diff --git a/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/INSTALLER b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/INSTALLER @@ -0,0 +1 @@ +uv \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/METADATA b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..3828df1b3590a55c1b9706574b3222ecb9f4d2c9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/METADATA @@ -0,0 +1,46 @@ +Metadata-Version: 2.4 +Name: cuda-bindings +Version: 13.2.0 +Summary: Python bindings for CUDA +Author-email: NVIDIA Corporation +License-Expression: LicenseRef-NVIDIA-SOFTWARE-LICENSE +Project-URL: Repository, https://github.com/NVIDIA/cuda-python +Project-URL: Documentation, https://nvidia.github.io/cuda-python/ +Classifier: Intended Audience :: Developers +Classifier: Topic :: Database +Classifier: Topic :: Scientific/Engineering +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Environment :: GPU :: NVIDIA CUDA +Requires-Python: >=3.10 +Description-Content-Type: text/x-rst +License-File: LICENSE +Requires-Dist: cuda-pathfinder~=1.1 +Provides-Extra: all +Requires-Dist: cuda-toolkit[nvfatbin,nvjitlink,nvrtc,nvvm]==13.*; extra == "all" +Requires-Dist: cuda-toolkit[cufile]==13.*; sys_platform == "linux" and extra == "all" +Dynamic: license-file + +.. SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE + +**************************************** +cuda-bindings: Low-level CUDA interfaces +**************************************** + +.. image:: https://img.shields.io/badge/NVIDIA-black?logo=nvidia + :target: https://www.nvidia.com/ + :alt: NVIDIA + +`cuda.bindings `_ is a standard set of low-level interfaces, providing full coverage of and 1:1 access to the CUDA host APIs from Python. Checkout the `Overview `_ for the workflow and performance results. + +* `Repository `_ +* `Documentation `_ +* `Examples `_ +* `Issue tracker `_ + +For the installation instruction, please refer to the `Installation `_ page. diff --git a/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/RECORD b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..e84a3de0cb74d23ca0dfcb41fff8e589d44eeedb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/RECORD @@ -0,0 +1,83 @@ +cuda/bindings/__init__.pxd,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +cuda/bindings/__init__.py,sha256=MwaiGzsnjQRwjtwFMGS36SnuaElYmFDh_VOT5vAvzhI,246 +cuda/bindings/_bindings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +cuda/bindings/_bindings/cydriver.cpython-310-x86_64-linux-gnu.so,sha256=gx7Z13YXH8qNiBZXzbPF1LTdJwLxa6kUZgeWOW2-6NI,467496 +cuda/bindings/_bindings/cydriver.pxd,sha256=Q_y7-jIEt7fWWCfYqXQZyeDiHPE-5uIXSYMUJflx1jo,68771 +cuda/bindings/_bindings/cynvrtc.cpython-310-x86_64-linux-gnu.so,sha256=uZNmLeP9OPLMUZcOanbgJsuORspQAaCaDYELbcfhZV0,82568 +cuda/bindings/_bindings/cynvrtc.pxd,sha256=Wo9QkstkK7t2ElKgRcpwe-0CRpO5jW2LLa6tyLYGD_I,3297 +cuda/bindings/_bindings/cyruntime.cpython-310-x86_64-linux-gnu.so,sha256=BO6x-aR0kqOAsW_HP5lAMphcNehespeEz8VLJZsHdE0,933776 +cuda/bindings/_bindings/cyruntime.pxd,sha256=UiIClazo-MgORJ2aAai8eqpJ6I59BuulfQKHYp1sxCo,51329 +cuda/bindings/_bindings/cyruntime_ptds.cpython-310-x86_64-linux-gnu.so,sha256=p1vJHC-DKQ4KmOEW50UUD_UoIzErXx6PY88am19TXm8,791632 +cuda/bindings/_bindings/cyruntime_ptds.pxd,sha256=9yYJOapFGTXpVPTCYbZ9We1DlL83L99RZdLunC-ptXg,51371 +cuda/bindings/_bindings/loader.h,sha256=nv8OzG_tSP4jszgK5o4-ELSW6K1iZEwaEekIECjP1dA,545 +cuda/bindings/_bindings/loader.pxd,sha256=vBMdQU-VrGguCEW58Y8V2HRzaUh5DDC0NkNWLJ_silI,252 +cuda/bindings/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +cuda/bindings/_internal/_fast_enum.py,sha256=kuBsYOZ-dKPLegjNdeFIGiX79zGapvmjDEfQo_SZZmA,2331 +cuda/bindings/_internal/cufile.cpython-310-x86_64-linux-gnu.so,sha256=Piod44hSJksVao3_pYN9s15tgrehd0_4_A9OFzBvRIc,103400 +cuda/bindings/_internal/cufile.pxd,sha256=xfyg-AsFaZPGSB4sYyyvbWfsE1Cpa9gcvo8ZnQBLOys,5985 +cuda/bindings/_internal/nvfatbin.cpython-310-x86_64-linux-gnu.so,sha256=uWwIkY215gpKUDvRxEZ0qeYsEabyiGL54_oEwNaXdnw,70280 +cuda/bindings/_internal/nvfatbin.pxd,sha256=-d4BC_Hoqggc6EcTB85gYLMHz9YNqWujZiACsLjCW7A,2224 +cuda/bindings/_internal/nvjitlink.cpython-310-x86_64-linux-gnu.so,sha256=JIkZVZFpD21gu3hZd0HbuvzO1ReXoEm2cc2ea3d0caI,74376 +cuda/bindings/_internal/nvjitlink.pxd,sha256=kCt6Qqwi11RNNT7akUxNE8RgYwyST4lzjO6r2b0Ms2Y,2507 +cuda/bindings/_internal/nvml.cpython-310-x86_64-linux-gnu.so,sha256=uf5fWT2RjKAAH7j2UrhJD5okw7JeiqPUs7tDuOgj2EQ,445768 +cuda/bindings/_internal/nvml.pxd,sha256=yACnUUOAAzJ-uOnSqtouTA3McwtMdyw2000Zt84n31U,56153 +cuda/bindings/_internal/nvvm.cpython-310-x86_64-linux-gnu.so,sha256=C_AMLPzbdvknzwJp1ykMZBw8lCXbCp5Zyz3KEPMMKoI,74376 +cuda/bindings/_internal/nvvm.pxd,sha256=l9723vL2xP3iQoNlY9rbJVyEvf0rOhprWzLAngQEmg8,2131 +cuda/bindings/_internal/utils.cpython-310-x86_64-linux-gnu.so,sha256=RiGpv6uG1cepcXDNbG2RAckZq3kgC-Y3MyLAOLm9N7M,127968 +cuda/bindings/_internal/utils.pxd,sha256=LlAp7vAy5_7XqZ8IIc0dCW0duu01V3aPt8seqgx37VM,4669 +cuda/bindings/_lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +cuda/bindings/_lib/cyruntime/cyruntime.pxd,sha256=icR65C-YpWJ59uyCRMRg_wGbqNGt6qPQLh2ksFkuTis,4785 +cuda/bindings/_lib/cyruntime/cyruntime.pxi,sha256=xQGllvLx76JE8WEeKS3LjOungvwj335nP6QNmKulr8c,88191 +cuda/bindings/_lib/dlfcn.pxd,sha256=Hey780RLtX6IQwca7kzsBnoMJ6CsizjfaKtcY240GrE,406 +cuda/bindings/_lib/param_packer.h,sha256=ITzzEtJ4ykPY1Py7_SPlf8u1gY9tUlAelvQ6Z3b0vkc,6031 +cuda/bindings/_lib/param_packer.pxd,sha256=9dAhnMLzwYbdDhdiTW6EFXRPfIE5wvfnKwoZTVIhjgs,374 +cuda/bindings/_lib/utils.pxd,sha256=WxVRuS8qEv9Bn7JNAoL6vswIlMzVhJhsEAWW-1TVWPg,3799 +cuda/bindings/_lib/utils.pxi,sha256=m_ExKSMLe3-SUSIeI0pk5l399Cu9vZbI7AXvyIga3I4,31414 +cuda/bindings/_lib/windll.pxd,sha256=oOzOOJ_hpQNVnqareRx3h_ctJI_zpebBDfaRhxtpSk8,1445 +cuda/bindings/_test_helpers/__init__.py,sha256=cgHj5gSAhwMG-0TGW_v4V-rrqaPQqtshVyKh_WiQpEg,401 +cuda/bindings/_test_helpers/arch_check.py,sha256=5JybKYuYW2h6wxcyUG5Erp9LIYKUp-58KnvLqaxsVXs,2515 +cuda/bindings/_version.py,sha256=YmFawMiMsMMopNM_zwbeX2OsUEwuEcxqVTzLAximZ_s,714 +cuda/bindings/cufile.cpython-310-x86_64-linux-gnu.so,sha256=Unm5hc066Geyp6L83ZLPlQ1lVLe6XL-qJaYrkaSKxL8,769864 +cuda/bindings/cufile.pxd,sha256=OYdWHkVy-yXxJPo_NkcPRsqe5YU81ohUICMnPv7vuBE,3907 +cuda/bindings/cycufile.cpython-310-x86_64-linux-gnu.so,sha256=CuoSHIwZitLuULxwOlLYNL351brShP43UyTpy0nsZSw,32320 +cuda/bindings/cycufile.pxd,sha256=Gm_O-vlSmwsxW04z6JZyuggA1j9kcQXGrtGPSyOO67E,18282 +cuda/bindings/cydriver.cpython-310-x86_64-linux-gnu.so,sha256=N5TdLPRUg_nlmXBg31iOv6Q75j-F1j4dQK-C1crh-mI,162368 +cuda/bindings/cydriver.pxd,sha256=Z7yWt_UQHuxVUq1o60SHpRKyR0dXkq2Ky_aP2YlkyIw,167883 +cuda/bindings/cynvfatbin.cpython-310-x86_64-linux-gnu.so,sha256=0nmk8WPhuT-b8PuyQrSICK-ZXxeQY5evSVgywhfPAkk,23424 +cuda/bindings/cynvfatbin.pxd,sha256=P1a8P27aWe_CG62kEyPJxnCUU0YTykC_WZ8X26MFFKI,3834 +cuda/bindings/cynvjitlink.cpython-310-x86_64-linux-gnu.so,sha256=FUpqZU4wUwkg1RYOmBfhsA8FB1WxA5agr9wyVzURUxc,23424 +cuda/bindings/cynvjitlink.pxd,sha256=bemcE-jn-T_4kDTiTRKDQwipqnIHIQtsILQGzyBrevU,4688 +cuda/bindings/cynvml.cpython-310-x86_64-linux-gnu.so,sha256=0_Uh-Z6Bf6b8bXau6pOIcmOEGqyRzOJSkNDi9uFmH3k,119040 +cuda/bindings/cynvml.pxd,sha256=6yvtCJdW3nphEUiMbR9TU2qIKHI3_igycaomck9GuLw,143031 +cuda/bindings/cynvrtc.cpython-310-x86_64-linux-gnu.so,sha256=peQEkg-Vv_NC_CrmHdXV4m-neyx2lqkFif65S_Me8d8,31616 +cuda/bindings/cynvrtc.pxd,sha256=_Z60qpczpJKLmBlhyNsMBnFdfDghfQiDyI7YyunIQz8,4228 +cuda/bindings/cynvvm.cpython-310-x86_64-linux-gnu.so,sha256=f1tGYAh8jSjCGshCFDn4LOKFUkX0evVIJiTaVIrl3jg,23424 +cuda/bindings/cynvvm.pxd,sha256=dyeql6-YjzOwzUaL0U4HvxHDGgSMomy7ynSRi98JLUY,3131 +cuda/bindings/cyruntime.cpython-310-x86_64-linux-gnu.so,sha256=L_2xinFSFokr3ROC0CGMJ5slbdwl_ww-v8VGt-nqz34,123200 +cuda/bindings/cyruntime.pxd,sha256=1_ZCuRPHCYA99HYsso0CSduC8jCN3YoV2TxGUHwntQI,64867 +cuda/bindings/cyruntime_functions.pxi,sha256=CuFzgwlbVfky7aR7K7RVmPPfHeLxHgE8QEhK16eE0XY,38120 +cuda/bindings/cyruntime_types.pxi,sha256=LQ3cnvX6aoTc2uaVdxTgdOGx21a1lkvtSufI2XSya8c,57832 +cuda/bindings/driver.cpython-310-x86_64-linux-gnu.so,sha256=JdBqHTErsoW6eWRBEIMMJx8OrvHDfl1ETJniEe4on3Q,7450144 +cuda/bindings/driver.pxd,sha256=60F-C8zO3DRRtDxJwYr_H1wbYHlLTJx1J_nXcP0qhMs,215545 +cuda/bindings/nvfatbin.cpython-310-x86_64-linux-gnu.so,sha256=3sUQrpFDf3KrE6n_PMRzcOCIkfsfIWrbj-8GDFRgiDg,107752 +cuda/bindings/nvfatbin.pxd,sha256=abT8l_ivuJIKAhkrNUmSPqZZ_qEsuTab2SeAbXwxEjE,1512 +cuda/bindings/nvjitlink.cpython-310-x86_64-linux-gnu.so,sha256=1gAYmOtvD1ZQl4G4oJOEU6A6SgSeY25XyiaWU3zuixs,107848 +cuda/bindings/nvjitlink.pxd,sha256=18kkQ37F4qhP7bSV2bNZPaDLgj7zq-kefVQJUd2v0as,1675 +cuda/bindings/nvml.cpython-310-x86_64-linux-gnu.so,sha256=VD2roOMKHbUq6PoL_7cVqMcAbDtDf09PTbMbCwnhWKg,4557992 +cuda/bindings/nvml.pxd,sha256=sdXyWvqrVdwYpXRf6RMa-SoYjSLKtBijF3En9hsQBjk,27138 +cuda/bindings/nvrtc.cpython-310-x86_64-linux-gnu.so,sha256=6vTWf0GSM0j9T1CjGNqUMW6pOCMM1c-nELJBgs81CQo,407904 +cuda/bindings/nvrtc.pxd,sha256=y70KzZ9RSfbPdQuMgwh6wIJL5S5xPZah3D8badAnd1o,786 +cuda/bindings/nvvm.cpython-310-x86_64-linux-gnu.so,sha256=txM16Wv9p_pWVizsIua5mKvHtz_tXfUomT4w5QOwEwE,99624 +cuda/bindings/nvvm.pxd,sha256=9cRYfaRYN-C8hYZLYc322on9UhwBGOsqjGff9Hq6XIs,1561 +cuda/bindings/runtime.cpython-310-x86_64-linux-gnu.so,sha256=-s35Y_suz3L8ZZoizPcBGj8mw1pH8NRGV01eOzprEco,5481376 +cuda/bindings/runtime.pxd,sha256=hyJPpmaIRsZCiHzvPHCAzIFy5XwbOJWvqkGGcxqgImw,110880 +cuda/bindings/utils/__init__.py,sha256=ZBltMPUI7GQbJLp_5mnRb8LkrgGKoiJFXZmTCyXUNnM,942 +cuda/bindings/utils/_ptx_utils.py,sha256=XsRSXDVnuFfQEF-xDcbU_A2LRZg_CdKZscMzuRw-ZTY,3225 +cuda/bindings/utils/_version_check.py,sha256=Wr-o20azz3b2wiWUrhUyzwd3RHEFBMpkbgz-6sPf_mE,2397 +cuda_bindings-13.2.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +cuda_bindings-13.2.0.dist-info/METADATA,sha256=OPFWg1a0gffJ_ISgNrrF__6YluqHVt4GEesTycDFqmk,2329 +cuda_bindings-13.2.0.dist-info/RECORD,, +cuda_bindings-13.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +cuda_bindings-13.2.0.dist-info/WHEEL,sha256=S0pQMymC1j_8kzFFYlJhYuLNt_1tCrGh0xqUbgWKCIg,152 +cuda_bindings-13.2.0.dist-info/licenses/LICENSE,sha256=gHsN94kFVQ3-fC6hFBTLdOonjuxnrXrsJxtPC3MAy9M,11076 +cuda_bindings-13.2.0.dist-info/top_level.txt,sha256=U5vpnvwNpaJF8bl4KnoUluMDTRt0J972FipwXjgNQ3A,5 diff --git a/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/REQUESTED b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/WHEEL b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..7adf69579a47b733ba1620e7c5bb36d159377136 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: setuptools (13.2.0) +Root-Is-Purelib: false +Tag: cp310-cp310-manylinux_2_24_x86_64 +Tag: cp310-cp310-manylinux_2_28_x86_64 + diff --git a/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/licenses/LICENSE b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..a5a65097cdc5e452ffd79974f1d7621c06ddbd1f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/licenses/LICENSE @@ -0,0 +1,48 @@ +NVIDIA SOFTWARE LICENSE + +This license is a legal agreement between you and NVIDIA Corporation ("NVIDIA") and governs your use of the NVIDIA CUDA Python software and materials provided hereunder ("SOFTWARE"). + +This license can be accepted only by an adult of legal age of majority in the country in which the SOFTWARE is used. If you are under the legal age of majority, you must ask your parent or legal guardian to consent to this license. By taking delivery of the SOFTWARE, you affirm that you have reached the legal age of majority, you accept the terms of this license, and you take legal and financial responsibility for the actions of your permitted users. + +You agree to use the SOFTWARE only for purposes that are permitted by (a) this license, and (b) any applicable law, regulation or generally accepted practices or guidelines in the relevant jurisdictions. + +1. LICENSE. Subject to the terms of this license, NVIDIA grants you a non-exclusive limited license to: (a) install and use the SOFTWARE, and (b) distribute the SOFTWARE subject to the distribution requirements described in this license. NVIDIA reserves all rights, title and interest in and to the SOFTWARE not expressly granted to you under this license. + +2. DISTRIBUTION REQUIREMENTS. These are the distribution requirements for you to exercise the distribution grant: +a. The terms under which you distribute the SOFTWARE must be consistent with the terms of this license, including (without limitation) terms relating to the license grant and license restrictions and protection of NVIDIA's intellectual property rights. +b. You agree to notify NVIDIA in writing of any known or suspected distribution or use of the SOFTWARE not in compliance with the requirements of this license, and to enforce the terms of your agreements with respect to distributed SOFTWARE. + +3. LIMITATIONS. Your license to use the SOFTWARE is restricted as follows: +a. The SOFTWARE is licensed for you to develop applications only for use in systems with NVIDIA GPUs. +b. You may not reverse engineer, decompile or disassemble, or remove copyright or other proprietary notices from any portion of the SOFTWARE or copies of the SOFTWARE. +c. You may not modify or create derivative works of any portion of the SOFTWARE. +d. You may not bypass, disable, or circumvent any technical measure, encryption, security, digital rights management or authentication mechanism in the SOFTWARE. +e. You may not use the SOFTWARE in any manner that would cause it to become subject to an open source software license. As examples, licenses that require as a condition of use, modification, and/or distribution that the SOFTWARE be (i) disclosed or distributed in source code form; (ii) licensed for the purpose of making derivative works; or (iii) redistributable at no charge. +f. Unless you have an agreement with NVIDIA for this purpose, you may not use the SOFTWARE with any system or application where the use or failure of the system or application can reasonably be expected to threaten or result in personal injury, death, or catastrophic loss. Examples include use in avionics, navigation, military, medical, life support or other life critical applications. NVIDIA does not design, test or manufacture the SOFTWARE for these critical uses and NVIDIA shall not be liable to you or any third party, in whole or in part, for any claims or damages arising from such uses. +g. You agree to defend, indemnify and hold harmless NVIDIA and its affiliates, and their respective employees, contractors, agents, officers and directors, from and against any and all claims, damages, obligations, losses, liabilities, costs or debt, fines, restitutions and expenses (including but not limited to attorney's fees and costs incident to establishing the right of indemnification) arising out of or related to use of the SOFTWARE outside of the scope of this Agreement, or not in compliance with its terms. + +4. PRE-RELEASE. SOFTWARE versions identified as alpha, beta, preview, early access or otherwise as pre-release may not be fully functional, may contain errors or design flaws, and may have reduced or different security, privacy, availability, and reliability standards relative to commercial versions of NVIDIA software and materials. You may use a pre-release SOFTWARE version at your own risk, understanding that these versions are not intended for use in production or business-critical systems. + +5. OWNERSHIP. The SOFTWARE and the related intellectual property rights therein are and will remain the sole and exclusive property of NVIDIA or its licensors. The SOFTWARE is copyrighted and protected by the laws of the United States and other countries, and international treaty provisions. NVIDIA may make changes to the SOFTWARE, at any time without notice, but is not obligated to support or update the SOFTWARE. + +6. COMPONENTS UNDER OTHER LICENSES. The SOFTWARE may include NVIDIA or third-party components with separate legal notices or terms as may be described in proprietary notices accompanying the SOFTWARE. If and to the extent there is a conflict between the terms in this license and the license terms associated with a component, the license terms associated with the components control only to the extent necessary to resolve the conflict. + +7. FEEDBACK. You may, but don't have to, provide to NVIDIA any Feedback. "Feedback" means any suggestions, bug fixes, enhancements, modifications, feature requests or other feedback regarding the SOFTWARE. For any Feedback that you voluntarily provide, you hereby grant NVIDIA and its affiliates a perpetual, non-exclusive, worldwide, irrevocable license to use, reproduce, modify, license, sublicense (through multiple tiers of sublicensees), and distribute (through multiple tiers of distributors) the Feedback without the payment of any royalties or fees to you. NVIDIA will use Feedback at its choice. + +8. NO WARRANTIES. THE SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. NVIDIA DOES NOT WARRANT THAT THE SOFTWARE WILL MEET YOUR REQUIREMENTS OR THAT THE OPERATION THEREOF WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ALL ERRORS WILL BE CORRECTED. + +9. LIMITATIONS OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND ITS AFFILIATES SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR ANY LOST PROFITS, PROJECT DELAYS, LOSS OF USE, LOSS OF DATA OR LOSS OF GOODWILL, OR THE COSTS OF PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF OR IN CONNECTION WITH THIS LICENSE OR THE USE OR PERFORMANCE OF THE SOFTWARE, WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED UPON BREACH OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR THEORY OF LIABILITY, EVEN IF NVIDIA HAS PREVIOUSLY BEEN ADVISED OF, OR COULD REASONABLY HAVE FORESEEN, THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT WILL NVIDIA'S AND ITS AFFILIATES TOTAL CUMULATIVE LIABILITY UNDER OR ARISING OUT OF THIS LICENSE EXCEED US$10.00. THE NATURE OF THE LIABILITY OR THE NUMBER OF CLAIMS OR SUITS SHALL NOT ENLARGE OR EXTEND THIS LIMIT. + +10. TERMINATION. Your rights under this license will terminate automatically without notice from NVIDIA if you fail to comply with any term and condition of this license or if you commence or participate in any legal proceeding against NVIDIA with respect to the SOFTWARE. NVIDIA may terminate this license with advance written notice to you if NVIDIA decides to no longer provide the SOFTWARE in a country or, in NVIDIA's sole discretion, the continued use of it is no longer commercially viable. Upon any termination of this license, you agree to promptly discontinue use of the SOFTWARE and destroy all copies in your possession or control. Your prior distributions in accordance with this license are not affected by the termination of this license. All provisions of this license will survive termination, except for the license granted to you. + +11. APPLICABLE LAW. This license will be governed in all respects by the laws of the United States and of the State of Delaware as those laws are applied to contracts entered into and performed entirely within Delaware by Delaware residents, without regard to the conflicts of laws principles. The United Nations Convention on Contracts for the International Sale of Goods is specifically disclaimed. You agree to all terms of this Agreement in the English language. The state or federal courts residing in Santa Clara County, California shall have exclusive jurisdiction over any dispute or claim arising out of this license. Notwithstanding this, you agree that NVIDIA shall still be allowed to apply for injunctive remedies or an equivalent type of urgent legal relief in any jurisdiction. + +12. NO ASSIGNMENT. This license and your rights and obligations thereunder may not be assigned by you by any means or operation of law without NVIDIA's permission. Any attempted assignment not approved by NVIDIA in writing shall be void and of no effect. + +13. EXPORT. The SOFTWARE is subject to United States export laws and regulations. You agree that you will not ship, transfer or export the SOFTWARE into any country, or use the SOFTWARE in any manner, prohibited by the United States Bureau of Industry and Security or economic sanctions regulations administered by the U.S. Department of Treasury's Office of Foreign Assets Control (OFAC), or any applicable export laws, restrictions or regulations. These laws include restrictions on destinations, end users and end use. By accepting this license, you confirm that you are not a resident or citizen of any country currently embargoed by the U.S. and that you are not otherwise prohibited from receiving the SOFTWARE. + +14. GOVERNMENT USE. The SOFTWARE has been developed entirely at private expense and is "commercial items" consisting of "commercial computer software" and "commercial computer software documentation" provided with RESTRICTED RIGHTS. Use, duplication or disclosure by the U.S. Government or a U.S. Government subcontractor is subject to the restrictions in this license pursuant to DFARS 227.7202-3(a) or as set forth in subparagraphs (b)(1) and (2) of the Commercial Computer Software - Restricted Rights clause at FAR 52.227-19, as applicable. Contractor/manufacturer is NVIDIA, 2788 San Tomas Expressway, Santa Clara, CA 95051. + +15. ENTIRE AGREEMENT. This license is the final, complete and exclusive agreement between the parties relating to the subject matter of this license and supersedes all prior or contemporaneous understandings and agreements relating to this subject matter, whether oral or written. If any court of competent jurisdiction determines that any provision of this license is illegal, invalid or unenforceable, the remaining provisions will remain in full force and effect. This license may only be modified in a writing signed by an authorized representative of each party. + +(v. May 12, 2021) diff --git a/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/top_level.txt b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..089f044f442ab95aabf9de9eb52b63efbac9f7b9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/cuda_bindings-13.2.0.dist-info/top_level.txt @@ -0,0 +1 @@ +cuda diff --git a/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/INSTALLER b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/INSTALLER @@ -0,0 +1 @@ +uv \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/METADATA b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..7f8d2528e248ae818335e36b1bdccd74a03a8ec0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/METADATA @@ -0,0 +1,169 @@ +Metadata-Version: 2.4 +Name: fastmcp +Version: 3.2.4 +Summary: The fast, Pythonic way to build MCP servers and clients. +Project-URL: Homepage, https://gofastmcp.com +Project-URL: Repository, https://github.com/PrefectHQ/fastmcp +Project-URL: Documentation, https://gofastmcp.com +Author: Jeremiah Lowin +License-Expression: Apache-2.0 +License-File: LICENSE +Keywords: agent,fastmcp,llm,mcp,mcp client,mcp server,model context protocol +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence +Classifier: Typing :: Typed +Requires-Python: >=3.10 +Requires-Dist: authlib>=1.6.5 +Requires-Dist: cyclopts>=4.0.0 +Requires-Dist: exceptiongroup>=1.2.2 +Requires-Dist: griffelib>=2.0.0 +Requires-Dist: httpx<1.0,>=0.28.1 +Requires-Dist: jsonref>=1.1.0 +Requires-Dist: jsonschema-path>=0.3.4 +Requires-Dist: mcp<2.0,>=1.24.0 +Requires-Dist: openapi-pydantic>=0.5.1 +Requires-Dist: opentelemetry-api>=1.20.0 +Requires-Dist: packaging>=24.0 +Requires-Dist: platformdirs>=4.0.0 +Requires-Dist: py-key-value-aio[filetree,keyring,memory]<0.5.0,>=0.4.4 +Requires-Dist: pydantic[email]>=2.11.7 +Requires-Dist: pyperclip>=1.9.0 +Requires-Dist: python-dotenv>=1.1.0 +Requires-Dist: pyyaml<7.0,>=6.0 +Requires-Dist: rich>=13.9.4 +Requires-Dist: uncalled-for>=0.2.0 +Requires-Dist: uvicorn>=0.35 +Requires-Dist: watchfiles>=1.0.0 +Requires-Dist: websockets>=15.0.1 +Provides-Extra: anthropic +Requires-Dist: anthropic>=0.48.0; extra == 'anthropic' +Provides-Extra: apps +Requires-Dist: prefab-ui>=0.18.0; extra == 'apps' +Provides-Extra: azure +Requires-Dist: azure-identity>=1.16.0; extra == 'azure' +Requires-Dist: pyjwt>=2.12.0; extra == 'azure' +Provides-Extra: code-mode +Requires-Dist: pydantic-monty==0.0.11; extra == 'code-mode' +Provides-Extra: gemini +Requires-Dist: google-genai>=1.18.0; extra == 'gemini' +Provides-Extra: openai +Requires-Dist: openai>=1.102.0; extra == 'openai' +Provides-Extra: tasks +Requires-Dist: pydocket>=0.19.0; extra == 'tasks' +Description-Content-Type: text/markdown + +
+ + + + + + + FastMCP Logo + + +# FastMCP 🚀 + +Move fast and make things. + +*Made with 💙 by [Prefect](https://www.prefect.io/)* + +[![Docs](https://img.shields.io/badge/docs-gofastmcp.com-blue)](https://gofastmcp.com) +[![Discord](https://img.shields.io/badge/community-discord-5865F2?logo=discord&logoColor=white)](https://discord.gg/uu8dJCgttd) +[![PyPI - Version](https://img.shields.io/pypi/v/fastmcp.svg)](https://pypi.org/project/fastmcp) +[![Tests](https://github.com/PrefectHQ/fastmcp/actions/workflows/run-tests.yml/badge.svg)](https://github.com/PrefectHQ/fastmcp/actions/workflows/run-tests.yml) +[![License](https://img.shields.io/github/license/PrefectHQ/fastmcp.svg)](https://github.com/PrefectHQ/fastmcp/blob/main/LICENSE) + +prefecthq%2Ffastmcp | Trendshift +
+ +--- + +The [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) connects LLMs to tools and data. FastMCP gives you everything you need to go from prototype to production: + +```python +from fastmcp import FastMCP + +mcp = FastMCP("Demo 🚀") + +@mcp.tool +def add(a: int, b: int) -> int: + """Add two numbers""" + return a + b + +if __name__ == "__main__": + mcp.run() +``` + +## Why FastMCP + +Building an effective MCP application is harder than it looks. FastMCP handles all of it. Declare a tool with a Python function, and the schema, validation, and documentation are generated automatically. Connect to a server with a URL, and transport negotiation, authentication, and protocol lifecycle are managed for you. You focus on your logic, and the MCP part just works: **with FastMCP, best practices are built in.** + +**That's why FastMCP is the standard framework for working with MCP.** FastMCP 1.0 was incorporated into the official MCP Python SDK in 2024. Today, the actively maintained standalone project is downloaded a million times a day, and some version of FastMCP powers 70% of MCP servers across all languages. + +FastMCP has three pillars: + + + + + + + +
+ +Servers +
Servers +
+
Expose tools, resources, and prompts to LLMs. +
+ +Apps +
Apps +
+
Give your tools interactive UIs rendered directly in the conversation. +
+ +Clients +
Clients +
+
Connect to any MCP server — local or remote, programmatic or CLI. +
+ +**[Servers](https://gofastmcp.com/servers/server)** wrap your Python functions into MCP-compliant tools, resources, and prompts. **[Clients](https://gofastmcp.com/clients/client)** connect to any server with full protocol support. And **[Apps](https://gofastmcp.com/apps/overview)** give your tools interactive UIs rendered directly in the conversation. + +Ready to build? Start with the [installation guide](https://gofastmcp.com/getting-started/installation) or jump straight to the [quickstart](https://gofastmcp.com/getting-started/quickstart). When you're ready to deploy, [Prefect Horizon](https://www.prefect.io/horizon) offers free hosting for FastMCP users. + +## Installation + +We recommend installing FastMCP with [uv](https://docs.astral.sh/uv/): + +```bash +uv pip install fastmcp +``` + +For full installation instructions, including verification and upgrading, see the [**Installation Guide**](https://gofastmcp.com/getting-started/installation). + +**Upgrading?** We have guides for: +- [Upgrading from FastMCP v2](https://gofastmcp.com/getting-started/upgrading/from-fastmcp-2) +- [Upgrading from the MCP Python SDK](https://gofastmcp.com/getting-started/upgrading/from-mcp-sdk) +- [Upgrading from the low-level SDK](https://gofastmcp.com/getting-started/upgrading/from-low-level-sdk) + +## 📚 Documentation + +FastMCP's complete documentation is available at **[gofastmcp.com](https://gofastmcp.com)**, including detailed guides, API references, and advanced patterns. + +Documentation is also available in [llms.txt format](https://llmstxt.org/), which is a simple markdown standard that LLMs can consume easily: + +- [`llms.txt`](https://gofastmcp.com/llms.txt) is essentially a sitemap, listing all the pages in the documentation. +- [`llms-full.txt`](https://gofastmcp.com/llms-full.txt) contains the entire documentation. Note this may exceed the context window of your LLM. + +**Community:** Join our [Discord server](https://discord.gg/uu8dJCgttd) to connect with other FastMCP developers and share what you're building. + +## Contributing + +We welcome contributions! See the [Contributing Guide](https://gofastmcp.com/development/contributing) for setup instructions, testing requirements, and PR guidelines. diff --git a/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/RECORD b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..449742a71d65cea20a5313498a9dc6f5fac5e487 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/RECORD @@ -0,0 +1,272 @@ +../../../bin/fastmcp,sha256=MfkjepFGdxQ2az0D_qPC5iwfRLdI8OK4u7PLyy3cxAM,366 +fastmcp-3.2.4.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +fastmcp-3.2.4.dist-info/METADATA,sha256=lynpS7SPSjNdo--BaPwEo3myU5Pr6U1E9HrAFWp0yzg,8138 +fastmcp-3.2.4.dist-info/RECORD,, +fastmcp-3.2.4.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +fastmcp-3.2.4.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87 +fastmcp-3.2.4.dist-info/entry_points.txt,sha256=ff8bMtKX1JvXyurMibAacMSKbJEPmac9ffAKU9mLnM8,44 +fastmcp-3.2.4.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356 +fastmcp/__init__.py,sha256=LkcO6la4rRaN92D_tPzSX-GmswQavh7ik6VMW0MkL8g,1598 +fastmcp/apps/__init__.py,sha256=qOKrdgOjpBTGemtb8TUvIb9efAJ5ULuktojGx2CjmIQ,930 +fastmcp/apps/app.py,sha256=4exo74XPWqIwOnO7_pfFvavXGR25ToZ23dkCIHOLkOk,14255 +fastmcp/apps/approval.py,sha256=2VPGYTrK5TouQ92MWM6lfmVcpcerc1pl231nc8-Vgs0,7041 +fastmcp/apps/choice.py,sha256=0hV23cvYk_LQ_LZlUR6UbmPNaf6jkCZFC0Yj_AILVAM,4538 +fastmcp/apps/config.py,sha256=j9Mas-IEsAcRTbQ7HJweI1AXwmXRX-YZ9HJGlnBJ-Xc,6292 +fastmcp/apps/file_upload.py,sha256=z18JoeTQhuUHreLN5wPM_4LTF63Fu_b_ZPEBlfuvw7M,14683 +fastmcp/apps/form.py,sha256=PlrtZ0RkeIa33Q_mu_ai936ebNRfUMlovhwdd1i93LQ,6699 +fastmcp/apps/generative.py,sha256=spMeJGGfgTpQpXv8K_g7WA9hnRyP9WPF5M3aaC91eeY,6512 +fastmcp/cli/__init__.py,sha256=Bo7WQWPBRQ6fqbYYPfbadefpXgl2h9gkdMaqTazGWyw,49 +fastmcp/cli/__main__.py,sha256=cGU_smvfctQI9xEY13u7tTEwwUI4AUieikXXA7ykYhA,69 +fastmcp/cli/apps_dev.py,sha256=JYqrIYpYL-tS83m2AKynTI4v5HqZg3Sh05MXtNfLGJo,70859 +fastmcp/cli/auth.py,sha256=yxi1hrwM0Mbftnywwr8LMUa9z8syKFxZWbkcSEFymfo,268 +fastmcp/cli/cimd.py,sha256=-vRuATr5d4JRcdUu1JFlnr7lTIJNJDRjBpKJdstpQQM,6592 +fastmcp/cli/cli.py,sha256=fJCC2kjxTc5nySwgfAfOOQw_BWdXB0sjINyej90abJo,37520 +fastmcp/cli/client.py,sha256=0inFgH1N8HYfA-wFyz5N2Vv2x9na3n_YB837RvQQpdQ,33729 +fastmcp/cli/discovery.py,sha256=QxwijtHMEzhcehAt-IHdMBbvJIdO_TAjfrA39MB0GKE,11953 +fastmcp/cli/generate.py,sha256=CXKkSoWDM7JyrHxAj88ArVp-qywePRDFfrF9Pu4ipRk,29290 +fastmcp/cli/install/__init__.py,sha256=MGRkPVKi7gjXi5yfhZ5-Y2WEHdyKTuPLMrq1rfhsJBs,961 +fastmcp/cli/install/claude_code.py,sha256=3yrnHApvUah-u_Vb4WNVLo_6w6vhP1cApAnaBMotyrM,7583 +fastmcp/cli/install/claude_desktop.py,sha256=0h_Z2MC31UqrTABIGbtlQzskC4wneBtgSdTjcnTbg3E,7483 +fastmcp/cli/install/cursor.py,sha256=hezQvFt3Er75DQrJDnOPNvzdSdK32ktk_pdtfhNWsmk,10226 +fastmcp/cli/install/gemini_cli.py,sha256=eqTtmzRbB9f-gtiNnBwMN05gn3UAuWVV-cV5CyIgl_E,7596 +fastmcp/cli/install/goose.py,sha256=JOX9zRzbc1m30QP9Msnm881T52dxyqy5ZUL5Mp9tRqQ,5971 +fastmcp/cli/install/mcp_json.py,sha256=yb3RCnZTyFK84UCjUcCBVCgS3BRqJk4-okBhoZenEkA,5764 +fastmcp/cli/install/shared.py,sha256=MqvwQJnth8HyGSuydS2o4_GodiX69yRv4oQnDJDKy3o,6990 +fastmcp/cli/install/stdio.py,sha256=s3zpDVQVbpUcMpcYyD6TQWT_OcBnwuEl8FSVhawMBE8,4766 +fastmcp/cli/run.py,sha256=G5Bvm781sA_n90zLzTy6fOwQwz3X5lA8KwONOFZhGVI,16119 +fastmcp/cli/tasks.py,sha256=B57vy76d3ybdi4wmlODRCCFrte1GmhLKqYixzRkGUuw,3791 +fastmcp/client/__init__.py,sha256=0GnysmzOcUCgjfSHSO9ruhiKEfPMVhvaP3x_7EUN0QQ,627 +fastmcp/client/auth/__init__.py,sha256=4DNsfp4iaQeBcpds0JDdMn6Mmfud44stWLsret0sVKY,91 +fastmcp/client/auth/bearer.py,sha256=MFEFqcH6u_V86msYiOsEFKN5ks1V9BnBNiPsPLHUTqo,399 +fastmcp/client/auth/oauth.py,sha256=IR1AcvtOY3tqEbD11eRCarcDr4fPzcgfuL5vCMpekcw,17556 +fastmcp/client/client.py,sha256=ctvCg7YhW38cwHPy-x56OPMtQ2RXXTeR1XmCnETPLT0,34861 +fastmcp/client/elicitation.py,sha256=sJcCdKpsFThFkxIqhN6nYTW0hCqVg5E9flTWPswZFII,3459 +fastmcp/client/logging.py,sha256=WBByRoBIB-Bl3ZUJVFvHqRt4teYPAvqC8MnJ358Elg8,1939 +fastmcp/client/messages.py,sha256=ROe6mlBBHPo1OQpvveRl2nYb2C98NE9B3368cd_6_Q4,4812 +fastmcp/client/mixins/__init__.py,sha256=xQrF4w5dI4V3CN9QDYoDrRmPUorcDL0JIhSWM1noarI,419 +fastmcp/client/mixins/prompts.py,sha256=QrGnUCqf5m5JudFP6Qb_9jqGi_psJh6ayUftjKOTpeM,12435 +fastmcp/client/mixins/resources.py,sha256=Nq-3p-m_OqRod9bbUw-A-as2j-EQI0L3XOLLozCh-tY,14518 +fastmcp/client/mixins/task_management.py,sha256=YWjDTtGD4mkVglvfwqtdd9h5FRyUX0xXQjM24d0QPo8,5759 +fastmcp/client/mixins/tools.py,sha256=k9K3mUjscpDD8Ct9WbluAJrWNs_WOZTlRT0ak7QfDH8,18448 +fastmcp/client/oauth_callback.py,sha256=5qx8F2zhoWT9yHG-QywfnfKuz8ZNWserz7SJsD_eM6s,7757 +fastmcp/client/progress.py,sha256=oFUL1yts_Th8ErHLvtZzYa8xYk-qncBBE9UX6dPEgXg,1187 +fastmcp/client/roots.py,sha256=Gi0-LVYp7YQ0aA8PPvTTn41nHPEPuU9VMkE4gSbSyz0,2657 +fastmcp/client/sampling/__init__.py,sha256=XN3brdKH3-vpr1UrKmXr1J59QSDZQEBmnWpNzOBQQGU,2272 +fastmcp/client/sampling/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +fastmcp/client/sampling/handlers/anthropic.py,sha256=mepyVC7Pn-s0EB0IVy9p9z_h1S3hJ9huq4Ze4-K6Rxc,16787 +fastmcp/client/sampling/handlers/google_genai.py,sha256=t5-jz8bwzzDxLVc5rLP5IJKaecPM92q0HZFz_VbLvsQ,13772 +fastmcp/client/sampling/handlers/openai.py,sha256=lkxjcX49FhHXu8KXfTMRwgjczVqpMtIJHlb65GaCZUQ,20270 +fastmcp/client/tasks.py,sha256=RPtpDr0hV1hgeJ1Y5C_V4HUqTWcbppsR1rTX5mqJlpQ,20418 +fastmcp/client/telemetry.py,sha256=2uoJABtLdUtbtJNO_snmqbZl_jon-oHBRDRVxRP5vzs,1375 +fastmcp/client/transports/__init__.py,sha256=Kyh1mSkkBqkKae_kpFjKLq-Unf4fwDZUEszedmJlUes,1104 +fastmcp/client/transports/base.py,sha256=sgg1d-Y3LVCrbsJnQ1JDXNZosSAmimBqbah4GyRpw7s,2621 +fastmcp/client/transports/config.py,sha256=1Xwp880iI1fAvXIqma_f8isMPXWuNh9J7wYG72YCZGg,8874 +fastmcp/client/transports/http.py,sha256=HQFPwRgpXqICEKVX7bGLV5NnKYw3F-SjlmROMhV830k,9081 +fastmcp/client/transports/inference.py,sha256=8jkqz2_9uDcIA2Hd3kALLCIFltiZ1Z_e9kub3d_VsZA,5374 +fastmcp/client/transports/memory.py,sha256=Ugm6TmKp54H7hoLzSYf6ssEQLY5pU3v86h3ZnojRRio,4184 +fastmcp/client/transports/sse.py,sha256=DoSri-EPThxzqwWTxLQC267kXS082SRVyuGYyclyEBQ,6284 +fastmcp/client/transports/stdio.py,sha256=jPcx5UMdqCGChJsgnJPm_qtND5CeCySPKPQKaPkdLwM,20565 +fastmcp/contrib/README.md,sha256=rKknYSI1T192UvSszqwwDlQ2eYQpxywrNTLoj177SYU,878 +fastmcp/contrib/bulk_tool_caller/README.md,sha256=5aUUY1TSFKtz1pvTLSDqkUCkGkuqMfMZNsLeaNqEgAc,1960 +fastmcp/contrib/bulk_tool_caller/__init__.py,sha256=xvGSSaUXTQrc31erBoi1Gh7BikgOliETDiYVTP3rLxY,75 +fastmcp/contrib/bulk_tool_caller/bulk_tool_caller.py,sha256=B4MaOrAwuevQ6YsVQDCvWlId_-n2SNrBKnBKohrnrTQ,4816 +fastmcp/contrib/bulk_tool_caller/example.py,sha256=6og_8pCJN_CabworC5R82zPAwwwM-W7HNJLQQSnS3lU,319 +fastmcp/contrib/component_manager/README.md,sha256=speekkx1S-4ZD1tNlgtW4qR82HzYwp-uaS3QfyTq9z8,4288 +fastmcp/contrib/component_manager/__init__.py,sha256=m-4nvgbOgINkZEKrR373cummQnhdXVg0LoBp716Sf98,96 +fastmcp/contrib/component_manager/component_manager.py,sha256=_TZtDuOq-zDVfCKvbpXQDWeELCVfvYBm3O6rJIVvxD4,4380 +fastmcp/contrib/component_manager/example.py,sha256=_kHuHRJHjCrzg54CuD5YX43SaopA_EC1cWAk7w3O_lw,1590 +fastmcp/contrib/mcp_mixin/README.md,sha256=f6ine6z9kuEx1qKhY9jzrH6sAwj1oWpXcLXGvK0GMVk,5404 +fastmcp/contrib/mcp_mixin/__init__.py,sha256=zZFHlAGexUJCDLAg4p7CGZDmb-mgPdN1xVv0tR4mg7I,153 +fastmcp/contrib/mcp_mixin/example.py,sha256=0hatqNQOXyCKcKrTe6b9Q3NG7cWDt3gHfiS-6vTLjY8,1239 +fastmcp/contrib/mcp_mixin/mcp_mixin.py,sha256=Bs3f6JGYKvuwiTAzUaGPXgN3Ey_0BwrJjfnFBelsULU,12706 +fastmcp/decorators.py,sha256=MTbqeKgd9JMRT3vmbPfrZgmYvWKa9Er3LNOIYH-W2YM,1320 +fastmcp/dependencies.py,sha256=fanlvin-NjeNy6PhbB0vGBti038Ng92InVRCKZubD4E,980 +fastmcp/exceptions.py,sha256=-kw0d1UC3RaCGzQs3NVlKnOPDuW6kcZAewmWacLRF1U,1134 +fastmcp/experimental/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +fastmcp/experimental/sampling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +fastmcp/experimental/sampling/handlers/__init__.py,sha256=cY6yyaI_DBx5NKH6t70tZQNjy1IEImbXV-VwKruk8UM,216 +fastmcp/experimental/sampling/handlers/openai.py,sha256=0HK7GX3hwz7PKkiObS7lYE_70ugZURC0I2_whxV7Ac0,223 +fastmcp/experimental/server/openapi/__init__.py,sha256=KymsmedsGHiqvYjJWMwS6yyogo8h_5tcmCDxSJMKbcU,1263 +fastmcp/experimental/transforms/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 +fastmcp/experimental/transforms/code_mode.py,sha256=7W0omeuX-gM9qZ0B2pPLjNvvs99giOzP1zbhjndqTaY,20721 +fastmcp/experimental/utilities/openapi/__init__.py,sha256=VhRbl-naljdXXyN7yDq4i91mpCEKJfOSQMKdlbMzehA,908 +fastmcp/mcp_config.py,sha256=00VqdcE_ERho0gBKaDWhfmDuvP5fhKD9txzRW1N7waU,12798 +fastmcp/prompts/__init__.py,sha256=6FwuG6LkO2OKqlJ1Bn-_8y3rgYT30kivpndeG4txATk,693 +fastmcp/prompts/base.py,sha256=ml04-77IIxaESAzZtLSzdRvHeI-Gt0phSnULXVIRwnw,14535 +fastmcp/prompts/function_prompt.py,sha256=tLbA23BIrmOSY6CJdl7J6kPcYSlFGAuZdH6a2AWjqwI,19865 +fastmcp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +fastmcp/resources/__init__.py,sha256=4wMpWrm4fIWzUZcska2UKGVEnpFShcQ2DBkI8RL4u54,957 +fastmcp/resources/base.py,sha256=9SxiytNRBvweefDgR8GmujHAUS5F3_PfxEH04L7bszk,17858 +fastmcp/resources/function_resource.py,sha256=1TDwJcVtB1eQVskhV2Wz18wIu2X0eQMnQwvLhvQiyt8,11793 +fastmcp/resources/template.py,sha256=i7NoobviGY6g8tKfcToTpzhjUP6eR5C0edOaR6Rqs0c,23962 +fastmcp/resources/types.py,sha256=f1_iIQM89g2w5I5XS3OMjg30zWt2RPUfUXnF0l4Y5W8,6107 +fastmcp/server/__init__.py,sha256=ObH0RRGGQBhqVq_g-9iXnFxrQDxF95db8dmyp_S2kUE,356 +fastmcp/server/app.py,sha256=1CRGUB6yTljLHPXWkbv98cYcox39o9-GMrLoAkFj6rU,593 +fastmcp/server/apps.py,sha256=69BBSVQ0SVjxxTewpXfj_Cd6yGad1lbedwudhM91hTU,835 +fastmcp/server/auth/__init__.py,sha256=xh3KBtYggQKUDTW1dYIqkskDmR3Vr0jvXy56XpkXwek,1961 +fastmcp/server/auth/auth.py,sha256=2NHSbX5A2i1v4scZHTzuKlHJTV8HB_PB28OcKQjsW7s,33781 +fastmcp/server/auth/authorization.py,sha256=Mf-mRQ07Tqgiqh4MgTOSRO1f0zy9J8VDGNJsfUlxHvo,5517 +fastmcp/server/auth/cimd.py,sha256=djgI3XjBQ7HHTKlvsPte4lBTpb0XOrEkr7B9ggLlIfg,28896 +fastmcp/server/auth/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +fastmcp/server/auth/handlers/authorize.py,sha256=1zrmXqRUhjiWSHgUhfj0CcCkj3uSlGkTnxHzaic0xYs,11617 +fastmcp/server/auth/jwt_issuer.py,sha256=oHsRd0nd8GiqPGOQvpry4zowg0_YXvyDkq5YPSU5MHE,8551 +fastmcp/server/auth/middleware.py,sha256=xwj3fUCLSlJK6n1Ehp-FN1qnjKqEz8b7LGAGMTqQ8Hk,3284 +fastmcp/server/auth/oauth_proxy/__init__.py,sha256=rCHQK6NNylTaQH4eCZ7m6T7isKppz-D1ehA-UuMrEBw,355 +fastmcp/server/auth/oauth_proxy/consent.py,sha256=EPFi5OhLFBD8ISVz505D2JftOGWPJ77g5bqQm-_dFzY,20664 +fastmcp/server/auth/oauth_proxy/models.py,sha256=qyjf76tYr_Z8ispQLgyOVGAiKafOjkI0Kc1wAjXbqI4,9493 +fastmcp/server/auth/oauth_proxy/proxy.py,sha256=xMg5gOSYxEJ0MwExJZyF8SSsHGyjKR2UVgiuyLmLGnc,93481 +fastmcp/server/auth/oauth_proxy/ui.py,sha256=zugejfQjsONciMhIW-_3mb5aWfhjEiJXJJttSnwsnoA,10271 +fastmcp/server/auth/oidc_proxy.py,sha256=LViIdGuAQV1AZztXTbhce-MkC8Dv8PpyNEsI3YMZdjA,22006 +fastmcp/server/auth/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +fastmcp/server/auth/providers/auth0.py,sha256=-DO8Rdnfj5GAStQFBmm-Rx5n-hqR-53aFzP5Zp51Ov8,5724 +fastmcp/server/auth/providers/aws.py,sha256=8RN4ygdzOAXLVpQhjnXvq2Fg6wlaaJ_jj3nhYDff64M,9613 +fastmcp/server/auth/providers/azure.py,sha256=zaQ6Te4GxWnRaNNuT6LAGUMPRsOkQcbOFNZHNqFt8w4,33592 +fastmcp/server/auth/providers/clerk.py,sha256=0tPK6TIMvC6p4s9cu62eAI90TQmq5jbxm6FqBtnT42U,17325 +fastmcp/server/auth/providers/debug.py,sha256=92erHZGQB1ATsl6PwrXui6h3WJ4wLxE9ACbI3JutmWY,3881 +fastmcp/server/auth/providers/descope.py,sha256=Xb_Bd8hKzXVrpB9AzqI2kYpiIxD-9crbIqWBnEz0Nws,9139 +fastmcp/server/auth/providers/discord.py,sha256=othAJb2GMyr-hg2W590PjPBlRRhWVF_i9Bxw3gEuBZM,12456 +fastmcp/server/auth/providers/github.py,sha256=fTIyp8EmPQNFnYrRyPYO9fD7oe_oN2F0FSKhusuQ_vE,13308 +fastmcp/server/auth/providers/google.py,sha256=KqMkwDRCLlQTMrE9wC8Jz80LS1OtZjqKuerdVozS3_U,16893 +fastmcp/server/auth/providers/in_memory.py,sha256=bb82_biQaWka-ODGJx5UkNyi6CHzqvI1LEkjTtnRGMo,15680 +fastmcp/server/auth/providers/introspection.py,sha256=dDXWIq3QV7RCjY48qR12kWKC75TbOmODUtvZzilXBdU,12479 +fastmcp/server/auth/providers/jwt.py,sha256=O00QA5-0Sxpx52JQmDbF_A4rWdMSTqrLqsBVHv_jT_0,22878 +fastmcp/server/auth/providers/keycloak.py,sha256=Sa2FcQYgQMalycN5HOvKeiC5Ks50C6403xvnT3XAgs4,2752 +fastmcp/server/auth/providers/oci.py,sha256=z4jAi5McZfBjXZTQlS6A_EJ_dk_MuOjW7pJdEZSNsvI,7812 +fastmcp/server/auth/providers/propelauth.py,sha256=UkPBBDETxZhL4_hK16DDQE6afhCly4uKMEva0ez4XwQ,9187 +fastmcp/server/auth/providers/scalekit.py,sha256=S-ofYu3fSchPigHCUO6hDUdto2eUfYZp168PKziLSL8,8740 +fastmcp/server/auth/providers/supabase.py,sha256=OzXFHaf7xiIjdr8tLpop7pX-Tp5qLUfPQNZ9vAxyy4w,7740 +fastmcp/server/auth/providers/workos.py,sha256=3RiwahX7jJ3LS5G2YIJsx4Uj70BD-yKyy311V__wWoM,18863 +fastmcp/server/auth/redirect_validation.py,sha256=ymTYbwSS80ORgAB67StxuUV1y_CIreKIpFqOqwEQ5YI,7237 +fastmcp/server/auth/ssrf.py,sha256=gHGZ8y4MOq-MaIc_hnixFgk12IRa_07eAe-urMZ-e_M,10987 +fastmcp/server/context.py,sha256=q3PcwLNnpaImNiVZjJMh2SEaVXhvkoj333IICL_mp7g,54579 +fastmcp/server/dependencies.py,sha256=kH3pOsNaXkY6fv-SsDZeDO_RVpjdIjb5cObgFbIYL-k,47404 +fastmcp/server/elicitation.py,sha256=QuyfkZKZKP6czNbwlv1DCikl2kdchscKL-P0pzz0oYg,19926 +fastmcp/server/event_store.py,sha256=aE-AvnefwLmo9_TqE79wJPXOar5ACfqpYpjB-htVlrA,6206 +fastmcp/server/http.py,sha256=j9KoNRfZBZXwepdeTXoA_59cHwmuTOxv6-r1aXlbY7A,13543 +fastmcp/server/lifespan.py,sha256=FkpUNI3KK8azA5x7WxbgedetEF-uFEUmyIRneXi4kKY,5927 +fastmcp/server/low_level.py,sha256=YlCi7awpuRfyYhai0_eIR_GfKLcO1x_NA9Imtfj-skY,13611 +fastmcp/server/middleware/__init__.py,sha256=3GacFe_Dxr3rUxpiZ4YMFBu4bWTknA7lhoBcSGa9DAE,274 +fastmcp/server/middleware/authorization.py,sha256=B_8w3t4Lk2lvRa6maDSOmUoMzNqzJUW_B96DxzjV9KU,11342 +fastmcp/server/middleware/caching.py,sha256=uNaZvKb0lcL87w9p96z8HM_I_hrR5QEYfvy7cCM2LAQ,20551 +fastmcp/server/middleware/dereference.py,sha256=dnMhYfvHX_rQ44cFnJMWPjtkOa0iCvh7RHP-SIRJPTU,2860 +fastmcp/server/middleware/error_handling.py,sha256=r_YsXNf5XAB5oEu8CBRUyDHul-QZyNMJtUAo3jRD98E,8566 +fastmcp/server/middleware/logging.py,sha256=1VZU8wU4iRTARUgv-uoygy_fxX8X-Q9ViQGrQi_gTMI,9457 +fastmcp/server/middleware/middleware.py,sha256=5gPo1gQqZ9cYtWmibzWe8XacWfpJP0maFC7PldfJw40,6535 +fastmcp/server/middleware/ping.py,sha256=ggVqOrLkU_Pci1EnwfNvkePZVcxPhsZ1IdAkpLe3s7o,2409 +fastmcp/server/middleware/rate_limiting.py,sha256=MwhMOhgsIhZjYwEQB8H8961hohV5564JlTwwYy_9ctU,7915 +fastmcp/server/middleware/response_limiting.py,sha256=rGq6Gf21YyxEURtPFqaNtWq2kH3fhSpeRibqffKNOTk,4738 +fastmcp/server/middleware/timing.py,sha256=lL_xc-ErLD5lplfvd5-HIyWEbZhgNBYkcQ74KFXAMkA,5591 +fastmcp/server/middleware/tool_injection.py,sha256=i5GXdOw_SEkqGjrjJBJA-ZOxRtYiYn1RfTPL2AqAHbI,4513 +fastmcp/server/mixins/__init__.py,sha256=vpfaDddmuwWQBB3g7cgSMZY4s0nWRqvfUtkPah8eAko,287 +fastmcp/server/mixins/lifespan.py,sha256=pqOCVaLRi52WPQbwxKVB2RUqiPZYKV248kPl-EigioM,9736 +fastmcp/server/mixins/mcp_operations.py,sha256=7ek2mlaPWygoslFKGFE7BCivenqRcuHlmwBJygHPZMk,15411 +fastmcp/server/mixins/transport.py,sha256=CJo8SndC2DtCHPGY3TcNZyAvDmteRfzwcimjwaspuqk,14537 +fastmcp/server/openapi/__init__.py,sha256=oofqqnJiIntpecKB4bHr9UIdE701QYgk9zA_6Mpu7no,1587 +fastmcp/server/openapi/components.py,sha256=oz3nvUaF9wo7UoiW8eHS__dUHax5P8xH2m1m4qgJqXM,693 +fastmcp/server/openapi/routing.py,sha256=tujysVY5jFm7HZYd3NMX99FXmVopTdqmwCh3LPXwN44,1245 +fastmcp/server/openapi/server.py,sha256=SHsph6E09XwLIAA9pcdzbMDtu4dxSp2owRWevL_6tRw,4010 +fastmcp/server/providers/__init__.py,sha256=Qqfg0iyJXzadeZPBF3yHJALVlbZiMx0k77CpHwJs4Jw,2313 +fastmcp/server/providers/addressing.py,sha256=4PG_c-FsmlBZkchckGe1YTtYHgiYqu8iobn1WLTvDQc,2611 +fastmcp/server/providers/aggregate.py,sha256=D7v1QrefX5EsYV4owFSrPOgQLQ6erfIirTdFNJNzVgc,12436 +fastmcp/server/providers/base.py,sha256=bq-U-noMQPA7ONq4bvtR7eZy1hPUGz3UISKtxAIezhg,23664 +fastmcp/server/providers/fastmcp_provider.py,sha256=op5aYeckMyy8ZlLg55FKN_C0k0HzPSknfrpZyWMFuJs,26456 +fastmcp/server/providers/filesystem.py,sha256=FYUUu-swjwDAJiy7KDXq-ATs7g52sXxdr4C2OK7Gzkc,8254 +fastmcp/server/providers/filesystem_discovery.py,sha256=z5qcyEWe9CuWrF8hYz-5F2sHmBt8ZOBf2ACc6Hxze2o,14132 +fastmcp/server/providers/local_provider/__init__.py,sha256=jYfatc5GN0doeiLCiP5K7ilqxnzc1iDdkhw7hIoOiuI,324 +fastmcp/server/providers/local_provider/decorators/__init__.py,sha256=WwBY7CLJ7YtcKzgz5-a-s0Bm9z8YGN8bYnQd2zabft8,401 +fastmcp/server/providers/local_provider/decorators/prompts.py,sha256=ukHORunbkdjaP9h4Ltq33hBFvGvmE7bUEtoGu-BDdcM,9668 +fastmcp/server/providers/local_provider/decorators/resources.py,sha256=qbTirudOg9XKzweXdJdCTiL-DL_lZ53oLcz0n6o8Sx4,9837 +fastmcp/server/providers/local_provider/decorators/tools.py,sha256=LQ7QQ2BSmh8llkjTiz69wA2TZ3mT1NhjKMRSA50ALXA,16177 +fastmcp/server/providers/local_provider/local_provider.py,sha256=R3V-fNZh2n-_N_qu8CM4ATf4bDojXB2ZC7mUS0mXxZA,17417 +fastmcp/server/providers/openapi/README.md,sha256=1Mc1Ur15OxMn-wAPEa1rZIiNNSMdv9sboQ3YpvNpUXM,9886 +fastmcp/server/providers/openapi/__init__.py,sha256=m1SR8ODlbo7HJ2xRmE_Hr0_vpjgU6bWG7KfduYGkmmA,948 +fastmcp/server/providers/openapi/components.py,sha256=gSZw3TrEhTxD2KxNUcq6bIeSwuDtazqLwnns1nfv-Zc,14415 +fastmcp/server/providers/openapi/provider.py,sha256=5j5woNrHfZYFPYNasxtSkZvs1euQo-VAs9717sick44,16246 +fastmcp/server/providers/openapi/routing.py,sha256=xfxcJAhpSKEwZWr2fi7xj_uTNl4P3Huyq0qv9r2dFns,3167 +fastmcp/server/providers/prefab_synthesis.py,sha256=tf_pKshPLOgIG1xks2aOIJFNHzZmiKZXbaT-NXARrCY,8606 +fastmcp/server/providers/proxy.py,sha256=PYc9tMasbwuIOsuUlyixcEwOgYN75PdxXhac6223w_c,43387 +fastmcp/server/providers/skills/__init__.py,sha256=juNaLg-SGgPf1a6IupzqGoIyvWa81s7CFDSl8ppMHdA,1839 +fastmcp/server/providers/skills/_common.py,sha256=mZmjg_TGBbgBr-KORHhDLRM8vYy3-jJqhcffnMsxY0Y,3353 +fastmcp/server/providers/skills/claude_provider.py,sha256=ZZ5MJZLzbyuPKolqZvi2tCYv4yhRuGGgdHi3LQjk124,1410 +fastmcp/server/providers/skills/directory_provider.py,sha256=j0c1SDjUAQp1k7nSKEBUaFL1PQhvojXv1yIzrSNid78,5856 +fastmcp/server/providers/skills/skill_provider.py,sha256=mLQITvmaX8U827odPjUQJUvF8MkWlKCQ22k8U5VaQAg,16119 +fastmcp/server/providers/skills/vendor_providers.py,sha256=JEhN0D-lyZf0tCvOsNo8hDMtYRL0noge9c6k2rjfVnw,3950 +fastmcp/server/providers/wrapped_provider.py,sha256=CwbZiyPcO1rbQojQdt1I35GkM8I-SBfZqvxLZddgezk,6219 +fastmcp/server/proxy.py,sha256=6MgnjANuFRfffuNQIG5lW39qU5DSFz2dpoFg9SLwRTY,1025 +fastmcp/server/sampling/__init__.py,sha256=u9jDHSE_yz6kTzbFqIOXqnM0PfIAiP-peAjHJBNqDd0,249 +fastmcp/server/sampling/run.py,sha256=sq2GGgUpoNO1nRq2abqiBgUJ8L3sBEyP4WbgZfcJL6g,27808 +fastmcp/server/sampling/sampling_tool.py,sha256=oIfEqdGSTKh8MpcP4yravMuVj79aZm4tqIrIMLBlfT0,7852 +fastmcp/server/server.py,sha256=qHl9fLCj27aD12OGikk6U9GqJKB3fsKXRraop6-VALE,95610 +fastmcp/server/tasks/__init__.py,sha256=6neQejS8iGptgOMrG5g11V0-nSFapS-VC3IrSpJ-goI,952 +fastmcp/server/tasks/capabilities.py,sha256=1Fm7Z8H4nNiaylvPHMQsLfLcVPQhMRsBiifNNoC5A4Q,1839 +fastmcp/server/tasks/config.py,sha256=DOAdIUyZ0mNfGqB8WwtEzUW-p8PEBJeCLyZwkW-qucw,5170 +fastmcp/server/tasks/context.py,sha256=1hf-ZWk-isHk3LgLXU9YExTdAMFZuU73xuRsxd5Cuc0,12787 +fastmcp/server/tasks/elicitation.py,sha256=61mKx5Iuxv8AGXFx7pPhzOkOSRX5Qan6AbSlaFbVsUM,11945 +fastmcp/server/tasks/handlers.py,sha256=R40GOE87a_OlJffVZ1GCSWYswsPrjudHxpzjmVFiQx8,9517 +fastmcp/server/tasks/keys.py,sha256=rm6OW4cGcbAjSCdbtSMGhDEYM17foE0hylevNeDcdGo,5494 +fastmcp/server/tasks/notifications.py,sha256=RT9aNzbg3gG_xQygJZ-OT7ai2FPdJ6CCcZqBhGVRZz8,11911 +fastmcp/server/tasks/requests.py,sha256=ZqKv-7-Btddi1_c3lTEvxNT54nhjrfOxE42jGWnp6nE,18175 +fastmcp/server/tasks/routing.py,sha256=tWyt9qBzvgoiJtgPwbzHUIBOSxkJp52VwIVf-JAHXhM,2587 +fastmcp/server/tasks/subscriptions.py,sha256=OeADhzkATV4lSjuM3TMQUyb4a4YPfM31vQqWu24pU3E,7624 +fastmcp/server/telemetry.py,sha256=cYBhUuMLbWmOe0tTF_9PrVBBNtZ1l7hcVwMM1hVrVKk,3929 +fastmcp/server/transforms/__init__.py,sha256=KiRD1bvCJw4mCVlOHH3Gf7CMUOnLnNEBD-pSk7U1_G0,7805 +fastmcp/server/transforms/catalog.py,sha256=LHaAdtb4jxqJTSj1ITrrsrZzdQlp5O-h5JxzdmCiuqI,9984 +fastmcp/server/transforms/namespace.py,sha256=t6Bb8e1I-KTZXR_IOgjLiltnGQCp9Fk35Ek_EDyjL1U,6691 +fastmcp/server/transforms/prompts_as_tools.py,sha256=-uBGbmSrv5ztwlnLkJIVQAqm5F4u1S0NTo1fzHLrPZ4,5680 +fastmcp/server/transforms/resources_as_tools.py,sha256=V0mHJTqDz_a7BJKAZyGPppDG4cPCYu3DFCCjM_I6iZI,6119 +fastmcp/server/transforms/search/__init__.py,sha256=OOkSUK7-nPDXLNSU5S04gG4Qk5YSo6WNieDAt2NbO6o,943 +fastmcp/server/transforms/search/base.py,sha256=_942ios0chanDhPXwKYra76IysCdyArngW_-_fiY8EI,10224 +fastmcp/server/transforms/search/bm25.py,sha256=aXzwV0X1mRYpEgUK8361NCFGis-yf7PoggjMza8uN7o,5256 +fastmcp/server/transforms/search/regex.py,sha256=2VyzJwZX5_EYeOJISkPa2S31usFp7reAB2NCUMT3sc4,1859 +fastmcp/server/transforms/tool_transform.py,sha256=KL91GXUHx4lArVXZ7REe0cSJw6H6bEWQPubmS4G7clA,3474 +fastmcp/server/transforms/version_filter.py,sha256=oZMY-KTFf7E9wxnoIdBPJnP7h3DDwHcKR-sHPZM3oQE,5238 +fastmcp/server/transforms/visibility.py,sha256=JmFs8V0JgPgr7UddKq1xoi-F3AeCbRapEqzwUz1vxsY,19100 +fastmcp/settings.py,sha256=qMF2AYB3NEnQ-j6ktF1qwMxufSu4GxxNwnyt8x89nz4,12143 +fastmcp/telemetry.py,sha256=O63vi3XAAp6gRy9QNA9hLq4KSpbl4hDZc9Z4ZNnUPbA,3822 +fastmcp/tools/__init__.py,sha256=Sthz_nus7soTubexXV433p8O4SimVF8WhxaUfmC_4GY,646 +fastmcp/tools/base.py,sha256=LMUTQqCriRiymZaKfPnn0gTfBYtt-UbSL6CPI6SC9S4,20902 +fastmcp/tools/function_parsing.py,sha256=ynWtkr9CzFcZwau4_oiswiQUo70x0lXk9W7Pok3w_7c,12389 +fastmcp/tools/function_tool.py,sha256=jBxX6eZVkTL-QgXFshqzUr8FQkpGz2bE9axMSkquMc8,17240 +fastmcp/tools/tool_transform.py,sha256=3ru-7CXHJqQG8NKUIQTH31HKpImYB_2RrkvTIt2tx5I,40561 +fastmcp/types.py,sha256=jMfvykSsBe4N1pLawAkakF8Ec3jIjNYEjzPnq3gW6Ys,771 +fastmcp/utilities/__init__.py,sha256=-imJ8S-rXmbXMWeDamldP-dHDqAPg_wwmPVz-LNX14E,31 +fastmcp/utilities/async_utils.py,sha256=1tFbwX7O51PNvLOF2Jz5-Cz2c9WozSex0xM5yBA0tJk,2465 +fastmcp/utilities/auth.py,sha256=e2PLw6RnyZ7CYvZYrsCl4ceVFLa3ckC6bn2Gv_xngxo,2671 +fastmcp/utilities/cli.py,sha256=nJWaknXR8MRdnFCHHN90yusMmN9ei0T1ls6DiGgXoW4,12039 +fastmcp/utilities/components.py,sha256=KQvMgJb3nsDWWyJygGxcRnJ1CgYCFsl3d2TWqH63IEY,9607 +fastmcp/utilities/docstring_parsing.py,sha256=chAVVx4R7pfCy-GWyR00LbxMmn0nDy6DdPcNBRpcf58,2259 +fastmcp/utilities/exceptions.py,sha256=7Z9j5IzM5rT27BC1Mcn8tkS-bjqCYqMKwb2MMTaxJYU,1350 +fastmcp/utilities/http.py,sha256=1ns1ymBS-WSxbZjGP6JYjSO52Wa_ls4j4WbnXiupoa4,245 +fastmcp/utilities/inspect.py,sha256=aaZHKd30x5eO-B5vZyftBQmalmngC2wURx0mhhuGLYg,17536 +fastmcp/utilities/json_schema.py,sha256=-ike0MNLzYDY1YLhJlZTsA419AcTcrEZ25FCYWMzZhI,27048 +fastmcp/utilities/json_schema_type.py,sha256=1IUWaEUbnYQa1Otvy6weJ11d9B-3p52UlhuryO87pA4,26262 +fastmcp/utilities/lifespan.py,sha256=QaMO7ibwP0Iys7CrPoi_ySX-qkwIB3yA8Gp-uLTF4cE,1880 +fastmcp/utilities/logging.py,sha256=n7Tl_IVPuULmaV_nIzpfbym1LdcHDAm2Ocol6LnKB_0,7548 +fastmcp/utilities/mcp_server_config/__init__.py,sha256=hHBxEwRsrgN0Q-1bvj28X6UVGDpfG6dt3yfSBGsOY80,791 +fastmcp/utilities/mcp_server_config/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +fastmcp/utilities/mcp_server_config/v1/environments/__init__.py,sha256=Tkv0dmJ6tKKotOBo-tho09QVdvEjy37iBsvBbEwH0EA,256 +fastmcp/utilities/mcp_server_config/v1/environments/base.py,sha256=fbC1C25jI1whwXLlIQtmji5B4UEHLgKvw5K8NICb33Y,826 +fastmcp/utilities/mcp_server_config/v1/environments/uv.py,sha256=DPVAXM5JDTN89wOSQsFnww4khRfNphXY2yzVeiKicNg,9755 +fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py,sha256=QJbvUV_tC2V6NCsrCGkS_yop_5oSs-0xDbY2BXiKuU8,15480 +fastmcp/utilities/mcp_server_config/v1/schema.json,sha256=ymDNFOWzcpnhIMeJmVPTw9b-NtHoHoru8Mc0WlSVxUY,8602 +fastmcp/utilities/mcp_server_config/v1/sources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +fastmcp/utilities/mcp_server_config/v1/sources/base.py,sha256=Y5MCxJyoDsaxcBN1zDL0CZtF5oAXxT_yqQOI-ze9b34,967 +fastmcp/utilities/mcp_server_config/v1/sources/filesystem.py,sha256=4kbwZ9sLxOKIHnXkxRnziTGck04yGlAe687g5YO_hm4,8104 +fastmcp/utilities/mime.py,sha256=mVJr2gpshSPuy1UL7XKgP4FeN5vKHsqocBIqWvjpoK0,847 +fastmcp/utilities/openapi/README.md,sha256=pcxMeSIHUmuhXHRYV7GOuMUZtw9QBv-rowQIDqmkab8,7657 +fastmcp/utilities/openapi/__init__.py,sha256=yDP3cjtluL9VaVq2cmGGDOWyFTLcbWo8boh8wS41q4M,1528 +fastmcp/utilities/openapi/director.py,sha256=lIcEq1ZedeBlBsZVg_aDZxT6erfnXv7EjoQYSPUyDYw,12850 +fastmcp/utilities/openapi/formatters.py,sha256=qyqqitbTxu2f7mVexcb54P19LA7t3OxCLd5ISD78SM4,14248 +fastmcp/utilities/openapi/json_schema_converter.py,sha256=4qSL8ZQb0IDlFRMH9c02hXjknYein4rMZq04N5t5Pss,13177 +fastmcp/utilities/openapi/models.py,sha256=-kfndwZSe92tVtKAgOuFn5rk1tN7oydCZKtLOEMEalA,2805 +fastmcp/utilities/openapi/parser.py,sha256=Ct3uWwXL0fqc6c01Xok3-zHtgUu-kN8mKN1E3EBfpkw,34569 +fastmcp/utilities/openapi/schemas.py,sha256=dzXgEDhlg3AVj43jgcIySZWfTN9PSy2rxXlBjgtuhwM,24083 +fastmcp/utilities/pagination.py,sha256=XFdlJulbexMjXsndjLJQ1NjH6qnZDLceMCHk-pEB0s0,2092 +fastmcp/utilities/skills.py,sha256=kpOkgScHPcxJ1HY5jIsTMovufae2cGvZ55qnarKae5A,7383 +fastmcp/utilities/tests.py,sha256=qNIiMnj5DwREXX4OwskRFQe4Wiv05GMkO5pd_PMfqyM,8772 +fastmcp/utilities/timeout.py,sha256=bhWCEvtKMeFLMJx8Za7-6IYaxi-O2y7ga6NZ4335LDc,1414 +fastmcp/utilities/token_cache.py,sha256=nYsLZgQomq5Dh2kXl_C3Ow34dWtOhCBi120dwytBYjs,5998 +fastmcp/utilities/types.py,sha256=D4bTZQs4MacDKXCeTlrhBEqhtxA41DC-ddIt_Ic5uXI,17807 +fastmcp/utilities/ui.py,sha256=gcnha7Vj4xEBxdrS83EZlKpN_43AQzcgiZFEvkTqzqg,14252 +fastmcp/utilities/version_check.py,sha256=zjY2HaSW4f09Gjun3V6TLyaeJC_ZPPf16VvQAdDigO8,4419 +fastmcp/utilities/versions.py,sha256=K5KMe47PqSM_pNxecIchLPFY-OdYzA1P_d_Cp-_3K0U,10541 diff --git a/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/REQUESTED b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/WHEEL b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..b1b94fd58e7e9ed0ef3449473bc48de68afcc3fe --- /dev/null +++ b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.29.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/entry_points.txt b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..829e525a543e9833c7453bd400e58a4da2f0466e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +fastmcp = fastmcp.cli:app diff --git a/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/licenses/LICENSE b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..f49a4e16e68b128803cc2dcea614603632b04eac --- /dev/null +++ b/.venv/lib/python3.10/site-packages/fastmcp-3.2.4.dist-info/licenses/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/AltairPlot-Cj80tEjo.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/AltairPlot-Cj80tEjo.js new file mode 100644 index 0000000000000000000000000000000000000000..c0d4ccfee5f7f49e5c2c42da2fc8e995b1938451 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/AltairPlot-Cj80tEjo.js @@ -0,0 +1,189 @@ +import{M as eh,p as Y3,a as K3,d as Jb,i as J3}from"./i18n-Dnhn5Rxr.js";import{R as Q3,w as Cn,aa as Z3,ae as eR,X as tR,a as Qb,T as nR,a5 as th,z as iR,x as Zb,V as ex,W as h2,u as tx,Y as nx,t as rR,a0 as sR}from"./index-DWyDLubb.js";import{g as aR}from"./color-DNxsOKs1.js";import{f as oR,m as uR,a as lR,d as cR,b as p2,q as ix,c as fR,i as dR,l as hR,e as pR,s as gR,g as mR,u as yR,h as g2,j as bR,k as xR,n as vR,o as ER,r as AR,t as CR,v as wR,w as FR,x as SR,y as $R,z as kR,A as DR,B as OR,C as RR,D as _R,E as TR,F as NR,G as MR,H as LR,I as BR,J as PR,K as IR,p as zR,$ as UR,L as m2,S as jR,M as y2,a4 as b2,N as qR,O as WR,P as GR,Q as HR,R as VR,T as XR,U as YR,V as KR,W as JR,X as QR,Y as ZR,Z as e5,_ as t5,a0 as n5,a1 as i5,a2 as r5,a3 as s5,a5,a6 as o5,a7 as u5,a8 as l5,a9 as c5,aa as f5,ab as d5,ac as h5,ad as p5,ae as g5,af as rx,ag as m5,ah as y5,ai as b5,aj as x5,ak as v5,al as E5,am as A5,an as C5,ao as w5,ap as F5,aq as S5,ar as $5,as as k5,at as nh}from"./mollweide-XXUPULVr.js";import{c as sx,x as ax,v as Gl,l as Hl,w as x2,d as v2,p as E2,s as A2,o as D5,n as O5,q as R5,u as _5,r as T5,y as N5,z as M5,b as L5,A as B5,B as P5,C as I5,a as Yo,m as z5,t as U5,D as j5,E as q5}from"./time-BMaLdJ6b.js";import{b as em,t as au,p as W5,d as G5,e as H5,f as C2,l as V5,g as X5,h as mc,i as Y5,j as K5,k as J5}from"./linear-8mDBZVC7.js";import{c as Q5,a as ox,f as Z5,b as e_}from"./defaultLocale-CzDG__Ur.js";import{d as t_}from"./dsv-DB8NKgIY.js";import{r as Ms}from"./range-OtVwhkKS.js";import{o as w2,i as n_}from"./ordinal-BeghXfj9.js";import{d as i_}from"./arc-Bt_eNeYl.js";import{l as r_,V as tm,D as s_,E as a_,F as o_,G as u_,H as l_,I as c_,J as f_,K as d_,L as h_,M as p_,N as g_,O as m_,P as y_,Q as b_,S as x_,T as v_,U as E_,k as A_,W as yc,X as C_}from"./step-B-Gbak1k.js";import{h as w_,t as F_,a as S_,b as $_,c as k_}from"./index-BU4IRnz1.js";import"./dispatch-kxCwF96_.js";import"./init-Dmth1JHB.js";import"./colors-Cc3OSVma.js";function D_(e,t,n,i){let r=t.getPropertyValue("--color-accent"),s=t.getPropertyValue("--body-text-color"),a=t.getPropertyValue("--border-color-primary"),o=t.fontFamily,u=t.getPropertyValue("--block-title-text-weight");const l=g=>g.endsWith("px")?parseFloat(g.slice(0,-2)):12;let c=l(t.getPropertyValue("--text-md")),f=l(t.getPropertyValue("--text-sm")),d={autosize:{type:"fit",contains:"padding"},axis:{labelFont:o,labelColor:s,titleFont:o,titleColor:s,tickColor:a,labelFontSize:f,gridColor:a,titleFontWeight:"normal",titleFontSize:f,labelFontWeight:"normal",domain:!1,labelAngle:0},legend:{labelColor:s,labelFont:o,titleColor:s,titleFont:o,titleFontWeight:"normal",titleFontSize:f,labelFontWeight:"normal",offset:2},title:{color:s,font:o,fontSize:c,fontWeight:u,anchor:"middle"},view:{stroke:a}};e.config=d;let p=e.encoding,h=e.layer;switch(n){case"scatter":e.config.mark={stroke:r},p.color&&p.color.type=="nominal"?p.color.scale.range=p.color.scale.range.map((g,m)=>ih(i,m)):p.color&&p.color.type=="quantitative"&&(p.color.scale.range=["#eff6ff","#1e3a8a"],p.color.scale.range.interpolate="hsl");break;case"line":e.config.mark={stroke:r,cursor:"crosshair"},h.forEach(g=>{g.encoding.color&&(g.encoding.color.scale.range=g.encoding.color.scale.range.map((m,y)=>ih(i,y)))});break;case"bar":e.config.mark={opacity:.8,fill:r},p.color&&(p.color.scale.range=p.color.scale.range.map((g,m)=>ih(i,m)));break}return e}function ih(e,t){let n=e[t%e.length];return n&&n in eh?eh[n]?.primary:n||eh[aR(t)].primary}function Vt(e,t,n){return e.fields=t||[],e.fname=n,e}function ze(e){return e==null?null:e.fname}function Et(e){return e==null?null:e.fields}function F2(e){return e.length===1?O_(e[0]):R_(e)}const O_=e=>function(t){return t[e]},R_=e=>{const t=e.length;return function(n){for(let i=0;ia?l():a=o+1:u==="["?(o>a&&l(),r=a=o+1):u==="]"&&(r||S("Access path missing open bracket: "+e),r>0&&l(),r=0,a=o+1)}return r&&S("Access path missing closing bracket: "+e),i&&S("Access path missing closing quote: "+e),o>a&&(o++,l()),t}function pn(e,t,n){const i=bi(e);return e=i.length===1?i[0]:e,Vt((n&&n.get||F2)(i),[e],t||e)}const Ru=pn("id"),$t=Vt(e=>e,[],"identity"),cr=Vt(()=>0,[],"zero"),Ha=Vt(()=>1,[],"one"),gn=Vt(()=>!0,[],"true"),ir=Vt(()=>!1,[],"false"),nm=new Set(Object.getOwnPropertyNames(Object.prototype));function __(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}const S2=0,im=1,rm=2,$2=3,k2=4;function sm(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:__,i=e||S2;return{level(r){return arguments.length?(i=+r,this):i},error(){return i>=im&&n(t||"error","ERROR",arguments),this},warn(){return i>=rm&&n(t||"warn","WARN",arguments),this},info(){return i>=$2&&n(t||"log","INFO",arguments),this},debug(){return i>=k2&&n(t||"log","DEBUG",arguments),this}}}var D=Array.isArray;function j(e){return e===Object(e)}const ux=e=>e!=="__proto__";function Va(){for(var e=arguments.length,t=new Array(e),n=0;n{for(const s in r)if(s==="signals")i.signals=T_(i.signals,r.signals);else{const a=s==="legend"?{layout:1}:s==="style"?!0:null;Xa(i,s,r[s],a)}return i},{})}function Xa(e,t,n,i){if(!ux(t))return;let r,s;if(j(n)&&!D(n)){s=j(e[t])?e[t]:e[t]={};for(r in n)i&&(i===!0||i[r])?Xa(s,r,n[r]):ux(r)&&(s[r]=n[r])}else e[t]=n}function T_(e,t){if(e==null)return t;const n={},i=[];function r(s){n[s.name]||(n[s.name]=1,i.push(s))}return t.forEach(r),e.forEach(r),i}function ce(e){return e[e.length-1]}function xt(e){return e==null||e===""?null:+e}const D2=e=>t=>e*Math.exp(t),O2=e=>t=>Math.log(e*t),R2=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),_2=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,bc=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function cf(e,t,n,i){const r=n(e[0]),s=n(ce(e)),a=(s-r)*t;return[i(r-a),i(s-a)]}function T2(e,t){return cf(e,t,xt,$t)}function N2(e,t){var n=Math.sign(e[0]);return cf(e,t,O2(n),D2(n))}function M2(e,t,n){return cf(e,t,bc(n),bc(1/n))}function L2(e,t,n){return cf(e,t,R2(n),_2(n))}function ff(e,t,n,i,r){const s=i(e[0]),a=i(ce(e)),o=t!=null?i(t):(s+a)/2;return[r(o+(s-o)*n),r(o+(a-o)*n)]}function am(e,t,n){return ff(e,t,n,xt,$t)}function om(e,t,n){const i=Math.sign(e[0]);return ff(e,t,n,O2(i),D2(i))}function xc(e,t,n,i){return ff(e,t,n,bc(i),bc(1/i))}function um(e,t,n,i){return ff(e,t,n,R2(i),_2(i))}function B2(e){return 1+~~(new Date(e).getMonth()/3)}function P2(e){return 1+~~(new Date(e).getUTCMonth()/3)}function W(e){return e!=null?D(e)?e:[e]:[]}function I2(e,t,n){let i=e[0],r=e[1],s;return r=n-t?[t,n]:[i=Math.min(Math.max(i,t),n-s),i+s]}function ae(e){return typeof e=="function"}const N_="descending";function lm(e,t,n){n=n||{},t=W(t)||[];const i=[],r=[],s={},a=n.comparator||M_;return W(e).forEach((o,u)=>{o!=null&&(i.push(t[u]===N_?-1:1),r.push(o=ae(o)?o:pn(o,null,n)),(Et(o)||[]).forEach(l=>s[l]=1))}),r.length===0?null:Vt(a(r,i),Object.keys(s))}const Ya=(e,t)=>(et||t==null)&&e!=null?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t===t?-1:t!==t&&e===e?1:0),M_=(e,t)=>e.length===1?L_(e[0],t[0]):B_(e,t,e.length),L_=(e,t)=>function(n,i){return Ya(e(n),e(i))*t},B_=(e,t,n)=>(t.push(0),function(i,r){let s,a=0,o=-1;for(;a===0&&++oe}function cm(e,t){let n;return i=>{n&&clearTimeout(n),n=setTimeout(()=>(t(i),n=null),e)}}function se(e){for(let t,n,i=1,r=arguments.length;ia&&(a=r))}else{for(r=t(e[n]);na&&(a=r))}return[s,a]}function z2(e,t){const n=e.length;let i=-1,r,s,a,o,u;if(t==null){for(;++i=s){r=a=s;break}if(i===n)return[-1,-1];for(o=u=i;++is&&(r=s,o=i),a=s){r=a=s;break}if(i===n)return[-1,-1];for(o=u=i;++is&&(r=s,o=i),a{r.set(s,e[s])}),r}function U2(e,t,n,i,r,s){if(!n&&n!==0)return s;const a=+n;let o=e[0],u=ce(e),l;us&&(a=r,r=s,s=a),n=n===void 0||n,i=i===void 0||i,(n?r<=e:ro.replace(/\\(.)/g,"$1")):W(e));const i=e&&e.length,r=n&&n.get||F2,s=o=>r(t?[o]:bi(o));let a;if(!i)a=function(){return""};else if(i===1){const o=s(e[0]);a=function(u){return""+o(u)}}else{const o=e.map(s);a=function(u){let l=""+o[0](u),c=0;for(;++c{t={},n={},i=0},s=(a,o)=>(++i>e&&(n=t,t={},i=1),t[a]=o);return r(),{clear:r,has:a=>H(t,a)||H(n,a),get:a=>H(t,a)?t[a]:H(n,a)?s(a,n[a]):void 0,set:(a,o)=>H(t,a)?t[a]=o:s(a,o)}}function G2(e,t,n,i){const r=t.length,s=n.length;if(!s)return t;if(!r)return n;const a=i||new t.constructor(r+s);let o=0,u=0,l=0;for(;o0?n[u++]:t[o++];for(;o=0;)n+=e;return n}function H2(e,t,n,i){const r=n||" ",s=e+"",a=t-s.length;return a<=0?s:i==="left"?To(r,a)+s:i==="center"?To(r,~~(a/2))+s+To(r,Math.ceil(a/2)):s+To(r,a)}function _u(e){return e&&ce(e)-e[0]||0}function P(e){return D(e)?"["+e.map(P)+"]":j(e)||q(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function hm(e){return e==null||e===""?null:!e||e==="false"||e==="0"?!1:!!e}const I_=e=>ge(e)||xr(e)?e:Date.parse(e);function pm(e,t){return t=t||I_,e==null||e===""?null:t(e)}function gm(e){return e==null||e===""?null:e+""}function Ln(e){const t={},n=e.length;for(let i=0;i(e[t]=1+n,e),{});function ym(e){const t=W(e).slice(),n={};return t.length||S("Missing time unit."),t.forEach(r=>{H(rh,r)?n[r]=1:S(`Invalid time unit: ${r}.`)}),(n[Ve]||n[bt]?1:0)+(n[jt]||n[At]||n[qt]?1:0)+(n[hi]?1:0)>1&&S(`Incompatible time units: ${e}`),t.sort((r,s)=>rh[r]-rh[s]),t}const z_={[ft]:"%Y ",[jt]:"Q%q ",[At]:"%b ",[qt]:"%d ",[Ve]:"W%U ",[bt]:"%a ",[hi]:"%j ",[nn]:"%H:00",[rn]:"00:%M",[mn]:":%S",[Bn]:".%L",[`${ft}-${At}`]:"%Y-%m ",[`${ft}-${At}-${qt}`]:"%Y-%m-%d ",[`${nn}-${rn}`]:"%H:%M"};function X2(e,t){const n=se({},z_,t),i=ym(e),r=i.length;let s="",a=0,o,u;for(a=0;aa;--o)if(u=i.slice(a,o).join("-"),n[u]!=null){s+=n[u],a=o;break}return s.trim()}const rs=new Date;function bm(e){return rs.setFullYear(e),rs.setMonth(0),rs.setDate(1),rs.setHours(0,0,0,0),rs}function Y2(e){return J2(new Date(e))}function K2(e){return Ap(new Date(e))}function J2(e){return Hl.count(bm(e.getFullYear())-1,e)}function Ap(e){return v2.count(bm(e.getFullYear())-1,e)}function Cp(e){return bm(e).getDay()}function U_(e,t,n,i,r,s,a){if(0<=e&&e<100){const o=new Date(-1,t,n,i,r,s,a);return o.setFullYear(e),o}return new Date(e,t,n,i,r,s,a)}function Q2(e){return eC(new Date(e))}function Z2(e){return wp(new Date(e))}function eC(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Gl.count(t-1,e)}function wp(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return x2.count(t-1,e)}function Fp(e){return rs.setTime(Date.UTC(e,0,1)),rs.getUTCDay()}function j_(e,t,n,i,r,s,a){if(0<=e&&e<100){const o=new Date(Date.UTC(-1,t,n,i,r,s,a));return o.setUTCFullYear(n.y),o}return new Date(Date.UTC(e,t,n,i,r,s,a))}function tC(e,t,n,i,r){const s=t||1,a=ce(e),o=(y,b,v)=>(v=v||y,q_(n[v],i[v],y===a&&s,b)),u=new Date,l=Ln(e),c=l[ft]?o(ft):kt(2012),f=l[At]?o(At):l[jt]?o(jt):cr,d=l[Ve]&&l[bt]?o(bt,1,Ve+bt):l[Ve]?o(Ve,1):l[bt]?o(bt,1):l[qt]?o(qt,1):l[hi]?o(hi,1):Ha,p=l[nn]?o(nn):cr,h=l[rn]?o(rn):cr,g=l[mn]?o(mn):cr,m=l[Bn]?o(Bn):cr;return function(y){u.setTime(+y);const b=c(u);return r(b,f(u),d(u,b),p(u),h(u),g(u),m(u))}}function q_(e,t,n,i){const r=n<=1?e:i?(s,a)=>i+n*Math.floor((e(s,a)-i)/n):(s,a)=>n*Math.floor(e(s,a)/n);return t?(s,a)=>t(r(s,a),a):r}function Ea(e,t,n){return t+e*7-(n+6)%7}const W_={[ft]:e=>e.getFullYear(),[jt]:e=>Math.floor(e.getMonth()/3),[At]:e=>e.getMonth(),[qt]:e=>e.getDate(),[nn]:e=>e.getHours(),[rn]:e=>e.getMinutes(),[mn]:e=>e.getSeconds(),[Bn]:e=>e.getMilliseconds(),[hi]:e=>J2(e),[Ve]:e=>Ap(e),[Ve+bt]:(e,t)=>Ea(Ap(e),e.getDay(),Cp(t)),[bt]:(e,t)=>Ea(1,e.getDay(),Cp(t))},G_={[jt]:e=>3*e,[Ve]:(e,t)=>Ea(e,0,Cp(t))};function nC(e,t){return tC(e,t||1,W_,G_,U_)}const H_={[ft]:e=>e.getUTCFullYear(),[jt]:e=>Math.floor(e.getUTCMonth()/3),[At]:e=>e.getUTCMonth(),[qt]:e=>e.getUTCDate(),[nn]:e=>e.getUTCHours(),[rn]:e=>e.getUTCMinutes(),[mn]:e=>e.getUTCSeconds(),[Bn]:e=>e.getUTCMilliseconds(),[hi]:e=>eC(e),[Ve]:e=>wp(e),[bt]:(e,t)=>Ea(1,e.getUTCDay(),Fp(t)),[Ve+bt]:(e,t)=>Ea(wp(e),e.getUTCDay(),Fp(t))},V_={[jt]:e=>3*e,[Ve]:(e,t)=>Ea(e,0,Fp(t))};function iC(e,t){return tC(e,t||1,H_,V_,j_)}const X_={[ft]:R5,[jt]:sx.every(3),[At]:sx,[Ve]:v2,[qt]:Hl,[bt]:Hl,[hi]:Hl,[nn]:O5,[rn]:D5,[mn]:A2,[Bn]:E2},Y_={[ft]:N5,[jt]:ax.every(3),[At]:ax,[Ve]:x2,[qt]:Gl,[bt]:Gl,[hi]:Gl,[nn]:T5,[rn]:_5,[mn]:A2,[Bn]:E2};function Ja(e){return X_[e]}function Qa(e){return Y_[e]}function rC(e,t,n){return e?e.offset(t,n):void 0}function sC(e,t,n){return rC(Ja(e),t,n)}function aC(e,t,n){return rC(Qa(e),t,n)}function oC(e,t,n,i){return e?e.range(t,n,i):void 0}function uC(e,t,n,i){return oC(Ja(e),t,n,i)}function lC(e,t,n,i){return oC(Qa(e),t,n,i)}const No=1e3,Mo=No*60,Lo=Mo*60,df=Lo*24,K_=df*7,lx=df*30,Sp=df*365,cC=[ft,At,qt,nn,rn,mn,Bn],Bo=cC.slice(0,-1),Po=Bo.slice(0,-1),Io=Po.slice(0,-1),J_=Io.slice(0,-1),Q_=[ft,Ve],cx=[ft,At],fC=[ft],go=[[Bo,1,No],[Bo,5,5*No],[Bo,15,15*No],[Bo,30,30*No],[Po,1,Mo],[Po,5,5*Mo],[Po,15,15*Mo],[Po,30,30*Mo],[Io,1,Lo],[Io,3,3*Lo],[Io,6,6*Lo],[Io,12,12*Lo],[J_,1,df],[Q_,1,K_],[cx,1,lx],[cx,3,3*lx],[fC,1,Sp]];function dC(e){const t=e.extent,n=e.maxbins||40,i=Math.abs(_u(t))/n;let r=em(o=>o[2]).right(go,i),s,a;return r===go.length?(s=fC,a=au(t[0]/Sp,t[1]/Sp,n)):r?(r=go[i/go[r-1][2]t[n]||(t[n]=e(n))}function Z_(e,t){return n=>{const i=e(n),r=i.indexOf(t);if(r<0)return i;let s=eT(i,r);const a=sr;)if(i[s]!=="0"){++s;break}return i.slice(0,s)+a}}function eT(e,t){let n=e.lastIndexOf("e"),i;if(n>0)return n;for(n=e.length;--n>t;)if(i=e.charCodeAt(n),i>=48&&i<=57)return n+1}function hC(e){const t=zo(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(i){const r=ox(i||",");if(r.precision==null){switch(r.precision=12,r.type){case"%":r.precision-=2;break;case"e":r.precision-=1;break}return Z_(t(r),t(".1f")(1)[1])}else return t(r)},formatSpan(i,r,s,a){a=ox(a??",f");const o=au(i,r,s),u=Math.max(Math.abs(i),Math.abs(r));let l;if(a.precision==null)switch(a.type){case"s":return isNaN(l=H5(o,u))||(a.precision=l),n(a,u);case"":case"e":case"g":case"p":case"r":{isNaN(l=G5(o,u))||(a.precision=l-(a.type==="e"));break}case"f":case"%":{isNaN(l=W5(o))||(a.precision=l-(a.type==="%")*2);break}}return t(a)}}}let $p;pC();function pC(){return $p=hC({format:Z5,formatPrefix:e_})}function gC(e){return hC(Q5(e))}function vc(e){return arguments.length?$p=gC(e):$p}function fx(e,t,n){n=n||{},j(n)||S(`Invalid time multi-format specifier: ${n}`);const i=t(mn),r=t(rn),s=t(nn),a=t(qt),o=t(Ve),u=t(At),l=t(jt),c=t(ft),f=e(n[Bn]||".%L"),d=e(n[mn]||":%S"),p=e(n[rn]||"%I:%M"),h=e(n[nn]||"%I %p"),g=e(n[qt]||n[bt]||"%a %d"),m=e(n[Ve]||"%b %d"),y=e(n[At]||"%B"),b=e(n[jt]||"%B"),v=e(n[ft]||"%Y");return A=>(i(A)q(i)?t(i):fx(t,Ja,i),utcFormat:i=>q(i)?n(i):fx(n,Qa,i),timeParse:zo(e.parse),utcParse:zo(e.utcParse)}}let kp;yC();function yC(){return kp=mC({format:L5,parse:I5,utcFormat:B5,utcParse:P5})}function bC(e){return mC(M5(e))}function ou(e){return arguments.length?kp=bC(e):kp}const Dp=(e,t)=>se({},e,t);function xC(e,t){const n=e?gC(e):vc(),i=t?bC(t):ou();return Dp(n,i)}function xm(e,t){const n=arguments.length;return n&&n!==2&&S("defaultLocale expects either zero or two arguments."),n?Dp(vc(e),ou(t)):Dp(vc(),ou())}function tT(){return pC(),yC(),xm()}const nT=/^(data:|([A-Za-z]+:)?\/\/)/,iT=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,rT=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,dx="file://";function sT(e,t){return n=>({options:n||{},sanitize:oT,load:aT,fileAccess:!1,file:uT(),http:cT(e)})}async function aT(e,t){const n=await this.sanitize(e,t),i=n.href;return n.localFile?this.file(i):this.http(i,t)}async function oT(e,t){t=se({},this.options,t);const n=this.fileAccess,i={href:null};let r,s,a;const o=iT.test(e.replace(rT,""));(e==null||typeof e!="string"||!o)&&S("Sanitize failure, invalid URI: "+P(e));const u=nT.test(e);return(a=t.baseURL)&&!u&&(!e.startsWith("/")&&!a.endsWith("/")&&(e="/"+e),e=a+e),s=(r=e.startsWith(dx))||t.mode==="file"||t.mode!=="http"&&!u&&n,r?e=e.slice(dx.length):e.startsWith("//")&&(t.defaultProtocol==="file"?(e=e.slice(2),s=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(i,"localFile",{value:!!s}),i.href=e,t.target&&(i.target=t.target+""),t.rel&&(i.rel=t.rel+""),t.context==="image"&&t.crossOrigin&&(i.crossOrigin=t.crossOrigin+""),i}function uT(e){return lT}async function lT(){S("No file system access.")}function cT(e){return e?async function(t,n){const i=se({},this.options.http,n),r=n&&n.response,s=await e(t,i);return s.ok?ae(s[r])?s[r]():s.text():S(s.status+""+s.statusText)}:fT}async function fT(){S("No HTTP fetch method available.")}const dT=e=>e!=null&&e===e,hT=e=>e==="true"||e==="false"||e===!0||e===!1,pT=e=>!Number.isNaN(Date.parse(e)),vC=e=>!Number.isNaN(+e)&&!(e instanceof Date),gT=e=>vC(e)&&Number.isInteger(+e),Op={boolean:hm,integer:xt,number:xt,date:pm,string:gm,unknown:$t},El=[hT,gT,vC,pT],mT=["boolean","integer","number","date"];function EC(e,t){if(!e||!e.length)return"unknown";const n=e.length,i=El.length,r=El.map((s,a)=>a+1);for(let s=0,a=0,o,u;ss===0?a:s,0)-1]}function AC(e,t){return t.reduce((n,i)=>(n[i]=EC(e,i),n),{})}function hx(e){const t=function(n,i){const r={delimiter:e};return vm(n,i?se(i,r):r)};return t.responseType="text",t}function vm(e,t){return t.header&&(e=t.header.map(P).join(t.delimiter)+` +`+e),t_(t.delimiter).parse(e+"")}vm.responseType="text";function yT(e){return typeof Buffer=="function"&&ae(Buffer.isBuffer)?Buffer.isBuffer(e):!1}function Em(e,t){const n=t&&t.property?pn(t.property):$t;return j(e)&&!yT(e)?bT(n(e),t):n(JSON.parse(e))}Em.responseType="json";function bT(e,t){return!D(e)&&j2(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}const xT={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function CC(e,t){let n,i,r,s;return e=Em(e,t),t&&t.feature?(n=oR,r=t.feature):t&&t.mesh?(n=uR,r=t.mesh,s=xT[t.filter]):S("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[r])?n(e,i,s):S("Invalid TopoJSON object: "+r),i&&i.features||[i]}CC.responseType="json";const Vl={dsv:vm,csv:hx(","),tsv:hx(" "),json:Em,topojson:CC};function Am(e,t){return arguments.length>1?(Vl[e]=t,this):H(Vl,e)?Vl[e]:null}function wC(e){const t=Am(e);return t&&t.responseType||"text"}function FC(e,t,n,i){t=t||{};const r=Am(t.type||"json");return r||S("Unknown data format type: "+t.type),e=r(e,t),t.parse&&vT(e,t.parse,n,i),H(e,"columns")&&delete e.columns,e}function vT(e,t,n,i){if(!e.length)return;const r=ou();n=n||r.timeParse,i=i||r.utcParse;let s=e.columns||Object.keys(e[0]),a,o,u,l,c,f;t==="auto"&&(t=AC(e,s)),s=Object.keys(t);const d=s.map(p=>{const h=t[p];let g,m;if(h&&(h.startsWith("date:")||h.startsWith("utc:")))return g=h.split(/:(.+)?/,2),m=g[1],(m[0]==="'"&&m[m.length-1]==="'"||m[0]==='"'&&m[m.length-1]==='"')&&(m=m.slice(1,-1)),(g[0]==="utc"?i:n)(m);if(!Op[h])throw Error("Illegal format pattern: "+p+":"+h);return Op[h]});for(u=0,c=e.length,f=s.length;u{const s=t(r);return i[s]||(i[s]=1,n.push(r)),n},n.remove=r=>{const s=t(r);if(i[s]){i[s]=0;const a=n.indexOf(r);a>=0&&n.splice(a,1)}return n},n}async function Xl(e,t){try{await t(e)}catch(n){e.error(n)}}const SC=Symbol("vega_id");let ET=1;function gf(e){return!!(e&&ee(e))}function ee(e){return e[SC]}function $C(e,t){return e[SC]=t,e}function be(e){const t=e===Object(e)?e:{data:e};return ee(t)?t:$C(t,ET++)}function Cm(e){return mf(e,be({}))}function mf(e,t){for(const n in e)t[n]=e[n];return t}function kC(e,t){return $C(t,ee(e))}function Ls(e,t){return e?t?(n,i)=>e(n,i)||ee(t(n))-ee(t(i)):(n,i)=>e(n,i)||ee(n)-ee(i):null}function DC(e){return e&&e.constructor===Bs}function Bs(){const e=[],t=[],n=[],i=[],r=[];let s=null,a=!1;return{constructor:Bs,insert(o){const u=W(o),l=u.length;for(let c=0;c{h(b)&&(l[ee(b)]=-1)});for(f=0,d=e.length;f0&&(y(g,h,p.value),o.modifies(h));for(f=0,d=r.length;f{h(b)&&l[ee(b)]>0&&y(b,p.field,p.value)}),o.modifies(p.field);if(a)o.mod=t.length||i.length?u.filter(b=>l[ee(b)]>0):u.slice();else for(m in c)o.mod.push(c[m]);return(s||s==null&&(t.length||i.length))&&o.clean(!0),o}}}const Yl="_:mod:_";function yf(){Object.defineProperty(this,Yl,{writable:!0,value:{}})}yf.prototype={set(e,t,n,i){const r=this,s=r[e],a=r[Yl];return t!=null&&t>=0?(s[t]!==n||i)&&(s[t]=n,a[t+":"+e]=-1,a[e]=-1):(s!==n||i)&&(r[e]=n,a[e]=D(n)?1+n.length:-1),r},modified(e,t){const n=this[Yl];if(arguments.length){if(D(e)){for(let i=0;i=0?t+1{p instanceof $e?(p!==this&&(t&&p.targets().add(this),s.push(p)),r.push({op:p,name:f,index:d})):i.set(f,d,p)};for(a in e)if(o=e[a],a===CT)W(o).forEach(f=>{f instanceof $e?f!==this&&(f.targets().add(this),s.push(f)):S("Pulse parameters must be operator instances.")}),this.source=o;else if(D(o))for(i.set(a,-1,Array(u=o.length)),l=0;l{const n=Date.now();return n-t>e?(t=n,1):0})},debounce(e){const t=rr();return this.targets().add(rr(null,null,cm(e,n=>{const i=n.dataflow;t.receive(n),i&&i.run&&i.run()}))),t},between(e,t){let n=!1;return e.targets().add(rr(null,null,()=>n=!0)),t.targets().add(rr(null,null,()=>n=!1)),this.filter(()=>n)},detach(){this._filter=gn,this._targets=null}};function OT(e,t,n,i){const r=this,s=rr(n,i),a=function(l){l.dataflow=r;try{s.receive(l)}catch(c){r.error(c)}finally{r.run()}};let o;typeof e=="string"&&typeof document<"u"?o=document.querySelectorAll(e):o=W(e);const u=o.length;for(let l=0;lt=i);return n.requests=0,n.done=()=>{--n.requests===0&&(e._pending=null,t(e))},e._pending=n}const LT={skip:!0};function BT(e,t,n,i,r){return(e instanceof $e?IT:PT)(this,e,t,n,i,r),this}function PT(e,t,n,i,r,s){const a=se({},s,LT);let o,u;ae(n)||(n=kt(n)),i===void 0?o=l=>e.touch(n(l)):ae(i)?(u=new $e(null,i,r,!1),o=l=>{u.evaluate(l);const c=n(l),f=u.value;DC(f)?e.pulse(c,f,s):e.update(c,f,a)}):o=l=>e.update(n(l),i,a),t.apply(o)}function IT(e,t,n,i,r,s){if(i===void 0)t.targets().add(n);else{const a=s||{},o=new $e(null,zT(n,i),r,!1);o.modified(a.force),o.rank=t.rank,t.targets().add(o),n&&(o.skip(!0),o.value=n.value,o.targets().add(n),e.connect(n,[o]))}}function zT(e,t){return t=ae(t)?t:kt(t),e?function(n,i){const r=t(n,i);return e.skip()||(e.skip(r!==this.value).value=r),r}:t}function UT(e){e.rank=++this._rank}function jT(e){const t=[e];let n,i,r;for(;t.length;)if(this.rank(n=t.pop()),i=n._targets)for(r=i.length;--r>=0;)t.push(n=i[r]),n===e&&S("Cycle detected in dataflow graph.")}const Ec={},ni=1,or=2,Ti=4,qT=ni|or,gx=ni|Ti,Qs=ni|or|Ti,mx=8,mo=16,yx=32,bx=64;function vr(e,t,n){this.dataflow=e,this.stamp=t??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function sh(e,t){const n=[];return ar(e,t,i=>n.push(i)),n}function xx(e,t){const n={};return e.visit(t,i=>{n[ee(i)]=1}),i=>n[ee(i)]?null:i}function Al(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}vr.prototype={StopPropagation:Ec,ADD:ni,REM:or,MOD:Ti,ADD_REM:qT,ADD_MOD:gx,ALL:Qs,REFLOW:mx,SOURCE:mo,NO_SOURCE:yx,NO_FIELDS:bx,fork(e){return new vr(this.dataflow).init(this,e)},clone(){const e=this.fork(Qs);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(Qs|mo)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new vr(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){const n=this;return n.stamp=e.stamp,n.encode=e.encode,e.fields&&!(t&bx)&&(n.fields=e.fields),t&ni?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),t&or?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),t&Ti?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),t&yx?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||Qs;return t&ni&&this.add.length||t&or&&this.rem.length||t&Ti&&this.mod.length},reflow(e){if(e)return this.fork(Qs).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(Ti,xx(this,ni))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return D(e)?e.forEach(n=>t[n]=!0):t[e]=!0,this},modified(e,t){const n=this.fields;return(t||this.mod.length)&&n?arguments.length?D(e)?e.some(i=>n[i]):n[e]:!!n:!1},filter(e,t){const n=this;return e&ni&&(n.addF=Al(n.addF,t)),e&or&&(n.remF=Al(n.remF,t)),e&Ti&&(n.modF=Al(n.modF,t)),e&mo&&(n.srcF=Al(n.srcF,t)),n},materialize(e){e=e||Qs;const t=this;return e&ni&&t.addF&&(t.add=sh(t.add,t.addF),t.addF=null),e&or&&t.remF&&(t.rem=sh(t.rem,t.remF),t.remF=null),e&Ti&&t.modF&&(t.mod=sh(t.mod,t.modF),t.modF=null),e&mo&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,i=t;if(e&mo)return ar(n.source,n.srcF,i),n;e&ni&&ar(n.add,n.addF,i),e&or&&ar(n.rem,n.remF,i),e&Ti&&ar(n.mod,n.modF,i);const r=n.source;if(e&mx&&r){const s=n.add.length+n.mod.length;s===r.length||(s?ar(r,xx(n,gx),i):ar(r,n.srcF,i))}return n}};function wm(e,t,n,i){const r=this;let s=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=i||null,this.pulses=n;for(const a of n)if(a.stamp===t){if(a.fields){const o=r.fields||(r.fields={});for(const u in a.fields)o[u]=1}a.changed(r.ADD)&&(s|=r.ADD),a.changed(r.REM)&&(s|=r.REM),a.changed(r.MOD)&&(s|=r.MOD)}this.changes=s}z(wm,vr,{fork(e){const t=new vr(this.dataflow).init(this,e&this.NO_FIELDS);return e!==void 0&&(e&t.ADD&&this.visit(t.ADD,n=>t.add.push(n)),e&t.REM&&this.visit(t.REM,n=>t.rem.push(n)),e&t.MOD&&this.visit(t.MOD,n=>t.mod.push(n))),t},changed(e){return this.changes&e},modified(e){const t=this,n=t.fields;return n&&t.changes&t.MOD?D(e)?e.some(i=>n[i]):n[e]:0},filter(){S("MultiPulse does not support filtering.")},materialize(){S("MultiPulse does not support materialization.")},visit(e,t){const n=this,i=n.pulses,r=i.length;let s=0;if(e&n.SOURCE)for(;si._enqueue(c,!0)),i._touched=pf(Ru);let a=0,o,u,l;try{for(;i._heap.size()>0;){if(o=i._heap.pop(),o.rank!==o.qrank){i._enqueue(o,!0);continue}u=o.run(i._getPulse(o,e)),u.then?u=await u:u.async&&(r.push(u.async),u=Ec),u!==Ec&&o._targets&&o._targets.forEach(c=>i._enqueue(c)),++a}}catch(c){i._heap.clear(),l=c}if(i._input={},i._pulse=null,i.debug(`Pulse ${s}: ${a} operators`),l&&(i._postrun=[],i.error(l)),i._postrun.length){const c=i._postrun.sort((f,d)=>d.priority-f.priority);i._postrun=[];for(let f=0;fi.runAsync(null,()=>{c.forEach(f=>{try{f(i)}catch(d){i.error(d)}})})),i}async function GT(e,t,n){for(;this._running;)await this._running;const i=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(i,i),this._running}function HT(e,t,n){return this._pulse?OC(this):(this.evaluate(e,t,n),this)}function VT(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(i){this.error(i)}}function OC(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}function XT(e,t){const n=e.stampr.pulse),t):this._input[e.id]||KT(this._pulse,n&&n.pulse)}function KT(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==Ec&&(e.source=t.source),e)}const Fm={skip:!1,force:!1};function JT(e,t){const n=t||Fm;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this}function QT(e,t,n){const i=n||Fm;return(e.set(t)||i.force)&&this.touch(e,i),this}function ZT(e,t,n){this.touch(e,n||Fm);const i=new vr(this,this._clock+(this._pulse?0:1)),r=e.pulse&&e.pulse.source||[];return i.target=e,this._input[e.id]=t.pulse(i,r),this}function eN(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),RC(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let i;return t.length?(i=t[0],t[0]=n,tN(t,0,e)):i=n,i}}}function RC(e,t,n,i){let r,s;const a=e[n];for(;n>t;){if(s=n-1>>1,r=e[s],i(a,r)<0){e[n]=r,n=s;continue}break}return e[n]=a}function tN(e,t,n){const i=t,r=e.length,s=e[t];let a=(t<<1)+1,o;for(;a=0&&(a=o),e[t]=e[a],t=a,a=(t<<1)+1;return e[t]=s,RC(e,i,t,n)}function pa(){this.logger(sm()),this.logLevel(im),this._clock=0,this._rank=0,this._locale=xm();try{this._loader=hf()}catch{}this._touched=pf(Ru),this._input={},this._pulse=null,this._heap=eN((e,t)=>e.qrank-t.qrank),this._postrun=[]}function yo(e){return function(){return this._log[e].apply(this,arguments)}}pa.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:yo("error"),warn:yo("warn"),info:yo("info"),debug:yo("debug"),logLevel:yo("level"),cleanThreshold:1e4,add:$T,connect:kT,rank:UT,rerank:jT,pulse:ZT,touch:JT,update:QT,changeset:Bs,ingest:_T,parse:RT,preload:NT,request:TT,events:OT,on:BT,evaluate:WT,run:HT,runAsync:GT,runAfter:VT,_enqueue:XT,_getPulse:YT};function F(e,t){$e.call(this,e,null,t)}z(F,$e,{run(e){if(e.stampthis.pulse=n):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});const Aa={};function _C(e){const t=TC(e);return t&&t.Definition||null}function TC(e){return e=e&&e.toLowerCase(),H(Aa,e)?Aa[e]:null}function*NC(e,t){if(t==null)for(let n of e)n!=null&&n!==""&&(n=+n)>=n&&(yield n);else{let n=-1;for(let i of e)i=t(i,++n,e),i!=null&&i!==""&&(i=+i)>=i&&(yield i)}}function Sm(e,t,n){const i=Float64Array.from(NC(e,n));return i.sort(C2),t.map(r=>lR(i,r))}function $m(e,t){return Sm(e,[.25,.5,.75],t)}function km(e,t){const n=e.length,i=cR(e,t),r=$m(e,t),s=(r[2]-r[0])/1.34;return 1.06*(Math.min(i,s)||i||Math.abs(r[0])||1)*Math.pow(n,-.2)}function MC(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let s=e.extent[0],a=e.extent[1],o,u,l,c,f,d;const p=e.span||a-s||Math.abs(s)||1;if(e.step)o=e.step;else if(e.steps){for(c=p/t,f=0,d=e.steps.length;ft;)o*=n;for(f=0,d=r.length;f=l&&p/c<=t&&(o=c)}c=Math.log(o);const h=c>=0?0:~~(-c/i)+1,g=Math.pow(n,-h-1);return(e.nice||e.nice===void 0)&&(c=Math.floor(s/o+g)*o,s=sd);const r=e.length,s=new Float64Array(r);let a=0,o=1,u=i(e[0]),l=u,c=u+t,f;for(;o=c){for(l=(u+l)/2;a>1);ar;)e[a--]=e[i]}i=r,r=s}return e}function rN(e){return function(){return e=(1103515245*e+12345)%2147483647,e/2147483647}}function sN(e,t){t==null&&(t=e,e=0);let n,i,r;const s={min(a){return arguments.length?(n=a||0,r=i-n,s):n},max(a){return arguments.length?(i=a||0,r=i-n,s):i},sample(){return n+Math.floor(r*yn())},pdf(a){return a===Math.floor(a)&&a>=n&&a=i?1:(o-n+1)/r},icdf(a){return a>=0&&a<=1?n-1+Math.floor(a*r):NaN}};return s.min(e).max(t)}const PC=Math.sqrt(2*Math.PI),aN=Math.SQRT2;let bo=NaN;function xf(e,t){e=e||0,t=t??1;let n=0,i=0,r,s;if(bo===bo)n=bo,bo=NaN;else{do n=yn()*2-1,i=yn()*2-1,r=n*n+i*i;while(r===0||r>1);s=Math.sqrt(-2*Math.log(r)/r),n*=s,bo=i*s}return e+n*t}function Dm(e,t,n){n=n??1;const i=(e-(t||0))/n;return Math.exp(-.5*i*i)/(n*PC)}function vf(e,t,n){t=t||0,n=n??1;const i=(e-t)/n,r=Math.abs(i);let s;if(r>37)s=0;else{const a=Math.exp(-r*r/2);let o;r<7.07106781186547?(o=.0352624965998911*r+.700383064443688,o=o*r+6.37396220353165,o=o*r+33.912866078383,o=o*r+112.079291497871,o=o*r+221.213596169931,o=o*r+220.206867912376,s=a*o,o=.0883883476483184*r+1.75566716318264,o=o*r+16.064177579207,o=o*r+86.7807322029461,o=o*r+296.564248779674,o=o*r+637.333633378831,o=o*r+793.826512519948,o=o*r+440.413735824752,s=s/o):(o=r+.65,o=r+4/o,o=r+3/o,o=r+2/o,o=r+1/o,s=a/o/2.506628274631)}return i>0?1-s:s}function Ef(e,t,n){return e<0||e>1?NaN:(t||0)+(n??1)*aN*oN(2*e-1)}function oN(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=10512122733215323e-25+n*t,n=-4112633980346984e-24+n*t,n=-29070369957882005e-24+n*t,n=42347877827932404e-23+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=22137376921775787e-25,n=9075656193888539e-23+n*t,n=-27517406297064545e-23+n*t,n=18239629214389228e-24+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=15076572693500548e-25+n*t,n=-3789465440126737e-24+n*t,n=761570120807834e-23+n*t,n=-1496002662714924e-23+n*t,n=2914795345090108e-23+n*t,n=-6771199775845234e-23+n*t,n=22900482228026655e-23+n*t,n=-99298272942317e-20+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}function Om(e,t){let n,i;const r={mean(s){return arguments.length?(n=s||0,r):n},stdev(s){return arguments.length?(i=s??1,r):i},sample:()=>xf(n,i),pdf:s=>Dm(s,n,i),cdf:s=>vf(s,n,i),icdf:s=>Ef(s,n,i)};return r.mean(e).stdev(t)}function Rm(e,t){const n=Om();let i=0;const r={data(s){return arguments.length?(e=s,i=s?s.length:0,r.bandwidth(t)):e},bandwidth(s){return arguments.length?(t=s,!t&&e&&(t=km(e)),r):t},sample(){return e[~~(yn()*i)]+t*n.sample()},pdf(s){let a=0,o=0;for(;o_m(n,i),pdf:s=>Tm(s,n,i),cdf:s=>Nm(s,n,i),icdf:s=>Mm(s,n,i)};return r.mean(e).stdev(t)}function zC(e,t){let n=0,i;function r(a){const o=[];let u=0,l;for(l=0;l=t&&e<=n?1/(n-t):0}function Pm(e,t,n){return n==null&&(n=t??1,t=0),en?1:(e-t)/(n-t)}function Im(e,t,n){return n==null&&(n=t??1,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function UC(e,t){let n,i;const r={min(s){return arguments.length?(n=s||0,r):n},max(s){return arguments.length?(i=s??1,r):i},sample:()=>Lm(n,i),pdf:s=>Bm(s,n,i),cdf:s=>Pm(s,n,i),icdf:s=>Im(s,n,i)};return t==null&&(t=e??1,e=0),r.min(e).max(t)}function zm(e,t,n){let i=0,r=0;for(const s of e){const a=n(s);t(s)==null||a==null||isNaN(a)||(i+=(a-i)/++r)}return{coef:[i],predict:()=>i,rSquared:0}}function Tu(e,t,n,i){const r=i-e*e,s=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-s*e,s]}function Af(e,t,n,i){e=e.filter(p=>{let h=t(p),g=n(p);return h!=null&&(h=+h)>=h&&g!=null&&(g=+g)>=g}),i&&e.sort((p,h)=>t(p)-t(h));const r=e.length,s=new Float64Array(r),a=new Float64Array(r);let o=0,u=0,l=0,c,f,d;for(d of e)s[o]=c=+t(d),a[o]=f=+n(d),++o,u+=(c-u)/o,l+=(f-l)/o;for(o=0;o=s&&a!=null&&(a=+a)>=a&&i(s,a,++r)}function Za(e,t,n,i,r){let s=0,a=0;return Nu(e,t,n,(o,u)=>{const l=u-r(o),c=u-i;s+=l*l,a+=c*c}),1-s/a}function Um(e,t,n){let i=0,r=0,s=0,a=0,o=0;Nu(e,t,n,(c,f)=>{++o,i+=(c-i)/o,r+=(f-r)/o,s+=(c*f-s)/o,a+=(c*c-a)/o});const u=Tu(i,r,s,a),l=c=>u[0]+u[1]*c;return{coef:u,predict:l,rSquared:Za(e,t,n,r,l)}}function jC(e,t,n){let i=0,r=0,s=0,a=0,o=0;Nu(e,t,n,(c,f)=>{++o,c=Math.log(c),i+=(c-i)/o,r+=(f-r)/o,s+=(c*f-s)/o,a+=(c*c-a)/o});const u=Tu(i,r,s,a),l=c=>u[0]+u[1]*Math.log(c);return{coef:u,predict:l,rSquared:Za(e,t,n,r,l)}}function qC(e,t,n){const[i,r,s,a]=Af(e,t,n);let o=0,u=0,l=0,c=0,f=0,d,p,h;Nu(e,t,n,(b,v)=>{d=i[f++],p=Math.log(v),h=d*v,o+=(v*p-o)/f,u+=(h-u)/f,l+=(h*p-l)/f,c+=(d*h-c)/f});const[g,m]=Tu(u/a,o/a,l/a,c/a),y=b=>Math.exp(g+m*(b-s));return{coef:[Math.exp(g-m*s),m],predict:y,rSquared:Za(e,t,n,a,y)}}function WC(e,t,n){let i=0,r=0,s=0,a=0,o=0,u=0;Nu(e,t,n,(f,d)=>{const p=Math.log(f),h=Math.log(d);++u,i+=(p-i)/u,r+=(h-r)/u,s+=(p*h-s)/u,a+=(p*p-a)/u,o+=(d-o)/u});const l=Tu(i,r,s,a),c=f=>l[0]*Math.pow(f,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Za(e,t,n,o,c)}}function jm(e,t,n){const[i,r,s,a]=Af(e,t,n),o=i.length;let u=0,l=0,c=0,f=0,d=0,p,h,g,m;for(p=0;p(x=x-s,v*x*x+A*x+E+a);return{coef:[E-A*s+v*s*s+a,A-2*v*s,v],predict:C,rSquared:Za(e,t,n,a,C)}}function GC(e,t,n,i){if(i===0)return zm(e,t,n);if(i===1)return Um(e,t,n);if(i===2)return jm(e,t,n);const[r,s,a,o]=Af(e,t,n),u=r.length,l=[],c=[],f=i+1;let d,p,h,g,m;for(d=0;d{v-=a;let A=o+y[0]+y[1]*v+y[2]*v*v;for(d=3;d=0;--s)for(o=t[s],u=1,r[s]+=o,a=1;a<=s;++a)u*=(s+1-a)/a,r[s-a]+=o*Math.pow(n,a)*u;return r[0]+=i,r}function lN(e){const t=e.length-1,n=[];let i,r,s,a,o;for(i=0;iMath.abs(e[i][a])&&(a=r);for(s=i;s=i;s--)e[s][r]-=e[s][i]*e[i][r]/e[i][i]}for(r=t-1;r>=0;--r){for(o=0,s=r+1;sr[v]-y?b:v;let E=0,C=0,x=0,w=0,R=0;const L=1/Math.abs(r[A]-y||1);for(let de=b;de<=v;++de){const N=r[de],O=s[de],I=cN(Math.abs(y-N)*L)*d[de],G=N*I;E+=I,C+=G,x+=O*I,w+=O*G,R+=N*G}const[J,ne]=Tu(C/E,x/E,w/E,R/E);c[m]=J+ne*y,f[m]=Math.abs(s[m]-c[m]),fN(r,m+1,h)}if(p===vx)break;const g=p2(f);if(Math.abs(g)=1?Ex:(b=1-y*y)*b}return dN(r,c,a,o)}function cN(e){return(e=1-e*e*e)*e*e}function fN(e,t,n){const i=e[t];let r=n[0],s=n[1]+1;if(!(s>=e.length))for(;t>r&&e[s]-i<=i-e[r];)n[0]=++r,n[1]=s,++s}function dN(e,t,n,i){const r=e.length,s=[];let a=0,o=0,u=[],l;for(;a[g,e(g)],s=t[0],a=t[1],o=a-s,u=o/i,l=[r(s)],c=[];if(n===i){for(let g=1;g0;)c.push(r(s+g/n*o))}let f=l[0],d=c[c.length-1];const p=1/o,h=pN(f[1],c);for(;d;){const g=r((f[0]+d[0])/2);g[0]-f[0]>=u&&gN(f,g,d,p,h)>hN?c.push(g):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l}function pN(e,t){let n=e,i=e;const r=t.length;for(let s=0;si&&(i=a)}return 1/(i-n)}function gN(e,t,n,i,r){const s=Math.atan2(r*(n[1]-e[1]),i*(n[0]-e[0])),a=Math.atan2(r*(t[1]-e[1]),i*(t[0]-e[0]));return Math.abs(s-a)}function mN(e){return t=>{const n=e.length;let i=1,r=String(e[0](t));for(;i{},yN={init:ah,add:ah,rem:ah,idx:0},uu={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.valid?e.sum:void 0,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||e.max===void 0)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:["exponential"],idx:1}},Mu=Object.keys(uu).filter(e=>e!=="__count__");function bN(e,t){return(n,i)=>se({name:e,aggregate_param:i,out:n||e},yN,t)}[...Mu,"__count__"].forEach(e=>{uu[e]=bN(e,uu[e])});function XC(e,t,n){return uu[e](n,t)}function YC(e,t){return e.idx-t.idx}function xN(e){const t={};e.forEach(i=>t[i.name]=i);const n=i=>{i.req&&i.req.forEach(r=>{t[r]||n(t[r]=uu[r]())})};return e.forEach(n),Object.values(t).sort(YC)}function vN(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.aggregate_param==null?e.init(this):e.init(this,e.aggregate_param))}function EN(e,t){if(e==null||e===""){++this.missing;return}e===e&&(++this.valid,this._ops.forEach(n=>n.add(this,e,t)))}function AN(e,t){if(e==null||e===""){--this.missing;return}e===e&&(--this.valid,this._ops.forEach(n=>n.rem(this,e,t)))}function CN(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function KC(e,t){const n=t||$t,i=xN(e),r=e.slice().sort(YC);function s(a){this._ops=i,this._out=r,this.cell=a,this.init()}return s.prototype.init=vN,s.prototype.add=EN,s.prototype.rem=AN,s.prototype.set=CN,s.prototype.get=n,s.fields=e.map(a=>a.out),s}function qm(e){this._key=e?pn(e):ee,this.reset()}const pt=qm.prototype;pt.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null};pt.add=function(e){this._add.push(e)};pt.rem=function(e){this._rem.push(e)};pt.values=function(){if(this._get=null,this._rem.length===0)return this._add;const e=this._add,t=this._rem,n=this._key,i=e.length,r=t.length,s=Array(i-r),a={};let o,u,l;for(o=0;o=0;)s=e(t[i])+"",H(n,s)||(n[s]=1,++r);return r};pt.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=z2(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext};pt.argmin=function(e){return this.extent(e)[0]||{}};pt.argmax=function(e){return this.extent(e)[1]||{}};pt.min=function(e){const t=this.extent(e)[0];return t!=null?e(t):void 0};pt.max=function(e){const t=this.extent(e)[1];return t!=null?e(t):void 0};pt.quartile=function(e){return(this._get!==e||!this._q)&&(this._q=$m(this.values(),e),this._get=e),this._q};pt.q1=function(e){return this.quartile(e)[0]};pt.q2=function(e){return this.quartile(e)[1]};pt.q3=function(e){return this.quartile(e)[2]};pt.ci=function(e){return(this._get!==e||!this._ci)&&(this._ci=LC(this.values(),1e3,.05,e),this._get=e),this._ci};pt.ci0=function(e){return this.ci(e)[0]};pt.ci1=function(e){return this.ci(e)[1]};function wr(e){F.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}wr.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Mu},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};z(wr,F,{transform(e,t){const n=this,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.modified();return n.stamp=i.stamp,n.value&&(r||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=r?n.init(e):Object.create(null),t.visit(t.SOURCE,s=>n.add(s))):(n.value=n.value||n.init(e),t.visit(t.REM,s=>n.rem(s)),t.visit(t.ADD,s=>n.add(s))),i.modifies(n._outputs),n._drop=e.drop!==!1,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&i.clean(!0).runAfter(()=>this.clean()),n.changes(i)},cross(){const e=this,t=e.value,n=e._dnames,i=n.map(()=>({})),r=n.length;function s(o){let u,l,c,f;for(u in o)for(c=o[u].tuple,l=0;l{const v=ze(b);return r(b),n.push(v),v}),this.cellkey=e.key?e.key:Rp(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const s=e.fields||[null],a=e.ops||["count"],o=e.aggregate_params||[null],u=e.as||[],l=s.length,c={};let f,d,p,h,g,m,y;for(l!==a.length&&S("Unmatched number of fields and aggregate ops."),y=0;yKC(b,b.field)),Object.create(null)},cellkey:Rp(),cell(e,t){let n=this.value[e];return n?n.num===0&&this._drop&&n.stamp{const f=i(c);c[o]=f,c[u]=f==null?null:r+s*(1+(f-r)/s)}:c=>c[o]=i(c)),t.modifies(n?a:o)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=MC(e),i=n.step;let r=n.start,s=r+Math.ceil((n.stop-r)/i)*i,a,o;(a=e.anchor)!=null&&(o=a-(r+i*Math.floor((a-r)/i)),r+=o,s+=o);const u=function(l){let c=xt(t(l));return c==null?null:cs?1/0:(c=Math.max(r,Math.min(c,s-i)),r+i*Math.floor(wN+(c-r)/i))};return u.start=r,u.stop=n.stop,u.step=i,this.value=Vt(u,Et(t),e.name||"bin_"+ze(t))}});function JC(e,t,n){const i=e;let r=t||[],s=n||[],a={},o=0;return{add:u=>s.push(u),remove:u=>a[i(u)]=++o,size:()=>r.length,data:(u,l)=>(o&&(r=r.filter(c=>!a[i(c)]),a={},o=0),l&&u&&r.sort(u),s.length&&(r=u?G2(u,r,s.sort(u)):r.concat(s),s=[]),r)}}function Gm(e){F.call(this,[],e)}Gm.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]};z(Gm,F,{transform(e,t){const n=t.fork(t.ALL),i=JC(ee,this.value,n.materialize(n.ADD).add),r=e.sort,s=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return n.visit(n.REM,i.remove),this.modified(s),this.value=n.source=i.data(Ls(r),s),t.source&&t.source.root&&(this.value.root=t.source.root),n}});function QC(e){$e.call(this,null,FN,e)}z(QC,$e);function FN(e){return this.value&&!e.modified()?this.value:lm(e.fields,e.orders)}function Hm(e){F.call(this,null,e)}Hm.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};function SN(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase();break}return e.match(n)}z(Hm,F,{transform(e,t){const n=f=>d=>{for(var p=SN(o(d),e.case,s)||[],h,g=0,m=p.length;gr[f]=1+(r[f]||0)),c=n(f=>r[f]-=1);return i?t.visit(t.SOURCE,l):(t.visit(t.ADD,l),t.visit(t.REM,c)),this._finish(t,u)},_parameterCheck(e,t){let n=!1;return(e.modified("stopwords")||!this._stop)&&(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),(e.modified("pattern")||!this._match)&&(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){const n=this._counts,i=this._tuples||(this._tuples={}),r=t[0],s=t[1],a=e.fork(e.NO_SOURCE|e.NO_FIELDS);let o,u,l;for(o in n)u=i[o],l=n[o]||0,!u&&l?(i[o]=u=be({}),u[r]=o,u[s]=l,a.add.push(u)):l===0?(u&&a.rem.push(u),n[o]=null,i[o]=null):u[s]!==l&&(u[s]=l,a.mod.push(u));return a.modifies(t)}});function Vm(e){F.call(this,null,e)}Vm.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]};z(Vm,F,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.as||["a","b"],r=i[0],s=i[1],a=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let o=this.value;return a?(o&&(n.rem=o),o=t.materialize(t.SOURCE).source,n.add=this.value=$N(o,r,s,e.filter||gn)):n.mod=o,n.source=this.value,n.modifies(i)}});function $N(e,t,n,i){for(var r=[],s={},a=e.length,o=0,u,l;oZC(s,t))):typeof i[r]===Cx&&i[r](e[r]);return i}function Xm(e){F.call(this,null,e)}const ew=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],ON={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:ew},{name:"weights",type:"number",array:!0}]};Xm.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:ew.concat(ON)},{name:"as",type:"string",array:!0,default:["value","density"]}]};z(Xm,F,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=ZC(e.distribution,RN(t)),r=e.steps||e.minsteps||25,s=e.steps||e.maxsteps||200;let a=e.method||"pdf";a!=="pdf"&&a!=="cdf"&&S("Invalid density method: "+a),!e.extent&&!i.data&&S("Missing density extent parameter."),a=i[a];const o=e.as||["value","density"],u=e.extent||di(i.data()),l=Cf(a,u,r,s).map(c=>{const f={};return f[o[0]]=c[0],f[o[1]]=c[1],be(f)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function RN(e){return()=>e.materialize(e.SOURCE).source}function tw(e,t){return e?e.map((n,i)=>t[i]||ze(n)):null}function Ym(e,t,n){const i=[],r=f=>f(u);let s,a,o,u,l,c;if(t==null)i.push(e.map(n));else for(s={},a=0,o=e.length;a_u(di(e,t))/30;z(Km,F,{transform(e,t){if(this.value&&!(e.modified()||t.changed()))return t;const n=t.materialize(t.SOURCE).source,i=Ym(t.source,e.groupby,$t),r=e.smooth||!1,s=e.field,a=e.step||_N(n,s),o=Ls((h,g)=>s(h)-s(g)),u=e.as||nw,l=i.length;let c=1/0,f=-1/0,d=0,p;for(;df&&(f=g),h[++p][u]=g}return this.value={start:c,stop:f,step:a},t.reflow(!0).modifies(u)}});function iw(e){$e.call(this,null,TN,e),this.modified(!0)}z(iw,$e);function TN(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:Vt(n=>t(n,e),Et(t),ze(t))}function Jm(e){F.call(this,[void 0,void 0],e)}Jm.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]};z(Jm,F,{transform(e,t){const n=this.value,i=e.field,r=t.changed()||t.modified(i.fields)||e.modified("field");let s=n[0],a=n[1];if((r||s==null)&&(s=1/0,a=-1/0),t.visit(r?t.SOURCE:t.ADD,o=>{const u=xt(i(o));u!=null&&(ua&&(a=u))}),!Number.isFinite(s)||!Number.isFinite(a)){let o=ze(i);o&&(o=` for field "${o}"`),t.dataflow.warn(`Infinite extent${o}: [${s}, ${a}]`),s=a=void 0}this.value=[s,a]}});function Qm(e,t){$e.call(this,e),this.parent=t,this.count=0}z(Qm,$e,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}});function wf(e){F.call(this,{},e),this._keys=Ka();const t=this._targets=[];t.active=0,t.forEach=n=>{for(let i=0,r=t.active;ii&&i.count>0);this.initTargets(n)}},initTargets(e){const t=this._targets,n=t.length,i=e?e.length:0;let r=0;for(;rthis.subflow(u,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,u=>{const l=ee(u),c=s.get(l);c!==void 0&&(s.delete(l),o(c).rem(u))}),t.visit(t.ADD,u=>{const l=i(u);s.set(ee(u),l),o(l).add(u)}),a||t.modified(i.fields)?t.visit(t.MOD,u=>{const l=ee(u),c=s.get(l),f=i(u);c===f?o(f).mod(u):(s.set(l,f),o(c).rem(u),o(f).add(u))}):t.changed(t.MOD)&&t.visit(t.MOD,u=>{o(s.get(ee(u))).mod(u)}),a&&t.visit(t.REFLOW,u=>{const l=ee(u),c=s.get(l),f=i(u);c!==f&&(s.set(l,f),o(c).rem(u),o(f).add(u))}),t.clean()?n.runAfter(()=>{this.clean(),s.clean()}):s.empty>n.cleanThreshold&&n.runAfter(s.clean),t}});function rw(e){$e.call(this,null,NN,e)}z(rw,$e);function NN(e){return this.value&&!e.modified()?this.value:D(e.name)?W(e.name).map(t=>pn(t)):pn(e.name,e.as)}function Zm(e){F.call(this,Ka(),e)}Zm.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]};z(Zm,F,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),s=r.add,a=r.rem,o=r.mod,u=e.expr;let l=!0;t.visit(t.REM,f=>{const d=ee(f);i.has(d)?i.delete(d):a.push(f)}),t.visit(t.ADD,f=>{u(f,e)?s.push(f):i.set(ee(f),1)});function c(f){const d=ee(f),p=u(f,e),h=i.get(d);p&&h?(i.delete(d),s.push(f)):!p&&!h?(i.set(d,1),a.push(f)):l&&p&&!h&&o.push(f)}return t.visit(t.MOD,c),e.modified()&&(l=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}});function e0(e){F.call(this,[],e)}e0.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]};z(e0,F,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=tw(i,e.as||[]),s=e.index||null,a=r.length;return n.rem=this.value,t.visit(t.SOURCE,o=>{const u=i.map(h=>h(o)),l=u.reduce((h,g)=>Math.max(h,g.length),0);let c=0,f,d,p;for(;c{for(let c=0,f;ca[i]=n(a,e))}});function sw(e){F.call(this,[],e)}z(sw,F,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r=this.value,s=e.size-r.length,a,o,u;if(s>0){for(a=[];--s>=0;)a.push(u=be(i(e))),r.push(u);n.add=n.add.length?n.materialize(n.ADD).add.concat(a):a}else o=r.slice(0,-s),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,r=r.slice(-s);return n.source=this.value=r,n}});const Cl={value:"value",median:p2,mean:fR,min:z5,max:Yo},MN=[];function i0(e){F.call(this,[],e)}i0.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]};function LN(e){var t=e.method||Cl.value,n;if(Cl[t]==null)S("Unrecognized imputation method: "+t);else return t===Cl.value?(n=e.value!==void 0?e.value:0,()=>n):Cl[t]}function BN(e){const t=e.field;return n=>n?t(n):NaN}z(i0,F,{transform(e,t){var n=t.fork(t.ALL),i=LN(e),r=BN(e),s=ze(e.field),a=ze(e.key),o=(e.groupby||[]).map(ze),u=PN(t.source,e.groupby,e.key,e.keyvals),l=[],c=this.value,f=u.domain.length,d,p,h,g,m,y,b,v,A,E;for(m=0,v=u.length;my(m),s=[],a=i?i.slice():[],o={},u={},l,c,f,d,p,h,g,m;for(a.forEach((y,b)=>o[y]=b+1),d=0,g=e.length;dn.add(s))):(r=n.value=n.value||this.init(e),t.visit(t.REM,s=>n.rem(s)),t.visit(t.ADD,s=>n.add(s))),n.changes(),t.visit(t.SOURCE,s=>{se(s,r[n.cellkey(s)].tuple)}),t.reflow(i).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let n,i;for(n=0,i=this._alen;n{const h=Rm(p,a)[o],g=e.counts?p.length:1,m=c||di(p);Cf(h,m,f,d).forEach(y=>{const b={};for(let v=0;v(this._pending=W(r.data),s=>s.touch(this)))}:n.request(e.url,e.format).then(i=>oh(this,t,W(i.data)))}});function zN(e){return e.modified("async")&&!(e.modified("values")||e.modified("url")||e.modified("format"))}function oh(e,t,n){n.forEach(be);const i=t.fork(t.NO_FIELDS&t.NO_SOURCE);return i.rem=e.value,e.value=i.source=i.add=n,e._pending=null,i.rem.length&&i.clean(!0),i}function a0(e){F.call(this,{},e)}a0.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]};z(a0,F,{transform(e,t){const n=e.fields,i=e.index,r=e.values,s=e.default==null?null:e.default,a=e.modified(),o=n.length;let u=a?t.SOURCE:t.ADD,l=t,c=e.as,f,d,p;return r?(d=r.length,o>1&&!c&&S('Multi-field lookup requires explicit "as" parameter.'),c&&c.length!==o*d&&S('The "as" parameter has too few output field names.'),c=c||r.map(ze),f=function(h){for(var g=0,m=0,y,b;gt.modified(h.fields)),u|=p?t.MOD:0),t.visit(u,f),l.modifies(c)}});function uw(e){$e.call(this,null,UN,e)}z(uw,$e);function UN(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let i=1/0,r=-1/0,s,a;for(s=0;sr&&(r=a[1]);return[i,r]}function lw(e){$e.call(this,null,jN,e)}z(lw,$e);function jN(e){return this.value&&!e.modified()?this.value:e.values.reduce((t,n)=>t.concat(n),[])}function cw(e){F.call(this,null,e)}z(cw,F,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function o0(e){wr.call(this,e)}o0.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:Mu,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]};z(o0,wr,{_transform:wr.prototype.transform,transform(e,t){return this._transform(qN(e,t),t)}});function qN(e,t){const n=e.field,i=e.value,r=(e.op==="count"?"__count__":e.op)||"sum",s=Et(n).concat(Et(i)),a=GN(n,e.limit||0,t);return t.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:a.map(()=>r),fields:a.map(o=>WN(o,n,i,s)),as:a.map(o=>o+""),modified:e.modified.bind(e)}}function WN(e,t,n,i){return Vt(r=>t(r)===e?n(r):NaN,i,e+"")}function GN(e,t,n){const i={},r=[];return n.visit(n.SOURCE,s=>{const a=e(s);i[a]||(i[a]=1,r.push(a))}),r.sort(Ya),t?r.slice(0,t):r}function fw(e){wf.call(this,e)}z(fw,wf,{transform(e,t){const n=e.subflow,i=e.field,r=s=>this.subflow(ee(s),n,t,s);return(e.modified("field")||i&&t.modified(Et(i)))&&S("PreFacet does not support field modification."),this.initTargets(),i?(t.visit(t.MOD,s=>{const a=r(s);i(s).forEach(o=>a.mod(o))}),t.visit(t.ADD,s=>{const a=r(s);i(s).forEach(o=>a.add(be(o)))}),t.visit(t.REM,s=>{const a=r(s);i(s).forEach(o=>a.rem(o))})):(t.visit(t.MOD,s=>r(s).mod(s)),t.visit(t.ADD,s=>r(s).add(s)),t.visit(t.REM,s=>r(s).rem(s))),t.clean()&&t.runAfter(()=>this.clean()),t}});function u0(e){F.call(this,null,e)}u0.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]};z(u0,F,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=tw(e.fields,e.as||[]),s=i?(o,u)=>HN(o,u,i,r):mf;let a;return this.value?a=this.value:(t=t.addAll(),a=this.value={}),t.visit(t.REM,o=>{const u=ee(o);n.rem.push(a[u]),a[u]=null}),t.visit(t.ADD,o=>{const u=s(o,be({}));a[ee(o)]=u,n.add.push(u)}),t.visit(t.MOD,o=>{n.mod.push(s(o,a[ee(o)]))}),n}});function HN(e,t,n,i){for(let r=0,s=n.length;r{const d=Sm(f,l);for(let p=0;p{const s=ee(r);n.rem.push(i[s]),i[s]=null}),t.visit(t.ADD,r=>{const s=Cm(r);i[ee(r)]=s,n.add.push(s)}),t.visit(t.MOD,r=>{const s=i[ee(r)];for(const a in r)s[a]=r[a],n.modifies(a);n.mod.push(s)})),n}});function c0(e){F.call(this,[],e),this.count=0}c0.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]};z(c0,F,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,s=this.value.reduce((c,f)=>(c[ee(f)]=1,c),{});let a=this.value,o=this.count,u=0;function l(c){let f,d;a.length=u&&(f=a[d],s[ee(f)]&&n.rem.push(f),a[d]=c)),++o}if(t.rem.length&&(t.visit(t.REM,c=>{const f=ee(c);s[f]&&(s[f]=-1,n.rem.push(c)),--o}),a=a.filter(c=>s[ee(c)]!==-1)),(t.rem.length||i)&&a.length{s[ee(c)]||l(c)}),u=-1),i&&a.length>r){const c=a.length-r;for(let f=0;f{s[ee(c)]&&n.mod.push(c)}),t.add.length&&t.visit(t.ADD,l),(t.add.length||u<0)&&(n.add=a.filter(c=>!s[ee(c)])),this.count=o,this.value=n.source=a,n}});function f0(e){F.call(this,null,e)}f0.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]};z(f0,F,{transform(e,t){if(this.value&&!e.modified())return;const n=t.materialize().fork(t.MOD),i=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=Ms(e.start,e.stop,e.step||1).map(r=>{const s={};return s[i]=r,be(s)}),n.add=t.add.concat(this.value),n}});function pw(e){F.call(this,null,e),this.modified(!0)}z(pw,F,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});function d0(e){F.call(this,null,e)}const gw=["unit0","unit1"];d0.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:mm,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:gw}]};z(d0,F,{transform(e,t){const n=e.field,i=e.interval!==!1,r=e.timezone==="utc",s=this._floor(e,t),a=(r?Qa:Ja)(s.unit).offset,o=e.as||gw,u=o[0],l=o[1],c=s.step;let f=s.start||1/0,d=s.stop||-1/0,p=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(Et(n)))&&(t=t.reflow(!0),p=t.SOURCE,f=1/0,d=-1/0),t.visit(p,h=>{const g=n(h);let m,y;g==null?(h[u]=null,i&&(h[l]=null)):(h[u]=m=y=s(g),i&&(h[l]=y=a(m,c)),md&&(d=y))}),s.start=f,s.stop=d,t.modifies(i?o:u)},_floor(e,t){const n=e.timezone==="utc",{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:dC({extent:e.extent||di(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),s=ym(i),a=this.value||{},o=(n?iC:nC)(s,r);return o.unit=ce(s),o.units=s,o.step=r,o.start=a.start,o.stop=a.stop,this.value=o}});function mw(e){F.call(this,Ka(),e)}z(mw,F,{transform(e,t){const n=t.dataflow,i=e.field,r=this.value,s=o=>r.set(i(o),o);let a=!0;return e.modified("field")||t.modified(i.fields)?(r.clear(),t.visit(t.SOURCE,s)):t.changed()?(t.visit(t.REM,o=>r.delete(i(o))),t.visit(t.ADD,s)):a=!1,this.modified(a),r.empty>n.cleanThreshold&&n.runAfter(r.clean),t.fork()}});function yw(e){F.call(this,null,e)}z(yw,F,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(Ls(e.sort)):t.source).map(e.field))}});function XN(e,t,n,i){const r=lu[e](t,n);return{init:r.init||cr,update:function(s,a){a[i]=r.next(s)}}}const lu={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?++e:e}}},percent_rank:function(){const e=lu.rank(),t=e.next;return{init:e.init,next:n=>(t(n)-1)/(n.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const n=t.data,i=t.compare;let r=t.index;if(e0||S("ntile num must be greater than zero.");const n=lu.cume_dist(),i=n.next;return{init:n.init,next:r=>Math.ceil(t*i(r))}},lag:function(e,t){return t=+t||1,{next:n=>{const i=n.index-t;return i>=0?e(n.data[i]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{const i=n.index+t,r=n.data;return ie(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return t=+t,t>0||S("nth_value nth must be greater than zero."),{next:n=>{const i=n.i0+(t-1);return it=null,next:n=>{const i=e(n.data[n.index]);return i!=null?t=i:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:i=>{const r=i.data;return i.index<=n?t:(n=YN(e,r,i.index))<0?(n=r.length,t=null):t=e(r[n])}}}};function YN(e,t,n){for(let i=t.length;nu[g]=1)}p(e.sort),t.forEach((h,g)=>{const m=n[g],y=i[g],b=r[g]||null,v=ze(m),A=VC(h,v,s[g]);if(p(m),a.push(A),H(lu,h))o.push(XN(h,m,y,A));else{if(m==null&&h!=="count"&&S("Null aggregate field specified."),h==="count"){c.push(A);return}d=!1;let E=l[v];E||(E=l[v]=[],E.field=m,f.push(E)),E.push(XC(h,b,A))}}),(c.length||f.length)&&(this.cell=JN(f,c,d)),this.inputs=Object.keys(u)}const xw=bw.prototype;xw.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()};xw.update=function(e,t){const n=this.cell,i=this.windows,r=e.data,s=i&&i.length;let a;if(n){for(a=e.p0;aKC(u,u.field));const i={num:0,agg:null,store:!1,count:t};if(!n)for(var r=e.length,s=i.agg=Array(r),a=0;athis.group(r(o));let a=this.state;(!a||n)&&(a=this.state=new bw(e)),n||t.modified(a.inputs)?(this.value={},t.visit(t.SOURCE,o=>s(o).add(o))):(t.visit(t.REM,o=>s(o).remove(o)),t.visit(t.ADD,o=>s(o).add(o)));for(let o=0,u=this._mlen;o0&&!r(s[n],s[n-1])&&(e.i0=t.left(s,s[n])),itypeof Image<"u"?Image:null;function p0(e,t,n){const i=e-t+n*2;return e?i>0?i:1:0}const i6="identity",Ca="linear",qi="log",Lu="pow",Bu="sqrt",Ff="symlog",ms="time",ys="utc",ui="sequential",eo="diverging",wa="quantile",Sf="quantize",$f="threshold",g0="ordinal",_p="point",vw="band",m0="bin-ordinal",Ke="continuous",Pu="discrete",Iu="discretizing",vn="interpolating",y0="temporal";function r6(e){return function(t){let n=t[0],i=t[1],r;return i=i&&n[u]<=r&&(s<0&&(s=u),a=u);if(!(s<0))return i=e.invertExtent(n[s]),r=e.invertExtent(n[a]),[i[0]===void 0?i[1]:i[0],r[1]===void 0?r[0]:r[1]]}}function b0(){const e=w2().unknown(void 0),t=e.domain,n=e.range;let i=[0,1],r,s,a=!1,o=0,u=0,l=.5;delete e.unknown;function c(){const f=t().length,d=i[1]g+r*y);return n(d?m.reverse():m)}return e.domain=function(f){return arguments.length?(t(f),c()):t()},e.range=function(f){return arguments.length?(i=[+f[0],+f[1]],c()):i.slice()},e.rangeRound=function(f){return i=[+f[0],+f[1]],a=!0,c()},e.bandwidth=function(){return s},e.step=function(){return r},e.round=function(f){return arguments.length?(a=!!f,c()):a},e.padding=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),o=u,c()):o},e.paddingInner=function(f){return arguments.length?(o=Math.max(0,Math.min(1,f)),c()):o},e.paddingOuter=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),c()):u},e.align=function(f){return arguments.length?(l=Math.max(0,Math.min(1,f)),c()):l},e.invertRange=function(f){if(f[0]==null||f[1]==null)return;const d=i[1]i[1-d])))return y=Math.max(0,mc(p,g)-1),b=g===m?y:mc(p,m)-1,g-p[y]>s+1e-10&&++y,d&&(v=y,y=h-b,b=h-v),y>b?void 0:t().slice(y,b+1)},e.invert=function(f){const d=e.invertRange([f,f]);return d&&d[0]},e.copy=function(){return b0().domain(t()).range(i).round(a).paddingInner(o).paddingOuter(u).align(l)},c()}function Ew(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return Ew(t())},e}function a6(){return Ew(b0().paddingInner(1))}var o6=Array.prototype.map;function u6(e){return o6.call(e,xt)}const l6=Array.prototype.slice;function Aw(){let e=[],t=[];function n(i){return i==null||i!==i?void 0:t[(mc(e,i)-1)%t.length]}return n.domain=function(i){return arguments.length?(e=u6(i),n):e.slice()},n.range=function(i){return arguments.length?(t=l6.call(i),n):t.slice()},n.tickFormat=function(i,r){return X5(e[0],ce(e),i??10,r)},n.copy=function(){return Aw().domain(n.domain()).range(n.range())},n}const Ac=new Map,Cw=Symbol("vega_scale");function ww(e){return e[Cw]=!0,e}function wx(e){return e&&e[Cw]===!0}function c6(e,t,n){const i=function(){const s=t();return s.invertRange||(s.invertRange=s.invert?r6(s):s.invertExtent?s6(s):void 0),s.type=e,ww(s)};return i.metadata=Ln(W(n)),i}function me(e,t,n){return arguments.length>1?(Ac.set(e,c6(e,t,n)),this):Fw(e)?Ac.get(e):void 0}me(i6,dR);me(Ca,V5,Ke);me(qi,hR,[Ke,qi]);me(Lu,pR,Ke);me(Bu,gR,Ke);me(Ff,mR,Ke);me(ms,U5,[Ke,y0]);me(ys,yR,[Ke,y0]);me(ui,g2,[Ke,vn]);me(`${ui}-${Ca}`,g2,[Ke,vn]);me(`${ui}-${qi}`,bR,[Ke,vn,qi]);me(`${ui}-${Lu}`,xR,[Ke,vn]);me(`${ui}-${Bu}`,vR,[Ke,vn]);me(`${ui}-${Ff}`,ER,[Ke,vn]);me(`${eo}-${Ca}`,AR,[Ke,vn]);me(`${eo}-${qi}`,CR,[Ke,vn,qi]);me(`${eo}-${Lu}`,wR,[Ke,vn]);me(`${eo}-${Bu}`,FR,[Ke,vn]);me(`${eo}-${Ff}`,SR,[Ke,vn]);me(wa,$R,[Iu,wa]);me(Sf,kR,Iu);me($f,DR,Iu);me(m0,Aw,[Pu,Iu]);me(g0,w2,Pu);me(vw,b0,Pu);me(_p,a6,Pu);function Fw(e){return Ac.has(e)}function Ps(e,t){const n=Ac.get(e);return n&&n.metadata[t]}function x0(e){return Ps(e,Ke)}function Fa(e){return Ps(e,Pu)}function Tp(e){return Ps(e,Iu)}function Sw(e){return Ps(e,qi)}function f6(e){return Ps(e,y0)}function $w(e){return Ps(e,vn)}function kw(e){return Ps(e,wa)}const d6=["clamp","base","constant","exponent"];function Dw(e,t){const n=t[0],i=ce(t)-n;return function(r){return e(n+r*i)}}function kf(e,t,n){return zR(v0(t||"rgb",n),e)}function Ow(e,t){const n=new Array(t),i=t+1;for(let r=0;re[o]?a[o](e[o]()):0),a)}function v0(e,t){const n=UR[h6(e)];return t!=null&&n&&n.gamma?n.gamma(t):n}function h6(e){return"interpolate"+e.toLowerCase().split("-").map(t=>t[0].toUpperCase()+t.slice(1)).join("")}const p6={blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},g6={accent:IR,category10:PR,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:BR,observable10:LR,paired:MR,pastel1:NR,pastel2:TR,set1:_R,set2:RR,set3:OR,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"};function _w(e){if(D(e))return e;const t=e.length/6|0,n=new Array(t);for(let i=0;ikf(_w(e)));function E0(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(Fx[e]=t,this):Fx[e]}const Kl="symbol",m6="discrete",y6="gradient",b6=e=>D(e)?e.map(t=>String(t)):String(e),x6=(e,t)=>e[1]-t[1],v6=(e,t)=>t[1]-e[1];function A0(e,t,n){let i;return ge(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),n!=null&&(t=Math.min(t,Math.floor(_u(e.domain())/n||1)+1))),j(t)&&(i=t.step,t=t.interval),q(t)&&(t=e.type===ms?Ja(t):e.type==ys?Qa(t):S("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function Nw(e,t,n){let i=e.range(),r=i[0],s=ce(i),a=x6;if(r>s&&(i=s,s=r,r=i,a=v6),r=Math.floor(r),s=Math.ceil(s),t=t.map(o=>[o,e(o)]).filter(o=>r<=o[1]&&o[1]<=s).sort(a).map(o=>o[0]),n>0&&t.length>1){const o=[t[0],ce(t)];for(;t.length>n&&t.length>=3;)t=t.filter((u,l)=>!(l%2));t.length<3&&(t=o)}return t}function C0(e,t){return e.bins?Nw(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function Mw(e,t,n,i,r,s){const a=t.type;let o=b6;if(a===ms||r===ms)o=e.timeFormat(i);else if(a===ys||r===ys)o=e.utcFormat(i);else if(Sw(a)){const u=e.formatFloat(i);if(s||t.bins)o=u;else{const l=Lw(t,n,!1);o=c=>l(c)?u(c):""}}else if(t.tickFormat){const u=t.domain();o=e.formatSpan(u[0],u[u.length-1],n,i)}else i&&(o=e.format(i));return o}function Lw(e,t,n){const i=C0(e,t),r=e.base(),s=Math.log(r),a=Math.max(1,r*t/i.length),o=u=>{let l=u/Math.pow(r,Math.round(Math.log(u)/s));return l*r1?i[1]-i[0]:i[0],a;for(a=1;aNp[e.type]||e.bins;function Iw(e,t,n,i,r,s,a){const o=Bw[t.type]&&s!==ms&&s!==ys?E6(e,t,r):Mw(e,t,n,r,s,a);return i===Kl&&w6(t)?F6(o):i===m6?S6(o):$6(o)}const F6=e=>(t,n,i)=>{const r=Sx(i[n+1],Sx(i.max,1/0)),s=$x(t,e),a=$x(r,e);return s&&a?s+" – "+a:a?"< "+a:"≥ "+s},Sx=(e,t)=>e??t,S6=e=>(t,n)=>n?e(t):null,$6=e=>t=>e(t),$x=(e,t)=>Number.isFinite(e)?t(e):null;function k6(e){const t=e.domain(),n=t.length-1;let i=+t[0],r=+ce(t),s=r-i;if(e.type===$f){const a=n?s/n:.1;i-=a,r+=a,s=r-i}return a=>(a-i)/s}function D6(e,t,n,i){const r=i||t.type;return q(n)&&f6(r)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),!n&&r===ms?e.timeFormat("%A, %d %B %Y, %X"):!n&&r===ys?e.utcFormat("%A, %d %B %Y, %X UTC"):Iw(e,t,5,null,n,i,!0)}function zw(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=D6(e,t,n.format,n.formatType);if(Tp(t.type)){const s=Pw(t).slice(1).map(r),a=s.length;return`${a} boundar${a===1?"y":"ies"}: ${s.join(", ")}`}else if(Fa(t.type)){const s=t.domain(),a=s.length,o=a>i?s.slice(0,i-2).map(r).join(", ")+", ending with "+s.slice(-1).map(r):s.map(r).join(", ");return`${a} value${a===1?"":"s"}: ${o}`}else{const s=t.domain();return`values from ${r(s[0])} to ${r(ce(s))}`}}let Uw=0;function O6(){Uw=0}const Cc="p_";function w0(e){return e&&e.gradient}function jw(e,t,n){const i=e.gradient;let r=e.id,s=i==="radial"?Cc:"";return r||(r=e.id="gradient_"+Uw++,i==="radial"?(e.x1=Zn(e.x1,.5),e.y1=Zn(e.y1,.5),e.r1=Zn(e.r1,0),e.x2=Zn(e.x2,.5),e.y2=Zn(e.y2,.5),e.r2=Zn(e.r2,.5),s=Cc):(e.x1=Zn(e.x1,0),e.y1=Zn(e.y1,0),e.x2=Zn(e.x2,1),e.y2=Zn(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+s+r+")"}function Zn(e,t){return e??t}function qw(e,t){var n=[],i;return i={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:n,stop:function(r,s){return n.push({offset:r,color:s}),i}}}const kx={basis:{curve:A_},"basis-closed":{curve:E_},"basis-open":{curve:v_},bundle:{curve:x_,tension:"beta",value:.85},cardinal:{curve:b_,tension:"tension",value:0},"cardinal-open":{curve:y_,tension:"tension",value:0},"cardinal-closed":{curve:m_,tension:"tension",value:0},"catmull-rom":{curve:g_,tension:"alpha",value:.5},"catmull-rom-closed":{curve:p_,tension:"alpha",value:.5},"catmull-rom-open":{curve:h_,tension:"alpha",value:.5},linear:{curve:d_},"linear-closed":{curve:f_},monotone:{horizontal:c_,vertical:l_},natural:{curve:u_},step:{curve:o_},"step-after":{curve:a_},"step-before":{curve:s_}};function F0(e,t,n){var i=H(kx,e)&&kx[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&n!=null&&(r=r[i.tension](n))),r}const R6={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},_6=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,T6=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,N6=/^((\s+,?\s*)|(,\s*))/,M6=/^[01]/;function Sa(e){const t=[];return(e.match(_6)||[]).forEach(i=>{let r=i[0];const s=r.toLowerCase(),a=R6[s],o=L6(s,a,i.slice(1).trim()),u=o.length;if(u1&&(g=Math.sqrt(g),n*=g,i*=g);const m=d/n,y=f/n,b=-f/i,v=d/i,A=m*o+y*u,E=b*o+v*u,C=m*e+y*t,x=b*e+v*t;let R=1/((C-A)*(C-A)+(x-E)*(x-E))-.25;R<0&&(R=0);let L=Math.sqrt(R);s==r&&(L=-L);const J=.5*(A+C)-L*(x-E),ne=.5*(E+x)+L*(C-A),de=Math.atan2(E-ne,A-J);let O=Math.atan2(x-ne,C-J)-de;O<0&&s===1?O+=si:O>0&&s===0&&(O-=si);const I=Math.ceil(Math.abs(O/(ss+.001))),G=[];for(let X=0;X+e}function wl(e,t,n){return Math.max(t,Math.min(e,n))}function Hw(){var e=j6,t=q6,n=W6,i=G6,r=Di(0),s=r,a=r,o=r,u=null;function l(c,f,d){var p,h=f??+e.call(this,c),g=d??+t.call(this,c),m=+n.call(this,c),y=+i.call(this,c),b=Math.min(m,y)/2,v=wl(+r.call(this,c),0,b),A=wl(+s.call(this,c),0,b),E=wl(+a.call(this,c),0,b),C=wl(+o.call(this,c),0,b);if(u||(u=p=tm()),v<=0&&A<=0&&E<=0&&C<=0)u.rect(h,g,m,y);else{var x=h+m,w=g+y;u.moveTo(h+v,g),u.lineTo(x-A,g),u.bezierCurveTo(x-nr*A,g,x,g+nr*A,x,g+A),u.lineTo(x,w-C),u.bezierCurveTo(x,w-nr*C,x-nr*C,w,x-C,w),u.lineTo(h+E,w),u.bezierCurveTo(h+nr*E,w,h,w-nr*E,h,w-E),u.lineTo(h,g+v),u.bezierCurveTo(h,g+nr*v,h+nr*v,g,h+v,g),u.closePath()}if(p)return u=null,p+""||null}return l.x=function(c){return arguments.length?(e=Di(c),l):e},l.y=function(c){return arguments.length?(t=Di(c),l):t},l.width=function(c){return arguments.length?(n=Di(c),l):n},l.height=function(c){return arguments.length?(i=Di(c),l):i},l.cornerRadius=function(c,f,d,p){return arguments.length?(r=Di(c),s=f!=null?Di(f):r,o=d!=null?Di(d):r,a=p!=null?Di(p):s,l):r},l.context=function(c){return arguments.length?(u=c??null,l):u},l}function Vw(){var e,t,n,i,r=null,s,a,o,u;function l(f,d,p){const h=p/2;if(s){var g=o-d,m=f-a;if(g||m){var y=Math.hypot(g,m),b=(g/=y)*u,v=(m/=y)*u,A=Math.atan2(m,g);r.moveTo(a-b,o-v),r.lineTo(f-g*h,d-m*h),r.arc(f,d,h,A-Math.PI,A),r.lineTo(a+b,o+v),r.arc(a,o,u,A,A+Math.PI)}else r.arc(f,d,h,0,si);r.closePath()}else s=1;a=f,o=d,u=h}function c(f){var d,p=f.length,h,g=!1,m;for(r==null&&(r=m=tm()),d=0;d<=p;++d)!(de.x||0,ju=e=>e.y||0,H6=e=>e.width||0,V6=e=>e.height||0,X6=e=>(e.x||0)+(e.width||0),Y6=e=>(e.y||0)+(e.height||0),K6=e=>e.startAngle||0,J6=e=>e.endAngle||0,Q6=e=>e.padAngle||0,Z6=e=>e.innerRadius||0,eM=e=>e.outerRadius||0,tM=e=>e.cornerRadius||0,nM=e=>zu(e.cornerRadiusTopLeft,e.cornerRadius)||0,iM=e=>zu(e.cornerRadiusTopRight,e.cornerRadius)||0,rM=e=>zu(e.cornerRadiusBottomRight,e.cornerRadius)||0,sM=e=>zu(e.cornerRadiusBottomLeft,e.cornerRadius)||0,aM=e=>zu(e.size,64),oM=e=>e.size||1,Df=e=>e.defined!==!1,uM=e=>Gw(e.shape||"circle"),lM=i_().startAngle(K6).endAngle(J6).padAngle(Q6).innerRadius(Z6).outerRadius(eM).cornerRadius(tM),cM=m2().x(Uu).y1(ju).y0(Y6).defined(Df),fM=m2().y(ju).x1(Uu).x0(X6).defined(Df),dM=r_().x(Uu).y(ju).defined(Df),hM=Hw().x(Uu).y(ju).width(H6).height(V6).cornerRadius(nM,iM,rM,sM),pM=jR().type(uM).size(aM),gM=Vw().x(Uu).y(ju).defined(Df).size(oM);function S0(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function mM(e,t){return lM.context(e)(t)}function yM(e,t){const n=t[0],i=n.interpolate||"linear";return(n.orient==="horizontal"?fM:cM).curve(F0(i,n.orient,n.tension)).context(e)(t)}function bM(e,t){const n=t[0],i=n.interpolate||"linear";return dM.curve(F0(i,n.orient,n.tension)).context(e)(t)}function to(e,t,n,i){return hM.context(e)(t,n,i)}function xM(e,t){return(t.mark.shape||t.shape).context(e)(t)}function vM(e,t){return pM.context(e)(t)}function EM(e,t){return gM.context(e)(t)}var Xw=1;function Yw(){Xw=1}function $0(e,t,n){var i=t.clip,r=e._defs,s=t.clip_id||(t.clip_id="clip"+Xw++),a=r.clipping[s]||(r.clipping[s]={id:s});return ae(i)?a.path=i(null):S0(n)?a.path=to(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+s+")"}function We(e){this.clear(),e&&this.union(e)}We.prototype={clone(){return new We(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,i){return nthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const i=this.rotatedPoints(e,t,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},rotatedPoints(e,t,n){var{x1:i,y1:r,x2:s,y2:a}=this,o=Math.cos(e),u=Math.sin(e),l=t-t*o+n*u,c=n-t*u-n*o;return[o*i-u*r+l,u*i+o*r+c,o*i-u*a+l,u*i+o*a+c,o*s-u*r+l,u*s+o*r+c,o*s-u*a+l,u*s+o*a+c]},union(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2e.x2||this.y2e.y2)},contains(e,t){return!(ethis.x2||tthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}};function Of(e){this.mark=e,this.bounds=this.bounds||new We}function Rf(e){Of.call(this,e),this.items=this.items||[]}z(Rf,Of);class Kw{constructor(t){this._pending=0,this._loader=t||hf()}pending(){return this._pending}sanitizeURL(t){const n=this;return _x(n),n._loader.sanitize(t,{context:"href"}).then(i=>(xo(n),i)).catch(()=>(xo(n),null))}loadImage(t){const n=this,i=n6();return _x(n),n._loader.sanitize(t,{context:"image"}).then(r=>{const s=r.href;if(!s||!i)throw{url:s};const a=new i,o=H(r,"crossOrigin")?r.crossOrigin:"anonymous";return o!=null&&(a.crossOrigin=o),a.onload=()=>xo(n),a.onerror=()=>xo(n),a.src=s,a}).catch(r=>(xo(n),{complete:!1,width:0,height:0,src:r&&r.url||""}))}ready(){const t=this;return new Promise(n=>{function i(r){t.pending()?setTimeout(()=>{i(!0)},10):n(r)}i(!1)})}}function _x(e){e._pending+=1}function xo(e){e._pending-=1}function Vi(e,t,n){if(t.stroke&&t.opacity!==0&&t.strokeOpacity!==0){const i=t.strokeWidth!=null?+t.strokeWidth:1;e.expand(i+(n?AM(t,i):0))}return e}function AM(e,t){return e.strokeJoin&&e.strokeJoin!=="miter"?0:t}const CM=si-1e-8;let _f,Jl,Ql,us,Mp,Zl,Lp,Bp;const fr=(e,t)=>_f.add(e,t),ec=(e,t)=>fr(Jl=e,Ql=t),Tx=e=>fr(e,_f.y1),Nx=e=>fr(_f.x1,e),as=(e,t)=>Mp*e+Lp*t,os=(e,t)=>Zl*e+Bp*t,fh=(e,t)=>fr(as(e,t),os(e,t)),dh=(e,t)=>ec(as(e,t),os(e,t));function qu(e,t){return _f=e,t?(us=t*Fr,Mp=Bp=Math.cos(us),Zl=Math.sin(us),Lp=-Zl):(Mp=Bp=1,us=Zl=Lp=0),wM}const wM={beginPath(){},closePath(){},moveTo:dh,lineTo:dh,rect(e,t,n,i){us?(fh(e+n,t),fh(e+n,t+i),fh(e,t+i),dh(e,t)):(fr(e+n,t+i),ec(e,t))},quadraticCurveTo(e,t,n,i){const r=as(e,t),s=os(e,t),a=as(n,i),o=os(n,i);Mx(Jl,r,a,Tx),Mx(Ql,s,o,Nx),ec(a,o)},bezierCurveTo(e,t,n,i,r,s){const a=as(e,t),o=os(e,t),u=as(n,i),l=os(n,i),c=as(r,s),f=os(r,s);Lx(Jl,a,u,c,Tx),Lx(Ql,o,l,f,Nx),ec(c,f)},arc(e,t,n,i,r,s){if(i+=us,r+=us,Jl=n*Math.cos(r)+e,Ql=n*Math.sin(r)+t,Math.abs(r-i)>CM)fr(e-n,t-n),fr(e+n,t+n);else{const a=l=>fr(n*Math.cos(l)+e,n*Math.sin(l)+t);let o,u;if(a(i),a(r),r!==i)if(i=i%si,i<0&&(i+=si),r=r%si,r<0&&(r+=si),rr;++u,o-=ss)a(o);else for(o=i-i%ss+ss,u=0;u<4&&oB6?(c=a*a+o*s,c>=0&&(c=Math.sqrt(c),u=(-a+c)/s,l=(-a-c)/s)):u=.5*o/a,0d)return!1;g>f&&(f=g)}else if(p>0){if(g0?(e.globalAlpha=n,e.fillStyle=Zw(e,t,t.fill),!0):!1}var SM=[];function ka(e,t,n){var i=(i=t.strokeWidth)!=null?i:1;return i<=0?!1:(n*=t.strokeOpacity==null?1:t.strokeOpacity,n>0?(e.globalAlpha=n,e.strokeStyle=Zw(e,t,t.stroke),e.lineWidth=i,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||SM),e.lineDashOffset=t.strokeDashOffset||0),!0):!1)}function $M(e,t){return e.zindex-t.zindex||e.index-t.index}function O0(e){if(!e.zdirty)return e.zitems;var t=e.items,n=[],i,r,s;for(r=0,s=t.length;r=0;)if(i=t(n[r]))return i;if(n===s){for(n=e.items,r=n.length;--r>=0;)if(!n[r].zindex&&(i=t(n[r])))return i}return null}function R0(e){return function(t,n,i){Pn(n,r=>{(!i||i.intersects(r.bounds))&&eF(e,t,r,r)})}}function kM(e){return function(t,n,i){n.items.length&&(!i||i.intersects(n.bounds))&&eF(e,t,n.items[0],n.items)}}function eF(e,t,n,i){var r=n.opacity==null?1:n.opacity;r!==0&&(e(t,i)||($a(t,n),n.fill&&wc(t,n,r)&&t.fill(),n.stroke&&ka(t,n,r)&&t.stroke()))}function Tf(e){return e=e||gn,function(t,n,i,r,s,a){return i*=t.pixelRatio,r*=t.pixelRatio,Fc(n,o=>{const u=o.bounds;if(!(u&&!u.contains(s,a)||!u)&&e(t,o,i,r,s,a))return o})}}function Wu(e,t){return function(n,i,r,s){var a=Array.isArray(i)?i[0]:i,o=t??a.fill,u=a.stroke&&n.isPointInStroke,l,c;return u&&(l=a.strokeWidth,c=a.strokeCap,n.lineWidth=l??1,n.lineCap=c??"butt"),e(n,i)?!1:o&&n.isPointInPath(r,s)||u&&n.isPointInStroke(r,s)}}function _0(e){return Tf(Wu(e))}function ls(e,t){return"translate("+e+","+t+")"}function T0(e){return"rotate("+e+")"}function DM(e,t){return"scale("+e+","+t+")"}function tF(e){return ls(e.x||0,e.y||0)}function OM(e){return ls(e.x||0,e.y||0)+(e.angle?" "+T0(e.angle):"")}function RM(e){return ls(e.x||0,e.y||0)+(e.angle?" "+T0(e.angle):"")+(e.scaleX||e.scaleY?" "+DM(e.scaleX||1,e.scaleY||1):"")}function N0(e,t,n){function i(a,o){a("transform",OM(o)),a("d",t(null,o))}function r(a,o){return t(qu(a,o.angle),o),Vi(a,o).translate(o.x||0,o.y||0)}function s(a,o){var u=o.x||0,l=o.y||0,c=o.angle||0;a.translate(u,l),c&&a.rotate(c*=Fr),a.beginPath(),t(a,o),c&&a.rotate(-c),a.translate(-u,-l)}return{type:e,tag:"path",nested:!1,attr:i,bound:r,draw:R0(s),pick:_0(s),isect:n||k0(s)}}var _M=N0("arc",mM);function TM(e,t){for(var n=e[0].orient==="horizontal"?t[1]:t[0],i=e[0].orient==="horizontal"?"y":"x",r=e.length,s=1/0,a,o;--r>=0;)e[r].defined!==!1&&(o=Math.abs(e[r][i]-n),o=0;)if(e[i].defined!==!1&&(r=e[i].x-t[0],s=e[i].y-t[1],a=r*r+s*s,a=0;)if(e[n].defined!==!1&&(i=e[n].x-t[0],r=e[n].y-t[1],s=i*i+r*r,i=e[n].size||1,s.5&&t<1.5?.5-Math.abs(t-1):0}function PM(e,t){e("transform",tF(t))}function rF(e,t){const n=iF(t);e("d",to(null,t,n,n))}function IM(e,t){e("class","background"),e("aria-hidden",!0),rF(e,t)}function zM(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?rF(e,t):e("d","")}function UM(e,t,n){const i=t.clip?$0(n,t,t):null;e("clip-path",i)}function jM(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let r=0;r{const s=r.x||0,a=r.y||0,o=r.strokeForeground,u=r.opacity==null?1:r.opacity;(r.stroke||r.fill)&&u&&(fu(e,r,s,a),$a(e,r),r.fill&&wc(e,r,u)&&e.fill(),r.stroke&&!o&&ka(e,r,u)&&e.stroke()),e.save(),e.translate(s,a),r.clip&&nF(e,r),n&&n.translate(-s,-a),Pn(r,l=>{(l.marktype==="group"||i==null||i.includes(l.marktype))&&this.draw(e,l,n,i)}),n&&n.translate(s,a),e.restore(),o&&r.stroke&&u&&(fu(e,r,s,a),$a(e,r),ka(e,r,u)&&e.stroke())})}function VM(e,t,n,i,r,s){if(t.bounds&&!t.bounds.contains(r,s)||!t.items)return null;const a=n*e.pixelRatio,o=i*e.pixelRatio;return Fc(t,u=>{let l,c,f;const d=u.bounds;if(d&&!d.contains(r,s))return;c=u.x||0,f=u.y||0;const p=c+(u.width||0),h=f+(u.height||0),g=u.clip;if(g&&(rp||sh))return;if(e.save(),e.translate(c,f),c=r-c,f=s-f,g&&S0(u)&&!GM(e,u,a,o))return e.restore(),null;const m=u.strokeForeground,y=t.interactive!==!1;return y&&m&&u.stroke&&WM(e,u,a,o)?(e.restore(),u):(l=Fc(u,b=>XM(b,c,f)?this.pick(b,n,i,c,f):null),!l&&y&&(u.fill||!m&&u.stroke)&&qM(e,u,a,o)&&(l=u),e.restore(),l||null)})}function XM(e,t,n){return(e.interactive!==!1||e.marktype==="group")&&e.bounds&&e.bounds.contains(t,n)}var YM={type:"group",tag:"g",nested:!1,attr:PM,bound:jM,draw:HM,pick:VM,isect:Jw,content:UM,background:IM,foreground:zM},du={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function L0(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then(i=>{e.image=i,e.image.url=e.url})),n}function B0(e,t){return e.width!=null?e.width:!t||!t.width?0:e.aspect!==!1&&e.height?e.height*t.width/t.height:t.width}function P0(e,t){return e.height!=null?e.height:!t||!t.height?0:e.aspect!==!1&&e.width?e.width*t.height/t.width:t.height}function Nf(e,t){return e==="center"?t/2:e==="right"?t:0}function Mf(e,t){return e==="middle"?t/2:e==="bottom"?t:0}function KM(e,t,n){const i=L0(t,n),r=B0(t,i),s=P0(t,i),a=(t.x||0)-Nf(t.align,r),o=(t.y||0)-Mf(t.baseline,s),u=!i.src&&i.toDataURL?i.toDataURL():i.src||"";e("href",u,du["xmlns:xlink"],"xlink:href"),e("transform",ls(a,o)),e("width",r),e("height",s),e("preserveAspectRatio",t.aspect===!1?"none":"xMidYMid")}function JM(e,t){const n=t.image,i=B0(t,n),r=P0(t,n),s=(t.x||0)-Nf(t.align,i),a=(t.y||0)-Mf(t.baseline,r);return e.set(s,a,s+i,a+r)}function QM(e,t,n){Pn(t,i=>{if(n&&!n.intersects(i.bounds))return;const r=L0(i,this);let s=B0(i,r),a=P0(i,r);if(s===0||a===0)return;let o=(i.x||0)-Nf(i.align,s),u=(i.y||0)-Mf(i.baseline,a),l,c,f,d;i.aspect!==!1&&(c=r.width/r.height,f=i.width/i.height,c===c&&f===f&&c!==f&&(f{if(!(n&&!n.intersects(i.bounds))){var r=i.opacity==null?1:i.opacity;r&&sF(e,i,r)&&($a(e,i),e.stroke())}})}function c8(e,t,n,i){return e.isPointInStroke?sF(e,t,1)&&e.isPointInStroke(n,i):!1}var f8={type:"rule",tag:"line",nested:!1,attr:o8,bound:u8,draw:l8,pick:Tf(c8),isect:Qw},d8=N0("shape",xM),h8=N0("symbol",vM,D0);const zx=W2();var Zt={height:xi,measureWidth:I0,estimateWidth:Sc,width:Sc,canvas:aF};aF(!0);function aF(e){Zt.width=e&&Ar?I0:Sc}function Sc(e,t){return oF($r(e,t),xi(e))}function oF(e,t){return~~(.8*e.length*t)}function I0(e,t){return xi(e)<=0||!(t=$r(e,t))?0:uF(t,Lf(e))}function uF(e,t){const n=`(${t}) ${e}`;let i=zx.get(n);return i===void 0&&(Ar.font=t,i=Ar.measureText(e).width,zx.set(n,i)),i}function xi(e){return e.fontSize!=null?+e.fontSize||0:11}function Sr(e){return e.lineHeight!=null?e.lineHeight:xi(e)+2}function p8(e){return D(e)?e.length>1?e:e[0]:e}function Gu(e){return p8(e.lineBreak&&e.text&&!D(e.text)?e.text.split(e.lineBreak):e.text)}function z0(e){const t=Gu(e);return(D(t)?t.length-1:0)*Sr(e)}function $r(e,t){const n=t==null?"":(t+"").trim();return e.limit>0&&n.length?m8(e,n):n}function g8(e){if(Zt.width===I0){const t=Lf(e);return n=>uF(n,t)}else if(Zt.width===Sc){const t=xi(e);return n=>oF(n,t)}else return t=>Zt.width(e,t)}function m8(e,t){var n=+e.limit,i=g8(e);if(i(t)>>1,i(t.slice(u))>n?a=u+1:o=u;return r+t.slice(a)}else{for(;a>>1),i(t.slice(0,u))Math.max(d,Zt.width(t,p)),0)):f=Zt.width(t,c),r==="center"?u-=f/2:r==="right"&&(u-=f),e.set(u+=a,l+=o,u+f,l+i),t.angle&&!n)e.rotate(t.angle*Fr,a,o);else if(n===2)return e.rotatedPoints(t.angle*Fr,a,o);return e}function x8(e,t,n){Pn(t,i=>{var r=i.opacity==null?1:i.opacity,s,a,o,u,l,c,f;if(!(n&&!n.intersects(i.bounds)||r===0||i.fontSize<=0||i.text==null||i.text.length===0)){if(e.font=Lf(i),e.textAlign=i.align||"left",s=Bf(i),a=s.x1,o=s.y1,i.angle&&(e.save(),e.translate(a,o),e.rotate(i.angle*Fr),a=o=0),a+=i.dx||0,o+=(i.dy||0)+U0(i),c=Gu(i),$a(e,i),D(c))for(l=Sr(i),u=0;ut;)e.removeChild(n[--i]);return e}function pF(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function Pf(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function F8(e,t,n,i){var r=e&&e.mark,s,a;if(r&&(s=sn[r.marktype]).tip){for(a=Pf(t,n),a[0]-=i[0],a[1]-=i[1];e=e.mark.group;)a[0]-=e.x||0,a[1]-=e.y||0;e=s.tip(r.items,a)}return e}let W0=class{constructor(t,n){this._active=null,this._handlers={},this._loader=t||hf(),this._tooltip=n||S8}initialize(t,n,i){return this._el=t,this._obj=i||null,this.origin(n)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()}scene(t){return arguments.length?(this._scene=t,this):this._scene}on(){}off(){}_handlerIndex(t,n,i){for(let r=t?t.length:0;--r>=0;)if(t[r].type===n&&(!i||t[r].handler===i))return r;return-1}handlers(t){const n=this._handlers,i=[];if(t)i.push(...n[this.eventName(t)]);else for(const r in n)i.push(...n[r]);return i}eventName(t){const n=t.indexOf(".");return n<0?t:t.slice(0,n)}handleHref(t,n,i){this._loader.sanitize(i,{context:"href"}).then(r=>{const s=new MouseEvent(t.type,t),a=dr(null,"a");for(const o in r)a.setAttribute(o,r[o]);a.dispatchEvent(s)}).catch(()=>{})}handleTooltip(t,n,i){if(n&&n.tooltip!=null){n=F8(n,t,this.canvas(),this._origin);const r=i&&n&&n.tooltip||null;this._tooltip.call(this._obj,this,t,n,r)}}getItemBoundingClientRect(t){const n=this.canvas();if(!n)return;const i=n.getBoundingClientRect(),r=this._origin,s=t.bounds,a=s.width(),o=s.height();let u=s.x1+r[0]+i.left,l=s.y1+r[1]+i.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,l+=t.y||0;return{x:u,y:l,width:a,height:o,left:u,top:l,right:u+a,bottom:l+o}}};function S8(e,t,n,i){e.element().setAttribute("title",i||"")}class Vu{constructor(t){this._el=null,this._bgcolor=null,this._loader=new Kw(t)}initialize(t,n,i,r,s){return this._el=t,this.resize(n,i,r,s)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(t){return arguments.length===0?this._bgcolor:(this._bgcolor=t,this)}resize(t,n,i,r){return this._width=t,this._height=n,this._origin=i||[0,0],this._scale=r||1,this}dirty(){}render(t,n){const i=this;return i._call=function(){i._render(t,n)},i._call(),i._call=null,i}_render(){}renderAsync(t,n){const i=this.render(t,n);return this._ready?this._ready.then(()=>i):Promise.resolve(i)}_load(t,n){var i=this,r=i._loader[t](n);if(!i._ready){const s=i._call;i._ready=i._loader.ready().then(a=>{a&&s(),i._ready=null})}return r}sanitizeURL(t){return this._load("sanitizeURL",t)}loadImage(t){return this._load("loadImage",t)}}const $8="keydown",k8="keypress",D8="keyup",gF="dragenter",nc="dragleave",mF="dragover",zp="pointerdown",O8="pointerup",$c="pointermove",ic="pointerout",yF="pointerover",Up="mousedown",R8="mouseup",bF="mousemove",kc="mouseout",xF="mouseover",Dc="click",_8="dblclick",T8="wheel",vF="mousewheel",Oc="touchstart",Rc="touchmove",_c="touchend",N8=[$8,k8,D8,gF,nc,mF,zp,O8,$c,ic,yF,Up,R8,bF,kc,xF,Dc,_8,T8,vF,Oc,Rc,_c],jp=$c,Jo=kc,qp=Dc;class Xu extends W0{constructor(t,n){super(t,n),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=N8,this.pointermove=Wx([$c,bF],[yF,xF],[ic,kc]),this.dragover=Wx([mF],[gF],[nc]),this.pointerout=Gx([ic,kc]),this.dragleave=Gx([nc])}initialize(t,n,i){return this._canvas=t&&q0(t,"canvas"),[Dc,Up,zp,$c,ic,nc].forEach(r=>qx(this,r)),super.initialize(t,n,i)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(t){this.fire(vF,t)}pointerdown(t){this._down=this._active,this.fire(zp,t)}mousedown(t){this._down=this._active,this.fire(Up,t)}click(t){this._down===this._active&&(this.fire(Dc,t),this._down=null)}touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(Oc,t,!0)}touchmove(t){this.fire(Rc,t,!0)}touchend(t){this.fire(_c,t,!0),this._touch=null}fire(t,n,i){const r=i?this._touch:this._active,s=this._handlers[t];if(n.vegaType=t,t===qp&&r&&r.href?this.handleHref(n,r,r.href):(t===jp||t===Jo)&&this.handleTooltip(n,r,t!==Jo),s)for(let a=0,o=s.length;a=0&&r.splice(s,1),this}pickEvent(t){const n=Pf(t,this._canvas),i=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-i[0],n[1]-i[1])}pick(t,n,i,r,s){const a=this.context();return sn[t.marktype].pick.call(this,a,t,n,i,r,s)}}const M8=e=>e===Oc||e===Rc||e===_c?[Oc,Rc,_c]:[e];function qx(e,t){M8(t).forEach(n=>L8(e,n))}function L8(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?i=>e[t](i):i=>e.fire(t,i)))}function Uo(e,t,n){t.forEach(i=>e.fire(i,n))}function Wx(e,t,n){return function(i){const r=this._active,s=this.pickEvent(i);s===r?Uo(this,e,i):((!r||!r.exit)&&Uo(this,n,i),this._active=s,Uo(this,t,i),Uo(this,e,i))}}function Gx(e){return function(t){Uo(this,e,t),this._active=null}}function B8(){return typeof window<"u"&&window.devicePixelRatio||1}function P8(e,t,n,i,r,s){const a=typeof HTMLElement<"u"&&e instanceof HTMLElement&&e.parentNode!=null,o=e.getContext("2d"),u=a?B8():r;e.width=t*u,e.height=n*u;for(const l in s)o[l]=s[l];return a&&u!==1&&(e.style.width=t+"px",e.style.height=n+"px"),o.pixelRatio=u,o.setTransform(u,0,0,u,u*i[0],u*i[1]),e}class Tc extends Vu{constructor(t){super(t),this._options={},this._redraw=!1,this._dirty=new We,this._tempb=new We}initialize(t,n,i,r,s,a){return this._options=a||{},this._canvas=this._options.externalContext?null:Er(1,1,this._options.type),t&&this._canvas&&(ln(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(t,n,i,r,s)}resize(t,n,i,r){if(super.resize(t,n,i,r),this._canvas)P8(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const s=this._options.externalContext;s||S("CanvasRenderer is missing a valid canvas or context"),s.scale(this._scale,this._scale),s.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(t){const n=this._tempb.clear().union(t.bounds);let i=t.mark.group;for(;i;)n.translate(i.x||0,i.y||0),i=i.mark.group;this._dirty.union(n)}_render(t,n){const i=this.context(),r=this._origin,s=this._width,a=this._height,o=this._dirty,u=I8(r,s,a);i.save();const l=this._redraw||o.empty()?(this._redraw=!1,u.expand(1)):z8(i,u.intersect(o),r);return this.clear(-r[0],-r[1],s,a),this.draw(i,t,l,n),i.restore(),o.clear(),this}draw(t,n,i,r){if(n.marktype!=="group"&&r!=null&&!r.includes(n.marktype))return;const s=sn[n.marktype];n.clip&&BM(t,n),s.draw.call(this,t,n,i,r),n.clip&&t.restore()}clear(t,n,i,r){const s=this._options,a=this.context();s.type!=="pdf"&&!s.externalContext&&a.clearRect(t,n,i,r),this._bgcolor!=null&&(a.fillStyle=this._bgcolor,a.fillRect(t,n,i,r))}}const I8=(e,t,n)=>new We().set(0,0,t,n).translate(-e[0],-e[1]);function z8(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-(n[0]%1),-(n[1]%1)),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}class EF extends W0{constructor(t,n){super(t,n);const i=this;i._hrefHandler=hh(i,(r,s)=>{s&&s.href&&i.handleHref(r,s,s.href)}),i._tooltipHandler=hh(i,(r,s)=>{i.handleTooltip(r,s,r.type!==Jo)})}initialize(t,n,i){let r=this._svg;return r&&(r.removeEventListener(qp,this._hrefHandler),r.removeEventListener(jp,this._tooltipHandler),r.removeEventListener(Jo,this._tooltipHandler)),this._svg=r=t&&q0(t,"svg"),r&&(r.addEventListener(qp,this._hrefHandler),r.addEventListener(jp,this._tooltipHandler),r.addEventListener(Jo,this._tooltipHandler)),super.initialize(t,n,i)}canvas(){return this._svg}on(t,n){const i=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[i],t,n)<0){const a={type:t,handler:n,listener:hh(this,n)};(r[i]||(r[i]=[])).push(a),this._svg&&this._svg.addEventListener(i,a.listener)}return this}off(t,n){const i=this.eventName(t),r=this._handlers[i],s=this._handlerIndex(r,t,n);return s>=0&&(this._svg&&this._svg.removeEventListener(i,r[s].listener),r.splice(s,1)),this}}const hh=(e,t)=>n=>{let i=n.target.__data__;i=Array.isArray(i)?i[0]:i,n.vegaType=n.type,t.call(e._obj,n,i)},AF="aria-hidden",G0="aria-label",H0="role",V0="aria-roledescription",CF="graphics-object",X0="graphics-symbol",wF=(e,t,n)=>({[H0]:e,[V0]:t,[G0]:n||void 0}),U8=Ln(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Hx={axis:{desc:"axis",caption:W8},legend:{desc:"legend",caption:G8},"title-text":{desc:"title",caption:e=>`Title text '${Xx(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${Xx(e)}'`}},Vx={ariaRole:H0,ariaRoleDescription:V0,description:G0};function FF(e,t){const n=t.aria===!1;if(e(AF,n||void 0),n||t.description==null)for(const i in Vx)e(Vx[i],void 0);else{const i=t.mark.marktype;e(G0,t.description),e(H0,t.ariaRole||(i==="group"?CF:X0)),e(V0,t.ariaRoleDescription||`${i} mark`)}}function SF(e){return e.aria===!1?{[AF]:!0}:U8[e.role]?null:Hx[e.role]?q8(e,Hx[e.role]):j8(e)}function j8(e){const t=e.marktype,n=t==="group"||t==="text"||e.items.some(i=>i.description!=null&&i.aria!==!1);return wF(n?CF:X0,`${t} mark container`,e.description)}function q8(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return wF(t.role||X0,t.desc,n.description||i(n))}catch{return null}}function Xx(e){return W(e.text).join(" ")}function W8(e){const t=e.datum,n=e.orient,i=t.title?$F(e):null,r=e.context,s=r.scales[t.scale].value,a=r.dataflow.locale(),o=s.type;return`${n==="left"||n==="right"?"Y":"X"}-axis`+(i?` titled '${i}'`:"")+` for a ${Fa(o)?"discrete":o} scale with ${zw(a,s,e)}`}function G8(e){const t=e.datum,n=t.title?$F(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,s=Object.keys(r),a=e.context,o=a.scales[r[s[0]]].value,u=a.dataflow.locale();return V8(i)+(n?` titled '${n}'`:"")+` for ${H8(s)} with ${zw(u,o,e)}`}function $F(e){try{return W(ce(e.items).items[0].text).join(" ")}catch{return null}}function H8(e){return e=e.map(t=>t+(t==="fill"||t==="stroke"?" color":"")),e.length<2?e[0]:e.slice(0,-1).join(", ")+" and "+ce(e)}function V8(e){return e.length?e[0].toUpperCase()+e.slice(1):e}const kF=e=>(e+"").replace(/&/g,"&").replace(//g,">"),X8=e=>kF(e).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ");function Y0(){let e="",t="",n="";const i=[],r=()=>t=n="",s=u=>{t&&(e+=`${t}>${n}`,r()),i.push(u)},a=(u,l)=>(l!=null&&(t+=` ${u}="${X8(l)}"`),o),o={open(u){s(u),t="<"+u;for(var l=arguments.length,c=new Array(l>1?l-1:0),f=1;f${n}`:"/>"):e+=``,r(),o},attr:a,text:u=>(n+=kF(u),o),toString:()=>e};return o}const DF=e=>OF(Y0(),e)+"";function OF(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let r=0;r{c.dirty=n})),!r.zdirty){if(i.exit){a.nested&&r.items.length?(l=r.items[0],l._svg&&this._update(a,l._svg,l)):i._svg&&(l=i._svg.parentNode,l&&l.removeChild(i._svg)),i._svg=null;continue}i=a.nested?r.items[0]:i,i._update!==n&&(!i._svg||!i._svg.ownerSVGElement?(this._dirtyAll=!1,Kx(i,n)):this._update(a,i._svg,i),i._update=n)}return!this._dirtyAll}mark(t,n,i,r){if(!this.isDirty(n))return n._svg;const s=this._svg,a=n.marktype,o=sn[a],u=n.interactive===!1?"none":null,l=o.tag==="g",c=Jx(n,t,i,"g",s);if(a!=="group"&&r!=null&&!r.includes(a))return ln(c,0),n._svg;c.setAttribute("class",pF(n));const f=SF(n);for(const g in f)Ot(c,g,f[g]);l||Ot(c,"pointer-events",u),Ot(c,"clip-path",n.clip?$0(this,n,n.group):null);let d=null,p=0;const h=g=>{const m=this.isDirty(g),y=Jx(g,c,d,o.tag,s);m&&(this._update(o,y,g),l&&J8(this,y,g,r)),d=y,++p};return o.nested?n.items.length&&h(n.items[0]):Pn(n,h),ln(c,p),c}_update(t,n,i){Li=n,yt=n.__values__,FF(Qo,i),t.attr(Qo,i,this);const r=Z8[t.type];r&&r.call(this,t,n,i),Li&&this.style(Li,i)}style(t,n){if(n!=null){for(const i in Nc){let r=i==="font"?Hu(n):n[i];if(r===yt[i])continue;const s=Nc[i];r==null?t.removeAttribute(s):(w0(r)&&(r=jw(r,this._defs.gradient,_F())),t.setAttribute(s,r+"")),yt[i]=r}for(const i in Mc)rc(t,Mc[i],n[i])}}defs(){const t=this._svg,n=this._defs;let i=n.el,r=0;for(const s in n.gradient)i||(n.el=i=He(t,vo+1,"defs",Ge)),r=Y8(i,n.gradient[s],r);for(const s in n.clipping)i||(n.el=i=He(t,vo+1,"defs",Ge)),r=K8(i,n.clipping[s],r);i&&(r===0?(t.removeChild(i),n.el=null):ln(i,r))}_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}}function Kx(e,t){for(;e&&e.dirty!==t;e=e.mark.group)if(e.dirty=t,e.mark&&e.mark.dirty!==t)e.mark.dirty=t;else return}function Y8(e,t,n){let i,r,s;if(t.gradient==="radial"){let a=He(e,n++,"pattern",Ge);hr(a,{id:Cc+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),a=He(a,0,"rect",Ge),hr(a,{width:1,height:1,fill:`url(${_F()}#${t.id})`}),e=He(e,n++,"radialGradient",Ge),hr(e,{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else e=He(e,n++,"linearGradient",Ge),hr(e,{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(i=0,r=t.stops.length;i{r=e.mark(t,a,r,i),++s}),ln(t,1+s)}function Jx(e,t,n,i,r){let s=e._svg,a;if(!s&&(a=t.ownerDocument,s=dr(a,i,Ge),e._svg=s,e.mark&&(s.__data__=e,s.__values__={fill:"default"},i==="g"))){const o=dr(a,"path",Ge);s.appendChild(o),o.__data__=e;const u=dr(a,"g",Ge);s.appendChild(u),u.__data__=e;const l=dr(a,"path",Ge);s.appendChild(l),l.__data__=e,l.__values__={fill:"default"}}return(s.ownerSVGElement!==r||Q8(s,n))&&t.insertBefore(s,n?n.nextSibling:t.firstChild),s}function Q8(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}let Li=null,yt=null;const Z8={group(e,t,n){const i=Li=t.childNodes[2];yt=i.__values__,e.foreground(Qo,n,this),yt=t.__values__,Li=t.childNodes[1],e.content(Qo,n,this);const r=Li=t.childNodes[0];e.background(Qo,n,this);const s=n.mark.interactive===!1?"none":null;if(s!==yt.events&&(Ot(i,"pointer-events",s),Ot(r,"pointer-events",s),yt.events=s),n.strokeForeground&&n.stroke){const a=n.fill;Ot(i,"display",null),this.style(r,n),Ot(r,"stroke",null),a&&(n.fill=null),yt=i.__values__,this.style(i,n),a&&(n.fill=a),Li=null}else Ot(i,"display","none")},image(e,t,n){n.smooth===!1?(rc(t,"image-rendering","optimizeSpeed"),rc(t,"image-rendering","pixelated")):rc(t,"image-rendering",null)},text(e,t,n){const i=Gu(n);let r,s,a,o;D(i)?(s=i.map(u=>$r(n,u)),r=s.join(` +`),r!==yt.text&&(ln(t,0),a=t.ownerDocument,o=Sr(n),s.forEach((u,l)=>{const c=dr(a,"tspan",Ge);c.__data__=n,c.textContent=u,l&&(c.setAttribute("x",0),c.setAttribute("dy",o)),t.appendChild(c)}),yt.text=r)):(s=$r(n,i),s!==yt.text&&(t.textContent=s,yt.text=s)),Ot(t,"font-family",Hu(n)),Ot(t,"font-size",xi(n)+"px"),Ot(t,"font-style",n.fontStyle),Ot(t,"font-variant",n.fontVariant),Ot(t,"font-weight",n.fontWeight)}};function Qo(e,t,n){t!==yt[e]&&(n?e9(Li,e,t,n):Ot(Li,e,t),yt[e]=t)}function rc(e,t,n){n!==yt[t]&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n+""),yt[t]=n)}function hr(e,t){for(const n in t)Ot(e,n,t[n])}function Ot(e,t,n){n!=null?e.setAttribute(t,n):e.removeAttribute(t)}function e9(e,t,n,i){n!=null?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}function _F(){let e;return typeof window>"u"?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}class TF extends Vu{constructor(t){super(t),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(t){const n=Y0();n.open("svg",se({},du,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const i=this._bgcolor;return i&&i!=="transparent"&&i!=="none"&&n.open("rect",{width:this._width,height:this._height,fill:i}).close(),n.open("g",RF,{transform:"translate("+this._origin+")"}),this.mark(n,t),n.close(),this.defs(n),this._text=n.close()+"",this}mark(t,n){const i=sn[n.marktype],r=i.tag,s=[FF,i.attr];t.open("g",{class:pF(n),"clip-path":n.clip?$0(this,n,n.group):null},SF(n),{"pointer-events":r!=="g"&&n.interactive===!1?"none":null});const a=o=>{const u=this.href(o);if(u&&t.open("a",u),t.open(r,this.attr(n,o,s,r!=="g"?r:null)),r==="text"){const l=Gu(o);if(D(l)){const c={x:0,dy:Sr(o)};for(let f=0;fthis.mark(t,d)),t.close(),l&&f?(c&&(o.fill=null),o.stroke=f,t.open("path",this.attr(n,o,i.foreground,"bgrect")).close(),c&&(o.fill=c)):t.open("path",this.attr(n,o,i.foreground,"bgfore")).close()}t.close(),u&&t.close()};return i.nested?n.items&&n.items.length&&a(n.items[0]):Pn(n,a),t.close()}href(t){const n=t.href;let i;if(n){if(i=this._hrefs&&this._hrefs[n])return i;this.sanitizeURL(n).then(r=>{r["xlink:href"]=r.href,r.href=null,(this._hrefs||(this._hrefs={}))[n]=r})}return null}attr(t,n,i,r){const s={},a=(o,u,l,c)=>{s[c||o]=u};return Array.isArray(i)?i.forEach(o=>o(a,n,this)):i(a,n,this),r&&t9(s,n,t,r,this._defs),s}defs(t){const n=this._defs.gradient,i=this._defs.clipping;if(Object.keys(n).length+Object.keys(i).length!==0){t.open("defs");for(const s in n){const a=n[s],o=a.stops;a.gradient==="radial"?(t.open("pattern",{id:Cc+s,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+s+")"}).close(),t.close(),t.open("radialGradient",{id:s,fx:a.x1,fy:a.y1,fr:a.r1,cx:a.x2,cy:a.y2,r:a.r2})):t.open("linearGradient",{id:s,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2});for(let u=0;u!$n.svgMarkTypes.includes(s));this._svgRenderer.render(t,$n.svgMarkTypes),this._canvasRenderer.render(t,r)}resize(t,n,i,r){return super.resize(t,n,i,r),this._svgRenderer.resize(t,n,i,r),this._canvasRenderer.resize(t,n,i,r),this}background(t){return $n.svgOnTop?this._canvasRenderer.background(t):this._svgRenderer.background(t),this}}class NF extends Xu{constructor(t,n){super(t,n)}initialize(t,n,i){const r=He(He(t,0,"div"),$n.svgOnTop?0:1,"div");return super.initialize(r,n,i)}}const MF="canvas",LF="hybrid",BF="png",PF="svg",IF="none",pr={Canvas:MF,PNG:BF,SVG:PF,Hybrid:LF,None:IF},bs={};bs[MF]=bs[BF]={renderer:Tc,headless:Tc,handler:Xu};bs[PF]={renderer:K0,headless:TF,handler:EF};bs[LF]={renderer:Wp,headless:Wp,handler:NF};bs[IF]={};function If(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(bs[e]=t,this):bs[e]}function zF(e,t,n){const i=[],r=new We().union(t),s=e.marktype;return s?UF(e,r,n,i):s==="group"?jF(e,r,n,i):S("Intersect scene must be mark node or group item.")}function UF(e,t,n,i){if(i9(e,t,n)){const r=e.items,s=e.marktype,a=r.length;let o=0;if(s==="group")for(;o=0;s--)if(n[s]!=i[s])return!1;for(s=n.length-1;s>=0;s--)if(r=n[s],!J0(e[r],t[r],r))return!1;return typeof e==typeof t}function a9(){Yw(),O6()}const Da="top",On="left",Rn="right",kr="bottom",o9="top-left",u9="top-right",l9="bottom-left",c9="bottom-right",Q0="start",Gp="middle",Rt="end",f9="x",d9="y",zf="group",Z0="axis",e1="title",h9="frame",p9="scope",t1="legend",HF="row-header",VF="row-footer",XF="row-title",YF="column-header",KF="column-footer",JF="column-title",g9="padding",m9="symbol",QF="fit",ZF="fit-x",eS="fit-y",y9="pad",n1="none",Fl="all",Hp="each",i1="flush",gr="column",mr="row";function tS(e){F.call(this,null,e)}z(tS,F,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,s=sn[r],a=s.bound;let o=i.bounds,u;if(s.nested)i.items.length&&n.dirty(i.items[0]),o=Sl(i,a),i.items.forEach(l=>{l.bounds.clear().union(o)});else if(r===zf||e.modified())switch(t.visit(t.MOD,l=>n.dirty(l)),o.clear(),i.items.forEach(l=>o.union(Sl(l,a))),i.role){case Z0:case t1:case e1:t.reflow()}else u=t.changed(t.REM),t.visit(t.ADD,l=>{o.union(Sl(l,a))}),t.visit(t.MOD,l=>{u=u||o.alignsWith(l.bounds),n.dirty(l),o.union(Sl(l,a))}),u&&(o.clear(),i.items.forEach(l=>o.union(l.bounds)));return WF(i),t.modifies("bounds")}});function Sl(e,t,n){return t(e.bounds.clear(),e,n)}const Qx=":vega_identifier:";function r1(e){F.call(this,0,e)}r1.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]};z(r1,F,{transform(e,t){const n=b9(t.dataflow),i=e.as;let r=n.value;return t.visit(t.ADD,s=>s[i]=s[i]||++r),n.set(this.value=r),t}});function b9(e){return e._signals[Qx]||(e._signals[Qx]=e.add(0))}function nS(e){F.call(this,null,e)}z(nS,F,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,x9(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);const i=n.marktype===zf?Rf:Of;return t.visit(t.ADD,r=>i.call(r,n)),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});function x9(e){const t=e.groups,n=e.parent;return t&&t.size===1?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}function iS(e){F.call(this,null,e)}const Zx={parity:e=>e.filter((t,n)=>n%2?t.opacity=0:1),greedy:(e,t)=>{let n;return e.filter((i,r)=>!r||!rS(n.bounds,i.bounds,t)?(n=i,1):i.opacity=0)}},rS=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),ev=(e,t)=>{for(var n=1,i=e.length,r=e[0].bounds,s;n{const t=e.bounds;return t.width()>1&&t.height()>1},E9=(e,t,n)=>{var i=e.range(),r=new We;return t===Da||t===kr?r.set(i[0],-1/0,i[1],1/0):r.set(-1/0,i[0],1/0,i[1]),r.expand(n||1),s=>r.encloses(s.bounds)},tv=e=>(e.forEach(t=>t.opacity=1),e),nv=(e,t)=>e.reflow(t.modified()).modifies("opacity");z(iS,F,{transform(e,t){const n=Zx[e.method]||Zx.parity,i=e.separation||0;let r=t.materialize(t.SOURCE).source,s,a;if(!r||!r.length)return;if(!e.method)return e.modified("method")&&(tv(r),t=nv(t,e)),t;if(r=r.filter(v9),!r.length)return;if(e.sort&&(r=r.slice().sort(e.sort)),s=tv(r),t=nv(t,e),s.length>=3&&ev(s,i)){do s=n(s,i);while(s.length>=3&&ev(s,i));s.length<3&&!ce(r).opacity&&(s.length>1&&(ce(s).opacity=0),ce(r).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(a=E9(e.boundScale,e.boundOrient,+e.boundTolerance),r.forEach(u=>{a(u)||(u.opacity=0)}));const o=s[0].mark.bounds.clear();return r.forEach(u=>{u.opacity&&o.union(u.bounds)}),t}});function sS(e){F.call(this,null,e)}z(sS,F,{transform(e,t){const n=t.dataflow;if(t.visit(t.ALL,i=>n.dirty(i)),t.fields&&t.fields.zindex){const i=t.source&&t.source[0];i&&(i.mark.zdirty=!0)}}});const mt=new We;function fa(e,t,n){return e[t]===n?0:(e[t]=n,1)}function A9(e){var t=e.items[0].orient;return t===On||t===Rn}function C9(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}function w9(e,t,n,i){var r=t.items[0],s=r.datum,a=r.translate!=null?r.translate:.5,o=r.orient,u=C9(s),l=r.range,c=r.offset,f=r.position,d=r.minExtent,p=r.maxExtent,h=s.title&&r.items[u[2]].items[0],g=r.titlePadding,m=r.bounds,y=h&&z0(h),b=0,v=0,A,E;switch(mt.clear().union(m),m.clear(),(A=u[0])>-1&&m.union(r.items[A].bounds),(A=u[1])>-1&&m.union(r.items[A].bounds),o){case Da:b=f||0,v=-c,E=Math.max(d,Math.min(p,-m.y1)),m.add(0,-E).add(l,0),h&&$l(e,h,E,g,y,0,-1,m);break;case On:b=-c,v=f||0,E=Math.max(d,Math.min(p,-m.x1)),m.add(-E,0).add(0,l),h&&$l(e,h,E,g,y,1,-1,m);break;case Rn:b=n+c,v=f||0,E=Math.max(d,Math.min(p,m.x2)),m.add(0,0).add(E,l),h&&$l(e,h,E,g,y,1,1,m);break;case kr:b=f||0,v=i+c,E=Math.max(d,Math.min(p,m.y2)),m.add(0,0).add(l,E),h&&$l(e,h,E,g,0,0,1,m);break;default:b=r.x,v=r.y}return Vi(m.translate(b,v),r),fa(r,"x",b+a)|fa(r,"y",v+a)&&(r.bounds=mt,e.dirty(r),r.bounds=m,e.dirty(r)),r.mark.bounds.clear().union(m)}function $l(e,t,n,i,r,s,a,o){const u=t.bounds;if(t.auto){const l=a*(n+r+i);let c=0,f=0;e.dirty(t),s?c=(t.x||0)-(t.x=l):f=(t.y||0)-(t.y=l),t.mark.bounds.clear().union(u.translate(-c,-f)),e.dirty(t)}o.union(u)}const iv=(e,t)=>Math.floor(Math.min(e,t)),rv=(e,t)=>Math.ceil(Math.max(e,t));function F9(e){var t=e.items,n=t.length,i=0,r,s;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;i1)for(x=0;x0&&(v[x]+=N/2);if(o&&Te(n.center,mr)&&c!==1)for(x=0;x0&&(A[x]+=O/2);for(x=0;xr&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),g+=s,b=0,A=t.length;b=0&&(x=n[v])==null;v-=d);o?(w=p==null?x.x:Math.round(x.bounds.x1+p*x.bounds.width()),R=g):(w=g,R=p==null?x.y:Math.round(x.bounds.y1+p*x.bounds.height())),E.union(C.bounds.translate(w-(C.x||0),R-(C.y||0))),C.x=w,C.y=R,e.dirty(C),m=a(m,E[l])}return m}function av(e,t,n,i,r,s){if(t){e.dirty(t);var a=n,o=n;i?a=Math.round(r.x1+s*r.width()):o=Math.round(r.y1+s*r.height()),t.bounds.translate(a-(t.x||0),o-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=a,t.y=o,e.dirty(t)}}function R9(e,t){const n=e[t]||{};return(i,r)=>n[i]!=null?n[i]:e[i]!=null?e[i]:r}function _9(e,t){let n=-1/0;return e.forEach(i=>{i.offset!=null&&(n=Math.max(n,i.offset))}),n>-1/0?n:t}function T9(e,t,n,i,r,s,a){const o=R9(n,t),u=_9(e,o("offset",0)),l=o("anchor",Q0),c=l===Rt?1:l===Gp?.5:0,f={align:Hp,bounds:o("bounds",i1),columns:o("direction")==="vertical"?1:e.length,padding:o("margin",8),center:o("center"),nodirty:!0};switch(t){case On:f.anchor={x:Math.floor(i.x1)-u,column:Rt,y:c*(a||i.height()+2*i.y1),row:l};break;case Rn:f.anchor={x:Math.ceil(i.x2)+u,y:c*(a||i.height()+2*i.y1),row:l};break;case Da:f.anchor={y:Math.floor(r.y1)-u,row:Rt,x:c*(s||r.width()+2*r.x1),column:l};break;case kr:f.anchor={y:Math.ceil(r.y2)+u,x:c*(s||r.width()+2*r.x1),column:l};break;case o9:f.anchor={x:u,y:u};break;case u9:f.anchor={x:s-u,y:u,column:Rt};break;case l9:f.anchor={x:u,y:a-u,row:Rt};break;case c9:f.anchor={x:s-u,y:a-u,column:Rt,row:Rt};break}return f}function N9(e,t){var n=t.items[0],i=n.datum,r=n.orient,s=n.bounds,a=n.x,o=n.y,u,l;return n._bounds?n._bounds.clear().union(s):n._bounds=s.clone(),s.clear(),L9(e,n,n.items[0].items[0]),s=M9(n,s),u=2*n.padding,l=2*n.padding,s.empty()||(u=Math.ceil(s.width()+u),l=Math.ceil(s.height()+l)),i.type===m9&&B9(n.items[0].items[0].items[0].items),r!==n1&&(n.x=a=0,n.y=o=0),n.width=u,n.height=l,Vi(s.set(a,o,a+u,o+l),n),n.mark.bounds.clear().union(s),n}function M9(e,t){return e.items.forEach(n=>t.union(n.bounds)),t.x1=e.padding,t.y1=e.padding,t}function L9(e,t,n){var i=t.padding,r=i-n.x,s=i-n.y;if(!t.datum.title)(r||s)&&Eo(e,n,r,s);else{var a=t.items[1].items[0],o=a.anchor,u=t.titlePadding||0,l=i-a.x,c=i-a.y;switch(a.orient){case On:r+=Math.ceil(a.bounds.width())+u;break;case Rn:case kr:break;default:s+=a.bounds.height()+u}switch((r||s)&&Eo(e,n,r,s),a.orient){case On:c+=ea(t,n,a,o,1,1);break;case Rn:l+=ea(t,n,a,Rt,0,0)+u,c+=ea(t,n,a,o,1,1);break;case kr:l+=ea(t,n,a,o,0,0),c+=ea(t,n,a,Rt,-1,0,1)+u;break;default:l+=ea(t,n,a,o,0,0)}(l||c)&&Eo(e,a,l,c),(l=Math.round(a.bounds.x1-i))<0&&(Eo(e,n,-l,0),Eo(e,a,-l,0))}}function ea(e,t,n,i,r,s,a){const o=e.datum.type!=="symbol",u=n.datum.vgrad,l=o&&(s||!u)&&!a?t.items[0]:t,c=l.bounds[r?"y2":"x2"]-e.padding,f=u&&s?c:0,d=u&&s?0:c,p=r<=0?0:z0(n);return Math.round(i===Q0?f:i===Rt?d-p:.5*(c-p))}function Eo(e,t,n,i){t.x+=n,t.y+=i,t.bounds.translate(n,i),t.mark.bounds.translate(n,i),e.dirty(t)}function B9(e){const t=e.reduce((n,i)=>(n[i.column]=Math.max(i.bounds.x2-i.x,n[i.column]||0),n),{});e.forEach(n=>{n.width=t[n.column],n.height=n.bounds.y2-n.y})}function P9(e,t,n,i,r){var s=t.items[0],a=s.frame,o=s.orient,u=s.anchor,l=s.offset,c=s.padding,f=s.items[0].items[0],d=s.items[1]&&s.items[1].items[0],p=o===On||o===Rn?i:n,h=0,g=0,m=0,y=0,b=0,v;if(a!==zf?o===On?(h=r.y2,p=r.y1):o===Rn?(h=r.y1,p=r.y2):(h=r.x1,p=r.x2):o===On&&(h=i,p=0),v=u===Q0?h:u===Rt?p:(h+p)/2,d&&d.text){switch(o){case Da:case kr:b=f.bounds.height()+c;break;case On:y=f.bounds.width()+c;break;case Rn:y=-f.bounds.width()-c;break}mt.clear().union(d.bounds),mt.translate(y-(d.x||0),b-(d.y||0)),fa(d,"x",y)|fa(d,"y",b)&&(e.dirty(d),d.bounds.clear().union(mt),d.mark.bounds.clear().union(mt),e.dirty(d)),mt.clear().union(d.bounds)}else mt.clear();switch(mt.union(f.bounds),o){case Da:g=v,m=r.y1-mt.height()-l;break;case On:g=r.x1-mt.width()-l,m=v;break;case Rn:g=r.x2+mt.width()+l,m=v;break;case kr:g=v,m=r.y2+l;break;default:g=s.x,m=s.y}return fa(s,"x",g)|fa(s,"y",m)&&(mt.translate(g,m),e.dirty(s),s.bounds.clear().union(mt),t.bounds.clear().union(mt),e.dirty(s)),s.bounds}function oS(e){F.call(this,null,e)}z(oS,F,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach(i=>{e.layout&&k9(n,i,e.layout),z9(n,i,e)}),I9(e.mark.group)?t.reflow():t}});function I9(e){return e&&e.mark.role!=="legend-entry"}function z9(e,t,n){var i=t.items,r=Math.max(0,t.width||0),s=Math.max(0,t.height||0),a=new We().set(0,0,r,s),o=a.clone(),u=a.clone(),l=[],c,f,d,p,h,g;for(h=0,g=i.length;h{d=y.orient||Rn,d!==n1&&(m[d]||(m[d]=[])).push(y)});for(const y in m){const b=m[y];aS(e,b,T9(b,y,n.legends,o,u,r,s))}l.forEach(y=>{const b=y.bounds;if(b.equals(y._bounds)||(y.bounds=y._bounds,e.dirty(y),y.bounds=b,e.dirty(y)),n.autosize&&(n.autosize.type===QF||n.autosize.type===ZF||n.autosize.type===eS))switch(y.orient){case On:case Rn:a.add(b.x1,0).add(b.x2,0);break;case Da:case kr:a.add(0,b.y1).add(0,b.y2)}else a.union(b)})}a.union(o).union(u),c&&a.union(P9(e,c,r,s,a)),t.clip&&a.set(0,0,t.width||0,t.height||0),U9(e,t,a,n)}function U9(e,t,n,i){const r=i.autosize||{},s=r.type;if(e._autosize<1||!s)return;let a=e._width,o=e._height,u=Math.max(0,t.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,t.height||0),f=Math.max(0,Math.ceil(-n.y1));const d=Math.max(0,Math.ceil(n.x2-u)),p=Math.max(0,Math.ceil(n.y2-c));if(r.contains===g9){const h=e.padding();a-=h.left+h.right,o-=h.top+h.bottom}s===n1?(l=0,f=0,u=a,c=o):s===QF?(u=Math.max(0,a-l-d),c=Math.max(0,o-f-p)):s===ZF?(u=Math.max(0,a-l-d),o=c+f+p):s===eS?(a=u+l+d,c=Math.max(0,o-f-p)):s===y9&&(a=u+l+d,o=c+f+p),e._resizeView(a,o,u,c,[l,f],r.resize)}const j9=Object.freeze(Object.defineProperty({__proto__:null,bound:tS,identifier:r1,mark:nS,overlap:iS,render:sS,viewlayout:oS},Symbol.toStringTag,{value:"Module"}));function uS(e){F.call(this,null,e)}z(uS,F,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,s=e.scale,a=e.count==null?e.values?e.values.length:10:e.count,o=A0(s,a,e.minstep),u=e.format||Mw(n,s,o,e.formatSpecifier,e.formatType,!!e.values),l=e.values?Nw(s,e.values,o):C0(s,o);return r&&(i.rem=r),r=l.map((c,f)=>be({index:f/(l.length-1||1),value:c,label:u(c)})),e.extra&&r.length&&r.push(be({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}});function lS(e){F.call(this,null,e)}function q9(){return be({})}function W9(e){const t=Ka().test(n=>n.exit);return t.lookup=n=>t.get(e(n)),t}z(lS,F,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||q9,s=e.key||ee,a=this.value;return D(i.encode)&&(i.encode=null),a&&(e.modified("key")||t.modified(s))&&S("DataJoin does not support modified key function or fields."),a||(t=t.addAll(),this.value=a=W9(s)),t.visit(t.ADD,o=>{const u=s(o);let l=a.get(u);l?l.exit?(a.empty--,i.add.push(l)):i.mod.push(l):(l=r(o),a.set(u,l),i.add.push(l)),l.datum=o,l.exit=!1}),t.visit(t.MOD,o=>{const u=s(o),l=a.get(u);l&&(l.datum=o,i.mod.push(l))}),t.visit(t.REM,o=>{const u=s(o),l=a.get(u);o===l.datum&&!l.exit&&(i.rem.push(l),l.exit=!0,++a.empty)}),t.changed(t.ADD_MOD)&&i.modifies("datum"),(t.clean()||e.clean&&a.empty>n.cleanThreshold)&&n.runAfter(a.clean),i}});function cS(e){F.call(this,null,e)}z(cS,F,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,s=t.encode;if(D(s))if(n.changed()||s.every(f=>r[f]))s=s[0],n.encode=null;else return t.StopPropagation;var a=s==="enter",o=r.update||ir,u=r.enter||ir,l=r.exit||ir,c=(s&&!a?r[s]:o)||ir;if(t.changed(t.ADD)&&(t.visit(t.ADD,f=>{u(f,e),o(f,e)}),n.modifies(u.output),n.modifies(o.output),c!==ir&&c!==o&&(t.visit(t.ADD,f=>{c(f,e)}),n.modifies(c.output))),t.changed(t.REM)&&l!==ir&&(t.visit(t.REM,f=>{l(f,e)}),n.modifies(l.output)),a||c!==ir){const f=t.MOD|(e.modified()?t.REFLOW:0);a?(t.visit(f,d=>{const p=u(d,e)||i;(c(d,e)||p)&&n.mod.push(d)}),n.mod.length&&n.modifies(u.output)):t.visit(f,d=>{(c(d,e)||i)&&n.mod.push(d)}),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation}});function fS(e){F.call(this,[],e)}z(fS,F,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,s=e.type||Kl,a=e.scale,o=+e.limit,u=A0(a,e.count==null?5:e.count,e.minstep),l=!!e.values||s===Kl,c=e.format||Iw(n,a,u,s,e.formatSpecifier,e.formatType,l),f=e.values||Pw(a,u),d,p,h,g,m;return r&&(i.rem=r),s===Kl?(o&&f.length>o?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),r=f.slice(0,o-1),m=!0):r=f,ae(h=e.size)?(!e.values&&a(r[0])===0&&(r=r.slice(1)),g=r.reduce((y,b)=>Math.max(y,h(b,e)),0)):h=kt(g=h||8),r=r.map((y,b)=>be({index:b,label:c(y,b,r),value:y,offset:g,size:h(y,e)})),m&&(m=f[r.length],r.push(be({index:r.length,label:`…${f.length-r.length} entries`,value:m,offset:g,size:h(m,e)})))):s===y6?(d=a.domain(),p=Rw(a,d[0],ce(d)),f.length<3&&!e.values&&d[0]!==ce(d)&&(f=[d[0],ce(d)]),r=f.map((y,b)=>be({index:b,label:c(y,b,f),value:y,perc:p(y)}))):(h=f.length-1,p=k6(a),r=f.map((y,b)=>be({index:b,label:c(y,b,f),value:y,perc:b?p(y):0,perc2:b===h?1:p(f[b+1])}))),i.source=r,i.add=r,this.value=r,i}});const G9=e=>e.source.x,H9=e=>e.source.y,V9=e=>e.target.x,X9=e=>e.target.y;function s1(e){F.call(this,{},e)}s1.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]};z(s1,F,{transform(e,t){var n=e.sourceX||G9,i=e.sourceY||H9,r=e.targetX||V9,s=e.targetY||X9,a=e.as||"path",o=e.orient||"vertical",u=e.shape||"line",l=ov.get(u+"-"+o)||ov.get(u);return l||S("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,c=>{c[a]=l(n(c),i(c),r(c),s(c))}),t.reflow(e.modified()).modifies(a)}});const dS=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,Y9=(e,t,n,i)=>dS(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),hS=(e,t,n,i)=>{var r=n-e,s=i-t,a=Math.hypot(r,s)/2,o=180*Math.atan2(s,r)/Math.PI;return"M"+e+","+t+"A"+a+","+a+" "+o+" 0 1 "+n+","+i},K9=(e,t,n,i)=>hS(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),pS=(e,t,n,i)=>{const r=n-e,s=i-t,a=.2*(r+s),o=.2*(s-r);return"M"+e+","+t+"C"+(e+a)+","+(t+o)+" "+(n+o)+","+(i-a)+" "+n+","+i},J9=(e,t,n,i)=>pS(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),Q9=(e,t,n,i)=>"M"+e+","+t+"V"+i+"H"+n,Z9=(e,t,n,i)=>"M"+e+","+t+"H"+n+"V"+i,eL=(e,t,n,i)=>{const r=Math.cos(e),s=Math.sin(e),a=Math.cos(n),o=Math.sin(n),u=Math.abs(n-e)>Math.PI?n<=e:n>e;return"M"+t*r+","+t*s+"A"+t+","+t+" 0 0,"+(u?1:0)+" "+t*a+","+t*o+"L"+i*a+","+i*o},tL=(e,t,n,i)=>{const r=(e+n)/2;return"M"+e+","+t+"C"+r+","+t+" "+r+","+i+" "+n+","+i},nL=(e,t,n,i)=>{const r=(t+i)/2;return"M"+e+","+t+"C"+e+","+r+" "+n+","+r+" "+n+","+i},iL=(e,t,n,i)=>{const r=Math.cos(e),s=Math.sin(e),a=Math.cos(n),o=Math.sin(n),u=(t+i)/2;return"M"+t*r+","+t*s+"C"+u*r+","+u*s+" "+u*a+","+u*o+" "+i*a+","+i*o},ov=Ka({line:dS,"line-radial":Y9,arc:hS,"arc-radial":K9,curve:pS,"curve-radial":J9,"orthogonal-horizontal":Q9,"orthogonal-vertical":Z9,"orthogonal-radial":eL,"diagonal-horizontal":tL,"diagonal-vertical":nL,"diagonal-radial":iL});function a1(e){F.call(this,null,e)}a1.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]};z(a1,F,{transform(e,t){var n=e.as||["startAngle","endAngle"],i=n[0],r=n[1],s=e.field||Ha,a=e.startAngle||0,o=e.endAngle!=null?e.endAngle:2*Math.PI,u=t.source,l=u.map(s),c=l.length,f=a,d=(o-a)/y2(l),p=Ms(c),h,g,m;for(e.sort&&p.sort((y,b)=>l[y]-l[b]),h=0;h-1)return i;var r=t.domain,s=e.type,a=t.zero||t.zero===void 0&&sL(e),o,u;if(!r)return 0;if((a||t.domainMin!=null||t.domainMax!=null||t.domainMid!=null)&&(o=(r=r.slice()).length-1||1,a&&(r[0]>0&&(r[0]=0),r[o]<0&&(r[o]=0)),t.domainMin!=null&&(r[0]=t.domainMin),t.domainMax!=null&&(r[o]=t.domainMax),t.domainMid!=null)){u=t.domainMid;const l=u>r[o]?o+1:ur+(s<0?-1:s>0?1:0),0));i!==t.length&&n.warn("Log scale domain includes zero: "+P(t))}return t}function dL(e,t,n){let i=t.bins;if(i&&!D(i)){const r=e.domain(),s=r[0],a=ce(r),o=i.step;let u=i.start==null?s:i.start,l=i.stop==null?a:i.stop;o||S("Scale bins parameter missing step property."),ua&&(l=o*Math.floor(a/o)),i=Ms(u,l+o/2,o)}return i?e.bins=i:e.bins&&delete e.bins,e.type===m0&&(i?!t.domain&&!t.domainRaw&&(e.domain(i),n=i.length):e.bins=e.domain()),n}function hL(e,t,n){var i=e.type,r=t.round||!1,s=t.range;if(t.rangeStep!=null)s=pL(i,t,n);else if(t.scheme&&(s=gL(i,t,n),ae(s))){if(e.interpolator)return e.interpolator(s);S(`Scale type ${i} does not support interpolating color schemes.`)}if(s&&$w(i))return e.interpolator(kf(Vp(s,t.reverse),t.interpolate,t.interpolateGamma));s&&t.interpolate&&e.interpolate?e.interpolate(v0(t.interpolate,t.interpolateGamma)):ae(e.round)?e.round(r):ae(e.rangeRound)&&e.interpolate(r?Y5:K5),s&&e.range(Vp(s,t.reverse))}function pL(e,t,n){e!==vw&&e!==_p&&S("Only band and point scales support rangeStep.");var i=(t.paddingOuter!=null?t.paddingOuter:t.padding)||0,r=e===_p?1:(t.paddingInner!=null?t.paddingInner:t.padding)||0;return[0,t.rangeStep*p0(n,r,i)]}function gL(e,t,n){var i=t.schemeExtent,r,s;return D(t.scheme)?s=kf(t.scheme,t.interpolate,t.interpolateGamma):(r=t.scheme.toLowerCase(),s=E0(r),s||S(`Unrecognized scheme name: ${t.scheme}`)),n=e===$f?n+1:e===m0?n-1:e===wa||e===Sf?+t.schemeCount||rL:n,$w(e)?uv(s,i,t.reverse):ae(s)?Ow(uv(s,i),n):e===g0?s:s.slice(0,n)}function uv(e,t,n){return ae(e)&&(t||n)?Dw(e,Vp(t||[0,1],n)):e}function Vp(e,t){return t?e.slice().reverse():e}function bS(e){F.call(this,null,e)}z(bS,F,{transform(e,t){const n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(Ls(e.sort)),this.modified(n),t}});const lv="zero",xS="center",vS="normalize",ES=["y0","y1"];function o1(e){F.call(this,null,e)}o1.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:lv,values:[lv,xS,vS]},{name:"as",type:"string",array:!0,length:2,default:ES}]};z(o1,F,{transform(e,t){var n=e.as||ES,i=n[0],r=n[1],s=Ls(e.sort),a=e.field||Ha,o=e.offset===xS?mL:e.offset===vS?yL:bL,u,l,c,f;for(u=xL(t.source,e.groupby,s,a),l=0,c=u.length,f=u.max;lg(c),a,o,u,l,c,f,d,p,h;if(t==null)r.push(e.slice());else for(a={},o=0,u=e.length;oh&&(h=p),n&&d.sort(n)}return r.max=h,r}const vL=Object.freeze(Object.defineProperty({__proto__:null,axisticks:uS,datajoin:lS,encode:cS,legendentries:fS,linkpath:s1,pie:a1,scale:mS,sortitems:bS,stack:o1},Symbol.toStringTag,{value:"Module"})),EL=b2(),Xp=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function AL(e,t){return function n(){const i=t();return i.type=e,i.path=b2().projection(i),i.copy=i.copy||function(){const r=n();return Xp.forEach(s=>{i[s]&&r[s](i[s]())}),r.path.pointRadius(i.path.pointRadius()),r},ww(i)}}function u1(e,t){if(!e||typeof e!="string")throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(Lc[e]=AL(e,t),this):Lc[e]||null}function AS(e){return e&&e.path||EL}const Lc={albers:s5,albersusa:r5,azimuthalequalarea:i5,azimuthalequidistant:n5,conicconformal:t5,conicequalarea:e5,conicequidistant:ZR,equalEarth:QR,equirectangular:JR,gnomonic:KR,identity:YR,mercator:XR,mollweide:VR,naturalEarth1:HR,orthographic:GR,stereographic:WR,transversemercator:qR};for(const e in Lc)u1(e,Lc[e]);function CL(){}const Oi=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function CS(){var e=1,t=1,n=o;function i(u,l){return l.map(c=>r(u,c))}function r(u,l){var c=[],f=[];return s(u,l,d=>{n(d,u,l),wL(d)>0?c.push([d]):f.push(d)}),f.forEach(d=>{for(var p=0,h=c.length,g;p=l,Oi[m<<1].forEach(v);++p=l,Oi[g|m<<1].forEach(v);for(Oi[m<<0].forEach(v);++h=l,y=u[h*e]>=l,Oi[m<<1|y<<2].forEach(v);++p=l,b=y,y=u[h*e+p+1]>=l,Oi[g|m<<1|y<<2|b<<3].forEach(v);Oi[m|y<<3].forEach(v)}for(p=-1,y=u[h*e]>=l,Oi[y<<2].forEach(v);++p=l,Oi[y<<2|b<<3].forEach(v);Oi[y<<3].forEach(v);function v(A){var E=[A[0][0]+p,A[0][1]+h],C=[A[1][0]+p,A[1][1]+h],x=a(E),w=a(C),R,L;(R=d[x])?(L=f[w])?(delete d[R.end],delete f[L.start],R===L?(R.ring.push(C),c(R.ring)):f[R.start]=d[L.end]={start:R.start,end:L.end,ring:R.ring.concat(L.ring)}):(delete d[R.end],R.ring.push(C),d[R.end=w]=R):(R=f[w])?(L=d[x])?(delete f[R.start],delete d[L.end],R===L?(R.ring.push(C),c(R.ring)):f[L.start]=d[R.end]={start:L.start,end:R.end,ring:L.ring.concat(R.ring)}):(delete f[R.start],R.ring.unshift(E),f[R.start=x]=R):f[x]=d[w]={start:x,end:w,ring:[E,C]}}}function a(u){return u[0]*2+u[1]*(e+1)*4}function o(u,l,c){u.forEach(f=>{var d=f[0],p=f[1],h=d|0,g=p|0,m,y=l[g*e+h];d>0&&d0&&p=0&&c>=0||S("invalid size"),e=l,t=c,i},i.smooth=function(u){return arguments.length?(n=u?o:CL,i):n===o},i}function wL(e){for(var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++ti!=p>i&&n<(d-l)*(i-c)/(p-c)+l&&(r=-r)}return r}function $L(e,t,n){var i;return kL(e,t,n)&&DL(e[i=+(e[0]===t[0])],n[i],t[i])}function kL(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function DL(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function wS(e,t,n){return function(i){var r=di(i),s=n?Math.min(r[0],0):r[0],a=r[1],o=a-s,u=t?au(s,a,e):o/(e+1);return Ms(s+u,a,u)}}function l1(e){F.call(this,null,e)}l1.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]};z(l1,F,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,r=e.field||$t,s=CS().smooth(e.smooth!==!1),a=e.thresholds||OL(i,r,e),o=e.as===null?null:e.as||"contour",u=[];return i.forEach(l=>{const c=r(l),f=s.size([c.width,c.height])(c.values,D(a)?a:a(c.values));RL(f,c,l,e),f.forEach(d=>{u.push(mf(l,be(o!=null?{[o]:d}:d)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}});function OL(e,t,n){const i=wS(n.levels||10,n.nice,n.zero!==!1);return n.resolve!=="shared"?i:i(e.map(r=>Yo(t(r).values)))}function RL(e,t,n,i){let r=i.scale||t.scale,s=i.translate||t.translate;if(ae(r)&&(r=r(n,i)),ae(s)&&(s=s(n,i)),(r===1||r==null)&&!s)return;const a=(ge(r)?r:r[0])||1,o=(ge(r)?r:r[1])||1,u=s&&s[0]||0,l=s&&s[1]||0;e.forEach(FS(t,a,o,u,l))}function FS(e,t,n,i,r){const s=e.x1||0,a=e.y1||0,o=t*n<0;function u(f){f.forEach(l)}function l(f){o&&f.reverse(),f.forEach(c)}function c(f){f[0]=(f[0]-s)*t+i,f[1]=(f[1]-a)*n+r}return function(f){return f.coordinates.forEach(u),f}}function cv(e,t,n){const i=e>=0?e:km(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function gh(e){return ae(e)?e:kt(+e)}function SS(){var e=u=>u[0],t=u=>u[1],n=Ha,i=[-1,-1],r=960,s=500,a=2;function o(u,l){const c=cv(i[0],u,e)>>a,f=cv(i[1],u,t)>>a,d=c?c+2:0,p=f?f+2:0,h=2*d+(r>>a),g=2*p+(s>>a),m=new Float32Array(h*g),y=new Float32Array(h*g);let b=m;u.forEach(A=>{const E=d+(+e(A)>>a),C=p+(+t(A)>>a);E>=0&&E=0&&C0&&f>0?(ta(h,g,m,y,c),na(h,g,y,m,f),ta(h,g,m,y,c),na(h,g,y,m,f),ta(h,g,m,y,c),na(h,g,y,m,f)):c>0?(ta(h,g,m,y,c),ta(h,g,y,m,c),ta(h,g,m,y,c),b=y):f>0&&(na(h,g,m,y,f),na(h,g,y,m,f),na(h,g,m,y,f),b=y);const v=l?Math.pow(2,-2*a):1/y2(b);for(let A=0,E=h*g;A>a),y2:p+(s>>a)}}return o.x=function(u){return arguments.length?(e=gh(u),o):e},o.y=function(u){return arguments.length?(t=gh(u),o):t},o.weight=function(u){return arguments.length?(n=gh(u),o):n},o.size=function(u){if(!arguments.length)return[r,s];var l=+u[0],c=+u[1];return l>=0&&c>=0||S("invalid size"),r=l,s=c,o},o.cellSize=function(u){return arguments.length?((u=+u)>=1||S("invalid cell size"),a=Math.floor(Math.log(u)/Math.LN2),o):1<=r&&(o>=s&&(u-=n[o-s+a*e]),i[o-r+a*e]=u/Math.min(o+1,e-1+s-o,s))}function na(e,t,n,i,r){const s=(r<<1)+1;for(let a=0;a=r&&(o>=s&&(u-=n[a+(o-s)*e]),i[a+(o-r)*e]=u/Math.min(o+1,t-1+s-o,s))}function c1(e){F.call(this,null,e)}c1.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const _L=["x","y","weight","size","cellSize","bandwidth"];function $S(e,t){return _L.forEach(n=>t[n]!=null?e[n](t[n]):0),e}z(c1,F,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,r=TL(i,e.groupby),s=(e.groupby||[]).map(ze),a=$S(SS(),e),o=e.as||"grid",u=[];function l(c,f){for(let d=0;dbe(l({[o]:a(c,e.counts)},c.dims))),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}});function TL(e,t){var n=[],i=c=>c(o),r,s,a,o,u,l;if(t==null)n.push(e);else for(r={},s=0,a=e.length;sn.push(o(c))),s&&a&&(t.visit(u,c=>{var f=s(c),d=a(c);f!=null&&d!=null&&(f=+f)===f&&(d=+d)===d&&i.push([f,d])}),n=n.concat({type:Yp,geometry:{type:NL,coordinates:i}})),this.value={type:d1,features:n}}});function p1(e){F.call(this,null,e)}p1.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]};z(p1,F,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||$t,s=e.as||"path",a=n.SOURCE;!i||e.modified()?(this.value=i=AS(e.projection),n.materialize().reflow()):a=r===$t||t.modified(r.fields)?n.ADD_MOD:n.ADD;const o=ML(i,e.pointRadius);return n.visit(a,u=>u[s]=i(r(u))),i.pointRadius(o),n.modifies(s)}});function ML(e,t){const n=e.pointRadius();return e.context(null),t!=null&&e.pointRadius(t),n}function g1(e){F.call(this,null,e)}g1.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]};z(g1,F,{transform(e,t){var n=e.projection,i=e.fields[0],r=e.fields[1],s=e.as||["x","y"],a=s[0],o=s[1],u;function l(c){const f=n([i(c),r(c)]);f?(c[a]=f[0],c[o]=f[1]):(c[a]=void 0,c[o]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(u=t.modified(i.fields)||t.modified(r.fields),t.visit(u?t.ADD_MOD:t.ADD,l)),t.modifies(s)}});function m1(e){F.call(this,null,e)}m1.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]};z(m1,F,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.as||"shape",s=n.ADD;return(!i||e.modified())&&(this.value=i=LL(AS(e.projection),e.field||pn("datum"),e.pointRadius),n.materialize().reflow(),s=n.SOURCE),n.visit(s,a=>a[r]=i),n.modifies(r)}});function LL(e,t,n){const i=n==null?r=>e(t(r)):r=>{var s=e.pointRadius(),a=e.pointRadius(n)(t(r));return e.pointRadius(s),a};return i.context=r=>(e.context(r),i),i}function y1(e){F.call(this,[],e),this.generator=a5()}y1.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]};z(y1,F,{transform(e,t){var n=this.value,i=this.generator,r;if(!n.length||e.modified())for(const s in e)ae(i[s])&&i[s](e[s]);return r=i(),n.length?t.mod.push(kC(n[0],r)):t.add.push(be(r)),n[0]=r,t}});function b1(e){F.call(this,null,e)}b1.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]};z(b1,F,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,i=e.resolve==="shared",r=e.field||$t,s=PL(e.opacity,e),a=BL(e.color,e),o=e.as||"image",u={$x:0,$y:0,$value:0,$max:i?Yo(n.map(l=>Yo(r(l).values))):0};return n.forEach(l=>{const c=r(l),f=se({},l,u);i||(f.$max=Yo(c.values||[])),l[o]=IL(c,f,a.dep?a:kt(a(f)),s.dep?s:kt(s(f)))}),t.reflow(!0).modifies(o)}});function BL(e,t){let n;return ae(e)?(n=i=>yc(e(i,t)),n.dep=kS(e)):n=kt(yc(e||"#888")),n}function PL(e,t){let n;return ae(e)?(n=i=>e(i,t),n.dep=kS(e)):e?n=kt(e):(n=i=>i.$value/i.$max||0,n.dep=!0),n}function kS(e){if(!ae(e))return!1;const t=Ln(Et(e));return t.$x||t.$y||t.$value||t.$max}function IL(e,t,n,i){const r=e.width,s=e.height,a=e.x1||0,o=e.y1||0,u=e.x2||r,l=e.y2||s,c=e.values,f=c?m=>c[m]:cr,d=Er(u-a,l-o),p=d.getContext("2d"),h=p.getImageData(0,0,u-a,l-o),g=h.data;for(let m=o,y=0;m{e[i]!=null&&fv(n,i,e[i])})):Xp.forEach(i=>{e.modified(i)&&fv(n,i,e[i])}),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&zL(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function zL(e,t){const n=jL(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}function UL(e){const t=u1((e||"mercator").toLowerCase());return t||S("Unrecognized projection type: "+e),t()}function fv(e,t,n){ae(e[t])&&e[t](n)}function jL(e){return e=W(e),e.length===1?e[0]:{type:d1,features:e.reduce((t,n)=>t.concat(qL(n)),[])}}function qL(e){return e.type===d1?e.features:W(e).filter(t=>t!=null).map(t=>t.type===Yp?t:{type:Yp,geometry:t})}const WL=Object.freeze(Object.defineProperty({__proto__:null,contour:f1,geojson:h1,geopath:p1,geopoint:g1,geoshape:m1,graticule:y1,heatmap:b1,isocontour:l1,kde2d:c1,projection:DS},Symbol.toStringTag,{value:"Module"})),dv={center:h5,collide:d5,nbody:f5,link:c5,x:l5,y:u5},jo="forces",Kp=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],GL=["static","iterations"],OS=["x","y","vx","vy"];function x1(e){F.call(this,null,e)}x1.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:OS}]};z(x1,F,{transform(e,t){var n=this.value,i=t.changed(t.ADD_REM),r=e.modified(Kp),s=e.iterations||300;if(n?(i&&(t.modifies("index"),n.nodes(t.source)),(r||t.changed(t.MOD))&&RS(n,e,0,t)):(this.value=n=VL(t.source,e),n.on("tick",HL(t.dataflow,this)),e.static||(i=!0,n.tick()),t.modifies("index")),r||i||e.modified(GL)||t.changed()&&e.restart){if(n.alpha(Math.max(n.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(n.alphaMin(),1/s)),e.static)for(n.stop();--s>=0;)n.tick();else if(n.stopped()&&n.restart(),!i)return t.StopPropagation}return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let o=this._argops,u=0,l=o.length,c;ue.touch(t).run()}function VL(e,t){const n=o5(e),i=n.stop,r=n.restart;let s=!1;return n.stopped=()=>s,n.restart=()=>(s=!1,r()),n.stop=()=>(s=!0,i()),RS(n,t,!0).on("end",()=>s=!0)}function RS(e,t,n,i){var r=W(t.forces),s,a,o,u;for(s=0,a=Kp.length;st(i,n):t)}const JL=Object.freeze(Object.defineProperty({__proto__:null,force:x1},Symbol.toStringTag,{value:"Module"}));function Jp(e,t,n){const i={};return e.each(r=>{const s=r.data;n(s)&&(i[t(s)]=r)}),e.lookup=i,e}function v1(e){F.call(this,null,e)}v1.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const QL=e=>e.values;z(v1,F,{transform(e,t){t.source||S("Nest transform requires an upstream data source.");var n=e.generate,i=e.modified(),r=t.clone(),s=this.value;return(!s||i||t.changed())&&(s&&s.each(a=>{a.children&&gf(a.data)&&r.rem.push(a.data)}),this.value=s=w_({values:W(e.keys).reduce((a,o)=>(a.key(o),a),ZL()).entries(r.source)},QL),n&&s.each(a=>{a.children&&(a=be(a.data),r.add.push(a),r.source.push(a))}),Jp(s,ee,ee)),r.source.root=s,r}});function ZL(){const e=[],t={entries:r=>i(n(r,0),0),key:r=>(e.push(r),t)};function n(r,s){if(s>=e.length)return r;const a=r.length,o=e[s++],u={},l={};let c=-1,f,d,p;for(;++ce.length)return r;const a=[];for(const o in r)a.push({key:o,values:i(r[o],s)});return a}return t}function Xi(e){F.call(this,null,e)}const eB=(e,t)=>e.parent===t.parent?1:2;z(Xi,F,{transform(e,t){(!t.source||!t.source.root)&&S(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),i=this.fields,r=t.source.root,s=e.as||i;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(Ls(e.sort,a=>a.data)),tB(n,this.params,e),n.separation&&n.separation(e.separation!==!1?eB:Ha);try{this.value=n(r)}catch(a){S(a)}return r.each(a=>nB(a,i,s)),t.reflow(e.modified()).modifies(s).modifies("leaf")}});function tB(e,t,n){for(let i,r=0,s=t.length;rs[ee(a)]=1),i.each(a=>{const o=a.data,u=a.parent&&a.parent.data;u&&s[ee(o)]&&s[ee(u)]&&r.add.push(be({source:u,target:o}))}),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,a=>s[ee(a)]=1),n.forEach(a=>{(s[ee(a.source)]||s[ee(a.target)])&&r.mod.push(a)})),r}});const pv={binary:v5,dice:k_,slice:$_,slicedice:x5,squarify:S_,resquarify:b5},tg=["x0","y0","x1","y1","depth","children"];function S1(e){Xi.call(this,e)}S1.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:tg.length,default:tg}]};z(S1,Xi,{layout(){const e=F_();return e.ratio=t=>{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{H(pv,t)?e.tile(pv[t]):S("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:tg});const iB=Object.freeze(Object.defineProperty({__proto__:null,nest:v1,pack:E1,partition:A1,stratify:C1,tree:w1,treelinks:F1,treemap:S1},Symbol.toStringTag,{value:"Module"})),mh=4278190080;function rB(e,t){const n=e.bitmap();return(t||[]).forEach(i=>n.set(e(i.boundary[0]),e(i.boundary[3]))),[n,void 0]}function sB(e,t,n,i,r){const s=e.width,a=e.height,o=i||r,u=Er(s,a).getContext("2d"),l=Er(s,a).getContext("2d"),c=o&&Er(s,a).getContext("2d");n.forEach(w=>sc(u,w,!1)),sc(l,t,!1),o&&sc(c,t,!0);const f=yh(u,s,a),d=yh(l,s,a),p=o&&yh(c,s,a),h=e.bitmap(),g=o&&e.bitmap();let m,y,b,v,A,E,C,x;for(y=0;y{r.items.forEach(s=>sc(e,s.items,n))}):sn[i].draw(e,{items:n?t.map(aB):t})}function aB(e){const t=mf(e,{});return t.stroke&&t.strokeOpacity!==0||t.fill&&t.fillOpacity!==0?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const Ri=5,Dt=31,hu=32,ur=new Uint32Array(hu+1),Dn=new Uint32Array(hu+1);Dn[0]=0;ur[0]=~Dn[0];for(let e=1;e<=hu;++e)Dn[e]=Dn[e-1]<<1|1,ur[e]=~Dn[e];function oB(e,t){const n=new Uint32Array(~~((e*t+hu)/hu));function i(s,a){n[s]|=a}function r(s,a){n[s]&=a}return{array:n,get:(s,a)=>{const o=a*e+s;return n[o>>>Ri]&1<<(o&Dt)},set:(s,a)=>{const o=a*e+s;i(o>>>Ri,1<<(o&Dt))},clear:(s,a)=>{const o=a*e+s;r(o>>>Ri,~(1<<(o&Dt)))},getRange:(s,a,o,u)=>{let l=u,c,f,d,p;for(;l>=a;--l)if(c=l*e+s,f=l*e+o,d=c>>>Ri,p=f>>>Ri,d===p){if(n[d]&ur[c&Dt]&Dn[(f&Dt)+1])return!0}else{if(n[d]&ur[c&Dt]||n[p]&Dn[(f&Dt)+1])return!0;for(let h=d+1;h{let l,c,f,d,p;for(;a<=u;++a)if(l=a*e+s,c=a*e+o,f=l>>>Ri,d=c>>>Ri,f===d)i(f,ur[l&Dt]&Dn[(c&Dt)+1]);else for(i(f,ur[l&Dt]),i(d,Dn[(c&Dt)+1]),p=f+1;p{let l,c,f,d,p;for(;a<=u;++a)if(l=a*e+s,c=a*e+o,f=l>>>Ri,d=c>>>Ri,f===d)r(f,Dn[l&Dt]|ur[(c&Dt)+1]);else for(r(f,Dn[l&Dt]),r(d,ur[(c&Dt)+1]),p=f+1;ps<0||a<0||u>=t||o>=e}}function uB(e,t,n){const i=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+i)/i),s=~~((t+2*n+i)/i),a=o=>~~((o+n)/i);return a.invert=o=>o*i-n,a.bitmap=()=>oB(r,s),a.ratio=i,a.padding=n,a.width=e,a.height=t,a}function lB(e,t,n,i){const r=e.width,s=e.height;return function(a){const o=a.datum.datum.items[i].items,u=o.length,l=a.datum.fontSize,c=Zt.width(a.datum,a.datum.text);let f=0,d,p,h,g,m,y,b;for(let v=0;v=f&&(f=b,a.x=m,a.y=y);return m=c/2,y=l/2,d=a.x-m,p=a.x+m,h=a.y-y,g=a.y+y,a.align="center",d<0&&p<=r?a.align="left":0<=d&&rr||t-(a=i/2)<0||t+a>s}function yr(e,t,n,i,r,s,a,o){const u=r*s/(i*2),l=e(t-u),c=e(t+u),f=e(n-(s=s/2)),d=e(n+s);return a.outOfBounds(l,f,c,d)||a.getRange(l,f,c,d)||o&&o.getRange(l,f,c,d)}function cB(e,t,n,i){const r=e.width,s=e.height,a=t[0],o=t[1];function u(l,c,f,d,p){const h=e.invert(l),g=e.invert(c);let m=f,y=s,b;if(!Bc(h,g,d,p,r,s)&&!yr(e,h,g,p,d,m,a,o)&&!yr(e,h,g,p,d,p,a,null)){for(;y-m>=1;)b=(m+y)/2,yr(e,h,g,p,d,b,a,o)?y=b:m=b;if(m>f)return[h,g,m,!0]}}return function(l){const c=l.datum.datum.items[i].items,f=c.length,d=l.datum.fontSize,p=Zt.width(l.datum,l.datum.text);let h=n?d:0,g=!1,m=!1,y=0,b,v,A,E,C,x,w,R,L,J,ne,de,N,O,I,G,X;for(let V=0;Vv&&(X=b,b=v,v=X),A>E&&(X=A,A=E,E=X),L=e(b),ne=e(v),J=~~((L+ne)/2),de=e(A),O=e(E),N=~~((de+O)/2),w=J;w>=L;--w)for(R=N;R>=de;--R)G=u(w,R,h,p,d),G&&([l.x,l.y,h,g]=G);for(w=J;w<=ne;++w)for(R=N;R<=O;++R)G=u(w,R,h,p,d),G&&([l.x,l.y,h,g]=G);!g&&!n&&(I=Math.abs(v-b+E-A),C=(b+v)/2,x=(A+E)/2,I>=y&&!Bc(C,x,p,d,r,s)&&!yr(e,C,x,d,p,d,a,null)&&(y=I,l.x=C,l.y=x,m=!0))}return g||m?(C=p/2,x=d/2,a.setRange(e(l.x-C),e(l.y-x),e(l.x+C),e(l.y+x)),l.align="center",l.baseline="middle",!0):!1}}const fB=[-1,-1,1,1],dB=[-1,1,-1,1];function hB(e,t,n,i){const r=e.width,s=e.height,a=t[0],o=t[1],u=e.bitmap();return function(l){const c=l.datum.datum.items[i].items,f=c.length,d=l.datum.fontSize,p=Zt.width(l.datum,l.datum.text),h=[];let g=n?d:0,m=!1,y=!1,b=0,v,A,E,C,x,w,R,L,J,ne,de,N;for(let O=0;O=1;)de=(J+ne)/2,yr(e,x,w,d,p,de,a,o)?ne=de:J=de;J>g&&(l.x=x,l.y=w,g=J,m=!0)}}!m&&!n&&(N=Math.abs(A-v+C-E),x=(v+A)/2,w=(E+C)/2,N>=b&&!Bc(x,w,p,d,r,s)&&!yr(e,x,w,d,p,d,a,null)&&(b=N,l.x=x,l.y=w,y=!0))}return m||y?(x=p/2,w=d/2,a.setRange(e(l.x-x),e(l.y-w),e(l.x+x),e(l.y+w)),l.align="center",l.baseline="middle",!0):!1}}const pB=["right","center","left"],gB=["bottom","middle","top"];function mB(e,t,n,i){const r=e.width,s=e.height,a=t[0],o=t[1],u=i.length;return function(l){const c=l.boundary,f=l.datum.fontSize;if(c[2]<0||c[5]<0||c[0]>r||c[3]>s)return!1;let d=l.textWidth??0,p,h,g,m,y,b,v,A,E,C,x,w,R,L,J;for(let ne=0;ne>>2&3)-1,g=p===0&&h===0||i[ne]<0,m=p&&h?Math.SQRT1_2:1,y=i[ne]<0?-1:1,b=c[1+p]+i[ne]*p*m,x=c[4+h]+y*f*h/2+i[ne]*h*m,A=x-f/2,E=x+f/2,w=e(b),L=e(A),J=e(E),!d)if(gv(w,w,L,J,a,o,b,b,A,E,c,g))d=Zt.width(l.datum,l.datum.text);else continue;if(C=b+y*d*p/2,b=C-d/2,v=C+d/2,w=e(b),R=e(v),gv(w,R,L,J,a,o,b,v,A,E,c,g))return l.x=p?p*y<0?v:b:C,l.y=h?h*y<0?E:A:x,l.align=pB[p*y+1],l.baseline=gB[h*y+1],a.setRange(w,L,R,J),!0}return!1}}function gv(e,t,n,i,r,s,a,o,u,l,c,f){return!(r.outOfBounds(e,n,t,i)||(f&&s||r).getRange(e,n,t,i))}const bh=0,xh=4,vh=8,Eh=0,Ah=1,Ch=2,yB={"top-left":bh+Eh,top:bh+Ah,"top-right":bh+Ch,left:xh+Eh,middle:xh+Ah,right:xh+Ch,"bottom-left":vh+Eh,bottom:vh+Ah,"bottom-right":vh+Ch},bB={naive:lB,"reduced-search":cB,floodfill:hB};function xB(e,t,n,i,r,s,a,o,u,l,c){if(!e.length)return e;const f=Math.max(i.length,r.length),d=vB(i,f),p=EB(r,f),h=AB(e[0].datum),g=h==="group"&&e[0].datum.items[u].marktype,m=g==="area",y=CB(h,g,o,u),b=l===null||l===1/0,v=m&&c==="naive";let A=-1,E=-1;const C=e.map(L=>{const J=b?Zt.width(L,L.text):void 0;return A=Math.max(A,J),E=Math.max(E,L.fontSize),{datum:L,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(L),textWidth:J}});l=l===null||l===1/0?Math.max(A,E)+Math.max(...i):l;const x=uB(t[0],t[1],l);let w;if(!v){n&&C.sort((ne,de)=>n(ne.datum,de.datum));let L=!1;for(let ne=0;nene.datum);w=s.length||J?sB(x,J||[],s,L,m):rB(x,a&&C)}const R=m?bB[c](x,w,a,u):mB(x,w,p,d);return C.forEach(L=>L.opacity=+R(L)),C}function vB(e,t){const n=new Float64Array(t),i=e.length;for(let r=0;r[s.x,s.x,s.x,s.y,s.y,s.y];return e?e==="line"||e==="area"?s=>r(s.datum):t==="line"?s=>{const a=s.datum.items[i].items;return r(a.length?a[n==="start"?0:a.length-1]:{x:NaN,y:NaN})}:s=>{const a=s.datum.bounds;return[a.x1,(a.x1+a.x2)/2,a.x2,a.y1,(a.y1+a.y2)/2,a.y2]}:r}const ng=["x","y","opacity","align","baseline"],_S=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function $1(e){F.call(this,null,e)}$1.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:_S},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:ng.length,default:ng}]};z($1,F,{transform(e,t){function n(s){const a=e[s];return ae(a)&&t.modified(a.fields)}const i=e.modified();if(!(i||t.changed(t.ADD_REM)||n("sort")))return;(!e.size||e.size.length!==2)&&S("Size parameter should be specified as a [width, height] array.");const r=e.as||ng;return xB(t.materialize(t.SOURCE).source||[],e.size,e.sort,W(e.offset==null?1:e.offset),W(e.anchor||_S),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||"end",e.markIndex||0,e.padding===void 0?0:e.padding,e.method||"naive").forEach(s=>{const a=s.datum;a[r[0]]=s.x,a[r[1]]=s.y,a[r[2]]=s.opacity,a[r[3]]=s.align,a[r[4]]=s.baseline}),t.reflow(i).modifies(r)}});const wB=Object.freeze(Object.defineProperty({__proto__:null,label:$1},Symbol.toStringTag,{value:"Module"}));function TS(e,t){var n=[],i=function(c){return c(o)},r,s,a,o,u,l;if(t==null)n.push(e);else for(r={},s=0,a=e.length;s{HC(l,e.x,e.y,e.bandwidth||.3).forEach(c=>{const f={};for(let d=0;de==="poly"?t:e==="quad"?2:1;function D1(e){F.call(this,null,e)}D1.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(ig)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]};z(D1,F,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=t.materialize(t.SOURCE).source,r=TS(i,e.groupby),s=(e.groupby||[]).map(ze),a=e.method||"linear",o=e.order==null?3:e.order,u=FB(a,o),l=e.as||[ze(e.x),ze(e.y)],c=ig[a],f=[];let d=e.extent;H(ig,a)||S("Invalid regression method: "+a),d!=null&&a==="log"&&d[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),r.forEach(p=>{if(p.length<=u){t.dataflow.warn("Skipping regression with more parameters than data points.");return}const g=c(p,e.x,e.y,o);if(e.params){f.push(be({keys:p.dims,coef:g.coef,rSquared:g.rSquared}));return}const m=d||di(p,e.x),y=b=>{const v={};for(let A=0;Ay([b,g.predict(b)])):Cf(g.predict,m,25,200).forEach(y)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n}});const SB=Object.freeze(Object.defineProperty({__proto__:null,loess:k1,regression:D1},Symbol.toStringTag,{value:"Module"}));function O1(e){F.call(this,null,e)}O1.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const $B=[-1e5,-1e5,1e5,1e5];z(O1,F,{transform(e,t){const n=e.as||"path",i=t.source;if(!i||!i.length)return t;let r=e.size;r=r?[0,0,r[0],r[1]]:(r=e.extent)?[r[0][0],r[0][1],r[1][0],r[1][1]]:$B;const s=this.value=E5.from(i,e.x,e.y).voronoi(r);for(let a=0,o=i.length;a>5)*e[1]),m=null,y=l.length,b=-1,v=[],A=l.map(C=>({text:t(C),font:n(C),style:r(C),weight:s(C),rotate:a(C),size:~~(i(C)+1e-14),padding:o(C),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:C})).sort((C,x)=>x.size-C.size);++b>1,E.y=e[1]*(c()+.5)>>1,_B(h,E,A,b),E.hasText&&p(g,E,m)&&(v.push(E),m?NB(m,E):m=[{x:E.x+E.x0,y:E.y+E.y0},{x:E.x+E.x1,y:E.y+E.y1}],E.x-=e[0]>>1,E.y-=e[1]>>1)}return v};function d(h){h.width=h.height=1;var g=Math.sqrt(h.getContext("2d").getImageData(0,0,1,1).data.length>>2);h.width=(qo<<5)/g,h.height=ac/g;var m=h.getContext("2d");return m.fillStyle=m.strokeStyle="red",m.textAlign="center",{context:m,ratio:g}}function p(h,g,m){for(var y=g.x,b=g.y,v=Math.hypot(e[0],e[1]),A=u(e),E=c()<.5?1:-1,C=-E,x,w,R;(x=A(C+=E))&&(w=~~x[0],R=~~x[1],!(Math.min(Math.abs(w),Math.abs(R))>=v));)if(g.x=y+w,g.y=b+R,!(g.x+g.x0<0||g.y+g.y0<0||g.x+g.x1>e[0]||g.y+g.y1>e[1])&&(!m||!TB(g,h,e[0]))&&(!m||MB(g,m))){for(var L=g.sprite,J=g.width>>5,ne=e[0]>>5,de=g.x-(J<<4),N=de&127,O=32-N,I=g.y1-g.y0,G=(g.y+g.y0)*ne+(de>>5),X,V=0;V>>N:0);G+=ne}return g.sprite=null,!0}return!1}return f.words=function(h){return arguments.length?(l=h,f):l},f.size=function(h){return arguments.length?(e=[+h[0],+h[1]],f):e},f.font=function(h){return arguments.length?(n=Vr(h),f):n},f.fontStyle=function(h){return arguments.length?(r=Vr(h),f):r},f.fontWeight=function(h){return arguments.length?(s=Vr(h),f):s},f.rotate=function(h){return arguments.length?(a=Vr(h),f):a},f.text=function(h){return arguments.length?(t=Vr(h),f):t},f.spiral=function(h){return arguments.length?(u=PB[h]||h,f):u},f.fontSize=function(h){return arguments.length?(i=Vr(h),f):i},f.padding=function(h){return arguments.length?(o=Vr(h),f):o},f.random=function(h){return arguments.length?(c=h,f):c},f}function _B(e,t,n,i){if(!t.sprite){var r=e.context,s=e.ratio;r.clearRect(0,0,(qo<<5)/s,ac/s);var a=0,o=0,u=0,l=n.length,c,f,d,p,h;for(--i;++i>5<<5,d=~~Math.max(Math.abs(b+v),Math.abs(b-v))}else c=c+31>>5<<5;if(d>u&&(u=d),a+c>=qo<<5&&(a=0,o+=u,u=0),o+d>=ac)break;r.translate((a+(c>>1))/s,(o+(d>>1))/s),t.rotate&&r.rotate(t.rotate*wh),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=c,t.height=d,t.xoff=a,t.yoff=o,t.x1=c>>1,t.y1=d>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,a+=c}for(var E=r.getImageData(0,0,(qo<<5)/s,ac/s).data,C=[];--i>=0;)if(t=n[i],!!t.hasText){for(c=t.width,f=c>>5,d=t.y1-t.y0,p=0;p>5),L=E[(o+h)*(qo<<5)+(a+p)<<2]?1<<31-p%32:0;C[R]|=L,x|=L}x?w=h:(t.y0++,d--,h--,o++)}t.y1=t.y0+w,t.sprite=C.slice(0,(t.y1-t.y0)*f)}}}function TB(e,t,n){n>>=5;for(var i=e.sprite,r=e.width>>5,s=e.x-(r<<4),a=s&127,o=32-a,u=e.y1-e.y0,l=(e.y+e.y0)*n+(s>>5),c,f=0;f>>a:0))&t[l+d])return!0;l+=n}return!1}function NB(e,t){var n=e[0],i=e[1];t.x+t.x0i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function MB(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0t[0].y&&e.y+e.y0g(h(m))}r.forEach(h=>{h[a[0]]=NaN,h[a[1]]=NaN,h[a[3]]=0});const l=s.words(r).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(o).random(yn).layout(),c=s.size(),f=c[0]>>1,d=c[1]>>1,p=l.length;for(let h=0,g,m;hnew Uint8Array(e),jB=e=>new Uint16Array(e),Zo=e=>new Uint32Array(e);function qB(){let e=8,t=[],n=Zo(0),i=Dl(0,e),r=Dl(0,e);return{data:()=>t,seen:()=>n=WB(n,t.length),add(s){for(let a=0,o=t.length,u=s.length,l;at.length,curr:()=>i,prev:()=>r,reset:s=>r[s]=i[s],all:()=>e<257?255:e<65537?65535:4294967295,set(s,a){i[s]|=a},clear(s,a){i[s]&=~a},resize(s,a){const o=i.length;(s>o||a>e)&&(e=Math.max(a,e),i=Dl(s,e,i),r=Dl(s,e))}}}function WB(e,t,n){return e.length>=t?e:(n=n||new e.constructor(t),n.set(e),n)}function Dl(e,t,n){const i=(t<257?UB:t<65537?jB:Zo)(e);return n&&i.set(n),i}function mv(e,t,n){const i=1<0)for(m=0;me,size:()=>n}}function GB(e,t){return e.sort.call(t,(n,i)=>{const r=e[n],s=e[i];return rs?1:0}),A5(e,t)}function HB(e,t,n,i,r,s,a,o,u){let l=0,c=0,f;for(f=0;lt.modified(i.fields));return n?this.reinit(e,t):this.eval(e,t)}else return this.init(e,t)},init(e,t){const n=e.fields,i=e.query,r=this._indices={},s=this._dims=[],a=i.length;let o=0,u,l;for(;o{const s=r.remove(t,n);for(const a in i)i[a].reindex(s)})},update(e,t,n){const i=this._dims,r=e.query,s=t.stamp,a=i.length;let o=0,u,l;for(n.filters=0,l=0;lp)for(m=p,y=Math.min(f,h);mh)for(m=Math.max(f,h),y=d;mf)for(h=f,g=Math.min(l,d);hd)for(h=Math.max(l,d),g=c;ho[c]&n?null:a[c];return s.filter(s.MOD,l),r&r-1?(s.filter(s.ADD,c=>{const f=o[c]&n;return!f&&f^u[c]&n?a[c]:null}),s.filter(s.REM,c=>{const f=o[c]&n;return f&&!(f^(f^u[c]&n))?a[c]:null})):(s.filter(s.ADD,l),s.filter(s.REM,c=>(o[c]&n)===r?a[c]:null)),s.filter(s.SOURCE,c=>l(c._index))}});const VB=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:_1,resolvefilter:T1},Symbol.toStringTag,{value:"Module"})),XB="RawCode",xs="Literal",YB="Property",KB="Identifier",JB="ArrayExpression",QB="BinaryExpression",LS="CallExpression",ZB="ConditionalExpression",e7="LogicalExpression",t7="MemberExpression",n7="ObjectExpression",i7="UnaryExpression";function qn(e){this.type=e}qn.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=r7(this),n=0,i=t.length;n";vi[vs]="Identifier";vi[Lr]="Keyword";vi[jf]="Null";vi[Is]="Numeric";vi[Lt]="Punctuator";vi[Ku]="String";vi[s7]="RegularExpression";var a7="ArrayExpression",o7="BinaryExpression",u7="CallExpression",l7="ConditionalExpression",BS="Identifier",c7="Literal",f7="LogicalExpression",d7="MemberExpression",h7="ObjectExpression",p7="Property",g7="UnaryExpression",Qe="Unexpected token %0",m7="Unexpected number",y7="Unexpected string",b7="Unexpected identifier",x7="Unexpected reserved word",v7="Unexpected end of input",rg="Invalid regular expression",Fh="Invalid regular expression: missing /",PS="Octal literals are not allowed in strict mode.",E7="Duplicate data property in object literal not allowed in strict mode",lt="ILLEGAL",pu="Disabled.",A7=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),C7=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function qf(e,t){if(!e)throw new Error("ASSERT: "+t)}function Ni(e){return e>=48&&e<=57}function N1(e){return"0123456789abcdefABCDEF".includes(e)}function eu(e){return"01234567".includes(e)}function w7(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function gu(e){return e===10||e===13||e===8232||e===8233}function Ju(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&A7.test(String.fromCharCode(e))}function Pc(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&C7.test(String.fromCharCode(e))}const F7={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function IS(){for(;$1114111||e!=="}")&&he({},Qe,lt),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,i=(t-65536&1023)+56320,String.fromCharCode(n,i))}function zS(){var e,t;for(e=Y.charCodeAt($++),t=String.fromCharCode(e),e===92&&(Y.charCodeAt($)!==117&&he({},Qe,lt),++$,e=sg("u"),(!e||e==="\\"||!Ju(e.charCodeAt(0)))&&he({},Qe,lt),t=e);$>>=")return $+=4,{type:Lt,value:a,start:e,end:$};if(s=a.substr(0,3),s===">>>"||s==="<<="||s===">>=")return $+=3,{type:Lt,value:s,start:e,end:$};if(r=s.substr(0,2),i===r[1]&&"+-<>&|".includes(i)||r==="=>")return $+=2,{type:Lt,value:r,start:e,end:$};if(r==="//"&&he({},Qe,lt),"<>=!+-*%&|^/".includes(i))return++$,{type:Lt,value:i,start:e,end:$};he({},Qe,lt)}function D7(e){let t="";for(;${if(parseInt(r,16)<=1114111)return"x";he({},rg)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch{he({},rg)}try{return new RegExp(e,t)}catch{return null}}function T7(){var e,t,n,i,r;for(e=Y[$],qf(e==="/","Regular expression literal must start with a slash"),t=Y[$++],n=!1,i=!1;$=0&&he({},rg,n),{value:n,literal:t}}function M7(){var e,t,n,i;return ve=null,IS(),e=$,t=T7(),n=N7(),i=_7(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:$}}function L7(e){return e.type===vs||e.type===Lr||e.type===Uf||e.type===jf}function US(){if(IS(),$>=Ct)return{type:Yu,start:$,end:$};const e=Y.charCodeAt($);return Ju(e)?k7():e===40||e===41||e===59?Sh():e===39||e===34?R7():e===46?Ni(Y.charCodeAt($+1))?bv():Sh():Ni(e)?bv():Sh()}function Pt(){const e=ve;return $=e.end,ve=US(),$=e.end,e}function jS(){const e=$;ve=US(),$=e}function B7(e){const t=new qn(a7);return t.elements=e,t}function xv(e,t,n){const i=new qn(e==="||"||e==="&&"?f7:o7);return i.operator=e,i.left=t,i.right=n,i}function P7(e,t){const n=new qn(u7);return n.callee=e,n.arguments=t,n}function I7(e,t,n){const i=new qn(l7);return i.test=e,i.consequent=t,i.alternate=n,i}function M1(e){const t=new qn(BS);return t.name=e,t}function Wo(e){const t=new qn(c7);return t.value=e.value,t.raw=Y.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function vv(e,t,n){const i=new qn(d7);return i.computed=e==="[",i.object=t,i.property=n,i.computed||(n.member=!0),i}function z7(e){const t=new qn(h7);return t.properties=e,t}function Ev(e,t,n){const i=new qn(p7);return i.key=t,i.value=n,i.kind=e,i}function U7(e,t){const n=new qn(g7);return n.operator=e,n.argument=t,n.prefix=!0,n}function he(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,(s,a)=>(qf(a":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11;break}return t}function Z7(){var e,t,n,i,r,s,a,o,u,l;if(e=ve,u=oc(),i=ve,r=wv(i),r===0)return u;for(i.prec=r,Pt(),t=[e,ve],a=oc(),s=[u,i,a];(r=wv(ve))>0;){for(;s.length>2&&r<=s[s.length-2].prec;)a=s.pop(),o=s.pop().value,u=s.pop(),t.pop(),n=xv(o,u,a),s.push(n);i=Pt(),i.prec=r,s.push(i),t.push(ve),n=oc(),s.push(n)}for(l=s.length-1,n=s[l],t.pop();l>1;)t.pop(),n=xv(s[l-1].value,s[l-2],n),l-=2;return n}function Es(){var e,t,n;return e=Z7(),Oe("?")&&(Pt(),t=Es(),wt(":"),n=Es(),e=I7(e,t,n)),e}function L1(){const e=Es();if(Oe(","))throw new Error(pu);return e}function qS(e){Y=e,$=0,Ct=Y.length,ve=null,jS();const t=L1();if(ve.type!==Yu)throw new Error("Unexpect token after expression.");return t}var WS={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function GS(e){function t(a,o,u,l){let c=e(o[0]);return u&&(c=u+"("+c+")",u.lastIndexOf("new ",0)===0&&(c="("+c+")")),c+"."+a+(l<0?"":l===0?"()":"("+o.slice(1).map(e).join(",")+")")}function n(a,o,u){return l=>t(a,l,o,u)}const i="new Date",r="String",s="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(a){a.length<3&&S("Missing arguments to clamp function."),a.length>3&&S("Too many arguments to clamp function.");const o=a.map(e);return"Math.max("+o[1]+", Math.min("+o[2]+","+o[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:i,date:n("getDate",i,0),day:n("getDay",i,0),year:n("getFullYear",i,0),month:n("getMonth",i,0),hours:n("getHours",i,0),minutes:n("getMinutes",i,0),seconds:n("getSeconds",i,0),milliseconds:n("getMilliseconds",i,0),time:n("getTime",i,0),timezoneoffset:n("getTimezoneOffset",i,0),utcdate:n("getUTCDate",i,0),utcday:n("getUTCDay",i,0),utcyear:n("getUTCFullYear",i,0),utcmonth:n("getUTCMonth",i,0),utchours:n("getUTCHours",i,0),utcminutes:n("getUTCMinutes",i,0),utcseconds:n("getUTCSeconds",i,0),utcmilliseconds:n("getUTCMilliseconds",i,0),length:n("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",r,0),lower:n("toLowerCase",r,0),substring:n("substring",r),split:n("split",r),trim:n("trim",r,0),btoa:"btoa",atob:"atob",regexp:s,test:n("test",s),if:function(a){a.length<3&&S("Missing arguments to if function."),a.length>3&&S("Too many arguments to if function.");const o=a.map(e);return"("+o[0]+"?"+o[1]+":"+o[2]+")"}}}function eP(e){const t=e&&e.length-1;return t&&(e[0]==='"'&&e[t]==='"'||e[0]==="'"&&e[t]==="'")?e.slice(1,-1):e}function HS(e){e=e||{};const t=e.allowed?Ln(e.allowed):{},n=e.forbidden?Ln(e.forbidden):{},i=e.constants||WS,r=(e.functions||GS)(f),s=e.globalvar,a=e.fieldvar,o=ae(s)?s:h=>`${s}["${h}"]`;let u={},l={},c=0;function f(h){if(q(h))return h;const g=d[h.type];return g==null&&S("Unsupported type: "+h.type),g(h)}const d={Literal:h=>h.raw,Identifier:h=>{const g=h.name;return c>0?g:H(n,g)?S("Illegal identifier: "+g):H(i,g)?i[g]:H(t,g)?g:(u[g]=1,o(g))},MemberExpression:h=>{const g=!h.computed,m=f(h.object);g&&(c+=1);const y=f(h.property);return m===a&&(l[eP(y)]=1),g&&(c-=1),m+(g?"."+y:"["+y+"]")},CallExpression:h=>{h.callee.type!=="Identifier"&&S("Illegal callee type: "+h.callee.type);const g=h.callee.name,m=h.arguments,y=H(r,g)&&r[g];return y||S("Unrecognized function: "+g),ae(y)?y(m):y+"("+m.map(f).join(",")+")"},ArrayExpression:h=>"["+h.elements.map(f).join(",")+"]",BinaryExpression:h=>"("+f(h.left)+" "+h.operator+" "+f(h.right)+")",UnaryExpression:h=>"("+h.operator+f(h.argument)+")",ConditionalExpression:h=>"("+f(h.test)+"?"+f(h.consequent)+":"+f(h.alternate)+")",LogicalExpression:h=>"("+f(h.left)+h.operator+f(h.right)+")",ObjectExpression:h=>{for(const g of h.properties){const m=g.key.name;nm.has(m)&&S("Illegal property: "+m)}return"{"+h.properties.map(f).join(",")+"}"},Property:h=>{c+=1;const g=f(h.key);return c-=1,g+":"+f(h.value)}};function p(h){const g={code:f(h),globals:Object.keys(u),fields:Object.keys(l)};return u={},l={},g}return p.functions=r,p.constants=i,p}const Fv=Symbol("vega_selection_getter");function VS(e){return(!e.getter||!e.getter[Fv])&&(e.getter=pn(e.field),e.getter[Fv]=!0),e.getter}const B1="intersect",Sv="union",tP="vlMulti",nP="vlPoint",$v="or",iP="and",ri="_vgsid_",mu=pn(ri),rP="E",sP="R",aP="R-E",oP="R-LE",uP="R-RE",lP="E-LT",cP="E-LTE",fP="E-GT",dP="E-GTE",hP="E-VALID",pP="E-ONE",Ic="index:unit";function kv(e,t){for(var n=t.fields,i=t.values,r=n.length,s=0,a,o;s=i[s])return!1}else if(o.type===cP){if(a>i[s])return!1}else if(o.type===fP){if(a<=i[s])return!1}else if(o.type===dP){if(ase(t.fields?{values:t.fields.map(i=>VS(i)(n.datum))}:{[ri]:mu(n.datum)},t))}function vP(e,t,n,i){for(var r=this.context.data[e],s=r?r.values.value:[],a={},o={},u={},l,c,f,d,p,h,g,m,y,b,v=s.length,A=0,E,C;A(x[c[R].field]=w,x),{})))}else p=ri,h=mu(l),g=a[p]||(a[p]={}),m=g[d]||(g[d]=[]),m.push(h),n&&(m=o[d]||(o[d]=[]),m.push({[ri]:h}));if(t=t||Sv,a[ri]?a[ri]=kh[`${ri}_${t}`](...Object.values(a[ri])):Object.keys(a).forEach(x=>{a[x]=Object.keys(a[x]).map(w=>a[x][w]).reduce((w,R)=>w===void 0?R:kh[`${u[x]}_${t}`](w,R))}),s=Object.keys(o),n&&s.length){const x=i?nP:tP;a[x]=t===Sv?{[$v]:s.reduce((w,R)=>(w.push(...o[R]),w),[])}:{[iP]:s.map(w=>({[$v]:o[w]}))}}return a}var kh={[`${ri}_union`]:w5,[`${ri}_intersect`]:C5,E_union:function(e,t){if(!e.length)return t;for(var n=0,i=t.length;nt.includes(n)):t},R_union:function(e,t){var n=xt(t[0]),i=xt(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]i&&(n=t[1],i=t[0]),e.length?ii&&(e[1]=i),e):[n,i]}};const EP=":",AP="@";function P1(e,t,n,i){t[0].type!==xs&&S("First argument to selection functions must be a string literal.");const r=t[0].value,s=t.length>=2&&ce(t).value,a="unit",o=AP+a,u=EP+r;s===B1&&!H(i,o)&&(i[o]=n.getData(r).indataRef(n,a)),H(i,u)||(i[u]=n.getData(r).tuplesRef())}function YS(e){const t=this.context.data[e];return t?t.values.value:[]}function CP(e,t,n){const i=this.context.data[e]["index:"+t],r=i?i.value.get(n):void 0;return r&&r.count}function wP(e,t){const n=this.context.dataflow,i=this.context.data[e],r=i.input;return n.pulse(r,n.changeset().remove(gn).insert(t)),1}function FP(e,t,n){if(e){const i=this.context.dataflow,r=e.mark.source;i.pulse(r,i.changeset().encode(e,t))}return n!==void 0?n:e}const Qu=e=>function(t,n){const i=this.context.dataflow.locale();return t===null?"null":i[e](n)(t)},SP=Qu("format"),KS=Qu("timeFormat"),$P=Qu("utcFormat"),kP=Qu("timeParse"),DP=Qu("utcParse"),Ol=new Date(2e3,0,1);function Gf(e,t,n){return!Number.isInteger(e)||!Number.isInteger(t)?"":(Ol.setYear(2e3),Ol.setMonth(e),Ol.setDate(t),KS.call(this,Ol,n))}function OP(e){return Gf.call(this,e,1,"%B")}function RP(e){return Gf.call(this,e,1,"%b")}function _P(e){return Gf.call(this,0,2+e,"%A")}function TP(e){return Gf.call(this,0,2+e,"%a")}const NP=":",MP="@",ag="%",JS="$";function I1(e,t,n,i){t[0].type!==xs&&S("First argument to data functions must be a string literal.");const r=t[0].value,s=NP+r;if(!H(s,i))try{i[s]=n.getData(r).tuplesRef()}catch{}}function LP(e,t,n,i){t[0].type!==xs&&S("First argument to indata must be a string literal."),t[1].type!==xs&&S("Second argument to indata must be a string literal.");const r=t[0].value,s=t[1].value,a=MP+s;H(a,i)||(i[a]=n.getData(r).indataRef(n,s))}function Tt(e,t,n,i){if(t[0].type===xs)Dv(n,i,t[0].value);else for(e in n.scales)Dv(n,i,e)}function Dv(e,t,n){const i=ag+n;if(!H(t,i))try{t[i]=e.scaleRef(n)}catch{}}function Ei(e,t){if(q(e)){const n=t.scales[e];return n&&wx(n.value)?n.value:void 0}else if(ae(e))return wx(e)?e:void 0}function BP(e,t,n){t.__bandwidth=r=>r&&r.bandwidth?r.bandwidth():0,n._bandwidth=Tt,n._range=Tt,n._scale=Tt;const i=r=>"_["+(r.type===xs?P(ag+r.value):P(ag)+"+"+e(r))+"]";return{_bandwidth:r=>`this.__bandwidth(${i(r[0])})`,_range:r=>`${i(r[0])}.range()`,_scale:r=>`${i(r[0])}(${e(r[1])})`}}function z1(e,t){return function(n,i,r){if(n){const s=Ei(n,(r||this).context);return s&&s.path[e](i)}else return t(i)}}const PP=z1("area",F5),IP=z1("bounds",S5),zP=z1("centroid",$5);function UP(e,t){const n=Ei(e,(t||this).context);return n&&n.scale()}function jP(e){const t=this.context.group;let n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n}function U1(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(i){e.warn(i)}return n[n.length-1]}function qP(){return U1(this.context.dataflow,"warn",arguments)}function WP(){return U1(this.context.dataflow,"info",arguments)}function GP(){return U1(this.context.dataflow,"debug",arguments)}function Dh(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function og(e){const t=yc(e),n=Dh(t.r),i=Dh(t.g),r=Dh(t.b);return .2126*n+.7152*i+.0722*r}function HP(e,t){const n=og(e),i=og(t),r=Math.max(n,i),s=Math.min(n,i);return(r+.05)/(s+.05)}function VP(){const e=[].slice.call(arguments);return e.unshift({}),se(...e)}function QS(e,t){return e===t||e!==e&&t!==t?!0:D(e)?D(t)&&e.length===t.length?XP(e,t):!1:j(e)&&j(t)?ZS(e,t):!1}function XP(e,t){for(let n=0,i=e.length;nZS(e,t)}function YP(e,t,n,i,r,s){const a=this.context.dataflow,o=this.context.data[e],u=o.input,l=a.stamp();let c=o.changes,f,d;if(a._trigger===!1||!(u.value.length||t||i))return 0;if((!c||c.stamp{o.modified=!0,a.pulse(u,c).run()},!0,1)),n&&(f=n===!0?gn:D(n)||gf(n)?n:Ov(n),c.remove(f)),t&&c.insert(t),i&&(f=Ov(i),u.value.some(f)?c.remove(f):c.insert(i)),r)for(d in s)c.modify(r,d,s[d]);return 1}function KP(e){const t=e.touches,n=t[0].clientX-t[1].clientX,i=t[0].clientY-t[1].clientY;return Math.hypot(n,i)}function JP(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)}const Rv={};function QP(e,t){const n=Rv[t]||(Rv[t]=pn(t));return D(e)?e.map(n):n(e)}function Hf(e){return D(e)||ArrayBuffer.isView(e)?e:null}function j1(e){return Hf(e)||(q(e)?e:null)}function ZP(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;is.stop(l(c),e(c))),s}function pI(e,t,n){const i=Ei(e,(n||this).context);return function(r){return i?i.path.context(r)(t):""}}function gI(e){let t=null;return function(n){return n?cu(n,t=t||Sa(e)):e}}const e$=e=>e.data;function t$(e,t){const n=YS.call(t,e);return n.root&&n.root.lookup||{}}function mI(e,t,n){const i=t$(e,this),r=i[t],s=i[n];return r&&s?r.path(s).map(e$):void 0}function yI(e,t){const n=t$(e,this)[t];return n?n.ancestors().map(e$):void 0}const n$=()=>typeof window<"u"&&window||null;function bI(){const e=n$();return e?e.screen:{}}function xI(){const e=n$();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]}function vI(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]}function i$(e,t,n){if(!e)return[];const[i,r]=e,s=new We().set(i[0],i[1],r[0],r[1]),a=n||this.context.dataflow.scenegraph().root;return zF(a,s,EI(t))}function EI(e){let t=null;if(e){const n=W(e.marktype),i=W(e.markname);t=r=>(!n.length||n.some(s=>r.marktype===s))&&(!i.length||i.some(s=>r.name===s))}return t}function AI(e,t,n){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5;e=W(e);const r=e[e.length-1];return r===void 0||Math.hypot(r[0]-t,r[1]-n)>i?[...e,[t,n]]:e}function CI(e){return W(e).reduce((t,n,i)=>{let[r,s]=n;return t+=i==0?`M ${r},${s} `:i===e.length-1?" Z":`L ${r},${s} `},"")}function wI(e,t,n){const{x:i,y:r,mark:s}=n,a=new We().set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[u,l]of t)ua.x2&&(a.x2=u),la.y2&&(a.y2=l);return a.translate(i,r),i$([[a.x1,a.y1],[a.x2,a.y2]],e,s).filter(u=>FI(u.x,u.y,t))}function FI(e,t,n){let i=0;for(let r=0,s=n.length-1;rt!=o>t&&e<(a-u)*(t-l)/(o-l)+u&&i++}return i&1}const yu={random(){return yn()},cumulativeNormal:vf,cumulativeLogNormal:Nm,cumulativeUniform:Pm,densityNormal:Dm,densityLogNormal:Tm,densityUniform:Bm,quantileNormal:Ef,quantileLogNormal:Mm,quantileUniform:Im,sampleNormal:xf,sampleLogNormal:_m,sampleUniform:Lm,isArray:D,isBoolean:Mr,isDate:xr,isDefined(e){return e!==void 0},isNumber:ge,isObject:j,isRegExp:fm,isString:q,isTuple:gf,isValid(e){return e!=null&&e===e},toBoolean:hm,toDate(e){return pm(e)},toNumber:xt,toString:gm,indexof:eI,join:ZP,lastindexof:tI,replace:iI,reverse:rI,sort:sI,slice:nI,flush:U2,lerp:q2,merge:VP,pad:H2,peek:ce,pluck:QP,span:_u,inrange:la,truncate:V2,rgb:yc,lab:q5,hcl:j5,hsl:C_,luminance:og,contrast:HP,sequence:Ms,format:SP,utcFormat:$P,utcParse:DP,utcOffset:aC,utcSequence:lC,timeFormat:KS,timeParse:kP,timeOffset:sC,timeSequence:uC,timeUnitSpecifier:X2,monthFormat:OP,monthAbbrevFormat:RP,dayFormat:_P,dayAbbrevFormat:TP,quarter:B2,utcquarter:P2,week:K2,utcweek:Z2,dayofyear:Y2,utcdayofyear:Q2,warn:qP,info:WP,debug:GP,extent(e){return di(e)},inScope:jP,intersect:i$,clampRange:I2,pinchDistance:KP,pinchAngle:JP,screen:bI,containerSize:vI,windowSize:xI,bandspace:aI,setdata:wP,pathShape:gI,panLinear:T2,panLog:N2,panPow:M2,panSymlog:L2,zoomLinear:am,zoomLog:om,zoomPow:xc,zoomSymlog:um,encode:FP,modify:YP,lassoAppend:AI,lassoPath:CI,intersectLasso:wI},SI=["view","item","group","xy","x","y"],$I="event.vega.",r$="this.",q1={},s$={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${P(JS+e)}]`,functions:kI,constants:WS,visitors:q1},ug=HS(s$);function kI(e){const t=GS(e);SI.forEach(n=>t[n]=$I+n);for(const n in yu)t[n]=r$+n;return se(t,BP(e,yu,q1)),t}function qe(e,t,n){return arguments.length===1?yu[e]:(yu[e]=t,n&&(q1[e]=n),ug&&(ug.functions[e]=r$+e),this)}qe("bandwidth",oI,Tt);qe("copy",uI,Tt);qe("domain",lI,Tt);qe("range",fI,Tt);qe("invert",cI,Tt);qe("scale",dI,Tt);qe("gradient",hI,Tt);qe("geoArea",PP,Tt);qe("geoBounds",IP,Tt);qe("geoCentroid",zP,Tt);qe("geoShape",pI,Tt);qe("geoScale",UP,Tt);qe("indata",CP,LP);qe("data",YS,I1);qe("treePath",mI,I1);qe("treeAncestors",yI,I1);qe("vlSelectionTest",gP,P1);qe("vlSelectionIdTest",bP,P1);qe("vlSelectionResolve",vP,P1);qe("vlSelectionTuples",xP);function pi(e,t){const n={};let i;try{e=q(e)?e:P(e)+"",i=qS(e)}catch{S("Expression parse error: "+e)}i.visit(s=>{if(s.type!==LS)return;const a=s.callee.name,o=s$.visitors[a];o&&o(a,s.arguments,t,n)});const r=ug(i);return r.globals.forEach(s=>{const a=JS+s;!H(n,a)&&t.getSignal(s)&&(n[a]=t.signalRef(s))}),{$expr:se({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}function DI(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach(i=>t.parseOperator(i)),n.forEach(i=>t.parseOperatorParameters(i)),(e.streams||[]).forEach(i=>t.parseStream(i)),(e.updates||[]).forEach(i=>t.parseUpdate(i)),t.resolve()}const OI=Ln(["rule"]),_v=Ln(["group","image","rect"]);function RI(e,t){let n="";return OI[t]||(e.x2&&(e.x?(_v[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(_v[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}function W1(e){return(e+"").toLowerCase()}function _I(e){return W1(e)==="operator"}function TI(e){return W1(e)==="collect"}function Ao(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}function NI(e,t,n,i){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n} + : (u > v || v == null) && u != null ? ${i} + : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n} + : v !== v && u === u ? ${i} : `}var MI={operator:(e,t)=>Ao(e,["_"],t.code),parameter:(e,t)=>Ao(e,["datum","_"],t.code),event:(e,t)=>Ao(e,["event"],t.code),handler:(e,t)=>{const n=`var datum=event.item&&event.item.datum;return ${t.code};`;return Ao(e,["_","event"],n)},encode:(e,t)=>{const{marktype:n,channels:i}=t;let r="var o=item,datum=o.datum,m=0,$;";for(const s in i){const a="o["+P(s)+"]";r+=`$=${i[s].code};if(${a}!==$)${a}=$,m=1;`}return r+=RI(i,n),r+="return m;",Ao(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(P).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n;const i=(s,a)=>{const o=t[a];let u,l;return s.path?(u=`a${s.path}`,l=`b${s.path}`):((n=n||{})["f"+a]=s,u=`this.f${a}(a)`,l=`this.f${a}(b)`),NI(u,l,-o,o)},r=Function("a","b","var u, v; return "+e.map(i).join("")+"0;");return n?r.bind(n):r}}};function LI(e){const t=this;_I(e.type)||!e.type?t.operator(e,e.update?t.operatorExpression(e.update):null):t.transform(e,e.type)}function BI(e){const t=this;if(e.params){const n=t.get(e.id);n||S("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}}function PI(e,t){t=t||{};const n=this;for(const i in e){const r=e[i];t[i]=D(r)?r.map(s=>Tv(s,n,t)):Tv(r,n,t)}return t}function Tv(e,t,n){if(!e||!j(e))return e;for(let i=0,r=Nv.length,s;ir&&r.$tupleid?ee:r);return t.fn[n]||(t.fn[n]=lm(i,e.$order,t.expr.codegen))}function WI(e,t){const n=e.$encode,i={};for(const r in n){const s=n[r];i[r]=Vt(t.encodeExpression(s.$expr),s.$fields),i[r].output=s.$output}return i}function GI(e,t){return t}function HI(e,t){const n=e.$subflow;return function(i,r,s){const a=t.fork().parse(n),o=a.get(n.operators[0].id),u=a.signals.parent;return u&&u.set(s),o.detachSubflow=()=>t.detach(a),o}}function VI(){return ee}function XI(e){var t=this,n=e.filter!=null?t.eventExpression(e.filter):void 0,i=e.stream!=null?t.get(e.stream):void 0,r;e.source?i=t.events(e.source,e.type,n):e.merge&&(r=e.merge.map(s=>t.get(s)),i=r[0].merge.apply(r[0],r.slice(1))),e.between&&(r=e.between.map(s=>t.get(s)),i=i.between(r[0],r[1])),e.filter&&(i=i.filter(n)),e.throttle!=null&&(i=i.throttle(+e.throttle)),e.debounce!=null&&(i=i.debounce(+e.debounce)),i==null&&S("Invalid stream definition: "+JSON.stringify(e)),e.consume&&i.consume(!0),t.stream(e,i)}function YI(e){var t=this,n=j(n=e.source)?n.$ref:n,i=t.get(n),r=null,s=e.update,a=void 0;i||S("Source not defined: "+e.source),r=e.target&&e.target.$expr?t.eventExpression(e.target.$expr):t.get(e.target),s&&s.$expr&&(s.$params&&(a=t.parseParameters(s.$params)),s=t.handlerExpression(s.$expr)),t.update(e,i,r,s,a)}const KI={skip:!0};function JI(e){var t=this,n={};if(e.signals){var i=n.signals={};Object.keys(t.signals).forEach(s=>{const a=t.signals[s];e.signals(s,a)&&(i[s]=a.value)})}if(e.data){var r=n.data={};Object.keys(t.data).forEach(s=>{const a=t.data[s];e.data(s,a)&&(r[s]=a.input.value)})}return t.subcontext&&e.recurse!==!1&&(n.subcontext=t.subcontext.map(s=>s.getState(e))),n}function QI(e){var t=this,n=t.dataflow,i=e.data,r=e.signals;Object.keys(r||{}).forEach(s=>{n.update(t.signals[s],r[s],KI)}),Object.keys(i||{}).forEach(s=>{n.pulse(t.data[s].input,n.changeset().remove(gn).insert(i[s]))}),(e.subcontext||[]).forEach((s,a)=>{const o=t.subcontext[a];o&&o.setState(s)})}function a$(e,t,n,i){return new o$(e,t,n,i)}function o$(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||MI,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function Mv(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}o$.prototype=Mv.prototype={fork(){const e=new Mv(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter(n=>n!==e);const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,i=n.dataflow,r=e.value;if(n.set(e.id,t),TI(e.type)&&r&&(r.$ingest?i.ingest(t,r.$ingest,r.$format):r.$request?i.preload(t,r.$request,r.$format):i.pulse(t,i.changeset().insert(r))),e.root&&(n.root=t),e.parent){let s=n.get(e.parent.$ref);s?(i.connect(s,[t]),t.targets().add(s)):(n.unresolved=n.unresolved||[]).push(()=>{s=n.get(e.parent.$ref),i.connect(s,[t]),t.targets().add(s)})}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const s in e.data){const a=n.data[s]||(n.data[s]={});e.data[s].forEach(o=>a[o]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[W1(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,i,r){this.dataflow.on(t,n,i,r,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:DI,parseOperator:LI,parseOperatorParameters:BI,parseParameters:PI,parseStream:XI,parseUpdate:YI,getState:JI,setState:QI};function ZI(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),u$(t,e.description()))}function u$(e,t){e&&(t==null?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}function e4(e){e.add(null,t=>(e._background=t.bg,e._resize=1,t.bg),{bg:e._signals.background})}const Oh="default";function t4(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:Oh,item:null}));e.on(e.events("view","pointermove"),t,(n,i)=>{const r=t.value,s=r?q(r)?r:r.user:Oh,a=i.item&&i.item.cursor||null;return r&&s===r.user&&a==r.item?r:{user:s,item:a}}),e.add(null,function(n){let i=n.cursor,r=this.value;return q(i)||(r=i.item,i=i.user),lg(e,i&&i!==Oh?i:r||i),r},{cursor:t})}function lg(e,t){const n=e.globalCursor()?typeof document<"u"&&document.body:e.container();if(n)return t==null?n.style.removeProperty("cursor"):n.style.cursor=t}function zc(e,t){var n=e._runtime.data;return H(n,t)||S("Unrecognized data set: "+t),n[t]}function n4(e,t){return arguments.length<2?zc(this,e).values.value:Vf.call(this,e,Bs().remove(gn).insert(t))}function Vf(e,t){DC(t)||S("Second argument to changes must be a changeset.");const n=zc(this,e);return n.modified=!0,this.pulse(n.input,t)}function i4(e,t){return Vf.call(this,e,Bs().insert(t))}function r4(e,t){return Vf.call(this,e,Bs().remove(t))}function l$(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function c$(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function Xf(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function s4(e){var t=Xf(e),n=l$(e),i=c$(e);e._renderer.background(e.background()),e._renderer.resize(n,i,t),e._handler.origin(t),e._resizeListeners.forEach(r=>{try{r(n,i)}catch(s){e.error(s)}})}function a4(e,t,n){var i=e._renderer,r=i&&i.canvas(),s,a,o;return r&&(o=Xf(e),a=t.changedTouches?t.changedTouches[0]:t,s=Pf(a,r),s[0]-=o[0],s[1]-=o[1]),t.dataflow=e,t.item=n,t.vega=o4(e,n,s),t}function o4(e,t,n){const i=t?t.mark.marktype==="group"?t:t.mark.group:null;function r(a){var o=i,u;if(a){for(u=t;u;u=u.mark.group)if(u.mark.name===a){o=u;break}}return o&&o.mark&&o.mark.interactive?o:{}}function s(a){if(!a)return n;q(a)&&(a=r(a));const o=n.slice();for(;a;)o[0]-=a.x||0,o[1]-=a.y||0,a=a.mark&&a.mark.group;return o}return{view:kt(e),item:kt(t||{}),group:r,xy:s,x:a=>s(a)[0],y:a=>s(a)[1]}}const Lv="view",u4="timer",l4="window",c4={trap:!1};function f4(e){const t=se({defaults:{}},e),n=(i,r)=>{r.forEach(s=>{D(i[s])&&(i[s]=Ln(i[s]))})};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}function f$(e,t,n,i){e._eventListeners.push({type:n,sources:W(t),handler:i})}function d4(e,t){var n=e._eventConfig.defaults,i=n.prevent,r=n.allow;return i===!1||r===!0?!1:i===!0||r===!1?!0:i?i[t]:r?!r[t]:e.preventDefault()}function Rl(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return i===!1||j(i)&&!i[n]?(e.warn(`Blocked ${t} ${n} event listener.`),!1):!0}function h4(e,t,n){var i=this,r=new bf(n),s=function(l,c){i.runAsync(null,()=>{e===Lv&&d4(i,t)&&l.preventDefault(),r.receive(a4(i,l,c))})},a;if(e===u4)Rl(i,"timer",t)&&i.timer(s,t);else if(e===Lv)Rl(i,"view",t)&&i.addEventListener(t,s,c4);else if(e===l4?Rl(i,"window",t)&&typeof window<"u"&&(a=[window]):typeof document<"u"&&Rl(i,"selector",t)&&(a=Array.from(document.querySelectorAll(e))),!a)i.warn("Can not resolve event source: "+e);else{for(var o=0,u=a.length;o=0;)t[r].stop();for(r=i.length;--r>=0;)for(a=i[r],s=a.sources.length;--s>=0;)a.sources[s].removeEventListener(a.type,a.handler);for(e&&e.call(this,this._handler,null,null,null),r=n.length;--r>=0;)u=n[r].type,o=n[r].handler,this._handler.off(u,o);return this}function en(e,t,n){const i=document.createElement(e);for(const r in t)i.setAttribute(r,t[r]);return n!=null&&(i.textContent=n),i}const m4="vega-bind",y4="vega-bind-name",b4="vega-bind-radio";function x4(e,t,n){if(!t)return;const i=n.param;let r=n.state;return r||(r=n.state={elements:null,active:!1,set:null,update:a=>{a!=e.signal(i.signal)&&e.runAsync(null,()=>{r.source=!0,e.signal(i.signal,a)})}},i.debounce&&(r.update=cm(i.debounce,r.update))),(i.input==null&&i.element?v4:A4)(r,t,i,e),r.active||(e.on(e._signals[i.signal],null,()=>{r.source?r.source=!1:r.set(e.signal(i.signal))}),r.active=!0),r}function v4(e,t,n,i){const r=n.event||"input",s=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,s),f$(i,t,r,s),e.set=a=>{t.value=a,t.dispatchEvent(E4(r))}}function E4(e){return typeof Event<"u"?new Event(e):{type:e}}function A4(e,t,n,i){const r=i.signal(n.signal),s=en("div",{class:m4}),a=n.input==="radio"?s:s.appendChild(en("label"));a.appendChild(en("span",{class:y4},n.name||n.signal)),t.appendChild(s);let o=C4;switch(n.input){case"checkbox":o=w4;break;case"select":o=F4;break;case"radio":o=S4;break;case"range":o=$4;break}o(e,a,n,r)}function C4(e,t,n,i){const r=en("input");for(const s in n)s!=="signal"&&s!=="element"&&r.setAttribute(s==="input"?"type":s,n[s]);r.setAttribute("name",n.signal),r.value=i,t.appendChild(r),r.addEventListener("input",()=>e.update(r.value)),e.elements=[r],e.set=s=>r.value=s}function w4(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const s=en("input",r);t.appendChild(s),s.addEventListener("change",()=>e.update(s.checked)),e.elements=[s],e.set=a=>s.checked=!!a||null}function F4(e,t,n,i){const r=en("select",{name:n.signal}),s=n.labels||[];n.options.forEach((a,o)=>{const u={value:a};Uc(a,i)&&(u.selected=!0),r.appendChild(en("option",u,(s[o]||a)+""))}),t.appendChild(r),r.addEventListener("change",()=>{e.update(n.options[r.selectedIndex])}),e.elements=[r],e.set=a=>{for(let o=0,u=n.options.length;o{const u={type:"radio",name:n.signal,value:a};Uc(a,i)&&(u.checked=!0);const l=en("input",u);l.addEventListener("change",()=>e.update(a));const c=en("label",{},(s[o]||a)+"");return c.prepend(l),r.appendChild(c),l}),e.set=a=>{const o=e.elements,u=o.length;for(let l=0;l{u.textContent=o.value,e.update(+o.value)};o.addEventListener("input",l),o.addEventListener("change",l),e.elements=[o],e.set=c=>{o.value=c,u.textContent=c}}function Uc(e,t){return e===t||e+""==t+""}function d$(e,t,n,i,r,s){return t=t||new i(e.loader()),t.initialize(n,l$(e),c$(e),Xf(e),r,s).background(e.background())}function G1(e,t){return t?function(){try{t.apply(this,arguments)}catch(n){e.error(n)}}:null}function k4(e,t,n,i){const r=new i(e.loader(),G1(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,Xf(e),e);return t&&t.handlers().forEach(s=>{r.on(s.type,s.handler)}),r}function D4(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,s=If(i);e=n._el=e?Rh(n,e,!0):null,ZI(n),s||n.error("Unrecognized renderer type: "+i);const a=s.handler||Xu,o=e?s.renderer:s.headless;return n._renderer=o?d$(n,n._renderer,e,o):null,n._handler=k4(n,n._handler,e,a),n._redraw=!0,e&&r!=="none"&&(t=t?n._elBind=Rh(n,t,!0):e.appendChild(en("form",{class:"vega-bindings"})),n._bind.forEach(u=>{u.param.element&&r!=="container"&&(u.element=Rh(n,u.param.element,!!u.param.input))}),n._bind.forEach(u=>{x4(n,u.element||t,u)})),n}function Rh(e,t,n){if(typeof t=="string")if(typeof document<"u"){if(t=document.querySelector(t),!t)return e.error("Signal bind element not found: "+t),null}else return e.error("DOM document instance not found."),null;if(t&&n)try{t.textContent=""}catch(i){t=null,e.error(i)}return t}const Co=e=>+e||0,O4=e=>({top:e,bottom:e,left:e,right:e});function zv(e){return j(e)?{top:Co(e.top),bottom:Co(e.bottom),left:Co(e.left),right:Co(e.right)}:O4(Co(e))}async function H1(e,t,n,i){const r=If(t),s=r&&r.headless;return s||S("Unrecognized renderer type: "+t),await e.runAsync(),d$(e,null,null,s,n,i).renderAsync(e._scenegraph.root)}async function R4(e,t){e!==pr.Canvas&&e!==pr.SVG&&e!==pr.PNG&&S("Unrecognized image type: "+e);const n=await H1(this,e,t);return e===pr.SVG?_4(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")}function _4(e,t){const n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}async function T4(e,t){return(await H1(this,pr.Canvas,e,t)).canvas()}async function N4(e){return(await H1(this,pr.SVG,e)).svg()}function M4(e,t,n){return a$(e,Aa,yu,n).parse(t)}function L4(e){var t=this._runtime.scales;return H(t,e)||S("Unrecognized scale or projection: "+e),t[e].value}var h$="width",p$="height",V1="padding",Uv={skip:!0};function g$(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===V1?i.left+i.right:0)}function m$(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===V1?i.top+i.bottom:0)}function B4(e){var t=e._signals,n=t[h$],i=t[p$],r=t[V1];function s(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,o=>{e._width=o.size,e._viewWidth=g$(e,o.size),s()},{size:n}),e._resizeHeight=e.add(null,o=>{e._height=o.size,e._viewHeight=m$(e,o.size),s()},{size:i});const a=e.add(null,s,{pad:r});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=i.rank+1,a.rank=r.rank+1}function P4(e,t,n,i,r,s){this.runAfter(a=>{let o=0;a._autosize=0,a.width()!==n&&(o=1,a.signal(h$,n,Uv),a._resizeWidth.skip(!0)),a.height()!==i&&(o=1,a.signal(p$,i,Uv),a._resizeHeight.skip(!0)),a._viewWidth!==e&&(a._resize=1,a._viewWidth=e),a._viewHeight!==t&&(a._resize=1,a._viewHeight=t),(a._origin[0]!==r[0]||a._origin[1]!==r[1])&&(a._resize=1,a._origin=r),o&&a.run("enter"),s&&a.runAfter(u=>u.resize())},!1,1)}function I4(e){return this._runtime.getState(e||{data:z4,signals:U4,recurse:!0})}function z4(e,t){return t.modified&&D(t.input.value)&&!e.startsWith("_:vega:_")}function U4(e,t){return!(e==="parent"||t instanceof Aa.proxy)}function j4(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},t=>{t._trigger=!0}),this}function q4(e,t){function n(i){e({timestamp:Date.now(),elapsed:i})}this._timers.push(k5(n,t))}function W4(e,t,n,i){const r=e.element();r&&r.setAttribute("title",G4(i))}function G4(e){return e==null?"":D(e)?y$(e):j(e)&&!xr(e)?H4(e):e+""}function H4(e){return Object.keys(e).map(t=>{const n=e[t];return t+": "+(D(n)?y$(n):b$(n))}).join(` +`)}function y$(e){return"["+e.map(b$).join(", ")+"]"}function b$(e){return D(e)?"[…]":j(e)&&!xr(e)?"{…}":e}function V4(){if(this.renderer()==="canvas"&&this._renderer._canvas){let e=null;const t=()=>{e?.();const n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener("change",t),e=()=>{n.removeEventListener("change",t)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};t()}}function x$(e,t){const n=this;if(t=t||{},pa.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),t.logLevel!=null&&n.logLevel(t.logLevel),t.locale||e.locale){const s=se({},e.locale,t.locale);n.locale(xC(s.number,s.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||pr.Canvas,n._scenegraph=new hF;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||W4,n._redraw=!0,n._handler=new Xu().scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=f4(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const r=M4(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map(s=>({state:null,param:se({},s)})),r.root&&r.root.set(i),i.source=r.data.root.input,n.pulse(r.data.root.input,n.changeset().insert(i.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=g$(n,n._width),n._viewHeight=m$(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,B4(n),e4(n),t4(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function _l(e,t){return H(e._signals,t)?e._signals[t]:S("Unrecognized signal name: "+P(t))}function v$(e,t){const n=(e._targets||[]).filter(i=>i._update&&i._update.handler===t);return n.length?n[0]:null}function jv(e,t,n,i){let r=v$(n,i);return r||(r=G1(e,()=>i(t,n.value)),r.handler=i,e.on(n,null,r)),e}function qv(e,t,n){const i=v$(t,n);return i&&t._targets.remove(i),e}z(x$,pa,{async evaluate(e,t,n){if(await pa.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,s4(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(i){this.error(i)}return n&&Xl(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=e!=null?e+"":null;return t!==this._desc&&u$(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){const i=_l(this,e);return arguments.length===1?i.value:this.update(i,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",zv(e)):zv(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(If(e)||S("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(pa.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(_l(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:P4,addEventListener(e,t,n){let i=t;return n&&n.trap===!1||(i=G1(this,t),i.raw=t),this._handler.on(e,i),this},removeEventListener(e,t){for(var n=this._handler.handlers(e),i=n.length,r,s;--i>=0;)if(s=n[i].type,r=n[i].handler,e===s&&(t===r||t===r.raw)){this._handler.off(s,r);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.includes(e)||t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return jv(this,e,_l(this,e),t)},removeSignalListener(e,t){return qv(this,_l(this,e),t)},addDataListener(e,t){return jv(this,e,zc(this,e).values,t)},removeDataListener(e,t){return qv(this,zc(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=lg(this,null);this._globalCursor=!!e,t&&lg(this,t)}return this}else return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:q4,events:h4,finalize:g4,hover:p4,data:n4,change:Vf,insert:i4,remove:r4,scale:L4,initialize:D4,toImageURL:R4,toCanvas:T4,toSVG:N4,getState:I4,setState:j4,_watchPixelRatio:V4});const X4="view",jc="[",qc="]",E$="{",A$="}",Y4=":",C$=",",K4="@",J4=">",Q4=/[[\]{}]/,Z4={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let w$,F$;function Br(e,t,n){return w$=t||X4,F$=n||Z4,S$(e.trim()).map(cg)}function ez(e){return F$[e]}function tu(e,t,n,i,r){const s=e.length;let a=0,o;for(;t=0?--a:i&&i.indexOf(o)>=0&&++a}return t}function S$(e){const t=[],n=e.length;let i=0,r=0;for(;r' after between selector: "+e;i=i.map(cg);const r=cg(e.slice(1).trim());return r.between?{between:i,stream:r}:(r.between=i,r)}function nz(e){const t={source:w$},n=[];let i=[0,0],r=0,s=0,a=e.length,o=0,u,l;if(e[a-1]===A$){if(o=e.lastIndexOf(E$),o>=0){try{i=iz(e.substring(o+1,a-1))}catch{throw"Invalid throttle specification: "+e}e=e.slice(0,o).trim(),a=e.length}else throw"Unmatched right brace: "+e;o=0}if(!a)throw e;if(e[0]===K4&&(r=++o),u=tu(e,o,Y4),u1?(t.type=n[1],r?t.markname=n[0].slice(1):ez(n[0])?t.marktype=n[0]:t.source=n[0]):t.type=n[0],t.type.slice(-1)==="!"&&(t.consume=!0,t.type=t.type.slice(0,-1)),l!=null&&(t.filter=l),i[0]&&(t.throttle=i[0]),i[1]&&(t.debounce=i[1]),t}function iz(e){const t=e.split(C$);if(!e.length||t.length>2)throw e;return t.map(n=>{const i=+n;if(i!==i)throw e;return i})}function rz(e){return j(e)?e:{type:e||"pad"}}const wo=e=>+e||0,sz=e=>({top:e,bottom:e,left:e,right:e});function az(e){return j(e)?e.signal?e:{top:wo(e.top),bottom:wo(e.bottom),left:wo(e.left),right:wo(e.right)}:sz(wo(e))}const Ze=e=>j(e)&&!D(e)?se({},e):{value:e};function Wv(e,t,n,i){return n!=null?(j(n)&&!D(n)||D(n)&&n.length&&j(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1):0}function ht(e,t,n){for(const i in t)Wv(e,i,t[i]);for(const i in n)Wv(e,i,n[i],"update")}function no(e,t,n){for(const i in t)n&&H(n,i)||(e[i]=se(e[i]||{},t[i]));return e}function oa(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const X1="mark",Y1="frame",K1="scope",oz="axis",uz="axis-domain",lz="axis-grid",cz="axis-label",fz="axis-tick",dz="axis-title",hz="legend",pz="legend-band",gz="legend-entry",mz="legend-gradient",$$="legend-label",yz="legend-symbol",bz="legend-title",xz="title",vz="title-text",Ez="title-subtitle";function Az(e,t,n,i,r){const s={},a={};let o,u,l,c;u="lineBreak",t==="text"&&r[u]!=null&&!oa(u,e)&&_h(s,u,r[u]),(n=="legend"||String(n).startsWith("axis"))&&(n=null),c=n===Y1?r.group:n===X1?se({},r.mark,r[t]):null;for(u in c)l=oa(u,e)||(u==="fill"||u==="stroke")&&(oa("fill",e)||oa("stroke",e)),l||_h(s,u,c[u]);W(i).forEach(f=>{const d=r.style&&r.style[f];for(const p in d)oa(p,e)||_h(s,p,d[p])}),e=se({},e);for(u in s)c=s[u],c.signal?(o=o||{})[u]=c:a[u]=c;return e.enter=se(a,e.enter),o&&(e.update=se(o,e.update)),e}function _h(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const k$=e=>q(e)?P(e):e.signal?`(${e.signal})`:D$(e);function Yf(e){if(e.gradient!=null)return wz(e);let t=e.signal?`(${e.signal})`:e.color?Cz(e.color):e.field!=null?D$(e.field):e.value!==void 0?P(e.value):void 0;return e.scale!=null&&(t=Fz(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${uc(e.exponent)})`),e.mult!=null&&(t+=`*${uc(e.mult)}`),e.offset!=null&&(t+=`+${uc(e.offset)}`),e.round&&(t=`round(${t})`),t}const Tl=(e,t,n,i)=>`(${e}(${[t,n,i].map(Yf).join(",")})+'')`;function Cz(e){return e.c?Tl("hcl",e.h,e.c,e.l):e.h||e.s?Tl("hsl",e.h,e.s,e.l):e.l||e.a?Tl("lab",e.l,e.a,e.b):e.r||e.g||e.b?Tl("rgb",e.r,e.g,e.b):null}function wz(e){const t=[e.start,e.stop,e.count].map(n=>n==null?null:P(n));for(;t.length&&ce(t)==null;)t.pop();return t.unshift(k$(e.gradient)),`gradient(${t.join(",")})`}function uc(e){return j(e)?"("+Yf(e)+")":e}function D$(e){return O$(j(e)?e:{datum:e})}function O$(e){let t,n,i;if(e.signal)t="datum",i=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(i=e.parent,t+=".datum"):i=e.group}else e.datum?(t="datum",i=e.datum):S("Invalid field reference: "+P(e));return e.signal||(i=q(i)?bi(i).map(P).join("]["):O$(i)),t+"["+i+"]"}function Fz(e,t){const n=k$(e.scale);return e.range!=null?t=`lerp(_range(${n}), ${+e.range})`:(t!==void 0&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(+e.band==1?"":"*"+uc(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),t==null&&(t="0")),t}function Sz(e){let t="";return e.forEach(n=>{const i=Yf(n);t+=n.test?`(${n.test})?${i}:`:i}),ce(t)===":"&&(t+="null"),t}function R$(e,t,n,i,r,s){const a={};s=s||{},s.encoders={$encode:a},e=Az(e,t,n,i,r.config);for(const o in e)a[o]=$z(e[o],t,s,r);return s}function $z(e,t,n,i){const r={},s={};for(const a in e)e[a]!=null&&(r[a]=Dz(kz(e[a]),i,n,s));return{$expr:{marktype:t,channels:r},$fields:Object.keys(s),$output:Object.keys(e)}}function kz(e){return D(e)?Sz(e):Yf(e)}function Dz(e,t,n,i){const r=pi(e,t);return r.$fields.forEach(s=>i[s]=1),se(n,r.$params),r.$expr}const Oz="outer",Rz=["value","update","init","react","bind"];function Gv(e,t){S(e+' for "outer" push: '+P(t))}function _$(e,t){const n=e.name;if(e.push===Oz)t.signals[n]||Gv("No prior signal definition",n),Rz.forEach(i=>{e[i]!==void 0&&Gv("Invalid property ",i)});else{const i=t.addSignal(n,e.value);e.react===!1&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function fg(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function Kf(e,t,n,i){return new fg(e,t,n,i)}function Wc(e,t){return Kf("operator",e,t)}function Z(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function bu(e,t){return t?{$field:e,$name:t}:{$field:e}}const dg=bu("key");function Hv(e,t){return{$compare:e,$order:t}}function _z(e,t){const n={$key:e};return t&&(n.$flat=!0),n}const Tz="ascending",Nz="descending";function Mz(e){return j(e)?(e.order===Nz?"-":"+")+Jf(e.op,e.field):""}function Jf(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const J1="scope",hg="view";function Ye(e){return e&&e.signal}function Lz(e){return e&&e.expr}function lc(e){if(Ye(e))return!0;if(j(e)){for(const t in e)if(lc(e[t]))return!0}return!1}function kn(e,t){return e??t}function cs(e){return e&&e.signal||e}const Vv="timer";function xu(e,t){return(e.merge?Pz:e.stream?Iz:e.type?zz:S("Invalid stream specification: "+P(e)))(e,t)}function Bz(e){return e===J1?hg:e||hg}function Pz(e,t){const n=e.merge.map(r=>xu(r,t)),i=Q1({merge:n},e,t);return t.addStream(i).id}function Iz(e,t){const n=xu(e.stream,t),i=Q1({stream:n},e,t);return t.addStream(i).id}function zz(e,t){let n;e.type===Vv?(n=t.event(Vv,e.throttle),e={between:e.between,filter:e.filter}):n=t.event(Bz(e.source),e.type);const i=Q1({stream:n},e,t);return Object.keys(i).length===1?n:t.addStream(i).id}function Q1(e,t,n){let i=t.between;return i&&(i.length!==2&&S('Stream "between" parameter must have 2 entries: '+P(t)),e.between=[xu(i[0],n),xu(i[1],n)]),i=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&i.push(Uz(t.marktype,t.markname,t.markrole)),t.source===J1&&i.push("inScope(event.item)"),i.length&&(e.filter=pi("("+i.join(")&&(")+")",n).$expr),(i=t.throttle)!=null&&(e.throttle=+i),(i=t.debounce)!=null&&(e.debounce=+i),t.consume&&(e.consume=!0),e}function Uz(e,t,n){const i="event.item";return i+(e&&e!=="*"?"&&"+i+".mark.marktype==='"+e+"'":"")+(n?"&&"+i+".mark.role==='"+n+"'":"")+(t?"&&"+i+".mark.name==='"+t+"'":"")}const jz={code:"_.$value",ast:{type:"Identifier",value:"value"}};function qz(e,t,n){const i=e.encode,r={target:n};let s=e.events,a=e.update,o=[];s||S("Signal update missing events specification."),q(s)&&(s=Br(s,t.isSubscope()?J1:hg)),s=W(s).filter(u=>u.signal||u.scale?(o.push(u),0):1),o.length>1&&(o=[Gz(o)]),s.length&&o.push(s.length>1?{merge:s}:s[0]),i!=null&&(a&&S("Signal encode and update are mutually exclusive."),a="encode(item(),"+P(i)+")"),r.update=q(a)?pi(a,t):a.expr!=null?pi(a.expr,t):a.value!=null?a.value:a.signal!=null?{$expr:jz,$params:{$value:t.signalRef(a.signal)}}:S("Invalid signal update specification."),e.force&&(r.options={force:!0}),o.forEach(u=>t.addUpdate(se(Wz(u,t),r)))}function Wz(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):xu(e,t)}}function Gz(e){return{signal:"["+e.map(t=>t.scale?'scale("'+t.scale+'")':t.signal)+"]"}}function Hz(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?S("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=pi(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach(r=>qz(r,t,n.id))}const Se=e=>(t,n,i)=>Kf(e,n,t||void 0,i),T$=Se("aggregate"),Vz=Se("axisticks"),N$=Se("bound"),Wn=Se("collect"),Xv=Se("compare"),Xz=Se("datajoin"),M$=Se("encode"),Yz=Se("expression"),Kz=Se("facet"),Jz=Se("field"),Qz=Se("key"),Zz=Se("legendentries"),eU=Se("load"),tU=Se("mark"),nU=Se("multiextent"),iU=Se("multivalues"),rU=Se("overlap"),sU=Se("params"),L$=Se("prefacet"),aU=Se("projection"),oU=Se("proxy"),uU=Se("relay"),B$=Se("render"),lU=Se("scale"),zs=Se("sieve"),cU=Se("sortitems"),P$=Se("viewlayout"),fU=Se("values");let dU=0;const I$={min:"min",max:"max",count:"sum"};function hU(e,t){const n=e.type||"linear";Fw(n)||S("Unrecognized scale type: "+P(n)),t.addScale(e.name,{type:n,domain:void 0})}function pU(e,t){const n=t.getScale(e.name).params;let i;n.domain=z$(e.domain,e,t),e.range!=null&&(n.range=j$(e,t,n)),e.interpolate!=null&&wU(e.interpolate,n),e.nice!=null&&(n.nice=CU(e.nice,t)),e.bins!=null&&(n.bins=AU(e.bins,t));for(i in e)H(n,i)||i==="name"||(n[i]=cn(e[i],t))}function cn(e,t){return j(e)?e.signal?t.signalRef(e.signal):S("Unsupported object: "+P(e)):e}function cc(e,t){return e.signal?t.signalRef(e.signal):e.map(n=>cn(n,t))}function Qf(e){S("Can not find data set: "+P(e))}function z$(e,t,n){if(!e){(t.domainMin!=null||t.domainMax!=null)&&S("No scale domain defined for domainMin/domainMax to override.");return}return e.signal?n.signalRef(e.signal):(D(e)?gU:e.fields?yU:mU)(e,t,n)}function gU(e,t,n){return e.map(i=>cn(i,n))}function mU(e,t,n){const i=n.getData(e.data);return i||Qf(e.data),Fa(t.type)?i.valuesRef(n,e.field,U$(e.sort,!1)):kw(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function yU(e,t,n){const i=e.data,r=e.fields.reduce((s,a)=>(a=q(a)?{data:i,field:a}:D(a)||a.signal?bU(a,n):a,s.push(a),s),[]);return(Fa(t.type)?xU:kw(t.type)?vU:EU)(e,n,r)}function bU(e,t){const n="_:vega:_"+dU++,i=Wn({});if(D(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+P(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,zs({})]),{data:n,field:"data"}}function xU(e,t,n){const i=U$(e.sort,!0);let r,s;const a=n.map(l=>{const c=t.getData(l.data);return c||Qf(l.data),c.countsRef(t,l.field,i)}),o={groupby:dg,pulse:a};i&&(r=i.op||"count",s=i.field?Jf(r,i.field):"count",o.ops=[I$[r]],o.fields=[t.fieldRef(s)],o.as=[s]),r=t.add(T$(o));const u=t.add(Wn({pulse:Z(r)}));return s=t.add(fU({field:dg,sort:t.sortRef(i),pulse:Z(u)})),Z(s)}function U$(e,t){return e&&(!e.field&&!e.op?j(e)?e.field="key":e={field:"key"}:!e.field&&e.op!=="count"?S("No field provided for sort aggregate op: "+e.op):t&&e.field&&e.op&&!I$[e.op]&&S("Multiple domain scales can not be sorted using "+e.op)),e}function vU(e,t,n){const i=n.map(r=>{const s=t.getData(r.data);return s||Qf(r.data),s.domainRef(t,r.field)});return Z(t.add(iU({values:i})))}function EU(e,t,n){const i=n.map(r=>{const s=t.getData(r.data);return s||Qf(r.data),s.extentRef(t,r.field)});return Z(t.add(nU({extents:i})))}function AU(e,t){return e.signal||D(e)?cc(e,t):t.objectProperty(e)}function CU(e,t){return e.signal?t.signalRef(e.signal):j(e)?{interval:cn(e.interval),step:cn(e.step)}:cn(e)}function wU(e,t){t.interpolate=cn(e.type||e),e.gamma!=null&&(t.interpolateGamma=cn(e.gamma))}function j$(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(q(r)){if(i&&H(i,r))return e=se({},e,{range:i[r]}),j$(e,t,n);r==="width"?r=[0,{signal:"width"}]:r==="height"?r=Fa(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:S("Unrecognized scale range value: "+P(r))}else if(r.scheme){n.scheme=D(r.scheme)?cc(r.scheme,t):cn(r.scheme,t),r.extent&&(n.schemeExtent=cc(r.extent,t)),r.count&&(n.schemeCount=cn(r.count,t));return}else if(r.step){n.rangeStep=cn(r.step,t);return}else{if(Fa(e.type)&&!D(r))return z$(r,e,t);D(r)||S("Unsupported range type: "+P(r))}return r.map(s=>(D(s)?cc:cn)(s,t))}function FU(e,t){const n=t.config.projection||{},i={};for(const r in e)r!=="name"&&(i[r]=pg(e[r],r,t));for(const r in n)i[r]==null&&(i[r]=pg(n[r],r,t));t.addProjection(e.name,i)}function pg(e,t,n){return D(e)?e.map(i=>pg(i,t,n)):j(e)?e.signal?n.signalRef(e.signal):t==="fit"?e:S("Unsupported parameter object: "+P(e)):e}const Gn="top",io="left",ro="right",Dr="bottom",q$="center",SU="vertical",$U="start",kU="middle",DU="end",gg="index",Z1="label",OU="offset",Oa="perc",RU="perc2",dn="value",Zu="guide-label",ey="guide-title",_U="group-title",TU="group-subtitle",Yv="symbol",fc="gradient",mg="discrete",yg="size",NU="shape",MU="fill",LU="stroke",BU="strokeWidth",PU="strokeDash",IU="opacity",ty=[yg,NU,MU,LU,BU,PU,IU],el={name:1,style:1,interactive:1},fe={value:0},hn={value:1},Zf="group",W$="rect",ny="rule",zU="symbol",Us="text";function vu(e){return e.type=Zf,e.interactive=e.interactive||!1,e}function Xt(e,t){const n=(i,r)=>kn(e[i],kn(t[i],r));return n.isVertical=i=>SU===kn(e.direction,t.direction||(i?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>kn(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>kn(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>kn(e.columns,kn(t.columns,+n.isVertical(!0))),n}function G$(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function UU(e,t,n){const i=t.config.style[n];return i&&i[e]}function ed(e,t,n){return`item.anchor === '${$U}' ? ${e} : item.anchor === '${DU}' ? ${t} : ${n}`}const iy=ed(P(io),P(ro),P(q$));function jU(e){const t=e("tickBand");let n=e("tickOffset"),i,r;return t?t.signal?(i={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},r={signal:`(${t.signal}) === 'extent'`},j(n)||(n={signal:`(${t.signal}) === 'extent' ? 0 : ${n}`})):t==="extent"?(i=1,r=!0,n=0):(i=.5,r=!1):(i=e("bandPosition"),r=e("tickExtra")),{extra:r,band:i,offset:n}}function H$(e,t){return t?e?j(e)?Object.assign({},e,{offset:H$(e.offset,t)}):{value:e,offset:t}:t:e}function an(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=no(e.encode,t,el)):e.interactive=!1,e}function qU(e,t,n,i){const r=Xt(e,n),s=r.isVertical(),a=r.gradientThickness(),o=r.gradientLength();let u,l,c,f,d;s?(l=[0,1],c=[0,0],f=a,d=o):(l=[0,0],c=[1,0],f=o,d=a);const p={enter:u={opacity:fe,x:fe,y:fe,width:Ze(f),height:Ze(d)},update:se({},u,{opacity:hn,fill:{gradient:t,start:l,stop:c}}),exit:{opacity:fe}};return ht(p,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),an({type:W$,role:mz,encode:p},i)}function WU(e,t,n,i,r){const s=Xt(e,n),a=s.isVertical(),o=s.gradientThickness(),u=s.gradientLength();let l,c,f,d,p="";a?(l="y",f="y2",c="x",d="width",p="1-"):(l="x",f="x2",c="y",d="height");const h={opacity:fe,fill:{scale:t,field:dn}};h[l]={signal:p+"datum."+Oa,mult:u},h[c]=fe,h[f]={signal:p+"datum."+RU,mult:u},h[d]=Ze(o);const g={enter:h,update:se({},h,{opacity:hn}),exit:{opacity:fe}};return ht(g,{stroke:s("gradientStrokeColor"),strokeWidth:s("gradientStrokeWidth")},{opacity:s("gradientOpacity")}),an({type:W$,role:pz,key:dn,from:r,encode:g},i)}const GU=`datum.${Oa}<=0?"${io}":datum.${Oa}>=1?"${ro}":"${q$}"`,HU=`datum.${Oa}<=0?"${Dr}":datum.${Oa}>=1?"${Gn}":"${kU}"`;function Kv(e,t,n,i){const r=Xt(e,t),s=r.isVertical(),a=Ze(r.gradientThickness()),o=r.gradientLength();let u=r("labelOverlap"),l,c,f,d,p="";const h={enter:l={opacity:fe},update:c={opacity:hn,text:{field:Z1}},exit:{opacity:fe}};return ht(h,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:kn(e.labelLimit,t.gradientLabelLimit)}),s?(l.align={value:"left"},l.baseline=c.baseline={signal:HU},f="y",d="x",p="1-"):(l.align=c.align={signal:GU},l.baseline={value:"top"},f="x",d="y"),l[f]=c[f]={signal:p+"datum."+Oa,mult:o},l[d]=c[d]=a,a.offset=kn(e.labelOffset,t.gradientLabelOffset)||0,u=u?{separation:r("labelSeparation"),method:u,order:"datum."+gg}:void 0,an({type:Us,role:$$,style:Zu,key:dn,from:i,encode:h,overlap:u},n)}function VU(e,t,n,i,r){const s=Xt(e,t),a=n.entries,o=!!(a&&a.interactive),u=a?a.name:void 0,l=s("clipHeight"),c=s("symbolOffset"),f={data:"value"},d=`(${r}) ? datum.${OU} : datum.${yg}`,p=l?Ze(l):{field:yg},h=`datum.${gg}`,g=`max(1, ${r})`;let m,y,b,v,A;p.mult=.5,m={enter:y={opacity:fe,x:{signal:d,mult:.5,offset:c},y:p},update:b={opacity:hn,x:y.x,y:y.y},exit:{opacity:fe}};let E=null,C=null;e.fill||(E=t.symbolBaseFillColor,C=t.symbolBaseStrokeColor),ht(m,{fill:s("symbolFillColor",E),shape:s("symbolType"),size:s("symbolSize"),stroke:s("symbolStrokeColor",C),strokeDash:s("symbolDash"),strokeDashOffset:s("symbolDashOffset"),strokeWidth:s("symbolStrokeWidth")},{opacity:s("symbolOpacity")}),ty.forEach(L=>{e[L]&&(b[L]=y[L]={scale:e[L],field:dn})});const x=an({type:zU,role:yz,key:dn,from:f,clip:l?!0:void 0,encode:m},n.symbols),w=Ze(c);w.offset=s("labelOffset"),m={enter:y={opacity:fe,x:{signal:d,offset:w},y:p},update:b={opacity:hn,text:{field:Z1},x:y.x,y:y.y},exit:{opacity:fe}},ht(m,{align:s("labelAlign"),baseline:s("labelBaseline"),fill:s("labelColor"),fillOpacity:s("labelOpacity"),font:s("labelFont"),fontSize:s("labelFontSize"),fontStyle:s("labelFontStyle"),fontWeight:s("labelFontWeight"),limit:s("labelLimit")});const R=an({type:Us,role:$$,style:Zu,key:dn,from:f,encode:m},n.labels);return m={enter:{noBound:{value:!l},width:fe,height:l?Ze(l):fe,opacity:fe},exit:{opacity:fe},update:b={opacity:hn,row:{signal:null},column:{signal:null}}},s.isVertical(!0)?(v=`ceil(item.mark.items.length / ${g})`,b.row.signal=`${h}%${v}`,b.column.signal=`floor(${h} / ${v})`,A={field:["row",h]}):(b.row.signal=`floor(${h} / ${g})`,b.column.signal=`${h} % ${g}`,A={field:h}),b.column.signal=`(${r})?${b.column.signal}:${h}`,i={facet:{data:i,name:"value",groupby:gg}},vu({role:K1,from:i,encode:no(m,a,el),marks:[x,R],name:u,interactive:o,sort:A})}function XU(e,t){const n=Xt(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}const ry='item.orient === "left"',sy='item.orient === "right"',td=`(${ry} || ${sy})`,YU=`datum.vgrad && ${td}`,KU=ed('"top"','"bottom"','"middle"'),JU=ed('"right"','"left"','"center"'),QU=`datum.vgrad && ${sy} ? (${JU}) : (${td} && !(datum.vgrad && ${ry})) ? "left" : ${iy}`,ZU=`item._anchor || (${td} ? "middle" : "start")`,ej=`${YU} ? (${ry} ? -90 : 90) : 0`,tj=`${td} ? (datum.vgrad ? (${sy} ? "bottom" : "top") : ${KU}) : "top"`;function nj(e,t,n,i){const r=Xt(e,t),s={enter:{opacity:fe},update:{opacity:hn,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:fe}};return ht(s,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:ZU},angle:{signal:ej},align:{signal:QU},baseline:{signal:tj},text:e.title,fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),baseline:r("titleBaseline")}),an({type:Us,role:bz,style:ey,from:i,encode:s},n)}function ij(e,t){let n;return j(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+Jv(e.path)+")":e.sphere&&(n="geoShape("+Jv(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function Jv(e){return j(e)&&e.signal?e.signal:P(e)}function V$(e){const t=e.role||"";return t.startsWith("axis")||t.startsWith("legend")||t.startsWith("title")?t:e.type===Zf?K1:t||X1}function rj(e){return{marktype:e.type,name:e.name||void 0,role:e.role||V$(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function sj(e,t){return e&&e.signal?t.signalRef(e.signal):e!==!1}function ay(e,t){const n=_C(e.type);n||S("Unrecognized transform type: "+P(e.type));const i=Kf(n.type.toLowerCase(),null,X$(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function X$(e,t,n){const i={},r=e.params.length;for(let s=0;sQv(e,s,n)):Qv(e,r,n)}function Qv(e,t,n){const i=e.type;if(Ye(t))return eE(i)?S("Expression references can not be signals."):Th(i)?n.fieldRef(t):tE(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||Th(i);return r&&lj(t)?n.exprRef(t.expr,t.as):r&&cj(t)?bu(t.field,t.as):eE(i)?pi(t,n):fj(i)?Z(n.getData(t).values):Th(i)?bu(t):tE(i)?n.compareRef(t):t}}function oj(e,t,n){return q(t.from)||S('Lookup "from" parameter must be a string literal.'),n.getData(t.from).lookupRef(n,t.key)}function uj(e,t,n){const i=t[e.name];return e.array?(D(i)||S("Expected an array of sub-parameters. Instead: "+P(i)),i.map(r=>Zv(e,r,n))):Zv(e,i,n)}function Zv(e,t,n){const i=e.params.length;let r;for(let a=0;ae&&e.expr,cj=e=>e&&e.field,fj=e=>e==="data",eE=e=>e==="expr",Th=e=>e==="field",tE=e=>e==="compare";function dj(e,t,n){let i,r,s,a,o;return e?(i=e.facet)&&(t||S("Only group marks can be faceted."),i.field!=null?a=o=dc(i,n):(e.data?o=Z(n.getData(e.data).aggregate):(s=ay(se({type:"aggregate",groupby:W(i.groupby)},i.aggregate),n),s.params.key=n.keyRef(i.groupby),s.params.pulse=dc(i,n),a=o=Z(n.add(s))),r=n.keyRef(i.groupby,!0))):a=Z(n.add(Wn(null,[{}]))),a||(a=dc(e,n)),{key:r,pulse:a,parent:o}}function dc(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:Z(t.getData(e.data).output)}function As(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}As.fromEntries=function(e,t){const n=t.length,i=t[n-1],r=t[n-2];let s=t[0],a=null,o=1;for(s&&s.type==="load"&&(s=t[1]),e.add(t[0]);of??"null").join(",")+"),0)",c=pi(l,t);u.update=c.$expr,u.params=c.$params}function nd(e,t){const n=V$(e),i=e.type===Zf,r=e.from&&e.from.facet,s=e.overlap;let a=e.layout||n===K1||n===Y1,o,u,l,c,f,d,p;const h=n===X1||a||r,g=dj(e.from,i,t);u=t.add(Xz({key:g.key||(e.key?bu(e.key):void 0),pulse:g.pulse,clean:!i}));const m=Z(u);u=l=t.add(Wn({pulse:m})),u=t.add(tU({markdef:rj(e),interactive:sj(e.interactive,t),clip:ij(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:Z(u)}));const y=Z(u);u=c=t.add(M$(R$(e.encode,e.type,n,e.style,t,{mod:!1,pulse:y}))),u.params.parent=t.encode(),e.transform&&e.transform.forEach(C=>{const x=ay(C,t),w=x.metadata;(w.generates||w.changes)&&S("Mark transforms should not generate new data."),w.nomod||(c.params.mod=!0),x.params.pulse=Z(u),t.add(u=x)}),e.sort&&(u=t.add(cU({sort:t.compareRef(e.sort),pulse:Z(u)})));const b=Z(u);(r||a)&&(a=t.add(P$({layout:t.objectProperty(e.layout),legends:t.legends,mark:y,pulse:b})),d=Z(a));const v=t.add(N$({mark:y,pulse:d||b}));p=Z(v),i&&(h&&(o=t.operators,o.pop(),a&&o.pop()),t.pushState(b,d||p,m),r?hj(e,t,g):h?pj(e,t,g):t.parse(e),t.popState(),h&&(a&&o.push(a),o.push(v))),s&&(p=gj(s,p,t));const A=t.add(B$({pulse:p})),E=t.add(zs({pulse:Z(A)},void 0,t.parent()));e.name!=null&&(f=e.name,t.addData(f,new As(t,l,A,E)),e.on&&e.on.forEach(C=>{(C.insert||C.remove||C.toggle)&&S("Marks only support modify triggers."),K$(C,t,f)}))}function gj(e,t,n){const i=e.method,r=e.bound,s=e.separation,a={separation:Ye(s)?n.signalRef(s.signal):s,method:Ye(i)?n.signalRef(i.signal):i,pulse:t};if(e.order&&(a.sort=n.compareRef({field:e.order})),r){const o=r.tolerance;a.boundTolerance=Ye(o)?n.signalRef(o.signal):+o,a.boundScale=n.scaleRef(r.scale),a.boundOrient=r.orient}return Z(n.add(rU(a)))}function mj(e,t){const n=t.config.legend,i=e.encode||{},r=Xt(e,n),s=i.legend||{},a=s.name||void 0,o=s.interactive,u=s.style,l={};let c=0,f,d,p;ty.forEach(v=>e[v]?(l[v]=e[v],c=c||e[v]):0),c||S("Missing valid scale for legend.");const h=yj(e,t.scaleType(c)),g={title:e.title!=null,scales:l,type:h,vgrad:h!=="symbol"&&r.isVertical()},m=Z(t.add(Wn(null,[g]))),y={enter:{x:{value:0},y:{value:0}}},b=Z(t.add(Zz(d={type:h,scale:t.scaleRef(c),count:t.objectProperty(r("tickCount")),limit:t.property(r("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return h===fc?(p=[qU(e,c,n,i.gradient),Kv(e,n,i.labels,b)],d.count=d.count||t.signalRef(`max(2,2*floor((${cs(r.gradientLength())})/100))`)):h===mg?p=[WU(e,c,n,i.gradient,b),Kv(e,n,i.labels,b)]:(f=XU(e,n),p=[VU(e,n,i,b,cs(f.columns))],d.size=vj(e,t,p[0].marks)),p=[vu({role:gz,from:m,encode:y,marks:p,layout:f,interactive:o})],g.title&&p.push(nj(e,n,i.title,m)),nd(vu({role:hz,from:m,encode:no(xj(r,e,n),s,el),marks:p,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:a,interactive:o,style:u}),t)}function yj(e,t){let n=e.type||Yv;return!e.type&&bj(e)===1&&(e.fill||e.stroke)&&(n=x0(t)?fc:Tp(t)?mg:Yv),n!==fc?n:Tp(t)?mg:fc}function bj(e){return ty.reduce((t,n)=>t+(e[n]?1:0),0)}function xj(e,t,n){const i={enter:{},update:{}};return ht(i,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),i}function vj(e,t,n){const i=cs(iE("size",e,n)),r=cs(iE("strokeWidth",e,n)),s=cs(Ej(n[1].encode,t,Zu));return pi(`max(ceil(sqrt(${i})+${r}),${s})`,t)}function iE(e,t,n){return t[e]?`scale("${t[e]}",datum)`:G$(e,n[0].encode)}function Ej(e,t,n){return G$("fontSize",e)||UU("fontSize",t,n)}const Aj=`item.orient==="${io}"?-90:item.orient==="${ro}"?90:0`;function Cj(e,t){e=q(e)?{text:e}:e;const n=Xt(e,t.config.title),i=e.encode||{},r=i.group||{},s=r.name||void 0,a=r.interactive,o=r.style,u=[],l={},c=Z(t.add(Wn(null,[l])));return u.push(Sj(e,n,wj(e),c)),e.subtitle&&u.push($j(e,n,i.subtitle,c)),nd(vu({role:xz,from:c,encode:Fj(n,r),marks:u,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:s,interactive:a,style:o}),t)}function wj(e){const t=e.encode;return t&&t.title||se({name:e.name,interactive:e.interactive,style:e.style},t)}function Fj(e,t){const n={enter:{},update:{}};return ht(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:iy},angle:{signal:Aj},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),no(n,t,el)}function Sj(e,t,n,i){const r={value:0},s=e.text,a={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return ht(a,{text:s,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),an({type:Us,role:vz,style:_U,from:i,encode:a},n)}function $j(e,t,n,i){const r={value:0},s=e.subtitle,a={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return ht(a,{text:s,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),an({type:Us,role:Ez,style:TU,from:i,encode:a},n)}function kj(e,t){const n=[];e.transform&&e.transform.forEach(i=>{n.push(ay(i,t))}),e.on&&e.on.forEach(i=>{K$(i,t,e.name)}),t.addDataPipeline(e.name,Dj(e,t,n))}function Dj(e,t,n){const i=[];let r=null,s=!1,a=!1,o,u,l,c,f;for(e.values?Ye(e.values)||lc(e.format)?(i.push(rE(t,e)),i.push(r=Xr())):i.push(r=Xr({$ingest:e.values,$format:e.format})):e.url?lc(e.url)||lc(e.format)?(i.push(rE(t,e)),i.push(r=Xr())):i.push(r=Xr({$request:e.url,$format:e.format})):e.source&&(r=o=W(e.source).map(d=>Z(t.getData(d).output)),i.push(null)),u=0,l=n.length;ue===Dr||e===Gn,id=(e,t,n)=>Ye(e)?Tj(e.signal,t,n):e===io||e===Gn?t:n,et=(e,t,n)=>Ye(e)?Rj(e.signal,t,n):J$(e)?t:n,Nn=(e,t,n)=>Ye(e)?_j(e.signal,t,n):J$(e)?n:t,Q$=(e,t,n)=>Ye(e)?Nj(e.signal,t,n):e===Gn?{value:t}:{value:n},Oj=(e,t,n)=>Ye(e)?Mj(e.signal,t,n):e===ro?{value:t}:{value:n},Rj=(e,t,n)=>Z$(`${e} === '${Gn}' || ${e} === '${Dr}'`,t,n),_j=(e,t,n)=>Z$(`${e} !== '${Gn}' && ${e} !== '${Dr}'`,t,n),Tj=(e,t,n)=>oy(`${e} === '${io}' || ${e} === '${Gn}'`,t,n),Nj=(e,t,n)=>oy(`${e} === '${Gn}'`,t,n),Mj=(e,t,n)=>oy(`${e} === '${ro}'`,t,n),Z$=(e,t,n)=>(t=t!=null?Ze(t):t,n=n!=null?Ze(n):n,sE(t)&&sE(n)?(t=t?t.signal||P(t.value):null,n=n?n.signal||P(n.value):null,{signal:`${e} ? (${t}) : (${n})`}):[se({test:e},t)].concat(n||[])),sE=e=>e==null||Object.keys(e).length===1,oy=(e,t,n)=>({signal:`${e} ? (${da(t)}) : (${da(n)})`}),Lj=(e,t,n,i,r)=>({signal:(i!=null?`${e} === '${io}' ? (${da(i)}) : `:"")+(n!=null?`${e} === '${Dr}' ? (${da(n)}) : `:"")+(r!=null?`${e} === '${ro}' ? (${da(r)}) : `:"")+(t!=null?`${e} === '${Gn}' ? (${da(t)}) : `:"")+"(null)"}),da=e=>Ye(e)?e.signal:e==null?null:P(e),Bj=(e,t)=>t===0?0:Ye(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},ga=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function ia(e,t,n,i){let r;if(t&&H(t,e))return t[e];if(H(n,e))return n[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return i[ey][r]}else if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return i[Zu][r]}return null}function aE(e){const t={};for(const n of e)if(n)for(const i in n)t[i]=1;return Object.keys(t)}function Pj(e,t){var n=t.config,i=n.style,r=n.axis,s=t.scaleType(e.scale)==="band"&&n.axisBand,a=e.orient,o,u,l;if(Ye(a)){const f=aE([n.axisX,n.axisY]),d=aE([n.axisTop,n.axisBottom,n.axisLeft,n.axisRight]);o={};for(l of f)o[l]=et(a,ia(l,n.axisX,r,i),ia(l,n.axisY,r,i));u={};for(l of d)u[l]=Lj(a.signal,ia(l,n.axisTop,r,i),ia(l,n.axisBottom,r,i),ia(l,n.axisLeft,r,i),ia(l,n.axisRight,r,i))}else o=a===Gn||a===Dr?n.axisX:n.axisY,u=n["axis"+a[0].toUpperCase()+a.slice(1)];return o||u||s?se({},r,o,u,s):r}function Ij(e,t,n,i){const r=Xt(e,t),s=e.orient;let a,o;const u={enter:a={opacity:fe},update:o={opacity:hn},exit:{opacity:fe}};ht(u,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const l=oE(e,0),c=oE(e,1);return a.x=o.x=et(s,l,fe),a.x2=o.x2=et(s,c),a.y=o.y=Nn(s,l,fe),a.y2=o.y2=Nn(s,c),an({type:ny,role:uz,from:i,encode:u},n)}function oE(e,t){return{scale:e.scale,range:t}}function zj(e,t,n,i,r){const s=Xt(e,t),a=e.orient,o=e.gridScale,u=id(a,1,-1),l=Uj(e.offset,u);let c,f,d;const p={enter:c={opacity:fe},update:d={opacity:hn},exit:f={opacity:fe}};ht(p,{stroke:s("gridColor"),strokeCap:s("gridCap"),strokeDash:s("gridDash"),strokeDashOffset:s("gridDashOffset"),strokeOpacity:s("gridOpacity"),strokeWidth:s("gridWidth")});const h={scale:e.scale,field:dn,band:r.band,extra:r.extra,offset:r.offset,round:s("tickRound")},g=et(a,{signal:"height"},{signal:"width"}),m=o?{scale:o,range:0,mult:u,offset:l}:{value:0,offset:l},y=o?{scale:o,range:1,mult:u,offset:l}:se(g,{mult:u,offset:l});return c.x=d.x=et(a,h,m),c.y=d.y=Nn(a,h,m),c.x2=d.x2=Nn(a,y),c.y2=d.y2=et(a,y),f.x=et(a,h),f.y=Nn(a,h),an({type:ny,role:lz,key:dn,from:i,encode:p},n)}function Uj(e,t){if(t!==1)if(!j(e))e=Ye(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);else{let n=e=se({},e);for(;n.mult!=null;)if(j(n.mult))n=n.mult=se({},n.mult);else return n.mult=Ye(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n.mult=t}return e}function jj(e,t,n,i,r,s){const a=Xt(e,t),o=e.orient,u=id(o,-1,1);let l,c,f;const d={enter:l={opacity:fe},update:f={opacity:hn},exit:c={opacity:fe}};ht(d,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const p=Ze(r);p.mult=u;const h={scale:e.scale,field:dn,band:s.band,extra:s.extra,offset:s.offset,round:a("tickRound")};return f.y=l.y=et(o,fe,h),f.y2=l.y2=et(o,p),c.x=et(o,h),f.x=l.x=Nn(o,fe,h),f.x2=l.x2=Nn(o,p),c.y=Nn(o,h),an({type:ny,role:fz,key:dn,from:i,encode:d},n)}function Nh(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function qj(e,t,n,i,r,s){const a=Xt(e,t),o=e.orient,u=e.scale,l=id(o,-1,1),c=cs(a("labelFlush")),f=cs(a("labelFlushOffset")),d=a("labelAlign"),p=a("labelBaseline");let h=c===0||!!c,g;const m=Ze(r);m.mult=l,m.offset=Ze(a("labelPadding")||0),m.offset.mult=l;const y={scale:u,field:dn,band:.5,offset:H$(s.offset,a("labelOffset"))},b=et(o,h?Nh(u,c,'"left"','"right"','"center"'):{value:"center"},Oj(o,"left","right")),v=et(o,Q$(o,"bottom","top"),h?Nh(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),A=Nh(u,c,`-(${f})`,f,0);h=h&&f;const E={opacity:fe,x:et(o,y,m),y:Nn(o,y,m)},C={enter:E,update:g={opacity:hn,text:{field:Z1},x:E.x,y:E.y,align:b,baseline:v},exit:{opacity:fe,x:E.x,y:E.y}};ht(C,{dx:!d&&h?et(o,A):null,dy:!p&&h?Nn(o,A):null}),ht(C,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:d,baseline:p});const x=a("labelBound");let w=a("labelOverlap");return w=w||x?{separation:a("labelSeparation"),method:w,order:"datum.index",bound:x?{scale:u,orient:o,tolerance:x}:null}:void 0,g.align!==b&&(g.align=ga(g.align,b)),g.baseline!==v&&(g.baseline=ga(g.baseline,v)),an({type:Us,role:cz,style:Zu,key:dn,from:i,encode:C,overlap:w},n)}function Wj(e,t,n,i){const r=Xt(e,t),s=e.orient,a=id(s,-1,1);let o,u;const l={enter:o={opacity:fe,anchor:Ze(r("titleAnchor",null)),align:{signal:iy}},update:u=se({},o,{opacity:hn,text:Ze(e.title)}),exit:{opacity:fe}},c={signal:`lerp(range("${e.scale}"), ${ed(0,1,.5)})`};return u.x=et(s,c),u.y=Nn(s,c),o.angle=et(s,fe,Bj(a,90)),o.baseline=et(s,Q$(s,Dr,Gn),{value:Dr}),u.angle=o.angle,u.baseline=o.baseline,ht(l,{fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),angle:r("titleAngle"),baseline:r("titleBaseline")}),Gj(r,s,l,n),l.update.align=ga(l.update.align,o.align),l.update.angle=ga(l.update.angle,o.angle),l.update.baseline=ga(l.update.baseline,o.baseline),an({type:Us,role:dz,style:ey,from:i,encode:l},n)}function Gj(e,t,n,i){const r=(o,u)=>o!=null?(n.update[u]=ga(Ze(o),n.update[u]),!1):!oa(u,i),s=r(e("titleX"),"x"),a=r(e("titleY"),"y");n.enter.auto=a===s?Ze(a):et(t,Ze(a),Ze(s))}function Hj(e,t){const n=Pj(e,t),i=e.encode||{},r=i.axis||{},s=r.name||void 0,a=r.interactive,o=r.style,u=Xt(e,n),l=jU(u),c={scale:e.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:e.title!=null},f=Z(t.add(Wn({},[c]))),d=Z(t.add(Vz({scale:t.scaleRef(e.scale),extra:t.property(l.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),p=[];let h;return c.grid&&p.push(zj(e,n,i.grid,d,l)),c.ticks&&(h=u("tickSize"),p.push(jj(e,n,i.ticks,d,h,l))),c.labels&&(h=c.ticks?h:0,p.push(qj(e,n,i.labels,d,h,l))),c.domain&&p.push(Ij(e,n,i.domain,f)),c.title&&p.push(Wj(e,n,i.title,f)),nd(vu({role:oz,from:f,encode:no(Vj(u,e),r,el),marks:p,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:s,interactive:a,style:o}),t)}function Vj(e,t){const n={enter:{},update:{}};return ht(n,{orient:e("orient"),offset:e("offset")||0,position:kn(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function ek(e,t,n){const i=W(e.signals),r=W(e.scales);return n||i.forEach(s=>_$(s,t)),W(e.projections).forEach(s=>FU(s,t)),r.forEach(s=>hU(s,t)),W(e.data).forEach(s=>kj(s,t)),r.forEach(s=>pU(s,t)),(n||i).forEach(s=>Hz(s,t)),W(e.axes).forEach(s=>Hj(s,t)),W(e.marks).forEach(s=>nd(s,t)),W(e.legends).forEach(s=>mj(s,t)),e.title&&Cj(e.title,t),t.parseLambdas(),t}const Xj=e=>no({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function Yj(e,t){const n=t.config,i=Z(t.root=t.add(Wc())),r=Kj(e,n);r.forEach(l=>_$(l,t)),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;const s=t.add(Wn()),a=t.add(M$(R$(Xj(e.encode),Zf,Y1,e.style,t,{pulse:Z(s)}))),o=t.add(P$({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:Z(a)}));t.operators.pop(),t.pushState(Z(a),Z(o),null),ek(e,t,r),t.operators.push(o);let u=t.add(N$({mark:i,pulse:Z(o)}));return u=t.add(B$({pulse:Z(u)})),u=t.add(zs({pulse:Z(u)})),t.addData("root",new As(t,s,s,u)),t}function So(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function Kj(e,t){const n=a=>kn(e[a],t[a]),i=[So("background",n("background")),So("autosize",rz(n("autosize"))),So("padding",az(n("padding"))),So("width",n("width")||0),So("height",n("height")||0)],r=i.reduce((a,o)=>(a[o.name]=o,a),{}),s={};return W(e.signals).forEach(a=>{H(r,a.name)?a=se(r[a.name],a):i.push(a),s[a.name]=a}),W(t.signals).forEach(a=>{!H(s,a.name)&&!H(r,a.name)&&i.push(a)}),i}function tk(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function uE(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}tk.prototype=uE.prototype={parse(e){return ek(e,this)},fork(){return new uE(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach(t=>{t.$ref=e.id}),e.refs=null),e},proxy(e){const t=e instanceof fg?Z(e):e;return this.add(oU({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;this.root&&(this.root.root=!0);for(e in this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(i,r,s){let a,o;i&&(a=i.data||(i.data={}),o=a[r]||(a[r]=[]),o.push(s))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const i in t.index)n(t.index[i],e,"index:"+i)}return this},pushState(e,t,n){this._encode.push(Z(this.add(zs({pulse:e})))),this._parent.push(t),this._lookup.push(n?Z(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return ce(this._parent)},encode(){return ce(this._encode)},lookup(){return ce(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(q(e))return bu(e,t);e.signal||S("Unsupported field reference: "+P(e));const n=e.signal;let i=this.field[n];if(!i){const r={name:this.signalRef(n)};t&&(r.as=t),this.field[n]=i=Z(this.add(Jz(r)))}return i},compareRef(e){let t=!1;const n=s=>Ye(s)?(t=!0,this.signalRef(s.signal)):Lz(s)?(t=!0,this.exprRef(s.expr)):s,i=W(e.field).map(n),r=W(e.order).map(n);return t?Z(this.add(Xv({fields:i,orders:r}))):Hv(i,r)},keyRef(e,t){let n=!1;const i=s=>Ye(s)?(n=!0,Z(r[s.signal])):s,r=this.signals;return e=W(e).map(i),n?Z(this.add(Qz({fields:e,flat:t}))):_z(e,t)},sortRef(e){if(!e)return e;const t=Jf(e.op,e.field),n=e.order||Tz;return n.signal?Z(this.add(Xv({fields:t,orders:this.signalRef(n.signal)}))):Hv(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},hasOwnSignal(e){return H(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&S("Duplicate signal name: "+P(e));const n=t instanceof fg?t:this.add(Wc(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||S("Unrecognized signal name: "+P(e)),this.signals[e]},signalRef(e){return this.signals[e]?Z(this.signals[e]):(H(this.lambdas,e)||(this.lambdas[e]=this.add(Wc(null))),Z(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;t0?",":"")+(j(r)?r.signal||uy(r):P(r))}return n+"]"}function Qj(e){let t="{",n=0,i,r;for(i in e)r=e[i],t+=(++n>1?",":"")+P(i)+":"+(j(r)?r.signal||uy(r):P(r));return t+"}"}function Zj(){const e="sans-serif",i="#4c78a8",r="#000",s="#888",a="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:i},area:{fill:i},image:null,line:{stroke:i,strokeWidth:2},path:{stroke:i},rect:{fill:i},rule:{stroke:r},shape:{stroke:i},symbol:{fill:i,size:64},text:{fill:r,font:e,fontSize:11},trail:{fill:i,size:2},style:{"guide-label":{fill:r,font:e,fontSize:10},"guide-title":{fill:r,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:r,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:r,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:a},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:s,grid:!1,gridWidth:1,gridColor:a,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:s,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:a,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:s,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}function eq(e,t,n){return j(e)||S("Input Vega specification must be an object."),t=Va(Zj(),t,e.config),Yj(e,new tk(t,n)).toRuntime()}var tq="5.33.1";se(Aa,t6,j9,vL,WL,JL,wB,iB,SB,OB,zB,VB);const nq=Object.freeze(Object.defineProperty({__proto__:null,Bounds:We,CanvasHandler:Xu,CanvasRenderer:Tc,DATE:qt,DAY:bt,DAYOFYEAR:hi,Dataflow:pa,Debug:k2,DisallowedObjectProperties:nm,Error:im,EventStream:bf,Gradient:qw,GroupItem:Rf,HOURS:nn,Handler:W0,HybridHandler:NF,HybridRenderer:Wp,Info:$2,Item:Of,MILLISECONDS:Bn,MINUTES:rn,MONTH:At,Marks:sn,MultiPulse:wm,None:S2,Operator:$e,Parameters:yf,Pulse:vr,QUARTER:jt,RenderType:pr,Renderer:Vu,ResourceLoader:Kw,SECONDS:mn,SVGHandler:EF,SVGRenderer:K0,SVGStringRenderer:TF,Scenegraph:hF,TIME_UNITS:mm,Transform:F,View:x$,WEEK:Ve,Warn:rm,YEAR:ft,accessor:Vt,accessorFields:Et,accessorName:ze,array:W,ascending:Ya,bandwidthNRD:km,bin:MC,bootstrapCI:LC,boundClip:WF,boundContext:qu,boundItem:Ip,boundMark:lF,boundStroke:Vi,changeset:Bs,clampRange:I2,codegenExpression:HS,compare:lm,constant:kt,cumulativeLogNormal:Nm,cumulativeNormal:vf,cumulativeUniform:Pm,dayofyear:Y2,debounce:cm,defaultLocale:xm,definition:_C,densityLogNormal:Tm,densityNormal:Dm,densityUniform:Bm,domChild:He,domClear:ln,domCreate:dr,domFind:q0,dotbin:BC,error:S,expressionFunction:qe,extend:se,extent:di,extentIndex:z2,falsy:ir,fastmap:Ka,field:pn,flush:U2,font:Lf,fontFamily:Hu,fontSize:xi,format:Vl,formatLocale:vc,formats:Am,hasOwnProperty:H,id:Ru,identity:$t,inferType:EC,inferTypes:AC,ingest:be,inherits:z,inrange:la,interpolate:v0,interpolateColors:kf,interpolateRange:Dw,intersect:zF,intersectBoxLine:ca,intersectPath:k0,intersectPoint:D0,intersectRule:Qw,isArray:D,isBoolean:Mr,isDate:xr,isFunction:ae,isIterable:j2,isNumber:ge,isObject:j,isRegExp:fm,isString:q,isTuple:gf,key:dm,lerp:q2,lineHeight:Sr,loader:hf,locale:xC,logger:sm,lruCache:W2,markup:Y0,merge:G2,mergeConfig:Va,multiLineOffset:z0,one:Ha,pad:H2,panLinear:T2,panLog:N2,panPow:M2,panSymlog:L2,parse:eq,parseExpression:qS,parseSelector:Br,path:tm,pathCurves:F0,pathEqual:GF,pathParse:Sa,pathRectangle:Hw,pathRender:cu,pathSymbols:Gw,pathTrail:Vw,peek:ce,point:Pf,projection:u1,quantileLogNormal:Mm,quantileNormal:Ef,quantileUniform:Im,quantiles:Sm,quantizeInterpolator:Ow,quarter:B2,quartiles:$m,get random(){return yn},randomInteger:sN,randomKDE:Rm,randomLCG:rN,randomLogNormal:IC,randomMixture:zC,randomNormal:Om,randomUniform:UC,read:FC,regressionConstant:zm,regressionExp:qC,regressionLinear:Um,regressionLoess:HC,regressionLog:jC,regressionPoly:GC,regressionPow:WC,regressionQuad:jm,renderModule:If,repeat:To,resetDefaultLocale:tT,resetSVGClipId:Yw,resetSVGDefIds:a9,responseType:wC,runtimeContext:a$,sampleCurve:Cf,sampleLogNormal:_m,sampleNormal:xf,sampleUniform:Lm,scale:me,sceneEqual:J0,sceneFromJSON:fF,scenePickVisit:Fc,sceneToJSON:cF,sceneVisit:Pn,sceneZOrder:O0,scheme:E0,serializeXML:DF,setHybridRendererOptions:n9,setRandom:nN,span:_u,splitAccessPath:bi,stringValue:P,textMetrics:Zt,timeBin:dC,timeFloor:nC,timeFormatLocale:ou,timeInterval:Ja,timeOffset:sC,timeSequence:uC,timeUnitSpecifier:X2,timeUnits:ym,toBoolean:hm,toDate:pm,toNumber:xt,toSet:Ln,toString:gm,transform:TC,transforms:Aa,truncate:V2,truthy:gn,tupleid:ee,typeParsers:Op,utcFloor:iC,utcInterval:Qa,utcOffset:aC,utcSequence:lC,utcdayofyear:Q2,utcquarter:P2,utcweek:Z2,version:tq,visitArray:ar,week:K2,writeConfig:Xa,zero:cr,zoomLinear:am,zoomLog:om,zoomPow:xc,zoomSymlog:um},Symbol.toStringTag,{value:"Module"}));function iq(e,t,n){let i;t.x2&&(t.x?(n&&e.x>e.x2&&(i=e.x,e.x=e.x2,e.x2=i),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(i=e.y,e.y=e.y2,e.y2=i),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}var rq={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},sq={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},aq={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const oq=Array.prototype.slice,Yr=(e,t,n)=>{const i=n?n(t[0]):t[0];return i[e].apply(i,oq.call(t,1))},uq=(e,t,n,i,r,s,a)=>new Date(e,t||0,n??1,i||0,r||0,s||0,a||0);var lq={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:uq,date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return Yr("join",arguments)},indexof:function(){return Yr("indexOf",arguments)},lastindexof:function(){return Yr("lastIndexOf",arguments)},slice:function(){return Yr("slice",arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(Ya),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return Yr("substring",arguments,String)},split:function(){return Yr("split",arguments,String)},replace:function(){return Yr("replace",arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const cq=["view","item","group","xy","x","y"],bg=new Set([Function,eval,setTimeout,setInterval]);typeof setImmediate=="function"&&bg.add(setImmediate);const fq={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:n==="datum"?e.datum:n==="event"?e.event:n==="item"?e.item:rq[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,i=e(t.object);n&&(e.memberDepth+=1);const r=e(t.property);if(n&&(e.memberDepth-=1),bg.has(i[r])){console.error(`Prevented interpretation of member "${r}" which could lead to insecure code execution`);return}return i[r]},CallExpression:(e,t)=>{const n=t.arguments;let i=t.callee.name;return i.startsWith("_")&&(i=i.slice(1)),i==="if"?e(n[0])?e(n[1]):e(n[2]):(e.fn[i]||lq[i]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>sq[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>aq[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>t.operator==="&&"?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((n,i)=>{e.memberDepth+=1;const r=e(i.key);e.memberDepth-=1;const s=e(i.value);return nm.has(r)?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):bg.has(s)?console.error(`Prevented interpretation of method "${s}" which could lead to insecure code execution`):n[r]=s,n},{})};function $o(e,t,n,i,r,s){const a=o=>fq[o.type](a,o);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=i,a.event=r,a.item=s,cq.forEach(o=>a.fn[o]=function(){return r.vega[o](...arguments)}),a(e)}var dq={operator(e,t){const n=t.ast,i=e.functions;return r=>$o(n,i,r)},parameter(e,t){const n=t.ast,i=e.functions;return(r,s)=>$o(n,i,s,r)},event(e,t){const n=t.ast,i=e.functions;return r=>$o(n,i,void 0,void 0,r)},handler(e,t){const n=t.ast,i=e.functions;return(r,s)=>{const a=s.item&&s.item.datum;return $o(n,i,r,a,s)}},encode(e,t){const{marktype:n,channels:i}=t,r=e.functions,s=n==="group"||n==="image"||n==="rect";return(a,o)=>{const u=a.datum;let l=0,c;for(const f in i)c=$o(i[f].ast,r,o,u,void 0,a),a[f]!==c&&(a[f]=c,l=1);return n!=="rule"&&iq(a,i,s),l}}};const hq="5.23.0",pq={version:hq};function ly(e){return T(e,"or")}function cy(e){return T(e,"and")}function fy(e){return T(e,"not")}function hc(e,t){if(fy(e))hc(e.not,t);else if(cy(e))for(const n of e.and)hc(n,t);else if(ly(e))for(const n of e.or)hc(n,t);else t(e)}function ma(e,t){return fy(e)?{not:ma(e.not,t)}:cy(e)?{and:e.and.map(n=>ma(n,t))}:ly(e)?{or:e.or.map(n=>ma(n,t))}:t(e)}const ie=structuredClone;function nk(e){throw new Error(e)}function Ra(e,t){const n={};for(const i of t)H(e,i)&&(n[i]=e[i]);return n}function zt(e,t){const n={...e};for(const i of t)delete n[i];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>Fe(e)).join(",")})`};function le(e){if(ge(e))return e;const t=q(e)?e:Fe(e);if(t.length<250)return t;let n=0;for(let i=0;io===0?a:`[${a}]`),s=r.map((a,o)=>r.slice(0,o+1).join(""));for(const a of s)t.add(a)}return t}function py(e,t){return e===void 0||t===void 0?!0:hy(vg(e),vg(t))}function we(e){return _(e).length===0}const _=Object.keys,dt=Object.values,Or=Object.entries;function Eu(e){return e===!0||e===!1}function Ne(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function nu(e,t){return fy(e)?`!(${nu(e.not,t)})`:cy(e)?`(${e.and.map(n=>nu(n,t)).join(") && (")})`:ly(e)?`(${e.or.map(n=>nu(n,t)).join(") || (")})`:t(e)}function Gc(e,t){if(t.length===0)return!0;const n=t.shift();return n in e&&Gc(e[n],t)&&delete e[n],we(e)}function tl(e){return e.charAt(0).toUpperCase()+e.substr(1)}function gy(e,t="datum"){const n=bi(e),i=[];for(let r=1;r<=n.length;r++){const s=`[${n.slice(0,r).map(P).join("][")}]`;i.push(`${t}${s}`)}return i.join(" && ")}function sk(e,t="datum"){return`${t}[${P(bi(e).join("."))}]`}function xe(e){return`datum['${e.replaceAll("'","\\'")}']`}function yq(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function bn(e){return`${bi(e).map(yq).join("\\.")}`}function Cs(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function so(e){return`${bi(e).join(".")}`}function Ta(e){return e?bi(e).length:0}function Ue(...e){return e.find(t=>t!==void 0)}let ak=42;function ok(e){const t=++ak;return e?String(e)+t:t}function bq(){ak=42}function uk(e){return lk(e)?e:`__${e}`}function lk(e){return e.startsWith("__")}function Au(e){if(e!==void 0)return(e%360+360)%360}function rd(e){return ge(e)?!0:!isNaN(e)&&!isNaN(parseFloat(e))}const lE=Object.getPrototypeOf(structuredClone({}));function Jt(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor.name!==t.constructor.name)return!1;let n,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(i=n;i--!==0;)if(!Jt(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const s of e.entries())if(!t.has(s[0]))return!1;for(const s of e.entries())if(!Jt(s[1],t.get(s[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e.entries())if(!t.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(i=n;i--!==0;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==lE.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==lE.toString)return e.toString()===t.toString();const r=Object.keys(e);if(n=r.length,n!==Object.keys(t).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(i=n;i--!==0;){const s=r[i];if(!Jt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Fe(e){const t=[];return(function n(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i===void 0)return;if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);let r,s;if(Array.isArray(i)){for(s="[",r=0;rdd(e[t])?Ne(`_${t}_${Or(e[t])}`):Ne(`_${t}_${e[t]}`)).join("")}function De(e){return e===!0||Ws(e)&&!e.binned}function st(e){return e==="binned"||Ws(e)&&e.binned===!0}function Ws(e){return j(e)}function dd(e){return T(e,"param")}function cE(e){switch(e){case Pi:case Ii:case Ji:case Wt:case Ci:case wi:case jr:case Qi:case zr:case Ur:case Gt:return 6;case qr:return 4;default:return 10}}function sl(e){return T(e,"expr")}function at(e,{level:t}={level:0}){const n=_(e||{}),i={};for(const r of n)i[r]=t===0?Kt(e[r]):at(e[r],{level:t-1});return i}function Ck(e){const{anchor:t,frame:n,offset:i,orient:r,angle:s,limit:a,color:o,subtitleColor:u,subtitleFont:l,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:p,subtitlePadding:h,...g}=e,m={...g,...o?{fill:o}:{}},y={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{},...s!==void 0?{angle:s}:{},...a!==void 0?{limit:a}:{}},b={...u?{subtitleColor:u}:{},...l?{subtitleFont:l}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...p?{subtitleLineHeight:p}:{},...h?{subtitlePadding:h}:{}},v=Ra(e,["align","baseline","dx","dy","limit"]);return{titleMarkConfig:m,subtitleMarkConfig:v,nonMarkTitleProperties:y,subtitle:b}}function lr(e){return q(e)||D(e)&&q(e[0])}function Q(e){return T(e,"signal")}function Gs(e){return T(e,"step")}function qq(e){return D(e)?!1:T(e,"fields")&&!T(e,"data")}function Wq(e){return D(e)?!1:T(e,"fields")&&T(e,"data")}function Bi(e){return D(e)?!1:T(e,"field")&&T(e,"data")}const Gq={aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1},Hq=_(Gq),Vq={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},Eg=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function wk(e){const t=D(e.condition)?e.condition.map(fE):fE(e.condition);return{...Kt(e),condition:t}}function Kt(e){if(sl(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function fE(e){if(sl(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function Re(e){if(sl(e)){const{expr:t,...n}=e;return{signal:t,...n}}return Q(e)?e:e!==void 0?{value:e}:void 0}function Xq(e){return Q(e)?e.signal:P(e)}function dE(e){return Q(e)?e.signal:P(e.value)}function _n(e){return Q(e)?e.signal:e==null?null:P(e)}function Yq(e,t,n){for(const i of n){const r=gi(i,t.markDef,t.config);r!==void 0&&(e[i]=Re(r))}return e}function Fk(e){return[].concat(e.type,e.style??[])}function Ce(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:s}=i;return r&&T(t,r)?t[r]:t[e]!==void 0?t[e]:s&&(!r||r===e)?void 0:gi(e,t,n,i)}function gi(e,t,n,{vgChannel:i}={}){const r=Ag(e,t,n.style);return Ue(i?r:void 0,r,i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function Ag(e,t,n){return Sk(e,Fk(t),n)}function Sk(e,t,n){t=W(t);let i;for(const r of t){const s=n[r];T(s,e)&&(i=s[e])}return i}function $k(e,t){return W(e).reduce((n,i)=>(n.field.push(U(i,t)),n.order.push(i.sort??"ascending"),n),{field:[],order:[]})}function kk(e,t){const n=[...e];return t.forEach(i=>{for(const r of n)if(Jt(r,i))return;n.push(i)}),n}function Dk(e,t){return Jt(e,t)||!t?e:e?[...W(e),...W(t)].join(", "):t}function Ok(e,t){const n=e.value,i=t.value;if(n==null||i===null)return{explicit:e.explicit,value:null};if((lr(n)||Q(n))&&(lr(i)||Q(i)))return{explicit:e.explicit,value:Dk(n,i)};if(lr(n)||Q(n))return{explicit:e.explicit,value:n};if(lr(i)||Q(i))return{explicit:e.explicit,value:i};if(!lr(n)&&!Q(n)&&!lr(i)&&!Q(i))return{explicit:e.explicit,value:kk(n,i)};throw new Error("It should never reach here")}function Fy(e){return`Invalid specification ${Fe(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const Kq='Autosize "fit" only works for single views and layered views.';function hE(e){return`${e=="width"?"Width":"Height"} "container" only works for single views and layered views.`}function pE(e){const t=e=="width"?"Width":"Height",n=e=="width"?"x":"y";return`${t} "container" only works well with autosize "fit" or "fit-${n}".`}function gE(e){return e?`Dropping "fit-${e}" because spec has discrete ${Ht(e)}.`:'Dropping "fit" because spec has discrete size.'}function Sy(e){return`Unknown field for ${e}. Cannot calculate view size.`}function mE(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function Jq(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function Qq(e){return`The "nearest" transform is not supported for ${e} marks.`}function Rk(e){return`Selection not supported for ${e} yet.`}function Zq(e){return`Cannot find a selection named "${e}".`}const eW="Scale bindings are currently only supported for scales with unbinned, continuous domains.",tW="Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc",nW="Legend bindings are only supported for selections over an individual field or encoding channel.";function iW(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}function rW(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}const sW="The same selection must be used to override scale domains in a layered view.",aW='Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.';function oW(e){return`Unknown repeated value "${e}".`}function yE(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const uW="Multiple timer selections in one unit spec are not supported. Ignoring all but the first.",$y="Animation involving facet, layer, or concat is currently unsupported.";function lW(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${P(e)}.`}function cW(e,t,n,i){return(e.length?"Multiple ":"No ")+`matching ${P(t)} encoding found for selection ${P(n.param)}. Using "field": ${P(i)}.`}const fW="Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).";function dW(e){return`Unrecognized parse "${e}".`}function bE(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}const hW="Attempt to add the same child twice.";function pW(e){return`Ignoring an invalid transform: ${Fe(e)}.`}const gW='If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.';function xE(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function mW(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${Fe(t)} is overridden by a child projection ${Fe(n)}.`}const yW="Arc marks uses theta channel rather than angle, replacing angle with theta.";function bW(e){return`${e}Offset dropped because ${e} is continuous`}function xW(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${Fe(n)}}.`}function _k(e){return`Invalid field type "${e}".`}function vW(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function EW(e){return`Invalid aggregation operator "${e}".`}function Tk(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function AW(e){return`Position range does not support relative band size for ${e}.`}function Cg(e,t){return`Dropping ${Fe(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}const CW="Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.";function hd(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function wW(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function FW(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function SW(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function $W(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`}function Bh(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t==="ordinal"?"order":"magnitude"}.`}function kW(e){return`The ${e} for range marks cannot be an expression`}function DW(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`}function OW(e,t){return`Specified orient "${e}" overridden with "${t}".`}function RW(e){return`Cannot use the scale property "${e}" with non-color channel.`}function _W(e){return`Cannot use the relative band size with ${e} scale.`}function TW(e){return`Using unaggregated domain with raw field has no effect (${Fe(e)}).`}function NW(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function MW(e){return`Unaggregated domain is currently unsupported for log scale (${Fe(e)}).`}function LW(e){return`Cannot apply size to non-oriented mark "${e}".`}function BW(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function PW(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function Nk(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function Mk(e){return`The step for "${e}" is dropped because the ${e==="width"?"x":"y"} is continuous.`}function IW(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${Fe(n)} and ${Fe(i)}). Using ${Fe(n)}.`}function zW(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${Fe(n)} and ${Fe(i)}). Using the union of the two domains.`}function UW(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function jW(e){return`Dropping sort property ${Fe(e)} as unioned domains only support boolean or op "count", "min", and "max".`}const vE="Domains that should be unioned has conflicting sort properties. Sort will be set to true.",qW="Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.",WW="Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.",GW="Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.";function HW(e){return`Cannot stack "${e}" if there is already "${e}2".`}function VW(e){return`Stack is applied to a non-linear scale (${e}).`}function XW(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function Hc(e,t){return`Invalid ${e}: ${Fe(t)}.`}function YW(e){return`Dropping day from datetime ${Fe(e)} as day cannot be combined with other units.`}function KW(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}function JW(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function QW(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function EE(e){return`1D error band does not support ${e}.`}function Lk(e){return`Channel ${e} is required for "binned" bin.`}function ZW(e){return`Channel ${e} should not be used with "binned" bin.`}function eG(e){return`Domain for ${e} is required for threshold scale.`}const Bk=sm(rm);let Fs=Bk;function tG(e){return Fs=e,Fs}function nG(){return Fs=Bk,Fs}function ky(...e){Fs.error(...e)}function M(...e){Fs.warn(...e)}function iG(...e){Fs.debug(...e)}function Hs(e){if(e&&j(e)){for(const t of Oy)if(T(e,t))return!0}return!1}const Pk=["january","february","march","april","may","june","july","august","september","october","november","december"],rG=Pk.map(e=>e.substr(0,3)),Ik=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],sG=Ik.map(e=>e.substr(0,3));function aG(e){if(rd(e)&&(e=+e),ge(e))return e>4&&M(Hc("quarter",e)),e-1;throw new Error(Hc("quarter",e))}function oG(e){if(rd(e)&&(e=+e),ge(e))return e-1;{const t=e.toLowerCase(),n=Pk.indexOf(t);if(n!==-1)return n;const i=t.substr(0,3),r=rG.indexOf(i);if(r!==-1)return r;throw new Error(Hc("month",e))}}function uG(e){if(rd(e)&&(e=+e),ge(e))return e%7;{const t=e.toLowerCase(),n=Ik.indexOf(t);if(n!==-1)return n;const i=t.substr(0,3),r=sG.indexOf(i);if(r!==-1)return r;throw new Error(Hc("day",e))}}function Dy(e,t){const n=[];if(t&&e.day!==void 0&&_(e).length>1&&(M(YW(e)),e=ie(e),delete e.day),e.year!==void 0?n.push(e.year):n.push(2012),e.month!==void 0){const i=t?oG(e.month):e.month;n.push(i)}else if(e.quarter!==void 0){const i=t?aG(e.quarter):e.quarter;n.push(ge(i)?i*3:`${i}*3`)}else n.push(0);if(e.date!==void 0)n.push(e.date);else if(e.day!==void 0){const i=t?uG(e.day):e.day;n.push(ge(i)?i+1:`${i}+1`)}else n.push(1);for(const i of["hours","minutes","seconds","milliseconds"]){const r=e[i];n.push(typeof r>"u"?0:r)}return n}function Ss(e){const n=Dy(e,!0).join(", ");return e.utc?`utc(${n})`:`datetime(${n})`}function lG(e){const n=Dy(e,!1).join(", ");return e.utc?`utc(${n})`:`datetime(${n})`}function cG(e){const t=Dy(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}const zk={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Oy=_(zk);function fG(e){return H(zk,e)}function Vs(e){return j(e)?e.binned:Uk(e)}function Uk(e){return e&&e.startsWith("binned")}function Ry(e){return e.startsWith("utc")}function dG(e){return e.substring(3)}const hG={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function pd(e){return Oy.filter(t=>qk(e,t))}function jk(e){const t=pd(e);return t[t.length-1]}function qk(e,t){const n=e.indexOf(t);return!(n<0||n>0&&t==="seconds"&&e.charAt(n-1)==="i"||e.length>n+3&&t==="day"&&e.charAt(n+3)==="o"||n>0&&t==="year"&&e.charAt(n-1)==="f")}function pG(e,t,{end:n}={end:!1}){const i=gy(t),r=Ry(e)?"utc":"";function s(u){return u==="quarter"?`(${r}quarter(${i})-1)`:`${r}${u}(${i})`}let a;const o={};for(const u of Oy)qk(e,u)&&(o[u]=s(u),a=u);return n&&(o[a]+="+1"),lG(o)}function Wk(e){if(!e)return;const t=pd(e);return`timeUnitSpecifier(${Fe(t)}, ${Fe(hG)})`}function gG(e,t,n){if(!e)return;const i=Wk(e);return`${n||Ry(e)?"utc":"time"}Format(${t}, ${i})`}function nt(e){if(!e)return;let t;return q(e)?Uk(e)?t={unit:e.substring(6),binned:!0}:t={unit:e}:j(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),Ry(t.unit)&&(t.utc=!0,t.unit=dG(t.unit)),t}function mG(e){const{utc:t,...n}=nt(e);return n.unit?(t?"utc":"")+_(n).map(i=>Ne(`${i==="unit"?"":`_${i}_`}${n[i]}`)).join(""):(t?"utc":"")+"timeunit"+_(n).map(i=>Ne(`_${i}_${n[i]}`)).join("")}function Gk(e,t=n=>n){const n=nt(e),i=jk(n.unit);if(i&&i!=="day"){const r={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:s,part:a}=Hk(i,n.step),o={...r,[a]:+r[a]+s};return`${t(Ss(o))} - ${t(Ss(r))}`}}const yG={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function bG(e){return H(yG,e)}function Hk(e,t=1){if(bG(e))return{part:e,step:t};switch(e){case"day":case"dayofyear":return{part:"date",step:t};case"quarter":return{part:"month",step:t*3};case"week":return{part:"date",step:t*7}}}function xG(e){return T(e,"param")}function _y(e){return!!e?.field&&e.equal!==void 0}function Ty(e){return!!e?.field&&e.lt!==void 0}function Ny(e){return!!e?.field&&e.lte!==void 0}function My(e){return!!e?.field&&e.gt!==void 0}function Ly(e){return!!e?.field&&e.gte!==void 0}function By(e){if(e?.field){if(D(e.range)&&e.range.length===2)return!0;if(Q(e.range))return!0}return!1}function Py(e){return!!e?.field&&(D(e.oneOf)||D(e.in))}function vG(e){return!!e?.field&&e.valid!==void 0}function Vk(e){return Py(e)||_y(e)||By(e)||Ty(e)||My(e)||Ny(e)||Ly(e)}function ei(e,t){return wd(e,{timeUnit:t,wrapTime:!0})}function EG(e,t){return e.map(n=>ei(n,t))}function Xk(e,t=!0){const{field:n}=e,i=nt(e.timeUnit),{unit:r,binned:s}=i||{},a=U(e,{expr:"datum"}),o=r?`time(${s?a:pG(r,n)})`:a;if(_y(e))return`${o}===${ei(e.equal,r)}`;if(Ty(e)){const u=e.lt;return`${o}<${ei(u,r)}`}else if(My(e)){const u=e.gt;return`${o}>${ei(u,r)}`}else if(Ny(e)){const u=e.lte;return`${o}<=${ei(u,r)}`}else if(Ly(e)){const u=e.gte;return`${o}>=${ei(u,r)}`}else{if(Py(e))return`indexof([${EG(e.oneOf,r).join(",")}], ${o}) !== -1`;if(vG(e))return gd(o,e.valid);if(By(e)){const{range:u}=at(e),l=Q(u)?{signal:`${u.signal}[0]`}:u[0],c=Q(u)?{signal:`${u.signal}[1]`}:u[1];if(l!==null&&c!==null&&t)return"inrange("+o+", ["+ei(l,r)+", "+ei(c,r)+"])";const f=[];return l!==null&&f.push(`${o} >= ${ei(l,r)}`),c!==null&&f.push(`${o} <= ${ei(c,r)}`),f.length>0?f.join(" && "):"true"}}throw new Error(`Invalid field predicate: ${Fe(e)}`)}function gd(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function AG(e){return Vk(e)&&e.timeUnit?{...e,timeUnit:nt(e.timeUnit)}:e}const al={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function CG(e){return e==="quantitative"||e==="temporal"}function Yk(e){return e==="ordinal"||e==="nominal"}const $s=al.quantitative,Iy=al.ordinal,Ma=al.temporal,zy=al.nominal,oo=al.geojson;function wG(e){if(e)switch(e=e.toLowerCase(),e){case"q":case $s:return"quantitative";case"t":case Ma:return"temporal";case"o":case Iy:return"ordinal";case"n":case zy:return"nominal";case oo:return"geojson"}}const ot={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",TIME:"time",UTC:"utc",POINT:"point",BAND:"band"},wg={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function FG(e,t){const n=wg[e],i=wg[t];return n===i||n==="ordinal-position"&&i==="time"||i==="ordinal-position"&&n==="time"}const SG={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function AE(e){return SG[e]}const Kk=new Set(["linear","log","pow","sqrt","symlog"]),Jk=new Set([...Kk,"time","utc"]);function Qk(e){return Kk.has(e)}const Zk=new Set(["quantile","quantize","threshold"]),$G=new Set([...Jk,...Zk,"sequential","identity"]),kG=new Set(["ordinal","bin-ordinal","point","band"]);function it(e){return kG.has(e)}function In(e){return $G.has(e)}function oi(e){return Jk.has(e)}function La(e){return Zk.has(e)}const DG={pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5};function OG(e){return!q(e)&&T(e,"name")}function eD(e){return T(e,"param")}function RG(e){return T(e,"unionWith")}function _G(e){return j(e)&&"field"in e}const TG={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},{type:Nte,domain:Mte,range:Lte,rangeMax:Bte,rangeMin:Pte,scheme:Ite,...NG}=TG,MG=_(NG);function Fg(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return oi(e)||e==="band"||e==="point";case"padding":case"rangeMin":case"rangeMax":return oi(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return e==="band";case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return oi(e);case"nice":return oi(e)||e==="quantize"||e==="threshold";case"exponent":return e==="pow";case"base":return e==="log";case"constant":return e==="symlog";case"zero":return In(e)&&!ue(["log","time","utc","threshold","quantile"],e)}}function tD(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return ya(e)?void 0:RW(t);case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}function LG(e,t){return ue([Iy,zy],t)?e===void 0||it(e):t===Ma?ue([ot.TIME,ot.UTC,void 0],e):t===$s?Qk(e)||La(e)||e===void 0:!0}function BG(e,t,n=!1){if(!Si(e))return!1;switch(e){case Me:case rt:case Pr:case ao:case En:case Vn:return oi(t)||t==="band"?!0:t==="point"?!n:!1;case Ir:return ue(["linear","band"],t);case Ji:case jr:case Qi:case zr:case Ur:case js:return oi(t)||La(t)||ue(["band","point","ordinal"],t);case Wt:case Ci:case wi:return t!=="band";case qr:case Gt:return t==="ordinal"||La(t)}}function PG(e){return j(e)&&"value"in e}const Mt={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},nD=Mt.arc,md=Mt.area,yd=Mt.bar,IG=Mt.image,bd=Mt.line,xd=Mt.point,zG=Mt.rect,Vc=Mt.rule,iD=Mt.text,Uy=Mt.tick,UG=Mt.trail,jy=Mt.circle,qy=Mt.square,rD=Mt.geoshape;function Gr(e){return["line","area","trail"].includes(e)}function Cu(e){return["rect","bar","image","arc","tick"].includes(e)}const jG=new Set(_(Mt));function mi(e){return T(e,"type")}const qG=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit"],WG=["fill","fillOpacity"],GG=[...qG,...WG],HG={color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1},CE=_(HG),Ph=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],VG={area:["line","point"],bar:Ph,rect:Ph,line:["point"],tick:["bandSize","thickness",...Ph]},XG={color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},YG={mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1},sD=_(YG);function ks(e){return T(e,"band")}const KG={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},JG=5,Wy={binSpacing:0,continuousBandSize:JG,minBandSize:.25,timeUnitBandPosition:.5},QG={...Wy,binSpacing:1},ZG={...Wy,thickness:1};function eH(e){return mi(e)?e.type:e}function aD(e,{isPath:t}){return e===void 0||e==="break-paths-show-path-domains"?t?"break-paths-show-domains":"filter":e===null?"show":e}function Gy({markDef:e,config:t,scaleChannel:n,scaleType:i,isCountAggregate:r}){if(!i||!In(i)||r)return"always-valid";const s=aD(Ce("invalid",e,t),{isPath:Gr(e.type)});return t.scale?.invalid?.[n]!==void 0?"show":s}function tH(e){return e==="break-paths-filter-domains"||e==="break-paths-show-domains"}function oD({scaleName:e,scale:t,mode:n}){const i=`domain('${e}')`;if(!t||!e)return;const r=`${i}[0]`,s=`peek(${i})`,a=t.domainHasZero();return a==="definitely"?{scale:e,value:0}:a==="maybe"?{signal:`scale('${e}', inrange(0, ${i}) ? 0 : ${n==="zeroOrMin"?r:s})`}:{signal:`scale('${e}', ${n==="zeroOrMin"?r:s})`}}function uD({scaleChannel:e,channelDef:t,scale:n,scaleName:i,markDef:r,config:s}){const a=n?.get("type"),o=Un(t),u=fd(o?.aggregate),l=Gy({scaleChannel:e,markDef:r,config:s,scaleType:a,isCountAggregate:u});if(o&&l==="show"){const c=s.scale.invalid?.[e]??"zero-or-min";return{test:gd(U(o,{expr:"datum"}),!1),...nH(c,n,i)}}}function nH(e,t,n){if(PG(e)){const{value:i}=e;return Q(i)?{signal:i.signal}:{value:i}}return oD({scale:t,scaleName:n,mode:"zeroOrMin"})}function Hy(e){const{channel:t,channelDef:n,markDef:i,scale:r,scaleName:s,config:a}=e,o=qs(t),u=Vy(e),l=uD({scaleChannel:o,channelDef:n,scale:r,scaleName:s,markDef:i,config:a});return l!==void 0?[l,u]:u}function iH(e){const{datum:t}=e;return Hs(t)?Ss(t):`${Fe(t)}`}function fs(e,t,n,i){const r={};if(t&&(r.scale=t),$i(e)){const{datum:s}=e;Hs(s)?r.signal=Ss(s):Q(s)?r.signal=s.signal:sl(s)?r.signal=s.expr:r.value=s}else r.field=U(e,n);if(i){const{offset:s,band:a}=i;s&&(r.offset=s),a&&(r.band=a)}return r}function Xc({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,endSuffix:s="end",bandPosition:a=.5}){const o=!Q(a)&&0{switch(t.fieldTitle){case"plain":return e.field;case"functional":return bH(e);default:return yH(e,t)}};let ED=vD;function AD(e){ED=e}function xH(){AD(vD)}function ba(e,t,{allowDisabling:n,includeDefault:i=!0}){const r=Jy(e)?.title;if(!B(e))return r??e.title;const s=e,a=i?Qy(s,t):void 0;return n?Ue(r,s.title,a):r??s.title??a}function Jy(e){if(Pa(e)&&e.axis)return e.axis;if(bD(e)&&e.legend)return e.legend;if(Yy(e)&&e.header)return e.header}function Qy(e,t){return ED(e,t)}function Jc(e){if(xD(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}else{const t=Jy(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function vH(e,t){switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(Ky(e)&&D(e.sort))return"ordinal";const{aggregate:n,bin:i,timeUnit:r}=e;if(r)return"temporal";if(i||n&&!Wr(n)&&!Wi(n))return"quantitative";if(Xs(e)&&e.scale?.type)switch(wg[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}function Un(e){if(B(e))return e;if(Ad(e))return e.condition}function Xe(e){if(re(e))return e;if(cl(e))return e.condition}function CD(e,t,n,i={}){if(q(e)||ge(e)||Mr(e)){const r=q(e)?"string":ge(e)?"number":"boolean";return M(xW(t,r,e)),{value:e}}return re(e)?Qc(e,t,n,i):cl(e)?{...e,condition:Qc(e.condition,t,n,i)}:e}function Qc(e,t,n,i){if(xD(e)){const{format:r,formatType:s,...a}=e;if(Ds(s)&&!n.customFormatTypes)return M(xE(t)),Qc(a,t,n,i)}else{const r=Pa(e)?"axis":bD(e)?"legend":Yy(e)?"header":null;if(r&&e[r]){const{format:s,formatType:a,...o}=e[r];if(Ds(a)&&!n.customFormatTypes)return M(xE(t)),Qc({...e,[r]:o},t,n,i)}}return B(e)?Zy(e,t,i):EH(e)}function EH(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=ge(n)?"quantitative":q(n)?"nominal":Hs(n)?"temporal":void 0,{...e,type:t}}function Zy(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:s,field:a}=e,o={...e};if(!n&&i&&!wy(i)&&!Wr(i)&&!Wi(i)&&(M(EW(i)),delete o.aggregate),r&&(o.timeUnit=nt(r)),a&&(o.field=`${a}`),De(s)&&(o.bin=Cd(s,t)),st(s)&&!je(t)&&M(ZW(t)),Nt(o)){const{type:u}=o,l=wG(u);u!==l&&(o.type=l),u!=="quantitative"&&fd(i)&&(M(vW(u,i)),o.type="quantitative")}else if(!mk(t)){const u=vH(o,t);o.type=u}if(Nt(o)){const{compatible:u,warning:l}=AH(o,t)||{};u===!1&&M(l)}if(Ky(o)&&q(o.sort)){const{sort:u}=o;if(FE(u))return{...o,sort:{encoding:u}};const l=u.substring(1);if(u.charAt(0)==="-"&&FE(l))return{...o,sort:{encoding:l,order:"descending"}}}if(Yy(o)){const{header:u}=o;if(u){const{orient:l,...c}=u;if(l)return{...o,header:{...c,labelOrient:u.labelOrient||l,titleOrient:u.titleOrient||l}}}}return o}function Cd(e,t){return Mr(e)?{maxbins:cE(t)}:e==="binned"?{binned:!0}:!e.maxbins&&!e.step?{...e,maxbins:cE(t)}:e}const ra={compatible:!0};function AH(e,t){const n=e.type;if(n==="geojson"&&t!=="shape")return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case Pi:case Ii:case sd:return Kc(e)?ra:{compatible:!1,warning:FW(t)};case Me:case rt:case Pr:case ao:case Wt:case Ci:case wi:case nl:case il:case ad:case ws:case od:case ud:case js:case En:case Vn:case ld:return ra;case Yn:case xn:case Xn:case Kn:return n!==$s?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:ra;case Qi:case zr:case Ur:case jr:case Ji:case Ki:case Yi:case Hn:case Ai:case Ir:return n==="nominal"&&!e.sort?{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`}:ra;case Gt:case qr:return!Kc(e)&&!gH(e)?{compatible:!1,warning:SW(t)}:ra;case Na:return e.type==="nominal"&&!("sort"in e)?{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}:ra}}function Ia(e){const{formatType:t}=Jc(e);return t==="time"||!t&&CH(e)}function CH(e){return e&&(e.type==="temporal"||B(e)&&!!e.timeUnit)}function wd(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){const s=t&&nt(t)?.unit;let a=s||n==="temporal",o;return sl(e)?o=e.expr:Q(e)?o=e.signal:Hs(e)?(a=!0,o=Ss(e)):(q(e)||ge(e))&&a&&(o=`datetime(${Fe(e)})`,fG(s)&&(ge(e)&&e<1e4||q(e)&&isNaN(Date.parse(e)))&&(o=Ss({[s]:e}))),o?i&&a?`time(${o})`:o:r?void 0:Fe(e)}function wD(e,t){const{type:n}=e;return t.map(i=>{const r=B(e)&&!Vs(e.timeUnit)?e.timeUnit:void 0,s=wd(i,{timeUnit:r,type:n,undefinedIfExprNotRequired:!0});return s!==void 0?{signal:s}:i})}function fl(e,t){return De(e.bin)?Si(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const kE={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function dl(e){return e?.condition}const FD=["domain","grid","labels","ticks","title"],wH={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},SD={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},FH={...SD,style:1,labelExpr:1,encoding:1};function DE(e){return H(FH,e)}const SH={axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1},$D=_(SH);function er(e){return T(e,"mark")}class Fd{constructor(t,n){this.name=t,this.run=n}hasMatchingType(t){return er(t)?eH(t.mark)===this.name:!1}}function ds(e,t){const n=e&&e[t];return n?D(n)?_a(n,i=>!!i.field):B(n)||Ad(n):!1}function kD(e,t){const n=e&&e[t];return n?D(n)?_a(n,i=>!!i.field):B(n)||$i(n)||cl(n):!1}function DD(e,t){if(je(t)){const n=e[t];if((B(n)||$i(n))&&(Yk(n.type)||B(n)&&n.timeUnit)){const i=xy(t);return kD(e,i)}}return!1}function OD(e){return _a(Eq,t=>{if(ds(e,t)){const n=e[t];if(D(n))return _a(n,i=>!!i.aggregate);{const i=Un(n);return i&&!!i.aggregate}}return!1})}function RD(e,t){const n=[],i=[],r=[],s=[],a={};return eb(e,(o,u)=>{if(B(o)){const{field:l,aggregate:c,bin:f,timeUnit:d,...p}=o;if(c||d||f){const g=Jy(o)?.title;let m=U(o,{forAs:!0});const y={...g?[]:{title:ba(o,t,{allowDisabling:!0})},...p,field:m};if(c){let b;if(Wr(c)?(b="argmax",m=U({op:"argmax",field:c.argmax},{forAs:!0}),y.field=`${m}.${l}`):Wi(c)?(b="argmin",m=U({op:"argmin",field:c.argmin},{forAs:!0}),y.field=`${m}.${l}`):c!=="boxplot"&&c!=="errorbar"&&c!=="errorband"&&(b=c),b){const v={op:b,as:m};l&&(v.field=l),s.push(v)}}else if(n.push(m),Nt(o)&&De(f)){if(i.push({bin:f,field:l,as:m}),n.push(U(o,{binSuffix:"end"})),fl(o,u)&&n.push(U(o,{binSuffix:"range"})),je(u)){const b={field:`${m}_end`};a[`${u}2`]=b}y.bin="binned",mk(u)||(y.type=$s)}else if(d&&!Vs(d)){r.push({timeUnit:d,field:l,as:m});const b=Nt(o)&&o.type!==Ma&&"time";b&&(u===nl||u===ws?y.formatType=b:_q(u)?y.legend={formatType:b,...y.legend}:je(u)&&(y.axis={formatType:b,...y.axis}))}a[u]=y}else n.push(l),a[u]=e[u]}else a[u]=e[u]}),{bins:i,timeUnits:r,aggregate:s,groupby:n,encoding:a}}function $H(e,t,n){const i=Nq(t,n);if(i){if(i==="binned"){const r=e[t===Hn?Me:rt];return!!(B(r)&&B(e[t])&&st(r.bin))}}else return!1;return!0}function kH(e,t,n,i){const r={};for(const s of _(e))gk(s)||M(wW(s));for(let s of $q){if(!e[s])continue;const a=e[s];if(rl(s)){const o=Sq(s),u=r[o];if(B(u)&&CG(u.type)&&B(a)&&!u.timeUnit){M(bW(o));continue}}if(s==="angle"&&t==="arc"&&!e.theta&&(M(yW),s=En),!$H(e,s,t)){M(hd(s,t));continue}if(s===Ji&&t==="line"&&Un(e[s])?.aggregate){M(CW);continue}if(s===Wt&&(n?"fill"in e:"stroke"in e)){M(Tk("encoding",{fill:"fill"in e,stroke:"stroke"in e}));continue}if(s===il||s===Na&&!D(a)&&!zn(a)||s===ws&&D(a)){if(a){if(s===Na){const o=e[s];if(yD(o)){r[s]=o;continue}}r[s]=W(a).reduce((o,u)=>(B(u)?o.push(Zy(u,s)):M(Cg(u,s)),o),[])}}else{if(s===ws&&a===null)r[s]=null;else if(!B(a)&&!$i(a)&&!zn(a)&&!ll(a)&&!Q(a)){M(Cg(a,s));continue}r[s]=CD(a,s,i)}}return r}function Sd(e,t){const n={};for(const i of _(e)){const r=CD(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function DH(e){const t=[];for(const n of _(e))if(ds(e,n)){const i=e[n],r=W(i);for(const s of r)B(s)?t.push(s):Ad(s)&&t.push(s.condition)}return t}function eb(e,t,n){if(e)for(const i of _(e)){const r=e[i];if(D(r))for(const s of r)t.call(n,s,i);else t.call(n,r,i)}}function OH(e,t,n,i){return e?_(e).reduce((r,s)=>{const a=e[s];return D(a)?a.reduce((o,u)=>t.call(i,o,u,s),r):t.call(i,r,a,s)},n):n}function _D(e,t){return _(t).reduce((n,i)=>{switch(i){case Me:case rt:case od:case ld:case ud:case Hn:case Ai:case Pr:case ao:case En:case Ki:case Vn:case Yi:case Ir:case Xn:case Yn:case Kn:case xn:case nl:case Gt:case js:case ws:return n;case Na:if(e==="line"||e==="trail")return n;case il:case ad:{const r=t[i];if(D(r)||B(r))for(const s of W(r))s.aggregate||n.push(U(s,{}));return n}case Ji:if(e==="trail")return n;case Wt:case Ci:case wi:case Qi:case zr:case Ur:case qr:case jr:{const r=Un(t[i]);return r&&!r.aggregate&&n.push(U(r,{})),n}}},[])}function RH(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let i,r;if(D(t)){for(const s of t)s.aggregate?(i||(i=[]),i.push(s)):(r||(r=[]),r.push(s));i&&(n.tooltip=i)}else t.aggregate?n.tooltip=t:r=t;return D(r)&&r.length===1&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}function $g(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};const r=e.map(({fieldPrefix:a,titlePrefix:o})=>{const u=i?` of ${tb(t)}`:"";return{field:a+t.field,type:t.type,title:Q(o)?{signal:`${o}"${escape(u)}"`}:o+u}}),s=DH(n).map(hH);return{tooltip:[...r,...ai(s,le)]}}function tb(e){const{title:t,field:n}=e;return Ue(t,n)}function nb(e,t,n,i,r){const{scale:s,axis:a}=n;return({partName:o,mark:u,positionPrefix:l,endPositionPrefix:c=void 0,extraEncoding:f={}})=>{const d=tb(n);return TD(e,o,r,{mark:u,encoding:{[t]:{field:`${l}_${n.field}`,type:n.type,...d!==void 0?{title:d}:{},...s!==void 0?{scale:s}:{},...a!==void 0?{axis:a}:{}},...q(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...i,...f}})}}function TD(e,t,n,i){const{clip:r,color:s,opacity:a}=e,o=e.type;return e[t]||e[t]===void 0&&n[t]?[{...i,mark:{...n[t],...r?{clip:r}:{},...s?{color:s}:{},...a?{opacity:a}:{},...mi(i.mark)?i.mark:{type:i.mark},style:`${o}-${String(t)}`,...Mr(e[t])?{}:e[t]}}]:[]}function ND(e,t,n){const{encoding:i}=e,r=t==="vertical"?"y":"x",s=i[r],a=i[`${r}2`],o=i[`${r}Error`],u=i[`${r}Error2`];return{continuousAxisChannelDef:Nl(s,n),continuousAxisChannelDef2:Nl(a,n),continuousAxisChannelDefError:Nl(o,n),continuousAxisChannelDefError2:Nl(u,n),continuousAxis:r}}function Nl(e,t){if(e?.aggregate){const{aggregate:n,...i}=e;return n!==t&&M(QW(n,t)),i}else return e}function MD(e,t){const{mark:n,encoding:i}=e,{x:r,y:s}=i;if(mi(n)&&n.orient)return n.orient;if(br(r)){if(br(s)){const a=B(r)&&r.aggregate,o=B(s)&&s.aggregate;if(!a&&o===t)return"vertical";if(!o&&a===t)return"horizontal";if(a===t&&o===t)throw new Error("Both x and y cannot have aggregate");return Ia(s)&&!Ia(r)?"horizontal":"vertical"}return"horizontal"}else{if(br(s))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}}const Zc="boxplot",_H=["box","median","outliers","rule","ticks"],TH=new Fd(Zc,BD);function LD(e){return ge(e)?"tukey":e}function BD(e,{config:t}){e={...e,encoding:Sd(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:s,...a}=e,o=mi(n)?n:{type:n};r&&M(Rk("boxplot"));const u=o.extent??t.boxplot.extent,l=Ce("size",o,t),c=o.invalid,f=LD(u),{bins:d,timeUnits:p,transform:h,continuousAxisChannelDef:g,continuousAxis:m,groupby:y,aggregate:b,encodingWithoutContinuousAxis:v,ticksOrient:A,boxOrient:E,customTooltipWithoutAggregatedField:C}=NH(e,u,t),x=so(g.field),{color:w,size:R,...L}=v,J=X3=>nb(o,m,g,X3,t.boxplot),ne=J(L),de=J(v),N=(j(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||"#4c78a8",O=J({...L,...R?{size:R}:{},color:{condition:{test:`${xe(`lower_box_${g.field}`)} >= ${xe(`upper_box_${g.field}`)}`,...w||{value:N}}}}),I=$g([{fieldPrefix:f==="min-max"?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:f==="min-max"?"lower_whisker_":"min_",titlePrefix:"Min"}],g,v),G={type:"tick",color:"black",opacity:1,orient:A,invalid:c,aria:!1},X=f==="min-max"?I:$g([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],g,v),V=[...ne({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:X}),...ne({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:X}),...ne({partName:"ticks",mark:G,positionPrefix:"lower_whisker",extraEncoding:X}),...ne({partName:"ticks",mark:G,positionPrefix:"upper_whisker",extraEncoding:X})],te=[...f!=="tukey"?V:[],...de({partName:"box",mark:{type:"bar",...l?{size:l}:{},orient:E,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:I}),...O({partName:"median",mark:{type:"tick",invalid:c,...j(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...l?{size:l}:{},orient:A,aria:!1},positionPrefix:"mid_box",extraEncoding:I})];if(f==="min-max")return{...a,transform:(a.transform??[]).concat(h),layer:te};const ye=xe(`lower_box_${g.field}`),oe=xe(`upper_box_${g.field}`),ke=`(${oe} - ${ye})`,gt=`${ye} - ${u} * ${ke}`,Le=`${oe} + ${u} * ${ke}`,Qn=xe(g.field),G3={joinaggregate:PD(g.field),groupby:y},Gb={transform:[{filter:`(${gt} <= ${Qn}) && (${Qn} <= ${Le})`},{aggregate:[{op:"min",field:g.field,as:`lower_whisker_${x}`},{op:"max",field:g.field,as:`upper_whisker_${x}`},{op:"min",field:`lower_box_${g.field}`,as:`lower_box_${x}`},{op:"max",field:`upper_box_${g.field}`,as:`upper_box_${x}`},...b],groupby:y}],layer:V},{tooltip:Uee,...H3}=L,{scale:Hb,axis:V3}=g,Vb=tb(g),Xb=zt(V3,["title"]),Yb=TD(o,"outliers",t.boxplot,{transform:[{filter:`(${Qn} < ${gt}) || (${Qn} > ${Le})`}],mark:"point",encoding:{[m]:{field:g.field,type:g.type,...Vb!==void 0?{title:Vb}:{},...Hb!==void 0?{scale:Hb}:{},...we(Xb)?{}:{axis:Xb}},...H3,...w?{color:w}:{},...C?{tooltip:C}:{}}})[0];let xl;const Kb=[...d,...p,G3];return Yb?xl={transform:Kb,layer:[Yb,Gb]}:(xl=Gb,xl.transform.unshift(...Kb)),{...a,layer:[xl,{transform:h,layer:te}]}}function PD(e){const t=so(e);return[{op:"q1",field:e,as:`lower_box_${t}`},{op:"q3",field:e,as:`upper_box_${t}`}]}function NH(e,t,n){const i=MD(e,Zc),{continuousAxisChannelDef:r,continuousAxis:s}=ND(e,i,Zc),a=r.field,o=so(a),u=LD(t),l=[...PD(a),{op:"median",field:a,as:`mid_box_${o}`},{op:"min",field:a,as:(u==="min-max"?"lower_whisker_":"min_")+o},{op:"max",field:a,as:(u==="min-max"?"upper_whisker_":"max_")+o}],c=u==="min-max"||u==="tukey"?[]:[{calculate:`${xe(`upper_box_${o}`)} - ${xe(`lower_box_${o}`)}`,as:`iqr_${o}`},{calculate:`min(${xe(`upper_box_${o}`)} + ${xe(`iqr_${o}`)} * ${t}, ${xe(`max_${o}`)})`,as:`upper_whisker_${o}`},{calculate:`max(${xe(`lower_box_${o}`)} - ${xe(`iqr_${o}`)} * ${t}, ${xe(`min_${o}`)})`,as:`lower_whisker_${o}`}],{[s]:f,...d}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:h}=RH(d),{bins:g,timeUnits:m,aggregate:y,groupby:b,encoding:v}=RD(h,n),A=i==="vertical"?"horizontal":"vertical",E=i,C=[...g,...m,{aggregate:[...y,...l],groupby:b},...c];return{bins:g,timeUnits:m,transform:C,groupby:b,aggregate:y,continuousAxisChannelDef:r,continuousAxis:s,encodingWithoutContinuousAxis:v,ticksOrient:A,boxOrient:E,customTooltipWithoutAggregatedField:p}}const ib="errorbar",MH=["ticks","rule"],LH=new Fd(ib,ID);function ID(e,{config:t}){e={...e,encoding:Sd(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:s,ticksOrient:a,markDef:o,outerSpec:u,tooltipEncoding:l}=zD(e,ib,t);delete s.size;const c=nb(o,r,i,s,t.errorbar),f=o.thickness,d=o.size,p={type:"tick",orient:a,aria:!1,...f!==void 0?{thickness:f}:{},...d!==void 0?{size:d}:{}},h=[...c({partName:"ticks",mark:p,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:p,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...f!==void 0?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return{...u,transform:n,...h.length>1?{layer:h}:{...h[0]}}}function BH(e,t){const{encoding:n}=e;if(PH(n))return{orient:MD(e,t),inputType:"raw"};const i=IH(n),r=zH(n),s=n.x,a=n.y;if(i){if(r)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const o=n.x2,u=n.y2;if(re(o)&&re(u))throw new Error(`${t} cannot have both x2 and y2`);if(re(o)){if(br(s))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}else if(re(u)){if(br(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}else{const o=n.xError,u=n.xError2,l=n.yError,c=n.yError2;if(re(u)&&!re(o))throw new Error(`${t} cannot have xError2 without xError`);if(re(c)&&!re(l))throw new Error(`${t} cannot have yError2 without yError`);if(re(o)&&re(l))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(re(o)){if(br(s))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}else if(re(l)){if(br(a))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function PH(e){return(re(e.x)||re(e.y))&&!re(e.x2)&&!re(e.y2)&&!re(e.xError)&&!re(e.xError2)&&!re(e.yError)&&!re(e.yError2)}function IH(e){return re(e.x2)||re(e.y2)}function zH(e){return re(e.xError)||re(e.xError2)||re(e.yError)||re(e.yError2)}function zD(e,t,n){const{mark:i,encoding:r,params:s,projection:a,...o}=e,u=mi(i)?i:{type:i};s&&M(Rk(t));const{orient:l,inputType:c}=BH(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:p,continuousAxisChannelDefError2:h,continuousAxis:g}=ND(e,l,t),{errorBarSpecificAggregate:m,postAggregateCalculates:y,tooltipSummary:b,tooltipTitleWithFieldName:v}=UH(u,f,d,p,h,c,t,n),{[g]:A,[g==="x"?"x2":"y2"]:E,[g==="x"?"xError":"yError"]:C,[g==="x"?"xError2":"yError2"]:x,...w}=r,{bins:R,timeUnits:L,aggregate:J,groupby:ne,encoding:de}=RD(w,n),N=[...J,...m],O=c!=="raw"?[]:ne,I=$g(b,f,de,v);return{transform:[...o.transform??[],...R,...L,...N.length===0?[]:[{aggregate:N,groupby:O}],...y],groupby:O,continuousAxisChannelDef:f,continuousAxis:g,encodingWithoutContinuousAxis:de,ticksOrient:l==="vertical"?"horizontal":"vertical",markDef:u,outerSpec:o,tooltipEncoding:I}}function UH(e,t,n,i,r,s,a,o){let u=[],l=[];const c=t.field;let f,d=!1;if(s==="raw"){const p=e.center?e.center:e.extent?e.extent==="iqr"?"median":"mean":o.errorbar.center,h=e.extent?e.extent:p==="mean"?"stderr":"iqr";if(p==="median"!=(h==="iqr")&&M(JW(p,h,a)),h==="stderr"||h==="stdev")u=[{op:h,field:c,as:`extent_${c}`},{op:p,field:c,as:`center_${c}`}],l=[{calculate:`${xe(`center_${c}`)} + ${xe(`extent_${c}`)}`,as:`upper_${c}`},{calculate:`${xe(`center_${c}`)} - ${xe(`extent_${c}`)}`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:tl(p)},{fieldPrefix:"upper_",titlePrefix:OE(p,h,"+")},{fieldPrefix:"lower_",titlePrefix:OE(p,h,"-")}],d=!0;else{let g,m,y;h==="ci"?(g="mean",m="ci0",y="ci1"):(g="median",m="q1",y="q3"),u=[{op:m,field:c,as:`lower_${c}`},{op:y,field:c,as:`upper_${c}`},{op:g,field:c,as:`center_${c}`}],f=[{fieldPrefix:"upper_",titlePrefix:ba({field:c,aggregate:y,type:"quantitative"},o,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:ba({field:c,aggregate:m,type:"quantitative"},o,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:ba({field:c,aggregate:g,type:"quantitative"},o,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&M(KW(e.center,e.extent)),s==="aggregated-upper-lower"?(f=[],l=[{calculate:xe(n.field),as:`upper_${c}`},{calculate:xe(c),as:`lower_${c}`}]):s==="aggregated-error"&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`${xe(c)} + ${xe(i.field)}`,as:`upper_${c}`}],r?l.push({calculate:`${xe(c)} + ${xe(r.field)}`,as:`lower_${c}`}):l.push({calculate:`${xe(c)} - ${xe(i.field)}`,as:`lower_${c}`}));for(const p of l)f.push({fieldPrefix:p.as.substring(0,6),titlePrefix:Cs(Cs(p.calculate,"datum['",""),"']","")})}return{postAggregateCalculates:l,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}function OE(e,t,n){return`${tl(e)} ${n} ${t}`}const rb="errorband",jH=["band","borders"],qH=new Fd(rb,UD);function UD(e,{config:t}){e={...e,encoding:Sd(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:s,markDef:a,outerSpec:o,tooltipEncoding:u}=zD(e,rb,t),l=a,c=nb(l,r,i,s,t.errorband),f=e.encoding.x!==void 0&&e.encoding.y!==void 0;let d={type:f?"area":"rect"},p={type:f?"line":"rule"};const h={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return f?(d={...d,...h,ariaRoleDescription:"errorband"},p={...p,...h,aria:!1}):l.interpolate?M(EE("interpolate")):l.tension&&M(EE("tension")),{...o,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:p,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:p,positionPrefix:"upper",extraEncoding:u})]}}const jD={};function sb(e,t,n){const i=new Fd(e,t);jD[e]={normalizer:i,parts:n}}function WH(){return _(jD)}sb(Zc,BD,_H);sb(ib,ID,MH);sb(rb,UD,jH);const GH=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],qD={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},WD={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},HH=_(qD),VH=_(WD),XH={header:1,headerRow:1,headerColumn:1,headerFacet:1},GD=_(XH),HD=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],YH={gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},KH={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},jn="_vgsid_",JH={point:{on:"click",fields:[jn],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function ab(e){return e==="legend"||!!e?.legend}function Ih(e){return ab(e)&&j(e)}function ob(e){return!!e?.select}function VD(e){const t=[];for(const n of e||[]){if(ob(n))continue;const{expr:i,bind:r,...s}=n;if(r&&i){const a={...s,bind:r,init:i};t.push(a)}else{const a={...s,...i?{update:i}:{},...r?{bind:r}:{}};t.push(a)}}return t}function QH(e){return $d(e)||lb(e)||ub(e)}function ub(e){return T(e,"concat")}function $d(e){return T(e,"vconcat")}function lb(e){return T(e,"hconcat")}function XD({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function yi(e){return T(e,"step")}function RE(e){return T(e,"view")||T(e,"width")||T(e,"height")}const _E=20,ZH={align:1,bounds:1,center:1,columns:1,spacing:1},eV=_(ZH);function tV(e,t,n){const i=n[t],r={},{spacing:s,columns:a}=i;s!==void 0&&(r.spacing=s),a!==void 0&&(Ed(e)&&!ul(e.facet)||ub(e))&&(r.columns=a),$d(e)&&(r.columns=1);for(const o of eV)if(e[o]!==void 0)if(o==="spacing"){const u=e[o];r[o]=ge(u)?u:{row:u.row??s,column:u.column??s}}else r[o]=e[o];return r}function kg(e,t){return e[t]??e[t==="width"?"continuousWidth":"continuousHeight"]}function Dg(e,t){const n=ef(e,t);return yi(n)?n.step:YD}function ef(e,t){const n=e[t]??e[t==="width"?"discreteWidth":"discreteHeight"];return Ue(n,{step:e.step})}const YD=20,nV={continuousWidth:200,continuousHeight:200,step:YD},iV={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:nV,mark:XG,arc:{},area:{},bar:QG,circle:{},geoshape:{},image:{},line:{},point:{},rect:Wy,rule:{color:"black"},square:{},text:{color:"black"},tick:ZG,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:DG,projection:{},legend:YH,header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:JH,style:{},title:{},facet:{spacing:_E},concat:{spacing:_E},normalizedNumberFormat:".0%"},_i=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],TE={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},NE={blue:_i[0],orange:_i[1],red:_i[2],teal:_i[3],green:_i[4],yellow:_i[5],purple:_i[6],pink:_i[7],brown:_i[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function rV(e={}){return{signals:[{name:"color",value:j(e)?{...NE,...e}:NE}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}function sV(e){return{signals:[{name:"fontSize",value:j(e)?{...TE,...e}:TE}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}function aV(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}function KD(e){const t=_(e||{}),n={};for(const i of t){const r=e[i];n[i]=dl(r)?wk(r):Kt(r)}return n}function oV(e){const t=_(e),n={};for(const i of t)n[i]=KD(e[i]);return n}const uV=[...sD,...$D,...GD,"background","padding","legend","lineBreak","scale","style","title","view"];function JD(e={}){const{color:t,font:n,fontSize:i,selection:r,...s}=e,a=Va({},ie(iV),n?aV(n):{},t?rV(t):{},i?sV(i):{},s||{});r&&Xa(a,"selection",r,!0);const o=zt(a,uV);for(const u of["background","lineBreak","padding"])a[u]&&(o[u]=Kt(a[u]));for(const u of sD)a[u]&&(o[u]=at(a[u]));for(const u of $D)a[u]&&(o[u]=KD(a[u]));for(const u of GD)a[u]&&(o[u]=at(a[u]));if(a.legend&&(o.legend=at(a.legend)),a.scale){const{invalid:u,...l}=a.scale,c=at(u,{level:1});o.scale={...at(l),..._(c).length>0?{invalid:c}:{}}}return a.style&&(o.style=oV(a.style)),a.title&&(o.title=at(a.title)),a.view&&(o.view=at(a.view)),o}const lV=new Set(["view",...jG]),cV=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],fV={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...VG};function dV(e){e=ie(e);for(const t of cV)delete e[t];if(e.axis)for(const t in e.axis)dl(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of GH)delete e.legend[t];if(e.mark){for(const t of CE)delete e.mark[t];e.mark.tooltip&&j(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(VD(e.params)),delete e.params);for(const t of lV){for(const i of CE)delete e[t][i];const n=fV[t];if(n)for(const i of n)delete e[t][i];pV(e,t)}for(const t of WH())delete e[t];hV(e);for(const t in e)j(e[t])&&we(e[t])&&delete e[t];return we(e)?void 0:e}function hV(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=Ck(e.title);we(t)||(e.style["group-title"]={...e.style["group-title"],...t}),we(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n}),we(i)?delete e.title:e.title=i}function pV(e,t,n,i){const r=e[t];t==="view"&&(n="cell");const s={...r,...e.style[n??t]};we(s)||(e.style[n??t]=s),delete e[t]}function kd(e){return T(e,"layer")}function gV(e){return T(e,"repeat")}function mV(e){return!D(e.repeat)&&T(e.repeat,"layer")}class cb{map(t,n){return Ed(t)?this.mapFacet(t,n):gV(t)?this.mapRepeat(t,n):lb(t)?this.mapHConcat(t,n):$d(t)?this.mapVConcat(t,n):ub(t)?this.mapConcat(t,n):this.mapLayerOrUnit(t,n)}mapLayerOrUnit(t,n){if(kd(t))return this.mapLayer(t,n);if(er(t))return this.mapUnit(t,n);throw new Error(Fy(t))}mapLayer(t,n){return{...t,layer:t.layer.map(i=>this.mapLayerOrUnit(i,n))}}mapHConcat(t,n){return{...t,hconcat:t.hconcat.map(i=>this.map(i,n))}}mapVConcat(t,n){return{...t,vconcat:t.vconcat.map(i=>this.map(i,n))}}mapConcat(t,n){const{concat:i,...r}=t;return{...r,concat:i.map(s=>this.map(s,n))}}mapFacet(t,n){return{...t,spec:this.map(t.spec,n)}}mapRepeat(t,n){return{...t,spec:this.map(t.spec,n)}}}const yV={zero:1,center:1,normalize:1};function bV(e){return H(yV,e)}const xV=new Set([nD,yd,md,Vc,xd,jy,qy,bd,iD,Uy]),vV=new Set([yd,md,nD]);function sa(e){return B(e)&&Ba(e)==="quantitative"&&!e.bin}function ME(e,t,{orient:n,type:i}){const r=t==="x"?"y":"radius",s=t==="x"&&["bar","area"].includes(i),a=e[t],o=e[r];if(B(a)&&B(o))if(sa(a)&&sa(o)){if(a.stack)return t;if(o.stack)return r;const u=B(a)&&!!a.aggregate,l=B(o)&&!!o.aggregate;if(u!==l)return u?t:r;if(s){if(n==="vertical")return r;if(n==="horizontal")return t}}else{if(sa(a))return t;if(sa(o))return r}else{if(sa(a))return s&&n==="vertical"?void 0:t;if(sa(o))return s&&n==="horizontal"?void 0:r}}function EV(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}function QD(e,t){const n=mi(e)?e:{type:e},i=n.type;if(!xV.has(i))return null;const r=ME(t,"x",n)||ME(t,"theta",n);if(!r)return null;const s=t[r],a=B(s)?U(s,{}):void 0,o=EV(r),u=[],l=new Set;if(t[o]){const g=t[o],m=B(g)?U(g,{}):void 0;m&&m!==a&&(u.push(o),l.add(m))}const c=o==="x"?"xOffset":"yOffset",f=t[c],d=B(f)?U(f,{}):void 0;d&&d!==a&&(u.push(c),l.add(d));const p=kq.reduce((g,m)=>{if(m!=="tooltip"&&ds(t,m)){const y=t[m];for(const b of W(y)){const v=Un(b);if(v.aggregate)continue;const A=U(v,{});(!A||!l.has(A))&&g.push({channel:m,fieldDef:v})}}return g},[]);let h;return s.stack!==void 0?Mr(s.stack)?h=s.stack?"zero":null:h=s.stack:vV.has(i)&&(h="zero"),!h||!bV(h)||OD(t)&&p.length===0?null:(s?.scale?.type&&s?.scale?.type!==ot.LINEAR&&s?.stack&&M(VW(s.scale.type)),re(t[Fi(r)])?(s.stack!==void 0&&M(HW(r)),null):(B(s)&&s.aggregate&&!Uq.has(s.aggregate)&&M(XW(s.aggregate)),{groupbyChannels:u,groupbyFields:l,fieldChannel:r,impute:s.impute===null?!1:Gr(i),stackBy:p,offset:h}))}function ZD(e,t,n){const i=at(e),r=Ce("orient",i,n);if(i.orient=FV(i.type,t,r),r!==void 0&&r!==i.orient&&M(OW(i.orient,r)),i.type==="bar"&&i.orient){const u=Ce("cornerRadiusEnd",i,n);if(u!==void 0){const l=i.orient==="horizontal"&&t.x2||i.orient==="vertical"&&t.y2?["cornerRadius"]:KG[i.orient];for(const c of l)i[c]=u;i.cornerRadiusEnd!==void 0&&delete i.cornerRadiusEnd}}const s=Ce("opacity",i,n),a=Ce("fillOpacity",i,n);return s===void 0&&a===void 0&&(i.opacity=CV(i.type,t)),Ce("cursor",i,n)===void 0&&(i.cursor=AV(i,t,n)),i}function AV(e,t,n){return t.href||e.href||Ce("href",e,n)?"pointer":e.cursor}function CV(e,t){if(ue([xd,Uy,jy,qy],e)&&!OD(t))return .7}function wV(e,t,{graticule:n}){if(n)return!1;const i=gi("filled",e,t),r=e.type;return Ue(i,r!==xd&&r!==bd&&r!==Vc)}function FV(e,t,n){switch(e){case xd:case jy:case qy:case iD:case zG:case IG:return}const{x:i,y:r,x2:s,y2:a}=t;switch(e){case yd:if(B(i)&&(st(i.bin)||B(r)&&r.aggregate&&!i.aggregate))return"vertical";if(B(r)&&(st(r.bin)||B(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||s){if(n)return n;if(!s)return(B(i)&&i.type===$s&&!De(i.bin)||Yc(i))&&B(r)&&st(r.bin)?"horizontal":"vertical";if(!a)return(B(r)&&r.type===$s&&!De(r.bin)||Yc(r))&&B(i)&&st(i.bin)?"vertical":"horizontal"}case Vc:if(s&&!(B(i)&&st(i.bin))&&a&&!(B(r)&&st(r.bin)))return;case md:if(a)return B(r)&&st(r.bin)?"horizontal":"vertical";if(s)return B(i)&&st(i.bin)?"vertical":"horizontal";if(e===Vc){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case bd:case Uy:{const o=$E(i),u=$E(r);if(n)return n;if(o&&!u)return e!=="tick"?"horizontal":"vertical";if(!o&&u)return e!=="tick"?"vertical":"horizontal";if(o&&u)return"vertical";{const l=Nt(i)&&i.type===Ma,c=Nt(r)&&r.type===Ma;if(l&&!c)return"vertical";if(!l&&c)return"horizontal"}return}}return"vertical"}function SV(e){const{point:t,line:n,...i}=e;return _(i).length>1?i:i.type}function $V(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:zt(e[t],["point","line"])});return e}function zh(e,t={},n){return e.point==="transparent"?{opacity:0}:e.point?j(e.point)?e.point:{}:e.point!==void 0?null:t.point||n.shape?j(t.point)?t.point:{}:void 0}function LE(e,t={}){return e.line?e.line===!0?{}:e.line:e.line!==void 0?null:t.line?t.line===!0?{}:t.line:void 0}class kV{constructor(){this.name="path-overlay"}hasMatchingType(t,n){if(er(t)){const{mark:i,encoding:r}=t,s=mi(i)?i:{type:i};switch(s.type){case"line":case"rule":case"trail":return!!zh(s,n[s.type],r);case"area":return!!zh(s,n[s.type],r)||!!LE(s,n[s.type])}}return!1}run(t,n,i){const{config:r}=n,{params:s,projection:a,mark:o,name:u,encoding:l,...c}=t,f=Sd(l,r),d=mi(o)?o:{type:o},p=zh(d,r[d.type],f),h=d.type==="area"&&LE(d,r[d.type]),g=[{name:u,...s?{params:s}:{},mark:SV({...d.type==="area"&&d.opacity===void 0&&d.fillOpacity===void 0?{opacity:.7}:{},...d}),encoding:zt(f,["shape"])}],m=QD(ZD(d,f,r),f);let y=f;if(m){const{fieldChannel:b,offset:v}=m;y={...f,[b]:{...f[b],...v?{stack:v}:{}}}}return y=zt(y,["y2","x2"]),h&&g.push({...a?{projection:a}:{},mark:{type:"line",...Ra(d,["clip","interpolate","tension","tooltip"]),...h},encoding:y}),p&&g.push({...a?{projection:a}:{},mark:{type:"point",opacity:1,filled:!0,...Ra(d,["clip","tooltip"]),...p},encoding:y}),i({...c,layer:g},{...n,config:$V(r)})}}function DV(e,t){return t?ul(e)?tO(e,t):eO(e,t):e}function Uh(e,t){return t?tO(e,t):e}function Og(e,t,n){const i=t[e];if(fH(i)){if(i.repeat in n)return{...t,[e]:n[i.repeat]};M(oW(i.repeat));return}return t}function eO(e,t){if(e=Og("field",e,t),e!==void 0){if(e===null)return null;if(Ky(e)&&zi(e.sort)){const n=Og("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function BE(e,t){if(B(e))return eO(e,t);{const n=Og("datum",e,t);return n!==e&&!n.type&&(n.type="nominal"),n}}function PE(e,t){if(re(e)){const n=BE(e,t);if(n)return n;if(ll(e))return{condition:e.condition}}else{if(cl(e)){const n=BE(e.condition,t);if(n)return{...e,condition:n};{const{condition:i,...r}=e;return r}}return e}}function tO(e,t){const n={};for(const i in e)if(T(e,i)){const r=e[i];if(D(r))n[i]=r.map(s=>PE(s,t)).filter(s=>s);else{const s=PE(r,t);s!==void 0&&(n[i]=s)}}return n}class OV{constructor(){this.name="RuleForRangedLine"}hasMatchingType(t){if(er(t)){const{encoding:n,mark:i}=t;if(i==="line"||mi(i)&&i.type==="line")for(const r of Fq){const s=qs(r),a=n[s];if(n[r]&&(B(a)&&!st(a.bin)||$i(a)))return!0}}return!1}run(t,n,i){const{encoding:r,mark:s}=t;return M(DW(!!r.x2,!!r.y2)),i({...t,mark:j(s)?{...s,type:"rule"}:"rule"},n)}}class RV extends cb{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[TH,LH,qH,new kV,new OV]}map(t,n){if(er(t)){const i=ds(t.encoding,Pi),r=ds(t.encoding,Ii),s=ds(t.encoding,sd);if(i||r||s)return this.mapFacetedUnit(t,n)}return super.map(t,n)}mapUnit(t,n){const{parentEncoding:i,parentProjection:r}=n,s=Uh(t.encoding,n.repeater),a={...t,...t.name?{name:[n.repeaterPrefix,t.name].filter(u=>u).join("_")}:{},...s?{encoding:s}:{}};if(i||r)return this.mapUnitWithParentEncodingOrProjection(a,n);const o=this.mapLayerOrUnit.bind(this);for(const u of this.nonFacetUnitNormalizers)if(u.hasMatchingType(a,n.config))return u.run(a,n,o);return a}mapRepeat(t,n){return mV(t)?this.mapLayerRepeat(t,n):this.mapNonLayerRepeat(t,n)}mapLayerRepeat(t,n){const{repeat:i,spec:r,...s}=t,{row:a,column:o,layer:u}=i,{repeater:l={},repeaterPrefix:c=""}=n;return a||o?this.mapRepeat({...t,repeat:{...a?{row:a}:{},...o?{column:o}:{}},spec:{repeat:{layer:u},spec:r}},n):{...s,layer:u.map(f=>{const d={...l,layer:f},p=`${(r.name?`${r.name}_`:"")+c}child__layer_${Ne(f)}`,h=this.mapLayerOrUnit(r,{...n,repeater:d,repeaterPrefix:p});return h.name=p,h})}}mapNonLayerRepeat(t,n){const{repeat:i,spec:r,data:s,...a}=t;!D(i)&&t.columns&&(t=zt(t,["columns"]),M(yE("repeat")));const o=[],{repeater:u={},repeaterPrefix:l=""}=n,c=!D(i)&&i.row||[u?u.row:null],f=!D(i)&&i.column||[u?u.column:null],d=D(i)&&i||[u?u.repeat:null];for(const h of d)for(const g of c)for(const m of f){const y={repeat:h,row:g,column:m,layer:u.layer},b=(r.name?`${r.name}_`:"")+l+"child__"+(D(i)?`${Ne(h)}`:(i.row?`row_${Ne(g)}`:"")+(i.column?`column_${Ne(m)}`:"")),v=this.map(r,{...n,repeater:y,repeaterPrefix:b});v.name=b,o.push(zt(v,["data"]))}const p=D(i)?t.columns:i.column?i.column.length:1;return{data:r.data??s,align:"all",...a,columns:p,concat:o}}mapFacet(t,n){const{facet:i}=t;return ul(i)&&t.columns&&(t=zt(t,["columns"]),M(yE("facet"))),super.mapFacet(t,n)}mapUnitWithParentEncodingOrProjection(t,n){const{encoding:i,projection:r}=t,{parentEncoding:s,parentProjection:a,config:o}=n,u=zE({parentProjection:a,projection:r}),l=IE({parentEncoding:s,encoding:Uh(i,n.repeater)});return this.mapUnit({...t,...u?{projection:u}:{},...l?{encoding:l}:{}},{config:o})}mapFacetedUnit(t,n){const{row:i,column:r,facet:s,...a}=t.encoding,{mark:o,width:u,projection:l,height:c,view:f,params:d,encoding:p,...h}=t,{facetMapping:g,layout:m}=this.getFacetMappingAndLayout({row:i,column:r,facet:s},n),y=Uh(a,n.repeater);return this.mapFacet({...h,...m,facet:g,spec:{...u?{width:u}:{},...c?{height:c}:{},...f?{view:f}:{},...l?{projection:l}:{},mark:o,encoding:y,...d?{params:d}:{}}},n)}getFacetMappingAndLayout(t,n){const{row:i,column:r,facet:s}=t;if(i||r){s&&M($W([...i?[Pi]:[],...r?[Ii]:[]]));const a={},o={};for(const u of[Pi,Ii]){const l=t[u];if(l){const{align:c,center:f,spacing:d,columns:p,...h}=l;a[u]=h;for(const g of["align","center","spacing"])l[g]!==void 0&&(o[g]??(o[g]={}),o[g][u]=l[g])}}return{facetMapping:a,layout:o}}else{const{align:a,center:o,spacing:u,columns:l,...c}=s;return{facetMapping:DV(c,n.repeater),layout:{...a?{align:a}:{},...o?{center:o}:{},...u?{spacing:u}:{},...l?{columns:l}:{}}}}}mapLayer(t,{parentEncoding:n,parentProjection:i,...r}){const{encoding:s,projection:a,...o}=t,u={...r,parentEncoding:IE({parentEncoding:n,encoding:s,layer:!0}),parentProjection:zE({parentProjection:i,projection:a})};return super.mapLayer({...o,...t.name?{name:[u.repeaterPrefix,t.name].filter(l=>l).join("_")}:{}},u)}}function IE({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([..._(e),..._(t)]);for(const s of r){const a=t[s],o=e[s];if(re(a)){const u={...o,...a};i[s]=u}else cl(a)?i[s]={...a,condition:{...o,...a.condition}}:a||a===null?i[s]=a:(n||zn(o)||Q(o)||re(o)||D(o))&&(i[s]=o)}}else i=t;return!i||we(i)?void 0:i}function zE(e){const{parentProjection:t,projection:n}=e;return t&&n&&M(mW({parentProjection:t,projection:n})),n??t}function fb(e){return T(e,"filter")}function _V(e){return T(e,"stop")}function nO(e){return T(e,"lookup")}function TV(e){return T(e,"data")}function NV(e){return T(e,"param")}function MV(e){return T(e,"pivot")}function LV(e){return T(e,"density")}function BV(e){return T(e,"quantile")}function PV(e){return T(e,"regression")}function IV(e){return T(e,"loess")}function zV(e){return T(e,"sample")}function UV(e){return T(e,"window")}function jV(e){return T(e,"joinaggregate")}function qV(e){return T(e,"flatten")}function WV(e){return T(e,"calculate")}function iO(e){return T(e,"bin")}function GV(e){return T(e,"impute")}function HV(e){return T(e,"timeUnit")}function VV(e){return T(e,"aggregate")}function XV(e){return T(e,"stack")}function YV(e){return T(e,"fold")}function KV(e){return T(e,"extent")&&!T(e,"density")&&!T(e,"regression")}function JV(e){return e.map(t=>fb(t)?{filter:ma(t.filter,AG)}:t)}class QV extends cb{map(t,n){return n.emptySelections??(n.emptySelections={}),n.selectionPredicates??(n.selectionPredicates={}),t=UE(t,n),super.map(t,n)}mapLayerOrUnit(t,n){if(t=UE(t,n),t.encoding){const i={};for(const[r,s]of Or(t.encoding))i[r]=rO(s,n);t={...t,encoding:i}}return super.mapLayerOrUnit(t,n)}mapUnit(t,n){const{selection:i,...r}=t;return i?{...r,params:Or(i).map(([s,a])=>{const{init:o,bind:u,empty:l,...c}=a;c.type==="single"?(c.type="point",c.toggle=!1):c.type==="multi"&&(c.type="point"),n.emptySelections[s]=l!=="none";for(const f of dt(n.selectionPredicates[s]??{}))f.empty=l!=="none";return{name:s,value:o,select:c,bind:u}})}:t}}function UE(e,t){const{transform:n,...i}=e;if(n){const r=n.map(s=>{if(fb(s))return{filter:Rg(s,t)};if(iO(s)&&Ws(s.bin))return{...s,bin:sO(s.bin)};if(nO(s)){const{selection:a,...o}=s.from;return a?{...s,from:{param:a,...o}}:s}return s});return{...i,transform:r}}return e}function rO(e,t){const n=ie(e);if(B(n)&&Ws(n.bin)&&(n.bin=sO(n.bin)),Xs(n)&&n.scale?.domain?.selection){const{selection:i,...r}=n.scale.domain;n.scale.domain={...r,...i?{param:i}:{}}}if(ll(n))if(D(n.condition))n.condition=n.condition.map(i=>{const{selection:r,param:s,test:a,...o}=i;return s?i:{...o,test:Rg(i,t)}});else{const{selection:i,param:r,test:s,...a}=rO(n.condition,t);n.condition=r?n.condition:{...a,test:Rg(n.condition,t)}}return n}function sO(e){const t=e.extent;if(t?.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function Rg(e,t){const n=i=>ma(i,r=>{var s;const a=t.emptySelections[r]??!0,o={param:r,empty:a};return(s=t.selectionPredicates)[r]??(s[r]=[]),t.selectionPredicates[r].push(o),o});return e.selection?n(e.selection):ma(e.test||e.filter,i=>i.selection?n(i.selection):i)}class _g extends cb{map(t,n){const i=n.selections??[];if(t.params&&!er(t)){const r=[];for(const s of t.params)ob(s)?i.push(s):r.push(s);t.params=r}return n.selections=i,super.map(t,n)}mapUnit(t,n){const i=n.selections;if(!i||!i.length)return t;const r=(n.path??[]).concat(t.name),s=[];for(const a of i)if(!a.views||!a.views.length)s.push(a);else for(const o of a.views)(q(o)&&(o===t.name||r.includes(o))||D(o)&&o.map(u=>r.indexOf(u)).every((u,l,c)=>u!==-1&&(l===0||u>c[l-1])))&&s.push(a);return s.length&&(t.params=s),t}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=_g.prototype[e];_g.prototype[e]=function(n,i){return t.call(this,n,ZV(n,i))}}function ZV(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function aO(e,t){t===void 0&&(t=JD(e.config));const n=iX(e,t),{width:i,height:r}=e,s=rX(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...s?{autosize:s}:{}}}const eX=new RV,tX=new QV,nX=new _g;function iX(e,t={}){const n={config:t};return nX.map(eX.map(tX.map(e,n),n),n)}function jE(e){return q(e)?{type:e}:e??{}}function rX(e,t,n){let{width:i,height:r}=t;const s=er(e)||kd(e),a={};s?i=="container"&&r=="container"?(a.type="fit",a.contains="padding"):i=="container"?(a.type="fit-x",a.contains="padding"):r=="container"&&(a.type="fit-y",a.contains="padding"):(i=="container"&&(M(hE("width")),i=void 0),r=="container"&&(M(hE("height")),r=void 0));const o={type:"pad",...a,...n?jE(n.autosize):{},...jE(e.autosize)};if(o.type==="fit"&&!s&&(M(Kq),o.type="pad"),i=="container"&&!(o.type=="fit"||o.type=="fit-x")&&M(pE("width")),r=="container"&&!(o.type=="fit"||o.type=="fit-y")&&M(pE("height")),!Jt(o,{type:"pad"}))return o}function sX(e){return["fit","fit-x","fit-y"].includes(e)}function aX(e){return e?`fit-${cd(e)}`:"fit"}const oX=["background","padding"];function qE(e,t){const n={};for(const i of oX)e&&e[i]!==void 0&&(n[i]=Kt(e[i]));return t&&(n.params=e.params),n}class tr{constructor(t={},n={}){this.explicit=t,this.implicit=n}clone(){return new tr(ie(this.explicit),ie(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(t){return Ue(this.explicit[t],this.implicit[t])}getWithExplicit(t){return this.explicit[t]!==void 0?{explicit:!0,value:this.explicit[t]}:this.implicit[t]!==void 0?{explicit:!1,value:this.implicit[t]}:{explicit:!1,value:void 0}}setWithExplicit(t,{value:n,explicit:i}){n!==void 0&&this.set(t,n,i)}set(t,n,i){return delete this[i?"implicit":"explicit"][t],this[i?"explicit":"implicit"][t]=n,this}copyKeyFromSplit(t,{explicit:n,implicit:i}){n[t]!==void 0?this.set(t,n[t],!0):i[t]!==void 0&&this.set(t,i[t],!1)}copyKeyFromObject(t,n){n[t]!==void 0&&this.set(t,n[t],!0)}copyAll(t){for(const n of _(t.combine())){const i=t.getWithExplicit(n);this.setWithExplicit(n,i)}}}function ii(e){return{explicit:!0,value:e}}function Yt(e){return{explicit:!1,value:e}}function oO(e){return(t,n,i,r)=>{const s=e(t.value,n.value);return s>0?t:s<0?n:Dd(t,n,i,r)}}function Dd(e,t,n,i){return e.explicit&&t.explicit&&M(IW(n,i,e.value,t.value)),e}function Tr(e,t,n,i,r=Dd){return e===void 0||e.value===void 0?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:Jt(e.value,t.value)?e:r(e,t,n,i)}class uX extends tr{constructor(t={},n={},i=!1){super(t,n),this.explicit=t,this.implicit=n,this.parseNothing=i}clone(){const t=super.clone();return t.parseNothing=this.parseNothing,t}}function za(e){return T(e,"url")}function wu(e){return T(e,"values")}function uO(e){return T(e,"name")&&!za(e)&&!wu(e)&&!Cr(e)}function Cr(e){return e&&(lO(e)||cO(e)||db(e))}function lO(e){return T(e,"sequence")}function cO(e){return T(e,"sphere")}function db(e){return T(e,"graticule")}var Pe;(function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup",e[e.PreFilterInvalid=5]="PreFilterInvalid",e[e.PostFilterInvalid=6]="PostFilterInvalid"})(Pe||(Pe={}));function fO({invalid:e,isPath:t}){switch(aD(e,{isPath:t})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}function lX(e){const{marks:t,scales:n}=fO(e);return t===n?Pe.Main:n==="include-invalid-values"?Pe.PreFilterInvalid:Pe.PostFilterInvalid}class Ae{constructor(t,n){this.debugName=n,this._children=[],this._parent=null,t&&(this.parent=t)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(t){this._parent=t,t&&t.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(t,n){if(this._children.includes(t)){M(hW);return}n!==void 0?this._children.splice(n,0,t):this._children.push(t)}removeChild(t){const n=this._children.indexOf(t);return this._children.splice(n,1),n}remove(){let t=this._parent.removeChild(this);for(const n of this._children)n._parent=this._parent,this._parent.addChild(n,t++)}insertAsParentOf(t){const n=t.parent;n.removeChild(this),this.parent=n,t.parent=this}swapWithParent(){const t=this._parent,n=t.parent;for(const r of this._children)r.parent=t;this._children=[],t.removeChild(this);const i=t.parent.removeChild(t);this._parent=n,n.addChild(this,i),t.parent=this}}class Ut extends Ae{clone(){const t=new this.constructor;return t.debugName=`clone_${this.debugName}`,t._source=this._source,t._name=`clone_${this._name}`,t.type=this.type,t.refCounts=this.refCounts,t.refCounts[t._name]=0,t}constructor(t,n,i,r){super(t,n),this.type=i,this.refCounts=r,this._source=this._name=n,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${ok()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(t){this._source=t}}function jh(e){return e.as!==void 0}function WE(e){return`${e}_end`}class li extends Ae{clone(){return new li(null,ie(this.timeUnits))}constructor(t,n){super(t),this.timeUnits=n}static makeFromEncoding(t,n){const i=n.reduceFieldDef((r,s,a)=>{const{field:o,timeUnit:u}=s;if(u){let l;if(Vs(u)){if(Be(n)){const{mark:c,markDef:f,config:d}=n,p=_r({fieldDef:s,markDef:f,config:d});(Cu(c)||p)&&(l={timeUnit:nt(u),field:o})}}else l={as:U(s,{forAs:!0}),field:o,timeUnit:u};if(Be(n)){const{mark:c,markDef:f,config:d}=n,p=_r({fieldDef:s,markDef:f,config:d});Cu(c)&&je(a)&&p!==.5&&(l.rectBandPosition=p)}l&&(r[le(l)]=l)}return r},{});return we(i)?null:new li(t,i)}static makeFromTransform(t,n){const{timeUnit:i,...r}={...n},s=nt(i),a={...r,timeUnit:s};return new li(t,{[le(a)]:a})}merge(t){this.timeUnits={...this.timeUnits};for(const n in t.timeUnits)this.timeUnits[n]||(this.timeUnits[n]=t.timeUnits[n]);for(const n of t.children)t.removeChild(n),n.parent=this;t.remove()}removeFormulas(t){const n={};for(const[i,r]of Or(this.timeUnits)){const s=jh(r)?r.as:`${r.field}_end`;t.has(s)||(n[i]=r)}this.timeUnits=n}producedFields(){return new Set(dt(this.timeUnits).map(t=>jh(t)?t.as:WE(t.field)))}dependentFields(){return new Set(dt(this.timeUnits).map(t=>t.field))}hash(){return`TimeUnit ${le(this.timeUnits)}`}assemble(){const t=[];for(const n of dt(this.timeUnits)){const{rectBandPosition:i}=n,r=nt(n.timeUnit);if(jh(n)){const{field:s,as:a}=n,{unit:o,utc:u,...l}=r,c=[a,`${a}_end`];t.push({field:bn(s),type:"timeunit",...o?{units:pd(o)}:{},...u?{timezone:"utc"}:{},...l,as:c}),t.push(...GE(c,i,r))}else if(n){const{field:s}=n,a=s.replaceAll("\\.","."),o=dO({timeUnit:r,field:a}),u=WE(a);t.push({type:"formula",expr:o,as:u}),t.push(...GE([a,u],i,r))}}return t}}const Od="offsetted_rect_start",Rd="offsetted_rect_end";function dO({timeUnit:e,field:t,reverse:n}){const{unit:i,utc:r}=e,s=jk(i),{part:a,step:o}=Hk(s,e.step);return`${r?"utcOffset":"timeOffset"}('${a}', ${xe(t)}, ${n?-o:o})`}function GE([e,t],n,i){if(n!==void 0&&n!==.5){const r=xe(e),s=xe(t);return[{type:"formula",expr:HE([dO({timeUnit:i,field:e,reverse:!0}),r],n+.5),as:`${e}_${Od}`},{type:"formula",expr:HE([r,s],n+.5),as:`${e}_${Rd}`}]}return[]}function HE([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const hl="_tuple_fields";class cX{constructor(...t){this.items=t,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const fX={defined:()=>!0,parse:(e,t,n)=>{const i=t.name,r=t.project??(t.project=new cX),s={},a={},o=new Set,u=(h,g)=>{const m=g==="visual"?h.channel:h.field;let y=Ne(`${i}_${m}`);for(let b=1;o.has(y);b++)y=Ne(`${i}_${m}_${b}`);return o.add(y),{[g]:y}},l=t.type,c=e.config.selection[l],f=n.value!==void 0?W(n.value):null;let{fields:d,encodings:p}=j(n.select)?n.select:{};if(!d&&!p&&f){for(const h of f)if(j(h))for(const g of _(h))wq(g)?(p||(p=[])).push(g):l==="interval"?(M(aW),p=c.encodings):(d??(d=[])).push(g)}!d&&!p&&(p=c.encodings,"fields"in c&&(d=c.fields));for(const h of p??[]){const g=e.fieldDef(h);if(g){let m=g.field;if(g.aggregate){M(Jq(h,g.aggregate));continue}else if(!m){M(mE(h));continue}if(g.timeUnit&&!Vs(g.timeUnit)){m=e.vgField(h);const y={timeUnit:g.timeUnit,as:m,field:g.field};a[le(y)]=y}if(!s[m]){const y=l==="interval"&&Si(h)&&In(e.getScaleComponent(h).get("type"))?"R":g.bin?"R-RE":"E",b={field:m,channel:h,type:y,index:r.items.length};b.signals={...u(b,"data"),...u(b,"visual")},r.items.push(s[m]=b),r.hasField[m]=s[m],r.hasSelectionId=r.hasSelectionId||m===jn,hk(h)?(b.geoChannel=h,b.channel=dk(h),r.hasChannel[b.channel]=s[m]):r.hasChannel[h]=s[m]}}else M(mE(h))}for(const h of d??[]){if(r.hasField[h])continue;const g={type:"E",field:h,index:r.items.length};g.signals={...u(g,"data")},r.items.push(g),r.hasField[h]=g,r.hasSelectionId=r.hasSelectionId||h===jn}f&&(t.init=f.map(h=>r.items.map(g=>j(h)?h[g.geoChannel||g.channel]!==void 0?h[g.geoChannel||g.channel]:h[g.field]:h))),we(a)||(r.timeUnit=new li(null,a))},signals:(e,t,n)=>{const i=t.name+hl;return n.filter(s=>s.name===i).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(mO)})}},hO="_curr",pc="anim_value",ua="anim_clock",Tg="eased_anim_clock",pO="min_extent",gO="max_range_extent",qh="last_tick_at",Wh="is_playing",dX=1/60*1e3,hX=(e,t)=>[{name:Tg,update:ua},{name:`${e}_domain`,init:`domain('${t}')`},{name:pO,init:`extent(${e}_domain)[0]`},{name:gO,init:`extent(range('${t}'))[1]`},{name:pc,update:`invert('${t}', ${Tg})`}],pX={defined:e=>e.type==="point",topLevelSignals:(e,t,n)=>(ci(t)&&(n=n.concat([{name:ua,init:"0",on:[{events:{type:"timer",throttle:dX},update:`${Wh} ? (${ua} + (now() - ${qh}) > ${gO} ? 0 : ${ua} + (now() - ${qh})) : ${ua}`}]},{name:qh,init:"now()",on:[{events:[{signal:ua},{signal:Wh}],update:"now()"}]},{name:Wh,init:"true"}])),n),signals:(e,t,n)=>{const i=t.name,r=i+hl,s=t.project,a="(item().isVoronoi ? datum.datum : datum)",o=dt(e.component.selection??{}).reduce((c,f)=>f.type==="interval"?c.concat(f.name+xa):c,[]).map(c=>`indexof(item().mark.name, '${c}') < 0`).join(" && "),u=`datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${o?` && ${o}`:""}`;let l=`unit: ${hs(e)}, `;if(t.project.hasSelectionId)l+=`${jn}: ${a}[${P(jn)}]`;else if(ci(t))l+=`fields: ${r}, values: [${pc} ? ${pc} : ${pO}]`;else{const c=s.items.map(f=>e.fieldDef(f.channel)?.bin?`[${a}[${P(e.vgField(f.channel,{}))}], ${a}[${P(e.vgField(f.channel,{binSuffix:"end"}))}]]`:`${a}[${P(f.field)}]`).join(", ");l+=`fields: ${r}, values: [${c}]`}if(ci(t))return n.concat(hX(t.name,e.scaleName(Ir)),[{name:i+Hi,on:[{events:[{signal:Tg},{signal:pc}],update:`{${l}}`,force:!0}]}]);{const c=t.events;return n.concat([{name:i+Hi,on:c?[{events:c,update:`${u} ? {${l}} : null`,force:!0}]:[]}])}}};function mO(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=bn(r.field),r}function Os(e,t=!0,n=$t){if(D(e)){const i=e.map(r=>Os(r,t,n));return t?`[${i.join(", ")}]`:i}else if(Hs(e))return n(t?Ss(e):cG(e));return t?n(Fe(e)):e}function gX(e,t){for(const n of dt(e.component.selection??{})){const i=n.name;let r=`${i}${Hi}, ${n.resolve==="global"?"true":`{unit: ${hs(e)}}`}`;for(const s of Td)s.defined(n)&&(s.signals&&(t=s.signals(e,n,t)),s.modifyExpr&&(r=s.modifyExpr(e,n,r)));t.push({name:i+jX,on:[{events:{signal:n.name+Hi},update:`modify(${P(n.name+Rs)}, ${r})`}]})}return hb(t)}function mX(e,t){if(e.component.selection&&_(e.component.selection).length){const n=P(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:Br("pointermove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return hb(t)}function yX(e,t){let n=!1;for(const i of dt(e.component.selection??{})){const r=i.name,s=P(r+Rs);if(t.filter(o=>o.name===r).length===0){const o=i.resolve==="global"?"union":i.resolve,u=i.type==="point"?", true, true)":")";t.push({name:i.name,update:`${TO}(${s}, ${P(o)}${u}`})}n=!0;for(const o of Td)o.defined(i)&&o.topLevelSignals&&(t=o.topLevelSignals(e,i,t))}return n&&t.filter(r=>r.name==="unit").length===0&&t.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),hb(t)}function bX(e,t){const n=[],i=[],r=hs(e,{escape:!1});for(const s of dt(e.component.selection??{})){const a={name:s.name+Rs};if(s.project.hasSelectionId&&(a.transform=[{type:"collect",sort:{field:jn}}]),s.init){const u=s.project.items.map(mO);a.values=s.project.hasSelectionId?s.init.map(l=>({unit:r,[jn]:Os(l,!1)[0]})):s.init.map(l=>({unit:r,fields:u,values:Os(l,!1)}))}if([...n,...t].filter(u=>u.name===s.name+Rs).length||n.push(a),ci(s)&&t.length){const u=e.lookupDataSource(e.getDataName(Pe.Main)),l=t.find(f=>f.name===u),c=l.transform.find(f=>f.type==="filter"&&f.expr.includes("vlSelectionTest"));if(c){l.transform=l.transform.filter(d=>d!==c);const f={name:l.name+hO,source:l.name,transform:[c]};i.push(f)}}}return n.concat(t,i)}function yO(e,t){for(const n of dt(e.component.selection??{}))for(const i of Td)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function xX(e,t){for(const n of e.children)Be(n)&&(t=yO(n,t));return t}function vX(e,t,n,i){const r=WO(e,t.param,t);return{signal:In(n.get("type"))&&D(i)&&i[0]>i[1]?`isValid(${r}) && reverse(${r})`:r}}function hb(e){return e.map(t=>(t.on&&!t.on.length&&delete t.on,t))}const Ui={defined:e=>e.type==="interval"&&e.resolve==="global"&&e.bind&&e.bind==="scales",parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!Si(r))continue;const s=e.getScaleComponent(r),a=s?s.get("type"):void 0;if(a=="sequential"&&M(tW),!s||!In(a)){M(eW);continue}s.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter(a=>n.filter(o=>o.name===a.signals.data).length===0);if(!e.parent||Mg(e)||i.length===0)return n;const r=n.find(a=>a.name===t.name);let s=r.update;if(s.includes(TO))r.update=`{${i.map(a=>`${P(bn(a.field))}: ${a.signals.data}`).join(", ")}}`;else{for(const a of i){const o=`${P(bn(a.field))}: ${a.signals.data}`;s.includes(o)||(s=`${s.substring(0,s.length-1)}, ${o}}`)}r.update=s}return n.concat(i.map(a=>({name:a.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!Mg(e))for(const i of t.scales){const r=n.find(s=>s.name===i.signals.data);r.push="outer",delete r.value,delete r.update}return n}};function Ng(e,t){return`domain(${P(e.scaleName(t))})`}function Mg(e){return e.parent&&ho(e.parent)&&(!e.parent.parent||Mg(e.parent.parent))}const xa="_brush",bO="_scale_trigger",ko="geo_interval_init_tick",xO="_init",EX="_center",AX={defined:e=>e.type==="interval",parse:(e,t,n)=>{var i;if(e.hasProjection){const r={...j(n.select)?n.select:{}};r.fields=[jn],r.encodings||(r.encodings=n.value?_(n.value):[Yn,Xn]),n.select={type:"interval",...r}}if(t.translate&&!Ui.defined(t)){const r=`!event.item || event.item.mark.name !== ${P(t.name+xa)}`;for(const s of t.events){if(!s.between){M(`${s} is not an ordered event stream for interval selections.`);continue}const a=W((i=s.between[0]).filter??(i.filter=[]));a.includes(r)||a.push(r)}}},signals:(e,t,n)=>{const i=t.name,r=i+Hi,s=dt(t.project.hasChannel).filter(o=>o.channel===Me||o.channel===rt),a=t.init?t.init[0]:null;if(n.push(...s.reduce((o,u)=>o.concat(CX(e,t,u,a&&a[u.index])),[])),e.hasProjection){const o=P(e.projectionName()),u=e.projectionName()+EX,{x:l,y:c}=t.project.hasChannel,f=l&&l.signals.visual,d=c&&c.signals.visual,p=l?a&&a[l.index]:`${u}[0]`,h=c?a&&a[c.index]:`${u}[1]`,g=E=>e.getSizeSignalRef(E).signal,m=`[[${f?f+"[0]":"0"}, ${d?d+"[0]":"0"}],[${f?f+"[1]":g("width")}, ${d?d+"[1]":g("height")}]]`;a&&(n.unshift({name:i+xO,init:`[scale(${o}, [${l?p[0]:p}, ${c?h[0]:h}]), scale(${o}, [${l?p[1]:p}, ${c?h[1]:h}])]`}),(!l||!c)&&(n.find(C=>C.name===u)||n.unshift({name:u,update:`invert(${o}, [${g("width")}/2, ${g("height")}/2])`})));const y=`intersect(${m}, {markname: ${P(e.getName("marks"))}}, unit.mark)`,b=`{unit: ${hs(e)}}`,v=`vlSelectionTuples(${y}, ${b})`,A=s.map(E=>E.signals.visual);return n.concat({name:r,on:[{events:[...A.length?[{signal:A.join(" || ")}]:[],...a?[{signal:ko}]:[]],update:v}]})}else{if(!Ui.defined(t)){const l=i+bO,c=s.map(f=>{const d=f.channel,{data:p,visual:h}=f.signals,g=P(e.scaleName(d)),m=e.getScaleComponent(d).get("type"),y=In(m)?"+":"";return`(!isArray(${p}) || (${y}invert(${g}, ${h})[0] === ${y}${p}[0] && ${y}invert(${g}, ${h})[1] === ${y}${p}[1]))`});c.length&&n.push({name:l,value:{},on:[{events:s.map(f=>({scale:e.scaleName(f.channel)})),update:c.join(" && ")+` ? ${l} : {}`}]})}const o=s.map(l=>l.signals.data),u=`unit: ${hs(e)}, fields: ${i+hl}, values`;return n.concat({name:r,...a?{init:`{${u}: ${Os(a)}}`}:{},...o.length?{on:[{events:[{signal:o.join(" || ")}],update:`${o.join(" && ")} ? {${u}: [${o}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>(Be(e)&&e.hasProjection&&t.init&&(n.filter(r=>r.name===ko).length||n.unshift({name:ko,value:null,on:[{events:"timer{1}",update:`${ko} === null ? {} : ${ko}`}]})),n),marks:(e,t,n)=>{const i=t.name,{x:r,y:s}=t.project.hasChannel,a=r?.signals.visual,o=s?.signals.visual,u=`data(${P(t.name+Rs)})`;if(Ui.defined(t)||!r&&!s)return n;const l={x:r!==void 0?{signal:`${a}[0]`}:{value:0},y:s!==void 0?{signal:`${o}[0]`}:{value:0},x2:r!==void 0?{signal:`${a}[1]`}:{field:{group:"width"}},y2:s!==void 0?{signal:`${o}[1]`}:{field:{group:"height"}}};if(t.resolve==="global")for(const m of _(l))l[m]=[{test:`${u}.length && ${u}[0].unit === ${hs(e)}`,...l[m]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...p}=t.mark,h=_(p).reduce((m,y)=>(m[y]=[{test:[r!==void 0&&`${a}[0] !== ${a}[1]`,s!==void 0&&`${o}[0] !== ${o}[1]`].filter(b=>b).join(" && "),value:p[y]},{value:null}],m),{}),g=d??(t.translate?"move":null);return[{name:`${i+xa}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:l}},...n,{name:i+xa,type:"rect",clip:!0,encode:{enter:{...g?{cursor:{value:g}}:{},fill:{value:"transparent"}},update:{...l,...h}}}]}};function CX(e,t,n,i){const r=!e.hasProjection,s=n.channel,a=n.signals.visual,o=P(r?e.scaleName(s):e.projectionName()),u=d=>`scale(${o}, ${d})`,l=e.getSizeSignalRef(s===Me?"width":"height").signal,c=`${s}(unit)`,f=t.events.reduce((d,p)=>[...d,{events:p.between[0],update:`[${c}, ${c}]`},{events:p,update:`[${a}[0], clamp(${c}, 0, ${l})]`}],[]);if(r){const d=n.signals.data,p=Ui.defined(t),h=e.getScaleComponent(s),g=h?h.get("type"):void 0,m=i?{init:Os(i,!0,u)}:{value:[]};return f.push({events:{signal:t.name+bO},update:In(g)?`[${u(`${d}[0]`)}, ${u(`${d}[1]`)}]`:"[0, 0]"}),p?[{name:d,on:[]}]:[{name:a,...m,on:f},{name:d,...i?{init:Os(i)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${o}, ${a})`}]}]}else{const d=s===Me?0:1,p=t.name+xO,h=i?{init:`[${p}[0][${d}], ${p}[1][${d}]]`}:{value:[]};return[{name:a,...h,on:f}]}}function uo({model:e,channelDef:t,vgChannel:n,invalidValueRef:i,mainRefFn:r}){const s=ll(t)&&t.condition;let a=[];s&&(a=W(s).map(l=>{const c=r(l);if(cH(l)){const{param:f,empty:d}=l;return{test:qO(e,{param:f,empty:d}),...c}}else return{test:sf(e,l.test),...c}})),i!==void 0&&a.push(i);const o=r(t);return o!==void 0&&a.push(o),a.length>1||a.length===1&&a[0].test?{[n]:a}:a.length===1?{[n]:a[0]}:{}}function pb(e,t="text"){const n=e.encoding[t];return uo({model:e,channelDef:n,vgChannel:t,mainRefFn:i=>_d(i,e.config),invalidValueRef:void 0})}function _d(e,t,n="datum"){if(e){if(zn(e))return Re(e.value);if(re(e)){const{format:i,formatType:r}=Jc(e);return Xy({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function vO(e,t={}){const{encoding:n,markDef:i,config:r,stack:s}=e,a=n.tooltip;if(D(a))return{tooltip:VE({tooltip:a},s,r,t)};{const o=t.reactiveGeom?"datum.datum":"datum";return uo({model:e,channelDef:a,vgChannel:"tooltip",mainRefFn:l=>{const c=_d(l,r,o);if(c)return c;if(l===null)return;let f=Ce("tooltip",i,r);if(f===!0&&(f={content:"encoding"}),q(f))return{value:f};if(j(f))return Q(f)?f:f.content==="encoding"?VE(n,s,r,t):{signal:o}},invalidValueRef:void 0})}}function EO(e,t,n,{reactiveGeom:i}={}){const r={...n,...n.tooltipFormat},s=new Set,a=i?"datum.datum":"datum",o=[];function u(c,f){const d=qs(f),p=Nt(c)?c:{...c,type:e[d].type},h=p.title||Qy(p,r),g=W(h).join(", ").replaceAll(/"/g,'\\"');let m;if(je(f)){const y=f==="x"?"x2":"y2",b=Un(e[y]);if(st(p.bin)&&b){const v=U(p,{expr:a}),A=U(b,{expr:a}),{format:E,formatType:C}=Jc(p);m=ol(v,A,E,C,r),s.add(y)}}if((je(f)||f===En||f===Vn)&&t&&t.fieldChannel===f&&t.offset==="normalize"){const{format:y,formatType:b}=Jc(p);m=Xy({fieldOrDatumDef:p,format:y,formatType:b,expr:a,config:r,normalizeStack:!0}).signal}m??(m=_d(p,r,a).signal),o.push({channel:f,key:g,value:m})}eb(e,(c,f)=>{B(c)?u(c,f):Ad(c)&&u(c.condition,f)});const l={};for(const{channel:c,key:f,value:d}of o)!s.has(c)&&!l[f]&&(l[f]=d);return l}function VE(e,t,n,{reactiveGeom:i}={}){const r=EO(e,t,n,{reactiveGeom:i}),s=Or(r).map(([a,o])=>`"${a}": ${o}`);return s.length>0?{signal:`{${s.join(", ")}}`}:void 0}function wX(e){const{markDef:t,config:n}=e,i=Ce("aria",t,n);return i===!1?{}:{...i?{aria:i}:{},...FX(e),...SX(e)}}function FX(e){const{mark:t,markDef:n,config:i}=e;if(i.aria===!1)return{};const r=Ce("ariaRoleDescription",n,i);return r!=null?{ariaRoleDescription:{value:r}}:H(Vq,t)?{}:{ariaRoleDescription:{value:t}}}function SX(e){const{encoding:t,markDef:n,config:i,stack:r}=e,s=t.description;if(s)return uo({model:e,channelDef:s,vgChannel:"description",mainRefFn:u=>_d(u,e.config),invalidValueRef:void 0});const a=Ce("description",n,i);if(a!=null)return{description:Re(a)};if(i.aria===!1)return{};const o=EO(t,r,i);if(!we(o))return{description:{signal:Or(o).map(([u,l],c)=>`"${c>0?"; ":""}${u}: " + (${l})`).join(" + ")}}}function ut(e,t,n={}){const{markDef:i,encoding:r,config:s}=t,{vgChannel:a}=n;let{defaultRef:o,defaultValue:u}=n;const l=r[e];o===void 0&&(u??(u=Ce(e,i,s,{vgChannel:a,ignoreVgConfig:!ll(l)})),u!==void 0&&(o=Re(u)));const c={markDef:i,config:s,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},f=uD({...c,scaleChannel:e,channelDef:l});return uo({model:t,channelDef:l,vgChannel:a??e,invalidValueRef:f,mainRefFn:p=>Vy({...c,channel:e,channelDef:p,stack:null,defaultRef:o})})}function AO(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:s}=n,a=t.filled??Ce("filled",n,r),o=ue(["bar","point","circle","square","geoshape"],s)?"transparent":void 0,u=Ce(a===!0?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[a===!0&&"color"]??o,l=Ce(a===!1?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[a===!1&&"color"],c=a?"fill":"stroke",f={...u?{fill:Re(u)}:{},...l?{stroke:Re(l)}:{}};return n.color&&(a?n.fill:n.stroke)&&M(Tk("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...ut("color",e,{vgChannel:c,defaultValue:a?u:l}),...ut("fill",e,{defaultValue:i.fill?u:void 0}),...ut("stroke",e,{defaultValue:i.stroke?l:void 0})}}function $X(e){const{encoding:t,mark:n}=e,i=t.order;return!Gr(n)&&zn(i)?uo({model:e,channelDef:i,vgChannel:"zindex",mainRefFn:r=>Re(r.value),invalidValueRef:void 0}):{}}function Ua({channel:e,markDef:t,encoding:n={},model:i,bandPosition:r}){const s=`${e}Offset`,a=t[s],o=n[s];if((s==="xOffset"||s==="yOffset")&&o)return{offsetType:"encoding",offset:Vy({channel:s,channelDef:o,markDef:t,config:i?.config,scaleName:i.scaleName(s),scale:i.getScaleComponent(s),stack:null,defaultRef:Re(a),bandPosition:r})};const u=t[s];return u?{offsetType:"visual",offset:u}:{}}function _t(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:s,config:a,stack:o}=t,u=r[e],l=r[Fi(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:p}=Ua({channel:e,markDef:s,encoding:r,model:t,bandPosition:.5}),h=gb({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),g=!u&&je(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:kX({channel:e,channelDef:u,channel2Def:l,markDef:s,config:a,scaleName:c,scale:f,stack:o,offset:d,defaultRef:h,bandPosition:p==="encoding"?0:void 0});return g?{[i||e]:g}:void 0}function kX(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:s,markDef:a}=e;if(re(n)&&r&&t===r.fieldChannel){if(B(n)){let o=n.bandPosition;if(o===void 0&&a.type==="text"&&(t==="radius"||t==="theta")&&(o=.5),o!==void 0)return Xc({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:o,offset:s})}return fs(n,i,{suffix:"end"},{offset:s})}return Hy(e)}function gb({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:s,config:a}=e;return()=>{const o=qs(n),u=Rr(n),l=Ce(n,s,a,{vgChannel:u});if(l!==void 0)return iu(n,l);switch(t){case"zeroOrMin":return XE({scaleName:i,scale:r,mode:"zeroOrMin",mainChannel:o,config:a});case"zeroOrMax":return XE({scaleName:i,scale:r,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:o,config:a});case"mid":return{...e[Ht(n)],mult:.5}}}}function XE({mainChannel:e,config:t,...n}){const i=oD(n),{mode:r}=n;if(i)return i;switch(e){case"radius":{if(r==="zeroOrMin")return{value:0};const{widthSignal:s,heightSignal:a}=r.zeroOrMax;return{signal:`min(${s},${a})/2`}}case"theta":return r==="zeroOrMin"?{value:0}:{signal:"2*PI"};case"x":return r==="zeroOrMin"?{value:0}:{field:{group:"width"}};case"y":return r==="zeroOrMin"?{field:{group:"height"}}:{value:0}}}const DX={left:"x",center:"xc",right:"x2"},OX={top:"y",middle:"yc",bottom:"y2"};function CO(e,t,n,i="middle"){if(e==="radius"||e==="theta")return Rr(e);const r=e==="x"?"align":"baseline",s=Ce(r,t,n);let a;return Q(s)?(M(kW(r)),a=void 0):a=s,e==="x"?DX[a||(i==="top"?"left":"center")]:OX[a||i]}function tf(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?wO(e,t,{defaultPos:n,defaultPos2:i}):_t(e,t,{defaultPos:n})}function wO(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:s}=t,a=Fi(e),o=Ht(e),u=RX(t,i,a),l=u[o]?CO(e,r,s):Rr(e);return{..._t(e,t,{defaultPos:n,vgChannel:l}),...u}}function RX(e,t,n){const{encoding:i,mark:r,markDef:s,stack:a,config:o}=e,u=qs(n),l=Ht(n),c=Rr(n),f=i[u],d=e.scaleName(u),p=e.getScaleComponent(u),{offset:h}=n in i||n in s?Ua({channel:n,markDef:s,encoding:i,model:e}):Ua({channel:u,markDef:s,encoding:i,model:e});if(!f&&(n==="x2"||n==="y2")&&(i.latitude||i.longitude)){const m=Ht(n),y=e.markDef[m];return y!=null?{[m]:{value:y}}:{[c]:{field:e.getName(n)}}}const g=_X({channel:n,channelDef:f,channel2Def:i[n],markDef:s,config:o,scaleName:d,scale:p,stack:a,offset:h,defaultRef:void 0});return g!==void 0?{[c]:g}:Ml(n,s)||Ml(n,{[n]:Ag(n,s,o.style),[l]:Ag(l,s,o.style)})||Ml(n,o[r])||Ml(n,o.mark)||{[c]:gb({model:e,defaultPos:t,channel:n,scaleName:d,scale:p})()}}function _X({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:s,scale:a,stack:o,offset:u,defaultRef:l}){return re(t)&&o&&e.charAt(0)===o.fieldChannel.charAt(0)?fs(t,s,{suffix:"start"},{offset:u}):Hy({channel:e,channelDef:n,scaleName:s,scale:a,stack:o,markDef:i,config:r,offset:u,defaultRef:l})}function Ml(e,t){const n=Ht(e),i=Rr(e);if(t[i]!==void 0)return{[i]:iu(e,t[i])};if(t[e]!==void 0)return{[i]:iu(e,t[e])};if(t[n]){const r=t[n];if(ks(r))M(AW(n));else return{[n]:iu(e,r)}}}function Gi(e,t){const{config:n,encoding:i,markDef:r}=e,s=r.type,a=Fi(t),o=Ht(t),u=i[t],l=i[a],c=e.getScaleComponent(t),f=c?c.get("type"):void 0,d=r.orient,p=i[o]??i.size??Ce("size",r,n,{vgChannel:o}),h=yk(t),g=s==="bar"&&(t==="x"?d==="vertical":d==="horizontal")||s==="tick"&&(t==="y"?d==="vertical":d==="horizontal");return B(u)&&(De(u.bin)||st(u.bin)||u.timeUnit&&!l)&&!(p&&!ks(p))&&!i[h]&&!it(f)?MX({fieldDef:u,fieldDef2:l,channel:t,model:e}):(re(u)&&it(f)||g)&&!l?NX(u,t,e):wO(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function TX(e,t,n,i,r,s,a){if(ks(r))if(n){const u=n.get("type");if(u==="band"){let l=`bandwidth('${t}')`;r.band!==1&&(l=`${r.band} * ${l}`);const c=gi("minBandSize",{type:a},i);return{signal:c?`max(${_n(c)}, ${l})`:l}}else r.band!==1&&(M(_W(u)),r=void 0)}else return{mult:r.band,field:{group:e}};else{if(Q(r))return r;if(r)return{value:r}}if(n){const u=n.get("range");if(Gs(u)&&ge(u.step))return{value:u.step-2}}if(!s){const{bandPaddingInner:u,barBandPaddingInner:l,rectBandPaddingInner:c,tickBandPaddingInner:f}=i.scale,d=Ue(u,a==="tick"?f:a==="bar"?l:c);if(Q(d))return{signal:`(1 - (${d.signal})) * ${e}`};if(ge(d))return{signal:`${1-d} * ${e}`}}return{value:Dg(i.view,e)-2}}function NX(e,t,n){const{markDef:i,encoding:r,config:s,stack:a}=n,o=i.orient,u=n.scaleName(t),l=n.getScaleComponent(t),c=Ht(t),f=Fi(t),d=yk(t),p=n.scaleName(d),h=n.getScaleComponent(xy(t)),g=i.type==="tick"||o==="horizontal"&&t==="y"||o==="vertical"&&t==="x";let m;(r.size||i.size)&&(g?m=ut("size",n,{vgChannel:c,defaultRef:Re(i.size)}):M(LW(i.type)));const y=!!m,b=gD({channel:t,fieldDef:e,markDef:i,config:s,scaleType:(l||h)?.get("type"),useVlSizeChannel:g});m=m||{[c]:TX(c,p||u,h||l,s,b,!!e,i.type)};const v=(l||h)?.get("type")==="band"&&ks(b)&&!y?"top":"middle",A=CO(t,i,s,v),E=A==="xc"||A==="yc",{offset:C,offsetType:x}=Ua({channel:t,markDef:i,encoding:r,model:n,bandPosition:E?.5:0}),w=Hy({channel:t,channelDef:e,markDef:i,config:s,scaleName:u,scale:l,stack:a,offset:C,defaultRef:gb({model:n,defaultPos:"mid",channel:t,scaleName:u,scale:l}),bandPosition:E?x==="encoding"?0:.5:Q(b)?{signal:`(1-${b})/2`}:ks(b)?(1-b.band)/2:0});if(c)return{[A]:w,...m};{const R=Rr(f),L=m[c],J=C?{...L,offset:C}:L;return{[A]:w,[R]:D(w)?[w[0],{...w[1],offset:J}]:{...w,offset:J}}}}function YE(e,t,n,i,r,s,a){if(fk(e))return 0;const o=e==="x"||e==="y2",u=o?-t/2:t/2;if(Q(n)||Q(r)||Q(i)||s){const l=_n(n),c=_n(r),f=_n(i),d=_n(s),h=s?`(${a} < ${d} ? ${o?"":"-"}0.5 * (${d} - (${a})) : ${u})`:u,g=f?`${f} + `:"",m=l?`(${l} ? -1 : 1) * `:"",y=c?`(${c} + ${h})`:h;return{signal:g+m+y}}else return r=r||0,i+(n?-r-u:+r+u)}function MX({fieldDef:e,fieldDef2:t,channel:n,model:i}){const{config:r,markDef:s,encoding:a}=i,o=i.getScaleComponent(n),u=i.scaleName(n),l=o?o.get("type"):void 0,c=o.get("reverse"),f=gD({channel:n,fieldDef:e,markDef:s,config:r,scaleType:l}),p=i.component.axes[n]?.[0]?.get("translate")??.5,h=je(n)?Ce("binSpacing",s,r)??0:0,g=Fi(n),m=Rr(n),y=Rr(g),b=gi("minBandSize",s,r),{offset:v}=Ua({channel:n,markDef:s,encoding:a,model:i,bandPosition:0}),{offset:A}=Ua({channel:g,markDef:s,encoding:a,model:i,bandPosition:0}),E=rH({fieldDef:e,scaleName:u}),C=YE(n,h,c,p,v,b,E),x=YE(g,h,c,p,A??v,b,E),w=Q(f)?{signal:`(1-${f.signal})/2`}:ks(f)?(1-f.band)/2:.5,R=_r({fieldDef:e,fieldDef2:t,markDef:s,config:r});if(De(e.bin)||e.timeUnit){const L=e.timeUnit&&R!==.5;return{[y]:KE({fieldDef:e,scaleName:u,bandPosition:w,offset:x,useRectOffsetField:L}),[m]:KE({fieldDef:e,scaleName:u,bandPosition:Q(w)?{signal:`1-${w.signal}`}:1-w,offset:C,useRectOffsetField:L})}}else if(st(e.bin)){const L=fs(e,u,{},{offset:x});if(B(t))return{[y]:L,[m]:fs(t,u,{},{offset:C})};if(Ws(e.bin)&&e.bin.step)return{[y]:L,[m]:{signal:`scale("${u}", ${U(e,{expr:"datum"})} + ${e.bin.step})`,offset:C}}}M(Lk(g))}function KE({fieldDef:e,scaleName:t,bandPosition:n,offset:i,useRectOffsetField:r}){return Xc({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i,...r?{startSuffix:Od,endSuffix:Rd}:{}})}const LX=new Set(["aria","width","height"]);function An(e,t){const{fill:n=void 0,stroke:i=void 0}=t.color==="include"?AO(e):{};return{...BX(e.markDef,t),...JE("fill",n),...JE("stroke",i),...ut("opacity",e),...ut("fillOpacity",e),...ut("strokeOpacity",e),...ut("strokeWidth",e),...ut("strokeDash",e),...$X(e),...vO(e),...pb(e,"href"),...wX(e)}}function JE(e,t){return t?{[e]:t}:{}}function BX(e,t){return Hq.reduce((n,i)=>(!LX.has(i)&&T(e,i)&&t[i]!=="ignore"&&(n[i]=Re(e[i])),n),{})}function mb(e){const{config:t,markDef:n}=e,i=new Set;if(e.forEachFieldDef((r,s)=>{let a;if(!Si(s)||!(a=e.getScaleType(s)))return;const o=fd(r.aggregate),u=Gy({scaleChannel:s,markDef:n,config:t,scaleType:a,isCountAggregate:o});if(tH(u)){const l=e.vgField(s,{expr:"datum",binSuffix:e.stack?.impute?"mid":void 0});l&&i.add(l)}}),i.size>0)return{defined:{signal:[...i].map(s=>gd(s,!0)).join(" && ")}}}function QE(e,t){if(t!==void 0)return{[e]:Re(t)}}const Gh="voronoi",FO={defined:e=>e.type==="point"&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(Gh)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,s=e.mark;if(Gr(s))return M(Qq(s)),n;const a={name:e.getName(Gh),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...vO(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let o=0,u=!1;return n.forEach((l,c)=>{const f=l.name??"";f===e.component.mark[0].name?o=c:f.includes(Gh)&&(u=!0)}),u||n.splice(o+1,0,a),n}},SO={defined:e=>e.type==="point"&&e.resolve==="global"&&e.bind&&e.bind!=="scales"&&!ab(e.bind),parse:(e,t,n)=>NO(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,s=t.bind,a=t.init&&t.init[0],o=FO.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach((u,l)=>{const c=Ne(`${i}_${u.field}`);n.filter(d=>d.name===c).length||n.unshift({name:c,...a?{init:Os(a[l])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${o}[${P(u.field)}] : null`}]:[],bind:s[u.field]??s[u.channel]??s})}),n},signals:(e,t,n)=>{const i=t.name,r=t.project,s=n.find(l=>l.name===i+Hi),a=i+hl,o=r.items.map(l=>Ne(`${i}_${l.field}`)),u=o.map(l=>`${l} !== null`).join(" && ");return o.length&&(s.update=`${u} ? {fields: ${a}, values: [${o.join(", ")}]} : null`),delete s.value,delete s.on,n}},nf="_toggle",$O={defined:e=>e.type==="point"&&!ci(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+nf,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Hi,i=t.name+nf;return`${i} ? null : ${n}, `+(t.resolve==="global"?`${i} ? null : true, `:`${i} ? null : {unit: ${hs(e)}}, `)+`${i} ? ${n} : null`}},PX={defined:e=>e.clear!==void 0&&e.clear!==!1&&!ci(e),parse:(e,t)=>{t.clear&&(t.clear=q(t.clear)?Br(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(SO.defined(t))for(const i of t.project.items){const r=n.findIndex(s=>s.name===Ne(`${t.name}_${i.field}`));r!==-1&&n[r].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(r,s){r!==-1&&n[r].on&&n[r].on.push({events:t.clear,update:s})}if(t.type==="interval")for(const r of t.project.items){const s=n.findIndex(a=>a.name===r.signals.visual);if(i(s,"[0, 0]"),s===-1){const a=n.findIndex(o=>o.name===r.signals.data);i(a,"null")}}else{let r=n.findIndex(s=>s.name===t.name+Hi);i(r,"null"),$O.defined(t)&&(r=n.findIndex(s=>s.name===t.name+nf),i(r,"false"))}return n}},kO={defined:e=>{const t=e.resolve==="global"&&e.bind&&ab(e.bind),n=e.project.items.length===1&&e.project.items[0].field!==jn;return t&&!n&&M(nW),t&&n},parse:(e,t,n)=>{const i=ie(n);if(i.select=q(i.select)?{type:i.select,toggle:t.toggle}:{...i.select,toggle:t.toggle},NO(t,i),j(n.select)&&(n.select.on||n.select.clear)){const a='event.item && indexof(event.item.mark.role, "legend") < 0';for(const o of t.events)o.filter=W(o.filter??[]),o.filter.includes(a)||o.filter.push(a)}const r=Ih(t.bind)?t.bind.legend:"click",s=q(r)?Br(r,"view"):W(r);t.bind={legend:{merge:s}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=Ih(t.bind)&&t.bind.legend,s=a=>o=>{const u=ie(o);return u.markname=a,u};for(const a of t.project.items){if(!a.hasLegend)continue;const o=`${Ne(a.field)}_legend`,u=`${i}_${o}`;if(n.filter(c=>c.name===u).length===0){const c=r.merge.map(s(`${o}_symbols`)).concat(r.merge.map(s(`${o}_labels`))).concat(r.merge.map(s(`${o}_entries`)));n.unshift({name:u,...t.init?{}:{value:null},on:[{events:c,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,s=n.find(d=>d.name===i+Hi),a=i+hl,o=r.items.filter(d=>d.hasLegend).map(d=>Ne(`${i}_${Ne(d.field)}_legend`)),l=`${o.map(d=>`${d} !== null`).join(" && ")} ? {fields: ${a}, values: [${o.join(", ")}]} : null`;t.events&&o.length>0?s.on.push({events:o.map(d=>({signal:d})),update:l}):o.length>0&&(s.update=l,delete s.value,delete s.on);const c=n.find(d=>d.name===i+nf),f=Ih(t.bind)&&t.bind.legend;return c&&(t.events?c.on.push({...c.on[0],events:f}):c.on[0].events=f),n}};function IX(e,t,n){const i=e.fieldDef(t)?.field;for(const r of dt(e.component.selection??{})){const s=r.project.hasField[i]??r.project.hasChannel[t];if(s&&kO.defined(r)){const a=n.get("selections")??[];a.push(r.name),n.set("selections",a,!1),s.hasLegend=!0}}}const DO="_translate_anchor",OO="_translate_delta",zX={defined:e=>e.type==="interval"&&e.translate,signals:(e,t,n)=>{const i=t.name,r=Ui.defined(t),s=i+DO,{x:a,y:o}=t.project.hasChannel;let u=Br(t.translate,"scope");return r||(u=u.map(l=>(l.between[0].markname=i+xa,l))),n.push({name:s,value:{},on:[{events:u.map(l=>l.between[0]),update:"{x: x(unit), y: y(unit)"+(a!==void 0?`, extent_x: ${r?Ng(e,Me):`slice(${a.signals.visual})`}`:"")+(o!==void 0?`, extent_y: ${r?Ng(e,rt):`slice(${o.signals.visual})`}`:"")+"}"}]},{name:i+OO,value:{},on:[{events:u,update:`{x: ${s}.x - x(unit), y: ${s}.y - y(unit)}`}]}),a!==void 0&&ZE(e,t,a,"width",n),o!==void 0&&ZE(e,t,o,"height",n),n}};function ZE(e,t,n,i,r){const s=t.name,a=s+DO,o=s+OO,u=n.channel,l=Ui.defined(t),c=r.find(E=>E.name===n.signals[l?"data":"visual"]),f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(u),p=d&&d.get("type"),h=d&&d.get("reverse"),g=l?u===Me?h?"":"-":h?"-":"":"",m=`${a}.extent_${u}`,y=`${g}${o}.${u} / ${l?`${f}`:`span(${m})`}`,b=!l||!d?"panLinear":p==="log"?"panLog":p==="symlog"?"panSymlog":p==="pow"?"panPow":"panLinear",v=l?p==="pow"?`, ${d.get("exponent")??1}`:p==="symlog"?`, ${d.get("constant")??1}`:"":"",A=`${b}(${m}, ${y}${v})`;c.on.push({events:{signal:o},update:l?A:`clampRange(${A}, 0, ${f})`})}const RO="_zoom_anchor",_O="_zoom_delta",UX={defined:e=>e.type==="interval"&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=Ui.defined(t),s=i+_O,{x:a,y:o}=t.project.hasChannel,u=P(e.scaleName(Me)),l=P(e.scaleName(rt));let c=Br(t.zoom,"scope");return r||(c=c.map(f=>(f.markname=i+xa,f))),n.push({name:i+RO,on:[{events:c,update:r?"{"+[u?`x: invert(${u}, x(unit))`:"",l?`y: invert(${l}, y(unit))`:""].filter(f=>f).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:s,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),a!==void 0&&eA(e,t,a,"width",n),o!==void 0&&eA(e,t,o,"height",n),n}};function eA(e,t,n,i,r){const s=t.name,a=n.channel,o=Ui.defined(t),u=r.find(b=>b.name===n.signals[o?"data":"visual"]),l=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(a),f=c&&c.get("type"),d=o?Ng(e,a):u.name,p=s+_O,h=`${s}${RO}.${a}`,g=!o||!c?"zoomLinear":f==="log"?"zoomLog":f==="symlog"?"zoomSymlog":f==="pow"?"zoomPow":"zoomLinear",m=o?f==="pow"?`, ${c.get("exponent")??1}`:f==="symlog"?`, ${c.get("constant")??1}`:"":"",y=`${g}(${d}, ${h}, ${p}${m})`;u.on.push({events:{signal:p},update:o?y:`clampRange(${y}, 0, ${l})`})}const Rs="_store",Hi="_tuple",jX="_modify",TO="vlSelectionResolve",Td=[pX,AX,fX,$O,SO,Ui,kO,PX,zX,UX,FO];function qX(e){let t=e.parent;for(;t&&!tn(t);)t=t.parent;return t}function hs(e,{escape:t}={escape:!0}){let n=t?P(e.name):e.name;const i=qX(e);if(i){const{facet:r}=i;for(const s of fn)r[s]&&(n+=` + '__facet_${s}_' + (facet[${P(i.vgField(s))}])`)}return n}function yb(e){return dt(e.component.selection??{}).reduce((t,n)=>t||n.project.hasSelectionId,!1)}function NO(e,t){(q(t.select)||!t.select.on)&&delete e.events,(q(t.select)||!t.select.clear)&&delete e.clear,(q(t.select)||!t.select.toggle)&&delete e.toggle}function ci(e){return e.events?.find(t=>"type"in t&&t.type==="timer")}const WX="RawCode",GX="Literal",HX="Property",VX="Identifier",XX="ArrayExpression",YX="BinaryExpression",KX="CallExpression",JX="ConditionalExpression",QX="LogicalExpression",ZX="MemberExpression",eY="ObjectExpression",tY="UnaryExpression";function Jn(e){this.type=e}Jn.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=nY(this),n=0,i=t.length;n";ki[_s]="Identifier";ki[Hr]="Keyword";ki[Md]="Null";ki[Ys]="Numeric";ki[Bt]="Punctuator";ki[gl]="String";ki[iY]="RegularExpression";var rY="ArrayExpression",sY="BinaryExpression",aY="CallExpression",oY="ConditionalExpression",MO="Identifier",uY="Literal",lY="LogicalExpression",cY="MemberExpression",fY="ObjectExpression",dY="Property",hY="UnaryExpression",tt="Unexpected token %0",pY="Unexpected number",gY="Unexpected string",mY="Unexpected identifier",yY="Unexpected reserved word",bY="Unexpected end of input",Lg="Invalid regular expression",Hh="Invalid regular expression: missing /",LO="Octal literals are not allowed in strict mode.",xY="Duplicate data property in object literal not allowed in strict mode",ct="ILLEGAL",Fu="Disabled.",vY=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),EY=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function Ld(e,t){if(!e)throw new Error("ASSERT: "+t)}function Mi(e){return e>=48&&e<=57}function bb(e){return"0123456789abcdefABCDEF".includes(e)}function ru(e){return"01234567".includes(e)}function AY(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function Su(e){return e===10||e===13||e===8232||e===8233}function ml(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&vY.test(String.fromCharCode(e))}function rf(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&EY.test(String.fromCharCode(e))}const CY={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function BO(){for(;k1114111||e!=="}")&&pe({},tt,ct),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,i=(t-65536&1023)+56320,String.fromCharCode(n,i))}function PO(){var e,t;for(e=K.charCodeAt(k++),t=String.fromCharCode(e),e===92&&(K.charCodeAt(k)!==117&&pe({},tt,ct),++k,e=Bg("u"),(!e||e==="\\"||!ml(e.charCodeAt(0)))&&pe({},tt,ct),t=e);k>>=")return k+=4,{type:Bt,value:a,start:e,end:k};if(s=a.substr(0,3),s===">>>"||s==="<<="||s===">>=")return k+=3,{type:Bt,value:s,start:e,end:k};if(r=s.substr(0,2),i===r[1]&&"+-<>&|".includes(i)||r==="=>")return k+=2,{type:Bt,value:r,start:e,end:k};if(r==="//"&&pe({},tt,ct),"<>=!+-*%&|^/".includes(i))return++k,{type:Bt,value:i,start:e,end:k};pe({},tt,ct)}function $Y(e){let t="";for(;k{if(parseInt(r,16)<=1114111)return"x";pe({},Lg)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch{pe({},Lg)}try{return new RegExp(e,t)}catch{return null}}function RY(){var e,t,n,i,r;for(e=K[k],Ld(e==="/","Regular expression literal must start with a slash"),t=K[k++],n=!1,i=!1;k=0&&pe({},Lg,n),{value:n,literal:t}}function TY(){var e,t,n,i;return Ee=null,BO(),e=k,t=RY(),n=_Y(),i=OY(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:k}}function NY(e){return e.type===_s||e.type===Hr||e.type===Nd||e.type===Md}function IO(){if(BO(),k>=Ft)return{type:pl,start:k,end:k};const e=K.charCodeAt(k);return ml(e)?SY():e===40||e===41||e===59?Vh():e===39||e===34?DY():e===46?Mi(K.charCodeAt(k+1))?tA():Vh():Mi(e)?tA():Vh()}function It(){const e=Ee;return k=e.end,Ee=IO(),k=e.end,e}function zO(){const e=k;Ee=IO(),k=e}function MY(e){const t=new Jn(rY);return t.elements=e,t}function nA(e,t,n){const i=new Jn(e==="||"||e==="&&"?lY:sY);return i.operator=e,i.left=t,i.right=n,i}function LY(e,t){const n=new Jn(aY);return n.callee=e,n.arguments=t,n}function BY(e,t,n){const i=new Jn(oY);return i.test=e,i.consequent=t,i.alternate=n,i}function xb(e){const t=new Jn(MO);return t.name=e,t}function Go(e){const t=new Jn(uY);return t.value=e.value,t.raw=K.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function iA(e,t,n){const i=new Jn(cY);return i.computed=e==="[",i.object=t,i.property=n,i.computed||(n.member=!0),i}function PY(e){const t=new Jn(fY);return t.properties=e,t}function rA(e,t,n){const i=new Jn(dY);return i.key=t,i.value=n,i.kind=e,i}function IY(e,t){const n=new Jn(hY);return n.operator=e,n.argument=t,n.prefix=!0,n}function pe(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,(s,a)=>(Ld(a":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11;break}return t}function JY(){var e,t,n,i,r,s,a,o,u,l;if(e=Ee,u=gc(),i=Ee,r=oA(i),r===0)return u;for(i.prec=r,It(),t=[e,Ee],a=gc(),s=[u,i,a];(r=oA(Ee))>0;){for(;s.length>2&&r<=s[s.length-2].prec;)a=s.pop(),o=s.pop().value,u=s.pop(),t.pop(),n=nA(o,u,a),s.push(n);i=It(),i.prec=r,s.push(i),t.push(Ee),n=gc(),s.push(n)}for(l=s.length-1,n=s[l],t.pop();l>1;)t.pop(),n=nA(s[l-1].value,s[l-2],n),l-=2;return n}function Ts(){var e,t,n;return e=JY(),_e("?")&&(It(),t=Ts(),St(":"),n=Ts(),e=BY(e,t,n)),e}function vb(){const e=Ts();if(_e(","))throw new Error(Fu);return e}function QY(e){K=e,k=0,Ft=K.length,Ee=null,zO();const t=vb();if(Ee.type!==pl)throw new Error("Unexpect token after expression.");return t}function Pg(e){const t=[];return e.type==="Identifier"?[e.name]:e.type==="Literal"?[e.value]:(e.type==="MemberExpression"&&(t.push(...Pg(e.object)),t.push(...Pg(e.property))),t)}function UO(e){return e.object.type==="MemberExpression"?UO(e.object):e.object.name==="datum"}function jO(e){const t=QY(e),n=new Set;return t.visit(i=>{i.type==="MemberExpression"&&UO(i)&&n.add(Pg(i).slice(1).join("."))}),n}class lo extends Ae{clone(){return new lo(null,this.model,ie(this.filter))}constructor(t,n,i){super(t),this.model=n,this.filter=i,this.expr=sf(this.model,this.filter,this),this._dependentFields=jO(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function ZY(e,t){const n={},i=e.config.selection;if(!t||!t.length)return n;let r=0;for(const s of t){const a=Ne(s.name),o=s.select,u=q(o)?o:o.type,l=j(o)?ie(o):{type:u},c=i[u];for(const p in c)p==="fields"||p==="encodings"||(p==="mark"&&(l.mark={...c.mark,...l.mark}),(l[p]===void 0||l[p]===!0)&&(l[p]=ie(c[p]??l[p])));const f=n[a]={...l,name:a,type:u,init:s.value,bind:s.bind,events:q(l.on)?Br(l.on,"scope"):W(ie(l.on))};if(ci(f)&&(r++,r>1)){delete n[a];continue}const d=ie(s);for(const p of Td)p.defined(f)&&p.parse&&p.parse(e,f,d)}return r>1&&M(uW),n}function qO(e,t,n,i="datum"){const r=q(t)?t:t.param,s=Ne(r),a=P(s+Rs);let o;try{o=e.getSelectionComponent(s,r)}catch{return`!!${s}`}if(o.project.timeUnit){const d=n??e.component.data.raw,p=o.project.timeUnit.clone();d.parent?p.insertAsParentOf(d):d.parent=p}const u=o.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest(",l=o.resolve==="global"?")":`, ${P(o.resolve)})`,c=`${u}${a}, ${i}${l}`,f=`length(data(${a}))`;return t.empty===!1?`${f} && ${c}`:`!${f} || ${c}`}function WO(e,t,n){const i=Ne(t),r=n.encoding;let s=n.field,a;try{a=e.getSelectionComponent(i,t)}catch{return i}if(!r&&!s)s=a.project.items[0].field,a.project.items.length>1&&M(lW(s));else if(r&&!s){const o=a.project.items.filter(u=>u.channel===r);!o.length||o.length>1?(s=a.project.items[0].field,M(cW(o,r,n,s))):s=o[0].field}return`${a.name}[${P(bn(s))}]`}function eK(e,t){for(const[n,i]of Or(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new Ut(new lo(t,e,{param:n}),r,Pe.Lookup,e.component.data.outputNodeRefCounts)}}function sf(e,t,n){return nu(t,i=>q(i)?i:xG(i)?qO(e,i,n):Xk(i))}function tK(e,t){if(e)return D(e)&&!lr(e)?e.map(n=>Qy(n,t)).join(", "):e}function Yh(e,t,n,i){var r,s;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(s=e.encode[t]).update??(s.update={}),e.encode[t].update[n]=i}function Ho(e,t,n,i={header:!1}){const{disable:r,orient:s,scale:a,labelExpr:o,title:u,zindex:l,...c}=e.combine();if(!r){for(const f in c){const d=f,p=wH[d],h=c[d];if(p&&p!==t&&p!=="both")delete c[d];else if(dl(h)){const{condition:g,...m}=h,y=W(g),b=kE[d];if(b){const{vgProp:v,part:A}=b,E=[...y.map(C=>{const{test:x,...w}=C;return{test:sf(null,x),...w}}),m];Yh(c,A,v,E),delete c[d]}else if(b===null){const v={signal:y.map(A=>{const{test:E,...C}=A;return`${sf(null,E)} ? ${dE(C)} : `}).join("")+dE(m)};c[d]=v}}else if(Q(h)){const g=kE[d];if(g){const{vgProp:m,part:y}=g;Yh(c,y,m,h),delete c[d]}}ue(["labelAlign","labelBaseline"],d)&&c[d]===null&&delete c[d]}if(t==="grid"){if(!c.grid)return;if(c.encode){const{grid:f}=c.encode;c.encode={...f?{grid:f}:{}},we(c.encode)&&delete c.encode}return{scale:a,orient:s,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:Ue(l,0)}}else{if(!i.header&&e.mainExtracted)return;if(o!==void 0){let d=o;c.encode?.labels?.update&&Q(c.encode.labels.update.text)&&(d=Cs(o,"datum.label",c.encode.labels.update.text.signal)),Yh(c,"labels","text",{signal:d})}if(c.labelAlign===null&&delete c.labelAlign,c.encode){for(const d of FD)e.hasAxisPart(d)||delete c.encode[d];we(c.encode)&&delete c.encode}const f=tK(u,n);return{scale:a,orient:s,grid:!1,...f?{title:f}:{},...c,...n.aria===!1?{aria:!1}:{},zindex:Ue(l,0)}}}}function GO(e){const{axes:t}=e.component,n=[];for(const i of Zi)if(t[i]){for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const s=i==="x"?"height":"width",a=e.getSizeSignalRef(s).signal;s!==a&&n.push({name:s,update:a})}}return n}function nK(e,t){const{x:n=[],y:i=[]}=e;return[...n.map(r=>Ho(r,"grid",t)),...i.map(r=>Ho(r,"grid",t)),...n.map(r=>Ho(r,"main",t)),...i.map(r=>Ho(r,"main",t))].filter(r=>r)}function uA(e,t,n,i){return Object.assign.apply(null,[{},...e.map(r=>{if(r==="axisOrient"){const s=n==="x"?"bottom":"left",a=t[n==="x"?"axisBottom":"axisLeft"]||{},o=t[n==="x"?"axisTop":"axisRight"]||{},u=new Set([..._(a),..._(o)]),l={};for(const c of u.values())l[c]={signal:`${i.signal} === "${s}" ? ${_n(a[c])} : ${_n(o[c])}`};return l}return t[r]})])}function iK(e,t,n,i){const r=t==="band"?["axisDiscrete","axisBand"]:t==="point"?["axisDiscrete","axisPoint"]:Qk(t)?["axisQuantitative"]:t==="time"||t==="utc"?["axisTemporal"]:[],s=e==="x"?"axisX":"axisY",a=Q(n)?"axisOrient":`axis${tl(n)}`,o=[...r,...r.map(l=>s+l.substr(4))],u=["axis",a,s];return{vlOnlyAxisConfig:uA(o,i,e,n),vgAxisConfig:uA(u,i,e,n),axisConfigStyle:rK([...u,...o],i)}}function rK(e,t){const n=[{}];for(const i of e){let r=t[i]?.style;if(r){r=W(r);for(const s of r)n.push(t.style[s])}}return Object.assign.apply(null,n)}function Ig(e,t,n,i={}){const r=Sk(e,n,t);if(r!==void 0)return{configFrom:"style",configValue:r};for(const s of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(i[s]?.[e]!==void 0)return{configFrom:s,configValue:i[s][e]};return{}}const lA={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??sK(n,e),gridScale:({model:e,channel:t})=>aK(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||VO(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||HO(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??uK(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??lK(t.type,n,B(t)&&!!t.timeUnit,B(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{const s=e==="x"?"width":e==="y"?"height":void 0,a=s?t.getSizeSignalRef(s):void 0;return n.tickCount??fK({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},tickMinStep:dK,title:({axis:e,model:t,channel:n})=>{if(e.title!==void 0)return e.title;const i=XO(t,n);if(i!==void 0)return i;const r=t.typedFieldDef(n),s=n==="x"?"x2":"y2",a=t.fieldDef(s);return kk(r?[SE(r)]:[],B(a)?[SE(a)]:[])},values:({axis:e,fieldOrDatumDef:t})=>hK(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??pK(n,t)};function sK(e,t){return!it(e)&&B(t)&&!De(t?.bin)&&!st(t?.bin)}function aK(e,t){const n=t==="x"?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}function oK(e,t,n,i,r){const s=t?.labelAngle;if(s!==void 0)return Q(s)?s:Au(s);{const{configValue:a}=Ig("labelAngle",i,t?.style,r);return a!==void 0?Au(a):n===Me&&ue([zy,Iy],e.type)&&!(B(e)&&e.timeUnit)?270:void 0}}function zg(e){return`(((${e.signal} % 360) + 360) % 360)`}function HO(e,t,n,i){if(e!==void 0)if(n==="x"){if(Q(e)){const r=zg(e),s=Q(t)?`(${t.signal} === "top")`:t==="top";return{signal:`(45 < ${r} && ${r} < 135) || (225 < ${r} && ${r} < 315) ? "middle" :(${r} <= 45 || 315 <= ${r}) === ${s} ? "bottom" : "top"`}}if(45{if(Xs(i)&&pD(i.sort)){const{field:s,timeUnit:a}=i,o=i.sort,u=o.map((l,c)=>`${Xk({field:s,timeUnit:a,equal:l})} ? ${c} : `).join("")+o.length;t=new ja(t,{calculate:u,as:qa(i,r,{forAs:!0})})}}),t}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${le(this.transform)}`}}function qa(e,t,n){return U(e,{prefix:t,suffix:"sort_index",...n})}function Pd(e,t){return ue(["top","bottom"],t)?"column":ue(["left","right"],t)||e==="row"?"row":"column"}function Wa(e,t,n,i){const r=i==="row"?n.headerRow:i==="column"?n.headerColumn:n.headerFacet;return Ue((t||{})[e],r[e],n.header[e])}function Id(e,t,n,i){const r={};for(const s of e){const a=Wa(s,t||{},n,i);a!==void 0&&(r[s]=a)}return r}const Eb=["row","column"],Ab=["header","footer"];function gK(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:s,titleAngle:a,titleOrient:o}=Id(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),u=Pd(t,o),l=Au(a);return{name:`${t}-title`,type:"group",role:`${u}-title`,title:{text:n,...t==="row"?{orient:"left"}:{},style:"guide-title",...KO(l,u),...YO(u,l,s),...JO(i,r,t,HH,qD)}}}function YO(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=VO(t,e==="row"?"left":"top",e==="row"?"y":"x");return i?{align:i}:{}}function KO(e,t){const n=HO(e,t==="row"?"left":"top",t==="row"?"y":"x",!0);return n?{baseline:n}:{}}function mK(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of Ab)if(n[r])for(const s of n[r]){const a=bK(e,t,r,n,s);a!=null&&i.push(a)}return i}function yK(e,t){const{sort:n}=e;return zi(n)?{field:U(n,{expr:"datum"}),order:n.order??"ascending"}:D(n)?{field:qa(e,t,{expr:"datum"}),order:"ascending"}:{field:U(e,{expr:"datum"}),order:n??"ascending"}}function Ug(e,t,n){const{format:i,formatType:r,labelAngle:s,labelAnchor:a,labelOrient:o,labelExpr:u}=Id(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),l=Xy({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=Pd(t,o);return{text:{signal:u?Cs(Cs(u,"datum.label",l),"datum.value",U(e,{expr:"parent"})):l},...t==="row"?{orient:"left"}:{},style:"guide-label",frame:"group",...KO(s,c),...YO(c,s,a),...JO(n,e,t,VH,WD)}}function bK(e,t,n,i,r){if(r){let s=null;const{facetFieldDef:a}=i,o=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:f}=Id(["labelOrient"],a.header,o,t);(t==="row"&&!ue(["top","bottom"],f)||t==="column"&&!ue(["left","right"],f))&&(s=Ug(a,t,o))}const u=tn(e)&&!ul(e.facet),l=r.axes,c=l?.length>0;if(s||c){const f=t==="row"?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:yK(a,t)}:{},...c&&u?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...s?{title:s}:{},...r.sizeSignal?{encode:{update:{[f]:r.sizeSignal}}}:{},...c?{axes:l}:{}}}}return null}const xK={column:{start:0,end:1},row:{start:1,end:0}};function vK(e,t){return xK[t][e]}function EK(e,t){const n={};for(const i of fn){const r=e[i];if(r?.facetFieldDef){const{titleAnchor:s,titleOrient:a}=Id(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),o=Pd(i,a),u=vK(s,o);u!==void 0&&(n[o]=u)}}return we(n)?void 0:n}function JO(e,t,n,i,r){const s={};for(const a of i){if(!r[a])continue;const o=Wa(a,t?.header,e,n);o!==void 0&&(s[r[a]]=o)}return s}function Cb(e){return[...Ll(e,"width"),...Ll(e,"height"),...Ll(e,"childWidth"),...Ll(e,"childHeight")]}function Ll(e,t){const n=t==="width"?"x":"y",i=e.component.layoutSize.get(t);if(!i||i==="merged")return[];const r=e.getSizeSignalRef(t).signal;if(i==="step"){const s=e.getScaleComponent(n);if(s){const a=s.get("type"),o=s.get("range");if(it(a)&&Gs(o)){const u=e.scaleName(n);return tn(e.parent)&&e.parent.component.resolve.scale[n]==="independent"?[cA(u,o)]:[cA(u,o),{name:r,update:QO(u,s,`domain('${u}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}else if(i=="container"){const s=r.endsWith("width"),a=s?"containerSize()[0]":"containerSize()[1]",o=kg(e.config.view,s?"width":"height"),u=`isFinite(${a}) ? ${a} : ${o}`;return[{name:r,init:u,on:[{update:u,events:"window:resize"}]}]}else return[{name:r,value:i}]}function cA(e,t){const n=`${e}_step`;return Q(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function QO(e,t,n){const i=t.get("type"),r=t.get("padding"),s=Ue(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a=i==="band"?a!==void 0?a:r:1,`bandspace(${n}, ${_n(a)}, ${_n(s)}) * ${e}_step`}function ZO(e){return e==="childWidth"?"width":e==="childHeight"?"height":e}function e3(e,t){return _(e).reduce((n,i)=>({...n,...uo({model:t,channelDef:e[i],vgChannel:i,mainRefFn:r=>Re(r.value),invalidValueRef:void 0})}),{})}function t3(e,t){if(tn(t))return e==="theta"?"independent":"shared";if(ho(t))return"shared";if(Ob(t))return je(e)||e==="theta"||e==="radius"?"independent":"shared";throw new Error("invalid model type for resolve")}function wb(e,t){const n=e.scale[t],i=je(t)?"axis":"legend";return n==="independent"?(e[i][t]==="shared"&&M(UW(t)),"independent"):e[i][t]||"shared"}const AK={...KH,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},n3=_(AK);class CK extends tr{}const fA={symbols:wK,gradient:FK,labels:SK,entries:$K};function wK(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:s}){if(s!=="symbol")return;const{markDef:a,encoding:o,config:u,mark:l}=n,c=a.filled&&l!=="trail";let f={...Yq({},n,GG),...AO(n,{filled:c})};const d=r.get("symbolOpacity")??u.legend.symbolOpacity,p=r.get("symbolFillColor")??u.legend.symbolFillColor,h=r.get("symbolStrokeColor")??u.legend.symbolStrokeColor,g=d===void 0?i3(o.opacity)??a.opacity:void 0;if(f.fill){if(i==="fill"||c&&i===Wt)delete f.fill;else if(T(f.fill,"field"))p?delete f.fill:(f.fill=Re(u.legend.symbolBaseFillColor??"black"),f.fillOpacity=Re(g??1));else if(D(f.fill)){const m=jg(o.fill??o.color)??a.fill??(c&&a.color);m&&(f.fill=Re(m))}}if(f.stroke){if(i==="stroke"||!c&&i===Wt)delete f.stroke;else if(T(f.stroke,"field")||h)delete f.stroke;else if(D(f.stroke)){const m=Ue(jg(o.stroke||o.color),a.stroke,c?a.color:void 0);m&&(f.stroke={value:m})}}if(i!==Qi){const m=B(t)&&s3(n,r,t);m?f.opacity=[{test:m,...Re(g??1)},Re(u.legend.unselectedOpacity)]:g&&(f.opacity=Re(g))}return f={...f,...e},we(f)?void 0:f}function FK(e,{model:t,legendType:n,legendCmpt:i}){if(n!=="gradient")return;const{config:r,markDef:s,encoding:a}=t;let o={};const l=(i.get("gradientOpacity")??r.legend.gradientOpacity)===void 0?i3(a.opacity)||s.opacity:void 0;return l&&(o.opacity=Re(l)),o={...o,...e},we(o)?void 0:o}function SK(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const s=n.legend(i)||{},a=n.config,o=B(t)?s3(n,r,t):void 0,u=o?[{test:o,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=s;let f;Ds(c)?f=Tn({fieldOrDatumDef:t,field:"datum.value",format:l,formatType:c,config:a}):l===void 0&&c===void 0&&a.customFormatTypes&&(t.type==="quantitative"&&a.numberFormatType?f=Tn({fieldOrDatumDef:t,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):t.type==="temporal"&&a.timeFormatType&&B(t)&&t.timeUnit===void 0&&(f=Tn({fieldOrDatumDef:t,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...u?{opacity:u}:{},...f?{text:f}:{},...e};return we(d)?void 0:d}function $K(e,{legendCmpt:t}){return t.get("selections")?.length?{...e,fill:{value:"transparent"}}:e}function i3(e){return r3(e,(t,n)=>Math.max(t,n.value))}function jg(e){return r3(e,(t,n)=>Ue(t,n.value))}function r3(e,t){if(dH(e))return W(e.condition).reduce(t,e.value);if(zn(e))return e.value}function s3(e,t,n){const i=t.get("selections");if(!i?.length)return;const r=P(n.field);return i.map(s=>`(!length(data(${P(Ne(s)+Rs)})) || (${s}[${r}] && indexof(${s}[${r}], datum.value) >= 0))`).join(" || ")}const dA={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return fD(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return dD(i,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??NK(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??MK(n),symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>e.symbolType??DK(t.type,n,i.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>ba(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(ya(n)&&oi(t)){if(e==="gradient")return}else if(e==="symbol")return;return e},values:({fieldOrDatumDef:e,legend:t})=>kK(t,e)};function kK(e,t){const n=e.values;if(D(n))return wD(t,n);if(Q(n))return n}function DK(e,t,n,i){if(t!=="shape"){const r=jg(n)??i;if(r)return r}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}function OK(e){const{legend:t}=e;return Ue(t.type,RK(e))}function RK({channel:e,timeUnit:t,scaleType:n}){if(ya(e)){if(ue(["quarter","month","day"],t))return"symbol";if(oi(n))return"gradient"}return"symbol"}function _K({legendConfig:e,legendType:t,orient:n,legend:i}){return i.direction??e[t?"gradientDirection":"symbolDirection"]??TK(n,t)}function TK(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return t==="gradient"?"horizontal":void 0}}function NK({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:s,gradientHorizontalMinLength:a,gradientVerticalMaxLength:o,gradientVerticalMinLength:u}=e;if(oi(r))return n==="horizontal"?i==="top"||i==="bottom"?hA(t,"width",a,s):a:hA(t,"height",u,o)}function hA(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function MK(e){if(ue(["quantile","threshold","log","symlog"],e))return"greedy"}function a3(e){const t=Be(e)?LK(e):zK(e);return e.component.legends=t,t}function LK(e){const{encoding:t}=e,n={};for(const i of[Wt,...HD]){const r=Xe(t[i]);!r||!e.getScaleComponent(i)||i===Gt&&B(r)&&r.type===oo||(n[i]=IK(e,i))}return n}function BK(e,t){const n=e.scaleName(t);if(e.mark==="trail"){if(t==="color")return{stroke:n};if(t==="size")return{strokeWidth:n}}return t==="color"?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}function PK(e,t,n,i){switch(t){case"disable":return n!==void 0;case"values":return!!n?.values;case"title":if(t==="title"&&e===i?.title)return!0}return e===(n||{})[t]}function IK(e,t){let n=e.legend(t);const{markDef:i,encoding:r,config:s}=e,a=s.legend,o=new CK({},BK(e,t));IX(e,t,o);const u=n!==void 0?!n:a.disable;if(o.set("disable",u,n!==void 0),u)return o;n=n||{};const l=e.getScaleComponent(t).get("type"),c=Xe(r[t]),f=B(c)?nt(c.timeUnit)?.unit:void 0,d=n.orient||s.legend.orient||"right",p=OK({legend:n,channel:t,timeUnit:f,scaleType:l}),h=_K({legend:n,legendType:p,orient:d,legendConfig:a}),g={legend:n,channel:t,model:e,markDef:i,encoding:r,fieldOrDatumDef:c,legendConfig:a,config:s,scaleType:l,orient:d,legendType:p,direction:h};for(const A of n3){if(p==="gradient"&&A.startsWith("symbol")||p==="symbol"&&A.startsWith("gradient"))continue;const E=A in dA?dA[A](g):n[A];if(E!==void 0){const C=PK(E,A,n,e.fieldDef(t));(C||s.legend[A]===void 0)&&o.set(A,E,C)}}const m=n?.encoding??{},y=o.get("selections"),b={},v={fieldOrDatumDef:c,model:e,channel:t,legendCmpt:o,legendType:p};for(const A of["labels","legend","title","symbols","gradient","entries"]){const E=e3(m[A]??{},e),C=A in fA?fA[A](E,v):E;C!==void 0&&!we(C)&&(b[A]={...y?.length&&B(c)?{name:`${Ne(c.field)}_legend_${A}`}:{},...y?.length?{interactive:!!y}:{},update:C})}return we(b)||o.set("encode",b,!!n?.encoding),o}function zK(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){a3(i);for(const r of _(i.component.legends))n.legend[r]=wb(e.component.resolve,r),n.legend[r]==="shared"&&(t[r]=o3(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of _(t))for(const r of e.children)r.component.legends[i]&&n.legend[i]==="shared"&&delete r.component.legends[i];return t}function o3(e,t){if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let r=!1;for(const s of n3){const a=Tr(e.getWithExplicit(s),t.getWithExplicit(s),s,"legend",(o,u)=>{switch(s){case"symbolType":return UK(o,u);case"title":return Ok(o,u);case"type":return r=!0,Yt("symbol")}return Dd(o,u,s,"legend")});e.setWithExplicit(s,a)}return r&&(e.implicit?.encode?.gradient&&Gc(e.implicit,["encode","gradient"]),e.explicit?.encode?.gradient&&Gc(e.explicit,["encode","gradient"])),e}function UK(e,t){return t.value==="circle"?t:e}function jK(e,t,n,i){var r,s;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(s=e.encode[t]).update??(s.update={}),e.encode[t].update[n]=i}function u3(e){const t=e.component.legends,n={};for(const r of _(t)){const s=e.getScaleComponent(r),a=Fe(s.get("domains"));if(n[a])for(const o of n[a])o3(o,t[r])||n[a].push(t[r]);else n[a]=[t[r].clone()]}return dt(n).flat().map(r=>qK(r,e.config)).filter(r=>r!==void 0)}function qK(e,t){const{disable:n,labelExpr:i,selections:r,...s}=e.combine();if(!n){if(t.aria===!1&&s.aria==null&&(s.aria=!1),s.encode?.symbols){const a=s.encode.symbols.update;a.fill&&a.fill.value!=="transparent"&&!a.stroke&&!s.stroke&&(a.stroke={value:"transparent"});for(const o of HD)s[o]&&delete a[o]}if(s.title||delete s.title,i!==void 0){let a=i;s.encode?.labels?.update&&Q(s.encode.labels.update.text)&&(a=Cs(i,"datum.label",s.encode.labels.update.text.signal)),jK(s,"labels","text",{signal:a})}return s}}function WK(e){return ho(e)||Ob(e)?GK(e):l3(e)}function GK(e){return e.children.reduce((t,n)=>t.concat(n.assembleProjections()),l3(e))}function l3(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map(a=>a.signal).join(", ")}]`},s=t.data.reduce((a,o)=>{const u=Q(o)?o.signal:`data('${e.lookupDataSource(o)}')`;return ue(a,u)||a.push(u),a},[]);if(s.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:s.length>1?`[${s.join(", ")}]`:s[0]},...n}]}else return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const HK=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class c3 extends tr{constructor(t,n,i,r){super({...n},{name:t}),this.specifiedProjection=n,this.size=i,this.data=r,this.merged=!1}get isFit(){return!!this.data}}function f3(e){e.component.projection=Be(e)?VK(e):KK(e)}function VK(e){if(e.hasProjection){const t=at(e.specifiedProjection),n=!(t&&(t.scale!=null||t.translate!=null)),i=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=n?XK(e):void 0,s=new c3(e.projectionName(!0),{...at(e.config.projection),...t},i,r);return s.get("type")||s.set("type","equalEarth",!1),s}}function XK(e){const t=[],{encoding:n}=e;for(const i of[[Yn,Xn],[xn,Kn]])(Xe(n[i[0]])||Xe(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(Gt)&&e.typedFieldDef(Gt).type===oo&&t.push({signal:e.getName(`geojson_${t.length}`)}),t.length===0&&t.push(e.requestDataName(Pe.Main)),t}function YK(e,t){const n=dy(HK,r=>!!(!H(e.explicit,r)&&!H(t.explicit,r)||H(e.explicit,r)&&H(t.explicit,r)&&Jt(e.get(r),t.get(r))));if(Jt(e.size,t.size)){if(n)return e;if(Jt(e.explicit,{}))return t;if(Jt(t.explicit,{}))return e}return null}function KK(e){if(e.children.length===0)return;let t;for(const i of e.children)f3(i);const n=dy(e.children,i=>{const r=i.component.projection;if(r)if(t){const s=YK(t,r);return s&&(t=s),!!s}else return t=r,!0;else return!0});if(t&&n){const i=e.projectionName(!0),r=new c3(i,t.specifiedProjection,t.size,ie(t.data));for(const s of e.children){const a=s.component.projection;a&&(a.isFit&&r.data.push(...s.component.projection.data),s.renameProjection(a.get("name"),i),a.merged=!0)}return r}}function JK(e,t,n,i){if(fl(t,n)){const r=Be(e)?e.axis(n)??e.legend(n)??{}:{},s=U(t,{expr:"datum"}),a=U(t,{expr:"datum",binSuffix:"end"});return{formulaAs:U(t,{binSuffix:"range",forAs:!0}),formula:ol(s,a,r.format,r.formatType,i)}}return{}}function d3(e,t){return`${Ak(e)}_${t}`}function QK(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}function Fb(e,t,n){const i=Cd(n,void 0)??{},r=d3(i,t);return e.getName(`${r}_bins`)}function ZK(e){return"as"in e}function pA(e,t,n){let i,r;ZK(e)?i=q(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:i=[U(e,{forAs:!0}),U(e,{binSuffix:"end",forAs:!0})];const s={...Cd(t,void 0)},a=d3(s,e.field),{signal:o,extentSignal:u}=QK(n,a);if(dd(s.extent)){const c=s.extent;r=WO(n,c.param,c),delete s.extent}const l={bin:s,field:e.field,as:[i],...o?{signal:o}:{},...u?{extentSignal:u}:{},...r?{span:r}:{}};return{key:a,binComponent:l}}class fi extends Ae{clone(){return new fi(null,ie(this.bins))}constructor(t,n){super(t),this.bins=n}static makeFromEncoding(t,n){const i=n.reduceFieldDef((r,s,a)=>{if(Nt(s)&&De(s.bin)){const{key:o,binComponent:u}=pA(s,s.bin,n);r[o]={...u,...r[o],...JK(n,s,a,n.config)}}return r},{});return we(i)?null:new fi(t,i)}static makeFromTransform(t,n,i){const{key:r,binComponent:s}=pA(n,n.bin,i);return new fi(t,{[r]:s})}merge(t,n){for(const i of _(t.bins))i in this.bins?(n(t.bins[i].signal,this.bins[i].signal),this.bins[i].as=ai([...this.bins[i].as,...t.bins[i].as],le)):this.bins[i]=t.bins[i];for(const i of t.children)t.removeChild(i),i.parent=this;t.remove()}producedFields(){return new Set(dt(this.bins).map(t=>t.as).flat(2))}dependentFields(){return new Set(dt(this.bins).map(t=>t.field))}hash(){return`Bin ${le(this.bins)}`}assemble(){return dt(this.bins).flatMap(t=>{const n=[],[i,...r]=t.as,{extent:s,...a}=t.bin,o={type:"bin",field:bn(t.field),as:i,signal:t.signal,...dd(s)?{extent:null}:{extent:s},...t.span?{span:{signal:`span(${t.span})`}}:{},...a};!s&&t.extentSignal&&(n.push({type:"extent",field:bn(t.field),signal:t.extentSignal}),o.extent={signal:t.extentSignal}),n.push(o);for(const u of r)for(let l=0;l<2;l++)n.push({type:"formula",expr:U({field:i[l]},{expr:"datum"}),as:u[l]});return t.formula&&n.push({type:"formula",expr:t.formula,as:t.formulaAs}),n})}}function eJ(e,t,n,i){const r=Be(i)?i.encoding[Fi(t)]:void 0;if(Nt(n)&&Be(i)&&mD(n,r,i.markDef,i.config)){e.add(U(n,{})),e.add(U(n,{suffix:"end"}));const{mark:s,markDef:a,config:o}=i,u=_r({fieldDef:n,markDef:a,config:o});Cu(s)&&u!==.5&&je(t)&&(e.add(U(n,{suffix:Od})),e.add(U(n,{suffix:Rd}))),n.bin&&fl(n,t)&&e.add(U(n,{binSuffix:"range"}))}else if(hk(t)){const s=dk(t);e.add(i.getName(s))}else e.add(U(n));return Xs(n)&&_G(n.scale?.range)&&e.add(n.scale.range.field),e}function tJ(e,t){for(const n of _(t)){const i=t[n];for(const r of _(i))n in e?e[n][r]=new Set([...e[n][r]??[],...i[r]]):e[n]={[r]:i[r]}}}class Mn extends Ae{clone(){return new Mn(null,new Set(this.dimensions),ie(this.measures))}constructor(t,n,i){super(t),this.dimensions=n,this.measures=i}get groupBy(){return this.dimensions}static makeFromEncoding(t,n){let i=!1;n.forEachFieldDef(a=>{a.aggregate&&(i=!0)});const r={},s=new Set;return!i||(n.forEachFieldDef((a,o)=>{const{aggregate:u,field:l}=a;if(u)if(u==="count")r["*"]??(r["*"]={}),r["*"].count=new Set([U(a,{forAs:!0})]);else{if(Wi(u)||Wr(u)){const c=Wi(u)?"argmin":"argmax",f=u[c];r[f]??(r[f]={}),r[f][c]=new Set([U({op:c,field:f},{forAs:!0})])}else r[l]??(r[l]={}),r[l][u]=new Set([U(a,{forAs:!0})]);Si(o)&&n.scaleDomain(o)==="unaggregated"&&(r[l]??(r[l]={}),r[l].min=new Set([U({field:l,aggregate:"min"},{forAs:!0})]),r[l].max=new Set([U({field:l,aggregate:"max"},{forAs:!0})]))}else eJ(s,o,a,n)}),s.size+_(r).length===0)?null:new Mn(t,s,r)}static makeFromTransform(t,n){var i;const r=new Set,s={};for(const a of n.aggregate){const{op:o,field:u,as:l}=a;o&&(o==="count"?(s["*"]??(s["*"]={}),s["*"].count=new Set([l||U(a,{forAs:!0})])):(s[u]??(s[u]={}),(i=s[u])[o]??(i[o]=new Set),s[u][o].add(l||U(a,{forAs:!0}))))}for(const a of n.groupby??[])r.add(a);return r.size+_(s).length===0?null:new Mn(t,r,s)}merge(t){return rk(this.dimensions,t.dimensions)?(tJ(this.measures,t.measures),!0):(iG("different dimensions, cannot merge"),!1)}addDimensions(t){t.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,..._(this.measures)])}producedFields(){const t=new Set;for(const n of _(this.measures))for(const i of _(this.measures[n])){const r=this.measures[n][i];r.size===0?t.add(`${i}_${n}`):r.forEach(t.add,t)}return t}hash(){return`Aggregate ${le({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const t=[],n=[],i=[];for(const s of _(this.measures))for(const a of _(this.measures[s]))for(const o of this.measures[s][a])i.push(o),t.push(a),n.push(s==="*"?null:bn(s));return{type:"aggregate",groupby:[...this.dimensions].map(bn),ops:t,fields:n,as:i}}}class co extends Ae{constructor(t,n,i,r){super(t),this.model=n,this.name=i,this.data=r;for(const s of fn){const a=n.facet[s];if(a){const{bin:o,sort:u}=a;this[s]={name:n.getName(`${s}_domain`),fields:[U(a),...De(o)?[U(a,{binSuffix:"end"})]:[]],...zi(u)?{sortField:u}:D(u)?{sortIndexField:qa(a,s)}:{}}}}this.childModel=n.child}hash(){let t="Facet";for(const n of fn)this[n]&&(t+=` ${n.charAt(0)}:${le(this[n])}`);return t}get fields(){const t=[];for(const n of fn)this[n]?.fields&&t.push(...this[n].fields);return t}dependentFields(){const t=new Set(this.fields);for(const n of fn)this[n]&&(this[n].sortField&&t.add(this[n].sortField.field),this[n].sortIndexField&&t.add(this[n].sortIndexField));return t}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const t={};for(const n of Zi){const i=this.childModel.component.scales[n];if(i&&!i.merged){const r=i.get("type"),s=i.get("range");if(it(r)&&Gs(s)){const a=zd(this.childModel,n),o=Db(a);o?t[n]=o:M(Sy(n))}}}return t}assembleRowColumnHeaderData(t,n,i){const r={row:"y",column:"x",facet:void 0}[t],s=[],a=[],o=[];r&&i&&i[r]&&(n?(s.push(`distinct_${i[r]}`),a.push("max")):(s.push(i[r]),a.push("distinct")),o.push(`distinct_${i[r]}`));const{sortField:u,sortIndexField:l}=this[t];if(u){const{op:c=vd,field:f}=u;s.push(f),a.push(c),o.push(U(u,{forAs:!0}))}else l&&(s.push(l),a.push("max"),o.push(l));return{name:this[t].name,source:n??this.data,transform:[{type:"aggregate",groupby:this[t].fields,...s.length?{fields:s,ops:a,as:o}:{}}]}}assembleFacetHeaderData(t){const{columns:n}=this.model.layout,{layoutHeaders:i}=this.model.component,r=[],s={};for(const u of Eb){for(const l of Ab){const c=(i[u]&&i[u][l])??[];for(const f of c)if(f.axes?.length>0){s[u]=!0;break}}if(s[u]){const l=`length(data("${this.facet.name}"))`,c=u==="row"?n?{signal:`ceil(${l} / ${n})`}:1:n?{signal:`min(${l}, ${n})`}:{signal:l};r.push({name:`${this.facet.name}_${u}`,transform:[{type:"sequence",start:0,stop:c}]})}}const{row:a,column:o}=s;return(a||o)&&r.unshift(this.assembleRowColumnHeaderData("facet",null,t)),r}assemble(){const t=[];let n=null;const i=this.getChildIndependentFieldsWithStep(),{column:r,row:s,facet:a}=this;if(r&&s&&(i.x||i.y)){n=`cross_${this.column.name}_${this.row.name}`;const o=[].concat(i.x??[],i.y??[]),u=o.map(()=>"distinct");t.push({name:n,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:o,ops:u}]})}for(const o of[Ii,Pi])this[o]&&t.push(this.assembleRowColumnHeaderData(o,n,i));if(a){const o=this.assembleFacetHeaderData(i);o&&t.push(...o)}return t}}function gA(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function nJ(e,t){const n=gy(e);if(t==="number")return`toNumber(${n})`;if(t==="boolean")return`toBoolean(${n})`;if(t==="string")return`toString(${n})`;if(t==="date")return`toDate(${n})`;if(t==="flatten")return n;if(t.startsWith("date:")){const i=gA(t.slice(5,t.length));return`timeParse(${n},'${i}')`}else if(t.startsWith("utc:")){const i=gA(t.slice(4,t.length));return`utcParse(${n},'${i}')`}else return M(dW(t)),null}function iJ(e){const t={};return hc(e.filter,n=>{if(Vk(n)){let i=null;_y(n)?i=Kt(n.equal):Ny(n)?i=Kt(n.lte):Ty(n)?i=Kt(n.lt):My(n)?i=Kt(n.gt):Ly(n)?i=Kt(n.gte):By(n)?i=n.range[0]:Py(n)&&(i=(n.oneOf??n.in)[0]),i&&(Hs(i)?t[n.field]="date":ge(i)?t[n.field]="number":q(i)&&(t[n.field]="string")),n.timeUnit&&(t[n.field]="date")}}),t}function rJ(e){const t={};function n(i){Ia(i)?t[i.field]="date":i.type==="quantitative"&&zq(i.aggregate)?t[i.field]="number":Ta(i.field)>1?i.field in t||(t[i.field]="flatten"):Xs(i)&&zi(i.sort)&&Ta(i.sort.field)>1&&(i.sort.field in t||(t[i.sort.field]="flatten"))}if((Be(e)||tn(e))&&e.forEachFieldDef((i,r)=>{if(Nt(i))n(i);else{const s=qs(r),a=e.fieldDef(s);n({...i,type:a.type})}}),Be(e)){const{mark:i,markDef:r,encoding:s}=e;if(Gr(i)&&!e.encoding.order){const a=r.orient==="horizontal"?"y":"x",o=s[a];B(o)&&o.type==="quantitative"&&!(o.field in t)&&(t[o.field]="number")}}return t}function sJ(e){const t={};if(Be(e)&&e.component.selection)for(const n of _(e.component.selection)){const i=e.component.selection[n];for(const r of i.project.items)!r.channel&&Ta(r.field)>1&&(t[r.field]="flatten")}return t}class vt extends Ae{clone(){return new vt(null,ie(this._parse))}constructor(t,n){super(t),this._parse=n}hash(){return`Parse ${le(this._parse)}`}static makeExplicit(t,n,i){let r={};const s=n.data;return!Cr(s)&&s?.format?.parse&&(r=s.format.parse),this.makeWithAncestors(t,r,{},i)}static makeWithAncestors(t,n,i,r){for(const o of _(i)){const u=r.getWithExplicit(o);u.value!==void 0&&(u.explicit||u.value===i[o]||u.value==="derived"||i[o]==="flatten"?delete i[o]:M(bE(o,i[o],u.value)))}for(const o of _(n)){const u=r.get(o);u!==void 0&&(u===n[o]?delete n[o]:M(bE(o,n[o],u)))}const s=new tr(n,i);r.copyAll(s);const a={};for(const o of _(s.combine())){const u=s.get(o);u!==null&&(a[o]=u)}return _(a).length===0||r.parseNothing?null:new vt(t,a)}get parse(){return this._parse}merge(t){this._parse={...this._parse,...t.parse},t.remove()}assembleFormatParse(){const t={};for(const n of _(this._parse)){const i=this._parse[n];Ta(n)===1&&(t[n]=i)}return t}producedFields(){return new Set(_(this._parse))}dependentFields(){return new Set(_(this._parse))}assembleTransforms(t=!1){return _(this._parse).filter(n=>t?Ta(n)>1:!0).map(n=>{const i=nJ(n,this._parse[n]);return i?{type:"formula",expr:i,as:so(n)}:null}).filter(n=>n!==null)}}class Nr extends Ae{clone(){return new Nr(null)}constructor(t){super(t)}dependentFields(){return new Set}producedFields(){return new Set([jn])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:jn}}}class yl extends Ae{clone(){return new yl(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${le(this.params)}`}assemble(){return{type:"graticule",...this.params===!0?{}:this.params}}}class bl extends Ae{clone(){return new bl(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${le(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class Ns extends Ae{constructor(t){super(null),t??(t={name:"source"});let n;if(Cr(t)||(n=t.format?{...zt(t.format,["parse"])}:{}),wu(t))this._data={values:t.values};else if(za(t)){if(this._data={url:t.url},!n.type){let i=/(?:\.([^.]+))?$/.exec(t.url)[1];ue(["json","csv","tsv","dsv","topojson"],i)||(i="json"),n.type=i}}else cO(t)?this._data={values:[{type:"Sphere"}]}:(uO(t)||Cr(t))&&(this._data={});this._generator=Cr(t),t.name&&(this._name=t.name),n&&!we(n)&&(this._data.format=n)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(t){this._name=t}set parent(t){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}var mA=function(e,t,n,i,r){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(e,n):r?r.value=n:t.set(e,n),n},aJ=function(e,t,n,i){if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?i:n==="a"?i.call(e):i?i.value:t.get(e)},Vo;function Sb(e){return e instanceof Ns||e instanceof yl||e instanceof bl}class $b{constructor(){Vo.set(this,void 0),mA(this,Vo,!1,"f")}setModified(){mA(this,Vo,!0,"f")}get modifiedFlag(){return aJ(this,Vo,"f")}}Vo=new WeakMap;class Ks extends $b{getNodeDepths(t,n,i){i.set(t,n);for(const r of t.children)this.getNodeDepths(r,n+1,i);return i}optimize(t){const i=[...this.getNodeDepths(t,0,new Map).entries()].sort((r,s)=>s[1]-r[1]);for(const r of i)this.run(r[0]);return this.modifiedFlag}}class kb extends $b{optimize(t){this.run(t);for(const n of t.children)this.optimize(n);return this.modifiedFlag}}class oJ extends kb{mergeNodes(t,n){const i=n.shift();for(const r of n)t.removeChild(r),r.parent=i,r.remove()}run(t){const n=t.children.map(r=>r.hash()),i={};for(let r=0;r1&&(this.setModified(),this.mergeNodes(t,i[r]))}}class uJ extends kb{constructor(t){super(),this.requiresSelectionId=t&&yb(t)}run(t){t instanceof Nr&&(this.requiresSelectionId&&(Sb(t.parent)||t.parent instanceof Mn||t.parent instanceof vt)||(this.setModified(),t.remove()))}}class lJ extends $b{optimize(t){return this.run(t,new Set),this.modifiedFlag}run(t,n){let i=new Set;t instanceof li&&(i=t.producedFields(),hy(i,n)&&(this.setModified(),t.removeFormulas(n),t.producedFields.length===0&&t.remove()));for(const r of t.children)this.run(r,new Set([...n,...i]))}}class cJ extends kb{constructor(){super()}run(t){t instanceof Ut&&!t.isRequired()&&(this.setModified(),t.remove())}}class fJ extends Ks{run(t){if(!Sb(t)&&!(t.numChildren()>1)){for(const n of t.children)if(n instanceof vt)if(t instanceof vt)this.setModified(),t.merge(n);else{if(py(t.producedFields(),n.dependentFields()))continue;this.setModified(),n.swapWithParent()}}}}class dJ extends Ks{run(t){const n=[...t.children],i=t.children.filter(r=>r instanceof vt);if(t.numChildren()>1&&i.length>=1){const r={},s=new Set;for(const a of i){const o=a.parse;for(const u of _(o))u in r?r[u]!==o[u]&&s.add(u):r[u]=o[u]}for(const a of s)delete r[a];if(!we(r)){this.setModified();const a=new vt(t,r);for(const o of n){if(o instanceof vt)for(const u of _(r))delete o.parse[u];t.removeChild(o),o.parent=a,o instanceof vt&&_(o.parse).length===0&&o.remove()}}}}}class hJ extends Ks{run(t){t instanceof Ut||t.numChildren()>0||t instanceof co||t instanceof Ns||(this.setModified(),t.remove())}}class pJ extends Ks{run(t){const n=t.children.filter(r=>r instanceof li),i=n.pop();for(const r of n)this.setModified(),i.merge(r)}}class gJ extends Ks{run(t){const n=t.children.filter(r=>r instanceof Mn),i={};for(const r of n){const s=le(r.groupBy);s in i||(i[s]=[]),i[s].push(r)}for(const r of _(i)){const s=i[r];if(s.length>1){const a=s.pop();for(const o of s)a.merge(o)&&(t.removeChild(o),o.parent=a,o.remove(),this.setModified())}}}}class mJ extends Ks{constructor(t){super(),this.model=t}run(t){const n=!(Sb(t)||t instanceof lo||t instanceof vt||t instanceof Nr),i=[],r=[];for(const s of t.children)s instanceof fi&&(n&&!py(t.producedFields(),s.dependentFields())?i.push(s):r.push(s));if(i.length>0){const s=i.pop();for(const a of i)s.merge(a,this.model.renameSignal.bind(this.model));this.setModified(),t instanceof fi?t.merge(s,this.model.renameSignal.bind(this.model)):s.swapWithParent()}if(r.length>1){const s=r.pop();for(const a of r)s.merge(a,this.model.renameSignal.bind(this.model));this.setModified()}}}class yJ extends Ks{run(t){const n=[...t.children];if(!_a(n,a=>a instanceof Ut)||t.numChildren()<=1)return;const r=[];let s;for(const a of n)if(a instanceof Ut){let o=a;for(;o.numChildren()===1;){const[u]=o.children;if(u instanceof Ut)o=u;else break}r.push(...o.children),s?(t.removeChild(a),a.parent=s.parent,s.parent.removeChild(s),s.parent=o,this.setModified()):s=o}else r.push(a);if(r.length){this.setModified();for(const a of r)a.parent.removeChild(a),a.parent=s}}}class Js extends Ae{clone(){return new Js(null,ie(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=ai(this.transform.groupby.concat(t),n=>n)}dependentFields(){const t=new Set;return this.transform.groupby&&this.transform.groupby.forEach(t.add,t),this.transform.joinaggregate.map(n=>n.field).filter(n=>n!==void 0).forEach(t.add,t),t}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(t){return t.as??U(t)}hash(){return`JoinAggregateTransform ${le(this.transform)}`}assemble(){const t=[],n=[],i=[];for(const s of this.transform.joinaggregate)n.push(s.op),i.push(this.getDefaultName(s)),t.push(s.field===void 0?null:s.field);const r=this.transform.groupby;return{type:"joinaggregate",as:i,ops:n,fields:t,...r!==void 0?{groupby:r}:{}}}}class Ga extends Ae{clone(){return new Ga(null,{...this.filter})}constructor(t,n){super(t),this.filter=n}static make(t,n,i){const{config:r,markDef:s}=n,{marks:a,scales:o}=i;if(a==="include-invalid-values"&&o==="include-invalid-values")return null;const u=n.reduceFieldDef((l,c,f)=>{const d=Si(f)&&n.getScaleComponent(f);if(d){const p=d.get("type"),{aggregate:h}=c,g=Gy({scaleChannel:f,markDef:s,config:r,scaleType:p,isCountAggregate:fd(h)});g!=="show"&&g!=="always-valid"&&(l[c.field]=c)}return l},{});return _(u).length?new Ga(t,u):null}dependentFields(){return new Set(_(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${le(this.filter)}`}assemble(){const t=_(this.filter).reduce((n,i)=>{const r=this.filter[i],s=U(r,{expr:"datum"});return r!==null&&(r.type==="temporal"?n.push(`(isDate(${s}) || (${qg(s)}))`):r.type==="quantitative"&&n.push(qg(s))),n},[]);return t.length>0?{type:"filter",expr:t.join(" && ")}:null}}function qg(e){return`isValid(${e}) && isFinite(+${e})`}function bJ(e){return e.stack.stackBy.reduce((t,n)=>{const i=n.fieldDef,r=U(i);return r&&t.push(r),t},[])}function xJ(e){return D(e)&&e.every(t=>q(t))&&e.length>1}class ji extends Ae{clone(){return new ji(null,ie(this._stack))}constructor(t,n){super(t),this._stack=n}static makeFromTransform(t,n){const{stack:i,groupby:r,as:s,offset:a="zero"}=n,o=[],u=[];if(n.sort!==void 0)for(const f of n.sort)o.push(f.field),u.push(Ue(f.order,"ascending"));const l={field:o,order:u};let c;return xJ(s)?c=s:q(s)?c=[s,`${s}_end`]:c=[`${n.stack}_start`,`${n.stack}_end`],new ji(t,{dimensionFieldDefs:[],stackField:i,groupby:r,offset:a,sort:l,facetby:[],as:c})}static makeFromEncoding(t,n){const i=n.stack,{encoding:r}=n;if(!i)return null;const{groupbyChannels:s,fieldChannel:a,offset:o,impute:u}=i,l=s.map(p=>{const h=r[p];return Un(h)}).filter(p=>!!p),c=bJ(n),f=n.encoding.order;let d;if(D(f)||B(f))d=$k(f);else{const p=yD(f)?f.sort:a==="y"?"descending":"ascending";d=c.reduce((h,g)=>(h.field.includes(g)||(h.field.push(g),h.order.push(p)),h),{field:[],order:[]})}return new ji(t,{dimensionFieldDefs:l,stackField:n.vgField(a),facetby:[],stackby:c,sort:d,offset:o,impute:u,as:[n.vgField(a,{suffix:"start",forAs:!0}),n.vgField(a,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(t){this._stack.facetby.push(...t)}dependentFields(){const t=new Set;return t.add(this._stack.stackField),this.getGroupbyFields().forEach(t.add,t),this._stack.facetby.forEach(t.add,t),this._stack.sort.field.forEach(t.add,t),t}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${le(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:t,impute:n,groupby:i}=this._stack;return t.length>0?t.map(r=>r.bin?n?[U(r,{binSuffix:"mid"})]:[U(r,{}),U(r,{binSuffix:"end"})]:[U(r)]).flat():i??[]}assemble(){const t=[],{facetby:n,dimensionFieldDefs:i,stackField:r,stackby:s,sort:a,offset:o,impute:u,as:l}=this._stack;if(u)for(const c of i){const{bandPosition:f=.5,bin:d}=c;if(d){const p=U(c,{expr:"datum"}),h=U(c,{expr:"datum",binSuffix:"end"});t.push({type:"formula",expr:`${qg(p)} ? ${f}*${p}+${1-f}*${h} : ${p}`,as:U(c,{binSuffix:"mid",forAs:!0})})}t.push({type:"impute",field:r,groupby:[...s,...n],key:U(c,{binSuffix:"mid"}),method:"value",value:0})}return t.push({type:"stack",groupby:[...this.getGroupbyFields(),...n],field:r,sort:a,as:l,offset:o}),t}}class fo extends Ae{clone(){return new fo(null,ie(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=ai(this.transform.groupby.concat(t),n=>n)}dependentFields(){const t=new Set;return(this.transform.groupby??[]).forEach(t.add,t),(this.transform.sort??[]).forEach(n=>t.add(n.field)),this.transform.window.map(n=>n.field).filter(n=>n!==void 0).forEach(t.add,t),t}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(t){return t.as??U(t)}hash(){return`WindowTransform ${le(this.transform)}`}assemble(){const t=[],n=[],i=[],r=[];for(const f of this.transform.window)n.push(f.op),i.push(this.getDefaultName(f)),r.push(f.param===void 0?null:f.param),t.push(f.field===void 0?null:f.field);const s=this.transform.frame,a=this.transform.groupby;if(s&&s[0]===null&&s[1]===null&&n.every(f=>wy(f)))return{type:"joinaggregate",as:i,ops:n,fields:t,...a!==void 0?{groupby:a}:{}};const o=[],u=[];if(this.transform.sort!==void 0)for(const f of this.transform.sort)o.push(f.field),u.push(f.order??"ascending");const l={field:o,order:u},c=this.transform.ignorePeers;return{type:"window",params:r,as:i,ops:n,fields:t,sort:l,...c!==void 0?{ignorePeers:c}:{},...a!==void 0?{groupby:a}:{},...s!==void 0?{frame:s}:{}}}}function vJ(e){function t(n){if(!(n instanceof co)){const i=n.clone();if(i instanceof Ut){const r=Gg+i.getSource();i.setSource(r),e.model.component.data.outputNodes[r]=i}else(i instanceof Mn||i instanceof ji||i instanceof fo||i instanceof Js)&&i.addDimensions(e.fields);for(const r of n.children.flatMap(t))r.parent=i;return[i]}return n.children.flatMap(t)}return t}function Wg(e){if(e instanceof co)if(e.numChildren()===1&&!(e.children[0]instanceof Ut)){const t=e.children[0];(t instanceof Mn||t instanceof ji||t instanceof fo||t instanceof Js)&&t.addDimensions(e.fields),t.swapWithParent(),Wg(e)}else{const t=e.model.component.data.main;h3(t);const n=vJ(e),i=e.children.map(n).flat();for(const r of i)r.parent=t}else e.children.map(Wg)}function h3(e){if(e instanceof Ut&&e.type===Pe.Main&&e.numChildren()===1){const t=e.children[0];t instanceof co||(t.swapWithParent(),h3(e))}}const Gg="scale_",Bl=5;function Hg(e){for(const t of e){for(const n of t.children)if(n.parent!==t)return!1;if(!Hg(t.children))return!1}return!0}function wn(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function yA(e,t,n){let i=e.sources,r=!1;return r=wn(new cJ,i)||r,r=wn(new uJ(t),i)||r,i=i.filter(s=>s.numChildren()>0),r=wn(new hJ,i)||r,i=i.filter(s=>s.numChildren()>0),n||(r=wn(new fJ,i)||r,r=wn(new mJ(t),i)||r,r=wn(new lJ,i)||r,r=wn(new dJ,i)||r,r=wn(new gJ,i)||r,r=wn(new pJ,i)||r,r=wn(new oJ,i)||r,r=wn(new yJ,i)||r),e.sources=i,r}function EJ(e,t){Hg(e.sources);let n=0,i=0;for(let r=0;rt(n))}}function p3(e){Be(e)?AJ(e):CJ(e)}function AJ(e){const t=e.component.scales;for(const n of _(t)){const i=FJ(e,n);if(t[n].setWithExplicit("domains",i),$J(e,n),e.component.data.isFaceted){let s=e;for(;!tn(s)&&s.parent;)s=s.parent;if(s.component.resolve.scale[n]==="shared")for(const o of i.value)Bi(o)&&(o.data=Gg+o.data.replace(Gg,""))}}}function CJ(e){for(const n of e.children)p3(n);const t=e.component.scales;for(const n of _(t)){let i,r=null;for(const s of e.children){const a=s.component.scales[n];if(a){i===void 0?i=a.getWithExplicit("domains"):i=Tr(i,a.getWithExplicit("domains"),"domains","scale",Vg);const o=a.get("selectionExtent");r&&o&&r.param!==o.param&&M(sW),r=o}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}function wJ(e,t,n,i){if(e==="unaggregated"){const{valid:r,reason:s}=bA(t,n);if(!r){M(s);return}}else if(e===void 0&&i.useUnaggregatedDomain){const{valid:r}=bA(t,n);if(r)return"unaggregated"}return e}function FJ(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=wJ(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:r}),t==="x"&&Xe(i.x2)?Xe(i.x)?Tr(sr(n,r,e,"x"),sr(n,r,e,"x2"),"domain","scale",Vg):sr(n,r,e,"x2"):t==="y"&&Xe(i.y2)?Xe(i.y)?Tr(sr(n,r,e,"y"),sr(n,r,e,"y2"),"domain","scale",Vg):sr(n,r,e,"y2"):sr(n,r,e,t)}function SJ(e,t,n){return e.map(i=>({signal:`{data: ${wd(i,{timeUnit:n,type:t})}}`}))}function Kh(e,t,n){const i=nt(n)?.unit;return t==="temporal"||i?SJ(e,t,i):[e]}function sr(e,t,n,i){const{encoding:r,markDef:s,mark:a,config:o,stack:u}=n,l=Xe(r[i]),{type:c}=l,f=l.timeUnit,d=lX({invalid:gi("invalid",s,o),isPath:Gr(a)});if(RG(t)){const g=sr(e,void 0,n,i),m=Kh(t.unionWith,c,f);return ii([...m,...g.value])}else{if(Q(t))return ii([t]);if(t&&t!=="unaggregated"&&!eD(t))return ii(Kh(t,c,f))}if(u&&i===u.fieldChannel){if(u.offset==="normalize")return Yt([[0,1]]);const g=n.requestDataName(d);return Yt([{data:g,field:n.vgField(i,{suffix:"start"})},{data:g,field:n.vgField(i,{suffix:"end"})}])}const p=Si(i)&&B(l)?kJ(n,i,e):void 0;if($i(l)){const g=Kh([l.datum],c,f);return Yt(g)}const h=l;if(t==="unaggregated"){const{field:g}=l;return Yt([{data:n.requestDataName(d),field:U({field:g,aggregate:"min"})},{data:n.requestDataName(d),field:U({field:g,aggregate:"max"})}])}else if(De(h.bin)){if(it(e))return Yt(e==="bin-ordinal"?[]:[{data:Eu(p)?n.requestDataName(d):n.requestDataName(Pe.Raw),field:n.vgField(i,fl(h,i)?{binSuffix:"range"}:{}),sort:p===!0||!j(p)?{field:n.vgField(i,{}),op:"min"}:p}]);{const{bin:g}=h;if(De(g)){const m=Fb(n,h.field,g);return Yt([new Je(()=>{const y=n.getSignalName(m);return`[${y}.start, ${y}.stop]`})])}else return Yt([{data:n.requestDataName(d),field:n.vgField(i,{})}])}}else if(h.timeUnit&&ue(["time","utc"],e)){const g=r[Fi(i)];if(mD(h,g,s,o)){const m=n.requestDataName(d),y=_r({fieldDef:h,fieldDef2:g,markDef:s,config:o}),b=Cu(a)&&y!==.5&&je(i);return Yt([{data:m,field:n.vgField(i,b?{suffix:Od}:{})},{data:m,field:n.vgField(i,{suffix:b?Rd:"end"})}])}}return Yt(p?[{data:Eu(p)?n.requestDataName(d):n.requestDataName(Pe.Raw),field:n.vgField(i),sort:p}]:[{data:n.requestDataName(d),field:n.vgField(i)}])}function Jh(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":vd),...i?{field:bn(i)}:{},...r?{order:r}:{}}}function $J(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t)?.bin,s=eD(i)?i:void 0,a=Ws(r)&&dd(r.extent)?r.extent:void 0;(s||a)&&n.set("selectionExtent",s??a,!0)}function kJ(e,t,n){if(!it(n))return;const i=e.fieldDef(t),r=i.sort;if(pD(r))return{op:"min",field:qa(i,t),order:"ascending"};const{stack:s}=e,a=s?new Set([...s.groupbyFields,...s.stackBy.map(o=>o.fieldDef.field)]):void 0;if(zi(r)){const o=s&&!a.has(r.field);return Jh(r,o)}else if(lH(r)){const{encoding:o,order:u}=r,l=e.fieldDef(o),{aggregate:c,field:f}=l,d=s&&!a.has(f);if(Wi(c)||Wr(c))return Jh({field:U(l),order:u},d);if(wy(c)||!c)return Jh({op:c,field:f,order:u},d)}else{if(r==="descending")return{op:"min",field:e.vgField(t),order:"descending"};if(ue(["ascending",void 0],r))return!0}}function bA(e,t){const{aggregate:n,type:i}=e;return n?q(n)&&!jq.has(n)?{valid:!1,reason:NW(n)}:i==="quantitative"&&t==="log"?{valid:!1,reason:MW(e)}:{valid:!0}:{valid:!1,reason:TW(e)}}function Vg(e,t,n,i){return e.explicit&&t.explicit&&M(zW(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function DJ(e){const t=ai(e.map(a=>{if(Bi(a)){const{sort:o,...u}=a;return u}return a}),le),n=ai(e.map(a=>{if(Bi(a)){const o=a.sort;return o!==void 0&&!Eu(o)&&("op"in o&&o.op==="count"&&delete o.field,o.order==="ascending"&&delete o.order),o}}).filter(a=>a!==void 0),le);if(t.length===0)return;if(t.length===1){const a=e[0];if(Bi(a)&&n.length>0){let o=n[0];if(n.length>1){M(vE);const u=n.filter(l=>j(l)&&"op"in l&&l.op!=="min");n.every(l=>j(l)&&"op"in l)&&u.length===1?o=u[0]:o=!0}else if(j(o)&&"field"in o){const u=o.field;a.field===u&&(o=o.order?{order:o.order}:!0)}return{...a,sort:o}}return a}const i=ai(n.map(a=>Eu(a)||!("op"in a)||q(a.op)&&H(Pq,a.op)?a:(M(jW(a)),!0)),le);let r;i.length===1?r=i[0]:i.length>1&&(M(vE),r=!0);const s=ai(e.map(a=>Bi(a)?a.data:null),a=>a);return s.length===1&&s[0]!==null?{data:s[0],fields:t.map(o=>o.field),...r?{sort:r}:{}}:{fields:t,...r?{sort:r}:{}}}function Db(e){if(Bi(e)&&q(e.field))return e.field;if(qq(e)){let t;for(const n of e.fields)if(Bi(n)&&q(n.field)){if(!t)t=n.field;else if(t!==n.field)return M(qW),t}return M(WW),t}else if(Wq(e)){M(GW);const t=e.fields[0];return q(t)?t:void 0}}function zd(e,t){const i=e.component.scales[t].get("domains").map(r=>(Bi(r)&&(r.data=e.lookupDataSource(r.data)),r));return DJ(i)}function g3(e){return ho(e)||Ob(e)?e.children.reduce((t,n)=>t.concat(g3(n)),xA(e)):xA(e)}function xA(e){return _(e.component.scales).reduce((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:s,type:a,selectionExtent:o,domains:u,range:l,reverse:c,...f}=r,d=OJ(r.range,s,n,e),p=zd(e,n),h=o?vX(e,o,i,p):null;return t.push({name:s,type:a,...p?{domain:p}:{},...h?{domainRaw:h}:{},range:d,...c!==void 0?{reverse:c}:{},...f}),t},[])}function OJ(e,t,n,i){if(je(n)){if(Gs(e))return{step:{signal:`${t}_step`}}}else if(j(e)&&Bi(e))return{...e,data:i.lookupDataSource(e.data)};return e}class m3 extends tr{constructor(t,n){super({},{name:t}),this.merged=!1,this.setWithExplicit("type",n)}domainHasZero(){const t=this.get("type");if(ue([ot.LOG,ot.TIME,ot.UTC],t))return"definitely-not";const n=this.get("zero");if(n===!0||n===void 0&&ue([ot.LINEAR,ot.SQRT,ot.POW],t))return"definitely";const i=this.get("domains");if(i.length>0){let r=!1,s=!1,a=!1;for(const o of i){if(D(o)){const u=o[0],l=o[o.length-1];if(ge(u)&&ge(l))if(u<=0&&l>=0){r=!0;continue}else{s=!0;continue}}a=!0}if(r)return"definitely";if(s&&!a)return"definitely-not"}return"maybe"}}const RJ=["range","scheme"];function _J(e){const t=e.component.scales;for(const n of Cy){const i=t[n];if(!i)continue;const r=TJ(n,e);i.setWithExplicit("range",r)}}function vA(e,t){const n=e.fieldDef(t);if(n?.bin){const{bin:i,field:r}=n,s=Ht(t),a=e.getName(s);if(j(i)&&i.binned&&i.step!==void 0)return new Je(()=>{const o=e.scaleName(t),u=`(domain("${o}")[1] - domain("${o}")[0]) / ${i.step}`;return`${e.getSignalName(a)} / (${u})`});if(De(i)){const o=Fb(e,r,i);return new Je(()=>{const u=e.getSignalName(o),l=`(${u}.stop - ${u}.start) / ${u}.step`;return`${e.getSignalName(a)} / (${l})`})}}}function TJ(e,t){const n=t.specifiedScales[e],{size:i}=t,s=t.getScaleComponent(e).get("type");for(const f of RJ)if(n[f]!==void 0){const d=Fg(s,f),p=tD(e,f);if(!d)M(Nk(s,f,e));else if(p)M(p);else switch(f){case"range":{const h=n.range;if(D(h)){if(je(e))return ii(h.map(g=>{if(g==="width"||g==="height"){const m=t.getName(g),y=t.getSignalName.bind(t);return Je.fromName(y,m)}return g}))}else if(j(h))return ii({data:t.requestDataName(Pe.Main),field:h.field,sort:{op:"min",field:t.vgField(e)}});return ii(h)}case"scheme":return ii(NJ(n[f]))}}const a=e===Me||e==="xOffset"?"width":"height",o=i[a];if(yi(o)){if(je(e))if(it(s)){const f=b3(o,t,e);if(f)return ii({step:f})}else M(Mk(a));else if(rl(e)){const f=e===Pr?"x":"y";if(t.getScaleComponent(f).get("type")==="band"){const h=x3(o,s);if(h)return ii(h)}}}const{rangeMin:u,rangeMax:l}=n,c=MJ(e,t);return(u!==void 0||l!==void 0)&&Fg(s,"rangeMin")&&D(c)&&c.length===2?ii([u??c[0],l??c[1]]):Yt(c)}function NJ(e){return OG(e)?{scheme:e.name,...zt(e,["name"])}:{scheme:e}}function y3(e,t,n,{center:i}={}){const r=Ht(e),s=t.getName(r),a=t.getSignalName.bind(t);return e===rt&&In(n)?i?[Je.fromName(o=>`${a(o)}/2`,s),Je.fromName(o=>`-${a(o)}/2`,s)]:[Je.fromName(a,s),0]:i?[Je.fromName(o=>`-${a(o)}/2`,s),Je.fromName(o=>`${a(o)}/2`,s)]:[0,Je.fromName(a,s)]}function MJ(e,t){const{size:n,config:i,mark:r,encoding:s}=t,{type:a}=Xe(s[e]),u=t.getScaleComponent(e).get("type"),{domain:l,domainMid:c}=t.specifiedScales[e];switch(e){case Me:case rt:{if(ue(["point","band"],u)){const f=v3(e,n,i.view);if(yi(f))return{step:b3(f,t,e)}}return y3(e,t,u)}case Pr:case ao:return LJ(e,t,u);case Ji:{const f=IJ(r,i),d=zJ(r,n,t,i);return La(u)?PJ(f,d,BJ(u,i,l,e)):[f,d]}case En:return[0,Math.PI*2];case js:return[0,360];case Vn:return[0,new Je(()=>{const f=t.getSignalName(tn(t.parent)?"child_width":"width"),d=t.getSignalName(tn(t.parent)?"child_height":"height");return`min(${f},${d})/2`})];case Ir:return{step:1e3/i.scale.framesPerSecond};case jr:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case qr:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case Gt:return"symbol";case Wt:case Ci:case wi:return u==="ordinal"?a==="nominal"?"category":"ordinal":c!==void 0?"diverging":r==="rect"||r==="geoshape"?"heatmap":"ramp";case Qi:case zr:case Ur:return[i.scale.minOpacity,i.scale.maxOpacity]}}function b3(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),s=xy(n),a=i[s];if(XD({step:e,offsetIsDiscrete:re(a)&&Yk(a.type)})==="offset"&&kD(i,s)){const u=t.getScaleComponent(s);let c=`domain('${t.scaleName(s)}').length`;if(u.get("type")==="band"){const d=u.get("paddingInner")??u.get("padding")??0,p=u.get("paddingOuter")??u.get("padding")??0;c=`bandspace(${c}, ${d}, ${p})`}const f=r.get("paddingInner")??r.get("padding");return{signal:`${e.step} * ${c} / (1-${Xq(f)})`}}else return e.step}function x3(e,t){if(XD({step:e,offsetIsDiscrete:it(t)})==="offset")return{step:e.step}}function LJ(e,t,n){const i=e===Pr?"x":"y",r=t.getScaleComponent(i);if(!r)return y3(i,t,n,{center:!0});const s=r.get("type"),a=t.scaleName(i),{markDef:o,config:u}=t;if(s==="band"){const l=v3(i,t.size,t.config.view);if(yi(l)){const c=x3(l,n);if(c)return c}return[0,{signal:`bandwidth('${a}')`}]}else{const l=t.encoding[i];if(B(l)&&l.timeUnit){const c=Gk(l.timeUnit,h=>`scale('${a}', ${h})`),f=t.config.scale.bandWithNestedOffsetPaddingInner,d=_r({fieldDef:l,markDef:o,config:u})-.5,p=d!==0?` + ${d}`:"";if(f){const h=Q(f)?`${f.signal}/2`+p:`${f/2+d}`,g=Q(f)?`(1 - ${f.signal}/2)`+p:`${1-f/2+d}`;return[{signal:`${h} * (${c})`},{signal:`${g} * (${c})`}]}return[0,{signal:c}]}return nk(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}function v3(e,t,n){const i=e===Me?"width":"height",r=t[i];return r||ef(n,i)}function BJ(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return n!==void 0&&D(n)?n.length+1:(M(eG(i)),3)}}function PJ(e,t,n){const i=()=>{const r=_n(t),s=_n(e),a=`(${r} - ${s}) / (${n} - 1)`;return`sequence(${s}, ${r} + ${a}, ${a})`};return Q(t)?new Je(i):{signal:i()}}function IJ(e,t){switch(e){case"bar":case"tick":return t.scale.minBandSize;case"line":case"trail":case"rule":return t.scale.minStrokeWidth;case"text":return t.scale.minFontSize;case"point":case"square":case"circle":return t.scale.minSize}throw new Error(hd("size",e))}const EA=.95;function zJ(e,t,n,i){const r={x:vA(n,"x"),y:vA(n,"y")};switch(e){case"bar":case"tick":{if(i.scale.maxBandSize!==void 0)return i.scale.maxBandSize;const s=AA(t,r,i.view);return ge(s)?s-1:new Je(()=>`${s.signal} - 1`)}case"line":case"trail":case"rule":return i.scale.maxStrokeWidth;case"text":return i.scale.maxFontSize;case"point":case"square":case"circle":{if(i.scale.maxSize)return i.scale.maxSize;const s=AA(t,r,i.view);return ge(s)?Math.pow(EA*s,2):new Je(()=>`pow(${EA} * ${s.signal}, 2)`)}}throw new Error(hd("size",e))}function AA(e,t,n){const i=yi(e.width)?e.width.step:Dg(n,"width"),r=yi(e.height)?e.height.step:Dg(n,"height");return t.x||t.y?new Je(()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`):Math.min(i,r)}function E3(e,t){Be(e)?UJ(e,t):C3(e,t)}function UJ(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:s,specifiedScales:a}=e;for(const o of _(n)){const u=a[o],l=n[o],c=e.getScaleComponent(o),f=Xe(r[o]),d=u[t],p=c.get("type"),h=c.get("padding"),g=c.get("paddingInner"),m=Fg(p,t),y=tD(o,t);if(d!==void 0&&(m?y&&M(y):M(Nk(p,t,o))),m&&y===void 0)if(d!==void 0){const b=f.timeUnit,v=f.type;switch(t){case"domainMax":case"domainMin":Hs(u[t])||v==="temporal"||b?l.set(t,{signal:wd(u[t],{type:v,timeUnit:b})},!0):l.set(t,u[t],!0);break;default:l.copyKeyFromObject(t,u)}}else{const b=T(CA,t)?CA[t]({model:e,channel:o,fieldOrDatumDef:f,scaleType:p,scalePadding:h,scalePaddingInner:g,domain:u.domain,domainMin:u.domainMin,domainMax:u.domainMax,markDef:s,config:i,hasNestedOffsetScale:DD(r,o),hasSecondaryRangeChannel:!!r[Fi(o)]}):i.scale[t];b!==void 0&&l.set(t,b,!1)}}}const CA={bins:({model:e,fieldOrDatumDef:t})=>B(t)?jJ(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>qJ(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:i,domainMax:r,fieldOrDatumDef:s})=>WJ(e,t,n,i,r,s),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>GJ(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:i,config:r,hasNestedOffsetScale:s})=>HJ(e,t,n.type,i,r.scale,s),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:i,config:r,hasNestedOffsetScale:s})=>VJ(e,t,n,i,r.scale,s),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>{const r=B(e)?e.sort:void 0;return XJ(t,r,n,i.scale)},zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:i,scaleType:r,config:s,hasSecondaryRangeChannel:a})=>YJ(e,t,n,i,r,s.scale,a)};function A3(e){Be(e)?_J(e):C3(e,"range")}function C3(e,t){const n=e.component.scales;for(const i of e.children)t==="range"?A3(i):E3(i,t);for(const i of _(n)){let r;for(const s of e.children){const a=s.component.scales[i];if(a){const o=a.getWithExplicit(t);r=Tr(r,o,t,"scale",oO((u,l)=>t==="range"&&u.step&&l.step?u.step-l.step:0))}}n[i].setWithExplicit(t,r)}}function jJ(e,t){const n=t.bin;if(De(n)){const i=Fb(e,t.field,n);return new Je(()=>e.getSignalName(i))}else if(st(n)&&Ws(n)&&n.step!==void 0)return{step:n.step}}function qJ(e,t){if(ue([Wt,Ci,wi],e)&&t!=="nominal")return"hcl"}function WJ(e,t,n,i,r,s){if(!(Un(s)?.bin||D(n)||r!=null||i!=null||ue([ot.TIME,ot.UTC],e)))return je(t)?!0:void 0}function GJ(e,t,n,i,r,s){if(je(e)){if(oi(t)){if(n.continuousPadding!==void 0)return n.continuousPadding;const{type:a,orient:o}=r;if(a==="bar"&&!(B(i)&&(i.bin||i.timeUnit))&&(o==="vertical"&&e==="x"||o==="horizontal"&&e==="y"))return s.continuousBandSize}if(t===ot.POINT)return n.pointPadding}}function HJ(e,t,n,i,r,s=!1){if(e===void 0){if(je(t)){const{bandPaddingInner:a,barBandPaddingInner:o,rectBandPaddingInner:u,tickBandPaddingInner:l,bandWithNestedOffsetPaddingInner:c}=r;return s?c:Ue(a,n==="bar"?o:n==="tick"?l:u)}else if(rl(t)&&i===ot.BAND)return r.offsetBandPaddingInner}}function VJ(e,t,n,i,r,s=!1){if(e===void 0){if(je(t)){const{bandPaddingOuter:a,bandWithNestedOffsetPaddingOuter:o}=r;if(s)return o;if(n===ot.BAND)return Ue(a,Q(i)?{signal:`${i.signal}/2`}:i/2)}else if(rl(t)){if(n===ot.POINT)return .5;if(n===ot.BAND)return r.offsetBandPaddingOuter}}}function XJ(e,t,n,i){if(n==="x"&&i.xReverse!==void 0)return In(e)&&t==="descending"?Q(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse;if(In(e)&&t==="descending")return!0}function YJ(e,t,n,i,r,s,a){if(!!n&&n!=="unaggregated"&&In(r)){if(D(n)){const u=n[0],l=n[n.length-1];if(ge(u)&&u<=0&&ge(l)&&l>=0)return!0}return!1}if(e==="size"&&t.type==="quantitative"&&!La(r))return!0;if(!(B(t)&&t.bin)&&ue([...Zi,...Dq],e)){const{orient:u,type:l}=i;return ue(["bar","area","line","trail"],l)&&(u==="horizontal"&&e==="y"||u==="vertical"&&e==="x")?!1:ue(["bar","area"],l)&&!a?!0:s?.zero}return!1}function KJ(e,t,n,i,r=!1){const s=JJ(t,n,i,r),{type:a}=e;return Si(t)?a!==void 0?BG(t,a)?B(n)&&!LG(a,n.type)?(M(PW(a,s)),s):a:(M(BW(t,a,s)),s):s:null}function JJ(e,t,n,i){switch(t.type){case"nominal":case"ordinal":{if(ya(e)||Lh(e)==="discrete")return e==="shape"&&t.type==="ordinal"&&M(Bh(e,"ordinal")),"ordinal";if(Mh(e))return"band";if(je(e)||rl(e)){if(ue(["rect","bar","image","rule","tick"],n.type)||i)return"band"}else if(n.type==="arc"&&e in Ay)return"band";const r=n[Ht(e)];return ks(r)||Pa(t)&&t.axis?.tickBand?"band":"point"}case"temporal":return ya(e)?"time":Lh(e)==="discrete"?(M(Bh(e,"temporal")),"ordinal"):B(t)&&t.timeUnit&&nt(t.timeUnit).utc?"utc":Mh(e)?"band":"time";case"quantitative":return ya(e)?B(t)&&De(t.bin)?"bin-ordinal":"linear":Lh(e)==="discrete"?(M(Bh(e,"quantitative")),"ordinal"):Mh(e)?"band":"linear";case"geojson":return}throw new Error(_k(t.type))}function QJ(e,{ignoreRange:t}={}){w3(e),p3(e);for(const n of MG)E3(e,n);t||A3(e)}function w3(e){Be(e)?e.component.scales=ZJ(e):e.component.scales=tQ(e)}function ZJ(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const s of Cy){const a=Xe(t[s]);if(a&&n===rD&&s===Gt&&a.type===oo)continue;let o=a&&a.scale;if(a&&o!==null&&o!==!1){o??(o={});const u=DD(t,s),l=KJ(o,s,a,i,u);r[s]=new m3(e.scaleName(`${s}`,!0),{value:l,explicit:o.type===l})}}return r}const eQ=oO((e,t)=>AE(e)-AE(t));function tQ(e){var t;const n=e.component.scales={},i={},r=e.component.resolve;for(const s of e.children){w3(s);for(const a of _(s.component.scales))if((t=r.scale)[a]??(t[a]=t3(a,e)),r.scale[a]==="shared"){const o=i[a],u=s.component.scales[a].getWithExplicit("type");o?FG(o.value,u.value)?i[a]=Tr(o,u,"type","scale",eQ):(r.scale[a]="independent",delete i[a]):i[a]=u}}for(const s of _(i)){const a=e.scaleName(s,!0),o=i[s];n[s]=new m3(a,o);for(const u of e.children){const l=u.component.scales[s];l&&(u.renameScale(l.get("name"),a),l.merged=!0)}}return n}class Qh{constructor(){this.nameMap={}}rename(t,n){this.nameMap[t]=n}has(t){return this.nameMap[t]!==void 0}get(t){for(;this.nameMap[t]&&t!==this.nameMap[t];)t=this.nameMap[t];return t}}function Be(e){return e?.type==="unit"}function tn(e){return e?.type==="facet"}function Ob(e){return e?.type==="concat"}function ho(e){return e?.type==="layer"}class Rb{constructor(t,n,i,r,s,a,o){this.type=n,this.parent=i,this.config=s,this.parent=i,this.config=s,this.view=at(o),this.name=t.name??r,this.title=lr(t.title)?{text:t.title}:t.title?at(t.title):void 0,this.scaleNameMap=i?i.scaleNameMap:new Qh,this.projectionNameMap=i?i.projectionNameMap:new Qh,this.signalNameMap=i?i.signalNameMap:new Qh,this.data=t.data,this.description=t.description,this.transforms=JV(t.transform??[]),this.layout=n==="layer"||n==="unit"?{}:tV(t,n,s),this.component={data:{sources:i?i.component.data.sources:[],outputNodes:i?i.component.data.outputNodes:{},outputNodeRefCounts:i?i.component.data.outputNodeRefCounts:{},isFaceted:Ed(t)||i?.component.data.isFaceted&&t.data===void 0},layoutSize:new tr,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...a?ie(a):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){QJ(this)}parseProjection(){f3(this)}renameTopLevelLayoutSizeSignal(){this.getName("width")!=="width"&&this.renameSignal(this.getName("width"),"width"),this.getName("height")!=="height"&&this.renameSignal(this.getName("height"),"height")}parseLegends(){a3(this)}assembleEncodeFromView(t){const{style:n,...i}=t,r={};for(const s of _(i)){const a=i[s];a!==void 0&&(r[s]=Re(a))}return r}assembleGroupEncodeEntry(t){let n={};return this.view&&(n=this.assembleEncodeFromView(this.view)),!t&&(this.description&&(n.description=Re(this.description)),this.type==="unit"||this.type==="layer")?{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...n}:we(n)?void 0:n}assembleLayout(){if(!this.layout)return;const{spacing:t,...n}=this.layout,{component:i,config:r}=this,s=EK(i.layoutHeaders,r);return{padding:t,...this.assembleDefaultLayout(),...n,...s?{titleBand:s}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:t}=this.component;let n=[];for(const i of fn)t[i].title&&n.push(gK(this,i));for(const i of Eb)n=n.concat(mK(this,i));return n}assembleAxes(){return nK(this.component.axes,this.config)}assembleLegends(){return u3(this)}assembleProjections(){return WK(this)}assembleTitle(){const{encoding:t,...n}=this.title??{},i={...Ck(this.config.title).nonMarkTitleProperties,...n,...t?{encode:{update:t}}:{}};if(i.text)return ue(["unit","layer"],this.type)?ue(["middle",void 0],i.anchor)&&(i.frame??(i.frame="group")):i.anchor??(i.anchor="start"),we(i)?void 0:i}assembleGroup(t=[]){const n={};t=t.concat(this.assembleSignals()),t.length>0&&(n.signals=t);const i=this.assembleLayout();i&&(n.layout=i),n.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const r=!this.parent||tn(this.parent)?g3(this):[];r.length>0&&(n.scales=r);const s=this.assembleAxes();s.length>0&&(n.axes=s);const a=this.assembleLegends();return a.length>0&&(n.legends=a),n}getName(t){return Ne((this.name?`${this.name}_`:"")+t)}getDataName(t){return this.getName(Pe[t].toLowerCase())}requestDataName(t){const n=this.getDataName(t),i=this.component.data.outputNodeRefCounts;return i[n]=(i[n]||0)+1,n}getSizeSignalRef(t){if(tn(this.parent)){const n=ZO(t),i=cd(n),r=this.component.scales[i];if(r&&!r.merged){const s=r.get("type"),a=r.get("range");if(it(s)&&Gs(a)){const o=r.get("name"),u=zd(this,i),l=Db(u);if(l){const c=U({aggregate:"distinct",field:l},{expr:"datum"});return{signal:QO(o,r,c)}}else return M(Sy(i)),null}}}return{signal:this.signalNameMap.get(this.getName(t))}}lookupDataSource(t){const n=this.component.data.outputNodes[t];return n?n.getSource():t}getSignalName(t){return this.signalNameMap.get(t)}renameSignal(t,n){this.signalNameMap.rename(t,n)}renameScale(t,n){this.scaleNameMap.rename(t,n)}renameProjection(t,n){this.projectionNameMap.rename(t,n)}scaleName(t,n){if(n)return this.getName(t);if(gk(t)&&Si(t)&&this.component.scales[t]||this.scaleNameMap.has(this.getName(t)))return this.scaleNameMap.get(this.getName(t))}projectionName(t){if(t)return this.getName("projection");if(this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection")))return this.projectionNameMap.get(this.getName("projection"))}getScaleComponent(t){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const n=this.component.scales[t];return n&&!n.merged?n:this.parent?this.parent.getScaleComponent(t):void 0}getScaleType(t){const n=this.getScaleComponent(t);return n?n.get("type"):void 0}getSelectionComponent(t,n){let i=this.component.selection[t];if(!i&&this.parent&&(i=this.parent.getSelectionComponent(t,n)),!i)throw new Error(Zq(n));return i}hasAxisOrientSignalRef(){return this.component.axes.x?.some(t=>t.hasOrientSignalRef())||this.component.axes.y?.some(t=>t.hasOrientSignalRef())}}class F3 extends Rb{vgField(t,n={}){const i=this.fieldDef(t);if(i)return U(i,n)}reduceFieldDef(t,n){return OH(this.getMapping(),(i,r,s)=>{const a=Un(r);return a?t(i,a,s):i},n)}forEachFieldDef(t,n){eb(this.getMapping(),(i,r)=>{const s=Un(i);s&&t(s,r)},n)}}class Ud extends Ae{clone(){return new Ud(null,ie(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ie(n);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??"value",i[1]??"density"];const r=this.transform.resolve??"shared";this.transform.resolve=r}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${le(this.transform)}`}assemble(){const{density:t,...n}=this.transform,i={type:"kde",field:t,...n};return i.resolve=this.transform.resolve,i}}class jd extends Ae{clone(){return new jd(null,ie(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ie(n)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${le(this.transform)}`}assemble(){const{extent:t,param:n}=this.transform;return{type:"extent",field:t,signal:n}}}class qd extends Ae{clone(){return new qd(this.parent,ie(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ie(n);const{flatten:i,as:r=[]}=this.transform;this.transform.as=i.map((s,a)=>r[a]??s)}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${le(this.transform)}`}assemble(){const{flatten:t,as:n}=this.transform;return{type:"flatten",fields:t,as:n}}}class Wd extends Ae{clone(){return new Wd(null,ie(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ie(n);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??"key",i[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${le(this.transform)}`}assemble(){const{fold:t,as:n}=this.transform;return{type:"fold",fields:t,as:n}}}class va extends Ae{clone(){return new va(null,ie(this.fields),this.geojson,this.signal)}static parseAll(t,n){if(n.component.projection&&!n.component.projection.isFit)return t;let i=0;for(const r of[[Yn,Xn],[xn,Kn]]){const s=r.map(a=>{const o=Xe(n.encoding[a]);return B(o)?o.field:$i(o)?{expr:`${o.datum}`}:zn(o)?{expr:`${o.value}`}:void 0});(s[0]||s[1])&&(t=new va(t,s,null,n.getName(`geojson_${i++}`)))}if(n.channelHasField(Gt)){const r=n.typedFieldDef(Gt);r.type===oo&&(t=new va(t,null,r.field,n.getName(`geojson_${i++}`)))}return t}constructor(t,n,i,r){super(t),this.fields=n,this.geojson=i,this.signal=r}dependentFields(){const t=(this.fields??[]).filter(q);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${le(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class $u extends Ae{clone(){return new $u(null,this.projection,ie(this.fields),ie(this.as))}constructor(t,n,i,r){super(t),this.projection=n,this.fields=i,this.as=r}static parseAll(t,n){if(!n.projectionName())return t;for(const i of[[Yn,Xn],[xn,Kn]]){const r=i.map(a=>{const o=Xe(n.encoding[a]);return B(o)?o.field:$i(o)?{expr:`${o.datum}`}:zn(o)?{expr:`${o.value}`}:void 0}),s=i[0]===xn?"2":"";(r[0]||r[1])&&(t=new $u(t,n.projectionName(),r,[n.getName(`x${s}`),n.getName(`y${s}`)]))}return t}dependentFields(){return new Set(this.fields.filter(q))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${le(this.fields)} ${le(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class ps extends Ae{clone(){return new ps(null,ie(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(t){const{start:n=0,stop:i,step:r}=t;return{signal:`sequence(${[n,i,...r?[r]:[]].join(",")})`}}static makeFromTransform(t,n){return new ps(t,n)}static makeFromEncoding(t,n){const i=n.encoding,r=i.x,s=i.y;if(B(r)&&B(s)){const a=r.impute?r:s.impute?s:void 0;if(a===void 0)return;const o=r.impute?s:s.impute?r:void 0,{method:u,value:l,frame:c,keyvals:f}=a.impute,d=_D(n.mark,i);return new ps(t,{impute:a.field,key:o.field,...u?{method:u}:{},...l!==void 0?{value:l}:{},...c?{frame:c}:{},...f!==void 0?{keyvals:f}:{},...d.length?{groupby:d}:{}})}return null}hash(){return`Impute ${le(this.transform)}`}assemble(){const{impute:t,key:n,keyvals:i,method:r,groupby:s,value:a,frame:o=[null,null]}=this.transform,u={type:"impute",field:t,key:n,...i?{keyvals:_V(i)?this.processSequence(i):i}:{},method:"value",...s?{groupby:s}:{},value:!r||r==="value"?a:null};if(r&&r!=="value"){const l={type:"window",as:[`imputed_${t}_value`],ops:[r],fields:[t],frame:o,ignorePeers:!1,...s?{groupby:s}:{}},c={type:"formula",expr:`datum.${t} === null ? datum.imputed_${t}_value : datum.${t}`,as:t};return[u,l,c]}else return[u]}}class Gd extends Ae{clone(){return new Gd(null,ie(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ie(n);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??n.on,i[1]??n.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${le(this.transform)}`}assemble(){const{loess:t,on:n,...i}=this.transform;return{type:"loess",x:n,y:t,...i}}}class ku extends Ae{clone(){return new ku(null,ie(this.transform),this.secondary)}constructor(t,n,i){super(t),this.transform=n,this.secondary=i}static make(t,n,i,r){const s=n.component.data.sources,{from:a}=i;let o=null;if(TV(a)){let u=k3(a.data,s);u||(u=new Ns(a.data),s.push(u));const l=n.getName(`lookup_${r}`);o=new Ut(u,l,Pe.Lookup,n.component.data.outputNodeRefCounts),n.component.data.outputNodes[l]=o}else if(NV(a)){const u=a.param;i={as:u,...i};let l;try{l=n.getSelectionComponent(Ne(u),u)}catch{throw new Error(iW(u))}if(o=l.materialized,!o)throw new Error(rW(u))}return new ku(t,i,o.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?W(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${le({transform:this.transform,secondary:this.secondary})}`}assemble(){let t;if(this.transform.from.fields)t={values:this.transform.from.fields,...this.transform.as?{as:W(this.transform.as)}:{}};else{let n=this.transform.as;q(n)||(M(gW),n="_lookup"),t={as:[n]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...t,...this.transform.default?{default:this.transform.default}:{}}}}class Hd extends Ae{clone(){return new Hd(null,ie(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ie(n);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??"prob",i[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${le(this.transform)}`}assemble(){const{quantile:t,...n}=this.transform;return{type:"quantile",field:t,...n}}}class Vd extends Ae{clone(){return new Vd(null,ie(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=ie(n);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??n.on,i[1]??n.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${le(this.transform)}`}assemble(){const{regression:t,on:n,...i}=this.transform;return{type:"regression",x:n,y:t,...i}}}class Xd extends Ae{clone(){return new Xd(null,ie(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=ai((this.transform.groupby??[]).concat(t),n=>n)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${le(this.transform)}`}assemble(){const{pivot:t,value:n,groupby:i,limit:r,op:s}=this.transform;return{type:"pivot",field:t,value:n,...r!==void 0?{limit:r}:{},...s!==void 0?{op:s}:{},...i!==void 0?{groupby:i}:{}}}}class Yd extends Ae{clone(){return new Yd(null,ie(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${le(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function S3(e){let t=0;function n(i,r){if(i instanceof Ns&&!i.isGenerator&&!za(i.data)&&(e.push(r),r={name:null,source:r.name,transform:[]}),i instanceof vt&&(i.parent instanceof Ns&&!r.source?(r.format={...r.format,parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof co){r.name||(r.name=`data_${t++}`),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,e.push(...i.assemble());return}switch((i instanceof yl||i instanceof bl||i instanceof Ga||i instanceof lo||i instanceof ja||i instanceof $u||i instanceof Mn||i instanceof ku||i instanceof fo||i instanceof Js||i instanceof Wd||i instanceof qd||i instanceof Ud||i instanceof Gd||i instanceof Hd||i instanceof Vd||i instanceof Nr||i instanceof Yd||i instanceof Xd||i instanceof jd)&&r.transform.push(i.assemble()),(i instanceof fi||i instanceof li||i instanceof ps||i instanceof ji||i instanceof va)&&r.transform.push(...i.assemble()),i instanceof Ut&&(r.source&&r.transform.length===0?i.setSource(r.source):i.parent instanceof Ut?i.setSource(r.name):(r.name||(r.name=`data_${t++}`),i.setSource(r.name),i.numChildren()===1&&(e.push(r),r={name:null,source:r.name,transform:[]}))),i.numChildren()){case 0:i instanceof Ut&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name=`data_${t++}`);let s=r.name;!r.source||r.transform.length>0?e.push(r):s=r.source;for(const a of i.children)n(a,{name:null,source:s,transform:[]});break}}}return n}function nQ(e){const t=[],n=S3(t);for(const i of e.children)n(i,{source:e.name,name:null,transform:[]});return t}function iQ(e,t){const n=[],i=S3(n);let r=0;for(const a of e.sources){a.hasName()||(a.dataName=`source_${r++}`);const o=a.assemble();i(a,o)}for(const a of n)a.transform.length===0&&delete a.transform;let s=0;for(const[a,o]of n.entries())(o.transform??[]).length===0&&!o.source&&n.splice(s++,0,n.splice(a,1)[0]);for(const a of n)for(const o of a.transform??[])o.type==="lookup"&&(o.from=e.outputNodes[o.from].getSource());for(const a of n)a.name in t&&(a.values=t[a.name]);return n}function rQ(e){return e==="top"||e==="left"||Q(e)?"header":"footer"}function sQ(e){for(const t of fn)aQ(e,t);wA(e,"x"),wA(e,"y")}function aQ(e,t){const{facet:n,config:i,child:r,component:s}=e;if(e.channelHasField(t)){const a=n[t],o=Wa("title",null,i,t);let u=ba(a,i,{allowDisabling:!0,includeDefault:o===void 0||!!o});r.component.layoutHeaders[t].title&&(u=D(u)?u.join(", "):u,u+=` / ${r.component.layoutHeaders[t].title}`,r.component.layoutHeaders[t].title=null);const l=Wa("labelOrient",a.header,i,t),c=a.header!==null?Ue(a.header?.labels,i.header.labels,!0):!1,f=ue(["bottom","right"],l)?"footer":"header";s.layoutHeaders[t]={title:a.header!==null?u:null,facetFieldDef:a,[f]:t==="facet"?[]:[$3(e,t,c)]}}}function $3(e,t,n){const i=t==="row"?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function wA(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:i,resolve:r}=e.component;if(r.axis[t]=wb(r,t),r.axis[t]==="shared"){const s=t==="x"?"column":"row",a=i[s];for(const o of n.component.axes[t]){const u=rQ(o.get("orient"));a[u]??(a[u]=[$3(e,s,!1)]);const l=Ho(o,"main",e.config,{header:!0});l&&a[u][0].axes.push(l),o.mainExtracted=!0}}}}function oQ(e){_b(e),af(e,"width"),af(e,"height")}function uQ(e){_b(e);const t=e.layout.columns===1?"width":"childWidth",n=e.layout.columns===void 0?"height":"childHeight";af(e,t),af(e,n)}function _b(e){for(const t of e.children)t.parseLayoutSize()}function af(e,t){const n=ZO(t),i=cd(n),r=e.component.resolve,s=e.component.layoutSize;let a;for(const o of e.children){const u=o.component.layoutSize.getWithExplicit(n),l=r.scale[i]??t3(i,e);if(l==="independent"&&u.value==="step"){a=void 0;break}if(a){if(l==="independent"&&a.value!==u.value){a=void 0;break}a=Tr(a,u,n,"")}else a=u}if(a){for(const o of e.children)e.renameSignal(o.getName(n),e.getName(t)),o.component.layoutSize.set(n,"merged",!1);s.setWithExplicit(t,a)}else s.setWithExplicit(t,{explicit:!1,value:void 0})}function lQ(e){const{size:t,component:n}=e;for(const i of Zi){const r=Ht(i);if(t[r]){const s=t[r];n.layoutSize.set(r,yi(s)?"step":s,!0)}else{const s=cQ(e,r);n.layoutSize.set(r,s,!1)}}}function cQ(e,t){const n=t==="width"?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const s=r.get("type"),a=r.get("range");if(it(s)){const o=ef(i.view,t);return Gs(a)||yi(o)?"step":o}else return kg(i.view,t)}else{if(e.hasProjection||e.mark==="arc")return kg(i.view,t);{const s=ef(i.view,t);return yi(s)?s.step:s}}}function Xg(e,t,n){return U(t,{suffix:`by_${U(e)}`,...n})}class su extends F3{constructor(t,n,i,r){super(t,"facet",n,i,r,t.resolve),this.child=Bb(t.spec,this,this.getName("child"),void 0,r),this.children=[this.child],this.facet=this.initFacet(t.facet)}initFacet(t){if(!ul(t))return{facet:this.initFacetFieldDef(t,"facet")};const n=_(t),i={};for(const r of n){if(![Pi,Ii].includes(r)){M(hd(r,"facet"));break}const s=t[r];if(s.field===void 0){M(Cg(s,r));break}i[r]=this.initFacetFieldDef(s,r)}return i}initFacetFieldDef(t,n){const i=Zy(t,n);return i.header?i.header=at(i.header):i.header===null&&(i.header=null),i}channelHasField(t){return T(this.facet,t)}fieldDef(t){return this.facet[t]}parseData(){this.component.data=Kd(this),this.child.parseData()}parseLayoutSize(){_b(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Object.values(this.component.selection).some(t=>ci(t))&&ky($y)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),sQ(this)}assembleSelectionTopLevelSignals(t){return this.child.assembleSelectionTopLevelSignals(t)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(t){return this.child.assembleSelectionData(t)}getHeaderLayoutMixins(){const t={};for(const n of fn)for(const i of Ab){const r=this.component.layoutHeaders[n],s=r[i],{facetFieldDef:a}=r;if(a){const o=Wa("titleOrient",a.header,this.config,n);if(["right","bottom"].includes(o)){const u=Pd(n,o);t.titleAnchor??(t.titleAnchor={}),t.titleAnchor[u]="end"}}if(s?.[0]){const o=n==="row"?"height":"width",u=i==="header"?"headerBand":"footerBand";n!=="facet"&&!this.child.component.layoutSize.get(o)&&(t[u]??(t[u]={}),t[u][n]=.5),r.title&&(t.offset??(t.offset={}),t.offset[n==="row"?"rowTitle":"columnTitle"]=10)}}return t}assembleDefaultLayout(){const{column:t,row:n}=this.facet,i=t?this.columnDistinctSignal():n?1:void 0;let r="all";return(!n&&this.component.resolve.scale.x==="independent"||!t&&this.component.resolve.scale.y==="independent")&&(r="none"),{...this.getHeaderLayoutMixins(),...i?{columns:i}:{},bounds:"full",align:r}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof su))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(t){return this.parent&&this.parent instanceof su?{...this.channelHasField("column")?{encode:{update:{columns:{field:U(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(t)}:super.assembleGroup(t)}getCardinalityAggregateForChild(){const t=[],n=[],i=[];if(this.child instanceof su){if(this.child.channelHasField("column")){const r=U(this.child.facet.column);t.push(r),n.push("distinct"),i.push(`distinct_${r}`)}}else for(const r of Zi){const s=this.child.component.scales[r];if(s&&!s.merged){const a=s.get("type"),o=s.get("range");if(it(a)&&Gs(o)){const u=zd(this.child,r),l=Db(u);l?(t.push(l),n.push("distinct"),i.push(`distinct_${l}`)):M(Sy(r))}}}return{fields:t,ops:n,as:i}}assembleFacet(){const{name:t,data:n}=this.component.data.facetRoot,{row:i,column:r}=this.facet,{fields:s,ops:a,as:o}=this.getCardinalityAggregateForChild(),u=[];for(const c of fn){const f=this.facet[c];if(f){u.push(U(f));const{bin:d,sort:p}=f;if(De(d)&&u.push(U(f,{binSuffix:"end"})),zi(p)){const{field:h,op:g=vd}=p,m=Xg(f,p);i&&r?(s.push(m),a.push("max"),o.push(m)):(s.push(h),a.push(g),o.push(m))}else if(D(p)){const h=qa(f,c);s.push(h),a.push("max"),o.push(h)}}}const l=!!i&&!!r;return{name:t,data:n,groupby:u,...l||s.length>0?{aggregate:{...l?{cross:l}:{},...s.length?{fields:s,ops:a,as:o}:{}}}:{}}}facetSortFields(t){const{facet:n}=this,i=n[t];return i?zi(i.sort)?[Xg(i,i.sort,{expr:"datum"})]:D(i.sort)?[qa(i,t,{expr:"datum"})]:[U(i,{expr:"datum"})]:[]}facetSortOrder(t){const{facet:n}=this,i=n[t];if(i){const{sort:r}=i;return[(zi(r)?r.order:!D(r)&&r)||"ascending"]}return[]}assembleLabelTitle(){const{facet:t,config:n}=this;if(t.facet)return Ug(t.facet,"facet",n);const i={row:["top","bottom"],column:["left","right"]};for(const r of Eb)if(t[r]){const s=Wa("labelOrient",t[r]?.header,n,r);if(i[r].includes(s))return Ug(t[r],r,n)}}assembleMarks(){const{child:t}=this,n=this.component.data.facetRoot,i=nQ(n),r=t.assembleGroupEncodeEntry(!1),s=this.assembleLabelTitle()||t.assembleTitle(),a=t.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...s?{title:s}:{},...a?{style:a}:{},from:{facet:this.assembleFacet()},sort:{field:fn.map(u=>this.facetSortFields(u)).flat(),order:fn.map(u=>this.facetSortOrder(u)).flat()},...i.length>0?{data:i}:{},...r?{encode:{update:r}}:{},...t.assembleGroup(mX(this,[]))}]}getMapping(){return this.facet}}function fQ(e,t){const{row:n,column:i}=t;if(n&&i){let r=null;for(const s of[n,i])if(zi(s.sort)){const{field:a,op:o=vd}=s.sort;e=r=new Js(e,{joinaggregate:[{op:o,field:a,as:Xg(s,s.sort,{forAs:!0})}],groupby:[U(s)]})}return r}return null}function k3(e,t){for(const n of t){const i=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;const r=e.format?.mesh,s=i.format?.feature;if(r&&s)continue;const a=e.format?.feature;if((a||s)&&a!==s)continue;const o=i.format?.mesh;if(!((r||o)&&r!==o)){if(wu(e)&&wu(i)){if(Jt(e.values,i.values))return n}else if(za(e)&&za(i)){if(e.url===i.url)return n}else if(uO(e)&&e.name===n.dataName)return n}}return null}function dQ(e,t){if(e.data||!e.parent){if(e.data===null){const i=new Ns({values:[]});return t.push(i),i}const n=k3(e.data,t);if(n)return Cr(e.data)||(n.data.format=ik({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const i=new Ns(e.data);return t.push(i),i}}else return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function hQ(e,t,n){let i=0;for(const r of t.transforms){let s,a;if(WV(r))a=e=new ja(e,r),s="derived";else if(fb(r)){const o=iJ(r);a=e=vt.makeWithAncestors(e,{},o,n)??e,e=new lo(e,t,r.filter)}else if(iO(r))a=e=fi.makeFromTransform(e,r,t),s="number";else if(HV(r))s="date",n.getWithExplicit(r.field).value===void 0&&(e=new vt(e,{[r.field]:s}),n.set(r.field,s,!1)),a=e=li.makeFromTransform(e,r);else if(VV(r))a=e=Mn.makeFromTransform(e,r),s="number",yb(t)&&(e=new Nr(e));else if(nO(r))a=e=ku.make(e,t,r,i++),s="derived";else if(UV(r))a=e=new fo(e,r),s="number";else if(jV(r))a=e=new Js(e,r),s="number";else if(XV(r))a=e=ji.makeFromTransform(e,r),s="derived";else if(YV(r))a=e=new Wd(e,r),s="derived";else if(KV(r))a=e=new jd(e,r),s="derived";else if(qV(r))a=e=new qd(e,r),s="derived";else if(MV(r))a=e=new Xd(e,r),s="derived";else if(zV(r))e=new Yd(e,r);else if(GV(r))a=e=ps.makeFromTransform(e,r),s="derived";else if(LV(r))a=e=new Ud(e,r),s="derived";else if(BV(r))a=e=new Hd(e,r),s="derived";else if(PV(r))a=e=new Vd(e,r),s="derived";else if(IV(r))a=e=new Gd(e,r),s="derived";else{M(pW(r));continue}if(a&&s!==void 0)for(const o of a.producedFields()??[])n.set(o,s,!1)}return e}function Kd(e){let t=dQ(e,e.component.data.sources);const{outputNodes:n,outputNodeRefCounts:i}=e.component.data,r=e.data,a=!(r&&(Cr(r)||za(r)||wu(r)))&&e.parent?e.parent.component.data.ancestorParse.clone():new uX;Cr(r)?(lO(r)?t=new bl(t,r.sequence):db(r)&&(t=new yl(t,r.graticule)),a.parseNothing=!0):r?.format?.parse===null&&(a.parseNothing=!0),t=vt.makeExplicit(t,e,a)??t,t=new Nr(t);const o=e.parent&&ho(e.parent);(Be(e)||tn(e))&&o&&(t=fi.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=hQ(t,e,a));const u=sJ(e),l=rJ(e);t=vt.makeWithAncestors(t,{},{...u,...l},a)??t,Be(e)&&(t=va.parseAll(t,e),t=$u.parseAll(t,e)),(Be(e)||tn(e))&&(o||(t=fi.makeFromEncoding(t,e)??t),t=li.makeFromEncoding(t,e)??t,t=ja.parseAllForSortIndex(t,e));const c=t=Pl(Pe.Raw,e,t);if(Be(e)){const m=Mn.makeFromEncoding(t,e);m&&(t=m,yb(e)&&(t=new Nr(t))),t=ps.makeFromEncoding(t,e)??t,t=ji.makeFromEncoding(t,e)??t}let f,d;if(Be(e)){const{markDef:m,mark:y,config:b}=e,v=Ce("invalid",m,b),{marks:A,scales:E}=d=fO({invalid:v,isPath:Gr(y)});A!==E&&E==="include-invalid-values"&&(f=t=Pl(Pe.PreFilterInvalid,e,t)),A==="exclude-invalid-values"&&(t=Ga.make(t,e,d)??t)}const p=t=Pl(Pe.Main,e,t);let h;if(Be(e)&&d){const{marks:m,scales:y}=d;m==="include-invalid-values"&&y==="exclude-invalid-values"&&(t=Ga.make(t,e,d)??t,h=t=Pl(Pe.PostFilterInvalid,e,t))}Be(e)&&eK(e,p);let g=null;if(tn(e)){const m=e.getName("facet");t=fQ(t,e.facet)??t,g=new co(t,e,m,p.getSource()),n[m]=g}return{...e.component.data,outputNodes:n,outputNodeRefCounts:i,raw:c,main:p,facetRoot:g,ancestorParse:a,preFilterInvalid:f,postFilterInvalid:h}}function Pl(e,t,n){const{outputNodes:i,outputNodeRefCounts:r}=t.component.data,s=t.getDataName(e),a=new Ut(n,s,e,r);return i[s]=a,a}class pQ extends Rb{constructor(t,n,i,r){super(t,"concat",n,i,r,t.resolve),(t.resolve?.axis?.x==="shared"||t.resolve?.axis?.y==="shared")&&M(fW),this.children=this.getChildren(t).map((s,a)=>Bb(s,this,this.getName(`concat_${a}`),void 0,r))}parseData(){this.component.data=Kd(this);for(const t of this.children)t.parseData()}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of _(t.component.selection))this.component.selection[n]=t.component.selection[n]}Object.values(this.component.selection).some(t=>ci(t))&&ky($y)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){for(const t of this.children)t.parseAxesAndHeaders()}getChildren(t){return $d(t)?t.vconcat:lb(t)?t.hconcat:t.concat}parseLayoutSize(){uQ(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(t){return this.children.reduce((n,i)=>i.assembleSelectionTopLevelSignals(n),t)}assembleSignals(){return this.children.forEach(t=>t.assembleSignals()),[]}assembleLayoutSignals(){const t=Cb(this);for(const n of this.children)t.push(...n.assembleLayoutSignals());return t}assembleSelectionData(t){return this.children.reduce((n,i)=>i.assembleSelectionData(n),t)}assembleMarks(){return this.children.map(t=>{const n=t.assembleTitle(),i=t.assembleGroupStyle(),r=t.assembleGroupEncodeEntry(!1);return{type:"group",name:t.getName("group"),...n?{title:n}:{},...i?{style:i}:{},...r?{encode:{update:r}}:{},...t.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){const t=this.layout.columns;return{...t!=null?{columns:t}:{},bounds:"full",align:"each"}}}function gQ(e){return e===!1||e===null}const mQ={disable:1,gridScale:1,scale:1,...SD,labelExpr:1,encode:1},D3=_(mQ);class Tb extends tr{constructor(t={},n={},i=!1){super(),this.explicit=t,this.implicit=n,this.mainExtracted=i}clone(){return new Tb(ie(this.explicit),ie(this.implicit),this.mainExtracted)}hasAxisPart(t){return t==="axis"?!0:t==="grid"||t==="title"?!!this.get(t):!gQ(this.get(t))}hasOrientSignalRef(){return Q(this.explicit.orient)}}function yQ(e,t,n){const{encoding:i,config:r}=e,s=Xe(i[t])??Xe(i[Fi(t)]),a=e.axis(t)||{},{format:o,formatType:u}=a;if(Ds(u))return{text:Tn({fieldOrDatumDef:s,field:"datum.value",format:o,formatType:u,config:r}),...n};if(o===void 0&&u===void 0&&r.customFormatTypes){if(Ba(s)==="quantitative"){if(Pa(s)&&s.stack==="normalize"&&r.normalizedNumberFormatType)return{text:Tn({fieldOrDatumDef:s,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:Tn({fieldOrDatumDef:s,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if(Ba(s)==="temporal"&&r.timeFormatType&&B(s)&&!s.timeUnit)return{text:Tn({fieldOrDatumDef:s,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}function bQ(e){return Zi.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[FQ(n,e)]),t),{})}const xQ={bottom:"top",top:"bottom",left:"right",right:"left"};function vQ(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const r of e.children){r.parseAxesAndHeaders();for(const s of _(r.component.axes))n.axis[s]=wb(e.component.resolve,s),n.axis[s]==="shared"&&(t[s]=EQ(t[s],r.component.axes[s]),t[s]||(n.axis[s]="independent",delete t[s]))}for(const r of Zi){for(const s of e.children)if(s.component.axes[r]){if(n.axis[r]==="independent"){t[r]=(t[r]??[]).concat(s.component.axes[r]);for(const a of s.component.axes[r]){const{value:o,explicit:u}=a.getWithExplicit("orient");if(!Q(o)){if(i[o]>0&&!u){const l=xQ[o];i[o]>i[l]&&a.set("orient",l,!1)}i[o]++}}}delete s.component.axes[r]}if(n.axis[r]==="independent"&&t[r]&&t[r].length>1)for(const[s,a]of(t[r]||[]).entries())s>0&&a.get("grid")&&!a.explicit.grid&&(a.implicit.grid=!1)}}function EQ(e,t){if(e){if(e.length!==t.length)return;const n=e.length;for(let i=0;in.clone());return e}function AQ(e,t){for(const n of D3){const i=Tr(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",(r,s)=>{switch(n){case"title":return Ok(r,s);case"gridScale":return{explicit:r.explicit,value:Ue(r.value,s.value)}}return Dd(r,s,n,"axis")});e.setWithExplicit(n,i)}return e}function CQ(e,t,n,i,r){if(t==="disable")return n!==void 0;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(Q(n.labelAngle)?n.labelAngle:Au(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===XO(i,r))return!0}return e===n[t]}const wQ=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function FQ(e,t){let n=t.axis(e);const i=new Tb,r=Xe(t.encoding[e]),{mark:s,config:a}=t,o=n?.orient||a[e==="x"?"axisX":"axisY"]?.orient||a.axis?.orient||cK(e),u=t.getScaleComponent(e).get("type"),l=iK(e,u,o,t.config),c=n!==void 0?!n:Ig("disable",a.style,n?.style,l).configValue;if(i.set("disable",c,n!==void 0),c)return i;n=n||{};const f=oK(r,n,e,a.style,l),d=dD(n.formatType,r,u),p=fD(r,r.type,n.format,n.formatType,a,!0),h={fieldOrDatumDef:r,axis:n,channel:e,model:t,scaleType:u,orient:o,labelAngle:f,format:p,formatType:d,mark:s,config:a};for(const y of D3){const b=y in lA?lA[y](h):DE(y)?n[y]:void 0,v=b!==void 0,A=CQ(b,y,n,t,e);if(v&&A)i.set(y,b,A);else{const{configValue:E=void 0,configFrom:C=void 0}=DE(y)&&y!=="values"?Ig(y,a.style,n.style,l):{},x=E!==void 0;v&&!x?i.set(y,b,A):(C!=="vgAxisConfig"||wQ.has(y)&&x||dl(E)||Q(E))&&i.set(y,E,!1)}}const g=n.encoding??{},m=FD.reduce((y,b)=>{if(!i.hasAxisPart(b))return y;const v=e3(g[b]??{},t),A=b==="labels"?yQ(t,e,v):v;return A!==void 0&&!we(A)&&(y[b]={update:A}),y},{});return we(m)||i.set("encode",m,!!n.encoding||n.labelAngle!==void 0),i}function SQ({encoding:e,size:t}){for(const n of Zi){const i=Ht(n);yi(t[i])&&br(e[n])&&(delete t[i],M(Mk(i)))}return t}const $Q={vgMark:"arc",encodeEntry:e=>({...An(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),..._t("x",e,{defaultPos:"mid"}),..._t("y",e,{defaultPos:"mid"}),...Gi(e,"radius"),...Gi(e,"theta")})},kQ={vgMark:"area",encodeEntry:e=>({...An(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...tf("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="horizontal"}),...tf("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="vertical"}),...mb(e)})},DQ={vgMark:"rect",encodeEntry:e=>({...An(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Gi(e,"x"),...Gi(e,"y")})},OQ={vgMark:"shape",encodeEntry:e=>({...An(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&B(n)&&n.type===oo?{field:U(n,{expr:"datum"})}:{}}]}},RQ={vgMark:"image",encodeEntry:e=>({...An(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...Gi(e,"x"),...Gi(e,"y"),...pb(e,"url")})},_Q={vgMark:"line",encodeEntry:e=>({...An(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),..._t("x",e,{defaultPos:"mid"}),..._t("y",e,{defaultPos:"mid"}),...ut("size",e,{vgChannel:"strokeWidth"}),...mb(e)})},TQ={vgMark:"trail",encodeEntry:e=>({...An(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),..._t("x",e,{defaultPos:"mid"}),..._t("y",e,{defaultPos:"mid"}),...ut("size",e),...mb(e)})};function Nb(e,t){const{config:n}=e;return{...An(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),..._t("x",e,{defaultPos:"mid"}),..._t("y",e,{defaultPos:"mid"}),...ut("size",e),...ut("angle",e),...NQ(e,n,t)}}function NQ(e,t,n){return n?{shape:{value:n}}:ut("shape",e)}const MQ={vgMark:"symbol",encodeEntry:e=>Nb(e)},LQ={vgMark:"symbol",encodeEntry:e=>Nb(e,"circle")},BQ={vgMark:"symbol",encodeEntry:e=>Nb(e,"square")},PQ={vgMark:"rect",encodeEntry:e=>({...An(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Gi(e,"x"),...Gi(e,"y")})},IQ={vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return!e.encoding.x&&!e.encoding.y&&!e.encoding.latitude&&!e.encoding.longitude?{}:{...An(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...tf("x",e,{defaultPos:n==="horizontal"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:n!=="vertical"}),...tf("y",e,{defaultPos:n==="vertical"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:n!=="horizontal"}),...ut("size",e,{vgChannel:"strokeWidth"})}}},zQ={vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...An(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),..._t("x",e,{defaultPos:"mid"}),..._t("y",e,{defaultPos:"mid"}),...pb(e),...ut("size",e,{vgChannel:"fontSize"}),...ut("angle",e),...QE("align",UQ(e.markDef,n,t)),...QE("baseline",jQ(e.markDef,n,t)),..._t("radius",e,{defaultPos:null}),..._t("theta",e,{defaultPos:null})}}};function UQ(e,t,n){if(Ce("align",e,n)===void 0)return"center"}function jQ(e,t,n){if(Ce("baseline",e,n)===void 0)return"middle"}const qQ={vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r=i==="horizontal"?"x":"y",s=i==="horizontal"?"y":"x",a=i==="horizontal"?"height":"width";return{...An(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Gi(e,r),..._t(s,e,{defaultPos:"mid",vgChannel:s==="y"?"yc":"xc"}),[a]:Re(Ce("thickness",n,t))}}},Il={arc:$Q,area:kQ,bar:DQ,circle:LQ,geoshape:OQ,image:RQ,line:_Q,point:MQ,rect:PQ,rule:IQ,square:BQ,text:zQ,tick:qQ,trail:TQ};function WQ(e){if(ue([bd,md,UG],e.mark)){const t=_D(e.mark,e.encoding);if(t.length>0)return GQ(e,t)}else if(e.mark===yd){const t=Eg.some(n=>Ce(n,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&t)return HQ(e)}return Mb(e)}const FA="faceted_path_";function GQ(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:FA+e.requestDataName(Pe.Main),data:e.requestDataName(Pe.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:Mb(e,{fromPrefix:FA})}]}const SA="stack_group_";function HQ(e){const[t]=Mb(e,{fromPrefix:SA}),n=e.scaleName(e.stack.fieldChannel),i=(l={})=>e.vgField(e.stack.fieldChannel,l),r=(l,c)=>{const f=[i({prefix:"min",suffix:"start",expr:c}),i({prefix:"max",suffix:"start",expr:c}),i({prefix:"min",suffix:"end",expr:c}),i({prefix:"max",suffix:"end",expr:c})];return`${l}(${f.map(d=>`scale('${n}',${d})`).join(",")})`};let s,a;e.stack.fieldChannel==="x"?(s={...Ra(t.encode.update,["y","yc","y2","height",...Eg]),x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...zt(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(s={...Ra(t.encode.update,["x","xc","x2","width"]),y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...zt(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const l of Eg){const c=gi(l,e.markDef,e.config);t.encode.update[l]?(s[l]=t.encode.update[l],delete t.encode.update[l]):c&&(s[l]=Re(c)),c&&(t.encode.update[l]={value:0})}const o=[];if(e.stack.groupbyChannels?.length>0)for(const l of e.stack.groupbyChannels){const c=e.fieldDef(l),f=U(c);f&&o.push(f),(c?.bin||c?.timeUnit)&&o.push(U(c,{binSuffix:"end"}))}return s=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((l,c)=>{if(t.encode.update[c])return{...l,[c]:t.encode.update[c]};{const f=gi(c,e.markDef,e.config);return f!==void 0?{...l,[c]:Re(f)}:l}},s),s.stroke&&(s.strokeForeground={value:!0},s.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(Pe.Main),name:SA+e.requestDataName(Pe.Main),groupby:o,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:s},marks:[{type:"group",encode:{update:a},marks:[t]}]}]}function VQ(e){const{encoding:t,stack:n,mark:i,markDef:r,config:s}=e,a=t.order;if(!(!D(a)&&zn(a)&&xg(a.value)||!a&&xg(Ce("order",r,s)))){if((D(a)||B(a))&&!n)return $k(a,{expr:"datum"});if(Gr(i)){const o=r.orient==="horizontal"?"y":"x",u=t[o];if(B(u))return{field:o}}}}function Mb(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:s}=e,a=Ue(i.clip,XQ(e),YQ(e)),o=Fk(i),u=r.key,l=VQ(e),c=KQ(e),f=Ce("aria",i,s),d=Il[n].postEncodingTransform?Il[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:Il[n].vgMark,...a?{clip:a}:{},...o?{style:o}:{},...u?{key:u.field}:{},...l?{sort:l}:{},...c||{},...f===!1?{aria:f}:{},from:{data:t.fromPrefix+e.requestDataName(Pe.Main)},encode:{update:Il[n].encodeEntry(e)},...d?{transform:d}:{}}]}function XQ(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return t?.get("selectionExtent")||n?.get("selectionExtent")?!0:void 0}function YQ(e){const t=e.component.projection;return t&&!t.isFit?!0:void 0}function KQ(e){if(!e.component.selection)return null;const t=_(e.component.selection).length;let n=t,i=e.parent;for(;i&&n===0;)n=_(i.component.selection).length,i=i.parent;return n?{interactive:t>0||e.mark==="geoshape"||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}class O3 extends F3{constructor(t,n,i,r={},s){super(t,"unit",n,i,s,void 0,RE(t)?t.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[],this.correctDataNames=l=>(l.from?.data&&(l.from.data=this.lookupDataSource(l.from.data),"time"in this.encoding&&(l.from.data=l.from.data+hO)),l.from?.facet?.data&&(l.from.facet.data=this.lookupDataSource(l.from.facet.data)),l);const a=mi(t.mark)?{...t.mark}:{type:t.mark},o=a.type;a.filled===void 0&&(a.filled=wV(a,s,{graticule:t.data&&db(t.data)}));const u=this.encoding=kH(t.encoding||{},o,a.filled,s);this.markDef=ZD(a,u,s),this.size=SQ({encoding:u,size:RE(t)?{...r,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}}:r}),this.stack=QD(this.markDef,u),this.specifiedScales=this.initScales(o,u),this.specifiedAxes=this.initAxes(u),this.specifiedLegends=this.initLegends(u),this.specifiedProjection=t.projection,this.selection=(t.params??[]).filter(l=>ob(l))}get hasProjection(){const{encoding:t}=this,n=this.mark===rD,i=t&&vq.some(r=>re(t[r]));return n||i}scaleDomain(t){const n=this.specifiedScales[t];return n?n.domain:void 0}axis(t){return this.specifiedAxes[t]}legend(t){return this.specifiedLegends[t]}initScales(t,n){return Cy.reduce((i,r)=>{const s=Xe(n[r]);return s&&(i[r]=this.initScale(s.scale??{})),i},{})}initScale(t){const{domain:n,range:i}=t,r=at(t);return D(n)&&(r.domain=n.map(Kt)),D(i)&&(r.range=i.map(Kt)),r}initAxes(t){return Zi.reduce((n,i)=>{const r=t[i];if(re(r)||i===Me&&re(t.x2)||i===rt&&re(t.y2)){const s=re(r)?r.axis:void 0;n[i]=s&&this.initAxis({...s})}return n},{})}initAxis(t){const n=_(t),i={};for(const r of n){const s=t[r];i[r]=dl(s)?wk(s):Kt(s)}return i}initLegends(t){return Rq.reduce((n,i)=>{const r=Xe(t[i]);if(r&&Tq(i)){const s=r.legend;n[i]=s&&at(s)}return n},{})}parseData(){this.component.data=Kd(this)}parseLayoutSize(){lQ(this)}parseSelections(){this.component.selection=ZY(this,this.selection)}parseMarkGroup(){this.component.mark=WQ(this)}parseAxesAndHeaders(){this.component.axes=bQ(this)}assembleSelectionTopLevelSignals(t){return yX(this,t)}assembleSignals(){return[...GO(this),...gX(this,[])]}assembleSelectionData(t){return bX(this,t)}assembleLayout(){return null}assembleLayoutSignals(){return Cb(this)}assembleMarks(){let t=this.component.mark??[];return(!this.parent||!ho(this.parent))&&(t=yO(this,t)),t.map(this.correctDataNames)}assembleGroupStyle(){const{style:t}=this.view||{};return t!==void 0?t:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(t){return ds(this.encoding,t)}fieldDef(t){const n=this.encoding[t];return Un(n)}typedFieldDef(t){const n=this.fieldDef(t);return Nt(n)?n:null}}class Lb extends Rb{constructor(t,n,i,r,s){super(t,"layer",n,i,s,t.resolve,t.view);const a={...r,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}};this.children=t.layer.map((o,u)=>{if(kd(o))return new Lb(o,this,this.getName(`layer_${u}`),a,s);if(er(o))return new O3(o,this,this.getName(`layer_${u}`),a,s);throw new Error(Fy(o))})}parseData(){this.component.data=Kd(this);for(const t of this.children)t.parseData()}parseLayoutSize(){oQ(this)}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of _(t.component.selection))this.component.selection[n]=t.component.selection[n]}Object.values(this.component.selection).some(t=>ci(t))&&ky($y)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){vQ(this)}assembleSelectionTopLevelSignals(t){return this.children.reduce((n,i)=>i.assembleSelectionTopLevelSignals(n),t)}assembleSignals(){return this.children.reduce((t,n)=>t.concat(n.assembleSignals()),GO(this))}assembleLayoutSignals(){return this.children.reduce((t,n)=>t.concat(n.assembleLayoutSignals()),Cb(this))}assembleSelectionData(t){return this.children.reduce((n,i)=>i.assembleSelectionData(n),t)}assembleGroupStyle(){const t=new Set;for(const i of this.children)for(const r of W(i.assembleGroupStyle()))t.add(r);const n=Array.from(t);return n.length>1?n:n.length===1?n[0]:void 0}assembleTitle(){let t=super.assembleTitle();if(t)return t;for(const n of this.children)if(t=n.assembleTitle(),t)return t}assembleLayout(){return null}assembleMarks(){return xX(this,this.children.flatMap(t=>t.assembleMarks()))}assembleLegends(){return this.children.reduce((t,n)=>t.concat(n.assembleLegends()),u3(this))}}function Bb(e,t,n,i,r){if(Ed(e))return new su(e,t,n,r);if(kd(e))return new Lb(e,t,n,i,r);if(er(e))return new O3(e,t,n,i,r);if(QH(e))return new pQ(e,t,n,r);throw new Error(Fy(e))}function JQ(e,t={}){t.logger&&tG(t.logger),t.fieldTitle&&AD(t.fieldTitle);try{const n=JD(Va(t.config,e.config)),i=aO(e,n),r=Bb(i,null,"",void 0,n);return r.parse(),EJ(r.component.data,r),{spec:ZQ(r,QQ(e,i.autosize,n,r),e.datasets,e.usermeta),normalized:i}}finally{t.logger&&nG(),t.fieldTitle&&xH()}}function QQ(e,t,n,i){const r=i.component.layoutSize.get("width"),s=i.component.layoutSize.get("height");if(t===void 0?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):q(t)&&(t={type:t}),r&&s&&sX(t.type)){if(r==="step"&&s==="step")M(gE()),t.type="pad";else if(r==="step"||s==="step"){const a=r==="step"?"width":"height";M(gE(cd(a)));const o=a==="width"?"height":"width";t.type=aX(o)}}return{..._(t).length===1&&t.type?t.type==="pad"?{}:{autosize:t.type}:{autosize:t},...qE(n,!1),...qE(e,!0)}}function ZQ(e,t,n={},i){const r=e.config?dV(e.config):void 0,s=iQ(e.component.data,n),a=e.assembleSelectionData(s),o=e.assembleProjections(),u=e.assembleTitle(),l=e.assembleGroupStyle(),c=e.assembleGroupEncodeEntry(!0);let f=e.assembleLayoutSignals();f=f.filter(h=>(h.name==="width"||h.name==="height")&&h.value!==void 0?(t[h.name]=+h.value,!1):!0);const{params:d,...p}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...p,...u?{title:u}:{},...l?{style:l}:{},...c?{encode:{update:c}}:{},data:a,...o.length>0?{projections:o}:{},...e.assembleGroup([...f,...e.assembleSelectionTopLevelSignals([]),...VD(d)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}const eZ=pq.version,tZ=Object.freeze(Object.defineProperty({__proto__:null,accessPathDepth:Ta,accessPathWithDatum:gy,accessWithDatumToUnescapedPath:xe,compile:JQ,contains:ue,deepEqual:Jt,deleteNestedProperty:Gc,duplicate:ie,entries:Or,every:dy,fieldIntersection:py,flatAccessWithDatum:sk,getFirstDefined:Ue,hasIntersection:hy,hasProperty:T,hash:le,internalField:uk,isBoolean:Eu,isEmpty:we,isEqual:mq,isInternalField:lk,isNullOrFalse:xg,isNumeric:rd,keys:_,logicalExpr:nu,mergeDeep:ik,never:nk,normalize:aO,normalizeAngle:Au,omit:zt,pick:Ra,prefixGenerator:vg,removePathFromField:so,replaceAll:Cs,replacePathInField:bn,resetIdCounter:bq,setEqual:rk,some:_a,stringify:Fe,titleCase:tl,unique:ai,uniqueId:ok,vals:dt,varName:Ne,version:eZ},Symbol.toStringTag,{value:"Module"}));function R3(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var nZ="2.15.0",iZ={version:nZ};const aa="#fff",$A="#888",rZ={background:"#333",view:{stroke:$A},title:{color:aa,subtitleColor:aa},style:{"guide-label":{fill:aa},"guide-title":{fill:aa}},axis:{domainColor:aa,gridColor:$A,tickColor:aa}},Kr="#4572a7",sZ={background:"#fff",arc:{fill:Kr},area:{fill:Kr},line:{stroke:Kr,strokeWidth:2},path:{stroke:Kr},rect:{fill:Kr},shape:{stroke:Kr},symbol:{fill:Kr,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},Jr="#30a2da",Zh="#cbcbcb",aZ="#999",oZ="#333",kA="#f0f0f0",DA="#333",uZ={arc:{fill:Jr},area:{fill:Jr},axis:{domainColor:Zh,grid:!0,gridColor:Zh,gridWidth:1,labelColor:aZ,labelFontSize:10,titleColor:oZ,tickColor:Zh,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:kA,group:{fill:kA},legend:{labelColor:DA,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:DA,titleFontSize:14,titlePadding:10},line:{stroke:Jr,strokeWidth:2},path:{stroke:Jr,strokeWidth:.5},rect:{fill:Jr},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:Jr},bar:{binSpacing:2,fill:Jr,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},Qr="#000",lZ={group:{fill:"#e5e5e5"},arc:{fill:Qr},area:{fill:Qr},line:{stroke:Qr},path:{stroke:Qr},rect:{fill:Qr},shape:{stroke:Qr},symbol:{fill:Qr,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},cZ=22,fZ="normal",OA="Benton Gothic, sans-serif",RA=11.5,dZ="normal",Zr="#82c6df",ep="Benton Gothic Bold, sans-serif",_A="normal",TA=13,Do={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"]},hZ={background:"#ffffff",title:{anchor:"start",color:"#000000",font:ep,fontSize:cZ,fontWeight:fZ},arc:{fill:Zr},area:{fill:Zr},line:{stroke:Zr,strokeWidth:2},path:{stroke:Zr},rect:{fill:Zr},shape:{stroke:Zr},symbol:{fill:Zr,size:30},axis:{labelFont:OA,labelFontSize:RA,labelFontWeight:dZ,titleFont:ep,titleFontSize:TA,titleFontWeight:_A},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:OA,labelFontSize:RA,symbolType:"square",titleFont:ep,titleFontSize:TA,titleFontWeight:_A},range:{category:Do["category-6"],diverging:Do["fireandice-6"],heatmap:Do["fire-7"],ordinal:Do["fire-7"],ramp:Do["fire-7"]}},es="#ab5787",zl="#979797",pZ={background:"#f9f9f9",arc:{fill:es},area:{fill:es},line:{stroke:es},path:{stroke:es},rect:{fill:es},shape:{stroke:es},symbol:{fill:es,size:30},axis:{domainColor:zl,domainWidth:.5,gridWidth:.2,labelColor:zl,tickColor:zl,tickWidth:.2,titleColor:zl},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},ts="#3e5c69",gZ={background:"#fff",arc:{fill:ts},area:{fill:ts},line:{stroke:ts},path:{stroke:ts},rect:{fill:ts},shape:{stroke:ts},symbol:{fill:ts},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},un="#1696d2",NA="#000000",mZ="#FFFFFF",Ul="Lato",tp="Lato",yZ="Lato",bZ="#DEDDDD",xZ=18,Oo={"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},vZ={background:mZ,title:{anchor:"start",fontSize:xZ,font:Ul},axisX:{domain:!0,domainColor:NA,domainWidth:1,grid:!1,labelFontSize:12,labelFont:tp,labelAngle:0,tickColor:NA,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:Ul},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:bZ,gridWidth:1,labelFontSize:12,labelFont:tp,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:Ul,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:tp,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:Ul,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:Oo["six-groups-cat-1"],diverging:Oo["diverging-colors"],heatmap:Oo["diverging-colors"],ordinal:Oo["six-groups-seq"],ramp:Oo["shades-blue"]},area:{fill:un},rect:{fill:un},line:{color:un,stroke:un,strokeWidth:5},trail:{color:un,stroke:un,strokeWidth:0,size:1},path:{stroke:un,strokeWidth:.5},point:{filled:!0},text:{font:yZ,color:un,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:un,stroke:null}},arc:{fill:un},shape:{stroke:un},symbol:{fill:un,size:30}},ns="#3366CC",MA="#ccc",jl="Arial, sans-serif",EZ={arc:{fill:ns},area:{fill:ns},path:{stroke:ns},rect:{fill:ns},shape:{stroke:ns},symbol:{stroke:ns},circle:{fill:ns},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:jl,fontSize:12},"guide-title":{font:jl,fontSize:12},"group-title":{font:jl,fontSize:12}},title:{font:jl,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:MA,tickColor:MA,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},Pb=e=>e*(1/3+1),LA=Pb(9),BA=Pb(10),PA=Pb(12),Ro="Segoe UI",IA="wf_standard-font, helvetica, arial, sans-serif",zA="#252423",_o="#605E5C",UA="transparent",AZ="#C8C6C4",Sn="#118DFF",CZ="#12239E",wZ="#E66C37",FZ="#6B007B",SZ="#E044A7",$Z="#744EC2",kZ="#D9B300",DZ="#D64550",_3=Sn,T3="#DEEFFF",jA=[T3,_3],OZ=[T3,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",_3],RZ={view:{stroke:UA},background:UA,font:Ro,header:{titleFont:IA,titleFontSize:PA,titleColor:zA,labelFont:Ro,labelFontSize:BA,labelColor:_o},axis:{ticks:!1,grid:!1,domain:!1,labelColor:_o,labelFontSize:LA,titleFont:IA,titleColor:zA,titleFontSize:PA,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:AZ,gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:Sn},line:{stroke:Sn,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:Ro,fontSize:LA,fill:_o},arc:{fill:Sn},area:{fill:Sn,line:!0,opacity:.6},path:{stroke:Sn},rect:{fill:Sn},point:{fill:Sn,filled:!0,size:75},shape:{stroke:Sn},symbol:{fill:Sn,strokeWidth:1.5,size:50},legend:{titleFont:Ro,titleFontWeight:"bold",titleColor:_o,labelFont:Ro,labelFontSize:BA,labelColor:_o,symbolType:"circle",symbolSize:75},range:{category:[Sn,CZ,wZ,FZ,SZ,$Z,kZ,DZ],diverging:jA,heatmap:jA,ordinal:OZ}},np='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',_Z='IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',ip=400,ql={textPrimary:{g90:"#f4f4f4",g100:"#f4f4f4",white:"#161616",g10:"#161616"},textSecondary:{g90:"#c6c6c6",g100:"#c6c6c6",white:"#525252",g10:"#525252"},layerAccent01:{white:"#e0e0e0",g10:"#e0e0e0",g90:"#525252",g100:"#393939"},gridBg:{white:"#ffffff",g10:"#ffffff",g90:"#161616",g100:"#161616"}},TZ=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],NZ=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function Jd({theme:e,background:t}){const n=["white","g10"].includes(e)?"light":"dark",i=ql.gridBg[e],r=ql.textPrimary[e],s=ql.textSecondary[e],a=n==="dark"?TZ:NZ,o=n==="dark"?"#d4bbff":"#6929c4";return{background:t,arc:{fill:o},area:{fill:o},path:{stroke:o},rect:{fill:o},shape:{stroke:o},symbol:{stroke:o},circle:{fill:o},view:{fill:i,stroke:i},group:{fill:i},title:{color:r,anchor:"start",dy:-15,fontSize:16,font:np,fontWeight:600},axis:{labelColor:s,labelFontSize:12,labelFont:_Z,labelFontWeight:ip,titleColor:r,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:ql.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:np,fill:s,fontWeight:ip},"guide-title":{font:np,fill:s,fontWeight:ip}},range:{category:a,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const MZ=Jd({theme:"white",background:"#ffffff"}),LZ=Jd({theme:"g10",background:"#f4f4f4"}),BZ=Jd({theme:"g90",background:"#262626"}),PZ=Jd({theme:"g100",background:"#161616"}),IZ=iZ.version,zZ=Object.freeze(Object.defineProperty({__proto__:null,carbong10:LZ,carbong100:PZ,carbong90:BZ,carbonwhite:MZ,dark:rZ,excel:sZ,fivethirtyeight:uZ,ggplot2:lZ,googlecharts:EZ,latimes:hZ,powerbi:RZ,quartz:pZ,urbaninstitute:vZ,version:IZ,vox:gZ},Symbol.toStringTag,{value:"Module"}));function UZ(e,t,n,i){if(D(e))return`[${e.map(r=>t(q(r)?r:qA(r,n))).join(", ")}]`;if(j(e)){let r="";const{title:s,image:a,...o}=e;s&&(r+=`

${t(s)}

`),a&&(r+=``);const u=Object.keys(o);if(u.length>0){r+="";for(const l of u){let c=o[l];c!==void 0&&(j(c)&&(c=qA(c,n)),r+=``)}r+="
${t(l)}${t(c)}
"}return r||"{}"}return t(e)}function jZ(e){const t=[];return function(n,i){if(typeof i!="object"||i===null)return i;const r=t.indexOf(this)+1;return t.length=r,t.length>e?"[Object]":t.indexOf(i)>=0?"[Circular]":(t.push(i),i)}}function qA(e,t){return JSON.stringify(e,jZ(t))}var qZ=`#vg-tooltip-element { + visibility: hidden; + padding: 8px; + position: fixed; + z-index: 1000; + font-family: sans-serif; + font-size: 11px; + border-radius: 3px; + box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); + /* The default theme is the light theme. */ + background-color: rgba(255, 255, 255, 0.95); + border: 1px solid #d9d9d9; + color: black; +} +#vg-tooltip-element.visible { + visibility: visible; +} +#vg-tooltip-element h2 { + margin-top: 0; + margin-bottom: 10px; + font-size: 13px; +} +#vg-tooltip-element table { + border-spacing: 0; +} +#vg-tooltip-element table tr { + border: none; +} +#vg-tooltip-element table tr td { + overflow: hidden; + text-overflow: ellipsis; + padding-top: 2px; + padding-bottom: 2px; +} +#vg-tooltip-element table tr td.key { + color: #808080; + max-width: 150px; + text-align: right; + padding-right: 4px; +} +#vg-tooltip-element table tr td.value { + display: block; + max-width: 300px; + max-height: 7em; + text-align: left; +} +#vg-tooltip-element.dark-theme { + background-color: rgba(32, 32, 32, 0.9); + border: 1px solid #f5f5f5; + color: white; +} +#vg-tooltip-element.dark-theme td.key { + color: #bfbfbf; +} +`;const N3="vg-tooltip-element",WZ={offsetX:10,offsetY:10,id:N3,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:GZ,maxDepth:2,formatTooltip:UZ,baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function GZ(e){return String(e).replace(/&/g,"&").replace(/=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function YZ(e,t,n){return e.clientX>=t.x&&e.clientX<=t.x+n.width&&e.clientY>=t.y&&e.clientY<=t.y+n.height}class KZ{constructor(t){this.options={...WZ,...t};const n=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const i=document.createElement("style");i.setAttribute("id",this.options.styleId),i.innerHTML=HZ(n);const r=document.head;r.childNodes.length>0?r.insertBefore(i,r.childNodes[0]):r.appendChild(i)}}tooltipHandler(t,n,i,r){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),(document.fullscreenElement??document.body).appendChild(this.el)),r==null||r===""){this.el.classList.remove("visible",`${this.options.theme}-theme`);return}this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:s,y:a}=this.options.anchor==="mark"?VZ(t,n,i,this.el.getBoundingClientRect(),this.options):M3(n,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${a}px`,this.el.style.left=`${s}px`}}var rp={};var JZ=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)r.hasOwnProperty(s)&&(i[s]=r[s])},e(t,n)};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}})(),QZ=Object.prototype.hasOwnProperty;function Yg(e,t){return QZ.call(e,t)}function Kg(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n=48&&i<=57){t++;continue}return!1}return!0}function is(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function P3(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Qg(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;t0&&u[c-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&d===void 0&&(l[p]===void 0?d=u.slice(0,c).join("/"):c==f-1&&(d=t.path),d!==void 0&&h(t,0,e,d)),c++,Array.isArray(l)){if(p==="-")p=l.length;else{if(n&&!Jg(p))throw new Ie("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,t,e);Jg(p)&&(p=~~p)}if(c>=f){if(n&&t.op==="add"&&p>l.length)throw new Ie("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,t,e);var a=eee[t.op].call(t,l,p,e);if(a.test===!1)throw new Ie("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return a}}else if(c>=f){var a=ha[t.op].call(t,l,p,e);if(a.test===!1)throw new Ie("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return a}if(l=l[p],n&&c0)throw new Ie('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Ie("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Ie("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Qg(e.value))throw new Ie("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n){if(e.op=="add"){var r=e.path.split("/").length,s=i.split("/").length;if(r!==s+1&&r!==s)throw new Ie("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==i)throw new Ie("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if(e.op==="move"||e.op==="copy"){var a={op:"_get",path:e.from,value:void 0},o=z3([a],n);if(o&&o.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ie("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}}else throw new Ie("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n)}function z3(e,t,n){try{if(!Array.isArray(e))throw new Ie("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Qd(Qt(t),Qt(e),n||!0);else{n=n||uf;for(var i=0;i0&&(e.patches=[],e.callback&&e.callback(i)),i}function zb(e,t,n,i,r){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=Kg(t),a=Kg(e),o=!1,u=a.length-1;u>=0;u--){var l=a[u],c=e[l];if(Yg(t,l)&&!(t[l]===void 0&&c!==void 0&&Array.isArray(t)===!1)){var f=t[l];typeof c=="object"&&c!=null&&typeof f=="object"&&f!=null&&Array.isArray(c)===Array.isArray(f)?zb(c,f,n,i+"/"+is(l),r):c!==f&&(r&&n.push({op:"test",path:i+"/"+is(l),value:Qt(c)}),n.push({op:"replace",path:i+"/"+is(l),value:Qt(f)}))}else Array.isArray(e)===Array.isArray(t)?(r&&n.push({op:"test",path:i+"/"+is(l),value:Qt(c)}),n.push({op:"remove",path:i+"/"+is(l)}),o=!0):(r&&n.push({op:"test",path:i,value:e}),n.push({op:"replace",path:i,value:t}))}if(!(!o&&s.length==a.length))for(var u=0;u=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(n,i)}return this}}return sp=e,sp}var ap,HA;function Ub(){if(HA)return ap;HA=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return ap=i=>i?typeof i!="object"?e:i:t,ap}var Wl={exports:{}},op,VA;function jb(){if(VA)return op;VA=1;const e="2.0.0",t=256,n=Number.MAX_SAFE_INTEGER||9007199254740991,i=16,r=t-6;return op={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:i,MAX_SAFE_BUILD_LENGTH:r,MAX_SAFE_INTEGER:n,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},op}var up,XA;function Zd(){return XA||(XA=1,up=typeof process=="object"&&rp&&rp.NODE_DEBUG&&/\bsemver\b/i.test(rp.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),up}var YA;function qb(){return YA||(YA=1,(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:r}=jb(),s=Zd();t=e.exports={};const a=t.re=[],o=t.safeRe=[],u=t.src=[],l=t.t={};let c=0;const f="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",r],[f,i]],p=g=>{for(const[m,y]of d)g=g.split(`${m}*`).join(`${m}{0,${y}}`).split(`${m}+`).join(`${m}{1,${y}}`);return g},h=(g,m,y)=>{const b=p(m),v=c++;s(g,v,m),l[g]=v,u[v]=m,a[v]=new RegExp(m,y?"g":void 0),o[v]=new RegExp(b,y?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),h("MAINVERSION",`(${u[l.NUMERICIDENTIFIER]})\\.(${u[l.NUMERICIDENTIFIER]})\\.(${u[l.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${u[l.NUMERICIDENTIFIERLOOSE]})\\.(${u[l.NUMERICIDENTIFIERLOOSE]})\\.(${u[l.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${u[l.NUMERICIDENTIFIER]}|${u[l.NONNUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${u[l.NUMERICIDENTIFIERLOOSE]}|${u[l.NONNUMERICIDENTIFIER]})`),h("PRERELEASE",`(?:-(${u[l.PRERELEASEIDENTIFIER]}(?:\\.${u[l.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${u[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[l.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${f}+`),h("BUILD",`(?:\\+(${u[l.BUILDIDENTIFIER]}(?:\\.${u[l.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${u[l.MAINVERSION]}${u[l.PRERELEASE]}?${u[l.BUILD]}?`),h("FULL",`^${u[l.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${u[l.MAINVERSIONLOOSE]}${u[l.PRERELEASELOOSE]}?${u[l.BUILD]}?`),h("LOOSE",`^${u[l.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${u[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${u[l.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${u[l.XRANGEIDENTIFIER]})(?:\\.(${u[l.XRANGEIDENTIFIER]})(?:\\.(${u[l.XRANGEIDENTIFIER]})(?:${u[l.PRERELEASE]})?${u[l.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${u[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[l.XRANGEIDENTIFIERLOOSE]})(?:${u[l.PRERELEASELOOSE]})?${u[l.BUILD]}?)?)?`),h("XRANGE",`^${u[l.GTLT]}\\s*${u[l.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${u[l.GTLT]}\\s*${u[l.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h("COERCE",`${u[l.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",u[l.COERCEPLAIN]+`(?:${u[l.PRERELEASE]})?(?:${u[l.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",u[l.COERCE],!0),h("COERCERTLFULL",u[l.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${u[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${u[l.LONETILDE]}${u[l.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${u[l.LONETILDE]}${u[l.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${u[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${u[l.LONECARET]}${u[l.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${u[l.LONECARET]}${u[l.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${u[l.GTLT]}\\s*(${u[l.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${u[l.GTLT]}\\s*(${u[l.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${u[l.GTLT]}\\s*(${u[l.LOOSEPLAIN]}|${u[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${u[l.XRANGEPLAIN]})\\s+-\\s+(${u[l.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${u[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[l.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Wl,Wl.exports)),Wl.exports}var lp,KA;function pee(){if(KA)return lp;KA=1;const e=/^[0-9]+$/,t=(i,r)=>{const s=e.test(i),a=e.test(r);return s&&a&&(i=+i,r=+r),i===r?0:s&&!a?-1:a&&!s?1:it(r,i)},lp}var cp,JA;function Wb(){if(JA)return cp;JA=1;const e=Zd(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=jb(),{safeRe:i,t:r}=qb(),s=Ub(),{compareIdentifiers:a}=pee();class o{constructor(l,c){if(c=s(c),l instanceof o){if(l.loose===!!c.loose&&l.includePrerelease===!!c.includePrerelease)return l;l=l.version}else if(typeof l!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof l}".`);if(l.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",l,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;const f=l.trim().match(c.loose?i[r.LOOSE]:i[r.FULL]);if(!f)throw new TypeError(`Invalid Version: ${l}`);if(this.raw=l,this.major=+f[1],this.minor=+f[2],this.patch=+f[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");f[4]?this.prerelease=f[4].split(".").map(d=>{if(/^[0-9]+$/.test(d)){const p=+d;if(p>=0&&p=0;)typeof this.prerelease[p]=="number"&&(this.prerelease[p]++,p=-2);if(p===-1){if(c===this.prerelease.join(".")&&f===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(d)}}if(c){let p=[c,d];f===!1&&(p=[c]),a(this.prerelease[0],c)===0?isNaN(this.prerelease[1])&&(this.prerelease=p):this.prerelease=p}break}default:throw new Error(`invalid increment argument: ${l}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return cp=o,cp}var fp,QA;function po(){if(QA)return fp;QA=1;const e=Wb();return fp=(n,i,r)=>new e(n,r).compare(new e(i,r)),fp}var dp,ZA;function gee(){if(ZA)return dp;ZA=1;const e=po();return dp=(n,i,r)=>e(n,i,r)===0,dp}var hp,e2;function mee(){if(e2)return hp;e2=1;const e=po();return hp=(n,i,r)=>e(n,i,r)!==0,hp}var pp,t2;function yee(){if(t2)return pp;t2=1;const e=po();return pp=(n,i,r)=>e(n,i,r)>0,pp}var gp,n2;function bee(){if(n2)return gp;n2=1;const e=po();return gp=(n,i,r)=>e(n,i,r)>=0,gp}var mp,i2;function xee(){if(i2)return mp;i2=1;const e=po();return mp=(n,i,r)=>e(n,i,r)<0,mp}var yp,r2;function vee(){if(r2)return yp;r2=1;const e=po();return yp=(n,i,r)=>e(n,i,r)<=0,yp}var bp,s2;function Eee(){if(s2)return bp;s2=1;const e=gee(),t=mee(),n=yee(),i=bee(),r=xee(),s=vee();return bp=(o,u,l,c)=>{switch(u){case"===":return typeof o=="object"&&(o=o.version),typeof l=="object"&&(l=l.version),o===l;case"!==":return typeof o=="object"&&(o=o.version),typeof l=="object"&&(l=l.version),o!==l;case"":case"=":case"==":return e(o,l,c);case"!=":return t(o,l,c);case">":return n(o,l,c);case">=":return i(o,l,c);case"<":return r(o,l,c);case"<=":return s(o,l,c);default:throw new TypeError(`Invalid operator: ${u}`)}},bp}var xp,a2;function Aee(){if(a2)return xp;a2=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(c,f){if(f=n(f),c instanceof t){if(c.loose===!!f.loose)return c;c=c.value}c=c.trim().split(/\s+/).join(" "),a("comparator",c,f),this.options=f,this.loose=!!f.loose,this.parse(c),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(c){const f=this.options.loose?i[r.COMPARATORLOOSE]:i[r.COMPARATOR],d=c.match(f);if(!d)throw new TypeError(`Invalid comparator: ${c}`);this.operator=d[1]!==void 0?d[1]:"",this.operator==="="&&(this.operator=""),d[2]?this.semver=new o(d[2],this.options.loose):this.semver=e}toString(){return this.value}test(c){if(a("Comparator.test",c,this.options.loose),this.semver===e||c===e)return!0;if(typeof c=="string")try{c=new o(c,this.options)}catch{return!1}return s(c,this.operator,this.semver,this.options)}intersects(c,f){if(!(c instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new u(c.value,f).test(this.value):c.operator===""?c.value===""?!0:new u(this.value,f).test(c.semver):(f=n(f),f.includePrerelease&&(this.value==="<0.0.0-0"||c.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||c.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&c.operator.startsWith(">")||this.operator.startsWith("<")&&c.operator.startsWith("<")||this.semver.version===c.semver.version&&this.operator.includes("=")&&c.operator.includes("=")||s(this.semver,"<",c.semver,f)&&this.operator.startsWith(">")&&c.operator.startsWith("<")||s(this.semver,">",c.semver,f)&&this.operator.startsWith("<")&&c.operator.startsWith(">")))}}xp=t;const n=Ub(),{safeRe:i,t:r}=qb(),s=Eee(),a=Zd(),o=Wb(),u=U3();return xp}var vp,o2;function U3(){if(o2)return vp;o2=1;const e=/\s+/g;class t{constructor(O,I){if(I=r(I),O instanceof t)return O.loose===!!I.loose&&O.includePrerelease===!!I.includePrerelease?O:new t(O.raw,I);if(O instanceof s)return this.raw=O.value,this.set=[[O]],this.formatted=void 0,this;if(this.options=I,this.loose=!!I.loose,this.includePrerelease=!!I.includePrerelease,this.raw=O.trim().replace(e," "),this.set=this.raw.split("||").map(G=>this.parseRange(G.trim())).filter(G=>G.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const G=this.set[0];if(this.set=this.set.filter(X=>!g(X[0])),this.set.length===0)this.set=[G];else if(this.set.length>1){for(const X of this.set)if(X.length===1&&m(X[0])){this.set=[X];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let O=0;O0&&(this.formatted+="||");const I=this.set[O];for(let G=0;G0&&(this.formatted+=" "),this.formatted+=I[G].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(O){const G=((this.options.includePrerelease&&p)|(this.options.loose&&h))+":"+O,X=i.get(G);if(X)return X;const V=this.options.loose,te=V?u[l.HYPHENRANGELOOSE]:u[l.HYPHENRANGE];O=O.replace(te,ne(this.options.includePrerelease)),a("hyphen replace",O),O=O.replace(u[l.COMPARATORTRIM],c),a("comparator trim",O),O=O.replace(u[l.TILDETRIM],f),a("tilde trim",O),O=O.replace(u[l.CARETTRIM],d),a("caret trim",O);let ye=O.split(" ").map(Le=>b(Le,this.options)).join(" ").split(/\s+/).map(Le=>J(Le,this.options));V&&(ye=ye.filter(Le=>(a("loose invalid filter",Le,this.options),!!Le.match(u[l.COMPARATORLOOSE])))),a("range list",ye);const oe=new Map,ke=ye.map(Le=>new s(Le,this.options));for(const Le of ke){if(g(Le))return[Le];oe.set(Le.value,Le)}oe.size>1&&oe.has("")&&oe.delete("");const gt=[...oe.values()];return i.set(G,gt),gt}intersects(O,I){if(!(O instanceof t))throw new TypeError("a Range is required");return this.set.some(G=>y(G,I)&&O.set.some(X=>y(X,I)&&G.every(V=>X.every(te=>V.intersects(te,I)))))}test(O){if(!O)return!1;if(typeof O=="string")try{O=new o(O,this.options)}catch{return!1}for(let I=0;IN.value==="<0.0.0-0",m=N=>N.value==="",y=(N,O)=>{let I=!0;const G=N.slice();let X=G.pop();for(;I&&G.length;)I=G.every(V=>X.intersects(V,O)),X=G.pop();return I},b=(N,O)=>(a("comp",N,O),N=C(N,O),a("caret",N),N=A(N,O),a("tildes",N),N=w(N,O),a("xrange",N),N=L(N,O),a("stars",N),N),v=N=>!N||N.toLowerCase()==="x"||N==="*",A=(N,O)=>N.trim().split(/\s+/).map(I=>E(I,O)).join(" "),E=(N,O)=>{const I=O.loose?u[l.TILDELOOSE]:u[l.TILDE];return N.replace(I,(G,X,V,te,ye)=>{a("tilde",N,G,X,V,te,ye);let oe;return v(X)?oe="":v(V)?oe=`>=${X}.0.0 <${+X+1}.0.0-0`:v(te)?oe=`>=${X}.${V}.0 <${X}.${+V+1}.0-0`:ye?(a("replaceTilde pr",ye),oe=`>=${X}.${V}.${te}-${ye} <${X}.${+V+1}.0-0`):oe=`>=${X}.${V}.${te} <${X}.${+V+1}.0-0`,a("tilde return",oe),oe})},C=(N,O)=>N.trim().split(/\s+/).map(I=>x(I,O)).join(" "),x=(N,O)=>{a("caret",N,O);const I=O.loose?u[l.CARETLOOSE]:u[l.CARET],G=O.includePrerelease?"-0":"";return N.replace(I,(X,V,te,ye,oe)=>{a("caret",N,X,V,te,ye,oe);let ke;return v(V)?ke="":v(te)?ke=`>=${V}.0.0${G} <${+V+1}.0.0-0`:v(ye)?V==="0"?ke=`>=${V}.${te}.0${G} <${V}.${+te+1}.0-0`:ke=`>=${V}.${te}.0${G} <${+V+1}.0.0-0`:oe?(a("replaceCaret pr",oe),V==="0"?te==="0"?ke=`>=${V}.${te}.${ye}-${oe} <${V}.${te}.${+ye+1}-0`:ke=`>=${V}.${te}.${ye}-${oe} <${V}.${+te+1}.0-0`:ke=`>=${V}.${te}.${ye}-${oe} <${+V+1}.0.0-0`):(a("no pr"),V==="0"?te==="0"?ke=`>=${V}.${te}.${ye}${G} <${V}.${te}.${+ye+1}-0`:ke=`>=${V}.${te}.${ye}${G} <${V}.${+te+1}.0-0`:ke=`>=${V}.${te}.${ye} <${+V+1}.0.0-0`),a("caret return",ke),ke})},w=(N,O)=>(a("replaceXRanges",N,O),N.split(/\s+/).map(I=>R(I,O)).join(" ")),R=(N,O)=>{N=N.trim();const I=O.loose?u[l.XRANGELOOSE]:u[l.XRANGE];return N.replace(I,(G,X,V,te,ye,oe)=>{a("xRange",N,G,X,V,te,ye,oe);const ke=v(V),gt=ke||v(te),Le=gt||v(ye),Qn=Le;return X==="="&&Qn&&(X=""),oe=O.includePrerelease?"-0":"",ke?X===">"||X==="<"?G="<0.0.0-0":G="*":X&&Qn?(gt&&(te=0),ye=0,X===">"?(X=">=",gt?(V=+V+1,te=0,ye=0):(te=+te+1,ye=0)):X==="<="&&(X="<",gt?V=+V+1:te=+te+1),X==="<"&&(oe="-0"),G=`${X+V}.${te}.${ye}${oe}`):gt?G=`>=${V}.0.0${oe} <${+V+1}.0.0-0`:Le&&(G=`>=${V}.${te}.0${oe} <${V}.${+te+1}.0-0`),a("xRange return",G),G})},L=(N,O)=>(a("replaceStars",N,O),N.trim().replace(u[l.STAR],"")),J=(N,O)=>(a("replaceGTE0",N,O),N.trim().replace(u[O.includePrerelease?l.GTE0PRE:l.GTE0],"")),ne=N=>(O,I,G,X,V,te,ye,oe,ke,gt,Le,Qn)=>(v(G)?I="":v(X)?I=`>=${G}.0.0${N?"-0":""}`:v(V)?I=`>=${G}.${X}.0${N?"-0":""}`:te?I=`>=${I}`:I=`>=${I}${N?"-0":""}`,v(ke)?oe="":v(gt)?oe=`<${+ke+1}.0.0-0`:v(Le)?oe=`<${ke}.${+gt+1}.0-0`:Qn?oe=`<=${ke}.${gt}.${Le}-${Qn}`:N?oe=`<${ke}.${gt}.${+Le+1}-0`:oe=`<=${oe}`,`${I} ${oe}`.trim()),de=(N,O,I)=>{for(let G=0;G0){const X=N[G].semver;if(X.major===O.major&&X.minor===O.minor&&X.patch===O.patch)return!0}return!1}return!0};return vp}var Ep,u2;function Cee(){if(u2)return Ep;u2=1;const e=U3();return Ep=(n,i,r)=>{try{i=new e(i,r)}catch{return!1}return i.test(n)},Ep}var wee=Cee(),j3=dee(wee);function Fee(e,t,n){const i=e.open(t),r=250,{origin:s}=new URL(t);let a=40;function o(l){l.source===i&&(a=0,e.removeEventListener("message",o,!1))}e.addEventListener("message",o,!1);function u(){a<=0||(i.postMessage(n,s),setTimeout(u,r),a-=1)}setTimeout(u,r)}var See=`.vega-embed { + position: relative; + display: inline-block; + box-sizing: border-box; +} +.vega-embed.has-actions { + padding-right: 38px; +} +.vega-embed details:not([open]) > :not(summary) { + display: none !important; +} +.vega-embed summary { + list-style: none; + position: absolute; + top: 0; + right: 0; + padding: 6px; + z-index: 1000; + background: white; + box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1); + color: #1b1e23; + border: 1px solid #aaa; + border-radius: 999px; + opacity: 0.2; + transition: opacity 0.4s ease-in; + cursor: pointer; + line-height: 0px; +} +.vega-embed summary::-webkit-details-marker { + display: none; +} +.vega-embed summary:active { + box-shadow: #aaa 0px 0px 0px 1px inset; +} +.vega-embed summary svg { + width: 14px; + height: 14px; +} +.vega-embed details[open] summary { + opacity: 0.7; +} +.vega-embed:hover summary, .vega-embed:focus-within summary { + opacity: 1 !important; + transition: opacity 0.2s ease; +} +.vega-embed .vega-actions { + position: absolute; + z-index: 1001; + top: 35px; + right: -9px; + display: flex; + flex-direction: column; + padding-bottom: 8px; + padding-top: 8px; + border-radius: 4px; + box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2); + border: 1px solid #d9d9d9; + background: white; + animation-duration: 0.15s; + animation-name: scale-in; + animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5); + text-align: left; +} +.vega-embed .vega-actions a { + padding: 8px 16px; + font-family: sans-serif; + font-size: 14px; + font-weight: 600; + white-space: nowrap; + color: #434a56; + text-decoration: none; +} +.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus { + background-color: #f7f7f9; + color: black; +} +.vega-embed .vega-actions::before, .vega-embed .vega-actions::after { + content: ""; + display: inline-block; + position: absolute; +} +.vega-embed .vega-actions::before { + left: auto; + right: 14px; + top: -16px; + border: 8px solid rgba(0, 0, 0, 0); + border-bottom-color: #d9d9d9; +} +.vega-embed .vega-actions::after { + left: auto; + right: 15px; + top: -14px; + border: 7px solid rgba(0, 0, 0, 0); + border-bottom-color: #fff; +} +.vega-embed .chart-wrapper.fit-x { + width: 100%; +} +.vega-embed .chart-wrapper.fit-y { + height: 100%; +} + +.vega-embed-wrapper { + max-width: 100%; + overflow: auto; + padding-right: 14px; +} + +@keyframes scale-in { + from { + opacity: 0; + transform: scale(0.6); + } + to { + opacity: 1; + transform: scale(1); + } +} +`;function q3(e,...t){for(const n of t)$ee(e,n);return e}function $ee(e,t){for(const n of Object.keys(t))Xa(e,n,t[n],!0)}const ti=nq;let Ou=tZ;const l2=typeof window<"u"?window:void 0;Ou===void 0&&l2?.vl?.compile&&(Ou=l2.vl);const kee={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},Dee={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},Xo={vega:"Vega","vega-lite":"Vega-Lite"},lf={vega:ti.version,"vega-lite":Ou?Ou.version:"not available"},Oee={vega:e=>e,"vega-lite":(e,t)=>Ou.compile(e,{config:t}).spec},Ree=` + + + + +`,_ee="chart-wrapper";function Tee(e){return typeof e=="function"}function c2(e,t,n,i){const r=`${t}
`,s=`
${n}`,a=window.open("");a.document.write(r+e+s),a.document.title=`${Xo[i]} JSON Source`}function Nee(e,t){if(e.$schema){const n=R3(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${Xo[n.library]}, but mode argument sets ${Xo[t]??t}.`);const i=n.library;return j3(lf[i],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${Xo[i]} ${n.version}, but the current version of ${Xo[i]} is v${lf[i]}.`),i}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":t??"vega"}function W3(e){return!!(e&&"load"in e)}function f2(e){return W3(e)?e:ti.loader(e)}function Mee(e){const t=e.usermeta?.embedOptions??{};return q(t.defaultStyle)&&(t.defaultStyle=!1),t}async function Lee(e,t,n={}){let i,r;q(t)?(r=f2(n.loader),i=JSON.parse(await r.load(t))):i=t;const s=Mee(i),a=s.loader;(!r||a)&&(r=f2(n.loader??a));const o=await d2(s,r),u=await d2(n,r),l={...q3(u,o),config:Va(u.config??{},o.config??{})};return await Pee(e,i,l,r)}async function d2(e,t){const n=q(e.config)?JSON.parse(await t.load(e.config)):e.config??{},i=q(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...i?{patch:i}:{},...n?{config:n}:{}}}function Bee(e){const t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}async function Pee(e,t,n={},i){const r=n.theme?Va(zZ[n.theme],n.config??{}):n.config,s=Mr(n.actions)?n.actions:q3({},kee,n.actions??{}),a={...Dee,...n.i18n},o=n.renderer??"canvas",u=n.logLevel??ti.Warn,l=n.downloadFileName??"visualization",c=typeof e=="string"?document.querySelector(e):e;if(!c)throw new Error(`${e} does not exist`);if(n.defaultStyle!==!1){const E="vega-embed-style",{root:C,rootContainer:x}=Bee(c);if(!C.getElementById(E)){const w=document.createElement("style");w.id=E,w.innerHTML=n.defaultStyle===void 0||n.defaultStyle===!0?See.toString():n.defaultStyle,x.appendChild(w)}}const f=Nee(t,n.mode);let d=Oee[f](t,r);if(f==="vega-lite"&&d.$schema){const E=R3(d.$schema);j3(lf.vega,`^${E.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${E.version}, but current version is v${lf.vega}.`)}c.classList.add("vega-embed"),s&&c.classList.add("has-actions"),c.innerHTML="";let p=c;if(s){const E=document.createElement("div");E.classList.add(_ee),c.appendChild(E),p=E}const h=n.patch;if(h&&(d=h instanceof Function?h(d):Qd(d,h,!0,!1).newDocument),n.formatLocale&&ti.formatLocale(n.formatLocale),n.timeFormatLocale&&ti.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(const E in n.expressionFunctions){const C=n.expressionFunctions[E];"fn"in C?ti.expressionFunction(E,C.fn,C.visitor):C instanceof Function&&ti.expressionFunction(E,C)}const{ast:g}=n,m=ti.parse(d,f==="vega-lite"?{}:r,{ast:g}),y=new(n.viewClass||ti.View)(m,{loader:i,logLevel:u,renderer:o,...g?{expr:ti.expressionInterpreter??n.expr??dq}:{}});if(y.addSignalListener("autosize",(E,C)=>{const{type:x}=C;x=="fit-x"?(p.classList.add("fit-x"),p.classList.remove("fit-y")):x=="fit-y"?(p.classList.remove("fit-x"),p.classList.add("fit-y")):x=="fit"?p.classList.add("fit-x","fit-y"):p.classList.remove("fit-x","fit-y")}),n.tooltip!==!1){const{loader:E,tooltip:C}=n,x=E&&!W3(E)?E?.baseURL:void 0,w=Tee(C)?C:new KZ({baseURL:x,...C===!0?{}:C}).call;y.tooltip(w)}let{hover:b}=n;if(b===void 0&&(b=f==="vega"),b){const{hoverSet:E,updateSet:C}=typeof b=="boolean"?{}:b;y.hover(E,C)}n&&(n.width!=null&&y.width(n.width),n.height!=null&&y.height(n.height),n.padding!=null&&y.padding(n.padding)),await y.initialize(p,n.bind).runAsync();let v;if(s!==!1){let E=c;if(n.defaultStyle!==!1||n.forceActionsMenu){const x=document.createElement("details");x.title=a.CLICK_TO_VIEW_ACTIONS,c.append(x),E=x;const w=document.createElement("summary");w.innerHTML=Ree,x.append(w),v=R=>{x.contains(R.target)||x.removeAttribute("open")},document.addEventListener("click",v)}const C=document.createElement("div");if(E.append(C),C.classList.add("vega-actions"),s===!0||s.export!==!1){for(const x of["svg","png"])if(s===!0||s.export===!0||s.export[x]){const w=a[`${x.toUpperCase()}_ACTION`],R=document.createElement("a"),L=j(n.scaleFactor)?n.scaleFactor[x]:n.scaleFactor;R.text=w,R.href="#",R.target="_blank",R.download=`${l}.${x}`,R.addEventListener("mousedown",async function(J){J.preventDefault();const ne=await y.toImageURL(x,L);this.href=ne}),C.append(R)}}if(s===!0||s.source!==!1){const x=document.createElement("a");x.text=a.SOURCE_ACTION,x.href="#",x.addEventListener("click",function(w){c2(nh(t),n.sourceHeader??"",n.sourceFooter??"",f),w.preventDefault()}),C.append(x)}if(f==="vega-lite"&&(s===!0||s.compiled!==!1)){const x=document.createElement("a");x.text=a.COMPILED_ACTION,x.href="#",x.addEventListener("click",function(w){c2(nh(d),n.sourceHeader??"",n.sourceFooter??"","vega"),w.preventDefault()}),C.append(x)}if(s===!0||s.editor!==!1){const x=n.editorUrl??"https://vega.github.io/editor/",w=document.createElement("a");w.text=a.EDITOR_ACTION,w.href="#",w.addEventListener("click",function(R){Fee(window,x,{config:r,mode:h?"vega":f,renderer:o,spec:nh(h?d:t)}),R.preventDefault()}),C.append(w)}}function A(){v&&document.removeEventListener("click",v),y.finalize()}return{view:y,spec:t,vgSpec:d,finalize:A,embedOptions:n}}var Iee=h2('
'),zee=h2('
');function zte(e,t){Q3(t,!0);let n=Y3(t,"colors",19,()=>[]),i,r,s,a=window.getComputedStyle(document.body),o=tx(null),u=tx(0),l=th(()=>t.value?.plot),c=th(()=>{if(!Cn(l))return null;let A=JSON.parse(Cn(l));return A&&A.params&&!t._selectable&&(A.params=A.params.filter(E=>E.name!=="brush")),iR(()=>{Cn(o)!==A&&(Zb(o,A,!0),Zb(u,A.width,!0)),t.value.chart&&A&&(A=D_(A,a,t.value.chart,n()))}),A}),f=th(()=>!(Cn(c)?.encoding?.column?.field||Cn(c)?.encoding?.row?.field||t.value.chart===void 0));const d=()=>Math.min(r.offsetWidth,Cn(u)||r.offsetWidth);let p=()=>{};const h=()=>{Cn(f)&&(Cn(c).width=d()),Lee(i,Cn(c),{actions:t.show_actions_button}).then(function(A){if(s=A.view,p=()=>{s.signal("width",d()).run()},!t._selectable)return;const E=(C,x)=>{const w=s.signal("brush");if(w)if(Object.keys(w).length===0)t.gradio.dispatch("select",{value:null,index:null,selected:!1});else{const R=Object.keys(w)[0];let L=w[R].map(J=>J/1e3);t.gradio.dispatch("select",{value:w,index:L,selected:!0})}};s.addEventListener("mouseup",E),s.addEventListener("touchup",E)})};let g=new ResizeObserver(()=>{Cn(f)&&Cn(c).width!==r.offsetWidth&&p()});Z3(()=>{h(),g.observe(r)}),eR(()=>{g.disconnect()});var m=zee();K3(m,"data-testid","altair");var y=ex(m);Jb(y,A=>i=A,()=>i);var b=tR(y,2);{var v=A=>{var E=Iee(),C=ex(E,!0);nx(E),rR(()=>sR(C,t.caption)),Qb(A,E)};J3(b,A=>{t.caption&&A(v)})}nx(m),Jb(m,A=>r=A,()=>r),Qb(e,m),nR()}export{zte as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/AltairPlot-Dp2S7wtT.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/AltairPlot-Dp2S7wtT.css new file mode 100644 index 0000000000000000000000000000000000000000..c5dd68b745da6fb848968b82d3e76b414d61d7b1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/AltairPlot-Dp2S7wtT.css @@ -0,0 +1 @@ +.altair.svelte-1i8dfv0 canvas{padding:6px}.altair.svelte-1i8dfv0 .vega-embed{padding:0!important}.altair.svelte-1i8dfv0 .vega-actions{right:0!important}.layout.svelte-1i8dfv0{display:flex;flex-direction:column;justify-content:center;align-items:center;width:var(--size-full);height:var(--size-full);color:var(--body-text-color)}.altair.svelte-1i8dfv0{display:flex;flex-direction:column;justify-content:center;align-items:center;width:var(--size-full);height:var(--size-full)}.caption.svelte-1i8dfv0{font-size:var(--text-sm);margin-bottom:6px}#vg-tooltip-element{font-family:var(--font)!important;font-size:var(--text-xs)!important;box-shadow:none!important;background-color:var(--block-background-fill)!important;border:1px solid var(--border-color-primary)!important;color:var(--body-text-color)!important}#vg-tooltip-element .key{color:var(--body-text-color-subdued)!important} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ApiDocs-D66OUv1H.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ApiDocs-D66OUv1H.js new file mode 100644 index 0000000000000000000000000000000000000000..0ca61a601edd57270b942168f4b4f78976684dd5 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ApiDocs-D66OUv1H.js @@ -0,0 +1,251 @@ +import{p as m,a as Ee,e as st,i as G,k as lt,u as ct,b as ke,h as St,f as Pt,d as Tt,t as zt,v as Xt,F as Kt}from"./i18n-Dnhn5Rxr.js";import{R as $e,t as R,a as o,T as Ce,U as g,f as ht,a4 as Lt,S as re,X as n,V as a,Y as t,a8 as we,a0 as V,Z as Te,W as b,a7 as xe,a6 as Ge,z as k,G as p,w as e,a1 as ve,a2 as _t,a3 as B,x as N,ad as Ae,aa as Bt,M as Vt,bQ as ea,a5 as At,at as qt,as as jt,aw as Nt}from"./index-DWyDLubb.js";import{b as Gt}from"./misc-vsnLZ-Y1.js";import{C as Ft}from"./clear-CEoTtSVi.js";import{a as ta,g as aa}from"./Blocks-D6_IyY-z.js";import{B as Yt}from"./Button-D-_s2ksk.js";import{L as Wt}from"./index-CglBvmLb.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{B as Le}from"./Block-J4oodUWp.js";import{h as Mt}from"./html-Ih_5QVTo.js";import{a as sa}from"./input-DrerMDOL.js";import"./size-CtOeLwIl.js";import"./state.svelte-CXxGByZZ.js";import"./utils.svelte-CCyS_0CY.js";import"./clone-BkeCM4Nl.js";import"./index-DkrWwIux.js";import"./index-tFQomdd2.js";import"./snippet-BWgYNF9D.js";import"./Image-CeW7PJs4.js";/* empty css *//* empty css */import"./Clear-BF6j078A.js";import"./index-B_pwUImq.js";var ra=ht('');function Et(d,s){$e(s,!1);let i=m(s,"icon_size",12,16);var c={get icon_size(){return i()},set icon_size(_){i(_),g()}},v=ra();return R(()=>{Ee(v,"width",i()),Ee(v,"height",i())}),o(d,v),Ce(c)}var na=ht('');function Zt(d,s){$e(s,!1);let i=m(s,"icon_size",12,16);var c={get icon_size(){return i()},set icon_size(_){i(_),g()}},v=na();return R(()=>{Ee(v,"width",i()),Ee(v,"height",i())}),o(d,v),Ce(c)}var ia=ht('');function Ht(d,s){$e(s,!1);let i=m(s,"icon_size",12,16);var c={get icon_size(){return i()},set icon_size(_){i(_),g()}},v=ia();return R(()=>{Ee(v,"width",i()),Ee(v,"height",i())}),o(d,v),Ce(c)}var oa=b('

API Docs

No API Routes found for

To expose an API endpoint of your app in this page, set the api_name parameter of the event listener.
For more information, visit the API Page guide . To hide the API documentation button and this page, set footer_links=["gradio", "settings"] in the Blocks.launch() method.

',1);function la(d,s){$e(s,!1);const i=Lt();let c=m(s,"root",12);var v={get root(){return c()},set root(E){c(E),g()}};st();var _=oa(),H=re(_),O=n(a(H),2),Z=n(a(O)),A=a(Z,!0);t(Z),t(O),we(2),t(H);var x=n(H,2),w=a(x);return Ft(w),t(x),R(()=>V(A,c())),Te("click",x,()=>i("close")),o(d,_),Ce(v)}var ca=b('

API Recorder

',1),da=b('

documentation


',1);function pa(d,s){$e(s,!1);let i=m(s,"root",12),c=m(s,"api_count",12),v=m(s,"current_language",12,"python");const _=Lt();var H={get root(){return i()},set root(y){i(y),g()},get api_count(){return c()},set api_count(y){c(y),g()},get current_language(){return v()},set current_language(y){v(y),g()}};st();var O=da(),Z=re(O),A=a(Z),x=n(A,2),w=a(x);{var E=y=>{var Y=xe("MCP");o(y,Y)},ce=y=>{var Y=Ge(),oe=re(Y);{var ee=$=>{var X=xe("CLI");o($,X)},I=$=>{var X=xe("API");o($,X)};G(oe,$=>{v()==="cli"?$(ee):$(I,!1)},!0)}o(y,Y)};G(w,y=>{v()==="mcp"?y(E):y(ce,!1)})}var K=n(w,2),S=a(K,!0);t(K),t(x);var h=n(x,2),l=a(h);{var P=y=>{Yt(y,{size:"sm",variant:"secondary",elem_id:"start-api-recorder",onclick:()=>_("close",{api_recorder_visible:!0}),children:(Y,oe)=>{var ee=ca();we(2),o(Y,ee)},$$slots:{default:!0}})};G(l,y=>{v()!=="mcp"&&v()!=="cli"&&y(P)})}var U=n(l,2),T=a(U),F=a(T,!0);t(T);var C=n(T,2);{var f=y=>{var Y=xe("MCP Tool");o(y,Y)},L=y=>{var Y=Ge(),oe=re(Y);{var ee=$=>{var X=xe(`CLI + endpoint`);o($,X)},I=$=>{var X=xe("API endpoint");o($,X)};G(oe,$=>{v()==="cli"?$(ee):$(I,!1)},!0)}o(y,Y)};G(C,y=>{v()==="mcp"?y(f):y(L,!1)})}var de=n(C);{var j=y=>{var Y=xe("s");o(y,Y)};G(de,y=>{c()>1&&y(j)})}we(),t(U),t(h),t(Z);var z=n(Z,2),Q=a(z);return Ft(Q),t(z),R(()=>{Ee(A,"src",ta),V(S,i()),V(F,c())}),Te("click",z,()=>_("close")),o(d,O),Ce(H)}function ut(d,s,i=null){return s===void 0?i==="py"?"None":null:d===null&&i==="py"?"None":s==="string"||s==="str"?i===null?d:'"'+d+'"':s==="number"?i===null?parseFloat(d):d:s==="boolean"||s=="bool"?i==="py"?(d=String(d),d==="true"?"True":"False"):i==="js"||i==="bash"?d:d==="true":s==="List[str]"?(d=JSON.stringify(d),d):s.startsWith("Literal['")?'"'+d+'"':i===null?d===""?null:JSON.parse(d):typeof d=="string"?d===""?i==="py"?"None":"null":d:(i==="bash"&&(d=Dt(d)),i==="py"&&(d=Rt(d)),va(d))}function Dt(d){return typeof d=="object"&&d!==null&&!Array.isArray(d)&&"url"in d&&d.url&&"meta"in d&&d.meta?._type==="gradio.FileData"?{path:d.url,meta:{_type:"gradio.FileData"}}:(Array.isArray(d)?d.forEach((s,i)=>{typeof s=="object"&&s!==null&&(d[i]=Dt(s))}):typeof d=="object"&&d!==null&&Object.keys(d).forEach(s=>{d[s]=Dt(d[s])}),d)}function Rt(d){return typeof d=="object"&&d!==null&&!Array.isArray(d)&&"url"in d&&d.url&&"meta"in d&&d.meta?._type==="gradio.FileData"?`handle_file('${d.url}')`:(Array.isArray(d)?d.forEach((s,i)=>{typeof s=="object"&&s!==null&&(d[i]=Rt(s))}):typeof d=="object"&&d!==null&&Object.keys(d).forEach(s=>{d[s]=Rt(d[s])}),d)}function va(d){let s=JSON.stringify(d,(v,_)=>_===null?"UNQUOTEDNone":typeof _=="string"&&_.startsWith("handle_file(")&&_.endsWith(")")?`UNQUOTED${_}`:_);const i=/"UNQUOTEDhandle_file\(([^)]*)\)"/g;s=s.replace(i,(v,_)=>`handle_file(${_})`);const c=/"UNQUOTEDNone"/g;return s.replace(c,"None")}function ot(d){return d<1?`${Math.round(d*1e3)} ms`:`${d.toFixed(2)} s`}var _a=b(" :",1),ua=b(" :",1),ha=b(" ",1),ma=b('Required'),ga=b('Default: ',1),fa=b('

',1),ya=b('
'),ba=b('

',1);function wa(d,s){$e(s,!1);let i=m(s,"is_running",12),c=m(s,"endpoint_returns",12),v=m(s,"js_returns",12),_=m(s,"current_language",12);var H={get is_running(){return i()},set is_running(h){i(h),g()},get endpoint_returns(){return c()},set endpoint_returns(h){c(h),g()},get js_returns(){return v()},set js_returns(h){v(h),g()},get current_language(){return _()},set current_language(h){_(h),g()}};st();var O=ba(),Z=re(O),A=n(a(Z),2);{var x=h=>{var l=_a(),P=re(l),U=n(P);{var T=F=>{var C=xe("s");o(F,C)};G(U,F=>{p(c()),k(()=>c().length!=1)&&F(T)})}we(),R(()=>V(P,`Accepts a JSON object with ${p(c()),k(()=>c().length)??""} + key`)),o(h,l)},w=h=>{var l=ua(),P=re(l),U=n(P);{var T=F=>{var C=xe("s");o(F,C)};G(U,F=>{p(c()),k(()=>c().length!=1)&&F(T)})}we(),R(()=>V(P,`Accepts ${p(c()),k(()=>c().length)??""} + parameter`)),o(h,l)};G(A,h=>{_()==="bash"?h(x):h(w,!1)})}t(Z);var E=n(Z,2);let ce;lt(E,5,c,ct,(h,l,P)=>{let U=()=>e(l).label,T=()=>e(l).python_type,F=()=>e(l).component,C=()=>e(l).parameter_name,f=()=>e(l).parameter_has_default,L=()=>e(l).parameter_default;var de=fa(),j=n(re(de),2),z=a(j),Q=a(z),y=a(Q,!0);t(Q);var Y=n(Q,2),oe=a(Y);{var ee=q=>{var W=ha(),ie=re(W,!0),_e=n(ie);{var fe=le=>{var ue=xe(` | + None`);o(le,ue)};G(_e,le=>{f()&&L()===null&&le(fe)})}R(()=>V(ie,(T(),k(()=>T().type)))),o(q,W)},I=q=>{var W=Ge(),ie=re(W);{var _e=le=>{var ue=xe();R(()=>V(ue,(T(),k(()=>T().type)))),o(le,ue)},fe=le=>{var ue=xe();R(()=>V(ue,(p(v()),k(()=>v()[P].type||"any")))),o(le,ue)};G(ie,le=>{_()==="bash"?le(_e):le(fe,!1)},!0)}o(q,W)};G(oe,q=>{_()==="python"?q(ee):q(I,!1)})}t(Y);var $=n(Y,2);{var X=q=>{var W=ma();o(q,W)},ne=q=>{var W=ga(),ie=n(re(W)),_e=a(ie,!0);t(ie),R(fe=>V(_e,fe),[()=>(p(ut),L(),T(),k(()=>ut(L(),T().type,"py")))]),o(q,W)};G($,q=>{!f()||_()=="bash"?q(X):q(ne,!1)})}t(z);var ae=n(z,2),te=a(ae);t(ae),t(j),R(()=>{V(y,C()||`[${P}]`),V(te,`The input value that is provided in the "${U()??""}" ${F()??""} + component. ${T(),k(()=>T().description)??""}`)}),o(h,de)}),t(E);var K=n(E,2);{var S=h=>{var l=ya(),P=a(l);Wt(P,{margin:!1}),t(l),o(h,l)};G(K,h=>{i()&&h(S)})}return R(()=>ce=ke(E,1,"",null,ce,{hide:i()})),o(d,O),Ce(H)}var xa=ht('');function Ot(d,s){$e(s,!1);let i=m(s,"classNames",12,"");var c={get classNames(){return i()},set classNames(_){i(_),g()}},v=xa();return R(()=>ke(v,0,St(i()),"svelte-etvp4k")),o(d,v),Ce(c)}var $a=ht('');function Jt(d,s){$e(s,!1);let i=m(s,"classNames",12,"");var c={get classNames(){return i()},set classNames(_){i(_),g()}},v=$a();return R(()=>ke(v,0,St(i()||"icon-size"),"svelte-5quqiz")),o(d,v),Ce(c)}var Ca=b('');function ze(d,s){$e(s,!1);let i=m(s,"code",12),c=B(!1);function v(){navigator.clipboard.writeText(i()),N(c,!0),setTimeout(()=>{N(c,!1)},1500)}ve(()=>e(c),()=>{e(c)}),_t();var _={get code(){return i()},set code(w){i(w),g()}},H=Ca(),O=a(H),Z=a(O);{var A=w=>{Jt(w,{classNames:"w-3 h-3 max-sm:w-2.5 max-sm:h-2.5"})},x=w=>{Ot(w,{classNames:"w-3 h-3 max-sm:w-2.5 max-sm:h-2.5"})};G(Z,w=>{e(c)?w(A):w(x,!1)})}return t(O),t(H),Te("click",H,v),o(d,H),Ce(_)}var Ia=b('
'),ka=b('
'),ja=b('
'),Pa=b('
'),Ta=b('
'),Sa=b('

First, install the HF CLI.

On macOS and Linux:

On Windows:

Then, install the Gradio extension:

',1),Na=b('
 
'),Ma=b(" ",1);function za(d,s){$e(s,!1);const i=B();let c=m(s,"current_language",12),v=m(s,"cli_flavor",12,"hf"),_="pip install gradio_client",H="npm i -D @gradio/client",O="curl --version";const Z="curl -LsSf https://hf.co/cli/install.sh | bash",A='powershell -ExecutionPolicy ByPass -c "irm https://hf.co/cli/install.ps1 | iex"';ve(()=>p(v()),()=>{N(i,v()==="hf"?"hf extensions install gradio-app/hf-gradio":"pip install gradio --upgrade")}),_t();var x={get current_language(){return c()},set current_language(S){c(S),g()},get cli_flavor(){return v()},set cli_flavor(S){v(S),g()}},w=Ge(),E=re(w);{var ce=S=>{Le(S,{children:(h,l)=>{var P=Ia(),U=a(P),T=a(U);ze(T,{code:_}),t(U);var F=n(U,2),C=a(F);C.textContent="$ pip install gradio_client",t(F),t(P),o(h,P)},$$slots:{default:!0}})},K=S=>{var h=Ge(),l=re(h);{var P=T=>{Le(T,{children:(F,C)=>{var f=ka(),L=a(f),de=a(L);ze(de,{code:H}),t(L);var j=n(L,2),z=a(j);z.textContent="$ npm i -D @gradio/client",t(j),t(f),o(F,f)},$$slots:{default:!0}})},U=T=>{var F=Ge(),C=re(F);{var f=de=>{Le(de,{children:(j,z)=>{var Q=ja(),y=a(Q),Y=a(y);ze(Y,{code:O}),t(y);var oe=n(y,2),ee=a(oe);ee.textContent="$ curl --version",t(oe),t(Q),o(j,Q)},$$slots:{default:!0}})},L=de=>{var j=Ge(),z=re(j);{var Q=y=>{var Y=Ma(),oe=re(Y);{var ee=$=>{var X=Sa(),ne=n(re(X),4);Le(ne,{children:(te,q)=>{var W=Pa(),ie=a(W),_e=a(ie);ze(_e,{code:Z}),t(ie);var fe=n(ie,2),le=a(fe);le.textContent="$ curl -LsSf https://hf.co/cli/install.sh | bash",t(fe),t(W),o(te,W)},$$slots:{default:!0}});var ae=n(ne,4);Le(ae,{children:(te,q)=>{var W=Ta(),ie=a(W),_e=a(ie);ze(_e,{code:A}),t(ie);var fe=n(ie,2),le=a(fe);le.textContent='$ powershell -ExecutionPolicy ByPass -c "irm https://hf.co/cli/install.ps1 | iex"',t(fe),t(W),o(te,W)},$$slots:{default:!0}}),we(2),o($,X)};G(oe,$=>{v()==="hf"&&$(ee)})}var I=n(oe,2);Le(I,{children:($,X)=>{var ne=Na(),ae=a(ne),te=a(ae);ze(te,{get code(){return e(i)}}),t(ae);var q=n(ae,2),W=a(q),ie=a(W);t(W),t(q),t(ne),R(()=>V(ie,`$ ${e(i)??""}`)),o($,ne)},$$slots:{default:!0}}),o(y,Y)};G(z,y=>{c()==="cli"&&y(Q)},!0)}o(de,j)};G(C,de=>{c()==="bash"?de(f):de(L,!1)},!0)}o(T,F)};G(l,T=>{c()==="javascript"?T(P):T(U,!1)},!0)}o(S,h)};G(E,S=>{c()==="python"?S(ce):S(K,!1)})}return o(d,w),Ce(x)}var Aa=b('
p50
p90
p99
');function qa(d,s){$e(s,!1);const i=B();let c=m(s,"p50",12),v=m(s,"p90",12),_=m(s,"p99",12);ve(()=>(p(c()),p(v()),p(_())),()=>{N(i,Math.max(c(),v(),_()))}),_t();var H={get p50(){return c()},set p50(L){c(L),g()},get p90(){return v()},set p90(L){v(L),g()},get p99(){return _()},set p99(L){_(L),g()}};st();var O=Aa(),Z=n(a(O),2),A=a(Z),x=n(a(A),2),w=a(x);t(x);var E=n(x,2),ce=a(E,!0);t(E),t(A);var K=n(A,2),S=n(a(K),2),h=a(S);t(S);var l=n(S,2),P=a(l,!0);t(l),t(K);var U=n(K,2),T=n(a(U),2),F=a(T);t(T);var C=n(T,2),f=a(C,!0);return t(C),t(U),t(Z),t(O),R((L,de,j)=>{Pt(w,`width: ${c()/e(i)*100}%`),V(ce,L),Pt(h,`width: ${v()/e(i)*100}%`),V(P,de),Pt(F,`width: ${_()/e(i)*100}%`),V(f,j)},[()=>(p(ot),p(c()),k(()=>ot(c()))),()=>(p(ot),p(v()),k(()=>ot(v()))),()=>(p(ot),p(_()),k(()=>ot(_())))]),o(d,O),Ce(H)}var Da=b('Most recently used'),Ra=b('
'),Oa=b('

API name:

');function La(d,s){$e(s,!1);const i=B();let c=m(s,"api_name",12,null),v=m(s,"description",12,null),_=m(s,"analytics",12),H=m(s,"last_api_call",12,null),O=m(s,"dependency_id",12,null);const Z=c()?_()[c()]?.success_rate:0;ve(()=>(p(H()),p(O())),()=>{N(i,H()?.fn_index===O())}),_t();var A={get api_name(){return c()},set api_name(l){c(l),g()},get description(){return v()},set description(l){v(l),g()},get analytics(){return _()},set analytics(l){_(l),g()},get last_api_call(){return H()},set last_api_call(l){H(l),g()},get dependency_id(){return O()},set dependency_id(l){O(l),g()}};st();var x=Oa(),w=n(a(x)),E=a(w,!0);t(w);var ce=n(w,2),K=a(ce),S=n(K);{var h=l=>{const P=Ae(()=>(p(_()),p(c()),k(()=>_()[c()]))),U=Ae(()=>(p(e(P)),k(()=>e(P).process_time_percentiles["50th"]))),T=Ae(()=>(p(e(P)),k(()=>e(P).process_time_percentiles["90th"]))),F=Ae(()=>(p(e(P)),k(()=>e(P).process_time_percentiles["99th"])));var C=Ra(),f=a(C),L=a(f),de=a(L);t(L);var j=n(L,2),z=a(j);qa(z,{get p50(){return e(U)},get p90(){return e(T)},get p99(){return e(F)}}),t(j),t(f);var Q=n(f,2);{var y=Y=>{var oe=Da();o(Y,oe)};G(Q,Y=>{e(i)&&Y(y)})}t(C),R((Y,oe)=>V(de,`${p(e(P)),k(()=>e(P).total_requests)??""} requests (${Y??""}% successful, p50: ${oe??""})`),[()=>k(()=>Math.round(Z*100)),()=>(p(ot),p(e(U)),k(()=>ot(e(U))))]),o(l,C)};G(S,l=>{p(_()),p(c()),k(()=>_()&&c()&&_()[c()])&&l(h)})}return t(ce),t(x),R(()=>{V(E,"/"+c()),V(K,`${v()??""} `)}),o(d,x),Ce(A)}var Ga=b('
'),Ea=b('
'),Za=b('
'),Ha=b('
'),Ua=b('
');function Ba(d,s){$e(s,!1);const i=B(),c=B(),v=B(),_=B(),H=B();let O=m(s,"dependency",12),Z=m(s,"current_language",12),A=m(s,"api_description",12,null),x=m(s,"analytics",12),w=m(s,"code_snippets",12),E=m(s,"last_api_call",12,null),ce=m(s,"cli_command",12,"");function K(I){return I.replace(/&/g,"&").replace(//g,">")}function S(I){let $=K(I);return $=$.replace(/\b(from|import|print)\b/g,'$1'),$=$.replace(/(Client\()("[^"]*")(\))/g,'$1$2$3'),$=$.replace(/(api_name=)("[^"]*")/g,'$1$2'),$}function h(I){let $=K(I);return $=$.replace(/\b(import|from|const|await)\b/g,'$1'),$=$.replace(/(Client\.connect\()("[^"]*")(\))/g,'$1$2$3'),$=$.replace(/(\.predict\()("[^"]*")/g,'$1$2'),$}function l(I){return K(I)}ve(()=>(p(w()),p(ce())),()=>{N(i,(w().cli||"").replace("{command}",ce()))}),ve(()=>p(w()),()=>{N(c,S(w().python||""))}),ve(()=>p(w()),()=>{N(v,h(w().javascript||""))}),ve(()=>p(w()),()=>{N(_,l(w().bash||""))}),ve(()=>e(i),()=>{N(H,l(e(i)))}),_t();var P={get dependency(){return O()},set dependency(I){O(I),g()},get current_language(){return Z()},set current_language(I){Z(I),g()},get api_description(){return A()},set api_description(I){A(I),g()},get analytics(){return x()},set analytics(I){x(I),g()},get code_snippets(){return w()},set code_snippets(I){w(I),g()},get last_api_call(){return E()},set last_api_call(I){E(I),g()},get cli_command(){return ce()},set cli_command(I){ce(I),g()}};st();var U=Ua(),T=a(U);La(T,{get api_name(){return p(O()),k(()=>O().api_name)},get description(){return A()},get analytics(){return x()},get last_api_call(){return E()},get dependency_id(){return p(O()),k(()=>O().id)}});var F=n(T,2);let C;var f=a(F);Le(f,{children:(I,$)=>{var X=Ga(),ne=a(X),ae=a(ne);{let W=Ae(()=>(p(w()),k(()=>w().python||"")));ze(ae,{get code(){return e(W)}})}t(ne);var te=n(ne,2),q=a(te);Mt(q,()=>e(c)),t(te),t(X),o(I,X)},$$slots:{default:!0}}),t(F);var L=n(F,2);let de;var j=a(L);Le(j,{children:(I,$)=>{var X=Ea(),ne=a(X),ae=a(ne);{let W=Ae(()=>(p(w()),k(()=>w().javascript||"")));ze(ae,{get code(){return e(W)}})}t(ne);var te=n(ne,2),q=a(te);Mt(q,()=>e(v)),t(te),t(X),o(I,X)},$$slots:{default:!0}}),t(L);var z=n(L,2);let Q;var y=a(z);Le(y,{children:(I,$)=>{var X=Za(),ne=a(X),ae=a(ne);{let W=Ae(()=>(p(w()),k(()=>w().bash||"")));ze(ae,{get code(){return e(W)}})}t(ne);var te=n(ne,2),q=a(te);Mt(q,()=>e(_)),t(te),t(X),o(I,X)},$$slots:{default:!0}}),t(z);var Y=n(z,2);let oe;var ee=a(Y);return Le(ee,{children:(I,$)=>{var X=Ha(),ne=a(X),ae=a(ne);ze(ae,{get code(){return e(i)}}),t(ne);var te=n(ne,2),q=a(te);Mt(q,()=>e(H)),t(te),t(X),o(I,X)},$$slots:{default:!0}}),t(Y),t(U),R(()=>{C=ke(F,1,"svelte-1v9rhoq",null,C,{hidden:Z()!=="python"}),de=ke(L,1,"svelte-1v9rhoq",null,de,{hidden:Z()!=="javascript"}),Q=ke(z,1,"svelte-1v9rhoq",null,Q,{hidden:Z()!=="bash"}),oe=ke(Y,1,"svelte-1v9rhoq",null,oe,{hidden:Z()!=="cli"})}),o(d,U),Ce(P)}var Va=b(` +client. +) +`,1),Fa=b(`
from gradio_client import Client, file
+
+client = Client( )
+
`),Ya=b(` +await client.predict( ); + `,1),Wa=b(`
import { Client } from "@gradio/client";
+
+const app = await Client.connect( );
+					
`),Ja=b('
 

',1),Qa=b('
'),Xa=b('
');function Ka(d,s){$e(s,!1);let i=m(s,"dependencies",12),c=m(s,"short_root",12),v=m(s,"root",12),_=m(s,"api_prefix",12,""),H=m(s,"current_language",12),O=m(s,"username",12),Z=B(),A=B(),x=B(),w=B(),E=m(s,"api_calls",28,()=>[]);async function ce(){return await(await fetch(v().replace(/\/$/,"")+_()+"/info/?all_endpoints=true")).json()}let K,S=B([]),h=B([]),l=B([]);function P(C,f){const L=`/${i()[C.fn_index].api_name}`,j=C.data.filter(z=>typeof z<"u").map((z,Q)=>{if(K[L]){const y=K[L].parameters[Q];if(!y)return;const Y=y.parameter_name,oe=y.python_type.type;if(f==="py")return` ${Y}=${ut(z,oe,"py")}`;if(f==="js")return` ${Y}: ${ut(z,oe,"js")}`;if(f==="bash")return` "${Y}": ${ut(z,oe,"bash")}`}return` ${ut(z,void 0,f)}`}).filter(z=>typeof z<"u").join(`, +`);if(j){if(f==="py")return`${j}, +`;if(f==="js")return`{ +${j}, +}`;if(f==="bash")return`{ +${j} +}`}return f==="py"?"":` +`}Bt(async()=>{K=(await ce()).named_endpoints;let f=E().map(z=>P(z,"py")),L=E().map(z=>P(z,"js")),de=E().map(z=>P(z,"bash")),j=E().map(z=>i()[z.fn_index].api_name||"");N(S,f.map((z,Q)=>({call:z,api_name:j[Q]}))),N(h,L.map((z,Q)=>({call:z,api_name:j[Q]}))),N(l,de.map((z,Q)=>({call:z,api_name:j[Q]}))),await Vt(),N(A,e(Z).innerText)});var U={get dependencies(){return i()},set dependencies(C){i(C),g()},get short_root(){return c()},set short_root(C){c(C),g()},get root(){return v()},set root(C){v(C),g()},get api_prefix(){return _()},set api_prefix(C){_(C),g()},get current_language(){return H()},set current_language(C){H(C),g()},get username(){return O()},set username(C){O(C),g()},get api_calls(){return E()},set api_calls(C){E(C),g()}};st();var T=Xa(),F=a(T);return Le(F,{border_mode:"focus",children:(C,f)=>{var L=Ge(),de=re(L);{var j=Q=>{var y=Fa(),Y=a(y),oe=a(Y);ze(oe,{get code(){return e(A)}}),t(Y);var ee=n(Y,2),I=a(ee),$=n(a(I),4),X=a($);t($);var ne=n($);{var ae=q=>{var W=xe();R(()=>V(W,`, auth=("${O()??""}", **password**)`)),o(q,W)};G(ne,q=>{O()!==null&&q(ae)})}var te=n(ne,2);lt(te,1,()=>e(S),ct,(q,W)=>{let ie=()=>e(W).call,_e=()=>e(W).api_name;we();var fe=Va(),le=n(re(fe)),ue=a(le),qe=n(ue),We=a(qe);t(qe),we(),t(le),R(()=>{V(ue,`predict( +${ie()??""} api_name=`),V(We,`"/${_e()??""}"`)}),o(q,fe)}),t(I),t(ee),Tt(ee,q=>N(Z,q),()=>e(Z)),t(y),R(()=>V(X,`"${c()??""}"`)),o(Q,y)},z=Q=>{var y=Ge(),Y=re(y);{var oe=I=>{var $=Wa(),X=a($),ne=a(X);{let le=Ae(()=>(e(x),k(()=>e(x)?.innerText)));ze(ne,{get code(){return e(le)}})}t(X);var ae=n(X,2),te=a(ae),q=n(a(te)),W=a(q);t(q);var ie=n(q);{var _e=le=>{var ue=xe();R(()=>V(ue,`, {auth: ["${O()??""}", **password**]}`)),o(le,ue)};G(ie,le=>{O()!==null&&le(_e)})}var fe=n(ie,2);lt(fe,1,()=>e(h),ct,(le,ue)=>{let qe=()=>e(ue).call,We=()=>e(ue).api_name;we();var De=Ya(),rt=n(re(De)),mt=a(rt);t(rt);var M=n(rt);{var r=u=>{var J=xe();R(()=>V(J,`, ${qe()??""}`)),o(u,J)};G(M,u=>{qe()&&u(r)})}we(),R(()=>V(mt,` + "/${We()??""}"`)),o(le,De)}),t(te),t(ae),Tt(ae,le=>N(x,le),()=>e(x)),t($),R(()=>V(W,`"${c()??""}"`)),o(I,$)},ee=I=>{var $=Ge(),X=re($);{var ne=ae=>{var te=Qa(),q=a(te),W=a(q);{let _e=Ae(()=>(e(w),k(()=>e(w)?.innerText)));ze(W,{get code(){return e(_e)}})}t(q);var ie=n(q,2);lt(ie,5,()=>e(l),ct,(_e,fe)=>{let le=()=>e(fe).call,ue=()=>e(fe).api_name;var qe=Ja(),We=re(qe),De=a(We);t(We),we(2),R(()=>V(De,`curl -X POST ${c()??""}call/v2/${ue()??""} -s -H "Content-Type: application/json" -d '${le()??""}' \\ + | awk -F'"' '{ print $4}' \\ + | read EVENT_ID; curl -N ${c()??""}call/${ue()??""}/$EVENT_ID`)),o(_e,qe)}),t(ie),Tt(ie,_e=>N(w,_e),()=>e(w)),t(te),o(ae,te)};G(X,ae=>{H()==="bash"&&ae(ne)},!0)}o(I,$)};G(Y,I=>{H()==="javascript"?I(oe):I(ee,!1)},!0)}o(Q,y)};G(de,Q=>{H()==="python"?Q(j):Q(z,!1)})}o(C,L)},$$slots:{default:!0}}),t(T),o(d,T),Ce(U)}const es="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20aria-hidden='true'%20focusable='false'%20role='img'%20width='1em'%20height='1em'%20preserveAspectRatio='xMidYMid%20meet'%20viewBox='0%200%2032%2032'%20%3e%3cpath%20d='M15.84.5a16.4,16.4,0,0,0-3.57.32C9.1,1.39,8.53,2.53,8.53,4.64V7.48H16v1H5.77a4.73,4.73,0,0,0-4.7,3.74,14.82,14.82,0,0,0,0,7.54c.57,2.28,1.86,3.82,4,3.82h2.6V20.14a4.73,4.73,0,0,1,4.63-4.63h7.38a3.72,3.72,0,0,0,3.73-3.73V4.64A4.16,4.16,0,0,0,19.65.82,20.49,20.49,0,0,0,15.84.5ZM11.78,2.77a1.39,1.39,0,0,1,1.38,1.46,1.37,1.37,0,0,1-1.38,1.38A1.42,1.42,0,0,1,10.4,4.23,1.44,1.44,0,0,1,11.78,2.77Z'%20fill='%235a9fd4'%20%3e%3c/path%3e%3cpath%20d='M16.16,31.5a16.4,16.4,0,0,0,3.57-.32c3.17-.57,3.74-1.71,3.74-3.82V24.52H16v-1H26.23a4.73,4.73,0,0,0,4.7-3.74,14.82,14.82,0,0,0,0-7.54c-.57-2.28-1.86-3.82-4-3.82h-2.6v3.41a4.73,4.73,0,0,1-4.63,4.63H12.35a3.72,3.72,0,0,0-3.73,3.73v7.14a4.16,4.16,0,0,0,3.73,3.82A20.49,20.49,0,0,0,16.16,31.5Zm4.06-2.27a1.39,1.39,0,0,1-1.38-1.46,1.37,1.37,0,0,1,1.38-1.38,1.42,1.42,0,0,1,1.38,1.38A1.44,1.44,0,0,1,20.22,29.23Z'%20fill='%23ffd43b'%20%3e%3c/path%3e%3c/svg%3e",ts="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20aria-hidden='true'%20focusable='false'%20role='img'%20width='1em'%20height='1em'%20preserveAspectRatio='xMidYMid%20meet'%20viewBox='0%200%2032%2032'%20%3e%3crect%20width='32'%20height='32'%20fill='%23f7df1e'%3e%3c/rect%3e%3cpath%20d='M21.5,25a3.27,3.27,0,0,0,3,1.83c1.25,0,2-.63,2-1.49,0-1-.81-1.39-2.19-2L23.56,23C21.39,22.1,20,20.94,20,18.49c0-2.25,1.72-4,4.41-4a4.44,4.44,0,0,1,4.27,2.41l-2.34,1.5a2,2,0,0,0-1.93-1.29,1.31,1.31,0,0,0-1.44,1.29c0,.9.56,1.27,1.85,1.83l.75.32c2.55,1.1,4,2.21,4,4.72,0,2.71-2.12,4.19-5,4.19a5.78,5.78,0,0,1-5.48-3.07Zm-10.63.26c.48.84.91,1.55,1.94,1.55s1.61-.39,1.61-1.89V14.69h3V25c0,3.11-1.83,4.53-4.49,4.53a4.66,4.66,0,0,1-4.51-2.75Z'%20%3e%3c/path%3e%3c/svg%3e",as="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20id='Layer_1'%20x='0px'%20y='0px'%20viewBox='0%200%20150%20150'%20style='enable-background:new%200%200%20150%20150;%20background-color:%20%2372a824;'%20xml:space='preserve'%3e%3cscript%20xmlns=''/%3e%3cstyle%20type='text/css'%3e%20.st0{fill:%23FFFFFF;}%20%3c/style%3e%3cg%3e%3cpath%20class='st0'%20d='M118.9,40.3L81.7,18.2c-2.2-1.3-4.7-2-7.2-2s-5,0.7-7.2,2L30.1,40.3c-4.4,2.6-7.2,7.5-7.2,12.8v44.2%20c0,5.3,2.7,10.1,7.2,12.8l37.2,22.1c2.2,1.3,4.7,2,7.2,2c2.5,0,5-0.7,7.2-2l37.2-22.1c4.4-2.6,7.2-7.5,7.2-12.8V53%20C126.1,47.8,123.4,42.9,118.9,40.3z%20M90.1,109.3l0.1,3.2c0,0.4-0.2,0.8-0.5,1l-1.9,1.1c-0.3,0.2-0.5,0-0.6-0.4l0-3.1%20c-1.6,0.7-3.2,0.8-4.3,0.4c-0.2-0.1-0.3-0.4-0.2-0.7l0.7-2.9c0.1-0.2,0.2-0.5,0.3-0.6c0.1-0.1,0.1-0.1,0.2-0.1%20c0.1-0.1,0.2-0.1,0.3,0c1.1,0.4,2.6,0.2,3.9-0.5c1.8-0.9,2.9-2.7,2.9-4.5c0-1.6-0.9-2.3-3-2.3c-2.7,0-5.2-0.5-5.3-4.5%20c0-3.3,1.7-6.7,4.4-8.8l0-3.2c0-0.4,0.2-0.8,0.5-1l1.8-1.2c0.3-0.2,0.5,0,0.6,0.4l0,3.2c1.3-0.5,2.5-0.7,3.6-0.4%20c0.2,0.1,0.3,0.4,0.2,0.7l-0.7,2.8c-0.1,0.2-0.2,0.4-0.3,0.6c-0.1,0.1-0.1,0.1-0.2,0.1c-0.1,0-0.2,0.1-0.3,0%20c-0.5-0.1-1.6-0.4-3.4,0.6c-1.9,1-2.6,2.6-2.5,3.8c0,1.5,0.8,1.9,3.3,1.9c3.4,0.1,4.9,1.6,5,5C94.7,103.4,92.9,107,90.1,109.3z%20M109.6,103.9c0,0.3,0,0.6-0.3,0.7l-9.4,5.7c-0.2,0.1-0.4,0-0.4-0.3v-2.4c0-0.3,0.2-0.5,0.4-0.6l9.3-5.5c0.2-0.1,0.4,0,0.4,0.3%20V103.9z%20M116.1,49.6L80.9,71.3c-4.4,2.6-7.6,5.4-7.6,10.7v43.4c0,3.2,1.3,5.2,3.2,5.8c-0.6,0.1-1.3,0.2-2,0.2%20c-2.1,0-4.1-0.6-5.9-1.6l-37.2-22.1c-3.6-2.2-5.9-6.2-5.9-10.5V53c0-4.3,2.3-8.4,5.9-10.5l37.2-22.1c1.8-1.1,3.8-1.6,5.9-1.6%20s4.1,0.6,5.9,1.6l37.2,22.1c3.1,1.8,5.1,5,5.7,8.5C122.1,48.4,119.3,47.7,116.1,49.6z'/%3e%3c/g%3e%3c/svg%3e";var ss=b(''),rs=b('

',1),ns=b('
'),is=b('

Returns

',1);function os(d,s){$e(s,!1);let i=m(s,"is_running",12),c=m(s,"endpoint_returns",12),v=m(s,"js_returns",12),_=m(s,"current_language",12);var H={get is_running(){return i()},set is_running(h){i(h),g()},get endpoint_returns(){return c()},set endpoint_returns(h){c(h),g()},get js_returns(){return v()},set js_returns(h){v(h),g()},get current_language(){return _()},set current_language(h){_(h),g()}};st();var O=is(),Z=re(O),A=n(a(Z),2);{var x=h=>{var l=xe();R(()=>V(l,`${_()=="python"?"tuple":_()=="bash"?"array":"list"} of ${p(c()),k(()=>c().length)??""} + elements`)),o(h,l)},w=h=>{var l=xe();R(()=>V(l,`${_()=="bash"?"an array of ":""}1 element`)),o(h,l)};G(A,h=>{p(c()),k(()=>c().length>1)?h(x):h(w,!1)})}t(Z);var E=n(Z,2);let ce;lt(E,5,c,ct,(h,l,P)=>{let U=()=>e(l).label,T=()=>e(l).python_type,F=()=>e(l).component;var C=rs(),f=n(re(C),2),L=a(f),de=a(L);{var j=I=>{var $=ss();$.textContent=`[${P}]`,o(I,$)};G(de,I=>{p(c()),k(()=>c().length>1)&&I(j)})}var z=n(de,2),Q=a(z);{var y=I=>{var $=xe();R(()=>V($,(T(),k(()=>T().type)))),o(I,$)},Y=I=>{var $=Ge(),X=re($);{var ne=te=>{var q=xe();R(()=>V(q,(T(),k(()=>T().type)))),o(te,q)},ae=te=>{var q=xe();R(()=>V(q,(p(v()),k(()=>v()[P].type)))),o(te,q)};G(X,te=>{_()==="bash"?te(ne):te(ae,!1)},!0)}o(I,$)};G(Q,I=>{_()==="python"?I(y):I(Y,!1)})}t(z),t(L);var oe=n(L,2),ee=a(oe);t(oe),t(f),R(()=>V(ee,`The output value that appears in the "${U()??""}" ${F()??""} + component.`)),o(h,C)}),t(E);var K=n(E,2);{var S=h=>{var l=ns(),P=a(l);Wt(P,{margin:!1}),t(l),o(h,l)};G(K,h=>{i()&&h(S)})}return R(()=>ce=ke(E,1,"",null,ce,{hide:i()})),o(d,O),Ce(H)}const ls="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjE0IDIyIDEyMiAxMDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiAjZmZmZmZmOyI+CjxyZWN0IHg9IjIyIiB5PSIyOCIgd2lkdGg9IjEwNiIgaGVpZ2h0PSI5NCIgcng9IjgiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzM3NDE1MSIgc3Ryb2tlLXdpZHRoPSI2Ii8+CjxyZWN0IHg9IjIyIiB5PSIyOCIgd2lkdGg9IjEwNiIgaGVpZ2h0PSIyMCIgcng9IjgiIGZpbGw9IiMzNzQxNTEiIGZpbGwtb3BhY2l0eT0iMC4wOCIvPgo8Y2lyY2xlIGN4PSIzOCIgY3k9IjM4IiByPSI0IiBmaWxsPSIjZmY1ZjU3Ii8+CjxjaXJjbGUgY3g9IjUyIiBjeT0iMzgiIHI9IjQiIGZpbGw9IiNmZWJjMmUiLz4KPGNpcmNsZSBjeD0iNjYiIGN5PSIzOCIgcj0iNCIgZmlsbD0iIzI4Yzg0MCIvPgo8dGV4dCB4PSIzOCIgeT0iNzYiIGZpbGw9IiMzNzQxNTEiIGZvbnQtZmFtaWx5PSJtb25vc3BhY2UiIGZvbnQtc2l6ZT0iMjIiIGZvbnQtd2VpZ2h0PSJib2xkIj4mZ3Q7XzwvdGV4dD4KPHJlY3QgeD0iMzgiIHk9Ijg4IiB3aWR0aD0iNTAiIGhlaWdodD0iNCIgcng9IjIiIGZpbGw9IiMzNzQxNTEiIGZpbGwtb3BhY2l0eT0iMC4zNSIvPgo8cmVjdCB4PSIzOCIgeT0iMTAwIiB3aWR0aD0iMzUiIGhlaWdodD0iNCIgcng9IjIiIGZpbGw9IiMzNzQxNTEiIGZpbGwtb3BhY2l0eT0iMC4yIi8+Cjwvc3ZnPgo=";var cs=b('
 
'),ds=b('
 
'),ps=b('
 
'),vs=b(`

1. Make sure you are using the latest version of Gradio:

2. Install the usage of this Space as a Skill for your coding agent by + running this in your terminal:

Instead of --claude, you can use --cursor, --codex, or --opencode. Combine flags to install for + multiple agents. Use --global to install user-level + instead of per-project.

3. This will add a skill to your coding agent that describes how to use this + Space via Python, JavaScript, and cURL API. The skill will look like this:

`);function _s(d,s){$e(s,!1);const i=B(),c=B(),v=B(),_=B(),H=B(),O=B(),Z=B();let A=m(s,"space_id",12);ve(()=>p(A()),()=>{N(i,A()||"")}),ve(()=>e(i),()=>{N(c,e(i).replace("/","-"))}),ve(()=>{},()=>{N(v,"pip install --upgrade gradio")}),ve(()=>e(i),()=>{N(_,`gradio skills add ${e(i)} --claude`)}),ve(()=>e(i),()=>{N(H,`gradio skills add ${e(i)} --cursor`)}),ve(()=>e(i),()=>{N(O,`gradio skills add ${e(i)} --codex`)}),ve(()=>(e(c),e(i)),()=>{N(Z,`--- +name: ${e(c)} +description: Use the ${e(i)} Gradio Space via API. Provides Python, JavaScript, and cURL usage examples. +--- + +# ${e(i)} + +This skill describes how to use the ${e(i)} Gradio Space programmatically. + +## API Endpoints +...`)}),_t();var x={get space_id(){return A()},set space_id(S){A(S),g()}},w=vs(),E=n(a(w),2);Le(E,{children:(S,h)=>{var l=cs(),P=a(l),U=a(P);ze(U,{get code(){return e(v)}}),t(P);var T=n(P,2),F=a(T),C=a(F);t(F),t(T),t(l),R(()=>V(C,`$ ${e(v)??""}`)),o(S,l)},$$slots:{default:!0}});var ce=n(E,4);Le(ce,{children:(S,h)=>{var l=ds(),P=a(l),U=a(P);ze(U,{get code(){return e(_)}}),t(P);var T=n(P,2),F=a(T),C=a(F);t(F),t(T),t(l),R(()=>V(C,`$ ${e(_)??""}`)),o(S,l)},$$slots:{default:!0}});var K=n(ce,6);return Le(K,{children:(S,h)=>{var l=ps(),P=a(l),U=a(P);ze(U,{get code(){return e(Z)}}),t(P);var T=n(P,2),F=a(T),C=a(F,!0);t(F),t(T),t(l),R(()=>V(C,e(Z))),o(S,l)},$$slots:{default:!0}}),t(w),o(d,w),Ce(x)}const Ut=""+new URL("mcp-DNm9doVd.svg",import.meta.url).href,us="data:image/svg+xml,%3csvg%20width='200'%20height='200'%20viewBox='0%200%20100%20100'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cline%20x1='50'%20y1='20'%20x2='50'%20y2='35'%20stroke='black'%20stroke-width='4'%20stroke-linecap='round'/%3e%3ccircle%20cx='50'%20cy='15'%20r='5'%20stroke='black'%20stroke-width='4'%20fill='none'/%3e%3crect%20x='15'%20y='35'%20width='70'%20height='50'%20rx='8'%20stroke='black'%20stroke-width='4'%20fill='none'/%3e%3crect%20x='5'%20y='48'%20width='10'%20height='24'%20rx='2'%20stroke='black'%20stroke-width='4'%20fill='none'/%3e%3crect%20x='85'%20y='48'%20width='10'%20height='24'%20rx='2'%20stroke='black'%20stroke-width='4'%20fill='none'/%3e%3ccircle%20cx='35'%20cy='60'%20r='4'%20stroke='black'%20stroke-width='4'%20fill='none'/%3e%3ccircle%20cx='65'%20cy='60'%20r='4'%20stroke='black'%20stroke-width='4'%20fill='none'/%3e%3c/svg%3e",hs=""+new URL("hf-logo-8sK58_pS.svg",import.meta.url).href;var ms=b(''),gs=b(`
`),fs=b('

 

',1),ys=b('
'),bs=b(''),ws=b('
'),xs=b('

'),$s=b('
'),Cs=b('

Takes no input parameters

'),Is=b('
'),ks=b('
'),js=b('
 
'),Ps=b('
 
'),Ts=b(`

The upload_files_to_gradio tool uploads files from your + local UPLOAD_DIRECTORY (or any of its subdirectories) to + the Gradio app. This is needed because MCP servers require files to be + provided as URLs. You can omit this tool if you prefer to upload files + manually. This tool requires uv to be installed.

`),Ss=b(`
Transport:
), Resources (), and Prompts ()

 

Streamable HTTP Transport: To add this MCP to clients that + support Streamable HTTP, simply add the following configuration to your MCP + config.

 

STDIO Transport: For clients that only support stdio (e.g. + Claude Desktop), first install Node.js. Then, you can use the following command:

 

 

Read more about MCP in the Gradio docs

`,1),Ns=b(`This Gradio app can also serve as an MCP server, with an MCP tool + corresponding to each API endpoint. To enable this, launch this Gradio app + with .launch(mcp_server=True) or set the GRADIO_MCP_SERVER env variable to "True".`,1);function Ms(d,s){$e(s,!1);const i=B(),c=B(),v=B();let _=m(s,"mcp_server_active",12),H=m(s,"mcp_server_url_streamable",12),O=m(s,"root",12),Z=m(s,"tools",12),A=m(s,"all_tools",28,()=>[]),x=m(s,"selected_tools",28,()=>new Set),w=m(s,"mcp_json_stdio",12),E=m(s,"file_data_present",12),ce=m(s,"mcp_docs",12),K=m(s,"analytics",12),S=m(s,"config_snippets",12),h=B("streamable_http"),l=B(!0);const P=[["streamable_http","Streamable HTTP"],["stdio","STDIO"]],U={tool:Et,resource:Ht,prompt:Zt};function T(j,z){if(!j)return null;const Q=JSON.parse(JSON.stringify(j));if(z&&E()){const y={command:"uvx",args:["--from","gradio[mcp]","gradio","upload-mcp",O(),""]};Q.mcpServers.upload_files_to_gradio=y}else delete Q.mcpServers?.upload_files_to_gradio;return Q}ve(()=>p(H()),()=>{N(i,H())}),ve(()=>(p(w()),p(H()),e(l)),()=>{N(c,T(w()?{mcpServers:{gradio:{url:H()}}}:null,e(l)))}),ve(()=>(p(w()),e(l)),()=>{N(v,T(w(),e(l)))}),ve(()=>(e(c),e(v)),()=>{S({streamable_http:JSON.stringify(e(c),null,2),stdio:JSON.stringify(e(v),null,2)})}),_t();var F={get mcp_server_active(){return _()},set mcp_server_active(j){_(j),g()},get mcp_server_url_streamable(){return H()},set mcp_server_url_streamable(j){H(j),g()},get root(){return O()},set root(j){O(j),g()},get tools(){return Z()},set tools(j){Z(j),g()},get all_tools(){return A()},set all_tools(j){A(j),g()},get selected_tools(){return x()},set selected_tools(j){x(j),g()},get mcp_json_stdio(){return w()},set mcp_json_stdio(j){w(j),g()},get file_data_present(){return E()},set file_data_present(j){E(j),g()},get mcp_docs(){return ce()},set mcp_docs(j){ce(j),g()},get analytics(){return K()},set analytics(j){K(j),g()},get config_snippets(){return S()},set config_snippets(j){S(j),g()}};st();var C=Ge(),f=re(C);{var L=j=>{var z=Ss(),Q=re(z),y=a(Q),Y=n(a(y),2);lt(Y,1,()=>P,ct,(se,D)=>{var pe=At(()=>qt(e(D),2));let ge=()=>e(pe)[0],Se=()=>e(pe)[1];var ye=ms(),Ne=a(ye,!0);t(ye),R(()=>{ke(ye,1,`snippet ${e(h)===ge()?"current-lang":"inactive-lang"}`,"svelte-1uo4thf"),V(Ne,Se())}),Te("click",ye,()=>N(h,ge())),o(se,ye)}),t(y),t(Q);var oe=n(Q,2);{var ee=se=>{var D=fs(),pe=re(D);Le(pe,{children:(ge,Se)=>{var ye=gs(),Ne=n(a(ye),2),Ze=a(Ne);zt(Ze);var Je=n(Ze,2);ze(Je,{get code(){return e(i)}}),t(Ne),t(ye),R(()=>Kt(Ze,e(i))),o(ge,ye)},$$slots:{default:!0}}),we(2),o(se,D)};G(oe,se=>{e(h)!=="stdio"&&se(ee)})}var I=n(oe,2),$=a(I),X=a($),ne=n(X),ae=a(ne);Et(ae,{}),t(ne);var te=n(ne,2),q=a(te);Ht(q,{}),t(te);var W=n(te,2),ie=a(W);Zt(ie,{}),t(W),we(),t($);var _e=n($,2);{var fe=se=>{var D=ys(),pe=a(D),ge=n(pe,2);t(D),Te("click",pe,()=>{x(new Set(A().map(Se=>Se.name)))}),Te("click",ge,()=>{x(new Set)}),o(se,D)};G(_e,se=>{p(A()),k(()=>A().length>0)&&se(fe)})}t(I);var le=n(I,2);lt(le,5,()=>(p(A()),p(Z()),k(()=>A().length>0?A():Z())),ct,(se,D,pe)=>{const ge=Ae(()=>(p(K()),e(D),k(()=>K()[e(D).meta.endpoint_name]?.success_rate||0)));var Se=ks(),ye=a(Se),Ne=a(ye);{var Ze=be=>{var he=bs();zt(he),R(He=>{Xt(he,He),he.disabled=e(h)!=="streamable_http",Pt(he,e(h)!=="streamable_http"?"opacity: 0.5; cursor: not-allowed;":"")},[()=>(p(x()),e(D),e(h),k(()=>x().has(e(D).name)||e(h)!=="streamable_http"))]),Te("change",he,He=>{He.currentTarget.checked?x().add(e(D).name):x().delete(e(D).name),x(x())}),o(be,he)};G(Ne,be=>{p(A()),k(()=>A().length>0)&&be(Ze)})}var Je=n(Ne,2),dt=a(Je),pt=a(dt),gt=a(pt);{var $t=be=>{const he=Ae(()=>(e(D),k(()=>U[e(D).meta.mcp_type])));e(he)(be,{})};G(gt,be=>{e(D),k(()=>U[e(D).meta.mcp_type])&&be($t)})}t(pt);var nt=n(pt,2),bt=a(nt,!0);t(nt);var Re=n(nt,2),me=a(Re,!0);t(Re);var Be=n(Re,2);{var Ve=be=>{const he=Ae(()=>(p(K()),e(D),k(()=>K()[e(D).meta.endpoint_name]))),He=Ae(()=>(p(e(he)),k(()=>e(he).process_time_percentiles["50th"])));var ft=ws(),wt=a(ft),it=a(wt);t(wt),t(ft),R((Ie,Pe)=>V(it,`${p(e(he)),k(()=>e(he).total_requests)??""} requests (${Ie??""}% successful, p50: ${Pe??""})`),[()=>(p(e(ge)),k(()=>Math.round(e(ge)*100))),()=>(p(ot),p(e(He)),k(()=>ot(e(He))))]),o(be,ft)};G(Be,be=>{p(K()),e(D),k(()=>K()[e(D).meta.endpoint_name])&&be(Ve)})}t(dt);var Qe=n(dt,2),et=a(Qe,!0);t(Qe),t(Je),t(ye);var je=n(ye,2);{var Ye=be=>{var he=Is(),He=a(he);{var ft=it=>{var Ie=$s();lt(Ie,5,()=>(e(D),k(()=>Object.entries(e(D).parameters))),ct,(Pe,Xe)=>{var vt=At(()=>qt(e(Xe),2));let tt=()=>e(vt)[0],Me=()=>e(vt)[1];var Ke=xs(),at=a(Ke),yt=a(at,!0);t(at);var Oe=n(at,2),Ue=a(Oe);t(Oe);var Fe=n(Oe,2),xt=a(Fe,!0);t(Fe),t(Ke),R(Ct=>{V(yt,tt()),V(Ue,`(${Me(),k(()=>Me().type)??""}${Ct??""})`),V(xt,(Me(),k(()=>Me().description?Me().description:"⚠︎ No description for this parameter in function docstring")))},[()=>(Me(),k(()=>Me().default!==void 0?`, default: ${JSON.stringify(Me().default)}`:""))]),o(Pe,Ke)}),t(Ie),o(it,Ie)},wt=it=>{var Ie=Cs();o(it,Ie)};G(He,it=>{e(D),k(()=>Object.keys(e(D).parameters).length>0)?it(ft):it(wt,!1)})}t(he),o(be,he)};G(je,be=>{e(D),k(()=>e(D).expanded)&&be(Ye)})}t(Se),R(()=>{V(bt,(e(D),k(()=>e(D).name))),V(me,(e(D),k(()=>e(D).description?e(D).description:"⚠︎ No description provided in function docstring"))),V(et,(e(D),k(()=>e(D).expanded?"▼":"▶")))}),Te("click",Je,()=>(e(D).expanded=!e(D).expanded,ea(()=>(A(),Z())))),o(se,Se)}),t(le);var ue=n(le,4);let qe;var We=n(a(ue),4);Le(We,{children:(se,D)=>{var pe=js(),ge=a(pe),Se=a(ge);ze(Se,{get code(){return p(S()),k(()=>S().streamable_http)}}),t(ge);var ye=n(ge,2),Ne=a(ye),Ze=a(Ne,!0);t(Ne),t(ye),t(pe),R(()=>V(Ze,(p(S()),k(()=>S().streamable_http)))),o(se,pe)},$$slots:{default:!0}}),t(ue);var De=n(ue,2);let rt;var mt=n(a(De),6);Le(mt,{children:(se,D)=>{var pe=Ps(),ge=a(pe),Se=a(ge);ze(Se,{get code(){return p(S()),k(()=>S().stdio)}}),t(ge);var ye=n(ge,2),Ne=a(ye),Ze=a(Ne,!0);t(Ne),t(ye),t(pe),R(()=>V(Ze,(p(S()),k(()=>S().stdio)))),o(se,pe)},$$slots:{default:!0}}),t(De);var M=n(De,2);{var r=se=>{var D=Ts(),pe=a(D),ge=a(pe);zt(ge),we(),t(pe),we(2),t(D),sa(ge,()=>e(l),Se=>N(l,Se)),o(se,D)};G(M,se=>{E()&&se(r)})}var u=n(M,4),J=a(u);t(u),R(()=>{V(X,`${p(A()),p(Z()),k(()=>A().length>0?A().length:Z().length)??""} Available MCP Tools + (`),qe=ke(ue,1,"svelte-1uo4thf",null,qe,{hidden:e(h)!=="streamable_http"}),rt=ke(De,1,"svelte-1uo4thf",null,rt,{hidden:e(h)!=="stdio"}),Ee(J,"href",ce())}),o(j,z)},de=j=>{var z=Ns();we(6),o(j,z)};G(f,j=>{_()?j(L):j(de,!1)})}return o(d,C),Ce(F)}var zs=ht('');function As(d,s){$e(s,!1);let i=m(s,"classNames",12,"");var c={get classNames(){return i()},set classNames(_){i(_),g()}},v=zs();return R(()=>ke(v,0,St(i()||"menu-icon-arrow"),"svelte-1s9m4x9")),o(d,v),Ce(c)}var qs=ht('');function Ds(d,s){$e(s,!1);let i=m(s,"classNames",12,"");var c={get classNames(){return i()},set classNames(_){i(_),g()}},v=qs();return R(()=>ke(v,0,St(i()),"svelte-1u0oj9c")),o(d,v),Ce(c)}var Rs=ht('HuggingChat');function Os(d,s){$e(s,!1);let i=m(s,"classNames",12,"");var c={get classNames(){return i()},set classNames(_){i(_),g()}},v=Rs();return R(()=>ke(v,0,St(i()||"icon-size"),"svelte-pw1cre")),o(d,v),Ce(c)}var Ls=b(' ',1),Gs=b('
');function Es(d,s){$e(s,!1);let i=m(s,"current_language",12),c=m(s,"space_id",12),v=m(s,"root",12),_=m(s,"api_count",12),H=m(s,"tools",12),O=m(s,"py_docs",12),Z=m(s,"js_docs",12),A=m(s,"bash_docs",12),x=m(s,"mcp_docs",12),w=m(s,"spaces_docs_suffix",12),E=m(s,"mcp_server_active",12),ce=m(s,"mcp_server_url_streamable",12),K=m(s,"config_snippets",12),S=m(s,"markdown_code_snippets",12),h=m(s,"dependencies",12),l=m(s,"info",12),P=m(s,"js_info",12),U=B({python:"",javascript:"",bash:"",mcp:""}),T=B(i()==="python"?"Python":i()==="javascript"?"JavaScript":i()==="bash"?"Bash":i()==="cli"?"CLI":"MCP"),F=B(`Copy ${e(T)} Docs as Markdown for LLMs`),C=B(!1),f=B(!1),L=B(null),de=B(null),j=B("");const z=typeof window<"u";function Q(){N(f,!0),z&&e(L)&&Vt().then(()=>{if(!e(L))return;const r=e(L).getBoundingClientRect(),u=6,J=Math.max(r.width+80,220),se=Math.max(window.innerWidth-r.right,u);N(j,`top:${r.bottom+u}px;right:${se}px;min-width:${J}px;`)})}function y(){N(f,!1)}function Y(){e(f)?y():Q()}function oe(){return`https://huggingface.co/chat/?prompt=${encodeURIComponent(`-------------------------------- +${e(U)[i()]} +-------------------------------- + +Read the documentation above so I can ask questions about it.`)}`}function ee(){z&&window.open(oe(),"_blank","noopener,noreferrer"),y()}function I(r){if(!e(f)||!z)return;const u=r.target;e(de)?.contains(u)||e(L)?.contains(u)||y()}function $(r){r.key==="Escape"&&e(f)&&y()}function X(){e(f)&&y()}function ne(){e(f)&&y()}async function ae(r){try{if(!e(U)[r]){console.warn("Nothing to copy");return}if(typeof navigator<"u"&&!!navigator.clipboard&&typeof navigator.clipboard.writeText=="function")await navigator.clipboard.writeText(e(U)[r]);else{console.warn("Clipboard API unavailable");return}N(C,!0),setTimeout(()=>{N(C,!1)},1500)}catch(u){console.error("Failed to write to clipboard",u)}}ve(()=>(p(c()),p(v()),p(_()),p(O()),p(w()),p(h()),p(l()),p(S()),p(P())),()=>{jt(U,e(U).python=` +# Python API documentation for ${c()||v()} +API Endpoints: ${_()} + +1. Install the Python client [docs](${O()}) if you don't already have it installed. + +\`\`\`bash +pip install gradio_client +\`\`\` + +2. Find the API endpoint below corresponding to your desired function in the app. Copy the code snippet, replacing the placeholder values with your own input data. ${c()?"If this is a private Space, you may need to pass your Hugging Face token as well. [Read more]("+O()+w()+").":""} + +${h().filter(r=>r.api_visibility==="public"&&l().named_endpoints["/"+r.api_name]).map(r=>`### API Name: /${r.api_name} +${l()?.named_endpoints["/"+r.api_name]?.description?"Description: "+l()?.named_endpoints["/"+r.api_name]?.description:""} + +\`\`\`python +${S()[r.api_name]?.python} +\`\`\` + +Accepts ${l()?.named_endpoints["/"+r.api_name]?.parameters?.length} parameter${l()?.named_endpoints["/"+r.api_name]?.parameters?.length!=1?"s":""}: + +${l()?.named_endpoints["/"+r.api_name]?.parameters?.map(u=>{const se=!u.parameter_has_default?"Required":`Default: ${ut(u.parameter_default,u.python_type.type,"py")}`,D=`${u.python_type.type}${u.parameter_has_default&&u.parameter_default===null?" | None":""}`;return`${u.parameter_name||`[${P().named_endpoints["/"+r.api_name]?.parameters.findIndex(pe=>pe.parameter_name===pe.parameter_name)}]`}: +- Type: ${D} +- ${se} +- The input value that is provided in the ${u.label} ${u.component} component. ${u.python_type.description}`}).join(` + +`)} + +Returns ${l()?.named_endpoints["/"+r.api_name]?.returns?.length>1?`tuple of ${l()?.named_endpoints["/"+r.api_name]?.returns?.length} elements`:"1 element"}: + +${l()?.named_endpoints["/"+r.api_name]?.returns?.map((u,J)=>{const se=u.python_type.type;return`${l()?.named_endpoints["/"+r.api_name]?.returns?.length>1?`[${J}]: `:""}- Type: ${se} +- The output value that appears in the "${u.label}" ${u.component} component.`}).join(` + +`)} +`).join(` + + +`)} +`)}),ve(()=>(p(c()),p(v()),p(_()),p(Z()),p(w()),p(h()),p(l()),p(S()),p(P())),()=>{jt(U,e(U).javascript=` +# JavaScript API documentation for ${c()||v()} +API Endpoints: ${_()} + +1. Install the JavaScript client [docs](${Z()}) if you don't already have it installed. + +\`\`\`bash +npm i -D @gradio/client +\`\`\` + +2. Find the API endpoint below corresponding to your desired function in the app. Copy the code snippet, replacing the placeholder values with your own input data. ${c()?"If this is a private Space, you may need to pass your Hugging Face token as well. [Read more]("+Z()+w()+").":""} + +${h().filter(r=>r.api_visibility==="public"&&l().named_endpoints["/"+r.api_name]).map(r=>`### API Name: /${r.api_name} +${l()?.named_endpoints["/"+r.api_name]?.description?"Description: "+l()?.named_endpoints["/"+r.api_name]?.description:""} + +\`\`\`javascript +${S()[r.api_name]?.javascript} +\`\`\` + +Accepts ${l()?.named_endpoints["/"+r.api_name]?.parameters?.length} parameter${l()?.named_endpoints["/"+r.api_name]?.parameters?.length!=1?"s":""}: + +${l()?.named_endpoints["/"+r.api_name]?.parameters?.map(u=>{const se=!u.parameter_has_default?"Required":`Default: ${ut(u.parameter_default,u.python_type.type,"py")}`,D=`${P().named_endpoints["/"+r.api_name]?.parameters.find(pe=>pe.parameter_name===u.parameter_name)?.type||"any"}`;return`${u.parameter_name||`[${P().named_endpoints["/"+r.api_name]?.parameters.findIndex(pe=>pe.parameter_name===u.parameter_name)}]`}: +- Type: ${D} +- ${se} +- The input value that is provided in the ${u.label} ${u.component} component. ${u.python_type.description}`}).join(` + +`)} + +Returns ${l()?.named_endpoints["/"+r.api_name]?.returns?.length>1?`list of ${l()?.named_endpoints["/"+r.api_name]?.returns?.length} elements`:"1 element"}: + +${l()?.named_endpoints["/"+r.api_name]?.returns?.map((u,J)=>{const se=P().named_endpoints["/"+r.api_name]?.returns[J]?.type;return`${l()?.named_endpoints["/"+r.api_name]?.returns?.length>1?`[${J}]: `:""}- Type: ${se} +- The output value that appears in the "${u.label}" ${u.component} component.`}).join(` + +`)}`).join(` + + +`)} +`)}),ve(()=>(p(c()),p(v()),p(_()),p(A()),p(h()),p(l()),p(S())),()=>{jt(U,e(U).bash=` +# Bash API documentation for ${c()||v()} +API Endpoints: ${_()} + +1. Confirm that you have cURL installed on your system. + +\`\`\`bash +curl --version +\`\`\` + +2. Find the API endpoint below corresponding to your desired function in the app. Copy the code snippet, replacing the placeholder values with your own input data. + +Making a prediction and getting a result requires 2 requests: a POST and a GET request. The POST request returns an EVENT_ID, which is used in the second GET request to fetch the results. In these snippets, we've used awk and read to parse the results, combining these two requests into one command for ease of use. + +If your endpoint accepts files, you must first upload them via a POST to \`/upload\`, then reference the returned path with the meta key: \`{"path": "...", "meta": {"_type": "gradio.FileData"}}\`. See [curl docs](${A()}). + +${h().filter(r=>r.api_visibility==="public"&&l().named_endpoints["/"+r.api_name]).map(r=>`### API Name: /${r.api_name} +${l()?.named_endpoints["/"+r.api_name]?.description?"Description: "+l()?.named_endpoints["/"+r.api_name]?.description:""} + +\`\`\`bash +${S()[r.api_name]?.bash} +\`\`\` + +Accepts a JSON object with ${l()?.named_endpoints["/"+r.api_name]?.parameters?.length} key${l()?.named_endpoints["/"+r.api_name]?.parameters?.length!=1?"s":""}: + +${l()?.named_endpoints["/"+r.api_name]?.parameters?.map(u=>{const J="Required",se=`${u.python_type.type}`;return`${u.parameter_name}: +- Type: ${se} +- ${J} +- The input value that is provided in the ${u.label} ${u.component} component. ${u.python_type.description}`}).join(` + +`)} + +Returns ${l()?.named_endpoints["/"+r.api_name]?.returns?.length>1?`an array of ${l()?.named_endpoints["/"+r.api_name]?.returns?.length} elements`:"an array of 1 element"}: + +${l()?.named_endpoints["/"+r.api_name]?.returns?.map((u,J)=>{const se=u.python_type.type;return`${l()?.named_endpoints["/"+r.api_name]?.returns?.length>1?`[${J}]: `:""}- Type: ${se} +- The output value that appears in the "${u.label}" ${u.component} component.`}).join(` + +`)} +`).join(` + + +`)} +`)}),ve(()=>(p(c()),p(v()),p(H()),p(E()),p(ce()),p(K()),p(x())),()=>{jt(U,e(U).mcp=` +# MCP documentation for ${c()||v()} +MCP Tools: ${H().length} + +${E()?` + +This page documents two transports: Streamable HTTP and STDIO. + +### Streamable HTTP + +MCP Server URL (Streamable HTTP): ${ce()} + +${H().length} available MCP tools, resources, and prompts: + +${H().map(r=>`### ${r.name} +Type: ${r.meta.mcp_type} +Description: ${r.description?r.description:"No description provided in function docstring"} +Parameters: ${Object.keys(r.parameters).length} +${Object.keys(r.parameters).map(u=>`- ${u} (${r.parameters[u].type}): ${r.parameters[u].description?r.parameters[u].description:"No description provided in function docstring"}`).join(` +`)} +`).join(` + +`)} + +Streamable HTTP Transport: To add this MCP to clients that support Streamable HTTP, simply add the following configuration to your MCP config. + +\`\`\`json +${K().streamable_http} +\`\`\` + +The \`upload_files_to_gradio\` tool uploads files from your local \`UPLOAD_DIRECTORY\` (or any of its subdirectories) to the Gradio app. +This is needed because MCP servers require files to be provided as URLs. You can omit this tool if you prefer to upload files manually. This tool requires [uv](https://docs.astral.sh/uv/getting-started/installation/) to be installed. + +### STDIO Transport + + +${H().length} available MCP tools, resources, and prompts: + +${H().map(r=>`### ${r.name} +Type: ${r.meta.mcp_type} +Description: ${r.description?r.description:"No description provided in function docstring"} +Parameters: ${Object.keys(r.parameters).length} +${Object.keys(r.parameters).map(u=>`- ${u} (${r.parameters[u].type}): ${r.parameters[u].description?r.parameters[u].description:"No description provided in function docstring"}`).join(` +`)} +`).join(` + +`)} + +STDIO Transport: For clients that only support stdio (e.g. Claude Desktop), first [install Node.js](https://nodejs.org/en/download/). Then, you can use the following command: + +\`\`\`json +${K().stdio} +\`\`\` + +The \`upload_files_to_gradio\` tool uploads files from your local \`UPLOAD_DIRECTORY\` (or any of its subdirectories) to the Gradio app. +This is needed because MCP servers require files to be provided as URLs. You can omit this tool if you prefer to upload files manually. This tool requires [uv](https://docs.astral.sh/uv/getting-started/installation/) to be installed. + +Read more about the MCP in the [Gradio docs](${x()}). +`:'This Gradio app can also serve as an MCP server, with an MCP tool corresponding to each API endpoint. \nTo enable this, launch this Gradio app with `.launch(mcp_server=True)` or set the `.launch(mcp_server=True)`or set the `GRADIO_MCP_SERVER` env variable to `"True"`.'} + +`)}),ve(()=>p(i()),()=>{i()}),ve(()=>p(i()),()=>{N(T,i()==="python"?"Python":i()==="javascript"?"JavaScript":i()==="bash"?"Bash":i()==="cli"?"CLI":"MCP")}),ve(()=>e(T),()=>{N(F,`Copy ${e(T)} Docs as Markdown for LLMs`)}),ve(()=>e(C),()=>{e(C)}),_t();var te={get current_language(){return i()},set current_language(r){i(r),g()},get space_id(){return c()},set space_id(r){c(r),g()},get root(){return v()},set root(r){v(r),g()},get api_count(){return _()},set api_count(r){_(r),g()},get tools(){return H()},set tools(r){H(r),g()},get py_docs(){return O()},set py_docs(r){O(r),g()},get js_docs(){return Z()},set js_docs(r){Z(r),g()},get bash_docs(){return A()},set bash_docs(r){A(r),g()},get mcp_docs(){return x()},set mcp_docs(r){x(r),g()},get spaces_docs_suffix(){return w()},set spaces_docs_suffix(r){w(r),g()},get mcp_server_active(){return E()},set mcp_server_active(r){E(r),g()},get mcp_server_url_streamable(){return ce()},set mcp_server_url_streamable(r){ce(r),g()},get config_snippets(){return K()},set config_snippets(r){K(r),g()},get markdown_code_snippets(){return S()},set markdown_code_snippets(r){S(r),g()},get dependencies(){return h()},set dependencies(r){h(r),g()},get info(){return l()},set info(r){l(r),g()},get js_info(){return P()},set js_info(r){P(r),g()}};st();var q=Gs();Te("mousedown",Nt,I),Te("keydown",Nt,$),Te("resize",Nt,X),Te("scroll",Nt,ne);var W=a(q),ie=a(W),_e=a(ie),fe=a(_e);{var le=r=>{Jt(r,{})},ue=r=>{Ot(r,{})};G(fe,r=>{e(C)?r(le):r(ue,!1)})}t(_e);var qe=n(_e,2),We=a(qe,!0);t(qe),t(ie);var De=n(ie,2),rt=a(De);{let r=Ae(()=>`caret-icon ${e(f)?"rotate-180":"rotate-0"}`);Ds(rt,{get classNames(){return e(r)}})}t(De),t(W),Tt(W,r=>N(L,r),()=>e(L));var mt=n(W,2);{var M=r=>{var u=Ls(),J=re(u),se=n(J,2),D=a(se),pe=a(D),ge=a(pe);Ot(ge,{classNames:"menu-icon"}),t(pe);var Se=n(pe,2),ye=n(a(Se),2),Ne=a(ye,!0);t(ye),t(Se),t(D);var Ze=n(D,2),Je=a(Ze),dt=a(Je);Os(dt,{classNames:"menu-icon"}),t(Je);var pt=n(Je,2),gt=a(pt),$t=n(a(gt));As($t,{classNames:"menu-icon-arrow"}),t(gt);var nt=n(gt,2),bt=a(nt);t(nt),t(pt),t(Ze),t(se),Tt(se,Re=>N(de,Re),()=>e(de)),R(()=>{Pt(se,e(j)),V(Ne,e(F)),V(bt,`Ask Questions About The ${e(T)??""} Docs`)}),Te("click",J,y),Te("click",D,()=>{ae(i()),y()}),Te("click",Ze,()=>{ee(),y()}),o(r,u)};G(mt,r=>{e(f)&&r(M)})}return t(q),R(()=>{V(We,e(C)?`Copied ${e(T)} Docs!`:"Copy Page"),Ee(De,"aria-expanded",e(f)),Ee(De,"aria-label",e(f)?"Close copy menu":"Open copy menu")}),Te("click",ie,()=>ae(i())),Te("click",De,Y),o(d,q),Ce(te)}var Zs=b('
  • '),Hs=b(`

    🪄 Recorded API Calls

    Note: Some API calls only affect the UI, so when using the + clients, the desired result may be achieved with only a subset of + the recorded calls.

    API Documentation

    `,1),Us=b(`1. Install the client (docs) if you don't already have it installed.`,1),Bs=b('

    '),Vs=b('
  • Gradio Gradio CLI
  • HF HF CLI
  • '),Fs=b(`If this is a private Space, you may need to pass + your Hugging Face token as well (read more).`,1),Ys=b('

    API Recorder

    ',1),Ws=b(`
     
    Making a + prediction and getting a result requires 2 requests: a POST and a GET request. The POST request + returns an EVENT_ID, which is used in the second GET request to fetch the results. In these + snippets, we've used awk and read to + parse the results, combining these two requests into one command + for ease of use.
     
    If your endpoint accepts files, you must first upload them via a POST to /upload, then reference the + returned path with the meta key: . See curl docs.`,1),Js=b(`

    2. Find the API endpoint below corresponding to your desired + function in the app. Copy the code snippet, replacing the + placeholder values with your own input data. Or use the to automatically generate your API requests.

    `,1),Qs=b("
    ",1),Xs=b('
    '),Ks=b('

    Choose one of the following ways to interact with the API.

    ',1);function Cr(d,s){$e(s,!1);const i=B(),c=B(),v=B(),_=B(),H=B(),O=B(),Z=B();let A=m(s,"dependencies",12),x=m(s,"root",12),w=m(s,"app",12),E=m(s,"space_id",12),ce=m(s,"root_node",12),K=m(s,"username",12),S=m(s,"last_api_call",12,null);const h="https://www.gradio.app/guides/getting-started-with-the-js-client",l="https://www.gradio.app/guides/getting-started-with-the-python-client",P="https://www.gradio.app/guides/querying-gradio-apps-with-curl",U="#connecting-to-a-hugging-face-space",T="https://www.gradio.app/guides/building-mcp-server-with-gradio";let F=A().filter(M=>M.api_visibility==="public").length;x()===""&&x(location.protocol+"//"+location.host+location.pathname),x().endsWith("/")||x(x()+"/");let C=m(s,"api_calls",28,()=>[]),f=B("python"),L=B("gradio");function de(M,r){const u=new URL(window.location.href);u.searchParams.set(M,r),history.replaceState(null,"",u.toString())}function j(M){return new URL(window.location.href).searchParams.get(M)}function z(M){return["python","javascript","bash","skill","mcp","cli"].includes(M??"")}let Q=!1,y=B(!1);async function Y(){return await(await fetch(x().replace(/\/$/,"")+w().api_prefix+"/info")).json()}async function oe(){return await w().view_api()}let ee=B(),I=B(),$=B();Y().then(M=>{N(ee,M)}),oe().then(M=>{N(I,M)});async function X(){return await(await fetch(x().replace(/\/$/,"")+"/monitoring/summary")).json()}X().then(M=>{N($,M.functions)});const ne=Lt();let ae=B([]),te=[],q=B(),W=B(!1),ie=B(new Set),_e=E()?E().split("/").pop()+"_":"";function fe(M){return _e&&M.startsWith(_e)?M.slice(_e.length):M}const le={command:"uvx",args:["--from","gradio[mcp]","gradio","upload-mcp",x(),""]};async function ue(){try{let M=`${x()}gradio_api/mcp/schema`;const u=await(await fetch(M)).json();N(W,u.map(J=>J.meta?.file_data_present).some(J=>J)),N(ae,u.map(J=>({name:J.name,description:J.description||"",parameters:J.inputSchema?.properties||{},meta:J.meta,expanded:!1,endpoint_name:J.endpoint_name}))),N(ie,new Set(e(ae).map(J=>J.name))),te=u.map(J=>J.meta?.headers||[]).flat(),te.length>0?N(q,{mcpServers:{gradio:{command:"npx",args:["mcp-remote",e(O),"--transport","streamable-http",...te.map(J=>["--header",`${J}: `]).flat()]}}}):(N(q,{mcpServers:{gradio:{command:"npx",args:["mcp-remote",e(O),"--transport","streamable-http"]}}}),e(W)&&jt(q,e(q).mcpServers.upload_files_to_gradio=le))}catch(M){console.error("Failed to fetch MCP tools:",M),N(ae,[])}}let qe=B({});Bt(()=>{const M=new AbortController,r=M.signal;document.body.style.overflow="hidden","parentIFrame"in window&&window.parentIFrame?.scrollTo(0,0);const u=j("lang");z(u)&&N(f,u);const J=`${x()}gradio_api/mcp/schema`;return fetch(J,{signal:r}).then(se=>{N(y,se.ok),e(y)?(ue(),z(u)||N(f,"mcp")):z(u)||N(f,"python"),M.abort()}).catch(()=>{N(y,!1)}),()=>{document.body.style.overflow="auto"}}),ve(()=>e(L),()=>{N(i,e(L)==="hf"?"hf gradio":"gradio")}),ve(()=>(p(A()),e(ee),p(S())),()=>{N(c,(()=>{const M=A().filter(r=>r.api_visibility==="public"&&e(ee)?.named_endpoints?.["/"+r.api_name]);if(e(ee)&&S()){const r=M.find(J=>J.id===S().fn_index),u=M.filter(J=>J.id!==S().fn_index);return r?[r,...u]:M}return M})())}),ve(()=>(p(E()),Ut),()=>{N(v,[["python","Python",es],["javascript","JavaScript",ts],["cli","CLI",us],["bash","cURL",as],...E()?[["skill","Skill",ls]]:[],["mcp","MCP",Ut]])}),ve(()=>e(ie),()=>{N(_,Array.from(e(ie)))}),ve(()=>e(_),()=>{N(H,e(_).map(fe))}),ve(()=>(e(_),e(ae),p(x()),e(H)),()=>{N(O,e(_).length>0&&e(_).length(e(ee),p(A()),e(i)),()=>{N(Z,(()=>{const M={};if(!e(ee)?.named_endpoints)return M;for(const r of A()){const u=e(ee).named_endpoints["/"+r.api_name];if(!u?.code_snippets)continue;const J=u.code_snippets;M[r.api_name]={python:J.python||"",javascript:J.javascript||"",bash:J.bash||"",cli:(J.cli||"").replace("{command}",e(i))}}return M})())}),_t();var We={get dependencies(){return A()},set dependencies(M){A(M),g()},get root(){return x()},set root(M){x(M),g()},get app(){return w()},set app(M){w(M),g()},get space_id(){return E()},set space_id(M){E(M),g()},get root_node(){return ce()},set root_node(M){ce(M),g()},get username(){return K()},set username(M){K(M),g()},get last_api_call(){return S()},set last_api_call(M){S(M),g()},get api_calls(){return C()},set api_calls(M){C(M),g()}};st();var De=Ge(),rt=re(De);{var mt=M=>{var r=Ge(),u=re(r);{var J=D=>{var pe=Ks(),ge=re(pe),Se=a(ge);{let Re=Ae(()=>E()||x());pa(Se,{get root(){return e(Re)},get api_count(){return F},get current_language(){return e(f)},$$events:{close(me){Gt.call(this,s,me)}}})}t(ge);var ye=n(ge,2),Ne=a(ye),Ze=n(a(Ne),2);Es(Ze,{get current_language(){return e(f)},get space_id(){return E()},get root(){return x()},get api_count(){return F},get tools(){return e(ae)},py_docs:l,js_docs:h,bash_docs:P,mcp_docs:T,spaces_docs_suffix:U,get mcp_server_active(){return e(y)},get mcp_server_url_streamable(){return e(O)},get config_snippets(){return e(qe)},get markdown_code_snippets(){return e(Z)},get dependencies(){return A()},get info(){return e(ee)},get js_info(){return e(I)}}),t(Ne);var Je=n(Ne,2),dt=a(Je);lt(dt,5,()=>e(v),ct,(Re,me)=>{var Be=At(()=>qt(e(me),3));let Ve=()=>e(Be)[0],Qe=()=>e(Be)[1],et=()=>e(Be)[2];var je=Zs(),Ye=a(je);let be;var he=n(Ye);t(je),R(()=>{ke(je,1,`snippet + ${e(f)===Ve()?"current-lang":"inactive-lang"}`,"svelte-1ujc8oz"),Ee(Ye,"src",et()),be=ke(Ye,1,"svelte-1ujc8oz",null,be,{"agent-icon":Ve()==="cli"}),V(he,` ${Qe()??""}`)}),Te("click",je,()=>{N(f,Ve()),de("lang",Ve())}),o(Re,je)}),t(dt);var pt=n(dt,2);{var gt=Re=>{var me=Hs(),Be=re(me),Ve=a(Be),Qe=n(a(Ve)),et=a(Qe);t(Qe),t(Ve);var je=n(Ve,2),Ye=a(je);t(je);var be=n(je,2);{let he=Ae(()=>E()||x());Ka(be,{get current_language(){return e(f)},get api_calls(){return C()},get dependencies(){return A()},get root(){return x()},get api_prefix(){return p(w()),k(()=>w().api_prefix)},get short_root(){return e(he)},get username(){return K()}})}we(2),t(Be),we(2),R(()=>{V(et,`[${p(C()),k(()=>C().length)??""}]`),V(Ye,`Here is the code snippet to replay the most recently recorded API + calls using the ${e(f)??""} + client.`)}),o(Re,me)},$t=Re=>{var me=Qs(),Be=re(me);{var Ve=Ie=>{var Pe=Bs(),Xe=a(Pe);{var vt=Me=>{var Ke=Us(),at=n(re(Ke)),yt=a(at,!0);t(at);var Oe=n(at,2);we(),R(()=>{V(yt,e(f)),Ee(Oe,"href",e(f)=="python"?l:h)}),o(Me,Ke)},tt=Me=>{var Ke=Ge(),at=re(Ke);{var yt=Ue=>{var Fe=xe("1. Confirm that you have cURL installed on your system.");o(Ue,Fe)},Oe=Ue=>{var Fe=Ge(),xt=re(Fe);{var Ct=It=>{var kt=xe("1. Install the CLI if you don't already have it installed.");o(It,kt)};G(xt,It=>{e(f)=="cli"&&It(Ct)},!0)}o(Ue,Fe)};G(at,Ue=>{e(f)=="bash"?Ue(yt):Ue(Oe,!1)},!0)}o(Me,Ke)};G(Xe,Me=>{e(f)=="python"||e(f)=="javascript"?Me(vt):Me(tt,!1)})}t(Pe),o(Ie,Pe)};G(Be,Ie=>{e(f)!=="skill"&&Ie(Ve)})}var Qe=n(Be,2);{var et=Ie=>{var Pe=Vs(),Xe=a(Pe),vt=a(Xe);we(),t(Xe);var tt=n(Xe,2),Me=a(tt);we(),t(tt),t(Pe),R(()=>{ke(Xe,1,`snippet ${e(L)==="gradio"?"current-lang":"inactive-lang"}`,"svelte-1ujc8oz"),Ee(vt,"src",aa),ke(tt,1,`snippet ${e(L)==="hf"?"current-lang":"inactive-lang"}`,"svelte-1ujc8oz"),Ee(Me,"src",hs)}),Te("click",Xe,()=>{N(L,"gradio")}),Te("click",tt,()=>{N(L,"hf")}),o(Ie,Pe)};G(Qe,Ie=>{e(f)==="cli"&&Ie(et)})}var je=n(Qe,2);let Ye;var be=a(je);_s(be,{get space_id(){return E()}}),t(je);var he=n(je,2);let He;var ft=a(he);{let Ie=Ae(()=>(e(ae),e(ie),k(()=>e(ae).filter(Pe=>e(ie).has(Pe.name)))));Ms(ft,{get mcp_server_active(){return e(y)},get mcp_server_url_streamable(){return e(O)},get tools(){return e(Ie)},get all_tools(){return e(ae)},get mcp_json_stdio(){return e(q)},get file_data_present(){return e(W)},mcp_docs:T,get analytics(){return e($)},get root(){return x()},get selected_tools(){return e(ie)},set selected_tools(Pe){N(ie,Pe)},get config_snippets(){return e(qe)},set config_snippets(Pe){N(qe,Pe)},$$legacy:!0})}t(he);var wt=n(he,2);{var it=Ie=>{var Pe=Js(),Xe=re(Pe);za(Xe,{get current_language(){return e(f)},get cli_flavor(){return e(L)}});var vt=n(Xe,2),tt=n(a(vt));{var Me=Oe=>{var Ue=Fs(),Fe=n(re(Ue));we(),R(()=>Ee(Fe,"href",e(f)=="python"?l+U:e(f)=="javascript"?h+U:P)),o(Oe,Ue)};G(tt,Oe=>{E()&&Oe(Me)})}var Ke=n(tt,2);Yt(Ke,{size:"sm",variant:"secondary",$$events:{click:()=>ne("close",{api_recorder_visible:!0})},children:(Oe,Ue)=>{var Fe=Ys();we(2),o(Oe,Fe)},$$slots:{default:!0}});var at=n(Ke,2);{var yt=Oe=>{var Ue=Ws(),Fe=n(re(Ue),30);Fe.textContent='{"path": "...", "meta": {"_type": "gradio.FileData"}}';var xt=n(Fe,2);{var Ct=kt=>{var Qt=xe(`Note: connecting to an authenticated app requires an + additional request.`);o(kt,Qt)};G(xt,kt=>{K()!==null&&kt(Ct)})}var It=n(xt,2);Ee(It,"href",P),we(),o(Oe,Ue)};G(at,Oe=>{e(f)=="bash"&&Oe(yt)})}t(vt),o(Ie,Pe)};G(wt,Ie=>{e(f)!=="mcp"&&e(f)!=="skill"&&Ie(it)})}R(()=>{Ye=ke(je,1,"svelte-1ujc8oz",null,Ye,{hidden:e(f)!=="skill"}),He=ke(he,1,"svelte-1ujc8oz",null,He,{hidden:e(f)!=="mcp"})}),o(Re,me)};G(pt,Re=>{p(C()),k(()=>C().length)?Re(gt):Re($t,!1)})}var nt=n(pt,2);let bt;lt(nt,5,()=>e(c),ct,(Re,me)=>{var Be=Ge(),Ve=re(Be);{var Qe=et=>{var je=Xs(),Ye=a(je);Ba(Ye,{get dependency(){return e(me)},get current_language(){return e(f)},get api_description(){return e(ee),e(me),k(()=>e(ee).named_endpoints["/"+e(me).api_name].description)},get analytics(){return e($)},get last_api_call(){return S()},get code_snippets(){return e(ee),e(me),k(()=>e(ee).named_endpoints["/"+e(me).api_name].code_snippets)},get cli_command(){return e(i)}});var be=n(Ye,2);{let He=Ae(()=>e(f)==="cli"?"python":e(f));wa(be,{get endpoint_returns(){return e(ee),e(me),k(()=>e(ee).named_endpoints["/"+e(me).api_name].parameters)},get js_returns(){return e(I),e(me),k(()=>e(I).named_endpoints["/"+e(me).api_name].parameters)},is_running:Q,get current_language(){return e(He)}})}var he=n(be,2);{let He=Ae(()=>e(f)==="cli"?"python":e(f));os(he,{get endpoint_returns(){return e(ee),e(me),k(()=>e(ee).named_endpoints["/"+e(me).api_name].returns)},get js_returns(){return e(I),e(me),k(()=>e(I).named_endpoints["/"+e(me).api_name].returns)},is_running:Q,get current_language(){return e(He)}})}t(je),o(et,je)};G(Ve,et=>{e(ee),e(me),k(()=>e(ee).named_endpoints["/"+e(me).api_name])&&et(Qe)})}o(Re,Be)}),t(nt),t(Je),t(ye),R(()=>bt=ke(nt,1,"svelte-1ujc8oz",null,bt,{hidden:e(f)==="mcp"||e(f)==="skill"})),o(D,pe)},se=D=>{la(D,{get root(){return x()},$$events:{close(pe){Gt.call(this,s,pe)}}})};G(u,D=>{F?D(J):D(se,!1)})}o(M,r)};G(rt,M=>{e(ee)&&e($)&&M(mt)})}return o(d,De),Ce(We)}export{Cr as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ApiDocs-y7Md9q8F.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ApiDocs-y7Md9q8F.css new file mode 100644 index 0000000000000000000000000000000000000000..89ec0a4c15589e88c79b1fb3591fa1b439deabd4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ApiDocs-y7Md9q8F.css @@ -0,0 +1 @@ +.wrap.svelte-1m8i4xt{padding:var(--size-6)}.attention.svelte-1m8i4xt{font-weight:var(--weight-bold);font-size:var(--text-lg)}.attention.svelte-1m8i4xt code:where(.svelte-1m8i4xt){border:none;background:none;color:var(--color-accent);font-weight:var(--weight-bold)}button.svelte-1m8i4xt{position:absolute;top:var(--size-5);right:var(--size-6);width:var(--size-4);color:var(--body-text-color)}button.svelte-1m8i4xt:hover{color:var(--color-accent)}@media(min-width:768px){button.svelte-1m8i4xt{top:var(--size-6)}}h2.svelte-uv8a36{display:flex;color:var(--body-text-color);font-weight:var(--weight-semibold);gap:var(--size-4)}h2.svelte-uv8a36 img:where(.svelte-uv8a36){margin-right:var(--size-2);width:var(--size-4);display:inline-block}.url.svelte-uv8a36{color:var(--color-accent);font-weight:400}button.svelte-uv8a36{position:absolute;top:var(--size-5);right:var(--size-6);width:var(--size-4);color:var(--body-text-color)}button.svelte-uv8a36:hover{color:var(--color-accent)}@media(min-width:768px){button.svelte-uv8a36{top:var(--size-6)}h2.svelte-uv8a36 img:where(.svelte-uv8a36){width:var(--size-5)}}.counts.svelte-uv8a36{margin-top:auto;margin-right:var(--size-8);margin-bottom:auto;margin-left:auto;color:var(--body-text-color);font-weight:var(--weight-light);display:flex;flex-direction:row;gap:.5rem}.loading-dot.svelte-uv8a36{position:relative;left:-9999px;width:12px;height:12px;border-radius:6px;background-color:#fd7b00;color:#fd7b00;box-shadow:9999px 0 0 -1px;margin-right:.3rem}.self-baseline.svelte-uv8a36{align-self:baseline}.title.svelte-uv8a36{display:flex;flex-direction:row;gap:.5rem}.btn-text.svelte-uv8a36{font-size:var(--text-lg)}.hr.svelte-1nfxyth{border:0;height:1px;background:var(--color-accent-soft);margin-bottom:12px}.code.svelte-1nfxyth{font-family:var(--font-mono);display:inline}.highlight.svelte-1nfxyth{background:var(--color-accent-soft);color:var(--color-accent);padding:var(--size-1)}.desc.svelte-1nfxyth{color:var(--body-text-color-subdued);font-size:var(--text-lg);margin-top:var(--size-1)}h4.svelte-1nfxyth{display:flex;align-items:center;margin-top:var(--size-6);margin-bottom:var(--size-3);color:var(--body-text-color);font-weight:var(--weight-bold)}.toggle-icon.svelte-1nfxyth{display:flex;align-items:center;margin-right:var(--size-2);border-radius:var(--radius-full);background:var(--color-grey-300);width:12px;height:4px}.toggle-dot.svelte-1nfxyth{border-radius:var(--radius-full);background:var(--color-grey-700);width:6px;height:6px;margin-right:auto}.icon-size.svelte-etvp4k{width:.75rem;height:.75rem}@media(max-width:640px){.icon-size.svelte-etvp4k{width:.625rem;height:.625rem}}.icon-size.svelte-5quqiz{width:.75rem;height:.75rem}@media(max-width:640px){.icon-size.svelte-5quqiz{width:.625rem;height:.625rem}}.copy-button.svelte-egghn7{display:inline-flex;align-items:center;gap:4px;height:24px;padding-left:8px;padding-right:8px;font-size:11px;font-weight:500;color:#1f2937;border:1px solid rgb(229,231,235);border-radius:6px;background-color:#fff;@media(max-width:640px){gap:2px;height:20px;padding-left:6px;padding-right:6px;font-size:9px;border-top-left-radius:4px;border-bottom-left-radius:4px}&:hover{box-shadow:inset 0 2px 4px #0000000d}@media(prefers-color-scheme:dark){border-color:#262626;background-color:#0a0a0a;color:#e5e7eb;&:hover{background-color:#262626}}}code.svelte-1ts4a2g pre:where(.svelte-1ts4a2g){overflow-x:auto;color:var(--body-text-color);font-family:var(--font-mono);tab-size:2}code.svelte-1ts4a2g{position:relative;display:block}.copy.svelte-1ts4a2g{position:absolute;top:0;right:0;margin-top:-5px;margin-right:-5px}.step.svelte-1ts4a2g{margin-top:var(--size-3);margin-bottom:var(--size-2);font-weight:var(--weight-semibold);color:var(--body-text-color)}.os-label.svelte-1ts4a2g{margin-top:var(--size-2);margin-bottom:var(--size-1);font-size:var(--text-sm);color:var(--body-text-color-subdued)}.tooltip-chart.svelte-1q3jha5{background:var(--background-fill-primary);border:1px solid var(--border-color-primary);border-radius:var(--radius-md);padding:var(--size-3);box-shadow:var(--shadow-drop-lg);min-width:200px;position:relative}.tooltip-arrow.svelte-1q3jha5{position:absolute;bottom:-8px;left:50%;transform:translate(-50%);width:0;height:0;border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid var(--border-color-primary)}.tooltip-arrow.svelte-1q3jha5:after{content:"";position:absolute;bottom:1px;left:50%;transform:translate(-50%);width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;border-top:7px solid var(--background-fill-primary)}.chart-bars.svelte-1q3jha5{display:flex;flex-direction:column;gap:var(--size-2)}.chart-bar-container.svelte-1q3jha5{display:flex;align-items:center;gap:var(--size-2)}.chart-bar-label.svelte-1q3jha5{font-size:var(--text-sm);font-weight:var(--weight-semibold);color:var(--body-text-color);min-width:30px}.chart-bar-wrapper.svelte-1q3jha5{flex:1;height:16px;background:var(--background-fill-secondary);border-radius:var(--radius-sm);overflow:hidden;position:relative}.chart-bar.svelte-1q3jha5{height:100%;background:var(--color-accent);border-radius:var(--radius-sm);transition:width .3s ease}.chart-bar-value.svelte-1q3jha5{font-size:var(--text-sm);color:var(--body-text-color);min-width:50px;text-align:right;font-family:var(--font-mono)}h3.svelte-13swnto{color:var(--body-text-color);font-weight:var(--section-header-text-weight);font-size:var(--text-lg)}.post.svelte-13swnto{margin-right:var(--size-2);border:1px solid var(--border-color-accent);border-radius:var(--radius-sm);background:var(--color-accent-soft);padding-right:var(--size-1);padding-bottom:var(--size-1);padding-left:var(--size-1);color:var(--color-accent);font-weight:var(--weight-semibold)}.analytics-inline.svelte-13swnto{display:inline-flex;align-items:center;gap:var(--size-2);margin-left:var(--size-2);color:var(--body-text-color-subdued)}.analytics-content.svelte-13swnto{position:relative;display:inline-block}.analytics-text-wrapper.svelte-13swnto{cursor:help}.analytics-tooltip.svelte-13swnto{position:absolute;bottom:100%;left:50%;transform:translate(-50%);margin-bottom:var(--size-2);opacity:0;pointer-events:none;transition:opacity .2s ease;z-index:1000}.analytics-content.svelte-13swnto:hover .analytics-tooltip:where(.svelte-13swnto){opacity:1;pointer-events:auto}.most-recently-used.svelte-13swnto{display:inline-block;color:#fd7b00;background:#fff4e6;border:1px solid #ffd9b3;border-radius:var(--radius-sm);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-weight:var(--weight-medium);white-space:nowrap}.desc.svelte-13swnto{color:var(--body-text-color);font-size:var(--text-lg);margin-left:var(--size-2)}code.svelte-1v9rhoq pre:where(.svelte-1v9rhoq){overflow-x:auto;color:var(--body-text-color);font-family:var(--font-mono);tab-size:2}code.svelte-1v9rhoq{position:relative;display:block}.copy.svelte-1v9rhoq{position:absolute;top:0;right:0;margin-top:-5px;margin-right:-5px}.container.svelte-1v9rhoq{display:flex;flex-direction:column;gap:var(--spacing-xxl);margin-top:var(--size-3);margin-bottom:var(--size-3)}.api-name{color:var(--color-accent)}.str{color:var(--color-accent-base)}.hidden.svelte-1v9rhoq{display:none}code.svelte-154to14 pre:where(.svelte-154to14){overflow-x:auto;color:var(--body-text-color);font-family:var(--font-mono);tab-size:2}.token.string.svelte-154to14{display:contents;color:var(--color-accent-base)}code.svelte-154to14{position:relative;display:block}.copy.svelte-154to14{position:absolute;top:0;right:0;margin-top:-5px;margin-right:-5px}.container.svelte-154to14{display:flex;flex-direction:column;gap:var(--spacing-xxl);margin-top:var(--size-3);margin-bottom:var(--size-3)}.api-name.svelte-154to14{color:var(--color-accent)}.hr.svelte-17pn6bc{border:0;height:1px;background:var(--color-accent-soft)}.code.svelte-17pn6bc{font-family:var(--font-mono);margin-right:10px}.highlight.svelte-17pn6bc{background:var(--color-accent-soft);color:var(--color-accent);padding:var(--size-1)}.desc.svelte-17pn6bc{color:var(--body-text-color-subdued);font-size:var(--text-lg)}h4.svelte-17pn6bc{display:flex;align-items:center;margin-top:var(--size-6);margin-bottom:var(--size-3);color:var(--body-text-color);font-weight:var(--weight-bold)}.toggle-icon.svelte-17pn6bc{display:flex;align-items:center;margin-right:var(--size-2);border-radius:var(--radius-full);background:var(--color-grey-300);width:12px;height:4px}.toggle-dot.svelte-17pn6bc{border-radius:var(--radius-full);background:var(--color-grey-700);width:6px;height:6px;margin-left:auto}.skill-content.svelte-1cyp2hi{margin-top:var(--size-2)}p.padded.svelte-1cyp2hi{padding:15px 0;font-size:var(--text-lg)}.hint.svelte-1cyp2hi{margin-top:var(--size-2);color:var(--body-text-color);opacity:.8;font-size:var(--text-md);line-height:1.6}.inline-code.svelte-1cyp2hi{display:inline;font-family:var(--font-mono);font-size:var(--text-md);background:var(--background-fill-secondary);padding:1px 4px;border-radius:var(--radius-sm)}code.svelte-1cyp2hi pre:where(.svelte-1cyp2hi){overflow-x:auto;color:var(--body-text-color);font-family:var(--font-mono);tab-size:2}code.svelte-1cyp2hi{position:relative;display:block}.copy.svelte-1cyp2hi{position:absolute;top:0;right:0;margin-top:-5px;margin-right:-5px}.tool-analytics-wrapper.svelte-1uo4thf{position:relative;display:inline-block}.tool-analytics.svelte-1uo4thf{font-size:.95em;color:var(--body-text-color-subdued)}.transport-selection.svelte-1uo4thf{margin-bottom:var(--size-4)}.snippets.svelte-1uo4thf{display:flex;align-items:center;margin-bottom:var(--size-4)}.snippets.svelte-1uo4thf>:where(.svelte-1uo4thf)+:where(.svelte-1uo4thf){margin-left:var(--size-2)}.transport-label.svelte-1uo4thf{font-weight:600;color:var(--body-text-color);margin-right:var(--size-2)}.file-upload-section.svelte-1uo4thf{margin-top:var(--size-4);padding:var(--size-3);border:1px solid var(--border-color-primary);border-radius:var(--radius-md);background:var(--background-fill-secondary)}.checkbox-label.svelte-1uo4thf{display:flex;align-items:center;font-weight:600;color:var(--body-text-color);cursor:pointer;margin-bottom:var(--size-2)}.checkbox.svelte-1uo4thf{margin-right:var(--size-2);width:var(--size-4);height:var(--size-4);cursor:pointer;accent-color:var(--color-accent)}.checkbox.svelte-1uo4thf:checked{background-color:var(--color-accent);border-color:var(--color-accent)}.file-upload-explanation.svelte-1uo4thf{margin:0;color:var(--body-text-color)}.snippet.svelte-1uo4thf{display:flex;align-items:center;border:1px solid var(--border-color-primary);border-radius:var(--radius-md);padding:var(--size-1) var(--size-1-5);color:var(--body-text-color-subdued);color:var(--body-text-color);line-height:1;user-select:none}.current-lang.svelte-1uo4thf{border:1px solid var(--body-text-color-subdued);color:var(--body-text-color)}.inactive-lang.svelte-1uo4thf{cursor:pointer;color:var(--body-text-color-subdued)}.inactive-lang.svelte-1uo4thf:hover,.inactive-lang.svelte-1uo4thf:focus{box-shadow:var(--shadow-drop);color:var(--body-text-color)}code.svelte-1uo4thf pre:where(.svelte-1uo4thf){overflow-x:auto;color:var(--body-text-color);font-family:var(--font-mono);tab-size:2}.copy.svelte-1uo4thf{position:absolute;top:0;right:0;margin-top:5px;margin-right:5px;z-index:10}.mcp-url.svelte-1uo4thf{padding:var(--size-2);position:relative}.mcp-url.svelte-1uo4thf label:where(.svelte-1uo4thf){display:block;margin-bottom:var(--size-2);font-weight:600;color:var(--body-text-color)}.mcp-url.svelte-1uo4thf .textbox:where(.svelte-1uo4thf){display:flex;align-items:center;gap:var(--size-2);border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);padding:var(--size-2);background:var(--background-fill-primary)}.mcp-url.svelte-1uo4thf input:where(.svelte-1uo4thf){flex:1;border:none;background:none;color:var(--body-text-color);font-family:var(--font-mono);font-size:var(--text-md);width:100%}.mcp-url.svelte-1uo4thf input:where(.svelte-1uo4thf):focus{outline:none}.status-indicator.svelte-1uo4thf{display:inline-block;margin-right:var(--size-1-5);position:relative;top:-1px;font-size:.8em}.status-indicator.active.svelte-1uo4thf{color:#4caf50;animation:svelte-1uo4thf-pulse 1s infinite}@keyframes svelte-1uo4thf-pulse{0%{opacity:1}50%{opacity:.6}to{opacity:1}}.mcp-tools.svelte-1uo4thf{margin-top:var(--size-4);border:1px solid var(--border-color-primary);border-radius:var(--radius-md);overflow:hidden}.tool-selection.svelte-1uo4thf{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--size-2)}.tool-selection-controls.svelte-1uo4thf{display:flex;gap:var(--size-2)}.select-all-btn.svelte-1uo4thf,.select-none-btn.svelte-1uo4thf{padding:var(--size-1) var(--size-2);border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);background:var(--background-fill-primary);color:var(--body-text-color);cursor:pointer;font-size:var(--text-sm)}.select-all-btn.svelte-1uo4thf:hover,.select-none-btn.svelte-1uo4thf:hover{background:var(--background-fill-secondary)}.tool-item.svelte-1uo4thf{border-bottom:1px solid var(--border-color-primary)}.tool-item.svelte-1uo4thf:last-child{border-bottom:none}.tool-header-wrapper.svelte-1uo4thf{display:flex;align-items:center}.tool-checkbox.svelte-1uo4thf{margin-left:var(--size-3);margin-right:var(--size-2);width:var(--size-4);height:var(--size-4);cursor:pointer;accent-color:var(--color-accent)}.tool-checkbox.svelte-1uo4thf:checked{background-color:var(--color-accent);border-color:var(--color-accent)}.tool-header.svelte-1uo4thf{flex:1;display:flex;justify-content:space-between;align-items:center;padding:var(--size-3);background:var(--background-fill-primary);border:none;cursor:pointer;text-align:left}.tool-header.svelte-1uo4thf:hover{background:var(--background-fill-secondary)}.tool-name.svelte-1uo4thf{font-family:var(--font-mono);font-weight:600}.tool-arrow.svelte-1uo4thf{color:var(--body-text-color-subdued)}.tool-content.svelte-1uo4thf{padding:var(--size-3);background:var(--background-fill-secondary)}.tool-description.svelte-1uo4thf{margin-bottom:var(--size-3);color:var(--body-text-color)}.parameter.svelte-1uo4thf{margin-bottom:var(--size-2);padding:var(--size-2);background:var(--background-fill-primary);border-radius:var(--radius-sm)}.parameter.svelte-1uo4thf code:where(.svelte-1uo4thf){font-weight:600;color:var(--color-accent)}.parameter-type.svelte-1uo4thf{color:var(--body-text-color-subdued);margin-left:var(--size-1)}.parameter-description.svelte-1uo4thf{margin-top:var(--size-1);color:var(--body-text-color)}a.svelte-1uo4thf{text-decoration:underline}.hidden.svelte-1uo4thf{display:none}.menu-icon-arrow.svelte-1s9m4x9{width:1rem;height:1rem;color:#6b7280;flex-shrink:0}@media(prefers-color-scheme:dark){.menu-icon-arrow.svelte-1s9m4x9{color:#d1d5db}}.caret-icon.svelte-1u0oj9c{transition:transform .2s ease-in-out;color:#9ca3af;overflow:visible;width:.75rem;height:.75rem}@media(max-width:640px){.caret-icon.svelte-1u0oj9c{width:.625rem;height:.625rem}}.rotate-180.svelte-1u0oj9c{transform:rotate(180deg)}.rotate-0.svelte-1u0oj9c{transform:rotate(0)}.icon-size.svelte-pw1cre{width:.75rem;height:.75rem}@media(max-width:640px){.icon-size.svelte-pw1cre{width:.625rem;height:.625rem}}.menu-icon.svelte-pw1cre{width:1rem;height:1rem;flex-shrink:0}.hidden.svelte-pw1cre{display:none}.block.svelte-pw1cre{display:block}.container-wrapper.svelte-de9ybk{display:flex;align-items:center;flex-shrink:0;min-width:100px;justify-content:flex-end;margin-left:auto}@media(max-width:640px){.container-wrapper.svelte-de9ybk{min-width:50px}}.trigger-wrapper.svelte-de9ybk{display:inline-flex;border-radius:.375rem}@media(max-width:640px){.trigger-wrapper.svelte-de9ybk{border-radius:.125rem}}.icon-wrapper.svelte-de9ybk{display:inline-flex;align-items:center;justify-content:center;border-radius:.375rem;padding:.125rem}@media(max-width:640px){.icon-wrapper.svelte-de9ybk{padding:0}}.menu-toggle-button.svelte-de9ybk{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;font-size:.875rem;color:#6b7280;border-radius:0;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem;border:1px solid rgb(229,231,235);border-left:none;background-color:#fff;transition:all .2s ease-in-out}.menu-toggle-button.svelte-de9ybk:disabled{pointer-events:none}.menu-toggle-button.svelte-de9ybk:hover{color:#374151;box-shadow:inset 0 2px 4px #0000000d}@media(max-width:640px){.menu-toggle-button.svelte-de9ybk{width:1.25rem;height:1.25rem;border-top-right-radius:.125rem;border-bottom-right-radius:.125rem}}@media(prefers-color-scheme:dark){.menu-toggle-button.svelte-de9ybk{border-color:#262626;background-color:#0a0a0a;color:#e5e7eb}.menu-toggle-button.svelte-de9ybk:hover{color:#fff;background-color:#1f2937}}.backdrop-overlay.svelte-de9ybk{position:fixed;inset:0;z-index:40}.menu-dropdown.svelte-de9ybk{position:fixed;z-index:50;backdrop-filter:blur(24px);border-radius:.75rem;max-height:420px;overflow-y:auto;padding:.25rem;border:1px solid rgb(229,231,235);display:flex;flex-direction:column;background-color:#fff;color:#1f2937}@media(prefers-color-scheme:dark){.menu-dropdown.svelte-de9ybk{border-color:#262626;background-color:#0a0a0a;color:#e5e7eb}}.menu-icon-container.svelte-de9ybk{border:1px solid rgb(229,231,235);border-radius:.5rem;padding:.375rem}@media(prefers-color-scheme:dark){.menu-icon-container.svelte-de9ybk{border-color:#262626}}.menu-text-container.svelte-de9ybk{display:flex;flex-direction:column;padding-left:.25rem;padding-right:.25rem}.menu-text-primary.svelte-de9ybk{font-size:11px;font-weight:500;color:#1f2937;display:flex;align-items:center;gap:.25rem}@media(prefers-color-scheme:dark){.menu-text-primary.svelte-de9ybk{color:#d1d5db}}.menu-text-secondary.svelte-de9ybk{font-size:.75rem;color:#4b5563}@media(prefers-color-scheme:dark){.menu-text-secondary.svelte-de9ybk{color:#9ca3af}}.copy-button.svelte-de9ybk{display:inline-flex;align-items:center;gap:4px;height:24px;padding-left:8px;padding-right:6px;font-size:11px;font-weight:500;color:#1f2937;border:1px solid rgb(229,231,235);border-radius:6px 0 0 6px;background-color:#fff;@media(max-width:640px){gap:2px;height:20px;padding-left:6px;padding-right:6px;font-size:9px;border-top-left-radius:4px;border-bottom-left-radius:4px}&:hover{box-shadow:inset 0 2px 4px #0000000d}@media(prefers-color-scheme:dark){border-color:#262626;background-color:#0a0a0a;color:#e5e7eb;&:hover{background-color:#262626}}}.base-menu-item.svelte-de9ybk{cursor:pointer;font-size:11px;position:relative;width:100%;user-select:none;outline:none;display:flex;align-items:center;gap:.375rem;padding:.375rem;border-radius:.75rem;text-align:left;transition:all .2s ease-in-out;border-color:#e5e7eb;background-color:#fff}.base-menu-item.svelte-de9ybk:hover{box-shadow:inset 0 2px 4px #0000000d}@media(prefers-color-scheme:dark){.base-menu-item.svelte-de9ybk{border-color:#1f2937;background-color:#0f1117;color:#e5e7eb}.base-menu-item.svelte-de9ybk:hover{background-color:#1f2937}}.banner-wrap.svelte-1ujc8oz{position:relative;border-bottom:1px solid var(--border-color-primary);padding:var(--size-4) var(--size-6);font-size:var(--text-md)}@media(min-width:768px){.banner-wrap.svelte-1ujc8oz{font-size:var(--text-xl)}}.docs-wrap.svelte-1ujc8oz{display:flex;flex-direction:column;gap:var(--spacing-xxl)}.endpoint.svelte-1ujc8oz{border-radius:var(--radius-md);background:var(--background-fill-primary);padding:var(--size-6);padding-top:var(--size-1);font-size:var(--text-md)}.client-doc.svelte-1ujc8oz{padding-top:var(--size-6);padding-right:var(--size-6);padding-left:var(--size-6);font-size:var(--text-md)}.snippets.svelte-1ujc8oz{display:flex;align-items:center;margin-bottom:var(--size-4)}.snippets.svelte-1ujc8oz>:where(.svelte-1ujc8oz)+:where(.svelte-1ujc8oz){margin-left:var(--size-2)}.snippet.svelte-1ujc8oz{display:flex;align-items:center;border:1px solid var(--border-color-primary);border-radius:var(--radius-md);padding:var(--size-1) var(--size-1-5);color:var(--body-text-color-subdued);color:var(--body-text-color);line-height:1;user-select:none;font-size:var(--text-lg)}.current-lang.svelte-1ujc8oz{border:1px solid var(--body-text-color-subdued);color:var(--body-text-color)}.inactive-lang.svelte-1ujc8oz{cursor:pointer;color:var(--body-text-color-subdued)}.inactive-lang.svelte-1ujc8oz:hover,.inactive-lang.svelte-1ujc8oz:focus{box-shadow:var(--shadow-drop);color:var(--body-text-color)}.snippet.svelte-1ujc8oz img:where(.svelte-1ujc8oz){margin-right:var(--size-1-5);width:var(--size-4);height:var(--size-4)}.endpoint-container.svelte-1ujc8oz{margin-top:var(--size-3);margin-bottom:var(--size-3);border:1px solid var(--block-border-color);border-radius:var(--radius-xl);padding:var(--size-3);padding-top:0}a.svelte-1ujc8oz{text-decoration:underline}p.padded.svelte-1ujc8oz{padding:15px 0;font-size:var(--text-lg)}code.svelte-1ujc8oz{font-size:var(--text-md)}.loading-dot.svelte-1ujc8oz{position:relative;left:-9999px;width:10px;height:10px;border-radius:5px;background-color:#fd7b00;color:#fd7b00;box-shadow:9999px 0 0 -1px;margin-right:.25rem}.docs-wrap .sm.secondary{padding-top:1px;padding-bottom:1px}.self-baseline.svelte-1ujc8oz{align-self:baseline}.api-count.svelte-1ujc8oz{font-weight:700;color:#fd7b00;align-self:baseline;font-family:var(--font-mono);font-size:var(--text-md)}.hidden.svelte-1ujc8oz{display:none}.cli-flavor-selector.svelte-1ujc8oz{display:flex;align-items:center;margin-bottom:var(--size-4)}.cli-flavor-selector.svelte-1ujc8oz>:where(.svelte-1ujc8oz)+:where(.svelte-1ujc8oz){margin-left:var(--size-2)}@media(prefers-color-scheme:dark){.agent-icon.svelte-1ujc8oz{filter:invert(1)}} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ApiRecorder-CoSLrx_1.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ApiRecorder-CoSLrx_1.css new file mode 100644 index 0000000000000000000000000000000000000000..2572e40f0b0a90c2e464bfde57b4ee3fdd04f930 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ApiRecorder-CoSLrx_1.css @@ -0,0 +1 @@ +.api-name.svelte-1kdww8a{font-size:var(--text-sm);font-family:var(--font-mono);color:#fd7b00}.loading-dot.svelte-1kdww8a{position:relative;left:-9999px;width:10px;height:10px;border-radius:5px;background-color:#fd7b00;color:#fd7b00;box-shadow:9999px 0 0 -1px;animation:svelte-1kdww8a-loading-dot 2s infinite linear;animation-delay:.25s;margin-left:.25rem;margin-right:.5rem}.docs-wrap .sm.secondary{padding-top:1px;padding-bottom:1px}.self-baseline.svelte-1kdww8a{align-self:baseline}@keyframes svelte-1kdww8a-loading-dot{0%{box-shadow:9999px 0 0 -1px}50%{box-shadow:9999px 0 0 2px}to{box-shadow:9999px 0 0 -1px}}.api-count.svelte-1kdww8a{font-weight:700;color:#fd7b00;align-self:baseline;font-family:var(--font-mono);font-size:var(--text-sm)}.api-section.svelte-1kdww8a{margin-left:4px} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ApiRecorder-y0lpz3M9.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ApiRecorder-y0lpz3M9.js new file mode 100644 index 0000000000000000000000000000000000000000..5f9e0fb0f5827943f068bd17bbdd0a366043633d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ApiRecorder-y0lpz3M9.js @@ -0,0 +1 @@ +import{p as u,e as B,i as P}from"./i18n-Dnhn5Rxr.js";import{R as S,V as t,X as w,S as C,Y as r,G as i,z as c,t as g,a0 as h,a as v,T as G,U as k,W as f}from"./index-DWyDLubb.js";import{B as I}from"./Button-D-_s2ksk.js";import"./snippet-BWgYNF9D.js";import"./Image-CeW7PJs4.js";import"./misc-vsnLZ-Y1.js";/* empty css */import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";/* empty css */var T=f(' '),U=f('

    Recording API Calls:

    ',1),V=f('
    ');function K(x,l){S(l,!1);let e=u(l,"api_calls",28,()=>[]),s=u(l,"dependencies",12);var b={get api_calls(){return e()},set api_calls(a){e(a),k()},get dependencies(){return s()},set dependencies(a){s(a),k()}};B();var n=V(),$=t(n);return I($,{size:"sm",variant:"secondary",children:(a,W)=>{var m=U(),_=w(C(m),4),p=t(_),R=t(p);r(p);var y=w(p,2);{var z=d=>{var o=T(),A=t(o);r(o),g(()=>h(A,`/${i(s()),i(e()),c(()=>s()[e()[e().length-1].fn_index].api_name)??""}`)),v(d,o)};P(y,d=>{i(e()),c(()=>e().length>0)&&d(z)})}r(_),g(()=>h(R,`[${i(e()),c(()=>e().length)??""}]`)),v(a,m)},$$slots:{default:!0}}),r(n),v(x,n),G(b)}export{K as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ArrowUp-D69HGcoh.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ArrowUp-D69HGcoh.js new file mode 100644 index 0000000000000000000000000000000000000000..80cfe6710241c03a915415d8cbea9a9c3a57fec4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ArrowUp-D69HGcoh.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as n,f as e}from"./index-DWyDLubb.js";var i=e('');function l(o){var r=i();n(o,r)}export{l as A}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BaseForm-B7Gu_hvH.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BaseForm-B7Gu_hvH.js new file mode 100644 index 0000000000000000000000000000000000000000..e7579d4273cbb6e006384e5e607ed20abee96623 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BaseForm-B7Gu_hvH.js @@ -0,0 +1 @@ +import{p as r,s as f,b as m,a as i,f as o}from"./i18n-Dnhn5Rxr.js";import{t as c,a as v,V as b,W as h,Y as u}from"./index-DWyDLubb.js";var _=h("
    ");function g(d,a){let l=r(a,"label",3,void 0);var e=_();let s,t;var n=b(e);f(n,a,"default",{}),u(e),c(()=>{s=m(e,1,"form svelte-d5xbca",null,s,{hidden:a.visible===!1,"hidden-css":a.visible==="hidden"}),i(e,"role",l()?"group":void 0),i(e,"aria-label",l()),t=o(e,"",t,{"flex-grow":a.scale,"min-width":`calc(min(${a.min_width}px, 100%))`})}),v(d,e)}export{g as B}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BaseForm-DJxyhkeW.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BaseForm-DJxyhkeW.css new file mode 100644 index 0000000000000000000000000000000000000000..02aec91aa212732a60f47660bba1d5039fa5b025 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BaseForm-DJxyhkeW.css @@ -0,0 +1 @@ +div.svelte-d5xbca{display:flex;flex-direction:inherit;flex-wrap:wrap;gap:var(--form-gap-width);box-shadow:var(--block-shadow);border:var(--block-border-width) solid var(--block-border-color);border-radius:var(--block-radius);background:var(--border-color-primary);overflow-y:hidden}div.svelte-d5xbca .block{box-shadow:none!important;border-width:0px!important;border-radius:0!important}.hidden.svelte-d5xbca{display:none}.hidden-css.svelte-d5xbca{display:none!important}div.svelte-d5xbca:not(:has(>:not(.hidden))){display:none} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Block-J4oodUWp.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Block-J4oodUWp.js new file mode 100644 index 0000000000000000000000000000000000000000..e403e13a730d9422b5730a47f30112b1c007909b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Block-J4oodUWp.js @@ -0,0 +1 @@ +import{B as ve,p as a,e as me,i as Z,d as we,c as xe,S as ye,C as be,s as pe,f as Ee}from"./i18n-Dnhn5Rxr.js";import{p as ke,E as Se,am as P,an as Le,d as ze,ao as Be,b as Ce,N as Ne,i as I,h as u,e as ie,ap as Te,aq as Me,g as Ae,ar as re,s as J,R as Re,a3 as N,a1 as se,G as o,w as l,a2 as Ye,a6 as Fe,S as Q,a as T,T as Ge,U as n,x as E,X as de,W as $,z as h,Z as He,t as Pe,f as Ue,as as We}from"./index-DWyDLubb.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";function je(U,t,k,c,S,g){let L=u;u&&ie();var r=null;u&&I.nodeType===Te&&(r=I,ie());var y=u?I:U,v=new ve(y,!1);ke(()=>{const d=t()||null;var b=d==="svg"?Le:null;if(d===null){v.ensure(null,null),P(!0);return}return v.ensure(d,p=>{if(d){if(r=u?r:b?document.createElementNS(b,d):document.createElement(d),ze(r,r),c){u&&Me(d)&&r.append(document.createComment(""));var m=u?Ae(r):r.appendChild(Be());u&&(m===null?re(!1):J(m)),c(r,m)}Ce.nodes.end=r,p.before(r)}u&&J(p)}),P(!0),()=>{d&&P(!1)}},Se),Ne(()=>{P(!0)}),L&&(re(!0),J(y))}var qe=Ue(''),De=$(" ",1),Ke=$('
    '),Oe=$(" ",1);function Ie(U,t){Re(t,!1);let k=a(t,"height",12,void 0),c=a(t,"min_height",12,void 0),S=a(t,"max_height",12,void 0),g=a(t,"width",12,void 0),L=a(t,"elem_id",12,""),r=a(t,"elem_classes",28,()=>[]),y=a(t,"variant",12,"solid"),v=a(t,"border_mode",12,"base"),d=a(t,"padding",12,!0),b=a(t,"type",12,"normal"),p=a(t,"test_id",12,void 0),m=a(t,"explicit_call",12,!1),W=a(t,"container",12,!0),w=a(t,"visible",12,!0),j=a(t,"allow_overflow",12,!0),q=a(t,"overflow_behavior",12,"auto"),M=a(t,"scale",12,null),D=a(t,"min_width",12,0),A=a(t,"flex",12,!1),K=a(t,"resizable",12,!1),O=a(t,"rtl",12,!1),i=a(t,"fullscreen",12,!1),V=a(t,"label",12,void 0),X=N(i()),f=N(),oe=b()==="fieldset"?"fieldset":"div",ee=N(0),te=N(0),s=N(null);function le(e){i()&&e.key==="Escape"&&i(!1)}const R=e=>{if(e!==void 0){if(typeof e=="number")return e+"px";if(typeof e=="string")return e}},fe=e=>{let z=e.clientY;const B=F=>{const _=F.clientY-z;z=F.clientY,We(f,l(f).style.height=`${l(f).offsetHeight+_}px`)},Y=()=>{window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",Y)};window.addEventListener("mousemove",B),window.addEventListener("mouseup",Y)};se(()=>(o(i()),l(X),l(f)),()=>{i()!==l(X)&&(E(X,i()),i()?(E(s,l(f).getBoundingClientRect()),E(ee,l(f).offsetHeight),E(te,l(f).offsetWidth),window.addEventListener("keydown",le)):(E(s,null),window.removeEventListener("keydown",le)))}),se(()=>o(w()),()=>{w()||A(!1)}),Ye();var ue={get height(){return k()},set height(e){k(e),n()},get min_height(){return c()},set min_height(e){c(e),n()},get max_height(){return S()},set max_height(e){S(e),n()},get width(){return g()},set width(e){g(e),n()},get elem_id(){return L()},set elem_id(e){L(e),n()},get elem_classes(){return r()},set elem_classes(e){r(e),n()},get variant(){return y()},set variant(e){y(e),n()},get border_mode(){return v()},set border_mode(e){v(e),n()},get padding(){return d()},set padding(e){d(e),n()},get type(){return b()},set type(e){b(e),n()},get test_id(){return p()},set test_id(e){p(e),n()},get explicit_call(){return m()},set explicit_call(e){m(e),n()},get container(){return W()},set container(e){W(e),n()},get visible(){return w()},set visible(e){w(e),n()},get allow_overflow(){return j()},set allow_overflow(e){j(e),n()},get overflow_behavior(){return q()},set overflow_behavior(e){q(e),n()},get scale(){return M()},set scale(e){M(e),n()},get min_width(){return D()},set min_width(e){D(e),n()},get flex(){return A()},set flex(e){A(e),n()},get resizable(){return K()},set resizable(e){K(e),n()},get rtl(){return O()},set rtl(e){O(e),n()},get fullscreen(){return i()},set fullscreen(e){i(e),n()},get label(){return V()},set label(e){V(e),n()}};me();var ae=Fe(),he=Q(ae);{var _e=e=>{var z=Oe(),B=Q(z);je(B,()=>oe,!1,(_,G)=>{we(_,x=>E(f,x),()=>l(f)),xe(_,(x,H)=>({"data-testid":p(),id:L(),class:`block ${x??""}`,dir:O()?"rtl":"ltr","aria-label":V(),style:"",[be]:{hidden:w()==="hidden",padded:d(),flex:A(),border_focus:v()==="focus",border_contrast:v()==="contrast","hide-container":!m()&&!W(),fullscreen:i(),animating:i()&&l(s)!==null,"auto-margin":M()===null},[ye]:H}),[()=>(o(r()),h(()=>r()?.join(" ")||"")),()=>({height:(o(i()),o(k()),h(()=>i()?void 0:R(k()))),"min-height":(o(i()),o(c()),h(()=>i()?void 0:R(c()))),"max-height":(o(i()),o(S()),h(()=>i()?void 0:R(S()))),"--start-top":(l(s),h(()=>l(s)?`${l(s).top}px`:"0px")),"--start-left":(l(s),h(()=>l(s)?`${l(s).left}px`:"0px")),"--start-width":(l(s),h(()=>l(s)?`${l(s).width}px`:"0px")),"--start-height":(l(s),h(()=>l(s)?`${l(s).height}px`:"0px")),width:(o(i()),o(g()),h(()=>i()?void 0:typeof g()=="number"?`calc(min(${g()}px, 100%))`:R(g()))),"border-style":y(),overflow:j()?q():"hidden","flex-grow":M(),"min-width":`calc(min(${D()}px, 100%))`})],void 0,void 0,"svelte-1plpy97");var C=De(),ne=Q(C);pe(ne,t,"default",{});var ce=de(ne,2);{var ge=x=>{var H=qe();He("mousedown",H,fe),T(x,H)};Z(ce,x=>{K()&&x(ge)})}T(G,C)});var Y=de(B,2);{var F=_=>{var G=Ke();let C;Pe(()=>C=Ee(G,"",C,{height:l(ee)+"px",width:l(te)+"px"})),T(_,G)};Z(Y,_=>{i()&&_(F)})}T(e,z)};Z(he,e=>{(w()===!0||w()==="hidden")&&e(_e)})}return T(U,ae),Ge(ue)}export{Ie as B}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BlockLabel-CZd21Hkw.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BlockLabel-CZd21Hkw.js new file mode 100644 index 0000000000000000000000000000000000000000..6932535c571a4672f73d170d89bd6ec26e5de6d5 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BlockLabel-CZd21Hkw.js @@ -0,0 +1 @@ +import{p as a,a as p,b as w}from"./i18n-Dnhn5Rxr.js";import{R as x,t as I,a as j,T as k,U as s,V as c,W as y,X as B,a0 as L,Y as h}from"./index-DWyDLubb.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";var R=y('');function V(_,l){x(l,!1);let o=a(l,"label",12,null),n=a(l,"Icon",12),r=a(l,"show_label",12,!0),b=a(l,"disable",12,!1),i=a(l,"float",12,!0),d=a(l,"rtl",12,!1);var g={get label(){return o()},set label(e){o(e),s()},get Icon(){return n()},set Icon(e){n(e),s()},get show_label(){return r()},set show_label(e){r(e),s()},get disable(){return b()},set disable(e){b(e),s()},get float(){return i()},set float(e){i(e),s()},get rtl(){return d()},set rtl(e){d(e),s()}},t=R();let u;var f=c(t),m=c(f);n()(m,{}),h(f);var v=B(f);return h(t),I(()=>{p(t,"dir",d()?"rtl":"ltr"),u=w(t,1,"svelte-19djge9",null,u,{hide:!r(),"sr-only":!r(),float:i(),"hide-label":b()}),L(v,` ${o()??""}`),t.dir=t.dir}),j(_,t),k(g)}export{V as B}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BlockTitle-BMm9LakX.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BlockTitle-BMm9LakX.js new file mode 100644 index 0000000000000000000000000000000000000000..dcf6668489ca13f1fea87627fa675e4eb8791615 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BlockTitle-BMm9LakX.js @@ -0,0 +1 @@ +import{p as o,s as _,i as p,a as b,b as v}from"./i18n-Dnhn5Rxr.js";import{R as g,S as w,t as k,a as x,T as y,U as n,V as B,W as I,X as S,Y as T}from"./index-DWyDLubb.js";import{I as j}from"./Info-Dzjhnd64.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";var R=I(' ',1);function Y(d,a){g(a,!1);let l=o(a,"show_label",12,!0),s=o(a,"info",12,void 0),r=o(a,"rtl",12,!1);var u={get show_label(){return l()},set show_label(t){l(t),n()},get info(){return s()},set info(t){s(t),n()},get rtl(){return r()},set rtl(t){r(t),n()}},i=R(),e=w(i);let f;var c=B(e);_(c,a,"default",{}),T(e);var h=S(e,2);{var m=t=>{j(t,{get info(){return s()}})};p(h,t=>{s()&&t(m)})}return k(()=>{b(e,"dir",r()?"rtl":"ltr"),f=v(e,1,"svelte-jdcl7l",null,f,{hide:!l(),"has-info":s()!=null,"sr-only":!l()}),e.dir=e.dir}),x(d,i),y(u)}export{Y as B}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Blocks-CXVCGwNW.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Blocks-CXVCGwNW.css new file mode 100644 index 0000000000000000000000000000000000000000..45f6f24924376292e3fa64f9f7482d9e23c1e3bb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Blocks-CXVCGwNW.css @@ -0,0 +1 @@ +.wrap.svelte-zxu34v{display:flex;flex-grow:1;flex-direction:column;width:var(--size-full);font-weight:var(--body-text-weight);font-size:var(--body-text-size)}main.contain.svelte-zxu34v{display:flex;flex-direction:column}footer.svelte-zxu34v{display:flex;justify-content:center;margin-top:var(--size-4);color:var(--body-text-color-subdued)}.divider.svelte-zxu34v{margin-left:var(--size-1);margin-right:var(--size-2)}.show-api.svelte-zxu34v,.settings.svelte-zxu34v,.record.svelte-zxu34v{display:flex;align-items:center}.show-api.svelte-zxu34v img:where(.svelte-zxu34v){margin-right:var(--size-1);margin-left:var(--size-2);width:var(--size-3)}.settings.svelte-zxu34v img:where(.svelte-zxu34v){margin-right:var(--size-1);margin-left:var(--size-1);width:var(--size-4)}.record.svelte-zxu34v img:where(.svelte-zxu34v){margin-right:var(--size-1);margin-left:var(--size-1);width:var(--size-3)}.built-with.svelte-zxu34v{display:flex;align-items:center}.built-with.svelte-zxu34v:hover,.settings.svelte-zxu34v:hover,.record.svelte-zxu34v:hover{color:var(--body-text-color)}.built-with.svelte-zxu34v img:where(.svelte-zxu34v){margin-right:var(--size-1);margin-left:var(--size-1);margin-bottom:1px;width:var(--size-4)}.api-docs.svelte-zxu34v{display:flex;position:fixed;top:0;right:0;z-index:var(--layer-top);background:#00000080;width:var(--size-screen);height:var(--size-screen-h)}.backdrop.svelte-zxu34v{flex:1 1 0%;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.api-docs-wrap.svelte-zxu34v{box-shadow:var(--shadow-drop-lg);background:var(--background-fill-primary);overflow-x:hidden;overflow-y:auto}@media(min-width:768px){.api-docs-wrap.svelte-zxu34v{border-top-left-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg);width:950px}}@media(min-width:1536px){.api-docs-wrap.svelte-zxu34v{width:1150px}}#api-recorder-container.svelte-zxu34v{position:fixed;left:10px;bottom:10px;z-index:1000}.show-api.svelte-zxu34v{display:flex;align-items:center}@media(max-width:640px){.show-api.svelte-zxu34v,.show-api-divider.svelte-zxu34v{display:none}}.show-api.svelte-zxu34v:hover{color:var(--body-text-color)}.hidden.svelte-zxu34v{display:none} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Blocks-D6_IyY-z.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Blocks-D6_IyY-z.js new file mode 100644 index 0000000000000000000000000000000000000000..a32a89c6a1f170b8de7ea50917957f74df5f60bf --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Blocks-D6_IyY-z.js @@ -0,0 +1,5 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ApiDocs-D66OUv1H.js","./i18n-Dnhn5Rxr.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./i18n-9kYrHpuJ.css","./misc-vsnLZ-Y1.js","./clear-CEoTtSVi.js","./Button-D-_s2ksk.js","./snippet-BWgYNF9D.js","./Image-CeW7PJs4.js","./Image-Da_XA0w6.css","./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js","./ScrollFade-DV-0xzhB.css","./Button-BZ4d-rtD.css","./ImagePreview-CCVfwC4m.css","./index-CglBvmLb.js","./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js","./html-Ih_5QVTo.js","./index-B_pwUImq.js","./StreamingBar-CMuqaV2j.css","./Clear-BF6j078A.js","./Block-J4oodUWp.js","./input-DrerMDOL.js","./size-CtOeLwIl.js","./state.svelte-CXxGByZZ.js","./utils.svelte-CCyS_0CY.js","./clone-BkeCM4Nl.js","./index-DkrWwIux.js","./index-tFQomdd2.js","./ApiDocs-y7Md9q8F.css","./ApiRecorder-y0lpz3M9.js","./ApiRecorder-CoSLrx_1.css","./Settings-Bwz4Nb_m.js","./Dropdown-Beu8JVME.js","./window-Uydxco8n.js","./BlockTitle-BMm9LakX.js","./Info-Dzjhnd64.js","./DropdownArrow-BOSZEGSp.js","./IconButtonWrapper-D0s9l4wW.js","./Dropdown--Uz_kS2s.css","./Checkbox-HhbcVSTv.js","./universal-CFOISHmx.js","./Checkbox-BbySKLMz.css","./Settings-CLQaonub.css","./Example-BeU1J4ps.css","./Index-C-RstoJU.js","./Code-BLWhl1y6.js","./Code-wZDUWKrz.css","./Index.svelte_svelte_type_style_lang-D9os8tfr.js","./actions-CLThs9VH.js","./Check-DUAHzS2-.js","./Copy-ChCbTvli.js","./MarkdownCode-B8HQ3LiU.js","./prism-python-B4lzO_Nz.js","./MarkdownCode-7h5zEbas.css","./Index-cY7HT1Ac.css","./Index-DP8ihX8q.css","./Example-BK-tWmkG.css","./Example-CgIc4GLa.css"])))=>i.map(i=>d[i]); +import{aO as Et,L as Ct,aP as St,h as Se,ar as Le,s as ze,i as rt,w as d,e as Lt,aJ as zt,ao as Ot,p as Rt,aQ as Mt,C as At,j as Ke,g as Dt,R as Fe,aR as ot,aS as De,u as be,y as lt,aT as Tt,a as v,T as Pe,W,x as F,a6 as Z,S as A,v as Xe,z as jt,aa as Ft,X as y,t as Y,a5 as Me,af as pe,V as I,a0 as me,Z as ie,aU as Pt,Y as q,aV as It,a7 as Ye}from"./index-DWyDLubb.js";import{d as dt,k as $e,u as et,i as k,g as qt,r as Ut,O as Vt,z as ct,j as Gt,P as _t,p as Ce,f as tt,q as it,m as Bt,b as at,a as N,w as Nt,A as Zt}from"./i18n-Dnhn5Rxr.js";import{h as Wt}from"./html-Ih_5QVTo.js";import{c as we}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{b as Ht}from"./size-CtOeLwIl.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{L as Jt,T as Qt}from"./state.svelte-CXxGByZZ.js";import{I as Kt,t as Xt}from"./utils.svelte-CCyS_0CY.js";import{AppTree as Yt}from"./index-DkrWwIux.js";function $(o,e=[],i=[],a){var t=Et(),n=Ct,l=t.is_rendered();t.update_pending_count(1),n.increment(l);var c=Se;if(c){Lt();var g=rt,h=zt(!1);ze(h)}St(e,[],i,w=>{c&&(Le(!0),ze(g));try{for(const E of w)d(E);a(o,...w)}finally{c&&Le(!1),t.update_pending_count(-1),n.decrement(l)}})}function $t(o,e){let i=null,a=Se;var t;if(Se){i=rt;for(var n=Dt(document.head);n!==null&&(n.nodeType!==At||n.data!==o);)n=Ke(n);if(n===null)Le(!1);else{var l=Ke(n);n.remove(),ze(l)}}Se||(t=document.head.appendChild(Ot()));try{Rt(()=>e(t),Mt)}finally{a&&(Le(!0),ze(i))}}var ei=W("");function ti(o,e){Fe(e,!0);var i,a,t,n=ot([async()=>i=await De(()=>e.node.component),async()=>a=await De(()=>e.node.runtime),()=>t=be(null),()=>{lt(()=>{if(!d(t)||!d(a)||!d(i))return;const c=e.node.props.shared_props,g=e.node.props.props,h=d(a),w=h.mount(d(i).default,{target:d(t),props:{shared_props:c,props:g,children:e.children}});return()=>{h.unmount(w)}})}]),l=ei();Tt([n[2]],()=>{dt(l,c=>F(t,c),()=>d(t))}),v(o,l),Pe()}function Te(o,e){Fe(e,!0);let i=Ut(e,["$$slots","$$events","$$legacy","node"]);var a,t=ot([async()=>a=await De(()=>e.node.component)]),n=Z(),l=A(n);$(l,[t[0]],[()=>e.node&&d(a)],(c,g)=>{var h=w=>{var E=Z(),u=A(E);$(u,[t[0]],[()=>e.node.props.shared_props.visible&&!e.node.runtime],(C,P)=>{var _=m=>{var b=Z(),x=A(b);$(x,[t[0]],void 0,S=>{we(x,()=>d(a).default,(V,D)=>{D(V,{get shared_props(){return e.node.props.shared_props},get props(){return e.node.props.props},children:(L,ae)=>{var G=Z(),B=A(G);$(B,[t[0]],[()=>e.node.children&&e.node.children.length],(J,ee)=>{var fe=se=>{var ne=Z(),re=A(ne);$(re,[t[0]],[()=>e.node.children],(Q,oe)=>{$e(Q,17,()=>d(oe),et,(K,le)=>{Te(K,{get node(){return d(le)}})})}),v(se,ne)};k(J,se=>{d(ee)&&se(fe)})}),v(L,G)},$$slots:{default:!0}})})}),v(m,b)},H=m=>{var b=Z(),x=A(b);$(x,[t[0]],[()=>e.node.props.shared_props.visible&&e.node.runtime],(S,V)=>{var D=L=>{$(L,[t[0]],void 0,ae=>{ti(ae,qt(()=>i,{get node(){return e.node},children:(G,B)=>{var J=Z(),ee=A(J);$(ee,[t[0]],[()=>e.node.children&&e.node.children.length],(fe,se)=>{var ne=re=>{var Q=Z(),oe=A(Q);$(oe,[t[0]],[()=>e.node.children],(K,le)=>{$e(K,17,()=>d(le),et,(Oe,Re)=>{Te(Oe,{get node(){return d(Re)}})})}),v(re,Q)};k(fe,re=>{d(se)&&re(ne)})}),v(G,J)},$$slots:{default:!0}}))})};k(S,L=>{d(V)&&L(D)},!0)}),v(m,b)};k(C,m=>{d(P)?m(_):m(H,!1)})}),v(w,E)};k(c,w=>{d(g)&&w(h)})}),v(o,n),Pe()}function ii(o){if(o==null)return"";const e=String(o),i=Gt(ct);if(e.includes(Kt))return Xt(e,i);const a=i(e);return typeof a=="string"&&a!==e?a:e}const ai=Vt(ct,()=>ii),si="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='576'%20height='576'%20viewBox='0%200%20576%20576'%20fill='none'%3e%3cpath%20d='M287.5%20229L86%20344.5L287.5%20460L489%20344.5L287.5%20229Z'%20stroke='url(%23paint0_linear_102_7)'%20stroke-width='59'%20stroke-linejoin='round'/%3e%3cpath%20d='M287.5%20116L86%20231.5L287.5%20347L489%20231.5L287.5%20116Z'%20stroke='url(%23paint1_linear_102_7)'%20stroke-width='59'%20stroke-linejoin='round'/%3e%3cpath%20d='M86%20344L288%20229'%20stroke='url(%23paint2_linear_102_7)'%20stroke-width='59'%20stroke-linejoin='bevel'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_102_7'%20x1='60'%20y1='341'%20x2='429.5'%20y2='344'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F9D100'/%3e%3cstop%20offset='1'%20stop-color='%23F97700'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_102_7'%20x1='513.5'%20y1='231'%20x2='143.5'%20y2='231'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F9D100'/%3e%3cstop%20offset='1'%20stop-color='%23F97700'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_102_7'%20x1='60'%20y1='344'%20x2='428.987'%20y2='341.811'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F9D100'/%3e%3cstop%20offset='1'%20stop-color='%23F97700'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",ni="data:image/svg+xml,%3csvg%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M26.9425%202.94265C27.4632%202.42195%2027.4632%201.57773%2026.9425%201.05703C26.4218%200.536329%2025.5776%200.536329%2025.0569%201.05703L22.5713%203.54256C21.1213%202.59333%2019.5367%202.43378%2018.1753%202.64006C16.5495%202.88638%2015.1127%203.66838%2014.3905%204.39053L12.3905%206.39053C12.1405%206.64058%2012%206.97972%2012%207.33334C12%207.68697%2012.1405%208.0261%2012.3905%208.27615L19.7239%2015.6095C20.2446%2016.1302%2021.0888%2016.1302%2021.6095%2015.6095L23.6095%2013.6095C24.3316%2012.8873%2025.1136%2011.4505%2025.36%209.82475C25.5663%208.46312%2025.4066%206.87827%2024.4571%205.42807L26.9425%202.94265Z'%20fill='%233c4555'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.276%2012.9426C12.7967%2012.4219%2012.7967%2011.5777%2012.276%2011.057C11.7553%2010.5363%2010.9111%2010.5363%2010.3904%2011.057L8.66651%2012.7809L8.27615%2012.3905C8.0261%2012.1405%207.68697%2012%207.33334%2012C6.97972%2012%206.64058%2012.1405%206.39053%2012.3905L4.39053%2014.3905C3.66838%2015.1127%202.88638%2016.5495%202.64006%2018.1753C2.43377%2019.5367%202.59333%2021.1214%203.54262%2022.5714L1.05703%2025.057C0.536329%2025.5777%200.536329%2026.4219%201.05703%2026.9426C1.57773%2027.4633%202.42195%2027.4633%202.94265%2026.9426L5.42817%2024.4571C6.87835%2025.4066%208.46315%2025.5663%209.82475%2025.36C11.4505%2025.1136%2012.8873%2024.3316%2013.6095%2023.6095L15.6095%2021.6095C16.1302%2021.0888%2016.1302%2020.2446%2015.6095%2019.7239L15.2188%2019.3332L16.9426%2017.6093C17.4633%2017.0886%2017.4633%2016.2444%2016.9426%2015.7237C16.4219%2015.203%2015.5777%2015.203%2015.057%2015.7237L13.3332%2017.4475L10.5521%2014.6665L12.276%2012.9426Z'%20fill='%23FF7C00'/%3e%3c/svg%3e",ri="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3c!--%20Outer%20gear%20teeth%20(gray)%20--%3e%3cpath%20d='M19.14%2012.94c.04-.3.06-.61.06-.94%200-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24%200-.43.17-.47.41l-.36%202.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47%200-.59.22L2.74%208.87c-.12.21-.08.47.12.61l2.03%201.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03%201.58c-.18.14-.23.41-.12.61l1.92%203.32c.12.22.37.29.59.22l2.39-.96c.5.38%201.03.7%201.62.94l.36%202.54c.05.24.24.41.48.41h3.84c.24%200%20.44-.17.47-.41l.36-2.54c.59-.24%201.13-.56%201.62-.94l2.39.96c.22.08.47%200%20.59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12%2015.6c-1.98%200-3.6-1.62-3.6-3.6s1.62-3.6%203.6-3.6%203.6%201.62%203.6%203.6-1.62%203.6-3.6%203.6z'%20fill='%23808080'/%3e%3c!--%20Inner%20circle%20(now%20gray)%20--%3e%3ccircle%20cx='12'%20cy='12'%20r='2.5'%20fill='%23808080'/%3e%3c/svg%3e",oi="data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='%23000000'%3e%3cg%20id='SVGRepo_bgCarrier'%20stroke-width='0'%3e%3c/g%3e%3cg%20id='SVGRepo_tracerCarrier'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3c/g%3e%3cg%20id='SVGRepo_iconCarrier'%3e%3ctitle%3erecord%20[%23982]%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3c/defs%3e%3cg%20id='Page-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='Dribbble-Light-Preview'%20transform='translate(-380.000000,%20-3839.000000)'%20fill='%23FF0000'%3e%3cg%20id='icons'%20transform='translate(56.000000,%20160.000000)'%3e%3cpath%20d='M338,3689%20C338,3691.209%20336.209,3693%20334,3693%20C331.791,3693%20330,3691.209%20330,3689%20C330,3686.791%20331.791,3685%20334,3685%20C336.209,3685%20338,3686.791%20338,3689%20M334,3697%20C329.589,3697%20326,3693.411%20326,3689%20C326,3684.589%20329.589,3681%20334,3681%20C338.411,3681%20342,3684.589%20342,3689%20C342,3693.411%20338.411,3697%20334,3697%20M334,3679%20C328.477,3679%20324,3683.477%20324,3689%20C324,3694.523%20328.477,3699%20334,3699%20C339.523,3699%20344,3694.523%20344,3689%20C344,3683.477%20339.523,3679%20334,3679'%20id='record-[%23982]'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e";let xe=!1,ue=null,Ie=[],li=0,ye={},di,je,ci=null,Ae=[];async function _i(){if(!xe)try{const o=document.title;document.title="[Sharing] Gradio Tab";const e=await navigator.mediaDevices.getDisplayMedia({video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!0,selfBrowserSurface:"include"});document.title=o;const i={videoBitsPerSecond:5e6};ue=new MediaRecorder(e,i),Ie=[],ye={},ue.ondataavailable=fi,ue.onstop=gi,ue.start(1e3),xe=!0,li=Date.now()}catch(o){je("Recording Error","Failed to start recording: "+o.message,"error")}}function ui(){!xe||!ue||(ue.stop(),xe=!1)}function fi(o){o.data.size>0&&Ie.push(o.data)}function gi(){xe=!1;const o=new Blob(Ie,{type:"video/mp4"});hi(o),(ue?.stream?.getTracks()||[]).forEach(i=>i.stop())}async function hi(o){try{je("Processing video","This may take a few seconds...","info");const e=new FormData;e.append("video",o,"recording.mp4"),ye.start!==void 0&&ye.end!==void 0&&(e.append("remove_segment_start",ye.start.toString()),e.append("remove_segment_end",ye.end.toString())),Ae.length>0&&e.append("zoom_effects",JSON.stringify(Ae));const i=await fetch(di+"/gradio_api/process_recording",{method:"POST",body:e});if(!i.ok)throw new Error(`Server returned ${i.status}: ${i.statusText}`);const a=await i.blob(),t=`gradio-screen-recording-${new Date().toISOString().replace(/:/g,"-").replace(/\..+/,"")}.mp4`;st(a,t),Ae=[]}catch{je("Processing Error","Failed to process recording. Saving original version.","warning");const i=`gradio-screen-recording-${new Date().toISOString().replace(/:/g,"-").replace(/\..+/,"")}.mp4`;st(o,i)}}function st(o,e){const i=URL.createObjectURL(o),a=document.createElement("a");a.style.display="none",a.href=i,a.download=e,document.body.appendChild(a),a.click(),setTimeout(()=>{document.body.removeChild(a),URL.revokeObjectURL(i)},100)}const vi=/^'([^]+)'$/,nt=Symbol("NOVALUE");class pi{id;inputs;outputs;cancels;pending=!1;trigger_modes;event_args={};targets=[];connection_type;triggers=[];original_trigger_id=null;show_progress_on=null;component_prop_inputs=[];show_progress;functions;constructor(e){this.id=e.id,this.original_trigger_id=e.id,this.inputs=e.inputs,this.outputs=e.outputs,this.connection_type=e.connection,this.show_progress=e.show_progress,this.functions={frontend:e.js?yi(e.js,e.backend_fn,e.inputs.length,e.outputs.length):void 0,backend:e.backend_fn,backend_js:e.js_implementation?new _t(`let result = await (${e.js_implementation})(...arguments); + return (!Array.isArray(result)) ? [result] : result;`):void 0},this.targets=e.targets,this.cancels=e.cancels,this.trigger_modes=e.trigger_mode,this.show_progress_on=e.show_progress_on||null,this.component_prop_inputs=e.component_prop_inputs||[];for(let i=0;ie==="success").map(([e])=>e),failure:this.triggers.filter(([,e])=>e==="failure").map(([e])=>e),all:this.triggers.filter(([,e])=>e==="all").map(([e])=>e)}}}class mi{dependencies_by_fn=new Map;dependencies_by_event=new Map;render_id_deps=new Map;submissions=new Map;client;queue=new Set;add_to_api_calls;update_state_cb;get_state_cb;rerender_cb;log_cb;on_connection_lost_cb;loading_stati=new Jt;connection_lost=!1;constructor(e,i,a,t,n,l,c,g){this.add_to_api_calls=c,this.log_cb=l,this.update_state_cb=a,this.get_state_cb=t,this.rerender_cb=n,this.on_connection_lost_cb=g,this.client=i,this.reload(e,a,t,n,i)}reload(e,i,a,t,n){const{by_id:l,by_event:c}=this.create(e);this.dependencies_by_event=c,this.dependencies_by_fn=l,this.client=n,this.update_state_cb=i,this.get_state_cb=a,this.rerender_cb=t;for(const[g,h]of this.dependencies_by_fn)for(const[w]of h.targets)this.set_event_args(w,h.event_args);this.register_loading_stati(l)}register_loading_stati(e){for(const[i,a]of e)this.loading_stati.register(a.id,a.show_progress_on||a.outputs,a.inputs,a.show_progress)}clear_loading_status(e){this.loading_stati.clear(e)}async update_loading_stati_state(){for(const[e,i]of Object.entries(this.loading_stati.current))this.update_state_cb(Number(e),{loading_status:i},!1)}dispatch_state_change_events(e){if(e.changed_state_ids)for(const i of e.changed_state_ids)this.dependencies_by_event.get("change-"+i)?.forEach(t=>{this.dispatch({type:"fn",fn_index:t.id,target_id:i,event_data:null})})}async dispatch(e){if(this.connection_lost)return;let i;if(e.type==="fn"){const a=this.dependencies_by_fn.get(e.fn_index);a&&(i=[a])}else i=this.dependencies_by_event.get(`${e.event_name}-${e.target_id}`);for(let a=0;a<(i?.length||0);a++){const t=i?i[a]:void 0;if(t){this.cancel(t.cancels);const n=wi(t.trigger_modes,this.submissions.has(t.id));if(n==="skip")continue;if(n==="defer"){this.queue.add(t.id);continue}t.functions.backend&&(this.loading_stati.update({status:"pending",fn_index:t.id,stream_state:null}),this.update_loading_stati_state());const l=await this.gather_state(t.inputs,t.component_prop_inputs),c=await Promise.all(t.targets.map(([E])=>this.set_event_args(E,t.event_args))),{success:g,failure:h,all:w}=t.get_triggers();try{let E=null;if(e.target_id!==void 0||e.type==="event"?E=e.target_id||null:E=t.original_trigger_id,t.connection_type==="stream"&&this.submissions.has(t.id)){const C=this.submissions.get(t.id);let P={fn_index:t.id,data:l,event_data:e.event_data};C.send_chunk(P),c.forEach(_=>_());continue}this.add_to_api_calls({fn_index:t.id,data:l,event_data:e.event_data,trigger_id:E});const u=await t.run(this.client,l,e.event_data,E);if(u.type==="void")c.forEach(C=>C());else if(u.type==="data")await this.handle_data(t.outputs,u.data),c.forEach(C=>C());else{let C=null;t.connection_type==="stream"&&!this.submissions.has(t.id)&&(C="waiting"),this.submissions.set(t.id,u.data);let P=0;e:for await(const _ of u.data)if(P===0&&t.inputs.forEach(H=>{this.update_state_cb(H,{loading_status:{validation_error:null}},!1)}),P+=1,_!==null){if(_.type==="data"&&await this.handle_data(t.outputs,_.data),_.type==="status"){_.original_msg==="process_starts"&&t.connection_type==="stream"&&(C="open");const{fn_index:H,...m}=_;if(_.stage==="complete"){C="closed",g.forEach(b=>{this.dispatch({type:"fn",fn_index:b,event_data:null,target_id:E})}),this.dispatch_state_change_events(_),this.loading_stati.update({...m,status:m.stage,fn_index:t.id,stream_state:C}),this.update_loading_stati_state();break e}else if(_.stage==="generating")this.dispatch_state_change_events(_),this.loading_stati.update({...m,status:m.stage,fn_index:t.id,stream_state:C}),this.update_loading_stati_state();else if(_.stage==="error"){if(_.broken||_.session_not_found){this.connection_lost||(this.connection_lost=!0,this.on_connection_lost_cb()),this.loading_stati.update({status:"complete",fn_index:t.id,stream_state:null}),this.update_loading_stati_state();break e}if(Array.isArray(_?.message)){_.message.forEach((x,S)=>{this.update_state_cb(t.inputs[S],{loading_status:{validation_error:x.is_valid?null:x.message,show_validation_error:!0}},!1)}),t.outputs.forEach(x=>{t.inputs.includes(x)||this.update_state_cb(x,{loading_status:{status:null}},!1)}),c.forEach(x=>x()),this.submissions.delete(t.id),this.queue.has(t.id)&&(this.queue.delete(t.id),this.dispatch(e));return}const b=_?.message?.replace(vi,(x,S)=>S);throw this.log_cb(_?._title??"Error",b||"",H,"error",m.duration,m.visible),new Error("Dependency function failed")}else this.loading_stati.update({...m,status:m.stage,fn_index:t.id,stream_state:C}),this.update_loading_stati_state()}if(_.type==="render"){this.loading_stati.update({status:"complete",fn_index:t.id,stream_state:null}),this.update_loading_stati_state();const{layout:H,components:m,render_id:b,dependencies:x}=_.data;this.rerender_cb(m,H);const{by_id:S,by_event:V}=this.create(x);this.register_loading_stati(S),S.forEach(L=>this.dependencies_by_fn.set(L.id,L)),V.forEach((L,ae)=>this.dependencies_by_event.set(ae,L));const D=this.render_id_deps.get(b);D&&D.forEach(L=>{S.has(L)||this.dependencies_by_fn.delete(L)}),this.render_id_deps.set(b,new Set(Array.from(S.keys()))),this.register_loading_stati(S);break e}_.type==="log"&&this.handle_log(_)}w.forEach(_=>{this.dispatch({type:"fn",fn_index:_,event_data:null,target_id:E})}),c.forEach(_=>_()),this.submissions.delete(t.id),this.queue.has(t.id)&&(this.queue.delete(t.id),this.dispatch(e))}}catch{this.loading_stati.update({status:"error",fn_index:t.id,eta:0,queue:!1,stream_state:null}),this.update_loading_stati_state(),this.submissions.delete(t.id),h.forEach(u=>{this.dispatch({type:"fn",fn_index:u,event_data:null})})}}}}create(e){const i=new Map,a=new Map,t=[];for(const n of e){const l=new pi(n);for(const[c,g]of n.targets)a.has(`${g}-${c}`)||a.set(`${g}-${c}`,[]),a.get(`${g}-${c}`)?.push(l);if(i.set(n.id,l),n.trigger_after!==void 0){const c=n.trigger_only_on_failure?"failure":n.trigger_only_on_success?"success":"all";t.push([n.id,n.trigger_after,c])}}for(const[n,l,c]of t){const g=i.get(l);g&&(g.add_trigger(n,c),g.original_trigger_id=xi(e,l))}return{by_id:i,by_event:a}}handle_log(e){const{title:i,log:a,fn_index:t,level:n,duration:l,visible:c}=e;this.log_cb(i,a,t,n,l,c)}async handle_data(e,i){await Promise.all(e.map(async(a,t)=>{const n=i[t]===void 0?nt:i[t];if(n!==nt)if(bi(n)){let l=!1,c=null;for(const[g,h]of Object.entries(n))if(g!=="__type__"){if(g==="visible"){l=!0,c=h;continue}await this.update_state_cb(e[t],{[g]:h},!1)}l&&await this.update_state_cb(e[t],{visible:c},!0)}else await this.update_state_cb(a,{value:n},!1)}))}async gather_state(e,i=[]){return(await Promise.all(e.map(a=>this.get_state_cb(a)))).map((a,t)=>i.includes(t)?a??null:a?.value??null)}async set_event_args(e,i){let a={};const t=await this.get_state_cb?.(e);if(!t)return()=>{};for(const[n]of Object.entries(i))a[n]=t?.[n]??null;return Object.keys(i).length===0?()=>{}:(await this.update_state_cb(e,i,!1),()=>{this.update_state_cb(e,a,!1)})}async cancel(e){if(e)for(const i of e){const a=this.submissions.get(i);if(a){await a.cancel(),this.loading_stati.update({status:"complete",fn_index:i,eta:0,queue:!1,stream_state:null}),this.update_loading_stati_state(),this.submissions.delete(i);const{failure:t,all:n}=this.dependencies_by_fn.get(i)?.get_triggers()||{failure:[],all:[]};t.forEach(l=>{this.dispatch({type:"fn",fn_index:l,event_data:null,target_id:i})}),n.forEach(l=>{this.dispatch({type:"fn",fn_index:l,event_data:null,target_id:i})})}}}dispatch_load_events(){this.dependencies_by_fn.forEach(e=>{e.targets.forEach(([i,a])=>{a==="load"&&this.dispatch({type:"fn",fn_index:e.id,event_data:null,target_id:i})})})}get_fns_from_targets(e){const i=[];return this.dependencies_by_event.forEach((a,t)=>{const[,n]=t.split("-");Number(n)===e&&a.forEach(l=>{i.push(l.id)})}),i}close_stream(e){const i=this.get_fns_from_targets(e);for(const a of i){const t=this.submissions.get(a);t&&(t.close_stream(),this.submissions.delete(a)),this.loading_stati.update({status:"complete",fn_index:a,eta:0,queue:!1,stream_state:"closed"})}this.update_loading_stati_state()}}function bi(o){return typeof o=="object"&&o!==null&&"__type__"in o&&o?.__type__==="update"}function wi(o,e){return e?o==="always_last"?"defer":o==="multiple"?"run":o==="once"?"skip":"run":"run"}function yi(o,e,i,a){const t=e?i===1:a===1;try{return new _t("__fn_args",` let result = await (${o})(...__fn_args); + if (typeof result === "undefined") return []; + return (${t} && !Array.isArray(result)) ? [result] : result;`)}catch(n){throw n}}function xi(o,e){let i=new Map,a=e,t=0;for(;t<100;){const n=i.get(a)||o.find(l=>l.id===a);if(!n||(i.set(n.id,n),n.trigger_after===null||n.trigger_after===void 0))break;a=n.trigger_after,t+=1}return a}var ki=W(" ",1),Ei=W(''),Ci=W('
    ·
    ',1),Si=W('
    ·
    ',1),Li=W('
    ·
    '),zi=W('
    '),Oi=W(''),Ri=W(''),Mi=W('
    ',1);function Ai(o,e){Fe(e,!0);const i=()=>it(ai,"$reactive_formatter",t),a=()=>it(Re,"$is_screen_recording",t),[t,n]=Bt();Ce(e,"render_complete",3,!1);let l=Ce(e,"ready",15,!1),c=Ce(e,"reload_count",11,0),g=Ce(e,"add_new_message",15);e.components.forEach(s=>{s.props.i18n||(s.props.i18n=i())});let h=be(Xe([])),w=null;function E(s,r,f){if(r==="share"){const{title:p,description:O}=f}else if(r==="error")K("Error",f,-1,r,10,!0);else if(r==="warning")K("Warning",f,-1,r,10,!0);else if(r==="info")K("Info",f,-1,r,10,!0);else if(r==="gradio_expand"||r==="gradio_tab_select"){const p=r==="gradio_expand"?s:f.component_id;u.render_previously_invisible_children(p)}else if(r=="clear_status")u.update_state(s,{loading_status:{}},!1),b.clear_loading_status(s);else if(r=="close_stream")b.close_stream(s);else if(r==="custom_button_click"){const p=f.id;C(p,"click",null)}else r==="select"&&s in u.initial_tabs&&(s=f.id),b.dispatch({type:"event",event_name:r,target_id:s,event_data:f})}let u=new Yt(e.components,e.layout,e.dependencies,{root:e.root,theme:e.theme_mode,version:e.version,api_prefix:e.api_prefix,max_file_size:e.max_file_size,autoscroll:e.autoscroll,fill_height:e.fill_height},e.app,i(),E);function C(s,r,f){b.dispatch({type:"event",event_name:r,target_id:s,event_data:f})}let P=be(Xe([])),_=be(null),H=s=>{F(_,s,!0),d(D)&&F(P,[...d(P),d(_)],!0)};function m(){F(h,d(h).filter(s=>s.type!=="error"),!0),++le,d(h).push({title:"Connection Lost",message:Oe,fn_index:-1,type:"error",id:le,duration:null,visible:!0}),w=setInterval(async()=>{try{const s=await e.app.reconnect();(s==="connected"||s==="changed")&&(clearInterval(w),w=null,window.location.reload())}catch(s){console.debug(s)}},2e3)}let b=new mi(e.dependencies,e.app,u.update_state.bind(u),u.get_state.bind(u),u.rerender.bind(u),K,H,m);lt(()=>{c(),jt(()=>{u.reload(e.components,e.layout,e.dependencies,{root:e.root,theme:e.theme_mode,version:e.version,api_prefix:e.api_prefix,max_file_size:e.max_file_size,autoscroll:e.autoscroll,fill_height:e.fill_height}),b.reload(e.dependencies,u.update_state.bind(u),u.get_state.bind(u),u.rerender.bind(u),e.app)})});let x=350,S=Me(()=>e.search_params.get("view")==="api"&&e.footer_links.includes("api")),V=Me(()=>e.search_params.get("view")==="settings"),D=Me(()=>e.search_params.get("view")==="api-recorder"&&e.footer_links.includes("api")),L=!0,ae=!0,G=null,B=null,J=null,ee=be(null);async function fe(){if(!G||!B){const s=await pe(()=>import("./ApiDocs-D66OUv1H.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]),import.meta.url),r=await pe(()=>import("./ApiRecorder-y0lpz3M9.js"),__vite__mapDeps([30,1,2,3,4,7,8,9,5,10,11,12,13,14,31]),import.meta.url);G||(G=s?.default),B||(B=r?.default)}}async function se(){B||(B=(await pe(()=>import("./ApiRecorder-y0lpz3M9.js"),__vite__mapDeps([30,1,2,3,4,7,8,9,5,10,11,12,13,14,31]),import.meta.url)).default)}async function ne(){J||(J=(await pe(()=>import("./Settings-Bwz4Nb_m.js"),__vite__mapDeps([32,1,2,3,4,6,11,8,12,33,22,16,17,18,19,34,35,36,37,38,39,40,26,41,42,23,24,15,20,25,27,28,43,44]),import.meta.url)).default)}async function re(){if(!d(ee)){const s=await pe(()=>import("./Index-C-RstoJU.js"),__vite__mapDeps([45,1,2,3,4,22,16,17,11,8,12,18,19,46,47,48,49,25,26,50,51,38,52,53,54,55,56,57,58]),import.meta.url);F(ee,s.default,!0)}}async function Q(s){F(D,!1),s&&await fe(),F(S,s);let r=new URLSearchParams(window.location.search);s?r.set("view","api"):r.delete("view"),history.replaceState(null,"","?"+r.toString())}async function oe(s){s&&await ne();let r=new URLSearchParams(window.location.search);s?r.set("view","settings"):r.delete("view"),history.replaceState(null,"","?"+r.toString()),F(V,!d(V))}function K(s,r,f,p,O=10,M=!1){M&&d(h).push({title:s,message:r,fn_index:f,type:p,id:++le,duration:O,visible:M})}g(K);let le=-1;i()("blocks.long_requests_queue"),i()("blocks.connection_can_break");const Oe="Connection to the server was lost. Attempting reconnection...";i()("blocks.waiting_for_inputs");let Re=Nt(!1),qe=0,ge;function Ue(){if("parentIFrame"in window){const s=ge.children[0].getBoundingClientRect();if(!s)return;window.parentIFrame?.size(s.bottom+qe+32)}}function Ve(){a()?ui():_i()}Ft(()=>{"parentIFrame"in window&&window.parentIFrame?.autoResize(!1);const s=new MutationObserver(Ue),r=new ResizeObserver(Ue);return s.observe(ge,{childList:!0,subtree:!0,attributes:!0}),r.observe(ge),u.ready.then(()=>{l(!0),b.dispatch_load_events()}),e.vibe_mode&&re(),()=>{s.disconnect(),r.disconnect(),w&&clearInterval(w)}});function ut(s){F(h,d(h).filter(r=>r.id!==s),!0)}var Ge=Mi();$t("zxu34v",s=>{var r=ki(),f=A(r);{var p=z=>{Pt(()=>{It.title=e.title??""})};k(f,z=>{e.control_page_title&&z(p)})}var O=y(f,2);{var M=z=>{var U=Z(),Ee=A(U);Wt(Ee,()=>``),v(z,U)};k(O,z=>{e.css&&z(M)})}v(s,r)});var ke=A(Ge);let Be;var he=I(ke);let Ne;var ft=I(he);Te(ft,{get node(){return u.root}}),q(he),dt(he,s=>ge=s,()=>ge);var Ze=y(he,2);{var gt=s=>{var r=Li(),f=I(r);{var p=R=>{var T=Ei(),te=I(T);{var de=j=>{var _e=Ye();Y(ve=>me(_e,ve),[()=>i()("errors.use_via_api_or_mcp")]),v(j,_e)},X=j=>{var _e=Ye();Y(ve=>me(_e,ve),[()=>i()("errors.use_via_api")]),v(j,_e)};k(te,j=>{e.app.config?.mcp_server?j(de):j(X,!1)})}var ce=y(te,2);q(T),Y(j=>{N(ce,"src",ni),N(ce,"alt",j)},[()=>i()("common.logo")]),ie("click",T,()=>{Q(!d(S))}),ie("mouseenter",T,()=>{fe(),se()}),v(R,T)};k(f,R=>{e.footer_links.includes("api")&&R(p)})}var O=y(f,2);{var M=R=>{var T=Ci(),te=y(A(T),2),de=I(te),X=y(de);q(te),Y((ce,j)=>{me(de,`${ce??""} `),N(X,"src",si),N(X,"alt",j)},[()=>i()("common.built_with_gradio"),()=>i()("common.logo")]),v(R,T)};k(O,R=>{e.footer_links.includes("gradio")&&R(M)})}var z=y(O,2);let U;var Ee=I(z),Qe=y(Ee);q(z);var xt=y(z,4);{var kt=R=>{var T=Si(),te=A(T);let de;var X=y(te,2),ce=I(X),j=y(ce);q(X),Y((_e,ve)=>{de=at(te,1,"divider svelte-zxu34v",null,de,{hidden:!a()}),me(ce,`${_e??""} `),N(j,"src",ri),N(j,"alt",ve)},[()=>i()("common.settings"),()=>i()("common.settings")]),ie("click",X,()=>{oe(!d(V))}),ie("mouseenter",X,()=>{ne()}),v(R,T)};k(xt,R=>{e.footer_links.includes("settings")&&R(kt)})}q(r),Y((R,T)=>{U=at(z,1,"record svelte-zxu34v",null,U,{hidden:!a()}),me(Ee,`${R??""} `),N(Qe,"src",oi),N(Qe,"alt",T)},[()=>i()("common.stop_recording"),()=>i()("common.stop_recording")]),ie("click",z,()=>{Ve()}),Ht(r,"clientHeight",R=>qe=R),v(s,r)};k(Ze,s=>{e.footer_links.length>0&&s(gt)})}var We=y(Ze,2);{var ht=s=>{var r=zi(),f=I(r);we(f,()=>B,(p,O)=>{O(p,{get api_calls(){return d(P)},get dependencies(){return e.dependencies}})}),q(r),ie("click",r,()=>{Q(!0),F(D,!1)}),v(s,r)};k(We,s=>{d(D)&&B&&s(ht)})}var He=y(We,2);{var vt=s=>{var r=Oi(),f=I(r),p=y(f,2),O=I(p);we(O,()=>G,(M,z)=>{z(M,{get root_node(){return u.root},get dependencies(){return e.dependencies},get root(){return e.root},get app(){return e.app},get space_id(){return e.space_id},get api_calls(){return d(P)},get username(){return e.username},get last_api_call(){return d(_)},$$events:{close:U=>{Q(!1),F(P,[],!0),F(D,F(D,U.detail?.api_recorder_visible))}}})}),q(p),q(r),Y(M=>N(r,"aria-label",M),[()=>i()("errors.use_via_api")]),ie("click",f,()=>{Q(!1)}),v(s,r)};k(He,s=>{d(S)&&u.root&&G&&s(vt)})}var Je=y(He,2);{var pt=s=>{var r=Ri(),f=I(r),p=y(f,2),O=I(p);we(O,()=>J,(M,z)=>{z(M,{onclose:()=>{oe(!1)},start_recording:()=>{Ve()},get pwa_enabled(){return e.app.config.pwa},get root(){return e.root},get space_id(){return e.space_id},get i18n(){return i()},get allow_zoom(){return L},set allow_zoom(U){L=U},get allow_video_trim(){return ae},set allow_video_trim(U){ae=U}})}),q(p),q(r),Y(M=>N(r,"aria-label",M),[()=>i()("common.settings")]),ie("click",f,()=>{oe(!1)}),v(s,r)};k(Je,s=>{d(V)&&e.app.config&&u.root&&J&&s(pt)})}var mt=y(Je,2);{var bt=s=>{var r=Z(),f=A(r);we(f,()=>d(ee),(p,O)=>{O(p,{get app(){return e.app},get root(){return e.root}})}),v(s,r)};k(mt,s=>{e.vibe_mode&&d(ee)&&s(bt)})}q(ke);var wt=y(ke,2);{var yt=s=>{Qt(s,{get messages(){return d(h)},on_close:ut})};k(wt,s=>{d(h)&&s(yt)})}Y(()=>{Be=tt(ke,"",Be,{"min-height":e.app_mode?"100%":"auto"}),Ne=tt(he,"",Ne,{"flex-grow":e.app_mode?"1":"auto","margin-right":e.vibe_mode?`${x}px`:"0"})}),v(o,Ge),Pe(),n()}const Gi=Object.freeze(Object.defineProperty({__proto__:null,default:Ai},Symbol.toStringTag,{value:"Module"}));export{Gi as B,ni as a,si as g,ri as s}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BokehPlot-BBQZH3vU.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BokehPlot-BBQZH3vU.js new file mode 100644 index 0000000000000000000000000000000000000000..064fc6a86326d2ea8f12960c25afccf2f474538b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BokehPlot-BBQZH3vU.js @@ -0,0 +1 @@ +import{p as b,e as S,a as k}from"./i18n-Dnhn5Rxr.js";import{R as x,ae as P,a1 as f,G as D,w as n,a2 as I,t as M,a as O,T,a3 as g,U as v,W as q,x as y}from"./index-DWyDLubb.js";var z=q('
    ');function J(w,r){x(r,!1);const i=g();let o=b(r,"value",12),t=b(r,"bokeh_version",12);const s=`bokehDiv-${Math.random().toString(5).substring(2)}`;async function j(e){if(document&&document.getElementById(s)&&(document.getElementById(s).innerHTML=""),window.Bokeh){u();let l=JSON.parse(e);await window.Bokeh.embed.embed_item(l,s)}}const h=`https://cdn.bokeh.org/bokeh/release/bokeh-${t()}.min.js`,B=[`https://cdn.pydata.org/bokeh/release/bokeh-widgets-${t()}.min.js`,`https://cdn.pydata.org/bokeh/release/bokeh-tables-${t()}.min.js`,`https://cdn.pydata.org/bokeh/release/bokeh-gl-${t()}.min.js`,`https://cdn.pydata.org/bokeh/release/bokeh-api-${t()}.min.js`];let d=g(!1);async function E(){await Promise.all(B.map((e,l)=>new Promise(C=>{const a=document.createElement("script");return a.onload=C,a.src=e,document.head.appendChild(a),a}))),y(d,!0)}let p=[];function m(){p=E()}function u(){const e=document.createElement("script");return e.onload=m,e.src=h,document.head.querySelector(`script[src="${h}"]`)?m():document.head.appendChild(e),e}const _=t()?u():null;P(()=>{_ in document.children&&(document.removeChild(_),p.forEach(e=>document.removeChild(e)))}),f(()=>D(o()),()=>{y(i,o()?.plot)}),f(()=>(n(d),n(i)),()=>{n(d)&&j(n(i))}),I();var $={get value(){return o()},set value(e){o(e),v()},get bokeh_version(){return t()},set bokeh_version(e){t(e),v()}};S();var c=z();return k(c,"data-testid","bokeh"),M(()=>k(c,"id",s)),O(w,c),T($)}export{J as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BokehPlot-DTqQzqHn.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BokehPlot-DTqQzqHn.css new file mode 100644 index 0000000000000000000000000000000000000000..4cbf6bbe94ef2215e4fcbb7342312a3a0ad4e6a7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/BokehPlot-DTqQzqHn.css @@ -0,0 +1 @@ +.gradio-bokeh.svelte-dz29a8{display:flex;justify-content:center} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Button-BZ4d-rtD.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Button-BZ4d-rtD.css new file mode 100644 index 0000000000000000000000000000000000000000..496367b859c6885e97440db6d78db287313e6b75 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Button-BZ4d-rtD.css @@ -0,0 +1 @@ +button.svelte-xzq5jh,a.svelte-xzq5jh{display:inline-flex;justify-content:center;align-items:center;transition:var(--button-transition);padding:var(--size-0-5) var(--size-2);text-align:center}button.svelte-xzq5jh:hover{transform:var(--button-transform-hover)}button.svelte-xzq5jh:active,a.svelte-xzq5jh:active{transform:var(--button-transform-active)}button[disabled].svelte-xzq5jh,a.disabled.svelte-xzq5jh{opacity:.5;filter:grayscale(30%);cursor:not-allowed;transform:none}.hidden.svelte-xzq5jh{display:none}.primary.svelte-xzq5jh{border:var(--button-border-width) solid var(--button-primary-border-color);background:var(--button-primary-background-fill);color:var(--button-primary-text-color);box-shadow:var(--button-primary-shadow)}.primary.svelte-xzq5jh:hover,.primary[disabled].svelte-xzq5jh{background:var(--button-primary-background-fill-hover);color:var(--button-primary-text-color-hover)}.primary.svelte-xzq5jh:hover{border-color:var(--button-primary-border-color-hover);box-shadow:var(--button-primary-shadow-hover)}.primary.svelte-xzq5jh:active{box-shadow:var(--button-primary-shadow-active)}.primary[disabled].svelte-xzq5jh{border-color:var(--button-primary-border-color)}.secondary.svelte-xzq5jh{border:var(--button-border-width) solid var(--button-secondary-border-color);background:var(--button-secondary-background-fill);color:var(--button-secondary-text-color);box-shadow:var(--button-secondary-shadow)}.secondary.svelte-xzq5jh:hover,.secondary[disabled].svelte-xzq5jh{background:var(--button-secondary-background-fill-hover);color:var(--button-secondary-text-color-hover)}.secondary.svelte-xzq5jh:hover{border-color:var(--button-secondary-border-color-hover);box-shadow:var(--button-secondary-shadow-hover)}.secondary.svelte-xzq5jh:active{box-shadow:var(--button-secondary-shadow-active)}.secondary[disabled].svelte-xzq5jh{border-color:var(--button-secondary-border-color)}.stop.svelte-xzq5jh{background:var(--button-cancel-background-fill);color:var(--button-cancel-text-color);border:var(--button-border-width) solid var(--button-cancel-border-color);box-shadow:var(--button-cancel-shadow)}.stop.svelte-xzq5jh:hover,.stop[disabled].svelte-xzq5jh{background:var(--button-cancel-background-fill-hover)}.stop.svelte-xzq5jh:hover{border-color:var(--button-cancel-border-color-hover);box-shadow:var(--button-cancel-shadow-hover)}.stop.svelte-xzq5jh:active{box-shadow:var(--button-cancel-shadow-active)}.stop[disabled].svelte-xzq5jh{border-color:var(--button-cancel-border-color)}.sm.svelte-xzq5jh{border-radius:var(--button-small-radius);padding:var(--button-small-padding);font-weight:var(--button-small-text-weight);font-size:var(--button-small-text-size)}.md.svelte-xzq5jh{border-radius:var(--button-medium-radius);padding:var(--button-medium-padding);font-weight:var(--button-medium-text-weight);font-size:var(--button-medium-text-size)}.lg.svelte-xzq5jh{border-radius:var(--button-large-radius);padding:var(--button-large-padding);font-weight:var(--button-large-text-weight);font-size:var(--button-large-text-size)}.button-icon{width:var(--text-xl);height:var(--text-xl)}.button-icon.right-padded{margin-right:var(--spacing-md)}.huggingface.svelte-xzq5jh{background:#141c2e;color:#fff}.huggingface.svelte-xzq5jh:hover{background:#283042;color:#fff} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Button-D-_s2ksk.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Button-D-_s2ksk.js new file mode 100644 index 0000000000000000000000000000000000000000..a7b4ba8a667623b80bd5315a849bceba6bd1dcbd --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Button-D-_s2ksk.js @@ -0,0 +1 @@ +import{p as x,i as m,a as n,b as y,f as j}from"./i18n-Dnhn5Rxr.js";import{R as A,a6 as h,S as b,a as _,T as C,aj as D,V as z,X as q,Y as B,t as I,W as S,w as o,a5 as g}from"./index-DWyDLubb.js";import{s as P}from"./snippet-BWgYNF9D.js";import{I as R}from"./Image-CeW7PJs4.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";/* empty css */var E=S(" "),F=S("");function N(T,e){A(e,!0);let k=x(e,"elem_classes",19,()=>[]),V=x(e,"onclick",3,()=>{});var w=h(),W=b(w);{var X=l=>{var a=E();let d,c;var s=z(a);{var v=t=>{{let i=g(()=>({alt:`${e.value} icon`,class:"button-icon"}));R(t,{get src(){return e.icon.url},get restProps(){return o(i)}})}};m(s,t=>{e.icon&&t(v)})}var f=q(s,2);{var u=t=>{var i=h(),r=b(i);P(r,()=>e.children),_(t,i)};m(f,t=>{e.children&&t(u)})}B(a),I(t=>{n(a,"href",e.link),n(a,"target",e.link_target),n(a,"rel",e.link_target==="_blank"?"noopener noreferrer":void 0),n(a,"aria-disabled",e.disabled),d=y(a,1,`${e.size??""} ${e.variant??""} ${t??""}`,"svelte-xzq5jh",d,{hidden:e.visible===!1||e.visible==="hidden",disabled:e.disabled}),n(a,"id",e.elem_id),c=j(a,"",c,{"flex-grow":e.scale,"pointer-events":e.disabled?"none":null,width:e.scale===0?"fit-content":null,"min-width":typeof e.min_width=="number"?`calc(min(${e.min_width}px, 100%))`:null})},[()=>k().join(" ")]),_(l,a)},Y=l=>{var a=F();a.__click=function(...t){V()?.apply(this,t)};let d,c;var s=z(a);{var v=t=>{{let i=g(()=>({alt:`${e.value} icon`})),r=g(()=>[`button-icon ${e.value?"right-padded":""}`]);R(t,{get restProps(){return o(i)},get class_names(){return o(r)},get src(){return e.icon.url}})}};m(s,t=>{e.icon&&t(v)})}var f=q(s,2);{var u=t=>{var i=h(),r=b(i);P(r,()=>e.children),_(t,i)};m(f,t=>{e.children&&t(u)})}B(a),I(t=>{d=y(a,1,`${e.size??""} ${e.variant??""} ${t??""}`,"svelte-xzq5jh",d,{hidden:e.visible===!1||e.visible==="hidden"}),n(a,"id",e.elem_id),a.disabled=e.disabled,c=j(a,"",c,{"flex-grow":e.scale,width:e.scale===0?"fit-content":null,"min-width":typeof e.min_width=="number"?`calc(min(${e.min_width}px, 100%))`:null})},[()=>k().join(" ")]),_(l,a)};m(W,l=>{e.link&&e.link.length>0?l(X):l(Y,!1)})}_(T,w),C()}D(["click"]);export{N as B}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Canvas3D-DomR9yf1.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Canvas3D-DomR9yf1.js new file mode 100644 index 0000000000000000000000000000000000000000..028f37b66b3d87a3d69ffd943b7df9d533b8d948 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Canvas3D-DomR9yf1.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css"])))=>i.map(i=>d[i]); +import{R as P,aa as I,y as M,w as a,a as R,T as V,a5 as g,u as o,W as x,af as A,x as u}from"./index-DWyDLubb.js";import{d as O}from"./i18n-Dnhn5Rxr.js";var E=x("");function S(h,r){P(r,!0);let d,w=g(()=>r.value.url),l,n=o(void 0),s=o(void 0),f=o(!1);I(()=>((async()=>(d=await A(()=>import("./index-CDrXokXW.js").then(t=>t.cx),__vite__mapDeps([0,1,2]),import.meta.url),d.CreateViewerForCanvas(l,{clearColor:r.clear_color,useRightHandedSystem:!0,animationAutoPlay:!0,cameraAutoOrbit:{enabled:!1},onInitialized:t=>{u(s,t,!0)}}).then(t=>{u(n,t,!0),u(f,!0)})))(),()=>{a(n)?.dispose()})),M(()=>{a(f)&&b(a(w))});function c(e,t){a(s)&&(a(s).scene.forcePointsCloud=e,a(s).scene.forceWireframe=t)}function b(e){a(n)&&(e?a(n).loadModel(e,{pluginOptions:{obj:{importVertexColors:!0}}}).then(()=>{r.display_mode==="point_cloud"?c(!0,!1):r.display_mode==="wireframe"?c(!1,!0):m(r.camera_position,r.zoom_speed,r.pan_speed)}):a(n).resetModel())}function m(e,t,y){if(!a(s))return;const i=a(s).camera;e[0]!==null&&(i.alpha=e[0]*Math.PI/180),e[1]!==null&&(i.beta=e[1]*Math.PI/180),e[2]!==null&&(i.radius=e[2]),i.lowerRadiusLimit=.1;const v=()=>{i.wheelPrecision=250/(i.radius*t),i.panningSensibility=1e4*y/i.radius};v(),i.onAfterCheckInputsObservable.add(v)}function p(){a(s)&&a(n)&&a(n).resetCamera()}var C={update_camera:m,reset_camera_position:p},_=E();return O(_,e=>l=e,()=>l),R(h,_),V(C)}export{S as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Canvas3DGS-DEcXVidd.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Canvas3DGS-DEcXVidd.js new file mode 100644 index 0000000000000000000000000000000000000000..245068f0d45187e0777852ff8143ef0e8d47b6ff --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Canvas3DGS-DEcXVidd.js @@ -0,0 +1,151 @@ +import{d as It}from"./i18n-Dnhn5Rxr.js";import{R as lt,aa as dt,y as ht,a as Rt,T as ct,W as Et,x as St,u as Jt,w as tt,a5 as At}from"./index-DWyDLubb.js";class h{constructor(t=0,e=0,A=0){this.x=t,this.y=e,this.z=A}equals(t){return!(this.x!==t.x||this.y!==t.y||this.z!==t.z)}add(t){return typeof t=="number"?new h(this.x+t,this.y+t,this.z+t):new h(this.x+t.x,this.y+t.y,this.z+t.z)}subtract(t){return typeof t=="number"?new h(this.x-t,this.y-t,this.z-t):new h(this.x-t.x,this.y-t.y,this.z-t.z)}multiply(t){return typeof t=="number"?new h(this.x*t,this.y*t,this.z*t):t instanceof h?new h(this.x*t.x,this.y*t.y,this.z*t.z):new h(this.x*t.buffer[0]+this.y*t.buffer[4]+this.z*t.buffer[8]+t.buffer[12],this.x*t.buffer[1]+this.y*t.buffer[5]+this.z*t.buffer[9]+t.buffer[13],this.x*t.buffer[2]+this.y*t.buffer[6]+this.z*t.buffer[10]+t.buffer[14])}divide(t){return typeof t=="number"?new h(this.x/t,this.y/t,this.z/t):new h(this.x/t.x,this.y/t.y,this.z/t.z)}cross(t){const e=this.y*t.z-this.z*t.y,A=this.z*t.x-this.x*t.z,Q=this.x*t.y-this.y*t.x;return new h(e,A,Q)}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lerp(t,e){return new h(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e,this.z+(t.z-this.z)*e)}min(t){return new h(Math.min(this.x,t.x),Math.min(this.y,t.y),Math.min(this.z,t.z))}max(t){return new h(Math.max(this.x,t.x),Math.max(this.y,t.y),Math.max(this.z,t.z))}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error(`Invalid component index: ${t}`)}}minComponent(){return this.xthis.y&&this.x>this.z?0:this.y>this.z?1:2}magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}distanceTo(t){return Math.sqrt((this.x-t.x)**2+(this.y-t.y)**2+(this.z-t.z)**2)}normalize(){const t=this.magnitude();return new h(this.x/t,this.y/t,this.z/t)}flat(){return[this.x,this.y,this.z]}clone(){return new h(this.x,this.y,this.z)}toString(){return`[${this.flat().join(", ")}]`}static One(t=1){return new h(t,t,t)}}class f{constructor(t=0,e=0,A=0,Q=1){this.x=t,this.y=e,this.z=A,this.w=Q}equals(t){return!(this.x!==t.x||this.y!==t.y||this.z!==t.z||this.w!==t.w)}normalize(){const t=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return new f(this.x/t,this.y/t,this.z/t,this.w/t)}multiply(t){const e=this.w,A=this.x,Q=this.y,s=this.z,n=t.w,U=t.x,F=t.y,i=t.z;return new f(e*U+A*n+Q*i-s*F,e*F-A*i+Q*n+s*U,e*i+A*F-Q*U+s*n,e*n-A*U-Q*F-s*i)}inverse(){const t=this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w;return new f(-this.x/t,-this.y/t,-this.z/t,this.w/t)}apply(t){const e=new f(t.x,t.y,t.z,0),A=new f(-this.x,-this.y,-this.z,this.w),Q=this.multiply(e).multiply(A);return new h(Q.x,Q.y,Q.z)}flat(){return[this.x,this.y,this.z,this.w]}clone(){return new f(this.x,this.y,this.z,this.w)}static FromEuler(t){const e=t.x/2,A=t.y/2,Q=t.z/2,s=Math.cos(A),n=Math.sin(A),U=Math.cos(e),F=Math.sin(e),i=Math.cos(Q),l=Math.sin(Q);return new f(s*F*i+n*U*l,n*U*i-s*F*l,s*U*l-n*F*i,s*U*i+n*F*l)}toEuler(){const t=2*(this.w*this.x+this.y*this.z),e=1-2*(this.x*this.x+this.y*this.y),A=Math.atan2(t,e);let Q;const s=2*(this.w*this.y-this.z*this.x);Math.abs(s)>=1?Q=Math.sign(s)*Math.PI/2:Q=Math.asin(s);const n=2*(this.w*this.z+this.x*this.y),U=1-2*(this.y*this.y+this.z*this.z),F=Math.atan2(n,U);return new h(A,Q,F)}static FromMatrix3(t){const e=t.buffer,A=e[0]+e[4]+e[8];let Q,s,n,U;if(A>0){const F=.5/Math.sqrt(A+1);U=.25/F,Q=(e[7]-e[5])*F,s=(e[2]-e[6])*F,n=(e[3]-e[1])*F}else if(e[0]>e[4]&&e[0]>e[8]){const F=2*Math.sqrt(1+e[0]-e[4]-e[8]);U=(e[7]-e[5])/F,Q=.25*F,s=(e[1]+e[3])/F,n=(e[2]+e[6])/F}else if(e[4]>e[8]){const F=2*Math.sqrt(1+e[4]-e[0]-e[8]);U=(e[2]-e[6])/F,Q=(e[1]+e[3])/F,s=.25*F,n=(e[5]+e[7])/F}else{const F=2*Math.sqrt(1+e[8]-e[0]-e[4]);U=(e[3]-e[1])/F,Q=(e[2]+e[6])/F,s=(e[5]+e[7])/F,n=.25*F}return new f(Q,s,n,U)}static FromAxisAngle(t,e){const A=e/2,Q=Math.sin(A),s=Math.cos(A);return new f(t.x*Q,t.y*Q,t.z*Q,s)}static LookRotation(t){const e=new h(0,0,1),A=e.dot(t);if(Math.abs(A- -1)<1e-6)return new f(0,1,0,Math.PI);if(Math.abs(A-1)<1e-6)return new f;const Q=Math.acos(A),s=e.cross(t).normalize();return f.FromAxisAngle(s,Q)}toString(){return`[${this.flat().join(", ")}]`}}class it{constructor(){const t=new Map;this.addEventListener=(e,A)=>{t.has(e)||t.set(e,new Set),t.get(e).add(A)},this.removeEventListener=(e,A)=>{t.has(e)&&t.get(e).delete(A)},this.hasEventListener=(e,A)=>t.has(e)?t.get(e).has(A):!1,this.dispatchEvent=e=>{if(t.has(e.type))for(const A of t.get(e.type))A(e)}}}class X{constructor(t=1,e=0,A=0,Q=0,s=0,n=1,U=0,F=0,i=0,l=0,d=1,B=0,r=0,C=0,I=0,a=1){this.buffer=[t,e,A,Q,s,n,U,F,i,l,d,B,r,C,I,a]}equals(t){if(this.buffer.length!==t.buffer.length)return!1;if(this.buffer===t.buffer)return!0;for(let e=0;e{},this.applyPosition=()=>{this.position=new h},this.applyRotation=()=>{this.rotation=new f},this.applyScale=()=>{this.scale=new h(1,1,1)},this.raiseChangeEvent=()=>{this.dispatchEvent(this._changeEvent)}}_updateMatrix(){this._transform=X.Compose(this._position,this._rotation,this._scale)}get position(){return this._position}set position(t){this._position.equals(t)||(this._position=t,this.positionChanged=!0,this._updateMatrix(),this.dispatchEvent(this._changeEvent))}get rotation(){return this._rotation}set rotation(t){this._rotation.equals(t)||(this._rotation=t,this.rotationChanged=!0,this._updateMatrix(),this.dispatchEvent(this._changeEvent))}get scale(){return this._scale}set scale(t){this._scale.equals(t)||(this._scale=t,this.scaleChanged=!0,this._updateMatrix(),this.dispatchEvent(this._changeEvent))}get forward(){let t=new h(0,0,1);return t=this.rotation.apply(t),t}get transform(){return this._transform}}class j{constructor(t=1,e=0,A=0,Q=0,s=1,n=0,U=0,F=0,i=1){this.buffer=[t,e,A,Q,s,n,U,F,i]}equals(t){if(this.buffer.length!==t.buffer.length)return!1;if(this.buffer===t.buffer)return!0;for(let e=0;e{for(let U=0;U{const U=j.RotationFromQuaternion(n).buffer;for(let F=0;F{for(let U=0;U{const n=new Uint8Array(this.vertexCount*K.RowLength),U=new Float32Array(n.buffer),F=new Uint8Array(n.buffer);for(let i=0;i{console.assert(n.byteLength===this.vertexCount*3*4,`Expected ${this.vertexCount*3*4} bytes, got ${n.byteLength} bytes`),this._positions=new Float32Array(n),this._rotations=new Float32Array(U),this._scales=new Float32Array(F),this._colors=new Uint8Array(i),this._selection=new Uint8Array(l),this.detached=!1}}static{this.RowLength=32}static Deserialize(t){const e=t.length/K.RowLength,A=new Float32Array(3*e),Q=new Float32Array(4*e),s=new Float32Array(3*e),n=new Uint8Array(4*e),U=new Float32Array(t.buffer),F=new Uint8Array(t.buffer);for(let i=0;i=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}intersects(t){return this.max.x>=t.min.x&&this.min.x<=t.max.x&&this.max.y>=t.min.y&&this.min.y<=t.max.y&&this.max.z>=t.min.z&&this.min.z<=t.max.z}size(){return this.max.subtract(this.min)}center(){return this.min.add(this.max).divide(2)}expand(t){this.min=this.min.min(t),this.max=this.max.max(t)}permute(){const t=this.min,e=this.max;this.min=new h(Math.min(t.x,e.x),Math.min(t.y,e.y),Math.min(t.z,e.z)),this.max=new h(Math.max(t.x,e.x),Math.max(t.y,e.y),Math.max(t.z,e.z))}}class H extends st{constructor(t=void 0){super(),this.selectedChanged=!1,this.colorTransformChanged=!1,this._selected=!1,this._colorTransforms=[],this._colorTransformsMap=new Map,this._data=t||new K,this._bounds=new Qt(new h(1/0,1/0,1/0),new h(-1/0,-1/0,-1/0)),this.recalculateBounds=()=>{this._bounds=new Qt(new h(1/0,1/0,1/0),new h(-1/0,-1/0,-1/0));for(let e=0;e{this.data.translate(this.position),this.position=new h},this.applyRotation=()=>{this.data.rotate(this.rotation),this.rotation=new f},this.applyScale=()=>{this.data.scale(this.scale),this.scale=new h(1,1,1)},this.recalculateBounds()}saveToFile(t=null,e="splat"){if(!document)return;if(!t){const U=new Date;t=`splat-${U.getFullYear()}-${U.getMonth()+1}-${U.getDate()}.${e}`}const A=this.clone();A.applyRotation(),A.applyScale(),A.applyPosition();const Q=A.data.serialize();let s;if(e==="ply"){const U=et.SplatToPLY(Q.buffer,A.data.vertexCount);s=new Blob([U],{type:"application/octet-stream"})}else s=new Blob([Q.buffer],{type:"application/octet-stream"});const n=document.createElement("a");n.download=t,n.href=URL.createObjectURL(s),n.click()}get data(){return this._data}get selected(){return this._selected}set selected(t){this._selected!==t&&(this._selected=t,this.selectedChanged=!0,this.dispatchEvent(this._changeEvent))}get colorTransforms(){return this._colorTransforms}get colorTransformsMap(){return this._colorTransformsMap}get bounds(){let t=this._bounds.center();t=t.add(this.position);let e=this._bounds.size();return e=e.multiply(this.scale),new Qt(t.subtract(e.divide(2)),t.add(e.divide(2)))}clone(){const t=new H(this.data.clone());return t.position=this.position.clone(),t.rotation=this.rotation.clone(),t.scale=this.scale.clone(),t}}class ut{constructor(){this._fx=1132,this._fy=1132,this._near=.1,this._far=100,this._width=512,this._height=512,this._projectionMatrix=new X,this._viewMatrix=new X,this._viewProj=new X,this._updateProjectionMatrix=()=>{this._projectionMatrix=new X(2*this.fx/this.width,0,0,0,0,-2*this.fy/this.height,0,0,0,0,this.far/(this.far-this.near),1,0,0,-(this.far*this.near)/(this.far-this.near),0),this._viewProj=this.projectionMatrix.multiply(this.viewMatrix)},this.update=(t,e)=>{const A=j.RotationFromQuaternion(e).buffer,Q=t.flat();this._viewMatrix=new X(A[0],A[1],A[2],0,A[3],A[4],A[5],0,A[6],A[7],A[8],0,-Q[0]*A[0]-Q[1]*A[3]-Q[2]*A[6],-Q[0]*A[1]-Q[1]*A[4]-Q[2]*A[7],-Q[0]*A[2]-Q[1]*A[5]-Q[2]*A[8],1),this._viewProj=this.projectionMatrix.multiply(this.viewMatrix)},this.setSize=(t,e)=>{this._width=t,this._height=e,this._updateProjectionMatrix()}}get fx(){return this._fx}set fx(t){this._fx!==t&&(this._fx=t,this._updateProjectionMatrix())}get fy(){return this._fy}set fy(t){this._fy!==t&&(this._fy=t,this._updateProjectionMatrix())}get near(){return this._near}set near(t){this._near!==t&&(this._near=t,this._updateProjectionMatrix())}get far(){return this._far}set far(t){this._far!==t&&(this._far=t,this._updateProjectionMatrix())}get width(){return this._width}get height(){return this._height}get projectionMatrix(){return this._projectionMatrix}get viewMatrix(){return this._viewMatrix}get viewProj(){return this._viewProj}}class v{constructor(t=0,e=0,A=0,Q=0){this.x=t,this.y=e,this.z=A,this.w=Q}equals(t){return!(this.x!==t.x||this.y!==t.y||this.z!==t.z||this.w!==t.w)}add(t){return typeof t=="number"?new v(this.x+t,this.y+t,this.z+t,this.w+t):new v(this.x+t.x,this.y+t.y,this.z+t.z,this.w+t.w)}subtract(t){return typeof t=="number"?new v(this.x-t,this.y-t,this.z-t,this.w-t):new v(this.x-t.x,this.y-t.y,this.z-t.z,this.w-t.w)}multiply(t){return typeof t=="number"?new v(this.x*t,this.y*t,this.z*t,this.w*t):t instanceof v?new v(this.x*t.x,this.y*t.y,this.z*t.z,this.w*t.w):new v(this.x*t.buffer[0]+this.y*t.buffer[4]+this.z*t.buffer[8]+this.w*t.buffer[12],this.x*t.buffer[1]+this.y*t.buffer[5]+this.z*t.buffer[9]+this.w*t.buffer[13],this.x*t.buffer[2]+this.y*t.buffer[6]+this.z*t.buffer[10]+this.w*t.buffer[14],this.x*t.buffer[3]+this.y*t.buffer[7]+this.z*t.buffer[11]+this.w*t.buffer[15])}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lerp(t,e){return new v(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e,this.z+(t.z-this.z)*e,this.w+(t.w-this.w)*e)}magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}distanceTo(t){return Math.sqrt((this.x-t.x)**2+(this.y-t.y)**2+(this.z-t.z)**2+(this.w-t.w)**2)}normalize(){const t=this.magnitude();return new v(this.x/t,this.y/t,this.z/t,this.w/t)}flat(){return[this.x,this.y,this.z,this.w]}clone(){return new v(this.x,this.y,this.z,this.w)}toString(){return`[${this.flat().join(", ")}]`}}class Nt extends st{constructor(t=void 0){super(),this._data=t||new ut,this._position=new h(0,0,-5),this.update=()=>{this.data.update(this.position,this.rotation)},this.screenPointToRay=(e,A)=>{const Q=new v(e,A,-1,1),s=this._data.projectionMatrix.invert(),n=Q.multiply(s),U=this._data.viewMatrix.invert(),F=n.multiply(U);return new h(F.x/F.w,F.y/F.w,F.z/F.w).subtract(this.position).normalize()}}get data(){return this._data}}class Wt extends it{constructor(){super(),this._objects=[],this.addObject=t=>{this.objects.push(t),this.dispatchEvent(new Vt(t))},this.removeObject=t=>{const e=this.objects.indexOf(t);if(e<0)throw new Error("Object not found in scene");this.objects.splice(e,1),this.dispatchEvent(new Zt(t))},this.findObject=t=>{for(const e of this.objects)if(t(e))return e},this.findObjectOfType=t=>{for(const e of this.objects)if(e instanceof t)return e},this.reset=()=>{const t=this.objects.slice();for(const e of t)this.removeObject(e)},this.reset()}getMergedSceneDataBuffer(t="splat"){const e=[];let A=0;for(const n of this.objects)if(n instanceof H){const U=n.clone();U.applyRotation(),U.applyScale(),U.applyPosition();const F=U.data.serialize();e.push(F),A+=U.data.vertexCount}const Q=new Uint8Array(A*K.RowLength);let s=0;for(const n of e)Q.set(n,s),s+=n.length;return t==="ply"?et.SplatToPLY(Q.buffer,A):Q.buffer}saveToFile(t=null,e="splat"){if(!document)return;if(!t){const n=new Date;t=`scene-${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}.${e}`}const A=this.getMergedSceneDataBuffer(e),Q=new Blob([A],{type:"application/octet-stream"}),s=document.createElement("a");s.download=t,s.href=URL.createObjectURL(Q),s.click()}get objects(){return this._objects}}async function Bt(E,t){const e=await fetch(E,{mode:"cors",credentials:"omit",cache:t?"force-cache":"default"});if(e.status!=200)throw new Error(e.status+" Unable to load "+e.url);return e}async function ot(E,t){const e=E.body.getReader(),A=E.headers.get("content-length"),Q=A&&!isNaN(parseInt(A))?parseInt(A):void 0,s=[];let n=0;for(;;){const{done:i,value:l}=await e.read();if(i)break;if(s.push(l),n+=l.length,t&&Q){const d=n/Q,B=Math.min(d*.95,.95);t(B)}}const U=new Uint8Array(n);let F=0;for(const i of s)U.set(i,F),F+=i.length;return t&&t(1),U}class Dt{static async LoadAsync(t,e,A,Q=!1){const s=await Bt(t,Q),n=await ot(s,A);return this.LoadFromArrayBuffer(n.buffer,e)}static async LoadFromFileAsync(t,e,A){const Q=new FileReader;let s=new H;return Q.onload=n=>{s=this.LoadFromArrayBuffer(n.target.result,e)},Q.onprogress=n=>{A?.(n.loaded/n.total)},Q.readAsArrayBuffer(t),await new Promise(n=>{Q.onloadend=()=>{n()}}),s}static LoadFromArrayBuffer(t,e){const A=new Uint8Array(t),Q=K.Deserialize(A),s=new H(Q);return e.addObject(s),s}}class pt{static async LoadAsync(t,e,A,Q="",s=!1){const n=await Bt(t,s),U=await ot(n,A);if(U[0]!==112||U[1]!==108||U[2]!==121||U[3]!==10)throw new Error("Invalid PLY file");return this.LoadFromArrayBuffer(U.buffer,e,Q)}static async LoadFromFileAsync(t,e,A,Q=""){const s=new FileReader;let n=new H;return s.onload=U=>{n=this.LoadFromArrayBuffer(U.target.result,e,Q)},s.onprogress=U=>{A?.(U.loaded/U.total)},s.readAsArrayBuffer(t),await new Promise(U=>{s.onloadend=()=>{U()}}),n}static LoadFromArrayBuffer(t,e,A=""){const Q=new Uint8Array(this._ParsePLYBuffer(t,A)),s=K.Deserialize(Q),n=new H(s);return e.addObject(n),n}static _ParsePLYBuffer(t,e){const A=new Uint8Array(t),Q=new TextDecoder().decode(A.slice(0,1024*10)),s=`end_header +`,n=Q.indexOf(s);if(n<0)throw new Error("Unable to read .ply file header");const U=parseInt(/element vertex (\d+)\n/.exec(Q)[1]);let F=0;const i={double:8,int:4,uint:4,float:4,short:2,ushort:2,uchar:1},l=[];for(const C of Q.slice(0,n).split(` +`).filter(I=>I.startsWith("property "))){const[I,a,R]=C.split(" ");if(l.push({name:R,type:a,offset:F}),!i[a])throw new Error(`Unsupported property type: ${a}`);F+=i[a]}const d=new DataView(t,n+s.length),B=new ArrayBuffer(K.RowLength*U),r=f.FromEuler(new h(Math.PI/2,0,0));for(let C=0;C{let V;switch(y.type){case"float":V=d.getFloat32(y.offset+C*F,!0);break;case"int":V=d.getInt32(y.offset+C*F,!0);break;default:throw new Error(`Unsupported property type: ${y.type}`)}switch(y.name){case"x":I[0]=V;break;case"y":I[1]=V;break;case"z":I[2]=V;break;case"scale_0":case"scaling_0":a[0]=Math.exp(V);break;case"scale_1":case"scaling_1":a[1]=Math.exp(V);break;case"scale_2":case"scaling_2":a[2]=Math.exp(V);break;case"red":R[0]=V;break;case"green":R[1]=V;break;case"blue":R[2]=V;break;case"f_dc_0":case"features_0":R[0]=(.5+et.SH_C0*V)*255;break;case"f_dc_1":case"features_1":R[1]=(.5+et.SH_C0*V)*255;break;case"f_dc_2":case"features_2":R[2]=(.5+et.SH_C0*V)*255;break;case"f_dc_3":R[3]=(.5+et.SH_C0*V)*255;break;case"opacity":case"opacity_0":R[3]=1/(1+Math.exp(-V))*255;break;case"rot_0":case"rotation_0":W=V;break;case"rot_1":case"rotation_1":w=V;break;case"rot_2":case"rotation_2":D=V;break;case"rot_3":case"rotation_3":k=V;break}});let u=new f(w,D,k,W);switch(e){case"polycam":{const y=I[1];I[1]=-I[2],I[2]=y,u=r.multiply(u);break}case"":break;default:throw new Error(`Unsupported format: ${e}`)}u=u.normalize(),c[0]=u.w*128+128,c[1]=u.x*128+128,c[2]=u.y*128+128,c[3]=u.z*128+128}return B}}const rt="dmFyIGVBID0gZnVuY3Rpb24oQyA9IHt9KSB7CiAgdmFyIHIsIEkgPSBDLCBsID0gaW1wb3J0Lm1ldGEudXJsLCBqID0gIiIsIFU7CiAgewogICAgdHJ5IHsKICAgICAgaiA9IG5ldyBVUkwoIi4iLCBsKS5ocmVmOwogICAgfSBjYXRjaCB7CiAgICB9CiAgICBVID0gKEEpID0+IHsKICAgICAgdmFyIEIgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgcmV0dXJuIEIub3BlbigiR0VUIiwgQSwgITEpLCBCLnJlc3BvbnNlVHlwZSA9ICJhcnJheWJ1ZmZlciIsIEIuc2VuZChudWxsKSwgbmV3IFVpbnQ4QXJyYXkoQi5yZXNwb25zZSk7CiAgICB9OwogIH0KICBjb25zb2xlLmxvZy5iaW5kKGNvbnNvbGUpLCBjb25zb2xlLmVycm9yLmJpbmQoY29uc29sZSk7CiAgdmFyIE0sIHUsIEw7CiAgZnVuY3Rpb24gcSgpIHsKICAgIHZhciBBID0gdS5idWZmZXI7CiAgICBJLkhFQVBVOCA9IEwgPSBuZXcgVWludDhBcnJheShBKSwgSS5IRUFQVTMyID0gbmV3IFVpbnQzMkFycmF5KEEpLCBJLkhFQVBGMzIgPSBuZXcgRmxvYXQzMkFycmF5KEEpLCBuZXcgQmlnSW50NjRBcnJheShBKSwgbmV3IEJpZ1VpbnQ2NEFycmF5KEEpOwogIH0KICBmdW5jdGlvbiBQKCkgewogICAgaWYgKEkucHJlUnVuKQogICAgICBmb3IgKHR5cGVvZiBJLnByZVJ1biA9PSAiZnVuY3Rpb24iICYmIChJLnByZVJ1biA9IFtJLnByZVJ1bl0pOyBJLnByZVJ1bi5sZW5ndGg7ICkKICAgICAgICBDQShJLnByZVJ1bi5zaGlmdCgpKTsKICAgIHgoVCk7CiAgfQogIGZ1bmN0aW9uIGIoKSB7CiAgICB5LmMoKTsKICB9CiAgZnVuY3Rpb24gVygpIHsKICAgIGlmIChJLnBvc3RSdW4pCiAgICAgIGZvciAodHlwZW9mIEkucG9zdFJ1biA9PSAiZnVuY3Rpb24iICYmIChJLnBvc3RSdW4gPSBbSS5wb3N0UnVuXSk7IEkucG9zdFJ1bi5sZW5ndGg7ICkKICAgICAgICBnQShJLnBvc3RSdW4uc2hpZnQoKSk7CiAgICB4KHYpOwogIH0KICB2YXIgcyA9IDAsIGYgPSBudWxsOwogIGZ1bmN0aW9uIF8oQSkgewogICAgcysrLCBJLm1vbml0b3JSdW5EZXBlbmRlbmNpZXM/LihzKTsKICB9CiAgZnVuY3Rpb24geihBKSB7CiAgICBpZiAocy0tLCBJLm1vbml0b3JSdW5EZXBlbmRlbmNpZXM/LihzKSwgcyA9PSAwICYmIGYpIHsKICAgICAgdmFyIEIgPSBmOwogICAgICBmID0gbnVsbCwgQigpOwogICAgfQogIH0KICB2YXIgUzsKICBmdW5jdGlvbiBWKCkgewogICAgcmV0dXJuIEJBKCJBR0Z6YlFFQUFBQUJHUVJnQVg4QmYyQUJmd0JnQ1g5L2YzOS9mMzkvZndCZ0FBQUNCd0VCWVFGaEFBQURCZ1VBQVFBQ0F3VUhBUUdDQW9DQUFnWUlBWDhCUVlDTUJBc0hGUVVCWWdJQUFXTUFCUUZrQUFRQlpRQURBV1lBQWd3QkFRck5PQVZQQVFKL1FZQUlLQUlBSWdFZ0FFRUhha0Y0Y1NJQ2FpRUFBa0FnQWtFQUlBQWdBVTBiUlFSQUlBQS9BRUVRZEUwTkFTQUFFQUFOQVF0QmhBaEJNRFlDQUVGL0R3dEJnQWdnQURZQ0FDQUJDOXdMQVFoL0FrQWdBRVVOQUNBQVFRaHJJZ01nQUVFRWF5Z0NBQ0lDUVhoeElnQnFJUVVDUUNBQ1FRRnhEUUFnQWtFQ2NVVU5BU0FESUFNb0FnQWlCR3NpQTBHWUNDZ0NBRWtOQVNBQUlBUnFJUUFDUUFKQUFrQkJuQWdvQWdBZ0EwY0VRQ0FES0FJTUlRRWdCRUgvQVUwRVFDQUJJQU1vQWdnaUFrY05Ba0dJQ0VHSUNDZ0NBRUYrSUFSQkEzWjNjVFlDQUF3RkN5QURLQUlZSVFjZ0FTQURSd1JBSUFNb0FnZ2lBaUFCTmdJTUlBRWdBallDQ0F3RUN5QURLQUlVSWdJRWZ5QURRUlJxQlNBREtBSVFJZ0pGRFFNZ0EwRVFhZ3NoQkFOQUlBUWhCaUFDSWdGQkZHb2hCQ0FCS0FJVUlnSU5BQ0FCUVJCcUlRUWdBU2dDRUNJQ0RRQUxJQVpCQURZQ0FBd0RDeUFGS0FJRUlnSkJBM0ZCQTBjTkEwR1FDQ0FBTmdJQUlBVWdBa0YrY1RZQ0JDQURJQUJCQVhJMkFnUWdCU0FBTmdJQUR3c2dBaUFCTmdJTUlBRWdBallDQ0F3Q0MwRUFJUUVMSUFkRkRRQUNRQ0FES0FJY0lnUkJBblJCdUFwcUlnSW9BZ0FnQTBZRVFDQUNJQUUyQWdBZ0FRMEJRWXdJUVl3SUtBSUFRWDRnQkhkeE5nSUFEQUlMQWtBZ0F5QUhLQUlRUmdSQUlBY2dBVFlDRUF3QkN5QUhJQUUyQWhRTElBRkZEUUVMSUFFZ0J6WUNHQ0FES0FJUUlnSUVRQ0FCSUFJMkFoQWdBaUFCTmdJWUN5QURLQUlVSWdKRkRRQWdBU0FDTmdJVUlBSWdBVFlDR0FzZ0F5QUZUdzBBSUFVb0FnUWlCRUVCY1VVTkFBSkFBa0FDUUFKQUlBUkJBbkZGQkVCQm9BZ29BZ0FnQlVZRVFFR2dDQ0FETmdJQVFaUUlRWlFJS0FJQUlBQnFJZ0EyQWdBZ0F5QUFRUUZ5TmdJRUlBTkJuQWdvQWdCSERRWkJrQWhCQURZQ0FFR2NDRUVBTmdJQUR3dEJuQWdvQWdBaUJ5QUZSZ1JBUVp3SUlBTTJBZ0JCa0FoQmtBZ29BZ0FnQUdvaUFEWUNBQ0FESUFCQkFYSTJBZ1FnQUNBRGFpQUFOZ0lBRHdzZ0JFRjRjU0FBYWlFQUlBVW9BZ3doQVNBRVFmOEJUUVJBSUFVb0FnZ2lBaUFCUmdSQVFZZ0lRWWdJS0FJQVFYNGdCRUVEZG5keE5nSUFEQVVMSUFJZ0FUWUNEQ0FCSUFJMkFnZ01CQXNnQlNnQ0dDRUlJQUVnQlVjRVFDQUZLQUlJSWdJZ0FUWUNEQ0FCSUFJMkFnZ01Bd3NnQlNnQ0ZDSUNCSDhnQlVFVWFnVWdCU2dDRUNJQ1JRMENJQVZCRUdvTElRUURRQ0FFSVFZZ0FpSUJRUlJxSVFRZ0FTZ0NGQ0lDRFFBZ0FVRVFhaUVFSUFFb0FoQWlBZzBBQ3lBR1FRQTJBZ0FNQWdzZ0JTQUVRWDV4TmdJRUlBTWdBRUVCY2pZQ0JDQUFJQU5xSUFBMkFnQU1Bd3RCQUNFQkN5QUlSUTBBQWtBZ0JTZ0NIQ0lFUVFKMFFiZ0thaUlDS0FJQUlBVkdCRUFnQWlBQk5nSUFJQUVOQVVHTUNFR01DQ2dDQUVGK0lBUjNjVFlDQUF3Q0N3SkFJQVVnQ0NnQ0VFWUVRQ0FJSUFFMkFoQU1BUXNnQ0NBQk5nSVVDeUFCUlEwQkN5QUJJQWcyQWhnZ0JTZ0NFQ0lDQkVBZ0FTQUNOZ0lRSUFJZ0FUWUNHQXNnQlNnQ0ZDSUNSUTBBSUFFZ0FqWUNGQ0FDSUFFMkFoZ0xJQU1nQUVFQmNqWUNCQ0FBSUFOcUlBQTJBZ0FnQXlBSFJ3MEFRWkFJSUFBMkFnQVBDeUFBUWY4QlRRUkFJQUJCZUhGQnNBaHFJUUlDZjBHSUNDZ0NBQ0lFUVFFZ0FFRURkblFpQUhGRkJFQkJpQWdnQUNBRWNqWUNBQ0FDREFFTElBSW9BZ2dMSVFBZ0FpQUROZ0lJSUFBZ0F6WUNEQ0FESUFJMkFnd2dBeUFBTmdJSUR3dEJIeUVCSUFCQi8vLy9CMDBFUUNBQVFTWWdBRUVJZG1jaUFtdDJRUUZ4SUFKQkFYUnJRVDVxSVFFTElBTWdBVFlDSENBRFFnQTNBaEFnQVVFQ2RFRzRDbW9oQkFKL0FrQUNmMEdNQ0NnQ0FDSUdRUUVnQVhRaUFuRkZCRUJCakFnZ0FpQUdjallDQUNBRUlBTTJBZ0JCR0NFQlFRZ01BUXNnQUVFWklBRkJBWFpyUVFBZ0FVRWZSeHQwSVFFZ0JDZ0NBQ0VFQTBBZ0JDSUNLQUlFUVhoeElBQkdEUUlnQVVFZGRpRUVJQUZCQVhRaEFTQUNJQVJCQkhGcUlnWW9BaEFpQkEwQUN5QUdJQU0yQWhCQkdDRUJJQUloQkVFSUN5RUFJQU1pQWd3QkN5QUNLQUlJSWdRZ0F6WUNEQ0FDSUFNMkFnaEJHQ0VBUVFnaEFVRUFDeUVHSUFFZ0Eyb2dCRFlDQUNBRElBSTJBZ3dnQUNBRGFpQUdOZ0lBUWFnSVFhZ0lLQUlBUVFGcklnQkJmeUFBR3pZQ0FBc0wwU2NCQzM4akFFRVFheUlLSkFBQ1FBSkFBa0FDUUFKQUFrQUNRQUpBQWtBQ1FDQUFRZlFCVFFSQVFZZ0lLQUlBSWdSQkVDQUFRUXRxUWZnRGNTQUFRUXRKR3lJR1FRTjJJZ0IySWdGQkEzRUVRQUpBSUFGQmYzTkJBWEVnQUdvaUFrRURkQ0lCUWJBSWFpSUFJQUZCdUFocUtBSUFJZ0VvQWdnaUJVWUVRRUdJQ0NBRVFYNGdBbmR4TmdJQURBRUxJQVVnQURZQ0RDQUFJQVUyQWdnTElBRkJDR29oQUNBQklBSkJBM1FpQWtFRGNqWUNCQ0FCSUFKcUlnRWdBU2dDQkVFQmNqWUNCQXdMQ3lBR1FaQUlLQUlBSWdoTkRRRWdBUVJBQWtCQkFpQUFkQ0lDUVFBZ0FtdHlJQUVnQUhSeGFDSUJRUU4wSWdCQnNBaHFJZ0lnQUVHNENHb29BZ0FpQUNnQ0NDSUZSZ1JBUVlnSUlBUkJmaUFCZDNFaUJEWUNBQXdCQ3lBRklBSTJBZ3dnQWlBRk5nSUlDeUFBSUFaQkEzSTJBZ1FnQUNBR2FpSUhJQUZCQTNRaUFTQUdheUlGUVFGeU5nSUVJQUFnQVdvZ0JUWUNBQ0FJQkVBZ0NFRjRjVUd3Q0dvaEFVR2NDQ2dDQUNFQ0FuOGdCRUVCSUFoQkEzWjBJZ054UlFSQVFZZ0lJQU1nQkhJMkFnQWdBUXdCQ3lBQktBSUlDeUVESUFFZ0FqWUNDQ0FESUFJMkFnd2dBaUFCTmdJTUlBSWdBellDQ0FzZ0FFRUlhaUVBUVp3SUlBYzJBZ0JCa0FnZ0JUWUNBQXdMQzBHTUNDZ0NBQ0lMUlEwQklBdG9RUUowUWJnS2FpZ0NBQ0lDS0FJRVFYaHhJQVpySVFNZ0FpRUJBMEFDUUNBQktBSVFJZ0JGQkVBZ0FTZ0NGQ0lBUlEwQkN5QUFLQUlFUVhoeElBWnJJZ0VnQXlBQklBTkpJZ0ViSVFNZ0FDQUNJQUViSVFJZ0FDRUJEQUVMQ3lBQ0tBSVlJUWtnQWlBQ0tBSU1JZ0JIQkVBZ0FpZ0NDQ0lCSUFBMkFnd2dBQ0FCTmdJSURBb0xJQUlvQWhRaUFRUi9JQUpCRkdvRklBSW9BaEFpQVVVTkF5QUNRUkJxQ3lFRkEwQWdCU0VISUFFaUFFRVVhaUVGSUFBb0FoUWlBUTBBSUFCQkVHb2hCU0FBS0FJUUlnRU5BQXNnQjBFQU5nSUFEQWtMUVg4aEJpQUFRYjkvU3cwQUlBQkJDMm9pQVVGNGNTRUdRWXdJS0FJQUlnZEZEUUJCSHlFSVFRQWdCbXNoQXlBQVFmVC8vd2ROQkVBZ0JrRW1JQUZCQ0habklnQnJka0VCY1NBQVFRRjBhMEUrYWlFSUN3SkFBa0FDUUNBSVFRSjBRYmdLYWlnQ0FDSUJSUVJBUVFBaEFBd0JDMEVBSVFBZ0JrRVpJQWhCQVhaclFRQWdDRUVmUnh0MElRSURRQUpBSUFFb0FnUkJlSEVnQm1zaUJDQURUdzBBSUFFaEJTQUVJZ01OQUVFQUlRTWdBU0VBREFNTElBQWdBU2dDRkNJRUlBUWdBU0FDUVIxMlFRUnhhaWdDRUNJQlJoc2dBQ0FFR3lFQUlBSkJBWFFoQWlBQkRRQUxDeUFBSUFWeVJRUkFRUUFoQlVFQ0lBaDBJZ0JCQUNBQWEzSWdCM0VpQUVVTkF5QUFhRUVDZEVHNENtb29BZ0FoQUFzZ0FFVU5BUXNEUUNBQUtBSUVRWGh4SUFacklnSWdBMGtoQVNBQ0lBTWdBUnNoQXlBQUlBVWdBUnNoQlNBQUtBSVFJZ0VFZnlBQkJTQUFLQUlVQ3lJQURRQUxDeUFGUlEwQUlBTkJrQWdvQWdBZ0JtdFBEUUFnQlNnQ0dDRUlJQVVnQlNnQ0RDSUFSd1JBSUFVb0FnZ2lBU0FBTmdJTUlBQWdBVFlDQ0F3SUN5QUZLQUlVSWdFRWZ5QUZRUlJxQlNBRktBSVFJZ0ZGRFFNZ0JVRVFhZ3NoQWdOQUlBSWhCQ0FCSWdCQkZHb2hBaUFBS0FJVUlnRU5BQ0FBUVJCcUlRSWdBQ2dDRUNJQkRRQUxJQVJCQURZQ0FBd0hDeUFHUVpBSUtBSUFJZ1ZOQkVCQm5BZ29BZ0FoQUFKQUlBVWdCbXNpQVVFUVR3UkFJQUFnQm1vaUFpQUJRUUZ5TmdJRUlBQWdCV29nQVRZQ0FDQUFJQVpCQTNJMkFnUU1BUXNnQUNBRlFRTnlOZ0lFSUFBZ0JXb2lBU0FCS0FJRVFRRnlOZ0lFUVFBaEFrRUFJUUVMUVpBSUlBRTJBZ0JCbkFnZ0FqWUNBQ0FBUVFocUlRQU1DUXNnQmtHVUNDZ0NBQ0lDU1FSQVFaUUlJQUlnQm1zaUFUWUNBRUdnQ0VHZ0NDZ0NBQ0lBSUFacUlnSTJBZ0FnQWlBQlFRRnlOZ0lFSUFBZ0JrRURjallDQkNBQVFRaHFJUUFNQ1F0QkFDRUFJQVpCTDJvaUF3Si9RZUFMS0FJQUJFQkI2QXNvQWdBTUFRdEI3QXRDZnpjQ0FFSGtDMEtBb0lDQWdJQUVOd0lBUWVBTElBcEJER3BCY0hGQjJLclZxZ1Z6TmdJQVFmUUxRUUEyQWdCQnhBdEJBRFlDQUVHQUlBc2lBV29pQkVFQUlBRnJJZ2R4SWdFZ0JrME5DRUhBQ3lnQ0FDSUZCRUJCdUFzb0FnQWlDQ0FCYWlJSklBaE5JQVVnQ1VseURRa0xBa0JCeEFzdEFBQkJCSEZGQkVBQ1FBSkFBa0FDUUVHZ0NDZ0NBQ0lGQkVCQnlBc2hBQU5BSUFBb0FnQWlDQ0FGVFFSQUlBVWdDQ0FBS0FJRWFra05Bd3NnQUNnQ0NDSUFEUUFMQzBFQUVBRWlBa0YvUmcwRElBRWhCRUhrQ3lnQ0FDSUFRUUZySWdVZ0FuRUVRQ0FCSUFKcklBSWdCV3BCQUNBQWEzRnFJUVFMSUFRZ0JrME5BMEhBQ3lnQ0FDSUFCRUJCdUFzb0FnQWlCU0FFYWlJSElBVk5JQUFnQjBseURRUUxJQVFRQVNJQUlBSkhEUUVNQlFzZ0JDQUNheUFIY1NJRUVBRWlBaUFBS0FJQUlBQW9BZ1JxUmcwQklBSWhBQXNnQUVGL1JnMEJJQVpCTUdvZ0JFMEVRQ0FBSVFJTUJBdEI2QXNvQWdBaUFpQURJQVJyYWtFQUlBSnJjU0lDRUFGQmYwWU5BU0FDSUFScUlRUWdBQ0VDREFNTElBSkJmMGNOQWd0QnhBdEJ4QXNvQWdCQkJISTJBZ0FMSUFFUUFTSUNRWDlHUVFBUUFTSUFRWDlHY2lBQUlBSk5jZzBGSUFBZ0Ftc2lCQ0FHUVNocVRRMEZDMEc0QzBHNEN5Z0NBQ0FFYWlJQU5nSUFRYndMS0FJQUlBQkpCRUJCdkFzZ0FEWUNBQXNDUUVHZ0NDZ0NBQ0lEQkVCQnlBc2hBQU5BSUFJZ0FDZ0NBQ0lCSUFBb0FnUWlCV3BHRFFJZ0FDZ0NDQ0lBRFFBTERBUUxRWmdJS0FJQUlnQkJBQ0FBSUFKTkcwVUVRRUdZQ0NBQ05nSUFDMEVBSVFCQnpBc2dCRFlDQUVISUN5QUNOZ0lBUWFnSVFYODJBZ0JCckFoQjRBc29BZ0EyQWdCQjFBdEJBRFlDQUFOQUlBQkJBM1FpQVVHNENHb2dBVUd3Q0dvaUJUWUNBQ0FCUWJ3SWFpQUZOZ0lBSUFCQkFXb2lBRUVnUncwQUMwR1VDQ0FFUVNocklnQkJlQ0FDYTBFSGNTSUJheUlGTmdJQVFhQUlJQUVnQW1vaUFUWUNBQ0FCSUFWQkFYSTJBZ1FnQUNBQ2FrRW9OZ0lFUWFRSVFmQUxLQUlBTmdJQURBUUxJQUlnQTAwZ0FTQURTM0lOQWlBQUtBSU1RUWh4RFFJZ0FDQUVJQVZxTmdJRVFhQUlJQU5CZUNBRGEwRUhjU0lBYWlJQk5nSUFRWlFJUVpRSUtBSUFJQVJxSWdJZ0FHc2lBRFlDQUNBQklBQkJBWEkyQWdRZ0FpQURha0VvTmdJRVFhUUlRZkFMS0FJQU5nSUFEQU1MUVFBaEFBd0dDMEVBSVFBTUJBdEJtQWdvQWdBZ0Frc0VRRUdZQ0NBQ05nSUFDeUFDSUFScUlRVkJ5QXNoQUFKQUEwQWdCU0FBS0FJQUlnRkhCRUFnQUNnQ0NDSUFEUUVNQWdzTElBQXRBQXhCQ0hGRkRRTUxRY2dMSVFBRFFBSkFJQUFvQWdBaUFTQURUUVJBSUFNZ0FTQUFLQUlFYWlJRlNRMEJDeUFBS0FJSUlRQU1BUXNMUVpRSUlBUkJLR3NpQUVGNElBSnJRUWR4SWdGcklnYzJBZ0JCb0FnZ0FTQUNhaUlCTmdJQUlBRWdCMEVCY2pZQ0JDQUFJQUpxUVNnMkFnUkJwQWhCOEFzb0FnQTJBZ0FnQXlBRlFTY2dCV3RCQjNGcVFTOXJJZ0FnQUNBRFFSQnFTUnNpQVVFYk5nSUVJQUZCMEFzcEFnQTNBaEFnQVVISUN5a0NBRGNDQ0VIUUN5QUJRUWhxTmdJQVFjd0xJQVEyQWdCQnlBc2dBallDQUVIVUMwRUFOZ0lBSUFGQkdHb2hBQU5BSUFCQkJ6WUNCQ0FBUVFocUlBQkJCR29oQUNBRlNRMEFDeUFCSUFOR0RRQWdBU0FCS0FJRVFYNXhOZ0lFSUFNZ0FTQURheUlDUVFGeU5nSUVJQUVnQWpZQ0FBSi9JQUpCL3dGTkJFQWdBa0Y0Y1VHd0NHb2hBQUovUVlnSUtBSUFJZ0ZCQVNBQ1FRTjJkQ0lDY1VVRVFFR0lDQ0FCSUFKeU5nSUFJQUFNQVFzZ0FDZ0NDQXNoQVNBQUlBTTJBZ2dnQVNBRE5nSU1RUXdoQWtFSURBRUxRUjhoQUNBQ1FmLy8vd2ROQkVBZ0FrRW1JQUpCQ0habklnQnJka0VCY1NBQVFRRjBhMEUrYWlFQUN5QURJQUEyQWh3Z0EwSUFOd0lRSUFCQkFuUkJ1QXBxSVFFQ1FBSkFRWXdJS0FJQUlnVkJBU0FBZENJRWNVVUVRRUdNQ0NBRUlBVnlOZ0lBSUFFZ0F6WUNBQXdCQ3lBQ1FSa2dBRUVCZG10QkFDQUFRUjlIRzNRaEFDQUJLQUlBSVFVRFFDQUZJZ0VvQWdSQmVIRWdBa1lOQWlBQVFSMTJJUVVnQUVFQmRDRUFJQUVnQlVFRWNXb2lCQ2dDRUNJRkRRQUxJQVFnQXpZQ0VBc2dBeUFCTmdJWVFRZ2hBaUFESWdFaEFFRU1EQUVMSUFFb0FnZ2lBQ0FETmdJTUlBRWdBellDQ0NBRElBQTJBZ2hCQUNFQVFSZ2hBa0VNQ3lBRGFpQUJOZ0lBSUFJZ0Eyb2dBRFlDQUF0QmxBZ29BZ0FpQUNBR1RRMEFRWlFJSUFBZ0Jtc2lBVFlDQUVHZ0NFR2dDQ2dDQUNJQUlBWnFJZ0kyQWdBZ0FpQUJRUUZ5TmdJRUlBQWdCa0VEY2pZQ0JDQUFRUWhxSVFBTUJBdEJoQWhCTURZQ0FFRUFJUUFNQXdzZ0FDQUNOZ0lBSUFBZ0FDZ0NCQ0FFYWpZQ0JDQUNRWGdnQW10QkIzRnFJZ2dnQmtFRGNqWUNCQ0FCUVhnZ0FXdEJCM0ZxSWdRZ0JpQUlhaUlEYXlFSEFrQkJvQWdvQWdBZ0JFWUVRRUdnQ0NBRE5nSUFRWlFJUVpRSUtBSUFJQWRxSWdBMkFnQWdBeUFBUVFGeU5nSUVEQUVMUVp3SUtBSUFJQVJHQkVCQm5BZ2dBellDQUVHUUNFR1FDQ2dDQUNBSGFpSUFOZ0lBSUFNZ0FFRUJjallDQkNBQUlBTnFJQUEyQWdBTUFRc2dCQ2dDQkNJQVFRTnhRUUZHQkVBZ0FFRjRjU0VKSUFRb0Fnd2hBZ0pBSUFCQi93Rk5CRUFnQkNnQ0NDSUJJQUpHQkVCQmlBaEJpQWdvQWdCQmZpQUFRUU4yZDNFMkFnQU1BZ3NnQVNBQ05nSU1JQUlnQVRZQ0NBd0JDeUFFS0FJWUlRWUNRQ0FDSUFSSEJFQWdCQ2dDQ0NJQUlBSTJBZ3dnQWlBQU5nSUlEQUVMQWtBZ0JDZ0NGQ0lBQkg4Z0JFRVVhZ1VnQkNnQ0VDSUFSUTBCSUFSQkVHb0xJUUVEUUNBQklRVWdBQ0lDUVJScUlRRWdBQ2dDRkNJQURRQWdBa0VRYWlFQklBSW9BaEFpQUEwQUN5QUZRUUEyQWdBTUFRdEJBQ0VDQ3lBR1JRMEFBa0FnQkNnQ0hDSUFRUUowUWJnS2FpSUJLQUlBSUFSR0JFQWdBU0FDTmdJQUlBSU5BVUdNQ0VHTUNDZ0NBRUYrSUFCM2NUWUNBQXdDQ3dKQUlBUWdCaWdDRUVZRVFDQUdJQUkyQWhBTUFRc2dCaUFDTmdJVUN5QUNSUTBCQ3lBQ0lBWTJBaGdnQkNnQ0VDSUFCRUFnQWlBQU5nSVFJQUFnQWpZQ0dBc2dCQ2dDRkNJQVJRMEFJQUlnQURZQ0ZDQUFJQUkyQWhnTElBY2dDV29oQnlBRUlBbHFJZ1FvQWdRaEFBc2dCQ0FBUVg1eE5nSUVJQU1nQjBFQmNqWUNCQ0FESUFkcUlBYzJBZ0FnQjBIL0FVMEVRQ0FIUVhoeFFiQUlhaUVBQW45QmlBZ29BZ0FpQVVFQklBZEJBM1owSWdKeFJRUkFRWWdJSUFFZ0FuSTJBZ0FnQUF3QkN5QUFLQUlJQ3lFQklBQWdBellDQ0NBQklBTTJBZ3dnQXlBQU5nSU1JQU1nQVRZQ0NBd0JDMEVmSVFJZ0IwSC8vLzhIVFFSQUlBZEJKaUFIUVFoMlp5SUFhM1pCQVhFZ0FFRUJkR3RCUG1vaEFnc2dBeUFDTmdJY0lBTkNBRGNDRUNBQ1FRSjBRYmdLYWlFQUFrQUNRRUdNQ0NnQ0FDSUJRUUVnQW5RaUJYRkZCRUJCakFnZ0FTQUZjallDQUNBQUlBTTJBZ0FNQVFzZ0IwRVpJQUpCQVhaclFRQWdBa0VmUnh0MElRSWdBQ2dDQUNFQkEwQWdBU0lBS0FJRVFYaHhJQWRHRFFJZ0FrRWRkaUVCSUFKQkFYUWhBaUFBSUFGQkJIRnFJZ1VvQWhBaUFRMEFDeUFGSUFNMkFoQUxJQU1nQURZQ0dDQURJQU0yQWd3Z0F5QUROZ0lJREFFTElBQW9BZ2dpQVNBRE5nSU1JQUFnQXpZQ0NDQURRUUEyQWhnZ0F5QUFOZ0lNSUFNZ0FUWUNDQXNnQ0VFSWFpRUFEQUlMQWtBZ0NFVU5BQUpBSUFVb0Fod2lBVUVDZEVHNENtb2lBaWdDQUNBRlJnUkFJQUlnQURZQ0FDQUFEUUZCakFnZ0IwRitJQUYzY1NJSE5nSUFEQUlMQWtBZ0JTQUlLQUlRUmdSQUlBZ2dBRFlDRUF3QkN5QUlJQUEyQWhRTElBQkZEUUVMSUFBZ0NEWUNHQ0FGS0FJUUlnRUVRQ0FBSUFFMkFoQWdBU0FBTmdJWUN5QUZLQUlVSWdGRkRRQWdBQ0FCTmdJVUlBRWdBRFlDR0FzQ1FDQURRUTlOQkVBZ0JTQURJQVpxSWdCQkEzSTJBZ1FnQUNBRmFpSUFJQUFvQWdSQkFYSTJBZ1FNQVFzZ0JTQUdRUU55TmdJRUlBVWdCbW9pQkNBRFFRRnlOZ0lFSUFNZ0JHb2dBellDQUNBRFFmOEJUUVJBSUFOQmVIRkJzQWhxSVFBQ2YwR0lDQ2dDQUNJQlFRRWdBMEVEZG5RaUFuRkZCRUJCaUFnZ0FTQUNjallDQUNBQURBRUxJQUFvQWdnTElRRWdBQ0FFTmdJSUlBRWdCRFlDRENBRUlBQTJBZ3dnQkNBQk5nSUlEQUVMUVI4aEFDQURRZi8vL3dkTkJFQWdBMEVtSUFOQkNIWm5JZ0JyZGtFQmNTQUFRUUYwYTBFK2FpRUFDeUFFSUFBMkFod2dCRUlBTndJUUlBQkJBblJCdUFwcUlRRUNRQUpBSUFkQkFTQUFkQ0lDY1VVRVFFR01DQ0FDSUFkeU5nSUFJQUVnQkRZQ0FDQUVJQUUyQWhnTUFRc2dBMEVaSUFCQkFYWnJRUUFnQUVFZlJ4dDBJUUFnQVNnQ0FDRUJBMEFnQVNJQ0tBSUVRWGh4SUFOR0RRSWdBRUVkZGlFQklBQkJBWFFoQUNBQ0lBRkJCSEZxSWdjb0FoQWlBUTBBQ3lBSElBUTJBaEFnQkNBQ05nSVlDeUFFSUFRMkFnd2dCQ0FFTmdJSURBRUxJQUlvQWdnaUFDQUVOZ0lNSUFJZ0JEWUNDQ0FFUVFBMkFoZ2dCQ0FDTmdJTUlBUWdBRFlDQ0FzZ0JVRUlhaUVBREFFTEFrQWdDVVVOQUFKQUlBSW9BaHdpQVVFQ2RFRzRDbW9pQlNnQ0FDQUNSZ1JBSUFVZ0FEWUNBQ0FBRFFGQmpBZ2dDMEYrSUFGM2NUWUNBQXdDQ3dKQUlBSWdDU2dDRUVZRVFDQUpJQUEyQWhBTUFRc2dDU0FBTmdJVUN5QUFSUTBCQ3lBQUlBazJBaGdnQWlnQ0VDSUJCRUFnQUNBQk5nSVFJQUVnQURZQ0dBc2dBaWdDRkNJQlJRMEFJQUFnQVRZQ0ZDQUJJQUEyQWhnTEFrQWdBMEVQVFFSQUlBSWdBeUFHYWlJQVFRTnlOZ0lFSUFBZ0Ftb2lBQ0FBS0FJRVFRRnlOZ0lFREFFTElBSWdCa0VEY2pZQ0JDQUNJQVpxSWdVZ0EwRUJjallDQkNBRElBVnFJQU0yQWdBZ0NBUkFJQWhCZUhGQnNBaHFJUUJCbkFnb0FnQWhBUUovUVFFZ0NFRURkblFpQnlBRWNVVUVRRUdJQ0NBRUlBZHlOZ0lBSUFBTUFRc2dBQ2dDQ0FzaEJDQUFJQUUyQWdnZ0JDQUJOZ0lNSUFFZ0FEWUNEQ0FCSUFRMkFnZ0xRWndJSUFVMkFnQkJrQWdnQXpZQ0FBc2dBa0VJYWlFQUN5QUtRUkJxSkFBZ0FBdkdCQUlHZndwOVFmLy8vLzhISVF4QmdJQ0FnSGdoRFVGL0lRa0RRQ0FESUFwR0JFQkJBQ0VBSUFoQkFFR0FnQkQ4Q3dCREFQOS9SeUFOSUF4cnNwVWhEd1VnQkNBS1FReHNhaUlMS2dJQUlSTWdDeW9DQ0NFVUlBc3FBZ1FoRlNBSklBSWdDa0VDZENJT2FpZ0NBQ0lMUndSQUlBRWdDMEhRQUd4cUlna3FBandnQUNvQ09DSVBsQ0FKS2dJNElBQXFBaWdpRUpRZ0NTb0NNQ0FBS2dJSUloR1VJQUFxQWhnaUVpQUpLZ0kwbEpLU2tpRVdJQWtxQWl3Z0Q1UWdDU29DS0NBUWxDQUpLZ0lnSUJHVUlCSWdDU29DSkpTU2twSWhGeUFKS2dJY0lBK1VJQWtxQWhnZ0VKUWdDU29DRUNBUmxDQVNJQWtxQWhTVWtwS1NJUmdnQ1NvQ0RDQVBsQ0FKS2dJSUlCQ1VJQWtxQWdBZ0VaUWdDU29DQkNBU2xKS1NraUVQSUFzaENRc2dCU0FPYWlBV0lCY2dGSlFnRHlBVGxDQVZJQmlVa3BLU1F3QUFnRVdVL0FBaUN6WUNBQ0FNSUFzZ0N5QU1TaHNoRENBTklBc2dDeUFOU0JzaERTQUtRUUZxSVFvTUFRc0xBMEFnQUNBRFJrVUVRQ0FGSUFCQkFuUnFJZ0VnRHlBQktBSUFJQXhyczVUOEFTSUJOZ0lBSUFnZ0FVRUNkR29pQVNBQktBSUFRUUZxTmdJQUlBQkJBV29oQUF3QkN3dEJBQ0VBSUFkQkFEWUNBQ0FJUVFScklRRkJBQ0VNUVFFaENnTkFJQXBCZ0lBRVJnUkFBMEFDUUNBQUlBTkdEUUFnQnlBRklBQkJBblJxS0FJQVFRSjBhaUlCSUFFb0FnQWlBVUVCYWpZQ0FDQUdJQUZCQW5ScUlBQTJBZ0FnQUVFQmFpRUFEQUVMQ3dVZ0J5QUtRUUowSWdKcUlBRWdBbW9vQWdBZ0RHb2lERFlDQUNBS1FRRnFJUW9NQVFzTEN3SUFDd3NKQVFCQmdRZ0xBZ1lCIik7CiAgfQogIGZ1bmN0aW9uIE8oQSkgewogICAgaWYgKEFycmF5QnVmZmVyLmlzVmlldyhBKSkKICAgICAgcmV0dXJuIEE7CiAgICBpZiAoQSA9PSBTICYmIE0pCiAgICAgIHJldHVybiBuZXcgVWludDhBcnJheShNKTsKICAgIGlmIChVKQogICAgICByZXR1cm4gVShBKTsKICAgIHRocm93ICdzeW5jIGZldGNoaW5nIG9mIHRoZSB3YXNtIGZhaWxlZDogeW91IGNhbiBwcmVsb2FkIGl0IHRvIE1vZHVsZVsid2FzbUJpbmFyeSJdIG1hbnVhbGx5LCBvciBlbWNjLnB5IHdpbGwgZG8gdGhhdCBmb3IgeW91IHdoZW4gZ2VuZXJhdGluZyBIVE1MIChidXQgbm90IEpTKSc7CiAgfQogIGZ1bmN0aW9uICQoQSwgQikgewogICAgdmFyIHQsIEUgPSBPKEEpOwogICAgdCA9IG5ldyBXZWJBc3NlbWJseS5Nb2R1bGUoRSk7CiAgICB2YXIgaSA9IG5ldyBXZWJBc3NlbWJseS5JbnN0YW5jZSh0LCBCKTsKICAgIHJldHVybiBbaSwgdF07CiAgfQogIGZ1bmN0aW9uIEFBKCkgewogICAgcmV0dXJuIHsgYTogbkEgfTsKICB9CiAgZnVuY3Rpb24gSUEoKSB7CiAgICBmdW5jdGlvbiBBKEUsIGkpIHsKICAgICAgcmV0dXJuIHkgPSBFLmV4cG9ydHMsIHUgPSB5LmIsIHEoKSwgckEoeSksIHooKSwgeTsKICAgIH0KICAgIF8oKTsKICAgIHZhciBCID0gQUEoKTsKICAgIGlmIChJLmluc3RhbnRpYXRlV2FzbSkKICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKChFLCBpKSA9PiB7CiAgICAgICAgSS5pbnN0YW50aWF0ZVdhc20oQiwgKG8sIGgpID0+IHsKICAgICAgICAgIEUoQShvKSk7CiAgICAgICAgfSk7CiAgICAgIH0pOwogICAgUyA/Pz0gVigpOwogICAgdmFyIHQgPSAkKFMsIEIpOwogICAgcmV0dXJuIEEodFswXSk7CiAgfQogIGZvciAodmFyIHggPSAoQSkgPT4gewogICAgZm9yICg7IEEubGVuZ3RoID4gMDsgKQogICAgICBBLnNoaWZ0KCkoSSk7CiAgfSwgdiA9IFtdLCBnQSA9IChBKSA9PiB2LnB1c2goQSksIFQgPSBbXSwgQ0EgPSAoQSkgPT4gVC5wdXNoKEEpLCBCQSA9IChBKSA9PiB7CiAgICBmb3IgKHZhciBCLCB0LCBFID0gMCwgaSA9IDAsIG8gPSBBLmxlbmd0aCwgaCA9IG5ldyBVaW50OEFycmF5KChvICogMyA+PiAyKSAtIChBW28gLSAyXSA9PSAiPSIpIC0gKEFbbyAtIDFdID09ICI9IikpOyBFIDwgbzsgRSArPSA0LCBpICs9IDMpCiAgICAgIEIgPSBuW0EuY2hhckNvZGVBdChFICsgMSldLCB0ID0gbltBLmNoYXJDb2RlQXQoRSArIDIpXSwgaFtpXSA9IG5bQS5jaGFyQ29kZUF0KEUpXSA8PCAyIHwgQiA+PiA0LCBoW2kgKyAxXSA9IEIgPDwgNCB8IHQgPj4gMiwgaFtpICsgMl0gPSB0IDw8IDYgfCBuW0EuY2hhckNvZGVBdChFICsgMyldOwogICAgcmV0dXJuIGg7CiAgfSwgUUEgPSAoKSA9PiAyMTQ3NDgzNjQ4LCBFQSA9IChBLCBCKSA9PiBNYXRoLmNlaWwoQSAvIEIpICogQiwgdEEgPSAoQSkgPT4gewogICAgdmFyIEIgPSB1LmJ1ZmZlciwgdCA9IChBIC0gQi5ieXRlTGVuZ3RoICsgNjU1MzUpIC8gNjU1MzYgfCAwOwogICAgdHJ5IHsKICAgICAgcmV0dXJuIHUuZ3Jvdyh0KSwgcSgpLCAxOwogICAgfSBjYXRjaCB7CiAgICB9CiAgfSwgaUEgPSAoQSkgPT4gewogICAgdmFyIEIgPSBMLmxlbmd0aDsKICAgIEEgPj4+PSAwOwogICAgdmFyIHQgPSBRQSgpOwogICAgaWYgKEEgPiB0KQogICAgICByZXR1cm4gITE7CiAgICBmb3IgKHZhciBFID0gMTsgRSA8PSA0OyBFICo9IDIpIHsKICAgICAgdmFyIGkgPSBCICogKDEgKyAwLjIgLyBFKTsKICAgICAgaSA9IE1hdGgubWluKGksIEEgKyAxMDA2NjMyOTYpOwogICAgICB2YXIgbyA9IE1hdGgubWluKHQsIEVBKE1hdGgubWF4KEEsIGkpLCA2NTUzNikpLCBoID0gdEEobyk7CiAgICAgIGlmIChoKQogICAgICAgIHJldHVybiAhMDsKICAgIH0KICAgIHJldHVybiAhMTsKICB9LCBuID0gbmV3IFVpbnQ4QXJyYXkoMTIzKSwgZSA9IDI1OyBlID49IDA7IC0tZSkKICAgIG5bNDggKyBlXSA9IDUyICsgZSwgbls2NSArIGVdID0gZSwgbls5NyArIGVdID0gMjYgKyBlOwogIG5bNDNdID0gNjIsIG5bNDddID0gNjMsIEkubm9FeGl0UnVudGltZSAmJiBJLm5vRXhpdFJ1bnRpbWUsIEkucHJpbnQgJiYgSS5wcmludCwgSS5wcmludEVyciAmJiBJLnByaW50RXJyLCBJLndhc21CaW5hcnkgJiYgKE0gPSBJLndhc21CaW5hcnkpLCBJLmFyZ3VtZW50cyAmJiBJLmFyZ3VtZW50cywgSS50aGlzUHJvZ3JhbSAmJiBJLnRoaXNQcm9ncmFtOwogIGZ1bmN0aW9uIHJBKEEpIHsKICAgIEkuX3NvcnQgPSBBLmQsIEkuX21hbGxvYyA9IEEuZSwgSS5fZnJlZSA9IEEuZjsKICB9CiAgdmFyIG5BID0geyBhOiBpQSB9LCB5ID0gSUEoKTsKICBmdW5jdGlvbiBtKCkgewogICAgaWYgKHMgPiAwKSB7CiAgICAgIGYgPSBtOwogICAgICByZXR1cm47CiAgICB9CiAgICBpZiAoUCgpLCBzID4gMCkgewogICAgICBmID0gbTsKICAgICAgcmV0dXJuOwogICAgfQogICAgZnVuY3Rpb24gQSgpIHsKICAgICAgSS5jYWxsZWRSdW4gPSAhMCwgYigpLCBJLm9uUnVudGltZUluaXRpYWxpemVkPy4oKSwgVygpOwogICAgfQogICAgSS5zZXRTdGF0dXMgPyAoSS5zZXRTdGF0dXMoIlJ1bm5pbmcuLi4iKSwgc2V0VGltZW91dCgoKSA9PiB7CiAgICAgIHNldFRpbWVvdXQoKCkgPT4gSS5zZXRTdGF0dXMoIiIpLCAxKSwgQSgpOwogICAgfSwgMSkpIDogQSgpOwogIH0KICBmdW5jdGlvbiBhQSgpIHsKICAgIGlmIChJLnByZUluaXQpCiAgICAgIGZvciAodHlwZW9mIEkucHJlSW5pdCA9PSAiZnVuY3Rpb24iICYmIChJLnByZUluaXQgPSBbSS5wcmVJbml0XSk7IEkucHJlSW5pdC5sZW5ndGggPiAwOyApCiAgICAgICAgSS5wcmVJbml0LnNoaWZ0KCkoKTsKICB9CiAgcmV0dXJuIGFBKCksIG0oKSwgciA9IEksIHI7Cn07CmxldCBnLCBRLCBkLCBjLCBOLCB3LCBwLCBSLCBrLCBKLCBhID0gMCwgWSA9IDAsIEggPSBbXSwgRyA9ICEwLCBEID0gITEsIEYgPSAhMSwgSyA9ICExOwphc3luYyBmdW5jdGlvbiBvQSgpIHsKICBpZiAoIWcgJiYgKGcgPSBhd2FpdCBlQSgpLCAhZyB8fCAhZy5IRUFQRjMyIHx8ICFnLl9zb3J0KSkKICAgIHRocm93IG5ldyBFcnJvcigiV0FTTSBtb2R1bGUgZmFpbGVkIHRvIGluaXRpYWxpemUgcHJvcGVybHkiKTsKfQpjb25zdCBaID0gYXN5bmMgKCkgPT4gewogIGlmIChEKSB7CiAgICBGID0gITA7CiAgICByZXR1cm47CiAgfQogIEQgPSAhMCwgRiA9ICExLCBnIHx8IGF3YWl0IG9BKCk7CiAgY29uc3QgQyA9IE1hdGgucG93KDIsIE1hdGguY2VpbChNYXRoLmxvZzIoUS52ZXJ0ZXhDb3VudCkpKTsKICBhIDwgQyAmJiAoYSA+IDAgJiYgKGcuX2ZyZWUoZCksIGcuX2ZyZWUoTiksIGcuX2ZyZWUodyksIGcuX2ZyZWUocCksIGcuX2ZyZWUoUiksIGcuX2ZyZWUoayksIGcuX2ZyZWUoSikpLCBhID0gQywgZCA9IGcuX21hbGxvYygxNiAqIDQpLCBOID0gZy5fbWFsbG9jKGEgKiA0KSwgdyA9IGcuX21hbGxvYygzICogYSAqIDQpLCBwID0gZy5fbWFsbG9jKGEgKiA0KSwgUiA9IGcuX21hbGxvYyhhICogNCksIGsgPSBnLl9tYWxsb2MoYSAqIDQpLCBKID0gZy5fbWFsbG9jKGEgKiA0KSksIFkgPCBRLnRyYW5zZm9ybXMubGVuZ3RoICYmIChZID4gMCAmJiBnLl9mcmVlKGMpLCBZID0gUS50cmFuc2Zvcm1zLmxlbmd0aCwgYyA9IGcuX21hbGxvYyhZICogNCkpLCBEID0gITEsIEYgJiYgKEYgPSAhMSwgYXdhaXQgWigpKTsKfSwgc0EgPSAoKSA9PiB7CiAgaWYgKCEoRCB8fCBGIHx8ICFnIHx8ICFRKSkgewogICAgRCA9ICEwOwogICAgdHJ5IHsKICAgICAgY29uc3QgQyA9IGcuSEVBUEYzMiwgciA9IGcuSEVBUFUzMjsKICAgICAgaWYgKHcgLyA0ICsgUS5wb3NpdGlvbnMubGVuZ3RoID4gQy5sZW5ndGgpCiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJQb3NpdGlvbnMgYnVmZmVyIG92ZXJmbG93Iik7CiAgICAgIGlmIChjIC8gNCArIFEudHJhbnNmb3Jtcy5sZW5ndGggPiBDLmxlbmd0aCkKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoIlRyYW5zZm9ybXMgYnVmZmVyIG92ZXJmbG93Iik7CiAgICAgIGlmIChOIC8gNCArIFEudHJhbnNmb3JtSW5kaWNlcy5sZW5ndGggPiByLmxlbmd0aCkKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoIlRyYW5zZm9ybSBpbmRpY2VzIGJ1ZmZlciBvdmVyZmxvdyIpOwogICAgICBpZiAoQy5zZXQoUS5wb3NpdGlvbnMsIHcgLyA0KSwgQy5zZXQoUS50cmFuc2Zvcm1zLCBjIC8gNCksIHIuc2V0KFEudHJhbnNmb3JtSW5kaWNlcywgTiAvIDQpLCBDLnNldChuZXcgRmxvYXQzMkFycmF5KEgpLCBkIC8gNCksIGcuX3NvcnQoCiAgICAgICAgZCwKICAgICAgICBjLAogICAgICAgIE4sCiAgICAgICAgUS52ZXJ0ZXhDb3VudCwKICAgICAgICB3LAogICAgICAgIHAsCiAgICAgICAgUiwKICAgICAgICBrLAogICAgICAgIEoKICAgICAgKSwgUiArIFEudmVydGV4Q291bnQgKiA0ID4gci5idWZmZXIuYnl0ZUxlbmd0aCkKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoIkRlcHRoIGluZGV4IGJ1ZmZlciBvdmVyZmxvdyIpOwogICAgICBjb25zdCBJID0gbmV3IFVpbnQzMkFycmF5KHIuYnVmZmVyLCBSLCBRLnZlcnRleENvdW50KSwgbCA9IG5ldyBVaW50MzJBcnJheShJLnNsaWNlKCkuYnVmZmVyKTsKICAgICAgc2VsZi5wb3N0TWVzc2FnZSh7IGRlcHRoSW5kZXg6IGwgfSwgW2wuYnVmZmVyXSk7CiAgICB9IGNhdGNoIHsKICAgICAgc2VsZi5wb3N0TWVzc2FnZSh7IGRlcHRoSW5kZXg6IG5ldyBVaW50MzJBcnJheSgwKSB9LCBbXSk7CiAgICB9CiAgICBEID0gITEsIEcgPSAhMTsKICB9Cn0sIFggPSAoKSA9PiB7CiAgSyB8fCAoSyA9ICEwLCBHICYmIHNBKCksIHNldFRpbWVvdXQoKCkgPT4gewogICAgSyA9ICExLCBYKCk7CiAgfSkpOwp9OwpzZWxmLm9ubWVzc2FnZSA9IChDKSA9PiB7CiAgQy5kYXRhLnNvcnREYXRhICYmIChRID8gKFEucG9zaXRpb25zLnNldChDLmRhdGEuc29ydERhdGEucG9zaXRpb25zKSwgUS50cmFuc2Zvcm1zLnNldChDLmRhdGEuc29ydERhdGEudHJhbnNmb3JtcyksIFEudHJhbnNmb3JtSW5kaWNlcy5zZXQoQy5kYXRhLnNvcnREYXRhLnRyYW5zZm9ybUluZGljZXMpLCBRLnZlcnRleENvdW50ID0gQy5kYXRhLnNvcnREYXRhLnZlcnRleENvdW50KSA6IFEgPSB7CiAgICBwb3NpdGlvbnM6IG5ldyBGbG9hdDMyQXJyYXkoQy5kYXRhLnNvcnREYXRhLnBvc2l0aW9ucyksCiAgICB0cmFuc2Zvcm1zOiBuZXcgRmxvYXQzMkFycmF5KEMuZGF0YS5zb3J0RGF0YS50cmFuc2Zvcm1zKSwKICAgIHRyYW5zZm9ybUluZGljZXM6IG5ldyBVaW50MzJBcnJheShDLmRhdGEuc29ydERhdGEudHJhbnNmb3JtSW5kaWNlcyksCiAgICB2ZXJ0ZXhDb3VudDogQy5kYXRhLnNvcnREYXRhLnZlcnRleENvdW50CiAgfSwgRyA9ICEwLCBaKCkpLCBDLmRhdGEudmlld1Byb2ogJiYgKEMuZGF0YS52aWV3UHJvai5ldmVyeSgocikgPT4gSC5pbmNsdWRlcyhyKSkgPT09ICExICYmIChIID0gQy5kYXRhLnZpZXdQcm9qLCBHID0gITApLCBYKCkpOwp9OwovLyMgc291cmNlTWFwcGluZ1VSTD1Tb3J0V29ya2VyLURRTDdVVEVoLmpzLm1hcAo=",ft=E=>Uint8Array.from(atob(E),t=>t.charCodeAt(0)),Ut=typeof self<"u"&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",ft(rt)],{type:"text/javascript;charset=utf-8"});function kt(E){let t;try{if(t=Ut&&(self.URL||self.webkitURL).createObjectURL(Ut),!t)throw"";const e=new Worker(t,{type:"module",name:E?.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+rt,{type:"module",name:E?.name})}}class yt{constructor(t,e){this._scene=null,this._camera=null,this._started=!1,this._initialized=!1,this._renderer=t;const A=t.gl;this._program=A.createProgram(),this._passes=e||[];const Q=A.createShader(A.VERTEX_SHADER);A.shaderSource(Q,this._getVertexSource()),A.compileShader(Q),A.getShaderParameter(Q,A.COMPILE_STATUS)||console.error(A.getShaderInfoLog(Q));const s=A.createShader(A.FRAGMENT_SHADER);A.shaderSource(s,this._getFragmentSource()),A.compileShader(s),A.getShaderParameter(s,A.COMPILE_STATUS)||console.error(A.getShaderInfoLog(s)),A.attachShader(this.program,Q),A.attachShader(this.program,s),A.linkProgram(this.program),A.getProgramParameter(this.program,A.LINK_STATUS)||console.error(A.getProgramInfoLog(this.program)),this.resize=()=>{A.useProgram(this._program),this._resize()},this.initialize=()=>{console.assert(!this._initialized,"ShaderProgram already initialized"),A.useProgram(this._program),this._initialize();for(const n of this.passes)n.initialize(this);this._initialized=!0,this._started=!0},this.render=(n,U)=>{A.useProgram(this._program),(this._scene!==n||this._camera!==U)&&(this.dispose(),this._scene=n,this._camera=U,this.initialize());for(const F of this.passes)F.render();this._render()},this.dispose=()=>{if(this._initialized){A.useProgram(this._program);for(const n of this.passes)n.dispose();this._dispose(),this._scene=null,this._camera=null,this._initialized=!1}}}get renderer(){return this._renderer}get scene(){return this._scene}get camera(){return this._camera}get program(){return this._program}get passes(){return this._passes}get started(){return this._started}}const at="dmFyIG9BID0gZnVuY3Rpb24oQyA9IHt9KSB7CiAgdmFyIGUsIEEgPSBDLCBoID0gaW1wb3J0Lm1ldGEudXJsLCBrID0gIiIsIHk7CiAgewogICAgdHJ5IHsKICAgICAgayA9IG5ldyBVUkwoIi4iLCBoKS5ocmVmOwogICAgfSBjYXRjaCB7CiAgICB9CiAgICB5ID0gKGcpID0+IHsKICAgICAgdmFyIEIgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgcmV0dXJuIEIub3BlbigiR0VUIiwgZywgITEpLCBCLnJlc3BvbnNlVHlwZSA9ICJhcnJheWJ1ZmZlciIsIEIuc2VuZChudWxsKSwgbmV3IFVpbnQ4QXJyYXkoQi5yZXNwb25zZSk7CiAgICB9OwogIH0KICBjb25zb2xlLmxvZy5iaW5kKGNvbnNvbGUpLCBjb25zb2xlLmVycm9yLmJpbmQoY29uc29sZSk7CiAgdmFyIEYsIEQsIE47CiAgZnVuY3Rpb24gVSgpIHsKICAgIHZhciBnID0gRC5idWZmZXI7CiAgICBBLkhFQVBVOCA9IE4gPSBuZXcgVWludDhBcnJheShnKSwgQS5IRUFQVTMyID0gbmV3IFVpbnQzMkFycmF5KGcpLCBBLkhFQVBGMzIgPSBuZXcgRmxvYXQzMkFycmF5KGcpLCBuZXcgQmlnSW50NjRBcnJheShnKSwgbmV3IEJpZ1VpbnQ2NEFycmF5KGcpOwogIH0KICBmdW5jdGlvbiBpKCkgewogICAgaWYgKEEucHJlUnVuKQogICAgICBmb3IgKHR5cGVvZiBBLnByZVJ1biA9PSAiZnVuY3Rpb24iICYmIChBLnByZVJ1biA9IFtBLnByZVJ1bl0pOyBBLnByZVJ1bi5sZW5ndGg7ICkKICAgICAgICAkKEEucHJlUnVuLnNoaWZ0KCkpOwogICAgeChUKTsKICB9CiAgZnVuY3Rpb24gSCgpIHsKICAgIGYuYygpOwogIH0KICBmdW5jdGlvbiBiKCkgewogICAgaWYgKEEucG9zdFJ1bikKICAgICAgZm9yICh0eXBlb2YgQS5wb3N0UnVuID09ICJmdW5jdGlvbiIgJiYgKEEucG9zdFJ1biA9IFtBLnBvc3RSdW5dKTsgQS5wb3N0UnVuLmxlbmd0aDsgKQogICAgICAgIE8oQS5wb3N0UnVuLnNoaWZ0KCkpOwogICAgeChqKTsKICB9CiAgdmFyIHMgPSAwLCB3ID0gbnVsbDsKICBmdW5jdGlvbiB2KGcpIHsKICAgIHMrKywgQS5tb25pdG9yUnVuRGVwZW5kZW5jaWVzPy4ocyk7CiAgfQogIGZ1bmN0aW9uIFAoZykgewogICAgaWYgKHMtLSwgQS5tb25pdG9yUnVuRGVwZW5kZW5jaWVzPy4ocyksIHMgPT0gMCAmJiB3KSB7CiAgICAgIHZhciBCID0gdzsKICAgICAgdyA9IG51bGwsIEIoKTsKICAgIH0KICB9CiAgdmFyIG07CiAgZnVuY3Rpb24gWCgpIHsKICAgIHJldHVybiBBQSgiQUdGemJRRUFBQUFCSmdaZ0FYOEJmMkFDZlgwQmYyQUJmUUYvWUFGL0FHQUxmMzkvZjM5L2YzOS9mMzhBWUFBQUFnY0JBV0VCWVFBQUF3Z0hBQUVDQXdBRUJRVUhBUUdDQW9DQUFnWUlBWDhCUVlDTUJBc0hGUVVCWWdJQUFXTUFCd0ZrQUFZQlpRQUZBV1lBQkF3QkFRcXFRQWRQQVFKL1FZQUlLQUlBSWdFZ0FFRUhha0Y0Y1NJQ2FpRUFBa0FnQWtFQUlBQWdBVTBiUlFSQUlBQS9BRUVRZEUwTkFTQUFFQUFOQVF0QmhBaEJNRFlDQUVGL0R3dEJnQWdnQURZQ0FDQUJDdzRBSUFBUUF5QUJFQU5CRUhSeUMzSUJCSDhnQUx3aUJFSC8vLzhEY1NFQkFrQWdCRUVYZGtIL0FYRWlBa1VOQUNBQ1FmQUFUUVJBSUFGQmdJQ0FCSEpCOFFBZ0FtdDJJUUVNQVFzZ0FrR05BVXNFUUVHQStBRWhBMEVBSVFFTUFRc2dBa0VLZEVHQWdBZHJJUU1MSUFNZ0JFRVFka0dBZ0FKeGNpQUJRUTEyY2d2Y0N3RUlmd0pBSUFCRkRRQWdBRUVJYXlJRElBQkJCR3NvQWdBaUFrRjRjU0lBYWlFRkFrQWdBa0VCY1EwQUlBSkJBbkZGRFFFZ0F5QURLQUlBSWdScklnTkJtQWdvQWdCSkRRRWdBQ0FFYWlFQUFrQUNRQUpBUVp3SUtBSUFJQU5IQkVBZ0F5Z0NEQ0VCSUFSQi93Rk5CRUFnQVNBREtBSUlJZ0pIRFFKQmlBaEJpQWdvQWdCQmZpQUVRUU4yZDNFMkFnQU1CUXNnQXlnQ0dDRUhJQUVnQTBjRVFDQURLQUlJSWdJZ0FUWUNEQ0FCSUFJMkFnZ01CQXNnQXlnQ0ZDSUNCSDhnQTBFVWFnVWdBeWdDRUNJQ1JRMERJQU5CRUdvTElRUURRQ0FFSVFZZ0FpSUJRUlJxSVFRZ0FTZ0NGQ0lDRFFBZ0FVRVFhaUVFSUFFb0FoQWlBZzBBQ3lBR1FRQTJBZ0FNQXdzZ0JTZ0NCQ0lDUVFOeFFRTkhEUU5Ca0FnZ0FEWUNBQ0FGSUFKQmZuRTJBZ1FnQXlBQVFRRnlOZ0lFSUFVZ0FEWUNBQThMSUFJZ0FUWUNEQ0FCSUFJMkFnZ01BZ3RCQUNFQkN5QUhSUTBBQWtBZ0F5Z0NIQ0lFUVFKMFFiZ0thaUlDS0FJQUlBTkdCRUFnQWlBQk5nSUFJQUVOQVVHTUNFR01DQ2dDQUVGK0lBUjNjVFlDQUF3Q0N3SkFJQU1nQnlnQ0VFWUVRQ0FISUFFMkFoQU1BUXNnQnlBQk5nSVVDeUFCUlEwQkN5QUJJQWMyQWhnZ0F5Z0NFQ0lDQkVBZ0FTQUNOZ0lRSUFJZ0FUWUNHQXNnQXlnQ0ZDSUNSUTBBSUFFZ0FqWUNGQ0FDSUFFMkFoZ0xJQU1nQlU4TkFDQUZLQUlFSWdSQkFYRkZEUUFDUUFKQUFrQUNRQ0FFUVFKeFJRUkFRYUFJS0FJQUlBVkdCRUJCb0FnZ0F6WUNBRUdVQ0VHVUNDZ0NBQ0FBYWlJQU5nSUFJQU1nQUVFQmNqWUNCQ0FEUVp3SUtBSUFSdzBHUVpBSVFRQTJBZ0JCbkFoQkFEWUNBQThMUVp3SUtBSUFJZ2NnQlVZRVFFR2NDQ0FETmdJQVFaQUlRWkFJS0FJQUlBQnFJZ0EyQWdBZ0F5QUFRUUZ5TmdJRUlBQWdBMm9nQURZQ0FBOExJQVJCZUhFZ0FHb2hBQ0FGS0FJTUlRRWdCRUgvQVUwRVFDQUZLQUlJSWdJZ0FVWUVRRUdJQ0VHSUNDZ0NBRUYrSUFSQkEzWjNjVFlDQUF3RkN5QUNJQUUyQWd3Z0FTQUNOZ0lJREFRTElBVW9BaGdoQ0NBQklBVkhCRUFnQlNnQ0NDSUNJQUUyQWd3Z0FTQUNOZ0lJREFNTElBVW9BaFFpQWdSL0lBVkJGR29GSUFVb0FoQWlBa1VOQWlBRlFSQnFDeUVFQTBBZ0JDRUdJQUlpQVVFVWFpRUVJQUVvQWhRaUFnMEFJQUZCRUdvaEJDQUJLQUlRSWdJTkFBc2dCa0VBTmdJQURBSUxJQVVnQkVGK2NUWUNCQ0FESUFCQkFYSTJBZ1FnQUNBRGFpQUFOZ0lBREFNTFFRQWhBUXNnQ0VVTkFBSkFJQVVvQWh3aUJFRUNkRUc0Q21vaUFpZ0NBQ0FGUmdSQUlBSWdBVFlDQUNBQkRRRkJqQWhCakFnb0FnQkJmaUFFZDNFMkFnQU1BZ3NDUUNBRklBZ29BaEJHQkVBZ0NDQUJOZ0lRREFFTElBZ2dBVFlDRkFzZ0FVVU5BUXNnQVNBSU5nSVlJQVVvQWhBaUFnUkFJQUVnQWpZQ0VDQUNJQUUyQWhnTElBVW9BaFFpQWtVTkFDQUJJQUkyQWhRZ0FpQUJOZ0lZQ3lBRElBQkJBWEkyQWdRZ0FDQURhaUFBTmdJQUlBTWdCMGNOQUVHUUNDQUFOZ0lBRHdzZ0FFSC9BVTBFUUNBQVFYaHhRYkFJYWlFQ0FuOUJpQWdvQWdBaUJFRUJJQUJCQTNaMElnQnhSUVJBUVlnSUlBQWdCSEkyQWdBZ0Fnd0JDeUFDS0FJSUN5RUFJQUlnQXpZQ0NDQUFJQU0yQWd3Z0F5QUNOZ0lNSUFNZ0FEWUNDQThMUVI4aEFTQUFRZi8vL3dkTkJFQWdBRUVtSUFCQkNIWm5JZ0pyZGtFQmNTQUNRUUYwYTBFK2FpRUJDeUFESUFFMkFod2dBMElBTndJUUlBRkJBblJCdUFwcUlRUUNmd0pBQW45QmpBZ29BZ0FpQmtFQklBRjBJZ0p4UlFSQVFZd0lJQUlnQm5JMkFnQWdCQ0FETmdJQVFSZ2hBVUVJREFFTElBQkJHU0FCUVFGMmEwRUFJQUZCSDBjYmRDRUJJQVFvQWdBaEJBTkFJQVFpQWlnQ0JFRjRjU0FBUmcwQ0lBRkJIWFloQkNBQlFRRjBJUUVnQWlBRVFRUnhhaUlHS0FJUUlnUU5BQXNnQmlBRE5nSVFRUmdoQVNBQ0lRUkJDQXNoQUNBRElnSU1BUXNnQWlnQ0NDSUVJQU0yQWd3Z0FpQUROZ0lJUVJnaEFFRUlJUUZCQUFzaEJpQUJJQU5xSUFRMkFnQWdBeUFDTmdJTUlBQWdBMm9nQmpZQ0FFR29DRUdvQ0NnQ0FFRUJheUlBUVg4Z0FCczJBZ0FMQzlFbkFRdC9Jd0JCRUdzaUNpUUFBa0FDUUFKQUFrQUNRQUpBQWtBQ1FBSkFBa0FnQUVIMEFVMEVRRUdJQ0NnQ0FDSUVRUkFnQUVFTGFrSDRBM0VnQUVFTFNSc2lCa0VEZGlJQWRpSUJRUU54QkVBQ1FDQUJRWDl6UVFGeElBQnFJZ0pCQTNRaUFVR3dDR29pQUNBQlFiZ0lhaWdDQUNJQktBSUlJZ1ZHQkVCQmlBZ2dCRUYrSUFKM2NUWUNBQXdCQ3lBRklBQTJBZ3dnQUNBRk5nSUlDeUFCUVFocUlRQWdBU0FDUVFOMElnSkJBM0kyQWdRZ0FTQUNhaUlCSUFFb0FnUkJBWEkyQWdRTUN3c2dCa0dRQ0NnQ0FDSUlUUTBCSUFFRVFBSkFRUUlnQUhRaUFrRUFJQUpyY2lBQklBQjBjV2dpQVVFRGRDSUFRYkFJYWlJQ0lBQkJ1QWhxS0FJQUlnQW9BZ2dpQlVZRVFFR0lDQ0FFUVg0Z0FYZHhJZ1EyQWdBTUFRc2dCU0FDTmdJTUlBSWdCVFlDQ0FzZ0FDQUdRUU55TmdJRUlBQWdCbW9pQnlBQlFRTjBJZ0VnQm1zaUJVRUJjallDQkNBQUlBRnFJQVUyQWdBZ0NBUkFJQWhCZUhGQnNBaHFJUUZCbkFnb0FnQWhBZ0ovSUFSQkFTQUlRUU4yZENJRGNVVUVRRUdJQ0NBRElBUnlOZ0lBSUFFTUFRc2dBU2dDQ0FzaEF5QUJJQUkyQWdnZ0F5QUNOZ0lNSUFJZ0FUWUNEQ0FDSUFNMkFnZ0xJQUJCQ0dvaEFFR2NDQ0FITmdJQVFaQUlJQVUyQWdBTUN3dEJqQWdvQWdBaUMwVU5BU0FMYUVFQ2RFRzRDbW9vQWdBaUFpZ0NCRUY0Y1NBR2F5RURJQUloQVFOQUFrQWdBU2dDRUNJQVJRUkFJQUVvQWhRaUFFVU5BUXNnQUNnQ0JFRjRjU0FHYXlJQklBTWdBU0FEU1NJQkd5RURJQUFnQWlBQkd5RUNJQUFoQVF3QkN3c2dBaWdDR0NFSklBSWdBaWdDRENJQVJ3UkFJQUlvQWdnaUFTQUFOZ0lNSUFBZ0FUWUNDQXdLQ3lBQ0tBSVVJZ0VFZnlBQ1FSUnFCU0FDS0FJUUlnRkZEUU1nQWtFUWFnc2hCUU5BSUFVaEJ5QUJJZ0JCRkdvaEJTQUFLQUlVSWdFTkFDQUFRUkJxSVFVZ0FDZ0NFQ0lCRFFBTElBZEJBRFlDQUF3SkMwRi9JUVlnQUVHL2Ywc05BQ0FBUVF0cUlnRkJlSEVoQmtHTUNDZ0NBQ0lIUlEwQVFSOGhDRUVBSUFacklRTWdBRUgwLy84SFRRUkFJQVpCSmlBQlFRaDJaeUlBYTNaQkFYRWdBRUVCZEd0QlBtb2hDQXNDUUFKQUFrQWdDRUVDZEVHNENtb29BZ0FpQVVVRVFFRUFJUUFNQVF0QkFDRUFJQVpCR1NBSVFRRjJhMEVBSUFoQkgwY2JkQ0VDQTBBQ1FDQUJLQUlFUVhoeElBWnJJZ1FnQTA4TkFDQUJJUVVnQkNJRERRQkJBQ0VESUFFaEFBd0RDeUFBSUFFb0FoUWlCQ0FFSUFFZ0FrRWRka0VFY1dvb0FoQWlBVVliSUFBZ0JCc2hBQ0FDUVFGMElRSWdBUTBBQ3dzZ0FDQUZja1VFUUVFQUlRVkJBaUFJZENJQVFRQWdBR3R5SUFkeElnQkZEUU1nQUdoQkFuUkJ1QXBxS0FJQUlRQUxJQUJGRFFFTEEwQWdBQ2dDQkVGNGNTQUdheUlDSUFOSklRRWdBaUFESUFFYklRTWdBQ0FGSUFFYklRVWdBQ2dDRUNJQkJIOGdBUVVnQUNnQ0ZBc2lBQTBBQ3dzZ0JVVU5BQ0FEUVpBSUtBSUFJQVpyVHcwQUlBVW9BaGdoQ0NBRklBVW9BZ3dpQUVjRVFDQUZLQUlJSWdFZ0FEWUNEQ0FBSUFFMkFnZ01DQXNnQlNnQ0ZDSUJCSDhnQlVFVWFnVWdCU2dDRUNJQlJRMERJQVZCRUdvTElRSURRQ0FDSVFRZ0FTSUFRUlJxSVFJZ0FDZ0NGQ0lCRFFBZ0FFRVFhaUVDSUFBb0FoQWlBUTBBQ3lBRVFRQTJBZ0FNQndzZ0JrR1FDQ2dDQUNJRlRRUkFRWndJS0FJQUlRQUNRQ0FGSUFacklnRkJFRThFUUNBQUlBWnFJZ0lnQVVFQmNqWUNCQ0FBSUFWcUlBRTJBZ0FnQUNBR1FRTnlOZ0lFREFFTElBQWdCVUVEY2pZQ0JDQUFJQVZxSWdFZ0FTZ0NCRUVCY2pZQ0JFRUFJUUpCQUNFQkMwR1FDQ0FCTmdJQVFad0lJQUkyQWdBZ0FFRUlhaUVBREFrTElBWkJsQWdvQWdBaUFra0VRRUdVQ0NBQ0lBWnJJZ0UyQWdCQm9BaEJvQWdvQWdBaUFDQUdhaUlDTmdJQUlBSWdBVUVCY2pZQ0JDQUFJQVpCQTNJMkFnUWdBRUVJYWlFQURBa0xRUUFoQUNBR1FTOXFJZ01DZjBIZ0N5Z0NBQVJBUWVnTEtBSUFEQUVMUWV3TFFuODNBZ0JCNUF0Q2dLQ0FnSUNBQkRjQ0FFSGdDeUFLUVF4cVFYQnhRZGlxMWFvRmN6WUNBRUgwQzBFQU5nSUFRY1FMUVFBMkFnQkJnQ0FMSWdGcUlnUkJBQ0FCYXlJSGNTSUJJQVpORFFoQndBc29BZ0FpQlFSQVFiZ0xLQUlBSWdnZ0FXb2lDU0FJVFNBRklBbEpjZzBKQ3dKQVFjUUxMUUFBUVFSeFJRUkFBa0FDUUFKQUFrQkJvQWdvQWdBaUJRUkFRY2dMSVFBRFFDQUFLQUlBSWdnZ0JVMEVRQ0FGSUFnZ0FDZ0NCR3BKRFFNTElBQW9BZ2dpQUEwQUN3dEJBQkFCSWdKQmYwWU5BeUFCSVFSQjVBc29BZ0FpQUVFQmF5SUZJQUp4QkVBZ0FTQUNheUFDSUFWcVFRQWdBR3R4YWlFRUN5QUVJQVpORFFOQndBc29BZ0FpQUFSQVFiZ0xLQUlBSWdVZ0JHb2lCeUFGVFNBQUlBZEpjZzBFQ3lBRUVBRWlBQ0FDUncwQkRBVUxJQVFnQW1zZ0IzRWlCQkFCSWdJZ0FDZ0NBQ0FBS0FJRWFrWU5BU0FDSVFBTElBQkJmMFlOQVNBR1FUQnFJQVJOQkVBZ0FDRUNEQVFMUWVnTEtBSUFJZ0lnQXlBRWEycEJBQ0FDYTNFaUFoQUJRWDlHRFFFZ0FpQUVhaUVFSUFBaEFnd0RDeUFDUVg5SERRSUxRY1FMUWNRTEtBSUFRUVJ5TmdJQUN5QUJFQUVpQWtGL1JrRUFFQUVpQUVGL1JuSWdBQ0FDVFhJTkJTQUFJQUpySWdRZ0JrRW9hazBOQlF0QnVBdEJ1QXNvQWdBZ0JHb2lBRFlDQUVHOEN5Z0NBQ0FBU1FSQVFid0xJQUEyQWdBTEFrQkJvQWdvQWdBaUF3UkFRY2dMSVFBRFFDQUNJQUFvQWdBaUFTQUFLQUlFSWdWcVJnMENJQUFvQWdnaUFBMEFDd3dFQzBHWUNDZ0NBQ0lBUVFBZ0FDQUNUUnRGQkVCQm1BZ2dBallDQUF0QkFDRUFRY3dMSUFRMkFnQkJ5QXNnQWpZQ0FFR29DRUYvTmdJQVFhd0lRZUFMS0FJQU5nSUFRZFFMUVFBMkFnQURRQ0FBUVFOMElnRkJ1QWhxSUFGQnNBaHFJZ1UyQWdBZ0FVRzhDR29nQlRZQ0FDQUFRUUZxSWdCQklFY05BQXRCbEFnZ0JFRW9heUlBUVhnZ0FtdEJCM0VpQVdzaUJUWUNBRUdnQ0NBQklBSnFJZ0UyQWdBZ0FTQUZRUUZ5TmdJRUlBQWdBbXBCS0RZQ0JFR2tDRUh3Q3lnQ0FEWUNBQXdFQ3lBQ0lBTk5JQUVnQTB0eURRSWdBQ2dDREVFSWNRMENJQUFnQkNBRmFqWUNCRUdnQ0NBRFFYZ2dBMnRCQjNFaUFHb2lBVFlDQUVHVUNFR1VDQ2dDQUNBRWFpSUNJQUJySWdBMkFnQWdBU0FBUVFGeU5nSUVJQUlnQTJwQktEWUNCRUdrQ0VId0N5Z0NBRFlDQUF3REMwRUFJUUFNQmd0QkFDRUFEQVFMUVpnSUtBSUFJQUpMQkVCQm1BZ2dBallDQUFzZ0FpQUVhaUVGUWNnTElRQUNRQU5BSUFVZ0FDZ0NBQ0lCUndSQUlBQW9BZ2dpQUEwQkRBSUxDeUFBTFFBTVFRaHhSUTBEQzBISUN5RUFBMEFDUUNBQUtBSUFJZ0VnQTAwRVFDQURJQUVnQUNnQ0JHb2lCVWtOQVFzZ0FDZ0NDQ0VBREFFTEMwR1VDQ0FFUVNocklnQkJlQ0FDYTBFSGNTSUJheUlITmdJQVFhQUlJQUVnQW1vaUFUWUNBQ0FCSUFkQkFYSTJBZ1FnQUNBQ2FrRW9OZ0lFUWFRSVFmQUxLQUlBTmdJQUlBTWdCVUVuSUFWclFRZHhha0V2YXlJQUlBQWdBMEVRYWtrYklnRkJHellDQkNBQlFkQUxLUUlBTndJUUlBRkJ5QXNwQWdBM0FnaEIwQXNnQVVFSWFqWUNBRUhNQ3lBRU5nSUFRY2dMSUFJMkFnQkIxQXRCQURZQ0FDQUJRUmhxSVFBRFFDQUFRUWMyQWdRZ0FFRUlhaUFBUVFScUlRQWdCVWtOQUFzZ0FTQURSZzBBSUFFZ0FTZ0NCRUYrY1RZQ0JDQURJQUVnQTJzaUFrRUJjallDQkNBQklBSTJBZ0FDZnlBQ1FmOEJUUVJBSUFKQmVIRkJzQWhxSVFBQ2YwR0lDQ2dDQUNJQlFRRWdBa0VEZG5RaUFuRkZCRUJCaUFnZ0FTQUNjallDQUNBQURBRUxJQUFvQWdnTElRRWdBQ0FETmdJSUlBRWdBellDREVFTUlRSkJDQXdCQzBFZklRQWdBa0gvLy84SFRRUkFJQUpCSmlBQ1FRaDJaeUlBYTNaQkFYRWdBRUVCZEd0QlBtb2hBQXNnQXlBQU5nSWNJQU5DQURjQ0VDQUFRUUowUWJnS2FpRUJBa0FDUUVHTUNDZ0NBQ0lGUVFFZ0FIUWlCSEZGQkVCQmpBZ2dCQ0FGY2pZQ0FDQUJJQU0yQWdBTUFRc2dBa0VaSUFCQkFYWnJRUUFnQUVFZlJ4dDBJUUFnQVNnQ0FDRUZBMEFnQlNJQktBSUVRWGh4SUFKR0RRSWdBRUVkZGlFRklBQkJBWFFoQUNBQklBVkJCSEZxSWdRb0FoQWlCUTBBQ3lBRUlBTTJBaEFMSUFNZ0FUWUNHRUVJSVFJZ0F5SUJJUUJCREF3QkN5QUJLQUlJSWdBZ0F6WUNEQ0FCSUFNMkFnZ2dBeUFBTmdJSVFRQWhBRUVZSVFKQkRBc2dBMm9nQVRZQ0FDQUNJQU5xSUFBMkFnQUxRWlFJS0FJQUlnQWdCazBOQUVHVUNDQUFJQVpySWdFMkFnQkJvQWhCb0Fnb0FnQWlBQ0FHYWlJQ05nSUFJQUlnQVVFQmNqWUNCQ0FBSUFaQkEzSTJBZ1FnQUVFSWFpRUFEQVFMUVlRSVFUQTJBZ0JCQUNFQURBTUxJQUFnQWpZQ0FDQUFJQUFvQWdRZ0JHbzJBZ1FnQWtGNElBSnJRUWR4YWlJSUlBWkJBM0kyQWdRZ0FVRjRJQUZyUVFkeGFpSUVJQVlnQ0dvaUEyc2hCd0pBUWFBSUtBSUFJQVJHQkVCQm9BZ2dBellDQUVHVUNFR1VDQ2dDQUNBSGFpSUFOZ0lBSUFNZ0FFRUJjallDQkF3QkMwR2NDQ2dDQUNBRVJnUkFRWndJSUFNMkFnQkJrQWhCa0Fnb0FnQWdCMm9pQURZQ0FDQURJQUJCQVhJMkFnUWdBQ0FEYWlBQU5nSUFEQUVMSUFRb0FnUWlBRUVEY1VFQlJnUkFJQUJCZUhFaENTQUVLQUlNSVFJQ1FDQUFRZjhCVFFSQUlBUW9BZ2dpQVNBQ1JnUkFRWWdJUVlnSUtBSUFRWDRnQUVFRGRuZHhOZ0lBREFJTElBRWdBallDRENBQ0lBRTJBZ2dNQVFzZ0JDZ0NHQ0VHQWtBZ0FpQUVSd1JBSUFRb0FnZ2lBQ0FDTmdJTUlBSWdBRFlDQ0F3QkN3SkFJQVFvQWhRaUFBUi9JQVJCRkdvRklBUW9BaEFpQUVVTkFTQUVRUkJxQ3lFQkEwQWdBU0VGSUFBaUFrRVVhaUVCSUFBb0FoUWlBQTBBSUFKQkVHb2hBU0FDS0FJUUlnQU5BQXNnQlVFQU5nSUFEQUVMUVFBaEFnc2dCa1VOQUFKQUlBUW9BaHdpQUVFQ2RFRzRDbW9pQVNnQ0FDQUVSZ1JBSUFFZ0FqWUNBQ0FDRFFGQmpBaEJqQWdvQWdCQmZpQUFkM0UyQWdBTUFnc0NRQ0FFSUFZb0FoQkdCRUFnQmlBQ05nSVFEQUVMSUFZZ0FqWUNGQXNnQWtVTkFRc2dBaUFHTmdJWUlBUW9BaEFpQUFSQUlBSWdBRFlDRUNBQUlBSTJBaGdMSUFRb0FoUWlBRVVOQUNBQ0lBQTJBaFFnQUNBQ05nSVlDeUFISUFscUlRY2dCQ0FKYWlJRUtBSUVJUUFMSUFRZ0FFRitjVFlDQkNBRElBZEJBWEkyQWdRZ0F5QUhhaUFITmdJQUlBZEIvd0ZOQkVBZ0IwRjRjVUd3Q0dvaEFBSi9RWWdJS0FJQUlnRkJBU0FIUVFOMmRDSUNjVVVFUUVHSUNDQUJJQUp5TmdJQUlBQU1BUXNnQUNnQ0NBc2hBU0FBSUFNMkFnZ2dBU0FETmdJTUlBTWdBRFlDRENBRElBRTJBZ2dNQVF0Qkh5RUNJQWRCLy8vL0IwMEVRQ0FIUVNZZ0IwRUlkbWNpQUd0MlFRRnhJQUJCQVhSclFUNXFJUUlMSUFNZ0FqWUNIQ0FEUWdBM0FoQWdBa0VDZEVHNENtb2hBQUpBQWtCQmpBZ29BZ0FpQVVFQklBSjBJZ1Z4UlFSQVFZd0lJQUVnQlhJMkFnQWdBQ0FETmdJQURBRUxJQWRCR1NBQ1FRRjJhMEVBSUFKQkgwY2JkQ0VDSUFBb0FnQWhBUU5BSUFFaUFDZ0NCRUY0Y1NBSFJnMENJQUpCSFhZaEFTQUNRUUYwSVFJZ0FDQUJRUVJ4YWlJRktBSVFJZ0VOQUFzZ0JTQUROZ0lRQ3lBRElBQTJBaGdnQXlBRE5nSU1JQU1nQXpZQ0NBd0JDeUFBS0FJSUlnRWdBellDRENBQUlBTTJBZ2dnQTBFQU5nSVlJQU1nQURZQ0RDQURJQUUyQWdnTElBaEJDR29oQUF3Q0N3SkFJQWhGRFFBQ1FDQUZLQUljSWdGQkFuUkJ1QXBxSWdJb0FnQWdCVVlFUUNBQ0lBQTJBZ0FnQUEwQlFZd0lJQWRCZmlBQmQzRWlCellDQUF3Q0N3SkFJQVVnQ0NnQ0VFWUVRQ0FJSUFBMkFoQU1BUXNnQ0NBQU5nSVVDeUFBUlEwQkN5QUFJQWcyQWhnZ0JTZ0NFQ0lCQkVBZ0FDQUJOZ0lRSUFFZ0FEWUNHQXNnQlNnQ0ZDSUJSUTBBSUFBZ0FUWUNGQ0FCSUFBMkFoZ0xBa0FnQTBFUFRRUkFJQVVnQXlBR2FpSUFRUU55TmdJRUlBQWdCV29pQUNBQUtBSUVRUUZ5TmdJRURBRUxJQVVnQmtFRGNqWUNCQ0FGSUFacUlnUWdBMEVCY2pZQ0JDQURJQVJxSUFNMkFnQWdBMEgvQVUwRVFDQURRWGh4UWJBSWFpRUFBbjlCaUFnb0FnQWlBVUVCSUFOQkEzWjBJZ0p4UlFSQVFZZ0lJQUVnQW5JMkFnQWdBQXdCQ3lBQUtBSUlDeUVCSUFBZ0JEWUNDQ0FCSUFRMkFnd2dCQ0FBTmdJTUlBUWdBVFlDQ0F3QkMwRWZJUUFnQTBILy8vOEhUUVJBSUFOQkppQURRUWgyWnlJQWEzWkJBWEVnQUVFQmRHdEJQbW9oQUFzZ0JDQUFOZ0ljSUFSQ0FEY0NFQ0FBUVFKMFFiZ0thaUVCQWtBQ1FDQUhRUUVnQUhRaUFuRkZCRUJCakFnZ0FpQUhjallDQUNBQklBUTJBZ0FnQkNBQk5nSVlEQUVMSUFOQkdTQUFRUUYyYTBFQUlBQkJIMGNiZENFQUlBRW9BZ0FoQVFOQUlBRWlBaWdDQkVGNGNTQURSZzBDSUFCQkhYWWhBU0FBUVFGMElRQWdBaUFCUVFSeGFpSUhLQUlRSWdFTkFBc2dCeUFFTmdJUUlBUWdBallDR0FzZ0JDQUVOZ0lNSUFRZ0JEWUNDQXdCQ3lBQ0tBSUlJZ0FnQkRZQ0RDQUNJQVEyQWdnZ0JFRUFOZ0lZSUFRZ0FqWUNEQ0FFSUFBMkFnZ0xJQVZCQ0dvaEFBd0JDd0pBSUFsRkRRQUNRQ0FDS0FJY0lnRkJBblJCdUFwcUlnVW9BZ0FnQWtZRVFDQUZJQUEyQWdBZ0FBMEJRWXdJSUF0QmZpQUJkM0UyQWdBTUFnc0NRQ0FDSUFrb0FoQkdCRUFnQ1NBQU5nSVFEQUVMSUFrZ0FEWUNGQXNnQUVVTkFRc2dBQ0FKTmdJWUlBSW9BaEFpQVFSQUlBQWdBVFlDRUNBQklBQTJBaGdMSUFJb0FoUWlBVVVOQUNBQUlBRTJBaFFnQVNBQU5nSVlDd0pBSUFOQkQwMEVRQ0FDSUFNZ0Jtb2lBRUVEY2pZQ0JDQUFJQUpxSWdBZ0FDZ0NCRUVCY2pZQ0JBd0JDeUFDSUFaQkEzSTJBZ1FnQWlBR2FpSUZJQU5CQVhJMkFnUWdBeUFGYWlBRE5nSUFJQWdFUUNBSVFYaHhRYkFJYWlFQVFad0lLQUlBSVFFQ2YwRUJJQWhCQTNaMElnY2dCSEZGQkVCQmlBZ2dCQ0FIY2pZQ0FDQUFEQUVMSUFBb0FnZ0xJUVFnQUNBQk5nSUlJQVFnQVRZQ0RDQUJJQUEyQWd3Z0FTQUVOZ0lJQzBHY0NDQUZOZ0lBUVpBSUlBTTJBZ0FMSUFKQkNHb2hBQXNnQ2tFUWFpUUFJQUFMb1FzQ0MzOEpmU01BUWFBQmF5SUxKQUFnQzBFd2FrRUFRU1Q4Q3dBRFFDQUJJQTVIQkVBZ0FpQU9RUU5zSWd4QkFtcEJBblFpRDJvcUFnQWhGeUFDSUF4QkFXcEJBblFpRUdvcUFnQWhHQ0FJSUF4QkFuUWlFV29nQWlBUmFpb0NBQ0laT0FJQUlBZ2dFR29nR0RnQ0FDQUlJQTlxSUJjNEFnQWdCeUFPUVFWMGFpSU5RUUEyQWd3Z0RTQVhPQUlJSUEwZ0dEZ0NCQ0FOSUJrNEFnQUNRQ0FBUlFSQUlBWWdEbW90QUFCRkRRRUxJQTFCZ0lDQUNEWUNEQXNnRFNBRklBNUJBblFpREVFQmNpSVNhaTBBQUVFSWRDQUZJQXhxTFFBQWNpQUZJQXhCQW5JaUUyb3RBQUJCRUhSeUlBVWdERUVEY2lJTWFpMEFBRUVZZEhJMkFod2dDeUFESUJKQkFuUWlFbW9xQWdBaUZ6Z0NrQUVnQ3lBRElCTkJBblFpRTJvcUFnQWlHRGdDbEFFZ0N5QURJQXhCQW5RaUZHb3FBZ0FpR1RnQ21BRWdDeUFESUE1QkJIUWlGV29xQWdDTUlobzRBcHdCSUF0QjRBQnFJZ3dnQ3lvQ21BRWlGa01BQUFEQWxDQVdsQ0FMS2dLVUFTSVdRd0FBQU1DVUlCYVVRd0FBZ0QrU2tqZ0NBQ0FNSUFzcUFwQUJJaFlnRnBJZ0N5b0NsQUdVSUFzcUFwZ0JJaFlnRnBJZ0N5b0NuQUdVa3pnQ0JDQU1JQXNxQXBBQkloWWdGcElnQ3lvQ21BR1VJQXNxQXBRQkloWWdGcElnQ3lvQ25BR1VramdDQ0NBTUlBc3FBcEFCSWhZZ0ZwSWdDeW9DbEFHVUlBc3FBcGdCSWhZZ0ZwSWdDeW9DbkFHVWtqZ0NEQ0FNSUFzcUFwZ0JJaFpEQUFBQXdKUWdGcFFnQ3lvQ2tBRWlGa01BQUFEQWxDQVdsRU1BQUlBL2twSTRBaEFnRENBTEtnS1VBU0lXSUJhU0lBc3FBcGdCbENBTEtnS1FBU0lXSUJhU0lBc3FBcHdCbEpNNEFoUWdEQ0FMS2dLUUFTSVdJQmFTSUFzcUFwZ0JsQ0FMS2dLVUFTSVdJQmFTSUFzcUFwd0JsSk00QWhnZ0RDQUxLZ0tVQVNJV0lCYVNJQXNxQXBnQmxDQUxLZ0tRQVNJV0lCYVNJQXNxQXB3QmxKSTRBaHdnRENBTEtnS1VBU0lXUXdBQUFNQ1VJQmFVSUFzcUFwQUJJaFpEQUFBQXdKUWdGcFJEQUFDQVA1S1NPQUlnSUFrZ0ZXb2dGemdDQUNBSklCSnFJQmc0QWdBZ0NTQVRhaUFaT0FJQUlBa2dGR29nR2pnQ0FDQUxJQVFnRVdvcUFnQWlGemdDTUNBTElBUWdFR29xQWdBaUdEZ0NRQ0FMSUFRZ0Qyb3FBZ0FpR1RnQ1VDQUtJQkZxSUJjNEFnQWdDaUFRYWlBWU9BSUFJQW9nRDJvZ0dUZ0NBQ0FMSUF3cUFoZ2dDeW9DT0pRZ0RDb0NBQ0FMS2dJd2xDQU1LZ0lNSUFzcUFqU1VrcEk0QWdBZ0N5QU1LZ0ljSUFzcUFqaVVJQXdxQWdRZ0N5b0NNSlFnRENvQ0VDQUxLZ0kwbEpLU09BSUVJQXNnRENvQ0lDQUxLZ0k0bENBTUtnSUlJQXNxQWpDVUlBd3FBaFFnQ3lvQ05KU1NramdDQ0NBTElBd3FBaGdnQ3lvQ1JKUWdEQ29DQUNBTEtnSThsQ0FNS2dJTUlBc3FBa0NVa3BJNEFnd2dDeUFNS2dJY0lBc3FBa1NVSUF3cUFnUWdDeW9DUEpRZ0RDb0NFQ0FMS2dKQWxKS1NPQUlRSUFzZ0RDb0NJQ0FMS2dKRWxDQU1LZ0lJSUFzcUFqeVVJQXdxQWhRZ0N5b0NRSlNTa2pnQ0ZDQUxJQXdxQWhnZ0N5b0NVSlFnRENvQ0FDQUxLZ0pJbENBTUtnSU1JQXNxQWt5VWtwSTRBaGdnQ3lBTUtnSWNJQXNxQWxDVUlBd3FBZ1FnQ3lvQ1NKUWdEQ29DRUNBTEtnSk1sSktTT0FJY0lBc2dEQ29DSUNBTEtnSlFsQ0FNS2dJSUlBc3FBa2lVSUF3cUFoUWdDeW9DVEpTU2tqZ0NJQ0FMS2dJZ0lSY2dDeW9DQ0NFWUlBc3FBaFFoR1NBTklBc3FBaGdpR2lBYWxDQUxLZ0lBSWhZZ0ZwUWdDeW9DRENJYklCdVVrcEpEQUFDQVFKUWdHaUFMS2dJY0loeVVJQllnQ3lvQ0JDSWRsQ0FiSUFzcUFoQWlIcFNTa2tNQUFJQkFsQkFDTmdJUUlBMGdHaUFYbENBV0lCaVVJQnNnR1pTU2trTUFBSUJBbENBY0lCeVVJQjBnSFpRZ0hpQWVsSktTUXdBQWdFQ1VFQUkyQWhRZ0RTQWNJQmVVSUIwZ0dKUWdIaUFabEpLU1F3QUFnRUNVSUJjZ0Y1UWdHQ0FZbENBWklCbVVrcEpEQUFDQVFKUVFBallDR0NBT1FRRnFJUTRNQVFzTElBdEJvQUZxSkFBTEFnQUxDd2tCQUVHQkNBc0NCZ0U9Iik7CiAgfQogIGZ1bmN0aW9uIFcoZykgewogICAgaWYgKEFycmF5QnVmZmVyLmlzVmlldyhnKSkKICAgICAgcmV0dXJuIGc7CiAgICBpZiAoZyA9PSBtICYmIEYpCiAgICAgIHJldHVybiBuZXcgVWludDhBcnJheShGKTsKICAgIGlmICh5KQogICAgICByZXR1cm4geShnKTsKICAgIHRocm93ICdzeW5jIGZldGNoaW5nIG9mIHRoZSB3YXNtIGZhaWxlZDogeW91IGNhbiBwcmVsb2FkIGl0IHRvIE1vZHVsZVsid2FzbUJpbmFyeSJdIG1hbnVhbGx5LCBvciBlbWNjLnB5IHdpbGwgZG8gdGhhdCBmb3IgeW91IHdoZW4gZ2VuZXJhdGluZyBIVE1MIChidXQgbm90IEpTKSc7CiAgfQogIGZ1bmN0aW9uIF8oZywgQikgewogICAgdmFyIEUsIFEgPSBXKGcpOwogICAgRSA9IG5ldyBXZWJBc3NlbWJseS5Nb2R1bGUoUSk7CiAgICB2YXIgbyA9IG5ldyBXZWJBc3NlbWJseS5JbnN0YW5jZShFLCBCKTsKICAgIHJldHVybiBbbywgRV07CiAgfQogIGZ1bmN0aW9uIFYoKSB7CiAgICByZXR1cm4geyBhOiBFQSB9OwogIH0KICBmdW5jdGlvbiB6KCkgewogICAgZnVuY3Rpb24gZyhRLCBvKSB7CiAgICAgIHJldHVybiBmID0gUS5leHBvcnRzLCBEID0gZi5iLCBVKCksIFFBKGYpLCBQKCksIGY7CiAgICB9CiAgICB2KCk7CiAgICB2YXIgQiA9IFYoKTsKICAgIGlmIChBLmluc3RhbnRpYXRlV2FzbSkKICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKChRLCBvKSA9PiB7CiAgICAgICAgQS5pbnN0YW50aWF0ZVdhc20oQiwgKHIsIGMpID0+IHsKICAgICAgICAgIFEoZyhyKSk7CiAgICAgICAgfSk7CiAgICAgIH0pOwogICAgbSA/Pz0gWCgpOwogICAgdmFyIEUgPSBfKG0sIEIpOwogICAgcmV0dXJuIGcoRVswXSk7CiAgfQogIGZvciAodmFyIHggPSAoZykgPT4gewogICAgZm9yICg7IGcubGVuZ3RoID4gMDsgKQogICAgICBnLnNoaWZ0KCkoQSk7CiAgfSwgaiA9IFtdLCBPID0gKGcpID0+IGoucHVzaChnKSwgVCA9IFtdLCAkID0gKGcpID0+IFQucHVzaChnKSwgQUEgPSAoZykgPT4gewogICAgZm9yICh2YXIgQiwgRSwgUSA9IDAsIG8gPSAwLCByID0gZy5sZW5ndGgsIGMgPSBuZXcgVWludDhBcnJheSgociAqIDMgPj4gMikgLSAoZ1tyIC0gMl0gPT0gIj0iKSAtIChnW3IgLSAxXSA9PSAiPSIpKTsgUSA8IHI7IFEgKz0gNCwgbyArPSAzKQogICAgICBCID0gbltnLmNoYXJDb2RlQXQoUSArIDEpXSwgRSA9IG5bZy5jaGFyQ29kZUF0KFEgKyAyKV0sIGNbb10gPSBuW2cuY2hhckNvZGVBdChRKV0gPDwgMiB8IEIgPj4gNCwgY1tvICsgMV0gPSBCIDw8IDQgfCBFID4+IDIsIGNbbyArIDJdID0gRSA8PCA2IHwgbltnLmNoYXJDb2RlQXQoUSArIDMpXTsKICAgIHJldHVybiBjOwogIH0sIGdBID0gKCkgPT4gMjE0NzQ4MzY0OCwgSUEgPSAoZywgQikgPT4gTWF0aC5jZWlsKGcgLyBCKSAqIEIsIENBID0gKGcpID0+IHsKICAgIHZhciBCID0gRC5idWZmZXIsIEUgPSAoZyAtIEIuYnl0ZUxlbmd0aCArIDY1NTM1KSAvIDY1NTM2IHwgMDsKICAgIHRyeSB7CiAgICAgIHJldHVybiBELmdyb3coRSksIFUoKSwgMTsKICAgIH0gY2F0Y2ggewogICAgfQogIH0sIEJBID0gKGcpID0+IHsKICAgIHZhciBCID0gTi5sZW5ndGg7CiAgICBnID4+Pj0gMDsKICAgIHZhciBFID0gZ0EoKTsKICAgIGlmIChnID4gRSkKICAgICAgcmV0dXJuICExOwogICAgZm9yICh2YXIgUSA9IDE7IFEgPD0gNDsgUSAqPSAyKSB7CiAgICAgIHZhciBvID0gQiAqICgxICsgMC4yIC8gUSk7CiAgICAgIG8gPSBNYXRoLm1pbihvLCBnICsgMTAwNjYzMjk2KTsKICAgICAgdmFyIHIgPSBNYXRoLm1pbihFLCBJQShNYXRoLm1heChnLCBvKSwgNjU1MzYpKSwgYyA9IENBKHIpOwogICAgICBpZiAoYykKICAgICAgICByZXR1cm4gITA7CiAgICB9CiAgICByZXR1cm4gITE7CiAgfSwgbiA9IG5ldyBVaW50OEFycmF5KDEyMyksIGEgPSAyNTsgYSA+PSAwOyAtLWEpCiAgICBuWzQ4ICsgYV0gPSA1MiArIGEsIG5bNjUgKyBhXSA9IGEsIG5bOTcgKyBhXSA9IDI2ICsgYTsKICBuWzQzXSA9IDYyLCBuWzQ3XSA9IDYzLCBBLm5vRXhpdFJ1bnRpbWUgJiYgQS5ub0V4aXRSdW50aW1lLCBBLnByaW50ICYmIEEucHJpbnQsIEEucHJpbnRFcnIgJiYgQS5wcmludEVyciwgQS53YXNtQmluYXJ5ICYmIChGID0gQS53YXNtQmluYXJ5KSwgQS5hcmd1bWVudHMgJiYgQS5hcmd1bWVudHMsIEEudGhpc1Byb2dyYW0gJiYgQS50aGlzUHJvZ3JhbTsKICBmdW5jdGlvbiBRQShnKSB7CiAgICBBLl9wYWNrID0gZy5kLCBBLl9tYWxsb2MgPSBnLmUsIEEuX2ZyZWUgPSBnLmY7CiAgfQogIHZhciBFQSA9IHsgYTogQkEgfSwgZiA9IHooKTsKICBmdW5jdGlvbiBxKCkgewogICAgaWYgKHMgPiAwKSB7CiAgICAgIHcgPSBxOwogICAgICByZXR1cm47CiAgICB9CiAgICBpZiAoaSgpLCBzID4gMCkgewogICAgICB3ID0gcTsKICAgICAgcmV0dXJuOwogICAgfQogICAgZnVuY3Rpb24gZygpIHsKICAgICAgQS5jYWxsZWRSdW4gPSAhMCwgSCgpLCBBLm9uUnVudGltZUluaXRpYWxpemVkPy4oKSwgYigpOwogICAgfQogICAgQS5zZXRTdGF0dXMgPyAoQS5zZXRTdGF0dXMoIlJ1bm5pbmcuLi4iKSwgc2V0VGltZW91dCgoKSA9PiB7CiAgICAgIHNldFRpbWVvdXQoKCkgPT4gQS5zZXRTdGF0dXMoIiIpLCAxKSwgZygpOwogICAgfSwgMSkpIDogZygpOwogIH0KICBmdW5jdGlvbiBpQSgpIHsKICAgIGlmIChBLnByZUluaXQpCiAgICAgIGZvciAodHlwZW9mIEEucHJlSW5pdCA9PSAiZnVuY3Rpb24iICYmIChBLnByZUluaXQgPSBbQS5wcmVJbml0XSk7IEEucHJlSW5pdC5sZW5ndGggPiAwOyApCiAgICAgICAgQS5wcmVJbml0LnNoaWZ0KCkoKTsKICB9CiAgcmV0dXJuIGlBKCksIHEoKSwgZSA9IEEsIGU7Cn07CmxldCBJOwphc3luYyBmdW5jdGlvbiB0QSgpIHsKICBpZiAoSSA9IGF3YWl0IG9BKCksICFJIHx8ICFJLkhFQVBGMzIgfHwgIUkuX3BhY2spCiAgICB0aHJvdyBuZXcgRXJyb3IoIldBU00gbW9kdWxlIGZhaWxlZCB0byBpbml0aWFsaXplIHByb3Blcmx5Iik7Cn0KbGV0IHQgPSAwOwpjb25zdCBsID0gbmV3IEFycmF5KCk7CmxldCBLID0gITEsIHAgPSAhMSwgWSwgUiwgRywgdSwgZCwgTSwgUywgTCwgSjsKY29uc3QgZUEgPSBhc3luYyAoQykgPT4gewogIGZvciAoOyBwOyApCiAgICBhd2FpdCBuZXcgUHJvbWlzZSgoSCkgPT4gc2V0VGltZW91dChILCAwKSk7CiAgSSB8fCAocCA9ICEwLCBhd2FpdCB0QSgpLCBwID0gITEpOwogIGNvbnN0IGUgPSBNYXRoLnBvdygyLCBNYXRoLmNlaWwoTWF0aC5sb2cyKEMudmVydGV4Q291bnQpKSk7CiAgZSA+IHQgJiYgKHQgPiAwICYmIChJLl9mcmVlKFkpLCBJLl9mcmVlKFIpLCBJLl9mcmVlKEcpLCBJLl9mcmVlKHUpLCBJLl9mcmVlKGQpLCBJLl9mcmVlKE0pLCBJLl9mcmVlKFMpLCBJLl9mcmVlKEwpLCBJLl9mcmVlKEopKSwgdCA9IGUsIFkgPSBJLl9tYWxsb2MoMyAqIHQgKiA0KSwgUiA9IEkuX21hbGxvYyg0ICogdCAqIDQpLCBHID0gSS5fbWFsbG9jKDMgKiB0ICogNCksIHUgPSBJLl9tYWxsb2MoNCAqIHQpLCBkID0gSS5fbWFsbG9jKHQpLCBNID0gSS5fbWFsbG9jKDggKiB0ICogNCksIFMgPSBJLl9tYWxsb2MoMyAqIHQgKiA0KSwgTCA9IEkuX21hbGxvYyg0ICogdCAqIDQpLCBKID0gSS5fbWFsbG9jKDMgKiB0ICogNCkpLCBJLkhFQVBGMzIuc2V0KEMucG9zaXRpb25zLCBZIC8gNCksIEkuSEVBUEYzMi5zZXQoQy5yb3RhdGlvbnMsIFIgLyA0KSwgSS5IRUFQRjMyLnNldChDLnNjYWxlcywgRyAvIDQpLCBJLkhFQVBVOC5zZXQoQy5jb2xvcnMsIHUpLCBJLkhFQVBVOC5zZXQoQy5zZWxlY3Rpb24sIGQpLCBJLl9wYWNrKAogICAgQy5zZWxlY3RlZCwKICAgIEMudmVydGV4Q291bnQsCiAgICBZLAogICAgUiwKICAgIEcsCiAgICB1LAogICAgZCwKICAgIE0sCiAgICBTLAogICAgTCwKICAgIEoKICApOwogIGNvbnN0IEEgPSBuZXcgVWludDMyQXJyYXkoSS5IRUFQVTMyLmJ1ZmZlciwgTSwgQy52ZXJ0ZXhDb3VudCAqIDgpLCBoID0gbmV3IFVpbnQzMkFycmF5KEEuc2xpY2UoKS5idWZmZXIpLCBrID0gbmV3IEZsb2F0MzJBcnJheShJLkhFQVBGMzIuYnVmZmVyLCBTLCBDLnZlcnRleENvdW50ICogMyksIHkgPSBuZXcgRmxvYXQzMkFycmF5KGsuc2xpY2UoKS5idWZmZXIpLCBGID0gbmV3IEZsb2F0MzJBcnJheShJLkhFQVBGMzIuYnVmZmVyLCBMLCBDLnZlcnRleENvdW50ICogNCksIEQgPSBuZXcgRmxvYXQzMkFycmF5KEYuc2xpY2UoKS5idWZmZXIpLCBOID0gbmV3IEZsb2F0MzJBcnJheShJLkhFQVBGMzIuYnVmZmVyLCBKLCBDLnZlcnRleENvdW50ICogMyksIFUgPSBuZXcgRmxvYXQzMkFycmF5KE4uc2xpY2UoKS5idWZmZXIpLCBpID0gewogICAgZGF0YTogaCwKICAgIHdvcmxkUG9zaXRpb25zOiB5LAogICAgd29ybGRSb3RhdGlvbnM6IEQsCiAgICB3b3JsZFNjYWxlczogVSwKICAgIG9mZnNldDogQy5vZmZzZXQsCiAgICB2ZXJ0ZXhDb3VudDogQy52ZXJ0ZXhDb3VudCwKICAgIHBvc2l0aW9uczogQy5wb3NpdGlvbnMuYnVmZmVyLAogICAgcm90YXRpb25zOiBDLnJvdGF0aW9ucy5idWZmZXIsCiAgICBzY2FsZXM6IEMuc2NhbGVzLmJ1ZmZlciwKICAgIGNvbG9yczogQy5jb2xvcnMuYnVmZmVyLAogICAgc2VsZWN0aW9uOiBDLnNlbGVjdGlvbi5idWZmZXIKICB9OwogIHNlbGYucG9zdE1lc3NhZ2UoeyByZXNwb25zZTogaSB9LCBbCiAgICBpLmRhdGEuYnVmZmVyLAogICAgaS53b3JsZFBvc2l0aW9ucy5idWZmZXIsCiAgICBpLndvcmxkUm90YXRpb25zLmJ1ZmZlciwKICAgIGkud29ybGRTY2FsZXMuYnVmZmVyLAogICAgaS5wb3NpdGlvbnMsCiAgICBpLnJvdGF0aW9ucywKICAgIGkuc2NhbGVzLAogICAgaS5jb2xvcnMsCiAgICBpLnNlbGVjdGlvbgogIF0pLCBLID0gITE7Cn0sIFogPSAoKSA9PiB7CiAgaWYgKGwubGVuZ3RoICE9PSAwICYmICFLKSB7CiAgICBLID0gITA7CiAgICBjb25zdCBDID0gbC5zaGlmdCgpOwogICAgZUEoQyksIHNldFRpbWVvdXQoKCkgPT4gewogICAgICBLID0gITEsIFooKTsKICAgIH0sIDApOwogIH0KfTsKc2VsZi5vbm1lc3NhZ2UgPSAoQykgPT4gewogIGlmIChDLmRhdGEuc3BsYXQpIHsKICAgIGNvbnN0IGUgPSBDLmRhdGEuc3BsYXQ7CiAgICBmb3IgKGNvbnN0IFtBLCBoXSBvZiBsLmVudHJpZXMoKSkKICAgICAgaWYgKGgub2Zmc2V0ID09PSBlLm9mZnNldCkgewogICAgICAgIGxbQV0gPSBlOwogICAgICAgIHJldHVybjsKICAgICAgfQogICAgbC5wdXNoKGUpLCBaKCk7CiAgfQp9OwovLyMgc291cmNlTWFwcGluZ1VSTD1EYXRhV29ya2VyLUJ6RWRfWmo2LmpzLm1hcAo=",wt=E=>Uint8Array.from(atob(E),t=>t.charCodeAt(0)),nt=typeof self<"u"&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",wt(at)],{type:"text/javascript;charset=utf-8"});function Tt(E){let t;try{if(t=nt&&(self.URL||self.webkitURL).createObjectURL(nt),!t)throw"";const e=new Worker(t,{type:"module",name:E?.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+at,{type:"module",name:E?.name})}}var bt=function(E={}){var t,e=E,A=import.meta.url,Q="",s;{try{Q=new URL(".",A).href}catch{}s=g=>{var J=new XMLHttpRequest;return J.open("GET",g,!1),J.responseType="arraybuffer",J.send(null),new Uint8Array(J.response)}}console.log.bind(console),console.error.bind(console);var n,U,F;function i(){var g=U.buffer;e.HEAPU8=F=new Uint8Array(g),e.HEAPU32=new Uint32Array(g),e.HEAPF32=new Float32Array(g),new BigInt64Array(g),new BigUint64Array(g)}function l(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)M(e.preRun.shift());u(_)}function d(){z.c()}function B(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)V(e.postRun.shift());u(y)}var r=0,C=null;function I(g){r++,e.monitorRunDependencies?.(r)}function a(g){if(r--,e.monitorRunDependencies?.(r),r==0&&C){var J=C;C=null,J()}}var R;function c(){return x("AGFzbQEAAAABJgZgAX8Bf2ACfX0Bf2ABfQF/YAF/AGALf39/f39/f39/f38AYAAAAgcBAWEBYQAAAwgHAAECAwAEBQUHAQGCAoCAAgYIAX8BQYCMBAsHFQUBYgIAAWMABwFkAAYBZQAFAWYABAwBAQqqQAdPAQJ/QYAIKAIAIgEgAEEHakF4cSICaiEAAkAgAkEAIAAgAU0bRQRAIAA/AEEQdE0NASAAEAANAQtBhAhBMDYCAEF/DwtBgAggADYCACABCw4AIAAQAyABEANBEHRyC3IBBH8gALwiBEH///8DcSEBAkAgBEEXdkH/AXEiAkUNACACQfAATQRAIAFBgICABHJB8QAgAmt2IQEMAQsgAkGNAUsEQEGA+AEhA0EAIQEMAQsgAkEKdEGAgAdrIQMLIAMgBEEQdkGAgAJxciABQQ12cgvcCwEIfwJAIABFDQAgAEEIayIDIABBBGsoAgAiAkF4cSIAaiEFAkAgAkEBcQ0AIAJBAnFFDQEgAyADKAIAIgRrIgNBmAgoAgBJDQEgACAEaiEAAkACQAJAQZwIKAIAIANHBEAgAygCDCEBIARB/wFNBEAgASADKAIIIgJHDQJBiAhBiAgoAgBBfiAEQQN2d3E2AgAMBQsgAygCGCEHIAEgA0cEQCADKAIIIgIgATYCDCABIAI2AggMBAsgAygCFCICBH8gA0EUagUgAygCECICRQ0DIANBEGoLIQQDQCAEIQYgAiIBQRRqIQQgASgCFCICDQAgAUEQaiEEIAEoAhAiAg0ACyAGQQA2AgAMAwsgBSgCBCICQQNxQQNHDQNBkAggADYCACAFIAJBfnE2AgQgAyAAQQFyNgIEIAUgADYCAA8LIAIgATYCDCABIAI2AggMAgtBACEBCyAHRQ0AAkAgAygCHCIEQQJ0QbgKaiICKAIAIANGBEAgAiABNgIAIAENAUGMCEGMCCgCAEF+IAR3cTYCAAwCCwJAIAMgBygCEEYEQCAHIAE2AhAMAQsgByABNgIUCyABRQ0BCyABIAc2AhggAygCECICBEAgASACNgIQIAIgATYCGAsgAygCFCICRQ0AIAEgAjYCFCACIAE2AhgLIAMgBU8NACAFKAIEIgRBAXFFDQACQAJAAkACQCAEQQJxRQRAQaAIKAIAIAVGBEBBoAggAzYCAEGUCEGUCCgCACAAaiIANgIAIAMgAEEBcjYCBCADQZwIKAIARw0GQZAIQQA2AgBBnAhBADYCAA8LQZwIKAIAIgcgBUYEQEGcCCADNgIAQZAIQZAIKAIAIABqIgA2AgAgAyAAQQFyNgIEIAAgA2ogADYCAA8LIARBeHEgAGohACAFKAIMIQEgBEH/AU0EQCAFKAIIIgIgAUYEQEGICEGICCgCAEF+IARBA3Z3cTYCAAwFCyACIAE2AgwgASACNgIIDAQLIAUoAhghCCABIAVHBEAgBSgCCCICIAE2AgwgASACNgIIDAMLIAUoAhQiAgR/IAVBFGoFIAUoAhAiAkUNAiAFQRBqCyEEA0AgBCEGIAIiAUEUaiEEIAEoAhQiAg0AIAFBEGohBCABKAIQIgINAAsgBkEANgIADAILIAUgBEF+cTYCBCADIABBAXI2AgQgACADaiAANgIADAMLQQAhAQsgCEUNAAJAIAUoAhwiBEECdEG4CmoiAigCACAFRgRAIAIgATYCACABDQFBjAhBjAgoAgBBfiAEd3E2AgAMAgsCQCAFIAgoAhBGBEAgCCABNgIQDAELIAggATYCFAsgAUUNAQsgASAINgIYIAUoAhAiAgRAIAEgAjYCECACIAE2AhgLIAUoAhQiAkUNACABIAI2AhQgAiABNgIYCyADIABBAXI2AgQgACADaiAANgIAIAMgB0cNAEGQCCAANgIADwsgAEH/AU0EQCAAQXhxQbAIaiECAn9BiAgoAgAiBEEBIABBA3Z0IgBxRQRAQYgIIAAgBHI2AgAgAgwBCyACKAIICyEAIAIgAzYCCCAAIAM2AgwgAyACNgIMIAMgADYCCA8LQR8hASAAQf///wdNBEAgAEEmIABBCHZnIgJrdkEBcSACQQF0a0E+aiEBCyADIAE2AhwgA0IANwIQIAFBAnRBuApqIQQCfwJAAn9BjAgoAgAiBkEBIAF0IgJxRQRAQYwIIAIgBnI2AgAgBCADNgIAQRghAUEIDAELIABBGSABQQF2a0EAIAFBH0cbdCEBIAQoAgAhBANAIAQiAigCBEF4cSAARg0CIAFBHXYhBCABQQF0IQEgAiAEQQRxaiIGKAIQIgQNAAsgBiADNgIQQRghASACIQRBCAshACADIgIMAQsgAigCCCIEIAM2AgwgAiADNgIIQRghAEEIIQFBAAshBiABIANqIAQ2AgAgAyACNgIMIAAgA2ogBjYCAEGoCEGoCCgCAEEBayIAQX8gABs2AgALC9EnAQt/IwBBEGsiCiQAAkACQAJAAkACQAJAAkACQAJAAkAgAEH0AU0EQEGICCgCACIEQRAgAEELakH4A3EgAEELSRsiBkEDdiIAdiIBQQNxBEACQCABQX9zQQFxIABqIgJBA3QiAUGwCGoiACABQbgIaigCACIBKAIIIgVGBEBBiAggBEF+IAJ3cTYCAAwBCyAFIAA2AgwgACAFNgIICyABQQhqIQAgASACQQN0IgJBA3I2AgQgASACaiIBIAEoAgRBAXI2AgQMCwsgBkGQCCgCACIITQ0BIAEEQAJAQQIgAHQiAkEAIAJrciABIAB0cWgiAUEDdCIAQbAIaiICIABBuAhqKAIAIgAoAggiBUYEQEGICCAEQX4gAXdxIgQ2AgAMAQsgBSACNgIMIAIgBTYCCAsgACAGQQNyNgIEIAAgBmoiByABQQN0IgEgBmsiBUEBcjYCBCAAIAFqIAU2AgAgCARAIAhBeHFBsAhqIQFBnAgoAgAhAgJ/IARBASAIQQN2dCIDcUUEQEGICCADIARyNgIAIAEMAQsgASgCCAshAyABIAI2AgggAyACNgIMIAIgATYCDCACIAM2AggLIABBCGohAEGcCCAHNgIAQZAIIAU2AgAMCwtBjAgoAgAiC0UNASALaEECdEG4CmooAgAiAigCBEF4cSAGayEDIAIhAQNAAkAgASgCECIARQRAIAEoAhQiAEUNAQsgACgCBEF4cSAGayIBIAMgASADSSIBGyEDIAAgAiABGyECIAAhAQwBCwsgAigCGCEJIAIgAigCDCIARwRAIAIoAggiASAANgIMIAAgATYCCAwKCyACKAIUIgEEfyACQRRqBSACKAIQIgFFDQMgAkEQagshBQNAIAUhByABIgBBFGohBSAAKAIUIgENACAAQRBqIQUgACgCECIBDQALIAdBADYCAAwJC0F/IQYgAEG/f0sNACAAQQtqIgFBeHEhBkGMCCgCACIHRQ0AQR8hCEEAIAZrIQMgAEH0//8HTQRAIAZBJiABQQh2ZyIAa3ZBAXEgAEEBdGtBPmohCAsCQAJAAkAgCEECdEG4CmooAgAiAUUEQEEAIQAMAQtBACEAIAZBGSAIQQF2a0EAIAhBH0cbdCECA0ACQCABKAIEQXhxIAZrIgQgA08NACABIQUgBCIDDQBBACEDIAEhAAwDCyAAIAEoAhQiBCAEIAEgAkEddkEEcWooAhAiAUYbIAAgBBshACACQQF0IQIgAQ0ACwsgACAFckUEQEEAIQVBAiAIdCIAQQAgAGtyIAdxIgBFDQMgAGhBAnRBuApqKAIAIQALIABFDQELA0AgACgCBEF4cSAGayICIANJIQEgAiADIAEbIQMgACAFIAEbIQUgACgCECIBBH8gAQUgACgCFAsiAA0ACwsgBUUNACADQZAIKAIAIAZrTw0AIAUoAhghCCAFIAUoAgwiAEcEQCAFKAIIIgEgADYCDCAAIAE2AggMCAsgBSgCFCIBBH8gBUEUagUgBSgCECIBRQ0DIAVBEGoLIQIDQCACIQQgASIAQRRqIQIgACgCFCIBDQAgAEEQaiECIAAoAhAiAQ0ACyAEQQA2AgAMBwsgBkGQCCgCACIFTQRAQZwIKAIAIQACQCAFIAZrIgFBEE8EQCAAIAZqIgIgAUEBcjYCBCAAIAVqIAE2AgAgACAGQQNyNgIEDAELIAAgBUEDcjYCBCAAIAVqIgEgASgCBEEBcjYCBEEAIQJBACEBC0GQCCABNgIAQZwIIAI2AgAgAEEIaiEADAkLIAZBlAgoAgAiAkkEQEGUCCACIAZrIgE2AgBBoAhBoAgoAgAiACAGaiICNgIAIAIgAUEBcjYCBCAAIAZBA3I2AgQgAEEIaiEADAkLQQAhACAGQS9qIgMCf0HgCygCAARAQegLKAIADAELQewLQn83AgBB5AtCgKCAgICABDcCAEHgCyAKQQxqQXBxQdiq1aoFczYCAEH0C0EANgIAQcQLQQA2AgBBgCALIgFqIgRBACABayIHcSIBIAZNDQhBwAsoAgAiBQRAQbgLKAIAIgggAWoiCSAITSAFIAlJcg0JCwJAQcQLLQAAQQRxRQRAAkACQAJAAkBBoAgoAgAiBQRAQcgLIQADQCAAKAIAIgggBU0EQCAFIAggACgCBGpJDQMLIAAoAggiAA0ACwtBABABIgJBf0YNAyABIQRB5AsoAgAiAEEBayIFIAJxBEAgASACayACIAVqQQAgAGtxaiEECyAEIAZNDQNBwAsoAgAiAARAQbgLKAIAIgUgBGoiByAFTSAAIAdJcg0ECyAEEAEiACACRw0BDAULIAQgAmsgB3EiBBABIgIgACgCACAAKAIEakYNASACIQALIABBf0YNASAGQTBqIARNBEAgACECDAQLQegLKAIAIgIgAyAEa2pBACACa3EiAhABQX9GDQEgAiAEaiEEIAAhAgwDCyACQX9HDQILQcQLQcQLKAIAQQRyNgIACyABEAEiAkF/RkEAEAEiAEF/RnIgACACTXINBSAAIAJrIgQgBkEoak0NBQtBuAtBuAsoAgAgBGoiADYCAEG8CygCACAASQRAQbwLIAA2AgALAkBBoAgoAgAiAwRAQcgLIQADQCACIAAoAgAiASAAKAIEIgVqRg0CIAAoAggiAA0ACwwEC0GYCCgCACIAQQAgACACTRtFBEBBmAggAjYCAAtBACEAQcwLIAQ2AgBByAsgAjYCAEGoCEF/NgIAQawIQeALKAIANgIAQdQLQQA2AgADQCAAQQN0IgFBuAhqIAFBsAhqIgU2AgAgAUG8CGogBTYCACAAQQFqIgBBIEcNAAtBlAggBEEoayIAQXggAmtBB3EiAWsiBTYCAEGgCCABIAJqIgE2AgAgASAFQQFyNgIEIAAgAmpBKDYCBEGkCEHwCygCADYCAAwECyACIANNIAEgA0tyDQIgACgCDEEIcQ0CIAAgBCAFajYCBEGgCCADQXggA2tBB3EiAGoiATYCAEGUCEGUCCgCACAEaiICIABrIgA2AgAgASAAQQFyNgIEIAIgA2pBKDYCBEGkCEHwCygCADYCAAwDC0EAIQAMBgtBACEADAQLQZgIKAIAIAJLBEBBmAggAjYCAAsgAiAEaiEFQcgLIQACQANAIAUgACgCACIBRwRAIAAoAggiAA0BDAILCyAALQAMQQhxRQ0DC0HICyEAA0ACQCAAKAIAIgEgA00EQCADIAEgACgCBGoiBUkNAQsgACgCCCEADAELC0GUCCAEQShrIgBBeCACa0EHcSIBayIHNgIAQaAIIAEgAmoiATYCACABIAdBAXI2AgQgACACakEoNgIEQaQIQfALKAIANgIAIAMgBUEnIAVrQQdxakEvayIAIAAgA0EQakkbIgFBGzYCBCABQdALKQIANwIQIAFByAspAgA3AghB0AsgAUEIajYCAEHMCyAENgIAQcgLIAI2AgBB1AtBADYCACABQRhqIQADQCAAQQc2AgQgAEEIaiAAQQRqIQAgBUkNAAsgASADRg0AIAEgASgCBEF+cTYCBCADIAEgA2siAkEBcjYCBCABIAI2AgACfyACQf8BTQRAIAJBeHFBsAhqIQACf0GICCgCACIBQQEgAkEDdnQiAnFFBEBBiAggASACcjYCACAADAELIAAoAggLIQEgACADNgIIIAEgAzYCDEEMIQJBCAwBC0EfIQAgAkH///8HTQRAIAJBJiACQQh2ZyIAa3ZBAXEgAEEBdGtBPmohAAsgAyAANgIcIANCADcCECAAQQJ0QbgKaiEBAkACQEGMCCgCACIFQQEgAHQiBHFFBEBBjAggBCAFcjYCACABIAM2AgAMAQsgAkEZIABBAXZrQQAgAEEfRxt0IQAgASgCACEFA0AgBSIBKAIEQXhxIAJGDQIgAEEddiEFIABBAXQhACABIAVBBHFqIgQoAhAiBQ0ACyAEIAM2AhALIAMgATYCGEEIIQIgAyIBIQBBDAwBCyABKAIIIgAgAzYCDCABIAM2AgggAyAANgIIQQAhAEEYIQJBDAsgA2ogATYCACACIANqIAA2AgALQZQIKAIAIgAgBk0NAEGUCCAAIAZrIgE2AgBBoAhBoAgoAgAiACAGaiICNgIAIAIgAUEBcjYCBCAAIAZBA3I2AgQgAEEIaiEADAQLQYQIQTA2AgBBACEADAMLIAAgAjYCACAAIAAoAgQgBGo2AgQgAkF4IAJrQQdxaiIIIAZBA3I2AgQgAUF4IAFrQQdxaiIEIAYgCGoiA2shBwJAQaAIKAIAIARGBEBBoAggAzYCAEGUCEGUCCgCACAHaiIANgIAIAMgAEEBcjYCBAwBC0GcCCgCACAERgRAQZwIIAM2AgBBkAhBkAgoAgAgB2oiADYCACADIABBAXI2AgQgACADaiAANgIADAELIAQoAgQiAEEDcUEBRgRAIABBeHEhCSAEKAIMIQICQCAAQf8BTQRAIAQoAggiASACRgRAQYgIQYgIKAIAQX4gAEEDdndxNgIADAILIAEgAjYCDCACIAE2AggMAQsgBCgCGCEGAkAgAiAERwRAIAQoAggiACACNgIMIAIgADYCCAwBCwJAIAQoAhQiAAR/IARBFGoFIAQoAhAiAEUNASAEQRBqCyEBA0AgASEFIAAiAkEUaiEBIAAoAhQiAA0AIAJBEGohASACKAIQIgANAAsgBUEANgIADAELQQAhAgsgBkUNAAJAIAQoAhwiAEECdEG4CmoiASgCACAERgRAIAEgAjYCACACDQFBjAhBjAgoAgBBfiAAd3E2AgAMAgsCQCAEIAYoAhBGBEAgBiACNgIQDAELIAYgAjYCFAsgAkUNAQsgAiAGNgIYIAQoAhAiAARAIAIgADYCECAAIAI2AhgLIAQoAhQiAEUNACACIAA2AhQgACACNgIYCyAHIAlqIQcgBCAJaiIEKAIEIQALIAQgAEF+cTYCBCADIAdBAXI2AgQgAyAHaiAHNgIAIAdB/wFNBEAgB0F4cUGwCGohAAJ/QYgIKAIAIgFBASAHQQN2dCICcUUEQEGICCABIAJyNgIAIAAMAQsgACgCCAshASAAIAM2AgggASADNgIMIAMgADYCDCADIAE2AggMAQtBHyECIAdB////B00EQCAHQSYgB0EIdmciAGt2QQFxIABBAXRrQT5qIQILIAMgAjYCHCADQgA3AhAgAkECdEG4CmohAAJAAkBBjAgoAgAiAUEBIAJ0IgVxRQRAQYwIIAEgBXI2AgAgACADNgIADAELIAdBGSACQQF2a0EAIAJBH0cbdCECIAAoAgAhAQNAIAEiACgCBEF4cSAHRg0CIAJBHXYhASACQQF0IQIgACABQQRxaiIFKAIQIgENAAsgBSADNgIQCyADIAA2AhggAyADNgIMIAMgAzYCCAwBCyAAKAIIIgEgAzYCDCAAIAM2AgggA0EANgIYIAMgADYCDCADIAE2AggLIAhBCGohAAwCCwJAIAhFDQACQCAFKAIcIgFBAnRBuApqIgIoAgAgBUYEQCACIAA2AgAgAA0BQYwIIAdBfiABd3EiBzYCAAwCCwJAIAUgCCgCEEYEQCAIIAA2AhAMAQsgCCAANgIUCyAARQ0BCyAAIAg2AhggBSgCECIBBEAgACABNgIQIAEgADYCGAsgBSgCFCIBRQ0AIAAgATYCFCABIAA2AhgLAkAgA0EPTQRAIAUgAyAGaiIAQQNyNgIEIAAgBWoiACAAKAIEQQFyNgIEDAELIAUgBkEDcjYCBCAFIAZqIgQgA0EBcjYCBCADIARqIAM2AgAgA0H/AU0EQCADQXhxQbAIaiEAAn9BiAgoAgAiAUEBIANBA3Z0IgJxRQRAQYgIIAEgAnI2AgAgAAwBCyAAKAIICyEBIAAgBDYCCCABIAQ2AgwgBCAANgIMIAQgATYCCAwBC0EfIQAgA0H///8HTQRAIANBJiADQQh2ZyIAa3ZBAXEgAEEBdGtBPmohAAsgBCAANgIcIARCADcCECAAQQJ0QbgKaiEBAkACQCAHQQEgAHQiAnFFBEBBjAggAiAHcjYCACABIAQ2AgAgBCABNgIYDAELIANBGSAAQQF2a0EAIABBH0cbdCEAIAEoAgAhAQNAIAEiAigCBEF4cSADRg0CIABBHXYhASAAQQF0IQAgAiABQQRxaiIHKAIQIgENAAsgByAENgIQIAQgAjYCGAsgBCAENgIMIAQgBDYCCAwBCyACKAIIIgAgBDYCDCACIAQ2AgggBEEANgIYIAQgAjYCDCAEIAA2AggLIAVBCGohAAwBCwJAIAlFDQACQCACKAIcIgFBAnRBuApqIgUoAgAgAkYEQCAFIAA2AgAgAA0BQYwIIAtBfiABd3E2AgAMAgsCQCACIAkoAhBGBEAgCSAANgIQDAELIAkgADYCFAsgAEUNAQsgACAJNgIYIAIoAhAiAQRAIAAgATYCECABIAA2AhgLIAIoAhQiAUUNACAAIAE2AhQgASAANgIYCwJAIANBD00EQCACIAMgBmoiAEEDcjYCBCAAIAJqIgAgACgCBEEBcjYCBAwBCyACIAZBA3I2AgQgAiAGaiIFIANBAXI2AgQgAyAFaiADNgIAIAgEQCAIQXhxQbAIaiEAQZwIKAIAIQECf0EBIAhBA3Z0IgcgBHFFBEBBiAggBCAHcjYCACAADAELIAAoAggLIQQgACABNgIIIAQgATYCDCABIAA2AgwgASAENgIIC0GcCCAFNgIAQZAIIAM2AgALIAJBCGohAAsgCkEQaiQAIAALoQsCC38JfSMAQaABayILJAAgC0EwakEAQST8CwADQCABIA5HBEAgAiAOQQNsIgxBAmpBAnQiD2oqAgAhFyACIAxBAWpBAnQiEGoqAgAhGCAIIAxBAnQiEWogAiARaioCACIZOAIAIAggEGogGDgCACAIIA9qIBc4AgAgByAOQQV0aiINQQA2AgwgDSAXOAIIIA0gGDgCBCANIBk4AgACQCAARQRAIAYgDmotAABFDQELIA1BgICACDYCDAsgDSAFIA5BAnQiDEEBciISai0AAEEIdCAFIAxqLQAAciAFIAxBAnIiE2otAABBEHRyIAUgDEEDciIMai0AAEEYdHI2AhwgCyADIBJBAnQiEmoqAgAiFzgCkAEgCyADIBNBAnQiE2oqAgAiGDgClAEgCyADIAxBAnQiFGoqAgAiGTgCmAEgCyADIA5BBHQiFWoqAgCMIho4ApwBIAtB4ABqIgwgCyoCmAEiFkMAAADAlCAWlCALKgKUASIWQwAAAMCUIBaUQwAAgD+SkjgCACAMIAsqApABIhYgFpIgCyoClAGUIAsqApgBIhYgFpIgCyoCnAGUkzgCBCAMIAsqApABIhYgFpIgCyoCmAGUIAsqApQBIhYgFpIgCyoCnAGUkjgCCCAMIAsqApABIhYgFpIgCyoClAGUIAsqApgBIhYgFpIgCyoCnAGUkjgCDCAMIAsqApgBIhZDAAAAwJQgFpQgCyoCkAEiFkMAAADAlCAWlEMAAIA/kpI4AhAgDCALKgKUASIWIBaSIAsqApgBlCALKgKQASIWIBaSIAsqApwBlJM4AhQgDCALKgKQASIWIBaSIAsqApgBlCALKgKUASIWIBaSIAsqApwBlJM4AhggDCALKgKUASIWIBaSIAsqApgBlCALKgKQASIWIBaSIAsqApwBlJI4AhwgDCALKgKUASIWQwAAAMCUIBaUIAsqApABIhZDAAAAwJQgFpRDAACAP5KSOAIgIAkgFWogFzgCACAJIBJqIBg4AgAgCSATaiAZOAIAIAkgFGogGjgCACALIAQgEWoqAgAiFzgCMCALIAQgEGoqAgAiGDgCQCALIAQgD2oqAgAiGTgCUCAKIBFqIBc4AgAgCiAQaiAYOAIAIAogD2ogGTgCACALIAwqAhggCyoCOJQgDCoCACALKgIwlCAMKgIMIAsqAjSUkpI4AgAgCyAMKgIcIAsqAjiUIAwqAgQgCyoCMJQgDCoCECALKgI0lJKSOAIEIAsgDCoCICALKgI4lCAMKgIIIAsqAjCUIAwqAhQgCyoCNJSSkjgCCCALIAwqAhggCyoCRJQgDCoCACALKgI8lCAMKgIMIAsqAkCUkpI4AgwgCyAMKgIcIAsqAkSUIAwqAgQgCyoCPJQgDCoCECALKgJAlJKSOAIQIAsgDCoCICALKgJElCAMKgIIIAsqAjyUIAwqAhQgCyoCQJSSkjgCFCALIAwqAhggCyoCUJQgDCoCACALKgJIlCAMKgIMIAsqAkyUkpI4AhggCyAMKgIcIAsqAlCUIAwqAgQgCyoCSJQgDCoCECALKgJMlJKSOAIcIAsgDCoCICALKgJQlCAMKgIIIAsqAkiUIAwqAhQgCyoCTJSSkjgCICALKgIgIRcgCyoCCCEYIAsqAhQhGSANIAsqAhgiGiAalCALKgIAIhYgFpQgCyoCDCIbIBuUkpJDAACAQJQgGiALKgIcIhyUIBYgCyoCBCIdlCAbIAsqAhAiHpSSkkMAAIBAlBACNgIQIA0gGiAXlCAWIBiUIBsgGZSSkkMAAIBAlCAcIByUIB0gHZQgHiAelJKSQwAAgECUEAI2AhQgDSAcIBeUIB0gGJQgHiAZlJKSQwAAgECUIBcgF5QgGCAYlCAZIBmUkpJDAACAQJQQAjYCGCAOQQFqIQ4MAQsLIAtBoAFqJAALAgALCwkBAEGBCAsCBgE=")}function W(g){if(ArrayBuffer.isView(g))return g;if(g==R&&n)return new Uint8Array(n);if(s)return s(g);throw'sync fetching of the wasm failed: you can preload it to Module["wasmBinary"] manually, or emcc.py will do that for you when generating HTML (but not JS)'}function w(g,J){var G,m=W(g);G=new WebAssembly.Module(m);var Y=new WebAssembly.Instance(G,J);return[Y,G]}function D(){return{a:b}}function k(){function g(m,Y){return z=m.exports,U=z.b,i(),N(z),a(),z}I();var J=D();if(e.instantiateWasm)return new Promise((m,Y)=>{e.instantiateWasm(J,(O,$)=>{m(g(O))})});R??=c();var G=w(R,J);return g(G[0])}for(var u=g=>{for(;g.length>0;)g.shift()(e)},y=[],V=g=>y.push(g),_=[],M=g=>_.push(g),x=g=>{for(var J,G,m=0,Y=0,O=g.length,$=new Uint8Array((O*3>>2)-(g[O-2]=="=")-(g[O-1]=="="));m>4,$[Y+1]=J<<4|G>>2,$[Y+2]=G<<6|o[g.charCodeAt(m+3)];return $},Z=()=>2147483648,p=(g,J)=>Math.ceil(g/J)*J,P=g=>{var J=U.buffer,G=(g-J.byteLength+65535)/65536|0;try{return U.grow(G),i(),1}catch{}},T=g=>{var J=F.length;g>>>=0;var G=Z();if(g>G)return!1;for(var m=1;m<=4;m*=2){var Y=J*(1+.2/m);Y=Math.min(Y,g+100663296);var O=Math.min(G,p(Math.max(g,Y),65536)),$=P(O);if($)return!0}return!1},o=new Uint8Array(123),S=25;S>=0;--S)o[48+S]=52+S,o[65+S]=S,o[97+S]=26+S;o[43]=62,o[47]=63,e.noExitRuntime&&e.noExitRuntime,e.print&&e.print,e.printErr&&e.printErr,e.wasmBinary&&(n=e.wasmBinary),e.arguments&&e.arguments,e.thisProgram&&e.thisProgram;function N(g){e._pack=g.d,e._malloc=g.e,e._free=g.f}var b={a:T},z=k();function q(){if(r>0){C=q;return}if(l(),r>0){C=q;return}function g(){e.calledRun=!0,d(),e.onRuntimeInitialized?.(),B()}e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),g()},1)):g()}function L(){if(e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.shift()()}return L(),q(),t=e,t};const Gt=()=>new Tt;class Ft{constructor(t){this.dataChanged=!1,this.transformsChanged=!1,this.colorTransformsChanged=!1,this._updating=new Set,this._dirty=new Set;let e=0,A=0;this._splatIndices=new Map,this._offsets=new Map;const Q=new Map;for(const B of t.objects)B instanceof H&&(this._splatIndices.set(B,A),this._offsets.set(B,e),Q.set(e,B),e+=B.data.vertexCount,A++);this._vertexCount=e,this._width=2048,this._height=Math.ceil(2*this.vertexCount/this.width),this._data=new Uint32Array(this.width*this.height*4),this._transformsWidth=5,this._transformsHeight=Q.size,this._transforms=new Float32Array(this._transformsWidth*this._transformsHeight*4),this._transformIndicesWidth=1024,this._transformIndicesHeight=Math.ceil(this.vertexCount/this._transformIndicesWidth),this._transformIndices=new Uint32Array(this._transformIndicesWidth*this._transformIndicesHeight),this._colorTransformsWidth=4,this._colorTransformsHeight=64,this._colorTransforms=new Float32Array(this._colorTransformsWidth*this._colorTransformsHeight*4),this._colorTransforms.fill(0),this._colorTransforms[0]=1,this._colorTransforms[5]=1,this._colorTransforms[10]=1,this._colorTransforms[15]=1,this._colorTransformIndicesWidth=1024,this._colorTransformIndicesHeight=Math.ceil(this.vertexCount/this._colorTransformIndicesWidth),this._colorTransformIndices=new Uint32Array(this._colorTransformIndicesWidth*this._colorTransformIndicesHeight),this.colorTransformIndices.fill(0),this._positions=new Float32Array(this.vertexCount*3),this._rotations=new Float32Array(this.vertexCount*4),this._scales=new Float32Array(this.vertexCount*3),this._worker=Gt();const s=B=>{const r=this._splatIndices.get(B);this._transforms.set(B.transform.buffer,r*20),this._transforms[r*20+16]=B.selected?1:0,B.positionChanged=!1,B.rotationChanged=!1,B.scaleChanged=!1,B.selectedChanged=!1,this.transformsChanged=!0},n=()=>{let B=!1;for(const I of this._splatIndices.keys())if(I.colorTransformChanged){B=!0;break}if(!B)return;const r=[new X];this._colorTransformIndices.fill(0);let C=1;for(const I of this._splatIndices.keys()){const a=this._offsets.get(I);for(const R of I.colorTransforms)r.includes(R)||(r.push(R),C++);for(const R of I.colorTransformsMap.keys()){const c=I.colorTransformsMap.get(R);this._colorTransformIndices[R+a]=c+C-1}I.colorTransformChanged=!1}for(let I=0;I{if(B.data.response){const r=B.data.response,C=Q.get(r.offset);s(C),n();const I=this._splatIndices.get(C);for(let a=0;asetTimeout(B,0))}const l=B=>{if(!U){i().then(()=>{l(B)});return}s(B);const r=U._malloc(3*B.data.vertexCount*4),C=U._malloc(4*B.data.vertexCount*4),I=U._malloc(3*B.data.vertexCount*4),a=U._malloc(4*B.data.vertexCount),R=U._malloc(B.data.vertexCount),c=U._malloc(8*B.data.vertexCount*4),W=U._malloc(3*B.data.vertexCount*4),w=U._malloc(4*B.data.vertexCount*4),D=U._malloc(3*B.data.vertexCount*4);U.HEAPF32.set(B.data.positions,r/4),U.HEAPF32.set(B.data.rotations,C/4),U.HEAPF32.set(B.data.scales,I/4),U.HEAPU8.set(B.data.colors,a),U.HEAPU8.set(B.data.selection,R),U._pack(B.selected,B.data.vertexCount,r,C,I,a,R,c,W,w,D);const k=new Uint32Array(U.HEAPU32.buffer,c,B.data.vertexCount*8),u=new Float32Array(U.HEAPF32.buffer,W,B.data.vertexCount*3),y=new Float32Array(U.HEAPF32.buffer,w,B.data.vertexCount*4),V=new Float32Array(U.HEAPF32.buffer,D,B.data.vertexCount*3),_=this._splatIndices.get(B),M=this._offsets.get(B);for(let x=0;x{if((B.positionChanged||B.rotationChanged||B.scaleChanged||B.selectedChanged)&&s(B),B.colorTransformChanged&&n(),!B.data.changed||B.data.detached)return;const r={position:new Float32Array(B.position.flat()),rotation:new Float32Array(B.rotation.flat()),scale:new Float32Array(B.scale.flat()),selected:B.selected,vertexCount:B.data.vertexCount,positions:B.data.positions,rotations:B.data.rotations,scales:B.data.scales,colors:B.data.colors,selection:B.data.selection,offset:this._offsets.get(B)};this._worker.postMessage({splat:r},[r.position.buffer,r.rotation.buffer,r.scale.buffer,r.positions.buffer,r.rotations.buffer,r.scales.buffer,r.colors.buffer,r.selection.buffer]),this._updating.add(B),B.data.detached=!0};this.getSplat=B=>{let r=null;for(const[C,I]of this._offsets)if(B>=I)r=C;else break;return r},this.getLocalIndex=(B,r)=>{const C=this._offsets.get(B);return r-C},this.markDirty=B=>{this._dirty.add(B)},this.rebuild=()=>{for(const B of this._dirty)d(B);this._dirty.clear()},this.dispose=()=>{this._worker.terminate()};for(const B of this._splatIndices.keys())l(B);n()}get offsets(){return this._offsets}get data(){return this._data}get width(){return this._width}get height(){return this._height}get transforms(){return this._transforms}get transformsWidth(){return this._transformsWidth}get transformsHeight(){return this._transformsHeight}get transformIndices(){return this._transformIndices}get transformIndicesWidth(){return this._transformIndicesWidth}get transformIndicesHeight(){return this._transformIndicesHeight}get colorTransforms(){return this._colorTransforms}get colorTransformsWidth(){return this._colorTransformsWidth}get colorTransformsHeight(){return this._colorTransformsHeight}get colorTransformIndices(){return this._colorTransformIndices}get colorTransformIndicesWidth(){return this._colorTransformIndicesWidth}get colorTransformIndicesHeight(){return this._colorTransformIndicesHeight}get positions(){return this._positions}get rotations(){return this._rotations}get scales(){return this._scales}get vertexCount(){return this._vertexCount}get needsRebuild(){return this._dirty.size>0}get updating(){return this._updating.size>0}}class gt{constructor(t=0,e=0,A=0,Q=255){this.r=t,this.g=e,this.b=A,this.a=Q}flat(){return[this.r,this.g,this.b,this.a]}flatNorm(){return[this.r/255,this.g/255,this.b/255,this.a/255]}toHexString(){return"#"+this.flat().map(t=>t.toString(16).padStart(2,"0")).join("")}toString(){return`[${this.flat().join(", ")}]`}}const xt=()=>new kt,Mt=`#version 300 es +precision highp float; +precision highp int; + +uniform highp usampler2D u_texture; +uniform highp sampler2D u_transforms; +uniform highp usampler2D u_transformIndices; +uniform highp sampler2D u_colorTransforms; +uniform highp usampler2D u_colorTransformIndices; +uniform mat4 projection, view; +uniform vec2 focal; +uniform vec2 viewport; + +uniform bool useDepthFade; +uniform float depthFade; + +in vec2 position; +in int index; + +out vec4 vColor; +out vec2 vPosition; +out float vSize; +out float vSelected; + +void main () { + uvec4 cen = texelFetch(u_texture, ivec2((uint(index) & 0x3ffu) << 1, uint(index) >> 10), 0); + float selected = float((cen.w >> 24) & 0xffu); + + uint transformIndex = texelFetch(u_transformIndices, ivec2(uint(index) & 0x3ffu, uint(index) >> 10), 0).x; + mat4 transform = mat4( + texelFetch(u_transforms, ivec2(0, transformIndex), 0), + texelFetch(u_transforms, ivec2(1, transformIndex), 0), + texelFetch(u_transforms, ivec2(2, transformIndex), 0), + texelFetch(u_transforms, ivec2(3, transformIndex), 0) + ); + + if (selected < 0.5) { + selected = texelFetch(u_transforms, ivec2(4, transformIndex), 0).x; + } + + mat4 viewTransform = view * transform; + + vec4 cam = viewTransform * vec4(uintBitsToFloat(cen.xyz), 1); + vec4 pos2d = projection * cam; + + float clip = 1.2 * pos2d.w; + if (pos2d.z < -pos2d.w || pos2d.z > pos2d.w || pos2d.x < -clip || pos2d.x > clip || pos2d.y < -clip || pos2d.y > clip) { + gl_Position = vec4(0.0, 0.0, 2.0, 1.0); + return; + } + + uvec4 cov = texelFetch(u_texture, ivec2(((uint(index) & 0x3ffu) << 1) | 1u, uint(index) >> 10), 0); + vec2 u1 = unpackHalf2x16(cov.x), u2 = unpackHalf2x16(cov.y), u3 = unpackHalf2x16(cov.z); + mat3 Vrk = mat3(u1.x, u1.y, u2.x, u1.y, u2.y, u3.x, u2.x, u3.x, u3.y); + + mat3 J = mat3( + focal.x / cam.z, 0., -(focal.x * cam.x) / (cam.z * cam.z), + 0., -focal.y / cam.z, (focal.y * cam.y) / (cam.z * cam.z), + 0., 0., 0. + ); + + mat3 T = transpose(mat3(viewTransform)) * J; + mat3 cov2d = transpose(T) * Vrk * T; + + //ref: https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/cuda_rasterizer/forward.cu#L110-L111 + cov2d[0][0] += 0.3; + cov2d[1][1] += 0.3; + + float mid = (cov2d[0][0] + cov2d[1][1]) / 2.0; + float radius = length(vec2((cov2d[0][0] - cov2d[1][1]) / 2.0, cov2d[0][1])); + float lambda1 = mid + radius, lambda2 = mid - radius; + + if (lambda2 < 0.0) return; + vec2 diagonalVector = normalize(vec2(cov2d[0][1], lambda1 - cov2d[0][0])); + vec2 majorAxis = min(sqrt(2.0 * lambda1), 1024.0) * diagonalVector; + vec2 minorAxis = min(sqrt(2.0 * lambda2), 1024.0) * vec2(diagonalVector.y, -diagonalVector.x); + + uint colorTransformIndex = texelFetch(u_colorTransformIndices, ivec2(uint(index) & 0x3ffu, uint(index) >> 10), 0).x; + mat4 colorTransform = mat4( + texelFetch(u_colorTransforms, ivec2(0, colorTransformIndex), 0), + texelFetch(u_colorTransforms, ivec2(1, colorTransformIndex), 0), + texelFetch(u_colorTransforms, ivec2(2, colorTransformIndex), 0), + texelFetch(u_colorTransforms, ivec2(3, colorTransformIndex), 0) + ); + + vec4 color = vec4((cov.w) & 0xffu, (cov.w >> 8) & 0xffu, (cov.w >> 16) & 0xffu, (cov.w >> 24) & 0xffu) / 255.0; + vColor = colorTransform * color; + + vPosition = position; + vSize = length(majorAxis); + vSelected = selected; + + float scalingFactor = 1.0; + + if (useDepthFade) { + float depthNorm = (pos2d.z / pos2d.w + 1.0) / 2.0; + float near = 0.1; float far = 100.0; + float normalizedDepth = (2.0 * near) / (far + near - depthNorm * (far - near)); + float start = max(normalizedDepth - 0.1, 0.0); + float end = min(normalizedDepth + 0.1, 1.0); + scalingFactor = clamp((depthFade - start) / (end - start), 0.0, 1.0); + } + + vec2 vCenter = vec2(pos2d) / pos2d.w; + gl_Position = vec4( + vCenter + + position.x * majorAxis * scalingFactor / viewport + + position.y * minorAxis * scalingFactor / viewport, 0.0, 1.0); +} +`,Lt=`#version 300 es +precision highp float; + +uniform float outlineThickness; +uniform vec4 outlineColor; + +in vec4 vColor; +in vec2 vPosition; +in float vSize; +in float vSelected; + +out vec4 fragColor; + +void main () { + float A = -dot(vPosition, vPosition); + + if (A < -4.0) discard; + + if (vSelected < 0.5) { + float B = exp(A) * vColor.a; + fragColor = vec4(B * vColor.rgb, B); + return; + } + + float outlineThreshold = -4.0 + (outlineThickness / vSize); + + if (A < outlineThreshold) { + fragColor = outlineColor; + } + else { + float B = exp(A) * vColor.a; + fragColor = vec4(B * vColor.rgb, B); + } +} +`;class Ct extends yt{constructor(t,e){super(t,e),this._outlineThickness=10,this._outlineColor=new gt(255,165,0,255),this._renderData=null,this._depthIndex=new Uint32Array,this._splatTexture=null,this._worker=null;const A=t.canvas,Q=t.gl;let s,n,U,F,i,l,d,B,r,C,I,a,R,c,W,w,D,k,u;this._resize=()=>{this._camera&&(this._camera.data.setSize(A.width,A.height),this._camera.update(),s=Q.getUniformLocation(this.program,"projection"),Q.uniformMatrix4fv(s,!1,this._camera.data.projectionMatrix.buffer),n=Q.getUniformLocation(this.program,"viewport"),Q.uniform2fv(n,new Float32Array([A.width,A.height])))};const y=()=>{this._worker=xt(),this._worker.onmessage=Z=>{if(Z.data.depthIndex){const{depthIndex:p}=Z.data;this._depthIndex=p,Q.bindBuffer(Q.ARRAY_BUFFER,u),Q.bufferData(Q.ARRAY_BUFFER,p,Q.STATIC_DRAW)}}};this._initialize=()=>{if(!this._scene||!this._camera){console.error("Cannot render without scene and camera");return}this._resize(),this._scene.addEventListener("objectAdded",V),this._scene.addEventListener("objectRemoved",_);for(const Z of this._scene.objects)Z instanceof H&&Z.addEventListener("objectChanged",M);this._renderData=new Ft(this._scene),U=Q.getUniformLocation(this.program,"focal"),Q.uniform2fv(U,new Float32Array([this._camera.data.fx,this._camera.data.fy])),F=Q.getUniformLocation(this.program,"view"),Q.uniformMatrix4fv(F,!1,this._camera.data.viewMatrix.buffer),C=Q.getUniformLocation(this.program,"outlineThickness"),Q.uniform1f(C,this.outlineThickness),I=Q.getUniformLocation(this.program,"outlineColor"),Q.uniform4fv(I,new Float32Array(this.outlineColor.flatNorm())),this._splatTexture=Q.createTexture(),i=Q.getUniformLocation(this.program,"u_texture"),Q.uniform1i(i,0),c=Q.createTexture(),l=Q.getUniformLocation(this.program,"u_transforms"),Q.uniform1i(l,1),W=Q.createTexture(),d=Q.getUniformLocation(this.program,"u_transformIndices"),Q.uniform1i(d,2),w=Q.createTexture(),B=Q.getUniformLocation(this.program,"u_colorTransforms"),Q.uniform1i(B,3),D=Q.createTexture(),r=Q.getUniformLocation(this.program,"u_colorTransformIndices"),Q.uniform1i(r,4),k=Q.createBuffer(),Q.bindBuffer(Q.ARRAY_BUFFER,k),Q.bufferData(Q.ARRAY_BUFFER,new Float32Array([-2,-2,2,-2,2,2,-2,2]),Q.STATIC_DRAW),a=Q.getAttribLocation(this.program,"position"),Q.enableVertexAttribArray(a),Q.vertexAttribPointer(a,2,Q.FLOAT,!1,0,0),u=Q.createBuffer(),R=Q.getAttribLocation(this.program,"index"),Q.enableVertexAttribArray(R),Q.bindBuffer(Q.ARRAY_BUFFER,u),y()};const V=Z=>{const p=Z;p.object instanceof H&&p.object.addEventListener("objectChanged",M),x()},_=Z=>{const p=Z;p.object instanceof H&&p.object.removeEventListener("objectChanged",M),x()},M=Z=>{const p=Z;p.object instanceof H&&this._renderData&&this._renderData.markDirty(p.object)},x=()=>{this._renderData?.dispose(),this._renderData=new Ft(this._scene),this._worker?.terminate(),y()};this._render=()=>{if(!this._scene||!this._camera||!this.renderData){console.error("Cannot render without scene and camera");return}if(this.renderData.needsRebuild&&this.renderData.rebuild(),this.renderData.dataChanged||this.renderData.transformsChanged||this.renderData.colorTransformsChanged){this.renderData.dataChanged&&(Q.activeTexture(Q.TEXTURE0),Q.bindTexture(Q.TEXTURE_2D,this.splatTexture),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_WRAP_S,Q.CLAMP_TO_EDGE),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_WRAP_T,Q.CLAMP_TO_EDGE),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_MIN_FILTER,Q.NEAREST),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_MAG_FILTER,Q.NEAREST),Q.texImage2D(Q.TEXTURE_2D,0,Q.RGBA32UI,this.renderData.width,this.renderData.height,0,Q.RGBA_INTEGER,Q.UNSIGNED_INT,this.renderData.data)),this.renderData.transformsChanged&&(Q.activeTexture(Q.TEXTURE1),Q.bindTexture(Q.TEXTURE_2D,c),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_WRAP_S,Q.CLAMP_TO_EDGE),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_WRAP_T,Q.CLAMP_TO_EDGE),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_MIN_FILTER,Q.NEAREST),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_MAG_FILTER,Q.NEAREST),Q.texImage2D(Q.TEXTURE_2D,0,Q.RGBA32F,this.renderData.transformsWidth,this.renderData.transformsHeight,0,Q.RGBA,Q.FLOAT,this.renderData.transforms),Q.activeTexture(Q.TEXTURE2),Q.bindTexture(Q.TEXTURE_2D,W),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_WRAP_S,Q.CLAMP_TO_EDGE),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_WRAP_T,Q.CLAMP_TO_EDGE),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_MIN_FILTER,Q.NEAREST),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_MAG_FILTER,Q.NEAREST),Q.texImage2D(Q.TEXTURE_2D,0,Q.R32UI,this.renderData.transformIndicesWidth,this.renderData.transformIndicesHeight,0,Q.RED_INTEGER,Q.UNSIGNED_INT,this.renderData.transformIndices)),this.renderData.colorTransformsChanged&&(Q.activeTexture(Q.TEXTURE3),Q.bindTexture(Q.TEXTURE_2D,w),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_WRAP_S,Q.CLAMP_TO_EDGE),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_WRAP_T,Q.CLAMP_TO_EDGE),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_MIN_FILTER,Q.NEAREST),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_MAG_FILTER,Q.NEAREST),Q.texImage2D(Q.TEXTURE_2D,0,Q.RGBA32F,this.renderData.colorTransformsWidth,this.renderData.colorTransformsHeight,0,Q.RGBA,Q.FLOAT,this.renderData.colorTransforms),Q.activeTexture(Q.TEXTURE4),Q.bindTexture(Q.TEXTURE_2D,D),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_WRAP_S,Q.CLAMP_TO_EDGE),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_WRAP_T,Q.CLAMP_TO_EDGE),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_MIN_FILTER,Q.NEAREST),Q.texParameteri(Q.TEXTURE_2D,Q.TEXTURE_MAG_FILTER,Q.NEAREST),Q.texImage2D(Q.TEXTURE_2D,0,Q.R32UI,this.renderData.colorTransformIndicesWidth,this.renderData.colorTransformIndicesHeight,0,Q.RED_INTEGER,Q.UNSIGNED_INT,this.renderData.colorTransformIndices));const Z=new Float32Array(this.renderData.positions.slice().buffer),p=new Float32Array(this.renderData.transforms.slice().buffer),P=new Uint32Array(this.renderData.transformIndices.slice().buffer);this._worker?.postMessage({sortData:{positions:Z,transforms:p,transformIndices:P,vertexCount:this.renderData.vertexCount}},[Z.buffer,p.buffer,P.buffer]),this.renderData.dataChanged=!1,this.renderData.transformsChanged=!1,this.renderData.colorTransformsChanged=!1}this._camera.update(),this._worker?.postMessage({viewProj:this._camera.data.viewProj.buffer}),Q.viewport(0,0,A.width,A.height),Q.clearColor(0,0,0,0),Q.clear(Q.COLOR_BUFFER_BIT),Q.disable(Q.DEPTH_TEST),Q.enable(Q.BLEND),Q.blendFuncSeparate(Q.ONE_MINUS_DST_ALPHA,Q.ONE,Q.ONE_MINUS_DST_ALPHA,Q.ONE),Q.blendEquationSeparate(Q.FUNC_ADD,Q.FUNC_ADD),Q.uniformMatrix4fv(s,!1,this._camera.data.projectionMatrix.buffer),Q.uniformMatrix4fv(F,!1,this._camera.data.viewMatrix.buffer),Q.bindBuffer(Q.ARRAY_BUFFER,k),Q.vertexAttribPointer(a,2,Q.FLOAT,!1,0,0),Q.bindBuffer(Q.ARRAY_BUFFER,u),Q.bufferData(Q.ARRAY_BUFFER,this.depthIndex,Q.STATIC_DRAW),Q.vertexAttribIPointer(R,1,Q.INT,0,0),Q.vertexAttribDivisor(R,1),Q.drawArraysInstanced(Q.TRIANGLE_FAN,0,4,this.depthIndex.length)},this._dispose=()=>{if(!this._scene||!this._camera||!this.renderData){console.error("Cannot dispose without scene and camera");return}this._scene.removeEventListener("objectAdded",V),this._scene.removeEventListener("objectRemoved",_);for(const Z of this._scene.objects)Z instanceof H&&Z.removeEventListener("objectChanged",M);this._worker?.terminate(),this.renderData.dispose(),Q.deleteTexture(this.splatTexture),Q.deleteTexture(c),Q.deleteTexture(W),Q.deleteBuffer(u),Q.deleteBuffer(k)},this._setOutlineThickness=Z=>{this._outlineThickness=Z,this._initialized&&Q.uniform1f(C,Z)},this._setOutlineColor=Z=>{this._outlineColor=Z,this._initialized&&Q.uniform4fv(I,new Float32Array(Z.flatNorm()))}}get renderData(){return this._renderData}get depthIndex(){return this._depthIndex}get splatTexture(){return this._splatTexture}get outlineThickness(){return this._outlineThickness}set outlineThickness(t){this._setOutlineThickness(t)}get outlineColor(){return this._outlineColor}set outlineColor(t){this._setOutlineColor(t)}get worker(){return this._worker}_getVertexSource(){return Mt}_getFragmentSource(){return Lt}}class Yt{constructor(t=1){let e=0,A=!1,Q,s,n,U;this.initialize=F=>{if(!(F instanceof Ct))throw new Error("FadeInPass requires a RenderProgram");e=F.started?1:0,A=!0,Q=F,s=F.renderer.gl,n=s.getUniformLocation(Q.program,"useDepthFade"),s.uniform1i(n,1),U=s.getUniformLocation(Q.program,"depthFade"),s.uniform1f(U,e)},this.render=()=>{!A||Q.renderData?.updating||(s.useProgram(Q.program),e=Math.min(e+t*.01,1),e>=1&&(A=!1,s.uniform1i(n,0)),s.uniform1f(U,e))}}dispose(){}}class Kt{constructor(t=null,e=null){this._backgroundColor=new gt;const A=t||document.createElement("canvas");t||(A.style.display="block",A.style.boxSizing="border-box",A.style.width="100%",A.style.height="100%",A.style.margin="0",A.style.padding="0",document.body.appendChild(A)),A.style.background=this._backgroundColor.toHexString(),this._canvas=A,this._gl=A.getContext("webgl2",{antialias:!1});const Q=e||[];e||Q.push(new Yt),this._renderProgram=new Ct(this,Q);const s=[this._renderProgram];this.resize=()=>{const n=A.clientWidth,U=A.clientHeight;(A.width!==n||A.height!==U)&&this.setSize(n,U)},this.setSize=(n,U)=>{A.width=n,A.height=U,this._gl.viewport(0,0,A.width,A.height);for(const F of s)F.resize()},this.render=(n,U)=>{for(const F of s)F.render(n,U)},this.dispose=()=>{for(const n of s)n.dispose()},this.addProgram=n=>{s.push(n)},this.removeProgram=n=>{const U=s.indexOf(n);if(U<0)throw new Error("Program not found");s.splice(U,1)},this.resize()}get canvas(){return this._canvas}get gl(){return this._gl}get renderProgram(){return this._renderProgram}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t,this._canvas.style.background=t.toHexString()}}class vt{constructor(t,e,A=.5,Q=.5,s=5,n=!0,U=new h){this.minAngle=-90,this.maxAngle=90,this.minZoom=.1,this.maxZoom=30,this.orbitSpeed=1,this.panSpeed=1,this.zoomSpeed=1,this.dampening=.12,this.setCameraTarget=()=>{};let F=U.clone(),i=F.clone(),l=A,d=Q,B=s,r=!1,C=!1,I=0,a=0,R=0;const c={};let W=!1;const w=()=>{if(W)return;const o=t.rotation.toEuler();l=-o.y,d=-o.x;const S=t.position.x-B*Math.sin(l)*Math.cos(d),N=t.position.y+B*Math.sin(d),b=t.position.z+B*Math.cos(l)*Math.cos(d);i=new h(S,N,b)};t.addEventListener("objectChanged",w),this.setCameraTarget=o=>{const S=o.x-t.position.x,N=o.y-t.position.y,b=o.z-t.position.z;B=Math.sqrt(S*S+N*N+b*b),d=Math.atan2(N,Math.sqrt(S*S+b*b)),l=-Math.atan2(S,b),i=new h(o.x,o.y,o.z)};const D=()=>.1+.9*(B-this.minZoom)/(this.maxZoom-this.minZoom),k=o=>{c[o.code]=!0,o.code==="ArrowUp"&&(c.KeyW=!0),o.code==="ArrowDown"&&(c.KeyS=!0),o.code==="ArrowLeft"&&(c.KeyA=!0),o.code==="ArrowRight"&&(c.KeyD=!0)},u=o=>{c[o.code]=!1,o.code==="ArrowUp"&&(c.KeyW=!1),o.code==="ArrowDown"&&(c.KeyS=!1),o.code==="ArrowLeft"&&(c.KeyA=!1),o.code==="ArrowRight"&&(c.KeyD=!1)},y=o=>{T(o),r=!0,C=o.button===2,a=o.clientX,R=o.clientY,window.addEventListener("mouseup",V)},V=o=>{T(o),r=!1,C=!1,window.removeEventListener("mouseup",V)},_=o=>{if(T(o),!r||!t)return;const S=o.clientX-a,N=o.clientY-R;if(C){const b=D(),z=-S*this.panSpeed*.01*b,q=-N*this.panSpeed*.01*b,L=j.RotationFromQuaternion(t.rotation).buffer,g=new h(L[0],L[3],L[6]),J=new h(L[1],L[4],L[7]);i=i.add(g.multiply(z)),i=i.add(J.multiply(q))}else l-=S*this.orbitSpeed*.003,d+=N*this.orbitSpeed*.003,d=Math.min(Math.max(d,this.minAngle*Math.PI/180),this.maxAngle*Math.PI/180);a=o.clientX,R=o.clientY},M=o=>{T(o);const S=D();B+=o.deltaY*this.zoomSpeed*.025*S,B=Math.min(Math.max(B,this.minZoom),this.maxZoom)},x=o=>{if(T(o),o.touches.length===1)r=!0,C=!1,a=o.touches[0].clientX,R=o.touches[0].clientY,I=0;else if(o.touches.length===2){r=!0,C=!0,a=(o.touches[0].clientX+o.touches[1].clientX)/2,R=(o.touches[0].clientY+o.touches[1].clientY)/2;const S=o.touches[0].clientX-o.touches[1].clientX,N=o.touches[0].clientY-o.touches[1].clientY;I=Math.sqrt(S*S+N*N)}},Z=o=>{T(o),r=!1,C=!1},p=o=>{if(T(o),!(!r||!t))if(C){const S=D(),N=o.touches[0].clientX-o.touches[1].clientX,b=o.touches[0].clientY-o.touches[1].clientY,z=Math.sqrt(N*N+b*b),q=I-z;B+=q*this.zoomSpeed*.1*S,B=Math.min(Math.max(B,this.minZoom),this.maxZoom),I=z;const L=(o.touches[0].clientX+o.touches[1].clientX)/2,g=(o.touches[0].clientY+o.touches[1].clientY)/2,J=L-a,G=g-R,m=j.RotationFromQuaternion(t.rotation).buffer,Y=new h(m[0],m[3],m[6]),O=new h(m[1],m[4],m[7]);i=i.add(Y.multiply(-J*this.panSpeed*.025*S)),i=i.add(O.multiply(-G*this.panSpeed*.025*S)),a=L,R=g}else{const S=o.touches[0].clientX-a,N=o.touches[0].clientY-R;l-=S*this.orbitSpeed*.003,d+=N*this.orbitSpeed*.003,d=Math.min(Math.max(d,this.minAngle*Math.PI/180),this.maxAngle*Math.PI/180),a=o.touches[0].clientX,R=o.touches[0].clientY}},P=(o,S,N)=>(1-N)*o+N*S;this.update=()=>{W=!0,A=P(A,l,this.dampening),Q=P(Q,d,this.dampening),s=P(s,B,this.dampening),F=F.lerp(i,this.dampening);const o=F.x+s*Math.sin(A)*Math.cos(Q),S=F.y-s*Math.sin(Q),N=F.z-s*Math.cos(A)*Math.cos(Q);t.position=new h(o,S,N);const b=F.subtract(t.position).normalize(),z=Math.asin(-b.y),q=Math.atan2(b.x,b.z);t.rotation=f.FromEuler(new h(z,q,0));const L=.025,g=.01,J=j.RotationFromQuaternion(t.rotation).buffer,G=new h(-J[2],-J[5],-J[8]),m=new h(J[0],J[3],J[6]);c.KeyS&&(i=i.add(G.multiply(L))),c.KeyW&&(i=i.subtract(G.multiply(L))),c.KeyA&&(i=i.subtract(m.multiply(L))),c.KeyD&&(i=i.add(m.multiply(L))),c.KeyE&&(l+=g),c.KeyQ&&(l-=g),c.KeyR&&(d+=g),c.KeyF&&(d-=g),W=!1};const T=o=>{o.preventDefault(),o.stopPropagation()};this.dispose=()=>{e.removeEventListener("dragenter",T),e.removeEventListener("dragover",T),e.removeEventListener("dragleave",T),e.removeEventListener("contextmenu",T),e.removeEventListener("mousedown",y),e.removeEventListener("mousemove",_),e.removeEventListener("wheel",M),e.removeEventListener("touchstart",x),e.removeEventListener("touchend",Z),e.removeEventListener("touchmove",p),n&&(window.removeEventListener("keydown",k),window.removeEventListener("keyup",u))},n&&(window.addEventListener("keydown",k),window.addEventListener("keyup",u)),e.addEventListener("dragenter",T),e.addEventListener("dragover",T),e.addEventListener("dragleave",T),e.addEventListener("contextmenu",T),e.addEventListener("mousedown",y),e.addEventListener("mousemove",_),e.addEventListener("wheel",M),e.addEventListener("touchstart",x),e.addEventListener("touchend",Z),e.addEventListener("touchmove",p),this.update()}}var Xt=Et("");function zt(E,t){lt(t,!0);let e=At(()=>t.value.url),A,Q,s,n=null,U,F=Jt(!1),i=null;function l(){if(i!==null&&(cancelAnimationFrame(i),i=null),n!==null&&(n.dispose(),n=null),Q=new Wt,s=new Nt,n=new Kt(A),U=new vt(s,A),U.zoomSpeed=t.zoom_speed,U.panSpeed=t.pan_speed,!t.value)return;let r=!1;const C=async()=>{if(r){console.error("Already loading");return}if(!tt(e))throw new Error("No resolved URL");if(r=!0,tt(e).endsWith(".ply"))await pt.LoadAsync(tt(e),Q,void 0);else if(tt(e).endsWith(".splat"))await Dt.LoadAsync(tt(e),Q,void 0);else throw new Error("Unsupported file type");r=!1},I=()=>{if(n){if(r){i=requestAnimationFrame(I);return}U.update(),n.render(Q,s),i=requestAnimationFrame(I)}};C(),i=requestAnimationFrame(I)}dt(()=>(t.value!=null&&l(),St(F,!0),()=>{n&&n.dispose()}));let d=At(()=>t.value?.path);ht(()=>{A&&tt(F)&&tt(d)&&l()});var B=Xt();It(B,r=>A=r,()=>A),Rt(E,B),ct()}export{zt as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Check-DUAHzS2-.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Check-DUAHzS2-.js new file mode 100644 index 0000000000000000000000000000000000000000..9cb88435f09b5c04eb76f5b7362eb21755b7c4fa --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Check-DUAHzS2-.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as t,f as e}from"./index-DWyDLubb.js";var s=e('');function a(o){var r=s();t(o,r)}export{a as C}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Checkbox-BbySKLMz.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Checkbox-BbySKLMz.css new file mode 100644 index 0000000000000000000000000000000000000000..89627d3c16f15f7a32ee6284582f73ba3b30f13e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Checkbox-BbySKLMz.css @@ -0,0 +1 @@ +.checkbox-container.svelte-1q8xtp9{display:flex;align-items:center;gap:var(--spacing-lg);cursor:pointer}.label-text.svelte-1q8xtp9{color:var(--body-text-color);font-size:var(--checkbox-label-text-size);line-height:var(--line-sm)}input.svelte-1q8xtp9{--ring-color: transparent;position:relative;box-shadow:var(--checkbox-shadow);border:1px solid var(--checkbox-border-color);border-radius:var(--checkbox-border-radius);background-color:var(--checkbox-background-color);line-height:var(--line-sm);flex-shrink:0;z-index:0}input.svelte-1q8xtp9:checked,input.svelte-1q8xtp9:checked:hover,input.svelte-1q8xtp9:checked:focus{background-image:var(--checkbox-check);background-color:var(--checkbox-background-color-selected);border-color:var(--checkbox-border-color-focus)}input.svelte-1q8xtp9:checked:focus{background-image:var(--checkbox-check);background-color:var(--checkbox-background-color-selected);border-color:var(--checkbox-border-color-focus)}input.svelte-1q8xtp9:hover{border-color:var(--checkbox-border-color-hover);background-color:var(--checkbox-background-color-hover)}input.svelte-1q8xtp9:focus{border-color:var(--checkbox-border-color-focus);background-color:var(--checkbox-background-color-focus)}input.svelte-1q8xtp9:indeterminate{background-image:none;background-color:var(--checkbox-background-color-selected);border-color:var(--checkbox-border-color-focus);position:relative}input.svelte-1q8xtp9:indeterminate:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;z-index:1;border-radius:var(--checkbox-border-radius);background-color:var(--checkbox-background-color-selected)}input.svelte-1q8xtp9:indeterminate:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:8px;height:2px;background-color:#fff;z-index:2}input.svelte-1q8xtp9:indeterminate:hover{background-color:var(--checkbox-background-color-selected);border-color:var(--checkbox-border-color-hover)}input.svelte-1q8xtp9:indeterminate:focus{background-color:var(--checkbox-background-color-selected);border-color:var(--checkbox-border-color-focus)}input[disabled].svelte-1q8xtp9{cursor:not-allowed;opacity:.75}label.disabled.svelte-1q8xtp9{cursor:not-allowed}input.svelte-1q8xtp9:not([disabled]):hover{cursor:pointer} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Checkbox-HhbcVSTv.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Checkbox-HhbcVSTv.js new file mode 100644 index 0000000000000000000000000000000000000000..c87d7d80ccfad1a4082e776d6e080ee0fbde6db4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Checkbox-HhbcVSTv.js @@ -0,0 +1 @@ +import{p as l,i as E,b as R,t as V}from"./i18n-Dnhn5Rxr.js";import{R as W,u as X,v as Y,y as Z,w as c,x as j,t as b,Z as _,a as h,T as z,V as f,X as A,W as v,a5 as B,Y as m,a0 as D}from"./index-DWyDLubb.js";import{s as F}from"./clone-BkeCM4Nl.js";import{a as G}from"./input-DrerMDOL.js";import{b as H}from"./universal-CFOISHmx.js";var I=v(' '),J=v('');function P(x,a){W(a,!0);let k=l(a,"label",3,"Checkbox"),t=l(a,"value",15),i=l(a,"indeterminate",7,!1),p=l(a,"interactive",3,!0),g=l(a,"show_label",3,!0),d=B(()=>!p()),o=X(Y(t()));Z(()=>{c(o)!==t()&&(j(o,t(),!0),a.on_change?.(F(t())))});async function y(e){e.key==="Enter"&&(t(!t()),a.on_select?.({index:0,value:e.currentTarget.checked,selected:e.currentTarget.checked}))}async function T(e){t(e.currentTarget.checked),a.on_select?.({index:0,value:e.currentTarget.checked,selected:e.currentTarget.checked}),a.on_input?.()}var n=J();let u;var s=f(n);V(s);var w=A(s,2);{var q=e=>{var r=I(),C=f(r,!0);m(r),b(()=>D(C,k())),h(e,r)};E(w,e=>{g()&&e(q)})}m(n),b(()=>{u=R(n,1,"checkbox-container svelte-1q8xtp9",null,u,{disabled:c(d)}),s.disabled=c(d)}),G(s,t),H("indeterminate","change",s,i,i),_("keydown",s,y),_("input",s,T),h(x,n),z()}export{P as C}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Clear-BF6j078A.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Clear-BF6j078A.js new file mode 100644 index 0000000000000000000000000000000000000000..b6cb1c38673a2bcb92d37752ba7603bf8ca78e41 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Clear-BF6j078A.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as o,f as t}from"./index-DWyDLubb.js";var l=t('');function i(e){var r=l();o(e,r)}export{i as C}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Code-BLWhl1y6.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Code-BLWhl1y6.js new file mode 100644 index 0000000000000000000000000000000000000000..974dfc6466d4969b62aa0b6f1010fe6b128f8320 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Code-BLWhl1y6.js @@ -0,0 +1,14 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-Dq9Y72II.js","./index-DUwqQ_4P.js","./i18n-Dnhn5Rxr.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./i18n-9kYrHpuJ.css","./index-o-aMX0pU.js","./index-rD6wvNSx.js","./index-B2xAlaja.js","./index-DYwhoY3R.js","./frontmatter-YCXABXxZ.js","./yaml-DsCXHVTH.js","./index-1ZT9ayz1.js"])))=>i.map(i=>d[i]); +import{p as Ee,d as gf,b as bf}from"./i18n-Dnhn5Rxr.js";import{af as se,R as yf,y as us,w as To,aa as xf,t as wf,a as kf,T as vf,u as Sf,x as Cf,V as Af,W as Mf,Y as Tf}from"./index-DWyDLubb.js";let js=[],Ma=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=Ma[i])e=i+1;else return!0;if(e==t)return!1}}function Do(n){return n>=127462&&n<=127487}const Oo=8205;function Of(n,e,t=!0,i=!0){return(t?Ta:Bf)(n,e,i)}function Ta(n,e,t){if(e==n.length)return e;e&&Da(n.charCodeAt(e))&&Oa(n.charCodeAt(e-1))&&e--;let i=ds(n,e);for(e+=Bo(i);e=0&&Do(ds(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Bf(n,e,t){for(;e>0;){let i=Ta(n,e-2,t);if(i=56320&&n<57344}function Oa(n){return n>=55296&&n<56320}function Bo(n){return n<65536?1:2}class z{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=ii(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),tt.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ii(this,e,t);let i=[];return this.decompose(e,t,i,0),tt.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Ci(this),r=new Ci(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Ci(this,e)}iterRange(e,t=this.length){return new Ba(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new La(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?z.empty:e.length<=32?new Q(e):tt.from(Q.split(e,[]))}}class Q extends z{constructor(e,t=Lf(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Ef(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new Q(Lo(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Tn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new Q(l,o.length+r.length));else{let a=l.length>>1;i.push(new Q(l.slice(0,a)),new Q(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof Q))return super.replace(e,t,i);[e,t]=ii(this,e,t);let s=Tn(this.text,Tn(i.text,Lo(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new Q(s,r):tt.from(Q.split(s,[]),r)}sliceString(e,t=this.length,i=` +`){[e,t]=ii(this,e,t);let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new Q(i,s)),i=[],s=-1);return s>-1&&t.push(new Q(i,s)),t}}class tt extends z{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=ii(this,e,t),i.lines=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new tt(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` +`){[e,t]=ii(this,e,t);let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof tt))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new Q(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof tt)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof Q&&a&&(p=c[c.length-1])instanceof Q&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new Q(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:tt.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new tt(l,t)}}z.empty=new Q([""],0);function Lf(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Tn(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(a>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof Q?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof Q?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(s instanceof Q){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof Q?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Ba{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ci(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class La{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(z.prototype[Symbol.iterator]=function(){return this.iter()},Ci.prototype[Symbol.iterator]=Ba.prototype[Symbol.iterator]=La.prototype[Symbol.iterator]=function(){return this});class Ef{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function ii(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function ce(n,e,t=!0,i=!0){return Of(n,e,t,i)}function Pf(n){return n>=56320&&n<57344}function Rf(n){return n>=55296&&n<56320}function Be(n,e){let t=n.charCodeAt(e);if(!Rf(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Pf(i)?(t-55296<<10)+(i-56320)+65536:t}function Ea(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function lt(n){return n<65536?1:2}const Us=/\r\n?|\n/;var he=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(he||(he={}));class ot{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=he.Simple&&h>=e&&(i==he.TrackDel&&se||i==he.TrackBefore&&se))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ot(e)}static create(e){return new ot(e)}}class ie extends ot{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Gs(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return Js(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length0&&bt(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?z.of(d.split(i||Us)):d:z.empty,m=p.length;if(f==u&&m==0)return;fo&&pe(s,f-o,-1),pe(s,u-f,m),bt(r,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new ie(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:s>=0&&e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function bt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function Js(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Ei(n),l=new Ei(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);pe(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Ei{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?z.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?z.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Pt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Pt(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return x.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return x.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return x.range(e.anchor,e.head)}static create(e,t,i){return new Pt(e,t,i)}}class x{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:x.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new x(e.ranges.map(t=>Pt.fromJSON(t)),e.main)}static single(e,t=e){return new x([x.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?8:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?x.range(a,l):x.range(l,a))}}return new x(e,t)}}function Ra(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Vr=0;class O{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=Vr++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new O(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:zr),!!e.static,e.enables)}of(e){return new Dn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function zr(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Dn{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=Vr++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Ys(f,c)){let d=i(f);if(l?!Eo(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let m=Rn(u,p);if(this.dependencies.every(b=>b instanceof O?u.facet(b)===f.facet(b):b instanceof Te?u.field(b,!1)==f.field(b,!1):!0)||(l?Eo(d=i(f),m,s):s(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}}function Eo(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(nn).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>{let r=i.facet(nn),o=s.facet(nn),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,nn.of({field:this,create:e})]}get extension(){return this}}const Lt={lowest:4,low:3,default:2,high:1,highest:0};function pi(n){return e=>new Ia(e,n)}const qt={highest:pi(Lt.highest),high:pi(Lt.high),default:pi(Lt.default),low:pi(Lt.low),lowest:pi(Lt.lowest)};class Ia{constructor(e,t){this.inner=e,this.prec=t}}class Xn{of(e){return new Xs(this,e)}reconfigure(e){return Xn.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Xs{constructor(e,t){this.compartment=e,this.inner=t}}class Pn{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Nf(e,t,o))u instanceof Te?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i?.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(b=>b.type==0))if(l[p.id]=a.length<<1|1,zr(m,d))a.push(i.facet(p));else{let b=p.combine(d.map(y=>y.value));a.push(i&&p.compare(b,i.facet(p))?i.facet(p):b)}else{for(let b of d)b.type==0?(l[b.id]=a.length<<1|1,a.push(b.value)):(l[b.id]=h.length<<1,h.push(y=>b.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(b=>If(b,p,d))}}let f=h.map(u=>u(l));return new Pn(e,o,f,l,a,r)}}function Nf(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Xs&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof Xs){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof Ia)r(o.inner,o.prec);else if(o instanceof Te)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Dn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,Lt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,Lt.default),i.reduce((o,l)=>o.concat(l))}function Ai(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Rn(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Na=O.define(),Qs=O.define({combine:n=>n.some(e=>e),static:!0}),Wa=O.define({combine:n=>n.length?n[0]:void 0,static:!0}),Fa=O.define(),Ha=O.define(),Va=O.define(),za=O.define({combine:n=>n.length?n[0]:!1});class ut{constructor(e,t){this.type=e,this.value=t}static define(){return new Wf}}class Wf{of(e){return new ut(this,e)}}class Ff{constructor(e){this.map=e}of(e){return new R(this,e)}}class R{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new R(this.type,t)}is(e){return this.type==e}static define(e={}){return new Ff(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}R.reconfigure=R.define();R.appendConfig=R.define();class Z{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Ra(i,t.newLength),r.some(l=>l.type==Z.time)||(this.annotations=r.concat(Z.time.of(Date.now())))}static create(e,t,i,s,r,o){return new Z(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Z.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Z.time=ut.define();Z.userEvent=ut.define();Z.addToHistory=ut.define();Z.remote=ut.define();function Hf(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof Z?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof Z?n=r[0]:n=qa(e,Yt(r),!1)}return n}function zf(n){let e=n.startState,t=e.facet(Va),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=_a(i,Zs(e,r,n.changes.newLength),!0))}return i==n?n:Z.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const _f=[];function Yt(n){return n==null?_f:Array.isArray(n)?n:[n]}var Ie=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Ie||(Ie={}));const qf=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let er;try{er=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Kf(n){if(er)return er.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||qf.test(t)))return!0}return!1}function $f(n){return e=>{if(!/\S/.test(e))return Ie.Space;if(Kf(e))return Ie.Word;for(let t=0;t-1)return Ie.Word;return Ie.Other}}class V{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(R.reconfigure)?(t=null,i=l.value):l.is(R.appendConfig)&&(t=null,i=Yt(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=Pn.resolve(i,s,this),r=new V(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Qs)?e.newSelection:e.newSelection.asSingle();new V(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:x.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=Yt(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return V.create({doc:e.doc,selection:x.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Pn.resolve(e.extensions||[],new Map),i=e.doc instanceof z?e.doc:z.of((e.doc||"").split(t.staticFacet(V.lineSeparator)||Us)),s=e.selection?e.selection instanceof x?e.selection:x.single(e.selection.anchor,e.selection.head):x.single(0);return Ra(s,i.length),t.staticFacet(Qs)||(s=s.asSingle()),new V(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(V.tabSize)}get lineBreak(){return this.facet(V.lineSeparator)||` +`}get readOnly(){return this.facet(za)}phrase(e,...t){for(let i of this.facet(V.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(Na))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return $f(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=ce(t,o,!1);if(r(t.slice(a,o))!=Ie.Word)break;o=a}for(;ln.length?n[0]:4});V.lineSeparator=Wa;V.readOnly=za;V.phrases=O.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});V.languageData=Na;V.changeFilter=Fa;V.transactionFilter=Ha;V.transactionExtender=Va;Xn.reconfigure=R.define();function Kt(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class xt{eq(e){return this==e}range(e,t=e){return tr.create(e,t,this)}}xt.prototype.startSide=xt.prototype.endSide=0;xt.prototype.point=!1;xt.prototype.mapMode=he.TrackDel;function _r(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let tr=class Ka{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Ka(e,t,i)}};function ir(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class qr{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),s.push(u-o),r.push(d-o))}return{mapped:i.length?new qr(s,r,i,l):null,pos:o}}}class F{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new F(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(ir)),this.isEmpty)return t.length?F.of(t):this;let l=new $a(this,null,-1).goto(0),a=0,h=[],c=new wt;for(;l.value||a=0){let f=t[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Pi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Pi.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),a=Po(o,l,i),h=new mi(o,a,r),c=new mi(l,a,r);i.iterGaps((f,u,d)=>Ro(h,f,c,u,d,s)),i.empty&&i.length==0&&Ro(h,0,c,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=999999999);let r=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=Po(r,o),a=new mi(r,l,0).goto(i),h=new mi(o,l,0).goto(i);for(;;){if(a.to!=h.to||!nr(a.active,h.active)||a.point&&(!h.point||!_r(a.point,h.point)))return!1;if(a.to>s)return!0;a.next(),h.next()}}static spans(e,t,i,s,r=-1){let o=new mi(e,null,r).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(s.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,t=!1){let i=new wt;for(let s of e instanceof tr?[e]:t?jf(e):e)i.add(s.from,s.to,s.value);return i.finish()}static join(e){if(!e.length)return F.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let s=e[i];s!=F.empty;s=s.nextLayer)t=new F(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}F.empty=new F([],[],null,-1);function jf(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(ir);e=i}return n}F.empty.nextLayer=F.empty;class wt{finishChunk(e){this.chunks.push(new qr(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new wt)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(F.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=F.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Po(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new $a(o,t,i,r));return s.length==1?s[0]:new Pi(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)ps(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)ps(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),ps(this.heap,0)}}}function ps(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}class mi{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Pi.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){sn(this.active,e),sn(this.activeTo,e),sn(this.activeRank,e),this.minActive=Io(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t0;)t++;rn(this.active,t,i),rn(this.activeTo,t,s),rn(this.activeRank,t,r),e&&rn(e,t,this.cursor.from),this.minActive=Io(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&sn(i,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[s]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function Ro(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,l=i,a=i-e,h=!!r.boundChange;for(let c=!1;;){let f=n.to+a-t.to,u=f||n.endSide-t.endSide,d=u<0?n.to+a:t.to,p=Math.min(d,o);if(n.point||t.point?(n.point&&t.point&&_r(n.point,t.point)&&nr(n.activeForPoint(n.to),t.activeForPoint(t.to))||r.comparePoint(l,p,n.point,t.point),c=!1):(c&&r.boundChange(l),p>l&&!nr(n.active,t.active)&&r.compareRange(l,p,n.active,t.active),h&&po)break;l=d,u<=0&&n.next(),u>=0&&t.next()}}function nr(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function Io(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=ce(n,s)}return i===!0?-1:n.length}const rr="ͼ",No=typeof Symbol>"u"?"__"+rr:Symbol.for(rr),or=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Wo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class kt{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(m=>o.map(b=>m.replace(/&/,b))).reduce((m,b)=>m.concat(b)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||u)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=Wo[No]||1;return Wo[No]=e+1,rr+e.toString(36)}static mount(e,t,i){let s=e[or],r=i&&i.nonce;s?r&&s.setNonce(r):s=new Uf(e,r),s.mount(Array.isArray(t)?t:[t],e)}}let Fo=new Map;class Uf{constructor(e,t){let i=e.ownerDocument||e,s=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let r=Fo.get(i);if(r)return e[or]=r;this.sheet=new s.CSSStyleSheet,Fo.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[or]=this}mount(e,t){let i=this.sheet,s=0,r=0;for(let o=0;o-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,l),i)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Gf=typeof navigator<"u"&&/Mac/.test(navigator.platform),Jf=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ae=0;ae<10;ae++)vt[48+ae]=vt[96+ae]=String(ae);for(var ae=1;ae<=24;ae++)vt[ae+111]="F"+ae;for(var ae=65;ae<=90;ae++)vt[ae]=String.fromCharCode(ae+32),Ri[ae]=String.fromCharCode(ae);for(var ms in vt)Ri.hasOwnProperty(ms)||(Ri[ms]=vt[ms]);function Yf(n){var e=Gf&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Jf&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ri:vt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function it(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;e2);var T={mac:Vo||/Mac/.test(xe.platform),windows:/Win/.test(xe.platform),linux:/Linux|X11/.test(xe.platform),ie:Qn,ie_version:Ua?lr.documentMode||6:hr?+hr[1]:ar?+ar[1]:0,gecko:Ho,gecko_version:Ho?+(/Firefox\/(\d+)/.exec(xe.userAgent)||[0,0])[1]:0,chrome:!!gs,chrome_version:gs?+gs[1]:0,ios:Vo,android:/Android\b/.test(xe.userAgent),webkit_version:Xf?+(/\bAppleWebKit\/(\d+)/.exec(xe.userAgent)||[0,0])[1]:0,safari:cr,safari_version:cr?+(/\bVersion\/(\d+(\.\d+)?)/.exec(xe.userAgent)||[0,0])[1]:0,tabSize:lr.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Kr(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const In=Object.create(null);function $r(n,e,t){if(n==e)return!0;n||(n=In),e||(e=In);let i=Object.keys(n),s=Object.keys(e);if(i.length-0!=s.length-0)return!1;for(let r of i)if(r!=t&&(s.indexOf(r)==-1||n[r]!==e[r]))return!1;return!0}function Qf(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function zo(n,e,t){let i=!1;if(e)for(let s in e)t&&s in t||(i=!0,s=="style"?n.style.cssText="":n.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(i=!0,s=="style"?n.style.cssText=t[s]:n.setAttribute(s,t[s]));return i}function Zf(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new Ft(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=Ga(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new Ft(e,i,s,t,e.widget||null,!0)}static line(e){return new Ji(e)}static set(e,t=!1){return F.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}I.none=F.empty;class Gi extends I{constructor(e){let{start:t,end:i}=Ga(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Kr(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||In}eq(e){return this==e||e instanceof Gi&&this.tagName==e.tagName&&$r(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Gi.prototype.point=!1;class Ji extends I{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ji&&this.spec.class==e.spec.class&&$r(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Ji.prototype.mapMode=he.TrackBefore;Ji.prototype.point=!0;class Ft extends I{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?he.TrackBefore:he.TrackAfter:he.TrackDel}get type(){return this.startSide!=this.endSide?fe.WidgetRange:this.startSide<=0?fe.WidgetBefore:fe.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ft&&eu(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Ft.prototype.point=!0;function Ga(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function eu(n,e){return n==e||!!(n&&e&&n.compare(e))}function Xt(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}class Ii extends xt{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof Ii&&this.tagName==e.tagName&&$r(this.attributes,e.attributes)}static create(e){return new Ii(e.tagName,e.attributes||In)}static set(e,t=!1){return F.of(e,t)}}Ii.prototype.startSide=Ii.prototype.endSide=-1;function ni(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function fr(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Mi(n,e){if(!e.anchorNode)return!1;try{return fr(n,e.anchorNode)}catch{return!1}}function Ti(n){return n.nodeType==3?Wi(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Di(n,e,t,i){return t?_o(n,e,t,i,-1)||_o(n,e,t,i,1):!1}function St(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function Nn(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function _o(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:ft(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=St(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?ft(n):0}else return!1}}function ft(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ni(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function tu(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function Ja(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function iu(n,e,t,i,s,r,o,l){let a=n.ownerDocument,h=a.defaultView||window;for(let c=n,f=!1;c&&!f;)if(c.nodeType==1){let u,d=c==a.body,p=1,m=1;if(d)u=tu(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let k=c.getBoundingClientRect();({scaleX:p,scaleY:m}=Ja(c,k)),u={left:k.left,right:k.left+c.clientWidth*p,top:k.top,bottom:k.top+c.clientHeight*m}}let b=0,y=0;if(s=="nearest")e.top0&&e.bottom>u.bottom+y&&(y=e.bottom-u.bottom+o)):e.bottom>u.bottom&&(y=e.bottom-u.bottom+o,t<0&&e.top-y0&&e.right>u.right+b&&(b=e.right-u.right+r)):e.right>u.right&&(b=e.right-u.right+r,t<0&&e.leftu.bottom||e.leftu.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function nu(n){let e=n.ownerDocument,t,i;for(let s=n.parentNode;s&&!(s==e.body||t&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:t,y:i}}class su{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?ft(t):0),i,Math.min(e.focusOffset,i?ft(i):0))}set(e,t,i,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}}let Bt=null;T.safari&&T.safari_version>=26&&(Bt=!1);function Ya(n){if(n.setActive)return n.setActive();if(Bt)return n.focus(Bt);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(Bt==null?{get preventScroll(){return Bt={preventScroll:!0},!0}}:void 0),!Bt){Bt=!1;for(let t=0;tMath.max(1,n.scrollHeight-n.clientHeight-4)}function Qa(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=ft(t)}else if(t.parentNode&&!Nn(t))i=St(t),t=t.parentNode;else return null}}function Za(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i=t){if(l.level==i)return o;(r<0||(s!=0?s<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function ih(n,e){if(n.length!=e.length)return!1;for(let t=0;t=0;m-=3)if(Ye[m+1]==-d){let b=Ye[m+2],y=b&2?s:b&4?b&1?r:s:0;y&&(j[f]=j[Ye[m]]=y),l=m;break}}else{if(Ye.length==189)break;Ye[l++]=f,Ye[l++]=u,Ye[l++]=a}else if((p=j[f])==2||p==1){let m=p==s;a=m?0:1;for(let b=l-3;b>=0;b-=3){let y=Ye[b+2];if(y&2)break;if(m)Ye[b+2]|=2;else{if(y&4)break;Ye[b+2]|=4}}}}}function uu(n,e,t,i){for(let s=0,r=i;s<=t.length;s++){let o=s?t[s-1].to:n,l=sa;)p==b&&(p=t[--m].from,b=m?t[m-1].to:n),j[--p]=d;a=c}else r=h,a++}}}function dr(n,e,t,i,s,r,o){let l=i%2?2:1;if(i%2==s%2)for(let a=e,h=0;aa&&o.push(new ht(a,m.from,d));let b=m.direction==Ht!=!(d%2);pr(n,b?i+1:i,s,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==t||(c?j[p]!=l:j[p]==l))break;p++}u?dr(n,a,p,i+1,s,u,o):ae;){let c=!0,f=!1;if(!h||a>r[h-1].to){let m=j[a-1];m!=l&&(c=!1,f=m==16)}let u=!c&&l==1?[]:null,d=c?i:i+1,p=a;e:for(;;)if(h&&p==r[h-1].to){if(f)break e;let m=r[--h];if(!c)for(let b=m.from,y=h;;){if(b==e)break e;if(y&&r[y-1].to==b)b=r[--y].from;else{if(j[b-1]==l)break e;break}}if(u)u.push(m);else{m.toj.length;)j[j.length]=256;let i=[],s=e==Ht?0:1;return pr(n,s,s,t,0,n.length,i),i}function nh(n){return[new ht(0,n,0)]}let sh="";function pu(n,e,t,i,s){var r;let o=i.head-n.from,l=ht.find(e,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),a=e[l],h=a.side(s,t);if(o==h){let u=l+=s?1:-1;if(u<0||u>=e.length)return null;a=e[l=u],o=a.side(!s,t),h=a.side(s,t)}let c=ce(n.text,o,a.forward(s,t));(ca.to)&&(c=h),sh=n.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return f&&c==h&&f.level+(s?0:1)n.some(e=>e)}),uh=O.define({combine:n=>n.some(e=>e)}),dh=O.define();class Zt{constructor(e,t="nearest",i="nearest",s=5,r=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new Zt(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Zt(x.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const on=R.define({map:(n,e)=>n.map(e)}),ph=R.define();function Ae(n,e,t){let i=n.facet(ah);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const at=O.define({combine:n=>n.length?n[0]:!0});let gu=0;const jt=O.define({combine(n){return n.filter((e,t)=>{for(let i=0;i{let a=[];return o&&a.push(Zn.of(h=>{let c=h.plugin(l);return c?o(c):I.none})),r&&a.push(r(l)),a})}static fromClass(e,t){return ue.define((i,s)=>new e(i,s),t)}}class bs{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Ae(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Ae(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Ae(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const mh=O.define(),Jr=O.define(),Zn=O.define(),gh=O.define(),Yr=O.define(),Yi=O.define(),bh=O.define();function Ko(n,e){let t=n.state.facet(bh);if(!t.length)return t;let i=t.map(r=>r instanceof Function?r(n):r),s=[];return F.spans(i,e.from,e.to,{point(){},span(r,o,l,a){let h=r-e.from,c=o-e.from,f=s;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,p;if(d==null&&(d=mu(e.text,h,c)),a>0&&f.length&&(p=f[f.length-1]).to==h&&p.direction==d)p.to=c,f=p.inner;else{let m={from:h,to:c,direction:d,inner:[]};f.push(m),f=m.inner}}}}),s}const yh=O.define();function Xr(n){let e=0,t=0,i=0,s=0;for(let r of n.state.facet(yh)){let o=r(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:i,bottom:s}}const ki=O.define();class Ne{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new Ne(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toAs.push(new Ne(r,o,l,a))),this.changedRanges=s}static create(e,t,i){return new Wn(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const bu=[];class te{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return bu}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&Qf(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let s of this.children){if(s==e)return i;i+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let i=St(this.dom),s=this.length?e>0:t>0;return new $e(this.parent.dom,i+(s?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof ts)return e;return null}static get(e){return e.cmTile}}class es extends te{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,s,r=e?.node==t?e:null,o=0;for(let l of this.children){if(l.sync(e),o+=l.length+l.breakAfter,s=i?i.nextSibling:t.firstChild,r&&s!=l.dom&&(r.written=!0),l.dom.parentNode==t)for(;s&&s!=l.dom;)s=$o(s);else t.insertBefore(l.dom,s);i=l.dom}for(s=i?i.nextSibling:t.firstChild,r&&s&&(r.written=!0);s;)s=$o(s);this.length=o}}function $o(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class ts extends es{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=te.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,s=0,r=0;;)if(s==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&r++,s=t.pop()}else{let o=i.children[s++];if(o instanceof yt)t.push(s),i=o,s=0;else{let l=r+o.length,a=e(o,r);if(a!==void 0)return a;r=l+o.breakAfter}}}resolveBlock(e,t){let i,s=-1,r,o=-1;if(this.blockTiles((l,a)=>{let h=a+l.length;if(e>=a&&e<=h){if(l.isWidget()&&t>=-1&&t<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(ae||e==a&&(t>1?l.length:l.covers(-1)))&&(!r||!l.isWidget()&&r.isWidget())&&(r=l,o=e-a)}}),!i&&!r)throw new Error("No tile at position "+e);return i&&t<0||!r?{tile:i,offset:s}:{tile:r,offset:o}}}class yt extends es{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new yt(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class si extends es{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let s=new si(t||document.createElement("div"),e);return(!t||!i)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(e,t,i){let s=null,r=-1,o=null,l=-1;function a(c,f){for(let u=0,d=0;u=f&&(p.isComposite()?a(p,f-d):(!o||o.isHidden&&(t>0||i&&xu(o,p)))&&(m>f||p.flags&32)?(o=p,l=f-d):(di&&(e=i);let s=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?T.chrome||T.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return T.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?Ni(a,o<0):a||null}static of(e,t){let i=new Rt(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class Vt extends te{constructor(e,t,i,s){super(e,t,s),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let s=this.widget.coordsAt(this.dom,e,t);if(s)return s;if(i)return Ni(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let a=l?r.length-1:0;o=r[a],!(e>0?a==0:a==r.length-1||o.top0;)if(s.isComposite())if(o){if(!e)break;i&&i.break(),e--,o=!1}else if(r==s.children.length){if(!e&&!l.length)break;i&&i.leave(s),o=!!s.breakAfter,{tile:s,index:r}=l.pop(),r++}else{let a=s.children[r],h=a.breakAfter;(t>0?a.length<=e:a.length=0;l--){let a=t.marks[l],h=s.lastChild;if(h instanceof Ce&&h.mark.eq(a.mark))h.dom!=a.dom&&h.setDOM(ys(a.dom)),s=h;else{if(this.cache.reused.get(a)){let f=te.get(a.dom);f&&f.setDOM(ys(a.dom))}let c=Ce.of(a.mark,a.dom);s.append(c),s=c}this.cache.reused.set(a,2)}let r=te.get(e.text);r&&this.cache.reused.set(r,2);let o=new Rt(e.text,e.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(e,t,i){let s=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);s||this.flushBuffer();let r=this.ensureMarks(t,i);!s&&!(e.flags&16)&&r.append(this.getBuffer(1)),r.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=xh);let s=si.start(e,t||((i=this.cache.find(si))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let s=this.curLine;for(let r=e.length-1;r>=0;r--){let o=e[r],l;if(t>0&&(l=s.lastChild)&&l instanceof Ce&&l.mark.eq(o))s=l,t--;else{let a=Ce.of(o,(i=this.cache.find(Ce,h=>h.mark.eq(o)))===null||i===void 0?void 0:i.dom);s.append(a),s=a,t=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!jo(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(T.ios&&jo(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(xs,0,32)||new Vt(xs.toDOM(),0,xs,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let t=new ku(e.from,e.to,e.value,e.rank),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-t.rank||this.wrappers[i-1].to-t.to)<0;)i--;this.wrappers.splice(i,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let s=t.lastChild;if(i.fromo.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(r),t=r}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(Fn,void 0,1);return i&&(i.flags=t),i||new Fn(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Su{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:s,lineBreak:r,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let l=this.textOff=Math.min(e,s.length);return r?null:s.slice(0,l)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const Hn=[Vt,si,Rt,Ce,Fn,yt,ts];for(let n=0;n[]),this.index=Hn.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let s=e.bucket,r=this.buckets[s],o=this.index[s];for(let l=r.length-1;l>=0;l--){let a=(l+o)%r.length,h=r[a];if((!t||t(h))&&!this.reused.has(h))return r.splice(a,1),a{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let s=0,r=0,o=0;;){let l=os){let h=a-s;this.preserve(h,!o,!l),s=a,r+=h}if(!l)break;t&&l.fromA<=t.range.fromA&&l.toA>=t.range.toA?(this.forward(l.fromA,t.range.fromA,t.range.fromA{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let h=a>0||l{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Ce&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=r=0):o instanceof Ce&&(s.shift(),r=Math.min(r,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,s=this.builder,r=0,o=F.spans(this.decorations,e,t,{point:(l,a,h,c,f,u)=>{if(h instanceof Ft){if(this.disallowBlockEffectsFor[u]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=c.length,f>c.length)s.continueWidget(a-l);else{let d=h.widget||(h.block?ri.block:ri.inline),p=Mu(h),m=this.cache.findWidget(d,a-l,p)||Vt.of(d,this.view,a-l,p);h.block?(h.startSide>0&&s.addLineStartIfNotCovered(i),s.addBlockWidget(m)):(s.ensureLine(i),s.addInlineWidget(m,c,f))}i=null}else i=Tu(i,h);a>l&&this.text.skip(a-l)},span:(l,a,h,c)=>{for(let f=l;fr,this.openMarks=o}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let s=e.parentNode;;s=s.parentNode){let r=te.get(s);if(s==this.view.contentDOM)break;r instanceof Ce?t.push(r):r?.isLine()?i=r:s.nodeName=="DIV"&&!i&&s!=this.view.contentDOM?i=new si(s,xh):t.push(Ce.of(new Gi({tagName:s.nodeName.toLowerCase(),attributes:Zf(s)}),s))}return{line:i,marks:t}}}function jo(n,e){let t=i=>{for(let s of i.children)if((e?s.isText():s.length)||t(s))return!0;return!1};return t(n)}function Mu(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const xh={class:"cm-line"};function Tu(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&Kr(t,n),i&&(n.class+=" "+i)),n}function Du(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof Ce&&e.push(i.mark)}return e}function ys(n){let e=te.get(n);return e&&e.setDOM(n.cloneNode()),n}class ri extends Ue{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}ri.inline=new ri("span");ri.block=new ri("div");const xs=new class extends Ue{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Uo{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=I.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new ts(e,e.contentDOM),this.updateInner([new Ne(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:c,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!Wu(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let r=s>-1?Bu(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:f}=this.hasComposition;i=new Ne(c,f,e.changes.mapPos(c,-1),e.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(T.ie||T.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=Pu(o,this.decorations,e.changes);a.length&&(i=Ne.extendWithRanges(i,a));let h=Iu(l,this.blockWrappers,e.changes);return h.length&&(i=Ne.extendWithRanges(i,h)),r&&!i.some(c=>c.fromA<=r.range.fromA&&c.toA>=r.range.toA)&&(i=r.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let o=this.tile,l=new Au(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=l.run(e,t),gr(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=T.chrome||T.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||i.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to-1)&&Mi(i,this.view.observer.selectionRange)&&!(s&&i.contains(s));if(!(r||t||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,h,c;if(a.empty?c=h=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),h=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),T.gecko&&a.empty&&!this.hasComposition&&Ou(h)){let u=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(u,h.node.childNodes[h.offset]||null)),h=c=new $e(u,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!Di(h.node,h.offset,f.anchorNode,f.anchorOffset)||!Di(c.node,c.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,a))&&(this.view.observer.ignore(()=>{T.android&&T.chrome&&i.contains(f.focusNode)&&Nu(f.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let u=ni(this.view.root);if(u)if(a.empty){if(T.gecko){let d=Lu(h.node,h.offset);if(d&&d!=3){let p=(d==1?Qa:Za)(h.node,h.offset);p&&(h=new $e(p.node,p.offset))}}u.collapse(h.node,h.offset),a.bidiLevel!=null&&u.caretBidiLevel!==void 0&&(u.caretBidiLevel=a.bidiLevel)}else if(u.extend){u.collapse(h.node,h.offset);try{u.extend(c.node,c.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([h,c]=[c,h]),d.setEnd(c.node,c.offset),d.setStart(h.node,h.offset),u.removeAllRanges(),u.addRange(d)}o&&this.view.root.activeElement==i&&(i.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(h,c)),this.impreciseAnchor=h.precise?null:new $e(f.anchorNode,f.anchorOffset),this.impreciseHead=c.precise?null:new $e(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Di(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=ni(e.root),{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(s,r)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let s=i.posAtStart;if(i.isComposite()){let r;if(e==i.dom)r=i.dom.childNodes[t];else{let o=ft(e)==0?0:t==0?-1:1;for(;;){let l=e.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?o=-1:o=1),e=l}o<0?r=e:r=e.nextSibling}if(r==i.dom.firstChild)return s;for(;r&&!te.get(r);)r=r.nextSibling;if(!r)return s+i.length;for(let o=0,l=s;;o++){let a=i.children[o];if(a.dom==r)return l;l+=a.length+a.breakAfter}}else return i.isText()?e==i.dom?s+t:s+(t?i.length:0):s}domAtPos(e,t){let{tile:i,offset:s}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(e,t):i.domIn(s,t)}inlineDOMNearPos(e,t){let i,s=-1,r=!1,o,l=-1,a=!1;return this.tile.blockTiles((h,c)=>{if(h.isWidget()){if(h.flags&32&&c>=e)return!0;h.flags&16&&(r=!0)}else{let f=c+h.length;if(c<=e&&(i=h,s=e-c,r=f=e&&!o&&(o=h,l=e-c,a=c>e),c>e&&o)return!0}}),!i&&!o?this.domAtPos(e,t):(r&&o?i=null:a&&i&&(o=null),i&&t<0||!o?i.domIn(s,t):o.domIn(l,t))}coordsAt(e,t){let{tile:i,offset:s}=this.tile.resolveBlock(e,t);return i.isWidget()?i.widget instanceof ws?null:i.coordsInWidget(s,t,!0):i.coordsIn(s,t)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function s(r,o){if(r.isComposite())for(let l of r.children){if(l.length>=o){let a=s(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(r.isText()&&oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==G.LTR,h=0,c=(f,u,d)=>{for(let p=0;ps);p++){let m=f.children[p],b=u+m.length,y=m.dom.getBoundingClientRect(),{height:k}=y;if(d&&!p&&(h+=y.top-d.top),m instanceof yt)b>i&&c(m,u,y);else if(u>=i&&(h>0&&t.push(-h),t.push(k+h),h=0,o)){let w=m.dom.lastChild,M=w?Ti(w):[];if(M.length){let v=M[M.length-1],C=a?v.right-y.left:y.right-v.left;C>l&&(l=C,this.minWidth=r,this.minWidthFrom=u,this.minWidthTo=b)}}d&&p==f.children.length-1&&(h+=d.bottom-y.bottom),u=b+m.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?G.RTL:G.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let c=Ti(h.dom);if(c.length!=1)return;l+=c[0].width,a=c[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(e)return e;let t=document.createElement("div"),i,s,r;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Ti(t.firstChild)[0];i=t.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,r=o&&o.height?o.height:i,t.remove()}),{lineHeight:i,charWidth:s,textHeight:r}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.view.state.doc.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(I.replace({widget:new ws(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return I.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Zn).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),i=!1,s=this.view.state.facet(Yr).map((r,o)=>{let l=typeof r=="function";return l&&(i=!0),l?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[e++]=i,t.push(F.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof r=="function"?r(this.view):r)}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(dh))try{if(h(this.view,e.range,e))return!0}catch(c){Ae(this.view.state,c,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=Xr(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;iu(this.view.scrollDOM,o,t.headi.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){gr(this.tile)}}function gr(n,e){let t=e?.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)gr(i,e)}}function Ou(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function wh(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=Qa(t.focusNode,t.focusOffset),s=Za(t.focusNode,t.focusOffset),r=i||s;if(s&&i&&s.node!=i.node){let l=te.get(s.node);if(!l||l.isText()&&l.text!=s.node.nodeValue)r=s;else if(n.docView.lastCompositionAfterCursor){let a=te.get(i.node);!a||a.isText()&&a.text!=i.node.nodeValue||(r=s)}}if(n.docView.lastCompositionAfterCursor=r!=i,!r)return null;let o=e-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function Bu(n,e,t){let i=wh(n,t);if(!i)return null;let{node:s,from:r,to:o}=i,l=s.nodeValue;if(/[\n\r]/.test(l)||n.state.doc.sliceString(i.from,i.to)!=l)return null;let a=e.invertedDesc;return{range:new Ne(a.mapPos(r),a.mapPos(o),r,o),text:s}}function Lu(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}class ws extends Ue{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Fu(n,e,t=1){let i=n.charCategorizer(e),s=n.doc.lineAt(e),r=e-s.from;if(s.length==0)return x.cursor(e);r==0?t=1:r==s.length&&(t=-1);let o=r,l=r;t<0?o=ce(s.text,r,!1):l=ce(s.text,r);let a=i(s.text.slice(o,l));for(;o>0;){let h=ce(s.text,o,!1);if(i(s.text.slice(h,o))!=a)break;o=h}for(;ln.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,a=Math.floor((s-t.top-(n.defaultLineHeight-l)*.5)/l);r+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+sr(o,r,n.state.tabSize)}function br(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let s;for(let r of i.type){if(r.from>e)break;if(!(r.toe)return r;(!s||r.type==fe.Text&&(s.type!=r.type||(t<0?r.frome)))&&(s=r)}}return s||i}return i}function Vu(n,e,t,i){let s=br(n,e.head,e.assoc||-1),r=!i||s.type!=fe.Text||!(n.lineWrapping||s.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(s.from),a=n.posAtCoords({x:t==(l==G.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return x.cursor(a,t?-1:1)}return x.cursor(t?s.to:s.from,t?-1:1)}function Go(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=e,a=null;;){let h=pu(s,r,o,l,t),c=sh;if(!h){if(s.number==(t?n.state.doc.lines:1))return l;c=` +`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),h=n.visualLineSide(s,!t)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function zu(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==Ie.Space&&(s=o),s==o}}function _u(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return x.cursor(s,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(s,e.assoc||-1),c=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let p=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(s-p.from))),l=(r<0?p.top:p.bottom)+c}let f=a.left+o,u=i??n.viewState.heightOracle.textHeight>>1,d=yr(n,{x:f,y:l+u*r},!1,r);return x.cursor(d.pos,d.assoc,void 0,o)}function Oi(n,e,t){for(;;){let i=0;for(let s of n)s.between(e-1,e+1,(r,o,l)=>{if(e>r&&es(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:x.cursor(i,in.viewState.docHeight)return new nt(n.state.doc.length,-1);if(h=n.elementAtHeight(a),i==null)break;if(h.type==fe.Text){let u=n.docView.coordsAt(i<0?h.from:h.to,i);if(u&&(i<0?u.top<=a+r:u.bottom>=a+r))break}let f=n.viewState.heightOracle.textHeight/2;a=i>0?h.bottom+f:h.top-f}if(n.viewport.from>=h.to||n.viewport.to<=h.from){if(t)return null;if(h.type==fe.Text){let f=Hu(n,s,h,o,l);return new nt(f,f==h.from?1:-1)}}if(h.type!=fe.Text)return a<(h.top+h.bottom)/2?new nt(h.from,1):new nt(h.to,-1);let c=n.docView.lineAt(h.from,2);return(!c||c.length!=h.length)&&(c=n.docView.lineAt(h.from,-2)),vh(n,c,h.from,o,l)}function vh(n,e,t,i,s){let r=-1,o=null,l=1e9,a=1e9,h=s,c=s,f=(u,d)=>{for(let p=0;pi?m.left-i:m.rights?m.top-s:m.bottom=h&&(h=Math.min(m.top,h),c=Math.max(m.bottom,c),y=0),(r<0||(y-a||b-l)<0)&&(r>=0&&a&&l=h+2?a=0:(r=d,l=b,a=y,o=m))}};if(e.isText()){for(let d=0;d(o.left+o.right)/2==(Jo(n,r+t)==G.LTR)?new nt(t+ce(e.text,r),-1):new nt(t+r,1)}else{if(!e.length)return new nt(t,1);for(let m=0;m(o.left+o.right)/2==(Jo(n,r+t)==G.LTR)?new nt(d+u.length,-1):new nt(d,1)}}function Jo(n,e){let t=n.state.doc.lineAt(e);return n.bidiSpans(t)[ht.find(n.bidiSpans(t),e-t.from,-1,1)].dir}const vi="￿";class qu{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(V.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=vi}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let s=e;;){this.findPointBefore(i,s);let r=this.text.length;this.readNode(s);let o=te.get(s),l=s.nextSibling;if(l==t){o?.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let a=te.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:Nn(s))||Nn(l)&&(s.nodeName!="BR"||o?.isWidget())&&this.text.length>r)&&!$u(l,t)&&this.lineBreak(),s=l}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(t))&&(r=l.index,o=l[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(e){let t=te.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(Ku(e,i.node,i.offset)?t:0))}}function Ku(n,e,t){for(;;){if(!e||t-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Sh(e.docView.tile,t,i,0))){let l=r||o?[]:Gu(e),a=new qu(l,e);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=Ju(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!fr(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!fr(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((T.ios||T.chrome)&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(x.range(h,a)):this.newSel=x.single(h,a)}}}function Sh(n,e,t,i){if(n.isComposite()){let s=-1,r=-1,o=-1,l=-1;for(let a=0,h=i,c=i;at)return Sh(f,e,t,h);if(u>=e&&s==-1&&(s=a,r=h),h>t&&f.dom.parentNode==n.dom){o=a,l=c;break}c=u,h=u+f.breakAfter}return{from:r,to:l<0?i+n.length:l,startDOM:(s?n.children[s-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o=0?n.children[o].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function Ch(n,e){let t,{newSel:i}=e,s=n.state.selection.main,r=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=s.from,h=null;(r===8||T.android&&e.text.length=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:n.state.doc.slice(s.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,s.to))}:n.state.doc.lineAt(s.from).toDate.now()-50?t={from:s.from,to:s.to,insert:n.state.toText(n.inputState.insertingText)}:T.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==` + `&&n.lineWrapping&&(i&&(i=x.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:z.of([" "])}),t)return Qr(n,t,i,r);if(i&&!Vn(i,s)){let o=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),l=n.inputState.lastSelectionOrigin,l=="select.pointer"&&(i=kh(n.state.facet(Yi).map(a=>a(n)),i))),n.dispatch({selection:i,scrollIntoView:o,userEvent:l}),!0}else return!1}function Qr(n,e,t,i=-1){if(T.ios&&n.inputState.flushIOSKey(e))return!0;let s=n.state.selection.main;if(T.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&n.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Qt(n.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||i==8&&e.insert.lengths.head)&&Qt(n.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Qt(n.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=Uu(n,e,t));return n.state.facet(hh).some(a=>a(n,e.from,e.to,r,l))||n.dispatch(l()),!0}function Uu(n,e,t){let i,s=n.state,r=s.selection.main,o=-1;if(e.from==e.to&&e.fromr.to){let a=e.fromf(n)),h,a);e.from==c&&(o=c)}if(o>-1)i={changes:e,selection:x.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=r.frome.to?s.sliceDoc(e.to,r.to):"";i=s.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let a=s.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(s.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let c=n.state.sliceDoc(e.from,e.to),f,u=t&&wh(n,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=n.state.doc.lineAt(r.head);let d=r.to-e.to;i=s.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:a,range:h||p.map(a)};let m=p.to-d,b=m-c.length;if(n.state.sliceDoc(b,m)!=c||m>=f.from&&b<=f.to)return{range:p};let y=s.changes({from:b,to:m,insert:e.insert}),k=p.to-r.to;return{changes:y,range:h?x.range(Math.max(0,h.anchor+k),Math.max(0,h.head+k)):p.map(y)}})}else i={changes:a,selection:h&&s.selection.replaceRange(h)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:l,scrollIntoView:!0})}function Ah(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Gu(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new Yo(t,i)),(s!=t||r!=i)&&e.push(new Yo(s,r))),e}function Ju(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?x.single(t+e,i+e):null}function Vn(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class Yu{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,T.safari&&e.contentDOM.addEventListener("input",()=>null),T.gecko&&fd(e.contentDOM.ownerDocument)}handleEvent(e){!sd(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let s of i.observers)s(this.view,t);for(let s of i.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Xu(e),i=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!t[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Th.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),T.android&&T.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return T.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Mh.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||Qu.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from0?!0:T.safari&&!T.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Xo(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(s){Ae(t.state,s)}}}function Xu(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let s=i.spec,r=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(r)for(let l in r){let a=r[l];a&&t(l).handlers.push(Xo(i.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(Xo(i.value,a))}}for(let i in je)t(i).handlers.push(je[i]);for(let i in ze)t(i).observers.push(ze[i]);return e}const Mh=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Qu="dthko",Th=[16,17,18,20,91,92,224,225],ln=6;function an(n){return Math.max(0,n)*.7+8}function Zu(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class ed{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=nu(e.contentDOM),this.atoms=e.state.facet(Yi).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(V.allowMultipleSelections)&&td(e,t),this.dragging=nd(e,t)&&Bh(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Zu(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,s=0,r=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Xr(this.view);e.clientX-a.left<=s+ln?t=-an(s-e.clientX):e.clientX+a.right>=o-ln&&(t=an(e.clientX-o)),e.clientY-a.top<=r+ln?i=-an(r-e.clientY):e.clientY+a.bottom>=l-ln&&(i=an(e.clientY-l)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=kh(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function td(n,e){let t=n.state.facet(rh);return t.length?t[0](e):T.mac?e.metaKey:e.ctrlKey}function id(n,e){let t=n.state.facet(oh);return t.length?t[0](e):T.mac?!e.altKey:!e.ctrlKey}function nd(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=ni(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function sd(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=te.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const je=Object.create(null),ze=Object.create(null),Dh=T.ie&&T.ie_version<15||T.ios&&T.webkit_version<604;function rd(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Oh(n,t.value)},50)}function is(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function Oh(n,e){e=is(n.state,Ur,e);let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(xr!=null&&t.selection.ranges.every(a=>a.empty)&&xr==r.toString()){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:x.cursor(h.from+f.length)}})}else o?i=t.changeByRange(a=>{let h=r.line(s++);return{changes:{from:a.from,to:a.to,insert:h.text},range:x.cursor(a.from+h.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}ze.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};je.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);ze.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};ze.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};je.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(lh))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=ld(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new ed(n,e,t,i)),i&&n.observer.ignore(()=>{Ya(n.contentDOM);let r=n.root.activeElement;r&&!r.contains(n.contentDOM)&&r.blur()});let s=n.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function Qo(n,e,t,i){if(i==1)return x.cursor(e,t);if(i==2)return Fu(n.state,e,t);{let s=n.docView.lineAt(e,t),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return lDate.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(el+1)%3:1}function ld(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=Bh(e),s=n.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,l){let a=n.posAndSideAtCoords({x:r.clientX,y:r.clientY},!1),h,c=Qo(n,a.pos,a.assoc,i);if(t.pos!=a.pos&&!o){let f=Qo(n,t.pos,t.assoc,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u1&&(h=ad(s,a.pos))?h:l?s.addRange(c):x.create([c])}}}function ad(n,e){for(let t=0;t=e)return x.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}je.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let s=n.docView.tile.nearest(e.target);if(s&&s.isWidget()){let r=s.posAtStart,o=r+s.length;(r>=t.to||o<=t.from)&&(t=x.range(r,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",is(n.state,Gr,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};je.dragend=n=>(n.inputState.draggedContent=null,!1);function il(n,e,t,i){if(t=is(n.state,Ur,t),!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=n.inputState,o=i&&r&&id(n,e)?{from:r.from,to:r.to}:null,l={from:s,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}je.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),s=0,r=()=>{++s==t.length&&il(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return il(n,e,i,!0),!0}return!1};je.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=Dh?null:e.clipboardData;return t?(Oh(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(rd(n),!1)};function hd(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function cd(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:is(n,Gr,e.join(n.lineBreak)),ranges:t,linewise:i}}let xr=null;je.copy=je.cut=(n,e)=>{let t=ni(n.root);if(t&&!Mi(n.contentDOM,t))return!1;let{text:i,ranges:s,linewise:r}=cd(n.state);if(!i&&!r)return!1;xr=r?i:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});let o=Dh?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",i),!0):(hd(n,i),!1)};const Lh=ut.define();function Eh(n,e){let t=[];for(let i of n.facet(ch)){let s=i(n,e);s&&t.push(s)}return t.length?n.update({effects:t,annotations:Lh.of(!0)}):null}function Ph(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=Eh(n.state,e);t?n.dispatch(t):n.update([])}},10)}ze.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),Ph(n)};ze.blur=n=>{n.observer.clearSelectionRange(),Ph(n)};ze.compositionstart=ze.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};ze.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,T.chrome&&T.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};ze.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};je.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(r&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),h=n.posAtDOM(l.endContainer,l.endOffset);return Qr(n,{from:a,to:h,insert:n.state.toText(r)},null),!0}}let s;if(T.chrome&&T.android&&(s=Mh.find(r=>r.inputType==e.inputType))&&(n.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return T.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),T.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>ze.compositionend(n,e),20),!1};const nl=new Set;function fd(n){nl.has(n)||(nl.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const sl=["pre-wrap","normal","pre-line","break-spaces"];let oi=!1;function rl(){oi=!1}class ud{constructor(e){this.lineWrapping=e,this.doc=z.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return sl.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(i-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=s,this.lineLength=r,a){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>On&&(oi=!0),this.height=e)}replace(e,t,i){return we.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=s[l],u=r.lineAt(a,Y.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:r.lineAt(h,Y.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=s[l-1].toA;)a=s[l-1].fromA,c=s[l-1].fromB,l--,ar*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.lineAt(0,Y.ByPos,i,s,r))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Oe extends Rh{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Ke(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof Oe||s instanceof le&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof le?s=new Oe(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):we.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setMeasuredHeight(s):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class le extends we{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,s);if(t.lineWrapping){let h=s+(e0){let r=i[i.length-1];r instanceof le?i[i.length-1]=new le(r.length+s):i.push(null,new le(s-1))}if(e>0){let r=i[0];r instanceof le?i[0]=new le(e+r.length):i.unshift(new le(e-1),null)}return we.of(i)}decomposeLeft(e,t){t.push(new le(e-1),null)}decomposeRight(e,t){t.push(null,new le(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),a=-1;for(s.from>t&&o.push(new le(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++],u=0;f<0&&(u=-f,f=s.heights[s.index++]),a==-1?a=f:Math.abs(f-a)>=On&&(a=-2);let d=new Oe(c,f,u);d.outdated=!1,o.push(d),l+=c+1}l<=r&&o.push(null,new le(r-l).updateHeight(e,l));let h=we.of(o);return(a<0||Math.abs(h.height-this.height)>=On||Math.abs(a-this.heightMetrics(e,t).perLine)>=On)&&(oi=!0),zn(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class md extends we{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return h;let c=t==Y.ByPosNoHeight?Y.ByPosNoHeight:Y.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(h)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,Y.ByPos,i,s,r);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&ol(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?we.of(this.break?[e,null,t]:[e,t]):(this.left=zn(this.left,e),this.right=zn(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return s&&s.from<=t+r.length&&s.more?a=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?a=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function ol(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof le&&(i=n[e+1])instanceof le&&n.splice(e-1,3,new le(t.length+1+i.length))}const gd=5;class Zr{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Oe?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Oe(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=gd)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Oe(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new le(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Oe)return e;let t=new Oe(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Oe)&&!this.isCovered?this.nodes.push(new Oe(0,-1,0)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=Math.min(h==n.parentNode?s.innerHeight:a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function wd(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left0&&e.top0}function kd(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class vs{constructor(e,t,i,s){this.from=e,this.to=t,this.size=i,this.displaySize=s}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new ud(t),this.stateDeco=hl(e),this.heightMap=we.empty().applyChanges(this.stateDeco,z.empty,this.heightOracle.setDoc(e.doc),[new Ne(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=I.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new hn(r,o))}}return this.viewports=e.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?al:new eo(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Si(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=hl(this.state);let s=e.changedRanges,r=Ne.extendWithRanges(s,bd(i,this.stateDeco,e?e.changes:ie.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);rl(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||oi)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(uh)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?G.RTL:G.LTR;let o=this.heightOracle.mustRefreshForWrapping(r)||this.mustMeasureContent,l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:M,scaleY:v}=Ja(t,l);(M>.005&&Math.abs(this.scaleX-M)>.005||v>.005&&Math.abs(this.scaleY-v)>.005)&&(this.scaleX=M,this.scaleY=v,h|=16,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Xa(e.scrollDOM);let p=(this.printing?kd:xd)(t,this.paddingTop),m=p.top-this.pixelViewport.top,b=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(a=!0)),!this.inView&&!this.scrollTarget&&!wd(e.dom))return 0;let k=l.width;if((this.contentDOMWidth!=k||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),a){let M=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(M)&&(o=!0),o||s.lineWrapping&&Math.abs(k-this.contentDOMWidth)>s.charWidth){let{lineHeight:v,charWidth:C,textHeight:S}=e.docView.measureTextSize();o=v>0&&s.refresh(r,v,C,S,Math.max(5,k/C),M),o&&(e.docView.minWidth=0,h|=16)}m>0&&b>0?c=Math.max(m,b):m<0&&b<0&&(c=Math.min(m,b)),rl();for(let v of this.viewports){let C=v.from==this.viewport.from?M:e.docView.measureVisibleLineHeights(v);this.heightMap=(o?we.empty().applyChanges(this.stateDeco,z.empty,this.heightOracle,[new Ne(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new dd(v.from,C))}oi&&(h|=2)}let w=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return w&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||w)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new hn(s.lineAt(o-i*1e3,Y.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,Y.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,Y.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=G.LTR&&!i)return[];let l=[],a=(c,f,u,d)=>{if(f-cc&&yy.from>=u.from&&y.to<=u.to&&Math.abs(y.from-c)y.fromk));if(!b){if(fw.from<=f&&w.to>=f)){let w=t.moveToLineBoundary(x.cursor(f),!1,!0).head;w>c&&(f=w)}let y=this.gapSize(u,c,f,d),k=i||y<2e6?y:2e6;b=new vs(c,f,y,k)}l.push(b)},h=c=>{if(c.length2e6)for(let C of e)C.from>=c.from&&C.fromc.from&&a(c.from,d,c,f),pt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];F.spans(t,this.viewport.from,this.viewport.to,{span(r,o){i.push({from:r,to:o})},point(){}},20);let s=0;if(i.length!=this.visibleRanges.length)s=12;else for(let r=0;r=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Si(this.heightMap.lineAt(e,Y.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Si(this.heightMap.lineAt(this.scaler.fromDOM(e),Y.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Si(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class hn{constructor(e,t){this.from=e,this.to=t}}function Sd(n,e,t){let i=[],s=n,r=0;return F.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function fn(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function Cd(n,e){for(let t of n)if(e(t))return t}const al={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function hl(n){let e=n.facet(Zn).filter(i=>typeof i!="function"),t=n.facet(Yr).filter(i=>typeof i!="function");return t.length&&e.push(F.join(t)),e}class eo{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,Y.ByPos,e,0,0).top,c=t.lineAt(a,Y.ByPos,e,0,0).bottom;return s+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Si(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Ke(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(s=>Si(s,e)):n._content)}const un=O.define({combine:n=>n.join(" ")}),wr=O.define({combine:n=>n.indexOf(!0)>-1}),kr=kt.newName(),Ih=kt.newName(),Nh=kt.newName(),Wh={"&light":"."+Ih,"&dark":"."+Nh};function vr(n,e,t){return new kt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const Ad=vr("."+kr,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Wh),Md={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Ss=T.ie&&T.ie_version<=11;class Td{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new su,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(T.ie&&T.ie_version<=11||T.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&T.android&&e.constructor.EDIT_CONTEXT!==!1&&!(T.chrome&&T.chrome_version<126)&&(this.editContext=new Od(e),e.state.facet(at)&&(e.contentDOM.editContext=this.editContext.editContext)),Ss&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(at)?i.root.activeElement!=this.dom:!Mi(this.dom,s))return;let r=s.anchorNode&&i.docView.tile.nearest(s.anchorNode);if(r&&r.isWidget()&&r.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(T.ie&&T.ie_version<=11||T.android&&T.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Di(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ni(e.root);if(!t)return!1;let i=T.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Dd(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let s=Mi(this.dom,i);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&Qt(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&Mi(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new ju(this.view,e,t,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,s=Ch(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!Vn(this.view.state.selection,t.newSel.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=cl(t,e.previousSibling||e.target.previousSibling,-1),s=cl(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(at)!=e.state.facet(at)&&(e.view.contentDOM.editContext=e.state.facet(at)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function cl(n,e,t){for(;e;){let i=te.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function fl(n,e){let t=e.startContainer,i=e.startOffset,s=e.endContainer,r=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return Di(o.node,o.offset,s,r)&&([t,i,s,r]=[s,r,t,i]),{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}}function Dd(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return fl(n,s)}let t=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?fl(n,t):null}class Od{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let s=e.state.selection.main,{anchor:r,head:o}=s,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let h=a-l>i.text.length;l==this.from&&rthis.to&&(a=r);let c=Ah(e.state.sliceDoc(l,a),i.text,(h?s.from:s.to)-l,h?"end":null);if(!c){let u=x.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Vn(u,s)||e.dispatch({selection:u,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:z.of(i.text.slice(c.from,c.toB).split(` +`))};if((T.mac||T.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:z.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);Qr(e,f,x.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let s=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{let s=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(a{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=ni(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,s=this.pendingContextChange;return e.changes.iterChanges((r,o,l,a,h)=>{if(i)return;let c=h.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,t+=c,this.to+=c;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(rthis.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),s&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class D{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(s=>s.forEach(r=>i(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||ru(e.parent)||document,this.viewState=new ll(e.state||V.create(e)),e.scrollTo&&e.scrollTo.is(on)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(jt).map(s=>new bs(s));for(let s of this.plugins)s.update(this);this.observer=new Td(this),this.inputState=new Yu(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Uo(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=!0,this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof Z?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(Lh))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Eh(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(V.phrases)!=this.state.facet(V.phrases))return this.setState(r);s=Wn.create(this,r,e),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;f=new Zt(d.empty?d:x.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(on)&&(f=d.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=_n.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(ki)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(un)!=s.state.facet(un)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let u of this.state.facet(mr))try{u(s)}catch(d){Ae(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Ch(this,c)&&h.force&&Qt(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new ll(e),this.plugins=e.facet(jt).map(i=>new bs(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Uo(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(jt),i=e.state.facet(jt);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new bs(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,s=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Xa(i))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(s);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(d=>{try{return d.read(this)}catch(p){return Ae(this.state,p),ul}}),f=Wn.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let d=0;d1||p<-1){s=s+p,i.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(mr))l(t)}get themeClasses(){return kr+" "+(this.state.facet(wr)?Nh:Ih)+" "+this.state.facet(un)}updateAttrs(){let e=dl(this,mh,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(at)?"true":"false",class:"cm-content",style:`${T.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),dl(this,Jr,t);let i=this.observer.ignore(()=>{let s=zo(this.contentDOM,this.contentAttrs,t),r=zo(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(D.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(ki);let e=this.state.facet(D.cspNonce);kt.mount(this.root,this.styleModules.concat(Ad).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return ks(this,e,Go(this,e,t,i))}moveByGroup(e,t){return ks(this,e,Go(this,e,t,i=>zu(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=i[t?i.length-1:0];return x.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,i=!0){return Vu(this,e,t,i)}moveVertically(e,t,i){return ks(this,e,_u(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=yr(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),yr(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[ht.find(r,e-s.from,-1,t)];return Ni(i,o.dir==G.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(fh)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Bd)return nh(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||ih(r.isolates,i=Ko(this,e))))return r.order;i||(i=Ko(this,e));let s=du(e.text,t,i);return this.bidiCache.push(new _n(e.from,e.to,t,i,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||T.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ya(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return on.of(new Zt(typeof e=="number"?x.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return on.of(new Zt(x.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return ue.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ue.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=kt.newName(),s=[un.of(i),ki.of(vr(`.${i}`,e))];return t&&t.dark&&s.push(wr.of(!0)),s}static baseTheme(e){return qt.lowest(ki.of(vr("."+kr,e,Wh)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&te.get(i)||te.get(e);return((t=s?.root)===null||t===void 0?void 0:t.view)||null}}D.styleModule=ki;D.inputHandler=hh;D.clipboardInputFilter=Ur;D.clipboardOutputFilter=Gr;D.scrollHandler=dh;D.focusChangeEffect=ch;D.perLineTextDirection=fh;D.exceptionSink=ah;D.updateListener=mr;D.editable=at;D.mouseSelectionStyle=lh;D.dragMovesSelection=oh;D.clickAddsSelectionRange=rh;D.decorations=Zn;D.blockWrappers=gh;D.outerDecorations=Yr;D.atomicRanges=Yi;D.bidiIsolatedRanges=bh;D.scrollMargins=yh;D.darkTheme=wr;D.cspNonce=O.define({combine:n=>n.length?n[0]:""});D.contentAttributes=Jr;D.editorAttributes=mh;D.lineWrapping=D.contentAttributes.of({class:"cm-lineWrapping"});D.announce=R.define();const Bd=4096,ul={};class _n{constructor(e,t,i,s,r,o){this.from=e,this.to=t,this.dir=i,this.isolates=s,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],s=e.length?e[e.length-1].dir:G.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&Kr(o,t)}return t}const Ld=T.mac?"mac":T.windows?"win":T.linux?"linux":"key";function Ed(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let a=0;ai.concat(s),[]))),t}let gt=null;const Id=4e3;function Nd(n,e=Ld){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(y=>Ed(y,e));for(let y=1;y{let M=gt={view:w,prefix:k,scope:o};return setTimeout(()=>{gt==M&&(gt=null)},Id),!0}]})}let m=p.join(" ");s(m,!1);let b=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&b.run.push(a),h&&(b.preventDefault=!0),c&&(b.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let u in c)c[u].run.push(d=>f(d,Sr))}let a=o[e]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let Sr=null;function Wd(n,e,t,i){Sr=e;let s=Yf(e),r=Be(s,0),o=lt(r)==s.length&&s!=" ",l="",a=!1,h=!1,c=!1;gt&>.view==t&>.scope==i&&(l=gt.prefix+" ",Th.indexOf(e.keyCode)<0&&(h=!0,gt=null));let f=new Set,u=b=>{if(b){for(let y of b.run)if(!f.has(y)&&(f.add(y),y(t)))return b.stopPropagation&&(c=!0),!0;b.preventDefault&&(b.stopPropagation&&(c=!0),h=!0)}return!1},d=n[i],p,m;return d&&(u(d[l+dn(s,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(T.windows&&e.ctrlKey&&e.altKey)&&!(T.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=vt[e.keyCode])&&p!=s?(u(d[l+dn(p,e,!0)])||e.shiftKey&&(m=Ri[e.keyCode])!=s&&m!=p&&u(d[l+dn(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(d[l+dn(s,e,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),Sr=null,a}class Qi{constructor(e,t,i,s,r){this.className=e,this.left=t,this.top=i,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let s=e.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let r=Fh(e);return[new Qi(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return Fd(e,t,i)}}function Fh(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==G.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function ml(n,e,t,i){let s=n.coordsAtPos(e,t*2);if(!s)return i;let r=n.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,l=n.posAtCoords({x:r.left+1,y:o}),a=n.posAtCoords({x:r.right-1,y:o});return l==null||a==null?i:{from:Math.max(i.from,Math.min(l,a)),to:Math.min(i.to,Math.max(l,a))}}function Fd(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),s=Math.min(t.to,n.viewport.to),r=n.textDirection==G.LTR,o=n.contentDOM,l=o.getBoundingClientRect(),a=Fh(n),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),d=br(n,i,1),p=br(n,s,-1),m=d.type==fe.Text?d:null,b=p.type==fe.Text?p:null;if(m&&(n.lineWrapping||d.widgetLineBreaks)&&(m=ml(n,i,1,m)),b&&(n.lineWrapping||p.widgetLineBreaks)&&(b=ml(n,s,-1,b)),m&&b&&m.from==b.from&&m.to==b.to)return k(w(t.from,t.to,m));{let v=m?w(t.from,null,m):M(d,!1),C=b?w(null,t.to,b):M(p,!0),S=[];return(m||d).to<(b||p).from-(m&&b?1:0)||d.widgetLineBreaks>1&&v.bottom+n.defaultLineHeight/2B&&H.from<_)for(let K=Math.max(H.from,B),oe=Math.min(H.to,_);;){let be=n.state.doc.lineAt(K);for(let ve of n.bidiSpans(be)){let ee=ve.from+be.from,E=ve.to+be.from;if(ee>=oe)break;E>K&&P(Math.max(ee,K),v==null&&ee<=B,Math.min(E,oe),C==null&&E>=_,ve.dir)}if(K=be.to+1,K>=oe)break}return q.length==0&&P(B,v==null,_,C==null,n.textDirection),{top:L,bottom:W,horizontal:q}}function M(v,C){let S=l.top+(C?v.top:v.bottom);return{top:S,bottom:S,horizontal:[]}}}function Hd(n,e){return n.constructor==e.constructor&&n.eq(e)}class Vd{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Bn)!=e.state.facet(Bn)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(Bn);for(;t!Hd(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[i].constructor&&s.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e,T.safari&&T.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Bn=O.define();function Hh(n){return[ue.define(e=>new Vd(e,n)),Bn.of(n)]}const Fi=O.define({combine(n){return Kt(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function zd(n={}){return[Fi.of(n),_d,qd,Kd,uh.of(!0)]}function Vh(n){return n.startState.facet(Fi)!=n.state.facet(Fi)}const _d=Hh({above:!0,markers(n){let{state:e}=n,t=e.facet(Fi),i=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty||t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:x.cursor(s.head,s.head>s.anchor?-1:1);for(let a of Qi.forRange(n,o,l))i.push(a)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Vh(n);return t&&gl(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){gl(e.state,n)},class:"cm-cursorLayer"});function gl(n,e){e.style.animationDuration=n.facet(Fi).cursorBlinkRate+"ms"}const qd=Hh({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:Qi.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||Vh(n)},class:"cm-selectionLayer"}),Kd=qt.highest(D.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));function bl(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,l)}function $d(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class jd{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(l,a,h,c)=>s(c,h,h+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,h,c)=>{let f=i(l,a,h);f&&c(h,h+l[0].length,f)};else if(i)this.addMatch=(l,a,h,c)=>c(h,h+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new wt,i=t.add.bind(t);for(let{from:s,to:r}of $d(e,this.maxLength))bl(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(i=Math.min(l,i),s=Math.max(a,s))}),e.viewportMoved||s-i>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>=o){let a=e.state.doc.lineAt(o),h=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lu.push(y.range(m,b));if(a==h)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(b,e,m,p));t=t.update({filterFrom:c,filterTo:f,filter:(m,b)=>mf,add:u})}}return t}}const Cr=/x/.unicode!=null?"gu":"g",Ud=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Cr),Gd={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Cs=null;function Jd(){var n;if(Cs==null&&typeof document<"u"&&document.body){let e=document.body.style;Cs=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Cs||!1}const Ln=O.define({combine(n){let e=Kt(n,{render:null,specialChars:Ud,addSpecialChars:null});return(e.replaceTabs=!Jd())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Cr)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Cr)),e}});function Yd(n={}){return[Ln.of(n),Xd()]}let yl=null;function Xd(){return yl||(yl=ue.fromClass(class{constructor(n){this.view=n,this.decorations=I.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Ln)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new jd({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=Be(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,a=ci(o.text,l,i-o.from);return I.replace({widget:new tp((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=I.replace({widget:new ep(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Ln);n.startState.facet(Ln)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Qd="•";function Zd(n){return n>=32?Qd:n==10?"␤":String.fromCharCode(9216+n)}class ep extends Ue{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Zd(this.code),i=e.state.phrase("Control character")+" "+(Gd[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class tp extends Ue{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}class ip extends Ue{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Ti(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),s=Ni(t[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function np(n){let e=ue.fromClass(class{constructor(t){this.view=t,this.placeholder=n?I.set([I.widget({widget:new ip(n),side:1}).range(0)]):I.none}get decorations(){return this.view.state.doc.length?I.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,D.contentAttributes.of({"aria-placeholder":n})]:e}const Ar=2e3;function sp(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>Ar||t.off>Ar||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=s;a++){let h=n.doc.line(a);h.length<=l&&r.push(x.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=s;a++){let h=n.doc.line(a),c=sr(h.text,o,n.tabSize,!0);if(c<0)r.push(x.cursor(h.to));else{let f=sr(h.text,l,n.tabSize);r.push(x.range(h.from+c,h.from+f))}}}return r}function rp(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function xl(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>Ar?-1:s==i.length?rp(n,e.clientX):ci(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function op(n,e){let t=xl(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=xl(n,s);if(!l)return i;let a=sp(n.state,t,l);return a.length?o?x.create(a.concat(i.ranges)):x.create(a):i}}:null}function lp(n){let e=(t=>t.altKey&&t.button==0);return D.mouseSelectionStyle.of((t,i)=>e(i)?op(t,i):null)}const ap={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},hp={style:"cursor: crosshair"};function cp(n={}){let[e,t]=ap[n.key||"Alt"],i=ue.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[i,D.contentAttributes.of(s=>{var r;return!((r=s.plugin(i))===null||r===void 0)&&r.isDown?hp:null})]}const pn="-10000px";class zh{constructor(e,t,i,s){this.facet=t,this.createTooltipView=i,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(e,t){var i;let s=e.state.facet(this.facet),r=s.filter(a=>a);if(s===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[h]=a),t.length=l.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function fp(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const As=O.define({combine:n=>{var e,t,i;return{position:T.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||fp}}}),wl=new WeakMap,to=ue.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(As);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new zh(n,io,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(As);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=pn,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(T.safari){let o=r.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(n=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),s=Xr(this.view);return{visible:{left:i.left+s.left,top:i.top+s.top,right:i.right-s.right,bottom:i.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(As).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:t,space:i,scaleX:s,scaleY:r}=n,o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1)){c.style.top=pn;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=u.right-u.left,b=(e=wl.get(h))!==null&&e!==void 0?e:u.bottom-u.top,y=h.offset||dp,k=this.view.textDirection==G.LTR,w=u.width>i.right-i.left?k?i.left:i.right-u.width:k?Math.max(i.left,Math.min(f.left-(d?14:0)+y.x,i.right-m)):Math.min(Math.max(i.left,f.left-m+(d?14:0)-y.x),i.right-m),M=this.above[l];!a.strictSide&&(M?f.top-b-p-y.yi.bottom)&&M==i.bottom-f.bottom>f.top-i.top&&(M=this.above[l]=!M);let v=(M?f.top-i.top:i.bottom-f.bottom)-p;if(vw&&L.topC&&(C=M?L.top-b-2-p:L.bottom+p+2);if(this.position=="absolute"?(c.style.top=(C-n.parent.top)/r+"px",kl(c,(w-n.parent.left)/s)):(c.style.top=C/r+"px",kl(c,w/s)),d){let L=f.left+(k?y.x:-y.x)-(w+14-7);d.style.left=L/s+"px"}h.overlap!==!0&&o.push({left:w,top:C,right:S,bottom:C+b}),c.classList.toggle("cm-tooltip-above",M),c.classList.toggle("cm-tooltip-below",!M),h.positioned&&h.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=pn}},{eventObservers:{scroll(){this.maybeMeasure()}}});function kl(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const up=D.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),dp={x:0,y:0},io=O.define({enables:[to,up]}),qn=O.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class ns{static create(e){return new ns(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new zh(e,qn,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let s=i[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const pp=io.compute([qn],n=>{let e=n.facet(qn);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:ns.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class mp{constructor(e,t,i,s,r){this.view=e,this.source=t,this.field=i,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;el.bottom||t.xl.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(s)).find(c=>c.from<=s&&c.to>=s),h=a&&a.dir==G.RTL?-1:1;r=t.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Ae(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(to),t=e?e.manager.tooltips.findIndex(i=>i.create==ns.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&r&&!gp(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!bp(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const mn=4;function gp(n,e){let{left:t,right:i,top:s,bottom:r}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();s=Math.min(l.top,s),r=Math.max(l.bottom,r)}return e.clientX>=t-mn&&e.clientX<=i+mn&&e.clientY>=s-mn&&e.clientY<=r+mn}function bp(n,e,t,i,s,r){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.rights||Math.min(o.bottom,l)=e&&a<=t}function yp(n,e={}){let t=R.define(),i=Te.define({create(){return[]},update(s,r){if(s.length&&(e.hideOnChange&&(r.docChanged||r.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(r,o))),r.docChanged)){let o=[];for(let l of s){let a=r.changes.mapPos(l.pos,-1,he.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=r.changes.mapPos(h.end)),o.push(h)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(xp)&&(s=[]);return s},provide:s=>qn.from(s)});return{active:i,extension:[i,ue.define(s=>new mp(s,n,i,t,e.hoverTime||300)),pp]}}function _h(n,e){let t=n.plugin(to);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const xp=R.define(),vl=O.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function wp(n,e){let t=n.plugin(qh),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const qh=ue.fromClass(class{constructor(n){this.input=n.state.facet(Mr),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(vl);this.top=new gn(n,!0,e.topContainer),this.bottom=new gn(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(vl);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new gn(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new gn(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Mr);if(t!=this.input){let i=t.filter(a=>a),s=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(n.view),l.push(c)):(c=this.panels[h],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>D.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class gn{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Sl(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Sl(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Sl(n){let e=n.nextSibling;return n.remove(),e}const Mr=O.define({enables:qh});class Ct extends xt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ct.prototype.elementClass="";Ct.prototype.toDOM=void 0;Ct.prototype.mapMode=he.TrackBefore;Ct.prototype.startSide=Ct.prototype.endSide=-1;Ct.prototype.point=!0;const Ms=O.define(),kp=O.define(),vp={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>F.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Bi=O.define();function Sp(n){return[Kh(),Bi.of({...vp,...n})]}const Cl=O.define({combine:n=>n.some(e=>e)});function Kh(n){return[Cp]}const Cp=ue.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(Bi).map(e=>new Ml(n,e)),this.fixed=!n.state.facet(Cl);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Cl)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=F.iter(this.view.state.facet(Ms),this.view.viewport.from),i=[],s=this.gutters.map(r=>new Ap(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let l of r.type)if(l.type==fe.Text&&o){Tr(t,i,l.from);for(let a of s)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of s)a.widget(this.view,l)}else if(r.type==fe.Text){Tr(t,i,r.from);for(let o of s)o.line(this.view,r,i)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Bi),t=n.state.facet(Bi),i=n.docChanged||n.heightChanged||n.viewportChanged||!F.eq(n.startState.facet(Ms),n.state.facet(Ms),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(n)&&(i=!0);else{i=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new Ml(this.view,r)):(this.gutters[o].update(n),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>D.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,s=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==G.LTR?{left:i,right:s}:{right:i,left:s}})});function Al(n){return Array.isArray(n)?n:[n]}function Tr(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class Ap{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=F.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let l=new $h(e,o,r,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,o,r,i);this.height=t.bottom,this.i++}line(e,t,i){let s=[];Tr(this.cursor,s,t.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),s=i?[i]:null;for(let r of e.state.facet(kp)){let o=r(e,t.widget,t);o&&(s||(s=[])).push(o)}s&&this.addElement(e,t,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Ml{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=s.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,s)&&s.preventDefault()});this.markers=Al(t.markers(e)),t.initialSpacer&&(this.spacer=new $h(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Al(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!F.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class $h{constructor(e,t,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,s)}update(e,t,i,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),Mp(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=rr(l,a,h)||o(l,a,h):o}return i}})}});class Ts extends Ct{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ds(n,e){return n.state.facet(Ut).formatNumber(e,n.state)}const Op=Bi.compute([Ut],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Tp)},lineMarker(e,t,i){return i.some(s=>s.toDOM)?null:new Ts(Ds(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let s of e.state.facet(Dp)){let r=s(e,t,i);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(Ut)!=e.state.facet(Ut),initialSpacer(e){return new Ts(Ds(e,Tl(e.state.doc.lines)))},updateSpacer(e,t){let i=Ds(t.view,Tl(t.view.state.doc.lines));return i==e.number?e:new Ts(i)},domEventHandlers:n.facet(Ut).domEventHandlers,side:"before"}));function Bp(n={}){return[Ut.of(n),Kh(),Op]}function Tl(n){let e=9;for(;e{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ke.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}N.closedBy=new N({deserialize:n=>n.split(" ")});N.openedBy=new N({deserialize:n=>n.split(" ")});N.group=new N({deserialize:n=>n.split(" ")});N.isolate=new N({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});N.contextHash=new N({perNode:!0});N.lookAhead=new N({perNode:!0});N.mounted=new N({perNode:!0});class ei{constructor(e,t,i,s=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=s}static get(e){return e&&e.props&&e.props[N.mounted.id]}}const Pp=Object.create(null);class ke{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Pp,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new ke(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(N.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(N.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}ke.none=new ke("",Object.create(null),0,8);class no{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|U.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=s&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:oo(ke.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new J(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new J(ke.none,t,i,s)))}static build(e){return Wp(e)}}J.empty=new J(ke.none,[],[],0);class so{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new so(this.buffer,this.index)}}class At{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return ke.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,i){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Hi(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?a.length:-1;e!=c;e+=t){let f=a[e],u=h[e]+l.from;if(!(!(r&U.EnterBracketed&&f instanceof J&&((o=ei.get(f))===null||o===void 0?void 0:o.overlay)===null&&(u>=i||u+f.length<=i))&&!jh(s,i,u,u+f.length))){if(f instanceof At){if(r&U.ExcludeBuffers)continue;let d=f.findChild(0,f.buffer.length,t,i-u,s);if(d>-1)return new st(new Rp(l,f,e,u),null,d)}else if(r&U.IncludeAnonymous||!f.type.isAnonymous||ro(f)){let d;if(!(r&U.IgnoreMounts)&&(d=ei.get(f))&&!d.overlay)return new me(d.tree,u,e,l);let p=new me(f,u,e,l);return r&U.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?f.children.length-1:0,t,i,s,r)}}}if(r&U.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+t:e=t<0?-1:l._parent._tree.children.length,l=l._parent,!l))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let s;if(!(i&U.IgnoreOverlays)&&(s=ei.get(this._tree))&&s.overlay){let r=e-this.from,o=i&U.EnterBracketed&&s.bracketed;for(let{from:l,to:a}of s.overlay)if((t>0||o?l<=r:l=r:a>r))return new me(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Ol(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function Dr(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Rp{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class st extends Uh{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new st(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&U.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new st(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new st(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new st(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1];e.push(i.slice(s,r,o)),t.push(0)}return new J(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Gh(n){if(!n.length)return null;let e=0,t=n[0];for(let r=1;rt.from||o.to=e){let l=new me(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[i])).push(Hi(l,e,t,!1))}}return s?Gh(s):i}class Kn{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~U.EnterBracketed,e instanceof me)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof me?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&U.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&U.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&U.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&U.IncludeAnonymous||l instanceof At||!l.type.isAnonymous||ro(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}for(let s=i;s=0;r--){if(r<0)return Dr(this._tree,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function ro(n){return n.children.some(e=>e instanceof At||!e.type.isAnonymous||ro(e))}function Wp(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Lp,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new so(t,t.length):t,a=i.types,h=0,c=0;function f(v,C,S,L,W,q){let{id:P,start:B,end:_,size:H}=l,K=c,oe=h;if(H<0)if(l.next(),H==-1){let X=r[P];S.push(X),L.push(B-v);return}else if(H==-3){h=P;return}else if(H==-4){c=P;return}else throw new RangeError(`Unrecognized record size: ${H}`);let be=a[P],ve,ee,E=B-v;if(_-B<=s&&(ee=b(l.pos-C,W))){let X=new Uint16Array(ee.size-ee.skip),$=l.pos-ee.size,ne=X.length;for(;l.pos>$;)ne=y(ee.start,X,ne);ve=new At(X,_-ee.start,i),E=ee.start-v}else{let X=l.pos-H;l.next();let $=[],ne=[],De=P>=o?P:-1,dt=0,ye=_;for(;l.pos>X;)De>=0&&l.id==De&&l.size>=0?(l.end<=ye-s&&(p($,ne,B,dt,l.end,ye,De,K,oe),dt=$.length,ye=l.end),l.next()):q>2500?u(B,X,$,ne):f(B,X,$,ne,De,q+1);if(De>=0&&dt>0&&dt<$.length&&p($,ne,B,dt,B,ye,De,K,oe),$.reverse(),ne.reverse(),De>-1&&dt>0){let Mo=d(be,oe);ve=oo(be,$,ne,0,$.length,0,_-B,Mo,Mo)}else ve=m(be,$,ne,_-B,K-_,oe)}S.push(ve),L.push(E)}function u(v,C,S,L){let W=[],q=0,P=-1;for(;l.pos>C;){let{id:B,start:_,end:H,size:K}=l;if(K>4)l.next();else{if(P>-1&&_=0;H-=3)B[K++]=W[H],B[K++]=W[H+1]-_,B[K++]=W[H+2]-_,B[K++]=K;S.push(new At(B,W[2]-_,i)),L.push(_-v)}}function d(v,C){return(S,L,W)=>{let q=0,P=S.length-1,B,_;if(P>=0&&(B=S[P])instanceof J){if(!P&&B.type==v&&B.length==W)return B;(_=B.prop(N.lookAhead))&&(q=L[P]+B.length+_)}return m(v,S,L,W,q,C)}}function p(v,C,S,L,W,q,P,B,_){let H=[],K=[];for(;v.length>L;)H.push(v.pop()),K.push(C.pop()+S-W);v.push(m(i.types[P],H,K,q-W,B-q,_)),C.push(W-S)}function m(v,C,S,L,W,q,P){if(q){let B=[N.contextHash,q];P=P?[B].concat(P):[B]}if(W>25){let B=[N.lookAhead,W];P=P?[B].concat(P):[B]}return new J(v,C,S,L,P)}function b(v,C){let S=l.fork(),L=0,W=0,q=0,P=S.end-s,B={size:0,start:0,skip:0};e:for(let _=S.pos-v;S.pos>_;){let H=S.size;if(S.id==C&&H>=0){B.size=L,B.start=W,B.skip=q,q+=4,L+=4,S.next();continue}let K=S.pos-H;if(H<0||K<_||S.start=o?4:0,be=S.start;for(S.next();S.pos>K;){if(S.size<0)if(S.size==-3||S.size==-4)oe+=4;else break e;else S.id>=o&&(oe+=4);S.next()}W=be,L+=H,q+=oe}return(C<0||L==v)&&(B.size=L,B.start=W,B.skip=q),B.size>4?B:void 0}function y(v,C,S){let{id:L,start:W,end:q,size:P}=l;if(l.next(),P>=0&&L4){let _=l.pos-(P-4);for(;l.pos>_;)S=y(v,C,S)}C[--S]=B,C[--S]=q-v,C[--S]=W-v,C[--S]=L}else P==-3?h=L:P==-4&&(c=L);return S}let k=[],w=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,k,w,-1,0);let M=(e=n.length)!==null&&e!==void 0?e:k.length?w[0]+k[0].length:0;return new J(a[n.topID],k.reverse(),w.reverse(),M)}const Bl=new WeakMap;function En(n,e){if(!n.isAnonymous||e instanceof At||e.type!=n)return 1;let t=Bl.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof J)){t=1;break}t+=En(n,i)}Bl.set(e,t)}return t}function oo(n,e,t,i,s,r,o,l,a){let h=0;for(let p=i;p=c)break;C+=S}if(w==M+1){if(C>c){let S=p[M];d(S.children,S.positions,0,S.children.length,m[M]+k);continue}f.push(p[M])}else{let S=m[w-1]+p[w-1].length-v;f.push(oo(n,p,m,M,w,v,S,null,a))}u.push(v+k-r)}}return d(e,t,i,s,0),(l||a)(f,u,o)}class Ib{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof st?this.setBuffer(e.context.buffer,e.index,t):e instanceof me&&this.map.set(e.tree,t)}get(e){return e instanceof st?this.getBuffer(e.context.buffer,e.index):e instanceof me?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class ct{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new ct(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,f)-h;u=d>=p?null:new ct(d,p,u.tree,u.offset+h,l>0,!!c)}if(u&&s.push(u),o.to>f)break;o=rnew We(s.from,s.to)):[new We(0,0)]:[new We(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class Fp{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function Nb(n){return(e,t,i,s)=>new Vp(e,n,t,i,s)}class Ll{constructor(e,t,i,s,r,o){this.parser=e,this.parse=t,this.overlay=i,this.bracketed=s,this.target=r,this.from=o}}function El(n){if(!n.length||n.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class Hp{constructor(e,t,i,s,r,o,l,a){this.parser=e,this.predicate=t,this.mounts=i,this.index=s,this.start=r,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const Or=new N({perNode:!0});class Vp{constructor(e,t,i,s,r){this.nest=t,this.input=i,this.fragments=s,this.ranges=r,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let s of this.inner)s.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new J(i.type,i.children,i.positions,i.length,i.propValues.concat([[Or,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[N.mounted.id]=new ei(t,e.overlay,e.parser,e.bracketed),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(s)){if(t){let h=t.mounts.find(c=>c.frag.from<=s.from&&c.frag.to>=s.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let f=c.from+h.pos,u=c.to+h.pos;f>=s.from&&u<=s.to&&!t.ranges.some(d=>d.fromf)&&t.ranges.push({from:f,to:u})}}l=!1}else if(i&&(o=zp(i.ranges,s.from,s.to)))l=o!=2;else if(!s.type.isAnonymous&&(r=this.nest(s,this.input))&&(s.fromnew We(f.from-s.from,f.to-s.from)):null,!!r.bracketed,s.tree,c.length?c[0].from:s.from)),r.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):l=!1}}else if(t&&(a=t.predicate(s))&&(a===!0&&(a=new We(s.from,s.to)),a.from=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&s.firstChild())t&&t.depth++,i&&i.depth++;else for(;!s.nextSibling();){if(!s.parent())break e;if(t&&!--t.depth){let h=Il(this.ranges,t.ranges);h.length&&(El(h),this.inner.splice(t.index,0,new Ll(t.parser,t.parser.startParse(this.input,Nl(t.mounts,h),h),t.ranges.map(c=>new We(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function zp(n,e,t){for(let i of n){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function Pl(n,e,t,i,s,r){if(e=e&&t.enter(i,1,U.IgnoreOverlays|U.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof J)t=t.children[0];else break}return!1}}class qp{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(Or))!==null&&t!==void 0?t:i.to,this.inner=new Rl(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Or))!==null&&e!==void 0?e:t.to,this.inner=new Rl(t.tree,-t.offset)}}findMounts(e,t){var i;let s=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let r=this.inner.cursor.node;r;r=r.parent){let o=(i=r.tree)===null||i===void 0?void 0:i.prop(N.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=r.to)break;a.tree==this.curFrag.tree&&s.push({frag:a,pos:r.from-a.offset,mount:o})}}}return s}}function Il(n,e){let t=null,i=e;for(let s=1,r=0;s=l)break;a.to<=o||(t||(i=t=e.slice()),a.froml&&t.splice(r+1,0,new We(l,a.to))):a.to>l?t[r--]=new We(l,a.to):t.splice(r--,1))}}return i}function Kp(n,e,t,i){let s=0,r=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=s==n.length?1e9:o?n[s].to:n[s].from,f=r==e.length?1e9:l?e[r].to:e[r].from;if(o!=l){let u=Math.max(a,t),d=Math.min(c,f,i);unew We(u.from+i,u.to+i)),f=Kp(e,c,a,h);for(let u=0,d=a;;u++){let p=u==f.length,m=p?h:f[u].from;if(m>d&&t.push(new ct(d,m,s.tree,-o,r.from>=d||r.openStart,r.to<=m||r.openEnd)),p)break;d=f[u].to}}else t.push(new ct(a,h,s.tree,-o,r.from>=o||r.openStart,r.to<=l||r.openEnd))}return t}let $p=0;class Re{constructor(e,t,i,s){this.name=e,this.set=t,this.base=i,this.modified=s,this.id=$p++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof Re&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let s=new Re(i,[],null,[]);if(s.set.push(s),t)for(let r of t.set)s.set.push(r);return s}static defineModifier(e){let t=new $n(e);return i=>i.modified.indexOf(t)>-1?i:$n.get(i.base||i,i.modified.concat(t).sort((s,r)=>s.id-r.id))}}let jp=0;class $n{constructor(e){this.name=e,this.instances=[],this.id=jp++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&Up(t,l.modified));if(i)return i;let s=[],r=new Re(e.name,s,e,t);for(let l of t)l.instances.push(r);let o=Gp(t);for(let l of e.set)if(!l.modified.length)for(let a of o)s.push($n.get(l,a));return r}}function Up(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function Gp(n){let e=[[]];for(let t=0;ti.length-t.length)}function Jp(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let r=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+s);let c=new Vi(i,o,a>0?r.slice(0,a):null);e[h]=c.sort(e[h])}}return Yh.add(e)}const Yh=new N({combine(n,e){let t,i,s;for(;n||e;){if(!n||e&&n.depth>=e.depth?(s=e,e=e.next):(s=n,n=n.next),t&&t.mode==s.mode&&!s.context&&!t.context)continue;let r=new Vi(s.tags,s.mode,s.context);t?t.next=r:i=r,t=r}return i}});class Vi{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=s;for(let l of r)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function Yp(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function Xp(n,e,t,i=0,s=n.length){let r=new Qp(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class Qp{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=s,c=Zp(e)||Vi.empty,f=Yp(r,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(t,l),h),c.opaque)return;let u=e.tree&&e.tree.prop(N.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(b=>!b.scope||b.scope(u.tree.type)),m=e.firstChild();for(let b=0,y=l;;b++){let k=b=w||!e.nextSibling())););if(!k||w>i)break;y=k.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,k.from+l),Math.min(i,y),"",p),this.startSpan(Math.min(i,y),h))}m&&e.parent()}else if(e.firstChild()){u&&(s="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function Zp(n){let e=n.type.prop(Yh);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const A=Re.define,yn=A(),pt=A(),Wl=A(pt),Fl=A(pt),mt=A(),xn=A(mt),Os=A(mt),Ze=A(),Dt=A(Ze),Xe=A(),Qe=A(),Br=A(),gi=A(Br),wn=A(),g={comment:yn,lineComment:A(yn),blockComment:A(yn),docComment:A(yn),name:pt,variableName:A(pt),typeName:Wl,tagName:A(Wl),propertyName:Fl,attributeName:A(Fl),className:A(pt),labelName:A(pt),namespace:A(pt),macroName:A(pt),literal:mt,string:xn,docString:A(xn),character:A(xn),attributeValue:A(xn),number:Os,integer:A(Os),float:A(Os),bool:A(mt),regexp:A(mt),escape:A(mt),color:A(mt),url:A(mt),keyword:Xe,self:A(Xe),null:A(Xe),atom:A(Xe),unit:A(Xe),modifier:A(Xe),operatorKeyword:A(Xe),controlKeyword:A(Xe),definitionKeyword:A(Xe),moduleKeyword:A(Xe),operator:Qe,derefOperator:A(Qe),arithmeticOperator:A(Qe),logicOperator:A(Qe),bitwiseOperator:A(Qe),compareOperator:A(Qe),updateOperator:A(Qe),definitionOperator:A(Qe),typeOperator:A(Qe),controlOperator:A(Qe),punctuation:Br,separator:A(Br),bracket:gi,angleBracket:A(gi),squareBracket:A(gi),paren:A(gi),brace:A(gi),content:Ze,heading:Dt,heading1:A(Dt),heading2:A(Dt),heading3:A(Dt),heading4:A(Dt),heading5:A(Dt),heading6:A(Dt),contentSeparator:A(Ze),list:A(Ze),quote:A(Ze),emphasis:A(Ze),strong:A(Ze),link:A(Ze),monospace:A(Ze),strikethrough:A(Ze),inserted:A(),deleted:A(),changed:A(),invalid:A(),meta:wn,documentMeta:A(wn),annotation:A(wn),processingInstruction:A(wn),definition:Re.defineModifier("definition"),constant:Re.defineModifier("constant"),function:Re.defineModifier("function"),standard:Re.defineModifier("standard"),local:Re.defineModifier("local"),special:Re.defineModifier("special")};for(let n in g){let e=g[n];e instanceof Re&&(e.name=n)}Xh([{tag:g.link,class:"tok-link"},{tag:g.heading,class:"tok-heading"},{tag:g.emphasis,class:"tok-emphasis"},{tag:g.strong,class:"tok-strong"},{tag:g.keyword,class:"tok-keyword"},{tag:g.atom,class:"tok-atom"},{tag:g.bool,class:"tok-bool"},{tag:g.url,class:"tok-url"},{tag:g.labelName,class:"tok-labelName"},{tag:g.inserted,class:"tok-inserted"},{tag:g.deleted,class:"tok-deleted"},{tag:g.literal,class:"tok-literal"},{tag:g.string,class:"tok-string"},{tag:g.number,class:"tok-number"},{tag:[g.regexp,g.escape,g.special(g.string)],class:"tok-string2"},{tag:g.variableName,class:"tok-variableName"},{tag:g.local(g.variableName),class:"tok-variableName tok-local"},{tag:g.definition(g.variableName),class:"tok-variableName tok-definition"},{tag:g.special(g.variableName),class:"tok-variableName2"},{tag:g.definition(g.propertyName),class:"tok-propertyName tok-definition"},{tag:g.typeName,class:"tok-typeName"},{tag:g.namespace,class:"tok-namespace"},{tag:g.className,class:"tok-className"},{tag:g.macroName,class:"tok-macroName"},{tag:g.propertyName,class:"tok-propertyName"},{tag:g.operator,class:"tok-operator"},{tag:g.comment,class:"tok-comment"},{tag:g.meta,class:"tok-meta"},{tag:g.invalid,class:"tok-invalid"},{tag:g.punctuation,class:"tok-punctuation"}]);var Bs;const It=new N;function Qh(n){return O.define({combine:n?e=>e.concat(n):void 0})}const em=new N;class Fe{constructor(e,t,i=[],s=""){this.data=e,this.name=s,V.prototype.hasOwnProperty("tree")||Object.defineProperty(V.prototype,"tree",{get(){return de(this)}}),this.parser=t,this.extension=[Mt.of(this),V.languageData.of((r,o,l)=>{let a=Hl(r,o,l),h=a.type.prop(It);if(!h)return[];let c=r.facet(h),f=a.type.prop(em);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return Hl(e,t,i).type.prop(It)==this.data}findRegions(e){let t=e.facet(Mt);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(It)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(N.mounted);if(l){if(l.tree.prop(It)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new Lr(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function de(n){let e=n.field(Fe.state,!1);return e?e.tree:J.empty}class tm{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let bi=null;class li{constructor(e,t,i=[],s,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new li(e,t,[],J.empty,0,i,[],null)}startParse(){return this.parser.startParse(new tm(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=J.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ct.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=bi;bi=this;try{return e()}finally{bi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Vl(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=ct.applyChanges(i,a),s=J.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=Vl(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Jh{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let a=bi;if(a){for(let h of s)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new J(ke.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return bi}}function Vl(n,e,t){return ct.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class ai{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new ai(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=li.create(e.facet(Mt).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new ai(i)}}Fe.state=Te.define({create:ai.init,update(n,e){for(let t of e.effects)if(t.is(Fe.setState))return t.value;return e.startState.facet(Mt)!=e.state.facet(Mt)?ai.init(e.state):n.apply(e)}});let Zh=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Zh=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Ls=typeof navigator<"u"&&(!((Bs=navigator.scheduling)===null||Bs===void 0)&&Bs.isInputPending)?()=>navigator.scheduling.isInputPending():null,im=ue.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Fe.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Fe.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Zh(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,a=r.context.work(()=>Ls&&Ls()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Fe.setState.of(new ai(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ae(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Mt=O.define({combine(n){return n.length?n[0]:null},enables:n=>[Fe.state,im,D.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class Fb{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class ec{constructor(e,t,i,s,r,o=void 0){this.name=e,this.alias=t,this.extensions=i,this.filename=s,this.loadFunc=r,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:i}=e;if(!t){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(i)}return new ec(e.name,(e.alias||[]).concat(e.name).map(s=>s.toLowerCase()),e.extensions||[],e.filename,t,i)}static matchFilename(e,t){for(let s of e)if(s.filename&&s.filename.test(t))return s;let i=/\.([^.]+)$/.exec(t);if(i){for(let s of e)if(s.extensions.indexOf(i[1])>-1)return s}return null}static matchLanguageName(e,t,i=!0){t=t.toLowerCase();for(let s of e)if(s.alias.some(r=>r==t))return s;if(i)for(let s of e)for(let r of s.alias){let o=t.indexOf(r);if(o>-1&&(r.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+r.length])))return s}return null}}const nm=O.define(),ss=O.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function zt(n){let e=n.facet(ss);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function zi(n,e){let t="",i=n.tabSize,s=n.facet(ss)[0];if(s==" "){for(;e>=i;)t+=" ",e-=i;s=" "}for(let r=0;r=e?sm(n,t,e):null}class rs{constructor(e,t={}){this.state=e,this.options=t,this.unit=zt(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return ci(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const tc=new N;function sm(n,e,t){let i=e.resolveStack(t),s=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(s!=i.node){let r=[];for(let o=s;o&&!(o.fromi.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return ic(i,n,t)}function ic(n,e,t){for(let i=n;i;i=i.next){let s=om(i.node);if(s)return s(ao.create(e,t,i))}return 0}function rm(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function om(n){let e=n.type.prop(tc);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(N.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>nc(o,!0,1,void 0,r&&!rm(o)?s.from:void 0)}return n.parent==null?lm:null}function lm(){return 0}class ao extends rs{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new ao(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(am(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return ic(this.context.next,this.base,this.pos)}}function am(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function hm(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let h=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+h}}l=a.to}}function Hb({closing:n,align:e=!0,units:t=1}){return i=>nc(i,e,t,n)}function nc(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||s==n.pos+o,a=e?hm(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}const Vb=n=>n.baseIndent;function zb({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const cm=200;function fm(){return V.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,s=t.lineAt(i);if(i>s.from+cm)return n;let r=t.sliceString(s.from,i);if(!e.some(h=>h.test(r)))return n;let{state:o}=n,l=-1,a=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==l)continue;l=c.from;let f=lo(o,c.from);if(f==null)continue;let u=/^\s*/.exec(c.text)[0],d=zi(o,f);u!=d&&a.push({from:c.from,to:c.from+u.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const um=O.define(),dm=new N;function _b(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(r&&l.from=e&&h.to>t&&(r=h)}}return r}function mm(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function jn(n,e,t){for(let i of n.facet(um)){let s=i(n,e,t);if(s)return s}return pm(n,e,t)}function sc(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const os=R.define({map:sc}),Zi=R.define({map:sc});function rc(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const _t=Te.define({create(){return I.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,i)=>n=zl(n,t,i)),n=n.map(e.changes);for(let t of e.effects)if(t.is(os)&&!gm(n,t.value.from,t.value.to)){let{preparePlaceholder:i}=e.state.facet(ac),s=i?I.replace({widget:new Sm(i(e.state,t.value))}):_l;n=n.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(Zi)&&(n=n.update({filter:(i,s)=>t.value.from!=i||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=zl(n,e.selection.main.head)),n},provide:n=>D.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,s)=>{t.push(i,s)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{se&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(s,r)=>s>=t||r<=e}):n}function Un(n,e,t){var i;let s=null;return(i=n.field(_t,!1))===null||i===void 0||i.between(e,t,(r,o)=>{(!s||s.from>r)&&(s={from:r,to:o})}),s}function gm(n,e,t){let i=!1;return n.between(e,e,(s,r)=>{s==e&&r==t&&(i=!0)}),i}function oc(n,e){return n.field(_t,!1)?e:e.concat(R.appendConfig.of(hc()))}const bm=n=>{for(let e of rc(n)){let t=jn(n.state,e.from,e.to);if(t)return n.dispatch({effects:oc(n.state,[os.of(t),lc(n,t)])}),!0}return!1},ym=n=>{if(!n.state.field(_t,!1))return!1;let e=[];for(let t of rc(n)){let i=Un(n.state,t.from,t.to);i&&e.push(Zi.of(i),lc(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function lc(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,s=n.state.doc.lineAt(e.to).number;return D.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${s}.`)}const xm=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(_t,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,s)=>{t.push(Zi.of({from:i,to:s}))}),n.dispatch({effects:t}),!0},km=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:bm},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:ym},{key:"Ctrl-Alt-[",run:xm},{key:"Ctrl-Alt-]",run:wm}],vm={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},ac=O.define({combine(n){return Kt(n,vm)}});function hc(n){return[_t,Mm]}function cc(n,e){let{state:t}=n,i=t.facet(ac),s=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=Un(n.state,l.from,l.to);a&&n.dispatch({effects:Zi.of(a)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,s,e);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const _l=I.replace({widget:new class extends Ue{toDOM(n){return cc(n,null)}}});class Sm extends Ue{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return cc(e,this.value)}}const Cm={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Es extends Ct{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function Am(n={}){let e={...Cm,...n},t=new Es(e,!0),i=new Es(e,!1),s=ue.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Mt)!=o.state.facet(Mt)||o.startState.field(_t,!1)!=o.state.field(_t,!1)||de(o.startState)!=de(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new wt;for(let a of o.viewportLineBlocks){let h=Un(o.state,a.from,a.to)?i:jn(o.state,a.from,a.to)?t:null;h&&l.add(a.from,a.from,h)}return l.finish()}}),{domEventHandlers:r}=e;return[s,Sp({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||F.empty},initialSpacer(){return new Es(e,!1)},domEventHandlers:{...r,click:(o,l,a)=>{if(r.click&&r.click(o,l,a))return!0;let h=Un(o.state,l.from,l.to);if(h)return o.dispatch({effects:Zi.of(h)}),!0;let c=jn(o.state,l.from,l.to);return c?(o.dispatch({effects:os.of(c)}),!0):!1}}}),hc()]}const Mm=D.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class fi{constructor(e,t){this.specs=e;let i;function s(l){let a=kt.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof Fe?l=>l.prop(It)==o.data:o?l=>l==o:void 0,this.style=Xh(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new kt(i):null,this.themeType=t.themeType}static define(e,t){return new fi(e,t||{})}}const Er=O.define(),fc=O.define({combine(n){return n.length?[n[0]]:null}});function Ps(n){let e=n.facet(Er);return e.length?e:n.facet(fc)}function ho(n,e){let t=[Dm],i;return n instanceof fi&&(n.module&&t.push(D.styleModule.of(n.module)),i=n.themeType),e?.fallback?t.push(fc.of(n)):i?t.push(Er.computeN([D.darkTheme],s=>s.facet(D.darkTheme)==(i=="dark")?[n]:[])):t.push(Er.of(n)),t}class Tm{constructor(e){this.markCache=Object.create(null),this.tree=de(e.state),this.decorations=this.buildDeco(e,Ps(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=de(e.state),i=Ps(e.state),s=i!=Ps(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return I.none;let i=new wt;for(let{from:s,to:r}of e.visibleRanges)Xp(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=I.mark({class:a})))},s,r);return i.finish()}}const Dm=qt.high(ue.fromClass(Tm,{decorations:n=>n.decorations})),Om=fi.define([{tag:g.meta,color:"#404740"},{tag:g.link,textDecoration:"underline"},{tag:g.heading,textDecoration:"underline",fontWeight:"bold"},{tag:g.emphasis,fontStyle:"italic"},{tag:g.strong,fontWeight:"bold"},{tag:g.strikethrough,textDecoration:"line-through"},{tag:g.keyword,color:"#708"},{tag:[g.atom,g.bool,g.url,g.contentSeparator,g.labelName],color:"#219"},{tag:[g.literal,g.inserted],color:"#164"},{tag:[g.string,g.deleted],color:"#a11"},{tag:[g.regexp,g.escape,g.special(g.string)],color:"#e40"},{tag:g.definition(g.variableName),color:"#00f"},{tag:g.local(g.variableName),color:"#30a"},{tag:[g.typeName,g.namespace],color:"#085"},{tag:g.className,color:"#167"},{tag:[g.special(g.variableName),g.macroName],color:"#256"},{tag:g.definition(g.propertyName),color:"#00c"},{tag:g.comment,color:"#940"},{tag:g.invalid,color:"#f00"}]),Bm=1e4,Lm="()[]{}",Em=new N;function Pr(n,e,t){let i=n.prop(e<0?N.openedBy:N.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function Rr(n){let e=n.type.prop(Em);return e?e(n.node):n}function Gt(n,e,t,i={}){let s=i.maxScanDistance||Bm,r=i.brackets||Lm,o=de(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=Pr(a.type,t,r);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return Pm(n,e,t,a,c,h,r)}}return Rm(n,e,t,o,l.type,s,r)}function Pm(n,e,t,i,s,r,o){let l=i.parent,a={from:s.from,to:s.to},h=0,c=l?.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let p=e+u*t;for(let m=t>0?0:d.length-1,b=t>0?d.length:-1;m!=b;m+=t){let y=o.indexOf(d[m]);if(!(y<0||i.resolveInner(p+m,1).type!=s))if(y%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:p+m,to:p+m+1},matched:y>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}function ql(n,e,t,i=0,s=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let r=s;for(let o=i;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosi?o.toLowerCase():o,r=this.string.substr(this.pos,e.length);return s(r)==s(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function Im(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||Nm,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||fo,mergeTokens:n.mergeTokens!==!1}}function Nm(n){if(typeof n!="object")return n;let e={};for(let t in n){let i=n[t];e[t]=i instanceof Array?i.slice():i}return e}const Kl=new WeakMap;class Pe extends Fe{constructor(e){let t=Qh(e.languageData),i=Im(e),s,r=new class extends Jh{createParse(o,l,a){return new Fm(s,o,l,a)}};super(t,r,[],e.name),this.topNode=zm(t,this),s=this,this.streamParser=i,this.stateAfter=new N({perNode:!0}),this.tokenTable=e.tokenTable?new gc(i.tokenTable):Vm}static define(e){return new Pe(e)}getIndent(e){let t,{overrideIndentation:i}=e.options;i&&(t=Kl.get(e.state),t!=null&&t1e4)return null;for(;r=i&&t+e.length<=s&&e.prop(n.stateAfter);if(r)return{state:n.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],h=l instanceof J&&a=e.length)return e;!s&&t==0&&e.type==n.topNode&&(s=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],a;if(ot&&co(n,r.tree,0-r.offset,t,l),h;if(a&&a.pos<=i&&(h=dc(n,r.tree,t+r.offset,a.pos+r.offset,!1)))return{state:a.state,tree:h}}return{state:n.streamParser.startState(s?zt(s):4),tree:J.empty}}class Fm{constructor(e,t,i,s){this.lang=e,this.input=t,this.fragments=i,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let r=li.get(),o=s[0].from,{state:l,tree:a}=Wm(e,i,o,this.to,r?.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let h=0;hh.from<=r.viewport.from&&h.to>=r.viewport.from)&&(this.state=this.lang.streamParser.startState(zt(r.state)),r.skipUntilInView(this.parsedPos,r.viewport.from),this.parsedPos=r.viewport.from),this.moveRangeIndex()}advance(){let e=li.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(t,this.chunkStart+512);for(e&&(i=Math.min(i,e.viewport.to));this.parsedPos=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` +`&&(t="");else{let i=t.indexOf(` +`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?s>r:s>=r)break;let o=this.ranges[++this.rangeIndex].from;t+=o-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(t,s,1),t+=s;let l=this.chunk.length;s=this.skipGapsTo(i,s,-1),i+=s,r+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&r==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=i:this.chunk.push(e,t,i,r),s}parseLine(e){let{line:t,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new uc(t,e?e.state.tabSize:4,e?zt(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=pc(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const fo=Object.create(null),_i=[ke.none],Hm=new no(_i),$l=[],jl=Object.create(null),mc=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])mc[n]=bc(fo,e);class gc{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),mc)}resolve(e){return e?this.table[e]||(this.table[e]=bc(this.extra,e)):0}}const Vm=new gc(fo);function Rs(n,e){$l.indexOf(n)>-1||($l.push(n),console.warn(e))}function bc(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||g[h];c?typeof c=="function"?a.length?a=a.map(c):Rs(h,`Modifier ${h} used at start of tag`):a.length?Rs(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:Rs(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(l=>l.id),r=jl[s];if(r)return r.id;let o=jl[s]=ke.define({id:_i.length,name:i,props:[Jp({[i]:t})]});return _i.push(o),o.id}function zm(n,e){let t=ke.define({id:_i.length,name:"Document",props:[It.add(()=>n),tc.add(()=>i=>e.getIndent(i))],top:!0});return _i.push(t),t}G.RTL,G.LTR;const _m=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=po(n.state,t.from);return i.line?qm(n):i.block?$m(n):!1};function uo(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const qm=uo(Gm,0),Km=uo(yc,0),$m=uo((n,e)=>yc(n,e,Um(e)),0);function po(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const yi=50;function jm(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-yi,i),o=n.sliceDoc(s,s+yi),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,h=r.length-l;if(r.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+a,margin:a&&1}};let c,f;s-i<=2*yi?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+yi),f=n.sliceDoc(s-yi,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function Um(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to);s.from>i.from&&s.from==t.to&&(s=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return e}function yc(n,e,t=e.selection.ranges){let i=t.map(r=>po(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>jm(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>f.from)){s=f.from;let u=/^\s*/.exec(f.text)[0].length,d=u==f.length,p=f.text.slice(u,u+h.length)==h?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+h,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,r.push({from:h,to:c})}return{changes:r}}return null}const Ir=ut.define(),Jm=ut.define(),Ym=O.define(),xc=O.define({combine(n){return Kt(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,s)=>e(i,s)||t(i,s)})}}),wc=Te.define({create(){return rt.empty},update(n,e){let t=e.state.facet(xc),i=e.annotation(Ir);if(i){let a=Me.fromTransaction(e,i.selection),h=i.side,c=h==0?n.undone:n.done;return a?c=Gn(c,c.length,t.minDepth,a):c=Sc(c,e.startState.selection),new rt(h==0?i.rest:c,h==0?c:i.rest)}let s=e.annotation(Jm);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(Z.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=Me.fromTransaction(e),o=e.annotation(Z.time),l=e.annotation(Z.userEvent);return r?n=n.addChanges(r,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new rt(n.done.map(Me.fromJSON),n.undone.map(Me.fromJSON))}});function Xm(n={}){return[wc,xc.of(n),D.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?kc:e.inputType=="historyRedo"?Nr:null;return i?(e.preventDefault(),i(t)):!1}})]}function ls(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(wc,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const kc=ls(0,!1),Nr=ls(1,!1),Qm=ls(0,!0),Zm=ls(1,!0);class Me{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new Me(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Me(e.changes&&ie.fromJSON(e.changes),[],e.mapped&&ot.fromJSON(e.mapped),e.startSelection&&x.fromJSON(e.startSelection),e.selectionsAfter.map(x.fromJSON))}static fromTransaction(e,t){let i=He;for(let s of e.startState.facet(Ym)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new Me(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,He)}static selection(e){return new Me(void 0,He,void 0,void 0,e)}}function Gn(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function eg(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let a=0;a=h&&o<=c&&(i=!0)}}),i}function tg(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function vc(n,e){return n.length?e.length?n.concat(e):n:e}const He=[],ig=200;function Sc(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-ig));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Gn(n,n.length-1,1e9,t.setSelAfter(i)))}else return[Me.selection([e])]}function ng(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Is(n,e){if(!n.length)return n;let t=n.length,i=He;for(;t;){let s=sg(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[Me.selection(i)]:He}function sg(n,e,t){let i=vc(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):He,t);if(!n.changes)return Me.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new Me(s,R.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const rg=/^(input\.type|delete)($|\.)/;class rt{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new rt(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||rg.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):as(t,e))}function ge(n){return n.textDirectionAt(n.state.selection.main.head)==G.LTR}const Ac=n=>Cc(n,!ge(n)),Mc=n=>Cc(n,ge(n));function Tc(n,e){return Je(n,t=>t.empty?n.moveByGroup(t,e):as(t,e))}const lg=n=>Tc(n,!ge(n)),ag=n=>Tc(n,ge(n));function hg(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function hs(n,e,t){let i=de(n).resolveInner(e.head),s=t?N.closedBy:N.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;hg(n,h,s)?i=h:a=t?h.to:h.from}let r=i.type.prop(s),o,l;return r&&(o=t?Gt(n,i.from,1):Gt(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,x.cursor(l,t?-1:1)}const cg=n=>Je(n,e=>hs(n.state,e,!ge(n))),fg=n=>Je(n,e=>hs(n.state,e,ge(n)));function Dc(n,e){return Je(n,t=>{if(!t.empty)return as(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const Oc=n=>Dc(n,!1),Bc=n=>Dc(n,!0);function Lc(n){let e=n.scrollDOM.clientHeighto.empty?n.moveVertically(o,e,t.height):as(o,e));if(s.eq(i.selection))return!1;let r;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomEc(n,!1),Wr=n=>Ec(n,!0);function Tt(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=x.cursor(i.from+r))}return s}const ug=n=>Je(n,e=>Tt(n,e,!0)),dg=n=>Je(n,e=>Tt(n,e,!1)),pg=n=>Je(n,e=>Tt(n,e,!ge(n))),mg=n=>Je(n,e=>Tt(n,e,ge(n))),gg=n=>Je(n,e=>x.cursor(n.lineBlockAt(e.head).from,1)),bg=n=>Je(n,e=>x.cursor(n.lineBlockAt(e.head).to,-1));function yg(n,e,t){let i=!1,s=ui(n.selection,r=>{let o=Gt(n,r.head,-1)||Gt(n,r.head,1)||r.head>0&&Gt(n,r.head-1,1)||r.headyg(n,e);function _e(n,e){let t=ui(n.state.selection,i=>{let s=e(i);return x.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Ge(n.state,t)),!0)}function Pc(n,e){return _e(n,t=>n.moveByChar(t,e))}const Rc=n=>Pc(n,!ge(n)),Ic=n=>Pc(n,ge(n));function Nc(n,e){return _e(n,t=>n.moveByGroup(t,e))}const wg=n=>Nc(n,!ge(n)),kg=n=>Nc(n,ge(n)),vg=n=>_e(n,e=>hs(n.state,e,!ge(n))),Sg=n=>_e(n,e=>hs(n.state,e,ge(n)));function Wc(n,e){return _e(n,t=>n.moveVertically(t,e))}const Fc=n=>Wc(n,!1),Hc=n=>Wc(n,!0);function Vc(n,e){return _e(n,t=>n.moveVertically(t,e,Lc(n).height))}const Gl=n=>Vc(n,!1),Jl=n=>Vc(n,!0),Cg=n=>_e(n,e=>Tt(n,e,!0)),Ag=n=>_e(n,e=>Tt(n,e,!1)),Mg=n=>_e(n,e=>Tt(n,e,!ge(n))),Tg=n=>_e(n,e=>Tt(n,e,ge(n))),Dg=n=>_e(n,e=>x.cursor(n.lineBlockAt(e.head).from)),Og=n=>_e(n,e=>x.cursor(n.lineBlockAt(e.head).to)),Yl=({state:n,dispatch:e})=>(e(Ge(n,{anchor:0})),!0),Xl=({state:n,dispatch:e})=>(e(Ge(n,{anchor:n.doc.length})),!0),Ql=({state:n,dispatch:e})=>(e(Ge(n,{anchor:n.selection.main.anchor,head:0})),!0),Zl=({state:n,dispatch:e})=>(e(Ge(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Bg=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),Lg=({state:n,dispatch:e})=>{let t=cs(n).map(({from:i,to:s})=>x.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:x.create(t),userEvent:"select"})),!0},Eg=({state:n,dispatch:e})=>{let t=ui(n.selection,i=>{let s=de(n),r=s.resolveStack(i.from,1);if(i.empty){let o=s.resolveStack(i.from,-1);o.node.from>=r.node.from&&o.node.to<=r.node.to&&(r=o)}for(let o=r;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return x.range(l.to,l.from)}return i});return t.eq(n.selection)?!1:(e(Ge(n,t)),!0)};function zc(n,e){let{state:t}=n,i=t.selection,s=t.selection.ranges.slice();for(let r of t.selection.ranges){let o=t.doc.lineAt(r.head);if(e?o.to0)for(let l=r;;){let a=n.moveVertically(l,e);if(a.heado.to){s.some(h=>h.head==a.head)||s.push(a);break}else{if(a.head==l.head)break;l=a}}}return s.length==i.ranges.length?!1:(n.dispatch(Ge(t,x.create(s,s.length-1))),!0)}const Pg=n=>zc(n,!1),Rg=n=>zc(n,!0),Ig=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=x.create([t.main]):t.main.empty||(i=x.create([x.cursor(t.main.head)])),i?(e(Ge(n,i)),!0):!1};function en(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);ao&&(t="delete.forward",a=kn(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=kn(n,o,!1),l=kn(n,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:x.cursor(o,os(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const _c=(n,e,t)=>en(n,i=>{let s=i.from,{state:r}=n,o=r.doc.lineAt(s),l,a;if(t&&!e&&s>o.from&&s_c(n,!1,!0),qc=n=>_c(n,!0,!1),Kc=(n,e)=>en(n,t=>{let i=t.head,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t.head&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let a=ce(r.text,i-r.from,e)+r.from,h=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||i!=t.head)&&(l=c),i=a}return i}),$c=n=>Kc(n,!1),Ng=n=>Kc(n,!0),Wg=n=>en(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headen(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),Hg=n=>en(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:z.of(["",""])},range:x.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},zg=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:ce(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:ce(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:x.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function cs(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function jc(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of cs(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let a of r.ranges)s.push(x.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let a of r.ranges)s.push(x.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:x.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const _g=({state:n,dispatch:e})=>jc(n,e,!1),qg=({state:n,dispatch:e})=>jc(n,e,!0);function Uc(n,e,t){if(n.readOnly)return!1;let i=[];for(let r of cs(n))t?i.push({from:r.from,insert:n.doc.slice(r.from,r.to)+n.lineBreak}):i.push({from:r.to,insert:n.lineBreak+n.doc.slice(r.from,r.to)});let s=n.changes(i);return e(n.update({changes:s,selection:n.selection.map(s,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Kg=({state:n,dispatch:e})=>Uc(n,e,!1),$g=({state:n,dispatch:e})=>Uc(n,e,!0),jg=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(cs(e).map(({from:s,to:r})=>(s>0?s--:r{let r;if(n.lineWrapping){let o=n.lineBlockAt(s.head),l=n.coordsAtPos(s.head,s.assoc||1);l&&(r=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(s,!0,r)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Ug(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=de(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(N.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from&&!/\S/.test(n.sliceDoc(i.to,s.from))?{from:i.to,to:s.from}:null}const ea=Gc(!1),Gg=Gc(!0);function Gc(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),a=!n&&r==o&&Ug(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new rs(e,{simulateBreak:r,simulateDoubleBreak:!!a}),c=lo(h,r);for(c==null&&(c=ci(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:x.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const Jg=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new rs(n,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=mo(n,(r,o,l)=>{let a=lo(i,r.from);if(a==null)return;/\S/.test(r.text)||(a=0);let h=/^\s*/.exec(r.text)[0],c=zi(n,a);(h!=c||l.fromn.readOnly?!1:(e(n.update(mo(n,(t,i)=>{i.push({from:t.from,insert:n.facet(ss)})}),{userEvent:"input.indent"})),!0),Yc=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(mo(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=ci(s,n.tabSize),o=0,l=zi(n,Math.max(0,r-zt(n)));for(;o(n.setTabFocusMode(),!0),Xg=[{key:"Ctrl-b",run:Ac,shift:Rc,preventDefault:!0},{key:"Ctrl-f",run:Mc,shift:Ic},{key:"Ctrl-p",run:Oc,shift:Fc},{key:"Ctrl-n",run:Bc,shift:Hc},{key:"Ctrl-a",run:gg,shift:Dg},{key:"Ctrl-e",run:bg,shift:Og},{key:"Ctrl-d",run:qc},{key:"Ctrl-h",run:Fr},{key:"Ctrl-k",run:Wg},{key:"Ctrl-Alt-h",run:$c},{key:"Ctrl-o",run:Vg},{key:"Ctrl-t",run:zg},{key:"Ctrl-v",run:Wr}],Qg=[{key:"ArrowLeft",run:Ac,shift:Rc,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:lg,shift:wg,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:pg,shift:Mg,preventDefault:!0},{key:"ArrowRight",run:Mc,shift:Ic,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ag,shift:kg,preventDefault:!0},{mac:"Cmd-ArrowRight",run:mg,shift:Tg,preventDefault:!0},{key:"ArrowUp",run:Oc,shift:Fc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Yl,shift:Ql},{mac:"Ctrl-ArrowUp",run:Ul,shift:Gl},{key:"ArrowDown",run:Bc,shift:Hc,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Xl,shift:Zl},{mac:"Ctrl-ArrowDown",run:Wr,shift:Jl},{key:"PageUp",run:Ul,shift:Gl},{key:"PageDown",run:Wr,shift:Jl},{key:"Home",run:dg,shift:Ag,preventDefault:!0},{key:"Mod-Home",run:Yl,shift:Ql},{key:"End",run:ug,shift:Cg,preventDefault:!0},{key:"Mod-End",run:Xl,shift:Zl},{key:"Enter",run:ea,shift:ea},{key:"Mod-a",run:Bg},{key:"Backspace",run:Fr,shift:Fr,preventDefault:!0},{key:"Delete",run:qc,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$c,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Ng,preventDefault:!0},{mac:"Mod-Backspace",run:Fg,preventDefault:!0},{mac:"Mod-Delete",run:Hg,preventDefault:!0}].concat(Xg.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),Zg=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:cg,shift:vg},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:fg,shift:Sg},{key:"Alt-ArrowUp",run:_g},{key:"Shift-Alt-ArrowUp",run:Kg},{key:"Alt-ArrowDown",run:qg},{key:"Shift-Alt-ArrowDown",run:$g},{key:"Mod-Alt-ArrowUp",run:Pg},{key:"Mod-Alt-ArrowDown",run:Rg},{key:"Escape",run:Ig},{key:"Mod-Enter",run:Gg},{key:"Alt-l",mac:"Ctrl-l",run:Lg},{key:"Mod-i",run:Eg,preventDefault:!0},{key:"Mod-[",run:Yc},{key:"Mod-]",run:Jc},{key:"Mod-Alt-\\",run:Jg},{key:"Shift-Mod-k",run:jg},{key:"Shift-Mod-\\",run:xg},{key:"Mod-/",run:_m},{key:"Alt-A",run:Km},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Yg}].concat(Qg),e0={key:"Tab",run:Jc,shift:Yc};class Xc{constructor(e,t,i,s){this.state=e,this.pos=t,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=de(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(Qc(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function ta(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function t0(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:t0(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function qb(n,e){return t=>{for(let i=de(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class ia{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}}function Wt(n){return n.selection.main.from}function Qc(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const go=ut.define();function n0(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return{...n.changeByRange(l=>{if(l!=s&&t!=i&&n.sliceDoc(l.from+r,l.from+o)!=n.sliceDoc(t,i))return{range:l};let a=n.toText(e);return{changes:{from:l.from+r,to:i==s.from?l.to:l.from+o,insert:a},range:x.cursor(l.from+r+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const na=new WeakMap;function s0(n){if(!Array.isArray(n))return n;let e=na.get(n);return e||na.set(n,e=i0(n)),e}const Jn=R.define(),qi=R.define();class r0{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&v<=57||v>=97&&v<=122?2:v>=65&&v<=90?1:0:(C=Ea(v))!=C.toLowerCase()?1:C!=C.toUpperCase()?2:0;(!k||S==1&&b||M==0&&S!=0)&&(t[f]==v||i[f]==v&&(u=!0)?o[f++]=k:o.length&&(y=!1)),M=S,k+=lt(v)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let l=o+(this.astral?lt(Be(i,o)):1);r&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return this.ret(e-i.length,s)}}class o0{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:l0,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>sa(e(i),t(i)),optionClass:(e,t)=>i=>sa(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function sa(n,e){return n?e?n+" "+e:n:e}function l0(n,e,t,i,s,r){let o=n.textDirection==G.RTL,l=o,a=!1,h="top",c,f,u=e.left-s.left,d=s.right-e.right,p=i.right-i.left,m=i.bottom-i.top;if(l&&u=m||k>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let b=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/b}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function a0(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function Ns(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class h0{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,l=e.state.facet(re);this.optionContent=a0(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Ns(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(re).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:qi.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=s){let{options:r,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=r)&&(this.range=Ns(r.length,o,e.state.facet(re).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=Ns(t.options.length,t.selected,this.view.state.facet(re).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:r}=s;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(s);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>Ae(this.view.state,l,"completion info")):(this.addInfoPane(o,s),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&f0(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottom{o.target==s&&o.preventDefault()});let r=null;for(let o=i.from;oi.from||i.from==0))if(r=u,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.tonew h0(t,n,e)}function f0(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),s=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/s)}function ra(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function u0(n,e){let t=[],i=null,s=null,r=c=>{t.push(c);let{section:f}=c.completion;if(f){i||(i=[]);let u=typeof f=="string"?f:f.name;i.some(d=>d.name==u)||i.push(typeof f=="string"?{name:u}:f)}},o=e.facet(re);for(let c of n)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)r(new ia(u,c.source,f?f(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),d,p=o.filterStrict?new o0(u):new r0(u);for(let m of c.result.options)if(d=p.match(m.label)){let b=m.displayLabel?f?f(m,d.matched):[]:d.matched,y=d.score+(m.boost||0);if(r(new ia(m,c.source,b,y)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:k}=m.section;s||(s=Object.create(null)),s[k]=Math.max(y,s[k]||-1e9)}}}}if(i){let c=Object.create(null),f=0,u=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.nameu.score-f.score||h(f.completion,u.completion))){let f=c.completion;!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost?l.push(c):ra(c.completion)>ra(a)&&(l[l.length-1]=c),a=c.completion}return l}class Jt{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Jt(this.options,oa(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r,o){if(s&&!o&&e.some(h=>h.isPending))return s.setDisabled();let l=u0(e,t);if(!l.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let a=t.facet(re).selectOnOpen?0:-1;if(s&&s.selected!=a&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;cc.hasResult()?Math.min(h,c.from):h,1e8),create:y0,above:r.aboveCursor},s?s.timestamp:Date.now(),a,!1)}map(e){return new Jt(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Jt(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Yn{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new Yn(g0,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(re),r=(i.override||t.languageDataAt("autocomplete",Wt(t)).map(s0)).map(a=>(this.active.find(c=>c.source==a)||new Ve(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((a,h)=>a==this.active[h])&&(r=this.active);let o=this.open,l=e.effects.some(a=>a.is(bo));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!d0(r,this.active)||l?o=Jt.build(r,t,this.id,o,i,l):o&&o.disabled&&!r.some(a=>a.isPending)&&(o=null),!o&&r.every(a=>!a.isPending)&&r.some(a=>a.hasResult())&&(r=r.map(a=>a.hasResult()?new Ve(a.source,0):a));for(let a of e.effects)a.is(ef)&&(o=o&&o.setSelected(a.value,this.id));return r==this.active&&o==this.open?this:new Yn(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?p0:m0}}function d0(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const g0=[];function Zc(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(go);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class Ve{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=Zc(e,t),s=this;(i&8||i&16&&this.touches(e))&&(s=new Ve(s.source,0)),i&4&&s.state==0&&(s=new Ve(this.source,1)),s=s.updateFor(e,i);for(let r of e.effects)if(r.is(Jn))s=new Ve(s.source,1,r.value);else if(r.is(qi))s=new Ve(s.source,0);else if(r.is(bo))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Wt(e.state))}}class ti extends Ve{constructor(e,t,i,s,r,o){super(e,3,t),this.limit=i,this.result=s,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Wt(e.state);if(l>o||!s||t&2&&(Wt(e.startState)==this.from||lt.map(e))}}),ef=R.define(),Se=Te.define({create(){return Yn.start()},update(n,e){return n.update(e)},provide:n=>[io.from(n,e=>e.tooltip),D.contentAttributes.from(n,e=>e.attrs)]});function yo(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(Se).active.find(s=>s.source==e.source);return i instanceof ti?(typeof t=="string"?n.dispatch({...n0(n.state,t,i.from,i.to),annotations:go.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const y0=c0(Se,yo);function vn(n,e="option"){return t=>{let i=t.state.field(Se,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:ef.of(l)}),!0}}const tf=n=>{let e=n.state.field(Se,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(Se,!1)?(n.dispatch({effects:Jn.of(!0)}),!0):!1,x0=n=>{let e=n.state.field(Se,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:qi.of(null)}),!0)};class w0{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const k0=50,v0=1e3,S0=ue.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(Se).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(Se),t=n.state.facet(re);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Se)==e)return;let i=n.transactions.some(r=>{let o=Zc(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;rk0&&Date.now()-o.time>v0){for(let l of o.context.abortListeners)try{l()}catch(a){Ae(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(r=>r.effects.some(o=>o.is(Jn)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.isPending&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of n.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(Se);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(re).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Wt(e),i=new Xc(e,t,n.explicit,this.view),s=new w0(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:qi.of(null)}),Ae(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(re).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(re),i=this.view.state.field(Se);for(let s=0;sl.source==r.active.source);if(o&&o.isPending)if(r.done==null){let l=new Ve(r.active.source,0);for(let a of r.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:bo.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Se,!1);if(e&&e.tooltip&&this.view.state.facet(re).closeOnBlur){let t=e.open&&_h(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:qi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Jn.of(!1)}),20),this.composing=0}}}),C0=typeof navigator=="object"&&/Win/.test(navigator.platform),A0=qt.highest(D.domEventHandlers({keydown(n,e){let t=e.state.field(Se,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(C0&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],s=t.active.find(o=>o.source==i.source),r=i.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(n.key)>-1&&yo(e,i),!1}})),nf=D.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class M0{constructor(e,t,i,s){this.field=e,this.line=t,this.from=i,this.to=s}}class xo{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,he.TrackDel),i=e.mapPos(this.to,1,he.TrackDel);return t==null||i==null?null:new xo(this.field,t,i)}}class wo{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],s=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let a of this.lines){if(i.length){let h=o,c=/^\t*/.exec(a)[0].length;for(let f=0;fnew xo(a.field,s[a.line]+a.from,s[a.line]+a.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let l=r[1]?+r[1]:null,a=r[2]||r[3]||"",h=-1,c=a.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=h&&u.field++}for(let f of s)if(f.line==i.length&&f.from>r.index){let u=r[2]?3+(r[1]||"").length:2;f.from-=u,f.to-=u}s.push(new M0(h,i.length,r.index,r.index+c.length)),o=o.slice(0,r.index)+a+o.slice(r.index+r[0].length)}o=o.replace(/\\([{}])/g,(l,a,h)=>{for(let c of s)c.line==i.length&&c.from>h&&(c.from--,c.to--);return a}),i.push(o)}return new wo(i,s)}}let T0=I.widget({widget:new class extends Ue{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),D0=I.mark({class:"cm-snippetField"});class di{constructor(e,t){this.ranges=e,this.active=t,this.deco=I.set(e.map(i=>(i.from==i.to?T0:D0).range(i.from,i.to)),!0)}map(e){let t=[];for(let i of this.ranges){let s=i.map(e);if(!s)return null;t.push(s)}return new di(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const tn=R.define({map(n,e){return n&&n.map(e)}}),O0=R.define(),Ki=Te.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(tn))return t.value;if(t.is(O0)&&n)return new di(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>D.decorations.from(n,e=>e?e.deco:I.none)});function ko(n,e){return x.create(n.filter(t=>t.field==e).map(t=>x.range(t.from,t.to)))}function B0(n){let e=wo.parse(n);return(t,i,s,r)=>{let{text:o,ranges:l}=e.instantiate(t.state,s),{main:a}=t.state.selection,h={changes:{from:s,to:r==a.from?a.to:r,insert:z.of(o)},scrollIntoView:!0,annotations:i?[go.of(i),Z.userEvent.of("input.complete")]:void 0};if(l.length&&(h.selection=ko(l,0)),l.some(c=>c.field>0)){let c=new di(l,0),f=h.effects=[tn.of(c)];t.state.field(Ki,!1)===void 0&&f.push(R.appendConfig.of([Ki,I0,N0,nf]))}t.dispatch(t.state.update(h))}}function sf(n){return({state:e,dispatch:t})=>{let i=e.field(Ki,!1);if(!i||n<0&&i.active==0)return!1;let s=i.active+n,r=n>0&&!i.ranges.some(o=>o.field==s+n);return t(e.update({selection:ko(i.ranges,s),effects:tn.of(r?null:new di(i.ranges,s)),scrollIntoView:!0})),!0}}const L0=({state:n,dispatch:e})=>n.field(Ki,!1)?(e(n.update({effects:tn.of(null)})),!0):!1,E0=sf(1),P0=sf(-1),R0=[{key:"Tab",run:E0,shift:P0},{key:"Escape",run:L0}],la=O.define({combine(n){return n.length?n[0]:R0}}),I0=qt.highest(Xi.compute([la],n=>n.facet(la)));function Kb(n,e){return{...e,apply:B0(n)}}const N0=D.domEventHandlers({mousedown(n,e){let t=e.state.field(Ki,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let s=t.ranges.find(r=>r.from<=i&&r.to>=i);return!s||s.field==t.active?!1:(e.dispatch({selection:ko(t.ranges,s.field),effects:tn.of(t.ranges.some(r=>r.field>s.field)?new di(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),$i={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Nt=R.define({map(n,e){let t=e.mapPos(n,-1,he.TrackAfter);return t??void 0}}),vo=new class extends xt{};vo.startSide=1;vo.endSide=-1;const rf=Te.define({create(){return F.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(Nt)&&(n=n.update({add:[vo.range(t.value,t.value+1)]}));return n}});function W0(){return[H0,rf]}const Fs="()[]{}<>«»»«[]{}";function of(n){for(let e=0;e{if((F0?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&<(Be(i,0))==1||e!=s.from||t!=s.to)return!1;let r=_0(n.state,i);return r?(n.dispatch(r),!0):!1}),V0=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=lf(n,n.selection.main.head).brackets||$i.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=q0(n.doc,o.head);for(let a of i)if(a==l&&fs(n.doc,o.head)==of(Be(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:x.cursor(o.head-a.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},z0=[{key:"Backspace",run:V0}];function _0(n,e){let t=lf(n,n.selection.main.head),i=t.brackets||$i.brackets;for(let s of i){let r=of(Be(s,0));if(e==s)return r==s?j0(n,s,i.indexOf(s+s+s)>-1,t):K0(n,s,r,t.before||$i.before);if(e==r&&af(n,n.selection.main.from))return $0(n,s,r)}return null}function af(n,e){let t=!1;return n.field(rf).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function fs(n,e){let t=n.sliceString(e,e+2);return t.slice(0,lt(Be(t,0)))}function q0(n,e){let t=n.sliceString(e-2,e);return lt(Be(t,0))==t.length?t:t.slice(1)}function K0(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Nt.of(o.to+e.length),range:x.range(o.anchor+e.length,o.head+e.length)};let l=fs(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:Nt.of(o.head+e.length),range:x.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function $0(n,e,t){let i=null,s=n.changeByRange(r=>r.empty&&fs(n.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:x.cursor(r.head+t.length)}:i={range:r});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function j0(n,e,t,i){let s=i.stringPrefixes||$i.stringPrefixes,r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:Nt.of(l.to+e.length),range:x.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=fs(n.doc,a),c;if(h==e){if(aa(n,a))return{changes:{insert:e+e,from:a},effects:Nt.of(a+e.length),range:x.cursor(a+e.length)};if(af(n,a)){let u=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:x.cursor(a+u.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(c=ha(n,a-2*e.length,s))>-1&&aa(n,c))return{changes:{insert:e+e+e+e,from:a},effects:Nt.of(a+e.length),range:x.cursor(a+e.length)};if(n.charCategorizer(a)(h)!=Ie.Word&&ha(n,a,s)>-1&&!U0(n,a,e,s))return{changes:{insert:e+e,from:a},effects:Nt.of(a+e.length),range:x.cursor(a+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function aa(n,e){let t=de(n).resolveInner(e+1);return t.parent&&t.from==e}function U0(n,e,t,i){let s=de(n).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+a;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function ha(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=Ie.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=Ie.Word)return r}return-1}function G0(n={}){return[A0,Se,re.of(n),S0,J0,nf]}const hf=[{key:"Ctrl-Space",run:Ws},{mac:"Alt-`",run:Ws},{mac:"Alt-i",run:Ws},{key:"Escape",run:x0},{key:"ArrowDown",run:vn(!0)},{key:"ArrowUp",run:vn(!1)},{key:"PageDown",run:vn(!0,"page")},{key:"PageUp",run:vn(!1,"page")},{key:"Enter",run:tf}],J0=qt.highest(Xi.computeN([re],n=>n.facet(re).defaultKeymap?[hf]:[])),Y0="#2E3235",et="#DDDDDD",Li="#B9D2FF",Sn="#b0b0b0",X0="#e0e0e0",cf="#808080",Hs="#000000",Q0="#A54543",ff="#fc6d24",Ot="#fda331",Vs="#8abeb7",ca="#b5bd68",xi="#6fb3d2",wi="#cc99cc",Z0="#6987AF",fa=ff,ua="#292d30",Cn=Li+"30",eb=Y0,zs=et,tb="#202325",da=et,ib=D.theme({"&":{color:et,backgroundColor:eb},".cm-content":{caretColor:da},".cm-cursor, .cm-dropCursor":{borderLeftColor:da},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:tb},".cm-panels":{backgroundColor:ua,color:Sn},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:Li,outline:`1px solid ${Sn}`,color:Hs},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:X0,color:Hs},".cm-activeLine":{backgroundColor:Cn},".cm-selectionMatch":{backgroundColor:Cn},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${Sn}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:Li,color:Hs},".cm-gutters":{borderRight:"1px solid #ffffff10",color:cf,backgroundColor:ua},".cm-activeLineGutter":{backgroundColor:Cn},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:Li},".cm-tooltip":{border:"none",backgroundColor:zs},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:zs,borderBottomColor:zs},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Cn,color:Sn}}},{dark:!0}),nb=fi.define([{tag:g.keyword,color:Ot},{tag:[g.name,g.deleted,g.character,g.propertyName,g.macroName],color:ca},{tag:[g.variableName],color:xi},{tag:[g.function(g.variableName)],color:Ot},{tag:[g.labelName],color:ff},{tag:[g.color,g.constant(g.name),g.standard(g.name)],color:Ot},{tag:[g.definition(g.name),g.separator],color:wi},{tag:[g.brace],color:wi},{tag:[g.annotation],color:fa},{tag:[g.number,g.changed,g.annotation,g.modifier,g.self,g.namespace],color:Ot},{tag:[g.typeName,g.className],color:xi},{tag:[g.operator,g.operatorKeyword],color:wi},{tag:[g.tagName],color:Ot},{tag:[g.squareBracket],color:wi},{tag:[g.angleBracket],color:wi},{tag:[g.attributeName],color:xi},{tag:[g.regexp],color:Ot},{tag:[g.quote],color:et},{tag:[g.string],color:ca},{tag:g.link,color:Z0,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[g.url,g.escape,g.special(g.string)],color:Vs},{tag:[g.meta],color:Q0},{tag:[g.comment],color:cf,fontStyle:"italic"},{tag:g.monospace,color:et},{tag:g.strong,fontWeight:"bold",color:Ot},{tag:g.emphasis,fontStyle:"italic",color:xi},{tag:g.strikethrough,textDecoration:"line-through"},{tag:g.heading,fontWeight:"bold",color:et},{tag:g.special(g.heading1),fontWeight:"bold",color:et},{tag:g.heading1,fontWeight:"bold",color:et},{tag:[g.heading2,g.heading3,g.heading4],fontWeight:"bold",color:et},{tag:[g.heading5,g.heading6],color:et},{tag:[g.atom,g.bool,g.special(g.variableName)],color:Vs},{tag:[g.processingInstruction,g.inserted],color:Vs},{tag:[g.contentSeparator],color:xi},{tag:g.invalid,color:Li,borderBottom:`1px dotted ${fa}`}]),sb=[ib,ho(nb)],pa="#2e3440",So="#3b4252",ma="#434c5e",An="#4c566a",ga="#e5e9f0",Hr="#eceff4",_s="#8fbcbb",ba="#88c0d0",rb="#81a1c1",qe="#5e81ac",ob="#bf616a",$t="#d08770",qs="#ebcb8b",ya="#a3be8c",lb="#b48ead",xa="#d30102",Co=Hr,Ks=Co,ab="#ffffff",$s=So,hb=Co,wa=So,cb=D.theme({"&":{color:pa,backgroundColor:ab},".cm-content":{caretColor:wa},".cm-cursor, .cm-dropCursor":{borderLeftColor:wa},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:hb},".cm-panels":{backgroundColor:Co,color:An},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:`1px solid ${An}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:ga},".cm-activeLine":{backgroundColor:Ks},".cm-selectionMatch":{backgroundColor:ga},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${An}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:Hr},".cm-gutters":{backgroundColor:Hr,color:pa,border:"none"},".cm-activeLineGutter":{backgroundColor:Ks},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:$s},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:$s,borderBottomColor:$s},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Ks,color:An}}},{dark:!1}),fb=fi.define([{tag:g.keyword,color:qe},{tag:[g.name,g.deleted,g.character,g.propertyName,g.macroName],color:$t},{tag:[g.variableName],color:$t},{tag:[g.function(g.variableName)],color:qe},{tag:[g.labelName],color:rb},{tag:[g.color,g.constant(g.name),g.standard(g.name)],color:qe},{tag:[g.definition(g.name),g.separator],color:ya},{tag:[g.brace],color:_s},{tag:[g.annotation],color:xa},{tag:[g.number,g.changed,g.annotation,g.modifier,g.self,g.namespace],color:ba},{tag:[g.typeName,g.className],color:qs},{tag:[g.operator,g.operatorKeyword],color:ya},{tag:[g.tagName],color:lb},{tag:[g.squareBracket],color:ob},{tag:[g.angleBracket],color:$t},{tag:[g.attributeName],color:qs},{tag:[g.regexp],color:qe},{tag:[g.quote],color:So},{tag:[g.string],color:$t},{tag:g.link,color:_s,textDecoration:"underline",textUnderlinePosition:"under"},{tag:[g.url,g.escape,g.special(g.string)],color:$t},{tag:[g.meta],color:ba},{tag:[g.comment],color:ma,fontStyle:"italic"},{tag:g.strong,fontWeight:"bold",color:qe},{tag:g.emphasis,fontStyle:"italic",color:qe},{tag:g.strikethrough,textDecoration:"line-through"},{tag:g.heading,fontWeight:"bold",color:qe},{tag:g.special(g.heading1),fontWeight:"bold",color:qe},{tag:g.heading1,fontWeight:"bold",color:qe},{tag:[g.heading2,g.heading3,g.heading4],fontWeight:"bold",color:qe},{tag:[g.heading5,g.heading6],color:qe},{tag:[g.atom,g.bool,g.special(g.variableName)],color:$t},{tag:[g.processingInstruction,g.inserted],color:_s},{tag:[g.contentSeparator],color:qs},{tag:g.invalid,color:ma,borderBottom:`1px dotted ${xa}`}]),ub=[cb,ho(fb)];class ka{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Et{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=i.facet(ji).markerFilter;s&&(e=s(e,i));let r=e.slice().sort((d,p)=>d.from-p.from||d.to-p.to),o=new wt,l=[],a=0,h=i.doc.iter(),c=0,f=i.doc.length;for(let d=0;;){let p=d==r.length?null:r[d];if(!p&&!l.length)break;let m,b;if(l.length)m=a,b=l.reduce((w,M)=>Math.min(w,M.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;b=p.to,l.push(p),d++}for(;dw.from||w.to==m))l.push(w),d++,b=Math.min(w.to,b);else{b=Math.min(w.from,b);break}}b=Math.min(b,f);let y=!1;if(l.some(w=>w.from==m&&(w.to==b||b==f))&&(y=m==b,!y&&b-m<10)){let w=m-(c+h.value.length);w>0&&(h.next(w),c=m);for(let M=m;;){if(M>=b){y=!0;break}if(!h.lineBreak&&c+h.value.length>M)break;M=c+h.value.length,c+=h.value.length,h.next()}}let k=Ab(l);if(y)o.add(m,m,I.widget({widget:new kb(k),diagnostics:l.slice()}));else{let w=l.reduce((M,v)=>v.markClass?M+" "+v.markClass:M,"");o.add(m,b,I.mark({class:"cm-lintRange cm-lintRange-"+k+w,diagnostics:l.slice(),inclusiveEnd:l.some(M=>M.to>b)}))}if(a=b,a==f)break;for(let w=0;w{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new ka(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new ka(i.from,r,i.diagnostic)}}),i}function db(n,e){let t=e.pos,i=e.end||t,s=n.state.facet(ji).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(uf))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function pb(n,e){return n.field(Le,!1)?e:e.concat(R.appendConfig.of(Mb))}const uf=R.define(),Ao=R.define(),df=R.define(),Le=Te.define({create(){return new Et(I.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=hi(t,n.selected.diagnostic,r)||hi(t,null,r)}!t.size&&s&&e.state.facet(ji).autoPanel&&(s=null),n=new Et(t,s,i)}for(let t of e.effects)if(t.is(uf)){let i=e.state.facet(ji).autoPanel?t.value.length?Ui.open:null:n.panel;n=Et.init(t.value,i,e.state)}else t.is(Ao)?n=new Et(n.diagnostics,t.value?Ui.open:null,n.selected):t.is(df)&&(n=new Et(n.diagnostics,n.panel,t.value));return n},provide:n=>[Mr.from(n,e=>e.panel),D.decorations.from(n,e=>e.diagnostics)]}),mb=I.mark({class:"cm-lintRange cm-lintRange-active"});function gb(n,e,t){let{diagnostics:i}=n.state.field(Le),s,r=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(emf(n,t,!1)))}const yb=n=>{let e=n.state.field(Le,!1);(!e||!e.panel)&&n.dispatch({effects:pb(n.state,[Ao.of(!0)])});let t=wp(n,Ui.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},va=n=>{let e=n.state.field(Le,!1);return!e||!e.panel?!1:(n.dispatch({effects:Ao.of(!1)}),!0)},xb=n=>{let e=n.state.field(Le,!1);if(!e)return!1;let t=n.state.selection.main,i=e.diagnostics.iter(t.to+1);return!i.value&&(i=e.diagnostics.iter(0),!i.value||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},wb=[{key:"Mod-Shift-m",run:yb,preventDefault:!0},{key:"F8",run:xb}],ji=O.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...Kt(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Sa,tooltipFilter:Sa,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,s,r)=>e(i,s,r)||t(i,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function Sa(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function pf(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;ir.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function mf(n,e,t){var i;let s=t?pf(e.actions):[];return it("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},it("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=hi(n.state.field(Le).diagnostics,e);p&&r.apply(n,p.from,p.to)},{name:h}=r,c=s[o]?h.indexOf(s[o]):-1,f=c<0?h:[h.slice(0,c),it("u",h.slice(c,c+1)),h.slice(c+1)],u=r.markClass?" "+r.markClass:"";return it("button",{type:"button",class:"cm-diagnosticAction"+u,onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&it("div",{class:"cm-diagnosticSource"},e.source))}class kb extends Ue{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return it("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Ca{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=mf(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Ui{constructor(e){this.view=e,this.items=[];let t=s=>{if(s.keyCode==27)va(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=pf(r.actions);for(let l=0;l{for(let r=0;rva(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Le).selected;if(!e)return-1;for(let t=0;t{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,u;for(let d=i;di&&(this.items.splice(i,f-i),s=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),i++}});i({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let h=a.height/this.list.offsetHeight;l.topa.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Le),i=hi(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:df.of(i)})}static open(e){return new Ui(e)}}function vb(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function Mn(n){return vb(``,'width="6" height="3"')}const Sb=D.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Mn("#d11")},".cm-lintRange-warning":{backgroundImage:Mn("orange")},".cm-lintRange-info":{backgroundImage:Mn("#999")},".cm-lintRange-hint":{backgroundImage:Mn("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function Cb(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function Ab(n){let e="hint",t=1;for(let i of n){let s=Cb(i.severity);s>t&&(t=s,e=i.severity)}return e}const Mb=[Le,D.decorations.compute([Le],n=>{let{selected:e,panel:t}=n.field(Le);return!e||!t||e.from==e.to?I.none:I.set([mb.range(e.from,e.to)])}),yp(gb,{hideOn:db}),Sb],Tb=[Yd(),Xm(),Am(),zd(),V.allowMultipleSelections.of(!0),fm(),ho(Om,{fallback:!0}),W0(),lp(),cp(),Xi.of([...z0,...Zg,...og,...km,...hf,...wb])],Db=["standardSQL","msSQL","mySQL","mariaDB","sqlite","cassandra","plSQL","hive","pgSQL","gql","gpSQL","sparkSQL","esper"],Aa={python:()=>se(()=>import("./index-Dq9Y72II.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url).then(n=>n.python()),c:()=>se(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(n=>Pe.define(n.c)),cpp:()=>se(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(n=>Pe.define(n.cpp)),markdown:async()=>{const[n,e]=await Promise.all([se(()=>import("./index-o-aMX0pU.js"),__vite__mapDeps([6,7,1,8,2,3,4,5,9]),import.meta.url),se(()=>import("./frontmatter-YCXABXxZ.js"),__vite__mapDeps([10,11,2,3,4,5]),import.meta.url)]);return n.markdown({extensions:[e.frontmatter]})},latex:()=>se(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(n=>Pe.define(n.stex)),json:()=>se(()=>import("./index-1ZT9ayz1.js"),__vite__mapDeps([12,1,2,3,4,5]),import.meta.url).then(n=>n.json()),html:()=>se(()=>import("./index-rD6wvNSx.js"),__vite__mapDeps([7,1,8,2,3,4,5,9]),import.meta.url).then(n=>n.html()),css:()=>se(()=>import("./index-B2xAlaja.js"),__vite__mapDeps([8,1,2,3,4,5]),import.meta.url).then(n=>n.css()),javascript:()=>se(()=>import("./index-DYwhoY3R.js"),__vite__mapDeps([9,1,2,3,4,5]),import.meta.url).then(n=>n.javascript()),jinja2:()=>se(()=>import("./jinja2-C4DGRd-O.js"),[],import.meta.url).then(n=>Pe.define(n.jinja2)),typescript:()=>se(()=>import("./index-DYwhoY3R.js"),__vite__mapDeps([9,1,2,3,4,5]),import.meta.url).then(n=>n.javascript({typescript:!0})),yaml:()=>se(()=>import("./yaml-DsCXHVTH.js"),[],import.meta.url).then(n=>Pe.define(n.yaml)),dockerfile:()=>se(()=>import("./dockerfile-ZL4hHokT.js"),[],import.meta.url).then(n=>Pe.define(n.dockerFile)),shell:()=>se(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(n=>Pe.define(n.shell)),r:()=>se(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(n=>Pe.define(n.r)),sql:()=>se(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(n=>Pe.define(n.standardSQL)),...Object.fromEntries(Db.map(n=>["sql-"+n,()=>se(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>Pe.define(e[n]))]))},Ob={py:"python",md:"markdown",js:"javascript",ts:"typescript",sh:"shell"};async function Bb(n){const e=Aa[n]||Aa[Ob[n]]||void 0;if(e)return e()}var Lb=Mf('
    ');function $b(n,e){yf(e,!0);let t=Ee(e,"class_names",3,""),i=Ee(e,"value",15),s=Ee(e,"basic",3,!0),r=Ee(e,"lines",3,5),o=Ee(e,"max_lines",3,null),l=Ee(e,"extensions",19,()=>[]),a=Ee(e,"use_tab",3,!0),h=Ee(e,"readonly",3,!1),c=Ee(e,"placeholder",3,void 0),f=Ee(e,"wrap_lines",3,!1),u=Ee(e,"show_line_numbers",3,!0),d=Ee(e,"autocomplete",3,!1),p=Sf(void 0),m,b;async function y(E){const X=await Bb(E);Cf(p,X,!0)}us(()=>{y(e.language)}),us(()=>{To(p),h(),be()}),us(()=>{k(i())}),w();function k(E){b&&E!==b.state.doc.toString()&&b.dispatch({changes:{from:0,to:b.state.doc.length,insert:E}})}function w(){b&&b.requestMeasure({read:L})}function M(){const E=new D({parent:m,state:H(i())});return E.dom.addEventListener("focus",v,!0),E.dom.addEventListener("blur",C,!0),E}function v(){e.onfocus?.()}function C(){e.onblur?.()}function S(E){let X=E.dom.querySelectorAll(".cm-gutterElement");if(X.length===0)return null;for(var $=0;$X.annotation(Z.userEvent)!=null)}function q(E){if(!E.docChanged)return;const $=E.state.doc.toString();i($),W(E)?(e.onchange?.($),e.oninput?.()):e.onchange?.($),b.requestMeasure({read:L})}function P(){return[...K(s(),a(),c(),h(),To(p),u()),B,...oe(),...l()]}const B=D.theme({"&":{fontSize:"var(--text-sm)",backgroundColor:"var(--border-color-secondary)"},".cm-content":{paddingTop:"5px",paddingBottom:"5px",color:"var(--body-text-color)",fontFamily:"var(--font-mono)",minHeight:"100%"},".cm-gutterElement":{marginRight:"var(--spacing-xs)"},".cm-gutters":{marginRight:"1px",borderRight:"1px solid var(--border-color-primary)",backgroundColor:"var(--block-background-fill);",color:"var(--body-text-color-subdued)"},".cm-focused":{outline:"none"},".cm-scroller":{height:"auto"},".cm-cursor":{borderLeftColor:"var(--body-text-color)"}}),_=D.theme({".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:"var(--background-fill-primary)",color:"var(--body-text-color)"},"& > ul > li[aria-selected]":{backgroundColor:"var(--color-accent-soft)",color:"var(--body-text-color)"}}});function H(E){return V.create({doc:E??void 0,extensions:P()})}function K(E,X,$,ne,De,dt){const ye=[D.editable.of(!ne),V.readOnly.of(ne),D.contentAttributes.of({"aria-label":"Code input container"})];return E&&ye.push(Tb),X&&ye.push(Xi.of([{key:"Tab",run:tf},e0])),$&&ye.push(np($)),De&&ye.push(De),dt&&ye.push(Bp()),d()&&(ye.push(G0()),ye.push(_)),ye.push(D.updateListener.of(q)),f()&&ye.push(D.lineWrapping),ye}function oe(){const E=[];return e.dark_mode?E.push(sb):E.push(ub),E}function be(){b?.dispatch({effects:R.reconfigure.of(P())})}xf(()=>(b=M(),()=>b?.destroy()));var ve=Lb(),ee=Af(ve);gf(ee,E=>m=E,()=>m),Tf(ve),wf(()=>bf(ee,1,`codemirror-wrapper ${t()??""}`,"svelte-pndh99")),kf(n,ve),vf()}export{It as A,ec as B,$b as C,Lp as D,x as E,li as F,Em as G,zb as H,U as I,Vb as J,em as K,Fb as L,no as N,Jh as P,Pe as S,J as T,ke as a,N as b,_b as c,de as d,Lr as e,dm as f,tc as g,Hb as h,qb as i,Ib as j,i0 as k,Kb as l,Re as m,ci as n,qt as o,Nb as p,Xi as q,D as r,Jp as s,g as t,Fe as u,ss as v,um as w,Qh as x,Xc as y,V as z}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Code-Bg0YpSHl.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Code-Bg0YpSHl.js new file mode 100644 index 0000000000000000000000000000000000000000..2ccc71e046eab458547b73b155b33c6ee2513dfe --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Code-Bg0YpSHl.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as r,f as t}from"./index-DWyDLubb.js";var a=t('');function s(l){var o=a();r(l,o)}export{s as C}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Code-wZDUWKrz.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Code-wZDUWKrz.css new file mode 100644 index 0000000000000000000000000000000000000000..b02c69e34df6cb267919aaecedd4aaad5281b278 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Code-wZDUWKrz.css @@ -0,0 +1 @@ +.wrap.svelte-pndh99{display:flex;flex-direction:column;flex-grow:1;margin:0;padding:0;height:100%}.codemirror-wrapper.svelte-pndh99{flex-grow:1;overflow:auto}.cm-editor{height:100%}.cm-selectionBackground{background-color:#b9d2ff30!important}.cm-focused{outline:none!important} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Copy-ChCbTvli.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Copy-ChCbTvli.js new file mode 100644 index 0000000000000000000000000000000000000000..a700cfa1b6151e70c523e2224978e8c12bb84f9f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Copy-ChCbTvli.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a,f as t}from"./index-DWyDLubb.js";var h=t('');function i(r){var o=h();a(r,o)}export{i as C}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Download-Di2PsS6O.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Download-Di2PsS6O.js new file mode 100644 index 0000000000000000000000000000000000000000..28da8a48698179f4c14d64646d1550650ac997ad --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Download-Di2PsS6O.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a,f as r}from"./index-DWyDLubb.js";var t=r('');function h(o){var v=t();a(o,v)}export{h as D}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/DownloadLink-TGTaev7f.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/DownloadLink-TGTaev7f.js new file mode 100644 index 0000000000000000000000000000000000000000..a9b5d0a344aa3b872e13b0a354a32d427715722f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/DownloadLink-TGTaev7f.js @@ -0,0 +1 @@ +import{l as s,p as r,e as v,c as w,s as _,S as k}from"./i18n-Dnhn5Rxr.js";import{R as m,a4 as g,Z as y,a as b,T as $,U as d,z as D,V as S,W as x,w as z,a5 as E,Y as L}from"./index-DWyDLubb.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";var T=x("");function U(l,e){const i=s(e,["children","$$slots","$$events","$$legacy"]),c=s(i,["href","download"]);m(e,!1);let n=r(e,"href",12,void 0),o=r(e,"download",12);const f=g();var p={get href(){return n()},set href(t){n(t),d()},get download(){return o()},set download(t){o(t),d()}};v();var a=T(),u=E(()=>f.bind(null,"click"));w(a,()=>({class:"download-link","data-testid":"download-link",href:n(),target:D(()=>typeof window<"u"&&window.__is_colab__?"_blank":null),rel:"noopener noreferrer",download:o(),...c,[k]:{position:"relative"}}),void 0,void 0,void 0,"svelte-7nkusa");var h=S(a);return _(h,e,"default",{}),L(a),y("click",a,function(...t){z(u)?.apply(this,t)}),b(l,a),$(p)}export{U as D}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Dropdown--Uz_kS2s.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Dropdown--Uz_kS2s.css new file mode 100644 index 0000000000000000000000000000000000000000..698e722bbba17bb18d43d32b808ee8a18c188a0f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Dropdown--Uz_kS2s.css @@ -0,0 +1 @@ +.options.svelte-1ou0lab{--window-padding: var(--size-8);position:fixed;z-index:var(--layer-top);margin-left:0;box-shadow:var(--shadow-drop-lg);border-radius:var(--container-radius);background:var(--background-fill-primary);min-width:fit-content;max-width:inherit;overflow:auto;color:var(--body-text-color);list-style:none}.item.svelte-1ou0lab{display:flex;cursor:pointer;padding:var(--size-2);word-break:break-word}.item.svelte-1ou0lab:hover,.active.svelte-1ou0lab{background:var(--background-fill-secondary)}.inner-item.svelte-1ou0lab{padding-right:var(--size-1)}.hide.svelte-1ou0lab{visibility:hidden}.icon-wrap.svelte-1dv2vbb{color:var(--body-text-color);margin-right:var(--size-2);width:var(--size-5)}.container.svelte-1dv2vbb .wrap:where(.svelte-1dv2vbb){box-shadow:var(--input-shadow);border:var(--input-border-width) solid var(--border-color-primary)}.wrap.svelte-1dv2vbb{position:relative;border-radius:var(--input-radius);background:var(--input-background-fill)}.wrap.svelte-1dv2vbb:focus-within{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus)}.wrap-inner.svelte-1dv2vbb{display:flex;position:relative;flex-wrap:wrap;align-items:center;gap:var(--checkbox-label-gap);padding:var(--checkbox-label-padding)}.token.svelte-1dv2vbb{display:flex;align-items:center;transition:var(--button-transition);cursor:pointer;box-shadow:var(--checkbox-label-shadow);border:var(--checkbox-label-border-width) solid var(--checkbox-label-border-color);border-radius:var(--button-small-radius);background:var(--checkbox-label-background-fill);padding:var(--checkbox-label-padding);color:var(--checkbox-label-text-color);font-weight:var(--checkbox-label-text-weight);font-size:var(--checkbox-label-text-size);line-height:var(--line-md);word-break:break-word}.token.svelte-1dv2vbb>:where(.svelte-1dv2vbb)+:where(.svelte-1dv2vbb){margin-left:var(--size-2)}.token-remove.svelte-1dv2vbb{fill:var(--body-text-color);display:flex;justify-content:center;align-items:center;cursor:pointer;border:var(--checkbox-border-width) solid var(--border-color-primary);border-radius:var(--radius-full);background:var(--background-fill-primary);padding:var(--size-0-5);width:16px;height:16px;flex-shrink:0}.secondary-wrap.svelte-1dv2vbb{display:flex;flex:1 1 0%;align-items:center;border:none;min-width:min-content}input.svelte-1dv2vbb{margin:var(--spacing-sm);outline:none;border:none;background:inherit;width:var(--size-full);color:var(--body-text-color);font-size:var(--input-text-size)}input.svelte-1dv2vbb:disabled{-webkit-text-fill-color:var(--body-text-color);-webkit-opacity:1;opacity:1;cursor:not-allowed}.remove-all.svelte-1dv2vbb{margin-left:var(--size-1);width:20px;height:20px}.subdued.svelte-1dv2vbb{color:var(--body-text-color-subdued)}input[readonly].svelte-1dv2vbb{cursor:pointer}.icon-wrap.svelte-1xfsv4t{position:absolute;top:50%;transform:translateY(-50%);right:var(--size-5);color:var(--body-text-color);width:var(--size-5);pointer-events:none}.container.svelte-1xfsv4t{height:100%}.container.svelte-1xfsv4t .wrap:where(.svelte-1xfsv4t){box-shadow:var(--input-shadow);border:var(--input-border-width) solid var(--border-color-primary)}.wrap.svelte-1xfsv4t{position:relative;border-radius:var(--input-radius);background:var(--input-background-fill)}.wrap.svelte-1xfsv4t:focus-within{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus);background:var(--input-background-fill-focus)}.wrap-inner.svelte-1xfsv4t{display:flex;position:relative;flex-wrap:wrap;align-items:center;gap:var(--checkbox-label-gap);padding:var(--checkbox-label-padding);height:100%}.secondary-wrap.svelte-1xfsv4t{display:flex;flex:1 1 0%;align-items:center;border:none;min-width:min-content;height:100%}input.svelte-1xfsv4t{margin:var(--spacing-sm);outline:none;border:none;background:inherit;width:var(--size-full);color:var(--body-text-color);font-size:var(--input-text-size);height:100%}input.svelte-1xfsv4t:disabled{-webkit-text-fill-color:var(--body-text-color);-webkit-opacity:1;opacity:1;cursor:not-allowed}.subdued.svelte-1xfsv4t{color:var(--body-text-color-subdued)}input[readonly].svelte-1xfsv4t{cursor:pointer} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Dropdown-Beu8JVME.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Dropdown-Beu8JVME.js new file mode 100644 index 0000000000000000000000000000000000000000..7380596ee94ca546ddd759aa8f85aa541c68f69f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Dropdown-Beu8JVME.js @@ -0,0 +1 @@ +import{p as s,d as oe,i as re,k as he,b as Y,a as Z,f as ie,u as we,t as ge}from"./i18n-Dnhn5Rxr.js";import{R as de,y as se,w as e,x as t,Z as ee,S as ye,a as W,T as ce,u as m,aw as pe,X as U,W as F,aj as fe,V as N,Y as z,t as te,a0 as _e,v as ue,a7 as xe,a5 as X,M as ke,at as Ae,a8 as De}from"./index-DWyDLubb.js";import{b as Te}from"./input-DrerMDOL.js";import{t as Oe,a as Ee}from"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{b as Be}from"./window-Uydxco8n.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as Ce}from"./BlockTitle-BMm9LakX.js";import{D as Ie}from"./DropdownArrow-BOSZEGSp.js";import{I as Re}from"./IconButtonWrapper-D0s9l4wW.js";var Se=F('
  • ✓
  • '),ze=F('
      '),He=F('
      ',1);function Le(b,l){de(l,!0);let i=s(l,"show_options",3,!1),E=s(l,"disabled",3,!1),p=s(l,"selected_indices",19,()=>[]),o=s(l,"active_index",3,null),D=s(l,"remember_scroll",3,!1),le=s(l,"offset_from_top",3,0),j=s(l,"from_top",3,!1),C=m(0),T=m(0),q=m(0),I=m(0),R,c,f=m(null),x=m(null),g=m(0),a=m(0),r=0;function H(){const{top:_,bottom:v}=R.getBoundingClientRect();j()?t(C,le()):t(C,_,!0),t(T,e(a)-v)}let L=null;function M(){i()&&(L!==null&&clearTimeout(L),L=setTimeout(()=>{H(),L=null},10))}function O(){c?.scrollTo?.(0,r)}se(()=>{if(i()&&R){if(D())O();else if(c&&p().length>0){let v=c.querySelectorAll("li");for(const B of Array.from(v))if(B.getAttribute("data-index")===p()[0].toString()){c?.scrollTo?.(0,B.offsetTop);break}}H();const _=R.parentElement?.getBoundingClientRect();t(q,_?.height||0,!0),t(I,_?.width||0,!0),l.onload?.()}e(T)>e(C)||j()?(t(f,`${e(C)}px`),t(g,e(T),!0),t(x,null)):(t(x,`${e(T)+e(q)}px`),t(g,e(C)-e(q)),t(f,null))});var u=He();ee("scroll",pe,M);var G=ye(u);oe(G,_=>R=_,()=>R);var ne=U(G,2);{var ae=_=>{var v=ze();v.__mousedown=h=>{h.preventDefault(),l.onchange?.(h.target.dataset.index)};let B;he(v,21,()=>l.filtered_indices,we,(h,y)=>{var k=Se();let J,P;var V=N(k);let S;var K=U(V);z(k),te((Q,d,$)=>{J=Y(k,1,"item svelte-1ou0lab",null,J,Q),Z(k,"data-index",e(y)),Z(k,"aria-label",l.choices[e(y)][0]),Z(k,"aria-selected",d),P=ie(k,"",P,{width:e(I)+"px"}),S=Y(V,1,"inner-item svelte-1ou0lab",null,S,$),_e(K,` ${l.choices[e(y)][0]??""}`)},[()=>({selected:p().includes(e(y)),active:e(y)===o(),"bg-gray-100":e(y)===o(),"dark:bg-gray-600":e(y)===o()}),()=>p().includes(e(y)),()=>({hide:!p().includes(e(y))})]),W(h,k)}),z(v),oe(v,h=>c=h,()=>c),te(()=>B=ie(v,"",B,{top:e(f),bottom:e(x),"max-height":`calc(${e(g)}px - var(--window-padding))`,width:e(I)+"px"})),ee("scroll",v,h=>r=h.currentTarget.scrollTop),Oe(3,v,()=>Ee,()=>({duration:200,y:5})),W(_,v)};re(ne,_=>{i()&&!E()&&_(ae)})}Be("innerHeight",_=>t(a,_,!0)),W(b,u),ce()}fe(["mousedown"]);function Ne(b,l){return(b%l+l)%l}function Ue(b,l){return b.reduce((i,E,p)=>((!l||E[0].toLowerCase().includes(l.toLowerCase()))&&i.push(p),i),[])}function We(b,l,i){if(b.key==="Escape")return[!1,l];if((b.key==="ArrowDown"||b.key==="ArrowUp")&&i.length>0)if(l===null)l=b.key==="ArrowDown"?i[0]:i[i.length-1];else{const E=i.indexOf(l),p=b.key==="ArrowUp"?-1:1;l=i[Ne(E+p,i.length)]}return[!0,l]}var je=F('
      '),qe=F('
      ');function Ke(b,l){de(l,!0);const i=typeof window<"u";let E=s(l,"label",3,"Dropdown"),p=s(l,"info",3,void 0),o=s(l,"value",15),D=s(l,"choices",19,()=>[]),le=s(l,"interactive",3,!0),j=s(l,"show_label",3,!0),C=s(l,"container",3,!0),T=s(l,"allow_custom_value",3,!1),q=s(l,"filterable",3,!0),I=s(l,"buttons",3,null),R=s(l,"oncustom_button_click",3,null),c,f=X(()=>i&&c===document.activeElement),x=X(()=>D().map(n=>n[0])),g=X(()=>D().map(n=>n[1])),a=m(""),r=m(null);se(()=>{o()===void 0||o()===null||Array.isArray(o())&&o().length===0?(t(a,""),t(r,null)):e(g).includes(o())?(t(a,e(x)[e(g).indexOf(o())],!0),t(r,e(g).indexOf(o()),!0)):T()?(t(a,o(),!0),t(r,null)):(t(a,""),t(r,null))});let H=e(a),L=m(!1),M=X(()=>!le()),O=m(ue(D().map((n,w)=>w))),u=m(null),G=X(()=>e(r)===null?[]:[e(r)]);function ne(n){if(t(r,parseInt(n),!0),isNaN(e(r))){t(r,null);return}let[w,A]=D()[e(r)];t(a,w,!0),H=e(a),o(A),l.on_select?.({index:e(r),value:e(g)[e(r)],selected:!0}),t(f,!1),t(u,null),l.on_input?.(),c.blur()}function ae(n){t(O,D().map((w,A)=>A),!0),t(f,!0),l.on_focus?.()}function _(){T()?e(x).includes(e(a))?(t(r,e(x).indexOf(e(a)),!0),o(e(g)[e(r)])):e(a)!==H&&(o(e(a)),t(r,null)):t(a,e(x)[e(g).indexOf(o())],!0),t(f,!1),t(u,null),t(O,D().map((n,w)=>w),!0),l.on_blur?.(),l.on_input?.()}async function v(n){await ke(),t(O,Ue(D(),e(a)),!0),t(u,e(O).length>0?e(O)[0]:null,!0),(w=>{var A=Ae(w,2);t(f,A[0]),t(u,A[1],!0)})(We(n,e(u),e(O))),n.key==="Enter"&&(H=e(a),e(u)!==null?(t(r,e(u),!0),o(e(g)[e(u)]),t(f,!1),c.blur(),t(u,null)):e(x).includes(e(a))?(t(r,e(x).indexOf(e(a)),!0),o(e(g)[e(r)]),t(f,!1),t(u,null),c.blur()):T()&&(o(e(a)),t(r,null),t(f,!1),t(u,null),c.blur()))}let B=m(ue(o()));se(()=>{e(B)!==o()&&(t(B,o(),!0),l.on_change?.(o()))});var h=qe();let y;var k=N(h);{var J=n=>{Re(n,{get buttons(){return I()},get on_custom_button_click(){return R()}})};re(k,n=>{j()&&I()&&I().length>0&&n(J)})}var P=U(k,2);Ce(P,{get show_label(){return j()},get info(){return p()},children:(n,w)=>{De();var A=xe();te(()=>_e(A,E())),W(n,A)},$$slots:{default:!0}});var V=U(P,2),S=N(V);let K;var Q=N(S),d=N(Q);ge(d);let $;d.__keydown=v,d.__keyup=n=>{l.on_key_up?.({key:n.key,input_value:e(a)})},oe(d,n=>c=n,()=>c);var ve=U(d,2);{var me=n=>{var w=je(),A=N(w);Ie(A),z(w),W(n,w)};re(ve,n=>{e(M)||n(me)})}z(Q),z(S);var be=U(S,2);Le(be,{get show_options(){return e(f)},get choices(){return D()},get filtered_indices(){return e(O)},get disabled(){return e(M)},get selected_indices(){return e(G)},get active_index(){return e(u)},onchange:ne,onload:()=>t(L,!0)}),z(V),z(h),te(n=>{y=Y(h,1,"svelte-1xfsv4t",null,y,{container:C()}),K=Y(S,1,"wrap-inner svelte-1xfsv4t",null,K,{show_options:e(f)}),Z(d,"aria-expanded",e(f)),Z(d,"aria-label",E()),$=Y(d,1,"border-none svelte-1xfsv4t",null,$,n),d.disabled=e(M),d.readOnly=!q()},[()=>({subdued:!e(x).includes(e(a))&&!T()})]),ee("blur",d,_),ee("focus",d,ae),Te(d,()=>e(a),n=>t(a,n)),W(b,h),ce()}fe(["keydown","keyup"]);export{Le as D,Ue as a,Ke as b,We as h}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/DropdownArrow-BOSZEGSp.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/DropdownArrow-BOSZEGSp.js new file mode 100644 index 0000000000000000000000000000000000000000..46f62dc596d0e3aa2abe8d431de83da527b67e1e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/DropdownArrow-BOSZEGSp.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as t,f as s}from"./index-DWyDLubb.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";var a=s('');function g(o){var r=a();t(o,r)}export{g as D}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_lights_area-CaG6NvhR.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_lights_area-CaG6NvhR.js new file mode 100644 index 0000000000000000000000000000000000000000..0f1dd20ea8dda3b3a9a9faa3ab9104ac6fb234f3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_lights_area-CaG6NvhR.js @@ -0,0 +1 @@ +import{d as L,aI as g,T as u,L as w,V as n,an as R,_ as b,s as E,R as D,C as y,bh as S,ao as B,aG as z,aH as F}from"./index-CDrXokXW.js";import{R as x}from"./rawTexture-DYLCXHMF.js";import{ArrayItem as A,GLTFLoader as C}from"./glTFLoader-Bp7IfGPK.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";async function M(){const i=new Uint16Array(16384),t=new Uint16Array(4096*4),s=await L.LoadFileAsync(L.GetAssetUrl("https://assets.babylonjs.com/core/areaLights/areaLightsLTC.bin")),e=new Uint16Array(s),a=e.length/8;for(let r=0;r{i._ltcTextures&&((i._ltcTextures?.LTC1).update(e[0]),(i._ltcTextures?.LTC2).update(e[1]),i.onDisposeObservable.addOnce(()=>{i._ltcTextures?.LTC1.dispose(),i._ltcTextures?.LTC2.dispose()}))}).catch(e=>{w.Error(`Area Light fail to get LTC textures data. Error: ${e}`)})}class U extends g{constructor(t,s,e,a){super(t,e,a),this.position=s,this._scene._ltcTextures||P(this._scene)}transferTexturesToEffect(t){return this._scene._ltcTextures&&(t.setTexture("areaLightsLTC1Sampler",this._scene._ltcTextures.LTC1),t.setTexture("areaLightsLTC2Sampler",this._scene._ltcTextures.LTC2)),this}prepareLightSpecificDefines(t,s){t["AREALIGHT"+s]=!0,t.AREALIGHTUSED=!0}_isReady(){return this._scene._ltcTextures?this._scene._ltcTextures.LTC1.isReady()&&this._scene._ltcTextures.LTC2.isReady():!1}}R.AddNodeConstructor("Light_Type_4",(i,t)=>()=>new l(i,n.Zero(),1,1,t));class l extends U{get width(){return this._width.x}set width(t){this._width.x=t}get height(){return this._height.y}set height(t){this._height.y=t}constructor(t,s,e,a,r,f){super(t,s,r,f),this._width=new n(e,0,0),this._height=new n(0,a,0),this._pointTransformedPosition=n.Zero(),this._pointTransformedWidth=n.Zero(),this._pointTransformedHeight=n.Zero()}getClassName(){return"RectAreaLight"}getTypeID(){return g.LIGHTTYPEID_RECT_AREALIGHT}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightWidth",4),this._uniformBuffer.addUniform("vLightHeight",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}_computeTransformedInformation(){return this.parent&&this.parent.getWorldMatrix?(n.TransformCoordinatesToRef(this.position,this.parent.getWorldMatrix(),this._pointTransformedPosition),n.TransformNormalToRef(this._width,this.parent.getWorldMatrix(),this._pointTransformedWidth),n.TransformNormalToRef(this._height,this.parent.getWorldMatrix(),this._pointTransformedHeight),!0):!1}transferToEffect(t,s){const e=this._scene.floatingOriginOffset;return this._computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this._pointTransformedPosition.x-e.x,this._pointTransformedPosition.y-e.y,this._pointTransformedPosition.z-e.z,0,s),this._uniformBuffer.updateFloat4("vLightWidth",this._pointTransformedWidth.x/2,this._pointTransformedWidth.y/2,this._pointTransformedWidth.z/2,0,s),this._uniformBuffer.updateFloat4("vLightHeight",this._pointTransformedHeight.x/2,this._pointTransformedHeight.y/2,this._pointTransformedHeight.z/2,0,s)):(this._uniformBuffer.updateFloat4("vLightData",this.position.x-e.x,this.position.y-e.y,this.position.z-e.z,0,s),this._uniformBuffer.updateFloat4("vLightWidth",this._width.x/2,this._width.y/2,this._width.z/2,0,s),this._uniformBuffer.updateFloat4("vLightHeight",this._height.x/2,this._height.y/2,this._height.z/2,0,s)),this}transferToNodeMaterialEffect(t,s){const e=this._scene.floatingOriginOffset;return this._computeTransformedInformation()?t.setFloat3(s,this._pointTransformedPosition.x-e.x,this._pointTransformedPosition.y-e.y,this._pointTransformedPosition.z-e.z):t.setFloat3(s,this.position.x-e.x,this.position.y-e.y,this.position.z-e.z),this}}b([E()],l.prototype,"width",null);b([E()],l.prototype,"height",null);D("BABYLON.RectAreaLight",l);const c="EXT_lights_area";class v{constructor(t){this.name=c,this._loader=t,this.enabled=this._loader.isExtensionUsed(c)}dispose(){this._loader=null,delete this._lights}onLoading(){const t=this._loader.gltf.extensions;if(t&&t[this.name]){const s=t[this.name];this._lights=s.lights,A.Assign(this._lights)}}loadNodeAsync(t,s,e){return C.LoadExtensionAsync(t,s,this.name,async(a,r)=>(this._loader._allMaterialsDirtyRequired=!0,await this._loader.loadNodeAsync(t,s,f=>{let h;const o=A.Get(a,this._lights,r.light),T=o.name||f.name;this._loader.babylonScene._blockEntityCollection=!!this._loader._assetContainer;const d=o.size!==void 0?o.size:1;switch(o.type){case"rect":{const _=o.rect?.aspect!==void 0?o.rect.aspect*d:d,m=d;h=new l(T,n.Zero(),_,m,this._loader.babylonScene);break}case"disk":{const _=Math.sqrt(d*d*.25*Math.PI);h=new l(T,n.Zero(),_,_,this._loader.babylonScene);break}default:throw this._loader.babylonScene._blockEntityCollection=!1,new Error(`${a}: Invalid area light type (${o.type})`)}h._parentContainer=this._loader._assetContainer,this._loader.babylonScene._blockEntityCollection=!1,o._babylonLight=h,h.falloffType=g.FALLOFF_GLTF,h.diffuse=o.color?y.FromArray(o.color):y.White(),h.intensity=o.intensity==null?1:o.intensity;const p=new S(`${T}_orientation`,this._loader.babylonScene);p.rotationQuaternion=B.RotationAxis(n.Up(),Math.PI),p.parent=f,h.parent=p,this._loader._babylonLights.push(h),C.AddPointerMetadata(h,a),e(f)})))}}z(c);F(c,!0,i=>new v(i));export{v as EXT_lights_area}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_lights_ies-uJl7poYh.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_lights_ies-uJl7poYh.js new file mode 100644 index 0000000000000000000000000000000000000000..5ab410a48b6b70231e1f8b97b1731df7a5c3924c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_lights_ies-uJl7poYh.js @@ -0,0 +1 @@ +import{V as f,aI as b,C as _,T as y,aG as p,aH as L}from"./index-CDrXokXW.js";import{a as A}from"./objectModelMapping-CGWnurZP.js";import{ArrayItem as l,GLTFLoader as u}from"./glTFLoader-Bp7IfGPK.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";const n="EXT_lights_ies";class w{constructor(i){this.name=n,this._loader=i,this.enabled=this._loader.isExtensionUsed(n)}dispose(){this._loader=null,delete this._lights}onLoading(){const i=this._loader.gltf.extensions;if(i&&i[this.name]){const r=i[this.name];this._lights=r.lights,l.Assign(this._lights)}}loadNodeAsync(i,r,c){return u.LoadExtensionAsync(i,r,this.name,async(h,a)=>{this._loader._allMaterialsDirtyRequired=!0;let e,t;const m=await this._loader.loadNodeAsync(i,r,s=>{t=l.Get(h,this._lights,a.light);const g=t.name||s.name;this._loader.babylonScene._blockEntityCollection=!!this._loader._assetContainer,e=new A(g,f.Zero(),f.Backward(),0,1,this._loader.babylonScene),e.angle=Math.PI/2,e.innerAngle=0,e._parentContainer=this._loader._assetContainer,this._loader.babylonScene._blockEntityCollection=!1,t._babylonLight=e,e.falloffType=b.FALLOFF_GLTF,e.diffuse=a.color?_.FromArray(a.color):_.White(),e.intensity=a.multiplier||1,e.range=Number.MAX_VALUE,e.parent=s,this._loader._babylonLights.push(e),u.AddPointerMetadata(e,h),c(s)});let o;if(t.uri)o=await this._loader.loadUriAsync(i,t,t.uri);else{const s=l.Get(`${i}/bufferView`,this._loader.gltf.bufferViews,t.bufferView);o=await this._loader.loadBufferViewAsync(`/bufferViews/${s.index}`,s)}return e.iesProfileTexture=new y(name+"_iesProfile",this._loader.babylonScene,!0,!1,void 0,null,null,o,!0,void 0,void 0,void 0,void 0,".ies"),m})}}p(n);L(n,!0,d=>new w(d));export{w as EXT_lights_ies}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_lights_image_based-BkkYWPdh.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_lights_image_based-BkkYWPdh.js new file mode 100644 index 0000000000000000000000000000000000000000..ed0ba82ea1ee604e18bd236b4a4b75fe3ce19508 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_lights_image_based-BkkYWPdh.js @@ -0,0 +1 @@ +import{e as y,ao as u,M as g,bj as f,ay as x,aG as b,aH as A}from"./index-CDrXokXW.js";import{_ as w}from"./environmentTextureTools-BFR5JSi6.js";import{CubeTexture as T}from"./cubeTexture-BcGycaMd.js";import{GLTFLoader as S,ArrayItem as h}from"./glTFLoader-Bp7IfGPK.js";import"./index-DWyDLubb.js";import"./dumpTools-C3pGK_mZ.js";import"./abstractEngine.cubeTexture-BasnejWx.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";class m extends T{constructor(t,e,a,n=5,r=0,s=!1,o=!1,l=3,i=null){super("",t),this._texture=t.getEngine().createRawCubeTexture(e,a,n,r,s,o,l,i)}update(t,e,a,n,r=null){this._texture.getEngine().updateRawCubeTexture(this._texture,t,e,a,n,r)}updateRGBDAsync(t,e=null,a=.8,n=0){return w(this._texture,t,e,a,n).then(()=>{})}clone(){return y.Clone(()=>{const t=this.getScene(),e=this._texture,a=new m(t,e._bufferViewArray,e.width,e.format,e.type,e.generateMipMaps,e.invertY,e.samplingMode,e._compression);return e.source===13&&a.updateRGBDAsync(e._bufferViewArrayArray,e._sphericalPolynomial,e._lodGenerationScale,e._lodGenerationOffset),a},this)}}const c="EXT_lights_image_based";class G{constructor(t){this.name=c,this._loader=t,this.enabled=this._loader.isExtensionUsed(c)}dispose(){this._loader=null,delete this._lights}onLoading(){const t=this._loader.gltf.extensions;if(t&&t[this.name]){const e=t[this.name];this._lights=e.lights}}loadSceneAsync(t,e){return S.LoadExtensionAsync(t,e,this.name,async(a,n)=>{this._loader._allMaterialsDirtyRequired=!0;const r=new Array;r.push(this._loader.loadSceneAsync(t,e)),this._loader.logOpen(`${a}`);const s=h.Get(`${a}/light`,this._lights,n.light);return r.push(this._loadLightAsync(`/extensions/${this.name}/lights/${n.light}`,s).then(o=>{this._loader.babylonScene.environmentTexture=o})),this._loader.logClose(),await Promise.all(r).then(()=>{})})}_loadLightAsync(t,e){if(!e._loaded){const a=new Array;this._loader.logOpen(`${t}`);const n=new Array(e.specularImages.length);for(let r=0;r{n[r][o]=_})),this._loader.logClose()}}this._loader.logClose(),e._loaded=Promise.all(a).then(async()=>{const r=new m(this._loader.babylonScene,null,e.specularImageSize);if(r.name=e.name||"environment",e._babylonTexture=r,e.intensity!=null&&(r.level=e.intensity),e.rotation){let i=u.FromArray(e.rotation);this._loader.babylonScene.useRightHandedSystem||(i=u.Inverse(i)),g.FromQuaternionToRef(i,r.getReflectionTextureMatrix())}if(!e.irradianceCoefficients)throw new Error(`${t}: Irradiance coefficients are missing`);const s=f.FromArray(e.irradianceCoefficients);s.scaleInPlace(e.intensity),s.convertIrradianceToLambertianRadiance();const o=x.FromHarmonics(s),l=(n.length-1)/Math.log2(e.specularImageSize);return await r.updateRGBDAsync(n,o,l)})}return e._loaded.then(()=>e._babylonTexture)}}b(c);A(c,!0,d=>new G(d));export{G as EXT_lights_image_based}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_mesh_gpu_instancing-Dk4bl8lI.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_mesh_gpu_instancing-Dk4bl8lI.js new file mode 100644 index 0000000000000000000000000000000000000000..51a5620939e00385d2d64c1012cd9df09dc52bbf --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_mesh_gpu_instancing-Dk4bl8lI.js @@ -0,0 +1 @@ +import{c as r,V as A,ao as F,M as b,L as g,aG as L,aH as M}from"./index-CDrXokXW.js";import{GLTFLoader as V,ArrayItem as w}from"./glTFLoader-Bp7IfGPK.js";import"./thinInstanceMesh-BDN_yrTe.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const c="EXT_mesh_gpu_instancing";class B{constructor(l){this.name=c,this._loader=l,this.enabled=this._loader.isExtensionUsed(c)}dispose(){this._loader=null}loadNodeAsync(l,s,T){return V.LoadExtensionAsync(l,s,this.name,async(m,h)=>{this._loader._disableInstancedMesh++;const p=this._loader.loadNodeAsync(`/nodes/${s.index}`,s,T);if(this._loader._disableInstancedMesh--,!s._primitiveBabylonMeshes)return await p;const u=new Array;let t=0;const i=a=>{if(h.attributes[a]==null){u.push(Promise.resolve(null));return}const o=w.Get(`${m}/attributes/${a}`,this._loader.gltf.accessors,h.attributes[a]);if(u.push(this._loader._loadFloatAccessorAsync(`/accessors/${o.bufferView}`,o)),t===0)t=o.count;else if(t!==o.count)throw new Error(`${m}/attributes: Instance buffer accessors do not have the same count.`)};return i("TRANSLATION"),i("ROTATION"),i("SCALE"),i("_COLOR_0"),await p.then(async a=>{const[o,d,_,n]=await Promise.all(u),y=new Float32Array(t*16);r.Vector3[0].copyFromFloats(0,0,0),r.Quaternion[0].copyFromFloats(0,0,0,1),r.Vector3[1].copyFromFloats(1,1,1);for(let e=0;enew B(f));export{B as EXT_mesh_gpu_instancing}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_meshopt_compression-C80C3Ae6.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_meshopt_compression-C80C3Ae6.js new file mode 100644 index 0000000000000000000000000000000000000000..07dd341becd7d8c38f8a4ccbf29a0844bbc3d163 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_meshopt_compression-C80C3Ae6.js @@ -0,0 +1 @@ +import{GLTFLoader as m,ArrayItem as h}from"./glTFLoader-Bp7IfGPK.js";import{d as n,aG as p,aH as y}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";let i=0,u=null;class r{static get Default(){return r._Default||(r._Default=new r),r._Default}constructor(){const e=r.Configuration.decoder;this._decoderModulePromise=n.LoadBabylonScriptAsync(e.url).then(()=>MeshoptDecoder.ready)}dispose(){delete this._decoderModulePromise}async decodeGltfBufferAsync(e,s,l,t,o){await this._decoderModulePromise,i===0&&(MeshoptDecoder.useWorkers(1),i=1);const a=await MeshoptDecoder.decodeGltfBufferAsync(s,l,e,t,o);return u!==null&&clearTimeout(u),u=setTimeout(()=>{MeshoptDecoder.useWorkers(0),i=0,u=null},1e3),a}}r.Configuration={decoder:{url:`${n._DefaultCdnUrl}/meshopt_decoder.js`}};r._Default=null;const d="EXT_meshopt_compression";class _{constructor(e){this.name=d,this.enabled=e.isExtensionUsed(d),this._loader=e}dispose(){this._loader=null}loadBufferViewAsync(e,s){return m.LoadExtensionAsync(e,s,this.name,async(l,t)=>{const o=s;if(o._meshOptData)return await o._meshOptData;const a=h.Get(`${e}/buffer`,this._loader.gltf.buffers,t.buffer);return o._meshOptData=this._loader.loadBufferAsync(`/buffers/${a.index}`,a,t.byteOffset||0,t.byteLength).then(async c=>await r.Default.decodeGltfBufferAsync(c,t.count,t.byteStride,t.mode,t.filter)),await o._meshOptData})}}p(d);y(d,!0,f=>new _(f));export{_ as EXT_meshopt_compression}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_texture_avif-D-6Hx_6U.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_texture_avif-D-6Hx_6U.js new file mode 100644 index 0000000000000000000000000000000000000000..51ffcef49bd1e52bee165b6b60430968a7026f46 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_texture_avif-D-6Hx_6U.js @@ -0,0 +1 @@ +import{GLTFLoader as a,ArrayItem as o}from"./glTFLoader-Bp7IfGPK.js";import{aG as u,aH as _}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const s="EXT_texture_avif";class c{constructor(e){this.name=s,this._loader=e,this.enabled=e.isExtensionUsed(s)}dispose(){this._loader=null}_loadTextureAsync(e,r,i){return a.LoadExtensionAsync(e,r,this.name,async(n,m)=>{const l=r.sampler==null?a.DefaultSampler:o.Get(`${e}/sampler`,this._loader.gltf.samplers,r.sampler),p=o.Get(`${n}/source`,this._loader.gltf.images,m.source);return await this._loader._createTextureAsync(e,l,p,d=>{i(d)},void 0,!r._textureInfo.nonColorData)})}}u(s);_(s,!0,t=>new c(t));export{c as EXT_texture_avif}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_texture_webp-ARKFdfJg.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_texture_webp-ARKFdfJg.js new file mode 100644 index 0000000000000000000000000000000000000000..91ab7fd6a6eb654be32bb7f8747aabff22223131 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/EXT_texture_webp-ARKFdfJg.js @@ -0,0 +1 @@ +import{GLTFLoader as o,ArrayItem as a}from"./glTFLoader-Bp7IfGPK.js";import{aG as u,aH as _}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const s="EXT_texture_webp";class c{constructor(e){this.name=s,this._loader=e,this.enabled=e.isExtensionUsed(s)}dispose(){this._loader=null}_loadTextureAsync(e,r,i){return o.LoadExtensionAsync(e,r,this.name,async(n,m)=>{const l=r.sampler==null?o.DefaultSampler:a.Get(`${e}/sampler`,this._loader.gltf.samplers,r.sampler),p=a.Get(`${n}/source`,this._loader.gltf.images,m.source);return await this._loader._createTextureAsync(e,l,p,d=>{i(d)},void 0,!r._textureInfo.nonColorData)})}}u(s);_(s,!0,t=>new c(t));export{c as EXT_texture_webp}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Edit-D-unDhOb.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Edit-D-unDhOb.js new file mode 100644 index 0000000000000000000000000000000000000000..7ad4156201ea91897cd3829cd99f1f7c6feeb3a3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Edit-D-unDhOb.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as r,f as e}from"./index-DWyDLubb.js";var s=e('');function n(t){var o=s();r(t,o)}export{n as E}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Empty-BIB2W5at.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Empty-BIB2W5at.js new file mode 100644 index 0000000000000000000000000000000000000000..b1a6cdacc07c0cc96da1d3230e65cfee6119520e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Empty-BIB2W5at.js @@ -0,0 +1 @@ +import{p as _,s as z,d as E,b as R}from"./i18n-Dnhn5Rxr.js";import{R as B,a1 as C,w as r,a2 as w,x as u,t as S,a as T,T as U,a3 as c,U as m,V as f,W as V,Y as g}from"./index-DWyDLubb.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";var W=V('
      ');function q(h,a){B(a,!1);const i=c();let s=_(a,"size",12,"small"),n=_(a,"unpadded_box",12,!1),l=c();function v(e){if(!e)return!1;const{height:p}=e.getBoundingClientRect(),{height:y}=e.parentElement?.getBoundingClientRect()||{height:p};return p>y+2}C(()=>r(l),()=>{u(i,v(r(l)))}),w();var b={get size(){return s()},set size(e){s(e),m()},get unpadded_box(){return n()},set unpadded_box(e){n(e),m()}},t=W();let d;var o=f(t),x=f(o);return z(x,a,"default",{}),g(o),g(t),E(t,e=>u(l,e),()=>r(l)),S(()=>d=R(t,1,"empty svelte-v95lt3",null,d,{small:s()==="small",large:s()==="large",unpadded_box:n(),small_parent:r(i)})),T(h,t),U(b)}export{q as E}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example--V2chS2k.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example--V2chS2k.css new file mode 100644 index 0000000000000000000000000000000000000000..4aaf8e123e1f40dcbaf442636d26cbdc647db0dd --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example--V2chS2k.css @@ -0,0 +1 @@ +ul.svelte-14aa7hi{white-space:nowrap;max-height:100px;list-style:none;padding:0;margin:0}.extra.svelte-14aa7hi{text-align:center}.gallery.svelte-14aa7hi{align-items:center;cursor:pointer;padding:var(--size-1) var(--size-2);text-align:left} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-4NTZ2aku.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-4NTZ2aku.css new file mode 100644 index 0000000000000000000000000000000000000000..2f27c83449ce1dc370387e4c2a83879578b8f321 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-4NTZ2aku.css @@ -0,0 +1 @@ +.container.svelte-1nl1glk{flex:none;max-width:none}.container.svelte-1nl1glk video{width:var(--size-full);height:var(--size-full);object-fit:cover}.container.svelte-1nl1glk:hover,.container.selected.svelte-1nl1glk{border-color:var(--border-color-accent)}.container.table.svelte-1nl1glk{margin:0 auto;border:2px solid var(--border-color-primary);border-radius:var(--radius-lg);overflow:hidden;width:var(--size-20);height:var(--size-20);object-fit:cover}.container.gallery.svelte-1nl1glk{height:var(--size-20);max-height:var(--size-20);object-fit:cover} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-7veL-tTh.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-7veL-tTh.js new file mode 100644 index 0000000000000000000000000000000000000000..3081c6dff115a2d69fee57bebd9006259cf4a870 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-7veL-tTh.js @@ -0,0 +1 @@ +import{p as o,e as m,i as f,b as v}from"./i18n-Dnhn5Rxr.js";import{R as g,t as y,a as b,T as _,U as i,W as h,V as x,G as k,z as I,Y as z}from"./index-DWyDLubb.js";import{I as E}from"./Image-CeW7PJs4.js";/* empty css */import"./misc-vsnLZ-Y1.js";/* empty css */var G=h("
      ");function Y(u,a){g(a,!1);let t=o(a,"value",12),s=o(a,"type",12),l=o(a,"selected",12,!1);var c={get value(){return t()},set value(e){t(e),i()},get type(){return s()},set type(e){s(e),i()},get selected(){return l()},set selected(e){l(e),i()}};m();var r=G();let p;var d=x(r);{var n=e=>{E(e,{get src(){return k(t()),I(()=>t().url)},alt:""})};f(d,e=>{t()&&e(n)})}return z(r),y(()=>p=v(r,1,"container svelte-bs74gu",null,p,{table:s()==="table",gallery:s()==="gallery",selected:l(),border:t()})),b(u,r),_(c)}export{Y as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-B0koE8za.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-B0koE8za.js new file mode 100644 index 0000000000000000000000000000000000000000..2a44e46421b0e54b56fa64483696858b45996e26 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-B0koE8za.js @@ -0,0 +1 @@ +import{p as u,f,b as v}from"./i18n-Dnhn5Rxr.js";import{R as n,t as m,a as y,T as g,U as c,W as i}from"./index-DWyDLubb.js";var b=i("
      ");function k(p,t){n(t,!1);let l=u(t,"value",12),a=u(t,"type",12),s=u(t,"selected",12,!1);var d={get value(){return l()},set value(e){l(e),c()},get type(){return a()},set type(e){a(e),c()},get selected(){return s()},set selected(e){s(e),c()}},r=b();let o;return m(()=>{f(r,`background-color: ${(l()?l():"black")??""}`),o=v(r,1,"svelte-1k1s8qu",null,o,{table:a()==="table",gallery:a()==="gallery",selected:s()})}),y(p,r),g(d)}export{k as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-B9bhmUl8.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-B9bhmUl8.js new file mode 100644 index 0000000000000000000000000000000000000000..1214cfde9ba94fcda68e4f024fad948b55845dde --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-B9bhmUl8.js @@ -0,0 +1 @@ +import{p as E,e as O,i as c,b as P,k as Q,a as G,u as Z}from"./i18n-Dnhn5Rxr.js";import{R as $,t as x,a as v,T as aa,U as R,W as o,G as T,z as s,V as p,a6 as Y,S as j,w as e,X as U,Y as _,a0 as A}from"./index-DWyDLubb.js";var ea=o(' '),sa=o('
      '),ra=o(' '),ta=o('
      ',2),va=o('
      …
      '),la=o('
      '),da=o("
      ");function ia(B,q){$(q,!1);let r=E(q,"value",12),h=E(q,"type",12),b=E(q,"selected",12,!1);var C={get value(){return r()},set value(t){r(t),R()},get type(){return h()},set type(t){h(t),R()},get selected(){return b()},set selected(t){b(t),R()}};O();var y=da();let V;var D=p(y);{var F=t=>{var m=la(),W=p(m);Q(W,1,()=>(T(r()),s(()=>r().slice(0,3))),Z,(u,a)=>{var X=Y(),J=j(X);{var K=n=>{var i=sa(),f=p(i),k=U(f,2);{var g=d=>{var l=ea(),w=p(l,!0);_(l),x(()=>A(w,(e(a),s(()=>e(a).caption)))),v(d,l)};c(k,d=>{e(a),s(()=>e(a).caption)&&d(g)})}_(i),x(()=>{G(f,"src",(e(a),s(()=>e(a).image.url))),G(f,"alt",(e(a),s(()=>e(a).caption||"")))}),v(n,i)},L=n=>{var i=Y(),f=j(i);{var k=g=>{var d=ta(),l=p(d);l.controls=!1,l.muted=!0;var w=U(l,2);{var M=S=>{var z=ra(),N=p(z,!0);_(z),x(()=>A(N,(e(a),s(()=>e(a).caption)))),v(S,z)};c(w,S=>{e(a),s(()=>e(a).caption)&&S(M)})}_(d),x(()=>G(l,"src",(e(a),s(()=>e(a).video.url)))),v(g,d)};c(f,g=>{e(a),s(()=>"video"in e(a)&&e(a).video)&&g(k)},!0)}v(n,i)};c(J,n=>{e(a),s(()=>"image"in e(a)&&e(a).image)?n(K):n(L,!1)})}v(u,X)});var H=U(W,2);{var I=u=>{var a=va();v(u,a)};c(H,u=>{T(r()),s(()=>r().length>3)&&u(I)})}_(m),v(t,m)};c(D,t=>{T(r()),s(()=>r()&&r().length>0)&&t(F)})}return _(y),x(()=>V=P(y,1,"container svelte-xds4q5",null,V,{table:h()==="table",gallery:h()==="gallery",selected:b()})),v(B,y),aa(C)}export{ia as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BC6WbF6q.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BC6WbF6q.js new file mode 100644 index 0000000000000000000000000000000000000000..c88b5d86ef223961997f51f37cecdbbee7561dae --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BC6WbF6q.js @@ -0,0 +1 @@ +import{p as c,e as h,d as z,b as S}from"./i18n-Dnhn5Rxr.js";import{R as W,aa as k,t as w,G as E,z as G,a0 as M,a as P,T as R,U as o,W as T,V as U,x as v,a3 as m,w as p,Y as V}from"./index-DWyDLubb.js";import{b as Y}from"./size-CtOeLwIl.js";/* empty css */var j=T("
      ");function D(y,a){W(a,!1);let l=c(a,"value",12),r=c(a,"type",12),n=c(a,"selected",12,!1),d=m(),u=m();function _(e,s){e.style.setProperty("--local-text-width",`${s&&s<150?s:200}px`),e.style.whiteSpace="unset"}function b(e,s=60){if(!e)return"";const i=String(e);return i.length<=s?i:i.slice(0,s)+"..."}k(()=>{_(p(u),p(d))});var x={get value(){return l()},set value(e){l(e),o()},get type(){return r()},set type(e){r(e),o()},get selected(){return n()},set selected(e){n(e),o()}};h();var t=j();let f;var g=U(t,!0);return V(t),z(t,e=>v(u,e),()=>p(u)),w(e=>{f=S(t,1,"svelte-xxobeb",null,f,{table:r()==="table",gallery:r()==="gallery",selected:n()}),M(g,e)},[()=>(E(l()),G(()=>b(l())))]),Y(t,"clientWidth",e=>v(d,e)),P(y,t),R(x)}export{D as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BG5zdIqX.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BG5zdIqX.css new file mode 100644 index 0000000000000000000000000000000000000000..ce4c5386d42b9640094bd054ac30bf1bb6b6a39f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BG5zdIqX.css @@ -0,0 +1 @@ +.gallery.svelte-s7j0w2{padding:var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BGbaSO1h.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BGbaSO1h.js new file mode 100644 index 0000000000000000000000000000000000000000..4b2279ee06484a800512501491e0fa139d8f676b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BGbaSO1h.js @@ -0,0 +1 @@ +import{p as u,b as n}from"./i18n-Dnhn5Rxr.js";import{R as o,t as m,a as i,T as y,U as p,W as g,a0 as x,V as h,Y as _}from"./index-DWyDLubb.js";var b=g("
      ");function S(c,t){o(t,!1);let a=u(t,"value",12),l=u(t,"type",12),r=u(t,"selected",12,!1);var d={get value(){return a()},set value(e){a(e),p()},get type(){return l()},set type(e){l(e),p()},get selected(){return r()},set selected(e){r(e),p()}},s=b();let v;var f=h(s,!0);return _(s),m(()=>{v=n(s,1,"svelte-3guu7e",null,v,{table:l()==="table",gallery:l()==="gallery",selected:r()}),x(f,a()!==null?a():"")}),i(c,s),y(d)}export{S as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BIrWl-Kd.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BIrWl-Kd.css new file mode 100644 index 0000000000000000000000000000000000000000..e81e8ccda8009c98167a5586774e23aa4fe87c83 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BIrWl-Kd.css @@ -0,0 +1 @@ +.gallery.svelte-xz0m7l{padding:var(--size-1) var(--size-2);display:flex;align-items:center;gap:20px;overflow-x:auto}div.svelte-xz0m7l{overflow:hidden;min-width:var(--local-text-width);white-space:nowrap}.container.svelte-xz0m7l img,.container.svelte-xz0m7l video{object-fit:contain;width:100px;height:100px}.container.selected.svelte-xz0m7l{border-color:var(--border-color-accent)}.border.table.svelte-xz0m7l{border:2px solid var(--border-color-primary)}.container.table.svelte-xz0m7l{margin:0 auto;border-radius:var(--radius-lg);overflow-x:auto;width:max-content;height:max-content;object-fit:cover;padding:var(--size-2)}.container.gallery.svelte-xz0m7l{object-fit:cover}div.svelte-xz0m7l>p{font-size:var(--text-lg);white-space:normal} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BK-tWmkG.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BK-tWmkG.css new file mode 100644 index 0000000000000000000000000000000000000000..62564a336ee4ea47eecc4bf4c9092cf93664d550 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BK-tWmkG.css @@ -0,0 +1 @@ +pre.svelte-1bbj91m{text-align:left}.gallery.svelte-1bbj91m{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BLPBtkTF.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BLPBtkTF.js new file mode 100644 index 0000000000000000000000000000000000000000..f63973b737c2896d58e1babbca409bbb43a663be --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BLPBtkTF.js @@ -0,0 +1 @@ +import{p as v,e as m}from"./i18n-Dnhn5Rxr.js";import{R as u,t as n,a as _,T as f,U as d,W as h,a0 as c,G as s,z as r,V as g,Y as x}from"./index-DWyDLubb.js";var b=h('
      ');function k(i,t){u(t,!1);let e=v(t,"value",28,()=>({visible:!0,home_page_title:"Home"}));var l={get value(){return e()},set value(p){e(p),d()}};m();var a=b(),o=g(a);return x(a),n(()=>c(o,`Navbar config: visible=${s(e()),r(()=>e().visible)??""}, home_page_title="${s(e()),r(()=>e().home_page_title)??""}"`)),_(i,a),f(l)}export{k as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BUUMH8K0.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BUUMH8K0.css new file mode 100644 index 0000000000000000000000000000000000000000..b98284b149f1ad4fb2b5316e3b8835eafba65ac4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BUUMH8K0.css @@ -0,0 +1 @@ +.gallery.svelte-1r9rmof{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BXmvnBf1.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BXmvnBf1.js new file mode 100644 index 0000000000000000000000000000000000000000..907f912c1f8180c768d4c374e2d34570a23a9dde --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BXmvnBf1.js @@ -0,0 +1 @@ +import{p as u,b as o}from"./i18n-Dnhn5Rxr.js";import{R as m,t as n,a as i,T as y,U as p,W as g,a0 as x,V as h,Y as _}from"./index-DWyDLubb.js";var b=g("
      ");function S(c,t){m(t,!1);let s=u(t,"value",12),a=u(t,"type",12),r=u(t,"selected",12,!1);var d={get value(){return s()},set value(e){s(e),p()},get type(){return a()},set type(e){a(e),p()},get selected(){return r()},set selected(e){r(e),p()}},l=b();let v;var f=h(l,!0);return _(l),n(()=>{v=o(l,1,"svelte-1r9rmof",null,v,{table:a()==="table",gallery:a()==="gallery",selected:r()}),x(f,s())}),i(c,l),y(d)}export{S as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-B_mfRiuX.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-B_mfRiuX.js new file mode 100644 index 0000000000000000000000000000000000000000..afbbe7293cefd16e6f6d1828e13367f9d4feea32 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-B_mfRiuX.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a7 as p,t as s,a as x,a0 as f,a8 as m}from"./index-DWyDLubb.js";function l(a,e){m();var t=p();s(()=>f(t,e.value||"")),x(a,t)}export{l as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BeU1J4ps.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BeU1J4ps.css new file mode 100644 index 0000000000000000000000000000000000000000..851f4ca4a9feb4de333ff21d0e43696e50b9e149 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BeU1J4ps.css @@ -0,0 +1 @@ +.gallery.svelte-1by696e{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BkTaSs73.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BkTaSs73.js new file mode 100644 index 0000000000000000000000000000000000000000..085d5ab3bdf8ca78776ee59ee0e714cb63dc3564 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BkTaSs73.js @@ -0,0 +1 @@ +import{p as u,b as n}from"./i18n-Dnhn5Rxr.js";import{R as o,t as m,a as i,T as y,U as v,W as g,a0 as h,V as x,Y as _}from"./index-DWyDLubb.js";var b=g("
      ");function S(c,t){o(t,!1);let s=u(t,"value",12),a=u(t,"type",12),r=u(t,"selected",12,!1);var d={get value(){return s()},set value(e){s(e),v()},get type(){return a()},set type(e){a(e),v()},get selected(){return r()},set selected(e){r(e),v()}},l=b();let p;var f=x(l,!0);return _(l),m(()=>{p=n(l,1,"svelte-1eh6nev",null,p,{table:a()==="table",gallery:a()==="gallery",selected:r()}),h(f,s())}),i(c,l),y(d)}export{S as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BlpJt4zj.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BlpJt4zj.css new file mode 100644 index 0000000000000000000000000000000000000000..b6538646a0fe34bc196329fed0716fd1bf5edce7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BlpJt4zj.css @@ -0,0 +1 @@ +.container.svelte-19cq9h3 img{width:100%;height:100%}.container.selected.svelte-19cq9h3{border-color:var(--border-color-accent)}.border.table.svelte-19cq9h3{border:1px solid var(--border-color-primary)}.container.table.svelte-19cq9h3{margin:0 auto;border-radius:var(--radius-lg);overflow:hidden;width:100%;height:100%;max-width:var(--size-40);max-height:var(--size-20);object-fit:cover}.container.gallery.svelte-19cq9h3{width:100%;max-width:100%;object-fit:cover;max-width:var(--size-40);max-height:var(--size-20);overflow:hidden} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BnU-j0j8.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BnU-j0j8.js new file mode 100644 index 0000000000000000000000000000000000000000..89459818eeb36f7c92b01d2523ae99d0b73ed34f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BnU-j0j8.js @@ -0,0 +1 @@ +import{p as u,b as n}from"./i18n-Dnhn5Rxr.js";import{R as o,t as m,a as y,T as i,U as p,W as g,a0 as x,V as h,Y as _}from"./index-DWyDLubb.js";var b=g("
      ");function E(c,t){o(t,!1);let s=u(t,"value",12),a=u(t,"type",12),r=u(t,"selected",12,!1);var d={get value(){return s()},set value(e){s(e),p()},get type(){return a()},set type(e){a(e),p()},get selected(){return r()},set selected(e){r(e),p()}},l=b();let v;var f=h(l,!0);return _(l),m(()=>{v=n(l,1,"svelte-j6qsyq",null,v,{table:a()==="table",gallery:a()==="gallery",selected:r()}),x(f,s())}),y(c,l),i(d)}export{E as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Bt86cDLM.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Bt86cDLM.js new file mode 100644 index 0000000000000000000000000000000000000000..2eae8d5eb6402f2edc720f1ad7119a9d6e87ebfe --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Bt86cDLM.js @@ -0,0 +1 @@ +import{p as r,e as g,b as h}from"./i18n-Dnhn5Rxr.js";import{R as y,x as o,t as x,a as _,T as b,a3 as w,U as c,W as E,a0 as R,w as S,V as T,Y as U}from"./index-DWyDLubb.js";var V=E("
      ");function j(f,t){y(t,!1);let s=r(t,"value",12),a=r(t,"type",12),u=r(t,"selected",12,!1),i=r(t,"choices",12),n=w();if(s()===null)o(n,"");else{let e=i().find(p=>p[1]===s());o(n,e?e[0]:"")}var v={get value(){return s()},set value(e){s(e),c()},get type(){return a()},set type(e){a(e),c()},get selected(){return u()},set selected(e){u(e),c()},get choices(){return i()},set choices(e){i(e),c()}};g();var l=V();let d;var m=T(l,!0);return U(l),x(()=>{d=h(l,1,"svelte-g2dls0",null,d,{table:a()==="table",gallery:a()==="gallery",selected:u()}),R(m,S(n))}),_(f,l),b(v)}export{j as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BvF-auBS.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BvF-auBS.js new file mode 100644 index 0000000000000000000000000000000000000000..abf20a18ef3e48f31b30d1db837a782ee49a4e88 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BvF-auBS.js @@ -0,0 +1 @@ +import{p as u,b as n}from"./i18n-Dnhn5Rxr.js";import{R as o,t as m,a as i,T as y,U as v,W as x,a0 as g,V as h,Y as _}from"./index-DWyDLubb.js";var b=x("
      ");function S(c,t){o(t,!1);let a=u(t,"value",12),l=u(t,"type",12),r=u(t,"selected",12,!1);var d={get value(){return a()},set value(e){a(e),v()},get type(){return l()},set type(e){l(e),v()},get selected(){return r()},set selected(e){r(e),v()}},s=b();let p;var f=h(s,!0);return _(s),m(()=>{p=n(s,1,"svelte-1uvxnv9",null,p,{table:l()==="table",gallery:l()==="gallery",selected:r()}),g(f,a()?a():"")}),i(c,s),y(d)}export{S as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BwHfD0oa.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BwHfD0oa.js new file mode 100644 index 0000000000000000000000000000000000000000..4d01294ad5543cb59537fc3fe8a7c1fb295664d2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-BwHfD0oa.js @@ -0,0 +1 @@ +import{p,b as m}from"./i18n-Dnhn5Rxr.js";import{R as y,t as g,G as _,z as x,a0 as h,a as b,T as S,U as u,W as j,V as c,Y as n}from"./index-DWyDLubb.js";var k=j("
       
      ");function G(f,t){y(t,!1);let a=p(t,"value",12),s=p(t,"type",12),r=p(t,"selected",12,!1);var i={get value(){return a()},set value(e){a(e),u()},get type(){return s()},set type(e){s(e),u()},get selected(){return r()},set selected(e){r(e),u()}},l=k();let d;var v=c(l),o=c(v,!0);return n(v),n(l),g(e=>{d=m(l,1,"svelte-pj4oi8",null,d,{table:s()==="table",gallery:s()==="gallery",selected:r()}),h(o,e)},[()=>(_(a()),x(()=>JSON.stringify(a(),null,2)))]),b(f,l),S(i)}export{G as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-C7q4tFc2.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-C7q4tFc2.js new file mode 100644 index 0000000000000000000000000000000000000000..1fa82c150856471ad2bcdd3d5ef853bc98028299 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-C7q4tFc2.js @@ -0,0 +1 @@ +import{p as o,b as p}from"./i18n-Dnhn5Rxr.js";import{t as u,a0 as m,a as d,W as b,V as v,Y as _}from"./index-DWyDLubb.js";/* empty css */var y=b("
       
      ");function j(c,e){let n=o(e,"selected",3,!1);function f(a,s=60){if(!a)return"";const r=String(a);return r.length<=s?r:r.slice(0,s)+"..."}var t=y();let l;var i=v(t,!0);_(t),u(a=>{l=p(t,1,"svelte-1bbj91m",null,l,{table:e.type==="table",gallery:e.type==="gallery",selected:n()}),m(i,a)},[()=>f(e.value)]),d(c,t)}export{j as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-C7vkYQeg.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-C7vkYQeg.css new file mode 100644 index 0000000000000000000000000000000000000000..6dbba577877ce521829311df61410fd0d542c41d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-C7vkYQeg.css @@ -0,0 +1 @@ +.container.svelte-ous74z img{width:100%;height:100%}.container.selected.svelte-ous74z{border-color:var(--border-color-accent)}.container.table.svelte-ous74z{margin:0 auto;border:2px solid var(--border-color-primary);border-radius:var(--radius-lg);width:var(--size-20);height:var(--size-20);object-fit:cover}.container.gallery.svelte-ous74z{border:2px solid var(--border-color-primary);height:var(--size-20);max-height:var(--size-20);object-fit:cover} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CA1DPrcM.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CA1DPrcM.css new file mode 100644 index 0000000000000000000000000000000000000000..934be00ead1ad380acc5fd81c0d86de77e2d0a08 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CA1DPrcM.css @@ -0,0 +1 @@ +.container.svelte-xds4q5{border-radius:var(--radius-lg);overflow:hidden}.container.selected.svelte-xds4q5{border:2px solid var(--border-color-accent)}.images-wrapper.svelte-xds4q5{display:flex;gap:var(--spacing-sm)}.container.table.svelte-xds4q5 .images-wrapper:where(.svelte-xds4q5){flex-direction:row;align-items:center;padding:var(--spacing-sm);border:1px solid var(--border-color-primary);border-radius:var(--radius-lg);background:var(--background-fill-secondary)}.container.gallery.svelte-xds4q5 .images-wrapper:where(.svelte-xds4q5){flex-direction:row;gap:0}.image-container.svelte-xds4q5{position:relative;flex-shrink:0}.container.table.svelte-xds4q5 .image-container:where(.svelte-xds4q5){width:var(--size-12);height:var(--size-12)}.container.gallery.svelte-xds4q5 .image-container:where(.svelte-xds4q5){width:var(--size-20);height:var(--size-20);margin-left:calc(-1 * var(--size-8))}.container.gallery.svelte-xds4q5 .image-container:where(.svelte-xds4q5):first-child{margin-left:0}.more-indicator.svelte-xds4q5{display:flex;align-items:center;justify-content:center;font-size:var(--text-lg);font-weight:700;color:var(--border-color-primary)}.container.table.svelte-xds4q5 .more-indicator:where(.svelte-xds4q5){width:var(--size-12);height:var(--size-12)}.container.gallery.svelte-xds4q5 .more-indicator:where(.svelte-xds4q5){width:var(--size-20);height:var(--size-20);margin-left:calc(-1 * var(--size-8));margin-right:calc(-1 * var(--size-6))}.image-container.svelte-xds4q5 img:where(.svelte-xds4q5),.image-container.svelte-xds4q5 video:where(.svelte-xds4q5){width:100%;height:100%;object-fit:cover;border-radius:var(--radius-md)}.caption.svelte-xds4q5{position:absolute;bottom:0;left:0;right:0;background:#000000b3;color:#fff;padding:var(--spacing-xs);font-size:var(--text-xs);text-align:center;border-radius:0 0 var(--radius-md) var(--radius-md);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.container.table.svelte-xds4q5 .caption:where(.svelte-xds4q5){display:none} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CCcLQRgY.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CCcLQRgY.js new file mode 100644 index 0000000000000000000000000000000000000000..43349f419eabec3b2080afa13896d7ad4f486090 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CCcLQRgY.js @@ -0,0 +1 @@ +import{p as v,b as d}from"./i18n-Dnhn5Rxr.js";import{R as n,t as f,a as c,T as y,W as _,a0 as o,V as b,Y as h}from"./index-DWyDLubb.js";/* empty css */var x=_("
      ");function R(s,e){n(e,!0);let r=v(e,"selected",3,!1),i=(e.value?Array.isArray(e.value)?e.value:[e.value]:[]).map(t=>e.choices.find(u=>u[1]===t)?.[0]).filter(t=>t!==void 0).join(", ");var a=x();let l;var m=b(a,!0);h(a),f(()=>{l=d(a,1,"svelte-1by696e",null,l,{table:e.type==="table",gallery:e.type==="gallery",selected:r()}),o(m,i)}),c(s,a),y()}export{R as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CD_WZEqN.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CD_WZEqN.css new file mode 100644 index 0000000000000000000000000000000000000000..6ea9ea8437ac7dcac71c279bbba69d253aa8f50b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CD_WZEqN.css @@ -0,0 +1 @@ +.wrap.svelte-ulqlw7{position:relative;height:var(--size-64);width:var(--size-40);overflow:hidden;border-radius:var(--radius-lg)}img.svelte-ulqlw7{height:var(--size-64);width:var(--size-40);position:absolute;object-fit:cover}.wrap.selected.svelte-ulqlw7{border-color:var(--color-accent)}.wrap.svelte-ulqlw7 img:where(.svelte-ulqlw7):first-child{clip-path:inset(0 50% 0 0%)}.wrap.svelte-ulqlw7 img:where(.svelte-ulqlw7):nth-of-type(2){clip-path:inset(0 0 0 50%)}span.svelte-ulqlw7{position:absolute;top:0;left:calc(50% - .75px);height:var(--size-64);width:1.5px;background:var(--border-color-primary)}.table.svelte-ulqlw7{margin:0 auto;border:2px solid var(--border-color-primary);border-radius:var(--radius-lg)}.gallery.svelte-ulqlw7{border:2px solid var(--border-color-primary);object-fit:cover} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CY2poEFg.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CY2poEFg.js new file mode 100644 index 0000000000000000000000000000000000000000..6acd9073a19bc6159c757f712939de6feefa1f9c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CY2poEFg.js @@ -0,0 +1 @@ +import{p,b as f}from"./i18n-Dnhn5Rxr.js";import{R as m,t as n,a as i,T as y,U as o,W as h,V as g,Y as b}from"./index-DWyDLubb.js";import{h as x}from"./html-Ih_5QVTo.js";var _=h("
      ");function R(d,t){m(t,!1);let s=p(t,"value",12),a=p(t,"type",12),r=p(t,"selected",12,!1);var v={get value(){return s()},set value(e){s(e),o()},get type(){return a()},set type(e){a(e),o()},get selected(){return r()},set selected(e){r(e),o()}},l=_();let u;var c=g(l);return x(c,s),b(l),n(()=>u=f(l,1,"prose svelte-s7j0w2",null,u,{table:a()==="table",gallery:a()==="gallery",selected:r()})),i(d,l),y(v)}export{R as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CZSJmqDf.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CZSJmqDf.css new file mode 100644 index 0000000000000000000000000000000000000000..5032d14583b5505ed425b95fba18f0c728ef4c9f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CZSJmqDf.css @@ -0,0 +1 @@ +.container.svelte-bs74gu img{width:100%;height:100%}.container.selected.svelte-bs74gu{border-color:var(--border-color-accent)}.border.table.svelte-bs74gu{border:2px solid var(--border-color-primary)}.container.table.svelte-bs74gu{margin:0 auto;border-radius:var(--radius-lg);overflow:hidden;width:var(--size-20);height:var(--size-20);object-fit:cover}.container.gallery.svelte-bs74gu{width:var(--size-20);max-width:var(--size-20);object-fit:cover} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CbN4r5yx.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CbN4r5yx.css new file mode 100644 index 0000000000000000000000000000000000000000..e931e13d56e7cfe9c7543559801ff25d70d028b1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CbN4r5yx.css @@ -0,0 +1 @@ +div.svelte-1p04unr{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.gallery.svelte-1p04unr{display:flex;align-items:center;cursor:pointer;padding:var(--size-1) var(--size-2);text-align:left} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CbzIfTHK.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CbzIfTHK.js new file mode 100644 index 0000000000000000000000000000000000000000..c812febff9db0a1e71db3f8d5a3851180f79b384 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CbzIfTHK.js @@ -0,0 +1 @@ +import{p as l,e as p,b as h}from"./i18n-Dnhn5Rxr.js";import{R as g,t as y,a as x,T as _,U as r,W as b,a0 as j,V as E,Y as R}from"./index-DWyDLubb.js";var S=b("
      ");function W(d,t){g(t,!1);let n=l(t,"value",12),s=l(t,"type",12),c=l(t,"selected",12,!1),i=l(t,"choices",12),f=n().map(e=>i().find(m=>m[1]===e)?.[0]).filter(e=>e!==void 0).join(", ");var o={get value(){return n()},set value(e){n(e),r()},get type(){return s()},set type(e){s(e),r()},get selected(){return c()},set selected(e){c(e),r()},get choices(){return i()},set choices(e){i(e),r()}};p();var a=S();let u;var v=E(a,!0);return R(a),y(()=>{u=h(a,1,"svelte-25nhtv",null,u,{table:s()==="table",gallery:s()==="gallery",selected:c()}),j(v,f)}),x(d,a),_(o)}export{W as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CgIc4GLa.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CgIc4GLa.css new file mode 100644 index 0000000000000000000000000000000000000000..b57947ccdba1d1b1928bc5e86efafb6d2274d32c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-CgIc4GLa.css @@ -0,0 +1 @@ +.gallery.svelte-11ua876{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Cpi22WGa.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Cpi22WGa.css new file mode 100644 index 0000000000000000000000000000000000000000..32f6761016c93f822bbb2494fdb9160f9e79ef43 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Cpi22WGa.css @@ -0,0 +1 @@ +.gallery.svelte-164n2qi{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Csc6CXXA.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Csc6CXXA.js new file mode 100644 index 0000000000000000000000000000000000000000..742457010e7cc2ed0a2fe9d61de083b83aefc9ad --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Csc6CXXA.js @@ -0,0 +1 @@ +import{p as a,b as h}from"./i18n-Dnhn5Rxr.js";import{R as b,w as k,t as x,a as y,T as z,U as r,V as w,ad as M,G as S,z as q,W as C,Y as E}from"./index-DWyDLubb.js";import{M as G}from"./MarkdownCode-B8HQ3LiU.js";/* empty css */import"./html-Ih_5QVTo.js";import"./prism-python-B4lzO_Nz.js";import"./index-B_pwUImq.js";var R=C("
      ");function B(f,t){b(t,!1);let l=a(t,"value",12),s=a(t,"type",12),n=a(t,"selected",12,!1),u=a(t,"sanitize_html",12),d=a(t,"line_breaks",12),m=a(t,"latex_delimiters",12);function g(e,c=60){if(!e)return"";const _=String(e);return _.length<=c?_:_.slice(0,c)+"..."}var p={get value(){return l()},set value(e){l(e),r()},get type(){return s()},set type(e){s(e),r()},get selected(){return n()},set selected(e){n(e),r()},get sanitize_html(){return u()},set sanitize_html(e){u(e),r()},get line_breaks(){return d()},set line_breaks(e){d(e),r()},get latex_delimiters(){return m()},set latex_delimiters(e){m(e),r()}},i=R();let o;var v=w(i);{let e=M(()=>(S(l()),q(()=>g(l()))));G(v,{get message(){return k(e)},get latex_delimiters(){return m()},get sanitize_html(){return u()},get line_breaks(){return d()},chatbot:!1})}return E(i),x(()=>o=h(i,1,"prose svelte-11ua876",null,o,{table:s()==="table",gallery:s()==="gallery",selected:n()})),y(f,i),z(p)}export{B as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Cvv6PwrD.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Cvv6PwrD.css new file mode 100644 index 0000000000000000000000000000000000000000..b19718c8b1d7298fac688f73c7600ab441910469 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Cvv6PwrD.css @@ -0,0 +1 @@ +.gallery.svelte-xxobeb{padding:var(--size-1) var(--size-2)}div.svelte-xxobeb{overflow:hidden;white-space:nowrap} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-D2mjvy71.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-D2mjvy71.js new file mode 100644 index 0000000000000000000000000000000000000000..7ec62c90da948468bd5a69f7b31a9ddfc1c74958 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-D2mjvy71.js @@ -0,0 +1 @@ +import{p as d,b as f}from"./i18n-Dnhn5Rxr.js";import{t as v,a as c,W as m,a0 as i,V as o,Y as u}from"./index-DWyDLubb.js";var p=m("
      ");function y(l,e){let s=d(e,"selected",3,!1);var t=p();let a;var r=o(t,!0);u(t),v(()=>{a=f(t,1,"svelte-9pg6fh",null,a,{table:e.type==="table",gallery:e.type==="gallery",selected:s()}),i(r,e.value?e.value:"")}),c(l,t)}export{y as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-D2nbjfVb.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-D2nbjfVb.css new file mode 100644 index 0000000000000000000000000000000000000000..36beabded8de5b64626fc6b8806992187ba8234f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-D2nbjfVb.css @@ -0,0 +1 @@ +.gallery.svelte-1eh6nev{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DBPhM3Hl.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DBPhM3Hl.js new file mode 100644 index 0000000000000000000000000000000000000000..7437509a74388791a03c90f1ed55b55765277750 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DBPhM3Hl.js @@ -0,0 +1 @@ +import{p as u,e as i,b as o}from"./i18n-Dnhn5Rxr.js";import{R as f,t as m,G as y,z as g,a0 as _,a as x,T as h,U as n,W as b,V as S,Y as k}from"./index-DWyDLubb.js";var q=b("
      ");function G(d,a){f(a,!1);let t=u(a,"value",12),l=u(a,"type",12),r=u(a,"selected",12,!1);var p={get value(){return t()},set value(e){t(e),n()},get type(){return l()},set type(e){l(e),n()},get selected(){return r()},set selected(e){r(e),n()}};i();var s=q();let c;var v=S(s,!0);return k(s),m(e=>{c=o(s,1,"svelte-164n2qi",null,c,{table:l()==="table",gallery:l()==="gallery",selected:r()}),_(v,e)},[()=>(y(t()),g(()=>t()!==null?t().toLocaleString():""))]),x(d,s),h(p)}export{G as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DD1VGTCq.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DD1VGTCq.js new file mode 100644 index 0000000000000000000000000000000000000000..30361e50c4572e2e17bbb4c33a5cc579de34e331 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DD1VGTCq.js @@ -0,0 +1 @@ +import{p as w,e as ve,i as u,b as X,k as Y,u as Z}from"./i18n-Dnhn5Rxr.js";import{R as de,a6 as j,S as z,a,T as ie,U as p,V as x,Y as y,t as k,Z as B,x as C,W as l,a3 as oe,a7 as ce,a0 as D,w as b,z as h,X as F,G as H}from"./index-DWyDLubb.js";var ne=l('
      Empty
      '),_e=l(' '),fe=l('…'),ue=l(''),ye=l("
      "),be=l('
      ',1),me=l("
      ");function pe(I,o){de(o,!1);let e=w(o,"value",12),c=w(o,"type",12),q=w(o,"selected",12,!1),m=w(o,"index",12),G=oe(!1),R=Array.isArray(e()),J=R&&(e().length===0||e()[0].length===0);var K={get value(){return e()},set value(t){e(t),p()},get type(){return c()},set type(t){c(t),p()},get selected(){return q()},set selected(t){q(t),p()},get index(){return m()},set index(t){m(t),p()}};ve();var T=j(),L=z(T);{var M=t=>{var r=me();let U;var N=x(r);{var O=v=>{var n=ce();k(()=>D(n,e())),a(v,n)},P=v=>{var n=j(),Q=z(n);{var $=d=>{var g=ne();a(d,g)},ee=d=>{var g=be(),A=z(g),V=x(A);Y(V,5,()=>(H(e()),h(()=>e().slice(0,3))),Z,(_,s)=>{var i=ue(),W=x(i);Y(W,1,()=>(b(s),h(()=>b(s).slice(0,3))),Z,(f,E)=>{var S=_e(),re=x(S,!0);y(S),k(()=>D(re,b(E))),a(f,S)});var se=F(W);{var le=f=>{var E=fe();a(f,E)};u(se,f=>{b(s),h(()=>b(s).length>3)&&f(le)})}y(i),a(_,i)}),y(V),y(A);var te=F(A,2);{var ae=_=>{var s=ye();let i;k(()=>i=X(s,1,"overlay svelte-wcwkqi",null,i,{odd:m()%2!=0,even:m()%2==0,button:c()==="gallery"})),a(_,s)};u(te,_=>{H(e()),h(()=>e().length>3)&&_(ae)})}a(d,g)};u(Q,d=>{J?d($):d(ee,!1)},!0)}a(v,n)};u(N,v=>{typeof e()=="string"?v(O):v(P,!1)})}y(r),k(()=>U=X(r,1,"svelte-wcwkqi",null,U,{table:c()==="table",gallery:c()==="gallery",selected:q()})),B("mouseenter",r,()=>C(G,!0)),B("mouseleave",r,()=>C(G,!1)),a(t,r)};u(L,t=>{R&&t(M)})}return a(I,T),ie(K)}export{pe as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DSMNiXnn.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DSMNiXnn.css new file mode 100644 index 0000000000000000000000000000000000000000..2ebec293cbc75ff56f7abc6cd0f46359b562219f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DSMNiXnn.css @@ -0,0 +1 @@ +.gallery.svelte-j6qsyq{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DVQdodPf.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DVQdodPf.js new file mode 100644 index 0000000000000000000000000000000000000000..7776baa55dbf5ca0a7aeda1c481fb7ac10ff02b8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DVQdodPf.js @@ -0,0 +1 @@ +import{p as i,e as o,b as y,a as n}from"./i18n-Dnhn5Rxr.js";import{R as b,t as w,a as h,T as q,U as u,X as x,W as k,V as z,G as p,z as v,a8 as E,Y as G}from"./index-DWyDLubb.js";var R=k('
      ');function U(g,a){b(a,!1);let s=i(a,"value",12),t=i(a,"samples_dir",12),l=i(a,"type",12),c=i(a,"selected",12,!1);var _={get value(){return s()},set value(e){s(e),u()},get samples_dir(){return t()},set samples_dir(e){t(e),u()},get type(){return l()},set type(e){l(e),u()},get selected(){return c()},set selected(e){c(e),u()}};o();var r=R();let d;var m=z(r),f=x(m,2);return E(2),G(r),w(()=>{d=y(r,1,"wrap svelte-ulqlw7",null,d,{table:l()==="table",gallery:l()==="gallery",selected:c()}),n(m,"src",(p(t()),p(s()),v(()=>t()+s()[0]))),n(f,"src",(p(t()),p(s()),v(()=>t()+s()[1])))}),h(g,r),q(_)}export{U as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DWDv4qx4.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DWDv4qx4.css new file mode 100644 index 0000000000000000000000000000000000000000..e13c4f4b9249b08eeda3af76c414694b6fc9c68a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DWDv4qx4.css @@ -0,0 +1 @@ +.gallery.svelte-g2dls0{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DnNUXGcx.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DnNUXGcx.js new file mode 100644 index 0000000000000000000000000000000000000000..5f42eb7d85ee0de14c686e493136fdd3a82e34a0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DnNUXGcx.js @@ -0,0 +1 @@ +import{p as f,i as g}from"./i18n-Dnhn5Rxr.js";import{R as d,a6 as h,S,a as i,T as b,U as x,a7 as m,t as o,a0 as p}from"./index-DWyDLubb.js";function R(u,a){d(a,!1);let s=f(a,"title",12),r=f(a,"x",12),l=f(a,"y",12);var v={get title(){return s()},set title(t){s(t),x()},get x(){return r()},set x(t){r(t),x()},get y(){return l()},set y(t){l(t),x()}},n=h(),c=S(n);{var y=t=>{var e=m();o(()=>p(e,s())),i(t,e)},_=t=>{var e=m();o(()=>p(e,`${r()??""} x ${l()??""}`)),i(t,e)};g(c,t=>{s()?t(y):t(_,!1)})}return i(u,n),b(v)}export{R as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Do5iR6B9.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Do5iR6B9.css new file mode 100644 index 0000000000000000000000000000000000000000..d631a6d1d00b261a1451dacde716bcee0691d1d5 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-Do5iR6B9.css @@ -0,0 +1 @@ +.gallery.svelte-pj4oi8{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DqXqJiLY.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DqXqJiLY.js new file mode 100644 index 0000000000000000000000000000000000000000..7f944d0fd4bc63b8540fda1ecd4afea41b83be50 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-DqXqJiLY.js @@ -0,0 +1 @@ +import{p as m,i as v,b as A}from"./i18n-Dnhn5Rxr.js";import{R as E,a6 as f,S as p,a as o,T as I,V as R,x as S,w as t,Y as T,t as W,W as Y,u as j,a5 as q}from"./index-DWyDLubb.js";import{V as z}from"./Video-B_oD6cFy.js";import"./snippet-BWgYNF9D.js";import"./actions-CLThs9VH.js";import"./universal-CFOISHmx.js";var B=Y("
      ");function K(c,a){E(a,!0);let _=m(a,"selected",3,!1),n=m(a,"value",3,null),e=j(void 0);async function g(){t(e)&&(t(e).muted=!0,t(e).playsInline=!0,t(e).controls=!1,t(e).setAttribute("muted",""),await t(e).play(),t(e).pause())}var i=f(),y=p(i);{var b=l=>{var u=f(),h=p(u);{var x=s=>{var r=B();let d;var V=R(r);{let k=q(()=>n()?.url);z(V,{muted:!0,playsinline:!0,onloadeddata:g,onmouseover:()=>t(e)?.play(),onmouseout:()=>t(e)?.pause(),get src(){return t(k)},is_stream:!1,get loop(){return a.loop},get node(){return t(e)},set node(w){S(e,w,!0)}})}T(r),W(()=>d=A(r,1,"container svelte-1nl1glk",null,d,{table:a.type==="table",gallery:a.type==="gallery",selected:_()})),o(s,r)};v(h,s=>{s(x)})}o(l,u)};v(y,l=>{n()&&l(b)})}o(c,i),I()}export{K as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-PAQ-gmig.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-PAQ-gmig.js new file mode 100644 index 0000000000000000000000000000000000000000..5923aa11d70e1022da97dd37121c6baa85133bec --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-PAQ-gmig.js @@ -0,0 +1 @@ +import{p as w,i as n,b as E,k as R,u as S}from"./i18n-Dnhn5Rxr.js";import{R as T,t as m,a as t,T as V,W as r,V as c,S as W,Y as o,a0 as X,w as Y,X as j}from"./index-DWyDLubb.js";var q=r("
    • "),z=r('
    • ...
    • '),B=r(" ",1),C=r("
      ");function G(h,a){T(a,!0);let y=w(a,"selected",3,!1);var l=C();let u;var g=c(l);{var x=s=>{var d=B(),f=W(d);R(f,17,()=>Array.isArray(a.value)?a.value.slice(0,3):[a.value],S,(e,i)=>{var v=q(),_=c(v),k=c(_);o(_),o(v),m(()=>X(k,`./${Y(i)??""}`)),t(e,v)});var b=j(f,2);{var A=e=>{var i=z();t(e,i)};n(b,e=>{Array.isArray(a.value)&&a.value.length>3&&e(A)})}t(s,d)};n(g,s=>{a.value&&s(x)})}o(l),m(()=>u=E(l,1,"svelte-14aa7hi",null,u,{table:a.type==="table",gallery:a.type==="gallery",selected:y()})),t(h,l),V()}export{G as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-PnzFsODt.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-PnzFsODt.css new file mode 100644 index 0000000000000000000000000000000000000000..3336dc908cbf8b8f2829fb7dd4564a5fb32d02b3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-PnzFsODt.css @@ -0,0 +1 @@ +.gallery.svelte-9pg6fh{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-QWdMqwA5.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-QWdMqwA5.css new file mode 100644 index 0000000000000000000000000000000000000000..5a1820e58c630d6dcaff03416180a0c164c23e2a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-QWdMqwA5.css @@ -0,0 +1 @@ +.gallery.svelte-25nhtv{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-RXDI_Ar6.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-RXDI_Ar6.css new file mode 100644 index 0000000000000000000000000000000000000000..b30d21cb8a9f1ca8df531c4899d549dd29715811 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-RXDI_Ar6.css @@ -0,0 +1 @@ +.gallery.svelte-1uvxnv9{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-bHSd0VUC.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-bHSd0VUC.css new file mode 100644 index 0000000000000000000000000000000000000000..25dbfd4ce5bff84b137d91c64c2fdc2fb3465b5a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-bHSd0VUC.css @@ -0,0 +1 @@ +div.svelte-1k1s8qu{width:var(--size-10);height:var(--size-10)}.table.svelte-1k1s8qu{margin:0 auto} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-guFL0Sj1.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-guFL0Sj1.css new file mode 100644 index 0000000000000000000000000000000000000000..21252c04db31ad12193fc98029ccebb66ff3de08 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-guFL0Sj1.css @@ -0,0 +1 @@ +.gallery.svelte-3guu7e{padding:var(--size-1) var(--size-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-iNtc2BQ6.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-iNtc2BQ6.js new file mode 100644 index 0000000000000000000000000000000000000000..253eaeaf1c3dd61317e6d509b83c58a547d4cbe3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-iNtc2BQ6.js @@ -0,0 +1 @@ +import{p as z,k as F,d as G,u as H,i as d,b as J,a as K}from"./i18n-Dnhn5Rxr.js";import{R as L,y as M,t as _,a as o,T as N,X as O,x as Q,W as S,V,u as U,a6 as f,S as y,w as t,a0 as k,Y as I,a7 as Z}from"./index-DWyDLubb.js";import{b as $}from"./size-CtOeLwIl.js";import{I as ee}from"./Image-CeW7PJs4.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";/* empty css */import{V as te}from"./Video-B_oD6cFy.js";import"./misc-vsnLZ-Y1.js";/* empty css */import"./snippet-BWgYNF9D.js";import"./actions-CLThs9VH.js";import"./universal-CFOISHmx.js";var ae=S(""),se=S("

      ");function fe(W,m){L(m,!0);let u=z(m,"value",19,()=>({text:"",files:[]})),w=z(m,"selected",3,!1),n=U(0),v;function E(a,e){a.style.setProperty("--local-text-width",`${e&&e<150?e:200}px`),a.style.whiteSpace="unset"}M(()=>{v&&t(n)&&E(v,t(n))});var s=se();let x;var c=V(s),P=V(c,!0);I(c);var R=O(c,2);F(R,17,()=>u().files,H,(a,e)=>{var g=f(),T=y(g);{var X=r=>{ee(r,{get src(){return t(e).url},alt:""})},Y=r=>{var b=f(),j=y(b);{var q=i=>{te(i,{get src(){return t(e).url},alt:"",loop:!0,is_stream:!1})},A=i=>{var h=f(),B=y(h);{var C=l=>{var p=ae();_(()=>K(p,"src",t(e).url)),o(l,p)},D=l=>{var p=Z();_(()=>k(p,t(e).orig_name)),o(l,p)};d(B,l=>{t(e).mime_type&&t(e).mime_type.includes("audio")?l(C):l(D,!1)},!0)}o(i,h)};d(j,i=>{t(e).mime_type&&t(e).mime_type.includes("video")?i(q):i(A,!1)},!0)}o(r,b)};d(T,r=>{t(e).mime_type&&t(e).mime_type.includes("image")?r(X):r(Y,!1)})}o(a,g)}),I(s),G(s,a=>v=a,()=>v),_(()=>{x=J(s,1,"container svelte-xz0m7l",null,x,{table:m.type==="table",gallery:m.type==="gallery",selected:w(),border:u()}),k(P,u().text?u().text:"")}),$(s,"clientWidth",a=>Q(n,a)),o(W,s),N()}export{fe as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-jts6u4zx.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-jts6u4zx.css new file mode 100644 index 0000000000000000000000000000000000000000..de0fc53d78da996bb9fd1936c770526802e61494 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-jts6u4zx.css @@ -0,0 +1 @@ +table.svelte-wcwkqi{position:relative;border-collapse:collapse}td.svelte-wcwkqi{border:1px solid var(--table-border-color);padding:var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono)}.selected.svelte-wcwkqi td:where(.svelte-wcwkqi){border-color:var(--border-color-accent)}.table.svelte-wcwkqi{display:inline-block;margin:0 auto}.gallery.svelte-wcwkqi td:where(.svelte-wcwkqi):first-child{border-left:none}.gallery.svelte-wcwkqi tr:where(.svelte-wcwkqi):first-child td:where(.svelte-wcwkqi){border-top:none}.gallery.svelte-wcwkqi td:where(.svelte-wcwkqi):last-child{border-right:none}.gallery.svelte-wcwkqi tr:where(.svelte-wcwkqi):last-child td:where(.svelte-wcwkqi){border-bottom:none}.overlay.svelte-wcwkqi{--gradient-to: transparent;position:absolute;bottom:0;background:linear-gradient(to bottom,transparent,var(--gradient-to));width:var(--size-full);height:50%}.odd.svelte-wcwkqi{--gradient-to: var(--table-even-background-fill)}.even.svelte-wcwkqi{--gradient-to: var(--table-odd-background-fill)}.button.svelte-wcwkqi{--gradient-to: var(--background-fill-primary)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-lh5jo09q.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-lh5jo09q.js new file mode 100644 index 0000000000000000000000000000000000000000..cc0adf1680fab286f12d88eac61b756e6d21a64e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-lh5jo09q.js @@ -0,0 +1 @@ +import{p as r,i as n,b as v}from"./i18n-Dnhn5Rxr.js";import{t as _,a as u,W as h,V as p,Y as b}from"./index-DWyDLubb.js";import{J as y}from"./JSON-CNFUDzUL.js";import"./Check-DUAHzS2-.js";import"./Copy-ChCbTvli.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./snippet-BWgYNF9D.js";import"./Empty-BIB2W5at.js";import"./IconButtonWrapper-D0s9l4wW.js";var g=h("
      ");function V(o,e){let s=r(e,"theme_mode",3,"system"),i=r(e,"selected",3,!1),m=!1,d=0;var t=g();let l;var c=p(t);{var f=a=>{y(a,{get value(){return e.value},open:!0,get theme_mode(){return s()},show_indices:m,label_height:d,interactive:!1,show_copy_button:!1})};n(c,a=>{e.value&&a(f)})}b(t),_(()=>l=v(t,1,"container svelte-19cq9h3",null,l,{table:e.type==="table",gallery:e.type==="gallery",selected:i(),border:e.value})),u(o,t)}export{V as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-m_TAV22D.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-m_TAV22D.js new file mode 100644 index 0000000000000000000000000000000000000000..2a7b3bc694feaa6fb00c9435c50e95d3f3e7ca51 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-m_TAV22D.js @@ -0,0 +1 @@ +import{p as v,b as i}from"./i18n-Dnhn5Rxr.js";import{R as d,t as m,a0 as c,a as f,T as n,W as o,V as y,Y as x}from"./index-DWyDLubb.js";/* empty css */var _=o("
      ");function g(l,e){d(e,!0);let s=v(e,"selected",3,!1);var a=_();let t;var r=y(a,!0);x(a),m(u=>{t=i(a,1,"svelte-1p04unr",null,t,{table:e.type==="table",gallery:e.type==="gallery",selected:s()}),c(r,u)},[()=>e.value?Array.isArray(e.value)?e.value.join(", "):e.value:""]),f(l,a),n()}export{g as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-obCq-B6m.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-obCq-B6m.js new file mode 100644 index 0000000000000000000000000000000000000000..7c6570d663cdd0f9e95ea85795383b6ff5183476 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Example-obCq-B6m.js @@ -0,0 +1 @@ +import{p as o,e as c,b as n}from"./i18n-Dnhn5Rxr.js";import{R as v,t as f,a as g,T as y,U as p,V as _,W as b,w as h,ad as x,G as k,z,Y as I}from"./index-DWyDLubb.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{I as q}from"./Image-CeW7PJs4.js";/* empty css */import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";/* empty css */import"./Upload-HitvyI7k.js";/* empty css */import"./snippet-BWgYNF9D.js";import"./misc-vsnLZ-Y1.js";/* empty css */import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";import"./actions-CLThs9VH.js";var w=b("
      ");function H(m,a){v(a,!1);let t=o(a,"value",12),r=o(a,"type",12),l=o(a,"selected",12,!1);var u={get value(){return t()},set value(e){t(e),p()},get type(){return r()},set type(e){r(e),p()},get selected(){return l()},set selected(e){l(e),p()}};c();var s=w();let i;var d=_(s);{let e=x(()=>(k(t()),z(()=>t().composite?.url||t().background?.url)));q(d,{get src(){return h(e)},alt:""})}return I(s),f(()=>i=n(s,1,"container svelte-ous74z",null,i,{table:r()==="table",gallery:r()==="gallery",selected:l()})),g(m,s),y(u)}export{H as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ExtrasAsMetadata-Bw6ELUiM.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ExtrasAsMetadata-Bw6ELUiM.js new file mode 100644 index 0000000000000000000000000000000000000000..0fb9ca7ecebbdb7352ab5c7093686d7c2228032e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ExtrasAsMetadata-Bw6ELUiM.js @@ -0,0 +1 @@ +import{aG as n,aH as d}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const r="ExtrasAsMetadata";class o{_assignExtras(s,t){if(t.extras&&Object.keys(t.extras).length>0){const a=s.metadata=s.metadata||{},e=a.gltf=a.gltf||{};e.extras=t.extras}}constructor(s){this.name=r,this.enabled=!0,this._loader=s}dispose(){this._loader=null}loadNodeAsync(s,t,a){return this._loader.loadNodeAsync(s,t,e=>{this._assignExtras(e,t),a(e)})}loadCameraAsync(s,t,a){return this._loader.loadCameraAsync(s,t,e=>{this._assignExtras(e,t),a(e)})}createMaterial(s,t,a){const e=this._loader.createMaterial(s,t,a);return this._assignExtras(e,t),e}loadAnimationAsync(s,t){return this._loader.loadAnimationAsync(s,t).then(a=>(this._assignExtras(a,t),a))}}n(r);d(r,!1,i=>new o(i));export{o as ExtrasAsMetadata}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/File-BHHIF0P7.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/File-BHHIF0P7.js new file mode 100644 index 0000000000000000000000000000000000000000..4e4a2037eae08f4bb3c3b4931b44ad9e02b543cc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/File-BHHIF0P7.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as r,f as t}from"./index-DWyDLubb.js";var a=t('');function n(o){var e=a();r(o,e)}export{n as F}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/FileUpload-DiuLlPU9.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/FileUpload-DiuLlPU9.css new file mode 100644 index 0000000000000000000000000000000000000000..e9b9c55444da3cf406d449331bf7c51bc551a3cc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/FileUpload-DiuLlPU9.css @@ -0,0 +1 @@ +.label-clear-button.svelte-al0bnp{color:var(--body-text-color-subdued);position:relative;left:-3px}.label-clear-button.svelte-al0bnp:hover{color:var(--body-text-color)}.file-preview.svelte-al0bnp{table-layout:fixed;width:var(--size-full);max-height:var(--size-60);overflow-y:auto;margin-top:var(--size-1);color:var(--body-text-color)}.file-preview-holder.svelte-al0bnp{overflow:auto}.file.svelte-al0bnp{display:flex;width:var(--size-full)}.file.svelte-al0bnp>:where(.svelte-al0bnp){padding:var(--size-1) var(--size-2-5)}.filename.svelte-al0bnp{flex-grow:1;display:flex;overflow:hidden}.filename.svelte-al0bnp .stem:where(.svelte-al0bnp){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.filename.svelte-al0bnp .ext:where(.svelte-al0bnp){white-space:nowrap}.download.svelte-al0bnp{min-width:8rem;width:10%;white-space:nowrap;text-align:right}.download.svelte-al0bnp:hover{text-decoration:underline}.download.svelte-al0bnp>a{color:var(--link-text-color)}.download.svelte-al0bnp>a:hover{color:var(--link-text-color-hover)}.download.svelte-al0bnp>a:visited{color:var(--link-text-color-visited)}.download.svelte-al0bnp>a:active{color:var(--link-text-color-active)}.selectable.svelte-al0bnp{cursor:pointer}tbody.svelte-al0bnp>tr:where(.svelte-al0bnp):nth-child(2n){background:var(--block-background-fill)}tbody.svelte-al0bnp>tr:where(.svelte-al0bnp):nth-child(odd){background:var(--table-odd-background-fill)}.drag-handle.svelte-al0bnp{cursor:grab;color:var(--body-text-color-subdued);padding-right:var(--size-2);user-select:none}.dragging.svelte-al0bnp{opacity:.5;cursor:grabbing}.drop-target.svelte-al0bnp{border-top:2px solid var(--color-accent)}tr:last-child.drop-target[data-drop-target=before].svelte-al0bnp{border-top:2px solid var(--color-accent);border-bottom:none}tr:last-child.drop-target[data-drop-target=after].svelte-al0bnp{border-top:none;border-bottom:2px solid var(--color-accent)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/FileUpload-yTZ4bq_L.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/FileUpload-yTZ4bq_L.js new file mode 100644 index 0000000000000000000000000000000000000000..990071c1e6fc559aefa5859bfe29ad193606c5a9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/FileUpload-yTZ4bq_L.js @@ -0,0 +1 @@ +import{p as i,k as _e,i as U,b as fe,a as ee,f as me,s as ve}from"./i18n-Dnhn5Rxr.js";import{R as de,t as te,a as c,T as ge,w as e,W as p,a5 as T,V as y,aj as he,X as w,a0 as re,Z as W,S as j,a7 as be,u as ae,x as v,Y as m,a8 as ye,a6 as we,M as pe}from"./index-DWyDLubb.js";import{U as se}from"./Upload-HitvyI7k.js";import{I as ue,U as Ae}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as ke}from"./BlockLabel-CZd21Hkw.js";import{C as xe}from"./Clear-BF6j078A.js";import{F as Be}from"./File-BHHIF0P7.js";import{I as ie}from"./IconButtonWrapper-D0s9l4wW.js";import{h as Te}from"./html-Ih_5QVTo.js";import{D as ze}from"./DownloadLink-TGTaev7f.js";const Ie=A=>{let r=["B","KB","MB","GB","PB"],n=0;for(;A>1024;)A/=1024,n++;let z=r[n];return A.toFixed(1)+" "+z};var Pe=p('⋮⋮'),Fe=p(" ⇣",1),De=p(''),Ee=p(' '),Ce=p('
      ');function Ue(A,r){de(r,!0);let n=i(r,"value",7),z=i(r,"selectable",3,!1),h=i(r,"height",3,void 0),R=i(r,"allow_reordering",3,!1),_=ae(null),d=ae(null);function G(a,l){v(_,l,!0),a.dataTransfer&&(a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",l.toString()))}function I(a,l){if(a.preventDefault(),l===e(u).length-1){const t=a.currentTarget.getBoundingClientRect(),o=t.top+t.height/2;v(d,a.clientY>o?e(u).length:l,!0)}else v(d,l,!0);a.dataTransfer&&(a.dataTransfer.dropEffect="move")}function J(a){(!a.dataTransfer?.dropEffect||a.dataTransfer.dropEffect==="none")&&(v(_,null),v(d,null))}function P(a,l){if(a.preventDefault(),e(_)===null||e(_)===l)return;const t=Array.isArray(n())?[...n()]:[n()],[o]=t.splice(e(_),1);t.splice(e(d)===e(u).length?e(u).length:l,0,o);const b=Array.isArray(n())?t:t[0];r.onchange?.(b),v(_,null),v(d,null)}function F(a){const l=a.lastIndexOf(".");return l===-1?[a,""]:[a.slice(0,l),a.slice(l)]}let u=T(()=>(Array.isArray(n())?n():[n()]).map(a=>{const[l,t]=F(a.orig_name??"");return{...a,filename_stem:l,filename_ext:t}}));function K(a,l){const t=a.currentTarget;(a.target===t||t&&t.firstElementChild&&a.composedPath().includes(t.firstElementChild))&&r.onselect?.({value:e(u)[l].orig_name,index:l})}function O(a){const l=Array.isArray(n())?[...n()]:[n()],t=l.splice(a,1),o=Array.isArray(n())?l:l[0];n(o),r.ondelete?.(t[0]),r.onchange?.(o)}function D(a){r.ondownload?.(a)}const V=typeof window<"u";var k=Ce();let X;var Y=y(k),Z=y(Y);_e(Z,23,()=>e(u),a=>a.url,(a,l,t)=>{var o=Ee();let b;o.__click=s=>{K(s,e(t))};var f=y(o),E=y(f);{var N=s=>{var g=Pe();c(s,g)};U(E,s=>{R()&&e(u).length>1&&s(N)})}var q=w(E,2),H=y(q,!0);m(q);var L=w(q,2),Q=y(L,!0);m(L),m(f);var M=w(f),x=y(M);{var S=s=>{{let g=T(()=>V&&window.__is_colab__?null:e(l).orig_name);ze(s,{get href(){return e(l).url},get download(){return e(g)},$$events:{click:()=>D(e(l))},children:(C,le)=>{var oe=Fe(),ce=j(oe);Te(ce,()=>e(l).size!=null?Ie(e(l).size):"(size unknown)"),ye(),c(C,oe)},$$slots:{default:!0}})}},$=s=>{var g=be();te(C=>re(g,C),[()=>r.i18n("file.uploading")]),c(s,g)};U(x,s=>{e(l).url?s(S):s($,!1)})}m(M);var ne=w(M);{var B=s=>{var g=De(),C=y(g);C.__click=()=>{O(e(t))},C.__keydown=le=>{le.key==="Enter"&&O(e(t))},m(g),c(s,g)};U(ne,s=>{e(u).length>1&&s(B)})}m(o),te(()=>{b=fe(o,1,"file svelte-al0bnp",null,b,{selectable:z(),dragging:e(_)===e(t),"drop-target":e(d)===e(t)||e(t)===e(u).length-1&&e(d)===e(u).length}),ee(o,"data-drop-target",e(d)===e(u).length&&e(t)===e(u).length-1||e(d)===e(t)+1?"after":"before"),ee(o,"draggable",R()&&e(u).length>1),ee(f,"aria-label",e(l).orig_name),re(H,e(l).filename_stem),re(Q,e(l).filename_ext)}),W("dragstart",o,s=>G(s,e(t))),W("dragenter",o,s=>s.preventDefault()),W("dragover",o,s=>I(s,e(t))),W("drop",o,s=>P(s,e(t))),W("dragend",o,J),c(a,o)}),m(Z),m(Y),m(k),te(()=>X=me(k,"",X,{"max-height":h()?typeof h()=="number"?h()+"px":h():"auto"})),c(A,k),ge()}he(["click","keydown"]);var Re=p(" ",1),Ye=p(" ",1),Le=p(" ",1);function qe(A,r){de(r,!0);let n=i(r,"value",15),z=i(r,"show_label",3,!0),h=i(r,"file_count",3,"single"),R=i(r,"file_types",3,null),_=i(r,"selectable",3,!1),d=i(r,"height",3,void 0),G=i(r,"max_file_size",3,null),I=i(r,"uploading",15,!1),J=i(r,"allow_reordering",3,!1),P=i(r,"upload_promise",15),F=i(r,"buttons",3,null),u=i(r,"on_custom_button_click",3,null);async function K(t){Array.isArray(n())?n([...n(),...Array.isArray(t)?t:[t]]):n()?n([n(),...Array.isArray(t)?t:[t]]):n(t),await pe(),r.onchange?.(n()),r.onupload?.(n())}function O(){n(null),r.onchange?.(null),r.onclear?.()}let D=ae(!1);var V=Le(),k=j(V);{var X=t=>{ie(t,{get buttons(){return F()},get on_custom_button_click(){return u()}})};U(k,t=>{z()&&F()&&F().length>0&&t(X)})}var Y=w(k,2);{let t=T(()=>!n()),o=T(()=>r.label||"File");ke(Y,{get show_label(){return z()},get Icon(){return Be},get float(){return e(t)},get label(){return e(o)}})}var Z=w(Y,2);{var a=t=>{var o=Ye(),b=j(o);{let E=T(()=>F()||[]);ie(b,{get buttons(){return e(E)},get on_custom_button_click(){return u()},children:(N,q)=>{var H=Re(),L=j(H);{var Q=x=>{{let S=T(()=>r.i18n("common.upload"));ue(x,{get Icon(){return Ae},get label(){return e(S)},children:($,ne)=>{se($,{icon_upload:!0,onload:K,get filetype(){return R()},get file_count(){return h()},get max_file_size(){return G()},get root(){return r.root},get onerror(){return r.onerror},get stream_handler(){return r.stream_handler},get upload(){return r.upload},get upload_promise(){return P()},set upload_promise(B){P(B)},get dragging(){return e(D)},set dragging(B){v(D,B,!0)},get uploading(){return I()},set uploading(B){I(B)}})},$$slots:{default:!0}})}};U(L,x=>{h()==="single"&&(Array.isArray(n())?n().length>0:n()!==null)||x(Q)})}var M=w(L,2);{let x=T(()=>r.i18n("common.clear"));ue(M,{get Icon(){return xe},get label(){return e(x)},onclick:S=>{S.stopPropagation(),O()}})}c(N,H)},$$slots:{default:!0}})}var f=w(b,2);Ue(f,{get i18n(){return r.i18n},get onselect(){return r.onselect},get selectable(){return _()},get value(){return n()},get height(){return d()},get onchange(){return r.onchange},get ondelete(){return r.ondelete},get allow_reordering(){return J()}}),c(t,o)},l=t=>{se(t,{onload:K,get filetype(){return R()},get file_count(){return h()},get max_file_size(){return G()},get root(){return r.root},get onerror(){return r.onerror},get stream_handler(){return r.stream_handler},get upload(){return r.upload},get height(){return d()},get upload_promise(){return P()},set upload_promise(o){P(o)},get dragging(){return e(D)},set dragging(o){v(D,o,!0)},get uploading(){return I()},set uploading(o){I(o)},children:(o,b)=>{var f=we(),E=j(f);ve(E,r,"default",{}),c(o,f)},$$slots:{default:!0}})};U(Z,t=>{n()&&(!Array.isArray(n())||n().length>0)?t(a):t(l,!1)})}c(A,V),ge()}export{Ue as F,qe as a}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/FullscreenButton-sCrcy_OJ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/FullscreenButton-sCrcy_OJ.js new file mode 100644 index 0000000000000000000000000000000000000000..5bd3ed1a62b1fa7dffb719c6157add1533f3b5b4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/FullscreenButton-sCrcy_OJ.js @@ -0,0 +1 @@ +import{i as c}from"./i18n-Dnhn5Rxr.js";import{a as n,f as m,R as f,a6 as u,S as v,T as h}from"./index-DWyDLubb.js";import{I as a}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{M as g}from"./Maximize-QH9NIRWs.js";var k=m('');function d(r){var e=k();n(r,e)}function I(r,e){f(e,!0);var t=u(),i=v(t);{var l=o=>{a(o,{get Icon(){return d},label:"Exit fullscreen mode",onclick:()=>e.onclick(!1)})},s=o=>{a(o,{get Icon(){return g},label:"Fullscreen",onclick:()=>e.onclick(!0)})};c(i,o=>{e.fullscreen?o(l):o(s,!1)})}n(r,t),h()}export{I as F}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Gallery-BwMbO7WY.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Gallery-BwMbO7WY.js new file mode 100644 index 0000000000000000000000000000000000000000..0d67e2c9c7ed6bd032b71e8edce01f42c9e2fdb8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Gallery-BwMbO7WY.js @@ -0,0 +1 @@ +import{p as o,i as f,k as Be,b as $,a as Re,u as Te,d as me,f as oe}from"./i18n-Dnhn5Rxr.js";import{av as wt,R as pt,u as ie,v as De,y as se,w as e,x as ue,M as yt,aa as kt,S as ee,a as x,T as zt,a5 as _,X as h,W as P,V as B,Y as I,t as J,Z as te,a0 as We}from"./index-DWyDLubb.js";import{b as xt}from"./window-Uydxco8n.js";import{s as It}from"./event-modifiers-CdEA5IGF.js";import{I as K,U as Pt,W as Lt,V as jt,a as Et}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as Mt}from"./BlockLabel-CZd21Hkw.js";import{E as Ut}from"./Empty-BIB2W5at.js";import{S as Bt}from"./ShareButton-wCSP7LoP.js";import{C as Ce}from"./Clear-BF6j078A.js";import{D as Rt}from"./Download-Di2PsS6O.js";import{I as Fe}from"./Image-DrPceByI.js";import{P as Se}from"./Play-BxqeM8KI.js";import{I as Tt}from"./IconButtonWrapper-D0s9l4wW.js";import{F as Dt}from"./FullscreenButton-sCrcy_OJ.js";import{U as Wt}from"./Upload-HitvyI7k.js";import{M as Ct}from"./ModifyUpload-CIJNunwR.js";import{I as ve}from"./Image-CeW7PJs4.js";/* empty css */import{V as ge}from"./Video-B_oD6cFy.js";import{d as Ft}from"./index-tFQomdd2.js";import{u as St}from"./utils.svelte-CCyS_0CY.js";async function Vt(S){return S?`
      ${(await Promise.all(S.map(async([E,b])=>E===null||!E.url?"":await St(E.url)))).map(E=>``).join("")}
      `:""}async function ka(S,t,E="uploaded_file"){const b=S.type.split("/")[1]||"png",V=new File([S],`${E}.${b}`),ce=[new wt({path:V.name,orig_name:V.name,blob:V,size:V.size,mime_type:V.type,is_stream:!1})];return await t(...ce)}var At=P('
      '),Gt=P(" ",1),Ot=P(' '),Xt=P(" ",1),Ht=P(""),qt=P('
      '),Yt=P(" ",1),Zt=P(" ",1),Jt=P('
      '),Kt=P(''),Nt=P(''),Qt=P(''),$t=P(" ",1);function ea(S,t){pt(t,!0);let E=o(t,"show_label",3,!0),b=o(t,"value",15),V=o(t,"columns",19,()=>[2]),ce=o(t,"rows",3,void 0),O=o(t,"height",3,"auto"),de=o(t,"allow_preview",3,!0),Ve=o(t,"object_fit",3,"cover"),Ae=o(t,"show_share_button",3,!1),Ge=o(t,"show_download_button",3,!1),n=o(t,"selected_index",15),Oe=o(t,"show_fullscreen_button",3,!0),Xe=o(t,"fullscreen",3,!1),He=o(t,"root",3,""),qe=o(t,"file_types",19,()=>["image","video"]),Ye=o(t,"max_file_size",3,null),Ze=o(t,"fit_columns",3,!0),Je=o(t,"buttons",3,null),Ke=o(t,"oncustom_button_click",3,null),Ne=o(t,"onpreview_open",3,()=>{}),Qe=o(t,"onchange",3,()=>{}),$e=o(t,"onclear",3,()=>{}),et=o(t,"onselect",3,a=>{}),tt=o(t,"onshare",3,a=>{}),he=o(t,"onerror",3,a=>{}),be=o(t,"onpreview_close",3,()=>{}),at=o(t,"onfullscreen",3,a=>{}),lt=o(t,"ondelete",3,()=>{}),nt=o(t,"onupload",3,()=>{}),ae=o(t,"onsource_change",3,()=>{}),we=null,fe="normal",rt=!1,_e=!1,pe,ye=ie(!1),d=_(()=>b()==null?null:b().map(a=>"video"in a?{video:a.video,caption:a.caption}:"image"in a?{image:a.image,caption:a.caption}:{}));function ot(a,i,m){if(a&&i&&m){const R=a.length;return Array.isArray(i)?i.map(k=>Math.min(k,R)):Math.min(i,R)}else return i}let it=_(()=>ot(e(d),V(),Ze())),ke=ie(De(b()));n()==null&&t.preview&&b()?.length&&n(0);let ze=ie(De(n()));se(()=>{Ft(e(ke),b())||(e(ye)?(n(t.preview&&b()?.length?0:null),ue(ye,!1)):n()!==null&&b()!==null?n(Math.max(0,Math.min(n(),b().length-1))):n(null),Qe()(),ue(ke,b(),!0))});let xe=_(()=>((n()??0)+(e(d)?.length??0)-1)%(e(d)?.length??0)),Ie=_(()=>((n()??0)+1)%(e(d)?.length??0));function st(a){const i=a.target,m=a.offsetX,k=i.offsetWidth/2;m{n()!==e(ze)&&(ue(ze,n(),!0),n()!==null&&e(d)!==null&&et()({index:n(),value:e(d)?.[n()]}))}),se(()=>{de()&&e(y)&&ct(n())});let N=[],y=ie(void 0);async function ct(a){if(typeof a!="number"||(await yt(),N[a]===void 0)||!e(y))return;N[a]?.focus();const{left:i,width:m}=e(y).getBoundingClientRect(),{left:R,width:k}=N[a].getBoundingClientRect(),W=R-i+k/2-m/2+e(y).scrollLeft;e(y)&&typeof e(y).scrollTo=="function"&&e(y).scrollTo({left:W<0?0:W,behavior:"smooth"})}async function dt(a,i){let m;try{m=await t._fetch(a)}catch(W){if(W instanceof TypeError){window.open(a,"_blank","noreferrer");return}throw W}const R=await m.blob(),k=URL.createObjectURL(R),A=document.createElement("a");A.href=k,A.download=i,A.click(),URL.revokeObjectURL(k)}let w=_(()=>n()!=null&&e(d)!=null?e(d)[n()]:null),Pe=!1;function Q(){e(y)&&(Pe=e(y).scrollWidth>e(y).clientWidth)}kt(()=>(Q(),document.addEventListener("fullscreenchange",()=>{_e=!!document.fullscreenElement}),window.addEventListener("resize",Q),()=>window.removeEventListener("resize",Q))),se(()=>{e(d),Q(),e(y)&&Q()});function ft(a){if(!b()||!e(d))return;const i=e(d)[a];let m;"image"in i?m={file:i.image,index:a}:"video"in i&&(m={file:i.video,index:a}),m&<()(m)}let Le=!1;var je=$t(),Ee=ee(je);{var _t=a=>{{let i=_(()=>t.label||"Gallery");Mt(a,{get show_label(){return E()},get Icon(){return Fe},get label(){return e(i)}})}};f(Ee,a=>{E()&&a(_t)})}var mt=h(Ee,2);{var vt=a=>{Ut(a,{unpadded_box:!0,size:"large",children:(i,m)=>{Fe(i)},$$slots:{default:!0}})},gt=a=>{var i=Qt(),m=B(i);{var R=M=>{var v=qt();$(v,1,"preview svelte-7anmrz",null,{},{minimal:fe==="minimal"});var T=B(v);Tt(T,{display_top_corner:rt,get buttons(){return Je()},get on_custom_button_click(){return Ke()},children:(s,u)=>{var r=Gt(),l=ee(r);{var c=g=>{{let D=_(()=>t.i18n("common.download"));K(g,{get Icon(){return Rt},get label(){return e(D)},onclick:()=>{const re="image"in e(w)?e(w)?.image:e(w)?.video;if(re==null)return;const{url:Z,orig_name:bt}=re;Z&&dt(Z,bt??"image")}})}};f(l,g=>{Ge()&&g(c)})}var p=h(l,2);{var z=g=>{Dt(g,{get fullscreen(){return Xe()},onclick:D=>at()({detail:D})})};f(p,g=>{Oe()&&g(z)})}var Y=h(p,2);{var j=g=>{var D=At(),re=B(D);Bt(re,{get i18n(){return t.i18n},get value(){return e(d)},get formatter(){return Vt},$$events:{share:Z=>{tt()(Z)},error:Z=>{he()(Z)}}}),I(D),x(g,D)};f(Y,g=>{Ae()&&g(j)})}var F=h(Y,2);{var ne=g=>{K(g,{get Icon(){return Ce},label:"Close",onclick:()=>{n(null),be()()}})};f(F,g=>{_e||g(ne)})}x(s,r)},$$slots:{default:!0}});var L=h(T,2),U=B(L);{var X=s=>{{let u=_(()=>({alt:e(w).caption||"",title:e(w).caption||null,class:e(w).caption&&"with-caption",loading:"lazy"}));ve(s,{get restProps(){return e(u)},get src(){return e(w).image.url},data_testid:"detailed-image"})}},G=s=>{{let u=_(()=>e(w).caption||"");ge(s,{get src(){return e(w).video.url},"data-testid":"detailed-video",get alt(){return e(u)},loading:"lazy",loop:!1,is_stream:!1,muted:!1,controls:!0})}};f(U,s=>{"image"in e(w)?s(X):s(G,!1)})}I(L);var H=h(L,2);{var q=s=>{var u=Ot(),r=B(u,!0);I(u),J(()=>We(r,e(w).caption)),x(s,u)};f(H,s=>{e(w)?.caption&&s(q)})}var C=h(H,2);Be(C,21,()=>e(d),Te,(s,u,r)=>{var l=Ht();let c;var p=B(l);{var z=j=>{{let F=_(()=>({title:e(u).caption||null,alt:"",class:"with-caption",loading:"lazy"}));ve(j,{get src(){return e(u).image.url},get restProps(){return e(F)},data_testid:`thumbnail ${r+1}`})}},Y=j=>{var F=Xt(),ne=ee(F);Se(ne);var g=h(ne,2);{let D=_(()=>e(u).caption||null);ge(g,{get src(){return e(u).video.url},get title(){return e(D)},is_stream:!1,"data-testid":"thumbnail "+(r+1),alt:"",loading:"lazy",loop:!1})}x(j,F)};f(p,j=>{"image"in e(u)?j(z):j(Y,!1)})}I(l),me(l,(j,F)=>N[F]=j,j=>N?.[j],()=>[r]),J(()=>{c=$(l,1,"thumbnail-item thumbnail-small svelte-7anmrz",null,c,{selected:n()===r&&fe!=="minimal"}),Re(l,"aria-label","Thumbnail "+(r+1)+" of "+e(d).length)}),te("click",l,()=>n(r)),x(s,l)}),I(C),me(C,s=>ue(y,s),()=>e(y)),I(v),J(()=>{oe(L,`height: calc(100% - ${e(w).caption?"80px":"60px"})`),oe(C,`justify-content: ${Pe?"flex-start":"center"};`)}),te("click",L,function(...s){("image"in e(w)?u=>st(u):null)?.apply(this,s)}),te("keydown",v,ut),x(M,v)};f(m,M=>{e(w)&&de()&&M(R)})}var k=h(m,2);let A,W;var Me=B(k);{var ht=M=>{Ct(M,{get i18n(){return t.i18n},onclear:()=>{b([]),ae()("upload"),$e()()},children:(v,T)=>{var L=Yt(),U=ee(L);{var X=r=>{{let l=_(()=>t.i18n("upload_text.click_to_upload"));K(r,{get Icon(){return Pt},get label(){return e(l)},children:(c,p)=>{Wt(c,{icon_upload:!0,onload:z=>nt()(z),get filetype(){return qe()},file_count:"multiple",get max_file_size(){return Ye()},get root(){return He()},onerror:z=>he()(z),get stream_handler(){return t.stream_handler},get upload(){return t.upload},get upload_promise(){return we},set upload_promise(z){we=z},get uploading(){return Le},set uploading(z){Le=z}})},$$slots:{default:!0}})}};f(U,r=>{t.upload&&t.stream_handler&&r(X)})}var G=h(U,2);{var H=r=>{{let l=_(()=>t.i18n("common.webcam"));K(r,{get Icon(){return Lt},get label(){return e(l)},onclick:()=>{ae()("webcam")}})}};f(G,r=>{t.sources.includes("webcam")&&r(H)})}var q=h(G,2);{var C=r=>{{let l=_(()=>t.i18n("common.video"));K(r,{get Icon(){return jt},get label(){return e(l)},onclick:()=>{ae()("webcam-video")}})}};f(q,r=>{t.sources.includes("webcam-video")&&r(C)})}var s=h(q,2);{var u=r=>{{let l=_(()=>t.i18n("upload_text.paste_clipboard"));K(r,{get label(){return e(l)},onclick:()=>{ae()("clipboard")},get Icon(){return Et}})}};f(s,r=>{t.sources.includes("clipboard")&&r(u)})}x(v,L)},$$slots:{default:!0}})};f(Me,M=>{t.interactive&&n()===null&&M(ht)})}var le=h(Me,2);let Ue;Be(le,21,()=>e(d),Te,(M,v,T)=>{var L=Nt(),U=B(L);let X;var G=B(U);{var H=l=>{{let c=_(()=>e(v).caption||""),p=_(()=>typeof e(v).image=="string"?e(v).image:e(v).image.url);ve(l,{get alt(){return e(c)},get src(){return e(p)},loading:"lazy"})}},q=l=>{var c=Zt(),p=ee(c);Se(p);var z=h(p,2);{let Y=_(()=>e(v).caption||null);ge(z,{get src(){return e(v).video.url},get title(){return e(Y)},is_stream:!1,"data-testid":"thumbnail "+(T+1),alt:"",loading:"lazy",loop:!1})}x(l,c)};f(G,l=>{"image"in e(v)?l(H):l(q,!1)})}var C=h(G,2);{var s=l=>{var c=Jt(),p=B(c,!0);I(c),J(()=>We(p,e(v).caption)),x(l,c)};f(C,l=>{e(v).caption&&l(s)})}I(U);var u=h(U,2);{var r=l=>{var c=Kt(),p=B(c);Ce(p),I(c),te("click",c,It(()=>ft(T))),x(l,c)};f(u,l=>{t.interactive&&l(r)})}I(L),J(()=>{X=$(U,1,"thumbnail-item thumbnail-lg svelte-7anmrz",null,X,{selected:n()===T}),Re(U,"aria-label","Thumbnail "+(T+1)+" of "+e(d).length)}),te("click",U,()=>{n()===null&&de()&&Ne()(),n(T)}),x(M,L)}),I(le),I(k),I(i),me(i,M=>pe=M,()=>pe),J(()=>{A=$(k,1,"grid-wrap svelte-7anmrz",null,A,{minimal:fe==="minimal","fixed-height":!O()||O()=="auto",hidden:_e}),W=oe(k,"",W,{height:O()!=="auto"?typeof O()=="number"?O()+"px":O():null}),Ue=$(le,1,"grid-container svelte-7anmrz",null,Ue,{"pt-6":E()}),oe(le,`--grid-cols:${e(it)??""}; --grid-rows:${ce()??""}; --object-fit: ${Ve()??""};`)}),x(a,i)};f(mt,a=>{b()==null||e(d)==null||e(d).length===0?a(vt):a(gt,!1)})}xt("innerHeight",a=>a),x(S,je),zt()}const za=Object.freeze(Object.defineProperty({__proto__:null,default:ea},Symbol.toStringTag,{value:"Module"}));export{ea as G,za as a,ka as h}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Gallery-D2TV53eD.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Gallery-D2TV53eD.css new file mode 100644 index 0000000000000000000000000000000000000000..c1d9ec76b79081faa74ec2fd718ef10468ab3340 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Gallery-D2TV53eD.css @@ -0,0 +1 @@ +.gallery-container.svelte-7anmrz{height:100%;position:relative}.gallery-container.svelte-7anmrz img,button.svelte-7anmrz{width:var(--size-full);height:var(--size-full);object-fit:contain;display:block;border-radius:var(--radius-lg)}.preview.svelte-7anmrz{display:flex;position:absolute;flex-direction:column;z-index:var(--layer-2);border-radius:calc(var(--block-radius) - var(--block-border-width));-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);width:var(--size-full);height:var(--size-full)}.preview.minimal.svelte-7anmrz{width:fit-content;height:fit-content}.preview.svelte-7anmrz:before{content:"";position:absolute;z-index:var(--layer-below);background:var(--background-fill-primary);opacity:.9;width:var(--size-full);height:var(--size-full)}.fixed-height.svelte-7anmrz{min-height:var(--size-80);max-height:55vh}@media(min-width:1280px){.fixed-height.svelte-7anmrz{min-height:450px}}.media-button.svelte-7anmrz{height:calc(100% - 60px);width:100%;display:flex}.media-button.svelte-7anmrz img,.media-button.svelte-7anmrz video{width:var(--size-full);height:var(--size-full);object-fit:contain}.thumbnails.svelte-7anmrz img{object-fit:cover;width:var(--size-full);height:var(--size-full)}.thumbnails.svelte-7anmrz svg{position:absolute;top:var(--size-2);left:var(--size-2);width:50%;height:50%;opacity:50%}.preview.svelte-7anmrz img.with-caption{height:var(--size-full)}.preview.minimal.svelte-7anmrz img.with-caption{height:auto}.caption.svelte-7anmrz{padding:var(--size-2) var(--size-3);overflow:hidden;color:var(--block-label-text-color);font-weight:var(--weight-semibold);text-align:center;text-overflow:ellipsis;white-space:nowrap;align-self:center}.thumbnails.svelte-7anmrz{display:flex;position:absolute;bottom:0;justify-content:flex-start;align-items:center;gap:var(--spacing-lg);width:var(--size-full);height:var(--size-14);overflow-x:scroll}.thumbnail-item.svelte-7anmrz{--ring-color: transparent;position:relative;box-shadow:inset 0 0 0 1px var(--ring-color),var(--shadow-drop);border:1px solid var(--border-color-primary);border-radius:var(--button-small-radius);background:var(--background-fill-secondary);aspect-ratio:var(--ratio-square);width:var(--size-full);height:var(--size-full);overflow:clip}.thumbnail-item.svelte-7anmrz:hover{--ring-color: var(--color-accent);border-color:var(--color-accent);filter:brightness(1.1)}.thumbnail-item.selected.svelte-7anmrz{--ring-color: var(--color-accent);border-color:var(--color-accent)}.thumbnail-item.svelte-7anmrz svg{position:absolute;top:50%;left:50%;width:50%;height:50%;opacity:50%;transform:translate(-50%,-50%)}.thumbnail-item.svelte-7anmrz video{width:var(--size-full);height:var(--size-full);overflow:hidden;object-fit:cover}.thumbnail-small.svelte-7anmrz{flex:none;transform:scale(.9);transition:75ms;width:var(--size-9);height:var(--size-9)}.thumbnail-small.selected.svelte-7anmrz{--ring-color: var(--color-accent);transform:scale(1);border-color:var(--color-accent)}.grid-wrap.svelte-7anmrz{position:relative;padding:var(--size-2);overflow-y:scroll}.grid-container.svelte-7anmrz{display:grid;position:relative;grid-template-rows:repeat(var(--grid-rows),minmax(100px,1fr));grid-template-columns:repeat(var(--grid-cols),minmax(100px,1fr));grid-auto-rows:minmax(100px,1fr);gap:var(--spacing-lg)}.thumbnail-lg.svelte-7anmrz>img{width:var(--size-full);height:var(--size-full);overflow:hidden;object-fit:var(--object-fit)}.thumbnail-lg.svelte-7anmrz:hover .caption-label:where(.svelte-7anmrz){opacity:.5}.caption-label.svelte-7anmrz{position:absolute;right:var(--block-label-margin);bottom:var(--block-label-margin);z-index:var(--layer-1);border-top:1px solid var(--border-color-primary);border-left:1px solid var(--border-color-primary);border-radius:var(--block-label-radius);background:var(--background-fill-secondary);padding:var(--block-label-padding);max-width:80%;overflow:hidden;font-size:var(--block-label-text-size);text-align:left;text-overflow:ellipsis;white-space:nowrap}.grid-wrap.minimal.svelte-7anmrz{padding:0}.gallery-item.svelte-7anmrz{position:relative;width:100%;height:100%}.delete-button.svelte-7anmrz{position:absolute;bottom:0;left:0;z-index:var(--layer-1);border-top:1px solid var(--border-color-primary);border-right:1px solid var(--border-color-primary);border-radius:0 var(--radius-sm) 0 var(--radius-sm);background:var(--background-fill-secondary);padding:var(--block-label-padding);cursor:pointer;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .2s ease;font-size:var(--block-label-text-size);color:var(--block-label-text-color);font-weight:var(--weight-semibold);width:auto;height:auto;min-width:fit-content;min-height:fit-content}.gallery-item.svelte-7anmrz:hover .delete-button:where(.svelte-7anmrz){opacity:1}.delete-button.svelte-7anmrz:hover{opacity:.8}.delete-button.svelte-7anmrz svg{width:var(--text-xs);height:var(--text-md);color:var(--block-label-text-color)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/HTML-Bg_bA9M4.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/HTML-Bg_bA9M4.js new file mode 100644 index 0000000000000000000000000000000000000000..9e499e28d3bc5bd65d5c09c99ec0f2d6b5131879 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/HTML-Bg_bA9M4.js @@ -0,0 +1,22 @@ +import{G as yr,p as W,i as ct,d as Ke,a as kr,b as Je,h as ht}from"./i18n-Dnhn5Rxr.js";import{R as Cr,u as $,v as br,a4 as Pr,y as pt,w as I,x as U,a6 as Lr,S as ft,a as ge,T as Er,V as ae,X as me,Y as oe,a8 as wr,t as ze,a0 as dt,W as rt,a5 as ue,at as xr,b1 as Mr}from"./index-DWyDLubb.js";import{s as Qe}from"./clone-BkeCM4Nl.js";import{s as Ar}from"./snippet-BWgYNF9D.js";var ve={exports:{}},_e={exports:{}},Y={},K={},gt;function J(){if(gt)return K;gt=1,K.__esModule=!0,K.extend=S,K.indexOf=a,K.escapeExpression=s,K.isEmpty=n,K.createFrame=c,K.blockParams=r,K.appendContextPath=t;var v={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},m=/[&<>"'`=]/g,y=/[&<>"'`=]/;function _(e){return v[e]}function S(e){for(var i=1;i0?(p.ids&&(p.ids=[p.name]),_.helpers.each(S,p)):d(this);if(p.data&&p.ids){var a=y.createFrame(p.data);a.contextPath=y.appendContextPath(p.data.contextPath,p.name),p={data:a}}return l(S,p)})},v.exports=m.default})(ye,ye.exports)),ye.exports}var ke={exports:{}},_t;function Nr(){return _t||(_t=1,(function(v,m){m.__esModule=!0;function y(d){return d&&d.__esModule?d:{default:d}}var _=J(),S=X(),p=y(S);m.default=function(d){d.registerHelper("each",function(l,a){if(!a)throw new p.default("Must pass iterator to #each");var s=a.fn,n=a.inverse,c=0,r="",t=void 0,e=void 0;a.data&&a.ids&&(e=_.appendContextPath(a.data.contextPath,a.ids[0])+"."),_.isFunction(l)&&(l=l.call(this)),a.data&&(t=_.createFrame(a.data));function i(u,g,k){t&&(t.key=u,t.index=g,t.first=g===0,t.last=!!k,e&&(t.contextPath=e+u)),r=r+s(l[u],{data:t,blockParams:_.blockParams([l[u],u],[e+u,null])})}if(l&&typeof l=="object")if(_.isArray(l))for(var o=l.length;c=0?p=d:p=parseInt(p,10)}return p},log:function(p){if(p=_.lookupLevel(p),typeof console<"u"&&_.lookupLevel(_.level)<=p){var d=_.methodMap[p];console[d]||(d="log");for(var l=arguments.length,a=Array(l>1?l-1:0),s=1;s= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};Y.REVISION_CHANGES=r;var t="[object Object]";function e(o,h,f){this.helpers=o||{},this.partials=h||{},this.decorators=f||{},S.registerDefaultHelpers(this),p.registerDefaultDecorators(this)}e.prototype={constructor:e,logger:l.default,log:l.default.log,registerHelper:function(h,f){if(m.toString.call(h)===t){if(f)throw new _.default("Arg not supported with multiple helpers");m.extend(this.helpers,h)}else this.helpers[h]=f},unregisterHelper:function(h){delete this.helpers[h]},registerPartial:function(h,f){if(m.toString.call(h)===t)m.extend(this.partials,h);else{if(typeof f>"u")throw new _.default('Attempting to register a partial called "'+h+'" as undefined');this.partials[h]=f}},unregisterPartial:function(h){delete this.partials[h]},registerDecorator:function(h,f){if(m.toString.call(h)===t){if(f)throw new _.default("Arg not supported with multiple decorators");m.extend(this.decorators,h)}else this.decorators[h]=f},unregisterDecorator:function(h){delete this.decorators[h]},resetLoggedPropertyAccesses:function(){a.resetLoggedProperties()}};var i=l.default.log;return Y.log=i,Y.createFrame=m.createFrame,Y.logger=l.default,Y}var Oe={exports:{}},Ot;function Vr(){return Ot||(Ot=1,(function(v,m){m.__esModule=!0;function y(_){this.string=_}y.prototype.toString=y.prototype.toHTML=function(){return""+this.string},m.default=y,v.exports=m.default})(Oe,Oe.exports)),Oe.exports}var ee={},Ne={},Nt;function Gr(){if(Nt)return Ne;Nt=1,Ne.__esModule=!0,Ne.wrapHelper=v;function v(m,y){if(typeof m!="function")return m;var _=function(){var p=arguments[arguments.length-1];return arguments[arguments.length-1]=y(p),m.apply(this,arguments)};return _}return Ne}var Rt;function Ur(){if(Rt)return ee;Rt=1,ee.__esModule=!0,ee.checkRevision=n,ee.template=c,ee.wrapProgram=r,ee.resolvePartial=t,ee.invokePartial=e,ee.noop=i;function v(u){return u&&u.__esModule?u:{default:u}}function m(u){if(u&&u.__esModule)return u;var g={};if(u!=null)for(var k in u)Object.prototype.hasOwnProperty.call(u,k)&&(g[k]=u[k]);return g.default=u,g}var y=J(),_=m(y),S=X(),p=v(S),d=nt(),l=nr(),a=Gr(),s=sr();function n(u){var g=u&&u[0]||1,k=d.COMPILER_REVISION;if(!(g>=d.LAST_COMPATIBLE_COMPILER_REVISION&&g<=d.COMPILER_REVISION))if(g"u"&&(this.lexer.yylloc={});var o=this.lexer.yylloc;c.push(o);var h=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);function f(){var O;return O=a.lexer.lex()||1,typeof O!="number"&&(O=a.symbols_[O]||O),O}for(var C,u,g,k,b={},L,A,E,P;;){if(u=s[s.length-1],this.defaultActions[u]?g=this.defaultActions[u]:((C===null||typeof C>"u")&&(C=f()),g=r[u]&&r[u][C]),typeof g>"u"||!g.length||!g[0]){var w="";{P=[];for(L in r[u])this.terminals_[L]&&L>2&&P.push("'"+this.terminals_[L]+"'");this.lexer.showPosition?w="Parse error on line "+(e+1)+`: +`+this.lexer.showPosition()+` +Expecting `+P.join(", ")+", got '"+(this.terminals_[C]||C)+"'":w="Parse error on line "+(e+1)+": Unexpected "+(C==1?"end of input":"'"+(this.terminals_[C]||C)+"'"),this.parseError(w,{text:this.lexer.match,token:this.terminals_[C]||C,line:this.lexer.yylineno,loc:o,expected:P})}}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+u+", token: "+C);switch(g[0]){case 1:s.push(C),n.push(this.lexer.yytext),c.push(this.lexer.yylloc),s.push(g[1]),C=null,i=this.lexer.yyleng,t=this.lexer.yytext,e=this.lexer.yylineno,o=this.lexer.yylloc;break;case 2:if(A=this.productions_[g[1]][1],b.$=n[n.length-A],b._$={first_line:c[c.length-(A||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(A||1)].first_column,last_column:c[c.length-1].last_column},h&&(b._$.range=[c[c.length-(A||1)].range[0],c[c.length-1].range[1]]),k=this.performAction.call(b,t,i,e,this.yy,g[1],n,c),typeof k<"u")return k;A&&(s=s.slice(0,-1*A*2),n=n.slice(0,-1*A),c=c.slice(0,-1*A)),s.push(this.productions_[g[1]][0]),n.push(b.$),c.push(b._$),E=r[s[s.length-2]][s[s.length-1]],s.push(E);break;case 3:return!0}}return!0}},S=(function(){var d={EOF:1,parseError:function(a,s){if(this.yy.parser)this.yy.parser.parseError(a,s);else throw new Error(a)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var s=a.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var s=a.length,n=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s-1),this.offset-=s;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===c.length?this.yylloc.first_column:0)+c[c.length-n.length].length-n[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-s]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),s=new Array(a.length+1).join("-");return a+this.upcomingInput()+` +`+s+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,s,n,c,r;this._more||(this.yytext="",this.match="");for(var t=this._currentRules(),e=0;es[0].length)&&(s=n,c=e,!this.options.flex)));e++);return s?(r=s[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+s[0].length},this.yytext+=s[0],this.match+=s[0],this.matches=s,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(s[0].length),this.matched+=s[0],a=this.performAction.call(this,this.yy,this,t[c],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a||void 0):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return typeof a<"u"?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return d.options={},d.performAction=function(a,s,n,c){function r(t,e){return s.yytext=s.yytext.substring(t,s.yyleng-e+t)}switch(n){case 0:if(s.yytext.slice(-2)==="\\\\"?(r(0,1),this.begin("mu")):s.yytext.slice(-1)==="\\"?(r(0,1),this.begin("emu")):this.begin("mu"),s.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw"?15:(r(5,9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(s.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return s.yytext=r(1,2).replace(/\\"/g,'"'),80;case 32:return s.yytext=r(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return s.yytext=s.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},d.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],d.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},d})();_.lexer=S;function p(){this.yy={}}return p.prototype=_,_.Parser=p,new p})();m.default=y,v.exports=m.default})(De,De.exports)),De.exports}var Be={exports:{}},qe={exports:{}},Ht;function ur(){return Ht||(Ht=1,(function(v,m){m.__esModule=!0;function y(s){return s&&s.__esModule?s:{default:s}}var _=X(),S=y(_);function p(){this.parents=[]}p.prototype={constructor:p,mutating:!1,acceptKey:function(n,c){var r=this.accept(n[c]);if(this.mutating){if(r&&!p.prototype[r.type])throw new S.default('Unexpected node type "'+r.type+'" found when accepting '+c+" on "+n.type);n[c]=r}},acceptRequired:function(n,c){if(this.acceptKey(n,c),!n[c])throw new S.default(n.type+" requires "+c)},acceptArray:function(n){for(var c=0,r=n.length;c0)throw new y.default("Invalid path: "+h,{loc:o});k===".."&&C++}else f.push(k)}return{type:"PathExpression",data:e,depth:C,parts:f,original:h,loc:o}}function s(e,i,o,h,f,C){var u=h.charAt(3)||h.charAt(2),g=u!=="{"&&u!=="&",k=/\*/.test(h);return{type:k?"Decorator":"MustacheStatement",path:e,params:i,hash:o,escaped:g,strip:f,loc:this.locInfo(C)}}function n(e,i,o,h){_(e,o),h=this.locInfo(h);var f={type:"Program",body:i,strip:{},loc:h};return{type:"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:f,openStrip:{},inverseStrip:{},closeStrip:{},loc:h}}function c(e,i,o,h,f,C){h&&h.path&&_(e,h);var u=/\*/.test(e.open);i.blockParams=e.blockParams;var g=void 0,k=void 0;if(o){if(u)throw new y.default("Unexpected inverse block on decorator",o);o.chain&&(o.program.body[0].closeStrip=h.strip),k=o.strip,g=o.program}return f&&(f=g,g=i,i=f),{type:u?"DecoratorBlock":"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:i,inverse:g,openStrip:e.strip,inverseStrip:k,closeStrip:h&&h.strip,loc:this.locInfo(C)}}function r(e,i){if(!i&&e.length){var o=e[0].loc,h=e[e.length-1].loc;o&&h&&(i={source:o.source,start:{line:o.start.line,column:o.start.column},end:{line:h.end.line,column:h.end.column}})}return{type:"Program",body:e,strip:{},loc:i}}function t(e,i,o,h){return _(e,o),{type:"PartialBlockStatement",name:e.path,params:e.params,hash:e.hash,program:i,openStrip:e.strip,closeStrip:o&&o.strip,loc:this.locInfo(h)}}return z}var Vt;function Qr(){if(Vt)return ne;Vt=1,ne.__esModule=!0,ne.parseWithoutProcessing=n,ne.parse=c;function v(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t.default=r,t}function m(r){return r&&r.__esModule?r:{default:r}}var y=Kr(),_=m(y),S=Jr(),p=m(S),d=zr(),l=v(d),a=J();ne.parser=_.default;var s={};a.extend(s,l);function n(r,t){if(r.type==="Program")return r;_.default.yy=s,s.locInfo=function(i){return new s.SourceLocation(t&&t.srcName,i)};var e=_.default.parse(r);return e}function c(r,t){var e=n(r,t),i=new p.default(t);return i.accept(e)}return ne}var ie={},Gt;function Yr(){if(Gt)return ie;Gt=1,ie.__esModule=!0,ie.Compiler=l,ie.precompile=a,ie.compile=s;function v(r){return r&&r.__esModule?r:{default:r}}var m=X(),y=v(m),_=J(),S=or(),p=v(S),d=[].slice;function l(){}l.prototype={compiler:l,equals:function(t){var e=this.opcodes.length;if(t.opcodes.length!==e)return!1;for(var i=0;i1)throw new y.default("Unsupported number of partial arguments: "+i.length,t);i.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):i.push({type:"PathExpression",parts:[],depth:0}));var o=t.name.original,h=t.name.type==="SubExpression";h&&this.accept(t.name),this.setupFullMustacheParams(t,e,void 0,!0);var f=t.indent||"";this.options.preventIndent&&f&&(this.opcode("appendContent",f),f=""),this.opcode("invokePartial",h,o,f),this.opcode("append")},PartialBlockStatement:function(t){this.PartialStatement(t)},MustacheStatement:function(t){this.SubExpression(t),t.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(t){this.DecoratorBlock(t)},ContentStatement:function(t){t.value&&this.opcode("appendContent",t.value)},CommentStatement:function(){},SubExpression:function(t){c(t);var e=this.classifySexpr(t);e==="simple"?this.simpleSexpr(t):e==="helper"?this.helperSexpr(t):this.ambiguousSexpr(t)},ambiguousSexpr:function(t,e,i){var o=t.path,h=o.parts[0],f=e!=null||i!=null;this.opcode("getContext",o.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",i),o.strict=!0,this.accept(o),this.opcode("invokeAmbiguous",h,f)},simpleSexpr:function(t){var e=t.path;e.strict=!0,this.accept(e),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,e,i){var o=this.setupFullMustacheParams(t,e,i),h=t.path,f=h.parts[0];if(this.options.knownHelpers[f])this.opcode("invokeKnownHelper",o.length,f);else{if(this.options.knownHelpersOnly)throw new y.default("You specified knownHelpersOnly, but used the unknown helper "+f,t);h.strict=!0,h.falsy=!0,this.accept(h),this.opcode("invokeHelper",o.length,h.original,p.default.helpers.simpleId(h))}},PathExpression:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0],i=p.default.helpers.scopedId(t),o=!t.depth&&!i&&this.blockParamIndex(e);o?this.opcode("lookupBlockParam",o,t.parts):e?t.data?(this.options.data=!0,this.opcode("lookupData",t.depth,t.parts,t.strict)):this.opcode("lookupOnContext",t.parts,t.falsy,t.strict,i):this.opcode("pushContext")},StringLiteral:function(t){this.opcode("pushString",t.value)},NumberLiteral:function(t){this.opcode("pushLiteral",t.value)},BooleanLiteral:function(t){this.opcode("pushLiteral",t.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(t){var e=t.pairs,i=0,o=e.length;for(this.opcode("pushHash");i=0)return[e,h]}}};function a(r,t,e){if(r==null||typeof r!="string"&&r.type!=="Program")throw new y.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+r);t=t||{},"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0);var i=e.parse(r,t),o=new e.Compiler().compile(i,t);return new e.JavaScriptCompiler().compile(o,t)}function s(r,t,e){if(t===void 0&&(t={}),r==null||typeof r!="string"&&r.type!=="Program")throw new y.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+r);t=_.extend({},t),"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0);var i=void 0;function o(){var f=e.parse(r,t),C=new e.Compiler().compile(f,t),u=new e.JavaScriptCompiler().compile(C,t,void 0,!0);return e.template(u)}function h(f,C){return i||(i=o()),i.call(this,f,C)}return h._setup=function(f){return i||(i=o()),i._setup(f)},h._child=function(f,C,u,g){return i||(i=o()),i._child(f,C,u,g)},h}function n(r,t){if(r===t)return!0;if(_.isArray(r)&&_.isArray(t)&&r.length===t.length){for(var e=0;e>1;return a?-s:s}return Fe.encode=function(a){var s="",n,c=p(a);do n=c&_,c>>>=m,c>0&&(n|=S),s+=v.encode(n);while(c>0);return s},Fe.decode=function(a,s,n){var c=a.length,r=0,t=0,e,i;do{if(s>=c)throw new Error("Expected more digits in base 64 VLQ value.");if(i=v.decode(a.charCodeAt(s++)),i===-1)throw new Error("Invalid base64 digit: "+a.charAt(s-1));e=!!(i&S),i&=_,r=r+(i<=0;P--)A=L[P],A==="."?L.splice(P,1):A===".."?E++:E>0&&(A===""?(L.splice(P+1,E),E=0):(L.splice(P,2),E--));return g=L.join("/"),g===""&&(g=b?"/":"."),k?(k.path=g,p(k)):g}v.normalize=d;function l(u,g){u===""&&(u="."),g===""&&(g=".");var k=S(g),b=S(u);if(b&&(u=b.path||"/"),k&&!k.scheme)return b&&(k.scheme=b.scheme),p(k);if(k||g.match(_))return g;if(b&&!b.host&&!b.path)return b.host=g,p(b);var L=g.charAt(0)==="/"?g:d(u.replace(/\/+$/,"")+"/"+g);return b?(b.path=L,p(b)):L}v.join=l,v.isAbsolute=function(u){return u.charAt(0)==="/"||y.test(u)};function a(u,g){u===""&&(u="."),u=u.replace(/\/$/,"");for(var k=0;g.indexOf(u+"/")!==0;){var b=u.lastIndexOf("/");if(b<0||(u=u.slice(0,b),u.match(/^([^\/]+:\/)?\/*$/)))return g;++k}return Array(k+1).join("../")+g.substr(u.length+1)}v.relative=a;var s=(function(){var u=Object.create(null);return!("__proto__"in u)})();function n(u){return u}function c(u){return t(u)?"$"+u:u}v.toSetString=s?n:c;function r(u){return t(u)?u.slice(1):u}v.fromSetString=s?n:r;function t(u){if(!u)return!1;var g=u.length;if(g<9||u.charCodeAt(g-1)!==95||u.charCodeAt(g-2)!==95||u.charCodeAt(g-3)!==111||u.charCodeAt(g-4)!==116||u.charCodeAt(g-5)!==111||u.charCodeAt(g-6)!==114||u.charCodeAt(g-7)!==112||u.charCodeAt(g-8)!==95||u.charCodeAt(g-9)!==95)return!1;for(var k=g-10;k>=0;k--)if(u.charCodeAt(k)!==36)return!1;return!0}function e(u,g,k){var b=o(u.source,g.source);return b!==0||(b=u.originalLine-g.originalLine,b!==0)||(b=u.originalColumn-g.originalColumn,b!==0||k)||(b=u.generatedColumn-g.generatedColumn,b!==0)||(b=u.generatedLine-g.generatedLine,b!==0)?b:o(u.name,g.name)}v.compareByOriginalPositions=e;function i(u,g,k){var b=u.generatedLine-g.generatedLine;return b!==0||(b=u.generatedColumn-g.generatedColumn,b!==0||k)||(b=o(u.source,g.source),b!==0)||(b=u.originalLine-g.originalLine,b!==0)||(b=u.originalColumn-g.originalColumn,b!==0)?b:o(u.name,g.name)}v.compareByGeneratedPositionsDeflated=i;function o(u,g){return u===g?0:u===null?1:g===null?-1:u>g?1:-1}function h(u,g){var k=u.generatedLine-g.generatedLine;return k!==0||(k=u.generatedColumn-g.generatedColumn,k!==0)||(k=o(u.source,g.source),k!==0)||(k=u.originalLine-g.originalLine,k!==0)||(k=u.originalColumn-g.originalColumn,k!==0)?k:o(u.name,g.name)}v.compareByGeneratedPositionsInflated=h;function f(u){return JSON.parse(u.replace(/^\)]}'[^\n]*\n/,""))}v.parseSourceMapInput=f;function C(u,g,k){if(g=g||"",u&&(u[u.length-1]!=="/"&&g[0]!=="/"&&(u+="/"),g=u+g),k){var b=S(k);if(!b)throw new Error("sourceMapURL could not be parsed");if(b.path){var L=b.path.lastIndexOf("/");L>=0&&(b.path=b.path.substring(0,L+1))}g=l(p(b),g)}return d(g)}v.computeSourceURL=C})(Xe)),Xe}var Ze={},Jt;function cr(){if(Jt)return Ze;Jt=1;var v=pe(),m=Object.prototype.hasOwnProperty,y=typeof Map<"u";function _(){this._array=[],this._set=y?new Map:Object.create(null)}return _.fromArray=function(p,d){for(var l=new _,a=0,s=p.length;a=0)return d}else{var l=v.toSetString(p);if(m.call(this._set,l))return this._set[l]}throw new Error('"'+p+'" is not in the set.')},_.prototype.at=function(p){if(p>=0&&pp||d==p&&a>=l||v.compareByGeneratedPositionsInflated(_,S)<=0}function y(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return y.prototype.unsortedForEach=function(S,p){this._array.forEach(S,p)},y.prototype.add=function(S){m(this._last,S)?(this._last=S,this._array.push(S)):(this._sorted=!1,this._array.push(S))},y.prototype.toArray=function(){return this._sorted||(this._array.sort(v.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},je.MappingList=y,je}var Qt;function hr(){if(Qt)return Ye;Qt=1;var v=lr(),m=pe(),y=cr().ArraySet,_=Zr().MappingList;function S(p){p||(p={}),this._file=m.getArg(p,"file",null),this._sourceRoot=m.getArg(p,"sourceRoot",null),this._skipValidation=m.getArg(p,"skipValidation",!1),this._sources=new y,this._names=new y,this._mappings=new _,this._sourcesContents=null}return S.prototype._version=3,S.fromSourceMap=function(d){var l=d.sourceRoot,a=new S({file:d.file,sourceRoot:l});return d.eachMapping(function(s){var n={generated:{line:s.generatedLine,column:s.generatedColumn}};s.source!=null&&(n.source=s.source,l!=null&&(n.source=m.relative(l,n.source)),n.original={line:s.originalLine,column:s.originalColumn},s.name!=null&&(n.name=s.name)),a.addMapping(n)}),d.sources.forEach(function(s){var n=s;l!==null&&(n=m.relative(l,s)),a._sources.has(n)||a._sources.add(n);var c=d.sourceContentFor(s);c!=null&&a.setSourceContent(s,c)}),a},S.prototype.addMapping=function(d){var l=m.getArg(d,"generated"),a=m.getArg(d,"original",null),s=m.getArg(d,"source",null),n=m.getArg(d,"name",null);this._skipValidation||this._validateMapping(l,a,s,n),s!=null&&(s=String(s),this._sources.has(s)||this._sources.add(s)),n!=null&&(n=String(n),this._names.has(n)||this._names.add(n)),this._mappings.add({generatedLine:l.line,generatedColumn:l.column,originalLine:a!=null&&a.line,originalColumn:a!=null&&a.column,source:s,name:n})},S.prototype.setSourceContent=function(d,l){var a=d;this._sourceRoot!=null&&(a=m.relative(this._sourceRoot,a)),l!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[m.toSetString(a)]=l):this._sourcesContents&&(delete this._sourcesContents[m.toSetString(a)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},S.prototype.applySourceMap=function(d,l,a){var s=l;if(l==null){if(d.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);s=d.file}var n=this._sourceRoot;n!=null&&(s=m.relative(n,s));var c=new y,r=new y;this._mappings.unsortedForEach(function(t){if(t.source===s&&t.originalLine!=null){var e=d.originalPositionFor({line:t.originalLine,column:t.originalColumn});e.source!=null&&(t.source=e.source,a!=null&&(t.source=m.join(a,t.source)),n!=null&&(t.source=m.relative(n,t.source)),t.originalLine=e.line,t.originalColumn=e.column,e.name!=null&&(t.name=e.name))}var i=t.source;i!=null&&!c.has(i)&&c.add(i);var o=t.name;o!=null&&!r.has(o)&&r.add(o)},this),this._sources=c,this._names=r,d.sources.forEach(function(t){var e=d.sourceContentFor(t);e!=null&&(a!=null&&(t=m.join(a,t)),n!=null&&(t=m.relative(n,t)),this.setSourceContent(t,e))},this)},S.prototype._validateMapping=function(d,l,a,s){if(l&&typeof l.line!="number"&&typeof l.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(d&&"line"in d&&"column"in d&&d.line>0&&d.column>=0&&!l&&!a&&!s)){if(d&&"line"in d&&"column"in d&&l&&"line"in l&&"column"in l&&d.line>0&&d.column>=0&&l.line>0&&l.column>=0&&a)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:d,source:a,original:l,name:s}))}},S.prototype._serializeMappings=function(){for(var d=0,l=1,a=0,s=0,n=0,c=0,r="",t,e,i,o,h=this._mappings.toArray(),f=0,C=h.length;f0){if(!m.compareByGeneratedPositionsInflated(e,h[f-1]))continue;t+=","}t+=v.encode(e.generatedColumn-d),d=e.generatedColumn,e.source!=null&&(o=this._sources.indexOf(e.source),t+=v.encode(o-c),c=o,t+=v.encode(e.originalLine-1-s),s=e.originalLine-1,t+=v.encode(e.originalColumn-a),a=e.originalColumn,e.name!=null&&(i=this._names.indexOf(e.name),t+=v.encode(i-n),n=i)),r+=t}return r},S.prototype._generateSourcesContent=function(d,l){return d.map(function(a){if(!this._sourcesContents)return null;l!=null&&(a=m.relative(l,a));var s=m.toSetString(a);return Object.prototype.hasOwnProperty.call(this._sourcesContents,s)?this._sourcesContents[s]:null},this)},S.prototype.toJSON=function(){var d={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(d.file=this._file),this._sourceRoot!=null&&(d.sourceRoot=this._sourceRoot),this._sourcesContents&&(d.sourcesContent=this._generateSourcesContent(d.sources,d.sourceRoot)),d},S.prototype.toString=function(){return JSON.stringify(this.toJSON())},Ye.SourceMapGenerator=S,Ye}var he={},$e={},Yt;function jr(){return Yt||(Yt=1,(function(v){v.GREATEST_LOWER_BOUND=1,v.LEAST_UPPER_BOUND=2;function m(y,_,S,p,d,l){var a=Math.floor((_-y)/2)+y,s=d(S,p[a],!0);return s===0?a:s>0?_-a>1?m(a,_,S,p,d,l):l==v.LEAST_UPPER_BOUND?_1?m(y,a,S,p,d,l):l==v.LEAST_UPPER_BOUND?a:y<0?-1:y}v.search=function(_,S,p,d){if(S.length===0)return-1;var l=m(-1,S.length,_,S,p,d||v.GREATEST_LOWER_BOUND);if(l<0)return-1;for(;l-1>=0&&p(S[l],S[l-1],!0)===0;)--l;return l}})($e)),$e}var et={},Xt;function $r(){if(Xt)return et;Xt=1;function v(_,S,p){var d=_[S];_[S]=_[p],_[p]=d}function m(_,S){return Math.round(_+Math.random()*(S-_))}function y(_,S,p,d){if(p=0){var i=this._originalMappings[e];if(n.column===void 0)for(var o=i.originalLine;i&&i.originalLine===o;)t.push({line:v.getArg(i,"generatedLine",null),column:v.getArg(i,"generatedColumn",null),lastColumn:v.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++e];else for(var h=i.originalColumn;i&&i.originalLine===c&&i.originalColumn==h;)t.push({line:v.getArg(i,"generatedLine",null),column:v.getArg(i,"generatedColumn",null),lastColumn:v.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++e]}return t},he.SourceMapConsumer=p;function d(s,n){var c=s;typeof s=="string"&&(c=v.parseSourceMapInput(s));var r=v.getArg(c,"version"),t=v.getArg(c,"sources"),e=v.getArg(c,"names",[]),i=v.getArg(c,"sourceRoot",null),o=v.getArg(c,"sourcesContent",null),h=v.getArg(c,"mappings"),f=v.getArg(c,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);i&&(i=v.normalize(i)),t=t.map(String).map(v.normalize).map(function(C){return i&&v.isAbsolute(i)&&v.isAbsolute(C)?v.relative(i,C):C}),this._names=y.fromArray(e.map(String),!0),this._sources=y.fromArray(t,!0),this._absoluteSources=this._sources.toArray().map(function(C){return v.computeSourceURL(i,C,n)}),this.sourceRoot=i,this.sourcesContent=o,this._mappings=h,this._sourceMapURL=n,this.file=f}d.prototype=Object.create(p.prototype),d.prototype.consumer=p,d.prototype._findSourceIndex=function(s){var n=s;if(this.sourceRoot!=null&&(n=v.relative(this.sourceRoot,n)),this._sources.has(n))return this._sources.indexOf(n);var c;for(c=0;c1&&(L.source=o+E[1],o+=E[1],L.originalLine=e+E[2],e=L.originalLine,L.originalLine+=1,L.originalColumn=i+E[3],i=L.originalColumn,E.length>4&&(L.name=h+E[4],h+=E[4])),b.push(L),typeof L.originalLine=="number"&&k.push(L)}S(b,v.compareByGeneratedPositionsDeflated),this.__generatedMappings=b,S(k,v.compareByOriginalPositions),this.__originalMappings=k},d.prototype._findMapping=function(n,c,r,t,e,i){if(n[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+n[r]);if(n[t]<0)throw new TypeError("Column must be greater than or equal to 0, got "+n[t]);return m.search(n,c,e,i)},d.prototype.computeColumnSpans=function(){for(var n=0;n=0){var t=this._generatedMappings[r];if(t.generatedLine===c.generatedLine){var e=v.getArg(t,"source",null);e!==null&&(e=this._sources.at(e),e=v.computeSourceURL(this.sourceRoot,e,this._sourceMapURL));var i=v.getArg(t,"name",null);return i!==null&&(i=this._names.at(i)),{source:e,line:v.getArg(t,"originalLine",null),column:v.getArg(t,"originalColumn",null),name:i}}}return{source:null,line:null,column:null,name:null}},d.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(n){return n==null}):!1},d.prototype.sourceContentFor=function(n,c){if(!this.sourcesContent)return null;var r=this._findSourceIndex(n);if(r>=0)return this.sourcesContent[r];var t=n;this.sourceRoot!=null&&(t=v.relative(this.sourceRoot,t));var e;if(this.sourceRoot!=null&&(e=v.urlParse(this.sourceRoot))){var i=t.replace(/^file:\/\//,"");if(e.scheme=="file"&&this._sources.has(i))return this.sourcesContent[this._sources.indexOf(i)];if((!e.path||e.path=="/")&&this._sources.has("/"+t))return this.sourcesContent[this._sources.indexOf("/"+t)]}if(c)return null;throw new Error('"'+t+'" is not in the SourceMap.')},d.prototype.generatedPositionFor=function(n){var c=v.getArg(n,"source");if(c=this._findSourceIndex(c),c<0)return{line:null,column:null,lastColumn:null};var r={source:c,originalLine:v.getArg(n,"line"),originalColumn:v.getArg(n,"column")},t=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",v.compareByOriginalPositions,v.getArg(n,"bias",p.GREATEST_LOWER_BOUND));if(t>=0){var e=this._originalMappings[t];if(e.source===r.source)return{line:v.getArg(e,"generatedLine",null),column:v.getArg(e,"generatedColumn",null),lastColumn:v.getArg(e,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},he.BasicSourceMapConsumer=d;function a(s,n){var c=s;typeof s=="string"&&(c=v.parseSourceMapInput(s));var r=v.getArg(c,"version"),t=v.getArg(c,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new y,this._names=new y;var e={line:-1,column:0};this._sections=t.map(function(i){if(i.url)throw new Error("Support for url field in sections not implemented.");var o=v.getArg(i,"offset"),h=v.getArg(o,"line"),f=v.getArg(o,"column");if(h=0;a--)this.prepend(l[a]);else if(l[S]||typeof l=="string")this.children.unshift(l);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+l);return this},p.prototype.walk=function(l){for(var a,s=0,n=this.children.length;s0){for(a=[],s=0;s0&&(i+=", "+o.join(", "));var h=0;Object.keys(this.aliases).forEach(function(u){var g=e.aliases[u];g.children&&g.referenceCount>1&&(i+=", alias"+ ++h+"="+u,g.children[0]="alias"+h)}),this.lookupPropertyFunctionIsUsed&&(i+=", "+this.lookupPropertyFunctionVarDeclaration());var f=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&f.push("blockParams"),this.useDepths&&f.push("depths");var C=this.mergeSource(i);return t?(f.push(C),Function.apply(this,f)):this.source.wrap(["function(",f.join(","),`) { + `,C,"}"])},mergeSource:function(t){var e=this.environment.isSimple,i=!this.forceBuffer,o=void 0,h=void 0,f=void 0,C=void 0;return this.source.each(function(u){u.appendToBuffer?(f?u.prepend(" + "):f=u,C=u):(f&&(h?f.prepend("buffer += "):o=!0,C.add(";"),f=C=void 0),h=!0,e||(i=!1))}),i?f?(f.prepend("return "),C.add(";")):h||this.source.push('return "";'):(t+=", buffer = "+(o?"":this.initializeBuffer()),f?(f.prepend("return buffer + "),C.add(";")):this.source.push("return buffer;")),t&&this.source.prepend("var "+t.substring(2)+(o?"":`; +`)),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return` + lookupProperty = container.lookupProperty || function(parent, propertyName) { + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return parent[propertyName]; + } + return undefined + } + `.trim()},blockValue:function(t){var e=this.aliasable("container.hooks.blockHelperMissing"),i=[this.contextName(0)];this.setupHelperArgs(t,0,i);var o=this.popStack();i.splice(1,0,o),this.push(this.source.functionCall(e,"call",i))},ambiguousBlockValue:function(){var t=this.aliasable("container.hooks.blockHelperMissing"),e=[this.contextName(0)];this.setupHelperArgs("",0,e,!0),this.flushInline();var i=this.topStack();e.splice(1,0,i),this.pushSource(["if (!",this.lastHelper,") { ",i," = ",this.source.functionCall(t,"call",e),"}"])},appendContent:function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},append:function(){if(this.isInline())this.replaceStack(function(e){return[" != null ? ",e,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(t){this.lastContext=t},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(t,e,i,o){var h=0;!o&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(t[h++])):this.pushContext(),this.resolvePath("context",t,h,e,i)},lookupBlockParam:function(t,e){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",e,1)},lookupData:function(t,e,i){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",e,0,!0,i)},resolvePath:function(t,e,i,o,h){var f=this;if(this.options.strict||this.options.assumeObjects){this.push(c(this.options.strict&&h,this,e,i,t));return}for(var C=e.length;ithis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var t=this.inlineStack;this.inlineStack=[];for(var e=0,i=t.length;eError rendering : '),cn=rt("
      ",1),hn=rt("
      ");function mn(v,m){Cr(m,!0);let y=W(m,"elem_classes",19,()=>[]),_=W(m,"props",23,()=>({})),S=W(m,"html_template",3,"${value}"),p=W(m,"css_template",3,""),d=W(m,"js_on_load",3,null),l=W(m,"head",3,null),a=W(m,"visible",3,!0),s=W(m,"autoscroll",3,!1),n=W(m,"apply_default_css",3,!0),c=W(m,"component_class_name",3,"HTML"),r=W(m,"upload",3,null),t=W(m,"server",19,()=>({})),e=W(m,"watch_fn",3,(x,M)=>{}),i=W(m,"fire_watchers",3,x=>{}),o=ue(()=>{if(S().includes("@children")&&m.children){const x=S().split("@children");return[!0,x[0]||"",x.slice(1).join("@children")||""]}return[!1,S(),""]}),h=ue(()=>xr(I(o),3)),f=ue(()=>I(h)[0]),C=ue(()=>I(h)[1]),u=ue(()=>I(h)[2]),g=$(br(Qe(_())));const k=Pr(),b=(x,M={})=>{k("event",{type:x,data:M})};let L,A,E,P=null,w=`html-${Math.random().toString(36).substring(2,11)}`,O=null,R={},H=$(""),F=$(""),Z=$(""),Ge=$(""),Ue=$(!1),it=$(!1),fe=$(null),de=$(null);function pr(x){let M=x.parentElement;for(;M;){const N=window.getComputedStyle(M);if(N.overflow==="auto"||N.overflow==="scroll"||N.overflowY==="auto"||N.overflowY==="scroll")return M;M=M.parentElement}return null}function fr(){return L?P?P.offsetHeight+P.scrollTop>=P.scrollHeight-100:window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-100:!0}function st(){L&&(P?P.scrollTo(0,P.scrollHeight):window.scrollTo(0,document.documentElement.scrollHeight))}async function at(){!s()||!L||(P||(P=pr(L)),fr()&&(await new Promise(x=>setTimeout(x,300)),st()))}function te(x,M,N="html"){try{const V=un.compile(x)(M),B=Object.keys(M),T=Object.values(M),G=new Function(...B,`return \`${V}\`;`);return N==="html"?U(fe,null):N==="css"&&U(de,null),G(...T)}catch(D){return console.error("Error evaluating template:",D),N==="html"?U(fe,D instanceof Error?D.message:String(D),!0):N==="css"&&U(de,D instanceof Error?D.message:String(D),!0),""}}function ot(){typeof document>"u"||(O||(O=document.createElement("style"),document.head.appendChild(O)),U(Ge,te(p(),R,"css"),!0),I(Ge)?O.textContent=`#${w} { ${I(Ge)} }`:O.textContent="")}function We(x,M,N){if(!x||M===N)return;const D=document.createElement("div");D.innerHTML=N;const V=Array.from(x.childNodes),B=Array.from(D.childNodes),T=Math.max(V.length,B.length);for(let G=0;G{U(Ue,!1),dr(),ot()}))}async function mr(x){if(!x)return;const N=new DOMParser().parseFromString(`${x}`,"text/html"),D=[];for(const V of Array.from(N.head.children))if(V.tagName==="SCRIPT"){const B=V.src;if(B){if(document.querySelector(`script[src="${B}"]`))continue;const T=document.createElement("script");T.src=B,D.push(new Promise((G,Q)=>{T.onload=()=>G(),T.onerror=()=>Q(new Error(`Failed to load script: ${B}`))})),document.head.appendChild(T)}else{const T=document.createElement("script");T.textContent=V.textContent,document.head.appendChild(T)}}else V.tagName==="LINK"&&V.href&&document.querySelector(`link[href="${V.href}"]`)||document.head.appendChild(V.cloneNode(!0));await Promise.all(D)}pt(()=>{!L||I(it)||(U(it,!0),R=new Proxy(Qe(_()),{set(x,M,N){const D=x[M];return x[M]=N,D!==N&&(gr(),(M==="value"||M==="label"||M==="visible")&&(_()[M]=N,I(g)[M]=N,k("update_value",{data:N,property:M}))),!0}}),I(f)?(U(F,te(I(C),R,"html"),!0),A.innerHTML=I(F),U(Z,te(I(u),R,"html"),!0),E.innerHTML=I(Z)):(U(H,te(S(),R,"html"),!0),L.innerHTML=I(H)),ot(),s()&&st(),at(),(async()=>{if(l()&&await mr(l()),d()&&L)try{const x=r()??(async N=>{throw new Error("upload is not available in this context")});new Function("element","trigger","props","server","upload","watch",d())(L,b,R,t(),x,e())}catch(x){console.error("Error executing js_on_load:",x)}})())}),pt(()=>{if(R&&_()&&JSON.stringify(I(g))!==JSON.stringify(_())){const x=[];for(const M in _())JSON.stringify(R[M])!==JSON.stringify(_()[M])&&x.push(M),R[M]=Qe(_()[M]);U(g,_(),!0),x.length>0&&queueMicrotask(()=>i()(x))}});var lt=Lr(),vr=ft(lt);{var _r=x=>{var M=ln(),N=ae(M),D=me(ae(N)),V=ae(D,!0);oe(D),wr(),oe(N);var B=me(N,2),T=ae(B,!0);oe(B),oe(M),ze(()=>{dt(V,c()),dt(T,I(fe)||I(de))}),ge(x,M)},Sr=x=>{var M=hn();let N;var D=ae(M);{var V=B=>{var T=cn(),G=ft(T);Ke(G,j=>A=j,()=>A);var Q=me(G,2);Ar(Q,()=>m.children??Mr);var q=me(Q,2);Ke(q,j=>E=j,()=>E),ze(()=>{Je(G,1,ht(n()?"prose gradio-style":"")),Je(q,1,ht(n()?"prose gradio-style":""))}),ge(B,T)};ct(D,B=>{I(f)&&B(V)})}oe(M),Ke(M,B=>L=B,()=>L),ze(B=>{kr(M,"id",w),N=Je(M,1,`${n()&&!I(f)?"prose gradio-style":""} ${B??""}`,"svelte-26mp0t",N,{hide:!a(),has_children:I(f)})},[()=>y().join(" ")]),ge(x,M)};ct(vr,x=>{I(fe)||I(de)?x(_r):x(Sr,!1)})}ge(v,lt),Er()}export{mn as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/HTML-CCquOCqP.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/HTML-CCquOCqP.css new file mode 100644 index 0000000000000000000000000000000000000000..96c71274943337b0315aef2b339088620808866a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/HTML-CCquOCqP.css @@ -0,0 +1 @@ +.hide.svelte-26mp0t{display:none}.has_children.svelte-26mp0t{display:flex;flex-direction:column;gap:var(--layout-gap)}.error-container.svelte-26mp0t{padding:12px;background-color:#fee;border:1px solid #fcc;border-radius:4px;color:#c33;font-family:monospace;font-size:13px}.error-title.svelte-26mp0t{display:block;margin-bottom:8px}.error-component-name.svelte-26mp0t{background-color:#fdd;padding:2px 4px;border-radius:2px}.error-message.svelte-26mp0t{white-space:pre-wrap;word-break:break-word} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/IconButtonWrapper-D0s9l4wW.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/IconButtonWrapper-D0s9l4wW.js new file mode 100644 index 0000000000000000000000000000000000000000..02ea037fe3611c2da52b5f406ef6d96f4d44cabc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/IconButtonWrapper-D0s9l4wW.js @@ -0,0 +1 @@ +import{p as r,e as j,i as f,a as W,b as q,k as A,u as D}from"./i18n-Dnhn5Rxr.js";import{R,G as v,z as d,t as y,Z as E,a as l,T,U as z,V as w,a0 as F,W as B,Y as C,X as H,a6 as h,S as x,w as G}from"./index-DWyDLubb.js";import{s as J}from"./snippet-BWgYNF9D.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";var K=B(' '),L=B('');function M(b,a){R(a,!1);let t=r(a,"button",12),u=r(a,"on_click",12);var p={get button(){return t()},set button(e){t(e),z()},get on_click(){return u()},set on_click(e){u(e),z()}};j();var n=L(),_=w(n);{var s=e=>{var i=K(),m=w(i,!0);C(i),y(()=>F(m,(v(t()),d(()=>t().value)))),l(e,i)};f(_,e=>{v(t()),d(()=>t().value)&&e(s)})}return C(n),y(()=>{W(n,"title",(v(t()),d(()=>t().value||""))),W(n,"aria-label",(v(t()),d(()=>t().value||"Custom action")))}),E("click",n,()=>u()(t().id)),l(b,n),T(p)}var N=B("
      ");function tt(b,a){R(a,!0);let t=r(a,"top_panel",3,!0),u=r(a,"display_top_corner",3,!1),p=r(a,"show_background",3,!0),n=r(a,"buttons",3,null),_=r(a,"on_custom_button_click",3,null);var s=N(),e=w(s);{var i=o=>{var c=h(),g=x(c);J(g,()=>a.children),l(o,c)};f(e,o=>{a.children&&o(i)})}var m=H(e,2);{var U=o=>{var c=h(),g=x(c);A(g,17,n,D,(V,I)=>{var S=h(),X=x(S);{var Y=k=>{M(k,{get button(){return G(I)},on_click:Z=>{_()&&_()(Z)}})};f(X,k=>{typeof G(I)!="string"&&k(Y)})}l(V,S)}),l(o,c)};f(m,o=>{n()&&o(U)})}C(s),y(()=>q(s,1,`icon-button-wrapper ${t()?"top-panel":""} ${u()?"display-top-corner":"hide-top-corner"} ${p()?"":"no-background"}`,"svelte-1pnho82")),l(b,s),T()}export{M as C,tt as I}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Image-CeW7PJs4.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Image-CeW7PJs4.js new file mode 100644 index 0000000000000000000000000000000000000000..ef18cc6efa18a0a61f1ebd52f259220830d0a08d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Image-CeW7PJs4.js @@ -0,0 +1 @@ +import{c as i}from"./i18n-Dnhn5Rxr.js";import{R as o,Z as r,a as m,T as n,W as c,_ as l}from"./index-DWyDLubb.js";import{b as d}from"./misc-vsnLZ-Y1.js";/* empty css */var f=c("");function g(s,t){o(t,!0);var a=f();i(a,e=>({src:t.src,class:e,"data-testid":t.data_testid,...t.restProps}),[()=>(t.class_names||[]).join(" ")],void 0,void 0,"svelte-1jk6tax"),l(a),r("load",a,function(e){d.call(this,t,e)}),m(s,a),n()}export{g as I}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Image-Da_XA0w6.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Image-Da_XA0w6.css new file mode 100644 index 0000000000000000000000000000000000000000..6c2df2a2290ac2f70939dceba80056004c1e2a3d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Image-Da_XA0w6.css @@ -0,0 +1 @@ +img.svelte-1jk6tax{object-fit:cover} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Image-DrPceByI.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Image-DrPceByI.js new file mode 100644 index 0000000000000000000000000000000000000000..e8e59e78797253a7afc9899e8b26fd97caf2ca16 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Image-DrPceByI.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as o,f as t}from"./index-DWyDLubb.js";var i=t('');function a(r){var e=i();o(r,e)}export{a as I}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ImagePreview-B2ps5aDR.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ImagePreview-B2ps5aDR.js new file mode 100644 index 0000000000000000000000000000000000000000..7770f03590335c7b2aae284a4986430c18bcc330 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ImagePreview-B2ps5aDR.js @@ -0,0 +1 @@ +import{p as i,e as te,i as p,d as re,b as ae}from"./i18n-Dnhn5Rxr.js";import{R as le,a4 as ne,S as L,w,a as B,T as oe,U as c,ad as P,G as s,z as g,X as k,W,V as D,Y as M,x as se,t as ue,Z as ie,a3 as ce}from"./index-DWyDLubb.js";import{b as T}from"./misc-vsnLZ-Y1.js";import{u as _e}from"./utils.svelte-CCyS_0CY.js";import{I as de}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as ge}from"./BlockLabel-CZd21Hkw.js";import{D as me}from"./DownloadLink-TGTaev7f.js";import{E as fe}from"./Empty-BIB2W5at.js";import{S as be}from"./ShareButton-wCSP7LoP.js";import{D as he}from"./Download-Di2PsS6O.js";import{I as O}from"./Image-DrPceByI.js";import{I as ve}from"./IconButtonWrapper-D0s9l4wW.js";import{F as pe}from"./FullscreenButton-sCrcy_OJ.js";import{I as we}from"./Image-CeW7PJs4.js";/* empty css */const ke=m=>{let t;if(m.currentTarget instanceof Element)t=m.currentTarget.querySelector("img");else return[NaN,NaN];const r=t.getBoundingClientRect(),_=t.naturalWidth/r.width,u=t.naturalHeight/r.height;if(_>u){const b=t.naturalHeight/_,n=(r.height-b)/2;var l=Math.round((m.clientX-r.left)*_),f=Math.round((m.clientY-r.top-n)*_)}else{const b=t.naturalWidth/u,n=(r.width-b)/2;var l=Math.round((m.clientX-r.left-n)*u),f=Math.round((m.clientY-r.top)*u)}return l<0||l>=t.naturalWidth||f<0||f>=t.naturalHeight?null:[l,f]};var ye=W(" ",1),Ie=W('
      '),xe=W(" ",1);function Se(m,t){le(t,!1);let r=i(t,"value",12),_=i(t,"label",12,void 0),u=i(t,"show_label",12),l=i(t,"buttons",28,()=>[]),f=i(t,"on_custom_button_click",12,null),b=i(t,"selectable",12,!1),n=i(t,"i18n",12),y=i(t,"display_icon_button_wrapper_top_corner",12,!1),v=i(t,"fullscreen",12,!1),I=i(t,"show_button_background",12,!0);const E=ne(),C=e=>{let d=ke(e);d&&E("select",{index:d,value:null})};let H=ce();var G={get value(){return r()},set value(e){r(e),c()},get label(){return _()},set label(e){_(e),c()},get show_label(){return u()},set show_label(e){u(e),c()},get buttons(){return l()},set buttons(e){l(e),c()},get on_custom_button_click(){return f()},set on_custom_button_click(e){f(e),c()},get selectable(){return b()},set selectable(e){b(e),c()},get i18n(){return n()},set i18n(e){n(e),c()},get display_icon_button_wrapper_top_corner(){return y()},set display_icon_button_wrapper_top_corner(e){y(e),c()},get fullscreen(){return v()},set fullscreen(e){v(e),c()},get show_button_background(){return I()},set show_button_background(e){I(e),c()}};te();var N=xe(),F=L(N);{let e=P(()=>(s(u()),s(_()),s(n()),g(()=>u()?_()||n()("image.image"):"")));ge(F,{get show_label(){return u()},get Icon(){return O},get label(){return w(e)}})}var U=k(F,2);{var V=e=>{fe(e,{unpadded_box:!0,size:"large",children:(d,x)=>{O(d)},$$slots:{default:!0}})},Z=e=>{var d=Ie(),x=D(d);ve(x,{get display_top_corner(){return y()},get show_background(){return I()},get buttons(){return l()},get on_custom_button_click(){return f()},children:(h,ze)=>{var X=ye(),Y=L(X);{var J=o=>{pe(o,{get fullscreen(){return v()},onclick:a=>{v(a),E("fullscreen",a)}})};p(Y,o=>{s(l()),g(()=>l().some(a=>typeof a=="string"&&a==="fullscreen"))&&o(J)})}var j=k(Y,2);{var K=o=>{{let a=P(()=>(s(r()),g(()=>r().orig_name||"image")));me(o,{get href(){return s(r()),g(()=>r().url)},get download(){return w(a)},children:(q,Be)=>{{let ee=P(()=>(s(n()),g(()=>n()("common.download"))));de(q,{get Icon(){return he},get label(){return w(ee)}})}},$$slots:{default:!0}})}};p(j,o=>{s(l()),g(()=>l().some(a=>typeof a=="string"&&a==="download"))&&o(K)})}var Q=k(j,2);{var $=o=>{be(o,{get i18n(){return n()},formatter:async a=>a?``:"",get value(){return r()},$$events:{share(a){T.call(this,t,a)},error(a){T.call(this,t,a)}}})};p(Q,o=>{s(l()),g(()=>l().some(a=>typeof a=="string"&&a==="share"))&&o($)})}B(h,X)},$$slots:{default:!0}});var S=k(x,2),z=D(S);let R;var A=D(z);we(A,{get src(){return s(r()),g(()=>r().url)},restProps:{loading:"lazy",alt:""},$$events:{load(h){T.call(this,t,h)}}}),M(z),M(S),M(d),re(d,h=>se(H,h),()=>w(H)),ue(()=>R=ae(z,1,"image-frame svelte-12vrxzd",null,R,{selectable:b()})),ie("click",S,C),B(e,d)};p(U,e=>{s(r()),g(()=>r()==null||!r()?.url)?e(V):e(Z,!1)})}return B(m,N),oe(G)}const Oe=Object.freeze(Object.defineProperty({__proto__:null,default:Se},Symbol.toStringTag,{value:"Module"}));export{Se as I,Oe as a,ke as g}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ImagePreview-CCVfwC4m.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ImagePreview-CCVfwC4m.css new file mode 100644 index 0000000000000000000000000000000000000000..f12aee45d45baaf9ff37acb116ad59331dd335ed --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ImagePreview-CCVfwC4m.css @@ -0,0 +1 @@ +.image-container.svelte-12vrxzd{height:100%;position:relative;min-width:var(--size-20)}.image-container.svelte-12vrxzd button:where(.svelte-12vrxzd){width:var(--size-full);height:var(--size-full);border-radius:var(--radius-lg);display:flex;align-items:center;justify-content:center}.image-frame.svelte-12vrxzd img{width:var(--size-full);height:var(--size-full);object-fit:scale-down}.selectable.svelte-12vrxzd{cursor:crosshair}.fullscreen-controls svg{position:relative;top:0}.image-container:fullscreen{background-color:#000;display:flex;justify-content:center;align-items:center}.image-container:fullscreen img{max-width:90vw;max-height:90vh;object-fit:scale-down}.image-frame.svelte-12vrxzd{width:auto;height:100%;display:flex;align-items:center;justify-content:center} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ImageUploader-Dpdel1G9.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ImageUploader-Dpdel1G9.css new file mode 100644 index 0000000000000000000000000000000000000000..5d7d86b30e80768748a391c2e93805ba746be7b2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ImageUploader-Dpdel1G9.css @@ -0,0 +1 @@ +button.svelte-1dqolfz{cursor:pointer;width:var(--size-full)}.wrap.svelte-1dqolfz{display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:var(--size-60);color:var(--block-label-text-color);height:100%;padding-top:var(--size-3)}.icon-wrap.svelte-1dqolfz{width:30px;margin-bottom:var(--spacing-lg)}@media(min-width:768px){.wrap.svelte-1dqolfz{font-size:var(--text-lg)}}.wrap.svelte-1tktvmr{position:relative;width:var(--size-full);height:var(--size-full)}.hide.svelte-1tktvmr{display:none}video.svelte-1tktvmr{width:var(--size-full);height:var(--size-full);object-fit:contain}.button-wrap.svelte-1tktvmr{position:absolute;background-color:var(--block-background-fill);border:1px solid var(--border-color-primary);padding:var(--size-1-5);display:flex;bottom:var(--size-2);left:50%;transform:translate(-50%);box-shadow:var(--shadow-drop-lg);border-radius:var(--radius-xl);line-height:var(--size-3);color:var(--button-secondary-text-color)}.icon-with-text.svelte-1tktvmr{width:var(--size-20);align-items:center;margin:0 var(--spacing-xl);display:flex;justify-content:space-evenly}@media(min-width:768px){button.svelte-1tktvmr{bottom:var(--size-4)}}@media(min-width:1280px){button.svelte-1tktvmr{bottom:var(--size-8)}}.icon.svelte-1tktvmr{width:18px;height:18px;display:flex;justify-content:space-between;align-items:center}.color-primary.svelte-1tktvmr{fill:var(--primary-600);stroke:var(--primary-600);color:var(--primary-600)}.flip.svelte-1tktvmr{transform:scaleX(-1)}.select-wrap.svelte-1tktvmr{-webkit-appearance:none;-moz-appearance:none;appearance:none;color:var(--button-secondary-text-color);background-color:transparent;width:95%;font-size:var(--text-md);position:absolute;bottom:var(--size-2);background-color:var(--block-background-fill);box-shadow:var(--shadow-drop-lg);border-radius:var(--radius-xl);z-index:var(--layer-top);border:1px solid var(--border-color-primary);text-align:left;line-height:var(--size-4);white-space:nowrap;text-overflow:ellipsis;left:50%;transform:translate(-50%);max-width:var(--size-52)}.select-wrap.svelte-1tktvmr>option:where(.svelte-1tktvmr){padding:.25rem .5rem;border-bottom:1px solid var(--border-color-accent);padding-right:var(--size-8);text-overflow:ellipsis;overflow:hidden}.select-wrap.svelte-1tktvmr>option:where(.svelte-1tktvmr):hover{background-color:var(--color-accent)}.select-wrap.svelte-1tktvmr>option:where(.svelte-1tktvmr):last-child{border:none}@media(min-width:768px){.wrap.svelte-1tktvmr{font-size:var(--text-lg)}}.image-frame.svelte-6uxbr3 img{width:var(--size-full);height:var(--size-full);object-fit:scale-down}.upload-container.svelte-6uxbr3{display:flex;align-items:center;justify-content:center;height:100%;flex-shrink:1;max-height:100%}.reduced-height.svelte-6uxbr3{height:calc(100% - var(--size-10))}.image-container.svelte-6uxbr3{display:flex;height:100%;flex-direction:column;justify-content:center;align-items:center;max-height:100%}.selectable.svelte-6uxbr3{cursor:crosshair}.image-frame.svelte-6uxbr3{object-fit:cover;width:100%;height:100%} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index--e-Yppt2.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index--e-Yppt2.css new file mode 100644 index 0000000000000000000000000000000000000000..e357eaee2930a86665d13c2f156aaf3006d72ca3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index--e-Yppt2.css @@ -0,0 +1 @@ +.container.svelte-g2cwl3{padding:var(--block-padding)}.output-class.svelte-g2cwl3{display:flex;justify-content:center;align-items:center;padding:var(--size-6) var(--size-4);color:var(--body-text-color);font-weight:var(--weight-bold);font-size:var(--text-xxl)}.confidence-set.svelte-g2cwl3{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:var(--size-2);color:var(--body-text-color);line-height:var(--line-none);font-family:var(--font-mono);width:100%}.confidence-set.svelte-g2cwl3:last-child{margin-bottom:0}.inner-wrap.svelte-g2cwl3{flex:1 1 0%;display:flex;flex-direction:column}.bar.svelte-g2cwl3{appearance:none;-webkit-appearance:none;-moz-appearance:none;align-self:flex-start;margin-bottom:var(--size-1);border-radius:var(--radius-md);background:var(--stat-background-fill);height:var(--size-1);border:none}.bar.svelte-g2cwl3::-moz-meter-bar{border-radius:var(--radius-md);background:var(--stat-background-fill)}.bar.svelte-g2cwl3::-webkit-meter-bar{border-radius:var(--radius-md);background:var(--stat-background-fill);border:none}.bar.svelte-g2cwl3::-webkit-meter-optimum-value,.bar.svelte-g2cwl3::-webkit-meter-suboptimum-value,.bar.svelte-g2cwl3::-webkit-meter-even-less-good-value{border-radius:var(--radius-md);background:var(--stat-background-fill)}.bar.svelte-g2cwl3::-ms-fill{border-radius:var(--radius-md);background:var(--stat-background-fill);border:none}.label.svelte-g2cwl3{display:flex;align-items:baseline}.label.svelte-g2cwl3>:where(.svelte-g2cwl3)+:where(.svelte-g2cwl3){margin-left:var(--size-2)}.confidence-set.svelte-g2cwl3:hover .label:where(.svelte-g2cwl3){color:var(--color-accent)}.confidence-set.svelte-g2cwl3:focus .label:where(.svelte-g2cwl3){color:var(--color-accent)}.text.svelte-g2cwl3{line-height:var(--line-md);text-align:left}.line.svelte-g2cwl3{flex:1 1 0%;border:1px dashed var(--border-color-primary);padding-right:var(--size-4);padding-left:var(--size-4)}.confidence.svelte-g2cwl3{margin-left:auto;text-align:right} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-3FqI08xq.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-3FqI08xq.css new file mode 100644 index 0000000000000000000000000000000000000000..48b8ee41777fe9d4cfa29825e67b979392906c12 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-3FqI08xq.css @@ -0,0 +1 @@ +.button-icon.svelte-4ac0fl{width:var(--text-xl);height:var(--text-xl);margin-right:var(--spacing-xl)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-4nvCzCrB.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-4nvCzCrB.js new file mode 100644 index 0000000000000000000000000000000000000000..6de3caf032b1a38c94a0c69425de849d6f2a3f85 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-4nvCzCrB.js @@ -0,0 +1 @@ +import{r as e}from"./i18n-Dnhn5Rxr.js";import{R as t,y as a,T as p}from"./index-DWyDLubb.js";import{G as i}from"./utils.svelte-CCyS_0CY.js";import"./clone-BkeCM4Nl.js";function $(n,o){t(o,!0);let s=e(o,["$$slots","$$events","$$legacy"]);const r=new i(s);a(()=>{r.props.value&&r.dispatch("change")}),p()}export{$ as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-5RnUXY9l.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-5RnUXY9l.css new file mode 100644 index 0000000000000000000000000000000000000000..2fd693cffb4ed26a1ca847758997d73402824c1f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-5RnUXY9l.css @@ -0,0 +1 @@ +.html-container.svelte-1jts93g{padding:var(--block-padding)}.label-padding.svelte-1jts93g{padding-top:var(--spacing-xxl)}div.svelte-1jts93g{transition:.15s}.pending.svelte-1jts93g{opacity:.2} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-7ZuVU2_6.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-7ZuVU2_6.js new file mode 100644 index 0000000000000000000000000000000000000000..95b31b1472868ecaac33999063e57aa257dbd2d0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-7ZuVU2_6.js @@ -0,0 +1 @@ +import{p as l,d as J,i as j,a as m,r as K}from"./i18n-Dnhn5Rxr.js";import{R as I,S as k,a as g,t as z,T as P,X as G,W as x,au as L,M as N,aj as O,a6 as Q,w as U,a5 as W,v as V,y as Y,a7 as Z,a0 as $,a8 as ee}from"./index-DWyDLubb.js";import{G as te}from"./utils.svelte-CCyS_0CY.js";import{s as ae}from"./snippet-BWgYNF9D.js";import{B as ie}from"./Button-D-_s2ksk.js";import"./clone-BkeCM4Nl.js";import"./Image-CeW7PJs4.js";import"./misc-vsnLZ-Y1.js";/* empty css */import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";/* empty css */var re=x(''),le=x(" ",1),ne=x(' ',1);function se(p,e){I(e,!0);let b=l(e,"elem_id",3,""),t=l(e,"elem_classes",19,()=>[]),d=l(e,"visible",3,!0),c=l(e,"file_types",19,()=>[]),y=l(e,"size",3,"lg"),a=l(e,"icon",3,null),v=l(e,"scale",3,null),h=l(e,"min_width",3,void 0),A=l(e,"variant",3,"secondary"),M=l(e,"disabled",3,!1),R=l(e,"max_file_size",3,null),w,S=W(()=>c()==null?null:c().map(i=>i.startsWith(".")?i:i+"/*").join(", "));function T(){e.onclick?.(),w.click()}async function X(r){let i=Array.from(r);if(!r.length)return;e.file_count==="single"&&(i=[r[0]]);let s=await L(i);await N();try{s=(await e.upload(s,e.root,void 0,R()??1/0))?.filter(f=>f!==null)}catch(f){e.onerror?.(f.message);return}const _=e.file_count==="single"?s?.[0]:s;e.onchange?.(_),e.onupload?.(_)}async function q(r){const i=r.target;i.files&&await X(i.files)}function C(r){const i=r.target;i.value&&(i.value="")}var B=ne(),n=k(B);n.__change=q,n.__click=C,J(n,r=>w=r,()=>w);var D=G(n,2);ie(D,{get size(){return y()},get variant(){return A()},get elem_id(){return b()},get elem_classes(){return t()},get visible(){return d()},onclick:T,get scale(){return v()},get min_width(){return h()},get disabled(){return M()},children:(r,i)=>{var s=le(),_=k(s);{var f=o=>{var u=re();z(()=>{m(u,"src",a().url),m(u,"alt",`${e.value} icon`)}),g(o,u)};j(_,o=>{a()&&o(f)})}var E=G(_,2);{var F=o=>{var u=Q(),H=k(u);ae(H,()=>e.children),g(o,u)};j(E,o=>{e.children&&o(F)})}g(r,s)},$$slots:{default:!0}}),z(()=>{m(n,"accept",U(S)),n.multiple=e.file_count==="multiple"||void 0,n.webkitdirectory=e.file_count==="directory"||void 0,m(n,"mozdirectory",e.file_count==="directory"||void 0),m(n,"data-testid",`${e.label??""}-upload-button`)}),g(p,B),P()}O(["change","click"]);function be(p,e){I(e,!0);const b=K(e,["$$slots","$$events","$$legacy"]),t=new te(b);let d=V(t.props.value);Y(()=>{d!==t.props.value&&(t.props.value=d)});async function c(a,v){t.props.value=a,t.dispatch(v)}const y=W(()=>!t.shared.interactive);se(p,{get elem_id(){return t.shared.elem_id},get elem_classes(){return t.shared.elem_classes},get visible(){return t.shared.visible},get file_count(){return t.props.file_count},get file_types(){return t.props.file_types},get size(){return t.props.size},get scale(){return t.shared.scale},get icon(){return t.props.icon},get min_width(){return t.shared.min_width},get root(){return t.shared.root},get value(){return d},get disabled(){return U(y)},get variant(){return t.props.variant},get label(){return t.shared.label},get max_file_size(){return t.shared.max_file_size},onclick:()=>t.dispatch("click"),onchange:a=>c(a,"change"),onupload:a=>c(a,"upload"),onerror:a=>{t.dispatch("error",a)},upload:(...a)=>t.shared.client.upload(...a),children:(a,v)=>{ee();var h=Z();z(()=>$(h,t.shared.label??"")),g(a,h)},$$slots:{default:!0}}),P()}export{se as BaseUploadButton,be as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-B4MNmBST.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-B4MNmBST.js new file mode 100644 index 0000000000000000000000000000000000000000..38c1e71f080d16671c948458549baa119161f50d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-B4MNmBST.js @@ -0,0 +1,2 @@ +import{p as M,i as p,b as F,f as R,k as N,a as _,F as O,u as Q,g as U,r as Z}from"./i18n-Dnhn5Rxr.js";import{R as X,a as h,T as Y,X as b,W as S,V as i,aj as $,Y as d,t as T,a0 as P,a6 as ee,S as q,w as t,a5 as I}from"./index-DWyDLubb.js";import{G as ae}from"./utils.svelte-CCyS_0CY.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{L as V}from"./LineChart-pr5WctpY.js";import{B as te}from"./Block-J4oodUWp.js";import{B as le}from"./BlockLabel-CZd21Hkw.js";import{E as re}from"./Empty-BIB2W5at.js";import{I as se}from"./IconButtonWrapper-D0s9l4wW.js";import{S as oe}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./clone-BkeCM4Nl.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var ne=S('

      '),ie=S(''),de=S('
      ');function ce(j,l){X(l,!0);let E=M(l,"color",3,void 0),e=M(l,"selectable",3,!1),f=M(l,"show_heading",3,!0);function w(o){return o.replace(/\s/g,"-")}var x=de(),g=i(x);{var k=o=>{var n=ne();let c,u;var r=i(n,!0);d(n),T(()=>{c=F(n,1,"output-class svelte-g2cwl3",null,c,{"no-confidence":!("confidences"in l.value)}),u=R(n,"",u,{"background-color":E()||"transparent"}),P(r,l.value.label)}),h(o,n)};p(g,o=>{(f()||!l.value.confidences)&&o(k)})}var y=b(g,2);{var G=o=>{var n=ee(),c=q(n);N(c,17,()=>l.value.confidences,Q,(u,r,a)=>{var s=ie();let m;s.__click=()=>{l.onselect?.({index:a,value:t(r).label})};var B=i(s),v=i(B),W=b(v,2),L=i(W),z=i(L,!0);d(L);var C=b(L,4),A=i(C);d(C),d(W),d(B),d(s),T((D,H,J,K)=>{m=F(s,1,"confidence-set group svelte-g2cwl3",null,m,{selectable:e()}),_(s,"data-testid",`${t(r).label}-confidence-set`),_(v,"aria-labelledby",D),_(v,"aria-label",t(r).label),_(v,"aria-valuenow",H),O(v,t(r).confidence),R(v,`width: ${t(r).confidence*100}%; background: var(--stat-background-fill); + `),_(L,"id",J),P(z,t(r).label),P(A,`${K??""}%`)},[()=>w(`meter-text-${t(r).label}`),()=>Math.round(t(r).confidence*100),()=>w(`meter-text-${t(r).label}`),()=>Math.round(t(r).confidence*100)]),h(u,s)}),h(o,n)};p(y,o=>{typeof l.value=="object"&&l.value.confidences&&o(G)})}d(x),h(j,x),Y()}$(["click"]);var ue=S(" ",1);function je(j,l){X(l,!0);const E=Z(l,["$$slots","$$events","$$legacy"]),e=new ae(E);let f=I(()=>e.props.value.label);e.watch_for_change(),te(j,{test_id:"label",get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},padding:!1,children:(w,x)=>{var g=ue(),k=q(g);oe(k,U({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var y=b(k,2);{var G=a=>{se(a,{get buttons(){return e.props.buttons},on_custom_button_click:s=>{e.dispatch("custom_button_click",{id:s})}})};p(y,a=>{e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0&&a(G)})}var o=b(y,2);{var n=a=>{{let s=I(()=>e.shared.label||e.i18n("label.label")),m=I(()=>e.shared.container===!1),B=I(()=>e.props.show_heading===!0);le(a,{get Icon(){return V},get label(){return t(s)},get disable(){return t(m)},get float(){return t(B)}})}};p(o,a=>{e.shared.show_label&&a(n)})}var c=b(o,2);{var u=a=>{ce(a,{onselect:s=>e.dispatch("select",s),get selectable(){return e.props._selectable},get value(){return e.props.value},get color(){return e.props.color},get show_heading(){return e.props.show_heading}})},r=a=>{re(a,{unpadded_box:!0,children:(s,m)=>{V(s)},$$slots:{default:!0}})};p(c,a=>{t(f)!==void 0&&t(f)!==null?a(u):a(r,!1)})}h(w,g)},$$slots:{default:!0}}),Y()}export{ce as BaseLabel,je as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-B80bIer5.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-B80bIer5.css new file mode 100644 index 0000000000000000000000000000000000000000..4270081b14f8104ca4d978de8d57c93e20e0a36d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-B80bIer5.css @@ -0,0 +1 @@ +.extra-feedback.svelte-fvat56{display:flex;align-items:center;position:relative}.extra-feedback-options.svelte-fvat56{display:none;position:absolute;padding:var(--spacing-md) 0;flex-direction:column;gap:var(--spacing-sm);top:100%}.extra-feedback.svelte-fvat56:hover .extra-feedback-options:where(.svelte-fvat56){display:flex}.extra-feedback-option.svelte-fvat56{border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);color:var(--block-label-text-color);background-color:var(--block-background-fill);font-size:var(--text-xs);padding:var(--spacing-xxs) var(--spacing-sm);width:max-content}.bubble.svelte-704d7y .icon-button-wrapper{margin:0px calc(var(--spacing-xl) * 2)}.message-buttons.svelte-704d7y{z-index:var(--layer-1)}.message-buttons-left.svelte-704d7y{align-self:flex-start}.bubble.message-buttons-right.svelte-704d7y{align-self:flex-end}.message-buttons-right.svelte-704d7y .icon-button-wrapper{margin-left:auto}.bubble.with-avatar.svelte-704d7y{margin-left:calc(var(--spacing-xl) * 5);margin-right:calc(var(--spacing-xl) * 5)}.panel.svelte-704d7y{display:flex;align-self:flex-start;z-index:var(--layer-1)}.file-container.svelte-e5gd5s{display:flex;align-items:center;gap:var(--spacing-lg);padding:var(--spacing-lg);border-radius:var(--radius-lg);width:fit-content;margin:var(--spacing-sm) 0}.file-icon.svelte-e5gd5s{display:flex;align-items:center;justify-content:center;color:var(--body-text-color)}.file-icon.svelte-e5gd5s svg{width:var(--size-7);height:var(--size-7)}.file-info.svelte-e5gd5s{display:flex;flex-direction:column}.file-link.svelte-e5gd5s{text-decoration:none;color:var(--body-text-color);display:flex;flex-direction:column;gap:var(--spacing-xs)}.file-name.svelte-e5gd5s{font-family:var(--font);font-size:var(--text-md);font-weight:500}.file-type.svelte-e5gd5s{font-family:var(--font);font-size:var(--text-sm);color:var(--body-text-color-subdued);text-transform:uppercase}.thought-group.svelte-18cn3o3{background:var(--background-fill-primary);border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);padding:var(--spacing-md);margin:var(--spacing-md) 0;font-size:var(--text-sm)}.children.svelte-18cn3o3 .thought-group{border:none;margin:0;padding-bottom:0}.children.svelte-18cn3o3{padding-left:var(--spacing-md)}.title.svelte-18cn3o3{display:flex;align-items:center;color:var(--body-text-color);cursor:pointer;width:100%}.title.svelte-18cn3o3 .md{font-size:var(--text-sm)!important}.content.svelte-18cn3o3,.content-preview.svelte-18cn3o3{overflow-wrap:break-word;word-break:break-word;margin-left:var(--spacing-lg);margin-bottom:var(--spacing-sm)}.content-preview.svelte-18cn3o3{position:relative;max-height:7.5em;overflow-y:auto;overscroll-behavior:contain;cursor:default}.content.svelte-18cn3o3 *,.content-preview.svelte-18cn3o3 *{font-size:var(--text-sm);color:var(--body-text-color)}.thought-group.svelte-18cn3o3 .thought:not(.nested){border:none;background:none}.duration.svelte-18cn3o3{color:var(--body-text-color-subdued);font-size:var(--text-sm);margin-left:var(--size-1)}.arrow.svelte-18cn3o3{opacity:.8;width:var(--size-8);height:var(--size-8);display:flex;align-items:center;justify-content:center}.arrow.svelte-18cn3o3 button{background-color:transparent}.loading-spinner.svelte-18cn3o3{display:inline-block;width:12px;height:12px;border:2px solid var(--body-text-color);border-radius:50%;border-top-color:transparent;animation:svelte-18cn3o3-spin 1s linear infinite;margin:0 var(--size-1) -1px var(--size-2);opacity:.8}@keyframes svelte-18cn3o3-spin{to{transform:rotate(360deg)}}.thought-group.svelte-18cn3o3 .message-content{opacity:.8}.message.svelte-1nr59td{position:relative;width:100%}.message.display_consecutive_in_same_bubble.svelte-1nr59td{margin-top:0}.message.svelte-1nr59td+.message:where(.svelte-1nr59td){margin-top:var(--spacing-sm)}.avatar-container.svelte-1nr59td{flex-shrink:0;border-radius:50%;border:1px solid var(--border-color-primary);overflow:hidden}.avatar-container.svelte-1nr59td img{object-fit:cover}.flex-wrap.svelte-1nr59td{display:flex;flex-direction:column;width:calc(100% - var(--spacing-xxl));max-width:100%;color:var(--body-text-color);font-size:var(--chatbot-text-size);overflow-wrap:break-word;width:100%;height:100%}.component.svelte-1nr59td{padding:0;border-radius:var(--radius-md);width:fit-content;overflow:hidden}.component.gallery.svelte-1nr59td{border:none}.bot.svelte-1nr59td:has(.model3D:where(.svelte-1nr59td)),.user.svelte-1nr59td:has(.model3D:where(.svelte-1nr59td)){border:none;max-width:75%}.message-row.svelte-1nr59td :where(.svelte-1nr59td):not(.avatar-container) img{margin:var(--size-2);max-height:300px}.file-pil.svelte-1nr59td{display:block;width:fit-content;padding:var(--spacing-sm) var(--spacing-lg);border-radius:var(--radius-md);background:var(--background-fill-secondary);color:var(--body-text-color);text-decoration:none;margin:0;font-family:var(--font-mono);font-size:var(--text-sm)}.file.svelte-1nr59td{width:auto!important;max-width:fit-content!important}@media(max-width:600px)or (max-width:480px){.component.svelte-1nr59td{width:100%}}.message.svelte-1nr59td .prose{font-size:var(--chatbot-text-size)}.message-bubble-border.svelte-1nr59td{border-width:1px;border-radius:var(--radius-md)}.panel-full-width.svelte-1nr59td{width:100%}.message-markdown-disabled.svelte-1nr59td{white-space:pre-line}.user.svelte-1nr59td{border-radius:var(--radius-md);align-self:flex-end;border-bottom-right-radius:0;box-shadow:var(--shadow-drop);border:1px solid var(--border-color-accent-subdued);background-color:var(--color-accent-soft);padding:var(--spacing-sm) var(--spacing-xl)}.bot.svelte-1nr59td{border:1px solid var(--border-color-primary);border-radius:var(--radius-md);border-color:var(--border-color-primary);background-color:var(--background-fill-secondary);box-shadow:var(--shadow-drop);align-self:flex-start;text-align:left;border-bottom-left-radius:0;padding:var(--spacing-sm) var(--spacing-xl)}.bot.svelte-1nr59td:has(.table-wrap:where(.svelte-1nr59td)){border:none;box-shadow:none;background:none}.message-row.svelte-1nr59td{display:flex;position:relative}.bubble.svelte-1nr59td{margin:calc(var(--spacing-xl) * 2);margin-bottom:var(--spacing-xl)}.bubble.user-row.svelte-1nr59td{align-self:flex-end;max-width:calc(100% - var(--spacing-xl) * 6)}.bubble.bot-row.svelte-1nr59td{align-self:flex-start;max-width:calc(100% - var(--spacing-xl) * 6)}.bubble.svelte-1nr59td .user-row:where(.svelte-1nr59td){flex-direction:row;justify-content:flex-end}.bubble.svelte-1nr59td .with_avatar.user-row:where(.svelte-1nr59td){margin-right:calc(var(--spacing-xl) * 2)!important}.bubble.svelte-1nr59td .with_avatar.bot-row:where(.svelte-1nr59td){margin-left:calc(var(--spacing-xl) * 2)!important}.bubble.svelte-1nr59td .with_opposite_avatar.user-row:where(.svelte-1nr59td){margin-left:calc(var(--spacing-xxl) + 35px + var(--spacing-xxl))}.panel.svelte-1nr59td{margin:0;padding:calc(var(--spacing-lg) * 2) calc(var(--spacing-lg) * 2)}.panel.bot-row.svelte-1nr59td{background:var(--background-fill-secondary)}.panel.svelte-1nr59td .with_avatar:where(.svelte-1nr59td){padding-left:calc(var(--spacing-xl) * 2)!important;padding-right:calc(var(--spacing-xl) * 2)!important}.panel.svelte-1nr59td .panel-full-width:where(.svelte-1nr59td){width:100%}.panel.svelte-1nr59td .user:where(.svelte-1nr59td) *{text-align:right}.flex-wrap.svelte-1nr59td{display:flex;flex-direction:column;max-width:100%;color:var(--body-text-color);font-size:var(--chatbot-text-size);overflow-wrap:break-word}@media(max-width:480px){.user-row.bubble.svelte-1nr59td{align-self:flex-end}.bot-row.bubble.svelte-1nr59td{align-self:flex-start}.message.svelte-1nr59td{width:100%}}.avatar-container.svelte-1nr59td{align-self:flex-start;position:relative;display:flex;justify-content:flex-start;align-items:flex-start;width:35px;height:35px;flex-shrink:0;bottom:0;border-radius:50%;border:1px solid var(--border-color-primary)}.user-row.svelte-1nr59td>.avatar-container:where(.svelte-1nr59td){order:2}.user-row.bubble.svelte-1nr59td>.avatar-container:where(.svelte-1nr59td){margin-left:var(--spacing-xxl)}.bot-row.bubble.svelte-1nr59td>.avatar-container:where(.svelte-1nr59td){margin-right:var(--spacing-xxl);margin-left:0}.panel.user-row.svelte-1nr59td>.avatar-container:where(.svelte-1nr59td){order:0}.avatar-container.svelte-1nr59td:not(.thumbnail-item) img{width:100%;height:100%;object-fit:cover;border-radius:50%;padding:var(--size-1-5)}.selectable.svelte-1nr59td{cursor:pointer}@keyframes svelte-1nr59td-dot-flashing{0%{opacity:.8}50%{opacity:.5}to{opacity:.8}}.message.svelte-1nr59td .preview{object-fit:contain;width:95%;max-height:93%}.image-preview.svelte-1nr59td{position:absolute;z-index:999;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:#000000e6;display:flex;justify-content:center;align-items:center}.image-preview.svelte-1nr59td svg{stroke:#fff}.image-preview-close-button.svelte-1nr59td{position:absolute;top:10px;right:10px;background:none;border:none;font-size:1.5em;cursor:pointer;height:30px;width:30px;padding:3px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color);border-radius:var(--radius-lg)}.message.svelte-1nr59td>div:where(.svelte-1nr59td){width:100%}.html.svelte-1nr59td{padding:0;border:none;background:none}.panel.svelte-1nr59td .bot:where(.svelte-1nr59td),.panel.svelte-1nr59td .user:where(.svelte-1nr59td){border:none;box-shadow:none;background-color:var(--background-fill-secondary)}textarea.svelte-1nr59td{background:none;border-radius:var(--radius-lg);border:none;display:block;max-width:100%}.user.svelte-1nr59td textarea:where(.svelte-1nr59td){border-bottom-right-radius:0}.bot.svelte-1nr59td textarea:where(.svelte-1nr59td){border-bottom-left-radius:0}.user.svelte-1nr59td textarea:where(.svelte-1nr59td):focus{outline:2px solid var(--border-color-accent)}.bot.svelte-1nr59td textarea:where(.svelte-1nr59td):focus{outline:2px solid var(--border-color-primary)}.panel.user-row.svelte-1nr59td{background-color:var(--color-accent-soft)}.panel.svelte-1nr59td .user-row:where(.svelte-1nr59td),.panel.svelte-1nr59td .bot-row:where(.svelte-1nr59td){align-self:flex-start}.panel.svelte-1nr59td .user:where(.svelte-1nr59td) *,.panel.svelte-1nr59td .bot:where(.svelte-1nr59td) *{text-align:inherit}.panel.svelte-1nr59td .user:where(.svelte-1nr59td){background-color:var(--color-accent-soft)}.panel.svelte-1nr59td .user-row:where(.svelte-1nr59td){background-color:var(--color-accent-soft);align-self:start}.panel.svelte-1nr59td .message:where(.svelte-1nr59td){margin-bottom:var(--spacing-md)}.container.svelte-stpvyx{display:flex;margin:calc(var(--spacing-xl) * 2)}.bubble.pending.svelte-stpvyx{border-width:1px;border-radius:var(--radius-lg);border-bottom-left-radius:0;border-color:var(--border-color-primary);background-color:var(--background-fill-secondary);box-shadow:var(--shadow-drop);align-self:flex-start;width:fit-content;margin-bottom:var(--spacing-xl)}.bubble.with_opposite_avatar.svelte-stpvyx{margin-right:calc(var(--spacing-xxl) + 35px + var(--spacing-xxl))}.panel.pending.svelte-stpvyx{margin:0;padding:calc(var(--spacing-lg) * 2) calc(var(--spacing-lg) * 2);width:100%;border:none;background:none;box-shadow:none;border-radius:0}.panel.with_avatar.svelte-stpvyx{padding-left:calc(var(--spacing-xl) * 2)!important;padding-right:calc(var(--spacing-xl) * 2)!important}.avatar-container.svelte-stpvyx{align-self:flex-start;position:relative;display:flex;justify-content:flex-start;align-items:flex-start;width:35px;height:35px;flex-shrink:0;bottom:0;border-radius:50%;border:1px solid var(--border-color-primary);margin-right:var(--spacing-xxl)}.avatar-container.svelte-stpvyx:not(.thumbnail-item) img{width:100%;height:100%;object-fit:cover;border-radius:50%;padding:var(--size-1-5)}.message-content.svelte-stpvyx{padding:var(--spacing-sm) var(--spacing-xl);min-height:var(--size-8);display:flex;align-items:center}.dots.svelte-stpvyx{display:flex;gap:var(--spacing-xs);align-items:center}.dot.svelte-stpvyx{width:var(--size-1-5);height:var(--size-1-5);margin-right:var(--spacing-xs);border-radius:50%;background-color:var(--body-text-color);opacity:.5;animation:svelte-stpvyx-pulse 1.5s infinite}.dot.svelte-stpvyx:nth-child(2){animation-delay:.2s}.dot.svelte-stpvyx:nth-child(3){animation-delay:.4s}@keyframes svelte-stpvyx-pulse{0%,to{opacity:.4;transform:scale(1)}50%{opacity:1;transform:scale(1.1)}}.placeholder-content.svelte-1rn3hyj{display:flex;flex-direction:column;height:100%}.placeholder.svelte-1rn3hyj{align-items:center;display:flex;justify-content:center;height:100%;flex-grow:1}.examples.svelte-1rn3hyj img{pointer-events:none}.examples.svelte-1rn3hyj{margin:auto;padding:var(--spacing-xxl);display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:var(--spacing-xl);max-width:min(4 * 240px + 5 * var(--spacing-xxl),100%)}.example.svelte-1rn3hyj{display:flex;flex-direction:column;align-items:flex-start;padding:var(--spacing-xxl);border:none;border-radius:var(--radius-lg);background-color:var(--block-background-fill);cursor:pointer;transition:all .15s ease-in-out;width:100%;gap:var(--spacing-sm);border:var(--block-border-width) solid var(--block-border-color);transform:translateY(0)}.example.svelte-1rn3hyj:hover{transform:translateY(-2px);background-color:var(--color-accent-soft)}.example-content.svelte-1rn3hyj{display:flex;flex-direction:column;align-items:flex-start;width:100%;height:100%}.example-text-content.svelte-1rn3hyj{margin-top:var(--spacing-sm);text-align:start}.example-text.svelte-1rn3hyj{font-size:var(--text-md);text-align:start;overflow:hidden;text-overflow:ellipsis}.example-icons-grid.svelte-1rn3hyj{display:flex;gap:var(--spacing-sm);width:100%}.example-icon.svelte-1rn3hyj{flex-shrink:0;width:var(--size-8);height:var(--size-8);display:flex;align-items:center;justify-content:center;border-radius:var(--radius-lg);border:var(--block-border-width) solid var(--block-border-color);background-color:var(--block-background-fill);position:relative}.example-icon.svelte-1rn3hyj svg{width:var(--size-4);height:var(--size-4);color:var(--color-text-secondary)}.text-icon-aa.svelte-1rn3hyj{font-size:var(--text-sm);font-weight:var(--weight-semibold);color:var(--color-text-secondary);line-height:1}.example-image-container.svelte-1rn3hyj{width:var(--size-8);height:var(--size-8);border-radius:var(--radius-lg);overflow:hidden;position:relative}.example-image-container.svelte-1rn3hyj img{width:100%;height:100%;object-fit:cover}.image-overlay.svelte-1rn3hyj{position:absolute;inset:0;background:#0009;color:#fff;display:flex;align-items:center;justify-content:center;font-size:var(--text-lg);font-weight:var(--weight-semibold);border-radius:var(--radius-lg)}.file-overlay.svelte-1rn3hyj{position:absolute;inset:0;background:#0009;color:#fff;display:flex;align-items:center;justify-content:center;font-size:var(--text-sm);font-weight:var(--weight-semibold);border-radius:var(--radius-lg)}.panel-wrap.svelte-kpz1{width:100%;overflow-y:auto}.bubble-wrap.svelte-kpz1{width:100%;overflow-y:auto;height:100%;padding-top:var(--spacing-xxl)}@media(prefers-color-scheme:dark){.bubble-wrap.svelte-kpz1{background:var(--background-fill-secondary)}}.message-wrap.svelte-kpz1 .prose.chatbot.md{opacity:.8;overflow-wrap:break-word}.message-wrap.svelte-kpz1 .message-row .md img{border-radius:var(--radius-xl);margin:var(--size-2);width:400px;max-width:30vw;max-height:30vw}.message-wrap.svelte-kpz1 .message a{color:var(--color-text-link);text-decoration:underline}.message-wrap.svelte-kpz1 .bot:not(:has(.table-wrap)) table,.message-wrap.svelte-kpz1 .bot:not(:has(.table-wrap)) tr,.message-wrap.svelte-kpz1 .bot:not(:has(.table-wrap)) td,.message-wrap.svelte-kpz1 .bot:not(:has(.table-wrap)) th{border:1px solid var(--border-color-primary)}.message-wrap.svelte-kpz1 .user table,.message-wrap.svelte-kpz1 .user tr,.message-wrap.svelte-kpz1 .user td,.message-wrap.svelte-kpz1 .user th{border:1px solid var(--border-color-accent)}.message-wrap.svelte-kpz1 span.katex{font-size:var(--text-lg);direction:ltr}.message-wrap.svelte-kpz1 span.katex-display{margin-top:0}.message-wrap.svelte-kpz1 pre{position:relative}.message-wrap.svelte-kpz1 .grid-wrap{max-height:80%!important;max-width:600px;object-fit:contain}.message-wrap.svelte-kpz1>div:where(.svelte-kpz1) p:not(:first-child){margin-top:var(--spacing-xxl)}.message-wrap.svelte-kpz1{display:flex;flex-direction:column;justify-content:space-between;margin-bottom:var(--spacing-xxl);direction:ltr}.panel-wrap.svelte-kpz1 .message-row:first-child{padding-top:calc(var(--spacing-xxl) * 2)}.scroll-down-button-container.svelte-kpz1{position:absolute;bottom:10px;left:50%;transform:translate(-50%);z-index:var(--layer-top)}.scroll-down-button-container.svelte-kpz1 button{border-radius:50%;box-shadow:var(--shadow-drop);transition:box-shadow .2s ease-in-out,transform .2s ease-in-out}.scroll-down-button-container.svelte-kpz1 button:hover{box-shadow:var(--shadow-drop),0 2px 2px #0000000d;transform:translateY(-2px)}.options.svelte-kpz1{margin-left:auto;padding:var(--spacing-xxl);display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:var(--spacing-xxl);max-width:min(4 * 200px + 5 * var(--spacing-xxl),100%);justify-content:flex-end}.option.svelte-kpz1{display:flex;flex-direction:column;align-items:center;padding:var(--spacing-xl);border:1px dashed var(--border-color-primary);border-radius:var(--radius-md);background-color:var(--background-fill-secondary);cursor:pointer;transition:var(--button-transition);max-width:var(--size-56);width:100%;justify-content:center}.option.svelte-kpz1:hover{background-color:var(--color-accent-soft);border-color:var(--border-color-accent)}.wrapper.svelte-1wizwbi{display:flex;position:relative;flex-direction:column;align-items:start;width:100%;height:100%;flex-grow:1}.progress-text{right:auto} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BBNOoCmW.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BBNOoCmW.js new file mode 100644 index 0000000000000000000000000000000000000000..d9204012ac869975a31f8b72a0d458fb10dd3f2d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BBNOoCmW.js @@ -0,0 +1 @@ +import{p as m,t as de,b as M,k as ue,u as fe,i as H,a as R,g as pe,r as ve}from"./i18n-Dnhn5Rxr.js";import{a as j,f as _e,aj as ee,R as N,t as V,T as q,W as L,u as W,v as J,x as k,w as r,y as X,X as T,a0 as ge,a5 as x,V as O,a6 as he,S as te,Y as P}from"./index-DWyDLubb.js";import{k as me}from"./key-Xd_8JrI4.js";import{G as ke}from"./utils.svelte-CCyS_0CY.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{F as we}from"./File-BHHIF0P7.js";import{B as be}from"./Block-J4oodUWp.js";import{B as ye}from"./BlockLabel-CZd21Hkw.js";import{I as xe}from"./IconButtonWrapper-D0s9l4wW.js";import{a as je}from"./input-DrerMDOL.js";import{S as Be}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./clone-BkeCM4Nl.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var Ce=_e('');function Ge(B){var t=Ce();j(B,t)}var Se=L('');function Fe(B,t){N(t,!0);let i=m(t,"value",15);var e=Se();de(e),e.__input=()=>t.onchange?.(!i());let f;V(()=>{e.disabled=t.disabled,f=M(e,1,"svelte-3g0mcl",null,f,{disabled:t.disabled&&!i()})}),je(e,i),j(B,e),q()}ee(["input"]);const Ie="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='32'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23888888'%20d='M6%202c-1.1%200-1.99.9-1.99%202L4%2020c0%201.1.89%202%201.99%202H18c1.1%200%202-.9%202-2V8l-6-6H6zm7%207V3.5L18.5%209H13z'/%3e%3c/svg%3e",Ue="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20viewBox='0%200%2032%2032'%20version='1.1'%20id='svg7'%20sodipodi:docname='light-folder-new.svg'%20inkscape:version='1.3.2%20(091e20e,%202023-11-25)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3csodipodi:namedview%20id='namedview7'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20inkscape:zoom='7.375'%20inkscape:cx='15.932203'%20inkscape:cy='16'%20inkscape:window-width='1312'%20inkscape:window-height='529'%20inkscape:window-x='0'%20inkscape:window-y='38'%20inkscape:window-maximized='0'%20inkscape:current-layer='svg7'%20/%3e%3cdefs%20id='defs6'%3e%3cclipPath%20id='clipPath1'%3e%3cpath%20d='m69.63%2012.145h-.052c-22.727-.292-46.47%204.077-46.709%204.122-2.424.451-4.946%202.974-5.397%205.397-.044.237-4.414%2023.983-4.122%2046.71-.292%2022.777%204.078%2046.523%204.122%2046.761.451%202.423%202.974%204.945%205.398%205.398.237.044%2023.982%204.413%2046.709%204.121%2022.779.292%2046.524-4.077%2046.761-4.121%202.423-.452%204.946-2.976%205.398-5.399.044-.236%204.413-23.981%204.121-46.709.292-22.777-4.077-46.523-4.121-46.761-.453-2.423-2.976-4.946-5.398-5.397-.238-.045-23.984-4.414-46.71-4.122'%20id='path1'%20/%3e%3c/clipPath%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20y2='352.98'%20x2='-601.15'%20y1='663.95'%20x1='-591.02'%20id='2'%3e%3cstop%20stop-color='%23a0a0a0'%20id='stop1'%20/%3e%3cstop%20offset='1'%20stop-color='%23aaa'%20id='stop2'%20/%3e%3c/linearGradient%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20y2='354.29'%20x2='-704.05'%20y1='647.77'%20x1='-701.19'%20id='1'%3e%3cstop%20stop-color='%23acabab'%20id='stop3'%20/%3e%3cstop%20offset='1'%20stop-color='%23d4d4d4'%20id='stop4'%20/%3e%3c/linearGradient%3e%3clinearGradient%20id='0'%20x1='59.12'%20y1='-19.888'%20x2='59.15'%20y2='-37.783'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(4.17478%200%200%204.16765-1069.7%20447.73)'%3e%3cstop%20stop-color='%23a0a0a0'%20id='stop5'%20/%3e%3cstop%20offset='1'%20stop-color='%23bdbdbd'%20id='stop6'%20/%3e%3c/linearGradient%3e%3c/defs%3e%3cg%20transform='matrix(.07089%200%200%20.07017%2023.295-40.67)'%20fill='%2360aae5'%20id='g7'%20style='fill:%23888888;fill-opacity:1'%3e%3cpath%20transform='matrix(.7872%200%200%20.79524%20415.34%20430.11)'%20d='m-884.1%20294.78c-4.626%200-8.349%203.718-8.349%208.335v161.41l468.19%201v-121.2c0-4.618-3.724-8.335-8.35-8.335h-272.65c-8.51.751-9.607-.377-13.812-5.981-5.964-7.968-14.969-21.443-20.84-29.21-4.712-6.805-5.477-6.02-13.292-6.02z'%20fill='url(%230)'%20color='%23000'%20id='path6'%20style='fill:%23888888;fill-opacity:1'%20/%3e%3crect%20transform='matrix(.7872%200%200%20.79524%20415.34%20430.11)'%20y='356.85'%20x='-890.28'%20height='295.13'%20width='463.85'%20fill='url(%231)'%20stroke='url(%231)'%20stroke-width='2.378'%20rx='9.63'%20id='rect6'%20style='fill:%23888888;fill-opacity:1'%20/%3e%3crect%20width='463.85'%20height='295.13'%20x='-890.28'%20y='356.85'%20transform='matrix(.7872%200%200%20.79524%20415.34%20430.11)'%20fill='none'%20stroke='url(%232)'%20stroke-linejoin='round'%20stroke-linecap='round'%20stroke-width='5.376'%20rx='9.63'%20id='rect7'%20style='fill:%23888888;fill-opacity:1'%20/%3e%3c/g%3e%3c/svg%3e";var ze=L(''),Le=L(''),Pe=L('file icon'),Ee=L('
    • '),Oe=L("
        ");function re(B,t){N(t,!0);let i=m(t,"path",19,()=>[]),e=m(t,"index_path",19,()=>[]),f=m(t,"selected_files",19,()=>[]),n=m(t,"selected_folders",19,()=>[]),S=m(t,"is_selected_entirely",3,!1),p=m(t,"selectable",3,!1),F=m(t,"file_count",3,"multiple"),g=W(J([])),o=W(J([]));const u=a=>{r(o).includes(a)?k(o,r(o).filter(c=>c!==a),!0):k(o,[...r(o),a],!0)},s=a=>{r(o).includes(a)||k(o,[...r(o),a],!0)};(async()=>(k(g,await t.ls_fn(i()),!0),t.valid_for_selection&&k(g,[{name:".",type:"file"},...r(g)],!0),k(o,r(g).map((a,c)=>a.type==="folder"&&(S()||f().some(_=>_[0]===a.name))?c:null).filter(a=>a!==null),!0)))(),X(()=>{S()&&r(g).forEach(a=>{t.oncheck?.({path:[...i(),a.name],checked:!0,type:a.type})})});function C(a,c,_){t.onselect?.({index:a,value:c.join("/"),selected:!0})}var w=Oe();let v;ue(w,21,()=>r(g),fe,(a,c,_)=>{let G=()=>r(c).type,h=()=>r(c).name,ae=()=>r(c).valid;const Y=x(()=>(G()==="file"?f():n()).some(l=>l[0]===h()&&l.length===1));var A=Ee(),I=O(A);let Z;I.__click=l=>{l.stopPropagation(),p()&&C([...e(),_],[...i(),h()],G())},I.__keydown=l=>{p()&&(l.key===" "||l.key==="Enter")&&C([...e(),_],[...i(),h()],G())};var K=O(I);{var le=l=>{var d=he(),U=te(d);{var D=z=>{var E=ze();j(z,E)},b=z=>{Fe(z,{disabled:!1,get value(){return r(Y)},onchange:E=>{t.oncheck?.({path:[...i(),h()],checked:E,type:G()}),p()&&C([...e(),_],[...i(),h()],G()),G()==="folder"&&E&&s(_)}})};H(U,z=>{G()==="folder"&&F()==="single"?z(D):z(b,!1)})}j(l,d)};H(K,l=>{t.interactive&&l(le)})}var Q=T(K,2);{var se=l=>{var d=Le();let U;d.__click=b=>{b.stopPropagation(),u(_)},d.__keydown=b=>{(b.key===" "||b.key==="Enter")&&u(_)};var D=O(d);Ge(D),P(d),V(b=>U=M(d,1,"icon svelte-6im0c4",null,U,b),[()=>({hidden:!r(o).includes(_)})]),j(l,d)},ie=l=>{var d=Pe(),U=O(d);P(d),V(()=>R(U,"src",h()==="."?Ue:Ie)),j(l,d)};H(Q,l=>{G()==="folder"?l(se):l(ie,!1)})}var $=T(Q,2),ne=O($,!0);P($),P(I);var oe=T(I,2);{var ce=l=>{{let d=x(()=>[...i(),h()]),U=x(()=>[...e(),_]),D=x(()=>f().filter(y=>y[0]===h()).map(y=>y.slice(1))),b=x(()=>n().filter(y=>y[0]===h()).map(y=>y.slice(1))),z=x(()=>n().some(y=>y[0]===h()&&y.length===1)),E=x(()=>ae()??!1);re(l,{get path(){return r(d)},get index_path(){return r(U)},get selected_files(){return r(D)},get selected_folders(){return r(b)},get is_selected_entirely(){return r(z)},get interactive(){return t.interactive},get selectable(){return p()},get ls_fn(){return t.ls_fn},get file_count(){return F()},get valid_for_selection(){return r(E)},get oncheck(){return t.oncheck},get onselect(){return t.onselect}})}};H(oe,l=>{G()==="folder"&&r(o).includes(_)&&l(ce)})}P(A),V(()=>{Z=M(I,1,"wrap svelte-6im0c4",null,Z,{selected:!t.interactive&&r(Y),selectable:p()}),R(I,"role",p()?"button":void 0),R(I,"tabindex",p()?0:void 0),ge(ne,h())}),j(a,A)}),P(w),V(()=>v=M(w,1,"svelte-6im0c4",null,v,{"no-checkboxes":!t.interactive,root:i().length===0})),j(B,w),q()}ee(["click","keydown"]);var Te=L('
        ');function De(B,t){N(t,!0);let i=m(t,"file_count",3,"multiple"),e=m(t,"value",15),f=m(t,"selectable",3,!1),n=W(J([]));const S=(u,s)=>u.join("/")===s.join("/"),p=(u,s)=>s.some(C=>S(C,u)),F=(u,s)=>u.join("/").startsWith(s.join("/"));var g=Te(),o=O(g);re(o,{path:[],get selected_files(){return e()},get selected_folders(){return r(n)},get interactive(){return t.interactive},get selectable(){return f()},get ls_fn(){return t.ls_fn},get file_count(){return i()},valid_for_selection:!1,oncheck:u=>{const{path:s,checked:C,type:w}=u;C?i()==="single"?e([s]):w==="folder"?p(s,r(n))||k(n,[...r(n),s],!0):p(s,e())||e([...e(),s]):(k(n,r(n).filter(v=>!F(s,v)),!0),w==="folder"?(k(n,r(n).filter(v=>!F(v,s)),!0),e(e().filter(v=>!F(v,s)))):e(e().filter(v=>!S(v,s)))),t.oninput?.()},get onselect(){return t.onselect}}),P(g),j(B,g),q()}var He=L(" ",1);function at(B,t){N(t,!0);const i=ve(t,["$$slots","$$events","$$legacy"]),e=new ke(i,{value:[]});let f=W(J(e.props.value)),n=x(()=>[e.props.root_dir,e.props.glob,e.props.ignore_glob]),S=W(J(r(n)));X(()=>{JSON.stringify(r(S))!=JSON.stringify(r(n))&&r(f)==e.props.value&&(k(S,r(n),!0),e.props.value=[])}),X(()=>{r(f)!=e.props.value&&(k(f,e.props.value,!0),e.dispatch("change"))});{let p=x(()=>e.props.value===null?"dashed":"solid");be(B,{get visible(){return e.shared.visible},get variant(){return r(p)},border_mode:"base",padding:!1,get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},allow_overflow:!0,overflow_behavior:"auto",get height(){return e.props.height},get max_height(){return e.props.max_height},get min_height(){return e.props.min_height},children:(F,g)=>{var o=He(),u=te(o);Be(u,pe(()=>e.shared.loading_status,{get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n},on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var s=T(u,2);{var C=a=>{xe(a,{get buttons(){return e.props.buttons},on_custom_button_click:c=>{e.dispatch("custom_button_click",{id:c})}})};H(s,a=>{e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0&&a(C)})}var w=T(s,2);{let a=x(()=>e.shared.label||"FileExplorer");ye(w,{get show_label(){return e.shared.show_label},get Icon(){return we},get label(){return r(a)},float:!1})}var v=T(w,2);me(v,()=>r(n),a=>{De(a,{get file_count(){return e.props.file_count},get interactive(){return e.shared.interactive},get selectable(){return e.props._selectable},get ls_fn(){return e.shared.server.ls},oninput:()=>e.dispatch("input"),onselect:c=>e.dispatch("select",c),get value(){return e.props.value},set value(c){e.props.value=c}})}),j(F,o)},$$slots:{default:!0}})}q()}export{at as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BBjxpuJ4.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BBjxpuJ4.js new file mode 100644 index 0000000000000000000000000000000000000000..edfa57f587e0588cfa5224bc5430fd086e970fd7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BBjxpuJ4.js @@ -0,0 +1 @@ +import{i as d,g as S,r as F}from"./i18n-Dnhn5Rxr.js";import{R as G,S as h,w as s,a as g,x as f,a5 as b,X as n,T as W,u as y,W as L,a6 as R}from"./index-DWyDLubb.js";import{G as T}from"./utils.svelte-CCyS_0CY.js";import{P as X,a as j}from"./Plot-DfljBR3n.js";import{B as q}from"./Block-J4oodUWp.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as z}from"./BlockLabel-CZd21Hkw.js";import{I as A}from"./IconButtonWrapper-D0s9l4wW.js";import{F as C}from"./FullscreenButton-sCrcy_OJ.js";import{S as D}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./clone-BkeCM4Nl.js";import"./key-Xd_8JrI4.js";import"./misc-vsnLZ-Y1.js";import"./Empty-BIB2W5at.js";import"./snippet-BWgYNF9D.js";import"./Maximize-QH9NIRWs.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var E=L(" ",1);function _e(v,p){G(p,!0);let $=F(p,["$$slots","$$events","$$legacy"]);const e=new T($);let r=y(!1);q(v,{padding:!1,get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get visible(){return e.shared.visible},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},allow_overflow:!1,get fullscreen(){return s(r)},set fullscreen(o){f(r,o,!0)},children:(o,H)=>{var u=E(),i=h(u);{let t=b(()=>e.shared.label||e.i18n("plot.plot"));z(i,{get show_label(){return e.shared.show_label},get label(){return s(t)},get Icon(){return X}})}var _=n(i,2);{var w=t=>{{let B=b(()=>e.props.buttons??[]);A(t,{get buttons(){return s(B)},on_custom_button_click:a=>{e.dispatch("custom_button_click",{id:a})},children:(a,J)=>{var m=R(),P=h(m);{var x=l=>{C(l,{get fullscreen(){return s(r)},$$events:{fullscreen:({detail:I})=>{f(r,I,!0)}}})};d(P,l=>{e.props.show_fullscreen_button&&l(x)})}g(a,m)},$$slots:{default:!0}})}};d(_,t=>{(e.props.buttons&&e.props.buttons.length>0||e.props.show_fullscreen_button)&&t(w)})}var c=n(_,2);D(c,S({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var k=n(c,2);j(k,{get value(){return e.props.value},get theme_mode(){return e.props.theme_mode},get show_label(){return e.shared.show_label},get caption(){return e.props.caption},get bokeh_version(){return e.props.bokeh_version},get show_actions_button(){return e.props.show_actions_button},get _selectable(){return e.props._selectable},get x_lim(){return e.props.x_lim},get show_fullscreen_button(){return e.props.show_fullscreen_button},on_change:()=>e.dispatch("change")}),g(o,u)},$$slots:{default:!0}}),W()}export{j as BasePlot,_e as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BDcHJDzf.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BDcHJDzf.css new file mode 100644 index 0000000000000000000000000000000000000000..be4301c979822818690bac1c051caf29b3962813 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BDcHJDzf.css @@ -0,0 +1 @@ +div.svelte-siq5d6{display:flex;position:relative;flex-direction:column;gap:var(--layout-gap)}div.svelte-siq5d6>*,div.svelte-siq5d6>.form>*{width:var(--size-full)}.hide.svelte-siq5d6{display:none}.compact.svelte-siq5d6>*,.compact.svelte-siq5d6 .box{border-radius:0}.compact.svelte-siq5d6,.panel.svelte-siq5d6{border:solid var(--panel-border-width) var(--panel-border-color);border-radius:var(--container-radius);background:var(--panel-background-fill);padding:var(--spacing-lg)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BJAly1p_.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BJAly1p_.js new file mode 100644 index 0000000000000000000000000000000000000000..23f5333dcba5085b7fad252b2fd0e04b5e985db9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BJAly1p_.js @@ -0,0 +1,10 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Blocks-D6_IyY-z.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./i18n-Dnhn5Rxr.js","./i18n-9kYrHpuJ.css","./html-Ih_5QVTo.js","./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js","./snippet-BWgYNF9D.js","./ScrollFade-DV-0xzhB.css","./size-CtOeLwIl.js","./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js","./index-B_pwUImq.js","./StreamingBar-CMuqaV2j.css","./state.svelte-CXxGByZZ.js","./index-CglBvmLb.js","./Clear-BF6j078A.js","./utils.svelte-CCyS_0CY.js","./clone-BkeCM4Nl.js","./index-DkrWwIux.js","./index-tFQomdd2.js","./Blocks-CXVCGwNW.css","./Login-DEGa-CNM.js","./BaseForm-B7Gu_hvH.js","./BaseForm-DJxyhkeW.css","./Textbox-BuFR2fNz.js","./actions-CLThs9VH.js","./input-DrerMDOL.js","./BlockTitle-BMm9LakX.js","./Info-Dzjhnd64.js","./Check-DUAHzS2-.js","./Copy-ChCbTvli.js","./Send-B_rl9Hxa.js","./Square-CcB54dqq.js","./IconButtonWrapper-D0s9l4wW.js","./Textbox-B5AH0EoL.css","./Block-J4oodUWp.js","./Button-D-_s2ksk.js","./Image-CeW7PJs4.js","./misc-vsnLZ-Y1.js","./Image-Da_XA0w6.css","./Button-BZ4d-rtD.css","./ImagePreview-CCVfwC4m.css","./Index.svelte_svelte_type_style_lang-BKODC18H.js","./Index-BDcHJDzf.css","./Login-DLnqC4Fa.css","./Example-Cvv6PwrD.css"])))=>i.map(i=>d[i]); +import{R as gt,x as i,a4 as mt,aa as Be,ae as ht,a1 as O,a2 as ft,T as yt,U as w,w as e,G as de,a6 as ke,S as ce,a as k,a3 as u,ad as E,z as g,X as Le,W as J,t as Re,a0 as Fe,V as Z,af as Ve,Y,a8 as wt}from"./index-DWyDLubb.js";import{y as He,p as v,e as vt,E as bt,m as xt,i as U,q as Ge,z as Ct,w as Et,A as We,D as Ze,a as At,g as kt}from"./i18n-Dnhn5Rxr.js";import{S as Lt}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var Rt=()=>{const r=document.createElement("link");r.href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700;1,900&display=swap",r.rel="stylesheet";const t=document.createElement("link");t.href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600;700&display=swap",t.rel="stylesheet",document.head.appendChild(r),document.head.appendChild(t)},St=()=>{const r=document.createElement("div");return r.style.backgroundImage="linear-gradient(to top, #f9fafb, white)",r.style.border="1px solid #e5e7eb",r.style.borderRadius="0.75rem",r.style.boxShadow="0 0 10px rgba(0, 0, 0, 0.1)",r.style.color="#374151",r.style.display="flex",r.style.flexDirection="row",r.style.alignItems="center",r.style.height="40px",r.style.justifyContent="space-between",r.style.overflow="hidden",r.style.position="fixed",r.style.right=".75rem",r.style.top=".75rem",r.style.width="auto",r.style.zIndex="20",r.style.paddingLeft="1rem",r.setAttribute("id","huggingface-space-header"),window.matchMedia("(max-width: 768px)").addEventListener("change",t=>{t.matches?r.style.display="none":r.style.display="flex"}),r},It=()=>{const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("xmlns:link","http://www.w3.org/1999/xlink"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false"),r.setAttribute("role","img"),r.setAttribute("width","1em"),r.setAttribute("height","1em"),r.setAttribute("preserveAspectRatio","xMidYMid meet"),r.setAttribute("viewBox","0 0 12 12"),r.setAttribute("fill","currentColor");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","M0.375001 10.3828L0.375 1.61719C0.375 1.104 0.816001 0.687501 1.35938 0.687501L10.6406 0.6875C10.9017 0.6875 11.1521 0.785449 11.3367 0.959797C11.5213 1.13415 11.625 1.37062 11.625 1.61719V10.3828C11.625 10.6294 11.5213 10.8659 11.3367 11.0402C11.1521 11.2145 10.9017 11.3125 10.6406 11.3125H1.35938C0.816001 11.3125 0.375001 10.896 0.375001 10.3828ZM1.35938 10.5156H10.6406C10.7183 10.5156 10.7813 10.4561 10.7813 10.3828V4.40625H1.21875V10.3828C1.21875 10.418 1.23356 10.4518 1.25994 10.4767C1.28631 10.5017 1.32208 10.5156 1.35938 10.5156ZM4.61052 6.38251L5.9999 7.69472L7.38927 6.38251C7.44083 6.33007 7.50645 6.29173 7.57913 6.27153C7.6518 6.25134 7.72898 6.25003 7.8024 6.26776C7.87583 6.28549 7.9428 6.3216 7.99628 6.37227C8.04983 6.42295 8.08785 6.48631 8.10645 6.5557C8.12528 6.62497 8.12393 6.69773 8.10263 6.76635C8.0814 6.83497 8.0409 6.8969 7.98555 6.94564L6.29802 8.53936C6.21892 8.61399 6.11169 8.65592 5.9999 8.65592C5.8881 8.65592 5.78087 8.61399 5.70177 8.53936L4.01427 6.94564C3.95874 6.89694 3.91814 6.835 3.89676 6.76633C3.87538 6.69766 3.874 6.62483 3.89277 6.55549C3.91154 6.48615 3.94977 6.42287 4.00343 6.37233C4.05708 6.32179 4.12418 6.28585 4.19765 6.2683C4.27098 6.25054 4.34803 6.25178 4.42068 6.27188C4.49334 6.29198 4.55891 6.3302 4.61052 6.38251Z"),r.appendChild(t),r},Pt=(r,t)=>{const o=document.createElement("div");return o.setAttribute("id","space-header__collapse"),o.style.display="flex",o.style.flexDirection="row",o.style.alignItems="center",o.style.justifyContent="center",o.style.fontSize="16px",o.style.paddingLeft="10px",o.style.paddingRight="10px",o.style.height="40px",o.style.cursor="pointer",o.style.color="#40546e",o.style.transitionDuration="0.1s",o.style.transitionProperty="all",o.style.transitionTimingFunction="ease-in-out",o.appendChild(It()),o.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),t()}),o.addEventListener("mouseenter",()=>{o.style.color="#213551"}),o.addEventListener("mouseleave",()=>{o.style.color="#40546e"}),o},$t=r=>{const t=document.createElement("p");return t.style.margin="0",t.style.padding="0",t.style.color="#9ca3af",t.style.fontSize="14px",t.style.fontFamily="Source Sans Pro, sans-serif",t.style.padding="0px 6px",t.style.borderLeft="1px solid #e5e7eb",t.style.marginLeft="4px",t.textContent=(r??0).toString(),t},Mt=()=>{const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("xmlns:link","http://www.w3.org/1999/xlink"),r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false"),r.setAttribute("role","img"),r.setAttribute("width","1em"),r.setAttribute("height","1em"),r.setAttribute("preserveAspectRatio","xMidYMid meet"),r.setAttribute("viewBox","0 0 32 32"),r.setAttribute("fill","#6b7280");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","M22.45,6a5.47,5.47,0,0,1,3.91,1.64,5.7,5.7,0,0,1,0,8L16,26.13,5.64,15.64a5.7,5.7,0,0,1,0-8,5.48,5.48,0,0,1,7.82,0L16,10.24l2.53-2.58A5.44,5.44,0,0,1,22.45,6m0-2a7.47,7.47,0,0,0-5.34,2.24L16,7.36,14.89,6.24a7.49,7.49,0,0,0-10.68,0,7.72,7.72,0,0,0,0,10.82L16,29,27.79,17.06a7.72,7.72,0,0,0,0-10.82A7.49,7.49,0,0,0,22.45,4Z"),r.appendChild(t),r},Dt=r=>{const t=document.createElement("a");return t.setAttribute("href",`https://huggingface.co/spaces/${r.id}`),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t.style.border="1px solid #e5e7eb",t.style.borderRadius="6px",t.style.display="flex",t.style.flexDirection="row",t.style.alignItems="center",t.style.margin="0 0 0 12px",t.style.fontSize="14px",t.style.paddingLeft="4px",t.style.textDecoration="none",t.appendChild(Mt()),t.appendChild($t(r.likes)),t},zt=(r,t="user")=>{const o=t==="user"?"users":"organizations",a=document.createElement("img");return a.src=`https://huggingface.co/api/${o}/${r}/avatar`,a.style.width="0.875rem",a.style.height="0.875rem",a.style.borderRadius="50%",a.style.flex="none",a.style.marginRight="0.375rem",a},Nt=r=>{const[t,o]=r.split("/"),a=document.createElement("a");return a.setAttribute("href",`https://huggingface.co/spaces/${r}`),a.setAttribute("rel","noopener noreferrer"),a.setAttribute("target","_blank"),a.style.color="#1f2937",a.style.textDecoration="none",a.style.fontWeight="600",a.style.fontSize="15px",a.style.lineHeight="24px",a.style.flex="none",a.style.fontFamily="IBM Plex Mono, sans-serif",a.addEventListener("mouseover",()=>{a.style.color="#2563eb"}),a.addEventListener("mouseout",()=>{a.style.color="#1f2937"}),a.textContent=o,a},Ot=()=>{const r=document.createElement("div");return r.style.marginLeft=".125rem",r.style.marginRight=".125rem",r.style.color="#d1d5db",r.textContent="/",r},Ut=r=>{const t=document.createElement("a");return t.setAttribute("href",`https://huggingface.co/${r}`),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t.style.color="rgb(107, 114, 128)",t.style.textDecoration="none",t.style.fontWeight="400",t.style.fontSize="16px",t.style.lineHeight="24px",t.style.flex="none",t.style.fontFamily="Source Sans Pro, sans-serif",t.addEventListener("mouseover",()=>{t.style.color="#2563eb"}),t.addEventListener("mouseout",()=>{t.style.color="rgb(107, 114, 128)"}),t.textContent=r,t},qt=r=>{const t=document.createElement("div");return t.style.display="flex",t.style.flexDirection="row",t.style.alignItems="center",t.style.justifyContent="center",t.style.borderRight="1px solid #e5e7eb",t.style.paddingRight="12px",t.style.height="40px",r.type!=="unknown"&&t.appendChild(zt(r.author,r.type)),t.appendChild(Ut(r.author)),t.appendChild(Ot()),t.appendChild(Nt(r.id)),t.appendChild(Dt(r)),t},Tt=r=>{const t=St(),o=()=>t.style.display="none";return t.appendChild(qt(r)),t.appendChild(Pt(r,o)),t},Ye=async(r,t="user")=>{const o=t==="user"?"users":"organizations";try{return(await fetch(`https://huggingface.co/api/${o}/${r}/avatar`)).ok}catch{return!1}},jt=async r=>{try{return await(await fetch(`https://huggingface.co/api/spaces/${r}`)).json()}catch{return null}},Bt=(r,t)=>{if(document.body===null)return console.error("document.body is null");document.body.appendChild(r)};async function Ft(r,t){var o,a;if(window===void 0)return console.error("Please run this script in a browser environment");if(Object.values((a=(o=window.location)==null?void 0:o.ancestorOrigins)!=null?a:{0:window.document.referrer}).some(L=>{var T;return((T=new URL(L))==null?void 0:T.origin)==="https://huggingface.co"}))return;Rt();let m;if(typeof r=="string"){if(m=await jt(r),m===null)return console.error("Space not found")}else m=r;const[b,q]=await Promise.all([Ye(m.author,"user"),Ye(m.author,"org")]);m.type=b?"user":q?"org":"unknown";const S=Tt(m);return Bt(S),{element:S}}var Vt=(r,t)=>Ft(r);let Ht=-1;function Gt(){const r=Et({}),t=new Map,o=new IntersectionObserver(R=>{R.forEach(m=>{if(m.isIntersecting){let b=t.get(m.target);b!==void 0&&r.update(q=>({...q,[b]:!0}))}})});function a(R,m){t.set(m,R),o.observe(m)}return{register:a,subscribe:r.subscribe}}const Je=Gt();var Wt=J('

        If your custom component never loads, consult the troubleshooting guide.

        '),Zt=J('
        '),Yt=J('

        Please contact the author of the space to let them know.

        '),Jt=J('

        '),Xt=J('

        '),Kt=J(" ",1);function lr(r,t){gt(t,!1);const o=()=>Ge(Je,"$intersecting",R),a=()=>Ge(Ct,"$_",R),[R,m]=xt();let b=u(!1);He().then(()=>{i(b,!0)});const q=mt();let S=v(t,"autoscroll",12),L=v(t,"version",12),T=v(t,"initial_height",12),te=v(t,"app_mode",12),f=v(t,"is_embed",12),ue=v(t,"theme_mode",12,"system"),pe=v(t,"control_page_title",12),_e=v(t,"container",12),ge=v(t,"info",12),re=v(t,"eager",12),me,Se=u([]),Ie=u(),Pe=u(),ne=v(t,"Client",12),I=v(t,"space",12),he=v(t,"src",12),$e=Ht++,j=u("pending"),Xe=u(null),P=u(),X=u(!1),se=u(!1),s=u(),Me=u("Loading..."),De=u(),ae,K=null;async function ze(n){n&&(K||(K=document.createElement("style"),document.head.appendChild(K)),K.textContent=We(n,L(),K)),await Ze(e(s).root+"/theme.css?v="+e(s).theme_hash,document.head),e(s).stylesheets&&await Promise.all(e(s).stylesheets.map(d=>d.startsWith("http:")||d.startsWith("https:")?Ze(d,document.head):fetch(e(s).root+"/"+d).then(c=>c.text()).then(c=>{We(c,L())})))}async function Ne(n){if(n){const d=new DOMParser,l=Array.from(d.parseFromString(n,"text/html").head.children);if(l)for(let c of l){let h=document.createElement(c.tagName);if(Array.from(c.attributes).forEach(y=>{h.setAttribute(y.name,y.value)}),h.textContent=c.textContent,h.tagName=="META"){const y=h.getAttribute("property"),M=h.getAttribute("name");if(y||M){const le=Array.from(document.head.getElementsByTagName("meta")??[]).find(F=>y&&F.getAttribute("property")===y||M&&F.getAttribute("name")===M?!F.isEqualNode(h):!1);if(le){document.head.replaceChild(h,le);continue}}}document.head.appendChild(h)}}}function Ke(n){const d=window.__gradio_mode__==="website";let l;if(d)l="light";else{const h=new URL(window.location.toString()).searchParams.get("__theme");l=ue()||h||"system"}return l==="dark"||l==="light"?Oe(n,l):l=Qe(n),l}function Qe(n){const d=l();window?.matchMedia("(prefers-color-scheme: dark)")?.addEventListener("change",l);function l(){let c=window?.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light";return Oe(n,c),c}return d}function Oe(n,d){const l=f()?n.parentElement:document.body,c=f()?n:n.parentElement;c.style.background="var(--body-background-fill)",d==="dark"?l.classList.add("dark"):l.classList.remove("dark")}let _=u({message:"",load_status:"pending",status:"sleeping",detail:"SLEEPING"}),p=u(),fe=u(!1);function Ue(n){i(_,n)}const qe=window.__GRADIO_DEV__;let oe=u(!1),B=u(),ye=u(0);Be(async()=>{i(De,Ke(e(P)));const n=window.__GRADIO__SERVER_PORT__;ae=qe==="dev"?`http://localhost:${typeof n=="number"?n:7860}`:I()||he()||new URL(location.pathname,location.origin).href.replace(/\/$/,"");const d=new URLSearchParams(window.location.search).get("deep_link"),l={};if(d&&(l.deep_link=d),i(p,await ne().connect(ae,{status_callback:Ue,with_null_state:!0,events:["data","log","status","render"],query_params:l})),window.addEventListener("beforeunload",()=>{e(p).close()}),!e(p).config&&!e(s)?.auth_required)throw new Error("Could not resolve app config");if(i(s,e(p).get_url_config()),window.__gradio_space__=e(s).space_id,e(p).config?.i18n_translations&&(await He(e(p).config.i18n_translations),i(b,!0)),window.__gradio_session_hash__=e(p).session_hash,i(_,{message:"",load_status:"complete",status:"running",detail:"RUNNING"}),await ze(e(s).css),await Ne(e(s).head),i(fe,!0),window.__is_colab__=e(s).is_colab,q("loaded"),i(Se,e(s).pages),i(Ie,e(s).current_page),i(Pe,e(s).root),e(s).deep_link_state==="invalid"&&i(oe,!0),e(s).js)try{const c=document.createElement("script");c.textContent=e(s).js,document.head.appendChild(c)}catch(c){console.error("Error executing custom JS:",c)}e(s).dev_mode&&setTimeout(()=>{const{host:c}=new URL(ae);let h=new URL(`${window.location.protocol}//${c}${e(p).api_prefix}/dev/reload`);me=new EventSource(h),me.addEventListener("error",async y=>{let M=y.data;M&&(e(B)("Error","Error reloading app",-1,"error",10,!0),console.error(JSON.parse(M)))}),me.addEventListener("reload",async y=>{if(e(p).close(),i(p,await ne().connect(ae,{status_callback:Ue,with_null_state:!0,events:["data","log","status","render"],session_hash:e(p).session_hash})),!e(p).config)throw new Error("Could not resolve app config");i(s,e(p).get_url_config()),window.__gradio_space__=e(s).space_id,await ze(e(s).css),await Ne(e(s).head),i(fe,!0),window.__is_colab__=e(s).is_colab,i(ye,e(ye)+1),q("loaded")})},200)});let we=u(),ie=u();async function et(){i(we,(await Ve(async()=>{const{default:n}=await import("./Blocks-D6_IyY-z.js").then(d=>d.B);return{default:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]),import.meta.url)).default)}async function tt(){i(ie,(await Ve(async()=>{const{default:n}=await import("./Login-DEGa-CNM.js");return{default:n}},__vite__mapDeps([21,3,1,2,4,5,22,23,24,25,26,6,7,8,27,28,29,30,31,32,33,34,10,11,12,35,36,37,38,39,40,41,42,14,15,43,44,45]),import.meta.url)).default)}function rt(){e(s).auth_required?tt():et()}let $=u();Be(async()=>{Je.register($e,e(P))});let Q;async function nt(n,d){if(n&&!d&&window.self===window.top){Q&&(Q.remove(),Q=void 0);const l=await Vt(n);l&&(Q=l.element)}}ht(()=>{Q?.remove()}),O(()=>e(s),()=>{e(s)?.app_id&&i(Xe,e(s).app_id)}),O(()=>(e(B),e(oe)),()=>{e(B)&&e(oe)&&(e(B)("Error","Deep link was not valid",-1,"error",10,!0),i(oe,!1))}),O(()=>(e(X),e(_)),()=>{i(j,!e(X)&&e(_).load_status!=="error"?"pending":!e(X)&&e(_).load_status==="error"?"error":e(_).load_status)}),O(()=>(e(s),de(re()),o()),()=>{e(s)&&(re()||o()[$e])&&rt()}),O(()=>(e(b),a()),()=>{e(b)&&(i(Me,a()("common.loading")+"..."),i($,{readable_error:{NO_APP_FILE:a()("errors.no_app_file"),CONFIG_ERROR:a()("errors.config_error"),BUILD_ERROR:a()("errors.build_error"),RUNTIME_ERROR:a()("errors.runtime_error"),PAUSED:a()("errors.space_paused")},title(n){return encodeURIComponent(a()("errors.space_not_working"))},description(n,d){return encodeURIComponent(`Hello, + +Firstly, thanks for creating this space! + +I noticed that the space isn't working correctly because there is ${this.readable_error[n]||"an error"}. + +It would be great if you could take a look at this because this space is being embedded on ${d}. + +Thanks!`)}}))}),O(()=>(e(se),e(P)),()=>{e(se)&&e(P).dispatchEvent(new CustomEvent("render",{bubbles:!0,cancelable:!1,composed:!0}))}),O(()=>(e(p),de(f())),()=>{e(p)?.config&&nt(e(p)?.config?.space_id,f())}),ft();var st={get autoscroll(){return S()},set autoscroll(n){S(n),w()},get version(){return L()},set version(n){L(n),w()},get initial_height(){return T()},set initial_height(n){T(n),w()},get app_mode(){return te()},set app_mode(n){te(n),w()},get is_embed(){return f()},set is_embed(n){f(n),w()},get theme_mode(){return ue()},set theme_mode(n){ue(n),w()},get control_page_title(){return pe()},set control_page_title(n){pe(n),w()},get container(){return _e()},set container(n){_e(n),w()},get info(){return ge()},set info(n){ge(n),w()},get eager(){return re()},set eager(n){re(n),w()},get Client(){return ne()},set Client(n){ne(n),w()},get space(){return I()},set space(n){I(n),w()},get src(){return he()},set src(n){he(n),w()}};vt();{let n=E(()=>_e()&&f()),d=E(()=>!!I()&&ge()),l=E(()=>e(j)==="complete"),c=E(()=>(e(s),g(()=>e(s)?.fill_width||!1))),h=E(()=>(e(s),g(()=>e(s)?.components||[])));bt(r,{get display(){return e(n)},get is_embed(){return f()},get info(){return e(d)},get version(){return L()},get initial_height(){return T()},get space(){return I()},get loaded(){return e(l)},get fill_width(){return e(c)},get pages(){return e(Se)},get current_page(){return e(Ie)},get root(){return e(Pe)},get components(){return e(h)},get wrapper(){return e(P)},set wrapper(y){i(P,y)},children:(y,M)=>{var ve=ke(),le=ce(ve);{var F=be=>{var Te=Kt(),je=ce(Te);{var ot=C=>{{let V=E(()=>!f());Lt(C,{get absolute(){return e(V)},get status(){return e(j)},timer:!1,queue_position:null,queue_size:null,translucent:!0,get loading_text(){return e(Me)},get i18n(){return a()},get autoscroll(){return S()},$$slots:{"additional-loading-text":(D,xe)=>{var x=Zt(),z=Z(x);{var H=N=>{var A=Wt();k(N,A)};U(z,N=>{qe==="dev"&&N(H)})}Y(x),k(D,x)},error:(D,xe)=>{var x=Xt(),z=Z(x),H=Z(z),N=Z(H,!0);Y(H),Y(z);var A=Le(z,2);{var ct=G=>{var W=Yt(),Ce=Le(Z(W));wt(),Y(W),Re((Ee,ee)=>At(Ce,"href",`https://huggingface.co/spaces/${I()??""}/discussions/new?title=${Ee??""}&description=${ee??""}`),[()=>(e($),e(_),g(()=>e($).title(e(_)?.detail))),()=>(e($),e(_),g(()=>e($).description(e(_)?.detail,location.origin)))]),k(G,W)},ut=G=>{var W=ke(),Ce=ce(W);{var Ee=ee=>{var Ae=Jt(),pt=Z(Ae,!0);Y(Ae),Re(_t=>Fe(pt,_t),[()=>(a(),g(()=>a()("errors.contact_page_author")))]),k(ee,Ae)};U(Ce,ee=>{e(b)&&ee(Ee)},!0)}k(G,W)};U(A,G=>{e(_),e($),g(()=>(e(_).status==="space_error"||e(_).status==="paused")&&e(_).discussions_enabled&&e($))?G(ct):G(ut,!1)})}Y(x),Re(()=>Fe(N,(e(_),g(()=>e(_)?.message||"")))),k(D,x)}}})}};U(je,C=>{e(j),e(s),g(()=>(e(j)==="pending"||e(j)==="error")&&!(e(s)&&e(s)?.auth_required))&&C(ot)})}var it=Le(je,2);{var lt=C=>{{let V=E(()=>e(b)?a():D=>D);e(ie)(C,{get auth_message(){return e(s),g(()=>e(s).auth_message)},get root(){return e(s),g(()=>e(s).root)},get space_id(){return I()},get i18n(){return e(V)},get app_mode(){return te()}})}},dt=C=>{var V=ke(),D=ce(V);{var xe=x=>{{let z=E(()=>(de(f()),e(s),g(()=>!f()&&e(s).fill_height))),H=E(()=>(de(f()),e(s),g(()=>f()?[]:e(s).footer_links))),N=E(()=>(e(s),g(()=>e(s).api_prefix||"")));e(we)(x,kt({get app(){return e(p)}},()=>e(s),{get fill_height(){return e(z)},get theme_mode(){return e(De)},get control_page_title(){return pe()},get target(){return e(P)},get autoscroll(){return S()},get footer_links(){return e(H)},get app_mode(){return te()},get version(){return L()},get api_prefix(){return e(N)},get max_file_size(){return e(s),g(()=>e(s).max_file_size)},initial_layout:void 0,search_params:g(()=>new URLSearchParams(window.location.search)),get reload_count(){return e(ye)},get ready(){return e(X)},set ready(A){i(X,A)},get render_complete(){return e(se)},set render_complete(A){i(se,A)},get add_new_message(){return e(B)},set add_new_message(A){i(B,A)},$$legacy:!0}))}};U(D,x=>{e(s)&&e(we)&&e(fe)&&x(xe)},!0)}k(C,V)};U(it,C=>{e(s),e(ie),g(()=>e(s)?.auth_required&&e(ie))?C(lt):C(dt,!1)})}k(be,Te)};U(le,be=>{e(b)&&be(F)})}k(y,ve)},$$slots:{default:!0},$$legacy:!0})}var at=yt(st);return m(),at}export{lr as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BL27_CUo.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BL27_CUo.css new file mode 100644 index 0000000000000000000000000000000000000000..7487d1d467660c8a5d0886868443095a8a746b9a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BL27_CUo.css @@ -0,0 +1 @@ +.s--slider.svelte-1io85vl{display:flex;align-items:center}.s--slider.svelte-1io85vl button:where(.svelte-1io85vl){width:3em;height:1.6em;position:relative;margin:0 .5em 0 0;background:var(--button-secondary-background-fill);border:none}.s--slider.svelte-1io85vl button[disabled]:where(.svelte-1io85vl){cursor:not-allowed}.s--slider.svelte-1io85vl button:where(.svelte-1io85vl):before{content:"";position:absolute;width:1.3em;height:1.3em;background:#fff;top:.13em;right:1.5em;transition:transform .3s}.s--slider.svelte-1io85vl button[aria-checked=true]:where(.svelte-1io85vl){background-color:var(--color-accent)}.s--slider.svelte-1io85vl button[aria-checked=true]:where(.svelte-1io85vl):before{transform:translate(1.3em);transition:transform .3s}.s--slider.svelte-1io85vl button:where(.svelte-1io85vl):focus{box-shadow:0 0 0 1px var(--color-accent)}.s--slider.svelte-1io85vl button:where(.svelte-1io85vl){border-radius:1.5em}.s--slider.svelte-1io85vl button:where(.svelte-1io85vl):before{border-radius:100%}.s--slider.svelte-1io85vl button:where(.svelte-1io85vl):focus{box-shadow:0 0 8px var(--accent-color);border-radius:1.5em}div.container.svelte-1p54cvv{display:block;width:100%}.input-container.svelte-1p54cvv{display:flex;position:relative;align-items:flex-end}.dialogue-container.svelte-1p54cvv{border:none;border-radius:var(--input-radius);background:var(--input-background-fill);padding:var(--spacing-md);margin-bottom:var(--spacing-sm);position:relative}.dialogue-line.svelte-1p54cvv{display:flex;align-items:center;margin-bottom:var(--spacing-sm)}.dialogue-line.svelte-1p54cvv:has(.action-column.hidden:where(.svelte-1p54cvv)) .text-column:where(.svelte-1p54cvv){margin-right:0}.speaker-column.svelte-1p54cvv{flex:0 0 150px;margin-right:var(--spacing-sm);display:flex;align-items:center}.speaker-column.svelte-1p54cvv textarea:where(.svelte-1p54cvv){background:var(--speaker-bg-color);transition:background-color .2s ease;border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);padding:var(--input-padding);color:var(--body-text-color);font-weight:var(--input-text-weight);font-size:var(--input-text-size);line-height:var(--line-sm);resize:none;width:100%;box-sizing:border-box;height:auto;min-height:30px;max-height:none;margin-top:0;margin-bottom:0;z-index:1;display:block;position:relative;white-space:pre-wrap;word-wrap:break-word;overflow-wrap:break-word;overflow:hidden}.text-column.svelte-1p54cvv{flex:1;margin-right:var(--spacing-sm)}.text-column.svelte-1p54cvv textarea:where(.svelte-1p54cvv){padding:var(--spacing-sm);border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);background:var(--speaker-bg-color);transition:background-color .2s ease;height:auto;min-height:30px;max-height:none;flex-grow:1;margin-top:0;margin-bottom:0;resize:none;z-index:1;display:block;position:relative;padding:var(--input-padding);width:100%;color:var(--body-text-color);font-weight:var(--input-text-weight);font-size:var(--input-text-size);line-height:var(--line-sm);white-space:pre-wrap;word-wrap:break-word;overflow-wrap:break-word;overflow:hidden;box-sizing:border-box}.text-column.svelte-1p54cvv textarea:where(.svelte-1p54cvv){color:var(--body-text-color)}.dialogue-line[style*="--speaker-bg-color: rgba"].svelte-1p54cvv .text-column:where(.svelte-1p54cvv) textarea:where(.svelte-1p54cvv),.dialogue-line[style*="--speaker-bg-color: rgba"].svelte-1p54cvv .speaker-column:where(.svelte-1p54cvv) textarea:where(.svelte-1p54cvv){color:#000}textarea.svelte-1p54cvv{flex-grow:1;margin-top:0;margin-bottom:0;resize:none;z-index:1;display:block;position:relative;outline:none!important;background:var(--input-background-fill);padding:var(--input-padding);width:100%;color:var(--body-text-color);font-weight:var(--input-text-weight);font-size:var(--input-text-size);line-height:var(--line-sm);box-shadow:var(--input-shadow);border:var(--input-border-width) solid var(--input-border-color);border-radius:var(--input-radius)}textarea.svelte-1p54cvv:disabled{-webkit-opacity:1;opacity:1}textarea.svelte-1p54cvv:focus{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus);background:var(--input-background-fill-focus)}textarea.svelte-1p54cvv::placeholder{color:var(--input-placeholder-color)}.action-column.svelte-1p54cvv{display:flex;justify-content:center}.add-button.svelte-1p54cvv{display:flex;justify-content:center;align-items:center;width:25px;height:25px;border:none;background:transparent;cursor:pointer}.delete-button.svelte-1p54cvv{display:flex;justify-content:center;align-items:center;width:15px;height:15px}.add-button.svelte-1p54cvv:hover{color:var(--color-accent)}.switch-container.svelte-1p54cvv{display:flex;justify-content:flex-start;transition:opacity .2s ease-in-out}.switch-container.switch-disabled.svelte-1p54cvv{opacity:.6;pointer-events:none}.switch-container.top-switch.svelte-1p54cvv{margin-bottom:var(--spacing-sm);justify-content:flex-end}.submit-container.svelte-1p54cvv{display:flex;justify-content:flex-end;margin-top:var(--spacing-sm)}.submit-container.svelte-1p54cvv button[disabled]:where(.svelte-1p54cvv){cursor:not-allowed}.submit-button.svelte-1p54cvv{border:none;text-align:center;text-decoration:none;font-size:14px;cursor:pointer;border-radius:15px;min-width:30px;height:30px;flex-shrink:0;display:flex;justify-content:center;align-items:center;background:var(--button-secondary-background-fill);color:var(--button-secondary-text-color)}.submit-button.svelte-1p54cvv:hover{background:var(--button-secondary-background-fill-hover)}.submit-button.svelte-1p54cvv:active{box-shadow:var(--button-shadow-active)}.submit-button.svelte-1p54cvv svg{height:22px;width:22px}.tag-menu.svelte-1p54cvv{position:absolute;width:100%;top:100%;left:0}.tag-menu-plain-text.svelte-1p54cvv{position:relative;width:100%}.tag-menu-plain-text.svelte-1p54cvv .options{position:static!important;width:100%!important;max-height:none!important;top:auto!important;bottom:auto!important}.hidden.svelte-1p54cvv{display:none}.loading-overlay.svelte-1p54cvv{position:absolute;inset:0;background:var(--input-background-fill);opacity:.95;backdrop-filter:blur(2px);display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:10;border-radius:var(--input-radius)}.loading-spinner.svelte-1p54cvv{width:24px;height:24px;border:2px solid var(--border-color-primary);border-top:2px solid var(--color-accent);border-radius:50%;animation:svelte-1p54cvv-spin 1s linear infinite;margin-bottom:var(--spacing-sm)}@keyframes svelte-1p54cvv-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.loading-text.svelte-1p54cvv{color:var(--body-text-color);font-size:var(--text-sm);font-weight:500;opacity:.8}.dialogue-container.loading.svelte-1p54cvv,.textarea-container.loading.svelte-1p54cvv{position:relative;opacity:.7;transition:opacity .3s ease-in-out}.dialogue-container.svelte-1p54cvv,.textarea-container.svelte-1p54cvv{transition:opacity .3s ease-in-out} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BPmhhU8b.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BPmhhU8b.css new file mode 100644 index 0000000000000000000000000000000000000000..cf337a90f3c7eef11538e642f339bdfbbbab3390 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BPmhhU8b.css @@ -0,0 +1 @@ +div.svelte-1p9262q{border:var(--block-border-width) solid var(--border-color-primary);background:var(--block-border-color);border-radius:var(--block-radius);display:flex;flex-direction:column;gap:var(--form-gap-width);overflow:hidden}div.svelte-1p9262q>*:not(.absolute){border:none;border-radius:0}.hide.svelte-1p9262q{display:none} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BQpIYZRd.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BQpIYZRd.js new file mode 100644 index 0000000000000000000000000000000000000000..280e787449e837c2d5eb79572be884d69c247dc1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BQpIYZRd.js @@ -0,0 +1 @@ +import{g as ae,i as x,r as re,k as X,a as z,b as Y,f as Z,u as j,d as se}from"./i18n-Dnhn5Rxr.js";import{R as oe,S as B,w as t,a as d,x as $,X as _,T as le,u as q,a5 as A,W as h,V as I,a6 as ie,t as y,Y as k,a0 as ne,Z as g}from"./index-DWyDLubb.js";import{B as pe}from"./Block-J4oodUWp.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as ue}from"./BlockLabel-CZd21Hkw.js";import{E as de}from"./Empty-BIB2W5at.js";import{I as C}from"./Image-DrPceByI.js";import{G as ce}from"./utils.svelte-CCyS_0CY.js";import{I as me}from"./IconButtonWrapper-D0s9l4wW.js";import{F as ve}from"./FullscreenButton-sCrcy_OJ.js";import{S as _e}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./snippet-BWgYNF9D.js";import"./clone-BkeCM4Nl.js";import"./Maximize-QH9NIRWs.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var ge=h(""),he=h(''),fe=h('
        '),be=h('
        the base file that is annotated
        ',1),$e=h('
        ',1);function Xe(D,P){oe(P,!0);const H=re(P,["$$slots","$$events","$$legacy"]),e=new ce(H);let c=q(null),S,n=q(!1),J=A(()=>e.shared.label||e.i18n("annotated_image.annotated_image"));e.watch_for_change();function E(l){$(c,l,!0)}function F(){$(c,null)}function K(l,G){e.dispatch("select",{value:G,index:l})}pe(D,{get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},padding:!1,get height(){return e.props.height},get width(){return e.props.width},allow_overflow:!1,get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},get fullscreen(){return t(n)},set fullscreen(l){$(n,l,!0)},children:(l,G)=>{var M=$e(),W=B(M);_e(W,ae({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status));var L=_(W,2);ue(L,{get show_label(){return e.shared.show_label},get Icon(){return C},get label(){return t(J)}});var R=_(L,2),N=I(R);{var O=p=>{de(p,{size:"large",unpadded_box:!0,children:(f,m)=>{C(f)},$$slots:{default:!0}})},Q=p=>{var f=be(),m=B(f),T=I(m);{let o=A(()=>e.props.buttons||[]);me(T,{get buttons(){return t(o)},on_custom_button_click:s=>{e.dispatch("custom_button_click",{id:s})},children:(s,b)=>{var a=ie(),i=B(a);{var r=v=>{ve(v,{get fullscreen(){return t(n)},$$events:{fullscreen:({detail:u})=>{$(n,u,!0)}}})};x(i,v=>{(e.props.buttons||[]).some(u=>typeof u=="string"&&u==="fullscreen")&&v(r)})}d(s,a)},$$slots:{default:!0}})}var w=_(T,2);let V;var U=_(w,2);X(U,17,()=>e.props.value?e.props.value.annotations:[],j,(o,s,b)=>{var a=ge();let i;y(r=>{z(a,"alt",`segmentation mask identifying ${e.shared.label??""} within the uploaded file`),i=Y(a,1,"mask fit-height svelte-1oizopk",null,i,{"fit-height":!t(n),active:t(c)==t(s).label,inactive:t(c)!=t(s).label&&t(c)!=null}),z(a,"src",t(s).image.url),Z(a,r)},[()=>e.props.color_map&&t(s).label in e.props.color_map?null:`filter: hue-rotate(${Math.round(b*360/(e.props.value?.annotations.length??1))}deg);`]),d(o,a)}),k(m),se(m,o=>S=o,()=>S);var ee=_(m,2);{var te=o=>{var s=fe();X(s,21,()=>e.props.value.annotations,j,(b,a,i)=>{var r=he(),v=I(r,!0);k(r),y(u=>{Z(r,`background-color: ${u??""}`),ne(v,t(a).label)},[()=>e.props.color_map&&t(a).label in e.props.color_map?e.props.color_map[t(a).label]+"88":`hsla(${Math.round(i*360/e.props.value.annotations.length)}, 100%, 50%, 0.3)`]),g("mouseover",r,()=>E(t(a).label)),g("focus",r,()=>E(t(a).label)),g("mouseout",r,()=>F()),g("blur",r,()=>F()),g("click",r,()=>K(i,t(a).label)),d(b,r)}),k(s),d(o,s)};x(ee,o=>{e.props.show_legend&&e.props.value&&o(te)})}y(()=>{V=Y(w,1,"base-image svelte-1oizopk",null,V,{"fit-height":e.props.height&&!t(n)}),z(w,"src",e.props.value?e.props.value.image.url:null)}),d(p,f)};x(N,p=>{e.props.value==null?p(O):p(Q,!1)})}k(R),d(l,M)},$$slots:{default:!0}}),le()}export{Xe as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BRBLpKMP.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BRBLpKMP.js new file mode 100644 index 0000000000000000000000000000000000000000..59afe33d0fe0b6d51f3947c675fe7f500751aeb0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BRBLpKMP.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./embed-C0bvMD9o.js","./mollweide-XXUPULVr.js","./ordinal-BeghXfj9.js","./init-Dmth1JHB.js","./linear-8mDBZVC7.js","./step-B-Gbak1k.js","./defaultLocale-CzDG__Ur.js","./time-BMaLdJ6b.js","./dispatch-kxCwF96_.js","./range-OtVwhkKS.js","./index-BU4IRnz1.js","./colors-Cc3OSVma.js","./dsv-DB8NKgIY.js","./arc-Bt_eNeYl.js"])))=>i.map(i=>d[i]); +import{R as be,u as $,v as se,y as Q,x as h,w as t,aa as xe,z as ke,S as Z,a7 as we,t as ie,a as W,X as T,T as $e,a5 as x,af as Ee,W as H,a0 as pe,a8 as Ie,V as Fe,Y as Pe}from"./index-DWyDLubb.js";import{i as O,r as ze,g as Oe,d as Se}from"./i18n-Dnhn5Rxr.js";import{G as Ae}from"./utils.svelte-CCyS_0CY.js";import{B as We}from"./Block-J4oodUWp.js";import{B as Te}from"./BlockTitle-BMm9LakX.js";import{I as Me}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{E as Ve}from"./Empty-BIB2W5at.js";import{D as Ce}from"./Download-Di2PsS6O.js";import{L as Le}from"./LineChart-pr5WctpY.js";import{I as Ne}from"./IconButtonWrapper-D0s9l4wW.js";import{F as je}from"./FullscreenButton-sCrcy_OJ.js";import{S as De}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./clone-BkeCM4Nl.js";import"./Info-Dzjhnd64.js";import"./html-Ih_5QVTo.js";import"./snippet-BWgYNF9D.js";import"./Maximize-QH9NIRWs.js";import"./Clear-BF6j078A.js";import"./index-B_pwUImq.js";var Be=H(" ",1),He=H('

        '),Re=H('
        ',1),Ye=H(" ",1);function ft(ue,ee){be(ee,!0);let de=ze(ee,["$$slots","$$events","$$legacy"]);const e=new Ae(de);let te=x(()=>{if(!e.props.color||!e.props.value||e.props.value.datatypes[e.props.color]!=="nominal")return[];const r=e.props.value.columns.indexOf(e.props.color);return r===-1?[]:Array.from(new Set(e.props.value.data.map(o=>o[r])))}),S=x(()=>e.props.x_lim||null),M=x(()=>e.props.y_lim||null),V=x(()=>t(S)?.[0]!==null?t(S)?.[0]:void 0),C=x(()=>t(S)?.[1]!==null?t(S)?.[1]:void 0),re=x(()=>t(M)?.[0]!==null?t(M)?.[0]:void 0),oe=x(()=>t(M)?.[1]!==null?t(M)?.[1]:void 0),E=$(!1);function fe(r){if(r==="x")return"ascending";if(r==="-x")return"descending";if(r==="y")return{field:e.props.y,order:"ascending"};if(r==="-y")return{field:e.props.y,order:"descending"};if(r===null)return null;if(Array.isArray(r))return r}let ce=x(()=>fe(e.props.sort)),R=$(se([]));function A(r){return r.replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]")}let Y=x(()=>e.props.value&&e.props.value.datatypes[e.props.x]==="temporal"),L=x(()=>t(Y)?[t(V)!==void 0?t(V)*1e3:null,t(C)!==void 0?t(C)*1e3:null]:t(S)),G=$(!1);const _e={s:1,m:60,h:3600,d:1440*60};let I=x(()=>e.props.x_bin?typeof e.props.x_bin=="string"?1e3*parseInt(e.props.x_bin.substring(0,e.props.x_bin.length-1))*_e[e.props.x_bin[e.props.x_bin.length-1]]:e.props.x_bin:void 0),U=x(()=>{if(e.props.value)if(e.props.value.mark==="point"){const r=t(I)!==void 0;return e.props.y_aggregate||r?"sum":void 0}else return e.props.y_aggregate?e.props.y_aggregate:"sum"}),le=x(()=>e.props.value?e.props.value.mark==="point"?t(I)!==void 0:t(I)!==void 0||e.props.value.datatypes[e.props.x]==="nominal":!1);function ne(r,o,f,n,v,u){if(r.length<1e3||e.props.x_bin!==null||e.props.value?.mark!=="line"||e.props.value?.datatypes[e.props.x]==="nominal")return r;const c=250;let s={};if((v===void 0||u===void 0)&&r.forEach(l=>{let i=l[o];(v===void 0||iu)&&(u=i)}),v===void 0||u===void 0)return r;const d=(u-v)/c;r.forEach((l,i)=>{const g=l[o],m=l[f],p=n!==null?l[n]:"any",a=Math.floor((g-v)/d);s[p]===void 0&&(s[p]=[]),s[p][a]=s[p][a]||[null,Number.POSITIVE_INFINITY,null,Number.NEGATIVE_INFINITY],ms[p][a][3]&&(s[p][a][2]=i,s[p][a][3]=m)});const w=[];return Object.values(s).forEach(l=>{l.forEach(([i,g,m,p])=>{let a=[];i!==null&&m!==null?a=[Math.min(i,m),Math.max(i,m)]:i!==null?a=[i]:m!==null&&(a=[m]),a.forEach(F=>{w.push(r[F])})})}),w}function me(r,o,f){let n=r.columns.indexOf(e.props.x),v=r.columns.indexOf(e.props.y),u=e.props.color?r.columns.indexOf(e.props.color):null,c=r.data;if(o!==void 0&&f!==void 0){const s=r.datatypes[e.props.x]==="temporal"?1e3:1,_=o*s,d=f*s;let w={},l={};const i=c.filter((g,m)=>{const p=g[n],a=u!==null?g[u]:"any";return p<_&&(w[a]===void 0||p>w[a][1])&&(w[a]=[m,p]),p>d&&(l[a]===void 0||p=_&&p<=d});c=[...Object.values(w).map(([g,m])=>c[g]),...ne(i,n,v,u,_,d),...Object.values(l).map(([g,m])=>c[g])]}else c=ne(c,n,v,u,void 0,void 0);return e.props.tooltip=="all"||Array.isArray(e.props.tooltip)?c.map(s=>{const _={};return r.columns.forEach((d,w)=>{_[d]=s[w]}),_}):c.map(s=>{const _={[e.props.x]:s[n],[e.props.y]:s[v]};return e.props.color&&u!==null&&(_[e.props.color]=s[u]),_})}Q(()=>{h(R,e.props.value?me(e.props.value,t(V),t(C)):[],!0)});let ae=$(se(e.props.value));Q(()=>{t(ae)!==e.props.value&&t(y)&&(h(ae,e.props.value,!0),t(y).data("data",t(R)).runAsync())});const ve=typeof window<"u";let b=$(void 0),k=x(()=>t(b)?window.getComputedStyle(t(b)):null),y=$(void 0),N=$(!1),j=$(0),X=$(0),D=$(void 0),q;async function B(){if(t(G)){h(J,!0);return}if(t(y)&&t(y).finalize(),!e.props.value||!t(b))return;h(j,t(b).offsetWidth,!0),h(X,t(b).offsetHeight,!0);const r=ye();r&&(h(D,new ResizeObserver(o=>{if(!(!o[0].target||!(o[0].target instanceof HTMLElement)))if(t(j)===0&&t(b).offsetWidth!==0&&e.props.value.datatypes[e.props.x]==="nominal")B();else{const f=Math.abs(t(j)-o[0].target.offsetWidth),n=Math.abs(t(X)-o[0].target.offsetHeight);f>100||n>100?(h(j,o[0].target.offsetWidth,!0),h(X,o[0].target.offsetHeight,!0),B()):(t(y).signal("width",o[0].target.offsetWidth).run(),t(E)&&t(y).signal("height",o[0].target.offsetHeight).run())}}),!0),q||(q=(await Ee(async()=>{const{default:o}=await import("./embed-C0bvMD9o.js");return{default:o}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url)).default),q(t(b),r,{actions:!1}).then(function(o){h(y,o.view,!0),t(D).observe(t(b));var f,n=0;t(y).addEventListener("dblclick",()=>{e.dispatch("double_click")}),t(b).addEventListener("mousedown",function(v){v.detail>1&&v.preventDefault()},!1),e.props._selectable&&t(y).addSignalListener("brush",function(v,u){if(Date.now()-n<1e3||(h(G,!0),Object.keys(u).length===0))return;clearTimeout(f);let c=u[Object.keys(u)[0]];t(Y)&&(c=[c[0]/1e3,c[1]/1e3]),f=setTimeout(function(){h(G,!1),n=Date.now(),e.dispatch("select",{value:c,index:c,selected:!0}),t(J)&&(h(J,!1),B())},250)})}))}let J=$(!1);xe(()=>(h(N,!0),()=>{h(N,!1),t(y)&&t(y).finalize(),t(D)&&t(D).disconnect()}));function ge(){if(!t(y)||!t(k))return;const o=t(k).getPropertyValue("--block-background-fill")||"white";t(y).background(o).run(),t(y).toImageURL("png",2).then(function(f){t(y).background("transparent").run();const n=document.createElement("a");n.setAttribute("href",f),n.setAttribute("download","chart.png"),n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}).catch(function(f){console.error("Export failed:",f),t(y).background("transparent").run()})}let he=x(()=>JSON.stringify(e.props.color_map));Q(()=>{e.props.title,e.props.x_title,e.props.y_title,e.props.color_title,e.props.x,e.props.y,e.props.color,e.props.x_bin,t(U),t(he),e.props.colors_in_legend,t(V),t(C),t(re),t(oe),e.props.caption,e.props.sort,t(N),t(b),t(E),t(k),t(N)&&t(b)&&ke(()=>{B()})});function ye(){if(!e.props.value||!t(k))return null;let r=t(k).getPropertyValue("--color-accent"),o=t(k).getPropertyValue("--body-text-color"),f=t(k).getPropertyValue("--border-color-primary"),n=t(k).fontFamily,v=t(k).getPropertyValue("--block-title-text-weight");const u=_=>_.endsWith("px")?parseFloat(_.slice(0,-2)):12;let c=u(t(k).getPropertyValue("--text-md")),s=u(t(k).getPropertyValue("--text-sm"));return{$schema:"https://vega.github.io/schema/vega-lite/v5.17.0.json",background:"transparent",config:{autosize:{type:"fit",contains:"padding"},axis:{labelFont:n,labelColor:o,titleFont:n,titleColor:o,titlePadding:8,tickColor:f,labelFontSize:s,gridColor:f,titleFontWeight:"normal",titleFontSize:s,labelFontWeight:"normal",domain:!1,labelAngle:0,titleLimit:t(b).offsetHeight*.8},legend:{labelColor:o,labelFont:n,titleColor:o,titleFont:n,titleFontWeight:"normal",titleFontSize:s,labelFontWeight:"normal",offset:2},title:{color:o,font:n,fontSize:c,fontWeight:v,anchor:"middle"},view:{stroke:f},mark:{stroke:e.props.value.mark!=="bar"?r:void 0,fill:e.props.value.mark==="bar"?r:void 0,cursor:"crosshair"}},data:{name:"data"},datasets:{data:t(R)},layer:["plot",...e.props.value.mark==="line"?["hover"]:[]].map(_=>({encoding:{size:e.props.value.mark==="line"?_=="plot"?{condition:{empty:!1,param:"hoverPlot",value:3},value:2}:{condition:{empty:!1,param:"hover",value:100},value:0}:void 0,opacity:_==="plot"?void 0:{condition:{empty:!1,param:"hover",value:1},value:0},x:{axis:{...e.props.x_label_angle!==null&&{labelAngle:e.props.x_label_angle},labels:e.props.x_axis_labels_visible,ticks:e.props.x_axis_labels_visible,...e.props.x_axis_format!==null&&{format:e.props.x_axis_format}},field:A(e.props.x),title:e.props.x_title||e.props.x,type:e.props.value.datatypes[e.props.x],scale:{zero:!1,domainMin:t(L)?.[0]!==null?t(L)?.[0]:void 0,domainMax:t(L)?.[1]!==null?t(L)?.[1]:void 0},bin:t(I)?{step:t(I)}:void 0,sort:t(ce)},y:{axis:{...e.props.y_label_angle&&{labelAngle:e.props.y_label_angle},...e.props.y_axis_format!==null&&{format:e.props.y_axis_format}},field:A(e.props.y),title:e.props.y_title||e.props.y,type:e.props.value.datatypes[e.props.y],scale:{zero:!1,domainMin:t(re)??void 0,domainMax:t(oe)??void 0},aggregate:t(le)?t(U):void 0},color:e.props.color?{field:A(e.props.color),legend:{orient:"bottom",title:e.props.color_title,values:e.props.colors_in_legend?.length?[...e.props.colors_in_legend]:void 0},scale:e.props.value.datatypes[e.props.color]==="nominal"?{domain:t(te),range:e.props.color_map?t(te).map(d=>e.props.color_map[d]):void 0}:{range:[100,200,300,400,500,600,700,800,900].map(d=>t(k).getPropertyValue("--primary-"+d)),interpolate:"hsl"},type:e.props.value.datatypes[e.props.color]}:void 0,tooltip:e.props.tooltip=="none"?void 0:[{field:A(e.props.y),type:e.props.value.datatypes[e.props.y],aggregate:t(le)?t(U):void 0,title:e.props.y_title||e.props.y},{field:A(e.props.x),type:e.props.value.datatypes[e.props.x],title:e.props.x_title||e.props.x,format:t(Y)?"%Y-%m-%d %H:%M:%S":void 0,bin:t(I)?{step:t(I)}:void 0},...e.props.color?[{field:e.props.color,type:e.props.value.datatypes[e.props.color]}]:[],...e.props.tooltip==="axis"?[]:e.props.value?.columns.filter(d=>d!==e.props.x&&d!==e.props.y&&d!==e.props.color&&(e.props.tooltip==="all"||e.props.tooltip.includes(d))).map(d=>({field:d,type:e.props.value.datatypes[d]}))]},strokeDash:{},mark:{clip:!0,type:_==="hover"?"point":e.props.value.mark},name:_})),params:[...e.props.value.mark==="line"?[{name:"hoverPlot",select:{clear:"mouseout",fields:e.props.color?[e.props.color]:[],nearest:!0,on:"mouseover",type:"point"},views:["hover"]},{name:"hover",select:{clear:"mouseout",nearest:!0,on:"mouseover",type:"point"},views:["hover"]}]:[],...e.props._selectable?[{name:"brush",select:{encodings:["x"],mark:{fill:"gray",fillOpacity:.3,stroke:"none"},type:"interval"},views:["plot"]}]:[]],width:t(b).offsetWidth,height:e.props.height||t(E)?"container":void 0,title:e.props.title||void 0}}We(ue,{get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},allow_overflow:!1,padding:!0,get height(){return e.props.height},get fullscreen(){return t(E)},set fullscreen(r){h(E,r,!0)},children:(r,o)=>{var f=Ye(),n=Z(f);{var v=l=>{De(l,Oe({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}))};O(n,l=>{e.shared.loading_status&&l(v)})}var u=T(n,2);{var c=l=>{Ne(l,{get buttons(){return e.props.buttons},on_custom_button_click:i=>{e.dispatch("custom_button_click",{id:i})},children:(i,g)=>{var m=Be(),p=Z(m);{var a=P=>{Me(P,{get Icon(){return Ce},label:"Export",onclick:ge})};O(p,P=>{e.props.buttons?.some(z=>typeof z=="string"&&z==="export")&&P(a)})}var F=T(p,2);{var K=P=>{je(P,{get fullscreen(){return t(E)},$$events:{fullscreen:({detail:z})=>{h(E,z,!0)}}})};O(F,P=>{e.props.buttons?.some(z=>typeof z=="string"&&z==="fullscreen")&&P(K)})}W(i,m)},$$slots:{default:!0}})};O(u,l=>{e.props.buttons?.length&&l(c)})}var s=T(u,2);Te(s,{get show_label(){return e.shared.show_label},info:void 0,children:(l,i)=>{Ie();var g=we();ie(()=>pe(g,e.shared.label)),W(l,g)},$$slots:{default:!0}});var _=T(s,2);{var d=l=>{var i=Re(),g=Z(i);Se(g,a=>h(b,a),()=>t(b));var m=T(g,2);{var p=a=>{var F=He(),K=Fe(F,!0);Pe(F),ie(()=>pe(K,e.props.caption)),W(a,F)};O(m,a=>{e.props.caption&&a(p)})}W(l,i)},w=l=>{Ve(l,{unpadded_box:!0,children:(i,g)=>{Le(i)},$$slots:{default:!0}})};O(_,l=>{e.props.value&&ve?l(d):l(w,!1)})}W(r,f)},$$slots:{default:!0}}),$e()}export{ft as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BV5kouZe.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BV5kouZe.css new file mode 100644 index 0000000000000000000000000000000000000000..cd08155410cc7d750ea69a8c683615af4a347968 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BV5kouZe.css @@ -0,0 +1 @@ +.wrap.svelte-yb2gcx{display:flex;flex-wrap:wrap;gap:var(--checkbox-label-gap)}label.svelte-yb2gcx{display:flex;align-items:center;transition:var(--button-transition);cursor:pointer;box-shadow:var(--checkbox-label-shadow);border:var(--checkbox-label-border-width) solid var(--checkbox-label-border-color);border-radius:var(--checkbox-border-radius);background:var(--checkbox-label-background-fill);padding:var(--checkbox-label-padding);color:var(--checkbox-label-text-color);font-weight:var(--checkbox-label-text-weight);font-size:var(--checkbox-label-text-size);line-height:var(--line-md)}label.svelte-yb2gcx:hover{background:var(--checkbox-label-background-fill-hover);transform:var(--button-transform-hover);box-shadow:var( --checkbox-label-shadow-hover, var(--checkbox-label-shadow) )}label.svelte-yb2gcx:active{transform:var(--button-transform-active);box-shadow:var( --checkbox-label-shadow-active, var(--checkbox-label-shadow) )}label.svelte-yb2gcx:focus{background:var(--checkbox-label-background-fill-focus)}label.selected.svelte-yb2gcx{background:var(--checkbox-label-background-fill-selected);color:var(--checkbox-label-text-color-selected);border-color:var(--checkbox-label-border-color-selected)}label.svelte-yb2gcx>:where(.svelte-yb2gcx)+:where(.svelte-yb2gcx){margin-left:var(--size-2)}input.svelte-yb2gcx{--ring-color: transparent;position:relative;box-shadow:var(--checkbox-shadow);border:var(--checkbox-border-width) solid var(--checkbox-border-color);border-radius:var(--checkbox-border-radius);background-color:var(--checkbox-background-color);line-height:var(--line-sm)}input.svelte-yb2gcx:checked,input.svelte-yb2gcx:checked:hover,input.svelte-yb2gcx:checked:focus{border-color:var(--checkbox-border-color-selected);background-image:var(--checkbox-check);background-color:var(--checkbox-background-color-selected)}input.svelte-yb2gcx:checked:focus{border-color:var(--checkbox-border-color-focus);background-image:var(--checkbox-check);background-color:var(--checkbox-background-color-selected)}input.svelte-yb2gcx:hover{border-color:var(--checkbox-border-color-hover);background-color:var(--checkbox-background-color-hover)}input.svelte-yb2gcx:not(:checked):focus{border-color:var(--checkbox-border-color-focus)}input[disabled].svelte-yb2gcx,.disabled.svelte-yb2gcx{cursor:not-allowed!important}input[disabled].svelte-yb2gcx{opacity:.75}input.svelte-yb2gcx:hover{cursor:pointer}.select-all-container.svelte-yb2gcx{display:flex;align-items:center;gap:var(--size-2)}.select-all-label.svelte-yb2gcx{display:flex;align-items:center;cursor:pointer;margin:0;padding:0;background:none;border:none;box-shadow:none}.select-all-checkbox.svelte-yb2gcx{--ring-color: transparent;position:relative;box-shadow:var(--checkbox-shadow);border:var(--checkbox-border-width) solid var(--checkbox-border-color);border-radius:var(--checkbox-border-radius);background-color:var(--checkbox-background-color);line-height:var(--line-sm);margin:0}.select-all-checkbox.svelte-yb2gcx:checked,.select-all-checkbox.svelte-yb2gcx:checked:hover,.select-all-checkbox.svelte-yb2gcx:checked:focus{border-color:var(--checkbox-border-color-selected);background-image:var(--checkbox-check);background-color:var(--checkbox-background-color-selected)}.select-all-checkbox.svelte-yb2gcx:indeterminate,.select-all-checkbox.svelte-yb2gcx:indeterminate:hover{border-color:var(--checkbox-border-color-selected);background-color:var(--checkbox-background-color-selected);position:relative}.select-all-checkbox.svelte-yb2gcx:indeterminate:after{content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:60%;height:2px;background-color:#fff}.select-all-checkbox.svelte-yb2gcx:not(:indeterminate):not(:checked):hover{border-color:var(--checkbox-border-color-hover);background-color:var(--checkbox-background-color-hover);cursor:pointer}.label-text.svelte-yb2gcx{margin:0;cursor:pointer;background:none;border:none;padding:0;font:inherit;color:inherit;text-align:left} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BVh8ZMox.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BVh8ZMox.js new file mode 100644 index 0000000000000000000000000000000000000000..ef2172acdb4e728a0a9e0a4c9c5430cb6f4f9e83 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BVh8ZMox.js @@ -0,0 +1 @@ +import{g as w,d as k,r as x,b as $}from"./i18n-Dnhn5Rxr.js";import{R as y,y as u,M as h,S,w as m,t as B,a as M,X as _,V as E,a5 as z,T as G,u as L,x as F,W as I,Y as P}from"./index-DWyDLubb.js";import{G as R,s as T}from"./utils.svelte-CCyS_0CY.js";import{M as V}from"./Index.svelte_svelte_type_style_lang-D9os8tfr.js";import{S as W}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{B as X}from"./Block-J4oodUWp.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{S as Y}from"./ScrollFade-CIgHp1zY.js";import{default as me}from"./Example-Csc6CXXA.js";import"./clone-BkeCM4Nl.js";import"./actions-CLThs9VH.js";import"./Check-DUAHzS2-.js";import"./Copy-ChCbTvli.js";import"./IconButtonWrapper-D0s9l4wW.js";import"./snippet-BWgYNF9D.js";import"./MarkdownCode-B8HQ3LiU.js";import"./html-Ih_5QVTo.js";import"./prism-python-B4lzO_Nz.js";import"./index-B_pwUImq.js";import"./Clear-BF6j078A.js";/* empty css */var j=I('
        ',1);function de(g,i){y(i,!0);let c=x(i,["$$slots","$$events","$$legacy"]);const e=new R(c);let s,n=L(!1);function a(){e.props.height&&F(n,T(s?.closest(".block")),!0)}u(()=>{const t=s?.closest(".block");if(!(!t||!e.props.height))return t.addEventListener("scroll",a),h().then(a),()=>t.removeEventListener("scroll",a)}),u(()=>{e.props.value!==void 0&&h().then(a)}),X(g,{get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},allow_overflow:!0,overflow_behavior:"auto",get height(){return e.props.height},get min_height(){return e.props.min_height},get max_height(){return e.props.max_height},get rtl(){return e.props.rtl},children:(t,q)=>{var l=j(),p=S(l);W(p,w({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{variant:"center",on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var r=_(p,2);let d;var f=E(r);{let o=z(()=>e.props.buttons?.includes("copy"));V(f,{get value(){return e.props.value},get elem_classes(){return e.shared.elem_classes},get visible(){return e.shared.visible},get rtl(){return e.props.rtl},onchange:()=>e.dispatch("change"),oncopy:b=>e.dispatch("copy",b.detail),get latex_delimiters(){return e.props.latex_delimiters},get sanitize_html(){return e.props.sanitize_html},get line_breaks(){return e.props.line_breaks},get header_links(){return e.props.header_links},get show_copy_button(){return m(o)},get loading_status(){return e.shared.loading_status},get theme_mode(){return e.shared.theme_mode}})}P(r),k(r,o=>s=o,()=>s);var v=_(r,2);Y(v,{get visible(){return m(n)}}),B(()=>d=$(r,1,"svelte-16ln60g",null,d,{padding:e.shared.padding,pending:e.shared.loading_status?.status==="pending"&&e.shared.loading_status?.show_progress!=="hidden"})),M(t,l)},$$slots:{default:!0}}),G()}export{me as BaseExample,V as BaseMarkdown,de as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BZR-ZeTY.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BZR-ZeTY.css new file mode 100644 index 0000000000000000000000000000000000000000..5dfa5a5f35aa25463b95af6c5fba271216a3a28a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BZR-ZeTY.css @@ -0,0 +1 @@ +:where(._jsonList.svelte-zxj9ye){list-style:none;margin:0;padding:0;padding-left:var(--jsonPaddingLeft, 1rem);border-left:var(--jsonBorderLeft, 1px dotted)}:where(._jsonBkt.svelte-zxj9ye){color:var(--jsonBracketColor, currentcolor)}.svelte-zxj9ye:where(._jsonBkt:where(.svelte-zxj9ye)):not(.empty):hover{cursor:pointer;background:var(--jsonBracketHoverBackground, #e5e7eb)}:where(._jsonSep.svelte-zxj9ye){color:var(--jsonSeparatorColor, currentcolor)}:where(._jsonKey.svelte-zxj9ye){color:var(--jsonKeyColor, currentcolor)}:where(._jsonVal.svelte-zxj9ye){color:var(--jsonValColor, #9ca3af)}:where(._jsonVal:where(.svelte-zxj9ye)).string.svelte-zxj9ye{color:var(--jsonValStringColor, #059669)}:where(._jsonVal:where(.svelte-zxj9ye)).number.svelte-zxj9ye{color:var(--jsonValNumberColor, #d97706)}:where(._jsonVal:where(.svelte-zxj9ye)).boolean.svelte-zxj9ye{color:var(--jsonValBooleanColor, #2563eb)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BceQtuka.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BceQtuka.js new file mode 100644 index 0000000000000000000000000000000000000000..6f18b062f4a331846174db9f2872ff8137d5357a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BceQtuka.js @@ -0,0 +1 @@ +import{p as S,i as ce,f as D,d as de,t as $e,k as De,b as Ge,u as Pe,g as Le,r as Ye}from"./i18n-Dnhn5Rxr.js";import{R as he,aa as Ve,y as pe,Z as V,S as fe,a7 as je,t as j,a as G,x as P,w as d,T as be,u as F,M as qe,aw as _e,X as f,W as z,aj as ze,a0 as ve,a8 as Ie,V as p,Y as m,a5 as q,at as We,v as Ze}from"./index-DWyDLubb.js";import{G as Ae}from"./utils.svelte-CCyS_0CY.js";import{a as Fe}from"./actions-CLThs9VH.js";import{b as Je}from"./input-DrerMDOL.js";import{t as E,E as Ke}from"./tinycolor-BQBUvzv5.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as Ne}from"./BlockTitle-BMm9LakX.js";import{B as Oe}from"./Block-J4oodUWp.js";import{S as Qe}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{default as Rt}from"./Example-B0koE8za.js";import"./clone-BkeCM4Nl.js";import"./snippet-BWgYNF9D.js";import"./Info-Dzjhnd64.js";import"./html-Ih_5QVTo.js";import"./Clear-BF6j078A.js";import"./index-B_pwUImq.js";function Ue(n,r){const s=e=>{n&&!n.contains(e.target)&&!e.defaultPrevented&&r(e)};return document.addEventListener("mousedown",s,!0),{destroy(){document.removeEventListener("mousedown",s,!0)}}}function me(n){const r=n.s,s=n.v;let e=r*s;const b=n.h/60;let u=e*(1-Math.abs(b%2-1));const c=s-e;e=e+c,u=u+c;const g=Math.floor(b)%6,_=[e,u,c,c,u,e][g],h=[u,e,e,u,c,c][g],w=[c,c,u,e,e,u][g];return E({r:_*255,g:h*255,b:w*255,a:n.a}).toHexString()}function et(n){const r=E(n);return r.isValid()?r.toHexString():n}function tt(n,r){return r==="hex"?E(n).toHexString():r==="rgb"?E(n).toRgbString():E(n).toHslString()}var rt=z(""),at=z('
        '),nt=z(' ',1);function st(n,r){he(r,!0);let s=S(r,"value",15),e=S(r,"on_input",3,()=>{}),b=S(r,"on_release",3,()=>{}),u=S(r,"on_submit",3,()=>{}),c=S(r,"on_blur",3,()=>{}),g=S(r,"on_focus",3,()=>{}),_=F(!1),h=F("hex"),w=!1,x,y,L=[0,0],i=null,H=!1,Y=[0,0],R=0,I=0,v=null,C=!1;function ge(t){v=t.currentTarget.getBoundingClientRect(),C=!0,J(t.clientX)}function J(t){if(!v)return;const a=Math.max(0,Math.min(t-v.left,v.width));I=a;const o=a/v.width*360;R=o,s(me({h:o,s:Y[0],v:Y[1],a:1})),e()()}function K(t,a){if(!i)return;const o=Math.max(0,Math.min(t-i.left,i.width)),B=Math.max(0,Math.min(a-i.top,i.height));L=[o,B];const M={h:R*1,s:o/i.width,v:1-B/i.height,a:1};Y=[M.s,M.v],s(me(M)),e()()}function we(t){H=!0,i=t.currentTarget.getBoundingClientRect(),K(t.clientX,t.clientY)}function xe(t){H&&K(t.clientX,t.clientY),C&&J(t.clientX)}function ye(){const t=H||C;H=!1,C=!1,t&&b()()}async function N(t){if(H||C||(await qe(),!t)||(!i&&x&&(i=x.getBoundingClientRect()),!v&&y&&(v=y.getBoundingClientRect()),!i||!v))return;const a=E(t).toHsv(),o=a.s*i.width,B=(1-a.v)*i.height;L=[o,B],Y=[a.s,a.v],R=a.h,I=a.h/360*v.width}function ke(){new EyeDropper().open().then(a=>{s(a.sRGBHex)}),e()()}const Be=[["Hex","hex"],["RGB","rgb"],["HSL","hsl"]];let O=q(()=>tt(s(),d(h)));Ve(async()=>{w=window!==void 0&&!!window.EyeDropper});function Me(){P(_,!1)}pe(()=>{N(s())});var Q=nt();V("mousemove",_e,xe),V("mouseup",_e,ye);var U=fe(Q);Ne(U,{get show_label(){return r.show_label},get info(){return r.info},children:(t,a)=>{Ie();var o=je();j(()=>ve(o,r.label)),G(t,o)},$$slots:{default:!0}});var k=f(U,2);k.__click=()=>{N(s()),P(_,!d(_))};let ee;var Se=f(k,2);{var Ee=t=>{var a=at(),o=p(a);o.__mousedown=we;var B=p(o);let M;m(o),de(o,l=>x=l,()=>x);var X=f(o,2);X.__mousedown=ge;var He=p(X);let te;m(X),de(X,l=>y=l,()=>y);var re=f(X,2),ae=p(re);let ne;var se=f(ae,2),W=p(se),T=p(W);$e(T),T.__change=l=>{s(et(l.currentTarget.value))},T.__keydown=l=>{l.key==="Enter"&&u()()};var Z=f(T,2);Z.__click=ke;var Re=p(Z);{var Ce=l=>{Ke(l)};ce(Re,l=>{w&&l(Ce)})}m(Z),m(W);var oe=f(W,2);De(oe,21,()=>Be,Pe,(l,A,lt,it)=>{var le=q(()=>We(d(A),2));let Xe=()=>d(le)[0],ie=()=>d(le)[1];var $=rt();let ue;$.__click=()=>{P(h,ie(),!0)};var Te=p($,!0);m($),j(()=>{ue=Ge($,1,"button svelte-nbn1m9",null,ue,{active:d(h)===ie()}),ve(Te,Xe())}),G(l,$)}),m(oe),m(se),m(re),m(a),Fe(a,(l,A)=>Ue?.(l,A),()=>Me),j(()=>{D(o,`--hue:${R??""}`),M=D(B,"",M,{transform:`translate(${L[0]??""}px,${L[1]??""}px)`,background:s()}),te=D(He,"",te,{background:"hsl("+R+", 100%, 50%)",transform:`translateX(${I??""}px)`}),ne=D(ae,"",ne,{background:s()})}),Je(T,()=>d(O),l=>P(O,l)),G(t,a)};ce(Se,t=>{d(_)&&t(Ee)})}j(()=>{k.disabled=r.disabled,ee=D(k,"",ee,{background:s()})}),V("focus",k,function(...t){g()?.apply(this,t)}),V("blur",k,function(...t){c()?.apply(this,t)}),G(n,Q),be()}ze(["click","mousedown","change","keydown"]);var ot=z(" ",1);function St(n,r){he(r,!0);let s=Ye(r,["$$slots","$$events","$$legacy"]);const e=new Ae(s,{value:"#000000"});let b=F(Ze(e.props.value)),u=q(()=>e.shared.label||e.i18n("color_picker.color_picker"));pe(()=>{d(b)!==e.props.value&&(P(b,e.props.value,!0),e.dispatch("change"))}),Oe(n,{get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},children:(c,g)=>{var _=ot(),h=fe(_);Qe(h,Le({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var w=f(h,2);{let x=q(()=>!e.shared.interactive);st(w,{get label(){return d(u)},get info(){return e.props.info},get show_label(){return e.shared.show_label},get disabled(){return d(x)},on_input:()=>e.dispatch("input"),on_release:()=>e.dispatch("release",e.props.value),on_submit:()=>e.dispatch("submit"),on_blur:()=>e.dispatch("blur"),on_focus:()=>e.dispatch("focus"),get value(){return e.props.value},set value(y){e.props.value=y}})}G(c,_)},$$slots:{default:!0}}),be()}export{st as BaseColorPicker,Rt as BaseExample,St as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BcflHCFb.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BcflHCFb.js new file mode 100644 index 0000000000000000000000000000000000000000..f7e6037d56f1251eccba0f8fc2e17e28226d2f7c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BcflHCFb.js @@ -0,0 +1 @@ +import{p as a,s as c}from"./i18n-Dnhn5Rxr.js";import{R as d,a6 as _,S as f,a as p,T as v,U as i}from"./index-DWyDLubb.js";import{B as g}from"./Block-J4oodUWp.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./snippet-BWgYNF9D.js";function y(n,s){d(s,!1);let t=a(s,"elem_id",12),l=a(s,"elem_classes",12),r=a(s,"visible",12,!0);var o={get elem_id(){return t()},set elem_id(e){t(e),i()},get elem_classes(){return l()},set elem_classes(e){l(e),i()},get visible(){return r()},set visible(e){r(e),i()}};return g(n,{get elem_id(){return t()},get elem_classes(){return l()},get visible(){return r()},explicit_call:!0,children:(e,b)=>{var m=_(),u=f(m);c(u,s,"default",{}),p(e,m)},$$slots:{default:!0}}),v(o)}export{y as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Bfu-ph5m.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Bfu-ph5m.js new file mode 100644 index 0000000000000000000000000000000000000000..08d1fa5421b0de7b70f56c6be7d2aa1a1373d42b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Bfu-ph5m.js @@ -0,0 +1 @@ +import{f as _,s as b,a as p,b as v,r as f}from"./i18n-Dnhn5Rxr.js";import{R as g,t as x,a as w,T as y,V as d,W as $,Y as i}from"./index-DWyDLubb.js";import{G as q}from"./utils.svelte-CCyS_0CY.js";import"./clone-BkeCM4Nl.js";var j=$('
        ');function T(h,t){g(t,!0);const m=f(t,["$$slots","$$events","$$legacy"]),s=new q(m);var e=j();let l;var a=d(e);let o;var r=d(a);_(r,"",{},{"--block-radius":"0px","--block-border-width":"0px","--layout-gap":"1px","--form-gap-width":"1px","--button-border-width":"0px","--button-large-radius":"0px","--button-small-radius":"0px"});var n=d(r);b(n,t,"default",{}),i(r),i(a),i(e),x((u,c)=>{p(e,"id",s.shared.elem_id),l=v(e,1,`gr-group ${u??""}`,"svelte-1p9262q",l,{hide:s.shared.visible==="hidden"}),p(a,"id",s.shared.elem_id),o=v(a,1,`gr-group ${c??""}`,"svelte-1p9262q",o,{hide:s.shared.visible==="hidden"})},[()=>s.shared.elem_classes?.join(" ")||"",()=>s.shared.elem_classes?.join(" ")||""]),w(h,e),y()}export{T as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BiPluRv8.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BiPluRv8.css new file mode 100644 index 0000000000000000000000000000000000000000..79c3ab51d9aadc41f2da7ad50ce09fa55b3a4cee --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BiPluRv8.css @@ -0,0 +1 @@ +button.svelte-1lrnmgy{display:flex;justify-content:center;align-items:center;gap:1px;z-index:var(--layer-2);color:var(--block-label-text-color);border:1px solid transparent}.quite-round.svelte-1lrnmgy{border-radius:var(--radius-sm)}.very-round.svelte-1lrnmgy{border-radius:var(--radius-md)}button[disabled].svelte-1lrnmgy{opacity:.5;box-shadow:none}button[disabled].svelte-1lrnmgy:hover{cursor:not-allowed}.padded.svelte-1lrnmgy{padding:2px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color)}button.svelte-1lrnmgy:hover,button.highlight.svelte-1lrnmgy{cursor:pointer;color:var(--color-accent)}.padded.svelte-1lrnmgy:hover{border:2px solid var(--button-secondary-border-color-hover);padding:1px;color:var(--block-label-text-color)}span.svelte-1lrnmgy{padding:0 1px;font-size:10px}div.svelte-1lrnmgy{padding:2px;display:flex;align-items:flex-end}.small.svelte-1lrnmgy{width:14px;height:14px}.medium.svelte-1lrnmgy{width:20px;height:20px}.large.svelte-1lrnmgy{width:22px;height:22px}.pending.svelte-1lrnmgy{animation:svelte-1lrnmgy-flash .5s infinite}@keyframes svelte-1lrnmgy-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-1lrnmgy{background:transparent;border:none;box-shadow:none}.hue-slider.svelte-qx84u5{position:relative;width:90%;margin:0 auto 10px;height:12px;border-radius:2px;border:1px solid var(--block-border-color);background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red);border-top:none}.opacity-slider.svelte-qx84u5{position:relative;width:90%;margin:10px auto 5px;height:12px;border-radius:2px;border:1px solid var(--block-border-color);background:linear-gradient(to right,transparent,var(--color)),repeating-conic-gradient(#808080 0% 25%,transparent 0% 50%) 0 0 / 10px 10px}.opacity-marker.svelte-qx84u5{position:absolute;width:16px;height:16px;border-radius:50%}.opacity-slider.svelte-qx84u5>.opacity-marker:where(.svelte-qx84u5){box-shadow:0 0 1px #888;top:-4px;height:18px;width:18px;left:-9px;margin:auto;border:1px solid var(--block-border-color)}.color-gradient.svelte-qx84u5{position:relative;--hue: white;background:linear-gradient(#0000,#000),linear-gradient(90deg,#fff,hsl(var(--hue),100%,50%));width:100%;height:150px;border-top-left-radius:4px;border-top-right-radius:4px}.marker.svelte-qx84u5{position:absolute;width:14px;height:14px;border-radius:50%;border:2px solid white;top:-7px;left:-7px;box-shadow:0 1px 5px #0000001a;pointer-events:none;border:1px solid var(--block-border-color)}.hue-slider.svelte-qx84u5>.marker:where(.svelte-qx84u5){box-shadow:0 0 1px #888;top:-3px;margin:auto;height:18px;width:18px;left:-9px;border:1px solid var(--block-border-color)}.swatch-wrap.svelte-q8yof7{display:flex;justify-content:space-between;align-items:flex-start;width:205px}span.lg.svelte-q8yof7{margin-top:var(--spacing-sm)}.swatch-container.svelte-q8yof7{display:flex;flex-direction:column;gap:10px;width:100%}.swatch.svelte-q8yof7{display:grid;grid-template-columns:repeat(auto-fill,25px);gap:8px;justify-content:flex-start;overflow:hidden;justify-content:center}.empty.svelte-q8yof7{border:1px solid var(--block-border-color);font-weight:var(--weight-bold);display:flex;justify-content:center;align-items:center;padding-top:4px;text-align:center;font-size:var(--scale-0);cursor:pointer}.empty.svelte-q8yof7:after{content:"+";margin-bottom:var(--size-1)}.color.svelte-q8yof7{width:25px;height:25px;border-radius:var(--radius-md)}.empty.selected.svelte-q8yof7,.color.selected.svelte-q8yof7{border:2px solid var(--color-accent)}.colorpicker.svelte-q8yof7{border:1px solid var(--block-border-color);background:conic-gradient(red,#ff0 60deg,#0f0,#0ff,#00f,#f0f,red 360deg);overflow:hidden;position:relative;color:#fff;cursor:pointer}.colorpicker.svelte-q8yof7:before{content:"";position:absolute;width:100%;height:100%;background:#0009;opacity:1;transition:.1s;top:0;left:0}.colorpicker.svelte-q8yof7:after{display:flex;justify-content:center;align-items:center;content:"⨯";color:#fff;font-size:var(--scale-5);position:absolute;width:100%;height:100%;transform:translateY(-7px);opacity:1;transition:.1s;top:0}.colorpicker.hidden.svelte-q8yof7:after,.colorpicker.hidden.svelte-q8yof7:before{opacity:0}.input.svelte-yn52fn{display:flex;align-items:center;padding:0 10px 15px}.input.svelte-yn52fn input:where(.svelte-yn52fn){height:30px;width:100%;flex-shrink:1;border-bottom-left-radius:0;border:1px solid var(--block-border-color);letter-spacing:-.05rem;border-left:none;border-right:none;font-family:var(--font-mono);font-size:var(--scale-000);padding-left:15px;padding-right:0;background-color:var(--background-fill-secondary);color:var(--block-label-text-color)}.swatch.svelte-yn52fn{width:50px;height:50px;border-top-left-radius:15px;border-bottom-left-radius:15px;flex-shrink:0;border:1px solid var(--block-border-color)}.buttons.svelte-yn52fn button:where(.svelte-yn52fn){display:flex;align-items:center;justify-content:center;border:1px solid var(--block-border-color);background:var(--background-fill-secondary);padding:3px 6px;font-size:var(--scale-000);cursor:pointer;border-right:none;width:100%;border-top:none}.buttons.svelte-yn52fn button:where(.svelte-yn52fn):first-child{border-left:none}.buttons.svelte-yn52fn button:where(.svelte-yn52fn):last-child{border-bottom-right-radius:15px;border-right:1px solid var(--block-border-color)}.buttons.svelte-yn52fn button:where(.svelte-yn52fn):hover{background:var(--background-fill-secondary-hover);font-weight:var(--weight-bold)}.buttons.svelte-yn52fn button.active:where(.svelte-yn52fn){background:var(--background-fill-secondary);font-weight:var(--weight-bold)}.buttons.svelte-yn52fn{height:20px;display:flex;justify-content:stretch;gap:0px}.input-wrap.svelte-yn52fn{display:flex}.eyedropper.svelte-yn52fn{display:flex;align-items:center;justify-content:center;width:25px;border-top-right-radius:15px;border:1px solid var(--block-border-color);border-left:none;background:var(--background-fill-secondary);height:30px;padding:7px 7px 5px 0;cursor:pointer}.wrap.svelte-1y25b79{width:230px;display:flex;gap:var(--size-4);background:var(--background-fill-secondary);padding:0 var(--size-4);cursor:default;padding-top:var(--size-2-5)}input.svelte-1y25b79{width:100%}span.svelte-1y25b79{width:26px;color:var(--body-text-color)}.wrap.svelte-1l3f0ck{max-width:230px;position:absolute;display:flex;flex-direction:column;gap:5px;background:var(--background-fill-secondary);border:1px solid var(--block-border-color);border-radius:var(--radius-md);box-shadow:0 0 5px #0000001a;padding-bottom:var(--size-2);pointer-events:all;cursor:default;z-index:var(--layer-top);overflow:hidden;top:0;transform:translate(35px,-12px)}.color_picker.svelte-1l3f0ck{transform:translate(35px,-50%)}.size_picker.svelte-1l3f0ck{transform:translate(35px,18px)}.eraser_picker.svelte-1l3f0ck{transform:translate(35px,-7px)}.toolbar-wrap.svelte-1uf24la{display:inline-flex;flex-direction:column;justify-content:center;align-items:center;position:absolute;left:15px;right:0;top:30%;width:30px;border:1px solid var(--block-border-color);border-radius:var(--radius-md);gap:var(--spacing-sm);z-index:1000;background-color:var(--block-background-fill)}.half-container.svelte-1uf24la{flex:1;display:flex;flex-direction:column;gap:var(--spacing-sm);position:relative}.half-container.svelte-1uf24la{width:100%;padding:var(--spacing-sm) 0}.half-container.svelte-1uf24la:last-child{border-top:1px solid var(--block-border-color)}.hide.svelte-1uf24la{display:none}.add-layer.svelte-189k4ah{display:flex;justify-content:center;align-items:center;margin:var(--spacing-sm) 0 0 0}.add-layer.svelte-189k4ah button{width:100%}.icon.svelte-189k4ah{width:14px;color:var(--body-text-color);transition:color .15s ease}.layer-wrap.svelte-189k4ah{display:flex;justify-content:center;align-items:center;width:100%;flex-direction:column}.layer-wrap.svelte-189k4ah button:where(.svelte-189k4ah){justify-content:space-between;align-items:center;width:100%;display:flex;font-size:var(--text-sm);line-height:var(--line-sm);transition:all .15s ease;padding:var(--spacing-md) var(--spacing-lg);border-radius:var(--radius-sm)}button.layer-title-button.svelte-189k4ah{width:100%}.layer-wrap.svelte-189k4ah button:where(.svelte-189k4ah):hover .icon:where(.svelte-189k4ah){color:var(--color-accent)}.selected_layer.svelte-189k4ah{color:var(--color-accent);font-weight:var(--weight-semibold)}ul.svelte-189k4ah{bottom:0;right:0;width:100%;list-style:none;z-index:var(--layer-top);padding:var(--spacing-sm);border-top:1px solid var(--border-color-primary)}li.svelte-189k4ah{display:flex;justify-content:space-between;align-items:center;transition:background-color .15s ease;border-bottom:1px solid var(--border-color-primary)}.layer-wrap.svelte-189k4ah ul:where(.svelte-189k4ah)>li:where(.svelte-189k4ah)>button:where(.svelte-189k4ah){padding-left:calc(var(--spacing-md))}li.svelte-189k4ah:hover{background-color:var(--background-fill-secondary)}li.svelte-189k4ah:last-child{border-bottom:none}li.svelte-189k4ah:last-child:hover{background-color:unset}li.svelte-189k4ah div:where(.svelte-189k4ah){display:flex;gap:var(--spacing-sm);padding:var(--spacing-sm)}li.svelte-189k4ah>button:where(.svelte-189k4ah){padding:var(--spacing-sm) var(--spacing-md)}.toolbar-wrap-wrap.svelte-1357rcu{position:absolute;right:0;bottom:0;width:fit-content;max-height:100%;overflow-y:auto;display:flex;flex-direction:column-reverse}.toolbar-wrap.svelte-1357rcu{min-width:110px;display:flex;flex-direction:column;justify-content:center;align-items:center;position:relative;right:0;bottom:0;border:1px solid var(--block-border-color);border-radius:0;border-top-left-radius:var(--radius-md);border-right:none;border-bottom:none;z-index:1000;background-color:var(--block-background-fill)}.separator.svelte-o0h5ih{width:1px;height:10px;background-color:var(--border-color-primary)}.zoom-number.svelte-o0h5ih{position:relative;width:30px;padding-left:4px;display:flex;align-items:center;justify-content:center}.zoom-number.svelte-o0h5ih span:where(.svelte-o0h5ih){cursor:pointer;font-size:var(--text-sm);transition:color .15s ease}.zoom-number.svelte-o0h5ih span:where(.svelte-o0h5ih):hover{color:var(--color-accent)}.zoom-controls.svelte-o0h5ih{position:absolute;top:calc(100% + var(--spacing-xxs) + 3px);left:-2px;background:var(--block-background-fill);border:1px solid var(--color-gray-200);border-radius:var(--radius-sm);padding:var(--spacing-xxs);box-shadow:var(--shadow-drop);font-size:12px;z-index:var(--layer-2);width:max-content;color:var(--block-label-text-color);border:1px solid var(--block-border-color);border-top-left-radius:0;border-top-right-radius:0}.zoom-controls.svelte-o0h5ih ul:where(.svelte-o0h5ih){list-style:none;margin:0;padding:0}.zoom-controls.svelte-o0h5ih li:where(.svelte-o0h5ih){display:flex;justify-content:space-between;align-items:center;transition:background-color .15s ease;border-bottom:1px solid var(--border-color-primary)}.zoom-controls.svelte-o0h5ih li:where(.svelte-o0h5ih):last-child{border-bottom:none}.zoom-controls.svelte-o0h5ih li:where(.svelte-o0h5ih):hover{background-color:var(--background-fill-secondary)}.zoom-controls.svelte-o0h5ih button:where(.svelte-o0h5ih){width:100%;text-align:left;padding:var(--spacing-sm) var(--spacing-md);font-size:var(--text-sm);line-height:var(--line-sm);transition:all .15s ease;border-radius:var(--radius-sm)}.zoom-controls.svelte-o0h5ih button:where(.svelte-o0h5ih):hover{color:var(--color-accent)}.image-container.svelte-6fnl1z{display:flex;height:100%;flex-direction:column;justify-content:center;align-items:center;max-height:100%;border-radius:var(--radius-sm)}.pixi-target.svelte-6fnl1z{width:100%;height:100%;position:absolute;top:0;left:0;z-index:1;display:block;opacity:0;pointer-events:none;border-radius:var(--radius-sm)}.pixi-target-crop.svelte-6fnl1z{width:100%;height:100%;position:absolute;top:0;left:0;z-index:2;display:block;opacity:0;pointer-events:none;border-radius:var(--radius-sm)}.visible.svelte-6fnl1z{opacity:1;pointer-events:auto}.pixi-target.svelte-6fnl1z{width:100%;height:100%;position:absolute;inset:0;overflow:hidden}.modal.svelte-6fnl1z{position:absolute;height:100%;width:100%;left:0;right:0;margin:auto;z-index:var(--layer-top);display:flex;align-items:center}.modal-inner.svelte-6fnl1z{height:100%;width:100%;background:var(--block-background-fill)}.dark-bg.svelte-6fnl1z{background:#333}.crop-confirm-button.svelte-6fnl1z{position:absolute;bottom:8px;left:0;right:0;margin:auto;z-index:var(--layer-top);display:flex;align-items:center;justify-content:center}h2.svelte-b4yllx{font-size:var(--text-xl)}p.svelte-b4yllx,h2.svelte-b4yllx{white-space:pre-line}.empty.svelte-b4yllx{display:flex;flex-direction:column;justify-content:center;align-items:center;position:absolute;height:100%;width:100%;left:0;right:0;margin:auto;z-index:var(--layer-1);text-align:center;color:var(--color-grey-500)!important;cursor:pointer}.wrap.svelte-b4yllx{display:flex;flex-direction:column;justify-content:center;align-items:center;line-height:var(--line-md);font-size:var(--text-md)}.or.svelte-b4yllx{color:var(--body-text-color-subdued)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BijVyRsD.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BijVyRsD.css new file mode 100644 index 0000000000000000000000000000000000000000..a519d0192a7732aba658f0ad66845c9491eb5895 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BijVyRsD.css @@ -0,0 +1 @@ +div.svelte-7xavid{display:flex;flex-wrap:wrap;gap:var(--layout-gap);width:var(--size-full);position:relative}.hide.svelte-7xavid{display:none}.compact.svelte-7xavid>*,.compact.svelte-7xavid .box{border-radius:0}.compact.svelte-7xavid,.panel.svelte-7xavid{border-radius:var(--container-radius);background:var(--background-fill-secondary);padding:var(--size-2)}.unequal-height.svelte-7xavid{align-items:flex-start}.stretch.svelte-7xavid{align-items:stretch}.stretch.svelte-7xavid>.column>*,.stretch.svelte-7xavid>.column>.form>*{flex-grow:1;flex-shrink:0}div.svelte-7xavid>*,div.svelte-7xavid>.form>*{flex:1 1 0%;flex-wrap:wrap;min-width:min(160px,100%)}.grow-children.svelte-7xavid>.column{align-self:stretch} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Br6Ie3Ai.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Br6Ie3Ai.js new file mode 100644 index 0000000000000000000000000000000000000000..00e6a832a106f7a31021565aa2216c4f7d1cf1e4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Br6Ie3Ai.js @@ -0,0 +1 @@ +import{r as s}from"./i18n-Dnhn5Rxr.js";import{R as i,y as o,ae as n,T as p}from"./index-DWyDLubb.js";import{G as l}from"./utils.svelte-CCyS_0CY.js";import"./clone-BkeCM4Nl.js";function u(c,r){i(r,!0);const a=s(r,["$$slots","$$events","$$legacy"]),t=new l(a);let e;o(()=>{e&&clearInterval(e),t.props.active&&(e=setInterval(()=>{document.visibilityState==="visible"&&t.dispatch("tick")},t.props.value*1e3))}),n(()=>{e&&clearInterval(e)}),p()}export{u as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BrAqfQnF.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BrAqfQnF.js new file mode 100644 index 0000000000000000000000000000000000000000..f3d47d9dee3cbb13bdcea6a1a94bf6953181a1dd --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BrAqfQnF.js @@ -0,0 +1 @@ +import{p as O,w as $e,x as U,e as Ue,i as R,s as pe,b as ee,a as E,f as ze,q as ye,m as Xe,k as Ye,d as te,u as Ze,r as Fe}from"./i18n-Dnhn5Rxr.js";import{R as Te,a3 as h,w as e,a4 as Je,aa as Ke,x as m,ax as Ne,as as se,a1 as X,G as Ie,a2 as Qe,Z as Re,aw as et,V as $,X as Y,Y as w,t as G,z as v,a as u,T as Be,M as Se,U as Z,S as M,a6 as ae,W as j,a0 as ve,a7 as tt,f as st,y as at}from"./index-DWyDLubb.js";import{G as lt}from"./utils.svelte-CCyS_0CY.js";import{T as it,a as rt}from"./Walkthrough.svelte_svelte_type_style_lang-Bw7iC7Yg.js";import"./clone-BkeCM4Nl.js";import"./event-modifiers-CdEA5IGF.js";var nt=j('

        '),dt=st(''),ot=j(" "),ct=j("
        "),_t=j('
        ',1),vt=j('
        ',1),pt=j("
        ");function bt(le,b){Te(b,!1);const p=()=>ye(L,"$selected_tab",H),t=()=>ye(Q,"$selected_tab_index",H),[H,ie]=Xe(),F=h(),J=h();let d=O(b,"visible",12,!0),i=O(b,"elem_id",12,""),S=O(b,"elem_classes",28,()=>[]),o=O(b,"selected",12),z=O(b,"initial_tabs",12),l=h([...z()]),T=h(),K=h(!0),re=h(),B=h([]),N=h([]),be=h(0),y=h(!1),ne=!0;const L=$e(o()||e(l)[0]?.id||!1),Q=$e(e(l).findIndex(s=>s?.id===o())||0),ue=Je();async function V(){if(!e(T)||!e(re)||!ne)return;ne=!1,await Se(),m(K,!0),await Se();const _=e(B)[0].getBoundingClientRect().width*e(B).length+50*(e(B).length-1),x=e(T).getBoundingClientRect().width;if(!(_k&&(k=a),I&&D-10{V();const s=new ResizeObserver(_=>{_[0].contentRect.width!==fe&&(fe=_[0].contentRect.width,m(y,!1),ne=!0,V())});return e(T)&&s.observe(e(T)),()=>{s.disconnect()}}),Ne(it,{register_tab:(s,_)=>(se(l,e(l)[_]=s),p()===!1&&s.visible&&s.interactive&&(U(L,s.id),U(Q,_)),_),unregister_tab:(s,_)=>{p()===s.id&&U(L,e(l)[0]?.id||!1),se(l,e(l)[_]=null)},selected_tab:L,selected_tab_index:Q});function ge(s,_){const x=e(l).find(C=>C?.id===s);s!==void 0&&x&&x.interactive&&x.visible&&p()!==x.id&&(o(s),U(L,s),U(Q,e(l).findIndex(C=>C?.id===s)),ue("change"))}X(()=>e(l),()=>{m(F,e(l).length>0)}),X(()=>(e(l),Ie(o())),()=>{e(l),o()!==null&&ge(o(),e(l).findIndex(s=>s?.id===o()))}),X(()=>e(l),()=>{e(l),V()}),X(()=>t(),()=>{t(),V()}),X(()=>(e(l),t()),()=>{m(J,e(l)[t()>=0?t():0]?.scale)}),Qe();var We={get visible(){return d()},set visible(s){d(s),Z()},get elem_id(){return i()},set elem_id(s){i(s),Z()},get elem_classes(){return S()},set elem_classes(s){S(s),Z()},get selected(){return o()},set selected(s){o(s),Z()},get initial_tabs(){return z()},set initial_tabs(s){z(s),Z()}};Ue();var W=pt();Re("resize",et,V);let he,me;var xe=$(W);{var Ce=s=>{var _=vt(),x=M(_);{var C=f=>{var a=nt(),n=$(a),D=$(n);w(n);var q=Y(n);w(a),G(()=>{ve(D,`Step ${(t()||0)+1}/${e(l),v(()=>e(l).length)??""}:`),ve(q,` ${e(l),t(),v(()=>e(l)[t()]?.label||"Walkthrough")??""}`)}),u(f,a)};R(x,f=>{e(y)&&f(C)})}var k=Y(x,2);let P;var I=$(k);Ye(I,5,()=>e(l),Ze,(f,a,n)=>{var D=ae(),q=M(D);{var Ee=de=>{var we=_t(),oe=M(we),g=$(oe);let ke;var ce=$(g),Ge=$(ce);{var Me=r=>{var c=dt();u(r,c)},je=r=>{var c=tt();c.nodeValue=n+1,u(r,c)};R(Ge,r=>{e(a),p(),v(()=>e(a).id{var c=ot();let A;var Ae=$(c,!0);w(c),te(c,(_e,Oe)=>se(N,e(N)[Oe]=_e),_e=>e(N)?.[_e],()=>[n]),G(()=>{A=ee(c,1,"step-label svelte-1xpzbgb",null,A,{visible:e(K)||n===t()}),ve(Ae,(e(a),v(()=>e(a)?.label!==void 0?e(a)?.label:"Step "+(n+1))))}),u(r,c)};R(He,r=>{e(y)||r(Le)})}w(g),te(g,(r,c)=>se(B,e(B)[c]=r),r=>e(B)?.[r],()=>[n]),w(oe);var Ve=Y(oe,2);{var qe=r=>{var c=ct();let A;G(()=>A=ee(c,1,"step-connector svelte-1xpzbgb",null,A,{completed:n{e(l),e(y),v(()=>n{ke=ee(g,1,"step-button svelte-1xpzbgb",null,ke,{active:e(a).id===p(),completed:e(a).idp()}),E(g,"aria-selected",(e(a),p(),v(()=>e(a).id===p()))),E(g,"aria-controls",(e(a),v(()=>e(a).elem_id))),g.disabled=(e(a),t(),v(()=>!e(a).interactive||n>t())),E(g,"aria-disabled",(e(a),t(),v(()=>!e(a).interactive||n>t()))),E(g,"id",(e(a),v(()=>e(a).elem_id?e(a).elem_id+"-button":null))),E(g,"data-tab-id",(e(a),v(()=>e(a).id)))}),Re("click",g,()=>{n<=t()&&e(a).id!==p()&&(ge(e(a).id),ue("select",{value:e(a).label,index:n}))}),u(de,we)};R(q,de=>{e(a),v(()=>e(a)?.visible)&&de(Ee)})}u(f,D)}),w(I),te(I,f=>m(re,f),()=>e(re)),w(k),te(k,f=>m(T,f),()=>e(T)),G(()=>P=ze(k,"",P,{"--label-height":e(be)+"px"})),u(s,_)};R(xe,s=>{e(F)&&s(Ce)})}var Pe=Y(xe,2);pe(Pe,b,"default",{}),w(W),G(s=>{he=ee(W,1,`stepper ${s??""}`,"svelte-1xpzbgb",he,{hide:!d(),compact:e(y)}),E(W,"id",i()),me=ze(W,"",me,{"flex-grow":e(J)})},[()=>(Ie(S()),v(()=>S().join(" ")))]),u(le,W);var De=Be(We);return ie(),De}function wt(le,b){Te(b,!0);let p=Fe(b,["$$slots","$$events","$$legacy"]);const t=new lt(p);at(()=>{t.props.selected&&v(()=>{const d=t.props.initial_tabs.findIndex(i=>i.id===t.props.selected);t.dispatch("gradio_tab_select",{value:t.props.initial_tabs[d].label,index:d,id:t.props.initial_tabs[d].id,component_id:t.props.initial_tabs[d].component_id})})});var H=ae(),ie=M(H);{var F=d=>{bt(d,{get visible(){return t.shared.visible},get elem_id(){return t.shared.elem_id},get elem_classes(){return t.shared.elem_classes},get initial_tabs(){return t.props.initial_tabs},get selected(){return t.props.selected},set selected(i){t.props.selected=i},$$events:{change:()=>t.dispatch("change"),select:i=>{t.dispatch("select",i.detail),t.dispatch("gradio_tab_select",i.detail)}},children:(i,S)=>{var o=ae(),z=M(o);pe(z,b,"default",{}),u(i,o)},$$slots:{default:!0}})},J=d=>{rt(d,{get visible(){return t.shared.visible},get elem_id(){return t.shared.elem_id},get elem_classes(){return t.shared.elem_classes},get initial_tabs(){return t.props.initial_tabs},get selected(){return t.props.selected},set selected(i){t.props.selected=i},$$events:{change:()=>t.dispatch("change"),select:i=>{t.dispatch("select",i.detail),t.dispatch("gradio_tab_select",i.detail)}},children:(i,S)=>{var o=ae(),z=M(o);pe(z,b,"default",{}),u(i,o)},$$slots:{default:!0}})};R(ie,d=>{t.props.name==="walkthrough"?d(F):d(J,!1)})}u(le,H),Be()}export{rt as BaseTabs,it as TABS,wt as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Brqch1XL.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Brqch1XL.js new file mode 100644 index 0000000000000000000000000000000000000000..7953de9c43c44a937c4ab76ce078420eabc2bdbe --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Brqch1XL.js @@ -0,0 +1 @@ +import{g as ae,d as V,i as te,r as se,a as r,t as E}from"./i18n-Dnhn5Rxr.js";import{R as re,u as ie,v as le,y as N,w as u,x as pe,Z as i,S as ne,a7 as oe,t as g,a as x,V as l,X as d,T as ue,M as $,aw as de,W,a0 as w,a5 as y,a8 as me,Y as p}from"./index-DWyDLubb.js";import{b as U}from"./input-DrerMDOL.js";import{G as ve}from"./utils.svelte-CCyS_0CY.js";import{B as ce}from"./Block-J4oodUWp.js";import{B as _e}from"./BlockTitle-BMm9LakX.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{S as fe}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./clone-BkeCM4Nl.js";import"./Info-Dzjhnd64.js";import"./html-Ih_5QVTo.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./index-B_pwUImq.js";let he=0;var be=W(''),ge=W('
        ',1);function Re(X,k){re(k,!0);let Y=se(k,["$$slots","$$events","$$legacy"]),e=new ve(Y);const Z=e.props.value;let S=ie(le(e.props.value)),m,B;const I=`range_id_${he++}`;let j=y(()=>e.props.minimum??0),q=y(()=>{const n=e.props.minimum,f=e.props.maximum,o=e.props.value;return o>f?100:o{e.props.value==null||!m||(m.style.setProperty("--range_progress",`${u(q)}%`),m.value=e.props.value.toString())});async function C(){await $(),e.dispatch("change")}async function M(n){await $(),e.dispatch("release",e.props.value)}function D(){e.dispatch("release",e.props.value),e.props.value=Math.min(Math.max(e.props.value,e.props.minimum),e.props.maximum)}let _=y(()=>!e.shared.interactive);N(()=>{e.props.value!=u(S)&&(pe(S,e.props.value,!0),C())});function F(){}function H(){e.props.value=Z,e.dispatch("change"),e.dispatch("release",e.props.value)}async function P(){await $(),e.dispatch("input")}i("resize",de,F),ce(X,{get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},children:(n,f)=>{var o=ge(),T=ne(o);fe(T,ae({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var z=d(T,2),h=l(z),v=l(h),J=l(v);_e(J,{get show_label(){return e.shared.show_label},get info(){return e.props.info},children:(a,c)=>{me();var R=oe();g(()=>w(R,e.shared.label||"Slider")),x(a,R)},$$slots:{default:!0}}),p(v);var A=d(v,2),t=l(A);E(t),V(t,a=>B=a,()=>B);var K=d(t,2);{var O=a=>{var c=be();g(()=>c.disabled=u(_)),i("click",c,H),x(a,c)};te(K,a=>{(e.props.buttons?.includes("reset")??!0)&&a(O)})}p(A),p(h);var G=d(h,2),b=l(G),Q=l(b,!0);p(b);var s=d(b,2);E(s),V(s,a=>m=a,()=>m);var L=d(s,2),ee=l(L,!0);p(L),p(G),p(z),g(()=>{r(v,"for",I),r(t,"aria-label",`number input for ${e.shared.label}`),r(t,"min",e.props.minimum),r(t,"max",e.props.maximum),r(t,"step",e.props.step),t.disabled=u(_),w(Q,u(j)),r(s,"id",I),r(s,"min",e.props.minimum),r(s,"max",e.props.maximum),r(s,"step",e.props.step),s.disabled=u(_),r(s,"aria-label",`range slider for ${e.shared.label}`),w(ee,e.props.maximum)}),U(t,()=>e.props.value,a=>e.props.value=a),i("input",t,P),i("blur",t,D),i("pointerup",t,M),U(s,()=>e.props.value,a=>e.props.value=a),i("input",s,P),i("pointerup",s,M),x(n,o)},$$slots:{default:!0}}),ue()}export{Re as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BtbmsJIn.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BtbmsJIn.js new file mode 100644 index 0000000000000000000000000000000000000000..6490affb724e7f577ad7c19f613a60a695082fcc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-BtbmsJIn.js @@ -0,0 +1,2 @@ +import{p as N,k as fe,b as ve,u as be,i as se,f as we,K as te,t as ne,d as de,r as ye,a as ke}from"./i18n-Dnhn5Rxr.js";import{a as F,f as je,aj as me,R as pe,X as p,V as h,t as O,a0 as re,w as r,T as he,a5 as ae,x as d,W as R,Y as _,u as j,v as M,y as xe,ae as qe,S as De,a7 as Me,Z as Se,a8 as Ye}from"./index-DWyDLubb.js";import{b as oe}from"./input-DrerMDOL.js";import{B as He}from"./Block-J4oodUWp.js";import{B as Ee}from"./BlockTitle-BMm9LakX.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{G as Fe}from"./utils.svelte-CCyS_0CY.js";import{I as Te}from"./IconButtonWrapper-D0s9l4wW.js";import{default as ut}from"./Example-B_mfRiuX.js";import"./Info-Dzjhnd64.js";import"./html-Ih_5QVTo.js";import"./snippet-BWgYNF9D.js";import"./clone-BkeCM4Nl.js";var Be=je('');function Le(t){var s=Be();F(t,s)}const Ce=(t,s)=>{if(t.toJSON()===null)return"";const o=D=>D.toString().padStart(2,"0"),e=t.getFullYear(),n=o(t.getMonth()+1),l=o(t.getDate()),v=o(t.getHours()),w=o(t.getMinutes()),b=o(t.getSeconds()),a=`${e}-${n}-${l}`,A=`${v}:${w}:${b}`;return s?`${a} ${A}`:a},ue=(t,s)=>{if(t==null||t==="")return!0;const o=s?/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/:/^\d{4}-\d{2}-\d{2}$/,e=t.match(o)!==null,n=t.match(/^(?:\s*now\s*(?:-\s*\d+\s*[dmhs])?)?\s*$/)!==null;return e||n},_e=(t,s)=>new Date(t,s+1,0).getDate(),Pe=(t,s)=>new Date(t,s,1).getDay(),Ne=(t,s)=>{if(!t||t===""){const e=new Date;return{selected_date:e,current_year:e.getFullYear(),current_month:e.getMonth(),selected_hour:e.getHours(),selected_minute:e.getMinutes(),selected_second:e.getSeconds(),is_pm:e.getHours()>=12}}try{let e=t;!s&&t.match(/^\d{4}-\d{2}-\d{2}$/)&&(e+=" 00:00:00");const n=new Date(e.replace(" ","T"));if(!isNaN(n.getTime()))return{selected_date:n,current_year:n.getFullYear(),current_month:n.getMonth(),selected_hour:n.getHours(),selected_minute:n.getMinutes(),selected_second:n.getSeconds(),is_pm:n.getHours()>=12}}catch{}const o=new Date;return{selected_date:o,current_year:o.getFullYear(),current_month:o.getMonth(),selected_hour:o.getHours(),selected_minute:o.getMinutes(),selected_second:o.getSeconds(),is_pm:o.getHours()>=12}},Ae=(t,s)=>{const o=_e(t,s),e=Pe(t,s),n=[],l=s===0?11:s-1,v=s===0?t-1:t,w=_e(v,l);for(let a=e-1;a>=0;a--)n.push({day:w-a,is_current_month:!1,is_next_month:!1});for(let a=1;a<=o;a++)n.push({day:a,is_current_month:!0,is_next_month:!1});const b=42-n.length;for(let a=1;a<=b;a++)n.push({day:a,is_current_month:!1,is_next_month:!0});return n},Je=(t,s)=>s?t===0?12:t>12?t-12:t:t===0?12:t,Ie=(t,s)=>s?t===12?12:t+12:t===12?0:t,We=["January","February","March","April","May","June","July","August","September","October","November","December"];var Ge=R(''),Oe=R('
        Period
        '),Re=R('
        Su
        Mo
        Tu
        We
        Th
        Fr
        Sa
        ');function Ke(t,s){pe(s,!0);let o=N(s,"selected_date",15),e=N(s,"current_year",15),n=N(s,"current_month",15),l=N(s,"selected_hour",15),v=N(s,"selected_minute",15),w=N(s,"selected_second",15),b=N(s,"is_pm",15),a=ae(()=>Je(l(),b())),A=ae(()=>Ae(e(),n()));const D=c=>{o(new Date(e(),n(),c,l(),v(),w())),T()},T=()=>{const c=Ce(o(),s.include_time);s.onupdate?.(c)},S=()=>{o(new Date(e(),n(),o().getDate(),l(),v(),w())),T()},B=()=>{n()===0?(n(11),te(e,-1)):te(n,-1)},J=()=>{n()===11?(n(0),te(e)):te(n)},K=()=>{b(!b()),b()&&l()<12?l(l()+12):!b()&&l()>=12&&l(l()-12),S()},V=c=>{l(Ie(c,b())),S()},ie=()=>{const c=new Date;o(c),e(c.getFullYear()),n(c.getMonth()),l(c.getHours()),v(c.getMinutes()),w(c.getSeconds()),b(l()>=12),T()};var Y=Re(),I=h(Y),L=h(I),X=h(L);X.__click=B;var Z=p(X,2),z=h(Z);_(Z);var W=p(Z,2);W.__click=J,_(L);var H=p(L,2),$=p(h(H),2);fe($,21,()=>r(A),be,(c,y)=>{let g=()=>r(y).day,x=()=>r(y).is_current_month,C=()=>r(y).is_next_month;var k=Ge();let E;k.__click=()=>{x()?D(g()):C()?(J(),D(g())):(B(),D(g()))};var P=h(k,!0);_(k),O(i=>{E=ve(k,1,"day svelte-s8mqj7",null,E,i),re(P,g())},[()=>({"other-month":!x(),selected:x()&&g()===o().getDate()&&n()===o().getMonth()&&e()===o().getFullYear()})]),F(c,k)}),_($),_(H);var ee=p(H,2);{var u=c=>{var y=Oe(),g=h(y),x=h(g),C=p(h(x),2);ne(C),C.__input=()=>V(r(a)),_(x);var k=p(x,2),E=p(h(k),2);ne(E),E.__input=S,_(k);var P=p(k,2),i=p(h(P),2);ne(i),i.__input=S,_(P);var f=p(P,2),q=p(h(f),2);q.__click=K;var m=h(q,!0);_(q),_(f),_(g),_(y),O(()=>re(m,b()?"PM":"AM")),oe(C,()=>r(a),ge=>d(a,ge)),oe(E,v),oe(i,w),F(c,y)};se(ee,c=>{s.include_time&&c(u)})}var le=p(ee,2),Q=h(le);Q.__click=function(...c){s.onclear?.apply(this,c)};var G=p(Q,2),U=h(G);U.__click=ie;var ce=p(U,2);ce.__click=function(...c){s.onclose?.apply(this,c)},_(G),_(le),_(I),_(Y),O(()=>{we(Y,`top: ${s.position.top??""}px; left: ${s.position.left??""}px;`),re(z,`${We[n()]??""} + ${e()??""}`)}),F(t,Y),he()}me(["click","input"]);var Ve=R(''),Xe=R('
        '),Ze=R('
        ',1);function lt(t,s){pe(s,!0);const o=ye(s,["$$slots","$$events","$$legacy"]),e=new Fe(o);let n=j(M(e.props.value)),l=j(!1),v=j(M(e.props.value)),w,b,a,A=j(M({top:0,left:0})),D=j(M(new Date().getFullYear())),T=j(M(new Date().getMonth())),S=j(M(new Date)),B=j(M(new Date().getHours())),J=j(M(new Date().getMinutes())),K=j(M(new Date().getSeconds())),V=j(r(B)>=12),ie=ae(()=>ue(r(v),e.props.include_time)),Y=ae(()=>!e.shared.interactive);xe(()=>{r(n)!=e.props.value&&(d(n,e.props.value,!0),d(v,e.props.value,!0),I(),e.dispatch("change"))});const I=()=>{const u=Ne(r(v),e.props.include_time);d(S,u.selected_date,!0),d(D,u.current_year,!0),d(T,u.current_month,!0),d(B,u.selected_hour,!0),d(J,u.selected_minute,!0),d(K,u.selected_second,!0),d(V,u.is_pm,!0)},L=()=>{r(v)!==e.props.value&&ue(r(v),e.props.include_time)&&(d(n,e.props.value=r(v),!0),e.dispatch("change"))},X=()=>{if(a){const u=a.getBoundingClientRect();d(A,{top:u.bottom+4,left:u.right-280},!0)}},Z=u=>{r(Y)||(u.stopPropagation(),d(l,!r(l)),r(l)?(I(),X(),setTimeout(()=>{typeof window<"u"&&(window.addEventListener("click",W),window.addEventListener("scroll",H,!0))},10)):typeof window<"u"&&(window.removeEventListener("click",W),window.removeEventListener("scroll",H,!0)))},z=()=>{d(l,!1),typeof window<"u"&&(window.removeEventListener("click",W),window.removeEventListener("scroll",H,!0))},W=u=>{r(l)&&w&&!w.contains(u.target)&&a&&!a.contains(u.target)&&z()},H=()=>{r(l)&&X()},$=u=>{d(v,u,!0),L()},ee=()=>{d(v,""),e.props.value="",z(),e.dispatch("change")};qe(()=>{typeof window<"u"&&(window.removeEventListener("click",W),window.removeEventListener("scroll",H,!0))}),I(),He(t,{get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},allow_overflow:!1,padding:!0,children:(u,le)=>{var Q=Ze(),G=De(Q),U=h(G);{var ce=i=>{Te(i,{get buttons(){return e.props.buttons},on_custom_button_click:f=>{e.dispatch("custom_button_click",{id:f})}})};se(U,i=>{e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0&&i(ce)})}var c=p(U,2);Ee(c,{get show_label(){return e.shared.show_label},get info(){return e.props.info},children:(i,f)=>{Ye();var q=Me();O(()=>re(q,e.shared.label||"Date")),F(i,q)},$$slots:{default:!0}}),_(G);var y=p(G,2),g=h(y);ne(g);let x;g.__keydown=i=>{i.key==="Enter"&&(L(),e.dispatch("submit"))},de(g,i=>b=i,()=>b);var C=p(g,2);{var k=i=>{var f=Ve();f.__click=Z;var q=h(f);Le(q),_(f),de(f,m=>a=m,()=>a),O(()=>f.disabled=r(Y)),F(i,f)};se(C,i=>{e.shared.interactive&&i(k)})}_(y);var E=p(y,2);{var P=i=>{var f=Xe(),q=h(f);Ke(q,{get include_time(){return e.props.include_time},get position(){return r(A)},onupdate:$,onclear:ee,onclose:z,get selected_date(){return r(S)},set selected_date(m){d(S,m,!0)},get current_year(){return r(D)},set current_year(m){d(D,m,!0)},get current_month(){return r(T)},set current_month(m){d(T,m,!0)},get selected_hour(){return r(B)},set selected_hour(m){d(B,m,!0)},get selected_minute(){return r(J)},set selected_minute(m){d(J,m,!0)},get selected_second(){return r(K)},set selected_second(m){d(K,m,!0)},get is_pm(){return r(V)},set is_pm(m){d(V,m,!0)}}),_(f),de(f,m=>w=m,()=>w),F(i,f)};se(E,i=>{r(l)&&i(P)})}O(()=>{x=ve(g,1,"time svelte-16sct4k",null,x,{invalid:!r(ie)}),g.disabled=r(Y),ke(g,"placeholder",e.props.include_time?"YYYY-MM-DD HH:MM:SS":"YYYY-MM-DD")}),Se("blur",g,L),oe(g,()=>r(v),i=>d(v,i)),F(u,Q)},$$slots:{default:!0}}),he()}me(["keydown","click"]);export{ut as BaseExample,lt as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C-RstoJU.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C-RstoJU.js new file mode 100644 index 0000000000000000000000000000000000000000..bfcf20f64ec62d8a0dbe989156fcbc2c8f19b3bb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C-RstoJU.js @@ -0,0 +1 @@ +import{p as le,e as Ve,i as C,d as ce,f as He,b as Q,k as ve,u as pe}from"./i18n-Dnhn5Rxr.js";import{R as Re,aa as ze,a1 as I,G as We,M as $,w as e,a2 as Be,t as W,z as b,Z as k,a as p,T as De,a3 as g,x as r,U as ue,V as l,X as u,W as _,Y as d,a6 as Le,S as Ue,ak as $e,a0 as te,a7 as fe}from"./index-DWyDLubb.js";import{b as Pe}from"./input-DrerMDOL.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{C as Te}from"./Code-BLWhl1y6.js";/* empty css */import{M as Ze}from"./Index.svelte_svelte_type_style_lang-D9os8tfr.js";import"./MarkdownCode-B8HQ3LiU.js";import"./index-B_pwUImq.js";/* empty css */import"./html-Ih_5QVTo.js";import"./snippet-BWgYNF9D.js";import"./actions-CLThs9VH.js";import"./utils.svelte-CCyS_0CY.js";import"./clone-BkeCM4Nl.js";import"./Check-DUAHzS2-.js";import"./Copy-ChCbTvli.js";import"./IconButtonWrapper-D0s9l4wW.js";import"./prism-python-B4lzO_Nz.js";var qe=_(' '),Qe=_(' '),Ie=_(' '),je=_(''),Ge=_('
        '),Xe=_('
        No messages yet
        '),Ye=_(''),Ae=_('
        '),Ke=_('
        '),Ne=_('
        '),Je=_('
        Powered by: gpt-oss
        ');function gt(me,j){Re(j,!1);let E=le(j,"app",12),F=le(j,"root",12),V=g(""),G=g(350),X=!1,se=g(),M=g("chat"),B=g(""),v=g(null),n=g([]),D=g();const P=(t="smooth")=>{e(D)&&e(D).scrollTo({top:e(D).scrollHeight,behavior:t})};let T=g([]);(async()=>E().post_data(`${F()}/gradio_api/vibe-starter-queries/`,{}).then(async([a,i])=>{if(i!==200)throw new Error(`Error: ${i}`);r(T,a.starter_queries)}).catch(async a=>{console.error("Failed to fetch starter queries:",a)}))();const Y=async t=>{const a=t||e(V);if(a.trim()==="")return;r(v,null);const i=e(n).length;r(n,[...e(n),{text:a,isBot:!1}]);const f=e(n).length;r(n,[...e(n),{text:"Working...",isBot:!0,isPending:!0}]),await $(),P();const y=a;t||r(V,""),E().post_data(`${F()}/gradio_api/vibe-edit/`,{prompt:y}).then(async([c,o])=>{if(o!==200)throw new Error(`Error: ${o}`);const s=c;r(v,s.diff_stats),r(n,e(n).map((m,h)=>h===i?{...m,hash:s.hash}:m)),r(n,e(n).map((m,h)=>h===f?{text:s.reasoning?s.reasoning:"Done.",isBot:!0,isPending:!1}:m)),await $(),P()}).catch(async c=>{r(n,e(n).map((o,s)=>s===f?{text:"Error occurred.",isBot:!0,isPending:!1}:o)),await $(),P()})},he=async t=>{await Y(t)},_e=async(t,a)=>{try{await E().post_data(`${F()}/gradio_api/undo-vibe-edit/`,{hash:t}),r(v,null);const i=e(n)[a];r(V,i.text),r(n,e(n).slice(0,a))}catch(i){console.error("Failed to undo:",i)}},we=t=>{t.preventDefault(),X=!0,document.addEventListener("mousemove",A),document.addEventListener("mouseup",K),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},A=t=>{if(!X)return;const a=250,i=Math.min(800,window.innerWidth*.5),f=window.innerWidth-t.clientX;r(G,Math.max(a,Math.min(i,f))),window.dispatchEvent(new CustomEvent("vibeEditorResize",{detail:{width:e(G)}}))},K=()=>{X=!1,document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",K),document.body.style.cursor="",document.body.style.userSelect=""},be=async()=>{try{const t=await fetch(`${F()}/gradio_api/vibe-code/`,{method:"GET",headers:{"Content-Type":"application/json"}});if(t.ok){const a=await t.json();r(B,a.code)}}catch(t){console.error("Failed to fetch code:",t)}};let z=g(!1);const ge=async()=>{try{await E().post_data(`${F()}/gradio_api/vibe-code/`,{code:e(B)}),r(z,!0),setTimeout(()=>{r(z,!1)},1e3)}catch(t){console.error("Failed to update code:",t)}};function ye(){const t="https://huggingface.co/new-space",a=new URLSearchParams({name:"new-space",sdk:"gradio"}),i=e(B).trimStart();a.append("files[0][path]","app.py"),a.append("files[0][content]",i),window.open(`${t}?${a.toString()}`,"_blank")?.focus()}ze(()=>()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",K)}),I(()=>We(E()),()=>{E(),be()}),I(()=>(e(M),$),()=>{e(M)==="chat"&&$().then(()=>P("auto"))}),I(()=>e(z),()=>{e(z)}),I(()=>e(T),()=>{e(T)}),Be();var xe={get app(){return E()},set app(t){E(t),ue()},get root(){return F()},set root(t){F(t),ue()}};Ve();var L=Je(),ae=l(L),N=u(ae,2),J=l(N);let oe;var Z=u(J,2);let re;var Ce=u(l(Z));{var ke=t=>{var a=Ie(),i=l(a);{var f=c=>{var o=qe(),s=l(o);d(o),W(()=>te(s,`+${e(v),b(()=>e(v).lines_added)??""}`)),p(c,o)};C(i,c=>{e(v),b(()=>e(v).lines_added>0)&&c(f)})}var y=u(i,2);{var S=c=>{var o=Qe(),s=l(o);d(o),W(()=>te(s,`-${e(v),b(()=>e(v).lines_removed)??""}`)),p(c,o)};C(y,c=>{e(v),b(()=>e(v).lines_removed>0)&&c(S)})}d(a),p(t,a)};C(Ce,t=>{e(v),b(()=>e(v)&&(e(v).lines_added>0||e(v).lines_removed>0))&&t(ke)})}d(Z),d(N);var O=u(N,2),Ee=l(O);{var Me=t=>{var a=Ke(),i=l(a);ve(i,1,()=>e(n),pe,(o,s,m)=>{var h=Ge();let H;var x=l(h),R=l(x),w=l(R);Ze(w,{get value(){return e(s),b(()=>e(s).text)},latex_delimiters:[],theme_mode:"system"}),d(R);var U=u(R,2);{var Fe=ee=>{var de=je();k("click",de,()=>_e(e(s).hash||"",m)),p(ee,de)};C(U,ee=>{e(s),b(()=>!e(s).isBot&&e(s).hash&&!e(s).isPending)&&ee(Fe)})}d(x),d(h),W(()=>H=Q(h,1,"message-item svelte-1s2fnws",null,H,{"bot-message":e(s).isBot,"user-message":!e(s).isBot})),p(o,h)});var f=u(i,2);{var y=o=>{var s=Xe();p(o,s)};C(f,o=>{e(n),b(()=>e(n).length===0)&&o(y)})}var S=u(f,2);{var c=o=>{var s=Ae(),m=l(s);ve(m,5,()=>e(T),pe,(h,H)=>{var x=Ye(),R=l(x,!0);d(x),W(()=>te(R,e(H))),k("click",x,()=>he(e(H))),p(h,x)}),d(m),d(s),p(o,s)};C(S,o=>{e(n),b(()=>e(n).length===0)&&o(c)})}d(a),ce(a,o=>r(D,o),()=>e(D)),p(t,a)},Se=t=>{var a=Le(),i=Ue(a);{var f=y=>{var S=Ne(),c=l(S),o=l(c);Te(o,{language:"python",lines:10,dark_mode:!1,basic:!0,readonly:!1,placeholder:"Enter your code here...",wrap_lines:!0,get value(){return e(B)},set value(w){r(B,w)},$$legacy:!0}),d(c);var s=u(c,2);let m;var h=l(s);{var H=w=>{var U=fe("Updated!");p(w,U)},x=w=>{var U=fe("Update Code");p(w,U)};C(h,w=>{e(z)?w(H):w(x,!1)})}d(s);var R=u(s,2);d(S),W(()=>m=Q(s,1,"update-code-button svelte-1s2fnws",null,m,{updating:e(z)})),k("click",s,ge),k("click",R,()=>ye()),p(y,S)};C(i,y=>{e(M)==="code"&&y(f)},!0)}p(t,a)};C(Ee,t=>{e(M)==="chat"?t(Me):t(Se,!1)})}d(O);var ne=u(O,2),q=u(l(ne),2);$e(q);var ie=u(q,2);return d(ne),d(L),ce(L,t=>r(se,t),()=>e(se)),W(t=>{He(L,`width: ${e(G)??""}px;`),oe=Q(J,1,"tab-button svelte-1s2fnws",null,oe,{active:e(M)==="chat"}),re=Q(Z,1,"tab-button svelte-1s2fnws",null,re,{active:e(M)==="code"}),ie.disabled=t},[()=>(e(V),b(()=>e(V).trim()===""))]),k("mousedown",ae,we),k("click",J,()=>r(M,"chat")),k("click",Z,()=>r(M,"code")),k("keydown",q,t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),Y())}),Pe(q,()=>e(V),t=>r(V,t)),k("click",ie,()=>Y()),p(me,L),De(xe)}export{gt as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C0OCjl9T.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C0OCjl9T.js new file mode 100644 index 0000000000000000000000000000000000000000..ebc9fcb924a21f1e4dfa009a42730ebe640432a9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C0OCjl9T.js @@ -0,0 +1 @@ +import{Q as Bx,J as er,G as hx,r as lx}from"./i18n-Dnhn5Rxr.js";import{R as Cx,y as px,aa as Ex,T as Ax}from"./index-DWyDLubb.js";import{_ as Fx}from"./__vite-browser-external-D7Ct-6yo.js";import{G as Dx}from"./utils.svelte-CCyS_0CY.js";import"./clone-BkeCM4Nl.js";var C0={exports:{}};function _x(R){throw new Error('Could not dynamically require "'+R+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var p0={exports:{}};const bx=Bx(Fx);var gx=p0.exports,Cr;function L(){return Cr||(Cr=1,(function(R,$){(function(h,x){R.exports=x()})(gx,function(){var h=h||(function(x,D){var E;if(typeof window<"u"&&window.crypto&&(E=window.crypto),typeof self<"u"&&self.crypto&&(E=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(E=globalThis.crypto),!E&&typeof window<"u"&&window.msCrypto&&(E=window.msCrypto),!E&&typeof er<"u"&&er.crypto&&(E=er.crypto),!E&&typeof _x=="function")try{E=bx}catch{}var g=function(){if(E){if(typeof E.getRandomValues=="function")try{return E.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof E.randomBytes=="function")try{return E.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},v=Object.create||(function(){function a(){}return function(n){var i;return a.prototype=n,i=new a,a.prototype=null,i}})(),u={},r=u.lib={},t=r.Base=(function(){return{extend:function(a){var n=v(this);return a&&n.mixIn(a),(!n.hasOwnProperty("init")||this.init===n.init)&&(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var n in a)a.hasOwnProperty(n)&&(this[n]=a[n]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),B=r.WordArray=t.extend({init:function(a,n){a=this.words=a||[],n!=D?this.sigBytes=n:this.sigBytes=a.length*4},toString:function(a){return(a||f).stringify(this)},concat:function(a){var n=this.words,i=a.words,p=this.sigBytes,C=a.sigBytes;if(this.clamp(),p%4)for(var A=0;A>>2]>>>24-A%4*8&255;n[p+A>>>2]|=_<<24-(p+A)%4*8}else for(var S=0;S>>2]=i[S>>>2];return this.sigBytes+=C,this},clamp:function(){var a=this.words,n=this.sigBytes;a[n>>>2]&=4294967295<<32-n%4*8,a.length=x.ceil(n/4)},clone:function(){var a=t.clone.call(this);return a.words=this.words.slice(0),a},random:function(a){for(var n=[],i=0;i>>2]>>>24-C%4*8&255;p.push((A>>>4).toString(16)),p.push((A&15).toString(16))}return p.join("")},parse:function(a){for(var n=a.length,i=[],p=0;p>>3]|=parseInt(a.substr(p,2),16)<<24-p%8*4;return new B.init(i,n/2)}},o=e.Latin1={stringify:function(a){for(var n=a.words,i=a.sigBytes,p=[],C=0;C>>2]>>>24-C%4*8&255;p.push(String.fromCharCode(A))}return p.join("")},parse:function(a){for(var n=a.length,i=[],p=0;p>>2]|=(a.charCodeAt(p)&255)<<24-p%4*8;return new B.init(i,n)}},c=e.Utf8={stringify:function(a){try{return decodeURIComponent(escape(o.stringify(a)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(a){return o.parse(unescape(encodeURIComponent(a)))}},s=r.BufferedBlockAlgorithm=t.extend({reset:function(){this._data=new B.init,this._nDataBytes=0},_append:function(a){typeof a=="string"&&(a=c.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(a){var n,i=this._data,p=i.words,C=i.sigBytes,A=this.blockSize,_=A*4,S=C/_;a?S=x.ceil(S):S=x.max((S|0)-this._minBufferSize,0);var d=S*A,F=x.min(d*4,C);if(d){for(var y=0;y>>2]|=u[B]<<24-B%4*8;g.call(this,t,r)}else g.apply(this,arguments)};v.prototype=E}})(),h.lib.WordArray})})(A0)),A0.exports}var F0={exports:{}},wx=F0.exports,Ar;function mx(){return Ar||(Ar=1,(function(R,$){(function(h,x){R.exports=x(L())})(wx,function(h){return(function(){var x=h,D=x.lib,E=D.WordArray,g=x.enc;g.Utf16=g.Utf16BE={stringify:function(u){for(var r=u.words,t=u.sigBytes,B=[],e=0;e>>2]>>>16-e%4*8&65535;B.push(String.fromCharCode(f))}return B.join("")},parse:function(u){for(var r=u.length,t=[],B=0;B>>1]|=u.charCodeAt(B)<<16-B%2*16;return E.create(t,r*2)}},g.Utf16LE={stringify:function(u){for(var r=u.words,t=u.sigBytes,B=[],e=0;e>>2]>>>16-e%4*8&65535);B.push(String.fromCharCode(f))}return B.join("")},parse:function(u){for(var r=u.length,t=[],B=0;B>>1]|=v(u.charCodeAt(B)<<16-B%2*16);return E.create(t,r*2)}};function v(u){return u<<8&4278255360|u>>>8&16711935}})(),h.enc.Utf16})})(F0)),F0.exports}var D0={exports:{}},Sx=D0.exports,Fr;function e0(){return Fr||(Fr=1,(function(R,$){(function(h,x){R.exports=x(L())})(Sx,function(h){return(function(){var x=h,D=x.lib,E=D.WordArray,g=x.enc;g.Base64={stringify:function(u){var r=u.words,t=u.sigBytes,B=this._map;u.clamp();for(var e=[],f=0;f>>2]>>>24-f%4*8&255,c=r[f+1>>>2]>>>24-(f+1)%4*8&255,s=r[f+2>>>2]>>>24-(f+2)%4*8&255,l=o<<16|c<<8|s,a=0;a<4&&f+a*.75>>6*(3-a)&63));var n=B.charAt(64);if(n)for(;e.length%4;)e.push(n);return e.join("")},parse:function(u){var r=u.length,t=this._map,B=this._reverseMap;if(!B){B=this._reverseMap=[];for(var e=0;e>>6-f%4*2,s=o|c;B[e>>>2]|=s<<24-e%4*8,e++}return E.create(B,e)}})(),h.enc.Base64})})(D0)),D0.exports}var _0={exports:{}},Rx=_0.exports,Dr;function zx(){return Dr||(Dr=1,(function(R,$){(function(h,x){R.exports=x(L())})(Rx,function(h){return(function(){var x=h,D=x.lib,E=D.WordArray,g=x.enc;g.Base64url={stringify:function(u,r){r===void 0&&(r=!0);var t=u.words,B=u.sigBytes,e=r?this._safe_map:this._map;u.clamp();for(var f=[],o=0;o>>2]>>>24-o%4*8&255,s=t[o+1>>>2]>>>24-(o+1)%4*8&255,l=t[o+2>>>2]>>>24-(o+2)%4*8&255,a=c<<16|s<<8|l,n=0;n<4&&o+n*.75>>6*(3-n)&63));var i=e.charAt(64);if(i)for(;f.length%4;)f.push(i);return f.join("")},parse:function(u,r){r===void 0&&(r=!0);var t=u.length,B=r?this._safe_map:this._map,e=this._reverseMap;if(!e){e=this._reverseMap=[];for(var f=0;f>>6-f%4*2,s=o|c;B[e>>>2]|=s<<24-e%4*8,e++}return E.create(B,e)}})(),h.enc.Base64url})})(_0)),_0.exports}var b0={exports:{}},qx=b0.exports,_r;function t0(){return _r||(_r=1,(function(R,$){(function(h,x){R.exports=x(L())})(qx,function(h){return(function(x){var D=h,E=D.lib,g=E.WordArray,v=E.Hasher,u=D.algo,r=[];(function(){for(var c=0;c<64;c++)r[c]=x.abs(x.sin(c+1))*4294967296|0})();var t=u.MD5=v.extend({_doReset:function(){this._hash=new g.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(c,s){for(var l=0;l<16;l++){var a=s+l,n=c[a];c[a]=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360}var i=this._hash.words,p=c[s+0],C=c[s+1],A=c[s+2],_=c[s+3],S=c[s+4],d=c[s+5],F=c[s+6],y=c[s+7],k=c[s+8],z=c[s+9],q=c[s+10],P=c[s+11],O=c[s+12],I=c[s+13],N=c[s+14],T=c[s+15],b=i[0],w=i[1],m=i[2],H=i[3];b=B(b,w,m,H,p,7,r[0]),H=B(H,b,w,m,C,12,r[1]),m=B(m,H,b,w,A,17,r[2]),w=B(w,m,H,b,_,22,r[3]),b=B(b,w,m,H,S,7,r[4]),H=B(H,b,w,m,d,12,r[5]),m=B(m,H,b,w,F,17,r[6]),w=B(w,m,H,b,y,22,r[7]),b=B(b,w,m,H,k,7,r[8]),H=B(H,b,w,m,z,12,r[9]),m=B(m,H,b,w,q,17,r[10]),w=B(w,m,H,b,P,22,r[11]),b=B(b,w,m,H,O,7,r[12]),H=B(H,b,w,m,I,12,r[13]),m=B(m,H,b,w,N,17,r[14]),w=B(w,m,H,b,T,22,r[15]),b=e(b,w,m,H,C,5,r[16]),H=e(H,b,w,m,F,9,r[17]),m=e(m,H,b,w,P,14,r[18]),w=e(w,m,H,b,p,20,r[19]),b=e(b,w,m,H,d,5,r[20]),H=e(H,b,w,m,q,9,r[21]),m=e(m,H,b,w,T,14,r[22]),w=e(w,m,H,b,S,20,r[23]),b=e(b,w,m,H,z,5,r[24]),H=e(H,b,w,m,N,9,r[25]),m=e(m,H,b,w,_,14,r[26]),w=e(w,m,H,b,k,20,r[27]),b=e(b,w,m,H,I,5,r[28]),H=e(H,b,w,m,A,9,r[29]),m=e(m,H,b,w,y,14,r[30]),w=e(w,m,H,b,O,20,r[31]),b=f(b,w,m,H,d,4,r[32]),H=f(H,b,w,m,k,11,r[33]),m=f(m,H,b,w,P,16,r[34]),w=f(w,m,H,b,N,23,r[35]),b=f(b,w,m,H,C,4,r[36]),H=f(H,b,w,m,S,11,r[37]),m=f(m,H,b,w,y,16,r[38]),w=f(w,m,H,b,q,23,r[39]),b=f(b,w,m,H,I,4,r[40]),H=f(H,b,w,m,p,11,r[41]),m=f(m,H,b,w,_,16,r[42]),w=f(w,m,H,b,F,23,r[43]),b=f(b,w,m,H,z,4,r[44]),H=f(H,b,w,m,O,11,r[45]),m=f(m,H,b,w,T,16,r[46]),w=f(w,m,H,b,A,23,r[47]),b=o(b,w,m,H,p,6,r[48]),H=o(H,b,w,m,y,10,r[49]),m=o(m,H,b,w,N,15,r[50]),w=o(w,m,H,b,d,21,r[51]),b=o(b,w,m,H,O,6,r[52]),H=o(H,b,w,m,_,10,r[53]),m=o(m,H,b,w,q,15,r[54]),w=o(w,m,H,b,C,21,r[55]),b=o(b,w,m,H,k,6,r[56]),H=o(H,b,w,m,T,10,r[57]),m=o(m,H,b,w,F,15,r[58]),w=o(w,m,H,b,I,21,r[59]),b=o(b,w,m,H,S,6,r[60]),H=o(H,b,w,m,P,10,r[61]),m=o(m,H,b,w,A,15,r[62]),w=o(w,m,H,b,z,21,r[63]),i[0]=i[0]+b|0,i[1]=i[1]+w|0,i[2]=i[2]+m|0,i[3]=i[3]+H|0},_doFinalize:function(){var c=this._data,s=c.words,l=this._nDataBytes*8,a=c.sigBytes*8;s[a>>>5]|=128<<24-a%32;var n=x.floor(l/4294967296),i=l;s[(a+64>>>9<<4)+15]=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,s[(a+64>>>9<<4)+14]=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360,c.sigBytes=(s.length+1)*4,this._process();for(var p=this._hash,C=p.words,A=0;A<4;A++){var _=C[A];C[A]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360}return p},clone:function(){var c=v.clone.call(this);return c._hash=this._hash.clone(),c}});function B(c,s,l,a,n,i,p){var C=c+(s&l|~s&a)+n+p;return(C<>>32-i)+s}function e(c,s,l,a,n,i,p){var C=c+(s&a|l&~a)+n+p;return(C<>>32-i)+s}function f(c,s,l,a,n,i,p){var C=c+(s^l^a)+n+p;return(C<>>32-i)+s}function o(c,s,l,a,n,i,p){var C=c+(l^(s|~a))+n+p;return(C<>>32-i)+s}D.MD5=v._createHelper(t),D.HmacMD5=v._createHmacHelper(t)})(Math),h.MD5})})(b0)),b0.exports}var g0={exports:{}},$x=g0.exports,br;function Jr(){return br||(br=1,(function(R,$){(function(h,x){R.exports=x(L())})($x,function(h){return(function(){var x=h,D=x.lib,E=D.WordArray,g=D.Hasher,v=x.algo,u=[],r=v.SHA1=g.extend({_doReset:function(){this._hash=new E.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,B){for(var e=this._hash.words,f=e[0],o=e[1],c=e[2],s=e[3],l=e[4],a=0;a<80;a++){if(a<16)u[a]=t[B+a]|0;else{var n=u[a-3]^u[a-8]^u[a-14]^u[a-16];u[a]=n<<1|n>>>31}var i=(f<<5|f>>>27)+l+u[a];a<20?i+=(o&c|~o&s)+1518500249:a<40?i+=(o^c^s)+1859775393:a<60?i+=(o&c|o&s|c&s)-1894007588:i+=(o^c^s)-899497514,l=s,s=c,c=o<<30|o>>>2,o=f,f=i}e[0]=e[0]+f|0,e[1]=e[1]+o|0,e[2]=e[2]+c|0,e[3]=e[3]+s|0,e[4]=e[4]+l|0},_doFinalize:function(){var t=this._data,B=t.words,e=this._nDataBytes*8,f=t.sigBytes*8;return B[f>>>5]|=128<<24-f%32,B[(f+64>>>9<<4)+14]=Math.floor(e/4294967296),B[(f+64>>>9<<4)+15]=e,t.sigBytes=B.length*4,this._process(),this._hash},clone:function(){var t=g.clone.call(this);return t._hash=this._hash.clone(),t}});x.SHA1=g._createHelper(r),x.HmacSHA1=g._createHmacHelper(r)})(),h.SHA1})})(g0)),g0.exports}var y0={exports:{}},Px=y0.exports,gr;function tr(){return gr||(gr=1,(function(R,$){(function(h,x){R.exports=x(L())})(Px,function(h){return(function(x){var D=h,E=D.lib,g=E.WordArray,v=E.Hasher,u=D.algo,r=[],t=[];(function(){function f(l){for(var a=x.sqrt(l),n=2;n<=a;n++)if(!(l%n))return!1;return!0}function o(l){return(l-(l|0))*4294967296|0}for(var c=2,s=0;s<64;)f(c)&&(s<8&&(r[s]=o(x.pow(c,1/2))),t[s]=o(x.pow(c,1/3)),s++),c++})();var B=[],e=u.SHA256=v.extend({_doReset:function(){this._hash=new g.init(r.slice(0))},_doProcessBlock:function(f,o){for(var c=this._hash.words,s=c[0],l=c[1],a=c[2],n=c[3],i=c[4],p=c[5],C=c[6],A=c[7],_=0;_<64;_++){if(_<16)B[_]=f[o+_]|0;else{var S=B[_-15],d=(S<<25|S>>>7)^(S<<14|S>>>18)^S>>>3,F=B[_-2],y=(F<<15|F>>>17)^(F<<13|F>>>19)^F>>>10;B[_]=d+B[_-7]+y+B[_-16]}var k=i&p^~i&C,z=s&l^s&a^l&a,q=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),P=(i<<26|i>>>6)^(i<<21|i>>>11)^(i<<7|i>>>25),O=A+P+k+t[_]+B[_],I=q+z;A=C,C=p,p=i,i=n+O|0,n=a,a=l,l=s,s=O+I|0}c[0]=c[0]+s|0,c[1]=c[1]+l|0,c[2]=c[2]+a|0,c[3]=c[3]+n|0,c[4]=c[4]+i|0,c[5]=c[5]+p|0,c[6]=c[6]+C|0,c[7]=c[7]+A|0},_doFinalize:function(){var f=this._data,o=f.words,c=this._nDataBytes*8,s=f.sigBytes*8;return o[s>>>5]|=128<<24-s%32,o[(s+64>>>9<<4)+14]=x.floor(c/4294967296),o[(s+64>>>9<<4)+15]=c,f.sigBytes=o.length*4,this._process(),this._hash},clone:function(){var f=v.clone.call(this);return f._hash=this._hash.clone(),f}});D.SHA256=v._createHelper(e),D.HmacSHA256=v._createHmacHelper(e)})(Math),h.SHA256})})(y0)),y0.exports}var k0={exports:{}},Wx=k0.exports,yr;function Lx(){return yr||(yr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),tr())})(Wx,function(h){return(function(){var x=h,D=x.lib,E=D.WordArray,g=x.algo,v=g.SHA256,u=g.SHA224=v.extend({_doReset:function(){this._hash=new E.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var r=v._doFinalize.call(this);return r.sigBytes-=4,r}});x.SHA224=v._createHelper(u),x.HmacSHA224=v._createHmacHelper(u)})(),h.SHA224})})(k0)),k0.exports}var H0={exports:{}},Ix=H0.exports,kr;function rx(){return kr||(kr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),J0())})(Ix,function(h){return(function(){var x=h,D=x.lib,E=D.Hasher,g=x.x64,v=g.Word,u=g.WordArray,r=x.algo;function t(){return v.create.apply(v,arguments)}var B=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],e=[];(function(){for(var o=0;o<80;o++)e[o]=t()})();var f=r.SHA512=E.extend({_doReset:function(){this._hash=new u.init([new v.init(1779033703,4089235720),new v.init(3144134277,2227873595),new v.init(1013904242,4271175723),new v.init(2773480762,1595750129),new v.init(1359893119,2917565137),new v.init(2600822924,725511199),new v.init(528734635,4215389547),new v.init(1541459225,327033209)])},_doProcessBlock:function(o,c){for(var s=this._hash.words,l=s[0],a=s[1],n=s[2],i=s[3],p=s[4],C=s[5],A=s[6],_=s[7],S=l.high,d=l.low,F=a.high,y=a.low,k=n.high,z=n.low,q=i.high,P=i.low,O=p.high,I=p.low,N=C.high,T=C.low,b=A.high,w=A.low,m=_.high,H=_.low,X=S,K=d,G=F,W=y,i0=k,a0=z,rr=q,s0=P,M=O,Z=I,B0=N,f0=T,h0=b,c0=w,xr=m,v0=H,V=0;V<80;V++){var Y,J,l0=e[V];if(V<16)J=l0.high=o[c+V*2]|0,Y=l0.low=o[c+V*2+1]|0;else{var nr=e[V-15],n0=nr.high,d0=nr.low,xx=(n0>>>1|d0<<31)^(n0>>>8|d0<<24)^n0>>>7,or=(d0>>>1|n0<<31)^(d0>>>8|n0<<24)^(d0>>>7|n0<<25),ir=e[V-2],o0=ir.high,u0=ir.low,ex=(o0>>>19|u0<<13)^(o0<<3|u0>>>29)^o0>>>6,sr=(u0>>>19|o0<<13)^(u0<<3|o0>>>29)^(u0>>>6|o0<<26),fr=e[V-7],tx=fr.high,ax=fr.low,cr=e[V-16],nx=cr.high,vr=cr.low;Y=or+ax,J=xx+tx+(Y>>>0>>0?1:0),Y=Y+sr,J=J+ex+(Y>>>0>>0?1:0),Y=Y+vr,J=J+nx+(Y>>>0>>0?1:0),l0.high=J,l0.low=Y}var ox=M&B0^~M&h0,dr=Z&f0^~Z&c0,ix=X&G^X&i0^G&i0,sx=K&W^K&a0^W&a0,fx=(X>>>28|K<<4)^(X<<30|K>>>2)^(X<<25|K>>>7),ur=(K>>>28|X<<4)^(K<<30|X>>>2)^(K<<25|X>>>7),cx=(M>>>14|Z<<18)^(M>>>18|Z<<14)^(M<<23|Z>>>9),vx=(Z>>>14|M<<18)^(Z>>>18|M<<14)^(Z<<23|M>>>9),Br=B[V],dx=Br.high,hr=Br.low,Q=v0+vx,r0=xr+cx+(Q>>>0>>0?1:0),Q=Q+dr,r0=r0+ox+(Q>>>0>>0?1:0),Q=Q+hr,r0=r0+dx+(Q>>>0
        >>0?1:0),Q=Q+Y,r0=r0+J+(Q>>>0>>0?1:0),lr=ur+sx,ux=fx+ix+(lr>>>0>>0?1:0);xr=h0,v0=c0,h0=B0,c0=f0,B0=M,f0=Z,Z=s0+Q|0,M=rr+r0+(Z>>>0>>0?1:0)|0,rr=i0,s0=a0,i0=G,a0=W,G=X,W=K,K=Q+lr|0,X=r0+ux+(K>>>0>>0?1:0)|0}d=l.low=d+K,l.high=S+X+(d>>>0>>0?1:0),y=a.low=y+W,a.high=F+G+(y>>>0>>0?1:0),z=n.low=z+a0,n.high=k+i0+(z>>>0>>0?1:0),P=i.low=P+s0,i.high=q+rr+(P>>>0>>0?1:0),I=p.low=I+Z,p.high=O+M+(I>>>0>>0?1:0),T=C.low=T+f0,C.high=N+B0+(T>>>0>>0?1:0),w=A.low=w+c0,A.high=b+h0+(w>>>0>>0?1:0),H=_.low=H+v0,_.high=m+xr+(H>>>0>>0?1:0)},_doFinalize:function(){var o=this._data,c=o.words,s=this._nDataBytes*8,l=o.sigBytes*8;c[l>>>5]|=128<<24-l%32,c[(l+128>>>10<<5)+30]=Math.floor(s/4294967296),c[(l+128>>>10<<5)+31]=s,o.sigBytes=c.length*4,this._process();var a=this._hash.toX32();return a},clone:function(){var o=E.clone.call(this);return o._hash=this._hash.clone(),o},blockSize:1024/32});x.SHA512=E._createHelper(f),x.HmacSHA512=E._createHmacHelper(f)})(),h.SHA512})})(H0)),H0.exports}var w0={exports:{}},Tx=w0.exports,Hr;function Nx(){return Hr||(Hr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),J0(),rx())})(Tx,function(h){return(function(){var x=h,D=x.x64,E=D.Word,g=D.WordArray,v=x.algo,u=v.SHA512,r=v.SHA384=u.extend({_doReset:function(){this._hash=new g.init([new E.init(3418070365,3238371032),new E.init(1654270250,914150663),new E.init(2438529370,812702999),new E.init(355462360,4144912697),new E.init(1731405415,4290775857),new E.init(2394180231,1750603025),new E.init(3675008525,1694076839),new E.init(1203062813,3204075428)])},_doFinalize:function(){var t=u._doFinalize.call(this);return t.sigBytes-=16,t}});x.SHA384=u._createHelper(r),x.HmacSHA384=u._createHmacHelper(r)})(),h.SHA384})})(w0)),w0.exports}var m0={exports:{}},Kx=m0.exports,wr;function Ox(){return wr||(wr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),J0())})(Kx,function(h){return(function(x){var D=h,E=D.lib,g=E.WordArray,v=E.Hasher,u=D.x64,r=u.Word,t=D.algo,B=[],e=[],f=[];(function(){for(var s=1,l=0,a=0;a<24;a++){B[s+5*l]=(a+1)*(a+2)/2%64;var n=l%5,i=(2*s+3*l)%5;s=n,l=i}for(var s=0;s<5;s++)for(var l=0;l<5;l++)e[s+5*l]=l+(2*s+3*l)%5*5;for(var p=1,C=0;C<24;C++){for(var A=0,_=0,S=0;S<7;S++){if(p&1){var d=(1<>>24)&16711935|(p<<24|p>>>8)&4278255360,C=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360;var A=a[i];A.high^=C,A.low^=p}for(var _=0;_<24;_++){for(var S=0;S<5;S++){for(var d=0,F=0,y=0;y<5;y++){var A=a[S+5*y];d^=A.high,F^=A.low}var k=o[S];k.high=d,k.low=F}for(var S=0;S<5;S++)for(var z=o[(S+4)%5],q=o[(S+1)%5],P=q.high,O=q.low,d=z.high^(P<<1|O>>>31),F=z.low^(O<<1|P>>>31),y=0;y<5;y++){var A=a[S+5*y];A.high^=d,A.low^=F}for(var I=1;I<25;I++){var d,F,A=a[I],N=A.high,T=A.low,b=B[I];b<32?(d=N<>>32-b,F=T<>>32-b):(d=T<>>64-b,F=N<>>64-b);var w=o[e[I]];w.high=d,w.low=F}var m=o[0],H=a[0];m.high=H.high,m.low=H.low;for(var S=0;S<5;S++)for(var y=0;y<5;y++){var I=S+5*y,A=a[I],X=o[I],K=o[(S+1)%5+5*y],G=o[(S+2)%5+5*y];A.high=X.high^~K.high&G.high,A.low=X.low^~K.low&G.low}var A=a[0],W=f[_];A.high^=W.high,A.low^=W.low}},_doFinalize:function(){var s=this._data,l=s.words;this._nDataBytes*8;var a=s.sigBytes*8,n=this.blockSize*32;l[a>>>5]|=1<<24-a%32,l[(x.ceil((a+1)/n)*n>>>5)-1]|=128,s.sigBytes=l.length*4,this._process();for(var i=this._state,p=this.cfg.outputLength/8,C=p/8,A=[],_=0;_>>24)&16711935|(d<<24|d>>>8)&4278255360,F=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,A.push(F),A.push(d)}return new g.init(A,p)},clone:function(){for(var s=v.clone.call(this),l=s._state=this._state.slice(0),a=0;a<25;a++)l[a]=l[a].clone();return s}});D.SHA3=v._createHelper(c),D.HmacSHA3=v._createHmacHelper(c)})(Math),h.SHA3})})(m0)),m0.exports}var S0={exports:{}},Xx=S0.exports,mr;function Ux(){return mr||(mr=1,(function(R,$){(function(h,x){R.exports=x(L())})(Xx,function(h){return(function(x){var D=h,E=D.lib,g=E.WordArray,v=E.Hasher,u=D.algo,r=g.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),t=g.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),B=g.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),e=g.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),f=g.create([0,1518500249,1859775393,2400959708,2840853838]),o=g.create([1352829926,1548603684,1836072691,2053994217,0]),c=u.RIPEMD160=v.extend({_doReset:function(){this._hash=g.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(C,A){for(var _=0;_<16;_++){var S=A+_,d=C[S];C[S]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360}var F=this._hash.words,y=f.words,k=o.words,z=r.words,q=t.words,P=B.words,O=e.words,I,N,T,b,w,m,H,X,K,G;m=I=F[0],H=N=F[1],X=T=F[2],K=b=F[3],G=w=F[4];for(var W,_=0;_<80;_+=1)W=I+C[A+z[_]]|0,_<16?W+=s(N,T,b)+y[0]:_<32?W+=l(N,T,b)+y[1]:_<48?W+=a(N,T,b)+y[2]:_<64?W+=n(N,T,b)+y[3]:W+=i(N,T,b)+y[4],W=W|0,W=p(W,P[_]),W=W+w|0,I=w,w=b,b=p(T,10),T=N,N=W,W=m+C[A+q[_]]|0,_<16?W+=i(H,X,K)+k[0]:_<32?W+=n(H,X,K)+k[1]:_<48?W+=a(H,X,K)+k[2]:_<64?W+=l(H,X,K)+k[3]:W+=s(H,X,K)+k[4],W=W|0,W=p(W,O[_]),W=W+G|0,m=G,G=K,K=p(X,10),X=H,H=W;W=F[1]+T+K|0,F[1]=F[2]+b+G|0,F[2]=F[3]+w+m|0,F[3]=F[4]+I+H|0,F[4]=F[0]+N+X|0,F[0]=W},_doFinalize:function(){var C=this._data,A=C.words,_=this._nDataBytes*8,S=C.sigBytes*8;A[S>>>5]|=128<<24-S%32,A[(S+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,C.sigBytes=(A.length+1)*4,this._process();for(var d=this._hash,F=d.words,y=0;y<5;y++){var k=F[y];F[y]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360}return d},clone:function(){var C=v.clone.call(this);return C._hash=this._hash.clone(),C}});function s(C,A,_){return C^A^_}function l(C,A,_){return C&A|~C&_}function a(C,A,_){return(C|~A)^_}function n(C,A,_){return C&_|A&~_}function i(C,A,_){return C^(A|~_)}function p(C,A){return C<>>32-A}D.RIPEMD160=v._createHelper(c),D.HmacRIPEMD160=v._createHmacHelper(c)})(),h.RIPEMD160})})(S0)),S0.exports}var R0={exports:{}},Gx=R0.exports,Sr;function ar(){return Sr||(Sr=1,(function(R,$){(function(h,x){R.exports=x(L())})(Gx,function(h){(function(){var x=h,D=x.lib,E=D.Base,g=x.enc,v=g.Utf8,u=x.algo;u.HMAC=E.extend({init:function(r,t){r=this._hasher=new r.init,typeof t=="string"&&(t=v.parse(t));var B=r.blockSize,e=B*4;t.sigBytes>e&&(t=r.finalize(t)),t.clamp();for(var f=this._oKey=t.clone(),o=this._iKey=t.clone(),c=f.words,s=o.words,l=0;l>>2]&255;d.sigBytes-=F}};E.BlockCipher=f.extend({cfg:f.cfg.extend({mode:s,padding:a}),reset:function(){var d;f.reset.call(this);var F=this.cfg,y=F.iv,k=F.mode;this._xformMode==this._ENC_XFORM_MODE?d=k.createEncryptor:(d=k.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==d?this._mode.init(this,y&&y.words):(this._mode=d.call(k,this,y&&y.words),this._mode.__creator=d)},_doProcessBlock:function(d,F){this._mode.processBlock(d,F)},_doFinalize:function(){var d,F=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(F.pad(this._data,this.blockSize),d=this._process(!0)):(d=this._process(!0),F.unpad(d)),d},blockSize:128/32});var n=E.CipherParams=g.extend({init:function(d){this.mixIn(d)},toString:function(d){return(d||this.formatter).stringify(this)}}),i=D.format={},p=i.OpenSSL={stringify:function(d){var F,y=d.ciphertext,k=d.salt;return k?F=v.create([1398893684,1701076831]).concat(k).concat(y):F=y,F.toString(t)},parse:function(d){var F,y=t.parse(d),k=y.words;return k[0]==1398893684&&k[1]==1701076831&&(F=v.create(k.slice(2,4)),k.splice(0,4),y.sigBytes-=16),n.create({ciphertext:y,salt:F})}},C=E.SerializableCipher=g.extend({cfg:g.extend({format:p}),encrypt:function(d,F,y,k){k=this.cfg.extend(k);var z=d.createEncryptor(y,k),q=z.finalize(F),P=z.cfg;return n.create({ciphertext:q,key:y,iv:P.iv,algorithm:d,mode:P.mode,padding:P.padding,blockSize:d.blockSize,formatter:k.format})},decrypt:function(d,F,y,k){k=this.cfg.extend(k),F=this._parse(F,k.format);var z=d.createDecryptor(y,k).finalize(F.ciphertext);return z},_parse:function(d,F){return typeof d=="string"?F.parse(d,this):d}}),A=D.kdf={},_=A.OpenSSL={execute:function(d,F,y,k,z){if(k||(k=v.random(64/8)),z)var q=e.create({keySize:F+y,hasher:z}).compute(d,k);else var q=e.create({keySize:F+y}).compute(d,k);var P=v.create(q.words.slice(F),y*4);return q.sigBytes=F*4,n.create({key:q,iv:P,salt:k})}},S=E.PasswordBasedCipher=C.extend({cfg:C.cfg.extend({kdf:_}),encrypt:function(d,F,y,k){k=this.cfg.extend(k);var z=k.kdf.execute(y,d.keySize,d.ivSize,k.salt,k.hasher);k.iv=z.iv;var q=C.encrypt.call(this,d,F,z.key,k);return q.mixIn(z),q},decrypt:function(d,F,y,k){k=this.cfg.extend(k),F=this._parse(F,k.format);var z=k.kdf.execute(y,d.keySize,d.ivSize,F.salt,k.hasher);k.iv=z.iv;var q=C.decrypt.call(this,d,F,z.key,k);return q}})})()})})($0)),$0.exports}var P0={exports:{}},Mx=P0.exports,$r;function Vx(){return $r||($r=1,(function(R,$){(function(h,x,D){R.exports=x(L(),U())})(Mx,function(h){return h.mode.CFB=(function(){var x=h.lib.BlockCipherMode.extend();x.Encryptor=x.extend({processBlock:function(E,g){var v=this._cipher,u=v.blockSize;D.call(this,E,g,u,v),this._prevBlock=E.slice(g,g+u)}}),x.Decryptor=x.extend({processBlock:function(E,g){var v=this._cipher,u=v.blockSize,r=E.slice(g,g+u);D.call(this,E,g,u,v),this._prevBlock=r}});function D(E,g,v,u){var r,t=this._iv;t?(r=t.slice(0),this._iv=void 0):r=this._prevBlock,u.encryptBlock(r,0);for(var B=0;B>24&255)===255){var u=v>>16&255,r=v>>8&255,t=v&255;u===255?(u=0,r===255?(r=0,t===255?t=0:++t):++r):++u,v=0,v+=u<<16,v+=r<<8,v+=t}else v+=1<<24;return v}function E(v){return(v[0]=D(v[0]))===0&&(v[1]=D(v[1])),v}var g=x.Encryptor=x.extend({processBlock:function(v,u){var r=this._cipher,t=r.blockSize,B=this._iv,e=this._counter;B&&(e=this._counter=B.slice(0),this._iv=void 0),E(e);var f=e.slice(0);r.encryptBlock(f,0);for(var o=0;o>>2]|=v<<24-u%4*8,x.sigBytes+=v},unpad:function(x){var D=x.words[x.sigBytes-1>>>2]&255;x.sigBytes-=D}},h.pad.Ansix923})})(N0)),N0.exports}var K0={exports:{}},fe=K0.exports,Nr;function ce(){return Nr||(Nr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),U())})(fe,function(h){return h.pad.Iso10126={pad:function(x,D){var E=D*4,g=E-x.sigBytes%E;x.concat(h.lib.WordArray.random(g-1)).concat(h.lib.WordArray.create([g<<24],1))},unpad:function(x){var D=x.words[x.sigBytes-1>>>2]&255;x.sigBytes-=D}},h.pad.Iso10126})})(K0)),K0.exports}var O0={exports:{}},ve=O0.exports,Kr;function de(){return Kr||(Kr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),U())})(ve,function(h){return h.pad.Iso97971={pad:function(x,D){x.concat(h.lib.WordArray.create([2147483648],1)),h.pad.ZeroPadding.pad(x,D)},unpad:function(x){h.pad.ZeroPadding.unpad(x),x.sigBytes--}},h.pad.Iso97971})})(O0)),O0.exports}var X0={exports:{}},ue=X0.exports,Or;function Be(){return Or||(Or=1,(function(R,$){(function(h,x,D){R.exports=x(L(),U())})(ue,function(h){return h.pad.ZeroPadding={pad:function(x,D){var E=D*4;x.clamp(),x.sigBytes+=E-(x.sigBytes%E||E)},unpad:function(x){for(var D=x.words,E=x.sigBytes-1,E=x.sigBytes-1;E>=0;E--)if(D[E>>>2]>>>24-E%4*8&255){x.sigBytes=E+1;break}}},h.pad.ZeroPadding})})(X0)),X0.exports}var U0={exports:{}},he=U0.exports,Xr;function le(){return Xr||(Xr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),U())})(he,function(h){return h.pad.NoPadding={pad:function(){},unpad:function(){}},h.pad.NoPadding})})(U0)),U0.exports}var G0={exports:{}},Ce=G0.exports,Ur;function pe(){return Ur||(Ur=1,(function(R,$){(function(h,x,D){R.exports=x(L(),U())})(Ce,function(h){return(function(x){var D=h,E=D.lib,g=E.CipherParams,v=D.enc,u=v.Hex,r=D.format;r.Hex={stringify:function(t){return t.ciphertext.toString(u)},parse:function(t){var B=u.parse(t);return g.create({ciphertext:B})}}})(),h.format.Hex})})(G0)),G0.exports}var Z0={exports:{}},Ee=Z0.exports,Gr;function Ae(){return Gr||(Gr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),e0(),t0(),x0(),U())})(Ee,function(h){return(function(){var x=h,D=x.lib,E=D.BlockCipher,g=x.algo,v=[],u=[],r=[],t=[],B=[],e=[],f=[],o=[],c=[],s=[];(function(){for(var n=[],i=0;i<256;i++)i<128?n[i]=i<<1:n[i]=i<<1^283;for(var p=0,C=0,i=0;i<256;i++){var A=C^C<<1^C<<2^C<<3^C<<4;A=A>>>8^A&255^99,v[p]=A,u[A]=p;var _=n[p],S=n[_],d=n[S],F=n[A]*257^A*16843008;r[p]=F<<24|F>>>8,t[p]=F<<16|F>>>16,B[p]=F<<8|F>>>24,e[p]=F;var F=d*16843009^S*65537^_*257^p*16843008;f[A]=F<<24|F>>>8,o[A]=F<<16|F>>>16,c[A]=F<<8|F>>>24,s[A]=F,p?(p=_^n[n[n[d^_]]],C^=n[n[C]]):p=C=1}})();var l=[0,1,2,4,8,16,32,64,128,27,54],a=g.AES=E.extend({_doReset:function(){var n;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var i=this._keyPriorReset=this._key,p=i.words,C=i.sigBytes/4,A=this._nRounds=C+6,_=(A+1)*4,S=this._keySchedule=[],d=0;d<_;d++)d6&&d%C==4&&(n=v[n>>>24]<<24|v[n>>>16&255]<<16|v[n>>>8&255]<<8|v[n&255]):(n=n<<8|n>>>24,n=v[n>>>24]<<24|v[n>>>16&255]<<16|v[n>>>8&255]<<8|v[n&255],n^=l[d/C|0]<<24),S[d]=S[d-C]^n);for(var F=this._invKeySchedule=[],y=0;y<_;y++){var d=_-y;if(y%4)var n=S[d];else var n=S[d-4];y<4||d<=4?F[y]=n:F[y]=f[v[n>>>24]]^o[v[n>>>16&255]]^c[v[n>>>8&255]]^s[v[n&255]]}}},encryptBlock:function(n,i){this._doCryptBlock(n,i,this._keySchedule,r,t,B,e,v)},decryptBlock:function(n,i){var p=n[i+1];n[i+1]=n[i+3],n[i+3]=p,this._doCryptBlock(n,i,this._invKeySchedule,f,o,c,s,u);var p=n[i+1];n[i+1]=n[i+3],n[i+3]=p},_doCryptBlock:function(n,i,p,C,A,_,S,d){for(var F=this._nRounds,y=n[i]^p[0],k=n[i+1]^p[1],z=n[i+2]^p[2],q=n[i+3]^p[3],P=4,O=1;O>>24]^A[k>>>16&255]^_[z>>>8&255]^S[q&255]^p[P++],N=C[k>>>24]^A[z>>>16&255]^_[q>>>8&255]^S[y&255]^p[P++],T=C[z>>>24]^A[q>>>16&255]^_[y>>>8&255]^S[k&255]^p[P++],b=C[q>>>24]^A[y>>>16&255]^_[k>>>8&255]^S[z&255]^p[P++];y=I,k=N,z=T,q=b}var I=(d[y>>>24]<<24|d[k>>>16&255]<<16|d[z>>>8&255]<<8|d[q&255])^p[P++],N=(d[k>>>24]<<24|d[z>>>16&255]<<16|d[q>>>8&255]<<8|d[y&255])^p[P++],T=(d[z>>>24]<<24|d[q>>>16&255]<<16|d[y>>>8&255]<<8|d[k&255])^p[P++],b=(d[q>>>24]<<24|d[y>>>16&255]<<16|d[k>>>8&255]<<8|d[z&255])^p[P++];n[i]=I,n[i+1]=N,n[i+2]=T,n[i+3]=b},keySize:256/32});x.AES=E._createHelper(a)})(),h.AES})})(Z0)),Z0.exports}var Q0={exports:{}},Fe=Q0.exports,Zr;function De(){return Zr||(Zr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),e0(),t0(),x0(),U())})(Fe,function(h){return(function(){var x=h,D=x.lib,E=D.WordArray,g=D.BlockCipher,v=x.algo,u=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],r=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],t=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],B=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],e=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],f=v.DES=g.extend({_doReset:function(){for(var l=this._key,a=l.words,n=[],i=0;i<56;i++){var p=u[i]-1;n[i]=a[p>>>5]>>>31-p%32&1}for(var C=this._subKeys=[],A=0;A<16;A++){for(var _=C[A]=[],S=t[A],i=0;i<24;i++)_[i/6|0]|=n[(r[i]-1+S)%28]<<31-i%6,_[4+(i/6|0)]|=n[28+(r[i+24]-1+S)%28]<<31-i%6;_[0]=_[0]<<1|_[0]>>>31;for(var i=1;i<7;i++)_[i]=_[i]>>>(i-1)*4+3;_[7]=_[7]<<5|_[7]>>>27}for(var d=this._invSubKeys=[],i=0;i<16;i++)d[i]=C[15-i]},encryptBlock:function(l,a){this._doCryptBlock(l,a,this._subKeys)},decryptBlock:function(l,a){this._doCryptBlock(l,a,this._invSubKeys)},_doCryptBlock:function(l,a,n){this._lBlock=l[a],this._rBlock=l[a+1],o.call(this,4,252645135),o.call(this,16,65535),c.call(this,2,858993459),c.call(this,8,16711935),o.call(this,1,1431655765);for(var i=0;i<16;i++){for(var p=n[i],C=this._lBlock,A=this._rBlock,_=0,S=0;S<8;S++)_|=B[S][((A^p[S])&e[S])>>>0];this._lBlock=A,this._rBlock=C^_}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,o.call(this,1,1431655765),c.call(this,8,16711935),c.call(this,2,858993459),o.call(this,16,65535),o.call(this,4,252645135),l[a]=this._lBlock,l[a+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function o(l,a){var n=(this._lBlock>>>l^this._rBlock)&a;this._rBlock^=n,this._lBlock^=n<>>l^this._lBlock)&a;this._lBlock^=n,this._rBlock^=n<192.");var n=a.slice(0,2),i=a.length<4?a.slice(0,2):a.slice(2,4),p=a.length<6?a.slice(0,2):a.slice(4,6);this._des1=f.createEncryptor(E.create(n)),this._des2=f.createEncryptor(E.create(i)),this._des3=f.createEncryptor(E.create(p))},encryptBlock:function(l,a){this._des1.encryptBlock(l,a),this._des2.decryptBlock(l,a),this._des3.encryptBlock(l,a)},decryptBlock:function(l,a){this._des3.decryptBlock(l,a),this._des2.encryptBlock(l,a),this._des1.decryptBlock(l,a)},keySize:192/32,ivSize:64/32,blockSize:64/32});x.TripleDES=g._createHelper(s)})(),h.TripleDES})})(Q0)),Q0.exports}var Y0={exports:{}},_e=Y0.exports,Qr;function be(){return Qr||(Qr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),e0(),t0(),x0(),U())})(_e,function(h){return(function(){var x=h,D=x.lib,E=D.StreamCipher,g=x.algo,v=g.RC4=E.extend({_doReset:function(){for(var t=this._key,B=t.words,e=t.sigBytes,f=this._S=[],o=0;o<256;o++)f[o]=o;for(var o=0,c=0;o<256;o++){var s=o%e,l=B[s>>>2]>>>24-s%4*8&255;c=(c+f[o]+l)%256;var a=f[o];f[o]=f[c],f[c]=a}this._i=this._j=0},_doProcessBlock:function(t,B){t[B]^=u.call(this)},keySize:256/32,ivSize:0});function u(){for(var t=this._S,B=this._i,e=this._j,f=0,o=0;o<4;o++){B=(B+1)%256,e=(e+t[B])%256;var c=t[B];t[B]=t[e],t[e]=c,f|=t[(t[B]+t[e])%256]<<24-o*8}return this._i=B,this._j=e,f}x.RC4=E._createHelper(v);var r=g.RC4Drop=v.extend({cfg:v.cfg.extend({drop:192}),_doReset:function(){v._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)u.call(this)}});x.RC4Drop=E._createHelper(r)})(),h.RC4})})(Y0)),Y0.exports}var j0={exports:{}},ge=j0.exports,Yr;function ye(){return Yr||(Yr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),e0(),t0(),x0(),U())})(ge,function(h){return(function(){var x=h,D=x.lib,E=D.StreamCipher,g=x.algo,v=[],u=[],r=[],t=g.Rabbit=E.extend({_doReset:function(){for(var e=this._key.words,f=this.cfg.iv,o=0;o<4;o++)e[o]=(e[o]<<8|e[o]>>>24)&16711935|(e[o]<<24|e[o]>>>8)&4278255360;var c=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,e[0]&4294901760|e[1]&65535,e[3]<<16|e[3]>>>16,e[1]&4294901760|e[2]&65535,e[0]<<16|e[0]>>>16,e[2]&4294901760|e[3]&65535,e[1]<<16|e[1]>>>16,e[3]&4294901760|e[0]&65535];this._b=0;for(var o=0;o<4;o++)B.call(this);for(var o=0;o<8;o++)s[o]^=c[o+4&7];if(f){var l=f.words,a=l[0],n=l[1],i=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360,p=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,C=i>>>16|p&4294901760,A=p<<16|i&65535;s[0]^=i,s[1]^=C,s[2]^=p,s[3]^=A,s[4]^=i,s[5]^=C,s[6]^=p,s[7]^=A;for(var o=0;o<4;o++)B.call(this)}},_doProcessBlock:function(e,f){var o=this._X;B.call(this),v[0]=o[0]^o[5]>>>16^o[3]<<16,v[1]=o[2]^o[7]>>>16^o[5]<<16,v[2]=o[4]^o[1]>>>16^o[7]<<16,v[3]=o[6]^o[3]>>>16^o[1]<<16;for(var c=0;c<4;c++)v[c]=(v[c]<<8|v[c]>>>24)&16711935|(v[c]<<24|v[c]>>>8)&4278255360,e[f+c]^=v[c]},blockSize:128/32,ivSize:64/32});function B(){for(var e=this._X,f=this._C,o=0;o<8;o++)u[o]=f[o];f[0]=f[0]+1295307597+this._b|0,f[1]=f[1]+3545052371+(f[0]>>>0>>0?1:0)|0,f[2]=f[2]+886263092+(f[1]>>>0>>0?1:0)|0,f[3]=f[3]+1295307597+(f[2]>>>0>>0?1:0)|0,f[4]=f[4]+3545052371+(f[3]>>>0>>0?1:0)|0,f[5]=f[5]+886263092+(f[4]>>>0>>0?1:0)|0,f[6]=f[6]+1295307597+(f[5]>>>0>>0?1:0)|0,f[7]=f[7]+3545052371+(f[6]>>>0>>0?1:0)|0,this._b=f[7]>>>0>>0?1:0;for(var o=0;o<8;o++){var c=e[o]+f[o],s=c&65535,l=c>>>16,a=((s*s>>>17)+s*l>>>15)+l*l,n=((c&4294901760)*c|0)+((c&65535)*c|0);r[o]=a^n}e[0]=r[0]+(r[7]<<16|r[7]>>>16)+(r[6]<<16|r[6]>>>16)|0,e[1]=r[1]+(r[0]<<8|r[0]>>>24)+r[7]|0,e[2]=r[2]+(r[1]<<16|r[1]>>>16)+(r[0]<<16|r[0]>>>16)|0,e[3]=r[3]+(r[2]<<8|r[2]>>>24)+r[1]|0,e[4]=r[4]+(r[3]<<16|r[3]>>>16)+(r[2]<<16|r[2]>>>16)|0,e[5]=r[5]+(r[4]<<8|r[4]>>>24)+r[3]|0,e[6]=r[6]+(r[5]<<16|r[5]>>>16)+(r[4]<<16|r[4]>>>16)|0,e[7]=r[7]+(r[6]<<8|r[6]>>>24)+r[5]|0}x.Rabbit=E._createHelper(t)})(),h.Rabbit})})(j0)),j0.exports}var M0={exports:{}},ke=M0.exports,jr;function He(){return jr||(jr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),e0(),t0(),x0(),U())})(ke,function(h){return(function(){var x=h,D=x.lib,E=D.StreamCipher,g=x.algo,v=[],u=[],r=[],t=g.RabbitLegacy=E.extend({_doReset:function(){var e=this._key.words,f=this.cfg.iv,o=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],c=this._C=[e[2]<<16|e[2]>>>16,e[0]&4294901760|e[1]&65535,e[3]<<16|e[3]>>>16,e[1]&4294901760|e[2]&65535,e[0]<<16|e[0]>>>16,e[2]&4294901760|e[3]&65535,e[1]<<16|e[1]>>>16,e[3]&4294901760|e[0]&65535];this._b=0;for(var s=0;s<4;s++)B.call(this);for(var s=0;s<8;s++)c[s]^=o[s+4&7];if(f){var l=f.words,a=l[0],n=l[1],i=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360,p=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,C=i>>>16|p&4294901760,A=p<<16|i&65535;c[0]^=i,c[1]^=C,c[2]^=p,c[3]^=A,c[4]^=i,c[5]^=C,c[6]^=p,c[7]^=A;for(var s=0;s<4;s++)B.call(this)}},_doProcessBlock:function(e,f){var o=this._X;B.call(this),v[0]=o[0]^o[5]>>>16^o[3]<<16,v[1]=o[2]^o[7]>>>16^o[5]<<16,v[2]=o[4]^o[1]>>>16^o[7]<<16,v[3]=o[6]^o[3]>>>16^o[1]<<16;for(var c=0;c<4;c++)v[c]=(v[c]<<8|v[c]>>>24)&16711935|(v[c]<<24|v[c]>>>8)&4278255360,e[f+c]^=v[c]},blockSize:128/32,ivSize:64/32});function B(){for(var e=this._X,f=this._C,o=0;o<8;o++)u[o]=f[o];f[0]=f[0]+1295307597+this._b|0,f[1]=f[1]+3545052371+(f[0]>>>0>>0?1:0)|0,f[2]=f[2]+886263092+(f[1]>>>0>>0?1:0)|0,f[3]=f[3]+1295307597+(f[2]>>>0>>0?1:0)|0,f[4]=f[4]+3545052371+(f[3]>>>0>>0?1:0)|0,f[5]=f[5]+886263092+(f[4]>>>0>>0?1:0)|0,f[6]=f[6]+1295307597+(f[5]>>>0>>0?1:0)|0,f[7]=f[7]+3545052371+(f[6]>>>0>>0?1:0)|0,this._b=f[7]>>>0>>0?1:0;for(var o=0;o<8;o++){var c=e[o]+f[o],s=c&65535,l=c>>>16,a=((s*s>>>17)+s*l>>>15)+l*l,n=((c&4294901760)*c|0)+((c&65535)*c|0);r[o]=a^n}e[0]=r[0]+(r[7]<<16|r[7]>>>16)+(r[6]<<16|r[6]>>>16)|0,e[1]=r[1]+(r[0]<<8|r[0]>>>24)+r[7]|0,e[2]=r[2]+(r[1]<<16|r[1]>>>16)+(r[0]<<16|r[0]>>>16)|0,e[3]=r[3]+(r[2]<<8|r[2]>>>24)+r[1]|0,e[4]=r[4]+(r[3]<<16|r[3]>>>16)+(r[2]<<16|r[2]>>>16)|0,e[5]=r[5]+(r[4]<<8|r[4]>>>24)+r[3]|0,e[6]=r[6]+(r[5]<<16|r[5]>>>16)+(r[4]<<16|r[4]>>>16)|0,e[7]=r[7]+(r[6]<<8|r[6]>>>24)+r[5]|0}x.RabbitLegacy=E._createHelper(t)})(),h.RabbitLegacy})})(M0)),M0.exports}var V0={exports:{}},we=V0.exports,Mr;function me(){return Mr||(Mr=1,(function(R,$){(function(h,x,D){R.exports=x(L(),e0(),t0(),x0(),U())})(we,function(h){return(function(){var x=h,D=x.lib,E=D.BlockCipher,g=x.algo;const v=16,u=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],r=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var t={pbox:[],sbox:[]};function B(s,l){let a=l>>24&255,n=l>>16&255,i=l>>8&255,p=l&255,C=s.sbox[0][a]+s.sbox[1][n];return C=C^s.sbox[2][i],C=C+s.sbox[3][p],C}function e(s,l,a){let n=l,i=a,p;for(let C=0;C1;--C)n=n^s.pbox[C],i=B(s,n)^i,p=n,n=i,i=p;return p=n,n=i,i=p,i=i^s.pbox[1],n=n^s.pbox[0],{left:n,right:i}}function o(s,l,a){for(let A=0;A<4;A++){s.sbox[A]=[];for(let _=0;_<256;_++)s.sbox[A][_]=r[A][_]}let n=0;for(let A=0;A=a&&(n=0);let i=0,p=0,C=0;for(let A=0;A{g!==x.props.value&&(g=x.props.value,E(x.props.value,x.props.secret,x.props.storage_key),x.dispatch("change"))}),Ex(()=>{D()}),Ax()}export{Ne as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C3kmU5RB.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C3kmU5RB.css new file mode 100644 index 0000000000000000000000000000000000000000..c9e6efa72afe1dac4aeee2891f5bd099a037898d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C3kmU5RB.css @@ -0,0 +1 @@ +.draggable.svelte-1kr8imm{display:flex;gap:var(--layout-gap);width:var(--size-full);position:relative}.horizontal.svelte-1kr8imm{flex-direction:row;flex-wrap:wrap}.vertical.svelte-1kr8imm{flex-direction:column}.hide.svelte-1kr8imm{display:none}.draggable.svelte-1kr8imm>.draggable-item,.draggable.svelte-1kr8imm>.form>.draggable-item{transition:transform .2s ease,border .2s ease}.draggable.svelte-1kr8imm>.draggable-item.drop-target,.draggable.svelte-1kr8imm>.form>.draggable-item.drop-target{border:2px dashed var(--border-color-primary)!important;border-radius:8px;transform:scale(.98);opacity:.8}.draggable.svelte-1kr8imm>.draggable-item.dragging,.draggable.svelte-1kr8imm>.form>.draggable-item.dragging{opacity:.5;transform:scale(1.02);z-index:1001}.draggable.svelte-1kr8imm>.draggable-item .drag-handle{position:absolute;top:4px;left:4px;width:20px;height:20px;min-width:20px;max-width:20px;min-height:20px;max-height:20px;background:var(--background-fill-secondary);border:1px solid rgba(0,0,0,.2);border-radius:4px;cursor:grab;display:flex;align-items:center;justify-content:center;font-size:10px;color:var(--body-text-color-subdued);opacity:0;transition:opacity .2s ease;z-index:100;user-select:none;flex-shrink:0}.draggable.svelte-1kr8imm>.draggable-item:hover .drag-handle{opacity:1}.draggable.svelte-1kr8imm>.draggable-item .drag-handle:hover{background:var(--background-fill-secondary);border-color:var(--border-color-primary);opacity:1;z-index:101}.draggable.svelte-1kr8imm>.draggable-item .drag-handle:active{cursor:grabbing;background:var(--background-fill-secondary);opacity:1;z-index:101}.horizontal.svelte-1kr8imm>.draggable-item,.horizontal.svelte-1kr8imm>.form>.draggable-item{flex:1 1 0%;flex-wrap:wrap;min-width:min(160px,100%)}.vertical.svelte-1kr8imm>.draggable-item,.vertical.svelte-1kr8imm>.form>.draggable-item{width:var(--size-full)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C6F3e_Rs.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C6F3e_Rs.js new file mode 100644 index 0000000000000000000000000000000000000000..eebc86f120bc988de0d018f6821b22351ec842a0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C6F3e_Rs.js @@ -0,0 +1 @@ +import{p as M,a as b,b as V,t as X,g as Y,i as Z,k as j,r as z,u as A}from"./i18n-Dnhn5Rxr.js";import{R as I,t as R,Z as C,a as x,T as S,V as q,X as v,W as G,x as P,w as s,M as D,a5 as y,a0 as T,Y as k,u as F,v as H,y as J,S as K,a7 as L,at as N,a8 as O}from"./index-DWyDLubb.js";import{G as Q}from"./utils.svelte-CCyS_0CY.js";import{B as U}from"./Block-J4oodUWp.js";import{B as $}from"./BlockTitle-BMm9LakX.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{I as ee}from"./IconButtonWrapper-D0s9l4wW.js";import{S as te}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{c as ae}from"./input-DrerMDOL.js";import{default as Ie}from"./Example-Bt86cDLM.js";import"./clone-BkeCM4Nl.js";import"./Info-Dzjhnd64.js";import"./html-Ih_5QVTo.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./index-B_pwUImq.js";let se=0;var re=G('');function le(m,t){I(t,!0);const h=[];let e=M(t,"selected",15),i=y(()=>e()===t.internal_value);async function d(u){P(i,u.target.checked),s(i)&&(await D(),t.on_input())}var r=re();let f;var a=q(r);X(a);var n,o=v(a,2),g=q(o,!0);k(o),k(r),R(()=>{b(r,"data-testid",`${t.display_value??""}-radio-label`),f=V(r,1,"svelte-19qdtil",null,f,{disabled:t.disabled,selected:s(i),rtl:t.rtl}),a.disabled=t.disabled,b(a,"name",`radio-${++se}`),b(a,"aria-checked",s(i)),n!==(n=t.internal_value)&&(a.value=(a.__value=t.internal_value)??""),T(g,t.display_value)}),ae(h,[],a,()=>(t.internal_value,e()),e),C("input",a,d),x(m,r),S()}var ie=G('
        ',1);function we(m,t){I(t,!0);const h=z(t,["$$slots","$$events","$$legacy"]),e=new Q(h);let i=y(()=>!e.shared.interactive),d=F(H(e.props.value));J(()=>{s(d)!=e.props.value&&(P(d,e.props.value,!0),e.dispatch("change"))}),U(m,{get visible(){return e.shared.visible},type:"fieldset",get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},get rtl(){return e.props.rtl},children:(r,f)=>{var a=ie(),n=K(a);te(n,Y({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var o=v(n,2);{var g=l=>{ee(l,{get buttons(){return e.props.buttons},on_custom_button_click:p=>{e.dispatch("custom_button_click",{id:p})}})};Z(o,l=>{e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0&&l(g)})}var u=v(o,2);$(u,{get show_label(){return e.shared.show_label},get info(){return e.props.info},children:(l,p)=>{O();var c=L();R(_=>T(c,_),[()=>e.shared.label||e.i18n("radio.radio")]),x(l,c)},$$slots:{default:!0}});var w=v(u,2);j(w,21,()=>e.props.choices,A,(l,p,c)=>{var _=y(()=>N(s(p),2));let W=()=>s(_)[0],B=()=>s(_)[1];le(l,{get display_value(){return W()},get internal_value(){return B()},get disabled(){return s(i)},get rtl(){return e.props.rtl},on_input:()=>{e.dispatch("input"),e.dispatch("select",{value:B(),index:c})},get selected(){return e.props.value},set selected(E){e.props.value=E}})}),k(w),x(r,a)},$$slots:{default:!0}}),S()}export{Ie as BaseExample,le as BaseRadio,we as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C6mSODH4.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C6mSODH4.js new file mode 100644 index 0000000000000000000000000000000000000000..a677e08d476e9450a476b3dc4ed5f57e179f99a0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-C6mSODH4.js @@ -0,0 +1 @@ +import{p as n,e as Ze,i as B,d as Be,s as Ae,b as Ue,f as He,r as Je,g as De}from"./i18n-Dnhn5Rxr.js";import{R as Ge,a4 as Ke,a1 as fe,G as f,w as r,a2 as Ne,S as k,a6 as q,a as w,t as Fe,Z as Ie,T as Te,a3 as ge,M as ce,U as o,ad as $,X as J,V as ke,z as j,W as _e,x as c,Y as Pe,av as Oe,y as Qe,u as ze,a5 as z}from"./index-DWyDLubb.js";import{G as $e}from"./utils.svelte-CCyS_0CY.js";import{g as et,I as tt}from"./ImagePreview-B2ps5aDR.js";import{b as ve}from"./misc-vsnLZ-Y1.js";import{I as rt,S as at}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as st}from"./BlockLabel-CZd21Hkw.js";import{C as lt}from"./Clear-BF6j078A.js";import{I as Re}from"./Image-DrPceByI.js";import{I as nt}from"./IconButtonWrapper-D0s9l4wW.js";import{F as ot}from"./FullscreenButton-sCrcy_OJ.js";import{W as it}from"./Webcam-DQkeURjU.js";import{U as ut,a as dt}from"./Upload-HitvyI7k.js";import{I as gt}from"./Image-CeW7PJs4.js";/* empty css */import{B as Ce}from"./Block-J4oodUWp.js";import{E as ct}from"./Empty-BIB2W5at.js";import{U as Ee}from"./UploadText-oRnvaG4b.js";import{S as We}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{default as sr}from"./Example-7veL-tTh.js";import"./clone-BkeCM4Nl.js";import"./DownloadLink-TGTaev7f.js";import"./ShareButton-wCSP7LoP.js";import"./Download-Di2PsS6O.js";/* empty css */import"./snippet-BWgYNF9D.js";import"./Maximize-QH9NIRWs.js";import"./actions-CLThs9VH.js";import"./DropdownArrow-BOSZEGSp.js";import"./Square-CcB54dqq.js";import"./Spinner-Dhvehhrf.js";import"./StreamingBar-Cb4g-rUI.js";/* empty css */import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";/* empty css */var _t=_e(" ",1),mt=_e("
        "),pt=_e('
        ',1);function ft(he,a){Ge(a,!1);const T=ge();let l=n(a,"value",12,null),ee=n(a,"label",12,void 0),te=n(a,"show_label",12),e=n(a,"sources",28,()=>["upload","clipboard","webcam"]),i=n(a,"streaming",12,!1),v=n(a,"pending",12,!1),y=n(a,"webcam_options",12),R=n(a,"selectable",12,!1),U=n(a,"root",12),V=n(a,"i18n",12),X=n(a,"max_file_size",12,null),Y=n(a,"upload",12),K=n(a,"stream_handler",12),N=n(a,"stream_every",12),re=n(a,"time_limit",12),ae=n(a,"show_fullscreen_button",12,!0),se=n(a,"stream_state",12,"closed"),_=n(a,"upload_promise",12,null),u=n(a,"onerror",12,void 0),D=ge(),x=n(a,"uploading",12,!1),g=n(a,"active_source",12,null),Z=n(a,"fullscreen",12,!1),L=ge([]),M=ge();async function h(t){if(!i()){if(t.path?.toLowerCase().endsWith(".svg")&&t.url){const p=await(await fetch(t.url)).text();l({...t,url:`data:image/svg+xml,${encodeURIComponent(p)}`})}else l(t);await ce(),F("upload")}}function le(){l(null),F("clear"),F("change",null)}function A(t){le(),t.stopPropagation()}async function ne(t,m){if(m==="stream"){F("stream",{value:{url:t},is_value_data:!0});return}c(M,Math.random().toString(36).substring(2,15));const p=new File([t],`image.${i()?"jpeg":"png"}`);c(L,[new Oe({path:p.name,orig_name:p.name,blob:p,size:p.size,mime_type:p.type,is_stream:!1})]),v(!0);const H=await r(D).load_files([p],r(M));(m==="change"||m==="upload")&&(l(H?.[0]||null),await ce(),F("change")),v(!1)}const F=Ke();let S=n(a,"dragging",12,!1);function s(t){let m=et(t);m&&F("select",{index:m,value:null})}async function Se(t){t==="clipboard"&&r(D).paste_clipboard()}let oe=ge();function be(t){t.preventDefault(),t.stopPropagation(),t.dataTransfer&&(t.dataTransfer.dropEffect="copy"),S(!0)}async function we(t){t.preventDefault(),t.stopPropagation(),S(!1),l()&&(le(),await ce()),g("upload"),await ce(),r(D).load_files_from_drop(t)}fe(()=>(f(g()),f(e())),()=>{!g()&&e()&&g(e()[0])}),fe(()=>(f(i()),f(g())),()=>{c(T,i()&&g()==="webcam")}),fe(()=>(f(x()),r(T)),()=>{x()&&!r(T)&&l(null)}),fe(()=>f(S()),()=>{F("drag",S())}),Ne();var ye={get value(){return l()},set value(t){l(t),o()},get label(){return ee()},set label(t){ee(t),o()},get show_label(){return te()},set show_label(t){te(t),o()},get sources(){return e()},set sources(t){e(t),o()},get streaming(){return i()},set streaming(t){i(t),o()},get pending(){return v()},set pending(t){v(t),o()},get webcam_options(){return y()},set webcam_options(t){y(t),o()},get selectable(){return R()},set selectable(t){R(t),o()},get root(){return U()},set root(t){U(t),o()},get i18n(){return V()},set i18n(t){V(t),o()},get max_file_size(){return X()},set max_file_size(t){X(t),o()},get upload(){return Y()},set upload(t){Y(t),o()},get stream_handler(){return K()},set stream_handler(t){K(t),o()},get stream_every(){return N()},set stream_every(t){N(t),o()},get time_limit(){return re()},set time_limit(t){re(t),o()},get show_fullscreen_button(){return ae()},set show_fullscreen_button(t){ae(t),o()},get stream_state(){return se()},set stream_state(t){se(t),o()},get upload_promise(){return _()},set upload_promise(t){_(t),o()},get onerror(){return u()},set onerror(t){u(t),o()},get uploading(){return x()},set uploading(t){x(t),o()},get active_source(){return g()},set active_source(t){g(t),o()},get fullscreen(){return Z()},set fullscreen(t){Z(t),o()},get dragging(){return S()},set dragging(t){S(t),o()}};Ze();var C=pt(),ie=k(C);{let t=$(()=>ee()||"Image");st(ie,{get show_label(){return te()},get Icon(){return Re},get label(){return r(t)}})}var ue=J(ie,2),me=ke(ue);nt(me,{children:(t,m)=>{var p=q(),H=k(p);{var b=P=>{var d=_t(),O=k(d);{var de=I=>{ot(I,{get fullscreen(){return Z()},$$events:{fullscreen(Q){ve.call(this,a,Q)}}})};B(O,I=>{ae()&&I(de)})}var G=J(O,2);rt(G,{get Icon(){return lt},label:"Remove Image",onclick:A}),w(P,d)};B(H,P=>{f(l()),r(T),j(()=>l()?.url&&!r(T))&&P(b)})}w(t,p)},$$slots:{default:!0}});var E=J(me,2);let W,pe;var xe=ke(E);{let t=$(()=>l()!==null||g()==="webcam"),m=$(()=>g()==="clipboard"?"clipboard":"image/*"),p=$(()=>(f(e()),f(l()),j(()=>!e().includes("upload")||l()!==null))),H=$(()=>(f(V()),j(()=>V()("image.drop_to_upload"))));Be(ut(xe,{get hidden(){return r(t)},get filetype(){return r(m)},onload:h,get onerror(){return u()},get root(){return U()},get max_file_size(){return X()},get disable_click(){return r(p)},get upload(){return Y()},get stream_handler(){return K()},get aria_label(){return r(H)},get upload_promise(){return _()},set upload_promise(b){_(b)},get uploading(){return x()},set uploading(b){x(b)},get dragging(){return S()},set dragging(b){S(b)},children:(b,P)=>{var d=q(),O=k(d);{var de=G=>{var I=q(),Q=k(I);Ae(Q,a,"default",{}),w(G,I)};B(O,G=>{l()===null&&G(de)})}w(b,d)},$$slots:{default:!0},$$legacy:!0}),b=>c(D,b),()=>r(D))}var Le=J(xe,2);{var Me=t=>{dt(t,{get root(){return U()},get upload_id(){return r(M)},get stream_handler(){return K()},get files(){return r(L)}})},je=t=>{var m=q(),p=k(m);{var H=P=>{it(P,{get root(){return U()},get value(){return l()},get stream_state(){return se()},get mirror_webcam(){return f(y()),j(()=>y().mirror)},get stream_every(){return N()},get streaming(){return i()},mode:"image",include_audio:!1,get i18n(){return V()},get upload(){return Y()},get time_limit(){return re()},get webcam_constraints(){return f(y()),j(()=>y().constraints)},$$events:{capture:d=>ne(d.detail,"change"),stream:d=>ne(d.detail,"stream"),error(d){ve.call(this,a,d)},drag(d){ve.call(this,a,d)},upload:d=>ne(d.detail,"upload"),close_stream(d){ve.call(this,a,d)}}})},b=P=>{var d=q(),O=k(d);{var de=G=>{var I=mt();let Q;var Xe=ke(I);{let Ye=$(()=>(f(l()),j(()=>({alt:l().alt_text}))));gt(Xe,{get src(){return f(l()),j(()=>l().url)},get restProps(){return r(Ye)}})}Pe(I),Fe(()=>Q=Ue(I,1,"image-frame svelte-6uxbr3",null,Q,{selectable:R()})),Ie("click",I,s),w(G,I)};B(O,G=>{l()!==null&&!i()&&G(de)},!0)}w(P,d)};B(p,P=>{g()==="webcam"&&(i()||!i()&&!l())?P(H):P(b,!1)},!0)}w(t,m)};B(Le,t=>{g()==="webcam"&&!i()&&v()?t(Me):t(je,!1)})}Pe(E);var qe=J(E,2);{var Ve=t=>{at(t,{get sources(){return e()},handle_clear:le,handle_select:Se,get active_source(){return g()},set active_source(m){g(m)},$$legacy:!0})};B(qe,t=>{f(e()),j(()=>e().length>1||e().includes("clipboard"))&&t(Ve)})}return Pe(ue),Be(ue,t=>c(oe,t),()=>r(oe)),Fe(()=>{W=Ue(E,1,"upload-container svelte-6uxbr3",null,W,{"reduced-height":e().length>1}),pe=He(E,"",pe,{width:l()?"auto":"100%"})}),Ie("dragover",E,be),Ie("drop",E,we),w(he,C),Te(ye)}var vt=_e(" ",1),ht=_e(" ",1);function tr(he,a){Ge(a,!0);let T={value:null},l=ze(void 0);class ee extends $e{async get_data(){r(l)&&(await r(l),await ce());const u=await super.get_data();return a.props.streaming&&(u.value=T.value),u}}const te=Je(a,["$$slots","$$events","$$legacy"]),e=new ee(te);let i=ze(!1),v=ze(!1),y=z(()=>e.props.sources?e.props.sources[0]:null),R;const U=_=>{const u=_;u.preventDefault(),u.stopPropagation(),u.type==="dragenter"||u.type==="dragover"?c(v,!0):u.type==="dragleave"&&c(v,!1)},V=_=>{if(e.shared.interactive){const u=_;u.preventDefault(),u.stopPropagation(),c(v,!1),R&&R.loadFilesFromDrop(u)}};let X=e.props.value,Y=!1;Qe(()=>{if(!Y){X=e.props.value,Y=!0;return}X!==e.props.value&&(X=e.props.value,e.dispatch("change"))});let K=z(()=>e?.shared?.loading_status.stream_state);var N=q(),re=k(N);{var ae=_=>{{let u=z(()=>r(v)?"focus":"base"),D=z(()=>e.props.height||void 0);Ce(_,{get visible(){return e.shared.visible},variant:"solid",get border_mode(){return r(u)},padding:!1,get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get height(){return r(D)},get width(){return e.props.width},allow_overflow:!1,get container(){return e.shared.container},"scale{gradio.shared.scale}":!0,get min_width(){return e.shared.min_width},get fullscreen(){return r(i)},set fullscreen(x){c(i,x,!0)},children:(x,g)=>{var Z=vt(),L=k(Z);We(L,De({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var M=J(L,2);tt(M,{get fullscreen(){return r(i)},get value(){return e.props.value},get label(){return e.shared.label},get show_label(){return e.shared.show_label},get selectable(){return e.props._selectable},get i18n(){return e.i18n},get buttons(){return e.props.buttons},on_custom_button_click:h=>{e.dispatch("custom_button_click",{id:h})},$$events:{select:({detail:h})=>e.dispatch("select",h),share:({detail:h})=>e.dispatch("share",h),error:({detail:h})=>e.dispatch("error",h),fullscreen:({detail:h})=>{c(i,h,!0)}}}),w(x,Z)},$$slots:{default:!0}})}},se=_=>{{let u=z(()=>e.props.value===null?"dashed":"solid"),D=z(()=>r(v)?"focus":"base"),x=z(()=>e.props.height||void 0);Ce(_,{get visible(){return e.shared.visible},get variant(){return r(u)},get border_mode(){return r(D)},padding:!1,get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get height(){return r(x)},get width(){return e.props.width},allow_overflow:!1,get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},get fullscreen(){return r(i)},set fullscreen(g){c(i,g,!0)},$$events:{dragenter:U,dragleave:U,dragover:U,drop:V},children:(g,Z)=>{var L=ht(),M=k(L);{var h=A=>{We(A,De({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}))};B(M,A=>{(e.shared.loading_status.type==="output"||e.shared.loading_status.validation_error)&&A(h)})}var le=J(M,2);{let A=z(()=>e.props.buttons===null?!0:e.props.buttons.some(s=>typeof s=="string"&&s==="fullscreen")),ne=z(()=>e.shared.loading_status?.status==="pending"||e.shared.loading_status?.status==="streaming"),F=z(()=>e.shared.loading_status?.time_limit),S=z(()=>e.shared.client?.stream);Be(ft(le,{get selectable(){return e.props._selectable},get root(){return e.shared.root},get sources(){return e.props.sources},get fullscreen(){return r(i)},get show_fullscreen_button(){return r(A)},onerror:s=>{e.shared.loading_status.status="error",e.dispatch("error",s)},get label(){return e.shared.label},get show_label(){return e.shared.show_label},get pending(){return r(ne)},get streaming(){return e.props.streaming},get webcam_options(){return e.props.webcam_options},get stream_every(){return e.props.stream_every},get time_limit(){return r(F)},get max_file_size(){return e.shared.max_file_size},get i18n(){return e.i18n},upload:(...s)=>e.shared.client.upload(...s),get stream_handler(){return r(S)},get stream_state(){return r(K)},get upload_promise(){return r(l)},set upload_promise(s){c(l,s,!0)},get active_source(){return r(y)},set active_source(s){c(y,s)},get value(){return e.props.value},set value(s){e.props.value=s},get dragging(){return r(v)},set dragging(s){c(v,s,!0)},$$events:{edit:()=>e.dispatch("edit"),clear:()=>{c(i,!1),e.dispatch("clear"),e.dispatch("input")},stream:({detail:s})=>{T=s,e.dispatch("stream",s)},drag:({detail:s})=>c(v,s,!0),upload:()=>{e.dispatch("upload"),e.dispatch("input")},select:({detail:s})=>e.dispatch("select",s),share:({detail:s})=>e.dispatch("share",s),close_stream:()=>{e.dispatch("close_stream")},fullscreen:({detail:s})=>{c(i,s,!0)}},children:(s,Se)=>{var oe=q(),be=k(oe);{var we=C=>{Ee(C,{get i18n(){return e.i18n},type:"image",get placeholder(){return e.props.placeholder}})},ye=C=>{var ie=q(),ue=k(ie);{var me=W=>{Ee(W,{get i18n(){return e.i18n},type:"clipboard",mode:"short"})},E=W=>{ct(W,{unpadded_box:!0,size:"large",children:(pe,xe)=>{Re(pe)},$$slots:{default:!0}})};B(ue,W=>{r(y)==="clipboard"?W(me):W(E,!1)},!0)}w(C,ie)};B(be,C=>{r(y)==="upload"||!r(y)?C(we):C(ye,!1)})}w(s,oe)},$$slots:{default:!0}}),s=>R=s,()=>R)}w(g,L)},$$slots:{default:!0}})}};B(re,_=>{e.shared.interactive?_(se,!1):_(ae)})}w(he,N),Te()}export{sr as BaseExample,gt as BaseImage,ft as BaseImageUploader,tt as BaseStaticImage,it as Webcam,tr as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CEZhPgHw.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CEZhPgHw.js new file mode 100644 index 0000000000000000000000000000000000000000..5add28537be0e7d40cea9a47d4b621341d38dfdf --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CEZhPgHw.js @@ -0,0 +1 @@ +import{i as I,k as ke,d as xe,b as Z,u as $e,a as oe,t as Be,g as De,r as Ee}from"./i18n-Dnhn5Rxr.js";import{a as f,f as Ie,R as ie,u as j,v as Me,y as Oe,w as t,x as o,a7 as q,t as E,Z as k,T as ue,a5 as _,X as x,V as h,W as M,at as le,a0 as C,a8 as Ae,Y as b,S as ce}from"./index-DWyDLubb.js";import{G as Se}from"./utils.svelte-CCyS_0CY.js";import{b as Ge}from"./input-DrerMDOL.js";import{p as Pe}from"./event-modifiers-CdEA5IGF.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as Re}from"./BlockTitle-BMm9LakX.js";import{D as Te}from"./DropdownArrow-BOSZEGSp.js";import{I as We}from"./IconButtonWrapper-D0s9l4wW.js";import{D as ze,h as Le,a as Ve,b as Xe}from"./Dropdown-Beu8JVME.js";import{B as Ye}from"./Block-J4oodUWp.js";import{S as Ze}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{default as kt}from"./Example-CCcLQRgY.js";import"./clone-BkeCM4Nl.js";import"./snippet-BWgYNF9D.js";import"./Info-Dzjhnd64.js";import"./html-Ih_5QVTo.js";import"./window-Uydxco8n.js";import"./Clear-BF6j078A.js";import"./index-B_pwUImq.js";/* empty css */var je=Ie('');function ne(O){var $=je();f(O,$)}var qe=M('
        '),Ce=M('
        '),Fe=M('
        '),He=M(' ',1),Je=M('
        ');function Ke(O,$){ie($,!0);const r=$.gradio;let s,n=j(""),F=_(()=>r.shared.label||"Multiselect"),B=_(()=>r.props.buttons),A=_(()=>r.props.choices.map(e=>e[0])),g=_(()=>r.props.choices.map(e=>e[1])),D=_(()=>!r.shared.interactive),d=j(!1),w=_(()=>{const e=Ve(r.props.choices,t(n));return[e,e.length>0&&!r.props.allow_custom_value?e[0]:null]}),v=_(()=>le(t(w),2)),W=_(()=>t(v)[0]),m=_(()=>t(v)[1]);function pe(){return r.props.value===void 0?[]:Array.isArray(r.props.value)?r.props.value.map(e=>{const a=t(g).indexOf(e);if(a!==-1)return a;if(r.props.allow_custom_value)return e}).filter(e=>e!==void 0):[]}let i=_(pe);function de(){r.props.allow_custom_value||o(n,""),r.props.allow_custom_value&&t(n)!==""&&(L(t(n)),o(n,"")),r.dispatch("blur"),o(d,!1),o(m,null)}function z(e){o(i,t(i).filter(a=>a!==e)),r.props.value=t(i).map(a=>typeof a=="number"?t(g)[a]:a),r.dispatch("input"),r.dispatch("select",{index:typeof e=="number"?e:-1,value:typeof e=="number"?t(g)[e]:e,selected:!1})}function L(e){(r.props.max_choices==null||t(i).lengthtypeof a=="number"?t(g)[a]:a)}function ve(e){const a=parseInt(e);H(a)}function H(e){t(i).includes(e)?z(e):L(e),o(n,""),o(m,null),r.dispatch("input")}function J(e){o(i,[]),o(n,""),r.props.value=[],e.preventDefault()}function _e(e){o(W,r.props.choices.map((a,l)=>l)),(r.props.max_choices===null||t(i).length{var l=le(a,2);o(d,l[0],!0),o(m,l[1])})(Le(e,t(m),t(W))),e.key==="Enter"&&(t(m)!==null?H(t(m)):r.props.allow_custom_value&&(L(t(n)),o(n,""))),e.key==="Backspace"&&t(n)===""){const a=t(i).slice(0,-1);r.props.value=a.map(l=>typeof l=="number"?t(g)[l]:l)}t(i).length===r.props.max_choices&&(o(d,!1),o(m,null))}let K=j(Me(r.props.value));Oe(()=>{t(K)!==r.props.value&&(o(K,r.props.value,!0),r.dispatch("change"))});function me(e){r.dispatch("custom_button_click",{id:e})}var P=Je();let N;var Q=h(P);{var he=e=>{We(e,{get buttons(){return t(B)},on_custom_button_click:me})};I(Q,e=>{r.shared.show_label&&t(B)&&t(B).length>0&&e(he)})}var U=x(Q,2);Re(U,{get show_label(){return r.shared.show_label},get info(){return r.props.info},children:(e,a)=>{Ae();var l=q();E(()=>C(l,t(F))),f(e,l)},$$slots:{default:!0}});var ee=x(U,2),R=h(ee);let te;var re=h(R);ke(re,17,()=>t(i),$e,(e,a)=>{var l=Ce(),S=h(l),T=h(S);{var V=u=>{var c=q();E(()=>C(c,t(A)[t(a)])),f(u,c)},G=u=>{var c=q();E(()=>C(c,t(a))),f(u,c)};I(T,u=>{typeof t(a)=="number"?u(V):u(G,!1)})}b(S);var y=x(S,2);{var X=u=>{var c=qe(),ye=h(c);ne(ye),b(c),E(Y=>oe(c,"title",Y),[()=>r.i18n("common.remove")+" "+t(a)]),k("click",c,Pe(()=>z(t(a)))),k("keydown",c,Y=>{Y.key==="Enter"&&z(t(a))}),f(u,c)};I(y,u=>{t(D)||u(X)})}b(l),f(e,l)});var se=x(re,2),p=h(se);Be(p);let ae;xe(p,e=>s=e,()=>s);var be=x(p,2);{var ge=e=>{var a=He(),l=ce(a);{var S=G=>{var y=Fe(),X=h(y);ne(X),b(y),E(u=>oe(y,"title",u),[()=>r.i18n("common.clear")]),k("click",y,J),k("keydown",y,u=>{u.key==="Enter"&&J(u)}),f(G,y)};I(l,G=>{t(i).length>0&&G(S)})}var T=x(l,2),V=h(T);Te(V),b(T),f(e,a)};I(be,e=>{t(D)||e(ge)})}b(se),b(R);var we=x(R,2);ze(we,{get show_options(){return t(d)},get choices(){return r.props.choices},get filtered_indices(){return t(W)},get disabled(){return t(D)},get selected_indices(){return t(i)},get active_index(){return t(m)},remember_scroll:!0,onchange:ve}),b(ee),b(P),E(e=>{N=Z(P,1,"svelte-1dv2vbb",null,N,{container:r.shared.container}),te=Z(R,1,"wrap-inner svelte-1dv2vbb",null,te,{show_options:t(d)}),ae=Z(p,1,"border-none svelte-1dv2vbb",null,ae,e),p.disabled=t(D),p.readOnly=!r.props.filterable},[()=>({subdued:!t(A).includes(t(n))&&!r.props.allow_custom_value||t(i).length===r.props.max_choices})]),Ge(p,()=>t(n),e=>o(n,e)),k("keydown",p,fe),k("keyup",p,e=>{r.dispatch("key_up",{key:e.key,input_value:t(n)})}),k("blur",p,de),k("focus",p,_e),f(O,P),ue()}var Ne=M(" ",1);function gt(O,$){ie($,!0);let r=Ee($,["$$slots","$$events","$$legacy"]);const s=new Se(r);Ye(O,{get visible(){return s.shared.visible},get elem_id(){return s.shared.elem_id},get elem_classes(){return s.shared.elem_classes},get padding(){return s.shared.container},allow_overflow:!1,get scale(){return s.shared.scale},get min_width(){return s.shared.min_width},children:(n,F)=>{var B=Ne(),A=ce(B);Ze(A,De({get autoscroll(){return s.shared.autoscroll},get i18n(){return s.i18n}},()=>s.shared.loading_status,{on_clear_status:()=>s.dispatch("clear_status",loading_status)}));var g=x(A,2);{var D=w=>{Ke(w,{get gradio(){return s}})},d=w=>{Xe(w,{get label(){return s.shared.label},get info(){return s.props.info},get choices(){return s.props.choices},get interactive(){return s.shared.interactive},get show_label(){return s.shared.show_label},get container(){return s.shared.container},get allow_custom_value(){return s.props.allow_custom_value},get filterable(){return s.props.filterable},get buttons(){return s.props.buttons},oncustom_button_click:v=>{s.dispatch("custom_button_click",{id:v})},on_change:()=>s.dispatch("change"),on_input:()=>s.dispatch("input"),on_select:v=>s.dispatch("select",v),on_focus:()=>s.dispatch("focus"),on_blur:()=>s.dispatch("blur"),on_key_up:v=>s.dispatch("key_up",v),get value(){return s.props.value},set value(v){s.props.value=v}})};I(g,w=>{s.props.multiselect?w(D):w(d,!1)})}f(n,B)},$$slots:{default:!0}}),ue()}export{Xe as BaseDropdown,ze as BaseDropdownOptions,kt as BaseExample,Ke as BaseMultiselect,gt as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CEhk7M0s.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CEhk7M0s.css new file mode 100644 index 0000000000000000000000000000000000000000..7aca3b67c234d954c55f0585a35d87dec4a398af --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CEhk7M0s.css @@ -0,0 +1 @@ +input.svelte-3g0mcl{--ring-color: transparent;position:relative;box-shadow:var(--input-shadow);border:1px solid var(--checkbox-border-color);border-radius:var(--radius-xs);background-color:var(--checkbox-background-color);line-height:var(--line-sm);width:18px!important;height:18px!important}input.svelte-3g0mcl:checked,input.svelte-3g0mcl:checked:hover,input.svelte-3g0mcl:checked:focus{border-color:var(--checkbox-border-color-selected);background-image:var(--checkbox-check);background-color:var(--checkbox-background-color-selected)}input.svelte-3g0mcl:hover{border-color:var(--checkbox-border-color-hover);background-color:var(--checkbox-background-color-hover)}input.svelte-3g0mcl:focus{border-color:var(--checkbox-border-color-focus);background-color:var(--checkbox-background-color-focus)}.disabled.svelte-3g0mcl{opacity:.8!important;cursor:not-allowed}.icon.svelte-6im0c4{display:inline-block;width:18px;height:18px;padding:3px 2px 3px 3px;margin:0;flex-grow:0;display:inline-flex;justify-content:center;align-items:center;border-radius:2px;cursor:pointer;transition:.1s;flex-shrink:0}.file-icon.svelte-6im0c4{display:inline-block;height:20px;margin:0;flex-grow:0;display:inline-flex;justify-content:center;align-items:center;transition:.1s}.file-icon.svelte-6im0c4 img:where(.svelte-6im0c4){width:100%;height:100%}.icon.svelte-6im0c4:hover{background:#eee}.icon.svelte-6im0c4:hover>*{color:var(--block-info-text-color)}.icon.svelte-6im0c4>*{transform:rotate(90deg);transform-origin:40% 50%;transition:.2s;color:var(--color-accent)}.no-checkbox.svelte-6im0c4{width:18px;height:18px}ul.root.svelte-6im0c4 .no-checkbox:where(.svelte-6im0c4){display:none}.hidden.svelte-6im0c4>*{transform:rotate(0);color:var(--body-text-color-subdued)}ul.svelte-6im0c4{margin-left:26px;padding-left:0;list-style:none}ul.root.svelte-6im0c4{margin-left:8px}ul.no-checkboxes.svelte-6im0c4:not(.root){margin-left:20px}li.svelte-6im0c4{padding-left:0;align-items:center;margin:8px 0;font-family:var(--font-mono);font-size:var(--scale-00);overflow-wrap:anywhere;word-break:break-word}.wrap.svelte-6im0c4{display:flex;gap:8px;align-items:center}.wrap.selected.svelte-6im0c4{background-color:var(--color-accent-soft);border-radius:var(--radius-sm);margin-left:-4px;padding-left:4px}.wrap.selectable.svelte-6im0c4{cursor:pointer;border-radius:var(--radius-sm);margin-left:-4px;padding-left:4px;padding-right:4px}.wrap.selectable.svelte-6im0c4:hover{background-color:var(--border-color-accent)}.item-name.svelte-6im0c4{flex:1;padding:2px 4px;border-radius:var(--radius-sm);margin-right:-4px}.file-wrap.svelte-1gs1iku{height:calc(100% - 25px);overflow-y:scroll} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CFLsnuCC.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CFLsnuCC.js new file mode 100644 index 0000000000000000000000000000000000000000..80ec6dfd3e2eb29bce7d0af22c575270ae7788d1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CFLsnuCC.js @@ -0,0 +1 @@ +import{p as x,s as $,b as A,f as y,i as j,r as C,g as I}from"./i18n-Dnhn5Rxr.js";import{R as q,S as f,t as R,a as h,T as w,X as g,V as _,W as G,aj as T,a0 as V,Y as v,a6 as W,w as k,a5 as B}from"./index-DWyDLubb.js";import{B as X}from"./Block-J4oodUWp.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{G as Y}from"./utils.svelte-CCyS_0CY.js";import{S as z}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{B as D}from"./Index.svelte_svelte_type_style_lang-BKODC18H.js";import"./snippet-BWgYNF9D.js";import"./clone-BkeCM4Nl.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var E=G('
        ',1);function F(u,t){q(t,!0);let s=x(t,"open",15,!0),m=x(t,"label",3,"");var e=E(),a=f(e);a.__click=()=>{s(!s()),s()?t.onexpand?.():t.oncollapse?.()};let d;var o=_(a),r=_(o,!0);v(o);var p=g(o,2);let i;v(a);var n=g(a,2);let c;var l=_(n);$(l,t,"default",{}),v(n),R(()=>{d=A(a,1,"label-wrap svelte-e5lyqv",null,d,{open:s()}),V(r,m()),i=y(p,"",i,{transform:s()?"rotate(0)":"rotate(90deg)"}),c=y(n,"",c,{display:s()?"block":"none"})}),h(u,e),w()}T(["click"]);var H=G(" ",1);function oe(u,t){q(t,!0);let s=C(t,["$$slots","$$events","$$legacy"]);class m extends Y{set_data(r){"open"in r&&r.open!==this.props.open&&(r.open?(this.dispatch("expand"),this.dispatch("gradio_expand")):this.dispatch("collapse")),super.set_data(r),this.shared.loading_status.status="complete"}}const e=new m(s);let a=B(()=>e.shared.label||""),d=B(()=>e.shared.visible===!0?!0:"hidden");X(u,{get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get visible(){return k(d)},children:(o,r)=>{var p=H(),i=f(p);{var n=l=>{z(l,I({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status))};j(i,l=>{e.shared.loading_status&&l(n)})}var c=g(i,2);F(c,{get label(){return k(a)},get open(){return e.props.open},onexpand:()=>{e.dispatch("expand"),e.dispatch("gradio_expand")},oncollapse:()=>e.dispatch("collapse"),children:(l,J)=>{D(l,{children:(P,K)=>{var b=W(),S=f(b);$(S,t,"default",{}),h(P,b)},$$slots:{default:!0}})},$$slots:{default:!0}}),h(o,p)},$$slots:{default:!0}}),w()}export{oe as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CI7BqPz-.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CI7BqPz-.css new file mode 100644 index 0000000000000000000000000000000000000000..d85b57abf0848f8e6c8307d4300c07768741f699 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CI7BqPz-.css @@ -0,0 +1 @@ +.error.svelte-15izthb{position:relative;padding:var(--size-4);color:var(--body-text-color);text-align:center}.error.svelte-15izthb>:where(.svelte-15izthb){margin-top:var(--size-4)}a.svelte-15izthb{color:var(--link-text-color)}a.svelte-15izthb:hover{color:var(--link-text-color-hover);text-decoration:underline}a.svelte-15izthb:visited{color:var(--link-text-color-visited)}a.svelte-15izthb:active{color:var(--link-text-color-active)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CIs-xuv1.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CIs-xuv1.js new file mode 100644 index 0000000000000000000000000000000000000000..9ffa24bee6a4d2b1bd93eb789c3a8411e16145c0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CIs-xuv1.js @@ -0,0 +1 @@ +import{i as w,g as $,r as x}from"./i18n-Dnhn5Rxr.js";import{R as y,u,v as S,y as k,w as o,x as d,S as B,a as J,X as h,a5 as m,T as N,W as O,V as G,Y as I}from"./index-DWyDLubb.js";import{b as j}from"./size-CtOeLwIl.js";import{G as z}from"./utils.svelte-CCyS_0CY.js";import{J as H,a as L}from"./JSON-CNFUDzUL.js";import{B as P}from"./Block-J4oodUWp.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as R}from"./BlockLabel-CZd21Hkw.js";import{S as T}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./clone-BkeCM4Nl.js";import"./Check-DUAHzS2-.js";import"./Copy-ChCbTvli.js";import"./Empty-BIB2W5at.js";import"./IconButtonWrapper-D0s9l4wW.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var V=O("
        ",1);function ie(_,a){y(a,!0);const g=x(a,["$$slots","$$events","$$legacy"]),e=new z(g);let i=u(S(e.props.value));k(()=>{o(i)!==e.props.value&&(d(i,e.props.value,!0),e.dispatch("change"))});let l=u(0);P(_,{get visible(){return e.shared.visible},test_id:"json",get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},padding:!1,allow_overflow:!0,overflow_behavior:"auto",get height(){return e.props.height},get min_height(){return e.props.min_height},get max_height(){return e.props.max_height},children:(c,W)=>{var n=V(),s=B(n),f=G(s);{var v=t=>{{let r=m(()=>e.shared.container===!1);R(t,{get Icon(){return L},get show_label(){return e.shared.show_label},get label(){return e.shared.label},float:!1,get disable(){return o(r)}})}};w(f,t=>{e.shared.label&&t(v)})}I(s);var p=h(s,2);T(p,$({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var b=h(p,2);{let t=m(()=>e.props.buttons==null?!0:e.props.buttons.some(r=>typeof r=="string"&&r==="copy"));H(b,{get value(){return e.props.value},get open(){return e.props.open},get theme_mode(){return e.props.theme_mode},get show_indices(){return e.props.show_indices},get show_copy_button(){return o(t)},get buttons(){return e.props.buttons},on_custom_button_click:r=>{e.dispatch("custom_button_click",{id:r})},get label_height(){return o(l)}})}j(s,"clientHeight",t=>d(l,t)),J(c,n)},$$slots:{default:!0}}),N()}export{H as BaseJSON,ie as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CKDSEi0w.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CKDSEi0w.css new file mode 100644 index 0000000000000000000000000000000000000000..4bd0669421a52ce987cf379d3f76f65fb54df164 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CKDSEi0w.css @@ -0,0 +1 @@ +.wrap.svelte-b2bl92{position:relative;width:100%;height:100%;z-index:var(--layer-1);overflow:hidden}.icon-wrap.svelte-b2bl92{display:block;position:absolute;top:50%;transform:translate(-20.5px,-50%);left:10px;width:40px;transition:.2s;color:var(--body-text-color);height:30px;border-radius:5px;background-color:var(--color-accent);display:flex;align-items:center;justify-content:center;z-index:var(--layer-3);box-shadow:0 0 5px 2px #0000004d;font-size:12px}.icon.left.svelte-b2bl92{transform:rotate(135deg);text-shadow:-1px -1px 1px rgba(0,0,0,.1)}.icon.right.svelte-b2bl92{transform:rotate(-45deg);text-shadow:-1px -1px 1px rgba(0,0,0,.1)}.icon.center.svelte-b2bl92{display:block;width:1px;height:100%;background-color:var(--color);opacity:.1}.icon-wrap.active.svelte-b2bl92,.icon-wrap.disabled.svelte-b2bl92{opacity:0}.outer.svelte-b2bl92{width:20px;height:100%;cursor:grab;position:absolute;top:0;left:-10px;pointer-events:auto;z-index:var(--layer-2)}.grab.svelte-b2bl92{cursor:grabbing}.inner.svelte-b2bl92{width:1px;height:100%;background:var(--color);position:absolute;left:calc((100% - 2px)/2)}.disabled.svelte-b2bl92{cursor:auto}.disabled.svelte-b2bl92 .inner:where(.svelte-b2bl92){box-shadow:none}.content.svelte-b2bl92{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.preview.svelte-j3ek2n{object-fit:contain;width:100%;transform-origin:top left;margin:auto}.small.svelte-j3ek2n{max-height:500px}.upload.svelte-j3ek2n{object-fit:contain;max-height:500px}.fixed.svelte-j3ek2n{position:absolute;inset:0}.fullscreen.svelte-j3ek2n{width:100%;height:100%}.image-container:fullscreen img.svelte-j3ek2n{width:100%;height:100%;max-height:none;max-width:none}.hidden.svelte-j3ek2n{opacity:0}.slider-wrap.svelte-1880bc6{user-select:none;height:100%;width:100%;position:relative;display:flex;align-items:center;justify-content:center}.limit_height.svelte-1880bc6 img{max-height:500px}.image-container.svelte-1880bc6{height:100%;position:relative;min-width:var(--size-20)}div.svelte-2ufkjh{display:flex;position:absolute;top:var(--size-2);right:var(--size-2);justify-content:flex-end;gap:var(--spacing-sm);z-index:var(--layer-5)}.upload-wrap.svelte-1c8zs50{display:flex;justify-content:center;align-items:center;height:100%;width:100%}.wrap.svelte-1c8zs50{width:100%}.half-wrap.svelte-1c8zs50{width:50%}.image-container.svelte-1c8zs50,.empty-wrap.svelte-1c8zs50{width:var(--size-full);height:var(--size-full)}.fixed.svelte-1c8zs50{--anim-block-background-fill: 255, 255, 255;position:absolute;top:0;left:0;background-color:rgba(var(--anim-block-background-fill),.8);z-index:0}@media(prefers-color-scheme:dark){.fixed.svelte-1c8zs50{--anim-block-background-fill: 31, 41, 55}}.side-by-side.svelte-1c8zs50 img{width:50%;object-fit:contain}.empty-wrap.svelte-1c8zs50{pointer-events:none}.icon-buttons.svelte-1c8zs50{display:flex;position:absolute;right:8px;z-index:var(--layer-top);top:8px} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CTDY4JGM.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CTDY4JGM.css new file mode 100644 index 0000000000000000000000000000000000000000..584335e64b28c39600a74a86a70d7422812c45dd --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CTDY4JGM.css @@ -0,0 +1 @@ +label.svelte-16ty2ow:not(.container),label.svelte-16ty2ow:not(.container)>input:where(.svelte-16ty2ow){height:100%;border:none}.container.svelte-16ty2ow>input:where(.svelte-16ty2ow){border:var(--input-border-width) solid var(--input-border-color);border-radius:var(--input-radius)}input[type=number].svelte-16ty2ow{display:block;position:relative;outline:none!important;box-shadow:var(--input-shadow);background:var(--input-background-fill);padding:var(--input-padding);width:100%;color:var(--body-text-color);font-size:var(--input-text-size);line-height:var(--line-sm)}input.svelte-16ty2ow:disabled{-webkit-text-fill-color:var(--body-text-color);-webkit-opacity:1;opacity:1}input.svelte-16ty2ow:focus{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus);background:var(--input-background-fill-focus)}input.svelte-16ty2ow::placeholder{color:var(--input-placeholder-color)}input.svelte-16ty2ow:out-of-range{border:var(--input-border-width) solid var(--error-border-color)}div.validation-error.svelte-16ty2ow{color:var(--error-icon-color);font-size:var(--font-sans);margin-top:var(--spacing-sm);font-weight:var(--weight-semibold)}label.container.svelte-16ty2ow input.validation-error:where(.svelte-16ty2ow){border-color:transparent!important;box-shadow:0 0 3px 1px var(--error-icon-color),var(--shadow-inset)!important} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CUqdOFP7.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CUqdOFP7.js new file mode 100644 index 0000000000000000000000000000000000000000..9e74f2d21bd07234d30c5431679e15da5716900a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CUqdOFP7.js @@ -0,0 +1 @@ +import{B as Fe,d as Ke,r as Oe,p as ue,i as N,k as X,u as me,b as ze,g as He,f as Ve,h as We}from"./i18n-Dnhn5Rxr.js";import{p as Xe,aA as Me,O as je,aB as be,aC as Qe,aD as $e,aE as et,U as tt,aF as Se,aG as at,a9 as rt,a3 as Te,aH as nt,h as ce,e as st,aI as lt,s as ot,aJ as vt,ar as ke,R as Ie,y as Re,w as e,aK as it,aL as ut,x as Q,a as r,T as Ne,u as de,W as f,v as mt,a6 as S,S as B,a5 as o,X as se,aj as ct,Z as j,V as T,t as ne,a0 as _e,Y as _,a7 as dt}from"./index-DWyDLubb.js";import{B as _t}from"./Block-J4oodUWp.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{G as ft}from"./utils.svelte-CCyS_0CY.js";import{k as gt}from"./key-Xd_8JrI4.js";import"./Textbox-BuFR2fNz.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import Ae from"./Example-BC6WbF6q.js";import"./snippet-BWgYNF9D.js";import"./clone-BkeCM4Nl.js";import"./actions-CLThs9VH.js";import"./input-DrerMDOL.js";import"./BlockTitle-BMm9LakX.js";import"./Info-Dzjhnd64.js";import"./html-Ih_5QVTo.js";import"./Check-DUAHzS2-.js";import"./Copy-ChCbTvli.js";import"./Send-B_rl9Hxa.js";import"./Square-CcB54dqq.js";import"./IconButtonWrapper-D0s9l4wW.js";import"./index-B_pwUImq.js";import"./size-CtOeLwIl.js";/* empty css */const De=0,we=1;function Ee(J,t,E,a,u){ce&&st();var P=rt(),H=at,v=P?Se(H):Te(H,!1,!1),y=P?Se(H):Te(H,!1,!1),b=new Fe(J);Xe(()=>{var m=t(),g=!1;let I=ce&&Me(m)===(J.data===lt);if(I&&(ot(vt()),ke(!1)),Me(m)){var F=nt(),le=!1;const A=D=>{if(!g){le=!0,F(!1),Qe.ensure(),ce&&ke(!1);try{D()}finally{$e(),et||tt()}}};m.then(D=>{A(()=>{be(v,D),b.ensure(we,a&&(z=>a(z,v)))})},D=>{A(()=>{if(be(y,D),b.ensure(we,u&&(z=>u(z,y))),!u)throw y.v})}),ce?b.ensure(De,E):je(()=>{le||A(()=>{b.ensure(De,E)})})}else be(v,m),b.ensure(we,a&&(A=>a(A,v)));return I&&ke(!0),()=>{g=!0}})}var pt=f("");function Ge(J,t){Ie(t,!0);let E=Oe(t,["$$slots","$$events","$$legacy","component","runtime"]),a=de(null);Re(()=>{if(!e(a)||!t.component)return;const P=t.component,H=t.runtime,v=E;if(H){const y=H.mount(P.default,{target:e(a),props:v});return()=>{H.unmount(y)}}else{const y=it(P.default,{target:e(a),props:v});return()=>{ut(y)}}});var u=pt();Ke(u,P=>Q(a,P),()=>e(a)),r(J,u),Ne()}var ht=f(''),xt=f(''),yt=f(' '),bt=f(""),kt=f(''),wt=f('
        '),Et=f("
        ...
        "),Ht=f(""),It=f('
        Pages:
        '),Nt=f(" ",1),Bt=f(''),Pt=f('');function zt(J,t){Ie(t,!0);let E=ue(t,"sample_labels",3,null),a=ue(t,"value",15,null),u=ue(t,"samples_per_page",3,10),P=ue(t,"layout",3,null),H=o(()=>t.proxy_url?`/proxy=${t.proxy_url}file=`:`${t.root}/file=`),v=de(-1),y=o(()=>(t.components.length<2||E()!==null)&&P()!=="table"),b=o(()=>E()?E().map(i=>[i]):t.samples??[]),m=de(0);Re(()=>{e(b),Q(m,0)});let g=o(()=>e(b).length>u()),I=o(()=>e(g)?e(b).slice(e(m)*u(),(e(m)+1)*u()):e(b).slice()),F=o(()=>Math.ceil(e(b).length/u())),le=o(()=>{if(!e(g))return[];let i=[];return[0,e(m),e(F)-1].forEach(G=>{for(let p=G-2;p<=G+2;p++)p>=0&&p0&&p-i[i.length-1]>1&&i.push(-1),i.push(p))}),i});function A(i){Q(v,i,!0)}function D(){Q(v,-1)}let z=de(mt([]));async function Je(i){const G=JSON.parse(i);Q(z,await Promise.all(G&&G.map(async p=>await Promise.all(p.map(async(K,L)=>{const Y=t.load_component(t.components[L].name,"example",t.components[L].class_id);return{value:K,component:Y.component,runtime:Y.runtime}})))),!0)}let Le=o(()=>JSON.stringify(e(I)||[]));var Be=S(),Ye=B(Be);Ee(Ye,()=>Je(e(Le)),i=>{var G=S(),p=B(G);{var K=L=>{var Y=Pt();X(Y,21,()=>e(I),me,(fe,U,h)=>{var k=S(),Z=B(k);{var x=s=>{var c=Bt();c.__click=()=>{a(h+e(m)*u()),t.onclick({index:a(),value:e(U)}),t.onselect({index:a(),value:e(U)})};var C=T(c);{var O=n=>{{let l=o(()=>e(v)===h);Ae(n,{get value(){return e(U)[0]},get selected(){return e(l)},type:"gallery"})}},M=n=>{var l=dt();ne(()=>_e(l,e(U)[0])),r(n,l)};N(C,n=>{E()?n(O):n(M,!1)})}_(c),j("mouseenter",c,()=>A(h)),j("mouseleave",c,()=>D()),r(s,c)};N(Z,s=>{e(U)[0]!=null&&s(x)})}r(fe,k)}),_(Y),r(L,Y)};N(p,L=>{e(y)&&L(K)})}r(i,G)},(i,G)=>{var p=Nt(),K=B(p);{var L=h=>{var k=xt();X(k,21,()=>e(I),me,(Z,x,s)=>{var c=S(),C=B(c);{var O=M=>{var n=ht();n.__click=()=>{a(s+e(m)*u()),t.onclick({index:a(),value:e(x)}),t.onselect({index:a(),value:e(x)})};var l=T(n);{var R=d=>{{let V=o(()=>e(v)===s);Ae(d,{get value(){return e(x)[0]},get selected(){return e(V)},type:"gallery"})}},w=d=>{var V=S(),$=B(V);{var oe=ve=>{var ie=S(),ge=B(ie);Ee(ge,()=>Promise.all([e(z)[s][0].component,e(z)[s][0].runtime]),null,(pe,ee)=>{var te=o(()=>{var[ae,re]=e(ee);return{component:ae,runtime:re}}),he=o(()=>e(te).component),xe=o(()=>e(te).runtime),W=S(),q=B(W);gt(q,()=>e(x)[0],ae=>{{let re=o(()=>e(v)===s);Ge(ae,He({get component(){return e(he)},get runtime(){return e(xe)}},()=>t.component_props[0],{get value(){return e(x)[0]},get samples_dir(){return e(H)},type:"gallery",get selected(){return e(re)},index:s,get root(){return t.root}}))}}),r(pe,W)}),r(ve,ie)};N($,ve=>{e(z).length&&e(z)[s]&&ve(oe)},!0)}r(d,V)};N(l,d=>{E()?d(R):d(w,!1)})}_(n),j("mouseenter",n,()=>A(s)),j("mouseleave",n,()=>D()),r(M,n)};N(C,M=>{e(x)[0]!=null&&M(O)})}r(Z,c)}),_(k),r(h,k)},Y=h=>{var k=S(),Z=B(k);{var x=s=>{var c=wt(),C=T(c),O=T(C),M=T(O);X(M,20,()=>t.headers,l=>l,(l,R)=>{var w=yt(),d=T(w,!0);_(w),ne(()=>_e(d,R)),r(l,w)}),_(M),_(O);var n=se(O);X(n,21,()=>e(z),me,(l,R,w)=>{var d=kt();d.__click=()=>{a(w+e(m)*u()),t.onclick({index:a(),value:e(R)}),t.onselect({index:a(),value:e(I)[w]})},X(d,21,()=>e(R),me,(V,$,oe,ve)=>{let ie=()=>e($).value,ge=()=>e($).component,pe=()=>e($).runtime;const ee=o(()=>t.components[oe]);var te=S(),he=B(te);{var xe=W=>{var q=bt(),ae=T(q);Ee(ae,()=>Promise.all([ge(),pe()]),null,(re,Ce)=>{var Pe=o(()=>{var[ye,qe]=e(Ce);return{component:ye,runtime:qe}}),Ue=o(()=>e(Pe).component),Ze=o(()=>e(Pe).runtime);{let ye=o(()=>e(v)===w);Ge(re,He({get component(){return e(Ue)},get runtime(){return e(Ze)}},()=>t.component_props[oe],{get value(){return ie()},get samples_dir(){return e(H)},type:"table",get selected(){return e(ye)},index:w,get root(){return t.root}}))}}),_(q),ne(()=>{Ve(q,`max-width: ${e(ee)==="textbox"?"35ch":"auto"}`),ze(q,1,We(e(ee)),"svelte-16f20a1")}),r(W,q)};N(he,W=>{e(ee)!==void 0&&W(xe)})}r(V,te)}),_(d),j("mouseenter",d,()=>A(w)),j("mouseleave",d,()=>D()),r(l,d)}),_(n),_(C),_(c),r(s,c)};N(Z,s=>{e(I).length>0&&s(x)},!0)}r(h,k)};N(K,h=>{e(y)?h(L):h(Y,!1)})}var fe=se(K,2);{var U=h=>{var k=It(),Z=se(T(k));X(Z,16,()=>e(le),x=>x,(x,s)=>{var c=S(),C=B(c);{var O=n=>{var l=Et();r(n,l)},M=n=>{var l=Ht();l.__click=()=>Q(m,s,!0);let R;var w=T(l,!0);_(l),ne(()=>{R=ze(l,1,"svelte-16f20a1",null,R,{"current-page":e(m)===s}),_e(w,s+1)}),r(n,l)};N(C,n=>{s===-1?n(O):n(M,!1)})}r(x,c)}),_(k),r(h,k)};N(fe,h=>{e(g)&&h(U)})}r(i,p)}),r(J,Be),Ne()}ct(["click"]);var Mt=f('
        '),St=f(" ",1);function ra(J,t){Ie(t,!0);let E=Oe(t,["$$slots","$$events","$$legacy"]);const a=new ft(E);let u=o(()=>a.props.samples??[]);_t(J,{get visible(){return a.shared.visible},padding:!1,get elem_id(){return a.shared.elem_id},get elem_classes(){return a.shared.elem_classes},get scale(){return a.shared.scale},get min_width(){return a.shared.min_width},allow_overflow:!1,container:!1,children:(P,H)=>{var v=St(),y=B(v);{var b=g=>{var I=Mt(),F=se(T(I));_(I),ne(()=>_e(F,` ${(a.shared.label||"Examples")??""}`)),r(g,I)};N(y,g=>{a.shared.show_label&&g(b)})}var m=se(y,2);zt(m,He({onclick:g=>(a.props.value=g.index,a.dispatch("click",a.props.value)),onselect:g=>a.dispatch("select",g),get load_component(){return a.shared.load_component},get samples(){return e(u)}},()=>a.props)),r(P,v)},$$slots:{default:!0}}),Ne()}export{ra as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CaF916uK.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CaF916uK.js new file mode 100644 index 0000000000000000000000000000000000000000..92d3eeb0e32f9fe79a367d6fefab5c42a4a652ea --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CaF916uK.js @@ -0,0 +1 @@ +import{g as Y,i as x,r as Z,b as B,a as r,t as j}from"./i18n-Dnhn5Rxr.js";import{R as q,u as z,v as A,y as C,w as I,x as F,S,t as d,a as u,Z as o,X as l,T as H,V as G,W as c,M as J,a0 as N,a5 as K,a8 as L,Y as P}from"./index-DWyDLubb.js";import{b as O}from"./input-DrerMDOL.js";import{G as Q}from"./utils.svelte-CCyS_0CY.js";import{B as U}from"./Block-J4oodUWp.js";import{B as ee}from"./BlockTitle-BMm9LakX.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{I as te}from"./IconButtonWrapper-D0s9l4wW.js";import{S as ae}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./clone-BkeCM4Nl.js";import"./Info-Dzjhnd64.js";import"./html-Ih_5QVTo.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./index-B_pwUImq.js";var re=c('
        '),se=c(" ",1),oe=c(' ',1);function ke(T,_){q(_,!0);const W=Z(_,["$$slots","$$events","$$legacy"]),e=new Q(W);e.props.value??=0;let m=z(A(e.props.value));C(()=>{I(m)!=e.props.value&&(F(m,e.props.value,!0),e.dispatch("change"))});async function D(s){await J(),s.key==="Enter"&&(s.preventDefault(),e.dispatch("submit"))}const E=K(()=>!e.shared.interactive);U(T,{get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get padding(){return e.shared.container},allow_overflow:!1,get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},children:(s,le)=>{var v=oe(),h=S(v);ae(h,Y({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{show_validation_error:!1,on_clear_status:()=>{e.dispatch("clear_status",e.shared.loading_status)}}));var i=l(h,2);let f;var b=G(i);{var M=a=>{te(a,{get buttons(){return e.props.buttons},on_custom_button_click:$=>{e.dispatch("custom_button_click",{id:$})}})};x(b,a=>{e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0&&a(M)})}var g=l(b,2);ee(g,{get show_label(){return e.shared.show_label},get info(){return e.props.info},children:(a,$)=>{L();var y=se(),k=S(y),R=l(k);{var V=n=>{var p=re(),X=G(p,!0);P(p),d(()=>N(X,e.shared.loading_status?.validation_error)),u(n,p)};x(R,n=>{e.shared.loading_status?.validation_error&&n(V)})}d(()=>N(k,`${(e.shared.label||"Number")??""} `)),u(a,y)},$$slots:{default:!0}});var t=l(g,2);j(t);let w;P(i),d(()=>{f=B(i,1,"block svelte-16ty2ow",null,f,{container:e.shared.container}),r(t,"aria-label",e.shared.label||"Number"),r(t,"min",e.props.minimum),r(t,"max",e.props.maximum),r(t,"step",e.props.step),r(t,"placeholder",e.props.placeholder),t.disabled=I(E),w=B(t,1,"svelte-16ty2ow",null,w,{"validation-error":e.shared.loading_status?.validation_error})}),O(t,()=>e.props.value,a=>e.props.value=a),o("keypress",t,D),o("input",t,()=>e.dispatch("input")),o("blur",t,()=>e.dispatch("blur")),o("focus",t,()=>e.dispatch("focus")),u(s,v)},$$slots:{default:!0}}),H()}export{ke as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Ci-0XPiC.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Ci-0XPiC.css new file mode 100644 index 0000000000000000000000000000000000000000..9828b41622a34379fd7da7f20490ba7dad10a704 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Ci-0XPiC.css @@ -0,0 +1 @@ +.dialog-button.svelte-nbn1m9{display:block;width:var(--size-10);height:var(--size-5);border:var(--block-border-width) solid var(--block-border-color)}.dialog-button.svelte-nbn1m9:disabled{cursor:not-allowed}.input.svelte-nbn1m9{display:flex;align-items:center;padding:0 10px 15px}.input.svelte-nbn1m9 input:where(.svelte-nbn1m9){height:30px;width:100%;flex-shrink:1;border-bottom-left-radius:0;border:1px solid var(--block-border-color);letter-spacing:-.05rem;border-left:none;border-right:none;font-family:var(--font-mono);font-size:var(--scale-000);padding-left:15px;padding-right:0;background-color:var(--background-fill-secondary);color:var(--block-label-text-color)}.color-picker.svelte-nbn1m9{width:230px;background:var(--background-fill-secondary);border:1px solid var(--block-border-color);border-radius:var(--block-radius);margin:var(--spacing-sm) 0}.buttons.svelte-nbn1m9{height:20px;display:flex;justify-content:stretch;gap:0px}.buttons.svelte-nbn1m9 button:where(.svelte-nbn1m9){display:flex;align-items:center;justify-content:center;border:1px solid var(--block-border-color);background:var(--background-fill-secondary);padding:3px 6px;font-size:var(--scale-000);cursor:pointer;border-right:none;width:100%;border-top:none}.buttons.svelte-nbn1m9 button:where(.svelte-nbn1m9):first-child{border-left:none}.buttons.svelte-nbn1m9 button:where(.svelte-nbn1m9):last-child{border-bottom-right-radius:15px;border-right:1px solid var(--block-border-color)}.buttons.svelte-nbn1m9 button:where(.svelte-nbn1m9):hover{background:var(--background-fill-secondary-hover);font-weight:var(--weight-bold)}.buttons.svelte-nbn1m9 button.active:where(.svelte-nbn1m9){background:var(--background-fill-secondary);font-weight:var(--weight-bold)}.input-wrap.svelte-nbn1m9{display:flex}.color-gradient.svelte-nbn1m9{position:relative;--hue: white;background:linear-gradient(#0000,#000),linear-gradient(90deg,#fff,hsl(var(--hue),100%,50%));width:100%;height:150px;border-radius:var(--radius-sm) var(--radius-sm) 0 0}.hue-slider.svelte-nbn1m9{position:relative;width:90%;margin:10px auto;height:10px;border-radius:5px;background:linear-gradient(to right,red,#ff0 17%,#0f0 33%,#0ff,#00f 67%,#f0f 83%,red)}.swatch.svelte-nbn1m9{width:50px;height:50px;border-top-left-radius:15px;border-bottom-left-radius:15px;flex-shrink:0;border:1px solid var(--block-border-color)}.eyedropper.svelte-nbn1m9{display:flex;align-items:center;justify-content:center;width:25px;border-top-right-radius:15px;border:1px solid var(--block-border-color);border-left:none;background:var(--background-fill-secondary);height:30px;padding:7px 7px 5px 0;cursor:pointer}.marker.svelte-nbn1m9{position:absolute;width:14px;height:14px;border-radius:50%;border:2px solid white;top:-2px;left:-7px;box-shadow:0 1px 5px #0000001a;pointer-events:none}input.svelte-nbn1m9{width:100%;height:30px;border:1px solid var(--block-border-color);border-radius:var(--radius-sm);padding:0 var(--size-2);font-family:var(--font-mono);font-size:var(--scale-000);color:var(--block-label-text-color);background-color:var(--background-fill-primary)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Ci5Z17ae.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Ci5Z17ae.js new file mode 100644 index 0000000000000000000000000000000000000000..daa059b66e21a105b097e5a35c5cdf4ad1378715 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Ci5Z17ae.js @@ -0,0 +1 @@ +import{p as d,s as C,d as V,b as X,a as Y,f as q,g as A,i as D,r as F}from"./i18n-Dnhn5Rxr.js";import{aj as H,R as j,aa as J,x as c,w as a,y as K,V as k,X as z,Y as B,t as N,a as E,T as G,u as g,a5 as P,W as T,S as R,a6 as O}from"./index-DWyDLubb.js";import{G as U}from"./utils.svelte-CCyS_0CY.js";import{S as Z}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{B as $}from"./Index.svelte_svelte_type_style_lang-BKODC18H.js";import"./clone-BkeCM4Nl.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var ee=T('
        ');function te(b,t){j(t,!0);let m=d(t,"open",15,!0),e=d(t,"position",11,"left"),v=d(t,"elem_classes",19,()=>[]),_=d(t,"elem_id",3,""),w=d(t,"onexpand",3,()=>{}),x=d(t,"oncollapse",3,()=>{}),n=g(!1),s=g(!1),r,f=g(0),y=P(()=>typeof t.width=="number"?`${t.width}px`:t.width),i=g(!1);function p(){if(!r.closest(".wrap"))return;const l=r.closest(".wrap")?.getBoundingClientRect();if(!l)return;const u=r.getBoundingClientRect(),h=e()==="left"?l.left:window.innerWidth-l.right;c(f,Math.max(0,u.width-h+30),!0)}J(()=>{r.closest(".wrap")?.classList.add("sidebar-parent"),p(),window.addEventListener("resize",p),document.documentElement.style.setProperty("--overlap-amount",`${a(f)}px`),c(n,!0);const u=window.matchMedia("(prefers-reduced-motion: reduce)");c(i,u.matches,!0);const h=Q=>{c(i,Q.matches,!0)};return u.addEventListener("change",h),()=>{window.removeEventListener("resize",p),u.removeEventListener("change",h)}}),K(()=>{a(n)&&c(s,m(),!0)});let W=P(()=>v()?.join(" ")||"");var o=ee();let L;var M=k(o);M.__click=()=>{c(s,!a(s)),m(a(s)),a(s)?w()?.():x()?.()};var S=z(M,2),I=k(S);C(I,t,"default",{}),B(S),B(o),V(o,l=>r=l,()=>r),N(()=>{L=X(o,1,`sidebar ${a(W)??""}`,"svelte-1uruprb",L,{open:a(s),right:e()==="right","reduce-motion":a(i)}),Y(o,"id",_()),q(o,`width: ${a(y)??""}; ${e()??""}: calc(${a(y)??""} * -1)`)}),E(b,o),G()}H(["click"]);var se=T(" ",1);function _e(b,t){j(t,!0);const m=F(t,["$$slots","$$events","$$legacy"]),e=new U(m);var v=se(),_=R(v);Z(_,A({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status));var w=z(_,2);{var x=n=>{te(n,{get width(){return e.props.width},onexpand:()=>e.dispatch("expand"),oncollapse:()=>e.dispatch("collapse"),get elem_classes(){return e.shared.elem_classes},get elem_id(){return e.shared.elem_id},get open(){return e.props.open},set open(s){e.props.open=s},get position(){return e.props.position},set position(s){e.props.position=s},children:(s,r)=>{$(s,{children:(f,y)=>{var i=O(),p=R(i);C(p,t,"default",{}),E(f,i)},$$slots:{default:!0}})},$$slots:{default:!0}})};D(w,n=>{e.shared.visible&&n(x)})}E(b,v),G()}export{_e as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CmTVIgCq.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CmTVIgCq.js new file mode 100644 index 0000000000000000000000000000000000000000..615279476f38ae7941771d3e820e0f4498eb521c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CmTVIgCq.js @@ -0,0 +1,10 @@ +import{p as C,b as De,a as ge,h as Lr,i as H,d as it,f as ot,t as An,F as Dn,k as mt,u as Or,g as Hr,r as jr}from"./i18n-Dnhn5Rxr.js";import{u as ne,v as $e,ai as rn,w as l,x as p,y as st,z as Gr,aj as et,R as Xe,t as ae,a as k,T as Ye,a5 as R,V,W as Y,Y as E,S as ce,X as D,A as Br,Z as Et,ak as Tr,a6 as Ce,a7 as Ln,a0 as _e,f as Le,aa as on,M as xt,aw as qr}from"./index-DWyDLubb.js";import{h as On}from"./html-Ih_5QVTo.js";import{a as Jt}from"./actions-CLThs9VH.js";import{b as Nr}from"./size-CtOeLwIl.js";import{U as Wr}from"./Upload-HitvyI7k.js";import{c as Ur,I as Kr}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{M as Hn}from"./MarkdownCode-B8HQ3LiU.js";import{b as Xr}from"./input-DrerMDOL.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{C as jn}from"./Checkbox-HhbcVSTv.js";import{C as Zt}from"./Check-DUAHzS2-.js";import{D as Yr}from"./DropdownArrow-BOSZEGSp.js";import{C as Jr}from"./Copy-ChCbTvli.js";import{F as Zr}from"./FullscreenButton-sCrcy_OJ.js";import{d as Qr}from"./dsv-DB8NKgIY.js";import{S as $r}from"./index-CglBvmLb.js";import{B as eo}from"./Block-J4oodUWp.js";import{G as to}from"./utils.svelte-CCyS_0CY.js";import{default as os}from"./Example-DD1VGTCq.js";import"./snippet-BWgYNF9D.js";import"./prism-python-B4lzO_Nz.js";import"./index-B_pwUImq.js";import"./clone-BkeCM4Nl.js";import"./universal-CFOISHmx.js";import"./Maximize-QH9NIRWs.js";import"./Clear-BF6j078A.js";function lt(e,t){return typeof e=="function"?e(t):e}function Ge(e,t){return n=>{t.setState(r=>({...r,[e]:lt(n,r[e])}))}}function Vt(e){return e instanceof Function}function no(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function ro(e,t){const n=[],r=o=>{o.forEach(i=>{n.push(i);const s=t(i);s!=null&&s.length&&r(s)})};return r(e),n}function q(e,t,n){let r=[],o;return i=>{let s;n.key&&n.debug&&(s=Date.now());const a=e(i);if(!(a.length!==r.length||a.some((_,h)=>r[h]!==_)))return o;r=a;let g;if(n.key&&n.debug&&(g=Date.now()),o=t(...a),n==null||n.onChange==null||n.onChange(o),n.key&&n.debug&&n!=null&&n.debug()){const _=Math.round((Date.now()-s)*100)/100,h=Math.round((Date.now()-g)*100)/100,d=h/16,c=(v,m)=>{for(v=String(v);v.length{var o;return(o=e?.debugAll)!=null?o:e[t]},key:!1,onChange:r}}function oo(e,t,n,r){const o=()=>{var s;return(s=i.getValue())!=null?s:e.options.renderFallbackValue},i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:o,getContext:q(()=>[e,n,t,i],(s,a,u,g)=>({table:s,column:a,row:u,cell:g,getValue:g.getValue,renderValue:g.renderValue}),N(e.options,"debugCells"))};return e._features.forEach(s=>{s.createCell==null||s.createCell(i,n,t,e)},{}),i}function io(e,t,n,r){var o,i;const a={...e._getDefaultColumnDef(),...t},u=a.accessorKey;let g=(o=(i=a.id)!=null?i:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?o:typeof a.header=="string"?a.header:void 0,_;if(a.accessorFn?_=a.accessorFn:u&&(u.includes(".")?_=d=>{let c=d;for(const m of u.split(".")){var v;c=(v=c)==null?void 0:v[m]}return c}:_=d=>d[a.accessorKey]),!g)throw new Error;let h={id:`${String(g)}`,accessorFn:_,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:q(()=>[!0],()=>{var d;return[h,...(d=h.columns)==null?void 0:d.flatMap(c=>c.getFlatColumns())]},N(e.options,"debugColumns")),getLeafColumns:q(()=>[e._getOrderColumnsFn()],d=>{var c;if((c=h.columns)!=null&&c.length){let v=h.columns.flatMap(m=>m.getLeafColumns());return d(v)}return[h]},N(e.options,"debugColumns"))};for(const d of e._features)d.createColumn==null||d.createColumn(h,e);return h}const Ie="debugHeaders";function yn(e,t,n){var r;let i={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const s=[],a=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(a),s.push(u)};return a(i),s},getContext:()=>({table:e,header:i,column:t})};return e._features.forEach(s=>{s.createHeader==null||s.createHeader(i,e)}),i}const lo={createTable:e=>{e.getHeaderGroups=q(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>{var i,s;const a=(i=r?.map(h=>n.find(d=>d.id===h)).filter(Boolean))!=null?i:[],u=(s=o?.map(h=>n.find(d=>d.id===h)).filter(Boolean))!=null?s:[],g=n.filter(h=>!(r!=null&&r.includes(h.id))&&!(o!=null&&o.includes(h.id)));return kt(t,[...a,...g,...u],e)},N(e.options,Ie)),e.getCenterHeaderGroups=q(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>(n=n.filter(i=>!(r!=null&&r.includes(i.id))&&!(o!=null&&o.includes(i.id))),kt(t,n,e,"center")),N(e.options,Ie)),e.getLeftHeaderGroups=q(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var o;const i=(o=r?.map(s=>n.find(a=>a.id===s)).filter(Boolean))!=null?o:[];return kt(t,i,e,"left")},N(e.options,Ie)),e.getRightHeaderGroups=q(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var o;const i=(o=r?.map(s=>n.find(a=>a.id===s)).filter(Boolean))!=null?o:[];return kt(t,i,e,"right")},N(e.options,Ie)),e.getFooterGroups=q(()=>[e.getHeaderGroups()],t=>[...t].reverse(),N(e.options,Ie)),e.getLeftFooterGroups=q(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),N(e.options,Ie)),e.getCenterFooterGroups=q(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),N(e.options,Ie)),e.getRightFooterGroups=q(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),N(e.options,Ie)),e.getFlatHeaders=q(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),N(e.options,Ie)),e.getLeftFlatHeaders=q(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),N(e.options,Ie)),e.getCenterFlatHeaders=q(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),N(e.options,Ie)),e.getRightFlatHeaders=q(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),N(e.options,Ie)),e.getCenterLeafHeaders=q(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),N(e.options,Ie)),e.getLeftLeafHeaders=q(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),N(e.options,Ie)),e.getRightLeafHeaders=q(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),N(e.options,Ie)),e.getLeafHeaders=q(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var o,i,s,a,u,g;return[...(o=(i=t[0])==null?void 0:i.headers)!=null?o:[],...(s=(a=n[0])==null?void 0:a.headers)!=null?s:[],...(u=(g=r[0])==null?void 0:g.headers)!=null?u:[]].map(_=>_.getLeafHeaders()).flat()},N(e.options,Ie))}};function kt(e,t,n,r){var o,i;let s=0;const a=function(d,c){c===void 0&&(c=1),s=Math.max(s,c),d.filter(v=>v.getIsVisible()).forEach(v=>{var m;(m=v.columns)!=null&&m.length&&a(v.columns,c+1)},0)};a(e);let u=[];const g=(d,c)=>{const v={depth:c,id:[r,`${c}`].filter(Boolean).join("_"),headers:[]},m=[];d.forEach(M=>{const I=[...m].reverse()[0],b=M.column.depth===v.depth;let G,X=!1;if(b&&M.column.parent?G=M.column.parent:(G=M.column,X=!0),I&&I?.column===G)I.subHeaders.push(M);else{const P=yn(n,G,{id:[r,c,G.id,M?.id].filter(Boolean).join("_"),isPlaceholder:X,placeholderId:X?`${m.filter(A=>A.column===G).length}`:void 0,depth:c,index:m.length});P.subHeaders.push(M),m.push(P)}v.headers.push(M),M.headerGroup=v}),u.push(v),c>0&&g(m,c-1)},_=t.map((d,c)=>yn(n,d,{depth:s,index:c}));g(_,s-1),u.reverse();const h=d=>d.filter(v=>v.column.getIsVisible()).map(v=>{let m=0,M=0,I=[0];v.subHeaders&&v.subHeaders.length?(I=[],h(v.subHeaders).forEach(G=>{let{colSpan:X,rowSpan:P}=G;m+=X,I.push(P)})):m=1;const b=Math.min(...I);return M=M+b,v.colSpan=m,v.rowSpan=M,{colSpan:m,rowSpan:M}});return h((o=(i=u[0])==null?void 0:i.headers)!=null?o:[]),u}const ln=(e,t,n,r,o,i,s)=>{let a={id:t,index:r,original:n,depth:o,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(a._valuesCache.hasOwnProperty(u))return a._valuesCache[u];const g=e.getColumn(u);if(g!=null&&g.accessorFn)return a._valuesCache[u]=g.accessorFn(a.original,r),a._valuesCache[u]},getUniqueValues:u=>{if(a._uniqueValuesCache.hasOwnProperty(u))return a._uniqueValuesCache[u];const g=e.getColumn(u);if(g!=null&&g.accessorFn)return g.columnDef.getUniqueValues?(a._uniqueValuesCache[u]=g.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[u]):(a._uniqueValuesCache[u]=[a.getValue(u)],a._uniqueValuesCache[u])},renderValue:u=>{var g;return(g=a.getValue(u))!=null?g:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>ro(a.subRows,u=>u.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let u=[],g=a;for(;;){const _=g.getParentRow();if(!_)break;u.push(_),g=_}return u.reverse()},getAllCells:q(()=>[e.getAllLeafColumns()],u=>u.map(g=>oo(e,a,g,g.id)),N(e.options,"debugRows")),_getAllCellsByColumnId:q(()=>[a.getAllCells()],u=>u.reduce((g,_)=>(g[_.column.id]=_,g),{}),N(e.options,"debugRows"))};for(let u=0;u{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Gn=(e,t,n)=>{var r,o;const i=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((o=e.getValue(t))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(i))};Gn.autoRemove=e=>Ke(e);const Bn=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};Bn.autoRemove=e=>Ke(e);const Tn=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};Tn.autoRemove=e=>Ke(e);const qn=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};qn.autoRemove=e=>Ke(e);const Nn=(e,t,n)=>!n.some(r=>{var o;return!((o=e.getValue(t))!=null&&o.includes(r))});Nn.autoRemove=e=>Ke(e)||!(e!=null&&e.length);const Wn=(e,t,n)=>n.some(r=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(r)});Wn.autoRemove=e=>Ke(e)||!(e!=null&&e.length);const Un=(e,t,n)=>e.getValue(t)===n;Un.autoRemove=e=>Ke(e);const Kn=(e,t,n)=>e.getValue(t)==n;Kn.autoRemove=e=>Ke(e);const sn=(e,t,n)=>{let[r,o]=n;const i=e.getValue(t);return i>=r&&i<=o};sn.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,o=typeof n!="number"?parseFloat(n):n,i=t===null||Number.isNaN(r)?-1/0:r,s=n===null||Number.isNaN(o)?1/0:o;if(i>s){const a=i;i=s,s=a}return[i,s]};sn.autoRemove=e=>Ke(e)||Ke(e[0])&&Ke(e[1]);const tt={includesString:Gn,includesStringSensitive:Bn,equalsString:Tn,arrIncludes:qn,arrIncludesAll:Nn,arrIncludesSome:Wn,equals:Un,weakEquals:Kn,inNumberRange:sn};function Ke(e){return e==null||e===""}const ao={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Ge("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n?.getValue(e.id);return typeof r=="string"?tt.includesString:typeof r=="number"?tt.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?tt.equals:Array.isArray(r)?tt.arrIncludes:tt.weakEquals},e.getFilterFn=()=>{var n,r;return Vt(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:tt[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,o;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const o=e.getFilterFn(),i=r?.find(_=>_.id===e.id),s=lt(n,i?i.value:void 0);if(bn(o,s,e)){var a;return(a=r?.filter(_=>_.id!==e.id))!=null?a:[]}const u={id:e.id,value:s};if(i){var g;return(g=r?.map(_=>_.id===e.id?u:_))!=null?g:[]}return r!=null&&r.length?[...r,u]:[u]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=o=>{var i;return(i=lt(t,o))==null?void 0:i.filter(s=>{const a=n.find(u=>u.id===s.id);if(a){const u=a.getFilterFn();if(bn(u,s.value,a))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function bn(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const uo=(e,t,n)=>n.reduce((r,o)=>{const i=o.getValue(e);return r+(typeof i=="number"?i:0)},0),co=(e,t,n)=>{let r;return n.forEach(o=>{const i=o.getValue(e);i!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}),r},go=(e,t,n)=>{let r;return n.forEach(o=>{const i=o.getValue(e);i!=null&&(r=i)&&(r=i)}),r},fo=(e,t,n)=>{let r,o;return n.forEach(i=>{const s=i.getValue(e);s!=null&&(r===void 0?s>=s&&(r=o=s):(r>s&&(r=s),o{let n=0,r=0;if(t.forEach(o=>{let i=o.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},_o=(e,t)=>{if(!t.length)return;const n=t.map(i=>i.getValue(e));if(!no(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),o=n.sort((i,s)=>i-s);return n.length%2!==0?o[r]:(o[r-1]+o[r])/2},vo=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),mo=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,po=(e,t)=>t.length,qt={sum:uo,min:co,max:go,extent:fo,mean:ho,median:_o,unique:vo,uniqueCount:mo,count:po},wo={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Ge("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n?.getValue(e.id);if(typeof r=="number")return qt.sum;if(Object.prototype.toString.call(r)==="[object Date]")return qt.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return Vt(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:qt[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=n.subRows)!=null&&o.length)}}};function So(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(i=>!t.includes(i.id));return n==="remove"?r:[...t.map(i=>e.find(s=>s.id===i)).filter(Boolean),...r]}const Co={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Ge("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=q(n=>[bt(t,n)],n=>n.findIndex(r=>r.id===e.id),N(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=bt(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const o=bt(t,n);return((r=o[o.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=q(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>o=>{let i=[];if(!(t!=null&&t.length))i=o;else{const s=[...t],a=[...o];for(;a.length&&s.length;){const u=s.shift(),g=a.findIndex(_=>_.id===u);g>-1&&i.push(a.splice(g,1)[0])}i=[...i,...a]}return So(i,n,r)},N(e.options,"debugTable"))}},Nt=()=>({left:[],right:[]}),xo={getInitialState:e=>({columnPinning:Nt(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Ge("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(o=>o.id).filter(Boolean);t.setColumnPinning(o=>{var i,s;if(n==="right"){var a,u;return{left:((a=o?.left)!=null?a:[]).filter(h=>!(r!=null&&r.includes(h))),right:[...((u=o?.right)!=null?u:[]).filter(h=>!(r!=null&&r.includes(h))),...r]}}if(n==="left"){var g,_;return{left:[...((g=o?.left)!=null?g:[]).filter(h=>!(r!=null&&r.includes(h))),...r],right:((_=o?.right)!=null?_:[]).filter(h=>!(r!=null&&r.includes(h)))}}return{left:((i=o?.left)!=null?i:[]).filter(h=>!(r!=null&&r.includes(h))),right:((s=o?.right)!=null?s:[]).filter(h=>!(r!=null&&r.includes(h)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var o,i,s;return((o=r.columnDef.enablePinning)!=null?o:!0)&&((i=(s=t.options.enableColumnPinning)!=null?s:t.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(a=>a.id),{left:r,right:o}=t.getState().columnPinning,i=n.some(a=>r?.includes(a)),s=n.some(a=>o?.includes(a));return i?"left":s?"right":!1},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();return o?(n=(r=t.getState().columnPinning)==null||(r=r[o])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=q(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,o)=>{const i=[...r??[],...o??[]];return n.filter(s=>!i.includes(s.column.id))},N(t.options,"debugRows")),e.getLeftVisibleCells=q(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(i=>n.find(s=>s.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),N(t.options,"debugRows")),e.getRightVisibleCells=q(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(i=>n.find(s=>s.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),N(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?Nt():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:Nt())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var o,i;return!!((o=r.left)!=null&&o.length||(i=r.right)!=null&&i.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=q(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(o=>o.id===r)).filter(Boolean),N(e.options,"debugColumns")),e.getRightLeafColumns=q(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(o=>o.id===r)).filter(Boolean),N(e.options,"debugColumns")),e.getCenterLeafColumns=q(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const o=[...n??[],...r??[]];return t.filter(i=>!o.includes(i.id))},N(e.options,"debugColumns"))}};function Ro(e){return e||(typeof document<"u"?document:null)}const It={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Wt=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),yo={getDefaultColumnDef:()=>It,getInitialState:e=>({columnSizing:{},columnSizingInfo:Wt(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Ge("columnSizing",e),onColumnSizingInfoChange:Ge("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,o;const i=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:It.minSize,(r=i??e.columnDef.size)!=null?r:It.size),(o=e.columnDef.maxSize)!=null?o:It.maxSize)},e.getStart=q(n=>[n,bt(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((o,i)=>o+i.getSize(),0),N(t.options,"debugColumns")),e.getAfter=q(n=>[n,bt(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((o,i)=>o+i.getSize(),0),N(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...o}=n;return o})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=o=>{if(o.subHeaders.length)o.subHeaders.forEach(r);else{var i;n+=(i=o.column.getSize())!=null?i:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),o=r?.getCanResize();return i=>{if(!r||!o||(i.persist==null||i.persist(),Ut(i)&&i.touches&&i.touches.length>1))return;const s=e.getSize(),a=e?e.getLeafHeaders().map(I=>[I.column.id,I.column.getSize()]):[[r.id,r.getSize()]],u=Ut(i)?Math.round(i.touches[0].clientX):i.clientX,g={},_=(I,b)=>{typeof b=="number"&&(t.setColumnSizingInfo(G=>{var X,P;const A=t.options.columnResizeDirection==="rtl"?-1:1,B=(b-((X=G?.startOffset)!=null?X:0))*A,ie=Math.max(B/((P=G?.startSize)!=null?P:0),-.999999);return G.columnSizingStart.forEach(re=>{let[U,z]=re;g[U]=Math.round(Math.max(z+z*ie,0)*100)/100}),{...G,deltaOffset:B,deltaPercentage:ie}}),(t.options.columnResizeMode==="onChange"||I==="end")&&t.setColumnSizing(G=>({...G,...g})))},h=I=>_("move",I),d=I=>{_("end",I),t.setColumnSizingInfo(b=>({...b,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},c=Ro(n),v={moveHandler:I=>h(I.clientX),upHandler:I=>{c?.removeEventListener("mousemove",v.moveHandler),c?.removeEventListener("mouseup",v.upHandler),d(I.clientX)}},m={moveHandler:I=>(I.cancelable&&(I.preventDefault(),I.stopPropagation()),h(I.touches[0].clientX),!1),upHandler:I=>{var b;c?.removeEventListener("touchmove",m.moveHandler),c?.removeEventListener("touchend",m.upHandler),I.cancelable&&(I.preventDefault(),I.stopPropagation()),d((b=I.touches[0])==null?void 0:b.clientX)}},M=bo()?{passive:!1}:!1;Ut(i)?(c?.addEventListener("touchmove",m.moveHandler,M),c?.addEventListener("touchend",m.upHandler,M)):(c?.addEventListener("mousemove",v.moveHandler,M),c?.addEventListener("mouseup",v.upHandler,M)),t.setColumnSizingInfo(I=>({...I,startOffset:u,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?Wt():(n=e.initialState.columnSizingInfo)!=null?n:Wt())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0}}};let Pt=null;function bo(){if(typeof Pt=="boolean")return Pt;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Pt=e,Pt}function Ut(e){return e.type==="touchstart"}const Fo={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Ge("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const o=e.columns;return(n=o.length?o.some(i=>i.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=q(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),N(t.options,"debugRows")),e.getVisibleCells=q(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,o)=>[...n,...r,...o],N(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>q(()=>[r(),r().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),N(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,i)=>({...o,[i.id]:n||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function bt(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Mo={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},ko={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Ge("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,o,i;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&((i=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>tt.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return Vt(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:tt[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},Io={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Ge("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,o;if(!t){e._queue(()=>{t=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var o,i;e.setExpanded(r?{}:(o=(i=e.initialState)==null?void 0:i.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const s=i.split(".");r=Math.max(r,s.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var o;const i=r===!0?!0:!!(r!=null&&r[e.id]);let s={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(a=>{s[a]=!0}):s=r,n=(o=n)!=null?o:!i,!i&&n)return{...s,[e.id]:!0};if(i&&!n){const{[e.id]:a,...u}=s;return u}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r?.[e.id])},e.getCanExpand=()=>{var n,r,o;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},Qt=0,$t=10,Kt=()=>({pageIndex:Qt,pageSize:$t}),Po={getInitialState:e=>({...e,pagination:{...Kt(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Ge("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,o;if(!t){e._queue(()=>{t=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const o=i=>lt(r,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=r=>{var o;e.setPagination(r?Kt():(o=e.initialState.pagination)!=null?o:Kt())},e.setPageIndex=r=>{e.setPagination(o=>{let i=lt(r,o.pageIndex);const s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,s)),{...o,pageIndex:i}})},e.resetPageIndex=r=>{var o,i;e.setPageIndex(r?Qt:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?o:Qt)},e.resetPageSize=r=>{var o,i;e.setPageSize(r?$t:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?o:$t)},e.setPageSize=r=>{e.setPagination(o=>{const i=Math.max(1,lt(r,o.pageSize)),s=o.pageSize*o.pageIndex,a=Math.floor(s/i);return{...o,pageIndex:a,pageSize:i}})},e.setPageCount=r=>e.setPagination(o=>{var i;let s=lt(r,(i=e.options.pageCount)!=null?i:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...o,pageCount:s}}),e.getPageOptions=q(()=>[e.getPageCount()],r=>{let o=[];return r&&r>0&&(o=[...new Array(r)].fill(null).map((i,s)=>s)),o},N(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},Xt=()=>({top:[],bottom:[]}),Eo={getInitialState:e=>({rowPinning:Xt(),...e}),getDefaultOptions:e=>({onRowPinningChange:Ge("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,o)=>{const i=r?e.getLeafRows().map(u=>{let{id:g}=u;return g}):[],s=o?e.getParentRows().map(u=>{let{id:g}=u;return g}):[],a=new Set([...s,e.id,...i]);t.setRowPinning(u=>{var g,_;if(n==="bottom"){var h,d;return{top:((h=u?.top)!=null?h:[]).filter(m=>!(a!=null&&a.has(m))),bottom:[...((d=u?.bottom)!=null?d:[]).filter(m=>!(a!=null&&a.has(m))),...Array.from(a)]}}if(n==="top"){var c,v;return{top:[...((c=u?.top)!=null?c:[]).filter(m=>!(a!=null&&a.has(m))),...Array.from(a)],bottom:((v=u?.bottom)!=null?v:[]).filter(m=>!(a!=null&&a.has(m)))}}return{top:((g=u?.top)!=null?g:[]).filter(m=>!(a!=null&&a.has(m))),bottom:((_=u?.bottom)!=null?_:[]).filter(m=>!(a!=null&&a.has(m)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:o}=t.options;return typeof r=="function"?r(e):(n=r??o)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:o}=t.getState().rowPinning,i=n.some(a=>r?.includes(a)),s=n.some(a=>o?.includes(a));return i?"top":s?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();if(!o)return-1;const i=(n=o==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(s=>{let{id:a}=s;return a});return(r=i?.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?Xt():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:Xt())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var o,i;return!!((o=r.top)!=null&&o.length||(i=r.bottom)!=null&&i.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(n??[]).map(s=>{const a=e.getRow(s,!0);return a.getIsAllParentsExpanded()?a:null}):(n??[]).map(s=>t.find(a=>a.id===s))).filter(Boolean).map(s=>({...s,position:r}))},e.getTopRows=q(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),N(e.options,"debugRows")),e.getBottomRows=q(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),N(e.options,"debugRows")),e.getCenterRows=q(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const o=new Set([...n??[],...r??[]]);return t.filter(i=>!o.has(i.id))},N(e.options,"debugRows"))}},Vo={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Ge("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(i=>{i.getCanSelect()&&(r[i.id]=!0)}):o.forEach(i=>{delete r[i.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach(i=>{en(o,i.id,r,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=q(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Yt(e,n):{rows:[],flatRows:[],rowsById:{}},N(e.options,"debugTable")),e.getFilteredSelectedRowModel=q(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Yt(e,n):{rows:[],flatRows:[],rowsById:{}},N(e.options,"debugTable")),e.getGroupedSelectedRowModel=q(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Yt(e,n):{rows:[],flatRows:[],rowsById:{}},N(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(o=>o.getCanSelect()&&!n[o.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(o=>!n[o.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const o=e.getIsSelected();t.setRowSelection(i=>{var s;if(n=typeof n<"u"?n:!o,e.getCanSelect()&&o===n)return i;const a={...i};return en(a,e.id,n,(s=r?.selectChildren)!=null?s:!0,t),a})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return an(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return tn(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return tn(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var o;n&&e.toggleSelected((o=r.target)==null?void 0:o.checked)}}}},en=(e,t,n,r,o)=>{var i;const s=o.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(a=>delete e[a]),s.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(i=s.subRows)!=null&&i.length&&s.getCanSelectSubRows()&&s.subRows.forEach(a=>en(e,a.id,n,r,o))};function Yt(e,t){const n=e.getState().rowSelection,r=[],o={},i=function(s,a){return s.map(u=>{var g;const _=an(u,n);if(_&&(r.push(u),o[u.id]=u),(g=u.subRows)!=null&&g.length&&(u={...u,subRows:i(u.subRows)}),_)return u}).filter(Boolean)};return{rows:i(t.rows),flatRows:r,rowsById:o}}function an(e,t){var n;return(n=t[e.id])!=null?n:!1}function tn(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let o=!0,i=!1;return e.subRows.forEach(s=>{if(!(i&&!o)&&(s.getCanSelect()&&(an(s,t)?i=!0:o=!1),s.subRows&&s.subRows.length)){const a=tn(s,t);a==="all"?i=!0:(a==="some"&&(i=!0),o=!1)}}),o?"all":i?"some":!1}const nn=/([0-9]+)/gm,zo=(e,t,n)=>Xn(at(e.getValue(n)).toLowerCase(),at(t.getValue(n)).toLowerCase()),Ao=(e,t,n)=>Xn(at(e.getValue(n)),at(t.getValue(n))),Do=(e,t,n)=>un(at(e.getValue(n)).toLowerCase(),at(t.getValue(n)).toLowerCase()),Lo=(e,t,n)=>un(at(e.getValue(n)),at(t.getValue(n))),Oo=(e,t,n)=>{const r=e.getValue(n),o=t.getValue(n);return r>o?1:run(e.getValue(n),t.getValue(n));function un(e,t){return e===t?0:e>t?1:-1}function at(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Xn(e,t){const n=e.split(nn).filter(Boolean),r=t.split(nn).filter(Boolean);for(;n.length&&r.length;){const o=n.shift(),i=r.shift(),s=parseInt(o,10),a=parseInt(i,10),u=[s,a].sort();if(isNaN(u[0])){if(o>i)return 1;if(i>o)return-1;continue}if(isNaN(u[1]))return isNaN(s)?-1:1;if(s>a)return 1;if(a>s)return-1}return n.length-r.length}const Rt={alphanumeric:zo,alphanumericCaseSensitive:Ao,text:Do,textCaseSensitive:Lo,datetime:Oo,basic:Ho},jo={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Ge("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const o of n){const i=o?.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return Rt.datetime;if(typeof i=="string"&&(r=!0,i.split(nn).length>1))return Rt.alphanumeric}return r?Rt.text:Rt.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof n?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return Vt(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Rt[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const o=e.getNextSortingOrder(),i=typeof n<"u"&&n!==null;t.setSorting(s=>{const a=s?.find(c=>c.id===e.id),u=s?.findIndex(c=>c.id===e.id);let g=[],_,h=i?n:o==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&r?a?_="toggle":_="add":s!=null&&s.length&&u!==s.length-1?_="replace":a?_="toggle":_="replace",_==="toggle"&&(i||o||(_="remove")),_==="add"){var d;g=[...s,{id:e.id,desc:h}],g.splice(0,g.length-((d=t.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else _==="toggle"?g=s.map(c=>c.id===e.id?{...c,desc:h}:c):_==="remove"?g=s.filter(c=>c.id!==e.id):g=[{id:e.id,desc:h}];return g})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,o;const i=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==i&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(o=t.options.enableMultiRemove)!=null)||o)?!1:s==="desc"?"asc":"desc":i},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(o=>o.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Go=[lo,Fo,Co,xo,so,ao,Mo,ko,jo,wo,Io,Po,Eo,Vo,yo];function Bo(e){var t,n;const r=[...Go,...(t=e._features)!=null?t:[]];let o={_features:r};const i=o._features.reduce((d,c)=>Object.assign(d,c.getDefaultOptions==null?void 0:c.getDefaultOptions(o)),{}),s=d=>o.options.mergeOptions?o.options.mergeOptions(i,d):{...i,...d};let u={...{},...(n=e.initialState)!=null?n:{}};o._features.forEach(d=>{var c;u=(c=d.getInitialState==null?void 0:d.getInitialState(u))!=null?c:u});const g=[];let _=!1;const h={_features:r,options:{...i,...e},initialState:u,_queue:d=>{g.push(d),_||(_=!0,Promise.resolve().then(()=>{for(;g.length;)g.shift()();_=!1}).catch(c=>setTimeout(()=>{throw c})))},reset:()=>{o.setState(o.initialState)},setOptions:d=>{const c=lt(d,o.options);o.options=s(c)},getState:()=>o.options.state,setState:d=>{o.options.onStateChange==null||o.options.onStateChange(d)},_getRowId:(d,c,v)=>{var m;return(m=o.options.getRowId==null?void 0:o.options.getRowId(d,c,v))!=null?m:`${v?[v.id,c].join("."):c}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(d,c)=>{let v=(c?o.getPrePaginationRowModel():o.getRowModel()).rowsById[d];if(!v&&(v=o.getCoreRowModel().rowsById[d],!v))throw new Error;return v},_getDefaultColumnDef:q(()=>[o.options.defaultColumn],d=>{var c;return d=(c=d)!=null?c:{},{header:v=>{const m=v.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:v=>{var m,M;return(m=(M=v.renderValue())==null||M.toString==null?void 0:M.toString())!=null?m:null},...o._features.reduce((v,m)=>Object.assign(v,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...d}},N(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:q(()=>[o._getColumnDefs()],d=>{const c=function(v,m,M){return M===void 0&&(M=0),v.map(I=>{const b=io(o,I,M,m),G=I;return b.columns=G.columns?c(G.columns,b,M+1):[],b})};return c(d)},N(e,"debugColumns")),getAllFlatColumns:q(()=>[o.getAllColumns()],d=>d.flatMap(c=>c.getFlatColumns()),N(e,"debugColumns")),_getAllFlatColumnsById:q(()=>[o.getAllFlatColumns()],d=>d.reduce((c,v)=>(c[v.id]=v,c),{}),N(e,"debugColumns")),getAllLeafColumns:q(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(d,c)=>{let v=d.flatMap(m=>m.getLeafColumns());return c(v)},N(e,"debugColumns")),getColumn:d=>o._getAllFlatColumnsById()[d]};Object.assign(o,h);for(let d=0;dq(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(o,i,s){i===void 0&&(i=0);const a=[];for(let g=0;ge._autoResetPageIndex()))}function qo(e,t,n){return n.options.filterFromLeafRows?No(e,t,n):Wo(e,t,n)}function No(e,t,n){var r;const o=[],i={},s=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,a=function(u,g){g===void 0&&(g=0);const _=[];for(let d=0;dq(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let d=0;d{var c;const v=e.getColumn(d.id);if(!v)return;const m=v.getFilterFn();m&&o.push({id:d.id,filterFn:m,resolvedValue:(c=m.resolveFilterValue==null?void 0:m.resolveFilterValue(d.value))!=null?c:d.value})});const s=(n??[]).map(d=>d.id),a=e.getGlobalFilterFn(),u=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());r&&a&&u.length&&(s.push("__global__"),u.forEach(d=>{var c;i.push({id:d.id,filterFn:a,resolvedValue:(c=a.resolveFilterValue==null?void 0:a.resolveFilterValue(r))!=null?c:r})}));let g,_;for(let d=0;d{c.columnFiltersMeta[m]=M})}if(i.length){for(let v=0;v{c.columnFiltersMeta[m]=M})){c.columnFilters.__global__=!0;break}}c.columnFilters.__global__!==!0&&(c.columnFilters.__global__=!1)}}const h=d=>{for(let c=0;ce._autoResetPageIndex()))}function Ko(){return e=>q(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,o=[],i=r.filter(u=>{var g;return(g=e.getColumn(u.id))==null?void 0:g.getCanSort()}),s={};i.forEach(u=>{const g=e.getColumn(u.id);g&&(s[u.id]={sortUndefined:g.columnDef.sortUndefined,invertSorting:g.columnDef.invertSorting,sortingFn:g.getSortingFn()})});const a=u=>{const g=u.map(_=>({..._}));return g.sort((_,h)=>{for(let c=0;c{var h;o.push(_),(h=_.subRows)!=null&&h.length&&(_.subRows=a(_.subRows))}),g};return{rows:a(n.rows),flatRows:o,rowsById:n.rowsById}},N(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function yt(...e){const t={};for(let n=0;n=0;s--){let a=e[s];typeof a=="function"&&(a=a());const u=(a||{})[i];if(u!==void 0)return u}}})}}return t}function Xo(e){const t=yt({state:{},onStateChange(){},renderFallbackValue:null,mergeOptions:(s,a)=>yt(s,a)},e),n=Bo(t);let r=ne($e(n.initialState)),o=ne(0);function i(){n.setOptions(s=>yt(s,e,{state:yt(l(r),e.state||{}),onStateChange:a=>{a instanceof Function?p(r,a(l(r)),!0):p(r,yt(l(r),a),!0),p(o,l(o)+1),e.onStateChange?.(a)}}))}return i(),rn(()=>{i()}),{getRowModel:()=>(l(o),n.getRowModel()),getHeaderGroups:()=>(l(o),n.getHeaderGroups()),getColumn:s=>(l(o),n.getColumn(s))}}function vt(e,t,n){let r=n.initialDeps??[],o,i=!0;function s(){var a,u,g;let _;n.key&&((a=n.debug)!=null&&a.call(n))&&(_=Date.now());const h=e();if(!(h.length!==r.length||h.some((v,m)=>r[m]!==v)))return o;r=h;let c;if(n.key&&((u=n.debug)!=null&&u.call(n))&&(c=Date.now()),o=t(...h),n.key&&((g=n.debug)!=null&&g.call(n))){const v=Math.round((Date.now()-_)*100)/100,m=Math.round((Date.now()-c)*100)/100,M=m/16,I=(b,G)=>{for(b=String(b);b.length{r=a},s}function Fn(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Yo=(e,t)=>Math.abs(e-t)<1.01,Jo=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}},Mn=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Zo=e=>e,Qo=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let o=t;o<=n;o++)r.push(o);return r},kn=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=s=>{const{width:a,height:u}=s;t({width:Math.round(a),height:Math.round(u)})};if(o(Mn(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(s=>{const a=()=>{const u=s[0];if(u?.borderBoxSize){const g=u.borderBoxSize[0];if(g){o({width:g.inlineSize,height:g.blockSize});return}}o(Mn(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},In={passive:!0},Pn=typeof window>"u"?!0:"onscrollend"in window,En=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const i=e.options.useScrollendEvent&&Pn?()=>{}:Jo(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),s=_=>()=>{const{horizontal:h,isRtl:d}=e.options;o=h?n.scrollLeft*(d&&-1||1):n.scrollTop,i(),t(o,_)},a=s(!0),u=s(!1);n.addEventListener("scroll",a,In);const g=e.options.useScrollendEvent&&Pn;return g&&n.addEventListener("scrollend",u,In),()=>{n.removeEventListener("scroll",a),g&&n.removeEventListener("scrollend",u)}},$o=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Vn=(e,{adjustments:t=0,behavior:n},r)=>{var o,i;const s=e+t;(i=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[r.options.horizontal?"left":"top"]:s,behavior:n})};class ei{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var n,r,o;return((o=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:o.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const s=()=>{const a=i.target,u=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(a,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var i;return(i=r())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=r())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,o])=>{typeof o>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Zo,rangeExtractor:Qo,onChange:()=>{},measureElement:$o,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=vt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,i=new Map;for(let s=r-1;s>=0;s--){const a=n[s];if(o.has(a.lane))continue;const u=i.get(a.lane);if(u==null||a.end>u.end?i.set(a.lane,a):a.ends.end===a.end?s.index-a.index:s.end-a.end)[0]:void 0},this.getMeasurementOptions=vt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,o,i,s,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:o,getItemKey:i,enabled:s,lanes:a}),{key:!1}),this.getMeasurements=vt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:o,getItemKey:i,enabled:s,lanes:a},u)=>{if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const d of this.laneAssignments.keys())d>=n&&this.laneAssignments.delete(d);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const g=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const _=this.measurementsCache.slice(0,g),h=new Array(a).fill(void 0);for(let d=0;d1){m=v;const X=h[m],P=X!==void 0?_[X]:void 0;M=P?P.end+this.options.gap:r+o}else{const X=this.options.lanes===1?_[d-1]:this.getFurthestMeasurement(_,d);M=X?X.end+this.options.gap:r+o,m=X?X.lane:d%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(d,m)}const I=u.get(c),b=typeof I=="number"?I:this.options.estimateSize(d),G=M+b;_[d]={index:d,start:M,size:b,end:G,key:c,lane:m},h[m]=d}return this.measurementsCache=_,_},{key:!1,debug:()=>this.options.debug}),this.calculateRange=vt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,i)=>this.range=n.length>0&&r>0?ti({measurements:n,outerSize:r,scrollOffset:o,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=vt(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,i,s)=>i===null||s===null?[]:n({startIndex:i,endIndex:s,overscan:r,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(o!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),s=Math.max(0,o-i),a=Math.min(this.options.count-1,o+i);return n>=s&&n<=a}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((s,a)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(a))});return}const r=this.indexFromElement(n),o=this.options.getItemKey(r),i=this.elementsCache.get(o);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(o,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var o;const i=this.measurementsCache[n];if(!i)return;const s=this.itemSizeCache.get(i.key)??i.size,a=r-s;a!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,a,this):i.start[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let i=0,s=n.length;ithis.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return Fn(r[Yn(0,r.length-1,o=>Fn(r[o]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,o=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),s=this.getScrollOffset();r==="auto"&&(r=n>=s+i?"end":"start"),r==="center"?n+=(o-i)/2:r==="end"&&(n-=i);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getSize(),i=this.getScrollOffset(),s=this.measurementsCache[n];if(!s)return;if(r==="auto")if(s.end>=i+o-this.options.scrollPaddingEnd)r="end";else if(s.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,s.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(n,r),s=this.now();this.scrollState={index:null,align:r,behavior:o,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:o="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,r);if(!i)return;const[s,a]=i,u=this.now();this.scrollState={index:n,align:a,behavior:o,startedAt:u,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const o=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((n=r[r.length-1])==null?void 0:n.end)??0;else{const i=Array(this.options.lanes).fill(null);let s=r.length-1;for(;s>=0&&i.some(a=>a===null);){const a=r[s];i[a.lane]===null&&(i[a.lane]=a.end),s--}o=Math.max(...i.filter(a=>a!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=r?r[0]:this.scrollState.lastTargetOffset,i=1,s=o!==this.scrollState.lastTargetOffset;if(!s&&Yo(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.scrollState=null;return}}else this.scrollState.stableFrames=0,s&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Yn=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,i=n(o);if(ir)t=o-1;else return o}return e>0?e-1:0};function ti({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const o=e.length-1,i=u=>e[u].start;if(e.length<=r)return{startIndex:0,endIndex:o};let s=Yn(0,o,i,n),a=s;if(r===1)for(;a1){const u=Array(r).fill(0);for(;a_=0&&g.some(_=>_>=n);){const _=e[s];g[_.lane]=_.start,s--}s=Math.max(0,s-s%r),a=Math.min(o,a+(r-1-a%r))}return{startIndex:s,endIndex:a}}function ni(e){let t=ne(0);const n=new ei({observeElementRect:kn,observeElementOffset:En,scrollToFn:Vn,...e,onChange:(o,i)=>{i?p(t,l(t)+1):queueMicrotask(()=>{p(t,l(t)+1)}),e.onChange?.(o,i)}});st(()=>{const o=n._didMount();return Gr(()=>{p(t,l(t)+1)}),o});let r=0;return st(()=>{const o=e.count;n.setOptions({observeElementRect:kn,observeElementOffset:En,scrollToFn:Vn,...e,onChange:(i,s)=>{s?p(t,l(t)+1):queueMicrotask(()=>{p(t,l(t)+1)}),e.onChange?.(i,s)}}),r===0&&o>0&&n.measure(),r=o}),rn(()=>{l(t),n._willUpdate()}),{instance:n,virtualItems:()=>(l(t),n.getVirtualItems()),totalSize:()=>(l(t),n.getTotalSize())}}var ri=Y('');function zn(e,t){Xe(t,!0);let n=C(t,"on_click",3,null),r=R(()=>t.position==="column"?t.coords[0]===0:t.coords[1]===0),o=R(()=>t.position==="column"?l(r)?"down":"up":l(r)?"right":"left");var i=ri();i.__click=g=>{g.stopPropagation(),n()&&n()()};var s=V(i),a=V(s),u=V(a);E(a),E(s),E(i),ae(()=>{De(i,1,`selection-button selection-button-${t.position??""} ${l(r)?`move-${l(o)}`:""}`,"svelte-fit6p6"),ge(i,"aria-label",`Select ${t.position}`),De(s,1,Lr(l(o)),"svelte-fit6p6"),ge(u,"data-name",l(o))}),k(e,i),Ye()}et(["click"]);var oi=Y('
        ');function ii(e,t){Xe(t,!0);let n=C(t,"value",15,!1),r=C(t,"editable",3,!0);function o(a){r()&&t.on_change(a)}var i=oi(),s=V(i);jn(s,{label:"",get interactive(){return r()},on_change:o,get value(){return n()},set value(a){n(a)}}),E(i),k(e,i),Ye()}var li=Y(''),si=Y(''),ai=Y(" ",1),ui=Y(" ",1);function Jn(e,t){Xe(t,!0);let n=C(t,"value",15,""),r=C(t,"display_value",3,null),o=C(t,"styling",3,""),i=C(t,"header",3,!1),s=C(t,"datatype",3,"str"),a=C(t,"line_breaks",3,!0),u=C(t,"editable",3,!0),g=C(t,"is_static",3,!1),_=C(t,"max_chars",3,null),h=C(t,"components",19,()=>({})),d=C(t,"is_dragging",3,!1),c=C(t,"wrap_text",3,!1),v=C(t,"expanded",3,!1),m=C(t,"show_selection_buttons",3,!1),M=C(t,"on_select_column",3,null),I=C(t,"on_select_row",3,null),b=C(t,"el",15,null),G=C(t,"pad_left",3,!1);function X(S,x=null,oe=!1){if(oe)return String(S);const $=String(S);return!x||x<=0||$.length<=x?$:$.slice(0,x)+"..."}let P=R(()=>!t.edit&&!v()&&_()!==null&&_()>0),A=R(()=>u()?n():r()!==null?r():n()),B=R(()=>l(P)?X(l(A),_(),s()==="image"):l(A));function ie(S){return requestAnimationFrame(()=>{S.focus()}),{}}function re(S){function x(){S.style.height="auto",S.style.height=`${S.scrollHeight}px`}return S.addEventListener("input",x),requestAnimationFrame(x),{destroy(){S.removeEventListener("input",x)}}}function U(S){t.onblur?.({blur_event:S,coords:t.coords})}function z(S){t.onkeydown?.(S)}function J(S){U({target:{value:n()}})}st(()=>{if(t.edit)return()=>{U({target:{value:n()}})}});var O=ui(),T=ce(O);{var te=S=>{var x=li();Tr(x),x.__mousedown=$=>$.stopPropagation(),x.__click=$=>$.stopPropagation(),x.__keydown=z;let oe;it(x,$=>b($),()=>b()),Br(()=>Xr(x,n)),Jt(x,$=>ie?.($)),Jt(x,$=>re?.($)),ae(()=>{x.readOnly=g(),ge(x,"aria-readonly",g()),ge(x,"aria-label",g()?"Cell is read-only":"Edit cell"),oe=De(x,1,"svelte-odwpey",null,oe,{header:i(),pad_left:G()})}),Et("blur",x,U),k(S,x)};H(T,S=>{t.edit&&s()!=="bool"&&S(te)})}var Q=D(T,2);{var fe=S=>{ii(S,{get editable(){return u()},on_change:J,get value(){return n()},set value(x){n(x)}})},Pe=S=>{var x=si();x.__keydown=z;let oe;var $=V(x);{var W=xe=>{const de=R(()=>h().image);var Me=Ce(),Re=ce(Me);{let he=R(()=>({url:l(B)}));Ur(Re,()=>l(de),(ke,Ae)=>{Ae(ke,{get value(){return l(he)},show_label:!1,label:"cell-image",show_download_button:!1,get i18n(){return t.i18n},gradio:{dispatch:()=>{}}})})}k(xe,Me)},K=xe=>{var de=Ce(),Me=ce(de);{var Re=ke=>{var Ae=Ce(),Te=ce(Ae);On(Te,()=>l(B)),k(ke,Ae)},he=ke=>{var Ae=Ce(),Te=ce(Ae);{var Oe=le=>{{let pe=R(()=>l(B).toLocaleString());Hn(le,{get message(){return l(pe)},get latex_delimiters(){return t.latex_delimiters},get line_breaks(){return a()},chatbot:!1})}},Je=le=>{var pe=Ln();ae(()=>_e(pe,l(B))),k(le,pe)};H(Te,le=>{s()==="markdown"?le(Oe):le(Je,!1)},!0)}k(ke,Ae)};H(Me,ke=>{s()==="html"?ke(Re):ke(he,!1)},!0)}k(xe,de)};H($,xe=>{s()==="image"&&h().image?xe(W):xe(K,!1)})}E(x),ae(()=>{ot(x,o()),ge(x,"data-editable",u()),ge(x,"data-max-chars",_()),ge(x,"data-expanded",t.edit),oe=De(x,1,"svelte-odwpey",null,oe,{dragging:d(),edit:t.edit,expanded:t.edit,header:i(),text:s()==="str",wrap:c()})}),Et("focus",x,xe=>xe.preventDefault()),k(S,x)};H(Q,S=>{s()==="bool"&&typeof n()=="boolean"?S(fe):S(Pe,!1)})}var be=D(Q,2);{var j=S=>{var x=ai(),oe=ce(x);zn(oe,{position:"column",get coords(){return t.coords},on_click:()=>M()(t.coords[1])});var $=D(oe,2);zn($,{position:"row",get coords(){return t.coords},on_click:()=>I()(t.coords[0])}),k(S,x)};H(be,S=>{m()&&t.coords&&M()&&I()&&S(j)})}k(e,O),Ye()}et(["mousedown","click","keydown"]);var ci=Y('');function Zn(e,t){Xe(t,!0);var n=ci();n.__click=function(...r){t.on_click?.apply(this,r)},n.__touchstart=r=>{r.preventDefault();const o=r.touches[0],i=new MouseEvent("click",{clientX:o.clientX,clientY:o.clientY,bubbles:!0,cancelable:!0,view:window});t.on_click(i)},k(e,n),Ye()}et(["click","touchstart"]);var di=Y('
        ');function gi(e,t){let n=C(t,"size",3,16);var r=di(),o=V(r);E(r),ae(()=>{ge(o,"width",n()),ge(o,"height",n())}),k(e,r)}var fi=Le('');function hi(e){var t=fi();k(e,t)}var _i=Le('');function vi(e,t){let n=C(t,"size",3,16);var r=_i();ae(()=>{ge(r,"width",n()),ge(r,"height",n())}),k(e,r)}var mi=Le('');function pi(e,t){let n=C(t,"size",3,16);var r=mi();ae(()=>{ge(r,"width",n()),ge(r,"height",n())}),k(e,r)}var wi=Y('
        '),Si=Y(''),Ci=Y(' '),xi=Y(' '),Ri=Y(' '),yi=Y('
        ');function bi(e,t){Xe(t,!0);let n=C(t,"is_editing",3,!1),r=C(t,"is_selected",3,!1),o=C(t,"is_static",3,!1),i=C(t,"is_bool",3,!1),s=C(t,"select_all_state",3,"unchecked"),a=C(t,"sort_direction",3,null),u=C(t,"sort_priority",3,null),g=C(t,"multi_sort",3,!1),_=C(t,"is_filtered",3,!1),h=C(t,"show_menu_button",3,!1),d=C(t,"is_first_column",3,!1),c=C(t,"line_breaks",3,!0),v=C(t,"editable",3,!0),m=C(t,"max_chars",3,void 0),M=C(t,"wrap_text",3,!1),I=R(()=>i()&&v()&&!o()&&!!t.on_select_all);var b=yi();let G;b.__click=O=>t.onclick(O,t.col_idx),b.__mousedown=O=>{O.preventDefault(),O.stopPropagation()};var X=V(b),P=V(X),A=V(P);{var B=O=>{var T=wi();T.__click=Q=>Q.stopPropagation(),T.__mousedown=Q=>Q.stopPropagation(),T.__keydown=Q=>Q.stopPropagation();var te=V(T);{let Q=R(()=>s()==="checked"),fe=R(()=>s()==="indeterminate"),Pe=R(()=>`Toggle all: ${t.value}`);jn(te,{get value(){return l(Q)},get indeterminate(){return l(fe)},get label(){return l(Pe)},interactive:!0,on_select:()=>t.on_select_all?.(t.col_idx,s()!=="checked")})}E(T),k(O,T)};H(A,O=>{l(I)&&O(B)})}var ie=D(A,2);{let O=R(()=>[t.col_idx,0]),T=R(()=>!!l(I));Jn(ie,{get value(){return t.value},get latex_delimiters(){return t.latex_delimiters},get line_breaks(){return c()},get edit(){return n()},onkeydown:te=>{["Enter","Escape","Tab"].includes(te.key)&&t.on_end_edit(te.key)},header:!0,get editable(){return v()},get is_static(){return o()},get i18n(){return t.i18n},get max_chars(){return m()},get wrap_text(){return M()},get coords(){return l(O)},get pad_left(){return l(T)}})}E(P);var re=D(P,2);{var U=O=>{var T=Ri(),te=V(T);{var Q=S=>{var x=Si(),oe=V(x);hi(oe),E(x),k(S,x)};H(te,S=>{_()&&S(Q)})}var fe=D(te,2);{var Pe=S=>{var x=xi(),oe=V(x);{var $=de=>{vi(de,{size:13})},W=de=>{pi(de,{size:13})};H(oe,de=>{a()==="asc"?de($):de(W,!1)})}var K=D(oe,2);{var xe=de=>{var Me=Ci(),Re=V(Me,!0);E(Me),ae(()=>_e(Re,u())),k(de,Me)};H(K,de=>{g()&&u()!=null&&de(xe)})}E(x),ae(()=>ge(x,"aria-label",`Sorted ${a()??""}ending`)),k(S,x)};H(fe,S=>{a()&&S(Pe)})}var be=D(fe,2);{var j=S=>{gi(S,{size:11})};H(be,S=>{o()&&S(j)})}E(T),k(O,T)};H(re,O=>{(a()||_()||o())&&O(U)})}var z=D(re,2);{var J=O=>{Zn(O,{on_click:T=>t.on_menu_click(T,t.col_idx)})};H(z,O=>{h()&&O(J)})}E(X),E(b),ae(()=>{G=De(b,1,"header-cell svelte-1d6xqpb",null,G,{focus:n()||r(),sorted:a()!==null,filtered:_(),"first-column":d()}),ge(b,"data-heading",t.col_idx),ge(b,"title",t.value)}),k(e,b),Ye()}et(["click","mousedown","keydown"]);var Fi=Y('
        ');function Mi(e,t){Xe(t,!0);let n=C(t,"display_value",3,null),r=C(t,"datatype",3,"str"),o=C(t,"col_style",3,""),i=C(t,"cell_style",3,""),s=C(t,"selection_classes",3,""),a=C(t,"is_editing",3,!1),u=C(t,"is_flash",3,!1),g=C(t,"is_static",3,!1),_=C(t,"show_menu_button",3,!1),h=C(t,"show_selection_buttons",3,!1),d=C(t,"is_first_column",3,!1),c=C(t,"is_solo",3,!1),v=C(t,"line_breaks",3,!0),m=C(t,"editable",3,!0),M=C(t,"max_chars",3,void 0),I=C(t,"components",19,()=>({})),b=C(t,"is_dragging",3,!1),G=C(t,"wrap_text",3,!1),X=ne(void 0),P=ne("");rn(()=>{c()&&l(X)?p(P,`height: ${l(X).offsetHeight}px;`):p(P,"")});var A=Fi();let B;A.__mousedown=function(...J){t.onmousedown?.apply(this,J)},A.__dblclick=function(...J){t.ondblclick?.apply(this,J)},A.__contextmenu=function(...J){t.oncontextmenu?.apply(this,J)};var ie=V(A),re=V(ie);{let J=R(()=>[t.row_idx,t.col_idx]);Jn(re,{get value(){return t.value},get display_value(){return n()},get latex_delimiters(){return t.latex_delimiters},get line_breaks(){return v()},get editable(){return m()},get is_static(){return g()},get edit(){return a()},get datatype(){return r()},get onblur(){return t.onblur},get max_chars(){return M()},get i18n(){return t.i18n},get components(){return I()},get show_selection_buttons(){return h()},get coords(){return l(J)},get on_select_column(){return t.on_select_column},get on_select_row(){return t.on_select_row},get is_dragging(){return b()},get wrap_text(){return G()},get expanded(){return c()}})}var U=D(re,2);{var z=J=>{Zn(J,{get on_click(){return t.on_menu_click}})};H(U,J=>{_()&&J(z)})}E(ie),it(ie,J=>p(X,J),()=>l(X)),E(A),ae(()=>{B=De(A,1,`body-cell ${s()??""}`,"svelte-183k2ki",B,{flash:u(),"first-column":d(),static:g(),"cell-solo":c()}),ge(A,"data-row",t.row_idx),ge(A,"data-col",t.col_idx),ge(A,"data-testid",`cell-${t.row_idx}-${t.col_idx}`),ge(A,"tabindex",g()?-1:void 0),ot(A,`${o()??""} ${i()??""}`),ot(ie,l(P))}),k(e,A),Ye()}et(["mousedown","dblclick","contextmenu"]);var ki=Y('');function Ii(e,t){var n=ki();n.__click=function(...r){t.on_click?.apply(this,r)},k(e,n)}et(["click"]);function Pi(e,t){if(e==null)return e;if(t==="number"){const n=Number(e);return isNaN(n)?e:n}if(t==="bool"){if(typeof e=="boolean")return e;if(typeof e=="number")return e!==0;const n=String(e).toLowerCase();return n==="true"||n==="1"?!0:n==="false"||n==="0"?!1:e}if(t==="date"){const n=new Date(e);return isNaN(n.getTime())?e:n.toISOString()}return e}var Ei=Le(''),Vi=Le(''),zi=Le(''),Ai=Le(''),Di=Le(''),Li=Le(''),Oi=Le(''),Hi=Le(''),ji=Le(''),Gi=Le(''),Bi=Le('');function Ue(e,t){var n=Ce(),r=ce(n);{var o=s=>{var a=Ei();k(s,a)},i=s=>{var a=Ce(),u=ce(a);{var g=h=>{var d=Vi();k(h,d)},_=h=>{var d=Ce(),c=ce(d);{var v=M=>{var I=zi();k(M,I)},m=M=>{var I=Ce(),b=ce(I);{var G=P=>{var A=Ai();k(P,A)},X=P=>{var A=Ce(),B=ce(A);{var ie=U=>{var z=Di();k(U,z)},re=U=>{var z=Ce(),J=ce(z);{var O=te=>{var Q=Li();k(te,Q)},T=te=>{var Q=Ce(),fe=ce(Q);{var Pe=j=>{var S=Oi();k(j,S)},be=j=>{var S=Ce(),x=ce(S);{var oe=W=>{var K=Hi();k(W,K)},$=W=>{var K=Ce(),xe=ce(K);{var de=Re=>{var he=ji();k(Re,he)},Me=Re=>{var he=Ce(),ke=ce(he);{var Ae=Oe=>{var Je=Gi();k(Oe,Je)},Te=Oe=>{var Je=Ce(),le=ce(Je);{var pe=qe=>{var He=Bi();k(qe,He)};H(le,qe=>{t.icon=="clear-filter"&&qe(pe)},!0)}k(Oe,Je)};H(ke,Oe=>{t.icon=="filter"?Oe(Ae):Oe(Te,!1)},!0)}k(Re,he)};H(xe,Re=>{t.icon=="clear-sort"?Re(de):Re(Me,!1)},!0)}k(W,K)};H(x,W=>{t.icon=="sort-desc"?W(oe):W($,!1)},!0)}k(j,S)};H(fe,j=>{t.icon=="sort-asc"?j(Pe):j(be,!1)},!0)}k(te,Q)};H(J,te=>{t.icon=="delete-column"?te(O):te(T,!1)},!0)}k(U,z)};H(B,U=>{t.icon=="delete-row"?U(ie):U(re,!1)},!0)}k(P,A)};H(b,P=>{t.icon=="add-row-below"?P(G):P(X,!1)},!0)}k(M,I)};H(c,M=>{t.icon=="add-row-above"?M(v):M(m,!1)},!0)}k(h,d)};H(u,h=>{t.icon=="add-column-left"?h(g):h(_,!1)},!0)}k(s,a)};H(r,s=>{t.icon=="add-column-right"?s(o):s(i,!1)})}k(e,n)}var Ti=Y(''),qi=Y(''),Ni=Y('
        Filter as
        ');function Wi(e,t){Xe(t,!0);let n=C(t,"on_filter",3,()=>{}),r,o=ne("string"),i=ne("Contains"),s=ne(!1),a=ne("");const u={string:["Contains","Does not contain","Starts with","Ends with","Is","Is not","Is empty","Is not empty"],number:["=","≠",">","<","≥","≤","Is empty","Is not empty"]};on(()=>{g()});function g(){if(!r)return;const U=window.innerWidth,z=window.innerHeight,J=r.getBoundingClientRect(),O=(U-J.width)/2,T=(z-J.height)/2;r.style.left=`${O}px`,r.style.top=`${T}px`}function _(U){const z=U.target;p(a,z.value,!0)}var h=Ni(),d=D(V(h),2),c=V(d),v=D(V(c),2);v.__click=U=>{U.stopPropagation(),p(o,l(o)==="string"?"number":"string",!0),p(i,u[l(o)][0],!0)};var m=V(v,!0);E(v),E(c);var M=D(c,2),I=V(M),b=V(I);b.__click=U=>{U.stopPropagation(),p(s,!l(s))};var G=V(b),X=D(G);Yr(X),E(b);var P=D(b,2);{var A=U=>{var z=qi();mt(z,21,()=>u[l(o)],Or,(J,O)=>{var T=Ti();T.__click=Q=>{Q.stopPropagation(),p(i,l(O),!0),p(s,!l(s))};var te=V(T,!0);E(T),ae(()=>_e(te,l(O))),k(J,T)}),E(z),k(U,z)};H(P,U=>{l(s)&&U(A)})}E(I);var B=D(I,2);An(B),B.__click=U=>U.stopPropagation(),B.__input=_,E(M);var ie=D(M,2);ie.__click=()=>n()(l(o),l(i),l(a));var re=V(ie);Zt(re),E(ie),E(d),it(d,U=>r=U,()=>r),E(h),ae(()=>{ge(v,"aria-label",`Change filter type. Filtering ${l(o)}s`),_e(m,l(o)),ge(b,"aria-label",`Change filter. Using '${l(i)}'`),_e(G,`${l(i)??""} `),Dn(B,l(a))}),k(e,h),Ye()}et(["click","input"]);var Ui=Y(' '),Ki=Y(' '),Xi=Y('1'),Yi=Y(' ',1),Ji=Y(''),Zi=Y(' ',1),Qi=Y(''),$i=Y(' ',1),el=Y(' ',1);function tl(e,t){Xe(t,!0);let n=C(t,"on_sort",3,()=>{}),r=C(t,"on_clear_sort",3,()=>{}),o=C(t,"sort_direction",3,null),i=C(t,"sort_priority",3,null),s=C(t,"on_filter",3,()=>{}),a=C(t,"on_clear_filter",3,()=>{}),u=C(t,"filter_active",3,null),g=C(t,"editable",3,!0),_,h=ne(null),d=R(()=>t.row===-1),c=R(()=>g()&&t.row_count[1]==="dynamic"),v=R(()=>g()&&t.col_count[1]==="dynamic");on(()=>{m()});function m(){if(!_)return;const z=window.innerWidth,J=window.innerHeight,O=_.getBoundingClientRect();let T=t.x-30,te=t.y-20;T+O.width>z&&(T=t.x-O.width+10),te+O.height>J&&(te=t.y-O.height+10),_.style.left=`${T}px`,_.style.top=`${te}px`}function M(){if(u()){s()("string","","");return}const z=_.getBoundingClientRect();p(h,{x:z.right,y:z.top+z.height/2},!0)}var I=el(),b=ce(I),G=V(b);{var X=z=>{var J=Yi(),O=ce(J);O.__click=()=>n()("asc");let T;var te=V(O);Ue(te,{icon:"sort-asc"});var Q=D(te),fe=D(Q);{var Pe=le=>{var pe=Ui(),qe=V(pe,!0);E(pe),ae(()=>_e(qe,i())),k(le,pe)};H(fe,le=>{o()==="asc"&&i()!==null&&le(Pe)})}E(O);var be=D(O,2);be.__click=()=>n()("desc");let j;var S=V(be);Ue(S,{icon:"sort-desc"});var x=D(S),oe=D(x);{var $=le=>{var pe=Ki(),qe=V(pe,!0);E(pe),ae(()=>_e(qe,i())),k(le,pe)};H(oe,le=>{o()==="desc"&&i()!==null&&le($)})}E(be);var W=D(be,2);W.__click=function(...le){r()?.apply(this,le)};var K=V(W);Ue(K,{icon:"clear-sort"});var xe=D(K);E(W);var de=D(W,2);de.__click=le=>{le.stopPropagation(),M()};let Me;var Re=V(de);Ue(Re,{icon:"filter"});var he=D(Re),ke=D(he);{var Ae=le=>{var pe=Xi();k(le,pe)};H(ke,le=>{u()&&le(Ae)})}E(de);var Te=D(de,2);Te.__click=function(...le){a()?.apply(this,le)};var Oe=V(Te);Ue(Oe,{icon:"clear-filter"});var Je=D(Oe);E(Te),ae((le,pe,qe,He,zt)=>{T=De(O,1,"svelte-1v4jjjx",null,T,{active:o()==="asc"}),_e(Q,` ${le??""} `),j=De(be,1,"svelte-1v4jjjx",null,j,{active:o()==="desc"}),_e(x,` ${pe??""} `),_e(xe,` ${qe??""}`),Me=De(de,1,"svelte-1v4jjjx",null,Me,{active:u()||l(h)}),_e(he,` ${He??""} `),_e(Je,` ${zt??""}`)},[()=>t.i18n("dataframe.sort_ascending"),()=>t.i18n("dataframe.sort_descending"),()=>t.i18n("dataframe.clear_sort"),()=>t.i18n("dataframe.filter"),()=>t.i18n("dataframe.clear_filter")]),k(z,J)};H(G,z=>{l(d)&&z(X)})}var P=D(G,2);{var A=z=>{var J=Zi(),O=ce(J);O.__click=()=>t.on_add_row_above();var T=V(O);Ue(T,{icon:"add-row-above"});var te=D(T);E(O);var Q=D(O,2);Q.__click=()=>t.on_add_row_below();var fe=V(Q);Ue(fe,{icon:"add-row-below"});var Pe=D(fe);E(Q);var be=D(Q,2);{var j=S=>{var x=Ji();x.__click=function(...W){t.on_delete_row?.apply(this,W)};var oe=V(x);Ue(oe,{icon:"delete-row"});var $=D(oe);E(x),ae(W=>_e($,` ${W??""}`),[()=>t.i18n("dataframe.delete_row")]),k(S,x)};H(be,S=>{t.can_delete_rows&&S(j)})}ae((S,x)=>{_e(te,` ${S??""}`),_e(Pe,` ${x??""}`)},[()=>t.i18n("dataframe.add_row_above"),()=>t.i18n("dataframe.add_row_below")]),k(z,J)};H(P,z=>{!l(d)&&l(c)&&z(A)})}var B=D(P,2);{var ie=z=>{var J=$i(),O=ce(J);O.__click=()=>t.on_add_column_left();var T=V(O);Ue(T,{icon:"add-column-left"});var te=D(T);E(O);var Q=D(O,2);Q.__click=()=>t.on_add_column_right();var fe=V(Q);Ue(fe,{icon:"add-column-right"});var Pe=D(fe);E(Q);var be=D(Q,2);{var j=S=>{var x=Qi();x.__click=function(...W){t.on_delete_col?.apply(this,W)};var oe=V(x);Ue(oe,{icon:"delete-column"});var $=D(oe);E(x),ae(W=>_e($,` ${W??""}`),[()=>t.i18n("dataframe.delete_column")]),k(S,x)};H(be,S=>{t.can_delete_cols&&S(j)})}ae((S,x)=>{_e(te,` ${S??""}`),_e(Pe,` ${x??""}`)},[()=>t.i18n("dataframe.add_column_left"),()=>t.i18n("dataframe.add_column_right")]),k(z,J)};H(B,z=>{l(v)&&z(ie)})}E(b),it(b,z=>_=z,()=>_);var re=D(b,2);{var U=z=>{Wi(z,{get on_filter(){return s()}})};H(re,z=>{l(h)&&z(U)})}k(e,I),Ye()}et(["click"]);var nl=Y(''),rl=Y('
        '),ol=Y('');function il(e,t){Xe(t,!0);let n=C(t,"show_fullscreen_button",3,!1),r=C(t,"show_copy_button",3,!1),o=C(t,"show_search",3,"none"),i=C(t,"fullscreen",3,!1),s=C(t,"current_search_query",7,null),a=ne(!1),u,g=ne("");function _(P){const A=P.target;p(g,A.value,!0);const B=l(g)||null;s()!==B&&(s(B),t.onsearch?.(s()))}function h(){p(a,!0),u&&clearTimeout(u),u=setTimeout(()=>{p(a,!1)},2e3)}async function d(){await t.on_copy(),h()}st(()=>()=>{u&&clearTimeout(u)});var c=ol(),v=V(c),m=V(v);{var M=P=>{var A=rl(),B=V(A);An(B),B.__input=_;let ie;var re=D(B,2);{var U=z=>{var J=nl();J.__click=function(...T){t.on_commit_filter?.apply(this,T)};var O=V(J);Zt(O),E(J),k(z,J)};H(re,z=>{s()&&o()==="filter"&&z(U)})}E(A),ae(()=>{Dn(B,s()||""),ge(B,"placeholder",o()==="filter"?"Filter...":"Search..."),ie=De(B,1,"search-input svelte-1rajnm3",null,ie,{"filter-mode":o()==="filter"}),ge(B,"title",`Enter text to ${o()} the table`)}),k(P,A)};H(m,P=>{o()!=="none"&&P(M)})}var I=D(m,2);{var b=P=>{{let A=R(()=>l(a)?Zt:Jr),B=R(()=>l(a)?"Copied to clipboard":"Copy table data");Kr(P,{get Icon(){return l(A)},get label(){return l(B)},onclick:d})}};H(I,P=>{r()&&P(b)})}var G=D(I,2);{var X=P=>{Zr(P,{get fullscreen(){return i()},onclick:A=>t.onfullscreen?.()})};H(G,P=>{n()&&P(X)})}E(v),E(c),k(e,c),Ye()}et(["input","click"]);function ll(e,t){const[n,r]=e;return t.some(([o,i])=>o===n&&i===r)}function sl(e,t){const[n,r]=e;if(!t.some(([u,g])=>u===n&&g===r))return"";const o=t.some(([u,g])=>u===n-1&&g===r),i=t.some(([u,g])=>u===n+1&&g===r),s=t.some(([u,g])=>u===n&&g===r-1),a=t.some(([u,g])=>u===n&&g===r+1);return`cell-selected${o?" no-top":""}${i?" no-bottom":""}${s?" no-left":""}${a?" no-right":""}`}function al(e,t){const[n]=e.composedPath();return!t.contains(n)}async function ul(e,t){if(!e||!e.length)return;const r=(t||e.flatMap((a,u)=>a.map((g,_)=>[u,_]))).reduce((a,[u,g])=>{a[u]=a[u]||{};const _=String(e[u][g].value);return a[u][g]=_.includes(",")||_.includes('"')||_.includes(` +`)?`"${_.replace(/"/g,'""')}"`:_,a},{}),o=Object.keys(r).sort((a,u)=>+a-+u);if(!o.length)return;const i=Object.keys(r[o[0]]).sort((a,u)=>+a-+u),s=o.map(a=>i.map(u=>r[a][u]||"").join(",")).join(` +`);try{await navigator.clipboard.writeText(s)}catch(a){throw new Error("Failed to copy to clipboard: "+a.message)}}function cl(e,t){return t.filter(n);function n(r){var o=-1;return e.split(` +`).every(i);function i(s){if(!s)return!0;var a=s.split(r).length;return o<0&&(o=a),o===a&&a>1}}}function dl(e){const t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(t.length),o=new Uint8Array(r);for(let i=0;i{if(!i?.target?.result||typeof i.target.result!="string")return;const[s]=cl(i.target.result,[","," "]),[a,...u]=Qr(s).parseRows(i.target.result);t(a),n(u)}),o.readAsText(r)}function fl(e,t,n){const{dtype:r,filter:o,value:i}=n,s=String(e.getValue(t)??""),a=i??"";if(r==="number"){const _=parseFloat(s),h=parseFloat(a);if(isNaN(_)||isNaN(h))return o==="Is empty"?s.trim()==="":o==="Is not empty"?s.trim()!=="":!0;switch(o){case"=":return _===h;case"≠":return _!==h;case">":return _>h;case"<":return _=h;case"≤":return _<=h;case"Is empty":return s.trim()==="";case"Is not empty":return s.trim()!=="";default:return!0}}const u=s.toLowerCase(),g=a.toLowerCase();switch(o){case"Contains":return u.includes(g);case"Does not contain":return!u.includes(g);case"Starts with":return u.startsWith(g);case"Ends with":return u.endsWith(g);case"Is":return u===g;case"Is not":return u!==g;case"Is empty":return s.trim()==="";case"Is not empty":return s.trim()!=="";default:return!0}}function hl(e){let t=ne($e([])),n=ne(0),r=ne(0),o=ne($e([]));function i(h,d){if(!h||h==="auto")return null;if(h.endsWith("%")){const v=parseFloat(h);return!isFinite(v)||d<=0?null:v/100*d}if(h.endsWith("px")){const v=parseFloat(h);return isFinite(v)?v:null}const c=parseFloat(h);return isFinite(c)?c:null}function s(h){h.style.width&&(h.style.width=""),h.style.minWidth&&(h.style.minWidth=""),h.style.maxWidth&&(h.style.maxWidth="")}function a(h,d){h.style.width!==d&&(h.style.width=d),h.style.minWidth!==d&&(h.style.minWidth=d),h.style.maxWidth!==d&&(h.style.maxWidth=d)}function u(){const h=e.header_row_el(),d=e.header_table_el();if(!h||!d)return;const c=Array.from(h.querySelectorAll(".header-cell")),v=Array.from(d.querySelectorAll(".sizing-body > tr > td")),m=e.show_row_numbers()?v.slice(1):v;c.forEach(s),m.forEach(s),d.style.width="auto",d.getBoundingClientRect();const M=e.viewport_width(),I=e.column_widths(),b=c.map((P,A)=>{const B=i(I[A],M);if(B!=null)return B;const ie=P.getBoundingClientRect().width;return M>0?Math.min(ie,M):ie});c.forEach((P,A)=>a(P,`${b[A]}px`)),m.forEach((P,A)=>{b[A]!=null&&a(P,`${b[A]}px`)});let G=b.reduce((P,A)=>P+A,0);if(e.show_row_numbers()){const P=h.querySelector(".row-number-header");P&&(G+=P.getBoundingClientRect().width)}d.style.width=`${G}px`;const X=d.getBoundingClientRect();p(o,c.map(P=>P.getBoundingClientRect().left-X.left),!0),p(t,b,!0),p(n,X.width,!0),p(r,X.height,!0),e.on_resize?.()}st(()=>{const h=e.header_table_el(),d=e.header_row_el();if(!h||!d)return;e.resolved_headers();const c=new ResizeObserver(u);return c.observe(h),d.querySelectorAll(".header-cell").forEach(m=>c.observe(m)),()=>c.disconnect()}),st(()=>{e.viewport_width(),e.column_widths(),u()});let g=R(()=>{if(!e.show_row_numbers())return 0;const h=e.header_row_el();return h?h.querySelector(".row-number-header")?.getBoundingClientRect().width??48:0});function _(h){if(l(t)[h]!==void 0)return`width: ${l(t)[h]}px; flex: 0 0 ${l(t)[h]}px;`;const d=i(e.column_widths()[h],e.viewport_width());return d!=null?`width: ${d}px; flex: 0 0 ${d}px;`:"width: 150px; flex: 0 0 150px;"}return{get col_widths(){return l(t)},get col_lefts(){return l(o)},get total_header_width(){return l(n)},get header_height(){return l(r)},get row_num_width(){return l(g)},get_col_style:_}}var _l=Y('

        '),vl=Y('
        '),ml=Y(' '),pl=Y(' '),wl=Y(' '),Sl=Y('
        '),Cl=Y(''),xl=Y('
        '),Rl=Y("
        "),yl=Y('
        '),bl=Y(''),Fl=Y('
        ',1);function Ml(e,t){Xe(t,!0);let n=C(t,"label",3,null),r=C(t,"show_label",3,!0),o=C(t,"headers",31,()=>$e([])),i=C(t,"values",31,()=>$e([])),s=C(t,"components",19,()=>({})),a=C(t,"editable",3,!0),u=C(t,"wrap",3,!1),g=C(t,"max_height",3,500),_=C(t,"line_breaks",3,!0),h=C(t,"column_widths",19,()=>[]),d=C(t,"show_row_numbers",3,!1),c=C(t,"buttons",3,null),v=C(t,"value_is_output",15,!1),m=C(t,"max_chars",3,void 0),M=C(t,"show_search",3,"none"),I=C(t,"pinned_columns",3,0),b=C(t,"static_columns",19,()=>[]),G=C(t,"fullscreen",3,!1),X=C(t,"display_value",3,null),P=C(t,"styling",3,null),A=R(()=>(i()??[]).map((f,w)=>{const F={_index:w};return(f??[]).forEach((y,L)=>{const Z=Array.isArray(t.datatype)?t.datatype[L]:t.datatype;F[`col_${L}`]=Pi(y,Z)}),F})),B=R(()=>{let f=o()??[];return t.col_count[1]==="fixed"&&f.length`${F+f.length}`)]),f.length||(f=Array(t.col_count[0]).fill(null).map((w,F)=>`${F}`)),f.map(w=>w??"")}),ie=R(()=>l(B).map((f,w)=>({id:`col_${w}`,accessorKey:`col_${w}`,header:f,size:150,minSize:45,filterFn:fl,meta:{colIndex:w,datatype:Array.isArray(t.datatype)?t.datatype[w]:t.datatype,isStatic:b().includes(w)||b().includes(f),isPinned:w({left:l(ie).filter((f,w)=>wf.id)}));const O=Xo({get data(){return l(A)},get columns(){return l(ie)},state:{get sorting(){return l(re)},get columnFilters(){return l(U)},get globalFilter(){return l(z)},get columnPinning(){return l(J)}},onSortingChange:f=>{p(re,typeof f=="function"?f(l(re)):f,!0)},onColumnFiltersChange:f=>{p(U,typeof f=="function"?f(l(U)):f,!0)},onGlobalFilterChange:f=>{p(z,typeof f=="function"?f(l(z)):f,!0)},getCoreRowModel:To(),getSortedRowModel:Ko(),getFilteredRowModel:Uo(),globalFilterFn:"includesString",enableSorting:!0,enableMultiSort:!0,maxMultiSortColCount:3});let T=R(()=>O.getRowModel().rows),te=R(()=>O.getHeaderGroups()),Q;const fe=ni({get count(){return l(T).length},getScrollElement:()=>Q,estimateSize:()=>35,overscan:10,measureElement:(f,w,F)=>{const y=f.getBoundingClientRect().height;if(y>0)return y;const L=f.getAttribute("data-index");if(L!=null){const Z=F.itemSizeCache?.get(Number(L));if(typeof Z=="number")return Z}return 35}});let Pe=R(()=>fe.virtualItems()),be=R(()=>fe.totalSize()),j=ne($e([])),S=ne(!1),x=ne(!1),oe=ne(!1),$=ne(!1),W=ne(null),K=ne(null),xe=ne(!1),de=!1,Me=ne(!1),Re=ne(!1),he;function ke(f){return Array.isArray(t.datatype)?t.datatype[f]??"str":t.datatype}const Ae=[2.2,1.7,1.4,1.2,1.1,1.05];function Te(f){const w=f.match(/^\s*(#{1,6})\s+(.+)/);if(w){const F=w[1].length;return w[2].replace(/[*_`[\]()]/g,"").length*Ae[F-1]}return f.replace(/[*_`#[\]()]/g,"").length}function Oe(f){const w=f.replace(/<[^>]+>/g,"").length,F=f.match(/0&&w!=="image"&&f.length>m()?f.slice(0,m())+"...":f}function le(){return(l(te)[0]?.headers??[]).map(w=>{const F=w.column.columnDef.meta?.colIndex??0,y=ke(F),L=`col_${F}`;if(y==="bool")return{val:"false",col_idx:F,dtype:y};const Z=y==="markdown"?Te:y==="html"?Oe:we=>we.length;let ee="",se=-1;for(const we of l(T)){const Ne=we.original._index,We=a()?we.original[L]:X()?.[Ne]?.[F]??i()?.[Ne]?.[F];if(We==null)continue;const Ze=Je(String(We),y),ft=Z(Ze);ft>se&&(se=ft,ee=Ze)}return{val:ee,col_idx:F,dtype:y}})}function pe(f,w){return X()?.[f]?.[w]!==void 0?X()[f][w]:String(i()?.[f]?.[w]??"")}function qe(f,w){return P()?.[f]?.[w]??""}function He(f,w){t.onchange?.({data:f??i(),headers:w??l(B),metadata:null}),v()||t.oninput?.(),v(!1)}function zt(f,w,F){const y=!a()||b().includes(F)||b().includes(l(B)[F]);y||f.preventDefault(),f.stopPropagation();const L=[w,F];if(f.shiftKey&&l(S)){const[Z,ee]=l(S),[se,we]=L,Ne=[];for(let We=Math.min(Z,se);We<=Math.max(Z,se);We++)for(let Ze=Math.min(ee,we);Ze<=Math.max(ee,we);Ze++)Ne.push([We,Ze]);p(j,Ne,!0)}else if(f.metaKey||f.ctrlKey){const Z=l(j).some(([ee,se])=>ee===w&&se===F);p(j,Z?l(j).filter(([ee,se])=>!(ee===w&&se===F)):[...l(j),L],!0)}else p(j,[L],!0);p(S,L,!0),p(oe,!1),p($,!1),p(W,null),p(K,null),p(x,!1),t.onselect?.({index:L,value:i()?.[w]?.[F],row_value:i()?.[w]??[],col_value:i()?.map(Z=>Z[F])??[]}),y||xt().then(()=>he?.focus())}function Qn(f,w,F){!a()||b().includes(F)||b().includes(l(B)[F])||(f.preventDefault(),f.stopPropagation(),p(x,[w,F],!0))}function $n(f){const{coords:w}=f,F=f.blur_event.target;if(!F||F.value===void 0)return;const[y,L]=w,Z=i()?.[y]?.[L],ee=F.value;if(String(Z)!==String(ee)){const se=i().map(we=>[...we]);se[y][L]=ee,i(se),t.onedit?.({index:[y,L],value:ee,previous_value:String(Z??"")}),He(se)}}function er(f,w){f.target instanceof HTMLAnchorElement||(f.preventDefault(),f.stopPropagation(),a()&&(p(x,!1),p(S,!1),p(j,[],!0),p(W,null),p(K,null),p($,w,!0),p(oe,a()?w:!1,!0),he?.focus()))}function tr(f){["Escape","Enter","Tab"].includes(f)&&(p(oe,!1),he?.focus())}function nr(f,w){if(f.stopPropagation(),l(K)?.col===w)p(K,null);else{const F=f.target.closest("th");if(F){const y=F.getBoundingClientRect();p(K,{col:w,x:y.right,y:y.bottom},!0)}}}function rr(f,w){const F=`col_${f}`,y=w==="desc",L=l(re).findIndex(Z=>Z.id===F);L>=0&&l(re)[L].desc===y?p(re,l(re).filter(Z=>Z.id!==F),!0):p(re,[...l(re).filter(Z=>Z.id!==F),{id:F,desc:y}].slice(-3),!0)}function or(){p(re,[],!0)}function ir(f,w,F,y){const L=`col_${f}`;l(U).findIndex(ee=>ee.id===L)>=0?p(U,l(U).filter(ee=>ee.id!==L),!0):p(U,[...l(U),{id:L,value:{dtype:w,filter:F,value:y}}],!0)}function lr(){p(U,[],!0)}function sr(f){p(z,f??"",!0),t.onsearch?.(f)}function cn(f){if(t.row_count[1]!=="dynamic")return;const w=i()[0]?.length||l(B).length||1,F=Array(w).fill(""),y=[...i()];f!==void 0?y.splice(f,0,F):y.push(F),i(y),He(y),p(S,[f??y.length-1,0],!0),he?.focus()}function ar(f){if(t.col_count[1]!=="dynamic")return;const w=[...o()??[],`Header ${(o()?.length??0)+1}`],F=i().map(y=>[...y,""]);f!==void 0&&(w.splice(f,0,w.pop()),F.forEach(y=>y.splice(f,0,y.pop()))),i(F),o(w),He(F,w),he?.focus()}function ur(f){i().length<=1||(i([...i().slice(0,f),...i().slice(f+1)]),He(i()),p(W,null),p(K,null))}function cr(f){t.col_count[1]==="dynamic"&&((i()[0]?.length??0)<=1||(i(i().map(w=>[...w.slice(0,f),...w.slice(f+1)])),o([...(o()??[]).slice(0,f),...(o()??[]).slice(f+1)]),He(i(),o()),p(W,null),p(K,null),p(S,!1),p(j,[],!0),p(x,!1)))}function dn(f,w){cn(w==="above"?f:f+1),p(W,null)}function gn(f,w){ar(w==="left"?f:f+1),p(W,null)}function dr(f,w){const F=i().map(y=>{const L=[...y];return L[f]=w,L});i(F),He(F)}function gr(f){if(!i().length)return"unchecked";let w=0;for(const F of i()){const y=F[f];(y===!0||y==="true"||y==="True")&&w++}return w===0?"unchecked":w===i().length?"checked":"indeterminate"}function fr(){if(!l(z)||M()!=="filter")return;const f=l(T).map(w=>{const F=w.original._index;return i()[F]});i(f),p(z,""),He(f)}async function fn(){const f=i().map(F=>F.map((y,L)=>({id:`${L}`,value:y}))),w=l(j).length>0?l(j):null;await ul(f,w),p(xe,!0),setTimeout(()=>p(xe,!1),800)}function hn(f){al(f,he)&&(p(j,[],!0),p(S,!1),p(x,!1),p(oe,!1),p($,!1),p(W,null),p(K,null))}function hr(f){if(!l(S)&&l($)===!1)return;const w=l(T).length,F=l(B).length;if(l(S)){const[y,L]=l(S);if(l(x)&&(f.key==="ArrowUp"||f.key==="ArrowDown"||f.key==="ArrowLeft"||f.key==="ArrowRight"))return;switch(f.key){case"ArrowUp":f.preventDefault(),y>0&&(p(S,[y-1,L],!0),p(j,[l(S)],!0),fe.instance.scrollToIndex(y-1,{align:"auto"}));break;case"ArrowDown":f.preventDefault(),y0&&(p(S,[y,L-1],!0),p(j,[l(S)],!0));break;case"ArrowRight":f.preventDefault(),L0?p(S,[y,L-1],!0):y>0&&p(S,[y-1,F-1],!0):Lhe?.focus());break}case"Enter":if(l(x)&&f.shiftKey)return;f.preventDefault(),l(x)?(p(x,!1),yhe?.focus())):a()&&(b().includes(L)||b().includes(l(B)[L])||p(x,[y,L],!0));break;case"Escape":p(x,!1),xt().then(()=>he?.focus());break;case"Delete":case"Backspace":if(!l(x)&&a()){f.preventDefault();const Z=i().map(ee=>[...ee]);l(j).forEach(([ee,se])=>{b().includes(se)||(Z[ee][se]="")}),i(Z),He(Z)}break;default:a()&&!l(x)&&f.key.length===1&&!f.ctrlKey&&!f.metaKey&&!b().includes(L)&&p(x,[y,L],!0);break}(f.ctrlKey||f.metaKey)&&f.key==="c"&&fn()}}function _r(){Q&&p(Me,Q.scrollTop>100)}function vr(){Q?.scrollTo({top:0})}function _n(f,w,F){if(f.stopPropagation(),l(W)?.row===w&&l(W).col===F)p(W,null);else{const y=f.target.closest(".body-cell, td");if(y){const L=y.getBoundingClientRect();p(W,{row:w,col:F,x:L.right,y:L.bottom},!0)}}}function mr(f){gl(typeof f=="string"?f:f?.data??"",w=>(o(w.map(F=>F??"")),o().map((F,y)=>({id:`h_${y}`,value:F}))),w=>{i(w),He(w,o())})}on(()=>(document.addEventListener("click",hn),()=>document.removeEventListener("click",hn)));function pr(f){return xt().then(()=>{console.log("measuring"),fe.instance.measureElement(f)}),{destroy(){}}}let At,Dt,Lt=ne(0);const pt=hl({header_row_el:()=>At,header_table_el:()=>Dt,resolved_headers:()=>l(B),row_data:()=>l(A),show_row_numbers:()=>d(),column_widths:()=>h(),viewport_width:()=>l(Lt),on_resize:void 0});let wr=R(()=>l(W)!==null||l(K)!==null),vn=R(()=>l(S)!==!1?l(S)[0]:!1);st(()=>{typeof l(vn)=="number"&&fe.instance.scrollToIndex(l(vn),{align:"auto"})});function Ft(f){const w=`col_${f}`,F=l(re).findIndex(y=>y.id===w);return F===-1?{direction:null,priority:null}:{direction:l(re)[F].desc?"desc":"asc",priority:F+1}}function mn(f){return l(U).some(w=>w.id===`col_${f}`)}var pn=Fl();Et("resize",qr,()=>{p(W,null),p(K,null)});var Mt=ce(pn);let wn;var Sn=V(Mt);{var Sr=f=>{var w=vl(),F=V(w);{var y=Z=>{var ee=_l(),se=V(ee),we=V(se,!0);E(se),E(ee),ae(()=>_e(we,n())),k(Z,ee)};H(F,Z=>{n()&&n().length!==0&&r()&&Z(y)})}var L=D(F,2);{let Z=R(()=>c()===null?!0:c().includes("fullscreen")),ee=R(()=>c()===null?!0:c().includes("copy")),se=R(()=>l(z)||null);il(L,{get show_fullscreen_button(){return l(Z)},get fullscreen(){return G()},on_copy:fn,get show_copy_button(){return l(ee)},get show_search(){return M()},onsearch:we=>sr(we),get onfullscreen(){return t.onfullscreen},on_commit_filter:fr,get current_search_query(){return l(se)}})}E(w),k(f,w)};H(Sn,f=>{(n()&&n().length!==0&&r()||(c()===null||c().includes("fullscreen"))||(c()===null||c().includes("copy"))||M()!=="none")&&f(Sr)})}var gt=D(Sn,2);let Cn;gt.__keydown=hr;var xn=V(gt);{let f=R(()=>t.i18n("dataframe.drop_to_upload"));Wr(xn,{get upload(){return t.upload},get stream_handler(){return t.stream_handler},flex:!1,center:!1,boundedheight:!1,disable_click:!0,get root(){return t.root},onload:mr,get aria_label(){return l(f)},get dragging(){return l(Re)},set dragging(w){p(Re,w,!0)},children:(w,F)=>{var y=yl();let L;var Z=V(y);{var ee=ue=>{var Ee=ml(),je=V(Ee,!0);E(Ee),ae(()=>_e(je,n())),k(ue,Ee)};H(Z,ue=>{n()&&n().length!==0&&ue(ee)})}var se=D(Z,2),we=V(se),Ne=V(we),We=V(Ne);{var Ze=ue=>{var Ee=pl();k(ue,Ee)};H(We,ue=>{d()&&ue(Ze)})}var ft=D(We);mt(ft,17,()=>l(te),ue=>ue.id,(ue,Ee)=>{var je=Ce(),me=ce(je);mt(me,17,()=>l(Ee).headers,nt=>nt.id,(nt,ut)=>{const Se=R(()=>l(ut).column.columnDef.meta?.colIndex??0);{let Ve=R(()=>String(l(ut).column.columnDef.header??"")),ze=R(()=>l(oe)===l(Se)),ct=R(()=>l($)===l(Se)),_t=R(()=>!!l(ut).column.columnDef.meta?.isStatic),wt=R(()=>ke(l(Se))==="bool"),St=R(()=>gr(l(Se))),ve=R(()=>Ft(l(Se)).direction),Fe=R(()=>Ft(l(Se)).priority),rt=R(()=>l(re).length>1),ye=R(()=>mn(l(Se))),Ct=R(()=>t.col_count[1]==="dynamic"),Qe=R(()=>l(Se)===0&&!d());bi(nt,{get value(){return l(Ve)},get col_idx(){return l(Se)},get is_editing(){return l(ze)},get is_selected(){return l(ct)},get is_static(){return l(_t)},get is_bool(){return l(wt)},get select_all_state(){return l(St)},get sort_direction(){return l(ve)},get sort_priority(){return l(Fe)},get multi_sort(){return l(rt)},get is_filtered(){return l(ye)},get show_menu_button(){return l(Ct)},get is_first_column(){return l(Qe)},get latex_delimiters(){return t.latex_delimiters},get line_breaks(){return _()},get editable(){return a()},get max_chars(){return m()},get i18n(){return t.i18n},get wrap_text(){return u()},onclick:er,on_menu_click:nr,on_end_edit:tr,on_select_all:dr})}}),k(ue,je)}),E(Ne),it(Ne,ue=>At=ue,()=>At),E(we);var ht=D(we),Ot=V(ht);{var Ht=ue=>{const Ee=R(le);var je=Cl(),me=V(je);{var nt=Se=>{var Ve=wl(),ze=V(Ve,!0);E(Ve),ae(()=>_e(ze,l(T).length)),k(Se,Ve)};H(me,Se=>{d()&&Se(nt)})}var ut=D(me);mt(ut,17,()=>l(Ee),Se=>Se.col_idx,(Se,Ve)=>{var ze=Sl(),ct=V(ze),_t=V(ct);{var wt=ve=>{Hn(ve,{get message(){return l(Ve).val},get latex_delimiters(){return t.latex_delimiters},get line_breaks(){return _()},chatbot:!1})},St=ve=>{var Fe=Ce(),rt=ce(Fe);{var ye=Qe=>{var dt=Ce(),Gt=ce(dt);On(Gt,()=>l(Ve).val),k(Qe,dt)},Ct=Qe=>{var dt=Ln();ae(()=>_e(dt,l(Ve).val)),k(Qe,dt)};H(rt,Qe=>{l(Ve).dtype==="html"?Qe(ye):Qe(Ct,!1)},!0)}k(ve,Fe)};H(_t,ve=>{l(Ve).dtype==="markdown"?ve(wt):ve(St,!1)})}E(ct),E(ze),k(Se,ze)}),E(je),k(ue,je)};H(Ot,ue=>{l(T).length>0&&ue(Ht)})}E(ht),E(se),it(se,ue=>Dt=ue,()=>Dt);var jt=D(se,2);mt(jt,21,()=>l(Pe),ue=>ue.key,(ue,Ee)=>{const je=R(()=>l(T)[l(Ee).index]),me=R(()=>l(je)?.original._index??l(Ee).index);var nt=Ce(),ut=ce(nt);{var Se=Ve=>{var ze=Rl();let ct;var _t=V(ze);{var wt=ve=>{var Fe=xl(),rt=V(Fe,!0);E(Fe),ae(()=>{ge(Fe,"data-row",l(me)),ot(Fe,`flex: 0 0 ${pt.row_num_width??""}px; width: ${pt.row_num_width??""}px;`),_e(rt,l(me)+1)}),k(ve,Fe)};H(_t,ve=>{d()&&ve(wt)})}var St=D(_t,2);mt(St,19,()=>l(je).getVisibleCells(),ve=>ve.id,(ve,Fe,rt)=>{const ye=R(()=>l(Fe).column.columnDef.meta?.colIndex??0),Ct=R(()=>ll([l(me),l(ye)],l(j)));{let Qe=R(()=>l(Fe).getValue()),dt=R(()=>pe(l(me),l(ye))),Gt=R(()=>ke(l(ye))),Fr=R(()=>pt.get_col_style(l(rt))),Mr=R(()=>qe(l(me),l(ye))),kr=R(()=>sl([l(me),l(ye)],l(j))),Ir=R(()=>!!(l(x)&&l(x)[0]===l(me)&&l(x)[1]===l(ye))),Pr=R(()=>l(xe)&&l(Ct)),Er=R(()=>!a()||!!l(Fe).column.columnDef.meta?.isStatic),Vr=R(()=>a()&&!l(Fe).column.columnDef.meta?.isStatic&&l(j).length===1&&l(j)[0][0]===l(me)&&l(j)[0][1]===l(ye)),zr=R(()=>l(j).length===1&&l(j)[0][0]===l(me)&&l(j)[0][1]===l(ye)),Ar=R(()=>l(j).length===1&&l(j)[0][0]===l(me)&&l(j)[0][1]===l(ye)),Dr=R(()=>l(rt)===0&&!d());Mi(ve,{get value(){return l(Qe)},get display_value(){return l(dt)},get datatype(){return l(Gt)},get row_idx(){return l(me)},get col_idx(){return l(ye)},get col_style(){return l(Fr)},get cell_style(){return l(Mr)},get selection_classes(){return l(kr)},get is_editing(){return l(Ir)},get is_flash(){return l(Pr)},get is_static(){return l(Er)},get show_menu_button(){return l(Vr)},get show_selection_buttons(){return l(zr)},get is_solo(){return l(Ar)},get is_first_column(){return l(Dr)},get latex_delimiters(){return t.latex_delimiters},get line_breaks(){return _()},get editable(){return a()},get max_chars(){return m()},get i18n(){return t.i18n},get components(){return s()},is_dragging:de,get wrap_text(){return u()},onmousedown:Be=>zt(Be,l(me),l(ye)),ondblclick:Be=>Qn(Be,l(me),l(ye)),oncontextmenu:Be=>{const Bt=!!l(Fe).column.columnDef.meta?.isStatic;!a()||Bt||(Be.preventDefault(),_n(Be,l(me),l(ye)))},onblur:$n,on_menu_click:Be=>_n(Be,l(me),l(ye)),on_select_column:Be=>{p(j,l(T).map((Bt,Tt)=>[Tt,Be]),!0),p(S,l(j)[0],!0)},on_select_row:Be=>{p(j,l(B).map((Bt,Tt)=>[Be,Tt]),!0),p(S,l(j)[0],!0)}})}}),E(ze),Jt(ze,(ve,Fe)=>pr?.(ve),()=>l(je)),ae(ve=>{ct=De(ze,1,"virtual-row svelte-2balj6",null,ct,{"row-odd":l(Ee).index%2!==0}),ge(ze,"data-index",l(Ee).index),ot(ze,`position: absolute; top: 0; left: 0; width: 100%; transform: translateY(${l(Ee).start??""}px);${ve??""}`)},[()=>l(j).some(([ve])=>ve===l(me))?" z-index: 3;":""]),k(Ve,ze)};H(ut,Ve=>{l(je)&&Ve(Se)})}k(ue,nt)}),E(jt),E(y),it(y,ue=>Q=ue,()=>Q),ae(()=>{L=De(y,1,"virtual-table-viewport svelte-2balj6",null,L,{"disable-scroll":l(wr)}),ot(y,`max-height: ${g()??""}px;`),ot(jt,`height: ${l(be)??""}px; position: relative; flex-shrink: 0; width: ${pt.total_header_width?`${pt.total_header_width}px`:"100%"};`)}),Et("scroll",y,_r),Nr(y,"clientWidth",ue=>p(Lt,ue)),k(w,y)},$$slots:{default:!0}})}var Cr=D(xn,2);{var xr=f=>{var w=bl();w.__click=vr,k(f,w)};H(Cr,f=>{l(Me)&&f(xr)})}E(gt),it(gt,f=>he=f,()=>he),E(Mt);var Rn=D(Mt,2);{var Rr=f=>{{let w=R(()=>l(W)?.x??l(K)?.x??0),F=R(()=>l(W)?.y??l(K)?.y??0),y=R(()=>l(K)?-1:l(W)?.row??0),L=R(()=>!l(K)&&i().length>1&&a()),Z=R(()=>i().length>0&&(i()[0]?.length??0)>1&&a()),ee=R(()=>l(K)?ht=>{rr(l(K).col,ht),p(K,null)}:void 0),se=R(()=>l(K)?()=>{or(),p(K,null)}:void 0),we=R(()=>l(K)?Ft(l(K).col).direction:null),Ne=R(()=>l(K)?Ft(l(K).col).priority:null),We=R(()=>l(K)?(ht,Ot,Ht)=>{ir(l(K).col,ht,Ot,Ht),p(K,null)}:void 0),Ze=R(()=>l(K)?()=>{lr(),p(K,null)}:void 0),ft=R(()=>l(K)?mn(l(K).col):null);tl(f,{get x(){return l(w)},get y(){return l(F)},get row(){return l(y)},get col_count(){return t.col_count},get row_count(){return t.row_count},on_add_row_above:()=>dn(l(W)?.row??-1,"above"),on_add_row_below:()=>dn(l(W)?.row??-1,"below"),on_add_column_left:()=>gn(l(W)?.col??l(K)?.col??-1,"left"),on_add_column_right:()=>gn(l(W)?.col??l(K)?.col??-1,"right"),on_delete_row:()=>ur(l(W)?.row??-1),on_delete_col:()=>cr(l(W)?.col??l(K)?.col??-1),get editable(){return a()},get can_delete_rows(){return l(L)},get can_delete_cols(){return l(Z)},get i18n(){return t.i18n},get on_sort(){return l(ee)},get on_clear_sort(){return l(se)},get sort_direction(){return l(we)},get sort_priority(){return l(Ne)},get on_filter(){return l(We)},get on_clear_filter(){return l(Ze)},get filter_active(){return l(ft)}})}};H(Rn,f=>{(l(W)||l(K))&&f(Rr)})}var yr=D(Rn,2);{var br=f=>{Ii(f,{on_click:()=>cn()})};H(yr,f=>{i().length===0&&a()&&t.row_count[1]==="dynamic"&&f(br)})}ae(()=>{wn=De(Mt,1,"table-container svelte-2balj6",null,wn,{fullscreen:G()}),Cn=De(gt,1,"table-wrap svelte-2balj6",null,Cn,{dragging:de,"menu-open":l(W)||l(K)}),ot(gt,`--df-max-col-width: ${l(Lt)??""}px;`)}),k(e,pn),Ye()}et(["keydown","click"]);var kl=Y(" ",1);function ts(e,t){Xe(t,!0);let n=jr(t,["$$slots","$$events","$$legacy"]);const r=new to(n);let o=ne($e(r.props.fullscreen??!1)),i=R(()=>{const h=r.props.datatype;if(!Array.isArray(h))return h;const d=r.props.headers,c=r.props.value?.headers;if(!d||!c)return h;const v=new Map;for(let m=0;mv.get(m)??h[M]??"str")}),s=ne($e(r.props.value?JSON.stringify(r.props.value):null));function a(h){r.props.value=h;const d=JSON.stringify(h);d!==l(s)&&(p(s,d,!0),r.dispatch("change",h))}function u(){r.dispatch("input")}function g(h){r.dispatch("select",h)}function _(h){r.dispatch("edit",h)}st(()=>{const h=r.props.value;if(h){const d=JSON.stringify(h);d!==l(s)&&(p(s,d,!0),r.dispatch("change",h))}}),eo(e,{get visible(){return r.shared.visible},get elem_id(){return r.shared.elem_id},get elem_classes(){return r.shared.elem_classes},get scale(){return r.shared.scale},get min_width(){return r.shared.min_width},padding:!1,container:!1,get fullscreen(){return l(o)},children:(h,d)=>{var c=kl(),v=ce(c);$r(v,Hr({get autoscroll(){return r.shared.autoscroll},get i18n(){return r.i18n}},()=>r.shared.loading_status));var m=D(v,2);{let M=R(()=>r.props.value?.headers??[]),I=R(()=>r.props.value?.data??[]),b=R(()=>r.props.value?.metadata?.display_value??null),G=R(()=>r.props.value?.metadata?.styling??null),X=R(()=>r.shared.interactive??!0),P=R(()=>r.props.column_widths??[]),A=R(()=>r.shared.client?.upload),B=R(()=>r.shared.client?.stream),ie=R(()=>r.props.static_columns??[]);Ml(m,{get headers(){return l(M)},get values(){return l(I)},get display_value(){return l(b)},get styling(){return l(G)},get col_count(){return r.props.col_count},get row_count(){return r.props.row_count},get label(){return r.shared.label},get show_label(){return r.shared.show_label},get wrap(){return r.props.wrap},get datatype(){return l(i)},get latex_delimiters(){return r.props.latex_delimiters},get max_height(){return r.props.max_height},get editable(){return l(X)},get line_breaks(){return r.props.line_breaks},get column_widths(){return l(P)},get root(){return r.shared.root},get i18n(){return r.i18n},get upload(){return l(A)},get stream_handler(){return l(B)},get buttons(){return r.props.buttons},get max_chars(){return r.props.max_chars},get show_row_numbers(){return r.props.show_row_numbers},get show_search(){return r.props.show_search},get pinned_columns(){return r.props.pinned_columns},get static_columns(){return l(ie)},get fullscreen(){return l(o)},onfullscreen:()=>{p(o,!l(o))},onchange:a,oninput:u,onselect:g,onedit:_})}k(h,c)},$$slots:{default:!0}}),Ye()}export{Ml as BaseDataFrame,os as BaseExample,ts as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Cok7jpx4.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Cok7jpx4.js new file mode 100644 index 0000000000000000000000000000000000000000..23664b53f47590fb1d72a7ef50d4dbc316ffdd5c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Cok7jpx4.js @@ -0,0 +1 @@ +import{i as u,s as m,a as f,b as c,f as _,r as v,g as x}from"./i18n-Dnhn5Rxr.js";import{R as b,t as w,a as y,T as $,X as q,W as G,V as S,w as j,Y as k,a5 as I}from"./index-DWyDLubb.js";import{S as R}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{G as T}from"./utils.svelte-CCyS_0CY.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";import"./clone-BkeCM4Nl.js";var V=G("
        ");function J(d,a){b(a,!0);const r=e=>{if(e!==void 0){if(typeof e=="number")return e+"px";if(typeof e=="string")return e}};let h=v(a,["$$slots","$$events","$$legacy"]),s=new T(h);var t=V();let o,l;var p=S(t);{var n=e=>{{let i=I(()=>s.shared.loading_status?s.shared.loading_status.status=="pending"?"generating":s.shared.loading_status.status:null);R(e,x({get autoscroll(){return s.shared.autoscroll},get i18n(){return s.i18n}},()=>s.shared.loading_status,{get status(){return j(i)}}))}};u(p,e=>{s.shared.loading_status&&s.shared.loading_status.show_progress&&s&&e(n)})}var g=q(p,2);m(g,a,"default",{}),k(t),w((e,i)=>{f(t,"id",s.shared.elem_id),o=c(t,1,`row ${e??""}`,"svelte-7xavid",o,{compact:s.props.variant==="compact",panel:s.props.variant==="panel","unequal-height":s.props.equal_height===!1,stretch:s.props.equal_height,hide:!s.shared.visible,"grow-children":s.shared.scale&&s.shared.scale>=1}),l=_(t,"",l,i)},[()=>s.shared.elem_classes?.join(" "),()=>({height:r(s.props.height),"max-height":r(s.props.max_height),"min-height":r(s.props.min_height),"flex-grow":s.shared.scale})]),y(d,t),$()}export{J as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Csvz6q0R.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Csvz6q0R.js new file mode 100644 index 0000000000000000000000000000000000000000..c7d80f44fb03b80b09c1a74be620352cdaa7ed2d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Csvz6q0R.js @@ -0,0 +1 @@ +import{i as G,s as H,d as j,a as z,b as C,r as N,g as O}from"./i18n-Dnhn5Rxr.js";import{R,aa as V,t as W,a as X,T as Y,X as F,W as J,V as K,M as Q,w as U,Y as Z,a5 as ee}from"./index-DWyDLubb.js";import{G as te}from"./utils.svelte-CCyS_0CY.js";import{S as re}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./clone-BkeCM4Nl.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var ae=J('
        ');function pe(y,_){R(_,!0);const A=N(_,["$$slots","$$events","$$legacy"]),s=new te(A);let a,o=null,c=[],i=null;const p=[{event:"dragstart",handler:x},{event:"dragend",handler:M}],m=[{event:"dragover",handler:k},{event:"drop",handler:P},{event:"dragenter",handler:D}];function w(e){p.forEach(({event:r,handler:t})=>{e.addEventListener(r,t)})}function h(e){p.forEach(({event:r,handler:t})=>{e.removeEventListener(r,t)})}function S(e){m.forEach(({event:r,handler:t})=>{e.addEventListener(r,t)})}function v(e){m.forEach(({event:r,handler:t})=>{e.removeEventListener(r,t)})}function b(e,r){e.classList.add("draggable-item"),e.setAttribute("data-index",r.toString()),e.style.position="relative";const t=document.createElement("div");t.className="drag-handle",t.setAttribute("draggable","true"),t.setAttribute("aria-grabbed","false"),t.setAttribute("data-index",r.toString()),t.innerHTML="⋮⋮",e.appendChild(t),w(t),S(e)}function f(){if(!a)return;c.forEach(t=>{const n=t.querySelector(".drag-handle");n&&(h(n),n.remove()),v(t)}),c=[];const e=Array.from(a.children);let r=0;e.forEach(t=>{t.classList.contains("status-tracker")||(t.classList.contains("form")&&t.children.length>0?Array.from(t.children).forEach(l=>{c.push(l),b(l,r),r++}):(c.push(t),b(t,r),r++))})}function x(e){e.stopPropagation?.();const r=e.currentTarget,t=r.parentElement;o=t,parseInt(r.dataset.index||"-1"),r.setAttribute("aria-grabbed","true"),t.classList.add("dragging"),e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/html",t.outerHTML),e.dataTransfer.setDragImage(t,10,10))}function M(e){e.stopPropagation?.();const r=e.currentTarget;r.parentElement.classList.remove("dragging"),r.setAttribute("aria-grabbed","false"),i&&(i.classList.remove("drop-target"),i=null),o=null}function k(e){return e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"),!1}function D(e){e.stopPropagation?.();const r=e.currentTarget;if(r===o||!o||!a)return;const t=o.parentElement,n=r.parentElement,l=t?.classList.contains("form")&&t.parentElement===a,u=n?.classList.contains("form")&&n.parentElement===a;(l||t===a)&&(u||n===a)&&(i&&i!==r&&i.classList.remove("drop-target"),r.classList.add("drop-target"),i=r)}async function P(e){e.stopPropagation?.();const r=e.currentTarget;if(r.classList.remove("drop-target"),i&&(i.classList.remove("drop-target"),i=null),o&&o!==r&&a){const t=o.parentElement,n=r.parentElement,l=t?.classList.contains("form")&&t.parentElement===a,u=n?.classList.contains("form")&&n.parentElement===a;if(!((l||t===a)&&(u||n===a)))return!1;const g=document.createElement("div");g.style.display="none",t.insertBefore(g,o),n.insertBefore(o,r),t.insertBefore(r,g),g.remove(),o?.classList.remove("dragging");const T=o?.querySelector(".drag-handle");T&&T.setAttribute("aria-grabbed","false"),await Q(),f()}return!1}V(()=>{f();const e=new MutationObserver(f);return a&&e.observe(a,{childList:!0,subtree:!1}),()=>{e.disconnect(),c.forEach(r=>{const t=r.querySelector(".drag-handle");t&&h(t),v(r)})}});var d=ae();let E;var L=K(d);{var $=e=>{{let r=ee(()=>s.shared.loading_status?s.shared.loading_status.status=="pending"?"generating":s.shared.loading_status.status:null);re(e,O({get autoscroll(){return s.shared.autoscroll},get i18n(){return s.i18n}},()=>s.shared.loading_status,{get status(){return U(r)}}))}};G(L,e=>{s.shared.loading_status&&s.props.show_progress&&e($)})}var q=F(L,2);H(q,_,"default",{}),Z(d),j(d,e=>a=e,()=>a),W(e=>{z(d,"id",s.shared.elem_id),E=C(d,1,`draggable ${e??""}`,"svelte-1kr8imm",E,{hide:!s.shared.visible,horizontal:s.props.orientation==="row",vertical:s.props.orientation==="column"})},[()=>(s.shared.elem_classes||[]).join(" ")]),X(y,d),Y()}export{pe as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CtxMS3EK.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CtxMS3EK.js new file mode 100644 index 0000000000000000000000000000000000000000..d17f0284670a3cd245896d45900eb5b15c65d4bc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CtxMS3EK.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Canvas3D-DomR9yf1.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./i18n-Dnhn5Rxr.js","./i18n-9kYrHpuJ.css","./Canvas3DGS-DEcXVidd.js"])))=>i.map(i=>d[i]); +import{p as i,i as S,s as de,d as ie,r as ue,g as $}from"./i18n-Dnhn5Rxr.js";import{R as oe,y as N,x as u,w as a,S as c,a as p,T as le,u as _,af as ee,a5 as m,X as P,W as T,a6 as F,V as _e,Y as pe,M as Q,v as ge}from"./index-DWyDLubb.js";import{G as me}from"./utils.svelte-CCyS_0CY.js";import ce from"./Model3D-HY69ejZB.js";import{c as re}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{U as he}from"./Upload-HitvyI7k.js";import{M as fe}from"./ModifyUpload-CIJNunwR.js";import{B as se}from"./BlockLabel-CZd21Hkw.js";import{F as Z}from"./File-BHHIF0P7.js";import{B as te}from"./Block-J4oodUWp.js";import{E as ve}from"./Empty-BIB2W5at.js";import{U as be}from"./UploadText-oRnvaG4b.js";import{I as we}from"./IconButtonWrapper-D0s9l4wW.js";import{S as ae}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{default as tr}from"./Example-BvF-auBS.js";import"./clone-BkeCM4Nl.js";import"./Download-Di2PsS6O.js";import"./Undo-C2-jWGVL.js";import"./index-tFQomdd2.js";import"./snippet-BWgYNF9D.js";import"./actions-CLThs9VH.js";import"./DownloadLink-TGTaev7f.js";import"./Clear-BF6j078A.js";import"./Edit-D-unDhOb.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var ye=T('
        '),xe=T(" ",1);function ze(O,t){oe(t,!0);let s=i(t,"value",15),X=i(t,"display_mode",3,"solid"),e=i(t,"clear_color",19,()=>[0,0,0,0]),W=i(t,"label",3,""),E=i(t,"zoom_speed",3,1),y=i(t,"pan_speed",3,1),L=i(t,"max_file_size",3,null),h=i(t,"uploading",15),R=i(t,"upload_promise",15),Y=i(t,"camera_position",19,()=>[null,null,null]),x=_(!1),V=_(void 0),j=_(void 0),I=_(void 0),z=_(!1);async function q(){return(await ee(()=>import("./Canvas3D-DomR9yf1.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url)).default}async function H(){return(await ee(()=>import("./Canvas3DGS-DEcXVidd.js"),__vite__mapDeps([5,3,1,2,4]),import.meta.url)).default}N(()=>{s()&&(u(x,s().path.endsWith(".splat")||s().path.endsWith(".ply"),!0),a(x)?H().then(r=>{u(V,r,!0)}):q().then(r=>{u(j,r,!0)}))}),N(()=>{t.ondrag?.(a(z))});async function J(r){s(r),await Q(),t.onchange?.(s()),t.onload?.(s())}async function o(){s(null),await Q(),t.onclear?.(),t.onchange?.(null)}async function D(){a(I)?.reset_camera_position()}function U(r){t.onerror?.(r)}var M=xe(),A=c(M);{let r=m(()=>W()||"3D Model");se(A,{get show_label(){return t.show_label},get Icon(){return Z},get label(){return a(r)}})}var f=P(A,2);{var v=r=>{{let g=m(()=>t.i18n("model3d.drop_to_upload"));he(r,{get upload(){return t.upload},get stream_handler(){return t.stream_handler},onload:J,get root(){return t.root},get max_file_size(){return L()},filetype:[".stl",".obj",".gltf",".glb","model/obj",".splat",".ply"],onerror:U,get aria_label(){return a(g)},get upload_promise(){return R()},set upload_promise(l){R(l)},get dragging(){return a(z)},set dragging(l){u(z,l,!0)},get uploading(){return h()},set uploading(l){h(l)},children:(l,C)=>{var b=F(),G=c(b);de(G,t,"default",{}),p(l,b)},$$slots:{default:!0}})}},k=r=>{var g=ye(),l=_e(g);{let n=m(()=>!a(x));fe(l,{get undoable(){return a(n)},onclear:o,get i18n(){return t.i18n},onundo:D})}var C=P(l,2);{var b=n=>{var w=F(),d=c(w);re(d,()=>a(V),(B,K)=>{K(B,{get value(){return s()},get zoom_speed(){return E()},get pan_speed(){return y()}})}),p(n,w)},G=n=>{var w=F(),d=c(w);re(d,()=>a(j),(B,K)=>{ie(K(B,{get value(){return s()},get display_mode(){return X()},get clear_color(){return e()},get camera_position(){return Y()},get zoom_speed(){return E()},get pan_speed(){return y()}}),ne=>u(I,ne,!0),()=>a(I))}),p(n,w)};S(C,n=>{a(x)?n(b):n(G,!1)})}pe(g),p(r,g)};S(f,r=>{s()==null?r(v):r(k,!1)})}p(O,M),le()}var De=T(" ",1),Me=T(" ",1),Be=T(" ",1);function $e(O,t){oe(t,!0);class s extends me{async get_data(){return a(h)&&(await a(h),await Q()),await super.get_data()}}const X=ue(t,["$$slots","$$events","$$legacy"]),e=new s(X);let W=_(ge(e.props.value)),E=_(!1),y=_(!1),L=_(!1),h=_(void 0);const R=typeof window<"u";N(()=>{a(W)!==e.props.value&&(u(W,e.props.value,!0),e.dispatch("change"))});function Y(o){e.props.value=o,e.dispatch("change",o),u(L,!0)}function x(o){u(y,o,!0)}function V(){e.props.value=null,e.dispatch("clear")}function j(o){e.props.value=o,e.dispatch("upload")}function I(o){e.shared.loading_status&&(e.shared.loading_status.status="error"),e.dispatch("error",o)}var z=F(),q=c(z);{var H=o=>{{let D=m(()=>e.props.value===null?"dashed":"solid"),U=m(()=>a(y)?"focus":"base");te(o,{get visible(){return e.shared.visible},get variant(){return a(D)},get border_mode(){return a(U)},padding:!1,get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},get height(){return e.props.height},children:(M,A)=>{var f=Me(),v=c(f);ae(v,$({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var k=P(v,2);{var r=l=>{ce(l,{get value(){return e.props.value},get i18n(){return e.i18n},get display_mode(){return e.props.display_mode},get clear_color(){return e.props.clear_color},get label(){return e.shared.label},get show_label(){return e.shared.show_label},get camera_position(){return e.props.camera_position},get zoom_speed(){return e.props.zoom_speed},get has_change_history(){return a(L)}})},g=l=>{var C=De(),b=c(C);{var G=d=>{we(d,{get buttons(){return e.props.buttons},on_custom_button_click:B=>{e.dispatch("custom_button_click",{id:B})}})};S(b,d=>{e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0&&d(G)})}var n=P(b,2);{let d=m(()=>e.shared.label||"3D Model");se(n,{get show_label(){return e.shared.show_label},get Icon(){return Z},get label(){return a(d)}})}var w=P(n,2);ve(w,{unpadded_box:!0,size:"large",children:(d,B)=>{Z(d)},$$slots:{default:!0}}),p(l,C)};S(k,l=>{e.props.value&&R?l(r):l(g,!1)})}p(M,f)},$$slots:{default:!0}})}},J=o=>{{let D=m(()=>e.props.value===null?"dashed":"solid"),U=m(()=>a(y)?"focus":"base");te(o,{get visible(){return e.shared.visible},get variant(){return a(D)},get border_mode(){return a(U)},padding:!1,get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},get height(){return e.props.height},children:(M,A)=>{var f=Be(),v=c(f);ae(v,$({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var k=P(v,2);ze(k,{get label(){return e.shared.label},get show_label(){return e.shared.show_label},get root(){return e.shared.root},get display_mode(){return e.props.display_mode},get clear_color(){return e.props.clear_color},get camera_position(){return e.props.camera_position},get zoom_speed(){return e.props.zoom_speed},onchange:Y,ondrag:x,onclear:V,onload:j,onerror:I,get i18n(){return e.i18n},get max_file_size(){return e.shared.max_file_size},upload:(...r)=>e.shared.client.upload(...r),stream_handler:(...r)=>e.shared.client.stream(...r),get upload_promise(){return a(h)},set upload_promise(r){u(h,r,!0)},get value(){return e.props.value},set value(r){e.props.value=r},get uploading(){return a(E)},set uploading(r){u(E,r,!0)},children:(r,g)=>{be(r,{get i18n(){return e.i18n},type:"file"})},$$slots:{default:!0}}),p(M,f)},$$slots:{default:!0}})}};S(q,o=>{e.shared.interactive?o(J,!1):o(H)})}p(O,z),le()}export{tr as BaseExample,ce as BaseModel3D,ze as BaseModel3DUpload,$e as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CvTz6tyr.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CvTz6tyr.js new file mode 100644 index 0000000000000000000000000000000000000000..4d4e04c66d6bcbafb820a16f0906327bb5b69d11 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CvTz6tyr.js @@ -0,0 +1 @@ +import{p as u,i as C,a as X,d as be,k as $e,u as et,N as It,b as se,f as Et,r as Pt,g as Ft}from"./i18n-Dnhn5Rxr.js";import{a as g,f as Bt,M as oe,aj as tt,R as De,u as S,v as at,aa as rt,x as s,w as t,ae as Ht,y as ne,V as v,Y as _,t as H,T as ze,X as q,S as xe,a0 as ge,au as Vt,W as R,aN as Wt,ai as Gt,a7 as Ae,A as Ut,Z as O,a5 as j,a8 as jt,a6 as Ze,ak as Lt}from"./index-DWyDLubb.js";import{f as Yt,s as Kt,G as Nt}from"./utils.svelte-CCyS_0CY.js";import{a as Xt}from"./actions-CLThs9VH.js";import{b as Zt}from"./input-DrerMDOL.js";import{M as Jt,V as Ot}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as Qt}from"./BlockTitle-BMm9LakX.js";import{A as $t}from"./ArrowUp-D69HGcoh.js";import{C as ea}from"./Check-DUAHzS2-.js";import{C as Je}from"./Clear-BF6j078A.js";import{F as ta}from"./File-BHHIF0P7.js";import{M as aa}from"./Music-BQN2qTdy.js";import{S as lt}from"./Square-CcB54dqq.js";import{S as ra}from"./ScrollFade-CIgHp1zY.js";import{U as la}from"./Upload-HitvyI7k.js";import{I as oa}from"./Image-CeW7PJs4.js";/* empty css */import{u as ia,p as sa,M as na}from"./MinimalAudioPlayer-Cb9FZeXv.js";import{o as Oe}from"./record.esm-EHLfhwCm.js";import{B as da}from"./Block-J4oodUWp.js";import{S as ua}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{default as vr}from"./Example-iNtc2BQ6.js";import"./clone-BkeCM4Nl.js";import"./snippet-BWgYNF9D.js";import"./Info-Dzjhnd64.js";import"./html-Ih_5QVTo.js";import"./misc-vsnLZ-Y1.js";/* empty css */import"./index-B_pwUImq.js";import"./size-CtOeLwIl.js";import"./Video-B_oD6cFy.js";import"./universal-CFOISHmx.js";var ca=Bt('');function Qe(y){var e=ca();g(y,e)}async function Me(y,e,o){if(await oe(),e===o)return;const E=window.getComputedStyle(y),F=parseFloat(E.paddingTop),l=parseFloat(E.paddingBottom),A=parseFloat(E.lineHeight);let T=o===void 0?!1:F+l+A*o,p=F+l+e*A;y.style.height="1px";let k;T&&y.scrollHeight>T?k=T:y.scrollHeighty.removeEventListener("input",o)}}var fa=R(""),va=R(''),ma=R('
        '),ga=R('
        ',1),pa=R('
        ');function ha(y,e){De(e,!0);let o=u(e,"waveform_settings",19,()=>({})),E=u(e,"recording",15),F=u(e,"max_file_size",3,null),l=u(e,"upload_promise",15),A,T,p=S(void 0),k=S(0),L,Z=S(!1),te=S(!1),B=S(at([])),J=S(""),Q=S(!1);const de=()=>{clearInterval(L),L=setInterval(()=>{Wt(k)},1e3)},I=async()=>{if(!A)return;T&&T.destroy();const f=getComputedStyle(document.documentElement).getPropertyValue("--color-accent")||"#ff7c00";T=ia.create({container:A,height:32,waveColor:"rgba(128, 128, 128, 0.5)",progressColor:f,cursorColor:"transparent",barWidth:2,barGap:2,barRadius:2,interact:!1,hideScrollbar:!0,...o()}),s(p,T.registerPlugin(Oe.create({scrollingWaveform:!0,scrollingWaveformWindow:7,renderRecordedAudio:!1})),!0),t(p).on("record-start",()=>{de(),s(Z,!0),s(te,!0)}),t(p).on("record-end",async x=>{clearInterval(L),s(Z,!1),l((async()=>{try{const n=await x.arrayBuffer(),Y=await new AudioContext({sampleRate:o().sampleRate||44100}).decodeAudioData(n);if(Y){const d=await sa(Y),K=new File([d],"audio.wav",{type:"audio/wav"}),D=await Vt([K],!1),M=(await e.upload(D,e.root,void 0,F()||void 0))?.[0];M&&e.onchange?.(M)}}catch(n){console.error("Error processing audio:",n)}finally{e.onstoprecording?.(),l(null)}})()),await l()})};rt(async()=>{try{const f=await Oe.getAvailableAudioDevices();s(B,f.filter(x=>x.deviceId),!0),t(B).length>0&&s(J,t(B)[0].deviceId,!0),t(B).length>1?s(Q,!0):await I()}catch{await I()}}),Ht(()=>{clearInterval(L),t(p)&&t(p).stopMic(),T&&T.destroy()}),ne(()=>{E()&&!t(Z)&&t(p)&&t(te)===!1&&t(B).length<=1?t(p).startMic({deviceId:t(J)}).then(()=>{t(p)?.startRecording()}).catch(f=>{console.error("Failed to access microphone:",f),e.onclear?.()}):!E()&&t(Z)&&t(p)&&(t(p).stopRecording(),s(k,0))});async function ue(){if(s(Q,!1),s(te,!0),await oe(),await I(),!!t(p))try{await t(p).startMic({deviceId:t(J)}),t(p).startRecording()}catch(f){console.error("Error starting recording:",f),s(Q,t(B).length>1),s(te,!1),E(!1)}}var ae=pa(),V=v(ae);{var W=f=>{var x=ma(),n=v(x);{var G=d=>{var K=va();$e(K,21,()=>t(B),et,(D,ie)=>{var M=fa(),N=v(M,!0);_(M);var ce={};H(()=>{ge(N,t(ie).label),ce!==(ce=t(ie).deviceId)&&(M.value=(M.__value=t(ie).deviceId)??"")}),g(D,M)}),_(K),It(K,()=>t(J),D=>s(J,D)),g(d,K)};C(n,d=>{t(B).length>1&&d(G)})}var Y=q(n,2);Y.__click=ue,_(x),g(f,x)},$=f=>{var x=ga(),n=xe(x);be(n,D=>A=D,()=>A);var G=q(n,2),Y=v(G,!0);_(G);var d=q(G,2);d.__click=()=>{t(Z)?E(!1):e.onclear?.()};var K=v(d);lt(K,{}),_(d),H(D=>ge(Y,D),[()=>Yt(t(k))]),g(f,x)};C(V,f=>{t(Q)?f(W):f($,!1)})}_(ae),H(()=>X(ae,"aria-label",e.label||"Audio Recorder")),g(y,ae),ze()}tt(["click"]);var ba=R('
        '),xa=R('
        '),wa=R("
        "),ya=R(''),ka=R('
        '),Ca=R('
        '),qa=R('
        '),Sa=R(''),Ra=R(''),Aa=R(''),Ma=R(''),Da=R('
        ');function za(y,e){De(e,!0);let o=u(e,"value",15),E=u(e,"value_is_output",3,!1),F=u(e,"lines",3,1),l=u(e,"placeholder",3,""),A=u(e,"disabled",3,!1),T=u(e,"info",3,void 0),p=u(e,"show_label",3,!0),k=u(e,"submit_btn",3,null),L=u(e,"stop_btn",3,null),Z=u(e,"rtl",3,!1),te=u(e,"autofocus",3,!1),B=u(e,"text_align",3,void 0),J=u(e,"autoscroll",3,!0),Q=u(e,"file_types_string",3,null),de=u(e,"max_file_size",3,null),I=u(e,"file_count",3,"multiple"),ue=u(e,"max_plain_text_length",3,1e3);u(e,"waveform_options",19,()=>({show_recording_waveform:!0}));let ae=u(e,"sources_string",3,"upload"),V=u(e,"active_source",15),W=u(e,"html_attributes",3,null),$=u(e,"upload_promise",15),f=u(e,"dragging",15),x,n,G=S(!1),Y=S(0),d=S(!1),K=S(!1),D=S(!1),ie=S(at(o()?.text??"")),M=S(!1),N=S(null),ce,_e=j(()=>ae().split(",").map(a=>a.trim()).filter(a=>a==="upload"||a==="microphone")),pe=j(()=>Q()?Q().split(",").map(a=>a.trim()):null),we=j(()=>t(_e)&&t(_e).includes("upload")&&!(I()==="single"&&o()?.files?.length>0));function Te(){s(K,Kt(n),!0)}ne(()=>{n&&o()?.text!==void 0&&oe().then(Te)}),ne(()=>{e.ondrag?.(f())}),ne(()=>{o()&&t(ie)!==o().text&&(e.onchange?.(o()),s(ie,o().text,!0))}),ne(()=>{n&&F()!==e.max_lines&&Me(n,F(),e.max_lines)}),Gt(()=>{n&&n.offsetHeight+n.scrollTop>n.scrollHeight-100&&s(G,!0)});const ot=()=>{t(G)&&J()&&!t(d)&&n.scrollTo(0,n.scrollHeight)};async function Ie(){e.onchange?.(o()),E()||e.oninput?.()}ne(()=>{o(),te()&&n&&n.focus()}),ne(()=>{t(G)&&J()&&ot()});function it(a){const r=a.target,i=r.value,m=[r.selectionStart,r.selectionEnd];e.onselect?.({value:i.substring(...m),index:m})}async function st(a){a.key==="Enter"&&a.shiftKey&&F()>1?(a.preventDefault(),await oe(),e.onsubmit?.()):a.key==="Enter"&&!a.shiftKey&&F()===1&&e.max_lines>=1&&(a.preventDefault(),ye(),V(null),await oe(),e.onsubmit?.())}function nt(a){const r=a.target,i=r.scrollTop;i=m&&s(d,!1),Te()}async function dt(a){if(Ie(),Array.isArray(a)){for(let r of a)o().files.push(r);o(o())}else o().files.push(a),o(o());await oe(),e.onchange?.(o()),e.onupload?.(a)}function ut(a,r){Ie(),a.stopPropagation(),o().files.splice(r,1),o(o())}function Ee(){x.open_upload()}function ct(){e.onstop?.()}function ye(){t(N)&&(o().files.push(t(N)),o(o()),s(N,null),e.onchange?.(o()))}function _t(){ye(),V(null),e.onsubmit?.()}async function ft(a){if(!a.clipboardData)return;const r=a.clipboardData.items,i=a.clipboardData.getData("text");if(i&&i.length>ue()){a.preventDefault();const m=new window.File([i],"pasted_text.txt",{type:"text/plain",lastModified:Date.now()});x&&x.load_files([m]);return}for(let m in r){const z=r[m];if(z.kind==="file"&&z.type.includes("image")){const P=z.getAsFile();P&&x.load_files([P])}}}function vt(a){a.preventDefault(),f(!0)}function mt(a){a.preventDefault();const r=ce.getBoundingClientRect(),{clientX:i,clientY:m}=a;(i<=r.left||i>=r.right||m<=r.top||m>=r.bottom)&&f(!1)}function gt(a){if(a.preventDefault(),f(!1),a.dataTransfer&&a.dataTransfer.files){const r=Array.from(a.dataTransfer.files);if(t(pe)){const i=r.filter(z=>t(pe).some(P=>P.startsWith(".")?z.name.toLowerCase().endsWith(P.toLowerCase()):z.type.match(new RegExp(P.replace("*",".*"))))),m=r.length-i.length;m>0&&e.onerror?.(`${m} file(s) were rejected. Accepted formats: ${t(pe).join(", ")}`),i.length>0&&x.load_files(i)}else x.load_files(r)}}var ee=Da();let Pe;var Fe=v(ee);Qt(Fe,{get show_label(){return p()},get info(){return T()},get rtl(){return Z()},children:(a,r)=>{jt();var i=Ae();H(()=>ge(i,e.label)),g(a,i)},$$slots:{default:!0}});var Be=q(Fe,2),He=v(Be);{var pt=a=>{var r=wa();let i;var m=v(r);{var z=b=>{var h=ba(),w=v(h);{let re=j(()=>e.label||"Audio");ha(w,{get label(){return t(re)},get waveform_settings(){return e.waveform_settings},get recording(){return t(M)},get upload(){return e.upload},get root(){return e.root},get max_file_size(){return de()},onchange:U=>{s(N,U,!0)},onstoprecording:()=>{s(M,!1),e.onstop_recording?.()},onclear:()=>{V(null),s(M,!1),s(N,null),e.onclear?.()},get upload_promise(){return $()},set upload_promise(U){$(U)}})}_(h),g(b,h)},P=b=>{var h=xa(),w=v(h);{let Se=j(()=>e.label||"Audio");na(w,{get value(){return t(N)},get label(){return t(Se)},loop:!1})}var re=q(w,2),U=v(re);U.__click=()=>{ye(),V(null),s(M,!1)};var he=v(U);ea(he),_(U);var fe=q(U,2);fe.__click=()=>{V(null),s(M,!1),s(N,null)};var qe=v(fe);Je(qe),_(fe),_(re),_(h),g(b,h)};C(m,b=>{t(N)?b(P,!1):b(z)})}_(r),H(()=>i=se(r,1,"recording-overlay svelte-1qn0337",null,i,{"has-audio":t(N)!==null})),g(a,r)};C(He,a=>{t(_e)&&t(_e).includes("microphone")&&V()==="microphone"&&a(pt)})}var Ve=q(He,2);{var ht=a=>{be(la(a,{onload:dt,get file_count(){return I()},get filetype(){return t(pe)},get root(){return e.root},get max_file_size(){return de()},show_progress:!1,disable_click:!0,get onerror(){return e.onerror},hidden:!0,get upload(){return e.upload},get stream_handler(){return e.stream_handler},get upload_promise(){return $()},set upload_promise(r){$(r)},get dragging(){return f()},set dragging(r){f(r)},get uploading(){return t(D)},set uploading(r){s(D,r,!0)}}),r=>x=r,()=>x)};C(Ve,a=>{t(we)&&a(ht)})}var ke=q(Ve,2);let We;var Ge=v(ke);{var bt=a=>{var r=qa(),i=v(r);{var m=h=>{var w=ya();w.__click=Ee;var re=v(w);Qe(re),_(w),H(()=>w.disabled=A()),g(h,w)};C(i,h=>{t(we)&&h(m)})}var z=q(i,2);$e(z,17,()=>o()?.files??[],et,(h,w,re)=>{var U=ka(),he=v(U),fe=v(he);{var qe=le=>{oa(le,{get src(){return t(w).url},restProps:{title:null,alt:"",loading:"lazy",class:"thumbnail-image"}})},Se=le=>{var Ne=Ze(),Rt=xe(Ne);{var At=ve=>{aa(ve)},Mt=ve=>{var Xe=Ze(),Dt=xe(Xe);{var zt=me=>{Ot(me)},Tt=me=>{ta(me)};C(Dt,me=>{t(w).mime_type&&t(w).mime_type.includes("video")?me(zt):me(Tt,!1)},!0)}g(ve,Xe)};C(Rt,ve=>{t(w).mime_type&&t(w).mime_type.includes("audio")?ve(At):ve(Mt,!1)},!0)}g(le,Ne)};C(fe,le=>{t(w).mime_type&&t(w).mime_type.includes("image")?le(qe):le(Se,!1)})}var Re=q(fe,2);Re.__click=le=>ut(le,re);var St=v(Re);Je(St),_(Re),_(he),_(U),g(h,U)});var P=q(z,2);{var b=h=>{var w=Ca();g(h,w)};C(P,h=>{t(D)&&h(b)})}_(r),g(a,r)};C(Ge,a=>{((o()?.files?.length??0)>0||t(D))&&a(bt)})}var Ue=q(Ge,2),je=v(Ue);{var xt=a=>{var r=Sa();r.__click=Ee;var i=v(r);Qe(i),_(r),H(()=>r.disabled=A()),g(a,r)};C(je,a=>{t(we)&&(o()?.files?.length??0)===0&&!t(D)&&a(xt)})}var Ce=q(je,2),c=v(Ce);Lt(c);let Le;Xt(c,(a,r)=>_a?.(a,r),()=>({text:o().text,lines:F(),max_lines:e.max_lines})),Ut(()=>Zt(c,()=>o().text,a=>o(o().text=a,!0))),be(c,a=>n=a,()=>n);var wt=q(c,2);ra(wt,{get visible(){return t(K)},position:"absolute"}),_(Ce);var Ye=q(Ce,2);{var yt=a=>{var r=Ra();let i;r.__click=async()=>{V()!=="microphone"?(V("microphone"),await oe(),s(M,!0)):(V(null),s(M,!1))};var m=v(r);Jt(m),_(r),H(()=>{i=se(r,1,"microphone-button svelte-1qn0337",null,i,{recording:t(M)}),r.disabled=A()}),g(a,r)};C(Ye,a=>{t(_e)&&t(_e).includes("microphone")&&a(yt)})}var Ke=q(Ye,2);{var kt=a=>{var r=Aa();let i;r.__click=_t;var m=v(r);{var z=b=>{$t(b)},P=b=>{var h=Ae();H(()=>ge(h,k())),g(b,h)};C(m,b=>{k()===!0?b(z):b(P,!1)})}_(r),H(()=>{i=se(r,1,"submit-button svelte-1qn0337",null,i,{"padded-button":k()!==!0}),r.disabled=A()}),g(a,r)};C(Ke,a=>{k()&&a(kt)})}var Ct=q(Ke,2);{var qt=a=>{var r=Ma();let i;r.__click=ct;var m=v(r);{var z=b=>{lt(b,{fill:"none",stroke_width:2.5})},P=b=>{var h=Ae();H(()=>ge(h,L())),g(b,h)};C(m,b=>{L()===!0?b(z):b(P,!1)})}_(r),H(()=>i=se(r,1,"stop-button svelte-1qn0337",null,i,{"padded-button":L()!==!0})),g(a,r)};C(Ct,a=>{L()&&a(qt)})}_(Ue),_(ke),_(Be),_(ee),be(ee,a=>ce=a,()=>ce),H(()=>{Pe=se(ee,1,"full-container svelte-1qn0337",null,Pe,{dragging:f()}),We=se(ke,1,"input-wrapper svelte-1qn0337",null,We,{"has-files":(o()?.files?.length??0)>0||t(D)}),X(c,"dir",Z()?"rtl":"ltr"),X(c,"placeholder",l()),X(c,"rows",F()),c.disabled=A(),Et(c,B()?"text-align: "+B():""),X(c,"autocapitalize",W()?.autocapitalize),X(c,"autocorrect",W()?.autocorrect),X(c,"spellcheck",W()?.spellcheck),X(c,"autocomplete",W()?.autocomplete),X(c,"tabindex",W()?.tabindex),X(c,"enterkeyhint",W()?.enterkeyhint),X(c,"lang",W()?.lang),Le=se(c,1,"svelte-1qn0337",null,Le,{"no-label":!p()}),c.dir=c.dir}),O("dragenter",ee,vt),O("dragleave",ee,mt),O("dragover",ee,a=>a.preventDefault()),O("drop",ee,gt),O("keypress",c,st),O("blur",c,()=>e.onblur?.()),O("select",c,it),O("focus",c,()=>e.onfocus?.()),O("scroll",c,nt),O("paste",c,ft),g(y,ee),ze()}tt(["click"]);var Ta=R(" ",1);function cr(y,e){De(e,!0);let o=S(null);class E extends Nt{async get_data(){return t(o)&&(await t(o),await oe()),await super.get_data()}}let F=Pt(e,["$$slots","$$events","$$legacy"]);const l=new E(F);l.props.value=l.props.value??{text:"",files:[]};let A=S(!1),T=S(null),p="darkorange";const k={height:50,barWidth:2,barGap:3,cursorWidth:2,cursorColor:"#ddd5e9",autoplay:!1,barRadius:10,dragToSeek:!0,normalize:!0,minPxPerSec:20,waveColor:"",progressColor:"",mediaControls:!1,sampleRate:44100};rt(()=>{p=getComputedStyle(document?.documentElement).getPropertyValue("--color-accent"),Z(),k.waveColor=l.props?.waveform_options?.waveform_color||"#9ca3af",k.progressColor=l.props?.waveform_options?.waveform_progress_color||p,k.mediaControls=l.props?.waveform_options?.show_controls,k.sampleRate=l.props?.waveform_options?.sample_rate||44100});const L={color:l.props?.waveform_options?.trim_region_color};function Z(){document.documentElement.style.setProperty("--trim-region-color",L.color||p)}const te=(...I)=>l.shared.client.upload(...I),B=I=>l.i18n(I),J=(...I)=>l.shared.client.stream(...I);let Q=j(()=>l.props.sources.join(",")),de=j(()=>(l.props.file_types||[]).join(",")||null);{let I=j(()=>[...l.shared.elem_classes||[],"multimodal-textbox"]),ue=j(()=>t(A)?"focus":"base");da(y,{get visible(){return l.shared.visible},get elem_id(){return l.shared.elem_id},get elem_classes(){return t(I)},get scale(){return l.shared.scale},get min_width(){return l.shared.min_width},allow_overflow:!1,padding:!1,get border_mode(){return t(ue)},get rtl(){return l.props.rtl},children:(ae,V)=>{var W=Ta(),$=xe(W);{var f=n=>{ua(n,Ft({get autoscroll(){return l.shared.autoscroll},get i18n(){return l.i18n}},()=>l.shared.loading_status,{on_clear_status:()=>l.dispatch("clear_status",l.shared.loading_status)}))};C($,n=>{l.shared.loading_status&&n(f)})}var x=q($,2);{let n=j(()=>l.shared.label||"MultimodalTextbox"),G=j(()=>l.props.max_lines?l.props.max_lines:l.props.lines+1),Y=j(()=>!l.shared.interactive);za(x,{value_is_output:!0,get file_types_string(){return t(de)},get root(){return l.shared.root},get label(){return t(n)},get info(){return l.props.info},get show_label(){return l.shared.show_label},get lines(){return l.props.lines},get rtl(){return l.props.rtl},get text_align(){return l.props.text_align},get waveform_settings(){return k},i18n:B,get max_lines(){return t(G)},get placeholder(){return l.props.placeholder},get submit_btn(){return l.props.submit_btn},get stop_btn(){return l.props.stop_btn},get autofocus(){return l.props.autofocus},get autoscroll(){return l.shared.autoscroll},get file_count(){return l.props.file_count},get sources_string(){return t(Q)},get max_file_size(){return l.shared.max_file_size},onchange:d=>{l.props.value=d,l.dispatch("change",l.props.value)},oninput:()=>l.dispatch("input"),onsubmit:()=>l.dispatch("submit"),onstop:()=>l.dispatch("stop"),onblur:()=>l.dispatch("blur"),onselect:d=>l.dispatch("select",d),onfocus:()=>l.dispatch("focus"),onerror:d=>{l.dispatch("error",d)},onstop_recording:()=>l.dispatch("stop_recording"),onupload:d=>l.dispatch("upload",d),onclear:()=>l.dispatch("clear"),get disabled(){return t(Y)},upload:te,stream_handler:J,get max_plain_text_length(){return l.props.max_plain_text_length},get html_attributes(){return l.props.html_attributes},get upload_promise(){return t(o)},set upload_promise(d){s(o,d,!0)},get value(){return l.props.value},set value(d){l.props.value=d},get dragging(){return t(A)},set dragging(d){s(A,d,!0)},get active_source(){return t(T)},set active_source(d){s(T,d,!0)}})}g(ae,W)},$$slots:{default:!0}})}ze()}export{vr as BaseExample,za as BaseMultimodalTextbox,cr as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Cva5NaVy.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Cva5NaVy.js new file mode 100644 index 0000000000000000000000000000000000000000..de25e07904156d7d9c7820532321a72cc754f409 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Cva5NaVy.js @@ -0,0 +1,13 @@ +import{p as a,e as Je,i as y,k as et,f as ct,u as tt,b as Ne,g as Ue,d as vt,a as Ae,h as Et,r as Kt}from"./i18n-Dnhn5Rxr.js";import{a as h,f as Ye,R as Ze,a1 as Oe,x as fe,G as s,a2 as gt,S as Z,z as v,X as J,w as e,T as Pe,a3 as je,U as n,V as S,Y as z,t as ke,a0 as Fe,Z as $e,W as T,ad as V,a4 as Ht,ae as Ft,a6 as le,y as Mt,u as ht,a5 as Be,a7 as _t,a8 as Qt,as as mt,ak as $t,al as er,aa as wt,M as tr}from"./index-DWyDLubb.js";import{a as rr}from"./actions-CLThs9VH.js";import{u as yt,S as ar,a as nr,G as lr}from"./utils.svelte-CCyS_0CY.js";import{b as or}from"./input-DrerMDOL.js";import{I as st}from"./Image-CeW7PJs4.js";import{I as Ie,c as Ke}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";/* empty css */import{C as zt}from"./Check-DUAHzS2-.js";import{C as Zt}from"./Copy-ChCbTvli.js";import{C as ir}from"./Clear-BF6j078A.js";import{D as sr}from"./Download-Di2PsS6O.js";import{E as ur}from"./Edit-D-unDhOb.js";import{U as _r}from"./Undo-C2-jWGVL.js";import{D as dr}from"./DownloadLink-TGTaev7f.js";import{S as cr,C as vr}from"./ShareButton-wCSP7LoP.js";import{I as Pt}from"./IconButtonWrapper-D0s9l4wW.js";import{F as kt}from"./File-BHHIF0P7.js";import{b as Qe}from"./misc-vsnLZ-Y1.js";import{M as jt}from"./MarkdownCode-B8HQ3LiU.js";import{t as gr,s as fr}from"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{s as hr}from"./event-modifiers-CdEA5IGF.js";import{T as mr}from"./Trash-D2U3jAj_.js";import{M as Lt}from"./Music-BQN2qTdy.js";import{B as wr}from"./Block-J4oodUWp.js";import{B as br}from"./BlockLabel-CZd21Hkw.js";import{S as pr}from"./index-CglBvmLb.js";import"./clone-BkeCM4Nl.js";/* empty css */import"./snippet-BWgYNF9D.js";import"./html-Ih_5QVTo.js";import"./prism-python-B4lzO_Nz.js";import"./index-B_pwUImq.js";var yr=Ye('');function kr(o){var t=yr();h(o,t)}var xr=Ye('');function Cr(o){var t=xr();h(o,t)}var Hr=Ye('');function zr(o){var t=Hr();h(o,t)}var jr=Ye('');function Mr(o){var t=jr();h(o,t)}const Lr=async(o,t=1800)=>{let l=[...o],r=await bt(l);if(r.length>t&&l.length>2){const d=l[0],i=l[l.length-1];l=[d,i],r=await bt(l)}return r.length>t&&l.length>0&&(l=l.map(i=>{if(i.type==="text"){const g=Math.floor(t/l.length)-20;if(i.content.length>g)return{...i,content:i.content.substring(0,g)+"..."}}return i}),r=await bt(l)),r},bt=async o=>(await Promise.all(o.map(async l=>{if(l.role==="system")return"";let r=l.role==="user"?"😃":"🤖",d="";if(l.type==="text"){const i={audio:/|!\[.*?\]\((\/file=.*?)\)/g};d=l.content;for(let[g,_]of Object.entries(i)){let C;for(;(C=_.exec(l.content))!==null;){const A=C[1]||C[2],x=await yt(A);d=d.replace(A,x)}}}else{if(!l.content.value)return"";const i=l.content.component==="video"?l.content.value?.video.path:l.content.value,g=await yt(i);l.content.component==="audio"?d=``:l.content.component==="video"?d=g:l.content.component==="image"&&(d=``)}return`${r}: ${d}`}))).filter(l=>l!=="").join(` +`),Vr=(o,t)=>o.replace('src="/file',`src="${t}file`);function Tr(o,t){if(!o){const l=t?.path;if(l){const r=l.toLowerCase();if(r.endsWith(".glb")||r.endsWith(".gltf")||r.endsWith(".obj")||r.endsWith(".stl")||r.endsWith(".splat")||r.endsWith(".ply"))return"model3d"}return"file"}return o.includes("audio")?"audio":o.includes("video")?"video":o.includes("image")?"image":o.includes("model")?"model3d":"file"}function Ar(o){const t=Array.isArray(o.file)?o.file[0]:o.file,l=Tr(t?.mime_type,t);return{component:l,value:l==="file"?Array.isArray(o.file)?o.file:[o.file]:o.file,alt_text:o.alt_text,constructor_args:{},props:{}}}function Ir(o,t,l,r){let d;return t.type==="text"?d={role:o.role,metadata:o.metadata,content:Vr(t.text,l),type:"text",index:r,options:o.options}:t.type==="file"?d={role:o.role,metadata:o.metadata,content:Ar(t),type:"component",index:r,options:o.options}:d={role:o.role,metadata:o.metadata,content:t,type:"component",index:r,options:o.options},d}function Dr(o,t){if(o===null)return o;const l=new Map;return o.flatMap((r,d)=>{const i=r.content.map(g=>Ir(r,g,t,d));for(const g of i){const{id:_,title:C,parent_id:A}=r.metadata||{};if(A){const x=l.get(String(A));if(x){const k={...g,children:[]};return x.children.push(k),_&&C&&l.set(String(_),k),null}}if(_&&C){const x={...g,children:[]};return l.set(String(_),x),x}}return i}).filter(r=>r!==null)}function Br(o){return o.type==="component"}function dt(o,t){const l=o[o.length-1].role==="assistant",r=o[o.length-1].index;return JSON.stringify(r)===JSON.stringify(t[t.length-1].index)&&l}function Sr(o,t=!0){const l=[];let r=[],d=null;for(const i of o)if(i.role==="assistant"||i.role==="user"){if(!t){l.push([i]);continue}i.role===d?r.push(i):(r.length>0&&l.push(r),r=[i],d=i.role)}return r.length>0&&l.push(r),l}async function Er(o,t,l){for(const r of o){if(t[r]||r==="file")continue;const d=r==="dataframe"?"component":"base",{component:i}=l(r,d),g=await i;t[r]=g.default}return t}function Vt(o){if(!o)return[];let t=new Set;return o.forEach(l=>{l.type==="component"&&t.add(l.content.component)}),Array.from(t)}function xt(o,t=0){let l="";const r=" ".repeat(t);o.metadata?.title&&(l+=`${r}${t>0?"- ":""}${o.metadata.title} +`),typeof o.content=="string"&&(l+=`${r} ${o.content} +`);const d=o;return d.children?.length>0&&(l+=d.children.map(i=>xt(i,t+1)).join("")),l}function Tt(o){return Array.isArray(o)?o.map(t=>t.metadata?.title?xt(t):t.content).join(` +`):o.metadata?.title?xt(o):o.content}function pt(o){return Array.isArray(o)&&o.every(t=>typeof t.content=="string")||!Array.isArray(o)&&typeof o.content=="string"}var Fr=Ye('');function Zr(o){var t=Fr();h(o,t)}var Pr=Ye('');function Wr(o){var t=Pr();h(o,t)}var Ur=Ye('');function Or(o){var t=Ur();h(o,t)}var Rr=Ye('');function qr(o){var t=Rr();h(o,t)}var Gr=Ye('');function At(o){var t=Gr();h(o,t)}var Nr=Ye('');function It(o){var t=Nr();h(o,t)}var Jr=T(" ",1),Yr=T(''),Xr=T('
        '),Kr=T(" ",1);function Qr(o,t){Ze(t,!1);const l=je();let r=a(t,"i18n",12),d=a(t,"handle_action",12),i=a(t,"feedback_options",12),g=a(t,"selected",12,null);function _(p){g(g()===p?null:p),d()(g())}Oe(()=>s(i()),()=>{fe(l,i().filter(p=>p!=="Like"&&p!=="Dislike"))}),gt();var C={get i18n(){return r()},set i18n(p){r(p),n()},get handle_action(){return d()},set handle_action(p){d(p),n()},get feedback_options(){return i()},set feedback_options(p){i(p),n()},get selected(){return g()},set selected(p){g(p),n()}};Je();var A=Kr(),x=Z(A);{var k=p=>{var M=Jr(),m=Z(M);{var L=P=>{{let f=V(()=>g()==="Dislike"?Zr:Wr),oe=V(()=>(s(g()),s(r()),v(()=>g()==="Dislike"?"Disliked":r()("chatbot.dislike")))),b=V(()=>g()==="Dislike"?"var(--color-accent)":"var(--block-label-text-color)");Ie(P,{get Icon(){return e(f)},get label(){return e(oe)},get color(){return e(b)},onclick:()=>_("Dislike")})}};y(m,P=>{s(i()),v(()=>i().includes("Dislike"))&&P(L)})}var D=J(m,2);{var Y=P=>{{let f=V(()=>g()==="Like"?Or:qr),oe=V(()=>(s(g()),s(r()),v(()=>g()==="Like"?"Liked":r()("chatbot.like")))),b=V(()=>g()==="Like"?"var(--color-accent)":"var(--block-label-text-color)");Ie(P,{get Icon(){return e(f)},get label(){return e(oe)},get color(){return e(b)},onclick:()=>_("Like")})}};y(D,P=>{s(i()),v(()=>i().includes("Like"))&&P(Y)})}h(p,M)};y(x,p=>{s(i()),v(()=>i().includes("Like")||i().includes("Dislike"))&&p(k)})}var I=J(x,2);{var j=p=>{var M=Xr(),m=S(M);{let D=V(()=>(s(g()),e(l),s(It),s(At),v(()=>g()&&e(l).includes(g())?It:At))),Y=V(()=>(s(g()),e(l),v(()=>g()&&e(l).includes(g())?"var(--color-accent)":"var(--block-label-text-color)")));Ie(m,{get Icon(){return e(D)},label:"Feedback",get color(){return e(Y)}})}var L=J(m,2);et(L,5,()=>e(l),tt,(D,Y)=>{var P=Yr();let f;var oe=S(P,!0);z(P),ke(()=>{f=ct(P,"",f,{"font-weight":g()===e(Y)?"bold":"normal"}),Fe(oe,e(Y))}),$e("click",P,()=>{_(e(Y)),d()(g()?g():null)}),h(D,P)}),z(L),z(M),h(p,M)};y(I,p=>{e(l),v(()=>e(l).length>0)&&p(j)})}return h(o,A),Pe(C)}function $r(o,t){Ze(t,!1);const l=Ht();let r=je(!1),d=a(t,"value",12),i=a(t,"watermark",12,null),g=a(t,"i18n",12),_;function C(){fe(r,!0),_&&clearTimeout(_),_=setTimeout(()=>{fe(r,!1)},2e3)}async function A(){if("clipboard"in navigator){l("copy",{value:d()});const k=i()?`${d()} + +${i()}`:d();await navigator.clipboard.writeText(k),C()}else{const k=document.createElement("textarea"),I=i()?`${d()} + +${i()}`:d();k.value=I,k.style.position="absolute",k.style.left="-999999px",document.body.prepend(k),k.select();try{document.execCommand("copy"),C()}catch(j){console.error(j)}finally{k.remove()}}}Ft(()=>{_&&clearTimeout(_)});var x={get value(){return d()},set value(k){d(k),n()},get watermark(){return i()},set watermark(k){i(k),n()},get i18n(){return g()},set i18n(k){g(k),n()}};Je();{let k=V(()=>(e(r),s(g()),v(()=>e(r)?g()("chatbot.copied_message"):g()("chatbot.copy_message")))),I=V(()=>e(r)?zt:Zt);Ie(o,{onclick:A,get label(){return e(k)},get Icon(){return e(I)}})}return Pe(x)}var ea=T(" ",1),ta=T(" ",1),ra=T("
        ");function Dt(o,t){Ze(t,!1);const l=je(),r=je();let d=a(t,"i18n",12),i=a(t,"likeable",12),g=a(t,"feedback_options",12),_=a(t,"show_retry",12),C=a(t,"show_undo",12),A=a(t,"show_edit",12),x=a(t,"in_edit_mode",12),k=a(t,"show_copy_button",12),I=a(t,"watermark",12,null),j=a(t,"message",12),p=a(t,"position",12),M=a(t,"avatar",12),m=a(t,"generating",12),L=a(t,"current_feedback",12),D=a(t,"file",12,null),Y=a(t,"show_download_button",12,!1),P=a(t,"show_share_button",12,!1),f=a(t,"handle_action",12),oe=a(t,"layout",12),b=a(t,"dispatch",12);Oe(()=>(s(j()),Tt),()=>{fe(l,pt(j())?Tt(j()):"")}),Oe(()=>(s(k()),s(j()),pt),()=>{fe(r,k()&&j()&&pt(j()))}),gt();var F={get i18n(){return d()},set i18n(w){d(w),n()},get likeable(){return i()},set likeable(w){i(w),n()},get feedback_options(){return g()},set feedback_options(w){g(w),n()},get show_retry(){return _()},set show_retry(w){_(w),n()},get show_undo(){return C()},set show_undo(w){C(w),n()},get show_edit(){return A()},set show_edit(w){A(w),n()},get in_edit_mode(){return x()},set in_edit_mode(w){x(w),n()},get show_copy_button(){return k()},set show_copy_button(w){k(w),n()},get watermark(){return I()},set watermark(w){I(w),n()},get message(){return j()},set message(w){j(w),n()},get position(){return p()},set position(w){p(w),n()},get avatar(){return M()},set avatar(w){M(w),n()},get generating(){return m()},set generating(w){m(w),n()},get current_feedback(){return L()},set current_feedback(w){L(w),n()},get file(){return D()},set file(w){D(w),n()},get show_download_button(){return Y()},set show_download_button(w){Y(w),n()},get show_share_button(){return P()},set show_share_button(w){P(w),n()},get handle_action(){return f()},set handle_action(w){f(w),n()},get layout(){return oe()},set layout(w){oe(w),n()},get dispatch(){return b()},set dispatch(w){b(w),n()}};Je();var q=le(),K=Z(q);{var re=w=>{var _e=ra(),ae=S(_e);Pt(ae,{top_panel:!1,children:(U,X)=>{var he=le(),de=Z(he);{var Q=W=>{var ie=ea(),me=Z(ie);{let R=V(()=>(s(d()),v(()=>d()("chatbot.submit"))));Ie(me,{get label(){return e(R)},get Icon(){return zt},onclick:()=>f()("edit_submit"),get disabled(){return m()}})}var $=J(me,2);{let R=V(()=>(s(d()),v(()=>d()("chatbot.cancel"))));Ie($,{get label(){return e(R)},get Icon(){return ir},onclick:()=>f()("edit_cancel"),get disabled(){return m()}})}h(W,ie)},ne=W=>{var ie=ta(),me=Z(ie);{var $=B=>{$r(B,{get value(){return e(l)},get watermark(){return I()},get i18n(){return d()},$$events:{copy:N=>b()("copy",N.detail)}})};y(me,B=>{e(r)&&B($)})}var R=J(me,2);{var se=B=>{{let N=V(()=>(s(D()),v(()=>D().is_stream?D().url?.replace("playlist.m3u8","playlist-file"):D().url))),be=V(()=>(s(D()),v(()=>D().orig_name||D().path||"file")));dr(B,{get href(){return e(N)},get download(){return e(be)},children:(ce,u)=>{{let H=V(()=>(s(d()),v(()=>d()("common.download"))));Ie(ce,{get Icon(){return sr},get label(){return e(H)}})}},$$slots:{default:!0}})}};y(R,B=>{s(Y()),s(D()),v(()=>Y()&&D()?.url)&&B(se)})}var Ce=J(R,2);{var ze=B=>{cr(B,{get i18n(){return d()},formatter:async N=>{if(!N)return"";let be=await yt(N.url);const ce=N.mime_type||"";return ce.startsWith("audio/")?``:ce.startsWith("video/")?``:ce.startsWith("image/")?``:""},get value(){return D()},$$events:{error:N=>b()("error",N.detail),share:N=>b()("share",N.detail)}})};y(Ce,B=>{P()&&D()&&B(ze)})}var we=J(Ce,2);{var E=B=>{{let N=V(()=>(s(d()),v(()=>d()("chatbot.retry"))));Ie(B,{get Icon(){return zr},get label(){return e(N)},onclick:()=>f()("retry"),get disabled(){return m()}})}};y(we,B=>{_()&&B(E)})}var O=J(we,2);{var ee=B=>{{let N=V(()=>(s(d()),v(()=>d()("chatbot.undo"))));Ie(B,{get label(){return e(N)},get Icon(){return _r},onclick:()=>f()("undo"),get disabled(){return m()}})}};y(O,B=>{C()&&B(ee)})}var xe=J(O,2);{var ue=B=>{{let N=V(()=>(s(d()),v(()=>d()("chatbot.edit"))));Ie(B,{get label(){return e(N)},get Icon(){return ur},onclick:()=>f()("edit"),get disabled(){return m()}})}};y(xe,B=>{A()&&B(ue)})}var pe=J(xe,2);{var He=B=>{Qr(B,{get handle_action(){return f()},get feedback_options(){return g()},get selected(){return L()},get i18n(){return d()}})};y(pe,B=>{i()&&B(He)})}h(W,ie)};y(de,W=>{x()?W(Q):W(ne,!1)})}h(U,he)},$$slots:{default:!0}}),z(_e),ke(()=>Ne(_e,1,`message-buttons-${p()??""} ${oe()??""} message-buttons ${M()!==null&&"with-avatar"}`,"svelte-704d7y")),h(w,_e)};y(K,w=>{e(r),s(_()),s(C()),s(A()),s(i()),s(Y()),s(D()),s(P()),v(()=>e(r)||_()||C()||A()||i()||Y()&&D()?.url||P()&&D())&&w(re)})}return h(o,q),Pe(F)}var aa=T(''),na=T("
        ");function la(o,t){Ze(t,!1);let l=a(t,"type",12),r=a(t,"components",12),d=a(t,"value",12),i=a(t,"target",12),g=a(t,"theme_mode",12),_=a(t,"props",12),C=a(t,"i18n",12),A=a(t,"upload",12),x=a(t,"_fetch",12),k=a(t,"allow_file_downloads",12),I=a(t,"display_icon_button_wrapper_top_corner",12,!1),j=je(!1),p=je();function M(f){fe(j,f.detail),e(j)&&e(p)?e(p).requestFullscreen?.():document.fullscreenElement&&document.exitFullscreen?.()}var m={get type(){return l()},set type(f){l(f),n()},get components(){return r()},set components(f){r(f),n()},get value(){return d()},set value(f){d(f),n()},get target(){return i()},set target(f){i(f),n()},get theme_mode(){return g()},set theme_mode(f){g(f),n()},get props(){return _()},set props(f){_(f),n()},get i18n(){return C()},set i18n(f){C(f),n()},get upload(){return A()},set upload(f){A(f),n()},get _fetch(){return x()},set _fetch(f){x(f),n()},get allow_file_downloads(){return k()},set allow_file_downloads(f){k(f),n()},get display_icon_button_wrapper_top_corner(){return I()},set display_icon_button_wrapper_top_corner(f){I(f),n()}};Je();var L=le(),D=Z(L);{var Y=f=>{var oe=le(),b=Z(oe);{let F=V(()=>(s(_()),v(()=>!!_().label)));Ke(b,()=>r()[l()],(q,K)=>{K(q,Ue(_,{get value(){return d()},display_icon_button_wrapper_top_corner:!1,get show_label(){return e(F)},get i18n(){return C()},get _fetch(){return x()},allow_preview:!1,interactive:!1,mode:"minimal",fixed_height:1,$$events:{load(re){Qe.call(this,t,re)}}}))})}h(f,oe)},P=f=>{var oe=le(),b=Z(oe);{var F=K=>{var re=le(),w=Z(re);{let _e=V(()=>(s(_()),v(()=>!!_().label))),ae=V(()=>({dispatch:()=>{},i18n:C()}));Ke(w,()=>r()[l()],(U,X)=>{X(U,Ue(_,{get value(){return d()},get show_label(){return e(_e)},get i18n(){return C()},interactive:!1,get line_breaks(){return s(_()),v(()=>_().line_breaks)},wrap:!0,root:"",get gradio(){return e(ae)},get datatype(){return s(_()),v(()=>_().datatype)},get latex_delimiters(){return s(_()),v(()=>_().latex_delimiters)},get col_count(){return s(_()),v(()=>_().col_count)},get row_count(){return s(_()),v(()=>_().row_count)},$$events:{load(he){Qe.call(this,t,he)}}}))})}h(K,re)},q=K=>{var re=le(),w=Z(re);{var _e=U=>{var X=le(),he=Z(X);{let de=V(()=>(s(_()),v(()=>_().caption||"")));Ke(he,()=>r()[l()],(Q,ne)=>{ne(Q,Ue(_,{get value(){return d()},get target(){return i()},get theme_mode(){return g()},on_change:()=>{},get bokeh_version(){return s(_()),v(()=>_().bokeh_version)},get caption(){return e(de)},show_actions_button:!0,$$events:{load(W){Qe.call(this,t,W)}}}))})}h(U,X)},ae=U=>{var X=le(),he=Z(X);{var de=ne=>{var W=le(),ie=Z(W);{let me=V(()=>(s(_()),v(()=>!!_().label))),$=V(()=>(s(_()),v(()=>({..._().waveform_settings,autoplay:_().autoplay}))));Ke(ie,()=>r()[l()],(R,se)=>{se(R,Ue(_,{get value(){return d()},get show_label(){return e(me)},show_share_button:!1,get i18n(){return C()},get waveform_settings(){return e($)},show_download_button:!1,display_icon_button_wrapper_top_corner:!1,minimal:!0,$$events:{load(Ce){Qe.call(this,t,Ce)}}}))})}h(ne,W)},Q=ne=>{var W=le(),ie=Z(W);{var me=R=>{var se=le(),Ce=Z(se);{let ze=V(()=>(s(d()),v(()=>d().video||d()))),we=V(()=>(s(_()),v(()=>!!_().label)));Ke(Ce,()=>r()[l()],(E,O)=>{O(E,Ue(_,{get autoplay(){return s(_()),v(()=>_().autoplay)},get value(){return e(ze)},get show_label(){return e(we)},show_share_button:!1,get i18n(){return C()},get upload(){return A()},display_icon_button_wrapper_top_corner:!1,show_download_button:!1,$$events:{load(ee){Qe.call(this,t,ee)}},children:(ee,xe)=>{var ue=aa();h(ee,ue)},$$slots:{default:!0}}))})}h(R,se)},$=R=>{var se=le(),Ce=Z(se);{var ze=E=>{var O=na(),ee=S(O);{let xe=V(()=>(s(_()),v(()=>!!_().label)));Ke(ee,()=>r()[l()],(ue,pe)=>{pe(ue,Ue(_,{get value(){return d()},get show_label(){return e(xe)},display_icon_button_wrapper_top_corner:!1,buttons:["fullscreen"],get fullscreen(){return e(j)},show_button_background:!1,get i18n(){return C()},$$events:{fullscreen:M,load(He){Qe.call(this,t,He)}}}))})}z(O),vt(O,xe=>fe(p,xe),()=>e(p)),h(E,O)},we=E=>{var O=le(),ee=Z(O);{var xe=pe=>{var He=le(),B=Z(He);{let N=V(()=>({value:d()}));Ke(B,()=>r()[l()],(be,ce)=>{ce(be,Ue(_,{get props(){return e(N)},$$events:{load(u){Qe.call(this,t,u)}}}))})}h(pe,He)},ue=pe=>{var He=le(),B=Z(He);{var N=be=>{var ce=le(),u=Z(ce);{let H=V(()=>(s(_()),v(()=>!!_().label))),ve=V(()=>({dispatch:()=>{},i18n:C()}));Ke(u,()=>r()[l()],(Le,Ee)=>{Ee(Le,Ue(_,{get value(){return d()},get clear_color(){return s(_()),v(()=>_().clear_color)},get display_mode(){return s(_()),v(()=>_().display_mode)},get zoom_speed(){return s(_()),v(()=>_().zoom_speed)},get pan_speed(){return s(_()),v(()=>_().pan_speed)}},()=>_().camera_position!==void 0&&{camera_position:_().camera_position},{has_change_history:!0,get show_label(){return e(H)},root:"",interactive:!1,show_share_button:!1,get gradio(){return e(ve)},get i18n(){return C()},$$events:{load(Re){Qe.call(this,t,Re)}}}))})}h(be,ce)};y(B,be=>{l()==="model3d"&&be(N)},!0)}h(pe,He)};y(ee,pe=>{l()==="html"?pe(xe):pe(ue,!1)},!0)}h(E,O)};y(Ce,E=>{l()==="image"?E(ze):E(we,!1)},!0)}h(R,se)};y(ie,R=>{l()==="video"?R(me):R($,!1)},!0)}h(ne,W)};y(he,ne=>{l()==="audio"?ne(de):ne(Q,!1)},!0)}h(U,X)};y(w,U=>{l()==="plot"?U(_e):U(ae,!1)},!0)}h(K,re)};y(b,K=>{l()==="dataframe"?K(F):K(q,!1)},!0)}h(f,oe)};y(D,f=>{l()==="gallery"?f(Y):f(P,!1)})}return h(o,L),Pe(m)}var oa=T('
        '),ia=T('');function Wt(o,t){Ze(t,!1);let l=a(t,"latex_delimiters",12),r=a(t,"sanitize_html",12),d=a(t,"_fetch",12),i=a(t,"i18n",12),g=a(t,"line_breaks",12),_=a(t,"upload",12),C=a(t,"target",12),A=a(t,"theme_mode",12),x=a(t,"_components",12),k=a(t,"render_markdown",12),I=a(t,"scroll",12),j=a(t,"allow_file_downloads",12),p=a(t,"display_consecutive_in_same_bubble",12),M=a(t,"thought_index",12),m=a(t,"allow_tags",12,!1),L=a(t,"message",12);var D={get latex_delimiters(){return l()},set latex_delimiters(b){l(b),n()},get sanitize_html(){return r()},set sanitize_html(b){r(b),n()},get _fetch(){return d()},set _fetch(b){d(b),n()},get i18n(){return i()},set i18n(b){i(b),n()},get line_breaks(){return g()},set line_breaks(b){g(b),n()},get upload(){return _()},set upload(b){_(b),n()},get target(){return C()},set target(b){C(b),n()},get theme_mode(){return A()},set theme_mode(b){A(b),n()},get _components(){return x()},set _components(b){x(b),n()},get render_markdown(){return k()},set render_markdown(b){k(b),n()},get scroll(){return I()},set scroll(b){I(b),n()},get allow_file_downloads(){return j()},set allow_file_downloads(b){j(b),n()},get display_consecutive_in_same_bubble(){return p()},set display_consecutive_in_same_bubble(b){p(b),n()},get thought_index(){return M()},set thought_index(b){M(b),n()},get allow_tags(){return m()},set allow_tags(b){m(b),n()},get message(){return L()},set message(b){L(b),n()}};Je();var Y=le(),P=Z(Y);{var f=b=>{var F=oa(),q=S(F);jt(q,{get message(){return s(L()),v(()=>L().content)},get latex_delimiters(){return l()},get sanitize_html(){return r()},get render_markdown(){return k()},get line_breaks(){return g()},get onload(){return I()},get allow_tags(){return m()},get theme_mode(){return A()}}),z(F),h(b,F)},oe=b=>{var F=le(),q=Z(F);{var K=w=>{{let _e=V(()=>M()>0&&p());la(w,{get target(){return C()},get theme_mode(){return A()},get props(){return s(L()),v(()=>L().content.props)},get type(){return s(L()),v(()=>L().content.component)},get components(){return x()},get value(){return s(L()),v(()=>L().content.value)},get display_icon_button_wrapper_top_corner(){return e(_e)},get i18n(){return i()},get upload(){return _()},get _fetch(){return d()},get allow_file_downloads(){return j()},$$events:{load:()=>I()()}})}},re=w=>{var _e=le(),ae=Z(_e);{var U=X=>{var he=le(),de=Z(he);et(de,1,()=>(s(L()),v(()=>L().content.value)),tt,(Q,ne)=>{const W=V(()=>e(ne));var ie=ia(),me=S(ie),$=S(me);kt($),z(me);var R=J(me,2),se=S(R),Ce=S(se),ze=S(Ce,!0);z(Ce),z(se);var we=J(se,2),E=S(we,!0);z(we),z(R),z(ie),ke((O,ee,xe)=>{Ae(se,"href",(s(e(W)),v(()=>e(W).url))),Ae(se,"download",O),Fe(ze,ee),Fe(E,xe)},[()=>(s(e(W)),v(()=>window.__is_colab__?null:e(W)?.orig_name||e(W)?.path.split("/").pop()||"file")),()=>(s(e(W)),v(()=>e(W)?.orig_name||e(W)?.path.split("/").pop()||"file")),()=>(s(e(W)),v(()=>(e(W).orig_name||e(W).path||"").split(".").pop().toUpperCase()))]),h(Q,ie)}),h(X,he)};y(ae,X=>{s(L()),v(()=>L().type==="component"&&L().content.component==="file")&&X(U)},!0)}h(w,_e)};y(q,w=>{s(L()),s(x()),v(()=>L().type==="component"&&L().content.component in x())?w(K):w(re,!1)},!0)}h(b,F)};y(P,b=>{s(L()),v(()=>L().type==="text")?b(f):b(oe,!1)})}return h(o,Y),Pe(D)}var sa=T(''),ua=T("()",1),_a=T(' '),da=T('
        '),ca=T("
        "),va=T('
        ');function Ut(o,t){Ze(t,!0);function l(F){return"children"in F}let r=ht(!1),d,i=ht(!1),g=Be(()=>({...t.thought,children:l(t.thought)?t.thought.children:[]})),_=ht(!1);Mt(()=>{e(r)||fe(_,e(g)?.metadata?.status!=="done")});function C(){fe(_,!e(_)),fe(r,!0)}function A(){d&&!e(i)&&(d.scrollTop=d.scrollHeight)}function x(){d&&(d.scrollHeight-d.scrollTop<=d.clientHeight+10||fe(i,!0))}Mt(()=>{e(g).content&&e(g).metadata?.status!=="done"&&setTimeout(A,0)});var k=va(),I=S(k);let j;var p=S(I);let M;var m=S(p);Ie(m,{get Icon(){return Cr}}),z(p);var L=J(p,2);{let F=Be(()=>e(g).metadata?.title||""),q=Be(()=>t.allow_tags||!1);jt(L,{get message(){return e(F)},get render_markdown(){return t.render_markdown},get latex_delimiters(){return t.latex_delimiters},get sanitize_html(){return t.sanitize_html},get allow_tags(){return e(q)}})}var D=J(L,2);{var Y=F=>{var q=sa();h(F,q)};y(D,F=>{e(g).metadata?.status==="pending"&&F(Y)})}var P=J(D,2);{var f=F=>{var q=_a(),K=S(q);{var re=ae=>{var U=_t();ke(()=>Fe(U,e(g).metadata.log)),h(ae,U)};y(K,ae=>{e(g).metadata.log&&ae(re)})}var w=J(K,2);{var _e=ae=>{var U=ua(),X=J(Z(U));{var he=Q=>{var ne=_t();ke(()=>Fe(ne,`${e(g).metadata.duration??""}s`)),h(Q,ne)},de=Q=>{var ne=le(),W=Z(ne);{var ie=$=>{var R=_t();ke(se=>Fe(R,`${se??""}s`),[()=>e(g).metadata.duration.toFixed(1)]),h($,R)},me=$=>{var R=_t();ke(se=>Fe(R,`${se??""}ms`),[()=>(e(g).metadata.duration*1e3).toFixed(1)]),h($,R)};y(W,$=>{e(g).metadata.duration>=.1?$(ie):$(me,!1)},!0)}h(Q,ne)};y(X,Q=>{Number.isInteger(e(g).metadata.duration)?Q(he):Q(de,!1)})}Qt(),h(ae,U)};y(w,ae=>{e(g).metadata.duration!==void 0&&ae(_e)})}z(q),h(F,q)};y(P,F=>{(e(g)?.metadata?.log||e(g)?.metadata?.duration)&&F(f)})}z(I);var oe=J(I,2);{var b=F=>{var q=ca();let K;var re=S(q);Wt(re,{get message(){return e(g)},get sanitize_html(){return t.sanitize_html},get allow_tags(){return t.allow_tags},get latex_delimiters(){return t.latex_delimiters},get render_markdown(){return t.render_markdown},get _components(){return t._components},get upload(){return t.upload},get thought_index(){return t.thought_index},get target(){return t.target},get theme_mode(){return t.theme_mode},get _fetch(){return t._fetch},get scroll(){return t.scroll},get allow_file_downloads(){return t.allow_file_downloads},get display_consecutive_in_same_bubble(){return t.display_consecutive_in_same_bubble},get i18n(){return t.i18n},get line_breaks(){return t.line_breaks}});var w=J(re,2);{var _e=ae=>{var U=da();et(U,21,()=>e(g).children,tt,(X,he)=>{var de=le(),Q=Z(de);{let ne=Be(()=>t.rtl||!1),W=Be(()=>t.thought_index+1);Ut(Q,{get thought(){return e(he)},get rtc(){return e(ne)},get sanitize_html(){return t.sanitize_html},get latex_delimiters(){return t.latex_delimiters},get render_markdown(){return t.render_markdown},get _components(){return t._components},get upload(){return t.upload},get thought_index(){return e(W)},get target(){return t.target},get theme_mode(){return t.theme_mode},get _fetch(){return t._fetch},get scroll(){return t.scroll},get allow_file_downloads(){return t.allow_file_downloads},get display_consecutive_in_same_bubble(){return t.display_consecutive_in_same_bubble},get i18n(){return t.i18n},get line_breaks(){return t.line_breaks}})}h(X,de)}),z(U),h(ae,U)};y(w,ae=>{e(g).children?.length>0&&ae(_e)})}z(q),vt(q,ae=>d=ae,()=>d),ke(()=>K=Ne(q,1,"svelte-18cn3o3",null,K,{content:e(_),"content-preview":!e(_)&&e(g).metadata?.status!=="done"})),$e("scroll",q,x),gr(3,q,()=>fr),h(F,q)};y(oe,F=>{e(_)&&F(b)})}z(k),ke(()=>{j=Ne(I,1,"title svelte-18cn3o3",null,j,{expanded:e(_)}),Ae(I,"aria-busy",e(g).content===""||e(g).content===null),M=ct(p,"",M,{transform:e(_)?"rotate(180deg)":"rotate(0deg)"})}),$e("click",I,hr(C)),$e("keydown",I,F=>F.key==="Enter"&&C()),h(o,k),Pe()}var ga=T('
        '),fa=T(''),ha=T("
        "),ma=T("
        ",1),wa=T("
        ",1);function ba(o,t){Ze(t,!1);let l=a(t,"value",12),r=a(t,"avatar_img",12),d=a(t,"opposite_avatar_img",12,null),i=a(t,"role",12,"user"),g=a(t,"messages",28,()=>[]),_=a(t,"layout",12),C=a(t,"render_markdown",12),A=a(t,"latex_delimiters",12),x=a(t,"sanitize_html",12),k=a(t,"selectable",12),I=a(t,"_fetch",12),j=a(t,"rtl",12),p=a(t,"dispatch",12),M=a(t,"i18n",12),m=a(t,"line_breaks",12),L=a(t,"upload",12),D=a(t,"target",12),Y=a(t,"theme_mode",12),P=a(t,"_components",12),f=a(t,"i",12),oe=a(t,"show_copy_button",12),b=a(t,"generating",12),F=a(t,"feedback_options",12),q=a(t,"show_like",12),K=a(t,"show_edit",12),re=a(t,"show_retry",12),w=a(t,"show_undo",12),_e=a(t,"handle_action",12),ae=a(t,"scroll",12),U=a(t,"allow_file_downloads",12),X=a(t,"in_edit_mode",12),he=a(t,"edit_messages",12),de=a(t,"display_consecutive_in_same_bubble",12),Q=a(t,"current_feedback",12,null),ne=a(t,"allow_tags",12,!1),W=a(t,"watermark",12,null),ie=je([]),me=je(Array(g().length).fill(160)),$=je(Array(g().length).fill(0));function R(u,H){p()("select",{index:H.index,value:H.content})}function se(u){return u.type==="text"?u.content:u.type==="component"&&u.content.component==="file"?Array.isArray(u.content.value)?`file of extension type: ${u.content.value[0].orig_name?.split(".").pop()}`:`file of extension type: ${u.content.value?.orig_name?.split(".").pop()}`+(u.content.value?.orig_name??""):`a component of type ${u.content.component??"unknown"}`}function Ce(u){for(const H of u)if(H.type==="component"&&(H.content.component==="audio"||H.content.component==="video"||H.content.component==="image"||H.content.component==="file")&&H.content.value)return H.content.value;return null}let ze=je();Oe(()=>(s(X()),e(ie),s(g())),()=>{if(X()){const u=e(ie).length-g().length;for(let H=u;H=0&&(mt(me,e(me)[H-u]=e(ie)[H]?.clientWidth),mt($,e($)[H-u]=e(ie)[H]?.clientHeight))}}),Oe(()=>(s(_e()),s(q()),s(F()),s(re()),s(w()),s(K()),s(X()),s(b()),s(oe()),s(g()),s(i()),s(r()),s(_()),s(p()),s(Q()),s(W()),s(U())),()=>{fe(ze,{handle_action:_e(),likeable:q(),feedback_options:F(),show_retry:re(),show_undo:w(),show_edit:K(),in_edit_mode:X(),generating:b(),show_copy_button:oe(),message:g(),position:i()==="user"?"right":"left",avatar:r(),layout:_(),dispatch:p(),current_feedback:Q(),watermark:W(),file:Ce(g()),show_download_button:U(),show_share_button:!0})}),gt();var we={get value(){return l()},set value(u){l(u),n()},get avatar_img(){return r()},set avatar_img(u){r(u),n()},get opposite_avatar_img(){return d()},set opposite_avatar_img(u){d(u),n()},get role(){return i()},set role(u){i(u),n()},get messages(){return g()},set messages(u){g(u),n()},get layout(){return _()},set layout(u){_(u),n()},get render_markdown(){return C()},set render_markdown(u){C(u),n()},get latex_delimiters(){return A()},set latex_delimiters(u){A(u),n()},get sanitize_html(){return x()},set sanitize_html(u){x(u),n()},get selectable(){return k()},set selectable(u){k(u),n()},get _fetch(){return I()},set _fetch(u){I(u),n()},get rtl(){return j()},set rtl(u){j(u),n()},get dispatch(){return p()},set dispatch(u){p(u),n()},get i18n(){return M()},set i18n(u){M(u),n()},get line_breaks(){return m()},set line_breaks(u){m(u),n()},get upload(){return L()},set upload(u){L(u),n()},get target(){return D()},set target(u){D(u),n()},get theme_mode(){return Y()},set theme_mode(u){Y(u),n()},get _components(){return P()},set _components(u){P(u),n()},get i(){return f()},set i(u){f(u),n()},get show_copy_button(){return oe()},set show_copy_button(u){oe(u),n()},get generating(){return b()},set generating(u){b(u),n()},get feedback_options(){return F()},set feedback_options(u){F(u),n()},get show_like(){return q()},set show_like(u){q(u),n()},get show_edit(){return K()},set show_edit(u){K(u),n()},get show_retry(){return re()},set show_retry(u){re(u),n()},get show_undo(){return w()},set show_undo(u){w(u),n()},get handle_action(){return _e()},set handle_action(u){_e(u),n()},get scroll(){return ae()},set scroll(u){ae(u),n()},get allow_file_downloads(){return U()},set allow_file_downloads(u){U(u),n()},get in_edit_mode(){return X()},set in_edit_mode(u){X(u),n()},get edit_messages(){return he()},set edit_messages(u){he(u),n()},get display_consecutive_in_same_bubble(){return de()},set display_consecutive_in_same_bubble(u){de(u),n()},get current_feedback(){return Q()},set current_feedback(u){Q(u),n()},get allow_tags(){return ne()},set allow_tags(u){ne(u),n()},get watermark(){return W()},set watermark(u){W(u),n()}};Je();var E=wa(),O=Z(E);let ee;var xe=S(O);{var ue=u=>{var H=ga(),ve=S(H);{let Le=V(()=>(s(r()),v(()=>r()?.url)));st(ve,{class:"avatar-image",get src(){return e(Le)},get alt(){return`${i()??""} avatar`}})}z(H),h(u,H)};y(xe,u=>{r()!==null&&u(ue)})}var pe=J(xe,2);let He;var B=S(pe);let N;et(B,5,g,tt,(u,H,ve)=>{var Le=ma(),Ee=Z(Le);let Re;var De=S(Ee);{var Xe=ge=>{var te=fa();$t(te),er(te,!0);let Me;ke(()=>Me=ct(te,"",Me,{width:(e(me),v(()=>`max(${e(me)[ve]}px, 160px)`)),"min-height":(e($),v(()=>`${e($)[ve]}px`))})),or(te,()=>he()[ve],qe=>he(he()[ve]=qe,!0)),h(ge,te)},ot=ge=>{var te=ha();let Me,qe;var Te=S(te);{var ye=G=>{Ut(G,{get thought(){return e(H)},get rtl(){return j()},get sanitize_html(){return x()},get allow_tags(){return ne()},get latex_delimiters(){return A()},get render_markdown(){return C()},get _components(){return P()},get upload(){return L()},thought_index:ve,get target(){return D()},get theme_mode(){return Y()},get _fetch(){return I()},get scroll(){return ae()},get allow_file_downloads(){return U()},get display_consecutive_in_same_bubble(){return de()},get i18n(){return M()},get line_breaks(){return m()}})},We=G=>{Wt(G,{get message(){return e(H)},get sanitize_html(){return x()},get allow_tags(){return ne()},get latex_delimiters(){return A()},get render_markdown(){return C()},get _components(){return P()},get upload(){return L()},thought_index:ve,get target(){return D()},get theme_mode(){return Y()},get _fetch(){return I()},get scroll(){return ae()},get allow_file_downloads(){return U()},get display_consecutive_in_same_bubble(){return de()},get i18n(){return M()},get line_breaks(){return m()}})};y(Te,G=>{e(H),v(()=>e(H)?.metadata?.title)?G(ye):G(We,!1)})}z(te),vt(te,(G,Se)=>mt(ie,e(ie)[Se]=G),G=>e(ie)?.[G],()=>[ve]),ke(G=>{Ae(te,"data-testid",i()),Ae(te,"dir",j()?"rtl":"ltr"),Ae(te,"aria-label",G),Me=Ne(te,1,"svelte-1nr59td",null,Me,{latest:f()===l().length-1,"message-markdown-disabled":!C(),selectable:k()}),qe=ct(te,"",qe,{"user-select":"text",cursor:k()?"pointer":"auto","text-align":j()?"right":"left"}),te.dir=te.dir},[()=>(s(i()),e(H),v(()=>i()+"'s message: "+se(e(H))))]),$e("click",te,()=>R(f(),e(H))),$e("keydown",te,G=>{G.key==="Enter"&&R(f(),e(H))}),h(ge,te)};y(De,ge=>{s(X()),e(H),v(()=>X()&&e(H).type==="text")?ge(Xe):ge(ot,!1)})}z(Ee);var c=J(Ee,2);{var Ve=ge=>{Dt(ge,Ue(()=>e(ze),{get current_feedback(){return Q()},get watermark(){return W()},get i18n(){return M()},$$events:{copy:te=>p()("copy",te.detail)}}))};y(c,ge=>{_()==="panel"&&ge(Ve)})}ke(ge=>Re=Ne(Ee,1,`message ${(de()?"":i())??""}`,"svelte-1nr59td",Re,ge),[()=>({"panel-full-width":!0,"message-markdown-disabled":!C(),component:e(H).type==="component",html:Br(e(H))&&e(H).content.component==="html",thought:ve>0})]),h(u,Le)}),z(B),z(pe),z(O);var be=J(O,2);{var ce=u=>{Dt(u,Ue(()=>e(ze),{get i18n(){return M()}}))};y(be,u=>{_()==="bubble"&&u(ce)})}return ke(()=>{ee=Ne(O,1,`message-row ${_()??""} ${i()??""}-row`,"svelte-1nr59td",ee,{with_avatar:r()!==null,with_opposite_avatar:d()!==null}),He=Ne(pe,1,"flex-wrap svelte-1nr59td",null,He,{role:i(),"component-wrap":g()[0].type==="component"}),N=Ne(B,1,Et(de()?i():""),"svelte-1nr59td",N,{message:de()})}),h(o,E),Pe(we)}var Bt=Object.prototype.hasOwnProperty;function Ct(o,t){var l,r;if(o===t)return!0;if(o&&t&&(l=o.constructor)===t.constructor){if(l===Date)return o.getTime()===t.getTime();if(l===RegExp)return o.toString()===t.toString();if(l===Array){if((r=o.length)===t.length)for(;r--&&Ct(o[r],t[r]););return r===-1}if(!l||typeof o=="object"){r=0;for(l in o)if(Bt.call(o,l)&&++r&&!Bt.call(t,l)||!(l in t)||!Ct(o[l],t[l]))return!1;return Object.keys(t).length===r}}return o!==o&&t!==t}var pa=T('
        '),ya=T('
        Loading content
        ');function St(o,t){Ze(t,!1);let l=a(t,"layout",12,"bubble"),r=a(t,"avatar_images",28,()=>[null,null]);var d={get layout(){return l()},set layout(x){l(x),n()},get avatar_images(){return r()},set avatar_images(x){r(x),n()}};Je();var i=ya(),g=S(i);{var _=x=>{var k=pa(),I=S(k);st(I,{class:"avatar-image",get src(){return s(r()),v(()=>r()[1].url)},alt:"bot avatar"}),z(k),h(x,k)};y(g,x=>{s(r()),v(()=>r()[1]!==null)&&x(_)})}var C=J(g,2);let A;return z(i),ke(()=>A=Ne(C,1,`message bot pending ${l()??""}`,"svelte-stpvyx",A,{with_avatar:r()[1]!==null,with_opposite_avatar:r()[0]!==null})),h(o,i),Pe(d)}var ka=T('
        '),xa=T('
        '),Ca=T(''),Ha=T('
        '),za=T('
        '),ja=T('
        '),Ma=T('
        ',2),La=T('
        '),Va=T('
        '),Ta=T('
        '),Aa=T('
        '),Ia=T('
        ',2),Da=T('
        '),Ba=T('
        '),Sa=T(''),Ea=T('
        '),Fa=T('');function Za(o,t){Ze(t,!1);let l=a(t,"examples",12,null),r=a(t,"placeholder",12,null),d=a(t,"latex_delimiters",12);const i=Ht();function g(j,p){const M=typeof p=="string"?{text:p}:p;i("example_select",{index:j,value:{text:M.text,files:M.files}})}var _={get examples(){return l()},set examples(j){l(j),n()},get placeholder(){return r()},set placeholder(j){r(j),n()},get latex_delimiters(){return d()},set latex_delimiters(j){d(j),n()}};Je();var C=Fa(),A=S(C);{var x=j=>{var p=ka(),M=S(p);jt(M,{get message(){return r()},get latex_delimiters(){return d()}}),z(p),h(j,p)};y(A,j=>{r()!==null&&j(x)})}var k=J(A,2);{var I=j=>{var p=Ea();et(p,5,l,tt,(M,m,L)=>{var D=Sa(),Y=S(D),P=S(Y);{var f=K=>{var re=xa(),w=S(re);st(w,{class:"example-image",get src(){return e(m),v(()=>e(m).icon.url)},alt:"Example icon"}),z(re),h(K,re)},oe=K=>{var re=le(),w=Z(re);{var _e=U=>{var X=Ca();h(U,X)},ae=U=>{var X=le(),he=Z(X);{var de=Q=>{var ne=le(),W=Z(ne);{var ie=$=>{var R=Ta(),se=S(R);et(se,1,()=>(e(m),v(()=>e(m).files.slice(0,4))),tt,(we,E,O,ee)=>{var xe=le(),ue=Z(xe);{var pe=B=>{var N=za(),be=S(N);{let H=V(()=>(e(E),v(()=>e(E).orig_name||`Example image ${O+1}`)));st(be,{class:"example-image",get src(){return e(E),v(()=>e(E).url)},get alt(){return e(H)}})}var ce=J(be,2);{var u=H=>{var ve=Ha(),Le=S(ve);z(ve),ke(()=>{Ae(ve,"aria-label",(e(m),v(()=>`${e(m).files.length-4} more files`))),Fe(Le,`+${e(m),v(()=>e(m).files.length-4)??""}`)}),h(H,ve)};y(ce,H=>{e(m),v(()=>O===3&&e(m).files.length>4)&&H(u)})}z(N),h(B,N)},He=B=>{var N=le(),be=Z(N);{var ce=H=>{var ve=Ma(),Le=S(ve),Ee=J(Le,2);{var Re=De=>{var Xe=ja(),ot=S(Xe);z(Xe),ke(()=>{Ae(Xe,"aria-label",(e(m),v(()=>`${e(m).files.length-4} more files`))),Fe(ot,`+${e(m),v(()=>e(m).files.length-4)??""}`)}),h(De,Xe)};y(Ee,De=>{e(m),v(()=>O===3&&e(m).files.length>4)&&De(Re)})}z(ve),ke(()=>Ae(Le,"src",(e(E),v(()=>e(E).url)))),h(H,ve)},u=H=>{var ve=La(),Le=S(ve);{var Ee=De=>{Lt(De)},Re=De=>{kt(De)};y(Le,De=>{e(E),v(()=>e(E).mime_type?.includes("audio"))?De(Ee):De(Re,!1)})}z(ve),ke(()=>Ae(ve,"aria-label",(e(E),v(()=>`File: ${e(E).orig_name}`)))),h(H,ve)};y(be,H=>{e(E),v(()=>e(E).mime_type?.includes("video"))?H(ce):H(u,!1)},!0)}h(B,N)};y(ue,B=>{e(E),v(()=>e(E).mime_type?.includes("image"))?B(pe):B(He,!1)})}h(we,xe)});var Ce=J(se,2);{var ze=we=>{var E=Va(),O=S(E),ee=S(O);z(O),z(E),ke(()=>{Ae(O,"aria-label",(e(m),v(()=>`${e(m).files.length-4} more files`))),Fe(ee,`+${e(m),v(()=>e(m).files.length-4)??""}`)}),h(we,E)};y(Ce,we=>{e(m),v(()=>e(m).files.length>4)&&we(ze)})}z(R),h($,R)},me=$=>{var R=le(),se=Z(R);{var Ce=we=>{var E=Aa(),O=S(E);{let ee=V(()=>(e(m),v(()=>e(m).files[0].orig_name||"Example image")));st(O,{class:"example-image",get src(){return e(m),v(()=>e(m).files[0].url)},get alt(){return e(ee)}})}z(E),h(we,E)},ze=we=>{var E=le(),O=Z(E);{var ee=ue=>{var pe=Ia(),He=S(pe);z(pe),ke(()=>Ae(He,"src",(e(m),v(()=>e(m).files[0].url)))),h(ue,pe)},xe=ue=>{var pe=le(),He=Z(pe);{var B=be=>{var ce=Da(),u=S(ce);Lt(u),z(ce),ke(()=>Ae(ce,"aria-label",(e(m),v(()=>`File: ${e(m).files[0].orig_name}`)))),h(be,ce)},N=be=>{var ce=Ba(),u=S(ce);kt(u),z(ce),ke(()=>Ae(ce,"aria-label",(e(m),v(()=>`File: ${e(m).files[0].orig_name}`)))),h(be,ce)};y(He,be=>{e(m),v(()=>e(m).files[0].mime_type?.includes("audio"))?be(B):be(N,!1)},!0)}h(ue,pe)};y(O,ue=>{e(m),v(()=>e(m).files[0].mime_type?.includes("video"))?ue(ee):ue(xe,!1)},!0)}h(we,E)};y(se,we=>{e(m),v(()=>e(m).files[0].mime_type?.includes("image"))?we(Ce):we(ze,!1)},!0)}h($,R)};y(W,$=>{e(m),v(()=>e(m).files.length>1)?$(ie):$(me,!1)})}h(Q,ne)};y(he,Q=>{e(m),v(()=>e(m).files!==void 0&&e(m).files.length>0)&&Q(de)},!0)}h(U,X)};y(w,U=>{e(m),v(()=>e(m)?.icon?.mime_type==="text")?U(_e):U(ae,!1)},!0)}h(K,re)};y(P,K=>{e(m),v(()=>e(m)?.icon?.url)?K(f):K(oe,!1)})}var b=J(P,2),F=S(b),q=S(F,!0);z(F),z(b),z(Y),z(D),ke(()=>{Ae(D,"aria-label",(e(m),v(()=>`Select example ${L+1}: ${e(m).display_text||e(m).text}`))),Fe(q,(e(m),v(()=>e(m).display_text||e(m).text)))}),$e("click",D,()=>g(L,typeof e(m)=="string"?{text:e(m)}:e(m))),h(M,D)}),z(p),h(j,p)};y(k,j=>{l()!==null&&j(I)})}return z(C),h(o,C),Pe(_)}function Pa(o,t){Ze(t,!1);let l=je(!1),r=a(t,"value",12),d=a(t,"watermark",12,null),i;function g(){fe(l,!0),i&&clearTimeout(i),i=setTimeout(()=>{fe(l,!1)},1e3)}const _=()=>{if(r()){const x=r().map(I=>I.type==="text"?`${I.role}: ${I.content}`:`${I.role}: ${I.content.value.url}`).join(` + +`),k=d()?`${x} + +${d()}`:x;navigator.clipboard.writeText(k).catch(I=>{console.error("Failed to copy conversation: ",I)})}};async function C(){"clipboard"in navigator&&(_(),g())}Ft(()=>{i&&clearTimeout(i)});var A={get value(){return r()},set value(x){r(x),n()},get watermark(){return d()},set watermark(x){d(x),n()}};Je();{let x=V(()=>e(l)?zt:Zt),k=V(()=>e(l)?"Copied conversation":"Copy conversation");Ie(o,{get Icon(){return e(x)},onclick:C,get label(){return e(k)}})}return Pe(A)}var Wa=T(" ",1),Ua=T(" ",1),Oa=T(''),Ra=T('
        '),qa=T('
        '),Ga=T('
        '),Na=T('
        ',1);function Ja(o,t){Ze(t,!1);const l=je(),r=je(),d=je();let i=a(t,"value",28,()=>[]),g=je(null),_=a(t,"_fetch",12),C=a(t,"load_component",12),A=a(t,"allow_file_downloads",12),x=a(t,"display_consecutive_in_same_bubble",12),k=je({});const I=typeof window<"u";async function j(){fe(k,await Er(Vt(i()),e(k),C()))}let p=a(t,"latex_delimiters",12),M=a(t,"pending_message",12,!1),m=a(t,"generating",12,!1),L=a(t,"selectable",12,!1),D=a(t,"likeable",12,!1),Y=a(t,"feedback_options",12),P=a(t,"feedback_value",12,null),f=a(t,"editable",12,null),oe=a(t,"show_share_button",12,!1),b=a(t,"show_copy_all_button",12,!1),F=a(t,"rtl",12,!1),q=a(t,"show_copy_button",12,!1),K=a(t,"buttons",12,null),re=a(t,"on_custom_button_click",12,null),w=a(t,"avatar_images",28,()=>[null,null]),_e=a(t,"sanitize_html",12,!0),ae=a(t,"render_markdown",12,!0),U=a(t,"line_breaks",12,!0),X=a(t,"autoscroll",12,!0),he=a(t,"theme_mode",12),de=a(t,"i18n",12),Q=a(t,"layout",12,"bubble"),ne=a(t,"placeholder",12,null),W=a(t,"upload",12),ie=a(t,"examples",12,null),me=a(t,"_retryable",12,!1),$=a(t,"_undoable",12,!1),R=a(t,"like_user_message",12,!1),se=a(t,"allow_tags",12,!1),Ce=a(t,"watermark",12,null),ze=a(t,"show_progress",12,"full"),we=je(null),E=je(null),O=je([]);wt(()=>{fe(we,document.querySelector("div.gradio-container"))});let ee=je(),xe=je(!1);const ue=Ht();function pe(){return e(ee)&&e(ee).offsetHeight+e(ee).scrollTop>e(ee).scrollHeight-100}function He(){e(ee)&&(e(ee).scrollTo(0,e(ee).scrollHeight),fe(xe,!1))}async function B(){X()&&pe()&&(await tr(),await new Promise(c=>setTimeout(c,300)),He())}wt(()=>{X()&&He(),B()}),wt(()=>{function c(){pe()?fe(xe,!1):fe(xe,!0)}return e(ee)?.addEventListener("scroll",c),()=>{e(ee)?.removeEventListener("scroll",c)}});function N(c,Ve,ge){if(ge==="undo"||ge==="retry"){const te=i();let Me=te.length-1;for(;te[Me].role==="assistant";)Me--;ue(ge,{index:te[Me].index,value:te[Me].content})}else if(ge=="edit")fe(E,c),e(O).push(Ve.content);else if(ge=="edit_cancel")fe(E,null);else if(ge=="edit_submit")fe(E,null),ue("edit",{index:Ve.index,_dispatch_value:[{type:"text",text:e(O)[c].slice()}],value:e(O)[c].slice(),previous_value:Ve.content});else{let te=ge==="Like"?!0:ge==="Dislike"?!1:ge||"";if(!e(r))return;const Me=e(r)[c],[qe]=[Me[0],Me[Me.length-1]];ue("like",{index:qe.index,value:Me.map(Te=>Te.content),liked:te})}}function be(){if(!i()||!e(r)||e(r).length===0)return;const c=e(r)[e(r).length-1];if(c[0].role==="assistant")return c[c.length-1].options}Oe(()=>s(i()),()=>{fe(l,Vt(i()).sort().join(", "))}),Oe(()=>e(l),()=>{e(l),j()}),Oe(()=>(s(i()),s(M()),e(k)),()=>{(i()||M()||e(k))&&B()}),Oe(()=>(s(i()),e(g)),()=>{Ct(i(),e(g))||(fe(g,i()),ue("change"))}),Oe(()=>(s(i()),s(x())),()=>{fe(r,i()&&Sr(i(),x()))}),Oe(()=>s(i()),()=>{fe(d,i()&&be())}),gt();var ce={get value(){return i()},set value(c){i(c),n()},get _fetch(){return _()},set _fetch(c){_(c),n()},get load_component(){return C()},set load_component(c){C(c),n()},get allow_file_downloads(){return A()},set allow_file_downloads(c){A(c),n()},get display_consecutive_in_same_bubble(){return x()},set display_consecutive_in_same_bubble(c){x(c),n()},get latex_delimiters(){return p()},set latex_delimiters(c){p(c),n()},get pending_message(){return M()},set pending_message(c){M(c),n()},get generating(){return m()},set generating(c){m(c),n()},get selectable(){return L()},set selectable(c){L(c),n()},get likeable(){return D()},set likeable(c){D(c),n()},get feedback_options(){return Y()},set feedback_options(c){Y(c),n()},get feedback_value(){return P()},set feedback_value(c){P(c),n()},get editable(){return f()},set editable(c){f(c),n()},get show_share_button(){return oe()},set show_share_button(c){oe(c),n()},get show_copy_all_button(){return b()},set show_copy_all_button(c){b(c),n()},get rtl(){return F()},set rtl(c){F(c),n()},get show_copy_button(){return q()},set show_copy_button(c){q(c),n()},get buttons(){return K()},set buttons(c){K(c),n()},get on_custom_button_click(){return re()},set on_custom_button_click(c){re(c),n()},get avatar_images(){return w()},set avatar_images(c){w(c),n()},get sanitize_html(){return _e()},set sanitize_html(c){_e(c),n()},get render_markdown(){return ae()},set render_markdown(c){ae(c),n()},get line_breaks(){return U()},set line_breaks(c){U(c),n()},get autoscroll(){return X()},set autoscroll(c){X(c),n()},get theme_mode(){return he()},set theme_mode(c){he(c),n()},get i18n(){return de()},set i18n(c){de(c),n()},get layout(){return Q()},set layout(c){Q(c),n()},get placeholder(){return ne()},set placeholder(c){ne(c),n()},get upload(){return W()},set upload(c){W(c),n()},get examples(){return ie()},set examples(c){ie(c),n()},get _retryable(){return me()},set _retryable(c){me(c),n()},get _undoable(){return $()},set _undoable(c){$(c),n()},get like_user_message(){return R()},set like_user_message(c){R(c),n()},get allow_tags(){return se()},set allow_tags(c){se(c),n()},get watermark(){return Ce()},set watermark(c){Ce(c),n()},get show_progress(){return ze()},set show_progress(c){ze(c),n()}};Je();var u=Na(),H=Z(u);{var ve=c=>{Pt(c,{get buttons(){return K()},get on_custom_button_click(){return re()},children:(Ve,ge)=>{var te=Wa(),Me=Z(te);{var qe=G=>{Ie(G,{get Icon(){return vr},onclick:async()=>{try{const Se=await Lr(i());ue("share",{description:Se})}catch(Se){console.error(Se);let rt=Se instanceof ar?Se.message:"Share failed.";ue("error",rt)}}})};y(Me,G=>{oe()&&G(qe)})}var Te=J(Me,2);{let G=V(()=>(s(de()),v(()=>de()("chatbot.clear"))));Ie(Te,{get Icon(){return mr},onclick:()=>ue("clear"),get label(){return e(G)}})}var ye=J(Te,2);{var We=G=>{Pa(G,{get value(){return i()},get watermark(){return Ce()}})};y(ye,G=>{b()&&G(We)})}h(Ve,te)},$$slots:{default:!0}})};y(H,c=>{s(i()),v(()=>i()!==null&&i().length>0)&&c(ve)})}var Le=J(H,2),Ee=S(Le);{var Re=c=>{var Ve=qa(),ge=S(Ve);et(ge,1,()=>e(r),tt,(Te,ye,We)=>{const G=V(()=>(e(ye),v(()=>e(ye)[0].role==="user"?"user":"bot"))),Se=V(()=>(s(w()),s(e(G)),v(()=>w()[e(G)==="user"?0:1]))),rt=V(()=>(s(w()),s(e(G)),v(()=>w()[e(G)==="user"?0:1]))),it=V(()=>(e(r),v(()=>e(r).slice(0,We).filter(nt=>nt[0].role==="assistant").length))),lt=V(()=>(s(e(G)),s(P()),s(e(it)),v(()=>e(G)==="bot"&&P()&&P()[e(it)]?P()[e(it)]:null)));var ut=Ua(),at=Z(ut);{let nt=V(()=>e(G)==="user"?D()&&R():D()),Rt=V(()=>(s(me()),s(dt),e(ye),s(i()),v(()=>me()&&dt(e(ye),i())))),qt=V(()=>(s($()),s(dt),e(ye),s(i()),v(()=>$()&&dt(e(ye),i())))),Gt=V(()=>(s(f()),s(e(G)),e(ye),v(()=>f()==="all"||f()=="user"&&e(G)==="user"&&e(ye).length>0&&e(ye)[e(ye).length-1].type=="text"))),Nt=V(()=>e(E)===We),Jt=V(()=>I?scroll:()=>{});ba(at,{get messages(){return e(ye)},get display_consecutive_in_same_bubble(){return x()},get opposite_avatar_img(){return e(rt)},get avatar_img(){return e(Se)},get role(){return e(G)},get layout(){return Q()},get dispatch(){return ue},get i18n(){return de()},get _fetch(){return _()},get line_breaks(){return U()},get theme_mode(){return he()},get target(){return e(we)},get upload(){return W()},get selectable(){return L()},get sanitize_html(){return _e()},get render_markdown(){return ae()},get rtl(){return F()},i:We,get value(){return i()},get latex_delimiters(){return p()},get _components(){return e(k)},get generating(){return m()},get feedback_options(){return Y()},get current_feedback(){return e(lt)},get allow_tags(){return se()},get watermark(){return Ce()},get show_like(){return e(nt)},get show_retry(){return e(Rt)},get show_undo(){return e(qt)},get show_edit(){return e(Gt)},get in_edit_mode(){return e(Nt)},get show_copy_button(){return q()},handle_action:Ge=>{Ge=="edit"&&e(O).splice(0,e(O).length),Ge==="edit"||Ge==="edit_submit"?e(ye).forEach((Yt,Xt)=>{N(Ge==="edit"?We:Xt,Yt,Ge)}):N(We,e(ye)[0],Ge)},get scroll(){return e(Jt)},get allow_file_downloads(){return A()},get edit_messages(){return e(O)},set edit_messages(Ge){fe(O,Ge)},$$events:{copy:Ge=>ue("copy",Ge.detail)},$$legacy:!0})}var ft=J(at,2);{var Ot=nt=>{St(nt,{get layout(){return Q()},get avatar_images(){return w()}})};y(ft,nt=>{s(ze()),s(m()),e(ye),v(()=>ze()!=="hidden"&&m()&&e(ye)[e(ye).length-1].role==="assistant"&&e(ye)[e(ye).length-1].metadata?.status==="done")&&nt(Ot)})}h(Te,ut)});var te=J(ge,2);{var Me=Te=>{St(Te,{get layout(){return Q()},get avatar_images(){return w()}})},qe=Te=>{var ye=le(),We=Z(ye);{var G=Se=>{var rt=Ra();et(rt,5,()=>e(d),tt,(it,lt,ut)=>{var at=Oa(),ft=S(at,!0);z(at),ke(()=>Fe(ft,(e(lt),v(()=>e(lt).label||e(lt).value)))),$e("click",at,()=>ue("option_select",{index:ut,value:e(lt).value})),h(it,at)}),z(rt),h(Se,rt)};y(We,Se=>{e(d)&&Se(G)},!0)}h(Te,ye)};y(te,Te=>{ze()!=="hidden"&&M()?Te(Me):Te(qe,!1)})}z(Ve),rr(Ve,Te=>nr?.(Te)),h(c,Ve)},De=c=>{Za(c,{get examples(){return ie()},get placeholder(){return ne()},get latex_delimiters(){return p()},$$events:{example_select:Ve=>ue("example_select",Ve.detail)}})};y(Ee,c=>{s(i()),e(r),v(()=>i()!==null&&i().length>0&&e(r)!==null)?c(Re):c(De,!1)})}z(Le),vt(Le,c=>fe(ee,c),()=>e(ee));var Xe=J(Le,2);{var ot=c=>{var Ve=Ga(),ge=S(Ve);Ie(ge,{get Icon(){return Mr},label:"Scroll down",size:"large",onclick:He}),z(Ve),h(c,Ve)};y(Xe,c=>{e(xe)&&c(ot)})}return ke(()=>Ne(Le,1,Et(Q()==="bubble"?"bubble-wrap":"panel-wrap"),"svelte-kpz1")),h(o,u),Pe(ce)}var Ya=T('
        ',1);function Vn(o,t){Ze(t,!0);let l=Kt(t,["$$slots","$$events","$$legacy"]);const r=new lr(l);let d=Be(()=>Dr(r.props.value,r.shared.root)),i=Be(()=>r.shared.loading_status.status==="error"?"full":r.shared.loading_status.show_progress==="hidden"?"hidden":"minimal");wr(o,{get elem_id(){return r.shared.elem_id},get elem_classes(){return r.shared.elem_classes},get visible(){return r.shared.visible},padding:!1,get scale(){return r.shared.scale},get min_width(){return r.shared.min_width},get height(){return r.props.height},get resizable(){return r.props.resizable},get min_height(){return r.props.min_height},get max_height(){return r.props.max_height},allow_overflow:!0,flex:!0,overflow_behavior:"auto",get rtl(){return r.props.rtl},children:(g,_)=>{var C=Ya(),A=Z(C);{var x=M=>{pr(M,Ue({get autoscroll(){return r.shared.autoscroll},get i18n(){return r.i18n}},()=>r.shared.loading_status,{get show_progress(){return e(i)},on_clear_status:()=>r.dispatch("clear_status",r.shared.loading_status)}))};y(A,M=>{r.shared.loading_status&&M(x)})}var k=J(A,2),I=S(k);{var j=M=>{{let m=Be(()=>r.shared.label||"Chatbot");br(M,{get show_label(){return r.shared.show_label},get Icon(){return kr},float:!0,get label(){return e(m)}})}};y(I,M=>{r.shared.show_label&&M(j)})}var p=J(I,2);{let M=Be(()=>(r.props.buttons??["share"]).some(f=>typeof f=="string"&&f==="share")),m=Be(()=>(r.props.buttons??["copy_all"]).some(f=>typeof f=="string"&&f==="copy_all")),L=Be(()=>r.shared.loading_status?.status==="pending"),D=Be(()=>r.shared.loading_status?.status==="generating"),Y=Be(()=>(r.props.buttons??["copy"]).some(f=>typeof f=="string"&&f==="copy")),P=Be(()=>r.shared.loading_status?.show_progress||"full");Ja(p,{get i18n(){return r.i18n},get selectable(){return r.props._selectable},get likeable(){return r.props.likeable},get feedback_options(){return r.props.feedback_options},get feedback_value(){return r.props.feedback_value},get show_share_button(){return e(M)},get show_copy_all_button(){return e(m)},get value(){return e(d)},get latex_delimiters(){return r.props.latex_delimiters},get display_consecutive_in_same_bubble(){return r.props.group_consecutive_messages},get render_markdown(){return r.props.render_markdown},get theme_mode(){return r.shared.theme_mode},get editable(){return r.props.editable},get pending_message(){return e(L)},get generating(){return e(D)},get rtl(){return r.props.rtl},get show_copy_button(){return e(Y)},get buttons(){return r.props.buttons},on_custom_button_click:f=>{r.dispatch("custom_button_click",{id:f})},get like_user_message(){return r.props.like_user_message},get show_progress(){return e(P)},get avatar_images(){return r.props.avatar_images},get sanitize_html(){return r.props.sanitize_html},get line_breaks(){return r.props.line_breaks},get autoscroll(){return r.props.autoscroll},get layout(){return r.props.layout},get placeholder(){return r.props.placeholder},get examples(){return r.props.examples},get _retryable(){return r.props._retryable},get _undoable(){return r.props._undoable},upload:(...f)=>r.shared.client.upload(...f),_fetch:(...f)=>r.shared.client.fetch(...f),get load_component(){return r.shared.load_component},get allow_file_downloads(){return r.props.allow_file_downloads},get allow_tags(){return r.props.allow_tags},get watermark(){return r.props.watermark},$$events:{change:()=>(r.props.value=r.props.value,r.dispatch("change",r.props.value)),select:f=>r.dispatch("select",f.detail),like:f=>r.dispatch("like",f.detail),share:f=>r.dispatch("share",f.detail),error:f=>r.dispatch("error",f.detail),example_select:f=>r.dispatch("example_select",f.detail),option_select:f=>r.dispatch("option_select",f.detail),retry:f=>r.dispatch("retry",f.detail),undo:f=>r.dispatch("undo",f.detail),clear:()=>{r.props.value=[],r.dispatch("clear")},copy:f=>r.dispatch("copy",f.detail),edit:f=>{r.props.value===null||r.props.value.length===0||(r.props.value[f.detail.index].content=[{text:f.detail.value,type:"text"}],r.dispatch("edit",f.detail))}}})}z(k),h(g,C)},$$slots:{default:!0}}),Pe()}export{Ja as BaseChatBot,Vn as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CvdjtBs2.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CvdjtBs2.js new file mode 100644 index 0000000000000000000000000000000000000000..87e76d2f64383401f1adc306abb689f7bed94f61 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CvdjtBs2.js @@ -0,0 +1,2 @@ +import{M as Be,p as Z,t as Ne,a as q,F as Xe,f as $,i as B,k as ie,u as ce,b as me,g as qe,r as Je}from"./i18n-Dnhn5Rxr.js";import{a as m,f as Ke,aj as Le,R as pe,v as re,u as N,al as Qe,x as u,t as ee,w as t,Z as W,T as ke,W as y,y as ze,aa as Ue,V as j,S as te,X as O,a6 as $e,a5 as G,Y as w,a0 as ue,at as et}from"./index-DWyDLubb.js";import{g as tt}from"./color-DNxsOKs1.js";import{C as Ie}from"./Clear-BF6j078A.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as rt}from"./Block-J4oodUWp.js";import{B as at}from"./BlockLabel-CZd21Hkw.js";import{E as nt}from"./Empty-BIB2W5at.js";import{G as ot}from"./utils.svelte-CCyS_0CY.js";import{I as lt}from"./IconButtonWrapper-D0s9l4wW.js";import{S as st}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./snippet-BWgYNF9D.js";import"./clone-BkeCM4Nl.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var it=Ke('');function Me(s){var r=it();m(s,r)}function Re(s,r){const e=document.createElement("canvas").getContext("2d");e.fillStyle=s,e.fillRect(0,0,1,1);const[o,b,T]=e.getImageData(0,0,1,1).data;return`rgba(${o}, ${b}, ${T}, ${r})`}function be(s){if(!s)return!0;const r=s.toLowerCase().trim();return r==="transparent"||r.length===9&&r.endsWith("00")}function ct(s,r){const h={};for(const e in s){const o=s[e].trim();o in Be?h[e]=Be[o]:be(o)?h[e]={primary:"transparent",secondary:"transparent"}:h[e]={primary:r?Re(o,1):o,secondary:r?Re(o,.5):o}}return h}function He(s,r){if(s.length===0)return[];const h=[];let e=s[0].token,o=s[0].class_or_confidence;for(let b=1;b');function Ce(s,r){pe(r,!0);let h=Z(r,"value",31,()=>re([])),e=Z(r,"label_to_edit",31,()=>-1),o=Z(r,"is_scores_mode",3,!1),b=N(re(r.category?.toString()??""));function T(){if(o()){const l=typeof r.category=="number"?r.category:parseFloat(r.category??"0");return Ve(l)}return r.category===null||r.active_legend&&r.active_legend!==r.category?"":r.color_map[r.category]?.primary??""}function R(l){const C=l.target.value.trim();h([...h().slice(0,r.label_index),{token:r.token,class_or_confidence:C===""?null:o()?Number(C):C},...h().slice(r.label_index+1)]),r.onchange()}function x(l){l.key==="Enter"&&(R(l),e(-1))}var i=ut();Ne(i),Qe(i,!0),i.__input=l=>{u(b,l.target.value,!0)},i.__keydown=x;let v;ee(l=>{q(i,"type",o()?"number":"text"),q(i,"step",o()?"0.1":void 0),q(i,"placeholder",o()?void 0:"label"),Xe(i,r.category),v=$(i,"",v,l)},[()=>({"background-color":T(),width:o()?"7ch":`${(t(b)?.length||4)+4}ch`})]),W("blur",i,R),m(s,i),ke()}Le(["input","keydown"]);var _t=y(''),dt=y('
        '),gt=y(' '),vt=y(''),ft=y(' '),ht=y(''),mt=y(" ",1),bt=y('
        ',1),pt=y('
        -1 0 +1
        '),kt=y(''),yt=y(' '),wt=y('
        ',1),xt=y('
        ');function Et(s,r){pe(r,!0);const h=typeof window<"u";let e=Z(r,"value",31,()=>re([])),o=Z(r,"show_legend",3,!1),b=Z(r,"show_inline_category",3,!0),T=Z(r,"color_map",19,()=>({})),R=Z(r,"show_whitespaces",3,!1),x=Z(r,"interactive",3,!1),i=N(-1),v=N(""),l=N(-1),A=N(null),C=N("categories"),P=N(re({}));ze(()=>{let a={...T()};for(const f of e())f.class_or_confidence!==null&&(typeof f.class_or_confidence=="string"?(u(C,"categories"),f.class_or_confidence in a||(a[f.class_or_confidence]=tt(Object.keys(a).length))):u(C,"scores"));u(P,ct(a,h),!0)}),Ue(()=>{if(!x())return;const a=()=>{u(A,window.getSelection(),!0),_e(),window.removeEventListener("mouseup",a)};window.addEventListener("mousedown",()=>{window.addEventListener("mouseup",a)})});function _e(){if(!t(A))return;const a=t(A).toString();if(!a||!R()&&!a.trim())return;const f=t(A).getRangeAt(0).startOffset,M=t(A).getRangeAt(0).endOffset;de(f,M)}function de(a,f){if(!t(A)?.toString()||t(i)===-1||!e()[t(i)].token.includes(t(A).toString()))return;const M=e()[t(i)].token,K=[{token:M.substring(0,a),class_or_confidence:null},{token:M.substring(a,f),class_or_confidence:t(C)==="scores"?1:"label"},{token:M.substring(f),class_or_confidence:null}].filter(L=>R()?L.token!=="":L.token.trim()!=="");e([...e().slice(0,t(i)),...K,...e().slice(t(i)+1)]),u(l,e().findIndex((L,E)=>E>=t(i)&&L.token===M.substring(a,f)&&L.class_or_confidence!==null),!0),d(),document.getElementById(`label-input-${t(l)}`)?.focus()}function ae(a){a<0||a>=e().length||(e(e()[a].class_or_confidence=null,!0),e(He(e())),d(),window.getSelection()?.empty())}function d(){r.onchange?.(e()),u(l,-1)}function I(a){return a===null||t(v)&&t(v)!==a?"":t(P)[a]?.secondary??""}function J(a){return a===null||t(v)&&t(v)!==a?"":t(P)[a]?.primary??""}function ye(a){const f=I(a);return be(f)?"":"black"}var ge=xt(),je=j(ge);{var Oe=a=>{var f=bt(),M=te(f);{var K=E=>{var z=dt();ie(z,21,()=>Object.entries(t(P)),ce,(c,H)=>{var n=G(()=>et(t(H),2));let F=()=>t(n)[0],Y=()=>t(n)[1];var _=_t();let X;var D=j(_,!0);w(_),ee(()=>{X=$(_,"",X,{"background-color":Y().secondary}),ue(D,F())}),W("mouseenter",_,()=>u(v,F(),!0)),W("mouseleave",_,()=>u(v,"")),W("focus",_,()=>u(v,F(),!0)),W("blur",_,()=>u(v,"")),m(c,_)}),w(z),m(E,z)};B(M,E=>{o()&&E(K)})}var L=O(M,2);ie(L,21,e,ce,(E,z,c)=>{let H=()=>t(z).token,n=()=>t(z).class_or_confidence;const F=G(()=>H().split(` +`));var Y=$e(),_=te(Y);ie(_,17,()=>t(F),ce,(X,D,Q)=>{var ne=mt(),oe=te(ne);{var ve=g=>{const S=G(()=>I(n()));var U=ft(),V=j(U);let we;V.__click=()=>{n()!==null&&(x()?(r.onselect?.({index:c,value:[H(),n()]}),u(l,c,!0)):r.onselect?.({index:c,value:[H(),n()]}))},V.__keydown=p=>{x()&&p.key==="Enter"&&n()!==null&&u(l,c,!0)};let xe;var le=j(V);let Ee;var Ae=j(le,!0);w(le);var Se=O(le,2);{var Fe=p=>{var k=gt();let se;var Ye=j(k,!0);w(k),ee(De=>{se=$(k,"",se,De),ue(Ye,n())},[()=>({"background-color":J(n())})]),m(p,k)};B(Se,p=>{!o()&&b()&&n()!==null&&t(l)!==c&&p(Fe)})}var We=O(Se,2);{var Ze=p=>{Ce(p,{get category(){return n()},get active_legend(){return t(v)},get color_map(){return t(P)},label_index:c,get token(){return H()},onchange:d,get value(){return e()},set value(k){e(k)},get label_to_edit(){return t(l)},set label_to_edit(k){u(l,k,!0)}})};B(We,p=>{x()&&t(l)===c&&n()!==null&&p(Ze)})}w(V);var Ge=O(V,2);{var Pe=p=>{var k=vt();k.__click=()=>ae(c);var se=j(k);Ie(se),w(k),m(p,k)};B(Ge,p=>{x()&&n()!==null&&p(Pe)})}w(U),ee((p,k)=>{we=me(V,1,"token svelte-1akrbo3",null,we,p),q(V,"role",n()!==null?"button":void 0),q(V,"tabindex",n()!==null?0:void 0),xe=$(V,"",xe,k),Ee=me(le,1,"text svelte-1akrbo3",null,Ee,{unlabeled:n()===null}),ue(Ae,t(D))},[()=>({highlighted:n()!==null,transparent:n()!==null&&be(t(S)),dimmed:t(v)&&t(v)!==n()}),()=>({"background-color":t(S),color:ye(n())})]),W("focus",V,()=>u(i,c,!0)),W("mouseenter",V,()=>u(i,c,!0)),m(g,U)};B(oe,g=>{(R()?t(D)!=="":t(D).trim())&&g(ve)})}var fe=O(oe,2);{var he=g=>{var S=ht();m(g,S)};B(fe,g=>{Q{var f=wt(),M=te(f);{var K=E=>{var z=pt();m(E,z)};B(M,E=>{o()&&E(K)})}var L=O(M,2);ie(L,21,e,ce,(E,z,c)=>{let H=()=>t(z).token,n=()=>t(z).class_or_confidence;const F=G(()=>typeof n()=="string"?parseFloat(n()):n());var Y=yt(),_=j(Y);let X;q(_,"tabindex",0),_.__click=()=>{x()?u(l,c,!0):r.onselect?.({index:c,value:[H(),n()]})},_.__keydown=g=>{g.key==="Enter"&&(x()?u(l,c,!0):r.onselect?.({index:c,value:[H(),n()]}))};let D;var Q=j(_),ne=j(Q,!0);w(Q);var oe=O(Q,2);{var ve=g=>{Ce(g,{get category(){return n()},get active_legend(){return t(v)},get color_map(){return t(P)},label_index:c,get token(){return H()},onchange:d,is_scores_mode:!0,get value(){return e()},set value(S){e(S)},get label_to_edit(){return t(l)},set label_to_edit(S){u(l,S,!0)}})};B(oe,g=>{x()&&n()!==null&&t(l)===c&&g(ve)})}w(_);var fe=O(_,2);{var he=g=>{var S=kt();S.__click=()=>ae(c);var U=j(S);Ie(U),w(S),m(g,S)};B(fe,g=>{x()&&n()!==null&&t(i)===c&&g(he)})}w(Y),ee(g=>{X=me(_,1,"token score-token svelte-1akrbo3",null,X,{highlighted:t(F)!==null}),D=$(_,"",D,g),ue(ne,H())},[()=>({"background-color":Ve(t(F))})]),W("mouseenter",_,()=>u(i,c,!0)),W("focus",_,()=>u(i,c,!0)),m(E,Y)}),w(L),m(a,f)};B(je,a=>{t(C)==="categories"?a(Oe):a(Te,!1)})}w(ge),m(s,ge),ke()}Le(["click","keydown"]);var St=y(" ",1);function Gt(s,r){pe(r,!0);const h=Je(r,["$$slots","$$events","$$legacy"]),e=new ot(h);let o=N(re(e.props.value));ze(()=>{t(o)!==e.props.value&&(u(o,e.props.value,!0),e.dispatch("change"))});let b=G(()=>e.props.combine_adjacent?He(e.props.value||[]):e.props.value);{let T=G(()=>e.shared.interactive?"dashed":"solid");rt(s,{get variant(){return t(T)},test_id:"highlighted-text",get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},padding:!1,get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},get rtl(){return e.props.rtl},children:(R,x)=>{var i=St(),v=te(i);st(v,qe({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{onclearstatus:()=>e.dispatch("clear_status",e.shared.loading_status)}));var l=O(v,2);{var A=d=>{lt(d,{get buttons(){return e.props.buttons},on_custom_button_click:I=>e.dispatch("custom_button_click",{id:I})})};B(l,d=>{e.shared.interactive&&e.shared.label&&e.shared.show_label&&e.props.buttons?.length&&d(A)})}var C=O(l,2);{var P=d=>{{let I=G(()=>e.shared.label||e.i18n("highlighted_text.highlighted_text")),J=G(()=>e.shared.container===!1);at(d,{get Icon(){return Me},get label(){return t(I)},float:!1,get disable(){return t(J)},get show_label(){return e.shared.show_label},get rtl(){return e.props.rtl}})}};B(C,d=>{e.shared.label&&e.shared.show_label&&d(P)})}var _e=O(C,2);{var de=d=>{Et(d,{get interactive(){return e.shared.interactive},get show_legend(){return e.props.show_legend},get show_inline_category(){return e.props.show_inline_category},get show_whitespaces(){return e.props.show_whitespaces},get color_map(){return e.props.color_map},onselect:I=>e.dispatch("select",I),onchange:()=>{e.props.value=t(b),e.dispatch("change")},get value(){return t(b)},set value(I){u(b,I)}})},ae=d=>{{let I=G(()=>e.shared.interactive?"small":"large");nt(d,{get size(){return t(I)},get unpadded_box(){return e.shared.interactive},children:(J,ye)=>{Me(J)},$$slots:{default:!0}})}};B(_e,d=>{t(b)?d(de):d(ae,!1)})}m(R,i)},$$slots:{default:!0}})}ke()}export{Et as BaseHighlightedText,Gt as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CvyxbOJU.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CvyxbOJU.css new file mode 100644 index 0000000000000000000000000000000000000000..23669494a67a8b5cbe20a4c6f7b64354d4e6133f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CvyxbOJU.css @@ -0,0 +1 @@ +.input-model.svelte-18wa0f8{display:flex;position:relative;justify-content:center;align-items:center;width:var(--size-full);height:var(--size-full);border-radius:var(--block-radius);overflow:hidden}.input-model.svelte-18wa0f8 canvas{width:var(--size-full);height:var(--size-full);object-fit:contain;overflow:hidden} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CwPG6Lki.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CwPG6Lki.js new file mode 100644 index 0000000000000000000000000000000000000000..87e18cc15c88f6e2b57b7be29d2dfcdfe835c90d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CwPG6Lki.js @@ -0,0 +1 @@ +import{g as ee,i as S,r as te,d as re,h as ae,b as se}from"./i18n-Dnhn5Rxr.js";import{R as oe,u as U,v as le,S as C,a as P,x as c,w as a,T as ie,M as q,a5 as g,X as T,W as M,t as ne,V as pe,Y as ue,a6 as ce}from"./index-DWyDLubb.js";import{b as f}from"./misc-vsnLZ-Y1.js";import{B as de}from"./Block-J4oodUWp.js";import{S as me}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{G as he}from"./utils.svelte-CCyS_0CY.js";import{U as _e}from"./UploadText-oRnvaG4b.js";import{G as ge,h as E}from"./Gallery-BwMbO7WY.js";import{S as fe}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{a as ve}from"./FileUpload-yTZ4bq_L.js";/* empty css *//* empty css *//* empty css */import{W as L}from"./Webcam-DQkeURjU.js";import"./Upload-HitvyI7k.js";/* empty css *//* empty css */import{default as vt}from"./Example-B9bhmUl8.js";import"./snippet-BWgYNF9D.js";import"./clone-BkeCM4Nl.js";import"./window-Uydxco8n.js";import"./event-modifiers-CdEA5IGF.js";import"./BlockLabel-CZd21Hkw.js";import"./Empty-BIB2W5at.js";import"./ShareButton-wCSP7LoP.js";import"./Clear-BF6j078A.js";import"./Download-Di2PsS6O.js";import"./Image-DrPceByI.js";import"./Play-BxqeM8KI.js";import"./IconButtonWrapper-D0s9l4wW.js";import"./FullscreenButton-sCrcy_OJ.js";import"./Maximize-QH9NIRWs.js";import"./ModifyUpload-CIJNunwR.js";import"./DownloadLink-TGTaev7f.js";import"./Edit-D-unDhOb.js";import"./Undo-C2-jWGVL.js";import"./Image-CeW7PJs4.js";import"./Video-B_oD6cFy.js";import"./actions-CLThs9VH.js";import"./universal-CFOISHmx.js";import"./index-tFQomdd2.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";import"./File-BHHIF0P7.js";import"./DropdownArrow-BOSZEGSp.js";import"./Square-CcB54dqq.js";import"./Spinner-Dhvehhrf.js";import"./StreamingBar-Cb4g-rUI.js";var we=M("
        ",1),be=M(" ",1);function _t(N,m){oe(m,!0);let y=U(void 0);class V extends he{async get_data(){return a(y)&&(await a(y),await q()),await super.get_data()}}const X=te(m,["$$slots","$$events","$$legacy"]),e=new V(X,{selected_index:null,file_types:["image","video"]});let x=U(!1);function Y(l){if(!e.props.value)return;const{index:n}=l;e.dispatch("delete",l),e.props.value=e.props.value.filter((s,p)=>p!==n),e.dispatch("change",e.props.value)}async function v(l){return(await Promise.all(l.map(async s=>{if(s.path?.toLowerCase().endsWith(".svg")&&s.url){const u=await(await fetch(s.url)).text();return{...s,url:`data:image/svg+xml,${encodeURIComponent(u)}`}}return s}))).map(s=>s.mime_type?.includes("video")?{video:s,caption:null}:{image:s,caption:null})}let j,i=U(le(e.props.sources?e.props.sources[0]:"upload")),F=g(()=>e.props.value===null?!0:e.props.value.length===0),k=g(()=>e.props.file_types?.includes("video")&&e.props.sources.includes("webcam")?e.props.sources.concat(["webcam-video"]):e.props.sources);async function I(){navigator.clipboard.read().then(async l=>{let n=null;for(let s=0;s(e.props.file_types||["image"]).some($=>u.startsWith($+"/")));if(p){const u=await l[s].getType(p);n=new File([u],`clipboard.${p.replace("image/","")}`);break}}if(n){const s=await E(n,u=>e.shared.client.upload(u,e.shared.root),"clipboard_upload"),p=await v(s);e.props.value?.push(...p),e.dispatch("change",e.props.value),c(i,null)}else e.dispatch("warning","No image or video found in clipboard")})}async function D(l){l==="clipboard"&&await I()}async function H(l){await q(),l==="clipboard"?await I():(c(i,l,!0),c(F,!0))}{let l=g(()=>e.props.height||void 0);de(N,{get visible(){return e.shared.visible},variant:"solid",padding:!1,get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},allow_overflow:!1,get height(){return a(l)},get fullscreen(){return a(x)},set fullscreen(n){c(x,n,!0)},children:(n,s)=>{var p=be(),u=C(p);fe(u,ee({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var $=T(u,2);{var J=h=>{var G=we(),_=C(G),W=pe(_);re(ve(W,{value:null,get root(){return e.shared.root},get label(){return e.shared.label},get max_file_size(){return e.shared.max_file_size},file_count:"multiple",get file_types(){return e.props.file_types},get i18n(){return e.i18n},upload:(...r)=>e.shared.client.upload(...r),stream_handler:(...r)=>e.shared.client.stream(...r),onupload:async r=>{const o=Array.isArray(r)?r:[r];e.props.value=await v(o),c(i,null),e.dispatch("upload",e.props.value),e.dispatch("change",e.props.value)},onerror:({detail:r})=>{e.shared.loading_status=e.shared.loading_status||{},e.shared.loading_status.status="error",e.dispatch("error",r)},get upload_promise(){return a(y)},set upload_promise(r){c(y,r,!0)},children:(r,o)=>{_e(r,{get i18n(){return e.i18n},type:"gallery"})},$$slots:{default:!0}}),r=>j=r,()=>j),ue(_);var t=T(_,2);{var z=r=>{L(r,{get root(){return e.shared.root},value:null,mirror_webcam:!0,streaming:!1,mode:"image",include_audio:!1,get i18n(){return e.i18n},upload:(...o)=>e.shared.client.upload(...o),$$events:{capture:async o=>{const A=await E(o.detail,b=>e.shared.client.upload(b,e.shared.root),"webcam_upload"),B=await v(A);e.props.value?.push(...B),c(i,null),e.dispatch("change",e.props.value)},error(o){f.call(this,m,o)},drag(o){f.call(this,m,o)},close_stream(o){f.call(this,m,o)}}})},w=r=>{var o=ce(),A=C(o);{var B=b=>{L(b,{get root(){return e.shared.root},value:null,mirror_webcam:!0,streaming:!1,mode:"video",include_audio:!1,get i18n(){return e.i18n},upload:(...d)=>e.shared.client.upload(...d),$$events:{capture:async d=>{const R={...d.detail};R.mime_type="video/webm";const Z=await v([R]);e.props.value?.push(...Z),c(i,null),e.dispatch("change",e.props.value)},error(d){f.call(this,m,d)},drag(d){f.call(this,m,d)},close_stream(d){f.call(this,m,d)}}})};S(A,b=>{a(i)==="webcam-video"&&b(B)},!0)}P(r,o)};S(t,r=>{a(i)==="webcam"?r(z):r(w,!1)})}var O=T(t,2);{var Q=r=>{me(r,{get sources(){return a(k)},handle_clear:()=>e.dispatch("clear"),handle_select:D,get active_source(){return a(i)},set active_source(o){c(i,o,!0)}})};S(O,r=>{(a(k).length>1||a(k).includes("clipboard"))&&r(Q)})}ne(r=>se(_,1,r,"svelte-vrqwbn"),[()=>ae(!e.props.value||a(i)&&a(i).includes("webcam")?"hidden-upload-input":"upload-wrapper")]),P(h,G)},K=h=>{{let G=g(()=>e.props.buttons.some(t=>typeof t=="string"&&t==="share")),_=g(()=>e.props.buttons.some(t=>typeof t=="string"&&t==="download")),W=g(()=>e.props.buttons.some(t=>typeof t=="string"&&t==="fullscreen"));ge(h,{onchange:()=>e.dispatch("change"),onclear:()=>e.dispatch("change"),onselect:t=>e.dispatch("select",t),onshare:t=>e.dispatch("share",t.detail),onerror:t=>e.dispatch("error",t.detail),onpreview_open:()=>{e.dispatch("preview_open")},onpreview_close:()=>e.dispatch("preview_close"),onfullscreen:({detail:t})=>{c(x,t,!0)},ondelete:Y,onupload:async t=>{const z=Array.isArray(t)?t:[t],w=await v(z);e.props.value=e.props.value?[...e.props.value,...w]:w,e.dispatch("upload",w),e.dispatch("change",e.props.value)},get sources(){return a(k)},onsource_change:H,get label(){return e.shared.label},get show_label(){return e.shared.show_label},get columns(){return e.props.columns},get rows(){return e.props.rows},get height(){return e.props.height},get preview(){return e.props.preview},get object_fit(){return e.props.object_fit},get interactive(){return e.shared.interactive},get allow_preview(){return e.props.allow_preview},get show_share_button(){return a(G)},get show_download_button(){return a(_)},get fit_columns(){return e.props.fit_columns},get i18n(){return e.i18n},_fetch:(...t)=>e.shared.client.fetch(...t),get show_fullscreen_button(){return a(W)},get buttons(){return e.props.buttons},oncustom_button_click:t=>{e.dispatch("custom_button_click",{id:t})},get fullscreen(){return a(x)},get root(){return e.shared.root},get file_types(){return e.props.file_types},get max_file_size(){return e.shared.max_file_size},upload:(...t)=>e.shared.client.upload(...t),stream_handler:(...t)=>e.shared.client.stream(...t),get selected_index(){return e.props.selected_index},set selected_index(t){e.props.selected_index=t},get value(){return e.props.value},set value(t){e.props.value=t}})}};S($,h=>{e.shared.interactive&&a(F)?h(J):h(K,!1)})}P(n,p)},$$slots:{default:!0}})}ie()}export{vt as BaseExample,ge as BaseGallery,_t as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CwinLc1f.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CwinLc1f.css new file mode 100644 index 0000000000000000000000000000000000000000..d1cb5071aa2c790187a7024744ae95deed42093c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CwinLc1f.css @@ -0,0 +1 @@ +.wrap.svelte-8epfm4{display:flex;flex-direction:column;width:100%}.head.svelte-8epfm4{margin-bottom:var(--size-2);display:flex;justify-content:space-between;align-items:flex-start;flex-wrap:wrap;width:100%}.head.svelte-8epfm4>label:where(.svelte-8epfm4){flex:1}.head.svelte-8epfm4>.tab-like-container:where(.svelte-8epfm4){margin-left:auto;order:1}.slider_input_container.svelte-8epfm4{display:flex;align-items:center;gap:var(--size-2)}input[type=range].svelte-8epfm4{-webkit-appearance:none;appearance:none;width:100%;cursor:pointer;outline:none;border-radius:var(--radius-xl);min-width:var(--size-28);background:transparent}input[type=range].svelte-8epfm4::-webkit-slider-runnable-track{height:var(--size-2);background:var(--neutral-200);border-radius:var(--radius-xl)}input[type=range].svelte-8epfm4::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;height:var(--size-4);width:var(--size-4);background-color:#fff;border-radius:50%;margin-top:-5px;box-shadow:0 0 0 1px #f7f6f6bc,1px 1px 4px #0000001a}input[type=range].svelte-8epfm4::-webkit-slider-runnable-track{background:linear-gradient(to right,var(--slider-color) var(--range_progress),var(--neutral-200) var(--range_progress))}input[type=range].svelte-8epfm4::-moz-range-track{height:var(--size-2);background:var(--neutral-200);border-radius:var(--radius-xl)}input[type=range].svelte-8epfm4::-moz-range-thumb{appearance:none;height:var(--size-4);width:var(--size-4);background-color:#fff;border-radius:50%;border:none;margin-top:calc(-1 * (var(--size-4) - var(--size-2)) / 2);box-shadow:0 0 0 1px #f7f6f6bc,1px 1px 4px #0000001a}input[type=range].svelte-8epfm4::-moz-range-progress{height:var(--size-2);background-color:var(--slider-color);border-radius:var(--radius-xl)}input[type=number].svelte-8epfm4{display:block;outline:none;border:1px solid var(--input-border-color);border-radius:var(--radius-sm);background:var(--input-background-fill);padding:var(--size-2) var(--size-3);height:var(--size-8);color:var(--body-text-color);font-size:var(--input-text-size);line-height:var(--line-sm);text-align:center;min-width:var(--size-16);transition:border-color .15s ease-in-out}input[type=number].svelte-8epfm4:focus{box-shadow:none;border-width:2px}input.svelte-8epfm4:disabled,input[disabled].svelte-8epfm4{-webkit-text-fill-color:var(--body-text-color);opacity:1;cursor:not-allowed}input.svelte-8epfm4::placeholder{color:var(--input-placeholder-color)}input[type=range][disabled].svelte-8epfm4{opacity:.6}input[type=range][disabled].svelte-8epfm4::-webkit-slider-thumb,input[type=range][disabled].svelte-8epfm4::-moz-range-thumb,input[type=range][disabled].svelte-8epfm4::-ms-thumb,input[type=range][disabled].svelte-8epfm4::-webkit-slider-thumb:hover,input[type=range][disabled].svelte-8epfm4::-moz-range-thumb:hover,input[type=range][disabled].svelte-8epfm4::-moz-range-track:hover{background-color:var(--body-text-color-subdued);cursor:not-allowed}.min_value.svelte-8epfm4,.max_value.svelte-8epfm4{font-size:var(--text-sm);color:var(--body-text-color-subdued)}.min_value.svelte-8epfm4{margin-right:var(--size-0-5)}.max_value.svelte-8epfm4{margin-left:var(--size-0-5);margin-right:var(--size-0-5)}@media(max-width:480px){.min_value.svelte-8epfm4,.max_value.svelte-8epfm4{display:none}}@media(max-width:520px){.head.svelte-8epfm4{gap:var(--size-3)}}@media(max-width:420px){.head.svelte-8epfm4 .tab-like-container:where(.svelte-8epfm4){margin-bottom:var(--size-4)}}.tab-like-container.svelte-8epfm4{display:flex;align-items:stretch;border:1px solid var(--input-border-color);border-radius:var(--radius-sm);overflow:hidden;height:var(--size-6)}input[type=number].svelte-8epfm4{border:none;border-radius:0;padding:var(--size-1) var(--size-2);height:100%;min-width:var(--size-14);font-size:var(--text-sm)}input[type=number].svelte-8epfm4:focus{box-shadow:inset 0 0 0 1px var(--color-accent);border-radius:3px 0 0 3px}.reset-button.svelte-8epfm4{display:flex;align-items:center;justify-content:center;background:none;border:none;border-left:1px solid var(--input-border-color);cursor:pointer;font-size:var(--text-sm);color:var(--body-text-color);padding:0 var(--size-2);min-width:var(--size-6);transition:background-color .15s ease-in-out}.reset-button.svelte-8epfm4:hover:not(:disabled){background-color:var(--background-fill-secondary)}.reset-button.svelte-8epfm4:disabled{opacity:.5;cursor:not-allowed} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CzkKCnV2.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CzkKCnV2.js new file mode 100644 index 0000000000000000000000000000000000000000..43dd851afa26713dc41451667bf704660682fdc2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-CzkKCnV2.js @@ -0,0 +1 @@ +import{p as a,i as f,a as h,r as E}from"./i18n-Dnhn5Rxr.js";import{R as w,S as b,a as o,T as k,X as I,W as x,t as z,a6 as R,a7 as S,w as T,a5 as W,a0 as X,a8 as j}from"./index-DWyDLubb.js";import{G as q}from"./utils.svelte-CCyS_0CY.js";import{s as A}from"./snippet-BWgYNF9D.js";import{B as F}from"./Button-D-_s2ksk.js";import"./clone-BkeCM4Nl.js";import"./Image-CeW7PJs4.js";import"./misc-vsnLZ-Y1.js";/* empty css */import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";/* empty css */var H=x(''),J=x(" ",1);function K(u,e){w(e,!0);let c=a(e,"elem_id",3,""),t=a(e,"elem_classes",19,()=>[]),m=a(e,"visible",3,!0),v=a(e,"variant",3,"secondary"),_=a(e,"size",3,"lg"),d=a(e,"disabled",3,!1),B=a(e,"scale",3,null),y=a(e,"min_width",3,void 0);function p(){if(e.on_click?.(),!e.value?.url)return;let r;if(!e.value.orig_name&&e.value.url){const s=e.value.url.split("/");r=s[s.length-1],r=r.split("?")[0].split("#")[0]}else r=e.value.orig_name;const l=document.createElement("a");l.href=e.value.url,l.download=r||"file",document.body.appendChild(l),l.click(),document.body.removeChild(l)}F(u,{get size(){return _()},get variant(){return v()},get elem_id(){return c()},get elem_classes(){return t()},get visible(){return m()},onclick:p,get scale(){return B()},get min_width(){return y()},get disabled(){return d()},children:(r,l)=>{var s=J(),g=b(s);{var C=i=>{var n=H();z(()=>{h(n,"src",e.icon.url),h(n,"alt",`${e.value} icon`)}),o(i,n)};f(g,i=>{e.icon&&i(C)})}var G=I(g,2);{var P=i=>{var n=R(),D=b(n);A(D,()=>e.children),o(i,n)};f(G,i=>{e.children&&i(P)})}o(r,s)},$$slots:{default:!0}}),k()}function te(u,e){w(e,!0);const c=E(e,["$$slots","$$events","$$legacy"]),t=new q(c);{let m=W(()=>!t.shared.interactive);K(u,{get value(){return t.props.value},get variant(){return t.props.variant},get elem_id(){return t.shared.elem_id},get elem_classes(){return t.shared.elem_classes},get size(){return t.props.size},get scale(){return t.shared.scale},get icon(){return t.props.icon},get min_width(){return t.shared.min_width},get visible(){return t.shared.visible},get disabled(){return T(m)},on_click:()=>t.dispatch("click"),children:(v,_)=>{j();var d=S();z(()=>X(d,t.shared.label??"")),o(v,d)},$$slots:{default:!0}})}k()}export{K as BaseButton,te as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-D5ut_MhQ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-D5ut_MhQ.js new file mode 100644 index 0000000000000000000000000000000000000000..0b1a7e6c1a38d6825c0cdd1ffe5798638e1c3b24 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-D5ut_MhQ.js @@ -0,0 +1 @@ +import{s as n,r as d}from"./i18n-Dnhn5Rxr.js";import{R as l,a6 as m,S as p,a as f,T as u}from"./index-DWyDLubb.js";import{G as c}from"./utils.svelte-CCyS_0CY.js";import{B as h}from"./BaseForm-B7Gu_hvH.js";import"./clone-BkeCM4Nl.js";function x(t,e){l(e,!0);let a=d(e,["$$slots","$$events","$$legacy"]);const r=new c(a);h(t,{get visible(){return r.shared.visible},get scale(){return r.shared.scale},get min_width(){return r.shared.min_width},children:(o,g)=>{var s=m(),i=p(s);n(i,e,"default",{}),f(o,s)},$$slots:{default:!0}}),u()}export{h as BaseForm,x as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DCKyQnHX.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DCKyQnHX.js new file mode 100644 index 0000000000000000000000000000000000000000..144882259281b88dd48f6902c4ebfde33b4515bb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DCKyQnHX.js @@ -0,0 +1 @@ +import{i as v,g as T,b as A,f as C,r as G}from"./i18n-Dnhn5Rxr.js";import{R as H,u as J,v as M,y as N,w as n,x as W,S as z,t as R,a as U,X as p,V,T as X,a5 as b,au as Y,W as q,Y as D}from"./index-DWyDLubb.js";import{G as F,c as w}from"./utils.svelte-CCyS_0CY.js";import K from"./HTML-Bg_bA9M4.js";import{S as O}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{B as P}from"./Block-J4oodUWp.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as Q}from"./BlockLabel-CZd21Hkw.js";import{C as Z}from"./Code-Bg0YpSHl.js";import{I as ee}from"./IconButtonWrapper-D0s9l4wW.js";import{default as ye}from"./Example-CY2poEFg.js";import"./clone-BkeCM4Nl.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var te=q("
        ",1);function ve(y,i){H(i,!0);let $=G(i,["$$slots","$$events","$$legacy"]),x=i.children;const e=new F($);let k=b(()=>({value:e.props.value??"",label:e.shared.label,visible:e.shared.visible,...e.props.props})),d=J(M(e.props.value));N(()=>{JSON.stringify(n(d))!==JSON.stringify(e.props.value)&&(W(d,e.props.value,!0),e.dispatch("change"))});let u=[];function B(a,s){const r=Array.isArray(a)?a:[a];u.push({props:r,callback:s})}function S(a){const s=new Set;for(const r of u)r.props.some(o=>a.includes(o))&&s.add(r);for(const r of s)try{r.callback()}catch(o){console.error("Error in watch callback:",o)}}async function E(a){try{const s=await Y([a]),r=await e.shared.client.upload(s,e.shared.root,void 0,e.shared.max_file_size??void 0);if(r&&r[0])return{path:r[0].path,url:r[0].url};throw new Error("Upload failed")}catch(s){throw e.dispatch("error",s instanceof Error?s.message:String(s)),s}}{let a=b(()=>e.props.padding!==!1);P(y,{get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get padding(){return n(a)},overflow_behavior:"visible",children:(s,r)=>{var o=te(),c=z(o);{var I=t=>{ee(t,{get buttons(){return e.props.buttons},on_custom_button_click:g=>{e.dispatch("custom_button_click",{id:g})}})};v(c,t=>{e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0&&t(I)})}var h=p(c,2);{var j=t=>{Q(t,{get Icon(){return Z},get show_label(){return e.shared.show_label},get label(){return e.shared.label},float:!0})};v(h,t=>{e.shared.show_label&&t(j)})}var _=p(h,2);O(_,T({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{variant:"center",on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var l=p(_,2);let f,m;var L=V(l);K(L,{get props(){return n(k)},get html_template(){return e.props.html_template},get css_template(){return e.props.css_template},get js_on_load(){return e.props.js_on_load},get elem_classes(){return e.shared.elem_classes},get visible(){return e.shared.visible},get autoscroll(){return e.shared.autoscroll},get apply_default_css(){return e.props.apply_default_css},get head(){return e.props.head},get component_class_name(){return e.props.component_class_name},upload:E,get server(){return e.shared.server},watch_fn:B,fire_watchers:S,$$events:{event:t=>{e.dispatch(t.detail.type,t.detail.data)},update_value:t=>{t.detail.property==="value"?e.props.value=t.detail.data:t.detail.property==="label"?e.shared.label=t.detail.data:t.detail.property==="visible"&&(e.shared.visible=t.detail.data)}},children:(t,g)=>{x?.(t)},$$slots:{default:!0}}),D(l),R(t=>{f=A(l,1,"html-container svelte-1jts93g",null,f,{pending:e.shared.loading_status?.status==="pending"&&e.shared.loading_status?.show_progress!=="hidden","label-padding":e.shared.show_label??void 0}),m=C(l,"",m,t)},[()=>({"min-height":e.props.min_height&&e.shared.loading_status?.status!=="pending"?w(e.props.min_height):void 0,"max-height":e.props.max_height?w(e.props.max_height):void 0,"overflow-y":e.props.max_height?"auto":void 0})]),U(s,o)},$$slots:{default:!0}})}X()}export{ye as BaseExample,K as BaseHTML,ve as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DHz84ApK.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DHz84ApK.css new file mode 100644 index 0000000000000000000000000000000000000000..e8abc020001a03b4396563b29368bfa17b3f9d3c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DHz84ApK.css @@ -0,0 +1 @@ +span.svelte-e5lyqv{font-weight:var(--section-header-text-weight);font-size:var(--section-header-text-size)}.label-wrap.svelte-e5lyqv{display:flex;justify-content:space-between;cursor:pointer;width:var(--size-full);color:var(--accordion-text-color)}.label-wrap.open.svelte-e5lyqv{margin-bottom:var(--size-2)}.icon.svelte-e5lyqv{transition:.15s} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DIMxqS5W.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DIMxqS5W.css new file mode 100644 index 0000000000000000000000000000000000000000..babf023236cf20d509d8a16c04e0196028330e2d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DIMxqS5W.css @@ -0,0 +1 @@ +.base-image.svelte-1oizopk{display:block;width:100%;height:auto}.container.svelte-1oizopk{display:flex;position:relative;flex-direction:column;justify-content:center;align-items:center;width:var(--size-full);height:var(--size-full)}.image-container.svelte-1oizopk{position:relative;top:0;left:0;flex-grow:1;width:100%;overflow:hidden}.fit-height.svelte-1oizopk{top:0;left:0;width:100%;height:100%;object-fit:contain}.mask.svelte-1oizopk{opacity:.85;transition:all .2s ease-in-out;position:absolute}.image-container.svelte-1oizopk:hover .mask:where(.svelte-1oizopk){opacity:.3}.mask.active.svelte-1oizopk{opacity:1}.mask.inactive.svelte-1oizopk{opacity:0}.legend.svelte-1oizopk{display:flex;flex-direction:row;flex-wrap:wrap;align-content:center;justify-content:center;align-items:center;gap:var(--spacing-sm);padding:var(--spacing-sm)}.legend-item.svelte-1oizopk{display:flex;flex-direction:row;align-items:center;cursor:pointer;border-radius:var(--radius-sm);padding:var(--spacing-sm)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DKIzZVIo.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DKIzZVIo.css new file mode 100644 index 0000000000000000000000000000000000000000..2a81945a4abca030830aed4451cdcbde990bb5c1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DKIzZVIo.css @@ -0,0 +1 @@ +.hidden-upload-input.svelte-vrqwbn{display:none}.upload-wrapper.svelte-vrqwbn{height:100%} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DMaj38-p.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DMaj38-p.css new file mode 100644 index 0000000000000000000000000000000000000000..f52a7bb264071638387f9a05c991b4d834a7ebea --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DMaj38-p.css @@ -0,0 +1 @@ +@media(max-width:768px){.sidebar.svelte-1uruprb{width:100vw!important}.sidebar.svelte-1uruprb:not(.right){left:-100vw!important}.sidebar.right.svelte-1uruprb{right:-100vw!important}.sidebar.svelte-1uruprb:not(.reduce-motion){transition:transform .3s ease-in-out!important}.sidebar-parent{padding-left:0!important;padding-right:0!important}.sidebar-parent:has(.sidebar.open){padding-left:0!important;padding-right:0!important}.sidebar.open.svelte-1uruprb{z-index:1001!important}}.sidebar-parent{display:flex!important;padding-left:0;padding-right:0}.sidebar-parent:not(.reduce-motion){transition:padding-left .3s ease-in-out,padding-right .3s ease-in-out}.sidebar-parent:has(.sidebar.open:not(.right)){padding-left:var(--overlap-amount)}.sidebar-parent:has(.sidebar.open.right){padding-right:var(--overlap-amount)}.sidebar.svelte-1uruprb{display:flex;flex-direction:column;position:fixed;top:0;height:100%;background-color:var(--background-fill-secondary);transform:translate(0);z-index:1000}.sidebar.svelte-1uruprb:not(.reduce-motion){transition:transform .3s ease-in-out}.sidebar.open.svelte-1uruprb:not(.right){transform:translate(100%);box-shadow:var(--size-1) 0 var(--size-1) #0000000d}.sidebar.open.right.svelte-1uruprb{transform:translate(-100%);box-shadow:calc(var(--size-1) * -1) 0 var(--size-1) #0000000d}.toggle-button.svelte-1uruprb{position:absolute;top:var(--size-4);background:var(--background-fill-secondary);border:1px solid var(--border-color-primary);cursor:pointer;padding:var(--size-2);display:flex;align-items:center;justify-content:center;width:var(--size-7);height:var(--size-8);z-index:1001;border-radius:0}.toggle-button.svelte-1uruprb:not(.reduce-motion){transition:all .3s ease-in-out}.sidebar.svelte-1uruprb:not(.right) .toggle-button:where(.svelte-1uruprb){left:100%;border-radius:0 var(--size-8) var(--size-8) 0;border-left:none}.sidebar.right.svelte-1uruprb .toggle-button:where(.svelte-1uruprb){right:100%;transform:rotate(180deg);border-radius:0 var(--size-8) var(--size-8) 0;border-left:none}.open.svelte-1uruprb:not(.right) .toggle-button:where(.svelte-1uruprb){right:0;left:auto;transform:rotate(180deg);border-radius:0 var(--size-8) var(--size-8) 0;border-left:none;border-right:1px solid var(--border-color-primary)}.open.right.svelte-1uruprb .toggle-button:where(.svelte-1uruprb){left:0;right:auto;transform:rotate(0);border-radius:0 var(--size-8) var(--size-8) 0;border-left:none;border-right:1px solid var(--border-color-primary)}.chevron.svelte-1uruprb{position:relative;display:flex;align-items:center;justify-content:center;padding-right:8px}.chevron-left.svelte-1uruprb{position:relative;width:var(--size-3);height:var(--size-3);border-top:var(--size-0-5) solid var(--body-text-color);border-right:var(--size-0-5) solid var(--body-text-color);transform:rotate(45deg)}.sidebar-content.svelte-1uruprb{padding:var(--size-5);padding-right:var(--size-8);overflow-y:auto}.sidebar.right.svelte-1uruprb .sidebar-content:where(.svelte-1uruprb){padding-left:var(--size-8)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DND_tLDq.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DND_tLDq.js new file mode 100644 index 0000000000000000000000000000000000000000..260eb327e5596efa2b7ea2b726759f5421689fbc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DND_tLDq.js @@ -0,0 +1 @@ +import{p as j,i as b,g as O,r as X}from"./i18n-Dnhn5Rxr.js";import{R as w,ae as P,w as r,T as k,a5 as p,x as f,u as y,S as $,a as D,X as v,W as I,v as q,y as A}from"./index-DWyDLubb.js";import{G as F}from"./utils.svelte-CCyS_0CY.js";import{S as H}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{C as J}from"./Code-BLWhl1y6.js";import{C as W}from"./Check-DUAHzS2-.js";import{C as K}from"./Copy-ChCbTvli.js";import{I as E}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{D as M}from"./Download-Di2PsS6O.js";import{D as N}from"./DownloadLink-TGTaev7f.js";import{I as Q}from"./IconButtonWrapper-D0s9l4wW.js";import{B as V}from"./Block-J4oodUWp.js";import{B as Y}from"./BlockLabel-CZd21Hkw.js";import{E as Z}from"./Empty-BIB2W5at.js";import{C as L}from"./Code-Bg0YpSHl.js";import{default as Le}from"./Example-C7q4tFc2.js";import"./clone-BkeCM4Nl.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";import"./snippet-BWgYNF9D.js";/* empty css */function ee(c,t){w(t,!0);let a=y(!1),e;function n(){f(a,!0),e&&clearTimeout(e),e=setTimeout(()=>{f(a,!1)},2e3)}async function o(){"clipboard"in navigator&&(await navigator.clipboard.writeText(t.value),n())}P(()=>{e&&clearTimeout(e)});{let i=p(()=>r(a)?W:K);E(c,{get Icon(){return r(i)},label:"Copy",onclick:o})}k()}function te(c,t){w(t,!0);let a=p(()=>e(t.language));function e(m){return{py:"py",python:"py",md:"md",markdown:"md",json:"json",html:"html",css:"css",js:"js",javascript:"js",ts:"ts",typescript:"ts",yaml:"yaml",yml:"yml",dockerfile:"dockerfile",sh:"sh",shell:"sh",r:"r",c:"c",cpp:"cpp",latex:"tex"}[m]||"txt"}let n=y(!1),o;function i(){f(n,!0),o&&clearTimeout(o),o=setTimeout(()=>{f(n,!1)},2e3)}let d=p(()=>URL.createObjectURL(new Blob([t.value])));P(()=>{o&&clearTimeout(o)}),N(c,{get download(){return`file.${r(a)??""}`},get href(){return r(d)},onclick:i,children:(m,_)=>{{let g=p(()=>r(n)?W:M);E(m,{get Icon(){return r(g)},label:"Download"})}},$$slots:{default:!0}}),k()}var re=I(" ",1);function ae(c,t){w(t,!0);let a=j(t,"buttons",3,null),e=j(t,"on_custom_button_click",3,null);Q(c,{get buttons(){return a()},get on_custom_button_click(){return e()},children:(n,o)=>{var i=re(),d=$(i);{var m=s=>{te(s,{get value(){return t.value},get language(){return t.language}})};b(d,s=>{a()?.some(u=>typeof u=="string"&&u==="download")&&s(m)})}var _=v(d,2);{var g=s=>{ee(s,{get value(){return t.value}})};b(_,s=>{a()?.some(u=>typeof u=="string"&&u==="copy")&&s(g)})}D(n,i)},$$slots:{default:!0}}),k()}var oe=I(" ",1),se=I(" ",1);function Ie(c,t){w(t,!0);const a=X(t,["$$slots","$$events","$$legacy"]),e=new F(a);let n=e.shared.theme==="dark",o=p(()=>e.shared.label||e.i18n("code.code")),i=y(q(e.props.value)),d=y(!0);A(()=>{if(r(d)){f(d,!1);return}r(i)!=e.props.value&&(f(i,e.props.value,!0),e.dispatch("change"))});{let m=p(()=>e.props.max_lines&&"fit-content");V(c,{get height(){return r(m)},variant:"solid",padding:!1,get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get visible(){return e.shared.visible},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},children:(_,g)=>{var s=se(),u=$(s);H(u,O({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var T=v(u,2);{var R=l=>{Y(l,{get Icon(){return L},get show_label(){return e.shared.show_label},get label(){return r(o)},float:!1})};b(T,l=>{e.shared.show_label&&l(R)})}var S=v(T,2);{var G=l=>{Z(l,{unpadded_box:!0,size:"large",children:(h,x)=>{L(h)},$$slots:{default:!0}})},U=l=>{var h=oe(),x=$(h);{let B=p(()=>e.props.buttons??["copy","download"]);ae(x,{get language(){return e.props.language},get value(){return e.props.value},get buttons(){return r(B)},on_custom_button_click:C=>{e.dispatch("custom_button_click",{id:C})}})}var z=v(x,2);{let B=p(()=>!e.shared.interactive);J(z,{get language(){return e.props.language},get lines(){return e.props.lines},get max_lines(){return e.props.max_lines},get dark_mode(){return n},get wrap_lines(){return e.props.wrap_lines},get show_line_numbers(){return e.props.show_line_numbers},get autocomplete(){return e.props.autocomplete},get readonly(){return r(B)},onblur:()=>e.dispatch("blur"),onfocus:()=>e.dispatch("focus"),oninput:()=>e.dispatch("input"),get value(){return e.props.value},set value(C){e.props.value=C}})}D(l,h)};b(S,l=>{!e.props.value&&!e.shared.interactive?l(G):l(U,!1)})}D(_,s)},$$slots:{default:!0}})}k()}export{J as BaseCode,ee as BaseCopy,te as BaseDownload,Le as BaseExample,ae as BaseWidget,Ie as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DP8ihX8q.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DP8ihX8q.css new file mode 100644 index 0000000000000000000000000000000000000000..96d7e8300c40f1b820a8756197b7ccf4a3d8b813 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DP8ihX8q.css @@ -0,0 +1 @@ +.vibe-editor.svelte-1s2fnws{position:fixed;top:0;right:0;height:100vh;background:var(--background-fill-primary);border-left:1px solid var(--border-color-primary);display:flex;flex-direction:column;z-index:100;box-shadow:var(--shadow-drop-lg);overflow:hidden}.resize-handle.svelte-1s2fnws{position:absolute;left:0;top:0;width:4px;height:100%;cursor:col-resize;background:transparent;border:none;border-left:2px solid transparent;transition:border-color .2s ease;z-index:101;padding:0}.resize-handle.svelte-1s2fnws:hover{border-left-color:var(--color-accent)}.resize-handle.svelte-1s2fnws:active{border-left-color:var(--color-accent);background:rgba(var(--color-accent-soft),.1)}.tab-header.svelte-1s2fnws{display:flex;border-bottom:1px solid var(--border-color-primary);background:var(--background-fill-secondary)}.tab-button.svelte-1s2fnws{flex:1;padding:12px 16px;background:transparent;border:none;border-bottom:2px solid transparent;font-size:14px;font-weight:500;color:var(--body-text-color-subdued);cursor:pointer;transition:all .2s ease}.tab-button.svelte-1s2fnws:hover{color:var(--body-text-color);background:var(--background-fill-primary)}.tab-button.active.svelte-1s2fnws{color:var(--color-accent);border-bottom-color:var(--color-accent);background:var(--background-fill-primary)}.tab-content.svelte-1s2fnws{flex:1;display:flex;flex-direction:column;overflow:hidden}.code-content.svelte-1s2fnws{flex:1;display:flex;flex-direction:column;padding:16px;gap:12px;overflow:hidden}.code-editor-container.svelte-1s2fnws{flex:1;overflow-y:auto;overflow-x:hidden;min-height:0}.update-code-button.svelte-1s2fnws{background:var(--button-primary-background-fill);color:var(--button-primary-text-color);border:none;border-radius:var(--button-large-radius);padding:8px 16px;font-weight:600;cursor:pointer;transition:background-color .2s;align-self:flex-start;width:100%}.update-code-button.updating.svelte-1s2fnws{background:var(--button-secondary-background-fill);color:var(--button-secondary-text-color)}.update-code-button.svelte-1s2fnws:hover{background:var(--button-primary-background-fill-hover)}.update-code-button.updating.svelte-1s2fnws:hover{background:var(--button-secondary-background-fill)}.deploy-to-spaces-button.svelte-1s2fnws{background:var(--button-secondary-background-fill);color:var(--button-secondary-text-color);border:none;border-radius:var(--button-large-radius);padding:8px 16px;font-weight:600;cursor:pointer;transition:background-color .2s;align-self:flex-start;width:100%}.deploy-to-spaces-button.svelte-1s2fnws:hover{background:var(--button-secondary-background-fill-hover)}.button-content.svelte-1s2fnws{display:flex;align-items:center;justify-content:center;gap:4px;font-weight:200}.spaces-logo.svelte-1s2fnws{width:1em;height:1em;vertical-align:middle;display:inline-block;margin-right:-3px}.message-history.svelte-1s2fnws{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px;position:relative}.message-item.svelte-1s2fnws{position:relative;padding:12px;border-radius:var(--radius-md);border:1px solid var(--border-color-primary);word-wrap:break-word;line-height:1.4;border-color:var(--border-color-primary)}.user-message.svelte-1s2fnws{margin-left:20px;padding:12px 64px 12px 12px}.bot-message.svelte-1s2fnws{margin-right:20px}.message-content.svelte-1s2fnws{display:block}.message-text.svelte-1s2fnws{color:var(--body-text-color);word-wrap:break-word;line-height:1.4;flex:1}.undo-button.svelte-1s2fnws{position:absolute;top:8px;right:8px;background:var(--button-secondary-background-fill);color:var(--button-secondary-text-color);border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);padding:var(--button-small-padding);font-size:12px;font-weight:500;cursor:pointer;transition:all .2s}.undo-button.svelte-1s2fnws:active{transform:translateY(0)}.no-messages.svelte-1s2fnws{text-align:center;color:var(--body-text-color-subdued);font-style:italic;padding:24px}.input-section.svelte-1s2fnws{padding:16px;border-top:1px solid var(--border-color-primary);background:var(--background-fill-secondary);display:flex;flex-direction:column;gap:12px}.prompt-input.svelte-1s2fnws{width:100%;min-height:80px;background:var(--input-background-fill);border:1px solid var(--border-color-primary);border-radius:var(--input-radius);padding:12px;resize:vertical;outline:none;font-family:inherit;font-size:14px;color:var(--body-text-color)}.prompt-input.svelte-1s2fnws:focus{border-color:var(--color-accent)}.submit-button.svelte-1s2fnws{background:var(--button-primary-background-fill);color:var(--button-primary-text-color);border:none;border-radius:var(--button-large-radius);padding:10px 20px;font-weight:600;cursor:pointer;transition:background-color .2s}.submit-button.svelte-1s2fnws:hover:not(:disabled){background:var(--button-primary-background-fill-hover)}.submit-button.svelte-1s2fnws:disabled{background:var(--button-secondary-background-fill);color:var(--button-secondary-text-color);cursor:not-allowed}.powered-by.svelte-1s2fnws{text-align:right;font-size:12px;color:var(--body-text-color-subdued)}.diff-stats.svelte-1s2fnws{margin-left:8px;display:inline-flex;gap:4px;font-size:11px;font-weight:600}.diff-stats.svelte-1s2fnws .added:where(.svelte-1s2fnws){color:#22c55e}.diff-stats.svelte-1s2fnws .removed:where(.svelte-1s2fnws){color:#ef4444}.starter-queries-container.svelte-1s2fnws{position:absolute;bottom:16px;left:50%;transform:translate(-50%);display:flex;flex-direction:column;align-items:center;padding:16px;gap:12px;width:calc(100% - 32px);max-width:500px}.starter-queries.svelte-1s2fnws{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:var(--spacing-md);width:100%}.starter-query-button.svelte-1s2fnws{display:flex;flex-direction:column;align-items:flex-start;padding:var(--spacing-lg);border:none;border-radius:var(--radius-lg);background-color:var(--block-background-fill);cursor:pointer;transition:all .15s ease-in-out;width:100%;gap:var(--spacing-sm);border:var(--block-border-width) solid var(--block-border-color);transform:translateY(0);text-align:left;line-height:1.4;word-wrap:break-word;white-space:normal;font-size:var(--text-md)}.starter-query-button.svelte-1s2fnws:hover{transform:translateY(-2px);background-color:var(--color-accent-soft)}.starter-query-button.svelte-1s2fnws:active{transform:translateY(0)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DRTA1kwo.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DRTA1kwo.js new file mode 100644 index 0000000000000000000000000000000000000000..fdb05a09b0f723b3b665bbf9590ddc2b3f09214c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DRTA1kwo.js @@ -0,0 +1 @@ +import{p as x,i as y,g as A,r as T}from"./i18n-Dnhn5Rxr.js";import{R as B,S as I,w as s,a as P,T as U,X as k,a5 as u,W as z,u as v,v as W,y as L,x as w,M}from"./index-DWyDLubb.js";import{s as R}from"./clone-BkeCM4Nl.js";import{G as X}from"./utils.svelte-CCyS_0CY.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as j}from"./BlockLabel-CZd21Hkw.js";import{E as q}from"./Empty-BIB2W5at.js";import{F}from"./File-BHHIF0P7.js";import{I as C}from"./IconButtonWrapper-D0s9l4wW.js";import{F as D,a as H}from"./FileUpload-yTZ4bq_L.js";import{B as J}from"./Block-J4oodUWp.js";import{U as K}from"./UploadText-oRnvaG4b.js";import{S as N}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{default as xe}from"./Example-m_TAV22D.js";import"./snippet-BWgYNF9D.js";import"./Upload-HitvyI7k.js";import"./actions-CLThs9VH.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./DownloadLink-TGTaev7f.js";import"./index-B_pwUImq.js";/* empty css */var O=z(" ",1);function Q(m,t){B(t,!0);let d=x(t,"buttons",3,null),i=x(t,"on_custom_button_click",3,null);var c=O(),_=I(c);{var e=a=>{C(a,{get buttons(){return d()},get on_custom_button_click(){return i()}})};y(_,a=>{t.show_label&&d()&&d().length>0&&a(e)})}var p=k(_,2);{let a=u(()=>t.value===null),l=u(()=>t.label||"File");j(p,{get show_label(){return t.show_label},get float(){return s(a)},get Icon(){return F},get label(){return s(l)}})}var g=k(p,2);{var h=a=>{D(a,{get i18n(){return t.i18n},get selectable(){return t.selectable},get value(){return t.value},get height(){return t.height},$$events:{select(...l){t.on_select?.apply(this,l)},download(...l){t.on_download?.apply(this,l)}}})},f=a=>{q(a,{unpadded_box:!0,size:"large",children:(l,b)=>{F(l)},$$slots:{default:!0}})};y(g,a=>{t.value&&(!Array.isArray(t.value)||t.value.length>0)?a(h):a(f,!1)})}P(m,c),U()}var V=z(" ",1);function we(m,t){B(t,!0);const d=T(t,["$$slots","$$events","$$legacy"]);let i=v(null),c=v(!1);class _ extends X{async get_data(){return s(i)&&(await s(i),await M()),await super.get_data()}}const e=new _(d);let p=v(W(e.props.value));L(()=>{s(p)!==e.props.value&&(w(p,e.props.value,!0),e.dispatch("change",R(e.props.value)))});{let g=u(()=>e.props.value?"solid":"dashed"),h=u(()=>s(c)?"focus":"base");J(m,{get visible(){return e.shared.visible},get variant(){return s(g)},get border_mode(){return s(h)},padding:!1,get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},allow_overflow:!1,children:(f,a)=>{var l=V(),b=I(l);{let o=u(()=>e.shared.loading_status?.status||"complete");N(b,A({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{get status(){return s(o)},on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}))}var E=k(b,2);{var G=o=>{Q(o,{on_select:({detail:n})=>e.dispatch("select",n),on_download:({detail:n})=>e.dispatch("download",n),get selectable(){return e.props._selectable},get value(){return e.props.value},get label(){return e.shared.label},get show_label(){return e.shared.show_label},get height(){return e.props.height},get i18n(){return e.i18n},get buttons(){return e.props.buttons},on_custom_button_click:n=>{e.dispatch("custom_button_click",{id:n})}})},S=o=>{{let n=u(()=>e.props.height??void 0);H(o,{upload:(...r)=>e.shared.client.upload(...r),stream_handler:(...r)=>e.shared.client.stream(...r),get label(){return e.shared.label},get show_label(){return e.shared.show_label},get value(){return e.props.value},get file_count(){return e.props.file_count},get file_types(){return e.props.file_types},get selectable(){return e.props._selectable},get height(){return s(n)},get root(){return e.shared.root},get allow_reordering(){return e.props.allow_reordering},get max_file_size(){return e.shared.max_file_size},get buttons(){return e.props.buttons},on_custom_button_click:r=>{e.dispatch("custom_button_click",{id:r})},onchange:r=>{e.props.value=r},ondrag:r=>w(c,r,!0),onclear:()=>e.dispatch("clear"),onselect:r=>e.dispatch("select",r),onupload:()=>e.dispatch("upload"),onerror:r=>{e.shared.loading_status=e.shared.loading_status||{},e.shared.loading_status.status="error",e.dispatch("error",r)},ondelete:r=>{e.dispatch("delete",r)},get i18n(){return e.i18n},get upload_promise(){return s(i)},set upload_promise(r){w(i,r,!0)},children:(r,Y)=>{K(r,{get i18n(){return e.i18n},type:"file"})},$$slots:{default:!0}})}};y(E,o=>{e.shared.interactive?o(S,!1):o(G)})}P(f,l)},$$slots:{default:!0}})}U()}export{xe as BaseExample,Q as BaseFile,H as BaseFileUpload,D as FilePreview,we as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Dd60luDZ.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Dd60luDZ.css new file mode 100644 index 0000000000000000000000000000000000000000..01db82b3c7a7718cc8431652e158e4b9c832efa2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Dd60luDZ.css @@ -0,0 +1 @@ +.gradio-container-6-13-0 Tables */ table,.gradio-container-6-13-0 tr,.gradio-container-6-13-0 td,.gradio-container-6-13-0 th{margin-top:var(--spacing-sm);margin-bottom:var(--spacing-sm);padding:var(--spacing-xl)}.gradio-container-6-13-0 .md code,.gradio-container-6-13-0 .md pre{background:none;font-family:var(--font-mono);font-size:var(--text-md);text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;tab-size:2;hyphens:none}.gradio-container-6-13-0 .md pre[class*=language-]::selection,.gradio-container-6-13-0 .md pre[class*=language-] ::selection,.gradio-container-6-13-0 .md code[class*=language-]::selection,.gradio-container-6-13-0 .md code[class*=language-] ::selection{text-shadow:none;background:#b3d4fc}.gradio-container-6-13-0 .md pre{padding:1em;margin:.5em 0;overflow:auto;position:relative;margin-top:var(--spacing-sm);margin-bottom:var(--spacing-sm);box-shadow:none;border:none;border-radius:var(--radius-md);background:var(--code-background-fill);font-family:var(--font-mono);text-shadow:none;border-radius:var(--radius-sm);white-space:nowrap;display:block;white-space:pre}.gradio-container-6-13-0 .md :not(pre)>code{padding:.1em;border-radius:var(--radius-xs);white-space:normal;background:var(--code-background-fill);border:1px solid var(--panel-border-color);padding:var(--spacing-xxs) var(--spacing-xs)}.gradio-container-6-13-0 .md .token.comment,.gradio-container-6-13-0 .md .token.prolog,.gradio-container-6-13-0 .md .token.doctype,.gradio-container-6-13-0 .md .token.cdata{color:#708090}.gradio-container-6-13-0 .md .token.punctuation{color:#999}.gradio-container-6-13-0 .md .token.namespace{opacity:.7}.gradio-container-6-13-0 .md .token.property,.gradio-container-6-13-0 .md .token.tag,.gradio-container-6-13-0 .md .token.boolean,.gradio-container-6-13-0 .md .token.number,.gradio-container-6-13-0 .md .token.constant,.gradio-container-6-13-0 .md .token.symbol,.gradio-container-6-13-0 .md .token.deleted{color:#905}.gradio-container-6-13-0 .md .token.selector,.gradio-container-6-13-0 .md .token.attr-name,.gradio-container-6-13-0 .md .token.string,.gradio-container-6-13-0 .md .token.char,.gradio-container-6-13-0 .md .token.builtin,.gradio-container-6-13-0 .md .token.inserted{color:#690}.gradio-container-6-13-0 .md .token.atrule,.gradio-container-6-13-0 .md .token.attr-value,.gradio-container-6-13-0 .md .token.keyword{color:#07a}.gradio-container-6-13-0 .md .token.function,.gradio-container-6-13-0 .md .token.class-name{color:#dd4a68}.gradio-container-6-13-0 .md .token.regex,.gradio-container-6-13-0 .md .token.important,.gradio-container-6-13-0 .md .token.variable{color:#e90}.gradio-container-6-13-0 .md .token.important,.gradio-container-6-13-0 .md .token.bold{font-weight:700}.gradio-container-6-13-0 .md .token.italic{font-style:italic}.gradio-container-6-13-0 .md .token.entity{cursor:help}.dark .md .token.comment,.dark .md .token.prolog,.dark .md .token.cdata{color:#5c6370}.dark .md .token.doctype,.dark .md .token.punctuation,.dark .md .token.entity{color:#abb2bf}.dark .md .token.attr-name,.dark .md .token.class-name,.dark .md .token.boolean,.dark .md .token.constant,.dark .md .token.number,.dark .md .token.atrule{color:#d19a66}.dark .md .token.keyword{color:#c678dd}.dark .md .token.property,.dark .md .token.tag,.dark .md .token.symbol,.dark .md .token.deleted,.dark .md .token.important{color:#e06c75}.dark .md .token.selector,.dark .md .token.string,.dark .md .token.char,.dark .md .token.builtin,.dark .md .token.inserted,.dark .md .token.regex,.dark .md .token.attr-value,.dark .md .token.attr-value>.token.punctuation{color:#98c379}.dark .md .token.variable,.dark .md .token.operator,.dark .md .token.function{color:#61afef}.dark .md .token.url{color:#56b6c2}.header.svelte-1kuiw39{display:flex;justify-content:space-between;align-items:center;padding:.7rem 1rem;border-bottom:1px solid var(--table-border-color)}.title.svelte-1kuiw39{font-size:var(--scale-0);font-weight:600;color:var(--body-text-color)}.toggle-all.svelte-1kuiw39{background:none;border:none;cursor:pointer;padding:0;color:var(--body-text-color);font-size:.7em;line-height:1;opacity:.7;transition:opacity .2s ease,transform .3s ease}.toggle-all.svelte-1kuiw39:hover{opacity:1}.wrap[data-all-open=true] .toggle-all.svelte-1kuiw39{transform:rotate(180deg)}.default.svelte-1kuiw39 pre,.default.svelte-1kuiw39 .highlight{display:inline-block}.wrap.svelte-1kuiw39 pre,.wrap.svelte-1kuiw39 .highlight{margin:0!important;background:transparent!important;font-family:var(--font-mono);font-weight:400;padding:0!important}.wrap.svelte-1kuiw39 pre a{color:var(--link-text-color-hover);text-decoration:underline}.wrap.svelte-1kuiw39 pre a:hover{color:var(--link-text-color-hover)}.default.svelte-1kuiw39>span:where(.svelte-1kuiw39){text-transform:uppercase;font-size:.7rem;font-weight:600}.default.svelte-1kuiw39>code:where(.svelte-1kuiw39){border:none}code.svelte-1kuiw39{background:none;font-family:var(--font-mono)}.wrap.svelte-1kuiw39{padding:0rem;border-radius:5px;overflow:hidden;position:relative;margin:0;box-shadow:var(--block-shadow);border-width:var(--block-border-width);border-color:var(--block-border-color);border-radius:var(--block-radius);width:100%;line-height:var(--line-sm);color:var(--body-text-color);display:grid;grid-template-rows:auto 1fr}.type.svelte-1kuiw39{position:relative;padding:.7rem 1rem .7rem 2rem;background:var(--table-odd-background-fill);border-bottom:0px solid var(--table-border-color);list-style:none}.type.svelte-1kuiw39:after{content:"▼";position:absolute;top:50%;right:15px;transform:translateY(-50%);transition:transform .3s ease;font-size:.7em;opacity:.7}details[open].svelte-1kuiw39 .type:where(.svelte-1kuiw39):after{transform:translateY(-50%) rotate(180deg)}.default.svelte-1kuiw39{padding:.2rem 1rem .3rem;border-bottom:1px solid var(--table-border-color);background:var(--block-background-fill)}.default.last.svelte-1kuiw39{border-bottom:none}.description.svelte-1kuiw39{padding:.7rem 1rem;font-size:var(--scale-00);font-family:var(--font-sans);background:var(--block-background-fill)}.param.svelte-1kuiw39{border-bottom:1px solid var(--table-border-color)}.param.svelte-1kuiw39:last-child{border-bottom:none}details[open].svelte-1kuiw39 .type:where(.svelte-1kuiw39){border-bottom-width:1px}.param.md.svelte-1kuiw39 code:where(.svelte-1kuiw39){background:none}details.svelte-1kuiw39>summary:where(.svelte-1kuiw39){cursor:pointer}details.svelte-1kuiw39>summary:where(.svelte-1kuiw39)::-webkit-details-marker{display:none}.param-link.svelte-1kuiw39{opacity:0;position:absolute;left:8px;top:50%;transform:translateY(-50%);transition:opacity .2s;color:var(--body-text-color);text-decoration:none}.link-icon.svelte-1kuiw39{font-size:14px}.type.svelte-1kuiw39:hover .param-link:where(.svelte-1kuiw39){opacity:.7}.param-link.svelte-1kuiw39:hover{opacity:1!important}.param-content.svelte-1kuiw39{overflow-y:auto} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Dfc9uZ1M.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Dfc9uZ1M.js new file mode 100644 index 0000000000000000000000000000000000000000..1a77ded1f9555d6d5f18803664b54a1aa30c7147 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Dfc9uZ1M.js @@ -0,0 +1 @@ +import{p as Y,e as ke,i as f,b as P,k as ze,u as Se,r as we,g as Ae}from"./i18n-Dnhn5Rxr.js";import{R as _e,a1 as le,G as w,w as e,a2 as Be,a6 as te,S as d,a as o,T as ve,a3 as Z,U as C,z as l,x as R,V as A,Y as h,X as x,t as U,a0 as I,W as i,Z as J,a8 as $e,ad as oe}from"./index-DWyDLubb.js";import{G as Ge}from"./utils.svelte-CCyS_0CY.js";import{B as Ve}from"./Block-J4oodUWp.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{S as Ee}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./clone-BkeCM4Nl.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var Ie=i(','),Je=i(" ",1),Ke=i(','),Oe=i(' ',1),Te=i(' :',1),qe=i(','),Le=i(" ",1),Ne=i("
      • "),Pe=i(','),Re=i('
          ',1);function ie(D,g){_e(g,!1);let r=Y(g,"json",12),t=Y(g,"depth",12,1/0),B=Y(g,"_cur",12,0),b=Y(g,"_last",12,!0),c=Z([]),v=Z(!1),n=Z(["",""]),k=Z(!1);function $(a){return a===null?"null":typeof a}function G(a){return JSON.stringify(a)}function ue(a){switch($(a)){case"function":return"f () {...}";case"symbol":return a.toString();default:return G(a)}}function W(){R(k,!e(k))}function F(a){a instanceof KeyboardEvent&&["Enter"," "].includes(a.key)&&W()}le(()=>(w(r()),e(v)),()=>{R(c,$(r())==="object"?Object.keys(r()):[]),R(v,Array.isArray(r())),R(n,e(v)?["[","]"]:["{","}"])}),le(()=>(w(t()),w(B())),()=>{R(k,t(){var K=Je(),V=d(K);let X;var H=A(V);h(V);var m=x(V);{var z=s=>{var S=Ie();o(s,S)};f(m,s=>{b()||s(z)})}U(()=>{X=P(V,1,"_jsonBkt empty svelte-zxj9ye",null,X,{isArray:e(v)}),I(H,`${e(n),l(()=>e(n)[0])??""}${e(n),l(()=>e(n)[1])??""}`)}),o(a,K)},de=a=>{var K=te(),V=d(K);{var X=m=>{var z=Oe(),s=d(z);let S;var M=A(s);h(s);var O=x(s);{var y=E=>{var Q=Ke();o(E,Q)};f(O,E=>{!b()&&e(k)&&E(y)})}U(()=>{S=P(s,1,"_jsonBkt svelte-zxj9ye",null,S,{isArray:e(v)}),I(M,`${e(n),l(()=>e(n)[0])??""}...${e(n),l(()=>e(n)[1])??""}`)}),J("click",s,W),J("keydown",s,F),o(m,z)},H=m=>{var z=Re(),s=d(z);let S;var M=A(s,!0);h(s);var O=x(s,2);ze(O,5,()=>e(c),Se,(T,_,re)=>{var ee=Ne(),ne=A(ee);{var ye=u=>{var j=Te(),p=d(j),q=A(p,!0);h(p),$e(),U(L=>I(q,L),[()=>(e(_),l(()=>G(e(_))))]),o(u,j)};f(ne,u=>{e(v)||u(ye)})}var je=x(ne,2);{var he=u=>{var j=te(),p=d(j);{let q=oe(()=>B()+1),L=oe(()=>(e(c),l(()=>re===e(c).length-1)));ie(p,{get json(){return w(r()),e(_),l(()=>r()[e(_)])},get depth(){return t()},get _cur(){return e(q)},get _last(){return e(L)}})}o(u,j)},xe=u=>{var j=Le(),p=d(j),q=A(p,!0);h(p);var L=x(p);{var be=N=>{var ae=qe();o(N,ae)};f(L,N=>{e(c),l(()=>re{P(p,1,`_jsonVal ${N??""}`,"svelte-zxj9ye"),I(q,ae)},[()=>(w(r()),e(_),l(()=>$(r()[e(_)]))),()=>(w(r()),e(_),l(()=>ue(r()[e(_)])))]),o(u,j)};f(je,u=>{w(r()),e(_),l(()=>$(r()[e(_)])==="object")?u(he):u(xe,!1)})}h(ee),o(T,ee)}),h(O);var y=x(O,2);let E;var Q=A(y,!0);h(y);var ge=x(y);{var me=T=>{var _=Pe();o(T,_)};f(ge,T=>{b()||T(me)})}U(()=>{S=P(s,1,"_jsonBkt svelte-zxj9ye",null,S,{isArray:e(v)}),I(M,(e(n),l(()=>e(n)[0]))),E=P(y,1,"_jsonBkt svelte-zxj9ye",null,E,{isArray:e(v)}),I(Q,(e(n),l(()=>e(n)[1])))}),J("click",s,W),J("keydown",s,F),J("click",y,W),J("keydown",y,F),o(m,z)};f(V,m=>{e(k)?m(X):m(H,!1)},!0)}o(a,K)};f(pe,a=>{e(c),l(()=>!e(c).length)?a(fe):a(de,!1)})}return o(D,se),ve(ce)}var Ue=i(" ",1);function ta(D,g){_e(g,!0);const r=we(g,["$$slots","$$events","$$legacy"]),t=new Ge(r);Ve(D,{get visible(){return t.shared.visible},get elem_id(){return t.shared.elem_id},get elem_classes(){return t.shared.elem_classes},container:!0,get scale(){return t.shared.scale},get min_width(){return t.shared.min_width},children:(b,c)=>{var v=Ue(),n=d(v);{var k=G=>{Ee(G,Ae({get autoscroll(){return t.shared.autoscroll},get i18n(){return t.i18n}},()=>t.shared.loading_status,{on_clear_status:()=>t.dispatch("clear_status",t.shared.loading_status)}))};f(n,G=>{t.shared.loading_status&&G(k)})}var $=x(n,2);ie($,{get json(){return t.props.value}}),o(b,v)},$$slots:{default:!0}}),ve()}export{ta as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Dg9ut_M4.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Dg9ut_M4.css new file mode 100644 index 0000000000000000000000000000000000000000..906663e2c49b4680d4d4cc6ab200ae5725edbb5e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Dg9ut_M4.css @@ -0,0 +1 @@ +.label-input.svelte-14ic1z3{margin-top:1px;margin-left:4px;border:none;border-radius:var(--radius-xs);padding:1px 5px;color:var(--color-white);font-weight:var(--weight-bold);font-size:var(--text-sm);text-transform:uppercase;line-height:1}.label-input.svelte-14ic1z3::placeholder{color:#ffffff80}.container.svelte-1akrbo3{display:flex;flex-direction:column;gap:var(--spacing-sm);padding:var(--block-padding)}.legend.svelte-1akrbo3,.score-legend.svelte-1akrbo3{display:flex;flex-wrap:wrap;gap:var(--spacing-sm)}.legend-item.svelte-1akrbo3{cursor:pointer;border:none;border-radius:var(--radius-xs);padding:0 var(--size-2);font-weight:var(--weight-semibold);color:#000}.score-legend.svelte-1akrbo3{justify-content:space-between;border-radius:var(--radius-xs);background:linear-gradient(to right,var(--color-purple),transparent,var(--color-red));padding:var(--size-1) var(--size-2);font-weight:var(--weight-semibold)}.textfield.svelte-1akrbo3{display:flex;flex-wrap:wrap;line-height:var(--scale-4);word-break:break-all}.line-break.svelte-1akrbo3{flex-basis:100%;height:0}.token-container.svelte-1akrbo3{position:relative}.token.svelte-1akrbo3{transition:.15s;border-radius:var(--radius-xs)}.token.highlighted.svelte-1akrbo3{cursor:pointer;padding:var(--size-0-5) var(--size-1);margin-left:var(--size-1);margin-right:var(--size-2)}.token.highlighted.transparent.svelte-1akrbo3{padding:var(--size-0-5) var(--size-0-5);margin:0;outline:1px solid transparent}.token.highlighted.transparent.svelte-1akrbo3:hover{outline-color:var(--neutral-400)}.dark .token.highlighted.transparent.svelte-1akrbo3:hover{outline-color:var(--neutral-500)}.token.dimmed.svelte-1akrbo3{color:var(--body-text-color)}.text.svelte-1akrbo3{white-space:pre-wrap}.text.unlabeled.svelte-1akrbo3{color:var(--body-text-color)}.score-token.svelte-1akrbo3 .text:where(.svelte-1akrbo3){color:var(--body-text-color)}.label.svelte-1akrbo3{margin-left:4px;border-radius:var(--radius-xs);padding:1px 5px;color:var(--color-white);font-weight:var(--weight-bold);text-transform:uppercase;font-size:70%;vertical-align:middle;bottom:1px;position:relative}.remove-btn.svelte-1akrbo3{display:none;position:absolute;top:0;right:0;width:var(--size-3);height:var(--size-3);border:none;border-radius:50%;background:var(--neutral-400);color:#fff;font-size:10px;cursor:pointer;justify-content:center;align-items:center}.dark .remove-btn.svelte-1akrbo3{background:var(--neutral-500);color:var(--neutral-950)}.remove-btn.svelte-1akrbo3 svg{width:var(--size-1-5);height:var(--size-1-5)}.remove-btn.svelte-1akrbo3:hover{background:var(--neutral-500)}.dark .remove-btn.svelte-1akrbo3:hover{background:var(--neutral-400)}.token-container.svelte-1akrbo3:hover .remove-btn:where(.svelte-1akrbo3),.token-container.svelte-1akrbo3:focus-within .remove-btn:where(.svelte-1akrbo3){display:flex} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DpH7sR6h.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DpH7sR6h.css new file mode 100644 index 0000000000000000000000000000000000000000..902ecc0518110a315fc266aacc0e4f8757b1e1a6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DpH7sR6h.css @@ -0,0 +1 @@ +.wrap.svelte-16f20a1{display:inline-block;width:var(--size-full);max-width:var(--size-full);color:var(--body-text-color)}.hide.svelte-16f20a1{display:none}.gallery.svelte-16f20a1{display:flex;flex-wrap:wrap;gap:var(--spacing-lg)}.gallery-item.svelte-16f20a1{border:1px solid var(--border-color-primary);border-radius:var(--button-large-radius);overflow:hidden}.gallery-item.svelte-16f20a1:hover{border-color:var(--border-color-accent);background:var(--table-row-focus)}.table-wrap.svelte-16f20a1{border:1px solid var(--border-color-primary);border-radius:var(--table-radius);width:var(--size-full);table-layout:auto;overflow-x:auto;line-height:var(--line-sm);color:var(--table-text-color)}table.svelte-16f20a1{width:var(--size-full)}.tr-head.svelte-16f20a1{box-shadow:var(--shadow-drop-lg);border-bottom:1px solid var(--border-color-primary)}.tr-head.svelte-16f20a1>:where(.svelte-16f20a1)+:where(.svelte-16f20a1){border-right-width:0px;border-left-width:1px;border-color:var(--border-color-primary)}th.svelte-16f20a1{padding:var(--size-2);white-space:nowrap}.tr-body.svelte-16f20a1{cursor:pointer;border-bottom:1px solid var(--border-color-primary);background:var(--table-even-background-fill)}.tr-body.svelte-16f20a1:last-child{border:none}.tr-body.svelte-16f20a1:nth-child(odd){background:var(--table-odd-background-fill)}.tr-body.svelte-16f20a1:hover{background:var(--table-row-focus)}.tr-body.svelte-16f20a1>:where(.svelte-16f20a1)+:where(.svelte-16f20a1){border-right-width:0px;border-left-width:1px;border-color:var(--border-color-primary)}.tr-body.svelte-16f20a1:hover>:where(.svelte-16f20a1)+:where(.svelte-16f20a1){border-color:var(--border-color-accent)}td.svelte-16f20a1{padding:var(--size-2);text-align:center}.paginate.svelte-16f20a1{display:flex;justify-content:center;align-items:center;gap:var(--spacing-sm);margin-top:var(--size-2);color:var(--block-label-text-color);font-size:var(--text-sm)}button.current-page.svelte-16f20a1{font-weight:var(--weight-bold)}.label.svelte-bnxc4d{display:flex;align-items:center;margin-bottom:var(--size-2);color:var(--block-label-text-color);font-weight:var(--block-label-text-weight);font-size:var(--block-label-text-size);line-height:var(--line-sm)}svg.svelte-bnxc4d{margin-right:var(--size-1)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Ds3FAhOq.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Ds3FAhOq.css new file mode 100644 index 0000000000000000000000000000000000000000..6eb4a24a5e8e464315752cd1dab9f179e3c1c866 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Ds3FAhOq.css @@ -0,0 +1 @@ +div.svelte-dmtrd3{display:flex;flex-direction:column;position:relative;border:none;border-radius:var(--radius-sm);width:100%;box-sizing:border-box}.grow-children.svelte-dmtrd3>.column>.column{flex-grow:1} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DszFtJDg.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DszFtJDg.js new file mode 100644 index 0000000000000000000000000000000000000000..346b6b2028e96b1fed83a8ab8b3cca52d1e63aa0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-DszFtJDg.js @@ -0,0 +1 @@ +import{p as r,e as F,s as J,a as H,b as K,f as L,q as k,m as Q,r as X}from"./i18n-Dnhn5Rxr.js";import{R as M,a4 as Z,ay as ee,aa as te,a1 as S,G as a,w as u,a2 as se,a6 as N,S as O,a as T,t as ae,z as re,T as P,a3 as q,U as l,V as le,ad as ie,W as ne,x as C,M as oe,Y as de}from"./index-DWyDLubb.js";import{G as ce}from"./utils.svelte-CCyS_0CY.js";import{T as _e}from"./Walkthrough.svelte_svelte_type_style_lang-Bw7iC7Yg.js";import{B as me}from"./Index.svelte_svelte_type_style_lang-BKODC18H.js";import"./clone-BkeCM4Nl.js";import"./event-modifiers-CdEA5IGF.js";import"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./html-Ih_5QVTo.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./snippet-BWgYNF9D.js";import"./index-B_pwUImq.js";import"./Clear-BF6j078A.js";var ue=ne('
          ');function pe(y,t){M(t,!1);const v=()=>k(R,"$selected_tab_index",d),s=()=>k(E,"$selected_tab",d),[d,w]=Q(),c=q();let i=r(t,"elem_id",12,""),f=r(t,"elem_classes",28,()=>[]),o=r(t,"label",12),_=r(t,"id",28,()=>({})),p=r(t,"visible",12),b=r(t,"interactive",12),g=r(t,"order",12),n=r(t,"scale",12),h=r(t,"component_id",12);const z=Z(),{register_tab:A,unregister_tab:D,selected_tab:E,selected_tab_index:R}=ee(_e);let x=q();function U(e,$){return e=JSON.parse(e),A(e,$)}te(()=>()=>D({label:o(),id:_(),elem_id:i()},g())),S(()=>(a(o()),a(_()),a(i()),a(p()),a(b()),a(n()),a(h())),()=>{C(c,JSON.stringify({label:o(),id:_(),elem_id:i(),visible:p(),interactive:b(),scale:n(),component_id:h()}))}),S(()=>(u(c),a(g())),()=>{C(x,U(u(c),g()))}),S(()=>(v(),u(x),a(o())),()=>{v()===u(x)&&oe().then(()=>z("select",{value:o(),index:u(x)}))}),se();var V={get elem_id(){return i()},set elem_id(e){i(e),l()},get elem_classes(){return f()},set elem_classes(e){f(e),l()},get label(){return o()},set label(e){o(e),l()},get id(){return _()},set id(e){_(e),l()},get visible(){return p()},set visible(e){p(e),l()},get interactive(){return b()},set interactive(e){b(e),l()},get order(){return g()},set order(e){g(e),l()},get scale(){return n()},set scale(e){n(e),l()},get component_id(){return h()},set component_id(e){h(e),l()}};F();var m=ue();let B,G;var W=le(m);{let e=ie(()=>n()>=1?n():null);me(W,{get scale(){return u(e)},children:($,ge)=>{var I=N(),j=O(I);J(j,t,"default",{}),T($,I)},$$slots:{default:!0}})}de(m),ae(e=>{H(m,"id",i()),B=K(m,1,`tabitem ${e??""}`,"svelte-dmtrd3",B,{"grow-children":n()>=1}),G=L(m,"",G,{display:s()===_()&&p()!==!1?"flex":"none","flex-grow":n()})},[()=>(a(f()),re(()=>f().join(" ")))]),T(y,m);var Y=P(V);return w(),Y}function qe(y,t){M(t,!0);let v=X(t,["$$slots","$$events","$$legacy"]);const s=new ce(v);pe(y,{get elem_id(){return s.shared.elem_id},get elem_classes(){return s.shared.elem_classes},get label(){return s.shared.label},get visible(){return s.shared.visible},get interactive(){return s.shared.interactive},get id(){return s.props.id},get order(){return s.props.order},get scale(){return s.props.scale},get component_id(){return s.props.component_id},$$events:{select:({detail:d})=>s.dispatch("select",d)},children:(d,w)=>{var c=N(),i=O(c);J(i,t,"default",{}),T(d,c)},$$slots:{default:!0}}),P()}export{pe as BaseTabItem,qe as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-E6_HM5Fx.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-E6_HM5Fx.js new file mode 100644 index 0000000000000000000000000000000000000000..c8e9c40752b6f8f72e70a692fa6583d05ac395de --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-E6_HM5Fx.js @@ -0,0 +1 @@ +import{g as L,i as $,k as M,r as N,u as O,v as Z,b as Q,a as j,t as z}from"./i18n-Dnhn5Rxr.js";import{R as U,y as ee,S,a6 as C,a as v,w as c,X as b,a5 as x,T as te,W as T,t as B,a0 as I,Z as g,V as f,a7 as ae,at as se,Y as _}from"./index-DWyDLubb.js";import{s as le}from"./clone-BkeCM4Nl.js";import{G as re}from"./utils.svelte-CCyS_0CY.js";import{B as oe}from"./Block-J4oodUWp.js";import{B as ie}from"./BlockTitle-BMm9LakX.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{I as ce}from"./IconButtonWrapper-D0s9l4wW.js";import{S as ne}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{d as pe}from"./index-tFQomdd2.js";import"./Info-Dzjhnd64.js";import"./html-Ih_5QVTo.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./index-B_pwUImq.js";var ue=T('
          '),de=T(''),ve=T('
          ',1);function Ge(F,A){U(A,!0);let H=N(A,["$$slots","$$events","$$legacy"]),e=new re(H);function G(l){e.props.value.includes(l)?e.props.value=e.props.value.filter(p=>p!==l):e.props.value=[...e.props.value,l],e.dispatch("input")}function P(){const l=e.props.choices.map(([,p])=>p);e.props.value.length===l.length?e.props.value=[]:e.props.value=l.slice(),e.dispatch("input")}let W=x(()=>{const l=e.props.choices.map(([,p])=>p);return e.props.value.length===0?"unchecked":e.props.value.length===l.length?"checked":"indeterminate"}),q=x(()=>!e.shared.interactive),D=e.props.value;ee(()=>{e.props.value,!pe(D,e.props.value)&&(D=e.props.value,e.dispatch("change",le(e.props.value)))}),oe(F,{get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},type:"fieldset",get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},children:(l,p)=>{var E=ve(),R=S(E);ne(R,L({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var V=b(R,2);{var J=n=>{ce(n,{get buttons(){return e.props.buttons},on_custom_button_click:h=>{e.dispatch("custom_button_click",{id:h})}})};$(V,n=>{e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0&&n(J)})}var X=b(V,2);{let n=x(()=>e.shared.show_label||e.props.show_select_all&&e.shared.interactive);ie(X,{get show_label(){return c(n)},get info(){return e.props.info},children:(h,k)=>{var m=C(),y=S(m);{var s=r=>{var t=ue(),o=f(t),i=f(o);z(i),_(o);var a=b(o,2),d=f(a,!0);_(a),_(t),B(()=>{Z(i,c(W)==="checked"),i.indeterminate=c(W)==="indeterminate",I(d,e.shared.show_label?e.shared.label:"Select All")}),g("change",i,P),g("click",a,P),v(r,t)},u=r=>{var t=C(),o=S(t);{var i=a=>{var d=ae();B(w=>I(d,w),[()=>e.shared.label||e.i18n("checkbox.checkbox_group")]),v(a,d)};$(o,a=>{e.shared.show_label&&a(i)},!0)}v(r,t)};$(y,r=>{e.props.show_select_all&&e.shared.interactive?r(s):r(u,!1)})}v(h,m)},$$slots:{default:!0}})}var Y=b(X,2);M(Y,21,()=>e.props.choices,O,(n,h,k)=>{var m=x(()=>se(c(h),2));let y=()=>c(m)[0],s=()=>c(m)[1];var u=de();let r;var t=f(u);z(t);var o=b(t,2),i=f(o,!0);_(o),_(u),B((a,d,w,K)=>{r=Q(u,1,"svelte-yb2gcx",null,r,a),t.disabled=c(q),Z(t,d),j(t,"name",w),j(t,"title",K),I(i,y())},[()=>({disabled:c(q),selected:e.props.value.includes(s())}),()=>e.props.value.includes(s()),()=>s()?.toString(),()=>s()?.toString()]),g("change",t,()=>G(s())),g("input",t,a=>e.dispatch("select",{index:k,value:s(),selected:a.currentTarget.checked})),g("keydown",t,a=>{a.key==="Enter"&&(G(s()),e.dispatch("select",{index:k,value:s(),selected:!e.props.value.includes(s())}))}),v(n,u)}),_(Y),v(l,E)},$$slots:{default:!0}}),te()}export{Ge as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-EYuwUe6R.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-EYuwUe6R.css new file mode 100644 index 0000000000000000000000000000000000000000..847943b28eaeef67c580e822087f3b8b66a803c9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-EYuwUe6R.css @@ -0,0 +1 @@ +.picker-container.svelte-s8mqj7{position:fixed;z-index:9999;box-shadow:var(--shadow-drop-lg);border-radius:var(--radius-lg);background:var(--background-fill-primary);border:1px solid var(--border-color-primary)}.picker.svelte-s8mqj7{padding:var(--size-3);min-width:280px}.picker-header.svelte-s8mqj7{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--size-3)}.nav-button.svelte-s8mqj7{background:none;border:none;font-size:var(--text-lg);padding:var(--size-1);border-radius:var(--radius-sm);transition:var(--button-transition);cursor:pointer;color:var(--body-text-color-subdued)}.nav-button.svelte-s8mqj7:hover{background:var(--button-secondary-background-fill-hover);color:var(--body-text-color)}.month-year.svelte-s8mqj7{font-weight:var(--weight-semibold);font-size:var(--text-base);color:var(--body-text-color)}.calendar-grid.svelte-s8mqj7{margin-bottom:var(--size-3)}.weekdays.svelte-s8mqj7{display:grid;grid-template-columns:repeat(7,1fr);gap:1px;margin-bottom:var(--size-2)}.weekday.svelte-s8mqj7{text-align:center;font-size:var(--text-sm);font-weight:var(--weight-semibold);color:var(--body-text-color-subdued);padding:var(--size-1)}.days.svelte-s8mqj7{display:grid;grid-template-columns:repeat(7,1fr);gap:1px}.day.svelte-s8mqj7{aspect-ratio:1;border:none;background:none;border-radius:var(--radius-sm);font-size:var(--text-sm);transition:var(--button-transition);color:var(--body-text-color);cursor:pointer}.day.svelte-s8mqj7:hover{background:var(--button-secondary-background-fill-hover)}.day.other-month.svelte-s8mqj7{color:var(--body-text-color-subdued)}.day.selected.svelte-s8mqj7{background:var(--button-primary-background-fill);color:var(--button-primary-text-color)}.day.selected.svelte-s8mqj7:hover{background:var(--button-primary-background-fill-hover)}.time-picker.svelte-s8mqj7{border-top:1px solid var(--border-color-primary);padding-top:var(--size-3);margin-bottom:var(--size-3)}.time-inputs.svelte-s8mqj7{display:flex;gap:var(--size-2);justify-content:center}.time-input-group.svelte-s8mqj7{display:flex;flex-direction:column;align-items:center;gap:var(--size-1)}.time-input-group.svelte-s8mqj7 label:where(.svelte-s8mqj7){font-size:var(--text-xs);color:var(--body-text-color-subdued);font-weight:var(--weight-semibold)}.am-pm-label.svelte-s8mqj7{font-size:var(--text-xs);color:var(--body-text-color-subdued);font-weight:var(--weight-semibold)}.time-input-group.svelte-s8mqj7 input:where(.svelte-s8mqj7){width:50px;padding:var(--size-1);border:1px solid var(--input-border-color);border-radius:var(--radius-sm);text-align:center;font-size:var(--text-sm);background:var(--input-background-fill);color:var(--body-text-color)}.time-input-group.svelte-s8mqj7 input:where(.svelte-s8mqj7):focus{outline:none;border-color:var(--input-border-color-focus);box-shadow:var(--input-shadow-focus)}.am-pm-toggle.svelte-s8mqj7{width:50px;padding:var(--size-1);border:1px solid var(--button-primary-border-color);border-radius:var(--radius-sm);text-align:center;font-size:var(--text-sm);background:var(--button-primary-background-fill);color:var(--button-primary-text-color);cursor:pointer;transition:var(--button-transition)}.am-pm-toggle.svelte-s8mqj7:hover{background:var(--button-primary-background-fill-hover);border-color:var(--button-primary-border-color-hover)}.am-pm-toggle.svelte-s8mqj7:focus{outline:none;border-color:var(--button-primary-border-color-focus);box-shadow:var(--button-primary-shadow-focus)}.picker-actions.svelte-s8mqj7{display:flex;gap:var(--size-2);justify-content:space-between;align-items:center;border-top:1px solid var(--border-color-primary);padding-top:var(--size-3)}.picker-actions-right.svelte-s8mqj7{display:flex;gap:var(--size-2)}.action-button.svelte-s8mqj7{padding:var(--size-1) var(--size-3);border:1px solid var(--button-secondary-border-color);border-radius:var(--radius-sm);background:var(--button-secondary-background-fill);color:var(--button-secondary-text-color);font-size:var(--text-sm);transition:var(--button-transition);cursor:pointer}.action-button.svelte-s8mqj7:hover{background:var(--button-secondary-background-fill-hover);border-color:var(--button-secondary-border-color-hover)}.label-content.svelte-16sct4k{display:flex;justify-content:space-between;align-items:flex-start}button.svelte-16sct4k{cursor:pointer;color:var(--body-text-color-subdued)}button.svelte-16sct4k:hover{color:var(--body-text-color)}.svelte-16sct4k::placeholder{color:var(--input-placeholder-color)}.timebox.svelte-16sct4k{flex-grow:1;flex-shrink:1;display:flex;position:relative;background:var(--input-background-fill)}.timebox.svelte-16sct4k svg{height:18px}.time.svelte-16sct4k{padding:var(--input-padding);color:var(--body-text-color);font-weight:var(--input-text-weight);font-size:var(--input-text-size);line-height:var(--line-sm);outline:none;flex-grow:1;background:none;border:var(--input-border-width) solid var(--input-border-color);border-right:none;border-top-left-radius:var(--input-radius);border-bottom-left-radius:var(--input-radius);box-shadow:var(--input-shadow)}.time.svelte-16sct4k:disabled{border-right:var(--input-border-width) solid var(--input-border-color);border-top-right-radius:var(--input-radius);border-bottom-right-radius:var(--input-radius)}.time.invalid.svelte-16sct4k{color:var(--body-text-color-subdued)}.calendar.svelte-16sct4k{display:inline-flex;justify-content:center;align-items:center;transition:var(--button-transition);box-shadow:var(--button-primary-shadow);text-align:center;background:var(--button-secondary-background-fill);color:var(--button-secondary-text-color);font-weight:var(--button-large-text-weight);font-size:var(--button-large-text-size);border-top-right-radius:var(--input-radius);border-bottom-right-radius:var(--input-radius);padding:var(--size-2);border:var(--input-border-width) solid var(--input-border-color)}.calendar.svelte-16sct4k:hover{background:var(--button-secondary-background-fill-hover);box-shadow:var(--button-primary-shadow-hover)}.calendar.svelte-16sct4k:active{box-shadow:var(--button-primary-shadow-active)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-JJcQ8Ljz.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-JJcQ8Ljz.js new file mode 100644 index 0000000000000000000000000000000000000000..519d1c75ebf337112dcac35db20975a3eaa683df --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-JJcQ8Ljz.js @@ -0,0 +1 @@ +import{w as _t,p as g,e as Re,s as Ie,d as be,b as ze,f as Xe,l as Ve,c as ft,S as mt,C as pt,i as te,q as vt,m as bt,r as wt,g as qe}from"./i18n-Dnhn5Rxr.js";import{R as ye,aa as Ge,w as l,a1 as we,G as S,a2 as He,Z as tt,aw as yt,V as ie,Y as ne,X as V,a8 as xt,x as D,t as Me,a as A,T as xe,a3 as $,U as _,W as Z,a4 as Ce,M as Ne,_ as zt,S as re,z as T,ad as N,a6 as ve,u as je,a5 as de}from"./index-DWyDLubb.js";import{G as Yt}from"./utils.svelte-CCyS_0CY.js";import{b as Oe}from"./size-CtOeLwIl.js";import{b as pe}from"./misc-vsnLZ-Y1.js";import{s as Te}from"./select-BigU4G0v.js";import{d as Xt}from"./dispatch-kxCwF96_.js";import{I as Ee}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as rt}from"./BlockLabel-CZd21Hkw.js";import{D as st}from"./DownloadLink-TGTaev7f.js";import{E as it}from"./Empty-BIB2W5at.js";import{C as nt}from"./Clear-BF6j078A.js";import{D as at}from"./Download-Di2PsS6O.js";import{I as Pe}from"./Image-DrPceByI.js";import{U as Mt}from"./Undo-C2-jWGVL.js";import{I as Et}from"./IconButtonWrapper-D0s9l4wW.js";import{F as Tt}from"./FullscreenButton-sCrcy_OJ.js";import{r as Dt,l as Rt}from"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{i as Je,S as Ze}from"./index-CglBvmLb.js";import{U as Ke}from"./Upload-HitvyI7k.js";import{B as Qe}from"./Block-J4oodUWp.js";import{U as kt}from"./UploadText-oRnvaG4b.js";import"./clone-BkeCM4Nl.js";import"./snippet-BWgYNF9D.js";import"./Maximize-QH9NIRWs.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";import"./actions-CLThs9VH.js";function St(i){return i}function $e(i,e){if(i===e||i!==i)return()=>i;const t=typeof i;if(t!==typeof e||Array.isArray(i)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(i)){const s=e.map((a,r)=>$e(i[r],a));return a=>s.map(r=>r(a))}if(t==="object"){if(!i||!e)throw new Error("Object cannot be null");if(Je(i)&&Je(e)){const r=i.getTime(),o=e.getTime()-r;return f=>new Date(r+f*o)}const s=Object.keys(e),a={};return s.forEach(r=>{a[r]=$e(i[r],e[r])}),r=>{const u={};return s.forEach(o=>{u[o]=a[o](r)}),u}}if(t==="number"){const s=e-i;return a=>i+a*s}return()=>e}function It(i,e={}){const t=_t(i);let s,a=i;function r(u,o){if(a=u,i==null)return t.set(i=u),Promise.resolve();let f=s,M=!1,{delay:x=0,duration:z=400,easing:w=St,interpolate:I=$e}={...e,...o};if(z===0)return f&&(f.abort(),f=null),t.set(i=a),Promise.resolve();const C=Dt.now()+x;let c;return s=Rt(d=>{if(dz?(t.set(i=u),!1):(t.set(i=c(w(v/z))),!0)}),s.promise}return{set:r,update:(u,o)=>r(u(a,i),o),subscribe:t.subscribe}}function Pt(i){let e;for(;e=i.sourceEvent;)i=e;return i}function et(i,e){if(i=Pt(i),e===void 0&&(e=i.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var s=t.createSVGPoint();return s.x=i.clientX,s.y=i.clientY,s=s.matrixTransform(e.getScreenCTM().inverse()),[s.x,s.y]}if(e.getBoundingClientRect){var a=e.getBoundingClientRect();return[i.clientX-a.left-e.clientLeft,i.clientY-a.top-e.clientTop]}}return[i.pageX,i.pageY]}const Lt={passive:!1},De={capture:!0,passive:!1};function Ae(i){i.stopImmediatePropagation()}function Ye(i){i.preventDefault(),i.stopImmediatePropagation()}function Ct(i){var e=i.document.documentElement,t=Te(i).on("dragstart.drag",Ye,De);"onselectstart"in e?t.on("selectstart.drag",Ye,De):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Bt(i,e){var t=i.document.documentElement,s=Te(i).on("dragstart.drag",null);e&&(s.on("click.drag",Ye,De),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in t?s.on("selectstart.drag",null):(t.style.MozUserSelect=t.__noselect,delete t.__noselect)}const Se=i=>()=>i;function Fe(i,{sourceEvent:e,subject:t,target:s,identifier:a,active:r,x:u,y:o,dx:f,dy:M,dispatch:x}){Object.defineProperties(this,{type:{value:i,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:t,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:M,enumerable:!0,configurable:!0},_:{value:x}})}Fe.prototype.on=function(){var i=this._.on.apply(this._,arguments);return i===this._?this:i};function Ut(i){return!i.ctrlKey&&!i.button}function Wt(){return this.parentNode}function jt(i,e){return e??{x:i.x,y:i.y}}function At(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ot(){var i=Ut,e=Wt,t=jt,s=At,a={},r=Xt("start","drag","end"),u=0,o,f,M,x,z=0;function w(n){n.on("mousedown.drag",I).filter(s).on("touchstart.drag",d).on("touchmove.drag",v,Lt).on("touchend.drag touchcancel.drag",B).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function I(n,y){if(!(x||!i.call(this,n,y))){var Y=O(this,e.call(this,n,y),n,y,"mouse");Y&&(Te(n.view).on("mousemove.drag",C,De).on("mouseup.drag",c,De),Ct(n.view),Ae(n),M=!1,o=n.clientX,f=n.clientY,Y("start",n))}}function C(n){if(Ye(n),!M){var y=n.clientX-o,Y=n.clientY-f;M=y*y+Y*Y>z}a.mouse("drag",n)}function c(n){Te(n.view).on("mousemove.drag mouseup.drag",null),Bt(n.view,M),Ye(n),a.mouse("end",n)}function d(n,y){if(i.call(this,n,y)){var Y=n.changedTouches,X=e.call(this,n,y),R=Y.length,L,p;for(L=0;L
          ◢◢
          ');function lt(i,e){ye(e,!1);function t(b,h,W){return Math.min(Math.max(b,h),W)}let s=g(e,"position",12,.5),a=g(e,"disabled",12,!1),r=g(e,"slider_color",12,"var(--border-color-primary)"),u=g(e,"image_size",28,()=>({top:0,left:0,width:0,height:0})),o=g(e,"el",12,void 0),f=g(e,"parent_el",12,void 0),M=$(),x=$(0),z=$(!1),w=0;function I(b){w=f()?.getBoundingClientRect().width||0,b===0&&u(u().width=o()?.getBoundingClientRect().width||0,!0),D(x,t(u().width*s()+u().left,0,w))}function C(b,h){const W=Math.pow(10,h);return Math.round((b+Number.EPSILON)*W)/W}function c(b){D(x,t(b,0,w)),s(C((b-u().left)/u().width,5))}function d(b){a()||(D(z,!0),c(b.x))}function v(b){a()||c(b.x)}function B(){a()||D(z,!1)}function O(b){D(x,t(u().width*b+u().left,0,w))}Ge(()=>{I(u().width);const b=Ot().on("start",d).on("drag",v).on("end",B);Te(l(M)).call(b)}),we(()=>S(u()),()=>{I(u().width)}),we(()=>S(s()),()=>{O(s())}),He();var n={get position(){return s()},set position(b){s(b),_()},get disabled(){return a()},set disabled(b){a(b),_()},get slider_color(){return r()},set slider_color(b){r(b),_()},get image_size(){return u()},set image_size(b){u(b),_()},get el(){return o()},set el(b){o(b),_()},get parent_el(){return f()},set parent_el(b){f(b),_()}};Re();var y=$t();tt("resize",yt,()=>I(u().width));var Y=ie(y),X=ie(Y);Ie(X,e,"default",{}),ne(Y),be(Y,b=>o(b),()=>o());var R=V(Y,2);let L;var p=ie(R);let U;var K=V(ie(p));let ae;xt(),ne(p);var F=V(p,2);let G;return ne(R),be(R,b=>D(M,b),()=>l(M)),ne(y),be(y,b=>f(b),()=>f()),Me(()=>{L=ze(R,1,"outer svelte-b2bl92",null,L,{disabled:a(),grab:l(z)}),Xe(R,`transform: translateX(${l(x)??""}px)`),U=ze(p,1,"icon-wrap svelte-b2bl92",null,U,{active:l(z),disabled:a()}),ae=Xe(K,"",ae,{"--color":r()}),G=Xe(F,"",G,{"--color":r()})}),A(i,y),xe(n)}var Ft=Z("");function Le(i,e){const t=Ve(e,["children","$$slots","$$events","$$legacy"]),s=Ve(t,["src","fullscreen","fixed","transform","img_el","hidden","variant","max_height"]);ye(e,!1);let a=g(e,"src",12,void 0),r=g(e,"fullscreen",12,!1),u=g(e,"fixed",12,!1),o=g(e,"transform",12,"translate(0px, 0px) scale(1)"),f=g(e,"img_el",12,null),M=g(e,"hidden",12,!1),x=g(e,"variant",12,"upload"),z=g(e,"max_height",12,500);const w=Ce();function I(d){if(!d)return{top:0,left:0,width:0,height:0};const v=d.parentElement?.getBoundingClientRect();if(!v)return{top:0,left:0,width:0,height:0};const B=d.naturalWidth/d.naturalHeight,O=v.width/v.height;let n,y;B>O?(n=v.width,y=v.width/B):(y=v.height,n=v.height*B);const Y=(v.width-n)/2;return{top:(v.height-y)/2,left:Y,width:n,height:y}}Ge(()=>{const d=new ResizeObserver(async v=>{for(const B of v)await Ne(),w("load",I(f()))});return d.observe(f()),()=>{d.disconnect()}});var C={get src(){return a()},set src(d){a(d),_()},get fullscreen(){return r()},set fullscreen(d){r(d),_()},get fixed(){return u()},set fixed(d){u(d),_()},get transform(){return o()},set transform(d){o(d),_()},get img_el(){return f()},set img_el(d){f(d),_()},get hidden(){return M()},set hidden(d){M(d),_()},get variant(){return x()},set variant(d){x(d),_()},get max_height(){return z()},set max_height(d){z(d),_()}};Re();var c=Ft();return ft(c,()=>({src:a(),"data-testid":"imageslider-image",...s,[pt]:{fixed:u(),hidden:M(),preview:x()==="preview",slider:x()==="upload",fullscreen:r(),small:!r()},[mt]:{transform:o(),"max-height":z()&&!r()?`${z()}px`:null}}),void 0,void 0,void 0,"svelte-j3ek2n"),be(c,d=>f(d),()=>f()),zt(c),tt("load",c,()=>w("load",I(f()))),A(i,c),xe(C)}class Gt{container;image;scale;offsetX;offsetY;isDragging;lastX;lastY;initial_left_padding;initial_top_padding;initial_width;initial_height;subscribers;handleImageLoad;real_image_size={top:0,left:0,width:0,height:0};last_touch_distance;constructor(e,t){this.container=e,this.image=t,this.scale=1,this.offsetX=0,this.offsetY=0,this.isDragging=!1,this.lastX=0,this.lastY=0,this.initial_left_padding=0,this.initial_top_padding=0,this.initial_width=0,this.initial_height=0,this.subscribers=[],this.last_touch_distance=0,this.handleWheel=this.handleWheel.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleImageLoad=this.init.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.image.addEventListener("load",this.handleImageLoad),this.container.addEventListener("wheel",this.handleWheel),this.container.addEventListener("mousedown",this.handleMouseDown),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),this.container.addEventListener("touchstart",this.handleTouchStart),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("touchend",this.handleTouchEnd),new ResizeObserver(a=>{for(const r of a)r.target===this.container&&(this.handleResize(),this.get_image_size(this.image))}).observe(this.container)}handleResize(){this.init()}init(){const e=this.container.getBoundingClientRect(),t=this.image.getBoundingClientRect();this.initial_left_padding=t.left-e.left,this.initial_top_padding=t.top-e.top,this.initial_width=t.width,this.initial_height=t.height,this.reset_zoom(),this.updateTransform()}reset_zoom(){this.scale=1,this.offsetX=0,this.offsetY=0,this.updateTransform()}handleMouseDown(e){const t=this.image.getBoundingClientRect();if(e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom){if(e.preventDefault(),this.scale===1)return;this.isDragging=!0,this.lastX=e.clientX,this.lastY=e.clientY,this.image.style.cursor="grabbing"}}handleMouseMove(e){if(!this.isDragging)return;const t=e.clientX-this.lastX,s=e.clientY-this.lastY;this.offsetX+=t,this.offsetY+=s,this.lastX=e.clientX,this.lastY=e.clientY,this.updateTransform(),this.updateTransform()}handleMouseUp(){this.isDragging&&(this.constrain_to_bounds(!0),this.updateTransform(),this.isDragging=!1,this.image.style.cursor=this.scale>1?"grab":"zoom-in")}async handleWheel(e){e.preventDefault();const t=this.container.getBoundingClientRect(),s=this.image.getBoundingClientRect();if(e.clientXs.right||e.clientYs.bottom)return;const a=1.05,r=this.scale,u=-Math.sign(e.deltaY)>0?Math.min(15,r*a):Math.max(1,r/a);if(u===r)return;const o=e.clientX-t.left-this.initial_left_padding,f=e.clientY-t.top-this.initial_top_padding;this.scale=u,this.offsetX=this.compute_new_offset({cursor_position:o,current_offset:this.offsetX,new_scale:u,old_scale:r}),this.offsetY=this.compute_new_offset({cursor_position:f,current_offset:this.offsetY,new_scale:u,old_scale:r}),this.updateTransform(),this.constrain_to_bounds(),this.updateTransform(),this.image.style.cursor=this.scale>1?"grab":"zoom-in"}compute_new_position({position:e,scale:t,anchor_position:s}){return e-(e-s)*(t/this.scale)}compute_new_offset({cursor_position:e,current_offset:t,new_scale:s,old_scale:a}){return e-s/a*(e-t)}constrain_to_bounds(e=!1){if(this.scale===1){this.offsetX=0,this.offsetY=0;return}const t={top:this.real_image_size.top*this.scale+this.offsetY,left:this.real_image_size.left*this.scale+this.offsetX,width:this.real_image_size.width*this.scale,height:this.real_image_size.height*this.scale,bottom:this.real_image_size.top*this.scale+this.offsetY+this.real_image_size.height*this.scale,right:this.real_image_size.left*this.scale+this.offsetX+this.real_image_size.width*this.scale},s=this.real_image_size.left+this.real_image_size.width,a=this.real_image_size.top+this.real_image_size.height;e&&(t.top>this.real_image_size.top?this.offsetY=this.calculate_position(this.real_image_size.top,0,"y"):t.bottomthis.real_image_size.left?this.offsetX=this.calculate_position(this.real_image_size.left,0,"x"):t.rightt!==e)}notify({x:e,y:t,scale:s}){this.subscribers.forEach(a=>a({x:e,y:t,scale:s}))}handleTouchStart(e){e.preventDefault();const t=this.image.getBoundingClientRect(),s=e.touches[0];if(s.clientX>=t.left&&s.clientX<=t.right&&s.clientY>=t.top&&s.clientY<=t.bottom){if(e.touches.length===1&&this.scale>1)this.isDragging=!0,this.lastX=s.clientX,this.lastY=s.clientY;else if(e.touches.length===2){const a=e.touches[0],r=e.touches[1];this.last_touch_distance=Math.hypot(r.clientX-a.clientX,r.clientY-a.clientY)}}}get_image_size(e){if(!e)return;const t=e.parentElement?.getBoundingClientRect();if(!t)return;const s=e.naturalWidth/e.naturalHeight,a=t.width/t.height;let r,u;s>a?(r=t.width,u=t.width/s):(u=t.height,r=t.height*s);const o=(t.width-r)/2,f=(t.height-u)/2;this.real_image_size={top:f,left:o,width:r,height:u}}handleTouchMove(e){if(e.touches.length===1&&this.isDragging){e.preventDefault();const t=e.touches[0],s=t.clientX-this.lastX,a=t.clientY-this.lastY;this.offsetX+=s,this.offsetY+=a,this.lastX=t.clientX,this.lastY=t.clientY,this.updateTransform()}else if(e.touches.length===2){e.preventDefault();const t=e.touches[0],s=e.touches[1],a=Math.hypot(s.clientX-t.clientX,s.clientY-t.clientY);if(this.last_touch_distance===0){this.last_touch_distance=a;return}const r=a/this.last_touch_distance,u=this.scale,o=Math.min(15,Math.max(1,u*r));if(o===u){this.last_touch_distance=a;return}const f=this.container.getBoundingClientRect(),M=(t.clientX+s.clientX)/2-f.left-this.initial_left_padding,x=(t.clientY+s.clientY)/2-f.top-this.initial_top_padding;this.scale=o,this.offsetX=this.compute_new_offset({cursor_position:M,current_offset:this.offsetX,new_scale:o,old_scale:u}),this.offsetY=this.compute_new_offset({cursor_position:x,current_offset:this.offsetY,new_scale:o,old_scale:u}),this.updateTransform(),this.constrain_to_bounds(),this.updateTransform(),this.last_touch_distance=a,this.image.style.cursor=this.scale>1?"grab":"zoom-in"}}handleTouchEnd(e){this.isDragging&&(this.constrain_to_bounds(!0),this.updateTransform(),this.isDragging=!1),e.touches.length===0&&(this.last_touch_distance=0)}calculate_position(e,t,s){if(this.container.getBoundingClientRect(),s==="x"){const a=e,r=this.real_image_size.left+t*this.real_image_size.width;return a-r*this.scale}if(s==="y"){const a=e,r=this.real_image_size.top+t*this.real_image_size.height;return a-r*this.scale}return 0}}var Ht=Z(" ",1),Nt=Z(" ",1),Vt=Z('
          '),qt=Z(" ",1);function Jt(i,e){ye(e,!1);const t=()=>vt(U,"$transform",s),[s,a]=bt(),r=$(),u=$();let o=g(e,"value",28,()=>[null,null]),f=g(e,"label",12,void 0),M=g(e,"show_download_button",12,!0),x=g(e,"show_label",12),z=g(e,"i18n",12),w=g(e,"position",12),I=g(e,"layer_images",12,!0),C=g(e,"show_single",12,!1),c=g(e,"slider_color",12),d=g(e,"show_fullscreen_button",12,!0),v=g(e,"fullscreen",12,!1),B=g(e,"buttons",12,null),O=g(e,"on_custom_button_click",12,null),n=g(e,"el_width",12,0),y=g(e,"max_height",12),Y=g(e,"interactive",12,!0);const X=Ce();let R=$(),L=$(),p=$(),U=It({x:0,y:0,z:1},{duration:75}),K=$();function ae(m,P,j,k,le,oe){return(m*j+k-le)/oe/P}let F=$(0),G=$(null),b=null;function h(m,P){!m||!P||(l(G)?.destroy(),b?.disconnect(),m?.getBoundingClientRect().width,D(F,P?.getBoundingClientRect().width||0),D(G,new Gt(P,m)),l(G).subscribe(({x:j,y:k,scale:le})=>{U.set({x:j,y:k,z:le})}),b=new ResizeObserver(j=>{for(const k of j)k.target===P&&D(F,k.contentRect.width),k.target===m&&k.contentRect.width}),b.observe(P),b.observe(m))}Ge(()=>()=>{l(G)?.destroy(),b?.disconnect()});let W=$(),H=$({top:0,left:0,width:0,height:0});function q(m){D(H,m.detail)}we(()=>(S(w()),l(F),l(H),t()),()=>{D(r,ae(w(),l(F),l(H).width,l(H).left,t().x,t().z))}),we(()=>(S(I()),l(r)),()=>{D(u,I()?`clip-path: inset(0 0 0 ${l(r)*100}%)`:"")}),we(()=>(l(R),l(L)),()=>{h(l(R),l(L))}),He();var he={get value(){return o()},set value(m){o(m),_()},get label(){return f()},set label(m){f(m),_()},get show_download_button(){return M()},set show_download_button(m){M(m),_()},get show_label(){return x()},set show_label(m){x(m),_()},get i18n(){return z()},set i18n(m){z(m),_()},get position(){return w()},set position(m){w(m),_()},get layer_images(){return I()},set layer_images(m){I(m),_()},get show_single(){return C()},set show_single(m){C(m),_()},get slider_color(){return c()},set slider_color(m){c(m),_()},get show_fullscreen_button(){return d()},set show_fullscreen_button(m){d(m),_()},get fullscreen(){return v()},set fullscreen(m){v(m),_()},get buttons(){return B()},set buttons(m){B(m),_()},get on_custom_button_click(){return O()},set on_custom_button_click(m){O(m),_()},get el_width(){return n()},set el_width(m){n(m),_()},get max_height(){return y()},set max_height(m){y(m),_()},get interactive(){return Y()},set interactive(m){Y(m),_()}};Re();var ge=qt(),_e=re(ge);{let m=N(()=>(S(f()),S(z()),T(()=>f()||z()("image.image"))));rt(_e,{get show_label(){return x()},get Icon(){return Pe},get label(){return l(m)}})}var ke=V(_e,2);{var Be=m=>{it(m,{unpadded_box:!0,size:"large",children:(P,j)=>{Pe(P)},$$slots:{default:!0}})},Ue=m=>{var P=Vt(),j=ie(P);Et(j,{get buttons(){return B()},get on_custom_button_click(){return O()},children:(E,se)=>{var J=Ht(),Q=re(J);{let ee=N(()=>(S(z()),T(()=>z()("common.undo")))),me=N(()=>(t(),T(()=>t().z===1)));Ee(Q,{get Icon(){return Mt},get label(){return l(ee)},get disabled(){return l(me)},onclick:()=>l(G)?.reset_zoom()})}var ue=V(Q,2);{var ce=ee=>{Tt(ee,{get fullscreen(){return v()},$$events:{fullscreen(me){pe.call(this,e,me)}}})};te(ue,ee=>{d()&&ee(ce)})}var fe=V(ue,2);{var ot=ee=>{{let me=N(()=>(S(o()),T(()=>o()[1]?.url))),dt=N(()=>(S(o()),T(()=>o()[1]?.orig_name||"image")));st(ee,{get href(){return l(me)},get download(){return l(dt)},children:(ht,or)=>{{let gt=N(()=>(S(z()),T(()=>z()("common.download"))));Ee(ht,{get Icon(){return at},get label(){return l(gt)}})}},$$slots:{default:!0}})}};te(fe,ee=>{M()&&ee(ot)})}var ut=V(fe,2);{var ct=ee=>{Ee(ee,{get Icon(){return nt},label:"Remove Image",onclick:me=>{o([null,null]),X("clear"),me.stopPropagation()}})};te(ut,ee=>{Y()&&ee(ct)})}A(E,J)},$$slots:{default:!0}});var k=V(j,2);let le;var oe=ie(k);lt(oe,{get slider_color(){return c()},get image_size(){return l(H)},get position(){return w()},set position(E){w(E)},get el(){return l(L)},set el(E){D(L,E)},get parent_el(){return l(K)},set parent_el(E){D(K,E)},children:(E,se)=>{var J=Nt(),Q=re(J);{let ce=N(()=>(S(o()),T(()=>o()?.[0]?.url)));Le(Q,{get src(){return l(ce)},alt:"",loading:"lazy",variant:"preview",get transform(){return`translate(${t(),T(()=>t().x)??""}px, ${t(),T(()=>t().y)??""}px) scale(${t(),T(()=>t().z)??""})`},get fullscreen(){return v()},get max_height(){return y()},get img_el(){return l(R)},set img_el(fe){D(R,fe)},$$events:{load:q},$$legacy:!0})}var ue=V(Q,2);{let ce=N(()=>(S(o()),T(()=>!o()?.[1]?.url))),fe=N(()=>(S(o()),T(()=>o()?.[1]?.url)));Le(ue,{variant:"preview",get fixed(){return I()},get hidden(){return l(ce)},get src(){return l(fe)},alt:"",loading:"lazy",get style(){return`${l(u)??""}; background: var(--block-background-fill);`},get transform(){return`translate(${t(),T(()=>t().x)??""}px, ${t(),T(()=>t().y)??""}px) scale(${t(),T(()=>t().z)??""})`},get fullscreen(){return v()},get max_height(){return y()},$$events:{load:q}})}A(E,J)},$$slots:{default:!0},$$legacy:!0}),ne(k),be(k,E=>D(W,E),()=>l(W)),ne(P),be(P,E=>D(p,E),()=>l(p)),Me(()=>le=ze(k,1,"slider-wrap svelte-1880bc6",null,le,{limit_height:!v()})),Oe(k,"clientWidth",n),A(m,P)};te(ke,m=>{S(o()),S(C()),T(()=>(o()===null||o()[0]===null||o()[1]===null)&&!C())?m(Be):m(Ue,!1)})}A(i,ge);var We=xe(he);return a(),We}var Zt=Z('
          ');function Kt(i,e){ye(e,!1);const t=Ce();Re();var s=Zt(),a=ie(s);Ee(a,{get Icon(){return nt},label:"Remove Image",onclick:r=>{t("remove_image"),r.stopPropagation()}}),ne(s),A(i,s),xe()}var Qt=Z('
          '),er=Z("
          "),tr=Z("
          "),rr=Z("
          "),sr=Z('
          ',1);function ir(i,e){ye(e,!1);let t=g(e,"value",12),s=g(e,"label",12,void 0),a=g(e,"show_label",12),r=g(e,"root",12),u=g(e,"position",12),o=g(e,"upload_count",12,2),f=g(e,"show_download_button",12,!0),M=g(e,"slider_color",12),x=g(e,"upload",12),z=g(e,"stream_handler",12),w=g(e,"max_file_size",12,null),I=g(e,"i18n",12),C=g(e,"max_height",12),c=g(e,"upload_promise",12,null),d=$(t()||[null,null]),v=$(),B=$(),O=$();async function n(h,W){const H=[t()[0],t()[1]];h.length>1?H[W]=h[0]:H[W]=h[W],t(H),await Ne(),Y("upload",H)}let y=$("");const Y=Ce();let X=g(e,"dragging",12,!1);we(()=>(S(t()),l(y)),()=>{JSON.stringify(t())!==l(y)&&(D(y,JSON.stringify(t())),D(d,t()))}),we(()=>S(X()),()=>{Y("drag",X())}),He();var R={get value(){return t()},set value(h){t(h),_()},get label(){return s()},set label(h){s(h),_()},get show_label(){return a()},set show_label(h){a(h),_()},get root(){return r()},set root(h){r(h),_()},get position(){return u()},set position(h){u(h),_()},get upload_count(){return o()},set upload_count(h){o(h),_()},get show_download_button(){return f()},set show_download_button(h){f(h),_()},get slider_color(){return M()},set slider_color(h){M(h),_()},get upload(){return x()},set upload(h){x(h),_()},get stream_handler(){return z()},set stream_handler(h){z(h),_()},get max_file_size(){return w()},set max_file_size(h){w(h),_()},get i18n(){return I()},set i18n(h){I(h),_()},get max_height(){return C()},set max_height(h){C(h),_()},get upload_promise(){return c()},set upload_promise(h){c(h),_()},get dragging(){return X()},set dragging(h){X(h),_()}};Re();var L=sr(),p=re(L);{let h=N(()=>(S(s()),S(I()),T(()=>s()||I()("image.image"))));rt(p,{get show_label(){return a()},get Icon(){return Pe},get label(){return l(h)}})}var U=V(p,2),K=ie(U);{var ae=h=>{Kt(h,{$$events:{remove_image:()=>{u(.5),t([null,null]),Y("clear")}}})};te(K,h=>{S(t()),T(()=>t()?.[0]?.url||t()?.[1]?.url)&&h(ae)})}var F=V(K,2);{var G=h=>{var W=Qt(),H=ie(W);{var q=he=>{{let ge=N(()=>(S(t()),T(()=>t()[1].orig_name||"image")));st(he,{get href(){return S(t()),T(()=>t()[1].url)},get download(){return l(ge)},children:(_e,ke)=>{Ee(_e,{get Icon(){return at}})},$$slots:{default:!0}})}};te(H,he=>{f()&&he(q)})}ne(W),A(h,W)};te(F,h=>{S(t()),T(()=>t()?.[1]?.url)&&h(G)})}var b=V(F,2);{let h=N(()=>(S(o()),S(t()),T(()=>o()==2||!t()?.[0])));lt(b,{get disabled(){return l(h)},get slider_color(){return M()},get position(){return u()},set position(W){u(W)},children:(W,H)=>{var q=rr();let he,ge;var _e=ie(q);{var ke=P=>{var j=er();let k;var le=ie(j);{let oe=N(()=>(S(t()),T(()=>!!t()?.[0])));Ke(le,{filetype:"image/*",onload:E=>n(E,0),get disable_click(){return l(oe)},get root(){return r()},file_count:"multiple",get upload(){return x()},get stream_handler(){return z()},get max_file_size(){return w()},get upload_promise(){return c()},set upload_promise(E){c(E)},get dragging(){return X()},set dragging(E){X(E)},children:(E,se)=>{var J=ve(),Q=re(J);Ie(Q,e,"default",{}),A(E,J)},$$slots:{default:!0},$$legacy:!0})}ne(j),Me(()=>k=ze(j,1,"wrap svelte-1c8zs50",null,k,{"half-wrap":o()===1})),A(P,j)},Be=P=>{{let j=N(()=>(l(d),T(()=>l(d)[0]?.url)));Le(P,{variant:"upload",get src(){return l(j)},alt:"",get max_height(){return C()},get img_el(){return l(v)},set img_el(k){D(v,k)},$$legacy:!0})}};te(_e,P=>{l(d),T(()=>!l(d)?.[0])?P(ke):P(Be,!1)})}var Ue=V(_e,2);{var We=P=>{{let j=N(()=>(S(t()),T(()=>!!t()?.[1])));Ke(P,{filetype:"image/*",onload:k=>n(k,1),get disable_click(){return l(j)},get root(){return r()},file_count:"multiple",get upload(){return x()},get stream_handler(){return z()},get max_file_size(){return w()},get upload_promise(){return c()},set upload_promise(k){c(k)},get dragging(){return X()},set dragging(k){X(k)},children:(k,le)=>{var oe=ve(),E=re(oe);Ie(E,e,"default",{}),A(k,oe)},$$slots:{default:!0},$$legacy:!0})}},m=P=>{var j=ve(),k=re(j);{var le=E=>{var se=tr();let J,Q;var ue=ie(se);it(ue,{unpadded_box:!0,size:"large",children:(ce,fe)=>{Pe(ce)},$$slots:{default:!0}}),ne(se),Me(()=>{J=ze(se,1,"empty-wrap fixed svelte-1c8zs50",null,J,{"white-icon":!t()?.[0]?.url}),Q=Xe(se,"",Q,{width:`${l(B)*(1-u())}px`,transform:`translateX(${l(B)*u()}px)`})}),A(E,se)},oe=E=>{var se=ve(),J=re(se);{var Q=ue=>{{let ce=N(()=>o()===1);Le(ue,{variant:"upload",get src(){return l(d),T(()=>l(d)[1].url)},alt:"",get fixed(){return l(ce)},transform:"translate(0px, 0px) scale(1)",get max_height(){return C()}})}};te(J,ue=>{l(d),T(()=>l(d)?.[1])&&ue(Q)},!0)}A(E,se)};te(k,E=>{l(d),S(o()),T(()=>!l(d)?.[1]&&o()===1)?E(le):E(oe,!1)},!0)}A(P,j)};te(Ue,P=>{l(d),S(o()),T(()=>!l(d)?.[1]&&o()===2)?P(We):P(m,!1)})}ne(q),Me(()=>{he=ze(q,1,"upload-wrap svelte-1c8zs50",null,he,{"side-by-side":o()===2}),ge=Xe(q,"",ge,{display:o()===2?"flex":"block"})}),A(W,q)},$$slots:{default:!0},$$legacy:!0})}return ne(U),Oe(U,"clientWidth",h=>D(B,h)),Oe(U,"clientHeight",h=>D(O,h)),A(i,L),xe(R)}function nr(i,e){ye(e,!1);let t=g(e,"value",28,()=>[null,null]),s=g(e,"upload",12),a=g(e,"stream_handler",12),r=g(e,"label",12),u=g(e,"show_label",12),o=g(e,"i18n",12),f=g(e,"root",12),M=g(e,"upload_count",12,1),x=g(e,"dragging",12),z=g(e,"max_height",12),w=g(e,"max_file_size",12,null),I=g(e,"upload_promise",12,null);var C={get value(){return t()},set value(c){t(c),_()},get upload(){return s()},set upload(c){s(c),_()},get stream_handler(){return a()},set stream_handler(c){a(c),_()},get label(){return r()},set label(c){r(c),_()},get show_label(){return u()},set show_label(c){u(c),_()},get i18n(){return o()},set i18n(c){o(c),_()},get root(){return f()},set root(c){f(c),_()},get upload_count(){return M()},set upload_count(c){M(c),_()},get dragging(){return x()},set dragging(c){x(c),_()},get max_height(){return z()},set max_height(c){z(c),_()},get max_file_size(){return w()},set max_file_size(c){w(c),_()},get upload_promise(){return I()},set upload_promise(c){I(c),_()}};return ir(i,{slider_color:"var(--border-color-primary)",position:.5,get root(){return f()},get label(){return r()},get show_label(){return u()},get upload_count(){return M()},get stream_handler(){return a()},get upload(){return s()},get max_file_size(){return w()},get max_height(){return z()},get i18n(){return o()},get upload_promise(){return I()},set upload_promise(c){I(c)},get value(){return t()},set value(c){t(c)},get dragging(){return x()},set dragging(c){x(c)},$$events:{edit(c){pe.call(this,e,c)},clear(c){pe.call(this,e,c)},stream(c){pe.call(this,e,c)},drag:({detail:c})=>x(c),upload(c){pe.call(this,e,c)},select(c){pe.call(this,e,c)},share(c){pe.call(this,e,c)}},children:(c,d)=>{var v=ve(),B=re(v);Ie(B,e,"default",{}),A(c,v)},$$slots:{default:!0},$$legacy:!0}),xe(C)}var ar=Z(" ",1),lr=Z(" ",1);function Br(i,e){ye(e,!0);let t=je(void 0);class s extends Yt{async get_data(){return l(t)&&(await l(t),await Ne()),await super.get_data()}}const a=wt(e,["$$slots","$$events","$$legacy"]),r=new s(a);let u=je(!1),o=je(!1),f,M=de(()=>Math.max(0,Math.min(100,r.props.slider_position))/100);r.watch_for_change();const x=d=>{const v=d;v.preventDefault(),v.stopPropagation(),v.type==="dragenter"||v.type==="dragover"?D(o,!0):v.type==="dragleave"&&D(o,!1)},z=d=>{if(r.shared.interactive){const v=d;v.preventDefault(),v.stopPropagation(),D(o,!1),f&&f.loadFilesFromDrop(v)}};var w=ve(),I=re(w);{var C=d=>{{let v=de(()=>l(o)?"focus":"base"),B=de(()=>r.props.height||void 0);Qe(d,{get visible(){return r.shared.visible},variant:"solid",get border_mode(){return l(v)},padding:!1,get elem_id(){return r.shared.elem_id},get elem_classes(){return r.shared.elem_classes},get height(){return l(B)},get width(){return r.props.width},allow_overflow:!1,get container(){return r.shared.container},get scale(){return r.shared.scale},get min_width(){return r.shared.min_width},get fullscreen(){return l(u)},set fullscreen(O){D(u,O,!0)},children:(O,n)=>{var y=ar(),Y=re(y);Ze(Y,qe({get autoscroll(){return r.shared.autoscroll},get i18n(){return r.i18n}},()=>r.shared.loading_status));var X=V(Y,2);{let R=de(()=>r.props.buttons.some(p=>typeof p=="string"&&p==="download")),L=de(()=>r.props.buttons.some(p=>typeof p=="string"&&p==="fullscreen"));Jt(X,{get fullscreen(){return l(u)},get interactive(){return r.shared.interactive},get label(){return r.shared.label},get show_label(){return r.shared.show_label},get show_download_button(){return l(R)},get i18n(){return r.i18n},get show_fullscreen_button(){return l(L)},get buttons(){return r.props.buttons},on_custom_button_click:p=>{r.dispatch("custom_button_click",{id:p})},get position(){return l(M)},get slider_color(){return r.props.slider_color},get max_height(){return r.props.max_height},get value(){return r.props.value},set value(p){r.props.value=p},$$events:{select:({detail:p})=>r.dispatch("select",p),share:({detail:p})=>r.dispatch("share",p),error:({detail:p})=>r.dispatch("error",p),clear:()=>{r.dispatch("clear"),r.dispatch("input")},fullscreen:({detail:p})=>{D(u,p,!0)}}})}A(O,y)},$$slots:{default:!0}})}},c=d=>{{let v=de(()=>r.props.value===null?"dashed":"solid"),B=de(()=>l(o)?"focus":"base"),O=de(()=>r.props.height||void 0);Qe(d,{get visible(){return r.shared.visible},get variant(){return l(v)},get border_mode(){return l(B)},padding:!1,get elem_id(){return r.shared.elem_id},get elem_classes(){return r.shared.elem_classes},get height(){return l(O)},get width(){return r.props.width},allow_overflow:!1,get container(){return r.shared.container},get scale(){return r.shared.scale},get min_width(){return r.shared.min_width},$$events:{dragenter:x,dragleave:x,dragover:x,drop:z},children:(n,y)=>{var Y=lr(),X=re(Y);Ze(X,qe({get autoscroll(){return r.shared.autoscroll},get i18n(){return r.i18n}},()=>r.shared.loading_status,{on_clear_status:()=>r.dispatch("clear_status",r.shared.loading_status)}));var R=V(X,2);{let L=de(()=>r.shared.client?.stream);be(nr(R,{get root(){return r.shared.root},get label(){return r.shared.label},get show_label(){return r.shared.show_label},get upload_count(){return r.props.upload_count},get max_file_size(){return r.shared.max_file_size},get i18n(){return r.i18n},upload:(...p)=>r.shared.client.upload(...p),get stream_handler(){return l(L)},get max_height(){return r.props.max_height},get upload_promise(){return l(t)},set upload_promise(p){D(t,p,!0)},get value(){return r.props.value},set value(p){r.props.value=p},get dragging(){return l(o)},set dragging(p){D(o,p,!0)},$$events:{edit:()=>r.dispatch("edit"),clear:()=>{r.dispatch("clear"),r.dispatch("input")},drag:({detail:p})=>D(o,p,!0),upload:()=>{r.dispatch("upload"),r.dispatch("input")},error:({detail:p})=>{r.shared.loading_status&&(r.shared.loading_status.status="error"),r.dispatch("error",p)},close_stream:()=>{r.dispatch("close_stream","stream")}},children:(p,U)=>{var K=ve(),ae=re(K);{var F=G=>{kt(G,{get i18n(){return r.i18n},type:"image",get placeholder(){return r.props.placeholder}})};te(ae,G=>{G(F)})}A(p,K)},$$slots:{default:!0}}),p=>f=p,()=>f)}A(n,Y)},$$slots:{default:!0}})}};te(I,d=>{!r.shared.interactive||r.props.value?.[1]&&r.props.value?.[0]?d(C):d(c,!1)})}A(i,w),xe()}export{Br as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Xhg3Ucw_.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Xhg3Ucw_.css new file mode 100644 index 0000000000000000000000000000000000000000..63a1a8de11e7e21e3b963c32e7122e70bcd062b7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-Xhg3Ucw_.css @@ -0,0 +1 @@ +.hide.svelte-94gmgt{display:none}.button-icon.svelte-94gmgt{width:var(--text-xl);height:var(--text-xl);margin-right:var(--spacing-xl)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-bJ8TG0Hn.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-bJ8TG0Hn.css new file mode 100644 index 0000000000000000000000000000000000000000..c0980a5e5dced61fe61be5b287d3bdb1e1a7c5ad --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-bJ8TG0Hn.css @@ -0,0 +1 @@ +.minimal-audio-recorder.svelte-doy9oc{display:flex;align-items:center;gap:var(--spacing-sm);border-radius:var(--radius-sm);width:100%;padding:var(--spacing-sm)}.device-selection-wrapper.svelte-doy9oc{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:var(--spacing-md);width:100%}.waveform-wrapper.svelte-doy9oc{flex:1 1 auto;min-width:0;width:100%}.waveform-wrapper.svelte-doy9oc ::part(wrapper){margin-bottom:0}.timestamp.svelte-doy9oc{font-size:13px;font-weight:500;color:var(--body-text-color);opacity:.7;font-variant-numeric:tabular-nums;flex-shrink:0;min-width:40px;text-align:center}.device-select-large.svelte-doy9oc{max-width:var(--size-60);font-size:var(--text-sm);padding:var(--spacing-sm) var(--spacing-md);border:1px solid var(--border-color-primary);border-radius:var(--radius-md);background:var(--background-fill-secondary);color:var(--body-text-color);cursor:pointer;height:var(--size-9)}.record-button.svelte-doy9oc{display:flex;align-items:center;justify-content:center;height:var(--size-9);width:var(--size-9);padding:0;flex-shrink:0;background-color:var(--block-background-fill);color:var(--body-text-color);border:1px solid var(--border-color-primary);border-radius:var(--radius-md);cursor:pointer}.record-button.svelte-doy9oc:before{content:"";height:var(--size-4);width:var(--size-4);border-radius:var(--radius-full);background:var(--primary-600);flex-shrink:0}.record-button.svelte-doy9oc:hover{background-color:var(--block-background-fill);border-color:var(--border-color-accent)}.record-button.svelte-doy9oc:active{transform:scale(.98)}.stop-button.svelte-doy9oc{display:flex;align-items:center;justify-content:center;width:var(--size-9);height:var(--size-9);padding:0;border:var(--size-px) solid var(--border-color-primary);border-radius:var(--radius-md);background:var(--button-secondary-background-fill);color:var(--error-500);cursor:pointer;flex-shrink:0}.stop-button.svelte-doy9oc:hover{background:var(--button-secondary-background-fill-hover);color:var(--error-600)}.stop-button.svelte-doy9oc:active{transform:scale(.95)}.stop-button.svelte-doy9oc svg{width:var(--size-5);height:var(--size-5)}@media(max-width:768px){.device-select-large.svelte-doy9oc{max-width:var(--size-40)}}.full-container.svelte-1qn0337{width:100%;position:relative;padding:var(--block-padding);border:1px solid transparent}.full-container.dragging.svelte-1qn0337{border-color:var(--color-accent);border-radius:calc(var(--radius-sm) - var(--size-px))}.full-container.dragging.svelte-1qn0337:after{content:"";position:absolute;inset:0;pointer-events:none}.input-container.svelte-1qn0337{display:flex;position:relative;flex-direction:column;gap:0}.input-wrapper.svelte-1qn0337{display:flex;position:relative;flex-direction:column;gap:0;background:var(--block-background-fill);border-radius:var(--radius-xl);padding:var(--spacing-sm) var(--spacing-sm) var(--spacing-sm) 0;align-items:flex-start;min-height:auto}.input-wrapper.has-files.svelte-1qn0337{padding-top:var(--spacing-xs)}.input-row.svelte-1qn0337{display:flex;align-items:flex-start;gap:var(--spacing-sm);width:100%}.thumbnails.svelte-1qn0337{display:flex;align-items:center;gap:var(--spacing-sm);padding:var(--spacing-xs) 0;margin-bottom:var(--spacing-xs);overflow-x:auto;overflow-y:hidden;scrollbar-width:none;-ms-overflow-style:none;flex-wrap:nowrap;-webkit-overflow-scrolling:touch;scroll-behavior:smooth;overflow-y:scroll;width:100%}.thumbnails.svelte-1qn0337::-webkit-scrollbar,.thumbnails.svelte-1qn0337::-webkit-scrollbar-track,.thumbnails.svelte-1qn0337::-webkit-scrollbar-thumb{display:none}.thumbnails.svelte-1qn0337 img{width:var(--size-full);height:var(--size-full);object-fit:cover;border-radius:var(--radius-md)}.thumbnail-wrapper.svelte-1qn0337{position:relative;flex-shrink:0}.thumbnail-item.svelte-1qn0337{position:relative;display:flex;justify-content:center;align-items:center;border-radius:var(--radius-md);background:var(--background-fill-secondary);width:var(--size-full);height:var(--size-full);cursor:default;padding:0}.thumbnail-small.svelte-1qn0337{width:var(--size-10);height:var(--size-10)}.thumbnail-item.svelte-1qn0337 svg{width:var(--size-5);height:var(--size-5)}.delete-button.svelte-1qn0337{position:absolute;inset:0;display:flex;justify-content:center;align-items:center;color:var(--button-primary-text-color);background:#0009;backdrop-filter:var(--blur-xs);border-radius:var(--radius-md);padding:0;z-index:var(--layer-1);opacity:0;transition:opacity .1s var(--easing-standard)}.delete-button.svelte-1qn0337:hover{background:#000c}.delete-button.svelte-1qn0337 svg{width:var(--size-5);height:var(--size-5)}.thumbnail-item.svelte-1qn0337:hover .delete-button:where(.svelte-1qn0337){opacity:1}textarea.svelte-1qn0337{flex-grow:1;outline:none!important;background:transparent;padding:var(--spacing-sm) 0;color:var(--body-text-color);font-weight:var(--input-text-weight);font-size:var(--input-text-size);border:none;margin:0;resize:none;position:relative;z-index:var(--layer-1);text-align:left}textarea.svelte-1qn0337:disabled{-webkit-opacity:1;opacity:1}textarea.svelte-1qn0337::placeholder{color:var(--input-placeholder-color)}textarea[dir=rtl].svelte-1qn0337{text-align:right}.microphone-button.svelte-1qn0337,.icon-button.svelte-1qn0337{color:var(--body-text-color);cursor:pointer;padding:var(--spacing-sm);display:flex;justify-content:center;align-items:center;flex-shrink:0;border-radius:var(--radius-md)}.thumbnail-add.svelte-1qn0337{background:var(--button-secondary-background-fill);cursor:pointer;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:var(--size-10);height:var(--size-10);border-radius:var(--radius-md);z-index:var(--layer-1)}.thumbnail-add.svelte-1qn0337:hover:not(:disabled){background:var(--button-secondary-background-fill-hover)}.thumbnail-add.svelte-1qn0337:disabled{opacity:.5;cursor:not-allowed}.thumbnail-add.svelte-1qn0337 svg{width:var(--size-5);height:var(--size-5)}.microphone-button.svelte-1qn0337,.icon-button.svelte-1qn0337{width:var(--size-9);height:var(--size-9)}.microphone-button.svelte-1qn0337:hover:not(:disabled),.icon-button.svelte-1qn0337:hover:not(:disabled){background:var(--button-secondary-background-fill)}.microphone-button.svelte-1qn0337:disabled,.icon-button.svelte-1qn0337:disabled{opacity:.5;cursor:not-allowed}.microphone-button.svelte-1qn0337 svg,.icon-button.svelte-1qn0337 svg{width:var(--size-5);height:var(--size-5)}.submit-button.svelte-1qn0337,.stop-button.svelte-1qn0337{background:var(--button-secondary-background-fill);cursor:pointer;display:flex;justify-content:center;align-items:center;flex-shrink:0;width:var(--size-9);height:var(--size-9);border-radius:var(--radius-md);z-index:var(--layer-1)}.submit-button.svelte-1qn0337:hover:not(:disabled),.stop-button.svelte-1qn0337:hover:not(:disabled){background:var(--button-secondary-background-fill-hover)}.submit-button.svelte-1qn0337:active:not(:disabled),.stop-button.svelte-1qn0337:active:not(:disabled){box-shadow:var(--button-shadow-active)}.submit-button.svelte-1qn0337:disabled,.stop-button.svelte-1qn0337:disabled{cursor:not-allowed}.submit-button.svelte-1qn0337 svg,.stop-button.svelte-1qn0337 svg{width:var(--size-5);height:var(--size-5)}.padded-button.svelte-1qn0337{padding:0 var(--spacing-lg);width:auto;border-radius:var(--radius-xl)}.loader.svelte-1qn0337{display:flex;justify-content:center;align-items:center;position:relative;border:var(--size-1) solid var(--border-color-primary);border-top-color:var(--color-accent);border-radius:var(--radius-100);width:var(--size-5);height:var(--size-5);animation:svelte-1qn0337-spin 1s linear infinite;flex-shrink:0}@keyframes svelte-1qn0337-spin{to{transform:rotate(360deg)}}.recording-overlay.svelte-1qn0337{position:absolute;inset:0;background:var(--block-background-fill);border-radius:var(--radius-xl);display:flex;align-items:center;justify-content:center;z-index:var(--layer-5);padding:var(--spacing-lg);backdrop-filter:blur(8px);animation:svelte-1qn0337-fadeIn .2s var(--easing-standard)}@keyframes svelte-1qn0337-fadeIn{0%{opacity:0}to{opacity:1}}.recording-content.svelte-1qn0337{display:flex;align-items:center;gap:var(--spacing-lg);width:100%;max-width:700px}.recording-content.svelte-1qn0337 .minimal-audio-recorder,.recording-content.svelte-1qn0337 .minimal-audio-player{flex:1}.action-buttons.svelte-1qn0337{display:flex;align-items:center;gap:var(--spacing-sm);flex-shrink:0}.stop-button.svelte-1qn0337,.confirm-button.svelte-1qn0337,.cancel-button.svelte-1qn0337{display:flex;align-items:center;justify-content:center;width:var(--size-9);height:var(--size-9);padding:0;border-radius:var(--radius-md);cursor:pointer;flex-shrink:0}.stop-button.svelte-1qn0337{background:var(--button-secondary-background-fill);border-color:var(--border-color-primary);color:var(--error-500)}.stop-button.svelte-1qn0337:hover{background:var(--button-secondary-background-fill-hover);color:var(--error-600)}.stop-button.svelte-1qn0337:active{transform:scale(.95)}.confirm-button.svelte-1qn0337{background:var(--button-primary-background-fill);border-color:var(--button-primary-border-color);color:#fff}.confirm-button.svelte-1qn0337:hover{background:var(--button-primary-background-fill-hover);color:var(--button-primary-text-color-hover)}.confirm-button.svelte-1qn0337:active{transform:scale(.95)}.cancel-button.svelte-1qn0337{background:var(--button-secondary-background-fill);color:var(--body-text-color)}.cancel-button.svelte-1qn0337:hover{background:var(--button-secondary-background-fill-hover)}.stop-button.svelte-1qn0337 svg,.confirm-button.svelte-1qn0337 svg,.cancel-button.svelte-1qn0337 svg{width:var(--size-5);height:var(--size-5)}@media(max-width:768px){.input-wrapper.svelte-1qn0337{padding:var(--spacing-xs)}.thumbnails.svelte-1qn0337{padding:var(--spacing-xs) 0;margin-bottom:var(--spacing-md)}.thumbnail-small.svelte-1qn0337,.thumbnail-add.svelte-1qn0337{width:var(--size-9);height:var(--size-9)}.thumbnail-item.svelte-1qn0337:active .delete-button:where(.svelte-1qn0337){opacity:1}}.textarea-wrapper.svelte-1qn0337{position:relative;flex-grow:1}.textarea-wrapper.svelte-1qn0337 textarea:where(.svelte-1qn0337){width:100%} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-cY7HT1Ac.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-cY7HT1Ac.css new file mode 100644 index 0000000000000000000000000000000000000000..0843d4d64e956cc7f509392c01dbec511a057ff4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-cY7HT1Ac.css @@ -0,0 +1 @@ +div.svelte-1xjkzpp .math.inline{fill:var(--body-text-color);display:inline-block;vertical-align:middle;padding:var(--size-1-5) -var(--size-1);color:var(--body-text-color)}div.svelte-1xjkzpp .math.inline svg{display:inline;margin-bottom:.22em}div.svelte-1xjkzpp{max-width:100%}.hide.svelte-1xjkzpp{display:none}div.svelte-16ln60g{transition:.15s}.pending.svelte-16ln60g{opacity:.2}.padding.svelte-16ln60g{padding:var(--block-padding)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-cYuhm-BK.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-cYuhm-BK.js new file mode 100644 index 0000000000000000000000000000000000000000..473ab1f135c5f24cebf7bc0229d61b188ce16f38 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-cYuhm-BK.js @@ -0,0 +1,570 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./browserAll-CO8QIzLb.js","./webworkerAll-Cko47uxa.js","./colorToUniform-3MxHuUz8.js","./i18n-Dnhn5Rxr.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./i18n-9kYrHpuJ.css","./misc-vsnLZ-Y1.js","./utils.svelte-CCyS_0CY.js","./clone-BkeCM4Nl.js","./ImagePreview-B2ps5aDR.js","./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js","./snippet-BWgYNF9D.js","./ScrollFade-DV-0xzhB.css","./BlockLabel-CZd21Hkw.js","./DownloadLink-TGTaev7f.js","./Empty-BIB2W5at.js","./ShareButton-wCSP7LoP.js","./Download-Di2PsS6O.js","./Image-DrPceByI.js","./IconButtonWrapper-D0s9l4wW.js","./FullscreenButton-sCrcy_OJ.js","./Maximize-QH9NIRWs.js","./Image-CeW7PJs4.js","./Image-Da_XA0w6.css","./ImagePreview-CCVfwC4m.css","./Block-J4oodUWp.js","./index-CglBvmLb.js","./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js","./html-Ih_5QVTo.js","./index-B_pwUImq.js","./StreamingBar-CMuqaV2j.css","./Clear-BF6j078A.js","./Upload-HitvyI7k.js","./actions-CLThs9VH.js","./Upload-C2I0h_eD.css","./Webcam-DQkeURjU.js","./DropdownArrow-BOSZEGSp.js","./Square-CcB54dqq.js","./Spinner-Dhvehhrf.js","./StreamingBar-Cb4g-rUI.js","./ImageUploader-Dpdel1G9.css","./window-Uydxco8n.js","./tinycolor-BQBUvzv5.js","./Plus-CDtuRS4x.js","./input-DrerMDOL.js","./Check-DUAHzS2-.js","./event-modifiers-CdEA5IGF.js","./ArrowUp-D69HGcoh.js","./Trash-D2U3jAj_.js","./Undo-C2-jWGVL.js","./Example-CZSJmqDf.css","./WebGPURenderer-aw-zH1pb.js","./SharedSystems-D1plL92C.js","./WebGLRenderer-BaJ4wXpG.js"])))=>i.map(i=>d[i]); +import{w as ai,p as z,e as ve,i as Q,a as Ue,b as re,f as Ie,G as Uo,d as Qe,k as Bi,u as Li,t as No,F as Fh,j as Ne,m as Bh,q as Lh,s as Oh,r as Gh,g as yn}from"./i18n-Dnhn5Rxr.js";import{a as H,f as ne,aj as Dh,R as ce,a1 as yt,x as W,G as Y,a2 as Le,V as it,X as q,Y as tt,t as Wt,w as m,T as ue,a3 as Z,U as I,a0 as Fe,W as nt,af as ps,aa as Wo,Z as jt,aw as xn,S as qt,z as Rt,M as xr,a4 as Oe,ad as Gt,a5 as de,at as Ho,a6 as ci,au as Os,u as Uh,av as Gs}from"./index-DWyDLubb.js";import{b as fe}from"./misc-vsnLZ-Y1.js";import{G as Nh}from"./utils.svelte-CCyS_0CY.js";import{I as Wh}from"./ImagePreview-B2ps5aDR.js";import{B as bn}from"./Block-J4oodUWp.js";import{U as Hh,a as Vh,W as Xh,I as ie}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{s as Ds,S as vn}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";/* empty css */import{c as Yh}from"./Upload-HitvyI7k.js";/* empty css *//* empty css */import{C as wn,b as si,W as jh}from"./Webcam-DQkeURjU.js";import{a as As}from"./actions-CLThs9VH.js";import{I as Vo}from"./Image-DrPceByI.js";import{b as kn}from"./window-Uydxco8n.js";import{t as he,E as qh}from"./tinycolor-BQBUvzv5.js";import{P as Xo}from"./Plus-CDtuRS4x.js";import{b as $h}from"./input-DrerMDOL.js";import{C as Yo}from"./Check-DUAHzS2-.js";/* empty css */import{s as gs}from"./event-modifiers-CdEA5IGF.js";import{A as Kh}from"./ArrowUp-D69HGcoh.js";import{C as Zh}from"./Clear-BF6j078A.js";import{D as Qh}from"./Download-Di2PsS6O.js";import{T as Jh}from"./Trash-D2U3jAj_.js";import{U as tl}from"./Undo-C2-jWGVL.js";import{I as el}from"./IconButtonWrapper-D0s9l4wW.js";import{B as il}from"./BlockLabel-CZd21Hkw.js";var sl=ne('');function rl(s){var t=sl();H(s,t)}var nl=ne('');function ol(s){var t=nl();H(s,t)}var al=ne('');function hl(s){var t=al();H(s,t)}var ll=ne('');function cl(s){var t=ll();H(s,t)}var ul=ne('');function dl(s){var t=ul();H(s,t)}var _l=ne('');function fl(s){var t=_l();H(s,t)}var pl=ne('');function gl(s){var t=pl();H(s,t)}var ml=ne('');function yl(s){var t=ml();H(s,t)}var xl=ne('');function bl(s){var t=xl();H(s,t)}var vl=ne('');function wl(s){var t=vl();H(s,t)}var kl=ne('');function Al(s){var t=kl();H(s,t)}var Sl=ne('');function Cl(s){var t=Sl();H(s,t)}var Ml=ne('');function Tl(s){var t=Ml();H(s,t)}var Pl=ne('');function zl(s){var t=Pl();H(s,t)}class ms{command;next;previous;constructor(t){this.command=t||null,this.next=null,this.previous=null}push(t){this.next=null;const e=new ms(t);e.previous=this,this.next=e}}class Il{history=new ms;current_history=ai(this.history);undo(){this.history.previous&&(this.history.command?.undo(),this.history=this.history.previous,this.current_history.update(()=>this.history))}redo(t){this.history.next&&(this.history=this.history.next,this.history.command?.execute(t),this.current_history.update(()=>this.history))}async execute(t,e){await t.execute(e),this.history.push(t),this.history=this.history.next,this.current_history.update(()=>this.history)}async wait_for_next_frame(){return new Promise(t=>{requestAnimationFrame(()=>{t()})})}async replay(t,e){for(;t.previous;)t=t.previous;for(;t.next;)await t.next.command.execute(e),t=t.next;this.history=t,this.current_history.update(()=>this.history)}contains(t){let e=this.history;for(;e;){if(e.command?.name===t)return!0;e=e.next}return!1}reset(){this.history=new ms,this.current_history.update(()=>this.history)}}var El=nt(' '),Rl=nt(' '),Fl=nt("");function ae(s,t){ce(t,!1);const e=Z();let i=z(t,"Icon",12),r=z(t,"label",12,""),n=z(t,"show_label",12,!1),o=z(t,"pending",12,!1),a=z(t,"size",12,"small"),h=z(t,"padded",12,!0),l=z(t,"highlight",12,!1),c=z(t,"disabled",12,!1),u=z(t,"hasPopup",12,!1),_=z(t,"color",12,"var(--block-label-text-color)"),d=z(t,"transparent",12,!1),f=z(t,"background",12,"var(--background-fill-primary)"),g=z(t,"offset",12,0),p=z(t,"label_position",12,"left"),y=z(t,"roundedness",12,"quite"),x=z(t,"onclick",12,void 0);yt(()=>(Y(l()),Y(_())),()=>{W(e,l()?"var(--color-accent)":_().toString())}),Le();var v={get Icon(){return i()},set Icon(B){i(B),I()},get label(){return r()},set label(B){r(B),I()},get show_label(){return n()},set show_label(B){n(B),I()},get pending(){return o()},set pending(B){o(B),I()},get size(){return a()},set size(B){a(B),I()},get padded(){return h()},set padded(B){h(B),I()},get highlight(){return l()},set highlight(B){l(B),I()},get disabled(){return c()},set disabled(B){c(B),I()},get hasPopup(){return u()},set hasPopup(B){u(B),I()},get color(){return _()},set color(B){_(B),I()},get transparent(){return d()},set transparent(B){d(B),I()},get background(){return f()},set background(B){f(B),I()},get offset(){return g()},set offset(B){g(B),I()},get label_position(){return p()},set label_position(B){p(B),I()},get roundedness(){return y()},set roundedness(B){y(B),I()},get onclick(){return x()},set onclick(B){x(B),I()}};ve();var b=Fl();b.__click=function(...B){x()?.apply(this,B)};let C,w;var k=it(b);{var R=B=>{var V=El(),L=it(V,!0);tt(V),Wt(()=>Fe(L,r())),H(B,V)};Q(k,B=>{n()&&p()==="left"&&B(R)})}var S=q(k,2);let P;var F=it(S);i()(F,{}),tt(S);var G=q(S,2);{var N=B=>{var V=Rl(),L=it(V,!0);tt(V),Wt(()=>Fe(L,r())),H(B,V)};Q(G,B=>{n()&&p()==="right"&&B(N)})}return tt(b),Wt(()=>{b.disabled=c(),Ue(b,"aria-label",r()),Ue(b,"aria-haspopup",u()),Ue(b,"title",r()),C=re(b,1,`${y()??""}-round`,"svelte-1lrnmgy",C,{pending:o(),padded:h(),highlight:l(),transparent:d()}),w=Ie(b,"",w,{color:!c()&&m(e)?m(e):"var(--block-label-text-color)","--bg-color":c()?"auto":f(),"margin-left":g()+"px"}),P=re(S,1,"svelte-1lrnmgy",null,P,{small:a()==="small",large:a()==="large",medium:a()==="medium"})}),H(s,b),ue(v)}Dh(["click"]);function Kr(s,t){const e=i=>{s&&!s.contains(i.target)&&!i.defaultPrevented&&t(i)};return document.addEventListener("mousedown",e,!0),{destroy(){document.removeEventListener("mousedown",e,!0)}}}var $=(s=>(s.Application="application",s.WebGLPipes="webgl-pipes",s.WebGLPipesAdaptor="webgl-pipes-adaptor",s.WebGLSystem="webgl-system",s.WebGPUPipes="webgpu-pipes",s.WebGPUPipesAdaptor="webgpu-pipes-adaptor",s.WebGPUSystem="webgpu-system",s.CanvasSystem="canvas-system",s.CanvasPipesAdaptor="canvas-pipes-adaptor",s.CanvasPipes="canvas-pipes",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s.MaskEffect="mask-effect",s.BlendMode="blend-mode",s.TextureSource="texture-source",s.Environment="environment",s.ShapeBuilder="shape-builder",s.Batcher="batcher",s))($||{});const br=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},ji=(s,t)=>br(s).priority??t,$t={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(br).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...s){return s.map(br).forEach(t=>{t.type.forEach(e=>{const i=this._addHandlers,r=this._queue;i[e]?i[e]?.(t):(r[e]=r[e]||[],r[e]?.push(t))})}),this},handle(s,t,e){const i=this._addHandlers,r=this._removeHandlers;if(i[s]||r[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=t,r[s]=e;const n=this._queue;return n[s]&&(n[s]?.forEach(o=>t(o)),delete n[s]),this},handleByMap(s,t){return this.handle(s,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(s,t,e=-1){return this.handle(s,i=>{t.findIndex(n=>n.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((n,o)=>ji(o.value,e)-ji(n.value,e)))},i=>{const r=t.findIndex(n=>n.name===i.name);r!==-1&&t.splice(r,1)})},handleByList(s,t,e=-1){return this.handle(s,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((r,n)=>ji(n,e)-ji(r,e)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})},mixin(s,...t){for(const e of t)Object.defineProperties(s.prototype,Object.getOwnPropertyDescriptors(e))}},Bl={extension:{type:$.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await ps(()=>import("./browserAll-CO8QIzLb.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51]),import.meta.url)}},Ll={extension:{type:$.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await ps(()=>import("./webworkerAll-Cko47uxa.js"),__vite__mapDeps([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51]),import.meta.url)}};class Kt{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new Kt(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}var Us={exports:{}},An;function Ol(){return An||(An=1,(function(s){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function r(h,l,c){this.fn=h,this.context=l,this.once=c||!1}function n(h,l,c,u,_){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new r(c,u||h,_),f=e?e+l:l;return h._events[f]?h._events[f].fn?h._events[f]=[h._events[f],d]:h._events[f].push(d):(h._events[f]=d,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new i:delete h._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)t.call(c,u)&&l.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=e?e+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var _=0,d=u.length,f=new Array(d);_Xe[s],uY:s=>Ye[s],vX:s=>je[s],vY:s=>qe[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>vr[s][t],sub:(s,t)=>vr[s][Ct.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?Ct.S:Ct.N:Math.abs(t)*2<=Math.abs(s)?s>0?Ct.E:Ct.W:t>0?s>0?Ct.SE:Ct.SW:s>0?Ct.NE:Ct.NW,matrixAppendRotationInv:(s,t,e=0,i=0)=>{const r=jo[Ct.inv(t)];r.tx=e,r.ty=i,s.append(r)},transformRectCoords:(s,t,e,i)=>{const{x:r,y:n,width:o,height:a}=s,{x:h,y:l,width:c,height:u}=t;return e===Ct.E?(i.set(r+h,n+l,o,a),i):e===Ct.S?i.set(c-n-a+h,r+l,a,o):e===Ct.W?i.set(c-r-o+h,u-n-a+l,o,a):e===Ct.N?i.set(n+h,u-r-o+l,a,o):i.set(r+h,n+l,o,a)}},$i=[new dt,new dt,new dt,new dt];class Mt{constructor(t=0,e=0,i=0,r=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new Mt(0,0,0,0)}clone(){return new Mt(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t=this.y&&e=u&&t<=_&&e>=d&&e<=f&&!(t>g&&ty&&et.right?t.right:this.right)<=R)return!1;const P=this.yt.bottom?t.bottom:this.bottom)>P}const i=this.left,r=this.right,n=this.top,o=this.bottom;if(r<=i||o<=n)return!1;const a=$i[0].set(t.left,t.top),h=$i[1].set(t.left,t.bottom),l=$i[2].set(t.right,t.top),c=$i[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=i||Math.min(a.x,h.x,l.x,c.x)>=r||Math.max(a.y,h.y,l.y,c.y)<=n||Math.min(a.y,h.y,l.y,c.y)>=o))return!1;const _=u*(h.y-a.y),d=u*(a.x-h.x),f=_*i+d*n,g=_*r+d*n,p=_*i+d*o,y=_*r+d*o;if(Math.max(f,g,p,y)<=_*a.x+d*a.y||Math.min(f,g,p,y)>=_*c.x+d*c.y)return!1;const x=u*(a.y-l.y),v=u*(l.x-a.x),b=x*i+v*n,C=x*r+v*n,w=x*i+v*o,k=x*r+v*o;return!(Math.max(b,C,w,k)<=x*a.x+v*a.y||Math.min(b,C,w,k)>=x*c.x+v*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this}getBounds(t){return t||(t=new Mt),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,i=t.y,r=t.x+t.width,n=t.y+t.height;return e>=this.x&&e=this.y&&i=this.x&&r=this.y&&n{if(oi.quiet||Sn.has(t))return;let i=new Error().stack;const r=`${t} +Deprecated since v${s}`,n=typeof console.groupCollapsed=="function"&&!oi.noColor;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",r):(i=i.split(` +`).splice(e).join(` +`),n?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",r),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",r),console.warn(i))),Sn.add(t)};Object.defineProperties(ht,{quiet:{get:()=>oi.quiet,set:s=>{oi.quiet=s},enumerable:!0,configurable:!1},noColor:{get:()=>oi.noColor,set:s=>{oi.noColor=s},enumerable:!0,configurable:!1}});const qo=()=>{};function ys(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function Cn(s){return!(s&s-1)&&!!s}function $o(s){const t={};for(const e in s)s[e]!==void 0&&(t[e]=s[e]);return t}const Mn=Object.create(null);function Yl(s){const t=Mn[s];return t===void 0&&(Mn[s]=Ot("resource")),t}const Ko=class Zo extends we{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...Zo.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){ht(wt,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Yl(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Ko.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let xs=Ko;const Qo=class Jo extends we{constructor(t={}){super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=Ot("textureSource"),this._resourceType="textureSource",this._resourceId=Ot("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...Jo.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new xs($o(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(t){this._style.maxAnisotropy=t}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=Ot("resource"),this.emit("change",this),this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy?.();this._gpuData=Object.create(null)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);const r=Math.round(t*i),n=Math.round(e*i);return this.width=r/i,this.height=n/i,this._resolution=i,this.pixelWidth===r&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=n,this.emit("resize",this),this._resourceId=Ot("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Cn(this.pixelWidth)&&Cn(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Qo.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let me=Qo;class Zr extends me{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}Zr.extension=$.TextureSource;const Tn=new pt;class jl{constructor(t,e){this.mapCoord=new pt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let r=0;rthis.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Mt);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Pn,this}set(t,e,i,r){this.minX=t,this.minY=e,this.maxX=i,this.maxY=r}addFrame(t,e,i,r,n){n||(n=this.matrix);const o=n.a,a=n.b,h=n.c,l=n.d,c=n.tx,u=n.ty;let _=this.minX,d=this.minY,f=this.maxX,g=this.maxY,p=o*t+h*e+c,y=a*t+l*e+u;p<_&&(_=p),yf&&(f=p),y>g&&(g=y),p=o*i+h*e+c,y=a*i+l*e+u,p<_&&(_=p),yf&&(f=p),y>g&&(g=y),p=o*t+h*r+c,y=a*t+l*r+u,p<_&&(_=p),yf&&(f=p),y>g&&(g=y),p=o*i+h*r+c,y=a*i+l*r+u,p<_&&(_=p),yf&&(f=p),y>g&&(g=y),this.minX=_,this.minY=d,this.maxX=f,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxXthis.maxX?_:this.maxX,this.maxY=d>this.maxY?d:this.maxY,_=o*e+h*n+c,d=a*e+l*n+u,this.minX=_this.maxX?_:this.maxX,this.maxY=d>this.maxY?d:this.maxY,_=o*r+h*n+c,d=a*r+l*n+u,this.minX=_this.maxX?_:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(t){return this.minXt.right&&(this.maxX=t.right),this.minYt.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,r){return this.minXe&&(this.maxX=e),this.minYr&&(this.maxY=r),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new be(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,r){let n=this.minX,o=this.minY,a=this.maxX,h=this.maxY;r||(r=this.matrix);const l=r.a,c=r.b,u=r.c,_=r.d,d=r.tx,f=r.ty;for(let g=e;ga?x:a,h=v>h?v:h}this.minX=n,this.minY=o,this.maxX=a,this.maxY=h}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}var $l={grad:.9,turn:360,rad:360/(2*Math.PI)},ze=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},Yt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*s)/e+0},pe=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),s>e?e:s>t?s:t},ta=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},zn=function(s){return{r:pe(s.r,0,255),g:pe(s.g,0,255),b:pe(s.b,0,255),a:pe(s.a)}},Hs=function(s){return{r:Yt(s.r),g:Yt(s.g),b:Yt(s.b),a:Yt(s.a,3)}},Kl=/^#([0-9a-f]{3,8})$/i,Ki=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},ea=function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:r}},ia=function(s){var t=s.h,e=s.s,i=s.v,r=s.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),l=n%6;return{r:255*[i,a,o,o,h,i][l],g:255*[h,i,i,a,o,o][l],b:255*[o,o,h,i,i,a][l],a:r}},In=function(s){return{h:ta(s.h),s:pe(s.s,0,100),l:pe(s.l,0,100),a:pe(s.a)}},En=function(s){return{h:Yt(s.h),s:Yt(s.s),l:Yt(s.l),a:Yt(s.a,3)}},Rn=function(s){return ia((e=(t=s).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},zi=function(s){return{h:(t=ea(s)).h,s:(r=(200-(e=t.s))*(i=t.v)/100)>0&&r<200?e*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,i,r},Zl=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ql=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Jl=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,wr={string:[[function(s){var t=Kl.exec(s);return t?(s=t[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?Yt(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?Yt(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var t=Jl.exec(s)||tc.exec(s);return t?t[2]!==t[4]||t[4]!==t[6]?null:zn({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(s){var t=Zl.exec(s)||Ql.exec(s);if(!t)return null;var e,i,r=In({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*($l[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Rn(r)},"hsl"]],object:[[function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=r===void 0?1:r;return ze(t)&&ze(e)&&ze(i)?zn({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(s){var t=s.h,e=s.s,i=s.l,r=s.a,n=r===void 0?1:r;if(!ze(t)||!ze(e)||!ze(i))return null;var o=In({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Rn(o)},"hsl"],[function(s){var t=s.h,e=s.s,i=s.v,r=s.a,n=r===void 0?1:r;if(!ze(t)||!ze(e)||!ze(i))return null;var o=(function(a){return{h:ta(a.h),s:pe(a.s,0,100),v:pe(a.v,0,100),a:pe(a.a)}})({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return ia(o)},"hsv"]]},Fn=function(s,t){for(var e=0;e=.5},s.prototype.toHex=function(){return t=Hs(this.rgba),e=t.r,i=t.g,r=t.b,o=(n=t.a)<1?Ki(Yt(255*n)):"","#"+Ki(e)+Ki(i)+Ki(r)+o;var t,e,i,r,n,o},s.prototype.toRgb=function(){return Hs(this.rgba)},s.prototype.toRgbString=function(){return t=Hs(this.rgba),e=t.r,i=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+r+", "+n+")":"rgb("+e+", "+i+", "+r+")";var t,e,i,r,n},s.prototype.toHsl=function(){return En(zi(this.rgba))},s.prototype.toHslString=function(){return t=En(zi(this.rgba)),e=t.h,i=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+r+"%, "+n+")":"hsl("+e+", "+i+"%, "+r+"%)";var t,e,i,r,n},s.prototype.toHsv=function(){return t=ea(this.rgba),{h:Yt(t.h),s:Yt(t.s),v:Yt(t.v),a:Yt(t.a,3)};var t},s.prototype.invert=function(){return Ae({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},s.prototype.saturate=function(t){return t===void 0&&(t=.1),Ae(Vs(this.rgba,t))},s.prototype.desaturate=function(t){return t===void 0&&(t=.1),Ae(Vs(this.rgba,-t))},s.prototype.grayscale=function(){return Ae(Vs(this.rgba,-1))},s.prototype.lighten=function(t){return t===void 0&&(t=.1),Ae(Bn(this.rgba,t))},s.prototype.darken=function(t){return t===void 0&&(t=.1),Ae(Bn(this.rgba,-t))},s.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},s.prototype.alpha=function(t){return typeof t=="number"?Ae({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):Yt(this.rgba.a,3);var e},s.prototype.hue=function(t){var e=zi(this.rgba);return typeof t=="number"?Ae({h:t,s:e.s,l:e.l,a:e.a}):Yt(e.h)},s.prototype.isEqual=function(t){return this.toHex()===Ae(t).toHex()},s})(),Ae=function(s){return s instanceof kr?s:new kr(s)},Ln=[],ic=function(s){s.forEach(function(t){Ln.indexOf(t)<0&&(t(kr,wr),Ln.push(t))})};function sc(s,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var r in e)i[e[r]]=r;var n={};s.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(o?.closest){var c=this.toRgb(),u=1/0,_="black";if(!n.length)for(var d in e)n[d]=new s(e[d]).toRgb();for(var f in e){var g=(a=c,h=n[f],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));gn===e[o]);if(t!==null&&e!==null){const n=Object.keys(t),o=Object.keys(e);return n.length!==o.length?!1:n.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,i,r]=this._components;return{r:t,g:e,b:i,a:r}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,r]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(r*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,i,r,n]=this._components;return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,i,r]=this._components;return t[0]=e,t[1]=i,t[2]=r,t}toNumber(){return this._int}toBgrNumber(){const[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,r,n]=Ci._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=r,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,i,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,r=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,r,n=255]=t,e/=255,i/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=Ci.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Ae(t);o.isValid()&&({r:e,g:i,b:r,a:n}=o.rgba,e/=255,i/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=r,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Ci||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};ui.shared=new ui;ui._temp=new ui;ui.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Ht=ui;const rc={cullArea:null,cullable:!1,cullableChildren:!0};let Ys=0;const On=500;function zt(...s){Ys!==On&&(Ys++,Ys===On?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...s))}const Wi={_registeredResources:new Set,register(s){this._registeredResources.add(s)},unregister(s){this._registeredResources.delete(s)},release(){this._registeredResources.forEach(s=>s.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(s){return this._registeredResources.has(s)},reset(){this._registeredResources.clear()}};class nc{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e0?e=this._pool[--this._index]:(e=new this._classType,this._count++),e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let t=0;t{const i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}clear(){this._poolsByClass.forEach(t=>t.clear()),this._poolsByClass.clear()}}const ge=new oc;Wi.register(ge);const ac={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(s){typeof s=="boolean"&&s===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(s===!0?{}:s))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(s){ht("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(s)}};function hc(s,t,e){const i=s.length;let r;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(r=t;r0&&i<=e){for(let o=e-1;o>=s;o--){const a=this.children[o];a&&(r.push(a),a.parent=null)}hc(this.children,s,e);const n=this.renderGroup||this.parentRenderGroup;n&&n.removeChildren(r);for(let o=0;o0&&this._didViewChangeTick++,r}else if(i===0&&this.children.length===0)return r;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(s){const t=this.getChildAt(s);return this.removeChild(t)},getChildAt(s){if(s<0||s>=this.children.length)throw new Error(`getChildAt: Index (${s}) does not exist.`);return this.children[s]},setChildIndex(s,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(s),this.addChildAt(s,t)},getChildIndex(s){const t=this.children.indexOf(s);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(s,t){this.allowChildren||ht(wt,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:e}=this;if(t<0||t>e.length)throw new Error(`${s}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(s.parent){const r=s.parent.children.indexOf(s);if(s.parent===this&&r===t)return s;r!==-1&&s.parent.children.splice(r,1)}t===e.length?e.push(s):e.splice(t,0,s),s.parent=this,s.didChange=!0,s._updateFlags=15;const i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(s),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",s,this,t),s.emit("added",this),s},swapChildren(s,t){if(s===t)return;const e=this.getChildIndex(s),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=s;const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...s){return s.length===1?this.reparentChildAt(s[0],this.children.length):(s.forEach(t=>this.reparentChildAt(t,this.children.length)),s[0])},reparentChildAt(s,t){if(s.parent===this)return this.setChildIndex(s,t),s;const e=s.worldTransform.clone();s.removeFromParent(),this.addChildAt(s,t);const i=this.worldTransform.clone();return i.invert(),e.prepend(i),s.setFromMatrix(e),s},replaceChild(s,t){s.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(s)),t.setFromMatrix(s.localTransform),t.updateLocalTransform(),this.removeChild(s)}},cc={collectRenderables(s,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(s,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,s):this.collectRenderablesWithEffects(s,t,e))},collectRenderablesSimple(s,t,e){const i=this.children,r=i.length;for(let n=0;n=0;r--){const n=this.effects[r];i[n.pipe].pop(n,this,s)}}};class Gn{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;ee.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(s){const t=this.effects.indexOf(s);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(s){const t=this._maskEffect;t?.mask!==s&&(t&&(this.removeEffect(t),Ar.returnMaskEffect(t),this._maskEffect=null),s!=null&&(this._maskEffect=Ar.getMaskEffect(s),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(s){this._maskOptions={...this._maskOptions,...s},s.mask&&(this.mask=s.mask),this._markStructureAsChanged()},set filters(s){!Array.isArray(s)&&s&&(s=[s]);const t=this._filterEffect||(this._filterEffect=new Gn);s=s;const e=s?.length>0,i=t.filters?.length>0,r=e!==i;s=Array.isArray(s)?s.slice(0):s,t.filters=Object.freeze(s),r&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=s??null))},get filters(){return this._filterEffect?.filters},set filterArea(s){this._filterEffect||(this._filterEffect=new Gn),this._filterEffect.filterArea=s},get filterArea(){return this._filterEffect?.filterArea}},_c={label:null,get name(){return ht(wt,"Container.name property has been removed, use Container.label instead"),this.label},set name(s){ht(wt,"Container.name property has been removed, use Container.label instead"),this.label=s},getChildByName(s,t=!1){return this.getChildByLabel(s,t)},getChildByLabel(s,t=!1){const e=this.children;for(let i=0;i>16&255,i=s>>8&255,r=s&255,n=t>>16&255,o=t>>8&255,a=t&255,h=e*n/255|0,l=i*o/255|0,c=r*a/255|0;return(h<<16)+(l<<8)+c}const Dn=16777215;function Un(s,t){return s===Dn?t:t===Dn?s:na(s,t)}function cs(s){return((s&255)<<16)+(s&65280)+(s>>16&255)}const gc={getGlobalAlpha(s){if(s)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(s=new pt,t){if(t)return s.copyFrom(this.worldTransform);this.updateLocalTransform();const e=Qr(this,te.get().identity());return s.appendFrom(this.localTransform,e),te.return(e),s},getGlobalTint(s){if(s)return this.renderGroup?cs(this.renderGroup.worldColor):this.parentRenderGroup?cs(Un(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Un(t,e.localColor),e=e.parent;return cs(t)}};function oa(s,t,e){return t.clear(),e||(e=pt.IDENTITY),aa(s,t,e,s,!0),t.isValid||t.set(0,0,0,0),t}function aa(s,t,e,i,r){let n;if(r)n=te.get(),n=e.copyTo(n);else{if(!s.visible||!s.measurable)return;s.updateLocalTransform();const h=s.localTransform;n=te.get(),n.appendFrom(h,e)}const o=t,a=!!s.effects.length;if(a&&(t=Ee.get().clear()),s.boundsArea)t.addRect(s.boundsArea,n);else{s.renderPipeId&&(t.matrix=n,t.addBounds(s.bounds));const h=s.children;for(let l=0;l-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);const e=t.children;for(let i=0;i0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;ethis.addChild(e)),t.parent?.addChild(this)}static mixin(t){ht("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),$t.mixin(lt,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||ht(wt,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let r=0;r1){for(let r=0;r-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=ge.get(Sc,this),this.groupTransform=pt.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),ge.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new pt),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*Ul}set angle(t){this.rotation=t*Nl}get pivot(){return this._pivot===Zi&&(this._pivot=new Kt(this,0,0)),this._pivot}set pivot(t){this._pivot===Zi&&(this._pivot=new Kt(this,0,0),this._origin!==Qi&&zt("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===js&&(this._skew=new Kt(this,0,0)),this._skew}set skew(t){this._skew===js&&(this._skew=new Kt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===qs&&(this._scale=new Kt(this,1,1)),this._scale}set scale(t){this._scale===qs&&(this._scale=new Kt(this,0,0)),typeof t=="string"&&(t=parseFloat(t)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get origin(){return this._origin===Qi&&(this._origin=new Kt(this,0,0)),this._origin}set origin(t){this._origin===Qi&&(this._origin=new Kt(this,0,0),this._pivot!==Zi&&zt("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._origin.set(t):this._origin.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){const i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this.origin.set(typeof t.originX=="number"?t.originX:this.origin.x,typeof t.originY=="number"?t.originY:this.origin.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,i=this._scale,r=this._pivot,n=this._origin,o=this._position,a=i._x,h=i._y,l=r._x,c=r._y,u=-n._x,_=-n._y;e.a=this._cx*a,e.b=this._sx*a,e.c=this._cy*h,e.d=this._sy*h,e.tx=o._x-(l*e.a+c*e.c)+(u*e.a+_*e.c)-u,e.ty=o._y-(l*e.b+c*e.d)+(u*e.b+_*e.d)-_}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Nn,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const i=Ht.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Nn,this._onUpdate())}get tint(){return cs(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Mc,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=$s,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=$s,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=$s,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let r=0;r=e.minX&&i<=e.maxX&&r>=e.minY&&r<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){const{renderPipes:r}=e;r.blendMode.pushBlendMode(this,this.groupBlendMode,t),r[this.renderPipeId].addRenderable(this,t),this.didViewUpdate=!1;const o=this.children,a=o.length;for(let h=0;h{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=r??!1,n!==void 0&&(this.width=n),o!==void 0&&(this.height=o)}static from(t,e=!1){return t instanceof _t?new kt(t):new kt(_t.from(t,e))}set texture(t){t||(t=_t.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return ql(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return ht("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,i=this._bounds,{width:r,height:n}=e.orig;i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*n,i.maxY=i.minY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){const i=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}const Tc=new be;function ua(s,t,e){const i=Tc;s.measurable=!0,sa(s,e,i),t.addBoundsMask(i),s.measurable=!1}function da(s,t,e){const i=Ee.get();s.measurable=!0;const r=te.get().identity(),n=_a(s,e,r);oa(s,i,n),s.measurable=!1,t.addBoundsMask(i),te.return(r),Ee.return(i)}function _a(s,t,e){return s?(s!==t&&(_a(s.parent,t,e),s.updateLocalTransform(),e.append(s.localTransform)),e):(zt("Mask bounds, renderable is not inside the root container"),e)}class fa{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof kt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(t,e){this.inverse||ua(this.mask,t,e)}addLocalBounds(t,e){da(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof kt}}fa.extension=$.MaskEffect;class pa{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}pa.extension=$.MaskEffect;class ga{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(t,e){ua(this.mask,t,e)}addLocalBounds(t,e){da(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof lt}}ga.extension=$.MaskEffect;const Pc={createCanvas:(s,t)=>{const e=document.createElement("canvas");return e.width=s,e.height=t,e},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,t)=>fetch(s,t),parseXML:s=>new DOMParser().parseFromString(s,"text/xml")};let Wn=Pc;const It={get(){return Wn},set(s){Wn=s}};class ma extends me{constructor(t){t.resource||(t.resource=It.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){const r=super.resize(t,e,i);return r&&this.resizeCanvas(),r}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}ma.extension=$.TextureSource;class Je extends me{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}Je.extension=$.TextureSource;var Sr=(s=>(s[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY",s))(Sr||{});class Ks{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=r}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const ya=class oe{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Ks(null,null,1/0),this.deltaMS=1/oe.targetFPMS,this.elapsedMS=1/oe.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Sr.NORMAL){return this._addListener(new Ks(t,e,i))}addOnce(t,e,i=Sr.NORMAL){return this._addListener(new Ks(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n{const t=It.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(r),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Zs}const Ss=class ba extends me{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...ba.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=Ji.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await xa(),this._load=new Promise((i,r)=>{this.isValid?i(this):(this._resolve=i,this._reject=r,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Ji.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Ji.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ji.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Ss.extension=$.TextureSource;Ss.defaultOptions={...me.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Ss.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Ii=Ss;const xe=(s,t,e=!1)=>(Array.isArray(s)||(s=[s]),t?s.map(i=>typeof i=="string"||e?t(i):i):s);class zc{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||zt(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=xe(t);let r;for(let h=0;h{n.set(h,e)});const o=[...n.keys()],a={cacheKeys:o,keys:i};i.forEach(h=>{this._cacheMap.set(h,a)}),o.forEach(h=>{const l=r?r[h]:e;this._cache.has(h)&&this._cache.get(h)!==l&&zt("[Cache] already has key:",h),this._cache.set(h,n.get(h))})}remove(t){if(!this._cacheMap.has(t)){zt(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(r=>{this._cache.delete(r)}),e.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}}const Pt=new zc,Cr=[];$t.handleByList($.TextureSource,Cr);function va(s={}){const t=s&&s.resource,e=t?s.resource:s,i=t?s:{resource:s};for(let r=0;r{Pt.has(i)&&Pt.remove(i)}),t||Pt.set(i,n),n}function Ec(s,t=!1){return typeof s=="string"?Pt.get(s):s instanceof me?new _t({source:s}):Ic(s,t)}_t.from=Ec;me.from=va;$t.add(fa,pa,ga,Ii,Je,ma,Zr);var He=(s=>(s[s.Low=0]="Low",s[s.Normal=1]="Normal",s[s.High=2]="High",s))(He||{});function ye(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function xi(s){return s.split("?")[0].split("#")[0]}function Rc(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fc(s,t,e){return s.replace(new RegExp(Rc(t),"g"),e)}function Bc(s,t){let e="",i=0,r=-1,n=0,o=-1;for(let a=0;a<=s.length;++a){if(a2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),r=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,r=a,n=0;continue}}}else e.length>0?e+=`/${s.slice(r+1,a)}`:e=s.slice(r+1,a),i=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const le={toPosix(s){return Fc(s,"\\","/")},isUrl(s){return/^https?:/.test(this.toPosix(s))},isDataUrl(s){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(s)},isBlobUrl(s){return s.startsWith("blob:")},hasProtocol(s){return/^[^/:]+:/.test(this.toPosix(s))},getProtocol(s){ye(s),s=this.toPosix(s);const t=/^file:\/\/\//.exec(s);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(s);return e?e[0]:""},toAbsolute(s,t,e){if(ye(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=xi(this.toPosix(t??It.get().getBaseUrl())),r=xi(this.toPosix(e??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?le.join(r,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(ye(s),s.length===0)return".";if(this.isDataUrl(s)||this.isBlobUrl(s))return s;s=this.toPosix(s);let t="";const e=s.startsWith("/");this.hasProtocol(s)&&(t=this.rootname(s),s=s.slice(t.length));const i=s.endsWith("/");return s=Bc(s),s.length>0&&i&&(s+="/"),e?`/${s}`:t+s},isAbsolute(s){return ye(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let t;for(let e=0;e0)if(t===void 0)t=i;else{const r=s[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(s){if(ye(s),s.length===0)return".";s=this.toPosix(s);let t=s.charCodeAt(0);const e=t===47;let i=-1,r=!0;const n=this.getProtocol(s),o=s;s=s.slice(n.length);for(let a=s.length-1;a>=1;--a)if(t=s.charCodeAt(a),t===47){if(!r){i=a;break}}else r=!1;return i===-1?e?"/":this.isUrl(o)?n+s:n:e&&i===1?"//":n+s.slice(0,i)},rootname(s){ye(s),s=this.toPosix(s);let t="";if(s.startsWith("/")?t="/":t=this.getProtocol(s),this.isUrl(s)){const e=s.indexOf("/",t.length);e!==-1?t=s.slice(0,e):t=s,t.endsWith("/")||(t+="/")}return t},basename(s,t){ye(s),t&&ye(t),s=xi(this.toPosix(s));let e=0,i=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=s.length){if(t.length===s.length&&t===s)return"";let o=t.length-1,a=-1;for(n=s.length-1;n>=0;--n){const h=s.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else a===-1&&(r=!1,a=n+1),o>=0&&(h===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=s.length),s.slice(e,i)}for(n=s.length-1;n>=0;--n)if(s.charCodeAt(n)===47){if(!r){e=n+1;break}}else i===-1&&(r=!1,i=n+1);return i===-1?"":s.slice(e,i)},extname(s){ye(s),s=xi(this.toPosix(s));let t=-1,e=0,i=-1,r=!0,n=0;for(let o=s.length-1;o>=0;--o){const a=s.charCodeAt(o);if(a===47){if(!r){e=o+1;break}continue}i===-1&&(r=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":s.slice(t,i)},parse(s){ye(s);const t={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return t;s=xi(this.toPosix(s));let e=s.charCodeAt(0);const i=this.isAbsolute(s);let r;t.root=this.rootname(s),i||this.hasProtocol(s)?r=1:r=0;let n=-1,o=0,a=-1,h=!0,l=s.length-1,c=0;for(;l>=r;--l){if(e=s.charCodeAt(l),e===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),e===46?n===-1?n=l:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||a===-1||c===0||c===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=s.slice(1,a):t.base=t.name=s.slice(o,a)):(o===0&&i?(t.name=s.slice(1,n),t.base=s.slice(1,a)):(t.name=s.slice(o,n),t.base=s.slice(o,a)),t.ext=s.slice(n,a)),t.dir=this.dirname(s),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function wa(s,t,e,i,r){const n=t[e];for(let o=0;o{const o=n.substring(1,n.length-1).split(",");r.push(o)}),wa(s,r,0,e,i)}else i.push(s);return i}const bs=s=>!Array.isArray(s);class pi{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,src:i}=t;return xe(e||i,n=>typeof n=="string"?n:Array.isArray(n)?n.map(o=>o?.src??o):n?.src?n.src:n,!0)}addManifest(t){this._manifest&&zt("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];let r=e;Array.isArray(e)||(r=Object.entries(e).map(([n,o])=>typeof o=="string"||Array.isArray(o)?{alias:n,src:o}:{alias:n,...o})),r.forEach(n=>{const o=n.src,a=n.alias;let h;if(typeof a=="string"){const l=this._createBundleAssetId(t,a);i.push(l),h=[a,l]}else{const l=a.map(c=>this._createBundleAssetId(t,c));i.push(...l),h=[...a,...l]}this.add({...n,alias:h,src:o})}),this._bundles[t]=i}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=n=>{this.hasKey(n)&&zt(`[Resolver] already has key: ${n} overwriting`)},xe(e).forEach(n=>{const{src:o}=n;let{data:a,format:h,loadParser:l,parser:c}=n;const u=xe(o).map(g=>typeof g=="string"?Lc(g):Array.isArray(g)?g:[g]),_=this.getAlias(n);Array.isArray(_)?_.forEach(i):i(_);const d=[],f=g=>({...this._parsers.find(y=>y.test(g))?.parse(g),src:g});u.forEach(g=>{g.forEach(p=>{let y={};if(typeof p!="object"?y=f(p):(a=p.data??a,h=p.format??h,(p.loadParser||p.parser)&&(l=p.loadParser??l,c=p.parser??c),y={...f(p.src),...p}),!_)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this._buildResolvedAsset(y,{aliases:_,data:a,format:h,loadParser:l,parser:c,progressSize:n.progressSize}),d.push(y)})}),_.forEach(g=>{this._assetMap[g]=d})})}resolveBundle(t){const e=bs(t);t=xe(t);const i={};return t.forEach(r=>{const n=this._bundles[r];if(n){const o=this.resolve(n),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(r,h)]=l}i[r]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const r in e)i[r]=e[r].src;return i}return e.src}resolve(t){const e=bs(t);t=xe(t);const i={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const o=this._getPreferredOrder(n);o?.priority.forEach(a=>{o.params[a].forEach(h=>{const l=n.filter(c=>c[a]?c[a]===h:!1);l.length&&(n=l)})}),this._resolverHash[r]=n[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:i,data:r,loadParser:n,parser:o,format:a,progressSize:h}=e;return(this._basePath||this._rootPath)&&(t.src=le.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.parser=o??t.parser,t.format=a??t.format??Oc(t.src),h!==void 0&&(t.progressSize=h),t}}pi.RETINA_PREFIX=/@([0-9\.]+)x/;function Oc(s){return s.split(".").pop().split("?").shift().split("#").shift()}const Mr=(s,t)=>{const e=t.split("?")[1];return e&&(s+=`?${e}`),s},ka=class Mi{constructor(t,e){this.linkedSheets=[];let i=t;t?.source instanceof me&&(i={texture:t,data:e});const{texture:r,data:n,cachePrefix:o=""}=i;this.cachePrefix=o,this._texture=r instanceof _t?r:null,this.textureSource=r.source,this.textures={},this.animations={},this.data=n;const a=parseFloat(n.meta.scale);a?(this.resolution=a,r.source.resolution=this.resolution):this.resolution=r.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Mi.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=Mi.BATCH_SIZE;for(;e-t{this._batchIndex*Mi.BATCH_SIZE{i[r]=t}),Object.keys(t.textures).forEach(r=>{i[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=le.dirname(s[0]);t.linkedSheets.forEach((n,o)=>{const a=Aa([`${r}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const Dc={extension:$.Asset,cache:{test:s=>s instanceof Hn,getCacheableAssets:(s,t)=>Aa(s,t,!1)},resolver:{extension:{type:$.ResolveParser,name:"resolveSpritesheet"},test:s=>{const e=s.split("?")[0].split("."),i=e.pop(),r=e.pop();return i==="json"&&Gc.includes(r)},parse:s=>{const t=s.split(".");return{resolution:parseFloat(pi.RETINA_PREFIX.exec(s)?.[1]??"1"),format:t[t.length-2],src:s}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:$.LoadParser,priority:He.Normal,name:"spritesheetLoader"},async testParse(s,t){return le.extname(t.src).toLowerCase()===".json"&&!!s.frames},async parse(s,t,e){const{texture:i,imageFilename:r,textureOptions:n,cachePrefix:o}=t?.data??{};let a=le.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let h;if(i instanceof _t)h=i;else{const u=Mr(a+(r??s.meta.image),t.src);h=(await e.load([{src:u,data:n}]))[u]}const l=new Hn({texture:h.source,data:s,cachePrefix:o});await l.parse();const c=s?.meta?.related_multi_packs;if(Array.isArray(c)){const u=[];for(const d of c){if(typeof d!="string")continue;let f=a+d;t.data?.ignoreMultiPack||(f=Mr(f,t.src),u.push(e.load({src:f,data:{textureOptions:n,ignoreMultiPack:!0}})))}const _=await Promise.all(u);l.linkedSheets=_,_.forEach(d=>{d.linkedSheets=[l].concat(l.linkedSheets.filter(f=>f!==d))})}return l},async unload(s,t,e){await e.unload(s.textureSource._sourceOrigin),s.destroy(!1)}}};$t.add(Dc);const Qs=Object.create(null),Vn=Object.create(null);function Jr(s,t){let e=Vn[s];return e===void 0&&(Qs[t]===void 0&&(Qs[t]=1),Vn[s]=e=Qs[t]++),e}let ts;function Sa(){return(!ts||ts?.isContextLost())&&(ts=It.get().createCanvas().getContext("webgl",{})),ts}let es;function Uc(){if(!es){es="mediump";const s=Sa();s&&s.getShaderPrecisionFormat&&(es=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision?"highp":"mediump")}return es}function Nc(s,t,e){return t?s:e?(s=s.replace("out vec4 finalColor;",""),` + + #ifdef GL_ES // This checks if it is WebGL1 + #define in varying + #define finalColor gl_FragColor + #define texture texture2D + #endif + ${s} + `):` + + #ifdef GL_ES // This checks if it is WebGL1 + #define in attribute + #define out varying + #endif + ${s} + `}function Wc(s,t,e){const i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(s.substring(0,9)!=="precision"){let r=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return r==="highp"&&i!=="highp"&&(r="mediump"),`precision ${r} float; +${s}`}else if(i!=="highp"&&s.substring(0,15)==="precision highp")return s.replace("precision highp","precision mediump");return s}function Hc(s,t){return t?`#version 300 es +${s}`:s}const Vc={},Xc={};function Yc(s,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const i=e?Vc:Xc;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,s.indexOf("#define SHADER_NAME")!==-1?s:`${`#define SHADER_NAME ${t}`} +${s}`}function jc(s,t){return t?s.replace("#version 300 es",""):s}const Js={stripVersion:jc,ensurePrecision:Wc,addProgramDefines:Nc,setProgramName:Yc,insertVersion:Hc},bi=Object.create(null),Ca=class Tr{constructor(t){t={...Tr.defaultOptions,...t};const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Uc()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let r=t.fragment,n=t.vertex;Object.keys(Js).forEach(o=>{const a=i[o];r=Js[o](r,a,!0),n=Js[o](n,a,!1)}),this.fragment=r,this.vertex=n,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Jr(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null,bi[this._cacheKey]=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return bi[e]||(bi[e]=new Tr(t),bi[e]._cacheKey=e),bi[e]}};Ca.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let _i=Ca;const Xn={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function qc(s){return Xn[s]??Xn.float32}const $c={f32:"float32","vec2":"float32x2","vec3":"float32x3","vec4":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2":"sint32x2","vec3":"sint32x3","vec4":"sint32x4",u32:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4",bool:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4"};function Kc({source:s,entryPoint:t}){const e={},i=s.indexOf(`fn ${t}`);if(i!==-1){const r=s.indexOf("->",i);if(r!==-1){const n=s.substring(i,r),o=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g;let a;for(;(a=o.exec(n))!==null;){const h=$c[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:h,stride:qc(h).stride,offset:0,instance:!1,start:0}}}}return e}function tr(s){const t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,r=/var(<[^>]+>)? (\w+)/,n=/:\s*(\w+)/,o=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,l=s.match(t)?.map(u=>({group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(i)[1],10),name:u.match(r)[2],isUniform:u.match(r)[1]==="",type:u.match(n)[1]}));if(!l)return{groups:[],structs:[]};const c=s.match(o)?.map(u=>{const _=u.match(h)[1],d=u.match(a).reduce((f,g)=>{const[p,y]=g.split(":");return f[p.trim()]=y.trim(),f},{});return d?{name:_,members:d}:null}).filter(({name:u})=>l.some(_=>_.type===u))??[];return{groups:l,structs:c}}var Ti=(s=>(s[s.VERTEX=1]="VERTEX",s[s.FRAGMENT=2]="FRAGMENT",s[s.COMPUTE=4]="COMPUTE",s))(Ti||{});function Zc({groups:s}){const t=[];for(let e=0;ee.has(o.name)?!1:(e.add(o.name),!0)),n=[...s.groups,...t.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return i.has(a)?!1:(i.add(a),!0)});return{structs:r,groups:n}}const vi=Object.create(null);class We{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:i,layout:r,gpuLayout:n,name:o}=t;if(this.name=o,this.fragment=e,this.vertex=i,e.source===i.source){const a=tr(e.source);this.structsAndGroups=a}else{const a=tr(i.source),h=tr(e.source);this.structsAndGroups=Jc(a,h)}this.layout=r??Qc(this.structsAndGroups),this.gpuLayout=n??Zc(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Jr(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=Kc(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,vi[this._cacheKey]=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return vi[e]||(vi[e]=new We(t),vi[e]._cacheKey=e),vi[e]}}const Ma=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4","vec2","vec3","vec4"],tu=Ma.reduce((s,t)=>(s[t]=!0,s),{});function eu(s,t){switch(s){case"f32":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const Ta=class Pa{constructor(t,e){this._touched=0,this.uid=Ot("uniform"),this._resourceType="uniformGroup",this._resourceId=Ot("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Pa.defaultOptions,...e},this.uniformStructures=t;const i={};for(const r in t){const n=t[r];if(n.name=r,n.size=n.size??1,!tu[n.type]){const o=n.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){const[,a,h]=o;throw new Error(`Uniform type ${n.type} is not supported. Use type: '${a}', size: ${h} instead.`)}throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${Ma.join(", ")}`)}n.value??(n.value=eu(n.type,n.size)),i[r]=n.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Jr(Object.keys(i).map(r=>`${r}-${t[r].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Ta.defaultOptions={ubo:!1,isStatic:!1};let za=Ta;class us{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const r=t[i];this.setResource(r,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){const i=this.resources[e];t!==i&&(i&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t,e){const i=this.resources;for(const r in i)i[r]._gcLastUsed=t,i[r]._touched=e}destroy(){const t=this.resources;for(const e in t)t[e]?.off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){const e=this.resources;for(const i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}var Pr=(s=>(s[s.WEBGL=1]="WEBGL",s[s.WEBGPU=2]="WEBGPU",s[s.BOTH=3]="BOTH",s))(Pr||{});class Cs extends we{constructor(t){super(),this.uid=Ot("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:i,groups:r,resources:n,compatibleRenderers:o,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,o===void 0&&(o=0,e&&(o|=Pr.WEBGPU),i&&(o|=Pr.WEBGL)),this.compatibleRenderers=o;const h={};if(!n&&!r&&(n={}),n&&r)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&r&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&r&&a)for(const l in a)for(const c in a[l]){const u=a[l][c];h[u]={group:l,binding:c,name:u}}else if(e&&r&&!a){const l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[c.name]=c})}else if(n){r={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,h[u.name]=u});let l=0;for(const c in n)h[c]||(r[99]||(r[99]=new us,this._ownedBindGroups.push(r[99])),h[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(const c in n){const u=c;let _=n[c];!_.source&&!_._resourceType&&(_=new za(_));const d=h[u];d&&(r[d.group]||(r[d.group]=new us,this._ownedBindGroups.push(r[d.group])),r[d.group].setResource(_,d.binding))}}this.groups=r,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(r,h)}addResource(t,e,i){var r,n;(r=this._uniformBindMap)[e]||(r[e]={}),(n=this._uniformBindMap[e])[i]||(n[i]=t),this.groups[e]||(this.groups[e]=new us,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const r in e){const n=e[r];Object.defineProperty(i,n.name,{get(){return t[n.group].getResource(n.binding)},set(o){t[n.group].setResource(o,n.binding)}})}return i}destroy(t=!1){this._destroyed||(this._destroyed=!0,this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const{gpu:e,gl:i,...r}=t;let n,o;return e&&(n=We.from(e)),i&&(o=_i.from(i)),new Cs({gpuProgram:n,glProgram:o,...r})}}const iu={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},er=0,ir=1,sr=2,rr=3,nr=4,or=5,zr=class Ia{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<80*e){a=s[0],h=s[1];let c=a,u=h;for(let _=e;_c&&(c=d),f>u&&(u=f)}l=Math.max(c-a,u-h),l=l!==0?32767/l:0}return Oi(n,o,e,a,h,l,0),o}function Ra(s,t,e,i,r){let n;if(r===vu(s,t,e,i)>0)for(let o=t;o=t;o-=i)n=jn(o/i|0,s[o],s[o+1],n);return n&&fi(n,n.next)&&(Di(n),n=n.next),n}function ti(s,t){if(!s)return s;t||(t=s);let e=s,i;do if(i=!1,!e.steiner&&(fi(e,e.next)||Bt(e.prev,e,e.next)===0)){if(Di(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Oi(s,t,e,i,r,n,o){if(!s)return;!o&&n&&pu(s,i,r,n);let a=s;for(;s.prev!==s.next;){const h=s.prev,l=s.next;if(n?au(s,i,r,n):ou(s)){t.push(h.i,s.i,l.i),Di(s),s=l.next,a=l.next;continue}if(s=l,s===a){o?o===1?(s=hu(ti(s),t),Oi(s,t,e,i,r,n,2)):o===2&&lu(s,t,e,i,r,n):Oi(ti(s),t,e,i,r,n,1);break}}}function ou(s){const t=s.prev,e=s,i=s.next;if(Bt(t,e,i)>=0)return!1;const r=t.x,n=e.x,o=i.x,a=t.y,h=e.y,l=i.y,c=Math.min(r,n,o),u=Math.min(a,h,l),_=Math.max(r,n,o),d=Math.max(a,h,l);let f=i.next;for(;f!==t;){if(f.x>=c&&f.x<=_&&f.y>=u&&f.y<=d&&Pi(r,a,n,h,o,l,f.x,f.y)&&Bt(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function au(s,t,e,i){const r=s.prev,n=s,o=s.next;if(Bt(r,n,o)>=0)return!1;const a=r.x,h=n.x,l=o.x,c=r.y,u=n.y,_=o.y,d=Math.min(a,h,l),f=Math.min(c,u,_),g=Math.max(a,h,l),p=Math.max(c,u,_),y=Fr(d,f,t,e,i),x=Fr(g,p,t,e,i);let v=s.prevZ,b=s.nextZ;for(;v&&v.z>=y&&b&&b.z<=x;){if(v.x>=d&&v.x<=g&&v.y>=f&&v.y<=p&&v!==r&&v!==o&&Pi(a,c,h,u,l,_,v.x,v.y)&&Bt(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=d&&b.x<=g&&b.y>=f&&b.y<=p&&b!==r&&b!==o&&Pi(a,c,h,u,l,_,b.x,b.y)&&Bt(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;v&&v.z>=y;){if(v.x>=d&&v.x<=g&&v.y>=f&&v.y<=p&&v!==r&&v!==o&&Pi(a,c,h,u,l,_,v.x,v.y)&&Bt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=d&&b.x<=g&&b.y>=f&&b.y<=p&&b!==r&&b!==o&&Pi(a,c,h,u,l,_,b.x,b.y)&&Bt(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function hu(s,t){let e=s;do{const i=e.prev,r=e.next.next;!fi(i,r)&&Ba(i,e,e.next,r)&&Gi(i,r)&&Gi(r,i)&&(t.push(i.i,e.i,r.i),Di(e),Di(e.next),e=s=r),e=e.next}while(e!==s);return ti(e)}function lu(s,t,e,i,r,n){let o=s;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&yu(o,a)){let h=La(o,a);o=ti(o,o.next),h=ti(h,h.next),Oi(o,t,e,i,r,n,0),Oi(h,t,e,i,r,n,0);return}a=a.next}o=o.next}while(o!==s)}function cu(s,t,e,i){const r=[];for(let n=0,o=t.length;n=e.next.y&&e.next.y!==e.y){const u=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(u<=i&&u>n&&(n=u,o=e.x=e.x&&e.x>=h&&i!==e.x&&Fa(ro.x||e.x===o.x&&fu(o,e)))&&(o=e,c=u)}e=e.next}while(e!==a);return o}function fu(s,t){return Bt(s.prev,s,t.prev)<0&&Bt(t.next,s,s.next)<0}function pu(s,t,e,i){let r=s;do r.z===0&&(r.z=Fr(r.x,r.y,t,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==s);r.prevZ.nextZ=null,r.prevZ=null,gu(r)}function gu(s){let t,e=1;do{let i=s,r;s=null;let n=null;for(t=0;i;){t++;let o=i,a=0;for(let l=0;l0||h>0&&o;)a!==0&&(h===0||!o||i.z<=o.z)?(r=i,i=i.nextZ,a--):(r=o,o=o.nextZ,h--),n?n.nextZ=r:s=r,r.prevZ=n,n=r;i=o}n.nextZ=null,e*=2}while(t>1);return s}function Fr(s,t,e,i,r){return s=(s-e)*r|0,t=(t-i)*r|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function mu(s){let t=s,e=s;do(t.x=(s-o)*(n-a)&&(s-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(r-o)*(i-a)}function Pi(s,t,e,i,r,n,o,a){return!(s===o&&t===a)&&Fa(s,t,e,i,r,n,o,a)}function yu(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!xu(s,t)&&(Gi(s,t)&&Gi(t,s)&&bu(s,t)&&(Bt(s.prev,s,t.prev)||Bt(s,t.prev,t))||fi(s,t)&&Bt(s.prev,s,s.next)>0&&Bt(t.prev,t,t.next)>0)}function Bt(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function fi(s,t){return s.x===t.x&&s.y===t.y}function Ba(s,t,e,i){const r=ss(Bt(s,t,e)),n=ss(Bt(s,t,i)),o=ss(Bt(e,i,s)),a=ss(Bt(e,i,t));return!!(r!==n&&o!==a||r===0&&is(s,e,t)||n===0&&is(s,i,t)||o===0&&is(e,s,i)||a===0&&is(e,t,i))}function is(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function ss(s){return s>0?1:s<0?-1:0}function xu(s,t){let e=s;do{if(e.i!==s.i&&e.next.i!==s.i&&e.i!==t.i&&e.next.i!==t.i&&Ba(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function Gi(s,t){return Bt(s.prev,s,s.next)<0?Bt(s,t,s.next)>=0&&Bt(s,s.prev,t)>=0:Bt(s,t,s.prev)<0||Bt(s,s.next,t)<0}function bu(s,t){let e=s,i=!1;const r=(s.x+t.x)/2,n=(s.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==s);return i}function La(s,t){const e=Br(s.i,s.x,s.y),i=Br(t.i,t.x,t.y),r=s.next,n=t.prev;return s.next=t,t.prev=s,e.next=r,r.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function jn(s,t,e,i){const r=Br(s,t,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Di(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Br(s,t,e){return{i:s,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function vu(s,t,e,i){let r=0;for(let n=t,o=e-i;n(s[s.NONE=0]="NONE",s[s.COLOR=16384]="COLOR",s[s.STENCIL=1024]="STENCIL",s[s.DEPTH=256]="DEPTH",s[s.COLOR_DEPTH=16640]="COLOR_DEPTH",s[s.COLOR_STENCIL=17408]="COLOR_STENCIL",s[s.DEPTH_STENCIL=1280]="DEPTH_STENCIL",s[s.ALL=17664]="ALL",s))(Oa||{});class ku{constructor(t){this.items=[],this._name=t}emit(t,e,i,r,n,o,a,h){const{name:l,items:c}=this;for(let u=0,_=c.length;u<_;u++)c[u][l](t,e,i,r,n,o,a,h);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}const Au=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],Ga=class Da extends we{constructor(t){super(),this.tick=0,this.uid=Ot("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const e=[...Au,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){const e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await ru(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...Da.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i{this.runners[e]=new ku(e)})}_addSystems(t){let e;for(e in t){const i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const r in this.runners)this.runners[r].add(i);return this}_addPipes(t,e){const i=e.reduce((r,n)=>(r[n.name]=n.value,r),{});t.forEach(r=>{const n=r.value,o=r.name,a=i[o];this.renderPipes[o]=new n(this,a?new a:null),this.runners.destroy.add(this.renderPipes[o])})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),(t===!0||typeof t=="object"&&t.releaseGlobalResources)&&Wi.release(),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!nu())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};Ga.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let Ua=Ga,rs;function Su(s){return rs!==void 0||(rs=(()=>{const t={stencil:!0,failIfMajorPerformanceCaveat:s??Ua.defaultOptions.failIfMajorPerformanceCaveat};try{if(!It.get().getWebGLRenderingContext())return!1;let i=It.get().createCanvas().getContext("webgl",t);const r=!!i?.getContextAttributes()?.stencil;if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,r}catch{return!1}})()),rs}let ns;async function Cu(s={}){return ns!==void 0||(ns=await(async()=>{const t=It.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(s)).requestDevice(),!0}catch{return!1}})()),ns}const qn=["webgl","webgpu","canvas"];async function Mu(s){let t=[];s.preference?(t.push(s.preference),qn.forEach(n=>{n!==s.preference&&t.push(n)})):t=qn.slice();let e,i={};for(let n=0;n{const{WebGPURenderer:h}=await import("./WebGPURenderer-aw-zH1pb.js");return{WebGPURenderer:h}},__vite__mapDeps([52,2,53,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51]),import.meta.url);e=a,i={...s,...s.webgpu};break}else if(o==="webgl"&&Su(s.failIfMajorPerformanceCaveat??Ua.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:a}=await ps(async()=>{const{WebGLRenderer:h}=await import("./WebGLRenderer-BaJ4wXpG.js");return{WebGLRenderer:h}},__vite__mapDeps([54,2,53,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51]),import.meta.url);e=a,i={...s,...s.webgl};break}else if(o==="canvas")throw i={...s},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!e)throw new Error("No available renderer for the current environment");const r=new e;return await r.init(i),r}const Na="8.15.0";class Wa{static init(){globalThis.__PIXI_APP_INIT__?.(this,Na)}static destroy(){}}Wa.extension=$.Application;class Tu{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Na)}destroy(){this._renderer=null}}Tu.extension={type:[$.WebGLSystem,$.WebGPUSystem],name:"initHook",priority:-10};const Ha=class Lr{constructor(...t){this.stage=new lt,t[0]!==void 0&&ht(wt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.stage||(this.stage=new lt),this.renderer=await Mu(t),Lr._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return ht(wt,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){const i=Lr._plugins.slice(0);i.reverse(),i.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Ha._plugins=[];let Va=Ha;$t.handleByList($.Application,Va._plugins);$t.add(Wa);class Xa extends we{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return ht(wt,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return ht(wt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return ht(wt,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return ht(wt,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return ht(wt,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(const e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}class Pu{constructor(t=0,e=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,e.prev!==null&&(e.prev.next=e.next),e.next!==null&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){const e=new Array(t.length);for(let i=0;i0){const e=this.first;delete this.items[e.key],--this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){const e=this.items[t];if(e!==void 0){if(this.ttl>0&&e.expiry<=Date.now()){this.delete(t);return}return this.moveToEnd(e),e.value}}has(t){return t in this.items}moveToEnd(t){this.last!==t&&(t.prev!==null&&(t.prev.next=t.next),t.next!==null&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),t.prev=this.last,t.next=null,this.last!==null&&(this.last.next=t),this.last=t,this.first===null&&(this.first=t))}keys(){const t=new Array(this.size);let e=this.first,i=0;for(;e!==null;)t[i++]=e.key,e=e.next;return t}setWithEvicted(t,e,i=this.resetTtl){let r=null;if(this.has(t))this.set(t,e,!0,i);else{this.max>0&&this.size===this.max&&(r={...this.first},this.evict(!0));let n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e};++this.size===1?this.first=n:this.last.next=n,this.last=n}return r}set(t,e,i=!1,r=this.resetTtl){let n=this.items[t];return i||n!==void 0?(n.value=e,i===!1&&r&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(n)):(this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},++this.size===1?this.first=n:this.last.next=n,this.last=n),this}values(t=this.keys()){const e=new Array(t.length);for(let i=0;i=0;i--){let r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!zu.includes(r)&&(r=`"${r}"`),e[i]=r}return`${s.fontStyle} ${s.fontVariant} ${s.fontWeight} ${t} ${e.join(",")}`}const ar={willReadFrequently:!0},ke=class X{static get experimentalLetterSpacingSupported(){let t=X._experimentalLetterSpacingSupported;if(t===void 0){const e=It.get().getCanvasRenderingContext2D().prototype;t=X._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,r,n,o,a,h,l){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t=" ",e,i=X._canvas,r=e.wordWrap){const n=`${t}-${e.styleKey}-wordWrap-${r}`;if(X._measurementCache.has(n))return X._measurementCache.get(n);const o=Or(e),a=X.measureFont(o);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);const h=X.__context;h.font=o;const c=(r?X._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length);let _=0;for(let x=0;x0)if(r)o-=e,l-=e;else{const c=(X.graphemeSegmenter(t).length-1)*e;o+=c,l+=c}return Math.max(o,l)}static _wordWrap(t,e,i=X._canvas){const r=i.getContext("2d",ar);let n=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=X._collapseSpaces(c),_=X._collapseNewlines(c);let d=!u;const f=e.wordWrapWidth+l,g=X._tokenize(t);for(let p=0;pf)if(o!==""&&(a+=X._addLine(o),o="",n=0),X.canBreakWords(y,e.breakWords)){const v=X.wordWrapSplit(y);for(let b=0;bf&&(a+=X._addLine(o),d=!1,o="",n=0),o+=C,n+=R}}else{o.length>0&&(a+=X._addLine(o),o="",n=0);const v=p===g.length-1;a+=X._addLine(y,!v),d=!1,o="",n=0}else x+n>f&&(d=!1,a+=X._addLine(o),o="",n=0),(o.length>0||!X.isBreakingSpace(y)||d)&&(o+=y,n+=x)}return a+=X._addLine(o,!1),a}static _addLine(t,e=!0){return t=X._trimRight(t),t=e?`${t} +`:t,t}static _getFromCache(t,e,i,r){let n=i[t];return typeof n!="number"&&(n=X._measureText(t,e,r)+e,i[t]=n),n}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!X.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:X._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:X._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let r=0;r{if(typeof Intl?.Segmenter=="function"){const s=new Intl.Segmenter;return t=>{const e=s.segment(t),i=[];let r=0;for(const n of e)i[r++]=n.segment;return i}}return s=>[...s]})();ke.experimentalLetterSpacing=!1;ke._fonts={};ke._newlines=[10,13];ke._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];ke._measurementCache=Ya(1e3);let ds=ke;const $n=[{offset:0,color:"white"},{offset:1,color:"black"}],tn=class Gr{constructor(...t){this.uid=Ot("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let e=Iu(t);e={...e.type==="radial"?Gr.defaultRadialOptions:Gr.defaultLinearOptions,...$o(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(r=>{this.addColorStop(r.offset,r.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:Ht.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:r}=this.end,n=i-t,o=r-e;const a=n<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(n<0){const p=t;t=i,i=p,n*=-1}if(o<0){const p=e;e=r,r=p,o*=-1}}const h=this.colorStops.length?this.colorStops:$n,l=this._textureSize,{canvas:c,context:u}=Zn(l,1),_=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);Kn(_,h),u.fillStyle=_,u.fillRect(0,0,l,1),this.texture=new _t({source:new Je({resource:c,addressMode:this._wrapMode})});const d=Math.sqrt(n*n+o*o),f=Math.atan2(o,n),g=new pt;g.scale(d/l,1),g.rotate(f),g.translate(t,e),this.textureSpace==="local"&&g.scale(l,l),this.transform=g}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:$n,e=this._textureSize,{canvas:i,context:r}=Zn(e,e),{x:n,y:o}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,u=a-c,_=h-c,d=e/(c*2),f=(n-u)*d,g=(o-_)*d,p=r.createRadialGradient(f,g,l*d,(a-u)*d,(h-_)*d,c*d);Kn(p,t),r.fillStyle=t[t.length-1].color,r.fillRect(0,0,e,e),r.fillStyle=p,r.translate(f,g),r.rotate(this.rotation),r.scale(1,this.scale),r.translate(-f,-g),r.fillRect(0,0,e,e),this.texture=new _t({source:new Je({resource:i,addressMode:this._wrapMode})});const y=new pt;y.scale(1/d,1/d),y.translate(u,_),this.textureSpace==="local"&&y.scale(e,e),this.transform=y}destroy(){this.texture?.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};tn.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};tn.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let Be=tn;function Kn(s,t){for(let e=0;e2&&(o.push([h].concat(l.splice(0,2))),c="l",h=h=="m"?"l":"L");;){if(l.length==s[c])return l.unshift(h),o.push(l);if(l.length0&&(r=i.pop(),r?(n=r.startX,o=r.startY):(n=0,o=0)),r=null;break;default:zt(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&r===null&&(r={startX:n,startY:o},i.push(r))}return t}class en{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new en(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=i}strokeContains(t,e,i,r=.5){if(this.radius===0)return!1;const n=this.x-t,o=this.y-e,a=this.radius,h=(1-r)*i,l=Math.sqrt(n*n+o*o);return l<=a+h&&l>a-(i-h)}getBounds(t){return t||(t=new Mt),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class sn{constructor(t=0,e=0,i=0,r=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=r}clone(){return new sn(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1}strokeContains(t,e,i,r=.5){const{halfWidth:n,halfHeight:o}=this;if(n<=0||o<=0)return!1;const a=i*(1-r),h=i-a,l=n-h,c=o-h,u=n+a,_=o+a,d=t-this.x,f=e-this.y,g=d*d/(l*l)+f*f/(c*c),p=d*d/(u*u)+f*f/(_*_);return g>1&&p<=1}getBounds(t){return t||(t=new Mt),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function Lu(s,t,e,i,r,n){const o=s-e,a=t-i,h=r-e,l=n-i,c=o*h+a*l,u=h*h+l*l;let _=-1;u!==0&&(_=c/u);let d,f;_<0?(d=e,f=i):_>1?(d=r,f=n):(d=e+_*h,f=i+_*l);const g=s-d,p=t-f;return g*g+p*p}let Ou,Gu;class Ei{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let r=0,n=e.length;re!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(i=!i)}return i}strokeContains(t,e,i,r=.5){const n=i*i,o=n*(1-r),a=n-o,{points:h}=this,l=h.length-(this.closePath?0:2);for(let c=0;cr?l:r,n=co?c:o}return t.x=i,t.width=r-i,t.y=n,t.height=o-n,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return ht("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return ht("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const os=(s,t,e,i,r,n,o)=>{const a=s-e,h=t-i,l=Math.sqrt(a*a+h*h);return l>=r-n&&l<=r+o};class rn{constructor(t=0,e=0,i=0,r=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n}getBounds(t){return t||(t=new Mt),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new rn(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let r=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(r*r+n*n<=o||(r=t-(this.x+this.width-i),r*r+n*n<=o)||(n=e-(this.y+this.height-i),r*r+n*n<=o)||(r=t-(this.x+i),r*r+n*n<=o))return!0}return!1}strokeContains(t,e,i,r=.5){const{x:n,y:o,width:a,height:h,radius:l}=this,c=i*(1-r),u=i-c,_=n+l,d=o+l,f=a-l*2,g=h-l*2,p=n+a,y=o+h;return(t>=n-c&&t<=n+u||t>=p-u&&t<=p+c)&&e>=d&&e<=d+g||(e>=o-c&&e<=o+u||e>=y-u&&e<=y+c)&&t>=_&&t<=_+f?!0:t<_&&ep-l&&ep-l&&e>y-l&&os(t,e,p-l,y-l,l,u,c)||t<_&&e>y-l&&os(t,e,_,y-l,l,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const ja={};function Du(s,t,e){let i=2166136261;for(let r=0;r>>=0;return ja[i]||Uu(s,t,i,e)}function Uu(s,t,e,i){const r={};let n=0;for(let a=0;a0){const o=new Uint8Array(s,e*8,n);new Uint8Array(t,e*8,n).set(o)}}const Nu={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var Wu=(s=>(s[s.DISABLED=0]="DISABLED",s[s.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",s[s.MASK_ACTIVE=2]="MASK_ACTIVE",s[s.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",s[s.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",s[s.NONE=5]="NONE",s))(Wu||{});function io(s,t){return t.alphaMode==="no-premultiply-alpha"&&Nu[s]||s}const Hu=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` +`);function Vu(s){let t="";for(let e=0;e0&&(t+=` +else `),e{if(Ri.length>0)for(const s of Ri)s&&s.destroy();Ri.length=0,vs=0}});function so(){return vs>0?Ri[--vs]:new qu}function ro(s){Ri[vs++]=s}let ki=0;const qa=class $a{constructor(t){this.uid=Ot("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t={...$a.defaultOptions,...t},t.maxTextures||(ht("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=Yu());const{maxTextures:e,attributesInitialSize:i,indicesInitialSize:r}=t;this.attributeBuffer=new to(i*4),this.indexBuffer=new Uint16Array(r),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;tthis.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const h=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer;let u=this._batchIndexSize,_=this._batchIndexStart,d="startBatch";const f=this.maxTextures;for(let g=this.elementStart;g=f||b)&&(this._finishBatch(i,_,u-_,r,o,a,t,d),d="renderBatch",_=u,o=v,a=p.topology,i=so(),r=i.textures,r.clear(),++ki),p._textureId=x._textureBindLocation=r.count,r.ids[x.uid]=r.count,r.textures[r.count++]=x,p._batch=i,u+=p.indexSize,p.packAsQuad?(this.packQuadAttributes(p,h,l,p._attributeStart,p._textureId),this.packQuadIndex(c,p._indexStart,p._attributeStart/this.vertexSize)):(this.packAttributes(p,h,l,p._attributeStart,p._textureId),this.packIndex(p,c,p._indexStart,p._attributeStart/this.vertexSize))}r.count>0&&(this._finishBatch(i,_,u-_,r,o,a,t,d),_=u,++ki),this.elementStart=this.elementSize,this._batchIndexStart=_,this._batchIndexSize=u}_finishBatch(t,e,i,r,n,o,a,h){t.gpuBindGroup=null,t.bindGroup=null,t.action=h,t.batcher=this,t.textures=r,t.blendMode=n,t.topology=o,t.start=e,t.size=i,++ki,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,this.attributeBuffer.size*2),i=new to(e);eo(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const e=this.indexBuffer;let i=Math.max(t,e.length*1.5);i+=i%2;const r=i>65535?new Uint32Array(i):new Uint16Array(i);if(r.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n(s[s.MAP_READ=1]="MAP_READ",s[s.MAP_WRITE=2]="MAP_WRITE",s[s.COPY_SRC=4]="COPY_SRC",s[s.COPY_DST=8]="COPY_DST",s[s.INDEX=16]="INDEX",s[s.VERTEX=32]="VERTEX",s[s.UNIFORM=64]="UNIFORM",s[s.STORAGE=128]="STORAGE",s[s.INDIRECT=256]="INDIRECT",s[s.QUERY_RESOLVE=512]="QUERY_RESOLVE",s[s.STATIC=1024]="STATIC",s))(se||{});class Ui extends we{constructor(t){let{data:e,size:i}=t;const{usage:r,label:n,shrinkToFit:o}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=Ot("buffer"),this._resourceType="buffer",this._resourceId=Ot("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i??(i=e?.byteLength);const a=!!e;this.descriptor={size:i,usage:r,mappedAtCreation:a,label:n},this.shrinkToFit=o??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&se.STATIC)}set static(t){t?this.descriptor.usage|=se.STATIC:this.descriptor.usage&=~se.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}const r=this._data;if(this._data=t,this._dataInt32=null,!r||r.length!==t.length){!this.shrinkToFit&&r&&t.byteLengtha&&(a=d),f>h&&(h=f),de.destroy()),this.unload(),this.indexBuffer?.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const Ju=new Float32Array(1),td=new Uint32Array(1);class ed extends Qu{constructor(){const e=new Ui({data:Ju,label:"attribute-batch-buffer",usage:se.VERTEX|se.COPY_DST,shrinkToFit:!1}),i=new Ui({data:td,label:"index-batch-buffer",usage:se.INDEX|se.COPY_DST,shrinkToFit:!1}),r=24;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:r,offset:0},aUV:{buffer:e,format:"float32x2",stride:r,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:r,offset:16},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:r,offset:20}},indexBuffer:i})}}function no(s,t,e){if(s)for(const i in s){const r=i.toLocaleLowerCase(),n=t[r];if(n){let o=s[i];i==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(o)}else zt(`${i} placement hook does not exist in shader`)}}const id=/\{\{(.*?)\}\}/g;function oo(s){const t={};return(s.match(id)?.map(i=>i.replace(/[{()}]/g,""))??[]).forEach(i=>{t[i]=[]}),t}function ao(s,t){let e;const i=/@in\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function ho(s,t,e=!1){const i=[];ao(t,i),s.forEach(a=>{a.header&&ao(a.header,i)});const r=i;e&&r.sort();const n=r.map((a,h)=>` @location(${h}) ${a},`).join(` +`);let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",` +${n} +`),o}function lo(s,t){let e;const i=/@out\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function sd(s){const e=/\b(\w+)\s*:/g.exec(s);return e?e[1]:""}function rd(s){const t=/@.*?\s+/g;return s.replace(t,"")}function nd(s,t){const e=[];lo(t,e),s.forEach(h=>{h.header&&lo(h.header,e)});let i=0;const r=e.sort().map(h=>h.indexOf("builtin")>-1?h:`@location(${i++}) ${h}`).join(`, +`),n=e.sort().map(h=>` var ${rd(h)};`).join(` +`),o=`return VSOutput( + ${e.sort().map(h=>` ${sd(h)}`).join(`, +`)});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",` +${r} +`),a=a.replace("{{start}}",` +${n} +`),a=a.replace("{{return}}",` +${o} +`),a}function co(s,t){let e=s;for(const i in t){const r=t[i];r.join(` +`).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----// +${r.join(` +`)} +//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}const De=Object.create(null),lr=new Map;let od=0;function ad({template:s,bits:t}){const e=Za(s,t);if(De[e])return De[e];const{vertex:i,fragment:r}=ld(s,t);return De[e]=Qa(i,r,t),De[e]}function hd({template:s,bits:t}){const e=Za(s,t);return De[e]||(De[e]=Qa(s.vertex,s.fragment,t)),De[e]}function ld(s,t){const e=t.map(o=>o.vertex).filter(o=>!!o),i=t.map(o=>o.fragment).filter(o=>!!o);let r=ho(e,s.vertex,!0);r=nd(e,r);const n=ho(i,s.fragment,!0);return{vertex:r,fragment:n}}function Za(s,t){return t.map(e=>(lr.has(e)||lr.set(e,od++),lr.get(e))).sort((e,i)=>e-i).join("-")+s.vertex+s.fragment}function Qa(s,t,e){const i=oo(s),r=oo(t);return e.forEach(n=>{no(n.vertex,i,n.name),no(n.fragment,r,n.name)}),{vertex:co(s,i),fragment:co(t,r)}}const cd=` + @in aPosition: vec2; + @in aUV: vec2; + + @out @builtin(position) vPosition: vec4; + @out vUV : vec2; + @out vColor : vec4; + + {{header}} + + struct VSOutput { + {{struct}} + }; + + @vertex + fn main( {{in}} ) -> VSOutput { + + var worldTransformMatrix = globalUniforms.uWorldTransformMatrix; + var modelMatrix = mat3x3( + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0 + ); + var position = aPosition; + var uv = aUV; + + {{start}} + + vColor = vec4(1., 1., 1., 1.); + + {{main}} + + vUV = uv; + + var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix; + + vPosition = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + + vColor *= globalUniforms.uWorldColorAlpha; + + {{end}} + + {{return}} + }; +`,ud=` + @in vUV : vec2; + @in vColor : vec4; + + {{header}} + + @fragment + fn main( + {{in}} + ) -> @location(0) vec4 { + + {{start}} + + var outColor:vec4; + + {{main}} + + var finalColor:vec4 = outColor * vColor; + + {{end}} + + return finalColor; + }; +`,dd=` + in vec2 aPosition; + in vec2 aUV; + + out vec4 vColor; + out vec2 vUV; + + {{header}} + + void main(void){ + + mat3 worldTransformMatrix = uWorldTransformMatrix; + mat3 modelMatrix = mat3( + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0 + ); + vec2 position = aPosition; + vec2 uv = aUV; + + {{start}} + + vColor = vec4(1.); + + {{main}} + + vUV = uv; + + mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix; + + gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + + vColor *= uWorldColorAlpha; + + {{end}} + } +`,_d=` + + in vec4 vColor; + in vec2 vUV; + + out vec4 finalColor; + + {{header}} + + void main(void) { + + {{start}} + + vec4 outColor; + + {{main}} + + finalColor = outColor * vColor; + + {{end}} + } +`,fd={name:"global-uniforms-bit",vertex:{header:` + struct GlobalUniforms { + uProjectionMatrix:mat3x3, + uWorldTransformMatrix:mat3x3, + uWorldColorAlpha: vec4, + uResolution: vec2, + } + + @group(0) @binding(0) var globalUniforms : GlobalUniforms; + `}},pd={name:"global-uniforms-bit",vertex:{header:` + uniform mat3 uProjectionMatrix; + uniform mat3 uWorldTransformMatrix; + uniform vec4 uWorldColorAlpha; + uniform vec2 uResolution; + `}};function gd({bits:s,name:t}){const e=ad({template:{fragment:ud,vertex:cd},bits:[fd,...s]});return We.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function md({bits:s,name:t}){return new _i({name:t,...hd({template:{vertex:dd,fragment:_d},bits:[pd,...s]})})}const yd={name:"color-bit",vertex:{header:` + @in aColor: vec4; + `,main:` + vColor *= vec4(aColor.rgb * aColor.a, aColor.a); + `}},xd={name:"color-bit",vertex:{header:` + in vec4 aColor; + `,main:` + vColor *= vec4(aColor.rgb * aColor.a, aColor.a); + `}},cr={};function bd(s){const t=[];if(s===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let i=0;i;`),t.push(`@group(1) @binding(${e++}) var textureSampler${i+1}: sampler;`)}return t.join(` +`)}function vd(s){const t=[];if(s===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e; + @out @interpolate(flat) vTextureId : u32; + `,main:` + vTextureId = aTextureIdAndRound.y; + `,end:` + if(aTextureIdAndRound.x == 1) + { + vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); + } + `},fragment:{header:` + @in @interpolate(flat) vTextureId: u32; + + ${bd(s)} + `,main:` + var uvDx = dpdx(vUV); + var uvDy = dpdy(vUV); + + ${vd(s)} + `}}),cr[s]}const ur={};function kd(s){const t=[];for(let e=0;e0&&t.push("else"),e, targetSize: vec2) -> vec2 + { + return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; + } + `}},Cd={name:"round-pixels-bit",vertex:{header:` + vec2 roundPixels(vec2 position, vec2 targetSize) + { + return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; + } + `}},uo={};function Md(s){let t=uo[s];if(t)return t;const e=new Int32Array(s);for(let i=0;ie&&this.remove(e,...t))}destroy(...t){this.removeAll(...t),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}function zd(s,t,e,i,r,n,o,a=null){let h=0;e*=t,r*=n;const l=a.a,c=a.b,u=a.c,_=a.d,d=a.tx,f=a.ty;for(;h>16|t&65280|(t&255)<<16,i=this.renderable;return i?na(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||Ed}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}const Ni={extension:{type:$.ShapeBuilder,name:"circle"},build(s,t){let e,i,r,n,o,a;if(s.type==="circle"){const b=s;if(o=a=b.radius,o<=0)return!1;e=b.x,i=b.y,r=n=0}else if(s.type==="ellipse"){const b=s;if(o=b.halfWidth,a=b.halfHeight,o<=0||a<=0)return!1;e=b.x,i=b.y,r=n=0}else{const b=s,C=b.width/2,w=b.height/2;e=b.x+C,i=b.y+w,o=a=Math.max(0,Math.min(b.radius,Math.min(C,w))),r=C-o,n=w-a}if(r<0||n<0)return!1;const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(r?4:0)+(n?4:0);if(l===0)return!1;if(h===0)return t[0]=t[6]=e+r,t[1]=t[3]=i+n,t[2]=t[4]=e-r,t[5]=t[7]=i-n,!0;let c=0,u=h*4+(r?2:0)+2,_=u,d=l,f=r+o,g=n,p=e+f,y=e-f,x=i+g;if(t[c++]=p,t[c++]=x,t[--u]=x,t[--u]=y,n){const b=i-g;t[_++]=y,t[_++]=b,t[--d]=b,t[--d]=p}for(let b=1;b0&&(r[n++]=h,r[n++]=l,r[n++]=h-1),h++;r[n++]=l+1,r[n++]=l,r[n++]=h-1}},Rd={...Ni,extension:{...Ni.extension,name:"ellipse"}},Fd={...Ni,extension:{...Ni.extension,name:"roundedRectangle"}},sh=1e-4,fo=1e-4;function Bd(s){const t=s.length;if(t<6)return 1;let e=0;for(let i=0,r=s[t-2],n=s[t-1];iu&&(u+=Math.PI*2);let _=c;const d=u-c,f=Math.abs(d),g=Math.sqrt(h*h+l*l),p=(15*f*Math.sqrt(g)/Math.PI>>0)+1,y=d/p;if(_+=y,a){o.push(s,t),o.push(e,i);for(let x=1,v=_;x=0&&(a.join==="round"?g+=Ve(w,k,w-P*L,k-F*L,w-G*L,k-N*L,d,!1)+4:g+=2,d.push(w-G*D,k-N*D),d.push(w+G*L,k+N*L));continue}const ot=(-P+b)*(-F+k)-(-P+w)*(-F+C),ut=(-G+R)*(-N+k)-(-G+w)*(-N+S),O=(T*ut-U*ot)/K,J=(rt*ot-st*ut)/K,Tt=(O-w)*(O-w)+(J-k)*(J-k),E=w+(O-w)*L,et=k+(J-k)*L,ct=w-(O-w)*D,at=k-(J-k)*D,ft=Math.min(T*T+st*st,U*U+rt*rt),Et=mt?L:D,Ut=ft+Et*Et*x;Tt<=Ut?a.join==="bevel"||Tt/x>v?(mt?(d.push(E,et),d.push(w+P*D,k+F*D),d.push(E,et),d.push(w+G*D,k+N*D)):(d.push(w-P*L,k-F*L),d.push(ct,at),d.push(w-G*L,k-N*L),d.push(ct,at)),g+=2):a.join==="round"?mt?(d.push(E,et),d.push(w+P*D,k+F*D),g+=Ve(w,k,w+P*D,k+F*D,w+G*D,k+N*D,d,!0)+4,d.push(E,et),d.push(w+G*D,k+N*D)):(d.push(w-P*L,k-F*L),d.push(ct,at),g+=Ve(w,k,w-P*L,k-F*L,w-G*L,k-N*L,d,!1)+4,d.push(w-G*L,k-N*L),d.push(ct,at)):(d.push(E,et),d.push(ct,at)):(d.push(w-P*L,k-F*L),d.push(w+P*D,k+F*D),a.join==="round"?mt?g+=Ve(w,k,w+P*D,k+F*D,w+G*D,k+N*D,d,!0)+2:g+=Ve(w,k,w-P*L,k-F*L,w-G*L,k-N*L,d,!1)+2:a.join==="miter"&&Tt/x<=v&&(mt?(d.push(ct,at),d.push(ct,at)):(d.push(E,et),d.push(E,et)),g+=2),d.push(w-G*L,k-N*L),d.push(w+G*D,k+N*D),g+=2)}b=s[(f-2)*2],C=s[(f-2)*2+1],w=s[(f-1)*2],k=s[(f-1)*2+1],P=-(C-k),F=b-w,B=Math.sqrt(P*P+F*F),P/=B,F/=B,P*=y,F*=y,d.push(w-P*L,k-F*L),d.push(w+P*D,k+F*D),u||(a.cap==="round"?g+=Ve(w-P*(L-D)*.5,k-F*(L-D)*.5,w-P*L,k-F*L,w+P*D,k+F*D,d,!1)+2:a.cap==="square"&&(g+=po(w,k,P,F,L,D,!1,d)));const gt=fo*fo;for(let M=p;M0&&o>0?(t[0]=i,t[1]=r,t[2]=i+n,t[3]=r,t[4]=i+n,t[5]=r+o,t[6]=i,t[7]=r+o,!0):!1},triangulate(s,t,e,i,r,n){let o=0;i*=e,t[i+o]=s[0],t[i+o+1]=s[1],o+=e,t[i+o]=s[2],t[i+o+1]=s[3],o+=e,t[i+o]=s[6],t[i+o+1]=s[7],o+=e,t[i+o]=s[4],t[i+o+1]=s[5],o+=e;const a=i/e;r[n++]=a,r[n++]=a+1,r[n++]=a+2,r[n++]=a+1,r[n++]=a+3,r[n++]=a+2}},Nd={extension:{type:$.ShapeBuilder,name:"triangle"},build(s,t){return t[0]=s.x,t[1]=s.y,t[2]=s.x2,t[3]=s.y2,t[4]=s.x3,t[5]=s.y3,!0},triangulate(s,t,e,i,r,n){let o=0;i*=e,t[i+o]=s[0],t[i+o+1]=s[1],o+=e,t[i+o]=s[2],t[i+o+1]=s[3],o+=e,t[i+o]=s[4],t[i+o+1]=s[5];const a=i/e;r[n++]=a,r[n++]=a+1,r[n++]=a+2}},Wd=new pt,Hd=new Mt;function Vd(s,t,e,i){const r=t.matrix?s.copyFrom(t.matrix).invert():s.identity();if(t.textureSpace==="local"){const o=e.getBounds(Hd);t.width&&o.pad(t.width);const{x:a,y:h}=o,l=1/o.width,c=1/o.height,u=-a*l,_=-h*c,d=r.a,f=r.b,g=r.c,p=r.d;r.a*=l,r.b*=l,r.c*=c,r.d*=c,r.tx=u*d+_*g+r.tx,r.ty=u*f+_*p+r.ty}else r.translate(t.texture.frame.x,t.texture.frame.y),r.scale(1/t.texture.source.width,1/t.texture.source.height);const n=t.texture.source.style;return!(t.fill instanceof Be)&&n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update()),i&&r.append(Wd.copyFrom(i).invert()),r}const Ts={};$t.handleByMap($.ShapeBuilder,Ts);$t.add(Ud,Dd,Nd,Ni,Rd,Fd);const Xd=new Mt,Yd=new pt;function jd(s,t){const{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let r=0;r{const u=[],_=Ts[h.type];if(!_.build(h,u))return;const d=a.length,f=n.length/2;let g="triangle-list";if(l&&eh(u,l),e){const v=h.closePath??!0,b=t;b.pixelLine?(Od(u,v,n,a),g="line-list"):Ld(u,b,!1,v,n,a)}else if(c){const v=[],b=u.slice();$d(c).forEach(w=>{v.push(b.length/2),b.push(...w)}),rh(b,v,n,2,f,a,d)}else _.triangulate(u,n,2,f,a,d);const p=o.length/2,y=t.texture;if(y!==_t.WHITE){const v=Vd(Yd,t,h,l);zd(n,2,f,o,p,2,n.length/2-f,v)}else Id(o,p,2,n.length/2-f);const x=ge.get(ih);x.indexOffset=d,x.indexSize=a.length-d,x.attributeOffset=f,x.attributeSize=n.length/2-f,x.baseColor=t.color,x.alpha=t.alpha,x.texture=y,x.geometryData=r,x.topology=g,i.push(x)})}function $d(s){const t=[];for(let e=0;e{ge.return(t)}),this.graphicsData&&ge.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}}class Zd{constructor(){this.instructions=new la}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new Td({maxTextures:e}),this.instructions.reset()}get geometry(){return ht(Xl,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const nn=class Dr{constructor(t){this._renderer=t,this._managedContexts=new Pd({renderer:t,type:"resource",name:"graphicsContext"})}init(t){Dr.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Dr.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=!!t._gpuData[this._renderer.uid],i=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&i.reset(),jd(t,i);const r=t.batchMode;t.customShader||r==="no-batch"?i.isBatchable=!1:r==="auto"?i.isBatchable=i.geometryData.vertices.length<400:i.isBatchable=!0,t.dirty=!1}return i}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=ge.get(Zd,{maxTextures:this._renderer.limits.maxBatchableTextures}),i=t._gpuData[this._renderer.uid],{batches:r,geometryData:n}=i;i.graphicsData=e;const o=n.vertices.length,a=n.indices.length;for(let u=0;uQd)return;const u=(s+e)/2,_=(t+i)/2,d=(e+r)/2,f=(i+n)/2,g=(r+o)/2,p=(n+a)/2,y=(u+d)/2,x=(_+f)/2,v=(d+g)/2,b=(f+p)/2,C=(y+v)/2,w=(x+b)/2;if(c>0){let k=o-s,R=a-t;const S=Math.abs((e-o)*R-(i-a)*k),P=Math.abs((r-o)*R-(n-a)*k);if(S>as&&P>as){if((S+P)*(S+P)<=l*(k*k+R*R)){h.push(C,w);return}}else if(S>as){if(S*S<=l*(k*k+R*R)){h.push(C,w);return}}else if(P>as){if(P*P<=l*(k*k+R*R)){h.push(C,w);return}}else if(k=C-(s+o)/2,R=w-(t+a)/2,k*k+R*R<=l){h.push(C,w);return}}Ur(s,t,u,_,y,x,C,w,h,l,c+1),Ur(C,w,v,b,g,p,o,a,h,l,c+1)}const e_=8,i_=11920929e-14,s_=1;function r_(s,t,e,i,r,n,o,a){const l=Math.min(.99,Math.max(0,a??nh.defaultOptions.bezierSmoothness));let c=(s_-l)/1;return c*=c,n_(t,e,i,r,n,o,s,c),s}function n_(s,t,e,i,r,n,o,a){Nr(o,s,t,e,i,r,n,a,0),o.push(r,n)}function Nr(s,t,e,i,r,n,o,a,h){if(h>e_)return;const l=(t+i)/2,c=(e+r)/2,u=(i+n)/2,_=(r+o)/2,d=(l+u)/2,f=(c+_)/2;let g=n-t,p=o-e;const y=Math.abs((i-n)*p-(r-o)*g);if(y>i_){if(y*y<=a*(g*g+p*p)){s.push(d,f);return}}else if(g=d-(t+n)/2,p=f-(e+o)/2,g*g+p*p<=a){s.push(d,f);return}Nr(s,t,e,l,c,d,f,a,h+1),Nr(s,d,f,u,_,n,o,a,h+1)}function ah(s,t,e,i,r,n,o,a){let h=Math.abs(r-n);(!o&&r>n||o&&n>r)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,c=r;l*=o?-1:1;for(let u=0;uu*h)}const Fi=Math.PI*2,dr={centerX:0,centerY:0,ang1:0,ang2:0},_r=({x:s,y:t},e,i,r,n,o,a,h)=>{s*=e,t*=i;const l=r*s-n*t,c=n*s+r*t;return h.x=l+o,h.y=c+a,h};function a_(s,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,r=Math.cos(s),n=Math.sin(s),o=Math.cos(s+t),a=Math.sin(s+t);return[{x:r-n*i,y:n+r*i},{x:o+a*i,y:a-o*i},{x:o,y:a}]}const mo=(s,t,e,i)=>{const r=s*i-t*e<0?-1:1;let n=s*e+t*i;return n>1&&(n=1),n<-1&&(n=-1),r*Math.acos(n)},h_=(s,t,e,i,r,n,o,a,h,l,c,u,_)=>{const d=Math.pow(r,2),f=Math.pow(n,2),g=Math.pow(c,2),p=Math.pow(u,2);let y=d*f-d*p-f*g;y<0&&(y=0),y/=d*p+f*g,y=Math.sqrt(y)*(o===a?-1:1);const x=y*r/n*u,v=y*-n/r*c,b=l*x-h*v+(s+e)/2,C=h*x+l*v+(t+i)/2,w=(c-x)/r,k=(u-v)/n,R=(-c-x)/r,S=(-u-v)/n,P=mo(1,0,w,k);let F=mo(w,k,R,S);a===0&&F>0&&(F-=Fi),a===1&&F<0&&(F+=Fi),_.centerX=b,_.centerY=C,_.ang1=P,_.ang2=F};function l_(s,t,e,i,r,n,o,a=0,h=0,l=0){if(n===0||o===0)return;const c=Math.sin(a*Fi/360),u=Math.cos(a*Fi/360),_=u*(t-i)/2+c*(e-r)/2,d=-c*(t-i)/2+u*(e-r)/2;if(_===0&&d===0)return;n=Math.abs(n),o=Math.abs(o);const f=Math.pow(_,2)/Math.pow(n,2)+Math.pow(d,2)/Math.pow(o,2);f>1&&(n*=Math.sqrt(f),o*=Math.sqrt(f)),h_(t,e,i,r,n,o,h,l,c,u,_,d,dr);let{ang1:g,ang2:p}=dr;const{centerX:y,centerY:x}=dr;let v=Math.abs(p)/(Fi/4);Math.abs(1-v)<1e-7&&(v=1);const b=Math.max(Math.ceil(v),1);p/=b;let C=s[s.length-2],w=s[s.length-1];const k={x:0,y:0};for(let R=0;R{const h=a.x-o.x,l=a.y-o.y,c=Math.sqrt(h*h+l*l),u=h/c,_=l/c;return{len:c,nx:u,ny:_}},r=(o,a)=>{o===0?s.moveTo(a.x,a.y):s.lineTo(a.x,a.y)};let n=t[t.length-1];for(let o=0;o0&&(d=-1,f=!0);const g=_/2;let p,y=Math.abs(Math.cos(g)*h/Math.sin(g));y>Math.min(c.len/2,u.len/2)?(y=Math.min(c.len/2,u.len/2),p=Math.abs(y*Math.sin(g)/Math.cos(g))):p=h;const x=a.x+u.nx*y+-u.ny*p*d,v=a.y+u.ny*y+u.nx*p*d,b=Math.atan2(c.ny,c.nx)+Math.PI/2*d,C=Math.atan2(u.ny,u.nx)-Math.PI/2*d;o===0&&s.moveTo(x+Math.cos(b)*p,v+Math.sin(b)*p),s.arc(x,v,p,b,C,f),n=a}}function u_(s,t,e,i){const r=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),n=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),o=t.length;for(let a=0;a1){let n=null;for(let o=r;o=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,o)}ellipse(t,e,i,r,n){return this.drawShape(new sn(t,e,i,r),n),this}roundRect(t,e,i,r,n,o){return this.drawShape(new rn(t,e,i,r,n),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new Ei,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Ei,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,r=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,o=i;i=n.a*i+n.c*r+n.tx,r=n.b*o+n.d*r+n.ty}this._currentPoly.points.push(i,r)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;ea.area).sort((a,h)=>h-a),[e,i]=t,r=t[t.length-1],n=e/i,o=i/r;return!(n>3&&o<2)}function y_(s){return s.split(/(?=[Mm])/).filter(i=>i.trim().length>0)}function x_(s){const t=s.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;const e=t.map(Number),i=[],r=[];for(let c=0;c1;if(F&&G){const B=P.map(L=>({path:L,area:x_(L)}));if(B.sort((L,D)=>D.area-L.area),P.length>3||!m_(B))for(let L=0;LparseInt(S,10)),t.context.poly(v,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":b=s.getAttribute("points"),v=b.match(/-?\d+/g).map(S=>parseInt(S,10)),t.context.poly(v,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{zt(`[SVG parser] <${s.nodeName}> elements unsupported`);break}}a&&(e=null);for(let S=0;S{this._fill=Ke({...this._originalFill},_e.defaultFillStyle)})),this._fill=Ke(t===0?"black":t,_e.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({..._e.defaultStrokeStyle,...t},()=>{this._stroke=ws({...this._originalStroke},_e.defaultStrokeStyle)})),this._stroke=ws(t,_e.defaultStrokeStyle),this.update())}update(){this._tick++,this.emit("update",this)}reset(){const t=ri.defaultTextStyle;for(const e in t)this[e]=t[e]}get styleKey(){return`${this.uid}-${this._tick}`}clone(){return new ri({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0})}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e(i[r]===n||(i[r]=n,e?.(r,n),this.update()),!0)})}_isFillStyle(t){return(t??null)!==null&&!(Ht.isColorLike(t)||t instanceof Be||t instanceof Ms)}};an.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};an.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let ks=an;function M_(s){const t=s;if(typeof t.dropShadow=="boolean"&&t.dropShadow){const e=ks.defaultDropShadow;s.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){ht(wt,"strokeThickness is now a part of stroke");const e=t.stroke;let i={};if(Ht.isColorLike(e))i.color=e;else if(e instanceof Be||e instanceof Ms)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");s.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){if(ht(wt,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(t.fill)||t.fill.length===0)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");t.fill.length!==t.fillGradientStops.length&&zt("The number of fill colors must match the number of fill gradient stops.");const e=new Be({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),i=t.fillGradientStops.slice(),r=t.fill.map(n=>Ht.shared.setValue(n).toNumber());i.forEach((n,o)=>{e.addColorStop(n,r[o])}),s.fill={fill:e}}}class T_{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const i=It.get().createCanvas();i.width=t,i.height=e;const r=i.getContext("2d");return{canvas:i,context:r}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=ys(t),e=ys(e);const r=(t<<17)+(e<<1);this._canvasPool[r]||(this._canvasPool[r]=[]);let n=this._canvasPool[r].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){const e=t.canvas,{width:i,height:r}=e,n=(i<<17)+(r<<1);t.context.resetTransform(),t.context.clearRect(0,0,i,r),this._canvasPool[n].push(t)}clear(){this._canvasPool={}}}const Wr=new T_;Wi.register(Wr);const Mo=1e5;function To(s,t,e,i=0){if(s.texture===_t.WHITE&&!s.fill)return Ht.shared.setValue(s.color).setAlpha(s.alpha??1).toHexa();if(s.fill){if(s.fill instanceof Ms){const r=s.fill,n=t.createPattern(r.texture.source.resource,"repeat"),o=r.transform.copyTo(pt.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),n.setTransform(o),n}else if(s.fill instanceof Be){const r=s.fill,n=r.type==="linear",o=r.textureSpace==="local";let a=1,h=1;o&&e&&(a=e.width+i,h=e.height+i);let l,c=!1;if(n){const{start:u,end:_}=r;l=t.createLinearGradient(u.x*a,u.y*h,_.x*a,_.y*h),c=Math.abs(_.x-u.x){const g=d+f.offset*u;l.addColorStop(Math.floor(g*Mo)/Mo,Ht.shared.setValue(f.color).toHex())})}}else r.colorStops.forEach(u=>{l.addColorStop(u.offset,Ht.shared.setValue(u.color).toHex())});return l}}else{const r=t.createPattern(s.texture.source.resource,"repeat"),n=s.matrix.copyTo(pt.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),r.setTransform(n),r}return zt("FillStyle not recognised",s),"red"}const ch=class uh extends Xa{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=!1;const e={...uh.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;const i=e.style.clone();e.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=_t.WHITE,i._fill.fill=null),this.applyFillAsTint=e.overrideFill;const r=i.fontSize;i.fontSize=this.baseMeasurementFontSize;const n=Or(i);e.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/r):i.fontSize=this.baseRenderedFontSize=r,this._style=i,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,e.textureStyle&&(this._textureStyle=e.textureStyle instanceof xs?e.textureStyle:new xs(e.textureStyle)),this.fontMetrics=ds.measureFont(n),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){const e=ds.graphemeSegmenter(t).filter(p=>!this._currentChars.includes(p)).filter((p,y,x)=>x.indexOf(p)===y);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:r,context:n}=i.canvasAndContext,o=i.texture.source;const a=this._style;let h=this._currentX,l=this._currentY,c=this._currentMaxCharHeight;const u=this.baseRenderedFontSize/this.baseMeasurementFontSize,_=this._padding*u;let d=!1;const f=r.width/this.resolution,g=r.height/this.resolution;for(let p=0;pf&&(l+=c,c=k,h=0,l+c>g)){o.update();const S=this._nextPage();r=S.canvasAndContext.canvas,n=S.canvasAndContext.context,o=S.texture.source,h=0,l=0,c=0}const R=v/u-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[y]={id:y.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:R,kerning:{}},d){this._drawGlyph(n,x,h+_,l+_,u,a);const S=o.width*u,P=o.height*u,F=new Mt(h/S*o.width,l/P*o.height,w/S*o.width,k/P*o.height);this.chars[y].texture=new _t({source:o,frame:F}),h+=Math.ceil(w)}}o.update(),this._currentX=h,this._currentY=l,this._currentMaxCharHeight=c,this._skipKerning&&this._applyKerning(e,n)}get pageTextures(){return ht(wt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){const i=this._measureCache;for(let r=0;r{const x=n.width;for(let v=0;v{let y=n.chars.length-1;if(i){let x=n.chars[y];for(;x===" ";)n.width-=e.chars[x].xAdvance,x=n.chars[--y]}r.width=Math.max(r.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,r.lines.push(n),r.height+=_},p=y=>y-c>u;for(let y=0;y50&&zt("BitmapText",`You have dynamically created ${hs} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),a.once("destroy",()=>{hs--,Pt.remove(i)}),Pt.set(i,a)}const n=Pt.get(i);return n.ensureCharacters?.(t),n}getLayout(t,e,i=!0){const r=this.getFont(t,e),n=`${t}-${e.styleKey}-${i}`;if(this.measureCache.has(n))return this.measureCache.get(n);const o=ds.graphemeSegmenter(t),a=P_(o,e,r,i);return this.measureCache.set(n,a),a}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},ht(wt,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));const i=e?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};const r=e.style,n=r instanceof ks?r:new ks(r),o=e.dynamicFill??this._canUseTintForStyle(n),a=new Po({style:n,overrideFill:o,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1,textureStyle:e.textureStyle}),h=R_(e.chars);return a.ensureCharacters(h.join("")),Pt.set(`${i}-bitmap`,a),a.once("destroy",()=>Pt.remove(`${i}-bitmap`)),a}uninstall(t){const e=`${t}-bitmap`,i=Pt.get(e);i&&i.destroy()}_canUseTintForStyle(t){return!t._stroke&&(!t.dropShadow||t.dropShadow.color===0)&&!t._fill.fill&&t._fill.color===16777215}}const zo=new F_;class dh extends Xa{constructor(t,e){super();const{textures:i,data:r}=t;Object.keys(r.pages).forEach(n=>{const o=r.pages[parseInt(n,10)],a=i[o.id];this.pages.push({texture:a})}),Object.keys(r.chars).forEach(n=>{const o=r.chars[n],{frame:a,source:h,rotate:l}=i[o.page],c=Ct.transformRectCoords(o,a,l,new Mt),u=new _t({frame:c,orig:new Mt(0,0,o.width,o.height),source:h,rotate:l});this.chars[n]={id:n.codePointAt(0),xOffset:o.xOffset,yOffset:o.yOffset,xAdvance:o.xAdvance,kerning:o.kerning??{},texture:u}}),this.baseRenderedFontSize=r.fontSize,this.baseMeasurementFontSize=r.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:r.fontSize},this.baseLineOffset=r.baseLineOffset,this.lineHeight=r.lineHeight,this.fontFamily=r.fontFamily,this.distanceField=r.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t)/)?Io.test(It.get().parseXML(s)):!1},parse(s){return Io.parse(It.get().parseXML(s))}},B_=[".xml",".fnt"],L_={extension:{type:$.CacheParser,name:"cacheBitmapFont"},test:s=>s instanceof dh,getCacheableAssets(s,t){const e={};return s.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},O_={extension:{type:$.LoadParser,priority:He.Normal},name:"loadBitmapFont",id:"bitmap-font",test(s){return B_.includes(le.extname(s).toLowerCase())},async testParse(s){return fr.test(s)||Eo.test(s)},async parse(s,t,e){const i=fr.test(s)?fr.parse(s):Eo.parse(s),{src:r}=t,{pages:n}=i,o=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;uh[u.src]);return new dh({data:i,textures:l},r)},async load(s,t){return await(await It.get().fetch(s)).text()},async unload(s,t,e){await Promise.all(s.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),s.destroy()}};class G_{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;iArray.isArray(s)&&s.every(t=>t instanceof _t),getCacheableAssets:(s,t)=>{const e={};return s.forEach(i=>{t.forEach((r,n)=>{e[i+(n===0?"":n+1)]=r})}),e}};async function _h(s){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=s});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(s)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const U_={extension:{type:$.DetectionParser,priority:1},test:async()=>_h("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async s=>[...s,"avif"],remove:async s=>s.filter(t=>t!=="avif")},Ro=["png","jpg","jpeg"],N_={extension:{type:$.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async s=>[...s,...Ro],remove:async s=>s.filter(t=>!Ro.includes(t))},W_="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Ps(s){return W_?!1:document.createElement("video").canPlayType(s)!==""}const H_={extension:{type:$.DetectionParser,priority:0},test:async()=>Ps("video/mp4"),add:async s=>[...s,"mp4","m4v"],remove:async s=>s.filter(t=>t!=="mp4"&&t!=="m4v")},V_={extension:{type:$.DetectionParser,priority:0},test:async()=>Ps("video/ogg"),add:async s=>[...s,"ogv"],remove:async s=>s.filter(t=>t!=="ogv")},X_={extension:{type:$.DetectionParser,priority:0},test:async()=>Ps("video/webm"),add:async s=>[...s,"webm"],remove:async s=>s.filter(t=>t!=="webm")},Y_={extension:{type:$.DetectionParser,priority:0},test:async()=>_h("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async s=>[...s,"webp"],remove:async s=>s.filter(t=>t!=="webp")},fh=class _s{constructor(){this.loadOptions={..._s.defaultOptions},this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{let r=null,n=null;if((e.parser||e.loadParser)&&(n=this._parserHash[e.parser||e.loadParser],e.loadParser&&zt(`[Assets] "loadParser" is deprecated, use "parser" instead for ${t}`),n||zt(`[Assets] specified load parser "${e.parser||e.loadParser}" not found while loading ${t}`)),!n){for(let o=0;o({alias:[g],src:g,data:{}})),d=_.reduce((g,p)=>g+(p.progressSize||1),0),f=_.map(async g=>{const p=le.toAbsolute(g.src);c[g.src]||(await this._loadAssetWithRetry(p,g,{onProgress:r,onError:n,strategy:o,retryCount:a,retryDelay:h},c),l+=g.progressSize||1,r&&r(l/d))});return await Promise.all(f),u?c[_[0].src]:c}async unload(t){const i=xe(t,r=>({alias:[r],src:r})).map(async r=>{const n=le.toAbsolute(r.src),o=this.promiseCache[n];if(o){const a=await o.promise;delete this.promiseCache[n],await o.parser?.unload?.(a,r,this)}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name||t.id).reduce((t,e)=>(!e.name&&!e.id?zt("[Assets] parser should have an id"):(t[e.name]||t[e.id])&&zt(`[Assets] parser id conflict "${e.id}"`),t[e.name]=e,e.id&&(t[e.id]=e),t),{})}async _loadAssetWithRetry(t,e,i,r){let n=0;const{onError:o,strategy:a,retryCount:h,retryDelay:l}=i,c=u=>new Promise(_=>setTimeout(_,u));for(;;)try{this.promiseCache[t]||(this.promiseCache[t]=this._getLoadPromiseAndParser(t,e)),r[e.src]=await this.promiseCache[t].promise;return}catch(u){delete this.promiseCache[t],delete r[e.src],n++;const _=a!=="retry"||n>h;if(a==="retry"&&!_){o&&o(u,e),await c(l);continue}if(a==="skip"){o&&o(u,e);return}o&&o(u,e);const d=new Error(`[Loader.load] Failed to load ${t}. +${u}`);throw u instanceof Error&&u.stack&&(d.stack=u.stack),d}}};fh.defaultOptions={onProgress:void 0,onError:void 0,strategy:"throw",retryCount:3,retryDelay:250};let j_=fh;function gi(s,t){if(Array.isArray(t)){for(const e of t)if(s.startsWith(`data:${e}`))return!0;return!1}return s.startsWith(`data:${t}`)}function mi(s,t){const e=s.split("?")[0],i=le.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const q_=".json",$_="application/json",K_={extension:{type:$.LoadParser,priority:He.Low},name:"loadJson",id:"json",test(s){return gi(s,$_)||mi(s,q_)},async load(s){return await(await It.get().fetch(s)).json()}},Z_=".txt",Q_="text/plain",J_={name:"loadTxt",id:"text",extension:{type:$.LoadParser,priority:He.Low,name:"loadTxt"},test(s){return gi(s,Q_)||mi(s,Z_)},async load(s){return await(await It.get().fetch(s)).text()}},tf=["normal","bold","100","200","300","400","500","600","700","800","900"],ef=[".ttf",".otf",".woff",".woff2"],sf=["font/ttf","font/otf","font/woff","font/woff2"],rf=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function nf(s){const t=le.extname(s),r=le.basename(s,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1));let n=r.length>0;for(const a of r)if(!a.match(rf)){n=!1;break}let o=r.join(" ");return n||(o=`"${o.replace(/[\\"]/g,"\\$&")}"`),o}const of=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function af(s){return of.test(s)?s:encodeURI(s)}const hf={extension:{type:$.LoadParser,priority:He.Low},name:"loadWebFont",id:"web-font",test(s){return gi(s,sf)||mi(s,ef)},async load(s,t){const e=It.get().getFontFaceSet();if(e){const i=[],r=t.data?.family??nf(s),n=t.data?.weights?.filter(a=>tf.includes(a))??["normal"],o=t.data??{};for(let a=0;an.faces.some(o=>t.indexOf(o)!==-1));r.faces=r.faces.filter(n=>t.indexOf(n)===-1),r.faces.length===0&&(i.entries=i.entries.filter(n=>n!==r)),t.forEach(n=>{It.get().getFontFaceSet().delete(n)}),i.entries.length===0&&Pt.remove(`${e}-and-url`)}};function hn(s,t=1){const e=pi.RETINA_PREFIX?.exec(s);return e?parseFloat(e[1]):t}function ln(s,t,e){s.label=e,s._sourceOrigin=e;const i=new _t({source:s,label:e}),r=()=>{delete t.promiseCache[e],Pt.has(e)&&Pt.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(zt("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),r())}),i.once("destroy",()=>{s.destroyed||(zt("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())}),i}const lf=".svg",cf="image/svg+xml",uf={extension:{type:$.LoadParser,priority:He.Low,name:"loadSVG"},name:"loadSVG",id:"svg",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(s){return gi(s,cf)||mi(s,lf)},async load(s,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?_f(s):df(s,t,e,this.config.crossOrigin)},unload(s){s.destroy(!0)}};async function df(s,t,e,i){const r=await It.get().fetch(s),n=It.get().createImage();n.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(await r.text())}`,n.crossOrigin=i,await n.decode();const o=t.data?.width??n.width,a=t.data?.height??n.height,h=t.data?.resolution||hn(s),l=Math.ceil(o*h),c=Math.ceil(a*h),u=It.get().createCanvas(l,c),_=u.getContext("2d");_.imageSmoothingEnabled=!0,_.imageSmoothingQuality="high",_.drawImage(n,0,0,o*h,a*h);const{parseAsGraphicsContext:d,...f}=t.data??{},g=new Je({resource:u,alphaMode:"premultiply-alpha-on-upload",resolution:h,...f});return ln(g,e,s)}async function _f(s){const e=await(await It.get().fetch(s)).text(),i=new _e;return i.svg(e),i}const ff=`(function () { + 'use strict'; + + const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII="; + async function checkImageBitmap() { + try { + if (typeof createImageBitmap !== "function") + return false; + const response = await fetch(WHITE_PNG); + const imageBlob = await response.blob(); + const imageBitmap = await createImageBitmap(imageBlob); + return imageBitmap.width === 1 && imageBitmap.height === 1; + } catch (_e) { + return false; + } + } + void checkImageBitmap().then((result) => { + self.postMessage(result); + }); + +})(); +`;let hi=null,Hr=class{constructor(){hi||(hi=URL.createObjectURL(new Blob([ff],{type:"application/javascript"}))),this.worker=new Worker(hi)}};Hr.revokeObjectURL=function(){hi&&(URL.revokeObjectURL(hi),hi=null)};const pf=`(function () { + 'use strict'; + + async function loadImageBitmap(url, alphaMode) { + const response = await fetch(url); + if (!response.ok) { + throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`); + } + const imageBlob = await response.blob(); + return alphaMode === "premultiplied-alpha" ? createImageBitmap(imageBlob, { premultiplyAlpha: "none" }) : createImageBitmap(imageBlob); + } + self.onmessage = async (event) => { + try { + const imageBitmap = await loadImageBitmap(event.data.data[0], event.data.data[1]); + self.postMessage({ + data: imageBitmap, + uuid: event.data.uuid, + id: event.data.id + }, [imageBitmap]); + } catch (e) { + self.postMessage({ + error: e, + uuid: event.data.uuid, + id: event.data.id + }); + } + }; + +})(); +`;let li=null;class ph{constructor(){li||(li=URL.createObjectURL(new Blob([pf],{type:"application/javascript"}))),this.worker=new Worker(li)}}ph.revokeObjectURL=function(){li&&(URL.revokeObjectURL(li),li=null)};let Fo=0,pr;class gf{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new Hr;e.addEventListener("message",i=>{e.terminate(),Hr.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){pr===void 0&&(pr=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){this._resolveHash[t.uuid]&&(t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),delete this._resolveHash[t.uuid])}async _run(t,e){await this._initWorkers();const i=new Promise((r,n)=>{this._queue.push({id:t,arguments:e,resolve:r,reject:n})});return this._next(),i}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),i=e.id;this._resolveHash[Fo]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Fo++,id:i})}reset(){this._workerPool.forEach(t=>t.terminate()),this._workerPool.length=0,Object.values(this._resolveHash).forEach(({reject:t})=>{t?.(new Error("WorkerManager has been reset before completion"))}),this._resolveHash={},this._queue.length=0,this._initialized=!1,this._createdWorkers=0}}const Bo=new gf,mf=[".jpeg",".jpg",".png",".webp",".avif"],yf=["image/jpeg","image/png","image/webp","image/avif"];async function xf(s,t){const e=await It.get().fetch(s);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${s}: ${e.status} ${e.statusText}`);const i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}const gh={name:"loadTextures",id:"texture",extension:{type:$.LoadParser,priority:He.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(s){return gi(s,yf)||mi(s,mf)},async load(s,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Bo.isImageBitmapSupported()?i=await Bo.loadImageBitmap(s,t):i=await xf(s,t):i=await new Promise((n,o)=>{i=It.get().createImage(),i.crossOrigin=this.config.crossOrigin,i.src=s,i.complete?n(i):(i.onload=()=>{n(i)},i.onerror=o)});const r=new Je({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||hn(s),...t.data});return ln(r,e,s)},unload(s){s.destroy(!0)}},bf=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"];let gr,mr;function vf(s,t,e){e===void 0&&!t.startsWith("data:")?s.crossOrigin=kf(t):e!==!1&&(s.crossOrigin=typeof e=="string"?e:"anonymous")}function wf(s){return new Promise((t,e)=>{s.addEventListener("canplaythrough",i),s.addEventListener("error",r),s.load();function i(){n(),t()}function r(o){n(),e(o)}function n(){s.removeEventListener("canplaythrough",i),s.removeEventListener("error",r)}})}function kf(s,t=globalThis.location){if(s.startsWith("data:"))return"";t||(t=globalThis.location);const e=new URL(s,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Af(){const s=[],t=[];for(const e of bf){const i=Ii.MIME_TYPES[e.substring(1)]||`video/${e.substring(1)}`;Ps(i)&&(s.push(e),t.includes(i)||t.push(i))}return{validVideoExtensions:s,validVideoMime:t}}const Sf={name:"loadVideo",id:"video",extension:{type:$.LoadParser,name:"loadVideo"},test(s){if(!gr||!mr){const{validVideoExtensions:i,validVideoMime:r}=Af();gr=i,mr=r}const t=gi(s,mr),e=mi(s,gr);return t||e},async load(s,t,e){const i={...Ii.defaultOptions,resolution:t.data?.resolution||hn(s),alphaMode:t.data?.alphaMode||await xa(),...t.data},r=document.createElement("video"),n={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(n).forEach(h=>{const l=n[h];l!==void 0&&r.setAttribute(h,l)}),i.muted===!0&&(r.muted=!0),vf(r,s,i.crossorigin);const o=document.createElement("source");let a;if(i.mime)a=i.mime;else if(s.startsWith("data:"))a=s.slice(5,s.indexOf(";"));else if(!s.startsWith("blob:")){const h=s.split("?")[0].slice(s.lastIndexOf(".")+1).toLowerCase();a=Ii.MIME_TYPES[h]||`video/${h}`}return o.src=s,a&&(o.type=a),new Promise(h=>{const l=async()=>{const c=new Ii({...i,resource:r});r.removeEventListener("canplay",l),t.data.preload&&await wf(r),h(ln(c,e,s))};i.preload&&!i.autoPlay&&r.load(),r.addEventListener("canplay",l),r.appendChild(o)})},unload(s){s.destroy(!0)}},mh={extension:{type:$.ResolveParser,name:"resolveTexture"},test:gh.test,parse:s=>({resolution:parseFloat(pi.RETINA_PREFIX.exec(s)?.[1]??"1"),format:s.split(".").pop(),src:s})},Cf={extension:{type:$.ResolveParser,priority:-2,name:"resolveJson"},test:s=>pi.RETINA_PREFIX.test(s)&&s.endsWith(".json"),parse:mh.parse};class Mf{constructor(){this._detections=[],this._initialized=!1,this.resolver=new pi,this.loader=new j_,this.cache=Pt,this._backgroundLoader=new G_(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){zt("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let n=t.manifest;typeof n=="string"&&(n=await this.load(n)),this.resolver.addManifest(n)}const e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,r=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:i}}),t.preferences&&this.setPreferences(t.preferences),t.loadOptions&&(this.loader.loadOptions={...this.loader.loadOptions,...t.loadOptions})}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const i=bs(t),r=xe(t).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(r),o=await this._mapLoadToResolve(n,e);return i?o[r[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},o=Object.keys(r);let a=0;const h=[],l=()=>{e?.(h.reduce((u,_)=>u+_,0)/a)},c=o.map((u,_)=>{const d=r[u],f=Object.values(d),p=[...new Set(f.flat())].reduce((y,x)=>y+(x.progressSize||1),0);return h.push(0),a+=p,this._mapLoadToResolve(d,y=>{h[_]=y*p,l()}).then(y=>{n[u]=y})});return await Promise.all(c),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Pt.get(t);const e={};for(let i=0;i{const a=r[o.src],h=[o.src];o.alias&&h.push(...o.alias),h.forEach(l=>{n[l]=a}),Pt.set(h,a)}),n}async unload(t){this._initialized||await this.init();const e=xe(t).map(r=>typeof r!="string"?r.src:r),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=xe(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{Pt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,r)=>e.indexOf(i)===r),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const Ze=new Mf;$t.handleByList($.LoadParser,Ze.loader.parsers).handleByList($.ResolveParser,Ze.resolver.parsers).handleByList($.CacheParser,Ze.cache.parsers).handleByList($.DetectionParser,Ze.detections);$t.add(D_,N_,U_,Y_,H_,V_,X_,K_,J_,hf,uf,gh,Sf,O_,L_,mh,Cf);const Lo={loader:$.LoadParser,resolver:$.ResolveParser,cache:$.CacheParser,detection:$.DetectionParser};$t.handle($.Asset,s=>{const t=s.ref;Object.entries(Lo).filter(([e])=>!!t[e]).forEach(([e,i])=>$t.add(Object.assign(t[e],{extension:t[e].extension??i})))},s=>{const t=s.ref;Object.keys(Lo).filter(e=>!!t[e]).forEach(e=>$t.remove(t[e]))});class Dt extends ca{constructor(t){t instanceof _e&&(t={context:t});const{context:e,roundPixels:i,...r}=t||{};super({label:"Graphics",...r}),this.renderPipeId="graphics",e?this.context=e:(this.context=this._ownedContext=new _e,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=i??!1}set context(t){t!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=t,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_onTouch(t){this._gcLastUsed=t,this._context._gcLastUsed=t}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new Dt(this._context.clone()):(this._ownedContext=null,new Dt(this._context))}lineStyle(t,e,i){ht(wt,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const r={};return t&&(r.width=t),e&&(r.color=e),i&&(r.alpha=i),this.context.strokeStyle=r,this}beginFill(t,e){ht(wt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){ht(wt,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return(t.width!==_e.defaultStrokeStyle.width||t.color!==_e.defaultStrokeStyle.color||t.alpha!==_e.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return ht(wt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return ht(wt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return ht(wt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return ht(wt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return ht(wt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return ht(wt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}class Jt extends _t{static create(t){const{dynamic:e,...i}=t;return new Jt({source:new me(i),dynamic:e??!1})}resize(t,e,i){return this.source.resize(t,e,i),this}}var Vr=(s=>(s.CLAMP="clamp-to-edge",s.REPEAT="repeat",s.MIRRORED_REPEAT="mirror-repeat",s))(Vr||{});new Proxy(Vr,{get(s,t){return ht(wt,`DRAW_MODES.${t} is deprecated, use '${Vr[t]}' instead`),s[t]}});var Xr=(s=>(s.NEAREST="nearest",s.LINEAR="linear",s))(Xr||{});const Oo=new Proxy(Xr,{get(s,t){return ht(wt,`DRAW_MODES.${t} is deprecated, use '${Xr[t]}' instead`),s[t]}});$t.add(Bl,Ll);function ls(s,t,e){return se?e:s}function fs(s,t,e){return new Promise(i=>{if(!t){i(null);return}const r=t.getLocalBounds(),n=e?new Mt(e.x,e.y,e.width,e.height):new Mt(0,0,r.width,r.height);s.extract.canvas({target:t,resolution:1,frame:n}).toBlob?.(a=>{a||i(null),i(a)})})}var Tf=nt('
          ',1);function Pf(s,t){ce(t,!1);let e=z(t,"color",12,"rgb(255, 255, 255)"),i=Z([0,0]),r=null,n=!1,o=[0,0],a=Z(0),h=Z(0),l=null,c=!1,u=!1;function _(U){l=U.currentTarget.getBoundingClientRect(),c=!0,d(U.clientX)}function d(U){if(!l)return;const rt=ls(U-l.left,0,l.width);W(h,rt);const xt=rt/l.width*360;W(a,xt),e(f({h:xt,s:o[0],v:o[1],a:1}))}function f(U){const rt=U.s,xt=U.v;let K=rt*xt;const mt=U.h/60;let ot=K*(1-Math.abs(mt%2-1));const ut=xt-K;K=K+ut,ot=ot+ut;const O=Math.floor(mt)%6,J=[K,ot,ut,ut,ot,K][O],Tt=[ot,K,K,ot,ut,ut][O],E=[ut,ut,ot,K,K,ot][O];return`rgba(${J*255}, ${Tt*255}, ${E*255}, ${U.a})`}function g(U,rt){if(!r)return;const xt=ls(U-r.left,0,r.width),K=ls(rt-r.top,0,r.height);W(i,[xt,K]);const mt={h:m(a)*1,s:xt/r.width,v:1-K/r.height,a:1};o=[mt.s,mt.v],e(f(mt))}function p(U){n=!0,r=U.currentTarget.getBoundingClientRect(),g(U.clientX,U.clientY)}function y(U){n&&g(U.clientX,U.clientY),c&&d(U.clientX),u&&P(U.clientX)}function x(){n&&(n=!1),c&&(c=!1),u&&(u=!1)}async function v(U){if(n||c||(await xr(),!U))return;r||(r=m(b).getBoundingClientRect()),l||(l=m(C).getBoundingClientRect());const rt=he(U).toHsv(),xt=rt.s*r.width,K=(1-rt.v)*r.height;W(i,[xt,K]),o=[rt.s,rt.v],W(a,rt.h),W(h,rt.h/360*l.width)}let b=Z(),C=Z(),w=z(t,"opacity",12,1),k=Z();function R(U){W(S,U.currentTarget.getBoundingClientRect()),u=!0,P(U.clientX)}let S=Z(null);function P(U){if(!m(S))return;const rt=ls(U-m(S).left,0,m(S).width);w(rt/m(S).width)}Wo(()=>{W(S,m(k).getBoundingClientRect())}),yt(()=>Y(e()),()=>{v(e())}),Le();var F={get color(){return e()},set color(U){e(U),I()},get opacity(){return w()},set opacity(U){w(U),I()}};ve();var G=Tf();jt("mousemove",xn,y),jt("mouseup",xn,x);var N=qt(G),B=it(N);let V;tt(N),Qe(N,U=>W(b,U),()=>m(b));var L=q(N,2),D=it(L);let gt;tt(L),Qe(L,U=>W(k,U),()=>m(k));var M=q(L,2),T=it(M);let st;return tt(M),Qe(M,U=>W(C,U),()=>m(C)),Wt(()=>{Ie(N,`--hue:${m(a)??""}`),V=Ie(B,"",V,{transform:`translate(${m(i),Rt(()=>m(i)[0])??""}px,${m(i),Rt(()=>m(i)[1])??""}px)`,background:e()}),Ie(L,`--color:${(e()==="auto"?"transparent":e())??""}`),gt=Ie(D,"",gt,{background:"white",transform:`translateX(${Y(w()),m(S),Rt(()=>w()*(m(S)?.width??1))??""}px)`}),st=Ie(T,"",st,{background:"hsl("+m(a)+", 100%, 50%)",transform:`translateX(${m(h)??""}px)`})}),jt("mousedown",N,p),jt("mousedown",L,R),jt("mousedown",M,_),H(s,G),ue(F)}var zf=nt(""),If=nt(""),Ef=nt('
          '),Rf=nt(""),Ff=nt('
          ',1);function Bf(s,t){ce(t,!1);const e=Z(),i=Z();let r=z(t,"selected_color",12),n=z(t,"colors",12),o=z(t,"user_colors",28,()=>[]),a=z(t,"show_empty",12,!1),h=z(t,"current_mode",12,"hex"),l=z(t,"color_picker",12,!1);const c=Oe();function u(S){return Array.isArray(S)?S[0]:S}function _(S){return Array.isArray(S)?S[1]:he(S).getAlpha()}function d(S,P){const F=u(S);return P==="hex"?he(F).toHexString():P==="rgb"?he(F).toRgbString():he(F).toHslString()}`${n().findIndex(S=>d(S,h())===d(r(),h()))}`;function f(S,P){`${S}${P.index}`,c(S,P)}function g(){c("select",{index:null,color:r()}),l(!l())}yt(()=>(Y(a()),Y(n())),()=>{W(e,a()?n():n().filter(S=>S))}),yt(()=>Y(r()),()=>{W(i,_(r()))}),Le();var p={get selected_color(){return r()},set selected_color(S){r(S),I()},get colors(){return n()},set colors(S){n(S),I()},get user_colors(){return o()},set user_colors(S){o(S),I()},get show_empty(){return a()},set show_empty(S){a(S),I()},get current_mode(){return h()},set current_mode(S){h(S),I()},get color_picker(){return l()},set color_picker(S){l(S),I()}};ve();var y=Ff(),x=qt(y);{var v=S=>{var P=zf();let F;Wt(()=>F=re(P,1,"svelte-q8yof7",null,F,{lg:o()})),H(S,P)};Q(x,S=>{l()||S(v)})}var b=q(x,2),C=it(b),w=it(C);{var k=S=>{var P=Ef(),F=it(P);{var G=L=>{{let D=Gt(()=>(Y(r()),Rt(()=>u(r()))));ae(L,{get Icon(){return Xo},onclick:()=>c("add_color"),roundedness:"very",get background(){return m(D)},color:"white"})}};Q(F,L=>{l()&&L(G)})}var N=q(F,2);Bi(N,1,o,Li,(L,D,gt)=>{const M=Gt(()=>(m(D),Rt(()=>u(m(D))))),T=Gt(()=>(m(D),Rt(()=>_(m(D)))));var st=If();let U,rt;Wt(()=>{U=re(st,1,"color svelte-q8yof7",null,U,{empty:m(D)===null,selected:`${m(M)}-${m(T)}`==`${r()}-${m(i)}`}),rt=Ie(st,`background-color: ${m(M)??""}`,rt,{opacity:m(T)})}),jt("click",st,()=>f("edit",{index:gt,color:m(M),opacity:m(T)})),H(L,st)});var B=q(N,2);let V;tt(P),Wt(()=>V=re(B,1,"color colorpicker svelte-q8yof7",null,V,{hidden:!l()})),jt("click",B,g),H(S,P)};Q(w,S=>{o()&&S(k)})}var R=q(w,2);return Bi(R,5,()=>m(e),Li,(S,P,F)=>{const G=Gt(()=>(m(P),Rt(()=>u(m(P))))),N=Gt(()=>(m(P),Rt(()=>_(m(P)))));var B=Rf();let V,L;Wt(()=>{V=re(B,1,"color svelte-q8yof7",null,V,{empty:m(P)===null,selected:`${m(G)}-${m(N)}`==`${r()}-${m(i)}`}),L=Ie(B,`background-color: ${m(G)??""}`,L,{opacity:m(N)})}),jt("click",B,()=>f("select",{index:F,color:m(G),opacity:m(N)})),H(S,B)}),tt(R),tt(C),tt(b),H(s,y),ue(p)}var Lf=nt(""),Of=nt('
          ');function Gf(s,t){ce(t,!1);const e=Z();let i=z(t,"color",12),r=z(t,"current_mode",12,"hex");const n=Oe(),o=[["Hex","hex"],["RGB","rgb"],["HSL","hsl"]];function a(w,k){return k==="hex"?he(w).toHexString():k==="rgb"?he(w).toRgbString():he(w).toHslString()}function h(){new EyeDropper().open().then(k=>{i(k.sRGBHex)})}const l=!!window.EyeDropper;function c(){n("selected",m(e)),n("close")}yt(()=>(Y(i()),Y(r())),()=>{W(e,a(i(),r()))}),yt(()=>m(e),()=>{m(e)&&n("selected",m(e))}),Le();var u={get color(){return i()},set color(w){i(w),I()},get current_mode(){return r()},set current_mode(w){r(w),I()}};ve();var _=Of(),d=it(_);let f;var g=q(d,2),p=it(g),y=it(p);No(y);var x=q(y,2),v=it(x);{var b=w=>{qh(w)};Q(v,w=>{l&&w(b)})}tt(x),tt(p);var C=q(p,2);return Bi(C,5,()=>o,Li,(w,k)=>{var R=de(()=>Ho(m(k),2));let S=()=>m(R)[0],P=()=>m(R)[1];var F=Lf();let G;var N=it(F,!0);tt(F),Wt(()=>{G=re(F,1,"button svelte-yn52fn",null,G,{active:r()===P()}),Fe(N,S())}),jt("click",F,()=>r(P())),H(w,F)}),tt(C),tt(g),tt(_),Wt(()=>{f=Ie(d,"",f,{background:i()}),Fh(y,m(e))}),jt("click",d,c),jt("change",y,w=>i(w.currentTarget.value)),jt("click",x,h),H(s,_),ue(u)}var Df=nt('
          ');function Uf(s,t){ce(t,!1);let e=z(t,"selected_size",12),i=z(t,"min",12),r=z(t,"max",12);const n=Oe();var o={get selected_size(){return e()},set selected_size(u){e(u),I()},get min(){return i()},set min(u){i(u),I()},get max(){return r()},set max(u){r(u),I()}};ve();var a=Df(),h=it(a),l=it(h);hl(l),tt(h);var c=q(h,2);return No(c),Ue(c,"step",1),tt(a),As(a,(u,_)=>Kr?.(u,_),()=>()=>n("click_outside")),Wt(()=>{Ue(c,"min",i()),Ue(c,"max",r())}),$h(c,e),H(s,a),ue(o)}var Nf=nt(" ",1),Wf=nt("
          ");function Go(s,t){ce(t,!1);let e=z(t,"colors",12),i=z(t,"selected_color",12),r=z(t,"color_mode",12,void 0),n=z(t,"recent_colors",28,()=>[]),o=z(t,"selected_size",12),a=z(t,"selected_opacity",12),h=z(t,"show_swatch",12),l=z(t,"show_size",12),c=z(t,"mode",12,"brush"),u=Z(!1),_=Z("hex"),d=null;const f=Oe();function g({index:M,color:T,opacity:st},U){U==="user"&&!T&&(d=M,W(u,!0)),T&&(i(T),st!==void 0&&a(st),U==="core"&&W(u,!1))}function p(M){d!==null&&n(n()[d]=M,!0)}let y=Z(0),x=Z(0);function v(M,T){let st;return function(...U){clearTimeout(st),st=setTimeout(()=>M(...U),T)}}let b=z(t,"preview",12,!1);function C(){b()||b(!0),k()}function w(){b(!1)}const k=v(w,1e3);function R(M){i(M)}function S(){n().length>=5&&n().pop(),!n().some(M=>Array.isArray(M)?M[0]===i()&&M[1]===a():M===i())&&(n().push([i(),a()]),n(n()))}yt(()=>Y(i()),()=>{p(i())}),yt(()=>(Y(o()),Y(i())),()=>{o(),i(),C()}),Le();var P={get colors(){return e()},set colors(M){e(M),I()},get selected_color(){return i()},set selected_color(M){i(M),I()},get color_mode(){return r()},set color_mode(M){r(M),I()},get recent_colors(){return n()},set recent_colors(M){n(M),I()},get selected_size(){return o()},set selected_size(M){o(M),I()},get selected_opacity(){return a()},set selected_opacity(M){a(M),I()},get show_swatch(){return h()},set show_swatch(M){h(M),I()},get show_size(){return l()},set show_size(M){l(M),I()},get mode(){return c()},set mode(M){c(M),I()},get preview(){return b()},set preview(M){b(M),I()}};ve();var F=Wf();let G;var N=it(F);{var B=M=>{var T=ci(),st=qt(T);{var U=rt=>{var xt=Nf(),K=qt(xt);Pf(K,{get color(){return i()},set color(ot){i(ot)},get opacity(){return a()},set opacity(ot){a(ot)},$$legacy:!0});var mt=q(K,2);Gf(mt,{get color(){return i()},get current_mode(){return m(_)},set current_mode(ot){W(_,ot)},$$events:{close:()=>W(u,!1),selected:({detail:ot})=>R(ot)},$$legacy:!0}),H(rt,xt)};Q(st,rt=>{m(u)&&rt(U)})}H(M,T)};Q(N,M=>{r()==="defaults"&&M(B)})}var V=q(N,2);{var L=M=>{{let T=Gt(()=>r()==="defaults"?n():null);Bf(M,{get colors(){return e()},get user_colors(){return m(T)},get selected_color(){return i()},get current_mode(){return m(_)},get color_picker(){return m(u)},set color_picker(st){W(u,st)},$$events:{select:({detail:st})=>g(st,"core"),edit:({detail:st})=>g(st,"user"),add_color:S},$$legacy:!0})}};Q(V,M=>{h()&&M(L)})}var D=q(V,2);{var gt=M=>{Uf(M,{max:100,min:1,get selected_size(){return o()},set selected_size(T){o(T)},$$legacy:!0})};Q(D,M=>{l()&&M(gt)})}return tt(F),As(F,(M,T)=>Kr?.(M,T),()=>()=>f("click_outside")),Wt(()=>G=re(F,1,"wrap svelte-1l3f0ck",null,G,{padded:!m(u),color_picker:m(u),size_picker:l()&&c()==="brush",eraser_picker:c()==="eraser"})),kn("innerHeight",M=>W(x,M)),kn("innerWidth",M=>W(y,M)),H(s,F),ue(P)}var Hf=nt(" ",1),Vf=nt(" ",1),Xf=nt(" ",1),Yf=nt('
          ');function jf(s,t){ce(t,!1);const e=Z(),i=Z(),r=Z(),n=Z(),o=Z();let a=z(t,"tool",12,"image"),h=z(t,"subtool",12,null),l=z(t,"background",12,!1),c=z(t,"brush_options",12),u=z(t,"selected_size",28,()=>c()&&typeof c().default_size=="number"?c().default_size:25),_=z(t,"eraser_options",12),d=z(t,"selected_eraser_size",28,()=>_()&&typeof _().default_size=="number"?_().default_size:25),f=z(t,"selected_color",28,()=>c()&&(()=>{const O=c().default_color;return Array.isArray(O)?O[0]:O})()),g=z(t,"selected_opacity",28,()=>c()&&(()=>{const O=c().default_color;if(Array.isArray(O))return O[1];const J=he(O);return J.getAlpha()<1?J.getAlpha():1})()),p=z(t,"preview",12,!1),y=z(t,"show_brush_color",12,!1),x=z(t,"show_brush_size",12,!1),v=z(t,"show_eraser_size",12,!1),b=z(t,"sources",12),C=z(t,"transforms",12),w=[];const k=Oe();function R(O,J){O.stopPropagation(),k("tool_change",{tool:J})}function S(O,J){O.stopPropagation(),k("subtool_change",{tool:a(),subtool:J})}yt(()=>(Y(a()),Y(h())),()=>{x(a()==="draw"&&h()==="size")}),yt(()=>(Y(a()),Y(h())),()=>{y(a()==="draw"&&h()==="color")}),yt(()=>(Y(a()),Y(h())),()=>{v(a()==="erase"&&h()==="size")}),yt(()=>Y(C()),()=>{W(e,C().includes("crop"))}),yt(()=>Y(C()),()=>{W(i,C().includes("resize"))}),yt(()=>Y(b()),()=>{W(r,b().includes("upload"))}),yt(()=>Y(b()),()=>{W(n,b().includes("webcam"))}),yt(()=>Y(b()),()=>{W(o,b().includes("clipboard"))}),Le();var P={get tool(){return a()},set tool(O){a(O),I()},get subtool(){return h()},set subtool(O){h(O),I()},get background(){return l()},set background(O){l(O),I()},get brush_options(){return c()},set brush_options(O){c(O),I()},get selected_size(){return u()},set selected_size(O){u(O),I()},get eraser_options(){return _()},set eraser_options(O){_(O),I()},get selected_eraser_size(){return d()},set selected_eraser_size(O){d(O),I()},get selected_color(){return f()},set selected_color(O){f(O),I()},get selected_opacity(){return g()},set selected_opacity(O){g(O),I()},get preview(){return p()},set preview(O){p(O),I()},get show_brush_color(){return y()},set show_brush_color(O){y(O),I()},get show_brush_size(){return x()},set show_brush_size(O){x(O),I()},get show_eraser_size(){return v()},set show_eraser_size(O){v(O),I()},get sources(){return b()},set sources(O){b(O),I()},get transforms(){return C()},set transforms(O){C(O),I()}};ve();var F=Yf(),G=it(F),N=it(G);{var B=O=>{{let J=Gt(()=>a()==="image");ae(O,{get Icon(){return Vo},label:"Image",get highlight(){return m(J)},onclick:Tt=>R(Tt,"image"),size:"medium",padded:!1,transparent:!0})}};Q(N,O=>{Y(b()),Rt(()=>b().length>0)&&O(B)})}var V=q(N,2);{var L=O=>{{let J=Gt(()=>a()==="draw");ae(O,{get Icon(){return ol},label:"Brush",onclick:Tt=>R(Tt,"draw"),get highlight(){return m(J)},size:"medium",padded:!1,transparent:!0})}};Q(V,O=>{c()&&O(L)})}var D=q(V,2);{var gt=O=>{{let J=Gt(()=>a()==="erase");ae(O,{get Icon(){return fl},label:"Erase",onclick:Tt=>R(Tt,"erase"),get highlight(){return m(J)},size:"medium",padded:!1,transparent:!0})}};Q(D,O=>{_()&&O(gt)})}tt(G);var M=q(G,2);let T;var st=it(M);{var U=O=>{var J=ci(),Tt=qt(J);{var E=ct=>{var at=Hf(),ft=qt(at);{var Et=Nt=>{{let Ft=Gt(()=>h()==="crop");ae(Nt,{get Icon(){return dl},label:"Crop",onclick:vt=>S(vt,"crop"),get highlight(){return m(Ft)},size:"medium",padded:!1,transparent:!0,offset:0})}};Q(ft,Nt=>{m(e)&&Nt(Et)})}var Ut=q(ft,2);{var bt=Nt=>{{let Ft=Gt(()=>h()==="size");ae(Nt,{get Icon(){return Cl},label:"Resize",onclick:vt=>S(vt,"size"),get highlight(){return m(Ft)},size:"medium",padded:!1,transparent:!0,offset:0})}};Q(Ut,Nt=>{m(i)&&Nt(bt)})}H(ct,at)},et=ct=>{var at=Vf(),ft=qt(at);{var Et=vt=>{{let ee=Gt(()=>h()==="upload");ae(vt,{get Icon(){return Hh},label:"Upload",onclick:Zt=>S(Zt,"upload"),get highlight(){return m(ee)},size:"medium",padded:!1,transparent:!0,offset:0})}};Q(ft,vt=>{m(r)&&vt(Et)})}var Ut=q(ft,2);{var bt=vt=>{{let ee=Gt(()=>h()==="paste");ae(vt,{get Icon(){return Vh},label:"Paste",onclick:Zt=>S(Zt,"paste"),get highlight(){return m(ee)},size:"large",padded:!1,transparent:!0,offset:0})}};Q(Ut,vt=>{m(o)&&vt(bt)})}var Nt=q(Ut,2);{var Ft=vt=>{{let ee=Gt(()=>h()==="webcam");ae(vt,{get Icon(){return Xh},label:"Webcam",onclick:Zt=>S(Zt,"webcam"),get highlight(){return m(ee)},size:"medium",padded:!1,transparent:!0,offset:0})}};Q(Nt,vt=>{m(n)&&vt(Ft)})}H(ct,at)};Q(Tt,ct=>{l()?ct(E):ct(et,!1)})}H(O,J)};Q(st,O=>{a()==="image"&&O(U)})}var rt=q(st,2);{var xt=O=>{var J=Xf(),Tt=qt(J);ae(Tt,{get Icon(){return cl},label:"Color",get color(){return f()},onclick:at=>S(at,"color"),size:"medium",padded:!1,transparent:!0,offset:0});var E=q(Tt,2);{let at=Gt(()=>h()==="size");ae(E,{get Icon(){return wn},label:"Brush Size",onclick:ft=>S(ft,"size"),get highlight(){return m(at)},size:"medium",padded:!1,transparent:!0,offset:0})}var et=q(E,2);{var ct=at=>{Go(at,{get colors(){return Y(c()),Rt(()=>c().colors)},get color_mode(){return Y(c()),Rt(()=>c().color_mode)},get recent_colors(){return w},get show_swatch(){return y()},get show_size(){return x()},mode:"brush",get selected_size(){return u()},set selected_size(ft){u(ft)},get selected_color(){return f()},set selected_color(ft){f(ft)},get selected_opacity(){return g()},set selected_opacity(ft){g(ft)},get preview(){return p()},set preview(ft){p(ft)},$$events:{click_outside:ft=>{ft.stopPropagation(),p(!1),y(!1),x(!1),S(ft,null)}},$$legacy:!0})};Q(et,at=>{(y()||x())&&at(ct)})}H(O,J)};Q(rt,O=>{a()==="draw"&&c()&&O(xt)})}var K=q(rt,2);{var mt=O=>{{let J=Gt(()=>h()==="size");ae(O,{get Icon(){return wn},label:"Eraser Size",onclick:Tt=>S(Tt,"size"),get highlight(){return m(J)},size:"medium",padded:!1,transparent:!0,offset:0})}};Q(K,O=>{a()==="erase"&&_()&&O(mt)})}var ot=q(K,2);{var ut=O=>{Go(O,{colors:[],show_swatch:!1,show_size:!0,mode:"eraser",get selected_size(){return d()},set selected_size(J){d(J)},get selected_color(){return f()},set selected_color(J){f(J)},get selected_opacity(){return g()},set selected_opacity(J){g(J)},get preview(){return p()},set preview(J){p(J)},$$events:{click_outside:J=>{J.stopPropagation(),p(!1),v(!1),S(J,null)}},$$legacy:!0})};Q(ot,O=>{v()&&O(ut)})}return tt(M),tt(F),Wt(()=>T=re(M,1,"half-container right svelte-1uf24la",null,T,{hide:a()==="pan"||a()==="image"&&!l()&&b().length===0||a()==="image"&&l()&&C().length===0})),H(s,F),ue(P)}var Yr=`in vec2 aPosition; +out vec2 vTextureCoord; + +uniform vec4 uInputSize; +uniform vec4 uOutputFrame; +uniform vec4 uOutputTexture; + +vec4 filterVertexPosition( void ) +{ + vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; + + position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +vec2 filterTextureCoord( void ) +{ + return aPosition * (uOutputFrame.zw * uInputSize.zw); +} + +void main(void) +{ + gl_Position = filterVertexPosition(); + vTextureCoord = filterTextureCoord(); +} +`,jr=`struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2 + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord( aPosition:vec2 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getSize() -> vec2 +{ + return gfu.uGlobalFrame.zw; +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition) + ); +}`,qf=` +in vec2 vTextureCoord; +out vec4 finalColor; + +uniform sampler2D uTexture; +uniform vec2 uOffset; + +void main(void) +{ + vec4 color = vec4(0.0); + + // Sample top left pixel + color += texture(uTexture, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y)); + + // Sample top right pixel + color += texture(uTexture, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y)); + + // Sample bottom right pixel + color += texture(uTexture, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y)); + + // Sample bottom left pixel + color += texture(uTexture, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y)); + + // Average + color *= 0.25; + + finalColor = color; +}`,$f=`struct KawaseBlurUniforms { + uOffset:vec2, +}; + +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler: sampler; +@group(1) @binding(0) var kawaseBlurUniforms : KawaseBlurUniforms; + +@fragment +fn mainFragment( + @builtin(position) position: vec4, + @location(0) uv : vec2 +) -> @location(0) vec4 { + let uOffset = kawaseBlurUniforms.uOffset; + var color: vec4 = vec4(0.0); + + // Sample top left pixel + color += textureSample(uTexture, uSampler, vec2(uv.x - uOffset.x, uv.y + uOffset.y)); + // Sample top right pixel + color += textureSample(uTexture, uSampler, vec2(uv.x + uOffset.x, uv.y + uOffset.y)); + // Sample bottom right pixel + color += textureSample(uTexture, uSampler, vec2(uv.x + uOffset.x, uv.y - uOffset.y)); + // Sample bottom left pixel + color += textureSample(uTexture, uSampler, vec2(uv.x - uOffset.x, uv.y - uOffset.y)); + // Average + color *= 0.25; + + return color; +}`,Kf=` +precision highp float; +in vec2 vTextureCoord; +out vec4 finalColor; + +uniform sampler2D uTexture; +uniform vec2 uOffset; + +uniform vec4 uInputClamp; + +void main(void) +{ + vec4 color = vec4(0.0); + + // Sample top left pixel + color += texture(uTexture, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), uInputClamp.xy, uInputClamp.zw)); + + // Sample top right pixel + color += texture(uTexture, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), uInputClamp.xy, uInputClamp.zw)); + + // Sample bottom right pixel + color += texture(uTexture, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), uInputClamp.xy, uInputClamp.zw)); + + // Sample bottom left pixel + color += texture(uTexture, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), uInputClamp.xy, uInputClamp.zw)); + + // Average + color *= 0.25; + + finalColor = color; +} +`,Zf=`struct KawaseBlurUniforms { + uOffset:vec2, +}; + +struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; + +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler: sampler; +@group(1) @binding(0) var kawaseBlurUniforms : KawaseBlurUniforms; + +@fragment +fn mainFragment( + @builtin(position) position: vec4, + @location(0) uv : vec2 +) -> @location(0) vec4 { + let uOffset = kawaseBlurUniforms.uOffset; + var color: vec4 = vec4(0.0); + + // Sample top left pixel + color += textureSample(uTexture, uSampler, clamp(vec2(uv.x - uOffset.x, uv.y + uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw)); + // Sample top right pixel + color += textureSample(uTexture, uSampler, clamp(vec2(uv.x + uOffset.x, uv.y + uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw)); + // Sample bottom right pixel + color += textureSample(uTexture, uSampler, clamp(vec2(uv.x + uOffset.x, uv.y - uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw)); + // Sample bottom left pixel + color += textureSample(uTexture, uSampler, clamp(vec2(uv.x - uOffset.x, uv.y - uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw)); + // Average + color *= 0.25; + + return color; +}`,Qf=Object.defineProperty,Jf=(s,t,e)=>t in s?Qf(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,$e=(s,t,e)=>(Jf(s,typeof t!="symbol"?t+"":t,e),e);const yh=class xh extends Er{constructor(...t){let e=t[0]??{};(typeof e=="number"||Array.isArray(e))&&(ht("6.0.0","KawaseBlurFilter constructor params are now options object. See params: { strength, quality, clamp, pixelSize }"),e={strength:e},t[1]!==void 0&&(e.quality=t[1]),t[2]!==void 0&&(e.clamp=t[2])),e={...xh.DEFAULT_OPTIONS,...e};const i=We.from({vertex:{source:jr,entryPoint:"mainVertex"},fragment:{source:e?.clamp?Zf:$f,entryPoint:"mainFragment"}}),r=_i.from({vertex:Yr,fragment:e?.clamp?Kf:qf,name:"kawase-blur-filter"});super({gpuProgram:i,glProgram:r,resources:{kawaseBlurUniforms:{uOffset:{value:new Float32Array(2),type:"vec2"}}}}),$e(this,"uniforms"),$e(this,"_pixelSize",{x:0,y:0}),$e(this,"_clamp"),$e(this,"_kernels",[]),$e(this,"_blur"),$e(this,"_quality"),this.uniforms=this.resources.kawaseBlurUniforms.uniforms,this.pixelSize=e.pixelSize??{x:1,y:1},Array.isArray(e.strength)?this.kernels=e.strength:typeof e.strength=="number"&&(this._blur=e.strength,this.quality=e.quality??3),this._clamp=!!e.clamp}apply(t,e,i,r){const n=this.pixelSizeX/e.source.width,o=this.pixelSizeY/e.source.height;let a;if(this._quality===1||this._blur===0)a=this._kernels[0]+.5,this.uniforms.uOffset[0]=a*n,this.uniforms.uOffset[1]=a*o,t.applyFilter(this,e,i,r);else{const h=di.getSameSizeTexture(e);let l=e,c=h,u;const _=this._quality-1;for(let d=0;d<_;d++)a=this._kernels[d]+.5,this.uniforms.uOffset[0]=a*n,this.uniforms.uOffset[1]=a*o,t.applyFilter(this,l,c,!0),u=l,l=c,c=u;a=this._kernels[_]+.5,this.uniforms.uOffset[0]=a*n,this.uniforms.uOffset[1]=a*o,t.applyFilter(this,l,i,r),di.returnTexture(h)}}get strength(){return this._blur}set strength(t){this._blur=t,this._generateKernels()}get quality(){return this._quality}set quality(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()}get kernels(){return this._kernels}set kernels(t){Array.isArray(t)&&t.length>0?(this._kernels=t,this._quality=t.length,this._blur=Math.max(...t)):(this._kernels=[0],this._quality=1)}get pixelSize(){return this._pixelSize}set pixelSize(t){if(typeof t=="number"){this.pixelSizeX=this.pixelSizeY=t;return}if(Array.isArray(t)){this.pixelSizeX=t[0],this.pixelSizeY=t[1];return}this._pixelSize=t}get pixelSizeX(){return this.pixelSize.x}set pixelSizeX(t){this.pixelSize.x=t}get pixelSizeY(){return this.pixelSize.y}set pixelSizeY(t){this.pixelSize.y=t}get clamp(){return this._clamp}_updatePadding(){this.padding=Math.ceil(this._kernels.reduce((t,e)=>t+e+.5,0))}_generateKernels(){const t=this._blur,e=this._quality,i=[t];if(t>0){let r=t;const n=t/e;for(let o=1;o, + uOffset: vec2, +}; + +struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; + +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler: sampler; +@group(1) @binding(0) var dropShadowUniforms : DropShadowUniforms; + +@fragment +fn mainFragment( + @builtin(position) position: vec4, + @location(0) uv : vec2 +) -> @location(0) vec4 { + var color: vec4 = textureSample(uTexture, uSampler, uv - dropShadowUniforms.uOffset * gfu.uInputSize.zw); + + // Premultiply alpha + color = vec4(vec3(dropShadowUniforms.uColor.rgb * color.a), color.a); + // alpha user alpha + color *= dropShadowUniforms.uAlpha; + + return color; +}`,sp=Object.defineProperty,rp=(s,t,e)=>t in s?sp(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ni=(s,t,e)=>(rp(s,typeof t!="symbol"?t+"":t,e),e);const bh=class vh extends Er{constructor(t){t={...vh.DEFAULT_OPTIONS,...t};const e=We.from({vertex:{source:jr,entryPoint:"mainVertex"},fragment:{source:ip,entryPoint:"mainFragment"}}),i=_i.from({vertex:Yr,fragment:ep,name:"drop-shadow-filter"});super({gpuProgram:e,glProgram:i,resources:{dropShadowUniforms:{uAlpha:{value:t.alpha,type:"f32"},uColor:{value:new Float32Array(3),type:"vec3"},uOffset:{value:t.offset,type:"vec2"}}},resolution:t.resolution}),ni(this,"uniforms"),ni(this,"shadowOnly",!1),ni(this,"_color"),ni(this,"_blurFilter"),ni(this,"_basePass"),this.uniforms=this.resources.dropShadowUniforms.uniforms,this._color=new Ht,this.color=t.color??0,this._blurFilter=new tp({strength:t.kernels??t.blur,quality:t.kernels?void 0:t.quality}),this._basePass=new Er({gpuProgram:We.from({vertex:{source:jr,entryPoint:"mainVertex"},fragment:{source:` + @group(0) @binding(1) var uTexture: texture_2d; + @group(0) @binding(2) var uSampler: sampler; + @fragment + fn mainFragment( + @builtin(position) position: vec4, + @location(0) uv : vec2 + ) -> @location(0) vec4 { + return textureSample(uTexture, uSampler, uv); + } + `,entryPoint:"mainFragment"}}),glProgram:_i.from({vertex:Yr,fragment:` + in vec2 vTextureCoord; + out vec4 finalColor; + uniform sampler2D uTexture; + + void main(void){ + finalColor = texture(uTexture, vTextureCoord); + } + `,name:"drop-shadow-filter"}),resources:{}}),Object.assign(this,t)}apply(t,e,i,r){const n=di.getSameSizeTexture(e);t.applyFilter(this,e,n,!0),this._blurFilter.apply(t,n,i,r),this.shadowOnly||t.applyFilter(this._basePass,e,i,!1),di.returnTexture(n)}get offset(){return this.uniforms.uOffset}set offset(t){this.uniforms.uOffset=t,this._updatePadding()}get offsetX(){return this.offset.x}set offsetX(t){this.offset.x=t,this._updatePadding()}get offsetY(){return this.offset.y}set offsetY(t){this.offset.y=t,this._updatePadding()}get color(){return this._color.value}set color(t){this._color.setValue(t);const[e,i,r]=this._color.toArray();this.uniforms.uColor[0]=e,this.uniforms.uColor[1]=i,this.uniforms.uColor[2]=r}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}get blur(){return this._blurFilter.strength}set blur(t){this._blurFilter.strength=t,this._updatePadding()}get quality(){return this._blurFilter.quality}set quality(t){this._blurFilter.quality=t,this._updatePadding()}get kernels(){return this._blurFilter.kernels}set kernels(t){this._blurFilter.kernels=t}get pixelSize(){return this._blurFilter.pixelSize}set pixelSize(t){typeof t=="number"&&(t={x:t,y:t}),Array.isArray(t)&&(t={x:t[0],y:t[1]}),this._blurFilter.pixelSize=t}get pixelSizeX(){return this._blurFilter.pixelSizeX}set pixelSizeX(t){this._blurFilter.pixelSizeX=t}get pixelSizeY(){return this._blurFilter.pixelSizeY}set pixelSizeY(t){this._blurFilter.pixelSizeY=t}_updatePadding(){const t=Math.max(Math.abs(this.offsetX),Math.abs(this.offsetY));this.padding=t+this.blur*2+this.quality*4}};ni(bh,"DEFAULT_OPTIONS",{offset:{x:4,y:4},color:0,alpha:.5,shadowOnly:!1,kernels:void 0,blur:2,quality:3,pixelSize:{x:1,y:1},resolution:1});let np=bh;class op{name="image";context;current_tool;current_subtool;async setup(t,e,i){this.context=t,this.current_tool=e,this.current_subtool=i}cleanup(){}async add_image({image:t,fixed_canvas:e,border_region:i=0}){const r=new ap(this.context,t,e,i);await this.context.execute_command(r)}set_tool(t,e){this.current_tool=t,this.current_subtool=e}}class ap{sprite=null;fixed_canvas;context;background;current_canvas_size;computed_dimensions;current_scale;current_position;border_region;scaled_width;scaled_height;previous_image=null;name;constructor(t,e,i,r=0){if(this.name="AddImage",this.context=t,this.background=e,this.fixed_canvas=i,this.border_region=r,this.current_canvas_size=Ne(this.context.dimensions),this.current_scale=Ne(this.context.scale),this.current_position=Ne(this.context.position),this.computed_dimensions={width:0,height:0},this.context.background_image&&this.context.background_image.texture){const n=this.context.background_image,o=n.borderRegion||0;this.previous_image={texture:this.clone_texture(n.texture),width:n.width,height:n.height,x:n.position.x,y:n.position.y,border_region:o}}}clone_texture(t){const e=Jt.create({width:t.width,height:t.height,resolution:window.devicePixelRatio||1}),i=new kt(t),r=new lt;return r.addChild(i),this.context.app.renderer.render(r,{renderTexture:e}),r.destroy({children:!0}),e}async start(){let t;if(this.background instanceof _t)t=this.background;else{const r=await createImageBitmap(this.background);t=_t.from(r)}this.sprite=new kt(t);const[e,i]=this.handle_image();this.computed_dimensions={width:e,height:i}}handle_image(){if(this.sprite===null)return[0,0];if(this.fixed_canvas){const t=Math.max(this.current_canvas_size.width-this.border_region*2,10),e=Math.max(this.current_canvas_size.height-this.border_region*2,10),{width:i,height:r,x:n,y:o}=hp(this.sprite.width,this.sprite.height,t,e);this.sprite.width=i,this.sprite.height=r,this.sprite.x=n+this.border_region,this.sprite.y=o+this.border_region}else{const t=this.sprite.width,e=this.sprite.height;return this.sprite.x=this.border_region,this.sprite.y=this.border_region,[t+this.border_region*2,e+this.border_region*2]}return[this.current_canvas_size.width,this.current_canvas_size.height]}async execute(t){if(t&&(this.context=t),await this.start(),this.sprite===null)return;const{width:e,height:i}=this.computed_dimensions;await this.context.set_image_properties({scale:1,position:{x:this.context.app.screen.width/2,y:this.context.app.screen.height/2},width:this.fixed_canvas?this.current_canvas_size.width:e,height:this.fixed_canvas?this.current_canvas_size.height:i});const r=this.context.layer_manager.create_background_layer(this.fixed_canvas?this.current_canvas_size.width:e,this.fixed_canvas?this.current_canvas_size.height:i);this.sprite.zIndex=0,r.addChild(this.sprite),this.context.layer_manager.reset_layers(this.fixed_canvas?this.current_canvas_size.width:e,this.fixed_canvas?this.current_canvas_size.height:i,!0),this.border_region>0&&(this.sprite.borderRegion=this.border_region),this.context.set_background_image(this.sprite),this.context.reset()}async undo(){if(this.sprite){if(this.sprite.destroy(),this.previous_image){const t=new kt(this.previous_image.texture);t.width=this.previous_image.width,t.height=this.previous_image.height,t.position.set(this.previous_image.x,this.previous_image.y),this.previous_image.border_region>0&&(t.borderRegion=this.previous_image.border_region),await this.context.set_image_properties({scale:1,position:{x:this.context.app.screen.width/2,y:this.context.app.screen.height/2},width:this.previous_image.width,height:this.previous_image.height});const e=this.context.layer_manager.create_background_layer(this.previous_image.width,this.previous_image.height);t.zIndex=0,e.addChild(t),this.context.layer_manager.reset_layers(this.previous_image.width,this.previous_image.height,!0),this.context.set_background_image(t)}else await this.context.set_image_properties({scale:1,position:{x:this.context.app.screen.width/2,y:this.context.app.screen.height/2},width:this.current_canvas_size.width,height:this.current_canvas_size.height}),this.context.layer_manager.create_background_layer(this.current_canvas_size.width,this.current_canvas_size.height),this.context.layer_manager.reset_layers(this.current_canvas_size.width,this.current_canvas_size.height);this.context.reset()}}}function hp(s,t,e,i){const r=s/t,n=e/i;let o,a;r>n?(o=e,a=e/r):(a=i,o=i*r);const h=Math.round((e-o)/2),l=Math.round((i-a)/2);return{width:Math.round(o),height:Math.round(a),x:h,y:l}}class qr{name="zoom";min_zoom=ai(!0);image_editor_context;max_zoom=10;border_padding=30;pad_bottom=0;is_pinching=!1;is_dragging=!1;is_pointer_dragging=!1;last_touch_position=null;last_pinch_distance=0;drag_start=new dt;current_tool;current_subtool;local_scale=1;local_dimensions={width:0,height:0};local_position={x:0,y:0};prevent_default(t){t.preventDefault(),t.stopPropagation()}set_tool(t,e){this.current_tool=t,this.current_subtool=e}set_zoom(t){const e=this.calculate_min_zoom(this.local_dimensions.width,this.local_dimensions.height);let i;const r=t==="fit";r?i=e:i=Math.max(0,Math.min(this.max_zoom,t));const n=this.image_editor_context.app.screen,o=n.width,a=n.height;let h;h={x:o/2,y:a/2},this.zoom_to_point(i,h,!0,r)}async setup(t,e,i){this.image_editor_context=t,this.current_tool=e,this.current_subtool=i,this.pad_bottom=t.pad_bottom;const{width:r,height:n}=await this.get_container_dimensions(),o=this.calculate_min_zoom(r,n),a=Math.min(o,1);this.local_scale=a;const h=this.image_editor_context.app.screen,l=h.width/2,c=h.height/2,u=r*a,_=n*a,d=l-u/2,f=c-_/2;this.local_position={x:d,y:f},this.setup_event_listeners(),await this.image_editor_context.set_image_properties({scale:a,position:{x:d,y:f}}),this.image_editor_context.dimensions.subscribe(g=>{this.local_dimensions=g}),this.image_editor_context.scale.subscribe(g=>{this.local_scale=g}),this.image_editor_context.position.subscribe(g=>{this.local_position=g})}setup_event_listeners(){const t=this.image_editor_context.app.stage;this.image_editor_context.app.canvas.addEventListener("wheel",this.prevent_default,{passive:!1}),t.eventMode="static",t.hitArea=this.image_editor_context.app.screen;const i=this.handle_wheel.bind(this);t.addEventListener("wheel",i,{passive:!1}),"ontouchstart"in window?(t.addEventListener("touchstart",this.handle_touch_start.bind(this)),t.addEventListener("touchmove",this.handle_touch_move.bind(this)),t.addEventListener("touchend",this.handle_touch_end.bind(this))):(t.addEventListener("pointerdown",this.handle_pointer_down.bind(this)),t.addEventListener("pointermove",this.handle_pointer_move.bind(this)),t.addEventListener("pointerup",this.handle_pointer_up.bind(this)),t.addEventListener("pointerupoutside",this.handle_pointer_up.bind(this)))}handle_wheel(t){const e=t.deltaMode===0&&Math.abs(t.deltaY)<50,i=e?30:10;if(t.altKey||t.metaKey){const r=this.image_editor_context.app.stage.toLocal(t.global),n=-t.deltaY*(e?.001:5e-4),o=this.local_scale*(1+n);this.zoom_to_point(o,r,!0)}else{const r=t.deltaX,n=t.deltaY,o={x:this.local_position.x-r/100*i,y:this.local_position.y-n/100*i},a=this.image_editor_context.app.screen,h=this.local_dimensions.width*this.local_scale,l=this.local_dimensions.height*this.local_scale,c=a.width-this.border_padding*2,u=a.height-this.border_padding*2-this.pad_bottom;let _={...o};if(h<=c)_.x=(a.width-h)/2;else{const d=a.width/2,f=d,g=a.width-d-h;_.x=Math.min(Math.max(o.x,g),f)}if(l<=u)_.y=(a.height-this.pad_bottom-l)/2;else{const d=(a.height-this.pad_bottom)/2,f=d,g=a.height-this.pad_bottom-d-l;_.y=Math.min(Math.max(o.y,g),f)}this.image_editor_context.set_image_properties({scale:this.local_scale,position:_})}}cleanup(){const t=this?.image_editor_context?.app?.stage;t&&(t.removeEventListener("wheel",this.handle_wheel.bind(this)),"ontouchstart"in window?(t.removeEventListener("touchstart",this.handle_touch_start.bind(this)),t.removeEventListener("touchmove",this.handle_touch_move.bind(this)),t.removeEventListener("touchend",this.handle_touch_end.bind(this))):(t.removeEventListener("pointerdown",this.handle_pointer_down.bind(this)),t.removeEventListener("pointermove",this.handle_pointer_move.bind(this)),t.removeEventListener("pointerup",this.handle_pointer_up.bind(this)),t.removeEventListener("pointerupoutside",this.handle_pointer_up.bind(this))))}async get_container_dimensions(){const t=this.image_editor_context.image_container.getLocalBounds();return{width:t.width,height:t.height}}calculate_min_zoom(t,e){const i=this.image_editor_context.app.screen,r=i.width,n=i.height;if(!t||!r||!e||!n)return 1;const o=r-this.border_padding*2,a=n-this.border_padding*2-this.pad_bottom,h=o/t,l=a/e;return Math.min(h,l)}handle_touch_start(t){t.preventDefault();const e=t;if(e.touches&&e.touches.length===2)this.is_pinching=!0,this.last_pinch_distance=Math.hypot(e.touches[0].pageX-e.touches[1].pageX,e.touches[0].pageY-e.touches[1].pageY);else if(e.touches&&e.touches.length===1){this.is_dragging=!0;const i=this.image_editor_context.app.view.getBoundingClientRect();this.last_touch_position=new dt(e.touches[0].pageX-i.left,e.touches[0].pageY-i.top)}}handle_touch_move(t){t.preventDefault();const e=t;if(this.is_pinching&&e.touches&&e.touches.length===2){const i=this.image_editor_context.app.view.getBoundingClientRect(),r=Math.hypot(e.touches[0].pageX-e.touches[1].pageX,e.touches[0].pageY-e.touches[1].pageY),n={x:(e.touches[0].pageX+e.touches[1].pageX)/2-i.left,y:(e.touches[0].pageY+e.touches[1].pageY)/2-i.top},o=r/this.last_pinch_distance;this.last_pinch_distance=r,this.zoom_to_point(this.local_scale*o,n)}else if(this.is_dragging&&e.touches&&e.touches.length===1&&this.last_touch_position){const i=this.image_editor_context.app.view.getBoundingClientRect(),r=new dt(e.touches[0].pageX-i.left,e.touches[0].pageY-i.top),n=r.x-this.last_touch_position.x,o=r.y-this.last_touch_position.y;this.image_editor_context.set_image_properties({position:{x:this.local_position.x+n,y:this.local_position.y+o}}),this.last_touch_position=r}}handle_touch_end(t){t.preventDefault();const e=t;if(e.touches&&e.touches.length<2&&(this.is_pinching=!1,e.touches&&e.touches.length===1)){const i=this.image_editor_context.app.view.getBoundingClientRect();this.last_touch_position=new dt(e.touches[0].pageX-i.left,e.touches[0].pageY-i.top),this.is_dragging=!0}e.touches&&e.touches.length===0&&(this.is_dragging=!1,this.last_touch_position=null,this.last_pinch_distance=0)}get_bounded_position(t){const e=this.image_editor_context.app.screen,i=this.local_dimensions.width*this.local_scale,r=this.local_dimensions.height*this.local_scale,n={x:(e.width-i)/2,y:(e.height-r-this.pad_bottom)/2};if(i<=e.width&&r<=e.height)return n;let o=t.x,a=t.y;if(i<=e.width)o=n.x;else{const h=e.width-i;o=Math.max(h,Math.min(0,t.x))}if(r<=e.height-this.pad_bottom)a=n.y;else{const h=e.height-r-this.pad_bottom;a=Math.max(h,Math.min(0,t.y))}return{x:o,y:a}}zoom_to_point(t,e,i,r){const n=this.image_editor_context.image_container,o=n.getGlobalPosition(),a=n.scale.x,h={x:(e.x-o.x)/a,y:(e.y-o.y)/a},l=this.calculate_min_zoom(this.local_dimensions.width,this.local_dimensions.height),c=Math.min(l,1);t=Math.min(Math.max(t,c),this.max_zoom);const u={x:e.x-h.x*t,y:e.y-h.y*t};if(t===c||r){const _=this.image_editor_context.app.screen.width,d=this.image_editor_context.app.screen.height,f=this.local_dimensions.width*t,g=this.local_dimensions.height*t;u.x=(_-f)/2,u.y=(d-this.pad_bottom-g)/2}this.image_editor_context.set_image_properties({scale:t,position:u,animate:typeof i=="boolean"?!i:t===c}),this.min_zoom.set(t===c)}handle_pointer_down(t){t.button===0&&this.current_tool==="pan"&&(this.is_pointer_dragging=!0,this.drag_start.copyFrom(t.global),this.drag_start.x-=this.local_position.x,this.drag_start.y-=this.local_position.y)}handle_pointer_move(t){if(this.is_pointer_dragging&&this.current_tool==="pan"){const e={x:t.global.x-this.drag_start.x,y:t.global.y-this.drag_start.y},i=this.image_editor_context.app.screen,r=this.local_dimensions.width*this.local_scale,n=this.local_dimensions.height*this.local_scale,o=i.width-this.border_padding*2,a=i.height-this.border_padding*2-this.pad_bottom;let h={...e};r<=o?h.x=(i.width-r)/2:h.x=e.x,n<=a?h.y=(i.height-this.pad_bottom-n)/2:h.y=e.y,this.image_editor_context.set_image_properties({scale:this.local_scale,position:h})}}handle_pointer_up(t){if(this.is_pointer_dragging&&this.current_tool==="pan"){this.is_pointer_dragging=!1;const e={x:t.global.x-this.drag_start.x,y:t.global.y-this.drag_start.y},i=this.image_editor_context.app.screen,r=this.local_dimensions.width*this.local_scale,n=this.local_dimensions.height*this.local_scale,o=i.width-this.border_padding*2,a=i.height-this.border_padding*2-this.pad_bottom;let h={...e};if(r<=o)h.x=(i.width-r)/2;else{const l=i.width/2,c=l,u=i.width-l-r;h.x=Math.min(Math.max(e.x,u),c)}if(n<=a)h.y=(i.height-this.pad_bottom-n)/2;else{const l=(i.height-this.pad_bottom)/2,c=l,u=i.height-this.pad_bottom-l-n;h.y=Math.min(Math.max(e.y,u),c)}this.image_editor_context.set_image_properties({scale:this.local_scale,position:h,animate:!0})}}}class lp{layers=[];active_layer=null;active_layer_id=null;draw_textures=new Map;layer_store=ai({active_layer:"",layers:[]});background_layer=null;image_container;app;fixed_canvas;dark;border_region;layer_options;constructor(t,e,i,r,n,o){this.image_container=t,this.app=e,this.fixed_canvas=i,this.dark=r,this.border_region=n,this.layer_options=o}toggle_layer_visibility(t){const e=this.layers.find(i=>i.id===t);e&&(e.container.visible=!e.container.visible,e.visible=e.container.visible,this.layer_store.update(i=>({active_layer:i.active_layer,layers:this.layers})))}create_background_layer(t,e){this.background_layer&&this.background_layer.destroy();const i=new lt;this.background_layer=i;const r=Jt.create({width:t,height:e,resolution:window.devicePixelRatio,antialias:!0,scaleMode:Oo.NEAREST}),n=new kt(r);i.addChild(n);const o=new Dt;return o.clear(),o.rect(0,0,t,e).fill({color:this.dark?3355443:16777215,alpha:1}),this.app.renderer.render({container:o,target:r,clear:!0}),this.image_container.addChild(i),i.zIndex=-1,this.update_layer_order(),i}set_layer_options(t,e,i){this.layer_options=t,this.reset_layers(e,i)}async create_background_layer_from_url(t,e,i){const r=this.create_background_layer(e||this.image_container.width,i||this.image_container.height);try{const n=await _t.from(t),o=new kt(n),a=o.texture.width,h=o.texture.height,l=e||this.image_container.width,c=i||this.image_container.height;if(this.fixed_canvas){const u=Math.max(l-this.border_region*2,10),_=Math.max(c-this.border_region*2,10),d=a/h,f=u/_;let g,p,y=this.border_region,x=this.border_region;a<=u&&h<=_?(g=a,p=h):d>f?(g=u,p=u/d):(p=_,g=_*d),y+=Math.round((u-g)/2),x+=Math.round((_-p)/2),o.width=g,o.height=p,o.position.set(y,x)}else{o.position.set(this.border_region,this.border_region),this.background_layer&&this.background_layer.destroy();const u=a+this.border_region*2,_=h+this.border_region*2,d=this.create_background_layer(u,_);return o.width=a,o.height=h,d.addChild(o),d}return r.addChild(o),r}catch(n){return console.error("Error loading image from URL:",n),r}}create_layer({width:t,height:e,layer_name:i,user_created:r,layer_id:n=void 0,make_active:o=!1}){const a=new lt,h=n||Math.random().toString(36).substring(2,15),l=i||`Layer ${this.layers.length+1}`;this.layers.push({name:l,id:h,container:a,user_created:r,visible:!0}),this.image_container.addChild(a);const c=Jt.create({width:t,height:e,resolution:window.devicePixelRatio,antialias:!0,scaleMode:Oo.NEAREST}),u=new kt(c);a.addChild(u);const _=new Dt;return _.clear(),_.beginFill(0,0),_.drawRect(0,0,t,e),_.endFill(),this.app.renderer.render({container:_,target:c,clear:!0}),this.draw_textures.set(a,c),this.update_layer_order(),o&&this.set_active_layer(h),this.layer_store.set({active_layer:this.active_layer_id||"",layers:this.layers}),a}async add_layer_from_url(t){const{width:e,height:i}=this.image_container.getLocalBounds(),r=this.create_layer({width:e,height:i,layer_name:"Layer 1",user_created:!0}),n=this.layers.findIndex(a=>a.container===r);if(n===-1)return console.error("Could not find newly created layer"),"";const o=this.layers[n].id;try{const a=await Ze.load(t),h=this.draw_textures.get(r);if(!h)return console.error("No draw texture found for layer"),o;const l=new kt(a),c=l.width,u=l.height;let _=this.border_region,d=this.border_region;const f=this.fixed_canvas?e-this.border_region*2:e,g=this.fixed_canvas?i-this.border_region*2:i;if((cf||u>g){const p=c/u,y=f/g;let x,v;p>y?(x=f,v=f/p):(v=g,x=g*p),l.width=x,l.height=v,_=this.border_region+Math.floor((f-x)/2),d=this.border_region+Math.floor((g-v)/2),l.position.set(_,d)}return this.app.renderer.render(l,{renderTexture:h}),this.set_active_layer(o),o}catch(a){return console.error("Error loading image from URL:",a),o}}get_active_layer(){return this.active_layer}set_active_layer(t){this.layers.some(e=>e.id===t)&&(this.active_layer=this.layers.find(e=>e.id===t)?.container||this.layers[0]?.container||null,this.active_layer_id=t,this.layer_store.set({active_layer:t,layers:this.layers}))}get_layers(){return this.layers}get_layer_textures(t){const e=this.layers.find(i=>i.id===t);if(e){const i=this.draw_textures.get(e.container);if(i)return{draw:i}}return null}delete_layer(t){const e=this.layers.findIndex(i=>i.id===t);if(e>-1){const i=this.draw_textures.get(this.layers[e].container);if(i&&(i.destroy(),this.draw_textures.delete(this.layers[e].container)),this.layers[e].container.destroy(),this.active_layer===this.layers[e].container){const r=this.layers[Math.max(0,e-1)]||null;this.active_layer=r?.container||null,this.active_layer_id=r?.id||null}this.layers=this.layers.filter(r=>r.id!==t),this.layer_store.update(r=>({active_layer:r.active_layer===t?this.layers[this.layers.length-1]?.id:r.active_layer,layers:this.layers})),this.update_layer_order()}}update_layer_order(){this.background_layer&&(this.background_layer.zIndex=-1),this.layers.forEach((t,e)=>{t.container.zIndex=e})}move_layer(t,e){const i=this.layers.findIndex(r=>r.id===t);if(i>-1){const r=e==="up"?i-1:i+1;this.layers=this.layers.map((n,o)=>o===i?this.layers[r]:o===r?this.layers[i]:n),this.update_layer_order(),this.layer_store.update(n=>({active_layer:t,layers:this.layers}))}}resize_all_layers(t,e,i,r,n,o){new Map(this.layers.map(d=>[d.id,d]));const a=this.background_layer,h=()=>{let d=0,f=0;const g=t-n,p=e-o;return r.includes("left")?d=0:r.includes("right")?d=g:d=Math.floor(g/2),r.includes("top")?f=0:r.includes("bottom")?f=p:f=Math.floor(p/2),{offsetX:d,offsetY:f}};this.background_layer=this._resize_background_layer(a,t,e,i,h);const l=[],c=this.layers.map(d=>({id:d.id,name:d.name,user_created:d.user_created,texture:this.draw_textures.get(d.container),container:d.container}));this.layers=[],this.draw_textures.clear();for(const d of c){const f=this._resize_single_layer(d,t,e,i,h);f&&l.push(f)}const u=Ne(this.layer_store).active_layer;!l.some(d=>d.id===u)&&l.length>0?this.set_active_layer(l[0].id):l.length===0?this.layer_store.update(d=>({...d,active_layer:""})):this.layer_store.update(d=>({...d})),this.update_layer_order(),setTimeout(()=>{Ze.cache.reset(),this.app.renderer.textureGC.run()},100)}_resize_background_layer(t,e,i,r,n){if(!t)return this.create_background_layer(e,i);let o=t.children.find(h=>h instanceof kt&&h.texture!==t.children[0]?.texture);const a=this.create_background_layer(e,i);if(o){const h=new kt(o.texture);if(h.width=o.width,h.height=o.height,r)h.width=e,h.height=i,h.position.set(0,0);else{const{offsetX:l,offsetY:c}=n();h.position.set(o.x+l,o.y+c)}a.addChild(h)}return a}_resize_single_layer(t,e,i,r,n){if(!t.texture)return console.warn(`No texture found for layer ${t.id}, skipping cleanup.`),t.container&&!t.container.destroyed&&(this.image_container.children.includes(t.container)&&this.image_container.removeChild(t.container),t.container.destroy({children:!0})),null;const o=this.create_layer({width:e,height:i,layer_name:t.name,user_created:t.user_created}),a=this.layers[this.layers.length-1];a.id=t.id;const h=this.draw_textures.get(o);if(!h){if(console.error(`Failed to get texture for newly created layer ${a.id}. Cleaning up.`),o&&!o.destroyed){this.image_container.children.includes(o)&&this.image_container.removeChild(o),o.destroy({children:!0});const c=this.layers.findIndex(u=>u.container===o);c>-1&&this.layers.splice(c,1),this.draw_textures.delete(o)}return t.texture&&!t.texture.destroyed&&t.texture.destroy(!0),t.container&&!t.container.destroyed&&t.container.destroy({children:!0}),null}this.app.renderer.clear({target:h,clearColor:[0,0,0,0]});const l=new kt(t.texture);if(r)l.width=e,l.height=i,l.position.set(0,0);else{const{offsetX:c,offsetY:u}=n();l.position.set(c,u)}return this.app.renderer.render(l,{renderTexture:h}),l.destroy(),t.texture&&!t.texture.destroyed&&t.texture.destroy(!0),t.container&&!t.container.destroyed&&(this.image_container.children.includes(t.container)&&this.image_container.removeChild(t.container),t.container.destroy({children:!0})),a}async get_blobs(t,e){return{background:await fs(this.app.renderer,this.background_layer,{width:t,height:e,x:0,y:0}),layers:await Promise.all(this.layers.map(async r=>{const n=await fs(this.app.renderer,r.container,{width:t,height:e,x:0,y:0});return n||null})),composite:await fs(this.app.renderer,this.image_container,{width:t,height:e,x:0,y:0})}}reset_layers(t,e,i=!1){const r=i?this.layers.map(n=>[n.name,n.id]):this.layer_options.layers.map(n=>[n,void 0]);this.layers.forEach(n=>{this.delete_layer(n.id)});for(const[n,o]of r)this.create_layer({width:t,height:e,layer_name:n,user_created:!this.layer_options.layers.find(a=>a===n),layer_id:o});if(!i)this.active_layer=this.layers[0].container,this.active_layer_id=this.layers[0].id;else if(this.active_layer=this.layers.find(n=>n.id===this.active_layer_id)?.container||this.layers[0]?.container,!this.active_layer)return;this.layer_store.update(n=>({active_layer:this.active_layer_id||this.layers[0].id,layers:this.layers}))}init_layers(t,e){for(const r of this.layers)this.delete_layer(r.id);let i=0;for(const r of this.layer_options.layers)this.create_layer({width:t,height:e,layer_name:r,user_created:!1,layer_id:`layer-${i}`}),i++;this.active_layer=this.layers[0].container,this.active_layer_id=this.layers[0].id,this.layer_store.update(r=>({active_layer:this.layers[0].id,layers:this.layers}))}}class cp{constructor(t,e){this.context=t,this.width=e.width,this.height=e.height,this.layer_name=e.layer_name||`Layer ${this.context.layer_manager.get_layers().length+1}`,this.user_created=e.user_created,this.layer_id=e.layer_id||Math.random().toString(36).substring(2,15),this.make_active=e.make_active||!1,this.name="AddLayer";const r=this.context.layer_manager.get_layers().find(n=>n.container===this.context.layer_manager.get_active_layer());this.previous_active_layer=r?.id||null}layer_id;layer_name;width;height;user_created;make_active;previous_active_layer=null;name;async execute(t){t&&(this.context=t),this.context.layer_manager.create_layer({width:this.width,height:this.height,layer_name:this.layer_name,user_created:this.user_created,layer_id:this.layer_id,make_active:this.make_active})}async undo(){this.context.layer_manager.delete_layer(this.layer_id),this.previous_active_layer&&this.context.layer_manager.set_active_layer(this.previous_active_layer)}}class up{constructor(t,e){this.context=t,this.name="RemoveLayer";const i=this.context.layer_manager.get_layers(),r=i.find(a=>a.id===e);if(!r)throw new Error(`Layer with ID ${e} not found`);const n=this.context.layer_manager.get_active_layer(),o=r.container===n;if(o){const a=i.findIndex(l=>l.id===e),h=i[Math.max(0,a-1)];this.previous_active_layer=h?.id||null}this.layer_data={id:r.id,name:r.name,user_created:r.user_created,visible:r.visible,was_active:o},this.captureTextureData(e)}layer_data;previous_active_layer=null;texture_copy=null;name;captureTextureData(t){const e=this.context.layer_manager.get_layer_textures(t);if(e)try{const i=e.draw,r=Jt.create({width:i.width,height:i.height,resolution:window.devicePixelRatio||1}),n=new kt(i);this.context.app.renderer.render(n,{renderTexture:r}),this.texture_copy=r,n.destroy()}catch(i){console.error("Failed to copy layer texture:",i),this.texture_copy=null}}async execute(t){t&&(this.context=t),this.context.layer_manager.delete_layer(this.layer_data.id)}async undo(){const t=Ne(this.context.dimensions);if(this.context.layer_manager.create_layer({width:t.width,height:t.height,layer_name:this.layer_data.name,user_created:this.layer_data.user_created,layer_id:this.layer_data.id,make_active:this.layer_data.was_active}),this.texture_copy)try{const e=this.context.layer_manager.get_layer_textures(this.layer_data.id);if(e){const i=new kt(this.texture_copy);this.context.app.renderer.render(i,{renderTexture:e.draw}),i.destroy()}}catch(e){console.error("Failed to restore layer content:",e)}this.layer_data.visible||this.context.layer_manager.toggle_layer_visibility(this.layer_data.id),!this.layer_data.was_active&&this.previous_active_layer&&this.context.layer_manager.set_active_layer(this.previous_active_layer)}destroy(){this.texture_copy&&(this.texture_copy.destroy(),this.texture_copy=null)}}class dp{constructor(t,e,i){this.context=t,this.layer_id=e,this.direction=i,this.name="ReorderLayer";const r=this.context.layer_manager.get_layers();this.original_order=r.map(a=>a.id);const n=r.findIndex(a=>a.id===e);if(n===-1)throw new Error(`Layer with ID ${e} not found`);const o=i==="up"?n-1:n+1;o<0||o>=r.length?this.new_order=[...this.original_order]:(this.new_order=[...this.original_order],[this.new_order[n],this.new_order[o]]=[this.new_order[o],this.new_order[n]])}original_order;new_order;layer_id;direction;name;async execute(t){t&&(this.context=t),this.context.layer_manager.move_layer(this.layer_id,this.direction)}async undo(){const t=this.context.layer_manager.get_layers();if(this.original_order.join(",")===t.map(n=>n.id).join(","))return;const e=t.findIndex(n=>n.id===this.layer_id);if(e===-1)return;const i=this.original_order.indexOf(this.layer_id),r=e>i?"up":"down";this.context.layer_manager.move_layer(this.layer_id,r)}}const _p={image:()=>new op,zoom:()=>new qr},yr={stiffness:.45,damping:.8};class fp{state;scale;position;subscribers;constructor(t){if(!(t instanceof $r))throw new Error("EditorState must be created by ImageEditor");this.scale=1,this.position={x:0,y:0},this.subscribers=new Set,this.state=Object.freeze({get position(){return{...this.position}},get scale(){return this.scale},get current_tool(){return this.current_tool},get current_subtool(){return this.current_subtool},subscribe:this.subscribe.bind(this)})}_set_position(t,e){const i={...this.position};this.position={x:t,y:e},this._notify_subscribers("position",i,this.position)}_set_scale(t){const e=this.scale;this.scale=t,this._notify_subscribers("scale",e,t)}_notify_subscribers(t,e,i){this.subscribers.forEach(r=>{r({property:t,oldValue:e,newValue:i,timestamp:Date.now()})})}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}}class $r{ready;background_image_present=ai(!1);min_zoom=ai(!0);app;ui_container;image_container;command_manager;layer_manager;tools=new Map;current_tool;current_subtool;target_element;width;height;original_width;original_height;dimensions;scale;position;state;scale_value=1;position_value={x:0,y:0};dimensions_value={width:0,height:0};layers=ai({active_layer:"",layers:[]});outline_container;outline_graphics;background_image;ready_resolve;event_callbacks=new Map;fixed_canvas;dark;border_region;layer_options;overlay_container;overlay_graphics;pad_bottom;theme_mode;constructor(t){this.pad_bottom=t.pad_bottom||0,this.dark=t.dark||!1,this.theme_mode=t.theme_mode||"dark",this.target_element=t.target_element,this.width=t.width,this.height=t.height,this.original_width=t.width,this.original_height=t.height,this.command_manager=new Il,this.ready=new Promise(e=>{this.ready_resolve=e}),this.fixed_canvas=t.fixed_canvas||!1,this.tools=new Map(t.tools.map(e=>typeof e=="string"?[e,_p[e]()]:[e.name,e]));for(const e of this.tools.values())e?.on&&e.on("change",()=>{this.notify("change")});this.dimensions=Ds({width:this.width,height:this.height},yr),this.scale=Ds(1,yr),this.position=Ds({x:0,y:0},yr),this.state=new fp(this),this.border_region=t.border_region||0,this.layer_options=t.layer_options||{allow_additional_layers:!0,layers:["Layer 1"],disabled:!1},this.scale.subscribe(e=>{this.state._set_scale(e)}),this.position.subscribe(e=>{this.state._set_position(e.x,e.y)}),this.init()}get context(){const t=this;return{app:this.app,ui_container:this.ui_container,image_container:this.image_container,get background_image(){return t.background_image},pad_bottom:this.pad_bottom,command_manager:this.command_manager,layer_manager:this.layer_manager,dimensions:{subscribe:this.dimensions.subscribe},scale:{subscribe:this.scale.subscribe},position:{subscribe:this.position.subscribe},set_image_properties:this.set_image_properties.bind(this),execute_command:this.execute_command.bind(this),resize_canvas:this.resize_canvas.bind(this),reset:this.reset.bind(this),set_background_image:this.set_background_image.bind(this)}}async init(){const t=this.target_element.getBoundingClientRect();new ResizeObserver(r=>{r.forEach(n=>{this.resize_canvas(n.contentBoxSize[0].inlineSize,n.contentBoxSize[0].blockSize)})}).observe(this.target_element),this.app=new Va,this.dark||(globalThis.__PIXI_APP__=this.app),await this.app.init({width:t.width,height:t.height,backgroundAlpha:this.dark?0:1,backgroundColor:this.theme_mode==="dark"?"#27272a":"#ffffff",resolution:window.devicePixelRatio,autoDensity:!0,antialias:!0,powerPreference:"high-performance"});const e=this.app.canvas;e.style.background="transparent",this.setup_containers(),this.layer_manager.create_background_layer(this.width,this.height),this.layer_manager.init_layers(this.width,this.height);for(const r of this.tools.values())await r.setup(this.context,this.current_tool,this.current_subtool);const i=this.tools.get("zoom");i&&i.min_zoom.subscribe(r=>{this.min_zoom.set(r)}),this.target_element.appendChild(e),this.target_element.style.background="transparent",this.dimensions.subscribe(r=>{this.dimensions_value=r,this.image_container.width=r.width,this.image_container.height=r.height}),this.scale.subscribe(r=>{this.scale_value=r}),this.position.subscribe(r=>{this.position_value=r}),this.app.ticker.add(()=>{this.image_container.scale.set(this.scale_value),this.image_container.position.set(this.position_value.x,this.position_value.y);const r=this.dimensions_value.width*this.scale_value,n=this.dimensions_value.height*this.scale_value,o=Math.round(this.image_container.position.x-this.outline_container.position.x),a=Math.round(this.image_container.position.y-this.outline_container.position.y);if(this.overlay_container.position.set(this.outline_container.position.x,this.outline_container.position.y),this.outline_graphics.clear(),this.outline_graphics.rect(o,a,r,n).fill({color:this.dark?3355443:16777215,alpha:1}),this.border_region>0){const h=this.border_region*this.scale_value,l=o+h-1,c=a+h-1,u=r-h*2+1,_=n-h*2+1;this.overlay_graphics.clear(),this.overlay_graphics.rect(l,c,u,_).stroke({color:10066329,width:1,alpha:0,pixelLine:!0});const d=5,g=d+5,p=10066329;for(let y=l;y{this.min_zoom.set(e)}),this.notify("change")}add_layer(){const t=new cp(this.context,{width:this.width,height:this.height,user_created:!0,make_active:!0});this.execute_command(t),this.notify("change")}async add_layers_from_url(t){if(this.command_manager.reset(),this.layer_manager.get_layers().forEach(n=>this.layer_manager.delete_layer(n.id)),t===void 0||t.length===0){this.layer_manager.create_layer({width:this.width,height:this.height,layer_name:void 0,user_created:!1});return}const i=[];for await(const n of t){const o=await this.layer_manager.add_layer_from_url(n);o&&i.push(o)}i.length>0&&this.layer_manager.set_active_layer(i[0]);const r=this.tools.get("resize");r&&typeof r.set_border_region=="function"&&r.set_border_region(this.border_region),this.notify("change"),this.notify("input")}set_layer(t){this.layer_manager.set_active_layer(t),this.notify("change")}move_layer(t,e){const i=new dp(this.context,t,e);this.execute_command(i),this.notify("change")}delete_layer(t){const e=new up(this.context,t);this.execute_command(e),this.notify("change")}modify_canvas_size(t,e,i,r){const n=this.width,o=this.height;this.layer_manager.resize_all_layers(t,e,r,i,n,o),this.width=t,this.height=e,this.set_image_properties({width:t,height:e,scale:1,position:{x:0,y:0},animate:!1}),this.notify("change")}async get_blobs(){return await this.layer_manager.get_blobs(this.width,this.height)}on(t,e){this.event_callbacks.set(t,[...this.event_callbacks.get(t)||[],e])}off(t,e){this.event_callbacks.set(t,this.event_callbacks.get(t)?.filter(i=>i!==e)||[])}notify(t){for(const e of this.event_callbacks.get(t)||[])e()}destroy(){this.app&&this.app?.destroy()}resize(t,e){this.set_image_properties({width:t,height:e}),this.reset()}async get_crop_bounds(){const t=this.tools.get("crop"),e=t.get_crop_bounds();return{image:await t.get_image(),...e}}get background_image_sprite(){return this.background_image}set_layer_options(t){this.layer_options=t,this.layer_manager.set_layer_options(t,this.width,this.height)}toggle_layer_visibility(t){this.layer_manager.toggle_layer_visibility(t)}}class pp{name="crop";image_editor_context;current_tool="image";current_subtool="crop";CORNER_SIZE=25;LINE_THICKNESS=5;HANDLE_COLOR=0;HIT_AREA_SIZE=40;is_dragging=!1;selected_handle=null;active_corner_index=-1;active_edge_index=-1;last_pointer_position=null;crop_bounds={x:0,y:0,width:0,height:0};crop_ui_container=null;crop_mask=null;dimensions={width:0,height:0};position={x:0,y:0};scale=1;is_dragging_window=!1;drag_start_position=null;drag_start_bounds=null;background_image_watcher=null;has_been_manually_changed=!1;event_callbacks=new Map;async setup(t,e,i){this.image_editor_context=t,this.current_tool=e,this.current_subtool=i,t.dimensions.subscribe(n=>{this.dimensions=n,this.crop_bounds={x:0,y:0,width:n.width,height:n.height},this.crop_ui_container&&this.update_crop_ui(),this.set_crop_mask(),this.update_crop_mask()}),t.position.subscribe(n=>{this.position=n}),t.scale.subscribe(n=>{this.scale=n}),this.background_image_watcher=()=>{this.crop_mask&&this.current_tool==="image"&&this.current_subtool==="crop"&&this.image_editor_context.background_image&&this.image_editor_context.background_image.setMask(this.crop_mask)},this.image_editor_context.app.ticker.add(this.background_image_watcher),await this.init_crop_ui(),this.setup_event_listeners();const r=e==="image"&&i==="crop";this.crop_ui_container&&(this.crop_ui_container.visible=r)}cleanup(){this.crop_ui_container&&this.image_editor_context.app.stage.removeChild(this.crop_ui_container),this.crop_mask&&(this.crop_mask.parent&&this.crop_mask.parent.removeChild(this.crop_mask),this.image_editor_context.background_image&&this.image_editor_context.background_image.mask===this.crop_mask&&(this.image_editor_context.background_image.mask=null),this.image_editor_context.image_container.mask===this.crop_mask&&(this.image_editor_context.image_container.mask=null)),this.crop_mask=null,this.crop_ui_container=null,this.background_image_watcher&&(this.image_editor_context.app.ticker.remove(this.background_image_watcher),this.background_image_watcher=null),this.cleanup_event_listeners()}set_tool(t,e){this.current_tool=t,this.current_subtool=e;const i=t==="image"&&e==="crop";this.crop_ui_container&&(this.crop_ui_container.visible=i),i&&this.crop_mask&&this.update_crop_mask()}set_crop_mask(){this.crop_mask&&(this.crop_mask.parent&&this.crop_mask.parent.removeChild(this.crop_mask),this.image_editor_context.image_container.mask===this.crop_mask&&(this.image_editor_context.image_container.mask=null),this.image_editor_context.background_image&&this.image_editor_context.background_image.mask===this.crop_mask&&(this.image_editor_context.background_image.mask=null)),this.crop_mask=new Dt,this.image_editor_context.image_container.addChild(this.crop_mask)}async init_crop_ui(){const{width:t,height:e}=this.image_editor_context.background_image?.getLocalBounds()||{width:!1,height:!1};this.crop_ui_container=this.make_crop_ui(this.dimensions.width*this.scale,this.dimensions.height*this.scale),this.crop_ui_container.position.set(this.position.x,this.position.y),this.crop_ui_container.visible=!1,this.image_editor_context.app.stage.addChild(this.crop_ui_container),this.set_crop_mask(),this.image_editor_context.app.ticker.add(this.update_crop_ui.bind(this)),this.update_crop_mask()}make_crop_ui(t,e){const i=new lt;i.eventMode="static",i.interactiveChildren=!0;const r=new Dt().rect(0,0,t,e).stroke({width:1,color:0,alignment:0,alpha:.5});return r.eventMode="static",r.cursor="move",r.hitArea=new Mt(0,0,t,e),r.on("pointerdown",this.handle_window_drag_start.bind(this)),i.addChild(r),this.create_corner_handles(i,t,e),this.create_edge_handles(i,t,e),i}create_handle(t=!1){const e=new lt;e.eventMode="static";const i=new Dt;t?i.rect(0,0,this.CORNER_SIZE*1.5,this.LINE_THICKNESS).fill(this.HANDLE_COLOR):i.rect(0,0,this.CORNER_SIZE,this.LINE_THICKNESS).rect(0,0,this.LINE_THICKNESS,this.CORNER_SIZE).fill(this.HANDLE_COLOR),e.addChild(i);const r=t?this.HIT_AREA_SIZE*1.5:this.HIT_AREA_SIZE;return e.hitArea=new Mt(-r/2+this.LINE_THICKNESS,-r/2+this.LINE_THICKNESS,r,r),e}create_edge_handles(t,e,i){[-1,1].forEach((r,n)=>{const o=this.create_handle(!0);o.rotation=0,o.on("pointerdown",a=>{this.handle_pointer_down(a,o,-1,n)}),o.x=e/2-this.CORNER_SIZE*3/2,o.y=r<0?-this.LINE_THICKNESS:i,o.cursor="ns-resize",t.addChild(o)}),[-1,1].forEach((r,n)=>{const o=this.create_handle(!0);o.rotation=Math.PI/2,o.on("pointerdown",a=>{this.handle_pointer_down(a,o,-1,n+2)}),o.x=r<0?-this.LINE_THICKNESS:e,o.y=i/2-this.CORNER_SIZE*3/2,o.cursor="ew-resize",t.addChild(o)})}create_corner_handles(t,e,i){[{x:0,y:0,xScale:1,yScale:1,cursor:"nwse-resize"},{x:e,y:0,xScale:-1,yScale:1,cursor:"nesw-resize"},{x:0,y:i,xScale:1,yScale:-1,cursor:"nesw-resize"},{x:e,y:i,xScale:-1,yScale:-1,cursor:"nwse-resize"}].forEach(({x:n,y:o,xScale:a,yScale:h,cursor:l},c)=>{const u=this.create_handle(!1);u.x=n-(a<0?-this.LINE_THICKNESS:this.LINE_THICKNESS),u.y=o-(h<0?-this.LINE_THICKNESS:this.LINE_THICKNESS),u.scale.set(a,h),u.on("pointerdown",_=>{this.handle_pointer_down(_,u,c,-1)}),u.cursor=l,t.addChild(u)})}handle_pointer_down(t,e,i,r){if(this.current_subtool!=="crop")return;t.stopPropagation(),this.is_dragging=!0,this.selected_handle=e,this.active_corner_index=i,this.active_edge_index=r;const n=this.image_editor_context.image_container.toLocal(t.global);this.last_pointer_position=new dt(n.x,n.y)}update_crop_bounds(t){this.has_been_manually_changed=!0;const e=new dt(t.x,t.y),i={x:this.crop_bounds.x,y:this.crop_bounds.y,width:this.crop_bounds.width,height:this.crop_bounds.height};if(this.active_corner_index!==-1)switch(this.active_corner_index){case 0:const r=Math.max(20,i.width-e.x),n=i.width-r;this.crop_bounds.width=r,this.crop_bounds.x=i.x+n;const o=Math.max(20,i.height-e.y),a=i.height-o;this.crop_bounds.height=o,this.crop_bounds.y=i.y+a;break;case 1:this.crop_bounds.width=Math.max(20,i.width+e.x);const h=Math.max(20,i.height-e.y),l=i.height-h;this.crop_bounds.height=h,this.crop_bounds.y=i.y+l;break;case 2:const c=Math.max(20,i.width-e.x),u=i.width-c;this.crop_bounds.width=c,this.crop_bounds.x=i.x+u,this.crop_bounds.height=Math.max(20,i.height+e.y);break;case 3:this.crop_bounds.width=Math.max(20,i.width+e.x),this.crop_bounds.height=Math.max(20,i.height+e.y);break}else if(this.active_edge_index!==-1)switch(this.active_edge_index){case 0:const r=Math.max(20,i.height-e.y),n=i.height-r;this.crop_bounds.height=r,this.crop_bounds.y=i.y+n;break;case 1:this.crop_bounds.height=Math.max(20,i.height+e.y);break;case 2:const o=Math.max(20,i.width-e.x),a=i.width-o;this.crop_bounds.width=o,this.crop_bounds.x=i.x+a;break;case 3:this.crop_bounds.width=Math.max(20,i.width+e.x);break}this.constrain_crop_bounds(),this.update_crop_ui(),this.update_crop_mask(),this.crop_mask&&this.image_editor_context.background_image&&this.image_editor_context.background_image.setMask(this.crop_mask)}constrain_crop_bounds(){this.crop_bounds.x,this.crop_bounds.y,this.crop_bounds.width,this.crop_bounds.height,this.crop_bounds.width=Math.max(20,Math.min(this.crop_bounds.width,this.dimensions.width)),this.crop_bounds.height=Math.max(20,Math.min(this.crop_bounds.height,this.dimensions.height));const t=this.crop_bounds.x;if(this.crop_bounds.x=Math.max(0,Math.min(this.crop_bounds.x,this.dimensions.width-this.crop_bounds.width)),this.crop_bounds.x!==t&&this.active_corner_index===0||this.active_edge_index===2){const i=this.crop_bounds.x-t;this.crop_bounds.width-=i}const e=this.crop_bounds.y;if(this.crop_bounds.y=Math.max(0,Math.min(this.crop_bounds.y,this.dimensions.height-this.crop_bounds.height)),this.crop_bounds.y!==e&&(this.active_corner_index===0||this.active_corner_index===1||this.active_edge_index===0)){const i=this.crop_bounds.y-e;this.crop_bounds.height-=i}this.crop_bounds.width=Math.max(20,Math.min(this.crop_bounds.width,this.dimensions.width-this.crop_bounds.x)),this.crop_bounds.height=Math.max(20,Math.min(this.crop_bounds.height,this.dimensions.height-this.crop_bounds.y))}update_crop_mask(){if(!this.crop_mask)return;this.crop_mask.clear();const{width:t,height:e}=this.image_editor_context.background_image?.getLocalBounds()??{width:0,height:0};this.crop_mask.rect(0,0,t,e).fill({color:0,alpha:.4}).rect(this.crop_bounds.x,this.crop_bounds.y,this.crop_bounds.width,this.crop_bounds.height).cut(),this.image_editor_context.background_image&&(this.image_editor_context.background_image.mask=null),this.image_editor_context.image_container.mask===this.crop_mask&&(this.image_editor_context.image_container.mask=null)}update_crop_ui(){if(!this.crop_mask||!this.crop_ui_container)return;this.crop_ui_container.position.set(this.position.x+this.crop_bounds.x*this.scale,this.position.y+this.crop_bounds.y*this.scale);const t=this.crop_bounds.width*this.scale,e=this.crop_bounds.height*this.scale,i=this.crop_ui_container.getChildAt(0);i.clear().rect(0,0,t,e).stroke({width:1,color:0,alignment:0,alpha:.5}),i.hitArea=new Mt(0,0,t,e),this.update_handle_positions(t,e)}update_handle_positions(t,e){if(!this.crop_ui_container)return;const i=this.crop_ui_container.children.slice(1),r=i.slice(0,4),n=[{x:0,y:0},{x:t,y:0},{x:0,y:e},{x:t,y:e}];r.forEach((a,h)=>{const l=h%2===0?1:-1,c=h<2?1:-1;a.position.set(n[h].x-(l<0?-this.LINE_THICKNESS:this.LINE_THICKNESS),n[h].y-(c<0?-this.LINE_THICKNESS:this.LINE_THICKNESS))}),i.slice(4).forEach((a,h)=>{h<2?a.position.set(t/2-this.CORNER_SIZE*1.5/2,h===0?-this.LINE_THICKNESS:e):a.position.set(h===2?0:t+this.LINE_THICKNESS,e/2-this.CORNER_SIZE*1.5/2)})}setup_event_listeners(){const t=this.image_editor_context.app.stage;t.eventMode="static",t.on("pointermove",this.handle_pointer_move.bind(this)),t.on("pointerup",this.handle_pointer_up.bind(this)),t.on("pointerupoutside",this.handle_pointer_up.bind(this))}cleanup_event_listeners(){const t=this.image_editor_context.app.stage;t.off("pointermove",this.handle_pointer_move.bind(this)),t.off("pointerup",this.handle_pointer_up.bind(this)),t.off("pointerupoutside",this.handle_pointer_up.bind(this))}handle_pointer_move(t){if(this.current_subtool==="crop"){if(this.is_dragging_window&&this.drag_start_position&&this.drag_start_bounds){const e=this.image_editor_context.image_container.toLocal(t.global),i=new dt(e.x-this.drag_start_position.x,e.y-this.drag_start_position.y);this.crop_bounds={x:this.drag_start_bounds.x+i.x,y:this.drag_start_bounds.y+i.y,width:this.drag_start_bounds.width,height:this.drag_start_bounds.height},this.constrain_crop_bounds(),this.update_crop_mask(),this.crop_mask&&this.image_editor_context.background_image&&this.image_editor_context.background_image.setMask(this.crop_mask);return}if(this.is_dragging&&this.selected_handle&&this.last_pointer_position){const e=this.image_editor_context.image_container.toLocal(t.global),i=new dt(e.x,e.y),r=new dt(i.x-this.last_pointer_position.x,i.y-this.last_pointer_position.y);this.update_crop_bounds(r),this.last_pointer_position=i,this.update_crop_mask()}}}handle_pointer_up(){this.current_subtool==="crop"&&(this.is_dragging=!1,this.is_dragging_window=!1,this.selected_handle=null,this.last_pointer_position=null,this.drag_start_position=null,this.drag_start_bounds=null,this.active_corner_index=-1,this.active_edge_index=-1,this.notify("change"))}handle_window_drag_start(t){if(this.current_subtool!=="crop")return;t.stopPropagation(),this.is_dragging_window=!0,this.has_been_manually_changed=!0;const e=this.image_editor_context.image_container.toLocal(t.global);this.drag_start_position=new dt(e.x,e.y),this.drag_start_bounds={...this.crop_bounds}}get crop_manually_changed(){return this.has_been_manually_changed}on(t,e){this.event_callbacks.set(t,[...this.event_callbacks.get(t)||[],e])}off(t,e){this.event_callbacks.set(t,this.event_callbacks.get(t)?.filter(i=>i!==e)||[])}notify(t){for(const e of this.event_callbacks.get(t)||[])e()}get_crop_bounds(){const{width:t,height:e}=this.image_editor_context.background_image?.getLocalBounds()??{width:0,height:0};return{x:this.crop_bounds.x,y:this.crop_bounds.y,crop_dimensions:{width:this.crop_bounds.width,height:this.crop_bounds.height},image_dimensions:{width:t,height:e}}}get_image(){if(!this.image_editor_context.background_image)return Promise.resolve(null);const t=new lt,e=new kt(this.image_editor_context.background_image.texture);return t.addChild(e),fs(this.image_editor_context.app.renderer,t,this.crop_bounds)}}class gp{constructor(t,e,i,r){this.context=t,this.name="Resize",this.original_width=e.width,this.original_height=e.height,this.original_x=e.x,this.original_y=e.y,this.new_width=i.width,this.new_height=i.height,this.new_x=i.x,this.new_y=i.y,this.reset_ui=r}original_width;original_height;original_x;original_y;new_width;new_height;new_x;new_y;reset_ui;name;async execute(t){t&&(this.context=t),this.context.background_image&&(this.context.background_image.width=this.new_width,this.context.background_image.height=this.new_height,this.context.background_image.position.set(this.new_x,this.new_y),this.reset_ui())}async undo(){this.context.background_image&&(this.context.background_image.width=this.original_width,this.context.background_image.height=this.original_height,this.context.background_image.position.set(this.original_x,this.original_y),this.reset_ui())}}class mp{name="resize";image_editor_context;current_tool="image";current_subtool="size";current_cursor="unset";CORNER_SIZE=25;LINE_THICKNESS=5;HANDLE_COLOR=0;HIT_AREA_SIZE=40;borderRegion=0;is_dragging=!1;selected_handle=null;active_corner_index=-1;active_edge_index=-1;last_pointer_position=null;resize_ui_container=null;dimensions={width:0,height:0};position={x:0,y:0};scale=1;is_moving=!1;dom_mousedown_handler=null;dom_mousemove_handler=null;dom_mouseup_handler=null;event_callbacks=new Map;last_scale=1;original_state=null;async setup(t,e,i){if(this.image_editor_context=t,this.current_tool=e,this.current_subtool=i,t.background_image)if(t.background_image.borderRegion!==void 0)this.borderRegion=t.background_image.borderRegion;else{const r=t.background_image,n=t.image_container,o=Math.abs(r.position.x-(n.width-r.width)/2)<2,a=Math.abs(r.position.y-(n.height-r.height)/2)<2;(!o||!a)&&(this.borderRegion=Math.max(r.position.x,r.position.y),t.background_image.borderRegion=this.borderRegion)}if(t.dimensions.subscribe(r=>{this.dimensions=r,this.resize_ui_container&&this.update_resize_ui()}),t.position.subscribe(r=>{this.position=r,this.resize_ui_container&&this.current_tool==="image"&&this.current_subtool==="size"&&this.update_resize_ui()}),t.scale.subscribe(r=>{this.scale=r,this.resize_ui_container&&this.current_tool==="image"&&this.current_subtool==="size"&&this.update_resize_ui()}),await this.init_resize_ui(),this.setup_event_listeners(),this.current_subtool==="size"&&this.image_editor_context.background_image){const r=this.image_editor_context.background_image,n=this.image_editor_context.image_container,o=r.width,a=r.height,h=n.getLocalBounds(),l=h.width,c=h.height,u=-(o-l),_=-(a-c),d=0,f=0,g=o>l&&(r.position.xd),p=a>c&&(r.position.y<_||r.position.y>f);(g||p)&&this.apply_boundary_constraints()}}cleanup(){this.resize_ui_container&&this.image_editor_context.app.stage.removeChild(this.resize_ui_container),this.cleanup_event_listeners()}set_tool(t,e){if(this.current_tool=t,this.current_subtool=e,t==="image"&&e==="size"){if(this.image_editor_context.background_image){const i=this.image_editor_context.background_image.borderRegion;typeof i=="number"&&i>0&&(this.borderRegion=i)}if(this.show_resize_ui(),this.image_editor_context.background_image){const i=this.image_editor_context.background_image,r=this.image_editor_context.image_container,n=i.width,o=i.height,a=r.getLocalBounds(),h=a.width,l=a.height,c=h-this.borderRegion*2,u=l-this.borderRegion*2,_=n>c?-(n-c)+this.borderRegion:this.borderRegion,d=n>c?this.borderRegion:h-n-this.borderRegion,f=o>u?-(o-u)+this.borderRegion:this.borderRegion,g=o>u?this.borderRegion:l-o-this.borderRegion,p=i.position.x<_||i.position.x>d,y=i.position.yg;(p||y)&&this.apply_boundary_constraints()}}else this.hide_resize_ui()}async init_resize_ui(){this.resize_ui_container=this.make_resize_ui(this.dimensions.width*this.scale,this.dimensions.height*this.scale),this.resize_ui_container.position.set(this.position.x,this.position.y),this.resize_ui_container.visible=!1,this.image_editor_context.app.stage.addChild(this.resize_ui_container)}make_resize_ui(t,e){const i=new lt;i.eventMode="static",i.interactiveChildren=!0;const r=new Dt().rect(0,0,t,e).stroke({width:1,color:0,alignment:0,alpha:.3}),n=new Dt;n.rect(0,0,t,e).stroke({width:1,color:0,alpha:.7,pixelLine:!0});const o=5,h=o+5;for(let c=0;c{const o=this.create_handle(!0);o.rotation=0,o.on("pointerdown",a=>{this.handle_pointer_down(a,o,-1,n)}),o.x=e/2,o.y=r<0?0:i,o.cursor="ns-resize",t.addChild(o)}),[-1,1].forEach((r,n)=>{const o=this.create_handle(!0);o.rotation=0,o.on("pointerdown",a=>{this.handle_pointer_down(a,o,-1,n+2)}),o.x=r<0?0:e,o.y=i/2,o.cursor="ew-resize",t.addChild(o)})}create_corner_handles(t,e,i){[{x:0,y:0,cursor:"nwse-resize"},{x:e,y:0,cursor:"nesw-resize"},{x:0,y:i,cursor:"nesw-resize"},{x:e,y:i,cursor:"nwse-resize"}].forEach(({x:n,y:o,cursor:a},h)=>{const l=this.create_handle(!1);l.x=n,l.y=o,l.on("pointerdown",c=>{this.handle_pointer_down(c,l,h,-1)}),l.cursor=a,t.addChild(l)})}handle_pointer_down(t,e,i,r){if(this.current_subtool!=="size")return;t.stopPropagation(),this.is_dragging=!0,this.selected_handle=e,this.active_corner_index=i,this.active_edge_index=r;const n=this.image_editor_context.image_container.toLocal(t.global);if(this.last_pointer_position=new dt(n.x,n.y),this.image_editor_context.background_image){const o=this.image_editor_context.background_image;this.original_state={width:o.width,height:o.height,x:o.position.x,y:o.position.y}}}maintain_aspect_ratio(t,e,i,r){const n=Math.abs(r.x),o=Math.abs(r.y);return n>o*1.2?e=t/i:o>n*1.2?t=e*i:t/i>e?e=t/i:t=e*i,{width:t,height:e}}limit_dimensions(t,e,i){const r=this.dimensions.width,n=this.dimensions.height;let o=t,a=e;return o>r&&(i&&this.active_corner_index!==-1&&(a=r/o*a),o=r),a>n&&(i&&this.active_corner_index!==-1&&(o=n/a*o),a=n),o=Math.max(20,o),a=Math.max(20,a),{width:o,height:a}}calculate_position_deltas(t,e,i,r){let n=0,o=0;return this.active_corner_index===0||this.active_edge_index===2?n=t-i:this.active_corner_index===2&&(n=t-i,o=0),(this.active_corner_index===0||this.active_corner_index===1||this.active_edge_index===0)&&(o=e-r),{x:n,y:o}}apply_boundary_constraints(){if(!this.image_editor_context.background_image)return;const t=this.image_editor_context.background_image,e=this.image_editor_context.image_container;let i=t.position.x,r=t.position.y;const n=e.width,o=e.height,a=t.width,h=t.height,l=n-this.borderRegion*2,c=o-this.borderRegion*2;if(a>l){const u=-(a-l)+this.borderRegion,_=this.borderRegion;i=Math.max(u,Math.min(_,i))}else{const u=this.borderRegion,_=n-a-this.borderRegion;(i_)&&(i=Math.max(u,Math.min(_,i)))}if(h>c){const u=-(h-c)+this.borderRegion,_=this.borderRegion;r=Math.max(u,Math.min(_,r))}else{const u=this.borderRegion,_=o-h-this.borderRegion;(r_)&&(r=Math.max(u,Math.min(_,r)))}if(t.position.set(i,r),this.resize_ui_container){const u=e.position.x+i*this.scale,_=e.position.y+r*this.scale;this.resize_ui_container.position.set(u,_)}}update_resize_bounds(t,e=!1){const i=this.image_editor_context.background_image;if(!i)return;const r=i.width,n=i.height,o=i.position.x,a=i.position.y,h=r/n;let l;if(this.active_corner_index!==-1){switch(this.active_corner_index){case 0:l=new dt(o-t.x,a-t.y);break;case 1:l=new dt(o+r+t.x,a-t.y);break;case 2:l=new dt(o-t.x,a+n+t.y);break;case 3:l=new dt(o+r+t.x,a+n+t.y);break;default:return}const c=this.handle_direct_corner_resize(l,r,n,o,a,h,e);i.width=c.width,i.height=c.height,i.position.set(c.x,c.y)}else if(this.active_edge_index!==-1){switch(this.active_edge_index){case 0:l=new dt(o+r/2,a-t.y);break;case 1:l=new dt(o+r/2,a+n+t.y);break;case 2:l=new dt(o-t.x,a+n/2);break;case 3:l=new dt(o+r+t.x,a+n/2);break;default:return}const c=this.handle_direct_edge_resize(l,r,n,o,a);i.width=c.width,i.height=c.height,i.position.set(c.x,c.y)}this.update_resize_ui()}update_resize_ui(){if(!this.resize_ui_container||!this.image_editor_context.background_image||!this.image_editor_context.background_image.position)return;const t=this.image_editor_context.background_image,i=this.image_editor_context.image_container.getGlobalPosition(),r=t.position.x*this.scale,n=t.position.y*this.scale;this.resize_ui_container.position.set(i.x+r,i.y+n);const o=t.width*this.scale,a=t.height*this.scale;this.resize_ui_container.getChildAt(0).clear().rect(0,0,o,a).stroke({width:1,color:0,alignment:0,alpha:.3});const l=this.resize_ui_container.getChildAt(1);if(l.clear(),l.rect(0,0,o,a).stroke({width:1,color:0,alpha:.7,pixelLine:!0}),!this.is_dragging&&!this.is_moving&&Math.abs(this.scale-this.last_scale)<.001){for(let f=0;f{h.position.set(o[l].x,o[l].y)}),i.slice(4).forEach((h,l)=>{l<2?h.position.set(t/2,l===0?0:e):h.position.set(l===2?0:t,e/2)})}setup_event_listeners(){const t=this.image_editor_context.app.stage;t.eventMode="static",t.on("pointermove",this.handle_pointer_move.bind(this)),t.on("pointerup",this.handle_pointer_up.bind(this)),t.on("pointerupoutside",this.handle_pointer_up.bind(this)),this.setup_dom_event_listeners()}setup_dom_event_listeners(){this.cleanup_dom_event_listeners();const t=this.image_editor_context.app.canvas;this.dom_mousedown_handler=e=>{if(this.current_subtool!=="size"||this.is_dragging||this.selected_handle||!this.image_editor_context.background_image)return;const i=this.image_editor_context.background_image,n=this.image_editor_context.image_container.getBounds(),o=t.getBoundingClientRect(),a=e.clientX-o.left,h=e.clientY-o.top,l=(a-n.x)/this.scale,c=(h-n.y)/this.scale;l>=i.position.x&&l<=i.position.x+i.width&&c>=i.position.y&&c<=i.position.y+i.height&&(this.is_moving=!0,this.last_pointer_position=new dt(l,c),this.original_state={width:i.width,height:i.height,x:i.position.x,y:i.position.y},e.preventDefault(),e.stopPropagation())},this.dom_mousemove_handler=e=>{if(this.current_subtool!=="size"||!this.is_moving||!this.last_pointer_position||!this.image_editor_context.background_image)return;const r=this.image_editor_context.image_container.getBounds(),n=t.getBoundingClientRect(),o=e.clientX-n.left,a=e.clientY-n.top,h=(o-r.x)/this.scale,l=(a-r.y)/this.scale,c=new dt(h,l);this.handle_image_dragging(c),this.last_pointer_position=c,e.preventDefault(),e.stopPropagation()},this.dom_mouseup_handler=e=>{if(this.current_subtool==="size"){if(this.original_state&&this.image_editor_context.background_image){const i=this.image_editor_context.background_image,r={width:i.width,height:i.height,x:i.position.x,y:i.position.y};if(this.original_state.width!==r.width||this.original_state.height!==r.height||this.original_state.x!==r.x||this.original_state.y!==r.y){const n=new gp(this.image_editor_context,this.original_state,r,this.update_resize_ui.bind(this));this.image_editor_context.execute_command(n)}this.original_state=null}this.is_moving=!1,this.last_pointer_position=null,this.update_resize_ui(),e.preventDefault(),e.stopPropagation()}},t.addEventListener("mousedown",this.dom_mousedown_handler),window.addEventListener("mousemove",this.dom_mousemove_handler),window.addEventListener("mouseup",this.dom_mouseup_handler)}cleanup_dom_event_listeners(){const t=this.image_editor_context.app.canvas;this.dom_mousedown_handler&&(t.removeEventListener("mousedown",this.dom_mousedown_handler),this.dom_mousedown_handler=null),this.dom_mousemove_handler&&(window.removeEventListener("mousemove",this.dom_mousemove_handler),this.dom_mousemove_handler=null),this.dom_mouseup_handler&&(window.removeEventListener("mouseup",this.dom_mouseup_handler),this.dom_mouseup_handler=null)}cleanup_event_listeners(){const t=this.image_editor_context.app.stage;t.off("pointermove",this.handle_pointer_move.bind(this)),t.off("pointerup",this.handle_pointer_up.bind(this)),t.off("pointerupoutside",this.handle_pointer_up.bind(this)),this.cleanup_dom_event_listeners()}handle_pointer_move(t){if(this.current_subtool!=="size")return;const e=this.image_editor_context.image_container.toLocal(t.global),i=new dt(e.x,e.y);if(this.is_moving&&this.last_pointer_position)this.handle_image_dragging(i),this.last_pointer_position=i;else if(this.is_dragging&&this.selected_handle){if(!this.image_editor_context.background_image)return;const r=this.image_editor_context.background_image,n=this.active_corner_index!==-1&&!t.shiftKey,o=r.width,a=r.height,h=r.position.x,l=r.position.y,c=o/a;let u;if(this.active_corner_index!==-1)u=this.handle_direct_corner_resize(i,o,a,h,l,c,n);else if(this.active_edge_index!==-1)u=this.handle_direct_edge_resize(i,o,a,h,l);else return;u=this.limit_dimensions_to_container(u,h,l,o,a,n),r.width=u.width,r.height=u.height,r.position.set(u.x,u.y),this.update_resize_ui(),this.last_pointer_position=i}}handle_pointer_up(){this.current_subtool==="size"&&(this.is_dragging=!1,this.is_moving=!1,this.selected_handle=null,this.last_pointer_position=null,this.active_corner_index=-1,this.active_edge_index=-1,this.update_resize_ui(),this.notify("change"))}handle_image_dragging(t){if(!this.last_pointer_position||!this.image_editor_context.background_image)return;const e=this.image_editor_context.background_image,i=this.image_editor_context.image_container.getLocalBounds(),r=t.x-this.last_pointer_position.x,n=t.y-this.last_pointer_position.y;let o=e.position.x+r,a=e.position.y+n;const h=i.width,l=i.height,c=e.width,u=e.height,_=h-this.borderRegion*2,d=l-this.borderRegion*2;if(c>_){const f=-(c-_)+this.borderRegion,g=this.borderRegion;o=Math.max(f,Math.min(g,o))}else{const f=this.borderRegion,g=h-c-this.borderRegion;o=Math.max(f,Math.min(g,o))}if(u>d){const f=-(u-d)+this.borderRegion,g=this.borderRegion;a=Math.max(f,Math.min(g,a))}else{const f=this.borderRegion,g=l-u-this.borderRegion;a=Math.max(f,Math.min(g,a))}e.position.set(o,a),this.update_resize_ui()}handle_direct_corner_resize(t,e,i,r,n,o,a){let h=0,l=0,c=r,u=n;switch(this.active_corner_index){case 0:h=r+e-t.x,l=n+i-t.y;break;case 1:h=t.x-r,l=n+i-t.y;break;case 2:h=r+e-t.x,l=t.y-n;break;case 3:h=t.x-r,l=t.y-n;break}h=Math.max(20,h),l=Math.max(20,l);let _=h,d=l;if(a){const f={x:t.x-(r+e/2),y:t.y-(n+i/2)},g=Math.abs(Math.atan2(f.y,f.x));g3*Math.PI/4?d=_/o:_=d*o}switch(this.active_corner_index){case 0:c=r+e-_,u=n+i-d;break;case 1:u=n+i-d;break;case 2:c=r+e-_;break}return{width:_,height:d,x:c,y:u}}handle_direct_edge_resize(t,e,i,r,n){let o=e,a=i,h=r,l=n;switch(this.active_edge_index){case 0:a=Math.max(20,n+i-t.y),l=t.y;break;case 1:a=Math.max(20,t.y-n);break;case 2:o=Math.max(20,r+e-t.x),h=t.x;break;case 3:o=Math.max(20,t.x-r);break}return{width:o,height:a,x:h,y:l}}limit_dimensions_to_container(t,e,i,r,n,o){let{width:a,height:h,x:l,y:c}=t;const u=this.dimensions.width-this.borderRegion*2,_=this.dimensions.height-this.borderRegion*2,d=a,f=h,g=this.apply_size_limits(a,h,u,_,o,d/f);a=g.width,h=g.height;const p=this.adjust_position_for_resizing(a,h,e,i,r,n);return l=p.x,c=p.y,this.apply_border_constraints(a,h,l,c,o,d/f)}apply_size_limits(t,e,i,r,n,o){let a=t,h=e;const l=a>i,c=h>r;if(l&&c){const u=i/a,_=r/h;u<_?(a=i,n&&(h=a/o)):(h=r,n&&(a=h*o))}else l?(a=i,n&&(h=a/o)):c&&(h=r,n&&(a=h*o));return{width:a,height:h}}adjust_position_for_resizing(t,e,i,r,n,o){let a=i,h=r;switch(this.active_corner_index){case 0:a=i+n-t,h=r+o-e;break;case 1:h=r+o-e;break;case 2:a=i+n-t;break}if(this.active_edge_index!==-1)switch(this.active_edge_index){case 0:h=r+o-e;break;case 2:a=i+n-t;break}return{x:a,y:h}}apply_border_constraints(t,e,i,r,n,o){const a=this.apply_top_left_constraints(t,e,i,r,n,o),h=this.apply_bottom_right_constraints(a.width,a.height,a.x,a.y,n,o);return h.width=Math.max(20,h.width),h.height=Math.max(20,h.height),h}apply_top_left_constraints(t,e,i,r,n,o){let a=t,h=e,l=i,c=r;return lthis.dimensions.width-this.borderRegion)if(this.active_corner_index===1||this.active_corner_index===3||this.active_edge_index===3)a=this.dimensions.width-this.borderRegion-l,n&&(h=a/o);else{const _=l+a-(this.dimensions.width-this.borderRegion);l=Math.max(this.borderRegion,l-_)}if(c+h>this.dimensions.height-this.borderRegion)if(this.active_corner_index===2||this.active_corner_index===3||this.active_edge_index===1)h=this.dimensions.height-this.borderRegion-c,n&&(a=h*o);else{const _=c+h-(this.dimensions.height-this.borderRegion);c=Math.max(this.borderRegion,c-_)}return{width:a,height:h,x:l,y:c}}show_resize_ui(){if(this.resize_ui_container&&(this.resize_ui_container.visible=!0,this.update_resize_ui()),this.image_editor_context.background_image){const t=this.image_editor_context.background_image;this.current_cursor=t.cursor,t.cursor="move"}this.setup_dom_event_listeners()}hide_resize_ui(){if(this.resize_ui_container&&(this.resize_ui_container.visible=!1),this.image_editor_context.background_image){const t=this.image_editor_context.background_image;t.cursor=this.current_cursor}this.cleanup_dom_event_listeners()}on(t,e){this.event_callbacks.set(t,[...this.event_callbacks.get(t)||[],e])}off(t,e){this.event_callbacks.set(t,this.event_callbacks.get(t)?.filter(i=>i!==e)||[])}notify(t){for(const e of this.event_callbacks.get(t)||[])e()}set_border_region(t){this.borderRegion=t,this.image_editor_context?.background_image&&(this.image_editor_context.background_image.borderRegion=t),this.resize_ui_container&&this.update_resize_ui(),this.current_subtool==="size"&&this.image_editor_context?.background_image&&this.apply_boundary_constraints()}}function yp(s,t){(s instanceof lt||"cursor"in s)&&(s.cursor=t)}function wh(s,t){for(const e of s)yp(e,t),e instanceof lt&&e.children.length>0&&wh(e.children,t)}function xp(s){return s!==null&&window.clearTimeout(s),null}class bp{constructor(t,e,i){this.image_editor_context=t,this.state=e,this.scale=i,this.initialize_cursor(),this.initialize_brush_preview()}cursor_graphics=null;cursor_container=null;brush_preview_container=null;brush_preview_graphics=null;is_preview_visible=!1;is_cursor_over_image=!1;cursor_position_check_timeout=null;is_brush_or_erase_active=!1;_bound_update_cursor=null;_bound_check_cursor_over_image=null;is_over_image(){return this.is_cursor_over_image}setup_event_listeners(){this.cleanup_event_listeners(),this._bound_update_cursor=this.update_cursor_position.bind(this),this._bound_check_cursor_over_image=this.check_cursor_over_image.bind(this);const t=this.image_editor_context.app.stage;t.on("pointermove",this._bound_update_cursor),t.on("pointermove",this._bound_check_cursor_over_image),this.image_editor_context.image_container.on("pointerenter",this.on_image_container_pointer_enter.bind(this)),this.image_editor_context.image_container.on("pointerleave",this.on_image_container_pointer_leave.bind(this))}cleanup_event_listeners(){const t=this.image_editor_context.app.stage;this._bound_update_cursor&&(t.off("pointermove",this._bound_update_cursor),this._bound_update_cursor=null),this._bound_check_cursor_over_image&&(t.off("pointermove",this._bound_check_cursor_over_image),this._bound_check_cursor_over_image=null),this.image_editor_context.image_container.off("pointerenter"),this.image_editor_context.image_container.off("pointerleave"),this.cursor_position_check_timeout=xp(this.cursor_position_check_timeout)}initialize_cursor(){this.cursor_container&&(this.cursor_container.parent&&this.cursor_container.parent.removeChild(this.cursor_container),this.cursor_container.destroy({children:!0}),this.cursor_container=null),this.cursor_container=new lt,this.image_editor_context.ui_container.addChild(this.cursor_container),this.cursor_graphics=new Dt,this.cursor_container.addChild(this.cursor_graphics),this.update_cursor_appearance()}update_cursor_appearance(){if(!this.cursor_graphics)return;this.cursor_graphics.clear();const t=this.state.mode==="draw"?he(this.state.color).toString():16777215;this.cursor_graphics.circle(0,0,this.state.brush_size*this.scale).stroke({width:1.5,color:t,alpha:.8}),this.cursor_graphics.circle(0,0,1).fill({color:t,alpha:.8})}update_cursor_position(t){if(!this.cursor_container)return;const e=this.image_editor_context.image_container.toLocal(t.global),i=this.image_editor_context.ui_container.toLocal(this.image_editor_context.image_container.toGlobal(e));this.cursor_container.position.set(i.x,i.y)}check_cursor_over_image(t){this.cursor_position_check_timeout!==null&&(window.clearTimeout(this.cursor_position_check_timeout),this.cursor_position_check_timeout=null);const i=this.image_editor_context.image_container.getBounds(),r=this.is_cursor_over_image;this.is_cursor_over_image=t.global.x>=i.x&&t.global.x<=i.x+i.width&&t.global.y>=i.y&&t.global.y<=i.y+i.height,r!==this.is_cursor_over_image&&this.update_cursor_and_preview_visibility()}update_cursor_size(){this.update_cursor_appearance()}set_active(t){this.is_brush_or_erase_active=t,this.update_cursor_and_preview_visibility()}update_cursor_visibility(){this.cursor_container&&(this.cursor_container.visible=this.is_cursor_over_image&&this.is_brush_or_erase_active)}preview_brush(t){this.is_preview_visible=t,this.brush_preview_container&&(this.brush_preview_container.visible=t&&this.is_brush_or_erase_active),t&&(this.update_brush_preview(),this.update_brush_preview_position())}initialize_brush_preview(){this.brush_preview_container&&(this.brush_preview_container.parent&&this.brush_preview_container.parent.removeChild(this.brush_preview_container),this.brush_preview_container.destroy({children:!0}),this.brush_preview_container=null),this.brush_preview_container=new lt,this.image_editor_context.ui_container.addChild(this.brush_preview_container),this.brush_preview_graphics=new Dt,this.brush_preview_container.addChild(this.brush_preview_graphics),this.brush_preview_container.visible=!1}update_brush_preview(){if(!this.brush_preview_graphics)return;this.brush_preview_graphics.clear();const t=this.state.brush_size*this.scale,e=this.state.mode==="draw"?he(this.state.color).setAlpha(this.state.opacity).toString():16777215;this.brush_preview_graphics.circle(0,0,t).fill({color:e,alpha:this.state.mode==="draw"?this.state.opacity:.3}),this.brush_preview_graphics.circle(0,0,t+1).stroke({width:1,color:0,alpha:.5})}update_brush_preview_position(){if(!this.brush_preview_container)return;const t=this.image_editor_context.image_container,e=t.width/2,i=t.height/2,r=t.toGlobal({x:e,y:i}),n=this.image_editor_context.ui_container.toLocal(r);this.brush_preview_container.position.set(n.x,n.y)}on_image_container_pointer_enter(){this.is_cursor_over_image=!0,this.update_cursor_and_preview_visibility()}on_image_container_pointer_leave(){this.is_cursor_over_image=!1,this.update_cursor_and_preview_visibility()}update_cursor_and_preview_visibility(){this.update_cursor_visibility(),this.brush_preview_container&&(this.brush_preview_container.visible=this.is_preview_visible&&this.is_brush_or_erase_active)}cleanup(){this.is_brush_or_erase_active=!1,this.cursor_container&&(this.cursor_container.parent&&this.cursor_container.parent.removeChild(this.cursor_container),this.cursor_container.destroy({children:!0}),this.cursor_container=null),this.brush_preview_container&&(this.brush_preview_container.parent&&this.brush_preview_container.parent.removeChild(this.brush_preview_container),this.brush_preview_container.destroy({children:!0}),this.brush_preview_container=null),this.cursor_position_check_timeout!==null&&(window.clearTimeout(this.cursor_position_check_timeout),this.cursor_position_check_timeout=null)}update_state(t,e){this.state=t,this.scale=e,this.update_cursor_appearance(),this.is_preview_visible&&this.update_brush_preview()}}class vp{stroke_data;context;original_texture=null;name;constructor(t,e,i){this.name="Draw",this.stroke_data=e,this.context=t,i&&(this.original_texture=this.create_texture_from(i))}create_texture_from(t){const e=Jt.create({width:t.width,height:t.height,resolution:window.devicePixelRatio||1}),i=new kt(t),r=new lt;return r.addChild(i),this.context.app.renderer.render(r,{renderTexture:e}),r.destroy({children:!0}),e}render_stroke_from_data(t,e){const i=t.segments.filter(n=>n.mode==="draw"),r=t.segments.filter(n=>n.mode==="erase");if(i.length>0){const n=new Dt,o=new lt;o.addChild(n);let a=1;for(const c of i){c.opacity0){const n=Jt.create({width:e.width,height:e.height,resolution:window.devicePixelRatio||1}),o=new kt(e),a=new lt;a.addChild(o),this.context.app.renderer.render({container:a,target:n,clear:!0});const h=new Dt,l=new lt;l.addChild(h),h.setFillStyle({color:16777215,alpha:1});for(const f of r)this.render_segment_to_graphics(h,f);const c=Jt.create({width:e.width,height:e.height,resolution:window.devicePixelRatio||1});this.context.app.renderer.render({container:l,target:c,clear:!0});const u=new kt(n),_=new kt(c),d=new lt;d.addChild(u),d.setMask({mask:_,inverse:!0}),this.context.app.renderer.render({container:d,target:e,clear:!0}),a.destroy({children:!0}),l.destroy({children:!0}),d.destroy({children:!0}),n.destroy(),c.destroy()}}render_segment_to_graphics(t,e){const i=Math.sqrt(Math.pow(e.to_x-e.from_x,2)+Math.pow(e.to_y-e.from_y,2));if(i<.1)t.circle(e.from_x,e.from_y,e.size).fill();else{const r=Math.max(e.size/3,2),n=Math.max(Math.ceil(i/r),2);for(let o=0;oa.container===t);if(!i)return;this.active_layer_id=i.id;const r=this.image_editor_context.layer_manager.get_layer_textures(i.id);if(!r)return;this.original_layer_texture&&this.original_layer_texture.destroy(),this.original_layer_texture=Jt.create({width:this.dimensions.width,height:this.dimensions.height,resolution:window.devicePixelRatio||1});const n=new kt(r.draw),o=new lt;o.addChild(n),this.app.renderer.render(o,{renderTexture:this.original_layer_texture}),o.destroy({children:!0}),this.is_new_stroke=!0}reset_eraser_mask(){!this.erase_graphics||!this.erase_texture||(this.erase_graphics.clear(),this.erase_graphics.setFillStyle({color:16777215,alpha:1}),this.erase_graphics.rect(0,0,this.dimensions.width,this.dimensions.height).fill(),this.erase_graphics.endFill(),this.app.renderer.render(this.erase_graphics,{renderTexture:this.erase_texture}))}commit_stroke(){if(!this.stroke_texture||!this.preview_sprite||!this.stroke_graphics||!this.original_layer_texture||!this.active_layer_id)return;this.preview_sprite.visible=!1;const t=this.image_editor_context.layer_manager.get_active_layer();if(!t)return;const i=this.image_editor_context.layer_manager.get_layers().find(h=>h.container===t);if(!i||i.id!==this.active_layer_id||!this.image_editor_context.layer_manager.get_layer_textures(i.id))return;const n={segments:[...this.current_stroke_segments],layer_id:this.active_layer_id},o=new vp(this.image_editor_context,n,this.original_layer_texture);this.stroke_graphics&&this.stroke_graphics.clear();const a=new lt;this.app.renderer.render(a,{renderTexture:this.stroke_texture}),a.destroy(),this.is_new_stroke=!0,this.original_layer_texture=null,this.active_layer_id=null,this.current_stroke_segments=[],this.image_editor_context.command_manager.execute(o,this.image_editor_context)}calculate_distance(t,e,i,r){return Math.sqrt(Math.pow(i-t,2)+Math.pow(r-e,2))}draw_segment(t,e,i,r,n,o,a,h){if(!this.stroke_graphics||!this.stroke_texture||!this.stroke_container||!this.preview_sprite)return;this.is_new_stroke&&!this.original_layer_texture&&this.preserve_canvas_state(),this.current_opacity=h==="draw"?Math.min(Math.max(a,0),1):.5;const l=n;if(this.is_new_stroke){this.stroke_graphics.clear(),this.current_stroke_segments=[];const u=new lt;this.app.renderer.render(u,{renderTexture:this.stroke_texture}),u.destroy(),this.is_new_stroke=!1}if(this.current_stroke_segments.push({from_x:t,from_y:e,to_x:i,to_y:r,size:l,color:o,opacity:this.current_opacity,mode:h}),h==="draw"){let u=16777215;try{o.startsWith("#")&&(u=parseInt(o.replace("#","0x"),16))}catch{u=16777215}this.stroke_graphics.setFillStyle({color:u,alpha:1})}else this.stroke_graphics.setFillStyle({color:16777215,alpha:1});const c=this.calculate_distance(t,e,i,r);if(c<.1)this.stroke_graphics.circle(t,e,l).fill();else{const u=Math.max(l/3,2),_=Math.max(Math.ceil(c/u),2);for(let d=0;d<_;d++){const f=d/(_-1),g=t+(i-t)*f,p=e+(r-e)*f;this.stroke_graphics.circle(g,p,l).fill()}}if(this.stroke_graphics.endFill(),this.app.renderer.render(this.stroke_container,{renderTexture:this.stroke_texture}),h==="draw")this.preview_sprite.texture=this.stroke_texture,this.preview_sprite.alpha=this.current_opacity,this.preview_sprite.tint=16777215;else{const u=this.image_editor_context.layer_manager.get_active_layer();if(!u)return;const d=this.image_editor_context.layer_manager.get_layers().find(C=>C.container===u);if(!d)return;const f=this.image_editor_context.layer_manager.get_layer_textures(d.id);if(!f)return;const g=Jt.create({width:this.dimensions.width,height:this.dimensions.height,resolution:window.devicePixelRatio||1}),p=new lt,y=new kt(f.draw);p.addChild(y),this.app.renderer.render(p,{renderTexture:g}),p.destroy({children:!0});const x=new lt,v=new kt(this.stroke_texture),b=new Dt;b.setFillStyle({color:16777215,alpha:.5}),b.rect(0,0,this.dimensions.width,this.dimensions.height).fill(),b.setMask({mask:v,inverse:!1}),x.addChild(b),this.app.renderer.render(x,{renderTexture:g}),this.preview_sprite.texture=g,this.preview_sprite.alpha=1,x.destroy({children:!0}),g.destroy()}this.preview_sprite.visible=!0}get_dimensions(){return this.dimensions}get textures_initialized(){return!!(this.stroke_texture&&this.display_container&&this.preview_sprite)}cleanup(){this.cleanup_textures()}}class kp{name="brush";image_editor_context;current_tool;current_subtool;state={opacity:1,brush_size:10,color:"#000000",mode:"draw"};brush_size=10;eraser_size=20;is_drawing=!1;last_x=0;last_y=0;scale=1;_bound_pointer_down=null;_bound_pointer_move=null;_bound_pointer_up=null;event_callbacks=new Map;brush_cursor=null;brush_textures=null;async setup(t,e,i){this.image_editor_context=t,this.current_tool=e,this.current_subtool=i,this.state.mode=e==="erase"?"erase":"draw",this.state.mode==="draw"?this.state.brush_size=this.brush_size:this.state.brush_size=this.eraser_size,t.scale.subscribe(r=>{this.scale=r,this.brush_cursor&&this.brush_cursor.update_state(this.state,this.scale)}),this.brush_cursor=new bp(this.image_editor_context,this.state,this.scale),this.brush_cursor.set_active(e==="draw"||e==="erase"),this.brush_textures=new wp(this.image_editor_context,t.app),this.brush_textures.initialize_textures(),this.setup_event_listeners(),this.handle_cursors(e)}handle_cursors(t){wh(this.image_editor_context.image_container.children,"none")}set_tool(t,e){if(this.current_tool=t,this.current_subtool=e,this.current_tool!=="erase"&&this.current_tool!=="draw"&&this.commit_pending_changes(),this.brush_cursor){const h=t==="draw"||t==="erase";this.brush_cursor.set_active(h)}const i=t==="erase"?"erase":"draw",r=this.state.mode!==i,n=t==="erase"||t==="draw",o=this.brush_textures?.textures_initialized??!1;let a=!1;if(this.brush_textures&&o){const h=this.image_editor_context.image_container.getLocalBounds(),l=this.brush_textures.get_dimensions();a=Math.round(h.width)!==Math.round(l.width)||Math.round(h.height)!==Math.round(l.height)}n&&(r||!o||a)&&this.brush_textures?.initialize_textures(),this.state.mode!==i&&(this.state.mode=i,this.state.mode==="draw"?this.state.brush_size=this.brush_size:this.state.brush_size=this.eraser_size,this.brush_cursor&&this.brush_cursor.update_state(this.state,this.scale))}commit_pending_changes(){this.is_drawing&&this.on_pointer_up()}on_pointer_down(t){if(!this.image_editor_context.layer_manager.get_active_layer()?.visible||this.current_tool!=="erase"&&this.current_tool!=="draw"||this.brush_cursor&&!this.brush_cursor.is_over_image())return;this.brush_textures&&this.brush_textures.preserve_canvas_state();const i=this.image_editor_context.image_container.toLocal(t.global);this.is_drawing=!0,this.last_x=i.x,this.last_y=i.y,this.brush_textures&&this.brush_textures.draw_segment(i.x,i.y,i.x,i.y,this.state.brush_size,this.state.color,this.state.opacity,this.state.mode)}on_pointer_move(t){if(this.brush_cursor&&this.brush_cursor.update_cursor_position(t),!this.is_drawing)return;const e=this.image_editor_context.image_container.toLocal(t.global);this.brush_textures&&this.brush_textures.draw_segment(this.last_x,this.last_y,e.x,e.y,this.state.brush_size,this.state.color,this.state.opacity,this.state.mode),this.last_x=e.x,this.last_y=e.y}on_pointer_up(){this.is_drawing&&(this.is_drawing=!1,this.brush_textures&&this.brush_textures.commit_stroke(),this.notify("change"))}setup_event_listeners(){this.cleanup_event_listeners(),this._bound_pointer_down=this.on_pointer_down.bind(this),this._bound_pointer_move=this.on_pointer_move.bind(this),this._bound_pointer_up=this.on_pointer_up.bind(this);const t=this.image_editor_context.image_container;t.eventMode="static",t.interactiveChildren=!0;const e=this.image_editor_context.app.stage;e.eventMode="static",e.on("pointerdown",this._bound_pointer_down),e.on("pointermove",this._bound_pointer_move),e.on("pointerup",this._bound_pointer_up),e.on("pointerupoutside",this._bound_pointer_up),this.brush_cursor&&this.brush_cursor.setup_event_listeners()}cleanup_event_listeners(){const t=this.image_editor_context.app.stage;this._bound_pointer_down&&(t.off("pointerdown",this._bound_pointer_down),this._bound_pointer_down=null),this._bound_pointer_move&&(t.off("pointermove",this._bound_pointer_move),this._bound_pointer_move=null),this._bound_pointer_up&&(t.off("pointerup",this._bound_pointer_up),t.off("pointerupoutside",this._bound_pointer_up),this._bound_pointer_up=null),this.brush_cursor&&this.brush_cursor.cleanup_event_listeners()}set_brush_size(t){this.brush_size=t,this.state.mode==="draw"&&(this.state.brush_size=t,this.brush_cursor&&this.brush_cursor.update_state(this.state,this.scale))}set_brush_color(t){const e=he(t).toHexString();this.state.color=e,this.brush_cursor&&this.brush_cursor.update_state(this.state,this.scale)}set_brush_opacity(t){const e=Math.max(0,Math.min(1,t));this.state.opacity=e,this.brush_cursor&&this.brush_cursor.update_state(this.state,this.scale)}set_eraser_size(t){this.eraser_size=t,this.state.mode==="erase"&&(this.state.brush_size=t,this.brush_cursor&&this.brush_cursor.update_state(this.state,this.scale))}get_current_size(){return this.state.mode==="draw"?this.brush_size:this.eraser_size}preview_brush(t){this.brush_cursor&&this.brush_cursor.preview_brush(t)}cleanup(){this.commit_pending_changes(),this.cleanup_event_listeners(),this.brush_textures&&(this.brush_textures.cleanup(),this.brush_textures=null),this.brush_cursor&&(this.brush_cursor.cleanup(),this.brush_cursor=null)}on(t,e){this.event_callbacks.set(t,[...this.event_callbacks.get(t)||[],e])}off(t,e){this.event_callbacks.set(t,this.event_callbacks.get(t)?.filter(i=>i!==e)||[])}notify(t){for(const e of this.event_callbacks.get(t)||[])e()}}var Ap=nt('
          '),Sp=nt('
        • '),Cp=nt('
        • '),Mp=nt('
          '),Tp=nt('
          ');function Pp(s,t){ce(t,!1);const e=()=>Lh(o(),"$layers",i),[i,r]=Bh(),n=Oe();let o=z(t,"layers",12),a=z(t,"enable_additional_layers",12,!0),h=z(t,"enable_layers",12,!0),l=z(t,"show_layers",12,!1);function c(){n("new_layer")}function u(v){n("change_layer",v),l(!1)}function _(v,b){n("move_layer",{id:v,direction:b})}function d(v){n("delete_layer",v)}var f={get layers(){return o()},set layers(v){o(v),I()},get enable_additional_layers(){return a()},set enable_additional_layers(v){a(v),I()},get enable_layers(){return h()},set enable_layers(v){h(v),I()},get show_layers(){return l()},set show_layers(v){l(v),I()}};ve();var g=ci(),p=qt(g);{var y=v=>{var b=Tp();let C;var w=it(b),k=it(w),R=q(k),S=it(R);gl(S),tt(R),tt(w);var P=q(w,2);{var F=G=>{var N=Mp(),B=it(N);Bi(B,1,()=>(e(),Rt(()=>e().layers)),Li,(D,gt,M)=>{let T=()=>m(gt).id,st=()=>m(gt).name,U=()=>m(gt).user_created,rt=()=>m(gt).visible;var xt=Sp(),K=it(xt);{var mt=et=>{ie(et,{get Icon(){return Al},size:"small",onclick:ct=>{ct.stopPropagation(),n("toggle_layer_visibility",T())}})},ot=et=>{ie(et,{get Icon(){return wl},size:"small",onclick:ct=>{ct.stopPropagation(),n("toggle_layer_visibility",T())}})};Q(K,et=>{rt()?et(ot,!1):et(mt)})}var ut=q(K,2);Ue(ut,"aria-label",`layer-${M+1}`);let O;var J=it(ut,!0);tt(ut);var Tt=q(ut,2);{var E=et=>{var ct=Ap(),at=it(ct);{var ft=Ft=>{ie(Ft,{onclick:vt=>{vt.stopPropagation(),_(T(),"up")},get Icon(){return Kh},size:"x-small"})};Q(at,Ft=>{M>0&&Ft(ft)})}var Et=q(at,2);{var Ut=Ft=>{ie(Ft,{onclick:vt=>{vt.stopPropagation(),_(T(),"down")},get Icon(){return rl},size:"x-small"})};Q(Et,Ft=>{e(),Rt(()=>M{ie(Ft,{onclick:vt=>{vt.stopPropagation(),d(T())},get Icon(){return Zh},size:"x-small"})};Q(bt,Ft=>{e(),U(),Rt(()=>e().layers.length>1&&U())&&Ft(Nt)})}tt(ct),H(et,ct)};Q(Tt,et=>{e(),Rt(()=>e().layers.length>1)&&et(E)})}tt(xt),Wt(()=>{O=re(ut,1,"svelte-189k4ah",null,O,{selected_layer:e().active_layer===T()}),Fe(J,st())}),jt("click",ut,gs(()=>u(T()))),H(D,xt)});var V=q(B,2);{var L=D=>{var gt=Cp(),M=it(gt);ie(M,{get Icon(){return Xo},label:"Add Layer",onclick:T=>{T.stopPropagation(),c()},size:"x-small"}),tt(gt),H(D,gt)};Q(V,D=>{a()&&D(L)})}tt(N),H(G,N)};Q(P,G=>{l()&&G(F)})}tt(b),As(b,(G,N)=>Kr?.(G,N),()=>()=>l(!1)),Wt(G=>{C=re(b,1,"layer-wrap svelte-189k4ah",null,C,{closed:!l()}),Fe(k,`${G??""} `)},[()=>(Y(l()),e(),Rt(()=>l()?"Layers":e().layers.find(G=>G.id===e().active_layer)?.name))]),jt("click",w,gs(()=>l(!l()))),H(v,b)};Q(p,v=>{h()&&v(y)})}H(s,g);var x=ue(f);return r(),x}var zp=nt('
          ');function Ip(s,t){ce(t,!1);let e=z(t,"layers",12),i=z(t,"enable_additional_layers",12,!0),r=z(t,"enable_layers",12,!0),n=z(t,"show_layers",12,!1);var o={get layers(){return e()},set layers(u){e(u),I()},get enable_additional_layers(){return i()},set enable_additional_layers(u){i(u),I()},get enable_layers(){return r()},set enable_layers(u){r(u),I()},get show_layers(){return n()},set show_layers(u){n(u),I()}},a=zp(),h=it(a),l=it(h);{var c=u=>{Pp(u,{get layers(){return e()},get enable_additional_layers(){return i()},get enable_layers(){return r()},get show_layers(){return n()},$$events:{new_layer(_){fe.call(this,t,_)},change_layer(_){fe.call(this,t,_)},move_layer(_){fe.call(this,t,_)},delete_layer(_){fe.call(this,t,_)},toggle_layer_visibility(_){fe.call(this,t,_)}}})};Q(l,u=>{r()&&u(c)})}return tt(h),tt(a),H(s,a),ue(o)}var Ep=nt('
        • '),Rp=nt('
          '),Fp=nt('
          ',1);function Bp(s,t){ce(t,!1);const e=Z();let i=z(t,"can_save",12,!1),r=z(t,"changeable",12,!1),n=z(t,"current_zoom",12,1),o=z(t,"tool",12),a=z(t,"min_zoom",12,!0),h=z(t,"enable_download",12,!1),l=z(t,"can_undo",12),c=z(t,"can_redo",12);const u=Oe();let _=Z(!1);function d(y){y.stopPropagation(),W(_,!m(_))}function f(y){u("set_zoom",y),W(_,!1)}function g(y){y.key==="Enter"&&f(n())}yt(()=>Y(n()),()=>{W(e,Math.round(n()*100))}),Le();var p={get can_save(){return i()},set can_save(y){i(y),I()},get changeable(){return r()},set changeable(y){r(y),I()},get current_zoom(){return n()},set current_zoom(y){n(y),I()},get tool(){return o()},set tool(y){o(y),I()},get min_zoom(){return a()},set min_zoom(y){a(y),I()},get enable_download(){return h()},set enable_download(y){h(y),I()},get can_undo(){return l()},set can_undo(y){l(y),I()},get can_redo(){return c()},set can_redo(y){c(y),I()}};return ve(),el(s,{children:(y,x)=>{var v=Fp(),b=qt(v);{var C=M=>{ie(M,{get Icon(){return Qh},label:"Download",onclick:T=>{u("download"),T.stopPropagation()}})};Q(b,M=>{h()&&M(C)})}var w=q(b,2);{let M=Gt(()=>o()==="pan");ie(w,{get Icon(){return yl},label:"Pan",onclick:T=>{T.stopPropagation(),u("pan")},get highlight(){return m(M)},size:"small",padded:!1,transparent:!0,get disabled(){return a()}})}var k=q(w,2);ie(k,{get Icon(){return zl},label:"Zoom out",onclick:M=>{u("zoom_out"),M.stopPropagation()}});var R=q(k,2);ie(R,{get Icon(){return Tl},label:"Zoom in",onclick:M=>{u("zoom_in"),M.stopPropagation()}});var S=q(R,2),P=it(S),F=it(P);tt(P);var G=q(P,2);{var N=M=>{var T=Rp(),st=it(T),U=it(st),rt=it(U);tt(U);var xt=q(U,2);Bi(xt,0,()=>[.25,.5,1,2,4],Li,(K,mt)=>{var ot=Ep(),ut=it(ot),O=it(ut);tt(ut),tt(ot),Wt(()=>Fe(O,`${mt*100}%`)),jt("click",ut,gs(()=>f(mt))),H(K,ot)}),tt(st),tt(T),jt("click",rt,gs(()=>f("fit"))),H(M,T)};Q(G,M=>{m(_)&&M(N)})}tt(S);var B=q(S,4);{let M=Gt(()=>!l());ie(B,{get Icon(){return tl},label:"Undo",onclick:T=>{u("undo"),T.stopPropagation()},get disabled(){return m(M)}})}var V=q(B,2);{let M=Gt(()=>!c());ie(V,{get Icon(){return bl},label:"Redo",onclick:T=>{u("redo"),T.stopPropagation()},get disabled(){return m(M)}})}var L=q(V,2);{var D=M=>{{let T=Gt(()=>!i());ie(M,{get disabled(){return m(T)},get Icon(){return Yo},label:"Save changes",onclick:st=>{u("save"),st.stopPropagation()},color:"var(--color-accent)"})}};Q(L,M=>{r()&&M(D)})}var gt=q(L,2);ie(gt,{get Icon(){return Jh},label:"Clear canvas",onclick:M=>{u("remove_image"),M.stopPropagation()}}),Wt(()=>Fe(F,`${m(e)??""}%`)),jt("click",P,d),jt("keydown",P,g),H(y,v)},$$slots:{default:!0}}),ue(p)}var Lp=nt(''),Op=nt(" ",1),Gp=nt('
          '),Dp=nt('
          ');function Up(s,t){ce(t,!1);const e=Z(),{drag:i,open_file_upload:r}=Yh(),n=Oe(),o=!0;let a=z(t,"changeable",12,!1),h=z(t,"sources",28,()=>["upload","webcam","clipboard"]),l=z(t,"transforms",28,()=>["crop","resize"]),c=z(t,"canvas_size",12),u=z(t,"is_dragging",12,!1),_=z(t,"background_image",12,!1),d=z(t,"brush_options",12),f=z(t,"eraser_options",12),g=z(t,"fixed_canvas",12,!1),p=z(t,"root",12),y=z(t,"i18n",12),x=z(t,"upload",12),v=z(t,"composite",12),b=z(t,"layers",12),C=z(t,"background",12),w=z(t,"border_region",12,0),k=z(t,"layer_options",12),R=z(t,"current_tool",12),S=z(t,"webcam_options",12),P=z(t,"show_download_button",12,!1),F=z(t,"theme_mode",12),G=z(t,"full_history",12,null),N=Z(),B=Z();function V(){!m(T)||!m(ut)||(m(T).set_tool(R()),m(T).set_subtool(m(At)))}function L(A){!m(T)||!m(ut)||(A.layers.length>0&&!A.active_layer&&m(T).set_layer(A.layers[0].id),R()&&(m(T).set_tool(R()),m(At)&&m(T).set_subtool(m(At))),m(K)&&(R()==="draw"||R()==="erase")&&m(K).set_tool(R(),m(At)))}function D(){return k()&&m(T)&&m(ut)}let gt=z(t,"has_drawn",12,!1);async function M(){return m(T)?!_()&&!gt()&&!b().length?{background:null,layers:[],composite:null}:await m(T).get_blobs():{background:null,layers:[],composite:null}}let T=Z();function st(A){m(T).add_image({image:A})}let U;async function rt(A){if(!m(T)||!A||!D())return;let j;if(typeof A=="string")j=A;else if(A?.meta?._type==="gradio.FileData"&&A?.url)j=A.url;else{console.warn("Invalid source provided to add_image_from_url:",A);return}try{U=m(T).add_image_from_url(j);let Xt=et.add_image_from_url(j);await Promise.all([U,Xt]),et.set_tool("image"),et.set_subtool("crop"),_(!0),m(mt).set_zoom("fit"),n("upload"),n("input")}catch(Xt){console.error("Error adding image from URL:",Xt)}}async function xt(A){if(!(!m(T)||!A.length||!D())&&Array.isArray(A)&&A.every(j=>j?.meta?._type==="gradio.FileData"))try{await U,await m(T).add_layers_from_url(A.map(j=>j.url)),n("change"),n("input")}catch(j){console.error("Error adding layer from URL:",j)}}let K=Z(),mt=Z(),ot=Z(1),ut=Z(!1),O=Z(!0),J={width:0,height:0};async function Tt(){if(!m(T)||!m(ut)||!m(mt))return;if(await xr(),m(N).offsetParent!==null){const j=m(N).getBoundingClientRect();(j.width!==J.width||j.height!==J.height)&&(m(mt).set_zoom("fit"),J={width:j.width,height:j.height})}}Wo(()=>{let A,j;return Et().then(()=>{A=new IntersectionObserver(()=>{Tt()}),j=new ResizeObserver(()=>{Tt()}),A.observe(m(N)),j.observe(m(N)),setTimeout(()=>{G()&&m(T)&&m(T).command_manager.replay(G(),m(T).context).then(()=>{E()})},0)}),typeof window<"u"&&(window.editor=m(T)),()=>{A&&A.disconnect(),j&&j.disconnect(),m(T)&&m(T).destroy()}});function E(){if(!m(T)||!m(ut))return;const A=Ne(m(T).layers);A.layers.length>0&&!A.active_layer&&m(T).set_layer(A.layers[0].id),R()&&(m(T).set_tool(R()),m(At)&&m(T).set_subtool(m(At))),m(K)&&(R()==="draw"||R()==="erase")&&m(K).set_tool(R(),m(At)),G(m(T).command_manager.history)}let et,ct=Z(),at=z(t,"can_undo",12,!1),ft=Z(!1);async function Et(){W(K,new kp),W(mt,new qr),W(T,new $r({target_element:m(N),width:c()[0],height:c()[1],tools:["image",m(mt),new mp,m(K)],fixed_canvas:g(),border_region:w(),layer_options:k(),theme_mode:F()})),m(K).on("change",()=>{gt(!0)}),W(ct,new qr),et=new $r({target_element:m(B),width:c()[0],height:c()[1],tools:["image",m(ct),new pp],dark:!0,fixed_canvas:!1,border_region:0,pad_bottom:40}),m(T).scale.subscribe(A=>{W(ot,A)}),m(T).min_zoom.subscribe(A=>{W(O,A)}),m(T).dimensions.subscribe(A=>{J={...A}}),m(T).command_manager.current_history.subscribe(A=>{at(A.previous!==null),W(ft,A.next!==null)}),await Promise.all([m(T).ready,et.ready]).then(()=>{bt({tool:"image"}),W(ut,!0),h().length>0?bt({tool:"image"}):bt({tool:"draw"}),et.set_subtool("crop")}),m(T).on("change",()=>{n("change"),n("input"),G(m(T).command_manager.history)}),C()||b().length>0?(C()&&await rt(C()),b().length>0&&await xt(b()),bt({tool:"draw"})):v()&&(await rt(v()),bt({tool:"draw"})),V()}async function Ut(A){if(A==null||!h().includes("upload"))return;m(T).reset_canvas();const j=Array.isArray(A)?A[0]:A;await m(T).add_image({image:j}),await et.add_image({image:j}),et.reset(),_(!0),m(mt).set_zoom("fit"),bt({tool:"draw"}),n("upload")}function bt({tool:A}){m(T).set_tool(A),R(A),A==="image"&&(et.set_tool("image"),et.set_subtool("crop"))}function Nt({tool:A,subtool:j}){m(T).set_subtool(j),W(At,j),j!==null&&(A==="draw"&&(j==="size"?W(Hi,!0):j==="color"&&W(Vi,!0)),A==="erase"&&j==="size"&&W(Ft,!0),A==="image"&&j==="paste"&&Is(),A==="image"&&j==="upload"&&xr().then(()=>{W(e,!1),r()}))}let Ft=Z(!1),vt=Z(),ee=Z(),Zt=Z(1),Vt=Z();function Ge(){const A=d().default_color==="auto"?d().colors[0]:d().default_color;if(Array.isArray(A))W(vt,A[0]),W(Zt,A[1]);else{W(vt,A);const j=he(A);j.getAlpha()<1?W(Zt,j.getAlpha()):W(Zt,1)}W(ee,typeof d().default_size=="number"?d().default_size:25)}function zs(){W(Vt,f().default_size==="auto"?25:f().default_size)}let Hi=Z(!1),Vi=Z(!1),At=Z(null),Ce=Z(!1);function Xi(A){m(mt).set_zoom(A)}function Yi(A){m(mt).set_zoom(A==="in"?m(ot)+(m(ot)<1?.1:m(ot)*.1):m(ot)-(m(ot)<1?.1:m(ot)*.1))}async function Is(){const A=await navigator.clipboard.read();for(let j=0;jPe.startsWith("image/"));if(Xt){const Pe=await A[j].getType(Xt);Ut(Pe)}}}function Es(A){A.detail!==null&&Ut(A.detail),Nt({tool:R(),subtool:null})}function Me(){n("save")}async function Te(){const{image:A}=await et.get_crop_bounds();A&&(await m(T).add_image({image:A,resize:!1}),Nt({tool:"image",subtool:null}),n("change"),n("input"))}async function yi(){const j=(await m(T).get_blobs()).composite;if(!j){n("download_error","Unable to generate image to download.");return}const Xt=URL.createObjectURL(j),Pe=document.createElement("a");Pe.href=Xt,Pe.download="image.png",Pe.click(),URL.revokeObjectURL(Xt)}function kh(){m(T).undo()}function Ah(){m(T).redo()}let Rs=Z(C());yt(()=>(Y(k()),m(T)),()=>{k()&&D()&&(m(T).set_layer_options(k()),V())}),yt(()=>(m(T),m(ut),Ne),()=>{if(m(T)&&m(ut)&&m(T).layers){const A=Ne(m(T).layers);A.layers.length>0&&!A.active_layer&&L(A)}}),yt(()=>(Y(C()),Y(b()),Y(v()),m(T),m(ut),m(mt)),()=>{C()==null&&b().length==0&&v()==null&&m(T)&&m(ut)&&(m(T).reset_canvas(),m(mt).set_zoom("fit"),bt({tool:"image"}),_(!1),gt(!1))}),yt(()=>(m(Rs),Y(C())),()=>{m(Rs)!==C()&&(bt({tool:"draw"}),Nt({tool:"draw",subtool:null}),R("draw"),W(Rs,C()))}),yt(()=>(Y(R()),m(At),m(ct)),()=>{R()==="image"&&m(At)==="crop"&&m(ct).set_zoom("fit")}),yt(()=>(Y(at()),m(T)),()=>{_(at()&&m(T).command_manager.contains("AddImage"))}),yt(()=>(Y(d()),Y(f())),()=>{d()&&Ge(),f()&&zs()}),yt(()=>(m(K),m(vt),Y(d())),()=>{m(K)?.set_brush_color((()=>{let A;if(m(vt)==="auto"){const j=d().colors.find(Xt=>Array.isArray(Xt)?Xt[0]===d().default_color:Xt===d().default_color)||d().colors[0];A=Array.isArray(j)?j[0]:j}else A=m(vt);return A})())}),yt(()=>(m(K),m(ee)),()=>{m(K)?.set_brush_size(typeof m(ee)=="number"?m(ee):25)}),yt(()=>(m(K),m(Vt)),()=>{m(K)?.set_eraser_size(typeof m(Vt)=="number"?m(Vt):25)}),yt(()=>(Y(R()),Y(_()),m(At),Y(h())),()=>{W(e,R()!=="image"||R()==="image"&&_()||R()==="image"&&m(At)==="webcam"||!h().includes("upload"))}),yt(()=>(m(K),m(Ce)),()=>{m(K)?.preview_brush(m(Ce))}),yt(()=>(m(K),m(Zt)),()=>{m(K)?.set_brush_opacity(m(Zt))}),yt(()=>(Y(v()),Y(C())),()=>{rt(v()||C())}),yt(()=>Y(b()),()=>{xt(b())}),Le();var Sh={antialias:o,get_blobs:M,add_image:st,add_image_from_url:rt,add_layers_from_url:xt,get changeable(){return a()},set changeable(A){a(A),I()},get sources(){return h()},set sources(A){h(A),I()},get transforms(){return l()},set transforms(A){l(A),I()},get canvas_size(){return c()},set canvas_size(A){c(A),I()},get is_dragging(){return u()},set is_dragging(A){u(A),I()},get background_image(){return _()},set background_image(A){_(A),I()},get brush_options(){return d()},set brush_options(A){d(A),I()},get eraser_options(){return f()},set eraser_options(A){f(A),I()},get fixed_canvas(){return g()},set fixed_canvas(A){g(A),I()},get root(){return p()},set root(A){p(A),I()},get i18n(){return y()},set i18n(A){y(A),I()},get upload(){return x()},set upload(A){x(A),I()},get composite(){return v()},set composite(A){v(A),I()},get layers(){return b()},set layers(A){b(A),I()},get background(){return C()},set background(A){C(A),I()},get border_region(){return w()},set border_region(A){w(A),I()},get layer_options(){return k()},set layer_options(A){k(A),I()},get current_tool(){return R()},set current_tool(A){R(A),I()},get webcam_options(){return S()},set webcam_options(A){S(A),I()},get show_download_button(){return P()},set show_download_button(A){P(A),I()},get theme_mode(){return F()},set theme_mode(A){F(A),I()},get full_history(){return G()},set full_history(A){G(A),I()},get has_drawn(){return gt()},set has_drawn(A){gt(A),I()},get can_undo(){return at()},set can_undo(A){at(A),I()}};ve();var ei=Dp();let cn;Ue(ei,"aria-label","Click to upload or drop files");var un=it(ei);{var Ch=A=>{var j=Op(),Xt=qt(j);{var Pe=Qt=>{Bp(Qt,{get changeable(){return a()},get min_zoom(){return m(O)},get current_zoom(){return m(ot)},get tool(){return R()},can_save:!0,get enable_download(){return P()},get can_undo(){return at()},get can_redo(){return m(ft)},$$events:{set_zoom:St=>Xi(St.detail),zoom_in:()=>Yi("in"),zoom_out:()=>Yi("out"),remove_image:()=>{n("clear"),m(T).reset_canvas(),bt({tool:"image"}),_(!1),gt(!1)},save:Me,pan:St=>{bt({tool:"pan"})},download:()=>yi(),undo:kh,redo:Ah}})};Q(Xt,Qt=>{m(At)!=="crop"&&Qt(Pe)})}var pn=q(Xt,2);{var Ph=Qt=>{jf(Qt,{get sources(){return h()},get transforms(){return l()},get background(){return _()},get show_brush_size(){return m(Hi)},get show_brush_color(){return m(Vi)},get show_eraser_size(){return m(Ft)},get brush_options(){return d()},get eraser_options(){return f()},get tool(){return R()},get subtool(){return m(At)},get selected_color(){return m(vt)},set selected_color(St){W(vt,St)},get selected_size(){return m(ee)},set selected_size(St){W(ee,St)},get selected_eraser_size(){return m(Vt)},set selected_eraser_size(St){W(Vt,St)},get selected_opacity(){return m(Zt)},set selected_opacity(St){W(Zt,St)},get preview(){return m(Ce)},set preview(St){W(Ce,St)},$$events:{tool_change:St=>bt(St.detail),subtool_change:St=>Nt(St.detail)},$$legacy:!0})};Q(pn,Qt=>{m(At)!=="crop"&&Qt(Ph)})}var gn=q(pn,2);{var zh=Qt=>{var St=Lp(),mn=it(St),Rh=it(mn);jh(Rh,{get upload(){return x()},get root(){return p()},streaming:!1,mode:"image",include_audio:!1,get i18n(){return y()},get mirror_webcam(){return Y(S()),Rt(()=>S().mirror)},get webcam_constraints(){return Y(S()),Rt(()=>S().constraints)},$$events:{capture:Es,error(Ls){fe.call(this,t,Ls)},drag(Ls){fe.call(this,t,Ls)}}}),tt(mn),tt(St),H(Qt,St)};Q(gn,Qt=>{R()==="image"&&m(At)==="webcam"&&Qt(zh)})}var Ih=q(gn,2);{var Eh=Qt=>{Ip(Qt,{get enable_additional_layers(){return Y(k()),Rt(()=>k().allow_additional_layers)},get layers(){return m(T),Rt(()=>m(T).layers)},$$events:{new_layer:()=>{m(T).add_layer()},change_layer:St=>{m(T).set_layer(St.detail),R()==="draw"&&bt({tool:"draw"})},move_layer:St=>{m(T).move_layer(St.detail.id,St.detail.direction)},delete_layer:St=>{m(T).delete_layer(St.detail)},toggle_layer_visibility:St=>{m(T).toggle_layer_visibility(St.detail)}}})};Q(Ih,Qt=>{m(At),Y(k()),Rt(()=>m(At)!=="crop"&&!k().disabled)&&Qt(Eh)})}H(A,j)};Q(un,A=>{m(ut)&&A(Ch)})}var Fs=q(un,2);let dn;Qe(Fs,A=>W(N,A),()=>m(N));var Bs=q(Fs,2);let _n;Qe(Bs,A=>W(B,A),()=>m(B));var fn=q(Bs,2);{var Mh=A=>{var j=Gp(),Xt=it(j);ae(Xt,{get Icon(){return Yo},label:"Confirm crop",show_label:!0,size:"large",padded:!0,color:"white",background:"var(--color-green-500)",label_position:"right",onclick:Te}),tt(j),H(A,j)};Q(fn,A=>{m(At)==="crop"&&A(Mh)})}var Th=q(fn,2);return Oh(Th,t,"default",{}),tt(ei),As(ei,(A,j)=>i?.(A,j),()=>({on_drag_change:A=>u(A),on_files:Ut,accepted_types:"image/*",disable_click:m(e)})),Wt(()=>{cn=re(ei,1,"image-container svelte-6fnl1z",null,cn,{"dark-bg":m(At)==="crop"}),dn=re(Fs,1,"pixi-target svelte-6fnl1z",null,dn,{visible:m(At)!=="crop"}),_n=re(Bs,1,"pixi-target-crop svelte-6fnl1z",null,_n,{visible:m(At)==="crop"})}),H(s,ei),si(t,"antialias",o),si(t,"get_blobs",M),si(t,"add_image",st),si(t,"add_image_from_url",rt),si(t,"add_layers_from_url",xt),ue(Sh)}const Np=/^(#\s*)(.+)$/m;function Do(s){const t=s.trim(),e=t.match(Np);if(!e)return[!1,t||!1];const[i,,r]=e,n=r.trim();if(t===i)return[n,!1];const o=e.index!==void 0?e.index+i.length:0,h=t.substring(o).trim()||!1;return[n,h]}var Wp=nt('

          '),Hp=nt('

          '),Vp=nt(" ",1),Xp=nt("
          Upload an image
          "),Yp=nt('
          or
          '),jp=nt("
          select the draw tool to start
          "),qp=nt('
          '),$p=nt(" ",1);function Kp(s,t){ce(t,!1);const e=Z(),i=Z();let r=z(t,"brush",12),n=z(t,"eraser",12),o=z(t,"sources",12),a=z(t,"i18n",12),h=z(t,"root",12),l=z(t,"label",12,void 0),c=z(t,"show_label",12),u=z(t,"changeable",12,!1),_=z(t,"theme_mode",12),d=z(t,"layers",12),f=z(t,"composite",12),g=z(t,"background",12),p=z(t,"layer_options",12),y=z(t,"transforms",12),x=z(t,"accept_blobs",12),v=z(t,"canvas_size",12),b=z(t,"fixed_canvas",12,!1),C=z(t,"realtime",12),w=z(t,"upload",12),k=z(t,"is_dragging",12),R=z(t,"placeholder",12,void 0),S=z(t,"border_region",12),P=z(t,"full_history",12,null),F=z(t,"webcam_options",12),G=z(t,"show_download_button",12,!1);const N=Oe();let B=Z(),V=Z(!1);function L(E){return!!E}function D(E){return!!E}async function gt(){let E;try{E=await m(B).get_blobs()}catch{return{background:null,layers:[],composite:null}}const et=E.background?w()(await Os([new File([E.background],"background.png")]),h()):Promise.resolve(null),ct=E.layers.filter(L).map(async(bt,Nt)=>w()(await Os([new File([bt],`layer_${Nt}.png`)]),h())),at=E.composite?w()(await Os([new File([E.composite],"composite.png")]),h()):Promise.resolve(null),[ft,Et,...Ut]=await Promise.all([et,at,...ct]);return{background:Array.isArray(ft)?ft[0]:ft,layers:Ut.flatMap(bt=>Array.isArray(bt)?bt:[bt]).filter(D),composite:Array.isArray(Et)?Et[0]:Et}}function M(E){m(B)&&E==null&&(m(B).handle_remove(),N("receive_null"))}let T=Z(!1),st=Z(),U=z(t,"image_id",12,null);function rt(){return new Promise(E=>setTimeout(()=>E(),30))}let xt=!1,K=!1;async function mt(E){if(!C())return;if(xt){K=!0;return}xt=!0,await rt();const et=await m(B).get_blobs(),ct=[];let at=Math.random().toString(36).substring(2);et.background&&ct.push([at,"background",new File([et.background],"background.png"),null]),et.composite&&ct.push([at,"composite",new File([et.composite],"composite.png"),null]),et.layers.forEach((ft,Et)=>{ft&&ct.push([at,"layer",new File([ft],`layer_${Et}.png`),Et])}),await Promise.all(ct.map(async([ft,Et,Ut,bt])=>x()({binary:!0,data:{file:Ut,id:ft,type:Et,index:bt}}))),U(at),N("change"),await rt(),xt=!1,K&&(K=!1,xt=!1,mt())}let ot=Z();yt(()=>m(T),()=>{m(T)&&N("upload")}),yt(()=>(Y(d()),Y(f()),Y(g())),()=>{M({layers:d(),composite:f(),background:g()})}),yt(()=>(m(e),m(i),Y(R()),Do),()=>{(E=>{var et=Ho(E,2);W(e,et[0]),W(i,et[1])})(R()?Do(R()):[!1,!1])}),Le();var ut={get_data:gt,get brush(){return r()},set brush(E){r(E),I()},get eraser(){return n()},set eraser(E){n(E),I()},get sources(){return o()},set sources(E){o(E),I()},get i18n(){return a()},set i18n(E){a(E),I()},get root(){return h()},set root(E){h(E),I()},get label(){return l()},set label(E){l(E),I()},get show_label(){return c()},set show_label(E){c(E),I()},get changeable(){return u()},set changeable(E){u(E),I()},get theme_mode(){return _()},set theme_mode(E){_(E),I()},get layers(){return d()},set layers(E){d(E),I()},get composite(){return f()},set composite(E){f(E),I()},get background(){return g()},set background(E){g(E),I()},get layer_options(){return p()},set layer_options(E){p(E),I()},get transforms(){return y()},set transforms(E){y(E),I()},get accept_blobs(){return x()},set accept_blobs(E){x(E),I()},get canvas_size(){return v()},set canvas_size(E){v(E),I()},get fixed_canvas(){return b()},set fixed_canvas(E){b(E),I()},get realtime(){return C()},set realtime(E){C(E),I()},get upload(){return w()},set upload(E){w(E),I()},get is_dragging(){return k()},set is_dragging(E){k(E),I()},get placeholder(){return R()},set placeholder(E){R(E),I()},get border_region(){return S()},set border_region(E){S(E),I()},get full_history(){return P()},set full_history(E){P(E),I()},get webcam_options(){return F()},set webcam_options(E){F(E),I()},get show_download_button(){return G()},set show_download_button(E){G(E),I()},get image_id(){return U()},set image_id(E){U(E),I()}};ve();var O=$p(),J=qt(O);{let E=Gt(()=>(Y(l()),Y(a()),Rt(()=>l()||a()("image.image"))));il(J,{get show_label(){return c()},get Icon(){return Vo},get label(){return m(E)}})}var Tt=q(J,2);return Qe(Up(Tt,{get transforms(){return y()},get composite(){return f()},get layers(){return d()},get background(){return g()},get canvas_size(){return v()},get changeable(){return u()},get sources(){return o()},get brush_options(){return r()},get eraser_options(){return n()},get fixed_canvas(){return b()},get border_region(){return S()},get layer_options(){return p()},get i18n(){return a()},get root(){return h()},get upload(){return w()},get webcam_options(){return F()},get show_download_button(){return G()},get theme_mode(){return _()},get background_image(){return m(T)},set background_image(E){W(T,E)},get current_tool(){return m(ot)},set current_tool(E){W(ot,E)},get is_dragging(){return k()},set is_dragging(E){k(E)},get has_drawn(){return m(V)},set has_drawn(E){W(V,E)},get can_undo(){return m(st)},set can_undo(E){W(st,E)},get full_history(){return P()},set full_history(E){P(E)},$$events:{history(E){fe.call(this,t,E)},save(E){fe.call(this,t,E)},input(E){fe.call(this,t,E)},change:mt,clear:()=>N("clear"),download_error(E){fe.call(this,t,E)}},children:(E,et)=>{var ct=ci(),at=qt(ct);{var ft=Et=>{var Ut=qp(),bt=it(Ut);{var Nt=Vt=>{var Ge=ci(),zs=qt(Ge);{var Hi=At=>{var Ce=Vp(),Xi=qt(Ce);{var Yi=Me=>{var Te=Wp(),yi=it(Te,!0);tt(Te),Wt(()=>Fe(yi,m(e))),H(Me,Te)};Q(Xi,Me=>{m(e)&&Me(Yi)})}var Is=q(Xi,2);{var Es=Me=>{var Te=Hp(),yi=it(Te,!0);tt(Te),Wt(()=>Fe(yi,m(i))),H(Me,Te)};Q(Is,Me=>{m(i)&&Me(Es)})}H(At,Ce)},Vi=At=>{var Ce=Xp();H(At,Ce)};Q(zs,At=>{m(e)||m(i)?At(Hi):At(Vi,!1)})}H(Vt,Ge)};Q(bt,Vt=>{Y(o()),Rt(()=>o()&&o().length)&&Vt(Nt)})}var Ft=q(bt,2);{var vt=Vt=>{var Ge=Yp();H(Vt,Ge)};Q(Ft,Vt=>{Y(o()),Y(r()),Y(R()),Rt(()=>o()&&o().length&&r()&&!R())&&Vt(vt)})}var ee=q(Ft,2);{var Zt=Vt=>{var Ge=jp();H(Vt,Ge)};Q(ee,Vt=>{r()&&!R()&&Vt(Zt)})}tt(Ut),H(Et,Ut)};Q(at,Et=>{m(ot)==="image"&&!m(st)&&Et(ft)})}H(E,ct)},$$slots:{default:!0},$$legacy:!0}),E=>W(B,E),()=>m(B)),H(s,O),si(t,"get_data",gt),ue(ut)}var Zp=nt(" ",1),Qp=nt(" ",1);function Jp(s,t){ce(t,!0);let e=Gh(t,["$$slots","$$events","$$legacy"]);class i extends Nh{async get_data(){const C=await super.get_data(),w=await l();return{...C,value:w}}}const r=new i(e,{server:{accept_blobs:()=>{}},buttons:[],height:350,border_region:0});let n,o=Uh(null),a=!1,h=!1;async function l(){if(m(o)){const C={id:m(o)};return W(o,null),C}return await n.get_data()}let c;function u(){r.dispatch("apply")}let _=de(()=>r.props.value?.background||r.props.value?.layers?.length||r.props.value?.composite),d=de(()=>r.props.value?.background?new Gs(r.props.value.background):null),f=de(()=>r.props.value?.composite?new Gs(r.props.value.composite):null),g=de(()=>r.props.value?.layers?.map(b=>new Gs(b))||[]);var p=ci(),y=qt(p);{var x=b=>{{let C=de(()=>c?"focus":"base");bn(b,{get visible(){return r.shared.visible},variant:"solid",get border_mode(){return m(C)},padding:!1,get elem_id(){return r.shared.elem_id},get elem_classes(){return r.shared.elem_classes},get height(){return r.props.height},get width(){return r.props.width},allow_overflow:!0,overflow_behavior:"visible",get container(){return r.shared.container},get scale(){return r.shared.scale},get min_width(){return r.shared.min_width},children:(w,k)=>{var R=Zp(),S=qt(R);vn(S,yn({get autoscroll(){return r.shared.autoscroll},get i18n(){return r.i18n}},()=>r.shared.loading_status,{on_clear_status:()=>r.dispatch("clear_status",r.shared.loading_status)}));var P=q(S,2);{let F=de(()=>r.props.value?.composite||null);Wh(P,{get value(){return m(F)},get label(){return r.shared.label},get show_label(){return r.shared.show_label},get buttons(){return r.props.buttons},get selectable(){return r.props._selectable},get i18n(){return r.i18n},$$events:{select:({detail:G})=>r.dispatch("select",G),share:({detail:G})=>r.dispatch("share",G),error:({detail:G})=>r.dispatch("error",G)}})}H(w,R)},$$slots:{default:!0}})}},v=b=>{{let C=de(()=>m(_)?"solid":"dashed"),w=de(()=>c?"focus":"base");bn(b,{get visible(){return r.shared.visible},get variant(){return m(C)},get border_mode(){return m(w)},padding:!1,get elem_id(){return r.shared.elem_id},get elem_classes(){return r.shared.elem_classes},get height(){return r.props.height},get width(){return r.props.width},allow_overflow:!0,overflow_behavior:"visible",get container(){return r.shared.container},get scale(){return r.shared.scale},get min_width(){return r.shared.min_width},children:(k,R)=>{var S=Qp(),P=qt(S);vn(P,yn({get autoscroll(){return r.shared.autoscroll},get i18n(){return r.i18n}},()=>r.shared.loading_status,{on_clear_status:()=>r.dispatch("clear_status",r.shared.loading_status)}));var F=q(P,2);{let G=de(()=>r.shared.attached_events.includes("apply")),N=de(()=>r.shared.attached_events.includes("change")||r.shared.attached_events.includes("input")),B=de(()=>r.props.buttons===null?!0:r.props.buttons.includes("download"));Qe(Kp(F,{get border_region(){return r.props.border_region},get canvas_size(){return r.props.canvas_size},get layers(){return m(g)},get composite(){return m(f)},get background(){return m(d)},get root(){return r.shared.root},get sources(){return r.props.sources},get label(){return r.shared.label},get show_label(){return r.shared.show_label},get fixed_canvas(){return r.props.fixed_canvas},get brush(){return r.props.brush},get eraser(){return r.props.eraser},get changeable(){return m(G)},get realtime(){return m(N)},get i18n(){return r.i18n},get transforms(){return r.props.transforms},get accept_blobs(){return r.shared.server.accept_blobs},get layer_options(){return r.props.layers},upload:(...V)=>r.shared.client.upload(...V),get placeholder(){return r.props.placeholder},get webcam_options(){return r.props.webcam_options},get show_download_button(){return m(B)},get theme_mode(){return r.shared.theme_mode},get is_dragging(){return c},set is_dragging(V){c=V},get image_id(){return m(o)},set image_id(V){W(o,V,!0)},$$events:{input:()=>{h?r.dispatch("input"):h=!0},save:V=>u(),edit:()=>r.dispatch("edit"),clear:()=>r.dispatch("clear"),drag:({detail:V})=>c=V,upload:()=>r.dispatch("upload"),share:({detail:V})=>r.dispatch("share",V),error:[({detail:V})=>{r.shared.loading_status=r.shared.loading_status||{},r.shared.loading_status.status="error",r.dispatch("error",V)},function(V){fe.call(this,t,V)}],receive_null:()=>r.props.value={background:null,layers:[],composite:null},change:()=>{a?r.dispatch("change"):a=!0},download_error:V=>r.dispatch("error",V.detail)}}),V=>n=V,()=>n)}H(k,S)},$$slots:{default:!0}})}};Q(y,b=>{r.shared.interactive?b(v,!1):b(x)})}H(s,p),ue()}const Ig=Object.freeze(Object.defineProperty({__proto__:null,default:Jp},Symbol.toStringTag,{value:"Module"}));export{Mc as $,Ua as A,se as B,lt as C,It as D,$ as E,Er as F,Pd as G,ge as H,sa as I,be as J,di as K,Gn as L,pt as M,kt as N,qc as O,dt as P,nu as Q,Pr as R,su as S,Ji as T,Sr as U,Wi as V,Mt as W,ku as X,Un as Y,$s as Z,Nn as _,we as a,xs as a0,Ht as a1,Sc as a2,oa as a3,Jt as a4,Na as a5,ht as a6,wt as a7,Tu as a8,Qu as a9,Xu as aa,md as ab,xd as ac,Cd as ad,Ad as ae,Md as af,ys as ag,ds as ah,Or as ai,To as aj,ih as ak,io as al,to as am,zo as an,P_ as ao,Pt as ap,Dt as aq,ql as ar,ks as as,nh as at,Ig as au,Wu as b,Ui as c,us as d,$t as e,eo as f,Du as g,Jr as h,Oa as i,ma as j,me as k,za as l,Wr as m,gd as n,yd as o,Sd as p,wd as q,hc as r,Cs as s,_t as t,Ot as u,jl as v,zt as w,We as x,_i as y,Td as z}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-cd2fBqg2.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-cd2fBqg2.js new file mode 100644 index 0000000000000000000000000000000000000000..0937b22d0c60006011fb304d79d6656d635e2e78 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-cd2fBqg2.js @@ -0,0 +1 @@ +import{g as m,r as i,s as d}from"./i18n-Dnhn5Rxr.js";import{R as l,T as n,a6 as f,S as u,a as c}from"./index-DWyDLubb.js";import{G as $}from"./utils.svelte-CCyS_0CY.js";import{B as g}from"./Index.svelte_svelte_type_style_lang-BKODC18H.js";import"./clone-BkeCM4Nl.js";import"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./html-Ih_5QVTo.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./snippet-BWgYNF9D.js";import"./index-B_pwUImq.js";import"./Clear-BF6j078A.js";function T(t,r){l(r,!0);let s=i(r,["$$slots","$$events","$$legacy"]);const a=new $(s);g(t,m(()=>a.shared,{children:(p,h)=>{var o=f(),e=u(o);d(e,r,"default",{}),c(p,o)},$$slots:{default:!0}})),n()}export{g as BaseColumn,T as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-fPjHowzi.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-fPjHowzi.css new file mode 100644 index 0000000000000000000000000000000000000000..1d5905688c702efc1eda93078f9536f470d7a740 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-fPjHowzi.css @@ -0,0 +1 @@ +div.svelte-19utvcn{width:100%;height:100%}#vg-tooltip-element{font-family:var(--font)!important;font-size:var(--text-xs)!important;box-shadow:none!important;background-color:var(--block-background-fill)!important;border:1px solid var(--border-color-primary)!important;color:var(--body-text-color)!important}#vg-tooltip-element .key{color:var(--body-text-color-subdued)!important}.caption.svelte-19utvcn{padding:0 4px;margin:0;text-align:center} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-idnwMe3R.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-idnwMe3R.js new file mode 100644 index 0000000000000000000000000000000000000000..d07fdaf5a05b67bf85fc4ef2073f9a35d98c51ba --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-idnwMe3R.js @@ -0,0 +1 @@ +import{n as a,h as l,a as m,b as _,r as d,j as c}from"./i18n-Dnhn5Rxr.js";import{R as u,aa as v,y as f,w as n,t as g,a as b,T as h,a5 as $,W as y}from"./index-DWyDLubb.js";import{G as x}from"./utils.svelte-CCyS_0CY.js";import"./clone-BkeCM4Nl.js";var j=y('
          ');function M(i,r){u(r,!0);const p=d(r,["$$slots","$$events","$$legacy"]),e=new x(p);let t=$(()=>({visible:e.shared.visible,main_page_name:e.props.main_page_name??"Home",value:e.props.value}));v(()=>{c(a)||a.set(n(t))}),f(()=>{a.set(n(t))});var s=j();g(o=>{m(s,"id",e.shared.elem_id),_(s,1,o)},[()=>l(e.shared.elem_classes.join(" "))]),b(i,s),h()}export{M as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-nh82mmWC.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-nh82mmWC.js new file mode 100644 index 0000000000000000000000000000000000000000..b9bea8a0afd2c7252f82bfe35952e06be9dbe9a9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-nh82mmWC.js @@ -0,0 +1 @@ +import{p as fe,i as _,d as ge,f as X,a as S,k as he,b as Y,r as _e}from"./i18n-Dnhn5Rxr.js";import{R as Q,aa as me,t as w,w as p,a0 as Z,Z as ye,a as g,T as U,u as ke,X as v,V as c,W as h,x as we,a5 as Fe,Y as l,S as be}from"./index-DWyDLubb.js";import{G as xe}from"./utils.svelte-CCyS_0CY.js";import{h as C}from"./html-Ih_5QVTo.js";import{P as J}from"./prism-python-B4lzO_Nz.js";import"./clone-BkeCM4Nl.js";var K={},N;function Ae(){return N||(N=1,(function(n){n.languages.typescript=n.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),n.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete n.languages.typescript.parameter,delete n.languages.typescript["literal-property"];var r=n.languages.extend("typescript",{});delete r["class-name"],n.languages.typescript["class-name"].inside=r,n.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:r}}}}),n.languages.ts=n.languages.typescript})(Prism)),K}Ae();var qe=h(' '),Le=h('🔗'),Te=h(": ",1),ze=h('
          default =
          '),Ee=h('

          '),Se=h('
           
          '),Ze=h('
          '),Ce=h('
          ');function Ie(n,r){Q(r,!0);let q=fe(r,"linkify",19,()=>[]),u,m=ke(!1),P="python",I=Fe(()=>$(r.docs,P));function M(e,a){let t="param-";return typeof a=="string"&&(t+=a+"-"),t+e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}function R(e,a){let t=J.highlight(e,J.languages[a],a);for(const o of q())t=t.replace(new RegExp(o,"g"),`${o}`);return t}function $(e,a){return e?Object.entries(e).map(([t,{type:o,description:k,default:f}])=>{let b=o?R(o,a):null;return{name:t,type:b,description:k,default:f?R(f,a):null}}):[]}function ee(){we(m,!p(m)),u.querySelectorAll(".param").forEach(a=>{a instanceof HTMLDetailsElement&&(a.open=p(m))})}function ae(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'$1')}me(()=>{window.location.hash&&V(window.location.hash),window.addEventListener("hashchange",e=>{V(window.location.hash)})});function V(e){if(!u)return;const a=e.slice(1),t=u.querySelector(`#${a}`);t instanceof HTMLDetailsElement&&(t.open=!0,t.scrollIntoView({behavior:"smooth"}))}const te=e=>{if(e!==void 0){if(typeof e=="number")return e+"px";if(typeof e=="string")return e}};var y=Ce();let j;var L=c(y),D=c(L);{var re=e=>{var a=qe(),t=c(a,!0);l(a),w(()=>Z(t,r.header)),g(e,a)};_(D,e=>{r.header!==null&&e(re)})}var F=v(D,2),se=c(F,!0);l(F),l(L);var ne=v(L,2);{var ie=e=>{var a=Ze();he(a,21,()=>p(I),({type:t,description:o,default:k,name:f})=>f,(t,o)=>{let k=()=>p(o).type,f=()=>p(o).description,b=()=>p(o).default,T=()=>p(o).name;var x=Se(),z=c(x),G=c(z);{var le=s=>{var i=Le();w(d=>S(i,"href",`#${d??""}`),[()=>M(T()||"",r.anchor_links)]),g(s,i)};_(G,s=>{r.anchor_links&&s(le)})}var E=v(G,2);Y(E,1,"language-python svelte-1kuiw39");var H=c(E),O=c(H,!0),oe=v(O);{var ce=s=>{var i=Te(),d=v(be(i));C(d,k),g(s,i)};_(oe,s=>{k()&&s(ce)})}l(H),l(E),l(z);var B=v(z,2);{var ue=s=>{var i=ze();let d;var A=c(i);X(A,"",{},{"padding-right":"4px"});var W=v(A,2),ve=v(c(W));C(ve,b),l(W),l(i),w(()=>d=Y(i,1,"default svelte-1kuiw39",null,d,{last:!f()})),g(s,i)};_(B,s=>{b()&&s(ue)})}var pe=v(B,2);{var de=s=>{var i=Ee(),d=c(i),A=c(d);C(A,()=>ae(f())),l(d),l(i),g(s,i)};_(pe,s=>{f()&&s(de)})}l(x),w(s=>{S(x,"id",s),Z(O,T())},[()=>r.anchor_links?M(T()||"",r.anchor_links):void 0]),g(t,x)}),l(a),g(e,a)};_(ne,e=>{p(I)&&e(ie)})}l(y),ge(y,e=>u=e,()=>u),w(e=>{j=X(y,"",j,e),S(F,"title",p(m)?"Close All":"Open All"),Z(se,p(m)?"▲":"▼")},[()=>({"max-height":te(r.max_height)})]),ye("click",F,ee),g(n,y),U()}function He(n,r){Q(r,!0);const q=_e(r,["$$slots","$$events","$$legacy"]),u=new xe(q);Ie(n,{get docs(){return u.props.value},get linkify(){return u.props.linkify},get header(){return u.props.header},get anchor_links(){return u.props.anchor_links},get max_height(){return u.props.max_height}}),U()}export{He as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-oaxkLqhJ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-oaxkLqhJ.js new file mode 100644 index 0000000000000000000000000000000000000000..0d339fa4fbb431b739f62b9c85e8c8697782f3a0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-oaxkLqhJ.js @@ -0,0 +1 @@ +import{p as he,e as lt,a as ue,i as D,b as J,k as nt,d as be,f as it,u as pt,r as ct,g as ut}from"./i18n-Dnhn5Rxr.js";import{R as Ce,a4 as dt,V as k,X as E,Y as w,t as N,a0 as ye,Z as O,a as y,T as Ie,U as xe,W as T,u as B,v as ie,y as Le,x as r,w as e,aa as vt,a7 as Ne,aw as ft,a5 as P,a6 as Ue,S as $e,a8 as gt,ak as ke,M as ee}from"./index-DWyDLubb.js";import{G as _t}from"./utils.svelte-CCyS_0CY.js";import{t as pe,f as ce}from"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{b as we}from"./input-DrerMDOL.js";import{I as mt}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as ht}from"./BlockTitle-BMm9LakX.js";import{C as bt}from"./Check-DUAHzS2-.js";import{C as xt}from"./Copy-ChCbTvli.js";import{P as kt}from"./Plus-CDtuRS4x.js";import{S as wt}from"./Send-B_rl9Hxa.js";import{T as yt}from"./Trash-D2U3jAj_.js";import{I as $t}from"./IconButtonWrapper-D0s9l4wW.js";import{b as Ct,D as ze}from"./Dropdown-Beu8JVME.js";/* empty css */import{B as It}from"./Block-J4oodUWp.js";import{S as St}from"./index-CglBvmLb.js";import{default as ha}from"./Example-BXmvnBf1.js";import"./clone-BkeCM4Nl.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";import"./snippet-BWgYNF9D.js";import"./Info-Dzjhnd64.js";import"./window-Uydxco8n.js";import"./DropdownArrow-BOSZEGSp.js";import"./Clear-BF6j078A.js";var Dt=T('
          ');function Tt(K,U){Ce(U,!1);let t=he(U,"label",12),c=he(U,"checked",12,!1),b=he(U,"disabled",12,!1);const m=dt();function G(u){const M=u.target.getAttribute("aria-checked");c(M!=="true"),m("click",{checked:c()})}var Y={get label(){return t()},set label(u){t(u),xe()},get checked(){return c()},set checked(u){c(u),xe()},get disabled(){return b()},set disabled(u){b(u),xe()}};lt();var V=Dt(),R=k(V),h=E(R,2),$=k(h,!0);return w(h),w(V),N(()=>{ue(R,"aria-checked",c()),R.disabled=b(),ye($,t())}),O("click",R,G),y(K,V),Ie(Y)}var Bt=T("
          "),Pt=T('
          Converting to dialogue format...
          '),Ot=T(''),Et=T('
          '),Mt=T('
          '),Rt=T('
          '),At=T("
          "),Lt=T('
          Converting to plain text...
          '),Nt=T('
          '),Ut=T('
          '),zt=T('
          '),Gt=T("
          ");function Ht(K,U){Ce(U,!0);const t=U.gradio;let c=B(!1),b=P(()=>!t.shared.interactive),m=B(ie([]));Le(()=>{t.props.value&&t.props.value.length&&typeof t.props.value!="string"?r(m,[...t.props.value],!0):t.props.value&&typeof t.props.value!="string"?r(m,[{speaker:`${t.props.speakers.length?t.props.speakers[0]:""}`,text:""}],!0):typeof t.props.value=="string"&&(r(I,t.props.value,!0),r(c,!0))});let G=P(()=>t.props.buttons||["copy"]),Y=a=>{t.dispatch("custom_button_click",{id:a})},V=B(ie(t.props.value));Le(()=>{e(V)!=t.props.value&&(r(V,t.props.value,!0),t.dispatch("change"))});let R,h=B(!1),$=B(-1),u=B(0),C=B(ie([])),M=ie([]),z,Se=B(0),te=B(!1),de,I=B(""),ae=B(null),Z=B(!1),j=B(!1);const De=["red","green","blue","yellow","purple","teal","orange","cyan","lime","pink"],Ge={red:"rgba(254, 202, 202, 0.7)",green:"rgba(209, 250, 229, 0.7)",blue:"rgba(219, 234, 254, 0.7)",yellow:"rgba(254, 243, 199, 0.7)",purple:"rgba(233, 213, 255, 0.7)",teal:"rgba(204, 251, 241, 0.7)",orange:"rgba(254, 215, 170, 0.7)",cyan:"rgba(207, 250, 254, 0.7)",lime:"rgba(217, 249, 157, 0.7)",pink:"rgba(252, 231, 243, 0.7)"};let He=P(()=>{let a={};return t.props.color_map?a={...t.props.color_map}:(a={},t.props.speakers.forEach((s,o)=>{const d=De[o%De.length];a[s]=Ge[d]})),a});function We(a){const s=t.props.speakers.length>0?t.props.speakers[0]:"";r(m,[...e(m).slice(0,a+1),{speaker:s,text:""},...e(m).slice(a+1)],!0),ee().then(()=>{M[a+1]&&M[a+1].focus()}),t.props.value=[...e(m)]}function Ve(a){r(m,[...e(m).slice(0,a),...e(m).slice(a+1)],!0),t.props.value=[...e(m)]}function ve(a,s,o){e(m)[a][s]=o,r(m,[...e(m)],!0),t.props.value=[...e(m)]}function se(a,s){const o=a.target||HTMLTextAreaElement;o&&!M[s]&&(M[s]=o);const d=o.selectionStart||0,_=o.value;let g=!1,p=-1;if(_[d-1]===":"){r($,s,!0),p=d;const l=Xe(_,d);r(C,t.props.tags.filter(n=>l===""||n.toLowerCase().includes(l.toLowerCase())),!0),g=e(C).length>0,r(u,0)}else{const l=_.lastIndexOf(":",d-1);if(l>=0&&!_.substring(l+1,d).includes(" ")){r($,s,!0),p=l+1;const n=_.substring(l+1,d);r(C,t.props.tags.filter(v=>n===""||v.toLowerCase().includes(n.toLowerCase())),!0),g=e(C).length>0,r(u,0)}}if(g&&p!==-1){r(h,!0);const l=o.getBoundingClientRect();if(R){const n=R.getBoundingClientRect();r(Se,n.top+l.height*(s+1.5))}}else r(h,!1);t.dispatch("input")}function Xe(a,s){const o=a.lastIndexOf(":",s-1);return o>=0?a.substring(o+1,s):""}async function Te(){const a=e(C)[e(u)];if(a){let s,o;e(c)?(o=z,s=e(I)):(o=M[e($)],s=e(m)[e($)].text);const d=o?.selectionStart||0,_=s.lastIndexOf(":",d-1);if(_>=0){const g=s.substring(0,_),p=s.substring(d);if(e(c)){const l=`${g}${a} ${p}`;r(I,l),t.props.speakers.length===0?t.props.value=l:t.props.value=await t.shared.server.unformat({text:l}),ee().then(()=>{if(z){const n=g.length+a.length+1;z.setSelectionRange(n,n),z.focus()}})}else{const l=g.replace(/\[S\d+\]/g,"").trim(),n=`${l}${a} ${p}`;ve(e($),"text",n),ee().then(()=>{const v=M[e($)];if(v){const S=l.length+a.length+1;v.setSelectionRange(S,S),v.focus()}})}}r(h,!1),r(u,0)}}async function Be(a){a=parseInt(a);const s=t.props.tags[a];if(s){let o,d;e(c)?(d=z,o=e(I)):(d=M[e($)],o=e(m)[e($)].text);const _=d?.selectionStart||0,g=o.lastIndexOf(":",_-1);if(g>=0){const p=o.substring(0,g),l=o.substring(_);if(e(c)){const n=`${p}${s} ${l}`;r(I,n),t.props.speakers.length===0?t.props.value=n:t.props.value=await t.shared.server.unformat({text:n}),ee().then(()=>{if(z){const v=p.length+s.length+1;z.setSelectionRange(v,v),z.focus()}})}else{const n=p.replace(/\[S\d+\]/g,"").trim(),v=`${n}${s} ${l}`;ve(e($),"text",v),ee().then(()=>{const S=M[e($)];if(S){const q=n.length+s.length+1;S.setSelectionRange(q,q),S.focus()}})}}r(h,!1),r(u,0)}}function Ye(a){if(e(h)){const s=a.target,o=document.getElementById("tag-menu");o&&!o.contains(s)&&r(h,!1)}}async function fe(a){return typeof a=="string"?a:await t.shared.server.format(a)}async function Ze(){if("clipboard"in navigator){const a=await fe(t.props.value);await navigator.clipboard.writeText(a),je()}}function je(){r(te,!0),de&&clearTimeout(de),de=setTimeout(()=>{r(te,!1)},1e3)}async function qe(){e(c)&&(t.props.value=await t.shared.server.unformat({text:e(I)})),t.dispatch("submit")}vt(async()=>{if(typeof t.props.value=="string")r(I,t.props.value,!0);else if(t.props.value&&t.props.value.length>0){const a=await fe(t.props.value);r(I,a,!0)}else r(I,"")});var re=Gt();O("click",ft,Ye);let Pe;var Oe=k(re);{var Fe=a=>{$t(a,{get buttons(){return e(G)},on_custom_button_click:Y,children:(s,o)=>{var d=Ue(),_=$e(d);{var g=p=>{{let l=P(()=>e(te)?bt:xt),n=P(()=>e(te)?"Copied":"Copy");mt(p,{get Icon(){return e(l)},onclick:Ze,get label(){return e(n)}})}};D(_,p=>{e(G).some(l=>typeof l=="string"&&l==="copy")&&p(g)})}y(s,d)},$$slots:{default:!0}})};D(Oe,a=>{t.shared.show_label&&(e(G).some(s=>typeof s=="string"&&s==="copy")||e(G).some(s=>typeof s!="string"))&&a(Fe)})}var Ee=E(Oe,2);ht(Ee,{get show_label(){return t.shared.show_label},get info(){return t.props.info},children:(a,s)=>{gt();var o=Ne();N(()=>ye(o,t.shared.label||"Dialogue")),y(a,o)},$$slots:{default:!0}});var Me=E(Ee,2);{var Je=a=>{var s=Bt();let o;var d=k(s);{let _=P(()=>e(j)||e(Z));Tt(d,{label:"Plain Text",get disabled(){return e(_)},get checked(){return e(c)},set checked(g){r(c,g,!0)},$$events:{click:async g=>{if(g.detail.checked){r(j,!0);try{r(I,await fe(e(m)),!0)}finally{r(j,!1)}}else{r(Z,!0);try{t.props.value=await t.shared.server.unformat({text:e(I)}),r(m,[...t.props.value],!0)}finally{r(Z,!1)}}}}})}w(s),N(()=>o=J(s,1,"switch-container top-switch svelte-1p54cvv",null,o,{"switch-disabled":e(j)||e(Z)})),y(a,s)};D(Me,a=>{t.props.ui_mode==="both"&&a(Je)})}var Re=E(Me,2);{var Ke=a=>{var s=At();let o;var d=k(s);{var _=p=>{var l=Pt();pe(3,l,()=>ce,()=>({duration:200})),y(p,l)};D(d,p=>{e(Z)&&p(_)})}var g=E(d,2);nt(g,17,()=>e(m),pt,(p,l,n)=>{var v=Rt(),S=k(v),q=k(S);{var f=i=>{var x=Ot();ke(x),N(()=>x.disabled=e(b)),we(x,()=>e(l).speaker,L=>e(l).speaker=L),y(i,x)},H=i=>{{let x=P(()=>t.props.speakers.map(L=>[L,L]));Ct(i,{label:"",show_label:!1,container:!0,interactive:!0,get value(){return e(l).speaker},get choices(){return e(x)},on_change:L=>ve(n,"speaker",L)})}};D(q,i=>{e(b)?i(f):i(H,!1)})}w(S);var Q=E(S,2),oe=k(Q),A=k(oe);ke(A),be(A,(i,x)=>M[x]=i,i=>M?.[i],()=>[n]);var ge=E(A,2);{var W=i=>{var x=Et(),L=k(x);{let F=P(()=>t.props.tags.map((X,ot)=>[X,ot])),me=P(()=>e(C).map(X=>t.props.tags.indexOf(X))),rt=P(()=>e(C).map(X=>t.props.tags.indexOf(X))[e(u)]);ze(L,{get choices(){return e(F)},get filtered_indices(){return e(me)},get active_index(){return e(rt)},show_options:!0,onchange:X=>Be(X),get offset_from_top(){return e(Se)},from_top:!0})}w(x),pe(3,x,()=>ce,()=>({duration:100})),y(i,x)};D(ge,i=>{e(h)&&e($)===n&&i(W)})}w(oe),w(Q);var le=E(Q,2);{var at=i=>{var x=Mt();let L;var F=k(x),me=k(F);kt(me),w(F),w(x),N(()=>{L=J(x,1,"svelte-1p54cvv",null,L,{"action-column":n==0,hidden:e(b)}),F.disabled=e(b)}),O("click",F,()=>We(n)),y(i,x)};D(le,i=>{(t.props.max_lines==null||t.props.max_lines&&n{it(v,`--speaker-bg-color: ${(e(b)&&(e(ae)===null||e(ae)===e(l).speaker)&&e(He)[e(l).speaker]||"transparent")??""}`),ue(A,"placeholder",t.props.placeholder),A.disabled=e(b),Ae=J(_e,1,"action-column svelte-1p54cvv",null,Ae,{hidden:e(b)||n==0}),ne.disabled=e(b)}),O("mouseenter",S,()=>e(b)&&r(ae,e(l).speaker,!0)),O("mouseleave",S,()=>e(b)&&r(ae,null)),we(A,()=>e(l).text,i=>e(l).text=i),O("input",A,i=>se(i,n)),O("focus",A,i=>se(i,n)),O("keydown",A,i=>{i.key==="Escape"&&e(h)?(r(h,!1),r(u,0),i.preventDefault()):e(h)&&e($)===n&&(i.key==="ArrowDown"?(r(u,Math.min(e(u)+1,e(C).length-1),!0),i.preventDefault()):i.key==="ArrowUp"?(r(u,Math.max(e(u)-1,0),!0),i.preventDefault()):i.key==="Enter"&&(e(C)[e(u)]&&Te(),i.preventDefault()))}),O("click",ne,()=>Ve(n)),y(p,v)}),w(s),be(s,p=>R=p,()=>R),N(()=>o=J(s,1,"dialogue-container svelte-1p54cvv",null,o,{loading:e(Z)})),y(a,s)},Qe=a=>{var s=Ue(),o=$e(s);{var d=_=>{var g=Ut();let p;var l=k(g);{var n=f=>{var H=Lt();pe(3,H,()=>ce,()=>({duration:200})),y(f,H)};D(l,f=>{e(j)&&f(n)})}var v=E(l,2);ke(v),ue(v,"rows",5),be(v,f=>z=f,()=>z);var S=E(v,2);{var q=f=>{var H=Nt(),Q=k(H);{let oe=P(()=>t.props.tags.map((W,le)=>[W,le])),A=P(()=>e(C).map(W=>t.props.tags.indexOf(W))),ge=P(()=>e(C).map(W=>t.props.tags.indexOf(W))[e(u)]);ze(Q,{get choices(){return e(oe)},get filtered_indices(){return e(A)},get active_index(){return e(ge)},show_options:!0,$$events:{change:W=>Be(W)}})}w(H),pe(3,H,()=>ce,()=>({duration:100})),y(f,H)};D(S,f=>{e(h)&&f(q)})}w(g),N(()=>{p=J(g,1,"textarea-container svelte-1p54cvv",null,p,{loading:e(j)}),ue(v,"placeholder",t.props.placeholder),v.disabled=e(b)}),we(v,()=>e(I),f=>r(I,f)),O("input",v,f=>{se(f,0),t.props.value=e(I)}),O("focus",v,f=>se(f,0)),O("keydown",v,f=>{f.key==="Escape"&&e(h)?(r(h,!1),r(u,0),f.preventDefault()):e(h)&&(f.key==="ArrowDown"?(r(u,Math.min(e(u)+1,e(C).length-1),!0),f.preventDefault()):f.key==="ArrowUp"?(r(u,Math.max(e(u)-1,0),!0),f.preventDefault()):f.key==="Enter"&&(e(C)[e(u)]&&Te(),f.preventDefault()))}),y(_,g)};D(o,_=>{(e(c)||t.props.ui_mode!=="dialogue")&&_(d)},!0)}y(a,s)};D(Re,a=>{!e(c)&&t.props.ui_mode!=="text"?a(Ke):a(Qe,!1)})}var et=E(Re,2);{var tt=a=>{var s=zt(),o=k(s),d=k(o);{var _=p=>{var l=Ne();N(()=>ye(l,t.props.submit_btn)),y(p,l)},g=p=>{wt(p)};D(d,p=>{typeof t.props.submit_btn=="string"?p(_):p(g,!1)})}w(o),w(s),N(()=>o.disabled=e(b)),O("click",o,qe),y(a,s)};D(et,a=>{t.props.submit_btn&&!e(b)&&a(tt)})}w(re),N(()=>Pe=J(re,1,"svelte-1p54cvv",null,Pe,{container:t.shared.container})),y(K,re),Ie()}var Wt=T(" ",1);function ga(K,U){Ce(U,!0);const t=ct(U,["$$slots","$$events","$$legacy"]),c=new _t(t);It(K,{get visible(){return c.shared.visible},get elem_id(){return c.shared.elem_id},get elem_classes(){return c.shared.elem_classes},get scale(){return c.shared.scale},get min_width(){return c.shared.min_width},allow_overflow:!0,get padding(){return c.shared.container},children:(b,m)=>{var G=Wt(),Y=$e(G);{var V=h=>{St(h,ut({get autoscroll(){return c.shared.autoscroll},get i18n(){return c.i18n}},()=>c.shared.loading_status,{on_clear_status:()=>c.dispatch("clear_status",c.shared.loading_status)}))};D(Y,h=>{c.shared.loading_status&&h(V)})}var R=E(Y,2);Ht(R,{get gradio(){return c}}),y(b,G)},$$slots:{default:!0}}),Ie()}export{Ht as BaseDialogue,ha as BaseExample,ga as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-pc9XuoeO.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-pc9XuoeO.css new file mode 100644 index 0000000000000000000000000000000000000000..26d6c63ac21db1aac03e18c4066f4506e05bd9bd --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-pc9XuoeO.css @@ -0,0 +1 @@ +label.svelte-19qdtil{display:flex;align-items:center;transition:var(--button-transition);cursor:pointer;box-shadow:var(--checkbox-label-shadow);border:var(--checkbox-label-border-width) solid var(--checkbox-label-border-color);border-radius:var(--checkbox-border-radius);background:var(--checkbox-label-background-fill);padding:var(--checkbox-label-padding);color:var(--checkbox-label-text-color);font-weight:var(--checkbox-label-text-weight);font-size:var(--checkbox-label-text-size);line-height:var(--line-md)}label.svelte-19qdtil:hover{background:var(--checkbox-label-background-fill-hover);transform:var(--button-transform-hover);box-shadow:var( --checkbox-label-shadow-hover, var(--checkbox-label-shadow) )}label.svelte-19qdtil:active{transform:var(--button-transform-active);box-shadow:var( --checkbox-label-shadow-active, var(--checkbox-label-shadow) )}label.svelte-19qdtil:focus{background:var(--checkbox-label-background-fill-focus)}label.selected.svelte-19qdtil{background:var(--checkbox-label-background-fill-selected);color:var(--checkbox-label-text-color-selected);border-color:var(--checkbox-label-border-color-selected)}label.svelte-19qdtil>:where(.svelte-19qdtil)+:where(.svelte-19qdtil){margin-left:var(--size-2)}label.rtl.svelte-19qdtil>:where(.svelte-19qdtil)+:where(.svelte-19qdtil){margin-left:0;margin-right:var(--size-2)}input.svelte-19qdtil{--ring-color: transparent;position:relative;box-shadow:var(--checkbox-shadow);border:var(--checkbox-border-width) solid var(--checkbox-border-color);border-radius:var(--radius-full);background-color:var(--checkbox-background-color);line-height:var(--line-sm)}input.svelte-19qdtil:checked,input.svelte-19qdtil:checked:hover{border-color:var(--checkbox-border-color-selected);background-image:var(--radio-circle);background-color:var(--checkbox-background-color-selected)}input.svelte-19qdtil:checked:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);border-radius:50%;background-color:#fff}input.svelte-19qdtil:hover:not([disabled]){border-color:var(--checkbox-border-color-hover);background-color:var(--checkbox-background-color-hover)}input.svelte-19qdtil:focus:not([disabled]){border-color:var(--checkbox-border-color-focus);background-color:var(--checkbox-background-color-focus)}input.svelte-19qdtil:checked:focus:not([disabled]){border-color:var(--checkbox-border-color-focus);background-image:var(--radio-circle);background-color:var(--checkbox-background-color-selected)}input[disabled].svelte-19qdtil,.disabled.svelte-19qdtil{cursor:not-allowed}input[disabled].svelte-19qdtil{opacity:.75}.wrap.svelte-e4x47i{display:flex;flex-wrap:wrap;gap:var(--checkbox-label-gap)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-qHbt41US.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-qHbt41US.js new file mode 100644 index 0000000000000000000000000000000000000000..ce8b2045b2aaa401056447a57c071872f1472ca7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-qHbt41US.js @@ -0,0 +1 @@ +import{i as x,r as w,g as $}from"./i18n-Dnhn5Rxr.js";import{R as y,u as k,v as T,y as B,S,w as a,a as G,X as E,a5 as o,T as I,x as M,M as u,W as P}from"./index-DWyDLubb.js";import{s as R}from"./clone-BkeCM4Nl.js";import{T as W}from"./Textbox-BuFR2fNz.js";import{S as X}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{B as j}from"./Block-J4oodUWp.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{G as q}from"./utils.svelte-CCyS_0CY.js";import{default as mt}from"./Example-BC6WbF6q.js";import"./actions-CLThs9VH.js";import"./input-DrerMDOL.js";import"./BlockTitle-BMm9LakX.js";import"./Info-Dzjhnd64.js";import"./html-Ih_5QVTo.js";import"./Check-DUAHzS2-.js";import"./Copy-ChCbTvli.js";import"./Send-B_rl9Hxa.js";import"./Square-CcB54dqq.js";import"./IconButtonWrapper-D0s9l4wW.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./index-B_pwUImq.js";import"./size-CtOeLwIl.js";/* empty css */var z=P(" ",1);function ut(d,p){y(p,!0);let c=w(p,["$$slots","$$events","$$legacy"]);const t=new q(c);let m=o(()=>t.shared.label||"Textbox");t.props.value=t.props.value??"";let n=k(T(t.props.value));async function h(){a(n)!==t.props.value&&(M(n,t.props.value,!0),await u(),t.dispatch("change",R(t.props.value)))}async function _(e){!t.shared||!t.props||(t.props.validation_error=null,t.props.value=e,await u(),t.dispatch("input"))}B(()=>{h()});function g(e){!t.shared||!t.props||(t.props.validation_error=null,t.props.value=e)}j(d,{get visible(){return t.shared.visible},get elem_id(){return t.shared.elem_id},get elem_classes(){return t.shared.elem_classes},get scale(){return t.shared.scale},get min_width(){return t.shared.min_width},allow_overflow:!1,get padding(){return t.shared.container},get rtl(){return t.props.rtl},children:(e,A)=>{var i=z(),l=S(i);{var f=s=>{X(s,$({get autoscroll(){return t.shared.autoscroll},get i18n(){return t.i18n}},()=>t.shared.loading_status,{show_validation_error:!1,on_clear_status:()=>t.dispatch("clear_status",t.shared.loading_status)}))};x(l,s=>{t.shared.loading_status&&s(f)})}var v=E(l,2);{let s=o(()=>t.shared?.loading_status?.validation_error||t.shared?.validation_error),b=o(()=>!t.shared.interactive);W(v,{get label(){return a(m)},get info(){return t.props.info},get show_label(){return t.shared.show_label},get lines(){return t.props.lines},get type(){return t.props.type},get rtl(){return t.props.rtl},get text_align(){return t.props.text_align},get max_lines(){return t.props.max_lines},get placeholder(){return t.props.placeholder},get submit_btn(){return t.props.submit_btn},get stop_btn(){return t.props.stop_btn},get buttons(){return t.props.buttons},get autofocus(){return t.props.autofocus},get container(){return t.shared.container},get autoscroll(){return t.shared.autoscroll},get max_length(){return t.props.max_length},get html_attributes(){return t.props.html_attributes},get validation_error(){return a(s)},onchange:g,oninput:_,onsubmit:()=>{t.shared.validation_error=null,t.dispatch("submit")},onblur:()=>t.dispatch("blur"),onselect:r=>t.dispatch("select",r),onfocus:()=>t.dispatch("focus"),onstop:()=>t.dispatch("stop"),oncopy:r=>t.dispatch("copy",r),oncustombuttonclick:r=>{t.dispatch("custom_button_click",{id:r})},get disabled(){return a(b)},get value(){return t.props.value},set value(r){t.props.value=r}})}G(e,i)},$$slots:{default:!0}}),I()}export{mt as BaseExample,W as BaseTextbox,ut as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-vigNnD5c.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-vigNnD5c.js new file mode 100644 index 0000000000000000000000000000000000000000..1d57601bb4e33f8948b03a1cf0a34cefb203829d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-vigNnD5c.js @@ -0,0 +1 @@ +import{r as p}from"./i18n-Dnhn5Rxr.js";import{R as l,a7 as u,t as d,a as m,w as c,T as g,a5 as _,a0 as h,a8 as v}from"./index-DWyDLubb.js";import{G as f}from"./utils.svelte-CCyS_0CY.js";import{B as $}from"./Button-D-_s2ksk.js";import"./clone-BkeCM4Nl.js";import"./snippet-BWgYNF9D.js";import"./Image-CeW7PJs4.js";import"./misc-vsnLZ-Y1.js";/* empty css */import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";/* empty css */function j(s,t){l(t,!0);let a=p(t,["$$slots","$$events","$$legacy"]);const e=new f(a);function i(){e.dispatch("click")}{let o=_(()=>!e.shared.interactive);$(s,{get value(){return e.props.value},get variant(){return e.props.variant},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get size(){return e.props.size},get scale(){return e.shared.scale},get link(){return e.props.link},get icon(){return e.props.icon},get min_width(){return e.shared.min_width},get visible(){return e.shared.visible},get disabled(){return c(o)},get link_target(){return e.props.link_target},onclick:i,children:(n,k)=>{v();var r=u();d(()=>h(r,e.props.value??"")),m(n,r)},$$slots:{default:!0}})}g()}export{$ as BaseButton,j as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-wgdu9Zy3.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-wgdu9Zy3.css new file mode 100644 index 0000000000000000000000000000000000000000..3e6623ef0f65bc07626f7543f5d2b43379ae5f69 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-wgdu9Zy3.css @@ -0,0 +1 @@ +.selection-button.svelte-fit6p6{position:absolute;background:var(--color-accent);width:var(--size-3);height:var(--size-5);color:var(--background-fill-primary)}.selection-button-column.svelte-fit6p6{top:-15px;left:50%;transform:translate(-50%) rotate(90deg);border-radius:var(--radius-sm) 0 0 var(--radius-sm)}.selection-button-row.svelte-fit6p6{left:calc(var(--size-2-5) * -1);top:50%;transform:translateY(-50%);border-radius:var(--radius-sm) 0 0 var(--radius-sm)}.move-down.svelte-fit6p6{bottom:-14px;top:auto;border-radius:0 var(--radius-sm) var(--radius-sm) 0}.move-right.svelte-fit6p6{left:auto;right:calc(var(--size-2-5) * -1);top:50%;transform:translateY(-50%);border-radius:0 var(--radius-sm) var(--radius-sm) 0}svg.svelte-fit6p6{fill:currentColor}span.svelte-fit6p6{display:flex;width:100%;height:100%}.up.svelte-fit6p6{transform:rotate(-90deg)}.down.svelte-fit6p6{transform:rotate(90deg)}.left.svelte-fit6p6{transform:rotate(-90deg)}.right.svelte-fit6p6{transform:rotate(90deg)}.bool-cell.svelte-1d51ufy{display:flex;align-items:center;justify-content:center;width:min-content;height:var(--size-full)}.bool-cell.svelte-1d51ufy input:disabled{cursor:not-allowed}.bool-cell.svelte-1d51ufy label{margin:0;width:100%;display:flex;justify-content:center;align-items:center}.bool-cell.svelte-1d51ufy span{display:none}.dragging.svelte-odwpey{cursor:crosshair!important}textarea.svelte-odwpey{position:absolute;flex:1 1 0%;transform:translate(.2px,-.5px);outline:none;border:none;background:transparent;cursor:text;width:calc(100% - var(--size-2));resize:none;height:100%;padding-left:0;font-size:inherit;font-weight:inherit;line-height:var(--line-lg);left:var(--size-2);user-select:text}textarea.svelte-odwpey:focus{outline:none}textarea.pad_left.svelte-odwpey{margin-left:var(--size-7)}span.svelte-odwpey{flex:1 1 0%;position:relative;display:block;outline:none;cursor:text;width:100%;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.header.svelte-odwpey{font-weight:var(--weight-bold)}span.text.expanded.svelte-odwpey{height:auto;min-height:100%;white-space:pre-wrap;word-break:break-word;overflow:visible}.edit.svelte-odwpey{opacity:0;pointer-events:none}span.svelte-odwpey img{max-height:100px;max-width:100%;height:auto;width:auto;object-fit:contain}textarea.svelte-odwpey:read-only{cursor:not-allowed}.wrap.svelte-odwpey,.wrap.expanded.svelte-odwpey{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:break-word;word-break:break-word}.cell-menu-button.svelte-j6wkfp{flex-shrink:0;display:none;align-items:center;justify-content:center;background-color:var(--block-background-fill);border:1px solid var(--border-color-primary);border-radius:var(--block-radius);width:var(--size-5);height:var(--size-5);min-width:var(--size-5);padding:0;margin-right:var(--spacing-sm);z-index:2;position:absolute;right:var(--size-1);top:50%;transform:translateY(-50%)}.wrapper.svelte-4dxgzr{display:flex;align-items:center;justify-content:center}.header-cell.svelte-1d6xqpb{--ring-color: transparent;position:relative;background:var(--table-even-background-fill)!important;font-weight:var(--weight-bold, 700);outline:none;box-shadow:inset 1px 0 0 var(--border-color-primary),inset 0 0 0 1px var(--ring-color);padding:0;overflow:visible;box-sizing:border-box}.header-cell.first-column.svelte-1d6xqpb{box-shadow:inset 0 0 0 1px var(--ring-color)}.header-cell.svelte-1d6xqpb:hover .cell-menu-button,.header-cell.focus.svelte-1d6xqpb .cell-menu-button{display:flex}.header-cell.focus.svelte-1d6xqpb{--ring-color: var(--color-accent);--sel-top: inset 0 2px 0 0 var(--ring-color);--sel-bottom: inset 0 -2px 0 0 var(--ring-color);--sel-left: inset 2px 0 0 0 var(--ring-color);--sel-right: inset -2px 0 0 0 var(--ring-color);box-shadow:var(--sel-top),var(--sel-bottom),var(--sel-left),var(--sel-right);z-index:2;position:relative}.header-cell.focus.first-column.svelte-1d6xqpb{box-shadow:inset 0 0 0 2px var(--ring-color)}.header-content.svelte-1d6xqpb{display:flex;align-items:center;gap:var(--size-3);overflow:hidden;min-width:0}.header-icons.svelte-1d6xqpb{display:flex;align-items:center;gap:2px;flex-shrink:0;margin-left:auto;opacity:.6}.sort-indicator.svelte-1d6xqpb{display:flex;align-items:center;position:relative;margin-left:-5px}.sort-priority.svelte-1d6xqpb{font-size:8px;background:var(--button-secondary-background-fill);border-radius:var(--radius-full);width:12px;height:12px;display:flex;align-items:center;justify-content:center;line-height:1}.filter-indicator.svelte-1d6xqpb{display:flex;align-items:center;width:16px;height:16px;margin-top:3px}.filter-indicator.svelte-1d6xqpb svg{width:100%;height:100%}.cell-wrap.svelte-1d6xqpb{display:flex;align-items:center;justify-content:flex-start;outline:none;min-height:var(--size-9);position:relative;height:100%;padding:var(--size-2);box-sizing:border-box;gap:var(--size-1);overflow:visible;min-width:0}.select-all-checkbox.svelte-1d6xqpb{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:var(--size-4)}.select-all-checkbox.svelte-1d6xqpb label{margin:0}.select-all-checkbox.svelte-1d6xqpb span{display:none}.body-cell.svelte-183k2ki{--ring-color: transparent;outline:none;box-shadow:inset 1px 0 0 var(--border-color-primary),inset 0 0 0 1px var(--ring-color);padding:0;overflow:hidden;box-sizing:border-box;user-select:none;min-width:0}.body-cell.static.svelte-183k2ki{user-select:text}.body-cell.first-column.svelte-183k2ki{box-shadow:inset 0 0 0 1px var(--ring-color)}.body-cell.svelte-183k2ki:hover .cell-menu-button,.body-cell.cell-selected.svelte-183k2ki .cell-menu-button{display:flex}.body-cell.cell-selected.svelte-183k2ki{--ring-color: var(--color-accent);--sel-top: inset 0 2px 0 0 var(--ring-color);--sel-bottom: inset 0 -2px 0 0 var(--ring-color);--sel-left: inset 2px 0 0 0 var(--ring-color);--sel-right: inset -2px 0 0 0 var(--ring-color);box-shadow:var(--sel-top),var(--sel-bottom),var(--sel-left),var(--sel-right);z-index:2;position:relative}.body-cell.cell-solo.svelte-183k2ki{z-index:10;overflow:visible}.body-cell.cell-solo.svelte-183k2ki .cell-wrap:where(.svelte-183k2ki){overflow:visible}.body-cell.cell-solo.svelte-183k2ki .cell-wrap>span{position:absolute;top:0;left:0;width:100%;min-height:100%;padding:var(--size-2);box-sizing:border-box;white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:break-word;word-break:break-word;background:var(--background-fill-primary);box-shadow:inset 0 2px 0 0 var(--color-accent),inset 0 -2px 0 0 var(--color-accent),inset 2px 0 0 0 var(--color-accent),inset -2px 0 0 0 var(--color-accent),0 6px 12px -4px #00000038;z-index:1}.body-cell.cell-solo.svelte-183k2ki .cell-wrap>textarea{position:absolute;top:0;left:0;width:100%;min-height:100%;padding:var(--size-2);padding-left:var(--size-2);margin:0;box-sizing:border-box;transform:none;background:var(--background-fill-primary);box-shadow:inset 0 2px 0 0 var(--color-accent),inset 0 -2px 0 0 var(--color-accent),inset 2px 0 0 0 var(--color-accent),inset -2px 0 0 0 var(--color-accent),0 6px 12px -4px #00000038;z-index:2;field-sizing:content;height:auto}.body-cell.cell-solo.svelte-183k2ki .selection-button{z-index:3}.body-cell.cell-selected.no-top.svelte-183k2ki{--sel-top: inset 0 0 0 0 transparent}.body-cell.cell-selected.no-bottom.svelte-183k2ki{--sel-bottom: inset 0 0 0 0 transparent}.body-cell.cell-selected.no-left.svelte-183k2ki{--sel-left: inset 0 0 0 0 transparent}.body-cell.cell-selected.no-right.svelte-183k2ki{--sel-right: inset 0 0 0 0 transparent}.body-cell.flash.cell-selected.svelte-183k2ki{animation:svelte-183k2ki-flash-color .7s ease-out}@keyframes svelte-183k2ki-flash-color{0%,30%{background:var(--color-accent-copied)}to{background:transparent}}.cell-wrap.svelte-183k2ki{display:flex;align-items:center;justify-content:flex-start;outline:none;min-height:var(--size-9);position:relative;padding:var(--size-2);box-sizing:border-box;gap:var(--size-1);overflow:hidden;min-width:0;height:100%}.add-row-button.svelte-1at77md{width:100%;padding:var(--size-1);background:transparent;border:1px dashed var(--border-color-primary);border-radius:var(--radius-sm);color:var(--body-text-color);cursor:pointer;transition:all .15s;margin-top:var(--size-2);z-index:10;position:relative;pointer-events:auto}.add-row-button.svelte-1at77md:hover{background:var(--background-fill-secondary);border-style:solid}.background.svelte-1y6dxc7{position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:#0006;z-index:20}.filter-menu.svelte-1y6dxc7{position:fixed;background:var(--background-fill-primary);border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);padding:var(--size-2);display:flex;flex-direction:column;gap:var(--size-2);box-shadow:var(--shadow-drop-lg);width:300px;z-index:21}.filter-datatype-container.svelte-1y6dxc7{display:flex;gap:var(--size-2);align-items:center}.filter-menu.svelte-1y6dxc7 span:where(.svelte-1y6dxc7){font-size:var(--text-sm);color:var(--body-text-color)}.filter-menu.svelte-1y6dxc7 button:where(.svelte-1y6dxc7){height:var(--size-6);background:none;border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);padding:var(--size-1) var(--size-2);color:var(--body-text-color);font-size:var(--text-sm);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:var(--size-2)}.filter-menu.svelte-1y6dxc7 button:where(.svelte-1y6dxc7):hover{background-color:var(--background-fill-secondary)}.filter-input.svelte-1y6dxc7{width:var(--size-full);height:var(--size-6);padding:var(--size-2);padding-right:var(--size-8);border:1px solid var(--border-color-primary);border-radius:var(--table-radius);font-size:var(--text-sm);color:var(--body-text-color);background:var(--background-fill-secondary);transition:all .2s ease}.filter-input.svelte-1y6dxc7:hover{border-color:var(--border-color-secondary);background:var(--background-fill-primary)}.filter-input.svelte-1y6dxc7:focus{outline:none;border-color:var(--color-accent);background:var(--background-fill-primary);box-shadow:0 0 0 1px var(--color-accent)}.dropdown-filter-options.svelte-1y6dxc7{display:flex;flex-direction:column;background:var(--background-fill-primary);border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);box-shadow:var(--shadow-drop-md);position:absolute;z-index:var(--layer-1)}.dropdown-filter-options.svelte-1y6dxc7 .filter-option:where(.svelte-1y6dxc7){border:none;justify-content:flex-start}.input-container.svelte-1y6dxc7{display:flex;gap:var(--size-2);align-items:center}.input-container.svelte-1y6dxc7 button:where(.svelte-1y6dxc7){width:130px}svg.dropdown-arrow{width:var(--size-4);height:var(--size-4);margin-left:auto}.filter-menu.svelte-1y6dxc7 .check-button:where(.svelte-1y6dxc7){background:var(--color-accent);color:#fff;border:none;width:var(--size-full);height:var(--size-6);border-radius:var(--radius-sm);display:flex;align-items:center;justify-content:center;padding:var(--size-1)}.check-button.svelte-1y6dxc7:hover{background:var(--color-accent-soft)}.cell-menu.svelte-1v4jjjx{position:fixed;z-index:var(--layer-1);background:var(--background-fill-primary);border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);padding:var(--size-1);display:flex;flex-direction:column;gap:var(--size-1);box-shadow:var(--shadow-drop-lg);min-width:150px;width:max-content}.cell-menu.svelte-1v4jjjx button:where(.svelte-1v4jjjx){background:none;border:none;cursor:pointer;text-align:left;padding:var(--size-1) var(--size-2);border-radius:var(--radius-sm);color:var(--body-text-color);font-size:var(--text-sm);transition:background-color .2s,color .2s;display:flex;align-items:center;gap:var(--size-2);position:relative}.cell-menu.svelte-1v4jjjx button.active:where(.svelte-1v4jjjx){background-color:var(--background-fill-secondary)}.cell-menu.svelte-1v4jjjx button:where(.svelte-1v4jjjx):hover{background-color:var(--background-fill-secondary)}.cell-menu.svelte-1v4jjjx button:where(.svelte-1v4jjjx) svg{fill:currentColor;transition:fill .2s}.priority.svelte-1v4jjjx{display:flex;align-items:center;justify-content:center;margin-left:auto;font-size:var(--size-2);background-color:var(--button-secondary-background-fill);color:var(--body-text-color);border-radius:var(--radius-sm);width:var(--size-2-5);height:var(--size-2-5)}.toolbar.svelte-1rajnm3{display:flex;align-items:center;gap:var(--size-2);flex:0 0 auto;font-family:var(--font-sans)}.toolbar-buttons.svelte-1rajnm3{display:flex;gap:var(--size-1);flex-wrap:nowrap;align-items:center}.toolbar-button.svelte-1rajnm3{display:flex;align-items:center;justify-content:center;width:var(--size-6);height:var(--size-6);padding:var(--size-1);border:none;border-radius:var(--radius-sm);background:transparent;color:var(--body-text-color-subdued);cursor:pointer;transition:all .2s}.toolbar-button.svelte-1rajnm3:hover{background:var(--background-fill-secondary);color:var(--body-text-color)}.toolbar-button.svelte-1rajnm3 svg{width:var(--size-4);height:var(--size-4)}.search-container.svelte-1rajnm3{position:relative}.search-input.svelte-1rajnm3{width:var(--size-full);height:var(--size-6);padding:var(--size-2);padding-right:var(--size-8);border:1px solid var(--border-color-primary);border-radius:var(--table-radius);font-size:var(--text-sm);color:var(--body-text-color);background:var(--background-fill-secondary);transition:all .2s ease}.search-input.svelte-1rajnm3:hover{border-color:var(--border-color-secondary);background:var(--background-fill-primary)}.search-input.svelte-1rajnm3:focus{outline:none;border-color:var(--color-accent);background:var(--background-fill-primary);box-shadow:0 0 0 1px var(--color-accent)}.check-button.svelte-1rajnm3{position:absolute;right:var(--size-1);top:50%;transform:translateY(-50%);background:var(--color-accent);color:#fff;border:none;width:var(--size-4);height:var(--size-4);border-radius:var(--radius-sm);display:flex;align-items:center;justify-content:center;padding:var(--size-1)}.check-button.svelte-1rajnm3 svg{width:var(--size-3);height:var(--size-3)}.check-button.svelte-1rajnm3:hover{background:var(--color-accent-soft)}.toolbar-buttons.svelte-1rajnm3 .icon-button{background:transparent!important;height:var(--size-6);width:var(--size-6)}.toolbar-buttons.svelte-1rajnm3 .icon-button:hover{background:var(--background-fill-secondary)!important;color:var(--body-text-color)!important;border:1px solid var(--border-color-primary);border-radius:var(--radius-sm)!important}.table-container.svelte-2balj6{display:flex;flex-direction:column;gap:var(--size-2);position:relative;max-width:100%;overflow-x:hidden}.table-container.fullscreen.svelte-2balj6{padding:var(--size-4);height:100%;box-sizing:border-box}.table-container.fullscreen.svelte-2balj6 .table-wrap:where(.svelte-2balj6){flex:1 1 auto;min-height:0;display:flex;flex-direction:column}.table-container.fullscreen.svelte-2balj6 .table-wrap:where(.svelte-2balj6)>*{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}.table-container.fullscreen.svelte-2balj6 .virtual-table-viewport:where(.svelte-2balj6){max-height:none!important;flex:1 1 auto;min-height:0}.table-wrap.svelte-2balj6{position:relative;transition:.15s;width:100%}.table-wrap.svelte-2balj6>*{max-width:100%}.table-wrap.menu-open.svelte-2balj6{overflow:hidden}.table-wrap.svelte-2balj6:focus-within{outline:none}.table-wrap.dragging.svelte-2balj6{cursor:crosshair!important;user-select:none}.table-wrap.dragging.svelte-2balj6 :where(.svelte-2balj6){cursor:crosshair!important;user-select:none}.table-wrap.svelte-2balj6>button{border:1px solid var(--border-color-primary);border-radius:var(--table-radius);overflow:hidden}.virtual-table-viewport.svelte-2balj6{display:flex;flex-direction:column;overflow:auto;position:relative;-webkit-overflow-scrolling:touch;min-width:0;max-width:100%;scrollbar-width:thin;scrollbar-color:rgba(128,128,128,.5) transparent}.virtual-table-viewport.svelte-2balj6::-webkit-scrollbar{width:4px;height:4px}.virtual-table-viewport.svelte-2balj6::-webkit-scrollbar-thumb{background-color:#80808080;border-radius:4px}.virtual-table-viewport.svelte-2balj6:hover{scrollbar-color:rgba(160,160,160,.7) transparent}.virtual-table-viewport.disable-scroll.svelte-2balj6{overflow:hidden!important}.header-table.svelte-2balj6{width:100%;color:var(--body-text-color);font-size:var(--input-text-size);line-height:var(--line-md);font-family:var(--font-mono);border-spacing:0;border-collapse:separate;table-layout:auto;position:sticky;top:0;z-index:7;flex-shrink:0}.sizing-body.svelte-2balj6 tr:where(.svelte-2balj6){visibility:collapse}.sizing-body.svelte-2balj6 td:where(.svelte-2balj6){padding:var(--size-2);border:none;white-space:nowrap;max-width:var(--df-max-col-width);overflow:hidden}.header-table.svelte-2balj6 .header-cell{max-width:var(--df-max-col-width)}.virtual-body.svelte-2balj6{box-sizing:border-box}.virtual-row.svelte-2balj6{display:flex;align-items:stretch;background:var(--table-odd-background-fill);text-align:left;font-size:var(--input-text-size);line-height:var(--line-md);font-family:var(--font-mono);color:var(--body-text-color);min-height:var(--size-9)}.virtual-row.svelte-2balj6:last-child{border-bottom:none}.virtual-row.row-odd.svelte-2balj6{background:var(--table-even-background-fill)}.virtual-row.svelte-2balj6:hover{background:var(--table-row-focus)}.cell-wrap.svelte-2balj6{display:flex;align-items:center;justify-content:flex-start;outline:none;min-height:var(--size-9);position:relative;height:100%;padding:var(--size-2);box-sizing:border-box;gap:var(--size-1);overflow:visible;min-width:0}.row-number-header.svelte-2balj6{text-align:center;padding:var(--size-1);min-width:var(--size-12);width:var(--size-12);font-weight:var(--weight-semibold);border-right:1px solid var(--border-color-primary);background:var(--table-even-background-fill)!important}.row-number-cell.svelte-2balj6{text-align:center;padding:var(--size-1);min-width:var(--size-12);width:var(--size-12);flex-shrink:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:var(--weight-semibold);border-right:1px solid var(--border-color-primary);display:flex;align-items:center;justify-content:center}.header-row.svelte-2balj6{display:flex;justify-content:flex-end;align-items:center;gap:var(--size-2);min-height:var(--size-6);flex-wrap:nowrap;width:100%}.header-row.svelte-2balj6 .label:where(.svelte-2balj6){flex:1 1 auto;margin-right:auto;font-family:var(--font-sans)}.header-row.svelte-2balj6 .label:where(.svelte-2balj6) p:where(.svelte-2balj6){margin:0;color:var(--block-label-text-color);font-size:var(--block-label-text-size);line-height:var(--line-sm)}.scroll-top-button.svelte-2balj6{position:absolute;right:var(--size-4);bottom:var(--size-4);width:var(--size-8);height:var(--size-8);border-radius:var(--table-radius);background:var(--color-accent);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:var(--text-lg);z-index:9;opacity:.5}.scroll-top-button.svelte-2balj6:hover{opacity:1} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-yEtVDF00.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-yEtVDF00.js new file mode 100644 index 0000000000000000000000000000000000000000..87c850b37391d5be8bc07b4e8718f85ae0b03859 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index-yEtVDF00.js @@ -0,0 +1 @@ +import{g,i as l,r as f}from"./i18n-Dnhn5Rxr.js";import{R as b,S as v,w as $,a as k,X as s,a5 as x,T as w,W as I}from"./index-DWyDLubb.js";import{G as B}from"./utils.svelte-CCyS_0CY.js";import{B as C}from"./Block-J4oodUWp.js";import{I as S}from"./Info-Dzjhnd64.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{I as G}from"./IconButtonWrapper-D0s9l4wW.js";import{S as W}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{C as y}from"./Checkbox-HhbcVSTv.js";import"./clone-BkeCM4Nl.js";import"./html-Ih_5QVTo.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./index-B_pwUImq.js";import"./input-DrerMDOL.js";import"./universal-CFOISHmx.js";var P=I(" ",1);function U(u,o){b(o,!0);let c=f(o,["$$slots","$$events","$$legacy"]);const t=new B(c);C(u,{get visible(){return t.shared.visible},get elem_id(){return t.shared.elem_id},get elem_classes(){return t.shared.elem_classes},children:(d,R)=>{var a=P(),i=v(a);W(i,g({get autoscroll(){return t.shared.autoscroll},get i18n(){return t.i18n}},()=>t.shared.loading_status,{on_clear_status:()=>t.dispatch("clear_status",t.shared.loading_status)}));var n=s(i,2);{var m=e=>{G(e,{get buttons(){return t.props.buttons},on_custom_button_click:r=>{t.dispatch("custom_button_click",{id:r})}})};l(n,e=>{t.shared.show_label&&t.props.buttons&&t.props.buttons.length>0&&e(m)})}var p=s(n,2);{let e=x(()=>t.shared.label||t.i18n("checkbox.checkbox"));y(p,{get label(){return $(e)},get interactive(){return t.shared.interactive},get show_label(){return t.shared.show_label},on_change:r=>t.dispatch("change",r),on_input:()=>t.dispatch("input"),on_select:r=>t.dispatch("select",r),get value(){return t.props.value},set value(r){t.props.value=r}})}var _=s(p,2);{var h=e=>{S(e,{get info(){return t.props.info}})};l(_,e=>{t.props.info&&e(h)})}k(d,a)},$$slots:{default:!0}}),w()}export{y as BaseCheckbox,U as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index.svelte_svelte_type_style_lang-BKODC18H.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index.svelte_svelte_type_style_lang-BKODC18H.js new file mode 100644 index 0000000000000000000000000000000000000000..3d7e1f653bf65cc8a2ae8a67435026776b67c770 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index.svelte_svelte_type_style_lang-BKODC18H.js @@ -0,0 +1 @@ +import{i as x,s as y,d as B,a as S,b as j,f as k,g as p}from"./i18n-Dnhn5Rxr.js";import{R as q,t as C,w as e,a as R,T,a5 as a,X as V,W,V as X,Y}from"./index-DWyDLubb.js";import{S as z}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";var A=W("
          ");function H(u,t){q(t,!0);let n,c=a(()=>t.scale??null),_=a(()=>t.min_width??0),v=a(()=>t.elem_id??""),f=a(()=>t.elem_classes??[]),g=a(()=>t.visible??!0),r=a(()=>t.variant??"default"),i=a(()=>t.loading_status);var s=A();let d,m;var o=X(s);{var h=l=>{{let w=a(()=>e(i)?e(i).status=="pending"?"generating":e(i).status:null);z(l,p({get autoscroll(){return t.autoscroll},get i18n(){return t.i18n}},()=>e(i),{get status(){return e(w)}}))}};x(o,l=>{e(i)&&e(i).show_progress&&l(h)})}var b=V(o,2);y(b,t,"default",{}),Y(s),B(s,l=>n=l,()=>n),C(l=>{S(s,"id",e(v)),d=j(s,1,`column ${l??""}`,"svelte-siq5d6",d,{compact:e(r)==="compact",panel:e(r)==="panel",hide:!e(g)}),m=k(s,"",m,{"flex-grow":e(c),"min-width":`calc(min(${e(_)??""}px, 100%))`})},[()=>e(f).join(" ")]),R(u,s),T()}export{H as B}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index.svelte_svelte_type_style_lang-D9os8tfr.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index.svelte_svelte_type_style_lang-D9os8tfr.js new file mode 100644 index 0000000000000000000000000000000000000000..f0c658d3674196bd1236cbf6662486cbc617047c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Index.svelte_svelte_type_style_lang-D9os8tfr.js @@ -0,0 +1 @@ +import{p as t,i as X,b as Y,a as q,f as A}from"./i18n-Dnhn5Rxr.js";import{R as D,y as E,t as F,a as G,T as H,X as J,W as K,V as L,w as n,a5 as _,Y as N,u as O,x as h}from"./index-DWyDLubb.js";import{a as Q}from"./actions-CLThs9VH.js";import{c as g,a as S}from"./utils.svelte-CCyS_0CY.js";import{C as U}from"./Check-DUAHzS2-.js";import{C as Z}from"./Copy-ChCbTvli.js";import{I as $}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{I as ee}from"./IconButtonWrapper-D0s9l4wW.js";import{M as te}from"./MarkdownCode-B8HQ3LiU.js";var ae=K('
          ');function ce(v,e){D(e,!0);let b=t(e,"elem_classes",19,()=>[]),k=t(e,"visible",3,!0),o=t(e,"min_height",3,void 0),y=t(e,"rtl",3,!1),w=t(e,"sanitize_html",3,!0),x=t(e,"line_breaks",3,!1),C=t(e,"latex_delimiters",19,()=>[]),I=t(e,"header_links",3,!1),d=t(e,"height",3,void 0),z=t(e,"show_copy_button",3,!1),M=t(e,"loading_status",3,void 0),T=t(e,"onchange",3,()=>{}),p=t(e,"oncopy",3,i=>{}),s=O(!1),l;E(()=>{e.value&&T()()});async function j(){"clipboard"in navigator&&(await navigator.clipboard.writeText(e.value),p()({value:e.value}),B())}function B(){h(s,!0),l&&clearTimeout(l),l=setTimeout(()=>{h(s,!1)},1e3)}var a=ae();let m,u;var c=L(a);{var W=i=>{ee(i,{children:(r,f)=>{{let R=_(()=>n(s)?U:Z),V=_(()=>n(s)?"Copied conversation":"Copy conversation");$(r,{get Icon(){return n(R)},onclick:j,get label(){return n(V)}})}},$$slots:{default:!0}})};X(c,i=>{z()&&i(W)})}var P=J(c,2);te(P,{get message(){return e.value},get latex_delimiters(){return C()},get sanitize_html(){return w()},get line_breaks(){return x()},chatbot:!1,get header_links(){return I()},get theme_mode(){return e.theme_mode}}),N(a),Q(a,i=>S?.(i)),F((i,r,f)=>{m=Y(a,1,`prose ${i??""}`,"svelte-1xjkzpp",m,{hide:!k()}),q(a,"dir",y()?"rtl":"ltr"),u=A(a,r,u,f),a.dir=a.dir},[()=>b()?.join(" ")||"",()=>d()?`max-height: ${g(d())}; overflow-y: auto;`:"",()=>({"min-height":o()&&M()?.status!=="pending"?g(o()):void 0})]),G(v,a),H()}export{ce as M}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Info-Dzjhnd64.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Info-Dzjhnd64.js new file mode 100644 index 0000000000000000000000000000000000000000..1e8db4ef0a09d7422b132f177417ecd2ae5a638f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Info-Dzjhnd64.js @@ -0,0 +1 @@ +import{p,e as _}from"./i18n-Dnhn5Rxr.js";import{R as i,G as o,z as f,a as m,T as g,U as u,V as E,W as R,Y as d}from"./index-DWyDLubb.js";import{h}from"./html-Ih_5QVTo.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";const I=/`([^`]+)`/g,$=/\[([^\]]+)\]\(([^)]+)\)/g,v=/\*\*(.+?)\*\*/g,O=/__(.+?)__/g,L=/\*(.+?)\*/g,S=/(?/g,">").replace(/"/g,""")}function k(r,e,t){const n=t.trim();return C.test(n)?/^https?:/i.test(n)?`${e}`:e:`${e}`}function s(r){let e=T(r);return e=e.replace(I,"$1"),e=e.replace($,k),e=e.replace(v,"$1"),e=e.replace(O,"$1"),e=e.replace(L,"$1"),e=e.replace(S,"$1"),e=e.replace(/\n/g,"
          "),e}var D=R('
          ');function K(r,e){i(e,!1);let t=p(e,"info",12);var n={get info(){return t()},set info(l){t(l),u()}};_();var a=D(),c=E(a);return h(c,()=>(o(s),o(t()),f(()=>s(t())))),d(a),m(r,a),g(n)}export{K as I}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/JSON-BjG2a1Vu.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/JSON-BjG2a1Vu.css new file mode 100644 index 0000000000000000000000000000000000000000..1c9df8cb1772fe7b6be2c56ae5a0c85e02a561ac --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/JSON-BjG2a1Vu.css @@ -0,0 +1 @@ +.json-node.svelte-1olemhd{font-family:var(--font-mono);--text-color: #d18770;--key-color: var(--text-color);--string-color: #ce9178;--number-color: #719fad;--bracket-color: #5d8585;--square-bracket-color: #be6069;--punctuation-color: #8fbcbb;--line-number-color: #6a737d;--separator-color: var(--line-number-color)}.json-node.dark-mode.svelte-1olemhd{--bracket-color: #7eb4b3;--number-color: #638d9a}.json-node.root.svelte-1olemhd{position:relative;padding-left:var(--size-14)}.json-node.root.svelte-1olemhd:before{content:"";position:absolute;top:0;bottom:0;left:var(--size-11);width:1px;background-color:var(--separator-color)}.line.svelte-1olemhd{display:flex;align-items:flex-start;padding:0;margin:0;line-height:var(--line-md)}.line-number.svelte-1olemhd{position:absolute;left:0;width:calc(var(--size-7));text-align:right;color:var(--line-number-color);user-select:none;text-overflow:ellipsis;direction:rtl;overflow:hidden}.content.svelte-1olemhd{flex:1;display:flex;align-items:center;padding-left:calc(var(--depth) * var(--size-2));flex-wrap:wrap}.children.svelte-1olemhd{padding-left:var(--size-4)}.children.hidden.svelte-1olemhd{display:none}.key.svelte-1olemhd{color:var(--key-color)}.string.svelte-1olemhd{color:var(--string-color)}.number.svelte-1olemhd{color:var(--number-color)}.bool.svelte-1olemhd,.null.svelte-1olemhd{color:var(--text-color)}.value.svelte-1olemhd{margin-left:var(--spacing-md)}.punctuation.svelte-1olemhd{color:var(--punctuation-color)}.bracket.svelte-1olemhd{margin-left:var(--spacing-sm);color:var(--bracket-color)}.square-bracket.svelte-1olemhd{margin-left:var(--spacing-sm);color:var(--square-bracket-color)}.toggle.svelte-1olemhd,.preview.svelte-1olemhd{background:none;border:none;color:inherit;cursor:pointer;padding:0;margin:0}.toggle.svelte-1olemhd{user-select:none;margin-right:var(--spacing-md)}.preview.svelte-1olemhd{margin:0 var(--spacing-sm) 0 var(--spacing-lg)}.preview.svelte-1olemhd:hover{text-decoration:underline}[data-pseudo-content]:before{content:attr(data-pseudo-content)}.copied svg{animation:svelte-1lc38wd-fade ease .3s;animation-fill-mode:forwards}@keyframes svelte-1lc38wd-fade{0%{opacity:0}to{opacity:1}}.json-holder.svelte-1lc38wd{padding:var(--size-2);overflow-y:auto}.empty-wrapper.svelte-1lc38wd{min-height:calc(var(--size-32) - 20px);height:100%} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/JSON-CNFUDzUL.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/JSON-CNFUDzUL.js new file mode 100644 index 0000000000000000000000000000000000000000..52c013257333712323ae9e3658449b8d5213dd65 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/JSON-CNFUDzUL.js @@ -0,0 +1 @@ +import{p as v,i as m,d as Se,b as Y,f as ke,a as ye,k as je,u as Ce}from"./i18n-Dnhn5Rxr.js";import{a as l,f as Ne,aj as Je,R as we,u as te,v as be,y as he,x as M,w as a,M as pe,V as o,X as b,Y as i,t as p,T as xe,S as O,a8 as qe,a0 as C,a6 as K,a5 as B,W as u,at as Ie}from"./index-DWyDLubb.js";import{C as Te}from"./Check-DUAHzS2-.js";import{C as Ve}from"./Copy-ChCbTvli.js";import{I as Ee}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{E as Me}from"./Empty-BIB2W5at.js";import{I as Be}from"./IconButtonWrapper-D0s9l4wW.js";var He=Ne('');function Le(X){var e=He();l(X,e)}var Pe=u(''),Re=u(' :',1),We=u(' ',1),Ye=u(" ",1),Ke=u(' '),Xe=u(' '),Ze=u(' '),ze=u('null'),De=u(" "),Fe=u(','),Ge=u(','),Qe=u('
          '),Ue=u('
          ');function Ae(X,e){we(e,!0);let S=v(e,"depth",3,0),ae=v(e,"is_root",3,!1),re=v(e,"is_last_item",3,!0),le=v(e,"key",3,null),se=v(e,"open",3,!1),Z=v(e,"theme_mode",3,"system"),H=v(e,"show_indices",3,!1),z=v(e,"interactive",3,!0),I=te(void 0),c=te(be(se()?!1:S()>=3)),k=te(be([]));function T(t){return t!==null&&(typeof t=="object"||Array.isArray(t))}async function ne(){M(c,!a(c)),await pe()}function _e(t){return Array.isArray(t)?`Array(${t.length})`:typeof t=="object"&&t!==null?`Object(${Object.keys(t).length})`:String(t)}he(()=>{T(e.value)?M(k,Object.entries(e.value),!0):M(k,[],!0)});function oe(){if(!a(I))return;a(I).querySelectorAll(".line").forEach((r,s)=>{const d=r.querySelector(".line-number");d&&(d.setAttribute("data-pseudo-content",(s+1).toString()),d?.setAttribute("aria-roledescription",`Line number ${s+1}`),d?.setAttribute("title",`Line number ${s+1}`))})}he(()=>{e.value,a(c),ae()&&a(I)&&pe().then(()=>{oe()})});var N=Ue();let ie;var L=o(N);let _;var j=b(o(L),2),V=o(j);{var D=t=>{var r=Pe();r.__click=ne,p(()=>{ye(r,"data-pseudo-content",z()?a(c)?"▶":"▼":""),ye(r,"aria-label",a(c)?"Expand":"Collapse"),r.disabled=!z()}),l(t,r)};m(V,t=>{T(e.value)&&t(D)})}var E=b(V,2);{var ve=t=>{var r=Re(),s=O(r),d=o(s);i(s),qe(),p(()=>C(d,`"${le()??""}"`)),l(t,r)};m(E,t=>{le()!==null&&t(ve)})}var ue=b(E,2);{var F=t=>{var r=Ye(),s=O(r);let d;var P=o(s,!0);i(s);var y=b(s,2);{var f=h=>{var J=We(),q=O(J);q.__click=ne;var w=o(q,!0);i(q);var n=b(q,2);let g;var Q=o(n,!0);i(n),p((R,x,A)=>{C(w,R),g=Y(n,1,"punctuation bracket svelte-1olemhd",null,g,x),C(Q,A)},[()=>_e(e.value),()=>({"square-bracket":Array.isArray(e.value)}),()=>Array.isArray(e.value)?"]":"}"]),l(h,J)};m(y,h=>{a(c)&&h(f)})}p((h,J)=>{d=Y(s,1,"punctuation bracket svelte-1olemhd",null,d,h),C(P,J)},[()=>({"square-bracket":Array.isArray(e.value)}),()=>Array.isArray(e.value)?"[":"{"]),l(t,r)},G=t=>{var r=K(),s=O(r);{var d=y=>{var f=Ke(),h=o(f);i(f),p(()=>C(h,`"${e.value??""}"`)),l(y,f)},P=y=>{var f=K(),h=O(f);{var J=w=>{var n=Xe(),g=o(n,!0);i(n),p(()=>C(g,e.value)),l(w,n)},q=w=>{var n=K(),g=O(n);{var Q=x=>{var A=Ze(),U=o(A,!0);i(A),p($=>C(U,$),[()=>e.value.toString()]),l(x,A)},R=x=>{var A=K(),U=O(A);{var $=W=>{var ee=ze();l(W,ee)},fe=W=>{var ee=De(),Oe=o(ee,!0);i(ee),p(()=>C(Oe,e.value)),l(W,ee)};m(U,W=>{e.value===null?W($):W(fe,!1)},!0)}l(x,A)};m(g,x=>{typeof e.value=="boolean"?x(Q):x(R,!1)},!0)}l(w,n)};m(h,w=>{typeof e.value=="number"?w(J):w(q,!1)},!0)}l(y,f)};m(s,y=>{typeof e.value=="string"?y(d):y(P,!1)},!0)}l(t,r)};m(ue,t=>{T(e.value)?t(F):t(G,!1)})}var ge=b(ue,2);{var ce=t=>{var r=Fe();l(t,r)};m(ge,t=>{!re()&&(!T(e.value)||a(c))&&t(ce)})}i(j),i(L);var de=b(L,2);{var me=t=>{var r=Qe();let s;var d=o(r);je(d,17,()=>a(k),Ce,(n,g,Q)=>{var R=B(()=>Ie(a(g),2));let x=()=>a(R)[0],A=()=>a(R)[1];{let U=B(()=>S()+1),$=B(()=>Q===a(k).length-1),fe=B(()=>Array.isArray(e.value)&&!H()?null:x());Ae(n,{get value(){return A()},get depth(){return a(U)},get is_last_item(){return a($)},get key(){return a(fe)},get open(){return se()},get theme_mode(){return Z()},get show_indices(){return H()},get interactive(){return z()}})}});var P=b(d,2),y=b(o(P),2),f=o(y);let h;var J=o(f,!0);i(f);var q=b(f,2);{var w=n=>{var g=Ge();l(n,g)};m(q,n=>{re()||n(w)})}i(y),i(P),i(r),p((n,g)=>{s=Y(r,1,"children svelte-1olemhd",null,s,{hidden:a(c)}),h=Y(f,1,"punctuation bracket svelte-1olemhd",null,h,n),C(J,g)},[()=>({"square-bracket":Array.isArray(e.value)}),()=>Array.isArray(e.value)?"]":"}"]),l(t,r)};m(de,t=>{T(e.value)&&t(me)})}i(N),Se(N,t=>M(I,t),()=>a(I)),p(()=>{ie=Y(N,1,"json-node svelte-1olemhd",null,ie,{root:ae(),"dark-mode":Z()==="dark"}),ke(N,`--depth: ${S()??""};`),_=Y(L,1,"line svelte-1olemhd",null,_,{collapsed:a(c)})}),l(X,N),xe()}Je(["click"]);var $e=u('
          ',1),et=u('
          ');function it(X,e){we(e,!0);let S=v(e,"value",19,()=>({})),ae=v(e,"open",3,!1),re=v(e,"theme_mode",3,"system"),le=v(e,"show_indices",3,!1),se=v(e,"interactive",3,!0),Z=v(e,"show_copy_button",3,!0),H=v(e,"buttons",3,null),z=v(e,"on_custom_button_click",3,null),I=B(()=>`calc(100% - ${e.label_height}px)`),c=te(!1),k=te(void 0);function T(){M(c,!0),a(k)&&clearTimeout(a(k)),M(k,setTimeout(()=>{M(c,!1)},1e3),!0)}async function ne(){"clipboard"in navigator&&(await navigator.clipboard.writeText(JSON.stringify(S(),null,2)),T())}function _e(_){return _&&Object.keys(_).length===0&&Object.getPrototypeOf(_)===Object.prototype&&JSON.stringify(_)===JSON.stringify({})}he(()=>()=>{a(k)&&clearTimeout(a(k))});var oe=K(),N=O(oe);{var ie=_=>{var j=$e(),V=O(j);{var D=F=>{Be(F,{get buttons(){return H()},get on_custom_button_click(){return z()},children:(G,ge)=>{var ce=K(),de=O(ce);{var me=t=>{{let r=B(()=>a(c)?"Copied":"Copy"),s=B(()=>a(c)?Te:Ve);Ee(t,{show_label:!1,get label(){return a(r)},get Icon(){return a(s)},onclick:()=>ne()})}};m(de,t=>{Z()&&t(me)})}l(G,ce)},$$slots:{default:!0}})};m(V,F=>{(Z()||H()&&H().some(G=>typeof G!="string"))&&F(D)})}var E=b(V,2);let ve;var ue=o(E);Ae(ue,{get value(){return S()},depth:0,is_root:!0,get open(){return ae()},get theme_mode(){return re()},get show_indices(){return le()},get interactive(){return se()}}),i(E),p(()=>ve=ke(E,"",ve,{"max-height":a(I)})),l(_,j)},L=_=>{var j=et(),V=o(j);Me(V,{children:(D,E)=>{Le(D)},$$slots:{default:!0}}),i(j),l(_,j)};m(N,_=>{S()&&S()!=='""'&&!_e(S())?_(ie):_(L,!1)})}l(X,oe),xe()}export{it as J,Le as a}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_animation_pointer-_r4j3nDo.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_animation_pointer-_r4j3nDo.js new file mode 100644 index 0000000000000000000000000000000000000000..ccddc9523eca769abbca9c6f2a6079dd2ffb6780 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_animation_pointer-_r4j3nDo.js @@ -0,0 +1 @@ +import{as as t,C as z,L as H,aG as G,aH as B}from"./index-CDrXokXW.js";import{S as e,G as Z}from"./objectModelMapping-CGWnurZP.js";import{AnimationPropertyInfo as I}from"./glTFLoaderAnimation-Dy3q9t_h.js";import"./index-DWyDLubb.js";function u(l,r,a,i){return z.FromArray(r,a).scale(i)}function V(l,r,a,i){return r[a+3]*i}function s(l,r,a,i){return r[a]*i}function K(l,r,a,i){return-r[a]*i}function A(l,r,a,i){return r[a+1]*i}function X(l,r,a,i){return r[a]*i*2}function o(l){return{scale:[new n(t.ANIMATIONTYPE_FLOAT,`${l}.uScale`,s,()=>2),new n(t.ANIMATIONTYPE_FLOAT,`${l}.vScale`,A,()=>2)],offset:[new n(t.ANIMATIONTYPE_FLOAT,`${l}.uOffset`,s,()=>2),new n(t.ANIMATIONTYPE_FLOAT,`${l}.vOffset`,A,()=>2)],rotation:[new n(t.ANIMATIONTYPE_FLOAT,`${l}.wAng`,K,()=>1)]}}class c extends I{buildAnimations(r,a,i,_){return[{babylonAnimatable:r._babylonCamera,babylonAnimation:this._buildAnimation(a,i,_)}]}}class n extends I{buildAnimations(r,a,i,_){const x=[];for(const T in r._data)x.push({babylonAnimatable:r._data[T].babylonMaterial,babylonAnimation:this._buildAnimation(a,i,_)});return x}}class m extends I{buildAnimations(r,a,i,_){return[{babylonAnimatable:r._babylonLight,babylonAnimation:this._buildAnimation(a,i,_)}]}}class W extends I{buildAnimations(r,a,i,_){return r._primitiveBabylonMeshes?r._primitiveBabylonMeshes.map(x=>({babylonAnimatable:x,babylonAnimation:this._buildAnimation(a,i,_)})):[]}}e("/cameras/{}/orthographic/xmag",[new c(t.ANIMATIONTYPE_FLOAT,"orthoLeft",K,()=>1),new c(t.ANIMATIONTYPE_FLOAT,"orthoRight",A,()=>1)]);e("/cameras/{}/orthographic/ymag",[new c(t.ANIMATIONTYPE_FLOAT,"orthoBottom",K,()=>1),new c(t.ANIMATIONTYPE_FLOAT,"orthoTop",A,()=>1)]);e("/cameras/{}/orthographic/zfar",[new c(t.ANIMATIONTYPE_FLOAT,"maxZ",s,()=>1)]);e("/cameras/{}/orthographic/znear",[new c(t.ANIMATIONTYPE_FLOAT,"minZ",s,()=>1)]);e("/cameras/{}/perspective/yfov",[new c(t.ANIMATIONTYPE_FLOAT,"fov",s,()=>1)]);e("/cameras/{}/perspective/zfar",[new c(t.ANIMATIONTYPE_FLOAT,"maxZ",s,()=>1)]);e("/cameras/{}/perspective/znear",[new c(t.ANIMATIONTYPE_FLOAT,"minZ",s,()=>1)]);e("/materials/{}/pbrMetallicRoughness/baseColorFactor",[new n(t.ANIMATIONTYPE_COLOR3,"albedoColor",u,()=>4),new n(t.ANIMATIONTYPE_FLOAT,"alpha",V,()=>4)]);e("/materials/{}/pbrMetallicRoughness/metallicFactor",[new n(t.ANIMATIONTYPE_FLOAT,"metallic",s,()=>1)]);e("/materials/{}/pbrMetallicRoughness/metallicFactor",[new n(t.ANIMATIONTYPE_FLOAT,"roughness",s,()=>1)]);const O=o("albedoTexture");e("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale",O.scale);e("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset",O.offset);e("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation",O.rotation);const N=o("metallicTexture");e("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/scale",N.scale);e("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/offset",N.offset);e("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/rotation",N.rotation);e("/materials/{}/emissiveFactor",[new n(t.ANIMATIONTYPE_COLOR3,"emissiveColor",u,()=>3)]);const g=o("bumpTexture");e("/materials/{}/normalTexture/scale",[new n(t.ANIMATIONTYPE_FLOAT,"bumpTexture.level",s,()=>1)]);e("/materials/{}/normalTexture/extensions/KHR_texture_transform/scale",g.scale);e("/materials/{}/normalTexture/extensions/KHR_texture_transform/offset",g.offset);e("/materials/{}/normalTexture/extensions/KHR_texture_transform/rotation",g.rotation);e("/materials/{}/occlusionTexture/strength",[new n(t.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",s,()=>1)]);const d=o("ambientTexture");e("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/scale",d.scale);e("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/offset",d.offset);e("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/rotation",d.rotation);const b=o("emissiveTexture");e("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/scale",b.scale);e("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/offset",b.offset);e("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/rotation",b.rotation);e("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyStrength",[new n(t.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",s,()=>1)]);e("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyRotation",[new n(t.ANIMATIONTYPE_FLOAT,"anisotropy.angle",s,()=>1)]);const M=o("anisotropy.texture");e("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/scale",M.scale);e("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/offset",M.offset);e("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/rotation",M.rotation);e("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatFactor",[new n(t.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",s,()=>1)]);e("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor",[new n(t.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",s,()=>1)]);const F=o("clearCoat.texture");e("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/scale",F.scale);e("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/offset",F.offset);e("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/rotation",F.rotation);const E=o("clearCoat.bumpTexture");e("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/scale",[new n(t.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",s,()=>1)]);e("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale",E.scale);e("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset",E.offset);e("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation",E.rotation);const w=o("clearCoat.textureRoughness");e("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/scale",w.scale);e("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/offset",w.offset);e("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/rotation",w.rotation);e("/materials/{}/extensions/KHR_materials_dispersion/dispersionFactor",[new n(t.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",s,()=>1)]);e("/materials/{}/extensions/KHR_materials_emissive_strength/emissiveStrength",[new n(t.ANIMATIONTYPE_FLOAT,"emissiveIntensity",s,()=>1)]);e("/materials/{}/extensions/KHR_materials_ior/ior",[new n(t.ANIMATIONTYPE_FLOAT,"indexOfRefraction",s,()=>1)]);e("/materials/{}/extensions/KHR_materials_iridescence/iridescenceFactor",[new n(t.ANIMATIONTYPE_FLOAT,"iridescence.intensity",s,()=>1)]);e("/materials/{}/extensions/KHR_materials_iridescence/iridescenceIor",[new n(t.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",s,()=>1)]);e("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMinimum",[new n(t.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",s,()=>1)]);e("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMaximum",[new n(t.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",s,()=>1)]);const L=o("iridescence.texture");e("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/scale",L.scale);e("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/offset",L.offset);e("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/rotation",L.rotation);const P=o("iridescence.thicknessTexture");e("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/scale",P.scale);e("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/offset",P.offset);e("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/rotation",P.rotation);e("/materials/{}/extensions/KHR_materials_sheen/sheenColorFactor",[new n(t.ANIMATIONTYPE_COLOR3,"sheen.color",u,()=>3)]);e("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessFactor",[new n(t.ANIMATIONTYPE_FLOAT,"sheen.roughness",s,()=>1)]);const y=o("sheen.texture");e("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/scale",y.scale);e("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/offset",y.offset);e("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/rotation",y.rotation);const C=o("sheen.textureRoughness");e("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/scale",C.scale);e("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/offset",C.offset);e("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/rotation",C.rotation);e("/materials/{}/extensions/KHR_materials_specular/specularFactor",[new n(t.ANIMATIONTYPE_FLOAT,"metallicF0Factor",s,()=>1)]);e("/materials/{}/extensions/KHR_materials_specular/specularColorFactor",[new n(t.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",u,()=>3)]);const Y=o("metallicReflectanceTexture");e("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/scale",Y.scale);e("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/offset",Y.offset);e("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/rotation",Y.rotation);const v=o("reflectanceTexture");e("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/scale",v.scale);e("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/offset",v.offset);e("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/rotation",v.rotation);e("/materials/{}/extensions/KHR_materials_transmission/transmissionFactor",[new n(t.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",s,()=>1)]);const S=o("subSurface.refractionIntensityTexture");e("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/scale",S.scale);e("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/offset",S.offset);e("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/rotation",S.rotation);e("/materials/{}/extensions/KHR_materials_volume/attenuationColor",[new n(t.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",u,()=>3)]);e("/materials/{}/extensions/KHR_materials_volume/attenuationDistance",[new n(t.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",s,()=>1)]);e("/materials/{}/extensions/KHR_materials_volume/thicknessFactor",[new n(t.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",s,()=>1)]);const $=o("subSurface.thicknessTexture");e("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/scale",$.scale);e("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/offset",$.offset);e("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/rotation",$.rotation);e("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionFactor",[new n(t.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",s,()=>1)]);const k=o("subSurface.translucencyIntensityTexture");e("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/scale",k.scale);e("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/offset",k.offset);e("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/rotation",k.rotation);e("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorFactor",[new n(t.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",u,()=>3)]);const j=o("subSurface.translucencyColorTexture");e("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/scale",j.scale);e("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/offset",j.offset);e("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/rotation",j.rotation);e("/extensions/KHR_lights_punctual/lights/{}/color",[new m(t.ANIMATIONTYPE_COLOR3,"diffuse",u,()=>3)]);e("/extensions/KHR_lights_punctual/lights/{}/intensity",[new m(t.ANIMATIONTYPE_FLOAT,"intensity",s,()=>1)]);e("/extensions/KHR_lights_punctual/lights/{}/range",[new m(t.ANIMATIONTYPE_FLOAT,"range",s,()=>1)]);e("/extensions/KHR_lights_punctual/lights/{}/spot/innerConeAngle",[new m(t.ANIMATIONTYPE_FLOAT,"innerAngle",X,()=>1)]);e("/extensions/KHR_lights_punctual/lights/{}/spot/outerConeAngle",[new m(t.ANIMATIONTYPE_FLOAT,"angle",X,()=>1)]);e("/extensions/EXT_lights_area/lights/{}/color",[new m(t.ANIMATIONTYPE_COLOR3,"diffuse",u,()=>3)]);e("/extensions/EXT_lights_area/lights/{}/intensity",[new m(t.ANIMATIONTYPE_FLOAT,"intensity",s,()=>1)]);e("/extensions/EXT_lights_area/lights/{}/size",[new m(t.ANIMATIONTYPE_FLOAT,"radius",s,()=>1)]);e("/extensions/EXT_lights_area/lights/{}/rect/aspect",[new m(t.ANIMATIONTYPE_FLOAT,"radius",s,()=>1)]);e("/nodes/{}/extensions/EXT_lights_ies/color",[new m(t.ANIMATIONTYPE_COLOR3,"diffuse",u,()=>3)]);e("/nodes/{}/extensions/EXT_lights_ies/multiplier",[new m(t.ANIMATIONTYPE_FLOAT,"intensity",s,()=>1)]);e("/nodes/{}/extensions/KHR_node_visibility/visible",[new W(t.ANIMATIONTYPE_FLOAT,"isVisible",s,()=>1)]);const R="KHR_animation_pointer";class D{constructor(r){this.name=R,this._loader=r,this._pathToObjectConverter=Z(this._loader.gltf)}get enabled(){return this._loader.isExtensionUsed(R)}dispose(){this._loader=null,delete this._pathToObjectConverter}_loadAnimationChannelAsync(r,a,i,_,x){const T=_.target.extensions?.KHR_animation_pointer;if(!T||!this._pathToObjectConverter)return null;_.target.path!=="pointer"&&H.Warn(`${r}/target/path: Value (${_.target.path}) must be (pointer) when using the ${this.name} extension`),_.target.node!=null&&H.Warn(`${r}/target/node: Value (${_.target.node}) must not be present when using the ${this.name} extension`);const h=`${r}/extensions/${this.name}`,p=T.pointer;if(!p)throw new Error(`${h}: Pointer is missing`);try{const f=this._pathToObjectConverter.convert(p);if(!f.info.interpolation)throw new Error(`${h}/pointer: Interpolation is missing`);return this._loader._loadAnimationChannelFromTargetInfoAsync(r,a,i,_,{object:f.object,info:f.info.interpolation},x)}catch{return H.Warn(`${h}/pointer: Invalid pointer (${p}) skipped`),null}}}G(R);B(R,!0,l=>new D(l));export{D as KHR_animation_pointer}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_draco_mesh_compression-CsW9PsVH.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_draco_mesh_compression-CsW9PsVH.js new file mode 100644 index 0000000000000000000000000000000000000000..812e081aa9443c0430b006a676bc7001f127107d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_draco_mesh_compression-CsW9PsVH.js @@ -0,0 +1 @@ +import{d as A,bp as M,J as w,L as v,aG as V,aH as k}from"./index-CDrXokXW.js";import{A as R}from"./workerPool-CfMXSLnf.js";import{GLTFLoader as F,ArrayItem as D,LoadBoundingInfoFromPositionAccessor as N}from"./glTFLoader-Bp7IfGPK.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";function I(c,t,n,i,f){const e=c;let r=null,o=null,s=null;try{r=new e.Decoder,o=new e.DecoderBuffer,o.Init(t,t.byteLength);let a;const l=r.GetEncodedGeometryType(o);switch(l){case e.TRIANGULAR_MESH:{const d=new e.Mesh;if(a=r.DecodeBufferToMesh(o,d),!a.ok()||d.ptr===0)throw new Error(a.error_msg());const y=d.num_faces()*3,h=y*4,u=e._malloc(h);try{r.GetTrianglesUInt32Array(d,h,u);const P=new Uint32Array(y);P.set(new Uint32Array(e.HEAPF32.buffer,u,y)),i(P)}finally{e._free(u)}s=d;break}case e.POINT_CLOUD:{const d=new e.PointCloud;if(a=r.DecodeBufferToPointCloud(o,d),!a.ok()||!d.ptr)throw new Error(a.error_msg());s=d;break}default:throw new Error(`Invalid geometry type ${l}`)}const _=s.num_points(),b=(d,m,y,h)=>{const u=h.data_type(),P=h.num_components(),B=h.normalized(),C=h.byte_stride(),O=h.byte_offset(),T={[e.DT_FLOAT32]:{typedArrayConstructor:Float32Array,heap:e.HEAPF32},[e.DT_INT8]:{typedArrayConstructor:Int8Array,heap:e.HEAP8},[e.DT_INT16]:{typedArrayConstructor:Int16Array,heap:e.HEAP16},[e.DT_INT32]:{typedArrayConstructor:Int32Array,heap:e.HEAP32},[e.DT_UINT8]:{typedArrayConstructor:Uint8Array,heap:e.HEAPU8},[e.DT_UINT16]:{typedArrayConstructor:Uint16Array,heap:e.HEAPU16},[e.DT_UINT32]:{typedArrayConstructor:Uint32Array,heap:e.HEAPU32}}[u];if(!T)throw new Error(`Invalid data type ${u}`);const U=_*P,L=U*T.typedArrayConstructor.BYTES_PER_ELEMENT,g=e._malloc(L);try{d.GetAttributeDataArrayForAllPoints(m,h,u,L,g);const G=new T.typedArrayConstructor(T.heap.buffer,g,U);f(y,G.slice(),P,O,C,B)}finally{e._free(g)}};if(n)for(const d in n){const m=n[d],y=r.GetAttributeByUniqueId(s,m);b(r,s,d,y)}else{const d={position:e.POSITION,normal:e.NORMAL,color:e.COLOR,uv:e.TEX_COORD};for(const m in d){const y=r.GetAttributeId(s,d[m]);if(y!==-1){const h=r.GetAttribute(s,y);b(r,s,m,h)}}}return _}finally{s&&e.destroy(s),o&&e.destroy(o),r&&e.destroy(r)}}function S(){let c;onmessage=t=>{const n=t.data;switch(n.id){case"init":{n.url&&importScripts(n.url);const i=n.wasmBinary?{wasmBinary:n.wasmBinary}:{};c=DracoDecoderModule(i),postMessage({id:"initDone"});break}case"decodeMesh":{if(!c)throw new Error("Draco decoder module is not available");c.then(i=>{const f=I(i,n.dataView,n.attributes,e=>{postMessage({id:"indices",data:e},[e.buffer])},(e,r,o,s,a,l)=>{postMessage({id:"attribute",kind:e,data:r,size:o,byteOffset:s,byteStride:a,normalized:l},[r.buffer])});postMessage({id:"decodeMeshDone",totalVertices:f})});break}}}}async function W(c,t,n){return await new Promise((i,f)=>{const e=o=>{c.removeEventListener("error",e),c.removeEventListener("message",r),f(o)},r=o=>{o.data.id==="initDone"&&(c.removeEventListener("error",e),c.removeEventListener("message",r),i(c))};if(c.addEventListener("error",e),c.addEventListener("message",r),!t)c.postMessage({id:"init",url:n});else{const o=t.slice(0);c.postMessage({id:"init",url:n,wasmBinary:o},[o])}})}function K(){return typeof navigator!="object"||!navigator.hardwareConcurrency?1:Math.min(Math.floor(navigator.hardwareConcurrency*.5),4)}function $(c){return!!(c.wasmUrl&&(c.wasmBinary||c.wasmBinaryUrl)&&typeof WebAssembly=="object"||c.fallbackUrl)}class H{constructor(t){if(t.workerPool){this._workerPoolPromise=Promise.resolve(t.workerPool);return}const n=t.wasmBinary,i=t.numWorkers??K(),f=i&&typeof Worker=="function"&&typeof URL=="function",e=f||!t.jsModule,r=t.wasmUrl&&t.wasmBinaryUrl&&typeof WebAssembly=="object"?{url:e?A.GetBabylonScriptURL(t.wasmUrl,!0):"",wasmBinaryPromise:n?Promise.resolve(n):A.LoadFileAsync(A.GetBabylonScriptURL(t.wasmBinaryUrl,!0))}:{url:e?A.GetBabylonScriptURL(t.fallbackUrl):"",wasmBinaryPromise:Promise.resolve(void 0)};f?this._workerPoolPromise=r.wasmBinaryPromise.then(o=>{const s=this._getWorkerContent(),a=URL.createObjectURL(new Blob([s],{type:"application/javascript"}));return new R(i,()=>{const l=new Worker(a);return W(l,o,r.url)})}):this._modulePromise=r.wasmBinaryPromise.then(async o=>{if(!this._isModuleAvailable()&&!t.jsModule){if(!r.url)throw new Error("Draco codec module is not available");await A.LoadBabylonScriptAsync(r.url)}return await this._createModuleAsync(o,t.jsModule)})}async whenReadyAsync(){if(this._workerPoolPromise){await this._workerPoolPromise;return}if(this._modulePromise){await this._modulePromise;return}}dispose(){this._workerPoolPromise&&this._workerPoolPromise.then(t=>{t.dispose()}),delete this._workerPoolPromise,delete this._modulePromise}}class p extends H{static get DefaultAvailable(){return $(p.DefaultConfiguration)}static get Default(){return p._Default??(p._Default=new p),p._Default}static ResetDefault(t){p._Default&&(t||p._Default.dispose(),p._Default=null)}_isModuleAvailable(){return typeof DracoDecoderModule<"u"}async _createModuleAsync(t,n){return{module:await(n||DracoDecoderModule)({wasmBinary:t})}}_getWorkerContent(){return`${I}(${S})()`}constructor(t=p.DefaultConfiguration){super(t)}decodeMeshToMeshDataAsync(t,n,i){const f=t instanceof ArrayBuffer?new Int8Array(t):new Int8Array(t.buffer,t.byteOffset,t.byteLength),e=(r,o)=>i&&i[r]!==void 0?(o!==i[r]&&v.Warn(`Normalized flag from Draco data (${o}) does not match normalized flag from glTF accessor (${i[r]}). Using flag from glTF accessor.`),i[r]):o;if(this._workerPoolPromise)return this._workerPoolPromise.then(async r=>await new Promise((o,s)=>{r.push((a,l)=>{let _=null;const b=[],d=h=>{a.removeEventListener("error",d),a.removeEventListener("message",m),s(h),l()},m=h=>{const u=h.data;switch(u.id){case"indices":{_=u.data;break}case"attribute":{b.push({kind:u.kind,data:u.data,size:u.size,byteOffset:u.byteOffset,byteStride:u.byteStride,normalized:e(u.kind,u.normalized)});break}case"decodeMeshDone":{a.removeEventListener("error",d),a.removeEventListener("message",m),o({indices:_,attributes:b,totalVertices:u.totalVertices}),l();break}}};a.addEventListener("error",d),a.addEventListener("message",m);const y=f.slice();a.postMessage({id:"decodeMesh",dataView:y,attributes:n},[y.buffer])})}));if(this._modulePromise)return this._modulePromise.then(r=>{let o=null;const s=[],a=I(r.module,f,n,l=>{o=l},(l,_,b,d,m,y)=>{s.push({kind:l,data:_,size:b,byteOffset:d,byteStride:m,normalized:y})});return{indices:o,attributes:s,totalVertices:a}});throw new Error("Draco decoder module is not available")}async decodeMeshToGeometryAsync(t,n,i,f){const e=await this.decodeMeshToMeshDataAsync(i,f),r=new M(t,n);e.indices&&r.setIndices(e.indices);for(const o of e.attributes)r.setVerticesBuffer(new w(n.getEngine(),o.data,o.kind,!1,void 0,o.byteStride,void 0,o.byteOffset,o.size,void 0,o.normalized,!0),e.totalVertices);return r}async _decodeMeshToGeometryForGltfAsync(t,n,i,f,e,r){const o=await this.decodeMeshToMeshDataAsync(i,f,e),s=new M(t,n);r&&(s._boundingInfo=r,s.useBoundingInfoFromGeometry=!0),o.indices&&s.setIndices(o.indices);for(const a of o.attributes)s.setVerticesBuffer(new w(n.getEngine(),a.data,a.kind,!1,void 0,a.byteStride,void 0,a.byteOffset,a.size,void 0,a.normalized,!0),o.totalVertices);return s}}p.DefaultConfiguration={wasmUrl:`${A._DefaultCdnUrl}/draco_wasm_wrapper_gltf.js`,wasmBinaryUrl:`${A._DefaultCdnUrl}/draco_decoder_gltf.wasm`,fallbackUrl:`${A._DefaultCdnUrl}/draco_decoder_gltf.js`};p._Default=null;const E="KHR_draco_mesh_compression";class z{constructor(t){this.name=E,this.useNormalizedFlagFromAccessor=!0,this._loader=t,this.enabled=p.DefaultAvailable&&this._loader.isExtensionUsed(E)}dispose(){delete this.dracoDecoder,this._loader=null}_loadVertexDataAsync(t,n,i){return F.LoadExtensionAsync(t,n,this.name,async(f,e)=>{if(n.mode!=null&&n.mode!==4&&n.mode!==5)throw new Error(`${t}: Unsupported mode ${n.mode}`);const r={},o={},s=(l,_)=>{const b=e.attributes[l];if(b!=null&&(i._delayInfo=i._delayInfo||[],i._delayInfo.indexOf(_)===-1&&i._delayInfo.push(_),r[_]=b,this.useNormalizedFlagFromAccessor)){const d=D.TryGet(this._loader.gltf.accessors,n.attributes[l]);d&&(o[_]=d.normalized||!1)}};s("POSITION",w.PositionKind),s("NORMAL",w.NormalKind),s("TANGENT",w.TangentKind),s("TEXCOORD_0",w.UVKind),s("TEXCOORD_1",w.UV2Kind),s("TEXCOORD_2",w.UV3Kind),s("TEXCOORD_3",w.UV4Kind),s("TEXCOORD_4",w.UV5Kind),s("TEXCOORD_5",w.UV6Kind),s("JOINTS_0",w.MatricesIndicesKind),s("WEIGHTS_0",w.MatricesWeightsKind),s("COLOR_0",w.ColorKind);const a=D.Get(f,this._loader.gltf.bufferViews,e.bufferView);return a._dracoBabylonGeometry||(a._dracoBabylonGeometry=this._loader.loadBufferViewAsync(`/bufferViews/${a.index}`,a).then(async l=>{const _=this.dracoDecoder||p.Default,b=D.TryGet(this._loader.gltf.accessors,n.attributes.POSITION),d=!this._loader.parent.alwaysComputeBoundingBox&&!i.skeleton&&b?N(b):null;return await _._decodeMeshToGeometryForGltfAsync(i.name,this._loader.babylonScene,l,r,o,d).catch(m=>{throw new Error(`${t}: ${m.message}`)})})),await a._dracoBabylonGeometry})}}V(E);k(E,!0,c=>new z(c));export{z as KHR_draco_mesh_compression}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_interactivity-BtMudStn.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_interactivity-BtMudStn.js new file mode 100644 index 0000000000000000000000000000000000000000..ef850aeb40a3cba2345f95a92854ec53efcbf4ab --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_interactivity-BtMudStn.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./flowGraphPlayAnimationBlock-CEIRjwmT.js","./declarationMapper-Lanf6XPr.js","./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./animationGroup-CCzMCPMh.js","./bone-z620UXj2.js","./objectModelMapping-CGWnurZP.js","./flowGraphStopAnimationBlock-DzdM2S-i.js","./flowGraphPauseAnimationBlock-BCBVeYeV.js","./flowGraphInterpolationBlock-DTRpEzHP.js","./flowGraphSceneReadyEventBlock-8yWc5f3q.js","./flowGraphSceneTickEventBlock-wqnxDI01.js","./flowGraphSendCustomEventBlock-COnjPh-a.js","./flowGraphReceiveCustomEventBlock-CHr_E_rI.js","./flowGraphMeshPickEventBlock-336WsC8m.js","./flowGraphMathBlocks-B5QWBKgA.js","./flowGraphBinaryOperationBlock-C6Dwxvh5.js","./flowGraphCachedOperationBlock-CAD6CbqU.js","./flowGraphUnaryOperationBlock-wNBDBj1u.js","./flowGraphVectorMathBlocks-DIRRvNKz.js","./flowGraphMatrixMathBlocks-D7ABsNS4.js","./flowGraphBranchBlock-C7xYG2zV.js","./flowGraphSetDelayBlock-C-Ra3zyP.js","./flowGraphCancelDelayBlock-BJcCzox9.js","./flowGraphCounterBlock-BzmD6VO2.js","./flowGraphDebounceBlock-CXVcNbRh.js","./flowGraphThrottleBlock-CbQ41JKj.js","./flowGraphDoNBlock-CP3xgcll.js","./flowGraphFlipFlopBlock-Y6garx3E.js","./flowGraphForLoopBlock-DUZ0AOjo.js","./flowGraphMultiGateBlock-4iS0VrNF.js","./flowGraphSequenceBlock-C1cNgLhX.js","./flowGraphSwitchBlock-BfoWGleb.js","./flowGraphWaitAllBlock-CK10vDaH.js","./flowGraphWhileLoopBlock-BWIuZKmu.js","./flowGraphConsoleLogBlock-CdBKcOMZ.js","./flowGraphConditionalDataBlock-Cv7dnhcP.js","./flowGraphConstantBlock-O3j13zGE.js","./flowGraphTransformCoordinatesSystemBlock-BtSaynCM.js","./flowGraphGetAssetBlock-DKMD3fRB.js","./flowGraphGetPropertyBlock-DRLha8FE.js","./flowGraphSetPropertyBlock-63nD7ivc.js","./flowGraphGetVariableBlock-DRAnW3yF.js","./flowGraphSetVariableBlock-DczV7NIl.js","./flowGraphJsonPointerParserBlock-BDL8JHpS.js","./flowGraphMathCombineExtractBlocks-CsnqKtJp.js","./flowGraphTypeToTypeBlocks-Bka59VEo.js","./flowGraphEasingBlock-3nljISe1.js","./flowGraphBezierCurveEasingBlock-DlxSIPlI.js","./flowGraphPointerOverEventBlock-CvKef7MZ.js","./flowGraphPointerOutEventBlock-p8RUrh0M.js","./flowGraphContextBlock-Cob0aKB2.js","./flowGraphArrayIndexBlock-DCHGYI8d.js","./flowGraphCodeExecutionBlock-CpslCx7t.js","./flowGraphIndexOfBlock-CrObGRpk.js","./flowGraphFunctionReferenceBlock-Bd_srACE.js","./flowGraphDataSwitchBlock-0lH2SmaQ.js","./flowGraphGLTFDataProvider-BJdJcFO4.js"])))=>i.map(i=>d[i]); +import{af as n}from"./index-DWyDLubb.js";import{M as et,ah as ot,V as Q,ai as rt,ao as R,C as at,b9 as nt,L as p,h as I,O,_ as it,s as st,R as J,aQ as q,aG as lt,aH as ct}from"./index-CDrXokXW.js";import{n as ut,p as pt,F as ht,g as _t,r as wt,s as $}from"./declarationMapper-Lanf6XPr.js";import{G as dt,A as E}from"./objectModelMapping-CGWnurZP.js";function mt(r){return r==="Mesh"||r==="AbstractMesh"||r==="GroundMesh"||r==="InstanceMesh"||r==="LinesMesh"||r==="GoldbergMesh"||r==="GreasedLineMesh"||r==="TrailMesh"}function Z(r){return r==="Vector2"||r==="Vector3"||r==="Vector4"||r==="Quaternion"||r==="Color3"||r==="Color4"}function ft(r){return r==="Matrix"||r==="Matrix2D"||r==="Matrix3D"}function yt(r){return r==="AnimationGroup"}function gt(r,t,e=!1){if(r==="Vector2")return ot.FromArray(t);if(r==="Vector3")return e&&(t[2]*=-1),Q.FromArray(t);if(r==="Vector4")return rt.FromArray(t);if(r==="Quaternion")return e&&(t[2]*=-1,t[3]*=-1),R.FromArray(t);if(r==="Color3")return new at(t[0],t[1],t[2]);if(r==="Color4")return new nt(t[0],t[1],t[2],t[3]);throw new Error(`Unknown vector class name ${r}`)}function M(r,t,e){const o=t?.getClassName?.()??"";if(Z(o)||ft(o))e[r]={value:t.asArray(),className:o};else if(o==="FlowGraphInteger")e[r]={value:t.value,className:o};else if(o&&(t.id||t.name))e[r]={id:t.id,name:t.name,className:o};else if(typeof t!="object")e[r]=t;else throw new Error(`Could not serialize value ${t}`)}function x(r,t,e,o){const a=t[r];let i;const s=a?.type??a?.className;if(mt(s)){let c=o.meshes.filter(l=>a.id?l.id===a.id:l.name===a.name);c.length===0&&(c=o.transformNodes.filter(l=>a.id?l.id===a.id:l.name===a.name)),i=a.uniqueId?c.find(l=>l.uniqueId===a.uniqueId):c[0]}else if(Z(s))i=gt(s,a.value);else if(yt(s)){const c=o.animationGroups.filter(l=>l.name===a.name);i=c.length===1?c[0]:c.find(l=>l.uniqueId===a.uniqueId)}else s==="Matrix"?i=et.FromArray(a.value):s==="Matrix2D"?i=new ut(a.value):s==="Matrix3D"?i=new pt(a.value):s==="FlowGraphInteger"?i=ht.FromValue(a.value):s==="number"||s==="string"||s==="boolean"?i=a.value[0]:a&&a.value!==void 0?i=a.value:Array.isArray(a)?i=a.reduce((c,l)=>(l.eventData&&(c[l.id]={type:_t(l.type)},typeof l.value<"u"&&(c[l.id].value=x("value",l,e,o))),c),{}):i=a;return i}function kt(r){return r==="FlowGraphJsonPointerParserBlock"}var K;(function(r){r.Animation="Animation",r.AnimationGroup="AnimationGroup",r.Mesh="Mesh",r.Material="Material",r.Camera="Camera",r.Light="Light"})(K||(K={}));function Gt(r,t,e,o){switch(t){case"Animation":return o?r.animations.find(a=>a.uniqueId===e)??null:r.animations[e]??null;case"AnimationGroup":return o?r.animationGroups.find(a=>a.uniqueId===e)??null:r.animationGroups[e]??null;case"Mesh":return o?r.meshes.find(a=>a.uniqueId===e)??null:r.meshes[e]??null;case"Material":return o?r.materials.find(a=>a.uniqueId===e)??null:r.materials[e]??null;case"Camera":return o?r.cameras.find(a=>a.uniqueId===e)??null:r.cameras[e]??null;case"Light":return o?r.lights.find(a=>a.uniqueId===e)??null:r.lights[e]??null;default:return null}}var W;(function(r){r.ExecuteBlock="ExecuteBlock",r.ExecuteEvent="ExecuteEvent",r.TriggerConnection="TriggerConnection",r.ContextVariableSet="ContextVariableSet",r.GlobalVariableSet="GlobalVariableSet",r.GlobalVariableDelete="GlobalVariableDelete",r.GlobalVariableGet="GlobalVariableGet",r.AddConnection="AddConnection",r.GetConnectionValue="GetConnectionValue",r.SetConnectionValue="SetConnectionValue",r.ActivateSignal="ActivateSignal",r.ContextVariableGet="ContextVariableGet"})(W||(W={}));class Bt{constructor(){this.logToConsole=!1,this.log=[]}addLogItem(t){if(t.time||(t.time=Date.now()),this.log.push(t),this.logToConsole){const e=t.payload?.value;typeof e=="object"&&e.getClassName?p.Log(`[FGLog] ${t.className}:${t.uniqueId.split("-")[0]} ${t.action} - ${JSON.stringify(e.getClassName())}: ${e.toString()}`):p.Log(`[FGLog] ${t.className}:${t.uniqueId.split("-")[0]} ${t.action} - ${JSON.stringify(t.payload)}`)}}getItemsOfType(t){return this.log.filter(e=>e.action===t)}}class X{get enableLogging(){return this._enableLogging}set enableLogging(t){this._enableLogging!==t&&(this._enableLogging=t,this._enableLogging?(this.logger=new Bt,this.logger.logToConsole=!0):this.logger=null)}constructor(t){this.uniqueId=I(),this._userVariables={},this._executionVariables={},this._globalContextVariables={},this._connectionValues={},this._pendingBlocks=[],this._executionId=0,this.onNodeExecutedObservable=new O,this.treatDataAsRightHanded=!1,this._enableLogging=!1,this._configuration=t,this.assetsContext=t.assetsContext??t.scene}hasVariable(t){return t in this._userVariables}setVariable(t,e){this._userVariables[t]=e,this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"ContextVariableSet",payload:{name:t,value:e}})}getAsset(t,e){return Gt(this.assetsContext,t,e)}getVariable(t){return this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"ContextVariableGet",payload:{name:t,value:this._userVariables[t]}}),this._userVariables[t]}get userVariables(){return this._userVariables}getScene(){return this._configuration.scene}_getUniqueIdPrefixedName(t,e){return`${t.uniqueId}_${e}`}_getGlobalContextVariable(t,e){return this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"GlobalVariableGet",payload:{name:t,defaultValue:e,possibleValue:this._globalContextVariables[t]}}),this._hasGlobalContextVariable(t)?this._globalContextVariables[t]:e}_setGlobalContextVariable(t,e){this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"GlobalVariableSet",payload:{name:t,value:e}}),this._globalContextVariables[t]=e}_deleteGlobalContextVariable(t){this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"GlobalVariableDelete",payload:{name:t}}),delete this._globalContextVariables[t]}_hasGlobalContextVariable(t){return t in this._globalContextVariables}_setExecutionVariable(t,e,o){this._executionVariables[this._getUniqueIdPrefixedName(t,e)]=o}_getExecutionVariable(t,e,o){return this._hasExecutionVariable(t,e)?this._executionVariables[this._getUniqueIdPrefixedName(t,e)]:o}_deleteExecutionVariable(t,e){delete this._executionVariables[this._getUniqueIdPrefixedName(t,e)]}_hasExecutionVariable(t,e){return this._getUniqueIdPrefixedName(t,e)in this._executionVariables}_hasConnectionValue(t){return t.uniqueId in this._connectionValues}_setConnectionValue(t,e){this._connectionValues[t.uniqueId]=e,this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"SetConnectionValue",payload:{connectionPointId:t.uniqueId,value:e}})}_setConnectionValueByKey(t,e){this._connectionValues[t]=e}_getConnectionValue(t){return this.logger?.addLogItem({time:Date.now(),className:this.getClassName(),uniqueId:this.uniqueId,action:"GetConnectionValue",payload:{connectionPointId:t.uniqueId,value:this._connectionValues[t.uniqueId]}}),this._connectionValues[t.uniqueId]}get configuration(){return this._configuration}get hasPendingBlocks(){return this._pendingBlocks.length>0}_addPendingBlock(t){this._pendingBlocks.includes(t)||(this._pendingBlocks.push(t),this._pendingBlocks.sort((e,o)=>e.priority-o.priority))}_removePendingBlock(t){const e=this._pendingBlocks.indexOf(t);e!==-1&&this._pendingBlocks.splice(e,1)}_clearPendingBlocks(){for(const t of this._pendingBlocks)t._cancelPendingTasks(this);this._pendingBlocks.length=0}_notifyExecuteNode(t){this.onNodeExecutedObservable.notifyObservers(t),this.logger?.addLogItem({time:Date.now(),className:t.getClassName(),uniqueId:t.uniqueId,action:"ExecuteBlock"})}_notifyOnTick(t){this._setGlobalContextVariable("timeSinceStart",t.timeSinceStart),this._setGlobalContextVariable("deltaTime",t.deltaTime);for(const e of this._pendingBlocks)e._executeOnTick?.(this)}_increaseExecutionId(){this._executionId++}get executionId(){return this._executionId}serialize(t={},e=M){t.uniqueId=this.uniqueId,t._userVariables={};for(const o in this._userVariables)e(o,this._userVariables[o],t._userVariables);t._connectionValues={};for(const o in this._connectionValues)e(o,this._connectionValues[o],t._connectionValues);this.assetsContext!==this.getScene()&&(t._assetsContext={meshes:this.assetsContext.meshes.map(o=>o.id),materials:this.assetsContext.materials.map(o=>o.id),textures:this.assetsContext.textures.map(o=>o.name),animations:this.assetsContext.animations.map(o=>o.name),lights:this.assetsContext.lights.map(o=>o.id),cameras:this.assetsContext.cameras.map(o=>o.id),sounds:this.assetsContext.sounds?.map(o=>o.name),skeletons:this.assetsContext.skeletons.map(o=>o.id),particleSystems:this.assetsContext.particleSystems.map(o=>o.name),geometries:this.assetsContext.geometries.map(o=>o.id),multiMaterials:this.assetsContext.multiMaterials.map(o=>o.id),transformNodes:this.assetsContext.transformNodes.map(o=>o.id)})}getClassName(){return"FlowGraphContext"}}it([st()],X.prototype,"uniqueId",void 0);var U;(function(r){r[r.Input=0]="Input",r[r.Output=1]="Output"})(U||(U={}));class Y{constructor(t,e,o){this._ownerBlock=o,this._connectedPoint=[],this.uniqueId=I(),this.connectedPointIds=[],this.name=t,this._connectionType=e}get connectionType(){return this._connectionType}_isSingularConnection(){return!0}isConnected(){return this._connectedPoint.length>0}connectTo(t){if(this._connectionType===t._connectionType)throw new Error(`Cannot connect two points of type ${this.connectionType}`);if(this._isSingularConnection()&&this._connectedPoint.length>0||t._isSingularConnection()&&t._connectedPoint.length>0)throw new Error("Max number of connections for point reached");this._connectedPoint.push(t),t._connectedPoint.push(this)}disconnectFrom(t,e=!0){const o=this._connectedPoint.indexOf(t),a=t._connectedPoint.indexOf(this);o===-1||a===-1||(e&&this._connectedPoint.splice(o,1),t._connectedPoint.splice(a,1))}disconnectFromAll(){for(const t of this._connectedPoint)this.disconnectFrom(t,!1);this._connectedPoint.length=0}dispose(){for(const t of this._connectedPoint)this.disconnectFrom(t)}serialize(t={}){t.uniqueId=this.uniqueId,t.name=this.name,t._connectionType=this._connectionType,t.connectedPointIds=[],t.className=this.getClassName();for(const e of this._connectedPoint)t.connectedPointIds.push(e.uniqueId)}getClassName(){return"FGConnection"}deserialize(t){this.uniqueId=t.uniqueId,this.name=t.name,this._connectionType=t._connectionType,this.connectedPointIds=t.connectedPointIds}}class L extends Y{constructor(t,e,o,a,i=a.defaultValue,s=!1){super(t,e,o),this.richType=a,this._defaultValue=i,this._optional=s,this._isDisabled=!1,this._lastValue=null,this.dataTransformer=null,this.onValueChangedObservable=new O}get optional(){return this._optional}get isDisabled(){return this._isDisabled}set isDisabled(t){this._isDisabled!==t&&(this._isDisabled=t,this._isDisabled&&this.disconnectFromAll())}_isSingularConnection(){return this.connectionType===0}setValue(t,e){e._getConnectionValue(this)!==t&&(e._setConnectionValue(this,t),this.onValueChangedObservable.notifyObservers(t))}resetToDefaultValue(t){t._setConnectionValue(this,this._defaultValue)}connectTo(t){this._isDisabled||super.connectTo(t)}_getValueOrDefault(t){const e=t._getConnectionValue(this)??this._defaultValue;return this.dataTransformer?this.dataTransformer(e):e}getValue(t){if(this.connectionType===1){t._notifyExecuteNode(this._ownerBlock),this._ownerBlock._updateOutputs(t);const o=this._getValueOrDefault(t);return this._lastValue=o,this.richType.typeTransformer?this.richType.typeTransformer(o):o}const e=this.isConnected()?this._connectedPoint[0].getValue(t):this._getValueOrDefault(t);return this._lastValue=e,this.richType.typeTransformer?this.richType.typeTransformer(e):e}_getLastValue(){return this._lastValue}getClassName(){return"FlowGraphDataConnection"}serialize(t={}){super.serialize(t),t.richType={},this.richType.serialize(t.richType),t.optional=this._optional,M("defaultValue",this._defaultValue,t)}}J("FlowGraphDataConnection",L);class Ft{constructor(t){this.config=t,this.uniqueId=I(),this.name=this.config?.name??this.getClassName(),this.dataInputs=[],this.dataOutputs=[]}_updateOutputs(t){}registerDataInput(t,e,o){const a=new L(t,0,this,e,o);return this.dataInputs.push(a),a}registerDataOutput(t,e,o){const a=new L(t,1,this,e,o);return this.dataOutputs.push(a),a}getDataInput(t){return this.dataInputs.find(e=>e.name===t)}getDataOutput(t){return this.dataOutputs.find(e=>e.name===t)}serialize(t={},e=M){if(t.uniqueId=this.uniqueId,t.config={},this.config){const o=this.config,a=Object.keys(o);for(const i of a)e(i,o[i],t.config)}t.dataInputs=[],t.dataOutputs=[],t.className=this.getClassName();for(const o of this.dataInputs){const a={};o.serialize(a),t.dataInputs.push(a)}for(const o of this.dataOutputs){const a={};o.serialize(a),t.dataOutputs.push(a)}}deserialize(t){}_log(t,e,o){t.logger?.addLogItem({action:e,payload:o,className:this.getClassName(),uniqueId:this.uniqueId})}getClassName(){return"FlowGraphBlock"}}class S extends Y{constructor(){super(...arguments),this.priority=0}_isSingularConnection(){return!1}connectTo(t){super.connectTo(t),this._connectedPoint.sort((e,o)=>o.priority-e.priority)}_activateSignal(t){if(t.logger?.addLogItem({action:"ActivateSignal",className:this._ownerBlock.getClassName(),uniqueId:this._ownerBlock.uniqueId,payload:{connectionType:this.connectionType,name:this.name}}),this.connectionType===0)t._notifyExecuteNode(this._ownerBlock),this._ownerBlock._execute(t,this),t._increaseExecutionId();else for(const e of this._connectedPoint)e._activateSignal(t)}}J("FlowGraphSignalConnection",S);class D extends Ft{constructor(t){super(t),this.priority=0,this.signalInputs=[],this.signalOutputs=[],this.in=this._registerSignalInput("in"),this.error=this._registerSignalOutput("error")}_registerSignalInput(t){const e=new S(t,0,this);return this.signalInputs.push(e),e}_registerSignalOutput(t){const e=new S(t,1,this);return this.signalOutputs.push(e),e}_unregisterSignalInput(t){const e=this.signalInputs.findIndex(o=>o.name===t);e!==-1&&(this.signalInputs[e].dispose(),this.signalInputs.splice(e,1))}_unregisterSignalOutput(t){const e=this.signalOutputs.findIndex(o=>o.name===t);e!==-1&&(this.signalOutputs[e].dispose(),this.signalOutputs.splice(e,1))}_reportError(t,e){this.error.payload=typeof e=="string"?new Error(e):e,this.error._activateSignal(t)}getSignalInput(t){return this.signalInputs.find(e=>e.name===t)}getSignalOutput(t){return this.signalOutputs.find(e=>e.name===t)}serialize(t={}){super.serialize(t),t.signalInputs=[],t.signalOutputs=[];for(const e of this.signalInputs){const o={};e.serialize(o),t.signalInputs.push(o)}for(const e of this.signalOutputs){const o={};e.serialize(o),t.signalOutputs.push(o)}}deserialize(t){for(let e=0;e{this.sceneReadyTriggered||(this.onEventTriggeredObservable.notifyObservers({type:"SceneReady"}),this.sceneReadyTriggered=!0)}),this._sceneDisposeObserver=this._scene.onDisposeObservable.add(()=>{this.onEventTriggeredObservable.notifyObservers({type:"SceneDispose"})}),this._sceneOnBeforeRenderObserver=this._scene.onBeforeRenderObservable.add(()=>{const t=this._scene.getEngine().getDeltaTime()/1e3;this.onEventTriggeredObservable.notifyObservers({type:"SceneBeforeRender",payload:{timeSinceStart:this._startingTime,deltaTime:t}}),this._startingTime+=t}),this._meshPickedObserver=this._scene.onPointerObservable.add(t=>{this.onEventTriggeredObservable.notifyObservers({type:"MeshPick",payload:t})},q.POINTERPICK),this._meshUnderPointerObserver=this._scene.onMeshUnderPointerUpdatedObservable.add(t=>{const e=t.pointerId,o=t.mesh,a=this._pointerUnderMeshState[e];!a&&o?this.onEventTriggeredObservable.notifyObservers({type:"PointerOver",payload:{pointerId:e,mesh:o}}):a&&!o?this.onEventTriggeredObservable.notifyObservers({type:"PointerOut",payload:{pointerId:e,mesh:a}}):a&&o&&a!==o&&(this.onEventTriggeredObservable.notifyObservers({type:"PointerOut",payload:{pointerId:e,mesh:a,over:o}}),this.onEventTriggeredObservable.notifyObservers({type:"PointerOver",payload:{pointerId:e,mesh:o,out:a}})),this._pointerUnderMeshState[e]=o},q.POINTERMOVE)}dispose(){this._sceneDisposeObserver?.remove(),this._sceneReadyObserver?.remove(),this._sceneOnBeforeRenderObserver?.remove(),this._meshPickedObserver?.remove(),this._meshUnderPointerObserver?.remove(),this.onEventTriggeredObservable.clear()}}function z(r,t){return!!(r.parent&&(r.parent===t||z(r.parent,t)))}function Wt(r){if(r.getClassName)return r.getClassName()}function Ut(r,t){return r===t&&(r==="Vector2"||r==="Vector3"||r==="Vector4"||r==="Quaternion")}function Ht(r,t){return r===t&&(r==="Matrix"||r==="Matrix2D"||r==="Matrix3D")}function Qt(r,t){return r==="FlowGraphInteger"&&t==="FlowGraphInteger"}function Jt(r,t){const e=typeof r=="number"||typeof r?.value=="number";return e&&!t?!isNaN(vt(r)):e}function vt(r){return typeof r=="number"?r:r.value}var H;(function(r){r[r.Stopped=0]="Stopped",r[r.Started=1]="Started"})(H||(H={}));class It{get state(){return this._state}set state(t){this._state=t,this.onStateChangedObservable.notifyObservers(t)}constructor(t){this.onStateChangedObservable=new O,this._eventBlocks={SceneReady:[],SceneDispose:[],SceneBeforeRender:[],MeshPick:[],PointerDown:[],PointerUp:[],PointerMove:[],PointerOver:[],PointerOut:[],SceneAfterRender:[],NoTrigger:[]},this._executionContexts=[],this._state=0,this._scene=t.scene,this._sceneEventCoordinator=new Et(this._scene),this._coordinator=t.coordinator,this._eventObserver=this._sceneEventCoordinator.onEventTriggeredObservable.add(e=>{for(const o of this._executionContexts){const a=this._getContextualOrder(e.type,o);for(const i of a)if(!i._executeEvent(o,e.payload))break}switch(e.type){case"SceneReady":this._sceneEventCoordinator.sceneReadyTriggered=!0;break;case"SceneBeforeRender":for(const o of this._executionContexts)o._notifyOnTick(e.payload);break;case"SceneDispose":this.dispose();break}})}createContext(){const t=new X({scene:this._scene,coordinator:this._coordinator});return this._executionContexts.push(t),t}getContext(t){return this._executionContexts[t]}addEventBlock(t){if((t.type==="PointerOver"||t.type==="PointerOut")&&(this._scene.constantlyUpdateMeshUnderPointer=!0),t.type!=="NoTrigger"&&this._eventBlocks[t.type].push(t),this.state===1)for(const e of this._executionContexts)t._startPendingTasks(e);else this.onStateChangedObservable.addOnce(e=>{if(e===1)for(const o of this._executionContexts)t._startPendingTasks(o)})}start(){this.state!==1&&(this._executionContexts.length===0&&this.createContext(),this.onStateChangedObservable.add(t=>{t===1&&(this._startPendingEvents(),this._scene.isReady(!0)&&this._sceneEventCoordinator.onEventTriggeredObservable.notifyObservers({type:"SceneReady"}))}),this.state=1)}_startPendingEvents(){for(const t of this._executionContexts)for(const e in this._eventBlocks){const o=this._getContextualOrder(e,t);for(const a of o)a._startPendingTasks(t)}}_getContextualOrder(t,e){const o=this._eventBlocks[t].sort((a,i)=>i.initPriority-a.initPriority);if(t==="MeshPick"){const a=[];for(const i of o){const s=i.asset.getValue(e);let c=0;for(;c0;){const a=e.pop();t(a);for(const i of a.dataInputs)for(const s of i._connectedPoint)o.has(s._ownerBlock.uniqueId)||(e.push(s._ownerBlock),o.add(s._ownerBlock.uniqueId));if(a instanceof D)for(const i of a.signalOutputs)for(const s of i._connectedPoint)o.has(s._ownerBlock.uniqueId)||(e.push(s._ownerBlock),o.add(s._ownerBlock.uniqueId))}}serialize(t={},e){t.allBlocks=[],this.visitAllBlocks(o=>{const a={};o.serialize(a),t.allBlocks.push(a)}),t.executionContexts=[];for(const o of this._executionContexts){const a={};o.serialize(a,e),t.executionContexts.push(a)}}}class g{constructor(t){this.config=t,this.dispatchEventsSynchronously=!0,this._flowGraphs=[],this._customEventsMap=new Map,this._eventExecutionCounter=new Map,this._executeOnNextFrame=[],this._eventUniqueId=0,this._disposeObserver=this.config.scene.onDisposeObservable.add(()=>{this.dispose()}),this._onBeforeRenderObserver=this.config.scene.onBeforeRenderObservable.add(()=>{this._eventExecutionCounter.clear();const o=this._executeOnNextFrame.slice(0);if(o.length)for(const a of o){this.notifyCustomEvent(a.id,a.data,!1);const i=this._executeOnNextFrame.findIndex(s=>s.uniqueId===a.uniqueId);i!==-1&&this._executeOnNextFrame.splice(i,1)}}),(g.SceneCoordinators.get(this.config.scene)??[]).push(this)}createGraph(){const t=new It({scene:this.config.scene,coordinator:this});return this._flowGraphs.push(t),t}removeGraph(t){const e=this._flowGraphs.indexOf(t);e!==-1&&(t.dispose(),this._flowGraphs.splice(e,1))}start(){for(const t of this._flowGraphs)t.start()}dispose(){for(const o of this._flowGraphs)o.dispose();this._flowGraphs.length=0,this._disposeObserver?.remove(),this._onBeforeRenderObserver?.remove();const t=g.SceneCoordinators.get(this.config.scene)??[],e=t.indexOf(this);e!==-1&&t.splice(e,1)}serialize(t,e){t._flowGraphs=[];for(const o of this._flowGraphs){const a={};o.serialize(a,e),t._flowGraphs.push(a)}t.dispatchEventsSynchronously=this.dispatchEventsSynchronously}get flowGraphs(){return this._flowGraphs}getCustomEventObservable(t){let e=this._customEventsMap.get(t);return e||(e=new O,this._customEventsMap.set(t,e)),e}notifyCustomEvent(t,e,o=!this.dispatchEventsSynchronously){if(o){this._executeOnNextFrame.push({id:t,data:e,uniqueId:this._eventUniqueId++});return}if(this._eventExecutionCounter.has(t)){const i=this._eventExecutionCounter.get(t);if(this._eventExecutionCounter.set(t,i+1),i>=g.MaxEventTypeExecutionPerFrame){i===g.MaxEventTypeExecutionPerFrame&&p.Warn(`FlowGraphCoordinator: Too many executions of event "${t}".`);return}}else this._eventExecutionCounter.set(t,1);const a=this._customEventsMap.get(t);a&&a.notifyObservers(e)}}g.MaxEventsPerType=30;g.MaxEventTypeExecutionPerFrame=30;g.SceneCoordinators=new Map;const N={};function Tt(r,t,e){N[`${r}/${t}`]=e}function Vt(r){switch(r){case"FlowGraphPlayAnimationBlock":return async()=>(await n(async()=>{const{FlowGraphPlayAnimationBlock:t}=await import("./flowGraphPlayAnimationBlock-CEIRjwmT.js");return{FlowGraphPlayAnimationBlock:t}},__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)).FlowGraphPlayAnimationBlock;case"FlowGraphStopAnimationBlock":return async()=>(await n(async()=>{const{FlowGraphStopAnimationBlock:t}=await import("./flowGraphStopAnimationBlock-DzdM2S-i.js");return{FlowGraphStopAnimationBlock:t}},__vite__mapDeps([8,1,2,3,4,7]),import.meta.url)).FlowGraphStopAnimationBlock;case"FlowGraphPauseAnimationBlock":return async()=>(await n(async()=>{const{FlowGraphPauseAnimationBlock:t}=await import("./flowGraphPauseAnimationBlock-BCBVeYeV.js");return{FlowGraphPauseAnimationBlock:t}},__vite__mapDeps([9,1,2,3,4,7]),import.meta.url)).FlowGraphPauseAnimationBlock;case"FlowGraphInterpolationBlock":return async()=>(await n(async()=>{const{FlowGraphInterpolationBlock:t}=await import("./flowGraphInterpolationBlock-DTRpEzHP.js");return{FlowGraphInterpolationBlock:t}},__vite__mapDeps([10,1,2,3,4,7]),import.meta.url)).FlowGraphInterpolationBlock;case"FlowGraphSceneReadyEventBlock":return async()=>(await n(async()=>{const{FlowGraphSceneReadyEventBlock:t}=await import("./flowGraphSceneReadyEventBlock-8yWc5f3q.js");return{FlowGraphSceneReadyEventBlock:t}},__vite__mapDeps([11,2,3,4,1,7]),import.meta.url)).FlowGraphSceneReadyEventBlock;case"FlowGraphSceneTickEventBlock":return async()=>(await n(async()=>{const{FlowGraphSceneTickEventBlock:t}=await import("./flowGraphSceneTickEventBlock-wqnxDI01.js");return{FlowGraphSceneTickEventBlock:t}},__vite__mapDeps([12,2,3,4,1,7]),import.meta.url)).FlowGraphSceneTickEventBlock;case"FlowGraphSendCustomEventBlock":return async()=>(await n(async()=>{const{FlowGraphSendCustomEventBlock:t}=await import("./flowGraphSendCustomEventBlock-COnjPh-a.js");return{FlowGraphSendCustomEventBlock:t}},__vite__mapDeps([13,2,3,4,1,7]),import.meta.url)).FlowGraphSendCustomEventBlock;case"FlowGraphReceiveCustomEventBlock":return async()=>(await n(async()=>{const{FlowGraphReceiveCustomEventBlock:t}=await import("./flowGraphReceiveCustomEventBlock-CHr_E_rI.js");return{FlowGraphReceiveCustomEventBlock:t}},__vite__mapDeps([14,2,3,4,1,7]),import.meta.url)).FlowGraphReceiveCustomEventBlock;case"FlowGraphMeshPickEventBlock":return async()=>(await n(async()=>{const{FlowGraphMeshPickEventBlock:t}=await import("./flowGraphMeshPickEventBlock-336WsC8m.js");return{FlowGraphMeshPickEventBlock:t}},__vite__mapDeps([15,2,3,4,1,7]),import.meta.url)).FlowGraphMeshPickEventBlock;case"FlowGraphEBlock":return async()=>(await n(async()=>{const{FlowGraphEBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphEBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphEBlock;case"FlowGraphPIBlock":return async()=>(await n(async()=>{const{FlowGraphPiBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphPiBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphPiBlock;case"FlowGraphInfBlock":return async()=>(await n(async()=>{const{FlowGraphInfBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphInfBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphInfBlock;case"FlowGraphNaNBlock":return async()=>(await n(async()=>{const{FlowGraphNaNBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphNaNBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphNaNBlock;case"FlowGraphRandomBlock":return async()=>(await n(async()=>{const{FlowGraphRandomBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphRandomBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphRandomBlock;case"FlowGraphAddBlock":return async()=>(await n(async()=>{const{FlowGraphAddBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphAddBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphAddBlock;case"FlowGraphSubtractBlock":return async()=>(await n(async()=>{const{FlowGraphSubtractBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphSubtractBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphSubtractBlock;case"FlowGraphMultiplyBlock":return async()=>(await n(async()=>{const{FlowGraphMultiplyBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphMultiplyBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphMultiplyBlock;case"FlowGraphDivideBlock":return async()=>(await n(async()=>{const{FlowGraphDivideBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphDivideBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphDivideBlock;case"FlowGraphAbsBlock":return async()=>(await n(async()=>{const{FlowGraphAbsBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphAbsBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphAbsBlock;case"FlowGraphSignBlock":return async()=>(await n(async()=>{const{FlowGraphSignBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphSignBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphSignBlock;case"FlowGraphTruncBlock":return async()=>(await n(async()=>{const{FlowGraphTruncBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphTruncBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphTruncBlock;case"FlowGraphFloorBlock":return async()=>(await n(async()=>{const{FlowGraphFloorBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphFloorBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphFloorBlock;case"FlowGraphCeilBlock":return async()=>(await n(async()=>{const{FlowGraphCeilBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphCeilBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphCeilBlock;case"FlowGraphRoundBlock":return async()=>(await n(async()=>{const{FlowGraphRoundBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphRoundBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphRoundBlock;case"FlowGraphFractBlock":return async()=>(await n(async()=>{const{FlowGraphFractionBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphFractionBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphFractionBlock;case"FlowGraphNegationBlock":return async()=>(await n(async()=>{const{FlowGraphNegationBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphNegationBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphNegationBlock;case"FlowGraphModuloBlock":return async()=>(await n(async()=>{const{FlowGraphModuloBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphModuloBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphModuloBlock;case"FlowGraphMinBlock":return async()=>(await n(async()=>{const{FlowGraphMinBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphMinBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphMinBlock;case"FlowGraphMaxBlock":return async()=>(await n(async()=>{const{FlowGraphMaxBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphMaxBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphMaxBlock;case"FlowGraphClampBlock":return async()=>(await n(async()=>{const{FlowGraphClampBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphClampBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphClampBlock;case"FlowGraphSaturateBlock":return async()=>(await n(async()=>{const{FlowGraphSaturateBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphSaturateBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphSaturateBlock;case"FlowGraphMathInterpolationBlock":return async()=>(await n(async()=>{const{FlowGraphMathInterpolationBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphMathInterpolationBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphMathInterpolationBlock;case"FlowGraphEqualityBlock":return async()=>(await n(async()=>{const{FlowGraphEqualityBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphEqualityBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphEqualityBlock;case"FlowGraphLessThanBlock":return async()=>(await n(async()=>{const{FlowGraphLessThanBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphLessThanBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphLessThanBlock;case"FlowGraphLessThanOrEqualBlock":return async()=>(await n(async()=>{const{FlowGraphLessThanOrEqualBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphLessThanOrEqualBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphLessThanOrEqualBlock;case"FlowGraphGreaterThanBlock":return async()=>(await n(async()=>{const{FlowGraphGreaterThanBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphGreaterThanBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphGreaterThanBlock;case"FlowGraphGreaterThanOrEqualBlock":return async()=>(await n(async()=>{const{FlowGraphGreaterThanOrEqualBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphGreaterThanOrEqualBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphGreaterThanOrEqualBlock;case"FlowGraphIsNaNBlock":return async()=>(await n(async()=>{const{FlowGraphIsNanBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphIsNanBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphIsNanBlock;case"FlowGraphIsInfBlock":return async()=>(await n(async()=>{const{FlowGraphIsInfinityBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphIsInfinityBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphIsInfinityBlock;case"FlowGraphDegToRadBlock":return async()=>(await n(async()=>{const{FlowGraphDegToRadBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphDegToRadBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphDegToRadBlock;case"FlowGraphRadToDegBlock":return async()=>(await n(async()=>{const{FlowGraphRadToDegBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphRadToDegBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphRadToDegBlock;case"FlowGraphSinBlock":return async()=>(await n(async()=>{const{FlowGraphSinBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphSinBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphSinBlock;case"FlowGraphCosBlock":return async()=>(await n(async()=>{const{FlowGraphCosBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphCosBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphCosBlock;case"FlowGraphTanBlock":return async()=>(await n(async()=>{const{FlowGraphTanBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphTanBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphTanBlock;case"FlowGraphASinBlock":return async()=>(await n(async()=>{const{FlowGraphAsinBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphAsinBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphAsinBlock;case"FlowGraphACosBlock":return async()=>(await n(async()=>{const{FlowGraphAcosBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphAcosBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphAcosBlock;case"FlowGraphATanBlock":return async()=>(await n(async()=>{const{FlowGraphAtanBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphAtanBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphAtanBlock;case"FlowGraphATan2Block":return async()=>(await n(async()=>{const{FlowGraphAtan2Block:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphAtan2Block:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphAtan2Block;case"FlowGraphSinhBlock":return async()=>(await n(async()=>{const{FlowGraphSinhBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphSinhBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphSinhBlock;case"FlowGraphCoshBlock":return async()=>(await n(async()=>{const{FlowGraphCoshBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphCoshBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphCoshBlock;case"FlowGraphTanhBlock":return async()=>(await n(async()=>{const{FlowGraphTanhBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphTanhBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphTanhBlock;case"FlowGraphASinhBlock":return async()=>(await n(async()=>{const{FlowGraphAsinhBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphAsinhBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphAsinhBlock;case"FlowGraphACoshBlock":return async()=>(await n(async()=>{const{FlowGraphAcoshBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphAcoshBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphAcoshBlock;case"FlowGraphATanhBlock":return async()=>(await n(async()=>{const{FlowGraphAtanhBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphAtanhBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphAtanhBlock;case"FlowGraphExponentialBlock":return async()=>(await n(async()=>{const{FlowGraphExpBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphExpBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphExpBlock;case"FlowGraphLogBlock":return async()=>(await n(async()=>{const{FlowGraphLogBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphLogBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphLogBlock;case"FlowGraphLog2Block":return async()=>(await n(async()=>{const{FlowGraphLog2Block:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphLog2Block:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphLog2Block;case"FlowGraphLog10Block":return async()=>(await n(async()=>{const{FlowGraphLog10Block:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphLog10Block:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphLog10Block;case"FlowGraphSquareRootBlock":return async()=>(await n(async()=>{const{FlowGraphSquareRootBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphSquareRootBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphSquareRootBlock;case"FlowGraphPowerBlock":return async()=>(await n(async()=>{const{FlowGraphPowerBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphPowerBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphPowerBlock;case"FlowGraphCubeRootBlock":return async()=>(await n(async()=>{const{FlowGraphCubeRootBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphCubeRootBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphCubeRootBlock;case"FlowGraphBitwiseAndBlock":return async()=>(await n(async()=>{const{FlowGraphBitwiseAndBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphBitwiseAndBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphBitwiseAndBlock;case"FlowGraphBitwiseOrBlock":return async()=>(await n(async()=>{const{FlowGraphBitwiseOrBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphBitwiseOrBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphBitwiseOrBlock;case"FlowGraphBitwiseNotBlock":return async()=>(await n(async()=>{const{FlowGraphBitwiseNotBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphBitwiseNotBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphBitwiseNotBlock;case"FlowGraphBitwiseXorBlock":return async()=>(await n(async()=>{const{FlowGraphBitwiseXorBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphBitwiseXorBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphBitwiseXorBlock;case"FlowGraphBitwiseLeftShiftBlock":return async()=>(await n(async()=>{const{FlowGraphBitwiseLeftShiftBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphBitwiseLeftShiftBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphBitwiseLeftShiftBlock;case"FlowGraphBitwiseRightShiftBlock":return async()=>(await n(async()=>{const{FlowGraphBitwiseRightShiftBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphBitwiseRightShiftBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphBitwiseRightShiftBlock;case"FlowGraphLengthBlock":return async()=>(await n(async()=>{const{FlowGraphLengthBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphLengthBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphLengthBlock;case"FlowGraphNormalizeBlock":return async()=>(await n(async()=>{const{FlowGraphNormalizeBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphNormalizeBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphNormalizeBlock;case"FlowGraphDotBlock":return async()=>(await n(async()=>{const{FlowGraphDotBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphDotBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphDotBlock;case"FlowGraphCrossBlock":return async()=>(await n(async()=>{const{FlowGraphCrossBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphCrossBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphCrossBlock;case"FlowGraphRotate2DBlock":return async()=>(await n(async()=>{const{FlowGraphRotate2DBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphRotate2DBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphRotate2DBlock;case"FlowGraphRotate3DBlock":return async()=>(await n(async()=>{const{FlowGraphRotate3DBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphRotate3DBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphRotate3DBlock;case"FlowGraphTransposeBlock":return async()=>(await n(async()=>{const{FlowGraphTransposeBlock:t}=await import("./flowGraphMatrixMathBlocks-D7ABsNS4.js");return{FlowGraphTransposeBlock:t}},__vite__mapDeps([21,1,2,3,4,19,18,17,7]),import.meta.url)).FlowGraphTransposeBlock;case"FlowGraphDeterminantBlock":return async()=>(await n(async()=>{const{FlowGraphDeterminantBlock:t}=await import("./flowGraphMatrixMathBlocks-D7ABsNS4.js");return{FlowGraphDeterminantBlock:t}},__vite__mapDeps([21,1,2,3,4,19,18,17,7]),import.meta.url)).FlowGraphDeterminantBlock;case"FlowGraphInvertMatrixBlock":return async()=>(await n(async()=>{const{FlowGraphInvertMatrixBlock:t}=await import("./flowGraphMatrixMathBlocks-D7ABsNS4.js");return{FlowGraphInvertMatrixBlock:t}},__vite__mapDeps([21,1,2,3,4,19,18,17,7]),import.meta.url)).FlowGraphInvertMatrixBlock;case"FlowGraphMatrixMultiplicationBlock":return async()=>(await n(async()=>{const{FlowGraphMatrixMultiplicationBlock:t}=await import("./flowGraphMatrixMathBlocks-D7ABsNS4.js");return{FlowGraphMatrixMultiplicationBlock:t}},__vite__mapDeps([21,1,2,3,4,19,18,17,7]),import.meta.url)).FlowGraphMatrixMultiplicationBlock;case"FlowGraphBranchBlock":return async()=>(await n(async()=>{const{FlowGraphBranchBlock:t}=await import("./flowGraphBranchBlock-C7xYG2zV.js");return{FlowGraphBranchBlock:t}},__vite__mapDeps([22,1,2,3,4,7]),import.meta.url)).FlowGraphBranchBlock;case"FlowGraphSetDelayBlock":return async()=>(await n(async()=>{const{FlowGraphSetDelayBlock:t}=await import("./flowGraphSetDelayBlock-C-Ra3zyP.js");return{FlowGraphSetDelayBlock:t}},__vite__mapDeps([23,1,2,3,4,7]),import.meta.url)).FlowGraphSetDelayBlock;case"FlowGraphCancelDelayBlock":return async()=>(await n(async()=>{const{FlowGraphCancelDelayBlock:t}=await import("./flowGraphCancelDelayBlock-BJcCzox9.js");return{FlowGraphCancelDelayBlock:t}},__vite__mapDeps([24,2,3,4,1,7]),import.meta.url)).FlowGraphCancelDelayBlock;case"FlowGraphCallCounterBlock":return async()=>(await n(async()=>{const{FlowGraphCallCounterBlock:t}=await import("./flowGraphCounterBlock-BzmD6VO2.js");return{FlowGraphCallCounterBlock:t}},__vite__mapDeps([25,1,2,3,4,7]),import.meta.url)).FlowGraphCallCounterBlock;case"FlowGraphDebounceBlock":return async()=>(await n(async()=>{const{FlowGraphDebounceBlock:t}=await import("./flowGraphDebounceBlock-CXVcNbRh.js");return{FlowGraphDebounceBlock:t}},__vite__mapDeps([26,1,2,3,4,7]),import.meta.url)).FlowGraphDebounceBlock;case"FlowGraphThrottleBlock":return async()=>(await n(async()=>{const{FlowGraphThrottleBlock:t}=await import("./flowGraphThrottleBlock-CbQ41JKj.js");return{FlowGraphThrottleBlock:t}},__vite__mapDeps([27,1,2,3,4,7]),import.meta.url)).FlowGraphThrottleBlock;case"FlowGraphDoNBlock":return async()=>(await n(async()=>{const{FlowGraphDoNBlock:t}=await import("./flowGraphDoNBlock-CP3xgcll.js");return{FlowGraphDoNBlock:t}},__vite__mapDeps([28,1,2,3,4,7]),import.meta.url)).FlowGraphDoNBlock;case"FlowGraphFlipFlopBlock":return async()=>(await n(async()=>{const{FlowGraphFlipFlopBlock:t}=await import("./flowGraphFlipFlopBlock-Y6garx3E.js");return{FlowGraphFlipFlopBlock:t}},__vite__mapDeps([29,1,2,3,4,7]),import.meta.url)).FlowGraphFlipFlopBlock;case"FlowGraphForLoopBlock":return async()=>(await n(async()=>{const{FlowGraphForLoopBlock:t}=await import("./flowGraphForLoopBlock-DUZ0AOjo.js");return{FlowGraphForLoopBlock:t}},__vite__mapDeps([30,1,2,3,4,7]),import.meta.url)).FlowGraphForLoopBlock;case"FlowGraphMultiGateBlock":return async()=>(await n(async()=>{const{FlowGraphMultiGateBlock:t}=await import("./flowGraphMultiGateBlock-4iS0VrNF.js");return{FlowGraphMultiGateBlock:t}},__vite__mapDeps([31,2,3,4,1,7]),import.meta.url)).FlowGraphMultiGateBlock;case"FlowGraphSequenceBlock":return async()=>(await n(async()=>{const{FlowGraphSequenceBlock:t}=await import("./flowGraphSequenceBlock-C1cNgLhX.js");return{FlowGraphSequenceBlock:t}},__vite__mapDeps([32,2,3,4,1,7]),import.meta.url)).FlowGraphSequenceBlock;case"FlowGraphSwitchBlock":return async()=>(await n(async()=>{const{FlowGraphSwitchBlock:t}=await import("./flowGraphSwitchBlock-BfoWGleb.js");return{FlowGraphSwitchBlock:t}},__vite__mapDeps([33,1,2,3,4,7]),import.meta.url)).FlowGraphSwitchBlock;case"FlowGraphWaitAllBlock":return async()=>(await n(async()=>{const{FlowGraphWaitAllBlock:t}=await import("./flowGraphWaitAllBlock-CK10vDaH.js");return{FlowGraphWaitAllBlock:t}},__vite__mapDeps([34,2,3,4,1,7]),import.meta.url)).FlowGraphWaitAllBlock;case"FlowGraphWhileLoopBlock":return async()=>(await n(async()=>{const{FlowGraphWhileLoopBlock:t}=await import("./flowGraphWhileLoopBlock-BWIuZKmu.js");return{FlowGraphWhileLoopBlock:t}},__vite__mapDeps([35,1,2,3,4,7]),import.meta.url)).FlowGraphWhileLoopBlock;case"FlowGraphConsoleLogBlock":return async()=>(await n(async()=>{const{FlowGraphConsoleLogBlock:t}=await import("./flowGraphConsoleLogBlock-CdBKcOMZ.js");return{FlowGraphConsoleLogBlock:t}},__vite__mapDeps([36,1,2,3,4,7]),import.meta.url)).FlowGraphConsoleLogBlock;case"FlowGraphConditionalBlock":return async()=>(await n(async()=>{const{FlowGraphConditionalDataBlock:t}=await import("./flowGraphConditionalDataBlock-Cv7dnhcP.js");return{FlowGraphConditionalDataBlock:t}},__vite__mapDeps([37,1,2,3,4,7]),import.meta.url)).FlowGraphConditionalDataBlock;case"FlowGraphConstantBlock":return async()=>(await n(async()=>{const{FlowGraphConstantBlock:t}=await import("./flowGraphConstantBlock-O3j13zGE.js");return{FlowGraphConstantBlock:t}},__vite__mapDeps([38,1,2,3,4,7]),import.meta.url)).FlowGraphConstantBlock;case"FlowGraphTransformCoordinatesSystemBlock":return async()=>(await n(async()=>{const{FlowGraphTransformCoordinatesSystemBlock:t}=await import("./flowGraphTransformCoordinatesSystemBlock-BtSaynCM.js");return{FlowGraphTransformCoordinatesSystemBlock:t}},__vite__mapDeps([39,1,2,3,4,7]),import.meta.url)).FlowGraphTransformCoordinatesSystemBlock;case"FlowGraphGetAssetBlock":return async()=>(await n(async()=>{const{FlowGraphGetAssetBlock:t}=await import("./flowGraphGetAssetBlock-DKMD3fRB.js");return{FlowGraphGetAssetBlock:t}},__vite__mapDeps([40,1,2,3,4,7]),import.meta.url)).FlowGraphGetAssetBlock;case"FlowGraphGetPropertyBlock":return async()=>(await n(async()=>{const{FlowGraphGetPropertyBlock:t}=await import("./flowGraphGetPropertyBlock-DRLha8FE.js");return{FlowGraphGetPropertyBlock:t}},__vite__mapDeps([41,1,2,3,4,18,7]),import.meta.url)).FlowGraphGetPropertyBlock;case"FlowGraphSetPropertyBlock":return async()=>(await n(async()=>{const{FlowGraphSetPropertyBlock:t}=await import("./flowGraphSetPropertyBlock-63nD7ivc.js");return{FlowGraphSetPropertyBlock:t}},__vite__mapDeps([42,1,2,3,4,7]),import.meta.url)).FlowGraphSetPropertyBlock;case"FlowGraphGetVariableBlock":return async()=>(await n(async()=>{const{FlowGraphGetVariableBlock:t}=await import("./flowGraphGetVariableBlock-DRAnW3yF.js");return{FlowGraphGetVariableBlock:t}},__vite__mapDeps([43,1,2,3,4,7]),import.meta.url)).FlowGraphGetVariableBlock;case"FlowGraphSetVariableBlock":return async()=>(await n(async()=>{const{FlowGraphSetVariableBlock:t}=await import("./flowGraphSetVariableBlock-DczV7NIl.js");return{FlowGraphSetVariableBlock:t}},__vite__mapDeps([44,2,3,4,1,7]),import.meta.url)).FlowGraphSetVariableBlock;case"FlowGraphJsonPointerParserBlock":return async()=>(await n(async()=>{const{FlowGraphJsonPointerParserBlock:t}=await import("./flowGraphJsonPointerParserBlock-BDL8JHpS.js");return{FlowGraphJsonPointerParserBlock:t}},__vite__mapDeps([45,1,2,3,4,18,7]),import.meta.url)).FlowGraphJsonPointerParserBlock;case"FlowGraphLeadingZerosBlock":return async()=>(await n(async()=>{const{FlowGraphLeadingZerosBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphLeadingZerosBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphLeadingZerosBlock;case"FlowGraphTrailingZerosBlock":return async()=>(await n(async()=>{const{FlowGraphTrailingZerosBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphTrailingZerosBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphTrailingZerosBlock;case"FlowGraphOneBitsCounterBlock":return async()=>(await n(async()=>{const{FlowGraphOneBitsCounterBlock:t}=await import("./flowGraphMathBlocks-B5QWBKgA.js");return{FlowGraphOneBitsCounterBlock:t}},__vite__mapDeps([16,2,3,4,1,17,18,19,7]),import.meta.url)).FlowGraphOneBitsCounterBlock;case"FlowGraphCombineVector2Block":return async()=>(await n(async()=>{const{FlowGraphCombineVector2Block:t}=await import("./flowGraphMathCombineExtractBlocks-CsnqKtJp.js");return{FlowGraphCombineVector2Block:t}},__vite__mapDeps([46,18,1,2,3,4,7]),import.meta.url)).FlowGraphCombineVector2Block;case"FlowGraphCombineVector3Block":return async()=>(await n(async()=>{const{FlowGraphCombineVector3Block:t}=await import("./flowGraphMathCombineExtractBlocks-CsnqKtJp.js");return{FlowGraphCombineVector3Block:t}},__vite__mapDeps([46,18,1,2,3,4,7]),import.meta.url)).FlowGraphCombineVector3Block;case"FlowGraphCombineVector4Block":return async()=>(await n(async()=>{const{FlowGraphCombineVector4Block:t}=await import("./flowGraphMathCombineExtractBlocks-CsnqKtJp.js");return{FlowGraphCombineVector4Block:t}},__vite__mapDeps([46,18,1,2,3,4,7]),import.meta.url)).FlowGraphCombineVector4Block;case"FlowGraphCombineMatrixBlock":return async()=>(await n(async()=>{const{FlowGraphCombineMatrixBlock:t}=await import("./flowGraphMathCombineExtractBlocks-CsnqKtJp.js");return{FlowGraphCombineMatrixBlock:t}},__vite__mapDeps([46,18,1,2,3,4,7]),import.meta.url)).FlowGraphCombineMatrixBlock;case"FlowGraphExtractVector2Block":return async()=>(await n(async()=>{const{FlowGraphExtractVector2Block:t}=await import("./flowGraphMathCombineExtractBlocks-CsnqKtJp.js");return{FlowGraphExtractVector2Block:t}},__vite__mapDeps([46,18,1,2,3,4,7]),import.meta.url)).FlowGraphExtractVector2Block;case"FlowGraphExtractVector3Block":return async()=>(await n(async()=>{const{FlowGraphExtractVector3Block:t}=await import("./flowGraphMathCombineExtractBlocks-CsnqKtJp.js");return{FlowGraphExtractVector3Block:t}},__vite__mapDeps([46,18,1,2,3,4,7]),import.meta.url)).FlowGraphExtractVector3Block;case"FlowGraphExtractVector4Block":return async()=>(await n(async()=>{const{FlowGraphExtractVector4Block:t}=await import("./flowGraphMathCombineExtractBlocks-CsnqKtJp.js");return{FlowGraphExtractVector4Block:t}},__vite__mapDeps([46,18,1,2,3,4,7]),import.meta.url)).FlowGraphExtractVector4Block;case"FlowGraphExtractMatrixBlock":return async()=>(await n(async()=>{const{FlowGraphExtractMatrixBlock:t}=await import("./flowGraphMathCombineExtractBlocks-CsnqKtJp.js");return{FlowGraphExtractMatrixBlock:t}},__vite__mapDeps([46,18,1,2,3,4,7]),import.meta.url)).FlowGraphExtractMatrixBlock;case"FlowGraphTransformVectorBlock":return async()=>(await n(async()=>{const{FlowGraphTransformBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphTransformBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphTransformBlock;case"FlowGraphTransformCoordinatesBlock":return async()=>(await n(async()=>{const{FlowGraphTransformCoordinatesBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphTransformCoordinatesBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphTransformCoordinatesBlock;case"FlowGraphConjugateBlock":return async()=>(await n(async()=>{const{FlowGraphConjugateBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphConjugateBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphConjugateBlock;case"FlowGraphAngleBetweenBlock":return async()=>(await n(async()=>{const{FlowGraphAngleBetweenBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphAngleBetweenBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphAngleBetweenBlock;case"FlowGraphQuaternionFromAxisAngleBlock":return async()=>(await n(async()=>{const{FlowGraphQuaternionFromAxisAngleBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphQuaternionFromAxisAngleBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphQuaternionFromAxisAngleBlock;case"FlowGraphAxisAngleFromQuaternionBlock":return async()=>(await n(async()=>{const{FlowGraphAxisAngleFromQuaternionBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphAxisAngleFromQuaternionBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphAxisAngleFromQuaternionBlock;case"FlowGraphQuaternionFromDirectionsBlock":return async()=>(await n(async()=>{const{FlowGraphQuaternionFromDirectionsBlock:t}=await import("./flowGraphVectorMathBlocks-DIRRvNKz.js");return{FlowGraphQuaternionFromDirectionsBlock:t}},__vite__mapDeps([20,1,2,3,4,17,18,19,7]),import.meta.url)).FlowGraphQuaternionFromDirectionsBlock;case"FlowGraphMatrixDecompose":return async()=>(await n(async()=>{const{FlowGraphMatrixDecomposeBlock:t}=await import("./flowGraphMatrixMathBlocks-D7ABsNS4.js");return{FlowGraphMatrixDecomposeBlock:t}},__vite__mapDeps([21,1,2,3,4,19,18,17,7]),import.meta.url)).FlowGraphMatrixDecomposeBlock;case"FlowGraphMatrixCompose":return async()=>(await n(async()=>{const{FlowGraphMatrixComposeBlock:t}=await import("./flowGraphMatrixMathBlocks-D7ABsNS4.js");return{FlowGraphMatrixComposeBlock:t}},__vite__mapDeps([21,1,2,3,4,19,18,17,7]),import.meta.url)).FlowGraphMatrixComposeBlock;case"FlowGraphBooleanToFloat":return async()=>(await n(async()=>{const{FlowGraphBooleanToFloat:t}=await import("./flowGraphTypeToTypeBlocks-Bka59VEo.js");return{FlowGraphBooleanToFloat:t}},__vite__mapDeps([47,19,18,1,2,3,4,7]),import.meta.url)).FlowGraphBooleanToFloat;case"FlowGraphBooleanToInt":return async()=>(await n(async()=>{const{FlowGraphBooleanToInt:t}=await import("./flowGraphTypeToTypeBlocks-Bka59VEo.js");return{FlowGraphBooleanToInt:t}},__vite__mapDeps([47,19,18,1,2,3,4,7]),import.meta.url)).FlowGraphBooleanToInt;case"FlowGraphFloatToBoolean":return async()=>(await n(async()=>{const{FlowGraphFloatToBoolean:t}=await import("./flowGraphTypeToTypeBlocks-Bka59VEo.js");return{FlowGraphFloatToBoolean:t}},__vite__mapDeps([47,19,18,1,2,3,4,7]),import.meta.url)).FlowGraphFloatToBoolean;case"FlowGraphIntToBoolean":return async()=>(await n(async()=>{const{FlowGraphIntToBoolean:t}=await import("./flowGraphTypeToTypeBlocks-Bka59VEo.js");return{FlowGraphIntToBoolean:t}},__vite__mapDeps([47,19,18,1,2,3,4,7]),import.meta.url)).FlowGraphIntToBoolean;case"FlowGraphIntToFloat":return async()=>(await n(async()=>{const{FlowGraphIntToFloat:t}=await import("./flowGraphTypeToTypeBlocks-Bka59VEo.js");return{FlowGraphIntToFloat:t}},__vite__mapDeps([47,19,18,1,2,3,4,7]),import.meta.url)).FlowGraphIntToFloat;case"FlowGraphFloatToInt":return async()=>(await n(async()=>{const{FlowGraphFloatToInt:t}=await import("./flowGraphTypeToTypeBlocks-Bka59VEo.js");return{FlowGraphFloatToInt:t}},__vite__mapDeps([47,19,18,1,2,3,4,7]),import.meta.url)).FlowGraphFloatToInt;case"FlowGraphEasingBlock":return async()=>(await n(async()=>{const{FlowGraphEasingBlock:t}=await import("./flowGraphEasingBlock-3nljISe1.js");return{FlowGraphEasingBlock:t}},__vite__mapDeps([48,2,3,4,1,7]),import.meta.url)).FlowGraphEasingBlock;case"FlowGraphBezierCurveEasing":return async()=>(await n(async()=>{const{FlowGraphBezierCurveEasingBlock:t}=await import("./flowGraphBezierCurveEasingBlock-DlxSIPlI.js");return{FlowGraphBezierCurveEasingBlock:t}},__vite__mapDeps([49,2,3,4,1,7]),import.meta.url)).FlowGraphBezierCurveEasingBlock;case"FlowGraphPointerOverEventBlock":return async()=>(await n(async()=>{const{FlowGraphPointerOverEventBlock:t}=await import("./flowGraphPointerOverEventBlock-CvKef7MZ.js");return{FlowGraphPointerOverEventBlock:t}},__vite__mapDeps([50,1,2,3,4,7]),import.meta.url)).FlowGraphPointerOverEventBlock;case"FlowGraphPointerOutEventBlock":return async()=>(await n(async()=>{const{FlowGraphPointerOutEventBlock:t}=await import("./flowGraphPointerOutEventBlock-p8RUrh0M.js");return{FlowGraphPointerOutEventBlock:t}},__vite__mapDeps([51,1,2,3,4,7]),import.meta.url)).FlowGraphPointerOutEventBlock;case"FlowGraphContextBlock":return async()=>(await n(async()=>{const{FlowGraphContextBlock:t}=await import("./flowGraphContextBlock-Cob0aKB2.js");return{FlowGraphContextBlock:t}},__vite__mapDeps([52,1,2,3,4,7]),import.meta.url)).FlowGraphContextBlock;case"FlowGraphArrayIndexBlock":return async()=>(await n(async()=>{const{FlowGraphArrayIndexBlock:t}=await import("./flowGraphArrayIndexBlock-DCHGYI8d.js");return{FlowGraphArrayIndexBlock:t}},__vite__mapDeps([53,1,2,3,4,7]),import.meta.url)).FlowGraphArrayIndexBlock;case"FlowGraphCodeExecutionBlock":return async()=>(await n(async()=>{const{FlowGraphCodeExecutionBlock:t}=await import("./flowGraphCodeExecutionBlock-CpslCx7t.js");return{FlowGraphCodeExecutionBlock:t}},__vite__mapDeps([54,1,2,3,4,7]),import.meta.url)).FlowGraphCodeExecutionBlock;case"FlowGraphIndexOfBlock":return async()=>(await n(async()=>{const{FlowGraphIndexOfBlock:t}=await import("./flowGraphIndexOfBlock-CrObGRpk.js");return{FlowGraphIndexOfBlock:t}},__vite__mapDeps([55,1,2,3,4,7]),import.meta.url)).FlowGraphIndexOfBlock;case"FlowGraphFunctionReference":return async()=>(await n(async()=>{const{FlowGraphFunctionReferenceBlock:t}=await import("./flowGraphFunctionReferenceBlock-Bd_srACE.js");return{FlowGraphFunctionReferenceBlock:t}},__vite__mapDeps([56,1,2,3,4,7]),import.meta.url)).FlowGraphFunctionReferenceBlock;case"FlowGraphDataSwitchBlock":return async()=>(await n(async()=>{const{FlowGraphDataSwitchBlock:t}=await import("./flowGraphDataSwitchBlock-0lH2SmaQ.js");return{FlowGraphDataSwitchBlock:t}},__vite__mapDeps([57,1,2,3,4,7]),import.meta.url)).FlowGraphDataSwitchBlock;default:if(N[r])return N[r];throw new Error(`Unknown block name ${r}`)}}class Ct extends D{constructor(t){super(t),this.out=this._registerSignalOutput("out")}}class Pt extends Ct{constructor(t,e){if(super(t),this._eventsSignalOutputs={},this.done=this._registerSignalOutput("done"),e)for(const o of e)this._eventsSignalOutputs[o]=this._registerSignalOutput(o+"Event")}_executeOnTick(t){}_startPendingTasks(t){t._getExecutionVariable(this,"_initialized",!1)&&(this._cancelPendingTasks(t),this._resetAfterCanceled(t)),this._preparePendingTasks(t),t._addPendingBlock(this),this.out._activateSignal(t),t._setExecutionVariable(this,"_initialized",!0)}_resetAfterCanceled(t){t._deleteExecutionVariable(this,"_initialized"),t._removePendingBlock(this)}}class bt extends Pt{constructor(){super(...arguments),this.initPriority=0,this.type="NoTrigger"}_execute(t){t._notifyExecuteNode(this),this.done._activateSignal(t)}}function Ot(r,t){for(const e of r)for(const o of e.dataOutputs)if(o.uniqueId===t)return o;throw new Error("Could not find data out connection with unique id "+t)}function xt(r,t){for(const e of r)if(e instanceof D){for(const o of e.signalInputs)if(o.uniqueId===t)return o}throw new Error("Could not find signal in connection with unique id "+t)}async function Dt(r,t){const e=await Promise.all(r.allBlocks.map(async o=>await Vt(o.className)()));return At(r,t,e)}function At(r,t,e){const o=t.coordinator.createGraph(),a=[],i=t.valueParseFunction??x;for(let s=0;si.getMeshById(l)),lights:s.lights?.map(l=>i.getLightByName(l)),cameras:s.cameras?.map(l=>i.getCameraByName(l)),materials:s.materials?.map(l=>i.getMaterialById(l)),textures:s.textures?.map(l=>i.getTextureByName(l)),animations:s.animations?.map(l=>i.animations.find(_=>_.name===l)),skeletons:s.skeletons?.map(l=>i.getSkeletonByName(l)),particleSystems:s.particleSystems?.map(l=>i.getParticleSystemById(l)),animationGroups:s.animationGroups?.map(l=>i.getAnimationGroupByName(l)),transformNodes:s.transformNodes?.map(l=>i.getTransformNodeById(l)),rootNodes:[],multiMaterials:[],morphTargetManagers:[],geometries:[],actionManagers:[],environmentTexture:null,postProcesses:[],sounds:null,effectLayers:[],layers:[],reflectionProbes:[],lensFlareSystems:[],proceduralTextures:[],getNodes:function(){throw new Error("Function not implemented.")}};o.assetsContext=c}for(const s in r._userVariables){const c=a(s,r._userVariables,o.assetsContext,i);o.userVariables[s]=c}for(const s in r._connectionValues){const c=a(s,r._connectionValues,o.assetsContext,i);o._setConnectionValueByKey(s,c)}return o}function Lt(r,t,e){const o={},a=t.valueParseFunction??x;if(r.config)for(const s in r.config)o[s]=a(s,r.config,t.assetsContainer||t.scene,t.scene);if(kt(r.className)){if(!t.pathConverter)throw new Error("Path converter is required for this block");o.pathConverter=t.pathConverter}const i=new e(o);i.uniqueId=r.uniqueId;for(let s=0;s{const a=t.values?.[o];if(!a)throw p.Error(["No value found for event key",o]),new Error("Error parsing events");const i=this._types[a.type];if(!i)throw p.Error(["No type found for event value",a]),new Error("Error parsing events");const s=typeof a.value<"u"?this._parseVariable(a):void 0;return{id:o,type:i.flowGraphType,eventData:!0,value:s}})),this._events.push(e)}}_parseNodes(){if(this._interactivityGraph.nodes)for(const t of this._interactivityGraph.nodes){if(typeof t.declaration!="number")throw p.Error(["No declaration found for node",t]),new Error("Error parsing nodes");const e=this._mappings[t.declaration];if(!e)throw p.Error(["No mapping found for node",t]),new Error("Error parsing nodes");if(e.flowGraphMapping.validation){const a=e.flowGraphMapping.validation(t,this._interactivityGraph,this._gltf);if(!a.valid)throw new Error(`Error validating interactivity node ${this._interactivityGraph.declarations?.[t.declaration].op} - ${a.error}`)}const o=[];for(const a of e.flowGraphMapping.blocks){const i=this._getEmptyBlock(a,e.fullOperationName);this._parseNodeConfiguration(t,i,e.flowGraphMapping,a),o.push(i)}this._nodes.push({blocks:o,fullOperationName:e.fullOperationName})}}_getEmptyBlock(t,e){return{uniqueId:I(),className:t,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[],config:{},type:e,metadata:{}}}_parseNodeConfiguration(t,e,o,a){const i=t.configuration;if(i)for(const s in i){const c=i[s];if(!c)throw new Error("Error parsing node configuration");const l=o.configuration?.[s];if(l&&l.toBlock?l.toBlock===a:o.blocks.indexOf(a)===0){let u=l?.defaultValue;c?.value&&(u=c.value),l?.isArray||(u.length!==1&&p.Warn(`Invalid non-array value length: ${u.length}`),u=u[0]),l?.dataTransformer&&(u=l.dataTransformer(u,this)),u!==void 0&&(e.config[l?.name||s]={value:u})}}}_parseNodeConnections(t){for(let e=0;ef.className===h.toBlock)||a.blocks[0]).signalOutputs.push(T);const A=w.node,d=this._nodes[A];if(!d)throw p.Error(["No node found for input node id",A]),new Error("Error parsing node connections");const k=$(d.fullOperationName);if(!k)throw p.Error(["No mapping found for input node",d]),new Error("Error parsing node connections");let m=k.inputs?.flows?.[w.socket||"in"],B=!1;if(!m)for(const f in k.inputs?.flows)f.startsWith("[")&&f.endsWith("]")&&(B=!0,m=k.inputs?.flows?.[f]);const y=m?B?m.name.replace("$1",w.socket||""):m.name:w.socket||"in",C=m&&m.toBlock&&d.blocks.find(f=>f.className===m.toBlock)||d.blocks[0];let G=C.signalInputs.find(f=>f.name===y);G||(G=this._createNewSocketConnection(y),C.signalInputs.push(G)),G.connectedPointIds.push(T.uniqueId),T.connectedPointIds.push(G.uniqueId)}const l=o.values||{},_=Object.keys(l);for(const u of _){const w=l[u];let h=i.flowGraphMapping.inputs?.values?.[u],v=!1;if(!h)for(const d in i.flowGraphMapping.inputs?.values)d.startsWith("[")&&d.endsWith("]")&&(v=!0,h=i.flowGraphMapping.inputs?.values?.[d]);const T=h?v?h.name.replace("$1",u):h.name:u,V=this._createNewSocketConnection(T);if((h&&h.toBlock&&a.blocks.find(d=>d.className===h.toBlock)||a.blocks[0]).dataInputs.push(V),w.value!==void 0){const d=this._parseVariable(w,h&&h.dataTransformer);t._connectionValues[V.uniqueId]=d}else if(typeof w.node<"u"){const d=w.node,k=w.socket||"value",m=this._nodes[d];if(!m)throw p.Error(["No node found for output socket reference",w]),new Error("Error parsing node connections");const B=$(m.fullOperationName);if(!B)throw p.Error(["No mapping found for output socket reference",w]),new Error("Error parsing node connections");let y=B.outputs?.values?.[k],C=!1;if(!y)for(const F in B.outputs?.values)F.startsWith("[")&&F.endsWith("]")&&(C=!0,y=B.outputs?.values?.[F]);const G=y?C?y.name.replace("$1",k):y?.name:k,f=y&&y.toBlock&&m.blocks.find(F=>F.className===y.toBlock)||m.blocks[0];let P=f.dataOutputs.find(F=>F.name===G);P||(P=this._createNewSocketConnection(G,!0),f.dataOutputs.push(P)),V.connectedPointIds.push(P.uniqueId),P.connectedPointIds.push(V.uniqueId)}else throw p.Error(["Invalid value for value connection",w]),new Error("Error parsing node connections")}if(i.flowGraphMapping.interBlockConnectors)for(const u of i.flowGraphMapping.interBlockConnectors){const w=u.input,h=u.output,v=u.isVariable;this._connectFlowGraphNodes(w,h,a.blocks[u.inputBlockIndex],a.blocks[u.outputBlockIndex],v)}if(i.flowGraphMapping.extraProcessor){const u=this._interactivityGraph.declarations?.[o.declaration];if(!u)throw p.Error(["No declaration found for extra processor",o]),new Error("Error parsing node connections");a.blocks=i.flowGraphMapping.extraProcessor(o,u,i.flowGraphMapping,this,a.blocks,t,this._gltf)}}}_createNewSocketConnection(t,e){return{uniqueId:I(),name:t,_connectionType:e?1:0,connectedPointIds:[]}}_connectFlowGraphNodes(t,e,o,a,i){const s=i?o.dataInputs:o.signalInputs,c=i?a.dataOutputs:a.signalOutputs,l=s.find(u=>u.name===t)||this._createNewSocketConnection(t),_=c.find(u=>u.name===e)||this._createNewSocketConnection(e,!0);s.find(u=>u.name===t)||s.push(l),c.find(u=>u.name===e)||c.push(_),l.connectedPointIds.push(_.uniqueId),_.connectedPointIds.push(l.uniqueId)}getVariableName(t){return"staticVariable_"+t}serializeToFlowGraph(){const t={uniqueId:I(),_userVariables:{},_connectionValues:{}};this._parseNodeConnections(t);for(let o=0;oo.concat(a.blocks),[]),executionContexts:[t]}}}const b="KHR_interactivity";class j{constructor(t){this._loader=t,this.name=b,this.enabled=this._loader.isExtensionUsed(b),this._pathConverter=dt(this._loader.gltf),t._skipStartAnimationStep=!0;const e=t.babylonScene;e&&tt(e)}dispose(){this._loader=null,delete this._pathConverter}async onReady(){if(!this._loader.babylonScene||!this._pathConverter)return;const t=this._loader.babylonScene,e=this._loader.gltf.extensions?.KHR_interactivity;if(!e)return;const o=new g({scene:t});o.dispatchEventsSynchronously=!1;const a=e.graphs.map(i=>new Nt(i,this._loader.gltf,this._loader.parent.targetFps).serializeToFlowGraph());await Promise.all(a.map(async i=>await Dt(i,{coordinator:o,pathConverter:this._pathConverter}))),o.start()}}function tt(r){E("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:()=>{if(!r.activeCamera)return new R(NaN,NaN,NaN,NaN);const t=R.FromRotationMatrix(r.activeCamera.getWorldMatrix()).normalize();return r.useRightHandedSystem||(t.w*=-1,t.x*=-1),t},type:"Quaternion",getTarget:()=>r.activeCamera}),E("/extensions/KHR_interactivity/?/activeCamera/position",{get:()=>{if(!r.activeCamera)return new Q(NaN,NaN,NaN);const t=r.activeCamera.getWorldMatrix().getTranslation();return r.useRightHandedSystem||(t.x*=-1),t},type:"Vector3",getTarget:()=>r.activeCamera}),E("/animations/{}/extensions/KHR_interactivity/isPlaying",{get:t=>t._babylonAnimationGroup?.isPlaying??!1,type:"boolean",getTarget:t=>t._babylonAnimationGroup}),E("/animations/{}/extensions/KHR_interactivity/minTime",{get:t=>(t._babylonAnimationGroup?.from??0)/60,type:"number",getTarget:t=>t._babylonAnimationGroup}),E("/animations/{}/extensions/KHR_interactivity/maxTime",{get:t=>(t._babylonAnimationGroup?.to??0)/60,type:"number",getTarget:t=>t._babylonAnimationGroup}),E("/animations/{}/extensions/KHR_interactivity/playhead",{get:t=>(t._babylonAnimationGroup?.getCurrentFrame()??0)/60,type:"number",getTarget:t=>t._babylonAnimationGroup}),E("/animations/{}/extensions/KHR_interactivity/virtualPlayhead",{get:t=>(t._babylonAnimationGroup?.getCurrentFrame()??0)/60,type:"number",getTarget:t=>t._babylonAnimationGroup})}Tt(b,"FlowGraphGLTFDataProvider",async()=>(await n(async()=>{const{FlowGraphGLTFDataProvider:r}=await import("./flowGraphGLTFDataProvider-BJdJcFO4.js");return{FlowGraphGLTFDataProvider:r}},__vite__mapDeps([58,1,2,3,4,7]),import.meta.url)).FlowGraphGLTFDataProvider);lt(b);ct(b,!0,r=>new j(r));const Zt=Object.freeze(Object.defineProperty({__proto__:null,KHR_interactivity:j,_AddInteractivityObjectModel:tt},Symbol.toStringTag,{value:"Module"}));export{Ft as F,Gt as G,Zt as K,z as _,Pt as a,Ct as b,bt as c,g as d,D as e,M as f,vt as g,Wt as h,Jt as i,Ut as j,Ht as k,Qt as l}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_lights_punctual-BAbq2qYj.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_lights_punctual-BAbq2qYj.js new file mode 100644 index 0000000000000000000000000000000000000000..119d44640b00977a11b25cec067784c87c888f19 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_lights_punctual-BAbq2qYj.js @@ -0,0 +1 @@ +import{bk as y,aI as m,V as r,M as L,an as w,_ as b,s as A,R as v,bl as C,C as g,aG as P,aH as S}from"./index-CDrXokXW.js";import{a as T}from"./objectModelMapping-CGWnurZP.js";import{ArrayItem as _,GLTFLoader as p}from"./glTFLoader-Bp7IfGPK.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";w.AddNodeConstructor("Light_Type_0",(l,e)=>()=>new c(l,r.Zero(),e));class c extends y{get shadowAngle(){return this._shadowAngle}set shadowAngle(e){this._shadowAngle=e,this.forceProjectionMatrixCompute()}get direction(){return this._direction}set direction(e){const i=this.needCube();if(this._direction=e,this.needCube()!==i&&this._shadowGenerators){const t=this._shadowGenerators.values();for(let n=t.next();n.done!==!0;n=t.next())n.value.recreateShadowMap()}}constructor(e,i,t,n){super(e,t,n),this._shadowAngle=Math.PI/2,this.position=i}getClassName(){return"PointLight"}getTypeID(){return m.LIGHTTYPEID_POINTLIGHT}needCube(){return!this.direction}getShadowDirection(e){if(this.direction)return super.getShadowDirection(e);switch(e){case 0:return new r(1,0,0);case 1:return new r(-1,0,0);case 2:return new r(0,-1,0);case 3:return new r(0,1,0);case 4:return new r(0,0,1);case 5:return new r(0,0,-1)}return r.Zero()}_setDefaultShadowProjectionMatrix(e,i,t){const n=this.getScene().activeCamera,d=this.getDepthMinZ(n),a=this.getDepthMaxZ(n),s=this.getScene().getEngine().useReverseDepthBuffer;L.PerspectiveFovLHToRef(this.shadowAngle,1,s?a:d,s?d:a,e,!0,this._scene.getEngine().isNDCHalfZRange,void 0,s)}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}transferToEffect(e,i){const t=this._scene.floatingOriginOffset;return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x-t.x,this.transformedPosition.y-t.y,this.transformedPosition.z-t.z,0,i):this._uniformBuffer.updateFloat4("vLightData",this.position.x-t.x,this.position.y-t.y,this.position.z-t.z,0,i),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,0,0,i),this}transferToNodeMaterialEffect(e,i){const t=this._scene.floatingOriginOffset;return this.computeTransformedInformation()?e.setFloat3(i,this.transformedPosition.x-t.x,this.transformedPosition.y-t.y,this.transformedPosition.z-t.z):e.setFloat3(i,this.position.x-t.x,this.position.y-t.y,this.position.z-t.z),this}prepareLightSpecificDefines(e,i){e["POINTLIGHT"+i]=!0}}b([A()],c.prototype,"shadowAngle",null);v("BABYLON.PointLight",c);const f="KHR_lights_punctual";class x{constructor(e){this.name=f,this._loader=e,this.enabled=this._loader.isExtensionUsed(f)}dispose(){this._loader=null,delete this._lights}onLoading(){const e=this._loader.gltf.extensions;if(e&&e[this.name]){const i=e[this.name];this._lights=i.lights,_.Assign(this._lights)}}loadNodeAsync(e,i,t){return p.LoadExtensionAsync(e,i,this.name,async(n,d)=>(this._loader._allMaterialsDirtyRequired=!0,await this._loader.loadNodeAsync(e,i,a=>{let s;const o=_.Get(n,this._lights,d.light),u=o.name||a.name;switch(this._loader.babylonScene._blockEntityCollection=!!this._loader._assetContainer,o.type){case"directional":{const h=new C(u,r.Backward(),this._loader.babylonScene);h.position.setAll(0),s=h;break}case"point":{s=new c(u,r.Zero(),this._loader.babylonScene);break}case"spot":{const h=new T(u,r.Zero(),r.Backward(),0,1,this._loader.babylonScene);h.angle=(o.spot&&o.spot.outerConeAngle||Math.PI/4)*2,h.innerAngle=(o.spot&&o.spot.innerConeAngle||0)*2,s=h;break}default:throw this._loader.babylonScene._blockEntityCollection=!1,new Error(`${n}: Invalid light type (${o.type})`)}s._parentContainer=this._loader._assetContainer,this._loader.babylonScene._blockEntityCollection=!1,o._babylonLight=s,s.falloffType=m.FALLOFF_GLTF,s.diffuse=o.color?g.FromArray(o.color):g.White(),s.intensity=o.intensity==null?1:o.intensity,s.range=o.range==null?Number.MAX_VALUE:o.range,s.parent=a,this._loader._babylonLights.push(s),p.AddPointerMetadata(s,n),t(a)})))}}P(f);S(f,!0,l=>new x(l));export{x as KHR_lights}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_anisotropy-Dittpx8X.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_anisotropy-Dittpx8X.js new file mode 100644 index 0000000000000000000000000000000000000000..f42fdc148344c0f0ee07aaed1714f4854cd7ba46 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_anisotropy-Dittpx8X.js @@ -0,0 +1 @@ +import{GLTFLoader as m}from"./glTFLoader-Bp7IfGPK.js";import{aG as d,aH as c}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const a="KHR_materials_anisotropy";class _{constructor(t){this.name=a,this.order=195,this._loader=t,this.enabled=this._loader.isExtensionUsed(a)}dispose(){this._loader=null}loadMaterialPropertiesAsync(t,o,r){return m.LoadExtensionAsync(t,o,this.name,async(s,n)=>{const e=new Array;e.push(this._loader.loadMaterialPropertiesAsync(t,o,r)),e.push(this._loadAnisotropyPropertiesAsync(s,n,r)),await Promise.all(e)})}async _loadAnisotropyPropertiesAsync(t,o,r){const s=this._loader._getOrCreateMaterialAdapter(r),n=new Array,e=o.anisotropyStrength??0,l=o.anisotropyRotation??0;s.specularRoughnessAnisotropy=e,s.geometryTangentAngle=l;const p=o.extensions??{};(!p.EXT_materials_anisotropy_openpbr||!p.EXT_materials_anisotropy_openpbr.openPbrAnisotropyEnabled)&&s.configureGltfStyleAnisotropy(!0),o.anisotropyTexture&&(o.anisotropyTexture.nonColorData=!0,n.push(this._loader.loadTextureInfoAsync(`${t}/anisotropyTexture`,o.anisotropyTexture,y=>{y.name=`${r.name} (Anisotropy Intensity)`,s.geometryTangentTexture=y}))),await Promise.all(n)}}d(a);c(a,!0,i=>new _(i));export{_ as KHR_materials_anisotropy}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_clearcoat-DS70653e.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_clearcoat-DS70653e.js new file mode 100644 index 0000000000000000000000000000000000000000..be68e7eec6a850e926dc62cd83b59d8d334d815b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_clearcoat-DS70653e.js @@ -0,0 +1 @@ +import{GLTFLoader as l}from"./glTFLoader-Bp7IfGPK.js";import{aG as u,aH as m}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const c="KHR_materials_clearcoat";class i{constructor(r){this.name=c,this.order=190,this._loader=r,this.enabled=this._loader.isExtensionUsed(c)}dispose(){this._loader=null}loadMaterialPropertiesAsync(r,e,t){return l.LoadExtensionAsync(r,e,this.name,async(o,s)=>{const a=new Array;a.push(this._loader.loadMaterialPropertiesAsync(r,e,t)),a.push(this._loadClearCoatPropertiesAsync(o,s,t)),await Promise.all(a)})}_loadClearCoatPropertiesAsync(r,e,t){const o=this._loader._getOrCreateMaterialAdapter(t),s=new Array;return o.configureCoat(),o.coatWeight=e.clearcoatFactor!==void 0?e.clearcoatFactor:0,o.coatRoughness=e.clearcoatRoughnessFactor!==void 0?e.clearcoatRoughnessFactor:0,e.clearcoatTexture&&s.push(this._loader.loadTextureInfoAsync(`${r}/clearcoatTexture`,e.clearcoatTexture,a=>{a.name=`${t.name} (ClearCoat)`,o.coatWeightTexture=a})),e.clearcoatRoughnessTexture&&(e.clearcoatRoughnessTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync(`${r}/clearcoatRoughnessTexture`,e.clearcoatRoughnessTexture,a=>{a.name=`${t.name} (ClearCoat Roughness)`,o.coatRoughnessTexture=a}))),e.clearcoatNormalTexture&&(e.clearcoatNormalTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync(`${r}/clearcoatNormalTexture`,e.clearcoatNormalTexture,a=>{a.name=`${t.name} (ClearCoat Normal)`,o.geometryCoatNormalTexture=a,e.clearcoatNormalTexture?.scale!=null&&(o.geometryCoatNormalTextureScale=e.clearcoatNormalTexture.scale)})),o.setNormalMapInversions(!t.getScene().useRightHandedSystem,t.getScene().useRightHandedSystem)),Promise.all(s).then(()=>{})}}u(c);m(c,!0,n=>new i(n));export{i as KHR_materials_clearcoat}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_diffuse_roughness-BbnIWM_S.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_diffuse_roughness-BbnIWM_S.js new file mode 100644 index 0000000000000000000000000000000000000000..7eef193b1f314bf3e3bef349a229c6a5185367ac --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_diffuse_roughness-BbnIWM_S.js @@ -0,0 +1 @@ +import{GLTFLoader as u}from"./glTFLoader-Bp7IfGPK.js";import{aG as h,aH as f}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const n="KHR_materials_diffuse_roughness";class d{constructor(s){this.name=n,this.order=190,this._loader=s,this.enabled=this._loader.isExtensionUsed(n)}dispose(){this._loader=null}loadMaterialPropertiesAsync(s,e,o){return u.LoadExtensionAsync(s,e,this.name,async(t,i)=>{const r=new Array;return r.push(this._loader.loadMaterialPropertiesAsync(s,e,o)),r.push(this._loadDiffuseRoughnessPropertiesAsync(t,i,o)),await Promise.all(r).then(()=>{})})}_loadDiffuseRoughnessPropertiesAsync(s,e,o){const t=this._loader._getOrCreateMaterialAdapter(o),i=new Array;return t.baseDiffuseRoughness=e.diffuseRoughnessFactor??0,e.diffuseRoughnessTexture&&i.push(this._loader.loadTextureInfoAsync(`${s}/diffuseRoughnessTexture`,e.diffuseRoughnessTexture,r=>{r.name=`${o.name} (Diffuse Roughness)`,t.baseDiffuseRoughnessTexture=r})),Promise.all(i).then(()=>{})}}h(n);f(n,!0,a=>new d(a));export{d as KHR_materials_diffuse_roughness}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_diffuse_transmission-DS01W3tb.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_diffuse_transmission-DS01W3tb.js new file mode 100644 index 0000000000000000000000000000000000000000..be944de4048fb4ad0847cea1eaab2b29cf98ac42 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_diffuse_transmission-DS01W3tb.js @@ -0,0 +1 @@ +import{GLTFLoader as m}from"./glTFLoader-Bp7IfGPK.js";import{C as f,aG as d,aH as l}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const t="KHR_materials_diffuse_transmission";class T{constructor(r){this.name=t,this.order=174,this._loader=r,this.enabled=this._loader.isExtensionUsed(t),this.enabled&&(r.parent.transparencyAsCoverage=!0)}dispose(){this._loader=null}loadMaterialPropertiesAsync(r,n,o){return m.LoadExtensionAsync(r,n,this.name,async(s,e)=>{const i=new Array;return i.push(this._loader.loadMaterialPropertiesAsync(r,n,o)),i.push(this._loadTranslucentPropertiesAsync(s,n,o,e)),await Promise.all(i).then(()=>{})})}_loadTranslucentPropertiesAsync(r,n,o,s){const e=this._loader._getOrCreateMaterialAdapter(o);e.configureSubsurface(),e.subsurfaceWeight=s.diffuseTransmissionFactor??0,e.subsurfaceColor=s.diffuseTransmissionColorFactor!==void 0?f.FromArray(s.diffuseTransmissionColorFactor):f.White();const i=new Array;return s.diffuseTransmissionTexture&&(s.diffuseTransmissionTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync(`${r}/diffuseTransmissionTexture`,s.diffuseTransmissionTexture).then(a=>{a.name=`${o.name} (Diffuse Transmission)`,e.subsurfaceWeightTexture=a}))),s.diffuseTransmissionColorTexture&&i.push(this._loader.loadTextureInfoAsync(`${r}/diffuseTransmissionColorTexture`,s.diffuseTransmissionColorTexture).then(a=>{a.name=`${o.name} (Diffuse Transmission Color)`,e.subsurfaceColorTexture=a})),Promise.all(i).then(()=>{})}}d(t);l(t,!0,u=>new T(u));export{T as KHR_materials_diffuse_transmission}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_dispersion-DpxfNQCn.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_dispersion-DpxfNQCn.js new file mode 100644 index 0000000000000000000000000000000000000000..452f6f61135dcb146625efd8ce08ba18ced6cc5e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_dispersion-DpxfNQCn.js @@ -0,0 +1 @@ +import{GLTFLoader as p}from"./glTFLoader-Bp7IfGPK.js";import{aG as d,aH as m}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const t="KHR_materials_dispersion";class l{constructor(s){this.name=t,this.order=174,this._loader=s,this.enabled=this._loader.isExtensionUsed(t)}dispose(){this._loader=null}loadMaterialPropertiesAsync(s,r,e){return p.LoadExtensionAsync(s,r,this.name,async(i,o)=>{const n=new Array;return n.push(this._loader.loadMaterialPropertiesAsync(s,r,e)),n.push(this._loadDispersionPropertiesAsync(i,r,e,o)),await Promise.all(n).then(()=>{})})}_loadDispersionPropertiesAsync(s,r,e,i){const o=this._loader._getOrCreateMaterialAdapter(e);return o.transmissionWeight>0||!i.dispersion||(o.transmissionDispersionAbbeNumber=20/i.dispersion),Promise.resolve()}}d(t);m(t,!0,a=>new l(a));export{l as KHR_materials_dispersion}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_emissive_strength-BqChGRqL.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_emissive_strength-BqChGRqL.js new file mode 100644 index 0000000000000000000000000000000000000000..f3ab746cdbba558441dc7f62d3f2537f87dc5605 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_emissive_strength-BqChGRqL.js @@ -0,0 +1 @@ +import{GLTFLoader as n}from"./glTFLoader-Bp7IfGPK.js";import{aG as m,aH as d}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const t="KHR_materials_emissive_strength";class l{constructor(e){this.name=t,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(t)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,s,i){return n.LoadExtensionAsync(e,s,this.name,async(r,a)=>(await this._loader.loadMaterialPropertiesAsync(e,s,i),this._loadEmissiveProperties(r,a,i),await Promise.resolve()))}_loadEmissiveProperties(e,s,i){if(s.emissiveStrength!==void 0){const r=this._loader._getOrCreateMaterialAdapter(i);r.emissionLuminance=s.emissiveStrength}}}m(t);d(t,!0,o=>new l(o));export{l as KHR_materials_emissive_strength}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_ior-BE6_deSQ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_ior-BE6_deSQ.js new file mode 100644 index 0000000000000000000000000000000000000000..99f62bb9af6e892ea5fe087f2b683e422cb68432 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_ior-BE6_deSQ.js @@ -0,0 +1 @@ +import{GLTFLoader as l}from"./glTFLoader-Bp7IfGPK.js";import{aG as p,aH as c}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const s="KHR_materials_ior";class t{constructor(r){this.name=s,this.order=180,this._loader=r,this.enabled=this._loader.isExtensionUsed(s)}dispose(){this._loader=null}loadMaterialPropertiesAsync(r,e,o){return l.LoadExtensionAsync(r,e,this.name,async(i,a)=>{const n=new Array;return n.push(this._loader.loadMaterialPropertiesAsync(r,e,o)),n.push(this._loadIorPropertiesAsync(i,a,o)),await Promise.all(n).then(()=>{})})}_loadIorPropertiesAsync(r,e,o){const i=this._loader._getOrCreateMaterialAdapter(o),a=e.ior!==void 0?e.ior:t._DEFAULT_IOR;return i.specularIor=a,Promise.resolve()}}t._DEFAULT_IOR=1.5;p(s);c(s,!0,d=>new t(d));export{t as KHR_materials_ior}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_iridescence-ezzlpHRh.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_iridescence-ezzlpHRh.js new file mode 100644 index 0000000000000000000000000000000000000000..a86417e2574c2d193d82b0caf55b4bcbdee6c980 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_iridescence-ezzlpHRh.js @@ -0,0 +1 @@ +import{GLTFLoader as d}from"./glTFLoader-Bp7IfGPK.js";import{aG as o,aH as h}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const t="KHR_materials_iridescence";class m{constructor(n){this.name=t,this.order=195,this._loader=n,this.enabled=this._loader.isExtensionUsed(t)}dispose(){this._loader=null}loadMaterialPropertiesAsync(n,e,r){return d.LoadExtensionAsync(n,e,this.name,async(s,c)=>{const i=new Array;return i.push(this._loader.loadMaterialPropertiesAsync(n,e,r)),i.push(this._loadIridescencePropertiesAsync(s,c,r)),await Promise.all(i).then(()=>{})})}_loadIridescencePropertiesAsync(n,e,r){const s=this._loader._getOrCreateMaterialAdapter(r),c=new Array;return s.thinFilmWeight=e.iridescenceFactor??0,s.thinFilmIor=e.iridescenceIor??e.iridescenceIOR??1.3,s.thinFilmThicknessMinimum=e.iridescenceThicknessMinimum??100,s.thinFilmThicknessMaximum=e.iridescenceThicknessMaximum??400,e.iridescenceTexture&&c.push(this._loader.loadTextureInfoAsync(`${n}/iridescenceTexture`,e.iridescenceTexture,i=>{i.name=`${r.name} (Iridescence)`,s.thinFilmWeightTexture=i})),e.iridescenceThicknessTexture&&c.push(this._loader.loadTextureInfoAsync(`${n}/iridescenceThicknessTexture`,e.iridescenceThicknessTexture,i=>{i.name=`${r.name} (Iridescence Thickness)`,s.thinFilmThicknessTexture=i})),Promise.all(c).then(()=>{})}}o(t);h(t,!0,a=>new m(a));export{m as KHR_materials_iridescence}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_pbrSpecularGlossiness-Cf_AZprx.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_pbrSpecularGlossiness-Cf_AZprx.js new file mode 100644 index 0000000000000000000000000000000000000000..0cf1d4c264fa96cecc357e2fd32f0e4f66afe57d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_pbrSpecularGlossiness-Cf_AZprx.js @@ -0,0 +1 @@ +import{aJ as a,C as t,aG as c,aH as d}from"./index-CDrXokXW.js";import{GLTFLoader as f}from"./glTFLoader-Bp7IfGPK.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const u="KHR_materials_pbrSpecularGlossiness";class h{constructor(r){this.name=u,this.order=200,this._loader=r,this.enabled=this._loader.isExtensionUsed(u)}dispose(){this._loader=null}loadMaterialPropertiesAsync(r,e,s){return f.LoadExtensionAsync(r,e,this.name,async(i,o)=>{const l=new Array;return l.push(this._loader.loadMaterialBasePropertiesAsync(r,e,s)),l.push(this._loadSpecularGlossinessPropertiesAsync(i,o,s)),this._loader.loadMaterialAlphaProperties(r,e,s),await Promise.all(l).then(()=>{})})}_loadSpecularGlossinessPropertiesAsync(r,e,s){if(!(s instanceof a))throw new Error(`${r}: Material type not supported`);const i=new Array;return s.metallic=null,s.roughness=null,e.diffuseFactor?(s.albedoColor=t.FromArray(e.diffuseFactor),s.alpha=e.diffuseFactor[3]):s.albedoColor=t.White(),s.reflectivityColor=e.specularFactor?t.FromArray(e.specularFactor):t.White(),s.microSurface=e.glossinessFactor==null?1:e.glossinessFactor,e.diffuseTexture&&i.push(this._loader.loadTextureInfoAsync(`${r}/diffuseTexture`,e.diffuseTexture,o=>{o.name=`${s.name} (Diffuse)`,s.albedoTexture=o})),e.specularGlossinessTexture&&(i.push(this._loader.loadTextureInfoAsync(`${r}/specularGlossinessTexture`,e.specularGlossinessTexture,o=>{o.name=`${s.name} (Specular Glossiness)`,s.reflectivityTexture=o,s.reflectivityTexture.hasAlpha=!0})),s.useMicroSurfaceFromReflectivityMapAlpha=!0),Promise.all(i).then(()=>{})}}c(u);d(u,!0,n=>new h(n));export{h as KHR_materials_pbrSpecularGlossiness}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_sheen-BCArul3M.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_sheen-BCArul3M.js new file mode 100644 index 0000000000000000000000000000000000000000..6b32b08621dbdb1c0d528bbac0f9ad6e4e633255 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_sheen-BCArul3M.js @@ -0,0 +1 @@ +import{GLTFLoader as d}from"./glTFLoader-Bp7IfGPK.js";import{C as i,aG as m,aH as c}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const a="KHR_materials_sheen";class g{constructor(o){this.name=a,this.order=190,this._loader=o,this.enabled=this._loader.isExtensionUsed(a)}dispose(){this._loader=null}loadMaterialPropertiesAsync(o,e,n){return d.LoadExtensionAsync(o,e,this.name,async(s,r)=>{const t=new Array;return t.push(this._loader.loadMaterialPropertiesAsync(o,e,n)),t.push(this._loadSheenPropertiesAsync(s,r,n)),await Promise.all(t).then(()=>{})})}_loadSheenPropertiesAsync(o,e,n){const s=this._loader._getOrCreateMaterialAdapter(n),r=new Array;s.configureFuzz();const t=e.sheenColorFactor!==void 0?i.FromArray(e.sheenColorFactor):i.Black(),l=e.sheenRoughnessFactor!==void 0?e.sheenRoughnessFactor:0;return s.fuzzWeight=1,s.fuzzColor=t,s.fuzzRoughness=l,e.sheenColorTexture&&r.push(this._loader.loadTextureInfoAsync(`${o}/sheenColorTexture`,e.sheenColorTexture,h=>{h.name=`${n.name} (Sheen Color)`,s.fuzzColorTexture=h})),e.sheenRoughnessTexture&&(e.sheenRoughnessTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync(`${o}/sheenRoughnessTexture`,e.sheenRoughnessTexture,h=>{h.name=`${n.name} (Sheen Roughness)`,s.fuzzRoughnessTexture=h}))),Promise.all(r).then(()=>{})}}m(a);c(a,!0,u=>new g(u));export{g as KHR_materials_sheen}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_specular-Dr1ARbmK.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_specular-Dr1ARbmK.js new file mode 100644 index 0000000000000000000000000000000000000000..14d36fa19bd0e86ae51e4348acc5a21b6845ec21 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_specular-Dr1ARbmK.js @@ -0,0 +1 @@ +import{GLTFLoader as i}from"./glTFLoader-Bp7IfGPK.js";import{C as n,aG as p,aH as d}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const t="KHR_materials_specular";class m{constructor(s){this.name=t,this.order=190,this._loader=s,this.enabled=this._loader.isExtensionUsed(t)}dispose(){this._loader=null}loadMaterialPropertiesAsync(s,e,o){return i.LoadExtensionAsync(s,e,this.name,async(l,a)=>{const r=new Array;r.push(this._loader.loadMaterialPropertiesAsync(s,e,o)),r.push(this._loadSpecularPropertiesAsync(l,a,o));const c=this._loader._getOrCreateMaterialAdapter(o);return a.extensions&&a.extensions.EXT_materials_specular_edge_color&&a.extensions.EXT_materials_specular_edge_color.specularEdgeColorEnabled&&c.enableSpecularEdgeColor(!0),await Promise.all(r).then(()=>{})})}_loadSpecularPropertiesAsync(s,e,o){const l=this._loader._getOrCreateMaterialAdapter(o),a=new Array;return l.specularWeight=e.specularFactor??1,l.specularColor=e.specularColorFactor!==void 0?n.FromArray(e.specularColorFactor):new n(1,1,1),e.specularTexture&&(e.specularTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync(`${s}/specularTexture`,e.specularTexture,r=>{r.name=`${o.name} (Specular)`,l.specularWeightTexture=r}))),e.specularColorTexture&&a.push(this._loader.loadTextureInfoAsync(`${s}/specularColorTexture`,e.specularColorTexture,r=>{r.name=`${o.name} (Specular Color)`,l.specularColorTexture=r})),Promise.all(a).then(()=>{})}}p(t);d(t,!0,u=>new m(u));export{m as KHR_materials_specular}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_transmission-4IzmwuFj.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_transmission-4IzmwuFj.js new file mode 100644 index 0000000000000000000000000000000000000000..a38b03cfc2d21f53fcdb24cc236fbdab4bb15ae0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_transmission-4IzmwuFj.js @@ -0,0 +1 @@ +import{GLTFLoader as l}from"./glTFLoader-Bp7IfGPK.js";import{aK as u,O as _,d as c,aL as T,aG as g,aH as f}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";class h{static _GetDefaultOptions(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:u.TEXTURETYPE_HALF_FLOAT,generateMipmaps:!0}}constructor(e,s){this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._options={...h._GetDefaultOptions(),...e},this._scene=s,this._scene._transmissionHelper=this,this.onErrorObservable=new _,this._scene.onDisposeObservable.addOnce(()=>{this.dispose()}),this._parseScene(),this._setupRenderTargets()}updateOptions(e){if(!Object.keys(e).filter(a=>this._options[a]!==e[a]).length)return;const t={...this._options,...e},r=this._options;this._options=t,t.renderSize!==r.renderSize||t.renderTargetTextureType!==r.renderTargetTextureType||t.generateMipmaps!==r.generateMipmaps||!this._opaqueRenderTarget?this._setupRenderTargets():(this._opaqueRenderTarget.samples=t.samples,this._opaqueRenderTarget.lodGenerationScale=t.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=t.lodGenerationOffset)}getOpaqueTarget(){return this._opaqueRenderTarget}_shouldRenderAsTransmission(e){return!!e?.subSurface?.isRefractionEnabled}_addMesh(e){this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),c.SetImmediate(()=>{this._shouldRenderAsTransmission(e.material)?(e.material.refractionTexture=this._opaqueRenderTarget,this._transparentMeshesCache.indexOf(e)===-1&&this._transparentMeshesCache.push(e)):this._opaqueMeshesCache.indexOf(e)===-1&&this._opaqueMeshesCache.push(e)})}_removeMesh(e){e.onMaterialChangedObservable.remove(this._materialObservers[e.uniqueId]),delete this._materialObservers[e.uniqueId];let s=this._transparentMeshesCache.indexOf(e);s!==-1&&this._transparentMeshesCache.splice(s,1),s=this._opaqueMeshesCache.indexOf(e),s!==-1&&this._opaqueMeshesCache.splice(s,1)}_parseScene(){this._scene.meshes.forEach(this._addMesh.bind(this)),this._scene.onNewMeshAddedObservable.add(this._addMesh.bind(this)),this._scene.onMeshRemovedObservable.add(this._removeMesh.bind(this))}_onMeshMaterialChanged(e){const s=this._transparentMeshesCache.indexOf(e),t=this._opaqueMeshesCache.indexOf(e);if(this._shouldRenderAsTransmission(e.material)){if(e.material){const a=e.material.subSurface;a&&(a.refractionTexture=this._opaqueRenderTarget)}t!==-1?(this._opaqueMeshesCache.splice(t,1),this._transparentMeshesCache.push(e)):s===-1&&this._transparentMeshesCache.push(e)}else s!==-1?(this._transparentMeshesCache.splice(s,1),this._opaqueMeshesCache.push(e)):t===-1&&this._opaqueMeshesCache.push(e)}_isRenderTargetValid(){return this._opaqueRenderTarget?.getInternalTexture()!==null}_setupRenderTargets(){this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new T("opaqueSceneTexture",this._options.renderSize,this._scene,this._options.generateMipmaps,void 0,this._options.renderTargetTextureType),this._opaqueRenderTarget.ignoreCameraViewport=!0,this._opaqueRenderTarget.renderList=this._opaqueMeshesCache,this._opaqueRenderTarget.clearColor=this._options.clearColor?.clone()??this._scene.clearColor.clone(),this._opaqueRenderTarget.gammaSpace=!1,this._opaqueRenderTarget.lodGenerationScale=this._options.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=this._options.lodGenerationOffset,this._opaqueRenderTarget.samples=this._options.samples,this._opaqueRenderTarget.renderSprites=!0,this._opaqueRenderTarget.renderParticles=!0,this._opaqueRenderTarget.disableImageProcessing=!0;let e;this._opaqueRenderTarget.onBeforeBindObservable.add(s=>{e=this._scene.environmentIntensity,this._scene.environmentIntensity=1,this._options.clearColor?s.clearColor.copyFrom(this._options.clearColor):this._scene.clearColor.toLinearSpaceToRef(s.clearColor,this._scene.getEngine().useExactSrgbConversions)}),this._opaqueRenderTarget.onAfterUnbindObservable.add(()=>{this._scene.environmentIntensity=e});for(const s of this._transparentMeshesCache)this._shouldRenderAsTransmission(s.material)&&(s.material.refractionTexture=this._opaqueRenderTarget)}dispose(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[]}}const o="KHR_materials_transmission";class m{constructor(e){this.name=o,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(o),this.enabled&&(e.parent.transparencyAsCoverage=!0)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,s,t){return l.LoadExtensionAsync(e,s,this.name,async(r,a)=>{const n=new Array;return n.push(this._loader.loadMaterialPropertiesAsync(e,s,t)),n.push(this._loadTransparentPropertiesAsync(r,s,t,a)),await Promise.all(n).then(()=>{})})}_loadTransparentPropertiesAsync(e,s,t,r){const a=this._loader._getOrCreateMaterialAdapter(t),n=r.transmissionFactor!==void 0?r.transmissionFactor:0;if(n===0)return Promise.resolve();if(a.configureTransmission(),a.transmissionWeight=n,n>0&&!this._loader.parent.dontUseTransmissionHelper){const i=t.getScene();i._transmissionHelper?i._transmissionHelper?._isRenderTargetValid()||i._transmissionHelper?._setupRenderTargets():new h({},t.getScene())}let p=Promise.resolve(null);return r.transmissionTexture&&(r.transmissionTexture.nonColorData=!0,p=this._loader.loadTextureInfoAsync(`${e}/transmissionTexture`,r.transmissionTexture,i=>{i.name=`${t.name} (Transmission)`,a.transmissionWeightTexture=i})),p.then(()=>{})}}g(o);f(o,!0,d=>new m(d));export{m as KHR_materials_transmission}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_unlit-DM_zxK5v.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_unlit-DM_zxK5v.js new file mode 100644 index 0000000000000000000000000000000000000000..b78ffa61b598a7e0d36ec932b856fca4c8c67ed7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_unlit-DM_zxK5v.js @@ -0,0 +1 @@ +import{C as d,aG as p,aH as u}from"./index-CDrXokXW.js";import{GLTFLoader as c}from"./glTFLoader-Bp7IfGPK.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const i="KHR_materials_unlit";class m{constructor(e){this.name=i,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(i)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,r,t){return c.LoadExtensionAsync(e,r,this.name,async()=>await this._loadUnlitPropertiesAsync(e,r,t))}_loadUnlitPropertiesAsync(e,r,t){const o=this._loader._getOrCreateMaterialAdapter(t),l=new Array,s=r.pbrMetallicRoughness;return s&&(s.baseColorFactor&&(o.baseColor=d.FromArray(s.baseColorFactor),o.geometryOpacity=s.baseColorFactor[3]),s.baseColorTexture&&l.push(this._loader.loadTextureInfoAsync(`${e}/baseColorTexture`,s.baseColorTexture,n=>{n.name=`${t.name} (Base Color)`,o.baseColorTexture=n}))),o.isUnlit=!0,r.doubleSided&&(o.backFaceCulling=!1,o.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,r,t),Promise.all(l).then(()=>{})}}p(i);u(i,!0,a=>new m(a));export{m as KHR_materials_unlit}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_variants-BwQ4yKQI.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_variants-BwQ4yKQI.js new file mode 100644 index 0000000000000000000000000000000000000000..50d0022344bfe24abdadbee692fb7bf8bc4b17dd --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_variants-BwQ4yKQI.js @@ -0,0 +1 @@ +import{GLTFLoader as S,ArrayItem as L}from"./glTFLoader-Bp7IfGPK.js";import{l as O,aG as C,aH as I}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const n="KHR_materials_variants";class s{constructor(t){this.name=n,this._loader=t,this.enabled=this._loader.isExtensionUsed(n)&&!this._loader.parent.skipMaterials}dispose(){this._loader=null}static GetAvailableVariants(t){const e=this._GetExtensionMetadata(t);return e?Object.keys(e.variants):[]}getAvailableVariants(t){return s.GetAvailableVariants(t)}static SelectVariant(t,e){const r=this._GetExtensionMetadata(t);if(!r)throw new Error(`Cannot select variant on a glTF mesh that does not have the ${n} extension`);const h=c=>{const f=r.variants[c];if(f)for(const m of f)m.mesh.material=m.material};if(e instanceof Array)for(const c of e)h(c);else h(e);r.lastSelected=e}selectVariant(t,e){s.SelectVariant(t,e)}static Reset(t){const e=this._GetExtensionMetadata(t);if(!e)throw new Error(`Cannot reset on a glTF mesh that does not have the ${n} extension`);for(const r of e.original)r.mesh.material=r.material;e.lastSelected=null}reset(t){s.Reset(t)}static GetLastSelectedVariant(t){const e=this._GetExtensionMetadata(t);if(!e)throw new Error(`Cannot get the last selected variant on a glTF mesh that does not have the ${n} extension`);return e.lastSelected}getLastSelectedVariant(t){return s.GetLastSelectedVariant(t)}static _GetExtensionMetadata(t){return t?._internalMetadata?.gltf?.[n]||null}onLoading(){const t=this._loader.gltf.extensions;if(t&&t[this.name]){const e=t[this.name];this._variants=e.variants}}onReady(){const t=this._loader.rootBabylonMesh;if(t){const e=this._loader.parent.extensionOptions[n];e?.defaultVariant&&s.SelectVariant(t,e.defaultVariant),e?.onLoaded?.({get variants(){return s.GetAvailableVariants(t)},get selectedVariant(){const r=s.GetLastSelectedVariant(t);return r?Array.isArray(r)?r[0]:r:s.GetAvailableVariants(t)[0]},set selectedVariant(r){s.SelectVariant(t,r)}})}}_loadMeshPrimitiveAsync(t,e,r,h,c,f){return S.LoadExtensionAsync(t,c,this.name,async(m,V)=>{const x=new Array;return x.push(this._loader._loadMeshPrimitiveAsync(t,e,r,h,c,o=>{if(f(o),o instanceof O){const $=S._GetDrawMode(t,c.mode),d=this._loader.rootBabylonMesh,E=d?d._internalMetadata=d._internalMetadata||{}:{},w=E.gltf=E.gltf||{},g=w[n]=w[n]||{lastSelected:null,original:[],variants:{}};g.original.push({mesh:o,material:o.material});for(let p=0;p{for(let v=0;v{const G=k;let l=null,i=G;do{if(i=i.parent,!i)return;l=s._GetExtensionMetadata(i)}while(l===null);if(d&&l===s._GetExtensionMetadata(d)){i._internalMetadata={};for(const a in d._internalMetadata)i._internalMetadata[a]=d._internalMetadata[a];i._internalMetadata.gltf=[];for(const a in d._internalMetadata.gltf)i._internalMetadata.gltf[a]=d._internalMetadata.gltf[a];i._internalMetadata.gltf[n]={lastSelected:null,original:[],variants:{}};for(const a of l.original)i._internalMetadata.gltf[n].original.push({mesh:a.mesh,material:a.material});for(const a in l.variants)if(Object.prototype.hasOwnProperty.call(l.variants,a)){i._internalMetadata.gltf[n].variants[a]=[];for(const A of l.variants[a])i._internalMetadata.gltf[n].variants[a].push({mesh:A.mesh,material:A.material})}l=i._internalMetadata.gltf[n]}for(const a of l.original)a.mesh===o&&(a.mesh=G);for(const a of l.variants[M.name])a.mesh===o&&(a.mesh=G)})}}))}}})),await Promise.all(x).then(([o])=>o)})}}C(n);I(n,!0,_=>new s(_));export{s as KHR_materials_variants}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_volume-BJpG2B3c.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_volume-BJpG2B3c.js new file mode 100644 index 0000000000000000000000000000000000000000..8fd6962f84969563dee4f16a95afbff7cc0e9abd --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_materials_volume-BJpG2B3c.js @@ -0,0 +1 @@ +import{C as h,aG as u,aH as d}from"./index-CDrXokXW.js";import{GLTFLoader as m}from"./glTFLoader-Bp7IfGPK.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const a="KHR_materials_volume";class c{constructor(t){this.name=a,this.order=173,this._loader=t,this.enabled=this._loader.isExtensionUsed(a),this.enabled&&this._loader._disableInstancedMesh++}dispose(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null}loadMaterialPropertiesAsync(t,o,i){return m.LoadExtensionAsync(t,o,this.name,async(e,s)=>{const r=new Array;return r.push(this._loader.loadMaterialPropertiesAsync(t,o,i)),r.push(this._loadVolumePropertiesAsync(e,o,i,s)),await Promise.all(r).then(()=>{})})}_loadVolumePropertiesAsync(t,o,i,e){const s=this._loader._getOrCreateMaterialAdapter(i);if(s.transmissionWeight===0&&s.subsurfaceWeight===0||!e.thicknessFactor)return Promise.resolve();s.transmissionDepth=e.attenuationDistance!==void 0?e.attenuationDistance:Number.MAX_VALUE,s.transmissionColor=e.attenuationColor!==void 0&&e.attenuationColor.length==3?h.FromArray(e.attenuationColor):h.White(),s.volumeThickness=e.thicknessFactor??0;const r=new Array;return e.thicknessTexture&&(e.thicknessTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync(`${t}/thicknessTexture`,e.thicknessTexture,l=>{l.name=`${i.name} (Thickness)`,s.volumeThicknessTexture=l}))),Promise.all(r).then(()=>{})}}u(a);d(a,!0,n=>new c(n));export{c as KHR_materials_volume}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_mesh_quantization-CvyzOSoH.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_mesh_quantization-CvyzOSoH.js new file mode 100644 index 0000000000000000000000000000000000000000..5f32d52ca9063a2c62611a68ad5444099d7495df --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_mesh_quantization-CvyzOSoH.js @@ -0,0 +1 @@ +import{aG as n,aH as i}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const s="KHR_mesh_quantization";class o{constructor(e){this.name=s,this.enabled=e.isExtensionUsed(s)}dispose(){}}n(s);i(s,!0,t=>new o(t));export{o as KHR_mesh_quantization}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_node_hoverability-bcsnWtSP.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_node_hoverability-bcsnWtSP.js new file mode 100644 index 0000000000000000000000000000000000000000..d8c4634f5f9b6cff73b521af0adccfa0c528328e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_node_hoverability-bcsnWtSP.js @@ -0,0 +1 @@ +import{aG as f,aH as b}from"./index-CDrXokXW.js";import{a as p}from"./declarationMapper-Lanf6XPr.js";import{A as v}from"./objectModelMapping-CGWnurZP.js";import"./index-DWyDLubb.js";const i="KHR_node_hoverability",d="targetMeshPointerOver_";p("event/onHoverIn",i,{blocks:["FlowGraphPointerOverEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer(e){return d+e}}},outputs:{values:{hoverNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"targetMesh",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"meshUnderPointer",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor(e,o,s,h,t,u,r){const a=t[t.length-1];a.config=a.config||{},a.config.glTF=r;const n=e.configuration?.nodeIndex?.value?.[0];if(n===void 0||typeof n!="number")throw new Error("nodeIndex not found in configuration");const l=d+n;return t[1].config.variable=l,u._userVariables[l]={className:"Mesh",id:r?.nodes?.[n]._babylonTransformNode?.id,uniqueId:r?.nodes?.[n]._babylonTransformNode?.uniqueId},t}});const c="targetMeshPointerOut_";p("event/onHoverOut",i,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer(e){return c+e}}},outputs:{values:{hoverNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"targetMesh",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"meshOutOfPointer",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor(e,o,s,h,t,u,r){const a=t[t.length-1];a.config=a.config||{},a.config.glTF=r;const n=e.configuration?.nodeIndex?.value?.[0];if(n===void 0||typeof n!="number")throw new Error("nodeIndex not found in configuration");const l=c+n;return t[1].config.variable=l,u._userVariables[l]={className:"Mesh",id:r?.nodes?.[n]._babylonTransformNode?.id,uniqueId:r?.nodes?.[n]._babylonTransformNode?.uniqueId},t}});v("/nodes/{}/extensions/KHR_node_hoverability/hoverable",{get:e=>{const o=e._babylonTransformNode;return o&&o.pointerOverDisableMeshTesting!==void 0?o.pointerOverDisableMeshTesting:!0},set:(e,o)=>{o._primitiveBabylonMeshes?.forEach(s=>{s.pointerOverDisableMeshTesting=!e})},getTarget:e=>e._babylonTransformNode,getPropertyName:[()=>"pointerOverDisableMeshTesting"],type:"boolean"});class x{constructor(o){this.name=i,this._loader=o,this.enabled=o.isExtensionUsed(i)}async onReady(){this._loader.gltf.nodes?.forEach(o=>{o.extensions?.KHR_node_hoverability&&o.extensions?.KHR_node_hoverability.hoverable===!1&&o._babylonTransformNode?.getChildMeshes().forEach(s=>{s.pointerOverDisableMeshTesting=!0})})}dispose(){this._loader=null}}f(i);b(i,!0,e=>new x(e));export{x as KHR_node_hoverability}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_node_selectability-C9CKUBKq.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_node_selectability-C9CKUBKq.js new file mode 100644 index 0000000000000000000000000000000000000000..f3ef41cbfe390b09369262110fd45f894651bd2a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_node_selectability-C9CKUBKq.js @@ -0,0 +1 @@ +import{aG as d,aH as u}from"./index-CDrXokXW.js";import{a as p}from"./declarationMapper-Lanf6XPr.js";import{A as b}from"./objectModelMapping-CGWnurZP.js";import"./index-DWyDLubb.js";const t="KHR_node_selectability";p("event/onSelect",t,{blocks:["FlowGraphMeshPickEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer(o){return"pickedMesh_"+o}}},outputs:{values:{selectedNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"},selectionPoint:{name:"pickedPoint"},selectionRayOrigin:{name:"pickOrigin"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"asset",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"pickedMesh",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor(o,e,a,m,i,c,r){const s=i[i.length-1];s.config=s.config||{},s.config.glTF=r;const n=o.configuration?.nodeIndex?.value?.[0];if(n===void 0||typeof n!="number")throw new Error("nodeIndex not found in configuration");const l="pickedMesh_"+n;return i[1].config.variable=l,c._userVariables[l]={className:"Mesh",id:r?.nodes?.[n]._babylonTransformNode?.id,uniqueId:r?.nodes?.[n]._babylonTransformNode?.uniqueId},i}});b("/nodes/{}/extensions/KHR_node_selectability/selectable",{get:o=>{const e=o._babylonTransformNode;return e&&e.isPickable!==void 0?e.isPickable:!0},set:(o,e)=>{e._primitiveBabylonMeshes?.forEach(a=>{a.isPickable=o})},getTarget:o=>o._babylonTransformNode,getPropertyName:[()=>"isPickable"],type:"boolean"});class f{constructor(e){this.name=t,this._loader=e,this.enabled=e.isExtensionUsed(t)}async onReady(){this._loader.gltf.nodes?.forEach(e=>{e.extensions?.KHR_node_selectability&&e.extensions?.KHR_node_selectability.selectable===!1&&e._babylonTransformNode?.getChildMeshes().forEach(a=>{a.isPickable=!1})})}dispose(){this._loader=null}}d(t);u(t,!0,o=>new f(o));export{f as KHR_node_selectability}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_node_visibility-D952nLJv.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_node_visibility-D952nLJv.js new file mode 100644 index 0000000000000000000000000000000000000000..ed93db8f12e9e44d0ec5df063ffbcba324497316 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_node_visibility-D952nLJv.js @@ -0,0 +1 @@ +import{aG as n,aH as r}from"./index-CDrXokXW.js";import{A as a}from"./objectModelMapping-CGWnurZP.js";import"./index-DWyDLubb.js";const o="KHR_node_visibility";a("/nodes/{}/extensions/KHR_node_visibility/visible",{get:e=>{const i=e._babylonTransformNode;return i&&i.isVisible!==void 0?i.isVisible:!0},set:(e,i)=>{i._primitiveBabylonMeshes?.forEach(s=>{s.inheritVisibility=!0}),i._babylonTransformNode&&(i._babylonTransformNode.isVisible=e),i._primitiveBabylonMeshes?.forEach(s=>{s.isVisible=e})},getTarget:e=>e._babylonTransformNode,getPropertyName:[()=>"isVisible"],type:"boolean"});class b{constructor(i){this.name=o,this._loader=i,this.enabled=i.isExtensionUsed(o)}onReady(){if(!this._loader)return;const i=this._loader.gltf.nodes;if(i)for(const s of i){const t=s._babylonTransformNode;t&&(t.inheritVisibility=!0,s.extensions&&s.extensions.KHR_node_visibility&&s.extensions.KHR_node_visibility.visible===!1&&(t.isVisible=!1))}}dispose(){delete this._loader}}n(o);r(o,!0,e=>new b(e));export{b as KHR_node_visibility}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_texture_basisu-iW9bNKGX.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_texture_basisu-iW9bNKGX.js new file mode 100644 index 0000000000000000000000000000000000000000..17b3129fc62675751f8980cd8380b7a4466f167e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_texture_basisu-iW9bNKGX.js @@ -0,0 +1 @@ +import{GLTFLoader as a,ArrayItem as o}from"./glTFLoader-Bp7IfGPK.js";import{aG as d,aH as _}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const r="KHR_texture_basisu";class c{constructor(e){this.name=r,this._loader=e,this.enabled=e.isExtensionUsed(r)}dispose(){this._loader=null}_loadTextureAsync(e,s,n){return a.LoadExtensionAsync(e,s,this.name,async(i,l)=>{const m=s.sampler==null?a.DefaultSampler:o.Get(`${e}/sampler`,this._loader.gltf.samplers,s.sampler),u=o.Get(`${i}/source`,this._loader.gltf.images,l.source);return await this._loader._createTextureAsync(e,m,u,p=>{n(p)},s._textureInfo.nonColorData?{useRGBAIfASTCBC7NotAvailableWhenUASTC:!0}:void 0,!s._textureInfo.nonColorData)})}}d(r);_(r,!0,t=>new c(t));export{c as KHR_texture_basisu}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_texture_transform-DDUX66hd.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_texture_transform-DDUX66hd.js new file mode 100644 index 0000000000000000000000000000000000000000..c5c8c9744750b30896a448949e56742f5f33c2f7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_texture_transform-DDUX66hd.js @@ -0,0 +1 @@ +import{T as d,aG as c,aH as m}from"./index-CDrXokXW.js";import{GLTFLoader as p}from"./glTFLoader-Bp7IfGPK.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const s="KHR_texture_transform";class n{constructor(o){this.name=s,this._loader=o,this.enabled=this._loader.isExtensionUsed(s)}dispose(){this._loader=null}loadTextureInfoAsync(o,a,f){return p.LoadExtensionAsync(o,a,this.name,async(e,t)=>await this._loader.loadTextureInfoAsync(o,a,r=>{if(!(r instanceof d))throw new Error(`${e}: Texture type not supported`);t.offset&&(r.uOffset=t.offset[0],r.vOffset=t.offset[1]),r.uRotationCenter=0,r.vRotationCenter=0,t.rotation&&(r.wAng=-t.rotation),t.scale&&(r.uScale=t.scale[0],r.vScale=t.scale[1]),t.texCoord!=null&&(r.coordinatesIndex=t.texCoord),f(r)}))}}c(s);m(s,!0,i=>new n(i));export{n as KHR_texture_transform}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_xmp_json_ld-DX3w5iqB.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_xmp_json_ld-DX3w5iqB.js new file mode 100644 index 0000000000000000000000000000000000000000..1490ae2fbb1f909acdb221946fb7aa2157bca785 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KHR_xmp_json_ld-DX3w5iqB.js @@ -0,0 +1 @@ +import{aG as n,aH as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const s="KHR_xmp_json_ld";class i{constructor(t){this.name=s,this.order=100,this._loader=t,this.enabled=this._loader.isExtensionUsed(s)}dispose(){this._loader=null}onLoading(){if(this._loader.rootBabylonMesh===null)return;const t=this._loader.gltf.extensions?.KHR_xmp_json_ld,o=this._loader.gltf.asset?.extensions?.KHR_xmp_json_ld;if(t&&o){const a=+o.packet;t.packets&&anew i(e));export{i as KHR_xmp_json_ld}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..0acaaff03d4bb7606de02a827aeee338e5a86910 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_AMS-Regular-DMm9YOAa.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_AMS-Regular-DMm9YOAa.woff new file mode 100644 index 0000000000000000000000000000000000000000..b804d7b33a3fa5b2587d2d1d55006aed678e3eb2 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_AMS-Regular-DMm9YOAa.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_AMS-Regular-DRggAlZN.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_AMS-Regular-DRggAlZN.ttf new file mode 100644 index 0000000000000000000000000000000000000000..c6f9a5e7c03f9e64e9c7b4773a8e37ade8eaf406 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_AMS-Regular-DRggAlZN.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf new file mode 100644 index 0000000000000000000000000000000000000000..9ff4a5e04421e5107f74c28e27354e0b2a4e7ef8 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff new file mode 100644 index 0000000000000000000000000000000000000000..9759710d1d3e16eb10012d56babb73f2479ba9f0 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..f390922eceffe1f6dfb81a3dc086a92d98171b02 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff new file mode 100644 index 0000000000000000000000000000000000000000..9bdd534fd2beb9b878f0219da9d63ffba56677e2 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..75344a1f98e37e2c631e178065854c3a81fb842f Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf new file mode 100644 index 0000000000000000000000000000000000000000..f522294ff0f3f8c52dfdaef7ebfaa06ebfcfaabf Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf new file mode 100644 index 0000000000000000000000000000000000000000..4e98259c3b54076d684bf3459baeaeae8dbce97a Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff new file mode 100644 index 0000000000000000000000000000000000000000..e7730f66275c87c28f26530d89264cffecf90be0 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..395f28beac23c7b0f7f3a1e714bd8dac253dd3bc Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Regular-CB_wures.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Regular-CB_wures.ttf new file mode 100644 index 0000000000000000000000000000000000000000..b8461b275fae76efd0d21fd0f1aaa696a5b10f9a Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Regular-CB_wures.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..735f6948d63c8cc7f8233735bb9c8d843c83d804 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff new file mode 100644 index 0000000000000000000000000000000000000000..acab069f90b6fe6301a004e6f8beaf6a0db48bce Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Bold-Cx986IdX.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Bold-Cx986IdX.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..ab2ad21da6fbe6c171bb869240954d0ead8f68fd Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Bold-Cx986IdX.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Bold-Jm3AIy58.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Bold-Jm3AIy58.woff new file mode 100644 index 0000000000000000000000000000000000000000..f38136ac1cc2dcdc9d9b10b8521487468b1f768c Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Bold-Jm3AIy58.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Bold-waoOVXN0.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Bold-waoOVXN0.ttf new file mode 100644 index 0000000000000000000000000000000000000000..4060e627dc341c1854260cbc3f7386e222a4d297 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Bold-waoOVXN0.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..5931794de4a2a485fa70099bf2659b145976d043 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf new file mode 100644 index 0000000000000000000000000000000000000000..dc007977ee709a236d9e82719cf7d4e5577a81b9 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff new file mode 100644 index 0000000000000000000000000000000000000000..67807b0bd4f867853271f5917fb3adf377f93f53 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Italic-3WenGoN9.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Italic-3WenGoN9.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0e9b0f354ad460202bba554359f5adcc8da666b7 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Italic-3WenGoN9.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Italic-BMLOBm91.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Italic-BMLOBm91.woff new file mode 100644 index 0000000000000000000000000000000000000000..6f43b594b6c1d863a0e3f93b001f8dd503316464 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Italic-BMLOBm91.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..b50920e138807f385d0b0359f4f0f09891f18406 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Regular-B22Nviop.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Regular-B22Nviop.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..eb24a7ba282b03d830fa6c63ee897d92a5188736 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Regular-B22Nviop.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Regular-Dr94JaBh.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Regular-Dr94JaBh.woff new file mode 100644 index 0000000000000000000000000000000000000000..21f5812968c42392a3eaea9b0c6320870b6b8b38 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Regular-Dr94JaBh.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Regular-ypZvNtVU.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Regular-ypZvNtVU.ttf new file mode 100644 index 0000000000000000000000000000000000000000..dd45e1ed2e18b32c516d9b481ebed3cb8bffa711 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Main-Regular-ypZvNtVU.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf new file mode 100644 index 0000000000000000000000000000000000000000..728ce7a1e2cb689df32c3a6c26e1bd072dcf2acb Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..29657023adc09956249f6295746c8ce4469b50d3 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff new file mode 100644 index 0000000000000000000000000000000000000000..0ae390d74c9f665cf8b1e5ea5483395da7513444 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-Italic-DA0__PXp.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-Italic-DA0__PXp.woff new file mode 100644 index 0000000000000000000000000000000000000000..eb5159d4c1ca83fb92b3190223698427df0e010c Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-Italic-DA0__PXp.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-Italic-flOr_0UB.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-Italic-flOr_0UB.ttf new file mode 100644 index 0000000000000000000000000000000000000000..70d559b4e937ca1b805eb39f544cbebe3c58ca6f Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-Italic-flOr_0UB.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-Italic-t53AETM-.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-Italic-t53AETM-.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..215c143fd7805a5c2b222bd7892a1a2b09610020 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Math-Italic-t53AETM-.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf new file mode 100644 index 0000000000000000000000000000000000000000..2f65a8a3a6d3628d11ea9c26c9077cef672fe427 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..cfaa3bda59246b49e94298478d6de3b3208066c8 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff new file mode 100644 index 0000000000000000000000000000000000000000..8d47c02d9408d34b2a9d566c0fe0d42bf82fb735 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..349c06dc609f896392fd5bc8b364d3bc3efc9330 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff new file mode 100644 index 0000000000000000000000000000000000000000..7e02df963621a5e26d53d510f0b4992eebde1c60 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf new file mode 100644 index 0000000000000000000000000000000000000000..d5850df98ec19de2eee9ff922ef59586efe471d0 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf new file mode 100644 index 0000000000000000000000000000000000000000..537279f6bd2184ed32f1a5168850609147d58ee6 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff new file mode 100644 index 0000000000000000000000000000000000000000..31b84829b42edae20d0148eeec0d922dad2108c4 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..a90eea85f6f7bded69ff5d40114447a6d8b48cfe Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Script-Regular-C5JkGWo-.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Script-Regular-C5JkGWo-.ttf new file mode 100644 index 0000000000000000000000000000000000000000..fd679bf374af72f2a183b97b40c9c7e9e51fbe5e Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Script-Regular-C5JkGWo-.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..b3048fc115681ee6c1bc86b0aa158cfbbf59daa3 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Script-Regular-D5yQViql.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Script-Regular-D5yQViql.woff new file mode 100644 index 0000000000000000000000000000000000000000..0e7da821eee0dd05a0a6f0b16c2c1345dc573a84 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Script-Regular-D5yQViql.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size1-Regular-C195tn64.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size1-Regular-C195tn64.woff new file mode 100644 index 0000000000000000000000000000000000000000..7f292d91184f257054ef77cc1cd3443db757c9cc Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size1-Regular-C195tn64.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf new file mode 100644 index 0000000000000000000000000000000000000000..871fd7d19d8658f64d8696ed9cdfc82c821ed76d Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..c5a8462fbfe2c39a7c1857b9e296e62500a8a8a5 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf new file mode 100644 index 0000000000000000000000000000000000000000..7a212caf91c0007e826fee2d622bf48acbd30dde Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..e1bccfe2403a4ed770c1697ae7c15b9e1cd9bc4e Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size2-Regular-oD1tc_U0.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size2-Regular-oD1tc_U0.woff new file mode 100644 index 0000000000000000000000000000000000000000..d241d9be2d317f7b39b401d96c8b18836acea0fa Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size2-Regular-oD1tc_U0.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size3-Regular-CTq5MqoE.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size3-Regular-CTq5MqoE.woff new file mode 100644 index 0000000000000000000000000000000000000000..e6e9b658dcf1cd031ac82b6b8f312444c55d4fc0 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size3-Regular-CTq5MqoE.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf new file mode 100644 index 0000000000000000000000000000000000000000..00bff3495fa9d2f98c1c9ce436add6a1bcfe87fb Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size4-Regular-BF-4gkZK.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size4-Regular-BF-4gkZK.woff new file mode 100644 index 0000000000000000000000000000000000000000..e1ec5457664f438ce5a1cc6dd8409bf60ca7804b Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size4-Regular-BF-4gkZK.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size4-Regular-DWFBv043.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size4-Regular-DWFBv043.ttf new file mode 100644 index 0000000000000000000000000000000000000000..74f08921f00f71f413ca42c9d1c90202e672ef38 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size4-Regular-DWFBv043.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..680c13085076a2f6c5a7e695935ec3f21cddb65f Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff new file mode 100644 index 0000000000000000000000000000000000000000..2432419f28936aff53ddfa2a732d027e6a6648fd Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..771f1af705f5cef5f578b3a1e7d8eff66f9b76b0 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf new file mode 100644 index 0000000000000000000000000000000000000000..c83252c5714c71a3e0ec62195884167339a0129b Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/LineChart-pr5WctpY.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/LineChart-pr5WctpY.js new file mode 100644 index 0000000000000000000000000000000000000000..3ed092990e1c6bebbd2dfd601f80b4518e0c7009 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/LineChart-pr5WctpY.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as t,f as o}from"./index-DWyDLubb.js";var v=o('');function s(i){var r=v();t(i,r)}export{s as L}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Login-DEGa-CNM.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Login-DEGa-CNM.js new file mode 100644 index 0000000000000000000000000000000000000000..3a88c04f87394011aec8b03c2e0989958042ed86 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Login-DEGa-CNM.js @@ -0,0 +1 @@ +import{p as c,e as re,i as R,b as ae}from"./i18n-Dnhn5Rxr.js";import{R as se,S as Y,X as p,w as l,x as f,ad as j,G as m,z as u,a as i,a7 as oe,t as g,a0 as P,V as h,T as le,a3 as U,U as x,W as d,Y as $,a8 as ie}from"./index-DWyDLubb.js";import{h as ne}from"./html-Ih_5QVTo.js";import{B as pe}from"./BaseForm-B7Gu_hvH.js";import{T as A}from"./Textbox-BuFR2fNz.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{B as E}from"./Block-J4oodUWp.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";/* empty css */import{B as me}from"./Button-D-_s2ksk.js";import{B as ue}from"./Index.svelte_svelte_type_style_lang-BKODC18H.js";import"./actions-CLThs9VH.js";import"./input-DrerMDOL.js";import"./BlockTitle-BMm9LakX.js";import"./Info-Dzjhnd64.js";import"./Check-DUAHzS2-.js";import"./Copy-ChCbTvli.js";import"./Send-B_rl9Hxa.js";import"./Square-CcB54dqq.js";import"./IconButtonWrapper-D0s9l4wW.js";import"./snippet-BWgYNF9D.js";import"./index-B_pwUImq.js";import"./Image-CeW7PJs4.js";import"./misc-vsnLZ-Y1.js";/* empty css *//* empty css */import"./index-CglBvmLb.js";import"./Clear-BF6j078A.js";var de=d('

          '),_e=d('

          '),ve=d('

          '),ce=d(" ",1),fe=d('

          ',1),ge=d("
          ");function He(H,n){se(n,!1);let _=c(n,"root",12),b=c(n,"auth_message",12),k=c(n,"app_mode",12),T=c(n,"space_id",12),r=c(n,"i18n",12),w=U(""),B=U(""),W=U(!1);const S=async()=>{const t=new FormData;t.append("username",l(w)),t.append("password",l(B));const C=new URL("login",_().endsWith("/")?_():_()+"/").href;let v=await fetch(C,{method:"POST",body:t});v.status===400?(f(W,!0),f(w,""),f(B,"")):v.status==200&&location.reload()};var I={get root(){return _()},set root(t){_(t),x()},get auth_message(){return b()},set auth_message(t){b(t),x()},get app_mode(){return k()},set app_mode(t){k(t),x()},get space_id(){return T()},set space_id(t){T(t),x()},get i18n(){return r()},set i18n(t){r(t),x()}};re();var y=ge();let q;var J=h(y);return ue(J,{variant:"panel",min_width:480,children:(t,C)=>{var v=fe(),z=Y(v),K=h(z,!0);$(z);var G=p(z,2);{var M=e=>{var a=de(),s=h(a);ne(s,b),$(a),i(e,a)};R(G,e=>{b()&&e(M)})}var O=p(G,2);{var N=e=>{var a=_e(),s=h(a,!0);$(a),g(o=>P(s,o),[()=>(m(r()),u(()=>r()("login.enable_cookies")))]),i(e,a)};R(O,e=>{T()&&e(N)})}var V=p(O,2);{var Q=e=>{var a=ve(),s=h(a,!0);$(a),g(o=>P(s,o),[()=>(m(r()),u(()=>r()("login.incorrect_credentials")))]),i(e,a)};R(V,e=>{l(W)&&e(Q)})}var X=p(V,2);pe(X,{children:(e,a)=>{var s=ce(),o=Y(s);E(o,{children:(D,te)=>{{let F=j(()=>(m(r()),u(()=>r()("login.username"))));A(D,{get label(){return l(F)},lines:1,show_label:!0,max_lines:1,onsubmit:S,get value(){return l(w)},set value(L){f(w,L)},$$legacy:!0})}},$$slots:{default:!0}});var ee=p(o,2);E(ee,{children:(D,te)=>{{let F=j(()=>(m(r()),u(()=>r()("login.password"))));A(D,{get label(){return l(F)},lines:1,show_label:!0,max_lines:1,type:"password",onsubmit:S,get value(){return l(B)},set value(L){f(B,L)},$$legacy:!0})}},$$slots:{default:!0}}),i(e,s)},$$slots:{default:!0}});var Z=p(X,2);me(Z,{size:"lg",variant:"primary",onclick:S,children:(e,a)=>{ie();var s=oe();g(o=>P(s,o),[()=>(m(r()),u(()=>r()("login.login")))]),i(e,s)},$$slots:{default:!0}}),g(e=>P(K,e),[()=>(m(r()),u(()=>r()("login.login")))]),i(t,v)},$$slots:{default:!0}}),$(y),g(()=>q=ae(y,1,"wrap svelte-14xt79u",null,q,{"min-h-screen":k()})),i(H,y),le(I)}export{He as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Login-DLnqC4Fa.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Login-DLnqC4Fa.css new file mode 100644 index 0000000000000000000000000000000000000000..0ebf035a692fd879788f1c73ac2ddd3b9f0180f4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Login-DLnqC4Fa.css @@ -0,0 +1 @@ +.wrap.svelte-14xt79u{display:flex;flex-direction:column;justify-content:center;align-items:center;margin-top:var(--size-3);background:var(--background-fill-primary);width:var(--size-full)}h2.svelte-14xt79u{margin-bottom:var(--size-3);color:var(--body-text-color);font-weight:var(--section-header-text-weight);font-size:var(--text-xl)}.auth.svelte-14xt79u{margin-top:var(--size-1);margin-bottom:var(--size-1);color:var(--body-text-color)}.creds.svelte-14xt79u{margin-top:var(--size-4);margin-bottom:var(--size-4);color:var(--error-text-color);font-weight:var(--weight-semibold)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MSFT_audio_emitter-C84vLoK2.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MSFT_audio_emitter-C84vLoK2.js new file mode 100644 index 0000000000000000000000000000000000000000..e2b19b8ec1491d4f9d617e4bf9d8274736318921 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MSFT_audio_emitter-C84vLoK2.js @@ -0,0 +1 @@ +import{O as R,V as m,aq as E,A as c,L as C,bo as v,be as F,R as L,b,a as _,M as U,by as W,d as P,aG as z,aH as q}from"./index-CDrXokXW.js";import{_ as $,d as g}from"./spatialWebAudio-CBDS0rWd.js";import{_WebAudioSoundSource as p}from"./webAudioSoundSource-CHASmwKl.js";import{_WebAudioStaticSound as y}from"./webAudioStaticSound-C9f3HBnG.js";import{_WebAudioStreamingSound as G}from"./webAudioStreamingSound-orB8PSId.js";import{ArrayItem as T,GLTFLoader as S}from"./glTFLoader-Bp7IfGPK.js";import"./audioEngine-C797_5QL.js";import"./index-DWyDLubb.js";import"./webAudioBaseSubGraph-CNNuTFUE.js";import"./abstractSoundSource-D3oGzC3p.js";import"./abstractSoundInstance-Cb1S6dEM.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";class w{constructor(t,e,i){this.frame=t,this.action=e,this.onlyOnce=i,this.isDone=!1}_clone(){return new w(this.frame,this.action,this.onlyOnce)}}const x={duration:0,shape:"linear"},D={duration:0,startOffset:0,waitTime:0},I={waitTime:0};function M(o){return o*Math.PI/180}function N(o){return o*180/Math.PI}class A{get name(){return this._soundV2.name}set name(t){this._soundV2.name=t}get autoplay(){return this._soundV2 instanceof p?!0:this._optionsV2.autoplay}set autoplay(t){this._optionsV2.autoplay=t}get loop(){return this._soundV2 instanceof p?!0:this._soundV2.loop}set loop(t){this._soundV2 instanceof p||this._soundV2&&(this._soundV2.loop=t)}get isPlaying(){return this._soundV2 instanceof p?!0:this._soundV2?.state===3||!this.isReady()&&this._optionsV2.autoplay}get isPaused(){return this._soundV2 instanceof p?!1:this._soundV2.state===5}get maxDistance(){return this._optionsV2.spatialMaxDistance||100}set maxDistance(t){this._optionsV2.spatialMaxDistance=t,!this.useCustomAttenuation&&this._soundV2&&(this._initSpatial(),this._soundV2.spatial.maxDistance=t)}get distanceModel(){return this._optionsV2.spatialDistanceModel||"linear"}set distanceModel(t){this._optionsV2.spatialDistanceModel=t,this._soundV2&&(this._initSpatial(),this._soundV2.spatial.distanceModel=t)}get currentTime(){return this._soundV2 instanceof p?this._soundV2.engine.currentTime:this._soundV2.currentTime}get spatialSound(){return this._soundV2?._isSpatial??!1}set spatialSound(t){this._soundV2&&(t?this._initSpatial():this._soundV2._isSpatial=!1)}get _onReady(){return this._onReadyObservable||(this._onReadyObservable=new R),this._onReadyObservable}constructor(t,e,i,s=null,a){if(this.useCustomAttenuation=!1,this.soundTrackId=-1,this.refDistance=1,this.rolloffFactor=1,this.metadata=null,this.onEndedObservable=new R,this._localDirection=new m(1,0,0),this._volume=1,this._isReadyToPlay=!1,this._isDirectional=!1,this._isOutputConnected=!1,this._url=null,this._onReadyObservable=null,this._onReadyToPlay=()=>{this._scene.mainSoundTrack.addSound(this),this._isReadyToPlay=!0,this._readyToPlayCallback(),this._onReadyObservable&&this._onReadyObservable.notifyObservers(),this._optionsV2.autoplay&&this.play()},this._onended=()=>{this.onended&&this.onended(),this.onEndedObservable.notifyObservers(this)},i=i||E.LastCreatedScene,!i)return;this._scene=i,A._SceneComponentInitialization(i),this._readyToPlayCallback=s||(()=>{}),this._customAttenuationFunction=(h,V,O,Q,X)=>V{if(r){const h={preloadCount:0,...n},V=new G(t,d,h);return V._initAsync(e,n).then(()=>{V.preloadInstancesAsync(1).then(this._onReadyToPlay)}),V}else{const h=new y(t,d,n);return h._initAsync(e,n).then(this._onReadyToPlay),h}};if(!e)this._soundV2=new y(t,d,n);else if(typeof e=="string")this._url=e,this._soundV2=u();else if(e instanceof ArrayBuffer)r=!1,this._soundV2=u();else if(e instanceof HTMLMediaElement)r=!0,this._soundV2=u();else if(e instanceof MediaStream){const h=new MediaStreamAudioSourceNode(d._audioContext,{mediaStream:e});this._soundV2=new p(t,h,d,n),this._soundV2._initAsync(n).then(this._onReadyToPlay)}else e instanceof AudioBuffer?(r=!1,this._soundV2=u()):Array.isArray(e)&&(this._soundV2=u());if(!this._soundV2){C.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.");return}this._soundV2 instanceof p||this._soundV2.onEndedObservable.add(this._onended)}dispose(){this.isPlaying&&this.stop(),this._isReadyToPlay=!1,this.soundTrackId===-1?this._scene.mainSoundTrack.removeSound(this):this._scene.soundTracks&&this._scene.soundTracks[this.soundTrackId].removeSound(this),this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._connectedTransformNode=null),this._soundV2.dispose()}isReady(){return this._isReadyToPlay}getClassName(){return"Sound"}setAudioBuffer(t){this._isReadyToPlay||this._soundV2 instanceof y&&this._soundV2._initAsync(t,this._optionsV2).then(this._onReadyToPlay)}updateOptions(t){if(t){if(this.loop=t.loop??this.loop,this.maxDistance=t.maxDistance??this.maxDistance,this.useCustomAttenuation=t.useCustomAttenuation??this.useCustomAttenuation,this.rolloffFactor=t.rolloffFactor??this.rolloffFactor,this.refDistance=t.refDistance??this.refDistance,this.distanceModel=t.distanceModel??this.distanceModel,t.playbackRate!==void 0&&this.setPlaybackRate(t.playbackRate),t.spatialSound!==void 0&&(this.spatialSound=t.spatialSound),t.volume!==void 0&&this.setVolume(t.volume),this._soundV2 instanceof y){let e=!1;t.offset!==void 0&&(this._optionsV2.startOffset=t.offset,e=!0),t.length!==void 0&&(this._soundV2.duration=t.length,e=!0),e&&this.isPaused&&this.stop()}this._updateSpatialParameters()}}_updateSpatialParameters(){if(!this.spatialSound)return;const t=this._soundV2.spatial;this.useCustomAttenuation?(t.distanceModel="linear",t.minDistance=1,t.maxDistance=Number.MAX_VALUE,t.rolloffFactor=1,t.panningModel="equalpower"):(t.distanceModel=this.distanceModel,t.minDistance=this.refDistance,t.maxDistance=this.maxDistance,t.rolloffFactor=this.rolloffFactor,t.panningModel=this._optionsV2.spatialPanningModel||"equalpower")}switchPanningModelToHRTF(){this.spatialSound&&(this._initSpatial(),this._soundV2.spatial.panningModel="HRTF")}switchPanningModelToEqualPower(){this.spatialSound&&(this._initSpatial(),this._soundV2.spatial.panningModel="equalpower")}connectToSoundTrackAudioNode(t){const e=this._soundV2._outNode;e&&(this._isOutputConnected&&e.disconnect(),e.connect(t),this._isOutputConnected=!0)}setDirectionalCone(t,e,i){if(e{this._soundV2.play(D)},500)}catch(a){C.Error("Error while trying to play audio: "+this.name+", "+a.message)}}}stop(t){this._soundV2&&(this._soundV2 instanceof p||(I.waitTime=t||0,this._soundV2.stop(I)))}pause(){this._soundV2&&(this._soundV2 instanceof p||this._soundV2.pause())}setVolume(t,e){if(!this.isReady()){this._onReady.addOnce(()=>{this.setVolume(t,e)});return}x.duration=e||0,this._soundV2.setVolume(t,x),this._volume=t}setPlaybackRate(t){this._soundV2 instanceof y&&(this._soundV2.playbackRate=t)}getPlaybackRate(){return this._soundV2 instanceof y?this._soundV2.playbackRate:1}getVolume(){return this._volume}attachToMesh(t){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedTransformNode=t,this.spatialSound||(this.spatialSound=!0,this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._optionsV2.startOffset,this._optionsV2.duration))),this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode),this._registerFunc=e=>this._onRegisterAfterWorldMatrixUpdate(e),this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc)}detachFromMesh(){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedTransformNode=null)}_onRegisterAfterWorldMatrixUpdate(t){if(!t.getBoundingInfo)this.setPosition(t.absolutePosition);else{const i=t.getBoundingInfo();this.setPosition(i.boundingSphere.centerWorld)}this._isDirectional&&this.isPlaying&&this._updateDirection()}clone(){if(!(this._soundV2 instanceof y))return null;const t={autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,useCustomAttenuation:this.useCustomAttenuation,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel},e=new A(this.name+"_cloned",this._soundV2.buffer,this._scene,null,t);return e._optionsV2=this._optionsV2,this.useCustomAttenuation&&e.setAttenuationFunction(this._customAttenuationFunction),e}getAudioBuffer(){return this._soundV2 instanceof y?this._soundV2.buffer._audioBuffer:null}getSoundSource(){return null}getSoundGain(){return this._soundV2._outNode}serialize(){const t={name:this.name,url:this._url,autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel,playbackRate:this.getPlaybackRate(),panningModel:this._soundV2.spatial.panningModel,soundTrackId:this.soundTrackId,metadata:this.metadata};return this.spatialSound&&(this._connectedTransformNode&&(t.connectedMeshId=this._connectedTransformNode.id),t.position=this._soundV2.spatial.position.asArray(),t.refDistance=this.refDistance,t.distanceModel=this.distanceModel,t.isDirectional=this._isDirectional,t.localDirectionToMesh=this._localDirection.asArray(),t.coneInnerAngle=this.directionalConeInnerAngle,t.coneOuterAngle=this.directionalConeOuterAngle,t.coneOuterGain=this._soundV2.spatial.coneOuterVolume),t}static Parse(t,e,i,s){const a=t.name;let n;t.url?n=i+t.url:n=i+a;const r={autoplay:t.autoplay,loop:t.loop,volume:t.volume,spatialSound:t.spatialSound,maxDistance:t.maxDistance,rolloffFactor:t.rolloffFactor,refDistance:t.refDistance,distanceModel:t.distanceModel,playbackRate:t.playbackRate};let l;if(!s)l=new A(a,n,e,()=>{e.removePendingData(l)},r),e.addPendingData(l);else{const d=()=>{v(()=>s._isReadyToPlay,()=>{const u=s.getAudioBuffer();u&&l.setAudioBuffer(u),l._isReadyToPlay=!0,l.autoplay&&l.play(0,s._optionsV2.startOffset,s._optionsV2.duration)},void 0,300)};l=new A(a,new ArrayBuffer(0),e,null,r),d()}if(t.position){const d=m.FromArray(t.position);l.setPosition(d)}if(t.isDirectional&&(l.setDirectionalCone(t.coneInnerAngle||360,t.coneOuterAngle||360,t.coneOuterGain||0),t.localDirectionToMesh)){const d=m.FromArray(t.localDirectionToMesh);l.setLocalDirectionToMesh(d)}if(t.connectedMeshId){const d=e.getMeshById(t.connectedMeshId);d&&l.attachToMesh(d)}return t.metadata&&(l.metadata=t.metadata),l}}A._SceneComponentInitialization=o=>{throw F("AudioSceneComponent")};L("BABYLON.Sound",A);class j{constructor(t,e,i){if(this.loop=!1,this._coneInnerAngle=360,this._coneOuterAngle=360,this._volume=1,this.isPlaying=!1,this.isPaused=!1,this._sounds=[],this._weights=[],e.length!==i.length)throw new Error("Sounds length does not equal weights length");this.loop=t,this._weights=i;let s=0;for(const n of i)s+=n;const a=s>0?1/s:0;for(let n=0;n{this._onended()})}get directionalConeInnerAngle(){return this._coneInnerAngle}set directionalConeInnerAngle(t){if(t!==this._coneInnerAngle){if(this._coneOuterAngle0&&(s=e.activeCameras[0]),this.audioListenerPositionProvider){const n=this.audioListenerPositionProvider();i.audioContext.listener.setPosition(n.x||0,n.y||0,n.z||0)}else s?this._cachedCameraPosition.equals(s.globalPosition)||(this._cachedCameraPosition.copyFrom(s.globalPosition),i.audioContext.listener.setPosition(s.globalPosition.x,s.globalPosition.y,s.globalPosition.z)):i.audioContext.listener.setPosition(0,0,0);if(this.audioListenerRotationProvider){const n=this.audioListenerRotationProvider();i.audioContext.listener.setOrientation(n.x||0,n.y||0,n.z||0,0,1,0)}else s?(s.rigCameras&&s.rigCameras.length>0&&(s=s.rigCameras[0]),s.getViewMatrix().invertToRef(this._invertMatrixTemp),m.TransformNormalToRef(f._CameraDirection,this._invertMatrixTemp,this._cameraDirectionTemp),this._cameraDirectionTemp.normalize(),!isNaN(this._cameraDirectionTemp.x)&&!isNaN(this._cameraDirectionTemp.y)&&!isNaN(this._cameraDirectionTemp.z)&&(this._cachedCameraDirection.equals(this._cameraDirectionTemp)||(this._cachedCameraDirection.copyFrom(this._cameraDirectionTemp),i.audioContext.listener.setOrientation(this._cameraDirectionTemp.x,this._cameraDirectionTemp.y,this._cameraDirectionTemp.z,0,1,0)))):i.audioContext.listener.setOrientation(0,0,0,0,1,0);let a;for(a=0;a{let t=o._getComponent(_.NAME_AUDIO);t||(t=new f(o),o._addComponent(t))};const k="MSFT_audio_emitter";class B{constructor(t){this.name=k,this._loader=t,this.enabled=this._loader.isExtensionUsed(k)}dispose(){this._loader=null,this._clips=null,this._emitters=null}onLoading(){const t=this._loader.gltf.extensions;if(t&&t[this.name]){const e=t[this.name];this._clips=e.clips,this._emitters=e.emitters,T.Assign(this._clips),T.Assign(this._emitters)}}loadSceneAsync(t,e){return S.LoadExtensionAsync(t,e,this.name,async(i,s)=>{const a=new Array;a.push(this._loader.loadSceneAsync(t,e));for(const n of s.emitters){const r=T.Get(`${i}/emitters`,this._emitters,n);if(r.refDistance!=null||r.maxDistance!=null||r.rolloffFactor!=null||r.distanceModel!=null||r.innerAngle!=null||r.outerAngle!=null)throw new Error(`${i}: Direction or Distance properties are not allowed on emitters attached to a scene`);a.push(this._loadEmitterAsync(`${i}/emitters/${r.index}`,r))}await Promise.all(a)})}loadNodeAsync(t,e,i){return S.LoadExtensionAsync(t,e,this.name,async(s,a)=>{const n=new Array,r=await this._loader.loadNodeAsync(s,e,l=>{for(const d of a.emitters){const u=T.Get(`${s}/emitters`,this._emitters,d);n.push(this._loadEmitterAsync(`${s}/emitters/${u.index}`,u).then(()=>{for(const h of u._babylonSounds)h.attachToMesh(l),(u.innerAngle!=null||u.outerAngle!=null)&&(h.setLocalDirectionToMesh(m.Forward()),h.setDirectionalCone(2*P.ToDegrees(u.innerAngle==null?Math.PI:u.innerAngle),2*P.ToDegrees(u.outerAngle==null?Math.PI:u.outerAngle),0))}))}i(l)});return await Promise.all(n),r})}loadAnimationAsync(t,e){return S.LoadExtensionAsync(t,e,this.name,async(i,s)=>{const a=await this._loader.loadAnimationAsync(t,e),n=new Array;T.Assign(s.events);for(const r of s.events)n.push(this._loadAnimationEventAsync(`${i}/events/${r.index}`,t,e,r,a));return await Promise.all(n),a})}_loadClipAsync(t,e){if(e._objectURL)return e._objectURL;let i;if(e.uri)i=this._loader.loadUriAsync(t,e,e.uri);else{const s=T.Get(`${t}/bufferView`,this._loader.gltf.bufferViews,e.bufferView);i=this._loader.loadBufferViewAsync(`/bufferViews/${s.index}`,s)}return e._objectURL=i.then(s=>URL.createObjectURL(new Blob([s],{type:e.mimeType}))),e._objectURL}_loadEmitterAsync(t,e){if(e._babylonSounds=e._babylonSounds||[],!e._babylonData){const i=new Array,s=e.name||`emitter${e.index}`,a={loop:!1,autoplay:!1,volume:e.volume==null?1:e.volume};for(let r=0;r{const h=e._babylonSounds[r]=new A(s,u,this._loader.babylonScene,null,a);h.refDistance=e.refDistance||1,h.maxDistance=e.maxDistance||256,h.rolloffFactor=e.rolloffFactor||1,h.distanceModel=e.distanceModel||"exponential"}))}const n=Promise.all(i).then(()=>{const r=e.clips.map(d=>d.weight||1),l=new j(e.loop||!1,e._babylonSounds,r);e.innerAngle&&(l.directionalConeInnerAngle=2*P.ToDegrees(e.innerAngle)),e.outerAngle&&(l.directionalConeOuterAngle=2*P.ToDegrees(e.outerAngle)),e.volume&&(l.volume=e.volume),e._babylonData.sound=l});e._babylonData={loaded:n}}return e._babylonData.loaded}_getEventAction(t,e,i,s,a){switch(i){case"play":return n=>{const r=(a||0)+(n-s);e.play(r)};case"stop":return()=>{e.stop()};case"pause":return()=>{e.pause()};default:throw new Error(`${t}: Unsupported action ${i}`)}}_loadAnimationEventAsync(t,e,i,s,a){if(a.targetedAnimations.length==0)return Promise.resolve();const n=a.targetedAnimations[0],r=s.emitter,l=T.Get(`/extensions/${this.name}/emitters`,this._emitters,r);return this._loadEmitterAsync(t,l).then(()=>{const d=l._babylonData.sound;if(d){const u=new w(s.time,this._getEventAction(t,d,s.action,s.time,s.startOffset));n.animation.addEvent(u),a.onAnimationGroupEndObservable.add(()=>{d.stop()}),a.onAnimationGroupPauseObservable.add(()=>{d.pause()})}})}}z(k);q(k,!0,o=>new B(o));export{B as MSFT_audio_emitter}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MSFT_lod-CdNjehaf.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MSFT_lod-CdNjehaf.js new file mode 100644 index 0000000000000000000000000000000000000000..9eb603bc46f29d075e83eedfbecc49505c0e0ab4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MSFT_lod-CdNjehaf.js @@ -0,0 +1 @@ +import{O as u,aM as f,aG as g,aH as p}from"./index-CDrXokXW.js";import{GLTFLoader as c,ArrayItem as b}from"./glTFLoader-Bp7IfGPK.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const O="MSFT_lod";class x{constructor(e){this.name=O,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new u,this.onMaterialLODsLoadedObservable=new u,this._bufferLODs=new Array,this._nodeIndexLOD=null,this._nodeSignalLODs=new Array,this._nodePromiseLODs=new Array,this._nodeBufferLODs=new Array,this._materialIndexLOD=null,this._materialSignalLODs=new Array,this._materialPromiseLODs=new Array,this._materialBufferLODs=new Array,this._loader=e,this.maxLODsToLoad=this._loader.parent.extensionOptions[O]?.maxLODsToLoad??this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(O)}dispose(){this._loader=null,this._nodeIndexLOD=null,this._nodeSignalLODs.length=0,this._nodePromiseLODs.length=0,this._nodeBufferLODs.length=0,this._materialIndexLOD=null,this._materialSignalLODs.length=0,this._materialPromiseLODs.length=0,this._materialBufferLODs.length=0,this.onMaterialLODsLoadedObservable.clear(),this.onNodeLODsLoadedObservable.clear()}onReady(){for(let e=0;e{e!==0&&(this._loader.endPerformanceCounter(`Node LOD ${e}`),this._loader.log(`Loaded node LOD ${e}`)),this.onNodeLODsLoadedObservable.notifyObservers(e),e!==this._nodePromiseLODs.length-1&&(this._loader.startPerformanceCounter(`Node LOD ${e+1}`),this._loadBufferLOD(this._nodeBufferLODs,e+1),this._nodeSignalLODs[e]&&this._nodeSignalLODs[e].resolve())});this._loader._completePromises.push(i)}for(let e=0;e{e!==0&&(this._loader.endPerformanceCounter(`Material LOD ${e}`),this._loader.log(`Loaded material LOD ${e}`)),this.onMaterialLODsLoadedObservable.notifyObservers(e),e!==this._materialPromiseLODs.length-1&&(this._loader.startPerformanceCounter(`Material LOD ${e+1}`),this._loadBufferLOD(this._materialBufferLODs,e+1),this._materialSignalLODs[e]&&this._materialSignalLODs[e].resolve())});this._loader._completePromises.push(i)}}loadSceneAsync(e,i){const s=this._loader.loadSceneAsync(e,i);return this._loadBufferLOD(this._bufferLODs,0),s}loadNodeAsync(e,i,s){return c.LoadExtensionAsync(e,i,this.name,async(t,o)=>{let n;const d=this._getLODs(t,i,this._loader.gltf.nodes,o.ids);this._loader.logOpen(`${t}`);for(let a=0;a{s(L),L.setEnabled(!1)},h=this._loader.loadNodeAsync(`/nodes/${l.index}`,l,r).then(L=>{if(a!==0){const _=d[a-1];_._babylonTransformNode&&(this._disposeTransformNode(_._babylonTransformNode),delete _._babylonTransformNode)}return L.setEnabled(!0),L});this._nodePromiseLODs[a]=this._nodePromiseLODs[a]||[],a===0?n=h:(this._nodeIndexLOD=null,this._nodePromiseLODs[a].push(h))}return this._loader.logClose(),await n})}_loadMaterialAsync(e,i,s,t,o){return this._nodeIndexLOD?null:c.LoadExtensionAsync(e,i,this.name,async(n,d)=>{let a;const l=this._getLODs(n,i,this._loader.gltf.materials,d.ids);this._loader.logOpen(`${n}`);for(let r=0;r{r===0&&o(_)}).then(_=>{if(r!==0){o(_);const m=l[r-1]._data;m[t]&&(this._disposeMaterials([m[t].babylonMaterial]),delete m[t])}return _});this._materialPromiseLODs[r]=this._materialPromiseLODs[r]||[],r===0?a=L:(this._materialIndexLOD=null,this._materialPromiseLODs[r].push(L))}return this._loader.logClose(),await a})}_loadUriAsync(e,i,s){if(this._nodeIndexLOD!==null){this._loader.log("deferred");const t=this._nodeIndexLOD-1;return this._nodeSignalLODs[t]=this._nodeSignalLODs[t]||new f,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then(async()=>await this._loader.loadUriAsync(e,i,s))}else if(this._materialIndexLOD!==null){this._loader.log("deferred");const t=this._materialIndexLOD-1;return this._materialSignalLODs[t]=this._materialSignalLODs[t]||new f,this._materialSignalLODs[t].promise.then(async()=>await this._loader.loadUriAsync(e,i,s))}return null}loadBufferAsync(e,i,s,t){if(this._loader.parent.useRangeRequests&&!i.uri){if(!this._loader.bin)throw new Error(`${e}: Uri is missing or the binary glTF is missing its binary chunk`);const o=async(n,d)=>{const a=s,l=a+t-1;let r=n[d];return r?(r.start=Math.min(r.start,a),r.end=Math.max(r.end,l)):(r={start:a,end:l,loaded:new f},n[d]=r),await r.loaded.promise.then(h=>new Uint8Array(h.buffer,h.byteOffset+s-r.start,t))};return this._loader.log("deferred"),this._nodeIndexLOD!==null?o(this._nodeBufferLODs,this._nodeIndexLOD):this._materialIndexLOD!==null?o(this._materialBufferLODs,this._materialIndexLOD):o(this._bufferLODs,0)}return null}_loadBufferLOD(e,i){const s=e[i];s&&(this._loader.log(`Loading buffer range [${s.start}-${s.end}]`),this._loader.bin.readAsync(s.start,s.end-s.start+1).then(t=>{s.loaded.resolve(t)},t=>{s.loaded.reject(t)}))}_getLODs(e,i,s,t){if(this.maxLODsToLoad<=0)throw new Error("maxLODsToLoad must be greater than zero");const o=[];for(let n=t.length-1;n>=0;n--)if(o.push(b.Get(`${e}/ids/${t[n]}`,s,t[n])),o.length===this.maxLODsToLoad)return o;return o.push(i),o}_disposeTransformNode(e){const i=[],s=e.material;s&&i.push(s);for(const o of e.getChildMeshes())o.material&&i.push(o.material);e.dispose();const t=i.filter(o=>this._loader.babylonScene.meshes.every(n=>n.material!=o));this._disposeMaterials(t)}_disposeMaterials(e){const i={};for(const s of e){for(const t of s.getActiveTextures())i[t.uniqueId]=t;s.dispose()}for(const s in i)for(const t of this._loader.babylonScene.materials)t.hasTexture(i[s])&&delete i[s];for(const s in i)i[s].dispose()}}g(O);p(O,!0,D=>new x(D));export{x as MSFT_lod}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MSFT_minecraftMesh-B8XzSlpi.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MSFT_minecraftMesh-B8XzSlpi.js new file mode 100644 index 0000000000000000000000000000000000000000..cac9c2a2008dca233a1b2cc1eb871ef15b7729da --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MSFT_minecraftMesh-B8XzSlpi.js @@ -0,0 +1 @@ +import{GLTFLoader as a}from"./glTFLoader-Bp7IfGPK.js";import{aG as d,aH as h}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const t="MSFT_minecraftMesh";class m{constructor(r){this.name=t,this._loader=r,this.enabled=this._loader.isExtensionUsed(t)}dispose(){this._loader=null}loadMaterialPropertiesAsync(r,s,e){return a.LoadExtraAsync(r,s,this.name,async(o,n)=>{if(n){if(!this._loader._pbrMaterialImpl)throw new Error(`${o}: Material type not supported`);const p=this._loader.loadMaterialPropertiesAsync(r,s,e);return e.needAlphaBlending()&&(e.forceDepthWrite=!0,e.separateCullingPass=!0),e.backFaceCulling=e.forceDepthWrite,e.twoSidedLighting=!0,await p}})}}d(t);h(t,!0,i=>new m(i));export{m as MSFT_minecraftMesh}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MSFT_sRGBFactors-DIaDjzzZ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MSFT_sRGBFactors-DIaDjzzZ.js new file mode 100644 index 0000000000000000000000000000000000000000..8767bc3512400f5208a4db25a9b6e97581f3e365 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MSFT_sRGBFactors-DIaDjzzZ.js @@ -0,0 +1 @@ +import{GLTFLoader as p}from"./glTFLoader-Bp7IfGPK.js";import{aG as l,aH as d}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./bone-z620UXj2.js";import"./skeleton-3aE04lM6.js";import"./rawTexture-DYLCXHMF.js";import"./assetContainer-D7EiOqw6.js";import"./objectModelMapping-CGWnurZP.js";const o="MSFT_sRGBFactors";class u{constructor(r){this.name=o,this._loader=r,this.enabled=this._loader.isExtensionUsed(o)}dispose(){this._loader=null}loadMaterialPropertiesAsync(r,a,t){return p.LoadExtraAsync(r,a,this.name,async(m,n)=>{if(n){const e=this._loader._getOrCreateMaterialAdapter(t),c=this._loader.loadMaterialPropertiesAsync(r,a,t),i=t.getScene().getEngine().useExactSrgbConversions;return e.baseColorTexture||e.baseColor.toLinearSpaceToRef(e.baseColor,i),e.specularColorTexture||e.specularColor.toLinearSpaceToRef(e.specularColor,i),await c}})}}l(o);d(o,!0,s=>new u(s));export{u as MSFT_sRGBFactors}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MarkdownCode-7h5zEbas.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MarkdownCode-7h5zEbas.css new file mode 100644 index 0000000000000000000000000000000000000000..47ccf9b420ee16fb2e56c4ce243756b90af6df53 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MarkdownCode-7h5zEbas.css @@ -0,0 +1 @@ +.gradio-container-6-13-0 Tables */ table,.gradio-container-6-13-0 tr,.gradio-container-6-13-0 td,.gradio-container-6-13-0 th{margin-top:var(--spacing-sm);margin-bottom:var(--spacing-sm);padding:var(--spacing-xl)}.gradio-container-6-13-0 .md code,.gradio-container-6-13-0 .md pre{background:none;font-family:var(--font-mono);font-size:var(--text-sm);text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;tab-size:2;hyphens:none}.gradio-container-6-13-0 .md pre[class*=language-]::selection,.gradio-container-6-13-0 .md pre[class*=language-] ::selection,.gradio-container-6-13-0 .md code[class*=language-]::selection,.gradio-container-6-13-0 .md code[class*=language-] ::selection{text-shadow:none;background:#b3d4fc}.gradio-container-6-13-0 .md pre{padding:1em;margin:.5em 0;overflow:auto;position:relative;margin-top:var(--spacing-sm);margin-bottom:var(--spacing-sm);box-shadow:none;border:none;border-radius:var(--radius-md);background:var(--code-background-fill);padding:var(--spacing-xxl);font-family:var(--font-mono);text-shadow:none;border-radius:var(--radius-sm);white-space:nowrap;display:block;white-space:pre}.gradio-container-6-13-0 .md :not(pre)>code{padding-block:var(--spacing-xxs);padding-inline:var(--spacing-xs);border-radius:var(--radius-xs);white-space:normal;background:var(--code-background-fill);border:1px solid var(--panel-border-color);display:inline-flex;align-items:center;line-height:1.4}.gradio-container-6-13-0 .md h1>code,.gradio-container-6-13-0 .md h2>code,.gradio-container-6-13-0 .md h3>code,.gradio-container-6-13-0 .md h4>code,.gradio-container-6-13-0 .md h5>code,.gradio-container-6-13-0 .md h6>code{font-size:inherit;line-height:inherit}.gradio-container-6-13-0 .md .token.comment,.gradio-container-6-13-0 .md .token.prolog,.gradio-container-6-13-0 .md .token.doctype,.gradio-container-6-13-0 .md .token.cdata{color:#708090}.gradio-container-6-13-0 .md .token.punctuation{color:#999}.gradio-container-6-13-0 .md .token.namespace{opacity:.7}.gradio-container-6-13-0 .md .token.property,.gradio-container-6-13-0 .md .token.tag,.gradio-container-6-13-0 .md .token.boolean,.gradio-container-6-13-0 .md .token.number,.gradio-container-6-13-0 .md .token.constant,.gradio-container-6-13-0 .md .token.symbol,.gradio-container-6-13-0 .md .token.deleted{color:#905}.gradio-container-6-13-0 .md .token.selector,.gradio-container-6-13-0 .md .token.attr-name,.gradio-container-6-13-0 .md .token.string,.gradio-container-6-13-0 .md .token.char,.gradio-container-6-13-0 .md .token.builtin,.gradio-container-6-13-0 .md .token.inserted{color:#690}.gradio-container-6-13-0 .md .token.atrule,.gradio-container-6-13-0 .md .token.attr-value,.gradio-container-6-13-0 .md .token.keyword{color:#07a}.gradio-container-6-13-0 .md .token.function,.gradio-container-6-13-0 .md .token.class-name{color:#dd4a68}.gradio-container-6-13-0 .md .token.regex,.gradio-container-6-13-0 .md .token.important,.gradio-container-6-13-0 .md .token.variable{color:#e90}.gradio-container-6-13-0 .md .token.important,.gradio-container-6-13-0 .md .token.bold{font-weight:700}.gradio-container-6-13-0 .md .token.italic{font-style:italic}.gradio-container-6-13-0 .md .token.entity{cursor:help}.dark .md .token.comment,.dark .md .token.prolog,.dark .md .token.cdata{color:#5c6370}.dark .md .token.doctype,.dark .md .token.punctuation,.dark .md .token.entity{color:#abb2bf}.dark .md .token.attr-name,.dark .md .token.class-name,.dark .md .token.boolean,.dark .md .token.constant,.dark .md .token.number,.dark .md .token.atrule{color:#d19a66}.dark .md .token.keyword{color:#c678dd}.dark .md .token.property,.dark .md .token.tag,.dark .md .token.symbol,.dark .md .token.deleted,.dark .md .token.important{color:#e06c75}.dark .md .token.selector,.dark .md .token.string,.dark .md .token.char,.dark .md .token.builtin,.dark .md .token.inserted,.dark .md .token.regex,.dark .md .token.attr-value,.dark .md .token.attr-value>.token.punctuation{color:#98c379}.dark .md .token.variable,.dark .md .token.operator,.dark .md .token.function{color:#61afef}.dark .md .token.url{color:#56b6c2}span.svelte-1hf8a14 div[class*=code_wrap]{position:relative}span.svelte-1hf8a14 span.katex{font-size:var(--text-lg);direction:ltr}span.svelte-1hf8a14 div[class*=code_wrap]>button{z-index:1;cursor:pointer;border-bottom-left-radius:var(--radius-sm);padding:var(--spacing-md);width:25px;height:25px;position:absolute;right:0}span.svelte-1hf8a14 .check{opacity:0;z-index:var(--layer-top);transition:opacity .2s;background:var(--code-background-fill);color:var(--body-text-color);position:absolute;top:var(--size-1-5);left:var(--size-1-5)}span.svelte-1hf8a14 p:not(:first-child){margin-top:var(--spacing-xxl)}span.svelte-1hf8a14 .md-header-anchor{margin-left:-25px;padding-right:8px;line-height:1;color:var(--body-text-color-subdued);opacity:0}span.svelte-1hf8a14 h1:hover .md-header-anchor,span.svelte-1hf8a14 h2:hover .md-header-anchor,span.svelte-1hf8a14 h3:hover .md-header-anchor,span.svelte-1hf8a14 h4:hover .md-header-anchor,span.svelte-1hf8a14 h5:hover .md-header-anchor,span.svelte-1hf8a14 h6:hover .md-header-anchor{opacity:1}span.md.svelte-1hf8a14 .md-header-anchor>svg{color:var(--body-text-color-subdued)}span.svelte-1hf8a14 table{word-break:break-word} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MarkdownCode-B8HQ3LiU.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MarkdownCode-B8HQ3LiU.js new file mode 100644 index 0000000000000000000000000000000000000000..eec9357a747aeccd3aa73cabdb7c7457c5ec3cd6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MarkdownCode-B8HQ3LiU.js @@ -0,0 +1,66 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./katex-CS_DgrDy.css","./auto-render-NRfUkSas.js","./katex-XbL3y5x-.js","./mermaid.core-7TB2QPZo.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./i18n-Dnhn5Rxr.js","./i18n-9kYrHpuJ.css","./step-B-Gbak1k.js","./dispatch-kxCwF96_.js","./select-BigU4G0v.js"])))=>i.map(i=>d[i]); +import{R as Ye,y as Ke,t as Ve,a as je,T as We,W as Qe,w as Je,a5 as et,V as tt,Y as nt,af as M,M as rt}from"./index-DWyDLubb.js";import{p as B,d as st,b as ut}from"./i18n-Dnhn5Rxr.js";import{h as it}from"./html-Ih_5QVTo.js";import{p as K}from"./prism-python-B4lzO_Nz.js";import{A as at}from"./index-B_pwUImq.js";function W(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let I=W();function _e(i){I=i}const Te=/[&<>"']/,ot=new RegExp(Te.source,"g"),ye=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,lt=new RegExp(ye.source,"g"),ct={"&":"&","<":"<",">":">",'"':""","'":"'"},ue=i=>ct[i];function A(i,e){if(e){if(Te.test(i))return i.replace(ot,ue)}else if(ye.test(i))return i.replace(lt,ue);return i}const pt=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function dt(i){return i.replace(pt,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Dt=/(^|[^\[])\^/g;function f(i,e){let t=typeof i=="string"?i:i.source;e=e||"";const n={replace:(s,u)=>{let r=typeof u=="string"?u:u.source;return r=r.replace(Dt,"$1"),t=t.replace(s,r),n},getRegex:()=>new RegExp(t,e)};return n}function ie(i){try{i=encodeURI(i).replace(/%25/g,"%")}catch{return null}return i}const v={exec:()=>null};function ae(i,e){const t=i.replace(/\|/g,(u,r,a)=>{let o=!1,c=r;for(;--c>=0&&a[c]==="\\";)o=!o;return o?"|":" |"}),n=t.split(/ \|/);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length{const u=s.match(/^\s+/);if(u===null)return s;const[r]=u;return r.length>=n.length?s.slice(n.length):s}).join(` +`)}class q{options;rules;lexer;constructor(e){this.options=e||I}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:U(n,` +`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],s=ft(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const s=U(n,"#");(this.options.pedantic||!s||/ $/.test(s))&&(n=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,` + $1`);n=U(n.replace(/^ *>[ \t]?/gm,""),` +`);const s=this.lexer.state.top;this.lexer.state.top=!0;const u=this.lexer.blockTokens(n);return this.lexer.state.top=s,{type:"blockquote",raw:t[0],tokens:u,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,u={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const r=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let a="",o="",c=!1;for(;e;){let l=!1;if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;a=t[0],e=e.substring(a.length);let d=t[2].split(` +`,1)[0].replace(/^\t+/,y=>" ".repeat(3*y.length)),p=e.split(` +`,1)[0],D=0;this.options.pedantic?(D=2,o=d.trimStart()):(D=t[2].search(/[^ ]/),D=D>4?1:D,o=d.slice(D),D+=t[1].length);let m=!1;if(!d&&/^ *$/.test(p)&&(a+=p+` +`,e=e.substring(p.length+1),l=!0),!l){const y=new RegExp(`^ {0,${Math.min(3,D-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),k=new RegExp(`^ {0,${Math.min(3,D-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),S=new RegExp(`^ {0,${Math.min(3,D-1)}}(?:\`\`\`|~~~)`),L=new RegExp(`^ {0,${Math.min(3,D-1)}}#`);for(;e;){const N=e.split(` +`,1)[0];if(p=N,this.options.pedantic&&(p=p.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),S.test(p)||L.test(p)||y.test(p)||k.test(e))break;if(p.search(/[^ ]/)>=D||!p.trim())o+=` +`+p.slice(D);else{if(m||d.search(/[^ ]/)>=4||S.test(d)||L.test(d)||k.test(d))break;o+=` +`+p}!m&&!p.trim()&&(m=!0),a+=N+` +`,e=e.substring(N.length+1),d=p.slice(D)}}u.loose||(c?u.loose=!0:/\n *\n *$/.test(a)&&(c=!0));let E=null,x;this.options.gfm&&(E=/^\[[ xX]\] /.exec(o),E&&(x=E[0]!=="[ ] ",o=o.replace(/^\[[ xX]\] +/,""))),u.items.push({type:"list_item",raw:a,task:!!E,checked:x,loose:!1,text:o,tokens:[]}),u.raw+=a}u.items[u.items.length-1].raw=a.trimEnd(),u.items[u.items.length-1].text=o.trimEnd(),u.raw=u.raw.trimEnd();for(let l=0;lD.type==="space"),p=d.length>0&&d.some(D=>/\n.*\n/.test(D.raw));u.loose=p}if(u.loose)for(let l=0;l$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",u=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:u}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=ae(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),u=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(` +`):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(const a of s)/^ *-+: *$/.test(a)?r.align.push("right"):/^ *:-+: *$/.test(a)?r.align.push("center"):/^ *:-+ *$/.test(a)?r.align.push("left"):r.align.push(null);for(const a of n)r.header.push({text:a,tokens:this.lexer.inline(a)});for(const a of u)r.rows.push(ae(a,r.header.length).map(o=>({text:o,tokens:this.lexer.inline(o)})));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===` +`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:A(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^$/.test(n))return;const r=U(n.slice(0,-1),"\\");if((n.length-r.length)%2===0)return}else{const r=ht(t[2],"()");if(r>-1){const o=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let s=t[2],u="";if(this.options.pedantic){const r=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);r&&(s=r[1],u=r[3])}else u=t[3]?t[3].slice(1,-1):"";return s=s.trim(),/^$/.test(n)?s=s.slice(1):s=s.slice(1,-1)),oe(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:u&&u.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const s=(n[2]||n[1]).replace(/\s+/g," "),u=t[s.toLowerCase()];if(!u){const r=n[0].charAt(0);return{type:"text",raw:r,text:r}}return oe(n,u,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const r=[...s[0]].length-1;let a,o,c=r,l=0;const d=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+r);(s=d.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(o=[...a].length,s[3]||s[4]){c+=o;continue}else if((s[5]||s[6])&&r%3&&!((r+o)%3)){l+=o;continue}if(c-=o,c>0)continue;o=Math.min(o,o+c+l);const p=[...s[0]][0].length,D=e.slice(0,r+s.index+p+o);if(Math.min(r,o)%2){const E=D.slice(1,-1);return{type:"em",raw:D,text:E,tokens:this.lexer.inlineTokens(E)}}const m=D.slice(2,-2);return{type:"strong",raw:D,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const s=/[^ ]/.test(n),u=/^ /.test(n)&&/ $/.test(n);return s&&u&&(n=n.substring(1,n.length-1)),n=A(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=A(t[1]),s="mailto:"+n):(n=A(t[1]),s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=A(t[0]),s="mailto:"+n;else{let u;do u=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(u!==t[0]);n=A(t[0]),t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=A(t[0]),{type:"text",raw:t[0],text:n}}}}const gt=/^(?: *(?:\n|$))+/,Et=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Ft=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,z=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,bt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Se=/(?:[*+-]|\d{1,9}[.)])/,Be=f(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Se).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),Q=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,mt=/^[^\n]+/,J=/(?!\s*\])(?:\\.|[^\[\]\\])+/,At=f(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",J).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),kt=f(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Se).getRegex(),Y="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ee=/|$))/,Ct=f("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",ee).replace("tag",Y).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Re=f(Q).replace("hr",z).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Y).getRegex(),wt=f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Re).getRegex(),te={blockquote:wt,code:Et,def:At,fences:Ft,heading:bt,hr:z,html:Ct,lheading:Be,list:kt,newline:gt,paragraph:Re,table:v,text:mt},le=f("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",z).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Y).getRegex(),xt={...te,table:le,paragraph:f(Q).replace("hr",z).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",le).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Y).getRegex()},_t={...te,html:f(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ee).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:v,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:f(Q).replace("hr",z).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",Be).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ie=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Tt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Oe=/^( {2,}|\\)\n(?!\s*$)/,yt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,Rt=f(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,P).getRegex(),It=f("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,P).getRegex(),Ot=f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,P).getRegex(),Lt=f(/\\([punct])/,"gu").replace(/punct/g,P).getRegex(),Nt=f(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),$t=f(ee).replace("(?:-->|$)","-->").getRegex(),vt=f("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",$t).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Z=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,zt=f(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Z).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Le=f(/^!?\[(label)\]\[(ref)\]/).replace("label",Z).replace("ref",J).getRegex(),Ne=f(/^!?\[(ref)\](?:\[\])?/).replace("ref",J).getRegex(),Pt=f("reflink|nolink(?!\\()","g").replace("reflink",Le).replace("nolink",Ne).getRegex(),ne={_backpedal:v,anyPunctuation:Lt,autolink:Nt,blockSkip:Bt,br:Oe,code:Tt,del:v,emStrongLDelim:Rt,emStrongRDelimAst:It,emStrongRDelimUnd:Ot,escape:Ie,link:zt,nolink:Ne,punctuation:St,reflink:Le,reflinkSearch:Pt,tag:vt,text:yt,url:v},Mt={...ne,link:f(/^!?\[(label)\]\((.*?)\)/).replace("label",Z).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Z).getRegex()},j={...ne,escape:f(Ie).replace("])","~|])").getRegex(),url:f(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\o+" ".repeat(c.length));let n,s,u,r;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=` +`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=` +`+n.raw,s.text+=` +`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=` +`+n.raw,s.text+=` +`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(u=e,this.options.extensions&&this.options.extensions.startBlock){let a=1/0;const o=e.slice(1);let c;this.options.extensions.startBlock.forEach(l=>{c=l.call({lexer:this},o),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),a<1/0&&a>=0&&(u=e.substring(0,a+1))}if(this.state.top&&(n=this.tokenizer.paragraph(u))){s=t[t.length-1],r&&s.type==="paragraph"?(s.raw+=` +`+n.raw,s.text+=` +`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n),r=u.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&s.type==="text"?(s.raw+=` +`+n.raw,s.text+=` +`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,s,u,r=e,a,o,c;if(this.tokens.links){const l=Object.keys(this.tokens.links);if(l.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,a.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(o||(c=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(l=>(n=l.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&n.type==="text"&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),s=t[t.length-1],s&&n.type==="text"&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,r,c)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(u=e,this.options.extensions&&this.options.extensions.startInline){let l=1/0;const d=e.slice(1);let p;this.options.extensions.startInline.forEach(D=>{p=D.call({lexer:this},d),typeof p=="number"&&p>=0&&(l=Math.min(l,p))}),l<1/0&&l>=0&&(u=e.substring(0,l+1))}if(n=this.tokenizer.inlineText(u)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(c=n.raw.slice(-1)),o=!0,s=t[t.length-1],s&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return t}}class X{options;constructor(e){this.options=e||I}code(e,t,n){const s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+` +`,s?'
          '+(n?e:A(e,!0))+`
          +`:"
          "+(n?e:A(e,!0))+`
          +`}blockquote(e){return`
          +${e}
          +`}html(e,t){return e}heading(e,t,n){return`${e} +`}hr(){return`
          +`}list(e,t,n){const s=t?"ol":"ul",u=t&&n!==1?' start="'+n+'"':"";return"<"+s+u+`> +`+e+" +`}listitem(e,t,n){return`
        • ${e}
        • +`}checkbox(e){return"'}paragraph(e){return`

          ${e}

          +`}table(e,t){return t&&(t=`${t}`),` + +`+e+` +`+t+`
          +`}tablerow(e){return` +${e} +`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+` +`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return"
          "}del(e){return`${e}`}link(e,t,n){const s=ie(e);if(s===null)return n;e=s;let u='
          ",u}image(e,t,n){const s=ie(e);if(s===null)return n;e=s;let u=`${n}0&&p.tokens[0].type==="paragraph"?(p.tokens[0].text=x+" "+p.tokens[0].text,p.tokens[0].tokens&&p.tokens[0].tokens.length>0&&p.tokens[0].tokens[0].type==="text"&&(p.tokens[0].tokens[0].text=x+" "+p.tokens[0].tokens[0].text)):p.tokens.unshift({type:"text",text:x+" "}):E+=x+" "}E+=this.parse(p.tokens,c),l+=this.renderer.listitem(E,m,!!D)}n+=this.renderer.list(l,a,o);continue}case"html":{const r=u;n+=this.renderer.html(r.text,r.block);continue}case"paragraph":{const r=u;n+=this.renderer.paragraph(this.parseInline(r.tokens));continue}case"text":{let r=u,a=r.tokens?this.parseInline(r.tokens):r.text;for(;s+1{const a=u[r].flat(1/0);n=n.concat(this.walkTokens(a,t))}):u.tokens&&(n=n.concat(this.walkTokens(u.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(u=>{if(!u.name)throw new Error("extension name required");if("renderer"in u){const r=t.renderers[u.name];r?t.renderers[u.name]=function(...a){let o=u.renderer.apply(this,a);return o===!1&&(o=r.apply(this,a)),o}:t.renderers[u.name]=u.renderer}if("tokenizer"in u){if(!u.level||u.level!=="block"&&u.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=t[u.level];r?r.unshift(u.tokenizer):t[u.level]=[u.tokenizer],u.start&&(u.level==="block"?t.startBlock?t.startBlock.push(u.start):t.startBlock=[u.start]:u.level==="inline"&&(t.startInline?t.startInline.push(u.start):t.startInline=[u.start]))}"childTokens"in u&&u.childTokens&&(t.childTokens[u.name]=u.childTokens)}),s.extensions=t),n.renderer){const u=this.defaults.renderer||new X(this.defaults);for(const r in n.renderer){if(!(r in u))throw new Error(`renderer '${r}' does not exist`);if(r==="options")continue;const a=r,o=n.renderer[a],c=u[a];u[a]=(...l)=>{let d=o.apply(u,l);return d===!1&&(d=c.apply(u,l)),d||""}}s.renderer=u}if(n.tokenizer){const u=this.defaults.tokenizer||new q(this.defaults);for(const r in n.tokenizer){if(!(r in u))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const a=r,o=n.tokenizer[a],c=u[a];u[a]=(...l)=>{let d=o.apply(u,l);return d===!1&&(d=c.apply(u,l)),d}}s.tokenizer=u}if(n.hooks){const u=this.defaults.hooks||new G;for(const r in n.hooks){if(!(r in u))throw new Error(`hook '${r}' does not exist`);if(r==="options")continue;const a=r,o=n.hooks[a],c=u[a];G.passThroughHooks.has(r)?u[a]=l=>{if(this.defaults.async)return Promise.resolve(o.call(u,l)).then(p=>c.call(u,p));const d=o.call(u,l);return c.call(u,d)}:u[a]=(...l)=>{let d=o.apply(u,l);return d===!1&&(d=c.apply(u,l)),d}}s.hooks=u}if(n.walkTokens){const u=this.defaults.walkTokens,r=n.walkTokens;s.walkTokens=function(a){let o=[];return o.push(r.call(this,a)),u&&(o=o.concat(u.call(this,a))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return _.lex(e,t??this.defaults)}parser(e,t){return T.parse(e,t??this.defaults)}#e(e,t){return(n,s)=>{const u={...s},r={...this.defaults,...u};this.defaults.async===!0&&u.async===!1&&(r.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),r.async=!0);const a=this.#t(!!r.silent,!!r.async);if(typeof n>"u"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then(o=>e(o,r)).then(o=>r.hooks?r.hooks.processAllTokens(o):o).then(o=>r.walkTokens?Promise.all(this.walkTokens(o,r.walkTokens)).then(()=>o):o).then(o=>t(o,r)).then(o=>r.hooks?r.hooks.postprocess(o):o).catch(a);try{r.hooks&&(n=r.hooks.preprocess(n));let o=e(n,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let c=t(o,r);return r.hooks&&(c=r.hooks.postprocess(c)),c}catch(o){return a(o)}}}#t(e,t){return n=>{if(n.message+=` +Please report this to https://github.com/markedjs/marked.`,e){const s="

          An error occurred:

          "+A(n.message+"",!0)+"
          ";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}}const R=new $e;function h(i,e){return R.parse(i,e)}h.options=h.setOptions=function(i){return R.setOptions(i),h.defaults=R.defaults,_e(h.defaults),h};h.getDefaults=W;h.defaults=I;h.use=function(...i){return R.use(...i),h.defaults=R.defaults,_e(h.defaults),h};h.walkTokens=function(i,e){return R.walkTokens(i,e)};h.parseInline=R.parseInline;h.Parser=T;h.parser=T.parse;h.Renderer=X;h.TextRenderer=re;h.Lexer=_;h.lexer=_.lex;h.Tokenizer=q;h.Hooks=G;h.parse=h;h.options;h.setOptions;h.use;h.walkTokens;h.parseInline;T.parse;_.lex;function Ht(i){if(typeof i=="function"&&(i={highlight:i}),!i||typeof i.highlight!="function")throw new Error("Must provide highlight function");return typeof i.langPrefix!="string"&&(i.langPrefix="language-"),typeof i.emptyLangClass!="string"&&(i.emptyLangClass=""),{async:!!i.async,walkTokens(e){if(e.type!=="code")return;const t=ce(e.lang);if(i.async)return Promise.resolve(i.highlight(e.text,t,e.lang||"")).then(pe(e));const n=i.highlight(e.text,t,e.lang||"");if(n instanceof Promise)throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");pe(e)(n)},useNewRenderer:!0,renderer:{code(e,t,n){typeof e=="object"&&(n=e.escaped,t=e.lang,e=e.text);const s=ce(t),u=s?i.langPrefix+De(s):i.emptyLangClass,r=u?` class="${u}"`:"";return e=e.replace(/\n$/,""),`
          ${n?e:De(e,!0)}
          +
          `}}}}function ce(i){return(i||"").match(/\S*/)[0]}function pe(i){return e=>{typeof e=="string"&&e!==i.text&&(i.escaped=!0,i.text=e)}}const ve=/[&<>"']/,Gt=new RegExp(ve.source,"g"),ze=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,qt=new RegExp(ze.source,"g"),Zt={"&":"&","<":"<",">":">",'"':""","'":"'"},de=i=>Zt[i];function De(i,e){if(e){if(ve.test(i))return i.replace(Gt,de)}else if(ze.test(i))return i.replace(qt,de);return i}const Xt=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,Yt=Object.hasOwnProperty;class se{constructor(){this.occurrences,this.reset()}slug(e,t){const n=this;let s=Kt(e,t===!0);const u=s;for(;Yt.call(n.occurrences,s);)n.occurrences[u]++,s=u+"-"+n.occurrences[u];return n.occurrences[s]=0,s}reset(){this.occurrences=Object.create(null)}}function Kt(i,e){return typeof i!="string"?"":(e||(i=i.toLowerCase()),i.replace(Xt,"").replace(/ /g,"-"))}let Pe=new se,Me=[];function Vt({prefix:i="",globalSlugs:e=!1}={}){return{headerIds:!1,hooks:{preprocess(t){return e||jt(),t}},renderer:{heading(t,n,s){s=s.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"");const u=`${i}${Pe.slug(s)}`,r={level:n,text:t,id:u};return Me.push(r),`${t} +`}}}}function jt(){Me=[],Pe=new se}(function(i){var e=/\\(?:[^a-z()[\]]|[a-z*]+)/i,t={"equation-command":{pattern:e,alias:"regex"}};i.languages.latex={comment:/%.*/,cdata:{pattern:/(\\begin\{((?:lstlisting|verbatim)\*?)\})[\s\S]*?(?=\\end\{\2\})/,lookbehind:!0},equation:[{pattern:/\$\$(?:\\[\s\S]|[^\\$])+\$\$|\$(?:\\[\s\S]|[^\\$])+\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/,inside:t,alias:"string"},{pattern:/(\\begin\{((?:align|eqnarray|equation|gather|math|multline)\*?)\})[\s\S]*?(?=\\end\{\2\})/,lookbehind:!0,inside:t,alias:"string"}],keyword:{pattern:/(\\(?:begin|cite|documentclass|end|label|ref|usepackage)(?:\[[^\]]+\])?\{)[^}]+(?=\})/,lookbehind:!0},url:{pattern:/(\\url\{)[^}]+(?=\})/,lookbehind:!0},headline:{pattern:/(\\(?:chapter|frametitle|paragraph|part|section|subparagraph|subsection|subsubparagraph|subsubsection|subsubsubparagraph)\*?(?:\[[^\]]+\])?\{)[^}]+(?=\})/,lookbehind:!0,alias:"class-name"},function:{pattern:e,alias:"selector"},punctuation:/[[\]{}&]/},i.languages.tex=i.languages.latex,i.languages.context=i.languages.latex})(Prism);(function(i){var e="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",t={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},n={bash:t,environment:{pattern:RegExp("\\$"+e),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+e),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};i.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+e),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:n},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:t}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:n},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:n.entity}}],environment:{pattern:RegExp("\\$?"+e),alias:"constant"},variable:n.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},t.inside=i.languages.bash;for(var s=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],u=n.variable[1].inside,r=0;r>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/});Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}});Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}});Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/});delete Prism.languages.c.boolean;var he={},fe;function Wt(){return fe||(fe=1,(function(i){var e=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,t=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,function(){return e.source});i.languages.cpp=i.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return e.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:e,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),i.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,function(){return t})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),i.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:i.languages.cpp}}}}),i.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),i.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:i.languages.extend("cpp",{})}}),i.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},i.languages.cpp["base-clause"])})(Prism)),he}Wt();Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};var ge={},Ee;function Qt(){return Ee||(Ee=1,(function(i){var e=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,t=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,n={pattern:RegExp(/(^|[^\w.])/.source+t+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};i.languages.java=i.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[n,{pattern:RegExp(/(^|[^\w.])/.source+t+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:n.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+t+/[A-Z]\w*\b/.source),lookbehind:!0,inside:n.inside}],keyword:e,function:[i.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),i.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),i.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":n,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+t+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:n.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+t+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:n.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,function(){return e.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism)),ge}Qt();Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];var Fe={},be;function Jt(){return be||(be=1,(function(i){for(var e=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,t=0;t<2;t++)e=e.replace(//g,function(){return e});e=e.replace(//g,function(){return/[^\s\S]/.source}),i.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+e),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},i.languages.rust["closure-params"].inside.rest=i.languages.rust,i.languages.rust.attribute.inside.string=i.languages.rust.string})(Prism)),Fe}Jt();var me={},Ae;function en(){return Ae||(Ae=1,(function(i){var e=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,t=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],n=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,s=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,u=/[{}\[\](),:;]/;i.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:e,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:t,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:n,operator:s,punctuation:u};var r={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:i.languages.php},a=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:r}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:r}}];i.languages.insertBefore("php","variable",{string:a,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:e,string:a,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:t,number:n,operator:s,punctuation:u}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),i.hooks.add("before-tokenize",function(o){if(/<\?/.test(o.code)){var c=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;i.languages["markup-templating"].buildPlaceholders(o,"php",c)}}),i.hooks.add("after-tokenize",function(o){i.languages["markup-templating"].tokenizePlaceholders(o,"php")})})(Prism)),me}en();(function(i){var e=/[*&][^\s[\]{},]+/,t=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,n="(?:"+t.source+"(?:[ ]+"+e.source+")?|"+e.source+"(?:[ ]+"+t.source+")?)",s=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),u=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function r(a,o){o=(o||"").replace(/m/g,"")+"m";var c=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return n}).replace(/<>/g,function(){return a});return RegExp(c,o)}i.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return n})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return n}).replace(/<>/g,function(){return"(?:"+s+"|"+u+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:r(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:r(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:r(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:r(u),lookbehind:!0,greedy:!0},number:{pattern:r(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:t,important:e,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},i.languages.yml=i.languages.yaml})(Prism);(function(i){function e(t,n){return"___"+t.toUpperCase()+n+"___"}Object.defineProperties(i.languages["markup-templating"]={},{buildPlaceholders:{value:function(t,n,s,u){if(t.language===n){var r=t.tokenStack=[];t.code=t.code.replace(s,function(a){if(typeof u=="function"&&!u(a))return a;for(var o=r.length,c;t.code.indexOf(c=e(n,o))!==-1;)++o;return r[o]=a,c}),t.grammar=i.languages.markup}}},tokenizePlaceholders:{value:function(t,n){if(t.language!==n||!t.tokenStack)return;t.grammar=i.languages[n];var s=0,u=Object.keys(t.tokenStack);function r(a){for(var o=0;o=u.length);o++){var c=a[o];if(typeof c=="string"||c.content&&typeof c.content=="string"){var l=u[s],d=t.tokenStack[l],p=typeof c=="string"?c:c.content,D=e(n,l),m=p.indexOf(D);if(m>-1){++s;var E=p.substring(0,m),x=new i.Token(n,i.tokenize(d,t.grammar),"language-"+n,d),y=p.substring(m+D.length),k=[];E&&k.push.apply(k,r([E])),k.push(x),y&&k.push.apply(k,r([y])),typeof c=="string"?a.splice.apply(a,[o,1].concat(k)):c.content=k}}else c.content&&r(c.content)}return a}r(t.tokens)}}})})(Prism);const tn='',nn=` + + +`,rn=` +`,ke=``,Ue=/[&<>"']/,sn=new RegExp(Ue.source,"g"),He=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,un=new RegExp(He.source,"g"),an={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce=i=>an[i]||"";function V(i,e){if(e){if(Ue.test(i))return i.replace(sn,Ce)}else if(He.test(i))return i.replace(un,Ce);return i}function on(i){const e=i.map(t=>({start:new RegExp(t.left.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")),end:new RegExp(t.right.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))}));return{name:"latex",level:"block",start(t){for(const n of e){const s=t.match(n.start);if(s)return s.index}return-1},tokenizer(t,n){for(const s of e){const u=new RegExp(`${s.start.source}([\\s\\S]+?)${s.end.source}`).exec(t);if(u)return{type:"latex",raw:u[0],text:u[1].trim()}}},renderer(t){return`
          ${t.text}
          `}}}function ln(){return{name:"mermaid",level:"block",start(i){return i.match(/^```mermaid\s*\n/)?.index},tokenizer(i){const e=/^```mermaid\s*\n([\s\S]*?)```\s*(?:\n|$)/.exec(i);if(e)return{type:"mermaid",raw:e[0],text:e[1].trim()}},renderer(i){return`
          ${i.text}
          +`}}}const cn={code(i,e,t){const n=(e??"").match(/\S*/)?.[0]??"";return i=i.replace(/\n$/,"")+` +`,!n||n==="mermaid"?'
          '+ke+"
          "+(t?i:V(i,!0))+`
          +`:'
          '+ke+'
          '+(t?i:V(i,!0))+`
          +`}},pn=new se;function dn({header_links:i,line_breaks:e,latex_delimiters:t}){const n=new $e;n.use({gfm:!0,pedantic:!1,breaks:e},Ht({highlight:(r,a)=>K.languages?.[a]?K.highlight(r,K.languages[a],a):r}),{renderer:cn}),i&&(n.use(Vt()),n.use({extensions:[{name:"heading",level:"block",renderer(r){const a=r.raw.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,""),o="h"+pn.slug(a),c=r.depth,l=this.parser.parseInline(r.tokens);return`
          ${tn}${l} +`}}]}));const s=ln(),u=on(t);return n.use({extensions:[s,u]}),n}const Dn=(i,e=location.href)=>{try{return!!i&&new URL(i).origin!==new URL(e).origin}catch{return!1}};function we(i){const e=new at,t=new DOMParser().parseFromString(i,"text/html");return Ge(t.body,"A",n=>{n instanceof HTMLElement&&"target"in n&&Dn(n.getAttribute("href"),location.href)&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))}),e.sanitize(t).body.innerHTML}function Ge(i,e,t){i&&(i.nodeName===e||typeof e=="function")&&t(i);const n=i?.childNodes||[];for(let s=0;s!xe.includes(i))];var gn=Qe("");function Cn(i,e){Ye(e,!0);let t=B(e,"chatbot",3,!0),n=B(e,"sanitize_html",3,!0),s=B(e,"latex_delimiters",19,()=>[]),u=B(e,"render_markdown",3,!0),r=B(e,"line_breaks",3,!0),a=B(e,"header_links",3,!1),o=B(e,"allow_tags",3,!1),c=B(e,"theme_mode",3,"system"),l;const d=dn({header_links:a(),line_breaks:r(),latex_delimiters:s()||[]});let p=et(()=>e.message&&e.message.trim()?y(e.message):""),D=!1;function m(b){return!s()||s().length===0?!1:s().some(g=>b.includes(g.left)&&b.includes(g.right))}function E(b){return b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x(b,g){if(g===!0){const C=/<\/?([a-zA-Z][a-zA-Z0-9-]*)([\s>])/g;return b.replace(C,(F,w,O)=>fn.includes(w.toLowerCase())?F:F.replace(//g,">"))}if(Array.isArray(g)){const C=g.map(w=>({open:new RegExp(`<(${w})(\\s+[^>]*)?>`,"gi"),close:new RegExp(``,"gi")}));let F=b;return C.forEach(w=>{F=F.replace(w.open,O=>O.replace(//g,">")),F=F.replace(w.close,O=>O.replace(//g,">"))}),F}return b}function y(b){let g=b;if(u()){const C=[];s().forEach((F,w)=>{const O=E(F.left),qe=E(F.right),Ze=new RegExp(`${O}([\\s\\S]+?)${qe}`,"g");g=g.replace(Ze,(Xe,En)=>(C.push(Xe),`%%%LATEX_BLOCK_${C.length-1}%%%`))}),g=d.parse(g),g=g.replace(/%%%LATEX_BLOCK_(\d+)%%%/g,(F,w)=>C[parseInt(w,10)])}return o()&&(g=x(g,o())),n()&&we&&(g=we(g)),g}async function k(b){if(s().length>0&&b&&m(b))if(!D)await Promise.all([M(()=>Promise.resolve({}),__vite__mapDeps([0]),import.meta.url),M(()=>import("./auto-render-NRfUkSas.js"),__vite__mapDeps([1,2]),import.meta.url)]).then(([,{default:g}])=>{D=!0,g(l,{delimiters:s(),throwOnError:!1})});else{const{default:g}=await M(async()=>{const{default:C}=await import("./auto-render-NRfUkSas.js");return{default:C}},__vite__mapDeps([1,2]),import.meta.url);g(l,{delimiters:s(),throwOnError:!1})}if(l){const g=l.querySelectorAll(".mermaid");if(g.length>0){await rt();const{default:C}=await M(async()=>{const{default:F}=await import("./mermaid.core-7TB2QPZo.js").then(w=>w.b5);return{default:F}},__vite__mapDeps([3,4,5,6,7,8,9,10]),import.meta.url);C.initialize({startOnLoad:!1,theme:c()==="dark"?"dark":"default",securityLevel:"antiscript"}),await C.run({nodes:Array.from(g).map(F=>F)})}}}Ke(()=>{l&&document.body.contains(l)?k(e.message):console.error("Element is not in the DOM")});var S=gn();let L;var N=tt(S);it(N,()=>Je(p)),nt(S),st(S,b=>l=b,()=>l),Ve(()=>L=ut(S,1,"md svelte-1hf8a14",null,L,{chatbot:t(),prose:u()})),je(i,S),We()}export{Cn as M}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MatplotlibPlot-B9p5biLs.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MatplotlibPlot-B9p5biLs.js new file mode 100644 index 0000000000000000000000000000000000000000..5844efda86e57082cde50c20b7864c620fdae38b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MatplotlibPlot-B9p5biLs.js @@ -0,0 +1 @@ +import{a as e}from"./i18n-Dnhn5Rxr.js";import{R as o,t as r,a as p,T as d,W as v,w as m,a5 as u,V as c,Y as f}from"./index-DWyDLubb.js";var h=v('
          ');function g(s,a){o(a,!0);let i=u(()=>a.value?.plot);var t=h();e(t,"data-testid","matplotlib");var l=c(t);f(t),r(()=>{e(l,"src",m(i)),e(l,"alt",`${a.value.chart} plot visualising provided data`)}),p(s,t),d()}export{g as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MatplotlibPlot-DvS6m0KD.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MatplotlibPlot-DvS6m0KD.css new file mode 100644 index 0000000000000000000000000000000000000000..b9d4529838b238f213066e832a644f4dc6775d68 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MatplotlibPlot-DvS6m0KD.css @@ -0,0 +1 @@ +.layout.svelte-n8pych{display:flex;flex-direction:column;justify-content:center;align-items:center;width:var(--size-full);height:var(--size-full);color:var(--body-text-color)}.matplotlib.svelte-n8pych img:where(.svelte-n8pych){object-fit:contain} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Maximize-QH9NIRWs.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Maximize-QH9NIRWs.js new file mode 100644 index 0000000000000000000000000000000000000000..b0cf59266f7d17cf9dbe696a3ca5cb4bed427478 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Maximize-QH9NIRWs.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a,f as t}from"./index-DWyDLubb.js";var e=t('');function h(o){var r=e();a(o,r)}export{h as M}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MinimalAudioPlayer-COky8gQS.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MinimalAudioPlayer-COky8gQS.css new file mode 100644 index 0000000000000000000000000000000000000000..3296823b9d3dd379d3b85fc3806824f0f572bc9b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MinimalAudioPlayer-COky8gQS.css @@ -0,0 +1 @@ +.minimal-audio-player.svelte-15unlcf{display:flex;align-items:center;gap:var(--spacing-sm);border-radius:var(--radius-sm);width:var(--size-52);padding:var(--spacing-sm)}.play-btn.svelte-15unlcf{display:inline-flex;align-items:center;justify-content:center;padding:0;border:none;background:none;color:var(--body-text-color);opacity:.7;cursor:pointer;border-radius:50%;transition:all .2s ease;flex-shrink:0}.play-btn.svelte-15unlcf:hover{color:var(--color-accent);opacity:1}.play-btn.svelte-15unlcf:active{transform:scale(.95)}.play-btn.svelte-15unlcf svg:where(.svelte-15unlcf){width:var(--size-5);height:var(--size-5);display:block}.waveform-wrapper.svelte-15unlcf{flex:1 1 auto;cursor:pointer;width:auto}.waveform-wrapper.svelte-15unlcf ::part(wrapper){margin-bottom:0}.timestamp.svelte-15unlcf{font-size:13px;font-weight:500;color:var(--body-text-color);opacity:.7;font-variant-numeric:tabular-nums;flex-shrink:0;min-width:40px;text-align:center}@media(prefers-reduced-motion:reduce){.play-btn.svelte-15unlcf{transition:none}} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MinimalAudioPlayer-Cb9FZeXv.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MinimalAudioPlayer-Cb9FZeXv.js new file mode 100644 index 0000000000000000000000000000000000000000..4bf319ed5a164a3ddc57e2033e1e6200ac8b4d97 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/MinimalAudioPlayer-Cb9FZeXv.js @@ -0,0 +1,73 @@ +import{p as X,i as q,d as $,a as _}from"./i18n-Dnhn5Rxr.js";import{aj as Y,R as Z,aa as J,ae as K,V as N,w as M,Y as I,X as F,t as Q,a0 as tt,a as B,T as et,u as A,x as R,W as it,a5 as st,f as V}from"./index-DWyDLubb.js";import{f as nt}from"./utils.svelte-CCyS_0CY.js";function C(c,t,e,i){return new(e||(e=Promise))((function(s,n){function r(l){try{h(i.next(l))}catch(a){n(a)}}function o(l){try{h(i.throw(l))}catch(a){n(a)}}function h(l){var a;l.done?s(l.value):(a=l.value,a instanceof e?a:new e((function(p){p(a)}))).then(r,o)}h((i=i.apply(c,t||[])).next())}))}class W{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),i?.once){const s=(...n)=>{this.un(t,s),e(...n)};return this.listeners[t].add(s),()=>this.un(t,s)}return this.listeners[t].add(e),()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach((i=>i(...e)))}}const L={decode:function(c,t){return C(this,void 0,void 0,(function*(){const e=new AudioContext({sampleRate:t});try{return yield e.decodeAudioData(c)}finally{e.close()}}))},createBuffer:function(c,t){if(!c||c.length===0)throw new Error("channelData must be a non-empty array");if(t<=0)throw new Error("duration must be greater than 0");if(typeof c[0]=="number"&&(c=[c]),!c[0]||c[0].length===0)throw new Error("channelData must contain non-empty channel arrays");return(function(e){const i=e[0];if(i.some((s=>s>1||s<-1))){const s=i.length;let n=0;for(let r=0;rn&&(n=o)}for(const r of e)for(let o=0;oc?.[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function G(c,t){const e=t.xmlns?document.createElementNS(t.xmlns,c):document.createElement(c);for(const[i,s]of Object.entries(t))if(i==="children"&&s)for(const[n,r]of Object.entries(s))r instanceof Node?e.appendChild(r):typeof r=="string"?e.appendChild(document.createTextNode(r)):e.appendChild(G(n,r));else i==="style"?Object.assign(e.style,s):i==="textContent"?e.textContent=s:e.setAttribute(i,s.toString());return e}function H(c,t,e){const i=G(c,t||{});return e?.appendChild(i),i}var rt=Object.freeze({__proto__:null,createElement:H,default:H});const ot={fetchBlob:function(c,t,e){return C(this,void 0,void 0,(function*(){const i=yield fetch(c,e);if(i.status>=400)throw new Error(`Failed to fetch ${c}: ${i.status} (${i.statusText})`);return(function(s,n){C(this,void 0,void 0,(function*(){if(!s.body||!s.headers)return;const r=s.body.getReader(),o=Number(s.headers.get("Content-Length"))||0;let h=0,l=0;const a=d=>C(this,void 0,void 0,(function*(){h+=d?.length||0;const u=Math.round(h/o*100);n(u)})),p=()=>C(this,void 0,void 0,(function*(){if(l++>1e5)return void console.error("Fetcher: Maximum iterations reached, stopping read loop");let d;try{d=yield r.read()}catch{return}d.done||(a(d.value),yield p())}));p()}))})(i.clone(),t),i.blob()}))}};class at extends W{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",(()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)}),{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const s=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;if(i&&this.media.removeAttribute("src"),s||t)try{this.media.src=s}catch{this.media.src=t}}destroy(){this.isExternalMedia||(this.media.pause(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load(),this.media.remove())}setMediaElement(t){this.media=t}play(){return C(this,void 0,void 0,(function*(){try{return yield this.media.play()}catch(t){if(t instanceof DOMException&&t.name==="AbortError")return;throw t}}))}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}class T extends W{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.dragUnsubscribe=null,this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[s,n]=this.initHtml();i.appendChild(s),this.container=s,this.scrollContainer=n.querySelector(".scroll"),this.wrapper=n.querySelector(".wrapper"),this.canvasWrapper=n.querySelector(".canvases"),this.progressWrapper=n.querySelector(".progress"),this.cursor=n.querySelector(".cursor"),e&&n.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const i=this.wrapper.getBoundingClientRect(),s=e.clientX-i.left,n=e.clientY-i.top;return[s/i.width,n/i.height]};if(this.wrapper.addEventListener("click",(e=>{const[i,s]=t(e);this.emit("click",i,s)})),this.wrapper.addEventListener("dblclick",(e=>{const[i,s]=t(e);this.emit("dblclick",i,s)})),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",(()=>{const{scrollLeft:e,scrollWidth:i,clientWidth:s}=this.scrollContainer,n=e/i,r=(e+s)/i;this.emit("scroll",n,r,e,e+s)})),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver((()=>{e().then((()=>this.onContainerResize())).catch((()=>{}))})),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.dragUnsubscribe||(this.dragUnsubscribe=(function(t,e,i,s,n=3,r=0,o=100){if(!t)return()=>{};const h=matchMedia("(pointer: coarse)").matches;let l=()=>{};const a=p=>{if(p.button!==r)return;p.preventDefault(),p.stopPropagation();let d=p.clientX,u=p.clientY,f=!1;const w=Date.now(),v=m=>{if(m.preventDefault(),m.stopPropagation(),h&&Date.now()-wn||Math.abs(D)>n){const k=t.getBoundingClientRect(),{left:j,top:z}=k;f||(i?.(d-j,u-z),f=!0),e(P,D,E-j,x-z),d=E,u=x}},b=m=>{if(f){const E=m.clientX,x=m.clientY,P=t.getBoundingClientRect(),{left:D,top:k}=P;s?.(E-D,x-k)}l()},y=m=>{m.relatedTarget&&m.relatedTarget!==document.documentElement||b(m)},S=m=>{f&&(m.stopPropagation(),m.preventDefault())},g=m=>{f&&m.preventDefault()};document.addEventListener("pointermove",v),document.addEventListener("pointerup",b),document.addEventListener("pointerout",y),document.addEventListener("pointercancel",y),document.addEventListener("touchmove",g,{passive:!1}),document.addEventListener("click",S,{capture:!0}),l=()=>{document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",b),document.removeEventListener("pointerout",y),document.removeEventListener("pointercancel",y),document.removeEventListener("touchmove",g),setTimeout((()=>{document.removeEventListener("click",S,{capture:!0})}),10)}};return t.addEventListener("pointerdown",a),()=>{l(),t.removeEventListener("pointerdown",a)}})(this.wrapper,((t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))}),(t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}),(t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))})),this.subscriptions.push(this.dragUnsubscribe))}getHeight(t,e){var i;const s=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const n=this.parent.clientHeight||128;return e?.every((r=>!r.overlay))?n/s:n}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=` + + :host { + user-select: none; + min-width: 1px; + } + :host audio { + display: block; + width: 100%; + } + :host .scroll { + overflow-x: auto; + overflow-y: hidden; + width: 100%; + position: relative; + } + :host .noScrollbar { + scrollbar-color: transparent; + scrollbar-width: none; + } + :host .noScrollbar::-webkit-scrollbar { + display: none; + -webkit-appearance: none; + } + :host .wrapper { + position: relative; + overflow: visible; + z-index: 2; + } + :host .canvases { + min-height: ${this.getHeight(this.options.height,this.options.splitChannels)}px; + } + :host .canvases > div { + position: relative; + } + :host canvas { + display: block; + position: absolute; + top: 0; + image-rendering: pixelated; + } + :host .progress { + pointer-events: none; + position: absolute; + z-index: 2; + top: 0; + left: 0; + width: 0; + height: 100%; + overflow: hidden; + } + :host .progress > div { + position: relative; + } + :host .cursor { + pointer-events: none; + position: absolute; + z-index: 5; + top: 0; + left: 0; + height: 100%; + border-radius: 2px; + } + + +
          +
          +
          +
          +
          +
          +
          + `,[t,e]}setOptions(t){if(this.options.container!==t.container){const e=this.parentFromOptionsContainer(t.container);e.appendChild(this.container),this.parent=e}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:e}=this.scrollContainer,i=e*t;this.setScroll(i)}destroy(){var t;this.subscriptions.forEach((e=>e())),this.container.remove(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),(t=this.unsubscribeOnScroll)===null||t===void 0||t.forEach((e=>e())),this.unsubscribeOnScroll=[]}createDelay(t=10){let e,i;const s=()=>{e&&(clearTimeout(e),e=void 0),i&&(i(),i=void 0)};return this.timeouts.push(s),()=>new Promise(((n,r)=>{s(),i=r,e=setTimeout((()=>{e=void 0,i=void 0,n()}),t)}))}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length===0)return"#999";if(t.length<2)return t[0]||"";const e=document.createElement("canvas"),i=e.getContext("2d"),s=e.height*(window.devicePixelRatio||1),n=i.createLinearGradient(0,0,0,s),r=1/(t.length-1);return t.forEach(((o,h)=>{const l=h*r;n.addColorStop(l,o)})),n}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,e,i,s){const n=t[0],r=t[1]||t[0],o=n.length,{width:h,height:l}=i.canvas,a=l/2,p=this.getPixelRatio(),d=e.barWidth?e.barWidth*p:1,u=e.barGap?e.barGap*p:e.barWidth?d/2:0,f=e.barRadius||0,w=h/(d+u)/o,v=f&&"roundRect"in i?"roundRect":"rect";i.beginPath();let b=0,y=0,S=0;for(let g=0;g<=o;g++){const m=Math.round(g*w);if(m>b){const P=Math.round(y*a*s),D=P+Math.round(S*a*s)||1;let k=a-P;e.barAlign==="top"?k=0:e.barAlign==="bottom"&&(k=l-D),i[v](b*(d+u),k,d,D,f),b=m,y=0,S=0}const E=Math.abs(n[g]||0),x=Math.abs(r[g]||0);E>y&&(y=E),x>S&&(S=x)}i.fill(),i.closePath()}renderLineWaveform(t,e,i,s){const n=r=>{const o=t[r]||t[0],h=o.length,{height:l}=i.canvas,a=l/2,p=i.canvas.width/h;i.moveTo(0,a);let d=0,u=0;for(let f=0;f<=h;f++){const w=Math.round(f*p);if(w>d){const b=a+(Math.round(u*a*s)||1)*(r===0?-1:1);i.lineTo(d,b),d=w,u=0}const v=Math.abs(o[f]||0);v>u&&(u=v)}i.lineTo(d,a)};i.beginPath(),n(0),n(1),i.fill(),i.closePath()}renderWaveform(t,e,i){if(i.fillStyle=this.convertColorValues(e.waveColor),e.renderFunction)return void e.renderFunction(t,i);let s=e.barHeight||1;if(e.normalize){const n=Array.from(t[0]).reduce(((r,o)=>Math.max(r,Math.abs(o))),0);s=n?s/n:s}e.barWidth||e.barGap||e.barAlign?this.renderBarWaveform(t,e,i,s):this.renderLineWaveform(t,e,i,s)}renderSingleCanvas(t,e,i,s,n,r,o){const h=this.getPixelRatio(),l=document.createElement("canvas");l.width=Math.round(i*h),l.height=Math.round(s*h),l.style.width=`${i}px`,l.style.height=`${s}px`,l.style.left=`${Math.round(n)}px`,r.appendChild(l);const a=l.getContext("2d");if(this.renderWaveform(t,e,a),l.width>0&&l.height>0){const p=l.cloneNode(),d=p.getContext("2d");d.drawImage(l,0,0),d.globalCompositeOperation="source-in",d.fillStyle=this.convertColorValues(e.progressColor),d.fillRect(0,0,l.width,l.height),o.appendChild(p)}}renderMultiCanvas(t,e,i,s,n,r){const o=this.getPixelRatio(),{clientWidth:h}=this.scrollContainer,l=i/o;let a=Math.min(T.MAX_CANVAS_WIDTH,h,l),p={};if(e.barWidth||e.barGap){const v=e.barWidth||.5,b=v+(e.barGap||v/2);a%b!=0&&(a=Math.floor(a/b)*b)}if(a===0)return;const d=v=>{if(v<0||v>=u||p[v])return;p[v]=!0;const b=v*a;let y=Math.min(l-b,a);if(e.barWidth||e.barGap){const g=e.barWidth||.5,m=g+(e.barGap||g/2);y=Math.floor(y/m)*m}if(y<=0)return;const S=t.map((g=>{const m=Math.floor(b/l*g.length),E=Math.floor((b+y)/l*g.length);return g.slice(m,E)}));this.renderSingleCanvas(S,e,y,s,b,n,r)},u=Math.ceil(l/a);if(!this.isScrollable){for(let v=0;v1){const v=this.on("scroll",(()=>{const{scrollLeft:b}=this.scrollContainer,y=Math.floor(b/l*u);Object.keys(p).length>T.MAX_NODES&&(n.innerHTML="",r.innerHTML="",p={}),d(y-1),d(y),d(y+1)}));this.unsubscribeOnScroll.push(v)}}renderChannel(t,e,i,s){var{overlay:n}=e,r=(function(a,p){var d={};for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&p.indexOf(u)<0&&(d[u]=a[u]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(u=Object.getOwnPropertySymbols(a);f0&&(o.style.marginTop=`-${h}px`),this.canvasWrapper.style.minHeight=`${h}px`,this.canvasWrapper.appendChild(o);const l=o.cloneNode();this.progressWrapper.appendChild(l),this.renderMultiCanvas(t,r,i,h,o,l)}render(t){return C(this,void 0,void 0,(function*(){var e;this.timeouts.forEach((h=>h())),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const i=this.getPixelRatio(),s=this.scrollContainer.clientWidth,n=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=n>s;const r=this.options.fillParent&&!this.isScrollable,o=(r?s:n)*i;if(this.wrapper.style.width=r?"100%":`${n}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let h=0;h1&&h.push(t.getChannelData(1)),this.renderChannel(h,this.options,o,0)}Promise.resolve().then((()=>this.emit("rendered")))}))}reRender(){if(this.unsubscribeOnScroll.forEach((i=>i())),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:e}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:i}=this.progressWrapper.getBoundingClientRect();let s=i-e;s*=2,s=s<0?Math.floor(s):Math.ceil(s),s/=2,this.scrollContainer.scrollLeft+=s}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){const{scrollLeft:i,scrollWidth:s,clientWidth:n}=this.scrollContainer,r=t*s,o=i,h=i+n,l=n/2;if(this.isDragging)r+30>h?this.scrollContainer.scrollLeft+=30:r-30h)&&(this.scrollContainer.scrollLeft=r-(this.options.autoCenter?l:0));const a=r-i-l;e&&this.options.autoCenter&&a>0&&(this.scrollContainer.scrollLeft+=Math.min(a,10))}{const a=this.scrollContainer.scrollLeft,p=a/s,d=(a+n)/s;this.emit("scroll",p,d,a,a+n)}}renderProgress(t,e){if(isNaN(t))return;const i=100*t;this.canvasWrapper.style.clipPath=`polygon(${i}% 0%, 100% 0%, 100% 100%, ${i}% 100%)`,this.progressWrapper.style.width=`${i}%`,this.cursor.style.left=`${i}%`,this.cursor.style.transform=this.options.cursorWidth?`translateX(-${t*this.options.cursorWidth}px)`:"",this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,e)}exportImage(t,e,i){return C(this,void 0,void 0,(function*(){const s=this.canvasWrapper.querySelectorAll("canvas");if(!s.length)throw new Error("No waveform data");if(i==="dataURL"){const n=Array.from(s).map((r=>r.toDataURL(t,e)));return Promise.resolve(n)}return Promise.all(Array.from(s).map((n=>new Promise(((r,o)=>{n.toBlob((h=>{h?r(h):o(new Error("Could not export image"))}),t,e)})))))}))}}T.MAX_CANVAS_WIDTH=8e3,T.MAX_NODES=10;class lt extends W{constructor(){super(...arguments),this.animationFrameId=null,this.isRunning=!1}start(){if(this.isRunning)return;this.isRunning=!0;const t=()=>{this.isRunning&&(this.emit("tick"),this.animationFrameId=requestAnimationFrame(t))};t()}stop(){this.isRunning=!1,this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}destroy(){this.stop()}}class U extends W{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return C(this,void 0,void 0,(function*(){}))}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then((e=>{if(e.status>=400)throw new Error(`Failed to fetch ${t}: ${e.status} (${e.statusText})`);return e.arrayBuffer()})).then((e=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(e))).then((e=>{this.currentSrc===t&&(this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())}))}_play(){if(!this.paused)return;this.paused=!1,this.bufferNode&&(this.bufferNode.onended=null,this.bufferNode.disconnect()),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let t=this.playedDuration*this._playbackRate;(t>=this.duration||t<0)&&(t=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,t),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return C(this,void 0,void 0,(function*(){this.paused&&(this._play(),this.emit("play"))}))}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const e=t-this.currentTime,i=this.bufferNode;i?.stop(this.audioContext.currentTime+e),i?.addEventListener("ended",(()=>{i===this.bufferNode&&(this.bufferNode=null,this.pause())}),{once:!0})}setSinkId(t){return C(this,void 0,void 0,(function*(){return this.audioContext.setSinkId(t)}))}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const e=!this.paused;e&&this._pause(),this.playedDuration=t/this._playbackRate,e&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,e;return(t=this._duration)!==null&&t!==void 0?t:((e=this.buffer)===null||e===void 0?void 0:e.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const e=this.buffer.numberOfChannels;for(let i=0;i{this.emit("init");const{peaks:n,duration:r}=this.options;(s||n&&r)&&this.load(s,n,r).catch((o=>{console.error("WaveSurfer initial load error:",o)}))}))}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",(()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}})))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",(()=>{const t=this.updateProgress();this.emit("timeupdate",t)})),this.onMediaEvent("play",(()=>{this.emit("play"),this.timer.start()})),this.onMediaEvent("pause",(()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null})),this.onMediaEvent("emptied",(()=>{this.timer.stop(),this.stopAtPosition=null})),this.onMediaEvent("ended",(()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null})),this.onMediaEvent("seeking",(()=>{this.emit("seeking",this.getCurrentTime())})),this.onMediaEvent("error",(()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null})))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",((t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))})),this.renderer.on("dblclick",((t,e)=>{this.emit("dblclick",t,e)})),this.renderer.on("scroll",((t,e,i,s)=>{const n=this.getDuration();this.emit("scroll",t*n,e*n,i,s)})),this.renderer.on("render",(()=>{this.emit("redraw")})),this.renderer.on("rendered",(()=>{this.emit("redrawcomplete")})),this.renderer.on("dragstart",(t=>{this.emit("dragstart",t)})),this.renderer.on("dragend",(t=>{this.emit("dragend",t)})));{let t;const e=this.renderer.on("drag",(i=>{if(!this.options.interact)return;let s;this.renderer.renderProgress(i),clearTimeout(t),this.isPlaying()?s=0:this.options.dragToSeek===!0?s=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(s=this.options.dragToSeek.debounceTime),t=setTimeout((()=>{this.seekTo(i)}),s),this.emit("interaction",i*this.getDuration()),this.emit("drag",i)}));this.subscriptions.push((()=>{clearTimeout(t),e()}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach((e=>{this.registerPlugin(e)}))}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach((t=>t())),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=L.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=L.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){if(this.plugins.includes(t))return t;t._init(this),this.plugins.push(t);const e=t.once("destroy",(()=>{this.plugins=this.plugins.filter((i=>i!==t)),this.subscriptions=this.subscriptions.filter((i=>i!==e))}));return this.subscriptions.push(e),t}unregisterPlugin(t){this.plugins=this.plugins.filter((e=>e!==t)),t.destroy()}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(t,e,i,s){return C(this,void 0,void 0,(function*(){var n;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=null,!e&&!i){const o=this.options.fetchParams||{};window.AbortController&&!o.signal&&(this.abortController=new AbortController,o.signal=this.abortController.signal);const h=a=>this.emit("loading",a);e=yield ot.fetchBlob(t,h,o);const l=this.options.blobMimeType;l&&(e=new Blob([e],{type:l}))}this.setSrc(t,e);const r=yield new Promise((o=>{const h=s||this.getDuration();h?o(h):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",(()=>o(this.getDuration())),{once:!0}))}));if(!t&&!e){const o=this.getMediaElement();o instanceof U&&(o.duration=r)}if(i)this.decodedData=L.createBuffer(i,r||0);else if(e){const o=yield e.arrayBuffer();this.decodedData=yield L.decode(o,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())}))}load(t,e,i){return C(this,void 0,void 0,(function*(){try{return yield this.loadAudio(t,void 0,e,i)}catch(s){throw this.emit("error",s),s}}))}loadBlob(t,e,i){return C(this,void 0,void 0,(function*(){try{return yield this.loadAudio("",t,e,i)}catch(s){throw this.emit("error",s),s}}))}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:i=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const s=Math.min(t,this.decodedData.numberOfChannels),n=[];for(let r=0;rMath.abs(d)&&(d=f)}h.push(Math.round(d*i)/i)}n.push(h)}return n}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}play(t,e){const i=Object.create(null,{play:{get:()=>super.play}});return C(this,void 0,void 0,(function*(){t!=null&&this.setTime(t);const s=yield i.play.call(this);return e!=null&&(this.media instanceof U?this.media.stopAt(e):this.stopAtPosition=e),s}))}playPause(){return C(this,void 0,void 0,(function*(){return this.isPlaying()?this.pause():this.play()}))}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return C(this,arguments,void 0,(function*(t="image/png",e=1,i="dataURL"){return this.renderer.exportImage(t,e,i)}))}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach((e=>e.destroy())),this.subscriptions.forEach((e=>e())),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}O.BasePlugin=class extends W{constructor(c){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=c}onInit(){}_init(c){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=c,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach((c=>c())),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}},O.dom=rt;function ct(c){const t=c.numberOfChannels,e=c.length*t*2+44,i=new ArrayBuffer(e),s=new DataView(i);let n=0;const r=function(o,h,l){for(let a=0;a{const s=new AudioContext({sampleRate:i||c.sampleRate}),n=c.numberOfChannels,r=i||c.sampleRate;let o=c.length,h=0;t!=null&&e!=null&&(h=Math.round(t*r),o=Math.round(e*r)-h);const l=s.createBuffer(n,o,r);for(let a=0;a{c&&c.skip(t)},yt=(c,t)=>(t||(t=5),c/100*t||5);var dt=V(''),ut=V(''),pt=it('
          ');function Ct(c,t){Z(t,!0);let e=X(t,"loop",3,!1),i,s,n=A(!1),r=A(0),o=A(0),h=A(!1),l=st(()=>t.value.url);const a=async()=>{if(!i||!M(l)||M(h))return;s&&s.destroy();const g=getComputedStyle(document.documentElement).getPropertyValue("--color-accent")||"#ff7c00";s=O.create({container:i,height:32,waveColor:"rgba(128, 128, 128, 0.5)",progressColor:g,cursorColor:"transparent",barWidth:2,barGap:2,barRadius:2,normalize:!0,interact:!0,dragToSeek:!0,hideScrollbar:!0}),s.on("play",()=>R(n,!0)),s.on("pause",()=>R(n,!1)),s.on("ready",()=>{R(r,s?.getDuration()||0,!0),R(h,!0)}),s.on("audioprocess",()=>{R(o,s?.getCurrentTime()||0,!0)}),s.on("interaction",()=>{R(o,s?.getCurrentTime()||0,!0)}),s.on("finish",()=>{R(n,!1),e()&&s?.play()}),await s.load(M(l))};J(async()=>{await a()}),K(()=>{s&&s.destroy()});const p=()=>{s&&s.playPause()};var d=pt(),u=N(d);u.__click=p;var f=N(u);{var w=g=>{var m=dt();B(g,m)},v=g=>{var m=ut();B(g,m)};q(f,g=>{M(n)?g(w):g(v,!1)})}I(u);var b=F(u,2);$(b,g=>i=g,()=>i);var y=F(b,2),S=N(y,!0);I(y),I(d),Q((g,m)=>{_(d,"aria-label",t.label||"Audio"),_(d,"data-testid",g),_(u,"aria-label",M(n)?"Pause":"Play"),tt(S,m)},[()=>t.label&&typeof t.label=="string"&&t.label.trim()?"waveform-"+t.label:"unlabelled-audio",()=>nt(M(n)?M(o):M(r))]),B(c,d),et()}Y(["click"]);export{Ct as M,yt as g,vt as p,bt as s,O as u}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Model3D-CvGLqGnb.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Model3D-CvGLqGnb.css new file mode 100644 index 0000000000000000000000000000000000000000..3caa3bbec62f5f6d91894d4cbe5adf6f75115382 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Model3D-CvGLqGnb.css @@ -0,0 +1 @@ +.model3D.svelte-pnaihf{display:flex;position:relative;width:var(--size-full);height:var(--size-full);border-radius:var(--block-radius);overflow:hidden}.model3D.svelte-pnaihf canvas{width:var(--size-full);height:var(--size-full);object-fit:contain;overflow:hidden} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Model3D-HY69ejZB.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Model3D-HY69ejZB.js new file mode 100644 index 0000000000000000000000000000000000000000..916b083aa2e8fb022667334da90066ef25abb189 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Model3D-HY69ejZB.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Canvas3D-DomR9yf1.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./i18n-Dnhn5Rxr.js","./i18n-9kYrHpuJ.css","./Canvas3DGS-DEcXVidd.js"])))=>i.map(i=>d[i]); +import{R as ee,u as c,v as ae,y as L,x as f,w as a,S as w,a as p,T as te,af as R,a5 as y,X as I,W as k,V as S,Y as T,t as oe,a6 as U}from"./index-DWyDLubb.js";import{p as n,i as z,a as C,d as re}from"./i18n-Dnhn5Rxr.js";import{I as V,c as A}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as ne}from"./BlockLabel-CZd21Hkw.js";import{D as le}from"./Download-Di2PsS6O.js";import{F as se}from"./File-BHHIF0P7.js";import{U as de}from"./Undo-C2-jWGVL.js";import{I as _e}from"./IconButtonWrapper-D0s9l4wW.js";import{d as ie}from"./index-tFQomdd2.js";import"./snippet-BWgYNF9D.js";var ue=k(" ",1),me=k('
          '),ve=k(" ",1);function ze(F,e){ee(e,!0);let G=n(e,"display_mode",3,"solid"),O=n(e,"clear_color",19,()=>[0,0,0,0]),q=n(e,"label",3,""),l=n(e,"zoom_speed",3,1),s=n(e,"pan_speed",3,1),u=n(e,"camera_position",19,()=>[null,null,null]),M=n(e,"has_change_history",3,!1),g=c(ae({camera_position:u(),zoom_speed:l(),pan_speed:s()})),h=c(!1),B=c(void 0),E=c(void 0),b=c(void 0);async function X(){return(await R(()=>import("./Canvas3D-DomR9yf1.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url)).default}async function Y(){return(await R(()=>import("./Canvas3DGS-DEcXVidd.js"),__vite__mapDeps([5,3,1,2,4]),import.meta.url)).default}L(()=>{e.value&&(f(h,e.value.path.endsWith(".splat")||e.value.path.endsWith(".ply"),!0),a(h)?Y().then(t=>{f(B,t,!0)}):X().then(t=>{f(E,t,!0)}))});function j(){a(b)?.reset_camera_position()}L(()=>{(!ie(a(g).camera_position,u())||a(g).zoom_speed!==l()||a(g).pan_speed!==s())&&(a(b)?.update_camera(u(),l(),s()),f(g,{camera_position:u(),zoom_speed:l(),pan_speed:s()},!0))});var P=ve(),W=w(P);{let t=y(()=>q()||e.i18n("3D_model.3d_model"));ne(W,{get show_label(){return e.show_label},get Icon(){return se},get label(){return a(t)}})}var H=I(W,2);{var J=t=>{var D=me(),x=S(D);_e(x,{children:(o,d)=>{var _=ue(),i=w(_);{var m=v=>{{let $=y(()=>!M());V(v,{get Icon(){return de},label:"Undo",onclick:()=>j(),get disabled(){return a($)}})}};z(i,v=>{a(h)||v(m)})}var r=I(i,2);C(r,"target",window.__is_colab__?"_blank":null);var Z=S(r);{let v=y(()=>e.i18n("common.download"));V(Z,{get Icon(){return le},get label(){return a(v)}})}T(r),oe(()=>{C(r,"href",e.value.url),C(r,"download",window.__is_colab__?null:e.value.orig_name||e.value.path)}),p(o,_)},$$slots:{default:!0}});var K=I(x,2);{var N=o=>{var d=U(),_=w(d);A(_,()=>a(B),(i,m)=>{m(i,{get value(){return e.value},get zoom_speed(){return l()},get pan_speed(){return s()}})}),p(o,d)},Q=o=>{var d=U(),_=w(d);A(_,()=>a(E),(i,m)=>{re(m(i,{get value(){return e.value},get display_mode(){return G()},get clear_color(){return O()},get camera_position(){return u()},get zoom_speed(){return l()},get pan_speed(){return s()}}),r=>f(b,r,!0),()=>a(b))}),p(o,d)};z(K,o=>{a(h)?o(N):o(Q,!1)})}T(D),p(t,D)};z(H,t=>{e.value&&t(J)})}p(F,P),te()}export{ze as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ModifyUpload-CIJNunwR.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ModifyUpload-CIJNunwR.js new file mode 100644 index 0000000000000000000000000000000000000000..43d72f542b4c7f12e83e00fa825ee9f0363a977c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ModifyUpload-CIJNunwR.js @@ -0,0 +1 @@ +import{p as d,i as a}from"./i18n-Dnhn5Rxr.js";import{R as E,S as _,X as t,w as n,a as b,a5 as l,a6 as M,T as W,W as x}from"./index-DWyDLubb.js";import{s as y}from"./snippet-BWgYNF9D.js";import{I as i}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{D as L}from"./DownloadLink-TGTaev7f.js";import{C as R}from"./Clear-BF6j078A.js";import{D as S}from"./Download-Di2PsS6O.js";import{E as T}from"./Edit-D-unDhOb.js";import{U as X}from"./Undo-C2-jWGVL.js";import{I as j}from"./IconButtonWrapper-D0s9l4wW.js";var q=x(" ",1);function Y(h,e){E(e,!0);let I=d(e,"editable",3,!1),w=d(e,"undoable",3,!1),m=d(e,"download",3,null);j(h,{children:(k,z)=>{var c=q(),f=_(c);{var p=o=>{{let r=l(()=>e.i18n("common.edit"));i(o,{get Icon(){return T},get label(){return n(r)},onclick:()=>e.onedit?.()})}};a(f,o=>{I()&&o(p)})}var s=t(f,2);{var D=o=>{{let r=l(()=>e.i18n("common.undo"));i(o,{get Icon(){return X},get label(){return n(r)},onclick:()=>e.onundo?.()})}};a(s,o=>{w()&&o(D)})}var u=t(s,2);{var P=o=>{L(o,{get href(){return m()},download:!0,children:(r,v)=>{{let C=l(()=>e.i18n("common.download"));i(r,{get Icon(){return S},get label(){return n(C)}})}},$$slots:{default:!0}})};a(u,o=>{m()&&o(P)})}var g=t(u,2);{var U=o=>{var r=M(),v=_(r);y(v,()=>e.children),b(o,r)};a(g,o=>{e.children&&o(U)})}var B=t(g,2);{let o=l(()=>e.i18n("common.clear"));i(B,{get Icon(){return R},get label(){return n(o)},onclick:r=>{e.onclear?.(),r.stopPropagation()}})}b(k,c)},$$slots:{default:!0}}),W()}export{Y as M}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Music-BQN2qTdy.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Music-BQN2qTdy.js new file mode 100644 index 0000000000000000000000000000000000000000..c083041bb0dae283622a5b04621c3dfb9e70c800 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Music-BQN2qTdy.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as o,f as t}from"./index-DWyDLubb.js";var c=t('');function a(r){var e=c();o(r,e)}export{a as M}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Play-BxqeM8KI.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Play-BxqeM8KI.js new file mode 100644 index 0000000000000000000000000000000000000000..577c266e435596056712048aa55381731958ffd0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Play-BxqeM8KI.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as t,f as n}from"./index-DWyDLubb.js";var s=n('');function l(o){var r=s();t(o,r)}export{l as P}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Plot-DfljBR3n.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Plot-DfljBR3n.js new file mode 100644 index 0000000000000000000000000000000000000000..fc1e6af109a24f8440df82b782be8a79ac003f4c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Plot-DfljBR3n.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./PlotlyPlot-Dg2-NYRI.js","./i18n-Dnhn5Rxr.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./i18n-9kYrHpuJ.css","./BokehPlot-BBQZH3vU.js","./BokehPlot-DTqQzqHn.css","./MatplotlibPlot-B9p5biLs.js","./MatplotlibPlot-DvS6m0KD.css","./AltairPlot-Cj80tEjo.js","./color-DNxsOKs1.js","./mollweide-XXUPULVr.js","./ordinal-BeghXfj9.js","./init-Dmth1JHB.js","./linear-8mDBZVC7.js","./step-B-Gbak1k.js","./defaultLocale-CzDG__Ur.js","./time-BMaLdJ6b.js","./dispatch-kxCwF96_.js","./range-OtVwhkKS.js","./index-BU4IRnz1.js","./colors-Cc3OSVma.js","./dsv-DB8NKgIY.js","./arc-Bt_eNeYl.js","./AltairPlot-Dp2S7wtT.css"])))=>i.map(i=>d[i]); +import{a as n,f as M,R as O,y as R,z as A,x as a,w as r,a6 as f,S as d,T as V,u as i,af as c}from"./index-DWyDLubb.js";import{i as D}from"./i18n-Dnhn5Rxr.js";import{k as I}from"./key-Xd_8JrI4.js";import{c as z}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{b as S}from"./misc-vsnLZ-Y1.js";import{E as j}from"./Empty-BIB2W5at.js";var H=M('');function B(s){var e=H();n(s,e)}function Y(s,e){O(e,!0);let l=i(null),v=i(!1),_=i(0);const g={plotly:()=>c(()=>import("./PlotlyPlot-Dg2-NYRI.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),bokeh:()=>c(()=>import("./BokehPlot-BBQZH3vU.js"),__vite__mapDeps([5,1,2,3,4,6]),import.meta.url),matplotlib:()=>c(()=>import("./MatplotlibPlot-B9p5biLs.js"),__vite__mapDeps([7,1,2,3,4,8]),import.meta.url),altair:()=>c(()=>import("./AltairPlot-Cj80tEjo.js"),__vite__mapDeps([9,1,2,3,4,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),import.meta.url)};let u={};const w=typeof window<"u";let p=i(null);R(()=>{let t=e.value?.type;A(()=>{a(_,r(_)+1),t!==r(p)&&a(l,null),t&&t in g&&w&&(u[t]?a(l,u[t],!0):g[t]().then(o=>{a(l,o.default,!0),u[t]=r(l)})),a(p,t,!0)}),e.on_change()});var h=f(),x=d(h);{var P=t=>{var o=f(),y=d(o);I(y,()=>r(_),E=>{var b=f(),T=d(b);z(T,()=>r(l),(C,L)=>{L(C,{get value(){return e.value},colors:[],get theme_mode(){return e.theme_mode},get show_label(){return e.show_label},get caption(){return e.caption},get bokeh_version(){return e.bokeh_version},get show_actions_button(){return e.show_actions_button},get _selectable(){return e._selectable},get x_lim(){return e.x_lim},get loaded_plotly_css(){return r(v)},set loaded_plotly_css(m){a(v,m,!0)},$$events:{select(m){S.call(this,e,m)}}})}),n(E,b)}),n(t,o)},k=t=>{j(t,{unpadded_box:!0,size:"large",children:(o,y)=>{B(o)},$$slots:{default:!0}})};D(x,t=>{e.value&&r(l)?t(P):t(k,!1)})}n(s,h),V()}const N=Object.freeze(Object.defineProperty({__proto__:null,default:Y},Symbol.toStringTag,{value:"Module"}));export{B as P,Y as a,N as b}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/PlotlyPlot-Dg2-NYRI.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/PlotlyPlot-Dg2-NYRI.js new file mode 100644 index 0000000000000000000000000000000000000000..b9338db5169885cb06a93cc709cf0bd91ce1e2fc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/PlotlyPlot-Dg2-NYRI.js @@ -0,0 +1,3789 @@ +import{G as UI,p as K_,e as VI,a as HI,d as qI}from"./i18n-Dnhn5Rxr.js";import{R as WI,az as GI,a1 as ZI,G as KI,a2 as YI,a as XI,T as $I,U as Y_,W as JI,w as Cg,a3 as U4,x as V4}from"./index-DWyDLubb.js";var Oy={exports:{}},QI=Oy.exports,H4;function tP(){return H4||(H4=1,(function(Ig){var n0={};(function(gd,dp){Ig.exports?Ig.exports=dp():gd.moduleName=dp()})(typeof self<"u"?self:QI,()=>{var gd=(()=>{var dp=Object.create,mp=Object.defineProperty,a0=Object.defineProperties,vd=Object.getOwnPropertyDescriptor,hm=Object.getOwnPropertyDescriptors,Dy=Object.getOwnPropertyNames,i0=Object.getOwnPropertySymbols,pm=Object.getPrototypeOf,Uu=Object.prototype.hasOwnProperty,Pg=Object.prototype.propertyIsEnumerable,X_=(K,V,u)=>V in K?mp(K,V,{enumerable:!0,configurable:!0,writable:!0,value:u}):K[V]=u,yd=(K,V)=>{for(var u in V||(V={}))Uu.call(V,u)&&X_(K,u,V[u]);if(i0)for(var u of i0(V))Pg.call(V,u)&&X_(K,u,V[u]);return K},dm=(K,V)=>a0(K,hm(V)),G4=(K,V)=>{var u={};for(var d in K)Uu.call(K,d)&&V.indexOf(d)<0&&(u[d]=K[d]);if(K!=null&&i0)for(var d of i0(K))V.indexOf(d)<0&&Pg.call(K,d)&&(u[d]=K[d]);return u},Bl=(K,V)=>()=>(K&&(V=K(K=0)),V),Vt=(K,V)=>()=>(V||K((V={exports:{}}).exports,V),V.exports),$_=(K,V)=>{for(var u in V)mp(K,u,{get:V[u],enumerable:!0})},J_=(K,V,u,d)=>{if(V&&typeof V=="object"||typeof V=="function")for(let E of Dy(V))!Uu.call(K,E)&&E!==u&&mp(K,E,{get:()=>V[E],enumerable:!(d=vd(V,E))||d.enumerable});return K},Z4=(K,V,u)=>(u=K!=null?dp(pm(K)):{},J_(mp(u,"default",{value:K,enumerable:!0}),K)),xd=K=>J_(mp({},"__esModule",{value:!0}),K),Fy=Vt(K=>{K.version="3.3.1"}),K4=Vt((K,V)=>{(function(u,d,E){d[u]=d[u]||E(),typeof V<"u"&&V.exports&&(V.exports=d[u])})("Promise",typeof window<"u"?window:K,function(){var u,d,E,A=Object.prototype.toString,t=typeof setImmediate<"u"?function(w){return setImmediate(w)}:setTimeout;try{Object.defineProperty({},"x",{}),u=function(w,l,x,y){return Object.defineProperty(w,l,{value:x,writable:!0,configurable:y!==!1})}}catch{u=function(l,x,y){return l[x]=y,l}}E=(function(){var w,l,x;function y(S,k){this.fn=S,this.self=k,this.next=void 0}return{add:function(S,k){x=new y(S,k),l?l.next=x:w=x,l=x,x=void 0},drain:function(){var S=w;for(w=l=d=void 0;S;)S.fn.call(S.self),S=S.next}}})();function e(w,l){E.add(w,l),d||(d=t(E.drain))}function r(w){var l,x=typeof w;return w!=null&&(x=="object"||x=="function")&&(l=w.then),typeof l=="function"?l:!1}function i(){for(var w=0;w0&&e(i,x))}catch(y){a.call(new f(x),y)}}}function a(w){var l=this;l.triggered||(l.triggered=!0,l.def&&(l=l.def),l.msg=w,l.state=2,l.chain.length>0&&e(i,l))}function s(w,l,x,y){for(var S=0;S{(function(){var u={version:"3.8.2"},d=[].slice,E=function(gt){return d.call(gt)},A=self.document;function t(gt){return gt&&(gt.ownerDocument||gt.document||gt).documentElement}function e(gt){return gt&&(gt.ownerDocument&>.ownerDocument.defaultView||gt.document&>||gt.defaultView)}if(A)try{E(A.documentElement.childNodes)[0].nodeType}catch{E=function(Et){for(var Xt=Et.length,fe=new Array(Xt);Xt--;)fe[Xt]=Et[Xt];return fe}}if(Date.now||(Date.now=function(){return+new Date}),A)try{A.createElement("DIV").style.setProperty("opacity",0,"")}catch{var r=this.Element.prototype,i=r.setAttribute,n=r.setAttributeNS,o=this.CSSStyleDeclaration.prototype,a=o.setProperty;r.setAttribute=function(Et,Xt){i.call(this,Et,Xt+"")},r.setAttributeNS=function(Et,Xt,fe){n.call(this,Et,Xt,fe+"")},o.setProperty=function(Et,Xt,fe){a.call(this,Et,Xt+"",fe)}}u.ascending=s;function s(gt,Et){return gtEt?1:gt>=Et?0:NaN}u.descending=function(gt,Et){return Etgt?1:Et>=gt?0:NaN},u.min=function(gt,Et){var Xt=-1,fe=gt.length,me,we;if(arguments.length===1){for(;++Xt=we){me=we;break}for(;++Xtwe&&(me=we)}else{for(;++Xt=we){me=we;break}for(;++Xtwe&&(me=we)}return me},u.max=function(gt,Et){var Xt=-1,fe=gt.length,me,we;if(arguments.length===1){for(;++Xt=we){me=we;break}for(;++Xtme&&(me=we)}else{for(;++Xt=we){me=we;break}for(;++Xtme&&(me=we)}return me},u.extent=function(gt,Et){var Xt=-1,fe=gt.length,me,we,Ve;if(arguments.length===1){for(;++Xt=we){me=Ve=we;break}for(;++Xtwe&&(me=we),Ve=we){me=Ve=we;break}for(;++Xtwe&&(me=we),Ve1)return Ve/(or-1)},u.deviation=function(){var gt=u.variance.apply(this,arguments);return gt&&Math.sqrt(gt)};function g(gt){return{left:function(Et,Xt,fe,me){for(arguments.length<3&&(fe=0),arguments.length<4&&(me=Et.length);fe>>1;gt(Et[we],Xt)<0?fe=we+1:me=we}return fe},right:function(Et,Xt,fe,me){for(arguments.length<3&&(fe=0),arguments.length<4&&(me=Et.length);fe>>1;gt(Et[we],Xt)>0?me=we:fe=we+1}return fe}}}var m=g(s);u.bisectLeft=m.left,u.bisect=u.bisectRight=m.right,u.bisector=function(gt){return g(gt.length===1?function(Et,Xt){return s(gt(Et),Xt)}:gt)},u.shuffle=function(gt,Et,Xt){(fe=arguments.length)<3&&(Xt=gt.length,fe<2&&(Et=0));for(var fe=Xt-Et,me,we;fe;)we=Math.random()*fe--|0,me=gt[fe+Et],gt[fe+Et]=gt[we+Et],gt[we+Et]=me;return gt},u.permute=function(gt,Et){for(var Xt=Et.length,fe=new Array(Xt);Xt--;)fe[Xt]=gt[Et[Xt]];return fe},u.pairs=function(gt){for(var Et=0,Xt=gt.length-1,fe,me=gt[0],we=new Array(Xt<0?0:Xt);Et=0;)for(Ve=gt[Et],Xt=Ve.length;--Xt>=0;)we[--me]=Ve[Xt];return we};var l=Math.abs;u.range=function(gt,Et,Xt){if(arguments.length<3&&(Xt=1,arguments.length<2&&(Et=gt,gt=0)),(Et-gt)/Xt===1/0)throw new Error("infinite range");var fe=[],me=x(l(Xt)),we=-1,Ve;if(gt*=me,Et*=me,Xt*=me,Xt<0)for(;(Ve=gt+Xt*++we)>Et;)fe.push(Ve/me);else for(;(Ve=gt+Xt*++we)=Et.length)return me?me.call(gt,or):fe?or.sort(fe):or;for(var Sr=-1,Wr=or.length,an=Et[Cr++],on,ta,hn,Bn=new S,Hn;++Sr=Et.length)return je;var Cr=[],Sr=Xt[or++];return je.forEach(function(Wr,an){Cr.push({key:Wr,values:Ve(an,or)})}),Sr?Cr.sort(function(Wr,an){return Sr(Wr.key,an.key)}):Cr}return gt.map=function(je,or){return we(or,je,0)},gt.entries=function(je){return Ve(we(u.map,je,0),0)},gt.key=function(je){return Et.push(je),gt},gt.sortKeys=function(je){return Xt[Et.length-1]=je,gt},gt.sortValues=function(je){return fe=je,gt},gt.rollup=function(je){return me=je,gt},gt},u.set=function(gt){var Et=new D;if(gt)for(var Xt=0,fe=gt.length;Xt=0&&(fe=gt.slice(Xt+1),gt=gt.slice(0,Xt)),gt)return arguments.length<2?this[gt].on(fe):this[gt].on(fe,Et);if(arguments.length===2){if(Et==null)for(gt in this)this.hasOwnProperty(gt)&&this[gt].on(fe,null);return this}};function G(gt){var Et=[],Xt=new S;function fe(){for(var me=Et,we=-1,Ve=me.length,je;++we=0&&(Xt=gt.slice(0,Et))!=="xmlns"&&(gt=gt.slice(Et+1)),dt.hasOwnProperty(Xt)?{space:dt[Xt],local:gt}:gt}},J.attr=function(gt,Et){if(arguments.length<2){if(typeof gt=="string"){var Xt=this.node();return gt=u.ns.qualify(gt),gt.local?Xt.getAttributeNS(gt.space,gt.local):Xt.getAttribute(gt)}for(Et in gt)this.each(Tt(Et,gt[Et]));return this}return this.each(Tt(gt,Et))};function Tt(gt,Et){gt=u.ns.qualify(gt);function Xt(){this.removeAttribute(gt)}function fe(){this.removeAttributeNS(gt.space,gt.local)}function me(){this.setAttribute(gt,Et)}function we(){this.setAttributeNS(gt.space,gt.local,Et)}function Ve(){var or=Et.apply(this,arguments);or==null?this.removeAttribute(gt):this.setAttribute(gt,or)}function je(){var or=Et.apply(this,arguments);or==null?this.removeAttributeNS(gt.space,gt.local):this.setAttributeNS(gt.space,gt.local,or)}return Et==null?gt.local?fe:Xt:typeof Et=="function"?gt.local?je:Ve:gt.local?we:me}function wt(gt){return gt.trim().replace(/\s+/g," ")}J.classed=function(gt,Et){if(arguments.length<2){if(typeof gt=="string"){var Xt=this.node(),fe=(gt=It(gt)).length,me=-1;if(Et=Xt.classList){for(;++me=0;)(we=Xt[fe])&&(me&&me!==we.nextSibling&&me.parentNode.insertBefore(we,me),me=we);return this},J.sort=function(gt){gt=Ut.apply(this,arguments);for(var Et=-1,Xt=this.length;++Et=Et&&(Et=me+1);!(or=Ve[Et])&&++Et0&&(gt=gt.slice(0,me));var Ve=We.get(gt);Ve&&(gt=Ve,we=vr);function je(){var Sr=this[fe];Sr&&(this.removeEventListener(gt,Sr,Sr.$),delete this[fe])}function or(){var Sr=we(Et,E(arguments));je.call(this),this.addEventListener(gt,this[fe]=Sr,Sr.$=Xt),Sr._=Et}function Cr(){var Sr=new RegExp("^__on([^.]+)"+u.requote(gt)+"$"),Wr;for(var an in this)if(Wr=an.match(Sr)){var on=this[an];this.removeEventListener(Wr[1],on,on.$),delete this[an]}}return me?Et?or:je:Et?j:Cr}var We=u.map({mouseenter:"mouseover",mouseleave:"mouseout"});A&&We.forEach(function(gt){"on"+gt in A&&We.remove(gt)});function qe(gt,Et){return function(Xt){var fe=u.event;u.event=Xt,Et[0]=this.__data__;try{gt.apply(this,Et)}finally{u.event=fe}}}function vr(gt,Et){var Xt=qe(gt,Et);return function(fe){var me=this,we=fe.relatedTarget;(!we||we!==me&&!(we.compareDocumentPosition(me)&8))&&Xt.call(me,fe)}}var _r,er=0;function Mr(gt){var Et=".dragsuppress-"+ ++er,Xt="click"+Et,fe=u.select(e(gt)).on("touchmove"+Et,rt).on("dragstart"+Et,rt).on("selectstart"+Et,rt);if(_r==null&&(_r="onselectstart"in gt?!1:I(gt.style,"userSelect")),_r){var me=t(gt).style,we=me[_r];me[_r]="none"}return function(Ve){if(fe.on(Et,null),_r&&(me[_r]=we),Ve){var je=function(){fe.on(Xt,null)};fe.on(Xt,function(){rt(),je()},!0),setTimeout(je,0)}}}u.mouse=function(gt){return de(gt,ct())};var Ir=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;function de(gt,Et){Et.changedTouches&&(Et=Et.changedTouches[0]);var Xt=gt.ownerSVGElement||gt;if(Xt.createSVGPoint){var fe=Xt.createSVGPoint();if(Ir<0){var me=e(gt);if(me.scrollX||me.scrollY){Xt=u.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var we=Xt[0][0].getScreenCTM();Ir=!(we.f||we.e),Xt.remove()}}return Ir?(fe.x=Et.pageX,fe.y=Et.pageY):(fe.x=Et.clientX,fe.y=Et.clientY),fe=fe.matrixTransform(gt.getScreenCTM().inverse()),[fe.x,fe.y]}var Ve=gt.getBoundingClientRect();return[Et.clientX-Ve.left-gt.clientLeft,Et.clientY-Ve.top-gt.clientTop]}u.touch=function(gt,Et,Xt){if(arguments.length<3&&(Xt=Et,Et=ct().changedTouches),Et){for(var fe=0,me=Et.length,we;fe1?Ht:gt<-1?-Ht:Math.asin(gt)}function Ue(gt){return((gt=Math.exp(gt))-1/gt)/2}function ir(gt){return((gt=Math.exp(gt))+1/gt)/2}function ar(gt){return((gt=Math.exp(2*gt))-1)/(gt+1)}var Ye=Math.SQRT2,Er=2,pn=4;u.interpolateZoom=function(gt,Et){var Xt=gt[0],fe=gt[1],me=gt[2],we=Et[0],Ve=Et[1],je=Et[2],or=we-Xt,Cr=Ve-fe,Sr=or*or+Cr*Cr,Wr,an;if(Sr<_t)an=Math.log(je/me)/Ye,Wr=function(Yn){return[Xt+Yn*or,fe+Yn*Cr,me*Math.exp(Ye*Yn*an)]};else{var on=Math.sqrt(Sr),ta=(je*je-me*me+pn*Sr)/(2*me*Er*on),hn=(je*je-me*me-pn*Sr)/(2*je*Er*on),Bn=Math.log(Math.sqrt(ta*ta+1)-ta),Hn=Math.log(Math.sqrt(hn*hn+1)-hn);an=(Hn-Bn)/Ye,Wr=function(Yn){var na=Yn*an,_n=ir(Bn),Ha=me/(Er*on)*(_n*ar(Ye*na+Bn)-Ue(Bn));return[Xt+Ha*or,fe+Ha*Cr,me*_n/ir(Ye*na+Bn)]}}return Wr.duration=an*1e3,Wr},u.behavior.zoom=function(){var gt={x:0,y:0,k:1},Et,Xt,fe,me=[960,500],we=dn,Ve=250,je=0,or="mousedown.zoom",Cr="mousemove.zoom",Sr="mouseup.zoom",Wr,an="touchstart.zoom",on,ta=st(na,"zoomstart","zoom","zoomend"),hn,Bn,Hn,Yn;Zn||(Zn="onwheel"in A?(bn=function(){return-u.event.deltaY*(u.event.deltaMode?120:1)},"wheel"):"onmousewheel"in A?(bn=function(){return u.event.wheelDelta},"mousewheel"):(bn=function(){return-u.event.detail},"MozMousePixelScroll"));function na(fi){fi.on(or,Ji).on(Zn+".zoom",pl).on("dblclick.zoom",Ns).on(an,es)}na.event=function(fi){fi.each(function(){var Ao=ta.of(this,arguments),Bo=gt;Ai?u.select(this).transition().each("start.zoom",function(){gt=this.__chart__||{x:0,y:0,k:1},zi(Ao)}).tween("zoom:zoom",function(){var Ds=me[0],Ts=me[1],lu=Xt?Xt[0]:Ds/2,ps=Xt?Xt[1]:Ts/2,zs=u.interpolateZoom([(lu-gt.x)/gt.k,(ps-gt.y)/gt.k,Ds/gt.k],[(lu-Bo.x)/Bo.k,(ps-Bo.y)/Bo.k,Ds/Bo.k]);return function(Eu){var ie=zs(Eu),nr=Ds/ie[2];this.__chart__=gt={x:lu-ie[0]*nr,y:ps-ie[1]*nr,k:nr},jo(Ao)}}).each("interrupt.zoom",function(){Ii(Ao)}).each("end.zoom",function(){Ii(Ao)}):(this.__chart__=gt,zi(Ao),jo(Ao),Ii(Ao))})},na.translate=function(fi){return arguments.length?(gt={x:+fi[0],y:+fi[1],k:gt.k},ki(),na):[gt.x,gt.y]},na.scale=function(fi){return arguments.length?(gt={x:gt.x,y:gt.y,k:null},Wa(+fi),ki(),na):gt.k},na.scaleExtent=function(fi){return arguments.length?(we=fi==null?dn:[+fi[0],+fi[1]],na):we},na.center=function(fi){return arguments.length?(fe=fi&&[+fi[0],+fi[1]],na):fe},na.size=function(fi){return arguments.length?(me=fi&&[+fi[0],+fi[1]],na):me},na.duration=function(fi){return arguments.length?(Ve=+fi,na):Ve},na.x=function(fi){return arguments.length?(Bn=fi,hn=fi.copy(),gt={x:0,y:0,k:1},na):Bn},na.y=function(fi){return arguments.length?(Yn=fi,Hn=fi.copy(),gt={x:0,y:0,k:1},na):Yn};function _n(fi){return[(fi[0]-gt.x)/gt.k,(fi[1]-gt.y)/gt.k]}function Ha(fi){return[fi[0]*gt.k+gt.x,fi[1]*gt.k+gt.y]}function Wa(fi){gt.k=Math.max(we[0],Math.min(we[1],fi))}function ri(fi,Ao){Ao=Ha(Ao),gt.x+=fi[0]-Ao[0],gt.y+=fi[1]-Ao[1]}function xi(fi,Ao,Bo,Ds){fi.__chart__={x:gt.x,y:gt.y,k:gt.k},Wa(Math.pow(2,Ds)),ri(Xt=Ao,Bo),fi=u.select(fi),Ve>0&&(fi=fi.transition().duration(Ve)),fi.call(na.event)}function ki(){Bn&&Bn.domain(hn.range().map(function(fi){return(fi-gt.x)/gt.k}).map(hn.invert)),Yn&&Yn.domain(Hn.range().map(function(fi){return(fi-gt.y)/gt.k}).map(Hn.invert))}function zi(fi){je++||fi({type:"zoomstart"})}function jo(fi){ki(),fi({type:"zoom",scale:gt.k,translate:[gt.x,gt.y]})}function Ii(fi){--je||(fi({type:"zoomend"}),Xt=null)}function Ji(){var fi=this,Ao=ta.of(fi,arguments),Bo=0,Ds=u.select(e(fi)).on(Cr,ps).on(Sr,zs),Ts=_n(u.mouse(fi)),lu=Mr(fi);Jn.call(fi),zi(Ao);function ps(){Bo=1,ri(u.mouse(fi),Ts),jo(Ao)}function zs(){Ds.on(Cr,null).on(Sr,null),lu(Bo),Ii(Ao)}}function es(){var fi=this,Ao=ta.of(fi,arguments),Bo={},Ds=0,Ts,lu=".zoom-"+u.event.changedTouches[0].identifier,ps="touchmove"+lu,zs="touchend"+lu,Eu=[],ie=u.select(fi),nr=Mr(fi);sn(),zi(Ao),ie.on(or,null).on(an,sn);function cr(){var qr=u.touches(fi);return Ts=gt.k,qr.forEach(function(Sn){Sn.identifier in Bo&&(Bo[Sn.identifier]=_n(Sn))}),qr}function sn(){var qr=u.event.target;u.select(qr).on(ps,zn).on(zs,Tn),Eu.push(qr);for(var Sn=u.event.changedTouches,sa=0,ea=Sn.length;sa1){var Va=ka[0],fa=ka[1],Un=Va[0]-fa[0],Nr=Va[1]-fa[1];Ds=Un*Un+Nr*Nr}}function zn(){var qr=u.touches(fi),Sn,sa,ea,ka;Jn.call(fi);for(var Ka=0,Va=qr.length;Ka1?1:Et,Xt=Xt<0?0:Xt>1?1:Xt,me=Xt<=.5?Xt*(1+Et):Xt+Et-Xt*Et,fe=2*Xt-me;function we(je){return je>360?je-=360:je<0&&(je+=360),je<60?fe+(me-fe)*je/60:je<180?me:je<240?fe+(me-fe)*(240-je)/60:fe}function Ve(je){return Math.round(we(je)*255)}return new Fa(Ve(gt+120),Ve(gt),Ve(gt-120))}u.hcl=Se;function Se(gt,Et,Xt){return this instanceof Se?(this.h=+gt,this.c=+Et,void(this.l=+Xt)):arguments.length<2?gt instanceof Se?new Se(gt.h,gt.c,gt.l):gt instanceof tr?Kn(gt.l,gt.a,gt.b):Kn((gt=mr((gt=u.rgb(gt)).r,gt.g,gt.b)).l,gt.a,gt.b):new Se(gt,Et,Xt)}var Re=Se.prototype=new En;Re.brighter=function(gt){return new Se(this.h,this.c,Math.min(100,this.l+zr*(arguments.length?gt:1)))},Re.darker=function(gt){return new Se(this.h,this.c,Math.max(0,this.l-zr*(arguments.length?gt:1)))},Re.rgb=function(){return Ze(this.h,this.c,this.l).rgb()};function Ze(gt,Et,Xt){return isNaN(gt)&&(gt=0),isNaN(Et)&&(Et=0),new tr(Xt,Math.cos(gt*=Yt)*Et,Math.sin(gt)*Et)}u.lab=tr;function tr(gt,Et,Xt){return this instanceof tr?(this.l=+gt,this.a=+Et,void(this.b=+Xt)):arguments.length<2?gt instanceof tr?new tr(gt.l,gt.a,gt.b):gt instanceof Se?Ze(gt.h,gt.c,gt.l):mr((gt=Fa(gt)).r,gt.g,gt.b):new tr(gt,Et,Xt)}var zr=18,tn=.95047,Yr=1,$r=1.08883,In=tr.prototype=new En;In.brighter=function(gt){return new tr(Math.min(100,this.l+zr*(arguments.length?gt:1)),this.a,this.b)},In.darker=function(gt){return new tr(Math.max(0,this.l-zr*(arguments.length?gt:1)),this.a,this.b)},In.rgb=function(){return Nn(this.l,this.a,this.b)};function Nn(gt,Et,Xt){var fe=(gt+16)/116,me=fe+Et/500,we=fe-Xt/200;return me=$n(me)*tn,fe=$n(fe)*Yr,we=$n(we)*$r,new Fa(Cn(3.2404542*me-1.5371385*fe-.4985314*we),Cn(-.969266*me+1.8760108*fe+.041556*we),Cn(.0556434*me-.2040259*fe+1.0572252*we))}function Kn(gt,Et,Xt){return gt>0?new Se(Math.atan2(Xt,Et)*se,Math.sqrt(Et*Et+Xt*Xt),gt):new Se(NaN,NaN,gt)}function $n(gt){return gt>.206893034?gt*gt*gt:(gt-4/29)/7.787037}function ia(gt){return gt>.008856?Math.pow(gt,1/3):7.787037*gt+4/29}function Cn(gt){return Math.round(255*(gt<=.00304?12.92*gt:1.055*Math.pow(gt,1/2.4)-.055))}u.rgb=Fa;function Fa(gt,Et,Xt){return this instanceof Fa?(this.r=~~gt,this.g=~~Et,void(this.b=~~Xt)):arguments.length<2?gt instanceof Fa?new Fa(gt.r,gt.g,gt.b):br(""+gt,Fa,ra):new Fa(gt,Et,Xt)}function Ga(gt){return new Fa(gt>>16,gt>>8&255,gt&255)}function ve(gt){return Ga(gt)+""}var ge=Fa.prototype=new En;ge.brighter=function(gt){gt=Math.pow(.7,arguments.length?gt:1);var Et=this.r,Xt=this.g,fe=this.b,me=30;return!Et&&!Xt&&!fe?new Fa(me,me,me):(Et&&Et>4,fe=fe>>4|fe,me=or&240,me=me>>4|me,we=or&15,we=we<<4|we):gt.length===7&&(fe=(or&16711680)>>16,me=(or&65280)>>8,we=or&255)),Et(fe,me,we))}function Tr(gt,Et,Xt){var fe=Math.min(gt/=255,Et/=255,Xt/=255),me=Math.max(gt,Et,Xt),we=me-fe,Ve,je,or=(me+fe)/2;return we?(je=or<.5?we/(me+fe):we/(2-me-fe),gt==me?Ve=(Et-Xt)/we+(Et0&&or<1?0:Ve),new gn(Ve,je,or)}function mr(gt,Et,Xt){gt=kr(gt),Et=kr(Et),Xt=kr(Xt);var fe=ia((.4124564*gt+.3575761*Et+.1804375*Xt)/tn),me=ia((.2126729*gt+.7151522*Et+.072175*Xt)/Yr),we=ia((.0193339*gt+.119192*Et+.9503041*Xt)/$r);return tr(116*me-16,500*(fe-me),200*(me-we))}function kr(gt){return(gt/=255)<=.04045?gt/12.92:Math.pow((gt+.055)/1.055,2.4)}function Ur(gt){var Et=parseFloat(gt);return gt.charAt(gt.length-1)==="%"?Math.round(Et*2.55):Et}var Or=u.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});Or.forEach(function(gt,Et){Or.set(gt,Ga(Et))});function pe(gt){return typeof gt=="function"?gt:function(){return gt}}u.functor=pe,u.xhr=Ke(B);function Ke(gt){return function(Et,Xt,fe){return arguments.length===2&&typeof Xt=="function"&&(fe=Xt,Xt=null),xr(Et,Xt,gt,fe)}}function xr(gt,Et,Xt,fe){var me={},we=u.dispatch("beforesend","progress","load","error"),Ve={},je=new XMLHttpRequest,or=null;self.XDomainRequest&&!("withCredentials"in je)&&/^(http(s)?:)?\/\//.test(gt)&&(je=new XDomainRequest),"onload"in je?je.onload=je.onerror=Cr:je.onreadystatechange=function(){je.readyState>3&&Cr()};function Cr(){var Sr=je.status,Wr;if(!Sr&&ln(je)||Sr>=200&&Sr<300||Sr===304){try{Wr=Xt.call(me,je)}catch(an){we.error.call(me,an);return}we.load.call(me,Wr)}else we.error.call(me,je)}return je.onprogress=function(Sr){var Wr=u.event;u.event=Sr;try{we.progress.call(me,je)}finally{u.event=Wr}},me.header=function(Sr,Wr){return Sr=(Sr+"").toLowerCase(),arguments.length<2?Ve[Sr]:(Wr==null?delete Ve[Sr]:Ve[Sr]=Wr+"",me)},me.mimeType=function(Sr){return arguments.length?(Et=Sr==null?null:Sr+"",me):Et},me.responseType=function(Sr){return arguments.length?(or=Sr,me):or},me.response=function(Sr){return Xt=Sr,me},["get","post"].forEach(function(Sr){me[Sr]=function(){return me.send.apply(me,[Sr].concat(E(arguments)))}}),me.send=function(Sr,Wr,an){if(arguments.length===2&&typeof Wr=="function"&&(an=Wr,Wr=null),je.open(Sr,gt,!0),Et!=null&&!("accept"in Ve)&&(Ve.accept=Et+",*/*"),je.setRequestHeader)for(var on in Ve)je.setRequestHeader(on,Ve[on]);return Et!=null&&je.overrideMimeType&&je.overrideMimeType(Et),or!=null&&(je.responseType=or),an!=null&&me.on("error",an).on("load",function(ta){an(null,ta)}),we.beforesend.call(me,je),je.send(Wr??null),me},me.abort=function(){return je.abort(),me},u.rebind(me,we,"on"),fe==null?me:me.get(Gr(fe))}function Gr(gt){return gt.length===1?function(Et,Xt){gt(Et==null?Xt:null)}:gt}function ln(gt){var Et=gt.responseType;return Et&&Et!=="text"?gt.response:gt.responseText}u.dsv=function(gt,Et){var Xt=new RegExp('["'+gt+` +]`),fe=gt.charCodeAt(0);function me(Cr,Sr,Wr){arguments.length<3&&(Wr=Sr,Sr=null);var an=xr(Cr,Et,Sr==null?we:Ve(Sr),Wr);return an.row=function(on){return arguments.length?an.response((Sr=on)==null?we:Ve(on)):Sr},an}function we(Cr){return me.parse(Cr.responseText)}function Ve(Cr){return function(Sr){return me.parse(Sr.responseText,Cr)}}me.parse=function(Cr,Sr){var Wr;return me.parseRows(Cr,function(an,on){if(Wr)return Wr(an,on-1);var ta=function(hn){for(var Bn={},Hn=an.length,Yn=0;Yn=ta)return an;if(Yn)return Yn=!1,Wr;var Ha=hn;if(Cr.charCodeAt(Ha)===34){for(var Wa=Ha;Wa++24?(isFinite(Et)&&(clearTimeout(vn),vn=setTimeout(Qa,Et)),Qr=0):(Qr=1,Oa(Qa))}u.timer.flush=function(){Ja(),wi()};function Ja(){for(var gt=Date.now(),Et=wn;Et;)gt>=Et.t&&Et.c(gt-Et.t)&&(Et.c=null),Et=Et.n;return gt}function wi(){for(var gt,Et=wn,Xt=1/0;Et;)Et.c?(Et.t=0;--je)hn.push(me[Cr[Wr[je]][2]]);for(je=+on;je1&&ke(gt[Xt[fe-2]],gt[Xt[fe-1]],gt[me])<=0;)--fe;Xt[fe++]=me}return Xt.slice(0,fe)}function Qi(gt,Et){return gt[0]-Et[0]||gt[1]-Et[1]}u.geom.polygon=function(gt){return Z(gt,Hi),gt};var Hi=u.geom.polygon.prototype=[];Hi.area=function(){for(var gt=-1,Et=this.length,Xt,fe=this[Et-1],me=0;++gtqt)je=je.L;else if(Ve=Et-li(je,Xt),Ve>qt){if(!je.R){fe=je;break}je=je.R}else{we>-qt?(fe=je.P,me=je):Ve>-qt?(fe=je,me=je.N):fe=me=je;break}var or=ts(gt);if(Po.insert(fe,or),!(!fe&&!me)){if(fe===me){is(fe),me=ts(fe.site),Po.insert(or,me),or.edge=me.edge=Is(fe.site,or.site),No(fe),No(me);return}if(!me){or.edge=Is(fe.site,or.site);return}is(fe),is(me);var Cr=fe.site,Sr=Cr.x,Wr=Cr.y,an=gt.x-Sr,on=gt.y-Wr,ta=me.site,hn=ta.x-Sr,Bn=ta.y-Wr,Hn=2*(an*Bn-on*hn),Yn=an*an+on*on,na=hn*hn+Bn*Bn,_n={x:(Bn*Yn-on*na)/Hn+Sr,y:(an*na-hn*Yn)/Hn+Wr};Bi(me.edge,Cr,ta,_n),or.edge=Is(Cr,gt,null,_n),me.edge=Is(gt,ta,null,_n),No(fe),No(me)}}function Da(gt,Et){var Xt=gt.site,fe=Xt.x,me=Xt.y,we=me-Et;if(!we)return fe;var Ve=gt.P;if(!Ve)return-1/0;Xt=Ve.site;var je=Xt.x,or=Xt.y,Cr=or-Et;if(!Cr)return je;var Sr=je-fe,Wr=1/we-1/Cr,an=Sr/Cr;return Wr?(-an+Math.sqrt(an*an-2*Wr*(Sr*Sr/(-2*Cr)-or+Cr/2+me-we/2)))/Wr+fe:(fe+je)/2}function li(gt,Et){var Xt=gt.N;if(Xt)return Da(Xt,Et);var fe=gt.site;return fe.y===Et?fe.x:1/0}function wo(gt){this.site=gt,this.edges=[]}wo.prototype.prepare=function(){for(var gt=this.edges,Et=gt.length,Xt;Et--;)Xt=gt[Et].edge,(!Xt.b||!Xt.a)&>.splice(Et,1);return gt.sort(Di),gt.length};function Ms(gt){for(var Et=gt[0][0],Xt=gt[1][0],fe=gt[0][1],me=gt[1][1],we,Ve,je,or,Cr=qo,Sr=Cr.length,Wr,an,on,ta,hn,Bn;Sr--;)if(Wr=Cr[Sr],!(!Wr||!Wr.prepare()))for(on=Wr.edges,ta=on.length,an=0;anqt||l(or-Ve)>qt)&&(on.splice(an,0,new $s(Wo(Wr.site,Bn,l(je-Et)qt?{x:Et,y:l(we-Et)qt?{x:l(Ve-me)qt?{x:Xt,y:l(we-Xt)qt?{x:l(Ve-fe)=-_t)){var on=or*or+Cr*Cr,ta=Sr*Sr+Wr*Wr,hn=(Wr*on-Cr*ta)/an,Bn=(or*ta-Sr*on)/an,Wr=Bn+je,Hn=yi.pop()||new _s;Hn.arc=gt,Hn.site=me,Hn.x=hn+Ve,Hn.y=Wr+Math.sqrt(hn*hn+Bn*Bn),Hn.cy=Wr,gt.circle=Hn;for(var Yn=null,na=uo._;na;)if(Hn.y0)){if(hn/=on,on<0){if(hn0){if(hn>an)return;hn>Wr&&(Wr=hn)}if(hn=Xt-je,!(!on&&hn<0)){if(hn/=on,on<0){if(hn>an)return;hn>Wr&&(Wr=hn)}else if(on>0){if(hn0)){if(hn/=ta,ta<0){if(hn0){if(hn>an)return;hn>Wr&&(Wr=hn)}if(hn=fe-or,!(!ta&&hn<0)){if(hn/=ta,ta<0){if(hn>an)return;hn>Wr&&(Wr=hn)}else if(ta>0){if(hn0&&(me.a={x:je+Wr*on,y:or+Wr*ta}),an<1&&(me.b={x:je+an*on,y:or+an*ta}),me}}}}}}function ii(gt){for(var Et=qi,Xt=al(gt[0][0],gt[0][1],gt[1][0],gt[1][1]),fe=Et.length,me;fe--;)me=Et[fe],(!io(me,gt)||!Xt(me)||l(me.a.x-me.b.x)=we)return;if(Sr>an){if(!fe)fe={x:ta,y:Ve};else if(fe.y>=je)return;Xt={x:ta,y:je}}else{if(!fe)fe={x:ta,y:je};else if(fe.y1)if(Sr>an){if(!fe)fe={x:(Ve-Hn)/Bn,y:Ve};else if(fe.y>=je)return;Xt={x:(je-Hn)/Bn,y:je}}else{if(!fe)fe={x:(je-Hn)/Bn,y:je};else if(fe.y=we)return;Xt={x:we,y:Bn*we+Hn}}else{if(!fe)fe={x:we,y:Bn*we+Hn};else if(fe.x=Sr&&Hn.x<=an&&Hn.y>=Wr&&Hn.y<=on?[[Sr,on],[an,on],[an,Wr],[Sr,Wr]]:[];Yn.point=or[hn]}),Cr}function je(or){return or.map(function(Cr,Sr){return{x:Math.round(fe(Cr,Sr)/qt)*qt,y:Math.round(me(Cr,Sr)/qt)*qt,i:Sr}})}return Ve.links=function(or){return xl(je(or)).edges.filter(function(Cr){return Cr.l&&Cr.r}).map(function(Cr){return{source:or[Cr.l.i],target:or[Cr.r.i]}})},Ve.triangles=function(or){var Cr=[];return xl(je(or)).cells.forEach(function(Sr,Wr){for(var an=Sr.site,on=Sr.edges.sort(Di),ta=-1,hn=on.length,Bn,Hn,Yn=on[hn-1].edge,na=Yn.l===an?Yn.r:Yn.l;++tana&&(na=Sr.x),Sr.y>_n&&(_n=Sr.y),on.push(Sr.x),ta.push(Sr.y);else for(hn=0;hnna&&(na=Ha),Wa>_n&&(_n=Wa),on.push(Ha),ta.push(Wa)}var ri=na-Hn,xi=_n-Yn;ri>xi?_n=Yn+ri:na=Hn+xi;function ki(Ii,Ji,es,pl,Ns,fi,Ao,Bo){if(!(isNaN(es)||isNaN(pl)))if(Ii.leaf){var Ds=Ii.x,Ts=Ii.y;if(Ds!=null)if(l(Ds-es)+l(Ts-pl)<.01)zi(Ii,Ji,es,pl,Ns,fi,Ao,Bo);else{var lu=Ii.point;Ii.x=Ii.y=Ii.point=null,zi(Ii,lu,Ds,Ts,Ns,fi,Ao,Bo),zi(Ii,Ji,es,pl,Ns,fi,Ao,Bo)}else Ii.x=es,Ii.y=pl,Ii.point=Ji}else zi(Ii,Ji,es,pl,Ns,fi,Ao,Bo)}function zi(Ii,Ji,es,pl,Ns,fi,Ao,Bo){var Ds=(Ns+Ao)*.5,Ts=(fi+Bo)*.5,lu=es>=Ds,ps=pl>=Ts,zs=ps<<1|lu;Ii.leaf=!1,Ii=Ii.nodes[zs]||(Ii.nodes[zs]=cs()),lu?Ns=Ds:Ao=Ds,ps?fi=Ts:Bo=Ts,ki(Ii,Ji,es,pl,Ns,fi,Ao,Bo)}var jo=cs();if(jo.add=function(Ii){ki(jo,Ii,+Wr(Ii,++hn),+an(Ii,hn),Hn,Yn,na,_n)},jo.visit=function(Ii){Gl(Ii,jo,Hn,Yn,na,_n)},jo.find=function(Ii){return Lc(jo,Ii[0],Ii[1],Hn,Yn,na,_n)},hn=-1,Et==null){for(;++hnwe||an>Ve||on=Ha,xi=Xt>=Wa,ki=xi<<1|ri,zi=ki+4;kiXt&&(we=Et.slice(Xt,we),je[Ve]?je[Ve]+=we:je[++Ve]=we),(fe=fe[0])===(me=me[0])?je[Ve]?je[Ve]+=me:je[++Ve]=me:(je[++Ve]=null,or.push({i:Ve,x:Ml(fe,me)})),Xt=bl.lastIndex;return Xt=0&&!(fe=u.interpolators[Xt](gt,Et)););return fe}u.interpolators=[function(gt,Et){var Xt=typeof Et;return(Xt==="string"?Or.has(Et.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(Et)?Al:hu:Et instanceof En?Al:Array.isArray(Et)?bs:Xt==="object"&&isNaN(Et)?_l:Ml)(gt,Et)}],u.interpolateArray=bs;function bs(gt,Et){var Xt=[],fe=[],me=gt.length,we=Et.length,Ve=Math.min(gt.length,Et.length),je;for(je=0;je=0?gt.slice(0,Et):gt,fe=Et>=0?gt.slice(Et+1):"in";return Xt=Nl.get(Xt)||Iu,fe=qu.get(fe)||B,qs(fe(Xt.apply(null,d.call(arguments,1))))};function qs(gt){return function(Et){return Et<=0?0:Et>=1?1:gt(Et)}}function sf(gt){return function(Et){return 1-gt(1-Et)}}function Oo(gt){return function(Et){return .5*(Et<.5?gt(2*Et):2-gt(2-2*Et))}}function yf(gt){return gt*gt}function os(gt){return gt*gt*gt}function Fi(gt){if(gt<=0)return 0;if(gt>=1)return 1;var Et=gt*gt,Xt=Et*gt;return 4*(gt<.5?Xt:3*(gt-Et)+Xt-.75)}function ac(gt){return function(Et){return Math.pow(Et,gt)}}function pu(gt){return 1-Math.cos(gt*Ht)}function ml(gt){return Math.pow(2,10*(gt-1))}function Cc(gt){return 1-Math.sqrt(1-gt*gt)}function Wu(gt,Et){var Xt;return arguments.length<2&&(Et=.45),arguments.length?Xt=Et/yt*Math.asin(1/gt):(gt=1,Xt=Et/4),function(fe){return 1+gt*Math.pow(2,-10*fe)*Math.sin((fe-Xt)*yt/Et)}}function mc(gt){return gt||(gt=1.70158),function(Et){return Et*Et*((gt+1)*Et-gt)}}function wl(gt){return gt<1/2.75?7.5625*gt*gt:gt<2/2.75?7.5625*(gt-=1.5/2.75)*gt+.75:gt<2.5/2.75?7.5625*(gt-=2.25/2.75)*gt+.9375:7.5625*(gt-=2.625/2.75)*gt+.984375}u.interpolateHcl=Xc;function Xc(gt,Et){gt=u.hcl(gt),Et=u.hcl(Et);var Xt=gt.h,fe=gt.c,me=gt.l,we=Et.h-Xt,Ve=Et.c-fe,je=Et.l-me;return isNaN(Ve)&&(Ve=0,fe=isNaN(fe)?Et.c:fe),isNaN(we)?(we=0,Xt=isNaN(Xt)?Et.h:Xt):we>180?we-=360:we<-180&&(we+=360),function(or){return Ze(Xt+we*or,fe+Ve*or,me+je*or)+""}}u.interpolateHsl=Bc;function Bc(gt,Et){gt=u.hsl(gt),Et=u.hsl(Et);var Xt=gt.h,fe=gt.s,me=gt.l,we=Et.h-Xt,Ve=Et.s-fe,je=Et.l-me;return isNaN(Ve)&&(Ve=0,fe=isNaN(fe)?Et.s:fe),isNaN(we)?(we=0,Xt=isNaN(Xt)?Et.h:Xt):we>180?we-=360:we<-180&&(we+=360),function(or){return ra(Xt+we*or,fe+Ve*or,me+je*or)+""}}u.interpolateLab=gc;function gc(gt,Et){gt=u.lab(gt),Et=u.lab(Et);var Xt=gt.l,fe=gt.a,me=gt.b,we=Et.l-Xt,Ve=Et.a-fe,je=Et.b-me;return function(or){return Nn(Xt+we*or,fe+Ve*or,me+je*or)+""}}u.interpolateRound=Gu;function Gu(gt,Et){return Et-=gt,function(Xt){return Math.round(gt+Et*Xt)}}u.transform=function(gt){var Et=A.createElementNS(u.ns.prefix.svg,"g");return(u.transform=function(Xt){if(Xt!=null){Et.setAttribute("transform",Xt);var fe=Et.transform.baseVal.consolidate()}return new Ic(fe?fe.matrix:Pu)})(gt)};function Ic(gt){var Et=[gt.a,gt.b],Xt=[gt.c,gt.d],fe=du(Et),me=Pc(Et,Xt),we=du(Rc(Xt,Et,-me))||0;Et[0]*Xt[1]180?Et+=360:Et-gt>180&&(gt+=360),fe.push({i:Xt.push(wu(Xt)+"rotate(",null,")")-2,x:Ml(gt,Et)})):Et&&Xt.push(wu(Xt)+"rotate("+Et+")")}function Oc(gt,Et,Xt,fe){gt!==Et?fe.push({i:Xt.push(wu(Xt)+"skewX(",null,")")-2,x:Ml(gt,Et)}):Et&&Xt.push(wu(Xt)+"skewX("+Et+")")}function Es(gt,Et,Xt,fe){if(gt[0]!==Et[0]||gt[1]!==Et[1]){var me=Xt.push(wu(Xt)+"scale(",null,",",null,")");fe.push({i:me-4,x:Ml(gt[0],Et[0])},{i:me-2,x:Ml(gt[1],Et[1])})}else(Et[0]!==1||Et[1]!==1)&&Xt.push(wu(Xt)+"scale("+Et+")")}function bc(gt,Et){var Xt=[],fe=[];return gt=u.transform(gt),Et=u.transform(Et),Tl(gt.translate,Et.translate,Xt,fe),Qu(gt.rotate,Et.rotate,Xt,fe),Oc(gt.skew,Et.skew,Xt,fe),Es(gt.scale,Et.scale,Xt,fe),gt=Et=null,function(me){for(var we=-1,Ve=fe.length,je;++we0?we=_n:(Xt.c=null,Xt.t=NaN,Xt=null,Et.end({type:"end",alpha:we=0})):_n>0&&(Et.start({type:"start",alpha:we=_n}),Xt=Qn(gt.tick)),gt):we},gt.start=function(){var _n,Ha=on.length,Wa=ta.length,ri=fe[0],xi=fe[1],ki,zi;for(_n=0;_n=0;)we.push(Sr=Cr[or]),Sr.parent=je,Sr.depth=je.depth+1;Xt&&(je.value=0),je.children=Cr}else Xt&&(je.value=+Xt.call(fe,je,je.depth)||0),delete je.children;return Tu(me,function(Wr){var an,on;gt&&(an=Wr.children)&&an.sort(gt),Xt&&(on=Wr.parent)&&(on.value+=Wr.value)}),Ve}return fe.sort=function(me){return arguments.length?(gt=me,fe):gt},fe.children=function(me){return arguments.length?(Et=me,fe):Et},fe.value=function(me){return arguments.length?(Xt=me,fe):Xt},fe.revalue=function(me){return Xt&&(ic(me,function(we){we.children&&(we.value=0)}),Tu(me,function(we){var Ve;we.children||(we.value=+Xt.call(fe,we,we.depth)||0),(Ve=we.parent)&&(Ve.value+=we.value)})),me},fe};function Ws(gt,Et){return u.rebind(gt,Et,"sort","children","value"),gt.nodes=gt,gt.links=Sf,gt}function ic(gt,Et){for(var Xt=[gt];(gt=Xt.pop())!=null;)if(Et(gt),(me=gt.children)&&(fe=me.length))for(var fe,me;--fe>=0;)Xt.push(me[fe])}function Tu(gt,Et){for(var Xt=[gt],fe=[];(gt=Xt.pop())!=null;)if(fe.push(gt),(Ve=gt.children)&&(we=Ve.length))for(var me=-1,we,Ve;++meme&&(me=je),fe.push(je)}for(Ve=0;Vefe&&(Xt=Et,fe=me);return Xt}function Du(gt){return gt.reduce(Xl,0)}function Xl(gt,Et){return gt+Et[1]}u.layout.histogram=function(){var gt=!0,Et=Number,Xt=yc,fe=$c;function me(we,Ve){for(var je=[],or=we.map(Et,this),Cr=Xt.call(this,or,Ve),Sr=fe.call(this,Cr,or,Ve),Wr,Ve=-1,an=or.length,on=Sr.length-1,ta=gt?1:1/an,hn;++Ve0)for(Ve=-1;++Ve=Cr[0]&&hn<=Cr[1]&&(Wr=je[u.bisect(Sr,hn,1,on)-1],Wr.y+=ta,Wr.push(we[Ve]));return je}return me.value=function(we){return arguments.length?(Et=we,me):Et},me.range=function(we){return arguments.length?(Xt=pe(we),me):Xt},me.bins=function(we){return arguments.length?(fe=typeof we=="number"?function(Ve){return Vs(Ve,we)}:pe(we),me):fe},me.frequency=function(we){return arguments.length?(gt=!!we,me):gt},me};function $c(gt,Et){return Vs(gt,Math.ceil(Math.log(Et.length)/Math.LN2+1))}function Vs(gt,Et){for(var Xt=-1,fe=+gt[0],me=(gt[1]-fe)/Et,we=[];++Xt<=Et;)we[Xt]=me*Xt+fe;return we}function yc(gt){return[u.min(gt),u.max(gt)]}u.layout.pack=function(){var gt=u.layout.hierarchy().sort(Yu),Et=0,Xt=[1,1],fe;function me(we,Ve){var je=gt.call(this,we,Ve),or=je[0],Cr=Xt[0],Sr=Xt[1],Wr=fe==null?Math.sqrt:typeof fe=="function"?fe:function(){return fe};if(or.x=or.y=0,Tu(or,function(on){on.r=+Wr(on.value)}),Tu(or,xc),Et){var an=Et*(fe?1:Math.max(2*or.r/Cr,2*or.r/Sr))/2;Tu(or,function(on){on.r+=an}),Tu(or,xc),Tu(or,function(on){on.r-=an})}return Vc(or,Cr/2,Sr/2,fe?1:1/Math.max(2*or.r/Cr,2*or.r/Sr)),je}return me.size=function(we){return arguments.length?(Xt=we,me):Xt},me.radius=function(we){return arguments.length?(fe=we==null||typeof we=="function"?we:+we,me):fe},me.padding=function(we){return arguments.length?(Et=+we,me):Et},Ws(me,gt)};function Yu(gt,Et){return gt.value-Et.value}function ou(gt,Et){var Xt=gt._pack_next;gt._pack_next=Et,Et._pack_prev=gt,Et._pack_next=Xt,Xt._pack_prev=Et}function tc(gt,Et){gt._pack_next=Et,Et._pack_prev=gt}function Xu(gt,Et){var Xt=Et.x-gt.x,fe=Et.y-gt.y,me=gt.r+Et.r;return .999*me*me>Xt*Xt+fe*fe}function xc(gt){if(!(Et=gt.children)||!(an=Et.length))return;var Et,Xt=1/0,fe=-1/0,me=1/0,we=-1/0,Ve,je,or,Cr,Sr,Wr,an;function on(_n){Xt=Math.min(_n.x-_n.r,Xt),fe=Math.max(_n.x+_n.r,fe),me=Math.min(_n.y-_n.r,me),we=Math.max(_n.y+_n.r,we)}if(Et.forEach(cf),Ve=Et[0],Ve.x=-Ve.r,Ve.y=0,on(Ve),an>1&&(je=Et[1],je.x=je.r,je.y=0,on(je),an>2))for(or=Et[2],su(Ve,je,or),on(or),ou(Ve,or),Ve._pack_prev=or,ou(or,je),je=Ve._pack_next,Cr=3;CrBn.x&&(Bn=Ha),Ha.depth>Hn.depth&&(Hn=Ha)});var Yn=Et(hn,Bn)/2-hn.x,na=Xt[0]/(Bn.x+Et(Bn,hn)/2+Yn),_n=Xt[1]/(Hn.depth||1);ic(on,function(Ha){Ha.x=(Ha.x+Yn)*na,Ha.y=Ha.depth*_n})}return an}function we(Sr){for(var Wr={A:null,children:[Sr]},an=[Wr],on;(on=an.pop())!=null;)for(var ta=on.children,hn,Bn=0,Hn=ta.length;Bn0&&(Cs(uc(hn,Sr,an),Sr,Ha),Hn+=Ha,Yn+=Ha),na+=hn.m,Hn+=on.m,_n+=Bn.m,Yn+=ta.m;hn&&!il(ta)&&(ta.t=hn,ta.m+=na-Yn),on&&!Au(Bn)&&(Bn.t=on,Bn.m+=Hn-_n,an=Sr)}return an}function Cr(Sr){Sr.x*=Xt[0],Sr.y=Sr.depth*Xt[1]}return me.separation=function(Sr){return arguments.length?(Et=Sr,me):Et},me.size=function(Sr){return arguments.length?(fe=(Xt=Sr)==null?Cr:null,me):fe?null:Xt},me.nodeSize=function(Sr){return arguments.length?(fe=(Xt=Sr)==null?null:Cr,me):fe?Xt:null},Ws(me,gt)};function Fu(gt,Et){return gt.parent==Et.parent?1:2}function Au(gt){var Et=gt.children;return Et.length?Et[0]:gt.t}function il(gt){var Et=gt.children,Xt;return(Xt=Et.length)?Et[Xt-1]:gt.t}function Cs(gt,Et,Xt){var fe=Xt/(Et.i-gt.i);Et.c-=fe,Et.s+=Xt,gt.c+=fe,Et.z+=Xt,Et.m+=Xt}function Mu(gt){for(var Et=0,Xt=0,fe=gt.children,me=fe.length,we;--me>=0;)we=fe[me],we.z+=Et,we.m+=Et,Et+=we.s+(Xt+=we.c)}function uc(gt,Et,Xt){return gt.a.parent===Et.parent?gt.a:Xt}u.layout.cluster=function(){var gt=u.layout.hierarchy().sort(null).value(null),Et=Fu,Xt=[1,1],fe=!1;function me(we,Ve){var je=gt.call(this,we,Ve),or=je[0],Cr,Sr=0;Tu(or,function(hn){var Bn=hn.children;Bn&&Bn.length?(hn.x=Dc(Bn),hn.y=Su(Bn)):(hn.x=Cr?Sr+=Et(hn,Cr):0,hn.y=0,Cr=hn)});var Wr=Xe(or),an=yr(or),on=Wr.x-Et(Wr,an)/2,ta=an.x+Et(an,Wr)/2;return Tu(or,fe?function(hn){hn.x=(hn.x-or.x)*Xt[0],hn.y=(or.y-hn.y)*Xt[1]}:function(hn){hn.x=(hn.x-on)/(ta-on)*Xt[0],hn.y=(1-(or.y?hn.y/or.y:1))*Xt[1]}),je}return me.separation=function(we){return arguments.length?(Et=we,me):Et},me.size=function(we){return arguments.length?(fe=(Xt=we)==null,me):fe?null:Xt},me.nodeSize=function(we){return arguments.length?(fe=(Xt=we)!=null,me):fe?Xt:null},Ws(me,gt)};function Su(gt){return 1+u.max(gt,function(Et){return Et.y})}function Dc(gt){return gt.reduce(function(Et,Xt){return Et+Xt.x},0)/gt.length}function Xe(gt){var Et=gt.children;return Et&&Et.length?Xe(Et[0]):gt}function yr(gt){var Et=gt.children,Xt;return Et&&(Xt=Et.length)?yr(Et[Xt-1]):gt}u.layout.treemap=function(){var gt=u.layout.hierarchy(),Et=Math.round,Xt=[1,1],fe=null,me=Kr,we=!1,Ve,je="squarify",or=.5*(1+Math.sqrt(5));function Cr(hn,Bn){for(var Hn=-1,Yn=hn.length,na,_n;++Hn0;)Yn.push(_n=na[xi-1]),Yn.area+=_n.area,je!=="squarify"||(Wa=an(Yn,ri))<=Ha?(na.pop(),Ha=Wa):(Yn.area-=Yn.pop().area,on(Yn,ri,Hn,!1),ri=Math.min(Hn.dx,Hn.dy),Yn.length=Yn.area=0,Ha=1/0);Yn.length&&(on(Yn,ri,Hn,!0),Yn.length=Yn.area=0),Bn.forEach(Sr)}}function Wr(hn){var Bn=hn.children;if(Bn&&Bn.length){var Hn=me(hn),Yn=Bn.slice(),na,_n=[];for(Cr(Yn,Hn.dx*Hn.dy/hn.value),_n.area=0;na=Yn.pop();)_n.push(na),_n.area+=na.area,na.z!=null&&(on(_n,na.z?Hn.dx:Hn.dy,Hn,!Yn.length),_n.length=_n.area=0);Bn.forEach(Wr)}}function an(hn,Bn){for(var Hn=hn.area,Yn,na=0,_n=1/0,Ha=-1,Wa=hn.length;++Hana&&(na=Yn));return Hn*=Hn,Bn*=Bn,Hn?Math.max(Bn*na*or/Hn,Hn/(Bn*_n*or)):1/0}function on(hn,Bn,Hn,Yn){var na=-1,_n=hn.length,Ha=Hn.x,Wa=Hn.y,ri=Bn?Et(hn.area/Bn):0,xi;if(Bn==Hn.dx){for((Yn||ri>Hn.dy)&&(ri=Hn.dy);++na<_n;)xi=hn[na],xi.x=Ha,xi.y=Wa,xi.dy=ri,Ha+=xi.dx=Math.min(Hn.x+Hn.dx-Ha,ri?Et(xi.area/ri):0);xi.z=!0,xi.dx+=Hn.x+Hn.dx-Ha,Hn.y+=ri,Hn.dy-=ri}else{for((Yn||ri>Hn.dx)&&(ri=Hn.dx);++na<_n;)xi=hn[na],xi.x=Ha,xi.y=Wa,xi.dx=ri,Wa+=xi.dy=Math.min(Hn.y+Hn.dy-Wa,ri?Et(xi.area/ri):0);xi.z=!1,xi.dy+=Hn.y+Hn.dy-Wa,Hn.x+=ri,Hn.dx-=ri}}function ta(hn){var Bn=Ve||gt(hn),Hn=Bn[0];return Hn.x=Hn.y=0,Hn.value?(Hn.dx=Xt[0],Hn.dy=Xt[1]):Hn.dx=Hn.dy=0,Ve&>.revalue(Hn),Cr([Hn],Hn.dx*Hn.dy/Hn.value),(Ve?Wr:Sr)(Hn),we&&(Ve=Bn),Bn}return ta.size=function(hn){return arguments.length?(Xt=hn,ta):Xt},ta.padding=function(hn){if(!arguments.length)return fe;function Bn(na){var _n=hn.call(ta,na,na.depth);return _n==null?Kr(na):Rr(na,typeof _n=="number"?[_n,_n,_n,_n]:_n)}function Hn(na){return Rr(na,hn)}var Yn;return me=(fe=hn)==null?Kr:(Yn=typeof hn)=="function"?Bn:(Yn==="number"&&(hn=[hn,hn,hn,hn]),Hn),ta},ta.round=function(hn){return arguments.length?(Et=hn?Math.round:Number,ta):Et!=Number},ta.sticky=function(hn){return arguments.length?(we=hn,Ve=null,ta):we},ta.ratio=function(hn){return arguments.length?(or=hn,ta):or},ta.mode=function(hn){return arguments.length?(je=hn+"",ta):je},Ws(ta,gt)};function Kr(gt){return{x:gt.x,y:gt.y,dx:gt.dx,dy:gt.dy}}function Rr(gt,Et){var Xt=gt.x+Et[3],fe=gt.y+Et[0],me=gt.dx-Et[1]-Et[3],we=gt.dy-Et[0]-Et[2];return me<0&&(Xt+=me/2,me=0),we<0&&(fe+=we/2,we=0),{x:Xt,y:fe,dx:me,dy:we}}u.random={normal:function(gt,Et){var Xt=arguments.length;return Xt<2&&(Et=1),Xt<1&&(gt=0),function(){var fe,me,we;do fe=Math.random()*2-1,me=Math.random()*2-1,we=fe*fe+me*me;while(!we||we>1);return gt+Et*fe*Math.sqrt(-2*Math.log(we)/we)}},logNormal:function(){var gt=u.random.normal.apply(u,arguments);return function(){return Math.exp(gt())}},bates:function(gt){var Et=u.random.irwinHall(gt);return function(){return Et()/gt}},irwinHall:function(gt){return function(){for(var Et=0,Xt=0;Xt2?va:ha,Cr=fe?Nc:lf;return me=or(gt,Et,Cr,Xt),we=or(Et,gt,Cr,Fo),je}function je(or){return me(or)}return je.invert=function(or){return we(or)},je.domain=function(or){return arguments.length?(gt=or.map(Number),Ve()):gt},je.range=function(or){return arguments.length?(Et=or,Ve()):Et},je.rangeRound=function(or){return je.range(or).interpolate(Gu)},je.clamp=function(or){return arguments.length?(fe=or,Ve()):fe},je.interpolate=function(or){return arguments.length?(Xt=or,Ve()):Xt},je.ticks=function(or){return Vi(gt,or)},je.tickFormat=function(or,Cr){return d3_scale_linearTickFormat(gt,or,Cr)},je.nice=function(or){return ca(gt,or),Ve()},je.copy=function(){return Ba(gt,Et,Xt,fe)},Ve()}function za(gt,Et){return u.rebind(gt,Et,"range","rangeRound","interpolate","clamp")}function ca(gt,Et){return Ta(gt,Ua(ei(gt,Et)[2])),Ta(gt,Ua(ei(gt,Et)[2])),gt}function ei(gt,Et){Et==null&&(Et=10);var Xt=mn(gt),fe=Xt[1]-Xt[0],me=Math.pow(10,Math.floor(Math.log(fe/Et)/Math.LN10)),we=Et/fe*me;return we<=.15?me*=10:we<=.35?me*=5:we<=.75&&(me*=2),Xt[0]=Math.ceil(Xt[0]/me)*me,Xt[1]=Math.floor(Xt[1]/me)*me+me*.5,Xt[2]=me,Xt}function Vi(gt,Et){return u.range.apply(u,ei(gt,Et))}u.scale.log=function(){return Oi(u.scale.linear().domain([0,1]),10,!0,[1,10])};function Oi(gt,Et,Xt,fe){function me(je){return(Xt?Math.log(je<0?0:je):-Math.log(je>0?0:-je))/Math.log(Et)}function we(je){return Xt?Math.pow(Et,je):-Math.pow(Et,-je)}function Ve(je){return gt(me(je))}return Ve.invert=function(je){return we(gt.invert(je))},Ve.domain=function(je){return arguments.length?(Xt=je[0]>=0,gt.domain((fe=je.map(Number)).map(me)),Ve):fe},Ve.base=function(je){return arguments.length?(Et=+je,gt.domain(fe.map(me)),Ve):Et},Ve.nice=function(){var je=Ta(fe.map(me),Xt?Math:Wi);return gt.domain(je),fe=je.map(we),Ve},Ve.ticks=function(){var je=mn(fe),or=[],Cr=je[0],Sr=je[1],Wr=Math.floor(me(Cr)),an=Math.ceil(me(Sr)),on=Et%1?2:Et;if(isFinite(an-Wr)){if(Xt){for(;Wr0;ta--)or.push(we(Wr)*ta);for(Wr=0;or[Wr]Sr;an--);or=or.slice(Wr,an)}return or},Ve.copy=function(){return Oi(gt.copy(),Et,Xt,fe)},za(Ve,gt)}var Wi={floor:function(gt){return-Math.ceil(-gt)},ceil:function(gt){return-Math.floor(-gt)}};u.scale.pow=function(){return Xi(u.scale.linear(),1,[0,1])};function Xi(gt,Et,Xt){var fe=ni(Et),me=ni(1/Et);function we(Ve){return gt(fe(Ve))}return we.invert=function(Ve){return me(gt.invert(Ve))},we.domain=function(Ve){return arguments.length?(gt.domain((Xt=Ve.map(Number)).map(fe)),we):Xt},we.ticks=function(Ve){return Vi(Xt,Ve)},we.tickFormat=function(Ve,je){return d3_scale_linearTickFormat(Xt,Ve,je)},we.nice=function(Ve){return we.domain(ca(Xt,Ve))},we.exponent=function(Ve){return arguments.length?(fe=ni(Et=Ve),me=ni(1/Et),gt.domain(Xt.map(fe)),we):Et},we.copy=function(){return Xi(gt.copy(),Et,Xt)},za(we,gt)}function ni(gt){return function(Et){return Et<0?-Math.pow(-Et,gt):Math.pow(Et,gt)}}u.scale.sqrt=function(){return u.scale.pow().exponent(.5)},u.scale.ordinal=function(){return Za([],{t:"range",a:[[]]})};function Za(gt,Et){var Xt,fe,me;function we(je){return fe[((Xt.get(je)||(Et.t==="range"?Xt.set(je,gt.push(je)):NaN))-1)%fe.length]}function Ve(je,or){return u.range(gt.length).map(function(Cr){return je+or*Cr})}return we.domain=function(je){if(!arguments.length)return gt;gt=[],Xt=new S;for(var or=-1,Cr=je.length,Sr;++or0?Xt[we-1]:gt[0],wean?0:1;if(Sr=St)return or(Sr,ta)+(Cr?or(Cr,1-ta):"")+"Z";var hn,Bn,Hn,Yn,na=0,_n=0,Ha,Wa,ri,xi,ki,zi,jo,Ii,Ji=[];if((Yn=(+Ve.apply(this,arguments)||0)/2)&&(Hn=fe===Rs?Math.sqrt(Cr*Cr+Sr*Sr):+fe.apply(this,arguments),ta||(_n*=-1),Sr&&(_n=Ee(Hn/Sr*Math.sin(Yn))),Cr&&(na=Ee(Hn/Cr*Math.sin(Yn)))),Sr){Ha=Sr*Math.cos(Wr+_n),Wa=Sr*Math.sin(Wr+_n),ri=Sr*Math.cos(an-_n),xi=Sr*Math.sin(an-_n);var es=Math.abs(an-Wr-2*_n)<=lt?0:1;if(_n&&$l(Ha,Wa,ri,xi)===ta^es){var pl=(Wr+an)/2;Ha=Sr*Math.cos(pl),Wa=Sr*Math.sin(pl),ri=xi=null}}else Ha=Wa=0;if(Cr){ki=Cr*Math.cos(an-na),zi=Cr*Math.sin(an-na),jo=Cr*Math.cos(Wr+na),Ii=Cr*Math.sin(Wr+na);var Ns=Math.abs(Wr-an+2*na)<=lt?0:1;if(na&&$l(ki,zi,jo,Ii)===1-ta^Ns){var fi=(Wr+an)/2;ki=Cr*Math.cos(fi),zi=Cr*Math.sin(fi),jo=Ii=null}}else ki=zi=0;if(on>qt&&(hn=Math.min(Math.abs(Sr-Cr)/2,+Xt.apply(this,arguments)))>.001){Bn=Cr0?0:1}function jl(gt,Et,Xt,fe,me){var we=gt[0]-Et[0],Ve=gt[1]-Et[1],je=(me?fe:-fe)/Math.sqrt(we*we+Ve*Ve),or=je*Ve,Cr=-je*we,Sr=gt[0]+or,Wr=gt[1]+Cr,an=Et[0]+or,on=Et[1]+Cr,ta=(Sr+an)/2,hn=(Wr+on)/2,Bn=an-Sr,Hn=on-Wr,Yn=Bn*Bn+Hn*Hn,na=Xt-fe,_n=Sr*on-an*Wr,Ha=(Hn<0?-1:1)*Math.sqrt(Math.max(0,na*na*Yn-_n*_n)),Wa=(_n*Hn-Bn*Ha)/Yn,ri=(-_n*Bn-Hn*Ha)/Yn,xi=(_n*Hn+Bn*Ha)/Yn,ki=(-_n*Bn+Hn*Ha)/Yn,zi=Wa-ta,jo=ri-hn,Ii=xi-ta,Ji=ki-hn;return zi*zi+jo*jo>Ii*Ii+Ji*Ji&&(Wa=xi,ri=ki),[[Wa-or,ri-Cr],[Wa*Xt/na,ri*Xt/na]]}function Bu(){return!0}function Jl(gt){var Et=ci,Xt=Ti,fe=Bu,me=nl,we=me.key,Ve=.7;function je(or){var Cr=[],Sr=[],Wr=-1,an=or.length,on,ta=pe(Et),hn=pe(Xt);function Bn(){Cr.push("M",me(gt(Sr),Ve))}for(;++Wr1?gt.join("L"):gt+"Z"}function Nu(gt){return gt.join("L")+"Z"}function Ui(gt){for(var Et=0,Xt=gt.length,fe=gt[0],me=[fe[0],",",fe[1]];++Et1&&me.push("H",fe[0]),me.join("")}function fo(gt){for(var Et=0,Xt=gt.length,fe=gt[0],me=[fe[0],",",fe[1]];++Et1){je=Et[1],we=gt[or],or++,fe+="C"+(me[0]+Ve[0])+","+(me[1]+Ve[1])+","+(we[0]-je[0])+","+(we[1]-je[1])+","+we[0]+","+we[1];for(var Cr=2;Cr9&&(we=Xt*3/Math.sqrt(we),Ve[je]=we*fe,Ve[je+1]=we*me));for(je=-1;++je<=or;)we=(gt[Math.min(or,je+1)][0]-gt[Math.max(0,je-1)][0])/(6*(1+Ve[je]*Ve[je])),Et.push([we||0,Ve[je]*we||0]);return Et}function Gt(gt){return gt.length<3?nl(gt):gt[0]+L(gt,Rt(gt))}u.svg.line.radial=function(){var gt=Jl(ae);return gt.radius=gt.x,delete gt.x,gt.angle=gt.y,delete gt.y,gt};function ae(gt){for(var Et,Xt=-1,fe=gt.length,me,we;++Xtlt)+",1 "+Wr}function Cr(Sr,Wr,an,on){return"Q 0,0 "+on}return we.radius=function(Sr){return arguments.length?(Xt=pe(Sr),we):Xt},we.source=function(Sr){return arguments.length?(gt=pe(Sr),we):gt},we.target=function(Sr){return arguments.length?(Et=pe(Sr),we):Et},we.startAngle=function(Sr){return arguments.length?(fe=pe(Sr),we):fe},we.endAngle=function(Sr){return arguments.length?(me=pe(Sr),we):me},we};function ze(gt){return gt.radius}u.svg.diagonal=function(){var gt=Te,Et=ye,Xt=rr;function fe(me,we){var Ve=gt.call(this,me,we),je=Et.call(this,me,we),or=(Ve.y+je.y)/2,Cr=[Ve,{x:Ve.x,y:or},{x:je.x,y:or},je];return Cr=Cr.map(Xt),"M"+Cr[0]+"C"+Cr[1]+" "+Cr[2]+" "+Cr[3]}return fe.source=function(me){return arguments.length?(gt=pe(me),fe):gt},fe.target=function(me){return arguments.length?(Et=pe(me),fe):Et},fe.projection=function(me){return arguments.length?(Xt=me,fe):Xt},fe};function rr(gt){return[gt.x,gt.y]}u.svg.diagonal.radial=function(){var gt=u.svg.diagonal(),Et=rr,Xt=gt.projection;return gt.projection=function(fe){return arguments.length?Xt(fr(Et=fe)):Et},gt};function fr(gt){return function(){var Et=gt.apply(this,arguments),Xt=Et[0],fe=Et[1]-Ht;return[Xt*Math.cos(fe),Xt*Math.sin(fe)]}}u.svg.symbol=function(){var gt=Lr,Et=gr;function Xt(fe,me){return(nn.get(gt.call(this,fe,me))||Hr)(Et.call(this,fe,me))}return Xt.type=function(fe){return arguments.length?(gt=pe(fe),Xt):gt},Xt.size=function(fe){return arguments.length?(Et=pe(fe),Xt):Et},Xt};function gr(){return 64}function Lr(){return"circle"}function Hr(gt){var Et=Math.sqrt(gt/lt);return"M0,"+Et+"A"+Et+","+Et+" 0 1,1 0,"+-Et+"A"+Et+","+Et+" 0 1,1 0,"+Et+"Z"}var nn=u.map({circle:Hr,cross:function(gt){var Et=Math.sqrt(gt/5)/2;return"M"+-3*Et+","+-Et+"H"+-Et+"V"+-3*Et+"H"+Et+"V"+-Et+"H"+3*Et+"V"+Et+"H"+Et+"V"+3*Et+"H"+-Et+"V"+Et+"H"+-3*Et+"Z"},diamond:function(gt){var Et=Math.sqrt(gt/(2*Mn)),Xt=Et*Mn;return"M0,"+-Et+"L"+Xt+",0 0,"+Et+" "+-Xt+",0Z"},square:function(gt){var Et=Math.sqrt(gt)/2;return"M"+-Et+","+-Et+"L"+Et+","+-Et+" "+Et+","+Et+" "+-Et+","+Et+"Z"},"triangle-down":function(gt){var Et=Math.sqrt(gt/cn),Xt=Et*cn/2;return"M0,"+Xt+"L"+Et+","+-Xt+" "+-Et+","+-Xt+"Z"},"triangle-up":function(gt){var Et=Math.sqrt(gt/cn),Xt=Et*cn/2;return"M0,"+-Xt+"L"+Et+","+Xt+" "+-Et+","+Xt+"Z"}});u.svg.symbolTypes=nn.keys();var cn=Math.sqrt(3),Mn=Math.tan(30*Yt);J.transition=function(gt){for(var Et=Ai||++ai,Xt=Xo(gt),fe=[],me,we,Ve=mi||{time:Date.now(),ease:Fi,delay:0,duration:250},je=-1,or=this.length;++je0;)Wr[--Yn].call(gt,Hn);if(Bn>=1)return Ve.event&&Ve.event.end.call(gt,gt.__data__,Et),--we.count?delete we[fe]:delete gt[Xt],1}Ve||(je=me.time,or=Qn(an,0,je),Ve=we[fe]={tween:new S,time:je,timer:or,delay:me.delay,duration:me.duration,ease:me.ease,index:Et},me=null,++we.count)}u.svg.axis=function(){var gt=u.scale.linear(),Et=Qo,Xt=6,fe=6,me=3,we=[10],Ve=null,je;function or(Cr){Cr.each(function(){var Sr=u.select(this),Wr=this.__chart__||gt,an=this.__chart__=gt.copy(),on=Ve??(an.ticks?an.ticks.apply(an,we):an.domain()),ta=je??(an.tickFormat?an.tickFormat.apply(an,we):B),hn=Sr.selectAll(".tick").data(on,an),Bn=hn.enter().insert("g",".domain").attr("class","tick").style("opacity",qt),Hn=u.transition(hn.exit()).style("opacity",qt).remove(),Yn=u.transition(hn.order()).style("opacity",1),na=Math.max(Xt,0)+me,_n,Ha=Pn(an),Wa=Sr.selectAll(".domain").data([0]),ri=(Wa.enter().append("path").attr("class","domain"),u.transition(Wa));Bn.append("line"),Bn.append("text");var xi=Bn.select("line"),ki=Yn.select("line"),zi=hn.select("text").text(ta),jo=Bn.select("text"),Ii=Yn.select("text"),Ji=Et==="top"||Et==="left"?-1:1,es,pl,Ns,fi;if(Et==="bottom"||Et==="top"?(_n=Us,es="x",Ns="y",pl="x2",fi="y2",zi.attr("dy",Ji<0?"0em":".71em").style("text-anchor","middle"),ri.attr("d","M"+Ha[0]+","+Ji*fe+"V0H"+Ha[1]+"V"+Ji*fe)):(_n=To,es="y",Ns="x",pl="y2",fi="x2",zi.attr("dy",".32em").style("text-anchor",Ji<0?"end":"start"),ri.attr("d","M"+Ji*fe+","+Ha[0]+"H0V"+Ha[1]+"H"+Ji*fe)),xi.attr(fi,Ji*Xt),jo.attr(Ns,Ji*na),ki.attr(pl,0).attr(fi,Ji*Xt),Ii.attr(es,0).attr(Ns,Ji*na),an.rangeBand){var Ao=an,Bo=Ao.rangeBand()/2;Wr=an=function(Ds){return Ao(Ds)+Bo}}else Wr.rangeBand?Wr=an:Hn.call(_n,an,Wr);Bn.call(_n,Wr,an),Yn.call(_n,an,an)})}return or.scale=function(Cr){return arguments.length?(gt=Cr,or):gt},or.orient=function(Cr){return arguments.length?(Et=Cr in Js?Cr+"":Qo,or):Et},or.ticks=function(){return arguments.length?(we=E(arguments),or):we},or.tickValues=function(Cr){return arguments.length?(Ve=Cr,or):Ve},or.tickFormat=function(Cr){return arguments.length?(je=Cr,or):je},or.tickSize=function(Cr){var Sr=arguments.length;return Sr?(Xt=+Cr,fe=+arguments[Sr-1],or):Xt},or.innerTickSize=function(Cr){return arguments.length?(Xt=+Cr,or):Xt},or.outerTickSize=function(Cr){return arguments.length?(fe=+Cr,or):fe},or.tickPadding=function(Cr){return arguments.length?(me=+Cr,or):me},or.tickSubdivide=function(){return arguments.length&&or},or};var Qo="bottom",Js={top:1,right:1,bottom:1,left:1};function Us(gt,Et,Xt){gt.attr("transform",function(fe){var me=Et(fe);return"translate("+(isFinite(me)?me:Xt(fe))+",0)"})}function To(gt,Et,Xt){gt.attr("transform",function(fe){var me=Et(fe);return"translate(0,"+(isFinite(me)?me:Xt(fe))+")"})}u.svg.brush=function(){var gt=st(Sr,"brushstart","brush","brushend"),Et=null,Xt=null,fe=[0,0],me=[0,0],we,Ve,je=!0,or=!0,Cr=hl[0];function Sr(hn){hn.each(function(){var Bn=u.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",ta).on("touchstart.brush",ta),Hn=Bn.selectAll(".background").data([0]);Hn.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),Bn.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var Yn=Bn.selectAll(".resize").data(Cr,B);Yn.exit().remove(),Yn.enter().append("g").attr("class",function(Wa){return"resize "+Wa}).style("cursor",function(Wa){return ko[Wa]}).append("rect").attr("x",function(Wa){return/[ew]$/.test(Wa)?-3:null}).attr("y",function(Wa){return/^[ns]/.test(Wa)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),Yn.style("display",Sr.empty()?"none":null);var na=u.transition(Bn),_n=u.transition(Hn),Ha;Et&&(Ha=Pn(Et),_n.attr("x",Ha[0]).attr("width",Ha[1]-Ha[0]),an(na)),Xt&&(Ha=Pn(Xt),_n.attr("y",Ha[0]).attr("height",Ha[1]-Ha[0]),on(na)),Wr(na)})}Sr.event=function(hn){hn.each(function(){var Bn=gt.of(this,arguments),Hn={x:fe,y:me,i:we,j:Ve},Yn=this.__chart__||Hn;this.__chart__=Hn,Ai?u.select(this).transition().each("start.brush",function(){we=Yn.i,Ve=Yn.j,fe=Yn.x,me=Yn.y,Bn({type:"brushstart"})}).tween("brush:brush",function(){var na=bs(fe,Hn.x),_n=bs(me,Hn.y);return we=Ve=null,function(Ha){fe=Hn.x=na(Ha),me=Hn.y=_n(Ha),Bn({type:"brush",mode:"resize"})}}).each("end.brush",function(){we=Hn.i,Ve=Hn.j,Bn({type:"brush",mode:"resize"}),Bn({type:"brushend"})}):(Bn({type:"brushstart"}),Bn({type:"brush",mode:"resize"}),Bn({type:"brushend"}))})};function Wr(hn){hn.selectAll(".resize").attr("transform",function(Bn){return"translate("+fe[+/e$/.test(Bn)]+","+me[+/^s/.test(Bn)]+")"})}function an(hn){hn.select(".extent").attr("x",fe[0]),hn.selectAll(".extent,.n>rect,.s>rect").attr("width",fe[1]-fe[0])}function on(hn){hn.select(".extent").attr("y",me[0]),hn.selectAll(".extent,.e>rect,.w>rect").attr("height",me[1]-me[0])}function ta(){var hn=this,Bn=u.select(u.event.target),Hn=gt.of(hn,arguments),Yn=u.select(hn),na=Bn.datum(),_n=!/^(n|s)$/.test(na)&&Et,Ha=!/^(e|w)$/.test(na)&&Xt,Wa=Bn.classed("extent"),ri=Mr(hn),xi,ki=u.mouse(hn),zi,jo=u.select(e(hn)).on("keydown.brush",es).on("keyup.brush",pl);if(u.event.changedTouches?jo.on("touchmove.brush",Ns).on("touchend.brush",Ao):jo.on("mousemove.brush",Ns).on("mouseup.brush",Ao),Yn.interrupt().selectAll("*").interrupt(),Wa)ki[0]=fe[0]-ki[0],ki[1]=me[0]-ki[1];else if(na){var Ii=+/w$/.test(na),Ji=+/^n/.test(na);zi=[fe[1-Ii]-ki[0],me[1-Ji]-ki[1]],ki[0]=fe[Ii],ki[1]=me[Ji]}else u.event.altKey&&(xi=ki.slice());Yn.style("pointer-events","none").selectAll(".resize").style("display",null),u.select("body").style("cursor",Bn.style("cursor")),Hn({type:"brushstart"}),Ns();function es(){u.event.keyCode==32&&(Wa||(xi=null,ki[0]-=fe[1],ki[1]-=me[1],Wa=2),rt())}function pl(){u.event.keyCode==32&&Wa==2&&(ki[0]+=fe[1],ki[1]+=me[1],Wa=0,rt())}function Ns(){var Bo=u.mouse(hn),Ds=!1;zi&&(Bo[0]+=zi[0],Bo[1]+=zi[1]),Wa||(u.event.altKey?(xi||(xi=[(fe[0]+fe[1])/2,(me[0]+me[1])/2]),ki[0]=fe[+(Bo[0]{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K):(u=u||self,d(u.d3=u.d3||{}))})(K,function(u){var d=new Date,E=new Date;function A(vt,Ut,re,Kt){function ue(Me){return vt(Me=arguments.length===0?new Date:new Date(+Me)),Me}return ue.floor=function(Me){return vt(Me=new Date(+Me)),Me},ue.ceil=function(Me){return vt(Me=new Date(Me-1)),Ut(Me,1),vt(Me),Me},ue.round=function(Me){var Ce=ue(Me),We=ue.ceil(Me);return Me-Ce0))return qe;do qe.push(vr=new Date(+Me)),Ut(Me,We),vt(Me);while(vr=Ce)for(;vt(Ce),!Me(Ce);)Ce.setTime(Ce-1)},function(Ce,We){if(Ce>=Ce)if(We<0)for(;++We<=0;)for(;Ut(Ce,-1),!Me(Ce););else for(;--We>=0;)for(;Ut(Ce,1),!Me(Ce););})},re&&(ue.count=function(Me,Ce){return d.setTime(+Me),E.setTime(+Ce),vt(d),vt(E),Math.floor(re(d,E))},ue.every=function(Me){return Me=Math.floor(Me),!isFinite(Me)||!(Me>0)?null:Me>1?ue.filter(Kt?function(Ce){return Kt(Ce)%Me===0}:function(Ce){return ue.count(0,Ce)%Me===0}):ue}),ue}var t=A(function(){},function(vt,Ut){vt.setTime(+vt+Ut)},function(vt,Ut){return Ut-vt});t.every=function(vt){return vt=Math.floor(vt),!isFinite(vt)||!(vt>0)?null:vt>1?A(function(Ut){Ut.setTime(Math.floor(Ut/vt)*vt)},function(Ut,re){Ut.setTime(+Ut+re*vt)},function(Ut,re){return(re-Ut)/vt}):t};var e=t.range,r=1e3,i=6e4,n=36e5,o=864e5,a=6048e5,s=A(function(vt){vt.setTime(vt-vt.getMilliseconds())},function(vt,Ut){vt.setTime(+vt+Ut*r)},function(vt,Ut){return(Ut-vt)/r},function(vt){return vt.getUTCSeconds()}),f=s.range,v=A(function(vt){vt.setTime(vt-vt.getMilliseconds()-vt.getSeconds()*r)},function(vt,Ut){vt.setTime(+vt+Ut*i)},function(vt,Ut){return(Ut-vt)/i},function(vt){return vt.getMinutes()}),g=v.range,m=A(function(vt){vt.setTime(vt-vt.getMilliseconds()-vt.getSeconds()*r-vt.getMinutes()*i)},function(vt,Ut){vt.setTime(+vt+Ut*n)},function(vt,Ut){return(Ut-vt)/n},function(vt){return vt.getHours()}),w=m.range,l=A(function(vt){vt.setHours(0,0,0,0)},function(vt,Ut){vt.setDate(vt.getDate()+Ut)},function(vt,Ut){return(Ut-vt-(Ut.getTimezoneOffset()-vt.getTimezoneOffset())*i)/o},function(vt){return vt.getDate()-1}),x=l.range;function y(vt){return A(function(Ut){Ut.setDate(Ut.getDate()-(Ut.getDay()+7-vt)%7),Ut.setHours(0,0,0,0)},function(Ut,re){Ut.setDate(Ut.getDate()+re*7)},function(Ut,re){return(re-Ut-(re.getTimezoneOffset()-Ut.getTimezoneOffset())*i)/a})}var S=y(0),k=y(1),M=y(2),T=y(3),c=y(4),h=y(5),b=y(6),_=S.range,P=k.range,z=M.range,D=T.range,B=c.range,R=h.range,I=b.range,F=A(function(vt){vt.setDate(1),vt.setHours(0,0,0,0)},function(vt,Ut){vt.setMonth(vt.getMonth()+Ut)},function(vt,Ut){return Ut.getMonth()-vt.getMonth()+(Ut.getFullYear()-vt.getFullYear())*12},function(vt){return vt.getMonth()}),j=F.range,N=A(function(vt){vt.setMonth(0,1),vt.setHours(0,0,0,0)},function(vt,Ut){vt.setFullYear(vt.getFullYear()+Ut)},function(vt,Ut){return Ut.getFullYear()-vt.getFullYear()},function(vt){return vt.getFullYear()});N.every=function(vt){return!isFinite(vt=Math.floor(vt))||!(vt>0)?null:A(function(Ut){Ut.setFullYear(Math.floor(Ut.getFullYear()/vt)*vt),Ut.setMonth(0,1),Ut.setHours(0,0,0,0)},function(Ut,re){Ut.setFullYear(Ut.getFullYear()+re*vt)})};var G=N.range,rt=A(function(vt){vt.setUTCSeconds(0,0)},function(vt,Ut){vt.setTime(+vt+Ut*i)},function(vt,Ut){return(Ut-vt)/i},function(vt){return vt.getUTCMinutes()}),ct=rt.range,st=A(function(vt){vt.setUTCMinutes(0,0,0)},function(vt,Ut){vt.setTime(+vt+Ut*n)},function(vt,Ut){return(Ut-vt)/n},function(vt){return vt.getUTCHours()}),et=st.range,Z=A(function(vt){vt.setUTCHours(0,0,0,0)},function(vt,Ut){vt.setUTCDate(vt.getUTCDate()+Ut)},function(vt,Ut){return(Ut-vt)/o},function(vt){return vt.getUTCDate()-1}),ot=Z.range;function X(vt){return A(function(Ut){Ut.setUTCDate(Ut.getUTCDate()-(Ut.getUTCDay()+7-vt)%7),Ut.setUTCHours(0,0,0,0)},function(Ut,re){Ut.setUTCDate(Ut.getUTCDate()+re*7)},function(Ut,re){return(re-Ut)/a})}var Q=X(0),ut=X(1),J=X(2),q=X(3),it=X(4),nt=X(5),dt=X(6),Tt=Q.range,wt=ut.range,Ct=J.range,It=q.range,Nt=it.range,te=nt.range,Jt=dt.range,ee=A(function(vt){vt.setUTCDate(1),vt.setUTCHours(0,0,0,0)},function(vt,Ut){vt.setUTCMonth(vt.getUTCMonth()+Ut)},function(vt,Ut){return Ut.getUTCMonth()-vt.getUTCMonth()+(Ut.getUTCFullYear()-vt.getUTCFullYear())*12},function(vt){return vt.getUTCMonth()}),Zt=ee.range,mt=A(function(vt){vt.setUTCMonth(0,1),vt.setUTCHours(0,0,0,0)},function(vt,Ut){vt.setUTCFullYear(vt.getUTCFullYear()+Ut)},function(vt,Ut){return Ut.getUTCFullYear()-vt.getUTCFullYear()},function(vt){return vt.getUTCFullYear()});mt.every=function(vt){return!isFinite(vt=Math.floor(vt))||!(vt>0)?null:A(function(Ut){Ut.setUTCFullYear(Math.floor(Ut.getUTCFullYear()/vt)*vt),Ut.setUTCMonth(0,1),Ut.setUTCHours(0,0,0,0)},function(Ut,re){Ut.setUTCFullYear(Ut.getUTCFullYear()+re*vt)})};var bt=mt.range;u.timeDay=l,u.timeDays=x,u.timeFriday=h,u.timeFridays=R,u.timeHour=m,u.timeHours=w,u.timeInterval=A,u.timeMillisecond=t,u.timeMilliseconds=e,u.timeMinute=v,u.timeMinutes=g,u.timeMonday=k,u.timeMondays=P,u.timeMonth=F,u.timeMonths=j,u.timeSaturday=b,u.timeSaturdays=I,u.timeSecond=s,u.timeSeconds=f,u.timeSunday=S,u.timeSundays=_,u.timeThursday=c,u.timeThursdays=B,u.timeTuesday=M,u.timeTuesdays=z,u.timeWednesday=T,u.timeWednesdays=D,u.timeWeek=S,u.timeWeeks=_,u.timeYear=N,u.timeYears=G,u.utcDay=Z,u.utcDays=ot,u.utcFriday=nt,u.utcFridays=te,u.utcHour=st,u.utcHours=et,u.utcMillisecond=t,u.utcMilliseconds=e,u.utcMinute=rt,u.utcMinutes=ct,u.utcMonday=ut,u.utcMondays=wt,u.utcMonth=ee,u.utcMonths=Zt,u.utcSaturday=dt,u.utcSaturdays=Jt,u.utcSecond=s,u.utcSeconds=f,u.utcSunday=Q,u.utcSundays=Tt,u.utcThursday=it,u.utcThursdays=Nt,u.utcTuesday=J,u.utcTuesdays=Ct,u.utcWednesday=q,u.utcWednesdays=It,u.utcWeek=Q,u.utcWeeks=Tt,u.utcYear=mt,u.utcYears=bt,Object.defineProperty(u,"__esModule",{value:!0})})}),mm=Vt((K,V)=>{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K,Q_()):(u=u||self,d(u.d3=u.d3||{},u.d3))})(K,function(u,d){function E(Dt){if(0<=Dt.y&&Dt.y<100){var qt=new Date(-1,Dt.m,Dt.d,Dt.H,Dt.M,Dt.S,Dt.L);return qt.setFullYear(Dt.y),qt}return new Date(Dt.y,Dt.m,Dt.d,Dt.H,Dt.M,Dt.S,Dt.L)}function A(Dt){if(0<=Dt.y&&Dt.y<100){var qt=new Date(Date.UTC(-1,Dt.m,Dt.d,Dt.H,Dt.M,Dt.S,Dt.L));return qt.setUTCFullYear(Dt.y),qt}return new Date(Date.UTC(Dt.y,Dt.m,Dt.d,Dt.H,Dt.M,Dt.S,Dt.L))}function t(Dt,qt,_t){return{y:Dt,m:qt,d:_t,H:0,M:0,S:0,L:0}}function e(Dt){var qt=Dt.dateTime,_t=Dt.date,lt=Dt.time,yt=Dt.periods,St=Dt.days,Ht=Dt.shortDays,Yt=Dt.months,se=Dt.shortMonths,ke=f(yt),Ee=v(yt),Ue=f(St),ir=v(St),ar=f(Ht),Ye=v(Ht),Er=f(Yt),pn=v(Yt),dn=f(se),bn=v(se),Zn={a:Nn,A:Kn,b:$n,B:ia,c:null,d:F,e:F,f:ct,H:j,I:N,j:G,L:rt,m:st,M:et,p:Cn,q:Fa,Q:Ce,s:We,S:Z,u:ot,U:X,V:Q,w:ut,W:J,x:null,X:null,y:q,Y:it,Z:nt,"%":Me},En={a:Ga,A:ve,b:ge,B:dr,c:null,d:dt,e:dt,f:Nt,H:Tt,I:wt,j:Ct,L:It,m:te,M:Jt,p:br,q:Tr,Q:Ce,s:We,S:ee,u:Zt,U:mt,V:bt,w:vt,W:Ut,x:null,X:null,y:re,Y:Kt,Z:ue,"%":Me},gn={a:Ze,A:tr,b:zr,B:tn,c:Yr,d:c,e:c,f:D,H:b,I:b,j:h,L:z,m:T,M:_,p:Re,q:M,Q:R,s:I,S:P,u:m,U:w,V:l,w:g,W:x,x:$r,X:In,y:S,Y:y,Z:k,"%":B};Zn.x=da(_t,Zn),Zn.X=da(lt,Zn),Zn.c=da(qt,Zn),En.x=da(_t,En),En.X=da(lt,En),En.c=da(qt,En);function da(mr,kr){return function(Ur){var Or=[],pe=-1,Ke=0,xr=mr.length,Gr,ln,wn;for(Ur instanceof Date||(Ur=new Date(+Ur));++pe53)return null;"w"in Or||(Or.w=1),"Z"in Or?(Ke=A(t(Or.y,0,1)),xr=Ke.getUTCDay(),Ke=xr>4||xr===0?d.utcMonday.ceil(Ke):d.utcMonday(Ke),Ke=d.utcDay.offset(Ke,(Or.V-1)*7),Or.y=Ke.getUTCFullYear(),Or.m=Ke.getUTCMonth(),Or.d=Ke.getUTCDate()+(Or.w+6)%7):(Ke=E(t(Or.y,0,1)),xr=Ke.getDay(),Ke=xr>4||xr===0?d.timeMonday.ceil(Ke):d.timeMonday(Ke),Ke=d.timeDay.offset(Ke,(Or.V-1)*7),Or.y=Ke.getFullYear(),Or.m=Ke.getMonth(),Or.d=Ke.getDate()+(Or.w+6)%7)}else("W"in Or||"U"in Or)&&("w"in Or||(Or.w="u"in Or?Or.u%7:"W"in Or?1:0),xr="Z"in Or?A(t(Or.y,0,1)).getUTCDay():E(t(Or.y,0,1)).getDay(),Or.m=0,Or.d="W"in Or?(Or.w+6)%7+Or.W*7-(xr+5)%7:Or.w+Or.U*7-(xr+6)%7);return"Z"in Or?(Or.H+=Or.Z/100|0,Or.M+=Or.Z%100,A(Or)):E(Or)}}function Se(mr,kr,Ur,Or){for(var pe=0,Ke=kr.length,xr=Ur.length,Gr,ln;pe=xr)return-1;if(Gr=kr.charCodeAt(pe++),Gr===37){if(Gr=kr.charAt(pe++),ln=gn[Gr in r?kr.charAt(pe++):Gr],!ln||(Or=ln(mr,Ur,Or))<0)return-1}else if(Gr!=Ur.charCodeAt(Or++))return-1}return Or}function Re(mr,kr,Ur){var Or=ke.exec(kr.slice(Ur));return Or?(mr.p=Ee[Or[0].toLowerCase()],Ur+Or[0].length):-1}function Ze(mr,kr,Ur){var Or=ar.exec(kr.slice(Ur));return Or?(mr.w=Ye[Or[0].toLowerCase()],Ur+Or[0].length):-1}function tr(mr,kr,Ur){var Or=Ue.exec(kr.slice(Ur));return Or?(mr.w=ir[Or[0].toLowerCase()],Ur+Or[0].length):-1}function zr(mr,kr,Ur){var Or=dn.exec(kr.slice(Ur));return Or?(mr.m=bn[Or[0].toLowerCase()],Ur+Or[0].length):-1}function tn(mr,kr,Ur){var Or=Er.exec(kr.slice(Ur));return Or?(mr.m=pn[Or[0].toLowerCase()],Ur+Or[0].length):-1}function Yr(mr,kr,Ur){return Se(mr,qt,kr,Ur)}function $r(mr,kr,Ur){return Se(mr,_t,kr,Ur)}function In(mr,kr,Ur){return Se(mr,lt,kr,Ur)}function Nn(mr){return Ht[mr.getDay()]}function Kn(mr){return St[mr.getDay()]}function $n(mr){return se[mr.getMonth()]}function ia(mr){return Yt[mr.getMonth()]}function Cn(mr){return yt[+(mr.getHours()>=12)]}function Fa(mr){return 1+~~(mr.getMonth()/3)}function Ga(mr){return Ht[mr.getUTCDay()]}function ve(mr){return St[mr.getUTCDay()]}function ge(mr){return se[mr.getUTCMonth()]}function dr(mr){return Yt[mr.getUTCMonth()]}function br(mr){return yt[+(mr.getUTCHours()>=12)]}function Tr(mr){return 1+~~(mr.getUTCMonth()/3)}return{format:function(mr){var kr=da(mr+="",Zn);return kr.toString=function(){return mr},kr},parse:function(mr){var kr=ra(mr+="",!1);return kr.toString=function(){return mr},kr},utcFormat:function(mr){var kr=da(mr+="",En);return kr.toString=function(){return mr},kr},utcParse:function(mr){var kr=ra(mr+="",!0);return kr.toString=function(){return mr},kr}}}var r={"-":"",_:" ",0:"0"},i=/^\s*\d+/,n=/^%/,o=/[\\^$*+?|[\]().{}]/g;function a(Dt,qt,_t){var lt=Dt<0?"-":"",yt=(lt?-Dt:Dt)+"",St=yt.length;return lt+(St<_t?new Array(_t-St+1).join(qt)+yt:yt)}function s(Dt){return Dt.replace(o,"\\$&")}function f(Dt){return new RegExp("^(?:"+Dt.map(s).join("|")+")","i")}function v(Dt){for(var qt={},_t=-1,lt=Dt.length;++_t68?1900:2e3),_t+lt[0].length):-1}function k(Dt,qt,_t){var lt=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(qt.slice(_t,_t+6));return lt?(Dt.Z=lt[1]?0:-(lt[2]+(lt[3]||"00")),_t+lt[0].length):-1}function M(Dt,qt,_t){var lt=i.exec(qt.slice(_t,_t+1));return lt?(Dt.q=lt[0]*3-3,_t+lt[0].length):-1}function T(Dt,qt,_t){var lt=i.exec(qt.slice(_t,_t+2));return lt?(Dt.m=lt[0]-1,_t+lt[0].length):-1}function c(Dt,qt,_t){var lt=i.exec(qt.slice(_t,_t+2));return lt?(Dt.d=+lt[0],_t+lt[0].length):-1}function h(Dt,qt,_t){var lt=i.exec(qt.slice(_t,_t+3));return lt?(Dt.m=0,Dt.d=+lt[0],_t+lt[0].length):-1}function b(Dt,qt,_t){var lt=i.exec(qt.slice(_t,_t+2));return lt?(Dt.H=+lt[0],_t+lt[0].length):-1}function _(Dt,qt,_t){var lt=i.exec(qt.slice(_t,_t+2));return lt?(Dt.M=+lt[0],_t+lt[0].length):-1}function P(Dt,qt,_t){var lt=i.exec(qt.slice(_t,_t+2));return lt?(Dt.S=+lt[0],_t+lt[0].length):-1}function z(Dt,qt,_t){var lt=i.exec(qt.slice(_t,_t+3));return lt?(Dt.L=+lt[0],_t+lt[0].length):-1}function D(Dt,qt,_t){var lt=i.exec(qt.slice(_t,_t+6));return lt?(Dt.L=Math.floor(lt[0]/1e3),_t+lt[0].length):-1}function B(Dt,qt,_t){var lt=n.exec(qt.slice(_t,_t+1));return lt?_t+lt[0].length:-1}function R(Dt,qt,_t){var lt=i.exec(qt.slice(_t));return lt?(Dt.Q=+lt[0],_t+lt[0].length):-1}function I(Dt,qt,_t){var lt=i.exec(qt.slice(_t));return lt?(Dt.s=+lt[0],_t+lt[0].length):-1}function F(Dt,qt){return a(Dt.getDate(),qt,2)}function j(Dt,qt){return a(Dt.getHours(),qt,2)}function N(Dt,qt){return a(Dt.getHours()%12||12,qt,2)}function G(Dt,qt){return a(1+d.timeDay.count(d.timeYear(Dt),Dt),qt,3)}function rt(Dt,qt){return a(Dt.getMilliseconds(),qt,3)}function ct(Dt,qt){return rt(Dt,qt)+"000"}function st(Dt,qt){return a(Dt.getMonth()+1,qt,2)}function et(Dt,qt){return a(Dt.getMinutes(),qt,2)}function Z(Dt,qt){return a(Dt.getSeconds(),qt,2)}function ot(Dt){var qt=Dt.getDay();return qt===0?7:qt}function X(Dt,qt){return a(d.timeSunday.count(d.timeYear(Dt)-1,Dt),qt,2)}function Q(Dt,qt){var _t=Dt.getDay();return Dt=_t>=4||_t===0?d.timeThursday(Dt):d.timeThursday.ceil(Dt),a(d.timeThursday.count(d.timeYear(Dt),Dt)+(d.timeYear(Dt).getDay()===4),qt,2)}function ut(Dt){return Dt.getDay()}function J(Dt,qt){return a(d.timeMonday.count(d.timeYear(Dt)-1,Dt),qt,2)}function q(Dt,qt){return a(Dt.getFullYear()%100,qt,2)}function it(Dt,qt){return a(Dt.getFullYear()%1e4,qt,4)}function nt(Dt){var qt=Dt.getTimezoneOffset();return(qt>0?"-":(qt*=-1,"+"))+a(qt/60|0,"0",2)+a(qt%60,"0",2)}function dt(Dt,qt){return a(Dt.getUTCDate(),qt,2)}function Tt(Dt,qt){return a(Dt.getUTCHours(),qt,2)}function wt(Dt,qt){return a(Dt.getUTCHours()%12||12,qt,2)}function Ct(Dt,qt){return a(1+d.utcDay.count(d.utcYear(Dt),Dt),qt,3)}function It(Dt,qt){return a(Dt.getUTCMilliseconds(),qt,3)}function Nt(Dt,qt){return It(Dt,qt)+"000"}function te(Dt,qt){return a(Dt.getUTCMonth()+1,qt,2)}function Jt(Dt,qt){return a(Dt.getUTCMinutes(),qt,2)}function ee(Dt,qt){return a(Dt.getUTCSeconds(),qt,2)}function Zt(Dt){var qt=Dt.getUTCDay();return qt===0?7:qt}function mt(Dt,qt){return a(d.utcSunday.count(d.utcYear(Dt)-1,Dt),qt,2)}function bt(Dt,qt){var _t=Dt.getUTCDay();return Dt=_t>=4||_t===0?d.utcThursday(Dt):d.utcThursday.ceil(Dt),a(d.utcThursday.count(d.utcYear(Dt),Dt)+(d.utcYear(Dt).getUTCDay()===4),qt,2)}function vt(Dt){return Dt.getUTCDay()}function Ut(Dt,qt){return a(d.utcMonday.count(d.utcYear(Dt)-1,Dt),qt,2)}function re(Dt,qt){return a(Dt.getUTCFullYear()%100,qt,2)}function Kt(Dt,qt){return a(Dt.getUTCFullYear()%1e4,qt,4)}function ue(){return"+0000"}function Me(){return"%"}function Ce(Dt){return+Dt}function We(Dt){return Math.floor(+Dt/1e3)}var qe;vr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function vr(Dt){return qe=e(Dt),u.timeFormat=qe.format,u.timeParse=qe.parse,u.utcFormat=qe.utcFormat,u.utcParse=qe.utcParse,qe}var _r="%Y-%m-%dT%H:%M:%S.%LZ";function er(Dt){return Dt.toISOString()}var Mr=Date.prototype.toISOString?er:u.utcFormat(_r);function Ir(Dt){var qt=new Date(Dt);return isNaN(qt)?null:qt}var de=+new Date("2000-01-01T00:00:00.000Z")?Ir:u.utcParse(_r);u.isoFormat=Mr,u.isoParse=de,u.timeFormatDefaultLocale=vr,u.timeFormatLocale=e,Object.defineProperty(u,"__esModule",{value:!0})})}),tb=Vt((K,V)=>{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K):(u=typeof globalThis<"u"?globalThis:u||self,d(u.d3=u.d3||{}))})(K,function(u){function d(T){return Math.abs(T=Math.round(T))>=1e21?T.toLocaleString("en").replace(/,/g,""):T.toString(10)}function E(T,c){if((h=(T=c?T.toExponential(c-1):T.toExponential()).indexOf("e"))<0)return null;var h,b=T.slice(0,h);return[b.length>1?b[0]+b.slice(2):b,+T.slice(h+1)]}function A(T){return T=E(Math.abs(T)),T?T[1]:NaN}function t(T,c){return function(h,b){for(var _=h.length,P=[],z=0,D=T[0],B=0;_>0&&D>0&&(B+D+1>b&&(D=Math.max(1,b-B)),P.push(h.substring(_-=D,_+D)),!((B+=D+1)>b));)D=T[z=(z+1)%T.length];return P.reverse().join(c)}}function e(T){return function(c){return c.replace(/[0-9]/g,function(h){return T[+h]})}}var r=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function i(T){if(!(c=r.exec(T)))throw new Error("invalid format: "+T);var c;return new n({fill:c[1],align:c[2],sign:c[3],symbol:c[4],zero:c[5],width:c[6],comma:c[7],precision:c[8]&&c[8].slice(1),trim:c[9],type:c[10]})}i.prototype=n.prototype;function n(T){this.fill=T.fill===void 0?" ":T.fill+"",this.align=T.align===void 0?">":T.align+"",this.sign=T.sign===void 0?"-":T.sign+"",this.symbol=T.symbol===void 0?"":T.symbol+"",this.zero=!!T.zero,this.width=T.width===void 0?void 0:+T.width,this.comma=!!T.comma,this.precision=T.precision===void 0?void 0:+T.precision,this.trim=!!T.trim,this.type=T.type===void 0?"":T.type+""}n.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function o(T){t:for(var c=T.length,h=1,b=-1,_;h0&&(b=0);break}return b>0?T.slice(0,b)+T.slice(_+1):T}var a;function s(T,c){var h=E(T,c);if(!h)return T+"";var b=h[0],_=h[1],P=_-(a=Math.max(-8,Math.min(8,Math.floor(_/3)))*3)+1,z=b.length;return P===z?b:P>z?b+new Array(P-z+1).join("0"):P>0?b.slice(0,P)+"."+b.slice(P):"0."+new Array(1-P).join("0")+E(T,Math.max(0,c+P-1))[0]}function f(T,c){var h=E(T,c);if(!h)return T+"";var b=h[0],_=h[1];return _<0?"0."+new Array(-_).join("0")+b:b.length>_+1?b.slice(0,_+1)+"."+b.slice(_+1):b+new Array(_-b.length+2).join("0")}var v={"%":function(T,c){return(T*100).toFixed(c)},b:function(T){return Math.round(T).toString(2)},c:function(T){return T+""},d,e:function(T,c){return T.toExponential(c)},f:function(T,c){return T.toFixed(c)},g:function(T,c){return T.toPrecision(c)},o:function(T){return Math.round(T).toString(8)},p:function(T,c){return f(T*100,c)},r:f,s,X:function(T){return Math.round(T).toString(16).toUpperCase()},x:function(T){return Math.round(T).toString(16)}};function g(T){return T}var m=Array.prototype.map,w=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function l(T){var c=T.grouping===void 0||T.thousands===void 0?g:t(m.call(T.grouping,Number),T.thousands+""),h=T.currency===void 0?"":T.currency[0]+"",b=T.currency===void 0?"":T.currency[1]+"",_=T.decimal===void 0?".":T.decimal+"",P=T.numerals===void 0?g:e(m.call(T.numerals,String)),z=T.percent===void 0?"%":T.percent+"",D=T.minus===void 0?"-":T.minus+"",B=T.nan===void 0?"NaN":T.nan+"";function R(F){F=i(F);var j=F.fill,N=F.align,G=F.sign,rt=F.symbol,ct=F.zero,st=F.width,et=F.comma,Z=F.precision,ot=F.trim,X=F.type;X==="n"?(et=!0,X="g"):v[X]||(Z===void 0&&(Z=12),ot=!0,X="g"),(ct||j==="0"&&N==="=")&&(ct=!0,j="0",N="=");var Q=rt==="$"?h:rt==="#"&&/[boxX]/.test(X)?"0"+X.toLowerCase():"",ut=rt==="$"?b:/[%p]/.test(X)?z:"",J=v[X],q=/[defgprs%]/.test(X);Z=Z===void 0?6:/[gprs]/.test(X)?Math.max(1,Math.min(21,Z)):Math.max(0,Math.min(20,Z));function it(nt){var dt=Q,Tt=ut,wt,Ct,It;if(X==="c")Tt=J(nt)+Tt,nt="";else{nt=+nt;var Nt=nt<0||1/nt<0;if(nt=isNaN(nt)?B:J(Math.abs(nt),Z),ot&&(nt=o(nt)),Nt&&+nt==0&&G!=="+"&&(Nt=!1),dt=(Nt?G==="("?G:D:G==="-"||G==="("?"":G)+dt,Tt=(X==="s"?w[8+a/3]:"")+Tt+(Nt&&G==="("?")":""),q){for(wt=-1,Ct=nt.length;++wtIt||It>57){Tt=(It===46?_+nt.slice(wt+1):nt.slice(wt))+Tt,nt=nt.slice(0,wt);break}}}et&&!ct&&(nt=c(nt,1/0));var te=dt.length+nt.length+Tt.length,Jt=te>1)+dt+nt+Tt+Jt.slice(te);break;default:nt=Jt+dt+nt+Tt;break}return P(nt)}return it.toString=function(){return F+""},it}function I(F,j){var N=R((F=i(F),F.type="f",F)),G=Math.max(-8,Math.min(8,Math.floor(A(j)/3)))*3,rt=Math.pow(10,-G),ct=w[8+G/3];return function(st){return N(rt*st)+ct}}return{format:R,formatPrefix:I}}var x;y({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});function y(T){return x=l(T),u.format=x.format,u.formatPrefix=x.formatPrefix,x}function S(T){return Math.max(0,-A(Math.abs(T)))}function k(T,c){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(A(c)/3)))*3-A(Math.abs(T)))}function M(T,c){return T=Math.abs(T),c=Math.abs(c)-T,Math.max(0,A(c)-A(T))+1}u.FormatSpecifier=n,u.formatDefaultLocale=y,u.formatLocale=l,u.formatSpecifier=i,u.precisionFixed=S,u.precisionPrefix=k,u.precisionRound=M,Object.defineProperty(u,"__esModule",{value:!0})})}),Y4=Vt((K,V)=>{V.exports=function(u){for(var d=u.length,E,A=0;A13)&&E!==32&&E!==133&&E!==160&&E!==5760&&E!==6158&&(E<8192||E>8205)&&E!==8232&&E!==8233&&E!==8239&&E!==8287&&E!==8288&&E!==12288&&E!==65279)return!1;return!0}}),Lo=Vt((K,V)=>{var u=Y4();V.exports=function(d){var E=typeof d;if(E==="string"){var A=d;if(d=+d,d===0&&u(A))return!1}else if(E!=="number")return!1;return d-d<1}}),ks=Vt((K,V)=>{V.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE*1e-4,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,ONEMILLI:1,ONEMICROSEC:.001,EPOCHJD:24405875e-1,ALMOST_EQUAL:1-1e-6,LOG_CLIP:10,MINUS_SIGN:"−"}}),eb=Vt((K,V)=>{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K):(u=typeof globalThis<"u"?globalThis:u||self,d(u["base64-arraybuffer"]={}))})(K,function(u){for(var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",E=typeof Uint8Array>"u"?[]:new Uint8Array(256),A=0;A>2],a+=d[(i[n]&3)<<4|i[n+1]>>4],a+=d[(i[n+1]&15)<<2|i[n+2]>>6],a+=d[i[n+2]&63];return o%3===2?a=a.substring(0,a.length-1)+"=":o%3===1&&(a=a.substring(0,a.length-2)+"=="),a},e=function(r){var i=r.length*.75,n=r.length,o,a=0,s,f,v,g;r[r.length-1]==="="&&(i--,r[r.length-2]==="="&&i--);var m=new ArrayBuffer(i),w=new Uint8Array(m);for(o=0;o>4,w[a++]=(f&15)<<4|v>>2,w[a++]=(v&3)<<6|g&63;return m};u.decode=e,u.encode=t,Object.defineProperty(u,"__esModule",{value:!0})})}),Fp=Vt((K,V)=>{V.exports=function(u){return window&&window.process&&window.process.versions?Object.prototype.toString.call(u)==="[object Object]":Object.prototype.toString.call(u)==="[object Object]"&&Object.getPrototypeOf(u).hasOwnProperty("hasOwnProperty")}}),nh=Vt(K=>{var V=eb().decode,u=Fp(),d=Array.isArray,E=ArrayBuffer,A=DataView;function t(s){return E.isView(s)&&!(s instanceof A)}K.isTypedArray=t;function e(s){return d(s)||t(s)}K.isArrayOrTypedArray=e;function r(s){return!e(s[0])}K.isArray1D=r,K.ensureArray=function(s,f){return d(s)||(s=[]),s.length=f,s};var i={u1c:typeof Uint8ClampedArray>"u"?void 0:Uint8ClampedArray,i1:typeof Int8Array>"u"?void 0:Int8Array,u1:typeof Uint8Array>"u"?void 0:Uint8Array,i2:typeof Int16Array>"u"?void 0:Int16Array,u2:typeof Uint16Array>"u"?void 0:Uint16Array,i4:typeof Int32Array>"u"?void 0:Int32Array,u4:typeof Uint32Array>"u"?void 0:Uint32Array,f4:typeof Float32Array>"u"?void 0:Float32Array,f8:typeof Float64Array>"u"?void 0:Float64Array};i.uint8c=i.u1c,i.uint8=i.u1,i.int8=i.i1,i.uint16=i.u2,i.int16=i.i2,i.uint32=i.u4,i.int32=i.i4,i.float32=i.f4,i.float64=i.f8;function n(s){return s.constructor===ArrayBuffer}K.isArrayBuffer=n,K.decodeTypedArraySpec=function(s){var f=[],v=o(s),g=v.dtype,m=i[g];if(!m)throw new Error('Error in dtype: "'+g+'"');var w=m.BYTES_PER_ELEMENT,l=v.bdata;n(l)||(l=V(l));var x=v.shape===void 0?[l.byteLength/w]:(""+v.shape).split(",");x.reverse();var y=x.length,S,k,M=+x[0],T=w*M,c=0;if(y===1)f=new m(l);else if(y===2)for(S=+x[1],k=0;k{var u=Lo(),d=nh().isArrayOrTypedArray;V.exports=function(a,s){if(u(s))s=String(s);else if(typeof s!="string"||s.slice(-4)==="[-1]")throw"bad property string";var f=s.split("."),v,g,m,w;for(w=0;w{var u=Og(),d=/^\w*$/,E=0,A=1,t=2,e=3,r=4;V.exports=function(i,n,o,a){o=o||"name",a=a||"value";var s,f,v,g={};n&&n.length?(v=u(i,n),f=v.get()):f=i,n=n||"";var m={};if(f)for(s=0;s2)return g[y]=g[y]|t,l.set(x,null);if(w){for(s=y;s{var u=/^(.*)(\.[^\.\[\]]+|\[\d\])$/,d=/^[^\.\[\]]+$/;V.exports=function(E,A){for(;A;){var t=E.match(u);if(t)E=t[1];else if(E.match(d))E="";else throw new Error("bad relativeAttr call:"+[E,A]);if(A.charAt(0)==="^")A=A.slice(1);else break}return E&&A.charAt(0)!=="["?E+"."+A:E+A}}),By=Vt((K,V)=>{var u=Lo();V.exports=function(d,E){if(d>0)return Math.log(d)/Math.LN10;var A=Math.log(Math.min(E[0],E[1]))/Math.LN10;return u(A)||(A=Math.log(Math.max(E[0],E[1]))/Math.LN10-6),A}}),J4=Vt((K,V)=>{var u=nh().isArrayOrTypedArray,d=Fp();V.exports=function E(A,t){for(var e in t){var r=t[e],i=A[e];if(i!==r)if(e.charAt(0)==="_"||typeof r=="function"){if(e in A)continue;A[e]=r}else if(u(r)&&u(i)&&d(r[0])){if(e==="customdata"||e==="ids")continue;for(var n=Math.min(r.length,i.length),o=0;o{function u(E,A){var t=E%A;return t<0?t+A:t}function d(E,A){return Math.abs(E)>A/2?E-Math.round(E/A)*A:E}V.exports={mod:u,modHalf:d}}),Af=Vt((K,V)=>{(function(u){var d=/^\s+/,E=/\s+$/,A=0,t=u.round,e=u.min,r=u.max,i=u.random;function n(q,it){if(q=q||"",it=it||{},q instanceof n)return q;if(!(this instanceof n))return new n(q,it);var nt=o(q);this._originalInput=q,this._r=nt.r,this._g=nt.g,this._b=nt.b,this._a=nt.a,this._roundA=t(100*this._a)/100,this._format=it.format||nt.format,this._gradientType=it.gradientType,this._r<1&&(this._r=t(this._r)),this._g<1&&(this._g=t(this._g)),this._b<1&&(this._b=t(this._b)),this._ok=nt.ok,this._tc_id=A++}n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var q=this.toRgb();return(q.r*299+q.g*587+q.b*114)/1e3},getLuminance:function(){var q=this.toRgb(),it,nt,dt,Tt,wt,Ct;return it=q.r/255,nt=q.g/255,dt=q.b/255,it<=.03928?Tt=it/12.92:Tt=u.pow((it+.055)/1.055,2.4),nt<=.03928?wt=nt/12.92:wt=u.pow((nt+.055)/1.055,2.4),dt<=.03928?Ct=dt/12.92:Ct=u.pow((dt+.055)/1.055,2.4),.2126*Tt+.7152*wt+.0722*Ct},setAlpha:function(q){return this._a=F(q),this._roundA=t(100*this._a)/100,this},toHsv:function(){var q=v(this._r,this._g,this._b);return{h:q.h*360,s:q.s,v:q.v,a:this._a}},toHsvString:function(){var q=v(this._r,this._g,this._b),it=t(q.h*360),nt=t(q.s*100),dt=t(q.v*100);return this._a==1?"hsv("+it+", "+nt+"%, "+dt+"%)":"hsva("+it+", "+nt+"%, "+dt+"%, "+this._roundA+")"},toHsl:function(){var q=s(this._r,this._g,this._b);return{h:q.h*360,s:q.s,l:q.l,a:this._a}},toHslString:function(){var q=s(this._r,this._g,this._b),it=t(q.h*360),nt=t(q.s*100),dt=t(q.l*100);return this._a==1?"hsl("+it+", "+nt+"%, "+dt+"%)":"hsla("+it+", "+nt+"%, "+dt+"%, "+this._roundA+")"},toHex:function(q){return m(this._r,this._g,this._b,q)},toHexString:function(q){return"#"+this.toHex(q)},toHex8:function(q){return w(this._r,this._g,this._b,this._a,q)},toHex8String:function(q){return"#"+this.toHex8(q)},toRgb:function(){return{r:t(this._r),g:t(this._g),b:t(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+t(this._r)+", "+t(this._g)+", "+t(this._b)+")":"rgba("+t(this._r)+", "+t(this._g)+", "+t(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:t(j(this._r,255)*100)+"%",g:t(j(this._g,255)*100)+"%",b:t(j(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+t(j(this._r,255)*100)+"%, "+t(j(this._g,255)*100)+"%, "+t(j(this._b,255)*100)+"%)":"rgba("+t(j(this._r,255)*100)+"%, "+t(j(this._g,255)*100)+"%, "+t(j(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:R[m(this._r,this._g,this._b,!0)]||!1},toFilter:function(q){var it="#"+l(this._r,this._g,this._b,this._a),nt=it,dt=this._gradientType?"GradientType = 1, ":"";if(q){var Tt=n(q);nt="#"+l(Tt._r,Tt._g,Tt._b,Tt._a)}return"progid:DXImageTransform.Microsoft.gradient("+dt+"startColorstr="+it+",endColorstr="+nt+")"},toString:function(q){var it=!!q;q=q||this._format;var nt=!1,dt=this._a<1&&this._a>=0,Tt=!it&&dt&&(q==="hex"||q==="hex6"||q==="hex3"||q==="hex4"||q==="hex8"||q==="name");return Tt?q==="name"&&this._a===0?this.toName():this.toRgbString():(q==="rgb"&&(nt=this.toRgbString()),q==="prgb"&&(nt=this.toPercentageRgbString()),(q==="hex"||q==="hex6")&&(nt=this.toHexString()),q==="hex3"&&(nt=this.toHexString(!0)),q==="hex4"&&(nt=this.toHex8String(!0)),q==="hex8"&&(nt=this.toHex8String()),q==="name"&&(nt=this.toName()),q==="hsl"&&(nt=this.toHslString()),q==="hsv"&&(nt=this.toHsvString()),nt||this.toHexString())},clone:function(){return n(this.toString())},_applyModification:function(q,it){var nt=q.apply(null,[this].concat([].slice.call(it)));return this._r=nt._r,this._g=nt._g,this._b=nt._b,this.setAlpha(nt._a),this},lighten:function(){return this._applyModification(k,arguments)},brighten:function(){return this._applyModification(M,arguments)},darken:function(){return this._applyModification(T,arguments)},desaturate:function(){return this._applyModification(x,arguments)},saturate:function(){return this._applyModification(y,arguments)},greyscale:function(){return this._applyModification(S,arguments)},spin:function(){return this._applyModification(c,arguments)},_applyCombination:function(q,it){return q.apply(null,[this].concat([].slice.call(it)))},analogous:function(){return this._applyCombination(z,arguments)},complement:function(){return this._applyCombination(h,arguments)},monochromatic:function(){return this._applyCombination(D,arguments)},splitcomplement:function(){return this._applyCombination(P,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(_,arguments)}},n.fromRatio=function(q,it){if(typeof q=="object"){var nt={};for(var dt in q)q.hasOwnProperty(dt)&&(dt==="a"?nt[dt]=q[dt]:nt[dt]=et(q[dt]));q=nt}return n(q,it)};function o(q){var it={r:0,g:0,b:0},nt=1,dt=null,Tt=null,wt=null,Ct=!1,It=!1;return typeof q=="string"&&(q=ut(q)),typeof q=="object"&&(Q(q.r)&&Q(q.g)&&Q(q.b)?(it=a(q.r,q.g,q.b),Ct=!0,It=String(q.r).substr(-1)==="%"?"prgb":"rgb"):Q(q.h)&&Q(q.s)&&Q(q.v)?(dt=et(q.s),Tt=et(q.v),it=g(q.h,dt,Tt),Ct=!0,It="hsv"):Q(q.h)&&Q(q.s)&&Q(q.l)&&(dt=et(q.s),wt=et(q.l),it=f(q.h,dt,wt),Ct=!0,It="hsl"),q.hasOwnProperty("a")&&(nt=q.a)),nt=F(nt),{ok:Ct,format:q.format||It,r:e(255,r(it.r,0)),g:e(255,r(it.g,0)),b:e(255,r(it.b,0)),a:nt}}function a(q,it,nt){return{r:j(q,255)*255,g:j(it,255)*255,b:j(nt,255)*255}}function s(q,it,nt){q=j(q,255),it=j(it,255),nt=j(nt,255);var dt=r(q,it,nt),Tt=e(q,it,nt),wt,Ct,It=(dt+Tt)/2;if(dt==Tt)wt=Ct=0;else{var Nt=dt-Tt;switch(Ct=It>.5?Nt/(2-dt-Tt):Nt/(dt+Tt),dt){case q:wt=(it-nt)/Nt+(it1&&(ee-=1),ee<1/6?te+(Jt-te)*6*ee:ee<1/2?Jt:ee<2/3?te+(Jt-te)*(2/3-ee)*6:te}if(it===0)dt=Tt=wt=nt;else{var It=nt<.5?nt*(1+it):nt+it-nt*it,Nt=2*nt-It;dt=Ct(Nt,It,q+1/3),Tt=Ct(Nt,It,q),wt=Ct(Nt,It,q-1/3)}return{r:dt*255,g:Tt*255,b:wt*255}}function v(q,it,nt){q=j(q,255),it=j(it,255),nt=j(nt,255);var dt=r(q,it,nt),Tt=e(q,it,nt),wt,Ct,It=dt,Nt=dt-Tt;if(Ct=dt===0?0:Nt/dt,dt==Tt)wt=0;else{switch(dt){case q:wt=(it-nt)/Nt+(it>1)+720)%360;--it;)dt.h=(dt.h+Tt)%360,wt.push(n(dt));return wt}function D(q,it){it=it||6;for(var nt=n(q).toHsv(),dt=nt.h,Tt=nt.s,wt=nt.v,Ct=[],It=1/it;it--;)Ct.push(n({h:dt,s:Tt,v:wt})),wt=(wt+It)%1;return Ct}n.mix=function(q,it,nt){nt=nt===0?0:nt||50;var dt=n(q).toRgb(),Tt=n(it).toRgb(),wt=nt/100,Ct={r:(Tt.r-dt.r)*wt+dt.r,g:(Tt.g-dt.g)*wt+dt.g,b:(Tt.b-dt.b)*wt+dt.b,a:(Tt.a-dt.a)*wt+dt.a};return n(Ct)},n.readability=function(q,it){var nt=n(q),dt=n(it);return(u.max(nt.getLuminance(),dt.getLuminance())+.05)/(u.min(nt.getLuminance(),dt.getLuminance())+.05)},n.isReadable=function(q,it,nt){var dt=n.readability(q,it),Tt,wt;switch(wt=!1,Tt=J(nt),Tt.level+Tt.size){case"AAsmall":case"AAAlarge":wt=dt>=4.5;break;case"AAlarge":wt=dt>=3;break;case"AAAsmall":wt=dt>=7;break}return wt},n.mostReadable=function(q,it,nt){var dt=null,Tt=0,wt,Ct,It,Nt;nt=nt||{},Ct=nt.includeFallbackColors,It=nt.level,Nt=nt.size;for(var te=0;teTt&&(Tt=wt,dt=n(it[te]));return n.isReadable(q,dt,{level:It,size:Nt})||!Ct?dt:(nt.includeFallbackColors=!1,n.mostReadable(q,["#fff","#000"],nt))};var B=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},R=n.hexNames=I(B);function I(q){var it={};for(var nt in q)q.hasOwnProperty(nt)&&(it[q[nt]]=nt);return it}function F(q){return q=parseFloat(q),(isNaN(q)||q<0||q>1)&&(q=1),q}function j(q,it){rt(q)&&(q="100%");var nt=ct(q);return q=e(it,r(0,parseFloat(q))),nt&&(q=parseInt(q*it,10)/100),u.abs(q-it)<1e-6?1:q%it/parseFloat(it)}function N(q){return e(1,r(0,q))}function G(q){return parseInt(q,16)}function rt(q){return typeof q=="string"&&q.indexOf(".")!=-1&&parseFloat(q)===1}function ct(q){return typeof q=="string"&&q.indexOf("%")!=-1}function st(q){return q.length==1?"0"+q:""+q}function et(q){return q<=1&&(q=q*100+"%"),q}function Z(q){return u.round(parseFloat(q)*255).toString(16)}function ot(q){return G(q)/255}var X=(function(){var q="[-\\+]?\\d+%?",it="[-\\+]?\\d*\\.\\d+%?",nt="(?:"+it+")|(?:"+q+")",dt="[\\s|\\(]+("+nt+")[,|\\s]+("+nt+")[,|\\s]+("+nt+")\\s*\\)?",Tt="[\\s|\\(]+("+nt+")[,|\\s]+("+nt+")[,|\\s]+("+nt+")[,|\\s]+("+nt+")\\s*\\)?";return{CSS_UNIT:new RegExp(nt),rgb:new RegExp("rgb"+dt),rgba:new RegExp("rgba"+Tt),hsl:new RegExp("hsl"+dt),hsla:new RegExp("hsla"+Tt),hsv:new RegExp("hsv"+dt),hsva:new RegExp("hsva"+Tt),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function Q(q){return!!X.CSS_UNIT.exec(q)}function ut(q){q=q.replace(d,"").replace(E,"").toLowerCase();var it=!1;if(B[q])q=B[q],it=!0;else if(q=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var nt;return(nt=X.rgb.exec(q))?{r:nt[1],g:nt[2],b:nt[3]}:(nt=X.rgba.exec(q))?{r:nt[1],g:nt[2],b:nt[3],a:nt[4]}:(nt=X.hsl.exec(q))?{h:nt[1],s:nt[2],l:nt[3]}:(nt=X.hsla.exec(q))?{h:nt[1],s:nt[2],l:nt[3],a:nt[4]}:(nt=X.hsv.exec(q))?{h:nt[1],s:nt[2],v:nt[3]}:(nt=X.hsva.exec(q))?{h:nt[1],s:nt[2],v:nt[3],a:nt[4]}:(nt=X.hex8.exec(q))?{r:G(nt[1]),g:G(nt[2]),b:G(nt[3]),a:ot(nt[4]),format:it?"name":"hex8"}:(nt=X.hex6.exec(q))?{r:G(nt[1]),g:G(nt[2]),b:G(nt[3]),format:it?"name":"hex"}:(nt=X.hex4.exec(q))?{r:G(nt[1]+""+nt[1]),g:G(nt[2]+""+nt[2]),b:G(nt[3]+""+nt[3]),a:ot(nt[4]+""+nt[4]),format:it?"name":"hex8"}:(nt=X.hex3.exec(q))?{r:G(nt[1]+""+nt[1]),g:G(nt[2]+""+nt[2]),b:G(nt[3]+""+nt[3]),format:it?"name":"hex"}:!1}function J(q){var it,nt;return q=q||{level:"AA",size:"small"},it=(q.level||"AA").toUpperCase(),nt=(q.size||"small").toLowerCase(),it!=="AA"&&it!=="AAA"&&(it="AA"),nt!=="small"&&nt!=="large"&&(nt="small"),{level:it,size:nt}}typeof V<"u"&&V.exports?V.exports=n:window.tinycolor=n})(Math)}),So=Vt(K=>{var V=Fp(),u=Array.isArray;function d(A,t){var e,r;for(e=0;e{V.exports=function(u){var d=u.variantValues,E=u.editType,A=u.colorEditType;A===void 0&&(A=E);var t={editType:E,valType:"integer",min:1,max:1e3,extras:["normal","bold"],dflt:"normal"};u.noNumericWeightValues&&(t.valType="enumerated",t.values=t.extras,t.extras=void 0,t.min=void 0,t.max=void 0);var e={family:{valType:"string",noBlank:!0,strict:!0,editType:E},size:{valType:"number",min:1,editType:E},color:{valType:"color",editType:A},weight:t,style:{editType:E,valType:"enumerated",values:["normal","italic"],dflt:"normal"},variant:u.noFontVariant?void 0:{editType:E,valType:"enumerated",values:d||["normal","small-caps","all-small-caps","all-petite-caps","petite-caps","unicase"],dflt:"normal"},textcase:u.noFontTextcase?void 0:{editType:E,valType:"enumerated",values:["normal","word caps","upper","lower"],dflt:"normal"},lineposition:u.noFontLineposition?void 0:{editType:E,valType:"flaglist",flags:["under","over","through"],extras:["none"],dflt:"none"},shadow:u.noFontShadow?void 0:{editType:E,valType:"string",dflt:u.autoShadowDflt?"auto":"none"},editType:E};return u.autoSize&&(e.size.dflt="auto"),u.autoColor&&(e.color.dflt="auto"),u.arrayOk&&(e.family.arrayOk=!0,e.weight.arrayOk=!0,e.style.arrayOk=!0,u.noFontVariant||(e.variant.arrayOk=!0),u.noFontTextcase||(e.textcase.arrayOk=!0),u.noFontLineposition||(e.lineposition.arrayOk=!0),u.noFontShadow||(e.shadow.arrayOk=!0),e.size.arrayOk=!0,e.color.arrayOk=!0),e}}),Dg=Vt((K,V)=>{V.exports={YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,HOVERID:"-hover"}}),_d=Vt((K,V)=>{var u=Dg(),d=yu(),E=d({editType:"none"});E.family.dflt=u.HOVERFONT,E.size.dflt=u.HOVERFONTSIZE,V.exports={clickmode:{valType:"flaglist",flags:["event","select"],dflt:"event",editType:"plot",extras:["none"]},dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","drawclosedpath","drawopenpath","drawline","drawrect","drawcircle","orbit","turntable",!1],dflt:"zoom",editType:"modebar"},hovermode:{valType:"enumerated",values:["x","y","closest",!1,"x unified","y unified"],dflt:"closest",editType:"modebar"},hoversubplots:{valType:"enumerated",values:["single","overlaying","axis"],dflt:"overlaying",editType:"none"},hoverdistance:{valType:"integer",min:-1,dflt:20,editType:"none"},spikedistance:{valType:"integer",min:-1,dflt:-1,editType:"none"},hoverlabel:{bgcolor:{valType:"color",editType:"none"},bordercolor:{valType:"color",editType:"none"},font:E,grouptitlefont:d({editType:"none"}),align:{valType:"enumerated",values:["left","right","auto"],dflt:"auto",editType:"none"},namelength:{valType:"integer",min:-1,dflt:15,editType:"none"},showarrow:{valType:"boolean",dflt:!0,editType:"none"},editType:"none"},selectdirection:{valType:"enumerated",values:["h","v","d","any"],dflt:"any",editType:"none"}}}),vm=Vt((K,V)=>{var u=yu(),d=_d().hoverlabel,E=So().extendFlat;V.exports={hoverlabel:{bgcolor:E({},d.bgcolor,{arrayOk:!0}),bordercolor:E({},d.bordercolor,{arrayOk:!0}),font:u({arrayOk:!0,editType:"none"}),align:E({},d.align,{arrayOk:!0}),namelength:E({},d.namelength,{arrayOk:!0}),showarrow:E({},d.showarrow),editType:"none"}}}),kl=Vt((K,V)=>{var u=yu(),d=vm();V.exports={type:{valType:"enumerated",values:[],dflt:"scatter",editType:"calc+clearAxisTypes",_noTemplating:!0},visible:{valType:"enumerated",values:[!0,!1,"legendonly"],dflt:!0,editType:"calc"},showlegend:{valType:"boolean",dflt:!0,editType:"style"},legend:{valType:"subplotid",dflt:"legend",editType:"style"},legendgroup:{valType:"string",dflt:"",editType:"style"},legendgrouptitle:{text:{valType:"string",dflt:"",editType:"style"},font:u({editType:"style"}),editType:"style"},legendrank:{valType:"number",dflt:1e3,editType:"style"},legendwidth:{valType:"number",min:0,editType:"style"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"style"},name:{valType:"string",editType:"style"},uid:{valType:"string",editType:"plot",anim:!0},ids:{valType:"data_array",editType:"calc",anim:!0},customdata:{valType:"data_array",editType:"calc"},meta:{valType:"any",arrayOk:!0,editType:"plot"},selectedpoints:{valType:"any",editType:"calc"},hoverinfo:{valType:"flaglist",flags:["x","y","z","text","name"],extras:["all","none","skip"],arrayOk:!0,dflt:"all",editType:"none"},hoverlabel:d.hoverlabel,stream:{token:{valType:"string",noBlank:!0,strict:!0,editType:"calc"},maxpoints:{valType:"number",min:0,max:1e4,dflt:500,editType:"calc"},editType:"calc"},uirevision:{valType:"any",editType:"none"}}}),o0=Vt((K,V)=>{var u=Af(),d={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]],Cividis:[[0,"rgb(0,32,76)"],[.058824,"rgb(0,42,102)"],[.117647,"rgb(0,52,110)"],[.176471,"rgb(39,63,108)"],[.235294,"rgb(60,74,107)"],[.294118,"rgb(76,85,107)"],[.352941,"rgb(91,95,109)"],[.411765,"rgb(104,106,112)"],[.470588,"rgb(117,117,117)"],[.529412,"rgb(131,129,120)"],[.588235,"rgb(146,140,120)"],[.647059,"rgb(161,152,118)"],[.705882,"rgb(176,165,114)"],[.764706,"rgb(192,177,109)"],[.823529,"rgb(209,191,102)"],[.882353,"rgb(225,204,92)"],[.941176,"rgb(243,219,79)"],[1,"rgb(255,233,69)"]]},E=d.RdBu;function A(r,i){if(i||(i=E),!r)return i;function n(){try{r=d[r]||JSON.parse(r)}catch{r=i}}return typeof r=="string"&&(n(),typeof r=="string"&&n()),t(r)?r:i}function t(r){var i=0;if(!Array.isArray(r)||r.length<2||!r[0]||!r[r.length-1]||+r[0][0]!=0||+r[r.length-1][0]!=1)return!1;for(var n=0;n{K.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],K.defaultLine="#444",K.lightLine="#eee",K.background="#fff",K.borderLine="#BEC8D9",K.lightFraction=1e3/11}),Pi=Vt((K,V)=>{var u=Af(),d=Lo(),E=nh().isTypedArray,A=V.exports={},t=af();A.defaults=t.defaults;var e=A.defaultLine=t.defaultLine;A.lightLine=t.lightLine;var r=A.background=t.background;A.tinyRGB=function(n){var o=n.toRgb();return"rgb("+Math.round(o.r)+", "+Math.round(o.g)+", "+Math.round(o.b)+")"},A.rgb=function(n){return A.tinyRGB(u(n))},A.opacity=function(n){return n?u(n).getAlpha():0},A.addOpacity=function(n,o){var a=u(n).toRgb();return"rgba("+Math.round(a.r)+", "+Math.round(a.g)+", "+Math.round(a.b)+", "+o+")"},A.combine=function(n,o){var a=u(n).toRgb();if(a.a===1)return u(n).toRgbString();var s=u(o||r).toRgb(),f=s.a===1?s:{r:255*(1-s.a)+s.r*s.a,g:255*(1-s.a)+s.g*s.a,b:255*(1-s.a)+s.b*s.a},v={r:f.r*(1-a.a)+a.r*a.a,g:f.g*(1-a.a)+a.g*a.a,b:f.b*(1-a.a)+a.b*a.a};return u(v).toRgbString()},A.interpolate=function(n,o,a){var s=u(n).toRgb(),f=u(o).toRgb(),v={r:a*s.r+(1-a)*f.r,g:a*s.g+(1-a)*f.g,b:a*s.b+(1-a)*f.b};return u(v).toRgbString()},A.contrast=function(n,o,a){var s=u(n);s.getAlpha()!==1&&(s=u(A.combine(n,r)));var f=s.isDark()?o?s.lighten(o):r:a?s.darken(a):e;return f.toString()},A.stroke=function(n,o){var a=u(o);n.style({stroke:A.tinyRGB(a),"stroke-opacity":a.getAlpha()})},A.fill=function(n,o){var a=u(o);n.style({fill:A.tinyRGB(a),"fill-opacity":a.getAlpha()})},A.clean=function(n){if(!(!n||typeof n!="object")){var o=Object.keys(n),a,s,f,v;for(a=0;a=0)))return n;if(v===3)s[v]>1&&(s[v]=1);else if(s[v]>=1)return n}var g=Math.round(s[0]*255)+", "+Math.round(s[1]*255)+", "+Math.round(s[2]*255);return f?"rgba("+g+", "+s[3]+")":"rgb("+g+")"}}),bd=Vt((K,V)=>{V.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}}),ym=Vt(K=>{K.counter=function(V,u,d,E){var A=(u||"")+(d?"":"$"),t=E===!1?"":"^";return V==="xy"?new RegExp(t+"x([2-9]|[1-9][0-9]+)?y([2-9]|[1-9][0-9]+)?"+A):new RegExp(t+V+"([2-9]|[1-9][0-9]+)?"+A)}}),Q4=Vt(K=>{var V=Lo(),u=Af(),d=So().extendFlat,E=kl(),A=o0(),t=Pi(),e=bd().DESELECTDIM,r=Og(),i=ym().counter,n=gm().modHalf,o=nh().isArrayOrTypedArray,a=nh().isTypedArraySpec,s=nh().decodeTypedArraySpec;K.valObjectMeta={data_array:{coerceFunction:function(v,g,m){g.set(o(v)?v:a(v)?s(v):m)}},enumerated:{coerceFunction:function(v,g,m,w){w.coerceNumber&&(v=+v),w.values.indexOf(v)===-1?g.set(m):g.set(v)},validateFunction:function(v,g){g.coerceNumber&&(v=+v);for(var m=g.values,w=0;wx===!0||x===!1;l(v)||w.arrayOk&&Array.isArray(v)&&v.length>0&&v.every(l)?g.set(v):g.set(m)}},number:{coerceFunction:function(v,g,m,w){a(v)&&(v=s(v)),!V(v)||w.min!==void 0&&vw.max?g.set(m):g.set(+v)}},integer:{coerceFunction:function(v,g,m,w){if((w.extras||[]).indexOf(v)!==-1){g.set(v);return}a(v)&&(v=s(v)),v%1||!V(v)||w.min!==void 0&&vw.max?g.set(m):g.set(+v)}},string:{coerceFunction:function(v,g,m,w){if(typeof v!="string"){var l=typeof v=="number";w.strict===!0||!l?g.set(m):g.set(String(v))}else w.noBlank&&!v?g.set(m):g.set(v)}},color:{coerceFunction:function(v,g,m){a(v)&&(v=s(v)),u(v).isValid()?g.set(v):g.set(m)}},colorlist:{coerceFunction:function(v,g,m){function w(l){return u(l).isValid()}!Array.isArray(v)||!v.length?g.set(m):v.every(w)?g.set(v):g.set(m)}},colorscale:{coerceFunction:function(v,g,m){g.set(A.get(v,m))}},angle:{coerceFunction:function(v,g,m){a(v)&&(v=s(v)),v==="auto"?g.set("auto"):V(v)?g.set(n(+v,360)):g.set(m)}},subplotid:{coerceFunction:function(v,g,m,w){var l=w.regex||i(m);let x=y=>typeof y=="string"&&l.test(y);x(v)||w.arrayOk&&o(v)&&v.length>0&&v.every(x)?g.set(v):g.set(m)},validateFunction:function(v,g){var m=g.dflt;return v===m?!0:typeof v!="string"?!1:!!i(m).test(v)}},flaglist:{coerceFunction:function(v,g,m,w){if((w.extras||[]).indexOf(v)!==-1){g.set(v);return}if(typeof v!="string"){g.set(m);return}for(var l=v.split("+"),x=0;x{var u={staticPlot:{valType:"boolean",dflt:!1},typesetMath:{valType:"boolean",dflt:!0},plotlyServerURL:{valType:"string",dflt:""},editable:{valType:"boolean",dflt:!1},edits:{annotationPosition:{valType:"boolean",dflt:!1},annotationTail:{valType:"boolean",dflt:!1},annotationText:{valType:"boolean",dflt:!1},axisTitleText:{valType:"boolean",dflt:!1},colorbarPosition:{valType:"boolean",dflt:!1},colorbarTitleText:{valType:"boolean",dflt:!1},legendPosition:{valType:"boolean",dflt:!1},legendText:{valType:"boolean",dflt:!1},shapePosition:{valType:"boolean",dflt:!1},titleText:{valType:"boolean",dflt:!1}},editSelection:{valType:"boolean",dflt:!0},autosizable:{valType:"boolean",dflt:!1},responsive:{valType:"boolean",dflt:!1},fillFrame:{valType:"boolean",dflt:!1},frameMargins:{valType:"number",dflt:0,min:0,max:.5},scrollZoom:{valType:"flaglist",flags:["cartesian","gl3d","geo","mapbox","map"],extras:[!0,!1],dflt:"gl3d+geo+map"},doubleClick:{valType:"enumerated",values:[!1,"reset","autosize","reset+autosize"],dflt:"reset+autosize"},doubleClickDelay:{valType:"number",dflt:300,min:0},showAxisDragHandles:{valType:"boolean",dflt:!0},showAxisRangeEntryBoxes:{valType:"boolean",dflt:!0},showTips:{valType:"boolean",dflt:!0},showLink:{valType:"boolean",dflt:!1},linkText:{valType:"string",dflt:"Edit chart",noBlank:!0},sendData:{valType:"boolean",dflt:!0},showSources:{valType:"any",dflt:!1},displayModeBar:{valType:"enumerated",values:["hover",!0,!1],dflt:"hover"},showSendToCloud:{valType:"boolean",dflt:!1},showEditInChartStudio:{valType:"boolean",dflt:!1},modeBarButtonsToRemove:{valType:"any",dflt:[]},modeBarButtonsToAdd:{valType:"any",dflt:[]},modeBarButtons:{valType:"any",dflt:!1},toImageButtonOptions:{valType:"any",dflt:{}},displaylogo:{valType:"boolean",dflt:!0},watermark:{valType:"boolean",dflt:!1},plotGlPixelRatio:{valType:"number",dflt:2,min:1,max:4},setBackground:{valType:"any",dflt:"transparent"},topojsonURL:{valType:"string",noBlank:!0,dflt:"https://cdn.plot.ly/un/"},mapboxAccessToken:{valType:"string",dflt:null},logging:{valType:"integer",min:0,max:2,dflt:1},notifyOnLogging:{valType:"integer",min:0,max:2,dflt:0},queueLength:{valType:"integer",min:0,dflt:0},locale:{valType:"string",dflt:"en-US"},locales:{valType:"any",dflt:{}}},d={};function E(A,t){for(var e in A){var r=A[e];r.valType?t[e]=r.dflt:(t[e]||(t[e]={}),E(r,t[e]))}}E(u,d),V.exports={configAttributes:u,dfltConfig:d}}),rb=Vt((K,V)=>{var u=Ni(),d=Lo(),E=[];V.exports=function(A,t){if(E.indexOf(A)!==-1)return;E.push(A);var e=1e3;d(t)?e=t:t==="long"&&(e=3e3);var r=u.select("body").selectAll(".plotly-notifier").data([0]);r.enter().append("div").classed("plotly-notifier",!0);var i=r.selectAll(".notifier-note").data(E);function n(o){o.duration(700).style("opacity",0).each("end",function(a){var s=E.indexOf(a);s!==-1&&E.splice(s,1),u.select(this).remove()})}i.enter().append("div").classed("notifier-note",!0).style("opacity",0).each(function(o){var a=u.select(this);a.append("button").classed("notifier-close",!0).html("×").on("click",function(){a.transition().call(n)});for(var s=a.append("p"),f=o.split(//g),v=0;v{var u=s0().dfltConfig,d=rb(),E=V.exports={};E.log=function(){var A;if(u.logging>1){var t=["LOG:"];for(A=0;A1){var e=[];for(A=0;A"),"long")}},E.warn=function(){var A;if(u.logging>0){var t=["WARN:"];for(A=0;A0){var e=[];for(A=0;A"),"stick")}},E.error=function(){var A;if(u.logging>0){var t=["ERROR:"];for(A=0;A0){var e=[];for(A=0;A"),"stick")}}}),Ry=Vt((K,V)=>{V.exports=function(){}}),nb=Vt((K,V)=>{V.exports=function(u,d){if(d instanceof RegExp){for(var E=d.toString(),A=0;A{V.exports=u;function u(){var d=new Float32Array(16);return d[0]=1,d[1]=0,d[2]=0,d[3]=0,d[4]=0,d[5]=1,d[6]=0,d[7]=0,d[8]=0,d[9]=0,d[10]=1,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,d}}),eT=Vt((K,V)=>{V.exports=u;function u(d){var E=new Float32Array(16);return E[0]=d[0],E[1]=d[1],E[2]=d[2],E[3]=d[3],E[4]=d[4],E[5]=d[5],E[6]=d[6],E[7]=d[7],E[8]=d[8],E[9]=d[9],E[10]=d[10],E[11]=d[11],E[12]=d[12],E[13]=d[13],E[14]=d[14],E[15]=d[15],E}}),rT=Vt((K,V)=>{V.exports=u;function u(d,E){return d[0]=E[0],d[1]=E[1],d[2]=E[2],d[3]=E[3],d[4]=E[4],d[5]=E[5],d[6]=E[6],d[7]=E[7],d[8]=E[8],d[9]=E[9],d[10]=E[10],d[11]=E[11],d[12]=E[12],d[13]=E[13],d[14]=E[14],d[15]=E[15],d}}),ab=Vt((K,V)=>{V.exports=u;function u(d){return d[0]=1,d[1]=0,d[2]=0,d[3]=0,d[4]=0,d[5]=1,d[6]=0,d[7]=0,d[8]=0,d[9]=0,d[10]=1,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,d}}),nT=Vt((K,V)=>{V.exports=u;function u(d,E){if(d===E){var A=E[1],t=E[2],e=E[3],r=E[6],i=E[7],n=E[11];d[1]=E[4],d[2]=E[8],d[3]=E[12],d[4]=A,d[6]=E[9],d[7]=E[13],d[8]=t,d[9]=r,d[11]=E[14],d[12]=e,d[13]=i,d[14]=n}else d[0]=E[0],d[1]=E[4],d[2]=E[8],d[3]=E[12],d[4]=E[1],d[5]=E[5],d[6]=E[9],d[7]=E[13],d[8]=E[2],d[9]=E[6],d[10]=E[10],d[11]=E[14],d[12]=E[3],d[13]=E[7],d[14]=E[11],d[15]=E[15];return d}}),aT=Vt((K,V)=>{V.exports=u;function u(d,E){var A=E[0],t=E[1],e=E[2],r=E[3],i=E[4],n=E[5],o=E[6],a=E[7],s=E[8],f=E[9],v=E[10],g=E[11],m=E[12],w=E[13],l=E[14],x=E[15],y=A*n-t*i,S=A*o-e*i,k=A*a-r*i,M=t*o-e*n,T=t*a-r*n,c=e*a-r*o,h=s*w-f*m,b=s*l-v*m,_=s*x-g*m,P=f*l-v*w,z=f*x-g*w,D=v*x-g*l,B=y*D-S*z+k*P+M*_-T*b+c*h;return B?(B=1/B,d[0]=(n*D-o*z+a*P)*B,d[1]=(e*z-t*D-r*P)*B,d[2]=(w*c-l*T+x*M)*B,d[3]=(v*T-f*c-g*M)*B,d[4]=(o*_-i*D-a*b)*B,d[5]=(A*D-e*_+r*b)*B,d[6]=(l*k-m*c-x*S)*B,d[7]=(s*c-v*k+g*S)*B,d[8]=(i*z-n*_+a*h)*B,d[9]=(t*_-A*z-r*h)*B,d[10]=(m*T-w*k+x*y)*B,d[11]=(f*k-s*T-g*y)*B,d[12]=(n*b-i*P-o*h)*B,d[13]=(A*P-t*b+e*h)*B,d[14]=(w*S-m*M-l*y)*B,d[15]=(s*M-f*S+v*y)*B,d):null}}),iT=Vt((K,V)=>{V.exports=u;function u(d,E){var A=E[0],t=E[1],e=E[2],r=E[3],i=E[4],n=E[5],o=E[6],a=E[7],s=E[8],f=E[9],v=E[10],g=E[11],m=E[12],w=E[13],l=E[14],x=E[15];return d[0]=n*(v*x-g*l)-f*(o*x-a*l)+w*(o*g-a*v),d[1]=-(t*(v*x-g*l)-f*(e*x-r*l)+w*(e*g-r*v)),d[2]=t*(o*x-a*l)-n*(e*x-r*l)+w*(e*a-r*o),d[3]=-(t*(o*g-a*v)-n*(e*g-r*v)+f*(e*a-r*o)),d[4]=-(i*(v*x-g*l)-s*(o*x-a*l)+m*(o*g-a*v)),d[5]=A*(v*x-g*l)-s*(e*x-r*l)+m*(e*g-r*v),d[6]=-(A*(o*x-a*l)-i*(e*x-r*l)+m*(e*a-r*o)),d[7]=A*(o*g-a*v)-i*(e*g-r*v)+s*(e*a-r*o),d[8]=i*(f*x-g*w)-s*(n*x-a*w)+m*(n*g-a*f),d[9]=-(A*(f*x-g*w)-s*(t*x-r*w)+m*(t*g-r*f)),d[10]=A*(n*x-a*w)-i*(t*x-r*w)+m*(t*a-r*n),d[11]=-(A*(n*g-a*f)-i*(t*g-r*f)+s*(t*a-r*n)),d[12]=-(i*(f*l-v*w)-s*(n*l-o*w)+m*(n*v-o*f)),d[13]=A*(f*l-v*w)-s*(t*l-e*w)+m*(t*v-e*f),d[14]=-(A*(n*l-o*w)-i*(t*l-e*w)+m*(t*o-e*n)),d[15]=A*(n*v-o*f)-i*(t*v-e*f)+s*(t*o-e*n),d}}),oT=Vt((K,V)=>{V.exports=u;function u(d){var E=d[0],A=d[1],t=d[2],e=d[3],r=d[4],i=d[5],n=d[6],o=d[7],a=d[8],s=d[9],f=d[10],v=d[11],g=d[12],m=d[13],w=d[14],l=d[15],x=E*i-A*r,y=E*n-t*r,S=E*o-e*r,k=A*n-t*i,M=A*o-e*i,T=t*o-e*n,c=a*m-s*g,h=a*w-f*g,b=a*l-v*g,_=s*w-f*m,P=s*l-v*m,z=f*l-v*w;return x*z-y*P+S*_+k*b-M*h+T*c}}),sT=Vt((K,V)=>{V.exports=u;function u(d,E,A){var t=E[0],e=E[1],r=E[2],i=E[3],n=E[4],o=E[5],a=E[6],s=E[7],f=E[8],v=E[9],g=E[10],m=E[11],w=E[12],l=E[13],x=E[14],y=E[15],S=A[0],k=A[1],M=A[2],T=A[3];return d[0]=S*t+k*n+M*f+T*w,d[1]=S*e+k*o+M*v+T*l,d[2]=S*r+k*a+M*g+T*x,d[3]=S*i+k*s+M*m+T*y,S=A[4],k=A[5],M=A[6],T=A[7],d[4]=S*t+k*n+M*f+T*w,d[5]=S*e+k*o+M*v+T*l,d[6]=S*r+k*a+M*g+T*x,d[7]=S*i+k*s+M*m+T*y,S=A[8],k=A[9],M=A[10],T=A[11],d[8]=S*t+k*n+M*f+T*w,d[9]=S*e+k*o+M*v+T*l,d[10]=S*r+k*a+M*g+T*x,d[11]=S*i+k*s+M*m+T*y,S=A[12],k=A[13],M=A[14],T=A[15],d[12]=S*t+k*n+M*f+T*w,d[13]=S*e+k*o+M*v+T*l,d[14]=S*r+k*a+M*g+T*x,d[15]=S*i+k*s+M*m+T*y,d}}),lT=Vt((K,V)=>{V.exports=u;function u(d,E,A){var t=A[0],e=A[1],r=A[2],i,n,o,a,s,f,v,g,m,w,l,x;return E===d?(d[12]=E[0]*t+E[4]*e+E[8]*r+E[12],d[13]=E[1]*t+E[5]*e+E[9]*r+E[13],d[14]=E[2]*t+E[6]*e+E[10]*r+E[14],d[15]=E[3]*t+E[7]*e+E[11]*r+E[15]):(i=E[0],n=E[1],o=E[2],a=E[3],s=E[4],f=E[5],v=E[6],g=E[7],m=E[8],w=E[9],l=E[10],x=E[11],d[0]=i,d[1]=n,d[2]=o,d[3]=a,d[4]=s,d[5]=f,d[6]=v,d[7]=g,d[8]=m,d[9]=w,d[10]=l,d[11]=x,d[12]=i*t+s*e+m*r+E[12],d[13]=n*t+f*e+w*r+E[13],d[14]=o*t+v*e+l*r+E[14],d[15]=a*t+g*e+x*r+E[15]),d}}),uT=Vt((K,V)=>{V.exports=u;function u(d,E,A){var t=A[0],e=A[1],r=A[2];return d[0]=E[0]*t,d[1]=E[1]*t,d[2]=E[2]*t,d[3]=E[3]*t,d[4]=E[4]*e,d[5]=E[5]*e,d[6]=E[6]*e,d[7]=E[7]*e,d[8]=E[8]*r,d[9]=E[9]*r,d[10]=E[10]*r,d[11]=E[11]*r,d[12]=E[12],d[13]=E[13],d[14]=E[14],d[15]=E[15],d}}),cT=Vt((K,V)=>{V.exports=u;function u(d,E,A,t){var e=t[0],r=t[1],i=t[2],n=Math.sqrt(e*e+r*r+i*i),o,a,s,f,v,g,m,w,l,x,y,S,k,M,T,c,h,b,_,P,z,D,B,R;return Math.abs(n)<1e-6?null:(n=1/n,e*=n,r*=n,i*=n,o=Math.sin(A),a=Math.cos(A),s=1-a,f=E[0],v=E[1],g=E[2],m=E[3],w=E[4],l=E[5],x=E[6],y=E[7],S=E[8],k=E[9],M=E[10],T=E[11],c=e*e*s+a,h=r*e*s+i*o,b=i*e*s-r*o,_=e*r*s-i*o,P=r*r*s+a,z=i*r*s+e*o,D=e*i*s+r*o,B=r*i*s-e*o,R=i*i*s+a,d[0]=f*c+w*h+S*b,d[1]=v*c+l*h+k*b,d[2]=g*c+x*h+M*b,d[3]=m*c+y*h+T*b,d[4]=f*_+w*P+S*z,d[5]=v*_+l*P+k*z,d[6]=g*_+x*P+M*z,d[7]=m*_+y*P+T*z,d[8]=f*D+w*B+S*R,d[9]=v*D+l*B+k*R,d[10]=g*D+x*B+M*R,d[11]=m*D+y*B+T*R,E!==d&&(d[12]=E[12],d[13]=E[13],d[14]=E[14],d[15]=E[15]),d)}}),fT=Vt((K,V)=>{V.exports=u;function u(d,E,A){var t=Math.sin(A),e=Math.cos(A),r=E[4],i=E[5],n=E[6],o=E[7],a=E[8],s=E[9],f=E[10],v=E[11];return E!==d&&(d[0]=E[0],d[1]=E[1],d[2]=E[2],d[3]=E[3],d[12]=E[12],d[13]=E[13],d[14]=E[14],d[15]=E[15]),d[4]=r*e+a*t,d[5]=i*e+s*t,d[6]=n*e+f*t,d[7]=o*e+v*t,d[8]=a*e-r*t,d[9]=s*e-i*t,d[10]=f*e-n*t,d[11]=v*e-o*t,d}}),hT=Vt((K,V)=>{V.exports=u;function u(d,E,A){var t=Math.sin(A),e=Math.cos(A),r=E[0],i=E[1],n=E[2],o=E[3],a=E[8],s=E[9],f=E[10],v=E[11];return E!==d&&(d[4]=E[4],d[5]=E[5],d[6]=E[6],d[7]=E[7],d[12]=E[12],d[13]=E[13],d[14]=E[14],d[15]=E[15]),d[0]=r*e-a*t,d[1]=i*e-s*t,d[2]=n*e-f*t,d[3]=o*e-v*t,d[8]=r*t+a*e,d[9]=i*t+s*e,d[10]=n*t+f*e,d[11]=o*t+v*e,d}}),pT=Vt((K,V)=>{V.exports=u;function u(d,E,A){var t=Math.sin(A),e=Math.cos(A),r=E[0],i=E[1],n=E[2],o=E[3],a=E[4],s=E[5],f=E[6],v=E[7];return E!==d&&(d[8]=E[8],d[9]=E[9],d[10]=E[10],d[11]=E[11],d[12]=E[12],d[13]=E[13],d[14]=E[14],d[15]=E[15]),d[0]=r*e+a*t,d[1]=i*e+s*t,d[2]=n*e+f*t,d[3]=o*e+v*t,d[4]=a*e-r*t,d[5]=s*e-i*t,d[6]=f*e-n*t,d[7]=v*e-o*t,d}}),dT=Vt((K,V)=>{V.exports=u;function u(d,E,A){var t,e,r,i=A[0],n=A[1],o=A[2],a=Math.sqrt(i*i+n*n+o*o);return Math.abs(a)<1e-6?null:(a=1/a,i*=a,n*=a,o*=a,t=Math.sin(E),e=Math.cos(E),r=1-e,d[0]=i*i*r+e,d[1]=n*i*r+o*t,d[2]=o*i*r-n*t,d[3]=0,d[4]=i*n*r-o*t,d[5]=n*n*r+e,d[6]=o*n*r+i*t,d[7]=0,d[8]=i*o*r+n*t,d[9]=n*o*r-i*t,d[10]=o*o*r+e,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,d)}}),mT=Vt((K,V)=>{V.exports=u;function u(d,E,A){var t=E[0],e=E[1],r=E[2],i=E[3],n=t+t,o=e+e,a=r+r,s=t*n,f=t*o,v=t*a,g=e*o,m=e*a,w=r*a,l=i*n,x=i*o,y=i*a;return d[0]=1-(g+w),d[1]=f+y,d[2]=v-x,d[3]=0,d[4]=f-y,d[5]=1-(s+w),d[6]=m+l,d[7]=0,d[8]=v+x,d[9]=m-l,d[10]=1-(s+g),d[11]=0,d[12]=A[0],d[13]=A[1],d[14]=A[2],d[15]=1,d}}),gT=Vt((K,V)=>{V.exports=u;function u(d,E){return d[0]=E[0],d[1]=0,d[2]=0,d[3]=0,d[4]=0,d[5]=E[1],d[6]=0,d[7]=0,d[8]=0,d[9]=0,d[10]=E[2],d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,d}}),vT=Vt((K,V)=>{V.exports=u;function u(d,E){return d[0]=1,d[1]=0,d[2]=0,d[3]=0,d[4]=0,d[5]=1,d[6]=0,d[7]=0,d[8]=0,d[9]=0,d[10]=1,d[11]=0,d[12]=E[0],d[13]=E[1],d[14]=E[2],d[15]=1,d}}),yT=Vt((K,V)=>{V.exports=u;function u(d,E){var A=Math.sin(E),t=Math.cos(E);return d[0]=1,d[1]=0,d[2]=0,d[3]=0,d[4]=0,d[5]=t,d[6]=A,d[7]=0,d[8]=0,d[9]=-A,d[10]=t,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,d}}),xT=Vt((K,V)=>{V.exports=u;function u(d,E){var A=Math.sin(E),t=Math.cos(E);return d[0]=t,d[1]=0,d[2]=-A,d[3]=0,d[4]=0,d[5]=1,d[6]=0,d[7]=0,d[8]=A,d[9]=0,d[10]=t,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,d}}),_T=Vt((K,V)=>{V.exports=u;function u(d,E){var A=Math.sin(E),t=Math.cos(E);return d[0]=t,d[1]=A,d[2]=0,d[3]=0,d[4]=-A,d[5]=t,d[6]=0,d[7]=0,d[8]=0,d[9]=0,d[10]=1,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,d}}),bT=Vt((K,V)=>{V.exports=u;function u(d,E){var A=E[0],t=E[1],e=E[2],r=E[3],i=A+A,n=t+t,o=e+e,a=A*i,s=t*i,f=t*n,v=e*i,g=e*n,m=e*o,w=r*i,l=r*n,x=r*o;return d[0]=1-f-m,d[1]=s+x,d[2]=v-l,d[3]=0,d[4]=s-x,d[5]=1-a-m,d[6]=g+w,d[7]=0,d[8]=v+l,d[9]=g-w,d[10]=1-a-f,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,d}}),wT=Vt((K,V)=>{V.exports=u;function u(d,E,A,t,e,r,i){var n=1/(A-E),o=1/(e-t),a=1/(r-i);return d[0]=r*2*n,d[1]=0,d[2]=0,d[3]=0,d[4]=0,d[5]=r*2*o,d[6]=0,d[7]=0,d[8]=(A+E)*n,d[9]=(e+t)*o,d[10]=(i+r)*a,d[11]=-1,d[12]=0,d[13]=0,d[14]=i*r*2*a,d[15]=0,d}}),TT=Vt((K,V)=>{V.exports=u;function u(d,E,A,t,e){var r=1/Math.tan(E/2),i=1/(t-e);return d[0]=r/A,d[1]=0,d[2]=0,d[3]=0,d[4]=0,d[5]=r,d[6]=0,d[7]=0,d[8]=0,d[9]=0,d[10]=(e+t)*i,d[11]=-1,d[12]=0,d[13]=0,d[14]=2*e*t*i,d[15]=0,d}}),kT=Vt((K,V)=>{V.exports=u;function u(d,E,A,t){var e=Math.tan(E.upDegrees*Math.PI/180),r=Math.tan(E.downDegrees*Math.PI/180),i=Math.tan(E.leftDegrees*Math.PI/180),n=Math.tan(E.rightDegrees*Math.PI/180),o=2/(i+n),a=2/(e+r);return d[0]=o,d[1]=0,d[2]=0,d[3]=0,d[4]=0,d[5]=a,d[6]=0,d[7]=0,d[8]=-((i-n)*o*.5),d[9]=(e-r)*a*.5,d[10]=t/(A-t),d[11]=-1,d[12]=0,d[13]=0,d[14]=t*A/(A-t),d[15]=0,d}}),AT=Vt((K,V)=>{V.exports=u;function u(d,E,A,t,e,r,i){var n=1/(E-A),o=1/(t-e),a=1/(r-i);return d[0]=-2*n,d[1]=0,d[2]=0,d[3]=0,d[4]=0,d[5]=-2*o,d[6]=0,d[7]=0,d[8]=0,d[9]=0,d[10]=2*a,d[11]=0,d[12]=(E+A)*n,d[13]=(e+t)*o,d[14]=(i+r)*a,d[15]=1,d}}),MT=Vt((K,V)=>{var u=ab();V.exports=d;function d(E,A,t,e){var r,i,n,o,a,s,f,v,g,m,w=A[0],l=A[1],x=A[2],y=e[0],S=e[1],k=e[2],M=t[0],T=t[1],c=t[2];return Math.abs(w-M)<1e-6&&Math.abs(l-T)<1e-6&&Math.abs(x-c)<1e-6?u(E):(f=w-M,v=l-T,g=x-c,m=1/Math.sqrt(f*f+v*v+g*g),f*=m,v*=m,g*=m,r=S*g-k*v,i=k*f-y*g,n=y*v-S*f,m=Math.sqrt(r*r+i*i+n*n),m?(m=1/m,r*=m,i*=m,n*=m):(r=0,i=0,n=0),o=v*n-g*i,a=g*r-f*n,s=f*i-v*r,m=Math.sqrt(o*o+a*a+s*s),m?(m=1/m,o*=m,a*=m,s*=m):(o=0,a=0,s=0),E[0]=r,E[1]=o,E[2]=f,E[3]=0,E[4]=i,E[5]=a,E[6]=v,E[7]=0,E[8]=n,E[9]=s,E[10]=g,E[11]=0,E[12]=-(r*w+i*l+n*x),E[13]=-(o*w+a*l+s*x),E[14]=-(f*w+v*l+g*x),E[15]=1,E)}}),ST=Vt((K,V)=>{V.exports=u;function u(d){return"mat4("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+", "+d[6]+", "+d[7]+", "+d[8]+", "+d[9]+", "+d[10]+", "+d[11]+", "+d[12]+", "+d[13]+", "+d[14]+", "+d[15]+")"}}),ib=Vt((K,V)=>{V.exports={create:tT(),clone:eT(),copy:rT(),identity:ab(),transpose:nT(),invert:aT(),adjoint:iT(),determinant:oT(),multiply:sT(),translate:lT(),scale:uT(),rotate:cT(),rotateX:fT(),rotateY:hT(),rotateZ:pT(),fromRotation:dT(),fromRotationTranslation:mT(),fromScaling:gT(),fromTranslation:vT(),fromXRotation:yT(),fromYRotation:xT(),fromZRotation:_T(),fromQuat:bT(),frustum:wT(),perspective:TT(),perspectiveFromFieldOfView:kT(),ortho:AT(),lookAt:MT(),str:ST()}}),Ny=Vt(K=>{var V=ib();K.init2dArray=function(u,d){for(var E=new Array(u),A=0;A{var u=Ni(),d=wd(),E=Ny(),A=ib();function t(w){var l;if(typeof w=="string"){if(l=document.getElementById(w),l===null)throw new Error("No DOM element with id '"+w+"' exists on the page.");return l}else if(w==null)throw new Error("DOM element provided is null or undefined");return w}function e(w){var l=u.select(w);return l.node()instanceof HTMLElement&&l.size()&&l.classed("js-plotly-plot")}function r(w){var l=w&&w.parentNode;l&&l.removeChild(w)}function i(w,l){n("global",w,l)}function n(w,l,x){var y="plotly.js-style-"+w,S=document.getElementById(y);if(!(S&&S.matches(".no-inline-styles"))){S||(S=document.createElement("style"),S.setAttribute("id",y),S.appendChild(document.createTextNode("")),document.head.appendChild(S));var k=S.sheet;k?k.insertRule?k.insertRule(l+"{"+x+"}",0):k.addRule?k.addRule(l,x,0):d.warn("addStyleRule failed"):d.warn("Cannot addRelatedStyleRule, probably due to strict CSP...")}}function o(w){var l="plotly.js-style-"+w,x=document.getElementById(l);x&&r(x)}function a(w,l,x,y,S,k){var M=y.split(":"),T=S.split(":"),c="data-btn-style-event-added";k||(k=document),k.querySelectorAll(w).forEach(function(h){h.getAttribute(c)||(h.addEventListener("mouseenter",function(){var b=this.querySelector(x);b&&(b.style[M[0]]=M[1])}),h.addEventListener("mouseleave",function(){var b=this.querySelector(x);b&&(l&&this.matches(l)?b.style[M[0]]=M[1]:b.style[T[0]]=T[1])}),h.setAttribute(c,!0))})}function s(w){var l=v(w),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return l.forEach(function(y){var S=f(y);if(S){var k=E.convertCssMatrix(S);x=A.multiply(x,x,k)}}),x}function f(w){var l=window.getComputedStyle(w,null),x=l.getPropertyValue("-webkit-transform")||l.getPropertyValue("-moz-transform")||l.getPropertyValue("-ms-transform")||l.getPropertyValue("-o-transform")||l.getPropertyValue("transform");return x==="none"?null:x.replace("matrix","").replace("3d","").slice(1,-1).split(",").map(function(y){return+y})}function v(w){for(var l=[];g(w);)l.push(w),w=w.parentNode,typeof ShadowRoot=="function"&&w instanceof ShadowRoot&&(w=w.host);return l}function g(w){return w&&(w instanceof Element||w instanceof HTMLElement)}function m(w,l){return w&&l&&w.top===l.top&&w.left===l.left&&w.right===l.right&&w.bottom===l.bottom}V.exports={getGraphDiv:t,isPlotDiv:e,removeElement:r,addStyleRule:i,addRelatedStyleRule:n,deleteRelatedStyleRule:o,setStyleOnHover:a,getFullTransformMatrix:s,getElementTransformMatrix:f,getElementAndAncestors:v,equalDomRects:m}}),Bg=Vt((K,V)=>{V.exports={mode:{valType:"enumerated",dflt:"afterall",values:["immediate","next","afterall"]},direction:{valType:"enumerated",values:["forward","reverse"],dflt:"forward"},fromcurrent:{valType:"boolean",dflt:!1},frame:{duration:{valType:"number",min:0,dflt:500},redraw:{valType:"boolean",dflt:!0}},transition:{duration:{valType:"number",min:0,dflt:500,editType:"none"},easing:{valType:"enumerated",dflt:"cubic-in-out",values:["linear","quad","cubic","sin","exp","circle","elastic","back","bounce","linear-in","quad-in","cubic-in","sin-in","exp-in","circle-in","elastic-in","back-in","bounce-in","linear-out","quad-out","cubic-out","sin-out","exp-out","circle-out","elastic-out","back-out","bounce-out","linear-in-out","quad-in-out","cubic-in-out","sin-in-out","exp-in-out","circle-in-out","elastic-in-out","back-in-out","bounce-in-out"],editType:"none"},ordering:{valType:"enumerated",values:["layout first","traces first"],dflt:"layout first",editType:"none"}}}}),Cu=Vt((K,V)=>{var u=So().extendFlat,d=Fp(),E={valType:"flaglist",extras:["none"],flags:["calc","clearAxisTypes","plot","style","markerSize","colorbars"]},A={valType:"flaglist",extras:["none"],flags:["calc","plot","legend","ticks","axrange","layoutstyle","modebar","camera","arraydraw","colorbars"]},t=E.flags.slice().concat(["fullReplot"]),e=A.flags.slice().concat("layoutReplot");V.exports={traces:E,layout:A,traceFlags:function(){return r(t)},layoutFlags:function(){return r(e)},update:function(o,a){var s=a.editType;if(s&&s!=="none")for(var f=s.split("+"),v=0;v{K.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"},K.pattern={shape:{valType:"enumerated",values:["","/","\\","x","-","|","+","."],dflt:"",arrayOk:!0,editType:"style"},path:{valType:"string",arrayOk:!0,editType:"style"},fillmode:{valType:"enumerated",values:["replace","overlay"],dflt:"replace",editType:"style"},bgcolor:{valType:"color",arrayOk:!0,editType:"style"},fgcolor:{valType:"color",arrayOk:!0,editType:"style"},fgopacity:{valType:"number",editType:"style",min:0,max:1},size:{valType:"number",min:0,dflt:8,arrayOk:!0,editType:"style"},solidity:{valType:"number",min:0,max:1,dflt:.3,arrayOk:!0,editType:"style"},editType:"style"}}),ob=Vt((K,V)=>{V.exports={FORMAT_LINK:"https://github.com/d3/d3-format/tree/v1.4.5#d3-format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format"}}),yl=Vt(K=>{var{DATE_FORMAT_LINK:V,FORMAT_LINK:u}=ob(),d=["Variables that can't be found will be replaced with the specifier.",'For example, a template of "data: %{x}, %{y}" will result in a value of "data: 1, %{y}" if x is 1 and y is missing.',"Variables with an undefined value will be replaced with the fallback value."].join(" ");function E({supportOther:A}={}){return["Variables are inserted using %{variable},",'for example "y: %{y}"'+(A?" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, *xother* will be added to those with different x positions from the first point. An underscore before or after *(x|y)other* will add a space on that side, only when this field is shown.":"."),`Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}".`,u,"for details on the formatting syntax.",`Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}".`,V,"for details on the date formatting syntax.",d].join(" ")}K.templateFormatStringDescription=E,K.hovertemplateAttrs=({editType:A="none",arrayOk:t}={},e={})=>yd({valType:"string",dflt:"",editType:A},t!==!1?{arrayOk:!0}:{}),K.texttemplateAttrs=({editType:A="calc",arrayOk:t}={},e={})=>yd({valType:"string",dflt:"",editType:A},t!==!1?{arrayOk:!0}:{}),K.shapeTexttemplateAttrs=({editType:A="arraydraw",newshape:t}={},e={})=>({valType:"string",dflt:"",editType:A}),K.templatefallbackAttrs=({editType:A="none"}={})=>({valType:"any",dflt:"-",editType:A})}),jy=Vt((K,V)=>{function u(x,y){return y?y.d2l(x):x}function d(x,y){return y?y.l2d(x):x}function E(x){return x.x0}function A(x){return x.x1}function t(x){return x.y0}function e(x){return x.y1}function r(x){return x.x0shift||0}function i(x){return x.x1shift||0}function n(x){return x.y0shift||0}function o(x){return x.y1shift||0}function a(x,y){return u(x.x1,y)+i(x)-u(x.x0,y)-r(x)}function s(x,y,S){return u(x.y1,S)+o(x)-u(x.y0,S)-n(x)}function f(x,y){return Math.abs(a(x,y))}function v(x,y,S){return Math.abs(s(x,y,S))}function g(x,y,S){return x.type!=="line"?void 0:Math.sqrt(Math.pow(a(x,y),2)+Math.pow(s(x,y,S),2))}function m(x,y){return d((u(x.x1,y)+i(x)+u(x.x0,y)+r(x))/2,y)}function w(x,y,S){return d((u(x.y1,S)+o(x)+u(x.y0,S)+n(x))/2,S)}function l(x,y,S){return x.type!=="line"?void 0:s(x,y,S)/a(x,y)}V.exports={x0:E,x1:A,y0:t,y1:e,slope:l,dx:a,dy:s,width:f,height:v,length:g,xcenter:m,ycenter:w}}),ET=Vt((K,V)=>{var u=Cu().overrideAll,d=kl(),E=yu(),A=If().dash,t=So().extendFlat,{shapeTexttemplateAttrs:e,templatefallbackAttrs:r}=yl(),i=jy();V.exports=u({newshape:{visible:t({},d.visible,{}),showlegend:{valType:"boolean",dflt:!1},legend:t({},d.legend,{}),legendgroup:t({},d.legendgroup,{}),legendgrouptitle:{text:t({},d.legendgrouptitle.text,{}),font:E({})},legendrank:t({},d.legendrank,{}),legendwidth:t({},d.legendwidth,{}),line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:4},dash:t({},A,{dflt:"solid"})},fillcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},fillrule:{valType:"enumerated",values:["evenodd","nonzero"],dflt:"evenodd"},opacity:{valType:"number",min:0,max:1,dflt:1},layer:{valType:"enumerated",values:["below","above","between"],dflt:"above"},drawdirection:{valType:"enumerated",values:["ortho","horizontal","vertical","diagonal"],dflt:"diagonal"},name:t({},d.name,{}),label:{text:{valType:"string",dflt:""},texttemplate:e({newshape:!0},{keys:Object.keys(i)}),texttemplatefallback:r({editType:"arraydraw"}),font:E({}),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right","start","middle","end"]},textangle:{valType:"angle",dflt:"auto"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yanchor:{valType:"enumerated",values:["top","middle","bottom"]},padding:{valType:"number",dflt:3,min:0}}},activeshape:{fillcolor:{valType:"color",dflt:"rgb(255,0,255)",description:"Sets the color filling the active shape' interior."},opacity:{valType:"number",min:0,max:1,dflt:.5}}},"none","from-root")}),zT=Vt((K,V)=>{var u=If().dash,d=So().extendFlat;V.exports={newselection:{mode:{valType:"enumerated",values:["immediate","gradual"],dflt:"immediate",editType:"none"},line:{color:{valType:"color",editType:"none"},width:{valType:"number",min:1,dflt:1,editType:"none"},dash:d({},u,{dflt:"dot",editType:"none"}),editType:"none"},editType:"none"},activeselection:{fillcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"none"},opacity:{valType:"number",min:0,max:1,dflt:.5,editType:"none"},editType:"none"}}}),Uy=Vt((K,V)=>{V.exports=function(u){var d=u.editType;return{t:{valType:"number",dflt:0,editType:d},r:{valType:"number",dflt:0,editType:d},b:{valType:"number",dflt:0,editType:d},l:{valType:"number",dflt:0,editType:d},editType:d}}}),xm=Vt((K,V)=>{var u=yu(),d=Bg(),E=af(),A=ET(),t=zT(),e=Uy(),r=So().extendFlat,i=u({editType:"calc"});i.family.dflt='"Open Sans", verdana, arial, sans-serif',i.size.dflt=12,i.color.dflt=E.defaultLine,V.exports={font:i,title:{text:{valType:"string",editType:"layoutstyle"},font:u({editType:"layoutstyle"}),subtitle:{text:{valType:"string",editType:"layoutstyle"},font:u({editType:"layoutstyle"}),editType:"layoutstyle"},xref:{valType:"enumerated",dflt:"container",values:["container","paper"],editType:"layoutstyle"},yref:{valType:"enumerated",dflt:"container",values:["container","paper"],editType:"layoutstyle"},x:{valType:"number",min:0,max:1,dflt:.5,editType:"layoutstyle"},y:{valType:"number",min:0,max:1,dflt:"auto",editType:"layoutstyle"},xanchor:{valType:"enumerated",dflt:"auto",values:["auto","left","center","right"],editType:"layoutstyle"},yanchor:{valType:"enumerated",dflt:"auto",values:["auto","top","middle","bottom"],editType:"layoutstyle"},pad:r(e({editType:"layoutstyle"}),{}),automargin:{valType:"boolean",dflt:!1,editType:"plot"},editType:"layoutstyle"},uniformtext:{mode:{valType:"enumerated",values:[!1,"hide","show"],dflt:!1,editType:"plot"},minsize:{valType:"number",min:0,dflt:0,editType:"plot"},editType:"plot"},autosize:{valType:"boolean",dflt:!1,editType:"none"},width:{valType:"number",min:10,dflt:700,editType:"plot"},height:{valType:"number",min:10,dflt:450,editType:"plot"},minreducedwidth:{valType:"number",min:2,dflt:64,editType:"plot"},minreducedheight:{valType:"number",min:2,dflt:64,editType:"plot"},margin:{l:{valType:"number",min:0,dflt:80,editType:"plot"},r:{valType:"number",min:0,dflt:80,editType:"plot"},t:{valType:"number",min:0,dflt:100,editType:"plot"},b:{valType:"number",min:0,dflt:80,editType:"plot"},pad:{valType:"number",min:0,dflt:0,editType:"plot"},autoexpand:{valType:"boolean",dflt:!0,editType:"plot"},editType:"plot"},computed:{valType:"any",editType:"none"},paper_bgcolor:{valType:"color",dflt:E.background,editType:"plot"},plot_bgcolor:{valType:"color",dflt:E.background,editType:"layoutstyle"},autotypenumbers:{valType:"enumerated",values:["convert types","strict"],dflt:"convert types",editType:"calc"},separators:{valType:"string",editType:"plot"},hidesources:{valType:"boolean",dflt:!1,editType:"plot"},showlegend:{valType:"boolean",editType:"legend"},colorway:{valType:"colorlist",dflt:E.defaults,editType:"calc"},datarevision:{valType:"any",editType:"calc"},uirevision:{valType:"any",editType:"none"},editrevision:{valType:"any",editType:"none"},selectionrevision:{valType:"any",editType:"none"},template:{valType:"any",editType:"calc"},newshape:A.newshape,activeshape:A.activeshape,newselection:t.newselection,activeselection:t.activeselection,meta:{valType:"any",arrayOk:!0,editType:"plot"},transition:r({},d.transition,{editType:"none"})}}),LT=Vt(()=>{(function(){if(!document.getElementById("696e55e75aaafa12d45b3ff634eadc8348f9c3015fc94984dac1ff824773eb97")){var K=document.createElement("style");K.id="696e55e75aaafa12d45b3ff634eadc8348f9c3015fc94984dac1ff824773eb97",K.textContent=`.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}`,document.head.appendChild(K)}})()}),ji=Vt(K=>{var V=wd(),u=Ry(),d=nb(),E=Fp(),A=Fg().addStyleRule,t=So(),e=kl(),r=xm(),i=t.extendFlat,n=t.extendDeepAll;K.modules={},K.allCategories={},K.allTypes=[],K.subplotsRegistry={},K.componentsRegistry={},K.layoutArrayContainers=[],K.layoutArrayRegexes=[],K.traceLayoutAttributes={},K.localeRegistry={},K.apiMethodRegistry={},K.collectableSubplotTypes=null,K.register=function(x){if(K.collectableSubplotTypes=null,x)x&&!Array.isArray(x)&&(x=[x]);else throw new Error("No argument passed to Plotly.register.");for(var y=0;y{var V=mm().timeFormat,u=Lo(),d=wd(),E=gm().mod,A=ks(),t=A.BADNUM,e=A.ONEDAY,r=A.ONEHOUR,i=A.ONEMIN,n=A.ONESEC,o=A.EPOCHJD,a=ji(),s=mm().utcFormat,f=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d(:?\d\d)?)?)?)?)?)?\s*$/m,v=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d(:?\d\d)?)?)?)?)?)?\s*$/m,g=new Date().getFullYear()-70;function m(B){return B&&a.componentsRegistry.calendars&&typeof B=="string"&&B!=="gregorian"}K.dateTick0=function(B,R){var I=w(B,!!R);if(R<2)return I;var F=K.dateTime2ms(I,B);return F+=e*(R-1),K.ms2DateTime(F,0,B)};function w(B,R){return m(B)?R?a.getComponentMethod("calendars","CANONICAL_SUNDAY")[B]:a.getComponentMethod("calendars","CANONICAL_TICK")[B]:R?"2000-01-02":"2000-01-01"}K.dfltRange=function(B){return m(B)?a.getComponentMethod("calendars","DFLTRANGE")[B]:["2000-01-01","2001-01-01"]},K.isJSDate=function(B){return typeof B=="object"&&B!==null&&typeof B.getTime=="function"};var l,x;K.dateTime2ms=function(B,R){if(K.isJSDate(B)){var I=B.getTimezoneOffset()*i,F=(B.getUTCMinutes()-B.getMinutes())*i+(B.getUTCSeconds()-B.getSeconds())*n+(B.getUTCMilliseconds()-B.getMilliseconds());if(F){var j=3*i;I=I-j/2+E(F-I+j/2,j)}return B=Number(B)-I,B>=l&&B<=x?B:t}if(typeof B!="string"&&typeof B!="number")return t;B=String(B);var N=m(R),G=B.charAt(0);N&&(G==="G"||G==="g")&&(B=B.slice(1),R="");var rt=N&&R.slice(0,7)==="chinese",ct=B.match(rt?v:f);if(!ct)return t;var st=ct[1],et=ct[3]||"1",Z=Number(ct[5]||1),ot=Number(ct[7]||0),X=Number(ct[9]||0),Q=Number(ct[11]||0);if(N){if(st.length===2)return t;st=Number(st);var ut;try{var J=a.getComponentMethod("calendars","getCal")(R);if(rt){var q=et.charAt(et.length-1)==="i";et=parseInt(et,10),ut=J.newDate(st,J.toMonthIndex(st,et,q),Z)}else ut=J.newDate(st,Number(et),Z)}catch{return t}return ut?(ut.toJD()-o)*e+ot*r+X*i+Q*n:t}st.length===2?st=(Number(st)+2e3-g)%100+g:st=Number(st),et-=1;var it=new Date(Date.UTC(2e3,et,Z,ot,X));return it.setUTCFullYear(st),it.getUTCMonth()!==et||it.getUTCDate()!==Z?t:it.getTime()+Q*n},l=K.MIN_MS=K.dateTime2ms("-9999"),x=K.MAX_MS=K.dateTime2ms("9999-12-31 23:59:59.9999"),K.isDateTime=function(B,R){return K.dateTime2ms(B,R)!==t};function y(B,R){return String(B+Math.pow(10,R)).slice(1)}var S=90*e,k=3*r,M=5*i;K.ms2DateTime=function(B,R,I){if(typeof B!="number"||!(B>=l&&B<=x))return t;R||(R=0);var F=Math.floor(E(B+.05,1)*10),j=Math.round(B-F/10),N,G,rt,ct,st,et;if(m(I)){var Z=Math.floor(j/e)+o,ot=Math.floor(E(B,e));try{N=a.getComponentMethod("calendars","getCal")(I).fromJD(Z).formatDate("yyyy-mm-dd")}catch{N=s("G%Y-%m-%d")(new Date(j))}if(N.charAt(0)==="-")for(;N.length<11;)N="-0"+N.slice(1);else for(;N.length<10;)N="0"+N;G=R=l+e&&B<=x-e))return t;var R=Math.floor(E(B+.05,1)*10),I=new Date(Math.round(B-R/10)),F=V("%Y-%m-%d")(I),j=I.getHours(),N=I.getMinutes(),G=I.getSeconds(),rt=I.getUTCMilliseconds()*10+R;return T(F,j,N,G,rt)};function T(B,R,I,F,j){if((R||I||F||j)&&(B+=" "+y(R,2)+":"+y(I,2),(F||j)&&(B+=":"+y(F,2),j))){for(var N=4;j%10===0;)N-=1,j/=10;B+="."+y(j,N)}return B}K.cleanDate=function(B,R,I){if(B===t)return R;if(K.isJSDate(B)||typeof B=="number"&&isFinite(B)){if(m(I))return d.error("JS Dates and milliseconds are incompatible with world calendars",B),R;if(B=K.ms2DateTimeLocal(+B),!B&&R!==void 0)return R}else if(!K.isDateTime(B,I))return d.error("unrecognized date",B),R;return B};var c=/%\d?f/g,h=/%h/g,b={1:"1",2:"1",3:"2",4:"2"};function _(B,R,I,F){B=B.replace(c,function(N){var G=Math.min(+N.charAt(1)||6,6),rt=(R/1e3%1+2).toFixed(G).slice(2).replace(/0+$/,"")||"0";return rt});var j=new Date(Math.floor(R+.05));if(B=B.replace(h,function(){return b[I("%q")(j)]}),m(F))try{B=a.getComponentMethod("calendars","worldCalFmt")(B,R,F)}catch{return"Invalid"}return I(B)(j)}var P=[59,59.9,59.99,59.999,59.9999];function z(B,R){var I=E(B+.05,e),F=y(Math.floor(I/r),2)+":"+y(E(Math.floor(I/i),60),2);if(R!=="M"){u(R)||(R=0);var j=Math.min(E(B/n,60),P[R]),N=(100+j).toFixed(R).slice(1);R>0&&(N=N.replace(/0+$/,"").replace(/[\.]$/,"")),F+=":"+N}return F}K.formatDate=function(B,R,I,F,j,N){if(j=m(j)&&j,!R)if(I==="y")R=N.year;else if(I==="m")R=N.month;else if(I==="d")R=N.dayMonth+` +`+N.year;else return z(B,I)+` +`+_(N.dayMonthYear,B,F,j);return _(R,B,F,j)};var D=3*e;K.incrementMonth=function(B,R,I){I=m(I)&&I;var F=E(B,e);if(B=Math.round(B-F),I)try{var j=Math.round(B/e)+o,N=a.getComponentMethod("calendars","getCal")(I),G=N.fromJD(j);return R%12?N.add(G,R,"m"):N.add(G,R/12,"y"),(G.toJD()-o)*e+F}catch{d.error("invalid ms "+B+" in calendar "+I)}var rt=new Date(B+D);return rt.setUTCMonth(rt.getUTCMonth()+R)+F-D},K.findExactDates=function(B,R){for(var I=0,F=0,j=0,N=0,G,rt,ct=m(R)&&a.getComponentMethod("calendars","getCal")(R),st=0;st{V.exports=function(u){return u}}),Vy=Vt(K=>{var V=Lo(),u=wd(),d=Rg(),E=ks().BADNUM,A=1e-9;K.findBin=function(n,o,a){if(V(o.start))return a?Math.ceil((n-o.start)/o.size-A)-1:Math.floor((n-o.start)/o.size+A);var s=0,f=o.length,v=0,g=f>1?(o[f-1]-o[0])/(f-1):1,m,w;for(g>=0?w=a?t:e:w=a?i:r,n+=g*A*(a?-1:1)*(g>=0?1:-1);s90&&u.log("Long binary search..."),s-1};function t(n,o){return no}function i(n,o){return n>=o}K.sorterAsc=function(n,o){return n-o},K.sorterDes=function(n,o){return o-n},K.distinctVals=function(n){var o=n.slice();o.sort(K.sorterAsc);var a;for(a=o.length-1;a>-1&&o[a]===E;a--);for(var s=o[a]-o[0]||1,f=s/(a||1)/1e4,v=[],g,m=0;m<=a;m++){var w=o[m],l=w-g;g===void 0?(v.push(w),g=w):l>f&&(s=Math.min(s,l),v.push(w),g=w)}return{vals:v,minDiff:s}},K.roundUp=function(n,o,a){for(var s=0,f=o.length-1,v,g=0,m=a?0:1,w=a?1:0,l=a?Math.ceil:Math.floor;s0&&(s=1),a&&s)return n.sort(o)}return s?n:n.reverse()},K.findIndexOfMin=function(n,o){o=o||d;for(var a=1/0,s,f=0;f{V.exports=function(u){return Object.keys(u).sort()}}),IT=Vt(K=>{var V=Lo(),u=nh().isArrayOrTypedArray;K.aggNums=function(d,E,A,t){var e,r;if((!t||t>A.length)&&(t=A.length),V(E)||(E=!1),u(A[0])){for(r=new Array(t),e=0;ed.length-1)return d[d.length-1];var A=E%1;return A*d[Math.ceil(E)]+(1-A)*d[Math.floor(E)]}}),PT=Vt((K,V)=>{var u=gm(),d=u.mod,E=u.modHalf,A=Math.PI,t=2*A;function e(w){return w/180*A}function r(w){return w/A*180}function i(w){return Math.abs(w[1]-w[0])>t-1e-14}function n(w,l){return E(l-w,t)}function o(w,l){return Math.abs(n(w,l))}function a(w,l){if(i(l))return!0;var x,y;l[0]y&&(y+=t);var S=d(w,t),k=S+t;return S>=x&&S<=y||k>=x&&k<=y}function s(w,l,x,y){if(!a(l,y))return!1;var S,k;return x[0]=S&&w<=k}function f(w,l,x,y,S,k,M){S=S||0,k=k||0;var T=i([x,y]),c,h,b,_,P;T?(c=0,h=A,b=t):x{K.isLeftAnchor=function(V){return V.xanchor==="left"||V.xanchor==="auto"&&V.x<=1/3},K.isCenterAnchor=function(V){return V.xanchor==="center"||V.xanchor==="auto"&&V.x>1/3&&V.x<2/3},K.isRightAnchor=function(V){return V.xanchor==="right"||V.xanchor==="auto"&&V.x>=2/3},K.isTopAnchor=function(V){return V.yanchor==="top"||V.yanchor==="auto"&&V.y>=2/3},K.isMiddleAnchor=function(V){return V.yanchor==="middle"||V.yanchor==="auto"&&V.y>1/3&&V.y<2/3},K.isBottomAnchor=function(V){return V.yanchor==="bottom"||V.yanchor==="auto"&&V.y<=1/3}}),DT=Vt(K=>{var V=gm().mod;K.segmentsIntersect=u;function u(e,r,i,n,o,a,s,f){var v=i-e,g=o-e,m=s-o,w=n-r,l=a-r,x=f-a,y=v*x-m*w;if(y===0)return null;var S=(g*x-m*l)/y,k=(g*w-v*l)/y;return k<0||k>1||S<0||S>1?null:{x:e+v*S,y:r+w*S}}K.segmentDistance=function(e,r,i,n,o,a,s,f){if(u(e,r,i,n,o,a,s,f))return 0;var v=i-e,g=n-r,m=s-o,w=f-a,l=v*v+g*g,x=m*m+w*w,y=Math.min(d(v,g,l,o-e,a-r),d(v,g,l,s-e,f-r),d(m,w,x,e-o,r-a),d(m,w,x,i-o,n-a));return Math.sqrt(y)};function d(e,r,i,n,o){var a=n*e+o*r;if(a<0)return n*n+o*o;if(a>i){var s=n-e,f=o-r;return s*s+f*f}else{var v=n*r-o*e;return v*v/i}}var E,A,t;K.getTextLocation=function(e,r,i,n){if((e!==A||n!==t)&&(E={},A=e,t=n),E[i])return E[i];var o=e.getPointAtLength(V(i-n/2,r)),a=e.getPointAtLength(V(i+n/2,r)),s=Math.atan((a.y-o.y)/(a.x-o.x)),f=e.getPointAtLength(V(i,r)),v=(f.x*4+o.x+a.x)/6,g=(f.y*4+o.y+a.y)/6,m={x:v,y:g,theta:s};return E[i]=m,m},K.clearLocationCache=function(){A=null},K.getVisibleSegment=function(e,r,i){var n=r.left,o=r.right,a=r.top,s=r.bottom,f=0,v=e.getTotalLength(),g=v,m,w;function l(y){var S=e.getPointAtLength(y);y===0?m=S:y===v&&(w=S);var k=S.xo?S.x-o:0,M=S.ys?S.y-s:0;return Math.sqrt(k*k+M*M)}for(var x=l(f);x;){if(f+=x+i,f>g)return;x=l(f)}for(x=l(g);x;){if(g-=x+i,f>g)return;x=l(g)}return{min:f,max:g,len:g-f,total:v,isClosed:f===0&&g===v&&Math.abs(m.x-w.x)<.1&&Math.abs(m.y-w.y)<.1}},K.findPointOnPath=function(e,r,i,n){n=n||{};for(var o=n.pathLength||e.getTotalLength(),a=n.tolerance||.001,s=n.iterationLimit||30,f=e.getPointAtLength(0)[i]>e.getPointAtLength(o)[i]?-1:1,v=0,g=0,m=o,w,l,x;v0?m=w:g=w,v++}return l}}),Hy=Vt(K=>{var V={};K.throttle=function(d,E,A){var t=V[d],e=Date.now();if(!t){for(var r in V)V[r].tst.ts+E){i();return}t.timer=setTimeout(function(){i(),t.timer=null},E)},K.done=function(d){var E=V[d];return!E||!E.timer?Promise.resolve():new Promise(function(A){var t=E.onDone;E.onDone=function(){t&&t(),A(),E.onDone=null}})},K.clear=function(d){if(d)u(V[d]),delete V[d];else for(var E in V)K.clear(E)};function u(d){d&&d.timer!==null&&(clearTimeout(d.timer),d.timer=null)}}),FT=Vt((K,V)=>{V.exports=function(u){u._responsiveChartHandler&&(window.removeEventListener("resize",u._responsiveChartHandler),delete u._responsiveChartHandler)}}),BT=Vt((K,V)=>{V.exports=A,V.exports.isMobile=A,V.exports.default=A;var u=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,d=/CrOS/,E=/android|ipad|playbook|silk/i;function A(t){t||(t={});let e=t.ua;if(!e&&typeof navigator<"u"&&(e=navigator.userAgent),e&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string")return!1;let r=u.test(e)&&!d.test(e)||!!t.tablet&&E.test(e);return!r&&t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.indexOf("Macintosh")!==-1&&e.indexOf("Safari")!==-1&&(r=!0),r}}),RT=Vt((K,V)=>{var u=Lo(),d=BT();V.exports=function(A){var t;if(A&&A.hasOwnProperty("userAgent")?t=A.userAgent:t=E(),typeof t!="string")return!0;var e=d({ua:{headers:{"user-agent":t}},tablet:!0,featureDetect:!1});if(!e)for(var r=t.split(" "),i=1;i-1;o--){var a=r[o];if(a.slice(0,8)==="Version/"){var s=a.slice(8).split(".")[0];if(u(s)&&(s=+s),s>=13)return!0}}}return e};function E(){var A;return typeof navigator<"u"&&(A=navigator.userAgent),A&&A.headers&&typeof A.headers["user-agent"]=="string"&&(A=A.headers["user-agent"]),A}}),NT=Vt((K,V)=>{var u=Ni();V.exports=function(d,E,A){var t=d.selectAll("g."+A.replace(/\s/g,".")).data(E,function(r){return r[0].trace.uid});t.exit().remove(),t.enter().append("g").attr("class",A),t.order();var e=d.classed("rangeplot")?"nodeRangePlot3":"node3";return t.each(function(r){r[0][e]=u.select(this)}),t}}),jT=Vt((K,V)=>{var u=ji();V.exports=function(d,E){for(var A=d._context.locale,t=0;t<2;t++){for(var e=d._context.locales,r=0;r<2;r++){var i=(e[A]||{}).dictionary;if(i){var n=i[E];if(n)return n}e=u.localeRegistry}var o=A.split("-")[0];if(o===A)break;A=o}return E}}),sb=Vt((K,V)=>{V.exports=function(u){for(var d={},E=[],A=0,t=0;t{V.exports=function(A){for(var t=E(A)?d:u,e=[],r=0;r{V.exports=function(u,d){if(!d)return u;var E=1/Math.abs(d),A=E>1?(E*u+E*d)/E:u+d,t=String(A).length;if(t>16){var e=String(d).length,r=String(u).length;if(t>=r+e){var i=parseFloat(A).toPrecision(12);i.indexOf("e+")===-1&&(A=+i)}}return A}}),HT=Vt((K,V)=>{var u=Lo(),d=ks().BADNUM,E=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;V.exports=function(A){return typeof A=="string"&&(A=A.replace(E,"")),u(A)?Number(A):d}}),Xr=Vt((K,V)=>{var u=Ni(),d=mm().utcFormat,E=tb().format,A=Lo(),t=ks(),e=t.FP_SAFE,r=-e,i=t.BADNUM,n=V.exports={};n.adjustFormat=function(J){return!J||/^\d[.]\df/.test(J)||/[.]\d%/.test(J)?J:J==="0.f"?"~f":/^\d%/.test(J)?"~%":/^\ds/.test(J)?"~s":!/^[~,.0$]/.test(J)&&/[&fps]/.test(J)?"~"+J:J};var o={};n.warnBadFormat=function(J){var q=String(J);o[q]||(o[q]=1,n.warn('encountered bad format: "'+q+'"'))},n.noFormat=function(J){return String(J)},n.numberFormat=function(J){var q;try{q=E(n.adjustFormat(J))}catch{return n.warnBadFormat(J),n.noFormat}return q},n.nestedProperty=Og(),n.keyedContainer=X4(),n.relativeAttr=$4(),n.isPlainObject=Fp(),n.toLogRange=By(),n.relinkPrivateKeys=J4();var a=nh();n.isArrayBuffer=a.isArrayBuffer,n.isTypedArray=a.isTypedArray,n.isArrayOrTypedArray=a.isArrayOrTypedArray,n.isArray1D=a.isArray1D,n.ensureArray=a.ensureArray,n.concat=a.concat,n.maxRowLength=a.maxRowLength,n.minRowLength=a.minRowLength;var s=gm();n.mod=s.mod,n.modHalf=s.modHalf;var f=Q4();n.valObjectMeta=f.valObjectMeta,n.coerce=f.coerce,n.coerce2=f.coerce2,n.coerceFont=f.coerceFont,n.coercePattern=f.coercePattern,n.coerceHoverinfo=f.coerceHoverinfo,n.coerceSelectionMarkerOpacity=f.coerceSelectionMarkerOpacity,n.validate=f.validate;var v=CT();n.dateTime2ms=v.dateTime2ms,n.isDateTime=v.isDateTime,n.ms2DateTime=v.ms2DateTime,n.ms2DateTimeLocal=v.ms2DateTimeLocal,n.cleanDate=v.cleanDate,n.isJSDate=v.isJSDate,n.formatDate=v.formatDate,n.incrementMonth=v.incrementMonth,n.dateTick0=v.dateTick0,n.dfltRange=v.dfltRange,n.findExactDates=v.findExactDates,n.MIN_MS=v.MIN_MS,n.MAX_MS=v.MAX_MS;var g=Vy();n.findBin=g.findBin,n.sorterAsc=g.sorterAsc,n.sorterDes=g.sorterDes,n.distinctVals=g.distinctVals,n.roundUp=g.roundUp,n.sort=g.sort,n.findIndexOfMin=g.findIndexOfMin,n.sortObjectKeys=Td();var m=IT();n.aggNums=m.aggNums,n.len=m.len,n.mean=m.mean,n.geometricMean=m.geometricMean,n.median=m.median,n.midRange=m.midRange,n.variance=m.variance,n.stdev=m.stdev,n.interp=m.interp;var w=Ny();n.init2dArray=w.init2dArray,n.transposeRagged=w.transposeRagged,n.dot=w.dot,n.translationMatrix=w.translationMatrix,n.rotationMatrix=w.rotationMatrix,n.rotationXYMatrix=w.rotationXYMatrix,n.apply3DTransform=w.apply3DTransform,n.apply2DTransform=w.apply2DTransform,n.apply2DTransform2=w.apply2DTransform2,n.convertCssMatrix=w.convertCssMatrix,n.inverseTransformMatrix=w.inverseTransformMatrix;var l=PT();n.deg2rad=l.deg2rad,n.rad2deg=l.rad2deg,n.angleDelta=l.angleDelta,n.angleDist=l.angleDist,n.isFullCircle=l.isFullCircle,n.isAngleInsideSector=l.isAngleInsideSector,n.isPtInsideSector=l.isPtInsideSector,n.pathArc=l.pathArc,n.pathSector=l.pathSector,n.pathAnnulus=l.pathAnnulus;var x=OT();n.isLeftAnchor=x.isLeftAnchor,n.isCenterAnchor=x.isCenterAnchor,n.isRightAnchor=x.isRightAnchor,n.isTopAnchor=x.isTopAnchor,n.isMiddleAnchor=x.isMiddleAnchor,n.isBottomAnchor=x.isBottomAnchor;var y=DT();n.segmentsIntersect=y.segmentsIntersect,n.segmentDistance=y.segmentDistance,n.getTextLocation=y.getTextLocation,n.clearLocationCache=y.clearLocationCache,n.getVisibleSegment=y.getVisibleSegment,n.findPointOnPath=y.findPointOnPath;var S=So();n.extendFlat=S.extendFlat,n.extendDeep=S.extendDeep,n.extendDeepAll=S.extendDeepAll,n.extendDeepNoArrays=S.extendDeepNoArrays;var k=wd();n.log=k.log,n.warn=k.warn,n.error=k.error;var M=ym();n.counterRegex=M.counter;var T=Hy();n.throttle=T.throttle,n.throttleDone=T.done,n.clearThrottle=T.clear;var c=Fg();n.getGraphDiv=c.getGraphDiv,n.isPlotDiv=c.isPlotDiv,n.removeElement=c.removeElement,n.addStyleRule=c.addStyleRule,n.addRelatedStyleRule=c.addRelatedStyleRule,n.deleteRelatedStyleRule=c.deleteRelatedStyleRule,n.setStyleOnHover=c.setStyleOnHover,n.getFullTransformMatrix=c.getFullTransformMatrix,n.getElementTransformMatrix=c.getElementTransformMatrix,n.getElementAndAncestors=c.getElementAndAncestors,n.equalDomRects=c.equalDomRects,n.clearResponsive=FT(),n.preserveDrawingBuffer=RT(),n.makeTraceGroups=NT(),n._=jT(),n.notifier=rb(),n.filterUnique=sb(),n.filterVisible=UT(),n.pushUnique=nb(),n.increment=VT(),n.cleanNumber=HT(),n.ensureNumber=function(J){return A(J)?(J=Number(J),J>e||J=q?!1:A(J)&&J>=0&&J%1===0},n.noop=Ry(),n.identity=Rg(),n.repeat=function(J,q){for(var it=new Array(q),nt=0;ntit?Math.max(it,Math.min(q,J)):Math.max(q,Math.min(it,J))},n.bBoxIntersect=function(J,q,it){return it=it||0,J.left<=q.right+it&&q.left<=J.right+it&&J.top<=q.bottom+it&&q.top<=J.bottom+it},n.simpleMap=function(J,q,it,nt,dt){for(var Tt=J.length,wt=new Array(Tt),Ct=0;Ct=Math.pow(2,it)?dt>10?(n.warn("randstr failed uniqueness"),wt):J(q,it,nt,(dt||0)+1):wt},n.OptionControl=function(J,q){J||(J={}),q||(q="opt");var it={};return it.optionList=[],it._newoption=function(nt){nt[q]=J,it[nt.name]=nt,it.optionList.push(nt)},it["_"+q]=J,it},n.smooth=function(J,q){if(q=Math.round(q)||0,q<2)return J;var it=J.length,nt=2*it,dt=2*q-1,Tt=new Array(dt),wt=new Array(it),Ct,It,Nt,te;for(Ct=0;Ct=nt&&(Nt-=nt*Math.floor(Nt/nt)),Nt<0?Nt=-1-Nt:Nt>=it&&(Nt=nt-1-Nt),te+=J[Nt]*Tt[It];wt[Ct]=te}return wt},n.syncOrAsync=function(J,q,it){var nt,dt;function Tt(){return n.syncOrAsync(J,q,it)}for(;J.length;)if(dt=J.splice(0,1)[0],nt=dt(q),nt&&nt.then)return nt.then(Tt);return it&&it(q)},n.stripTrailingSlash=function(J){return J.slice(-1)==="/"?J.slice(0,-1):J},n.noneOrAll=function(J,q,it){if(J){var nt=!1,dt=!0,Tt,wt;for(Tt=0;Tt0?dt:0})},n.fillArray=function(J,q,it,nt){if(nt=nt||n.identity,n.isArrayOrTypedArray(J))for(var dt=0;dtz.test(window.navigator.userAgent);var D=/Firefox\/(\d+)\.\d+/;n.getFirefoxVersion=function(){var J=D.exec(window.navigator.userAgent);if(J&&J.length===2){var q=parseInt(J[1]);if(!isNaN(q))return q}return null},n.isD3Selection=function(J){return J instanceof u.selection},n.ensureSingle=function(J,q,it,nt){var dt=J.select(q+(it?"."+it:""));if(dt.size())return dt;var Tt=J.append(q);return it&&Tt.classed(it,!0),nt&&Tt.call(nt),Tt},n.ensureSingleById=function(J,q,it,nt){var dt=J.select(q+"#"+it);if(dt.size())return dt;var Tt=J.append(q).attr("id",it);return nt&&Tt.call(nt),Tt},n.objectFromPath=function(J,q){for(var it=J.split("."),nt,dt=nt={},Tt=0;Tt1?dt+wt[1]:"";if(Tt&&(wt.length>1||Ct.length>4||it))for(;nt.test(Ct);)Ct=Ct.replace(nt,"$1"+Tt+"$2");return Ct+It},n.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var F=/^\w*$/;n.templateString=function(J,q){var it={};return J.replace(n.TEMPLATE_STRING_REGEX,function(nt,dt){var Tt;return F.test(dt)?Tt=q[dt]:(it[dt]=it[dt]||n.nestedProperty(q,dt).get,Tt=it[dt](!0)),Tt!==void 0?Tt:""})};var j={max:10,count:0,name:"hovertemplate"};n.hovertemplateString=J=>et(dm(yd({},J),{opts:j}));var N={max:10,count:0,name:"texttemplate"};n.texttemplateString=J=>et(dm(yd({},J),{opts:N}));var G=/^(\S+)([\*\/])(-?\d+(\.\d+)?)$/;function rt(J){var q=J.match(G);return q?{key:q[1],op:q[2],number:Number(q[3])}:{key:J,op:null,number:null}}var ct={max:10,count:0,name:"texttemplate",parseMultDiv:!0};n.texttemplateStringForShapes=J=>et(dm(yd({},J),{opts:ct}));var st=/^[:|\|]/;function et({data:J=[],locale:q,fallback:it,labels:nt={},opts:dt,template:Tt}){return Tt.replace(n.TEMPLATE_STRING_REGEX,(wt,Ct,It)=>{let Nt=["xother","yother"].includes(Ct),te=["_xother","_yother"].includes(Ct),Jt=["_xother_","_yother_"].includes(Ct),ee=["xother_","yother_"].includes(Ct),Zt=Nt||te||ee||Jt;(te||Jt)&&(Ct=Ct.substring(1)),(ee||Jt)&&(Ct=Ct.substring(0,Ct.length-1));let mt=null,bt=null;if(dt.parseMultDiv){var vt=rt(Ct);Ct=vt.key,mt=vt.op,bt=vt.number}let Ut;if(Zt){if(nt[Ct]===void 0)return"";Ut=nt[Ct]}else for(let Me of J)if(Me){if(Me.hasOwnProperty(Ct)){Ut=Me[Ct];break}if(F.test(Ct)||(Ut=n.nestedProperty(Me,Ct).get(!0)),Ut!==void 0)break}if(Ut===void 0){let{count:Me,max:Ce,name:We}=dt,qe=it===!1?wt:it;return Me=Z&&wt<=ot,Nt=Ct>=Z&&Ct<=ot;if(It&&(nt=10*nt+wt-Z),Nt&&(dt=10*dt+Ct-Z),!It||!Nt){if(nt!==dt)return nt-dt;if(wt!==Ct)return wt-Ct}}return dt-nt};var X=2e9;n.seedPseudoRandom=function(){X=2e9},n.pseudoRandom=function(){var J=X;return X=(69069*X+1)%4294967296,Math.abs(X-J)<429496729?n.pseudoRandom():X/4294967296},n.fillText=function(J,q,it){var nt=Array.isArray(it)?function(wt){it.push(wt)}:function(wt){it.text=wt},dt=n.extractOption(J,q,"htx","hovertext");if(n.isValidTextValue(dt))return nt(dt);var Tt=n.extractOption(J,q,"tx","text");if(n.isValidTextValue(Tt))return nt(Tt)},n.isValidTextValue=function(J){return J||J===0},n.formatPercent=function(J,q){q=q||0;for(var it=(Math.round(100*J*Math.pow(10,q))*Math.pow(.1,q)).toFixed(q)+"%",nt=0;nt1&&(Nt=1):Nt=0,n.strTranslate(dt-Nt*(it+wt),Tt-Nt*(nt+Ct))+n.strScale(Nt)+(It?"rotate("+It+(q?"":" "+it+" "+nt)+")":"")},n.setTransormAndDisplay=function(J,q){J.attr("transform",n.getTextTransform(q)),J.style("display",q.scale?null:"none")},n.ensureUniformFontSize=function(J,q){var it=n.extendFlat({},q);return it.size=Math.max(q.size,J._fullLayout.uniformtext.minsize||0),it},n.join2=function(J,q,it){var nt=J.length;return nt>1?J.slice(0,-1).join(q)+it+J[nt-1]:J.join(q)},n.bigFont=function(J){return Math.round(1.2*J)};var Q=n.getFirefoxVersion(),ut=Q!==null&&Q<86;n.getPositionFromD3Event=function(){return ut?[u.event.layerX,u.event.layerY]:[u.event.offsetX,u.event.offsetY]}}),qT=Vt(()=>{var K=Xr(),V={"X,X div":'direction:ltr;font-family:"Open Sans",verdana,arial,sans-serif;margin:0;padding:0;border:0;',"X input,X button":'font-family:"Open Sans",verdana,arial,sans-serif;',"X input:focus,X button:focus":"outline:none;","X a":"text-decoration:none;","X a:hover":"text-decoration:none;","X .crisp":"shape-rendering:crispEdges;","X .user-select-none":"-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;","X svg a":"fill:#447adb;","X svg a:hover":"fill:#3c6dc5;","X .main-svg":"position:absolute;top:0;left:0;pointer-events:none;","X .main-svg .draglayer":"pointer-events:all;","X .cursor-default":"cursor:default;","X .cursor-pointer":"cursor:pointer;","X .cursor-crosshair":"cursor:crosshair;","X .cursor-move":"cursor:move;","X .cursor-col-resize":"cursor:col-resize;","X .cursor-row-resize":"cursor:row-resize;","X .cursor-ns-resize":"cursor:ns-resize;","X .cursor-ew-resize":"cursor:ew-resize;","X .cursor-sw-resize":"cursor:sw-resize;","X .cursor-s-resize":"cursor:s-resize;","X .cursor-se-resize":"cursor:se-resize;","X .cursor-w-resize":"cursor:w-resize;","X .cursor-e-resize":"cursor:e-resize;","X .cursor-nw-resize":"cursor:nw-resize;","X .cursor-n-resize":"cursor:n-resize;","X .cursor-ne-resize":"cursor:ne-resize;","X .cursor-grab":"cursor:-webkit-grab;cursor:grab;","X .modebar":"position:absolute;top:2px;right:2px;","X .ease-bg":"-webkit-transition:background-color .3s ease 0s;-moz-transition:background-color .3s ease 0s;-ms-transition:background-color .3s ease 0s;-o-transition:background-color .3s ease 0s;transition:background-color .3s ease 0s;","X .modebar--hover>:not(.watermark)":"opacity:0;-webkit-transition:opacity .3s ease 0s;-moz-transition:opacity .3s ease 0s;-ms-transition:opacity .3s ease 0s;-o-transition:opacity .3s ease 0s;transition:opacity .3s ease 0s;","X:hover .modebar--hover .modebar-group":"opacity:1;","X:focus-within .modebar--hover .modebar-group":"opacity:1;","X .modebar-group":"float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;","X .modebar-group a":"display:grid;place-content:center;","X .modebar-btn":"position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;border:none;background:rgba(0,0,0,0);","X .modebar-btn svg":"position:relative;","X .modebar-btn:focus-visible":"outline:1px solid #000;outline-offset:1px;border-radius:3px;","X .modebar.vertical":"display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;","X .modebar.vertical svg":"top:-1px;","X .modebar.vertical .modebar-group":"display:block;float:none;padding-left:0px;padding-bottom:8px;","X .modebar.vertical .modebar-group .modebar-btn":"display:block;text-align:center;","X [data-title]:before,X [data-title]:after":"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;","X [data-title]:hover:before,X [data-title]:hover:after":"display:block;opacity:1;","X [data-title]:before":'content:"";position:absolute;background:rgba(0,0,0,0);border:6px solid rgba(0,0,0,0);z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;',"X [data-title]:after":"content:attr(data-title);background:#69738a;color:#fff;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;margin-right:-18px;border-radius:2px;","X .vertical [data-title]:before,X .vertical [data-title]:after":"top:0%;right:200%;","X .vertical [data-title]:before":"border:6px solid rgba(0,0,0,0);border-left-color:#69738a;margin-top:8px;margin-right:-30px;",Y:'font-family:"Open Sans",verdana,arial,sans-serif;position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;',"Y p":"margin:0;","Y .notifier-note":"min-width:180px;max-width:250px;border:1px solid #fff;z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,.9);color:#fff;padding:10px;overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;","Y .notifier-close":"color:#fff;opacity:.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;","Y .notifier-close:hover":"color:#444;text-decoration:none;cursor:pointer;"};for(d in V)u=d.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier"),K.addStyleRule(u,V[d]);var u,d}),lb=Vt((K,V)=>{V.exports=!0}),ub=Vt((K,V)=>{var u=lb(),d;typeof window.matchMedia=="function"?d=!window.matchMedia("(hover: none)").matches:d=u,V.exports=d}),l0=Vt((K,V)=>{var u=typeof Reflect=="object"?Reflect:null,d=u&&typeof u.apply=="function"?u.apply:function(S,k,M){return Function.prototype.apply.call(S,k,M)},E;u&&typeof u.ownKeys=="function"?E=u.ownKeys:Object.getOwnPropertySymbols?E=function(S){return Object.getOwnPropertyNames(S).concat(Object.getOwnPropertySymbols(S))}:E=function(S){return Object.getOwnPropertyNames(S)};function A(S){console&&console.warn&&console.warn(S)}var t=Number.isNaN||function(S){return S!==S};function e(){e.init.call(this)}V.exports=e,V.exports.once=l,e.EventEmitter=e,e.prototype._events=void 0,e.prototype._eventsCount=0,e.prototype._maxListeners=void 0;var r=10;function i(S){if(typeof S!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof S)}Object.defineProperty(e,"defaultMaxListeners",{enumerable:!0,get:function(){return r},set:function(S){if(typeof S!="number"||S<0||t(S))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+S+".");r=S}}),e.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},e.prototype.setMaxListeners=function(S){if(typeof S!="number"||S<0||t(S))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+S+".");return this._maxListeners=S,this};function n(S){return S._maxListeners===void 0?e.defaultMaxListeners:S._maxListeners}e.prototype.getMaxListeners=function(){return n(this)},e.prototype.emit=function(S){for(var k=[],M=1;M0&&(h=k[0]),h instanceof Error)throw h;var b=new Error("Unhandled error."+(h?" ("+h.message+")":""));throw b.context=h,b}var _=c[S];if(_===void 0)return!1;if(typeof _=="function")d(_,this,k);else for(var P=_.length,z=g(_,P),M=0;M0&&b.length>c&&!b.warned){b.warned=!0;var _=new Error("Possible EventEmitter memory leak detected. "+b.length+" "+String(k)+" listeners added. Use emitter.setMaxListeners() to increase limit");_.name="MaxListenersExceededWarning",_.emitter=S,_.type=k,_.count=b.length,A(_)}return S}e.prototype.addListener=function(S,k){return o(this,S,k,!1)},e.prototype.on=e.prototype.addListener,e.prototype.prependListener=function(S,k){return o(this,S,k,!0)};function a(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function s(S,k,M){var T={fired:!1,wrapFn:void 0,target:S,type:k,listener:M},c=a.bind(T);return c.listener=M,T.wrapFn=c,c}e.prototype.once=function(S,k){return i(k),this.on(S,s(this,S,k)),this},e.prototype.prependOnceListener=function(S,k){return i(k),this.prependListener(S,s(this,S,k)),this},e.prototype.removeListener=function(S,k){var M,T,c,h,b;if(i(k),T=this._events,T===void 0)return this;if(M=T[S],M===void 0)return this;if(M===k||M.listener===k)--this._eventsCount===0?this._events=Object.create(null):(delete T[S],T.removeListener&&this.emit("removeListener",S,M.listener||k));else if(typeof M!="function"){for(c=-1,h=M.length-1;h>=0;h--)if(M[h]===k||M[h].listener===k){b=M[h].listener,c=h;break}if(c<0)return this;c===0?M.shift():m(M,c),M.length===1&&(T[S]=M[0]),T.removeListener!==void 0&&this.emit("removeListener",S,b||k)}return this},e.prototype.off=e.prototype.removeListener,e.prototype.removeAllListeners=function(S){var k,M,T;if(M=this._events,M===void 0)return this;if(M.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):M[S]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete M[S]),this;if(arguments.length===0){var c=Object.keys(M),h;for(T=0;T=0;T--)this.removeListener(S,k[T]);return this};function f(S,k,M){var T=S._events;if(T===void 0)return[];var c=T[k];return c===void 0?[]:typeof c=="function"?M?[c.listener||c]:[c]:M?w(c):g(c,c.length)}e.prototype.listeners=function(S){return f(this,S,!0)},e.prototype.rawListeners=function(S){return f(this,S,!1)},e.listenerCount=function(S,k){return typeof S.listenerCount=="function"?S.listenerCount(k):v.call(S,k)},e.prototype.listenerCount=v;function v(S){var k=this._events;if(k!==void 0){var M=k[S];if(typeof M=="function")return 1;if(M!==void 0)return M.length}return 0}e.prototype.eventNames=function(){return this._eventsCount>0?E(this._events):[]};function g(S,k){for(var M=new Array(k),T=0;T{var u=l0().EventEmitter,d={init:function(E){if(E._ev instanceof u)return E;var A=new u,t=new u;return E._ev=A,E._internalEv=t,E.on=A.on.bind(A),E.once=A.once.bind(A),E.removeListener=A.removeListener.bind(A),E.removeAllListeners=A.removeAllListeners.bind(A),E._internalOn=t.on.bind(t),E._internalOnce=t.once.bind(t),E._removeInternalListener=t.removeListener.bind(t),E._removeAllInternalListeners=t.removeAllListeners.bind(t),E.emit=function(e,r){A.emit(e,r),t.emit(e,r)},typeof E.addEventListener=="function"&&E.addEventListener("wheel",()=>{},{passive:!0}),E},triggerHandler:function(E,A,t){var e,r=E._ev;if(!r)return;var i=r._events[A];if(!i)return;function n(a){if(a.listener){if(r.removeListener(A,a.listener),!a.fired)return a.fired=!0,a.listener.apply(r,[t])}else return a.apply(r,[t])}i=Array.isArray(i)?i:[i];var o;for(o=0;o{var u=Xr(),d=s0().dfltConfig;function E(t,e){for(var r=[],i,n=0;nd.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)},A.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},A.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},A.undo=function(t){var e,r;if(!(t.undoQueue===void 0||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r{V.exports={_isLinkedToArray:"frames_entry",group:{valType:"string"},name:{valType:"string"},traces:{valType:"any"},baseframe:{valType:"string"},data:{valType:"any"},layout:{valType:"any"}}}),bm=Vt(K=>{var V=ji(),u=Xr(),d=kl(),E=xm(),A=cb(),t=Bg(),e=s0().configAttributes,r=Cu(),i=u.extendDeepAll,n=u.isPlainObject,o=u.isArrayOrTypedArray,a=u.nestedProperty,s=u.valObjectMeta,f="_isSubplotObj",v="_isLinkedToArray",g="_arrayAttrRegexps",m="_deprecated",w=[f,v,g,m];K.IS_SUBPLOT_OBJ=f,K.IS_LINKED_TO_ARRAY=v,K.DEPRECATED=m,K.UNDERSCORE_ATTRS=w,K.get=function(){var z={};return V.allTypes.forEach(function(D){z[D]=S(D)}),{defs:{valObjects:s,metaKeys:w.concat(["description","role","editType","impliedEdits"]),editType:{traces:r.traces,layout:r.layout},impliedEdits:{}},traces:z,layout:k(),frames:M(),animation:T(t),config:T(e)}},K.crawl=function(z,D,B,R){var I=B||0;R=R||"",Object.keys(z).forEach(function(F){var j=z[F];if(w.indexOf(F)===-1){var N=(R?R+".":"")+F;D(j,F,z,I,N),!K.isValObject(j)&&n(j)&&F!=="impliedEdits"&&K.crawl(j,D,I+1,N)}})},K.isValObject=function(z){return z&&z.valType!==void 0},K.findArrayAttributes=function(z){var D=[],B=[],R=[],I,F;function j(G,rt,ct,st){B=B.slice(0,st).concat([rt]),R=R.slice(0,st).concat([G&&G._isLinkedToArray]);var et=G&&(G.valType==="data_array"||G.arrayOk===!0)&&!(B[st-1]==="colorbar"&&(rt==="ticktext"||rt==="tickvals"));et&&N(I,0,"")}function N(G,rt,ct){var st=G[B[rt]],et=ct+B[rt];if(rt===B.length-1)o(st)&&D.push(F+et);else if(R[rt]){if(Array.isArray(st))for(var Z=0;Z=F.length)return!1;if(z.dimensions===2){if(B++,D.length===B)return z;var j=D[B];if(!y(j))return!1;z=F[I][j]}else z=F[I]}else z=F}}return z}function y(z){return z===Math.round(z)&&z>=0}function S(z){var D,B;D=V.modules[z]._module,B=D.basePlotModule;var R={};R.type=null;var I=i({},d),F=i({},D.attributes);K.crawl(F,function(G,rt,ct,st,et){a(I,et).set(void 0),G===void 0&&a(F,et).set(void 0)}),i(R,I),V.traceIs(z,"noOpacity")&&delete R.opacity,V.traceIs(z,"showLegend")||(delete R.showlegend,delete R.legendgroup),V.traceIs(z,"noHover")&&(delete R.hoverinfo,delete R.hoverlabel),D.selectPoints||delete R.selectedpoints,i(R,F),B.attributes&&i(R,B.attributes),R.type=z;var j={meta:D.meta||{},categories:D.categories||{},animatable:!!D.animatable,type:z,attributes:T(R)};if(D.layoutAttributes){var N={};i(N,D.layoutAttributes),j.layoutAttributes=T(N)}return D.animatable||K.crawl(j,function(G){K.isValObject(G)&&"anim"in G&&delete G.anim}),j}function k(){var z={},D,B;i(z,E);for(D in V.subplotsRegistry)if(B=V.subplotsRegistry[D],!!B.layoutAttributes)if(Array.isArray(B.attr))for(var R=0;R{var V=Xr(),u=kl(),d="templateitemname",E={name:{valType:"string",editType:"none"}};E[d]={valType:"string",editType:"calc"},K.templatedArray=function(e,r){return r._isLinkedToArray=e,r.name=E.name,r[d]=E[d],r},K.traceTemplater=function(e){var r={},i,n;for(i in e)n=e[i],Array.isArray(n)&&n.length&&(r[i]=0);function o(a){i=V.coerce(a,{},u,"type");var s={type:i,_template:null};if(i in r){n=e[i];var f=r[i]%n.length;r[i]++,s._template=n[f]}return s}return{newTrace:o}},K.newContainer=function(e,r,i){var n=e._template,o=n&&(n[r]||i&&n[i]);V.isPlainObject(o)||(o=null);var a=e[r]={_template:o};return a},K.arrayTemplater=function(e,r,i){var n=e._template,o=n&&n[t(r)],a=n&&n[r];(!Array.isArray(a)||!a.length)&&(a=[]);var s={};function f(g){var m={name:g.name,_input:g},w=m[d]=g[d];if(!A(w))return m._template=o,m;for(var l=0;l=n&&(i._input||{})._templateitemname;a&&(o=n);var s=r+"["+o+"]",f;function v(){f={},a&&(f[s]={},f[s][d]=a)}v();function g(x,y){f[x]=y}function m(x,y){a?V.nestedProperty(f[s],x).set(y):f[s+"."+x]=y}function w(){var x=f;return v(),x}function l(x,y){x&&m(x,y);var S=w();for(var k in S)V.nestedProperty(e,k).set(S[k])}return{modifyBase:g,modifyItem:m,getUpdateObj:w,applyUpdate:l}}}),Mf=Vt((K,V)=>{var u=ym().counter;V.exports={idRegex:{x:u("x","( domain)?"),y:u("y","( domain)?")},attrRegex:u("[xy]axis"),xAxisMatch:u("xaxis"),yAxisMatch:u("yaxis"),AX_ID_PATTERN:/^[xyz][0-9]*( domain)?$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,SUBPLOT_PATTERN:/^x([0-9]*)y([0-9]*)$/,HOUR_PATTERN:"hour",WEEKDAY_PATTERN:"day of week",MINDRAG:8,MINZOOM:20,DRAGGERSIZE:20,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],traceLayerClasses:["imagelayer","heatmaplayer","contourcarpetlayer","contourlayer","funnellayer","waterfalllayer","barlayer","carpetlayer","violinlayer","boxlayer","ohlclayer","scattercarpetlayer","scatterlayer"],clipOnAxisFalseQuery:[".scatterlayer",".barlayer",".funnellayer",".waterfalllayer"],layerValue2layerClass:{"above traces":"above","below traces":"below"},zindexSeparator:"z"}}),fc=Vt(K=>{var V=ji(),u=Mf();K.id2name=function(E){if(!(typeof E!="string"||!E.match(u.AX_ID_PATTERN))){var A=E.split(" ")[0].slice(1);return A==="1"&&(A=""),E.charAt(0)+"axis"+A}},K.name2id=function(E){if(E.match(u.AX_NAME_PATTERN)){var A=E.slice(5);return A==="1"&&(A=""),E.charAt(0)+A}},K.cleanId=function(E,A,t){var e=/( domain)$/.test(E);if(!(typeof E!="string"||!E.match(u.AX_ID_PATTERN))&&!(A&&E.charAt(0)!==A)&&!(e&&!t)){var r=E.split(" ")[0].slice(1).replace(/^0+/,"");return r==="1"&&(r=""),E.charAt(0)+r+(e&&t?" domain":"")}},K.list=function(E,A,t){var e=E._fullLayout;if(!e)return[];var r=K.listIds(E,A),i=new Array(r.length),n;for(n=0;ne?1:-1:+(E.slice(1)||1)-+(A.slice(1)||1)},K.ref2id=function(E){return/^[xyz]/.test(E)?E.split(" ")[0]:!1};function d(E,A){if(A&&A.length){for(var t=0;t{function u(E){var A=E._fullLayout._zoomlayer;A&&A.selectAll(".outline-controllers").remove()}function d(E){var A=E._fullLayout._zoomlayer;A&&A.selectAll(".select-outline").remove(),E._fullLayout._outlining=!1}V.exports={clearOutlineControllers:u,clearOutline:d}}),qy=Vt((K,V)=>{V.exports={scattermode:{valType:"enumerated",values:["group","overlay"],dflt:"overlay",editType:"calc"},scattergap:{valType:"number",min:0,max:1,editType:"calc"}}}),Pf=Vt(K=>{var V=ji();Mf().SUBPLOT_PATTERN,K.getSubplotCalcData=function(u,d,E){var A=V.subplotsRegistry[d];if(!A)return[];for(var t=A.attr,e=[],r=0;r{var V=ji(),u=Xr();K.manageCommandObserver=function(r,i,n,o){var a={},s=!0;i&&i._commandObserver&&(a=i._commandObserver),a.cache||(a.cache={}),a.lookupTable={};var f=K.hasSimpleAPICommandBindings(r,n,a.lookupTable);if(i&&i._commandObserver){if(f)return a;if(i._commandObserver.remove)return i._commandObserver.remove(),i._commandObserver=null,a}if(f){d(r,f,a.cache),a.check=function(){if(s){var m=d(r,f,a.cache);return m.changed&&o&&a.lookupTable[m.value]!==void 0&&(a.disable(),Promise.resolve(o({value:m.value,type:f.type,prop:f.prop,traces:f.traces,index:a.lookupTable[m.value]})).then(a.enable,a.enable)),m.changed}};for(var v=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],g=0;g0?".":"")+a;u.isPlainObject(s)?e(s,i,f,o+1):i(f,a,s)}})}}),Vu=Vt((K,V)=>{var u=Ni(),d=mm().timeFormatLocale,E=tb().formatLocale,A=Lo(),t=eb(),e=ji(),r=bm(),i=cl(),n=Xr(),o=Pi(),a=ks().BADNUM,s=fc(),f=kd().clearOutline,v=qy(),g=Bg(),m=cb(),w=Pf().getModuleCalcData,l=n.relinkPrivateKeys,x=n._,y=V.exports={};n.extendFlat(y,e),y.attributes=kl(),y.attributes.type.values=y.allTypes,y.fontAttrs=yu(),y.layoutAttributes=xm();var S=GT();y.executeAPICommand=S.executeAPICommand,y.computeAPICommandBindings=S.computeAPICommandBindings,y.manageCommandObserver=S.manageCommandObserver,y.hasSimpleAPICommandBindings=S.hasSimpleAPICommandBindings,y.redrawText=function(Z){return Z=n.getGraphDiv(Z),new Promise(function(ot){setTimeout(function(){Z._fullLayout&&(e.getComponentMethod("annotations","draw")(Z),e.getComponentMethod("legend","draw")(Z),e.getComponentMethod("colorbar","draw")(Z),ot(y.previousPromises(Z)))},300)})},y.resize=function(Z){Z=n.getGraphDiv(Z);var ot,X=new Promise(function(Q,ut){(!Z||n.isHidden(Z))&&ut(new Error("Resize must be passed a displayed plot div element.")),Z._redrawTimer&&clearTimeout(Z._redrawTimer),Z._resolveResize&&(ot=Z._resolveResize),Z._resolveResize=Q,Z._redrawTimer=setTimeout(function(){if(!Z.layout||Z.layout.width&&Z.layout.height||n.isHidden(Z)){Q(Z);return}delete Z.layout.width,delete Z.layout.height;var J=Z.changed;Z.autoplay=!0,e.call("relayout",Z,{autosize:!0}).then(function(){Z.changed=J,Z._resolveResize===Q&&(delete Z._resolveResize,Q(Z))})},100)});return ot&&ot(X),X},y.previousPromises=function(Z){if((Z._promises||[]).length)return Promise.all(Z._promises).then(function(){Z._promises=[]})},y.addLinks=function(Z){if(!(!Z._context.showLink&&!Z._context.showSources)){var ot=Z._fullLayout,X=n.ensureSingle(ot._paper,"text","js-plot-link-container",function(nt){nt.style({"font-family":'"Open Sans", Arial, sans-serif',"font-size":"12px",fill:o.defaultLine,"pointer-events":"all"}).each(function(){var dt=u.select(this);dt.append("tspan").classed("js-link-to-tool",!0),dt.append("tspan").classed("js-link-spacer",!0),dt.append("tspan").classed("js-sourcelinks",!0)})}),Q=X.node(),ut={y:ot._paper.attr("height")-9};document.body.contains(Q)&&Q.getComputedTextLength()>=ot.width-20?(ut["text-anchor"]="start",ut.x=5):(ut["text-anchor"]="end",ut.x=ot._paper.attr("width")-7),X.attr(ut);var J=X.select(".js-link-to-tool"),q=X.select(".js-link-spacer"),it=X.select(".js-sourcelinks");Z._context.showSources&&Z._context.showSources(Z),Z._context.showLink&&k(Z,J),q.text(J.text()&&it.text()?" - ":"")}};function k(Z,ot){ot.text("");var X=ot.append("a").attr({"xlink:xlink:href":"#",class:"link--impt link--embedview","font-weight":"bold"}).text(Z._context.linkText+" »");if(Z._context.sendData)X.on("click",function(){y.sendDataToCloud(Z)});else{var Q=window.location.pathname.split("/"),ut=window.location.search;X.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+Q[2].split(".")[0]+"/"+Q[1]+ut})}}y.sendDataToCloud=function(Z){var ot=(window.PLOTLYENV||{}).BASE_URL||Z._context.plotlyServerURL;if(ot){Z.emit("plotly_beforeexport");var X=u.select(Z).append("div").attr("id","hiddenform").style("display","none"),Q=X.append("form").attr({action:ot+"/external",method:"post",target:"_blank"}),ut=Q.append("input").attr({type:"text",name:"data"});return ut.node().value=y.graphJson(Z,!1,"keepdata"),Q.node().submit(),X.remove(),Z.emit("plotly_afterexport"),!1}};var M=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],T=["year","month","dayMonth","dayMonthYear"];y.supplyDefaults=function(Z,ot){var X=ot&&ot.skipUpdateCalc,Q=Z._fullLayout||{};if(Q._skipDefaults){delete Q._skipDefaults;return}var ut=Z._fullLayout={},J=Z.layout||{},q=Z._fullData||[],it=Z._fullData=[],nt=Z.data||[],dt=Z.calcdata||[],Tt=Z._context||{},wt;Z._transitionData||y.createTransitionData(Z),ut._dfltTitle={plot:x(Z,"Click to enter Plot title"),subtitle:x(Z,"Click to enter Plot subtitle"),x:x(Z,"Click to enter X axis title"),y:x(Z,"Click to enter Y axis title"),colorbar:x(Z,"Click to enter Colorscale title"),annotation:x(Z,"new text")},ut._traceWord=x(Z,"trace");var Ct=b(Z,M);if(ut._mapboxAccessToken=Tt.mapboxAccessToken,Q._initialAutoSizeIsDone){var It=Q.width,Nt=Q.height;y.supplyLayoutGlobalDefaults(J,ut,Ct),J.width||(ut.width=It),J.height||(ut.height=Nt),y.sanitizeMargins(ut)}else{y.supplyLayoutGlobalDefaults(J,ut,Ct);var te=!J.width||!J.height,Jt=ut.autosize,ee=Tt.autosizable,Zt=te&&(Jt||ee);Zt?y.plotAutoSize(Z,J,ut):te&&y.sanitizeMargins(ut),!Jt&&te&&(J.width=ut.width,J.height=ut.height)}ut._d3locale=_(Ct,ut.separators),ut._extraFormat=b(Z,T),ut._initialAutoSizeIsDone=!0,ut._dataLength=nt.length,ut._modules=[],ut._visibleModules=[],ut._basePlotModules=[];var mt=ut._subplots=h(),bt=ut._splomAxes={x:{},y:{}},vt=ut._splomSubplots={};ut._splomGridDflt={},ut._scatterStackOpts={},ut._firstScatter={},ut._alignmentOpts={},ut._colorAxes={},ut._requestRangeslider={},ut._traceUids=c(q,nt),y.supplyDataDefaults(nt,it,J,ut);var Ut=Object.keys(bt.x),re=Object.keys(bt.y);if(Ut.length>1&&re.length>1){for(e.getComponentMethod("grid","sizeDefaults")(J,ut),wt=0;wt15&&re.length>15&&ut.shapes.length===0&&ut.images.length===0,y.linkSubplots(it,ut,q,Q),y.cleanPlot(it,ut,q,Q);var We=!!(Q._has&&Q._has("cartesian")),qe=!!(ut._has&&ut._has("cartesian")),vr=We,_r=qe;vr&&!_r?Q._bgLayer.remove():_r&&!vr&&(ut._shouldCreateBgLayer=!0),Q._zoomlayer&&!Z._dragging&&f({_fullLayout:Q}),P(it,ut),l(ut,Q),e.getComponentMethod("colorscale","crossTraceDefaults")(it,ut),ut._preGUI||(ut._preGUI={}),ut._tracePreGUI||(ut._tracePreGUI={});var er=ut._tracePreGUI,Mr={},Ir;for(Ir in er)Mr[Ir]="old";for(wt=0;wt0){var dt=1-2*ut;J=Math.round(dt*J),q=Math.round(dt*q)}}var Tt=y.layoutAttributes.width.min,wt=y.layoutAttributes.height.min;J1,It=!ot.height&&Math.abs(X.height-q)>1;(It||Ct)&&(Ct&&(X.width=J),It&&(X.height=q)),Z._initialAutoSize||(Z._initialAutoSize={width:J,height:q}),y.sanitizeMargins(X)},y.supplyLayoutModuleDefaults=function(Z,ot,X,Q){var ut=e.componentsRegistry,J=ot._basePlotModules,q,it,nt,dt=e.subplotsRegistry.cartesian;for(q in ut)nt=ut[q],nt.includeBasePlot&&nt.includeBasePlot(Z,ot);J.length||J.push(dt),ot._has("cartesian")&&(e.getComponentMethod("grid","contentDefaults")(Z,ot),dt.finalizeSubplots(Z,ot));for(var Tt in ot._subplots)ot._subplots[Tt].sort(n.subplotSort);for(it=0;it1&&(X.l/=Jt,X.r/=Jt)}if(Ct){var ee=(X.t+X.b)/Ct;ee>1&&(X.t/=ee,X.b/=ee)}var Zt=X.xl!==void 0?X.xl:X.x,mt=X.xr!==void 0?X.xr:X.x,bt=X.yt!==void 0?X.yt:X.y,vt=X.yb!==void 0?X.yb:X.y;It[ot]={l:{val:Zt,size:X.l+te},r:{val:mt,size:X.r+te},b:{val:vt,size:X.b+te},t:{val:bt,size:X.t+te}},Nt[ot]=1}if(!Q._replotting)return y.doAutoMargin(Z)}};function F(Z){if("_redrawFromAutoMarginCount"in Z._fullLayout)return!1;var ot=s.list(Z,"",!0);for(var X in ot)if(ot[X].autoshift||ot[X].shift)return!0;return!1}y.doAutoMargin=function(Z){var ot=Z._fullLayout,X=ot.width,Q=ot.height;ot._size||(ot._size={}),B(ot);var ut=ot._size,J=ot.margin,q={t:0,b:0,l:0,r:0},it=n.extendFlat({},ut),nt=J.l,dt=J.r,Tt=J.t,wt=J.b,Ct=ot._pushmargin,It=ot._pushmarginIds,Nt=ot.minreducedwidth,te=ot.minreducedheight;if(J.autoexpand!==!1){for(var Jt in Ct)It[Jt]||delete Ct[Jt];var ee=Z._fullLayout._reservedMargin;for(var Zt in ee)for(var mt in ee[Zt]){var bt=ee[Zt][mt];q[mt]=Math.max(q[mt],bt)}Ct.base={l:{val:0,size:nt},r:{val:1,size:dt},t:{val:1,size:Tt},b:{val:0,size:wt}};for(var vt in q){var Ut=0;for(var re in Ct)re!=="base"&&A(Ct[re][vt].size)&&(Ut=Ct[re][vt].size>Ut?Ct[re][vt].size:Ut);var Kt=Math.max(0,J[vt]-Ut);q[vt]=Math.max(0,q[vt]-Kt)}for(var ue in Ct){var Me=Ct[ue].l||{},Ce=Ct[ue].b||{},We=Me.val,qe=Me.size,vr=Ce.val,_r=Ce.size,er=X-q.r-q.l,Mr=Q-q.t-q.b;for(var Ir in Ct){if(A(qe)&&Ct[Ir].r){var de=Ct[Ir].r.val,Dt=Ct[Ir].r.size;if(de>We){var qt=(qe*de+(Dt-er)*We)/(de-We),_t=(Dt*(1-We)+(qe-er)*(1-de))/(de-We);qt+_t>nt+dt&&(nt=qt,dt=_t)}}if(A(_r)&&Ct[Ir].t){var lt=Ct[Ir].t.val,yt=Ct[Ir].t.size;if(lt>vr){var St=(_r*lt+(yt-Mr)*vr)/(lt-vr),Ht=(yt*(1-vr)+(_r-Mr)*(1-lt))/(lt-vr);St+Ht>wt+Tt&&(wt=St,Tt=Ht)}}}}}var Yt=n.constrain(X-J.l-J.r,R,Nt),se=n.constrain(Q-J.t-J.b,I,te),ke=Math.max(0,X-Yt),Ee=Math.max(0,Q-se);if(ke){var Ue=(nt+dt)/ke;Ue>1&&(nt/=Ue,dt/=Ue)}if(Ee){var ir=(wt+Tt)/Ee;ir>1&&(wt/=ir,Tt/=ir)}if(ut.l=Math.round(nt)+q.l,ut.r=Math.round(dt)+q.r,ut.t=Math.round(Tt)+q.t,ut.b=Math.round(wt)+q.b,ut.p=Math.round(J.pad),ut.w=Math.round(X)-ut.l-ut.r,ut.h=Math.round(Q)-ut.t-ut.b,!ot._replotting&&(y.didMarginChange(it,ut)||F(Z))){"_redrawFromAutoMarginCount"in ot?ot._redrawFromAutoMarginCount++:ot._redrawFromAutoMarginCount=1;var ar=3*(1+Object.keys(It).length);if(ot._redrawFromAutoMarginCount1)return!0}return!1},y.graphJson=function(Z,ot,X,Q,ut,J){(ut&&ot&&!Z._fullData||ut&&!ot&&!Z._fullLayout)&&y.supplyDefaults(Z);var q=ut?Z._fullData:Z.data,it=ut?Z._fullLayout:Z.layout,nt=(Z._transitionData||{})._frames;function dt(Ct,It){if(typeof Ct=="function")return It?"_function_":null;if(n.isPlainObject(Ct)){var Nt={},te;return Object.keys(Ct).sort().forEach(function(mt){if(["_","["].indexOf(mt.charAt(0))===-1){if(typeof Ct[mt]=="function"){It&&(Nt[mt]="_function");return}if(X==="keepdata"){if(mt.slice(-3)==="src")return}else if(X==="keepstream"){if(te=Ct[mt+"src"],typeof te=="string"&&te.indexOf(":")>0&&!n.isPlainObject(Ct.stream))return}else if(X!=="keepall"&&(te=Ct[mt+"src"],typeof te=="string"&&te.indexOf(":")>0))return;Nt[mt]=dt(Ct[mt],It)}}),Nt}var Jt=Array.isArray(Ct),ee=n.isTypedArray(Ct);if((Jt||ee)&&Ct.dtype&&Ct.shape){var Zt=Ct.bdata;return dt({dtype:Ct.dtype,shape:Ct.shape,bdata:n.isArrayBuffer(Zt)?t.encode(Zt):Zt},It)}return Jt?Ct.map(function(mt){return dt(mt,It)}):ee?n.simpleMap(Ct,n.identity):n.isJSDate(Ct)?n.ms2DateTimeLocal(+Ct):Ct}var Tt={data:(q||[]).map(function(Ct){var It=dt(Ct);return ot&&delete It.fit,It})};if(!ot&&(Tt.layout=dt(it),ut)){var wt=it._size;Tt.layout.computed={margin:{b:wt.b,l:wt.l,r:wt.r,t:wt.t}}}return nt&&(Tt.frames=dt(nt)),J&&(Tt.config=dt(Z._context,!0)),Q==="object"?Tt:JSON.stringify(Tt)},y.modifyFrames=function(Z,ot){var X,Q,ut,J=Z._transitionData._frames,q=Z._transitionData._frameHash;for(X=0;X0&&(Z._transitioningWithDuration=!0),Z._transitionData._interruptCallbacks.push(function(){Q=!0}),X.redraw&&Z._transitionData._interruptCallbacks.push(function(){return e.call("redraw",Z)}),Z._transitionData._interruptCallbacks.push(function(){Z.emit("plotly_transitioninterrupted",[])});var Ct=0,It=0;function Nt(){return Ct++,function(){It++,!Q&&It===Ct&&it(wt)}}X.runFn(Nt),setTimeout(Nt())})}function it(wt){if(Z._transitionData)return J(Z._transitionData._interruptCallbacks),Promise.resolve().then(function(){if(X.redraw)return e.call("redraw",Z)}).then(function(){Z._transitioning=!1,Z._transitioningWithDuration=!1,Z.emit("plotly_transitioned",[])}).then(wt)}function nt(){if(Z._transitionData)return Z._transitioning=!1,ut(Z._transitionData._interruptCallbacks)}var dt=[y.previousPromises,nt,X.prepareFn,y.rehover,y.reselect,q],Tt=n.syncOrAsync(dt,Z);return(!Tt||!Tt.then)&&(Tt=Promise.resolve()),Tt.then(function(){return Z})}y.doCalcdata=function(Z,ot){var X=s.list(Z),Q=Z._fullData,ut=Z._fullLayout,J,q,it,nt,dt=new Array(Q.length),Tt=(Z.calcdata||[]).slice();for(Z.calcdata=dt,ut._numBoxes=0,ut._numViolins=0,ut._violinScaleGroupStats={},Z._hmpixcount=0,Z._hmlumcount=0,ut._piecolormap={},ut._sunburstcolormap={},ut._treemapcolormap={},ut._iciclecolormap={},ut._funnelareacolormap={},it=0;it=0;nt--)if(vt[nt].enabled){J._indexToPoints=vt[nt]._indexToPoints;break}q&&q.calc&&(bt=q.calc(Z,J))}(!Array.isArray(bt)||!bt[0])&&(bt=[{x:a,y:a}]),bt[0].t||(bt[0].t={}),bt[0].trace=J,dt[Zt]=bt}}for(st(X,Q,ut),it=0;it{K.xmlns="http://www.w3.org/2000/xmlns/",K.svg="http://www.w3.org/2000/svg",K.xlink="http://www.w3.org/1999/xlink",K.svgAttrs={xmlns:K.svg,"xmlns:xlink":K.xlink}}),gf=Vt((K,V)=>{V.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},FROM_BR:{left:1,center:.5,right:0,bottom:0,middle:.5,top:1},LINE_SPACING:1.3,CAP_SHIFT:.7,MID_SHIFT:.35,OPPOSITE_SIDE:{left:"right",right:"left",top:"bottom",bottom:"top"}}}),Dl=Vt(K=>{var V=Ni(),u=Xr(),d=u.strTranslate,E=zh(),A=gf().LINE_SPACING,t=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;K.convertToTspans=function(I,F,j){var N=I.text(),G=!I.attr("data-notex")&&F&&F._context.typesetMath&&typeof MathJax<"u"&&N.match(t),rt=V.select(I.node().parentNode);if(rt.empty())return;var ct=I.attr("class")?I.attr("class").split(" ")[0]:"text";ct+="-math",rt.selectAll("svg."+ct).remove(),rt.selectAll("g."+ct+"-group").remove(),I.style("display",null).attr({"data-unformatted":N,"data-math":"N"});function st(){rt.empty()||(ct=I.attr("class")+"-math",rt.select("svg."+ct).remove()),I.text("").style("white-space","pre");var et=z(I.node(),N);et&&I.style("pointer-events","all"),K.positionText(I),j&&j.call(I)}return G?(F&&F._promises||[]).push(new Promise(function(et){I.style("display","none");var Z=parseInt(I.node().style.fontSize,10),ot={fontSize:Z};o(G[2],ot,function(X,Q,ut){rt.selectAll("svg."+ct).remove(),rt.selectAll("g."+ct+"-group").remove();var J=X&&X.select("svg");if(!J||!J.node()){st(),et();return}var q=rt.append("g").classed(ct+"-group",!0).attr({"pointer-events":"none","data-unformatted":N,"data-math":"Y"});q.node().appendChild(J.node()),Q&&Q.node()&&J.node().insertBefore(Q.node().cloneNode(!0),J.node().firstChild);var it=ut.width,nt=ut.height;J.attr({class:ct,height:nt,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var dt=I.node().style.fill||"black",Tt=J.select("g");Tt.attr({fill:dt,stroke:dt});var wt=Tt.node().getBoundingClientRect(),Ct=wt.width,It=wt.height;(Ct>it||It>nt)&&(J.style("overflow","hidden"),wt=J.node().getBoundingClientRect(),Ct=wt.width,It=wt.height);var Nt=+I.attr("x"),te=+I.attr("y"),Jt=Z||I.node().getBoundingClientRect().height,ee=-Jt/4;if(ct[0]==="y")q.attr({transform:"rotate("+[-90,Nt,te]+")"+d(-Ct/2,ee-It/2)});else if(ct[0]==="l")te=ee-It/2;else if(ct[0]==="a"&&ct.indexOf("atitle")!==0)Nt=0,te=ee;else{var Zt=I.attr("text-anchor");Nt=Nt-Ct*(Zt==="middle"?.5:Zt==="end"?1:0),te=te+ee-It/2}J.attr({x:Nt,y:te}),j&&j.call(I,q),et(q)})})):st(),I};var e=/(<|<|<)/g,r=/(>|>|>)/g;function i(I){return I.replace(e,"\\lt ").replace(r,"\\gt ")}var n=[["$","$"],["\\(","\\)"]];function o(I,F,j){var N=parseInt((MathJax.version||"").split(".")[0]);if(N!==2&&N!==3){u.warn("No MathJax version:",MathJax.version);return}var G,rt,ct,st,et=function(){return rt=u.extendDeepAll({},MathJax.Hub.config),ct=MathJax.Hub.processSectionDelay,MathJax.Hub.processSectionDelay!==void 0&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:n},displayAlign:"left"})},Z=function(){rt=u.extendDeepAll({},MathJax.config),MathJax.config.tex||(MathJax.config.tex={}),MathJax.config.tex.inlineMath=n},ot=function(){if(G=MathJax.Hub.config.menuSettings.renderer,G!=="SVG")return MathJax.Hub.setRenderer("SVG")},X=function(){G=MathJax.config.startup.output,G!=="svg"&&(MathJax.config.startup.output="svg")},Q=function(){var dt="math-output-"+u.randstr({},64);st=V.select("body").append("div").attr({id:dt}).style({visibility:"hidden",position:"absolute","font-size":F.fontSize+"px"}).text(i(I));var Tt=st.node();return N===2?MathJax.Hub.Typeset(Tt):MathJax.typeset([Tt])},ut=function(){var dt=st.select(N===2?".MathJax_SVG":".MathJax"),Tt=!dt.empty()&&st.select("svg").node();if(!Tt)u.log("There was an error in the tex syntax.",I),j();else{var wt=Tt.getBoundingClientRect(),Ct;N===2?Ct=V.select("body").select("#MathJax_SVG_glyphs"):Ct=dt.select("defs"),j(dt,Ct,wt)}st.remove()},J=function(){if(G!=="SVG")return MathJax.Hub.setRenderer(G)},q=function(){G!=="svg"&&(MathJax.config.startup.output=G)},it=function(){return ct!==void 0&&(MathJax.Hub.processSectionDelay=ct),MathJax.Hub.Config(rt)},nt=function(){MathJax.config=rt};N===2?MathJax.Hub.Queue(et,ot,Q,ut,J,it):N===3&&(Z(),X(),MathJax.startup.defaultReady(),MathJax.startup.promise.then(function(){Q(),ut(),q(),nt()}))}var a={sup:"font-size:70%",sub:"font-size:70%",s:"text-decoration:line-through",u:"text-decoration:underline",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},s={sub:"0.3em",sup:"-0.6em"},f={sub:"-0.21em",sup:"0.42em"},v="​",g=["http:","https:","mailto:","",void 0,":"],m=K.NEWLINES=/(\r\n?|\n)/g,w=/(<[^<>]*>)/,l=/<(\/?)([^ >]*)(\s+(.*))?>/i,x=//i;K.BR_TAG_ALL=//gi;var y=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,S=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,k=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,M=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function T(I,F){if(!I)return null;var j=I.match(F),N=j&&(j[3]||j[4]);return N&&_(N)}var c=/(^|;)\s*color:/;K.plainText=function(I,F){F=F||{};for(var j=F.len!==void 0&&F.len!==-1?F.len:1/0,N=F.allowedTags!==void 0?F.allowedTags:["br"],G="...",rt=G.length,ct=I.split(w),st=[],et="",Z=0,ot=0;otrt?st.push(X.slice(0,Math.max(0,q-rt))+G):st.push(X.slice(0,q));break}et=""}}return st.join("")};var h={mu:"μ",amp:"&",lt:"<",gt:">",nbsp:" ",times:"×",plusmn:"±",deg:"°"},b=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function _(I){return I.replace(b,function(F,j){var N;return j.charAt(0)==="#"?N=P(j.charAt(1)==="x"?parseInt(j.slice(2),16):parseInt(j.slice(1),10)):N=h[j],N||F})}K.convertEntities=_;function P(I){if(!(I>1114111)){var F=String.fromCodePoint;if(F)return F(I);var j=String.fromCharCode;return I<=65535?j(I):j((I>>10)+55232,I%1024+56320)}}function z(I,F){F=F.replace(m," ");var j=!1,N=[],G,rt=-1;function ct(){rt++;var It=document.createElementNS(E.svg,"tspan");V.select(It).attr({class:"line",dy:rt*A+"em"}),I.appendChild(It),G=It;var Nt=N;if(N=[{node:It}],Nt.length>1)for(var te=1;te.",F);return}var Nt=N.pop();It!==Nt.type&&u.log("Start tag <"+Nt.type+"> doesnt match end tag <"+It+">. Pretending it did match.",F),G=N[N.length-1].node}var ot=x.test(F);ot?ct():(G=I,N=[{node:I}]);for(var X=F.split(w),Q=0;Q{var u=Ni(),d=Af(),E=Lo(),A=Xr(),t=Pi(),e=o0().isValid;function r(m,w,l){var x=w?A.nestedProperty(m,w).get()||{}:m,y=x[l||"color"];y&&y._inputArray&&(y=y._inputArray);var S=!1;if(A.isArrayOrTypedArray(y)){for(var k=0;k=0;x--,y++){var S=m[x];l[y]=[1-S[0],S[1]]}return l}function f(m,w){w=w||{};for(var l=m.domain,x=m.range,y=x.length,S=new Array(y),k=0;k{var u=ob(),d=u.FORMAT_LINK,E=u.DATE_FORMAT_LINK;function A(r,i){return{valType:"string",dflt:"",editType:"none",description:(i?t:e)("hover text",r)+["By default the values are formatted using "+(i?"generic number format":"`"+r+"axis.hoverformat`")+"."].join(" ")}}function t(r,i){return["Sets the "+r+" formatting rule"+(i?"for `"+i+"` ":""),"using d3 formatting mini-languages","which are very similar to those in Python. For numbers, see: "+d+"."].join(" ")}function e(r,i){return t(r,i)+[" And for dates see: "+E+".","We add two items to d3's date formatter:","*%h* for half of the year as a decimal number as well as","*%{n}f* for fractional seconds","with n digits. For example, *2016-10-13 09:15:23.456* with tickformat","*%H~%M~%S.%2f* would display *09~15~23.46*"].join(" ")}V.exports={axisHoverFormat:A,descriptionOnlyNumbers:t,descriptionWithDates:e}}),Of=Vt((K,V)=>{var u=yu(),d=af(),E=If().dash,A=So().extendFlat,t=cl().templatedArray;yl().templateFormatStringDescription;var e=hc().descriptionWithDates,r=ks().ONEDAY,i=Mf(),n=i.HOUR_PATTERN,o=i.WEEKDAY_PATTERN,a={valType:"enumerated",values:["auto","linear","array"],editType:"ticks",impliedEdits:{tick0:void 0,dtick:void 0}},s=A({},a,{values:a.values.slice().concat(["sync"])});function f(c){return{valType:"integer",min:0,dflt:c?5:0,editType:"ticks"}}var v={valType:"any",editType:"ticks",impliedEdits:{tickmode:"linear"}},g={valType:"any",editType:"ticks",impliedEdits:{tickmode:"linear"}},m={valType:"data_array",editType:"ticks"},w={valType:"enumerated",values:["outside","inside",""],editType:"ticks"};function l(c){var h={valType:"number",min:0,editType:"ticks"};return c||(h.dflt=5),h}function x(c){var h={valType:"number",min:0,editType:"ticks"};return c||(h.dflt=1),h}var y={valType:"color",dflt:d.defaultLine,editType:"ticks"},S={valType:"color",dflt:d.lightLine,editType:"ticks"};function k(c){var h={valType:"number",min:0,editType:"ticks"};return c||(h.dflt=1),h}var M=A({},E,{editType:"ticks"}),T={valType:"boolean",editType:"ticks"};V.exports={visible:{valType:"boolean",editType:"plot"},color:{valType:"color",dflt:d.defaultLine,editType:"ticks"},title:{text:{valType:"string",editType:"ticks"},font:u({editType:"ticks"}),standoff:{valType:"number",min:0,editType:"ticks"},editType:"ticks"},type:{valType:"enumerated",values:["-","linear","log","date","category","multicategory"],dflt:"-",editType:"calc",_noTemplating:!0},autotypenumbers:{valType:"enumerated",values:["convert types","strict"],dflt:"convert types",editType:"calc"},autorange:{valType:"enumerated",values:[!0,!1,"reversed","min reversed","max reversed","min","max"],dflt:!0,editType:"axrange",impliedEdits:{"range[0]":void 0,"range[1]":void 0}},autorangeoptions:{minallowed:{valType:"any",editType:"plot",impliedEdits:{"range[0]":void 0,"range[1]":void 0}},maxallowed:{valType:"any",editType:"plot",impliedEdits:{"range[0]":void 0,"range[1]":void 0}},clipmin:{valType:"any",editType:"plot",impliedEdits:{"range[0]":void 0,"range[1]":void 0}},clipmax:{valType:"any",editType:"plot",impliedEdits:{"range[0]":void 0,"range[1]":void 0}},include:{valType:"any",arrayOk:!0,editType:"plot",impliedEdits:{"range[0]":void 0,"range[1]":void 0}},editType:"plot"},rangemode:{valType:"enumerated",values:["normal","tozero","nonnegative"],dflt:"normal",editType:"plot"},range:{valType:"info_array",items:[{valType:"any",editType:"axrange",impliedEdits:{"^autorange":!1},anim:!0},{valType:"any",editType:"axrange",impliedEdits:{"^autorange":!1},anim:!0}],editType:"axrange",impliedEdits:{autorange:!1},anim:!0},minallowed:{valType:"any",editType:"plot",impliedEdits:{"^autorange":!1}},maxallowed:{valType:"any",editType:"plot",impliedEdits:{"^autorange":!1}},fixedrange:{valType:"boolean",dflt:!1,editType:"calc"},modebardisable:{valType:"flaglist",flags:["autoscale","zoominout"],extras:["none"],dflt:"none",editType:"modebar"},insiderange:{valType:"info_array",items:[{valType:"any",editType:"plot"},{valType:"any",editType:"plot"}],editType:"plot"},scaleanchor:{valType:"enumerated",values:[i.idRegex.x.toString(),i.idRegex.y.toString(),!1],editType:"plot"},scaleratio:{valType:"number",min:0,dflt:1,editType:"plot"},constrain:{valType:"enumerated",values:["range","domain"],editType:"plot"},constraintoward:{valType:"enumerated",values:["left","center","right","top","middle","bottom"],editType:"plot"},matches:{valType:"enumerated",values:[i.idRegex.x.toString(),i.idRegex.y.toString()],editType:"calc"},rangebreaks:t("rangebreak",{enabled:{valType:"boolean",dflt:!0,editType:"calc"},bounds:{valType:"info_array",items:[{valType:"any",editType:"calc"},{valType:"any",editType:"calc"}],editType:"calc"},pattern:{valType:"enumerated",values:[o,n,""],editType:"calc"},values:{valType:"info_array",freeLength:!0,editType:"calc",items:{valType:"any",editType:"calc"}},dvalue:{valType:"number",editType:"calc",min:0,dflt:r},editType:"calc"}),tickmode:s,nticks:f(),tick0:v,dtick:g,ticklabelstep:{valType:"integer",min:1,dflt:1,editType:"ticks"},tickvals:m,ticktext:{valType:"data_array",editType:"ticks"},ticks:w,tickson:{valType:"enumerated",values:["labels","boundaries"],dflt:"labels",editType:"ticks"},ticklabelmode:{valType:"enumerated",values:["instant","period"],dflt:"instant",editType:"ticks"},ticklabelposition:{valType:"enumerated",values:["outside","inside","outside top","inside top","outside left","inside left","outside right","inside right","outside bottom","inside bottom"],dflt:"outside",editType:"calc"},ticklabeloverflow:{valType:"enumerated",values:["allow","hide past div","hide past domain"],editType:"calc"},ticklabelshift:{valType:"integer",dflt:0,editType:"ticks"},ticklabelstandoff:{valType:"integer",dflt:0,editType:"ticks"},ticklabelindex:{valType:"integer",arrayOk:!0,editType:"calc"},mirror:{valType:"enumerated",values:[!0,"ticks",!1,"all","allticks"],dflt:!1,editType:"ticks+layoutstyle"},ticklen:l(),tickwidth:x(),tickcolor:y,showticklabels:{valType:"boolean",dflt:!0,editType:"ticks"},labelalias:{valType:"any",dflt:!1,editType:"ticks"},automargin:{valType:"flaglist",flags:["height","width","left","right","top","bottom"],extras:[!0,!1],dflt:!1,editType:"ticks"},showspikes:{valType:"boolean",dflt:!1,editType:"modebar"},spikecolor:{valType:"color",dflt:null,editType:"none"},spikethickness:{valType:"number",dflt:3,editType:"none"},spikedash:A({},E,{dflt:"dash",editType:"none"}),spikemode:{valType:"flaglist",flags:["toaxis","across","marker"],dflt:"toaxis",editType:"none"},spikesnap:{valType:"enumerated",values:["data","cursor","hovered data"],dflt:"hovered data",editType:"none"},tickfont:u({editType:"ticks"}),tickangle:{valType:"angle",dflt:"auto",editType:"ticks"},autotickangles:{valType:"info_array",freeLength:!0,items:{valType:"angle"},dflt:[0,30,90],editType:"ticks"},tickprefix:{valType:"string",dflt:"",editType:"ticks"},showtickprefix:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",editType:"ticks"},ticksuffix:{valType:"string",dflt:"",editType:"ticks"},showticksuffix:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",editType:"ticks"},showexponent:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",editType:"ticks"},exponentformat:{valType:"enumerated",values:["none","e","E","power","SI","B","SI extended"],dflt:"B",editType:"ticks"},minexponent:{valType:"number",dflt:3,min:0,editType:"ticks"},separatethousands:{valType:"boolean",dflt:!1,editType:"ticks"},tickformat:{valType:"string",dflt:"",editType:"ticks",description:e("tick label")},tickformatstops:t("tickformatstop",{enabled:{valType:"boolean",dflt:!0,editType:"ticks"},dtickrange:{valType:"info_array",items:[{valType:"any",editType:"ticks"},{valType:"any",editType:"ticks"}],editType:"ticks"},value:{valType:"string",dflt:"",editType:"ticks"},editType:"ticks"}),hoverformat:{valType:"string",dflt:"",editType:"none",description:e("hover text")},unifiedhovertitle:{text:{valType:"string",dflt:"",editType:"none"},editType:"none"},showline:{valType:"boolean",dflt:!1,editType:"ticks+layoutstyle"},linecolor:{valType:"color",dflt:d.defaultLine,editType:"layoutstyle"},linewidth:{valType:"number",min:0,dflt:1,editType:"ticks+layoutstyle"},showgrid:T,gridcolor:S,gridwidth:k(),griddash:M,zeroline:{valType:"boolean",editType:"ticks"},zerolinecolor:{valType:"color",dflt:d.defaultLine,editType:"ticks"},zerolinelayer:{valType:"enumerated",values:["above traces","below traces"],dflt:"below traces",editType:"plot"},zerolinewidth:{valType:"number",dflt:1,editType:"ticks"},showdividers:{valType:"boolean",dflt:!0,editType:"ticks"},dividercolor:{valType:"color",dflt:d.defaultLine,editType:"ticks"},dividerwidth:{valType:"number",dflt:1,editType:"ticks"},anchor:{valType:"enumerated",values:["free",i.idRegex.x.toString(),i.idRegex.y.toString()],editType:"plot"},side:{valType:"enumerated",values:["top","bottom","left","right"],editType:"plot"},overlaying:{valType:"enumerated",values:["free",i.idRegex.x.toString(),i.idRegex.y.toString()],editType:"plot"},minor:{tickmode:a,nticks:f("minor"),tick0:v,dtick:g,tickvals:m,ticks:w,ticklen:l("minor"),tickwidth:x("minor"),tickcolor:y,gridcolor:S,gridwidth:k("minor"),griddash:M,showgrid:T,editType:"ticks"},minorloglabels:{valType:"enumerated",values:["small digits","complete","none"],dflt:"small digits",editType:"calc"},layer:{valType:"enumerated",values:["above traces","below traces"],dflt:"above traces",editType:"plot"},domain:{valType:"info_array",items:[{valType:"number",min:0,max:1,editType:"plot"},{valType:"number",min:0,max:1,editType:"plot"}],dflt:[0,1],editType:"plot"},position:{valType:"number",min:0,max:1,dflt:0,editType:"plot"},autoshift:{valType:"boolean",dflt:!1,editType:"plot"},shift:{valType:"number",editType:"plot"},categoryorder:{valType:"enumerated",values:["trace","category ascending","category descending","array","total ascending","total descending","min ascending","min descending","max ascending","max descending","sum ascending","sum descending","mean ascending","mean descending","geometric mean ascending","geometric mean descending","median ascending","median descending"],dflt:"trace",editType:"calc"},categoryarray:{valType:"data_array",editType:"calc"},uirevision:{valType:"any",editType:"none"},editType:"calc"}}),Wy=Vt((K,V)=>{var u=Of(),d=yu(),E=So().extendFlat,A=Cu().overrideAll;V.exports=A({orientation:{valType:"enumerated",values:["h","v"],dflt:"v"},thicknessmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"pixels"},thickness:{valType:"number",min:0,dflt:30},lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number"},xref:{valType:"enumerated",dflt:"paper",values:["container","paper"],editType:"layoutstyle"},xanchor:{valType:"enumerated",values:["left","center","right"]},xpad:{valType:"number",min:0,dflt:10},y:{valType:"number"},yref:{valType:"enumerated",dflt:"paper",values:["container","paper"],editType:"layoutstyle"},yanchor:{valType:"enumerated",values:["top","middle","bottom"]},ypad:{valType:"number",min:0,dflt:10},outlinecolor:u.linecolor,outlinewidth:u.linewidth,bordercolor:u.linecolor,borderwidth:{valType:"number",min:0,dflt:0},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},tickmode:u.minor.tickmode,nticks:u.nticks,tick0:u.tick0,dtick:u.dtick,tickvals:u.tickvals,ticktext:u.ticktext,ticks:E({},u.ticks,{dflt:""}),ticklabeloverflow:E({},u.ticklabeloverflow,{}),ticklabelposition:{valType:"enumerated",values:["outside","inside","outside top","inside top","outside left","inside left","outside right","inside right","outside bottom","inside bottom"],dflt:"outside"},ticklen:u.ticklen,tickwidth:u.tickwidth,tickcolor:u.tickcolor,ticklabelstep:u.ticklabelstep,showticklabels:u.showticklabels,labelalias:u.labelalias,tickfont:d({}),tickangle:u.tickangle,tickformat:u.tickformat,tickformatstops:u.tickformatstops,tickprefix:u.tickprefix,showtickprefix:u.showtickprefix,ticksuffix:u.ticksuffix,showticksuffix:u.showticksuffix,separatethousands:u.separatethousands,exponentformat:u.exponentformat,minexponent:u.minexponent,showexponent:u.showexponent,title:{text:{valType:"string"},font:d({}),side:{valType:"enumerated",values:["right","top","bottom"]}}},"colorbars","from-root")}),Wl=Vt((K,V)=>{var u=Wy(),d=ym().counter,E=Td(),A=o0().scales;E(A);function t(e){return"`"+e+"`"}V.exports=function(e,r){e=e||"",r=r||{};var i=r.cLetter||"c";"onlyIfNumerical"in r&&r.onlyIfNumerical;var n="noScale"in r?r.noScale:e==="marker.line",o="showScaleDflt"in r?r.showScaleDflt:i==="z",a=typeof r.colorscaleDflt=="string"?A[r.colorscaleDflt]:null,s=r.editTypeOverride||"",f=e?e+".":"",v;"colorAttr"in r?(v=r.colorAttr,r.colorAttr):(v={z:"z",c:"color"}[i],""+t(f+v));var g=i+"auto",m=i+"min",w=i+"max",l=i+"mid",x={};x[m]=x[w]=void 0;var y={};y[g]=!1;var S={};return v==="color"&&(S.color={valType:"color",arrayOk:!0,editType:s||"style"},r.anim&&(S.color.anim=!0)),S[g]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:x},S[m]={valType:"number",dflt:null,editType:s||"plot",impliedEdits:y},S[w]={valType:"number",dflt:null,editType:s||"plot",impliedEdits:y},S[l]={valType:"number",dflt:null,editType:"calc",impliedEdits:x},S.colorscale={valType:"colorscale",editType:"calc",dflt:a,impliedEdits:{autocolorscale:!1}},S.autocolorscale={valType:"boolean",dflt:r.autoColorDflt!==!1,editType:"calc",impliedEdits:{colorscale:void 0}},S.reversescale={valType:"boolean",dflt:!1,editType:"plot"},n||(S.showscale={valType:"boolean",dflt:o,editType:"calc"},S.colorbar=u),r.noColorAxis||(S.coloraxis={valType:"subplotid",regex:d("coloraxis"),dflt:null,editType:"calc"}),S}}),fb=Vt((K,V)=>{var u=So().extendFlat,d=Wl(),E=o0().scales;V.exports={editType:"calc",colorscale:{editType:"calc",sequential:{valType:"colorscale",dflt:E.Reds,editType:"calc"},sequentialminus:{valType:"colorscale",dflt:E.Blues,editType:"calc"},diverging:{valType:"colorscale",dflt:E.RdBu,editType:"calc"}},coloraxis:u({_isSubplotObj:!0,editType:"calc"},d("",{colorAttr:"corresponding trace color array(s)",noColorAxis:!0,showScaleDflt:!0}))}}),hb=Vt((K,V)=>{var u=Xr();V.exports=function(d){return u.isPlainObject(d.colorbar)}}),pb=Vt(K=>{var V=Lo(),u=Xr(),d=ks(),E=d.ONEDAY,A=d.ONEWEEK;K.dtick=function(t,e){var r=e==="log",i=e==="date",n=e==="category",o=i?E:1;if(!t)return o;if(V(t))return t=Number(t),t<=0?o:n?Math.max(1,Math.round(t)):i?Math.max(.1,t):t;if(typeof t!="string"||!(i||r))return o;var a=t.charAt(0),s=t.slice(1);return s=V(s)?Number(s):0,s<=0||!(i&&a==="M"&&s===Math.round(s)||r&&a==="L"||r&&a==="D"&&(s===1||s===2))?o:t},K.tick0=function(t,e,r,i){if(e==="date")return u.cleanDate(t,u.dateTick0(r,i%A===0?1:0));if(!(i==="D1"||i==="D2"))return V(t)?Number(t):0}}),u0=Vt((K,V)=>{var u=pb(),d=Xr().isArrayOrTypedArray,E=nh().isTypedArraySpec,A=nh().decodeTypedArraySpec;V.exports=function(t,e,r,i,n){n||(n={});var o=n.isMinor,a=o?t.minor||{}:t,s=o?e.minor:e,f=o?"minor.":"";function v(k){var M=a[k];return E(M)&&(M=A(M)),M!==void 0?M:(s._template||{})[k]}var g=v("tick0"),m=v("dtick"),w=v("tickvals"),l=d(w)?"array":m?"linear":"auto",x=r(f+"tickmode",l);if(x==="auto"||x==="sync")r(f+"nticks");else if(x==="linear"){var y=s.dtick=u.dtick(m,i);s.tick0=u.tick0(g,i,e.calendar,y)}else if(i!=="multicategory"){var S=r(f+"tickvals");S===void 0?s.tickmode="auto":o||r("ticktext")}}}),wm=Vt((K,V)=>{var u=Xr(),d=Of();V.exports=function(E,A,t,e){var r=e.isMinor,i=r?E.minor||{}:E,n=r?A.minor:A,o=r?d.minor:d,a=r?"minor.":"",s=u.coerce2(i,n,o,"ticklen",r?(A.ticklen||5)*.6:void 0),f=u.coerce2(i,n,o,"tickwidth",r?A.tickwidth||1:void 0),v=u.coerce2(i,n,o,"tickcolor",(r?A.tickcolor:void 0)||n.color),g=t(a+"ticks",!r&&e.outerTicks||s||f||v?"outside":"");g||(delete n.ticklen,delete n.tickwidth,delete n.tickcolor)}}),db=Vt((K,V)=>{V.exports=function(u){var d=["showexponent","showtickprefix","showticksuffix"],E=d.filter(function(t){return u[t]!==void 0}),A=function(t){return u[t]===u[E[0]]};if(E.every(A)||E.length===1)return u[E[0]]}}),Gf=Vt((K,V)=>{var u=Xr(),d=cl();V.exports=function(E,A,t){var e=t.name,r=t.inclusionAttr||"visible",i=A[e],n=u.isArrayOrTypedArray(E[e])?E[e]:[],o=A[e]=[],a=d.arrayTemplater(A,e,r),s,f;for(s=0;s{var u=Xr(),d=Pi().contrast,E=Of(),A=db(),t=Gf();V.exports=function(r,i,n,o,a){a||(a={});var s=n("labelalias");u.isPlainObject(s)||delete i.labelalias;var f=A(r),v=n("showticklabels");if(v){a.noTicklabelshift||n("ticklabelshift"),a.noTicklabelstandoff||n("ticklabelstandoff");var g=a.font||{},m=i.color,w=i.ticklabelposition||"",l=w.indexOf("inside")!==-1?d(a.bgColor):m&&m!==E.color.dflt?m:g.color;if(u.coerceFont(n,"tickfont",g,{overrideDflt:{color:l}}),!a.noTicklabelstep&&o!=="multicategory"&&o!=="log"&&n("ticklabelstep"),!a.noAng){var x=n("tickangle");!a.noAutotickangles&&x==="auto"&&n("autotickangles")}if(o!=="category"){var y=n("tickformat");t(r,i,{name:"tickformatstops",inclusionAttr:"enabled",handleItemDefaults:e}),i.tickformatstops.length||delete i.tickformatstops,!a.noExp&&!y&&o!=="date"&&(n("showexponent",f),n("exponentformat"),n("minexponent"),n("separatethousands"))}!a.noMinorloglabels&&o==="log"&&n("minorloglabels")}};function e(r,i){function n(a,s){return u.coerce(r,i,E.tickformatstops,a,s)}var o=n("enabled");o&&(n("dtickrange"),n("value"))}}),Md=Vt((K,V)=>{var u=db();V.exports=function(d,E,A,t,e){e||(e={});var r=e.tickSuffixDflt,i=u(d),n=A("tickprefix");n&&A("showtickprefix",i);var o=A("ticksuffix",r);o&&A("showticksuffix",i)}}),mb=Vt((K,V)=>{var u=Xr(),d=cl(),E=u0(),A=wm(),t=Ad(),e=Md(),r=Wy();V.exports=function(i,n,o){var a=d.newContainer(n,"colorbar"),s=i.colorbar||{};function f(I,F){return u.coerce(s,a,r,I,F)}var v=o.margin||{t:0,b:0,l:0,r:0},g=o.width-v.l-v.r,m=o.height-v.t-v.b,w=f("orientation"),l=w==="v",x=f("thicknessmode");f("thickness",x==="fraction"?30/(l?g:m):30);var y=f("lenmode");f("len",y==="fraction"?1:l?m:g);var S=f("yref"),k=f("xref"),M=S==="paper",T=k==="paper",c,h,b,_="left";l?(b="middle",_=T?"left":"right",c=T?1.02:1,h=.5):(b=M?"bottom":"top",_="center",c=.5,h=M?1.02:1),u.coerce(s,a,{x:{valType:"number",min:T?-2:0,max:T?3:1,dflt:c}},"x"),u.coerce(s,a,{y:{valType:"number",min:M?-2:0,max:M?3:1,dflt:h}},"y"),f("xanchor",_),f("xpad"),f("yanchor",b),f("ypad"),u.noneOrAll(s,a,["x","y"]),f("outlinecolor"),f("outlinewidth"),f("bordercolor"),f("borderwidth"),f("bgcolor");var P=u.coerce(s,a,{ticklabelposition:{valType:"enumerated",dflt:"outside",values:l?["outside","inside","outside top","inside top","outside bottom","inside bottom"]:["outside","inside","outside left","inside left","outside right","inside right"]}},"ticklabelposition");f("ticklabeloverflow",P.indexOf("inside")!==-1?"hide past domain":"hide past div"),E(s,a,f,"linear");var z=o.font,D={noAutotickangles:!0,noTicklabelshift:!0,noTicklabelstandoff:!0,outerTicks:!1,font:z};P.indexOf("inside")!==-1&&(D.bgColor="black"),e(s,a,f,"linear",D),t(s,a,f,"linear",D),A(s,a,f,"linear",D),f("title.text",o._dfltTitle.colorbar);var B=a.showticklabels?a.tickfont:z,R=u.extendFlat({},z,{family:B.family,size:u.bigFont(B.size)});u.coerceFont(f,"title.font",R),f("title.side",l?"top":"right")}}),vf=Vt((K,V)=>{var u=Lo(),d=Xr(),E=hb(),A=mb(),t=o0().isValid,e=ji().traceIs;function r(i,n){var o=n.slice(0,n.length-1);return n?d.nestedProperty(i,o).get()||{}:i}V.exports=function i(n,o,a,s,f){var v=f.prefix,g=f.cLetter,m="_module"in o,w=r(n,v),l=r(o,v),x=r(o._template||{},v)||{},y=function(){return delete n.coloraxis,delete o.coloraxis,i(n,o,a,s,f)};if(m){var S=a._colorAxes||{},k=s(v+"coloraxis");if(k){var M=e(o,"contour")&&d.nestedProperty(o,"contours.coloring").get()||"heatmap",T=S[k];T?(T[2].push(y),T[0]!==M&&(T[0]=!1,d.warn(["Ignoring coloraxis:",k,"setting","as it is linked to incompatible colorscales."].join(" ")))):S[k]=[M,o,[y]];return}}var c=w[g+"min"],h=w[g+"max"],b=u(c)&&u(h)&&c{var u=Xr(),d=cl(),E=fb(),A=vf();V.exports=function(t,e){function r(g,m){return u.coerce(t,e,E,g,m)}r("colorscale.sequential"),r("colorscale.sequentialminus"),r("colorscale.diverging");var i=e._colorAxes,n,o;function a(g,m){return u.coerce(n,o,E.coloraxis,g,m)}for(var s in i){var f=i[s];if(f[0])n=t[s]||{},o=d.newContainer(e,s,"coloraxis"),o._name=s,A(n,o,e,a,{prefix:"",cLetter:"c"});else{for(var v=0;v{var u=Xr(),d=ah().hasColorscale,E=ah().extractOpts;V.exports=function(A,t){function e(f,v){var g=f["_"+v];g!==void 0&&(f[v]=g)}function r(f,v){var g=v.container?u.nestedProperty(f,v.container).get():f;if(g)if(g.coloraxis)g._colorAx=t[g.coloraxis];else{var m=E(g),w=m.auto;(w||m.min===void 0)&&e(g,v.min),(w||m.max===void 0)&&e(g,v.max),m.autocolorscale&&e(g,"colorscale")}}for(var i=0;i{var u=Lo(),d=Xr(),E=ah().extractOpts;V.exports=function(A,t,e){var r=A._fullLayout,i=e.vals,n=e.containerStr,o=n?d.nestedProperty(t,n).get():t,a=E(o),s=a.auto!==!1,f=a.min,v=a.max,g=a.mid,m=function(){return d.aggNums(Math.min,null,i)},w=function(){return d.aggNums(Math.max,null,i)};if(f===void 0?f=m():s&&(o._colorAx&&u(f)?f=Math.min(f,m()):f=m()),v===void 0?v=w():s&&(o._colorAx&&u(v)?v=Math.max(v,w()):v=w()),s&&g!==void 0&&(v-g>g-f?f=g-(v-g):v-g=0?l=r.colorscale.sequential:l=r.colorscale.sequentialminus,a._sync("colorscale",l)}}}),xu=Vt((K,V)=>{var u=o0(),d=ah();V.exports={moduleType:"component",name:"colorscale",attributes:Wl(),layoutAttributes:fb(),supplyLayoutDefaults:ZT(),handleDefaults:vf(),crossTraceDefaults:KT(),calc:ih(),scales:u.scales,defaultScale:u.defaultScale,getScale:u.get,isValidScale:u.isValid,hasColorscale:d.hasColorscale,extractOpts:d.extractOpts,extractScale:d.extractScale,flipScale:d.flipScale,makeColorScaleFunc:d.makeColorScaleFunc,makeColorScaleFuncFromTrace:d.makeColorScaleFuncFromTrace}}),nu=Vt((K,V)=>{var u=Xr(),d=nh().isTypedArraySpec;V.exports={hasLines:function(E){return E.visible&&E.mode&&E.mode.indexOf("lines")!==-1},hasMarkers:function(E){return E.visible&&(E.mode&&E.mode.indexOf("markers")!==-1||E.type==="splom")},hasText:function(E){return E.visible&&E.mode&&E.mode.indexOf("text")!==-1},isBubble:function(E){var A=E.marker;return u.isPlainObject(A)&&(u.isArrayOrTypedArray(A.size)||d(A.size))}}}),Tm=Vt((K,V)=>{var u=Lo();V.exports=function(d,E){E||(E=2);var A=d.marker,t=A.sizeref||1,e=A.sizemin||0,r=A.sizemode==="area"?function(i){return Math.sqrt(i/t)}:function(i){return i/t};return function(i){var n=r(i/E);return u(n)&&n>0?Math.max(n,e):0}}}),mh=Vt(K=>{var V=Xr();K.getSubplot=function(e){return e.subplot||e.xaxis+e.yaxis||e.geo},K.isTraceInSubplots=function(e,r){if(e.type==="splom"){for(var i=e.xaxes||[],n=e.yaxes||[],o=0;o=0&&i.index{V.exports=E;var u={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},d=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function E(e){var r=[];return e.replace(d,function(i,n,o){var a=n.toLowerCase();for(o=t(o),a=="m"&&o.length>2&&(r.push([n].concat(o.splice(0,2))),a="l",n=n=="m"?"l":"L");;){if(o.length==u[a])return o.unshift(n),r.push(o);if(o.length{var u=Ng(),d=function(g,m){return m?Math.round(g*(m=Math.pow(10,m)))/m:Math.round(g)},E="M0,0Z",A=Math.sqrt(2),t=Math.sqrt(3),e=Math.PI,r=Math.cos,i=Math.sin;V.exports={circle:{n:0,f:function(g,m,w){if(n(m))return E;var l=d(g,2),x="M"+l+",0A"+l+","+l+" 0 1,1 0,-"+l+"A"+l+","+l+" 0 0,1 "+l+",0Z";return w?v(m,w,x):x}},square:{n:1,f:function(g,m,w){if(n(m))return E;var l=d(g,2);return v(m,w,"M"+l+","+l+"H-"+l+"V-"+l+"H"+l+"Z")}},diamond:{n:2,f:function(g,m,w){if(n(m))return E;var l=d(g*1.3,2);return v(m,w,"M"+l+",0L0,"+l+"L-"+l+",0L0,-"+l+"Z")}},cross:{n:3,f:function(g,m,w){if(n(m))return E;var l=d(g*.4,2),x=d(g*1.2,2);return v(m,w,"M"+x+","+l+"H"+l+"V"+x+"H-"+l+"V"+l+"H-"+x+"V-"+l+"H-"+l+"V-"+x+"H"+l+"V-"+l+"H"+x+"Z")}},x:{n:4,f:function(g,m,w){if(n(m))return E;var l=d(g*.8/A,2),x="l"+l+","+l,y="l"+l+",-"+l,S="l-"+l+",-"+l,k="l-"+l+","+l;return v(m,w,"M0,"+l+x+y+S+y+S+k+S+k+x+k+x+"Z")}},"triangle-up":{n:5,f:function(g,m,w){if(n(m))return E;var l=d(g*2/t,2),x=d(g/2,2),y=d(g,2);return v(m,w,"M-"+l+","+x+"H"+l+"L0,-"+y+"Z")}},"triangle-down":{n:6,f:function(g,m,w){if(n(m))return E;var l=d(g*2/t,2),x=d(g/2,2),y=d(g,2);return v(m,w,"M-"+l+",-"+x+"H"+l+"L0,"+y+"Z")}},"triangle-left":{n:7,f:function(g,m,w){if(n(m))return E;var l=d(g*2/t,2),x=d(g/2,2),y=d(g,2);return v(m,w,"M"+x+",-"+l+"V"+l+"L-"+y+",0Z")}},"triangle-right":{n:8,f:function(g,m,w){if(n(m))return E;var l=d(g*2/t,2),x=d(g/2,2),y=d(g,2);return v(m,w,"M-"+x+",-"+l+"V"+l+"L"+y+",0Z")}},"triangle-ne":{n:9,f:function(g,m,w){if(n(m))return E;var l=d(g*.6,2),x=d(g*1.2,2);return v(m,w,"M-"+x+",-"+l+"H"+l+"V"+x+"Z")}},"triangle-se":{n:10,f:function(g,m,w){if(n(m))return E;var l=d(g*.6,2),x=d(g*1.2,2);return v(m,w,"M"+l+",-"+x+"V"+l+"H-"+x+"Z")}},"triangle-sw":{n:11,f:function(g,m,w){if(n(m))return E;var l=d(g*.6,2),x=d(g*1.2,2);return v(m,w,"M"+x+","+l+"H-"+l+"V-"+x+"Z")}},"triangle-nw":{n:12,f:function(g,m,w){if(n(m))return E;var l=d(g*.6,2),x=d(g*1.2,2);return v(m,w,"M-"+l+","+x+"V-"+l+"H"+x+"Z")}},pentagon:{n:13,f:function(g,m,w){if(n(m))return E;var l=d(g*.951,2),x=d(g*.588,2),y=d(-g,2),S=d(g*-.309,2),k=d(g*.809,2);return v(m,w,"M"+l+","+S+"L"+x+","+k+"H-"+x+"L-"+l+","+S+"L0,"+y+"Z")}},hexagon:{n:14,f:function(g,m,w){if(n(m))return E;var l=d(g,2),x=d(g/2,2),y=d(g*t/2,2);return v(m,w,"M"+y+",-"+x+"V"+x+"L0,"+l+"L-"+y+","+x+"V-"+x+"L0,-"+l+"Z")}},hexagon2:{n:15,f:function(g,m,w){if(n(m))return E;var l=d(g,2),x=d(g/2,2),y=d(g*t/2,2);return v(m,w,"M-"+x+","+y+"H"+x+"L"+l+",0L"+x+",-"+y+"H-"+x+"L-"+l+",0Z")}},octagon:{n:16,f:function(g,m,w){if(n(m))return E;var l=d(g*.924,2),x=d(g*.383,2);return v(m,w,"M-"+x+",-"+l+"H"+x+"L"+l+",-"+x+"V"+x+"L"+x+","+l+"H-"+x+"L-"+l+","+x+"V-"+x+"Z")}},star:{n:17,f:function(g,m,w){if(n(m))return E;var l=g*1.4,x=d(l*.225,2),y=d(l*.951,2),S=d(l*.363,2),k=d(l*.588,2),M=d(-l,2),T=d(l*-.309,2),c=d(l*.118,2),h=d(l*.809,2),b=d(l*.382,2);return v(m,w,"M"+x+","+T+"H"+y+"L"+S+","+c+"L"+k+","+h+"L0,"+b+"L-"+k+","+h+"L-"+S+","+c+"L-"+y+","+T+"H-"+x+"L0,"+M+"Z")}},hexagram:{n:18,f:function(g,m,w){if(n(m))return E;var l=d(g*.66,2),x=d(g*.38,2),y=d(g*.76,2);return v(m,w,"M-"+y+",0l-"+x+",-"+l+"h"+y+"l"+x+",-"+l+"l"+x+","+l+"h"+y+"l-"+x+","+l+"l"+x+","+l+"h-"+y+"l-"+x+","+l+"l-"+x+",-"+l+"h-"+y+"Z")}},"star-triangle-up":{n:19,f:function(g,m,w){if(n(m))return E;var l=d(g*t*.8,2),x=d(g*.8,2),y=d(g*1.6,2),S=d(g*4,2),k="A "+S+","+S+" 0 0 1 ";return v(m,w,"M-"+l+","+x+k+l+","+x+k+"0,-"+y+k+"-"+l+","+x+"Z")}},"star-triangle-down":{n:20,f:function(g,m,w){if(n(m))return E;var l=d(g*t*.8,2),x=d(g*.8,2),y=d(g*1.6,2),S=d(g*4,2),k="A "+S+","+S+" 0 0 1 ";return v(m,w,"M"+l+",-"+x+k+"-"+l+",-"+x+k+"0,"+y+k+l+",-"+x+"Z")}},"star-square":{n:21,f:function(g,m,w){if(n(m))return E;var l=d(g*1.1,2),x=d(g*2,2),y="A "+x+","+x+" 0 0 1 ";return v(m,w,"M-"+l+",-"+l+y+"-"+l+","+l+y+l+","+l+y+l+",-"+l+y+"-"+l+",-"+l+"Z")}},"star-diamond":{n:22,f:function(g,m,w){if(n(m))return E;var l=d(g*1.4,2),x=d(g*1.9,2),y="A "+x+","+x+" 0 0 1 ";return v(m,w,"M-"+l+",0"+y+"0,"+l+y+l+",0"+y+"0,-"+l+y+"-"+l+",0Z")}},"diamond-tall":{n:23,f:function(g,m,w){if(n(m))return E;var l=d(g*.7,2),x=d(g*1.4,2);return v(m,w,"M0,"+x+"L"+l+",0L0,-"+x+"L-"+l+",0Z")}},"diamond-wide":{n:24,f:function(g,m,w){if(n(m))return E;var l=d(g*1.4,2),x=d(g*.7,2);return v(m,w,"M0,"+x+"L"+l+",0L0,-"+x+"L-"+l+",0Z")}},hourglass:{n:25,f:function(g,m,w){if(n(m))return E;var l=d(g,2);return v(m,w,"M"+l+","+l+"H-"+l+"L"+l+",-"+l+"H-"+l+"Z")},noDot:!0},bowtie:{n:26,f:function(g,m,w){if(n(m))return E;var l=d(g,2);return v(m,w,"M"+l+","+l+"V-"+l+"L-"+l+","+l+"V-"+l+"Z")},noDot:!0},"circle-cross":{n:27,f:function(g,m,w){if(n(m))return E;var l=d(g,2);return v(m,w,"M0,"+l+"V-"+l+"M"+l+",0H-"+l+"M"+l+",0A"+l+","+l+" 0 1,1 0,-"+l+"A"+l+","+l+" 0 0,1 "+l+",0Z")},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(g,m,w){if(n(m))return E;var l=d(g,2),x=d(g/A,2);return v(m,w,"M"+x+","+x+"L-"+x+",-"+x+"M"+x+",-"+x+"L-"+x+","+x+"M"+l+",0A"+l+","+l+" 0 1,1 0,-"+l+"A"+l+","+l+" 0 0,1 "+l+",0Z")},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(g,m,w){if(n(m))return E;var l=d(g,2);return v(m,w,"M0,"+l+"V-"+l+"M"+l+",0H-"+l+"M"+l+","+l+"H-"+l+"V-"+l+"H"+l+"Z")},needLine:!0,noDot:!0},"square-x":{n:30,f:function(g,m,w){if(n(m))return E;var l=d(g,2);return v(m,w,"M"+l+","+l+"L-"+l+",-"+l+"M"+l+",-"+l+"L-"+l+","+l+"M"+l+","+l+"H-"+l+"V-"+l+"H"+l+"Z")},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(g,m,w){if(n(m))return E;var l=d(g*1.3,2);return v(m,w,"M"+l+",0L0,"+l+"L-"+l+",0L0,-"+l+"ZM0,-"+l+"V"+l+"M-"+l+",0H"+l)},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(g,m,w){if(n(m))return E;var l=d(g*1.3,2),x=d(g*.65,2);return v(m,w,"M"+l+",0L0,"+l+"L-"+l+",0L0,-"+l+"ZM-"+x+",-"+x+"L"+x+","+x+"M-"+x+","+x+"L"+x+",-"+x)},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(g,m,w){if(n(m))return E;var l=d(g*1.4,2);return v(m,w,"M0,"+l+"V-"+l+"M"+l+",0H-"+l)},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(g,m,w){if(n(m))return E;var l=d(g,2);return v(m,w,"M"+l+","+l+"L-"+l+",-"+l+"M"+l+",-"+l+"L-"+l+","+l)},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(g,m,w){if(n(m))return E;var l=d(g*1.2,2),x=d(g*.85,2);return v(m,w,"M0,"+l+"V-"+l+"M"+l+",0H-"+l+"M"+x+","+x+"L-"+x+",-"+x+"M"+x+",-"+x+"L-"+x+","+x)},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(g,m,w){if(n(m))return E;var l=d(g/2,2),x=d(g,2);return v(m,w,"M"+l+","+x+"V-"+x+"M"+(l-x)+",-"+x+"V"+x+"M"+x+","+l+"H-"+x+"M-"+x+","+(l-x)+"H"+x)},needLine:!0,noFill:!0},"y-up":{n:37,f:function(g,m,w){if(n(m))return E;var l=d(g*1.2,2),x=d(g*1.6,2),y=d(g*.8,2);return v(m,w,"M-"+l+","+y+"L0,0M"+l+","+y+"L0,0M0,-"+x+"L0,0")},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(g,m,w){if(n(m))return E;var l=d(g*1.2,2),x=d(g*1.6,2),y=d(g*.8,2);return v(m,w,"M-"+l+",-"+y+"L0,0M"+l+",-"+y+"L0,0M0,"+x+"L0,0")},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(g,m,w){if(n(m))return E;var l=d(g*1.2,2),x=d(g*1.6,2),y=d(g*.8,2);return v(m,w,"M"+y+","+l+"L0,0M"+y+",-"+l+"L0,0M-"+x+",0L0,0")},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(g,m,w){if(n(m))return E;var l=d(g*1.2,2),x=d(g*1.6,2),y=d(g*.8,2);return v(m,w,"M-"+y+","+l+"L0,0M-"+y+",-"+l+"L0,0M"+x+",0L0,0")},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(g,m,w){if(n(m))return E;var l=d(g*1.4,2);return v(m,w,"M"+l+",0H-"+l)},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(g,m,w){if(n(m))return E;var l=d(g*1.4,2);return v(m,w,"M0,"+l+"V-"+l)},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(g,m,w){if(n(m))return E;var l=d(g,2);return v(m,w,"M"+l+",-"+l+"L-"+l+","+l)},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(g,m,w){if(n(m))return E;var l=d(g,2);return v(m,w,"M"+l+","+l+"L-"+l+",-"+l)},needLine:!0,noDot:!0,noFill:!0},"arrow-up":{n:45,f:function(g,m,w){if(n(m))return E;var l=d(g,2),x=d(g*2,2);return v(m,w,"M0,0L-"+l+","+x+"H"+l+"Z")},backoff:1,noDot:!0},"arrow-down":{n:46,f:function(g,m,w){if(n(m))return E;var l=d(g,2),x=d(g*2,2);return v(m,w,"M0,0L-"+l+",-"+x+"H"+l+"Z")},noDot:!0},"arrow-left":{n:47,f:function(g,m,w){if(n(m))return E;var l=d(g*2,2),x=d(g,2);return v(m,w,"M0,0L"+l+",-"+x+"V"+x+"Z")},noDot:!0},"arrow-right":{n:48,f:function(g,m,w){if(n(m))return E;var l=d(g*2,2),x=d(g,2);return v(m,w,"M0,0L-"+l+",-"+x+"V"+x+"Z")},noDot:!0},"arrow-bar-up":{n:49,f:function(g,m,w){if(n(m))return E;var l=d(g,2),x=d(g*2,2);return v(m,w,"M-"+l+",0H"+l+"M0,0L-"+l+","+x+"H"+l+"Z")},backoff:1,needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(g,m,w){if(n(m))return E;var l=d(g,2),x=d(g*2,2);return v(m,w,"M-"+l+",0H"+l+"M0,0L-"+l+",-"+x+"H"+l+"Z")},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(g,m,w){if(n(m))return E;var l=d(g*2,2),x=d(g,2);return v(m,w,"M0,-"+x+"V"+x+"M0,0L"+l+",-"+x+"V"+x+"Z")},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(g,m,w){if(n(m))return E;var l=d(g*2,2),x=d(g,2);return v(m,w,"M0,-"+x+"V"+x+"M0,0L-"+l+",-"+x+"V"+x+"Z")},needLine:!0,noDot:!0},arrow:{n:53,f:function(g,m,w){if(n(m))return E;var l=e/2.5,x=2*g*r(l),y=2*g*i(l);return v(m,w,"M0,0L"+-x+","+y+"L"+x+","+y+"Z")},backoff:.9,noDot:!0},"arrow-wide":{n:54,f:function(g,m,w){if(n(m))return E;var l=e/4,x=2*g*r(l),y=2*g*i(l);return v(m,w,"M0,0L"+-x+","+y+"A "+2*g+","+2*g+" 0 0 1 "+x+","+y+"Z")},backoff:.4,noDot:!0}};function n(g){return g===null}var o,a,s,f;function v(g,m,w){if((!g||g%360===0)&&!m)return w;if(s===g&&f===m&&o===w)return a;s=g,f=m,o=w;function l(D,B){var R=r(D),I=i(D),F=B[0],j=B[1]+(m||0);return[F*R-j*I,F*I+j*R]}for(var x=g/180*e,y=0,S=0,k=u(w),M="",T=0;T{var u=Ni(),d=Xr(),E=d.numberFormat,A=Lo(),t=Af(),e=ji(),r=Pi(),i=xu(),n=d.strTranslate,o=Dl(),a=zh(),s=gf(),f=s.LINE_SPACING,v=bd().DESELECTDIM,g=nu(),m=Tm(),w=mh().appendArrayPointValue,l=V.exports={};l.font=function(mt,bt){var vt=bt.variant,Ut=bt.style,re=bt.weight,Kt=bt.color,ue=bt.size,Me=bt.family,Ce=bt.shadow,We=bt.lineposition,qe=bt.textcase;Me&&mt.style("font-family",Me),ue+1&&mt.style("font-size",ue+"px"),Kt&&mt.call(r.fill,Kt),re&&mt.style("font-weight",re),Ut&&mt.style("font-style",Ut),vt&&mt.style("font-variant",vt),qe&&mt.style("text-transform",x(S(qe))),Ce&&mt.style("text-shadow",Ce==="auto"?o.makeTextShadow(r.contrast(Kt)):x(Ce)),We&&mt.style("text-decoration-line",x(k(We)))};function x(mt){return mt==="none"?void 0:mt}var y={normal:"none",lower:"lowercase",upper:"uppercase","word caps":"capitalize"};function S(mt){return y[mt]}function k(mt){return mt.replace("under","underline").replace("over","overline").replace("through","line-through").split("+").join(" ")}l.setPosition=function(mt,bt,vt){mt.attr("x",bt).attr("y",vt)},l.setSize=function(mt,bt,vt){mt.attr("width",bt).attr("height",vt)},l.setRect=function(mt,bt,vt,Ut,re){mt.call(l.setPosition,bt,vt).call(l.setSize,Ut,re)},l.translatePoint=function(mt,bt,vt,Ut){var re=vt.c2p(mt.x),Kt=Ut.c2p(mt.y);if(A(re)&&A(Kt)&&bt.node())bt.node().nodeName==="text"?bt.attr("x",re).attr("y",Kt):bt.attr("transform",n(re,Kt));else return!1;return!0},l.translatePoints=function(mt,bt,vt){mt.each(function(Ut){var re=u.select(this);l.translatePoint(Ut,re,bt,vt)})},l.hideOutsideRangePoint=function(mt,bt,vt,Ut,re,Kt){bt.attr("display",vt.isPtWithinRange(mt,re)&&Ut.isPtWithinRange(mt,Kt)?null:"none")},l.hideOutsideRangePoints=function(mt,bt){if(bt._hasClipOnAxisFalse){var vt=bt.xaxis,Ut=bt.yaxis;mt.each(function(re){var Kt=re[0].trace,ue=Kt.xcalendar,Me=Kt.ycalendar,Ce=e.traceIs(Kt,"bar-like")?".bartext":".point,.textpoint";mt.selectAll(Ce).each(function(We){l.hideOutsideRangePoint(We,u.select(this),vt,Ut,ue,Me)})})}},l.crispRound=function(mt,bt,vt){return!bt||!A(bt)?vt||0:mt._context.staticPlot?bt:bt<1?1:Math.round(bt)},l.singleLineStyle=function(mt,bt,vt,Ut,re){bt.style("fill","none");var Kt=(((mt||[])[0]||{}).trace||{}).line||{},ue=vt||Kt.width||0,Me=re||Kt.dash||"";r.stroke(bt,Ut||Kt.color),l.dashLine(bt,Me,ue)},l.lineGroupStyle=function(mt,bt,vt,Ut){mt.style("fill","none").each(function(re){var Kt=(((re||[])[0]||{}).trace||{}).line||{},ue=bt||Kt.width||0,Me=Ut||Kt.dash||"";u.select(this).call(r.stroke,vt||Kt.color).call(l.dashLine,Me,ue)})},l.dashLine=function(mt,bt,vt){vt=+vt||0,bt=l.dashStyle(bt,vt),mt.style({"stroke-dasharray":bt,"stroke-width":vt+"px"})},l.dashStyle=function(mt,bt){bt=+bt||1;var vt=Math.max(bt,3);return mt==="solid"?mt="":mt==="dot"?mt=vt+"px,"+vt+"px":mt==="dash"?mt=3*vt+"px,"+3*vt+"px":mt==="longdash"?mt=5*vt+"px,"+5*vt+"px":mt==="dashdot"?mt=3*vt+"px,"+vt+"px,"+vt+"px,"+vt+"px":mt==="longdashdot"&&(mt=5*vt+"px,"+2*vt+"px,"+vt+"px,"+2*vt+"px"),mt};function M(mt,bt,vt,Ut){var re=bt.fillpattern,Kt=bt.fillgradient,ue=l.getPatternAttr,Me=re&&(ue(re.shape,0,"")||ue(re.path,0,""));if(Me){var Ce=ue(re.bgcolor,0,null),We=ue(re.fgcolor,0,null),qe=re.fgopacity,vr=ue(re.size,0,8),_r=ue(re.solidity,0,.3),er=bt.uid;l.pattern(mt,"point",vt,er,Me,vr,_r,void 0,re.fillmode,Ce,We,qe)}else if(Kt&&Kt.type!=="none"){var Mr=Kt.type,Ir="scatterfill-"+bt.uid;if(Ut&&(Ir="legendfill-"+bt.uid),!Ut&&(Kt.start!==void 0||Kt.stop!==void 0)){var de,Dt;Mr==="horizontal"?(de={x:Kt.start,y:0},Dt={x:Kt.stop,y:0}):Mr==="vertical"&&(de={x:0,y:Kt.start},Dt={x:0,y:Kt.stop}),de.x=bt._xA.c2p(de.x===void 0?bt._extremes.x.min[0].val:de.x,!0),de.y=bt._yA.c2p(de.y===void 0?bt._extremes.y.min[0].val:de.y,!0),Dt.x=bt._xA.c2p(Dt.x===void 0?bt._extremes.x.max[0].val:Dt.x,!0),Dt.y=bt._yA.c2p(Dt.y===void 0?bt._extremes.y.max[0].val:Dt.y,!0),mt.call(z,vt,Ir,"linear",Kt.colorscale,"fill",de,Dt,!0,!1)}else Mr==="horizontal"&&(Mr=Mr+"reversed"),mt.call(l.gradient,vt,Ir,Mr,Kt.colorscale,"fill")}else bt.fillcolor&&mt.call(r.fill,bt.fillcolor)}l.singleFillStyle=function(mt,bt){var vt=u.select(mt.node()),Ut=vt.data(),re=((Ut[0]||[])[0]||{}).trace||{};M(mt,re,bt,!1)},l.fillGroupStyle=function(mt,bt,vt){mt.style("stroke-width",0).each(function(Ut){var re=u.select(this);Ut[0].trace&&M(re,Ut[0].trace,bt,vt)})};var T=YT();l.symbolNames=[],l.symbolFuncs=[],l.symbolBackOffs=[],l.symbolNeedLines={},l.symbolNoDot={},l.symbolNoFill={},l.symbolList=[],Object.keys(T).forEach(function(mt){var bt=T[mt],vt=bt.n;l.symbolList.push(vt,String(vt),mt,vt+100,String(vt+100),mt+"-open"),l.symbolNames[vt]=mt,l.symbolFuncs[vt]=bt.f,l.symbolBackOffs[vt]=bt.backoff||0,bt.needLine&&(l.symbolNeedLines[vt]=!0),bt.noDot?l.symbolNoDot[vt]=!0:l.symbolList.push(vt+200,String(vt+200),mt+"-dot",vt+300,String(vt+300),mt+"-open-dot"),bt.noFill&&(l.symbolNoFill[vt]=!0)});var c=l.symbolNames.length,h="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";l.symbolNumber=function(mt){if(A(mt))mt=+mt;else if(typeof mt=="string"){var bt=0;mt.indexOf("-open")>0&&(bt=100,mt=mt.replace("-open","")),mt.indexOf("-dot")>0&&(bt+=200,mt=mt.replace("-dot","")),mt=l.symbolNames.indexOf(mt),mt>=0&&(mt+=bt)}return mt%100>=c||mt>=400?0:Math.floor(Math.max(mt,0))};function b(mt,bt,vt,Ut){var re=mt%100;return l.symbolFuncs[re](bt,vt,Ut)+(mt>=200?h:"")}var _=E("~f"),P={radial:{type:"radial"},radialreversed:{type:"radial",reversed:!0},horizontal:{type:"linear",start:{x:1,y:0},stop:{x:0,y:0}},horizontalreversed:{type:"linear",start:{x:1,y:0},stop:{x:0,y:0},reversed:!0},vertical:{type:"linear",start:{x:0,y:1},stop:{x:0,y:0}},verticalreversed:{type:"linear",start:{x:0,y:1},stop:{x:0,y:0},reversed:!0}};l.gradient=function(mt,bt,vt,Ut,re,Kt){var ue=P[Ut];return z(mt,bt,vt,ue.type,re,Kt,ue.start,ue.stop,!1,ue.reversed)};function z(mt,bt,vt,Ut,re,Kt,ue,Me,Ce,We){var qe=re.length,vr;Ut==="linear"?vr={node:"linearGradient",attrs:{x1:ue.x,y1:ue.y,x2:Me.x,y2:Me.y,gradientUnits:Ce?"userSpaceOnUse":"objectBoundingBox"},reversed:We}:Ut==="radial"&&(vr={node:"radialGradient",reversed:We});for(var _r=new Array(qe),er=0;er=0&&mt.i===void 0&&(mt.i=Kt.i),bt.style("opacity",Ut.selectedOpacityFn?Ut.selectedOpacityFn(mt):mt.mo===void 0?ue.opacity:mt.mo),Ut.ms2mrc){var Ce;mt.ms==="various"||ue.size==="various"?Ce=3:Ce=Ut.ms2mrc(mt.ms),mt.mrc=Ce,Ut.selectedSizeFn&&(Ce=mt.mrc=Ut.selectedSizeFn(mt));var We=l.symbolNumber(mt.mx||ue.symbol)||0;mt.om=We%200>=100;var qe=Zt(mt,vt),vr=it(mt,vt);bt.attr("d",b(We,Ce,qe,vr))}var _r=!1,er,Mr,Ir;if(mt.so)Ir=Me.outlierwidth,Mr=Me.outliercolor,er=ue.outliercolor;else{var de=(Me||{}).width;Ir=(mt.mlw+1||de+1||(mt.trace?(mt.trace.marker.line||{}).width:0)+1)-1||0,"mlc"in mt?Mr=mt.mlcc=Ut.lineScale(mt.mlc):d.isArrayOrTypedArray(Me.color)?Mr=r.defaultLine:Mr=Me.color,d.isArrayOrTypedArray(ue.color)&&(er=r.defaultLine,_r=!0),"mc"in mt?er=mt.mcc=Ut.markerScale(mt.mc):er=ue.color||ue.colors||"rgba(0,0,0,0)",Ut.selectedColorFn&&(er=Ut.selectedColorFn(mt))}if(mt.om)bt.call(r.stroke,er).style({"stroke-width":(Ir||1)+"px",fill:"none"});else{bt.style("stroke-width",(mt.isBlank?0:Ir)+"px");var Dt=ue.gradient,qt=mt.mgt;qt?_r=!0:qt=Dt&&Dt.type,d.isArrayOrTypedArray(qt)&&(qt=qt[0],P[qt]||(qt=0));var _t=ue.pattern,lt=l.getPatternAttr,yt=_t&&(lt(_t.shape,mt.i,"")||lt(_t.path,mt.i,""));if(qt&&qt!=="none"){var St=mt.mgc;St?_r=!0:St=Dt.color;var Ht=vt.uid;_r&&(Ht+="-"+mt.i),l.gradient(bt,re,Ht,qt,[[0,St],[1,er]],"fill")}else if(yt){var Yt=!1,se=_t.fgcolor;!se&&Kt&&Kt.color&&(se=Kt.color,Yt=!0);var ke=lt(se,mt.i,Kt&&Kt.color||null),Ee=lt(_t.bgcolor,mt.i,null),Ue=_t.fgopacity,ir=lt(_t.size,mt.i,8),ar=lt(_t.solidity,mt.i,.3);Yt=Yt||mt.mcc||d.isArrayOrTypedArray(_t.shape)||d.isArrayOrTypedArray(_t.path)||d.isArrayOrTypedArray(_t.bgcolor)||d.isArrayOrTypedArray(_t.fgcolor)||d.isArrayOrTypedArray(_t.size)||d.isArrayOrTypedArray(_t.solidity);var Ye=vt.uid;Yt&&(Ye+="-"+mt.i),l.pattern(bt,"point",re,Ye,yt,ir,ar,mt.mcc,_t.fillmode,Ee,ke,Ue)}else d.isArrayOrTypedArray(er)?r.fill(bt,er[mt.i]):r.fill(bt,er);Ir&&r.stroke(bt,Mr)}},l.makePointStyleFns=function(mt){var bt={},vt=mt.marker;return bt.markerScale=l.tryColorscale(vt,""),bt.lineScale=l.tryColorscale(vt,"line"),e.traceIs(mt,"symbols")&&(bt.ms2mrc=g.isBubble(mt)?m(mt):function(){return(vt.size||6)/2}),mt.selectedpoints&&d.extendFlat(bt,l.makeSelectedPointStyleFns(mt)),bt},l.makeSelectedPointStyleFns=function(mt){var bt={},vt=mt.selected||{},Ut=mt.unselected||{},re=mt.marker||{},Kt=vt.marker||{},ue=Ut.marker||{},Me=re.opacity,Ce=Kt.opacity,We=ue.opacity,qe=Ce!==void 0,vr=We!==void 0;(d.isArrayOrTypedArray(Me)||qe||vr)&&(bt.selectedOpacityFn=function(lt){var yt=lt.mo===void 0?re.opacity:lt.mo;return lt.selected?qe?Ce:yt:vr?We:v*yt});var _r=re.color,er=Kt.color,Mr=ue.color;(er||Mr)&&(bt.selectedColorFn=function(lt){var yt=lt.mcc||_r;return lt.selected?er||yt:Mr||yt});var Ir=re.size,de=Kt.size,Dt=ue.size,qt=de!==void 0,_t=Dt!==void 0;return e.traceIs(mt,"symbols")&&(qt||_t)&&(bt.selectedSizeFn=function(lt){var yt=lt.mrc||Ir/2;return lt.selected?qt?de/2:yt:_t?Dt/2:yt}),bt},l.makeSelectedTextStyleFns=function(mt){var bt={},vt=mt.selected||{},Ut=mt.unselected||{},re=mt.textfont||{},Kt=vt.textfont||{},ue=Ut.textfont||{},Me=re.color,Ce=Kt.color,We=ue.color;return bt.selectedTextColorFn=function(qe){var vr=qe.tc||Me;return qe.selected?Ce||vr:We||(Ce?vr:r.addOpacity(vr,v))},bt},l.selectedPointStyle=function(mt,bt){if(!(!mt.size()||!bt.selectedpoints)){var vt=l.makeSelectedPointStyleFns(bt),Ut=bt.marker||{},re=[];vt.selectedOpacityFn&&re.push(function(Kt,ue){Kt.style("opacity",vt.selectedOpacityFn(ue))}),vt.selectedColorFn&&re.push(function(Kt,ue){r.fill(Kt,vt.selectedColorFn(ue))}),vt.selectedSizeFn&&re.push(function(Kt,ue){var Me=ue.mx||Ut.symbol||0,Ce=vt.selectedSizeFn(ue);Kt.attr("d",b(l.symbolNumber(Me),Ce,Zt(ue,bt),it(ue,bt))),ue.mrc2=Ce}),re.length&&mt.each(function(Kt){for(var ue=u.select(this),Me=0;Me0?vt:0}l.textPointStyle=function(mt,bt,vt){if(mt.size()){var Ut;if(bt.selectedpoints){var re=l.makeSelectedTextStyleFns(bt);Ut=re.selectedTextColorFn}var Kt=bt.texttemplate,ue=vt._fullLayout;mt.each(function(Me){var Ce=u.select(this),We=Kt?d.extractOption(Me,bt,"txt","texttemplate"):d.extractOption(Me,bt,"tx","text");if(!We&&We!==0){Ce.remove();return}if(Kt){var qe=bt._module.formatLabels,vr=qe?qe(Me,bt,ue):{},_r={};w(_r,bt,Me.i),We=d.texttemplateString({data:[_r,Me,bt._meta],fallback:bt.texttemplatefallback,labels:vr,locale:ue._d3locale,template:We})}var er=Me.tp||bt.textposition,Mr=R(Me,bt),Ir=Ut?Ut(Me):Me.tc||bt.textfont.color;Ce.call(l.font,{family:Me.tf||bt.textfont.family,weight:Me.tw||bt.textfont.weight,style:Me.ty||bt.textfont.style,variant:Me.tv||bt.textfont.variant,textcase:Me.tC||bt.textfont.textcase,lineposition:Me.tE||bt.textfont.lineposition,shadow:Me.tS||bt.textfont.shadow,size:Mr,color:Ir}).text(We).call(o.convertToTspans,vt).call(B,er,Mr,Me.mrc)})}},l.selectedTextStyle=function(mt,bt){if(!(!mt.size()||!bt.selectedpoints)){var vt=l.makeSelectedTextStyleFns(bt);mt.each(function(Ut){var re=u.select(this),Kt=vt.selectedTextColorFn(Ut),ue=Ut.tp||bt.textposition,Me=R(Ut,bt);r.fill(re,Kt);var Ce=e.traceIs(bt,"bar-like");B(re,ue,Me,Ut.mrc2||Ut.mrc,Ce)})}};var I=.5;l.smoothopen=function(mt,bt){if(mt.length<3)return"M"+mt.join("L");var vt="M"+mt[0],Ut=[],re;for(re=1;re=Ce||lt>=qe&<<=Ce)&&(yt<=vr&&yt>=We||yt>=vr&&yt<=We)&&(mt=[lt,yt])}return mt}l.applyBackoff=Z,l.makeTester=function(){var mt=d.ensureSingleById(u.select("body"),"svg","js-plotly-tester",function(vt){vt.attr(a.svgAttrs).style({position:"absolute",left:"-10000px",top:"-10000px",width:"9000px",height:"9000px","z-index":"1"})}),bt=d.ensureSingle(mt,"path","js-reference-point",function(vt){vt.attr("d","M0,0H1V1H0Z").style({"stroke-width":0,fill:"black"})});l.tester=mt,l.testref=bt},l.savedBBoxes={};var ot=0,X=1e4;l.bBox=function(mt,bt,vt){vt||(vt=Q(mt));var Ut;if(vt){if(Ut=l.savedBBoxes[vt],Ut)return d.extendFlat({},Ut)}else if(mt.childNodes.length===1){var re=mt.childNodes[0];if(vt=Q(re),vt){var Kt=+re.getAttribute("x")||0,ue=+re.getAttribute("y")||0,Me=re.getAttribute("transform");if(!Me){var Ce=l.bBox(re,!1,vt);return Kt&&(Ce.left+=Kt,Ce.right+=Kt),ue&&(Ce.top+=ue,Ce.bottom+=ue),Ce}if(vt+="~"+Kt+"~"+ue+"~"+Me,Ut=l.savedBBoxes[vt],Ut)return d.extendFlat({},Ut)}}var We,qe;bt?We=mt:(qe=l.tester.node(),We=mt.cloneNode(!0),qe.appendChild(We)),u.select(We).attr("transform",null).call(o.positionText,0,0);var vr=We.getBoundingClientRect(),_r=l.testref.node().getBoundingClientRect();bt||qe.removeChild(We);var er={height:vr.height,width:vr.width,left:vr.left-_r.left,top:vr.top-_r.top,right:vr.right-_r.left,bottom:vr.bottom-_r.top};return ot>=X&&(l.savedBBoxes={},ot=0),vt&&(l.savedBBoxes[vt]=er),ot++,d.extendFlat({},er)};function Q(mt){var bt=mt.getAttribute("data-unformatted");if(bt!==null)return bt+mt.getAttribute("data-math")+mt.getAttribute("text-anchor")+mt.getAttribute("style")}l.setClipUrl=function(mt,bt,vt){mt.attr("clip-path",ut(bt,vt))};function ut(mt,bt){if(!mt)return null;var vt=bt._context,Ut=vt._exportedPlot?"":vt._baseUrl||"";return Ut?"url('"+Ut+"#"+mt+"')":"url(#"+mt+")"}l.getTranslate=function(mt){var bt=/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,vt=mt.attr?"attr":"getAttribute",Ut=mt[vt]("transform")||"",re=Ut.replace(bt,function(Kt,ue,Me){return[ue,Me].join(" ")}).split(" ");return{x:+re[0]||0,y:+re[1]||0}},l.setTranslate=function(mt,bt,vt){var Ut=/(\btranslate\(.*?\);?)/,re=mt.attr?"attr":"getAttribute",Kt=mt.attr?"attr":"setAttribute",ue=mt[re]("transform")||"";return bt=bt||0,vt=vt||0,ue=ue.replace(Ut,"").trim(),ue+=n(bt,vt),ue=ue.trim(),mt[Kt]("transform",ue),ue},l.getScale=function(mt){var bt=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,vt=mt.attr?"attr":"getAttribute",Ut=mt[vt]("transform")||"",re=Ut.replace(bt,function(Kt,ue,Me){return[ue,Me].join(" ")}).split(" ");return{x:+re[0]||1,y:+re[1]||1}},l.setScale=function(mt,bt,vt){var Ut=/(\bscale\(.*?\);?)/,re=mt.attr?"attr":"getAttribute",Kt=mt.attr?"attr":"setAttribute",ue=mt[re]("transform")||"";return bt=bt||1,vt=vt||1,ue=ue.replace(Ut,"").trim(),ue+="scale("+bt+","+vt+")",ue=ue.trim(),mt[Kt]("transform",ue),ue};var J=/\s*sc.*/;l.setPointGroupScale=function(mt,bt,vt){if(bt=bt||1,vt=vt||1,!!mt){var Ut=bt===1&&vt===1?"":"scale("+bt+","+vt+")";mt.each(function(){var re=(this.getAttribute("transform")||"").replace(J,"");re+=Ut,re=re.trim(),this.setAttribute("transform",re)})}};var q=/translate\([^)]*\)\s*$/;l.setTextPointsScale=function(mt,bt,vt){mt&&mt.each(function(){var Ut,re=u.select(this),Kt=re.select("text");if(Kt.node()){var ue=parseFloat(Kt.attr("x")||0),Me=parseFloat(Kt.attr("y")||0),Ce=(re.attr("transform")||"").match(q);bt===1&&vt===1?Ut=[]:Ut=[n(ue,Me),"scale("+bt+","+vt+")",n(-ue,-Me)],Ce&&Ut.push(Ce),re.attr("transform",Ut.join(""))}})};function it(mt,bt){var vt;return mt&&(vt=mt.mf),vt===void 0&&(vt=bt.marker&&bt.marker.standoff||0),!bt._geo&&!bt._xA?-vt:vt}l.getMarkerStandoff=it;var nt=Math.atan2,dt=Math.cos,Tt=Math.sin;function wt(mt,bt){var vt=bt[0],Ut=bt[1];return[vt*dt(mt)-Ut*Tt(mt),vt*Tt(mt)+Ut*dt(mt)]}var Ct,It,Nt,te,Jt,ee;function Zt(mt,bt){var vt=mt.ma;vt===void 0&&(vt=bt.marker.angle,(!vt||d.isArrayOrTypedArray(vt))&&(vt=0));var Ut,re,Kt=bt.marker.angleref;if(Kt==="previous"||Kt==="north"){if(bt._geo){var ue=bt._geo.project(mt.lonlat);Ut=ue[0],re=ue[1]}else{var Me=bt._xA,Ce=bt._yA;if(Me&&Ce)Ut=Me.c2p(mt.x),re=Ce.c2p(mt.y);else return 90}if(bt._geo){var We=mt.lonlat[0],qe=mt.lonlat[1],vr=bt._geo.project([We,qe+1e-5]),_r=bt._geo.project([We+1e-5,qe]),er=nt(_r[1]-re,_r[0]-Ut),Mr=nt(vr[1]-re,vr[0]-Ut),Ir;if(Kt==="north")Ir=vt/180*Math.PI;else if(Kt==="previous"){var de=We/180*Math.PI,Dt=qe/180*Math.PI,qt=Ct/180*Math.PI,_t=It/180*Math.PI,lt=qt-de,yt=dt(_t)*Tt(lt),St=Tt(_t)*dt(Dt)-dt(_t)*Tt(Dt)*dt(lt);Ir=-nt(yt,St)-Math.PI,Ct=We,It=qe}var Ht=wt(er,[dt(Ir),0]),Yt=wt(Mr,[Tt(Ir),0]);vt=nt(Ht[1]+Yt[1],Ht[0]+Yt[0])/Math.PI*180,Kt==="previous"&&!(ee===bt.uid&&mt.i===Jt+1)&&(vt=null)}if(Kt==="previous"&&!bt._geo)if(ee===bt.uid&&mt.i===Jt+1&&A(Ut)&&A(re)){var se=Ut-Nt,ke=re-te,Ee=bt.line&&bt.line.shape||"",Ue=Ee.slice(Ee.length-1);Ue==="h"&&(ke=0),Ue==="v"&&(se=0),vt+=nt(ke,se)/Math.PI*180+90}else vt=null}return Nt=Ut,te=re,Jt=mt.i,ee=bt.uid,vt}l.getMarkerAngle=Zt}),c0=Vt((K,V)=>{var u=Ni(),d=Lo(),E=Vu(),A=ji(),t=Xr(),e=t.strTranslate,r=Eo(),i=Pi(),n=Dl(),o=bd(),a=gf().OPPOSITE_SIDE,s=/ [XY][0-9]* /,f=1.6,v=1.6;function g(m,w,l){var x=m._fullLayout,y=l.propContainer,S=l.propName,k=l.placeholder,M=l.traceIndex,T=l.avoid||{},c=l.attributes,h=l.transform,b=l.containerGroup,_=1,P=y.title,z=(P&&P.text?P.text:"").trim(),D=!1,B=P&&P.font?P.font:{},R=B.family,I=B.size,F=B.color,j=B.weight,N=B.style,G=B.variant,rt=B.textcase,ct=B.lineposition,st=B.shadow,et=l.subtitlePropName,Z=!!et,ot=l.subtitlePlaceholder,X=(y.title||{}).subtitle||{text:"",font:{}},Q=(X.text||"").trim(),ut=!1,J=1,q=X.font,it=q.family,nt=q.size,dt=q.color,Tt=q.weight,wt=q.style,Ct=q.variant,It=q.textcase,Nt=q.lineposition,te=q.shadow,Jt;S==="title.text"?Jt="titleText":S.indexOf("axis")!==-1?Jt="axisTitleText":S.indexOf("colorbar")!==-1&&(Jt="colorbarTitleText");var ee=m._context.edits[Jt];function Zt(_r,er){return _r===void 0||er===void 0?!1:_r.replace(s," % ")===er.replace(s," % ")}z===""?_=0:Zt(z,k)&&(ee||(z=""),_=.2,D=!0),Z&&(Q===""?J=0:Zt(Q,ot)&&(ee||(Q=""),J=.2,ut=!0)),l._meta?z=t.templateString(z,l._meta):x._meta&&(z=t.templateString(z,x._meta));var mt=z||Q||ee,bt;b||(b=t.ensureSingle(x._infolayer,"g","g-"+w),bt=x._hColorbarMoveTitle);var vt=b.selectAll("text."+w).data(mt?[0]:[]);vt.enter().append("text"),vt.text(z).attr("class",w),vt.exit().remove();var Ut=null,re=w+"-subtitle",Kt=Q||ee;if(Z&&(Ut=b.selectAll("text."+re).data(Kt?[0]:[]),Ut.enter().append("text"),Ut.text(Q).attr("class",re),Ut.exit().remove()),!mt)return b;function ue(_r,er){t.syncOrAsync([Me,Ce],{title:_r,subtitle:er})}function Me(_r){var er=_r.title,Mr=_r.subtitle,Ir;!h&&bt&&(h={}),h?(Ir="",h.rotate&&(Ir+="rotate("+[h.rotate,c.x,c.y]+")"),(h.offset||bt)&&(Ir+=e(0,(h.offset||0)-(bt||0)))):Ir=null,er.attr("transform",Ir);function de(St){if(St){var Ht=u.select(St.node().parentNode).select("."+re);if(!Ht.empty()){var Yt=St.node().getBBox();if(Yt.height){var se=Yt.y+Yt.height+f*nt;Ht.attr("y",se)}}}}if(er.style("opacity",_*i.opacity(F)).call(r.font,{color:i.rgb(F),size:u.round(I,2),family:R,weight:j,style:N,variant:G,textcase:rt,shadow:st,lineposition:ct}).attr(c).call(n.convertToTspans,m,de),Mr&&!Mr.empty()){var Dt=b.select("."+w+"-math-group"),qt=er.node().getBBox(),_t=Dt.node()?Dt.node().getBBox():void 0,lt=_t?_t.y+_t.height+f*nt:qt.y+qt.height+v*nt,yt=t.extendFlat({},c,{y:lt});Mr.attr("transform",Ir),Mr.style("opacity",J*i.opacity(dt)).call(r.font,{color:i.rgb(dt),size:u.round(nt,2),family:it,weight:Tt,style:wt,variant:Ct,textcase:It,shadow:te,lineposition:Nt}).attr(yt).call(n.convertToTspans,m)}return E.previousPromises(m)}function Ce(_r){var er=_r.title,Mr=u.select(er.node().parentNode);if(T&&T.selection&&T.side&&z){Mr.attr("transform",null);var Ir=a[T.side],de=T.side==="left"||T.side==="top"?-1:1,Dt=d(T.pad)?T.pad:2,qt=r.bBox(Mr.node()),_t={t:0,b:0,l:0,r:0},lt=m._fullLayout._reservedMargin;for(var yt in lt)for(var St in lt[yt]){var Ht=lt[yt][St];_t[St]=Math.max(_t[St],Ht)}var Yt={left:_t.l,top:_t.t,right:x.width-_t.r,bottom:x.height-_t.b},se=T.maxShift||de*(Yt[T.side]-qt[T.side]),ke=0;if(se<0)ke=se;else{var Ee=T.offsetLeft||0,Ue=T.offsetTop||0;qt.left-=Ee,qt.right-=Ee,qt.top-=Ue,qt.bottom-=Ue,T.selection.each(function(){var ar=r.bBox(this);t.bBoxIntersect(qt,ar,Dt)&&(ke=Math.max(ke,de*(ar[T.side]-qt[Ir])+Dt))}),ke=Math.min(se,ke),y._titleScoot=Math.abs(ke)}if(ke>0||se<0){var ir={left:[-ke,0],right:[ke,0],top:[0,-ke],bottom:[0,ke]}[T.side];Mr.attr("transform",e(ir[0],ir[1]))}}}vt.call(ue,Ut);function We(_r,er){_r.text(er).on("mouseover.opacity",function(){u.select(this).transition().duration(o.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){u.select(this).transition().duration(o.HIDE_PLACEHOLDER).style("opacity",0)})}if(ee&&(z?vt.on(".opacity",null):(We(vt,k),D=!0),vt.call(n.makeEditable,{gd:m}).on("edit",function(_r){M!==void 0?A.call("_guiRestyle",m,S,_r,M):A.call("_guiRelayout",m,S,_r)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(ue)}).on("input",function(_r){this.text(_r||" ").call(n.positionText,c.x,c.y)}),Z)){if(Z&&!z){var qe=vt.node().getBBox(),vr=qe.y+qe.height+v*nt;Ut.attr("y",vr)}Q?Ut.on(".opacity",null):(We(Ut,ot),ut=!0),Ut.call(n.makeEditable,{gd:m}).on("edit",function(_r){A.call("_guiRelayout",m,"title.subtitle.text",_r)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(ue)}).on("input",function(_r){this.text(_r||" ").call(n.positionText,Ut.attr("x"),Ut.attr("y"))})}return vt.classed("js-placeholder",D),Ut&&!Ut.empty()&&Ut.classed("js-placeholder",ut),b}V.exports={draw:g,SUBTITLE_PADDING_EM:v,SUBTITLE_PADDING_MATHJAX_EM:f}}),gp=Vt((K,V)=>{var u=Ni(),d=mm().utcFormat,E=Xr(),A=E.numberFormat,t=Lo(),e=E.cleanNumber,r=E.ms2DateTime,i=E.dateTime2ms,n=E.ensureNumber,o=E.isArrayOrTypedArray,a=ks(),s=a.FP_SAFE,f=a.BADNUM,v=a.LOG_CLIP,g=a.ONEWEEK,m=a.ONEDAY,w=a.ONEHOUR,l=a.ONEMIN,x=a.ONESEC,y=fc(),S=Mf(),k=S.HOUR_PATTERN,M=S.WEEKDAY_PATTERN;function T(h){return Math.pow(10,h)}function c(h){return h!=null}V.exports=function(h,b){b=b||{};var _=h._id||"x",P=_.charAt(0);function z(X,Q){if(X>0)return Math.log(X)/Math.LN10;if(X<=0&&Q&&h.range&&h.range.length===2){var ut=h.range[0],J=h.range[1];return .5*(ut+J-2*v*Math.abs(ut-J))}else return f}function D(X,Q,ut,J){if((J||{}).msUTC&&t(X))return+X;var q=i(X,ut||h.calendar);if(q===f)if(t(X)){X=+X;var it=Math.floor(E.mod(X+.05,1)*10),nt=Math.round(X-it/10);q=i(new Date(nt))+it/10}else return f;return q}function B(X,Q,ut){return r(X,Q,ut||h.calendar)}function R(X){return h._categories[Math.round(X)]}function I(X){if(c(X)){if(h._categoriesMap===void 0&&(h._categoriesMap={}),h._categoriesMap[X]!==void 0)return h._categoriesMap[X];h._categories.push(typeof X=="number"?String(X):X);var Q=h._categories.length-1;return h._categoriesMap[X]=Q,Q}return f}function F(X,Q){for(var ut=new Array(Q),J=0;Jh.range[1]&&(ut=!ut);for(var J=ut?-1:1,q=J*X,it=0,nt=0;ntTt)it=nt+1;else{it=q<(dt+Tt)/2?nt:nt+1;break}}var wt=h._B[it]||0;return isFinite(wt)?rt(X,h._m2,wt):0},et=function(X){var Q=h._rangebreaks.length;if(!Q)return ct(X,h._m,h._b);for(var ut=0,J=0;Jh._rangebreaks[J].pmax&&(ut=J+1);return ct(X,h._m2,h._B[ut])}}h.c2l=h.type==="log"?z:n,h.l2c=h.type==="log"?T:n,h.l2p=st,h.p2l=et,h.c2p=h.type==="log"?function(X,Q){return st(z(X,Q))}:st,h.p2c=h.type==="log"?function(X){return T(et(X))}:et,["linear","-"].indexOf(h.type)!==-1?(h.d2r=h.r2d=h.d2c=h.r2c=h.d2l=h.r2l=e,h.c2d=h.c2r=h.l2d=h.l2r=n,h.d2p=h.r2p=function(X){return h.l2p(e(X))},h.p2d=h.p2r=et,h.cleanPos=n):h.type==="log"?(h.d2r=h.d2l=function(X,Q){return z(e(X),Q)},h.r2d=h.r2c=function(X){return T(e(X))},h.d2c=h.r2l=e,h.c2d=h.l2r=n,h.c2r=z,h.l2d=T,h.d2p=function(X,Q){return h.l2p(h.d2r(X,Q))},h.p2d=function(X){return T(et(X))},h.r2p=function(X){return h.l2p(e(X))},h.p2r=et,h.cleanPos=n):h.type==="date"?(h.d2r=h.r2d=E.identity,h.d2c=h.r2c=h.d2l=h.r2l=D,h.c2d=h.c2r=h.l2d=h.l2r=B,h.d2p=h.r2p=function(X,Q,ut){return h.l2p(D(X,0,ut))},h.p2d=h.p2r=function(X,Q,ut){return B(et(X),Q,ut)},h.cleanPos=function(X){return E.cleanDate(X,f,h.calendar)}):h.type==="category"?(h.d2c=h.d2l=I,h.r2d=h.c2d=h.l2d=R,h.d2r=h.d2l_noadd=N,h.r2c=function(X){var Q=G(X);return Q!==void 0?Q:h.fraction2r(.5)},h.l2r=h.c2r=n,h.r2l=G,h.d2p=function(X){return h.l2p(h.r2c(X))},h.p2d=function(X){return R(et(X))},h.r2p=h.d2p,h.p2r=et,h.cleanPos=function(X){return typeof X=="string"&&X!==""?X:n(X)}):h.type==="multicategory"&&(h.r2d=h.c2d=h.l2d=R,h.d2r=h.d2l_noadd=N,h.r2c=function(X){var Q=N(X);return Q!==void 0?Q:h.fraction2r(.5)},h.r2c_just_indices=j,h.l2r=h.c2r=n,h.r2l=N,h.d2p=function(X){return h.l2p(h.r2c(X))},h.p2d=function(X){return R(et(X))},h.r2p=h.d2p,h.p2r=et,h.cleanPos=function(X){return Array.isArray(X)||typeof X=="string"&&X!==""?X:n(X)},h.setupMultiCategory=function(X){var Q=h._traceIndices,ut,J,q=h._matchGroup;if(q&&h._categories.length===0){for(var it in q)if(it!==_){var nt=b[y.id2name(it)];Q=Q.concat(nt._traceIndices)}}var dt=[[0,{}],[0,{}]],Tt=[];for(ut=0;utnt[1]&&(J[it?0:1]=ut),J[0]===J[1]){var dt=h.l2r(Q),Tt=h.l2r(ut);if(Q!==void 0){var wt=dt+1;ut!==void 0&&(wt=Math.min(wt,Tt)),J[it?1:0]=wt}if(ut!==void 0){var Ct=Tt+1;Q!==void 0&&(Ct=Math.max(Ct,dt)),J[it?0:1]=Ct}}}},h.cleanRange=function(X,Q){h._cleanRange(X,Q),h.limitRange(X)},h._cleanRange=function(X,Q){Q||(Q={}),X||(X="range");var ut=E.nestedProperty(h,X).get(),J,q;if(h.type==="date"?q=E.dfltRange(h.calendar):P==="y"?q=S.DFLTRANGEY:h._name==="realaxis"?q=[0,1]:q=Q.dfltRange||S.DFLTRANGEX,q=q.slice(),(h.rangemode==="tozero"||h.rangemode==="nonnegative")&&(q[0]=0),!ut||ut.length!==2){E.nestedProperty(h,X).set(q);return}var it=ut[0]===null,nt=ut[1]===null;for(h.type==="date"&&!h.autorange&&(ut[0]=E.cleanDate(ut[0],f,h.calendar),ut[1]=E.cleanDate(ut[1],f,h.calendar)),J=0;J<2;J++)if(h.type==="date"){if(!E.isDateTime(ut[J],h.calendar)){h[X]=q;break}if(h.r2l(ut[0])===h.r2l(ut[1])){var dt=E.constrain(h.r2l(ut[0]),E.MIN_MS+1e3,E.MAX_MS-1e3);ut[0]=h.l2r(dt-1e3),ut[1]=h.l2r(dt+1e3);break}}else{if(!t(ut[J]))if(!(it||nt)&&t(ut[1-J]))ut[J]=ut[1-J]*(J?10:.1);else{h[X]=q;break}if(ut[J]<-s?ut[J]=-s:ut[J]>s&&(ut[J]=s),ut[0]===ut[1]){var Tt=Math.max(1,Math.abs(ut[0]*1e-6));ut[0]-=Tt,ut[1]+=Tt}}},h.setScale=function(X){var Q=b._size;if(h.overlaying){var ut=y.getFromId({_fullLayout:b},h.overlaying);h.domain=ut.domain}var J=X&&h._r?"_r":"range",q=h.calendar;h.cleanRange(J);var it=h.r2l(h[J][0],q),nt=h.r2l(h[J][1],q),dt=P==="y";if(dt?(h._offset=Q.t+(1-h.domain[1])*Q.h,h._length=Q.h*(h.domain[1]-h.domain[0]),h._m=h._length/(it-nt),h._b=-h._m*nt):(h._offset=Q.l+h.domain[0]*Q.w,h._length=Q.w*(h.domain[1]-h.domain[0]),h._m=h._length/(nt-it),h._b=-h._m*it),h._rangebreaks=[],h._lBreaks=0,h._m2=0,h._B=[],h.rangebreaks){var Tt,wt;if(h._rangebreaks=h.locateBreaks(Math.min(it,nt),Math.max(it,nt)),h._rangebreaks.length){for(Tt=0;Ttnt&&(Ct=!Ct),Ct&&h._rangebreaks.reverse();var It=Ct?-1:1;for(h._m2=It*h._length/(Math.abs(nt-it)-h._lBreaks),h._B.push(-h._m2*(dt?nt:it)),Tt=0;Ttq&&(q+=7,itq&&(q+=24,it=J&&it=J&&X=Kt.min&&(btKt.max&&(Kt.max=vt),Ut=!1)}Ut&&nt.push({min:bt,max:vt})}};for(ut=0;ut{var u=Lo(),d=Xr(),E=ks().BADNUM,A=d.isArrayOrTypedArray,t=d.isDateTime,e=d.cleanNumber,r=Math.round;V.exports=function(v,g,m){var w=v,l=m.noMultiCategory;if(A(w)&&!w.length)return"-";if(!l&&f(w))return"multicategory";if(l&&Array.isArray(w[0])){for(var x=[],y=0;yx*2}function a(v){return Math.max(1,(v-1)/1e3)}function s(v,g){for(var m=v.length,w=a(m),l=0,x=0,y={},S=0;Sl*2}function f(v){return A(v[0])&&A(v[1])}}),Yh=Vt((K,V)=>{var u=Ni(),d=Lo(),E=Xr(),A=ks().FP_SAFE,t=ji(),e=Eo(),r=fc(),i=r.getFromId,n=r.isLinked;V.exports={applyAutorangeOptions:b,getAutoRange:o,makePadFn:s,doAutoRange:m,findExtremes:w,concatExtremes:g};function o(_,P){var z,D,B=[],R=_._fullLayout,I=s(R,P,0),F=s(R,P,1),j=g(_,P),N=j.min,G=j.max;if(N.length===0||G.length===0)return E.simpleMap(P.range,P.r2l);var rt=N[0].val,ct=G[0].val;for(z=1;z0&&(wt=ut-I(it)-F(nt),wt>J?Ct/wt>q&&(dt=it,Tt=nt,q=Ct/wt):Ct/ut>q&&(dt={val:it.val,nopad:1},Tt={val:nt.val,nopad:1},q=Ct/ut));function It(Zt,mt){return Math.max(Zt,F(mt))}if(rt===ct){var Nt=rt-1,te=rt+1;if(X)if(rt===0)B=[0,1];else{var Jt=(rt>0?G:N).reduce(It,0),ee=rt/(1-Math.min(.5,Jt/ut));B=rt>0?[0,ee]:[ee,0]}else Q?B=[Math.max(0,Nt),Math.max(1,te)]:B=[Nt,te]}else X?(dt.val>=0&&(dt={val:0,nopad:1}),Tt.val<=0&&(Tt={val:0,nopad:1})):Q&&(dt.val-q*I(dt)<0&&(dt={val:0,nopad:1}),Tt.val<=0&&(Tt={val:1,nopad:1})),q=(Tt.val-dt.val-a(P,it.val,nt.val))/(ut-I(dt)-F(Tt)),B=[dt.val-q*I(dt),Tt.val+q*F(Tt)];return B=b(B,P),P.limitRange&&P.limitRange(),et&&B.reverse(),E.simpleMap(B,P.l2r||Number)}function a(_,P,z){var D=0;if(_.rangebreaks)for(var B=_.locateBreaks(P,z),R=0;R0?z.ppadplus:z.ppadminus)||z.ppad||0),it=J((_._m>0?z.ppadminus:z.ppadplus)||z.ppad||0),nt=J(z.vpadplus||z.vpad),dt=J(z.vpadminus||z.vpad);if(!N){if(Q=1/0,ut=-1/0,j)for(rt=0;rt0&&(Q=ct),ct>ut&&ct-A&&(Q=ct),ct>ut&&ct=Ct;rt--)wt(rt);return{min:D,max:B,opts:z}}function l(_,P,z,D){y(_,P,z,D,k)}function x(_,P,z,D){y(_,P,z,D,M)}function y(_,P,z,D,B){for(var R=D.tozero,I=D.extrapad,F=!0,j=0;j<_.length&&F;j++){var N=_[j];if(B(N.val,P)&&N.pad>=z&&(N.extrapad||!I)){F=!1;break}else B(P,N.val)&&N.pad<=z&&(I||!N.extrapad)&&(_.splice(j,1),j--)}if(F){var G=R&&P===0;_.push({val:P,pad:G?0:z,extrapad:G?!1:I})}}function S(_){return d(_)&&Math.abs(_)=P}function T(_,P){var z=P.autorangeoptions;return z&&z.minallowed!==void 0&&h(P,z.minallowed,z.maxallowed)?z.minallowed:z&&z.clipmin!==void 0&&h(P,z.clipmin,z.clipmax)?Math.max(_,P.d2l(z.clipmin)):_}function c(_,P){var z=P.autorangeoptions;return z&&z.maxallowed!==void 0&&h(P,z.minallowed,z.maxallowed)?z.maxallowed:z&&z.clipmax!==void 0&&h(P,z.clipmin,z.clipmax)?Math.min(_,P.d2l(z.clipmax)):_}function h(_,P,z){return P!==void 0&&z!==void 0?(P=_.d2l(P),z=_.d2l(z),P=j&&(R=j,z=j),I<=j&&(I=j,D=j)}}return z=T(z,P),D=c(D,P),[z,D]}}),yo=Vt((K,V)=>{var u=Ni(),d=Lo(),E=Vu(),A=ji(),t=Xr(),e=t.strTranslate,r=Dl(),i=c0(),n=Pi(),o=Eo(),a=Of(),s=pb(),f=ks(),v=f.ONEMAXYEAR,g=f.ONEAVGYEAR,m=f.ONEMINYEAR,w=f.ONEMAXQUARTER,l=f.ONEAVGQUARTER,x=f.ONEMINQUARTER,y=f.ONEMAXMONTH,S=f.ONEAVGMONTH,k=f.ONEMINMONTH,M=f.ONEWEEK,T=f.ONEDAY,c=T/2,h=f.ONEHOUR,b=f.ONEMIN,_=f.ONESEC,P=f.ONEMILLI,z=f.ONEMICROSEC,D=f.MINUS_SIGN,B=f.BADNUM,R={K:"zeroline"},I={K:"gridline",L:"path"},F={K:"minor-gridline",L:"path"},j={K:"tick",L:"path"},N={K:"tick",L:"text"},G={width:["x","r","l","xl","xr"],height:["y","t","b","yt","yb"],right:["r","xr"],left:["l","xl"],top:["t","yt"],bottom:["b","yb"]},rt=gf(),ct=rt.MID_SHIFT,st=rt.CAP_SHIFT,et=rt.LINE_SPACING,Z=rt.OPPOSITE_SIDE,ot=3,X=V.exports={};X.setConvert=gp();var Q=km(),ut=fc(),J=ut.idSort,q=ut.isLinked;X.id2name=ut.id2name,X.name2id=ut.name2id,X.cleanId=ut.cleanId,X.list=ut.list,X.listIds=ut.listIds,X.getFromId=ut.getFromId,X.getFromTrace=ut.getFromTrace;var it=Yh();X.getAutoRange=it.getAutoRange,X.findExtremes=it.findExtremes;var nt=1e-4;function dt(ve){var ge=(ve[1]-ve[0])*nt;return[ve[0]-ge,ve[1]+ge]}X.coerceRef=function(ve,ge,dr,br,Tr,mr){var kr=br.charAt(br.length-1),Ur=dr._fullLayout._subplots[kr+"axis"],Or=br+"ref",pe={};return Tr||(Tr=Ur[0]||(typeof mr=="string"?mr:mr[0])),mr||(mr=Tr),Ur=Ur.concat(Ur.map(function(Ke){return Ke+" domain"})),pe[Or]={valType:"enumerated",values:Ur.concat(mr?typeof mr=="string"?[mr]:mr:[]),dflt:Tr},t.coerce(ve,ge,pe,Or)},X.getRefType=function(ve){return ve===void 0?ve:ve==="paper"?"paper":ve==="pixel"?"pixel":/( domain)$/.test(ve)?"domain":"range"},X.coercePosition=function(ve,ge,dr,br,Tr,mr){var kr,Ur,Or=X.getRefType(br);if(Or!=="range")kr=t.ensureNumber,Ur=dr(Tr,mr);else{var pe=X.getFromId(ge,br);mr=pe.fraction2r(mr),Ur=dr(Tr,mr),kr=pe.cleanPos}ve[Tr]=kr(Ur)},X.cleanPosition=function(ve,ge,dr){var br=dr==="paper"||dr==="pixel"?t.ensureNumber:X.getFromId(ge,dr).cleanPos;return br(ve)},X.redrawComponents=function(ve,ge){ge=ge||X.listIds(ve);var dr=ve._fullLayout;function br(Tr,mr,kr,Ur){for(var Or=A.getComponentMethod(Tr,mr),pe={},Ke=0;Ke2e-6||((dr-ve._forceTick0)/ve._minDtick%1+1.000001)%1>2e-6)&&(ve._minDtick=0))},X.saveRangeInitial=function(ve,ge){for(var dr=X.list(ve,"",!0),br=!1,Tr=0;Trxr*.3||pe(br)||pe(Tr))){var Gr=dr.dtick/2;ve+=ve+Grkr){var Ur=Number(dr.slice(1));mr.exactYears>kr&&Ur%12===0?ve=X.tickIncrement(ve,"M6","reverse")+T*1.5:mr.exactMonths>kr?ve=X.tickIncrement(ve,"M1","reverse")+T*15.5:ve-=c;var Or=X.tickIncrement(ve,dr);if(Or<=br)return Or}return ve}X.prepMinorTicks=function(ve,ge,dr){if(!ge.minor.dtick){delete ve.dtick;var br=ge.dtick&&d(ge._tmin),Tr;if(br){var mr=X.tickIncrement(ge._tmin,ge.dtick,!0);Tr=[ge._tmin,mr*.99+ge._tmin*.01]}else{var kr=t.simpleMap(ge.range,ge.r2l);Tr=[kr[0],.8*kr[0]+.2*kr[1]]}if(ve.range=t.simpleMap(Tr,ge.l2r),ve._isMinor=!0,X.prepTicks(ve,dr),br){var Ur=d(ge.dtick),Or=d(ve.dtick),pe=Ur?ge.dtick:+ge.dtick.substring(1),Ke=Or?ve.dtick:+ve.dtick.substring(1);Ur&&Or?te(pe,Ke)?pe===2*M&&Ke===2*T&&(ve.dtick=M):pe===2*M&&Ke===3*T?ve.dtick=M:pe===M&&!(ge._input.minor||{}).nticks?ve.dtick=T:Jt(pe/Ke,2.5)?ve.dtick=pe/2:ve.dtick=pe:String(ge.dtick).charAt(0)==="M"?Or?ve.dtick="M1":te(pe,Ke)?pe>=12&&Ke===2&&(ve.dtick="M3"):ve.dtick=ge.dtick:String(ve.dtick).charAt(0)==="L"?String(ge.dtick).charAt(0)==="L"?te(pe,Ke)||(ve.dtick=Jt(pe/Ke,2.5)?ge.dtick/2:ge.dtick):ve.dtick="D1":ve.dtick==="D2"&&+ge.dtick>1&&(ve.dtick=1)}ve.range=ge.range}ge.minor._tick0Init===void 0&&(ve.tick0=ge.tick0)};function te(ve,ge){return Math.abs((ve/ge+.5)%1-.5)<.001}function Jt(ve,ge){return Math.abs(ve/ge-1)<.001}X.prepTicks=function(ve,ge){var dr=t.simpleMap(ve.range,ve.r2l,void 0,void 0,ge);if(ve.tickmode==="auto"||!ve.dtick){var br=ve.nticks,Tr;br||(ve.type==="category"||ve.type==="multicategory"?(Tr=ve.tickfont?t.bigFont(ve.tickfont.size||12):15,br=ve._length/Tr):(Tr=ve._id.charAt(0)==="y"?40:80,br=t.constrain(ve._length/Tr,4,9)+1),ve._name==="radialaxis"&&(br*=2)),ve.minor&&ve.minor.tickmode!=="array"||ve.tickmode==="array"&&(br*=100),ve._roughDTick=Math.abs(dr[1]-dr[0])/br,X.autoTicks(ve,ve._roughDTick),ve._minDtick>0&&ve.dtick0?(mr=br-1,kr=br):(mr=br,kr=br);var Ur=ve[mr].value,Or=ve[kr].value,pe=Math.abs(Or-Ur),Ke=dr||pe,xr=0;Ke>=m?pe>=m&&pe<=v?xr=pe:xr=g:dr===l&&Ke>=x?pe>=x&&pe<=w?xr=pe:xr=l:Ke>=k?pe>=k&&pe<=y?xr=pe:xr=S:dr===M&&Ke>=M?xr=M:Ke>=T?xr=T:dr===c&&Ke>=c?xr=c:dr===h&&Ke>=h&&(xr=h);var Gr;xr>=pe&&(xr=pe,Gr=!0);var ln=Tr+xr;if(ge.rangebreaks&&xr>0){for(var wn=84,rn=0,Qr=0;QrM&&(xr=pe)}(xr>0||br===0)&&(ve[br].periodX=Tr+xr/2)}}X.calcTicks=function(ve,ge){for(var dr=ve.type,br=ve.calendar,Tr=ve.ticklabelstep,mr=ve.ticklabelmode==="period",kr=ve.range[0]>ve.range[1],Ur=!ve.ticklabelindex||t.isArrayOrTypedArray(ve.ticklabelindex)?ve.ticklabelindex:[ve.ticklabelindex],Or=t.simpleMap(ve.range,ve.r2l,void 0,void 0,ge),pe=Or[1]=(Oa?0:1);Qn--){var Qa=!Qn;Qn?(ve._dtickInit=ve.dtick,ve._tick0Init=ve.tick0):(ve.minor._dtickInit=ve.minor.dtick,ve.minor._tick0Init=ve.minor.tick0);var Ja=Qn?ve:t.extendFlat({},ve,ve.minor);if(Qa?X.prepMinorTicks(Ja,ve,ge):X.prepTicks(Ja,ge),Ja.tickmode==="array"){Qn?(rn=[],ln=Ut(ve,!Qa)):(Qr=[],wn=Ut(ve,!Qa));continue}if(Ja.tickmode==="sync"){rn=[],ln=vt(ve);continue}var wi=dt(Or),ci=wi[0],Ti=wi[1],Ra=d(Ja.dtick),Qi=dr==="log"&&!(Ra||Ja.dtick.charAt(0)==="L"),Hi=X.tickFirst(Ja,ge);if(Qn){if(ve._tmin=Hi,Hi=Ti:Ci<=Ti;Ci=X.tickIncrement(Ci,qo,pe,br)){if(Qn&&zo++,Ja.rangebreaks&&!pe){if(Ci=xr)break}if(rn.length>Gr||Ci===Ho)break;Ho=Ci;var Po={value:Ci};Qn?(Qi&&Ci!==(Ci|0)&&(Po.simpleLabel=!0),Tr>1&&zo%Tr&&(Po.skipLabel=!0),rn.push(Po)):(Po.minor=!0,Qr.push(Po))}}if(!Qr||Qr.length<2)Ur=!1;else{var hs=(Qr[1].value-Qr[0].value)*(kr?-1:1);Ga(hs,ve.tickformat)||(Ur=!1)}if(!Ur)vn=rn;else{var Gi=rn.concat(Qr);mr&&rn.length&&(Gi=Gi.slice(1)),Gi=Gi.sort(function(Wo,Bi){return Wo.value-Bi.value}).filter(function(Wo,Bi,$s){return Bi===0||Wo.value!==$s[Bi-1].value});var uo=Gi.map(function(Wo,Bi){return Wo.minor===void 0&&!Wo.skipLabel?Bi:null}).filter(function(Wo){return Wo!==null});uo.forEach(function(Wo){Ur.map(function(Bi){var $s=Wo+Bi;$s>=0&&$s-1;wo--){if(rn[wo].drop){rn.splice(wo,1);continue}rn[wo].value=Kn(rn[wo].value,ve);var No=ve.c2p(rn[wo].value);(Ms?_s>No-Di:_sxr||flxr&&($s.periodX=xr),flTr&&Grg)ge/=g,br=Tr(10),ve.dtick="M"+12*vr(ge,br,re);else if(mr>S)ge/=S,ve.dtick="M"+vr(ge,1,Kt);else if(mr>T){if(ve.dtick=vr(ge,T,ve._hasDayOfWeekBreaks?[1,2,7,14]:Me),!dr){var kr=X.getTickFormat(ve),Ur=ve.ticklabelmode==="period";Ur&&(ve._rawTick0=ve.tick0),/%[uVW]/.test(kr)?ve.tick0=t.dateTick0(ve.calendar,2):ve.tick0=t.dateTick0(ve.calendar,1),Ur&&(ve._dowTick0=ve.tick0)}}else mr>h?ve.dtick=vr(ge,h,Kt):mr>b?ve.dtick=vr(ge,b,ue):mr>_?ve.dtick=vr(ge,_,ue):(br=Tr(10),ve.dtick=vr(ge,br,re))}else if(ve.type==="log"){ve.tick0=0;var Or=t.simpleMap(ve.range,ve.r2l);if(ve._isMinor&&(ge*=1.5),ge>.7)ve.dtick=Math.ceil(ge);else if(Math.abs(Or[1]-Or[0])<1){var pe=1.5*Math.abs((Or[1]-Or[0])/ge);ge=Math.abs(Math.pow(10,Or[1])-Math.pow(10,Or[0]))/pe,br=Tr(10),ve.dtick="L"+vr(ge,br,re)}else ve.dtick=ge>.3?"D2":"D1"}else ve.type==="category"||ve.type==="multicategory"?(ve.tick0=0,ve.dtick=Math.ceil(Math.max(ge,1))):Nn(ve)?(ve.tick0=0,br=1,ve.dtick=vr(ge,br,qe)):(ve.tick0=0,br=Tr(10),ve.dtick=vr(ge,br,re));if(ve.dtick===0&&(ve.dtick=1),!d(ve.dtick)&&typeof ve.dtick!="string"){var Ke=ve.dtick;throw ve.dtick=1,"ax.dtick error: "+String(Ke)}};function _r(ve){var ge=ve.dtick;if(ve._tickexponent=0,!d(ge)&&typeof ge!="string"&&(ge=1),(ve.type==="category"||ve.type==="multicategory")&&(ve._tickround=null),ve.type==="date"){var dr=ve.r2l(ve.tick0),br=ve.l2r(dr).replace(/(^-|i)/g,""),Tr=br.length;if(String(ge).charAt(0)==="M")Tr>10||br.slice(5)!=="01-01"?ve._tickround="d":ve._tickround=+ge.slice(1)%12===0?"y":"m";else if(ge>=T&&Tr<=10||ge>=T*15)ve._tickround="d";else if(ge>=b&&Tr<=16||ge>=h)ve._tickround="M";else if(ge>=_&&Tr<=19||ge>=b)ve._tickround="S";else{var mr=ve.l2r(dr+ge).replace(/^-/,"").length;ve._tickround=Math.max(Tr,mr)-20,ve._tickround<0&&(ve._tickround=4)}}else if(d(ge)||ge.charAt(0)==="L"){var kr=ve.range.map(ve.r2d||Number);d(ge)||(ge=Number(ge.slice(1))),ve._tickround=2-Math.floor(Math.log(ge)/Math.LN10+.01);var Ur=Math.max(Math.abs(kr[0]),Math.abs(kr[1])),Or=Math.floor(Math.log(Ur)/Math.LN10+.01),pe=ve.minexponent===void 0?3:ve.minexponent;Math.abs(Or)>pe&&(Ht(ve.exponentformat)&&ve.exponentformat!=="SI extended"&&!Yt(Or)||Ht(ve.exponentformat)&&ve.exponentformat==="SI extended"&&!se(Or)?ve._tickexponent=3*Math.round((Or-1)/3):ve._tickexponent=Or)}else ve._tickround=null}X.tickIncrement=function(ve,ge,dr,br){var Tr=dr?-1:1;if(d(ge))return t.increment(ve,Tr*ge);var mr=ge.charAt(0),kr=Tr*Number(ge.slice(1));if(mr==="M")return t.incrementMonth(ve,kr,br);if(mr==="L")return Math.log(Math.pow(10,ve)+kr)/Math.LN10;if(mr==="D"){var Ur=ge==="D2"?We:Ce,Or=ve+Tr*.01,pe=t.roundUp(t.mod(Or,1),Ur,dr);return Math.floor(Or)+Math.log(u.round(Math.pow(10,pe),1))/Math.LN10}throw"unrecognized dtick "+String(ge)},X.tickFirst=function(ve,ge){var dr=ve.r2l||Number,br=t.simpleMap(ve.range,dr,void 0,void 0,ge),Tr=br[1]=0&&vn<=ve._length?Qr:null};if(mr&&t.isArrayOrTypedArray(ve.ticktext)){var xr=t.simpleMap(ve.range,ve.r2l),Gr=(Math.abs(xr[1]-xr[0])-(ve._lBreaks||0))/1e4;for(pe=0;pe"+Ur;else{var pe=$n(ve),Ke=ve._trueSide||ve.side;(!pe&&Ke==="top"||pe&&Ke==="bottom")&&(kr+="
          ")}ge.text=kr}function Ir(ve,ge,dr,br,Tr){var mr=ve.dtick,kr=ge.x,Ur=ve.tickformat,Or=typeof mr=="string"&&mr.charAt(0);if(Tr==="never"&&(Tr=""),br&&Or!=="L"&&(mr="L3",Or="L"),Ur||Or==="L")ge.text=Ee(Math.pow(10,kr),ve,Tr,br);else if(d(mr)||Or==="D"&&(ve.minorloglabels==="complete"||t.mod(kr+.01,1)<.1)){ve.minorloglabels==="complete"&&!(t.mod(kr+.01,1)<.1)&&(ge.fontSize*=.75);var pe=Math.pow(10,kr).toExponential(0),Ke=pe.split("e"),xr=+Ke[1],Gr=Math.abs(xr),ln=ve.exponentformat;ln==="power"||Ht(ln)&&ln!=="SI extended"&&Yt(xr)||Ht(ln)&&ln==="SI extended"&&se(xr)?(ge.text=Ke[0],Gr>0&&(ge.text+="x10"),ge.text==="1x10"&&(ge.text="10"),xr!==0&&xr!==1&&(ge.text+=""+(xr>0?"":D)+Gr+""),ge.fontSize*=1.25):(ln==="e"||ln==="E")&&Gr>2?ge.text=Ke[0]+ln+(xr>0?"+":D)+Gr:(ge.text=Ee(Math.pow(10,kr),ve,"","fakehover"),mr==="D1"&&ve._id.charAt(0)==="y"&&(ge.dy-=ge.fontSize/6))}else if(Or==="D")ge.text=ve.minorloglabels==="none"?"":String(Math.round(Math.pow(10,t.mod(kr,1)))),ge.fontSize*=.75;else throw"unrecognized dtick "+String(mr);if(ve.dtick==="D1"){var wn=String(ge.text).charAt(0);(wn==="0"||wn==="1")&&(ve._id.charAt(0)==="y"?ge.dx-=ge.fontSize/4:(ge.dy+=ge.fontSize/2,ge.dx+=(ve.range[1]>ve.range[0]?1:-1)*ge.fontSize*(kr<0?.5:.25)))}}function de(ve,ge){var dr=ve._categories[Math.round(ge.x)];dr===void 0&&(dr=""),ge.text=String(dr)}function Dt(ve,ge,dr){var br=Math.round(ge.x),Tr=ve._categories[br]||[],mr=Tr[1]===void 0?"":String(Tr[1]),kr=Tr[0]===void 0?"":String(Tr[0]);dr?ge.text=kr+" - "+mr:(ge.text=mr,ge.text2=kr)}function qt(ve,ge,dr,br,Tr){Tr==="never"?Tr="":ve.showexponent==="all"&&Math.abs(ge.x/ve.dtick)<1e-6&&(Tr="hide"),ge.text=Ee(ge.x,ve,Tr,br)}function _t(ve,ge,dr,br,Tr){if(ve.thetaunit==="radians"&&!dr){var mr=ge.x/180;if(mr===0)ge.text="0";else{var kr=lt(mr);if(kr[1]>=100)ge.text=Ee(t.deg2rad(ge.x),ve,Tr,br);else{var Ur=ge.x<0;kr[1]===1?kr[0]===1?ge.text="π":ge.text=kr[0]+"π":ge.text=["",kr[0],"","⁄","",kr[1],"","π"].join(""),Ur&&(ge.text=D+ge.text)}}}else ge.text=Ee(ge.x,ve,Tr,br)}function lt(ve){function ge(Ur,Or){return Math.abs(Ur-Or)<=1e-6}function dr(Ur,Or){return ge(Or,0)?Ur:dr(Or,Ur%Or)}function br(Ur){for(var Or=1;!ge(Math.round(Ur*Or)/Or,Ur);)Or*=10;return Or}var Tr=br(ve),mr=ve*Tr,kr=Math.abs(dr(mr,Tr));return[Math.round(mr/kr),Math.round(Tr/kr)]}var yt=["f","p","n","μ","m","","k","M","G","T"],St=["q","r","y","z","a",...yt,"P","E","Z","Y","R","Q"],Ht=ve=>["SI","SI extended","B"].includes(ve);function Yt(ve){return ve>14||ve<-15}function se(ve){return ve>32||ve<-30}function ke(ve,ge){return Ht(ge)?!!(ge==="SI extended"&&se(ve)||ge!=="SI extended"&&Yt(ve)):!1}function Ee(ve,ge,dr,br){var Tr=ve<0,mr=ge._tickround,kr=dr||ge.exponentformat||"B",Ur=ge._tickexponent,Or=X.getTickFormat(ge),pe=ge.separatethousands;if(br){var Ke={exponentformat:kr,minexponent:ge.minexponent,dtick:ge.showexponent==="none"?ge.dtick:d(ve)&&Math.abs(ve)||1,range:ge.showexponent==="none"?ge.range.map(ge.r2d):[0,ve||1]};_r(Ke),mr=(Number(Ke._tickround)||0)+4,Ur=Ke._tickexponent,ge.hoverformat&&(Or=ge.hoverformat)}if(Or)return ge._numFormat(Or)(ve).replace(/-/g,D);var xr=Math.pow(10,-mr)/2;if(kr==="none"&&(Ur=0),ve=Math.abs(ve),ve"+wn+"":kr==="B"&&Ur===9?ve+="B":Ht(kr)&&(ve+=kr==="SI extended"?St[Ur/3+10]:yt[Ur/3+5])}return Tr?D+ve:ve}X.getTickFormat=function(ve){var ge;function dr(Or){return typeof Or!="string"?Or:Number(Or.replace("M",""))*S}function br(Or,pe){var Ke=["L","D"];if(typeof Or==typeof pe){if(typeof Or=="number")return Or-pe;var xr=Ke.indexOf(Or.charAt(0)),Gr=Ke.indexOf(pe.charAt(0));return xr===Gr?Number(Or.replace(/(L|D)/g,""))-Number(pe.replace(/(L|D)/g,"")):xr-Gr}else return typeof Or=="number"?1:-1}function Tr(Or,pe,Ke){var xr=Ke||function(wn){return wn},Gr=pe[0],ln=pe[1];return(!Gr&&typeof Gr!="number"||xr(Gr)<=xr(Or))&&(!ln&&typeof ln!="number"||xr(ln)>=xr(Or))}function mr(Or,pe){var Ke=pe[0]===null,xr=pe[1]===null,Gr=br(Or,pe[0])>=0,ln=br(Or,pe[1])<=0;return(Ke||Gr)&&(xr||ln)}var kr,Ur;if(ve.tickformatstops&&ve.tickformatstops.length>0)switch(ve.type){case"date":case"linear":{for(ge=0;ge=0&&Tr.unshift(Tr.splice(Ke,1).shift())}});var Ur={false:{left:0,right:0}};return t.syncOrAsync(Tr.map(function(Or){return function(){if(Or){var pe=X.getFromId(ve,Or);dr||(dr={}),dr.axShifts=Ur,dr.overlayingShiftedAx=kr;var Ke=X.drawOne(ve,pe,dr);return pe._shiftPusher&&Cn(pe,pe._fullDepth||0,Ur,!0),pe._r=pe.range.slice(),pe._rl=t.simpleMap(pe._r,pe.r2l),Ke}}}))},X.drawOne=function(ve,ge,dr){dr=dr||{};var br=dr.axShifts||{},Tr=dr.overlayingShiftedAx||[],mr,kr,Ur;ge.setScale();var Or=ve._fullLayout,pe=ge._id,Ke=pe.charAt(0),xr=X.counterLetter(pe),Gr=Or._plots[ge._mainSubplot],ln=ge.zerolinelayer==="above traces";if(!Gr)return;if(ge._shiftPusher=ge.autoshift||Tr.indexOf(ge._id)!==-1||Tr.indexOf(ge.overlaying)!==-1,ge._shiftPusher&ge.anchor==="free"){var wn=ge.linewidth/2||0;ge.ticks==="inside"&&(wn+=ge.ticklen),Cn(ge,wn,br,!0),Cn(ge,ge.shift||0,br,!1)}(dr.skipTitle!==!0||ge._shift===void 0)&&(ge._shift=Fa(ge,br));var rn=Gr[Ke+"axislayer"],Qr=ge._mainLinePosition,vn=Qr+=ge._shift,Oa=ge._mainMirrorPosition,Qn=ge._vals=X.calcTicks(ge),Qa=[ge.mirror,vn,Oa].join("_");for(mr=0;mr0?Jo.bottom-$s:0,fl))));var xl=0,bu=0;if(ge._shiftPusher&&(xl=Math.max(fl,Jo.height>0?Wo==="l"?$s-Jo.left:Jo.right-$s:0),ge.title.text!==Or._dfltTitle[Ke]&&(bu=(ge._titleStandoff||0)+(ge._titleScoot||0),Wo==="l"&&(bu+=En(ge))),ge._fullDepth=Math.max(xl,bu)),ge.automargin){us={x:0,y:0,r:0,l:0,t:0,b:0};var au=[0,1],fu=typeof ge._shift=="number"?ge._shift:0;if(Ke==="x"){if(Wo==="b"?us[Wo]=ge._depth:(us[Wo]=ge._depth=Math.max(Jo.width>0?$s-Jo.top:0,fl),au.reverse()),Jo.width>0){var zc=Jo.right-(ge._offset+ge._length);zc>0&&(us.xr=1,us.r=zc);var _c=ge._offset-Jo.left;_c>0&&(us.xl=0,us.l=_c)}}else if(Wo==="l"?(ge._depth=Math.max(Jo.height>0?$s-Jo.left:0,fl),us[Wo]=ge._depth-fu):(ge._depth=Math.max(Jo.height>0?Jo.right-$s:0,fl),us[Wo]=ge._depth+fu,au.reverse()),Jo.height>0){var cs=Jo.bottom-(ge._offset+ge._length);cs>0&&(us.yb=0,us.b=cs);var Gl=ge._offset-Jo.top;Gl>0&&(us.yt=1,us.t=Gl)}us[xr]=ge.anchor==="free"?ge.position:ge._anchorAxis.domain[au[0]],ge.title.text!==Or._dfltTitle[Ke]&&(us[Wo]+=En(ge)+(ge.title.standoff||0)),ge.mirror&&ge.anchor!=="free"&&(Ss={x:0,y:0,r:0,l:0,t:0,b:0},Ss[Bi]=ge.linewidth,ge.mirror&&ge.mirror!==!0&&(Ss[Bi]+=fl),ge.mirror===!0||ge.mirror==="ticks"?Ss[xr]=ge._anchorAxis.domain[au[1]]:(ge.mirror==="all"||ge.mirror==="allticks")&&(Ss[xr]=[ge._counterDomainMin,ge._counterDomainMax][au[1]]))}Is&&(Ls=A.getComponentMethod("rangeslider","autoMarginOpts")(ve,ge)),typeof ge.automargin=="string"&&(Ue(us,ge.automargin),Ue(Ss,ge.automargin)),E.autoMargin(ve,Ze(ge),us),E.autoMargin(ve,tr(ge),Ss),E.autoMargin(ve,zr(ge),Ls)}),t.syncOrAsync(io)}};function Ue(ve,ge){if(ve){var dr=Object.keys(G).reduce(function(br,Tr){return ge.indexOf(Tr)!==-1&&G[Tr].forEach(function(mr){br[mr]=1}),br},{});Object.keys(ve).forEach(function(br){dr[br]||(br.length===1?ve[br]=0:delete ve[br])})}}function ir(ve,ge){var dr=[],br,Tr=function(mr,kr){var Ur=mr.xbnd[kr];Ur!==null&&dr.push(t.extendFlat({},mr,{x:Ur}))};if(ge.length){for(br=0;brve.range[1],Ur=ve.ticklabelposition&&ve.ticklabelposition.indexOf("inside")!==-1,Or=!Ur;if(dr){var pe=kr?-1:1;dr=dr*pe}if(br){var Ke=ve.side,xr=Ur&&(Ke==="top"||Ke==="left")||Or&&(Ke==="bottom"||Ke==="right")?1:-1;br=br*xr}return ve._id.charAt(0)==="x"?function(Gr){return e(Tr+ve._offset+ve.l2p(pn(Gr))+dr,mr+br)}:function(Gr){return e(mr+br,Tr+ve._offset+ve.l2p(pn(Gr))+dr)}};function pn(ve){return ve.periodX!==void 0?ve.periodX:ve.x}function dn(ve){var ge=ve.ticklabelposition||"",dr=ve.tickson||"",br=function(wn){return ge.indexOf(wn)!==-1},Tr=br("top"),mr=br("left"),kr=br("right"),Ur=br("bottom"),Or=br("inside"),pe=dr!=="boundaries"&&(Ur||mr||Tr||kr);if(!pe&&!Or)return[0,0];var Ke=ve.side,xr=pe?(ve.tickwidth||0)/2:0,Gr=ot,ln=ve.tickfont?ve.tickfont.size:12;return(Ur||Tr)&&(xr+=ln*st,Gr+=(ve.linewidth||0)/2),(mr||kr)&&(xr+=(ve.linewidth||0)/2,Gr+=ot),Or&&Ke==="top"&&(Gr-=ln*(1-st)),(mr||Tr)&&(xr=-xr),(Ke==="bottom"||Ke==="right")&&(Gr=-Gr),[pe?xr:0,Or?Gr:0]}X.makeTickPath=function(ve,ge,dr,br){br||(br={});var Tr=br.minor;if(Tr&&!ve.minor)return"";var mr=br.len!==void 0?br.len:Tr?ve.minor.ticklen:ve.ticklen,kr=ve._id.charAt(0),Ur=(ve.linewidth||1)/2;return kr==="x"?"M0,"+(ge+Ur*dr)+"v"+mr*dr:"M"+(ge+Ur*dr)+",0h"+mr*dr},X.makeLabelFns=function(ve,ge,dr){var br=ve.ticklabelposition||"",Tr=ve.tickson||"",mr=function(Ci){return br.indexOf(Ci)!==-1},kr=mr("top"),Ur=mr("left"),Or=mr("right"),pe=mr("bottom"),Ke=Tr!=="boundaries"&&(pe||Ur||kr||Or),xr=mr("inside"),Gr=br==="inside"&&ve.ticks==="inside"||!xr&&ve.ticks==="outside"&&Tr!=="boundaries",ln=0,wn=0,rn=Gr?ve.ticklen:0;if(xr?rn*=-1:Ke&&(rn=0),Gr&&(ln+=rn,dr)){var Qr=t.deg2rad(dr);ln=rn*Math.cos(Qr)+1,wn=rn*Math.sin(Qr)}ve.showticklabels&&(Gr||ve.showline)&&(ln+=.2*ve.tickfont.size),ln+=(ve.linewidth||1)/2*(xr?-1:1);var vn={labelStandoff:ln,labelShift:wn},Oa,Qn,Qa,Ja,wi=0,ci=ve.side,Ti=ve._id.charAt(0),Ra=ve.tickangle,Qi;if(Ti==="x")Qi=!xr&&ci==="bottom"||xr&&ci==="top",Ja=Qi?1:-1,xr&&(Ja*=-1),Oa=wn*Ja,Qn=ge+ln*Ja,Qa=Qi?1:-.2,Math.abs(Ra)===90&&(xr?Qa+=ct:Ra===-90&&ci==="bottom"?Qa=st:Ra===90&&ci==="top"?Qa=ct:Qa=.5,wi=ct/2*(Ra/90)),vn.xFn=function(Ci){return Ci.dx+Oa+wi*Ci.fontSize},vn.yFn=function(Ci){return Ci.dy+Qn+Ci.fontSize*Qa},vn.anchorFn=function(Ci,zo){if(Ke){if(Ur)return"end";if(Or)return"start"}return!d(zo)||zo===0||zo===180?"middle":zo*Ja<0!==xr?"end":"start"},vn.heightFn=function(Ci,zo,qi){return zo<-60||zo>60?-.5*qi:ve.side==="top"!==xr?-qi:0};else if(Ti==="y"){if(Qi=!xr&&ci==="left"||xr&&ci==="right",Ja=Qi?1:-1,xr&&(Ja*=-1),Oa=ln,Qn=wn*Ja,Qa=0,!xr&&Math.abs(Ra)===90&&(Ra===-90&&ci==="left"||Ra===90&&ci==="right"?Qa=st:Qa=.5),xr){var Hi=d(Ra)?+Ra:0;if(Hi!==0){var Ho=t.deg2rad(Hi);wi=Math.abs(Math.sin(Ho))*st*Ja,Qa=0}}vn.xFn=function(Ci){return Ci.dx+ge-(Oa+Ci.fontSize*Qa)*Ja+wi*Ci.fontSize},vn.yFn=function(Ci){return Ci.dy+Qn+Ci.fontSize*ct},vn.anchorFn=function(Ci,zo){return d(zo)&&Math.abs(zo)===90?"middle":Qi?"end":"start"},vn.heightFn=function(Ci,zo,qi){return ve.side==="right"&&(zo*=-1),zo<-30?-qi:zo<30?-.5*qi:0}}return vn};function bn(ve){return[ve.text,ve.x,ve.axInfo,ve.font,ve.fontSize,ve.fontColor].join("_")}X.drawTicks=function(ve,ge,dr){dr=dr||{};var br=ge._id+"tick",Tr=[].concat(ge.minor&&ge.minor.ticks?dr.vals.filter(function(kr){return kr.minor&&!kr.noTick}):[]).concat(ge.ticks?dr.vals.filter(function(kr){return!kr.minor&&!kr.noTick}):[]),mr=dr.layer.selectAll("path."+br).data(Tr,bn);mr.exit().remove(),mr.enter().append("path").classed(br,1).classed("ticks",1).classed("crisp",dr.crisp!==!1).each(function(kr){return n.stroke(u.select(this),kr.minor?ge.minor.tickcolor:ge.tickcolor)}).style("stroke-width",function(kr){return o.crispRound(ve,kr.minor?ge.minor.tickwidth:ge.tickwidth,1)+"px"}).attr("d",dr.path).style("display",null),ia(ge,[j]),mr.attr("transform",dr.transFn)},X.drawGrid=function(ve,ge,dr){if(dr=dr||{},ge.tickmode!=="sync"){var br=ge._id+"grid",Tr=ge.minor&&ge.minor.showgrid,mr=Tr?dr.vals.filter(function(vn){return vn.minor}):[],kr=ge.showgrid?dr.vals.filter(function(vn){return!vn.minor}):[],Ur=dr.counterAxis;if(Ur&&X.shouldShowZeroLine(ve,ge,Ur))for(var Or=ge.tickmode==="array",pe=0;pe=0;wn--){var rn=wn?Gr:ln;if(rn){var Qr=rn.selectAll("path."+br).data(wn?kr:mr,bn);Qr.exit().remove(),Qr.enter().append("path").classed(br,1).classed("crisp",dr.crisp!==!1),Qr.attr("transform",dr.transFn).attr("d",dr.path).each(function(vn){return n.stroke(u.select(this),vn.minor?ge.minor.gridcolor:ge.gridcolor||"#ddd")}).style("stroke-dasharray",function(vn){return o.dashStyle(vn.minor?ge.minor.griddash:ge.griddash,vn.minor?ge.minor.gridwidth:ge.gridwidth)}).style("stroke-width",function(vn){return(vn.minor?xr:ge._gw)+"px"}).style("display",null),typeof dr.path=="function"&&Qr.attr("d",dr.path)}}ia(ge,[I,F])}},X.drawZeroLine=function(ve,ge,dr){dr=dr||dr;var br=ge._id+"zl",Tr=X.shouldShowZeroLine(ve,ge,dr.counterAxis),mr=dr.layer.selectAll("path."+br).data(Tr?[{x:0,id:ge._id}]:[]);mr.exit().remove(),mr.enter().append("path").classed(br,1).classed("zl",1).classed("crisp",dr.crisp!==!1).each(function(){dr.layer.selectAll("path").sort(function(kr,Ur){return J(kr.id,Ur.id)})}),mr.attr("transform",dr.transFn).attr("d",dr.path).call(n.stroke,ge.zerolinecolor||n.defaultLine).style("stroke-width",o.crispRound(ve,ge.zerolinewidth,ge._gw||1)+"px").style("display",null),ia(ge,[R])},X.drawLabels=function(ve,ge,dr){dr=dr||{};var br=ve._fullLayout,Tr=ge._id,mr=ge.zerolinelayer==="above traces",kr=dr.cls||Tr+"tick",Ur=dr.vals.filter(function(Gi){return Gi.text}),Or=dr.labelFns,pe=dr.secondary?0:ge.tickangle,Ke=(ge._prevTickAngles||{})[kr],xr=dr.layer.selectAll("g."+kr).data(ge.showticklabels?Ur:[],bn),Gr=[];xr.enter().append("g").classed(kr,1).append("text").attr("text-anchor","middle").each(function(Gi){var uo=u.select(this),yi=ve._promises.length;uo.call(r.positionText,Or.xFn(Gi),Or.yFn(Gi)).call(o.font,{family:Gi.font,size:Gi.fontSize,color:Gi.fontColor,weight:Gi.fontWeight,style:Gi.fontStyle,variant:Gi.fontVariant,textcase:Gi.fontTextcase,lineposition:Gi.fontLineposition,shadow:Gi.fontShadow}).text(Gi.text).call(r.convertToTspans,ve),ve._promises[yi]?Gr.push(ve._promises.pop().then(function(){ln(uo,pe)})):ln(uo,pe)}),ia(ge,[N]),xr.exit().remove(),dr.repositionOnUpdate&&xr.each(function(Gi){u.select(this).select("text").call(r.positionText,Or.xFn(Gi),Or.yFn(Gi))});function ln(Gi,uo){Gi.each(function(yi){var ao=u.select(this),ts=ao.select(".text-math-group"),vs=Or.anchorFn(yi,uo),As=dr.transFn.call(ao.node(),yi)+(d(uo)&&+uo!=0?" rotate("+uo+","+Or.xFn(yi)+","+(Or.yFn(yi)-yi.fontSize/2)+")":""),_o=r.lineCount(ao),Da=et*yi.fontSize,li=Or.heightFn(yi,d(uo)?+uo:0,(_o-1)*Da);if(li&&(As+=e(0,li)),ts.empty()){var wo=ao.select("text");wo.attr({transform:As,"text-anchor":vs}),wo.style("display",null),ge._adjustTickLabelsOverflow&&ge._adjustTickLabelsOverflow()}else{var Ms=o.bBox(ts.node()).width,Di=Ms*{end:-.5,start:.5}[vs];ts.attr("transform",As+e(Di,0))}})}ge._adjustTickLabelsOverflow=function(){var Gi=ge.ticklabeloverflow;if(!(!Gi||Gi==="allow")){var uo=Gi.indexOf("hide")!==-1,yi=ge._id.charAt(0)==="x",ao=0,ts=yi?ve._fullLayout.width:ve._fullLayout.height;if(Gi.indexOf("domain")!==-1){var vs=t.simpleMap(ge.range,ge.r2l);ao=ge.l2p(vs[0])+ge._offset,ts=ge.l2p(vs[1])+ge._offset}var As=Math.min(ao,ts),_o=Math.max(ao,ts),Da=ge.side,li=1/0,wo=-1/0;xr.each(function(No){var is=u.select(this),al=is.select(".text-math-group");if(al.empty()){var ii=o.bBox(is.node()),io=0;yi?(ii.right>_o||ii.left_o||ii.top+(ge.tickangle?0:No.fontSize/4)ge["_visibleLabelMin_"+vs._id]?is.style("display","none"):_o.K==="tick"&&!As&&is.node().style.display!=="none"&&is.style("display",null)})})})})},ln(xr,Ke+1?Ke:pe);function wn(){return Gr.length&&Promise.all(Gr)}var rn=null;function Qr(){if(ln(xr,pe),Ur.length&&ge.autotickangles&&(ge.type!=="log"||String(ge.dtick).charAt(0)!=="D")){rn=ge.autotickangles[0];var Gi=0,uo=[],yi,ao=1;xr.each(function(us){Gi=Math.max(Gi,us.fontSize);var Ss=ge.l2p(us.x),Ls=Re(this),xl=o.bBox(Ls.node());ao=Math.max(ao,r.lineCount(Ls)),uo.push({top:0,bottom:10,height:10,left:Ss-xl.width/2,right:Ss+xl.width/2+2,width:xl.width+2})});var ts=(ge.tickson==="boundaries"||ge.showdividers)&&!dr.secondary,vs=Ur.length,As=Math.abs((Ur[vs-1].x-Ur[0].x)*ge._m)/(vs-1),_o=ts?As/2:As,Da=ts?ge.ticklen:Gi*1.25*ao,li=Math.sqrt(Math.pow(_o,2)+Math.pow(Da,2)),wo=_o/li,Ms=ge.autotickangles.map(function(us){return us*Math.PI/180}),Di=Ms.find(function(us){return Math.abs(Math.cos(us))<=wo});Di===void 0&&(Di=Ms.reduce(function(us,Ss){return Math.abs(Math.cos(us))qo*qi&&(Ho=qi,Ra[Ti]=Qi[Ti]=Ci[Ti])}var Po=Math.abs(Ho-Hi);Po-Ja>0?(Po-=Ja,Ja*=1+Ja/Po):Ja=0,ge._id.charAt(0)!=="y"&&(Ja=-Ja),Ra[ci]=Qn.p2r(Qn.r2p(Qi[ci])+wi*Ja),Qn.autorange==="min"||Qn.autorange==="max reversed"?(Ra[0]=null,Qn._rangeInitial0=void 0,Qn._rangeInitial1=void 0):(Qn.autorange==="max"||Qn.autorange==="min reversed")&&(Ra[1]=null,Qn._rangeInitial0=void 0,Qn._rangeInitial1=void 0),br._insideTickLabelsUpdaterange[Qn._name+".range"]=Ra}var hs=t.syncOrAsync(vn);return hs&&hs.then&&ve._promises.push(hs),hs};function Zn(ve,ge,dr){var br=ge._id+"divider",Tr=dr.vals,mr=dr.layer.selectAll("path."+br).data(Tr,bn);mr.exit().remove(),mr.enter().insert("path",":first-child").classed(br,1).classed("crisp",1).call(n.stroke,ge.dividercolor).style("stroke-width",o.crispRound(ve,ge.dividerwidth,1)+"px"),mr.attr("transform",dr.transFn).attr("d",dr.path)}X.getPxPosition=function(ve,ge){var dr=ve._fullLayout._size,br=ge._id.charAt(0),Tr=ge.side,mr;if(ge.anchor!=="free"?mr=ge._anchorAxis:br==="x"?mr={_offset:dr.t+(1-(ge.position||0))*dr.h,_length:0}:br==="y"&&(mr={_offset:dr.l+(ge.position||0)*dr.w+ge._shift,_length:0}),Tr==="top"||Tr==="left")return mr._offset;if(Tr==="bottom"||Tr==="right")return mr._offset+mr._length};function En(ve){var ge=ve.title.font.size,dr=(ve.title.text.match(r.BR_TAG_ALL)||[]).length;return ve.title.hasOwnProperty("standoff")?ge*(st+dr*et):dr?ge*(dr+1)*et:ge}function gn(ve,ge){var dr=ve._fullLayout,br=ge._id,Tr=br.charAt(0),mr=ge.title.font.size,kr,Ur=(ge.title.text.match(r.BR_TAG_ALL)||[]).length;if(ge.title.hasOwnProperty("standoff"))ge.side==="bottom"||ge.side==="right"?kr=ge._depth+ge.title.standoff+mr*st:(ge.side==="top"||ge.side==="left")&&(kr=ge._depth+ge.title.standoff+mr*(ct+Ur*et));else{var Or=$n(ge);if(ge.type==="multicategory")kr=ge._depth;else{var pe=1.5*mr;Or&&(pe=.5*mr,ge.ticks==="outside"&&(pe+=ge.ticklen)),kr=10+pe+(ge.linewidth?ge.linewidth-1:0)}Or||(Tr==="x"?kr+=ge.side==="top"?mr*(ge.showticklabels?1:0):mr*(ge.showticklabels?1.5:.5):kr+=ge.side==="right"?mr*(ge.showticklabels?1:.5):mr*(ge.showticklabels?.5:0))}var Ke=X.getPxPosition(ve,ge),xr,Gr,ln;Tr==="x"?(Gr=ge._offset+ge._length/2,ln=ge.side==="top"?Ke-kr:Ke+kr):(ln=ge._offset+ge._length/2,Gr=ge.side==="right"?Ke+kr:Ke-kr,xr={rotate:"-90",offset:0});var wn;if(ge.type!=="multicategory"){var rn=ge._selections[ge._id+"tick"];if(wn={selection:rn,side:ge.side},rn&&rn.node()&&rn.node().parentNode){var Qr=o.getTranslate(rn.node().parentNode);wn.offsetLeft=Qr.x,wn.offsetTop=Qr.y}ge.title.hasOwnProperty("standoff")&&(wn.pad=0)}return ge._titleStandoff=kr,i.draw(ve,br+"title",{propContainer:ge,propName:ge._name+".title.text",placeholder:dr._dfltTitle[Tr],avoid:wn,transform:xr,attributes:{x:Gr,y:ln,"text-anchor":"middle"}})}X.shouldShowZeroLine=function(ve,ge,dr){var br=t.simpleMap(ge.range,ge.r2l);return br[0]*br[1]<=0&&ge.zeroline&&(ge.type==="linear"||ge.type==="-")&&!(ge.rangebreaks&&ge.maskBreaks(0)===B)&&(da(ge,0)||!ra(ve,ge,dr,br)||Se(ve,ge))},X.clipEnds=function(ve,ge){return ge.filter(function(dr){return da(ve,dr.x)})};function da(ve,ge){var dr=ve.l2p(ge);return dr>1&&dr1)for(Tr=1;Tr=Tr.min&&ve=z:/%L/.test(ge)?ve>=P:/%[SX]/.test(ge)?ve>=_:/%M/.test(ge)?ve>=b:/%[HI]/.test(ge)?ve>=h:/%p/.test(ge)?ve>=c:/%[Aadejuwx]/.test(ge)?ve>=T:/%[UVW]/.test(ge)?ve>=M:/%[Bbm]/.test(ge)?ve>=k:/%[q]/.test(ge)?ve>=x:/%[Yy]/.test(ge)?ve>=m:!0}}),gb=Vt((K,V)=>{V.exports=function(u,d,E){var A,t;if(E){var e=d==="reversed"||d==="min reversed"||d==="max reversed";A=E[e?1:0],t=E[e?0:1]}var r=u("autorangeoptions.minallowed",t===null?A:void 0),i=u("autorangeoptions.maxallowed",A===null?t:void 0);r===void 0&&u("autorangeoptions.clipmin"),i===void 0&&u("autorangeoptions.clipmax"),u("autorangeoptions.include")}}),vb=Vt((K,V)=>{var u=gb();V.exports=function(d,E,A,t){var e=E._template||{},r=E.type||e.type||"-";A("minallowed"),A("maxallowed");var i=A("range");if(!i){var n;!t.noInsiderange&&r!=="log"&&(n=A("insiderange"),n&&(n[0]===null||n[1]===null)&&(E.insiderange=!1,n=void 0),n&&(i=A("range",n)))}var o=E.getAutorangeDflt(i,t),a=A("autorange",o),s;i&&(i[0]===null&&i[1]===null||(i[0]===null||i[1]===null)&&(a==="reversed"||a===!0)||i[0]!==null&&(a==="min"||a==="max reversed")||i[1]!==null&&(a==="max"||a==="min reversed"))&&(i=void 0,delete E.range,E.autorange=!0,s=!0),s||(o=E.getAutorangeDflt(i,t),a=A("autorange",o)),a&&(u(A,a,i),(r==="linear"||r==="-")&&A("rangemode")),E.cleanRange()}}),XT=Vt((K,V)=>{var u={left:0,top:0};V.exports=d;function d(A,t,e){t=t||A.currentTarget||A.srcElement,Array.isArray(e)||(e=[0,0]);var r=A.clientX||0,i=A.clientY||0,n=E(t);return e[0]=r-n.left,e[1]=i-n.top,e}function E(A){return A===window||A===document||A===document.body?u:A.getBoundingClientRect()}}),Gy=Vt((K,V)=>{var u=lb();function d(){var E=!1;try{var A=Object.defineProperty({},"passive",{get:function(){E=!0}});window.addEventListener("test",null,A),window.removeEventListener("test",null,A)}catch{E=!1}return E}V.exports=u&&d()}),$T=Vt((K,V)=>{V.exports=function(u,d,E,A,t){var e=(u-E)/(A-E),r=e+d/(A-E),i=(e+r)/2;return t==="left"||t==="bottom"?e:t==="center"||t==="middle"?i:t==="right"||t==="top"?r:e<2/3-i?e:r>4/3-i?r:i}}),JT=Vt((K,V)=>{var u=Xr(),d=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];V.exports=function(E,A,t,e){return t==="left"?E=0:t==="center"?E=1:t==="right"?E=2:E=u.constrain(Math.floor(E*3),0,2),e==="bottom"?A=0:e==="middle"?A=1:e==="top"?A=2:A=u.constrain(Math.floor(A*3),0,2),d[A][E]}}),QT=Vt((K,V)=>{var u=_m(),d=Hy(),E=Fg().getGraphDiv,A=Dg(),t=V.exports={};t.wrapped=function(e,r,i){e=E(e),e._fullLayout&&d.clear(e._fullLayout._uid+A.HOVERID),t.raw(e,r,i)},t.raw=function(e,r){var i=e._fullLayout,n=e._hoverdata;r||(r={}),!(r.target&&!e._dragged&&u.triggerHandler(e,"plotly_beforehover",r)===!1)&&(i._hoverlayer.selectAll("g").remove(),i._hoverlayer.selectAll("line").remove(),i._hoverlayer.selectAll("circle").remove(),e._hoverdata=void 0,r.target&&n&&e.emit("plotly_unhover",{event:r,points:n}))}}),oh=Vt((K,V)=>{var u=XT(),d=ub(),E=Gy(),A=Xr().removeElement,t=Mf(),e=V.exports={};e.align=$T(),e.getCursor=JT();var r=QT();e.unhover=r.wrapped,e.unhoverRaw=r.raw,e.init=function(o){var a=o.gd,s=1,f=a._context.doubleClickDelay,v=o.element,g,m,w,l,x,y,S,k;a._mouseDownTime||(a._mouseDownTime=0),v.style.pointerEvents="all",v.onmousedown=c,E?(v._ontouchstart&&v.removeEventListener("touchstart",v._ontouchstart),v._ontouchstart=c,v.addEventListener("touchstart",c,{passive:!1})):v.ontouchstart=c;function M(_,P,z){return Math.abs(_)"u"&&typeof _.clientY>"u"&&(_.clientX=g,_.clientY=m),w=new Date().getTime(),w-a._mouseDownTimef&&(s=Math.max(s-1,1)),a._dragged)o.doneFn&&o.doneFn();else{var P;y.target===S?P=y:(P={target:S,srcElement:S,toElement:S},Object.keys(y).concat(Object.keys(y.__proto__)).forEach(z=>{var D=y[z];!P[z]&&typeof D!="function"&&(P[z]=D)})),o.clickFn&&o.clickFn(s,P),k||S.dispatchEvent(new MouseEvent("click",_))}a._dragging=!1,a._dragged=!1}};function i(){var o=document.createElement("div");o.className="dragcover";var a=o.style;return a.position="fixed",a.left=0,a.right=0,a.top=0,a.bottom=0,a.zIndex=999999999,a.background="none",document.body.appendChild(o),o}e.coverSlip=i;function n(o){return u(o.changedTouches?o.changedTouches[0]:o,document.body)}}),Xh=Vt((K,V)=>{V.exports=function(u,d){(u.attr("class")||"").split(" ").forEach(function(E){E.indexOf("cursor-")===0&&u.classed(E,!1)}),d&&u.classed("cursor-"+d,!0)}}),tk=Vt((K,V)=>{var u=Xh(),d="data-savedcursor",E="!!";V.exports=function(A,t){var e=A.attr(d);if(t){if(!e){for(var r=(A.attr("class")||"").split(" "),i=0;i{var u=yu(),d=af();V.exports={_isSubplotObj:!0,visible:{valType:"boolean",dflt:!0,editType:"legend"},bgcolor:{valType:"color",editType:"legend"},bordercolor:{valType:"color",dflt:d.defaultLine,editType:"legend"},maxheight:{valType:"number",min:0,editType:"legend"},borderwidth:{valType:"number",min:0,dflt:0,editType:"legend"},font:u({editType:"legend"}),grouptitlefont:u({editType:"legend"}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v",editType:"legend"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"],editType:"legend"},tracegroupgap:{valType:"number",min:0,dflt:10,editType:"legend"},entrywidth:{valType:"number",min:0,editType:"legend"},entrywidthmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"pixels",editType:"legend"},indentation:{valType:"number",min:-15,dflt:0,editType:"legend"},itemsizing:{valType:"enumerated",values:["trace","constant"],dflt:"trace",editType:"legend"},itemwidth:{valType:"number",min:30,dflt:30,editType:"legend"},itemclick:{valType:"enumerated",values:["toggle","toggleothers",!1],dflt:"toggle",editType:"legend"},itemdoubleclick:{valType:"enumerated",values:["toggle","toggleothers",!1],dflt:"toggleothers",editType:"legend"},groupclick:{valType:"enumerated",values:["toggleitem","togglegroup"],dflt:"togglegroup",editType:"legend"},x:{valType:"number",editType:"legend"},xref:{valType:"enumerated",dflt:"paper",values:["container","paper"],editType:"layoutstyle"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left",editType:"legend"},y:{valType:"number",editType:"legend"},yref:{valType:"enumerated",dflt:"paper",values:["container","paper"],editType:"layoutstyle"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],editType:"legend"},uirevision:{valType:"any",editType:"none"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle",editType:"legend"},title:{text:{valType:"string",dflt:"",editType:"legend"},font:u({editType:"legend"}),side:{valType:"enumerated",values:["top","left","top left","top center","top right"],editType:"legend"},editType:"legend"},editType:"legend"}}),Zy=Vt(K=>{K.isGrouped=function(V){return(V.traceorder||"").indexOf("grouped")!==-1},K.isVertical=function(V){return V.orientation!=="h"},K.isReversed=function(V){return(V.traceorder||"").indexOf("reversed")!==-1}}),xb=Vt((K,V)=>{var u=ji(),d=Xr(),E=cl(),A=kl(),t=yb(),e=xm(),r=Zy();function i(n,o,a,s){var f=o[n]||{},v=E.newContainer(a,n);function g(Z,ot){return d.coerce(f,v,t,Z,ot)}var m=d.coerceFont(g,"font",a.font);g("bgcolor",a.paper_bgcolor),g("bordercolor");var w=g("visible");if(!w)return;var l,x=function(Z,ot){var X=l._input,Q=l;return d.coerce(X,Q,A,Z,ot)},y=a.font||{},S=d.coerceFont(g,"grouptitlefont",y,{overrideDflt:{size:Math.round(y.size*1.1)}}),k=0,M=!1,T="normal",c=(a.shapes||[]).filter(function(Z){return Z.showlegend});function h(Z){return u.traceIs(Z,"pie-like")&&Z._length!=null&&(Array.isArray(Z.legend)||Array.isArray(Z.showlegend))}s.filter(h).forEach(function(Z){Z.visible&&k++;for(var ot=0;otZ.legend.length)for(var Q=Z.legend.length;Q(n==="legend"?1:0));if(z===!1&&(a[n]=void 0),!(z===!1&&!f.uirevision)&&(g("uirevision",a.uirevision),z!==!1)){g("borderwidth");var D=g("orientation"),B=g("yref"),R=g("xref"),I=D==="h",F=B==="paper",j=R==="paper",N,G,rt,ct="left";I?(N=0,u.getComponentMethod("rangeslider","isVisible")(o.xaxis)?F?(G=1.1,rt="bottom"):(G=1,rt="top"):F?(G=-.1,rt="top"):(G=0,rt="bottom")):(G=1,rt="auto",j?N=1.02:(N=1,ct="right")),d.coerce(f,v,{x:{valType:"number",editType:"legend",min:j?-2:0,max:j?3:1,dflt:N}},"x"),d.coerce(f,v,{y:{valType:"number",editType:"legend",min:F?-2:0,max:F?3:1,dflt:G}},"y"),g("traceorder",T),r.isGrouped(a[n])&&g("tracegroupgap"),g("entrywidth"),g("entrywidthmode"),g("indentation"),g("itemsizing"),g("itemwidth"),g("itemclick"),g("itemdoubleclick"),g("groupclick"),g("xanchor",ct),g("yanchor",rt),g("maxheight"),g("valign"),d.noneOrAll(f,v,["x","y"]);var st=g("title.text");if(st){g("title.side",I?"left":"top");var et=d.extendFlat({},m,{size:d.bigFont(m.size)});d.coerceFont(g,"title.font",et)}}}V.exports=function(n,o,a){var s,f=a.slice(),v=o.shapes;if(v)for(s=0;s{var u=ji(),d=Xr(),E=d.pushUnique,A=!0;V.exports=function(t,e,r){var i=e._fullLayout;if(e._dragged||e._editing)return;var n=i.legend.itemclick,o=i.legend.itemdoubleclick,a=i.legend.groupclick;r===1&&n==="toggle"&&o==="toggleothers"&&A&&e.data&&e._context.showTips&&d.notifier(d._(e,"Double-click on legend to isolate one trace"),"long"),A=!1;var s;if(r===1?s=n:r===2&&(s=o),!s)return;var f=a==="togglegroup",v=i.hiddenlabels?i.hiddenlabels.slice():[],g=t.data()[0][0];if(g.groupTitle&&g.noClick)return;var m=e._fullData,w=(i.shapes||[]).filter(function(Zt){return Zt.showlegend}),l=m.concat(w),x=g.trace;x._isShape&&(x=x._fullInput);var y=x.legendgroup,S,k,M,T,c,h,b={},_=[],P=[],z=[];function D(Zt,mt){var bt=_.indexOf(Zt),vt=b.visible;return vt||(vt=b.visible=[]),_.indexOf(Zt)===-1&&(_.push(Zt),bt=_.length-1),vt[bt]=mt,bt}var B=(i.shapes||[]).map(function(Zt){return Zt._input}),R=!1;function I(Zt,mt){B[Zt].visible=mt,R=!0}function F(Zt,mt){if(!(g.groupTitle&&!f)){var bt=Zt._fullInput||Zt,vt=bt._isShape,Ut=bt.index;Ut===void 0&&(Ut=bt._index);var re=bt.visible===!1?!1:mt;vt?I(Ut,re):D(Ut,re)}}var j=x.legend,N=x._fullInput,G=N&&N._isShape;if(!G&&u.traceIs(x,"pie-like")){var rt=g.label,ct=v.indexOf(rt);if(s==="toggle")ct===-1?v.push(rt):v.splice(ct,1);else if(s==="toggleothers"){var st=ct!==-1,et=[];for(S=0;S{V.exports={scrollBarWidth:6,scrollBarMinHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4,scrollBarEnterAttrs:{rx:20,ry:3,width:0,height:0},titlePad:2,itemGap:5}}),rk=Vt((K,V)=>{var u=ji(),d=Zy();V.exports=function(E,A,t){var e=A._inHover,r=d.isGrouped(A),i=d.isReversed(A),n={},o=[],a=!1,s={},f=0,v=0,g,m;function w(N,G,rt){if(A.visible!==!1&&!(t&&N!==A._id))if(G===""||!d.isGrouped(A)){var ct="~~i"+f;o.push(ct),n[ct]=[rt],f++}else o.indexOf(G)===-1?(o.push(G),a=!0,n[G]=[rt]):n[G].push(rt)}for(g=0;gz&&(P=z)}b[g][0]._groupMinRank=P,b[g][0]._preGroupSort=g}var D=function(N,G){return N[0]._groupMinRank-G[0]._groupMinRank||N[0]._preGroupSort-G[0]._preGroupSort},B=function(N,G){return N.trace.legendrank-G.trace.legendrank||N._preSort-G._preSort};for(b.forEach(function(N,G){N[0]._preGroupSort=G}),b.sort(D),g=0;g{var V=Xr();function u(d){return d.indexOf("e")!==-1?d.replace(/[.]?0+e/,"e"):d.indexOf(".")!==-1?d.replace(/[.]?0+$/,""):d}K.formatPiePercent=function(d,E){var A=u((d*100).toPrecision(3));return V.numSeparate(A,E)+"%"},K.formatPieValue=function(d,E){var A=u(d.toPrecision(10));return V.numSeparate(A,E)},K.getFirstFilled=function(d,E){if(V.isArrayOrTypedArray(d))for(var A=0;A{var u=Eo(),d=Pi();V.exports=function(E,A,t,e){var r=t.marker.pattern;r&&r.shape?u.pointStyle(E,t,e,A):d.fill(E,A.color)}}),Am=Vt((K,V)=>{var u=Pi(),d=Sd().castOption,E=nk();V.exports=function(A,t,e,r){var i=e.marker.line,n=d(i.color,t.pts)||u.defaultLine,o=d(i.width,t.pts)||0;A.call(E,t,e,r).style("stroke-width",o).call(u.stroke,n)}}),bb=Vt((K,V)=>{var u=Ni(),d=ji(),E=Xr(),A=E.strTranslate,t=Eo(),e=Pi(),r=ah().extractOpts,i=nu(),n=Am(),o=Sd().castOption,a=_b(),s=12,f=5,v=2,g=10,m=5;V.exports=function(y,S,k){var M=S._fullLayout;k||(k=M.legend);var T=k.itemsizing==="constant",c=k.itemwidth,h=(c+a.itemGap*2)/2,b=A(h,0),_=function(et,Z,ot,X){var Q;if(et+1)Q=et;else if(Z&&Z.width>0)Q=Z.width;else return 0;return T?X:Math.min(Q,ot)};y.each(function(et){var Z=u.select(this),ot=E.ensureSingle(Z,"g","layers");ot.style("opacity",et[0].trace.opacity);var X=k.indentation,Q=k.valign,ut=et[0].lineHeight,J=et[0].height;if(Q==="middle"&&X===0||!ut||!J)ot.attr("transform",null);else{var q={top:1,bottom:-1}[Q],it=q*(.5*(ut-J+3))||0,nt=k.indentation;ot.attr("transform",A(nt,it))}var dt=ot.selectAll("g.legendfill").data([et]);dt.enter().append("g").classed("legendfill",!0);var Tt=ot.selectAll("g.legendlines").data([et]);Tt.enter().append("g").classed("legendlines",!0);var wt=ot.selectAll("g.legendsymbols").data([et]);wt.enter().append("g").classed("legendsymbols",!0),wt.selectAll("g.legendpoints").data([et]).enter().append("g").classed("legendpoints",!0)}).each(st).each(D).each(R).each(B).each(F).each(rt).each(G).each(P).each(z).each(j).each(N);function P(et){var Z=l(et),ot=Z.showFill,X=Z.showLine,Q=Z.showGradientLine,ut=Z.showGradientFill,J=Z.anyFill,q=Z.anyLine,it=et[0],nt=it.trace,dt,Tt,wt=r(nt),Ct=wt.colorscale,It=wt.reversescale,Nt=function(vt){if(vt.size())if(ot)t.fillGroupStyle(vt,S,!0);else{var Ut="legendfill-"+nt.uid;t.gradient(vt,S,Ut,w(It),Ct,"fill")}},te=function(vt){if(vt.size()){var Ut="legendline-"+nt.uid;t.lineGroupStyle(vt),t.gradient(vt,S,Ut,w(It),Ct,"stroke")}},Jt=i.hasMarkers(nt)||!J?"M5,0":q?"M5,-2":"M5,-3",ee=u.select(this),Zt=ee.select(".legendfill").selectAll("path").data(ot||ut?[et]:[]);if(Zt.enter().append("path").classed("js-fill",!0),Zt.exit().remove(),Zt.attr("d",Jt+"h"+c+"v6h-"+c+"z").call(Nt),X||Q){var mt=_(void 0,nt.line,g,f);Tt=E.minExtend(nt,{line:{width:mt}}),dt=[E.minExtend(it,{trace:Tt})]}var bt=ee.select(".legendlines").selectAll("path").data(X||Q?[dt]:[]);bt.enter().append("path").classed("js-line",!0),bt.exit().remove(),bt.attr("d",Jt+(Q?"l"+c+",0.0001":"h"+c)).call(X?t.lineGroupStyle:te)}function z(et){var Z=l(et),ot=Z.anyFill,X=Z.anyLine,Q=Z.showLine,ut=Z.showMarker,J=et[0],q=J.trace,it=!ut&&!X&&!ot&&i.hasText(q),nt,dt;function Tt(Zt,mt,bt,vt){var Ut=E.nestedProperty(q,Zt).get(),re=E.isArrayOrTypedArray(Ut)&&mt?mt(Ut):Ut;if(T&&re&&vt!==void 0&&(re=vt),bt){if(rebt[1])return bt[1]}return re}function wt(Zt){return J._distinct&&J.index&&Zt[J.index]?Zt[J.index]:Zt[0]}if(ut||it||Q){var Ct={},It={};if(ut){Ct.mc=Tt("marker.color",wt),Ct.mx=Tt("marker.symbol",wt),Ct.mo=Tt("marker.opacity",E.mean,[.2,1]),Ct.mlc=Tt("marker.line.color",wt),Ct.mlw=Tt("marker.line.width",E.mean,[0,5],v),It.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var Nt=Tt("marker.size",E.mean,[2,16],s);Ct.ms=Nt,It.marker.size=Nt}Q&&(It.line={width:Tt("line.width",wt,[0,10],f)}),it&&(Ct.tx="Aa",Ct.tp=Tt("textposition",wt),Ct.ts=10,Ct.tc=Tt("textfont.color",wt),Ct.tf=Tt("textfont.family",wt),Ct.tw=Tt("textfont.weight",wt),Ct.ty=Tt("textfont.style",wt),Ct.tv=Tt("textfont.variant",wt),Ct.tC=Tt("textfont.textcase",wt),Ct.tE=Tt("textfont.lineposition",wt),Ct.tS=Tt("textfont.shadow",wt)),nt=[E.minExtend(J,Ct)],dt=E.minExtend(q,It),dt.selectedpoints=null,dt.texttemplate=null}var te=u.select(this).select("g.legendpoints"),Jt=te.selectAll("path.scatterpts").data(ut?nt:[]);Jt.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform",b),Jt.exit().remove(),Jt.call(t.pointStyle,dt,S),ut&&(nt[0].mrc=3);var ee=te.selectAll("g.pointtext").data(it?nt:[]);ee.enter().append("g").classed("pointtext",!0).append("text").attr("transform",b),ee.exit().remove(),ee.selectAll("text").call(t.textPointStyle,dt,S)}function D(et){var Z=et[0].trace,ot=Z.type==="waterfall";if(et[0]._distinct&&ot){var X=et[0].trace[et[0].dir].marker;return et[0].mc=X.color,et[0].mlw=X.line.width,et[0].mlc=X.line.color,I(et,this,"waterfall")}var Q=[];Z.visible&&ot&&(Q=et[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var ut=u.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(Q);ut.enter().append("path").classed("legendwaterfall",!0).attr("transform",b).style("stroke-miterlimit",1),ut.exit().remove(),ut.each(function(J){var q=u.select(this),it=Z[J[0]].marker,nt=_(void 0,it.line,m,v);q.attr("d",J[1]).style("stroke-width",nt+"px").call(e.fill,it.color),nt&&q.call(e.stroke,it.line.color)})}function B(et){I(et,this)}function R(et){I(et,this,"funnel")}function I(et,Z,ot){var X=et[0].trace,Q=X.marker||{},ut=Q.line||{},J=Q.cornerradius?"M6,3a3,3,0,0,1-3,3H-3a3,3,0,0,1-3-3V-3a3,3,0,0,1,3-3H3a3,3,0,0,1,3,3Z":"M6,6H-6V-6H6Z",q=ot?X.visible&&X.type===ot:d.traceIs(X,"bar"),it=u.select(Z).select("g.legendpoints").selectAll("path.legend"+ot).data(q?[et]:[]);it.enter().append("path").classed("legend"+ot,!0).attr("d",J).attr("transform",b),it.exit().remove(),it.each(function(nt){var dt=u.select(this),Tt=nt[0],wt=_(Tt.mlw,Q.line,m,v);dt.style("stroke-width",wt+"px");var Ct=Tt.mcc;if(!k._inHover&&"mc"in Tt){var It=r(Q),Nt=It.mid;Nt===void 0&&(Nt=(It.max+It.min)/2),Ct=t.tryColorscale(Q,"")(Nt)}var te=Ct||Tt.mc||Q.color,Jt=Q.pattern,ee=t.getPatternAttr,Zt=Jt&&(ee(Jt.shape,0,"")||ee(Jt.path,0,""));if(Zt){var mt=ee(Jt.bgcolor,0,null),bt=ee(Jt.fgcolor,0,null),vt=Jt.fgopacity,Ut=x(Jt.size,8,10),re=x(Jt.solidity,.5,1),Kt="legend-"+X.uid;dt.call(t.pattern,"legend",S,Kt,Zt,Ut,re,Ct,Jt.fillmode,mt,bt,vt)}else dt.call(e.fill,te);wt&&e.stroke(dt,Tt.mlc||ut.color)})}function F(et){var Z=et[0].trace,ot=u.select(this).select("g.legendpoints").selectAll("path.legendbox").data(Z.visible&&d.traceIs(Z,"box-violin")?[et]:[]);ot.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform",b),ot.exit().remove(),ot.each(function(){var X=u.select(this);if((Z.boxpoints==="all"||Z.points==="all")&&e.opacity(Z.fillcolor)===0&&e.opacity((Z.line||{}).color)===0){var Q=E.minExtend(Z,{marker:{size:T?s:E.constrain(Z.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});ot.call(t.pointStyle,Q,S)}else{var ut=_(void 0,Z.line,m,v);X.style("stroke-width",ut+"px").call(e.fill,Z.fillcolor),ut&&e.stroke(X,Z.line.color)}})}function j(et){var Z=et[0].trace,ot=u.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(Z.visible&&Z.type==="candlestick"?[et,et]:[]);ot.enter().append("path").classed("legendcandle",!0).attr("d",function(X,Q){return Q?"M-15,0H-8M-8,6V-6H8Z":"M15,0H8M8,-6V6H-8Z"}).attr("transform",b).style("stroke-miterlimit",1),ot.exit().remove(),ot.each(function(X,Q){var ut=u.select(this),J=Z[Q?"increasing":"decreasing"],q=_(void 0,J.line,m,v);ut.style("stroke-width",q+"px").call(e.fill,J.fillcolor),q&&e.stroke(ut,J.line.color)})}function N(et){var Z=et[0].trace,ot=u.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(Z.visible&&Z.type==="ohlc"?[et,et]:[]);ot.enter().append("path").classed("legendohlc",!0).attr("d",function(X,Q){return Q?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"}).attr("transform",b).style("stroke-miterlimit",1),ot.exit().remove(),ot.each(function(X,Q){var ut=u.select(this),J=Z[Q?"increasing":"decreasing"],q=_(void 0,J.line,m,v);ut.style("fill","none").call(t.dashLine,J.line.dash,q),q&&e.stroke(ut,J.line.color)})}function G(et){ct(et,this,"pie")}function rt(et){ct(et,this,"funnelarea")}function ct(et,Z,ot){var X=et[0],Q=X.trace,ut=ot?Q.visible&&Q.type===ot:d.traceIs(Q,ot),J=u.select(Z).select("g.legendpoints").selectAll("path.legend"+ot).data(ut?[et]:[]);if(J.enter().append("path").classed("legend"+ot,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",b),J.exit().remove(),J.size()){var q=Q.marker||{},it=_(o(q.line.width,X.pts),q.line,m,v),nt="pieLike",dt=E.minExtend(Q,{marker:{line:{width:it}}},nt),Tt=E.minExtend(X,{trace:dt},nt);n(J,Tt,dt,S)}}function st(et){var Z=et[0].trace,ot,X=[];if(Z.visible)switch(Z.type){case"histogram2d":case"heatmap":X=[["M-15,-2V4H15V-2Z"]],ot=!0;break;case"choropleth":case"choroplethmapbox":case"choroplethmap":X=[["M-6,-6V6H6V-6Z"]],ot=!0;break;case"densitymapbox":case"densitymap":X=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],ot="radial";break;case"cone":X=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],ot=!1;break;case"streamtube":X=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],ot=!1;break;case"surface":X=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],ot=!0;break;case"mesh3d":X=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],ot=!1;break;case"volume":X=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],ot=!0;break;case"isosurface":X=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],ot=!1;break}var Q=u.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(X);Q.enter().append("path").classed("legend3dandfriends",!0).attr("transform",b).style("stroke-miterlimit",1),Q.exit().remove(),Q.each(function(ut,J){var q=u.select(this),it=r(Z),nt=it.colorscale,dt=it.reversescale,Tt=function(Nt){if(Nt.size()){var te="legendfill-"+Z.uid;t.gradient(Nt,S,te,w(dt,ot==="radial"),nt,"fill")}},wt;if(nt){if(!ot){var Ct=nt.length;wt=J===0?nt[dt?Ct-1:0][1]:J===1?nt[dt?0:Ct-1][1]:nt[Math.floor((Ct-1)/2)][1]}}else{var It=Z.vertexcolor||Z.facecolor||Z.color;wt=E.isArrayOrTypedArray(It)?It[J]||It[0]:It}q.attr("d",ut[0]),wt?q.call(e.fill,wt):q.call(Tt)})}};function w(y,S){var k=S?"radial":"horizontal";return k+(y?"":"reversed")}function l(y){var S=y[0].trace,k=S.contours,M=i.hasLines(S),T=i.hasMarkers(S),c=S.visible&&S.fill&&S.fill!=="none",h=!1,b=!1;if(k){var _=k.coloring;_==="lines"?h=!0:M=_==="none"||_==="heatmap"||k.showlines,k.type==="constraint"?c=k._operation!=="=":(_==="fill"||_==="heatmap")&&(b=!0)}return{showMarker:T,showLine:M,showFill:c,showGradientLine:h,showGradientFill:b,anyLine:M||h,anyFill:c||b}}function x(y,S,k){return y&&E.isArrayOrTypedArray(y)?S:y>k?k:y}}),wb=Vt((K,V)=>{var u=Ni(),d=Xr(),E=Vu(),A=ji(),t=_m(),e=oh(),r=Eo(),i=Pi(),n=Dl(),o=ek(),a=_b(),s=gf(),f=s.LINE_SPACING,v=s.FROM_TL,g=s.FROM_BR,m=rk(),w=bb(),l=Zy(),x=1,y=/^legend[0-9]*$/;V.exports=function(j,N){if(N)k(j,N);else{var G=j._fullLayout,rt=G._legends,ct=G._infolayer.selectAll('[class^="legend"]');ct.each(function(){var ot=u.select(this),X=ot.attr("class"),Q=X.split(" ")[0];Q.match(y)&&rt.indexOf(Q)===-1&&ot.remove()});for(var st=0;st1)}var it=rt.hiddenlabels||[];if(!Z&&(!rt.showlegend||!ot.length))return et.selectAll("."+ct).remove(),rt._topdefs.select("#"+st).remove(),E.autoMargin(j,ct);var nt=d.ensureSingle(et,"g",ct,function(ee){Z||ee.attr("pointer-events","all")}),dt=d.ensureSingleById(rt._topdefs,"clipPath",st,function(ee){ee.append("rect")}),Tt=d.ensureSingle(nt,"rect","bg",function(ee){ee.attr("shape-rendering","crispEdges")});Tt.call(i.stroke,G.bordercolor).call(i.fill,G.bgcolor).style("stroke-width",G.borderwidth+"px");var wt=d.ensureSingle(nt,"g","scrollbox"),Ct=G.title;G._titleWidth=0,G._titleHeight=0;var It;Ct.text?(It=d.ensureSingle(wt,"text",ct+"titletext"),It.attr("text-anchor","start").call(r.font,Ct.font).text(Ct.text),_(It,wt,j,G,x)):wt.selectAll("."+ct+"titletext").remove();var Nt=d.ensureSingle(nt,"rect","scrollbar",function(ee){ee.attr(a.scrollBarEnterAttrs).call(i.fill,a.scrollBarColor)}),te=wt.selectAll("g.groups").data(ot);te.enter().append("g").attr("class","groups"),te.exit().remove();var Jt=te.selectAll("g.traces").data(d.identity);Jt.enter().append("g").attr("class","traces"),Jt.exit().remove(),Jt.style("opacity",function(ee){var Zt=ee[0].trace;return A.traceIs(Zt,"pie-like")?it.indexOf(ee[0].label)!==-1?.5:1:Zt.visible==="legendonly"?.5:1}).each(function(){u.select(this).call(c,j,G)}).call(w,j,G).each(function(){Z||u.select(this).call(b,j,ct)}),d.syncOrAsync([E.previousPromises,function(){return D(j,te,Jt,G)},function(){var ee=rt._size,Zt=G.borderwidth,mt=G.xref==="paper",bt=G.yref==="paper";if(Ct.text&&S(It,G,Zt),!Z){var vt,Ut;mt?vt=ee.l+ee.w*G.x-v[R(G)]*G._width:vt=rt.width*G.x-v[R(G)]*G._width,bt?Ut=ee.t+ee.h*(1-G.y)-v[I(G)]*G._effHeight:Ut=rt.height*(1-G.y)-v[I(G)]*G._effHeight;var re=B(j,ct,vt,Ut);if(re)return;if(rt.margin.autoexpand){var Kt=vt,ue=Ut;vt=mt?d.constrain(vt,0,rt.width-G._width):Kt,Ut=bt?d.constrain(Ut,0,rt.height-G._effHeight):ue,vt!==Kt&&d.log("Constrain "+ct+".x to make legend fit inside graph"),Ut!==ue&&d.log("Constrain "+ct+".y to make legend fit inside graph")}r.setTranslate(nt,vt,Ut)}if(Nt.on(".drag",null),nt.on("wheel",null),Z||G._height<=G._maxHeight||j._context.staticPlot){var Me=G._effHeight;Z&&(Me=G._height),Tt.attr({width:G._width-Zt,height:Me-Zt,x:Zt/2,y:Zt/2}),r.setTranslate(wt,0,0),dt.select("rect").attr({width:G._width-2*Zt,height:Me-2*Zt,x:Zt,y:Zt}),r.setClipUrl(wt,st,j),r.setRect(Nt,0,0,0,0),delete G._scrollY}else{var Ce=Math.max(a.scrollBarMinHeight,G._effHeight*G._effHeight/G._height),We=G._effHeight-Ce-2*a.scrollBarMargin,qe=G._height-G._effHeight,vr=We/qe,_r=Math.min(G._scrollY||0,qe);Tt.attr({width:G._width-2*Zt+a.scrollBarWidth+a.scrollBarMargin,height:G._effHeight-Zt,x:Zt/2,y:Zt/2}),dt.select("rect").attr({width:G._width-2*Zt+a.scrollBarWidth+a.scrollBarMargin,height:G._effHeight-2*Zt,x:Zt,y:Zt+_r}),r.setClipUrl(wt,st,j),lt(_r,Ce,vr),nt.on("wheel",function(){_r=d.constrain(G._scrollY+u.event.deltaY/qe*We,0,qe),lt(_r,Ce,vr),_r!==0&&_r!==qe&&u.event.preventDefault()});var er,Mr,Ir,de=function(se,ke,Ee){var Ue=(Ee-ke)/vr+se;return d.constrain(Ue,0,qe)},Dt=function(se,ke,Ee){var Ue=(ke-Ee)/vr+se;return d.constrain(Ue,0,qe)},qt=u.behavior.drag().on("dragstart",function(){var se=u.event.sourceEvent;se.type==="touchstart"?er=se.changedTouches[0].clientY:er=se.clientY,Ir=_r}).on("drag",function(){var se=u.event.sourceEvent;se.buttons===2||se.ctrlKey||(se.type==="touchmove"?Mr=se.changedTouches[0].clientY:Mr=se.clientY,_r=de(Ir,er,Mr),lt(_r,Ce,vr))});Nt.call(qt);var _t=u.behavior.drag().on("dragstart",function(){var se=u.event.sourceEvent;se.type==="touchstart"&&(er=se.changedTouches[0].clientY,Ir=_r)}).on("drag",function(){var se=u.event.sourceEvent;se.type==="touchmove"&&(Mr=se.changedTouches[0].clientY,_r=Dt(Ir,er,Mr),lt(_r,Ce,vr))});wt.call(_t)}function lt(se,ke,Ee){G._scrollY=j._fullLayout[ct]._scrollY=se,r.setTranslate(wt,0,-se),r.setRect(Nt,G._width,a.scrollBarMargin+se*Ee,a.scrollBarWidth,ke),dt.select("rect").attr("y",Zt+se)}if(j._context.edits.legendPosition){var yt,St,Ht,Yt;nt.classed("cursor-move",!0),e.init({element:nt.node(),gd:j,prepFn:function(se){if(se.target!==Nt.node()){var ke=r.getTranslate(nt);Ht=ke.x,Yt=ke.y}},moveFn:function(se,ke){if(Ht!==void 0&&Yt!==void 0){var Ee=Ht+se,Ue=Yt+ke;r.setTranslate(nt,Ee,Ue),yt=e.align(Ee,G._width,ee.l,ee.l+ee.w,G.xanchor),St=e.align(Ue+G._height,-G._height,ee.t+ee.h,ee.t,G.yanchor)}},doneFn:function(){if(yt!==void 0&&St!==void 0){var se={};se[ct+".x"]=yt,se[ct+".y"]=St,A.call("_guiRelayout",j,se)}},clickFn:function(se,ke){var Ee=et.selectAll("g.traces").filter(function(){var Ue=this.getBoundingClientRect();return ke.clientX>=Ue.left&&ke.clientX<=Ue.right&&ke.clientY>=Ue.top&&ke.clientY<=Ue.bottom});Ee.size()>0&&T(j,nt,Ee,se,ke)}})}}],j)}}function M(j,N,G){var rt=j[0],ct=rt.width,st=N.entrywidthmode,et=rt.trace.legendwidth||N.entrywidth;return st==="fraction"?N._maxWidth*et:G+(et||ct)}function T(j,N,G,rt,ct){var st=G.data()[0][0].trace,et={event:ct,node:G.node(),curveNumber:st.index,expandedIndex:st.index,data:j.data,layout:j.layout,frames:j._transitionData._frames,config:j._context,fullData:j._fullData,fullLayout:j._fullLayout};st._group&&(et.group=st._group),A.traceIs(st,"pie-like")&&(et.label=G.datum()[0].label);var Z=t.triggerHandler(j,"plotly_legendclick",et);if(rt===1){if(Z===!1)return;N._clickTimeout=setTimeout(function(){j._fullLayout&&o(G,j,rt)},j._context.doubleClickDelay)}else if(rt===2){N._clickTimeout&&clearTimeout(N._clickTimeout),j._legendMouseDownTime=0;var ot=t.triggerHandler(j,"plotly_legenddoubleclick",et);ot!==!1&&Z!==!1&&o(G,j,rt)}}function c(j,N,G){var rt=F(G),ct=j.data()[0][0],st=ct.trace,et=A.traceIs(st,"pie-like"),Z=!G._inHover&&N._context.edits.legendText&&!et,ot=G._maxNameLength,X,Q;ct.groupTitle?(X=ct.groupTitle.text,Q=ct.groupTitle.font):(Q=G.font,G.entries?X=ct.text:(X=et?ct.label:st.name,st._meta&&(X=d.templateString(X,st._meta))));var ut=d.ensureSingle(j,"text",rt+"text");ut.attr("text-anchor","start").call(r.font,Q).text(Z?h(X,ot):X);var J=G.indentation+G.itemwidth+a.itemGap*2;n.positionText(ut,J,0),Z?ut.call(n.makeEditable,{gd:N,text:X}).call(_,j,N,G).on("edit",function(q){this.text(h(q,ot)).call(_,j,N,G);var it=ct.trace._fullInput||{},nt={};return nt.name=q,it._isShape?A.call("_guiRelayout",N,"shapes["+st.index+"].name",nt.name):A.call("_guiRestyle",N,nt,st.index)}):_(ut,j,N,G)}function h(j,N){var G=Math.max(4,N);if(j&&j.trim().length>=G/2)return j;j=j||"";for(var rt=G-j.length;rt>0;rt--)j+=" ";return j}function b(j,N,G){var rt=N._context.doubleClickDelay,ct,st=1,et=d.ensureSingle(j,"rect",G+"toggle",function(Z){N._context.staticPlot||Z.style("cursor","pointer").attr("pointer-events","all"),Z.call(i.fill,"rgba(0,0,0,0)")});N._context.staticPlot||(et.on("mousedown",function(){ct=new Date().getTime(),ct-N._legendMouseDownTimert&&(st=Math.max(st-1,1)),T(N,Z,j,st,u.event)}}))}function _(j,N,G,rt,ct){rt._inHover&&j.attr("data-notex",!0),n.convertToTspans(j,G,function(){P(N,G,rt,ct)})}function P(j,N,G,rt){var ct=j.data()[0][0],st=ct&&ct.trace.showlegend;if(Array.isArray(st)&&(st=st[ct.i]!==!1),!G._inHover&&ct&&!st){j.remove();return}var et=j.select("g[class*=math-group]"),Z=et.node(),ot=F(G);G||(G=N._fullLayout[ot]);var X=G.borderwidth,Q;rt===x?Q=G.title.font:ct.groupTitle?Q=ct.groupTitle.font:Q=G.font;var ut=Q.size*f,J,q;if(Z){var it=r.bBox(Z);J=it.height,q=it.width,rt===x?r.setTranslate(et,X,X+J*.75):r.setTranslate(et,0,J*.25)}else{var nt="."+ot+(rt===x?"title":"")+"text",dt=j.select(nt),Tt=n.lineCount(dt),wt=dt.node();if(J=ut*Tt,q=wt?r.bBox(wt).width:0,rt===x)G.title.side==="left"&&(q+=a.itemGap*2),n.positionText(dt,X+a.titlePad,X+ut);else{var Ct=a.itemGap*2+G.indentation+G.itemwidth;ct.groupTitle&&(Ct=a.itemGap,q-=G.indentation+G.itemwidth),n.positionText(dt,Ct,-ut*((Tt-1)/2-.3))}}rt===x?(G._titleWidth=q,G._titleHeight=J):(ct.lineHeight=ut,ct.height=Math.max(J,16)+3,ct.width=q)}function z(j){var N=0,G=0,rt=j.title.side;return rt&&(rt.indexOf("left")!==-1&&(N=j._titleWidth),rt.indexOf("top")!==-1&&(G=j._titleHeight)),[N,G]}function D(j,N,G,rt){var ct=j._fullLayout,st=F(rt);rt||(rt=ct[st]);var et=ct._size,Z=l.isVertical(rt),ot=l.isGrouped(rt),X=rt.entrywidthmode==="fraction",Q=rt.borderwidth,ut=2*Q,J=a.itemGap,q=rt.indentation+rt.itemwidth+J*2,it=2*(Q+J),nt=I(rt),dt=rt.y<0||rt.y===0&&nt==="top",Tt=rt.y>1||rt.y===1&&nt==="bottom",wt=rt.tracegroupgap,Ct={};let{orientation:It,yref:Nt}=rt,{maxheight:te}=rt,Jt=dt||Tt||It!=="v"||Nt!=="paper";te||(te=Jt?.5:1);let ee=Jt?ct.height:et.h;rt._maxHeight=Math.max(te>1?te:te*ee,30);var Zt=0;rt._width=0,rt._height=0;var mt=z(rt);if(Z)G.each(function(lt){var yt=lt[0].height;r.setTranslate(this,Q+mt[0],Q+mt[1]+rt._height+yt/2+J),rt._height+=yt,rt._width=Math.max(rt._width,lt[0].width)}),Zt=q+rt._width,rt._width+=J+q+ut,rt._height+=it,ot&&(N.each(function(lt,yt){r.setTranslate(this,0,yt*rt.tracegroupgap)}),rt._height+=(rt._lgroupsLength-1)*rt.tracegroupgap);else{var bt=R(rt),vt=rt.x<0||rt.x===0&&bt==="right",Ut=rt.x>1||rt.x===1&&bt==="left",re=Tt||dt,Kt=ct.width/2;rt._maxWidth=Math.max(vt?re&&bt==="left"?et.l+et.w:Kt:Ut?re&&bt==="right"?et.r+et.w:Kt:et.w,2*q);var ue=0,Me=0;G.each(function(lt){var yt=M(lt,rt,q);ue=Math.max(ue,yt),Me+=yt}),Zt=null;var Ce=0;if(ot){var We=0,qe=0,vr=0;N.each(function(){var lt=0,yt=0;u.select(this).selectAll("g.traces").each(function(Ht){var Yt=M(Ht,rt,q),se=Ht[0].height;r.setTranslate(this,mt[0],mt[1]+Q+J+se/2+yt),yt+=se,lt=Math.max(lt,Yt),Ct[Ht[0].trace.legendgroup]=lt});var St=lt+J;qe>0&&St+Q+qe>rt._maxWidth?(Ce=Math.max(Ce,qe),qe=0,vr+=We+wt,We=yt):We=Math.max(We,yt),r.setTranslate(this,qe,vr),qe+=St}),rt._width=Math.max(Ce,qe)+Q,rt._height=vr+We+it}else{var _r=G.size(),er=Me+ut+(_r-1)*J=rt._maxWidth&&(Ce=Math.max(Ce,Dt),Ir=0,de+=Mr,rt._height+=Mr,Mr=0),r.setTranslate(this,mt[0]+Q+Ir,mt[1]+Q+de+yt/2+J),Dt=Ir+St+J,Ir+=Ht,Mr=Math.max(Mr,yt)}),er?(rt._width=Ir+ut,rt._height=Mr+it):(rt._width=Math.max(Ce,Dt)+ut,rt._height+=Mr+it)}}rt._width=Math.ceil(Math.max(rt._width+mt[0],rt._titleWidth+2*(Q+a.titlePad))),rt._height=Math.ceil(Math.max(rt._height+mt[1],rt._titleHeight+2*(Q+a.itemGap))),rt._effHeight=Math.min(rt._height,rt._maxHeight);var qt=j._context.edits,_t=qt.legendText||qt.legendPosition;G.each(function(lt){var yt=u.select(this).select("."+st+"toggle"),St=lt[0].height,Ht=lt[0].trace.legendgroup,Yt=M(lt,rt,q);ot&&Ht!==""&&(Yt=Ct[Ht]);var se=_t?q:Zt||Yt;!Z&&!X&&(se+=J/2),r.setRect(yt,0,-St/2,se,St)})}function B(j,N,G,rt){var ct=j._fullLayout,st=ct[N],et=R(st),Z=I(st),ot=st.xref==="paper",X=st.yref==="paper";j._fullLayout._reservedMargin[N]={};var Q=st.y<.5?"b":"t",ut=st.x<.5?"l":"r",J={r:ct.width-G,l:G+st._width,b:ct.height-rt,t:rt+st._effHeight};if(ot&&X)return E.autoMargin(j,N,{x:st.x,y:st.y,l:st._width*v[et],r:st._width*g[et],b:st._effHeight*g[Z],t:st._effHeight*v[Z]});ot?j._fullLayout._reservedMargin[N][Q]=J[Q]:X||st.orientation==="v"?j._fullLayout._reservedMargin[N][ut]=J[ut]:j._fullLayout._reservedMargin[N][Q]=J[Q]}function R(j){return d.isRightAnchor(j)?"right":d.isCenterAnchor(j)?"center":"left"}function I(j){return d.isBottomAnchor(j)?"bottom":d.isMiddleAnchor(j)?"middle":"top"}function F(j){return j._id||"legend"}}),Tb=Vt(K=>{var V=Ni(),u=Lo(),d=Af(),E=Xr(),A=E.pushUnique,t=E.strTranslate,e=E.strRotate,r=_m(),i=Dl(),n=tk(),o=Eo(),a=Pi(),s=oh(),f=yo(),v=Mf().zindexSeparator,g=ji(),m=mh(),w=Dg(),l=xb(),x=wb(),y=w.YANGLE,S=Math.PI*y/180,k=1/Math.sin(S),M=Math.cos(S),T=Math.sin(S),c=w.HOVERARROWSIZE,h=w.HOVERTEXTPAD,b={box:!0,ohlc:!0,violin:!0,candlestick:!0},_={scatter:!0,scattergl:!0,splom:!0};function P(q,it){return q.distance-it.distance}K.hover=function(q,it,nt,dt){q=E.getGraphDiv(q);var Tt=it.target;E.throttle(q._fullLayout._uid+w.HOVERID,w.HOVERMINTIME,function(){z(q,it,nt,dt,Tt)})},K.loneHover=function(q,it){var nt=!0;Array.isArray(q)||(nt=!1,q=[q]);var dt=it.gd,Tt=Q(dt),wt=ut(dt),Ct=q.map(function(vt){var Ut=vt._x0||vt.x0||vt.x||0,re=vt._x1||vt.x1||vt.x||0,Kt=vt._y0||vt.y0||vt.y||0,ue=vt._y1||vt.y1||vt.y||0,Me=vt.eventData;if(Me){var Ce=Math.min(Ut,re),We=Math.max(Ut,re),qe=Math.min(Kt,ue),vr=Math.max(Kt,ue),_r=vt.trace;if(g.traceIs(_r,"gl3d")){var er=dt._fullLayout[_r.scene]._scene.container,Mr=er.offsetLeft,Ir=er.offsetTop;Ce+=Mr,We+=Mr,qe+=Ir,vr+=Ir}Me.bbox={x0:Ce+wt,x1:We+wt,y0:qe+Tt,y1:vr+Tt},it.inOut_bbox&&it.inOut_bbox.push(Me.bbox)}else Me=!1;return{color:vt.color||a.defaultLine,x0:vt.x0||vt.x||0,x1:vt.x1||vt.x||0,y0:vt.y0||vt.y||0,y1:vt.y1||vt.y||0,xLabel:vt.xLabel,yLabel:vt.yLabel,zLabel:vt.zLabel,text:vt.text,name:vt.name,idealAlign:vt.idealAlign,borderColor:vt.borderColor,fontFamily:vt.fontFamily,fontSize:vt.fontSize,fontColor:vt.fontColor,fontWeight:vt.fontWeight,fontStyle:vt.fontStyle,fontVariant:vt.fontVariant,nameLength:vt.nameLength,textAlign:vt.textAlign,trace:vt.trace||{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0,hovertemplate:vt.hovertemplate||!1,hovertemplateLabels:vt.hovertemplateLabels||!1,eventData:Me}}),It=!1,Nt=R(Ct,{gd:dt,hovermode:"closest",rotateLabels:It,bgColor:it.bgColor||a.background,container:V.select(it.container),outerContainer:it.outerContainer||it.container}),te=Nt.hoverLabels,Jt=5,ee=0,Zt=0;te.sort(function(vt,Ut){return vt.y0-Ut.y0}).each(function(vt,Ut){var re=vt.y0-vt.by/2;re-Jtqe[0]._length||En<0||En>vr[0]._length)return s.unhoverRaw(q,it)}if(it.pointerX=Zn+qe[0]._offset,it.pointerY=En+vr[0]._offset,"xval"in it?_t=m.flat(wt,it.xval):_t=m.p2c(qe,Zn),"yval"in it?lt=m.flat(wt,it.yval):lt=m.p2c(vr,En),!u(_t[0])||!u(lt[0]))return E.warn("Fx.hover failed",it,q),s.unhoverRaw(q,it)}var ra=1/0;function Se(Ra,Qi){for(St=0;StYe&&(Dt.splice(0,Ye),ra=Dt[0].distance),ee&&de!==0&&Dt.length===0){ar.distance=de,ar.index=!1;var qi=Yt._module.hoverPoints(ar,Ue,ir,"closest",{hoverLayer:It._hoverlayer});if(qi&&(qi=qi.filter(function(yi){return yi.spikeDistance<=de})),qi&&qi.length){var qo,Po=qi.filter(function(yi){return yi.xa.showspikes&&yi.xa.spikesnap!=="hovered data"});if(Po.length){var hs=Po[0];u(hs.x0)&&u(hs.y0)&&(qo=Ze(hs),(!Er.vLinePoint||Er.vLinePoint.spikeDistance>qo.spikeDistance)&&(Er.vLinePoint=qo))}var Gi=qi.filter(function(yi){return yi.ya.showspikes&&yi.ya.spikesnap!=="hovered data"});if(Gi.length){var uo=Gi[0];u(uo.x0)&&u(uo.y0)&&(qo=Ze(uo),(!Er.hLinePoint||Er.hLinePoint.spikeDistance>qo.spikeDistance)&&(Er.hLinePoint=qo))}}}}}Se();function Re(Ra,Qi,Hi){for(var Ho=null,Ci=1/0,zo,qi=0;qiRa.trace.index===Cn.trace.index):Dt=[Cn];var Fa=Dt.length,Ga=X("x",Cn,It),ve=X("y",Cn,It);Se(Ga,ve);var ge=[],dr={},br=0,Tr=function(Ra){var Qi=b[Ra.trace.type]?D(Ra):Ra.trace.index;if(!dr[Qi])br++,dr[Qi]=br,ge.push(Ra);else{var Hi=dr[Qi]-1,Ho=ge[Hi];Hi>0&&Math.abs(Ra.distance)Fa-1;mr--)Tr(Dt[mr]);Dt=ge,tn()}var kr=q._hoverdata,Ur=[],Or=Q(q),pe=ut(q);for(let Ra of Dt){var Ke=m.makeEventData(Ra,Ra.trace,Ra.cd);if(Ra.hovertemplate!==!1){var xr=!1;Ra.cd[Ra.index]&&Ra.cd[Ra.index].ht&&(xr=Ra.cd[Ra.index].ht),Ra.hovertemplate=xr||Ra.trace.hovertemplate||!1}if(Ra.xa&&Ra.ya){var Gr=Ra.x0+Ra.xa._offset,ln=Ra.x1+Ra.xa._offset,wn=Ra.y0+Ra.ya._offset,rn=Ra.y1+Ra.ya._offset,Qr=Math.min(Gr,ln),vn=Math.max(Gr,ln),Oa=Math.min(wn,rn),Qn=Math.max(wn,rn);Ke.bbox={x0:Qr+pe,x1:vn+pe,y0:Oa+Or,y1:Qn+Or}}Ra.eventData=[Ke],Ur.push(Ke)}q._hoverdata=Ur;var Qa=Zt==="y"&&(qt.length>1||Dt.length>1)||Zt==="closest"&&pn&&Dt.length>1,Ja=a.combine(It.plot_bgcolor||a.background,It.paper_bgcolor),wi=R(Dt,{gd:q,hovermode:Zt,rotateLabels:Qa,bgColor:Ja,container:It._hoverlayer,outerContainer:It._paper.node(),commonLabelOpts:It.hoverlabel,hoverdistance:It.hoverdistance}),ci=wi.hoverLabels;if(m.isUnifiedHover(Zt)||(F(ci,Qa,It,wi.commonLabelBoundingBox),G(ci,Qa,It._invScaleX,It._invScaleY)),Tt&&Tt.tagName){var Ti=g.getComponentMethod("annotations","hasClickToShow")(q,Ur);n(V.select(Tt),Ti?"pointer":"")}!Tt||dt||!st(q,it,kr)||(kr&&q.emit("plotly_unhover",{event:it,points:kr}),q.emit("plotly_hover",{event:it,points:q._hoverdata,xaxes:qe,yaxes:vr,xvals:_t,yvals:lt}))}function D(q){return[q.trace.index,q.index,q.x0,q.y0,q.name,q.attr,q.xa?q.xa._id:"",q.ya?q.ya._id:""].join(",")}var B=/([\s\S]*)<\/extra>/;function R(q,it){var nt=it.gd,dt=nt._fullLayout,Tt=it.hovermode,wt=it.rotateLabels,Ct=it.bgColor,It=it.container,Nt=it.outerContainer,te=it.commonLabelOpts||{};if(q.length===0)return[[]];var Jt=it.fontFamily||w.HOVERFONT,ee=it.fontSize||w.HOVERFONTSIZE,Zt=it.fontWeight||dt.font.weight,mt=it.fontStyle||dt.font.style,bt=it.fontVariant||dt.font.variant,vt=it.fontTextcase||dt.font.textcase,Ut=it.fontLineposition||dt.font.lineposition,re=it.fontShadow||dt.font.shadow,Kt=q[0],ue=Kt.xa,Me=Kt.ya,Ce=Tt.charAt(0),We=Ce+"Label",qe=Kt[We];if(qe===void 0&&ue.type==="multicategory")for(var vr=0;vrdt.width-pe&&(Ke=dt.width-pe),Fa.attr("d","M"+(kr-Ke)+",0L"+(kr-Ke+c)+","+Or+c+"H"+pe+"v"+Or+(h*2+mr.height)+"H"+-pe+"V"+Or+c+"H"+(kr-Ke-c)+"Z"),kr=Ke,St.minX=kr-pe,St.maxX=kr+pe,ue.side==="top"?(St.minY=Ur-(h*2+mr.height),St.maxY=Ur-h):(St.minY=Ur+h,St.maxY=Ur+(h*2+mr.height))}else{var xr,Gr,ln;Me.side==="right"?(xr="start",Gr=1,ln="",kr=ue._offset+ue._length):(xr="end",Gr=-1,ln="-",kr=ue._offset),Ur=Me._offset+(Kt.y0+Kt.y1)/2,Ga.attr("text-anchor",xr),Fa.attr("d","M0,0L"+ln+c+","+c+"V"+(h+mr.height/2)+"h"+ln+(h*2+mr.width)+"V-"+(h+mr.height/2)+"H"+ln+c+"V-"+c+"Z"),St.minY=Ur-(h+mr.height/2),St.maxY=Ur+(h+mr.height/2),Me.side==="right"?(St.minX=kr+c,St.maxX=kr+c+(h*2+mr.width)):(St.minX=kr-c-(h*2+mr.width),St.maxX=kr-c);var wn=mr.height/2,rn=er-mr.top-wn,Qr="clip"+dt._uid+"commonlabel"+Me._id,vn;if(krFa.hoverinfo!=="none");if(Cn.length===0)return[];var Ht=dt.hoverlabel,Yt=Ht.font,se=Cn[0],ke=((Tt==="x unified"?se.xa:se.ya).unifiedhovertitle||{}).text,Ee=ke?E.hovertemplateString({data:Tt==="x unified"?[{xa:se.xa,x:se.xVal}]:[{ya:se.ya,y:se.yVal}],fallback:se.trace.hovertemplatefallback,locale:dt._d3locale,template:ke}):qe,Ue={showlegend:!0,legend:{title:{text:Ee,font:Yt},font:Yt,bgcolor:Ht.bgcolor,bordercolor:Ht.bordercolor,borderwidth:1,tracegroupgap:7,traceorder:dt.legend?dt.legend.traceorder:void 0,orientation:"v"}},ir={font:Yt};l(Ue,ir,nt._fullData);var ar=ir.legend;ar.entries=[];for(var Ye=0;Ye=0?Kn=Yr:$r+da=0?Kn=$r:In+da=0?$n=zr:tn+ra=0?$n=tn:Nn+ra=0,(Cn.idealAlign==="top"||!Qa)&&Ja?(ln-=rn/2,Cn.anchor="end"):Qa?(ln+=rn/2,Cn.anchor="start"):Cn.anchor="middle",Cn.crossPos=ln;else{if(Cn.pos=ln,Qa=Gr+wn/2+Qn<=Mr,Ja=Gr-wn/2-Qn>=0,(Cn.idealAlign==="left"||!Qa)&&Ja)Gr-=wn/2,Cn.anchor="end";else if(Qa)Gr+=wn/2,Cn.anchor="start";else{Cn.anchor="middle";var wi=Qn/2,ci=Gr+wi-Mr,Ti=Gr-wi;ci>0&&(Gr-=ci),Ti<0&&(Gr+=-Ti)}Cn.crossPos=Gr}Ur.attr("text-anchor",Cn.anchor),pe&&Or.attr("text-anchor",Cn.anchor),Fa.attr("transform",t(Gr,ln)+(wt?e(y):""))}),{hoverLabels:ia,commonLabelBoundingBox:St}}function I(q,it,nt,dt,Tt,wt){var Ct,It,Nt="",te="";q.nameOverride!==void 0&&(q.name=q.nameOverride),q.name&&(q.trace._meta&&(q.name=E.templateString(q.name,q.trace._meta)),Nt=Z(q.name,q.nameLength));var Jt=nt.charAt(0),ee=Jt==="x"?"y":"x";q.zLabel!==void 0?(q.xLabel!==void 0&&(te+="x: "+q.xLabel+"
          "),q.yLabel!==void 0&&(te+="y: "+q.yLabel+"
          "),q.trace.type!=="choropleth"&&q.trace.type!=="choroplethmapbox"&&q.trace.type!=="choroplethmap"&&(te+=(te?"z: ":"")+q.zLabel)):it&&q[Jt+"Label"]===Tt?te=q[ee+"Label"]||"":q.xLabel===void 0?q.yLabel!==void 0&&q.trace.type!=="scattercarpet"&&(te=q.yLabel):q.yLabel===void 0?te=q.xLabel:te="("+q.xLabel+", "+q.yLabel+")",(q.text||q.text===0)&&!Array.isArray(q.text)&&(te+=(te?"
          ":"")+q.text),q.extraText!==void 0&&(te+=(te?"
          ":"")+q.extraText),wt&&te===""&&!q.hovertemplate&&(Nt===""&&wt.remove(),te=Nt),(It=(Ct=q.trace)==null?void 0:Ct.hoverlabel)!=null&&It.split&&(q.hovertemplate="");let{hovertemplate:Zt=!1}=q;if(Zt){let mt=q.hovertemplateLabels||q;q[Jt+"Label"]!==Tt&&(mt[Jt+"other"]=mt[Jt+"Val"],mt[Jt+"otherLabel"]=mt[Jt+"Label"]),te=E.hovertemplateString({data:[q.eventData[0]||{},q.trace._meta],fallback:q.trace.hovertemplatefallback,labels:mt,locale:dt._d3locale,template:Zt}),te=te.replace(B,(bt,vt)=>(Nt=Z(vt,q.nameLength),""))}return[te,Nt]}function F(q,it,nt,dt){var Tt=it?"xa":"ya",wt=it?"ya":"xa",Ct=0,It=1,Nt=q.size(),te=new Array(Nt),Jt=0,ee=dt.minX,Zt=dt.maxX,mt=dt.minY,bt=dt.maxY,vt=function(_t){return _t*nt._invScaleX},Ut=function(_t){return _t*nt._invScaleY};q.each(function(_t){var lt=_t[Tt],yt=_t[wt],St=lt._id.charAt(0)==="x",Ht=lt.range;Jt===0&&Ht&&Ht[0]>Ht[1]!==St&&(It=-1);var Yt=0,se=St?nt.width:nt.height;if(nt.hovermode==="x"||nt.hovermode==="y"){var ke=j(_t,it),Ee=_t.anchor,Ue=Ee==="end"?-1:1,ir,ar;if(Ee==="middle")ir=_t.crossPos+(St?Ut(ke.y-_t.by/2):vt(_t.bx/2+_t.tx2width/2)),ar=ir+(St?Ut(_t.by):vt(_t.bx));else if(St)ir=_t.crossPos+Ut(c+ke.y)-Ut(_t.by/2-c),ar=ir+Ut(_t.by);else{var Ye=vt(Ue*c+ke.x),Er=Ye+vt(Ue*_t.bx);ir=_t.crossPos+Math.min(Ye,Er),ar=_t.crossPos+Math.max(Ye,Er)}St?mt!==void 0&&bt!==void 0&&Math.min(ar,bt)-Math.max(ir,mt)>1&&(yt.side==="left"?(Yt=yt._mainLinePosition,se=nt.width):se=yt._mainLinePosition):ee!==void 0&&Zt!==void 0&&Math.min(ar,Zt)-Math.max(ir,ee)>1&&(yt.side==="top"?(Yt=yt._mainLinePosition,se=nt.height):se=yt._mainLinePosition)}te[Jt++]=[{datum:_t,traceIndex:_t.trace.index,dp:0,pos:_t.pos,posref:_t.posref,size:_t.by*(St?k:1)/2,pmin:Yt,pmax:se}]}),te.sort(function(_t,lt){return _t[0].posref-lt[0].posref||It*(lt[0].traceIndex-_t[0].traceIndex)});var re,Kt,ue,Me,Ce,We,qe;function vr(_t){var lt=_t[0],yt=_t[_t.length-1];if(Kt=lt.pmin-lt.pos-lt.dp+lt.size,ue=yt.pos+yt.dp+yt.size-lt.pmax,Kt>.01){for(Ce=_t.length-1;Ce>=0;Ce--)_t[Ce].dp+=Kt;re=!1}if(!(ue<.01)){if(Kt<-.01){for(Ce=_t.length-1;Ce>=0;Ce--)_t[Ce].dp-=ue;re=!1}if(re){var St=0;for(Me=0;Me<_t.length;Me++)We=_t[Me],We.pos+We.dp+We.size>lt.pmax&&St++;for(Me=_t.length-1;Me>=0&&!(St<=0);Me--)We=_t[Me],We.pos>lt.pmax-1&&(We.del=!0,St--);for(Me=0;Me<_t.length&&!(St<=0);Me++)if(We=_t[Me],We.pos=0;Ce--)_t[Ce].dp-=ue;for(Me=_t.length-1;Me>=0&&!(St<=0);Me--)We=_t[Me],We.pos+We.dp+We.size>lt.pmax&&(We.del=!0,St--)}}}for(;!re&&Ct<=Nt;){for(Ct++,re=!0,Me=0;Me.01){for(Ce=er.length-1;Ce>=0;Ce--)er[Ce].dp+=Kt;for(_r.push.apply(_r,er),te.splice(Me+1,1),qe=0,Ce=_r.length-1;Ce>=0;Ce--)qe+=_r[Ce].dp;for(ue=qe/_r.length,Ce=_r.length-1;Ce>=0;Ce--)_r[Ce].dp-=ue;re=!1}else Me++}te.forEach(vr)}for(Me=te.length-1;Me>=0;Me--){var de=te[Me];for(Ce=de.length-1;Ce>=0;Ce--){var Dt=de[Ce],qt=Dt.datum;qt.offset=Dt.dp,qt.del=Dt.del}}}function j(q,it){var nt=0,dt=q.offset;return it&&(dt*=-T,nt=q.offset*M),{x:nt,y:dt}}function N(q){var it={start:1,end:-1,middle:0}[q.anchor],nt=it*(c+h),dt=nt+it*(q.txwidth+h),Tt=q.anchor==="middle";return Tt&&(nt-=q.tx2width/2,dt+=q.txwidth/2+h),{alignShift:it,textShiftX:nt,text2ShiftX:dt}}function G(q,it,nt,dt){var Tt=function(Ct){return Ct*nt},wt=function(Ct){return Ct*dt};q.each(function(Ct){var It=V.select(this);if(Ct.del)return It.remove();var Nt=It.select("text.nums"),te=Ct.anchor,Jt=te==="end"?-1:1,ee=N(Ct),Zt=j(Ct,it),mt=Zt.x,bt=Zt.y,vt=te==="middle",Ut="hoverlabel"in Ct.trace?Ct.trace.hoverlabel.showarrow:!0,re;vt?re="M-"+Tt(Ct.bx/2+Ct.tx2width/2)+","+wt(bt-Ct.by/2)+"h"+Tt(Ct.bx)+"v"+wt(Ct.by)+"h-"+Tt(Ct.bx)+"Z":Ut?re="M0,0L"+Tt(Jt*c+mt)+","+wt(c+bt)+"v"+wt(Ct.by/2-c)+"h"+Tt(Jt*Ct.bx)+"v-"+wt(Ct.by)+"H"+Tt(Jt*c+mt)+"V"+wt(bt-c)+"Z":re="M"+Tt(Jt*c+mt)+","+wt(bt-Ct.by/2)+"h"+Tt(Jt*Ct.bx)+"v"+wt(Ct.by)+"h"+Tt(-Jt*Ct.bx)+"Z",It.select("path").attr("d",re);var Kt=mt+ee.textShiftX,ue=bt+Ct.ty0-Ct.by/2+h,Me=Ct.textAlign||"auto";Me!=="auto"&&(Me==="left"&&te!=="start"?(Nt.attr("text-anchor","start"),Kt=vt?-Ct.bx/2-Ct.tx2width/2+h:-Ct.bx-h):Me==="right"&&te!=="end"&&(Nt.attr("text-anchor","end"),Kt=vt?Ct.bx/2-Ct.tx2width/2-h:Ct.bx+h)),Nt.call(i.positionText,Tt(Kt),wt(ue)),Ct.tx2width&&(It.select("text.name").call(i.positionText,Tt(ee.text2ShiftX+ee.alignShift*h+mt),wt(bt+Ct.ty0-Ct.by/2+h)),It.select("rect").call(o.setRect,Tt(ee.text2ShiftX+(ee.alignShift-1)*Ct.tx2width/2+mt),wt(bt-Ct.by/2-1),Tt(Ct.tx2width),wt(Ct.by+2)))})}function rt(q,it){var nt=q.index,dt=q.trace||{},Tt=q.cd[0],wt=q.cd[nt]||{};function Ct(Zt){return Zt||u(Zt)&&Zt===0}var It=Array.isArray(nt)?function(Zt,mt){var bt=E.castOption(Tt,nt,Zt);return Ct(bt)?bt:E.extractOption({},dt,"",mt)}:function(Zt,mt){return E.extractOption(wt,dt,Zt,mt)};function Nt(Zt,mt,bt){var vt=It(mt,bt);Ct(vt)&&(q[Zt]=vt)}if(Nt("hoverinfo","hi","hoverinfo"),Nt("bgcolor","hbg","hoverlabel.bgcolor"),Nt("borderColor","hbc","hoverlabel.bordercolor"),Nt("fontFamily","htf","hoverlabel.font.family"),Nt("fontSize","hts","hoverlabel.font.size"),Nt("fontColor","htc","hoverlabel.font.color"),Nt("fontWeight","htw","hoverlabel.font.weight"),Nt("fontStyle","hty","hoverlabel.font.style"),Nt("fontVariant","htv","hoverlabel.font.variant"),Nt("nameLength","hnl","hoverlabel.namelength"),Nt("textAlign","hta","hoverlabel.align"),q.posref=it==="y"||it==="closest"&&dt.orientation==="h"?q.xa._offset+(q.x0+q.x1)/2:q.ya._offset+(q.y0+q.y1)/2,q.x0=E.constrain(q.x0,0,q.xa._length),q.x1=E.constrain(q.x1,0,q.xa._length),q.y0=E.constrain(q.y0,0,q.ya._length),q.y1=E.constrain(q.y1,0,q.ya._length),q.xLabelVal!==void 0&&(q.xLabel="xLabel"in q?q.xLabel:f.hoverLabelText(q.xa,q.xLabelVal,dt.xhoverformat),q.xVal=q.xa.c2d(q.xLabelVal)),q.yLabelVal!==void 0&&(q.yLabel="yLabel"in q?q.yLabel:f.hoverLabelText(q.ya,q.yLabelVal,dt.yhoverformat),q.yVal=q.ya.c2d(q.yLabelVal)),q.zLabelVal!==void 0&&q.zLabel===void 0&&(q.zLabel=String(q.zLabelVal)),!isNaN(q.xerr)&&!(q.xa.type==="log"&&q.xerr<=0)){var te=f.tickText(q.xa,q.xa.c2l(q.xerr),"hover").text;q.xerrneg!==void 0?q.xLabel+=" +"+te+" / -"+f.tickText(q.xa,q.xa.c2l(q.xerrneg),"hover").text:q.xLabel+=" ± "+te,it==="x"&&(q.distance+=1)}if(!isNaN(q.yerr)&&!(q.ya.type==="log"&&q.yerr<=0)){var Jt=f.tickText(q.ya,q.ya.c2l(q.yerr),"hover").text;q.yerrneg!==void 0?q.yLabel+=" +"+Jt+" / -"+f.tickText(q.ya,q.ya.c2l(q.yerrneg),"hover").text:q.yLabel+=" ± "+Jt,it==="y"&&(q.distance+=1)}var ee=q.hoverinfo||q.trace.hoverinfo;return ee&&ee!=="all"&&(ee=Array.isArray(ee)?ee:ee.split("+"),ee.indexOf("x")===-1&&(q.xLabel=void 0),ee.indexOf("y")===-1&&(q.yLabel=void 0),ee.indexOf("z")===-1&&(q.zLabel=void 0),ee.indexOf("text")===-1&&(q.text=void 0),ee.indexOf("name")===-1&&(q.name=void 0)),q}function ct(q,it,nt){var dt=nt.container,Tt=nt.fullLayout,wt=Tt._size,Ct=nt.event,It=!!it.hLinePoint,Nt=!!it.vLinePoint,te,Jt;if(dt.selectAll(".spikeline").remove(),!!(Nt||It)){var ee=a.combine(Tt.plot_bgcolor,Tt.paper_bgcolor);if(It){var Zt=it.hLinePoint,mt,bt;te=Zt&&Zt.xa,Jt=Zt&&Zt.ya;var vt=Jt.spikesnap;vt==="cursor"?(mt=Ct.pointerX,bt=Ct.pointerY):(mt=te._offset+Zt.x,bt=Jt._offset+Zt.y);var Ut=d.readability(Zt.color,ee)<1.5?a.contrast(ee):Zt.color,re=Jt.spikemode,Kt=Jt.spikethickness,ue=Jt.spikecolor||Ut,Me=f.getPxPosition(q,Jt),Ce,We;if(re.indexOf("toaxis")!==-1||re.indexOf("across")!==-1){if(re.indexOf("toaxis")!==-1&&(Ce=Me,We=mt),re.indexOf("across")!==-1){var qe=Jt._counterDomainMin,vr=Jt._counterDomainMax;Jt.anchor==="free"&&(qe=Math.min(qe,Jt.position),vr=Math.max(vr,Jt.position)),Ce=wt.l+qe*wt.w,We=wt.l+vr*wt.w}dt.insert("line",":first-child").attr({x1:Ce,x2:We,y1:bt,y2:bt,"stroke-width":Kt,stroke:ue,"stroke-dasharray":o.dashStyle(Jt.spikedash,Kt)}).classed("spikeline",!0).classed("crisp",!0),dt.insert("line",":first-child").attr({x1:Ce,x2:We,y1:bt,y2:bt,"stroke-width":Kt+2,stroke:ee}).classed("spikeline",!0).classed("crisp",!0)}re.indexOf("marker")!==-1&&dt.insert("circle",":first-child").attr({cx:Me+(Jt.side!=="right"?Kt:-Kt),cy:bt,r:Kt,fill:ue}).classed("spikeline",!0)}if(Nt){var _r=it.vLinePoint,er,Mr;te=_r&&_r.xa,Jt=_r&&_r.ya;var Ir=te.spikesnap;Ir==="cursor"?(er=Ct.pointerX,Mr=Ct.pointerY):(er=te._offset+_r.x,Mr=Jt._offset+_r.y);var de=d.readability(_r.color,ee)<1.5?a.contrast(ee):_r.color,Dt=te.spikemode,qt=te.spikethickness,_t=te.spikecolor||de,lt=f.getPxPosition(q,te),yt,St;if(Dt.indexOf("toaxis")!==-1||Dt.indexOf("across")!==-1){if(Dt.indexOf("toaxis")!==-1&&(yt=lt,St=Mr),Dt.indexOf("across")!==-1){var Ht=te._counterDomainMin,Yt=te._counterDomainMax;te.anchor==="free"&&(Ht=Math.min(Ht,te.position),Yt=Math.max(Yt,te.position)),yt=wt.t+(1-Yt)*wt.h,St=wt.t+(1-Ht)*wt.h}dt.insert("line",":first-child").attr({x1:er,x2:er,y1:yt,y2:St,"stroke-width":qt,stroke:_t,"stroke-dasharray":o.dashStyle(te.spikedash,qt)}).classed("spikeline",!0).classed("crisp",!0),dt.insert("line",":first-child").attr({x1:er,x2:er,y1:yt,y2:St,"stroke-width":qt+2,stroke:ee}).classed("spikeline",!0).classed("crisp",!0)}Dt.indexOf("marker")!==-1&&dt.insert("circle",":first-child").attr({cx:er,cy:lt-(te.side!=="top"?qt:-qt),r:qt,fill:_t}).classed("spikeline",!0)}}}function st(q,it,nt){if(!nt||nt.length!==q._hoverdata.length)return!0;for(var dt=nt.length-1;dt>=0;dt--){var Tt=nt[dt],wt=q._hoverdata[dt];if(Tt.curveNumber!==wt.curveNumber||String(Tt.pointNumber)!==String(wt.pointNumber)||String(Tt.pointNumbers)!==String(wt.pointNumbers)||Tt.binNumber!==wt.binNumber)return!0}return!1}function et(q,it){return!0}function Z(q,it){return i.plainText(q||"",{len:it,allowedTags:["br","sub","sup","b","i","em","s","u"]})}function ot(q,it){for(var nt=it.charAt(0),dt=[],Tt=[],wt=[],Ct=0;Ctq.offsetTop+q.clientTop,ut=q=>q.offsetLeft+q.clientLeft;function J(q,it){var nt=q._fullLayout,dt=it.getBoundingClientRect(),Tt=dt.left,wt=dt.top,Ct=Tt+dt.width,It=wt+dt.height,Nt=E.apply3DTransform(nt._invTransform)(Tt,wt),te=E.apply3DTransform(nt._invTransform)(Ct,It),Jt=Nt[0],ee=Nt[1],Zt=te[0],mt=te[1];return{x:Jt,y:ee,width:Zt-Jt,height:mt-ee,top:Math.min(ee,mt),left:Math.min(Jt,Zt),right:Math.max(Jt,Zt),bottom:Math.max(ee,mt)}}}),jg=Vt((K,V)=>{var u=Xr(),d=Pi(),E=mh().isUnifiedHover;V.exports=function(A,t,e,r){r=r||{};var i=t.legend;function n(o){r.font[o]||(r.font[o]=i?t.legend.font[o]:t.font[o])}t&&E(t.hovermode)&&(r.font||(r.font={}),n("size"),n("family"),n("color"),n("weight"),n("style"),n("variant"),i?(r.bgcolor||(r.bgcolor=d.combine(t.legend.bgcolor,t.paper_bgcolor)),r.bordercolor||(r.bordercolor=t.legend.bordercolor)):r.bgcolor||(r.bgcolor=t.paper_bgcolor)),e("hoverlabel.bgcolor",r.bgcolor),e("hoverlabel.bordercolor",r.bordercolor),e("hoverlabel.namelength",r.namelength),e("hoverlabel.showarrow",r.showarrow),u.coerceFont(e,"hoverlabel.font",r.font),e("hoverlabel.align",r.align)}}),ak=Vt((K,V)=>{var u=Xr(),d=jg(),E=_d();V.exports=function(A,t){function e(r,i){return u.coerce(A,t,E,r,i)}d(A,t,e)}}),ik=Vt((K,V)=>{var u=Xr(),d=vm(),E=jg();V.exports=function(A,t,e,r){function i(o,a){return u.coerce(A,t,d,o,a)}var n=u.extendFlat({},r.hoverlabel);t.hovertemplate&&(n.namelength=-1),E(A,t,i,n)}}),kb=Vt((K,V)=>{var u=Xr(),d=_d();V.exports=function(E,A){function t(e,r){return A[e]!==void 0?A[e]:u.coerce(E,A,d,e,r)}return t("clickmode"),t("hoversubplots"),t("hovermode")}}),ok=Vt((K,V)=>{var u=Xr(),d=_d(),E=kb(),A=jg();V.exports=function(t,e){function r(v,g){return u.coerce(t,e,d,v,g)}var i=E(t,e);i&&(r("hoverdistance"),r("spikedistance"));var n=r("dragmode");n==="select"&&r("selectdirection");var o=e._has("mapbox"),a=e._has("map"),s=e._has("geo"),f=e._basePlotModules.length;e.dragmode==="zoom"&&((o||a||s)&&f===1||(o||a)&&s&&f===2)&&(e.dragmode="pan"),A(t,e,r),u.coerceFont(r,"hoverlabel.grouptitlefont",e.hoverlabel.font)}}),sk=Vt((K,V)=>{var u=Xr(),d=ji();V.exports=function(A){var t=A.calcdata,e=A._fullLayout;function r(s){return function(f){return u.coerceHoverinfo({hoverinfo:f},{_module:s._module},e)}}for(var i=0;i{var u=ji(),d=Tb().hover;V.exports=function(E,A,t){var e=u.getComponentMethod("annotations","onClick")(E,E._hoverdata);t!==void 0&&d(E,A,t,!0);function r(){E.emit("plotly_click",{points:E._hoverdata,event:A})}E._hoverdata&&A&&A.target&&(e&&e.then?e.then(r):r(),A.stopImmediatePropagation&&A.stopImmediatePropagation())}}),pc=Vt((K,V)=>{var u=Ni(),d=Xr(),E=oh(),A=mh(),t=_d(),e=Tb();V.exports={moduleType:"component",name:"fx",constants:Dg(),schema:{layout:t},attributes:vm(),layoutAttributes:t,supplyLayoutGlobalDefaults:ak(),supplyDefaults:ik(),supplyLayoutDefaults:ok(),calc:sk(),getDistanceFunction:A.getDistanceFunction,getClosest:A.getClosest,inbox:A.inbox,quadrature:A.quadrature,appendArrayPointValue:A.appendArrayPointValue,castHoverOption:i,castHoverinfo:n,hover:e.hover,unhover:E.unhover,loneHover:e.loneHover,loneUnhover:r,click:lk()};function r(o){var a=d.isD3Selection(o)?o:u.select(o);a.selectAll("g.hovertext").remove(),a.selectAll(".spikeline").remove()}function i(o,a,s){return d.castOption(o,a,"hoverlabel."+s)}function n(o,a,s){function f(v){return d.coerceHoverinfo({hoverinfo:v},{_module:o._module},a)}return d.castOption(o,s,"hoverinfo",f)}}),$h=Vt(K=>{K.selectMode=function(V){return V==="lasso"||V==="select"},K.drawMode=function(V){return V==="drawclosedpath"||V==="drawopenpath"||V==="drawline"||V==="drawrect"||V==="drawcircle"},K.openMode=function(V){return V==="drawline"||V==="drawopenpath"},K.rectMode=function(V){return V==="select"||V==="drawline"||V==="drawrect"||V==="drawcircle"},K.freeMode=function(V){return V==="lasso"||V==="drawclosedpath"||V==="drawopenpath"},K.selectingOrDrawing=function(V){return K.freeMode(V)||K.rectMode(V)}}),Ug=Vt((K,V)=>{V.exports=function(u){var d=u._fullLayout;d._glcanvas&&d._glcanvas.size()&&d._glcanvas.each(function(E){E.regl&&E.regl.clear({color:!0,depth:!0})})}}),Ky=Vt((K,V)=>{V.exports={undo:{width:857.1,height:1e3,path:"m857 350q0-87-34-166t-91-137-137-92-166-34q-96 0-183 41t-147 114q-4 6-4 13t5 11l76 77q6 5 14 5 9-1 13-7 41-53 100-82t126-29q58 0 110 23t92 61 61 91 22 111-22 111-61 91-92 61-110 23q-55 0-105-20t-90-57l77-77q17-16 8-38-10-23-33-23h-250q-15 0-25 11t-11 25v250q0 24 22 33 22 10 39-8l72-72q60 57 137 88t159 31q87 0 166-34t137-92 91-137 34-166z",transform:"matrix(1 0 0 -1 0 850)"},home:{width:928.6,height:1e3,path:"m786 296v-267q0-15-11-26t-25-10h-214v214h-143v-214h-214q-15 0-25 10t-11 26v267q0 1 0 2t0 2l321 264 321-264q1-1 1-4z m124 39l-34-41q-5-5-12-6h-2q-7 0-12 3l-386 322-386-322q-7-4-13-4-7 2-12 7l-35 41q-4 5-3 13t6 12l401 334q18 15 42 15t43-15l136-114v109q0 8 5 13t13 5h107q8 0 13-5t5-13v-227l122-102q5-5 6-12t-4-13z",transform:"matrix(1 0 0 -1 0 850)"},"camera-retro":{width:1e3,height:1e3,path:"m518 386q0 8-5 13t-13 5q-37 0-63-27t-26-63q0-8 5-13t13-5 12 5 5 13q0 23 16 38t38 16q8 0 13 5t5 13z m125-73q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m-572-320h858v71h-858v-71z m643 320q0 89-62 152t-152 62-151-62-63-152 63-151 151-63 152 63 62 151z m-571 358h214v72h-214v-72z m-72-107h858v143h-462l-36-71h-360v-72z m929 143v-714q0-30-21-51t-50-21h-858q-29 0-50 21t-21 51v714q0 30 21 51t50 21h858q29 0 50-21t21-51z",transform:"matrix(1 0 0 -1 0 850)"},zoombox:{width:1e3,height:1e3,path:"m1000-25l-250 251c40 63 63 138 63 218 0 224-182 406-407 406-224 0-406-182-406-406s183-406 407-406c80 0 155 22 218 62l250-250 125 125z m-812 250l0 438 437 0 0-438-437 0z m62 375l313 0 0-312-313 0 0 312z",transform:"matrix(1 0 0 -1 0 850)"},pan:{width:1e3,height:1e3,path:"m1000 350l-187 188 0-125-250 0 0 250 125 0-188 187-187-187 125 0 0-250-250 0 0 125-188-188 186-187 0 125 252 0 0-250-125 0 187-188 188 188-125 0 0 250 250 0 0-126 187 188z",transform:"matrix(1 0 0 -1 0 850)"},zoom_plus:{width:875,height:1e3,path:"m1 787l0-875 875 0 0 875-875 0z m687-500l-187 0 0-187-125 0 0 187-188 0 0 125 188 0 0 187 125 0 0-187 187 0 0-125z",transform:"matrix(1 0 0 -1 0 850)"},zoom_minus:{width:875,height:1e3,path:"m0 788l0-876 875 0 0 876-875 0z m688-500l-500 0 0 125 500 0 0-125z",transform:"matrix(1 0 0 -1 0 850)"},autoscale:{width:1e3,height:1e3,path:"m250 850l-187 0-63 0 0-62 0-188 63 0 0 188 187 0 0 62z m688 0l-188 0 0-62 188 0 0-188 62 0 0 188 0 62-62 0z m-875-938l0 188-63 0 0-188 0-62 63 0 187 0 0 62-187 0z m875 188l0-188-188 0 0-62 188 0 62 0 0 62 0 188-62 0z m-125 188l-1 0-93-94-156 156 156 156 92-93 2 0 0 250-250 0 0-2 93-92-156-156-156 156 94 92 0 2-250 0 0-250 0 0 93 93 157-156-157-156-93 94 0 0 0-250 250 0 0 0-94 93 156 157 156-157-93-93 0 0 250 0 0 250z",transform:"matrix(1 0 0 -1 0 850)"},tooltip_basic:{width:1500,height:1e3,path:"m375 725l0 0-375-375 375-374 0-1 1125 0 0 750-1125 0z",transform:"matrix(1 0 0 -1 0 850)"},tooltip_compare:{width:1125,height:1e3,path:"m187 786l0 2-187-188 188-187 0 0 937 0 0 373-938 0z m0-499l0 1-187-188 188-188 0 0 937 0 0 376-938-1z",transform:"matrix(1 0 0 -1 0 850)"},plotlylogo:{width:1542,height:1e3,path:"m0-10h182v-140h-182v140z m228 146h183v-286h-183v286z m225 714h182v-1000h-182v1000z m225-285h182v-715h-182v715z m225 142h183v-857h-183v857z m231-428h182v-429h-182v429z m225-291h183v-138h-183v138z",transform:"matrix(1 0 0 -1 0 850)"},"z-axis":{width:1e3,height:1e3,path:"m833 5l-17 108v41l-130-65 130-66c0 0 0 38 0 39 0-1 36-14 39-25 4-15-6-22-16-30-15-12-39-16-56-20-90-22-187-23-279-23-261 0-341 34-353 59 3 60 228 110 228 110-140-8-351-35-351-116 0-120 293-142 474-142 155 0 477 22 477 142 0 50-74 79-163 96z m-374 94c-58-5-99-21-99-40 0-24 65-43 144-43 79 0 143 19 143 43 0 19-42 34-98 40v216h87l-132 135-133-135h88v-216z m167 515h-136v1c16 16 31 34 46 52l84 109v54h-230v-71h124v-1c-16-17-28-32-44-51l-89-114v-51h245v72z",transform:"matrix(1 0 0 -1 0 850)"},"3d_rotate":{width:1e3,height:1e3,path:"m922 660c-5 4-9 7-14 11-359 263-580-31-580-31l-102 28 58-400c0 1 1 1 2 2 118 108 351 249 351 249s-62 27-100 42c88 83 222 183 347 122 16-8 30-17 44-27-2 1-4 2-6 4z m36-329c0 0 64 229-88 296-62 27-124 14-175-11 157-78 225-208 249-266 8-19 11-31 11-31 2 5 6 15 11 32-5-13-8-20-8-20z m-775-239c70-31 117-50 198-32-121 80-199 346-199 346l-96-15-58-12c0 0 55-226 155-287z m603 133l-317-139c0 0 4-4 19-14 7-5 24-15 24-15s-177-147-389 4c235-287 536-112 536-112l31-22 100 299-4-1z m-298-153c6-4 14-9 24-15 0 0-17 10-24 15z",transform:"matrix(1 0 0 -1 0 850)"},camera:{width:1e3,height:1e3,path:"m500 450c-83 0-150-67-150-150 0-83 67-150 150-150 83 0 150 67 150 150 0 83-67 150-150 150z m400 150h-120c-16 0-34 13-39 29l-31 93c-6 15-23 28-40 28h-340c-16 0-34-13-39-28l-31-94c-6-15-23-28-40-28h-120c-55 0-100-45-100-100v-450c0-55 45-100 100-100h800c55 0 100 45 100 100v450c0 55-45 100-100 100z m-400-550c-138 0-250 112-250 250 0 138 112 250 250 250 138 0 250-112 250-250 0-138-112-250-250-250z m365 380c-19 0-35 16-35 35 0 19 16 35 35 35 19 0 35-16 35-35 0-19-16-35-35-35z",transform:"matrix(1 0 0 -1 0 850)"},movie:{width:1e3,height:1e3,path:"m938 413l-188-125c0 37-17 71-44 94 64 38 107 107 107 187 0 121-98 219-219 219-121 0-219-98-219-219 0-61 25-117 66-156h-115c30 33 49 76 49 125 0 103-84 187-187 187s-188-84-188-187c0-57 26-107 65-141-38-22-65-62-65-109v-250c0-70 56-126 125-126h500c69 0 125 56 125 126l188-126c34 0 62 28 62 63v375c0 35-28 63-62 63z m-750 0c-69 0-125 56-125 125s56 125 125 125 125-56 125-125-56-125-125-125z m406-1c-87 0-157 70-157 157 0 86 70 156 157 156s156-70 156-156-70-157-156-157z",transform:"matrix(1 0 0 -1 0 850)"},question:{width:857.1,height:1e3,path:"m500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-14 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-16-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z",transform:"matrix(1 0 0 -1 0 850)"},disk:{width:857.1,height:1e3,path:"m214-7h429v214h-429v-214z m500 0h72v500q0 8-6 21t-11 20l-157 156q-5 6-19 12t-22 5v-232q0-22-15-38t-38-16h-322q-22 0-37 16t-16 38v232h-72v-714h72v232q0 22 16 38t37 16h465q22 0 38-16t15-38v-232z m-214 518v178q0 8-5 13t-13 5h-107q-7 0-13-5t-5-13v-178q0-8 5-13t13-5h107q7 0 13 5t5 13z m357-18v-518q0-22-15-38t-38-16h-750q-23 0-38 16t-16 38v750q0 22 16 38t38 16h517q23 0 50-12t42-26l156-157q16-15 27-42t11-49z",transform:"matrix(1 0 0 -1 0 850)"},drawopenpath:{width:70,height:70,path:"M33.21,85.65a7.31,7.31,0,0,1-2.59-.48c-8.16-3.11-9.27-19.8-9.88-41.3-.1-3.58-.19-6.68-.35-9-.15-2.1-.67-3.48-1.43-3.79-2.13-.88-7.91,2.32-12,5.86L3,32.38c1.87-1.64,11.55-9.66,18.27-6.9,2.13.87,4.75,3.14,5.17,9,.17,2.43.26,5.59.36,9.25a224.17,224.17,0,0,0,1.5,23.4c1.54,10.76,4,12.22,4.48,12.4.84.32,2.79-.46,5.76-3.59L43,80.07C41.53,81.57,37.68,85.64,33.21,85.65ZM74.81,69a11.34,11.34,0,0,0,6.09-6.72L87.26,44.5,74.72,32,56.9,38.35c-2.37.86-5.57,3.42-6.61,6L38.65,72.14l8.42,8.43ZM55,46.27a7.91,7.91,0,0,1,3.64-3.17l14.8-5.3,8,8L76.11,60.6l-.06.19a6.37,6.37,0,0,1-3,3.43L48.25,74.59,44.62,71Zm16.57,7.82A6.9,6.9,0,1,0,64.64,61,6.91,6.91,0,0,0,71.54,54.09Zm-4.05,0a2.85,2.85,0,1,1-2.85-2.85A2.86,2.86,0,0,1,67.49,54.09Zm-4.13,5.22L60.5,56.45,44.26,72.7l2.86,2.86ZM97.83,35.67,84.14,22l-8.57,8.57L89.26,44.24Zm-13.69-8,8,8-2.85,2.85-8-8Z",transform:"matrix(1 0 0 1 -15 -15)"},drawclosedpath:{width:90,height:90,path:"M88.41,21.12a26.56,26.56,0,0,0-36.18,0l-2.07,2-2.07-2a26.57,26.57,0,0,0-36.18,0,23.74,23.74,0,0,0,0,34.8L48,90.12a3.22,3.22,0,0,0,4.42,0l36-34.21a23.73,23.73,0,0,0,0-34.79ZM84,51.24,50.16,83.35,16.35,51.25a17.28,17.28,0,0,1,0-25.47,20,20,0,0,1,27.3,0l4.29,4.07a3.23,3.23,0,0,0,4.44,0l4.29-4.07a20,20,0,0,1,27.3,0,17.27,17.27,0,0,1,0,25.46ZM66.76,47.68h-33v6.91h33ZM53.35,35H46.44V68h6.91Z",transform:"matrix(1 0 0 1 -5 -5)"},lasso:{width:1031,height:1e3,path:"m1018 538c-36 207-290 336-568 286-277-48-473-256-436-463 10-57 36-108 76-151-13-66 11-137 68-183 34-28 75-41 114-42l-55-70 0 0c-2-1-3-2-4-3-10-14-8-34 5-45 14-11 34-8 45 4 1 1 2 3 2 5l0 0 113 140c16 11 31 24 45 40 4 3 6 7 8 11 48-3 100 0 151 9 278 48 473 255 436 462z m-624-379c-80 14-149 48-197 96 42 42 109 47 156 9 33-26 47-66 41-105z m-187-74c-19 16-33 37-39 60 50-32 109-55 174-68-42-25-95-24-135 8z m360 75c-34-7-69-9-102-8 8 62-16 128-68 170-73 59-175 54-244-5-9 20-16 40-20 61-28 159 121 317 333 354s407-60 434-217c28-159-121-318-333-355z",transform:"matrix(1 0 0 -1 0 850)"},selectbox:{width:1e3,height:1e3,path:"m0 850l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-285l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z",transform:"matrix(1 0 0 -1 0 850)"},drawline:{width:70,height:70,path:"M60.64,62.3a11.29,11.29,0,0,0,6.09-6.72l6.35-17.72L60.54,25.31l-17.82,6.4c-2.36.86-5.57,3.41-6.6,6L24.48,65.5l8.42,8.42ZM40.79,39.63a7.89,7.89,0,0,1,3.65-3.17l14.79-5.31,8,8L61.94,54l-.06.19a6.44,6.44,0,0,1-3,3.43L34.07,68l-3.62-3.63Zm16.57,7.81a6.9,6.9,0,1,0-6.89,6.9A6.9,6.9,0,0,0,57.36,47.44Zm-4,0a2.86,2.86,0,1,1-2.85-2.85A2.86,2.86,0,0,1,53.32,47.44Zm-4.13,5.22L46.33,49.8,30.08,66.05l2.86,2.86ZM83.65,29,70,15.34,61.4,23.9,75.09,37.59ZM70,21.06l8,8-2.84,2.85-8-8ZM87,80.49H10.67V87H87Z",transform:"matrix(1 0 0 1 -15 -15)"},drawrect:{width:80,height:80,path:"M78,22V79H21V22H78m9-9H12V88H87V13ZM68,46.22H31V54H68ZM53,32H45.22V69H53Z",transform:"matrix(1 0 0 1 -10 -10)"},drawcircle:{width:80,height:80,path:"M50,84.72C26.84,84.72,8,69.28,8,50.3S26.84,15.87,50,15.87,92,31.31,92,50.3,73.16,84.72,50,84.72Zm0-60.59c-18.6,0-33.74,11.74-33.74,26.17S31.4,76.46,50,76.46,83.74,64.72,83.74,50.3,68.6,24.13,50,24.13Zm17.15,22h-34v7.11h34Zm-13.8-13H46.24v34h7.11Z",transform:"matrix(1 0 0 1 -10 -10)"},eraseshape:{width:80,height:80,path:"M82.77,78H31.85L6,49.57,31.85,21.14H82.77a8.72,8.72,0,0,1,8.65,8.77V69.24A8.72,8.72,0,0,1,82.77,78ZM35.46,69.84H82.77a.57.57,0,0,0,.49-.6V29.91a.57.57,0,0,0-.49-.61H35.46L17,49.57Zm32.68-34.7-24,24,5,5,24-24Zm-19,.53-5,5,24,24,5-5Z",transform:"matrix(1 0 0 1 -10 -10)"},spikeline:{width:1e3,height:1e3,path:"M512 409c0-57-46-104-103-104-57 0-104 47-104 104 0 57 47 103 104 103 57 0 103-46 103-103z m-327-39l92 0 0 92-92 0z m-185 0l92 0 0 92-92 0z m370-186l92 0 0 93-92 0z m0-184l92 0 0 92-92 0z",transform:"matrix(1.5 0 0 -1.5 0 850)"},pencil:{width:1792,height:1792,path:"M491 1536l91-91-235-235-91 91v107h128v128h107zm523-928q0-22-22-22-10 0-17 7l-542 542q-7 7-7 17 0 22 22 22 10 0 17-7l542-542q7-7 7-17zm-54-192l416 416-832 832h-416v-416zm683 96q0 53-37 90l-166 166-416-416 166-165q36-38 90-38 53 0 91 38l235 234q37 39 37 91z",transform:"matrix(1 0 0 1 0 1)"},newplotlylogo:{name:"newplotlylogo",svg:[""," plotly-logomark"," "," "," "," "," "," "," "," "," "," "," "," "," ",""].join("")}}}),Yy=Vt((K,V)=>{var u=32;V.exports={CIRCLE_SIDES:u,i000:0,i090:u/4,i180:u/2,i270:u/4*3,cos45:Math.cos(Math.PI/4),sin45:Math.sin(Math.PI/4),SQRT2:Math.sqrt(2)}}),Xy=Vt((K,V)=>{var u=Xr().strTranslate;function d(e,r){switch(e.type){case"log":return e.p2d(r);case"date":return e.p2r(r,0,e.calendar);default:return e.p2r(r)}}function E(e,r){switch(e.type){case"log":return e.d2p(r);case"date":return e.r2p(r,0,e.calendar);default:return e.r2p(r)}}function A(e){var r=e._id.charAt(0)==="y"?1:0;return function(i){return d(e,i[r])}}function t(e){return u(e.xaxis._offset,e.yaxis._offset)}V.exports={p2r:d,r2p:E,axValue:A,getTransform:t}}),Ed=Vt(K=>{var V=Ng(),u=Yy(),d=u.CIRCLE_SIDES,E=u.SQRT2,A=Xy(),t=A.p2r,e=A.r2p,r=[0,3,4,5,6,1,2],i=[0,3,4,1,2];K.writePaths=function(a){var s=a.length;if(!s)return"M0,0Z";for(var f="",v=0;v0&&x{var u=fc(),d=$h(),E=d.drawMode,A=d.openMode,t=Yy(),e=t.i000,r=t.i090,i=t.i180,n=t.i270,o=t.cos45,a=t.sin45,s=Xy(),f=s.p2r,v=s.r2p,g=kd(),m=g.clearOutline,w=Ed(),l=w.readPaths,x=w.writePaths,y=w.ellipseOver,S=w.fixDatesForPaths;function k(T,c){if(T.length){var h=T[0][0];if(h){var b=c.gd,_=c.isActiveShape,P=c.dragmode,z=(b.layout||{}).shapes||[];if(!E(P)&&_!==void 0){var D=b._fullLayout._activeShapeIndex;if(D{var u=$h(),d=u.selectMode,E=kd(),A=E.clearOutline,t=Ed(),e=t.readPaths,r=t.writePaths,i=t.fixDatesForPaths;V.exports=function(n,o){if(n.length){var a=n[0][0];if(a){var s=a.getAttribute("d"),f=o.gd,v=f._fullLayout.newselection,g=o.plotinfo,m=g.xaxis,w=g.yaxis,l=o.isActiveSelection,x=o.dragmode,y=(f.layout||{}).selections||[];if(!d(x)&&l!==void 0){var S=f._fullLayout._activeSelectionIndex;if(S{V.exports={segmentRE:/[MLHVQCTSZ][^MLHVQCTSZ]*/g,paramRE:/[^\s,]+/g,paramIsX:{M:{0:!0,drawn:0},L:{0:!0,drawn:0},H:{0:!0,drawn:0},V:{},Q:{0:!0,2:!0,drawn:2},C:{0:!0,2:!0,4:!0,drawn:4},T:{0:!0,drawn:0},S:{0:!0,2:!0,drawn:2},Z:{}},paramIsY:{M:{1:!0,drawn:1},L:{1:!0,drawn:1},H:{},V:{0:!0,drawn:0},Q:{1:!0,3:!0,drawn:3},C:{1:!0,3:!0,5:!0,drawn:5},T:{1:!0,drawn:1},S:{1:!0,3:!0,drawn:5},Z:{}},numParams:{M:2,L:2,H:1,V:1,Q:4,C:6,T:2,S:4,Z:0}}}),zd=Vt(K=>{var V=Vg(),u=Xr(),d=yo();K.rangeToShapePosition=function(t){return t.type==="log"?t.r2d:function(e){return e}},K.shapePositionToRange=function(t){return t.type==="log"?t.d2r:function(e){return e}},K.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},K.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},K.extractPathCoords=function(t,e,r){var i=[],n=t.match(V.segmentRE);return n.forEach(function(o){var a=e[o.charAt(0)].drawn;if(a!==void 0){var s=o.slice(1).match(V.paramRE);if(!(!s||s.lengthl&&(y="X"),y});return v>l&&(x=x.replace(/[\s,]*X.*/,""),u.log("Ignoring extra params in segment "+f)),g+x})}function A(t,e){e=e||0;var r=0;return e&&t&&(t.type==="category"||t.type==="multicategory")&&(r=(t.r2p(1)-t.r2p(0))*e),r}}),Mb=Vt((K,V)=>{var u=Xr(),d=yo(),E=Dl(),A=Eo(),t=Ed().readPaths,e=zd(),r=e.getPathString,i=jy(),n=gf().FROM_TL;V.exports=function(s,f,v,g){if(g.selectAll(".shape-label").remove(),!!(v.label.text||v.label.texttemplate)){var m;if(v.label.texttemplate){var w={};if(v.type!=="path"){var l=d.getFromId(s,v.xref),x=d.getFromId(s,v.yref);for(var y in i){var S=i[y](v,l,x);S!==void 0&&(w[y]=S)}}m=u.texttemplateStringForShapes({data:[w],fallback:v.label.texttemplatefallback,locale:s._fullLayout._d3locale,template:v.label.texttemplate})}else m=v.label.text;var k={"data-index":f},M=v.label.font,T={"data-notex":1},c=g.append("g").attr(k).classed("shape-label",!0),h=c.append("text").attr(T).classed("shape-label-text",!0).text(m),b,_,P,z;if(v.path){var D=r(s,v),B=t(D,s);b=1/0,P=1/0,_=-1/0,z=-1/0;for(var R=0;R=s?m=f-g:m=g-f,-180/Math.PI*Math.atan2(m,w)}function a(s,f,v,g,m,w,l){var x=m.label.textposition,y=m.label.textangle,S=m.label.padding,k=m.type,M=Math.PI/180*w,T=Math.sin(M),c=Math.cos(M),h=m.label.xanchor,b=m.label.yanchor,_,P,z,D;if(k==="line"){x==="start"?(_=s,P=f):x==="end"?(_=v,P=g):(_=(s+v)/2,P=(f+g)/2),h==="auto"&&(x==="start"?y==="auto"?v>s?h="left":vs?h="right":vs?h="right":vs?h="left":v{var u=Xr(),d=u.strTranslate,E=oh(),A=$h(),t=A.drawMode,e=A.selectMode,r=ji(),i=Pi(),n=Yy(),o=n.i000,a=n.i090,s=n.i180,f=n.i270,v=kd(),g=v.clearOutlineControllers,m=Ed(),w=m.pointsOnRectangle,l=m.pointsOnEllipse,x=m.writePaths,y=$y().newShapes,S=$y().createShapeObj,k=Ab(),M=Mb();V.exports=function b(_,P,z,D){D||(D=0);var B=z.gd;function R(){b(_,P,z,D++),(l(_[0])||z.hasText)&&I({redrawing:!0})}function I(ee){var Zt={};z.isActiveShape!==void 0&&(z.isActiveShape=!1,Zt=y(P,z)),z.isActiveSelection!==void 0&&(z.isActiveSelection=!1,Zt=k(P,z),B._fullLayout._reselect=!0),Object.keys(Zt).length&&r.call((ee||{}).redrawing?"relayout":"_guiRelayout",B,Zt)}var F=B._fullLayout,j=F._zoomlayer,N=z.dragmode,G=t(N),rt=e(N);(G||rt)&&(B._fullLayout._outlining=!0),g(B),P.attr("d",x(_));var ct,st,et,Z,ot;if(!D&&(z.isActiveShape||z.isActiveSelection)){ot=T([],_);var X=j.append("g").attr("class","outline-controllers");Tt(X),Jt()}if(G&&z.hasText){var Q=j.select(".label-temp"),ut=S(P,z,z.dragmode);M(B,"label-temp",ut,Q)}function J(ee){et=+ee.srcElement.getAttribute("data-i"),Z=+ee.srcElement.getAttribute("data-j"),ct[et][Z].moveFn=q}function q(ee,Zt){if(_.length){var mt=ot[et][Z][1],bt=ot[et][Z][2],vt=_[et],Ut=vt.length;if(w(vt)){var re=ee,Kt=Zt;if(z.isActiveSelection){var ue=c(vt,Z);ue[1]===vt[Z][1]?Kt=0:re=0}for(var Me=0;Me1&&!(ee.length===2&&ee[1][0]==="Z")&&(Z===0&&(ee[0][0]="M"),_[et]=ee,R(),I())}}function dt(ee,Zt){if(ee===2){et=+Zt.srcElement.getAttribute("data-i"),Z=+Zt.srcElement.getAttribute("data-j");var mt=_[et];!w(mt)&&!l(mt)&&nt()}}function Tt(ee){ct=[];for(var Zt=0;Zt<_.length;Zt++){var mt=_[Zt],bt=w(mt),vt=!bt&&l(mt);ct[Zt]=[];for(var Ut=mt.length,re=0;re{var u=Ni(),d=ji(),E=Xr(),A=yo(),t=Ed().readPaths,e=Jy(),r=Mb(),i=kd().clearOutlineControllers,n=Pi(),o=Eo(),a=cl().arrayEditor,s=oh(),f=Xh(),v=Vg(),g=zd(),m=g.getPathString;V.exports={draw:w,drawOne:y,eraseActiveShape:h,drawLabel:r};function w(b){var _=b._fullLayout;_._shapeUpperLayer.selectAll("path").remove(),_._shapeLowerLayer.selectAll("path").remove(),_._shapeUpperLayer.selectAll("text").remove(),_._shapeLowerLayer.selectAll("text").remove();for(var P in _._plots){var z=_._plots[P].shapelayer;z&&(z.selectAll("path").remove(),z.selectAll("text").remove())}for(var D=0;D<_.shapes.length;D++)_.shapes[D].visible===!0&&y(b,D)}function l(b){return!!b._fullLayout._outlining}function x(b){return!b._context.edits.shapePosition}function y(b,_){b._fullLayout._paperdiv.selectAll('.shapelayer [data-index="'+_+'"]').remove();var P=g.makeShapesOptionsAndPlotinfo(b,_),z=P.options,D=P.plotinfo;if(!z._input||z.visible!==!0)return;if(z.layer==="above")R(b._fullLayout._shapeUpperLayer);else if(z.xref==="paper"||z.yref==="paper")R(b._fullLayout._shapeLowerLayer);else if(z.layer==="between")R(D.shapelayerBetween);else if(D._hadPlotinfo){var B=D.mainplotinfo||D;R(B.shapelayer)}else R(b._fullLayout._shapeLowerLayer);function R(I){var F=m(b,z),j={"data-index":_,"fill-rule":z.fillrule,d:F},N=z.opacity,G=z.fillcolor,rt=z.line.width?z.line.color:"rgba(0,0,0,0)",ct=z.line.width,st=z.line.dash;!ct&&z.editable===!0&&(ct=5,st="solid");var et=F[F.length-1]!=="Z",Z=x(b)&&z.editable&&b._fullLayout._activeShapeIndex===_;Z&&(G=et?"rgba(0,0,0,0)":b._fullLayout.activeshape.fillcolor,N=b._fullLayout.activeshape.opacity);var ot=I.append("g").classed("shape-group",!0).attr({"data-index":_}),X=ot.append("path").attr(j).style("opacity",N).call(n.stroke,rt).call(n.fill,G).call(o.dashLine,st,ct);S(ot,b,z),r(b,_,z,ot);var Q;if((Z||b._context.edits.shapePosition)&&(Q=a(b.layout,"shapes",z)),Z){X.style({cursor:"move"});var ut={element:X.node(),plotinfo:D,gd:b,editHelpers:Q,hasText:z.label.text||z.label.texttemplate,isActiveShape:!0},J=t(F,b);e(J,X,ut)}else b._context.edits.shapePosition?k(b,X,z,_,I,Q):z.editable===!0&&X.style("pointer-events",et||n.opacity(G)*N<=.5?"stroke":"all");X.node().addEventListener("click",function(){return T(b,X)})}}function S(b,_,P){var z=(P.xref+P.yref).replace(/paper/g,"").replace(/[xyz][0-9]* *domain/g,"");o.setClipUrl(b,z?"clip"+_._fullLayout._uid+z:null,_)}function k(b,_,P,z,D,B){var R=10,I=10,F=P.xsizemode==="pixel",j=P.ysizemode==="pixel",N=P.type==="line",G=P.type==="path",rt=B.modifyItem,ct,st,et,Z,ot,X,Q,ut,J,q,it,nt,dt,Tt,wt,Ct=u.select(_.node().parentNode),It=A.getFromId(b,P.xref),Nt=A.getRefType(P.xref),te=A.getFromId(b,P.yref),Jt=A.getRefType(P.yref),ee=P.x0shift,Zt=P.x1shift,mt=P.y0shift,bt=P.y1shift,vt=function(lt,yt){var St=g.getDataToPixel(b,It,yt,!1,Nt);return St(lt)},Ut=function(lt,yt){var St=g.getDataToPixel(b,te,yt,!0,Jt);return St(lt)},re=g.getPixelToData(b,It,!1,Nt),Kt=g.getPixelToData(b,te,!0,Jt),ue=We(),Me={element:ue.node(),gd:b,prepFn:_r,doneFn:er,clickFn:Mr},Ce;s.init(Me),ue.node().onmousemove=vr;function We(){return N?qe():_}function qe(){var lt=10,yt=Math.max(P.line.width,lt),St=D.append("g").attr("data-index",z).attr("drag-helper",!0);St.append("path").attr("d",_.attr("d")).style({cursor:"move","stroke-width":yt,"stroke-opacity":"0"});var Ht={"fill-opacity":"0"},Yt=Math.max(yt/2,lt);return St.append("circle").attr({"data-line-point":"start-point",cx:F?vt(P.xanchor)+P.x0:vt(P.x0,ee),cy:j?Ut(P.yanchor)-P.y0:Ut(P.y0,mt),r:Yt}).style(Ht).classed("cursor-grab",!0),St.append("circle").attr({"data-line-point":"end-point",cx:F?vt(P.xanchor)+P.x1:vt(P.x1,Zt),cy:j?Ut(P.yanchor)-P.y1:Ut(P.y1,bt),r:Yt}).style(Ht).classed("cursor-grab",!0),St}function vr(lt){if(l(b)){Ce=null;return}if(N)lt.target.tagName==="path"?Ce="move":Ce=lt.target.attributes["data-line-point"].value==="start-point"?"resize-over-start-point":"resize-over-end-point";else{var yt=Me.element.getBoundingClientRect(),St=yt.right-yt.left,Ht=yt.bottom-yt.top,Yt=lt.clientX-yt.left,se=lt.clientY-yt.top,ke=!G&&St>R&&Ht>I&&!lt.shiftKey?s.getCursor(Yt/St,1-se/Ht):"move";f(_,ke),Ce=ke.split("-")[0]}}function _r(lt){l(b)||(F&&(ot=vt(P.xanchor)),j&&(X=Ut(P.yanchor)),P.type==="path"?wt=P.path:(ct=F?P.x0:vt(P.x0),st=j?P.y0:Ut(P.y0),et=F?P.x1:vt(P.x1),Z=j?P.y1:Ut(P.y1)),ctZ?(Q=st,it="y0",ut=Z,nt="y1"):(Q=Z,it="y1",ut=st,nt="y0"),vr(lt),Dt(D,P),_t(_,P,b),Me.moveFn=Ce==="move"?Ir:de,Me.altKey=lt.altKey)}function er(){l(b)||(f(_),qt(D),S(_,b,P),d.call("_guiRelayout",b,B.getUpdateObj()))}function Mr(){l(b)||qt(D)}function Ir(lt,yt){if(P.type==="path"){var St=function(se){return se},Ht=St,Yt=St;F?rt("xanchor",P.xanchor=re(ot+lt)):(Ht=function(se){return re(vt(se)+lt)},It&&It.type==="date"&&(Ht=g.encodeDate(Ht))),j?rt("yanchor",P.yanchor=Kt(X+yt)):(Yt=function(se){return Kt(Ut(se)+yt)},te&&te.type==="date"&&(Yt=g.encodeDate(Yt))),rt("path",P.path=M(wt,Ht,Yt))}else F?rt("xanchor",P.xanchor=re(ot+lt)):(rt("x0",P.x0=re(ct+lt)),rt("x1",P.x1=re(et+lt))),j?rt("yanchor",P.yanchor=Kt(X+yt)):(rt("y0",P.y0=Kt(st+yt)),rt("y1",P.y1=Kt(Z+yt)));_.attr("d",m(b,P)),Dt(D,P),r(b,z,P,Ct)}function de(lt,yt){if(G){var St=function(gn){return gn},Ht=St,Yt=St;F?rt("xanchor",P.xanchor=re(ot+lt)):(Ht=function(gn){return re(vt(gn)+lt)},It&&It.type==="date"&&(Ht=g.encodeDate(Ht))),j?rt("yanchor",P.yanchor=Kt(X+yt)):(Yt=function(gn){return Kt(Ut(gn)+yt)},te&&te.type==="date"&&(Yt=g.encodeDate(Yt))),rt("path",P.path=M(wt,Ht,Yt))}else if(N){if(Ce==="resize-over-start-point"){var se=ct+lt,ke=j?st-yt:st+yt;rt("x0",P.x0=F?se:re(se)),rt("y0",P.y0=j?ke:Kt(ke))}else if(Ce==="resize-over-end-point"){var Ee=et+lt,Ue=j?Z-yt:Z+yt;rt("x1",P.x1=F?Ee:re(Ee)),rt("y1",P.y1=j?Ue:Kt(Ue))}}else{var ir=function(gn){return Ce.indexOf(gn)!==-1},ar=ir("n"),Ye=ir("s"),Er=ir("w"),pn=ir("e"),dn=ar?Q+yt:Q,bn=Ye?ut+yt:ut,Zn=Er?J+lt:J,En=pn?q+lt:q;j&&(ar&&(dn=Q-yt),Ye&&(bn=ut-yt)),(!j&&bn-dn>I||j&&dn-bn>I)&&(rt(it,P[it]=j?dn:Kt(dn)),rt(nt,P[nt]=j?bn:Kt(bn))),En-Zn>R&&(rt(dt,P[dt]=F?Zn:re(Zn)),rt(Tt,P[Tt]=F?En:re(En)))}_.attr("d",m(b,P)),Dt(D,P),r(b,z,P,Ct)}function Dt(lt,yt){(F||j)&&St();function St(){var Ht=yt.type!=="path",Yt=lt.selectAll(".visual-cue").data([0]),se=1;Yt.enter().append("path").attr({fill:"#fff","fill-rule":"evenodd",stroke:"#000","stroke-width":se}).classed("visual-cue",!0);var ke=vt(F?yt.xanchor:E.midRange(Ht?[yt.x0,yt.x1]:g.extractPathCoords(yt.path,v.paramIsX))),Ee=Ut(j?yt.yanchor:E.midRange(Ht?[yt.y0,yt.y1]:g.extractPathCoords(yt.path,v.paramIsY)));if(ke=g.roundPositionForSharpStrokeRendering(ke,se),Ee=g.roundPositionForSharpStrokeRendering(Ee,se),F&&j){var Ue="M"+(ke-1-se)+","+(Ee-1-se)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";Yt.attr("d",Ue)}else if(F){var ir="M"+(ke-1-se)+","+(Ee-9-se)+"v18 h2 v-18 Z";Yt.attr("d",ir)}else{var ar="M"+(ke-9-se)+","+(Ee-1-se)+"h18 v2 h-18 Z";Yt.attr("d",ar)}}}function qt(lt){lt.selectAll(".visual-cue").remove()}function _t(lt,yt,St){var Ht=yt.xref,Yt=yt.yref,se=A.getFromId(St,Ht),ke=A.getFromId(St,Yt),Ee="";Ht!=="paper"&&!se.autorange&&(Ee+=Ht),Yt!=="paper"&&!ke.autorange&&(Ee+=Yt),o.setClipUrl(lt,Ee?"clip"+St._fullLayout._uid+Ee:null,St)}}function M(b,_,P){return b.replace(v.segmentRE,function(z){var D=0,B=z.charAt(0),R=v.paramIsX[B],I=v.paramIsY[B],F=v.numParams[B],j=z.slice(1).replace(v.paramRE,function(N){return D>=F||(R[D]?N=_(N):I[D]&&(N=P(N)),D++),N});return B+j})}function T(b,_){if(x(b)){var P=_.node(),z=+P.getAttribute("data-index");if(z>=0){if(z===b._fullLayout._activeShapeIndex){c(b);return}b._fullLayout._activeShapeIndex=z,b._fullLayout._deactivateShape=c,w(b)}}}function c(b){if(x(b)){var _=b._fullLayout._activeShapeIndex;_>=0&&(i(b),delete b._fullLayout._activeShapeIndex,w(b))}}function h(b){if(x(b)){i(b);var _=b._fullLayout._activeShapeIndex,P=(b.layout||{}).shapes||[];if(_{var u=ji(),d=Vu(),E=fc(),A=Ky(),t=Qy().eraseActiveShape,e=Xr(),r=e._,i=V.exports={};i.toImage={name:"toImage",title:function(k){var M=k._context.toImageButtonOptions||{},T=M.format||"png";return T==="png"?r(k,"Download plot as a PNG"):r(k,"Download plot")},icon:A.camera,click:function(k){var M=k._context.toImageButtonOptions,T={format:M.format||"png"};e.notifier(r(k,"Taking snapshot - this may take a few seconds"),"long"),["filename","width","height","scale"].forEach(function(c){c in M&&(T[c]=M[c])}),u.call("downloadImage",k,T).then(function(c){e.notifier(r(k,"Snapshot succeeded")+" - "+c,"long")}).catch(function(){e.notifier(r(k,"Sorry, there was a problem downloading your snapshot!"),"long")})}},i.sendDataToCloud={name:"sendDataToCloud",title:function(k){return r(k,"Edit in Chart Studio")},icon:A.disk,click:function(k){d.sendDataToCloud(k)}},i.editInChartStudio={name:"editInChartStudio",title:function(k){return r(k,"Edit in Chart Studio")},icon:A.pencil,click:function(k){d.sendDataToCloud(k)}},i.zoom2d={name:"zoom2d",_cat:"zoom",title:function(k){return r(k,"Zoom")},attr:"dragmode",val:"zoom",icon:A.zoombox,click:n},i.pan2d={name:"pan2d",_cat:"pan",title:function(k){return r(k,"Pan")},attr:"dragmode",val:"pan",icon:A.pan,click:n},i.select2d={name:"select2d",_cat:"select",title:function(k){return r(k,"Box Select")},attr:"dragmode",val:"select",icon:A.selectbox,click:n},i.lasso2d={name:"lasso2d",_cat:"lasso",title:function(k){return r(k,"Lasso Select")},attr:"dragmode",val:"lasso",icon:A.lasso,click:n},i.drawclosedpath={name:"drawclosedpath",title:function(k){return r(k,"Draw closed freeform")},attr:"dragmode",val:"drawclosedpath",icon:A.drawclosedpath,click:n},i.drawopenpath={name:"drawopenpath",title:function(k){return r(k,"Draw open freeform")},attr:"dragmode",val:"drawopenpath",icon:A.drawopenpath,click:n},i.drawline={name:"drawline",title:function(k){return r(k,"Draw line")},attr:"dragmode",val:"drawline",icon:A.drawline,click:n},i.drawrect={name:"drawrect",title:function(k){return r(k,"Draw rectangle")},attr:"dragmode",val:"drawrect",icon:A.drawrect,click:n},i.drawcircle={name:"drawcircle",title:function(k){return r(k,"Draw circle")},attr:"dragmode",val:"drawcircle",icon:A.drawcircle,click:n},i.eraseshape={name:"eraseshape",title:function(k){return r(k,"Erase active shape")},icon:A.eraseshape,click:t},i.zoomIn2d={name:"zoomIn2d",_cat:"zoomin",title:function(k){return r(k,"Zoom in")},attr:"zoom",val:"in",icon:A.zoom_plus,click:n},i.zoomOut2d={name:"zoomOut2d",_cat:"zoomout",title:function(k){return r(k,"Zoom out")},attr:"zoom",val:"out",icon:A.zoom_minus,click:n},i.autoScale2d={name:"autoScale2d",_cat:"autoscale",title:function(k){return r(k,"Autoscale")},attr:"zoom",val:"auto",icon:A.autoscale,click:n},i.resetScale2d={name:"resetScale2d",_cat:"resetscale",title:function(k){return r(k,"Reset axes")},attr:"zoom",val:"reset",icon:A.home,click:n},i.hoverClosestCartesian={name:"hoverClosestCartesian",_cat:"hoverclosest",title:function(k){return r(k,"Show closest data on hover")},attr:"hovermode",val:"closest",icon:A.tooltip_basic,gravity:"ne",click:n},i.hoverCompareCartesian={name:"hoverCompareCartesian",_cat:"hoverCompare",title:function(k){return r(k,"Compare data on hover")},attr:"hovermode",val:function(k){return k._fullLayout._isHoriz?"y":"x"},icon:A.tooltip_compare,gravity:"ne",click:n};function n(k,M){var T=M.currentTarget,c=T.getAttribute("data-attr"),h=T.getAttribute("data-val")||!0,b=k._fullLayout,_={},P=E.list(k,null,!0),z=b._cartesianSpikesEnabled,D,B;if(c==="zoom"){var R=h==="in"?.5:2,I=(1+R)/2,F=(1-R)/2,j,N;for(B=0;B{var u=Sb(),d=Object.keys(u),E=["drawline","drawopenpath","drawclosedpath","drawcircle","drawrect","eraseshape"],A=["v1hovermode","hoverclosest","hovercompare","togglehover","togglespikelines"].concat(E),t=[],e=function(r){if(A.indexOf(r._cat||r.name)===-1){var i=r.name,n=(r._cat||r.name).toLowerCase();t.indexOf(i)===-1&&t.push(i),t.indexOf(n)===-1&&t.push(n)}};d.forEach(function(r){e(u[r])}),t.sort(),V.exports={DRAW_MODES:E,backButtons:A,foreButtons:t}}),zb=Vt((K,V)=>{Eb(),V.exports={editType:"modebar",orientation:{valType:"enumerated",values:["v","h"],dflt:"h",editType:"modebar"},bgcolor:{valType:"color",editType:"modebar"},color:{valType:"color",editType:"modebar"},activecolor:{valType:"color",editType:"modebar"},uirevision:{valType:"any",editType:"none"},add:{valType:"string",arrayOk:!0,dflt:"",editType:"modebar"},remove:{valType:"string",arrayOk:!0,dflt:"",editType:"modebar"}}}),uk=Vt((K,V)=>{var u=Xr(),d=Pi(),E=cl(),A=zb();V.exports=function(t,e){var r=t.modebar||{},i=E.newContainer(e,"modebar");function n(a,s){return u.coerce(r,i,A,a,s)}n("orientation"),n("bgcolor",d.addOpacity(e.paper_bgcolor,.5));var o=d.contrast(d.rgb(e.modebar.bgcolor));n("color",d.addOpacity(o,.3)),n("activecolor",d.addOpacity(o,.7)),n("uirevision",e.uirevision),n("add"),n("remove")}}),ck=Vt((K,V)=>{var u=Ni(),d=Lo(),E=Xr(),A=Ky(),t=Fy().version,e=new DOMParser;function r(a){this.container=a.container,this.element=document.createElement("div"),this.update(a.graphInfo,a.buttons),this.container.appendChild(this.element)}var i=r.prototype;i.update=function(a,s){this.graphInfo=a;var f=this.graphInfo._context,v=this.graphInfo._fullLayout,g="modebar-"+v._uid;this.element.setAttribute("id",g),this.element.setAttribute("role","toolbar"),this._uid=g,this.element.className="modebar modebar--custom",f.displayModeBar==="hover"&&(this.element.className+=" modebar--hover ease-bg"),v.modebar.orientation==="v"&&(this.element.className+=" vertical",s=s.reverse());var m=v.modebar,w="#"+g+" .modebar-group";document.querySelectorAll(w).forEach(function(k){k.style.backgroundColor=m.bgcolor});var l=!this.hasButtons(s),x=this.hasLogo!==f.displaylogo,y=this.locale!==f.locale;if(this.locale=f.locale,(l||x||y)&&(this.removeAllButtons(),this.updateButtons(s),f.watermark||f.displaylogo)){var S=this.getLogo();f.watermark&&(S.className=S.className+" watermark"),v.modebar.orientation==="v"?this.element.insertBefore(S,this.element.childNodes[0]):this.element.appendChild(S),this.hasLogo=!0}this.updateActiveButton(),E.setStyleOnHover("#"+g+" .modebar-btn",".active",".icon path","fill: "+m.activecolor,"fill: "+m.color,this.element)},i.updateButtons=function(a){var s=this;this.buttons=a,this.buttonElements=[],this.buttonsNames=[],this.buttons.forEach(function(f){var v=s.createGroup();f.forEach(function(g){var m=g.name;if(!m)throw new Error("must provide button 'name' in button config");if(s.buttonsNames.indexOf(m)!==-1)throw new Error("button name '"+m+"' is taken");s.buttonsNames.push(m);var w=s.createButton(g);s.buttonElements.push(w),v.appendChild(w)}),s.element.appendChild(v)})},i.createGroup=function(){var a=document.createElement("div");a.className="modebar-group";var s=this.graphInfo._fullLayout.modebar;return a.style.backgroundColor=s.bgcolor,a},i.createButton=function(a){var s=this,f=document.createElement("button");f.setAttribute("type","button"),f.setAttribute("rel","tooltip"),f.className="modebar-btn";var v=a.title;v===void 0?v=a.name:typeof v=="function"&&(v=v(this.graphInfo)),(v||v===0)&&(f.setAttribute("data-title",v),f.setAttribute("aria-label",v)),a.attr!==void 0&&f.setAttribute("data-attr",a.attr);var g=a.val;g!==void 0&&(typeof g=="function"&&(g=g(this.graphInfo)),f.setAttribute("data-val",g));var m=a.click;if(typeof m!="function")throw new Error("must provide button 'click' function in button config");f.addEventListener("click",function(l){a.click(s.graphInfo,l),s.updateActiveButton(l.currentTarget)}),f.setAttribute("data-toggle",a.toggle||!1),a.toggle&&u.select(f).classed("active",!0);var w=a.icon;return typeof w=="function"?f.appendChild(w()):f.appendChild(this.createIcon(w||A.question)),f.setAttribute("data-gravity",a.gravity||"n"),f},i.createIcon=function(a){var s=d(a.height)?Number(a.height):a.ascent-a.descent,f="http://www.w3.org/2000/svg",v;if(a.path){v=document.createElementNS(f,"svg"),v.setAttribute("viewBox",[0,0,a.width,s].join(" ")),v.setAttribute("class","icon");var g=document.createElementNS(f,"path");g.setAttribute("d",a.path),a.transform?g.setAttribute("transform",a.transform):a.ascent!==void 0&&g.setAttribute("transform","matrix(1 0 0 -1 0 "+a.ascent+")"),v.appendChild(g)}if(a.svg){var m=e.parseFromString(a.svg,"application/xml");v=m.childNodes[0]}return v.setAttribute("height","1em"),v.setAttribute("width","1em"),v},i.updateActiveButton=function(a){var s=this.graphInfo._fullLayout,f=a!==void 0?a.getAttribute("data-attr"):null;this.buttonElements.forEach(function(v){var g=v.getAttribute("data-val")||!0,m=v.getAttribute("data-attr"),w=v.getAttribute("data-toggle")==="true",l=u.select(v),x=function(k,M){var T=s.modebar,c=k.querySelector(".icon path");c&&(M||k.matches(":hover")?c.style.fill=T.activecolor:c.style.fill=T.color)};if(w){if(m===f){var y=!l.classed("active");l.classed("active",y),x(v,y)}}else{var S=m===null?m:E.nestedProperty(s,m).get();l.classed("active",S===g),x(v,S===g)}})},i.hasButtons=function(a){var s=this.buttons;if(!s||a.length!==s.length)return!1;for(var f=0;f{var u=fc(),d=nu(),E=ji(),A=mh().isUnifiedHover,t=ck(),e=Sb(),r=Eb().DRAW_MODES,i=Xr().extendDeep;V.exports=function(g){var m=g._fullLayout,w=g._context,l=m._modeBar;if(!w.displayModeBar&&!w.watermark){l&&(l.destroy(),delete m._modeBar);return}if(!Array.isArray(w.modeBarButtonsToRemove))throw new Error(["*modeBarButtonsToRemove* configuration options","must be an array."].join(" "));if(!Array.isArray(w.modeBarButtonsToAdd))throw new Error(["*modeBarButtonsToAdd* configuration options","must be an array."].join(" "));var x=w.modeBarButtons,y;Array.isArray(x)&&x.length?y=v(x):!w.displayModeBar&&w.watermark?y=[]:y=n(g),l?l.update(g,y):m._modeBar=t(g,y)};function n(g){var m=g._fullLayout,w=g._fullData,l=g._context;function x(q,it){if(typeof it=="string"){if(it.toLowerCase()===q.toLowerCase())return!0}else{var nt=it.name,dt=it._cat||it.name;if(nt===q||dt===q.toLowerCase())return!0}return!1}var y=m.modebar.add;typeof y=="string"&&(y=[y]);var S=m.modebar.remove;typeof S=="string"&&(S=[S]);var k=l.modeBarButtonsToAdd.concat(y.filter(function(q){for(var it=0;it1?(st=["toggleHover"],et=["resetViews"]):h?(ct=["zoomInGeo","zoomOutGeo"],st=["hoverClosestGeo"],et=["resetGeo"]):c?(st=["hoverClosest3d"],et=["resetCameraDefault3d","resetCameraLastSave3d"]):z?(ct=["zoomInMapbox","zoomOutMapbox"],st=["toggleHover"],et=["resetViewMapbox"]):D?(ct=["zoomInMap","zoomOutMap"],st=["toggleHover"],et=["resetViewMap"]):b?st=["hoverClosestPie"]:I?(st=["hoverClosestCartesian","hoverCompareCartesian"],et=["resetViewSankey"]):st=["toggleHover"],T&&st.push("toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"),(s(w)||j)&&(st=[]),T&&!F&&(ct=["zoomIn2d","zoomOut2d","autoScale2d"],et[0]!=="resetViews"&&(et=["resetScale2d"])),c?Z=["zoom3d","pan3d","orbitRotation","tableRotation"]:T&&!F||P?Z=["zoom2d","pan2d"]:z||D||h?Z=["pan2d"]:B&&(Z=["zoom2d"]),a(w)&&Z.push("select2d","lasso2d");var ot=[],X=function(q){ot.indexOf(q)===-1&&st.indexOf(q)!==-1&&ot.push(q)};if(Array.isArray(k)){for(var Q=[],ut=0;ut{V.exports={moduleType:"component",name:"modebar",layoutAttributes:zb(),supplyLayoutDefaults:uk(),manage:fk()}}),Cb=Vt((K,V)=>{var u=gf().FROM_BL;V.exports=function(d,E,A){A===void 0&&(A=u[d.constraintoward||"center"]);var t=[d.r2l(d.range[0]),d.r2l(d.range[1])],e=t[0]+(t[1]-t[0])*A;d.range=d._input.range=[d.l2r(e+(t[0]-e)*E),d.l2r(e+(t[1]-e)*E)],d.setScale()}}),f0=Vt(K=>{var V=Xr(),u=Yh(),d=fc().id2name,E=Of(),A=Cb(),t=gp(),e=ks().ALMOST_EQUAL,r=gf().FROM_BL;K.handleDefaults=function(g,m,w){var l=w.axIds,x=w.axHasImage,y=m._axisConstraintGroups=[],S=m._axisMatchGroups=[],k,M,T,c,h,b,_,P;for(k=0;ky?w.slice(y):l.slice(x))+S}function f(g,m){for(var w=m._size,l=w.h/w.w,x={},y=Object.keys(g),S=0;Se*_&&!B)){for(x=0;xet&&itct&&(ct=it);var dt=(ct-rt)/(2*st);c/=dt,rt=k.l2r(rt),ct=k.l2r(ct),k.range=k._input.range=j{var V=Ni(),u=ji(),d=Vu(),E=Xr(),A=Dl(),t=Ug(),e=Pi(),r=Eo(),i=c0(),n=Lb(),o=yo(),a=gf(),s=f0(),f=s.enforce,v=s.clean,g=Yh().doAutoRange,m="start",w="middle",l="end",x=Mf().zindexSeparator;K.layoutStyles=function(I){return E.syncOrAsync([d.doAutoMargin,S],I)};function y(I,F,j){for(var N=0;N=I[1]||G[1]<=I[0])&&rt[0]F[0])return!0}return!1}function S(I){var F=I._fullLayout,j=F._size,N=j.p,G=o.list(I,"",!0),rt,ct,st,et,Z,ot;if(F._paperdiv.style({width:I._context.responsive&&F.autosize&&!I._context._hasZeroWidth&&!I.layout.width?"100%":F.width+"px",height:I._context.responsive&&F.autosize&&!I._context._hasZeroHeight&&!I.layout.height?"100%":F.height+"px"}).selectAll(".main-svg").call(r.setSize,F.width,F.height),I._context.setBackground(I,F.paper_bgcolor),K.drawMainTitle(I),n.manage(I),!F._has("cartesian"))return d.previousPromises(I);function X(_t,lt,yt){var St=_t._lw/2;if(_t._id.charAt(0)==="x"){if(lt){if(yt==="top")return lt._offset-N-St}else return j.t+j.h*(1-(_t.position||0))+St%1;return lt._offset+lt._length+N+St}if(lt){if(yt==="right")return lt._offset+lt._length+N+St}else return j.l+j.w*(_t.position||0)+St%1;return lt._offset-N-St}for(rt=0;rt0){_(I,rt,Z,et),st.attr({x:ct,y:rt,"text-anchor":N,dy:D(F.yanchor)}).call(A.positionText,ct,rt);var ot=(F.text.match(A.BR_TAG_ALL)||[]).length;if(ot){var X=a.LINE_SPACING*ot+a.MID_SHIFT;F.y===0&&(X=-X),st.selectAll(".line").each(function(){var it=+this.getAttribute("dy").slice(0,-2)-X+"em";this.setAttribute("dy",it)})}var Q=V.select(I).selectAll(".gtitle-subtitle");if(Q.node()){var ut=st.node().getBBox(),J=ut.y+ut.height,q=J+i.SUBTITLE_PADDING_EM*F.subtitle.font.size;Q.attr({x:ct,y:q,"text-anchor":N,dy:D(F.yanchor)}).call(A.positionText,ct,q)}}}};function c(I,F,j,N,G){var rt=F.yref==="paper"?I._fullLayout._size.h:I._fullLayout.height,ct=E.isTopAnchor(F)?N:N-G,st=j==="b"?rt-ct:ct;return E.isTopAnchor(F)&&j==="t"||E.isBottomAnchor(F)&&j==="b"?!1:st.5?"t":"b",ct=I._fullLayout.margin[rt],st=0;return F.yref==="paper"?st=j+F.pad.t+F.pad.b:F.yref==="container"&&(st=h(rt,N,G,I._fullLayout.height,j)+F.pad.t+F.pad.b),st>ct?st:0}function _(I,F,j,N){var G="title.automargin",rt=I._fullLayout.title,ct=rt.y>.5?"t":"b",st={x:rt.x,y:rt.y,t:0,b:0},et={};rt.yref==="paper"&&c(I,rt,ct,F,N)?st[ct]=j:rt.yref==="container"&&(et[ct]=j,I._fullLayout._reservedMargin[G]=et),d.allowAutoMargin(I,G),d.autoMargin(I,G,st)}function P(I,F){var j=I.title,N=I._size,G=0;return(F===m?G=j.pad.l:F===l&&(G=-j.pad.r),j.xref)==="paper"?N.l+N.w*j.x+G:I.width*j.x+G}function z(I,F){var j=I.title,N=I._size,G=0;return F==="0em"||!F?G=-j.pad.b:F===a.CAP_SHIFT+"em"&&(G=j.pad.t),j.y==="auto"?N.t/2:j.yref==="paper"?N.t+N.h-N.h*j.y+G:I.height-I.height*j.y+G}function D(I){return I==="top"?a.CAP_SHIFT+.3+"em":I==="bottom"?"-0.3em":a.MID_SHIFT+"em"}function B(I){var F=I.title,j=w;return E.isRightAnchor(F)?j=l:E.isLeftAnchor(F)&&(j=m),j}function R(I){var F=I.title,j="0em";return E.isTopAnchor(F)?j=a.CAP_SHIFT+"em":E.isMiddleAnchor(F)&&(j=a.MID_SHIFT+"em"),j}K.doTraceStyle=function(I){var F=I.calcdata,j=[],N;for(N=0;N{var u=Ed().readPaths,d=Jy(),E=kd().clearOutlineControllers,A=Pi(),t=Eo(),e=cl().arrayEditor,r=zd(),i=r.getPathString;V.exports={draw:n,drawOne:a,activateLastSelection:v};function n(m){var w=m._fullLayout;E(m),w._selectionLayer.selectAll("path").remove();for(var l in w._plots){var x=w._plots[l].selectionLayer;x&&x.selectAll("path").remove()}for(var y=0;y=0;B--){var R=k.append("path").attr(T).style("opacity",B?.1:c).call(A.stroke,b).call(A.fill,h).call(t.dashLine,B?"solid":P,B?4+_:_);if(s(R,m,x),z){var I=e(m.layout,"selections",x);R.style({cursor:"move"});var F={element:R.node(),plotinfo:y,gd:m,editHelpers:I,isActiveSelection:!0},j=u(M,m);d(j,R,F)}else R.style("pointer-events",B?"all":"none");D[B]=R}var N=D[0],G=D[1];G.node().addEventListener("click",function(){return f(m,N)})}}function s(m,w,l){var x=l.xref+l.yref;t.setClipUrl(m,"clip"+w._fullLayout._uid+x,w)}function f(m,w){if(o(m)){var l=w.node(),x=+l.getAttribute("data-index");if(x>=0){if(x===m._fullLayout._activeSelectionIndex){g(m);return}m._fullLayout._activeSelectionIndex=x,m._fullLayout._deactivateSelection=g,n(m)}}}function v(m){if(o(m)){var w=m._fullLayout.selections.length-1;m._fullLayout._activeSelectionIndex=w,m._fullLayout._deactivateSelection=g,n(m)}}function g(m){if(o(m)){var w=m._fullLayout._activeSelectionIndex;w>=0&&(E(m),delete m._fullLayout._activeSelectionIndex,n(m))}}}),hk=Vt((K,V)=>{function u(){var d,E=0,A=!1;function t(e,r){return d.list.push({type:e,data:r?JSON.parse(JSON.stringify(r)):void 0}),d}return d={list:[],segmentId:function(){return E++},checkIntersection:function(e,r){return t("check",{seg1:e,seg2:r})},segmentChop:function(e,r){return t("div_seg",{seg:e,pt:r}),t("chop",{seg:e,pt:r})},statusRemove:function(e){return t("pop_seg",{seg:e})},segmentUpdate:function(e){return t("seg_update",{seg:e})},segmentNew:function(e,r){return t("new_seg",{seg:e,primary:r})},segmentRemove:function(e){return t("rem_seg",{seg:e})},tempStatus:function(e,r,i){return t("temp_status",{seg:e,above:r,below:i})},rewind:function(e){return t("rewind",{seg:e})},status:function(e,r,i){return t("status",{seg:e,above:r,below:i})},vert:function(e){return e===A?d:(A=e,t("vert",{x:e}))},log:function(e){return typeof e!="string"&&(e=JSON.stringify(e,!1," ")),t("log",{txt:e})},reset:function(){return t("reset")},selected:function(e){return t("selected",{segs:e})},chainStart:function(e){return t("chain_start",{seg:e})},chainRemoveHead:function(e,r){return t("chain_rem_head",{index:e,pt:r})},chainRemoveTail:function(e,r){return t("chain_rem_tail",{index:e,pt:r})},chainNew:function(e,r){return t("chain_new",{pt1:e,pt2:r})},chainMatch:function(e){return t("chain_match",{index:e})},chainClose:function(e){return t("chain_close",{index:e})},chainAddHead:function(e,r){return t("chain_add_head",{index:e,pt:r})},chainAddTail:function(e,r){return t("chain_add_tail",{index:e,pt:r})},chainConnect:function(e,r){return t("chain_con",{index1:e,index2:r})},chainReverse:function(e){return t("chain_rev",{index:e})},chainJoin:function(e,r){return t("chain_join",{index1:e,index2:r})},done:function(){return t("done")}},d}V.exports=u}),pk=Vt((K,V)=>{function u(d){typeof d!="number"&&(d=1e-10);var E={epsilon:function(A){return typeof A=="number"&&(d=A),d},pointAboveOrOnLine:function(A,t,e){var r=t[0],i=t[1],n=e[0],o=e[1],a=A[0],s=A[1];return(n-r)*(s-i)-(o-i)*(a-r)>=-d},pointBetween:function(A,t,e){var r=A[1]-t[1],i=e[0]-t[0],n=A[0]-t[0],o=e[1]-t[1],a=n*i+r*o;if(a-d)},pointsSameX:function(A,t){return Math.abs(A[0]-t[0])d!=n-r>d&&(i-s)*(r-f)/(n-f)+s-e>d&&(o=!o),i=s,n=f}return o}};return E}V.exports=u}),dk=Vt((K,V)=>{var u={create:function(){var d={root:{root:!0,next:null},exists:function(E){return!(E===null||E===d.root)},isEmpty:function(){return d.root.next===null},getHead:function(){return d.root.next},insertBefore:function(E,A){for(var t=d.root,e=d.root.next;e!==null;){if(A(e)){E.prev=e.prev,E.next=e,e.prev.next=E,e.prev=E;return}t=e,e=e.next}t.next=E,E.prev=t,E.next=null},findTransition:function(E){for(var A=d.root,t=d.root.next;t!==null&&!E(t);)A=t,t=t.next;return{before:A===d.root?null:A,after:t,insert:function(e){return e.prev=A,e.next=t,A.next=e,t!==null&&(t.prev=e),e}}}};return d},node:function(d){return d.prev=null,d.next=null,d.remove=function(){d.prev.next=d.next,d.next&&(d.next.prev=d.prev),d.prev=null,d.next=null},d}};V.exports=u}),mk=Vt((K,V)=>{var u=dk();function d(E,A,t){function e(w,l){return{id:t?t.segmentId():-1,start:w,end:l,myFill:{above:null,below:null},otherFill:null}}function r(w,l,x){return{id:t?t.segmentId():-1,start:w,end:l,myFill:{above:x.myFill.above,below:x.myFill.below},otherFill:null}}var i=u.create();function n(w,l,x,y,S,k){var M=A.pointsCompare(l,S);return M!==0?M:A.pointsSame(x,k)?0:w!==y?w?1:-1:A.pointAboveOrOnLine(x,y?S:k,y?k:S)?1:-1}function o(w,l){i.insertBefore(w,function(x){var y=n(w.isStart,w.pt,l,x.isStart,x.pt,x.other.pt);return y<0})}function a(w,l){var x=u.node({isStart:!0,pt:w.start,seg:w,primary:l,other:null,status:null});return o(x,w.end),x}function s(w,l,x){var y=u.node({isStart:!1,pt:l.end,seg:l,primary:x,other:w,status:null});w.other=y,o(y,w.pt)}function f(w,l){var x=a(w,l);return s(x,w,l),x}function v(w,l){t&&t.segmentChop(w.seg,l),w.other.remove(),w.seg.end=l,w.other.pt=l,o(w.other,w.pt)}function g(w,l){var x=r(l,w.seg.end,w.seg);return v(w,l),f(x,w.primary)}function m(w,l){var x=u.create();function y(R,I){var F=R.seg.start,j=R.seg.end,N=I.seg.start,G=I.seg.end;return A.pointsCollinear(F,N,G)?A.pointsCollinear(j,N,G)||A.pointAboveOrOnLine(j,N,G)?1:-1:A.pointAboveOrOnLine(F,N,G)?1:-1}function S(R){return x.findTransition(function(I){var F=y(R,I.ev);return F>0})}function k(R,I){var F=R.seg,j=I.seg,N=F.start,G=F.end,rt=j.start,ct=j.end;t&&t.checkIntersection(F,j);var st=A.linesIntersect(N,G,rt,ct);if(st===!1){if(!A.pointsCollinear(N,G,rt)||A.pointsSame(N,ct)||A.pointsSame(G,rt))return!1;var et=A.pointsSame(N,rt),Z=A.pointsSame(G,ct);if(et&&Z)return I;var ot=!et&&A.pointBetween(N,rt,ct),X=!Z&&A.pointBetween(G,rt,ct);if(et)return X?g(I,G):g(R,ct),I;ot&&(Z||(X?g(I,G):g(R,ct)),g(I,N))}else st.alongA===0&&(st.alongB===-1?g(R,rt):st.alongB===0?g(R,st.pt):st.alongB===1&&g(R,ct)),st.alongB===0&&(st.alongA===-1?g(I,N):st.alongA===0?g(I,st.pt):st.alongA===1&&g(I,G));return!1}for(var M=[];!i.isEmpty();){var T=i.getHead();if(t&&t.vert(T.pt[0]),T.isStart){let R=function(){if(h){var I=k(T,h);if(I)return I}return b?k(T,b):!1};t&&t.segmentNew(T.seg,T.primary);var c=S(T),h=c.before?c.before.ev:null,b=c.after?c.after.ev:null;t&&t.tempStatus(T.seg,h?h.seg:!1,b?b.seg:!1);var _=R();if(_){if(E){var P;T.seg.myFill.below===null?P=!0:P=T.seg.myFill.above!==T.seg.myFill.below,P&&(_.seg.myFill.above=!_.seg.myFill.above)}else _.seg.otherFill=T.seg.myFill;t&&t.segmentUpdate(_.seg),T.other.remove(),T.remove()}if(i.getHead()!==T){t&&t.rewind(T.seg);continue}if(E){var P;T.seg.myFill.below===null?P=!0:P=T.seg.myFill.above!==T.seg.myFill.below,b?T.seg.myFill.below=b.seg.myFill.above:T.seg.myFill.below=w,P?T.seg.myFill.above=!T.seg.myFill.below:T.seg.myFill.above=T.seg.myFill.below}else if(T.seg.otherFill===null){var z;b?T.primary===b.primary?z=b.seg.otherFill.above:z=b.seg.myFill.above:z=T.primary?l:w,T.seg.otherFill={above:z,below:z}}t&&t.status(T.seg,h?h.seg:!1,b?b.seg:!1),T.other.status=c.insert(u.node({ev:T}))}else{var D=T.status;if(D===null)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(x.exists(D.prev)&&x.exists(D.next)&&k(D.prev.ev,D.next.ev),t&&t.statusRemove(D.ev.seg),D.remove(),!T.primary){var B=T.seg.myFill;T.seg.myFill=T.seg.otherFill,T.seg.otherFill=B}M.push(T.seg)}i.getHead().remove()}return t&&t.done(),M}return E?{addRegion:function(w){for(var l,x=w[w.length-1],y=0;y{function u(d,E,A){var t=[],e=[];return d.forEach(function(r){var i=r.start,n=r.end;if(E.pointsSame(i,n)){console.warn("PolyBool: Warning: Zero-length segment detected; your epsilon is probably too small or too large");return}A&&A.chainStart(r);var o={index:0,matches_head:!1,matches_pt1:!1},a={index:0,matches_head:!1,matches_pt1:!1},s=o;function f(z,D,B){return s.index=z,s.matches_head=D,s.matches_pt1=B,s===o?(s=a,!1):(s=null,!0)}for(var v=0;v{function u(E,A,t){var e=[];return E.forEach(function(r){var i=(r.myFill.above?8:0)+(r.myFill.below?4:0)+(r.otherFill&&r.otherFill.above?2:0)+(r.otherFill&&r.otherFill.below?1:0);A[i]!==0&&e.push({id:t?t.segmentId():-1,start:r.start,end:r.end,myFill:{above:A[i]===1,below:A[i]===2},otherFill:null})}),t&&t.selected(e),e}var d={union:function(E,A){return u(E,[0,2,1,0,2,2,0,0,1,0,1,0,0,0,0,0],A)},intersect:function(E,A){return u(E,[0,0,0,0,0,2,0,2,0,0,1,1,0,2,1,0],A)},difference:function(E,A){return u(E,[0,0,0,0,2,0,2,0,1,1,0,0,0,1,2,0],A)},differenceRev:function(E,A){return u(E,[0,2,1,0,0,0,1,1,0,2,0,2,0,0,0,0],A)},xor:function(E,A){return u(E,[0,2,1,0,2,0,0,1,1,0,0,2,0,1,2,0],A)}};V.exports=d}),yk=Vt((K,V)=>{var u={toPolygon:function(d,E){function A(r){if(r.length<=0)return d.segments({inverted:!1,regions:[]});function i(a){var s=a.slice(0,a.length-1);return d.segments({inverted:!1,regions:[s]})}for(var n=i(r[0]),o=1;o{var u=hk(),d=pk(),E=mk(),A=gk(),t=vk(),e=yk(),r=!1,i=d(),n;n={buildLog:function(a){return a===!0?r=u():a===!1&&(r=!1),r===!1?!1:r.list},epsilon:function(a){return i.epsilon(a)},segments:function(a){var s=E(!0,i,r);return a.regions.forEach(s.addRegion),{segments:s.calculate(a.inverted),inverted:a.inverted}},combine:function(a,s){var f=E(!1,i,r);return{combined:f.calculate(a.segments,a.inverted,s.segments,s.inverted),inverted1:a.inverted,inverted2:s.inverted}},selectUnion:function(a){return{segments:t.union(a.combined,r),inverted:a.inverted1||a.inverted2}},selectIntersect:function(a){return{segments:t.intersect(a.combined,r),inverted:a.inverted1&&a.inverted2}},selectDifference:function(a){return{segments:t.difference(a.combined,r),inverted:a.inverted1&&!a.inverted2}},selectDifferenceRev:function(a){return{segments:t.differenceRev(a.combined,r),inverted:!a.inverted1&&a.inverted2}},selectXor:function(a){return{segments:t.xor(a.combined,r),inverted:a.inverted1!==a.inverted2}},polygon:function(a){return{regions:A(a.segments,i,r),inverted:a.inverted}},polygonFromGeoJSON:function(a){return e.toPolygon(n,a)},polygonToGeoJSON:function(a){return e.fromPolygon(n,i,a)},union:function(a,s){return o(a,s,n.selectUnion)},intersect:function(a,s){return o(a,s,n.selectIntersect)},difference:function(a,s){return o(a,s,n.selectDifference)},differenceRev:function(a,s){return o(a,s,n.selectDifferenceRev)},xor:function(a,s){return o(a,s,n.selectXor)}};function o(a,s,f){var v=n.segments(a),g=n.segments(s),m=n.combine(v,g),w=f(m);return n.polygon(w)}typeof window=="object"&&(window.PolyBool=n),V.exports=n}),_k=Vt((K,V)=>{V.exports=function(u,d,E,A){var t=u[0],e=u[1],r=!1;E===void 0&&(E=0),A===void 0&&(A=d.length);for(var i=A-E,n=0,o=i-1;ne!=v>e&&t<(f-a)*(e-s)/(v-s)+a;g&&(r=!r)}return r}}),qg=Vt((K,V)=>{var u=Ny().dot,d=ks().BADNUM,E=V.exports={};E.tester=function(A){var t=A.slice(),e=t[0][0],r=e,i=t[0][1],n=i,o;for((t[t.length-1][0]!==t[0][0]||t[t.length-1][1]!==t[0][1])&&t.push(t[0]),o=1;or||y===d||yn||l&&s(w))}function v(w,l){var x=w[0],y=w[1];if(x===d||xr||y===d||yn)return!1;var S=t.length,k=t[0][0],M=t[0][1],T=0,c,h,b,_,P;for(c=1;cMath.max(h,k)||y>Math.max(b,M)))if(yo||Math.abs(u(v,s))>r)return!0;return!1},E.filter=function(A,t){var e=[A[0]],r=0,i=0;function n(a){A.push(a);var s=e.length,f=r;e.splice(i+1);for(var v=f+1;v1){var o=A.pop();n(o)}return{addPt:n,raw:A,filtered:e}}}),bk=Vt((K,V)=>{V.exports={BENDPX:1.5,MINSELECT:12,SELECTDELAY:100,SELECTID:"-select"}}),wk=Vt((K,V)=>{var u=xk(),d=_k(),E=ji(),A=Eo().dashStyle,t=Pi(),e=pc(),r=mh().makeEventData,i=$h(),n=i.freeMode,o=i.rectMode,a=i.drawMode,s=i.openMode,f=i.selectMode,v=zd(),g=Vg(),m=Jy(),w=kd().clearOutline,l=Ed(),x=l.handleEllipse,y=l.readPaths,S=$y().newShapes,k=Ab(),M=Ib().activateLastSelection,T=Xr(),c=T.sorterAsc,h=qg(),b=Hy(),_=fc().getFromId,P=Ug(),z=Hg().redrawReglTraces,D=bk(),B=D.MINSELECT,R=h.filter,I=h.tester,F=Xy(),j=F.p2r,N=F.axValue,G=F.getTransform;function rt(Dt){return Dt.subplot!==void 0}function ct(Dt,qt,_t,lt,yt){var St=!rt(lt),Ht=n(yt),Yt=o(yt),se=s(yt),ke=a(yt),Ee=f(yt),Ue=yt==="drawline",ir=yt==="drawcircle",ar=Ue||ir,Ye=lt.gd,Er=Ye._fullLayout,pn=Ee&&Er.newselection.mode==="immediate"&&St,dn=Er._zoomlayer,bn=lt.element.getBoundingClientRect(),Zn=lt.plotinfo,En=G(Zn),gn=qt-bn.left,da=_t-bn.top;Er._calcInverseTransform(Ye);var ra=T.apply3DTransform(Er._invTransform)(gn,da);gn=ra[0],da=ra[1];var Se=Er._invScaleX,Re=Er._invScaleY,Ze=gn,tr=da,zr="M"+gn+","+da,tn=lt.xaxes[0],Yr=lt.yaxes[0],$r=tn._length,In=Yr._length,Nn=Dt.altKey&&!(a(yt)&&se),Kn,$n,ia,Cn,Fa,Ga,ve;Q(Dt,Ye,lt),Ht&&(Kn=R([[gn,da]],D.BENDPX));var ge=dn.selectAll("path.select-outline-"+Zn.id).data([1]),dr=ke?Er.newshape:Er.newselection;ke&&(lt.hasText=dr.label.text||dr.label.texttemplate);var br=ke&&!se?dr.fillcolor:"rgba(0,0,0,0)",Tr=dr.line.color||(St?t.contrast(Ye._fullLayout.plot_bgcolor):"#7f7f7f");ge.enter().append("path").attr("class","select-outline select-outline-"+Zn.id).style({opacity:ke?dr.opacity/2:1,"stroke-dasharray":A(dr.line.dash,dr.line.width),"stroke-width":dr.line.width+"px","shape-rendering":"crispEdges"}).call(t.stroke,Tr).call(t.fill,br).attr("fill-rule","evenodd").classed("cursor-move",!!ke).attr("transform",En).attr("d",zr+"Z");var mr=dn.append("path").attr("class","zoombox-corners").style({fill:t.background,stroke:t.defaultLine,"stroke-width":1}).attr("transform",En).attr("d","M0,0Z");if(ke&<.hasText){var kr=dn.select(".label-temp");kr.empty()&&(kr=dn.append("g").classed("label-temp",!0).classed("select-outline",!0).style({opacity:.8}))}var Ur=Er._uid+D.SELECTID,Or=[],pe=nt(Ye,lt.xaxes,lt.yaxes,lt.subplot);pn&&!Dt.shiftKey&&(lt._clearSubplotSelections=function(){if(St){var xr=tn._id,Gr=Yr._id;Kt(Ye,xr,Gr,pe);for(var ln=(Ye.layout||{}).selections||[],wn=[],rn=!1,Qr=0;Qr=0){Ye._fullLayout._deactivateShape(Ye);return}if(!ke){var ln=Er.clickmode;b.done(Ur).then(function(){if(b.clear(Ur),xr===2){for(ge.remove(),Fa=0;Fa-1&&st(Gr,Ye,lt.xaxes,lt.yaxes,lt.subplot,lt,ge),ln==="event"&&Ir(Ye,void 0);e.click(Ye,Gr,Zn.id)}).catch(T.error)}},lt.doneFn=function(){mr.remove(),b.done(Ur).then(function(){b.clear(Ur),!pn&&Cn&<.selectionDefs&&(Cn.subtract=Nn,lt.selectionDefs.push(Cn),lt.mergedPolygons.length=0,[].push.apply(lt.mergedPolygons,ia)),(pn||ke)&&q(lt,pn),lt.doneFnCompleted&<.doneFnCompleted(Or),Ee&&Ir(Ye,ve)}).catch(T.error)}}function st(Dt,qt,_t,lt,yt,St,Ht){var Yt=qt._hoverdata,se=qt._fullLayout,ke=se.clickmode,Ee=ke.indexOf("event")>-1,Ue=[],ir,ar,Ye,Er,pn,dn,bn,Zn,En,gn;if(Tt(Yt)){Q(Dt,qt,St),ir=nt(qt,_t,lt,yt);var da=wt(Yt,ir),ra=da.pointNumbers.length>0;if(ra?It(ir,da):Nt(ir)&&(bn=Ct(da))){for(Ht&&Ht.remove(),gn=0;gn=0}function J(Dt){return Dt._fullLayout._activeSelectionIndex>=0}function q(Dt,qt){var _t=Dt.dragmode,lt=Dt.plotinfo,yt=Dt.gd;ut(yt)&&yt._fullLayout._deactivateShape(yt),J(yt)&&yt._fullLayout._deactivateSelection(yt);var St=yt._fullLayout,Ht=St._zoomlayer,Yt=a(_t),se=f(_t);if(Yt||se){var ke=Ht.selectAll(".select-outline-"+lt.id);if(ke&&yt._fullLayout._outlining){var Ee;Yt&&(Ee=S(ke,Dt)),Ee&&E.call("_guiRelayout",yt,{shapes:Ee});var Ue;se&&!rt(Dt)&&(Ue=k(ke,Dt)),Ue&&(yt._fullLayout._noEmitSelectedAtStart=!0,E.call("_guiRelayout",yt,{selections:Ue}).then(function(){qt&&M(yt)})),yt._fullLayout._outlining=!1}}lt.selection={},lt.selection.selectionDefs=Dt.selectionDefs=[],lt.selection.mergedPolygons=Dt.mergedPolygons=[]}function it(Dt){return Dt._id}function nt(Dt,qt,_t,lt){if(!Dt.calcdata)return[];var yt=[],St=qt.map(it),Ht=_t.map(it),Yt,se,ke;for(ke=0;ke0,St=yt?lt[0]:_t;return qt.selectedpoints?qt.selectedpoints.indexOf(St)>-1:!1}function It(Dt,qt){var _t=[],lt,yt,St,Ht;for(Ht=0;Ht0&&_t.push(lt);if(_t.length===1&&(St=_t[0]===qt.searchInfo,St&&(yt=qt.searchInfo.cd[0].trace,yt.selectedpoints.length===qt.pointNumbers.length))){for(Ht=0;Ht1||(qt+=lt.selectedpoints.length,qt>1)))return!1;return qt===1}function te(Dt,qt,_t){var lt;for(lt=0;lt-1&&qt;if(!Ht&&qt){var xr=Me(Dt,!0);if(xr.length){var Gr=xr[0].xref,ln=xr[0].yref;if(Gr&&ln){var wn=qe(xr),rn=_r([_(Dt,Gr,"x"),_(Dt,ln,"y")]);rn(Or,wn)}}Dt._fullLayout._noEmitSelectedAtStart?Dt._fullLayout._noEmitSelectedAtStart=!1:Ke&&Ir(Dt,Or),ir._reselect=!1}if(!Ht&&ir._deselect){var Qr=ir._deselect;Yt=Qr.xref,se=Qr.yref,re(Yt,se,Ee)||Kt(Dt,Yt,se,lt),Ke&&(Or.points.length?Ir(Dt,Or):de(Dt)),ir._deselect=!1}return{eventData:Or,selectionTesters:_t}}function Ut(Dt){var qt=Dt.calcdata;if(qt)for(var _t=0;_t{V.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0,noRotate:!0},{path:"M2,2V-2H-2V2Z",backoff:0,noRotate:!0}]}),Wg=Vt((K,V)=>{V.exports={axisRefDescription:function(u,d,E){return["If set to a",u,"axis id (e.g. *"+u+"* or","*"+u+"2*), the `"+u+"` position refers to a",u,"coordinate. If set to *paper*, the `"+u+"`","position refers to the distance from the",d,"of the plotting","area in normalized coordinates where *0* (*1*) corresponds to the",d,"("+E+"). If set to a",u,"axis ID followed by","*domain* (separated by a space), the position behaves like for","*paper*, but refers to the distance in fractions of the domain","length from the",d,"of the domain of that axis: e.g.,","*"+u+"2 domain* refers to the domain of the second",u," axis and a",u,"position of 0.5 refers to the","point between the",d,"and the",E,"of the domain of the","second",u,"axis."].join(" ")}}}),h0=Vt((K,V)=>{var u=Pb(),d=yu(),E=Mf(),A=cl().templatedArray;Wg(),V.exports=A("annotation",{visible:{valType:"boolean",dflt:!0,editType:"calc+arraydraw"},text:{valType:"string",editType:"calc+arraydraw"},textangle:{valType:"angle",dflt:0,editType:"calc+arraydraw"},font:d({editType:"calc+arraydraw",colorEditType:"arraydraw"}),width:{valType:"number",min:1,dflt:null,editType:"calc+arraydraw"},height:{valType:"number",min:1,dflt:null,editType:"calc+arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},align:{valType:"enumerated",values:["left","center","right"],dflt:"center",editType:"arraydraw"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle",editType:"arraydraw"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},borderpad:{valType:"number",min:0,dflt:1,editType:"calc+arraydraw"},borderwidth:{valType:"number",min:0,dflt:1,editType:"calc+arraydraw"},showarrow:{valType:"boolean",dflt:!0,editType:"calc+arraydraw"},arrowcolor:{valType:"color",editType:"arraydraw"},arrowhead:{valType:"integer",min:0,max:u.length,dflt:1,editType:"arraydraw"},startarrowhead:{valType:"integer",min:0,max:u.length,dflt:1,editType:"arraydraw"},arrowside:{valType:"flaglist",flags:["end","start"],extras:["none"],dflt:"end",editType:"arraydraw"},arrowsize:{valType:"number",min:.3,dflt:1,editType:"calc+arraydraw"},startarrowsize:{valType:"number",min:.3,dflt:1,editType:"calc+arraydraw"},arrowwidth:{valType:"number",min:.1,editType:"calc+arraydraw"},standoff:{valType:"number",min:0,dflt:0,editType:"calc+arraydraw"},startstandoff:{valType:"number",min:0,dflt:0,editType:"calc+arraydraw"},ax:{valType:"any",editType:"calc+arraydraw"},ay:{valType:"any",editType:"calc+arraydraw"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",E.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",E.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",E.idRegex.x.toString()],editType:"calc"},x:{valType:"any",editType:"calc+arraydraw"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto",editType:"calc+arraydraw"},xshift:{valType:"number",dflt:0,editType:"calc+arraydraw"},yref:{valType:"enumerated",values:["paper",E.idRegex.y.toString()],editType:"calc"},y:{valType:"any",editType:"calc+arraydraw"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"calc+arraydraw"},yshift:{valType:"number",dflt:0,editType:"calc+arraydraw"},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1,editType:"arraydraw"},xclick:{valType:"any",editType:"arraydraw"},yclick:{valType:"any",editType:"arraydraw"},hovertext:{valType:"string",editType:"arraydraw"},hoverlabel:{bgcolor:{valType:"color",editType:"arraydraw"},bordercolor:{valType:"color",editType:"arraydraw"},font:d({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc"})}),vp=Vt((K,V)=>{V.exports={PTS_LINESONLY:20,minTolerance:.2,toleranceGrowth:10,maxScreensAway:20,eventDataKeys:[]}}),Jh=Vt((K,V)=>{V.exports=function(u){return{valType:"color",editType:"style",anim:!0}}}),dc=Vt((K,V)=>{var u=hc().axisHoverFormat,{hovertemplateAttrs:d,texttemplateAttrs:E,templatefallbackAttrs:A}=yl(),t=Wl(),e=yu(),r=If().dash,i=If().pattern,n=Eo(),o=vp(),a=So().extendFlat,s=Jh();function f(m){return{valType:"any",dflt:0,editType:"calc"}}function v(m){return{valType:"any",editType:"calc"}}function g(m){return{valType:"enumerated",values:["start","middle","end"],dflt:"middle",editType:"calc"}}V.exports={x:{valType:"data_array",editType:"calc+clearAxisTypes",anim:!0},x0:{valType:"any",dflt:0,editType:"calc+clearAxisTypes",anim:!0},dx:{valType:"number",dflt:1,editType:"calc",anim:!0},y:{valType:"data_array",editType:"calc+clearAxisTypes",anim:!0},y0:{valType:"any",dflt:0,editType:"calc+clearAxisTypes",anim:!0},dy:{valType:"number",dflt:1,editType:"calc",anim:!0},xperiod:f(),yperiod:f(),xperiod0:v(),yperiod0:v(),xperiodalignment:g(),yperiodalignment:g(),xhoverformat:u("x"),yhoverformat:u("y"),offsetgroup:{valType:"string",dflt:"",editType:"calc"},alignmentgroup:{valType:"string",dflt:"",editType:"calc"},stackgroup:{valType:"string",dflt:"",editType:"calc"},orientation:{valType:"enumerated",values:["v","h"],editType:"calc"},groupnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},stackgaps:{valType:"enumerated",values:["infer zero","interpolate"],dflt:"infer zero",editType:"calc"},text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},texttemplate:E(),texttemplatefallback:A({editType:"calc"}),hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"style"},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"],editType:"calc"},hoveron:{valType:"flaglist",flags:["points","fills"],editType:"style"},hovertemplate:d({},{keys:o.eventDataKeys}),hovertemplatefallback:A(),line:{color:{valType:"color",editType:"style",anim:!0},width:{valType:"number",min:0,dflt:2,editType:"style",anim:!0},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear",editType:"plot"},smoothing:{valType:"number",min:0,max:1.3,dflt:1,editType:"plot"},dash:a({},r,{editType:"style"}),backoff:{valType:"number",min:0,dflt:"auto",arrayOk:!0,editType:"plot"},simplify:{valType:"boolean",dflt:!0,editType:"plot"},editType:"plot"},connectgaps:{valType:"boolean",dflt:!1,editType:"calc"},cliponaxis:{valType:"boolean",dflt:!0,editType:"plot"},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],editType:"calc"},fillcolor:s(!0),fillgradient:a({type:{valType:"enumerated",values:["radial","horizontal","vertical","none"],dflt:"none",editType:"calc"},start:{valType:"number",editType:"calc"},stop:{valType:"number",editType:"calc"},colorscale:{valType:"colorscale",editType:"style"},editType:"calc"}),fillpattern:i,marker:a({symbol:{valType:"enumerated",values:n.symbolList,dflt:"circle",arrayOk:!0,editType:"style"},opacity:{valType:"number",min:0,max:1,arrayOk:!0,editType:"style",anim:!0},angle:{valType:"angle",dflt:0,arrayOk:!0,editType:"plot",anim:!1},angleref:{valType:"enumerated",values:["previous","up"],dflt:"up",editType:"plot",anim:!1},standoff:{valType:"number",min:0,dflt:0,arrayOk:!0,editType:"plot",anim:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0,editType:"calc",anim:!0},maxdisplayed:{valType:"number",min:0,dflt:0,editType:"plot"},sizeref:{valType:"number",dflt:1,editType:"calc"},sizemin:{valType:"number",min:0,dflt:0,editType:"calc"},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter",editType:"calc"},line:a({width:{valType:"number",min:0,arrayOk:!0,editType:"style",anim:!0},editType:"calc"},t("marker.line",{anim:!0})),gradient:{type:{valType:"enumerated",values:["radial","horizontal","vertical","none"],arrayOk:!0,dflt:"none",editType:"calc"},color:{valType:"color",arrayOk:!0,editType:"calc"},editType:"calc"},editType:"calc"},t("marker",{anim:!0})),selected:{marker:{opacity:{valType:"number",min:0,max:1,editType:"style"},color:{valType:"color",editType:"style"},size:{valType:"number",min:0,editType:"style"},editType:"style"},textfont:{color:{valType:"color",editType:"style"},editType:"style"},editType:"style"},unselected:{marker:{opacity:{valType:"number",min:0,max:1,editType:"style"},color:{valType:"color",editType:"style"},size:{valType:"number",min:0,editType:"style"},editType:"style"},textfont:{color:{valType:"color",editType:"style"},editType:"style"},editType:"style"},textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0,editType:"calc"},textfont:e({editType:"calc",colorEditType:"style",arrayOk:!0}),zorder:{valType:"integer",dflt:0,editType:"plot"}}}),Ob=Vt((K,V)=>{var u=h0(),d=dc().line,E=If().dash,A=So().extendFlat,t=Cu().overrideAll,e=cl().templatedArray;Wg(),V.exports=t(e("selection",{type:{valType:"enumerated",values:["rect","path"]},xref:A({},u.xref,{}),yref:A({},u.yref,{}),x0:{valType:"any"},x1:{valType:"any"},y0:{valType:"any"},y1:{valType:"any"},path:{valType:"string",editType:"arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:.7,editType:"arraydraw"},line:{color:d.color,width:A({},d.width,{min:1,dflt:1}),dash:A({},E,{dflt:"dot"})}}),"arraydraw","from-root")}),Tk=Vt((K,V)=>{var u=Xr(),d=yo(),E=Gf(),A=Ob(),t=zd();V.exports=function(r,i){E(r,i,{name:"selections",handleItemDefaults:e});for(var n=i.selections,o=0;o{V.exports=function(u,d,E){E("newselection.mode");var A=E("newselection.line.width");A&&(E("newselection.line.color"),E("newselection.line.dash")),E("activeselection.fillcolor"),E("activeselection.opacity")}}),Gg=Vt((K,V)=>{var u=ji(),d=Xr(),E=fc();V.exports=function(A){return function(t,e){var r=t[A];if(Array.isArray(r))for(var i=u.subplotsRegistry.cartesian,n=i.idRegex,o=e._subplots,a=o.xaxis,s=o.yaxis,f=o.cartesian,v=e._has("cartesian"),g=0;g{var u=Ib(),d=wk();V.exports={moduleType:"component",name:"selections",layoutAttributes:Ob(),supplyLayoutDefaults:Tk(),supplyDrawNewSelectionDefaults:kk(),includeBasePlot:Gg()("selections"),draw:u.draw,drawOne:u.drawOne,reselect:d.reselect,prepSelect:d.prepSelect,clearOutline:d.clearOutline,clearSelectionsCache:d.clearSelectionsCache,selectOnClick:d.selectOnClick}}),Db=Vt((K,V)=>{var u=Ni(),d=Xr(),E=d.numberFormat,A=Af(),t=Gy(),e=ji(),r=d.strTranslate,i=Dl(),n=Pi(),o=Eo(),a=pc(),s=yo(),f=Xh(),v=oh(),g=$h(),m=g.selectingOrDrawing,w=g.freeMode,l=gf().FROM_TL,x=Ug(),y=Hg().redrawReglTraces,S=Vu(),k=fc().getFromId,M=Ec().prepSelect,T=Ec().clearOutline,c=Ec().selectOnClick,h=Cb(),b=Mf(),_=b.MINDRAG,P=b.MINZOOM,z=!0;function D(dt,Tt,wt,Ct,It,Nt,te,Jt){var ee=dt._fullLayout._zoomlayer,Zt=te+Jt==="nsew",mt=(te+Jt).length===1,bt,vt,Ut,re,Kt,ue,Me,Ce,We,qe,vr,_r,er,Mr,Ir,de,Dt,qt,_t,lt,yt,St,Ht;wt+=Tt.yaxis._shift;function Yt(){if(bt=Tt.xaxis,vt=Tt.yaxis,We=bt._length,qe=vt._length,Me=bt._offset,Ce=vt._offset,Ut={},Ut[bt._id]=bt,re={},re[vt._id]=vt,te&&Jt)for(var ge=Tt.overlays,dr=0;dr=0){br._fullLayout._deactivateShape(br);return}var Tr=br._fullLayout.clickmode;if(ot(br),ge===2&&!mt&&$n(),Zt)Tr.indexOf("select")>-1&&c(dr,br,Kt,ue,Tt.id,Ee),Tr.indexOf("event")>-1&&a.click(br,dr,Tt.id);else if(ge===1&&mt){var mr=te?vt:bt,kr=te==="s"||Jt==="w"?0:1,Ur=mr._name+".range["+kr+"]",Or=F(mr,kr),pe="left",Ke="middle";if(mr.fixedrange)return;te?(Ke=te==="n"?"top":"bottom",mr.side==="right"&&(pe="right")):Jt==="e"&&(pe="right"),br._context.showAxisRangeEntryBoxes&&u.select(ke).call(i.makeEditable,{gd:br,immediate:!0,background:br._fullLayout.paper_bgcolor,text:String(Or),fill:mr.tickfont?mr.tickfont.color:"#444",horizontalAlign:pe,verticalAlign:Ke}).on("edit",function(xr){var Gr=mr.d2r(xr);Gr!==void 0&&e.call("_guiRelayout",br,Ur,Gr)})}}v.init(Ee);var ar,Ye,Er,pn,dn,bn,Zn,En,gn,da;function ra(ge,dr,br){var Tr=ke.getBoundingClientRect();ar=dr-Tr.left,Ye=br-Tr.top,dt._fullLayout._calcInverseTransform(dt);var mr=d.apply3DTransform(dt._fullLayout._invTransform)(ar,Ye);ar=mr[0],Ye=mr[1],Er={l:ar,r:ar,w:0,t:Ye,b:Ye,h:0},pn=dt._hmpixcount?dt._hmlumcount/dt._hmpixcount:A(dt._fullLayout.plot_bgcolor).getLuminance(),dn="M0,0H"+We+"V"+qe+"H0V0",bn=!1,Zn="xy",da=!1,En=ct(ee,pn,Me,Ce,dn),gn=st(ee,Me,Ce)}function Se(ge,dr){if(dt._transitioningWithDuration)return!1;var br=Math.max(0,Math.min(We,St*ge+ar)),Tr=Math.max(0,Math.min(qe,Ht*dr+Ye)),mr=Math.abs(br-ar),kr=Math.abs(Tr-Ye);Er.l=Math.min(ar,br),Er.r=Math.max(ar,br),Er.t=Math.min(Ye,Tr),Er.b=Math.max(Ye,Tr);function Ur(){Zn="",Er.r=Er.l,Er.t=Er.b,gn.attr("d","M0,0Z")}if(vr.isSubplotConstrained)mr>P||kr>P?(Zn="xy",mr/We>kr/qe?(kr=mr*qe/We,Ye>Tr?Er.t=Ye-kr:Er.b=Ye+kr):(mr=kr*We/qe,ar>br?Er.l=ar-mr:Er.r=ar+mr),gn.attr("d",J(Er))):Ur();else if(_r.isSubplotConstrained)if(mr>P||kr>P){Zn="xy";var Or=Math.min(Er.l/We,(qe-Er.b)/qe),pe=Math.max(Er.r/We,(qe-Er.t)/qe);Er.l=Or*We,Er.r=pe*We,Er.b=(1-Or)*qe,Er.t=(1-pe)*qe,gn.attr("d",J(Er))}else Ur();else!Mr||kr0){var xr;if(_r.isSubplotConstrained||!er&&Mr.length===1){for(xr=0;xr1&&(Ur.maxallowed!==void 0&&de===(Ur.range[0]1&&(Or.maxallowed!==void 0&&Dt===(Or.range[0]=0?Math.min(dt,.9):1/(1/Math.max(dt,-.3)+3.222))}function rt(dt,Tt,wt){return dt?dt==="nsew"?wt?"":Tt==="pan"?"move":"crosshair":dt.toLowerCase()+"-resize":"pointer"}function ct(dt,Tt,wt,Ct,It){return dt.append("path").attr("class","zoombox").style({fill:Tt>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform",r(wt,Ct)).attr("d",It+"Z")}function st(dt,Tt,wt){return dt.append("path").attr("class","zoombox-corners").style({fill:n.background,stroke:n.defaultLine,"stroke-width":1,opacity:0}).attr("transform",r(Tt,wt)).attr("d","M0,0Z")}function et(dt,Tt,wt,Ct,It,Nt){dt.attr("d",Ct+"M"+wt.l+","+wt.t+"v"+wt.h+"h"+wt.w+"v-"+wt.h+"h-"+wt.w+"Z"),Z(dt,Tt,It,Nt)}function Z(dt,Tt,wt,Ct){wt||(dt.transition().style("fill",Ct>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),Tt.transition().style("opacity",1).duration(200))}function ot(dt){u.select(dt).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function X(dt){z&&dt.data&&dt._context.showTips&&(d.notifier(d._(dt,"Double-click to zoom back out"),"long"),z=!1)}function Q(dt,Tt){return"M"+(dt.l-.5)+","+(Tt-P-.5)+"h-3v"+(2*P+1)+"h3ZM"+(dt.r+.5)+","+(Tt-P-.5)+"h3v"+(2*P+1)+"h-3Z"}function ut(dt,Tt){return"M"+(Tt-P-.5)+","+(dt.t-.5)+"v-3h"+(2*P+1)+"v3ZM"+(Tt-P-.5)+","+(dt.b+.5)+"v3h"+(2*P+1)+"v-3Z"}function J(dt){var Tt=Math.floor(Math.min(dt.b-dt.t,dt.r-dt.l,P)/2);return"M"+(dt.l-3.5)+","+(dt.t-.5+Tt)+"h3v"+-Tt+"h"+Tt+"v-3h-"+(Tt+3)+"ZM"+(dt.r+3.5)+","+(dt.t-.5+Tt)+"h-3v"+-Tt+"h"+-Tt+"v-3h"+(Tt+3)+"ZM"+(dt.r+3.5)+","+(dt.b+.5-Tt)+"h-3v"+Tt+"h"+-Tt+"v3h"+(Tt+3)+"ZM"+(dt.l-3.5)+","+(dt.b+.5-Tt)+"h3v"+Tt+"h"+Tt+"v3h-"+(Tt+3)+"Z"}function q(dt,Tt,wt,Ct,It){for(var Nt=!1,te={},Jt={},ee,Zt,mt,bt,vt=(It||{}).xaHash,Ut=(It||{}).yaHash,re=0;re{var V=Ni(),u=pc(),d=oh(),E=Xh(),A=Db().makeDragBox,t=Mf().DRAGGERSIZE;K.initInteractions=function(e){var r=e._fullLayout;if(e._context.staticPlot){V.select(e).selectAll(".drag").remove();return}if(!(!r._has("cartesian")&&!r._has("splom"))){var i=Object.keys(r._plots||{}).sort(function(o,a){if((r._plots[o].mainplot&&!0)===(r._plots[a].mainplot&&!0)){var s=o.split("y"),f=a.split("y");return s[0]===f[0]?Number(s[1]||1)-Number(f[1]||1):Number(s[0]||1)-Number(f[0]||1)}return r._plots[o].mainplot?1:-1});i.forEach(function(o){var a=r._plots[o],s=a.xaxis,f=a.yaxis;if(!a.mainplot){var v=A(e,a,s._offset,f._offset,s._length,f._length,"ns","ew");v.onmousemove=function(w){e._fullLayout._rehover=function(){e._fullLayout._hoversubplot===o&&e._fullLayout._plots[o]&&u.hover(e,w,o)},u.hover(e,w,o),e._fullLayout._lasthover=v,e._fullLayout._hoversubplot=o},v.onmouseout=function(w){e._dragging||(e._fullLayout._hoversubplot=null,d.unhover(e,w))},e._context.showAxisDragHandles&&(A(e,a,s._offset-t,f._offset-t,t,t,"n","w"),A(e,a,s._offset+s._length,f._offset-t,t,t,"n","e"),A(e,a,s._offset-t,f._offset+f._length,t,t,"s","w"),A(e,a,s._offset+s._length,f._offset+f._length,t,t,"s","e"))}if(e._context.showAxisDragHandles){if(o===s._mainSubplot){var g=s._mainLinePosition;s.side==="top"&&(g-=t),A(e,a,s._offset+s._length*.1,g,s._length*.8,t,"","ew"),A(e,a,s._offset,g,s._length*.1,t,"","w"),A(e,a,s._offset+s._length*.9,g,s._length*.1,t,"","e")}if(o===f._mainSubplot){var m=f._mainLinePosition;f.side!=="right"&&(m-=t),A(e,a,m,f._offset+f._length*.1,t,f._length*.8,"ns",""),A(e,a,m,f._offset+f._length*.9,t,f._length*.1,"s",""),A(e,a,m,f._offset,t,f._length*.1,"n","")}}});var n=r._hoverlayer.node();n.onmousemove=function(o){o.target=e._fullLayout._lasthover,u.hover(e,o,r._hoversubplot)},n.onclick=function(o){o.target=e._fullLayout._lasthover,u.click(e,o)},n.onmousedown=function(o){e._fullLayout._lasthover.onmousedown(o)},K.updateFx(e)}},K.updateFx=function(e){var r=e._fullLayout,i=r.dragmode==="pan"?"move":"crosshair";E(r._draggers,i)}}),Ak=Vt((K,V)=>{var u=ji();V.exports=function(d){for(var E=u.layoutArrayContainers,A=u.layoutArrayRegexes,t=d.split("[")[0],e,r,i=0;i{var V=Fp(),u=Ry(),d=wd(),E=Vy().sorterAsc,A=ji();K.containerArrayMatch=Ak();var t=K.isAddVal=function(r){return r==="add"||V(r)},e=K.isRemoveVal=function(r){return r===null||r==="remove"};K.applyContainerArrayChanges=function(r,i,n,o,a){var s=i.astr,f=A.getComponentMethod(s,"supplyLayoutDefaults"),v=A.getComponentMethod(s,"draw"),g=A.getComponentMethod(s,"drawOne"),m=o.replot||o.recalc||f===u||v===u,w=r.layout,l=r._fullLayout;if(n[""]){Object.keys(n).length>1&&d.warn("Full array edits are incompatible with other edits",s);var x=n[""][""];if(e(x))i.set(null);else if(Array.isArray(x))i.set(x);else return d.warn("Unrecognized full array edit value",s,x),!0;return m?!1:(f(w,l),v(r),!0)}var y=Object.keys(n).map(Number).sort(E),S=i.get(),k=S||[],M=a(l,s).get(),T=[],c=-1,h=k.length,b,_,P,z,D,B,R,I;for(b=0;bk.length-(R?0:1)){d.warn("index out of range",s,P);continue}if(B!==void 0)D.length>1&&d.warn("Insertion & removal are incompatible with edits to the same index.",s,P),e(B)?T.push(P):R?(B==="add"&&(B={}),k.splice(P,0,B),M&&M.splice(P,0,{})):d.warn("Unrecognized full object edit value",s,P,B),c===-1&&(c=P);else for(_=0;_=0;b--)k.splice(T[b],1),M&&M.splice(T[b],1);if(k.length?S||i.set(k):i.set(null),m)return!1;if(f(w,l),g!==u){var F;if(c===-1)F=y;else{for(h=Math.max(k.length,h),F=[],b=0;b=c));b++)F.push(P);for(b=c;b{var V=Lo(),u=ji(),d=Xr(),E=Vu(),A=fc(),t=Pi(),e=A.cleanId,r=A.getFromTrace,i=u.traceIs,n=["x","y","z"];K.clearPromiseQueue=function(l){Array.isArray(l._promises)&&l._promises.length>0&&d.log("Clearing previous rejected promises from queue."),l._promises=[]},K.cleanLayout=function(l){var x;l||(l={}),l.xaxis1&&(l.xaxis||(l.xaxis=l.xaxis1),delete l.xaxis1),l.yaxis1&&(l.yaxis||(l.yaxis=l.yaxis1),delete l.yaxis1),l.scene1&&(l.scene||(l.scene=l.scene1),delete l.scene1);var y=(E.subplotsRegistry.cartesian||{}).attrRegex;(E.subplotsRegistry.polar||{}).attrRegex,(E.subplotsRegistry.ternary||{}).attrRegex,(E.subplotsRegistry.gl3d||{}).attrRegex;var S=Object.keys(l);for(x=0;x3?(z.x=1.02,z.xanchor="left"):z.x<-2&&(z.x=-.02,z.xanchor="right"),z.y>3?(z.y=1.02,z.yanchor="bottom"):z.y<-2&&(z.y=-.02,z.yanchor="top")),l.dragmode==="rotate"&&(l.dragmode="orbit"),t.clean(l),l.template&&l.template.layout&&K.cleanLayout(l.template.layout),l};function o(l,x){var y=l[x],S=x.charAt(0);y&&y!=="paper"&&(l[x]=e(y,S,!0))}K.cleanData=function(l){for(var x=0;x0)return l.slice(0,x)}K.hasParent=function(l,x){for(var y=m(x);y;){if(y in l)return!0;y=m(y)}return!1},K.clearAxisTypes=function(l,x,y){for(var S=0;S{let y=(...S)=>S.every(k=>d.isPlainObject(k))||S.every(k=>Array.isArray(k));if([l,x].every(S=>Array.isArray(S))){if(l.length!==x.length)return!1;for(let S=0;Sd.isPlainObject(S))){if(Object.keys(l).length!==Object.keys(x).length)return!1;for(let S in l){if(S.startsWith("_"))continue;let k=l[S],M=x[S];if(k!==M&&!(y(k,M)&&w(k,M)))return!1}return!0}return!1};K.collectionsAreEqual=w}),t1=Vt(K=>{var V=Ni(),u=Lo(),d=ub(),E=Xr(),A=E.nestedProperty,t=_m(),e=WT(),r=ji(),i=bm(),n=Vu(),o=yo(),a=vb(),s=Of(),f=Eo(),v=Pi(),g=Fb().initInteractions,m=zh(),w=Ec().clearOutline,l=s0().dfltConfig,x=Mk(),y=Sk(),S=Hg(),k=Cu(),M=Mf().AX_NAME_PATTERN,T=0,c=5;function h(_t,lt,yt,St){var Ht;if(_t=E.getGraphDiv(_t),t.init(_t),E.isPlainObject(lt)){var Yt=lt;lt=Yt.data,yt=Yt.layout,St=Yt.config,Ht=Yt.frames}var se=t.triggerHandler(_t,"plotly_beforeplot",[lt,yt,St]);if(se===!1)return Promise.reject();!lt&&!yt&&!E.isPlotDiv(_t)&&E.warn("Calling _doPlot as if redrawing but this container doesn't yet have a plot.",_t);function ke(){if(Ht)return K.addFrames(_t,Ht)}D(_t,St),yt||(yt={}),V.select(_t).classed("js-plotly-plot",!0),f.makeTester(),Array.isArray(_t._promises)||(_t._promises=[]);var Ee=(_t.data||[]).length===0&&Array.isArray(lt);Array.isArray(lt)&&(y.cleanData(lt),Ee?_t.data=lt:_t.data.push.apply(_t.data,lt),_t.empty=!1),(!_t.layout||Ee)&&(_t.layout=y.cleanLayout(yt)),n.supplyDefaults(_t);var Ue=_t._fullLayout,ir=Ue._has("cartesian");Ue._replotting=!0,(Ee||Ue._shouldCreateBgLayer)&&(qt(_t),Ue._shouldCreateBgLayer&&delete Ue._shouldCreateBgLayer),f.initGradients(_t),f.initPatterns(_t),Ee&&o.saveShowSpikeInitial(_t);var ar=!_t.calcdata||_t.calcdata.length!==(_t._fullData||[]).length;ar&&n.doCalcdata(_t);for(var Ye=0;Ye<_t.calcdata.length;Ye++)_t.calcdata[Ye][0].trace=_t._fullData[Ye];_t._context.responsive?_t._responsiveChartHandler||(_t._responsiveChartHandler=function(){E.isHidden(_t)||n.resize(_t)},window.addEventListener("resize",_t._responsiveChartHandler)):E.clearResponsive(_t);var Er=E.extendFlat({},Ue._size),pn=0;function dn(){for(var Re=Ue._basePlotModules,Ze=0;Ze=_t.data.length||Ht<-_t.data.length)throw new Error(yt+" must be valid indices for gd.data.");if(lt.indexOf(Ht,St+1)>-1||Ht>=0&<.indexOf(-_t.data.length+Ht)>-1||Ht<0&<.indexOf(_t.data.length+Ht)>-1)throw new Error("each index in "+yt+" must be unique.")}}function j(_t,lt,yt){if(!Array.isArray(_t.data))throw new Error("gd.data must be an array.");if(typeof lt>"u")throw new Error("currentIndices is a required argument.");if(Array.isArray(lt)||(lt=[lt]),F(_t,lt,"currentIndices"),typeof yt<"u"&&!Array.isArray(yt)&&(yt=[yt]),typeof yt<"u"&&F(_t,yt,"newIndices"),typeof yt<"u"&<.length!==yt.length)throw new Error("current and new indices must be of equal length.")}function N(_t,lt,yt){var St,Ht;if(!Array.isArray(_t.data))throw new Error("gd.data must be an array.");if(typeof lt>"u")throw new Error("traces must be defined.");for(Array.isArray(lt)||(lt=[lt]),St=0;St"u")throw new Error("indices must be an integer or array of integers");F(_t,yt,"indices");for(var Yt in lt){if(!Array.isArray(lt[Yt])||lt[Yt].length!==yt.length)throw new Error("attribute "+Yt+" must be an array of length equal to indices array length");if(Ht&&(!(Yt in St)||!Array.isArray(St[Yt])||St[Yt].length!==lt[Yt].length))throw new Error("when maxPoints is set as a key:value object it must contain a 1:1 correspondence with the keys and number of traces in the update object")}}function rt(_t,lt,yt,St){var Ht=E.isPlainObject(St),Yt=[],se,ke,Ee,Ue,ir;Array.isArray(yt)||(yt=[yt]),yt=I(yt,_t.data.length-1);for(var ar in lt)for(var Ye=0;Ye=0&&ir=0&&ir"u")return Ue=K.redraw(_t),e.add(_t,Ht,se,Yt,ke),Ue;Array.isArray(yt)||(yt=[yt]);try{j(_t,St,yt)}catch(ir){throw _t.data.splice(_t.data.length-lt.length,lt.length),ir}return e.startSequence(_t),e.add(_t,Ht,se,Yt,ke),Ue=K.moveTraces(_t,St,yt),e.stopSequence(_t),Ue}function X(_t,lt){_t=E.getGraphDiv(_t);var yt=[],St=K.addTraces,Ht=X,Yt=[_t,yt,lt],se=[_t,lt],ke,Ee;if(typeof lt>"u")throw new Error("indices must be an integer or array of integers.");for(Array.isArray(lt)||(lt=[lt]),F(_t,lt,"indices"),lt=I(lt,_t.data.length-1),lt.sort(E.sorterDes),ke=0;ke"u")for(yt=[],Ue=0;Ue0&&typeof Ze.parts[tn]!="string";)tn--;var Yr=Ze.parts[tn],$r=Ze.parts[tn-1]+"."+Yr,In=Ze.parts.slice(0,tn).join("."),Nn=A(_t.layout,In).get(),Kn=A(St,In).get(),$n=Ze.get();if(tr!==void 0){Zn[Re]=tr,En[Re]=Yr==="reverse"?tr:J($n);var ia=i.getLayoutValObject(St,Ze.parts);if(ia&&ia.impliedEdits&&tr!==null)for(var Cn in ia.impliedEdits)gn(E.relativeAttr(Re,Cn),ia.impliedEdits[Cn]);if(["width","height"].indexOf(Re)!==-1)if(tr){gn("autosize",null);var Fa=Re==="height"?"width":"height";gn(Fa,St[Fa])}else St[Re]=_t._initialAutoSize[Re];else if(Re==="autosize")gn("width",tr?null:St.width),gn("height",tr?null:St.height);else if($r.match(It))Se($r),A(St,In+"._inputRange").set(null);else if($r.match(Nt)){Se($r),A(St,In+"._inputRange").set(null);var Ga=A(St,In).get();Ga._inputDomain&&(Ga._input.domain=Ga._inputDomain.slice())}else $r.match(te)&&A(St,In+"._inputDomain").set(null);if(Yr==="type"){ra=Nn;var ve=Kn.type==="linear"&&tr==="log",ge=Kn.type==="log"&&tr==="linear";if(ve||ge){if(!ra||!ra.range)gn(In+".autorange",!0);else if(Kn.autorange)ve&&(ra.range=ra.range[1]>ra.range[0]?[1,2]:[2,1]);else{var dr=ra.range[0],br=ra.range[1];ve?(dr<=0&&br<=0&&gn(In+".autorange",!0),dr<=0?dr=br/1e6:br<=0&&(br=dr/1e6),gn(In+".range[0]",Math.log(dr)/Math.LN10),gn(In+".range[1]",Math.log(br)/Math.LN10)):(gn(In+".range[0]",Math.pow(10,dr)),gn(In+".range[1]",Math.pow(10,br)))}Array.isArray(St._subplots.polar)&&St._subplots.polar.length&&St[Ze.parts[0]]&&Ze.parts[1]==="radialaxis"&&delete St[Ze.parts[0]]._subplot.viewInitial["radialaxis.range"],r.getComponentMethod("annotations","convertCoords")(_t,Kn,tr,gn),r.getComponentMethod("images","convertCoords")(_t,Kn,tr,gn)}else gn(In+".autorange",!0),gn(In+".range",null);A(St,In+"._inputRange").set(null)}else if(Yr.match(M)){var Tr=A(St,Re).get(),mr=(tr||{}).type;(!mr||mr==="-")&&(mr="linear"),r.getComponentMethod("annotations","convertCoords")(_t,Tr,mr,gn),r.getComponentMethod("images","convertCoords")(_t,Tr,mr,gn)}var kr=x.containerArrayMatch(Re);if(kr){ir=kr.array,ar=kr.index;var Ur=kr.property,Or=ia||{editType:"calc"};ar!==""&&Ur===""&&(x.isAddVal(tr)?En[Re]=null:x.isRemoveVal(tr)?En[Re]=(A(yt,ir).get()||[])[ar]:E.warn("unrecognized full object value",lt)),k.update(bn,Or),Ue[ir]||(Ue[ir]={});var pe=Ue[ir][ar];pe||(pe=Ue[ir][ar]={}),pe[Ur]=tr,delete lt[Re]}else Yr==="reverse"?(Nn.range?Nn.range.reverse():(gn(In+".autorange",!0),Nn.range=[1,0]),Kn.autorange?bn.calc=!0:bn.plot=!0):(Re==="dragmode"&&(tr===!1&&$n!==!1||tr!==!1&&$n===!1)||St._has("scatter-like")&&St._has("regl")&&Re==="dragmode"&&(tr==="lasso"||tr==="select")&&!($n==="lasso"||$n==="select")?bn.plot=!0:ia?k.update(bn,ia):bn.calc=!0,Ze.set(tr))}}for(ir in Ue){var Ke=x.applyContainerArrayChanges(_t,Yt(yt,ir),Ue[ir],bn,Yt);Ke||(bn.plot=!0)}for(var xr in da){ra=o.getFromId(_t,xr);var Gr=ra&&ra._constraintGroup;if(Gr){bn.calc=!0;for(var ln in Gr)da[ln]||(o.getFromId(_t,ln)._constraintShrinkable=!0)}}(ee(_t)||lt.height||lt.width)&&(bn.plot=!0);var wn=St.shapes;for(ar=0;ar1;)if(St.pop(),yt=A(lt,St.join(".")+".uirevision").get(),yt!==void 0)return yt;return lt.uirevision}function Kt(_t,lt){for(var yt=0;yt[In,_t._ev.listeners(In)]);Yt=K.newPlot(_t,lt,yt,St).then(()=>{for(let[In,Nn]of $r)Nn.forEach(Kn=>_t.on(In,Kn));return K.react(_t,lt,yt,St)})}else{_t.data=lt||[],y.cleanData(_t.data),_t.layout=yt||{},y.cleanLayout(_t.layout),Ce(_t.data,_t.layout,ke,Ee),n.supplyDefaults(_t,{skipUpdateCalc:!0});var ar=_t._fullData,Ye=_t._fullLayout,Er=Ye.datarevision===void 0,pn=Ye.transition,dn=vr(_t,Ee,Ye,Er,pn),bn=dn.newDataRevision,Zn=qe(_t,ke,ar,Er,pn,bn);if(ee(_t)&&(dn.layoutReplot=!0),Zn.calc||dn.calc){_t.calcdata=void 0;for(var En=Object.getOwnPropertyNames(Ye),gn=0;gn(ir||_t.emit("plotly_react",{config:St,data:lt,layout:yt}),_t))}function qe(_t,lt,yt,St,Ht,Yt){var se=lt.length===yt.length;if(!Ht&&!se)return{fullReplot:!0,calc:!0};var ke=k.traceFlags();ke.arrays={},ke.nChanges=0,ke.nChangesAnim=0;var Ee,Ue;function ir(Er){var pn=i.getTraceValObject(Ue,Er);return!Ue._module.animatable&&pn.anim&&(pn.anim=!1),pn}var ar={getValObject:ir,flags:ke,immutable:St,transition:Ht,newDataRevision:Yt,gd:_t},Ye={};for(Ee=0;Ee=Ht.length?Ht[0]:Ht[Ue]:Ht}function ke(Ue){return Array.isArray(Yt)?Ue>=Yt.length?Yt[0]:Yt[Ue]:Yt}function Ee(Ue,ir){var ar=0;return function(){if(Ue&&++ar===ir)return Ue()}}return new Promise(function(Ue,ir){function ar(){if(St._frameQueue.length!==0){for(;St._frameQueue.length;){var Yr=St._frameQueue.pop();Yr.onInterrupt&&Yr.onInterrupt()}_t.emit("plotly_animationinterrupted",[])}}function Ye(Yr){if(Yr.length!==0){for(var $r=0;$rSt._timeToNext&&pn()};Yr()}var bn=0;function Zn(Yr){return Array.isArray(Ht)?bn>=Ht.length?Yr.transitionOpts=Ht[bn]:Yr.transitionOpts=Ht[0]:Yr.transitionOpts=Ht,bn++,Yr}var En,gn,da=[],ra=lt==null,Se=Array.isArray(lt),Re=!ra&&!Se&&E.isPlainObject(lt);if(Re)da.push({type:"object",data:Zn(E.extendFlat({},lt))});else if(ra||["string","number"].indexOf(typeof lt)!==-1)for(En=0;En0&&zrzr)&&tn.push(gn);da=tn}}da.length>0?Ye(da):(_t.emit("plotly_animated"),Ue())})}function Mr(_t,lt,yt){if(_t=E.getGraphDiv(_t),lt==null)return Promise.resolve();if(!E.isPlotDiv(_t))throw new Error("This element is not a Plotly plot: "+_t+". It's likely that you've failed to create a plot before adding frames. For more details, see https://plotly.com/javascript/animations/");var St,Ht,Yt,se,ke=_t._transitionData._frames,Ee=_t._transitionData._frameHash;if(!Array.isArray(lt))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+lt);var Ue=ke.length+lt.length*2,ir=[],ar={};for(St=lt.length-1;St>=0;St--)if(E.isPlainObject(lt[St])){var Ye=lt[St].name,Er=(Ee[Ye]||ar[Ye]||{}).name,pn=lt[St].name,dn=Ee[Er]||ar[Er];Er&&pn&&typeof pn=="number"&&dn&&TZe.index?-1:Re.index=0;St--){if(Ht=ir[St].frame,typeof Ht.name=="number"&&E.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!Ht.name)for(;Ee[Ht.name="frame "+_t._transitionData._counter++];);if(Ee[Ht.name]){for(Yt=0;Yt=0;yt--)St=lt[yt],Yt.push({type:"delete",index:St}),se.unshift({type:"insert",index:St,value:Ht[St]});var ke=n.modifyFrames,Ee=n.modifyFrames,Ue=[_t,se],ir=[_t,Yt];return e&&e.add(_t,ke,Ue,Ee,ir),n.modifyFrames(_t,Yt)}function de(_t){_t=E.getGraphDiv(_t);var lt=_t._fullLayout||{},yt=_t._fullData||[];return n.cleanPlot([],{},yt,lt),n.purge(_t),t.purge(_t),lt._container&<._container.remove(),delete _t._context,_t}function Dt(_t){var lt=_t._fullLayout,yt=_t.getBoundingClientRect();if(!E.equalDomRects(yt,lt._lastBBox)){var St=lt._invTransform=E.inverseTransformMatrix(E.getFullTransformMatrix(_t));lt._invScaleX=Math.sqrt(St[0][0]*St[0][0]+St[0][1]*St[0][1]+St[0][2]*St[0][2]),lt._invScaleY=Math.sqrt(St[1][0]*St[1][0]+St[1][1]*St[1][1]+St[1][2]*St[1][2]),lt._lastBBox=yt}}function qt(_t){var lt=V.select(_t),yt=_t._fullLayout;if(yt._calcInverseTransform=Dt,yt._calcInverseTransform(_t),yt._container=lt.selectAll(".plot-container").data([0]),yt._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0).style({width:"100%",height:"100%"}),yt._paperdiv=yt._container.selectAll(".svg-container").data([0]),yt._paperdiv.enter().append("div").classed("user-select-none",!0).classed("svg-container",!0).style("position","relative"),yt._glcontainer=yt._paperdiv.selectAll(".gl-container").data([{}]),yt._glcontainer.enter().append("div").classed("gl-container",!0),yt._paperdiv.selectAll(".main-svg").remove(),yt._paperdiv.select(".modebar-container").remove(),yt._paper=yt._paperdiv.insert("svg",":first-child").classed("main-svg",!0),yt._toppaper=yt._paperdiv.append("svg").classed("main-svg",!0),yt._modebardiv=yt._paperdiv.append("div"),delete yt._modeBar,yt._hoverpaper=yt._paperdiv.append("svg").classed("main-svg",!0),!yt._uid){var St={};V.selectAll("defs").each(function(){this.id&&(St[this.id.split("-")[1]]=1)}),yt._uid=E.randstr(St)}yt._paperdiv.selectAll(".main-svg").attr(m.svgAttrs),yt._defs=yt._paper.append("defs").attr("id","defs-"+yt._uid),yt._clips=yt._defs.append("g").classed("clips",!0),yt._topdefs=yt._toppaper.append("defs").attr("id","topdefs-"+yt._uid),yt._topclips=yt._topdefs.append("g").classed("clips",!0),yt._bgLayer=yt._paper.append("g").classed("bglayer",!0),yt._draggers=yt._paper.append("g").classed("draglayer",!0);var Ht=yt._paper.append("g").classed("layer-below",!0);yt._imageLowerLayer=Ht.append("g").classed("imagelayer",!0),yt._shapeLowerLayer=Ht.append("g").classed("shapelayer",!0),yt._cartesianlayer=yt._paper.append("g").classed("cartesianlayer",!0),yt._polarlayer=yt._paper.append("g").classed("polarlayer",!0),yt._smithlayer=yt._paper.append("g").classed("smithlayer",!0),yt._ternarylayer=yt._paper.append("g").classed("ternarylayer",!0),yt._geolayer=yt._paper.append("g").classed("geolayer",!0),yt._funnelarealayer=yt._paper.append("g").classed("funnelarealayer",!0),yt._pielayer=yt._paper.append("g").classed("pielayer",!0),yt._iciclelayer=yt._paper.append("g").classed("iciclelayer",!0),yt._treemaplayer=yt._paper.append("g").classed("treemaplayer",!0),yt._sunburstlayer=yt._paper.append("g").classed("sunburstlayer",!0),yt._indicatorlayer=yt._toppaper.append("g").classed("indicatorlayer",!0),yt._glimages=yt._paper.append("g").classed("glimages",!0);var Yt=yt._toppaper.append("g").classed("layer-above",!0);yt._imageUpperLayer=Yt.append("g").classed("imagelayer",!0),yt._shapeUpperLayer=Yt.append("g").classed("shapelayer",!0),yt._selectionLayer=yt._toppaper.append("g").classed("selectionlayer",!0),yt._infolayer=yt._toppaper.append("g").classed("infolayer",!0),yt._menulayer=yt._toppaper.append("g").classed("menulayer",!0),yt._zoomlayer=yt._toppaper.append("g").classed("zoomlayer",!0),yt._hoverlayer=yt._hoverpaper.append("g").classed("hoverlayer",!0),yt._modebardiv.classed("modebar-container",!0).style("position","absolute").style("top","0px").style("right","0px"),_t.emit("plotly_framework")}K.animate=er,K.addFrames=Mr,K.deleteFrames=Ir,K.addTraces=ot,K.deleteTraces=X,K.extendTraces=et,K.moveTraces=Q,K.prependTraces=Z,K.newPlot=R,K._doPlot=h,K.purge=de,K.react=We,K.redraw=B,K.relayout=Tt,K.restyle=ut,K.setPlotConfig=_,K.update=Zt,K._guiRelayout=mt(Tt),K._guiRestyle=mt(ut),K._guiUpdate=mt(Zt),K._storeDirectGUIEdit=nt}),Bp=Vt(K=>{var V=ji();K.getDelay=function(E){return E._has&&(E._has("gl3d")||E._has("mapbox")||E._has("map"))?500:0},K.getRedrawFunc=function(E){return function(){V.getComponentMethod("colorbar","draw")(E)}},K.encodeSVG=function(E){return"data:image/svg+xml,"+encodeURIComponent(E)},K.encodeJSON=function(E){return"data:application/json,"+encodeURIComponent(E)};var u=window.URL||window.webkitURL;K.createObjectURL=function(E){return u.createObjectURL(E)},K.revokeObjectURL=function(E){return u.revokeObjectURL(E)},K.createBlob=function(E,A){if(A==="svg")return new window.Blob([E],{type:"image/svg+xml;charset=utf-8"});if(A==="full-json")return new window.Blob([E],{type:"application/json;charset=utf-8"});var t=d(window.atob(E));return new window.Blob([t],{type:"image/"+A})},K.octetStream=function(E){document.location.href="data:application/octet-stream"+E};function d(E){for(var A=E.length,t=new ArrayBuffer(A),e=new Uint8Array(t),r=0;r{var u=Ni();Xr();var d=Eo(),E=Pi();zh();var A=/"/g,t="TOBESTRIPPED",e=new RegExp('("'+t+")|("+t+'")',"g");function r(n){var o=u.select("body").append("div").style({display:"none"}).html(""),a=n.replace(/(&[^;]*;)/gi,function(s){return s==="<"?"<":s==="&rt;"?">":s.indexOf("<")!==-1||s.indexOf(">")!==-1?"":o.html(s).text()});return o.remove(),a}function i(n){return n.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}V.exports=function(n,o,a){var s=n._fullLayout,f=s._paper,v=s._toppaper,g=s.width,m=s.height,w;f.insert("rect",":first-child").call(d.setRect,0,0,g,m).call(E.fill,s.paper_bgcolor);var l=s._basePlotModules||[];for(w=0;w{var u=Xr(),d=l0().EventEmitter,E=Bp();function A(t){var e=t.emitter||new d,r=new Promise(function(i,n){var o=window.Image,a=t.svg,s=t.format||"png",f=t.canvas,v=t.scale||1,g=t.width||300,m=t.height||150,w=v*g,l=v*m,x=f.getContext("2d",{willReadFrequently:!0}),y=new o,S,k;s==="svg"||u.isSafari()?k=E.encodeSVG(a):(S=E.createBlob(a,"svg"),k=E.createObjectURL(S)),f.width=w,f.height=l,y.onload=function(){var M;switch(S=null,E.revokeObjectURL(k),s!=="svg"&&x.drawImage(y,0,0,w,l),s){case"jpeg":M=f.toDataURL("image/jpeg");break;case"png":M=f.toDataURL("image/png");break;case"webp":M=f.toDataURL("image/webp");break;case"svg":M=k;break;default:var T="Image format is not jpeg, png, svg or webp.";if(n(new Error(T)),!t.promise)return e.emit("error",T)}i(M),t.promise||e.emit("success",M)},y.onerror=function(M){if(S=null,E.revokeObjectURL(k),n(M),!t.promise)return e.emit("error",M)},y.src=k});return t.promise?r:e}V.exports=A}),Bb=Vt((K,V)=>{var u=Lo(),d=t1(),E=Vu(),A=Xr(),t=Bp(),e=e1(),r=r1(),i=Fy().version,n={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],dflt:"png"},width:{valType:"number",min:1},height:{valType:"number",min:1},scale:{valType:"number",min:0,dflt:1},setBackground:{valType:"any",dflt:!1},imageDataOnly:{valType:"boolean",dflt:!1}};function o(a,s){s=s||{};var f,v,g,m;A.isPlainObject(a)?(f=a.data||[],v=a.layout||{},g=a.config||{},m={}):(a=A.getGraphDiv(a),f=A.extendDeep([],a.data),v=A.extendDeep({},a.layout),g=a._context,m=a._fullLayout||{});function w(R){return!(R in s)||A.validate(s[R],n[R])}if(!w("width")&&s.width!==null||!w("height")&&s.height!==null)throw new Error("Height and width should be pixel values.");if(!w("format"))throw new Error("Export format is not "+A.join2(n.format.values,", "," or ")+".");var l={};function x(R,I){return A.coerce(s,l,n,R,I)}var y=x("format"),S=x("width"),k=x("height"),M=x("scale"),T=x("setBackground"),c=x("imageDataOnly"),h=document.createElement("div");h.style.position="absolute",h.style.left="-5000px",document.body.appendChild(h);var b=A.extendFlat({},v);S?b.width=S:s.width===null&&u(m.width)&&(b.width=m.width),k?b.height=k:s.height===null&&u(m.height)&&(b.height=m.height);var _=A.extendFlat({},g,{_exportedPlot:!0,staticPlot:!0,setBackground:T}),P=t.getRedrawFunc(h);function z(){return new Promise(function(R){setTimeout(R,t.getDelay(h._fullLayout))})}function D(){return new Promise(function(R,I){var F=e(h,y,M),j=h._fullLayout.width,N=h._fullLayout.height;function G(){d.purge(h),document.body.removeChild(h)}if(y==="full-json"){var rt=E.graphJson(h,!1,"keepdata","object",!0,!0);return rt.version=i,rt=JSON.stringify(rt),G(),R(c?rt:t.encodeJSON(rt))}if(G(),y==="svg")return R(c?F:t.encodeSVG(F));var ct=document.createElement("canvas");ct.id=A.randstr(),r({format:y,width:j,height:N,scale:M,canvas:ct,svg:F,promise:!0}).then(R).catch(I)})}function B(R){return c?R.replace(t.IMAGE_URL_PREFIX,""):R}return new Promise(function(R,I){d.newPlot(h,f,b,_).then(P).then(z).then(D).then(function(F){R(B(F))}).catch(function(F){I(F)})})}V.exports=o}),Ek=Vt((K,V)=>{var u=Xr(),d=Vu(),E=bm(),A=s0().dfltConfig,t=u.isPlainObject,e=Array.isArray,r=u.isArrayOrTypedArray;V.exports=function(l,x){l===void 0&&(l=[]),x===void 0&&(x={});var y=E.get(),S=[],k={_context:u.extendFlat({},A)},M,T;e(l)?(k.data=u.extendDeep([],l),M=l):(k.data=[],M=[],S.push(s("array","data"))),t(x)?(k.layout=u.extendDeep({},x),T=x):(k.layout={},T={},arguments.length>1&&S.push(s("object","layout"))),d.supplyDefaults(k);for(var c=k._fullData,h=M.length,b=0;bP.length&&S.push(s("unused",k,b.concat(P.length)));var F=P.length,j=Array.isArray(I);j&&(F=Math.min(F,I.length));var N,G,rt,ct,st;if(z.dimensions===2)for(G=0;GP[G].length&&S.push(s("unused",k,b.concat(G,P[G].length)));var et=P[G].length;for(N=0;N<(j?Math.min(et,I[G].length):et);N++)rt=j?I[G][N]:I,ct=_[G][N],st=P[G][N],u.validate(ct,rt)?st!==ct&&st!==+ct&&S.push(s("dynamic",k,b.concat(G,N),ct,st)):S.push(s("value",k,b.concat(G,N),ct))}else S.push(s("array",k,b.concat(G),_[G]));else for(G=0;G{var u=Xr(),d=Bp();function E(A,t,e){var r=document.createElement("a"),i="download"in r,n=new Promise(function(o,a){var s,f;if(i)return s=d.createBlob(A,e),f=d.createObjectURL(s),r.href=f,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),d.revokeObjectURL(f),s=null,o(t);if(u.isSafari()){var v=e==="svg"?",":";base64,";return d.octetStream(v+encodeURIComponent(A)),o(t)}a(new Error("download error"))});return n}V.exports=E}),Rb=Vt((K,V)=>{var u=Xr(),d=Bb(),E=zk();Bp();function A(t,e){var r;return u.isPlainObject(t)||(r=u.getGraphDiv(t)),e=e||{},e.format=e.format||"png",e.width=e.width||null,e.height=e.height||null,e.imageDataOnly=!0,new Promise(function(i,n){r&&r._snapshotInProgress&&n(new Error("Snapshotting already in progress.")),r&&(r._snapshotInProgress=!0);var o=d(t,e),a=e.filename||t.fn||"newplot";a+="."+e.format.replace("-","."),o.then(function(s){return r&&(r._snapshotInProgress=!1),E(s,a,e.format)}).then(function(s){i(s)}).catch(function(s){r&&(r._snapshotInProgress=!1),n(s)})})}V.exports=A}),Lk=Vt(K=>{var V=Xr(),u=V.isPlainObject,d=bm(),E=Vu(),A=kl(),t=cl(),e=s0().dfltConfig;K.makeTemplate=function(g){g=V.isPlainObject(g)?g:V.getGraphDiv(g),g=V.extendDeep({_context:e},{data:g.data,layout:g.layout}),E.supplyDefaults(g);var m=g.data||[],w=g.layout||{};w._basePlotModules=g._fullLayout._basePlotModules,w._modules=g._fullLayout._modules;var l={data:{},layout:{}};m.forEach(function(_){var P={};n(_,P,a.bind(null,_));var z=V.coerce(_,{},A,"type"),D=l.data[z];D||(D=l.data[z]=[]),D.push(P)}),n(w,l.layout,o.bind(null,w)),delete l.layout.template;var x=w.template;if(u(x)){var y=x.layout,S,k,M,T,c,h;u(y)&&r(y,l.layout);var b=x.data;if(u(b)){for(k in l.data)if(M=b[k],Array.isArray(M)){for(c=l.data[k],h=c.length,T=M.length,S=0;SB?S.push({code:"unused",traceType:_,templateCount:D,dataCount:B}):B>D&&S.push({code:"reused",traceType:_,templateCount:D,dataCount:B})}}function R(I,F){for(var j in I)if(j.charAt(0)!=="_"){var N=I[j],G=s(I,j,F);u(N)?(Array.isArray(I)&&N._template===!1&&N.templateitemname&&S.push({code:"missing",path:G,templateitemname:N.templateitemname}),R(N,G)):Array.isArray(N)&&f(N)&&R(N,G)}}if(R({data:M,layout:k},""),S.length)return S.map(v)};function f(g){for(var m=0;m{var V=t1();K._doPlot=V._doPlot,K.newPlot=V.newPlot,K.restyle=V.restyle,K.relayout=V.relayout,K.redraw=V.redraw,K.update=V.update,K._guiRestyle=V._guiRestyle,K._guiRelayout=V._guiRelayout,K._guiUpdate=V._guiUpdate,K._storeDirectGUIEdit=V._storeDirectGUIEdit,K.react=V.react,K.extendTraces=V.extendTraces,K.prependTraces=V.prependTraces,K.addTraces=V.addTraces,K.deleteTraces=V.deleteTraces,K.moveTraces=V.moveTraces,K.purge=V.purge,K.addFrames=V.addFrames,K.deleteFrames=V.deleteFrames,K.animate=V.animate,K.setPlotConfig=V.setPlotConfig;var u=Fg().getGraphDiv,d=Qy().eraseActiveShape;K.deleteActiveShape=function(A){return d(u(A))},K.toImage=Bb(),K.validate=Ek(),K.downloadImage=Rb();var E=Lk();K.makeTemplate=E.makeTemplate,K.validateTemplate=E.validateTemplate}),Mm=Vt((K,V)=>{var u=Xr(),d=ji();V.exports=function(E,A,t,e){var r=e("x"),i=e("y"),n,o=d.getComponentMethod("calendars","handleTraceDefaults");if(o(E,A,["x","y"],t),r){var a=u.minRowLength(r);i?n=Math.min(a,u.minRowLength(i)):(n=a,e("y0"),e("dy"))}else{if(!i)return 0;n=u.minRowLength(i),e("x0"),e("dx")}return A._length=n,n}}),Qh=Vt((K,V)=>{var u=Xr().dateTick0,d=ks(),E=d.ONEWEEK;function A(t,e){return t%E===0?u(e,1):u(e,0)}V.exports=function(t,e,r,i,n){if(n||(n={x:!0,y:!0}),n.x){var o=i("xperiod");o&&(i("xperiod0",A(o,e.xcalendar)),i("xperiodalignment"))}if(n.y){var a=i("yperiod");a&&(i("yperiod0",A(a,e.ycalendar)),i("yperiodalignment"))}}}),Ik=Vt((K,V)=>{var u=["orientation","groupnorm","stackgaps"];V.exports=function(d,E,A,t){var e=A._scatterStackOpts,r=t("stackgroup");if(r){var i=E.xaxis+E.yaxis,n=e[i];n||(n=e[i]={});var o=n[r],a=!1;o?o.traces.push(E):(o=n[r]={traceIndices:[],traces:[E]},a=!0);for(var s={orientation:E.x&&!E.y?"h":"v"},f=0;f{var u=Pi(),d=ah().hasColorscale,E=vf(),A=nu();V.exports=function(t,e,r,i,n,o){var a=A.isBubble(t),s=(t.line||{}).color,f;if(o=o||{},s&&(r=s),n("marker.symbol"),n("marker.opacity",a?.7:1),n("marker.size"),o.noAngle||(n("marker.angle"),o.noAngleRef||n("marker.angleref"),o.noStandOff||n("marker.standoff")),n("marker.color",r),d(t,"marker")&&E(t,e,i,n,{prefix:"marker.",cLetter:"c"}),o.noSelect||(n("selected.marker.color"),n("unselected.marker.color"),n("selected.marker.size"),n("unselected.marker.size")),o.noLine||(s&&!Array.isArray(s)&&e.marker.color!==s?f=s:a?f=u.background:f=u.defaultLine,n("marker.line.color",f),d(t,"marker.line")&&E(t,e,i,n,{prefix:"marker.line.",cLetter:"c"}),n("marker.line.width",a?1:0)),a&&(n("marker.sizeref"),n("marker.sizemin"),n("marker.sizemode")),o.gradient){var v=n("marker.gradient.type");v!=="none"&&n("marker.gradient.color")}}}),Bh=Vt((K,V)=>{var u=Xr().isArrayOrTypedArray,d=ah().hasColorscale,E=vf();V.exports=function(A,t,e,r,i,n){n||(n={});var o=(A.marker||{}).color;if(o&&o._inputArray&&(o=o._inputArray),i("line.color",e),d(A,"line"))E(A,t,r,i,{prefix:"line.",cLetter:"c"});else{var a=(u(o)?!1:o)||e;i("line.color",a)}i("line.width"),n.noDash||i("line.dash"),n.backoff&&i("line.backoff")}}),Sm=Vt((K,V)=>{V.exports=function(u,d,E){var A=E("line.shape");A==="spline"&&E("line.smoothing")}}),Rh=Vt((K,V)=>{var u=Xr();V.exports=function(d,E,A,t,e){e=e||{},t("textposition"),u.coerceFont(t,"textfont",e.font||A.font,e),e.noSelect||(t("selected.textfont.color"),t("unselected.textfont.color"))}}),tp=Vt((K,V)=>{var u=Pi(),d=Xr().isArrayOrTypedArray;function E(A){for(var t=u.interpolate(A[0][1],A[1][1],.5),e=2;e{var u=Xr(),d=ji(),E=dc(),A=vp(),t=nu(),e=Mm(),r=Qh(),i=Ik(),n=Lh(),o=Bh(),a=Sm(),s=Rh(),f=tp(),v=Xr().coercePattern;V.exports=function(g,m,w,l){function x(b,_){return u.coerce(g,m,E,b,_)}var y=e(g,m,l,x);if(y||(m.visible=!1),!!m.visible){r(g,m,l,x),x("xhoverformat"),x("yhoverformat"),x("zorder");var S=i(g,m,l,x);l.scattermode==="group"&&m.orientation===void 0&&x("orientation","v");var k=!S&&y{var u=f0().getAxisGroup;V.exports=function(d,E,A,t,e){var r=E.orientation,i=E[{v:"x",h:"y"}[r]+"axis"],n=u(A,i)+r,o=A._alignmentOpts||{},a=t("alignmentgroup"),s=o[n];s||(s=o[n]={});var f=s[a];f?f.traces.push(E):f=s[a]={traces:[E],alignmentIndex:Object.keys(s).length,offsetGroups:{}};var v=t("offsetgroup")||"",g=f.offsetGroups,m=g[v];E._offsetIndex=0,(e!=="group"||v)&&(m||(m=g[v]={offsetIndex:Object.keys(g).length}),E._offsetIndex=m.offsetIndex)}}),Nb=Vt((K,V)=>{var u=Xr(),d=p0(),E=dc();V.exports=function(A,t){var e,r,i,n=t.scattermode;function o(g){return u.coerce(r._input,r,E,g)}if(t.scattermode==="group")for(i=0;i=0;f--){var v=A[f];if(v.type==="scatter"&&v.xaxis===a.xaxis&&v.yaxis===a.yaxis){v.opacity=void 0;break}}}}}}),Ok=Vt((K,V)=>{var u=Xr(),d=qy();V.exports=function(E,A){function t(r,i){return u.coerce(E,A,d,r,i)}var e=A.barmode==="group";A.scattermode==="group"&&t("scattergap",e?A.bargap:.2)}}),ep=Vt((K,V)=>{var u=Lo(),d=Xr(),E=d.dateTime2ms,A=d.incrementMonth,t=ks(),e=t.ONEAVGMONTH;V.exports=function(r,i,n,o){if(i.type!=="date")return{vals:o};var a=r[n+"periodalignment"];if(!a)return{vals:o};var s=r[n+"period"],f;if(u(s)){if(s=+s,s<=0)return{vals:o}}else if(typeof s=="string"&&s.charAt(0)==="M"){var v=+s.substring(1);if(v>0&&Math.round(v)===v)f=v;else return{vals:o}}for(var g=i.calendar,m=a==="start",w=a==="end",l=r[n+"period0"],x=E(l,g)||0,y=[],S=[],k=[],M=o.length,T=0;Tc;)_=A(_,-f,g);for(;_<=c;)_=A(_,f,g);b=A(_,-f,g)}else{for(h=Math.round((c-x)/s),_=x+h*s;_>c;)_-=s;for(;_<=c;)_+=s;b=_-s}y[T]=m?b:w?_:(b+_)/2,S[T]=b,k[T]=_}return{vals:y,starts:S,ends:k}}}),Nh=Vt((K,V)=>{var u=ah().hasColorscale,d=ih(),E=nu();V.exports=function(A,t){E.hasLines(t)&&u(t,"line")&&d(A,t,{vals:t.line.color,containerStr:"line",cLetter:"c"}),E.hasMarkers(t)&&(u(t,"marker")&&d(A,t,{vals:t.marker.color,containerStr:"marker",cLetter:"c"}),u(t,"marker.line")&&d(A,t,{vals:t.marker.line.color,containerStr:"marker.line",cLetter:"c"}))}}),yp=Vt((K,V)=>{var u=Xr();V.exports=function(d,E){for(var A=0;A{var u=Xr();V.exports=function(d,E){u.isArrayOrTypedArray(E.selectedpoints)&&u.tagSelected(d,E)}}),Uh=Vt((K,V)=>{var u=Lo(),d=Xr(),E=yo(),A=ep(),t=ks().BADNUM,e=nu(),r=Nh(),i=yp(),n=jh();function o(m,w){var l=m._fullLayout,x=w._xA=E.getFromId(m,w.xaxis||"x","x"),y=w._yA=E.getFromId(m,w.yaxis||"y","y"),S=x.makeCalcdata(w,"x"),k=y.makeCalcdata(w,"y"),M=A(w,x,"x",S),T=A(w,y,"y",k),c=M.vals,h=T.vals,b=w._length,_=new Array(b),P=w.ids,z=g(w,l,x,y),D=!1,B,R,I,F,j,N;f(l,w);var G="x",rt="y",ct;if(z)d.pushUnique(z.traceIndices,w.index),B=z.orientation==="v",B?(rt="s",ct="x"):(G="s",ct="y"),j=z.stackgaps==="interpolate";else{var st=s(w,b);a(m,w,x,y,c,h,st)}var et=!!w.xperiodalignment,Z=!!w.yperiodalignment;for(R=0;RR&&_[F].gap;)F--;for(N=_[F].s,I=_.length-1;I>F;I--)_[I].s=N;for(;R{V.exports=d;var u=Xr().distinctVals;function d(E,A){this.traces=E,this.sepNegVal=A.sepNegVal,this.overlapNoMerge=A.overlapNoMerge;for(var t=1/0,e=A.posAxis._id.charAt(0),r=[],i=0;i{var u=Lo(),d=Xr().isArrayOrTypedArray,E=ks().BADNUM,A=ji(),t=yo(),e=f0().getAxisGroup,r=Dk();function i(_,P){for(var z=P.xaxis,D=P.yaxis,B=_._fullLayout,R=_._fullData,I=_.calcdata,F=[],j=[],N=0;Nj+I||!u(F))}for(var G=0;G{var u=Uh(),d=d0().setGroupPositions;function E(e,r){for(var i=r.xaxis,n=r.yaxis,o=e._fullLayout,a=e._fullData,s=e.calcdata,f=[],v=[],g=0;gz[g]&&g{var u=Eo(),d=ks(),E=d.BADNUM,A=d.LOG_CLIP,t=A+.5,e=A-.5,r=Xr(),i=r.segmentsIntersect,n=r.constrain,o=vp();V.exports=function(a,s){var f=s.trace||{},v=s.xaxis,g=s.yaxis,m=v.type==="log",w=g.type==="log",l=v._length,x=g._length,y=s.backoff,S=f.marker,k=s.connectGaps,M=s.baseTolerance,T=s.shape,c=T==="linear",h=f.fill&&f.fill!=="none",b=[],_=o.minTolerance,P=a.length,z=new Array(P),D=0,B,R,I,F,j,N,G,rt,ct,st,et,Z,ot,X,Q,ut;function J(se){var ke=a[se];if(!ke)return!1;var Ee=s.linearized?v.l2p(ke.x):v.c2p(ke.x),Ue=s.linearized?g.l2p(ke.y):g.c2p(ke.y);if(Ee===E){if(m&&(Ee=v.c2p(ke.x,!0)),Ee===E)return!1;w&&Ue===E&&(Ee*=Math.abs(v._m*x*(v._m>0?t:e)/(g._m*l*(g._m>0?t:e)))),Ee*=1e3}if(Ue===E){if(w&&(Ue=g.c2p(ke.y,!0)),Ue===E)return!1;Ue*=1e3}return[Ee,Ue]}function q(se,ke,Ee,Ue){var ir=Ee-se,ar=Ue-ke,Ye=.5-se,Er=.5-ke,pn=ir*ir+ar*ar,dn=ir*Ye+ar*Er;if(dn>0&&dn1||Math.abs(Ye.y-Ee[0][1])>1)&&(Ye=[Ye.x,Ye.y],Ue&&Tt(Ye,se)It||se[1]te)return[n(se[0],Ct,It),n(se[1],Nt,te)]}function ue(se,ke){if(se[0]===ke[0]&&(se[0]===Ct||se[0]===It)||se[1]===ke[1]&&(se[1]===Nt||se[1]===te))return!0}function Me(se,ke){var Ee=[],Ue=Kt(se),ir=Kt(ke);return Ue&&ir&&ue(Ue,ir)||(Ue&&Ee.push(Ue),ir&&Ee.push(ir)),Ee}function Ce(se,ke,Ee){return function(Ue,ir){var ar=Kt(Ue),Ye=Kt(ir),Er=[];if(ar&&Ye&&ue(ar,Ye))return Er;ar&&Er.push(ar),Ye&&Er.push(Ye);var pn=2*r.constrain((Ue[se]+ir[se])/2,ke,Ee)-((ar||Ue)[se]+(Ye||ir)[se]);if(pn){var dn;ar&&Ye?dn=pn>0==ar[se]>Ye[se]?ar:Ye:dn=ar||Ye,dn[se]+=pn}return Er}}var We;T==="linear"||T==="spline"?We=re:T==="hv"||T==="vh"?We=Me:T==="hvh"?We=Ce(0,Ct,It):T==="vhv"&&(We=Ce(1,Nt,te));function qe(se,ke){var Ee=ke[0]-se[0],Ue=(ke[1]-se[1])/Ee,ir=(se[1]*ke[0]-ke[1]*se[0])/Ee;return ir>0?[Ue>0?Ct:It,te]:[Ue>0?It:Ct,Nt]}function vr(se){var ke=se[0],Ee=se[1],Ue=ke===z[D-1][0],ir=Ee===z[D-1][1];if(!(Ue&&ir))if(D>1){var ar=ke===z[D-2][0],Ye=Ee===z[D-2][1];Ue&&(ke===Ct||ke===It)&&ar?Ye?D--:z[D-1]=se:ir&&(Ee===Nt||Ee===te)&&Ye?ar?D--:z[D-1]=se:z[D++]=se}else z[D++]=se}function _r(se){z[D-1][0]!==se[0]&&z[D-1][1]!==se[1]&&vr([mt,bt]),vr(se),vt=null,mt=bt=0}var er=r.isArrayOrTypedArray(S);function Mr(se){if(se&&y&&(se.i=B,se.d=a,se.trace=f,se.marker=er?S[se.i]:S,se.backoff=y),it=se[0]/l,nt=se[1]/x,ee=se[0]It?It:0,Zt=se[1]te?te:0,ee||Zt){if(!D)z[D++]=[ee||se[0],Zt||se[1]];else if(vt){var ke=We(vt,se);ke.length>1&&(_r(ke[0]),z[D++]=ke[1])}else Ut=We(z[D-1],se)[0],z[D++]=Ut;var Ee=z[D-1];ee&&Zt&&(Ee[0]!==ee||Ee[1]!==Zt)?(vt&&(mt!==ee&&bt!==Zt?vr(mt&&bt?qe(vt,se):[mt||ee,bt||Zt]):mt&&bt&&vr([mt,bt])),vr([ee,Zt])):mt-ee&&bt-Zt&&vr([ee||mt,Zt||bt]),vt=se,mt=ee,bt=Zt}else vt&&_r(We(vt,se)[0]),z[D++]=se}for(B=0;Bdt(N,Ir))break;I=N,ot=ct[0]*rt[0]+ct[1]*rt[1],ot>et?(et=ot,F=N,G=!1):ot=a.length||!N)break;Mr(N),R=N}}vt&&vr([mt||vt[0],bt||vt[1]]),b.push(z.slice(0,D))}var de=T.slice(T.length-1);if(y&&de!=="h"&&de!=="v"){for(var Dt=!1,qt=-1,_t=[],lt=0;lt{var u={tonextx:1,tonexty:1,tonext:1};V.exports=function(d,E,A){var t,e,r,i,n,o={},a=!1,s=-1,f=0,v=-1;for(e=0;e=0?n=v:(n=v=f,f++),n{var u=Ni(),d=ji(),E=Xr(),A=E.ensureSingle,t=E.identity,e=Eo(),r=nu(),i=jb(),n=Ub(),o=qg().tester;V.exports=function(v,g,m,w,l,x){var y,S,k=!l,M=!!l&&l.duration>0,T=n(v,g,m);if(y=w.selectAll("g.trace").data(T,function(h){return h[0].trace.uid}),y.enter().append("g").attr("class",function(h){return"trace scatter trace"+h[0].trace.uid}).style("stroke-miterlimit",2),y.order(),a(v,y,g),M){x&&(S=x());var c=u.transition().duration(l.duration).ease(l.easing).each("end",function(){S&&S()}).each("interrupt",function(){S&&S()});c.each(function(){w.selectAll("g.trace").each(function(h,b){s(v,b,g,h,T,this,l)})})}else y.each(function(h,b){s(v,b,g,h,T,this,l)});k&&y.exit().remove(),w.selectAll("path:not([d])").remove()};function a(v,g,m){g.each(function(w){var l=A(u.select(this),"g","fills");e.setClipUrl(l,m.layerClipId,v);var x=w[0].trace,y=[];x._ownfill&&y.push("_ownFill"),x._nexttrace&&y.push("_nextFill");var S=l.selectAll("g").data(y,t);S.enter().append("g"),S.exit().each(function(k){x[k]=null}).remove(),S.order().each(function(k){x[k]=A(u.select(this),"path","js-fill")})})}function s(v,g,m,w,l,x,y){var S=v._context.staticPlot,k;f(v,g,m,w,l);var M=!!y&&y.duration>0;function T(_r){return M?_r.transition():_r}var c=m.xaxis,h=m.yaxis,b=w[0].trace,_=b.line,P=u.select(x),z=A(P,"g","errorbars"),D=A(P,"g","lines"),B=A(P,"g","points"),R=A(P,"g","text");if(d.getComponentMethod("errorbars","plot")(v,z,m,y),b.visible!==!0)return;T(P).style("opacity",b.opacity);var I,F,j=b.fill.charAt(b.fill.length-1);j!=="x"&&j!=="y"&&(j="");var N,G;j==="y"?(N=1,G=h.c2p(0,!0)):j==="x"&&(N=0,G=c.c2p(0,!0)),w[0][m.isRangePlot?"nodeRangePlot3":"node3"]=P;var rt="",ct=[],st=b._prevtrace,et=null,Z=null;st&&(rt=st._prevRevpath||"",F=st._nextFill,ct=st._ownPolygons,et=st._fillsegments,Z=st._fillElement);var ot,X,Q="",ut="",J,q,it,nt,dt,Tt,wt=[];b._polygons=[];var Ct=[],It=[],Nt=E.noop;if(I=b._ownFill,r.hasLines(b)||b.fill!=="none"){F&&F.datum(w),["hv","vh","hvh","vhv"].indexOf(_.shape)!==-1?(J=e.steps(_.shape),q=e.steps(_.shape.split("").reverse().join(""))):_.shape==="spline"?J=q=function(_r){var er=_r[_r.length-1];return _r.length>1&&_r[0][0]===er[0]&&_r[0][1]===er[1]?e.smoothclosed(_r.slice(1),_.smoothing):e.smoothopen(_r,_.smoothing)}:J=q=function(_r){return"M"+_r.join("L")},it=function(_r){return q(_r.reverse())},It=i(w,{xaxis:c,yaxis:h,trace:b,connectGaps:b.connectgaps,baseTolerance:Math.max(_.width||1,3)/4,shape:_.shape,backoff:_.backoff,simplify:_.simplify,fill:b.fill}),Ct=new Array(It.length);var te=0;for(k=0;k=S[0]&&P.x<=S[1]&&P.y>=k[0]&&P.y<=k[1]}),h=Math.ceil(c.length/T),b=0;l.forEach(function(P,z){var D=P[0].trace;r.hasMarkers(D)&&D.marker.maxdisplayed>0&&z{V.exports={container:"marker",min:"cmin",max:"cmax"}}),n1=Vt((K,V)=>{var u=yo();V.exports=function(d,E,A){var t={},e={_fullLayout:A},r=u.getFromTrace(e,E,"x"),i=u.getFromTrace(e,E,"y"),n=d.orig_x;n===void 0&&(n=d.x);var o=d.orig_y;return o===void 0&&(o=d.y),t.xLabel=u.tickText(r,r.c2l(n),!0).text,t.yLabel=u.tickText(i,i.c2l(o),!0).text,t}}),gh=Vt((K,V)=>{var u=Ni(),d=Eo(),E=ji();function A(i){var n=u.select(i).selectAll("g.trace.scatter");n.style("opacity",function(o){return o[0].trace.opacity}),n.selectAll("g.points").each(function(o){var a=u.select(this),s=o.trace||o[0].trace;t(a,s,i)}),n.selectAll("g.text").each(function(o){var a=u.select(this),s=o.trace||o[0].trace;e(a,s,i)}),n.selectAll("g.trace path.js-line").call(d.lineGroupStyle),n.selectAll("g.trace path.js-fill").call(d.fillGroupStyle,i,!1),E.getComponentMethod("errorbars","style")(n)}function t(i,n,o){d.pointStyle(i.selectAll("path.point"),n,o)}function e(i,n,o){d.textPointStyle(i.selectAll("text"),n,o)}function r(i,n,o){var a=n[0].trace;a.selectedpoints?(d.selectedPointStyle(o.selectAll("path.point"),a),d.selectedTextStyle(o.selectAll("text"),a)):(t(o,a,i),e(o,a,i))}V.exports={style:A,stylePoints:t,styleText:e,styleOnSelect:r}}),zm=Vt((K,V)=>{var u=Pi(),d=nu();V.exports=function(E,A){var t,e;if(E.mode==="lines")return t=E.line.color,t&&u.opacity(t)?t:E.fillcolor;if(E.mode==="none")return E.fill?E.fillcolor:"";var r=A.mcc||(E.marker||{}).color,i=A.mlcc||((E.marker||{}).line||{}).color;return e=r&&u.opacity(r)?r:i&&u.opacity(i)&&(A.mlw||((E.marker||{}).line||{}).width)?i:"",e?u.opacity(e)<.3?u.addOpacity(e,.3):e:(t=(E.line||{}).color,t&&u.opacity(t)&&d.hasLines(E)&&E.line.width?t:E.fillcolor)}}),Lm=Vt((K,V)=>{var u=Xr(),d=pc(),E=ji(),A=zm(),t=Pi(),e=u.fillText;V.exports=function(r,i,n,o){var a=r.cd,s=a[0].trace,f=r.xa,v=r.ya,g=f.c2p(i),m=v.c2p(n),w=[g,m],l=s.hoveron||"",x=s.mode.indexOf("markers")!==-1?3:.5,y=!!s.xperiodalignment,S=!!s.yperiodalignment;if(l.indexOf("points")!==-1){var k=function(rt){if(y){var ct=f.c2p(rt.xStart),st=f.c2p(rt.xEnd);return g>=Math.min(ct,st)&&g<=Math.max(ct,st)?0:1/0}var et=Math.max(3,rt.mrc||0),Z=1-1/et,ot=Math.abs(f.c2p(rt.x)-g);return ot=Math.min(ct,st)&&m<=Math.max(ct,st)?0:1/0}var et=Math.max(3,rt.mrc||0),Z=1-1/et,ot=Math.abs(v.c2p(rt.y)-m);return otQ!=wt>=Q&&(nt=q[J-1][0],dt=q[J][0],wt-Tt&&(it=nt+(dt-nt)*(Q-Tt)/(wt-Tt),et=Math.min(et,it),Z=Math.max(Z,it)));return et=Math.max(et,0),Z=Math.min(Z,f._length),{x0:et,x1:Z,y0:Q,y1:Q}}if(l.indexOf("fills")!==-1&&s._fillElement){var j=I(s._fillElement)&&!I(s._fillExclusionElement);if(j){var N=F(s._polygons);N===null&&(N={x0:w[0],x1:w[0],y0:w[1],y1:w[1]});var G=t.defaultLine;return t.opacity(s.fillcolor)?G=s.fillcolor:t.opacity((s.line||{}).color)&&(G=s.line.color),u.extendFlat(r,{distance:r.maxHoverDistance,x0:N.x0,x1:N.x1,y0:N.y0,y1:N.y1,color:G,hovertemplate:!1}),delete r.index,s.text&&!u.isArrayOrTypedArray(s.text)?r.text=String(s.text):r.text=s.name,[r]}}}}),Cm=Vt((K,V)=>{var u=nu();V.exports=function(d,E){var A=d.cd,t=d.xaxis,e=d.yaxis,r=[],i=A[0].trace,n,o,a,s,f=!u.hasMarkers(i)&&!u.hasText(i);if(f)return[];if(E===!1)for(n=0;n{V.exports={xaxis:{valType:"subplotid",dflt:"x",editType:"calc+clearAxisTypes"},yaxis:{valType:"subplotid",dflt:"y",editType:"calc+clearAxisTypes"}}}),Vb=Vt((K,V)=>{var u=ji().traceIs,d=km();V.exports=function(r,i,n,o){n("autotypenumbers",o.autotypenumbersDflt);var a=n("type",(o.splomStash||{}).type);a==="-"&&(E(i,o.data),i.type==="-"?i.type="linear":r.type=i.type)};function E(r,i){if(r.type==="-"){var n=r._id,o=n.charAt(0),a;n.indexOf("scene")!==-1&&(n=o);var s=A(i,n,o);if(s){if(s.type==="histogram"&&o==={v:"y",h:"x"}[s.orientation||"v"]){r.type="linear";return}var f=o+"calendar",v=s[f],g={noMultiCategory:!u(s,"cartesian")||u(s,"noMultiCategory")};if(s.type==="box"&&s._hasPreCompStats&&o==={h:"x",v:"y"}[s.orientation||"v"]&&(g.noMultiCategory=!0),g.autotypenumbers=r.autotypenumbers,e(s,o)){var m=t(s),w=[];for(a=0;a0&&(a["_"+n+"axes"]||{})[i]||(a[n+"axis"]||n)===i&&(e(a,n)||(a[n]||[]).length||a[n+"0"]))return a}}function t(r){return{v:"x",h:"y"}[r.orientation||"v"]}function e(r,i){var n=t(r),o=u(r,"box-violin"),a=u(r._fullInput||{},"candlestick");return o&&!a&&i===n&&r[n]===void 0&&r[n+"0"]===void 0}}),a1=Vt((K,V)=>{var u=nh().isTypedArraySpec;function d(E,A){var t=A.dataAttr||E._id.charAt(0),e={},r,i,n;if(A.axData)r=A.axData;else for(r=[],i=0;i0||u(r),n;i&&(n="array");var o=t("categoryorder",n),a;o==="array"&&(a=t("categoryarray")),!i&&o==="array"&&(o=A.categoryorder="trace"),o==="trace"?A._initialCategories=[]:o==="array"?A._initialCategories=a.slice():(a=d(A,e).sort(),o==="category ascending"?A._initialCategories=a:o==="category descending"&&(A._initialCategories=a.reverse()))}}}),Zg=Vt((K,V)=>{var u=Af().mix,d=af(),E=Xr();V.exports=function(A,t,e,r){r=r||{};var i=r.dfltColor;function n(h,b){return E.coerce2(A,t,r.attributes,h,b)}var o=n("linecolor",i),a=n("linewidth"),s=e("showline",r.showLine||!!o||!!a);s||(delete t.linecolor,delete t.linewidth);var f=u(i,r.bgColor,r.blend||d.lightFraction).toRgbString(),v=n("gridcolor",f),g=n("gridwidth"),m=n("griddash"),w=e("showgrid",r.showGrid||!!v||!!g||!!m);if(w||(delete t.gridcolor,delete t.gridwidth,delete t.griddash),r.hasMinor){var l=u(t.gridcolor,r.bgColor,67).toRgbString(),x=n("minor.gridcolor",l),y=n("minor.gridwidth",t.gridwidth||1),S=n("minor.griddash",t.griddash||"solid"),k=e("minor.showgrid",!!x||!!y||!!S);k||(delete t.minor.gridcolor,delete t.minor.gridwidth,delete t.minor.griddash)}if(!r.noZeroLine){n("zerolinelayer");var M=n("zerolinecolor",i),T=n("zerolinewidth"),c=e("zeroline",r.showGrid||!!M||!!T);c||(delete t.zerolinelayer,delete t.zerolinecolor,delete t.zerolinewidth)}}}),Kg=Vt((K,V)=>{var u=Lo(),d=ji(),E=Xr(),A=cl(),t=Gf(),e=Of(),r=u0(),i=wm(),n=Ad(),o=Md(),a=a1(),s=Zg(),f=vb(),v=gp(),g=Mf().WEEKDAY_PATTERN,m=Mf().HOUR_PATTERN;V.exports=function(y,S,k,M,T){var c=M.letter,h=M.font||{},b=M.splomStash||{},_=k("visible",!M.visibleDflt),P=S._template||{},z=S.type||P.type||"-",D;if(z==="date"){var B=d.getComponentMethod("calendars","handleDefaults");B(y,S,"calendar",M.calendar),M.noTicklabelmode||(D=k("ticklabelmode"))}!M.noTicklabelindex&&(z==="date"||z==="linear")&&k("ticklabelindex");var R="";(!M.noTicklabelposition||z==="multicategory")&&(R=E.coerce(y,S,{ticklabelposition:{valType:"enumerated",dflt:"outside",values:D==="period"?["outside","inside"]:c==="x"?["outside","inside","outside left","inside left","outside right","inside right"]:["outside","inside","outside top","inside top","outside bottom","inside bottom"]}},"ticklabelposition")),M.noTicklabeloverflow||k("ticklabeloverflow",R.indexOf("inside")!==-1?"hide past domain":z==="category"||z==="multicategory"?"allow":"hide past div"),v(S,T),f(y,S,k,M),a(y,S,k,M),M.noHover||(z!=="category"&&k("hoverformat"),M.noUnifiedhovertitle||k("unifiedhovertitle.text"));var I=k("color"),F=I!==e.color.dflt?I:h.color,j=b.label||T._dfltTitle[c];if(o(y,S,k,z,M),!_)return S;k("title.text",j),E.coerceFont(k,"title.font",h,{overrideDflt:{size:E.bigFont(h.size),color:F}}),r(y,S,k,z);var N=M.hasMinor;if(N&&(A.newContainer(S,"minor"),r(y,S,k,z,{isMinor:!0})),n(y,S,k,z,M),i(y,S,k,M),N){var G=M.isMinor;M.isMinor=!0,i(y,S,k,M),M.isMinor=G}s(y,S,k,{dfltColor:I,bgColor:M.bgColor,showGrid:M.showGrid,hasMinor:N,attributes:e}),N&&!S.minor.ticks&&!S.minor.showgrid&&delete S.minor,(S.showline||S.ticks)&&k("mirror");var rt=z==="multicategory";if(!M.noTickson&&(z==="category"||rt)&&(S.ticks||S.showgrid)&&(rt?(k("tickson","boundaries"),delete S.ticklabelposition):k("tickson")),rt){var ct=k("showdividers");ct&&(k("dividercolor"),k("dividerwidth"))}if(z==="date")if(t(y,S,{name:"rangebreaks",inclusionAttr:"enabled",handleItemDefaults:w}),!S.rangebreaks.length)delete S.rangebreaks;else{for(var st=0;st=2){var h="",b,_;if(c.length===2){for(b=0;b<2;b++)if(_=x(c[b]),_){h=g;break}}var P=M("pattern",h);if(P===g)for(b=0;b<2;b++)_=x(c[b]),_&&(S.bounds[b]=c[b]=_-1);if(P)for(b=0;b<2;b++)switch(_=c[b],P){case g:if(!u(_)){S.enabled=!1;return}if(_=+_,_!==Math.floor(_)||_<0||_>=7){S.enabled=!1;return}S.bounds[b]=c[b]=_;break;case m:if(!u(_)){S.enabled=!1;return}if(_=+_,_<0||_>24){S.enabled=!1;return}S.bounds[b]=c[b]=_;break}if(k.autorange===!1){var z=k.range;if(z[0]z[1]){S.enabled=!1;return}}else if(c[0]>z[0]&&c[1]{var u=Lo(),d=Xr();V.exports=function(E,A,t,e){var r=e.counterAxes||[],i=e.overlayableAxes||[],n=e.letter,o=e.grid,a=e.overlayingDomain,s,f,v,g,m,w;o&&(f=o._domains[n][o._axisMap[A._id]],s=o._anchors[A._id],f&&(v=o[n+"side"].split(" ")[0],g=o.domain[n][v==="right"||v==="top"?1:0])),f=f||[0,1],s=s||(u(E.position)?"free":r[0]||"free"),v=v||(n==="x"?"bottom":"left"),g=g||0,m=0,w=!1;var l=d.coerce(E,A,{anchor:{valType:"enumerated",values:["free"].concat(r),dflt:s}},"anchor"),x=d.coerce(E,A,{side:{valType:"enumerated",values:n==="x"?["bottom","top"]:["left","right"],dflt:v}},"side");if(l==="free"){if(n==="y"){var y=t("autoshift");y&&(g=x==="left"?a[0]:a[1],w=A.automargin?A.automargin:!0,m=x==="left"?-3:3),t("shift",m)}t("position",g)}t("automargin",w);var S=!1;if(i.length&&(S=d.coerce(E,A,{overlaying:{valType:"enumerated",values:[!1].concat(i),dflt:!1}},"overlaying")),!S){var k=t("domain",f);k[0]>k[1]-1/4096&&(A.domain=f),d.noneOrAll(E.domain,A.domain,f),A.tickmode==="sync"&&(A.tickmode="auto")}return t("layer"),A}}),Rk=Vt((K,V)=>{var u=Xr(),d=Pi(),E=mh().isUnifiedHover,A=kb(),t=cl(),e=xm(),r=Of(),i=Vb(),n=Kg(),o=f0(),a=i1(),s=fc(),f=s.id2name,v=s.name2id,g=Mf().AX_ID_PATTERN,m=ji(),w=m.traceIs,l=m.getComponentMethod;function x(y,S,k){Array.isArray(y[S])?y[S].push(k):y[S]=[k]}V.exports=function(y,S,k){var M=S.autotypenumbers,T={},c={},h={},b={},_={},P={},z={},D={},B={},R={},I,F;for(I=0;I{var u=Ni(),d=ji(),E=Xr(),A=Eo(),t=yo();V.exports=function(e,r,i,n){var o=e._fullLayout;if(r.length===0){t.redrawComponents(e);return}function a(S){var k=S.xaxis,M=S.yaxis;o._defs.select("#"+S.clipId+"> rect").call(A.setTranslate,0,0).call(A.setScale,1,1),S.plot.call(A.setTranslate,k._offset,M._offset).call(A.setScale,1,1);var T=S.plot.selectAll(".scatterlayer .trace");T.selectAll(".point").call(A.setPointGroupScale,1,1),T.selectAll(".textpoint").call(A.setTextPointsScale,1,1),T.call(A.hideOutsideRangePoints,S)}function s(S,k){var M=S.plotinfo,T=M.xaxis,c=M.yaxis,h=T._length,b=c._length,_=!!S.xr1,P=!!S.yr1,z=[];if(_){var D=E.simpleMap(S.xr0,T.r2l),B=E.simpleMap(S.xr1,T.r2l),R=D[1]-D[0],I=B[1]-B[0];z[0]=(D[0]*(1-k)+k*B[0]-D[0])/(D[1]-D[0])*h,z[2]=h*(1-k+k*I/R),T.range[0]=T.l2r(D[0]*(1-k)+k*B[0]),T.range[1]=T.l2r(D[1]*(1-k)+k*B[1])}else z[0]=0,z[2]=h;if(P){var F=E.simpleMap(S.yr0,c.r2l),j=E.simpleMap(S.yr1,c.r2l),N=F[1]-F[0],G=j[1]-j[0];z[1]=(F[1]*(1-k)+k*j[1]-F[1])/(F[0]-F[1])*b,z[3]=b*(1-k+k*G/N),c.range[0]=T.l2r(F[0]*(1-k)+k*j[0]),c.range[1]=c.l2r(F[1]*(1-k)+k*j[1])}else z[1]=0,z[3]=b;t.drawOne(e,T,{skipTitle:!0}),t.drawOne(e,c,{skipTitle:!0}),t.redrawComponents(e,[T._id,c._id]);var rt=_?h/z[2]:1,ct=P?b/z[3]:1,st=_?z[0]:0,et=P?z[1]:0,Z=_?z[0]/z[2]*h:0,ot=P?z[1]/z[3]*b:0,X=T._offset-Z,Q=c._offset-ot;M.clipRect.call(A.setTranslate,st,et).call(A.setScale,1/rt,1/ct),M.plot.call(A.setTranslate,X,Q).call(A.setScale,rt,ct),A.setPointGroupScale(M.zoomScalePts,1/rt,1/ct),A.setTextPointsScale(M.zoomScaleTxt,1/rt,1/ct)}var f;n&&(f=n());function v(){for(var S={},k=0;ki.duration?(v(),l=window.cancelAnimationFrame(y)):l=window.requestAnimationFrame(y)}return m=Date.now(),l=window.requestAnimationFrame(y),Promise.resolve()}}),Yc=Vt(K=>{var V=Ni(),u=ji(),d=Xr(),E=Vu(),A=Eo(),t=Pf().getModuleCalcData,e=fc(),r=Mf(),i=zh(),n=d.ensureSingle;function o(w,l,x){return d.ensureSingle(w,l,x,function(y){y.datum(x)})}var a=r.zindexSeparator;K.name="cartesian",K.attr=["xaxis","yaxis"],K.idRoot=["x","y"],K.idRegex=r.idRegex,K.attrRegex=r.attrRegex,K.attributes=Bk(),K.layoutAttributes=Of(),K.supplyLayoutDefaults=Rk(),K.transitionAxes=Nk(),K.finalizeSubplots=function(w,l){var x=l._subplots,y=x.xaxis,S=x.yaxis,k=x.cartesian,M=k,T={},c={},h,b,_;for(h=0;h0){var z=P.id;if(z.indexOf(a)!==-1)continue;z+=a+(h+1),P=d.extendFlat({},P,{id:z,plot:S._cartesianlayer.selectAll(".subplot").select("."+z)})}for(var D=[],B,R=0;R1&&(G+=a+N),j.push(T+G),M=0;M1,_=l.mainplotinfo;if(!l.mainplot||b)if(h)l.xlines=n(y,"path","xlines-above"),l.ylines=n(y,"path","ylines-above"),l.xaxislayer=n(y,"g","xaxislayer-above"),l.yaxislayer=n(y,"g","yaxislayer-above");else{if(!M){var P=n(y,"g","layer-subplot");l.shapelayer=n(P,"g","shapelayer"),l.imagelayer=n(P,"g","imagelayer"),_&&b?(l.minorGridlayer=_.minorGridlayer,l.gridlayer=_.gridlayer,l.zerolinelayer=_.zerolinelayer):(l.minorGridlayer=n(y,"g","minor-gridlayer"),l.gridlayer=n(y,"g","gridlayer"),l.zerolinelayer=n(y,"g","zerolinelayer"));var z=n(y,"g","layer-between");l.shapelayerBetween=n(z,"g","shapelayer"),l.imagelayerBetween=n(z,"g","imagelayer"),n(y,"path","xlines-below"),n(y,"path","ylines-below"),l.overlinesBelow=n(y,"g","overlines-below"),n(y,"g","xaxislayer-below"),n(y,"g","yaxislayer-below"),l.overaxesBelow=n(y,"g","overaxes-below")}l.overplot=n(y,"g","overplot"),l.plot=n(l.overplot,"g",S),_&&b?l.zerolinelayerAbove=_.zerolinelayerAbove:l.zerolinelayerAbove=n(y,"g","zerolinelayer-above"),M||(l.xlines=n(y,"path","xlines-above"),l.ylines=n(y,"path","ylines-above"),l.overlinesAbove=n(y,"g","overlines-above"),n(y,"g","xaxislayer-above"),n(y,"g","yaxislayer-above"),l.overaxesAbove=n(y,"g","overaxes-above"),l.xlines=y.select(".xlines-"+T),l.ylines=y.select(".ylines-"+c),l.xaxislayer=y.select(".xaxislayer-"+T),l.yaxislayer=y.select(".yaxislayer-"+c))}else{var D=_.plotgroup,B=S+"-x",R=S+"-y";l.minorGridlayer=_.minorGridlayer,l.gridlayer=_.gridlayer,l.zerolinelayer=_.zerolinelayer,l.zerolinelayerAbove=_.zerolinelayerAbove,n(_.overlinesBelow,"path",B),n(_.overlinesBelow,"path",R),n(_.overaxesBelow,"g",B),n(_.overaxesBelow,"g",R),l.plot=n(_.overplot,"g",S),n(_.overlinesAbove,"path",B),n(_.overlinesAbove,"path",R),n(_.overaxesAbove,"g",B),n(_.overaxesAbove,"g",R),l.xlines=D.select(".overlines-"+T).select("."+B),l.ylines=D.select(".overlines-"+c).select("."+R),l.xaxislayer=D.select(".overaxes-"+T).select("."+B),l.yaxislayer=D.select(".overaxes-"+c).select("."+R)}M||(h||(o(l.minorGridlayer,"g",l.xaxis._id),o(l.minorGridlayer,"g",l.yaxis._id),l.minorGridlayer.selectAll("g").map(function(I){return I[0]}).sort(e.idSort),o(l.gridlayer,"g",l.xaxis._id),o(l.gridlayer,"g",l.yaxis._id),l.gridlayer.selectAll("g").map(function(I){return I[0]}).sort(e.idSort)),l.xlines.style("fill","none").classed("crisp",!0),l.ylines.style("fill","none").classed("crisp",!0))}function g(w,l){if(w){var x={};w.each(function(c){var h=c[0],b=V.select(this);b.remove(),m(h,l),x[h]=!0});for(var y in l._plots)for(var S=l._plots[y],k=S.overlays||[],M=0;M{var u=nu();V.exports={hasLines:u.hasLines,hasMarkers:u.hasMarkers,hasText:u.hasText,isBubble:u.isBubble,attributes:dc(),layoutAttributes:qy(),supplyDefaults:Pk(),crossTraceDefaults:Nb(),supplyLayoutDefaults:Ok(),calc:Uh().calc,crossTraceCalc:Fk(),arraysToCalcdata:yp(),plot:Em(),colorbar:Zf(),formatLabels:n1(),style:gh().style,styleOnSelect:gh().styleOnSelect,hoverPoints:Lm(),selectPoints:Cm(),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:Yc(),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}}),Uk=Vt((K,V)=>{var u=Ni(),d=Pi(),E=Pb(),A=Xr(),t=A.strScale,e=A.strRotate,r=A.strTranslate;V.exports=function(i,n,o){var a=i.node(),s=E[o.arrowhead||0],f=E[o.startarrowhead||0],v=(o.arrowwidth||1)*(o.arrowsize||1),g=(o.arrowwidth||1)*(o.startarrowsize||1),m=n.indexOf("start")>=0,w=n.indexOf("end")>=0,l=s.backoff*v+o.standoff,x=f.backoff*g+o.startstandoff,y,S,k,M;if(a.nodeName==="line"){y={x:+i.attr("x1"),y:+i.attr("y1")},S={x:+i.attr("x2"),y:+i.attr("y2")};var T=y.x-S.x,c=y.y-S.y;if(k=Math.atan2(c,T),M=k+Math.PI,l&&x&&l+x>Math.sqrt(T*T+c*c)){N();return}if(l){if(l*l>T*T+c*c){N();return}var h=l*Math.cos(k),b=l*Math.sin(k);S.x+=h,S.y+=b,i.attr({x2:S.x,y2:S.y})}if(x){if(x*x>T*T+c*c){N();return}var _=x*Math.cos(k),P=x*Math.sin(k);y.x-=_,y.y-=P,i.attr({x1:y.x,y1:y.y})}}else if(a.nodeName==="path"){var z=a.getTotalLength(),D="";if(z{var u=Ni(),d=ji(),E=Vu(),A=Xr(),t=A.strTranslate,e=yo(),r=Pi(),i=Eo(),n=pc(),o=Dl(),a=Xh(),s=oh(),f=cl().arrayEditor,v=Uk();V.exports={draw:g,drawOne:m,drawRaw:l};function g(x){var y=x._fullLayout;y._infolayer.selectAll(".annotation").remove();for(var S=0;S2/3?gn="right":gn="center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[gn]}for(var re=!1,Kt=["x","y"],ue=0;ue1)&&(We===Ce?(Yt=qe.r2fraction(y["a"+Me]),(Yt<0||Yt>1)&&(re=!0)):re=!0),qt=qe._offset+qe.r2p(y[Me]),yt=.5}else{var se=Ht==="domain";Me==="x"?(lt=y[Me],qt=se?qe._offset+qe._length*lt:qt=h.l+h.w*lt):(lt=1-y[Me],qt=se?qe._offset+qe._length*lt:qt=h.t+h.h*lt),yt=y.showarrow?.5:lt}if(y.showarrow){Dt.head=qt;var ke=y["a"+Me];if(St=_r*Ut(.5,y.xanchor)-er*Ut(.5,y.yanchor),We===Ce){var Ee=e.getRefType(We);Ee==="domain"?(Me==="y"&&(ke=1-ke),Dt.tail=qe._offset+qe._length*ke):Ee==="paper"?Me==="y"?(ke=1-ke,Dt.tail=h.t+h.h*ke):Dt.tail=h.l+h.w*ke:Dt.tail=qe._offset+qe.r2p(ke),_t=St}else Dt.tail=qt+ke,_t=St+ke;Dt.text=Dt.tail+St;var Ue=c[Me==="x"?"width":"height"];if(Ce==="paper"&&(Dt.head=A.constrain(Dt.head,1,Ue-1)),We==="pixel"){var ir=-Math.max(Dt.tail-3,Dt.text),ar=Math.min(Dt.tail+3,Dt.text)-Ue;ir>0?(Dt.tail+=ir,Dt.text+=ir):ar>0&&(Dt.tail-=ar,Dt.text-=ar)}Dt.tail+=de,Dt.head+=de}else St=Mr*Ut(yt,Ir),_t=St,Dt.text=qt+St;Dt.text+=de,St+=de,_t+=de,y["_"+Me+"padplus"]=Mr/2+_t,y["_"+Me+"padminus"]=Mr/2-_t,y["_"+Me+"size"]=Mr,y["_"+Me+"shift"]=St}if(re){et.remove();return}var Ye=0,Er=0;if(y.align!=="left"&&(Ye=(Zt-Jt)*(y.align==="center"?.5:1)),y.valign!=="top"&&(Er=(mt-ee)*(y.valign==="middle"?.5:1)),Nt)It.select("svg").attr({x:X+Ye-1,y:X+Er}).call(i.setClipUrl,ut?I:null,x);else{var pn=X+Er-te.top,dn=X+Ye-te.left;nt.call(o.positionText,dn,pn).call(i.setClipUrl,ut?I:null,x)}J.select("rect").call(i.setRect,X,X,Zt,mt),Q.call(i.setRect,Z/2,Z/2,bt-Z,vt-Z),et.call(i.setTranslate,Math.round(F.x.text-bt/2),Math.round(F.y.text-vt/2)),G.attr({transform:"rotate("+j+","+F.x.text+","+F.y.text+")"});var bn=function(En,gn){N.selectAll(".annotation-arrow-g").remove();var da=F.x.head,ra=F.y.head,Se=F.x.tail+En,Re=F.y.tail+gn,Ze=F.x.text+En,tr=F.y.text+gn,zr=A.rotationXYMatrix(j,Ze,tr),tn=A.apply2DTransform(zr),Yr=A.apply2DTransform2(zr),$r=+Q.attr("width"),In=+Q.attr("height"),Nn=Ze-.5*$r,Kn=Nn+$r,$n=tr-.5*In,ia=$n+In,Cn=[[Nn,$n,Nn,ia],[Nn,ia,Kn,ia],[Kn,ia,Kn,$n],[Kn,$n,Nn,$n]].map(Yr);if(!Cn.reduce(function(pe,Ke){return pe^!!A.segmentsIntersect(da,ra,da+1e6,ra+1e6,Ke[0],Ke[1],Ke[2],Ke[3])},!1)){Cn.forEach(function(pe){var Ke=A.segmentsIntersect(Se,Re,da,ra,pe[0],pe[1],pe[2],pe[3]);Ke&&(Se=Ke.x,Re=Ke.y)});var Fa=y.arrowwidth,Ga=y.arrowcolor,ve=y.arrowside,ge=N.append("g").style({opacity:r.opacity(Ga)}).classed("annotation-arrow-g",!0),dr=ge.append("path").attr("d","M"+Se+","+Re+"L"+da+","+ra).style("stroke-width",Fa+"px").call(r.stroke,r.rgb(Ga));if(v(dr,ve,y),b.annotationPosition&&dr.node().parentNode&&!k){var br=da,Tr=ra;if(y.standoff){var mr=Math.sqrt(Math.pow(da-Se,2)+Math.pow(ra-Re,2));br+=y.standoff*(Se-da)/mr,Tr+=y.standoff*(Re-ra)/mr}var kr=ge.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(Se-br)+","+(Re-Tr),transform:t(br,Tr)}).style("stroke-width",Fa+6+"px").call(r.stroke,"rgba(0,0,0,0)").call(r.fill,"rgba(0,0,0,0)"),Ur,Or;s.init({element:kr.node(),gd:x,prepFn:function(){var pe=i.getTranslate(et);Ur=pe.x,Or=pe.y,M&&M.autorange&&D(M._name+".autorange",!0),T&&T.autorange&&D(T._name+".autorange",!0)},moveFn:function(pe,Ke){var xr=tn(Ur,Or),Gr=xr[0]+pe,ln=xr[1]+Ke;et.call(i.setTranslate,Gr,ln),B("x",w(M,pe,"x",h,y)),B("y",w(T,Ke,"y",h,y)),y.axref===y.xref&&B("ax",w(M,pe,"ax",h,y)),y.ayref===y.yref&&B("ay",w(T,Ke,"ay",h,y)),ge.attr("transform",t(pe,Ke)),G.attr({transform:"rotate("+j+","+Gr+","+ln+")"})},doneFn:function(){d.call("_guiRelayout",x,R());var pe=document.querySelector(".js-notes-box-panel");pe&&pe.redraw(pe.selectedObj)}})}}};if(y.showarrow&&bn(0,0),rt){var Zn;s.init({element:et.node(),gd:x,prepFn:function(){Zn=G.attr("transform")},moveFn:function(En,gn){var da="pointer";if(y.showarrow)y.axref===y.xref?B("ax",w(M,En,"ax",h,y)):B("ax",y.ax+En),y.ayref===y.yref?B("ay",w(T,gn,"ay",h.w,y)):B("ay",y.ay+gn),bn(En,gn);else{if(k)return;var ra,Se;if(M)ra=w(M,En,"x",h,y);else{var Re=y._xsize/h.w,Ze=y.x+(y._xshift-y.xshift)/h.w-Re/2;ra=s.align(Ze+En/h.w,Re,0,1,y.xanchor)}if(T)Se=w(T,gn,"y",h,y);else{var tr=y._ysize/h.h,zr=y.y-(y._yshift+y.yshift)/h.h-tr/2;Se=s.align(zr-gn/h.h,tr,0,1,y.yanchor)}B("x",ra),B("y",Se),(!M||!T)&&(da=s.getCursor(M?.5:ra,T?.5:Se,y.xanchor,y.yanchor))}G.attr({transform:t(En,gn)+Zn}),a(et,da)},clickFn:function(En,gn){y.captureevents&&x.emit("plotly_clickannotation",st(gn))},doneFn:function(){a(et),d.call("_guiRelayout",x,R());var En=document.querySelector(".js-notes-box-panel");En&&En.redraw(En.selectedObj)}})}}b.annotationText?nt.call(o.makeEditable,{delegate:et,gd:x}).call(dt).on("edit",function(wt){y.text=wt,this.call(dt),B("text",wt),M&&M.autorange&&D(M._name+".autorange",!0),T&&T.autorange&&D(T._name+".autorange",!0),d.call("_guiRelayout",x,R())}):nt.call(dt)}}),Vk=Vt((K,V)=>{var u=Xr(),d=ji(),E=cl().arrayEditor;V.exports={hasClickToShow:A,onClick:t};function A(i,n){var o=e(i,n);return o.on.length>0||o.explicitOff.length>0}function t(i,n){var o=e(i,n),a=o.on,s=o.off.concat(o.explicitOff),f={},v=i._fullLayout.annotations,g,m;if(a.length||s.length){for(g=0;g{var u=Xr(),d=Pi();V.exports=function(E,A,t,e){e("opacity");var r=e("bgcolor"),i=e("bordercolor"),n=d.opacity(i);e("borderpad");var o=e("borderwidth"),a=e("showarrow");e("text",a?" ":t._dfltTitle.annotation),e("textangle"),u.coerceFont(e,"font",t.font),e("width"),e("align");var s=e("height");if(s&&e("valign"),a){var f=e("arrowside"),v,g;f.indexOf("end")!==-1&&(v=e("arrowhead"),g=e("arrowsize")),f.indexOf("start")!==-1&&(e("startarrowhead",v),e("startarrowsize",g)),e("arrowcolor",n?A.bordercolor:d.defaultLine),e("arrowwidth",(n&&o||1)*2),e("standoff"),e("startstandoff")}var m=e("hovertext"),w=t.hoverlabel||{};if(m){var l=e("hoverlabel.bgcolor",w.bgcolor||(d.opacity(r)?d.rgb(r):d.defaultLine)),x=e("hoverlabel.bordercolor",w.bordercolor||d.contrast(l)),y=u.extendFlat({},w.font);y.color||(y.color=x),u.coerceFont(e,"hoverlabel.font",y)}e("captureevents",!!m)}}),Hk=Vt((K,V)=>{var u=Xr(),d=yo(),E=Gf(),A=Hb(),t=h0();V.exports=function(r,i){E(r,i,{name:"annotations",handleItemDefaults:e})};function e(r,i,n){function o(h,b){return u.coerce(r,i,t,h,b)}var a=o("visible"),s=o("clicktoshow");if(a||s){A(r,i,n,o);for(var f=i.showarrow,v=["x","y"],g=[-10,-30],m={_fullLayout:n},w=0;w<2;w++){var l=v[w],x=d.coerceRef(r,i,m,l,"","paper");if(x!=="paper"){var y=d.getFromId(m,x);y._annIndices.push(i._index)}if(d.coercePosition(i,m,o,x,l,.5),f){var S="a"+l,k=d.coerceRef(r,i,m,S,"pixel",["pixel","paper"]);k!=="pixel"&&k!==x&&(k=i[S]="pixel");var M=k==="pixel"?g[w]:.4;d.coercePosition(i,m,o,k,S,M)}o(l+"anchor"),o(l+"shift")}if(u.noneOrAll(r,i,["x","y"]),f&&u.noneOrAll(r,i,["ax","ay"]),s){var T=o("xclick"),c=o("yclick");i._xclick=T===void 0?i.x:d.cleanPosition(T,m,i.xref),i._yclick=c===void 0?i.y:d.cleanPosition(c,m,i.yref)}}}}),qk=Vt((K,V)=>{var u=Xr(),d=yo(),E=o1().draw;V.exports=function(e){var r=e._fullLayout,i=u.filterVisible(r.annotations);if(i.length&&e._fullData.length)return u.syncOrAsync([E,A],e)};function A(e){var r=e._fullLayout;u.filterVisible(r.annotations).forEach(function(i){var n=d.getFromId(e,i.xref),o=d.getFromId(e,i.yref),a=d.getRefType(i.xref),s=d.getRefType(i.yref);i._extremes={},a==="range"&&t(i,n),s==="range"&&t(i,o)})}function t(e,r){var i=r._id,n=i.charAt(0),o=e[n],a=e["a"+n],s=e[n+"ref"],f=e["a"+n+"ref"],v=e["_"+n+"padplus"],g=e["_"+n+"padminus"],m={x:1,y:-1}[n]*e[n+"shift"],w=3*e.arrowsize*e.arrowwidth||0,l=w+m,x=w-m,y=3*e.startarrowsize*e.arrowwidth||0,S=y+m,k=y-m,M;if(f===s){var T=d.findExtremes(r,[r.r2c(o)],{ppadplus:l,ppadminus:x}),c=d.findExtremes(r,[r.r2c(a)],{ppadplus:Math.max(v,S),ppadminus:Math.max(g,k)});M={min:[T.min[0],c.min[0]],max:[T.max[0],c.max[0]]}}else S=a?S+a:S,k=a?k-a:k,M=d.findExtremes(r,[r.r2c(o)],{ppadplus:Math.max(v,l,S),ppadminus:Math.max(g,x,k)});e._extremes[i]=M}}),Wk=Vt((K,V)=>{var u=Lo(),d=By();V.exports=function(E,A,t,e){A=A||{};var r=t==="log"&&A.type==="linear",i=t==="linear"&&A.type==="log";if(!(r||i))return;var n=E._fullLayout.annotations,o=A._id.charAt(0),a,s;function f(g){var m=a[g],w=null;r?w=d(m,A.range):w=Math.pow(10,m),u(w)||(w=null),e(s+g,w)}for(var v=0;v{var u=o1(),d=Vk();V.exports={moduleType:"component",name:"annotations",layoutAttributes:h0(),supplyLayoutDefaults:Hk(),includeBasePlot:Gg()("annotations"),calcAutorange:qk(),draw:u.draw,drawOne:u.drawOne,drawRaw:u.drawRaw,hasClickToShow:d.hasClickToShow,onClick:d.onClick,convertCoords:Wk()}}),s1=Vt((K,V)=>{var u=h0(),d=Cu().overrideAll,E=cl().templatedArray;V.exports=d(E("annotation",{visible:u.visible,x:{valType:"any"},y:{valType:"any"},z:{valType:"any"},ax:{valType:"number"},ay:{valType:"number"},xanchor:u.xanchor,xshift:u.xshift,yanchor:u.yanchor,yshift:u.yshift,text:u.text,textangle:u.textangle,font:u.font,width:u.width,height:u.height,opacity:u.opacity,align:u.align,valign:u.valign,bgcolor:u.bgcolor,bordercolor:u.bordercolor,borderpad:u.borderpad,borderwidth:u.borderwidth,showarrow:u.showarrow,arrowcolor:u.arrowcolor,arrowhead:u.arrowhead,startarrowhead:u.startarrowhead,arrowside:u.arrowside,arrowsize:u.arrowsize,startarrowsize:u.startarrowsize,arrowwidth:u.arrowwidth,standoff:u.standoff,startstandoff:u.startstandoff,hovertext:u.hovertext,hoverlabel:u.hoverlabel,captureevents:u.captureevents}),"calc","from-root")}),Zk=Vt((K,V)=>{var u=Xr(),d=yo(),E=Gf(),A=Hb(),t=s1();V.exports=function(r,i,n){E(r,i,{name:"annotations",handleItemDefaults:e,fullLayout:n.fullLayout})};function e(r,i,n,o){function a(v,g){return u.coerce(r,i,t,v,g)}function s(v){var g=v+"axis",m={_fullLayout:{}};return m._fullLayout[g]=n[g],d.coercePosition(i,m,a,v,v,.5)}var f=a("visible");f&&(A(r,i,o.fullLayout,a),s("x"),s("y"),s("z"),u.noneOrAll(r,i,["x","y","z"]),i.xref="x",i.yref="y",i.zref="z",a("xanchor"),a("yanchor"),a("xshift"),a("yshift"),i.showarrow&&(i.axref="pixel",i.ayref="pixel",a("ax",-10),a("ay",-30),u.noneOrAll(r,i,["ax","ay"])))}}),Kk=Vt((K,V)=>{var u=Xr(),d=yo();V.exports=function(A){for(var t=A.fullSceneLayout,e=t.annotations,r=0;r{function u(E,A){var t=[0,0,0,0],e,r;for(e=0;e<4;++e)for(r=0;r<4;++r)t[r]+=E[4*e+r]*A[e];return t}function d(E,A){var t=u(E.projection,u(E.view,u(E.model,[A[0],A[1],A[2],1])));return t}V.exports=d}),Yk=Vt((K,V)=>{var u=o1().drawRaw,d=qb(),E=["x","y","z"];V.exports=function(A){for(var t=A.fullSceneLayout,e=A.dataScale,r=t.annotations,i=0;i1){o=!0;break}}o?A.fullLayout._infolayer.select(".annotation-"+A.id+'[data-index="'+i+'"]').remove():(n._pdata=d(A.glplot.cameraParams,[t.xaxis.r2l(n.x)*e[0],t.yaxis.r2l(n.y)*e[1],t.zaxis.r2l(n.z)*e[2]]),u(A.graphDiv,n,i,A.id,n._xa,n._ya))}}}),Xk=Vt((K,V)=>{var u=ji(),d=Xr();V.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:s1()}}},layoutAttributes:s1(),handleDefaults:Zk(),includeBasePlot:E,convert:Kk(),draw:Yk()};function E(A,t){var e=u.subplotsRegistry.gl3d;if(e)for(var r=e.attrRegex,i=Object.keys(A),n=0;n{var u=h0(),d=yu(),E=dc().line,A=If().dash,t=So().extendFlat,e=cl().templatedArray;Wg();var r=kl(),{shapeTexttemplateAttrs:i,templatefallbackAttrs:n}=yl(),o=jy();V.exports=e("shape",{visible:t({},r.visible,{editType:"calc+arraydraw"}),showlegend:{valType:"boolean",dflt:!1,editType:"calc+arraydraw"},legend:t({},r.legend,{editType:"calc+arraydraw"}),legendgroup:t({},r.legendgroup,{editType:"calc+arraydraw"}),legendgrouptitle:{text:t({},r.legendgrouptitle.text,{editType:"calc+arraydraw"}),font:d({editType:"calc+arraydraw"}),editType:"calc+arraydraw"},legendrank:t({},r.legendrank,{editType:"calc+arraydraw"}),legendwidth:t({},r.legendwidth,{editType:"calc+arraydraw"}),type:{valType:"enumerated",values:["circle","rect","path","line"],editType:"calc+arraydraw"},layer:{valType:"enumerated",values:["below","above","between"],dflt:"above",editType:"arraydraw"},xref:t({},u.xref,{}),xsizemode:{valType:"enumerated",values:["scaled","pixel"],dflt:"scaled",editType:"calc+arraydraw"},xanchor:{valType:"any",editType:"calc+arraydraw"},x0:{valType:"any",editType:"calc+arraydraw"},x1:{valType:"any",editType:"calc+arraydraw"},x0shift:{valType:"number",dflt:0,min:-1,max:1,editType:"calc"},x1shift:{valType:"number",dflt:0,min:-1,max:1,editType:"calc"},yref:t({},u.yref,{}),ysizemode:{valType:"enumerated",values:["scaled","pixel"],dflt:"scaled",editType:"calc+arraydraw"},yanchor:{valType:"any",editType:"calc+arraydraw"},y0:{valType:"any",editType:"calc+arraydraw"},y1:{valType:"any",editType:"calc+arraydraw"},y0shift:{valType:"number",dflt:0,min:-1,max:1,editType:"calc"},y1shift:{valType:"number",dflt:0,min:-1,max:1,editType:"calc"},path:{valType:"string",editType:"calc+arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},line:{color:t({},E.color,{editType:"arraydraw"}),width:t({},E.width,{editType:"calc+arraydraw"}),dash:t({},A,{editType:"arraydraw"}),editType:"calc+arraydraw"},fillcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},fillrule:{valType:"enumerated",values:["evenodd","nonzero"],dflt:"evenodd",editType:"arraydraw"},editable:{valType:"boolean",dflt:!1,editType:"calc+arraydraw"},label:{text:{valType:"string",dflt:"",editType:"arraydraw"},texttemplate:i({},{keys:Object.keys(o)}),texttemplatefallback:n({editType:"arraydraw"}),font:d({editType:"calc+arraydraw",colorEditType:"arraydraw"}),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right","start","middle","end"],editType:"arraydraw"},textangle:{valType:"angle",dflt:"auto",editType:"calc+arraydraw"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto",editType:"calc+arraydraw"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],editType:"calc+arraydraw"},padding:{valType:"number",dflt:3,min:0,editType:"arraydraw"},editType:"arraydraw"},editType:"arraydraw"})}),$k=Vt((K,V)=>{var u=Xr(),d=yo(),E=Gf(),A=Wb(),t=zd();V.exports=function(i,n){E(i,n,{name:"shapes",handleItemDefaults:r})};function e(i,n){return i?"bottom":n.indexOf("top")!==-1?"top":n.indexOf("bottom")!==-1?"bottom":"middle"}function r(i,n,o){function a(Z,ot){return u.coerce(i,n,A,Z,ot)}n._isShape=!0;var s=a("visible");if(s){var f=a("showlegend");f&&(a("legend"),a("legendwidth"),a("legendgroup"),a("legendgrouptitle.text"),u.coerceFont(a,"legendgrouptitle.font"),a("legendrank"));var v=a("path"),g=v?"path":"rect",m=a("type",g),w=m!=="path";w&&delete n.path,a("editable"),a("layer"),a("opacity"),a("fillcolor"),a("fillrule");var l=a("line.width");l&&(a("line.color"),a("line.dash"));for(var x=a("xsizemode"),y=a("ysizemode"),S=["x","y"],k=0;k<2;k++){var M=S[k],T=M+"anchor",c=M==="x"?x:y,h={_fullLayout:o},b,_,P,z=d.coerceRef(i,n,h,M,void 0,"paper"),D=d.getRefType(z);if(D==="range"?(b=d.getFromId(h,z),b._shapeIndices.push(n._index),P=t.rangeToShapePosition(b),_=t.shapePositionToRange(b),(b.type==="category"||b.type==="multicategory")&&(a(M+"0shift"),a(M+"1shift"))):_=P=u.identity,w){var B=.25,R=.75,I=M+"0",F=M+"1",j=i[I],N=i[F];i[I]=_(i[I],!0),i[F]=_(i[F],!0),c==="pixel"?(a(I,0),a(F,10)):(d.coercePosition(n,h,a,z,I,B),d.coercePosition(n,h,a,z,F,R)),n[I]=P(n[I]),n[F]=P(n[F]),i[I]=j,i[F]=N}if(c==="pixel"){var G=i[T];i[T]=_(i[T],!0),d.coercePosition(n,h,a,z,T,.25),n[T]=P(n[T]),i[T]=G}}w&&u.noneOrAll(i,n,["x0","x1","y0","y1"]);var rt=m==="line",ct,st;if(w&&(ct=a("label.texttemplate"),a("label.texttemplatefallback")),ct||(st=a("label.text")),st||ct){a("label.textangle");var et=a("label.textposition",rt?"middle":"middle center");a("label.xanchor"),a("label.yanchor",e(rt,et)),a("label.padding"),u.coerceFont(a,"label.font",o.font)}}}}),Jk=Vt((K,V)=>{var u=Pi(),d=Xr();function E(A,t){return A?"bottom":t.indexOf("top")!==-1?"top":t.indexOf("bottom")!==-1?"bottom":"middle"}V.exports=function(A,t,e){e("newshape.visible"),e("newshape.name"),e("newshape.showlegend"),e("newshape.legend"),e("newshape.legendwidth"),e("newshape.legendgroup"),e("newshape.legendgrouptitle.text"),d.coerceFont(e,"newshape.legendgrouptitle.font"),e("newshape.legendrank"),e("newshape.drawdirection"),e("newshape.layer"),e("newshape.fillcolor"),e("newshape.fillrule"),e("newshape.opacity");var r=e("newshape.line.width");if(r){var i=(A||{}).plot_bgcolor||"#FFF";e("newshape.line.color",u.contrast(i)),e("newshape.line.dash")}var n=A.dragmode==="drawline",o=e("newshape.label.text"),a=e("newshape.label.texttemplate");if(e("newshape.label.texttemplatefallback"),o||a){e("newshape.label.textangle");var s=e("newshape.label.textposition",n?"middle":"middle center");e("newshape.label.xanchor"),e("newshape.label.yanchor",E(n,s)),e("newshape.label.padding"),d.coerceFont(e,"newshape.label.font",t.font)}e("activeshape.fillcolor"),e("activeshape.opacity")}}),Qk=Vt((K,V)=>{var u=Xr(),d=yo(),E=Vg(),A=zd();V.exports=function(n){var o=n._fullLayout,a=u.filterVisible(o.shapes);if(!(!a.length||!n._fullData.length))for(var s=0;s0?l+g:g;return{ppad:g,ppadplus:m?y:S,ppadminus:m?S:y}}else return{ppad:g}}function i(n,o,a){var s=n._id.charAt(0)==="x"?"x":"y",f=n.type==="category"||n.type==="multicategory",v,g,m=0,w=0,l=f?n.r2c:n.d2c,x=o[s+"sizemode"]==="scaled";if(x?(v=o[s+"0"],g=o[s+"1"],f&&(m=o[s+"0shift"],w=o[s+"1shift"])):(v=o[s+"anchor"],g=o[s+"anchor"]),v!==void 0)return[l(v)+m,l(g)+w];if(o.path){var y=1/0,S=-1/0,k=o.path.match(E.segmentRE),M,T,c,h,b;for(n.type==="date"&&(l=A.decodeDate(l)),M=0;MS&&(S=b)));if(S>=y)return[y,S]}}}),t6=Vt((K,V)=>{var u=Qy();V.exports={moduleType:"component",name:"shapes",layoutAttributes:Wb(),supplyLayoutDefaults:$k(),supplyDrawNewShapeDefaults:Jk(),includeBasePlot:Gg()("shapes"),calcAutorange:Qk(),draw:u.draw,drawOne:u.drawOne}}),Gb=Vt((K,V)=>{var u=Mf(),d=cl().templatedArray;Wg(),V.exports=d("image",{visible:{valType:"boolean",dflt:!0,editType:"arraydraw"},source:{valType:"string",editType:"arraydraw"},layer:{valType:"enumerated",values:["below","above"],dflt:"above",editType:"arraydraw"},sizex:{valType:"number",dflt:0,editType:"arraydraw"},sizey:{valType:"number",dflt:0,editType:"arraydraw"},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain",editType:"arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},x:{valType:"any",dflt:0,editType:"arraydraw"},y:{valType:"any",dflt:0,editType:"arraydraw"},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left",editType:"arraydraw"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top",editType:"arraydraw"},xref:{valType:"enumerated",values:["paper",u.idRegex.x.toString()],dflt:"paper",editType:"arraydraw"},yref:{valType:"enumerated",values:["paper",u.idRegex.y.toString()],dflt:"paper",editType:"arraydraw"},editType:"arraydraw"})}),e6=Vt((K,V)=>{var u=Xr(),d=yo(),E=Gf(),A=Gb(),t="images";V.exports=function(r,i){var n={name:t,handleItemDefaults:e};E(r,i,n)};function e(r,i,n){function o(x,y){return u.coerce(r,i,A,x,y)}var a=o("source"),s=o("visible",!!a);if(!s)return i;o("layer"),o("xanchor"),o("yanchor"),o("sizex"),o("sizey"),o("sizing"),o("opacity");for(var f={_fullLayout:n},v=["x","y"],g=0;g<2;g++){var m=v[g],w=d.coerceRef(r,i,f,m,"paper",void 0);if(w!=="paper"){var l=d.getFromId(f,w);l._imgIndices.push(i._index)}d.coercePosition(i,f,o,w,m,0)}return i}}),r6=Vt((K,V)=>{var u=Ni(),d=Eo(),E=yo(),A=fc(),t=zh();V.exports=function(e){var r=e._fullLayout,i=[],n={},o=[],a,s;for(s=0;s{var u=Lo(),d=By();V.exports=function(E,A,t,e){A=A||{};var r=t==="log"&&A.type==="linear",i=t==="linear"&&A.type==="log";if(r||i){for(var n=E._fullLayout.images,o=A._id.charAt(0),a,s,f=0;f{V.exports={moduleType:"component",name:"images",layoutAttributes:Gb(),supplyLayoutDefaults:e6(),includeBasePlot:Gg()("images"),draw:r6(),convertCoords:n6()}}),l1=Vt((K,V)=>{V.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"◄",right:"►",up:"▲",down:"▼"}}}),Zb=Vt((K,V)=>{var u=yu(),d=af(),E=So().extendFlat,A=Cu().overrideAll,t=Uy(),e=cl().templatedArray,r=e("button",{visible:{valType:"boolean"},method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},args2:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});V.exports=A(e("updatemenu",{_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:r,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},pad:E(t({editType:"arraydraw"}),{}),font:u({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:d.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")}),i6=Vt((K,V)=>{var u=Xr(),d=Gf(),E=Zb(),A=l1(),t=A.name,e=E.buttons;V.exports=function(n,o){var a={name:t,handleItemDefaults:r};d(n,o,a)};function r(n,o,a){function s(g,m){return u.coerce(n,o,E,g,m)}var f=d(n,o,{name:"buttons",handleItemDefaults:i}),v=s("visible",f.length>0);v&&(s("active"),s("direction"),s("type"),s("showactive"),s("x"),s("y"),u.noneOrAll(n,o,["x","y"]),s("xanchor"),s("yanchor"),s("pad.t"),s("pad.r"),s("pad.b"),s("pad.l"),u.coerceFont(s,"font",a.font),s("bgcolor",a.paper_bgcolor),s("bordercolor"),s("borderwidth"))}function i(n,o){function a(f,v){return u.coerce(n,o,e,f,v)}var s=a("visible",n.method==="skip"||Array.isArray(n.args));s&&(a("method"),a("args"),a("args2"),a("label"),a("execute"))}}),o6=Vt((K,V)=>{V.exports=t;var u=Ni(),d=Pi(),E=Eo(),A=Xr();function t(e,r,i){this.gd=e,this.container=r,this.id=i,this.position=null,this.translateX=null,this.translateY=null,this.hbar=null,this.vbar=null,this.bg=this.container.selectAll("rect.scrollbox-bg").data([0]),this.bg.exit().on(".drag",null).on("wheel",null).remove(),this.bg.enter().append("rect").classed("scrollbox-bg",!0).style("pointer-events","all").attr({opacity:0,x:0,y:0,width:0,height:0})}t.barWidth=2,t.barLength=20,t.barRadius=2,t.barPad=1,t.barColor="#808BA4",t.prototype.enable=function(e,r,i){var n=this.gd._fullLayout,o=n.width,a=n.height;this.position=e;var s=this.position.l,f=this.position.w,v=this.position.t,g=this.position.h,m=this.position.direction,w=m==="down",l=m==="left",x=m==="right",y=m==="up",S=f,k=g,M,T,c,h;!w&&!l&&!x&&!y&&(this.position.direction="down",w=!0);var b=w||y;b?(M=s,T=M+S,w?(c=v,h=Math.min(c+k,a),k=h-c):(h=v+k,c=Math.max(h-k,0),k=h-c)):(c=v,h=c+k,l?(T=s+S,M=Math.max(T-S,0),S=T-M):(M=s,T=Math.min(M+S,o),S=T-M)),this._box={l:M,t:c,w:S,h:k};var _=f>S,P=t.barLength+2*t.barPad,z=t.barWidth+2*t.barPad,D=s,B=v+g;B+z>a&&(B=a-z);var R=this.container.selectAll("rect.scrollbar-horizontal").data(_?[0]:[]);R.exit().on(".drag",null).remove(),R.enter().append("rect").classed("scrollbar-horizontal",!0).call(d.fill,t.barColor),_?(this.hbar=R.attr({rx:t.barRadius,ry:t.barRadius,x:D,y:B,width:P,height:z}),this._hbarXMin=D+P/2,this._hbarTranslateMax=S-P):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var I=g>k,F=t.barWidth+2*t.barPad,j=t.barLength+2*t.barPad,N=s+f,G=v;N+F>o&&(N=o-F);var rt=this.container.selectAll("rect.scrollbar-vertical").data(I?[0]:[]);rt.exit().on(".drag",null).remove(),rt.enter().append("rect").classed("scrollbar-vertical",!0).call(d.fill,t.barColor),I?(this.vbar=rt.attr({rx:t.barRadius,ry:t.barRadius,x:N,y:G,width:F,height:j}),this._vbarYMin=G+j/2,this._vbarTranslateMax=k-j):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var ct=this.id,st=M-.5,et=I?T+F+.5:T+.5,Z=c-.5,ot=_?h+z+.5:h+.5,X=n._topdefs.selectAll("#"+ct).data(_||I?[0]:[]);if(X.exit().remove(),X.enter().append("clipPath").attr("id",ct).append("rect"),_||I?(this._clipRect=X.select("rect").attr({x:Math.floor(st),y:Math.floor(Z),width:Math.ceil(et)-Math.floor(st),height:Math.ceil(ot)-Math.floor(Z)}),this.container.call(E.setClipUrl,ct,this.gd),this.bg.attr({x:s,y:v,width:f,height:g})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(E.setClipUrl,null),delete this._clipRect),_||I){var Q=u.behavior.drag().on("dragstart",function(){u.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(Q);var ut=u.behavior.drag().on("dragstart",function(){u.event.sourceEvent.preventDefault(),u.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));_&&this.hbar.on(".drag",null).call(ut),I&&this.vbar.on(".drag",null).call(ut)}this.setTranslate(r,i)},t.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(E.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},t.prototype._onBoxDrag=function(){var e=this.translateX,r=this.translateY;this.hbar&&(e-=u.event.dx),this.vbar&&(r-=u.event.dy),this.setTranslate(e,r)},t.prototype._onBoxWheel=function(){var e=this.translateX,r=this.translateY;this.hbar&&(e+=u.event.deltaY),this.vbar&&(r+=u.event.deltaY),this.setTranslate(e,r)},t.prototype._onBarDrag=function(){var e=this.translateX,r=this.translateY;if(this.hbar){var i=e+this._hbarXMin,n=i+this._hbarTranslateMax,o=A.constrain(u.event.x,i,n),a=(o-i)/(n-i),s=this.position.w-this._box.w;e=a*s}if(this.vbar){var f=r+this._vbarYMin,v=f+this._vbarTranslateMax,g=A.constrain(u.event.y,f,v),m=(g-f)/(v-f),w=this.position.h-this._box.h;r=m*w}this.setTranslate(e,r)},t.prototype.setTranslate=function(e,r){var i=this.position.w-this._box.w,n=this.position.h-this._box.h;if(e=A.constrain(e||0,0,i),r=A.constrain(r||0,0,n),this.translateX=e,this.translateY=r,this.container.call(E.setTranslate,this._box.l-this.position.l-e,this._box.t-this.position.t-r),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+e-.5),y:Math.floor(this.position.t+r-.5)}),this.hbar){var o=e/i;this.hbar.call(E.setTranslate,e+o*this._hbarTranslateMax,r)}if(this.vbar){var a=r/n;this.vbar.call(E.setTranslate,e,r+a*this._vbarTranslateMax)}}}),s6=Vt((K,V)=>{var u=Ni(),d=Vu(),E=Pi(),A=Eo(),t=Xr(),e=Dl(),r=cl().arrayEditor,i=gf().LINE_SPACING,n=l1(),o=o6();V.exports=function(P){var z=P._fullLayout,D=t.filterVisible(z[n.name]);function B(ct){d.autoMargin(P,h(ct))}var R=z._menulayer.selectAll("g."+n.containerClassName).data(D.length>0?[0]:[]);if(R.enter().append("g").classed(n.containerClassName,!0).style("cursor","pointer"),R.exit().each(function(){u.select(this).selectAll("g."+n.headerGroupClassName).each(B)}).remove(),D.length!==0){var I=R.selectAll("g."+n.headerGroupClassName).data(D,a);I.enter().append("g").classed(n.headerGroupClassName,!0);for(var F=t.ensureSingle(R,"g",n.dropdownButtonGroupClassName,function(ct){ct.style("pointer-events","all")}),j=0;j{var u=l1();V.exports={moduleType:"component",name:u.name,layoutAttributes:Zb(),supplyLayoutDefaults:i6(),draw:s6()}}),Yg=Vt((K,V)=>{V.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}}),Kb=Vt((K,V)=>{var u=yu(),d=Uy(),E=So().extendDeepAll,A=Cu().overrideAll,t=Bg(),e=cl().templatedArray,r=Yg(),i=e("step",{visible:{valType:"boolean",dflt:!0},method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}});V.exports=A(e("slider",{visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:i,lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:E(d({editType:"arraydraw"}),{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:t.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:u({})},font:u({}),activebgcolor:{valType:"color",dflt:r.gripBgActiveColor},bgcolor:{valType:"color",dflt:r.railBgColor},bordercolor:{valType:"color",dflt:r.railBorderColor},borderwidth:{valType:"number",min:0,dflt:r.railBorderWidth},ticklen:{valType:"number",min:0,dflt:r.tickLength},tickcolor:{valType:"color",dflt:r.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:r.minorTickLength}}),"arraydraw","from-root")}),u6=Vt((K,V)=>{var u=Xr(),d=Gf(),E=Kb(),A=Yg(),t=A.name,e=E.steps;V.exports=function(n,o){d(n,o,{name:t,handleItemDefaults:r})};function r(n,o,a){function s(y,S){return u.coerce(n,o,E,y,S)}for(var f=d(n,o,{name:"steps",handleItemDefaults:i}),v=0,g=0;g{var u=Ni(),d=Vu(),E=Pi(),A=Eo(),t=Xr(),e=t.strTranslate,r=Dl(),i=cl().arrayEditor,n=Yg(),o=gf(),a=o.LINE_SPACING,s=o.FROM_TL,f=o.FROM_BR;V.exports=function(R){var I=R._context.staticPlot,F=R._fullLayout,j=g(F,R),N=F._infolayer.selectAll("g."+n.containerClassName).data(j.length>0?[0]:[]);N.enter().append("g").classed(n.containerClassName,!0).style("cursor",I?null:"ew-resize");function G(et){et._commandObserver&&(et._commandObserver.remove(),delete et._commandObserver),d.autoMargin(R,v(et))}if(N.exit().each(function(){u.select(this).selectAll("g."+n.groupClassName).each(G)}).remove(),j.length!==0){var rt=N.selectAll("g."+n.groupClassName).data(j,m);rt.enter().append("g").classed(n.groupClassName,!0),rt.exit().each(G).remove();for(var ct=0;ct0&&(ct=ct.transition().duration(I.transition.duration).ease(I.transition.easing)),ct.attr("transform",e(rt-n.gripWidth*.5,I._dims.currentValueTotalHeight))}}function P(R,I){var F=R._dims;return F.inputAreaStart+n.stepInset+(F.inputAreaLength-2*n.stepInset)*Math.min(1,Math.max(0,I))}function z(R,I){var F=R._dims;return Math.min(1,Math.max(0,(I-n.stepInset-F.inputAreaStart)/(F.inputAreaLength-2*n.stepInset-2*F.inputAreaStart)))}function D(R,I,F){var j=F._dims,N=t.ensureSingle(R,"rect",n.railTouchRectClass,function(G){G.call(c,I,R,F).style("pointer-events","all")});N.attr({width:j.inputAreaLength,height:Math.max(j.inputAreaWidth,n.tickOffset+F.ticklen+j.labelHeight)}).call(E.fill,F.bgcolor).attr("opacity",0),A.setTranslate(N,0,j.currentValueTotalHeight)}function B(R,I){var F=I._dims,j=F.inputAreaLength-n.railInset*2,N=t.ensureSingle(R,"rect",n.railRectClass);N.attr({width:j,height:n.railWidth,rx:n.railRadius,ry:n.railRadius,"shape-rendering":"crispEdges"}).call(E.stroke,I.bordercolor).call(E.fill,I.bgcolor).style("stroke-width",I.borderwidth+"px"),A.setTranslate(N,n.railInset,(F.inputAreaWidth-n.railWidth)*.5+F.currentValueTotalHeight)}}),f6=Vt((K,V)=>{var u=Yg();V.exports={moduleType:"component",name:u.name,layoutAttributes:Kb(),supplyLayoutDefaults:u6(),draw:c6()}}),u1=Vt((K,V)=>{var u=af();V.exports={bgcolor:{valType:"color",dflt:u.background,editType:"plot"},bordercolor:{valType:"color",dflt:u.defaultLine,editType:"plot"},borderwidth:{valType:"integer",dflt:0,min:0,editType:"plot"},autorange:{valType:"boolean",dflt:!0,editType:"calc",impliedEdits:{"range[0]":void 0,"range[1]":void 0}},range:{valType:"info_array",items:[{valType:"any",editType:"calc",impliedEdits:{"^autorange":!1}},{valType:"any",editType:"calc",impliedEdits:{"^autorange":!1}}],editType:"calc",impliedEdits:{autorange:!1}},thickness:{valType:"number",dflt:.15,min:0,max:1,editType:"plot"},visible:{valType:"boolean",dflt:!0,editType:"calc"},editType:"calc"}}),Yb=Vt((K,V)=>{V.exports={_isSubplotObj:!0,rangemode:{valType:"enumerated",values:["auto","fixed","match"],dflt:"match",editType:"calc"},range:{valType:"info_array",items:[{valType:"any",editType:"plot"},{valType:"any",editType:"plot"}],editType:"plot"},editType:"calc"}}),c1=Vt((K,V)=>{V.exports={name:"rangeslider",containerClassName:"rangeslider-container",bgClassName:"rangeslider-bg",rangePlotClassName:"rangeslider-rangeplot",maskMinClassName:"rangeslider-mask-min",maskMaxClassName:"rangeslider-mask-max",slideBoxClassName:"rangeslider-slidebox",grabberMinClassName:"rangeslider-grabber-min",grabAreaMinClassName:"rangeslider-grabarea-min",handleMinClassName:"rangeslider-handle-min",grabberMaxClassName:"rangeslider-grabber-max",grabAreaMaxClassName:"rangeslider-grabarea-max",handleMaxClassName:"rangeslider-handle-max",maskMinOppAxisClassName:"rangeslider-mask-min-opp-axis",maskMaxOppAxisClassName:"rangeslider-mask-max-opp-axis",maskColor:"rgba(0,0,0,0.4)",maskOppAxisColor:"rgba(0,0,0,0.2)",slideBoxFill:"transparent",slideBoxCursor:"ew-resize",grabAreaFill:"transparent",grabAreaCursor:"col-resize",grabAreaWidth:10,handleWidth:4,handleRadius:1,handleStrokeWidth:1,extraPad:15}}),h6=Vt(K=>{var V=fc(),u=Dl(),d=c1(),E=gf().LINE_SPACING,A=d.name;function t(e){var r=e&&e[A];return r&&r.visible}K.isVisible=t,K.makeData=function(e){for(var r=V.list({_fullLayout:e},"x",!0),i=e.margin,n=[],o=0;o{var u=Xr(),d=cl(),E=fc(),A=u1(),t=Yb();V.exports=function(e,r,i){var n=e[i],o=r[i];if(!(n.rangeslider||r._requestRangeslider[o._id]))return;u.isPlainObject(n.rangeslider)||(n.rangeslider={});var a=n.rangeslider,s=d.newContainer(o,"rangeslider");function f(h,b){return u.coerce(a,s,A,h,b)}var v,g;function m(h,b){return u.coerce(v,g,t,h,b)}var w=f("visible");if(w){f("bgcolor",r.plot_bgcolor),f("bordercolor"),f("borderwidth"),f("thickness"),f("autorange",!o.isValidRange(a.range)),f("range");var l=r._subplots;if(l)for(var x=l.cartesian.filter(function(h){return h.slice(0,Math.max(0,h.indexOf("y")))===E.name2id(i)}).map(function(h){return h.slice(h.indexOf("y"),h.length)}),y=u.simpleMap(x,E.id2name),S=0;S{var u=fc().list,d=Yh().getAutoRange,E=c1();V.exports=function(A){for(var t=u(A,"x",!0),e=0;e{var u=Ni(),d=ji(),E=Vu(),A=Xr(),t=A.strTranslate,e=Eo(),r=Pi(),i=c0(),n=Yc(),o=fc(),a=oh(),s=Xh(),f=c1();V.exports=function(c){for(var h=c._fullLayout,b=h._rangeSliderData,_=0;_=Jt.max)Nt=dt[te+1];else if(It=Jt.pmax)Nt=dt[te+1];else if(It0?c.touches[0].clientX:0}function g(c,h,b,_){if(h._context.staticPlot)return;var P=c.select("rect."+f.slideBoxClassName).node(),z=c.select("rect."+f.grabAreaMinClassName).node(),D=c.select("rect."+f.grabAreaMaxClassName).node();function B(){var R=u.event,I=R.target,F=v(R),j=F-c.node().getBoundingClientRect().left,N=_.d2p(b._rl[0]),G=_.d2p(b._rl[1]),rt=a.coverSlip();this.addEventListener("touchmove",ct),this.addEventListener("touchend",st),rt.addEventListener("mousemove",ct),rt.addEventListener("mouseup",st);function ct(et){var Z=v(et),ot=+Z-F,X,Q,ut;switch(I){case P:if(ut="ew-resize",N+ot>b._length||G+ot<0)return;X=N+ot,Q=G+ot;break;case z:if(ut="col-resize",N+ot>b._length)return;X=N+ot,Q=G;break;case D:if(ut="col-resize",G+ot<0)return;X=N,Q=G+ot;break;default:ut="ew-resize",X=j,Q=j+ot;break}if(Q{var u=Xr(),d=u1(),E=Yb(),A=h6();V.exports={moduleType:"component",name:"rangeslider",schema:{subplots:{xaxis:{rangeslider:u.extendFlat({},d,{yaxis:E})}}},layoutAttributes:u1(),handleDefaults:p6(),calcAutorange:d6(),draw:m6(),isVisible:A.isVisible,makeData:A.makeData,autoMarginOpts:A.autoMarginOpts}}),f1=Vt((K,V)=>{var u=yu(),d=af(),E=cl().templatedArray,A=E("button",{visible:{valType:"boolean",dflt:!0,editType:"plot"},step:{valType:"enumerated",values:["month","year","day","hour","minute","second","all"],dflt:"month",editType:"plot"},stepmode:{valType:"enumerated",values:["backward","todate"],dflt:"backward",editType:"plot"},count:{valType:"number",min:0,dflt:1,editType:"plot"},label:{valType:"string",editType:"plot"},editType:"plot"});V.exports={visible:{valType:"boolean",editType:"plot"},buttons:A,x:{valType:"number",min:-2,max:3,editType:"plot"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left",editType:"plot"},y:{valType:"number",min:-2,max:3,editType:"plot"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom",editType:"plot"},font:u({editType:"plot"}),bgcolor:{valType:"color",dflt:d.lightLine,editType:"plot"},activecolor:{valType:"color",editType:"plot"},bordercolor:{valType:"color",dflt:d.defaultLine,editType:"plot"},borderwidth:{valType:"number",min:0,dflt:0,editType:"plot"},editType:"plot"}}),Xb=Vt((K,V)=>{V.exports={yPad:.02,minButtonWidth:30,rx:3,ry:3,lightAmount:25,darkAmount:10}}),v6=Vt((K,V)=>{var u=Xr(),d=Pi(),E=cl(),A=Gf(),t=f1(),e=Xb();V.exports=function(n,o,a,s,f){var v=n.rangeselector||{},g=E.newContainer(o,"rangeselector");function m(S,k){return u.coerce(v,g,t,S,k)}var w=A(v,g,{name:"buttons",handleItemDefaults:r,calendar:f}),l=m("visible",w.length>0);if(l){var x=i(o,a,s);m("x",x[0]),m("y",x[1]),u.noneOrAll(n,o,["x","y"]),m("xanchor"),m("yanchor"),u.coerceFont(m,"font",a.font);var y=m("bgcolor");m("activecolor",d.contrast(y,e.lightAmount,e.darkAmount)),m("bordercolor"),m("borderwidth")}};function r(n,o,a,s){var f=s.calendar;function v(w,l){return u.coerce(n,o,t.buttons,w,l)}var g=v("visible");if(g){var m=v("step");m!=="all"&&(f&&f!=="gregorian"&&(m==="month"||m==="year")?o.stepmode="backward":v("stepmode"),v("count")),v("label")}}function i(n,o,a){for(var s=a.filter(function(m){return o[m].anchor===n._id}),f=0,v=0;v{var u=Q_(),d=Xr().titleCase;V.exports=function(A,t){var e=A._name,r={};if(t.step==="all")r[e+".autorange"]=!0;else{var i=E(A,t);r[e+".range[0]"]=i[0],r[e+".range[1]"]=i[1]}return r};function E(A,t){var e=A.range,r=new Date(A.r2l(e[1])),i=t.step,n=u["utc"+d(i)],o=t.count,a;switch(t.stepmode){case"backward":a=A.l2r(+n.offset(r,-o));break;case"todate":var s=n.offset(r,-o);a=A.l2r(+n.ceil(s));break}var f=e[1];return[a,f]}}),x6=Vt((K,V)=>{var u=Ni(),d=ji(),E=Vu(),A=Pi(),t=Eo(),e=Xr(),r=e.strTranslate,i=Dl(),n=fc(),o=gf(),a=o.LINE_SPACING,s=o.FROM_TL,f=o.FROM_BR,v=Xb(),g=y6();V.exports=function(T){var c=T._fullLayout,h=c._infolayer.selectAll(".rangeselector").data(m(T),w);h.enter().append("g").classed("rangeselector",!0),h.exit().remove(),h.style({cursor:"pointer","pointer-events":"all"}),h.each(function(b){var _=u.select(this),P=b,z=P.rangeselector,D=_.selectAll("g.button").data(e.filterVisible(z.buttons));D.enter().append("g").classed("button",!0),D.exit().remove(),D.each(function(B){var R=u.select(this),I=g(P,B);B._isActive=l(P,B,I),R.call(x,z,B),R.call(S,z,B,T),R.on("click",function(){T._dragged||d.call("_guiRelayout",T,I)}),R.on("mouseover",function(){B._isHovered=!0,R.call(x,z,B)}),R.on("mouseout",function(){B._isHovered=!1,R.call(x,z,B)})}),M(T,D,z,P._name,_)})};function m(T){for(var c=n.list(T,"x",!0),h=[],b=0;b{V.exports={moduleType:"component",name:"rangeselector",schema:{subplots:{xaxis:{rangeselector:f1()}}},layoutAttributes:f1(),handleDefaults:v6(),draw:x6()}}),Hu=Vt(K=>{var V=So().extendFlat;K.attributes=function(u,d){u=u||{},d=d||{};var E={valType:"info_array",editType:u.editType,items:[{valType:"number",min:0,max:1,editType:u.editType},{valType:"number",min:0,max:1,editType:u.editType}],dflt:[0,1]};u.name&&u.name+"",u.trace,d.description&&""+d.description;var A={x:V({},E,{}),y:V({},E,{}),editType:u.editType};return u.noGridCell||(A.row={valType:"integer",min:0,dflt:0,editType:u.editType},A.column={valType:"integer",min:0,dflt:0,editType:u.editType}),A},K.defaults=function(u,d,E,A){var t=A&&A.x||[0,1],e=A&&A.y||[0,1],r=d.grid;if(r){var i=E("domain.column");i!==void 0&&(i{var u=Xr(),d=ym().counter,E=Hu().attributes,A=Mf().idRegex,t=cl(),e={rows:{valType:"integer",min:1,editType:"plot"},roworder:{valType:"enumerated",values:["top to bottom","bottom to top"],dflt:"top to bottom",editType:"plot"},columns:{valType:"integer",min:1,editType:"plot"},subplots:{valType:"info_array",freeLength:!0,dimensions:2,items:{valType:"enumerated",values:[d("xy").toString(),""],editType:"plot"},editType:"plot"},xaxes:{valType:"info_array",freeLength:!0,items:{valType:"enumerated",values:[A.x.toString(),""],editType:"plot"},editType:"plot"},yaxes:{valType:"info_array",freeLength:!0,items:{valType:"enumerated",values:[A.y.toString(),""],editType:"plot"},editType:"plot"},pattern:{valType:"enumerated",values:["independent","coupled"],dflt:"coupled",editType:"plot"},xgap:{valType:"number",min:0,max:1,editType:"plot"},ygap:{valType:"number",min:0,max:1,editType:"plot"},domain:E({name:"grid",editType:"plot",noGridCell:!0},{}),xside:{valType:"enumerated",values:["bottom","bottom plot","top plot","top"],dflt:"bottom plot",editType:"plot"},yside:{valType:"enumerated",values:["left","left plot","right plot","right"],dflt:"left plot",editType:"plot"},editType:"plot"};function r(s,f,v){var g=f[v+"axes"],m=Object.keys((s._splomAxes||{})[v]||{});if(Array.isArray(g))return g;if(m.length)return m}function i(s,f){var v=s.grid||{},g=r(f,v,"x"),m=r(f,v,"y");if(!s.grid&&!g&&!m)return;var w=Array.isArray(v.subplots)&&Array.isArray(v.subplots[0]),l=Array.isArray(g),x=Array.isArray(m),y=l&&g!==v.xaxes&&x&&m!==v.yaxes,S,k;w?(S=v.subplots.length,k=v.subplots[0].length):(x&&(S=m.length),l&&(k=g.length));var M=t.newContainer(f,"grid");function T(I,F){return u.coerce(v,M,e,I,F)}var c=T("rows",S),h=T("columns",k);if(!(c*h>1)){delete f.grid;return}if(!w&&!l&&!x){var b=T("pattern")==="independent";b&&(w=!0)}M._hasSubplotGrid=w;var _=T("roworder"),P=_==="top to bottom",z=w?.2:.1,D=w?.3:.1,B,R;y&&f._splomGridDflt&&(B=f._splomGridDflt.xside,R=f._splomGridDflt.yside),M._domains={x:n("x",T,z,B,h),y:n("y",T,D,R,c,P)}}function n(s,f,v,g,m,w){var l=f(s+"gap",v),x=f("domain."+s);f(s+"side",g);for(var y=new Array(m),S=x[0],k=(x[1]-S)/(m-l),M=k*(1-l),T=0;T{V.exports={visible:{valType:"boolean",editType:"calc"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"],editType:"calc"},symmetric:{valType:"boolean",editType:"calc"},array:{valType:"data_array",editType:"calc"},arrayminus:{valType:"data_array",editType:"calc"},value:{valType:"number",min:0,dflt:10,editType:"calc"},valueminus:{valType:"number",min:0,dflt:10,editType:"calc"},traceref:{valType:"integer",min:0,dflt:0,editType:"style"},tracerefminus:{valType:"integer",min:0,dflt:0,editType:"style"},copy_ystyle:{valType:"boolean",editType:"plot"},copy_zstyle:{valType:"boolean",editType:"style"},color:{valType:"color",editType:"style"},thickness:{valType:"number",min:0,dflt:2,editType:"style"},width:{valType:"number",min:0,editType:"plot"},editType:"calc"}}),b6=Vt((K,V)=>{var u=Lo(),d=ji(),E=Xr(),A=cl(),t=Jb();V.exports=function(e,r,i,n){var o="error_"+n.axis,a=A.newContainer(r,o),s=e[o]||{};function f(y,S){return E.coerce(s,a,t,y,S)}var v=s.array!==void 0||s.value!==void 0||s.type==="sqrt",g=f("visible",v);if(g!==!1){var m=f("type","array"in s?"data":"percent"),w=!0;m!=="sqrt"&&(w=f("symmetric",!((m==="data"?"arrayminus":"valueminus")in s))),m==="data"?(f("array"),f("traceref"),w||(f("arrayminus"),f("tracerefminus"))):(m==="percent"||m==="constant")&&(f("value"),w||f("valueminus"));var l="copy_"+n.inherit+"style";if(n.inherit){var x=r["error_"+n.inherit];(x||{}).visible&&f(l,!(s.color||u(s.thickness)||u(s.width)))}(!n.inherit||!a[l])&&(f("color",i),f("thickness"),f("width",d.traceIs(r,"gl3d")?0:4))}}}),Qb=Vt((K,V)=>{V.exports=function(d){var E=d.type,A=d.symmetric;if(E==="data"){var t=d.array||[];if(A)return function(n,o){var a=+t[o];return[a,a]};var e=d.arrayminus||[];return function(n,o){var a=+t[o],s=+e[o];return!isNaN(a)||!isNaN(s)?[s||0,a||0]:[NaN,NaN]}}else{var r=u(E,d.value),i=u(E,d.valueminus);return A||d.valueminus===void 0?function(n){var o=r(n);return[o,o]}:function(n){return[i(n),r(n)]}}};function u(d,E){if(d==="percent")return function(A){return Math.abs(A*E/100)};if(d==="constant")return function(){return Math.abs(E)};if(d==="sqrt")return function(A){return Math.sqrt(Math.abs(A))}}}),w6=Vt((K,V)=>{var u=Lo(),d=ji(),E=yo(),A=Xr(),t=Qb();V.exports=function(r){for(var i=r.calcdata,n=0;n{var u=Ni(),d=Lo(),E=Eo(),A=nu();V.exports=function(e,r,i,n){var o,a=i.xaxis,s=i.yaxis,f=n&&n.duration>0,v=e._context.staticPlot;r.each(function(g){var m=g[0].trace,w=m.error_x||{},l=m.error_y||{},x;m.ids&&(x=function(M){return M.id});var y=A.hasMarkers(m)&&m.marker.maxdisplayed>0;!l.visible&&!w.visible&&(g=[]);var S=u.select(this).selectAll("g.errorbar").data(g,x);if(S.exit().remove(),!!g.length){w.visible||S.selectAll("path.xerror").remove(),l.visible||S.selectAll("path.yerror").remove(),S.style("opacity",1);var k=S.enter().append("g").classed("errorbar",!0);f&&k.style("opacity",0).transition().duration(n.duration).style("opacity",1),E.setClipUrl(S,i.layerClipId,e),S.each(function(M){var T=u.select(this),c=t(M,a,s);if(!(y&&!M.vis)){var h,b=T.select("path.yerror");if(l.visible&&d(c.x)&&d(c.yh)&&d(c.ys)){var _=l.width;h="M"+(c.x-_)+","+c.yh+"h"+2*_+"m-"+_+",0V"+c.ys,c.noYS||(h+="m-"+_+",0h"+2*_),o=!b.size(),o?b=T.append("path").style("vector-effect",v?"none":"non-scaling-stroke").classed("yerror",!0):f&&(b=b.transition().duration(n.duration).ease(n.easing)),b.attr("d",h)}else b.remove();var P=T.select("path.xerror");if(w.visible&&d(c.y)&&d(c.xh)&&d(c.xs)){var z=(w.copy_ystyle?l:w).width;h="M"+c.xh+","+(c.y-z)+"v"+2*z+"m0,-"+z+"H"+c.xs,c.noXS||(h+="m0,-"+z+"v"+2*z),o=!P.size(),o?P=T.append("path").style("vector-effect",v?"none":"non-scaling-stroke").classed("xerror",!0):f&&(P=P.transition().duration(n.duration).ease(n.easing)),P.attr("d",h)}else P.remove()}})}})};function t(e,r,i){var n={x:r.c2p(e.x),y:i.c2p(e.y)};return e.yh!==void 0&&(n.yh=i.c2p(e.yh),n.ys=i.c2p(e.ys),d(n.ys)||(n.noYS=!0,n.ys=i.c2p(e.ys,!0))),e.xh!==void 0&&(n.xh=r.c2p(e.xh),n.xs=r.c2p(e.xs),d(n.xs)||(n.noXS=!0,n.xs=r.c2p(e.xs,!0))),n}}),k6=Vt((K,V)=>{var u=Ni(),d=Pi();V.exports=function(E){E.each(function(A){var t=A[0].trace,e=t.error_y||{},r=t.error_x||{},i=u.select(this);i.selectAll("path.yerror").style("stroke-width",e.thickness+"px").call(d.stroke,e.color),r.copy_ystyle&&(r=e),i.selectAll("path.xerror").style("stroke-width",r.thickness+"px").call(d.stroke,r.color)})}}),A6=Vt((K,V)=>{var u=Xr(),d=Cu().overrideAll,E=Jb(),A={error_x:u.extendFlat({},E),error_y:u.extendFlat({},E)};delete A.error_x.copy_zstyle,delete A.error_y.copy_zstyle,delete A.error_y.copy_ystyle;var t={error_x:u.extendFlat({},E),error_y:u.extendFlat({},E),error_z:u.extendFlat({},E)};delete t.error_x.copy_ystyle,delete t.error_y.copy_ystyle,delete t.error_z.copy_ystyle,delete t.error_z.copy_zstyle,V.exports={moduleType:"component",name:"errorbars",schema:{traces:{scatter:A,bar:A,histogram:A,scatter3d:d(t,"calc","nested"),scattergl:d(A,"calc","nested")}},supplyDefaults:b6(),calc:w6(),makeComputeError:Qb(),plot:T6(),style:k6(),hoverInfo:e};function e(r,i,n){(i.error_y||{}).visible&&(n.yerr=r.yh-r.y,i.error_y.symmetric||(n.yerrneg=r.y-r.ys)),(i.error_x||{}).visible&&(n.xerr=r.xh-r.x,i.error_x.symmetric||(n.xerrneg=r.x-r.xs))}}),M6=Vt((K,V)=>{V.exports={cn:{colorbar:"colorbar",cbbg:"cbbg",cbfill:"cbfill",cbfills:"cbfills",cbline:"cbline",cblines:"cblines",cbaxis:"cbaxis",cbtitleunshift:"cbtitleunshift",cbtitle:"cbtitle",cboutline:"cboutline",crisp:"crisp",jsPlaceholder:"js-placeholder"}}}),S6=Vt((K,V)=>{var u=Ni(),d=Af(),E=Vu(),A=ji(),t=yo(),e=oh(),r=Xr(),i=r.strTranslate,n=So().extendFlat,o=Xh(),a=Eo(),s=Pi(),f=c0(),v=Dl(),g=ah().flipScale,m=Kg(),w=i1(),l=Of(),x=gf(),y=x.LINE_SPACING,S=x.FROM_TL,k=x.FROM_BR,M=M6().cn;function T(z){var D=z._fullLayout,B=D._infolayer.selectAll("g."+M.colorbar).data(c(z),function(R){return R._id});B.enter().append("g").attr("class",function(R){return R._id}).classed(M.colorbar,!0),B.each(function(R){var I=u.select(this);r.ensureSingle(I,"rect",M.cbbg),r.ensureSingle(I,"g",M.cbfills),r.ensureSingle(I,"g",M.cblines),r.ensureSingle(I,"g",M.cbaxis,function(j){j.classed(M.crisp,!0)}),r.ensureSingle(I,"g",M.cbtitleunshift,function(j){j.append("g").classed(M.cbtitle,!0)}),r.ensureSingle(I,"rect",M.cboutline);var F=h(I,R,z);F&&F.then&&(z._promises||[]).push(F),z._context.edits.colorbarPosition&&b(I,R,z)}),B.exit().each(function(R){E.autoMargin(z,R._id)}).remove(),B.order()}function c(z){var D=z._fullLayout,B=z.calcdata,R=[],I,F,j,N;function G(q){return n(q,{_fillcolor:null,_line:{color:null,width:null,dash:null},_levels:{start:null,end:null,size:null},_filllevels:null,_fillgradient:null,_zrange:null})}function rt(){typeof N.calc=="function"?N.calc(z,j,I):(I._fillgradient=F.reversescale?g(F.colorscale):F.colorscale,I._zrange=[F[N.min],F[N.max]])}for(var ct=0;ct1){var Dt=Math.pow(10,Math.floor(Math.log(de)/Math.LN10));Mr*=Dt*r.roundUp(de/Dt,[2,5,10]),(Math.abs(te.start)/te.size+1e-6)%1<2e-6&&(_r.tick0=0)}_r.dtick=Mr}_r.domain=R?[qe+ot/it.h,qe+Ut-ot/it.h]:[qe+Z/it.w,qe+Ut-Z/it.w],_r.setScale(),z.attr("transform",i(Math.round(it.l),Math.round(it.t)));var qt=z.select("."+M.cbtitleunshift).attr("transform",i(-Math.round(it.l),-Math.round(it.t))),_t=_r.ticklabelposition,lt=_r.title.font.size,yt=z.select("."+M.cbaxis),St,Ht=0,Yt=0;function se(ar,Ye){var Er={propContainer:_r,propName:D._propPrefix+"title.text",traceIndex:D._traceIndex,_meta:D._meta,placeholder:q._dfltTitle.colorbar,containerGroup:z.select("."+M.cbtitle)},pn=ar.charAt(0)==="h"?ar.slice(1):"h"+ar;z.selectAll("."+pn+",."+pn+"-math-group").remove(),f.draw(B,ar,n(Er,Ye||{}))}function ke(){if(R&&er||!R&&!er){var ar,Ye;wt==="top"&&(ar=Z+it.l+re*X,Ye=ot+it.t+Kt*(1-qe-Ut)+3+lt*.75),wt==="bottom"&&(ar=Z+it.l+re*X,Ye=ot+it.t+Kt*(1-qe)-3-lt*.25),wt==="right"&&(Ye=ot+it.t+Kt*Q+3+lt*.75,ar=Z+it.l+re*qe),se(_r._id+"title",{attributes:{x:ar,y:Ye,"text-anchor":R?"start":"middle"}})}}function Ee(){if(R&&!er||!R&&er){var ar=_r.position||0,Ye=_r._offset+_r._length/2,Er,pn;if(wt==="right")pn=Ye,Er=it.l+re*ar+10+lt*(_r.showticklabels?1:.5);else if(Er=Ye,wt==="bottom"&&(pn=it.t+Kt*ar+10+(_t.indexOf("inside")===-1?_r.tickfont.size:0)+(_r.ticks!=="inside"&&D.ticklen||0)),wt==="top"){var dn=Tt.text.split("
          ").length;pn=it.t+Kt*ar+10-mt-y*lt*dn}se((R?"h":"v")+_r._id+"title",{avoid:{selection:u.select(B).selectAll("g."+_r._id+"tick"),side:wt,offsetTop:R?0:it.t,offsetLeft:R?it.l:0,maxShift:R?q.width:q.height},attributes:{x:Er,y:pn,"text-anchor":"middle"},transform:{rotate:R?-90:0,offset:0}})}}function Ue(){if(!R&&!er||R&&er){var ar=z.select("."+M.cbtitle),Ye=ar.select("text"),Er=[-G/2,G/2],pn=ar.select(".h"+_r._id+"title-math-group").node(),dn=15.6;Ye.node()&&(dn=parseInt(Ye.node().style.fontSize,10)*y);var bn;if(pn?(bn=a.bBox(pn),Yt=bn.width,Ht=bn.height,Ht>dn&&(Er[1]-=(Ht-dn)/2)):Ye.node()&&!Ye.classed(M.jsPlaceholder)&&(bn=a.bBox(Ye.node()),Yt=bn.width,Ht=bn.height),R){if(Ht){if(Ht+=5,wt==="top")_r.domain[1]-=Ht/it.h,Er[1]*=-1;else{_r.domain[0]+=Ht/it.h;var Zn=v.lineCount(Ye);Er[1]+=(1-Zn)*dn}ar.attr("transform",i(Er[0],Er[1])),_r.setScale()}}else Yt&&(wt==="right"&&(_r.domain[0]+=(Yt+lt/2)/it.w),ar.attr("transform",i(Er[0],Er[1])),_r.setScale())}z.selectAll("."+M.cbfills+",."+M.cblines).attr("transform",R?i(0,Math.round(it.h*(1-_r.domain[1]))):i(Math.round(it.w*_r.domain[0]),0)),yt.attr("transform",R?i(0,Math.round(-it.t)):i(Math.round(-it.l),0));var En=z.select("."+M.cbfills).selectAll("rect."+M.cbfill).attr("style","").data(ee);En.enter().append("rect").classed(M.cbfill,!0).attr("style",""),En.exit().remove();var gn=Ct.map(_r.c2p).map(Math.round).sort(function(Ze,tr){return Ze-tr});En.each(function(Ze,tr){var zr=[tr===0?Ct[0]:(ee[tr]+ee[tr-1])/2,tr===ee.length-1?Ct[1]:(ee[tr]+ee[tr+1])/2].map(_r.c2p).map(Math.round);R&&(zr[1]=r.constrain(zr[1]+(zr[1]>zr[0])?1:-1,gn[0],gn[1]));var tn=u.select(this).attr(R?"x":"y",ue).attr(R?"y":"x",u.min(zr)).attr(R?"width":"height",Math.max(mt,2)).attr(R?"height":"width",Math.max(u.max(zr)-u.min(zr),2));if(D._fillgradient)a.gradient(tn,B,D._id,R?"vertical":"horizontalreversed",D._fillgradient,"fill");else{var Yr=Nt(Ze).replace("e-","");tn.attr("fill",d(Yr).toHexString())}});var da=z.select("."+M.cblines).selectAll("path."+M.cbline).data(dt.color&&dt.width?Zt:[]);da.enter().append("path").classed(M.cbline,!0),da.exit().remove(),da.each(function(Ze){var tr=ue,zr=Math.round(_r.c2p(Ze))+dt.width/2%1;u.select(this).attr("d","M"+(R?tr+","+zr:zr+","+tr)+(R?"h":"v")+mt).call(a.lineGroupStyle,dt.width,It(Ze),dt.dash)}),yt.selectAll("g."+_r._id+"tick,path").remove();var ra=ue+mt+(G||0)/2-(D.ticks==="outside"?1:0),Se=t.calcTicks(_r),Re=t.getTickSigns(_r)[2];return t.drawTicks(B,_r,{vals:_r.ticks==="inside"?t.clipEnds(_r,Se):Se,layer:yt,path:t.makeTickPath(_r,ra,Re),transFn:t.makeTransTickFn(_r)}),t.drawLabels(B,_r,{vals:Se,layer:yt,transFn:t.makeTransTickLabelFn(_r),labelFns:t.makeLabelFns(_r,ra)})}function ir(){var ar,Ye=mt+G/2;_t.indexOf("inside")===-1&&(ar=a.bBox(yt.node()),Ye+=R?ar.width:ar.height),St=qt.select("text");var Er=0,pn=R&&wt==="top",dn=!R&&wt==="right",bn=0;if(St.node()&&!St.classed(M.jsPlaceholder)){var Zn,En=qt.select(".h"+_r._id+"title-math-group").node();En&&(R&&er||!R&&!er)?(ar=a.bBox(En),Er=ar.width,Zn=ar.height):(ar=a.bBox(qt.node()),Er=ar.right-it.l-(R?ue:vr),Zn=ar.bottom-it.t-(R?vr:ue),!R&&wt==="top"&&(Ye+=ar.height,bn=ar.height)),dn&&(St.attr("transform",i(Er/2+lt/2,0)),Er*=2),Ye=Math.max(Ye,R?Er:Zn)}var gn=(R?Z:ot)*2+Ye+rt+G/2,da=0;!R&&Tt.text&&et==="bottom"&&Q<=0&&(da=gn/2,gn+=da,bn+=da),q._hColorbarMoveTitle=da,q._hColorbarMoveCBTitle=bn;var ra=rt+G,Se=(R?ue:vr)-ra/2-(R?Z:0),Re=(R?vr:ue)-(R?vt:ot+bn-da);z.select("."+M.cbbg).attr("x",Se).attr("y",Re).attr(R?"width":"height",Math.max(gn-da,2)).attr(R?"height":"width",Math.max(vt+ra,2)).call(s.fill,ct).call(s.stroke,D.bordercolor).style("stroke-width",rt);var Ze=dn?Math.max(Er-10,0):0;z.selectAll("."+M.cboutline).attr("x",(R?ue:vr+Z)+Ze).attr("y",(R?vr+ot-vt:ue)+(pn?Ht:0)).attr(R?"width":"height",Math.max(mt,2)).attr(R?"height":"width",Math.max(vt-(R?2*ot+Ht:2*Z+Ze),2)).call(s.stroke,D.outlinecolor).style({fill:"none","stroke-width":G});var tr=R?Me*gn:0,zr=R?0:(1-Ce)*gn-bn;if(tr=J?it.l-tr:-tr,zr=ut?it.t-zr:-zr,z.attr("transform",i(tr,zr)),!R&&(rt||d(ct).getAlpha()&&!d.equals(q.paper_bgcolor,ct))){var tn=yt.selectAll("text"),Yr=tn[0].length,$r=z.select("."+M.cbbg).node(),In=a.bBox($r),Nn=a.getTranslate(z),Kn=2;tn.each(function(Tr,mr){var kr=0,Ur=Yr-1;if(mr===kr||mr===Ur){var Or=a.bBox(this),pe=a.getTranslate(this),Ke;if(mr===Ur){var xr=Or.right+pe.x,Gr=In.right+Nn.x+vr-rt-Kn+X;Ke=Gr-xr,Ke>0&&(Ke=0)}else if(mr===kr){var ln=Or.left+pe.x,wn=In.left+Nn.x+vr+rt+Kn;Ke=wn-ln,Ke<0&&(Ke=0)}Ke&&(Yr<3?this.setAttribute("transform","translate("+Ke+",0) "+this.getAttribute("transform")):this.setAttribute("visibility","hidden"))}})}var $n={},ia=S[st],Cn=k[st],Fa=S[et],Ga=k[et],ve=gn-mt;R?(F==="pixels"?($n.y=Q,$n.t=vt*Fa,$n.b=vt*Ga):($n.t=$n.b=0,$n.yt=Q+I*Fa,$n.yb=Q-I*Ga),N==="pixels"?($n.x=X,$n.l=gn*ia,$n.r=gn*Cn):($n.l=ve*ia,$n.r=ve*Cn,$n.xl=X-j*ia,$n.xr=X+j*Cn)):(F==="pixels"?($n.x=X,$n.l=vt*ia,$n.r=vt*Cn):($n.l=$n.r=0,$n.xl=X+I*ia,$n.xr=X-I*Cn),N==="pixels"?($n.y=1-Q,$n.t=gn*Fa,$n.b=gn*Ga):($n.t=ve*Fa,$n.b=ve*Ga,$n.yt=Q-j*Fa,$n.yb=Q+j*Ga));var ge=D.y<.5?"b":"t",dr=D.x<.5?"l":"r";B._fullLayout._reservedMargin[D._id]={};var br={r:q.width-Se-tr,l:Se+$n.r,b:q.height-Re-zr,t:Re+$n.b};J&&ut?E.autoMargin(B,D._id,$n):J?B._fullLayout._reservedMargin[D._id][ge]=br[ge]:ut||R?B._fullLayout._reservedMargin[D._id][dr]=br[dr]:B._fullLayout._reservedMargin[D._id][ge]=br[ge]}return r.syncOrAsync([E.previousPromises,ke,Ue,Ee,E.previousPromises,ir],B)}function b(z,D,B){var R=D.orientation==="v",I=B._fullLayout,F=I._size,j,N,G;e.init({element:z.node(),gd:B,prepFn:function(){j=z.attr("transform"),o(z)},moveFn:function(rt,ct){z.attr("transform",j+i(rt,ct)),N=e.align((R?D._uFrac:D._vFrac)+rt/F.w,R?D._thickFrac:D._lenFrac,0,1,D.xanchor),G=e.align((R?D._vFrac:1-D._uFrac)-ct/F.h,R?D._lenFrac:D._thickFrac,0,1,D.yanchor);var st=e.getCursor(N,G,D.xanchor,D.yanchor);o(z,st)},doneFn:function(){if(o(z),N!==void 0&&G!==void 0){var rt={};rt[D._propPrefix+"x"]=N,rt[D._propPrefix+"y"]=G,D._traceIndex!==void 0?A.call("_guiRestyle",B,rt,D._traceIndex):A.call("_guiRelayout",B,rt)}}})}function _(z,D,B){var R=D._levels,I=[],F=[],j,N,G=R.end+R.size/100,rt=R.size,ct=1.001*B[0]-.001*B[1],st=1.001*B[1]-.001*B[0];for(N=0;N<1e5&&(j=R.start+N*rt,!(rt>0?j>=G:j<=G));N++)j>ct&&j0?j>=G:j<=G));N++)j>B[0]&&j{V.exports={moduleType:"component",name:"colorbar",attributes:Wy(),supplyDefaults:mb(),draw:S6().draw,hasColorbar:hb()}}),z6=Vt((K,V)=>{V.exports={moduleType:"component",name:"legend",layoutAttributes:yb(),supplyLayoutDefaults:xb(),draw:wb(),style:bb()}}),L6=Vt((K,V)=>{V.exports={moduleType:"locale",name:"en",dictionary:{"Click to enter Colorscale title":"Click to enter Colourscale title"},format:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],periods:["AM","PM"],dateTime:"%a %b %e %X %Y",date:"%d/%m/%Y",time:"%H:%M:%S",decimal:".",thousands:",",grouping:[3],currency:["$",""],year:"%Y",month:"%b %Y",dayMonth:"%b %-d",dayMonthYear:"%b %-d, %Y"}}}),C6=Vt((K,V)=>{V.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}}),t2=Vt((K,V)=>{var u=ji(),d=Xr(),E=d.extendFlat,A=d.extendDeep;function t(r){var i;switch(r){case"themes__thumb":i={autosize:!0,width:150,height:150,title:{text:""},showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":i={title:{text:""},hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:i={}}return i}function e(r){var i=["xaxis","yaxis","zaxis"];return i.indexOf(r.slice(0,5))>-1}V.exports=function(r,i){var n,o=r.data,a=r.layout,s=A([],o),f=A({},a,t(i.tileClass)),v=r._context||{};if(i.width&&(f.width=i.width),i.height&&(f.height=i.height),i.tileClass==="thumbnail"||i.tileClass==="themes__thumb"){f.annotations=[];var g=Object.keys(f);for(n=0;n{var u=l0().EventEmitter,d=ji(),E=Xr(),A=Bp(),t=t2(),e=e1(),r=r1();function i(n,o){var a=new u,s=t(n,{format:"png"}),f=s.gd;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);function v(){var m=A.getDelay(f._fullLayout);setTimeout(function(){var w=e(f),l=document.createElement("canvas");l.id=E.randstr(),a=r({format:o.format,width:f._fullLayout.width,height:f._fullLayout.height,canvas:l,emitter:a,svg:w}),a.clean=function(){f&&document.body.removeChild(f)}},m)}var g=A.getRedrawFunc(f);return d.call("_doPlot",f,s.data,s.layout,s.config).then(g).then(v).catch(function(m){a.emit("error",m)}),a}V.exports=i}),P6=Vt((K,V)=>{var u=Bp(),d={getDelay:u.getDelay,getRedrawFunc:u.getRedrawFunc,clone:t2(),toSVG:e1(),svgToImg:r1(),toImage:I6(),downloadImage:Rb()};V.exports=d}),O6=Vt(K=>{K.version=Fy().version,K4(),qT();var V=ji(),u=K.register=V.register,d=Ck(),E=Object.keys(d);for(t=0;t{V.exports=O6()}),m0=Vt((K,V)=>{V.exports={TEXTPAD:3,eventDataKeys:["value","label"]}}),xp=Vt((K,V)=>{var u=dc(),d=hc().axisHoverFormat,{hovertemplateAttrs:E,texttemplateAttrs:A,templatefallbackAttrs:t}=yl(),e=Wl(),r=yu(),i=m0(),n=If().pattern,o=So().extendFlat,a=r({editType:"calc",arrayOk:!0,colorEditType:"style"}),s=u.marker,f=s.line,v=o({},f.width,{dflt:0}),g=o({width:v,editType:"calc"},e("marker.line")),m=o({line:g,editType:"calc"},e("marker"),{opacity:{valType:"number",arrayOk:!0,dflt:1,min:0,max:1,editType:"style"},pattern:n,cornerradius:{valType:"any",editType:"calc"}});V.exports={x:u.x,x0:u.x0,dx:u.dx,y:u.y,y0:u.y0,dy:u.dy,xperiod:u.xperiod,yperiod:u.yperiod,xperiod0:u.xperiod0,yperiod0:u.yperiod0,xperiodalignment:u.xperiodalignment,yperiodalignment:u.yperiodalignment,xhoverformat:d("x"),yhoverformat:d("y"),text:u.text,texttemplate:A({editType:"plot"},{keys:i.eventDataKeys}),texttemplatefallback:t({editType:"plot"}),hovertext:u.hovertext,hovertemplate:E({},{keys:i.eventDataKeys}),hovertemplatefallback:t(),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0,editType:"calc"},insidetextanchor:{valType:"enumerated",values:["end","middle","start"],dflt:"end",editType:"plot"},textangle:{valType:"angle",dflt:"auto",editType:"plot"},textfont:o({},a,{}),insidetextfont:o({},a,{}),outsidetextfont:o({},a,{}),constraintext:{valType:"enumerated",values:["inside","outside","both","none"],dflt:"both",editType:"calc"},cliponaxis:o({},u.cliponaxis,{}),orientation:{valType:"enumerated",values:["v","h"],editType:"calc+clearAxisTypes"},base:{valType:"any",dflt:null,arrayOk:!0,editType:"calc"},offset:{valType:"number",dflt:null,arrayOk:!0,editType:"calc"},width:{valType:"number",dflt:null,min:0,arrayOk:!0,editType:"calc"},marker:m,offsetgroup:u.offsetgroup,alignmentgroup:u.alignmentgroup,selected:{marker:{opacity:u.selected.marker.opacity,color:u.selected.marker.color,editType:"style"},textfont:u.selected.textfont,editType:"style"},unselected:{marker:{opacity:u.unselected.marker.opacity,color:u.unselected.marker.color,editType:"style"},textfont:u.unselected.textfont,editType:"style"},zorder:u.zorder}}),h1=Vt((K,V)=>{V.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group",editType:"calc"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},bargap:{valType:"number",min:0,max:1,editType:"calc"},bargroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},barcornerradius:{valType:"any",editType:"calc"}}}),p1=Vt((K,V)=>{var u=Pi(),d=ah().hasColorscale,E=vf(),A=Xr().coercePattern;V.exports=function(t,e,r,i,n){var o=r("marker.color",i),a=d(t,"marker");a&&E(t,e,n,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",u.defaultLine),d(t,"marker.line")&&E(t,e,n,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width"),r("marker.opacity"),A(r,"marker.pattern",o,a),r("selected.marker.color"),r("unselected.marker.color")}}),Ch=Vt((K,V)=>{var u=Lo(),d=Xr(),E=Pi(),A=ji(),t=Mm(),e=Qh(),r=p1(),i=p0(),n=xp(),o=d.coerceFont;function a(g,m,w,l){function x(T,c){return d.coerce(g,m,n,T,c)}var y=t(g,m,l,x);if(!y){m.visible=!1;return}e(g,m,l,x),x("xhoverformat"),x("yhoverformat"),x("zorder"),x("orientation",m.x&&!m.y?"h":"v"),x("base"),x("offset"),x("width"),x("text"),x("hovertext"),x("hovertemplate"),x("hovertemplatefallback");var S=x("textposition");v(g,m,l,x,S,{moduleHasSelected:!0,moduleHasUnselected:!0,moduleHasConstrain:!0,moduleHasCliponaxis:!0,moduleHasTextangle:!0,moduleHasInsideanchor:!0}),r(g,m,x,w,l);var k=(m.marker.line||{}).color,M=A.getComponentMethod("errorbars","supplyDefaults");M(g,m,k||E.defaultLine,{axis:"y"}),M(g,m,k||E.defaultLine,{axis:"x",inherit:"y"}),d.coerceSelectionMarkerOpacity(m,x)}function s(g,m){var w,l;function x(k,M){return d.coerce(l._input,l,n,k,M)}for(var y=0;y=0)return g}else if(typeof g=="string"&&(g=g.trim(),g.slice(-1)==="%"&&u(g.slice(0,-1))&&(g=+g.slice(0,-1),g>=0)))return g+"%"}function v(g,m,w,l,x,y){y=y||{};var S=y.moduleHasSelected!==!1,k=y.moduleHasUnselected!==!1,M=y.moduleHasConstrain!==!1,T=y.moduleHasCliponaxis!==!1,c=y.moduleHasTextangle!==!1,h=y.moduleHasInsideanchor!==!1,b=!!y.hasPathbar,_=Array.isArray(x)||x==="auto",P=_||x==="inside",z=_||x==="outside";if(P||z){var D=o(l,"textfont",w.font),B=d.extendFlat({},D),R=g.textfont&&g.textfont.color,I=!R;if(I&&delete B.color,o(l,"insidetextfont",B),b){var F=d.extendFlat({},D);I&&delete F.color,o(l,"pathbar.textfont",F)}z&&o(l,"outsidetextfont",D),S&&l("selected.textfont.color"),k&&l("unselected.textfont.color"),M&&l("constraintext"),T&&l("cliponaxis"),c&&l("textangle"),l("texttemplate"),l("texttemplatefallback")}P&&h&&l("insidetextanchor")}V.exports={supplyDefaults:a,crossTraceDefaults:s,handleText:v,validateCornerradius:f}}),e2=Vt((K,V)=>{var u=ji(),d=yo(),E=Xr(),A=h1(),t=Ch().validateCornerradius;V.exports=function(e,r,i){function n(S,k){return E.coerce(e,r,A,S,k)}for(var o=!1,a=!1,s=!1,f={},v=n("barmode"),g=v==="group",m=0;m0&&!f[l]&&(s=!0),f[l]=!0),w.visible&&w.type==="histogram"){var x=d.getFromId({_fullLayout:r},w[w.orientation==="v"?"xaxis":"yaxis"]);x.type!=="category"&&(a=!0)}}if(!o){delete r.barmode;return}v!=="overlay"&&n("barnorm"),n("bargap",a&&!s?0:.2),n("bargroupgap");var y=n("barcornerradius");r.barcornerradius=t(y)}}),Xg=Vt((K,V)=>{var u=Xr();V.exports=function(d,E){for(var A=0;A{var u=yo(),d=ep(),E=ah().hasColorscale,A=ih(),t=Xg(),e=jh();V.exports=function(r,i){var n=u.getFromId(r,i.xaxis||"x"),o=u.getFromId(r,i.yaxis||"y"),a,s,f,v,g,m,w={msUTC:!!(i.base||i.base===0)};i.orientation==="h"?(a=n.makeCalcdata(i,"x",w),f=o.makeCalcdata(i,"y"),v=d(i,o,"y",f),g=!!i.yperiodalignment,m="y"):(a=o.makeCalcdata(i,"y",w),f=n.makeCalcdata(i,"x"),v=d(i,n,"x",f),g=!!i.xperiodalignment,m="x"),s=v.vals;for(var l=Math.min(s.length,a.length),x=new Array(l),y=0;y{var u=Ni(),d=Xr();function E(r,i,n){var o=r._fullLayout,a=o["_"+n+"Text_minsize"];if(a){var s=o.uniformtext.mode==="hide",f;switch(n){case"funnelarea":case"pie":case"sunburst":f="g.slice";break;case"treemap":case"icicle":f="g.slice, g.pathbar";break;default:f="g.points > g.point"}i.selectAll(f).each(function(v){var g=v.transform;if(g){g.scale=s&&g.hide?0:a/g.fontSize;var m=u.select(this).select("text");d.setTransormAndDisplay(m,g)}})}}function A(r,i,n){if(n.uniformtext.mode){var o=e(r),a=n.uniformtext.minsize,s=i.scale*i.fontSize;i.hide=s{var V=Lo(),u=Af(),d=Xr().isArrayOrTypedArray;K.coerceString=function(E,A,t){if(typeof A=="string"){if(A||!E.noBlank)return A}else if((typeof A=="number"||A===!0)&&!E.strict)return String(A);return t!==void 0?t:E.dflt},K.coerceNumber=function(E,A,t){if(V(A)){A=+A;var e=E.min,r=E.max,i=e!==void 0&&Ar;if(!i)return A}return t!==void 0?t:E.dflt},K.coerceColor=function(E,A,t){return u(A).isValid()?A:t!==void 0?t:E.dflt},K.coerceEnumerated=function(E,A,t){return E.coerceNumber&&(A=+A),E.values.indexOf(A)!==-1?A:t!==void 0?t:E.dflt},K.getValue=function(E,A){var t;return d(E)?A{var u=Ni(),d=Pi(),E=Eo(),A=Xr(),t=ji(),e=sh().resizeText,r=xp(),i=r.textfont,n=r.insidetextfont,o=r.outsidetextfont,a=d1();function s(T){var c=u.select(T).selectAll('g[class^="barlayer"]').selectAll("g.trace");e(T,c,"bar");var h=c.size(),b=T._fullLayout;c.style("opacity",function(_){return _[0].trace.opacity}).each(function(_){(b.barmode==="stack"&&h>1||b.bargap===0&&b.bargroupgap===0&&!_[0].trace.marker.line.width)&&u.select(this).attr("shape-rendering","crispEdges")}),c.selectAll("g.points").each(function(_){var P=u.select(this),z=_[0].trace;f(P,z,T)}),t.getComponentMethod("errorbars","style")(c)}function f(T,c,h){E.pointStyle(T.selectAll("path"),c,h),v(T,c,h)}function v(T,c,h){T.selectAll("text").each(function(b){var _=u.select(this),P=A.ensureUniformFontSize(h,l(_,b,c,h));E.font(_,P)})}function g(T,c,h){var b=c[0].trace;b.selectedpoints?m(h,b,T):(f(h,b,T),t.getComponentMethod("errorbars","style")(h))}function m(T,c,h){E.selectedPointStyle(T.selectAll("path"),c),w(T.selectAll("text"),c,h)}function w(T,c,h){T.each(function(b){var _=u.select(this),P;if(b.selected){P=A.ensureUniformFontSize(h,l(_,b,c,h));var z=c.selected.textfont&&c.selected.textfont.color;z&&(P.color=z),E.font(_,P)}else E.selectedTextStyle(_,c)})}function l(T,c,h,b){var _=b._fullLayout.font,P=h.textfont;if(T.classed("bartext-inside")){var z=M(c,h);P=y(h,c.i,_,z)}else T.classed("bartext-outside")&&(P=S(h,c.i,_));return P}function x(T,c,h){return k(i,T.textfont,c,h)}function y(T,c,h,b){var _=x(T,c,h),P=T._input.textfont===void 0||T._input.textfont.color===void 0||Array.isArray(T.textfont.color)&&T.textfont.color[c]===void 0;return P&&(_={color:d.contrast(b),family:_.family,size:_.size,weight:_.weight,style:_.style,variant:_.variant,textcase:_.textcase,lineposition:_.lineposition,shadow:_.shadow}),k(n,T.insidetextfont,c,_)}function S(T,c,h){var b=x(T,c,h);return k(o,T.outsidetextfont,c,b)}function k(T,c,h,b){c=c||{};var _=a.getValue(c.family,h),P=a.getValue(c.size,h),z=a.getValue(c.color,h),D=a.getValue(c.weight,h),B=a.getValue(c.style,h),R=a.getValue(c.variant,h),I=a.getValue(c.textcase,h),F=a.getValue(c.lineposition,h),j=a.getValue(c.shadow,h);return{family:a.coerceString(T.family,_,b.family),size:a.coerceNumber(T.size,P,b.size),color:a.coerceColor(T.color,z,b.color),weight:a.coerceString(T.weight,D,b.weight),style:a.coerceString(T.style,B,b.style),variant:a.coerceString(T.variant,R,b.variant),textcase:a.coerceString(T.variant,I,b.textcase),lineposition:a.coerceString(T.variant,F,b.lineposition),shadow:a.coerceString(T.variant,j,b.shadow)}}function M(T,c){return c.type==="waterfall"?c[T.dir].marker.color:T.mcc||T.mc||c.marker.color}V.exports={style:s,styleTextPoints:v,styleOnSelect:g,getInsideTextFont:y,getOutsideTextFont:S,getBarColor:M,resizeText:e}}),g0=Vt((K,V)=>{var u=Ni(),d=Lo(),E=Xr(),A=Dl(),t=Pi(),e=Eo(),r=ji(),i=yo().tickText,n=sh(),o=n.recordMinTextSize,a=n.clearMinTextSize,s=Vh(),f=d1(),v=m0(),g=xp(),m=g.text,w=g.textposition,l=mh().appendArrayPointValue,x=v.TEXTPAD;function y(rt){return rt.id}function S(rt){if(rt.ids)return y}function k(rt){return(rt>0)-(rt<0)}function M(rt,ct){return rt0}function b(rt,ct,st,et,Z,ot){var X=ct.xaxis,Q=ct.yaxis,ut=rt._fullLayout,J=rt._context.staticPlot;Z||(Z={mode:ut.barmode,norm:ut.barmode,gap:ut.bargap,groupgap:ut.bargroupgap},a("bar",ut));var q=E.makeTraceGroups(et,st,"trace bars").each(function(it){var nt=u.select(this),dt=it[0].trace,Tt=it[0].t,wt=dt.type==="waterfall",Ct=dt.type==="funnel",It=dt.type==="histogram",Nt=dt.type==="bar",te=Nt||Ct,Jt=0;wt&&dt.connector.visible&&dt.connector.mode==="between"&&(Jt=dt.connector.line.width/2);var ee=dt.orientation==="h",Zt=h(Z),mt=E.ensureSingle(nt,"g","points"),bt=S(dt),vt=mt.selectAll("g.point").data(E.identity,bt);vt.enter().append("g").classed("point",!0),vt.exit().remove(),vt.each(function(re,Kt){var ue=u.select(this),Me=T(re,X,Q,ee),Ce=Me[0][0],We=Me[0][1],qe=Me[1][0],vr=Me[1][1],_r=(ee?We-Ce:vr-qe)===0;_r&&te&&f.getLineWidth(dt,re)&&(_r=!1),_r||(_r=!d(Ce)||!d(We)||!d(qe)||!d(vr)),re.isBlank=_r,_r&&(ee?We=Ce:vr=qe),Jt&&!_r&&(ee?(Ce-=M(Ce,We)*Jt,We+=M(Ce,We)*Jt):(qe-=M(qe,vr)*Jt,vr+=M(qe,vr)*Jt));var er,Mr;if(dt.type==="waterfall"){if(!_r){var Ir=dt[re.dir].marker;er=Ir.line.width,Mr=Ir.color}}else er=f.getLineWidth(dt,re),Mr=re.mc||dt.marker.color;function de(ra){var Se=u.round(er/2%1,2);return Z.gap===0&&Z.groupgap===0?u.round(Math.round(ra)-Se,2):ra}function Dt(ra,Se,Re){return Re&&ra===Se?ra:Math.abs(ra-Se)>=2?de(ra):ra>Se?Math.ceil(ra):Math.floor(ra)}var qt=t.opacity(Mr),_t=qt<1||er>.01?de:Dt;rt._context.staticPlot||(Ce=_t(Ce,We,ee),We=_t(We,Ce,ee),qe=_t(qe,vr,!ee),vr=_t(vr,qe,!ee));var lt=ee?X.c2p:Q.c2p,yt;re.s0>0?yt=re._sMax:re.s0<0?yt=re._sMin:yt=re.s1>0?re._sMax:re._sMin;function St(ra,Se){if(!ra)return 0;var Re=Math.abs(ee?vr-qe:We-Ce),Ze=Math.abs(ee?We-Ce:vr-qe),tr=_t(Math.abs(lt(yt,!0)-lt(0,!0))),zr=re.hasB?Math.min(Re/2,Ze/2):Math.min(Re/2,tr),tn;if(Se==="%"){var Yr=Math.min(50,ra);tn=Re*(Yr/100)}else tn=ra;return _t(Math.max(Math.min(tn,zr),0))}var Ht=Nt||It?St(Tt.cornerradiusvalue,Tt.cornerradiusform):0,Yt,se,ke="M"+Ce+","+qe+"V"+vr+"H"+We+"V"+qe+"Z",Ee=0;if(Ht&&re.s){var Ue=k(re.s0)===0||k(re.s)===k(re.s0)?re.s1:re.s0;if(Ee=_t(re.hasB?0:Math.abs(lt(yt,!0)-lt(Ue,!0))),Ee0?Math.sqrt(Ee*(2*Ht-Ee)):0,dn=ir>0?Math.max:Math.min;Yt="M"+Ce+","+qe+"V"+(vr-Er*ar)+"H"+dn(We-(Ht-Ee)*ir,Ce)+"A "+Ht+","+Ht+" 0 0 "+Ye+" "+We+","+(vr-Ht*ar-pn)+"V"+(qe+Ht*ar+pn)+"A "+Ht+","+Ht+" 0 0 "+Ye+" "+dn(We-(Ht-Ee)*ir,Ce)+","+(qe+Er*ar)+"Z"}else if(re.hasB)Yt="M"+(Ce+Ht*ir)+","+qe+"A "+Ht+","+Ht+" 0 0 "+Ye+" "+Ce+","+(qe+Ht*ar)+"V"+(vr-Ht*ar)+"A "+Ht+","+Ht+" 0 0 "+Ye+" "+(Ce+Ht*ir)+","+vr+"H"+(We-Ht*ir)+"A "+Ht+","+Ht+" 0 0 "+Ye+" "+We+","+(vr-Ht*ar)+"V"+(qe+Ht*ar)+"A "+Ht+","+Ht+" 0 0 "+Ye+" "+(We-Ht*ir)+","+qe+"Z";else{se=Math.abs(vr-qe)+Ee;var bn=se0?Math.sqrt(Ee*(2*Ht-Ee)):0,En=ar>0?Math.max:Math.min;Yt="M"+(Ce+bn*ir)+","+qe+"V"+En(vr-(Ht-Ee)*ar,qe)+"A "+Ht+","+Ht+" 0 0 "+Ye+" "+(Ce+Ht*ir-Zn)+","+vr+"H"+(We-Ht*ir+Zn)+"A "+Ht+","+Ht+" 0 0 "+Ye+" "+(We-bn*ir)+","+En(vr-(Ht-Ee)*ar,qe)+"V"+qe+"Z"}}else Yt=ke}else Yt=ke;var gn=c(E.ensureSingle(ue,"path"),ut,Z,ot);if(gn.style("vector-effect",J?"none":"non-scaling-stroke").attr("d",isNaN((We-Ce)*(vr-qe))||_r&&rt._context.staticPlot?"M0,0Z":Yt).call(e.setClipUrl,ct.layerClipId,rt),!ut.uniformtext.mode&&Zt){var da=e.makePointStyleFns(dt);e.singlePointStyle(re,gn,dt,da,rt)}_(rt,ct,ue,it,Kt,Ce,We,qe,vr,Ht,Ee,Z,ot),ct.layerClipId&&e.hideOutsideRangePoint(re,ue.select("text"),X,Q,dt.xcalendar,dt.ycalendar)});var Ut=dt.cliponaxis===!1;e.setClipUrl(nt,Ut?null:ct.layerClipId,rt)});r.getComponentMethod("errorbars","plot")(rt,q,ct,Z)}function _(rt,ct,st,et,Z,ot,X,Q,ut,J,q,it,nt){var dt=ct.xaxis,Tt=ct.yaxis,wt=rt._fullLayout,Ct;function It(se,ke,Ee){var Ue=E.ensureSingle(se,"text").text(ke).attr({class:"bartext bartext-"+Ct,"text-anchor":"middle","data-notex":1}).call(e.font,Ee).call(A.convertToTspans,rt);return Ue}var Nt=et[0].trace,te=Nt.orientation==="h",Jt=F(wt,et,Z,dt,Tt);Ct=j(Nt,Z);var ee=it.mode==="stack"||it.mode==="relative",Zt=et[Z],mt=!ee||Zt._outmost,bt=Zt.hasB,vt=J&&J-q>x;if(!Jt||Ct==="none"||(Zt.isBlank||ot===X||Q===ut)&&(Ct==="auto"||Ct==="inside")){st.select("text").remove();return}var Ut=wt.font,re=s.getBarColor(et[Z],Nt),Kt=s.getInsideTextFont(Nt,Z,Ut,re),ue=s.getOutsideTextFont(Nt,Z,Ut),Me=Nt.insidetextanchor||"end",Ce=st.datum();te?dt.type==="log"&&Ce.s0<=0&&(dt.range[0]0&&de>0,_t;vt?bt?_t=P(vr-2*J,_r,Ir,de,te)||P(vr,_r-2*J,Ir,de,te):te?_t=P(vr-(J-q),_r,Ir,de,te)||P(vr,_r-2*(J-q),Ir,de,te):_t=P(vr,_r-(J-q),Ir,de,te)||P(vr-2*(J-q),_r,Ir,de,te):_t=P(vr,_r,Ir,de,te),qt&&_t?Ct="inside":(Ct="outside",er.remove(),er=null)}else Ct="inside";if(!er){Dt=E.ensureUniformFontSize(rt,Ct==="outside"?ue:Kt),er=It(st,Jt,Dt);var lt=er.attr("transform");if(er.attr("transform",""),Mr=e.bBox(er.node()),Ir=Mr.width,de=Mr.height,er.attr("transform",lt),Ir<=0||de<=0){er.remove();return}}var yt=Nt.textangle,St,Ht;Ct==="outside"?(Ht=Nt.constraintext==="both"||Nt.constraintext==="outside",St=I(ot,X,Q,ut,Mr,{isHorizontal:te,constrained:Ht,angle:yt})):(Ht=Nt.constraintext==="both"||Nt.constraintext==="inside",St=B(ot,X,Q,ut,Mr,{isHorizontal:te,constrained:Ht,angle:yt,anchor:Me,hasB:bt,r:J,overhead:q})),St.fontSize=Dt.size,o(Nt.type==="histogram"?"bar":Nt.type,St,wt),Zt.transform=St;var Yt=c(er,wt,it,nt);E.setTransormAndDisplay(Yt,St)}function P(rt,ct,st,et,Z){if(rt<0||ct<0)return!1;var ot=st<=rt&&et<=ct,X=st<=ct&&et<=rt,Q=Z?rt>=st*(ct/et):ct>=et*(rt/st);return ot||X||Q}function z(rt){return rt==="auto"?0:rt}function D(rt,ct){var st=Math.PI/180*ct,et=Math.abs(Math.sin(st)),Z=Math.abs(Math.cos(st));return{x:rt.width*Z+rt.height*et,y:rt.width*et+rt.height*Z}}function B(rt,ct,st,et,Z,ot){var X=!!ot.isHorizontal,Q=!!ot.constrained,ut=ot.angle||0,J=ot.anchor,q=J==="end",it=J==="start",nt=ot.leftToRight||0,dt=(nt+1)/2,Tt=1-dt,wt=ot.hasB,Ct=ot.r,It=ot.overhead,Nt=Z.width,te=Z.height,Jt=Math.abs(ct-rt),ee=Math.abs(et-st),Zt=Jt>2*x&&ee>2*x?x:0;Jt-=2*Zt,ee-=2*Zt;var mt=z(ut);ut==="auto"&&!(Nt<=Jt&&te<=ee)&&(Nt>Jt||te>ee)&&(!(Nt>ee||te>Jt)||Ntx){var re=R(rt,ct,st,et,bt,Ct,It,X,wt);vt=re.scale,Ut=re.pad}else vt=1,Q&&(vt=Math.min(1,Jt/bt.x,ee/bt.y)),Ut=0;var Kt=Z.left*Tt+Z.right*dt,ue=(Z.top+Z.bottom)/2,Me=(rt+x)*Tt+(ct-x)*dt,Ce=(st+et)/2,We=0,qe=0;if(it||q){var vr=(X?bt.x:bt.y)/2;Ct&&(q||wt)&&(Zt+=Ut);var _r=X?M(rt,ct):M(st,et);X?it?(Me=rt+_r*Zt,We=-_r*vr):(Me=ct-_r*Zt,We=_r*vr):it?(Ce=st+_r*Zt,qe=-_r*vr):(Ce=et-_r*Zt,qe=_r*vr)}return{textX:Kt,textY:ue,targetX:Me,targetY:Ce,anchorX:We,anchorY:qe,scale:vt,rotate:mt}}function R(rt,ct,st,et,Z,ot,X,Q,ut){var J=Math.max(0,Math.abs(ct-rt)-2*x),q=Math.max(0,Math.abs(et-st)-2*x),it=ot-x,nt=X?it-Math.sqrt(it*it-(it-X)*(it-X)):it,dt=ut?it*2:Q?it-X:2*nt,Tt=ut?it*2:Q?2*nt:it-X,wt,Ct,It,Nt,te;return Z.y/Z.x>=q/(J-dt)?Nt=q/Z.y:Z.y/Z.x<=(q-Tt)/J?Nt=J/Z.x:!ut&&Q?(wt=Z.x*Z.x+Z.y*Z.y/4,Ct=-2*Z.x*(J-it)-Z.y*(q/2-it),It=(J-it)*(J-it)+(q/2-it)*(q/2-it)-it*it,Nt=(-Ct+Math.sqrt(Ct*Ct-4*wt*It))/(2*wt)):ut?(wt=(Z.x*Z.x+Z.y*Z.y)/4,Ct=-Z.x*(J/2-it)-Z.y*(q/2-it),It=(J/2-it)*(J/2-it)+(q/2-it)*(q/2-it)-it*it,Nt=(-Ct+Math.sqrt(Ct*Ct-4*wt*It))/(2*wt)):(wt=Z.x*Z.x/4+Z.y*Z.y,Ct=-Z.x*(J/2-it)-2*Z.y*(q-it),It=(J/2-it)*(J/2-it)+(q-it)*(q-it)-it*it,Nt=(-Ct+Math.sqrt(Ct*Ct-4*wt*It))/(2*wt)),Nt=Math.min(1,Nt),Q?te=Math.max(0,it-Math.sqrt(Math.max(0,it*it-(it-(q-Z.y*Nt)/2)*(it-(q-Z.y*Nt)/2)))-X):te=Math.max(0,it-Math.sqrt(Math.max(0,it*it-(it-(J-Z.x*Nt)/2)*(it-(J-Z.x*Nt)/2)))-X),{scale:Nt,pad:te}}function I(rt,ct,st,et,Z,ot){var X=!!ot.isHorizontal,Q=!!ot.constrained,ut=ot.angle||0,J=Z.width,q=Z.height,it=Math.abs(ct-rt),nt=Math.abs(et-st),dt;X?dt=nt>2*x?x:0:dt=it>2*x?x:0;var Tt=1;Q&&(Tt=X?Math.min(1,nt/q):Math.min(1,it/J));var wt=z(ut),Ct=D(Z,wt),It=(X?Ct.x:Ct.y)/2,Nt=(Z.left+Z.right)/2,te=(Z.top+Z.bottom)/2,Jt=(rt+ct)/2,ee=(st+et)/2,Zt=0,mt=0,bt=X?M(ct,rt):M(st,et);return X?(Jt=ct-bt*dt,Zt=bt*It):(ee=et+bt*dt,mt=-bt*It),{textX:Nt,textY:te,targetX:Jt,targetY:ee,anchorX:Zt,anchorY:mt,scale:Tt,rotate:wt}}function F(rt,ct,st,et,Z){var ot=ct[0].trace,X=ot.texttemplate,Q;return X?Q=N(rt,ct,st,et,Z):ot.textinfo?Q=G(ct,st,et,Z):Q=f.getValue(ot.text,st),f.coerceString(m,Q)}function j(rt,ct){var st=f.getValue(rt.textposition,ct);return f.coerceEnumerated(w,st)}function N(rt,ct,st,et,Z){var ot=ct[0].trace,X=E.castOption(ot,st,"texttemplate");if(!X)return"";var Q=ot.type==="histogram",ut=ot.type==="waterfall",J=ot.type==="funnel",q=ot.orientation==="h",it,nt,dt,Tt;q?(it="y",nt=Z,dt="x",Tt=et):(it="x",nt=et,dt="y",Tt=Z);function wt(Zt){return i(nt,nt.c2l(Zt),!0).text}function Ct(Zt){return i(Tt,Tt.c2l(Zt),!0).text}var It=ct[st],Nt={};Nt.label=It.p,Nt.labelLabel=Nt[it+"Label"]=wt(It.p);var te=E.castOption(ot,It.i,"text");(te===0||te)&&(Nt.text=te),Nt.value=It.s,Nt.valueLabel=Nt[dt+"Label"]=Ct(It.s);var Jt={};l(Jt,ot,It.i),(Q||Jt.x===void 0)&&(Jt.x=q?Nt.value:Nt.label),(Q||Jt.y===void 0)&&(Jt.y=q?Nt.label:Nt.value),(Q||Jt.xLabel===void 0)&&(Jt.xLabel=q?Nt.valueLabel:Nt.labelLabel),(Q||Jt.yLabel===void 0)&&(Jt.yLabel=q?Nt.labelLabel:Nt.valueLabel),ut&&(Nt.delta=+It.rawS||It.s,Nt.deltaLabel=Ct(Nt.delta),Nt.final=It.v,Nt.finalLabel=Ct(Nt.final),Nt.initial=Nt.final-Nt.delta,Nt.initialLabel=Ct(Nt.initial)),J&&(Nt.value=It.s,Nt.valueLabel=Ct(Nt.value),Nt.percentInitial=It.begR,Nt.percentInitialLabel=E.formatPercent(It.begR),Nt.percentPrevious=It.difR,Nt.percentPreviousLabel=E.formatPercent(It.difR),Nt.percentTotal=It.sumR,Nt.percenTotalLabel=E.formatPercent(It.sumR));var ee=E.castOption(ot,It.i,"customdata");return ee&&(Nt.customdata=ee),E.texttemplateString({data:[Jt,Nt,ot._meta],fallback:ot.texttemplatefallback,labels:Nt,locale:rt._d3locale,template:X})}function G(rt,ct,st,et){var Z=rt[0].trace,ot=Z.orientation==="h",X=Z.type==="waterfall",Q=Z.type==="funnel";function ut(ee){var Zt=ot?et:st;return i(Zt,ee,!0).text}function J(ee){var Zt=ot?st:et;return i(Zt,+ee,!0).text}var q=Z.textinfo,it=rt[ct],nt=q.split("+"),dt=[],Tt,wt=function(ee){return nt.indexOf(ee)!==-1};if(wt("label")&&dt.push(ut(rt[ct].p)),wt("text")&&(Tt=E.castOption(Z,it.i,"text"),(Tt===0||Tt)&&dt.push(Tt)),X){var Ct=+it.rawS||it.s,It=it.v,Nt=It-Ct;wt("initial")&&dt.push(J(Nt)),wt("delta")&&dt.push(J(Ct)),wt("final")&&dt.push(J(It))}if(Q){wt("value")&&dt.push(J(it.s));var te=0;wt("percent initial")&&te++,wt("percent previous")&&te++,wt("percent total")&&te++;var Jt=te>1;wt("percent initial")&&(Tt=E.formatPercent(it.begR),Jt&&(Tt+=" of initial"),dt.push(Tt)),wt("percent previous")&&(Tt=E.formatPercent(it.difR),Jt&&(Tt+=" of previous"),dt.push(Tt)),wt("percent total")&&(Tt=E.formatPercent(it.sumR),Jt&&(Tt+=" of total"),dt.push(Tt))}return dt.join("
          ")}V.exports={plot:b,toMoveInsideBar:B}}),Im=Vt((K,V)=>{var u=pc(),d=ji(),E=Pi(),A=Xr().fillText,t=d1().getLineWidth,e=yo().hoverLabelText,r=ks().BADNUM;function i(a,s,f,v,g){var m=n(a,s,f,v,g);if(m){var w=m.cd,l=w[0].trace,x=w[m.index];return m.color=o(l,x),d.getComponentMethod("errorbars","hoverInfo")(x,l,m),[m]}}function n(a,s,f,v,g){var m=a.cd,w=m[0].trace,l=m[0].t,x=v==="closest",y=w.type==="waterfall",S=a.maxHoverDistance,k=a.maxSpikeDistance,M,T,c,h,b,_,P;w.orientation==="h"?(M=f,T=s,c="y",h="x",b=et,_=rt):(M=s,T=f,c="x",h="y",_=et,b=rt);var z=w[c+"period"],D=x||z;function B(Tt){return I(Tt,-1)}function R(Tt){return I(Tt,1)}function I(Tt,wt){var Ct=Tt.w;return Tt[c]+wt*Ct/2}function F(Tt){return Tt[c+"End"]-Tt[c+"Start"]}var j=x?B:z?function(Tt){return Tt.p-F(Tt)/2}:function(Tt){return Math.min(B(Tt),Tt.p-l.bardelta/2)},N=x?R:z?function(Tt){return Tt.p+F(Tt)/2}:function(Tt){return Math.max(R(Tt),Tt.p+l.bardelta/2)};function G(Tt,wt,Ct){return g.finiteRange&&(Ct=0),u.inbox(Tt-M,wt-M,Ct+Math.min(1,Math.abs(wt-Tt)/P)-1)}function rt(Tt){return G(j(Tt),N(Tt),S)}function ct(Tt){return G(B(Tt),R(Tt),k)}function st(Tt){var wt=Tt[h];if(y){var Ct=Math.abs(Tt.rawS)||0;T>0?wt+=Ct:T<0&&(wt-=Ct)}return wt}function et(Tt){var wt=T,Ct=Tt.b,It=st(Tt);return u.inbox(Ct-wt,It-wt,S+(It-wt)/(It-Ct)-1)}function Z(Tt){var wt=T,Ct=Tt.b,It=st(Tt);return u.inbox(Ct-wt,It-wt,k+(It-wt)/(It-Ct)-1)}var ot=a[c+"a"],X=a[h+"a"];P=Math.abs(ot.r2c(ot.range[1])-ot.r2c(ot.range[0]));function Q(Tt){return(b(Tt)+_(Tt))/2}var ut=u.getDistanceFunction(v,b,_,Q);if(u.getClosest(m,ut,a),a.index!==!1&&m[a.index].p!==r){D||(j=function(Tt){return Math.min(B(Tt),Tt.p-l.bargroupwidth/2)},N=function(Tt){return Math.max(R(Tt),Tt.p+l.bargroupwidth/2)});var J=a.index,q=m[J],it=w.base?q.b+q.s:q.s;a[h+"0"]=a[h+"1"]=X.c2p(q[h],!0),a[h+"LabelVal"]=it;var nt=l.extents[l.extents.round(q.p)];a[c+"0"]=ot.c2p(x?j(q):nt[0],!0),a[c+"1"]=ot.c2p(x?N(q):nt[1],!0);var dt=q.orig_p!==void 0;return a[c+"LabelVal"]=dt?q.orig_p:q.p,a.labelLabel=e(ot,a[c+"LabelVal"],w[c+"hoverformat"]),a.valueLabel=e(X,a[h+"LabelVal"],w[h+"hoverformat"]),a.baseLabel=e(X,q.b,w[h+"hoverformat"]),a.spikeDistance=(Z(q)+ct(q))/2,a[c+"Spike"]=ot.c2p(q.p,!0),A(q,w,a),a.hovertemplate=w.hovertemplate,a}}function o(a,s){var f=s.mcc||a.marker.color,v=s.mlcc||a.marker.line.color,g=t(a,s);if(E.opacity(f))return f;if(E.opacity(v)&&g)return v}V.exports={hoverPoints:i,hoverOnBars:n,getTraceColor:o}}),B6=Vt((K,V)=>{V.exports=function(u,d,E){return u.x="xVal"in d?d.xVal:d.x,u.y="yVal"in d?d.yVal:d.y,d.xa&&(u.xaxis=d.xa),d.ya&&(u.yaxis=d.ya),E.orientation==="h"?(u.label=u.y,u.value=u.x):(u.label=u.x,u.value=u.y),u}}),Pm=Vt((K,V)=>{V.exports=function(d,E){var A=d.cd,t=d.xaxis,e=d.yaxis,r=A[0].trace,i=r.type==="funnel",n=r.orientation==="h",o=[],a;if(E===!1)for(a=0;a{V.exports={attributes:xp(),layoutAttributes:h1(),supplyDefaults:Ch().supplyDefaults,crossTraceDefaults:Ch().crossTraceDefaults,supplyLayoutDefaults:e2(),calc:F6(),crossTraceCalc:d0().crossTraceCalc,colorbar:Zf(),arraysToCalcdata:Xg(),plot:g0().plot,style:Vh().style,styleOnSelect:Vh().styleOnSelect,hoverPoints:Im().hoverPoints,eventData:B6(),selectPoints:Pm(),moduleType:"trace",name:"bar",basePlotModule:Yc(),categories:["bar-like","cartesian","svg","bar","oriented","errorBarsOK","showLegend","zoomScale"],animatable:!0,meta:{}}}),N6=Vt((K,V)=>{V.exports=R6()}),$g=Vt((K,V)=>{var u=Jh(),d=dc(),E=xp(),A=af(),t=hc().axisHoverFormat,{hovertemplateAttrs:e,templatefallbackAttrs:r}=yl(),i=So().extendFlat,n=d.marker,o=n.line;V.exports={y:{valType:"data_array",editType:"calc+clearAxisTypes"},x:{valType:"data_array",editType:"calc+clearAxisTypes"},x0:{valType:"any",editType:"calc+clearAxisTypes"},y0:{valType:"any",editType:"calc+clearAxisTypes"},dx:{valType:"number",editType:"calc"},dy:{valType:"number",editType:"calc"},xperiod:d.xperiod,yperiod:d.yperiod,xperiod0:d.xperiod0,yperiod0:d.yperiod0,xperiodalignment:d.xperiodalignment,yperiodalignment:d.yperiodalignment,xhoverformat:t("x"),yhoverformat:t("y"),name:{valType:"string",editType:"calc+clearAxisTypes"},q1:{valType:"data_array",editType:"calc+clearAxisTypes"},median:{valType:"data_array",editType:"calc+clearAxisTypes"},q3:{valType:"data_array",editType:"calc+clearAxisTypes"},lowerfence:{valType:"data_array",editType:"calc"},upperfence:{valType:"data_array",editType:"calc"},notched:{valType:"boolean",editType:"calc"},notchwidth:{valType:"number",min:0,max:.5,dflt:.25,editType:"calc"},notchspan:{valType:"data_array",editType:"calc"},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],editType:"calc"},jitter:{valType:"number",min:0,max:1,editType:"calc"},pointpos:{valType:"number",min:-2,max:2,editType:"calc"},sdmultiple:{valType:"number",min:0,editType:"calc",dflt:1},sizemode:{valType:"enumerated",values:["quartiles","sd"],editType:"calc",dflt:"quartiles"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],editType:"calc"},mean:{valType:"data_array",editType:"calc"},sd:{valType:"data_array",editType:"calc"},orientation:{valType:"enumerated",values:["v","h"],editType:"calc+clearAxisTypes"},quartilemethod:{valType:"enumerated",values:["linear","exclusive","inclusive"],dflt:"linear",editType:"calc"},width:{valType:"number",min:0,dflt:0,editType:"calc"},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)",editType:"style"},symbol:i({},n.symbol,{arrayOk:!1,editType:"plot"}),opacity:i({},n.opacity,{arrayOk:!1,dflt:1,editType:"style"}),angle:i({},n.angle,{arrayOk:!1,editType:"calc"}),size:i({},n.size,{arrayOk:!1,editType:"calc"}),color:i({},n.color,{arrayOk:!1,editType:"style"}),line:{color:i({},o.color,{arrayOk:!1,dflt:A.defaultLine,editType:"style"}),width:i({},o.width,{arrayOk:!1,dflt:0,editType:"style"}),outliercolor:{valType:"color",editType:"style"},outlierwidth:{valType:"number",min:0,dflt:1,editType:"style"},editType:"style"},editType:"plot"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,dflt:2,editType:"style"},editType:"plot"},fillcolor:u(),whiskerwidth:{valType:"number",min:0,max:1,dflt:.5,editType:"calc"},showwhiskers:{valType:"boolean",editType:"calc"},offsetgroup:E.offsetgroup,alignmentgroup:E.alignmentgroup,selected:{marker:d.selected.marker,editType:"style"},unselected:{marker:d.unselected.marker,editType:"style"},text:i({},d.text,{}),hovertext:i({},d.hovertext,{}),hovertemplate:e({}),hovertemplatefallback:r(),hoveron:{valType:"flaglist",flags:["boxes","points"],dflt:"boxes+points",editType:"style"},zorder:d.zorder}}),Jg=Vt((K,V)=>{V.exports={boxmode:{valType:"enumerated",values:["group","overlay"],dflt:"overlay",editType:"calc"},boxgap:{valType:"number",min:0,max:1,dflt:.3,editType:"calc"},boxgroupgap:{valType:"number",min:0,max:1,dflt:.3,editType:"calc"}}}),Qg=Vt((K,V)=>{var u=Xr(),d=ji(),E=Pi(),A=Qh(),t=p0(),e=km(),r=$g();function i(s,f,v,g){function m(h,b){return u.coerce(s,f,r,h,b)}if(n(s,f,m,g),f.visible!==!1){A(s,f,g,m),m("xhoverformat"),m("yhoverformat");var w=f._hasPreCompStats;w&&(m("lowerfence"),m("upperfence")),m("line.color",(s.marker||{}).color||v),m("line.width"),m("fillcolor",E.addOpacity(f.line.color,.5));var l=!1;if(w){var x=m("mean"),y=m("sd");x&&x.length&&(l=!0,y&&y.length&&(l="sd"))}m("whiskerwidth");var S=m("sizemode"),k;S==="quartiles"&&(k=m("boxmean",l)),m("showwhiskers",S==="quartiles"),(S==="sd"||k==="sd")&&m("sdmultiple"),m("width"),m("quartilemethod");var M=!1;if(w){var T=m("notchspan");T&&T.length&&(M=!0)}else u.validate(s.notchwidth,r.notchwidth)&&(M=!0);var c=m("notched",M);c&&m("notchwidth"),o(s,f,m,{prefix:"box"}),m("zorder")}}function n(s,f,v,g){function m(G){var rt=0;return G&&G.length&&(rt+=1,u.isArrayOrTypedArray(G[0])&&G[0].length&&(rt+=1)),rt}function w(G){return u.validate(s[G],r[G])}var l=v("y"),x=v("x"),y;if(f.type==="box"){var S=v("q1"),k=v("median"),M=v("q3");f._hasPreCompStats=S&&S.length&&k&&k.length&&M&&M.length,y=Math.min(u.minRowLength(S),u.minRowLength(k),u.minRowLength(M))}var T=m(l),c=m(x),h=T&&u.minRowLength(l),b=c&&u.minRowLength(x),_=g.calendar,P={autotypenumbers:g.autotypenumbers},z,D;if(f._hasPreCompStats)switch(String(c)+String(T)){case"00":var B=w("x0")||w("dx"),R=w("y0")||w("dy");R&&!B?z="h":z="v",D=y;break;case"10":z="v",D=Math.min(y,b);break;case"20":z="h",D=Math.min(y,x.length);break;case"01":z="h",D=Math.min(y,h);break;case"02":z="v",D=Math.min(y,l.length);break;case"12":z="v",D=Math.min(y,b,l.length);break;case"21":z="h",D=Math.min(y,x.length,h);break;case"11":D=0;break;case"22":var I=!1,F;for(F=0;F0?(z="v",c>0?D=Math.min(b,h):D=Math.min(h)):c>0?(z="h",D=Math.min(b)):D=0;if(!D){f.visible=!1;return}f._length=D;var j=v("orientation",z);f._hasPreCompStats?j==="v"&&c===0?(v("x0",0),v("dx",1)):j==="h"&&T===0&&(v("y0",0),v("dy",1)):j==="v"&&c===0?v("x0"):j==="h"&&T===0&&v("y0");var N=d.getComponentMethod("calendars","handleTraceDefaults");N(s,f,["x","y"],g)}function o(s,f,v,g){var m=g.prefix,w=u.coerce2(s,f,r,"marker.outliercolor"),l=v("marker.line.outliercolor"),x="outliers";f._hasPreCompStats?x="all":(w||l)&&(x="suspectedoutliers");var y=v(m+"points",x);y?(v("jitter",y==="all"?.3:0),v("pointpos",y==="all"?-1.5:0),v("marker.symbol"),v("marker.opacity"),v("marker.size"),v("marker.angle"),v("marker.color",f.line.color),v("marker.line.color"),v("marker.line.width"),y==="suspectedoutliers"&&(v("marker.line.outliercolor",f.marker.color),v("marker.line.outlierwidth")),v("selected.marker.color"),v("unselected.marker.color"),v("selected.marker.size"),v("unselected.marker.size"),v("text"),v("hovertext")):delete f.marker;var S=v("hoveron");(S==="all"||S.indexOf("points")!==-1)&&(v("hovertemplate"),v("hovertemplatefallback")),u.coerceSelectionMarkerOpacity(f,v)}function a(s,f){var v,g;function m(y){return u.coerce(g._input,g,r,y)}for(var w=0;w{var u=ji(),d=Xr(),E=Jg();function A(e,r,i,n,o){for(var a=o+"Layout",s=!1,f=0;f{var u=Lo(),d=yo(),E=ep(),A=Xr(),t=ks().BADNUM,e=A._;V.exports=function(y,S){var k=y._fullLayout,M=d.getFromId(y,S.xaxis||"x"),T=d.getFromId(y,S.yaxis||"y"),c=[],h=S.type==="violin"?"_numViolins":"_numBoxes",b,_,P,z,D,B,R;S.orientation==="h"?(P=M,z="x",D=T,B="y",R=!!S.yperiodalignment):(P=T,z="y",D=M,B="x",R=!!S.xperiodalignment);var I=r(S,B,D,k[h]),F=I[0],j=I[1],N=A.distinctVals(F,D),G=N.vals,rt=N.minDiff/2,ct,st,et,Z,ot,X,Q=(S.boxpoints||S.points)==="all"?A.identity:function(vr){return vr.vct.uf};if(S._hasPreCompStats){var ut=S[z],J=function(vr){return P.d2c((S[vr]||[])[b])},q=1/0,it=-1/0;for(b=0;b=ct.q1&&ct.q3>=ct.med){var dt=J("lowerfence");ct.lf=dt!==t&&dt<=ct.q1?dt:g(ct,et,Z);var Tt=J("upperfence");ct.uf=Tt!==t&&Tt>=ct.q3?Tt:m(ct,et,Z);var wt=J("mean");ct.mean=wt!==t?wt:Z?A.mean(et,Z):(ct.q1+ct.q3)/2;var Ct=J("sd");ct.sd=wt!==t&&Ct>=0?Ct:Z?A.stdev(et,Z,ct.mean):ct.q3-ct.q1,ct.lo=w(ct),ct.uo=l(ct);var It=J("notchspan");It=It!==t&&It>0?It:x(ct,Z),ct.ln=ct.med-It,ct.un=ct.med+It;var Nt=ct.lf,te=ct.uf;S.boxpoints&&et.length&&(Nt=Math.min(Nt,et[0]),te=Math.max(te,et[Z-1])),S.notched&&(Nt=Math.min(Nt,ct.ln),te=Math.max(te,ct.un)),ct.min=Nt,ct.max=te}else{A.warn(["Invalid input - make sure that q1 <= median <= q3","q1 = "+ct.q1,"median = "+ct.med,"q3 = "+ct.q3].join(` +`));var Jt;ct.med!==t?Jt=ct.med:ct.q1!==t?ct.q3!==t?Jt=(ct.q1+ct.q3)/2:Jt=ct.q1:ct.q3!==t?Jt=ct.q3:Jt=0,ct.med=Jt,ct.q1=ct.q3=Jt,ct.lf=ct.uf=Jt,ct.mean=ct.sd=Jt,ct.ln=ct.un=Jt,ct.min=ct.max=Jt}q=Math.min(q,ct.min),it=Math.max(it,ct.max),ct.pts2=st.filter(Q),c.push(ct)}}S._extremes[P._id]=d.findExtremes(P,[q,it],{padded:!0})}else{var ee=P.makeCalcdata(S,z),Zt=i(G,rt),mt=G.length,bt=n(mt);for(b=0;b=0&&vt0){if(ct={},ct.pos=ct[B]=G[b],st=ct.pts=bt[b].sort(f),et=ct[z]=st.map(v),Z=et.length,ct.min=et[0],ct.max=et[Z-1],ct.mean=A.mean(et,Z),ct.sd=A.stdev(et,Z,ct.mean)*S.sdmultiple,ct.med=A.interp(et,.5),Z%2&&(ue||Me)){var Ce,We;ue?(Ce=et.slice(0,Z/2),We=et.slice(Z/2+1)):Me&&(Ce=et.slice(0,Z/2+1),We=et.slice(Z/2)),ct.q1=A.interp(Ce,.5),ct.q3=A.interp(We,.5)}else ct.q1=A.interp(et,.25),ct.q3=A.interp(et,.75);ct.lf=g(ct,et,Z),ct.uf=m(ct,et,Z),ct.lo=w(ct),ct.uo=l(ct);var qe=x(ct,Z);ct.ln=ct.med-qe,ct.un=ct.med+qe,Ut=Math.min(Ut,ct.ln),re=Math.max(re,ct.un),ct.pts2=st.filter(Q),c.push(ct)}S.notched&&A.isTypedArray(ee)&&(ee=Array.from(ee)),S._extremes[P._id]=d.findExtremes(P,S.notched?ee.concat([Ut,re]):ee,{padded:!0})}return s(c,S),c.length>0?(c[0].t={num:k[h],dPos:rt,posLetter:B,valLetter:z,labels:{med:e(y,"median:"),min:e(y,"min:"),q1:e(y,"q1:"),q3:e(y,"q3:"),max:e(y,"max:"),mean:S.boxmean==="sd"||S.sizemode==="sd"?e(y,"mean ± σ:").replace("σ",S.sdmultiple===1?"σ":S.sdmultiple+"σ"):e(y,"mean:"),lf:e(y,"lower fence:"),uf:e(y,"upper fence:")}},k[h]++,c):[{t:{empty:!0}}]};function r(y,S,k,M){var T=S in y,c=S+"0"in y,h="d"+S in y;if(T||c&&h){var b=k.makeCalcdata(y,S),_=E(y,k,S,b).vals;return[_,b]}var P;c?P=y[S+"0"]:"name"in y&&(k.type==="category"||u(y.name)&&["linear","log"].indexOf(k.type)!==-1||A.isDateTime(y.name)&&k.type==="date")?P=y.name:P=M;for(var z=k.type==="multicategory"?k.r2c_just_indices(P):k.d2c(P,0,y[S+"calendar"]),D=y._length,B=new Array(D),R=0;R{var u=yo(),d=Xr(),E=f0().getAxisGroup,A=["v","h"];function t(r,i){for(var n=r.calcdata,o=i.xaxis,a=i.yaxis,s=0;s1,c=1-s[r+"gap"],h=1-s[r+"groupgap"];for(g=0;g0;if(z==="positive"?(st=D*(P?1:.5),ot=Z,et=ot=R):z==="negative"?(st=ot=R,et=D*(P?1:.5),X=Z):(st=et=D,ot=X=Z),nt){var dt=b.pointpos,Tt=b.jitter,wt=b.marker.size/2,Ct=0;dt+Tt>=0&&(Ct=Z*(dt+Tt),Ct>st?(it=!0,J=wt,Q=Ct):Ct>ot&&(J=wt,Q=st)),Ct<=st&&(Q=st);var It=0;dt-Tt<=0&&(It=-Z*(dt-Tt),It>et?(it=!0,q=wt,ut=It):It>X&&(q=wt,ut=et)),It<=et&&(ut=et)}else Q=st,ut=et;var Nt=new Array(w.length);for(m=0;m{var u=Ni(),d=Xr(),E=Eo(),A=5,t=.01;function e(o,a,s,f){var v=o._context.staticPlot,g=a.xaxis,m=a.yaxis;d.makeTraceGroups(f,s,"trace boxes").each(function(w){var l=u.select(this),x=w[0],y=x.t,S=x.trace;if(y.wdPos=y.bdPos*S.whiskerwidth,S.visible!==!0||y.empty){l.remove();return}var k,M;S.orientation==="h"?(k=m,M=g):(k=g,M=m),r(l,{pos:k,val:M},S,y,v),i(l,{x:g,y:m},S,y),n(l,{pos:k,val:M},S,y)})}function r(o,a,s,f,v){var g=s.orientation==="h",m=a.val,w=a.pos,l=!!w.rangebreaks,x=f.bPos,y=f.wdPos||0,S=f.bPosPxOffset||0,k=s.whiskerwidth||0,M=s.showwhiskers!==!1,T=s.notched||!1,c=T?1-2*s.notchwidth:1,h,b;Array.isArray(f.bdPos)?(h=f.bdPos[0],b=f.bdPos[1]):(h=f.bdPos,b=f.bdPos);var _=o.selectAll("path.box").data(s.type!=="violin"||s.box.visible?d.identity:[]);_.enter().append("path").style("vector-effect",v?"none":"non-scaling-stroke").attr("class","box"),_.exit().remove(),_.each(function(P){if(P.empty)return u.select(this).attr("d","M0,0Z");var z=w.c2l(P.pos+x,!0),D=w.l2p(z-h)+S,B=w.l2p(z+b)+S,R=l?(D+B)/2:w.l2p(z)+S,I=s.whiskerwidth,F=l?D*I+(1-I)*R:w.l2p(z-y)+S,j=l?B*I+(1-I)*R:w.l2p(z+y)+S,N=w.l2p(z-h*c)+S,G=w.l2p(z+b*c)+S,rt=s.sizemode==="sd",ct=m.c2p(rt?P.mean-P.sd:P.q1,!0),st=rt?m.c2p(P.mean+P.sd,!0):m.c2p(P.q3,!0),et=d.constrain(rt?m.c2p(P.mean,!0):m.c2p(P.med,!0),Math.min(ct,st)+1,Math.max(ct,st)-1),Z=P.lf===void 0||s.boxpoints===!1||rt,ot=m.c2p(Z?P.min:P.lf,!0),X=m.c2p(Z?P.max:P.uf,!0),Q=m.c2p(P.ln,!0),ut=m.c2p(P.un,!0);g?u.select(this).attr("d","M"+et+","+N+"V"+G+"M"+ct+","+D+"V"+B+(T?"H"+Q+"L"+et+","+G+"L"+ut+","+B:"")+"H"+st+"V"+D+(T?"H"+ut+"L"+et+","+N+"L"+Q+","+D:"")+"Z"+(M?"M"+ct+","+R+"H"+ot+"M"+st+","+R+"H"+X+(k===0?"":"M"+ot+","+F+"V"+j+"M"+X+","+F+"V"+j):"")):u.select(this).attr("d","M"+N+","+et+"H"+G+"M"+D+","+ct+"H"+B+(T?"V"+Q+"L"+G+","+et+"L"+B+","+ut:"")+"V"+st+"H"+D+(T?"V"+ut+"L"+N+","+et+"L"+D+","+Q:"")+"Z"+(M?"M"+R+","+ct+"V"+ot+"M"+R+","+st+"V"+X+(k===0?"":"M"+F+","+ot+"H"+j+"M"+F+","+X+"H"+j):""))})}function i(o,a,s,f){var v=a.x,g=a.y,m=f.bdPos,w=f.bPos,l=s.boxpoints||s.points;d.seedPseudoRandom();var x=function(k){return k.forEach(function(M){M.t=f,M.trace=s}),k},y=o.selectAll("g.points").data(l?x:[]);y.enter().append("g").attr("class","points"),y.exit().remove();var S=y.selectAll("path").data(function(k){var M,T=k.pts2,c=Math.max((k.max-k.min)/10,k.q3-k.q1),h=c*1e-9,b=c*t,_=[],P=0,z;if(s.jitter){if(c===0)for(P=1,_=new Array(T.length),M=0;Mk.lo&&(j.so=!0)}return T});S.enter().append("path").classed("point",!0),S.exit().remove(),S.call(E.translatePoints,v,g)}function n(o,a,s,f){var v=a.val,g=a.pos,m=!!g.rangebreaks,w=f.bPos,l=f.bPosPxOffset||0,x=s.boxmean||(s.meanline||{}).visible,y,S;Array.isArray(f.bdPos)?(y=f.bdPos[0],S=f.bdPos[1]):(y=f.bdPos,S=f.bdPos);var k=o.selectAll("path.mean").data(s.type==="box"&&s.boxmean||s.type==="violin"&&s.box.visible&&s.meanline.visible?d.identity:[]);k.enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}),k.exit().remove(),k.each(function(M){var T=g.c2l(M.pos+w,!0),c=g.l2p(T-y)+l,h=g.l2p(T+S)+l,b=m?(c+h)/2:g.l2p(T)+l,_=v.c2p(M.mean,!0),P=v.c2p(M.mean-M.sd,!0),z=v.c2p(M.mean+M.sd,!0);s.orientation==="h"?u.select(this).attr("d","M"+_+","+c+"V"+h+(x==="sd"?"m0,0L"+P+","+b+"L"+_+","+c+"L"+z+","+b+"Z":"")):u.select(this).attr("d","M"+c+","+_+"H"+h+(x==="sd"?"m0,0L"+b+","+P+"L"+c+","+_+"L"+b+","+z+"Z":""))})}V.exports={plot:e,plotBoxAndWhiskers:r,plotPoints:i,plotBoxMean:n}}),y1=Vt((K,V)=>{var u=Ni(),d=Pi(),E=Eo();function A(e,r,i){var n=i||u.select(e).selectAll("g.trace.boxes");n.style("opacity",function(o){return o[0].trace.opacity}),n.each(function(o){var a=u.select(this),s=o[0].trace,f=s.line.width;function v(w,l,x,y){w.style("stroke-width",l+"px").call(d.stroke,x).call(d.fill,y)}var g=a.selectAll("path.box");if(s.type==="candlestick")g.each(function(w){if(!w.empty){var l=u.select(this),x=s[w.dir];v(l,x.line.width,x.line.color,x.fillcolor),l.style("opacity",s.selectedpoints&&!w.selected?.3:1)}});else{v(g,f,s.line.color,s.fillcolor),a.selectAll("path.mean").style({"stroke-width":f,"stroke-dasharray":2*f+"px,"+f+"px"}).call(d.stroke,s.line.color);var m=a.selectAll("path.point");E.pointStyle(m,s,e)}})}function t(e,r,i){var n=r[0].trace,o=i.selectAll("path.point");n.selectedpoints?E.selectedPointStyle(o,n):E.pointStyle(o,n,e)}V.exports={style:A,styleOnSelect:t}}),n2=Vt((K,V)=>{var u=yo(),d=Xr(),E=pc(),A=Pi(),t=d.fillText;function e(n,o,a,s){var f=n.cd,v=f[0].trace,g=v.hoveron,m=[],w;return g.indexOf("boxes")!==-1&&(m=m.concat(r(n,o,a,s))),g.indexOf("points")!==-1&&(w=i(n,o,a)),s==="closest"?w?[w]:m:(w&&m.push(w),m)}function r(n,o,a,s){var f=n.cd,v=n.xa,g=n.ya,m=f[0].trace,w=f[0].t,l=m.type==="violin",x,y,S,k,M,T,c,h,b,_,P,z=w.bdPos,D,B,R=w.wHover,I=function(It){return S.c2l(It.pos)+w.bPos-S.c2l(T)};l&&m.side!=="both"?(m.side==="positive"&&(b=function(It){var Nt=I(It);return E.inbox(Nt,Nt+R,_)},D=z,B=0),m.side==="negative"&&(b=function(It){var Nt=I(It);return E.inbox(Nt-R,Nt,_)},D=0,B=z)):(b=function(It){var Nt=I(It);return E.inbox(Nt-R,Nt+R,_)},D=B=z);var F;l?F=function(It){return E.inbox(It.span[0]-M,It.span[1]-M,_)}:F=function(It){return E.inbox(It.min-M,It.max-M,_)},m.orientation==="h"?(M=o,T=a,c=F,h=b,x="y",S=g,y="x",k=v):(M=a,T=o,c=b,h=F,x="x",S=v,y="y",k=g);var j=Math.min(1,z/Math.abs(S.r2c(S.range[1])-S.r2c(S.range[0])));_=n.maxHoverDistance-j,P=n.maxSpikeDistance-j;function N(It){return(c(It)+h(It))/2}var G=E.getDistanceFunction(s,c,h,N);if(E.getClosest(f,G,n),n.index===!1)return[];var rt=f[n.index],ct=m.line.color,st=(m.marker||{}).color;A.opacity(ct)&&m.line.width?n.color=ct:A.opacity(st)&&m.boxpoints?n.color=st:n.color=m.fillcolor,n[x+"0"]=S.c2p(rt.pos+w.bPos-B,!0),n[x+"1"]=S.c2p(rt.pos+w.bPos+D,!0),n[x+"LabelVal"]=rt.orig_p!==void 0?rt.orig_p:rt.pos;var et=x+"Spike";n.spikeDistance=N(rt)*P/_,n[et]=S.c2p(rt.pos,!0);var Z=m.boxmean||m.sizemode==="sd"||(m.meanline||{}).visible,ot=m.boxpoints||m.points,X=ot&&Z?["max","uf","q3","med","mean","q1","lf","min"]:ot&&!Z?["max","uf","q3","med","q1","lf","min"]:!ot&&Z?["max","q3","med","mean","q1","min"]:["max","q3","med","q1","min"],Q=k.range[1]{V.exports=function(u,d){return d.hoverOnBox&&(u.hoverOnBox=d.hoverOnBox),"xVal"in d&&(u.x=d.xVal),"yVal"in d&&(u.y=d.yVal),d.xa&&(u.xaxis=d.xa),d.ya&&(u.yaxis=d.ya),u}}),a2=Vt((K,V)=>{V.exports=function(u,d){var E=u.cd,A=u.xaxis,t=u.yaxis,e=[],r,i;if(d===!1)for(r=0;r{V.exports={attributes:$g(),layoutAttributes:Jg(),supplyDefaults:Qg().supplyDefaults,crossTraceDefaults:Qg().crossTraceDefaults,supplyLayoutDefaults:m1().supplyLayoutDefaults,calc:r2(),crossTraceCalc:g1().crossTraceCalc,plot:v1().plot,style:y1().style,styleOnSelect:y1().styleOnSelect,hoverPoints:n2().hoverPoints,eventData:j6(),selectPoints:a2(),moduleType:"trace",name:"box",basePlotModule:Yc(),categories:["cartesian","svg","symbols","oriented","box-violin","showLegend","boxLayout","zoomScale"],meta:{}}}),V6=Vt((K,V)=>{V.exports=U6()}),Om=Vt((K,V)=>{var u=Wl(),{extendFlat:d}=So(),E=kl(),{axisHoverFormat:A}=hc(),t=yu(),{hovertemplateAttrs:e,templatefallbackAttrs:r,texttemplateAttrs:i}=yl(),n=dc();V.exports=d({z:{valType:"data_array",editType:"calc"},x:d({},n.x,{impliedEdits:{xtype:"array"}}),x0:d({},n.x0,{impliedEdits:{xtype:"scaled"}}),dx:d({},n.dx,{impliedEdits:{xtype:"scaled"}}),y:d({},n.y,{impliedEdits:{ytype:"array"}}),y0:d({},n.y0,{impliedEdits:{ytype:"scaled"}}),dy:d({},n.dy,{impliedEdits:{ytype:"scaled"}}),xperiod:d({},n.xperiod,{impliedEdits:{xtype:"scaled"}}),yperiod:d({},n.yperiod,{impliedEdits:{ytype:"scaled"}}),xperiod0:d({},n.xperiod0,{impliedEdits:{xtype:"scaled"}}),yperiod0:d({},n.yperiod0,{impliedEdits:{ytype:"scaled"}}),xperiodalignment:d({},n.xperiodalignment,{impliedEdits:{xtype:"scaled"}}),yperiodalignment:d({},n.yperiodalignment,{impliedEdits:{ytype:"scaled"}}),text:{valType:"data_array",editType:"calc"},hovertext:{valType:"data_array",editType:"calc"},transpose:{valType:"boolean",dflt:!1,editType:"calc"},xtype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},ytype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},zsmooth:{valType:"enumerated",values:["fast","best",!1],dflt:!1,editType:"calc"},hoverongaps:{valType:"boolean",dflt:!0,editType:"none"},connectgaps:{valType:"boolean",editType:"calc"},xgap:{valType:"number",dflt:0,min:0,editType:"plot"},ygap:{valType:"number",dflt:0,min:0,editType:"plot"},xhoverformat:A("x"),yhoverformat:A("y"),zhoverformat:A("z",1),hovertemplate:e(),hovertemplatefallback:r(),texttemplate:i({arrayOk:!1,editType:"plot"},{keys:["x","y","z","text"]}),texttemplatefallback:r({editType:"plot"}),textfont:t({editType:"plot",autoSize:!0,autoColor:!0,colorEditType:"style"}),showlegend:d({},E.showlegend,{dflt:!1}),zorder:n.zorder},u("",{cLetter:"z",autoColorDflt:!1}))}),x1=Vt((K,V)=>{var u=Lo(),d=Xr(),E=ji();V.exports=function(e,r,i,n,o,a){var s=i("z");o=o||"x",a=a||"y";var f,v;if(s===void 0||!s.length)return 0;if(d.isArray1D(s)){f=i(o),v=i(a);var g=d.minRowLength(f),m=d.minRowLength(v);if(g===0||m===0)return 0;r._length=Math.min(g,m,s.length)}else{if(f=A(o,i),v=A(a,i),!t(s))return 0;i("transpose"),r._length=null}var w=E.getComponentMethod("calendars","handleTraceDefaults");return w(e,r,[o,a],n),!0};function A(e,r){var i=r(e),n=i?r(e+"type","array"):"scaled";return n==="scaled"&&(r(e+"0"),r("d"+e)),i}function t(e){for(var r=!0,i=!1,n=!1,o,a=0;a0&&(i=!0);for(var s=0;s{var u=Xr();V.exports=function(d,E){d("texttemplate"),d("texttemplatefallback");var A=u.extendFlat({},E.font,{color:"auto",size:"auto"});u.coerceFont(d,"textfont",A)}}),i2=Vt((K,V)=>{V.exports=function(u,d,E){var A=E("zsmooth");A===!1&&(E("xgap"),E("ygap")),E("zhoverformat")}}),H6=Vt((K,V)=>{var u=Xr(),d=x1(),E=tv(),A=Qh(),t=i2(),e=vf(),r=Om();V.exports=function(i,n,o,a){function s(v,g){return u.coerce(i,n,r,v,g)}var f=d(i,n,s,a);if(!f){n.visible=!1;return}A(i,n,a,s),s("xhoverformat"),s("yhoverformat"),s("text"),s("hovertext"),s("hovertemplate"),s("hovertemplatefallback"),E(s,a),t(i,n,s,a),s("hoverongaps"),s("connectgaps",u.isArray1D(n.z)&&n.zsmooth!==!1),e(i,n,a,s,{prefix:"",cLetter:"z"}),s("zorder")}}),o2=Vt((K,V)=>{var u=Lo();V.exports={count:function(d,E,A){return A[d]++,1},sum:function(d,E,A,t){var e=t[E];return u(e)?(e=Number(e),A[d]+=e,e):0},avg:function(d,E,A,t,e){var r=t[E];return u(r)&&(r=Number(r),A[d]+=r,e[d]++),0},min:function(d,E,A,t){var e=t[E];if(u(e))if(e=Number(e),u(A[d])){if(A[d]>e){var r=e-A[d];return A[d]=e,r}}else return A[d]=e,e;return 0},max:function(d,E,A,t){var e=t[E];if(u(e))if(e=Number(e),u(A[d])){if(A[d]{V.exports={percent:function(u,d){for(var E=u.length,A=100/d,t=0;t{V.exports=function(u,d){for(var E=u.length,A=0,t=0;t{var u=ks(),d=u.ONEAVGYEAR,E=u.ONEAVGMONTH,A=u.ONEDAY,t=u.ONEHOUR,e=u.ONEMIN,r=u.ONESEC,i=yo().tickIncrement;V.exports=function(f,v,g,m,w){var l=-1.1*v,x=-.1*v,y=f-x,S=g[0],k=g[1],M=Math.min(n(S+x,S+y,m,w),n(k+x,k+y,m,w)),T=Math.min(n(S+l,S+x,m,w),n(k+l,k+x,m,w)),c,h;if(M>T&&TA){var b=c===d?1:6,_=c===d?"M12":"M1";return function(P,z){var D=m.c2d(P,d,w),B=D.indexOf("-",b);B>0&&(D=D.slice(0,B));var R=m.d2c(D,0,w);if(Rr?f>A?f>d*1.1?d:f>E*1.1?E:A:f>t?t:f>e?e:r:Math.pow(10,Math.floor(Math.log(f)/Math.LN10))}function a(f,v,g,m,w,l){if(m&&f>A){var x=s(v,w,l),y=s(g,w,l),S=f===d?0:1;return x[S]!==y[S]}return Math.floor(g/f)-Math.floor(v/f)>.1}function s(f,v,g){var m=v.c2d(f,d,g).split("-");return m[0]===""&&(m.unshift(),m[0]="-"+m[0]),m}}),c2=Vt((K,V)=>{var u=Lo(),d=Xr(),E=ji(),A=yo(),{hasColorscale:t}=ah(),e=ih(),r=Xg(),i=o2(),n=s2(),o=l2(),a=u2();function s(w,l){var x=[],y=[],S=l.orientation==="h",k=A.getFromId(w,S?l.yaxis:l.xaxis),M=S?"y":"x",T={x:"y",y:"x"}[M],c=l[M+"calendar"],h=l.cumulative,b,_=f(w,l,k,M),P=_[0],z=_[1],D=typeof P.size=="string",B=[],R=D?B:P,I=[],F=[],j=[],N=0,G=l.histnorm,rt=l.histfunc,ct=G.indexOf("density")!==-1,st,et,Z;h.enabled&&ct&&(G=G.replace(/ ?density$/,""),ct=!1);var ot=rt==="max"||rt==="min",X=ot?null:0,Q=i.count,ut=n[G],J=!1,q=function(Ut){return k.r2c(Ut,0,c)},it;for(d.isArrayOrTypedArray(l[T])&&rt!=="count"&&(it=l[T],J=rt==="avg",Q=i[rt]),b=q(P.start),et=q(P.end)+(b-A.tickIncrement(b,P.size,!1,c))/1e6;b=0&&Z=mt;b--)if(y[b]){bt=b;break}for(b=mt;b<=bt;b++)if(u(x[b])&&u(y[b])){var vt={p:x[b],s:y[b],b:0};h.enabled||(vt.pts=j[b],wt?vt.ph0=vt.ph1=j[b].length?z[j[b][0]]:x[b]:(l._computePh=!0,vt.ph0=Jt(B[b]),vt.ph1=Jt(B[b+1],!0))),Zt.push(vt)}return Zt.length===1&&(Zt[0].width1=A.tickIncrement(Zt[0].p,P.size,!1,c)-Zt[0].p),t(l,"marker")&&e(w,l,{vals:l.marker.color,containerStr:"marker",cLetter:"c"}),t(l,"marker.line")&&e(w,l,{vals:l.marker.line.color,containerStr:"marker.line",cLetter:"c"}),r(Zt,l),d.isArrayOrTypedArray(l.selectedpoints)&&d.tagSelected(Zt,l,Nt),Zt}function f(w,l,x,y,S){var k=y+"bins",M=w._fullLayout,T=l["_"+y+"bingroup"],c=M._histogramBinOpts[T],h=M.barmode==="overlay",b,_,P,z,D,B,R,I=function(te){return x.r2c(te,0,z)},F=function(te){return x.c2r(te,0,z)},j=x.type==="date"?function(te){return te||te===0?d.cleanDate(te,null,z):null}:function(te){return u(te)?Number(te):null};function N(te,Jt,ee){Jt[te+"Found"]?(Jt[te]=j(Jt[te]),Jt[te]===null&&(Jt[te]=ee[te])):(B[te]=Jt[te]=ee[te],d.nestedProperty(_[0],k+"."+te).set(ee[te]))}if(l["_"+y+"autoBinFinished"])delete l["_"+y+"autoBinFinished"];else{_=c.traces;var G=[],rt=!0,ct=!1,st=!1;for(b=0;b<_.length;b++)if(P=_[b],P.visible){var et=c.dirs[b];D=P["_"+et+"pos0"]=x.makeCalcdata(P,et),G=d.concat(G,D),delete P["_"+y+"autoBinFinished"],l.visible===!0&&(rt?rt=!1:(delete P._autoBin,P["_"+y+"autoBinFinished"]=1),E.traceIs(P,"2dMap")&&(ct=!0),P.type==="histogram2dcontour"&&(st=!0))}z=_[0][y+"calendar"];var Z=A.autoBin(G,x,c.nbins,ct,z,c.sizeFound&&c.size),ot=_[0]._autoBin={};if(B=ot[c.dirs[0]]={},st&&(c.size||(Z.start=F(A.tickIncrement(I(Z.start),Z.size,!0,z))),c.end===void 0&&(Z.end=F(A.tickIncrement(I(Z.end),Z.size,!1,z)))),h&&!E.traceIs(l,"2dMap")&&Z._dataSpan===0&&x.type!=="category"&&x.type!=="multicategory"&&l.bingroup===""&&typeof l.xbins>"u"){if(S)return[Z,D,!0];Z=v(w,l,x,y,k)}R=P.cumulative||{},R.enabled&&R.currentbin!=="include"&&(R.direction==="decreasing"?Z.start=F(A.tickIncrement(I(Z.start),Z.size,!0,z)):Z.end=F(A.tickIncrement(I(Z.end),Z.size,!1,z))),c.size=Z.size,c.sizeFound||(B.size=Z.size,d.nestedProperty(_[0],k+".size").set(Z.size)),N("start",c,Z),N("end",c,Z)}D=l["_"+y+"pos0"],delete l["_"+y+"pos0"];var X=l._input[k]||{},Q=d.extendFlat({},c),ut=c.start,J=x.r2l(X.start),q=J!==void 0;if((c.startFound||q)&&J!==x.r2l(ut)){var it=q?J:d.aggNums(Math.min,null,D),nt={type:x.type==="category"||x.type==="multicategory"?"linear":x.type,r2l:x.r2l,dtick:c.size,tick0:ut,calendar:z,range:[it,A.tickIncrement(it,c.size,!1,z)].map(x.l2r)},dt=A.tickFirst(nt);dt>x.r2l(it)&&(dt=A.tickIncrement(dt,c.size,!0,z)),Q.start=x.l2r(dt),q||d.nestedProperty(l,k+".start").set(Q.start)}var Tt=c.end,wt=x.r2l(X.end),Ct=wt!==void 0;if((c.endFound||Ct)&&wt!==x.r2l(Tt)){var It=Ct?wt:d.aggNums(Math.max,null,D);Q.end=x.l2r(It),Ct||d.nestedProperty(l,k+".start").set(Q.end)}var Nt="autobin"+y;return l._input[Nt]===!1&&(l._input[k]=d.extendFlat({},l[k]||{}),delete l._input[Nt],delete l[Nt]),[Q,D]}function v(w,l,x,y,S){var k=w._fullLayout,M=g(w,l),T=!1,c=1/0,h=[l],b,_,P;for(b=0;b=0;y--)T(y);else if(l==="increasing"){for(y=1;y=0;y--)w[y]+=w[y+1];x==="exclude"&&(w.push(0),w.shift())}}V.exports={calc:s,calcAllAutoBins:f}}),q6=Vt((K,V)=>{var u=Xr(),d=yo(),E=o2(),A=s2(),t=l2(),e=u2(),r=c2().calcAllAutoBins;V.exports=function(a,s){var f=d.getFromId(a,s.xaxis),v=d.getFromId(a,s.yaxis),g=s.xcalendar,m=s.ycalendar,w=function(de){return f.r2c(de,0,g)},l=function(de){return v.r2c(de,0,m)},x=function(de){return f.c2r(de,0,g)},y=function(de){return v.c2r(de,0,m)},S,k,M,T,c=r(a,s,f,"x"),h=c[0],b=c[1],_=r(a,s,v,"y"),P=_[0],z=_[1],D=s._length;b.length>D&&b.splice(D,b.length-D),z.length>D&&z.splice(D,z.length-D);var B=[],R=[],I=[],F=typeof h.size=="string",j=typeof P.size=="string",N=[],G=[],rt=F?N:h,ct=j?G:P,st=0,et=[],Z=[],ot=s.histnorm,X=s.histfunc,Q=ot.indexOf("density")!==-1,ut=X==="max"||X==="min",J=ut?null:0,q=E.count,it=A[ot],nt=!1,dt=[],Tt=[],wt="z"in s?s.z:"marker"in s&&Array.isArray(s.marker.color)?s.marker.color:"";wt&&X!=="count"&&(nt=X==="avg",q=E[X]);var Ct=h.size,It=w(h.start),Nt=w(h.end)+(It-d.tickIncrement(It,Ct,!1,g))/1e6;for(S=It;S=0&&M=0&&T{var u=Xr(),d=ks().BADNUM,E=ep();V.exports=function(A,t,e,r,i,n){var o=A._length,a=t.makeCalcdata(A,r),s=e.makeCalcdata(A,i);a=E(A,t,r,a).vals,s=E(A,e,i,s).vals;var f=A.text,v=f!==void 0&&u.isArray1D(f),g=A.hovertext,m=g!==void 0&&u.isArray1D(g),w,l,x=u.distinctVals(a),y=x.vals,S=u.distinctVals(s),k=S.vals,M=[],T,c,h=k.length,b=y.length;for(w=0;w{var u=Lo(),d=Xr(),E=ks().BADNUM;V.exports=function(A,t,e,r){var i,n,o,a,s,f;function v(y){if(u(y))return+y}if(t&&t.transpose){for(i=0,s=0;s{var u=Xr(),d=.01,E=[[-1,0],[1,0],[0,-1],[0,1]];function A(e){return .5-.25*Math.min(1,e*.5)}V.exports=function(e,r){var i=1,n;for(t(e,r),n=0;nd;n++)i=t(e,r,A(i));return i>d&&u.log("interp2d didn't converge quickly",i),e};function t(e,r,i){var n=0,o,a,s,f,v,g,m,w,l,x,y,S,k;for(f=0;fS&&(n=Math.max(n,Math.abs(e[a][s]-y)/(k-S))))}return n}}),T1=Vt((K,V)=>{var u=Xr().maxRowLength;V.exports=function(d){var E=[],A={},t=[],e=d[0],r=[],i=[0,0,0],n=u(d),o,a,s,f,v,g,m,w;for(a=0;a=0;v--)f=t[v],a=f[0],s=f[1],g=((A[[a-1,s]]||i)[2]+(A[[a+1,s]]||i)[2]+(A[[a,s-1]]||i)[2]+(A[[a,s+1]]||i)[2])/20,g&&(m[f]=[a,s,g],t.splice(v,1),w=!0);if(!w)throw"findEmpties iterated with no new neighbors";for(f in m)A[f]=m[f],E.push(m[f])}return E.sort(function(l,x){return x[2]-l[2]})}}),f2=Vt((K,V)=>{var u=ji(),d=Xr().isArrayOrTypedArray;V.exports=function(E,A,t,e,r,i){var n=[],o=u.traceIs(E,"contour"),a=u.traceIs(E,"histogram"),s,f,v,g=d(A)&&A.length>1;if(g&&!a&&i.type!=="category"){var m=A.length;if(m<=r){if(o)n=Array.from(A).slice(0,r);else if(r===1)i.type==="log"?n=[.5*A[0],2*A[0]]:n=[A[0]-.5,A[0]+.5];else if(i.type==="log"){for(n=[Math.pow(A[0],1.5)/Math.pow(A[1],.5)],v=1;v{var u=ji(),d=Xr(),E=yo(),A=ep(),t=q6(),e=ih(),r=_1(),i=b1(),n=w1(),o=T1(),a=f2(),s=ks().BADNUM;V.exports=function(g,m){var w=E.getFromId(g,m.xaxis||"x"),l=E.getFromId(g,m.yaxis||"y"),x=u.traceIs(m,"contour"),y=u.traceIs(m,"histogram"),S=x?"best":m.zsmooth,k,M,T,c,h,b,_,P,z,D,B;if(w._minDtick=0,l._minDtick=0,y)B=t(g,m),c=B.orig_x,k=B.x,M=B.x0,T=B.dx,P=B.orig_y,h=B.y,b=B.y0,_=B.dy,z=B.z;else{var R=m.z;d.isArray1D(R)?(r(m,w,l,"x","y",["z"]),k=m._x,h=m._y,R=m._z):(c=m.x?w.makeCalcdata(m,"x"):[],P=m.y?l.makeCalcdata(m,"y"):[],k=A(m,w,"x",c).vals,h=A(m,l,"y",P).vals,m._x=k,m._y=h),M=m.x0,T=m.dx,b=m.y0,_=m.dy,z=i(R,m,w,l)}(w.rangebreaks||l.rangebreaks)&&(z=v(k,h,z),y||(k=f(k),h=f(h),m._x=k,m._y=h)),!y&&(x||m.connectgaps)&&(m._emptypoints=o(z),n(z,m._emptypoints));function I(Z){S=m._input.zsmooth=m.zsmooth=!1,d.warn('cannot use zsmooth: "fast": '+Z)}function F(Z){if(Z.length>1){var ot=(Z[Z.length-1]-Z[0])/(Z.length-1),X=Math.abs(ot/100);for(D=0;DX)return!1}return!0}m._islinear=!1,w.type==="log"||l.type==="log"?S==="fast"&&I("log axis found"):F(k)?F(h)?m._islinear=!0:S==="fast"&&I("y scale is not linear"):S==="fast"&&I("x scale is not linear");var j=d.maxRowLength(z),N=m.xtype==="scaled"?"":k,G=a(m,N,M,T,j,w),rt=m.ytype==="scaled"?"":h,ct=a(m,rt,b,_,z.length,l);m._extremes[w._id]=E.findExtremes(w,G),m._extremes[l._id]=E.findExtremes(l,ct);var st={x:G,y:ct,z,text:m._text||m.text,hovertext:m._hovertext||m.hovertext};if(m.xperiodalignment&&c&&(st.orig_x=c),m.yperiodalignment&&P&&(st.orig_y=P),N&&N.length===G.length-1&&(st.xCenter=N),rt&&rt.length===ct.length-1&&(st.yCenter=rt),y&&(st.xRanges=B.xRanges,st.yRanges=B.yRanges,st.pts=B.pts),x||e(g,m,{vals:z,cLetter:"z"}),x&&m.contours&&m.contours.coloring==="heatmap"){var et={type:m.type==="contour"?"heatmap":"histogram2d",xcalendar:m.xcalendar,ycalendar:m.ycalendar};st.xfill=a(et,N,M,T,j,w),st.yfill=a(et,rt,b,_,z.length,l)}return[st]};function f(g){for(var m=[],w=g.length,l=0;l{K.CSS_DECLARATIONS=[["image-rendering","optimizeSpeed"],["image-rendering","-moz-crisp-edges"],["image-rendering","-o-crisp-edges"],["image-rendering","-webkit-optimize-contrast"],["image-rendering","optimize-contrast"],["image-rendering","crisp-edges"],["image-rendering","pixelated"]],K.STYLE=K.CSS_DECLARATIONS.map(function(V){return V.join(": ")+"; "}).join("")}),h2=Vt((K,V)=>{var u=A1(),d=Eo(),E=Xr(),A=null;function t(){if(A!==null)return A;A=!1;var e=E.isSafari()||E.isMacWKWebView()||E.isIOS();if(window.navigator.userAgent&&!e){var r=Array.from(u.CSS_DECLARATIONS).reverse(),i=window.CSS&&window.CSS.supports||window.supportsCSS;if(typeof i=="function")A=r.some(function(s){return i.apply(null,s)});else{var n=d.tester.append("image").attr("style",u.STYLE),o=window.getComputedStyle(n.node()),a=o.imageRendering;A=r.some(function(s){var f=s[1];return a===f||a===f.toLowerCase()}),n.remove()}}return A}V.exports=t}),M1=Vt((K,V)=>{var u=Ni(),d=Af(),E=ji(),A=Eo(),t=yo(),e=Xr(),r=Dl(),i=n1(),n=Pi(),o=xu().extractOpts,a=xu().makeColorScaleFuncFromTrace,s=zh(),f=gf(),v=f.LINE_SPACING,g=h2(),m=A1().STYLE,w="heatmap-label";function l(M){return M.selectAll("g."+w)}function x(M){l(M).remove()}V.exports=function(M,T,c,h){var b=T.xaxis,_=T.yaxis;e.makeTraceGroups(h,c,"hm").each(function(P){var z=u.select(this),D=P[0],B=D.trace,R=B.xgap||0,I=B.ygap||0,F=D.z,j=D.x,N=D.y,G=D.xCenter,rt=D.yCenter,ct=E.traceIs(B,"contour"),st=ct?"best":B.zsmooth,et=F.length,Z=e.maxRowLength(F),ot=!1,X=!1,Q,ut,J,q,it,nt,dt,Tt;for(nt=0;Q===void 0&&nt0;)ut=b.c2p(j[nt]),nt--;for(ut0;)it=_.c2p(N[nt]),nt--;it=b._length||ut<=0||q>=_._length||it<=0;if(te){var Jt=z.selectAll("image").data([]);Jt.exit().remove(),x(z);return}var ee,Zt;wt==="fast"?(ee=Z,Zt=et):(ee=It,Zt=Nt);var mt=document.createElement("canvas");mt.width=ee,mt.height=Zt;var bt=mt.getContext("2d",{willReadFrequently:!0}),vt=a(B,{noNumericCheck:!0,returnArray:!0}),Ut,re;wt==="fast"?(Ut=ot?function(vn){return Z-1-vn}:e.identity,re=X?function(vn){return et-1-vn}:e.identity):(Ut=function(vn){return e.constrain(Math.round(b.c2p(j[vn])-Q),0,It)},re=function(vn){return e.constrain(Math.round(_.c2p(N[vn])-q),0,Nt)});var Kt=re(0),ue=[Kt,Kt],Me=ot?0:1,Ce=X?0:1,We=0,qe=0,vr=0,_r=0,er,Mr,Ir,de,Dt;function qt(vn,Oa){if(vn!==void 0){var Qn=vt(vn);return Qn[0]=Math.round(Qn[0]),Qn[1]=Math.round(Qn[1]),Qn[2]=Math.round(Qn[2]),We+=Oa,qe+=Qn[0]*Oa,vr+=Qn[1]*Oa,_r+=Qn[2]*Oa,Qn}return[0,0,0,0]}function _t(vn,Oa,Qn,Qa){var Ja=vn[Qn.bin0];if(Ja===void 0)return qt(void 0,1);var wi=vn[Qn.bin1],ci=Oa[Qn.bin0],Ti=Oa[Qn.bin1],Ra=wi-Ja||0,Qi=ci-Ja||0,Hi;return wi===void 0?Ti===void 0?Hi=0:ci===void 0?Hi=2*(Ti-Ja):Hi=(2*Ti-ci-Ja)*2/3:Ti===void 0?ci===void 0?Hi=0:Hi=(2*Ja-wi-ci)*2/3:ci===void 0?Hi=(2*Ti-wi-Ja)*2/3:Hi=Ti+Ja-wi-ci,qt(Ja+Qn.frac*Ra+Qa.frac*(Qi+Qn.frac*Hi))}if(wt!=="default"){var lt=0,yt;try{yt=new Uint8Array(ee*Zt*4)}catch{yt=new Array(ee*Zt*4)}if(wt==="smooth"){var St=G||j,Ht=rt||N,Yt=new Array(St.length),se=new Array(Ht.length),ke=new Array(It),Ee=G?S:y,Ue=rt?S:y,ir,ar,Ye;for(nt=0;ntNn||Nn>_._length))for(dt=tn;dt$n||$n>b._length)){var ia=i({x:Kn,y:In},B,M._fullLayout);ia.x=Kn,ia.y=In;var Cn=D.z[nt][dt];Cn===void 0?(ia.z="",ia.zLabel=""):(ia.z=Cn,ia.zLabel=t.tickText(Se,Cn,"hover").text);var Fa=D.text&&D.text[nt]&&D.text[nt][dt];(Fa===void 0||Fa===!1)&&(Fa=""),ia.text=Fa;var Ga=e.texttemplateString({data:[ia,B._meta],fallback:B.texttemplatefallback,labels:ia,locale:M._fullLayout._d3locale,template:da});if(Ga){var ve=Ga.split("
          "),ge=ve.length,dr=0;for(Tt=0;Tt{V.exports={min:"zmin",max:"zmax"}}),S1=Vt((K,V)=>{var u=Ni();V.exports=function(d){u.select(d).selectAll(".hm image").style("opacity",function(E){return E.trace.opacity})}}),E1=Vt((K,V)=>{var u=pc(),d=Xr(),E=d.isArrayOrTypedArray,A=yo(),t=xu().extractOpts;V.exports=function(e,r,i,n,o){o||(o={});var a=o.isContour,s=e.cd[0],f=s.trace,v=e.xa,g=e.ya,m=s.x,w=s.y,l=s.z,x=s.xCenter,y=s.yCenter,S=s.zmask,k=f.zhoverformat,M=m,T=w,c,h,b,_;if(e.index!==!1){try{b=Math.round(e.index[1]),_=Math.round(e.index[0])}catch{d.error("Error hovering on heatmap, pointNumber must be [row,col], found:",e.index);return}if(b<0||b>=l[0].length||_<0||_>l.length)return}else{if(u.inbox(r-m[0],r-m[m.length-1],0)>0||u.inbox(i-w[0],i-w[w.length-1],0)>0)return;if(a){var P;for(M=[2*m[0]-m[1]],P=1;P{V.exports={attributes:Om(),supplyDefaults:H6(),calc:k1(),plot:M1(),colorbar:Ld(),style:S1(),hoverPoints:E1(),moduleType:"trace",name:"heatmap",basePlotModule:Yc(),categories:["cartesian","svg","2dMap","showLegend"],meta:{}}}),G6=Vt((K,V)=>{V.exports=W6()}),p2=Vt((K,V)=>{V.exports=function(u,d){return{start:{valType:"any",editType:"calc"},end:{valType:"any",editType:"calc"},size:{valType:"any",editType:"calc"},editType:"calc"}}}),Z6=Vt((K,V)=>{V.exports={eventDataKeys:["binNumber"]}}),z1=Vt((K,V)=>{var u=xp(),d=hc().axisHoverFormat,{hovertemplateAttrs:E,texttemplateAttrs:A,templatefallbackAttrs:t}=yl(),e=yu(),r=p2(),i=Z6(),n=So().extendFlat;V.exports={x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},xhoverformat:d("x"),yhoverformat:d("y"),text:n({},u.text,{}),hovertext:n({},u.hovertext,{}),orientation:u.orientation,histfunc:{valType:"enumerated",values:["count","sum","avg","min","max"],dflt:"count",editType:"calc"},histnorm:{valType:"enumerated",values:["","percent","probability","density","probability density"],dflt:"",editType:"calc"},cumulative:{enabled:{valType:"boolean",dflt:!1,editType:"calc"},direction:{valType:"enumerated",values:["increasing","decreasing"],dflt:"increasing",editType:"calc"},currentbin:{valType:"enumerated",values:["include","exclude","half"],dflt:"include",editType:"calc"},editType:"calc"},nbinsx:{valType:"integer",min:0,dflt:0,editType:"calc"},xbins:r("x",!0),nbinsy:{valType:"integer",min:0,dflt:0,editType:"calc"},ybins:r("y",!0),autobinx:{valType:"boolean",dflt:null,editType:"calc"},autobiny:{valType:"boolean",dflt:null,editType:"calc"},bingroup:{valType:"string",dflt:"",editType:"calc"},hovertemplate:E({},{keys:i.eventDataKeys}),hovertemplatefallback:t(),texttemplate:A({arrayOk:!1,editType:"plot"},{keys:["label","value"]}),texttemplatefallback:t({editType:"plot"}),textposition:n({},u.textposition,{arrayOk:!1}),textfont:e({arrayOk:!1,editType:"plot",colorEditType:"style"}),outsidetextfont:e({arrayOk:!1,editType:"plot",colorEditType:"style"}),insidetextfont:e({arrayOk:!1,editType:"plot",colorEditType:"style"}),insidetextanchor:u.insidetextanchor,textangle:u.textangle,cliponaxis:u.cliponaxis,constraintext:u.constraintext,marker:u.marker,offsetgroup:u.offsetgroup,alignmentgroup:u.alignmentgroup,selected:u.selected,unselected:u.unselected,zorder:u.zorder}}),K6=Vt((K,V)=>{var u=ji(),d=Xr(),E=Pi(),A=Ch().handleText,t=p1(),e=z1();V.exports=function(r,i,n,o){function a(T,c){return d.coerce(r,i,e,T,c)}var s=a("x"),f=a("y"),v=a("cumulative.enabled");v&&(a("cumulative.direction"),a("cumulative.currentbin")),a("text");var g=a("textposition");A(r,i,o,a,g,{moduleHasSelected:!0,moduleHasUnselected:!0,moduleHasConstrain:!0,moduleHasCliponaxis:!0,moduleHasTextangle:!0,moduleHasInsideanchor:!0}),a("hovertext"),a("hovertemplate"),a("hovertemplatefallback"),a("xhoverformat"),a("yhoverformat");var m=a("orientation",f&&!s?"h":"v"),w=m==="v"?"x":"y",l=m==="v"?"y":"x",x=s&&f?Math.min(d.minRowLength(s)&&d.minRowLength(f)):d.minRowLength(i[w]||[]);if(!x){i.visible=!1;return}i._length=x;var y=u.getComponentMethod("calendars","handleTraceDefaults");y(r,i,["x","y"],o);var S=i[l];S&&a("histfunc"),a("histnorm"),a("autobin"+w),t(r,i,a,n,o),d.coerceSelectionMarkerOpacity(i,a);var k=(i.marker.line||{}).color,M=u.getComponentMethod("errorbars","supplyDefaults");M(r,i,k||E.defaultLine,{axis:"y"}),M(r,i,k||E.defaultLine,{axis:"x",inherit:"y"}),a("zorder")}}),L1=Vt((K,V)=>{var u=Xr(),d=fc(),E=ji().traceIs,A=p0(),t=Ch().validateCornerradius,e=u.nestedProperty,r=f0().getAxisGroup,i=[{aStr:{x:"xbins.start",y:"ybins.start"},name:"start"},{aStr:{x:"xbins.end",y:"ybins.end"},name:"end"},{aStr:{x:"xbins.size",y:"ybins.size"},name:"size"},{aStr:{x:"nbinsx",y:"nbinsy"},name:"nbins"}],n=["x","y"];V.exports=function(o,a){var s=a._histogramBinOpts={},f=[],v={},g=[],m,w,l,x,y,S,k;function M(ct,st){return u.coerce(m._input,m,m._module.attributes,ct,st)}function T(ct){return ct.orientation==="v"?"x":"y"}function c(ct,st){var et=d.getFromTrace({_fullLayout:a},ct,st);return et.type}function h(ct,st,et){var Z=ct.uid+"__"+et;st||(st=Z);var ot=c(ct,et),X=ct[et+"calendar"]||"",Q=s[st],ut=!0;Q&&(ot===Q.axType&&X===Q.calendar?(ut=!1,Q.traces.push(ct),Q.dirs.push(et)):(st=Z,ot!==Q.axType&&u.warn(["Attempted to group the bins of trace",ct.index,"set on a","type:"+ot,"axis","with bins on","type:"+Q.axType,"axis."].join(" ")),X!==Q.calendar&&u.warn(["Attempted to group the bins of trace",ct.index,"set with a",X,"calendar","with bins",Q.calendar?"on a "+Q.calendar+" calendar":"w/o a set calendar"].join(" ")))),ut&&(s[st]={traces:[ct],dirs:[et],axType:ot,calendar:ct[et+"calendar"]||""}),ct["_"+et+"bingroup"]=st}for(y=0;y{var u=Im().hoverPoints,d=yo().hoverLabelText;V.exports=function(E,A,t,e,r){var i=u(E,A,t,e,r);if(i){E=i[0];var n=E.cd[E.index],o=E.cd[0].trace;if(!o.cumulative.enabled){var a=o.orientation==="h"?"y":"x";E[a+"Label"]=d(E[a+"a"],[n.ph0,n.ph1],o[a+"hoverformat"])}return i}}}),d2=Vt((K,V)=>{V.exports=function(u,d,E,A,t){if(u.x="xVal"in d?d.xVal:d.x,u.y="yVal"in d?d.yVal:d.y,"zLabelVal"in d&&(u.z=d.zLabelVal),d.xa&&(u.xaxis=d.xa),d.ya&&(u.yaxis=d.ya),!(E.cumulative||{}).enabled){var e=Array.isArray(t)?A[0].pts[t[0]][t[1]]:A[t].pts;u.pointNumbers=e,u.binNumber=u.pointNumber,delete u.pointNumber,delete u.pointIndex;var r;if(E._indexToPoints){r=[];for(var i=0;i{V.exports={attributes:z1(),layoutAttributes:h1(),supplyDefaults:K6(),crossTraceDefaults:L1(),supplyLayoutDefaults:e2(),calc:c2().calc,crossTraceCalc:d0().crossTraceCalc,plot:g0().plot,layerName:"barlayer",style:Vh().style,styleOnSelect:Vh().styleOnSelect,colorbar:Zf(),hoverPoints:Y6(),selectPoints:Pm(),eventData:d2(),moduleType:"trace",name:"histogram",basePlotModule:Yc(),categories:["bar-like","cartesian","svg","bar","histogram","oriented","errorBarsOK","showLegend"],meta:{}}}),$6=Vt((K,V)=>{V.exports=X6()}),C1=Vt((K,V)=>{var u=z1(),d=p2(),E=Om(),A=kl(),t=hc().axisHoverFormat,{hovertemplateAttrs:e,texttemplateAttrs:r,templatefallbackAttrs:i}=yl(),n=Wl(),o=So().extendFlat;V.exports=o({x:u.x,y:u.y,z:{valType:"data_array",editType:"calc"},marker:{color:{valType:"data_array",editType:"calc"},editType:"calc"},histnorm:u.histnorm,histfunc:u.histfunc,nbinsx:u.nbinsx,xbins:d("x"),nbinsy:u.nbinsy,ybins:d("y"),autobinx:u.autobinx,autobiny:u.autobiny,bingroup:o({},u.bingroup,{}),xbingroup:o({},u.bingroup,{}),ybingroup:o({},u.bingroup,{}),xgap:E.xgap,ygap:E.ygap,zsmooth:E.zsmooth,xhoverformat:t("x"),yhoverformat:t("y"),zhoverformat:t("z",1),hovertemplate:e({},{keys:["z"]}),hovertemplatefallback:i(),texttemplate:r({arrayOk:!1,editType:"plot"},{keys:["z"]}),texttemplatefallback:i({editType:"plot"}),textfont:E.textfont,showlegend:o({},A.showlegend,{dflt:!1})},n("",{cLetter:"z",autoColorDflt:!1}))}),m2=Vt((K,V)=>{var u=ji(),d=Xr();V.exports=function(E,A,t,e){var r=t("x"),i=t("y"),n=d.minRowLength(r),o=d.minRowLength(i);if(!n||!o){A.visible=!1;return}A._length=Math.min(n,o);var a=u.getComponentMethod("calendars","handleTraceDefaults");a(E,A,["x","y"],e);var s=t("z")||t("marker.color");s&&t("histfunc"),t("histnorm"),t("autobinx"),t("autobiny")}}),J6=Vt((K,V)=>{var u=Xr(),d=m2(),E=i2(),A=vf(),t=tv(),e=C1();V.exports=function(r,i,n,o){function a(s,f){return u.coerce(r,i,e,s,f)}d(r,i,a,o),i.visible!==!1&&(E(r,i,a,o),A(r,i,o,a,{prefix:"",cLetter:"z"}),a("hovertemplate"),a("hovertemplatefallback"),t(a,o),a("xhoverformat"),a("yhoverformat"))}}),Q6=Vt((K,V)=>{var u=E1(),d=yo().hoverLabelText;V.exports=function(E,A,t,e,r){var i=u(E,A,t,e,r);if(i){E=i[0];var n=E.index,o=n[0],a=n[1],s=E.cd[0],f=s.trace,v=s.xRanges[a],g=s.yRanges[o];return E.xLabel=d(E.xa,[v[0],v[1]],f.xhoverformat),E.yLabel=d(E.ya,[g[0],g[1]],f.yhoverformat),i}}}),tA=Vt((K,V)=>{V.exports={attributes:C1(),supplyDefaults:J6(),crossTraceDefaults:L1(),calc:k1(),plot:M1(),layerName:"heatmaplayer",colorbar:Ld(),style:S1(),hoverPoints:Q6(),eventData:d2(),moduleType:"trace",name:"histogram2d",basePlotModule:Yc(),categories:["cartesian","svg","2dMap","histogram","showLegend"],meta:{}}}),eA=Vt((K,V)=>{V.exports=tA()}),I1=Vt((K,V)=>{V.exports={COMPARISON_OPS:["=","!=","<",">=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}}}),ev=Vt((K,V)=>{var u=Om(),d=dc(),E=hc(),A=E.axisHoverFormat,t=E.descriptionOnlyNumbers,e=Wl(),r=If().dash,i=yu(),n=So().extendFlat,o=I1(),a=o.COMPARISON_OPS2,s=o.INTERVAL_OPS,f=d.line;V.exports=n({z:u.z,x:u.x,x0:u.x0,dx:u.dx,y:u.y,y0:u.y0,dy:u.dy,xperiod:u.xperiod,yperiod:u.yperiod,xperiod0:d.xperiod0,yperiod0:d.yperiod0,xperiodalignment:u.xperiodalignment,yperiodalignment:u.yperiodalignment,text:u.text,hovertext:u.hovertext,transpose:u.transpose,xtype:u.xtype,ytype:u.ytype,xhoverformat:A("x"),yhoverformat:A("y"),zhoverformat:A("z",1),hovertemplate:u.hovertemplate,hovertemplatefallback:u.hovertemplatefallback,texttemplate:n({},u.texttemplate,{}),texttemplatefallback:u.texttemplatefallback,textfont:n({},u.textfont,{}),hoverongaps:u.hoverongaps,connectgaps:n({},u.connectgaps,{}),fillcolor:{valType:"color",editType:"calc"},autocontour:{valType:"boolean",dflt:!0,editType:"calc",impliedEdits:{"contours.start":void 0,"contours.end":void 0,"contours.size":void 0}},ncontours:{valType:"integer",dflt:15,min:1,editType:"calc"},contours:{type:{valType:"enumerated",values:["levels","constraint"],dflt:"levels",editType:"calc"},start:{valType:"number",dflt:null,editType:"plot",impliedEdits:{"^autocontour":!1}},end:{valType:"number",dflt:null,editType:"plot",impliedEdits:{"^autocontour":!1}},size:{valType:"number",dflt:null,min:0,editType:"plot",impliedEdits:{"^autocontour":!1}},coloring:{valType:"enumerated",values:["fill","heatmap","lines","none"],dflt:"fill",editType:"calc"},showlines:{valType:"boolean",dflt:!0,editType:"plot"},showlabels:{valType:"boolean",dflt:!1,editType:"plot"},labelfont:i({editType:"plot",colorEditType:"style"}),labelformat:{valType:"string",dflt:"",editType:"plot",description:t("contour label")},operation:{valType:"enumerated",values:[].concat(a).concat(s),dflt:"=",editType:"calc"},value:{valType:"any",dflt:0,editType:"calc"},editType:"calc",impliedEdits:{autocontour:!1}},line:{color:n({},f.color,{editType:"style+colorbars"}),width:{valType:"number",min:0,editType:"style+colorbars"},dash:r,smoothing:n({},f.smoothing,{}),editType:"plot"},zorder:d.zorder},e("",{cLetter:"z",autoColorDflt:!1,editTypeOverride:"calc"}))}),g2=Vt((K,V)=>{var u=C1(),d=ev(),E=Wl(),A=hc().axisHoverFormat,t=So().extendFlat;V.exports=t({x:u.x,y:u.y,z:u.z,marker:u.marker,histnorm:u.histnorm,histfunc:u.histfunc,nbinsx:u.nbinsx,xbins:u.xbins,nbinsy:u.nbinsy,ybins:u.ybins,autobinx:u.autobinx,autobiny:u.autobiny,bingroup:u.bingroup,xbingroup:u.xbingroup,ybingroup:u.ybingroup,autocontour:d.autocontour,ncontours:d.ncontours,contours:d.contours,line:{color:d.line.color,width:t({},d.line.width,{dflt:.5}),dash:d.line.dash,smoothing:d.line.smoothing,editType:"plot"},xhoverformat:A("x"),yhoverformat:A("y"),zhoverformat:A("z",1),hovertemplate:u.hovertemplate,hovertemplatefallback:u.hovertemplatefallback,texttemplate:d.texttemplate,texttemplatefallback:d.texttemplatefallback,textfont:d.textfont},E("",{cLetter:"z",editTypeOverride:"calc"}))}),P1=Vt((K,V)=>{V.exports=function(u,d,E,A){var t=A("contours.start"),e=A("contours.end"),r=t===!1||e===!1,i=E("contours.size"),n;r?n=d.autocontour=!0:n=E("autocontour",!1),(n||!i)&&E("ncontours")}}),v2=Vt((K,V)=>{var u=Xr();V.exports=function(d,E,A,t){t||(t={});var e=d("contours.showlabels");if(e){var r=E.font;u.coerceFont(d,"contours.labelfont",r,{overrideDflt:{color:A}}),d("contours.labelformat")}t.hasHover!==!1&&d("zhoverformat")}}),O1=Vt((K,V)=>{var u=vf(),d=v2();V.exports=function(E,A,t,e,r){var i=t("contours.coloring"),n,o="";i==="fill"&&(n=t("contours.showlines")),n!==!1&&(i!=="lines"&&(o=t("line.color","#000")),t("line.width",.5),t("line.dash")),i!=="none"&&(E.showlegend!==!0&&(A.showlegend=!1),A._dfltShowLegend=!1,u(E,A,e,t,{prefix:"",cLetter:"z"})),t("line.smoothing"),d(t,e,o,r)}}),rA=Vt((K,V)=>{var u=Xr(),d=m2(),E=P1(),A=O1(),t=tv(),e=g2();V.exports=function(r,i,n,o){function a(f,v){return u.coerce(r,i,e,f,v)}function s(f){return u.coerce2(r,i,e,f)}d(r,i,a,o),i.visible!==!1&&(E(r,i,a,s),A(r,i,a,o),a("xhoverformat"),a("yhoverformat"),a("hovertemplate"),a("hovertemplatefallback"),i.contours&&i.contours.coloring==="heatmap"&&t(a,o))}}),y2=Vt((K,V)=>{var u=yo(),d=Xr();V.exports=function(A,t){var e=A.contours;if(A.autocontour){var r=A.zmin,i=A.zmax;(A.zauto||r===void 0)&&(r=d.aggNums(Math.min,null,t)),(A.zauto||i===void 0)&&(i=d.aggNums(Math.max,null,t));var n=E(r,i,A.ncontours);e.size=n.dtick,e.start=u.tickFirst(n),n.range.reverse(),e.end=u.tickFirst(n),e.start===r&&(e.start+=e.size),e.end===i&&(e.end-=e.size),e.start>e.end&&(e.start=e.end=(e.start+e.end)/2),A._input.contours||(A._input.contours={}),d.extendFlat(A._input.contours,{start:e.start,end:e.end,size:e.size}),A._input.autocontour=!0}else if(e.type!=="constraint"){var o=e.start,a=e.end,s=A._input.contours;if(o>a&&(e.start=s.start=a,a=e.end=s.end=o,o=e.start),!(e.size>0)){var f;o===a?f=1:f=E(o,a,A.ncontours).dtick,s.size=e.size=f}}};function E(A,t,e){var r={type:"linear",range:[A,t]};return u.autoTicks(r,(t-A)/(e||15)),r}}),rv=Vt((K,V)=>{V.exports=function(u){return u.end+u.size/1e6}}),x2=Vt((K,V)=>{var u=xu(),d=k1(),E=y2(),A=rv();V.exports=function(t,e){var r=d(t,e),i=r[0].z;E(e,i);var n=e.contours,o=u.extractOpts(e),a;if(n.coloring==="heatmap"&&o.auto&&e.autocontour===!1){var s=n.start,f=A(n),v=n.size||1,g=Math.floor((f-s)/v)+1;isFinite(v)||(v=1,g=1);var m=s-v/2,w=m+g*v;a=[m,w]}else a=i;return u.calc(t,e,{vals:a,cLetter:"z"}),r}}),nv=Vt((K,V)=>{V.exports={BOTTOMSTART:[1,9,13,104,713],TOPSTART:[4,6,7,104,713],LEFTSTART:[8,12,14,208,1114],RIGHTSTART:[2,3,11,208,1114],NEWDELTA:[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],CHOOSESADDLE:{104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},SADDLEREMAINDER:{1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11},LABELDISTANCE:2,LABELINCREASE:10,LABELMIN:3,LABELMAX:10,LABELOPTIMIZER:{EDGECOST:1,ANGLECOST:1,NEIGHBORCOST:5,SAMELEVELFACTOR:10,SAMELEVELDISTANCE:5,MAXCOST:100,INITIALSEARCHPOINTS:10,ITERATIONS:5}}}),_2=Vt((K,V)=>{var u=nv();V.exports=function(E){var A=E[0].z,t=A.length,e=A[0].length,r=t===2||e===2,i,n,o,a,s,f,v,g,m;for(n=0;nE?0:1)+(A[0][1]>E?0:2)+(A[1][1]>E?0:4)+(A[1][0]>E?0:8);if(t===5||t===10){var e=(A[0][0]+A[0][1]+A[1][0]+A[1][1])/4;return E>e?t===5?713:1114:t===5?104:208}return t===15?0:t}}),b2=Vt((K,V)=>{var u=Xr(),d=nv();V.exports=function(i,n,o){var a,s,f,v,g;for(n=n||.01,o=o||.01,f=0;f20?(v=d.CHOOSESADDLE[v][(g[0]||g[1])<0?0:1],i.crossings[f]=d.SADDLEREMAINDER[v]):delete i.crossings[f],g=d.NEWDELTA[v],!g){u.log("Found bad marching index:",v,n,i.level);break}m.push(r(i,n,g)),n[0]+=g[0],n[1]+=g[1],f=n.join(","),E(m[m.length-1],m[m.length-2],a,s)&&m.pop();var k=g[0]&&(n[0]<0||n[0]>l-2)||g[1]&&(n[1]<0||n[1]>w-2),M=n[0]===x[0]&&n[1]===x[1]&&g[0]===y[0]&&g[1]===y[1];if(M||o&&k)break;v=i.crossings[f]}S===1e4&&u.log("Infinite loop in contour?");var T=E(m[0],m[m.length-1],a,s),c=0,h=.2*i.smoothing,b=[],_=0,P,z,D,B,R,I,F,j,N,G,rt;for(S=1;S=_;S--)if(P=b[S],P=_&&P+b[z]j&&N--,i.edgepaths[N]=rt.concat(m,G));break}Z||(i.edgepaths[j]=m.concat(G))}for(j=0;j20&&n?i===208||i===1114?a=o[0]===0?1:-1:s=o[1]===0?1:-1:d.BOTTOMSTART.indexOf(i)!==-1?s=1:d.LEFTSTART.indexOf(i)!==-1?a=1:d.TOPSTART.indexOf(i)!==-1?s=-1:a=-1,[a,s]}function r(i,n,o){var a=n[0]+Math.max(o[0],0),s=n[1]+Math.max(o[1],0),f=i.z[s][a],v=i.xaxis,g=i.yaxis;if(o[1]){var m=(i.level-f)/(i.z[s][a+1]-f),w=(m!==1?(1-m)*v.c2l(i.x[a]):0)+(m!==0?m*v.c2l(i.x[a+1]):0);return[v.c2p(v.l2c(w),!0),g.c2p(i.y[s],!0),a+m,s]}else{var l=(i.level-f)/(i.z[s+1][a]-f),x=(l!==1?(1-l)*g.c2l(i.y[s]):0)+(l!==0?l*g.c2l(i.y[s+1]):0);return[v.c2p(i.x[a],!0),g.c2p(g.l2c(x),!0),a,s+l]}}}),nA=Vt((K,V)=>{var u=I1(),d=Lo();V.exports={"[]":A("[]"),"][":A("]["),">":t(">"),"<":t("<"),"=":t("=")};function E(e,r){var i=Array.isArray(r),n;function o(a){return d(a)?+a:null}return u.COMPARISON_OPS2.indexOf(e)!==-1?n=o(i?r[0]:r):u.INTERVAL_OPS.indexOf(e)!==-1?n=i?[o(r[0]),o(r[1])]:[o(r),o(r)]:u.SET_OPS.indexOf(e)!==-1&&(n=i?r.map(o):[o(r)]),n}function A(e){return function(r){r=E(e,r);var i=Math.min(r[0],r[1]),n=Math.max(r[0],r[1]);return{start:i,end:n,size:n-i}}}function t(e){return function(r){return r=E(e,r),{start:r,end:1/0,size:1/0}}}}),w2=Vt((K,V)=>{var u=Xr(),d=nA(),E=rv();V.exports=function(A,t,e){for(var r=A.type==="constraint"?d[A._operation](A.value):A,i=r.size,n=[],o=E(r),a=e.trace._carpetTrace,s=a?{xaxis:a.aaxis,yaxis:a.baxis,x:e.a,y:e.b}:{xaxis:t.xaxis,yaxis:t.yaxis,x:e.x,y:e.y},f=r.start;f1e3){u.warn("Too many contours, clipping at 1000",A);break}return n}}),T2=Vt((K,V)=>{var u=Xr();V.exports=function(E,A){var t,e,r,i=function(a){return a.reverse()},n=function(a){return a};switch(A){case"=":case"<":return E;case">":for(E.length!==1&&u.warn("Contour data invalid for the specified inequality operation."),e=E[0],t=0;t{V.exports=function(u,d){var E=u[0],A=E.z,t;switch(d.type){case"levels":var e=Math.min(A[0][0],A[0][1]);for(t=0;tr.level||r.starts.length&&e===r.level)}break;case"constraint":if(E.prefixBoundary=!1,E.edgepaths.length)return;var i=E.x.length,n=E.y.length,o=-1/0,a=1/0;for(t=0;t":s>o&&(E.prefixBoundary=!0);break;case"<":(so||E.starts.length&&v===a)&&(E.prefixBoundary=!0);break;case"][":f=Math.min(s[0],s[1]),v=Math.max(s[0],s[1]),fo&&(E.prefixBoundary=!0);break}break}}}),D1=Vt(K=>{var V=Ni(),u=Xr(),d=Eo(),E=xu(),A=Dl(),t=yo(),e=gp(),r=M1(),i=_2(),n=b2(),o=w2(),a=T2(),s=k2(),f=nv(),v=f.LABELOPTIMIZER;K.plot=function(k,M,T,c){var h=M.xaxis,b=M.yaxis;u.makeTraceGroups(c,T,"contour").each(function(_){var P=V.select(this),z=_[0],D=z.trace,B=z.x,R=z.y,I=D.contours,F=o(I,M,z),j=u.ensureSingle(P,"g","heatmapcoloring"),N=[];I.coloring==="heatmap"&&(N=[_]),r(k,M,N,j),i(F),n(F);var G=h.c2p(B[0],!0),rt=h.c2p(B[B.length-1],!0),ct=b.c2p(R[0],!0),st=b.c2p(R[R.length-1],!0),et=[[G,st],[rt,st],[rt,ct],[G,ct]],Z=F;I.type==="constraint"&&(Z=a(F,I._operation)),g(P,et,I),m(P,Z,et,I),l(P,F,k,z,I),y(P,M,k,z,et)})};function g(k,M,T){var c=u.ensureSingle(k,"g","contourbg"),h=c.selectAll("path").data(T.coloring==="fill"?[0]:[]);h.enter().append("path"),h.exit().remove(),h.attr("d","M"+M.join("L")+"Z").style("stroke","none")}function m(k,M,T,c){var h=c.coloring==="fill"||c.type==="constraint"&&c._operation!=="=",b="M"+T.join("L")+"Z";h&&s(M,c);var _=u.ensureSingle(k,"g","contourfill"),P=_.selectAll("path").data(h?M:[]);P.enter().append("path"),P.exit().remove(),P.each(function(z){var D=(z.prefixBoundary?b:"")+w(z,T);D?V.select(this).attr("d",D).style("stroke","none"):V.select(this).remove()})}function w(k,M){var T="",c=0,h=k.edgepaths.map(function(rt,ct){return ct}),b=!0,_,P,z,D,B,R;function I(rt){return Math.abs(rt[1]-M[0][1])<.01}function F(rt){return Math.abs(rt[1]-M[2][1])<.01}function j(rt){return Math.abs(rt[0]-M[0][0])<.01}function N(rt){return Math.abs(rt[0]-M[2][0])<.01}for(;h.length;){for(R=d.smoothopen(k.edgepaths[c],k.smoothing),T+=b?R:R.replace(/^M/,"L"),h.splice(h.indexOf(c),1),_=k.edgepaths[c][k.edgepaths[c].length-1],D=-1,z=0;z<4;z++){if(!_){u.log("Missing end?",c,k);break}for(I(_)&&!N(_)?P=M[1]:j(_)?P=M[0]:F(_)?P=M[3]:N(_)&&(P=M[2]),B=0;B=0&&(P=G,D=B):Math.abs(_[1]-P[1])<.01?Math.abs(_[1]-G[1])<.01&&(G[0]-_[0])*(P[0]-G[0])>=0&&(P=G,D=B):u.log("endpt to newendpt is not vert. or horz.",_,P,G)}if(_=P,D>=0)break;T+="L"+P}if(D===k.edgepaths.length){u.log("unclosed perimeter path");break}c=D,b=h.indexOf(c)===-1,b&&(c=h[0],T+="Z")}for(c=0;cv.MAXCOST*2)break;I&&(P/=2),_=D-P/2,z=_+P*1.5}if(R<=v.MAXCOST)return B};function x(k,M,T,c){var h=M.width/2,b=M.height/2,_=k.x,P=k.y,z=k.theta,D=Math.cos(z)*h,B=Math.sin(z)*h,R=(_>c.center?c.right-_:_-c.left)/(D+Math.abs(Math.sin(z)*b)),I=(P>c.middle?c.bottom-P:P-c.top)/(Math.abs(B)+Math.cos(z)*b);if(R<1||I<1)return 1/0;var F=v.EDGECOST*(1/(R-1)+1/(I-1));F+=v.ANGLECOST*z*z;for(var j=_-D,N=P-B,G=_+D,rt=P+B,ct=0;ct{var u=Ni(),d=xu(),E=rv();V.exports=function(A){var t=A.contours,e=t.start,r=E(t),i=t.size||1,n=Math.floor((r-e)/i)+1,o=t.coloring==="lines"?0:1,a=d.extractOpts(A);isFinite(i)||(i=1,n=1);var s=a.reversescale?d.flipScale(a.colorscale):a.colorscale,f=s.length,v=new Array(f),g=new Array(f),m,w,l=a.min,x=a.max;if(t.coloring==="heatmap"){for(w=0;w=x)&&(e<=l&&(e=l),r>=x&&(r=x),n=Math.floor((r-e)/i)+1,o=0),w=0;wl&&(v.unshift(l),g.unshift(g[0])),v[v.length-1]{var u=Ni(),d=Eo(),E=S1(),A=A2();V.exports=function(t){var e=u.select(t).selectAll("g.contour");e.style("opacity",function(r){return r[0].trace.opacity}),e.each(function(r){var i=u.select(this),n=r[0].trace,o=n.contours,a=n.line,s=o.size||1,f=o.start,v=o.type==="constraint",g=!v&&o.coloring==="lines",m=!v&&o.coloring==="fill",w=g||m?A(n):null;i.selectAll("g.contourlevel").each(function(y){u.select(this).selectAll("path").call(d.lineGroupStyle,a.width,g?w(y.level):a.color,a.dash)});var l=o.labelfont;if(i.selectAll("g.contourlabels text").each(function(y){d.font(u.select(this),{weight:l.weight,style:l.style,variant:l.variant,textcase:l.textcase,lineposition:l.lineposition,shadow:l.shadow,family:l.family,size:l.size,color:l.color||(g?w(y.level):a.color)})}),v)i.selectAll("g.contourfill path").style("fill",n.fillcolor);else if(m){var x;i.selectAll("g.contourfill path").style("fill",function(y){return x===void 0&&(x=y.level),w(y.level+.5*s)}),x===void 0&&(x=f),i.selectAll("g.contourbg path").style("fill",w(x-.5*s))}}),E(t)}}),B1=Vt((K,V)=>{var u=xu(),d=A2(),E=rv();function A(t,e,r){var i=e.contours,n=e.line,o=i.size||1,a=i.coloring,s=d(e,{isColorbar:!0});if(a==="heatmap"){var f=u.extractOpts(e);r._fillgradient=f.reversescale?u.flipScale(f.colorscale):f.colorscale,r._zrange=[f.min,f.max]}else a==="fill"&&(r._fillcolor=s);r._line={color:a==="lines"?s:n.color,width:i.showlines!==!1?n.width:0,dash:n.dash},r._levels={start:i.start,end:E(i),size:o}}V.exports={min:"zmin",max:"zmax",calc:A}}),M2=Vt((K,V)=>{var u=Pi(),d=E1();V.exports=function(E,A,t,e,r){r||(r={}),r.isContour=!0;var i=d(E,A,t,e,r);return i&&i.forEach(function(n){var o=n.trace;o.contours.type==="constraint"&&(o.fillcolor&&u.opacity(o.fillcolor)?n.color=u.addOpacity(o.fillcolor,1):o.contours.showlines&&u.opacity(o.line.color)&&(n.color=u.addOpacity(o.line.color,1)))}),i}}),aA=Vt((K,V)=>{V.exports={attributes:g2(),supplyDefaults:rA(),crossTraceDefaults:L1(),calc:x2(),plot:D1().plot,layerName:"contourlayer",style:F1(),colorbar:B1(),hoverPoints:M2(),moduleType:"trace",name:"histogram2dcontour",basePlotModule:Yc(),categories:["cartesian","svg","2dMap","contour","histogram","showLegend"],meta:{}}}),iA=Vt((K,V)=>{V.exports=aA()}),S2=Vt((K,V)=>{var u=Lo(),d=v2(),E=Pi(),A=E.addOpacity,t=E.opacity,e=I1(),r=Xr().isArrayOrTypedArray,i=e.CONSTRAINT_REDUCTION,n=e.COMPARISON_OPS2;V.exports=function(a,s,f,v,g,m){var w=s.contours,l,x,y,S=f("contours.operation");if(w._operation=i[S],o(f,w),S==="="?l=w.showlines=!0:(l=f("contours.showlines"),y=f("fillcolor",A((a.line||{}).color||g,.5))),l){var k=y&&t(y)?A(s.fillcolor,1):g;x=f("line.color",k),f("line.width",2),f("line.dash")}f("line.smoothing"),d(f,v,x,m)};function o(a,s){var f;n.indexOf(s.operation)===-1?(a("contours.value",[0,1]),r(s.value)?s.value.length>2?s.value=s.value.slice(2):s.length===0?s.value=[0,1]:s.length<2?(f=parseFloat(s.value[0]),s.value=[f,f+1]):s.value=[parseFloat(s.value[0]),parseFloat(s.value[1])]:u(s.value)&&(f=parseFloat(s.value),s.value=[f,f+1])):(a("contours.value",0),u(s.value)||(r(s.value)?s.value=parseFloat(s.value[0]):s.value=0))}}),oA=Vt((K,V)=>{var u=Xr(),d=x1(),E=Qh(),A=S2(),t=P1(),e=O1(),r=tv(),i=ev();V.exports=function(n,o,a,s){function f(w,l){return u.coerce(n,o,i,w,l)}function v(w){return u.coerce2(n,o,i,w)}var g=d(n,o,f,s);if(!g){o.visible=!1;return}E(n,o,s,f),f("xhoverformat"),f("yhoverformat"),f("text"),f("hovertext"),f("hoverongaps"),f("hovertemplate"),f("hovertemplatefallback");var m=f("contours.type")==="constraint";f("connectgaps",u.isArray1D(o.z)),m?A(n,o,f,s,a):(t(n,o,f,v),e(n,o,f,s)),o.contours&&o.contours.coloring==="heatmap"&&r(f,s),f("zorder")}}),sA=Vt((K,V)=>{V.exports={attributes:ev(),supplyDefaults:oA(),calc:x2(),plot:D1().plot,style:F1(),colorbar:B1(),hoverPoints:M2(),moduleType:"trace",name:"contour",basePlotModule:Yc(),categories:["cartesian","svg","2dMap","contour","showLegend"],meta:{}}}),lA=Vt((K,V)=>{V.exports=sA()}),E2=Vt((K,V)=>{var{hovertemplateAttrs:u,texttemplateAttrs:d,templatefallbackAttrs:E}=yl(),A=Jh(),t=dc(),e=kl(),r=Wl(),i=If().dash,n=So().extendFlat,o=t.marker,a=t.line,s=o.line;V.exports={a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},c:{valType:"data_array",editType:"calc"},sum:{valType:"number",dflt:0,min:0,editType:"calc"},mode:n({},t.mode,{dflt:"markers"}),text:n({},t.text,{}),texttemplate:d({editType:"plot"},{keys:["a","b","c","text"]}),texttemplatefallback:E({editType:"plot"}),hovertext:n({},t.hovertext,{}),line:{color:a.color,width:a.width,dash:i,backoff:a.backoff,shape:n({},a.shape,{values:["linear","spline"]}),smoothing:a.smoothing,editType:"calc"},connectgaps:t.connectgaps,cliponaxis:t.cliponaxis,fill:n({},t.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:A(),marker:n({symbol:o.symbol,opacity:o.opacity,angle:o.angle,angleref:o.angleref,standoff:o.standoff,maxdisplayed:o.maxdisplayed,size:o.size,sizeref:o.sizeref,sizemin:o.sizemin,sizemode:o.sizemode,line:n({width:s.width,editType:"calc"},r("marker.line")),gradient:o.gradient,editType:"calc"},r("marker")),textfont:t.textfont,textposition:t.textposition,selected:t.selected,unselected:t.unselected,hoverinfo:n({},e.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:t.hoveron,hovertemplate:u(),hovertemplatefallback:E()}}),uA=Vt((K,V)=>{var u=Xr(),d=vp(),E=nu(),A=Lh(),t=Bh(),e=Sm(),r=Rh(),i=tp(),n=E2();V.exports=function(o,a,s,f){function v(S,k){return u.coerce(o,a,n,S,k)}var g=v("a"),m=v("b"),w=v("c"),l;if(g?(l=g.length,m?(l=Math.min(l,m.length),w&&(l=Math.min(l,w.length))):w?l=Math.min(l,w.length):l=0):m&&w&&(l=Math.min(m.length,w.length)),!l){a.visible=!1;return}a._length=l,v("sum"),v("text"),v("hovertext"),a.hoveron!=="fills"&&(v("hovertemplate"),v("hovertemplatefallback"));var x=l{var u=yo();V.exports=function(d,E,A){var t={},e=A[E.subplot]._subplot;return t.aLabel=u.tickText(e.aaxis,d.a,!0).text,t.bLabel=u.tickText(e.baxis,d.b,!0).text,t.cLabel=u.tickText(e.caxis,d.c,!0).text,t}}),fA=Vt((K,V)=>{var u=Lo(),d=Nh(),E=yp(),A=jh(),t=Uh().calcMarkerSize,e=["a","b","c"],r={a:["b","c"],b:["a","c"],c:["a","b"]};V.exports=function(i,n){var o=i._fullLayout[n.subplot],a=o.sum,s=n.sum||a,f={a:n.a,b:n.b,c:n.c},v=n.ids,g,m,w,l,x,y;for(g=0;g{var u=Em();V.exports=function(d,E,A){var t=E.plotContainer;t.select(".scatterlayer").selectAll("*").remove();for(var e=E.xaxis,r=E.yaxis,i={xaxis:e,yaxis:r,plot:t,layerClipId:E._hasClipOnAxisFalse?E.clipIdRelative:null},n=E.layers.frontplot.select("g.scatterlayer"),o=0;o{var u=Lm();V.exports=function(d,E,A,t){var e=u(d,E,A,t);if(!e||e[0].index===!1)return;var r=e[0];if(r.index===void 0){var i=1-r.y0/d.ya._length,n=d.xa._length,o=n*i/2,a=n-o;return r.x0=Math.max(Math.min(r.x0,a),o),r.x1=Math.max(Math.min(r.x1,a),o),e}var s=r.cd[r.index],f=r.trace,v=r.subplot;r.a=s.a,r.b=s.b,r.c=s.c,r.xLabelVal=void 0,r.yLabelVal=void 0;var g={};g[f.subplot]={_subplot:v};var m=f._module.formatLabels(s,f,g);r.aLabel=m.aLabel,r.bLabel=m.bLabel,r.cLabel=m.cLabel;var w=s.hi||f.hoverinfo,l=[];function x(S,k){l.push(S._hovertitle+": "+k)}if(!f.hovertemplate){var y=w.split("+");y.indexOf("all")!==-1&&(y=["a","b","c"]),y.indexOf("a")!==-1&&x(v.aaxis,r.aLabel),y.indexOf("b")!==-1&&x(v.baxis,r.bLabel),y.indexOf("c")!==-1&&x(v.caxis,r.cLabel)}return r.extraText=l.join("
          "),r.hovertemplate=f.hovertemplate,e}}),dA=Vt((K,V)=>{V.exports=function(u,d,E,A,t){if(d.xa&&(u.xaxis=d.xa),d.ya&&(u.yaxis=d.ya),A[t]){var e=A[t];u.a=e.a,u.b=e.b,u.c=e.c}else u.a=d.a,u.b=d.b,u.c=d.c;return u}}),mA=Vt((K,V)=>{var u=Ni(),d=Af(),E=ji(),A=Xr(),t=A.strTranslate,e=A._,r=Pi(),i=Eo(),n=gp(),o=So().extendFlat,a=Vu(),s=yo(),f=oh(),v=pc(),g=$h(),m=g.freeMode,w=g.rectMode,l=c0(),x=Ec().prepSelect,y=Ec().selectOnClick,S=Ec().clearOutline,k=Ec().clearSelectionsCache,M=Mf();function T(F,j){this.id=F.id,this.graphDiv=F.graphDiv,this.init(j),this.makeFramework(j),this.updateFx(j),this.aTickLayout=null,this.bTickLayout=null,this.cTickLayout=null}V.exports=T;var c=T.prototype;c.init=function(F){this.container=F._ternarylayer,this.defs=F._defs,this.layoutId=F._uid,this.traceHash={},this.layers={}},c.plot=function(F,j){var N=this,G=j[N.id],rt=j._size;N._hasClipOnAxisFalse=!1;for(var ct=0;cth*ot?(dt=ot,nt=dt*h):(nt=Z,dt=nt/h),Tt=st*nt/Z,wt=et*dt/ot,q=j.l+j.w*rt-nt/2,it=j.t+j.h*(1-ct)-dt/2,N.x0=q,N.y0=it,N.w=nt,N.h=dt,N.sum=X,N.xaxis={type:"linear",range:[Q+2*J-X,X-Q-2*ut],domain:[rt-Tt/2,rt+Tt/2],_id:"x"},n(N.xaxis,N.graphDiv._fullLayout),N.xaxis.setScale(),N.xaxis.isPtWithinRange=function(Ut){return Ut.a>=N.aaxis.range[0]&&Ut.a<=N.aaxis.range[1]&&Ut.b>=N.baxis.range[1]&&Ut.b<=N.baxis.range[0]&&Ut.c>=N.caxis.range[1]&&Ut.c<=N.caxis.range[0]},N.yaxis={type:"linear",range:[Q,X-ut-J],domain:[ct-wt/2,ct+wt/2],_id:"y"},n(N.yaxis,N.graphDiv._fullLayout),N.yaxis.setScale(),N.yaxis.isPtWithinRange=function(){return!0};var Ct=N.yaxis.domain[0],It=N.aaxis=o({},F.aaxis,{range:[Q,X-ut-J],side:"left",tickangle:(+F.aaxis.tickangle||0)-30,domain:[Ct,Ct+wt*h],anchor:"free",position:0,_id:"y",_length:nt});n(It,N.graphDiv._fullLayout),It.setScale();var Nt=N.baxis=o({},F.baxis,{range:[X-Q-J,ut],side:"bottom",domain:N.xaxis.domain,anchor:"free",position:0,_id:"x",_length:nt});n(Nt,N.graphDiv._fullLayout),Nt.setScale();var te=N.caxis=o({},F.caxis,{range:[X-Q-ut,J],side:"right",tickangle:(+F.caxis.tickangle||0)+30,domain:[Ct,Ct+wt*h],anchor:"free",position:0,_id:"y",_length:nt});n(te,N.graphDiv._fullLayout),te.setScale();var Jt="M"+q+","+(it+dt)+"h"+nt+"l-"+nt/2+",-"+dt+"Z";N.clipDef.select("path").attr("d",Jt),N.layers.plotbg.select("path").attr("d",Jt);var ee="M0,"+dt+"h"+nt+"l-"+nt/2+",-"+dt+"Z";N.clipDefRelative.select("path").attr("d",ee);var Zt=t(q,it);N.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",Zt),N.clipDefRelative.select("path").attr("transform",null);var mt=t(q-Nt._offset,it+dt);N.layers.baxis.attr("transform",mt),N.layers.bgrid.attr("transform",mt);var bt=t(q+nt/2,it)+"rotate(30)"+t(0,-It._offset);N.layers.aaxis.attr("transform",bt),N.layers.agrid.attr("transform",bt);var vt=t(q+nt/2,it)+"rotate(-30)"+t(0,-te._offset);N.layers.caxis.attr("transform",vt),N.layers.cgrid.attr("transform",vt),N.drawAxes(!0),N.layers.aline.select("path").attr("d",It.showline?"M"+q+","+(it+dt)+"l"+nt/2+",-"+dt:"M0,0").call(r.stroke,It.linecolor||"#000").style("stroke-width",(It.linewidth||0)+"px"),N.layers.bline.select("path").attr("d",Nt.showline?"M"+q+","+(it+dt)+"h"+nt:"M0,0").call(r.stroke,Nt.linecolor||"#000").style("stroke-width",(Nt.linewidth||0)+"px"),N.layers.cline.select("path").attr("d",te.showline?"M"+(q+nt/2)+","+it+"l"+nt/2+","+dt:"M0,0").call(r.stroke,te.linecolor||"#000").style("stroke-width",(te.linewidth||0)+"px"),N.graphDiv._context.staticPlot||N.initInteractions(),i.setClipUrl(N.layers.frontplot,N._hasClipOnAxisFalse?null:N.clipId,N.graphDiv)},c.drawAxes=function(F){var j=this,N=j.graphDiv,G=j.id.slice(7)+"title",rt=j.layers,ct=j.aaxis,st=j.baxis,et=j.caxis;if(j.drawAx(ct),j.drawAx(st),j.drawAx(et),F){var Z=Math.max(ct.showticklabels?ct.tickfont.size/2:0,(et.showticklabels?et.tickfont.size*.75:0)+(et.ticks==="outside"?et.ticklen*.87:0)),ot=(st.showticklabels?st.tickfont.size:0)+(st.ticks==="outside"?st.ticklen:0)+3;rt["a-title"]=l.draw(N,"a"+G,{propContainer:ct,propName:j.id+".aaxis.title.text",placeholder:e(N,"Click to enter Component A title"),attributes:{x:j.x0+j.w/2,y:j.y0-ct.title.font.size/3-Z,"text-anchor":"middle"}}),rt["b-title"]=l.draw(N,"b"+G,{propContainer:st,propName:j.id+".baxis.title.text",placeholder:e(N,"Click to enter Component B title"),attributes:{x:j.x0-ot,y:j.y0+j.h+st.title.font.size*.83+ot,"text-anchor":"middle"}}),rt["c-title"]=l.draw(N,"c"+G,{propContainer:et,propName:j.id+".caxis.title.text",placeholder:e(N,"Click to enter Component C title"),attributes:{x:j.x0+j.w+ot,y:j.y0+j.h+et.title.font.size*.83+ot,"text-anchor":"middle"}})}},c.drawAx=function(F){var j=this,N=j.graphDiv,G=F._name,rt=G.charAt(0),ct=F._id,st=j.layers[G],et=30,Z=rt+"tickLayout",ot=b(F);j[Z]!==ot&&(st.selectAll("."+ct+"tick").remove(),j[Z]=ot),F.setScale();var X=s.calcTicks(F),Q=s.clipEnds(F,X),ut=s.makeTransTickFn(F),J=s.getTickSigns(F)[2],q=A.deg2rad(et),it=J*(F.linewidth||1)/2,nt=J*F.ticklen,dt=j.w,Tt=j.h,wt=rt==="b"?"M0,"+it+"l"+Math.sin(q)*nt+","+Math.cos(q)*nt:"M"+it+",0l"+Math.cos(q)*nt+","+-Math.sin(q)*nt,Ct={a:"M0,0l"+Tt+",-"+dt/2,b:"M0,0l-"+dt/2+",-"+Tt,c:"M0,0l-"+Tt+","+dt/2}[rt];s.drawTicks(N,F,{vals:F.ticks==="inside"?Q:X,layer:st,path:wt,transFn:ut,crisp:!1}),s.drawGrid(N,F,{vals:Q,layer:j.layers[rt+"grid"],path:Ct,transFn:ut,crisp:!1}),s.drawLabels(N,F,{vals:X,layer:st,transFn:ut,labelFns:s.makeLabelFns(F,0,et)})};function b(F){return F.ticks+String(F.ticklen)+String(F.showticklabels)}var _=M.MINZOOM/2+.87,P="m-0.87,.5h"+_+"v3h-"+(_+5.2)+"l"+(_/2+2.6)+",-"+(_*.87+4.5)+"l2.6,1.5l-"+_/2+","+_*.87+"Z",z="m0.87,.5h-"+_+"v3h"+(_+5.2)+"l-"+(_/2+2.6)+",-"+(_*.87+4.5)+"l-2.6,1.5l"+_/2+","+_*.87+"Z",D="m0,1l"+_/2+","+_*.87+"l2.6,-1.5l-"+(_/2+2.6)+",-"+(_*.87+4.5)+"l-"+(_/2+2.6)+","+(_*.87+4.5)+"l2.6,1.5l"+_/2+",-"+_*.87+"Z",B="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",R=!0;c.clearOutline=function(){k(this.dragOptions),S(this.dragOptions.gd)},c.initInteractions=function(){var F=this,j=F.layers.plotbg.select("path").node(),N=F.graphDiv,G=N._fullLayout._zoomlayer,rt,ct;this.dragOptions={element:j,gd:N,plotinfo:{id:F.id,domain:N._fullLayout[F.id].domain,xaxis:F.xaxis,yaxis:F.yaxis},subplot:F.id,prepFn:function(mt,bt,vt){F.dragOptions.xaxes=[F.xaxis],F.dragOptions.yaxes=[F.yaxis],rt=N._fullLayout._invScaleX,ct=N._fullLayout._invScaleY;var Ut=F.dragOptions.dragmode=N._fullLayout.dragmode;m(Ut)?F.dragOptions.minDrag=1:F.dragOptions.minDrag=void 0,Ut==="zoom"?(F.dragOptions.moveFn=Nt,F.dragOptions.clickFn=dt,F.dragOptions.doneFn=te,Tt(mt,bt,vt)):Ut==="pan"?(F.dragOptions.moveFn=ee,F.dragOptions.clickFn=dt,F.dragOptions.doneFn=Zt,Jt(),F.clearOutline(N)):(w(Ut)||m(Ut))&&x(mt,bt,vt,F.dragOptions,Ut)}};var st,et,Z,ot,X,Q,ut,J,q,it;function nt(mt){var bt={};return bt[F.id+".aaxis.min"]=mt.a,bt[F.id+".baxis.min"]=mt.b,bt[F.id+".caxis.min"]=mt.c,bt}function dt(mt,bt){var vt=N._fullLayout.clickmode;I(N),mt===2&&(N.emit("plotly_doubleclick",null),E.call("_guiRelayout",N,nt({a:0,b:0,c:0}))),vt.indexOf("select")>-1&&mt===1&&y(bt,N,[F.xaxis],[F.yaxis],F.id,F.dragOptions),vt.indexOf("event")>-1&&v.click(N,bt,F.id)}function Tt(mt,bt,vt){var Ut=j.getBoundingClientRect();st=bt-Ut.left,et=vt-Ut.top,N._fullLayout._calcInverseTransform(N);var re=N._fullLayout._invTransform,Kt=A.apply3DTransform(re)(st,et);st=Kt[0],et=Kt[1],Z={a:F.aaxis.range[0],b:F.baxis.range[1],c:F.caxis.range[1]},X=Z,ot=F.aaxis.range[1]-Z.a,Q=d(F.graphDiv._fullLayout[F.id].bgcolor).getLuminance(),ut="M0,"+F.h+"L"+F.w/2+", 0L"+F.w+","+F.h+"Z",J=!1,q=G.append("path").attr("class","zoombox").attr("transform",t(F.x0,F.y0)).style({fill:Q>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",ut),it=G.append("path").attr("class","zoombox-corners").attr("transform",t(F.x0,F.y0)).style({fill:r.background,stroke:r.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),F.clearOutline(N)}function wt(mt,bt){return 1-bt/F.h}function Ct(mt,bt){return 1-(mt+(F.h-bt)/Math.sqrt(3))/F.w}function It(mt,bt){return(mt-(F.h-bt)/Math.sqrt(3))/F.w}function Nt(mt,bt){var vt=st+mt*rt,Ut=et+bt*ct,re=Math.max(0,Math.min(1,wt(st,et),wt(vt,Ut))),Kt=Math.max(0,Math.min(1,Ct(st,et),Ct(vt,Ut))),ue=Math.max(0,Math.min(1,It(st,et),It(vt,Ut))),Me=(re/2+ue)*F.w,Ce=(1-re/2-Kt)*F.w,We=(Me+Ce)/2,qe=Ce-Me,vr=(1-re)*F.h,_r=vr-qe/h;qe.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),it.transition().style("opacity",1).duration(200),J=!0),N.emit("plotly_relayouting",nt(X))}function te(){I(N),X!==Z&&(E.call("_guiRelayout",N,nt(X)),R&&N.data&&N._context.showTips&&(A.notifier(e(N,"Double-click to zoom back out"),"long"),R=!1))}function Jt(){Z={a:F.aaxis.range[0],b:F.baxis.range[1],c:F.caxis.range[1]},X=Z}function ee(mt,bt){var vt=mt/F.xaxis._m,Ut=bt/F.yaxis._m;X={a:Z.a-Ut,b:Z.b+(vt+Ut)/2,c:Z.c-(vt-Ut)/2};var re=[X.a,X.b,X.c].sort(A.sorterAsc),Kt={a:re.indexOf(X.a),b:re.indexOf(X.b),c:re.indexOf(X.c)};re[0]<0&&(re[1]+re[0]/2<0?(re[2]+=re[0]+re[1],re[0]=re[1]=0):(re[2]+=re[0]/2,re[1]+=re[0]/2,re[0]=0),X={a:re[Kt.a],b:re[Kt.b],c:re[Kt.c]},bt=(Z.a-X.a)*F.yaxis._m,mt=(Z.c-X.c-Z.b+X.b)*F.xaxis._m);var ue=t(F.x0+mt,F.y0+bt);F.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",ue);var Me=t(-mt,-bt);F.clipDefRelative.select("path").attr("transform",Me),F.aaxis.range=[X.a,F.sum-X.b-X.c],F.baxis.range=[F.sum-X.a-X.c,X.b],F.caxis.range=[F.sum-X.a-X.b,X.c],F.drawAxes(!1),F._hasClipOnAxisFalse&&F.plotContainer.select(".scatterlayer").selectAll(".trace").call(i.hideOutsideRangePoints,F),N.emit("plotly_relayouting",nt(X))}function Zt(){E.call("_guiRelayout",N,nt(X))}j.onmousemove=function(mt){v.hover(N,mt,F.id),N._fullLayout._lasthover=j,N._fullLayout._hoversubplot=F.id},j.onmouseout=function(mt){N._dragging||f.unhover(N,mt)},f.init(this.dragOptions)};function I(F){u.select(F).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}}),z2=Vt((K,V)=>{var u=af(),d=Hu().attributes,E=Of(),A=Cu().overrideAll,t=So().extendFlat,e={title:{text:E.title.text,font:E.title.font},color:E.color,tickmode:E.minor.tickmode,nticks:t({},E.nticks,{dflt:6,min:1}),tick0:E.tick0,dtick:E.dtick,tickvals:E.tickvals,ticktext:E.ticktext,ticks:E.ticks,ticklen:E.ticklen,tickwidth:E.tickwidth,tickcolor:E.tickcolor,ticklabelstep:E.ticklabelstep,showticklabels:E.showticklabels,labelalias:E.labelalias,showtickprefix:E.showtickprefix,tickprefix:E.tickprefix,showticksuffix:E.showticksuffix,ticksuffix:E.ticksuffix,showexponent:E.showexponent,exponentformat:E.exponentformat,minexponent:E.minexponent,separatethousands:E.separatethousands,tickfont:E.tickfont,tickangle:E.tickangle,tickformat:E.tickformat,tickformatstops:E.tickformatstops,hoverformat:E.hoverformat,showline:t({},E.showline,{dflt:!0}),linecolor:E.linecolor,linewidth:E.linewidth,showgrid:t({},E.showgrid,{dflt:!0}),gridcolor:E.gridcolor,gridwidth:E.gridwidth,griddash:E.griddash,layer:E.layer,min:{valType:"number",dflt:0,min:0}},r=V.exports=A({domain:d({name:"ternary"}),bgcolor:{valType:"color",dflt:u.background},sum:{valType:"number",dflt:1,min:0},aaxis:e,baxis:e,caxis:e},"plot","from-root");r.uirevision={valType:"any",editType:"none"},r.aaxis.uirevision=r.baxis.uirevision=r.caxis.uirevision={valType:"any",editType:"none"}}),Cd=Vt((K,V)=>{var u=Xr(),d=cl(),E=Hu().defaults;V.exports=function(A,t,e,r){var i=r.type,n=r.attributes,o=r.handleDefaults,a=r.partition||"x",s=t._subplots[i],f=s.length,v=f&&s[0].replace(/\d+$/,""),g,m;function w(S,k){return u.coerce(g,m,n,S,k)}for(var l=0;l{var u=Pi(),d=cl(),E=Xr(),A=Cd(),t=Ad(),e=Md(),r=wm(),i=u0(),n=Zg(),o=z2(),a=["aaxis","baxis","caxis"];V.exports=function(v,g,m){A(v,g,m,{type:"ternary",attributes:o,handleDefaults:s,font:g.font,paper_bgcolor:g.paper_bgcolor})};function s(v,g,m,w){var l=m("bgcolor"),x=m("sum");w.bgColor=u.combine(l,w.paper_bgcolor);for(var y,S,k,M=0;M=x&&(T.min=0,c.min=0,h.min=0,v.aaxis&&delete v.aaxis.min,v.baxis&&delete v.baxis.min,v.caxis&&delete v.caxis.min)}function f(v,g,m,w){var l=o[g._name];function x(b,_){return E.coerce(v,g,l,b,_)}x("uirevision",w.uirevision),g.type="linear";var y=x("color"),S=y!==l.color.dflt?y:m.font.color,k=g._name,M=k.charAt(0).toUpperCase(),T="Component "+M,c=x("title.text",T);g._hovertitle=c===T?c:M,E.coerceFont(x,"title.font",m.font,{overrideDflt:{size:E.bigFont(m.font.size),color:S}}),x("min"),i(v,g,x,"linear"),e(v,g,x,"linear"),t(v,g,x,"linear",{noAutotickangles:!0,noTicklabelshift:!0,noTicklabelstandoff:!0}),r(v,g,x,{outerTicks:!0});var h=x("showticklabels");h&&(E.coerceFont(x,"tickfont",m.font,{overrideDflt:{color:S}}),x("tickangle"),x("tickformat")),n(v,g,x,{dfltColor:y,bgColor:m.bgColor,blend:60,showLine:!0,showGrid:!0,noZeroLine:!0,attributes:l}),x("hoverformat"),x("layer")}}),vA=Vt(K=>{var V=mA(),u=Pf().getSubplotCalcData,d=Xr().counterRegex,E="ternary";K.name=E;var A=K.attr="subplot";K.idRoot=E,K.idRegex=K.attrRegex=d(E);var t=K.attributes={};t[A]={valType:"subplotid",dflt:"ternary",editType:"calc"},K.layoutAttributes=z2(),K.supplyLayoutDefaults=gA(),K.plot=function(e){for(var r=e._fullLayout,i=e.calcdata,n=r._subplots[E],o=0;o{V.exports={attributes:E2(),supplyDefaults:uA(),colorbar:Zf(),formatLabels:cA(),calc:fA(),plot:hA(),style:gh().style,styleOnSelect:gh().styleOnSelect,hoverPoints:pA(),selectPoints:Cm(),eventData:dA(),moduleType:"trace",name:"scatterternary",basePlotModule:vA(),categories:["ternary","symbols","showLegend","scatter-like"],meta:{}}}),xA=Vt((K,V)=>{V.exports=yA()}),L2=Vt((K,V)=>{var u=$g(),d=So().extendFlat,E=hc().axisHoverFormat;V.exports={y:u.y,x:u.x,x0:u.x0,y0:u.y0,xhoverformat:E("x"),yhoverformat:E("y"),name:d({},u.name,{}),orientation:d({},u.orientation,{}),bandwidth:{valType:"number",min:0,editType:"calc"},scalegroup:{valType:"string",dflt:"",editType:"calc"},scalemode:{valType:"enumerated",values:["width","count"],dflt:"width",editType:"calc"},spanmode:{valType:"enumerated",values:["soft","hard","manual"],dflt:"soft",editType:"calc"},span:{valType:"info_array",items:[{valType:"any",editType:"calc"},{valType:"any",editType:"calc"}],editType:"calc"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,dflt:2,editType:"style"},editType:"plot"},fillcolor:u.fillcolor,points:d({},u.boxpoints,{}),jitter:d({},u.jitter,{}),pointpos:d({},u.pointpos,{}),width:d({},u.width,{}),marker:u.marker,text:u.text,hovertext:u.hovertext,hovertemplate:u.hovertemplate,hovertemplatefallback:u.hovertemplatefallback,quartilemethod:u.quartilemethod,box:{visible:{valType:"boolean",dflt:!1,editType:"plot"},width:{valType:"number",min:0,max:1,dflt:.25,editType:"plot"},fillcolor:{valType:"color",editType:"style"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"plot"},meanline:{visible:{valType:"boolean",dflt:!1,editType:"plot"},color:{valType:"color",editType:"style"},width:{valType:"number",min:0,editType:"style"},editType:"plot"},side:{valType:"enumerated",values:["both","positive","negative"],dflt:"both",editType:"calc"},offsetgroup:u.offsetgroup,alignmentgroup:u.alignmentgroup,selected:u.selected,unselected:u.unselected,hoveron:{valType:"flaglist",flags:["violins","points","kde"],dflt:"violins+points+kde",extras:["all"],editType:"style"},zorder:u.zorder}}),C2=Vt((K,V)=>{var u=Jg(),d=Xr().extendFlat;V.exports={violinmode:d({},u.boxmode,{}),violingap:d({},u.boxgap,{}),violingroupgap:d({},u.boxgroupgap,{})}}),_A=Vt((K,V)=>{var u=Xr(),d=Pi(),E=Qg(),A=L2();V.exports=function(t,e,r,i){function n(c,h){return u.coerce(t,e,A,c,h)}function o(c,h){return u.coerce2(t,e,A,c,h)}if(E.handleSampleDefaults(t,e,n,i),e.visible!==!1){n("bandwidth"),n("side");var a=n("width");a||(n("scalegroup",e.name),n("scalemode"));var s=n("span"),f;Array.isArray(s)&&(f="manual"),n("spanmode",f);var v=n("line.color",(t.marker||{}).color||r),g=n("line.width"),m=n("fillcolor",d.addOpacity(e.line.color,.5));E.handlePointsDefaults(t,e,n,{prefix:""});var w=o("box.width"),l=o("box.fillcolor",m),x=o("box.line.color",v),y=o("box.line.width",g),S=n("box.visible",!!(w||l||x||y));S||(e.box={visible:!1});var k=o("meanline.color",v),M=o("meanline.width",g),T=n("meanline.visible",!!(k||M));T||(e.meanline={visible:!1}),n("quartilemethod"),n("zorder")}}}),bA=Vt((K,V)=>{var u=Xr(),d=C2(),E=m1();V.exports=function(A,t,e){function r(i,n){return u.coerce(A,t,d,i,n)}E._supply(A,t,e,r,"violin")}}),R1=Vt(K=>{var V=Xr(),u={gaussian:function(d){return 1/Math.sqrt(2*Math.PI)*Math.exp(-.5*d*d)}};K.makeKDE=function(d,E,A){var t=A.length,e=u.gaussian,r=d.bandwidth,i=1/(t*r);return function(n){for(var o=0,a=0;a{var u=Xr(),d=yo(),E=r2(),A=R1(),t=ks().BADNUM;V.exports=function(n,o){var a=E(n,o);if(a[0].t.empty)return a;for(var s=n._fullLayout,f=d.getFromId(n,o[o.orientation==="h"?"xaxis":"yaxis"]),v=1/0,g=-1/0,m=0,w=0,l=0;l{var u=g1().setPositionOffset,d=["v","h"];V.exports=function(E,A){for(var t=E.calcdata,e=A.xaxis,r=A.yaxis,i=0;i{var u=Ni(),d=Xr(),E=Eo(),A=v1(),t=jb(),e=R1();V.exports=function(r,i,n,o){var a=r._context.staticPlot,s=r._fullLayout,f=i.xaxis,v=i.yaxis;function g(m,w){var l=t(m,{xaxis:f,yaxis:v,trace:w,connectGaps:!0,baseTolerance:.75,shape:"spline",simplify:!0,linearized:!0});return E.smoothopen(l[0],1)}d.makeTraceGroups(o,n,"trace violins").each(function(m){var w=u.select(this),l=m[0],x=l.t,y=l.trace;if(y.visible!==!0||x.empty){w.remove();return}var S=x.bPos,k=x.bdPos,M=i[x.valLetter+"axis"],T=i[x.posLetter+"axis"],c=y.side==="both",h=c||y.side==="positive",b=c||y.side==="negative",_=w.selectAll("path.violin").data(d.identity);_.enter().append("path").style("vector-effect",a?"none":"non-scaling-stroke").attr("class","violin"),_.exit().remove(),_.each(function(j){var N=u.select(this),G=j.density,rt=G.length,ct=T.c2l(j.pos+S,!0),st=T.l2p(ct),et;if(y.width)et=x.maxKDE/k;else{var Z=s._violinScaleGroupStats[y.scalegroup];et=y.scalemode==="count"?Z.maxKDE/k*(Z.maxCount/j.pts.length):Z.maxKDE/k}var ot,X,Q,ut,J,q,it;if(h){for(q=new Array(rt),ut=0;ut{var u=Ni(),d=Pi(),E=gh().stylePoints;V.exports=function(A){var t=u.select(A).selectAll("g.trace.violins");t.style("opacity",function(e){return e[0].trace.opacity}),t.each(function(e){var r=e[0].trace,i=u.select(this),n=r.box||{},o=n.line||{},a=r.meanline||{},s=a.width;i.selectAll("path.violin").style("stroke-width",r.line.width+"px").call(d.stroke,r.line.color).call(d.fill,r.fillcolor),i.selectAll("path.box").style("stroke-width",o.width+"px").call(d.stroke,o.color).call(d.fill,n.fillcolor);var f={"stroke-width":s+"px","stroke-dasharray":2*s+"px,"+s+"px"};i.selectAll("path.mean").style(f).call(d.stroke,a.color),i.selectAll("path.meanline").style(f).call(d.stroke,a.color),E(i,r,A)})}}),MA=Vt((K,V)=>{var u=Pi(),d=Xr(),E=yo(),A=n2(),t=R1();V.exports=function(e,r,i,n,o){o||(o={});var a=o.hoverLayer,s=e.cd,f=s[0].trace,v=f.hoveron,g=v.indexOf("violins")!==-1,m=v.indexOf("kde")!==-1,w=[],l,x;if(g||m){var y=A.hoverOnBoxes(e,r,i,n);if(m&&y.length>0){var S=e.xa,k=e.ya,M,T,c,h,b;f.orientation==="h"?(b=r,M="y",c=k,T="x",h=S):(b=i,M="x",c=S,T="y",h=k);var _=s[e.index];if(b>=_.span[0]&&b<=_.span[1]){var P=d.extendFlat({},e),z=h.c2p(b,!0),D=t.getKdeValue(_,f,b),B=t.getPositionOnKdePath(_,f,z),R=c._offset,I=c._length;P[M+"0"]=B[0],P[M+"1"]=B[1],P[T+"0"]=P[T+"1"]=z,P[T+"Label"]=T+": "+E.hoverLabelText(h,b,f[T+"hoverformat"])+", "+s[0].t.labels.kde+" "+D.toFixed(3);for(var F=0,j=0;j{V.exports={attributes:L2(),layoutAttributes:C2(),supplyDefaults:_A(),crossTraceDefaults:Qg().crossTraceDefaults,supplyLayoutDefaults:bA(),calc:wA(),crossTraceCalc:TA(),plot:kA(),style:AA(),styleOnSelect:gh().styleOnSelect,hoverPoints:MA(),selectPoints:a2(),moduleType:"trace",name:"violin",basePlotModule:Yc(),categories:["cartesian","svg","symbols","oriented","box-violin","showLegend","violinLayout","zoomScale"],meta:{}}}),EA=Vt((K,V)=>{V.exports=SA()}),zA=Vt((K,V)=>{V.exports={eventDataKeys:["percentInitial","percentPrevious","percentTotal"]}}),I2=Vt((K,V)=>{var u=xp(),d=dc().line,E=kl(),A=hc().axisHoverFormat,{hovertemplateAttrs:t,texttemplateAttrs:e,templatefallbackAttrs:r}=yl(),i=zA(),n=So().extendFlat,o=Pi();V.exports={x:u.x,x0:u.x0,dx:u.dx,y:u.y,y0:u.y0,dy:u.dy,xperiod:u.xperiod,yperiod:u.yperiod,xperiod0:u.xperiod0,yperiod0:u.yperiod0,xperiodalignment:u.xperiodalignment,yperiodalignment:u.yperiodalignment,xhoverformat:A("x"),yhoverformat:A("y"),hovertext:u.hovertext,hovertemplate:t({},{keys:i.eventDataKeys}),hovertemplatefallback:r(),hoverinfo:n({},E.hoverinfo,{flags:["name","x","y","text","percent initial","percent previous","percent total"]}),textinfo:{valType:"flaglist",flags:["label","text","percent initial","percent previous","percent total","value"],extras:["none"],editType:"plot",arrayOk:!1},texttemplate:e({editType:"plot"},{keys:i.eventDataKeys.concat(["label","value"])}),texttemplatefallback:r({editType:"plot"}),text:u.text,textposition:u.textposition,insidetextanchor:n({},u.insidetextanchor,{dflt:"middle"}),textangle:n({},u.textangle,{dflt:0}),textfont:u.textfont,insidetextfont:u.insidetextfont,outsidetextfont:u.outsidetextfont,constraintext:u.constraintext,cliponaxis:u.cliponaxis,orientation:n({},u.orientation,{}),offset:n({},u.offset,{arrayOk:!1}),width:n({},u.width,{arrayOk:!1}),marker:a(),connector:{fillcolor:{valType:"color",editType:"style"},line:{color:n({},d.color,{dflt:o.defaultLine}),width:n({},d.width,{dflt:0,editType:"plot"}),dash:d.dash,editType:"style"},visible:{valType:"boolean",dflt:!0,editType:"plot"},editType:"plot"},offsetgroup:u.offsetgroup,alignmentgroup:u.alignmentgroup,zorder:u.zorder};function a(){var s=n({},u.marker);return delete s.pattern,delete s.cornerradius,s}}),P2=Vt((K,V)=>{V.exports={funnelmode:{valType:"enumerated",values:["stack","group","overlay"],dflt:"stack",editType:"calc"},funnelgap:{valType:"number",min:0,max:1,editType:"calc"},funnelgroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}}),O2=Vt((K,V)=>{var u=Xr(),d=p0(),E=Ch().handleText,A=Mm(),t=Qh(),e=I2(),r=Pi();function i(a,s,f,v){function g(k,M){return u.coerce(a,s,e,k,M)}var m=A(a,s,v,g);if(!m){s.visible=!1;return}t(a,s,v,g),g("xhoverformat"),g("yhoverformat"),g("orientation",s.y&&!s.x?"v":"h"),g("offset"),g("width");var w=g("text");g("hovertext"),g("hovertemplate"),g("hovertemplatefallback");var l=g("textposition");E(a,s,v,g,l,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!0,moduleHasCliponaxis:!0,moduleHasTextangle:!0,moduleHasInsideanchor:!0}),s.textposition!=="none"&&!s.texttemplate&&g("textinfo",u.isArrayOrTypedArray(w)?"text+value":"value");var x=g("marker.color",f);g("marker.line.color",r.defaultLine),g("marker.line.width");var y=g("connector.visible");if(y){g("connector.fillcolor",n(x));var S=g("connector.line.width");S&&(g("connector.line.color"),g("connector.line.dash"))}g("zorder")}function n(a){var s=u.isArrayOrTypedArray(a)?"#000":a;return r.addOpacity(s,.5*r.opacity(s))}function o(a,s){var f,v;function g(w){return u.coerce(v._input,v,e,w)}for(var m=0;m{var u=Xr(),d=P2();V.exports=function(E,A,t){var e=!1;function r(o,a){return u.coerce(E,A,d,o,a)}for(var i=0;i{var u=Xr();V.exports=function(d,E){for(var A=0;A{var u=yo(),d=ep(),E=CA(),A=jh(),t=ks().BADNUM;V.exports=function(r,i){var n=u.getFromId(r,i.xaxis||"x"),o=u.getFromId(r,i.yaxis||"y"),a,s,f,v,g,m,w,l;i.orientation==="h"?(a=n.makeCalcdata(i,"x"),f=o.makeCalcdata(i,"y"),v=d(i,o,"y",f),g=!!i.yperiodalignment,m="y"):(a=o.makeCalcdata(i,"y"),f=n.makeCalcdata(i,"x"),v=d(i,n,"x",f),g=!!i.xperiodalignment,m="x"),s=v.vals;var x=Math.min(s.length,a.length),y=new Array(x);for(i._base=[],w=0;w{var u=d0().setGroupPositions;V.exports=function(d,E){var A=d._fullLayout,t=d._fullData,e=d.calcdata,r=E.xaxis,i=E.yaxis,n=[],o=[],a=[],s,f;for(f=0;f{var u=Ni(),d=Xr(),E=Eo(),A=ks().BADNUM,t=g0(),e=sh().clearMinTextSize;V.exports=function(o,a,s,f){var v=o._fullLayout;e("funnel",v),r(o,a,s,f),i(o,a,s,f),t.plot(o,a,s,f,{mode:v.funnelmode,norm:v.funnelmode,gap:v.funnelgap,groupgap:v.funnelgroupgap})};function r(o,a,s,f){var v=a.xaxis,g=a.yaxis;d.makeTraceGroups(f,s,"trace bars").each(function(m){var w=u.select(this),l=m[0].trace,x=d.ensureSingle(w,"g","regions");if(!l.connector||!l.connector.visible){x.remove();return}var y=l.orientation==="h",S=x.selectAll("g.region").data(d.identity);S.enter().append("g").classed("region",!0),S.exit().remove();var k=S.size();S.each(function(M,T){if(!(T!==k-1&&!M.cNext)){var c=n(M,v,g,y),h=c[0],b=c[1],_="";h[0]!==A&&b[0]!==A&&h[1]!==A&&b[1]!==A&&h[2]!==A&&b[2]!==A&&h[3]!==A&&b[3]!==A&&(y?_+="M"+h[0]+","+b[1]+"L"+h[2]+","+b[2]+"H"+h[3]+"L"+h[1]+","+b[1]+"Z":_+="M"+h[1]+","+b[1]+"L"+h[2]+","+b[3]+"V"+b[2]+"L"+h[1]+","+b[0]+"Z"),_===""&&(_="M0,0Z"),d.ensureSingle(u.select(this),"path").attr("d",_).call(E.setClipUrl,a.layerClipId,o)}})})}function i(o,a,s,f){var v=a.xaxis,g=a.yaxis;d.makeTraceGroups(f,s,"trace bars").each(function(m){var w=u.select(this),l=m[0].trace,x=d.ensureSingle(w,"g","lines");if(!l.connector||!l.connector.visible||!l.connector.line.width){x.remove();return}var y=l.orientation==="h",S=x.selectAll("g.line").data(d.identity);S.enter().append("g").classed("line",!0),S.exit().remove();var k=S.size();S.each(function(M,T){if(!(T!==k-1&&!M.cNext)){var c=n(M,v,g,y),h=c[0],b=c[1],_="";h[3]!==void 0&&b[3]!==void 0&&(y?(_+="M"+h[0]+","+b[1]+"L"+h[2]+","+b[2],_+="M"+h[1]+","+b[1]+"L"+h[3]+","+b[2]):(_+="M"+h[1]+","+b[1]+"L"+h[2]+","+b[3],_+="M"+h[1]+","+b[0]+"L"+h[2]+","+b[2])),_===""&&(_="M0,0Z"),d.ensureSingle(u.select(this),"path").attr("d",_).call(E.setClipUrl,a.layerClipId,o)}})})}function n(o,a,s,f){var v=[],g=[],m=f?a:s,w=f?s:a;return v[0]=m.c2p(o.s0,!0),g[0]=w.c2p(o.p0,!0),v[1]=m.c2p(o.s1,!0),g[1]=w.c2p(o.p1,!0),v[2]=m.c2p(o.nextS0,!0),g[2]=w.c2p(o.nextP0,!0),v[3]=m.c2p(o.nextS1,!0),g[3]=w.c2p(o.nextP1,!0),f?[v,g]:[g,v]}}),DA=Vt((K,V)=>{var u=Ni(),d=Eo(),E=Pi(),A=bd().DESELECTDIM,t=Vh(),e=sh().resizeText,r=t.styleTextPoints;function i(n,o,a){var s=a||u.select(n).selectAll('g[class^="funnellayer"]').selectAll("g.trace");e(n,s,"funnel"),s.style("opacity",function(f){return f[0].trace.opacity}),s.each(function(f){var v=u.select(this),g=f[0].trace;v.selectAll(".point > path").each(function(m){if(!m.isBlank){var w=g.marker;u.select(this).call(E.fill,m.mc||w.color).call(E.stroke,m.mlc||w.line.color).call(d.dashLine,w.line.dash,m.mlw||w.line.width).style("opacity",g.selectedpoints&&!m.selected?A:1)}}),r(v,g,n),v.selectAll(".regions").each(function(){u.select(this).selectAll("path").style("stroke-width",0).call(E.fill,g.connector.fillcolor)}),v.selectAll(".lines").each(function(){var m=g.connector.line;d.lineGroupStyle(u.select(this).selectAll("path"),m.width,m.color,m.dash)})})}V.exports={style:i}}),FA=Vt((K,V)=>{var u=Pi().opacity,d=Im().hoverOnBars,E=Xr().formatPercent;V.exports=function(t,e,r,i,n){var o=d(t,e,r,i,n);if(o){var a=o.cd,s=a[0].trace,f=s.orientation==="h",v=o.index,g=a[v],m=f?"x":"y";o[m+"LabelVal"]=g.s,o.percentInitial=g.begR,o.percentInitialLabel=E(g.begR,1),o.percentPrevious=g.difR,o.percentPreviousLabel=E(g.difR,1),o.percentTotal=g.sumR,o.percentTotalLabel=E(g.sumR,1);var w=g.hi||s.hoverinfo,l=[];if(w&&w!=="none"&&w!=="skip"){var x=w==="all",y=w.split("+"),S=function(k){return x||y.indexOf(k)!==-1};S("percent initial")&&l.push(o.percentInitialLabel+" of initial"),S("percent previous")&&l.push(o.percentPreviousLabel+" of previous"),S("percent total")&&l.push(o.percentTotalLabel+" of total")}return o.extraText=l.join("
          "),o.color=A(s,g),[o]}};function A(t,e){var r=t.marker,i=e.mc||r.color,n=e.mlc||r.line.color,o=e.mlw||r.line.width;if(u(i))return i;if(u(n)&&o)return n}}),BA=Vt((K,V)=>{V.exports=function(u,d){return u.x="xVal"in d?d.xVal:d.x,u.y="yVal"in d?d.yVal:d.y,"percentInitial"in d&&(u.percentInitial=d.percentInitial),"percentPrevious"in d&&(u.percentPrevious=d.percentPrevious),"percentTotal"in d&&(u.percentTotal=d.percentTotal),d.xa&&(u.xaxis=d.xa),d.ya&&(u.yaxis=d.ya),u}}),RA=Vt((K,V)=>{V.exports={attributes:I2(),layoutAttributes:P2(),supplyDefaults:O2().supplyDefaults,crossTraceDefaults:O2().crossTraceDefaults,supplyLayoutDefaults:LA(),calc:IA(),crossTraceCalc:PA(),plot:OA(),style:DA().style,hoverPoints:FA(),eventData:BA(),selectPoints:Pm(),moduleType:"trace",name:"funnel",basePlotModule:Yc(),categories:["bar-like","cartesian","svg","oriented","showLegend","zoomScale"],meta:{}}}),NA=Vt((K,V)=>{V.exports=RA()}),jA=Vt((K,V)=>{V.exports={eventDataKeys:["initial","delta","final"]}}),D2=Vt((K,V)=>{var u=xp(),d=dc().line,E=kl(),A=hc().axisHoverFormat,{hovertemplateAttrs:t,texttemplateAttrs:e,templatefallbackAttrs:r}=yl(),i=jA(),n=So().extendFlat,o=Pi();function a(s){return{marker:{color:n({},u.marker.color,{arrayOk:!1,editType:"style"}),line:{color:n({},u.marker.line.color,{arrayOk:!1,editType:"style"}),width:n({},u.marker.line.width,{arrayOk:!1,editType:"style"}),editType:"style"},editType:"style"},editType:"style"}}V.exports={measure:{valType:"data_array",dflt:[],editType:"calc"},base:{valType:"number",dflt:null,arrayOk:!1,editType:"calc"},x:u.x,x0:u.x0,dx:u.dx,y:u.y,y0:u.y0,dy:u.dy,xperiod:u.xperiod,yperiod:u.yperiod,xperiod0:u.xperiod0,yperiod0:u.yperiod0,xperiodalignment:u.xperiodalignment,yperiodalignment:u.yperiodalignment,xhoverformat:A("x"),yhoverformat:A("y"),hovertext:u.hovertext,hovertemplate:t({},{keys:i.eventDataKeys}),hovertemplatefallback:r(),hoverinfo:n({},E.hoverinfo,{flags:["name","x","y","text","initial","delta","final"]}),textinfo:{valType:"flaglist",flags:["label","text","initial","delta","final"],extras:["none"],editType:"plot",arrayOk:!1},texttemplate:e({editType:"plot"},{keys:i.eventDataKeys.concat(["label"])}),texttemplatefallback:r({editType:"plot"}),text:u.text,textposition:u.textposition,insidetextanchor:u.insidetextanchor,textangle:u.textangle,textfont:u.textfont,insidetextfont:u.insidetextfont,outsidetextfont:u.outsidetextfont,constraintext:u.constraintext,cliponaxis:u.cliponaxis,orientation:u.orientation,offset:u.offset,width:u.width,increasing:a(),decreasing:a(),totals:a(),connector:{line:{color:n({},d.color,{dflt:o.defaultLine}),width:n({},d.width,{editType:"plot"}),dash:d.dash,editType:"plot"},mode:{valType:"enumerated",values:["spanning","between"],dflt:"between",editType:"plot"},visible:{valType:"boolean",dflt:!0,editType:"plot"},editType:"plot"},offsetgroup:u.offsetgroup,alignmentgroup:u.alignmentgroup,zorder:u.zorder}}),F2=Vt((K,V)=>{V.exports={waterfallmode:{valType:"enumerated",values:["group","overlay"],dflt:"group",editType:"calc"},waterfallgap:{valType:"number",min:0,max:1,editType:"calc"},waterfallgroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}}),Dm=Vt((K,V)=>{V.exports={INCREASING:{COLOR:"#3D9970",SYMBOL:"▲"},DECREASING:{COLOR:"#FF4136",SYMBOL:"▼"}}}),B2=Vt((K,V)=>{var u=Xr(),d=p0(),E=Ch().handleText,A=Mm(),t=Qh(),e=D2(),r=Pi(),i=Dm(),n=i.INCREASING.COLOR,o=i.DECREASING.COLOR,a="#4499FF";function s(g,m,w){g(m+".marker.color",w),g(m+".marker.line.color",r.defaultLine),g(m+".marker.line.width")}function f(g,m,w,l){function x(T,c){return u.coerce(g,m,e,T,c)}var y=A(g,m,l,x);if(!y){m.visible=!1;return}t(g,m,l,x),x("xhoverformat"),x("yhoverformat"),x("measure"),x("orientation",m.x&&!m.y?"h":"v"),x("base"),x("offset"),x("width"),x("text"),x("hovertext"),x("hovertemplate"),x("hovertemplatefallback");var S=x("textposition");E(g,m,l,x,S,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!0,moduleHasCliponaxis:!0,moduleHasTextangle:!0,moduleHasInsideanchor:!0}),m.textposition!=="none"&&(x("texttemplate"),x("texttemplatefallback"),m.texttemplate||x("textinfo")),s(x,"increasing",n),s(x,"decreasing",o),s(x,"totals",a);var k=x("connector.visible");if(k){x("connector.mode");var M=x("connector.line.width");M&&(x("connector.line.color"),x("connector.line.dash"))}x("zorder")}function v(g,m){var w,l;function x(S){return u.coerce(l._input,l,e,S)}if(m.waterfallmode==="group")for(var y=0;y{var u=Xr(),d=F2();V.exports=function(E,A,t){var e=!1;function r(o,a){return u.coerce(E,A,d,o,a)}for(var i=0;i{var u=yo(),d=ep(),E=Xr().mergeArray,A=jh(),t=ks().BADNUM;function e(i){return i==="a"||i==="absolute"}function r(i){return i==="t"||i==="total"}V.exports=function(i,n){var o=u.getFromId(i,n.xaxis||"x"),a=u.getFromId(i,n.yaxis||"y"),s,f,v,g,m,w;n.orientation==="h"?(s=o.makeCalcdata(n,"x"),v=a.makeCalcdata(n,"y"),g=d(n,a,"y",v),m=!!n.yperiodalignment,w="y"):(s=a.makeCalcdata(n,"y"),v=o.makeCalcdata(n,"x"),g=d(n,o,"x",v),m=!!n.xperiodalignment,w="x"),f=g.vals;for(var l=Math.min(f.length,s.length),x=new Array(l),y=0,S,k=!1,M=0;M{var u=d0().setGroupPositions;V.exports=function(d,E){var A=d._fullLayout,t=d._fullData,e=d.calcdata,r=E.xaxis,i=E.yaxis,n=[],o=[],a=[],s,f;for(f=0;f{var u=Ni(),d=Xr(),E=Eo(),A=ks().BADNUM,t=g0(),e=sh().clearMinTextSize;V.exports=function(n,o,a,s){var f=n._fullLayout;e("waterfall",f),t.plot(n,o,a,s,{mode:f.waterfallmode,norm:f.waterfallmode,gap:f.waterfallgap,groupgap:f.waterfallgroupgap}),r(n,o,a,s)};function r(n,o,a,s){var f=o.xaxis,v=o.yaxis;d.makeTraceGroups(s,a,"trace bars").each(function(g){var m=u.select(this),w=g[0].trace,l=d.ensureSingle(m,"g","lines");if(!w.connector||!w.connector.visible){l.remove();return}var x=w.orientation==="h",y=w.connector.mode,S=l.selectAll("g.line").data(d.identity);S.enter().append("g").classed("line",!0),S.exit().remove();var k=S.size();S.each(function(M,T){if(!(T!==k-1&&!M.cNext)){var c=i(M,f,v,x),h=c[0],b=c[1],_="";h[0]!==A&&b[0]!==A&&h[1]!==A&&b[1]!==A&&(y==="spanning"&&!M.isSum&&T>0&&(x?_+="M"+h[0]+","+b[1]+"V"+b[0]:_+="M"+h[1]+","+b[0]+"H"+h[0]),y!=="between"&&(M.isSum||T{var u=Ni(),d=Eo(),E=Pi(),A=bd().DESELECTDIM,t=Vh(),e=sh().resizeText,r=t.styleTextPoints;function i(n,o,a){var s=a||u.select(n).selectAll('g[class^="waterfalllayer"]').selectAll("g.trace");e(n,s,"waterfall"),s.style("opacity",function(f){return f[0].trace.opacity}),s.each(function(f){var v=u.select(this),g=f[0].trace;v.selectAll(".point > path").each(function(m){if(!m.isBlank){var w=g[m.dir].marker;u.select(this).call(E.fill,w.color).call(E.stroke,w.line.color).call(d.dashLine,w.line.dash,w.line.width).style("opacity",g.selectedpoints&&!m.selected?A:1)}}),r(v,g,n),v.selectAll(".lines").each(function(){var m=g.connector.line;d.lineGroupStyle(u.select(this).selectAll("path"),m.width,m.color,m.dash)})})}V.exports={style:i}}),GA=Vt((K,V)=>{var u=yo().hoverLabelText,d=Pi().opacity,E=Im().hoverOnBars,A=Dm(),t={increasing:A.INCREASING.SYMBOL,decreasing:A.DECREASING.SYMBOL};V.exports=function(r,i,n,o,a){var s=E(r,i,n,o,a);if(!s)return;var f=s.cd,v=f[0].trace,g=v.orientation==="h",m=g?"x":"y",w=g?r.xa:r.ya;function l(_){return u(w,_,v[m+"hoverformat"])}var x=s.index,y=f[x],S=y.isSum?y.b+y.s:y.rawS;s.initial=y.b+y.s-S,s.delta=S,s.final=s.initial+s.delta;var k=l(Math.abs(s.delta));s.deltaLabel=S<0?"("+k+")":k,s.finalLabel=l(s.final),s.initialLabel=l(s.initial);var M=y.hi||v.hoverinfo,T=[];if(M&&M!=="none"&&M!=="skip"){var c=M==="all",h=M.split("+"),b=function(_){return c||h.indexOf(_)!==-1};y.isSum||(b("final")&&(g?!b("x"):!b("y"))&&T.push(s.finalLabel),b("delta")&&(S<0?T.push(s.deltaLabel+" "+t.decreasing):T.push(s.deltaLabel+" "+t.increasing)),b("initial")&&T.push("Initial: "+s.initialLabel))}return T.length&&(s.extraText=T.join("
          ")),s.color=e(v,y),[s]};function e(r,i){var n=r[i.dir].marker,o=n.color,a=n.line.color,s=n.line.width;if(d(o))return o;if(d(a)&&s)return a}}),ZA=Vt((K,V)=>{V.exports=function(u,d){return u.x="xVal"in d?d.xVal:d.x,u.y="yVal"in d?d.yVal:d.y,"initial"in d&&(u.initial=d.initial),"delta"in d&&(u.delta=d.delta),"final"in d&&(u.final=d.final),d.xa&&(u.xaxis=d.xa),d.ya&&(u.yaxis=d.ya),u}}),KA=Vt((K,V)=>{V.exports={attributes:D2(),layoutAttributes:F2(),supplyDefaults:B2().supplyDefaults,crossTraceDefaults:B2().crossTraceDefaults,supplyLayoutDefaults:UA(),calc:VA(),crossTraceCalc:HA(),plot:qA(),style:WA().style,hoverPoints:GA(),eventData:ZA(),selectPoints:Pm(),moduleType:"trace",name:"waterfall",basePlotModule:Yc(),categories:["bar-like","cartesian","svg","oriented","showLegend","zoomScale"],meta:{}}}),YA=Vt((K,V)=>{V.exports=KA()}),Fm=Vt((K,V)=>{V.exports={colormodel:{rgb:{min:[0,0,0],max:[255,255,255],fmt:function(u){return u.slice(0,3)},suffix:["","",""]},rgba:{min:[0,0,0,0],max:[255,255,255,1],fmt:function(u){return u.slice(0,4)},suffix:["","","",""]},rgba256:{colormodel:"rgba",zminDflt:[0,0,0,0],zmaxDflt:[255,255,255,255],min:[0,0,0,0],max:[255,255,255,1],fmt:function(u){return u.slice(0,4)},suffix:["","","",""]},hsl:{min:[0,0,0],max:[360,100,100],fmt:function(u){var d=u.slice(0,3);return d[1]=d[1]+"%",d[2]=d[2]+"%",d},suffix:["°","%","%"]},hsla:{min:[0,0,0,0],max:[360,100,100,1],fmt:function(u){var d=u.slice(0,4);return d[1]=d[1]+"%",d[2]=d[2]+"%",d},suffix:["°","%","%",""]}}}}),R2=Vt((K,V)=>{var u=kl(),d=dc().zorder,{hovertemplateAttrs:E,templatefallbackAttrs:A}=yl(),t=So().extendFlat,e=Fm().colormodel,r=["rgb","rgba","rgba256","hsl","hsla"],i=[],n=[];for(a=0;a{var u=Xr(),d=R2(),E=Fm(),A=Bp().IMAGE_URL_PREFIX;V.exports=function(t,e){function r(o,a){return u.coerce(t,e,d,o,a)}r("source"),e.source&&!e.source.match(A)&&delete e.source,e._hasSource=!!e.source;var i=r("z");if(e._hasZ=!(i===void 0||!i.length||!i[0]||!i[0].length),!e._hasZ&&!e._hasSource){e.visible=!1;return}r("x0"),r("y0"),r("dx"),r("dy");var n;e._hasZ?(r("colormodel","rgb"),n=E.colormodel[e.colormodel],r("zmin",n.zminDflt||n.min),r("zmax",n.zmaxDflt||n.max)):e._hasSource&&(e.colormodel="rgba256",n=E.colormodel[e.colormodel],e.zmin=n.zminDflt,e.zmax=n.zmaxDflt),r("zsmooth"),r("text"),r("hovertext"),r("hovertemplate"),r("hovertemplatefallback"),e._length=null,r("zorder")}}),Rp=Vt((K,V)=>{typeof Object.create=="function"?V.exports=function(u,d){d&&(u.super_=d,u.prototype=Object.create(d.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}))}:V.exports=function(u,d){if(d){u.super_=d;var E=function(){};E.prototype=d.prototype,u.prototype=new E,u.prototype.constructor=u}}}),N2=Vt((K,V)=>{V.exports=l0().EventEmitter}),$A=Vt(K=>{K.byteLength=r,K.toByteArray=n,K.fromByteArray=s;var V=[],u=[],d=typeof Uint8Array<"u"?Uint8Array:Array,E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(A=0,t=E.length;A0)throw new Error("Invalid string. Length must be a multiple of 4");var g=f.indexOf("=");g===-1&&(g=v);var m=g===v?0:4-g%4;return[g,m]}function r(f){var v=e(f),g=v[0],m=v[1];return(g+m)*3/4-m}function i(f,v,g){return(v+g)*3/4-g}function n(f){var v,g=e(f),m=g[0],w=g[1],l=new d(i(f,m,w)),x=0,y=w>0?m-4:m,S;for(S=0;S>16&255,l[x++]=v>>8&255,l[x++]=v&255;return w===2&&(v=u[f.charCodeAt(S)]<<2|u[f.charCodeAt(S+1)]>>4,l[x++]=v&255),w===1&&(v=u[f.charCodeAt(S)]<<10|u[f.charCodeAt(S+1)]<<4|u[f.charCodeAt(S+2)]>>2,l[x++]=v>>8&255,l[x++]=v&255),l}function o(f){return V[f>>18&63]+V[f>>12&63]+V[f>>6&63]+V[f&63]}function a(f,v,g){for(var m,w=[],l=v;ly?y:x+l));return m===1?(v=f[g-1],w.push(V[v>>2]+V[v<<4&63]+"==")):m===2&&(v=(f[g-2]<<8)+f[g-1],w.push(V[v>>10]+V[v>>4&63]+V[v<<2&63]+"=")),w.join("")}}),JA=Vt(K=>{K.read=function(V,u,d,E,A){var t,e,r=A*8-E-1,i=(1<>1,o=-7,a=d?A-1:0,s=d?-1:1,f=V[u+a];for(a+=s,t=f&(1<<-o)-1,f>>=-o,o+=r;o>0;t=t*256+V[u+a],a+=s,o-=8);for(e=t&(1<<-o)-1,t>>=-o,o+=E;o>0;e=e*256+V[u+a],a+=s,o-=8);if(t===0)t=1-n;else{if(t===i)return e?NaN:(f?-1:1)*(1/0);e=e+Math.pow(2,E),t=t-n}return(f?-1:1)*e*Math.pow(2,t-E)},K.write=function(V,u,d,E,A,t){var e,r,i,n=t*8-A-1,o=(1<>1,s=A===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=E?0:t-1,v=E?1:-1,g=u<0||u===0&&1/u<0?1:0;for(u=Math.abs(u),isNaN(u)||u===1/0?(r=isNaN(u)?1:0,e=o):(e=Math.floor(Math.log(u)/Math.LN2),u*(i=Math.pow(2,-e))<1&&(e--,i*=2),e+a>=1?u+=s/i:u+=s*Math.pow(2,1-a),u*i>=2&&(e++,i/=2),e+a>=o?(r=0,e=o):e+a>=1?(r=(u*i-1)*Math.pow(2,A),e=e+a):(r=u*Math.pow(2,a-1)*Math.pow(2,A),e=0));A>=8;V[d+f]=r&255,f+=v,r/=256,A-=8);for(e=e<0;V[d+f]=e&255,f+=v,e/=256,n-=8);V[d+f-v]|=g*128}}),v0=Vt(K=>{var V=$A(),u=JA(),d=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;K.Buffer=e,K.SlowBuffer=w,K.INSPECT_MAX_BYTES=50;var E=2147483647;K.kMaxLength=E,e.TYPED_ARRAY_SUPPORT=A(),!e.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function A(){try{let mt=new Uint8Array(1),bt={foo:function(){return 42}};return Object.setPrototypeOf(bt,Uint8Array.prototype),Object.setPrototypeOf(mt,bt),mt.foo()===42}catch{return!1}}Object.defineProperty(e.prototype,"parent",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.buffer}}),Object.defineProperty(e.prototype,"offset",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.byteOffset}});function t(mt){if(mt>E)throw new RangeError('The value "'+mt+'" is invalid for option "size"');let bt=new Uint8Array(mt);return Object.setPrototypeOf(bt,e.prototype),bt}function e(mt,bt,vt){if(typeof mt=="number"){if(typeof bt=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return o(mt)}return r(mt,bt,vt)}e.poolSize=8192;function r(mt,bt,vt){if(typeof mt=="string")return a(mt,bt);if(ArrayBuffer.isView(mt))return f(mt);if(mt==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof mt);if(Nt(mt,ArrayBuffer)||mt&&Nt(mt.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Nt(mt,SharedArrayBuffer)||mt&&Nt(mt.buffer,SharedArrayBuffer)))return v(mt,bt,vt);if(typeof mt=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let Ut=mt.valueOf&&mt.valueOf();if(Ut!=null&&Ut!==mt)return e.from(Ut,bt,vt);let re=g(mt);if(re)return re;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof mt[Symbol.toPrimitive]=="function")return e.from(mt[Symbol.toPrimitive]("string"),bt,vt);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof mt)}e.from=function(mt,bt,vt){return r(mt,bt,vt)},Object.setPrototypeOf(e.prototype,Uint8Array.prototype),Object.setPrototypeOf(e,Uint8Array);function i(mt){if(typeof mt!="number")throw new TypeError('"size" argument must be of type number');if(mt<0)throw new RangeError('The value "'+mt+'" is invalid for option "size"')}function n(mt,bt,vt){return i(mt),mt<=0?t(mt):bt!==void 0?typeof vt=="string"?t(mt).fill(bt,vt):t(mt).fill(bt):t(mt)}e.alloc=function(mt,bt,vt){return n(mt,bt,vt)};function o(mt){return i(mt),t(mt<0?0:m(mt)|0)}e.allocUnsafe=function(mt){return o(mt)},e.allocUnsafeSlow=function(mt){return o(mt)};function a(mt,bt){if((typeof bt!="string"||bt==="")&&(bt="utf8"),!e.isEncoding(bt))throw new TypeError("Unknown encoding: "+bt);let vt=l(mt,bt)|0,Ut=t(vt),re=Ut.write(mt,bt);return re!==vt&&(Ut=Ut.slice(0,re)),Ut}function s(mt){let bt=mt.length<0?0:m(mt.length)|0,vt=t(bt);for(let Ut=0;Ut=E)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+E.toString(16)+" bytes");return mt|0}function w(mt){return+mt!=mt&&(mt=0),e.alloc(+mt)}e.isBuffer=function(mt){return mt!=null&&mt._isBuffer===!0&&mt!==e.prototype},e.compare=function(mt,bt){if(Nt(mt,Uint8Array)&&(mt=e.from(mt,mt.offset,mt.byteLength)),Nt(bt,Uint8Array)&&(bt=e.from(bt,bt.offset,bt.byteLength)),!e.isBuffer(mt)||!e.isBuffer(bt))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(mt===bt)return 0;let vt=mt.length,Ut=bt.length;for(let re=0,Kt=Math.min(vt,Ut);reUt.length?(e.isBuffer(Kt)||(Kt=e.from(Kt)),Kt.copy(Ut,re)):Uint8Array.prototype.set.call(Ut,Kt,re);else if(e.isBuffer(Kt))Kt.copy(Ut,re);else throw new TypeError('"list" argument must be an Array of Buffers');re+=Kt.length}return Ut};function l(mt,bt){if(e.isBuffer(mt))return mt.length;if(ArrayBuffer.isView(mt)||Nt(mt,ArrayBuffer))return mt.byteLength;if(typeof mt!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof mt);let vt=mt.length,Ut=arguments.length>2&&arguments[2]===!0;if(!Ut&&vt===0)return 0;let re=!1;for(;;)switch(bt){case"ascii":case"latin1":case"binary":return vt;case"utf8":case"utf-8":return dt(mt).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vt*2;case"hex":return vt>>>1;case"base64":return Ct(mt).length;default:if(re)return Ut?-1:dt(mt).length;bt=(""+bt).toLowerCase(),re=!0}}e.byteLength=l;function x(mt,bt,vt){let Ut=!1;if((bt===void 0||bt<0)&&(bt=0),bt>this.length||((vt===void 0||vt>this.length)&&(vt=this.length),vt<=0)||(vt>>>=0,bt>>>=0,vt<=bt))return"";for(mt||(mt="utf8");;)switch(mt){case"hex":return I(this,bt,vt);case"utf8":case"utf-8":return P(this,bt,vt);case"ascii":return B(this,bt,vt);case"latin1":case"binary":return R(this,bt,vt);case"base64":return _(this,bt,vt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,bt,vt);default:if(Ut)throw new TypeError("Unknown encoding: "+mt);mt=(mt+"").toLowerCase(),Ut=!0}}e.prototype._isBuffer=!0;function y(mt,bt,vt){let Ut=mt[bt];mt[bt]=mt[vt],mt[vt]=Ut}e.prototype.swap16=function(){let mt=this.length;if(mt%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let bt=0;btbt&&(mt+=" ... "),""},d&&(e.prototype[d]=e.prototype.inspect),e.prototype.compare=function(mt,bt,vt,Ut,re){if(Nt(mt,Uint8Array)&&(mt=e.from(mt,mt.offset,mt.byteLength)),!e.isBuffer(mt))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof mt);if(bt===void 0&&(bt=0),vt===void 0&&(vt=mt?mt.length:0),Ut===void 0&&(Ut=0),re===void 0&&(re=this.length),bt<0||vt>mt.length||Ut<0||re>this.length)throw new RangeError("out of range index");if(Ut>=re&&bt>=vt)return 0;if(Ut>=re)return-1;if(bt>=vt)return 1;if(bt>>>=0,vt>>>=0,Ut>>>=0,re>>>=0,this===mt)return 0;let Kt=re-Ut,ue=vt-bt,Me=Math.min(Kt,ue),Ce=this.slice(Ut,re),We=mt.slice(bt,vt);for(let qe=0;qe2147483647?vt=2147483647:vt<-2147483648&&(vt=-2147483648),vt=+vt,te(vt)&&(vt=re?0:mt.length-1),vt<0&&(vt=mt.length+vt),vt>=mt.length){if(re)return-1;vt=mt.length-1}else if(vt<0)if(re)vt=0;else return-1;if(typeof bt=="string"&&(bt=e.from(bt,Ut)),e.isBuffer(bt))return bt.length===0?-1:k(mt,bt,vt,Ut,re);if(typeof bt=="number")return bt=bt&255,typeof Uint8Array.prototype.indexOf=="function"?re?Uint8Array.prototype.indexOf.call(mt,bt,vt):Uint8Array.prototype.lastIndexOf.call(mt,bt,vt):k(mt,[bt],vt,Ut,re);throw new TypeError("val must be string, number or Buffer")}function k(mt,bt,vt,Ut,re){let Kt=1,ue=mt.length,Me=bt.length;if(Ut!==void 0&&(Ut=String(Ut).toLowerCase(),Ut==="ucs2"||Ut==="ucs-2"||Ut==="utf16le"||Ut==="utf-16le")){if(mt.length<2||bt.length<2)return-1;Kt=2,ue/=2,Me/=2,vt/=2}function Ce(qe,vr){return Kt===1?qe[vr]:qe.readUInt16BE(vr*Kt)}let We;if(re){let qe=-1;for(We=vt;Weue&&(vt=ue-Me),We=vt;We>=0;We--){let qe=!0;for(let vr=0;vrre&&(Ut=re)):Ut=re;let Kt=bt.length;Ut>Kt/2&&(Ut=Kt/2);let ue;for(ue=0;ue>>0,isFinite(vt)?(vt=vt>>>0,Ut===void 0&&(Ut="utf8")):(Ut=vt,vt=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let re=this.length-bt;if((vt===void 0||vt>re)&&(vt=re),mt.length>0&&(vt<0||bt<0)||bt>this.length)throw new RangeError("Attempt to write outside buffer bounds");Ut||(Ut="utf8");let Kt=!1;for(;;)switch(Ut){case"hex":return M(this,mt,bt,vt);case"utf8":case"utf-8":return T(this,mt,bt,vt);case"ascii":case"latin1":case"binary":return c(this,mt,bt,vt);case"base64":return h(this,mt,bt,vt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,mt,bt,vt);default:if(Kt)throw new TypeError("Unknown encoding: "+Ut);Ut=(""+Ut).toLowerCase(),Kt=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function _(mt,bt,vt){return bt===0&&vt===mt.length?V.fromByteArray(mt):V.fromByteArray(mt.slice(bt,vt))}function P(mt,bt,vt){vt=Math.min(mt.length,vt);let Ut=[],re=bt;for(;re239?4:Kt>223?3:Kt>191?2:1;if(re+Me<=vt){let Ce,We,qe,vr;switch(Me){case 1:Kt<128&&(ue=Kt);break;case 2:Ce=mt[re+1],(Ce&192)===128&&(vr=(Kt&31)<<6|Ce&63,vr>127&&(ue=vr));break;case 3:Ce=mt[re+1],We=mt[re+2],(Ce&192)===128&&(We&192)===128&&(vr=(Kt&15)<<12|(Ce&63)<<6|We&63,vr>2047&&(vr<55296||vr>57343)&&(ue=vr));break;case 4:Ce=mt[re+1],We=mt[re+2],qe=mt[re+3],(Ce&192)===128&&(We&192)===128&&(qe&192)===128&&(vr=(Kt&15)<<18|(Ce&63)<<12|(We&63)<<6|qe&63,vr>65535&&vr<1114112&&(ue=vr))}}ue===null?(ue=65533,Me=1):ue>65535&&(ue-=65536,Ut.push(ue>>>10&1023|55296),ue=56320|ue&1023),Ut.push(ue),re+=Me}return D(Ut)}var z=4096;function D(mt){let bt=mt.length;if(bt<=z)return String.fromCharCode.apply(String,mt);let vt="",Ut=0;for(;UtUt)&&(vt=Ut);let re="";for(let Kt=bt;Ktvt&&(mt=vt),bt<0?(bt+=vt,bt<0&&(bt=0)):bt>vt&&(bt=vt),btvt)throw new RangeError("Trying to access beyond buffer length")}e.prototype.readUintLE=e.prototype.readUIntLE=function(mt,bt,vt){mt=mt>>>0,bt=bt>>>0,vt||j(mt,bt,this.length);let Ut=this[mt],re=1,Kt=0;for(;++Kt>>0,bt=bt>>>0,vt||j(mt,bt,this.length);let Ut=this[mt+--bt],re=1;for(;bt>0&&(re*=256);)Ut+=this[mt+--bt]*re;return Ut},e.prototype.readUint8=e.prototype.readUInt8=function(mt,bt){return mt=mt>>>0,bt||j(mt,1,this.length),this[mt]},e.prototype.readUint16LE=e.prototype.readUInt16LE=function(mt,bt){return mt=mt>>>0,bt||j(mt,2,this.length),this[mt]|this[mt+1]<<8},e.prototype.readUint16BE=e.prototype.readUInt16BE=function(mt,bt){return mt=mt>>>0,bt||j(mt,2,this.length),this[mt]<<8|this[mt+1]},e.prototype.readUint32LE=e.prototype.readUInt32LE=function(mt,bt){return mt=mt>>>0,bt||j(mt,4,this.length),(this[mt]|this[mt+1]<<8|this[mt+2]<<16)+this[mt+3]*16777216},e.prototype.readUint32BE=e.prototype.readUInt32BE=function(mt,bt){return mt=mt>>>0,bt||j(mt,4,this.length),this[mt]*16777216+(this[mt+1]<<16|this[mt+2]<<8|this[mt+3])},e.prototype.readBigUInt64LE=ee(function(mt){mt=mt>>>0,J(mt,"offset");let bt=this[mt],vt=this[mt+7];(bt===void 0||vt===void 0)&&q(mt,this.length-8);let Ut=bt+this[++mt]*2**8+this[++mt]*2**16+this[++mt]*2**24,re=this[++mt]+this[++mt]*2**8+this[++mt]*2**16+vt*2**24;return BigInt(Ut)+(BigInt(re)<>>0,J(mt,"offset");let bt=this[mt],vt=this[mt+7];(bt===void 0||vt===void 0)&&q(mt,this.length-8);let Ut=bt*2**24+this[++mt]*2**16+this[++mt]*2**8+this[++mt],re=this[++mt]*2**24+this[++mt]*2**16+this[++mt]*2**8+vt;return(BigInt(Ut)<>>0,bt=bt>>>0,vt||j(mt,bt,this.length);let Ut=this[mt],re=1,Kt=0;for(;++Kt=re&&(Ut-=Math.pow(2,8*bt)),Ut},e.prototype.readIntBE=function(mt,bt,vt){mt=mt>>>0,bt=bt>>>0,vt||j(mt,bt,this.length);let Ut=bt,re=1,Kt=this[mt+--Ut];for(;Ut>0&&(re*=256);)Kt+=this[mt+--Ut]*re;return re*=128,Kt>=re&&(Kt-=Math.pow(2,8*bt)),Kt},e.prototype.readInt8=function(mt,bt){return mt=mt>>>0,bt||j(mt,1,this.length),this[mt]&128?(255-this[mt]+1)*-1:this[mt]},e.prototype.readInt16LE=function(mt,bt){mt=mt>>>0,bt||j(mt,2,this.length);let vt=this[mt]|this[mt+1]<<8;return vt&32768?vt|4294901760:vt},e.prototype.readInt16BE=function(mt,bt){mt=mt>>>0,bt||j(mt,2,this.length);let vt=this[mt+1]|this[mt]<<8;return vt&32768?vt|4294901760:vt},e.prototype.readInt32LE=function(mt,bt){return mt=mt>>>0,bt||j(mt,4,this.length),this[mt]|this[mt+1]<<8|this[mt+2]<<16|this[mt+3]<<24},e.prototype.readInt32BE=function(mt,bt){return mt=mt>>>0,bt||j(mt,4,this.length),this[mt]<<24|this[mt+1]<<16|this[mt+2]<<8|this[mt+3]},e.prototype.readBigInt64LE=ee(function(mt){mt=mt>>>0,J(mt,"offset");let bt=this[mt],vt=this[mt+7];(bt===void 0||vt===void 0)&&q(mt,this.length-8);let Ut=this[mt+4]+this[mt+5]*2**8+this[mt+6]*2**16+(vt<<24);return(BigInt(Ut)<>>0,J(mt,"offset");let bt=this[mt],vt=this[mt+7];(bt===void 0||vt===void 0)&&q(mt,this.length-8);let Ut=(bt<<24)+this[++mt]*2**16+this[++mt]*2**8+this[++mt];return(BigInt(Ut)<>>0,bt||j(mt,4,this.length),u.read(this,mt,!0,23,4)},e.prototype.readFloatBE=function(mt,bt){return mt=mt>>>0,bt||j(mt,4,this.length),u.read(this,mt,!1,23,4)},e.prototype.readDoubleLE=function(mt,bt){return mt=mt>>>0,bt||j(mt,8,this.length),u.read(this,mt,!0,52,8)},e.prototype.readDoubleBE=function(mt,bt){return mt=mt>>>0,bt||j(mt,8,this.length),u.read(this,mt,!1,52,8)};function N(mt,bt,vt,Ut,re,Kt){if(!e.isBuffer(mt))throw new TypeError('"buffer" argument must be a Buffer instance');if(bt>re||btmt.length)throw new RangeError("Index out of range")}e.prototype.writeUintLE=e.prototype.writeUIntLE=function(mt,bt,vt,Ut){if(mt=+mt,bt=bt>>>0,vt=vt>>>0,!Ut){let ue=Math.pow(2,8*vt)-1;N(this,mt,bt,vt,ue,0)}let re=1,Kt=0;for(this[bt]=mt&255;++Kt>>0,vt=vt>>>0,!Ut){let ue=Math.pow(2,8*vt)-1;N(this,mt,bt,vt,ue,0)}let re=vt-1,Kt=1;for(this[bt+re]=mt&255;--re>=0&&(Kt*=256);)this[bt+re]=mt/Kt&255;return bt+vt},e.prototype.writeUint8=e.prototype.writeUInt8=function(mt,bt,vt){return mt=+mt,bt=bt>>>0,vt||N(this,mt,bt,1,255,0),this[bt]=mt&255,bt+1},e.prototype.writeUint16LE=e.prototype.writeUInt16LE=function(mt,bt,vt){return mt=+mt,bt=bt>>>0,vt||N(this,mt,bt,2,65535,0),this[bt]=mt&255,this[bt+1]=mt>>>8,bt+2},e.prototype.writeUint16BE=e.prototype.writeUInt16BE=function(mt,bt,vt){return mt=+mt,bt=bt>>>0,vt||N(this,mt,bt,2,65535,0),this[bt]=mt>>>8,this[bt+1]=mt&255,bt+2},e.prototype.writeUint32LE=e.prototype.writeUInt32LE=function(mt,bt,vt){return mt=+mt,bt=bt>>>0,vt||N(this,mt,bt,4,4294967295,0),this[bt+3]=mt>>>24,this[bt+2]=mt>>>16,this[bt+1]=mt>>>8,this[bt]=mt&255,bt+4},e.prototype.writeUint32BE=e.prototype.writeUInt32BE=function(mt,bt,vt){return mt=+mt,bt=bt>>>0,vt||N(this,mt,bt,4,4294967295,0),this[bt]=mt>>>24,this[bt+1]=mt>>>16,this[bt+2]=mt>>>8,this[bt+3]=mt&255,bt+4};function G(mt,bt,vt,Ut,re){ut(bt,Ut,re,mt,vt,7);let Kt=Number(bt&BigInt(4294967295));mt[vt++]=Kt,Kt=Kt>>8,mt[vt++]=Kt,Kt=Kt>>8,mt[vt++]=Kt,Kt=Kt>>8,mt[vt++]=Kt;let ue=Number(bt>>BigInt(32)&BigInt(4294967295));return mt[vt++]=ue,ue=ue>>8,mt[vt++]=ue,ue=ue>>8,mt[vt++]=ue,ue=ue>>8,mt[vt++]=ue,vt}function rt(mt,bt,vt,Ut,re){ut(bt,Ut,re,mt,vt,7);let Kt=Number(bt&BigInt(4294967295));mt[vt+7]=Kt,Kt=Kt>>8,mt[vt+6]=Kt,Kt=Kt>>8,mt[vt+5]=Kt,Kt=Kt>>8,mt[vt+4]=Kt;let ue=Number(bt>>BigInt(32)&BigInt(4294967295));return mt[vt+3]=ue,ue=ue>>8,mt[vt+2]=ue,ue=ue>>8,mt[vt+1]=ue,ue=ue>>8,mt[vt]=ue,vt+8}e.prototype.writeBigUInt64LE=ee(function(mt,bt=0){return G(this,mt,bt,BigInt(0),BigInt("0xffffffffffffffff"))}),e.prototype.writeBigUInt64BE=ee(function(mt,bt=0){return rt(this,mt,bt,BigInt(0),BigInt("0xffffffffffffffff"))}),e.prototype.writeIntLE=function(mt,bt,vt,Ut){if(mt=+mt,bt=bt>>>0,!Ut){let Me=Math.pow(2,8*vt-1);N(this,mt,bt,vt,Me-1,-Me)}let re=0,Kt=1,ue=0;for(this[bt]=mt&255;++re>0)-ue&255;return bt+vt},e.prototype.writeIntBE=function(mt,bt,vt,Ut){if(mt=+mt,bt=bt>>>0,!Ut){let Me=Math.pow(2,8*vt-1);N(this,mt,bt,vt,Me-1,-Me)}let re=vt-1,Kt=1,ue=0;for(this[bt+re]=mt&255;--re>=0&&(Kt*=256);)mt<0&&ue===0&&this[bt+re+1]!==0&&(ue=1),this[bt+re]=(mt/Kt>>0)-ue&255;return bt+vt},e.prototype.writeInt8=function(mt,bt,vt){return mt=+mt,bt=bt>>>0,vt||N(this,mt,bt,1,127,-128),mt<0&&(mt=255+mt+1),this[bt]=mt&255,bt+1},e.prototype.writeInt16LE=function(mt,bt,vt){return mt=+mt,bt=bt>>>0,vt||N(this,mt,bt,2,32767,-32768),this[bt]=mt&255,this[bt+1]=mt>>>8,bt+2},e.prototype.writeInt16BE=function(mt,bt,vt){return mt=+mt,bt=bt>>>0,vt||N(this,mt,bt,2,32767,-32768),this[bt]=mt>>>8,this[bt+1]=mt&255,bt+2},e.prototype.writeInt32LE=function(mt,bt,vt){return mt=+mt,bt=bt>>>0,vt||N(this,mt,bt,4,2147483647,-2147483648),this[bt]=mt&255,this[bt+1]=mt>>>8,this[bt+2]=mt>>>16,this[bt+3]=mt>>>24,bt+4},e.prototype.writeInt32BE=function(mt,bt,vt){return mt=+mt,bt=bt>>>0,vt||N(this,mt,bt,4,2147483647,-2147483648),mt<0&&(mt=4294967295+mt+1),this[bt]=mt>>>24,this[bt+1]=mt>>>16,this[bt+2]=mt>>>8,this[bt+3]=mt&255,bt+4},e.prototype.writeBigInt64LE=ee(function(mt,bt=0){return G(this,mt,bt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),e.prototype.writeBigInt64BE=ee(function(mt,bt=0){return rt(this,mt,bt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ct(mt,bt,vt,Ut,re,Kt){if(vt+Ut>mt.length)throw new RangeError("Index out of range");if(vt<0)throw new RangeError("Index out of range")}function st(mt,bt,vt,Ut,re){return bt=+bt,vt=vt>>>0,re||ct(mt,bt,vt,4),u.write(mt,bt,vt,Ut,23,4),vt+4}e.prototype.writeFloatLE=function(mt,bt,vt){return st(this,mt,bt,!0,vt)},e.prototype.writeFloatBE=function(mt,bt,vt){return st(this,mt,bt,!1,vt)};function et(mt,bt,vt,Ut,re){return bt=+bt,vt=vt>>>0,re||ct(mt,bt,vt,8),u.write(mt,bt,vt,Ut,52,8),vt+8}e.prototype.writeDoubleLE=function(mt,bt,vt){return et(this,mt,bt,!0,vt)},e.prototype.writeDoubleBE=function(mt,bt,vt){return et(this,mt,bt,!1,vt)},e.prototype.copy=function(mt,bt,vt,Ut){if(!e.isBuffer(mt))throw new TypeError("argument should be a Buffer");if(vt||(vt=0),!Ut&&Ut!==0&&(Ut=this.length),bt>=mt.length&&(bt=mt.length),bt||(bt=0),Ut>0&&Ut=this.length)throw new RangeError("Index out of range");if(Ut<0)throw new RangeError("sourceEnd out of bounds");Ut>this.length&&(Ut=this.length),mt.length-bt>>0,vt=vt===void 0?this.length:vt>>>0,mt||(mt=0);let re;if(typeof mt=="number")for(re=bt;re2**32?re=X(String(vt)):typeof vt=="bigint"&&(re=String(vt),(vt>BigInt(2)**BigInt(32)||vt<-(BigInt(2)**BigInt(32)))&&(re=X(re)),re+="n"),Ut+=` It must be ${bt}. Received ${re}`,Ut},RangeError);function X(mt){let bt="",vt=mt.length,Ut=mt[0]==="-"?1:0;for(;vt>=Ut+4;vt-=3)bt=`_${mt.slice(vt-3,vt)}${bt}`;return`${mt.slice(0,vt)}${bt}`}function Q(mt,bt,vt){J(bt,"offset"),(mt[bt]===void 0||mt[bt+vt]===void 0)&&q(bt,mt.length-(vt+1))}function ut(mt,bt,vt,Ut,re,Kt){if(mt>vt||mt= 0${ue} and < 2${ue} ** ${(Kt+1)*8}${ue}`:Me=`>= -(2${ue} ** ${(Kt+1)*8-1}${ue}) and < 2 ** ${(Kt+1)*8-1}${ue}`,new Z.ERR_OUT_OF_RANGE("value",Me,mt)}Q(Ut,re,Kt)}function J(mt,bt){if(typeof mt!="number")throw new Z.ERR_INVALID_ARG_TYPE(bt,"number",mt)}function q(mt,bt,vt){throw Math.floor(mt)!==mt?(J(mt,vt),new Z.ERR_OUT_OF_RANGE("offset","an integer",mt)):bt<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${bt}`,mt)}var it=/[^+/0-9A-Za-z-_]/g;function nt(mt){if(mt=mt.split("=")[0],mt=mt.trim().replace(it,""),mt.length<2)return"";for(;mt.length%4!==0;)mt=mt+"=";return mt}function dt(mt,bt){bt=bt||1/0;let vt,Ut=mt.length,re=null,Kt=[];for(let ue=0;ue55295&&vt<57344){if(!re){if(vt>56319){(bt-=3)>-1&&Kt.push(239,191,189);continue}else if(ue+1===Ut){(bt-=3)>-1&&Kt.push(239,191,189);continue}re=vt;continue}if(vt<56320){(bt-=3)>-1&&Kt.push(239,191,189),re=vt;continue}vt=(re-55296<<10|vt-56320)+65536}else re&&(bt-=3)>-1&&Kt.push(239,191,189);if(re=null,vt<128){if((bt-=1)<0)break;Kt.push(vt)}else if(vt<2048){if((bt-=2)<0)break;Kt.push(vt>>6|192,vt&63|128)}else if(vt<65536){if((bt-=3)<0)break;Kt.push(vt>>12|224,vt>>6&63|128,vt&63|128)}else if(vt<1114112){if((bt-=4)<0)break;Kt.push(vt>>18|240,vt>>12&63|128,vt>>6&63|128,vt&63|128)}else throw new Error("Invalid code point")}return Kt}function Tt(mt){let bt=[];for(let vt=0;vt>8,re=vt%256,Kt.push(re),Kt.push(Ut);return Kt}function Ct(mt){return V.toByteArray(nt(mt))}function It(mt,bt,vt,Ut){let re;for(re=0;re=bt.length||re>=mt.length);++re)bt[re+vt]=mt[re];return re}function Nt(mt,bt){return mt instanceof bt||mt!=null&&mt.constructor!=null&&mt.constructor.name!=null&&mt.constructor.name===bt.name}function te(mt){return mt!==mt}var Jt=(function(){let mt="0123456789abcdef",bt=new Array(256);for(let vt=0;vt<16;++vt){let Ut=vt*16;for(let re=0;re<16;++re)bt[Ut+re]=mt[vt]+mt[re]}return bt})();function ee(mt){return typeof BigInt>"u"?Zt:mt}function Zt(){throw new Error("BigInt not supported")}}),N1=Vt((K,V)=>{V.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var u={},d=Symbol("test"),E=Object(d);if(typeof d=="string"||Object.prototype.toString.call(d)!=="[object Symbol]"||Object.prototype.toString.call(E)!=="[object Symbol]")return!1;var A=42;u[d]=A;for(var t in u)return!1;if(typeof Object.keys=="function"&&Object.keys(u).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(u).length!==0)return!1;var e=Object.getOwnPropertySymbols(u);if(e.length!==1||e[0]!==d||!Object.prototype.propertyIsEnumerable.call(u,d))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var r=Object.getOwnPropertyDescriptor(u,d);if(r.value!==A||r.enumerable!==!0)return!1}return!0}}),av=Vt((K,V)=>{var u=N1();V.exports=function(){return u()&&!!Symbol.toStringTag}}),j2=Vt((K,V)=>{V.exports=Object}),QA=Vt((K,V)=>{V.exports=Error}),tM=Vt((K,V)=>{V.exports=EvalError}),eM=Vt((K,V)=>{V.exports=RangeError}),rM=Vt((K,V)=>{V.exports=ReferenceError}),U2=Vt((K,V)=>{V.exports=SyntaxError}),Bm=Vt((K,V)=>{V.exports=TypeError}),nM=Vt((K,V)=>{V.exports=URIError}),aM=Vt((K,V)=>{V.exports=Math.abs}),iM=Vt((K,V)=>{V.exports=Math.floor}),oM=Vt((K,V)=>{V.exports=Math.max}),sM=Vt((K,V)=>{V.exports=Math.min}),lM=Vt((K,V)=>{V.exports=Math.pow}),uM=Vt((K,V)=>{V.exports=Math.round}),cM=Vt((K,V)=>{V.exports=Number.isNaN||function(u){return u!==u}}),fM=Vt((K,V)=>{var u=cM();V.exports=function(d){return u(d)||d===0?d:d<0?-1:1}}),hM=Vt((K,V)=>{V.exports=Object.getOwnPropertyDescriptor}),y0=Vt((K,V)=>{var u=hM();if(u)try{u([],"length")}catch{u=null}V.exports=u}),iv=Vt((K,V)=>{var u=Object.defineProperty||!1;if(u)try{u({},"a",{value:1})}catch{u=!1}V.exports=u}),pM=Vt((K,V)=>{var u=typeof Symbol<"u"&&Symbol,d=N1();V.exports=function(){return typeof u!="function"||typeof Symbol!="function"||typeof u("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:d()}}),V2=Vt((K,V)=>{V.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),H2=Vt((K,V)=>{var u=j2();V.exports=u.getPrototypeOf||null}),dM=Vt((K,V)=>{var u="Function.prototype.bind called on incompatible ",d=Object.prototype.toString,E=Math.max,A="[object Function]",t=function(i,n){for(var o=[],a=0;a{var u=dM();V.exports=Function.prototype.bind||u}),j1=Vt((K,V)=>{V.exports=Function.prototype.call}),q2=Vt((K,V)=>{V.exports=Function.prototype.apply}),mM=Vt((K,V)=>{V.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),gM=Vt((K,V)=>{var u=Rm(),d=q2(),E=j1(),A=mM();V.exports=A||u.call(E,d)}),vM=Vt((K,V)=>{var u=Rm(),d=Bm(),E=j1(),A=gM();V.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new d("a function is required");return A(u,E,t)}}),yM=Vt((K,V)=>{var u=vM(),d=y0(),E;try{E=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var A=!!E&&d&&d(Object.prototype,"__proto__"),t=Object,e=t.getPrototypeOf;V.exports=A&&typeof A.get=="function"?u([A.get]):typeof e=="function"?function(r){return e(r==null?r:t(r))}:!1}),xM=Vt((K,V)=>{var u=V2(),d=H2(),E=yM();V.exports=u?function(A){return u(A)}:d?function(A){if(!A||typeof A!="object"&&typeof A!="function")throw new TypeError("getProto: not an object");return d(A)}:E?function(A){return E(A)}:null}),_M=Vt((K,V)=>{var u=Function.prototype.call,d=Object.prototype.hasOwnProperty,E=Rm();V.exports=E.call(u,d)}),U1=Vt((K,V)=>{var u,d=j2(),E=QA(),A=tM(),t=eM(),e=rM(),r=U2(),i=Bm(),n=nM(),o=aM(),a=iM(),s=oM(),f=sM(),v=lM(),g=uM(),m=fM(),w=Function,l=function(Q){try{return w('"use strict"; return ('+Q+").constructor;")()}catch{}},x=y0(),y=iv(),S=function(){throw new i},k=x?(function(){try{return arguments.callee,S}catch{try{return x(arguments,"callee").get}catch{return S}}})():S,M=pM()(),T=xM(),c=H2(),h=V2(),b=q2(),_=j1(),P={},z=typeof Uint8Array>"u"||!T?u:T(Uint8Array),D={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?u:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?u:ArrayBuffer,"%ArrayIteratorPrototype%":M&&T?T([][Symbol.iterator]()):u,"%AsyncFromSyncIteratorPrototype%":u,"%AsyncFunction%":P,"%AsyncGenerator%":P,"%AsyncGeneratorFunction%":P,"%AsyncIteratorPrototype%":P,"%Atomics%":typeof Atomics>"u"?u:Atomics,"%BigInt%":typeof BigInt>"u"?u:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?u:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?u:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?u:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":E,"%eval%":eval,"%EvalError%":A,"%Float16Array%":typeof Float16Array>"u"?u:Float16Array,"%Float32Array%":typeof Float32Array>"u"?u:Float32Array,"%Float64Array%":typeof Float64Array>"u"?u:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?u:FinalizationRegistry,"%Function%":w,"%GeneratorFunction%":P,"%Int8Array%":typeof Int8Array>"u"?u:Int8Array,"%Int16Array%":typeof Int16Array>"u"?u:Int16Array,"%Int32Array%":typeof Int32Array>"u"?u:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":M&&T?T(T([][Symbol.iterator]())):u,"%JSON%":typeof JSON=="object"?JSON:u,"%Map%":typeof Map>"u"?u:Map,"%MapIteratorPrototype%":typeof Map>"u"||!M||!T?u:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":d,"%Object.getOwnPropertyDescriptor%":x,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?u:Promise,"%Proxy%":typeof Proxy>"u"?u:Proxy,"%RangeError%":t,"%ReferenceError%":e,"%Reflect%":typeof Reflect>"u"?u:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?u:Set,"%SetIteratorPrototype%":typeof Set>"u"||!M||!T?u:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?u:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":M&&T?T(""[Symbol.iterator]()):u,"%Symbol%":M?Symbol:u,"%SyntaxError%":r,"%ThrowTypeError%":k,"%TypedArray%":z,"%TypeError%":i,"%Uint8Array%":typeof Uint8Array>"u"?u:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?u:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?u:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?u:Uint32Array,"%URIError%":n,"%WeakMap%":typeof WeakMap>"u"?u:WeakMap,"%WeakRef%":typeof WeakRef>"u"?u:WeakRef,"%WeakSet%":typeof WeakSet>"u"?u:WeakSet,"%Function.prototype.call%":_,"%Function.prototype.apply%":b,"%Object.defineProperty%":y,"%Object.getPrototypeOf%":c,"%Math.abs%":o,"%Math.floor%":a,"%Math.max%":s,"%Math.min%":f,"%Math.pow%":v,"%Math.round%":g,"%Math.sign%":m,"%Reflect.getPrototypeOf%":h};if(T)try{null.error}catch(Q){B=T(T(Q)),D["%Error.prototype%"]=B}var B,R=function Q(ut){var J;if(ut==="%AsyncFunction%")J=l("async function () {}");else if(ut==="%GeneratorFunction%")J=l("function* () {}");else if(ut==="%AsyncGeneratorFunction%")J=l("async function* () {}");else if(ut==="%AsyncGenerator%"){var q=Q("%AsyncGeneratorFunction%");q&&(J=q.prototype)}else if(ut==="%AsyncIteratorPrototype%"){var it=Q("%AsyncGenerator%");it&&T&&(J=T(it.prototype))}return D[ut]=J,J},I={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},F=Rm(),j=_M(),N=F.call(_,Array.prototype.concat),G=F.call(b,Array.prototype.splice),rt=F.call(_,String.prototype.replace),ct=F.call(_,String.prototype.slice),st=F.call(_,RegExp.prototype.exec),et=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Z=/\\(\\)?/g,ot=function(Q){var ut=ct(Q,0,1),J=ct(Q,-1);if(ut==="%"&&J!=="%")throw new r("invalid intrinsic syntax, expected closing `%`");if(J==="%"&&ut!=="%")throw new r("invalid intrinsic syntax, expected opening `%`");var q=[];return rt(Q,et,function(it,nt,dt,Tt){q[q.length]=dt?rt(Tt,Z,"$1"):nt||it}),q},X=function(Q,ut){var J=Q,q;if(j(I,J)&&(q=I[J],J="%"+q[0]+"%"),j(D,J)){var it=D[J];if(it===P&&(it=R(J)),typeof it>"u"&&!ut)throw new i("intrinsic "+Q+" exists, but is not available. Please file an issue!");return{alias:q,name:J,value:it}}throw new r("intrinsic "+Q+" does not exist!")};V.exports=function(Q,ut){if(typeof Q!="string"||Q.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof ut!="boolean")throw new i('"allowMissing" argument must be a boolean');if(st(/^%?[^%]*%?$/,Q)===null)throw new r("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var J=ot(Q),q=J.length>0?J[0]:"",it=X("%"+q+"%",ut),nt=it.name,dt=it.value,Tt=!1,wt=it.alias;wt&&(q=wt[0],G(J,N([0,1],wt)));for(var Ct=1,It=!0;Ct=J.length){var ee=x(dt,Nt);It=!!ee,It&&"get"in ee&&!("originalValue"in ee.get)?dt=ee.get:dt=dt[Nt]}else It=j(dt,Nt),dt=dt[Nt];It&&!Tt&&(D[nt]=dt)}}return dt}}),bM=Vt((K,V)=>{var u=iv(),d=U2(),E=Bm(),A=y0();V.exports=function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new E("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new E("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new E("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new E("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new E("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new E("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,n=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,s=!!A&&A(t,e);if(u)u(t,e,{configurable:o===null&&s?s.configurable:!o,enumerable:i===null&&s?s.enumerable:!i,value:r,writable:n===null&&s?s.writable:!n});else if(a||!i&&!n&&!o)t[e]=r;else throw new d("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),W2=Vt((K,V)=>{var u=iv(),d=function(){return!!u};d.hasArrayLengthDefineBug=function(){if(!u)return null;try{return u([],"length",{value:1}).length!==1}catch{return!0}},V.exports=d}),wM=Vt((K,V)=>{var u=U1(),d=bM(),E=W2()(),A=y0(),t=Bm(),e=u("%Math.floor%");V.exports=function(r,i){if(typeof r!="function")throw new t("`fn` is not a function");if(typeof i!="number"||i<0||i>4294967295||e(i)!==i)throw new t("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],o=!0,a=!0;if("length"in r&&A){var s=A(r,"length");s&&!s.configurable&&(o=!1),s&&!s.writable&&(a=!1)}return(o||a||!n)&&(E?d(r,"length",i,!0,!0):d(r,"length",i)),r}}),ov=Vt((K,V)=>{var u=Rm(),d=U1(),E=wM(),A=Bm(),t=d("%Function.prototype.apply%"),e=d("%Function.prototype.call%"),r=d("%Reflect.apply%",!0)||u.call(e,t),i=iv(),n=d("%Math.max%");V.exports=function(a){if(typeof a!="function")throw new A("a function is required");var s=r(u,e,arguments);return E(s,1+n(0,a.length-(arguments.length-1)),!0)};var o=function(){return r(u,t,arguments)};i?i(V.exports,"apply",{value:o}):V.exports.apply=o}),Nm=Vt((K,V)=>{var u=U1(),d=ov(),E=d(u("String.prototype.indexOf"));V.exports=function(A,t){var e=u(A,!!t);return typeof e=="function"&&E(A,".prototype.")>-1?d(e):e}}),TM=Vt((K,V)=>{var u=av()(),d=Nm(),E=d("Object.prototype.toString"),A=function(r){return u&&r&&typeof r=="object"&&Symbol.toStringTag in r?!1:E(r)==="[object Arguments]"},t=function(r){return A(r)?!0:r!==null&&typeof r=="object"&&typeof r.length=="number"&&r.length>=0&&E(r)!=="[object Array]"&&E(r.callee)==="[object Function]"},e=(function(){return A(arguments)})();A.isLegacyArguments=t,V.exports=e?A:t}),kM=Vt((K,V)=>{var u=Object.prototype.toString,d=Function.prototype.toString,E=/^\s*(?:function)?\*/,A=av()(),t=Object.getPrototypeOf,e=function(){if(!A)return!1;try{return Function("return function*() {}")()}catch{}},r;V.exports=function(i){if(typeof i!="function")return!1;if(E.test(d.call(i)))return!0;if(!A){var n=u.call(i);return n==="[object GeneratorFunction]"}if(!t)return!1;if(typeof r>"u"){var o=e();r=o?t(o):!1}return t(i)===r}}),AM=Vt((K,V)=>{var u=Function.prototype.toString,d=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,E,A;if(typeof d=="function"&&typeof Object.defineProperty=="function")try{E=Object.defineProperty({},"length",{get:function(){throw A}}),A={},d(function(){throw 42},null,E)}catch(x){x!==A&&(d=null)}else d=null;var t=/^\s*class\b/,e=function(x){try{var y=u.call(x);return t.test(y)}catch{return!1}},r=function(x){try{return e(x)?!1:(u.call(x),!0)}catch{return!1}},i=Object.prototype.toString,n="[object Object]",o="[object Function]",a="[object GeneratorFunction]",s="[object HTMLAllCollection]",f="[object HTML document.all class]",v="[object HTMLCollection]",g=typeof Symbol=="function"&&!!Symbol.toStringTag,m=!(0 in[,]),w=function(){return!1};typeof document=="object"&&(l=document.all,i.call(l)===i.call(document.all)&&(w=function(x){if((m||!x)&&(typeof x>"u"||typeof x=="object"))try{var y=i.call(x);return(y===s||y===f||y===v||y===n)&&x("")==null}catch{}return!1}));var l;V.exports=d?function(x){if(w(x))return!0;if(!x||typeof x!="function"&&typeof x!="object")return!1;try{d(x,null,E)}catch(y){if(y!==A)return!1}return!e(x)&&r(x)}:function(x){if(w(x))return!0;if(!x||typeof x!="function"&&typeof x!="object")return!1;if(g)return r(x);if(e(x))return!1;var y=i.call(x);return y!==o&&y!==a&&!/^\[object HTML/.test(y)?!1:r(x)}}),G2=Vt((K,V)=>{var u=AM(),d=Object.prototype.toString,E=Object.prototype.hasOwnProperty,A=function(i,n,o){for(var a=0,s=i.length;a=3&&(a=o),d.call(i)==="[object Array]"?A(i,n,a):typeof i=="string"?t(i,n,a):e(i,n,a)};V.exports=r}),Z2=Vt((K,V)=>{var u=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],d=typeof globalThis>"u"?window:globalThis;V.exports=function(){for(var E=[],A=0;A{var u=G2(),d=Z2(),E=ov(),A=Nm(),t=y0(),e=A("Object.prototype.toString"),r=av()(),i=typeof globalThis>"u"?window:globalThis,n=d(),o=A("String.prototype.slice"),a=Object.getPrototypeOf,s=A("Array.prototype.indexOf",!0)||function(m,w){for(var l=0;l-1?w:w!=="Object"?!1:g(m)}return t?v(m):null}}),SM=Vt((K,V)=>{var u=G2(),d=Z2(),E=Nm(),A=E("Object.prototype.toString"),t=av()(),e=y0(),r=typeof globalThis>"u"?window:globalThis,i=d(),n=E("Array.prototype.indexOf",!0)||function(v,g){for(var m=0;m-1}return e?f(v):!1}}),K2=Vt(K=>{var V=TM(),u=kM(),d=MM(),E=SM();function A(wt){return wt.call.bind(wt)}var t=typeof BigInt<"u",e=typeof Symbol<"u",r=A(Object.prototype.toString),i=A(Number.prototype.valueOf),n=A(String.prototype.valueOf),o=A(Boolean.prototype.valueOf);t&&(a=A(BigInt.prototype.valueOf));var a;e&&(s=A(Symbol.prototype.valueOf));var s;function f(wt,Ct){if(typeof wt!="object")return!1;try{return Ct(wt),!0}catch{return!1}}K.isArgumentsObject=V,K.isGeneratorFunction=u,K.isTypedArray=E;function v(wt){return typeof Promise<"u"&&wt instanceof Promise||wt!==null&&typeof wt=="object"&&typeof wt.then=="function"&&typeof wt.catch=="function"}K.isPromise=v;function g(wt){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(wt):E(wt)||G(wt)}K.isArrayBufferView=g;function m(wt){return d(wt)==="Uint8Array"}K.isUint8Array=m;function w(wt){return d(wt)==="Uint8ClampedArray"}K.isUint8ClampedArray=w;function l(wt){return d(wt)==="Uint16Array"}K.isUint16Array=l;function x(wt){return d(wt)==="Uint32Array"}K.isUint32Array=x;function y(wt){return d(wt)==="Int8Array"}K.isInt8Array=y;function S(wt){return d(wt)==="Int16Array"}K.isInt16Array=S;function k(wt){return d(wt)==="Int32Array"}K.isInt32Array=k;function M(wt){return d(wt)==="Float32Array"}K.isFloat32Array=M;function T(wt){return d(wt)==="Float64Array"}K.isFloat64Array=T;function c(wt){return d(wt)==="BigInt64Array"}K.isBigInt64Array=c;function h(wt){return d(wt)==="BigUint64Array"}K.isBigUint64Array=h;function b(wt){return r(wt)==="[object Map]"}b.working=typeof Map<"u"&&b(new Map);function _(wt){return typeof Map>"u"?!1:b.working?b(wt):wt instanceof Map}K.isMap=_;function P(wt){return r(wt)==="[object Set]"}P.working=typeof Set<"u"&&P(new Set);function z(wt){return typeof Set>"u"?!1:P.working?P(wt):wt instanceof Set}K.isSet=z;function D(wt){return r(wt)==="[object WeakMap]"}D.working=typeof WeakMap<"u"&&D(new WeakMap);function B(wt){return typeof WeakMap>"u"?!1:D.working?D(wt):wt instanceof WeakMap}K.isWeakMap=B;function R(wt){return r(wt)==="[object WeakSet]"}R.working=typeof WeakSet<"u"&&R(new WeakSet);function I(wt){return R(wt)}K.isWeakSet=I;function F(wt){return r(wt)==="[object ArrayBuffer]"}F.working=typeof ArrayBuffer<"u"&&F(new ArrayBuffer);function j(wt){return typeof ArrayBuffer>"u"?!1:F.working?F(wt):wt instanceof ArrayBuffer}K.isArrayBuffer=j;function N(wt){return r(wt)==="[object DataView]"}N.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&N(new DataView(new ArrayBuffer(1),0,1));function G(wt){return typeof DataView>"u"?!1:N.working?N(wt):wt instanceof DataView}K.isDataView=G;var rt=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function ct(wt){return r(wt)==="[object SharedArrayBuffer]"}function st(wt){return typeof rt>"u"?!1:(typeof ct.working>"u"&&(ct.working=ct(new rt)),ct.working?ct(wt):wt instanceof rt)}K.isSharedArrayBuffer=st;function et(wt){return r(wt)==="[object AsyncFunction]"}K.isAsyncFunction=et;function Z(wt){return r(wt)==="[object Map Iterator]"}K.isMapIterator=Z;function ot(wt){return r(wt)==="[object Set Iterator]"}K.isSetIterator=ot;function X(wt){return r(wt)==="[object Generator]"}K.isGeneratorObject=X;function Q(wt){return r(wt)==="[object WebAssembly.Module]"}K.isWebAssemblyCompiledModule=Q;function ut(wt){return f(wt,i)}K.isNumberObject=ut;function J(wt){return f(wt,n)}K.isStringObject=J;function q(wt){return f(wt,o)}K.isBooleanObject=q;function it(wt){return t&&f(wt,a)}K.isBigIntObject=it;function nt(wt){return e&&f(wt,s)}K.isSymbolObject=nt;function dt(wt){return ut(wt)||J(wt)||q(wt)||it(wt)||nt(wt)}K.isBoxedPrimitive=dt;function Tt(wt){return typeof Uint8Array<"u"&&(j(wt)||st(wt))}K.isAnyArrayBuffer=Tt,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(wt){Object.defineProperty(K,wt,{enumerable:!1,value:function(){throw new Error(wt+" is not supported in userland")}})})}),Y2=Vt((K,V)=>{V.exports=function(u){return u&&typeof u=="object"&&typeof u.copy=="function"&&typeof u.fill=="function"&&typeof u.readUInt8=="function"}}),X2=Vt(K=>{var V=Object.getOwnPropertyDescriptors||function(N){for(var G=Object.keys(N),rt={},ct=0;ct=st)return X;switch(X){case"%s":return String(ct[rt++]);case"%d":return Number(ct[rt++]);case"%j":try{return JSON.stringify(ct[rt++])}catch{return"[Circular]"}default:return X}}),Z=ct[rt];rt"u")return function(){return K.deprecate(N,G).apply(this,arguments)};var rt=!1;function ct(){if(!rt){if(process.throwDeprecation)throw new Error(G);process.traceDeprecation?console.trace(G):console.error(G),rt=!0}return N.apply(this,arguments)}return ct};var d={},E=/^$/;A="false",A=A.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),E=new RegExp("^"+A+"$","i");var A;K.debuglog=function(N){if(N=N.toUpperCase(),!d[N])if(E.test(N)){var G=process.pid;d[N]=function(){var rt=K.format.apply(K,arguments);console.error("%s %d: %s",N,G,rt)}}else d[N]=function(){};return d[N]};function t(N,G){var rt={seen:[],stylize:r};return arguments.length>=3&&(rt.depth=arguments[2]),arguments.length>=4&&(rt.colors=arguments[3]),m(G)?rt.showHidden=G:G&&K._extend(rt,G),k(rt.showHidden)&&(rt.showHidden=!1),k(rt.depth)&&(rt.depth=2),k(rt.colors)&&(rt.colors=!1),k(rt.customInspect)&&(rt.customInspect=!0),rt.colors&&(rt.stylize=e),n(rt,N,rt.depth)}K.inspect=t,t.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},t.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function e(N,G){var rt=t.styles[G];return rt?"\x1B["+t.colors[rt][0]+"m"+N+"\x1B["+t.colors[rt][1]+"m":N}function r(N,G){return N}function i(N){var G={};return N.forEach(function(rt,ct){G[rt]=!0}),G}function n(N,G,rt){if(N.customInspect&&G&&b(G.inspect)&&G.inspect!==K.inspect&&!(G.constructor&&G.constructor.prototype===G)){var ct=G.inspect(rt,N);return y(ct)||(ct=n(N,ct,rt)),ct}var st=o(N,G);if(st)return st;var et=Object.keys(G),Z=i(et);if(N.showHidden&&(et=Object.getOwnPropertyNames(G)),h(G)&&(et.indexOf("message")>=0||et.indexOf("description")>=0))return a(G);if(et.length===0){if(b(G)){var ot=G.name?": "+G.name:"";return N.stylize("[Function"+ot+"]","special")}if(M(G))return N.stylize(RegExp.prototype.toString.call(G),"regexp");if(c(G))return N.stylize(Date.prototype.toString.call(G),"date");if(h(G))return a(G)}var X="",Q=!1,ut=["{","}"];if(g(G)&&(Q=!0,ut=["[","]"]),b(G)){var J=G.name?": "+G.name:"";X=" [Function"+J+"]"}if(M(G)&&(X=" "+RegExp.prototype.toString.call(G)),c(G)&&(X=" "+Date.prototype.toUTCString.call(G)),h(G)&&(X=" "+a(G)),et.length===0&&(!Q||G.length==0))return ut[0]+X+ut[1];if(rt<0)return M(G)?N.stylize(RegExp.prototype.toString.call(G),"regexp"):N.stylize("[Object]","special");N.seen.push(G);var q;return Q?q=s(N,G,rt,Z,et):q=et.map(function(it){return f(N,G,rt,Z,it,Q)}),N.seen.pop(),v(q,X,ut)}function o(N,G){if(k(G))return N.stylize("undefined","undefined");if(y(G)){var rt="'"+JSON.stringify(G).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return N.stylize(rt,"string")}if(x(G))return N.stylize(""+G,"number");if(m(G))return N.stylize(""+G,"boolean");if(w(G))return N.stylize("null","null")}function a(N){return"["+Error.prototype.toString.call(N)+"]"}function s(N,G,rt,ct,st){for(var et=[],Z=0,ot=G.length;Z-1&&(et?ot=ot.split(` +`).map(function(Q){return" "+Q}).join(` +`).slice(2):ot=` +`+ot.split(` +`).map(function(Q){return" "+Q}).join(` +`))):ot=N.stylize("[Circular]","special")),k(Z)){if(et&&st.match(/^\d+$/))return ot;Z=JSON.stringify(""+st),Z.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(Z=Z.slice(1,-1),Z=N.stylize(Z,"name")):(Z=Z.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),Z=N.stylize(Z,"string"))}return Z+": "+ot}function v(N,G,rt){var ct=0,st=N.reduce(function(et,Z){return ct++,Z.indexOf(` +`)>=0&&ct++,et+Z.replace(/\u001b\[\d\d?m/g,"").length+1},0);return st>60?rt[0]+(G===""?"":G+` + `)+" "+N.join(`, + `)+" "+rt[1]:rt[0]+G+" "+N.join(", ")+" "+rt[1]}K.types=K2();function g(N){return Array.isArray(N)}K.isArray=g;function m(N){return typeof N=="boolean"}K.isBoolean=m;function w(N){return N===null}K.isNull=w;function l(N){return N==null}K.isNullOrUndefined=l;function x(N){return typeof N=="number"}K.isNumber=x;function y(N){return typeof N=="string"}K.isString=y;function S(N){return typeof N=="symbol"}K.isSymbol=S;function k(N){return N===void 0}K.isUndefined=k;function M(N){return T(N)&&P(N)==="[object RegExp]"}K.isRegExp=M,K.types.isRegExp=M;function T(N){return typeof N=="object"&&N!==null}K.isObject=T;function c(N){return T(N)&&P(N)==="[object Date]"}K.isDate=c,K.types.isDate=c;function h(N){return T(N)&&(P(N)==="[object Error]"||N instanceof Error)}K.isError=h,K.types.isNativeError=h;function b(N){return typeof N=="function"}K.isFunction=b;function _(N){return N===null||typeof N=="boolean"||typeof N=="number"||typeof N=="string"||typeof N=="symbol"||typeof N>"u"}K.isPrimitive=_,K.isBuffer=Y2();function P(N){return Object.prototype.toString.call(N)}function z(N){return N<10?"0"+N.toString(10):N.toString(10)}var D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function B(){var N=new Date,G=[z(N.getHours()),z(N.getMinutes()),z(N.getSeconds())].join(":");return[N.getDate(),D[N.getMonth()],G].join(" ")}K.log=function(){console.log("%s - %s",B(),K.format.apply(K,arguments))},K.inherits=Rp(),K._extend=function(N,G){if(!G||!T(G))return N;for(var rt=Object.keys(G),ct=rt.length;ct--;)N[rt[ct]]=G[rt[ct]];return N};function R(N,G){return Object.prototype.hasOwnProperty.call(N,G)}var I=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;K.promisify=function(N){if(typeof N!="function")throw new TypeError('The "original" argument must be of type Function');if(I&&N[I]){var G=N[I];if(typeof G!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(G,I,{value:G,enumerable:!1,writable:!1,configurable:!0}),G}function G(){for(var rt,ct,st=new Promise(function(ot,X){rt=ot,ct=X}),et=[],Z=0;Z{function u(f,v){var g=Object.keys(f);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(f);v&&(m=m.filter(function(w){return Object.getOwnPropertyDescriptor(f,w).enumerable})),g.push.apply(g,m)}return g}function d(f){for(var v=1;v0?this.tail.next=g:this.head=g,this.tail=g,++this.length}},{key:"unshift",value:function(v){var g={data:v,next:this.head};this.length===0&&(this.tail=g),this.head=g,++this.length}},{key:"shift",value:function(){if(this.length!==0){var v=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,v}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(v){if(this.length===0)return"";for(var g=this.head,m=""+g.data;g=g.next;)m+=v+g.data;return m}},{key:"concat",value:function(v){if(this.length===0)return i.alloc(0);for(var g=i.allocUnsafe(v>>>0),m=this.head,w=0;m;)s(m.data,g,w),w+=m.data.length,m=m.next;return g}},{key:"consume",value:function(v,g){var m;return vl.length?l.length:v;if(x===l.length?w+=l:w+=l.slice(0,v),v-=x,v===0){x===l.length?(++m,g.next?this.head=g.next:this.head=this.tail=null):(this.head=g,g.data=l.slice(x));break}++m}return this.length-=m,w}},{key:"_getBuffer",value:function(v){var g=i.allocUnsafe(v),m=this.head,w=1;for(m.data.copy(g),v-=m.data.length;m=m.next;){var l=m.data,x=v>l.length?l.length:v;if(l.copy(g,g.length-v,0,x),v-=x,v===0){x===l.length?(++w,m.next?this.head=m.next:this.head=this.tail=null):(this.head=m,m.data=l.slice(x));break}++w}return this.length-=w,g}},{key:a,value:function(v,g){return o(this,d({},g,{depth:0,customInspect:!1}))}}]),f})()}),$2=Vt((K,V)=>{function u(r,i){var n=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(i?i(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(t,this,r)):process.nextTick(t,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(s){!i&&s?n._writableState?n._writableState.errorEmitted?process.nextTick(E,n):(n._writableState.errorEmitted=!0,process.nextTick(d,n,s)):process.nextTick(d,n,s):i?(process.nextTick(E,n),i(s)):process.nextTick(E,n)}),this)}function d(r,i){t(r,i),E(r)}function E(r){r._writableState&&!r._writableState.emitClose||r._readableState&&!r._readableState.emitClose||r.emit("close")}function A(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function t(r,i){r.emit("error",i)}function e(r,i){var n=r._readableState,o=r._writableState;n&&n.autoDestroy||o&&o.autoDestroy?r.destroy(i):r.emit("error",i)}V.exports={destroy:u,undestroy:A,errorOrDestroy:e}}),x0=Vt((K,V)=>{function u(i,n){i.prototype=Object.create(n.prototype),i.prototype.constructor=i,i.__proto__=n}var d={};function E(i,n,o){o||(o=Error);function a(f,v,g){return typeof n=="string"?n:n(f,v,g)}var s=(function(f){u(v,f);function v(g,m,w){return f.call(this,a(g,m,w))||this}return v})(o);s.prototype.name=o.name,s.prototype.code=i,d[i]=s}function A(i,n){if(Array.isArray(i)){var o=i.length;return i=i.map(function(a){return String(a)}),o>2?"one of ".concat(n," ").concat(i.slice(0,o-1).join(", "),", or ")+i[o-1]:o===2?"one of ".concat(n," ").concat(i[0]," or ").concat(i[1]):"of ".concat(n," ").concat(i[0])}else return"of ".concat(n," ").concat(String(i))}function t(i,n,o){return i.substr(0,n.length)===n}function e(i,n,o){return(o===void 0||o>i.length)&&(o=i.length),i.substring(o-n.length,o)===n}function r(i,n,o){return typeof o!="number"&&(o=0),o+n.length>i.length?!1:i.indexOf(n,o)!==-1}E("ERR_INVALID_OPT_VALUE",function(i,n){return'The value "'+n+'" is invalid for option "'+i+'"'},TypeError),E("ERR_INVALID_ARG_TYPE",function(i,n,o){var a;typeof n=="string"&&t(n,"not ")?(a="must not be",n=n.replace(/^not /,"")):a="must be";var s;if(e(i," argument"))s="The ".concat(i," ").concat(a," ").concat(A(n,"type"));else{var f=r(i,".")?"property":"argument";s='The "'.concat(i,'" ').concat(f," ").concat(a," ").concat(A(n,"type"))}return s+=". Received type ".concat(typeof o),s},TypeError),E("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),E("ERR_METHOD_NOT_IMPLEMENTED",function(i){return"The "+i+" method is not implemented"}),E("ERR_STREAM_PREMATURE_CLOSE","Premature close"),E("ERR_STREAM_DESTROYED",function(i){return"Cannot call "+i+" after a stream was destroyed"}),E("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),E("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),E("ERR_STREAM_WRITE_AFTER_END","write after end"),E("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),E("ERR_UNKNOWN_ENCODING",function(i){return"Unknown encoding: "+i},TypeError),E("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),V.exports.codes=d}),J2=Vt((K,V)=>{var u=x0().codes.ERR_INVALID_OPT_VALUE;function d(A,t,e){return A.highWaterMark!=null?A.highWaterMark:t?A[e]:null}function E(A,t,e,r){var i=d(t,r,e);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var n=r?e:"highWaterMark";throw new u(n,i)}return Math.floor(i)}return A.objectMode?16:16*1024}V.exports={getHighWaterMark:E}}),zM=Vt((K,V)=>{V.exports=u;function u(E,A){if(d("noDeprecation"))return E;var t=!1;function e(){if(!t){if(d("throwDeprecation"))throw new Error(A);d("traceDeprecation")?console.trace(A):console.warn(A),t=!0}return E.apply(this,arguments)}return e}function d(E){try{if(!window.localStorage)return!1}catch{return!1}var A=window.localStorage[E];return A==null?!1:String(A).toLowerCase()==="true"}}),Q2=Vt((K,V)=>{V.exports=c;function u(Z){var ot=this;this.next=null,this.entry=null,this.finish=function(){et(ot,Z)}}var d;c.WritableState=M;var E={deprecate:zM()},A=N2(),t=v0().Buffer,e=window.Uint8Array||function(){};function r(Z){return t.from(Z)}function i(Z){return t.isBuffer(Z)||Z instanceof e}var n=$2(),o=J2(),a=o.getHighWaterMark,s=x0().codes,f=s.ERR_INVALID_ARG_TYPE,v=s.ERR_METHOD_NOT_IMPLEMENTED,g=s.ERR_MULTIPLE_CALLBACK,m=s.ERR_STREAM_CANNOT_PIPE,w=s.ERR_STREAM_DESTROYED,l=s.ERR_STREAM_NULL_VALUES,x=s.ERR_STREAM_WRITE_AFTER_END,y=s.ERR_UNKNOWN_ENCODING,S=n.errorOrDestroy;Rp()(c,A);function k(){}function M(Z,ot,X){d=d||_0(),Z=Z||{},typeof X!="boolean"&&(X=ot instanceof d),this.objectMode=!!Z.objectMode,X&&(this.objectMode=this.objectMode||!!Z.writableObjectMode),this.highWaterMark=a(this,Z,"writableHighWaterMark",X),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Q=Z.decodeStrings===!1;this.decodeStrings=!Q,this.defaultEncoding=Z.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ut){R(ot,ut)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Z.emitClose!==!1,this.autoDestroy=!!Z.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new u(this)}M.prototype.getBuffer=function(){for(var Z=this.bufferedRequest,ot=[];Z;)ot.push(Z),Z=Z.next;return ot},(function(){try{Object.defineProperty(M.prototype,"buffer",{get:E.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var T;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(T=Function.prototype[Symbol.hasInstance],Object.defineProperty(c,Symbol.hasInstance,{value:function(Z){return T.call(this,Z)?!0:this!==c?!1:Z&&Z._writableState instanceof M}})):T=function(Z){return Z instanceof this};function c(Z){d=d||_0();var ot=this instanceof d;if(!ot&&!T.call(c,this))return new c(Z);this._writableState=new M(Z,this,ot),this.writable=!0,Z&&(typeof Z.write=="function"&&(this._write=Z.write),typeof Z.writev=="function"&&(this._writev=Z.writev),typeof Z.destroy=="function"&&(this._destroy=Z.destroy),typeof Z.final=="function"&&(this._final=Z.final)),A.call(this)}c.prototype.pipe=function(){S(this,new m)};function h(Z,ot){var X=new x;S(Z,X),process.nextTick(ot,X)}function b(Z,ot,X,Q){var ut;return X===null?ut=new l:typeof X!="string"&&!ot.objectMode&&(ut=new f("chunk",["string","Buffer"],X)),ut?(S(Z,ut),process.nextTick(Q,ut),!1):!0}c.prototype.write=function(Z,ot,X){var Q=this._writableState,ut=!1,J=!Q.objectMode&&i(Z);return J&&!t.isBuffer(Z)&&(Z=r(Z)),typeof ot=="function"&&(X=ot,ot=null),J?ot="buffer":ot||(ot=Q.defaultEncoding),typeof X!="function"&&(X=k),Q.ending?h(this,X):(J||b(this,Q,Z,X))&&(Q.pendingcb++,ut=P(this,Q,J,Z,ot,X)),ut},c.prototype.cork=function(){this._writableState.corked++},c.prototype.uncork=function(){var Z=this._writableState;Z.corked&&(Z.corked--,!Z.writing&&!Z.corked&&!Z.bufferProcessing&&Z.bufferedRequest&&j(this,Z))},c.prototype.setDefaultEncoding=function(Z){if(typeof Z=="string"&&(Z=Z.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Z+"").toLowerCase())>-1))throw new y(Z);return this._writableState.defaultEncoding=Z,this},Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function _(Z,ot,X){return!Z.objectMode&&Z.decodeStrings!==!1&&typeof ot=="string"&&(ot=t.from(ot,X)),ot}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function P(Z,ot,X,Q,ut,J){if(!X){var q=_(ot,Q,ut);Q!==q&&(X=!0,ut="buffer",Q=q)}var it=ot.objectMode?1:Q.length;ot.length+=it;var nt=ot.length{var u=Object.keys||function(o){var a=[];for(var s in o)a.push(s);return a};V.exports=r;var d=ew(),E=Q2();for(Rp()(r,d),A=u(E.prototype),e=0;e{var u=v0(),d=u.Buffer;function E(t,e){for(var r in t)e[r]=t[r]}d.from&&d.alloc&&d.allocUnsafe&&d.allocUnsafeSlow?V.exports=u:(E(u,K),K.Buffer=A);function A(t,e,r){return d(t,e,r)}A.prototype=Object.create(d.prototype),E(d,A),A.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return d(t,e,r)},A.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=d(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i},A.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return d(t)},A.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return u.SlowBuffer(t)}}),tw=Vt(K=>{var V=LM().Buffer,u=V.isEncoding||function(w){switch(w=""+w,w&&w.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function d(w){if(!w)return"utf8";for(var l;;)switch(w){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return w;default:if(l)return;w=(""+w).toLowerCase(),l=!0}}function E(w){var l=d(w);if(typeof l!="string"&&(V.isEncoding===u||!u(w)))throw new Error("Unknown encoding: "+w);return l||w}K.StringDecoder=A;function A(w){this.encoding=E(w);var l;switch(this.encoding){case"utf16le":this.text=a,this.end=s,l=4;break;case"utf8":this.fillLast=i,l=4;break;case"base64":this.text=f,this.end=v,l=3;break;default:this.write=g,this.end=m;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=V.allocUnsafe(l)}A.prototype.write=function(w){if(w.length===0)return"";var l,x;if(this.lastNeed){if(l=this.fillLast(w),l===void 0)return"";x=this.lastNeed,this.lastNeed=0}else x=0;return x>5===6?2:w>>4===14?3:w>>3===30?4:w>>6===2?-1:-2}function e(w,l,x){var y=l.length-1;if(y=0?(S>0&&(w.lastNeed=S-1),S):--y=0?(S>0&&(w.lastNeed=S-2),S):--y=0?(S>0&&(S===2?S=0:w.lastNeed=S-3),S):0))}function r(w,l,x){if((l[0]&192)!==128)return w.lastNeed=0,"�";if(w.lastNeed>1&&l.length>1){if((l[1]&192)!==128)return w.lastNeed=1,"�";if(w.lastNeed>2&&l.length>2&&(l[2]&192)!==128)return w.lastNeed=2,"�"}}function i(w){var l=this.lastTotal-this.lastNeed,x=r(this,w);if(x!==void 0)return x;if(this.lastNeed<=w.length)return w.copy(this.lastChar,l,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);w.copy(this.lastChar,l,0,w.length),this.lastNeed-=w.length}function n(w,l){var x=e(this,w,l);if(!this.lastNeed)return w.toString("utf8",l);this.lastTotal=x;var y=w.length-(x-this.lastNeed);return w.copy(this.lastChar,0,y),w.toString("utf8",l,y)}function o(w){var l=w&&w.length?this.write(w):"";return this.lastNeed?l+"�":l}function a(w,l){if((w.length-l)%2===0){var x=w.toString("utf16le",l);if(x){var y=x.charCodeAt(x.length-1);if(y>=55296&&y<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=w[w.length-2],this.lastChar[1]=w[w.length-1],x.slice(0,-1)}return x}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=w[w.length-1],w.toString("utf16le",l,w.length-1)}function s(w){var l=w&&w.length?this.write(w):"";if(this.lastNeed){var x=this.lastTotal-this.lastNeed;return l+this.lastChar.toString("utf16le",0,x)}return l}function f(w,l){var x=(w.length-l)%3;return x===0?w.toString("base64",l):(this.lastNeed=3-x,this.lastTotal=3,x===1?this.lastChar[0]=w[w.length-1]:(this.lastChar[0]=w[w.length-2],this.lastChar[1]=w[w.length-1]),w.toString("base64",l,w.length-x))}function v(w){var l=w&&w.length?this.write(w):"";return this.lastNeed?l+this.lastChar.toString("base64",0,3-this.lastNeed):l}function g(w){return w.toString(this.encoding)}function m(w){return w&&w.length?this.write(w):""}}),V1=Vt((K,V)=>{var u=x0().codes.ERR_STREAM_PREMATURE_CLOSE;function d(e){var r=!1;return function(){if(!r){r=!0;for(var i=arguments.length,n=new Array(i),o=0;o{var u;function d(l,x,y){return x in l?Object.defineProperty(l,x,{value:y,enumerable:!0,configurable:!0,writable:!0}):l[x]=y,l}var E=V1(),A=Symbol("lastResolve"),t=Symbol("lastReject"),e=Symbol("error"),r=Symbol("ended"),i=Symbol("lastPromise"),n=Symbol("handlePromise"),o=Symbol("stream");function a(l,x){return{value:l,done:x}}function s(l){var x=l[A];if(x!==null){var y=l[o].read();y!==null&&(l[i]=null,l[A]=null,l[t]=null,x(a(y,!1)))}}function f(l){process.nextTick(s,l)}function v(l,x){return function(y,S){l.then(function(){if(x[r]){y(a(void 0,!0));return}x[n](y,S)},S)}}var g=Object.getPrototypeOf(function(){}),m=Object.setPrototypeOf((u={get stream(){return this[o]},next:function(){var l=this,x=this[e];if(x!==null)return Promise.reject(x);if(this[r])return Promise.resolve(a(void 0,!0));if(this[o].destroyed)return new Promise(function(M,T){process.nextTick(function(){l[e]?T(l[e]):M(a(void 0,!0))})});var y=this[i],S;if(y)S=new Promise(v(y,this));else{var k=this[o].read();if(k!==null)return Promise.resolve(a(k,!1));S=new Promise(this[n])}return this[i]=S,S}},d(u,Symbol.asyncIterator,function(){return this}),d(u,"return",function(){var l=this;return new Promise(function(x,y){l[o].destroy(null,function(S){if(S){y(S);return}x(a(void 0,!0))})})}),u),g),w=function(l){var x,y=Object.create(m,(x={},d(x,o,{value:l,writable:!0}),d(x,A,{value:null,writable:!0}),d(x,t,{value:null,writable:!0}),d(x,e,{value:null,writable:!0}),d(x,r,{value:l._readableState.endEmitted,writable:!0}),d(x,n,{value:function(S,k){var M=y[o].read();M?(y[i]=null,y[A]=null,y[t]=null,S(a(M,!1))):(y[A]=S,y[t]=k)},writable:!0}),x));return y[i]=null,E(l,function(S){if(S&&S.code!=="ERR_STREAM_PREMATURE_CLOSE"){var k=y[t];k!==null&&(y[i]=null,y[A]=null,y[t]=null,k(S)),y[e]=S;return}var M=y[A];M!==null&&(y[i]=null,y[A]=null,y[t]=null,M(a(void 0,!0))),y[r]=!0}),l.on("readable",f.bind(null,y)),y};V.exports=w}),IM=Vt((K,V)=>{V.exports=function(){throw new Error("Readable.from is not available in the browser")}}),ew=Vt((K,V)=>{V.exports=h;var u;h.ReadableState=c,l0().EventEmitter;var d=function(J,q){return J.listeners(q).length},E=N2(),A=v0().Buffer,t=window.Uint8Array||function(){};function e(J){return A.from(J)}function r(J){return A.isBuffer(J)||J instanceof t}var i=X2(),n;i&&i.debuglog?n=i.debuglog("stream"):n=function(){};var o=EM(),a=$2(),s=J2(),f=s.getHighWaterMark,v=x0().codes,g=v.ERR_INVALID_ARG_TYPE,m=v.ERR_STREAM_PUSH_AFTER_EOF,w=v.ERR_METHOD_NOT_IMPLEMENTED,l=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,x,y,S;Rp()(h,E);var k=a.errorOrDestroy,M=["error","close","destroy","pause","resume"];function T(J,q,it){if(typeof J.prependListener=="function")return J.prependListener(q,it);!J._events||!J._events[q]?J.on(q,it):Array.isArray(J._events[q])?J._events[q].unshift(it):J._events[q]=[it,J._events[q]]}function c(J,q,it){u=u||_0(),J=J||{},typeof it!="boolean"&&(it=q instanceof u),this.objectMode=!!J.objectMode,it&&(this.objectMode=this.objectMode||!!J.readableObjectMode),this.highWaterMark=f(this,J,"readableHighWaterMark",it),this.buffer=new o,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=J.emitClose!==!1,this.autoDestroy=!!J.autoDestroy,this.destroyed=!1,this.defaultEncoding=J.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,J.encoding&&(x||(x=tw().StringDecoder),this.decoder=new x(J.encoding),this.encoding=J.encoding)}function h(J){if(u=u||_0(),!(this instanceof h))return new h(J);var q=this instanceof u;this._readableState=new c(J,this,q),this.readable=!0,J&&(typeof J.read=="function"&&(this._read=J.read),typeof J.destroy=="function"&&(this._destroy=J.destroy)),E.call(this)}Object.defineProperty(h.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(J){this._readableState&&(this._readableState.destroyed=J)}}),h.prototype.destroy=a.destroy,h.prototype._undestroy=a.undestroy,h.prototype._destroy=function(J,q){q(J)},h.prototype.push=function(J,q){var it=this._readableState,nt;return it.objectMode?nt=!0:typeof J=="string"&&(q=q||it.defaultEncoding,q!==it.encoding&&(J=A.from(J,q),q=""),nt=!0),b(this,J,q,!1,nt)},h.prototype.unshift=function(J){return b(this,J,null,!0,!1)};function b(J,q,it,nt,dt){n("readableAddChunk",q);var Tt=J._readableState;if(q===null)Tt.reading=!1,R(J,Tt);else{var wt;if(dt||(wt=P(Tt,q)),wt)k(J,wt);else if(Tt.objectMode||q&&q.length>0)if(typeof q!="string"&&!Tt.objectMode&&Object.getPrototypeOf(q)!==A.prototype&&(q=e(q)),nt)Tt.endEmitted?k(J,new l):_(J,Tt,q,!0);else if(Tt.ended)k(J,new m);else{if(Tt.destroyed)return!1;Tt.reading=!1,Tt.decoder&&!it?(q=Tt.decoder.write(q),Tt.objectMode||q.length!==0?_(J,Tt,q,!1):j(J,Tt)):_(J,Tt,q,!1)}else nt||(Tt.reading=!1,j(J,Tt))}return!Tt.ended&&(Tt.length=z?J=z:(J--,J|=J>>>1,J|=J>>>2,J|=J>>>4,J|=J>>>8,J|=J>>>16,J++),J}function B(J,q){return J<=0||q.length===0&&q.ended?0:q.objectMode?1:J!==J?q.flowing&&q.length?q.buffer.head.data.length:q.length:(J>q.highWaterMark&&(q.highWaterMark=D(J)),J<=q.length?J:q.ended?q.length:(q.needReadable=!0,0))}h.prototype.read=function(J){n("read",J),J=parseInt(J,10);var q=this._readableState,it=J;if(J!==0&&(q.emittedReadable=!1),J===0&&q.needReadable&&((q.highWaterMark!==0?q.length>=q.highWaterMark:q.length>0)||q.ended))return n("read: emitReadable",q.length,q.ended),q.length===0&&q.ended?X(this):I(this),null;if(J=B(J,q),J===0&&q.ended)return q.length===0&&X(this),null;var nt=q.needReadable;n("need readable",nt),(q.length===0||q.length-J0?dt=ot(J,q):dt=null,dt===null?(q.needReadable=q.length<=q.highWaterMark,J=0):(q.length-=J,q.awaitDrain=0),q.length===0&&(q.ended||(q.needReadable=!0),it!==J&&q.ended&&X(this)),dt!==null&&this.emit("data",dt),dt};function R(J,q){if(n("onEofChunk"),!q.ended){if(q.decoder){var it=q.decoder.end();it&&it.length&&(q.buffer.push(it),q.length+=q.objectMode?1:it.length)}q.ended=!0,q.sync?I(J):(q.needReadable=!1,q.emittedReadable||(q.emittedReadable=!0,F(J)))}}function I(J){var q=J._readableState;n("emitReadable",q.needReadable,q.emittedReadable),q.needReadable=!1,q.emittedReadable||(n("emitReadable",q.flowing),q.emittedReadable=!0,process.nextTick(F,J))}function F(J){var q=J._readableState;n("emitReadable_",q.destroyed,q.length,q.ended),!q.destroyed&&(q.length||q.ended)&&(J.emit("readable"),q.emittedReadable=!1),q.needReadable=!q.flowing&&!q.ended&&q.length<=q.highWaterMark,Z(J)}function j(J,q){q.readingMore||(q.readingMore=!0,process.nextTick(N,J,q))}function N(J,q){for(;!q.reading&&!q.ended&&(q.length1&&ut(nt.pipes,J)!==-1)&&!Nt&&(n("false write response, pause",nt.awaitDrain),nt.awaitDrain++),it.pause())}function ee(vt){n("onerror",vt),bt(),J.removeListener("error",ee),d(J,"error")===0&&k(J,vt)}T(J,"error",ee);function Zt(){J.removeListener("finish",mt),bt()}J.once("close",Zt);function mt(){n("onfinish"),J.removeListener("close",Zt),bt()}J.once("finish",mt);function bt(){n("unpipe"),it.unpipe(J)}return J.emit("pipe",it),nt.flowing||(n("pipe resume"),it.resume()),J};function G(J){return function(){var q=J._readableState;n("pipeOnDrain",q.awaitDrain),q.awaitDrain&&q.awaitDrain--,q.awaitDrain===0&&d(J,"data")&&(q.flowing=!0,Z(J))}}h.prototype.unpipe=function(J){var q=this._readableState,it={hasUnpiped:!1};if(q.pipesCount===0)return this;if(q.pipesCount===1)return J&&J!==q.pipes?this:(J||(J=q.pipes),q.pipes=null,q.pipesCount=0,q.flowing=!1,J&&J.emit("unpipe",this,it),this);if(!J){var nt=q.pipes,dt=q.pipesCount;q.pipes=null,q.pipesCount=0,q.flowing=!1;for(var Tt=0;Tt0,nt.flowing!==!1&&this.resume()):J==="readable"&&!nt.endEmitted&&!nt.readableListening&&(nt.readableListening=nt.needReadable=!0,nt.flowing=!1,nt.emittedReadable=!1,n("on readable",nt.length,nt.reading),nt.length?I(this):nt.reading||process.nextTick(ct,this)),it},h.prototype.addListener=h.prototype.on,h.prototype.removeListener=function(J,q){var it=E.prototype.removeListener.call(this,J,q);return J==="readable"&&process.nextTick(rt,this),it},h.prototype.removeAllListeners=function(J){var q=E.prototype.removeAllListeners.apply(this,arguments);return(J==="readable"||J===void 0)&&process.nextTick(rt,this),q};function rt(J){var q=J._readableState;q.readableListening=J.listenerCount("readable")>0,q.resumeScheduled&&!q.paused?q.flowing=!0:J.listenerCount("data")>0&&J.resume()}function ct(J){n("readable nexttick read 0"),J.read(0)}h.prototype.resume=function(){var J=this._readableState;return J.flowing||(n("resume"),J.flowing=!J.readableListening,st(this,J)),J.paused=!1,this};function st(J,q){q.resumeScheduled||(q.resumeScheduled=!0,process.nextTick(et,J,q))}function et(J,q){n("resume",q.reading),q.reading||J.read(0),q.resumeScheduled=!1,J.emit("resume"),Z(J),q.flowing&&!q.reading&&J.read(0)}h.prototype.pause=function(){return n("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(n("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Z(J){var q=J._readableState;for(n("flow",q.flowing);q.flowing&&J.read()!==null;);}h.prototype.wrap=function(J){var q=this,it=this._readableState,nt=!1;J.on("end",function(){if(n("wrapped end"),it.decoder&&!it.ended){var wt=it.decoder.end();wt&&wt.length&&q.push(wt)}q.push(null)}),J.on("data",function(wt){if(n("wrapped data"),it.decoder&&(wt=it.decoder.write(wt)),!(it.objectMode&&wt==null)&&!(!it.objectMode&&(!wt||!wt.length))){var Ct=q.push(wt);Ct||(nt=!0,J.pause())}});for(var dt in J)this[dt]===void 0&&typeof J[dt]=="function"&&(this[dt]=(function(wt){return function(){return J[wt].apply(J,arguments)}})(dt));for(var Tt=0;Tt=q.length?(q.decoder?it=q.buffer.join(""):q.buffer.length===1?it=q.buffer.first():it=q.buffer.concat(q.length),q.buffer.clear()):it=q.buffer.consume(J,q.decoder),it}function X(J){var q=J._readableState;n("endReadable",q.endEmitted),q.endEmitted||(q.ended=!0,process.nextTick(Q,q,J))}function Q(J,q){if(n("endReadableNT",J.endEmitted,J.length),!J.endEmitted&&J.length===0&&(J.endEmitted=!0,q.readable=!1,q.emit("end"),J.autoDestroy)){var it=q._writableState;(!it||it.autoDestroy&&it.finished)&&q.destroy()}}typeof Symbol=="function"&&(h.from=function(J,q){return S===void 0&&(S=IM()),S(h,J,q)});function ut(J,q){for(var it=0,nt=J.length;it{V.exports=i;var u=x0().codes,d=u.ERR_METHOD_NOT_IMPLEMENTED,E=u.ERR_MULTIPLE_CALLBACK,A=u.ERR_TRANSFORM_ALREADY_TRANSFORMING,t=u.ERR_TRANSFORM_WITH_LENGTH_0,e=_0();Rp()(i,e);function r(a,s){var f=this._transformState;f.transforming=!1;var v=f.writecb;if(v===null)return this.emit("error",new E);f.writechunk=null,f.writecb=null,s!=null&&this.push(s),v(a);var g=this._readableState;g.reading=!1,(g.needReadable||g.length{V.exports=d;var u=rw();Rp()(d,u);function d(E){if(!(this instanceof d))return new d(E);u.call(this,E)}d.prototype._transform=function(E,A,t){t(null,E)}}),OM=Vt((K,V)=>{var u;function d(f){var v=!1;return function(){v||(v=!0,f.apply(void 0,arguments))}}var E=x0().codes,A=E.ERR_MISSING_ARGS,t=E.ERR_STREAM_DESTROYED;function e(f){if(f)throw f}function r(f){return f.setHeader&&typeof f.abort=="function"}function i(f,v,g,m){m=d(m);var w=!1;f.on("close",function(){w=!0}),u===void 0&&(u=V1()),u(f,{readable:v,writable:g},function(x){if(x)return m(x);w=!0,m()});var l=!1;return function(x){if(!w&&!l){if(l=!0,r(f))return f.abort();if(typeof f.destroy=="function")return f.destroy();m(x||new t("pipe"))}}}function n(f){f()}function o(f,v){return f.pipe(v)}function a(f){return!f.length||typeof f[f.length-1]!="function"?e:f.pop()}function s(){for(var f=arguments.length,v=new Array(f),g=0;g0;return i(x,S,k,function(M){w||(w=M),M&&l.forEach(n),!S&&(l.forEach(n),m(w))})});return v.reduce(o)}V.exports=s}),DM=Vt((K,V)=>{V.exports=E;var u=l0().EventEmitter,d=Rp();d(E,u),E.Readable=ew(),E.Writable=Q2(),E.Duplex=_0(),E.Transform=rw(),E.PassThrough=PM(),E.finished=V1(),E.pipeline=OM(),E.Stream=E;function E(){u.call(this)}E.prototype.pipe=function(A,t){var e=this;function r(v){A.writable&&A.write(v)===!1&&e.pause&&e.pause()}e.on("data",r);function i(){e.readable&&e.resume&&e.resume()}A.on("drain",i),!A._isStdio&&(!t||t.end!==!1)&&(e.on("end",o),e.on("close",a));var n=!1;function o(){n||(n=!0,A.end())}function a(){n||(n=!0,typeof A.destroy=="function"&&A.destroy())}function s(v){if(f(),u.listenerCount(this,"error")===0)throw v}e.on("error",s),A.on("error",s);function f(){e.removeListener("data",r),A.removeListener("drain",i),e.removeListener("end",o),e.removeListener("close",a),e.removeListener("error",s),A.removeListener("error",s),e.removeListener("end",f),e.removeListener("close",f),A.removeListener("close",f)}return e.on("end",f),e.on("close",f),A.on("close",f),A.emit("pipe",e),A}}),jm=Vt(K=>{var V=Object.getOwnPropertyDescriptors||function(N){for(var G=Object.keys(N),rt={},ct=0;ct=st)return X;switch(X){case"%s":return String(ct[rt++]);case"%d":return Number(ct[rt++]);case"%j":try{return JSON.stringify(ct[rt++])}catch{return"[Circular]"}default:return X}}),Z=ct[rt];rt"u")return function(){return K.deprecate(N,G).apply(this,arguments)};var rt=!1;function ct(){if(!rt){if(process.throwDeprecation)throw new Error(G);process.traceDeprecation?console.trace(G):console.error(G),rt=!0}return N.apply(this,arguments)}return ct};var d={},E=/^$/;A="false",A=A.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),E=new RegExp("^"+A+"$","i");var A;K.debuglog=function(N){if(N=N.toUpperCase(),!d[N])if(E.test(N)){var G=process.pid;d[N]=function(){var rt=K.format.apply(K,arguments);console.error("%s %d: %s",N,G,rt)}}else d[N]=function(){};return d[N]};function t(N,G){var rt={seen:[],stylize:r};return arguments.length>=3&&(rt.depth=arguments[2]),arguments.length>=4&&(rt.colors=arguments[3]),m(G)?rt.showHidden=G:G&&K._extend(rt,G),k(rt.showHidden)&&(rt.showHidden=!1),k(rt.depth)&&(rt.depth=2),k(rt.colors)&&(rt.colors=!1),k(rt.customInspect)&&(rt.customInspect=!0),rt.colors&&(rt.stylize=e),n(rt,N,rt.depth)}K.inspect=t,t.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},t.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function e(N,G){var rt=t.styles[G];return rt?"\x1B["+t.colors[rt][0]+"m"+N+"\x1B["+t.colors[rt][1]+"m":N}function r(N,G){return N}function i(N){var G={};return N.forEach(function(rt,ct){G[rt]=!0}),G}function n(N,G,rt){if(N.customInspect&&G&&b(G.inspect)&&G.inspect!==K.inspect&&!(G.constructor&&G.constructor.prototype===G)){var ct=G.inspect(rt,N);return y(ct)||(ct=n(N,ct,rt)),ct}var st=o(N,G);if(st)return st;var et=Object.keys(G),Z=i(et);if(N.showHidden&&(et=Object.getOwnPropertyNames(G)),h(G)&&(et.indexOf("message")>=0||et.indexOf("description")>=0))return a(G);if(et.length===0){if(b(G)){var ot=G.name?": "+G.name:"";return N.stylize("[Function"+ot+"]","special")}if(M(G))return N.stylize(RegExp.prototype.toString.call(G),"regexp");if(c(G))return N.stylize(Date.prototype.toString.call(G),"date");if(h(G))return a(G)}var X="",Q=!1,ut=["{","}"];if(g(G)&&(Q=!0,ut=["[","]"]),b(G)){var J=G.name?": "+G.name:"";X=" [Function"+J+"]"}if(M(G)&&(X=" "+RegExp.prototype.toString.call(G)),c(G)&&(X=" "+Date.prototype.toUTCString.call(G)),h(G)&&(X=" "+a(G)),et.length===0&&(!Q||G.length==0))return ut[0]+X+ut[1];if(rt<0)return M(G)?N.stylize(RegExp.prototype.toString.call(G),"regexp"):N.stylize("[Object]","special");N.seen.push(G);var q;return Q?q=s(N,G,rt,Z,et):q=et.map(function(it){return f(N,G,rt,Z,it,Q)}),N.seen.pop(),v(q,X,ut)}function o(N,G){if(k(G))return N.stylize("undefined","undefined");if(y(G)){var rt="'"+JSON.stringify(G).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return N.stylize(rt,"string")}if(x(G))return N.stylize(""+G,"number");if(m(G))return N.stylize(""+G,"boolean");if(w(G))return N.stylize("null","null")}function a(N){return"["+Error.prototype.toString.call(N)+"]"}function s(N,G,rt,ct,st){for(var et=[],Z=0,ot=G.length;Z-1&&(et?ot=ot.split(` +`).map(function(Q){return" "+Q}).join(` +`).slice(2):ot=` +`+ot.split(` +`).map(function(Q){return" "+Q}).join(` +`))):ot=N.stylize("[Circular]","special")),k(Z)){if(et&&st.match(/^\d+$/))return ot;Z=JSON.stringify(""+st),Z.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(Z=Z.slice(1,-1),Z=N.stylize(Z,"name")):(Z=Z.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),Z=N.stylize(Z,"string"))}return Z+": "+ot}function v(N,G,rt){var ct=0,st=N.reduce(function(et,Z){return ct++,Z.indexOf(` +`)>=0&&ct++,et+Z.replace(/\u001b\[\d\d?m/g,"").length+1},0);return st>60?rt[0]+(G===""?"":G+` + `)+" "+N.join(`, + `)+" "+rt[1]:rt[0]+G+" "+N.join(", ")+" "+rt[1]}K.types=K2();function g(N){return Array.isArray(N)}K.isArray=g;function m(N){return typeof N=="boolean"}K.isBoolean=m;function w(N){return N===null}K.isNull=w;function l(N){return N==null}K.isNullOrUndefined=l;function x(N){return typeof N=="number"}K.isNumber=x;function y(N){return typeof N=="string"}K.isString=y;function S(N){return typeof N=="symbol"}K.isSymbol=S;function k(N){return N===void 0}K.isUndefined=k;function M(N){return T(N)&&P(N)==="[object RegExp]"}K.isRegExp=M,K.types.isRegExp=M;function T(N){return typeof N=="object"&&N!==null}K.isObject=T;function c(N){return T(N)&&P(N)==="[object Date]"}K.isDate=c,K.types.isDate=c;function h(N){return T(N)&&(P(N)==="[object Error]"||N instanceof Error)}K.isError=h,K.types.isNativeError=h;function b(N){return typeof N=="function"}K.isFunction=b;function _(N){return N===null||typeof N=="boolean"||typeof N=="number"||typeof N=="string"||typeof N=="symbol"||typeof N>"u"}K.isPrimitive=_,K.isBuffer=Y2();function P(N){return Object.prototype.toString.call(N)}function z(N){return N<10?"0"+N.toString(10):N.toString(10)}var D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function B(){var N=new Date,G=[z(N.getHours()),z(N.getMinutes()),z(N.getSeconds())].join(":");return[N.getDate(),D[N.getMonth()],G].join(" ")}K.log=function(){console.log("%s - %s",B(),K.format.apply(K,arguments))},K.inherits=Rp(),K._extend=function(N,G){if(!G||!T(G))return N;for(var rt=Object.keys(G),ct=rt.length;ct--;)N[rt[ct]]=G[rt[ct]];return N};function R(N,G){return Object.prototype.hasOwnProperty.call(N,G)}var I=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;K.promisify=function(N){if(typeof N!="function")throw new TypeError('The "original" argument must be of type Function');if(I&&N[I]){var G=N[I];if(typeof G!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(G,I,{value:G,enumerable:!1,writable:!1,configurable:!0}),G}function G(){for(var rt,ct,st=new Promise(function(ot,X){rt=ot,ct=X}),et=[],Z=0;Z{function u(x){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},u(x)}function d(x,y,S){return Object.defineProperty(x,"prototype",{writable:!1}),x}function E(x,y){if(!(x instanceof y))throw new TypeError("Cannot call a class as a function")}function A(x,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(y&&y.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),Object.defineProperty(x,"prototype",{writable:!1}),y&&t(x,y)}function t(x,y){return t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(S,k){return S.__proto__=k,S},t(x,y)}function e(x){var y=n();return function(){var S=o(x),k;if(y){var M=o(this).constructor;k=Reflect.construct(S,arguments,M)}else k=S.apply(this,arguments);return r(this,k)}}function r(x,y){if(y&&(u(y)==="object"||typeof y=="function"))return y;if(y!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return i(x)}function i(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function n(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function o(x){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(y){return y.__proto__||Object.getPrototypeOf(y)},o(x)}var a={},s,f;function v(x,y,S){S||(S=Error);function k(T,c,h){return typeof y=="string"?y:y(T,c,h)}var M=(function(T){A(h,T);var c=e(h);function h(b,_,P){var z;return E(this,h),z=c.call(this,k(b,_,P)),z.code=x,z}return d(h)})(S);a[x]=M}function g(x,y){if(Array.isArray(x)){var S=x.length;return x=x.map(function(k){return String(k)}),S>2?"one of ".concat(y," ").concat(x.slice(0,S-1).join(", "),", or ")+x[S-1]:S===2?"one of ".concat(y," ").concat(x[0]," or ").concat(x[1]):"of ".concat(y," ").concat(x[0])}else return"of ".concat(y," ").concat(String(x))}function m(x,y,S){return x.substr(0,y.length)===y}function w(x,y,S){return(S===void 0||S>x.length)&&(S=x.length),x.substring(S-y.length,S)===y}function l(x,y,S){return typeof S!="number"&&(S=0),S+y.length>x.length?!1:x.indexOf(y,S)!==-1}v("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),v("ERR_INVALID_ARG_TYPE",function(x,y,S){s===void 0&&(s=lv()),s(typeof x=="string","'name' must be a string");var k;typeof y=="string"&&m(y,"not ")?(k="must not be",y=y.replace(/^not /,"")):k="must be";var M;if(w(x," argument"))M="The ".concat(x," ").concat(k," ").concat(g(y,"type"));else{var T=l(x,".")?"property":"argument";M='The "'.concat(x,'" ').concat(T," ").concat(k," ").concat(g(y,"type"))}return M+=". Received type ".concat(u(S)),M},TypeError),v("ERR_INVALID_ARG_VALUE",function(x,y){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";f===void 0&&(f=jm());var k=f.inspect(y);return k.length>128&&(k="".concat(k.slice(0,128),"...")),"The argument '".concat(x,"' ").concat(S,". Received ").concat(k)},TypeError),v("ERR_INVALID_RETURN_VALUE",function(x,y,S){var k;return S&&S.constructor&&S.constructor.name?k="instance of ".concat(S.constructor.name):k="type ".concat(u(S)),"Expected ".concat(x,' to be returned from the "').concat(y,'"')+" function but got ".concat(k,".")},TypeError),v("ERR_MISSING_ARGS",function(){for(var x=arguments.length,y=new Array(x),S=0;S0,"At least one arg needs to be specified");var k="The ",M=y.length;switch(y=y.map(function(T){return'"'.concat(T,'"')}),M){case 1:k+="".concat(y[0]," argument");break;case 2:k+="".concat(y[0]," and ").concat(y[1]," arguments");break;default:k+=y.slice(0,M-1).join(", "),k+=", and ".concat(y[M-1]," arguments");break}return"".concat(k," must be specified")},TypeError),V.exports.codes=a}),FM=Vt((K,V)=>{function u(j,N){var G=Object.keys(j);if(Object.getOwnPropertySymbols){var rt=Object.getOwnPropertySymbols(j);N&&(rt=rt.filter(function(ct){return Object.getOwnPropertyDescriptor(j,ct).enumerable})),G.push.apply(G,rt)}return G}function d(j){for(var N=1;N"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function m(j){return Function.toString.call(j).indexOf("[native code]")!==-1}function w(j,N){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(G,rt){return G.__proto__=rt,G},w(j,N)}function l(j){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(N){return N.__proto__||Object.getPrototypeOf(N)},l(j)}function x(j){"@babel/helpers - typeof";return x=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(N){return typeof N}:function(N){return N&&typeof Symbol=="function"&&N.constructor===Symbol&&N!==Symbol.prototype?"symbol":typeof N},x(j)}var y=jm(),S=y.inspect,k=nw(),M=k.codes.ERR_INVALID_ARG_TYPE;function T(j,N,G){return(G===void 0||G>j.length)&&(G=j.length),j.substring(G-N.length,G)===N}function c(j,N){if(N=Math.floor(N),j.length==0||N==0)return"";var G=j.length*N;for(N=Math.floor(Math.log(N)/Math.log(2));N;)j+=j,N--;return j+=j.substring(0,G-j.length),j}var h="",b="",_="",P="",z={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},D=10;function B(j){var N=Object.keys(j),G=Object.create(Object.getPrototypeOf(j));return N.forEach(function(rt){G[rt]=j[rt]}),Object.defineProperty(G,"message",{value:j.message}),G}function R(j){return S(j,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function I(j,N,G){var rt="",ct="",st=0,et="",Z=!1,ot=R(j),X=ot.split(` +`),Q=R(N).split(` +`),ut=0,J="";if(G==="strictEqual"&&x(j)==="object"&&x(N)==="object"&&j!==null&&N!==null&&(G="strictEqualObject"),X.length===1&&Q.length===1&&X[0]!==Q[0]){var q=X[0].length+Q[0].length;if(q<=D){if((x(j)!=="object"||j===null)&&(x(N)!=="object"||N===null)&&(j!==0||N!==0))return"".concat(z[G],` + +`)+"".concat(X[0]," !== ").concat(Q[0],` +`)}else if(G!=="strictEqualObject"){var it=process.stderr&&process.stderr.isTTY?process.stderr.columns:80;if(q2&&(J=` + `.concat(c(" ",ut),"^"),ut=0)}}}for(var nt=X[X.length-1],dt=Q[Q.length-1];nt===dt&&(ut++<2?et=` + `.concat(nt).concat(et):rt=nt,X.pop(),Q.pop(),!(X.length===0||Q.length===0));)nt=X[X.length-1],dt=Q[Q.length-1];var Tt=Math.max(X.length,Q.length);if(Tt===0){var wt=ot.split(` +`);if(wt.length>30)for(wt[26]="".concat(h,"...").concat(P);wt.length>27;)wt.pop();return"".concat(z.notIdentical,` + +`).concat(wt.join(` +`),` +`)}ut>3&&(et=` +`.concat(h,"...").concat(P).concat(et),Z=!0),rt!==""&&(et=` + `.concat(rt).concat(et),rt="");var Ct=0,It=z[G]+` +`.concat(b,"+ actual").concat(P," ").concat(_,"- expected").concat(P),Nt=" ".concat(h,"...").concat(P," Lines skipped");for(ut=0;ut1&&ut>2&&(te>4?(ct+=` +`.concat(h,"...").concat(P),Z=!0):te>3&&(ct+=` + `.concat(Q[ut-2]),Ct++),ct+=` + `.concat(Q[ut-1]),Ct++),st=ut,rt+=` +`.concat(_,"-").concat(P," ").concat(Q[ut]),Ct++;else if(Q.length1&&ut>2&&(te>4?(ct+=` +`.concat(h,"...").concat(P),Z=!0):te>3&&(ct+=` + `.concat(X[ut-2]),Ct++),ct+=` + `.concat(X[ut-1]),Ct++),st=ut,ct+=` +`.concat(b,"+").concat(P," ").concat(X[ut]),Ct++;else{var Jt=Q[ut],ee=X[ut],Zt=ee!==Jt&&(!T(ee,",")||ee.slice(0,-1)!==Jt);Zt&&T(Jt,",")&&Jt.slice(0,-1)===ee&&(Zt=!1,ee+=","),Zt?(te>1&&ut>2&&(te>4?(ct+=` +`.concat(h,"...").concat(P),Z=!0):te>3&&(ct+=` + `.concat(X[ut-2]),Ct++),ct+=` + `.concat(X[ut-1]),Ct++),st=ut,ct+=` +`.concat(b,"+").concat(P," ").concat(ee),rt+=` +`.concat(_,"-").concat(P," ").concat(Jt),Ct+=2):(ct+=rt,rt="",(te===1||ut===0)&&(ct+=` + `.concat(ee),Ct++))}if(Ct>20&&ut30)for(q[26]="".concat(h,"...").concat(P);q.length>27;)q.pop();q.length===1?st=G.call(this,"".concat(J," ").concat(q[0])):st=G.call(this,"".concat(J,` + +`).concat(q.join(` +`),` +`))}else{var it=R(X),nt="",dt=z[Z];Z==="notDeepEqual"||Z==="notEqual"?(it="".concat(z[Z],` + +`).concat(it),it.length>1024&&(it="".concat(it.slice(0,1021),"..."))):(nt="".concat(R(Q)),it.length>512&&(it="".concat(it.slice(0,509),"...")),nt.length>512&&(nt="".concat(nt.slice(0,509),"...")),Z==="deepEqual"||Z==="equal"?it="".concat(dt,` + +`).concat(it,` + +should equal + +`):nt=" ".concat(Z," ").concat(nt)),st=G.call(this,"".concat(it).concat(nt))}return Error.stackTraceLimit=ut,st.generatedMessage=!et,Object.defineProperty(s(st),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),st.code="ERR_ASSERTION",st.actual=X,st.expected=Q,st.operator=Z,Error.captureStackTrace&&Error.captureStackTrace(s(st),ot),st.stack,st.name="AssertionError",a(st)}return e(rt,[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:N,value:function(ct,st){return S(this,d(d({},st),{},{customInspect:!1,depth:0}))}}]),rt})(f(Error),S.custom);V.exports=F}),aw=Vt((K,V)=>{var u=Object.prototype.toString;V.exports=function(d){var E=u.call(d),A=E==="[object Arguments]";return A||(A=E!=="[object Array]"&&d!==null&&typeof d=="object"&&typeof d.length=="number"&&d.length>=0&&u.call(d.callee)==="[object Function]"),A}}),BM=Vt((K,V)=>{var u;Object.keys||(d=Object.prototype.hasOwnProperty,E=Object.prototype.toString,A=aw(),t=Object.prototype.propertyIsEnumerable,e=!t.call({toString:null},"toString"),r=t.call(function(){},"prototype"),i=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],n=function(f){var v=f.constructor;return v&&v.prototype===f},o={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},a=(function(){if(typeof window>"u")return!1;for(var f in window)try{if(!o["$"+f]&&d.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{n(window[f])}catch{return!0}}catch{return!0}return!1})(),s=function(f){if(typeof window>"u"||!a)return n(f);try{return n(f)}catch{return!1}},u=function(f){var v=f!==null&&typeof f=="object",g=E.call(f)==="[object Function]",m=A(f),w=v&&E.call(f)==="[object String]",l=[];if(!v&&!g&&!m)throw new TypeError("Object.keys called on a non-object");var x=r&&g;if(w&&f.length>0&&!d.call(f,0))for(var y=0;y0)for(var S=0;S{var u=Array.prototype.slice,d=aw(),E=Object.keys,A=E?function(e){return E(e)}:BM(),t=Object.keys;A.shim=function(){if(Object.keys){var e=(function(){var r=Object.keys(arguments);return r&&r.length===arguments.length})(1,2);e||(Object.keys=function(r){return d(r)?t(u.call(r)):t(r)})}else Object.keys=A;return Object.keys||A},V.exports=A}),RM=Vt((K,V)=>{var u=iw(),d=N1()(),E=Nm(),A=Object,t=E("Array.prototype.push"),e=E("Object.prototype.propertyIsEnumerable"),r=d?Object.getOwnPropertySymbols:null;V.exports=function(i,n){if(i==null)throw new TypeError("target must be an object");var o=A(i);if(arguments.length===1)return o;for(var a=1;a{var u=RM(),d=function(){if(!Object.assign)return!1;for(var A="abcdefghijklmnopqrst",t=A.split(""),e={},r=0;r{var u=function(d){return d!==d};V.exports=function(d,E){return d===0&&E===0?1/d===1/E:!!(d===E||u(d)&&u(E))}}),H1=Vt((K,V)=>{var u=ow();V.exports=function(){return typeof Object.is=="function"?Object.is:u}}),sv=Vt((K,V)=>{var u=iw(),d=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",E=Object.prototype.toString,A=Array.prototype.concat,t=Object.defineProperty,e=function(a){return typeof a=="function"&&E.call(a)==="[object Function]"},r=W2()(),i=t&&r,n=function(a,s,f,v){if(s in a){if(v===!0){if(a[s]===f)return}else if(!e(v)||!v())return}i?t(a,s,{configurable:!0,enumerable:!1,value:f,writable:!0}):a[s]=f},o=function(a,s){var f=arguments.length>2?arguments[2]:{},v=u(s);d&&(v=A.call(v,Object.getOwnPropertySymbols(s)));for(var g=0;g{var u=H1(),d=sv();V.exports=function(){var E=u();return d(Object,{is:E},{is:function(){return Object.is!==E}}),E}}),UM=Vt((K,V)=>{var u=sv(),d=ov(),E=ow(),A=H1(),t=jM(),e=d(A(),Object);u(e,{getPolyfill:A,implementation:E,shim:t}),V.exports=e}),sw=Vt((K,V)=>{V.exports=function(u){return u!==u}}),lw=Vt((K,V)=>{var u=sw();V.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:u}}),VM=Vt((K,V)=>{var u=sv(),d=lw();V.exports=function(){var E=d();return u(Number,{isNaN:E},{isNaN:function(){return Number.isNaN!==E}}),E}}),HM=Vt((K,V)=>{var u=ov(),d=sv(),E=sw(),A=lw(),t=VM(),e=u(A(),Number);d(e,{getPolyfill:A,implementation:E,shim:t}),V.exports=e}),qM=Vt((K,V)=>{function u(Zt,mt){return e(Zt)||t(Zt,mt)||E(Zt,mt)||d()}function d(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(Zt,mt){if(Zt){if(typeof Zt=="string")return A(Zt,mt);var bt=Object.prototype.toString.call(Zt).slice(8,-1);if(bt==="Object"&&Zt.constructor&&(bt=Zt.constructor.name),bt==="Map"||bt==="Set")return Array.from(Zt);if(bt==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(bt))return A(Zt,mt)}}function A(Zt,mt){(mt==null||mt>Zt.length)&&(mt=Zt.length);for(var bt=0,vt=new Array(mt);bt10)return!0;for(var mt=0;mt57)return!0}return Zt.length===10&&Zt>=Math.pow(2,32)}function F(Zt){return Object.keys(Zt).filter(I).concat(s(Zt).filter(Object.prototype.propertyIsEnumerable.bind(Zt)))}function j(Zt,mt){if(Zt===mt)return 0;for(var bt=Zt.length,vt=mt.length,Ut=0,re=Math.min(bt,vt);Ut{function u(st){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(et){return typeof et}:function(et){return et&&typeof Symbol=="function"&&et.constructor===Symbol&&et!==Symbol.prototype?"symbol":typeof et},u(st)}function d(st,et,Z){return Object.defineProperty(st,"prototype",{writable:!1}),st}function E(st,et){if(!(st instanceof et))throw new TypeError("Cannot call a class as a function")}var A=nw(),t=A.codes,e=t.ERR_AMBIGUOUS_ARGUMENT,r=t.ERR_INVALID_ARG_TYPE,i=t.ERR_INVALID_ARG_VALUE,n=t.ERR_INVALID_RETURN_VALUE,o=t.ERR_MISSING_ARGS,a=FM(),s=jm(),f=s.inspect,v=jm().types,g=v.isPromise,m=v.isRegExp,w=NM()(),l=H1()(),x=Nm()("RegExp.prototype.test"),y,S;function k(){var st=qM();y=st.isDeepEqual,S=st.isDeepStrictEqual}var M=!1,T=V.exports=P,c={};function h(st){throw st.message instanceof Error?st.message:new a(st)}function b(st,et,Z,ot,X){var Q=arguments.length,ut;if(Q===0)ut="Failed";else if(Q===1)Z=st,st=void 0;else{if(M===!1){M=!0;var J=process.emitWarning?process.emitWarning:console.warn.bind(console);J("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")}Q===2&&(ot="!=")}if(Z instanceof Error)throw Z;var q={actual:st,expected:et,operator:ot===void 0?"fail":ot,stackStartFn:X||b};Z!==void 0&&(q.message=Z);var it=new a(q);throw ut&&(it.message=ut,it.generatedMessage=!0),it}T.fail=b,T.AssertionError=a;function _(st,et,Z,ot){if(!Z){var X=!1;if(et===0)X=!0,ot="No value argument passed to `assert.ok()`";else if(ot instanceof Error)throw ot;var Q=new a({actual:Z,expected:!0,message:ot,operator:"==",stackStartFn:st});throw Q.generatedMessage=X,Q}}function P(){for(var st=arguments.length,et=new Array(st),Z=0;Z1?Z-1:0),X=1;X1?Z-1:0),X=1;X1?Z-1:0),X=1;X1?Z-1:0),X=1;X{var u=1e3,d=u*60,E=d*60,A=E*24,t=A*365.25;V.exports=function(o,a){a=a||{};var s=typeof o;if(s==="string"&&o.length>0)return e(o);if(s==="number"&&isNaN(o)===!1)return a.long?i(o):r(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))};function e(o){if(o=String(o),!(o.length>100)){var a=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(o);if(a){var s=parseFloat(a[1]),f=(a[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return s*t;case"days":case"day":case"d":return s*A;case"hours":case"hour":case"hrs":case"hr":case"h":return s*E;case"minutes":case"minute":case"mins":case"min":case"m":return s*d;case"seconds":case"second":case"secs":case"sec":case"s":return s*u;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}function r(o){return o>=A?Math.round(o/A)+"d":o>=E?Math.round(o/E)+"h":o>=d?Math.round(o/d)+"m":o>=u?Math.round(o/u)+"s":o+"ms"}function i(o){return n(o,A,"day")||n(o,E,"hour")||n(o,d,"minute")||n(o,u,"second")||o+" ms"}function n(o,a,s){if(!(o{K=V.exports=E.debug=E.default=E,K.coerce=r,K.disable=t,K.enable=A,K.enabled=e,K.humanize=WM(),K.names=[],K.skips=[],K.formatters={};var u;function d(i){var n=0,o;for(o in i)n=(n<<5)-n+i.charCodeAt(o),n|=0;return K.colors[Math.abs(n)%K.colors.length]}function E(i){function n(){if(n.enabled){var o=n,a=+new Date,s=a-(u||a);o.diff=s,o.prev=u,o.curr=a,u=a;for(var f=new Array(arguments.length),v=0;v{K=V.exports=GM(),K.log=E,K.formatArgs=d,K.save=A,K.load=t,K.useColors=u,K.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:e(),K.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function u(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}K.formatters.j=function(r){try{return JSON.stringify(r)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}};function d(r){var i=this.useColors;if(r[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+r[0]+(i?"%c ":" ")+"+"+K.humanize(this.diff),!!i){var n="color: "+this.color;r.splice(1,0,n,"color: inherit");var o=0,a=0;r[0].replace(/%[a-zA-Z%]/g,function(s){s!=="%%"&&(o++,s==="%c"&&(a=o))}),r.splice(a,0,n)}}function E(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function A(r){try{r==null?K.storage.removeItem("debug"):K.storage.debug=r}catch{}}function t(){var r;try{r=K.storage.debug}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=n0.DEBUG),r}K.enable(t());function e(){try{return window.localStorage}catch{}}}),KM=Vt((K,V)=>{var u=lv(),d=ZM()("stream-parser");V.exports=r;var E=-1,A=0,t=1,e=2;function r(l){var x=l&&typeof l._transform=="function",y=l&&typeof l._write=="function";if(!x&&!y)throw new Error("must pass a Writable or Transform stream in");d("extending Parser into stream"),l._bytes=n,l._skipBytes=o,x&&(l._passthrough=a),x?l._transform=f:l._write=s}function i(l){d("initializing parser stream"),l._parserBytesLeft=0,l._parserBuffers=[],l._parserBuffered=0,l._parserState=E,l._parserCallback=null,typeof l.push=="function"&&(l._parserOutput=l.push.bind(l)),l._parserInit=!0}function n(l,x){u(!this._parserCallback,'there is already a "callback" set!'),u(isFinite(l)&&l>0,'can only buffer a finite number of bytes > 0, got "'+l+'"'),this._parserInit||i(this),d("buffering %o bytes",l),this._parserBytesLeft=l,this._parserCallback=x,this._parserState=A}function o(l,x){u(!this._parserCallback,'there is already a "callback" set!'),u(l>0,'can only skip > 0 bytes, got "'+l+'"'),this._parserInit||i(this),d("skipping %o bytes",l),this._parserBytesLeft=l,this._parserCallback=x,this._parserState=t}function a(l,x){u(!this._parserCallback,'There is already a "callback" set!'),u(l>0,'can only pass through > 0 bytes, got "'+l+'"'),this._parserInit||i(this),d("passing through %o bytes",l),this._parserBytesLeft=l,this._parserCallback=x,this._parserState=e}function s(l,x,y){this._parserInit||i(this),d("write(%o bytes)",l.length),typeof x=="function"&&(y=x),m(this,l,null,y)}function f(l,x,y){this._parserInit||i(this),d("transform(%o bytes)",l.length),typeof x!="function"&&(x=this._parserOutput),m(this,l,x,y)}function v(l,x,y,S){return l._parserBytesLeft<=0?S(new Error("got data but not currently parsing anything")):x.length<=l._parserBytesLeft?function(){return g(l,x,y,S)}:function(){var k=x.slice(0,l._parserBytesLeft);return g(l,k,y,function(M){if(M)return S(M);if(x.length>k.length)return function(){return v(l,x.slice(k.length),y,S)}})}}function g(l,x,y,S){if(l._parserBytesLeft-=x.length,d("%o bytes left for stream piece",l._parserBytesLeft),l._parserState===A?(l._parserBuffers.push(x),l._parserBuffered+=x.length):l._parserState===e&&y(x),l._parserBytesLeft===0){var k=l._parserCallback;if(k&&l._parserState===A&&l._parserBuffers.length>1&&(x=Buffer.concat(l._parserBuffers,l._parserBuffered)),l._parserState!==A&&(x=null),l._parserCallback=null,l._parserBuffered=0,l._parserState=E,l._parserBuffers.splice(0),k){var M=[];x&&M.push(x),y&&M.push(y);var T=k.length>M.length;T&&M.push(w(S));var c=k.apply(l,M);if(!T||S===c)return S}}else return S}var m=w(v);function w(l){return function(){for(var x=l.apply(this,arguments);typeof x=="function";)x=x();return x}}}),_u=Vt(K=>{var V=DM().Transform,u=KM();function d(){V.call(this,{readableObjectMode:!0})}d.prototype=Object.create(V.prototype),d.prototype.constructor=d,u(d.prototype),K.ParserStream=d,K.sliceEq=function(A,t,e){for(var r=t,i=0;i{var u=_u().readUInt16BE,d=_u().readUInt32BE;function E(a,s){if(a.length<4+s)return null;var f=d(a,s);return a.length>4&15,v=a[4]&15,g=a[5]>>4&15,m=u(a,6),w=8,l=0;lm.width||g.width===m.width&&g.height>m.height?g:m}),f=a.reduce(function(g,m){return g.height>m.height||g.height===m.height&&g.width>m.width?g:m}),v;return s.width>f.height||s.width===f.height&&s.height>f.width?v=s:v=f,v}V.exports.readSizeFromMeta=function(a){var s={sizes:[],transforms:[],item_inf:{},item_loc:{}};if(n(a,s),!!s.sizes.length){var f=o(s.sizes),v=1;s.transforms.forEach(function(m){var w={1:6,2:5,3:8,4:7,5:4,6:3,7:2,8:1},l={1:4,2:3,3:2,4:1,5:6,6:5,7:8,8:7};if(m.type==="imir"&&(m.value===0?v=l[v]:(v=l[v],v=w[v],v=w[v])),m.type==="irot")for(var x=0;x{function u(A,t){var e=new Error(A);return e.code=t,e}function d(A){try{return decodeURIComponent(escape(A))}catch{return A}}function E(A,t,e){this.input=A.subarray(t,e),this.start=t;var r=String.fromCharCode.apply(null,this.input.subarray(0,4));if(r!=="II*\0"&&r!=="MM\0*")throw u("invalid TIFF signature","EBADDATA");this.big_endian=r[0]==="M"}E.prototype.each=function(A){this.aborted=!1;var t=this.read_uint32(4);for(this.ifds_to_read=[{id:0,offset:t}];this.ifds_to_read.length>0&&!this.aborted;){var e=this.ifds_to_read.shift();e.offset&&this.scan_ifd(e.id,e.offset,A)}},E.prototype.read_uint16=function(A){var t=this.input;if(A+2>t.length)throw u("unexpected EOF","EBADDATA");return this.big_endian?t[A]*256+t[A+1]:t[A]+t[A+1]*256},E.prototype.read_uint32=function(A){var t=this.input;if(A+4>t.length)throw u("unexpected EOF","EBADDATA");return this.big_endian?t[A]*16777216+t[A+1]*65536+t[A+2]*256+t[A+3]:t[A]+t[A+1]*256+t[A+2]*65536+t[A+3]*16777216},E.prototype.is_subifd_link=function(A,t){return A===0&&t===34665||A===0&&t===34853||A===34665&&t===40965},E.prototype.exif_format_length=function(A){switch(A){case 1:case 2:case 6:case 7:return 1;case 3:case 8:return 2;case 4:case 9:case 11:return 4;case 5:case 10:case 12:return 8;default:return 0}},E.prototype.exif_format_read=function(A,t){var e;switch(A){case 1:case 2:return e=this.input[t],e;case 6:return e=this.input[t],e|(e&128)*33554430;case 3:return e=this.read_uint16(t),e;case 8:return e=this.read_uint16(t),e|(e&32768)*131070;case 4:return e=this.read_uint32(t),e;case 9:return e=this.read_uint32(t),e|0;case 5:case 10:case 11:case 12:return null;case 7:return null;default:return null}},E.prototype.scan_ifd=function(A,t,e){var r=this.read_uint16(t);t+=2;for(var i=0;ithis.input.length)throw u("unexpected EOF","EBADDATA");for(var m=[],w=v,l=0;l0&&(this.ifds_to_read.push({id:n,offset:m[0]}),g=!0);var y={is_big_endian:this.big_endian,ifd:A,tag:n,format:o,count:a,entry_offset:t+this.start,data_length:f,data_offset:v+this.start,value:m,is_subifd_link:g};if(e(y)===!1){this.aborted=!0;return}t+=12}A===0&&this.ifds_to_read.push({id:1,offset:this.read_uint32(t)})},V.exports.ExifParser=E,V.exports.get_orientation=function(A){var t=0;try{return new E(A,0,A.length).each(function(e){if(e.ifd===0&&e.tag===274&&Array.isArray(e.value))return t=e.value[0],!1}),t}catch{return-1}}}),XM=Vt((K,V)=>{var u=_u().str2arr,d=_u().sliceEq,E=_u().readUInt32BE,A=YM(),t=q1(),e=u("ftyp");V.exports=function(r){if(d(r,4,e)){var i=A.unbox(r,0);if(i){var n=A.getMimeType(i.data);if(n){for(var o,a=i.end;;){var s=A.unbox(r,a);if(!s)break;if(a=s.end,s.boxtype==="mdat")return;if(s.boxtype==="meta"){o=s.data;break}}if(o){var f=A.readSizeFromMeta(o);if(f){var v={width:f.width,height:f.height,type:n.type,mime:n.mime,wUnits:"px",hUnits:"px"};if(f.variants.length>1&&(v.variants=f.variants),f.orientation&&(v.orientation=f.orientation),f.exif_location&&f.exif_location.offset+f.exif_location.length<=r.length){var g=E(r,f.exif_location.offset),m=r.slice(f.exif_location.offset+g+4,f.exif_location.offset+f.exif_location.length),w=t.get_orientation(m);w>0&&(v.orientation=w)}return v}}}}}}}),$M=Vt((K,V)=>{var u=_u().str2arr,d=_u().sliceEq,E=_u().readUInt16LE,A=u("BM");V.exports=function(t){if(!(t.length<26)&&d(t,0,A))return{width:E(t,18),height:E(t,22),type:"bmp",mime:"image/bmp",wUnits:"px",hUnits:"px"}}}),JM=Vt((K,V)=>{var u=_u().str2arr,d=_u().sliceEq,E=_u().readUInt16LE,A=u("GIF87a"),t=u("GIF89a");V.exports=function(e){if(!(e.length<10)&&!(!d(e,0,A)&&!d(e,0,t)))return{width:E(e,6),height:E(e,8),type:"gif",mime:"image/gif",wUnits:"px",hUnits:"px"}}}),QM=Vt((K,V)=>{var u=_u().readUInt16LE,d=0,E=1,A=16;V.exports=function(t){var e=u(t,0),r=u(t,2),i=u(t,4);if(!(e!==d||r!==E||!i)){for(var n=[],o={width:0,height:0},a=0;ao.width||f>o.height)&&(o=v)}return{width:o.width,height:o.height,variants:n,type:"ico",mime:"image/x-icon",wUnits:"px",hUnits:"px"}}}}),tS=Vt((K,V)=>{var u=_u().readUInt16BE,d=_u().str2arr,E=_u().sliceEq,A=q1(),t=d("Exif\0\0");V.exports=function(e){if(!(e.length<2)&&!(e[0]!==255||e[1]!==216||e[2]!==255))for(var r=2;;){for(;;){if(e.length-r<2)return;if(e[r++]===255)break}for(var i=e[r++],n;i===255;)i=e[r++];if(208<=i&&i<=217||i===1)n=0;else if(192<=i&&i<=254){if(e.length-r<2)return;n=u(e,r)-2,r+=2}else return;if(i===217||i===218)return;var o;if(i===225&&n>=10&&E(e,r,t)&&(o=A.get_orientation(e.slice(r+6,r+n))),n>=5&&192<=i&&i<=207&&i!==196&&i!==200&&i!==204){if(e.length-r0&&(a.orientation=o),a}r+=n}}}),eS=Vt((K,V)=>{var u=_u().str2arr,d=_u().sliceEq,E=_u().readUInt32BE,A=u(`‰PNG\r + +`),t=u("IHDR");V.exports=function(e){if(!(e.length<24)&&d(e,0,A)&&d(e,12,t))return{width:E(e,16),height:E(e,20),type:"png",mime:"image/png",wUnits:"px",hUnits:"px"}}}),rS=Vt((K,V)=>{var u=_u().str2arr,d=_u().sliceEq,E=_u().readUInt32BE,A=u("8BPS\0");V.exports=function(t){if(!(t.length<22)&&d(t,0,A))return{width:E(t,18),height:E(t,14),type:"psd",mime:"image/vnd.adobe.photoshop",wUnits:"px",hUnits:"px"}}}),nS=Vt((K,V)=>{function u(s){return s===32||s===9||s===13||s===10}function d(s){return typeof s=="number"&&isFinite(s)&&s>0}function E(s){var f=0,v=s.length;for(s[0]===239&&s[1]===187&&s[2]===191&&(f=3);f]*>/,t=/^<([-_.:a-zA-Z0-9]+:)?svg\s/,e=/[^-]\bwidth="([^%]+?)"|[^-]\bwidth='([^%]+?)'/,r=/\bheight="([^%]+?)"|\bheight='([^%]+?)'/,i=/\bview[bB]ox="(.+?)"|\bview[bB]ox='(.+?)'/,n=/in$|mm$|cm$|pt$|pc$|px$|em$|ex$/;function o(s){var f=s.match(e),v=s.match(r),g=s.match(i);return{width:f&&(f[1]||f[2]),height:v&&(v[1]||v[2]),viewbox:g&&(g[1]||g[2])}}function a(s){return n.test(s)?s.match(n)[0]:"px"}V.exports=function(s){if(E(s)){for(var f="",v=0;v{var u=_u().str2arr,d=_u().sliceEq,E=_u().readUInt16LE,A=_u().readUInt16BE,t=_u().readUInt32LE,e=_u().readUInt32BE,r=u("II*\0"),i=u("MM\0*");function n(s,f,v){return v?A(s,f):E(s,f)}function o(s,f,v){return v?e(s,f):t(s,f)}function a(s,f,v){var g=n(s,f+2,v),m=o(s,f+4,v);return m!==1||g!==3&&g!==4?null:g===3?n(s,f+8,v):o(s,f+8,v)}V.exports=function(s){if(!(s.length<8)&&!(!d(s,0,r)&&!d(s,0,i))){var f=s[0]===77,v=o(s,4,f)-8;if(!(v<0)){var g=v+8;if(!(s.length-g<2)){var m=n(s,g+0,f)*12;if(!(m<=0)&&(g+=2,!(s.length-g{var u=_u().str2arr,d=_u().sliceEq,E=_u().readUInt16LE,A=_u().readUInt32LE,t=q1(),e=u("RIFF"),r=u("WEBP");function i(a,s){if(!(a[s+3]!==157||a[s+4]!==1||a[s+5]!==42))return{width:E(a,s+6)&16383,height:E(a,s+8)&16383,type:"webp",mime:"image/webp",wUnits:"px",hUnits:"px"}}function n(a,s){if(a[s]===47){var f=A(a,s+1);return{width:(f&16383)+1,height:(f>>14&16383)+1,type:"webp",mime:"image/webp",wUnits:"px",hUnits:"px"}}}function o(a,s){return{width:(a[s+6]<<16|a[s+5]<<8|a[s+4])+1,height:(a[s+9]<a.length)){for(;s+8=10?f=f||i(a,s+8):m==="VP8L"&&w>=9?f=f||n(a,s+8):m==="VP8X"&&w>=10?f=f||o(a,s+8):m==="EXIF"&&(v=t.get_orientation(a.slice(s+8,s+8+w)),s=1/0),s+=8+w}if(f)return v>0&&(f.orientation=v),f}}}}),oS=Vt((K,V)=>{V.exports={avif:XM(),bmp:$M(),gif:JM(),ico:QM(),jpeg:tS(),png:eS(),psd:rS(),svg:nS(),tiff:aS(),webp:iS()}}),sS=Vt((K,V)=>{var u=oS();function d(E){for(var A=Object.keys(u),t=0;t{var V=sS(),u=Bp().IMAGE_URL_PREFIX,d=v0().Buffer;K.getImageSize=function(E){var A=E.replace(u,""),t=new d(A,"base64");return V(t)}}),uS=Vt((K,V)=>{var u=Xr(),d=Fm(),E=Lo(),A=yo(),t=Xr().maxRowLength,e=lS().getImageSize;V.exports=function(o,a){var s,f;if(a._hasZ)s=a.z.length,f=t(a.z);else if(a._hasSource){var v=e(a.source);s=v.height,f=v.width}var g=A.getFromId(o,a.xaxis||"x"),m=A.getFromId(o,a.yaxis||"y"),w=g.d2c(a.x0)-a.dx/2,l=m.d2c(a.y0)-a.dy/2,x,y=[w,w+f*a.dx],S=[l,l+s*a.dy];if(g&&g.type==="log")for(x=0;x{var u=Ni(),d=Xr(),E=d.strTranslate,A=zh(),t=Fm(),e=h2(),r=A1().STYLE;V.exports=function(i,n,o,a){var s=n.xaxis,f=n.yaxis,v=!i._context._exportedPlot&&e();d.makeTraceGroups(a,o,"im").each(function(g){var m=u.select(this),w=g[0],l=w.trace,x=(l.zsmooth==="fast"||l.zsmooth===!1&&v)&&!l._hasZ&&l._hasSource&&s.type==="linear"&&f.type==="linear";l._realImage=x;var y=w.z,S=w.x0,k=w.y0,M=w.w,T=w.h,c=l.dx,h=l.dy,b,_,P,z,D,B;for(B=0;b===void 0&&B0;)_=s.c2p(S+B*c),B--;for(B=0;z===void 0&&B0;)D=f.c2p(k+B*h),B--;if(_et[0];if(Z||ot){var X=b+I/2,Q=z+F/2;ct+="transform:"+E(X+"px",Q+"px")+"scale("+(Z?-1:1)+","+(ot?-1:1)+")"+E(-X+"px",-Q+"px")+";"}}rt.attr("style",ct);var ut=new Promise(function(J){if(l._hasZ)J();else if(l._hasSource)if(l._canvas&&l._canvas.el.width===M&&l._canvas.el.height===T&&l._canvas.source===l.source)J();else{var q=document.createElement("canvas");q.width=M,q.height=T;var it=q.getContext("2d",{willReadFrequently:!0});l._image=l._image||new Image;var nt=l._image;nt.onload=function(){it.drawImage(nt,0,0),l._canvas={el:q,source:l.source},J()},nt.setAttribute("src",l.source)}}).then(function(){var J,q;if(l._hasZ)q=G(function(dt,Tt){var wt=y[Tt][dt];return d.isTypedArray(wt)&&(wt=Array.from(wt)),wt}),J=q.toDataURL("image/png");else if(l._hasSource)if(x)J=l.source;else{var it=l._canvas.el.getContext("2d",{willReadFrequently:!0}),nt=it.getImageData(0,0,M,T).data;q=G(function(dt,Tt){var wt=4*(Tt*M+dt);return[nt[wt],nt[wt+1],nt[wt+2],nt[wt+3]]}),J=q.toDataURL("image/png")}rt.attr({"xlink:href":J,height:F,width:I,x:b,y:z})});i._promises.push(ut)})}}),fS=Vt((K,V)=>{var u=Ni();V.exports=function(d){u.select(d).selectAll(".im image").style("opacity",function(E){return E[0].trace.opacity})}}),hS=Vt((K,V)=>{var u=pc(),d=Xr(),E=d.isArrayOrTypedArray,A=Fm();V.exports=function(t,e,r){var i=t.cd[0],n=i.trace,o=t.xa,a=t.ya;if(!(u.inbox(e-i.x0,e-(i.x0+i.w*n.dx),0)>0||u.inbox(r-i.y0,r-(i.y0+i.h*n.dy),0)>0)){var s=Math.floor((e-i.x0)/n.dx),f=Math.floor(Math.abs(r-i.y0)/n.dy),v;if(n._hasZ?v=i.z[f][s]:n._hasSource&&(v=n._canvas.el.getContext("2d",{willReadFrequently:!0}).getImageData(s,f,1,1).data),!!v){var g=i.hi||n.hoverinfo,m;if(g){var w=g.split("+");w.indexOf("all")!==-1&&(w=["color"]),w.indexOf("color")!==-1&&(m=!0)}var l=A.colormodel[n.colormodel],x=l.colormodel||n.colormodel,y=x.length,S=n._scaler(v),k=l.suffix,M=[];(n.hovertemplate||m)&&(M.push("["+[S[0]+k[0],S[1]+k[1],S[2]+k[2]].join(", ")),y===4&&M.push(", "+S[3]+k[3]),M.push("]"),M=M.join(""),t.extraText=x.toUpperCase()+": "+M);var T;E(n.hovertext)&&E(n.hovertext[f])?T=n.hovertext[f][s]:E(n.text)&&E(n.text[f])&&(T=n.text[f][s]);var c=a.c2p(i.y0+(f+.5)*n.dy),h=i.x0+(s+.5)*n.dx,b=i.y0+(f+.5)*n.dy,_="["+v.slice(0,n.colormodel.length).join(", ")+"]";return[d.extendFlat(t,{index:[f,s],x0:o.c2p(i.x0+s*n.dx),x1:o.c2p(i.x0+(s+1)*n.dx),y0:c,y1:c,color:S,xVal:h,xLabelVal:h,yVal:b,yLabelVal:b,zLabelVal:_,text:T,hovertemplateLabels:{zLabel:_,colorLabel:M,"color[0]Label":S[0]+k[0],"color[1]Label":S[1]+k[1],"color[2]Label":S[2]+k[2],"color[3]Label":S[3]+k[3]}})]}}}}),pS=Vt((K,V)=>{V.exports=function(u,d){return"xVal"in d&&(u.x=d.xVal),"yVal"in d&&(u.y=d.yVal),d.xa&&(u.xaxis=d.xa),d.ya&&(u.yaxis=d.ya),u.color=d.color,u.colormodel=d.trace.colormodel,u.z||(u.z=d.color),u}}),dS=Vt((K,V)=>{V.exports={attributes:R2(),supplyDefaults:XA(),calc:uS(),plot:cS(),style:fS(),hoverPoints:hS(),eventData:pS(),moduleType:"trace",name:"image",basePlotModule:Yc(),categories:["cartesian","svg","2dMap","noSortingByValue"],animatable:!1,meta:{}}}),mS=Vt((K,V)=>{V.exports=dS()}),b0=Vt((K,V)=>{var u=kl(),d=Hu().attributes,E=yu(),A=af(),{hovertemplateAttrs:t,texttemplateAttrs:e,templatefallbackAttrs:r}=yl(),i=So().extendFlat,n=If().pattern,o=E({editType:"plot",arrayOk:!0,colorEditType:"plot"});V.exports={labels:{valType:"data_array",editType:"calc"},label0:{valType:"number",dflt:0,editType:"calc"},dlabel:{valType:"number",dflt:1,editType:"calc"},values:{valType:"data_array",editType:"calc"},marker:{colors:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:A.defaultLine,arrayOk:!0,editType:"style"},width:{valType:"number",min:0,dflt:0,arrayOk:!0,editType:"style"},editType:"calc"},pattern:n,editType:"calc"},text:{valType:"data_array",editType:"plot"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"style"},scalegroup:{valType:"string",dflt:"",editType:"calc"},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"],editType:"calc"},hoverinfo:i({},u.hoverinfo,{flags:["label","text","value","percent","name"]}),hovertemplate:t({},{keys:["label","color","value","percent","text"]}),hovertemplatefallback:r(),texttemplate:e({editType:"plot"},{keys:["label","color","value","percent","text"]}),texttemplatefallback:r({editType:"plot"}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0,editType:"plot"},textfont:i({},o,{}),insidetextorientation:{valType:"enumerated",values:["horizontal","radial","tangential","auto"],dflt:"auto",editType:"plot"},insidetextfont:i({},o,{}),outsidetextfont:i({},o,{}),automargin:{valType:"boolean",dflt:!1,editType:"plot"},showlegend:i({},u.showlegend,{arrayOk:!0}),legend:i({},u.legend,{arrayOk:!0}),title:{text:{valType:"string",dflt:"",editType:"plot"},font:i({},o,{}),position:{valType:"enumerated",values:["top left","top center","top right","middle center","bottom left","bottom center","bottom right"],editType:"plot"},editType:"plot"},domain:d({name:"pie",trace:!0,editType:"calc"}),hole:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},sort:{valType:"boolean",dflt:!0,editType:"calc"},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise",editType:"calc"},rotation:{valType:"angle",dflt:0,editType:"calc"},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0,editType:"calc"}}}),w0=Vt((K,V)=>{var u=Lo(),d=Xr(),E=b0(),A=Hu().defaults,t=Ch().handleText,e=Xr().coercePattern;function r(o,a){var s=d.isArrayOrTypedArray(o),f=d.isArrayOrTypedArray(a),v=Math.min(s?o.length:1/0,f?a.length:1/0);if(isFinite(v)||(v=0),v&&f){for(var g,m=0;m0){g=!0;break}}g||(v=0)}return{hasLabels:s,hasValues:f,len:v}}function i(o,a,s,f,v){var g=f("marker.line.width");g&&f("marker.line.color",v?void 0:s.paper_bgcolor);var m=f("marker.colors");e(f,"marker.pattern",m),o.marker&&!a.marker.pattern.fgcolor&&(a.marker.pattern.fgcolor=o.marker.colors),a.marker.pattern.bgcolor||(a.marker.pattern.bgcolor=s.paper_bgcolor)}function n(o,a,s,f){function v(_,P){return d.coerce(o,a,E,_,P)}var g=v("labels"),m=v("values"),w=r(g,m),l=w.len;if(a._hasLabels=w.hasLabels,a._hasValues=w.hasValues,!a._hasLabels&&a._hasValues&&(v("label0"),v("dlabel")),!l){a.visible=!1;return}a._length=l,i(o,a,f,v,!0),v("scalegroup");var x=v("text"),y=v("texttemplate");v("texttemplatefallback");var S;if(y||(S=v("textinfo",d.isArrayOrTypedArray(x)?"text+percent":"percent")),v("hovertext"),v("hovertemplate"),v("hovertemplatefallback"),y||S&&S!=="none"){var k=v("textposition");t(o,a,f,v,k,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1});var M=Array.isArray(k)||k==="auto",T=M||k==="outside";T&&v("automargin"),(k==="inside"||k==="auto"||Array.isArray(k))&&v("insidetextorientation")}else S==="none"&&v("textposition","none");A(a,f,v);var c=v("hole"),h=v("title.text");if(h){var b=v("title.position",c?"middle center":"top center");!c&&b==="middle center"&&(a.title.position="top center"),d.coerceFont(v,"title.font",f.font)}v("sort"),v("direction"),v("rotation"),v("pull")}V.exports={handleLabelsAndValues:r,handleMarkerDefaults:i,supplyDefaults:n}}),W1=Vt((K,V)=>{V.exports={hiddenlabels:{valType:"data_array",editType:"calc"},piecolorway:{valType:"colorlist",editType:"calc"},extendpiecolors:{valType:"boolean",dflt:!0,editType:"calc"}}}),gS=Vt((K,V)=>{var u=Xr(),d=W1();V.exports=function(E,A){function t(e,r){return u.coerce(E,A,d,e,r)}t("hiddenlabels"),t("piecolorway",A.colorway),t("extendpiecolors")}}),Um=Vt((K,V)=>{var u=Lo(),d=Af(),E=Pi(),A={};function t(n,o){var a=[],s=n._fullLayout,f=s.hiddenlabels||[],v=o.labels,g=o.marker.colors||[],m=o.values,w=o._length,l=o._hasValues&&w,x,y;if(o.dlabel)for(v=new Array(w),x=0;x=0});var P=o.type==="funnelarea"?T:o.sort;return P&&a.sort(function(z,D){return D.v-z.v}),a[0]&&(a[0].vTotal=M),a}function e(n){return function(o,a){return!o||(o=d(o),!o.isValid())?!1:(o=E.addOpacity(o,o.getAlpha()),n[a]||(n[a]=o),o)}}function r(n,o){var a=(o||{}).type;a||(a="pie");var s=n._fullLayout,f=n.calcdata,v=s[a+"colorway"],g=s["_"+a+"colormap"];s["extend"+a+"colors"]&&(v=i(v,A));for(var m=0,w=0;w{var u=mh().appendArrayMultiPointValues;V.exports=function(d,E){var A={curveNumber:E.index,pointNumbers:d.pts,data:E._input,fullData:E,label:d.label,color:d.color,value:d.v,percent:d.percent,text:d.text,bbox:d.bbox,v:d.v};return d.pts.length===1&&(A.pointNumber=A.i=d.pts[0]),u(A,E,d.pts),E.type==="funnelarea"&&(delete A.v,delete A.i),A}}),G1=Vt((K,V)=>{var u=Ni(),d=Vu(),E=pc(),A=Pi(),t=Eo(),e=Xr(),r=e.strScale,i=e.strTranslate,n=Dl(),o=sh(),a=o.recordMinTextSize,s=o.clearMinTextSize,f=m0().TEXTPAD,v=Sd(),g=vS(),m=Xr().isValidTextValue;function w(ot,X){var Q=ot._context.staticPlot,ut=ot._fullLayout,J=ut._size;s("pie",ut),k(X,ot),G(X,J);var q=e.makeTraceGroups(ut._pielayer,X,"trace").each(function(it){var nt=u.select(this),dt=it[0],Tt=dt.trace;ct(it),nt.attr("stroke-linejoin","round"),nt.each(function(){var wt=u.select(this).selectAll("g.slice").data(it);wt.enter().append("g").classed("slice",!0),wt.exit().remove();var Ct=[[[],[]],[[],[]]],It=!1;wt.each(function(vt,Ut){if(vt.hidden){u.select(this).selectAll("path,g").remove();return}vt.pointNumber=vt.i,vt.curveNumber=Tt.index,Ct[vt.pxmid[1]<0?0:1][vt.pxmid[0]<0?0:1].push(vt);var re=dt.cx,Kt=dt.cy,ue=u.select(this),Me=ue.selectAll("path.surface").data([vt]);if(Me.enter().append("path").classed("surface",!0).style({"pointer-events":Q?"none":"all"}),ue.call(x,ot,it),Tt.pull){var Ce=+v.castOption(Tt.pull,vt.pts)||0;Ce>0&&(re+=Ce*vt.pxmid[0],Kt+=Ce*vt.pxmid[1])}vt.cxFinal=re,vt.cyFinal=Kt;function We(de,Dt,qt,_t){var lt=_t*(Dt[0]-de[0]),yt=_t*(Dt[1]-de[1]);return"a"+_t*dt.r+","+_t*dt.r+" 0 "+vt.largeArc+(qt?" 1 ":" 0 ")+lt+","+yt}var qe=Tt.hole;if(vt.v===dt.vTotal){var vr="M"+(re+vt.px0[0])+","+(Kt+vt.px0[1])+We(vt.px0,vt.pxmid,!0,1)+We(vt.pxmid,vt.px0,!0,1)+"Z";qe?Me.attr("d","M"+(re+qe*vt.px0[0])+","+(Kt+qe*vt.px0[1])+We(vt.px0,vt.pxmid,!1,qe)+We(vt.pxmid,vt.px0,!1,qe)+"Z"+vr):Me.attr("d",vr)}else{var _r=We(vt.px0,vt.px1,!0,1);if(qe){var er=1-qe;Me.attr("d","M"+(re+qe*vt.px1[0])+","+(Kt+qe*vt.px1[1])+We(vt.px1,vt.px0,!1,qe)+"l"+er*vt.px0[0]+","+er*vt.px0[1]+_r+"Z")}else Me.attr("d","M"+re+","+Kt+"l"+vt.px0[0]+","+vt.px0[1]+_r+"Z")}et(ot,vt,dt);var Mr=v.castOption(Tt.textposition,vt.pts),Ir=ue.selectAll("g.slicetext").data(vt.text&&Mr!=="none"?[0]:[]);Ir.enter().append("g").classed("slicetext",!0),Ir.exit().remove(),Ir.each(function(){var de=e.ensureSingle(u.select(this),"text","",function(Yt){Yt.attr("data-notex",1)}),Dt=e.ensureUniformFontSize(ot,Mr==="outside"?y(Tt,vt,ut.font):S(Tt,vt,ut.font));de.text(vt.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(t.font,Dt).call(n.convertToTspans,ot);var qt=t.bBox(de.node()),_t;if(Mr==="outside")_t=D(qt,vt);else if(_t=M(qt,vt,dt),Mr==="auto"&&_t.scale<1){var lt=e.ensureUniformFontSize(ot,Tt.outsidetextfont);de.call(t.font,lt),qt=t.bBox(de.node()),_t=D(qt,vt)}var yt=_t.textPosAngle,St=yt===void 0?vt.pxmid:st(dt.r,yt);if(_t.targetX=re+St[0]*_t.rCenter+(_t.x||0),_t.targetY=Kt+St[1]*_t.rCenter+(_t.y||0),Z(_t,qt),_t.outside){var Ht=_t.targetY;vt.yLabelMin=Ht-qt.height/2,vt.yLabelMid=Ht,vt.yLabelMax=Ht+qt.height/2,vt.labelExtraX=0,vt.labelExtraY=0,It=!0}_t.fontSize=Dt.size,a(Tt.type,_t,ut),it[Ut].transform=_t,e.setTransormAndDisplay(de,_t)})});var Nt=u.select(this).selectAll("g.titletext").data(Tt.title.text?[0]:[]);if(Nt.enter().append("g").classed("titletext",!0),Nt.exit().remove(),Nt.each(function(){var vt=e.ensureSingle(u.select(this),"text","",function(Kt){Kt.attr("data-notex",1)}),Ut=Tt.title.text;Tt._meta&&(Ut=e.templateString(Ut,Tt._meta)),vt.text(Ut).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(t.font,Tt.title.font).call(n.convertToTspans,ot);var re;Tt.title.position==="middle center"?re=B(dt):re=R(dt,J),vt.attr("transform",i(re.x,re.y)+r(Math.min(1,re.scale))+i(re.tx,re.ty))}),It&&N(Ct,Tt),l(wt,Tt),It&&Tt.automargin){var te=t.bBox(nt.node()),Jt=Tt.domain,ee=J.w*(Jt.x[1]-Jt.x[0]),Zt=J.h*(Jt.y[1]-Jt.y[0]),mt=(.5*ee-dt.r)/J.w,bt=(.5*Zt-dt.r)/J.h;d.autoMargin(ot,"pie."+Tt.uid+".automargin",{xl:Jt.x[0]-mt,xr:Jt.x[1]+mt,yb:Jt.y[0]-bt,yt:Jt.y[1]+bt,l:Math.max(dt.cx-dt.r-te.left,0),r:Math.max(te.right-(dt.cx+dt.r),0),b:Math.max(te.bottom-(dt.cy+dt.r),0),t:Math.max(dt.cy-dt.r-te.top,0),pad:5})}})});setTimeout(function(){q.selectAll("tspan").each(function(){var it=u.select(this);it.attr("dy")&&it.attr("dy",it.attr("dy"))})},0)}function l(ot,X){ot.each(function(Q){var ut=u.select(this);if(!Q.labelExtraX&&!Q.labelExtraY){ut.select("path.textline").remove();return}var J=ut.select("g.slicetext text");Q.transform.targetX+=Q.labelExtraX,Q.transform.targetY+=Q.labelExtraY,e.setTransormAndDisplay(J,Q.transform);var q=Q.cxFinal+Q.pxmid[0],it=Q.cyFinal+Q.pxmid[1],nt="M"+q+","+it,dt=(Q.yLabelMax-Q.yLabelMin)*(Q.pxmid[0]<0?-1:1)/4;if(Q.labelExtraX){var Tt=Q.labelExtraX*Q.pxmid[1]/Q.pxmid[0],wt=Q.yLabelMid+Q.labelExtraY-(Q.cyFinal+Q.pxmid[1]);Math.abs(Tt)>Math.abs(wt)?nt+="l"+wt*Q.pxmid[0]/Q.pxmid[1]+","+wt+"H"+(q+Q.labelExtraX+dt):nt+="l"+Q.labelExtraX+","+Tt+"v"+(wt-Tt)+"h"+dt}else nt+="V"+(Q.yLabelMid+Q.labelExtraY)+"h"+dt;e.ensureSingle(ut,"path","textline").call(A.stroke,X.outsidetextfont.color).attr({"stroke-width":Math.min(2,X.outsidetextfont.size/8),d:nt,fill:"none"})})}function x(ot,X,Q){var ut=Q[0],J=ut.cx,q=ut.cy,it=ut.trace,nt=it.type==="funnelarea";"_hasHoverLabel"in it||(it._hasHoverLabel=!1),"_hasHoverEvent"in it||(it._hasHoverEvent=!1),ot.on("mouseover",function(dt){var Tt=X._fullLayout,wt=X._fullData[it.index];if(!(X._dragging||Tt.hovermode===!1)){var Ct=wt.hoverinfo;if(Array.isArray(Ct)&&(Ct=E.castHoverinfo({hoverinfo:[v.castOption(Ct,dt.pts)],_module:it._module},Tt,0)),Ct==="all"&&(Ct="label+text+value+percent+name"),wt.hovertemplate||Ct!=="none"&&Ct!=="skip"&&Ct){var It=dt.rInscribed||0,Nt=J+dt.pxmid[0]*(1-It),te=q+dt.pxmid[1]*(1-It),Jt=Tt.separators,ee=[];if(Ct&&Ct.indexOf("label")!==-1&&ee.push(dt.label),dt.text=v.castOption(wt.hovertext||wt.text,dt.pts),Ct&&Ct.indexOf("text")!==-1){var Zt=dt.text;e.isValidTextValue(Zt)&&ee.push(Zt)}dt.value=dt.v,dt.valueLabel=v.formatPieValue(dt.v,Jt),Ct&&Ct.indexOf("value")!==-1&&ee.push(dt.valueLabel),dt.percent=dt.v/ut.vTotal,dt.percentLabel=v.formatPiePercent(dt.percent,Jt),Ct&&Ct.indexOf("percent")!==-1&&ee.push(dt.percentLabel);var mt=wt.hoverlabel,bt=mt.font,vt=[];E.loneHover({trace:it,x0:Nt-It*ut.r,x1:Nt+It*ut.r,y:te,_x0:nt?J+dt.TL[0]:Nt-It*ut.r,_x1:nt?J+dt.TR[0]:Nt+It*ut.r,_y0:nt?q+dt.TL[1]:te-It*ut.r,_y1:nt?q+dt.BL[1]:te+It*ut.r,text:ee.join("
          "),name:wt.hovertemplate||Ct.indexOf("name")!==-1?wt.name:void 0,idealAlign:dt.pxmid[0]<0?"left":"right",color:v.castOption(mt.bgcolor,dt.pts)||dt.color,borderColor:v.castOption(mt.bordercolor,dt.pts),fontFamily:v.castOption(bt.family,dt.pts),fontSize:v.castOption(bt.size,dt.pts),fontColor:v.castOption(bt.color,dt.pts),nameLength:v.castOption(mt.namelength,dt.pts),textAlign:v.castOption(mt.align,dt.pts),hovertemplate:v.castOption(wt.hovertemplate,dt.pts),hovertemplateLabels:dt,eventData:[g(dt,wt)]},{container:Tt._hoverlayer.node(),outerContainer:Tt._paper.node(),gd:X,inOut_bbox:vt}),dt.bbox=vt[0],it._hasHoverLabel=!0}it._hasHoverEvent=!0,X.emit("plotly_hover",{points:[g(dt,wt)],event:u.event})}}),ot.on("mouseout",function(dt){var Tt=X._fullLayout,wt=X._fullData[it.index],Ct=u.select(this).datum();it._hasHoverEvent&&(dt.originalEvent=u.event,X.emit("plotly_unhover",{points:[g(Ct,wt)],event:u.event}),it._hasHoverEvent=!1),it._hasHoverLabel&&(E.loneUnhover(Tt._hoverlayer.node()),it._hasHoverLabel=!1)}),ot.on("click",function(dt){var Tt=X._fullLayout,wt=X._fullData[it.index];X._dragging||Tt.hovermode===!1||(X._hoverdata=[g(dt,wt)],E.click(X,u.event))})}function y(ot,X,Q){var ut=v.castOption(ot.outsidetextfont.color,X.pts)||v.castOption(ot.textfont.color,X.pts)||Q.color,J=v.castOption(ot.outsidetextfont.family,X.pts)||v.castOption(ot.textfont.family,X.pts)||Q.family,q=v.castOption(ot.outsidetextfont.size,X.pts)||v.castOption(ot.textfont.size,X.pts)||Q.size,it=v.castOption(ot.outsidetextfont.weight,X.pts)||v.castOption(ot.textfont.weight,X.pts)||Q.weight,nt=v.castOption(ot.outsidetextfont.style,X.pts)||v.castOption(ot.textfont.style,X.pts)||Q.style,dt=v.castOption(ot.outsidetextfont.variant,X.pts)||v.castOption(ot.textfont.variant,X.pts)||Q.variant,Tt=v.castOption(ot.outsidetextfont.textcase,X.pts)||v.castOption(ot.textfont.textcase,X.pts)||Q.textcase,wt=v.castOption(ot.outsidetextfont.lineposition,X.pts)||v.castOption(ot.textfont.lineposition,X.pts)||Q.lineposition,Ct=v.castOption(ot.outsidetextfont.shadow,X.pts)||v.castOption(ot.textfont.shadow,X.pts)||Q.shadow;return{color:ut,family:J,size:q,weight:it,style:nt,variant:dt,textcase:Tt,lineposition:wt,shadow:Ct}}function S(ot,X,Q){var ut=v.castOption(ot.insidetextfont.color,X.pts);!ut&&ot._input.textfont&&(ut=v.castOption(ot._input.textfont.color,X.pts));var J=v.castOption(ot.insidetextfont.family,X.pts)||v.castOption(ot.textfont.family,X.pts)||Q.family,q=v.castOption(ot.insidetextfont.size,X.pts)||v.castOption(ot.textfont.size,X.pts)||Q.size,it=v.castOption(ot.insidetextfont.weight,X.pts)||v.castOption(ot.textfont.weight,X.pts)||Q.weight,nt=v.castOption(ot.insidetextfont.style,X.pts)||v.castOption(ot.textfont.style,X.pts)||Q.style,dt=v.castOption(ot.insidetextfont.variant,X.pts)||v.castOption(ot.textfont.variant,X.pts)||Q.variant,Tt=v.castOption(ot.insidetextfont.textcase,X.pts)||v.castOption(ot.textfont.textcase,X.pts)||Q.textcase,wt=v.castOption(ot.insidetextfont.lineposition,X.pts)||v.castOption(ot.textfont.lineposition,X.pts)||Q.lineposition,Ct=v.castOption(ot.insidetextfont.shadow,X.pts)||v.castOption(ot.textfont.shadow,X.pts)||Q.shadow;return{color:ut||A.contrast(X.color),family:J,size:q,weight:it,style:nt,variant:dt,textcase:Tt,lineposition:wt,shadow:Ct}}function k(ot,X){for(var Q,ut,J=0;J=-4;mt-=2)Zt(Math.PI*mt,"tan");for(mt=4;mt>=-4;mt-=2)Zt(Math.PI*(mt+1),"tan")}if(Ct||Nt){for(mt=4;mt>=-4;mt-=2)Zt(Math.PI*(mt+1.5),"rad");for(mt=4;mt>=-4;mt-=2)Zt(Math.PI*(mt+.5),"rad")}}if(nt||te||Ct){var bt=Math.sqrt(ot.width*ot.width+ot.height*ot.height);if(ee={scale:J*ut*2/bt,rCenter:1-J,rotate:0},ee.textPosAngle=(X.startangle+X.stopangle)/2,ee.scale>=1)return ee;Jt.push(ee)}(te||Nt)&&(ee=c(ot,ut,it,dt,Tt),ee.textPosAngle=(X.startangle+X.stopangle)/2,Jt.push(ee)),(te||It)&&(ee=h(ot,ut,it,dt,Tt),ee.textPosAngle=(X.startangle+X.stopangle)/2,Jt.push(ee));for(var vt=0,Ut=0,re=0;re=1)break}return Jt[vt]}function T(ot,X){var Q=ot.startangle,ut=ot.stopangle;return Q>X&&X>ut||Q0?1:-1)/2,y:q/(1+Q*Q/(ut*ut)),outside:!0}}function B(ot){var X=Math.sqrt(ot.titleBox.width*ot.titleBox.width+ot.titleBox.height*ot.titleBox.height);return{x:ot.cx,y:ot.cy,scale:ot.trace.hole*ot.r*2/X,tx:0,ty:-ot.titleBox.height/2+ot.trace.title.font.size}}function R(ot,X){var Q=1,ut=1,J,q=ot.trace,it={x:ot.cx,y:ot.cy},nt={tx:0,ty:0};nt.ty+=q.title.font.size,J=j(q),q.title.position.indexOf("top")!==-1?(it.y-=(1+J)*ot.r,nt.ty-=ot.titleBox.height):q.title.position.indexOf("bottom")!==-1&&(it.y+=(1+J)*ot.r);var dt=I(ot.r,ot.trace.aspectratio),Tt=X.w*(q.domain.x[1]-q.domain.x[0])/2;return q.title.position.indexOf("left")!==-1?(Tt=Tt+dt,it.x-=(1+J)*dt,nt.tx+=ot.titleBox.width/2):q.title.position.indexOf("center")!==-1?Tt*=2:q.title.position.indexOf("right")!==-1&&(Tt=Tt+dt,it.x+=(1+J)*dt,nt.tx-=ot.titleBox.width/2),Q=Tt/ot.titleBox.width,ut=F(ot,X)/ot.titleBox.height,{x:it.x,y:it.y,scale:Math.min(Q,ut),tx:nt.tx,ty:nt.ty}}function I(ot,X){return ot/(X===void 0?1:X)}function F(ot,X){var Q=ot.trace,ut=X.h*(Q.domain.y[1]-Q.domain.y[0]);return Math.min(ot.titleBox.height,ut/2)}function j(ot){var X=ot.pull;if(!X)return 0;var Q;if(e.isArrayOrTypedArray(X))for(X=0,Q=0;QX&&(X=ot.pull[Q]);return X}function N(ot,X){var Q,ut,J,q,it,nt,dt,Tt,wt,Ct,It,Nt,te;function Jt(bt,vt){return bt.pxmid[1]-vt.pxmid[1]}function ee(bt,vt){return vt.pxmid[1]-bt.pxmid[1]}function Zt(bt,vt){vt||(vt={});var Ut=vt.labelExtraY+(ut?vt.yLabelMax:vt.yLabelMin),re=ut?bt.yLabelMin:bt.yLabelMax,Kt=ut?bt.yLabelMax:bt.yLabelMin,ue=bt.cyFinal+it(bt.px0[1],bt.px1[1]),Me=Ut-re,Ce,We,qe,vr,_r,er;if(Me*dt>0&&(bt.labelExtraY=Me),!!e.isArrayOrTypedArray(X.pull))for(We=0;We=(v.castOption(X.pull,qe.pts)||0))&&((bt.pxmid[1]-qe.pxmid[1])*dt>0?(vr=qe.cyFinal+it(qe.px0[1],qe.px1[1]),Me=vr-re-bt.labelExtraY,Me*dt>0&&(bt.labelExtraY+=Me)):(Kt+bt.labelExtraY-ue)*dt>0&&(Ce=3*nt*Math.abs(We-Ct.indexOf(bt)),_r=qe.cxFinal+q(qe.px0[0],qe.px1[0]),er=_r+Ce-(bt.cxFinal+bt.pxmid[0])-bt.labelExtraX,er*nt>0&&(bt.labelExtraX+=er)))}for(ut=0;ut<2;ut++)for(J=ut?Jt:ee,it=ut?Math.max:Math.min,dt=ut?1:-1,Q=0;Q<2;Q++){for(q=Q?Math.max:Math.min,nt=Q?1:-1,Tt=ot[ut][Q],Tt.sort(J),wt=ot[1-ut][Q],Ct=wt.concat(Tt),Nt=[],It=0;It1?(Tt=Q.r,wt=Tt/J.aspectratio):(wt=Q.r,Tt=wt*J.aspectratio),Tt*=(1+J.baseratio)/2,dt=Tt*wt}it=Math.min(it,dt/Q.vTotal)}for(ut=0;utX.vTotal/2?1:0,Tt.halfangle=Math.PI*Math.min(Tt.v/X.vTotal,.5),Tt.ring=1-ut.hole,Tt.rInscribed=z(Tt,X))}function st(ot,X){return[ot*Math.sin(X),-ot*Math.cos(X)]}function et(ot,X,Q){var ut=ot._fullLayout,J=Q.trace,q=J.texttemplate,it=J.textinfo;if(!q&&it&&it!=="none"){var nt=it.split("+"),dt=function(vt){return nt.indexOf(vt)!==-1},Tt=dt("label"),wt=dt("text"),Ct=dt("value"),It=dt("percent"),Nt=ut.separators,te;if(te=Tt?[X.label]:[],wt){var Jt=v.getFirstFilled(J.text,X.pts);m(Jt)&&te.push(Jt)}Ct&&te.push(v.formatPieValue(X.v,Nt)),It&&te.push(v.formatPiePercent(X.v/Q.vTotal,Nt)),X.text=te.join("
          ")}function ee(vt){return{label:vt.label,value:vt.v,valueLabel:v.formatPieValue(vt.v,ut.separators),percent:vt.v/Q.vTotal,percentLabel:v.formatPiePercent(vt.v/Q.vTotal,ut.separators),color:vt.color,text:vt.text,customdata:e.castOption(J,vt.i,"customdata")}}if(q){var Zt=e.castOption(J,X.i,"texttemplate");if(!Zt)X.text="";else{var mt=ee(X),bt=v.getFirstFilled(J.text,X.pts);(m(bt)||bt==="")&&(mt.text=bt),X.text=e.texttemplateString({data:[mt,J._meta],fallback:J.texttemplatefallback,labels:mt,locale:ot._fullLayout._d3locale,template:Zt})}}}function Z(ot,X){var Q=ot.rotate*Math.PI/180,ut=Math.cos(Q),J=Math.sin(Q),q=(X.left+X.right)/2,it=(X.top+X.bottom)/2;ot.textX=q*ut-it*J,ot.textY=q*J+it*ut,ot.noCenter=!0}V.exports={plot:w,formatSliceLabel:et,transformInsideText:M,determineInsideTextFont:S,positionTitleOutside:R,prerenderTitles:k,layoutAreas:G,attachFxHandlers:x,computeTransform:Z}}),yS=Vt((K,V)=>{var u=Ni(),d=Am(),E=sh().resizeText;V.exports=function(A){var t=A._fullLayout._pielayer.selectAll(".trace");E(A,t,"pie"),t.each(function(e){var r=e[0],i=r.trace,n=u.select(this);n.style({opacity:i.opacity}),n.selectAll("path.surface").each(function(o){u.select(this).call(d,o,i,A)})})}}),xS=Vt(K=>{var V=Vu();K.name="pie",K.plot=function(u,d,E,A){V.plotBasePlot(K.name,u,d,E,A)},K.clean=function(u,d,E,A){V.cleanBasePlot(K.name,u,d,E,A)}}),_S=Vt((K,V)=>{V.exports={attributes:b0(),supplyDefaults:w0().supplyDefaults,supplyLayoutDefaults:gS(),layoutAttributes:W1(),calc:Um().calc,crossTraceCalc:Um().crossTraceCalc,plot:G1().plot,style:yS(),styleOne:Am(),moduleType:"trace",name:"pie",basePlotModule:xS(),categories:["pie-like","pie","showLegend"],meta:{}}}),bS=Vt((K,V)=>{V.exports=_S()}),wS=Vt(K=>{var V=Vu();K.name="sunburst",K.plot=function(u,d,E,A){V.plotBasePlot(K.name,u,d,E,A)},K.clean=function(u,d,E,A){V.cleanBasePlot(K.name,u,d,E,A)}}),uw=Vt((K,V)=>{V.exports={CLICK_TRANSITION_TIME:750,CLICK_TRANSITION_EASING:"linear",eventDataKeys:["currentPath","root","entry","percentRoot","percentEntry","percentParent"]}}),uv=Vt((K,V)=>{var u=kl(),{hovertemplateAttrs:d,texttemplateAttrs:E,templatefallbackAttrs:A}=yl(),t=Wl(),e=Hu().attributes,r=b0(),i=uw(),n=So().extendFlat,o=If().pattern;V.exports={labels:{valType:"data_array",editType:"calc"},parents:{valType:"data_array",editType:"calc"},values:{valType:"data_array",editType:"calc"},branchvalues:{valType:"enumerated",values:["remainder","total"],dflt:"remainder",editType:"calc"},count:{valType:"flaglist",flags:["branches","leaves"],dflt:"leaves",editType:"calc"},level:{valType:"any",editType:"plot",anim:!0},maxdepth:{valType:"integer",editType:"plot",dflt:-1},marker:n({colors:{valType:"data_array",editType:"calc"},line:{color:n({},r.marker.line.color,{dflt:null}),width:n({},r.marker.line.width,{dflt:1}),editType:"calc"},pattern:o,editType:"calc"},t("marker",{colorAttr:"colors",anim:!1})),leaf:{opacity:{valType:"number",editType:"style",min:0,max:1},editType:"plot"},text:r.text,textinfo:{valType:"flaglist",flags:["label","text","value","current path","percent root","percent entry","percent parent"],extras:["none"],editType:"plot"},texttemplate:E({editType:"plot"},{keys:i.eventDataKeys.concat(["label","value"])}),texttemplatefallback:A({editType:"plot"}),hovertext:r.hovertext,hoverinfo:n({},u.hoverinfo,{flags:["label","text","value","name","current path","percent root","percent entry","percent parent"],dflt:"label+text+value+name"}),hovertemplate:d({},{keys:i.eventDataKeys}),hovertemplatefallback:A(),textfont:r.textfont,insidetextorientation:r.insidetextorientation,insidetextfont:r.insidetextfont,outsidetextfont:n({},r.outsidetextfont,{}),rotation:{valType:"angle",dflt:0,editType:"plot"},sort:r.sort,root:{color:{valType:"color",editType:"calc",dflt:"rgba(0,0,0,0)"},editType:"calc"},domain:e({name:"sunburst",trace:!0,editType:"calc"})}}),cw=Vt((K,V)=>{V.exports={sunburstcolorway:{valType:"colorlist",editType:"calc"},extendsunburstcolors:{valType:"boolean",dflt:!0,editType:"calc"}}}),TS=Vt((K,V)=>{var u=Xr(),d=uv(),E=Hu().defaults,A=Ch().handleText,t=w0().handleMarkerDefaults,e=xu(),r=e.hasColorscale,i=e.handleDefaults;V.exports=function(n,o,a,s){function f(y,S){return u.coerce(n,o,d,y,S)}var v=f("labels"),g=f("parents");if(!v||!v.length||!g||!g.length){o.visible=!1;return}var m=f("values");m&&m.length?f("branchvalues"):f("count"),f("level"),f("maxdepth"),t(n,o,s,f);var w=o._hasColorscale=r(n,"marker","colors")||(n.marker||{}).coloraxis;w&&i(n,o,s,f,{prefix:"marker.",cLetter:"c"}),f("leaf.opacity",w?1:.7);var l=f("text");f("texttemplate"),f("texttemplatefallback"),o.texttemplate||f("textinfo",u.isArrayOrTypedArray(l)?"text+label":"label"),f("hovertext"),f("hovertemplate"),f("hovertemplatefallback");var x="auto";A(n,o,s,f,x,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),f("insidetextorientation"),f("sort"),f("rotation"),f("root.color"),E(o,s,f),o._length=null}}),kS=Vt((K,V)=>{var u=Xr(),d=cw();V.exports=function(E,A){function t(e,r){return u.coerce(E,A,d,e,r)}t("sunburstcolorway",A.colorway),t("extendsunburstcolors")}}),cv=Vt((K,V)=>{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K):(u=u||self,d(u.d3=u.d3||{}))})(K,function(u){function d(_t,lt){return _t.parent===lt.parent?1:2}function E(_t){return _t.reduce(A,0)/_t.length}function A(_t,lt){return _t+lt.x}function t(_t){return 1+_t.reduce(e,0)}function e(_t,lt){return Math.max(_t,lt.y)}function r(_t){for(var lt;lt=_t.children;)_t=lt[0];return _t}function i(_t){for(var lt;lt=_t.children;)_t=lt[lt.length-1];return _t}function n(){var _t=d,lt=1,yt=1,St=!1;function Ht(Yt){var se,ke=0;Yt.eachAfter(function(Ye){var Er=Ye.children;Er?(Ye.x=E(Er),Ye.y=t(Er)):(Ye.x=se?ke+=_t(Ye,se):0,Ye.y=0,se=Ye)});var Ee=r(Yt),Ue=i(Yt),ir=Ee.x-_t(Ee,Ue)/2,ar=Ue.x+_t(Ue,Ee)/2;return Yt.eachAfter(St?function(Ye){Ye.x=(Ye.x-Yt.x)*lt,Ye.y=(Yt.y-Ye.y)*yt}:function(Ye){Ye.x=(Ye.x-ir)/(ar-ir)*lt,Ye.y=(1-(Yt.y?Ye.y/Yt.y:1))*yt})}return Ht.separation=function(Yt){return arguments.length?(_t=Yt,Ht):_t},Ht.size=function(Yt){return arguments.length?(St=!1,lt=+Yt[0],yt=+Yt[1],Ht):St?null:[lt,yt]},Ht.nodeSize=function(Yt){return arguments.length?(St=!0,lt=+Yt[0],yt=+Yt[1],Ht):St?[lt,yt]:null},Ht}function o(_t){var lt=0,yt=_t.children,St=yt&&yt.length;if(!St)lt=1;else for(;--St>=0;)lt+=yt[St].value;_t.value=lt}function a(){return this.eachAfter(o)}function s(_t){var lt=this,yt,St=[lt],Ht,Yt,se;do for(yt=St.reverse(),St=[];lt=yt.pop();)if(_t(lt),Ht=lt.children,Ht)for(Yt=0,se=Ht.length;Yt=0;--Ht)yt.push(St[Ht]);return this}function v(_t){for(var lt=this,yt=[lt],St=[],Ht,Yt,se;lt=yt.pop();)if(St.push(lt),Ht=lt.children,Ht)for(Yt=0,se=Ht.length;Yt=0;)yt+=St[Ht].value;lt.value=yt})}function m(_t){return this.eachBefore(function(lt){lt.children&<.children.sort(_t)})}function w(_t){for(var lt=this,yt=l(lt,_t),St=[lt];lt!==yt;)lt=lt.parent,St.push(lt);for(var Ht=St.length;_t!==yt;)St.splice(Ht,0,_t),_t=_t.parent;return St}function l(_t,lt){if(_t===lt)return _t;var yt=_t.ancestors(),St=lt.ancestors(),Ht=null;for(_t=yt.pop(),lt=St.pop();_t===lt;)Ht=_t,_t=yt.pop(),lt=St.pop();return Ht}function x(){for(var _t=this,lt=[_t];_t=_t.parent;)lt.push(_t);return lt}function y(){var _t=[];return this.each(function(lt){_t.push(lt)}),_t}function S(){var _t=[];return this.eachBefore(function(lt){lt.children||_t.push(lt)}),_t}function k(){var _t=this,lt=[];return _t.each(function(yt){yt!==_t&<.push({source:yt.parent,target:yt})}),lt}function M(_t,lt){var yt=new _(_t),St=+_t.value&&(yt.value=_t.value),Ht,Yt=[yt],se,ke,Ee,Ue;for(lt==null&&(lt=c);Ht=Yt.pop();)if(St&&(Ht.value=+Ht.data.value),(ke=lt(Ht.data))&&(Ue=ke.length))for(Ht.children=new Array(Ue),Ee=Ue-1;Ee>=0;--Ee)Yt.push(se=Ht.children[Ee]=new _(ke[Ee])),se.parent=Ht,se.depth=Ht.depth+1;return yt.eachBefore(b)}function T(){return M(this).eachBefore(h)}function c(_t){return _t.children}function h(_t){_t.data=_t.data.data}function b(_t){var lt=0;do _t.height=lt;while((_t=_t.parent)&&_t.height<++lt)}function _(_t){this.data=_t,this.depth=this.height=0,this.parent=null}_.prototype=M.prototype={constructor:_,count:a,each:s,eachAfter:v,eachBefore:f,sum:g,sort:m,path:w,ancestors:x,descendants:y,leaves:S,links:k,copy:T};var P=Array.prototype.slice;function z(_t){for(var lt=_t.length,yt,St;lt;)St=Math.random()*lt--|0,yt=_t[lt],_t[lt]=_t[St],_t[St]=yt;return _t}function D(_t){for(var lt=0,yt=(_t=z(P.call(_t))).length,St=[],Ht,Yt;lt0&&yt*yt>St*St+Ht*Ht}function F(_t,lt){for(var yt=0;ytEe?(Ht=(Ue+Ee-Yt)/(2*Ue),ke=Math.sqrt(Math.max(0,Ee/Ue-Ht*Ht)),yt.x=_t.x-Ht*St-ke*se,yt.y=_t.y-Ht*se+ke*St):(Ht=(Ue+Yt-Ee)/(2*Ue),ke=Math.sqrt(Math.max(0,Yt/Ue-Ht*Ht)),yt.x=lt.x+Ht*St-ke*se,yt.y=lt.y+Ht*se+ke*St)):(yt.x=lt.x+yt.r,yt.y=lt.y)}function st(_t,lt){var yt=_t.r+lt.r-1e-6,St=lt.x-_t.x,Ht=lt.y-_t.y;return yt>0&&yt*yt>St*St+Ht*Ht}function et(_t){var lt=_t._,yt=_t.next._,St=lt.r+yt.r,Ht=(lt.x*yt.r+yt.x*lt.r)/St,Yt=(lt.y*yt.r+yt.y*lt.r)/St;return Ht*Ht+Yt*Yt}function Z(_t){this._=_t,this.next=null,this.previous=null}function ot(_t){if(!(Ht=_t.length))return 0;var lt,yt,St,Ht,Yt,se,ke,Ee,Ue,ir,ar;if(lt=_t[0],lt.x=0,lt.y=0,!(Ht>1))return lt.r;if(yt=_t[1],lt.x=-yt.r,yt.x=lt.r,yt.y=0,!(Ht>2))return lt.r+yt.r;ct(yt,lt,St=_t[2]),lt=new Z(lt),yt=new Z(yt),St=new Z(St),lt.next=St.previous=yt,yt.next=lt.previous=St,St.next=yt.previous=lt;t:for(ke=3;ke0)throw new Error("cycle");return ke}return yt.id=function(St){return arguments.length?(_t=ut(St),yt):_t},yt.parentId=function(St){return arguments.length?(lt=ut(St),yt):lt},yt}function vt(_t,lt){return _t.parent===lt.parent?1:2}function Ut(_t){var lt=_t.children;return lt?lt[0]:_t.t}function re(_t){var lt=_t.children;return lt?lt[lt.length-1]:_t.t}function Kt(_t,lt,yt){var St=yt/(lt.i-_t.i);lt.c-=St,lt.s+=yt,_t.c+=St,lt.z+=yt,lt.m+=yt}function ue(_t){for(var lt=0,yt=0,St=_t.children,Ht=St.length,Yt;--Ht>=0;)Yt=St[Ht],Yt.z+=lt,Yt.m+=lt,lt+=Yt.s+(yt+=Yt.c)}function Me(_t,lt,yt){return _t.a.parent===lt.parent?_t.a:yt}function Ce(_t,lt){this._=_t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=lt}Ce.prototype=Object.create(_.prototype);function We(_t){for(var lt=new Ce(_t,0),yt,St=[lt],Ht,Yt,se,ke;yt=St.pop();)if(Yt=yt._.children)for(yt.children=new Array(ke=Yt.length),se=ke-1;se>=0;--se)St.push(Ht=yt.children[se]=new Ce(Yt[se],se)),Ht.parent=yt;return(lt.parent=new Ce(null,0)).children=[lt],lt}function qe(){var _t=vt,lt=1,yt=1,St=null;function Ht(Ue){var ir=We(Ue);if(ir.eachAfter(Yt),ir.parent.m=-ir.z,ir.eachBefore(se),St)Ue.eachBefore(Ee);else{var ar=Ue,Ye=Ue,Er=Ue;Ue.eachBefore(function(En){En.xYe.x&&(Ye=En),En.depth>Er.depth&&(Er=En)});var pn=ar===Ye?1:_t(ar,Ye)/2,dn=pn-ar.x,bn=lt/(Ye.x+pn+dn),Zn=yt/(Er.depth||1);Ue.eachBefore(function(En){En.x=(En.x+dn)*bn,En.y=En.depth*Zn})}return Ue}function Yt(Ue){var ir=Ue.children,ar=Ue.parent.children,Ye=Ue.i?ar[Ue.i-1]:null;if(ir){ue(Ue);var Er=(ir[0].z+ir[ir.length-1].z)/2;Ye?(Ue.z=Ye.z+_t(Ue._,Ye._),Ue.m=Ue.z-Er):Ue.z=Er}else Ye&&(Ue.z=Ye.z+_t(Ue._,Ye._));Ue.parent.A=ke(Ue,Ye,Ue.parent.A||ar[0])}function se(Ue){Ue._.x=Ue.z+Ue.parent.m,Ue.m+=Ue.parent.m}function ke(Ue,ir,ar){if(ir){for(var Ye=Ue,Er=Ue,pn=ir,dn=Ye.parent.children[0],bn=Ye.m,Zn=Er.m,En=pn.m,gn=dn.m,da;pn=re(pn),Ye=Ut(Ye),pn&&Ye;)dn=Ut(dn),Er=re(Er),Er.a=Ue,da=pn.z+En-Ye.z-bn+_t(pn._,Ye._),da>0&&(Kt(Me(pn,Ue,ar),Ue,da),bn+=da,Zn+=da),En+=pn.m,bn+=Ye.m,gn+=dn.m,Zn+=Er.m;pn&&!re(Er)&&(Er.t=pn,Er.m+=En-Zn),Ye&&!Ut(dn)&&(dn.t=Ye,dn.m+=bn-gn,ar=Ue)}return ar}function Ee(Ue){Ue.x*=lt,Ue.y=Ue.depth*yt}return Ht.separation=function(Ue){return arguments.length?(_t=Ue,Ht):_t},Ht.size=function(Ue){return arguments.length?(St=!1,lt=+Ue[0],yt=+Ue[1],Ht):St?null:[lt,yt]},Ht.nodeSize=function(Ue){return arguments.length?(St=!0,lt=+Ue[0],yt=+Ue[1],Ht):St?[lt,yt]:null},Ht}function vr(_t,lt,yt,St,Ht){for(var Yt=_t.children,se,ke=-1,Ee=Yt.length,Ue=_t.value&&(Ht-yt)/_t.value;++keEn&&(En=Ue),Se=bn*bn*ra,gn=Math.max(En/Se,Se/Zn),gn>da){bn-=Ue;break}da=gn}se.push(Ee={value:bn,dice:Er1?St:1)},yt})(_r);function Ir(){var _t=Mr,lt=!1,yt=1,St=1,Ht=[0],Yt=J,se=J,ke=J,Ee=J,Ue=J;function ir(Ye){return Ye.x0=Ye.y0=0,Ye.x1=yt,Ye.y1=St,Ye.eachBefore(ar),Ht=[0],lt&&Ye.eachBefore(Ct),Ye}function ar(Ye){var Er=Ht[Ye.depth],pn=Ye.x0+Er,dn=Ye.y0+Er,bn=Ye.x1-Er,Zn=Ye.y1-Er;bn=Ye-1){var En=Yt[ar];En.x0=pn,En.y0=dn,En.x1=bn,En.y1=Zn;return}for(var gn=Ue[ar],da=Er/2+gn,ra=ar+1,Se=Ye-1;ra>>1;Ue[Re]Zn-dn){var zr=(pn*tr+bn*Ze)/Er;ir(ar,ra,Ze,pn,dn,zr,Zn),ir(ra,Ye,tr,zr,dn,bn,Zn)}else{var tn=(dn*tr+Zn*Ze)/Er;ir(ar,ra,Ze,pn,dn,bn,tn),ir(ra,Ye,tr,pn,tn,bn,Zn)}}}function Dt(_t,lt,yt,St,Ht){(_t.depth&1?vr:It)(_t,lt,yt,St,Ht)}var qt=(function _t(lt){function yt(St,Ht,Yt,se,ke){if((Ee=St._squarify)&&Ee.ratio===lt)for(var Ee,Ue,ir,ar,Ye=-1,Er,pn=Ee.length,dn=St.value;++Ye1?St:1)},yt})(_r);u.cluster=n,u.hierarchy=M,u.pack=nt,u.packEnclose=D,u.packSiblings=X,u.partition=Nt,u.stratify=bt,u.tree=qe,u.treemap=Ir,u.treemapBinary=de,u.treemapDice=It,u.treemapResquarify=qt,u.treemapSlice=vr,u.treemapSliceDice=Dt,u.treemapSquarify=Mr,Object.defineProperty(u,"__esModule",{value:!0})})}),fv=Vt(K=>{var V=cv(),u=Lo(),d=Xr(),E=xu().makeColorScaleFuncFromTrace,A=Um().makePullColorFn,t=Um().generateExtendedColors,e=xu().calc,r=ks().ALMOST_EQUAL,i={},n={},o={};K.calc=function(s,f){var v=s._fullLayout,g=f.ids,m=d.isArrayOrTypedArray(g),w=f.labels,l=f.parents,x=f.values,y=d.isArrayOrTypedArray(x),S=[],k={},M={},T=function(X,Q){k[X]?k[X].push(Q):k[X]=[Q],M[Q]=1},c=function(X){return X||typeof X=="number"},h=function(X){return!y||u(x[X])&&x[X]>=0},b,_,P;m?(b=Math.min(g.length,l.length),_=function(X){return c(g[X])&&h(X)},P=function(X){return String(g[X])}):(b=Math.min(w.length,l.length),_=function(X){return c(w[X])&&h(X)},P=function(X){return String(w[X])}),y&&(b=Math.min(b,x.length));for(var z=0;z1){for(var I=d.randstr(),F=0;F{});function Np(){}function fw(){return this.rgb().formatHex()}function AS(){return this.rgb().formatHex8()}function MS(){return vw(this).formatHsl()}function hw(){return this.rgb().formatRgb()}function Hm(K){var V,u;return K=(K+"").trim().toLowerCase(),(V=xw.exec(K))?(u=V[1].length,V=parseInt(V[1],16),u===6?pw(V):u===3?new Df(V>>8&15|V>>4&240,V>>4&15|V&240,(V&15)<<4|V&15,1):u===8?hv(V>>24&255,V>>16&255,V>>8&255,(V&255)/255):u===4?hv(V>>12&15|V>>8&240,V>>8&15|V>>4&240,V>>4&15|V&240,((V&15)<<4|V&15)/255):null):(V=_w.exec(K))?new Df(V[1],V[2],V[3],1):(V=bw.exec(K))?new Df(V[1]*255/100,V[2]*255/100,V[3]*255/100,1):(V=ww.exec(K))?hv(V[1],V[2],V[3],V[4]):(V=Tw.exec(K))?hv(V[1]*255/100,V[2]*255/100,V[3]*255/100,V[4]):(V=kw.exec(K))?gw(V[1],V[2]/100,V[3]/100,1):(V=Aw.exec(K))?gw(V[1],V[2]/100,V[3]/100,V[4]):$1.hasOwnProperty(K)?pw($1[K]):K==="transparent"?new Df(NaN,NaN,NaN,0):null}function pw(K){return new Df(K>>16&255,K>>8&255,K&255,1)}function hv(K,V,u,d){return d<=0&&(K=V=u=NaN),new Df(K,V,u,d)}function K1(K){return K instanceof Np||(K=Hm(K)),K?(K=K.rgb(),new Df(K.r,K.g,K.b,K.opacity)):new Df}function pv(K,V,u,d){return arguments.length===1?K1(K):new Df(K,V,u,d??1)}function Df(K,V,u,d){this.r=+K,this.g=+V,this.b=+u,this.opacity=+d}function dw(){return`#${Pd(this.r)}${Pd(this.g)}${Pd(this.b)}`}function SS(){return`#${Pd(this.r)}${Pd(this.g)}${Pd(this.b)}${Pd((isNaN(this.opacity)?1:this.opacity)*255)}`}function mw(){let K=dv(this.opacity);return`${K===1?"rgb(":"rgba("}${Id(this.r)}, ${Id(this.g)}, ${Id(this.b)}${K===1?")":`, ${K})`}`}function dv(K){return isNaN(K)?1:Math.max(0,Math.min(1,K))}function Id(K){return Math.max(0,Math.min(255,Math.round(K)||0))}function Pd(K){return K=Id(K),(K<16?"0":"")+K.toString(16)}function gw(K,V,u,d){return d<=0?K=V=u=NaN:u<=0||u>=1?K=V=NaN:V<=0&&(K=NaN),new Hh(K,V,u,d)}function vw(K){if(K instanceof Hh)return new Hh(K.h,K.s,K.l,K.opacity);if(K instanceof Np||(K=Hm(K)),!K)return new Hh;if(K instanceof Hh)return K;K=K.rgb();var V=K.r/255,u=K.g/255,d=K.b/255,E=Math.min(V,u,d),A=Math.max(V,u,d),t=NaN,e=A-E,r=(A+E)/2;return e?(V===A?t=(u-d)/e+(u0&&r<1?0:t,new Hh(t,e,r,K.opacity)}function Y1(K,V,u,d){return arguments.length===1?vw(K):new Hh(K,V,u,d??1)}function Hh(K,V,u,d){this.h=+K,this.s=+V,this.l=+u,this.opacity=+d}function yw(K){return K=(K||0)%360,K<0?K+360:K}function mv(K){return Math.max(0,Math.min(1,K||0))}function X1(K,V,u){return(K<60?V+(u-V)*K/60:K<180?u:K<240?V+(u-V)*(240-K)/60:V)*255}var jp,Od,Dd,k0,qh,xw,_w,bw,ww,Tw,kw,Aw,$1,J1=Bl(()=>{Z1(),jp=.7,Od=1/jp,Dd="\\s*([+-]?\\d+)\\s*",k0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",qh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xw=/^#([0-9a-f]{3,8})$/,_w=new RegExp(`^rgb\\(${Dd},${Dd},${Dd}\\)$`),bw=new RegExp(`^rgb\\(${qh},${qh},${qh}\\)$`),ww=new RegExp(`^rgba\\(${Dd},${Dd},${Dd},${k0}\\)$`),Tw=new RegExp(`^rgba\\(${qh},${qh},${qh},${k0}\\)$`),kw=new RegExp(`^hsl\\(${k0},${qh},${qh}\\)$`),Aw=new RegExp(`^hsla\\(${k0},${qh},${qh},${k0}\\)$`),$1={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},T0(Np,Hm,{copy(K){return Object.assign(new this.constructor,this,K)},displayable(){return this.rgb().displayable()},hex:fw,formatHex:fw,formatHex8:AS,formatHsl:MS,formatRgb:hw,toString:hw}),T0(Df,pv,Vm(Np,{brighter(K){return K=K==null?Od:Math.pow(Od,K),new Df(this.r*K,this.g*K,this.b*K,this.opacity)},darker(K){return K=K==null?jp:Math.pow(jp,K),new Df(this.r*K,this.g*K,this.b*K,this.opacity)},rgb(){return this},clamp(){return new Df(Id(this.r),Id(this.g),Id(this.b),dv(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:dw,formatHex:dw,formatHex8:SS,formatRgb:mw,toString:mw})),T0(Hh,Y1,Vm(Np,{brighter(K){return K=K==null?Od:Math.pow(Od,K),new Hh(this.h,this.s,this.l*K,this.opacity)},darker(K){return K=K==null?jp:Math.pow(jp,K),new Hh(this.h,this.s,this.l*K,this.opacity)},rgb(){var K=this.h%360+(this.h<0)*360,V=isNaN(K)||isNaN(this.s)?0:this.s,u=this.l,d=u+(u<.5?u:1-u)*V,E=2*u-d;return new Df(X1(K>=240?K-240:K+120,E,d),X1(K,E,d),X1(K<120?K+240:K-120,E,d),this.opacity)},clamp(){return new Hh(yw(this.h),mv(this.s),mv(this.l),dv(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let K=dv(this.opacity);return`${K===1?"hsl(":"hsla("}${yw(this.h)}, ${mv(this.s)*100}%, ${mv(this.l)*100}%${K===1?")":`, ${K})`}`}}))}),Q1,tx,Mw=Bl(()=>{Q1=Math.PI/180,tx=180/Math.PI});function Sw(K){if(K instanceof rp)return new rp(K.l,K.a,K.b,K.opacity);if(K instanceof _p)return Ew(K);K instanceof Df||(K=K1(K));var V=ix(K.r),u=ix(K.g),d=ix(K.b),E=rx((.2225045*V+.7168786*u+.0606169*d)/lx),A,t;return V===u&&u===d?A=t=E:(A=rx((.4360747*V+.3850649*u+.1430804*d)/sx),t=rx((.0139322*V+.0971045*u+.7141733*d)/ux)),new rp(116*E-16,500*(A-E),200*(E-t),K.opacity)}function ex(K,V,u,d){return arguments.length===1?Sw(K):new rp(K,V,u,d??1)}function rp(K,V,u,d){this.l=+K,this.a=+V,this.b=+u,this.opacity=+d}function rx(K){return K>zw?Math.pow(K,.3333333333333333):K/fx+cx}function nx(K){return K>Fd?K*K*K:fx*(K-cx)}function ax(K){return 255*(K<=.0031308?12.92*K:1.055*Math.pow(K,.4166666666666667)-.055)}function ix(K){return(K/=255)<=.04045?K/12.92:Math.pow((K+.055)/1.055,2.4)}function ES(K){if(K instanceof _p)return new _p(K.h,K.c,K.l,K.opacity);if(K instanceof rp||(K=Sw(K)),K.a===0&&K.b===0)return new _p(NaN,0{Z1(),J1(),Mw(),qm=18,sx=.96422,lx=1,ux=.82521,cx=4/29,Fd=6/29,fx=3*Fd*Fd,zw=Fd*Fd*Fd,T0(rp,ex,Vm(Np,{brighter(K){return new rp(this.l+qm*(K??1),this.a,this.b,this.opacity)},darker(K){return new rp(this.l-qm*(K??1),this.a,this.b,this.opacity)},rgb(){var K=(this.l+16)/116,V=isNaN(this.a)?K:K+this.a/500,u=isNaN(this.b)?K:K-this.b/200;return V=sx*nx(V),K=lx*nx(K),u=ux*nx(u),new Df(ax(3.1338561*V-1.6168667*K-.4906146*u),ax(-.9787684*V+1.9161415*K+.033454*u),ax(.0719453*V-.2289914*K+1.4052427*u),this.opacity)}})),T0(_p,ox,Vm(Np,{brighter(K){return new _p(this.h,this.c,this.l+qm*(K??1),this.opacity)},darker(K){return new _p(this.h,this.c,this.l-qm*(K??1),this.opacity)},rgb(){return Ew(this).rgb()}}))});function LS(K){if(K instanceof Bd)return new Bd(K.h,K.s,K.l,K.opacity);K instanceof Df||(K=K1(K));var V=K.r/255,u=K.g/255,d=K.b/255,E=(gx*d+dx*V-mx*u)/(gx+dx-mx),A=d-E,t=(A0*(u-E)-vv*A)/Wm,e=Math.sqrt(t*t+A*A)/(A0*E*(1-E)),r=e?Math.atan2(t,A)*tx-120:NaN;return new Bd(r<0?r+360:r,e,E,K.opacity)}function hx(K,V,u,d){return arguments.length===1?LS(K):new Bd(K,V,u,d??1)}function Bd(K,V,u,d){this.h=+K,this.s=+V,this.l=+u,this.opacity=+d}var px,gv,vv,Wm,A0,dx,mx,gx,CS=Bl(()=>{Z1(),J1(),Mw(),px=-.14861,gv=1.78277,vv=-.29227,Wm=-.90649,A0=1.97294,dx=A0*Wm,mx=A0*gv,gx=gv*vv-Wm*px,T0(Bd,hx,Vm(Np,{brighter(K){return K=K==null?Od:Math.pow(Od,K),new Bd(this.h,this.s,this.l*K,this.opacity)},darker(K){return K=K==null?jp:Math.pow(jp,K),new Bd(this.h,this.s,this.l*K,this.opacity)},rgb(){var K=isNaN(this.h)?0:(this.h+120)*Q1,V=+this.l,u=isNaN(this.s)?0:this.s*V*(1-V),d=Math.cos(K),E=Math.sin(K);return new Df(255*(V+u*(px*d+gv*E)),255*(V+u*(vv*d+Wm*E)),255*(V+u*(A0*d)),this.opacity)}}))}),M0=Bl(()=>{J1(),zS(),CS()});function Lw(K,V,u,d,E){var A=K*K,t=A*K;return((1-3*K+3*A-t)*V+(4-6*A+3*t)*u+(1+3*K+3*A-3*t)*d+t*E)/6}function Cw(K){var V=K.length-1;return function(u){var d=u<=0?u=0:u>=1?(u=1,V-1):Math.floor(u*V),E=K[d],A=K[d+1],t=d>0?K[d-1]:2*E-A,e=d{});function Iw(K){var V=K.length;return function(u){var d=Math.floor(((u%=1)<0?++u:u)*V),E=K[(d+V-1)%V],A=K[d%V],t=K[(d+1)%V],e=K[(d+2)%V];return Lw((u-d/V)*V,E,A,t,e)}}var Pw=Bl(()=>{vx()}),Gm,Ow=Bl(()=>{Gm=K=>()=>K});function Dw(K,V){return function(u){return K+u*V}}function IS(K,V,u){return K=Math.pow(K,u),V=Math.pow(V,u)-K,u=1/u,function(d){return Math.pow(K+d*V,u)}}function yv(K,V){var u=V-K;return u?Dw(K,u>180||u<-180?u-360*Math.round(u/360):u):Gm(isNaN(K)?V:K)}function PS(K){return(K=+K)==1?Ff:function(V,u){return u-V?IS(V,u,K):Gm(isNaN(V)?u:V)}}function Ff(K,V){var u=V-K;return u?Dw(K,u):Gm(isNaN(K)?V:K)}var S0=Bl(()=>{Ow()});function Fw(K){return function(V){var u=V.length,d=new Array(u),E=new Array(u),A=new Array(u),t,e;for(t=0;t{M0(),vx(),Pw(),S0(),xv=(function K(V){var u=PS(V);function d(E,A){var t=u((E=pv(E)).r,(A=pv(A)).r),e=u(E.g,A.g),r=u(E.b,A.b),i=Ff(E.opacity,A.opacity);return function(n){return E.r=t(n),E.g=e(n),E.b=r(n),E.opacity=i(n),E+""}}return d.gamma=K,d})(1),Bw=Fw(Cw),Rw=Fw(Iw)});function yx(K,V){V||(V=[]);var u=K?Math.min(V.length,K.length):0,d=V.slice(),E;return function(A){for(E=0;E{});function OS(K,V){return(jw(V)?yx:Uw)(K,V)}function Uw(K,V){var u=V?V.length:0,d=K?Math.min(u,K.length):0,E=new Array(d),A=new Array(u),t;for(t=0;t{kv(),xx()});function Hw(K,V){var u=new Date;return K=+K,V=+V,function(d){return u.setTime(K*(1-d)+V*d),u}}var qw=Bl(()=>{});function np(K,V){return K=+K,V=+V,function(u){return K*(1-u)+V*u}}var _v=Bl(()=>{});function Ww(K,V){var u={},d={},E;(K===null||typeof K!="object")&&(K={}),(V===null||typeof V!="object")&&(V={});for(E in V)E in K?u[E]=Tv(K[E],V[E]):d[E]=V[E];return function(A){for(E in u)d[E]=u[E](A);return d}}var Gw=Bl(()=>{kv()});function DS(K){return function(){return K}}function FS(K){return function(V){return K(V)+""}}function Zw(K,V){var u=bv.lastIndex=wv.lastIndex=0,d,E,A,t=-1,e=[],r=[];for(K=K+"",V=V+"";(d=bv.exec(K))&&(E=wv.exec(V));)(A=E.index)>u&&(A=V.slice(u,A),e[t]?e[t]+=A:e[++t]=A),(d=d[0])===(E=E[0])?e[t]?e[t]+=E:e[++t]=E:(e[++t]=null,r.push({i:t,x:np(d,E)})),u=wv.lastIndex;return u{_v(),bv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wv=new RegExp(bv.source,"g")});function Tv(K,V){var u=typeof V,d;return V==null||u==="boolean"?Gm(V):(u==="number"?np:u==="string"?(d=Hm(V))?(V=d,xv):Zw:V instanceof Hm?xv:V instanceof Date?Hw:jw(V)?yx:Array.isArray(V)?Uw:typeof V.valueOf!="function"&&typeof V.toString!="function"||isNaN(V)?Ww:np)(K,V)}var kv=Bl(()=>{M0(),Nw(),Vw(),qw(),_v(),Gw(),Kw(),Ow(),xx()});function BS(K){var V=K.length;return function(u){return K[Math.max(0,Math.min(V-1,Math.floor(u*V)))]}}var RS=Bl(()=>{});function NS(K,V){var u=yv(+K,+V);return function(d){var E=u(d);return E-360*Math.floor(E/360)}}var jS=Bl(()=>{S0()});function US(K,V){return K=+K,V=+V,function(u){return Math.round(K*(1-u)+V*u)}}var VS=Bl(()=>{});function Yw(K,V,u,d,E,A){var t,e,r;return(t=Math.sqrt(K*K+V*V))&&(K/=t,V/=t),(r=K*u+V*d)&&(u-=K*r,d-=V*r),(e=Math.sqrt(u*u+d*d))&&(u/=e,d/=e,r/=e),K*d{_x=180/Math.PI,Av={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1}});function qS(K){let V=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(K+"");return V.isIdentity?Av:Yw(V.a,V.b,V.c,V.d,V.e,V.f)}function WS(K){return K==null?Av:(Mv||(Mv=document.createElementNS("http://www.w3.org/2000/svg","g")),Mv.setAttribute("transform",K),(K=Mv.transform.baseVal.consolidate())?(K=K.matrix,Yw(K.a,K.b,K.c,K.d,K.e,K.f)):Av)}var Mv,GS=Bl(()=>{HS()});function Xw(K,V,u,d){function E(i){return i.length?i.pop()+" ":""}function A(i,n,o,a,s,f){if(i!==o||n!==a){var v=s.push("translate(",null,V,null,u);f.push({i:v-4,x:np(i,o)},{i:v-2,x:np(n,a)})}else(o||a)&&s.push("translate("+o+V+a+u)}function t(i,n,o,a){i!==n?(i-n>180?n+=360:n-i>180&&(i+=360),a.push({i:o.push(E(o)+"rotate(",null,d)-2,x:np(i,n)})):n&&o.push(E(o)+"rotate("+n+d)}function e(i,n,o,a){i!==n?a.push({i:o.push(E(o)+"skewX(",null,d)-2,x:np(i,n)}):n&&o.push(E(o)+"skewX("+n+d)}function r(i,n,o,a,s,f){if(i!==o||n!==a){var v=s.push(E(s)+"scale(",null,",",null,")");f.push({i:v-4,x:np(i,o)},{i:v-2,x:np(n,a)})}else(o!==1||a!==1)&&s.push(E(s)+"scale("+o+","+a+")")}return function(i,n){var o=[],a=[];return i=K(i),n=K(n),A(i.translateX,i.translateY,n.translateX,n.translateY,o,a),t(i.rotate,n.rotate,o,a),e(i.skewX,n.skewX,o,a),r(i.scaleX,i.scaleY,n.scaleX,n.scaleY,o,a),i=n=null,function(s){for(var f=-1,v=a.length,g;++f{_v(),GS(),$w=Xw(qS,"px, ","px)","deg)"),Jw=Xw(WS,", ",")",")")});function Qw(K){return((K=Math.exp(K))+1/K)/2}function KS(K){return((K=Math.exp(K))-1/K)/2}function YS(K){return((K=Math.exp(2*K))-1)/(K+1)}var t3,e3,XS=Bl(()=>{t3=1e-12,e3=(function K(V,u,d){function E(A,t){var e=A[0],r=A[1],i=A[2],n=t[0],o=t[1],a=t[2],s=n-e,f=o-r,v=s*s+f*f,g,m;if(v{M0(),S0(),n3=r3(yv),a3=r3(Ff)});function JS(K,V){var u=Ff((K=ex(K)).l,(V=ex(V)).l),d=Ff(K.a,V.a),E=Ff(K.b,V.b),A=Ff(K.opacity,V.opacity);return function(t){return K.l=u(t),K.a=d(t),K.b=E(t),K.opacity=A(t),K+""}}var QS=Bl(()=>{M0(),S0()});function i3(K){return function(V,u){var d=K((V=ox(V)).h,(u=ox(u)).h),E=Ff(V.c,u.c),A=Ff(V.l,u.l),t=Ff(V.opacity,u.opacity);return function(e){return V.h=d(e),V.c=E(e),V.l=A(e),V.opacity=t(e),V+""}}}var o3,s3,t8=Bl(()=>{M0(),S0(),o3=i3(yv),s3=i3(Ff)});function l3(K){return(function V(u){u=+u;function d(E,A){var t=K((E=hx(E)).h,(A=hx(A)).h),e=Ff(E.s,A.s),r=Ff(E.l,A.l),i=Ff(E.opacity,A.opacity);return function(n){return E.h=t(n),E.s=e(n),E.l=r(Math.pow(n,u)),E.opacity=i(n),E+""}}return d.gamma=V,d})(1)}var u3,c3,e8=Bl(()=>{M0(),S0(),u3=l3(yv),c3=l3(Ff)});function r8(K,V){V===void 0&&(V=K,K=Tv);for(var u=0,d=V.length-1,E=V[0],A=new Array(d<0?0:d);u{kv()});function a8(K,V){for(var u=new Array(V),d=0;d{}),Rd={};$_(Rd,{interpolate:()=>Tv,interpolateArray:()=>OS,interpolateBasis:()=>Cw,interpolateBasisClosed:()=>Iw,interpolateCubehelix:()=>u3,interpolateCubehelixLong:()=>c3,interpolateDate:()=>Hw,interpolateDiscrete:()=>BS,interpolateHcl:()=>o3,interpolateHclLong:()=>s3,interpolateHsl:()=>n3,interpolateHslLong:()=>a3,interpolateHue:()=>NS,interpolateLab:()=>JS,interpolateNumber:()=>np,interpolateNumberArray:()=>yx,interpolateObject:()=>Ww,interpolateRgb:()=>xv,interpolateRgbBasis:()=>Bw,interpolateRgbBasisClosed:()=>Rw,interpolateRound:()=>US,interpolateString:()=>Zw,interpolateTransformCss:()=>$w,interpolateTransformSvg:()=>Jw,interpolateZoom:()=>e3,piecewise:()=>r8,quantize:()=>a8});var E0=Bl(()=>{kv(),Vw(),vx(),Pw(),qw(),RS(),jS(),_v(),xx(),Gw(),VS(),Kw(),ZS(),XS(),Nw(),$S(),QS(),t8(),e8(),n8(),i8()}),bx=Vt((K,V)=>{var u=Eo(),d=Pi();V.exports=function(E,A,t,e,r){var i=A.data.data,n=i.i,o=r||i.color;if(n>=0){A.i=i.i;var a=t.marker;a.pattern?(!a.colors||!a.pattern.shape)&&(a.color=o,A.color=o):(a.color=o,A.color=o),u.pointStyle(E,t,e,A)}else d.fill(E,o)}}),f3=Vt((K,V)=>{var u=Ni(),d=Pi(),E=Xr(),A=sh().resizeText,t=bx();function e(i){var n=i._fullLayout._sunburstlayer.selectAll(".trace");A(i,n,"sunburst"),n.each(function(o){var a=u.select(this),s=o[0],f=s.trace;a.style("opacity",f.opacity),a.selectAll("path.surface").each(function(v){u.select(this).call(r,v,f,i)})})}function r(i,n,o,a){var s=n.data.data,f=!n.children,v=s.i,g=E.castOption(o,v,"marker.line.color")||d.defaultLine,m=E.castOption(o,v,"marker.line.width")||0;i.call(t,n,o,a).style("stroke-width",m).call(d.stroke,g).style("opacity",f?o.leaf.opacity:null)}V.exports={style:e,styleOne:r}}),Up=Vt(K=>{var V=Xr(),u=Pi(),d=Xh(),E=Sd();K.findEntryWithLevel=function(r,i){var n;return i&&r.eachAfter(function(o){if(K.getPtId(o)===i)return n=o.copy()}),n||r},K.findEntryWithChild=function(r,i){var n;return r.eachAfter(function(o){for(var a=o.children||[],s=0;s0)},K.getMaxDepth=function(r){return r.maxdepth>=0?r.maxdepth:1/0},K.isHeader=function(r,i){return!(K.isLeaf(r)||r.depth===i._maxDepth-1)};function e(r){return r.data.data.pid}K.getParent=function(r,i){return K.findEntryWithLevel(r,e(i))},K.listPath=function(r,i){var n=r.parent;if(!n)return[];var o=i?[n.data[i]]:[n];return K.listPath(n,i).concat(o)},K.getPath=function(r){return K.listPath(r,"label").join("/")+"/"},K.formatValue=E.formatPieValue,K.formatPercent=function(r,i){var n=V.formatPercent(r,0);return n==="0%"&&(n=E.formatPiePercent(r,i)),n}}),Sv=Vt((K,V)=>{var u=Ni(),d=ji(),E=mh().appendArrayPointValue,A=pc(),t=Xr(),e=_m(),r=Up(),i=Sd(),n=i.formatPieValue;V.exports=function(a,s,f,v,g){var m=v[0],w=m.trace,l=m.hierarchy,x=w.type==="sunburst",y=w.type==="treemap"||w.type==="icicle";"_hasHoverLabel"in w||(w._hasHoverLabel=!1),"_hasHoverEvent"in w||(w._hasHoverEvent=!1);var S=function(T){var c=f._fullLayout;if(!(f._dragging||c.hovermode===!1)){var h=f._fullData[w.index],b=T.data.data,_=b.i,P=r.isHierarchyRoot(T),z=r.getParent(l,T),D=r.getValue(T),B=function(q){return t.castOption(h,_,q)},R=B("hovertemplate"),I=A.castHoverinfo(h,c,_),F=c.separators,j;if(R||I&&I!=="none"&&I!=="skip"){var N,G;x&&(N=m.cx+T.pxmid[0]*(1-T.rInscribed),G=m.cy+T.pxmid[1]*(1-T.rInscribed)),y&&(N=T._hoverX,G=T._hoverY);var rt={},ct=[],st=[],et=function(q){return ct.indexOf(q)!==-1};I&&(ct=I==="all"?h._module.attributes.hoverinfo.flags:I.split("+")),rt.label=b.label,et("label")&&rt.label&&st.push(rt.label),b.hasOwnProperty("v")&&(rt.value=b.v,rt.valueLabel=n(rt.value,F),et("value")&&st.push(rt.valueLabel)),rt.currentPath=T.currentPath=r.getPath(T.data),et("current path")&&!P&&st.push(rt.currentPath);var Z,ot=[],X=function(){ot.indexOf(Z)===-1&&(st.push(Z),ot.push(Z))};rt.percentParent=T.percentParent=D/r.getValue(z),rt.parent=T.parentString=r.getPtLabel(z),et("percent parent")&&(Z=r.formatPercent(rt.percentParent,F)+" of "+rt.parent,X()),rt.percentEntry=T.percentEntry=D/r.getValue(s),rt.entry=T.entry=r.getPtLabel(s),et("percent entry")&&!P&&!T.onPathbar&&(Z=r.formatPercent(rt.percentEntry,F)+" of "+rt.entry,X()),rt.percentRoot=T.percentRoot=D/r.getValue(l),rt.root=T.root=r.getPtLabel(l),et("percent root")&&!P&&(Z=r.formatPercent(rt.percentRoot,F)+" of "+rt.root,X()),rt.text=B("hovertext")||B("text"),et("text")&&(Z=rt.text,t.isValidTextValue(Z)&&st.push(Z)),j=[o(T,h,g.eventDataKeys)];var Q={trace:h,y:G,_x0:T._x0,_x1:T._x1,_y0:T._y0,_y1:T._y1,text:st.join("
          "),name:R||et("name")?h.name:void 0,color:B("hoverlabel.bgcolor")||b.color,borderColor:B("hoverlabel.bordercolor"),fontFamily:B("hoverlabel.font.family"),fontSize:B("hoverlabel.font.size"),fontColor:B("hoverlabel.font.color"),fontWeight:B("hoverlabel.font.weight"),fontStyle:B("hoverlabel.font.style"),fontVariant:B("hoverlabel.font.variant"),nameLength:B("hoverlabel.namelength"),textAlign:B("hoverlabel.align"),hovertemplate:R,hovertemplateLabels:rt,eventData:j};x&&(Q.x0=N-T.rInscribed*T.rpx1,Q.x1=N+T.rInscribed*T.rpx1,Q.idealAlign=T.pxmid[0]<0?"left":"right"),y&&(Q.x=N,Q.idealAlign=N<0?"left":"right");var ut=[];A.loneHover(Q,{container:c._hoverlayer.node(),outerContainer:c._paper.node(),gd:f,inOut_bbox:ut}),j[0].bbox=ut[0],w._hasHoverLabel=!0}if(y){var J=a.select("path.surface");g.styleOne(J,T,h,f,{hovered:!0})}w._hasHoverEvent=!0,f.emit("plotly_hover",{points:j||[o(T,h,g.eventDataKeys)],event:u.event})}},k=function(T){var c=f._fullLayout,h=f._fullData[w.index],b=u.select(this).datum();if(w._hasHoverEvent&&(T.originalEvent=u.event,f.emit("plotly_unhover",{points:[o(b,h,g.eventDataKeys)],event:u.event}),w._hasHoverEvent=!1),w._hasHoverLabel&&(A.loneUnhover(c._hoverlayer.node()),w._hasHoverLabel=!1),y){var _=a.select("path.surface");g.styleOne(_,b,h,f,{hovered:!1})}},M=function(T){var c=f._fullLayout,h=f._fullData[w.index],b=x&&(r.isHierarchyRoot(T)||r.isLeaf(T)),_=r.getPtId(T),P=r.isEntry(T)?r.findEntryWithChild(l,_):r.findEntryWithLevel(l,_),z=r.getPtId(P),D={points:[o(T,h,g.eventDataKeys)],event:u.event};b||(D.nextLevel=z);var B=e.triggerHandler(f,"plotly_"+w.type+"click",D);if(B!==!1&&c.hovermode&&(f._hoverdata=[o(T,h,g.eventDataKeys)],A.click(f,u.event)),!b&&B!==!1&&!f._dragging&&!f._transitioning){d.call("_storeDirectGUIEdit",h,c._tracePreGUI[h.uid],{level:h.level});var R={data:[{level:z}],traces:[w.index]},I={frame:{redraw:!1,duration:g.transitionTime},transition:{duration:g.transitionTime,easing:g.transitionEasing},mode:"immediate",fromcurrent:!0};A.loneUnhover(c._hoverlayer.node()),d.call("animate",f,R,I)}};a.on("mouseover",S),a.on("mouseout",k),a.on("click",M)};function o(a,s,f){for(var v=a.data.data,g={curveNumber:s.index,pointNumber:v.i,data:s._input,fullData:s},m=0;m{var V=Ni(),u=cv(),d=(E0(),xd(Rd)).interpolate,E=Eo(),A=Xr(),t=Dl(),e=sh(),r=e.recordMinTextSize,i=e.clearMinTextSize,n=G1(),o=Sd().getRotationAngle,a=n.computeTransform,s=n.transformInsideText,f=f3().styleOne,v=Vh().resizeText,g=Sv(),m=uw(),w=Up();K.plot=function(M,T,c,h){var b=M._fullLayout,_=b._sunburstlayer,P,z,D=!c,B=!b.uniformtext.mode&&w.hasTransition(c);if(i("sunburst",b),P=_.selectAll("g.trace.sunburst").data(T,function(I){return I[0].trace.uid}),P.enter().append("g").classed("trace",!0).classed("sunburst",!0).attr("stroke-linejoin","round"),P.order(),B){h&&(z=h());var R=V.transition().duration(c.duration).ease(c.easing).each("end",function(){z&&z()}).each("interrupt",function(){z&&z()});R.each(function(){_.selectAll("g.trace").each(function(I){l(M,I,this,c)})})}else P.each(function(I){l(M,I,this,c)}),b.uniformtext.mode&&v(M,b._sunburstlayer.selectAll(".trace"),"sunburst");D&&P.exit().remove()};function l(M,T,c,h){var b=M._context.staticPlot,_=M._fullLayout,P=!_.uniformtext.mode&&w.hasTransition(h),z=V.select(c),D=z.selectAll("g.slice"),B=T[0],R=B.trace,I=B.hierarchy,F=w.findEntryWithLevel(I,R.level),j=w.getMaxDepth(R),N=_._size,G=R.domain,rt=N.w*(G.x[1]-G.x[0]),ct=N.h*(G.y[1]-G.y[0]),st=.5*Math.min(rt,ct),et=B.cx=N.l+N.w*(G.x[1]+G.x[0])/2,Z=B.cy=N.t+N.h*(1-G.y[0])-ct/2;if(!F)return D.remove();var ot=null,X={};P&&D.each(function(vt){X[w.getPtId(vt)]={rpx0:vt.rpx0,rpx1:vt.rpx1,x0:vt.x0,x1:vt.x1,transform:vt.transform},!ot&&w.isEntry(vt)&&(ot=vt)});var Q=x(F).descendants(),ut=F.height+1,J=0,q=j;B.hasMultipleRoots&&w.isHierarchyRoot(F)&&(Q=Q.slice(1),ut-=1,J=1,q+=1),Q=Q.filter(function(vt){return vt.y1<=q});var it=o(R.rotation);it&&Q.forEach(function(vt){vt.x0+=it,vt.x1+=it});var nt=Math.min(ut,j),dt=function(vt){return(vt-J)/nt*st},Tt=function(vt,Ut){return[vt*Math.cos(Ut),-vt*Math.sin(Ut)]},wt=function(vt){return A.pathAnnulus(vt.rpx0,vt.rpx1,vt.x0,vt.x1,et,Z)},Ct=function(vt){return et+S(vt)[0]*(vt.transform.rCenter||0)+(vt.transform.x||0)},It=function(vt){return Z+S(vt)[1]*(vt.transform.rCenter||0)+(vt.transform.y||0)};D=D.data(Q,w.getPtId),D.enter().append("g").classed("slice",!0),P?D.exit().transition().each(function(){var vt=V.select(this),Ut=vt.select("path.surface");Ut.transition().attrTween("d",function(Kt){var ue=ee(Kt);return function(Me){return wt(ue(Me))}});var re=vt.select("g.slicetext");re.attr("opacity",0)}).remove():D.exit().remove(),D.order();var Nt=null;if(P&&ot){var te=w.getPtId(ot);D.each(function(vt){Nt===null&&w.getPtId(vt)===te&&(Nt=vt.x1)})}var Jt=D;P&&(Jt=Jt.transition().each("end",function(){var vt=V.select(this);w.setSliceCursor(vt,M,{hideOnRoot:!0,hideOnLeaves:!0,isTransitioning:!1})})),Jt.each(function(vt){var Ut=V.select(this),re=A.ensureSingle(Ut,"path","surface",function(qe){qe.style("pointer-events",b?"none":"all")});vt.rpx0=dt(vt.y0),vt.rpx1=dt(vt.y1),vt.xmid=(vt.x0+vt.x1)/2,vt.pxmid=Tt(vt.rpx1,vt.xmid),vt.midangle=-(vt.xmid-Math.PI/2),vt.startangle=-(vt.x0-Math.PI/2),vt.stopangle=-(vt.x1-Math.PI/2),vt.halfangle=.5*Math.min(A.angleDelta(vt.x0,vt.x1)||Math.PI,Math.PI),vt.ring=1-vt.rpx0/vt.rpx1,vt.rInscribed=y(vt),P?re.transition().attrTween("d",function(qe){var vr=Zt(qe);return function(_r){return wt(vr(_r))}}):re.attr("d",wt),Ut.call(g,F,M,T,{eventDataKeys:m.eventDataKeys,transitionTime:m.CLICK_TRANSITION_TIME,transitionEasing:m.CLICK_TRANSITION_EASING}).call(w.setSliceCursor,M,{hideOnRoot:!0,hideOnLeaves:!0,isTransitioning:M._transitioning}),re.call(f,vt,R,M);var Kt=A.ensureSingle(Ut,"g","slicetext"),ue=A.ensureSingle(Kt,"text","",function(qe){qe.attr("data-notex",1)}),Me=A.ensureUniformFontSize(M,w.determineTextFont(R,vt,_.font));ue.text(K.formatSliceLabel(vt,F,R,T,_)).classed("slicetext",!0).attr("text-anchor","middle").call(E.font,Me).call(t.convertToTspans,M);var Ce=E.bBox(ue.node());vt.transform=s(Ce,vt,B),vt.transform.targetX=Ct(vt),vt.transform.targetY=It(vt);var We=function(qe,vr){var _r=qe.transform;return a(_r,vr),_r.fontSize=Me.size,r(R.type,_r,_),A.getTextTransform(_r)};P?ue.transition().attrTween("transform",function(qe){var vr=mt(qe);return function(_r){return We(vr(_r),Ce)}}):ue.attr("transform",We(vt,Ce))});function ee(vt){var Ut=w.getPtId(vt),re=X[Ut],Kt=X[w.getPtId(F)],ue;if(Kt){var Me=(vt.x1>Kt.x1?2*Math.PI:0)+it;ue=vt.rpx1Nt?2*Math.PI:0)+it;re={x0:ue,x1:ue}}else re={rpx0:st,rpx1:st},A.extendFlat(re,bt(vt));else re={rpx0:0,rpx1:0};else re={x0:it,x1:it};return d(re,Kt)}function mt(vt){var Ut=X[w.getPtId(vt)],re,Kt=vt.transform;if(Ut)re=Ut;else if(re={rpx1:vt.rpx1,transform:{textPosAngle:Kt.textPosAngle,scale:0,rotate:Kt.rotate,rCenter:Kt.rCenter,x:Kt.x,y:Kt.y}},ot)if(vt.parent)if(Nt){var ue=vt.x1>Nt?2*Math.PI:0;re.x0=re.x1=ue}else A.extendFlat(re,bt(vt));else re.x0=re.x1=it;else re.x0=re.x1=it;var Me=d(re.transform.textPosAngle,vt.transform.textPosAngle),Ce=d(re.rpx1,vt.rpx1),We=d(re.x0,vt.x0),qe=d(re.x1,vt.x1),vr=d(re.transform.scale,Kt.scale),_r=d(re.transform.rotate,Kt.rotate),er=Kt.rCenter===0?3:re.transform.rCenter===0?1/3:1,Mr=d(re.transform.rCenter,Kt.rCenter),Ir=function(de){return Mr(Math.pow(de,er))};return function(de){var Dt=Ce(de);We(de),qe(de);var qt=Ir(de),_t=Me(de),lt={rpx1:Dt,transform:{textPosAngle:_t,rCenter:qt,x:Kt.x,y:Kt.y}};return r(R.type,Kt,_),{transform:{targetX:Ct(lt),targetY:It(lt),scale:vr(de),rotate:_r(de),rCenter:qt}}}}function bt(vt){var Ut=vt.parent,re=X[w.getPtId(Ut)],Kt={};if(re){var ue=Ut.children,Me=ue.indexOf(vt),Ce=ue.length,We=d(re.x0,re.x1);Kt.x0=We(Me/Ce),Kt.x1=We(Me/Ce)}else Kt.x0=Kt.x1=0;return Kt}}function x(M){return u.partition().size([2*Math.PI,M.height+1])(M)}K.formatSliceLabel=function(M,T,c,h,b){var _=c.texttemplate,P=c.textinfo;if(!_&&(!P||P==="none"))return"";var z=b.separators,D=h[0],B=M.data.data,R=D.hierarchy,I=w.isHierarchyRoot(M),F=w.getParent(R,M),j=w.getValue(M);if(!_){var N=P.split("+"),G=function(J){return N.indexOf(J)!==-1},rt=[],ct;if(G("label")&&B.label&&rt.push(B.label),B.hasOwnProperty("v")&&G("value")&&rt.push(w.formatValue(B.v,z)),!I){G("current path")&&rt.push(w.getPath(M.data));var st=0;G("percent parent")&&st++,G("percent entry")&&st++,G("percent root")&&st++;var et=st>1;if(st){var Z,ot=function(J){ct=w.formatPercent(Z,z),et&&(ct+=" of "+J),rt.push(ct)};G("percent parent")&&!I&&(Z=j/w.getValue(F),ot("parent")),G("percent entry")&&(Z=j/w.getValue(T),ot("entry")),G("percent root")&&(Z=j/w.getValue(R),ot("root"))}}return G("text")&&(ct=A.castOption(c,B.i,"text"),A.isValidTextValue(ct)&&rt.push(ct)),rt.join("
          ")}var X=A.castOption(c,B.i,"texttemplate");if(!X)return"";var Q={};B.label&&(Q.label=B.label),B.hasOwnProperty("v")&&(Q.value=B.v,Q.valueLabel=w.formatValue(B.v,z)),Q.currentPath=w.getPath(M.data),I||(Q.percentParent=j/w.getValue(F),Q.percentParentLabel=w.formatPercent(Q.percentParent,z),Q.parent=w.getPtLabel(F)),Q.percentEntry=j/w.getValue(T),Q.percentEntryLabel=w.formatPercent(Q.percentEntry,z),Q.entry=w.getPtLabel(T),Q.percentRoot=j/w.getValue(R),Q.percentRootLabel=w.formatPercent(Q.percentRoot,z),Q.root=w.getPtLabel(R),B.hasOwnProperty("color")&&(Q.color=B.color);var ut=A.castOption(c,B.i,"text");return(A.isValidTextValue(ut)||ut==="")&&(Q.text=ut),Q.customdata=A.castOption(c,B.i,"customdata"),A.texttemplateString({data:[Q,c._meta],fallback:c.texttemplatefallback,labels:Q,locale:b._d3locale,template:X})};function y(M){return M.rpx0===0&&A.isFullCircle([M.x0,M.x1])?1:Math.max(0,Math.min(1/(1+1/Math.sin(M.halfangle)),M.ring/2))}function S(M){return k(M.rpx1,M.transform.textPosAngle)}function k(M,T){return[M*Math.sin(T),-M*Math.cos(T)]}}),o8=Vt((K,V)=>{V.exports={moduleType:"trace",name:"sunburst",basePlotModule:wS(),categories:[],animatable:!0,attributes:uv(),layoutAttributes:cw(),supplyDefaults:TS(),supplyLayoutDefaults:kS(),calc:fv().calc,crossTraceCalc:fv().crossTraceCalc,plot:wx().plot,style:f3().style,colorbar:Zf(),meta:{}}}),s8=Vt((K,V)=>{V.exports=o8()}),l8=Vt(K=>{var V=Vu();K.name="treemap",K.plot=function(u,d,E,A){V.plotBasePlot(K.name,u,d,E,A)},K.clean=function(u,d,E,A){V.cleanBasePlot(K.name,u,d,E,A)}}),z0=Vt((K,V)=>{V.exports={CLICK_TRANSITION_TIME:750,CLICK_TRANSITION_EASING:"poly",eventDataKeys:["currentPath","root","entry","percentRoot","percentEntry","percentParent"],gapWithPathbar:1}}),Tx=Vt((K,V)=>{var{hovertemplateAttrs:u,texttemplateAttrs:d,templatefallbackAttrs:E}=yl(),A=Wl(),t=Hu().attributes,e=b0(),r=uv(),i=z0(),n=So().extendFlat,o=If().pattern;V.exports={labels:r.labels,parents:r.parents,values:r.values,branchvalues:r.branchvalues,count:r.count,level:r.level,maxdepth:r.maxdepth,tiling:{packing:{valType:"enumerated",values:["squarify","binary","dice","slice","slice-dice","dice-slice"],dflt:"squarify",editType:"plot"},squarifyratio:{valType:"number",min:1,dflt:1,editType:"plot"},flip:{valType:"flaglist",flags:["x","y"],dflt:"",editType:"plot"},pad:{valType:"number",min:0,dflt:3,editType:"plot"},editType:"calc"},marker:n({pad:{t:{valType:"number",min:0,editType:"plot"},l:{valType:"number",min:0,editType:"plot"},r:{valType:"number",min:0,editType:"plot"},b:{valType:"number",min:0,editType:"plot"},editType:"calc"},colors:r.marker.colors,pattern:o,depthfade:{valType:"enumerated",values:[!0,!1,"reversed"],editType:"style"},line:r.marker.line,cornerradius:{valType:"number",min:0,dflt:0,editType:"plot"},editType:"calc"},A("marker",{colorAttr:"colors",anim:!1})),pathbar:{visible:{valType:"boolean",dflt:!0,editType:"plot"},side:{valType:"enumerated",values:["top","bottom"],dflt:"top",editType:"plot"},edgeshape:{valType:"enumerated",values:[">","<","|","/","\\"],dflt:">",editType:"plot"},thickness:{valType:"number",min:12,editType:"plot"},textfont:n({},e.textfont,{}),editType:"calc"},text:e.text,textinfo:r.textinfo,texttemplate:d({editType:"plot"},{keys:i.eventDataKeys.concat(["label","value"])}),texttemplatefallback:E({editType:"plot"}),hovertext:e.hovertext,hoverinfo:r.hoverinfo,hovertemplate:u({},{keys:i.eventDataKeys}),hovertemplatefallback:E(),textfont:e.textfont,insidetextfont:e.insidetextfont,outsidetextfont:n({},e.outsidetextfont,{}),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"top left",editType:"plot"},sort:e.sort,root:r.root,domain:t({name:"treemap",trace:!0,editType:"calc"})}}),h3=Vt((K,V)=>{V.exports={treemapcolorway:{valType:"colorlist",editType:"calc"},extendtreemapcolors:{valType:"boolean",dflt:!0,editType:"calc"}}}),u8=Vt((K,V)=>{var u=Xr(),d=Tx(),E=Pi(),A=Hu().defaults,t=Ch().handleText,e=m0().TEXTPAD,r=w0().handleMarkerDefaults,i=xu(),n=i.hasColorscale,o=i.handleDefaults;V.exports=function(a,s,f,v){function g(h,b){return u.coerce(a,s,d,h,b)}var m=g("labels"),w=g("parents");if(!m||!m.length||!w||!w.length){s.visible=!1;return}var l=g("values");l&&l.length?g("branchvalues"):g("count"),g("level"),g("maxdepth");var x=g("tiling.packing");x==="squarify"&&g("tiling.squarifyratio"),g("tiling.flip"),g("tiling.pad");var y=g("text");g("texttemplate"),g("texttemplatefallback"),s.texttemplate||g("textinfo",u.isArrayOrTypedArray(y)?"text+label":"label"),g("hovertext"),g("hovertemplate"),g("hovertemplatefallback");var S=g("pathbar.visible"),k="auto";t(a,s,v,g,k,{hasPathbar:S,moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),g("textposition");var M=s.textposition.indexOf("bottom")!==-1;r(a,s,v,g);var T=s._hasColorscale=n(a,"marker","colors")||(a.marker||{}).coloraxis;T?o(a,s,v,g,{prefix:"marker.",cLetter:"c"}):g("marker.depthfade",!(s.marker.colors||[]).length);var c=s.textfont.size*2;g("marker.pad.t",M?c/4:c),g("marker.pad.l",c/4),g("marker.pad.r",c/4),g("marker.pad.b",M?c:c/4),g("marker.cornerradius"),s._hovered={marker:{line:{width:2,color:E.contrast(v.paper_bgcolor)}}},S&&(g("pathbar.thickness",s.pathbar.textfont.size+2*e),g("pathbar.side"),g("pathbar.edgeshape")),g("sort"),g("root.color"),A(s,v,g),s._length=null}}),c8=Vt((K,V)=>{var u=Xr(),d=h3();V.exports=function(E,A){function t(e,r){return u.coerce(E,A,d,e,r)}t("treemapcolorway",A.colorway),t("extendtreemapcolors")}}),p3=Vt(K=>{var V=fv();K.calc=function(u,d){return V.calc(u,d)},K.crossTraceCalc=function(u){return V._runCrossTraceCalc("treemap",u)}}),d3=Vt((K,V)=>{V.exports=function u(d,E,A){var t;A.swapXY&&(t=d.x0,d.x0=d.y0,d.y0=t,t=d.x1,d.x1=d.y1,d.y1=t),A.flipX&&(t=d.x0,d.x0=E[0]-d.x1,d.x1=E[0]-t),A.flipY&&(t=d.y0,d.y0=E[1]-d.y1,d.y1=E[1]-t);var e=d.children;if(e)for(var r=0;r{var u=cv(),d=d3();V.exports=function(A,t,e){var r=e.flipX,i=e.flipY,n=e.packing==="dice-slice",o=e.pad[i?"bottom":"top"],a=e.pad[r?"right":"left"],s=e.pad[r?"left":"right"],f=e.pad[i?"top":"bottom"],v;n&&(v=a,a=o,o=v,v=s,s=f,f=v);var g=u.treemap().tile(E(e.packing,e.squarifyratio)).paddingInner(e.pad.inner).paddingLeft(a).paddingRight(s).paddingTop(o).paddingBottom(f).size(n?[t[1],t[0]]:t)(A);return(n||r||i)&&d(g,t,{swapXY:n,flipX:r,flipY:i}),g};function E(A,t){switch(A){case"squarify":return u.treemapSquarify.ratio(t);case"binary":return u.treemapBinary;case"dice":return u.treemapDice;case"slice":return u.treemapSlice;default:return u.treemapSliceDice}}}),kx=Vt((K,V)=>{var u=Ni(),d=Pi(),E=Xr(),A=Up(),t=sh().resizeText,e=bx();function r(n){var o=n._fullLayout._treemaplayer.selectAll(".trace");t(n,o,"treemap"),o.each(function(a){var s=u.select(this),f=a[0],v=f.trace;s.style("opacity",v.opacity),s.selectAll("path.surface").each(function(g){u.select(this).call(i,g,v,n,{hovered:!1})})})}function i(n,o,a,s,f){var v=(f||{}).hovered,g=o.data.data,m=g.i,w,l,x=g.color,y=A.isHierarchyRoot(o),S=1;if(v)w=a._hovered.marker.line.color,l=a._hovered.marker.line.width;else if(y&&x===a.root.color)S=100,w="rgba(0,0,0,0)",l=0;else if(w=E.castOption(a,m,"marker.line.color")||d.defaultLine,l=E.castOption(a,m,"marker.line.width")||0,!a._hasColorscale&&!o.onPathbar){var k=a.marker.depthfade;if(k){var M=d.combine(d.addOpacity(a._backgroundColor,.75),x),T;if(k===!0){var c=A.getMaxDepth(a);isFinite(c)?A.isLeaf(o)?T=0:T=a._maxVisibleLayers-(o.data.depth-a._entryDepth):T=o.data.height+1}else T=o.data.depth-a._entryDepth,a._atRootLevel||T++;if(T>0)for(var h=0;h{var u=Ni(),d=Xr(),E=Eo(),A=Dl(),t=m3(),e=kx().styleOne,r=z0(),i=Up(),n=Sv(),o=!0;V.exports=function(a,s,f,v,g){var m=g.barDifY,w=g.width,l=g.height,x=g.viewX,y=g.viewY,S=g.pathSlice,k=g.toMoveInsideSlice,M=g.strTransform,T=g.hasTransition,c=g.handleSlicesExit,h=g.makeUpdateSliceInterpolator,b=g.makeUpdateTextInterpolator,_={},P=a._context.staticPlot,z=a._fullLayout,D=s[0],B=D.trace,R=D.hierarchy,I=w/B._entryDepth,F=i.listPath(f.data,"id"),j=t(R.copy(),[w,l],{packing:"dice",pad:{inner:0,top:0,left:0,right:0,bottom:0}}).descendants();j=j.filter(function(G){var rt=F.indexOf(G.data.id);return rt===-1?!1:(G.x0=I*rt,G.x1=I*(rt+1),G.y0=m,G.y1=m+l,G.onPathbar=!0,!0)}),j.reverse(),v=v.data(j,i.getPtId),v.enter().append("g").classed("pathbar",!0),c(v,o,_,[w,l],S),v.order();var N=v;T&&(N=N.transition().each("end",function(){var G=u.select(this);i.setSliceCursor(G,a,{hideOnRoot:!1,hideOnLeaves:!1,isTransitioning:!1})})),N.each(function(G){G._x0=x(G.x0),G._x1=x(G.x1),G._y0=y(G.y0),G._y1=y(G.y1),G._hoverX=x(G.x1-Math.min(w,l)/2),G._hoverY=y(G.y1-l/2);var rt=u.select(this),ct=d.ensureSingle(rt,"path","surface",function(ot){ot.style("pointer-events",P?"none":"all")});T?ct.transition().attrTween("d",function(ot){var X=h(ot,o,_,[w,l]);return function(Q){return S(X(Q))}}):ct.attr("d",S),rt.call(n,f,a,s,{styleOne:e,eventDataKeys:r.eventDataKeys,transitionTime:r.CLICK_TRANSITION_TIME,transitionEasing:r.CLICK_TRANSITION_EASING}).call(i.setSliceCursor,a,{hideOnRoot:!1,hideOnLeaves:!1,isTransitioning:a._transitioning}),ct.call(e,G,B,a,{hovered:!1}),G._text=(i.getPtLabel(G)||"").split("
          ").join(" ")||"";var st=d.ensureSingle(rt,"g","slicetext"),et=d.ensureSingle(st,"text","",function(ot){ot.attr("data-notex",1)}),Z=d.ensureUniformFontSize(a,i.determineTextFont(B,G,z.font,{onPathbar:!0}));et.text(G._text||" ").classed("slicetext",!0).attr("text-anchor","start").call(E.font,Z).call(A.convertToTspans,a),G.textBB=E.bBox(et.node()),G.transform=k(G,{fontSize:Z.size,onPathbar:!0}),G.transform.fontSize=Z.size,T?et.transition().attrTween("transform",function(ot){var X=b(ot,o,_,[w,l]);return function(Q){return M(X(Q))}}):et.attr("transform",M(G))})}}),h8=Vt((K,V)=>{var u=Ni(),d=(E0(),xd(Rd)).interpolate,E=Up(),A=Xr(),t=m0().TEXTPAD,e=g0(),r=e.toMoveInsideBar,i=sh(),n=i.recordMinTextSize,o=z0(),a=f8();function s(f){return E.isHierarchyRoot(f)?"":E.getPtId(f)}V.exports=function(f,v,g,m,w){var l=f._fullLayout,x=v[0],y=x.trace,S=y.type,k=S==="icicle",M=x.hierarchy,T=E.findEntryWithLevel(M,y.level),c=u.select(g),h=c.selectAll("g.pathbar"),b=c.selectAll("g.slice");if(!T){h.remove(),b.remove();return}var _=E.isHierarchyRoot(T),P=!l.uniformtext.mode&&E.hasTransition(m),z=E.getMaxDepth(y),D=function(er){return er.data.depth-T.data.depth-1?F+G:-(N+G):0,ct={x0:j,x1:j,y0:rt,y1:rt+N},st=function(er,Mr,Ir){var de=y.tiling.pad,Dt=function(yt){return yt-de<=Mr.x0},qt=function(yt){return yt+de>=Mr.x1},_t=function(yt){return yt-de<=Mr.y0},lt=function(yt){return yt+de>=Mr.y1};return er.x0===Mr.x0&&er.x1===Mr.x1&&er.y0===Mr.y0&&er.y1===Mr.y1?{x0:er.x0,x1:er.x1,y0:er.y0,y1:er.y1}:{x0:Dt(er.x0-de)?0:qt(er.x0-de)?Ir[0]:er.x0,x1:Dt(er.x1+de)?0:qt(er.x1+de)?Ir[0]:er.x1,y0:_t(er.y0-de)?0:lt(er.y0-de)?Ir[1]:er.y0,y1:_t(er.y1+de)?0:lt(er.y1+de)?Ir[1]:er.y1}},et=null,Z={},ot={},X=null,Q=function(er,Mr){return Mr?Z[s(er)]:ot[s(er)]},ut=function(er,Mr,Ir,de){if(Mr)return Z[s(M)]||ct;var Dt=ot[y.level]||Ir;return D(er)?st(er,Dt,de):{}};x.hasMultipleRoots&&_&&z++,y._maxDepth=z,y._backgroundColor=l.paper_bgcolor,y._entryDepth=T.data.depth,y._atRootLevel=_;var J=-I/2+B.l+B.w*(R.x[1]+R.x[0])/2,q=-F/2+B.t+B.h*(1-(R.y[1]+R.y[0])/2),it=function(er){return J+er},nt=function(er){return q+er},dt=nt(0),Tt=it(0),wt=function(er){return Tt+er},Ct=function(er){return dt+er};function It(er,Mr){return er+","+Mr}var Nt=wt(0),te=function(er){er.x=Math.max(Nt,er.x)},Jt=y.pathbar.edgeshape,ee=function(er){var Mr=wt(Math.max(Math.min(er.x0,er.x0),0)),Ir=wt(Math.min(Math.max(er.x1,er.x1),j)),de=Ct(er.y0),Dt=Ct(er.y1),qt=N/2,_t={},lt={};_t.x=Mr,lt.x=Ir,_t.y=lt.y=(de+Dt)/2;var yt={x:Mr,y:de},St={x:Ir,y:de},Ht={x:Ir,y:Dt},Yt={x:Mr,y:Dt};return Jt===">"?(yt.x-=qt,St.x-=qt,Ht.x-=qt,Yt.x-=qt):Jt==="/"?(Ht.x-=qt,Yt.x-=qt,_t.x-=qt/2,lt.x-=qt/2):Jt==="\\"?(yt.x-=qt,St.x-=qt,_t.x-=qt/2,lt.x-=qt/2):Jt==="<"&&(_t.x-=qt,lt.x-=qt),te(yt),te(Yt),te(_t),te(St),te(Ht),te(lt),"M"+It(yt.x,yt.y)+"L"+It(St.x,St.y)+"L"+It(lt.x,lt.y)+"L"+It(Ht.x,Ht.y)+"L"+It(Yt.x,Yt.y)+"L"+It(_t.x,_t.y)+"Z"},Zt=y[k?"tiling":"marker"].pad,mt=function(er){return y.textposition.indexOf(er)!==-1},bt=mt("top"),vt=mt("left"),Ut=mt("right"),re=mt("bottom"),Kt=function(er){var Mr=it(er.x0),Ir=it(er.x1),de=nt(er.y0),Dt=nt(er.y1),qt=Ir-Mr,_t=Dt-de;if(!qt||!_t)return"";var lt=y.marker.cornerradius||0,yt=Math.min(lt,qt/2,_t/2);yt&&er.data&&er.data.data&&er.data.data.label&&(bt&&(yt=Math.min(yt,Zt.t)),vt&&(yt=Math.min(yt,Zt.l)),Ut&&(yt=Math.min(yt,Zt.r)),re&&(yt=Math.min(yt,Zt.b)));var St=function(Ht,Yt){return yt?"a"+It(yt,yt)+" 0 0 1 "+It(Ht,Yt):""};return"M"+It(Mr,de+yt)+St(yt,-yt)+"L"+It(Ir-yt,de)+St(yt,yt)+"L"+It(Ir,Dt-yt)+St(-yt,yt)+"L"+It(Mr+yt,Dt)+St(-yt,-yt)+"Z"},ue=function(er,Mr){var Ir=er.x0,de=er.x1,Dt=er.y0,qt=er.y1,_t=er.textBB,lt=bt||Mr.isHeader&&!re,yt=lt?"start":re?"end":"middle",St=mt("right"),Ht=mt("left")||Mr.onPathbar,Yt=Ht?-1:St?1:0;if(Mr.isHeader){if(Ir+=(k?Zt:Zt.l)-t,de-=(k?Zt:Zt.r)-t,Ir>=de){var se=(Ir+de)/2;Ir=se,de=se}var ke;re?(ke=qt-(k?Zt:Zt.b),Dt{var u=Ni(),d=Up(),E=sh(),A=E.clearMinTextSize,t=Vh().resizeText,e=h8();V.exports=function(r,i,n,o,a){var s=a.type,f=a.drawDescendants,v=r._fullLayout,g=v["_"+s+"layer"],m,w,l=!n;if(A(s,v),m=g.selectAll("g.trace."+s).data(i,function(y){return y[0].trace.uid}),m.enter().append("g").classed("trace",!0).classed(s,!0),m.order(),!v.uniformtext.mode&&d.hasTransition(n)){o&&(w=o());var x=u.transition().duration(n.duration).ease(n.easing).each("end",function(){w&&w()}).each("interrupt",function(){w&&w()});x.each(function(){g.selectAll("g.trace").each(function(y){e(r,y,this,n,f)})})}else m.each(function(y){e(r,y,this,n,f)}),v.uniformtext.mode&&t(r,g.selectAll(".trace"),s);l&&m.exit().remove()}}),p8=Vt((K,V)=>{var u=Ni(),d=Xr(),E=Eo(),A=Dl(),t=m3(),e=kx().styleOne,r=z0(),i=Up(),n=Sv(),o=wx().formatSliceLabel,a=!1;V.exports=function(s,f,v,g,m){var w=m.width,l=m.height,x=m.viewX,y=m.viewY,S=m.pathSlice,k=m.toMoveInsideSlice,M=m.strTransform,T=m.hasTransition,c=m.handleSlicesExit,h=m.makeUpdateSliceInterpolator,b=m.makeUpdateTextInterpolator,_=m.prevEntry,P={},z=s._context.staticPlot,D=s._fullLayout,B=f[0],R=B.trace,I=R.textposition.indexOf("left")!==-1,F=R.textposition.indexOf("right")!==-1,j=R.textposition.indexOf("bottom")!==-1,N=!j&&!R.marker.pad.t||j&&!R.marker.pad.b,G=t(v,[w,l],{packing:R.tiling.packing,squarifyratio:R.tiling.squarifyratio,flipX:R.tiling.flip.indexOf("x")>-1,flipY:R.tiling.flip.indexOf("y")>-1,pad:{inner:R.tiling.pad,top:R.marker.pad.t,left:R.marker.pad.l,right:R.marker.pad.r,bottom:R.marker.pad.b}}),rt=G.descendants(),ct=1/0,st=-1/0;rt.forEach(function(Q){var ut=Q.depth;ut>=R._maxDepth?(Q.x0=Q.x1=(Q.x0+Q.x1)/2,Q.y0=Q.y1=(Q.y0+Q.y1)/2):(ct=Math.min(ct,ut),st=Math.max(st,ut))}),g=g.data(rt,i.getPtId),R._maxVisibleLayers=isFinite(st)?st-ct+1:0,g.enter().append("g").classed("slice",!0),c(g,a,P,[w,l],S),g.order();var et=null;if(T&&_){var Z=i.getPtId(_);g.each(function(Q){et===null&&i.getPtId(Q)===Z&&(et={x0:Q.x0,x1:Q.x1,y0:Q.y0,y1:Q.y1})})}var ot=function(){return et||{x0:0,x1:w,y0:0,y1:l}},X=g;return T&&(X=X.transition().each("end",function(){var Q=u.select(this);i.setSliceCursor(Q,s,{hideOnRoot:!0,hideOnLeaves:!1,isTransitioning:!1})})),X.each(function(Q){var ut=i.isHeader(Q,R);Q._x0=x(Q.x0),Q._x1=x(Q.x1),Q._y0=y(Q.y0),Q._y1=y(Q.y1),Q._hoverX=x(Q.x1-R.marker.pad.r),Q._hoverY=y(j?Q.y1-R.marker.pad.b/2:Q.y0+R.marker.pad.t/2);var J=u.select(this),q=d.ensureSingle(J,"path","surface",function(Ct){Ct.style("pointer-events",z?"none":"all")});T?q.transition().attrTween("d",function(Ct){var It=h(Ct,a,ot(),[w,l]);return function(Nt){return S(It(Nt))}}):q.attr("d",S),J.call(n,v,s,f,{styleOne:e,eventDataKeys:r.eventDataKeys,transitionTime:r.CLICK_TRANSITION_TIME,transitionEasing:r.CLICK_TRANSITION_EASING}).call(i.setSliceCursor,s,{isTransitioning:s._transitioning}),q.call(e,Q,R,s,{hovered:!1}),Q.x0===Q.x1||Q.y0===Q.y1?Q._text="":ut?Q._text=N?"":i.getPtLabel(Q)||"":Q._text=o(Q,v,R,f,D)||"";var it=d.ensureSingle(J,"g","slicetext"),nt=d.ensureSingle(it,"text","",function(Ct){Ct.attr("data-notex",1)}),dt=d.ensureUniformFontSize(s,i.determineTextFont(R,Q,D.font)),Tt=Q._text||" ",wt=ut&&Tt.indexOf("
          ")===-1;nt.text(Tt).classed("slicetext",!0).attr("text-anchor",F?"end":I||wt?"start":"middle").call(E.font,dt).call(A.convertToTspans,s),Q.textBB=E.bBox(nt.node()),Q.transform=k(Q,{fontSize:dt.size,isHeader:ut}),Q.transform.fontSize=dt.size,T?nt.transition().attrTween("transform",function(Ct){var It=b(Ct,a,ot(),[w,l]);return function(Nt){return M(It(Nt))}}):nt.attr("transform",M(Q))}),et}}),d8=Vt((K,V)=>{var u=g3(),d=p8();V.exports=function(E,A,t,e){return u(E,A,t,e,{type:"treemap",drawDescendants:d})}}),m8=Vt((K,V)=>{V.exports={moduleType:"trace",name:"treemap",basePlotModule:l8(),categories:[],animatable:!0,attributes:Tx(),layoutAttributes:h3(),supplyDefaults:u8(),supplyLayoutDefaults:c8(),calc:p3().calc,crossTraceCalc:p3().crossTraceCalc,plot:d8(),style:kx().style,colorbar:Zf(),meta:{}}}),g8=Vt((K,V)=>{V.exports=m8()}),v8=Vt(K=>{var V=Vu();K.name="icicle",K.plot=function(u,d,E,A){V.plotBasePlot(K.name,u,d,E,A)},K.clean=function(u,d,E,A){V.cleanBasePlot(K.name,u,d,E,A)}}),v3=Vt((K,V)=>{var{hovertemplateAttrs:u,texttemplateAttrs:d,templatefallbackAttrs:E}=yl(),A=Wl(),t=Hu().attributes,e=b0(),r=uv(),i=Tx(),n=z0(),o=So().extendFlat,a=If().pattern;V.exports={labels:r.labels,parents:r.parents,values:r.values,branchvalues:r.branchvalues,count:r.count,level:r.level,maxdepth:r.maxdepth,tiling:{orientation:{valType:"enumerated",values:["v","h"],dflt:"h",editType:"plot"},flip:i.tiling.flip,pad:{valType:"number",min:0,dflt:0,editType:"plot"},editType:"calc"},marker:o({colors:r.marker.colors,line:r.marker.line,pattern:a,editType:"calc"},A("marker",{colorAttr:"colors",anim:!1})),leaf:r.leaf,pathbar:i.pathbar,text:e.text,textinfo:r.textinfo,texttemplate:d({editType:"plot"},{keys:n.eventDataKeys.concat(["label","value"])}),texttemplatefallback:E({editType:"plot"}),hovertext:e.hovertext,hoverinfo:r.hoverinfo,hovertemplate:u({},{keys:n.eventDataKeys}),hovertemplatefallback:E(),textfont:e.textfont,insidetextfont:e.insidetextfont,outsidetextfont:i.outsidetextfont,textposition:i.textposition,sort:e.sort,root:r.root,domain:t({name:"icicle",trace:!0,editType:"calc"})}}),y3=Vt((K,V)=>{V.exports={iciclecolorway:{valType:"colorlist",editType:"calc"},extendiciclecolors:{valType:"boolean",dflt:!0,editType:"calc"}}}),y8=Vt((K,V)=>{var u=Xr(),d=v3(),E=Pi(),A=Hu().defaults,t=Ch().handleText,e=m0().TEXTPAD,r=w0().handleMarkerDefaults,i=xu(),n=i.hasColorscale,o=i.handleDefaults;V.exports=function(a,s,f,v){function g(M,T){return u.coerce(a,s,d,M,T)}var m=g("labels"),w=g("parents");if(!m||!m.length||!w||!w.length){s.visible=!1;return}var l=g("values");l&&l.length?g("branchvalues"):g("count"),g("level"),g("maxdepth"),g("tiling.orientation"),g("tiling.flip"),g("tiling.pad");var x=g("text");g("texttemplate"),g("texttemplatefallback"),s.texttemplate||g("textinfo",u.isArrayOrTypedArray(x)?"text+label":"label"),g("hovertext"),g("hovertemplate"),g("hovertemplatefallback");var y=g("pathbar.visible"),S="auto";t(a,s,v,g,S,{hasPathbar:y,moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),g("textposition"),r(a,s,v,g);var k=s._hasColorscale=n(a,"marker","colors")||(a.marker||{}).coloraxis;k&&o(a,s,v,g,{prefix:"marker.",cLetter:"c"}),g("leaf.opacity",k?1:.7),s._hovered={marker:{line:{width:2,color:E.contrast(v.paper_bgcolor)}}},y&&(g("pathbar.thickness",s.pathbar.textfont.size+2*e),g("pathbar.side"),g("pathbar.edgeshape")),g("sort"),g("root.color"),A(s,v,g),s._length=null}}),x8=Vt((K,V)=>{var u=Xr(),d=y3();V.exports=function(E,A){function t(e,r){return u.coerce(E,A,d,e,r)}t("iciclecolorway",A.colorway),t("extendiciclecolors")}}),x3=Vt(K=>{var V=fv();K.calc=function(u,d){return V.calc(u,d)},K.crossTraceCalc=function(u){return V._runCrossTraceCalc("icicle",u)}}),_8=Vt((K,V)=>{var u=cv(),d=d3();V.exports=function(E,A,t){var e=t.flipX,r=t.flipY,i=t.orientation==="h",n=t.maxDepth,o=A[0],a=A[1];n&&(o=(E.height+1)*A[0]/Math.min(E.height+1,n),a=(E.height+1)*A[1]/Math.min(E.height+1,n));var s=u.partition().padding(t.pad.inner).size(i?[A[1],o]:[A[0],a])(E);return(i||e||r)&&d(s,A,{swapXY:i,flipX:e,flipY:r}),s}}),_3=Vt((K,V)=>{var u=Ni(),d=Pi(),E=Xr(),A=sh().resizeText,t=bx();function e(i){var n=i._fullLayout._iciclelayer.selectAll(".trace");A(i,n,"icicle"),n.each(function(o){var a=u.select(this),s=o[0],f=s.trace;a.style("opacity",f.opacity),a.selectAll("path.surface").each(function(v){u.select(this).call(r,v,f,i)})})}function r(i,n,o,a){var s=n.data.data,f=!n.children,v=s.i,g=E.castOption(o,v,"marker.line.color")||d.defaultLine,m=E.castOption(o,v,"marker.line.width")||0;i.call(t,n,o,a).style("stroke-width",m).call(d.stroke,g).style("opacity",f?o.leaf.opacity:null)}V.exports={style:e,styleOne:r}}),b8=Vt((K,V)=>{var u=Ni(),d=Xr(),E=Eo(),A=Dl(),t=_8(),e=_3().styleOne,r=z0(),i=Up(),n=Sv(),o=wx().formatSliceLabel,a=!1;V.exports=function(s,f,v,g,m){var w=m.width,l=m.height,x=m.viewX,y=m.viewY,S=m.pathSlice,k=m.toMoveInsideSlice,M=m.strTransform,T=m.hasTransition,c=m.handleSlicesExit,h=m.makeUpdateSliceInterpolator,b=m.makeUpdateTextInterpolator,_=m.prevEntry,P={},z=s._context.staticPlot,D=s._fullLayout,B=f[0],R=B.trace,I=R.textposition.indexOf("left")!==-1,F=R.textposition.indexOf("right")!==-1,j=R.textposition.indexOf("bottom")!==-1,N=t(v,[w,l],{flipX:R.tiling.flip.indexOf("x")>-1,flipY:R.tiling.flip.indexOf("y")>-1,orientation:R.tiling.orientation,pad:{inner:R.tiling.pad},maxDepth:R._maxDepth}),G=N.descendants(),rt=1/0,ct=-1/0;G.forEach(function(X){var Q=X.depth;Q>=R._maxDepth?(X.x0=X.x1=(X.x0+X.x1)/2,X.y0=X.y1=(X.y0+X.y1)/2):(rt=Math.min(rt,Q),ct=Math.max(ct,Q))}),g=g.data(G,i.getPtId),R._maxVisibleLayers=isFinite(ct)?ct-rt+1:0,g.enter().append("g").classed("slice",!0),c(g,a,P,[w,l],S),g.order();var st=null;if(T&&_){var et=i.getPtId(_);g.each(function(X){st===null&&i.getPtId(X)===et&&(st={x0:X.x0,x1:X.x1,y0:X.y0,y1:X.y1})})}var Z=function(){return st||{x0:0,x1:w,y0:0,y1:l}},ot=g;return T&&(ot=ot.transition().each("end",function(){var X=u.select(this);i.setSliceCursor(X,s,{hideOnRoot:!0,hideOnLeaves:!1,isTransitioning:!1})})),ot.each(function(X){X._x0=x(X.x0),X._x1=x(X.x1),X._y0=y(X.y0),X._y1=y(X.y1),X._hoverX=x(X.x1-R.tiling.pad),X._hoverY=y(j?X.y1-R.tiling.pad/2:X.y0+R.tiling.pad/2);var Q=u.select(this),ut=d.ensureSingle(Q,"path","surface",function(nt){nt.style("pointer-events",z?"none":"all")});T?ut.transition().attrTween("d",function(nt){var dt=h(nt,a,Z(),[w,l],{orientation:R.tiling.orientation,flipX:R.tiling.flip.indexOf("x")>-1,flipY:R.tiling.flip.indexOf("y")>-1});return function(Tt){return S(dt(Tt))}}):ut.attr("d",S),Q.call(n,v,s,f,{styleOne:e,eventDataKeys:r.eventDataKeys,transitionTime:r.CLICK_TRANSITION_TIME,transitionEasing:r.CLICK_TRANSITION_EASING}).call(i.setSliceCursor,s,{isTransitioning:s._transitioning}),ut.call(e,X,R,s,{hovered:!1}),X.x0===X.x1||X.y0===X.y1?X._text="":X._text=o(X,v,R,f,D)||"";var J=d.ensureSingle(Q,"g","slicetext"),q=d.ensureSingle(J,"text","",function(nt){nt.attr("data-notex",1)}),it=d.ensureUniformFontSize(s,i.determineTextFont(R,X,D.font));q.text(X._text||" ").classed("slicetext",!0).attr("text-anchor",F?"end":I?"start":"middle").call(E.font,it).call(A.convertToTspans,s),X.textBB=E.bBox(q.node()),X.transform=k(X,{fontSize:it.size}),X.transform.fontSize=it.size,T?q.transition().attrTween("transform",function(nt){var dt=b(nt,a,Z(),[w,l]);return function(Tt){return M(dt(Tt))}}):q.attr("transform",M(X))}),st}}),w8=Vt((K,V)=>{var u=g3(),d=b8();V.exports=function(E,A,t,e){return u(E,A,t,e,{type:"icicle",drawDescendants:d})}}),T8=Vt((K,V)=>{V.exports={moduleType:"trace",name:"icicle",basePlotModule:v8(),categories:[],animatable:!0,attributes:v3(),layoutAttributes:y3(),supplyDefaults:y8(),supplyLayoutDefaults:x8(),calc:x3().calc,crossTraceCalc:x3().crossTraceCalc,plot:w8(),style:_3().style,colorbar:Zf(),meta:{}}}),k8=Vt((K,V)=>{V.exports=T8()}),A8=Vt(K=>{var V=Vu();K.name="funnelarea",K.plot=function(u,d,E,A){V.plotBasePlot(K.name,u,d,E,A)},K.clean=function(u,d,E,A){V.cleanBasePlot(K.name,u,d,E,A)}}),b3=Vt((K,V)=>{var u=b0(),d=kl(),E=Hu().attributes,{hovertemplateAttrs:A,texttemplateAttrs:t,templatefallbackAttrs:e}=yl(),r=So().extendFlat;V.exports={labels:u.labels,label0:u.label0,dlabel:u.dlabel,values:u.values,marker:{colors:u.marker.colors,line:{color:r({},u.marker.line.color,{dflt:null}),width:r({},u.marker.line.width,{dflt:1}),editType:"calc"},pattern:u.marker.pattern,editType:"calc"},text:u.text,hovertext:u.hovertext,scalegroup:r({},u.scalegroup,{}),textinfo:r({},u.textinfo,{flags:["label","text","value","percent"]}),texttemplate:t({editType:"plot"},{keys:["label","color","value","text","percent"]}),texttemplatefallback:e({editType:"plot"}),hoverinfo:r({},d.hoverinfo,{flags:["label","text","value","percent","name"]}),hovertemplate:A({},{keys:["label","color","value","text","percent"]}),hovertemplatefallback:e(),textposition:r({},u.textposition,{values:["inside","none"],dflt:"inside"}),textfont:u.textfont,insidetextfont:u.insidetextfont,title:{text:u.title.text,font:u.title.font,position:r({},u.title.position,{values:["top left","top center","top right"],dflt:"top center"}),editType:"plot"},domain:E({name:"funnelarea",trace:!0,editType:"calc"}),aspectratio:{valType:"number",min:0,dflt:1,editType:"plot"},baseratio:{valType:"number",min:0,max:1,dflt:.333,editType:"plot"}}}),w3=Vt((K,V)=>{var u=W1().hiddenlabels;V.exports={hiddenlabels:u,funnelareacolorway:{valType:"colorlist",editType:"calc"},extendfunnelareacolors:{valType:"boolean",dflt:!0,editType:"calc"}}}),M8=Vt((K,V)=>{var u=Xr(),d=b3(),E=Hu().defaults,A=Ch().handleText,t=w0().handleLabelsAndValues,e=w0().handleMarkerDefaults;V.exports=function(r,i,n,o){function a(S,k){return u.coerce(r,i,d,S,k)}var s=a("labels"),f=a("values"),v=t(s,f),g=v.len;if(i._hasLabels=v.hasLabels,i._hasValues=v.hasValues,!i._hasLabels&&i._hasValues&&(a("label0"),a("dlabel")),!g){i.visible=!1;return}i._length=g,e(r,i,o,a),a("scalegroup");var m=a("text"),w=a("texttemplate");a("texttemplatefallback");var l;if(w||(l=a("textinfo",Array.isArray(m)?"text+percent":"percent")),a("hovertext"),a("hovertemplate"),a("hovertemplatefallback"),w||l&&l!=="none"){var x=a("textposition");A(r,i,o,a,x,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1})}else l==="none"&&a("textposition","none");E(i,o,a);var y=a("title.text");y&&(a("title.position"),u.coerceFont(a,"title.font",o.font)),a("aspectratio"),a("baseratio")}}),S8=Vt((K,V)=>{var u=Xr(),d=w3();V.exports=function(E,A){function t(e,r){return u.coerce(E,A,d,e,r)}t("hiddenlabels"),t("funnelareacolorway",A.colorway),t("extendfunnelareacolors")}}),T3=Vt((K,V)=>{var u=Um();function d(A,t){return u.calc(A,t)}function E(A){u.crossTraceCalc(A,{type:"funnelarea"})}V.exports={calc:d,crossTraceCalc:E}}),E8=Vt((K,V)=>{var u=Ni(),d=Eo(),E=Xr(),A=E.strScale,t=E.strTranslate,e=Dl(),r=g0(),i=r.toMoveInsideBar,n=sh(),o=n.recordMinTextSize,a=n.clearMinTextSize,s=Sd(),f=G1(),v=f.attachFxHandlers,g=f.determineInsideTextFont,m=f.layoutAreas,w=f.prerenderTitles,l=f.positionTitleOutside,x=f.formatSliceLabel;V.exports=function(M,T){var c=M._context.staticPlot,h=M._fullLayout;a("funnelarea",h),w(T,M),m(T,h._size),E.makeTraceGroups(h._funnelarealayer,T,"trace").each(function(b){var _=u.select(this),P=b[0],z=P.trace;k(b),_.each(function(){var D=u.select(this).selectAll("g.slice").data(b);D.enter().append("g").classed("slice",!0),D.exit().remove(),D.each(function(R,I){if(R.hidden){u.select(this).selectAll("path,g").remove();return}R.pointNumber=R.i,R.curveNumber=z.index;var F=P.cx,j=P.cy,N=u.select(this),G=N.selectAll("path.surface").data([R]);G.enter().append("path").classed("surface",!0).style({"pointer-events":c?"none":"all"}),N.call(v,M,b);var rt="M"+(F+R.TR[0])+","+(j+R.TR[1])+y(R.TR,R.BR)+y(R.BR,R.BL)+y(R.BL,R.TL)+"Z";G.attr("d",rt),x(M,R,P);var ct=s.castOption(z.textposition,R.pts),st=N.selectAll("g.slicetext").data(R.text&&ct!=="none"?[0]:[]);st.enter().append("g").classed("slicetext",!0),st.exit().remove(),st.each(function(){var et=E.ensureSingle(u.select(this),"text","",function(it){it.attr("data-notex",1)}),Z=E.ensureUniformFontSize(M,g(z,R,h.font));et.text(R.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(d.font,Z).call(e.convertToTspans,M);var ot=d.bBox(et.node()),X,Q,ut,J=Math.min(R.BL[1],R.BR[1])+j,q=Math.max(R.TL[1],R.TR[1])+j;Q=Math.max(R.TL[0],R.BL[0])+F,ut=Math.min(R.TR[0],R.BR[0])+F,X=i(Q,ut,J,q,ot,{isHorizontal:!0,constrained:!0,angle:0,anchor:"middle"}),X.fontSize=Z.size,o(z.type,X,h),b[I].transform=X,E.setTransormAndDisplay(et,X)})});var B=u.select(this).selectAll("g.titletext").data(z.title.text?[0]:[]);B.enter().append("g").classed("titletext",!0),B.exit().remove(),B.each(function(){var R=E.ensureSingle(u.select(this),"text","",function(j){j.attr("data-notex",1)}),I=z.title.text;z._meta&&(I=E.templateString(I,z._meta)),R.text(I).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(d.font,z.title.font).call(e.convertToTspans,M);var F=l(P,h._size);R.attr("transform",t(F.x,F.y)+A(Math.min(1,F.scale))+t(F.tx,F.ty))})})})};function y(M,T){var c=T[0]-M[0],h=T[1]-M[1];return"l"+c+","+h}function S(M,T){return[.5*(M[0]+T[0]),.5*(M[1]+T[1])]}function k(M){if(!M.length)return;var T=M[0],c=T.trace,h=c.aspectratio,b=c.baseratio;b>.999&&(b=.999);var _=Math.pow(b,2),P=T.vTotal,z=P*_/(1-_),D=P,B=z/P;function R(){var dt=Math.sqrt(B);return{x:dt,y:-dt}}function I(){var dt=R();return[dt.x,dt.y]}var F,j=[];j.push(I());var N,G;for(N=M.length-1;N>-1;N--)if(G=M[N],!G.hidden){var rt=G.v/D;B+=rt,j.push(I())}var ct=1/0,st=-1/0;for(N=0;N-1;N--)if(G=M[N],!G.hidden){q+=1;var it=j[q][0],nt=j[q][1];G.TL=[-it,nt],G.TR=[it,nt],G.BL=ut,G.BR=J,G.pxmid=S(G.TR,G.BR),ut=G.TL,J=G.TR}}}),z8=Vt((K,V)=>{var u=Ni(),d=Am(),E=sh().resizeText;V.exports=function(A){var t=A._fullLayout._funnelarealayer.selectAll(".trace");E(A,t,"funnelarea"),t.each(function(e){var r=e[0],i=r.trace,n=u.select(this);n.style({opacity:i.opacity}),n.selectAll("path.surface").each(function(o){u.select(this).call(d,o,i,A)})})}}),L8=Vt((K,V)=>{V.exports={moduleType:"trace",name:"funnelarea",basePlotModule:A8(),categories:["pie-like","funnelarea","showLegend"],attributes:b3(),layoutAttributes:w3(),supplyDefaults:M8(),supplyLayoutDefaults:S8(),calc:T3().calc,crossTraceCalc:T3().crossTraceCalc,plot:E8(),style:z8(),styleOne:Am(),meta:{}}}),C8=Vt((K,V)=>{V.exports=L8()}),Bf=Vt((K,V)=>{(function(){var u={24:function(t){var e={left:0,top:0};t.exports=r;function r(n,o,a){o=o||n.currentTarget||n.srcElement,Array.isArray(a)||(a=[0,0]);var s=n.clientX||0,f=n.clientY||0,v=i(o);return a[0]=s-v.left,a[1]=f-v.top,a}function i(n){return n===window||n===document||n===document.body?e:n.getBoundingClientRect()}},109:function(t){t.exports=e;function e(r,i,n,o){var a=n[0],s=n[2],f=i[0]-a,v=i[2]-s,g=Math.sin(o),m=Math.cos(o);return r[0]=a+v*g+f*m,r[1]=i[1],r[2]=s+v*m-f*g,r}},160:function(t){t.exports=e;function e(r,i,n){return r[0]=Math.max(i[0],n[0]),r[1]=Math.max(i[1],n[1]),r[2]=Math.max(i[2],n[2]),r[3]=Math.max(i[3],n[3]),r}},216:function(t){t.exports=e;function e(r,i){for(var n={},o=0;o1){g[0]in f||(f[g[0]]=[]),f=f[g[0]];for(var m=1;m=0;--F){var ot=R[F];j=ot[0];var X=D[j],Q=X[0],ut=X[1],J=z[Q],q=z[ut];if((J[0]-q[0]||J[1]-q[1])<0){var it=Q;Q=ut,ut=it}X[0]=Q;var nt=X[1]=ot[1],dt;for(I&&(dt=X[2]);F>0&&R[F-1][0]===j;){var ot=R[--F],Tt=ot[1];I?D.push([nt,Tt,dt]):D.push([nt,Tt]),nt=Tt}I?D.push([nt,ut,dt]):D.push([nt,ut])}return N}function M(z,D,B){for(var R=D.length,I=new i(R),F=[],j=0;jD[2]?1:0)}function h(z,D,B){if(z.length!==0){if(D)for(var R=0;R0||j.length>0}function P(z,D,B){var R;if(B){R=D;for(var I=new Array(D.length),F=0;F 0 U ||b|| > 0. + // Assign z = 0, x = -b, y = a: + // a*-b + b*a + c*0 = -ba + ba + 0 = 0 + if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) { + return normalize(vec3(-v.y, v.x, 0.0)); + } else { + return normalize(vec3(0.0, v.z, -v.y)); + } +} + +// Calculate the cone vertex and normal at the given index. +// +// The returned vertex is for a cone with its top at origin and height of 1.0, +// pointing in the direction of the vector attribute. +// +// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices. +// These vertices are used to make up the triangles of the cone by the following: +// segment + 0 top vertex +// segment + 1 perimeter vertex a+1 +// segment + 2 perimeter vertex a +// segment + 3 center base vertex +// segment + 4 perimeter vertex a +// segment + 5 perimeter vertex a+1 +// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment. +// To go from index to segment, floor(index / 6) +// To go from segment to angle, 2*pi * (segment/segmentCount) +// To go from index to segment index, index - (segment*6) +// +vec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) { + + const float segmentCount = 8.0; + + float index = rawIndex - floor(rawIndex / + (segmentCount * 6.0)) * + (segmentCount * 6.0); + + float segment = floor(0.001 + index/6.0); + float segmentIndex = index - (segment*6.0); + + normal = -normalize(d); + + if (segmentIndex > 2.99 && segmentIndex < 3.01) { + return mix(vec3(0.0), -d, coneOffset); + } + + float nextAngle = ( + (segmentIndex > 0.99 && segmentIndex < 1.01) || + (segmentIndex > 4.99 && segmentIndex < 5.01) + ) ? 1.0 : 0.0; + float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount); + + vec3 v1 = mix(d, vec3(0.0), coneOffset); + vec3 v2 = v1 - d; + + vec3 u = getOrthogonalVector(d); + vec3 v = normalize(cross(u, d)); + + vec3 x = u * cos(angle) * length(d)*0.25; + vec3 y = v * sin(angle) * length(d)*0.25; + vec3 v3 = v2 + x + y; + if (segmentIndex < 3.0) { + vec3 tx = u * sin(angle); + vec3 ty = v * -cos(angle); + vec3 tangent = tx + ty; + normal = normalize(cross(v3 - v1, tangent)); + } + + if (segmentIndex == 0.0) { + return mix(d, vec3(0.0), coneOffset); + } + return v3; +} + +attribute vec3 vector; +attribute vec4 color, position; +attribute vec2 uv; + +uniform float vectorScale, coneScale, coneOffset; +uniform mat4 model, view, projection, inverseModel; +uniform vec3 eyePosition, lightPosition; + +varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position; +varying vec4 f_color; +varying vec2 f_uv; + +void main() { + // Scale the vector magnitude to stay constant with + // model & view changes. + vec3 normal; + vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal); + vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0); + + //Lighting geometry parameters + vec4 cameraCoordinate = view * conePosition; + cameraCoordinate.xyz /= cameraCoordinate.w; + f_lightDirection = lightPosition - cameraCoordinate.xyz; + f_eyeDirection = eyePosition - cameraCoordinate.xyz; + f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz); + + // vec4 m_position = model * vec4(conePosition, 1.0); + vec4 t_position = view * conePosition; + gl_Position = projection * t_position; + + f_color = color; + f_data = conePosition.xyz; + f_position = position.xyz; + f_uv = uv; +} +`]),o=i([`#extension GL_OES_standard_derivatives : enable + +precision highp float; +#define GLSLIFY 1 + +float beckmannDistribution(float x, float roughness) { + float NdotH = max(x, 0.0001); + float cos2Alpha = NdotH * NdotH; + float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha; + float roughness2 = roughness * roughness; + float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha; + return exp(tan2Alpha / roughness2) / denom; +} + +float cookTorranceSpecular( + vec3 lightDirection, + vec3 viewDirection, + vec3 surfaceNormal, + float roughness, + float fresnel) { + + float VdotN = max(dot(viewDirection, surfaceNormal), 0.0); + float LdotN = max(dot(lightDirection, surfaceNormal), 0.0); + + //Half angle vector + vec3 H = normalize(lightDirection + viewDirection); + + //Geometric term + float NdotH = max(dot(surfaceNormal, H), 0.0); + float VdotH = max(dot(viewDirection, H), 0.000001); + float LdotH = max(dot(lightDirection, H), 0.000001); + float G1 = (2.0 * NdotH * VdotN) / VdotH; + float G2 = (2.0 * NdotH * LdotN) / LdotH; + float G = min(1.0, min(G1, G2)); + + //Distribution term + float D = beckmannDistribution(NdotH, roughness); + + //Fresnel term + float F = pow(1.0 - VdotN, fresnel); + + //Multiply terms and done + return G * F * D / max(3.14159265 * VdotN, 0.000001); +} + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec3 clipBounds[2]; +uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity; +uniform sampler2D texture; + +varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position; +varying vec4 f_color; +varying vec2 f_uv; + +void main() { + if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard; + vec3 N = normalize(f_normal); + vec3 L = normalize(f_lightDirection); + vec3 V = normalize(f_eyeDirection); + + if(gl_FrontFacing) { + N = -N; + } + + float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel))); + float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0); + + vec4 surfaceColor = f_color * texture2D(texture, f_uv); + vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0); + + gl_FragColor = litColor * opacity; +} +`]),a=i([`precision highp float; + +precision highp float; +#define GLSLIFY 1 + +vec3 getOrthogonalVector(vec3 v) { + // Return up-vector for only-z vector. + // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0). + // From the above if-statement we have ||a|| > 0 U ||b|| > 0. + // Assign z = 0, x = -b, y = a: + // a*-b + b*a + c*0 = -ba + ba + 0 = 0 + if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) { + return normalize(vec3(-v.y, v.x, 0.0)); + } else { + return normalize(vec3(0.0, v.z, -v.y)); + } +} + +// Calculate the cone vertex and normal at the given index. +// +// The returned vertex is for a cone with its top at origin and height of 1.0, +// pointing in the direction of the vector attribute. +// +// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices. +// These vertices are used to make up the triangles of the cone by the following: +// segment + 0 top vertex +// segment + 1 perimeter vertex a+1 +// segment + 2 perimeter vertex a +// segment + 3 center base vertex +// segment + 4 perimeter vertex a +// segment + 5 perimeter vertex a+1 +// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment. +// To go from index to segment, floor(index / 6) +// To go from segment to angle, 2*pi * (segment/segmentCount) +// To go from index to segment index, index - (segment*6) +// +vec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) { + + const float segmentCount = 8.0; + + float index = rawIndex - floor(rawIndex / + (segmentCount * 6.0)) * + (segmentCount * 6.0); + + float segment = floor(0.001 + index/6.0); + float segmentIndex = index - (segment*6.0); + + normal = -normalize(d); + + if (segmentIndex > 2.99 && segmentIndex < 3.01) { + return mix(vec3(0.0), -d, coneOffset); + } + + float nextAngle = ( + (segmentIndex > 0.99 && segmentIndex < 1.01) || + (segmentIndex > 4.99 && segmentIndex < 5.01) + ) ? 1.0 : 0.0; + float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount); + + vec3 v1 = mix(d, vec3(0.0), coneOffset); + vec3 v2 = v1 - d; + + vec3 u = getOrthogonalVector(d); + vec3 v = normalize(cross(u, d)); + + vec3 x = u * cos(angle) * length(d)*0.25; + vec3 y = v * sin(angle) * length(d)*0.25; + vec3 v3 = v2 + x + y; + if (segmentIndex < 3.0) { + vec3 tx = u * sin(angle); + vec3 ty = v * -cos(angle); + vec3 tangent = tx + ty; + normal = normalize(cross(v3 - v1, tangent)); + } + + if (segmentIndex == 0.0) { + return mix(d, vec3(0.0), coneOffset); + } + return v3; +} + +attribute vec4 vector; +attribute vec4 position; +attribute vec4 id; + +uniform mat4 model, view, projection; +uniform float vectorScale, coneScale, coneOffset; + +varying vec3 f_position; +varying vec4 f_id; + +void main() { + vec3 normal; + vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector.xyz), position.w, coneOffset, normal); + vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0); + gl_Position = projection * (view * conePosition); + f_id = id; + f_position = position.xyz; +} +`]),s=i([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec3 clipBounds[2]; +uniform float pickId; + +varying vec3 f_position; +varying vec4 f_id; + +void main() { + if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard; + + gl_FragColor = vec4(pickId, f_id.xyz); +}`]);e.meshShader={vertex:n,fragment:o,attributes:[{name:"position",type:"vec4"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec3"}]},e.pickShader={vertex:a,fragment:s,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec3"}]}},620:function(t){t.exports=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","uint","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"]},665:function(t,e,r){var i=r(3202);t.exports=s;var n=96;function o(f,v){var g=i(getComputedStyle(f).getPropertyValue(v));return g[0]*s(g[1],f)}function a(f,v){var g=document.createElement("div");g.style["font-size"]="128"+f,v.appendChild(g);var m=o(g,"font-size")/128;return v.removeChild(g),m}function s(f,v){switch(v=v||document.body,f=(f||"px").trim().toLowerCase(),(v===window||v===document)&&(v=document.body),f){case"%":return v.clientHeight/100;case"ch":case"ex":return a(f,v);case"em":return o(v,"font-size");case"rem":return o(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return n;case"cm":return n/2.54;case"mm":return n/25.4;case"pt":return n/72;case"pc":return n/6}return 1}},727:function(t,e,r){var i=r(2962),n=6;function o(S){var k=S===2?f:S===3?v:S===4?g:S===5?m:w;return S<6?k(i[S]):k(i)}function a(){return[[0]]}function s(S,k){return[[k[0]],[S[0][0]]]}function f(S){return function(k,M){return[S([[+M[0],+k[0][1]],[+M[1],+k[1][1]]]),S([[+k[0][0],+M[0]],[+k[1][0],+M[1]]]),S(k)]}}function v(S){return function(k,M){return[S([[+M[0],+k[0][1],+k[0][2]],[+M[1],+k[1][1],+k[1][2]],[+M[2],+k[2][1],+k[2][2]]]),S([[+k[0][0],+M[0],+k[0][2]],[+k[1][0],+M[1],+k[1][2]],[+k[2][0],+M[2],+k[2][2]]]),S([[+k[0][0],+k[0][1],+M[0]],[+k[1][0],+k[1][1],+M[1]],[+k[2][0],+k[2][1],+M[2]]]),S(k)]}}function g(S){return function(k,M){return[S([[+M[0],+k[0][1],+k[0][2],+k[0][3]],[+M[1],+k[1][1],+k[1][2],+k[1][3]],[+M[2],+k[2][1],+k[2][2],+k[2][3]],[+M[3],+k[3][1],+k[3][2],+k[3][3]]]),S([[+k[0][0],+M[0],+k[0][2],+k[0][3]],[+k[1][0],+M[1],+k[1][2],+k[1][3]],[+k[2][0],+M[2],+k[2][2],+k[2][3]],[+k[3][0],+M[3],+k[3][2],+k[3][3]]]),S([[+k[0][0],+k[0][1],+M[0],+k[0][3]],[+k[1][0],+k[1][1],+M[1],+k[1][3]],[+k[2][0],+k[2][1],+M[2],+k[2][3]],[+k[3][0],+k[3][1],+M[3],+k[3][3]]]),S([[+k[0][0],+k[0][1],+k[0][2],+M[0]],[+k[1][0],+k[1][1],+k[1][2],+M[1]],[+k[2][0],+k[2][1],+k[2][2],+M[2]],[+k[3][0],+k[3][1],+k[3][2],+M[3]]]),S(k)]}}function m(S){return function(k,M){return[S([[+M[0],+k[0][1],+k[0][2],+k[0][3],+k[0][4]],[+M[1],+k[1][1],+k[1][2],+k[1][3],+k[1][4]],[+M[2],+k[2][1],+k[2][2],+k[2][3],+k[2][4]],[+M[3],+k[3][1],+k[3][2],+k[3][3],+k[3][4]],[+M[4],+k[4][1],+k[4][2],+k[4][3],+k[4][4]]]),S([[+k[0][0],+M[0],+k[0][2],+k[0][3],+k[0][4]],[+k[1][0],+M[1],+k[1][2],+k[1][3],+k[1][4]],[+k[2][0],+M[2],+k[2][2],+k[2][3],+k[2][4]],[+k[3][0],+M[3],+k[3][2],+k[3][3],+k[3][4]],[+k[4][0],+M[4],+k[4][2],+k[4][3],+k[4][4]]]),S([[+k[0][0],+k[0][1],+M[0],+k[0][3],+k[0][4]],[+k[1][0],+k[1][1],+M[1],+k[1][3],+k[1][4]],[+k[2][0],+k[2][1],+M[2],+k[2][3],+k[2][4]],[+k[3][0],+k[3][1],+M[3],+k[3][3],+k[3][4]],[+k[4][0],+k[4][1],+M[4],+k[4][3],+k[4][4]]]),S([[+k[0][0],+k[0][1],+k[0][2],+M[0],+k[0][4]],[+k[1][0],+k[1][1],+k[1][2],+M[1],+k[1][4]],[+k[2][0],+k[2][1],+k[2][2],+M[2],+k[2][4]],[+k[3][0],+k[3][1],+k[3][2],+M[3],+k[3][4]],[+k[4][0],+k[4][1],+k[4][2],+M[4],+k[4][4]]]),S([[+k[0][0],+k[0][1],+k[0][2],+k[0][3],+M[0]],[+k[1][0],+k[1][1],+k[1][2],+k[1][3],+M[1]],[+k[2][0],+k[2][1],+k[2][2],+k[2][3],+M[2]],[+k[3][0],+k[3][1],+k[3][2],+k[3][3],+M[3]],[+k[4][0],+k[4][1],+k[4][2],+k[4][3],+M[4]]]),S(k)]}}function w(S){return function(k,M){return[S([[+M[0],+k[0][1],+k[0][2],+k[0][3],+k[0][4],+k[0][5]],[+M[1],+k[1][1],+k[1][2],+k[1][3],+k[1][4],+k[1][5]],[+M[2],+k[2][1],+k[2][2],+k[2][3],+k[2][4],+k[2][5]],[+M[3],+k[3][1],+k[3][2],+k[3][3],+k[3][4],+k[3][5]],[+M[4],+k[4][1],+k[4][2],+k[4][3],+k[4][4],+k[4][5]],[+M[5],+k[5][1],+k[5][2],+k[5][3],+k[5][4],+k[5][5]]]),S([[+k[0][0],+M[0],+k[0][2],+k[0][3],+k[0][4],+k[0][5]],[+k[1][0],+M[1],+k[1][2],+k[1][3],+k[1][4],+k[1][5]],[+k[2][0],+M[2],+k[2][2],+k[2][3],+k[2][4],+k[2][5]],[+k[3][0],+M[3],+k[3][2],+k[3][3],+k[3][4],+k[3][5]],[+k[4][0],+M[4],+k[4][2],+k[4][3],+k[4][4],+k[4][5]],[+k[5][0],+M[5],+k[5][2],+k[5][3],+k[5][4],+k[5][5]]]),S([[+k[0][0],+k[0][1],+M[0],+k[0][3],+k[0][4],+k[0][5]],[+k[1][0],+k[1][1],+M[1],+k[1][3],+k[1][4],+k[1][5]],[+k[2][0],+k[2][1],+M[2],+k[2][3],+k[2][4],+k[2][5]],[+k[3][0],+k[3][1],+M[3],+k[3][3],+k[3][4],+k[3][5]],[+k[4][0],+k[4][1],+M[4],+k[4][3],+k[4][4],+k[4][5]],[+k[5][0],+k[5][1],+M[5],+k[5][3],+k[5][4],+k[5][5]]]),S([[+k[0][0],+k[0][1],+k[0][2],+M[0],+k[0][4],+k[0][5]],[+k[1][0],+k[1][1],+k[1][2],+M[1],+k[1][4],+k[1][5]],[+k[2][0],+k[2][1],+k[2][2],+M[2],+k[2][4],+k[2][5]],[+k[3][0],+k[3][1],+k[3][2],+M[3],+k[3][4],+k[3][5]],[+k[4][0],+k[4][1],+k[4][2],+M[4],+k[4][4],+k[4][5]],[+k[5][0],+k[5][1],+k[5][2],+M[5],+k[5][4],+k[5][5]]]),S([[+k[0][0],+k[0][1],+k[0][2],+k[0][3],+M[0],+k[0][5]],[+k[1][0],+k[1][1],+k[1][2],+k[1][3],+M[1],+k[1][5]],[+k[2][0],+k[2][1],+k[2][2],+k[2][3],+M[2],+k[2][5]],[+k[3][0],+k[3][1],+k[3][2],+k[3][3],+M[3],+k[3][5]],[+k[4][0],+k[4][1],+k[4][2],+k[4][3],+M[4],+k[4][5]],[+k[5][0],+k[5][1],+k[5][2],+k[5][3],+M[5],+k[5][5]]]),S([[+k[0][0],+k[0][1],+k[0][2],+k[0][3],+k[0][4],+M[0]],[+k[1][0],+k[1][1],+k[1][2],+k[1][3],+k[1][4],+M[1]],[+k[2][0],+k[2][1],+k[2][2],+k[2][3],+k[2][4],+M[2]],[+k[3][0],+k[3][1],+k[3][2],+k[3][3],+k[3][4],+M[3]],[+k[4][0],+k[4][1],+k[4][2],+k[4][3],+k[4][4],+M[4]],[+k[5][0],+k[5][1],+k[5][2],+k[5][3],+k[5][4],+M[5]]]),S(k)]}}var l=[a,s];function x(S,k,M,T,c,h,b,_){return function(P,z){switch(P.length){case 0:return S(P,z);case 1:return k(P,z);case 2:return M(P,z);case 3:return T(P,z);case 4:return c(P,z);case 5:return h(P,z)}var D=b[P.length];return D||(D=b[P.length]=_(P.length)),D(P,z)}}function y(){for(;l.length1e-6?(x=Math.acos(y),S=Math.sin(x),k=Math.sin((1-o)*x)/S,M=Math.sin(o*x)/S):(k=1-o,M=o),r[0]=k*a+M*g,r[1]=k*s+M*m,r[2]=k*f+M*w,r[3]=k*v+M*l,r}},799:function(t,e,r){var i=r(3236),n=r(9405),o=i([`precision mediump float; +#define GLSLIFY 1 +attribute vec2 position; +varying vec2 uv; +void main() { + uv = position; + gl_Position = vec4(position, 0, 1); +}`]),a=i([`precision mediump float; +#define GLSLIFY 1 + +uniform sampler2D accumBuffer; +varying vec2 uv; + +void main() { + vec4 accum = texture2D(accumBuffer, 0.5 * (uv + 1.0)); + gl_FragColor = min(vec4(1,1,1,1), accum); +}`]);t.exports=function(s){return n(s,o,a,null,[{name:"position",type:"vec2"}])}},811:function(t){t.exports=e;function e(r,i){return r[0]=1/i[0],r[1]=1/i[1],r[2]=1/i[2],r}},840:function(t,e,r){var i=r(3236),n=i([`precision highp float; +#define GLSLIFY 1 + +attribute vec3 position, normal; +attribute vec4 color; +attribute vec2 uv; + +uniform mat4 model + , view + , projection + , inverseModel; +uniform vec3 eyePosition + , lightPosition; + +varying vec3 f_normal + , f_lightDirection + , f_eyeDirection + , f_data; +varying vec4 f_color; +varying vec2 f_uv; + +vec4 project(vec3 p) { + return projection * (view * (model * vec4(p, 1.0))); +} + +void main() { + gl_Position = project(position); + + //Lighting geometry parameters + vec4 cameraCoordinate = view * vec4(position , 1.0); + cameraCoordinate.xyz /= cameraCoordinate.w; + f_lightDirection = lightPosition - cameraCoordinate.xyz; + f_eyeDirection = eyePosition - cameraCoordinate.xyz; + f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz); + + f_color = color; + f_data = position; + f_uv = uv; +} +`]),o=i([`#extension GL_OES_standard_derivatives : enable + +precision highp float; +#define GLSLIFY 1 + +float beckmannDistribution(float x, float roughness) { + float NdotH = max(x, 0.0001); + float cos2Alpha = NdotH * NdotH; + float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha; + float roughness2 = roughness * roughness; + float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha; + return exp(tan2Alpha / roughness2) / denom; +} + +float cookTorranceSpecular( + vec3 lightDirection, + vec3 viewDirection, + vec3 surfaceNormal, + float roughness, + float fresnel) { + + float VdotN = max(dot(viewDirection, surfaceNormal), 0.0); + float LdotN = max(dot(lightDirection, surfaceNormal), 0.0); + + //Half angle vector + vec3 H = normalize(lightDirection + viewDirection); + + //Geometric term + float NdotH = max(dot(surfaceNormal, H), 0.0); + float VdotH = max(dot(viewDirection, H), 0.000001); + float LdotH = max(dot(lightDirection, H), 0.000001); + float G1 = (2.0 * NdotH * VdotN) / VdotH; + float G2 = (2.0 * NdotH * LdotN) / LdotH; + float G = min(1.0, min(G1, G2)); + + //Distribution term + float D = beckmannDistribution(NdotH, roughness); + + //Fresnel term + float F = pow(1.0 - VdotN, fresnel); + + //Multiply terms and done + return G * F * D / max(3.14159265 * VdotN, 0.000001); +} + +//#pragma glslify: beckmann = require(glsl-specular-beckmann) // used in gl-surface3d + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec3 clipBounds[2]; +uniform float roughness + , fresnel + , kambient + , kdiffuse + , kspecular; +uniform sampler2D texture; + +varying vec3 f_normal + , f_lightDirection + , f_eyeDirection + , f_data; +varying vec4 f_color; +varying vec2 f_uv; + +void main() { + if (f_color.a == 0.0 || + outOfRange(clipBounds[0], clipBounds[1], f_data) + ) discard; + + vec3 N = normalize(f_normal); + vec3 L = normalize(f_lightDirection); + vec3 V = normalize(f_eyeDirection); + + if(gl_FrontFacing) { + N = -N; + } + + float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel))); + //float specular = max(0.0, beckmann(L, V, N, roughness)); // used in gl-surface3d + + float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0); + + vec4 surfaceColor = vec4(f_color.rgb, 1.0) * texture2D(texture, f_uv); + vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0); + + gl_FragColor = litColor * f_color.a; +} +`]),a=i([`precision highp float; +#define GLSLIFY 1 + +attribute vec3 position; +attribute vec4 color; +attribute vec2 uv; + +uniform mat4 model, view, projection; + +varying vec4 f_color; +varying vec3 f_data; +varying vec2 f_uv; + +void main() { + gl_Position = projection * (view * (model * vec4(position, 1.0))); + f_color = color; + f_data = position; + f_uv = uv; +}`]),s=i([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec3 clipBounds[2]; +uniform sampler2D texture; +uniform float opacity; + +varying vec4 f_color; +varying vec3 f_data; +varying vec2 f_uv; + +void main() { + if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard; + + gl_FragColor = f_color * texture2D(texture, f_uv) * opacity; +}`]),f=i([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +attribute vec3 position; +attribute vec4 color; +attribute vec2 uv; +attribute float pointSize; + +uniform mat4 model, view, projection; +uniform vec3 clipBounds[2]; + +varying vec4 f_color; +varying vec2 f_uv; + +void main() { + if (outOfRange(clipBounds[0], clipBounds[1], position)) { + + gl_Position = vec4(0.0, 0.0 ,0.0 ,0.0); + } else { + gl_Position = projection * (view * (model * vec4(position, 1.0))); + } + gl_PointSize = pointSize; + f_color = color; + f_uv = uv; +}`]),v=i([`precision highp float; +#define GLSLIFY 1 + +uniform sampler2D texture; +uniform float opacity; + +varying vec4 f_color; +varying vec2 f_uv; + +void main() { + vec2 pointR = gl_PointCoord.xy - vec2(0.5, 0.5); + if(dot(pointR, pointR) > 0.25) { + discard; + } + gl_FragColor = f_color * texture2D(texture, f_uv) * opacity; +}`]),g=i([`precision highp float; +#define GLSLIFY 1 + +attribute vec3 position; +attribute vec4 id; + +uniform mat4 model, view, projection; + +varying vec3 f_position; +varying vec4 f_id; + +void main() { + gl_Position = projection * (view * (model * vec4(position, 1.0))); + f_id = id; + f_position = position; +}`]),m=i([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec3 clipBounds[2]; +uniform float pickId; + +varying vec3 f_position; +varying vec4 f_id; + +void main() { + if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard; + + gl_FragColor = vec4(pickId, f_id.xyz); +}`]),w=i([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +attribute vec3 position; +attribute float pointSize; +attribute vec4 id; + +uniform mat4 model, view, projection; +uniform vec3 clipBounds[2]; + +varying vec3 f_position; +varying vec4 f_id; + +void main() { + if (outOfRange(clipBounds[0], clipBounds[1], position)) { + + gl_Position = vec4(0.0, 0.0, 0.0, 0.0); + } else { + gl_Position = projection * (view * (model * vec4(position, 1.0))); + gl_PointSize = pointSize; + } + f_id = id; + f_position = position; +}`]),l=i([`precision highp float; +#define GLSLIFY 1 + +attribute vec3 position; + +uniform mat4 model, view, projection; + +void main() { + gl_Position = projection * (view * (model * vec4(position, 1.0))); +}`]),x=i([`precision highp float; +#define GLSLIFY 1 + +uniform vec3 contourColor; + +void main() { + gl_FragColor = vec4(contourColor, 1.0); +} +`]);e.meshShader={vertex:n,fragment:o,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},e.wireShader={vertex:a,fragment:s,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},e.pointShader={vertex:f,fragment:v,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},e.pickShader={vertex:g,fragment:m,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},e.pointPickShader={vertex:w,fragment:m,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},e.contourShader={vertex:l,fragment:x,attributes:[{name:"position",type:"vec3"}]}},855:function(t,e,r){t.exports={init:y,sweepBipartite:M,sweepComplete:T,scanBipartite:c,scanComplete:h};var i=r(1888),n=r(8828),o=r(4192),a=1<<28,s=1024,f=i.mallocInt32(s),v=i.mallocInt32(s),g=i.mallocInt32(s),m=i.mallocInt32(s),w=i.mallocInt32(s),l=i.mallocInt32(s),x=i.mallocDouble(s*8);function y(b){var _=n.nextPow2(b);f.length<_&&(i.free(f),f=i.mallocInt32(_)),v.length<_&&(i.free(v),v=i.mallocInt32(_)),g.length<_&&(i.free(g),g=i.mallocInt32(_)),m.length<_&&(i.free(m),m=i.mallocInt32(_)),w.length<_&&(i.free(w),w=i.mallocInt32(_)),l.length<_&&(i.free(l),l=i.mallocInt32(_));var P=8*_;x.length>>1;o(x,X);for(var Q=0,ut=0,st=0;st=a)J=J-a|0,S(g,m,ut--,J);else if(J>=0)S(f,v,Q--,J);else if(J<=-a){J=-J-a|0;for(var q=0;q>>1;o(x,X);for(var Q=0,ut=0,J=0,st=0;st>1===x[2*st+3]>>1&&(it=2,st+=1),q<0){for(var nt=-(q>>1)-1,dt=0;dt>1)-1;it===0?S(f,v,Q--,nt):it===1?S(g,m,ut--,nt):it===2&&S(w,l,J--,nt)}}}function c(b,_,P,z,D,B,R,I,F,j,N,G){var rt=0,ct=2*b,st=_,et=_+b,Z=1,ot=1;z?ot=a:Z=a;for(var X=D;X>>1;o(x,q);for(var it=0,X=0;X=a?(dt=!z,Q-=a):(dt=!!z,Q-=1),dt)k(f,v,it++,Q);else{var Tt=G[Q],wt=ct*Q,Ct=N[wt+_+1],It=N[wt+_+1+b];t:for(var Nt=0;Nt>>1;o(x,Q);for(var ut=0,et=0;et=a)f[ut++]=Z-a;else{Z-=1;var q=N[Z],it=rt*Z,nt=j[it+_+1],dt=j[it+_+1+b];t:for(var Tt=0;Tt=0;--Tt)if(f[Tt]===Z){for(var Nt=Tt+1;Nt max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec3 lowerBound, upperBound; +uniform float contourTint; +uniform vec4 contourColor; +uniform sampler2D colormap; +uniform vec3 clipBounds[2]; +uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity; +uniform float vertexColor; + +varying float value, kill; +varying vec3 worldCoordinate; +varying vec3 lightDirection, eyeDirection, surfaceNormal; +varying vec4 vColor; + +void main() { + if ( + kill > 0.0 || + vColor.a == 0.0 || + outOfRange(clipBounds[0], clipBounds[1], worldCoordinate) + ) discard; + + vec3 N = normalize(surfaceNormal); + vec3 V = normalize(eyeDirection); + vec3 L = normalize(lightDirection); + + if(gl_FrontFacing) { + N = -N; + } + + float specular = max(beckmannSpecular(L, V, N, roughness), 0.); + float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0); + + //decide how to interpolate color — in vertex or in fragment + vec4 surfaceColor = + step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) + + step(.5, vertexColor) * vColor; + + vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0); + + gl_FragColor = mix(litColor, contourColor, contourTint) * opacity; +} +`]),s=n([`precision highp float; +#define GLSLIFY 1 + +attribute vec4 uv; +attribute float f; + +uniform vec3 objectOffset; +uniform mat3 permutation; +uniform mat4 model, view, projection; +uniform float height, zOffset; +uniform sampler2D colormap; + +varying float value, kill; +varying vec3 worldCoordinate; +varying vec2 planeCoordinate; +varying vec3 lightDirection, eyeDirection, surfaceNormal; +varying vec4 vColor; + +void main() { + vec3 dataCoordinate = permutation * vec3(uv.xy, height); + worldCoordinate = objectOffset + dataCoordinate; + mat4 objectOffsetTranslation = mat4(1.0) + mat4(vec4(0), vec4(0), vec4(0), vec4(objectOffset, 0)); + vec4 worldPosition = (model * objectOffsetTranslation) * vec4(dataCoordinate, 1.0); + + vec4 clipPosition = projection * (view * worldPosition); + clipPosition.z += zOffset; + + gl_Position = clipPosition; + value = f + objectOffset.z; + kill = -1.0; + planeCoordinate = uv.zw; + + vColor = texture2D(colormap, vec2(value, value)); + + //Don't do lighting for contours + surfaceNormal = vec3(1,0,0); + eyeDirection = vec3(0,1,0); + lightDirection = vec3(0,0,1); +} +`]),f=n([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec2 shape; +uniform vec3 clipBounds[2]; +uniform float pickId; + +varying float value, kill; +varying vec3 worldCoordinate; +varying vec2 planeCoordinate; +varying vec3 surfaceNormal; + +vec2 splitFloat(float v) { + float vh = 255.0 * v; + float upper = floor(vh); + float lower = fract(vh); + return vec2(upper / 255.0, floor(lower * 16.0) / 16.0); +} + +void main() { + if ((kill > 0.0) || + (outOfRange(clipBounds[0], clipBounds[1], worldCoordinate))) discard; + + vec2 ux = splitFloat(planeCoordinate.x / shape.x); + vec2 uy = splitFloat(planeCoordinate.y / shape.y); + gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0)); +} +`]);e.createShader=function(v){var g=i(v,o,a,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return g.attributes.uv.location=0,g.attributes.f.location=1,g.attributes.normal.location=2,g},e.createPickShader=function(v){var g=i(v,o,f,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return g.attributes.uv.location=0,g.attributes.f.location=1,g.attributes.normal.location=2,g},e.createContourShader=function(v){var g=i(v,s,a,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return g.attributes.uv.location=0,g.attributes.f.location=1,g},e.createPickContourShader=function(v){var g=i(v,s,f,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return g.attributes.uv.location=0,g.attributes.f.location=1,g}},1085:function(t,e,r){var i=r(1371);t.exports=n;function n(o,a,s){a=typeof a=="number"?a:1,s=s||": ";var f=o.split(/\r?\n/),v=String(f.length+a-1).length;return f.map(function(g,m){var w=m+a,l=String(w).length,x=i(w,v-l);return x+s+g}).join(` +`)}},1091:function(t){t.exports=e;function e(){var r=new Float32Array(3);return r[0]=0,r[1]=0,r[2]=0,r}},1125:function(t,e,r){t.exports=o;var i=r(3250)[3];function n(a,s,f,v){for(var g=0;g<2;++g){var m=a[g],w=s[g],l=Math.min(m,w),x=Math.max(m,w),y=f[g],S=v[g],k=Math.min(y,S),M=Math.max(y,S);if(M0&&m>0||g<0&&m<0)return!1;var w=i(f,a,s),l=i(v,a,s);return w>0&&l>0||w<0&&l<0?!1:g===0&&m===0&&w===0&&l===0?n(a,s,f,v):!0}},1278:function(t,e,r){var i=r(2361),n=Math.pow(2,-1074),o=-1>>>0;t.exports=a;function a(s,f){if(isNaN(s)||isNaN(f))return NaN;if(s===f)return s;if(s===0)return f<0?-n:n;var v=i.hi(s),g=i.lo(s);return f>s==s>0?g===o?(v+=1,g=0):g+=1:g===0?(g=o,v-=1):g-=1,i.pack(g,v)}},1283:function(t,e,r){var i=r(9405),n=r(3236),o=n([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +attribute vec3 position; +attribute vec4 color; +attribute vec2 glyph; +attribute vec4 id; + +uniform vec4 highlightId; +uniform float highlightScale; +uniform mat4 model, view, projection; +uniform vec3 clipBounds[2]; + +varying vec4 interpColor; +varying vec4 pickId; +varying vec3 dataCoordinate; + +void main() { + if (outOfRange(clipBounds[0], clipBounds[1], position)) { + + gl_Position = vec4(0,0,0,0); + } else { + float scale = 1.0; + if(distance(highlightId, id) < 0.0001) { + scale = highlightScale; + } + + vec4 worldPosition = model * vec4(position, 1); + vec4 viewPosition = view * worldPosition; + viewPosition = viewPosition / viewPosition.w; + vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0)); + + gl_Position = clipPosition; + interpColor = color; + pickId = id; + dataCoordinate = position; + } +}`]),a=n([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +attribute vec3 position; +attribute vec4 color; +attribute vec2 glyph; +attribute vec4 id; + +uniform mat4 model, view, projection; +uniform vec2 screenSize; +uniform vec3 clipBounds[2]; +uniform float highlightScale, pixelRatio; +uniform vec4 highlightId; + +varying vec4 interpColor; +varying vec4 pickId; +varying vec3 dataCoordinate; + +void main() { + if (outOfRange(clipBounds[0], clipBounds[1], position)) { + + gl_Position = vec4(0,0,0,0); + } else { + float scale = pixelRatio; + if(distance(highlightId.bgr, id.bgr) < 0.001) { + scale *= highlightScale; + } + + vec4 worldPosition = model * vec4(position, 1.0); + vec4 viewPosition = view * worldPosition; + vec4 clipPosition = projection * viewPosition; + clipPosition /= clipPosition.w; + + gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0); + interpColor = color; + pickId = id; + dataCoordinate = position; + } +}`]),s=n([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +attribute vec3 position; +attribute vec4 color; +attribute vec2 glyph; +attribute vec4 id; + +uniform float highlightScale; +uniform vec4 highlightId; +uniform vec3 axes[2]; +uniform mat4 model, view, projection; +uniform vec2 screenSize; +uniform vec3 clipBounds[2]; +uniform float scale, pixelRatio; + +varying vec4 interpColor; +varying vec4 pickId; +varying vec3 dataCoordinate; + +void main() { + if (outOfRange(clipBounds[0], clipBounds[1], position)) { + + gl_Position = vec4(0,0,0,0); + } else { + float lscale = pixelRatio * scale; + if(distance(highlightId, id) < 0.0001) { + lscale *= highlightScale; + } + + vec4 clipCenter = projection * (view * (model * vec4(position, 1))); + vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y; + vec4 clipPosition = projection * (view * (model * vec4(dataPosition, 1))); + + gl_Position = clipPosition; + interpColor = color; + pickId = id; + dataCoordinate = dataPosition; + } +} +`]),f=n([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec3 fragClipBounds[2]; +uniform float opacity; + +varying vec4 interpColor; +varying vec3 dataCoordinate; + +void main() { + if ( + outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate) || + interpColor.a * opacity == 0. + ) discard; + gl_FragColor = interpColor * opacity; +} +`]),v=n([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec3 fragClipBounds[2]; +uniform float pickGroup; + +varying vec4 pickId; +varying vec3 dataCoordinate; + +void main() { + if (outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate)) discard; + + gl_FragColor = vec4(pickGroup, pickId.bgr); +}`]),g=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],m={vertex:o,fragment:f,attributes:g},w={vertex:a,fragment:f,attributes:g},l={vertex:s,fragment:f,attributes:g},x={vertex:o,fragment:v,attributes:g},y={vertex:a,fragment:v,attributes:g},S={vertex:s,fragment:v,attributes:g};function k(M,T){var c=i(M,T),h=c.attributes;return h.position.location=0,h.color.location=1,h.glyph.location=2,h.id.location=3,c}e.createPerspective=function(M){return k(M,m)},e.createOrtho=function(M){return k(M,w)},e.createProject=function(M){return k(M,l)},e.createPickPerspective=function(M){return k(M,x)},e.createPickOrtho=function(M){return k(M,y)},e.createPickProject=function(M){return k(M,S)}},1303:function(t,e,r){t.exports=o;var i=r(3250);function n(a,s){var f,v;if(s[0][0]s[1][0])f=s[1],v=s[0];else{var g=Math.min(a[0][1],a[1][1]),m=Math.max(a[0][1],a[1][1]),w=Math.min(s[0][1],s[1][1]),l=Math.max(s[0][1],s[1][1]);return ml?g-l:m-l}var x,y;a[0][1]s[1][0])f=s[1],v=s[0];else return n(s,a);var g,m;if(a[0][0]a[1][0])g=a[1],m=a[0];else return-n(a,s);var w=i(f,v,m),l=i(f,v,g);if(w<0){if(l<=0)return w}else if(w>0){if(l>=0)return w}else if(l)return l;if(w=i(m,g,v),l=i(m,g,f),w<0){if(l<=0)return w}else if(w>0){if(l>=0)return w}else if(l)return l;return v[0]-m[0]}},1318:function(t){t.exports=e;function e(r,i){return r[0].mul(i[1]).cmp(i[0].mul(r[1]))}},1338:function(t){function e(n,o,a){var s=n[a]|0;if(s<=0)return[];var f=new Array(s),v;if(a===n.length-1)for(v=0;v"u"&&(o=0),typeof n){case"number":if(n>0)return r(n|0,o);break;case"object":if(typeof n.length=="number")return e(n,o,0);break}return[]}t.exports=i},1369:function(t,e,r){var i=r(5716);t.exports=n;function n(o){var a=o.length,s=o.words,f=0;if(a===1)f=s[0];else if(a===2)f=s[0]+s[1]*67108864;else for(var v=0;vo)throw new Error("gl-vao: Too many vertex attributes");for(var a=0;a=0?b[F]:I)}function z(R){var I=y(R);return I?_ in I:h.indexOf(R)>=0}function D(R,I){var F,j=y(R);return j?j[_]=I:(F=h.indexOf(R),F>=0?b[F]=I:(F=h.length,b[F]=I,h[F]=R)),this}function B(R){var I=y(R),F,j;return I?_ in I&&delete I[_]:(F=h.indexOf(R),F<0?!1:(j=h.length-1,h[F]=void 0,b[F]=b[j],h[F]=h[j],h.length=j,b.length=j,!0))}return Object.create(c.prototype,{get___:{value:S(P)},has___:{value:S(z)},set___:{value:S(D)},delete___:{value:S(B)}})};c.prototype=Object.create(Object.prototype,{get:{value:function(h,b){return this.get___(h,b)},writable:!0,configurable:!0},has:{value:function(h){return this.has___(h)},writable:!0,configurable:!0},set:{value:function(h,b){return this.set___(h,b)},writable:!0,configurable:!0},delete:{value:function(h){return this.delete___(h)},writable:!0,configurable:!0}}),typeof i=="function"?(function(){r&&typeof Proxy<"u"&&(Proxy=void 0);function h(){this instanceof c||M();var b=new i,_=void 0,P=!1;function z(I,F){return _?b.has(I)?b.get(I):_.get___(I,F):b.get(I,F)}function D(I){return b.has(I)||(_?_.has___(I):!1)}var B;r?B=function(I,F){return b.set(I,F),b.has(I)||(_||(_=new c),_.set(I,F)),this}:B=function(I,F){if(P)try{b.set(I,F)}catch{_||(_=new c),_.set___(I,F)}else b.set(I,F);return this};function R(I){var F=!!b.delete(I);return _&&_.delete___(I)||F}return Object.create(c.prototype,{get___:{value:S(z)},has___:{value:S(D)},set___:{value:S(B)},delete___:{value:S(R)},permitHostObjects___:{value:S(function(I){if(I===e)P=!0;else throw new Error("bogus call to permitHostObjects___")})}})}h.prototype=c.prototype,t.exports=h,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})})():(typeof Proxy<"u"&&(Proxy=void 0),t.exports=c)})()},1570:function(t){t.exports=r;var e=[function(){function i(n,o,a,s){for(var f=n.length,v=[],g=0;g>1,x=a[2*l+1];if(x===g)return l;g>1,x=a[2*l+1];if(x===g)return l;g>1,x=a[2*l+1];if(x===g)return l;g HALF_PI) && (b <= ONE_AND_HALF_PI)) ? + b - PI : + b; +} + +float look_horizontal_or_vertical(float a, float ratio) { + // ratio controls the ratio between being horizontal to (vertical + horizontal) + // if ratio is set to 0.5 then it is 50%, 50%. + // when using a higher ratio e.g. 0.75 the result would + // likely be more horizontal than vertical. + + float b = positive_angle(a); + + return + (b < ( ratio) * HALF_PI) ? 0.0 : + (b < (2.0 - ratio) * HALF_PI) ? -HALF_PI : + (b < (2.0 + ratio) * HALF_PI) ? 0.0 : + (b < (4.0 - ratio) * HALF_PI) ? HALF_PI : + 0.0; +} + +float roundTo(float a, float b) { + return float(b * floor((a + 0.5 * b) / b)); +} + +float look_round_n_directions(float a, int n) { + float b = positive_angle(a); + float div = TWO_PI / float(n); + float c = roundTo(b, div); + return look_upwards(c); +} + +float applyAlignOption(float rawAngle, float delta) { + return + (option > 2) ? look_round_n_directions(rawAngle + delta, option) : // option 3-n: round to n directions + (option == 2) ? look_horizontal_or_vertical(rawAngle + delta, hv_ratio) : // horizontal or vertical + (option == 1) ? rawAngle + delta : // use free angle, and flip to align with one direction of the axis + (option == 0) ? look_upwards(rawAngle) : // use free angle, and stay upwards + (option ==-1) ? 0.0 : // useful for backward compatibility, all texts remains horizontal + rawAngle; // otherwise return back raw input angle +} + +bool isAxisTitle = (axis.x == 0.0) && + (axis.y == 0.0) && + (axis.z == 0.0); + +void main() { + //Compute world offset + float axisDistance = position.z; + vec3 dataPosition = axisDistance * axis + offset; + + float beta = angle; // i.e. user defined attributes for each tick + + float axisAngle; + float clipAngle; + float flip; + + if (enableAlign) { + axisAngle = (isAxisTitle) ? HALF_PI : + computeViewAngle(dataPosition, dataPosition + axis); + clipAngle = computeViewAngle(dataPosition, dataPosition + alignDir); + + axisAngle += (sin(axisAngle) < 0.0) ? PI : 0.0; + clipAngle += (sin(clipAngle) < 0.0) ? PI : 0.0; + + flip = (dot(vec2(cos(axisAngle), sin(axisAngle)), + vec2(sin(clipAngle),-cos(clipAngle))) > 0.0) ? 1.0 : 0.0; + + beta += applyAlignOption(clipAngle, flip * PI); + } + + //Compute plane offset + vec2 planeCoord = position.xy * pixelScale; + + mat2 planeXform = scale * mat2( + cos(beta), sin(beta), + -sin(beta), cos(beta) + ); + + vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution; + + //Compute clip position + vec3 clipPosition = project(dataPosition); + + //Apply text offset in clip coordinates + clipPosition += vec3(viewOffset, 0.0); + + //Done + gl_Position = vec4(clipPosition, 1.0); +} +`]),f=i([`precision highp float; +#define GLSLIFY 1 + +uniform vec4 color; +void main() { + gl_FragColor = color; +}`]);e.Q=function(m){return n(m,s,f,null,[{name:"position",type:"vec3"}])};var v=i([`precision highp float; +#define GLSLIFY 1 + +attribute vec3 position; +attribute vec3 normal; + +uniform mat4 model, view, projection; +uniform vec3 enable; +uniform vec3 bounds[2]; + +varying vec3 colorChannel; + +void main() { + + vec3 signAxis = sign(bounds[1] - bounds[0]); + + vec3 realNormal = signAxis * normal; + + if(dot(realNormal, enable) > 0.0) { + vec3 minRange = min(bounds[0], bounds[1]); + vec3 maxRange = max(bounds[0], bounds[1]); + vec3 nPosition = mix(minRange, maxRange, 0.5 * (position + 1.0)); + gl_Position = projection * (view * (model * vec4(nPosition, 1.0))); + } else { + gl_Position = vec4(0,0,0,0); + } + + colorChannel = abs(realNormal); +} +`]),g=i([`precision highp float; +#define GLSLIFY 1 + +uniform vec4 colors[3]; + +varying vec3 colorChannel; + +void main() { + gl_FragColor = colorChannel.x * colors[0] + + colorChannel.y * colors[1] + + colorChannel.z * colors[2]; +}`]);e.bg=function(m){return n(m,v,g,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},1888:function(t,e,r){var i=r(8828),n=r(1338),o=r(4793).hp;r.g.__TYPEDARRAY_POOL||(r.g.__TYPEDARRAY_POOL={UINT8:n([32,0]),UINT16:n([32,0]),UINT32:n([32,0]),BIGUINT64:n([32,0]),INT8:n([32,0]),INT16:n([32,0]),INT32:n([32,0]),BIGINT64:n([32,0]),FLOAT:n([32,0]),DOUBLE:n([32,0]),DATA:n([32,0]),UINT8C:n([32,0]),BUFFER:n([32,0])});var a=typeof Uint8ClampedArray<"u",s=typeof BigUint64Array<"u",f=typeof BigInt64Array<"u",v=r.g.__TYPEDARRAY_POOL;v.UINT8C||(v.UINT8C=n([32,0])),v.BIGUINT64||(v.BIGUINT64=n([32,0])),v.BIGINT64||(v.BIGINT64=n([32,0])),v.BUFFER||(v.BUFFER=n([32,0]));var g=v.DATA,m=v.BUFFER;e.free=function(R){if(o.isBuffer(R))m[i.log2(R.length)].push(R);else{if(Object.prototype.toString.call(R)!=="[object ArrayBuffer]"&&(R=R.buffer),!R)return;var I=R.length||R.byteLength,F=i.log2(I)|0;g[F].push(R)}};function w(R){if(R){var I=R.length||R.byteLength,F=i.log2(I);g[F].push(R)}}function l(R){w(R.buffer)}e.freeUint8=e.freeUint16=e.freeUint32=e.freeBigUint64=e.freeInt8=e.freeInt16=e.freeInt32=e.freeBigInt64=e.freeFloat32=e.freeFloat=e.freeFloat64=e.freeDouble=e.freeUint8Clamped=e.freeDataView=l,e.freeArrayBuffer=w,e.freeBuffer=function(R){m[i.log2(R.length)].push(R)},e.malloc=function(R,I){if(I===void 0||I==="arraybuffer")return x(R);switch(I){case"uint8":return y(R);case"uint16":return S(R);case"uint32":return k(R);case"int8":return M(R);case"int16":return T(R);case"int32":return c(R);case"float":case"float32":return h(R);case"double":case"float64":return b(R);case"uint8_clamped":return _(R);case"bigint64":return z(R);case"biguint64":return P(R);case"buffer":return B(R);case"data":case"dataview":return D(R);default:return null}return null};function x(I){var I=i.nextPow2(I),F=i.log2(I),j=g[F];return j.length>0?j.pop():new ArrayBuffer(I)}e.mallocArrayBuffer=x;function y(R){return new Uint8Array(x(R),0,R)}e.mallocUint8=y;function S(R){return new Uint16Array(x(2*R),0,R)}e.mallocUint16=S;function k(R){return new Uint32Array(x(4*R),0,R)}e.mallocUint32=k;function M(R){return new Int8Array(x(R),0,R)}e.mallocInt8=M;function T(R){return new Int16Array(x(2*R),0,R)}e.mallocInt16=T;function c(R){return new Int32Array(x(4*R),0,R)}e.mallocInt32=c;function h(R){return new Float32Array(x(4*R),0,R)}e.mallocFloat32=e.mallocFloat=h;function b(R){return new Float64Array(x(8*R),0,R)}e.mallocFloat64=e.mallocDouble=b;function _(R){return a?new Uint8ClampedArray(x(R),0,R):y(R)}e.mallocUint8Clamped=_;function P(R){return s?new BigUint64Array(x(8*R),0,R):null}e.mallocBigUint64=P;function z(R){return f?new BigInt64Array(x(8*R),0,R):null}e.mallocBigInt64=z;function D(R){return new DataView(x(R),0,R)}e.mallocDataView=D;function B(R){R=i.nextPow2(R);var I=i.log2(R),F=m[I];return F.length>0?F.pop():new o(R)}e.mallocBuffer=B,e.clearCache=function(){for(var R=0;R<32;++R)v.UINT8[R].length=0,v.UINT16[R].length=0,v.UINT32[R].length=0,v.INT8[R].length=0,v.INT16[R].length=0,v.INT32[R].length=0,v.FLOAT[R].length=0,v.DOUBLE[R].length=0,v.BIGUINT64[R].length=0,v.BIGINT64[R].length=0,v.UINT8C[R].length=0,g[R].length=0,m[R].length=0}},1903:function(t){t.exports=e;function e(r){var i=new Float32Array(16);return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i}},1944:function(t,e,r){var i=r(5250),n=r(8210);t.exports=o;function o(a,s){for(var f=i(a[0],s[0]),v=1;v>1,B=f(h[D],b);B<=0?(B===0&&(z=D),_=D+1):B>0&&(P=D-1)}return z}e.findCell=w;function l(h,b){for(var _=new Array(h.length),P=0,z=_.length;P=h.length||f(h[rt],D)!==0););}return _}e.incidence=l;function x(h,b){if(!b)return l(m(S(h,0)),h);for(var _=new Array(b),P=0;P>>F&1&&I.push(z[F]);b.push(I)}return g(b)}e.explode=y;function S(h,b){if(b<0)return[];for(var _=[],P=(1<0}c=c.filter(h);for(var b=c.length,_=new Array(b),P=new Array(b),T=0;T0;){var nt=q.pop(),dt=st[nt];f(dt,function(te,Jt){return te-Jt});var Tt=dt.length,wt=it[nt],Ct;if(wt===0){var F=c[nt];Ct=[F]}for(var T=0;T=0)&&(it[It]=wt^1,q.push(It),wt===0)){var F=c[It];J(F)||(F.reverse(),Ct.push(F))}}wt===0&&y.push(Ct)}return y}},2145:function(t,e){e.uniforms=o,e.attributes=a;var r={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},i=null;function n(s,f){if(!i){var v=Object.keys(r);i={};for(var g=0;g1)for(var x=0;x1&&B.drawBuffersWEBGL(n[D]);var N=b.getExtension("WEBGL_depth_texture");N?R?c.depth=l(b,P,z,N.UNSIGNED_INT_24_8_WEBGL,b.DEPTH_STENCIL,b.DEPTH_STENCIL_ATTACHMENT):I&&(c.depth=l(b,P,z,b.UNSIGNED_SHORT,b.DEPTH_COMPONENT,b.DEPTH_ATTACHMENT)):I&&R?c._depth_rb=x(b,P,z,b.DEPTH_STENCIL,b.DEPTH_STENCIL_ATTACHMENT):I?c._depth_rb=x(b,P,z,b.DEPTH_COMPONENT16,b.DEPTH_ATTACHMENT):R&&(c._depth_rb=x(b,P,z,b.STENCIL_INDEX,b.STENCIL_ATTACHMENT));var G=b.checkFramebufferStatus(b.FRAMEBUFFER);if(G!==b.FRAMEBUFFER_COMPLETE){c._destroyed=!0,b.bindFramebuffer(b.FRAMEBUFFER,null),b.deleteFramebuffer(c.handle),c.handle=null,c.depth&&(c.depth.dispose(),c.depth=null),c._depth_rb&&(b.deleteRenderbuffer(c._depth_rb),c._depth_rb=null);for(var j=0;jP||b<0||b>P)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");c._shape[0]=h,c._shape[1]=b;for(var z=v(_),D=0;Dz||b<0||b>z)throw new Error("gl-fbo: Parameters are too large for FBO");_=_||{};var D=1;if("color"in _){if(D=Math.max(_.color|0,0),D<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(D>1)if(P){if(D>c.getParameter(P.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+D+" draw buffers")}else throw new Error("gl-fbo: Multiple draw buffer extension not supported")}var B=c.UNSIGNED_BYTE,R=c.getExtension("OES_texture_float");if(_.float&&D>0){if(!R)throw new Error("gl-fbo: Context does not support floating point textures");B=c.FLOAT}else _.preferFloat&&D>0&&R&&(B=c.FLOAT);var I=!0;"depth"in _&&(I=!!_.depth);var F=!1;return"stencil"in _&&(F=!!_.stencil),new S(c,h,b,B,D,I,F,P)}},2272:function(t,e,r){var i=r(2646)[4];r(2478),t.exports=o;function n(a,s,f,v,g,m){var w=s.opposite(v,g);if(!(w<0)){if(g0;){for(var x=f.pop(),m=f.pop(),y=-1,S=-1,w=g[m],M=1;M=0||(s.flip(m,x),n(a,s,f,y,m,S),n(a,s,f,m,S,y),n(a,s,f,S,x,y),n(a,s,f,x,y,S))}}},2334:function(t){t.exports=e;function e(r,i,n){return r[0]=Math.min(i[0],n[0]),r[1]=Math.min(i[1],n[1]),r[2]=Math.min(i[2],n[2]),r[3]=Math.min(i[3],n[3]),r}},2335:function(t){t.exports=e;function e(r){var i=new Float32Array(4);return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i}},2361:function(t){var e=!1;if(typeof Float64Array<"u"){var r=new Float64Array(1),i=new Uint32Array(r.buffer);if(r[0]=1,e=!0,i[1]===1072693248){let o=function(f,v){return i[0]=f,i[1]=v,r[0]},a=function(f){return r[0]=f,i[0]},s=function(f){return r[0]=f,i[1]};t.exports=function(f){return r[0]=f,[i[0],i[1]]},t.exports.pack=o,t.exports.lo=a,t.exports.hi=s}else if(i[0]===1072693248){let o=function(f,v){return i[1]=f,i[0]=v,r[0]},a=function(f){return r[0]=f,i[1]},s=function(f){return r[0]=f,i[0]};t.exports=function(f){return r[0]=f,[i[1],i[0]]},t.exports.pack=o,t.exports.lo=a,t.exports.hi=s}else e=!1}if(!e){let o=function(f,v){return n.writeUInt32LE(f,0,!0),n.writeUInt32LE(v,4,!0),n.readDoubleLE(0,!0)},a=function(f){return n.writeDoubleLE(f,0,!0),n.readUInt32LE(0,!0)},s=function(f){return n.writeDoubleLE(f,0,!0),n.readUInt32LE(4,!0)};var n=new Buffer(8);t.exports=function(f){return n.writeDoubleLE(f,0,!0),[n.readUInt32LE(0,!0),n.readUInt32LE(4,!0)]},t.exports.pack=o,t.exports.lo=a,t.exports.hi=s}t.exports.sign=function(o){return t.exports.hi(o)>>>31},t.exports.exponent=function(o){var a=t.exports.hi(o);return(a<<1>>>21)-1023},t.exports.fraction=function(o){var a=t.exports.lo(o),s=t.exports.hi(o),f=s&(1<<20)-1;return s&2146435072&&(f+=1048576),[a,f]},t.exports.denormalized=function(o){var a=t.exports.hi(o);return!(a&2146435072)}},2408:function(t){t.exports=e;function e(r,i,n){var o=Math.sin(n),a=Math.cos(n),s=i[0],f=i[1],v=i[2],g=i[3],m=i[8],w=i[9],l=i[10],x=i[11];return i!==r&&(r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15]),r[0]=s*a-m*o,r[1]=f*a-w*o,r[2]=v*a-l*o,r[3]=g*a-x*o,r[8]=s*o+m*a,r[9]=f*o+w*a,r[10]=v*o+l*a,r[11]=g*o+x*a,r}},2419:function(t){t.exports=e;function e(r){for(var i=1,n=1;nS-y?o(f,v,g,m,w,l,x,y,S,k,M):a(f,v,g,m,w,l,x,y,S,k,M)}return s}function i(){function o(g,m,w,l,x,y,S,k,M,T,c){for(var h=2*g,b=l,_=h*l;bT-M?l?o(g,m,w,x,y,S,k,M,T,c,h):a(g,m,w,x,y,S,k,M,T,c,h):l?s(g,m,w,x,y,S,k,M,T,c,h):f(g,m,w,x,y,S,k,M,T,c,h)}return v}function n(o){return o?r():i()}e.partial=n(!1),e.full=n(!0)},2478:function(t){function e(s,f,v,g,m){for(var w=m+1;g<=m;){var l=g+m>>>1,x=s[l],y=v!==void 0?v(x,f):x-f;y>=0?(w=l,m=l-1):g=l+1}return w}function r(s,f,v,g,m){for(var w=m+1;g<=m;){var l=g+m>>>1,x=s[l],y=v!==void 0?v(x,f):x-f;y>0?(w=l,m=l-1):g=l+1}return w}function i(s,f,v,g,m){for(var w=g-1;g<=m;){var l=g+m>>>1,x=s[l],y=v!==void 0?v(x,f):x-f;y<0?(w=l,g=l+1):m=l-1}return w}function n(s,f,v,g,m){for(var w=g-1;g<=m;){var l=g+m>>>1,x=s[l],y=v!==void 0?v(x,f):x-f;y<=0?(w=l,g=l+1):m=l-1}return w}function o(s,f,v,g,m){for(;g<=m;){var w=g+m>>>1,l=s[w],x=v!==void 0?v(l,f):l-f;if(x===0)return w;x<=0?g=w+1:m=w-1}return-1}function a(s,f,v,g,m,w){return typeof v=="function"?w(s,f,v,g===void 0?0:g|0,m===void 0?s.length-1:m|0):w(s,f,void 0,v===void 0?0:v|0,g===void 0?s.length-1:g|0)}t.exports={ge:function(s,f,v,g,m){return a(s,f,v,g,m,e)},gt:function(s,f,v,g,m){return a(s,f,v,g,m,r)},lt:function(s,f,v,g,m){return a(s,f,v,g,m,i)},le:function(s,f,v,g,m){return a(s,f,v,g,m,n)},eq:function(s,f,v,g,m){return a(s,f,v,g,m,o)}}},2504:function(t){t.exports=e;function e(r,i,n){var o=n[0],a=n[1],s=n[2];return r[0]=i[0]*o,r[1]=i[1]*o,r[2]=i[2]*o,r[3]=i[3]*o,r[4]=i[4]*a,r[5]=i[5]*a,r[6]=i[6]*a,r[7]=i[7]*a,r[8]=i[8]*s,r[9]=i[9]*s,r[10]=i[10]*s,r[11]=i[11]*s,r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r}},2538:function(t,e,r){var i=r(8902),n=r(5542),o=r(2272),a=r(5023);t.exports=m;function s(w){return[Math.min(w[0],w[1]),Math.max(w[0],w[1])]}function f(w,l){return w[0]-l[0]||w[1]-l[1]}function v(w){return w.map(s).sort(f)}function g(w,l,x){return l in w?w[l]:x}function m(w,l,x){Array.isArray(l)?(x=x||{},l=l||[]):(x=l||{},l=[]);var y=!!g(x,"delaunay",!0),S=!!g(x,"interior",!0),k=!!g(x,"exterior",!0),M=!!g(x,"infinity",!1);if(!S&&!k||w.length===0)return[];var T=i(w,l);if(y||S!==k||M){for(var c=n(w.length,v(l)),h=0;h0){if(G=1,st[Z++]=v(M[b],l,x,y),b+=F,S>0)for(N=1,_=M[b],ot=st[Z]=v(_,l,x,y),ut=st[Z+X],it=st[Z+J],Tt=st[Z+nt],(ot!==ut||ot!==it||ot!==Tt)&&(z=M[b+P],B=M[b+D],I=M[b+R],s(N,G,_,z,B,I,ot,ut,it,Tt,l,x,y),wt=et[Z]=rt++),Z+=1,b+=F,N=2;N0)for(N=1,_=M[b],ot=st[Z]=v(_,l,x,y),ut=st[Z+X],it=st[Z+J],Tt=st[Z+nt],(ot!==ut||ot!==it||ot!==Tt)&&(z=M[b+P],B=M[b+D],I=M[b+R],s(N,G,_,z,B,I,ot,ut,it,Tt,l,x,y),wt=et[Z]=rt++,Tt!==it&&f(et[Z+J],wt,B,I,it,Tt,l,x,y)),Z+=1,b+=F,N=2;N0){if(N=1,st[Z++]=v(M[b],l,x,y),b+=F,k>0)for(G=1,_=M[b],ot=st[Z]=v(_,l,x,y),it=st[Z+J],ut=st[Z+X],Tt=st[Z+nt],(ot!==it||ot!==ut||ot!==Tt)&&(z=M[b+P],B=M[b+D],I=M[b+R],s(N,G,_,z,B,I,ot,it,ut,Tt,l,x,y),wt=et[Z]=rt++),Z+=1,b+=F,G=2;G0)for(G=1,_=M[b],ot=st[Z]=v(_,l,x,y),it=st[Z+J],ut=st[Z+X],Tt=st[Z+nt],(ot!==it||ot!==ut||ot!==Tt)&&(z=M[b+P],B=M[b+D],I=M[b+R],s(N,G,_,z,B,I,ot,it,ut,Tt,l,x,y),wt=et[Z]=rt++,Tt!==it&&f(et[Z+J],wt,I,z,Tt,it,l,x,y)),Z+=1,b+=F,G=2;G 0"),typeof s.vertex!="function"&&f("Must specify vertex creation function"),typeof s.cell!="function"&&f("Must specify cell creation function"),typeof s.phase!="function"&&f("Must specify phase function");for(var w=s.getters||[],l=new Array(g),x=0;x=0?l[x]=!0:l[x]=!1;return o(s.vertex,s.cell,s.phase,m,v,l)}},2642:function(t,e,r){t.exports=o;var i=r(727);function n(a){for(var s=0,f=0;fl[1][2]&&(_[0]=-_[0]),l[0][2]>l[2][0]&&(_[1]=-_[1]),l[1][0]>l[0][1]&&(_[2]=-_[2]),!0};function y(M,T,c){var h=T[0],b=T[1],_=T[2],P=T[3];return M[0]=c[0]*h+c[4]*b+c[8]*_+c[12]*P,M[1]=c[1]*h+c[5]*b+c[9]*_+c[13]*P,M[2]=c[2]*h+c[6]*b+c[10]*_+c[14]*P,M[3]=c[3]*h+c[7]*b+c[11]*_+c[15]*P,M}function S(M,T){M[0][0]=T[0],M[0][1]=T[1],M[0][2]=T[2],M[1][0]=T[4],M[1][1]=T[5],M[1][2]=T[6],M[2][0]=T[8],M[2][1]=T[9],M[2][2]=T[10]}function k(M,T,c,h,b){M[0]=T[0]*h+c[0]*b,M[1]=T[1]*h+c[1]*b,M[2]=T[2]*h+c[2]*b}},2653:function(t,e,r){var i=r(3865);t.exports=n;function n(o,a){for(var s=o.length,f=new Array(s),v=0;v=v[S]&&(y+=1);l[x]=y}}return f}function s(f,v){try{return i(f,!0)}catch{var g=n(f);if(g.length<=v)return[];var m=o(f,g),w=i(m,!0);return a(w,g)}}},2762:function(t,e,r){var i=r(1888),n=r(5298),o=r(9618),a=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"];function s(l,x,y,S,k){this.gl=l,this.type=x,this.handle=y,this.length=S,this.usage=k}var f=s.prototype;f.bind=function(){this.gl.bindBuffer(this.type,this.handle)},f.unbind=function(){this.gl.bindBuffer(this.type,null)},f.dispose=function(){this.gl.deleteBuffer(this.handle)};function v(l,x,y,S,k,M){var T=k.length*k.BYTES_PER_ELEMENT;if(M<0)return l.bufferData(x,k,S),T;if(T+M>y)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return l.bufferSubData(x,M,k),y}function g(l,x){for(var y=i.malloc(l.length,x),S=l.length,k=0;k=0;--S){if(x[S]!==y)return!1;y*=l[S]}return!0}f.update=function(l,x){if(typeof x!="number"&&(x=-1),this.bind(),typeof l=="object"&&typeof l.shape<"u"){var y=l.dtype;if(a.indexOf(y)<0&&(y="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var S=gl.getExtension("OES_element_index_uint");S&&y!=="uint16"?y="uint32":y="uint16"}if(y===l.dtype&&m(l.shape,l.stride))l.offset===0&&l.data.length===l.shape[0]?this.length=v(this.gl,this.type,this.length,this.usage,l.data,x):this.length=v(this.gl,this.type,this.length,this.usage,l.data.subarray(l.offset,l.shape[0]),x);else{var k=i.malloc(l.size,y),M=o(k,l.shape);n.assign(M,l),x<0?this.length=v(this.gl,this.type,this.length,this.usage,k,x):this.length=v(this.gl,this.type,this.length,this.usage,k.subarray(0,l.size),x),i.free(k)}}else if(Array.isArray(l)){var T;this.type===this.gl.ELEMENT_ARRAY_BUFFER?T=g(l,"uint16"):T=g(l,"float32"),x<0?this.length=v(this.gl,this.type,this.length,this.usage,T,x):this.length=v(this.gl,this.type,this.length,this.usage,T.subarray(0,l.length),x),i.free(T)}else if(typeof l=="object"&&typeof l.length=="number")this.length=v(this.gl,this.type,this.length,this.usage,l,x);else if(typeof l=="number"||l===void 0){if(x>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");l=l|0,l<=0&&(l=1),this.gl.bufferData(this.type,l|0,this.usage),this.length=l}else throw new Error("gl-buffer: Invalid data type")};function w(l,x,y,S){if(y=y||l.ARRAY_BUFFER,S=S||l.DYNAMIC_DRAW,y!==l.ARRAY_BUFFER&&y!==l.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(S!==l.DYNAMIC_DRAW&&S!==l.STATIC_DRAW&&S!==l.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var k=l.createBuffer(),M=new s(l,y,k,0,S);return M.update(x),M}t.exports=w},2825:function(t){t.exports=e;function e(r,i,n){var o=new Float32Array(3);return o[0]=r,o[1]=i,o[2]=n,o}},2931:function(t,e,r){t.exports={EPSILON:r(2613),create:r(1091),clone:r(3126),angle:r(8192),fromValues:r(2825),copy:r(3990),set:r(1463),equals:r(9922),exactEquals:r(9265),add:r(5632),subtract:r(6843),sub:r(2229),multiply:r(5847),mul:r(4505),divide:r(6690),div:r(4008),min:r(8107),max:r(7417),floor:r(2681),ceil:r(9226),round:r(2447),scale:r(6621),scaleAndAdd:r(8489),distance:r(7056),dist:r(5455),squaredDistance:r(2953),sqrDist:r(6141),length:r(1387),len:r(868),squaredLength:r(3066),sqrLen:r(5486),negate:r(5093),inverse:r(811),normalize:r(3536),dot:r(244),cross:r(5911),lerp:r(6658),random:r(7636),transformMat4:r(5673),transformMat3:r(492),transformQuat:r(264),rotateX:r(6894),rotateY:r(109),rotateZ:r(8692),forEach:r(5137)}},2933:function(t){t.exports=e;function e(r,i){return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r}},2953:function(t){t.exports=e;function e(r,i){var n=i[0]-r[0],o=i[1]-r[1],a=i[2]-r[2];return n*n+o*o+a*a}},2962:function(t,e,r){var i=r(5250),n=r(8210),o=r(3012),a=r(7004),s=6;function f(S,k,M,T){return function(c){return T(S(M(c[0][0],c[1][1]),M(-c[0][1],c[1][0])))}}function v(S,k,M,T){return function(c){return T(S(k(S(M(c[1][1],c[2][2]),M(-c[1][2],c[2][1])),c[0][0]),S(k(S(M(c[1][0],c[2][2]),M(-c[1][2],c[2][0])),-c[0][1]),k(S(M(c[1][0],c[2][1]),M(-c[1][1],c[2][0])),c[0][2]))))}}function g(S,k,M,T){return function(c){return T(S(S(k(S(k(S(M(c[2][2],c[3][3]),M(-c[2][3],c[3][2])),c[1][1]),S(k(S(M(c[2][1],c[3][3]),M(-c[2][3],c[3][1])),-c[1][2]),k(S(M(c[2][1],c[3][2]),M(-c[2][2],c[3][1])),c[1][3]))),c[0][0]),k(S(k(S(M(c[2][2],c[3][3]),M(-c[2][3],c[3][2])),c[1][0]),S(k(S(M(c[2][0],c[3][3]),M(-c[2][3],c[3][0])),-c[1][2]),k(S(M(c[2][0],c[3][2]),M(-c[2][2],c[3][0])),c[1][3]))),-c[0][1])),S(k(S(k(S(M(c[2][1],c[3][3]),M(-c[2][3],c[3][1])),c[1][0]),S(k(S(M(c[2][0],c[3][3]),M(-c[2][3],c[3][0])),-c[1][1]),k(S(M(c[2][0],c[3][1]),M(-c[2][1],c[3][0])),c[1][3]))),c[0][2]),k(S(k(S(M(c[2][1],c[3][2]),M(-c[2][2],c[3][1])),c[1][0]),S(k(S(M(c[2][0],c[3][2]),M(-c[2][2],c[3][0])),-c[1][1]),k(S(M(c[2][0],c[3][1]),M(-c[2][1],c[3][0])),c[1][2]))),-c[0][3]))))}}function m(S,k,M,T){return function(c){return T(S(S(k(S(S(k(S(k(S(M(c[3][3],c[4][4]),M(-c[3][4],c[4][3])),c[2][2]),S(k(S(M(c[3][2],c[4][4]),M(-c[3][4],c[4][2])),-c[2][3]),k(S(M(c[3][2],c[4][3]),M(-c[3][3],c[4][2])),c[2][4]))),c[1][1]),k(S(k(S(M(c[3][3],c[4][4]),M(-c[3][4],c[4][3])),c[2][1]),S(k(S(M(c[3][1],c[4][4]),M(-c[3][4],c[4][1])),-c[2][3]),k(S(M(c[3][1],c[4][3]),M(-c[3][3],c[4][1])),c[2][4]))),-c[1][2])),S(k(S(k(S(M(c[3][2],c[4][4]),M(-c[3][4],c[4][2])),c[2][1]),S(k(S(M(c[3][1],c[4][4]),M(-c[3][4],c[4][1])),-c[2][2]),k(S(M(c[3][1],c[4][2]),M(-c[3][2],c[4][1])),c[2][4]))),c[1][3]),k(S(k(S(M(c[3][2],c[4][3]),M(-c[3][3],c[4][2])),c[2][1]),S(k(S(M(c[3][1],c[4][3]),M(-c[3][3],c[4][1])),-c[2][2]),k(S(M(c[3][1],c[4][2]),M(-c[3][2],c[4][1])),c[2][3]))),-c[1][4]))),c[0][0]),k(S(S(k(S(k(S(M(c[3][3],c[4][4]),M(-c[3][4],c[4][3])),c[2][2]),S(k(S(M(c[3][2],c[4][4]),M(-c[3][4],c[4][2])),-c[2][3]),k(S(M(c[3][2],c[4][3]),M(-c[3][3],c[4][2])),c[2][4]))),c[1][0]),k(S(k(S(M(c[3][3],c[4][4]),M(-c[3][4],c[4][3])),c[2][0]),S(k(S(M(c[3][0],c[4][4]),M(-c[3][4],c[4][0])),-c[2][3]),k(S(M(c[3][0],c[4][3]),M(-c[3][3],c[4][0])),c[2][4]))),-c[1][2])),S(k(S(k(S(M(c[3][2],c[4][4]),M(-c[3][4],c[4][2])),c[2][0]),S(k(S(M(c[3][0],c[4][4]),M(-c[3][4],c[4][0])),-c[2][2]),k(S(M(c[3][0],c[4][2]),M(-c[3][2],c[4][0])),c[2][4]))),c[1][3]),k(S(k(S(M(c[3][2],c[4][3]),M(-c[3][3],c[4][2])),c[2][0]),S(k(S(M(c[3][0],c[4][3]),M(-c[3][3],c[4][0])),-c[2][2]),k(S(M(c[3][0],c[4][2]),M(-c[3][2],c[4][0])),c[2][3]))),-c[1][4]))),-c[0][1])),S(k(S(S(k(S(k(S(M(c[3][3],c[4][4]),M(-c[3][4],c[4][3])),c[2][1]),S(k(S(M(c[3][1],c[4][4]),M(-c[3][4],c[4][1])),-c[2][3]),k(S(M(c[3][1],c[4][3]),M(-c[3][3],c[4][1])),c[2][4]))),c[1][0]),k(S(k(S(M(c[3][3],c[4][4]),M(-c[3][4],c[4][3])),c[2][0]),S(k(S(M(c[3][0],c[4][4]),M(-c[3][4],c[4][0])),-c[2][3]),k(S(M(c[3][0],c[4][3]),M(-c[3][3],c[4][0])),c[2][4]))),-c[1][1])),S(k(S(k(S(M(c[3][1],c[4][4]),M(-c[3][4],c[4][1])),c[2][0]),S(k(S(M(c[3][0],c[4][4]),M(-c[3][4],c[4][0])),-c[2][1]),k(S(M(c[3][0],c[4][1]),M(-c[3][1],c[4][0])),c[2][4]))),c[1][3]),k(S(k(S(M(c[3][1],c[4][3]),M(-c[3][3],c[4][1])),c[2][0]),S(k(S(M(c[3][0],c[4][3]),M(-c[3][3],c[4][0])),-c[2][1]),k(S(M(c[3][0],c[4][1]),M(-c[3][1],c[4][0])),c[2][3]))),-c[1][4]))),c[0][2]),S(k(S(S(k(S(k(S(M(c[3][2],c[4][4]),M(-c[3][4],c[4][2])),c[2][1]),S(k(S(M(c[3][1],c[4][4]),M(-c[3][4],c[4][1])),-c[2][2]),k(S(M(c[3][1],c[4][2]),M(-c[3][2],c[4][1])),c[2][4]))),c[1][0]),k(S(k(S(M(c[3][2],c[4][4]),M(-c[3][4],c[4][2])),c[2][0]),S(k(S(M(c[3][0],c[4][4]),M(-c[3][4],c[4][0])),-c[2][2]),k(S(M(c[3][0],c[4][2]),M(-c[3][2],c[4][0])),c[2][4]))),-c[1][1])),S(k(S(k(S(M(c[3][1],c[4][4]),M(-c[3][4],c[4][1])),c[2][0]),S(k(S(M(c[3][0],c[4][4]),M(-c[3][4],c[4][0])),-c[2][1]),k(S(M(c[3][0],c[4][1]),M(-c[3][1],c[4][0])),c[2][4]))),c[1][2]),k(S(k(S(M(c[3][1],c[4][2]),M(-c[3][2],c[4][1])),c[2][0]),S(k(S(M(c[3][0],c[4][2]),M(-c[3][2],c[4][0])),-c[2][1]),k(S(M(c[3][0],c[4][1]),M(-c[3][1],c[4][0])),c[2][2]))),-c[1][4]))),-c[0][3]),k(S(S(k(S(k(S(M(c[3][2],c[4][3]),M(-c[3][3],c[4][2])),c[2][1]),S(k(S(M(c[3][1],c[4][3]),M(-c[3][3],c[4][1])),-c[2][2]),k(S(M(c[3][1],c[4][2]),M(-c[3][2],c[4][1])),c[2][3]))),c[1][0]),k(S(k(S(M(c[3][2],c[4][3]),M(-c[3][3],c[4][2])),c[2][0]),S(k(S(M(c[3][0],c[4][3]),M(-c[3][3],c[4][0])),-c[2][2]),k(S(M(c[3][0],c[4][2]),M(-c[3][2],c[4][0])),c[2][3]))),-c[1][1])),S(k(S(k(S(M(c[3][1],c[4][3]),M(-c[3][3],c[4][1])),c[2][0]),S(k(S(M(c[3][0],c[4][3]),M(-c[3][3],c[4][0])),-c[2][1]),k(S(M(c[3][0],c[4][1]),M(-c[3][1],c[4][0])),c[2][3]))),c[1][2]),k(S(k(S(M(c[3][1],c[4][2]),M(-c[3][2],c[4][1])),c[2][0]),S(k(S(M(c[3][0],c[4][2]),M(-c[3][2],c[4][0])),-c[2][1]),k(S(M(c[3][0],c[4][1]),M(-c[3][1],c[4][0])),c[2][2]))),-c[1][3]))),c[0][4])))))}}function w(S){var k=S===2?f:S===3?v:S===4?g:S===5?m:void 0;return k(n,o,i,a)}var l=[function(){return[0]},function(S){return[S[0][0]]}];function x(S,k,M,T,c,h,b,_){return function(P){switch(P.length){case 0:return S(P);case 1:return k(P);case 2:return M(P);case 3:return T(P);case 4:return c(P);case 5:return h(P)}var z=b[P.length];return z||(z=b[P.length]=_(P.length)),z(P)}}function y(){for(;l.length0){_=v[D][h][0],z=D;break}P=_[z^1];for(var B=0;B<2;++B)for(var R=v[B][h],I=0;I0&&(_=F,P=j,z=B)}return b||_&&l(_,z),P}function y(c,h){var b=v[h][c][0],_=[c];l(b,h);for(var P=b[h^1],z=h;;){for(;P!==c;)_.push(P),P=x(_[_.length-2],P,!1);if(v[0][c].length+v[1][c].length===0)break;var D=_[_.length-1],B=c,R=_[1],I=x(D,B,!0);if(i(a[D],a[B],a[R],a[I])<0)break;_.push(c),P=x(D,B)}return _}function S(c,h){return h[1]===h[h.length-1]}for(var g=0;g0;){v[0][g].length;var T=y(g,k);S(M,T)?M.push.apply(M,T):(M.length>0&&w.push(M),M=T)}M.length>0&&w.push(M)}return w}},3090:function(t,e,r){t.exports=n;var i=r(3250)[3];function n(o){var a=o.length;if(a<3){for(var s=new Array(a),f=0;f1&&i(o[g[x-2]],o[g[x-1]],l)<=0;)x-=1,g.pop();for(g.push(w),x=m.length;x>1&&i(o[m[x-2]],o[m[x-1]],l)>=0;)x-=1,m.pop();m.push(w)}for(var s=new Array(m.length+g.length-2),y=0,f=0,S=g.length;f0;--k)s[y++]=m[k];return s}},3105:function(t,e){"use restrict";var r=32;e.INT_BITS=r,e.INT_MAX=2147483647,e.INT_MIN=-1<0)-(o<0)},e.abs=function(o){var a=o>>r-1;return(o^a)-a},e.min=function(o,a){return a^(o^a)&-(o65535)<<4,o>>>=a,s=(o>255)<<3,o>>>=s,a|=s,s=(o>15)<<2,o>>>=s,a|=s,s=(o>3)<<1,o>>>=s,a|=s,a|o>>1},e.log10=function(o){return o>=1e9?9:o>=1e8?8:o>=1e7?7:o>=1e6?6:o>=1e5?5:o>=1e4?4:o>=1e3?3:o>=100?2:o>=10?1:0},e.popCount=function(o){return o=o-(o>>>1&1431655765),o=(o&858993459)+(o>>>2&858993459),(o+(o>>>4)&252645135)*16843009>>>24};function i(o){var a=32;return o&=-o,o&&a--,o&65535&&(a-=16),o&16711935&&(a-=8),o&252645135&&(a-=4),o&858993459&&(a-=2),o&1431655765&&(a-=1),a}e.countTrailingZeros=i,e.nextPow2=function(o){return o+=o===0,--o,o|=o>>>1,o|=o>>>2,o|=o>>>4,o|=o>>>8,o|=o>>>16,o+1},e.prevPow2=function(o){return o|=o>>>1,o|=o>>>2,o|=o>>>4,o|=o>>>8,o|=o>>>16,o-(o>>>1)},e.parity=function(o){return o^=o>>>16,o^=o>>>8,o^=o>>>4,o&=15,27030>>>o&1};var n=new Array(256);(function(o){for(var a=0;a<256;++a){var s=a,f=a,v=7;for(s>>>=1;s;s>>>=1)f<<=1,f|=s&1,--v;o[a]=f<>>8&255]<<16|n[o>>>16&255]<<8|n[o>>>24&255]},e.interleave2=function(o,a){return o&=65535,o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,a&=65535,a=(a|a<<8)&16711935,a=(a|a<<4)&252645135,a=(a|a<<2)&858993459,a=(a|a<<1)&1431655765,o|a<<1},e.deinterleave2=function(o,a){return o=o>>>a&1431655765,o=(o|o>>>1)&858993459,o=(o|o>>>2)&252645135,o=(o|o>>>4)&16711935,o=(o|o>>>16)&65535,o<<16>>16},e.interleave3=function(o,a,s){return o&=1023,o=(o|o<<16)&4278190335,o=(o|o<<8)&251719695,o=(o|o<<4)&3272356035,o=(o|o<<2)&1227133513,a&=1023,a=(a|a<<16)&4278190335,a=(a|a<<8)&251719695,a=(a|a<<4)&3272356035,a=(a|a<<2)&1227133513,o|=a<<1,s&=1023,s=(s|s<<16)&4278190335,s=(s|s<<8)&251719695,s=(s|s<<4)&3272356035,s=(s|s<<2)&1227133513,o|s<<2},e.deinterleave3=function(o,a){return o=o>>>a&1227133513,o=(o|o>>>2)&3272356035,o=(o|o>>>4)&251719695,o=(o|o>>>8)&4278190335,o=(o|o>>>16)&1023,o<<22>>22},e.nextCombination=function(o){var a=o|o-1;return a+1|(~a&-~a)-1>>>i(o)+1}},3126:function(t){t.exports=e;function e(r){var i=new Float32Array(3);return i[0]=r[0],i[1]=r[1],i[2]=r[2],i}},3134:function(t,e,r){t.exports=n;var i=r(1682);function n(o,a){var s=o.length;if(typeof a!="number"){a=0;for(var f=0;f=0}function v(g,m,w,l){var x=i(m,w,l);if(x===0){var y=n(i(g,m,w)),S=n(i(g,m,l));if(y===S){if(y===0){var k=f(g,m,w),M=f(g,m,l);return k===M?0:k?1:-1}return 0}else{if(S===0)return y>0||f(g,m,l)?-1:1;if(y===0)return S>0||f(g,m,w)?1:-1}return n(S-y)}var T=i(g,m,w);if(T>0)return x>0&&i(g,m,l)>0?1:-1;if(T<0)return x>0||i(g,m,l)>0?1:-1;var c=i(g,m,l);return c>0||f(g,m,w)?1:-1}},3202:function(t){t.exports=function(e,r){r||(r=[0,""]),e=String(e);var i=parseFloat(e,10);return r[0]=i,r[1]=e.match(/[\d.\-\+]*\s*(.*)/)[1]||"",r}},3233:function(t){var e="",r;t.exports=i;function i(n,o){if(typeof n!="string")throw new TypeError("expected a string");if(o===1)return n;if(o===2)return n+n;var a=n.length*o;if(r!==n||typeof r>"u")r=n,e="";else if(e.length>=a)return e.substr(0,a);for(;a>e.length&&o>1;)o&1&&(e+=n),o>>=1,n+=n;return e+=n,e=e.substr(0,a),e}},3236:function(t){t.exports=function(e){typeof e=="string"&&(e=[e]);for(var r=[].slice.call(arguments,1),i=[],n=0;n0){if(z<=0)return D;B=P+z}else if(P<0){if(z>=0)return D;B=-(P+z)}else return D;var R=v*B;return D>=R||D<=-R?D:y(h,b,_)},function(h,b,_,P){var z=h[0]-P[0],D=b[0]-P[0],B=_[0]-P[0],R=h[1]-P[1],I=b[1]-P[1],F=_[1]-P[1],j=h[2]-P[2],N=b[2]-P[2],G=_[2]-P[2],rt=D*F,ct=B*I,st=B*R,et=z*F,Z=z*I,ot=D*R,X=j*(rt-ct)+N*(st-et)+G*(Z-ot),Q=(Math.abs(rt)+Math.abs(ct))*Math.abs(j)+(Math.abs(st)+Math.abs(et))*Math.abs(N)+(Math.abs(Z)+Math.abs(ot))*Math.abs(G),ut=g*Q;return X>ut||-X>ut?X:S(h,b,_,P)}];function M(h){var b=k[h.length];return b||(b=k[h.length]=x(h.length)),b.apply(void 0,h)}function T(h,b,_,P,z,D,B){return function(R,I,F,j,N){switch(arguments.length){case 0:case 1:return 0;case 2:return P(R,I);case 3:return z(R,I,F);case 4:return D(R,I,F,j);case 5:return B(R,I,F,j,N)}for(var G=new Array(arguments.length),rt=0;rt4)throw new n("","Invalid data type");switch(j.charAt(0)){case"b":case"i":f["uniform"+N+"iv"](m[z],D);break;case"v":f["uniform"+N+"fv"](m[z],D);break;default:throw new n("","Unrecognized data type for vector "+name+": "+j)}}else if(j.indexOf("mat")===0&&j.length===4){if(N=j.charCodeAt(j.length-1)-48,N<2||N>4)throw new n("","Invalid uniform dimension type for matrix "+name+": "+j);f["uniformMatrix"+N+"fv"](m[z],!1,D);break}else throw new n("","Unknown uniform data type for "+name+": "+j)}}}}}function x(T,c){if(typeof c!="object")return[[T,c]];var h=[];for(var b in c){var _=c[b],P=T;parseInt(b)+""===b?P+="["+b+"]":P+="."+b,typeof _=="object"?h.push.apply(h,x(P,_)):h.push([P,_])}return h}function y(T){switch(T){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":return 0;case"float":return 0;default:var c=T.indexOf("vec");if(0<=c&&c<=1&&T.length===4+c){var h=T.charCodeAt(T.length-1)-48;if(h<2||h>4)throw new n("","Invalid data type");return T.charAt(0)==="b"?a(h,!1):a(h,0)}else if(T.indexOf("mat")===0&&T.length===4){var h=T.charCodeAt(T.length-1)-48;if(h<2||h>4)throw new n("","Invalid uniform dimension type for matrix "+name+": "+T);return a(h*h,0)}else throw new n("","Unknown uniform data type for "+name+": "+T)}}function S(T,c,h){if(typeof h=="object"){var b=k(h);Object.defineProperty(T,c,{get:o(b),set:l(h),enumerable:!0,configurable:!1})}else m[h]?Object.defineProperty(T,c,{get:w(h),set:l(h),enumerable:!0,configurable:!1}):T[c]=y(g[h].type)}function k(T){var c;if(Array.isArray(T)){c=new Array(T.length);for(var h=0;h=0!=c>=0&&m.push(y[0]+.5+.5*(T+c)/(T-c))}g+=M,++y[0]}}}function r(){return e()}var i=r;function n(s){var f={};return function(v,g,m){var w=v.dtype,l=v.order,x=[w,l.join()].join(),y=f[x];return y||(f[x]=y=s([w,l])),y(v.shape.slice(0),v.data,v.stride,v.offset|0,g,m)}}function o(s){return n(i.bind(void 0,s))}function a(s){return o({funcName:s.funcName})}t.exports=a({funcName:"zeroCrossings"})},3352:function(t,e,r){var i=r(2478),n=0,o=1,a=2;t.exports=b;function s(_,P,z,D,B){this.mid=_,this.left=P,this.right=z,this.leftPoints=D,this.rightPoints=B,this.count=(P?P.count:0)+(z?z.count:0)+D.length}var f=s.prototype;function v(_,P){_.mid=P.mid,_.left=P.left,_.right=P.right,_.leftPoints=P.leftPoints,_.rightPoints=P.rightPoints,_.count=P.count}function g(_,P){var z=T(P);_.mid=z.mid,_.left=z.left,_.right=z.right,_.leftPoints=z.leftPoints,_.rightPoints=z.rightPoints,_.count=z.count}function m(_,P){var z=_.intervals([]);z.push(P),g(_,z)}function w(_,P){var z=_.intervals([]),D=z.indexOf(P);return D<0?n:(z.splice(D,1),g(_,z),o)}f.intervals=function(_){return _.push.apply(_,this.leftPoints),this.left&&this.left.intervals(_),this.right&&this.right.intervals(_),_},f.insert=function(_){var P=this.count-this.leftPoints.length;if(this.count+=1,_[1]3*(P+1)?m(this,_):this.left.insert(_):this.left=T([_]);else if(_[0]>this.mid)this.right?4*(this.right.count+1)>3*(P+1)?m(this,_):this.right.insert(_):this.right=T([_]);else{var z=i.ge(this.leftPoints,_,k),D=i.ge(this.rightPoints,_,M);this.leftPoints.splice(z,0,_),this.rightPoints.splice(D,0,_)}},f.remove=function(_){var P=this.count-this.leftPoints;if(_[1]3*(P-1))return w(this,_);var D=this.left.remove(_);return D===a?(this.left=null,this.count-=1,o):(D===o&&(this.count-=1),D)}else if(_[0]>this.mid){if(!this.right)return n;var B=this.left?this.left.count:0;if(4*B>3*(P-1))return w(this,_);var D=this.right.remove(_);return D===a?(this.right=null,this.count-=1,o):(D===o&&(this.count-=1),D)}else{if(this.count===1)return this.leftPoints[0]===_?a:n;if(this.leftPoints.length===1&&this.leftPoints[0]===_){if(this.left&&this.right){for(var R=this,I=this.left;I.right;)R=I,I=I.right;if(R===this)I.right=this.right;else{var F=this.left,D=this.right;R.count-=I.count,R.right=I.left,I.left=F,I.right=D}v(this,I),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?v(this,this.left):v(this,this.right);return o}for(var F=i.ge(this.leftPoints,_,k);F=0&&_[D][1]>=P;--D){var B=z(_[D]);if(B)return B}}function y(_,P){for(var z=0;z<_.length;++z){var D=P(_[z]);if(D)return D}}f.queryPoint=function(_,P){if(_this.mid){if(this.right){var z=this.right.queryPoint(_,P);if(z)return z}return x(this.rightPoints,_,P)}else return y(this.leftPoints,P)},f.queryInterval=function(_,P,z){if(_this.mid&&this.right){var D=this.right.queryInterval(_,P,z);if(D)return D}return Pthis.mid?x(this.rightPoints,_,z):y(this.leftPoints,z)};function S(_,P){return _-P}function k(_,P){var z=_[0]-P[0];return z||_[1]-P[1]}function M(_,P){var z=_[1]-P[1];return z||_[0]-P[0]}function T(_){if(_.length===0)return null;for(var P=[],z=0;z<_.length;++z)P.push(_[z][0],_[z][1]);P.sort(S);for(var D=P[P.length>>1],B=[],R=[],I=[],z=0;z<_.length;++z){var F=_[z];F[1]=0),M.type){case"b":x=parseInt(x,10).toString(2);break;case"c":x=String.fromCharCode(parseInt(x,10));break;case"d":case"i":x=parseInt(x,10);break;case"j":x=JSON.stringify(x,null,M.width?parseInt(M.width):0);break;case"e":x=M.precision?parseFloat(x).toExponential(M.precision):parseFloat(x).toExponential();break;case"f":x=M.precision?parseFloat(x).toFixed(M.precision):parseFloat(x);break;case"g":x=M.precision?String(Number(x.toPrecision(M.precision))):parseFloat(x);break;case"o":x=(parseInt(x,10)>>>0).toString(8);break;case"s":x=String(x),x=M.precision?x.substring(0,M.precision):x;break;case"t":x=String(!!x),x=M.precision?x.substring(0,M.precision):x;break;case"T":x=Object.prototype.toString.call(x).slice(8,-1).toLowerCase(),x=M.precision?x.substring(0,M.precision):x;break;case"u":x=parseInt(x,10)>>>0;break;case"v":x=x.valueOf(),x=M.precision?x.substring(0,M.precision):x;break;case"x":x=(parseInt(x,10)>>>0).toString(16);break;case"X":x=(parseInt(x,10)>>>0).toString(16).toUpperCase();break}n.json.test(M.type)?y+=x:(n.number.test(M.type)&&(!b||M.sign)?(_=b?"+":"-",x=x.toString().replace(n.sign,"")):_="",c=M.pad_char?M.pad_char==="0"?"0":M.pad_char.charAt(1):" ",h=M.width-(_+x).length,T=M.width&&h>0?c.repeat(h):"",y+=M.align?_+x+T:c==="0"?_+T+x:T+_+x)}return y}var f=Object.create(null);function v(g){if(f[g])return f[g];for(var m=g,w,l=[],x=0;m;){if((w=n.text.exec(m))!==null)l.push(w[0]);else if((w=n.modulo.exec(m))!==null)l.push("%");else if((w=n.placeholder.exec(m))!==null){if(w[2]){x|=1;var y=[],S=w[2],k=[];if((k=n.key.exec(S))!==null)for(y.push(k[1]);(S=S.substring(k[0].length))!=="";)if((k=n.key_access.exec(S))!==null)y.push(k[1]);else if((k=n.index_access.exec(S))!==null)y.push(k[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");w[2]=y}else x|=2;if(x===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");l.push({placeholder:w[0],param_no:w[1],keys:w[2],sign:w[3],pad_char:w[4],align:w[5],width:w[6],precision:w[7],type:w[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");m=m.substring(w[0].length)}return f[g]=l}e.sprintf=o,e.vsprintf=a,typeof window<"u"&&(window.sprintf=o,window.vsprintf=a,i=function(){return{sprintf:o,vsprintf:a}}.call(e,r,e,t),i!==void 0&&(t.exports=i))})()},3390:function(t){t.exports=e;function e(r,i,n,o){var a=new Float32Array(4);return a[0]=r,a[1]=i,a[2]=n,a[3]=o,a}},3436:function(t,e,r){var i=r(3236),n=r(9405),o=i([`precision highp float; +#define GLSLIFY 1 + +attribute vec3 position, offset; +attribute vec4 color; +uniform mat4 model, view, projection; +uniform float capSize; +varying vec4 fragColor; +varying vec3 fragPosition; + +void main() { + vec4 worldPosition = model * vec4(position, 1.0); + worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0); + gl_Position = projection * (view * worldPosition); + fragColor = color; + fragPosition = position; +}`]),a=i([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec3 clipBounds[2]; +uniform float opacity; +varying vec3 fragPosition; +varying vec4 fragColor; + +void main() { + if ( + outOfRange(clipBounds[0], clipBounds[1], fragPosition) || + fragColor.a * opacity == 0. + ) discard; + + gl_FragColor = opacity * fragColor; +}`]);t.exports=function(s){return n(s,o,a,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])}},3502:function(t,e,r){t.exports=o;var i=r(5995),n=r(9127);function o(a,s){return n(i(a,s))}},3508:function(t,e,r){var i=r(6852);i=i.slice().filter(function(n){return!/^(gl\_|texture)/.test(n)}),t.exports=i.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},3536:function(t){t.exports=e;function e(r,i){var n=i[0],o=i[1],a=i[2],s=n*n+o*o+a*a;return s>0&&(s=1/Math.sqrt(s),r[0]=i[0]*s,r[1]=i[1]*s,r[2]=i[2]*s),r}},3545:function(t,e,r){t.exports=s;var i=r(8105),n=i("log&&w[T+v]>k;--M,T-=x){for(var c=T,h=T+x,b=0;b>>1,k=2*f,M=S,T=w[k*S+v];x=P?(M=_,T=P):b>=D?(M=h,T=b):(M=z,T=D):P>=D?(M=_,T=P):D>=b?(M=h,T=b):(M=z,T=D);for(var B=k*(y-1),R=k*M,I=0;Ithis.buffer.length){n.free(this.buffer);for(var y=this.buffer=n.mallocUint8(a(x*l*4)),S=0;Sk|0},vertex:function(x,y,S,k,M,T,c,h,b,_,P,z,D){var B=(c<<0)+(h<<1)+(b<<2)+(_<<3)|0;if(!(B===0||B===15))switch(B){case 0:P.push([x-.5,y-.5]);break;case 1:P.push([x-.25-.25*(k+S-2*D)/(S-k),y-.25-.25*(M+S-2*D)/(S-M)]);break;case 2:P.push([x-.75-.25*(-k-S+2*D)/(k-S),y-.25-.25*(T+k-2*D)/(k-T)]);break;case 3:P.push([x-.5,y-.5-.5*(M+S+T+k-4*D)/(S-M+k-T)]);break;case 4:P.push([x-.25-.25*(T+M-2*D)/(M-T),y-.75-.25*(-M-S+2*D)/(M-S)]);break;case 5:P.push([x-.5-.5*(k+S+T+M-4*D)/(S-k+M-T),y-.5]);break;case 6:P.push([x-.5-.25*(-k-S+T+M)/(k-S+M-T),y-.5-.25*(-M-S+T+k)/(M-S+k-T)]);break;case 7:P.push([x-.75-.25*(T+M-2*D)/(M-T),y-.75-.25*(T+k-2*D)/(k-T)]);break;case 8:P.push([x-.75-.25*(-T-M+2*D)/(T-M),y-.75-.25*(-T-k+2*D)/(T-k)]);break;case 9:P.push([x-.5-.25*(k+S+-T-M)/(S-k+T-M),y-.5-.25*(M+S+-T-k)/(S-M+T-k)]);break;case 10:P.push([x-.5-.5*(-k-S+-T-M+4*D)/(k-S+T-M),y-.5]);break;case 11:P.push([x-.25-.25*(-T-M+2*D)/(T-M),y-.75-.25*(M+S-2*D)/(S-M)]);break;case 12:P.push([x-.5,y-.5-.5*(-M-S+-T-k+4*D)/(M-S+T-k)]);break;case 13:P.push([x-.75-.25*(k+S-2*D)/(S-k),y-.25-.25*(-T-k+2*D)/(T-k)]);break;case 14:P.push([x-.25-.25*(-k-S+2*D)/(k-S),y-.25-.25*(-M-S+2*D)/(M-S)]);break;case 15:P.push([x-.5,y-.5]);break}},cell:function(x,y,S,k,M,T,c,h,b){M?h.push([x,y]):h.push([y,x])}});return function(x,y){var S=[],k=[];return l(x,S,k,y),{positions:S,cells:k}}}};function a(g,m){var w=g.length+"d",l=o[w];if(l)return l(i,g,m)}function s(g,m){for(var w=n(g,m),l=w.length,x=new Array(l),y=new Array(l),S=0;S>1,w=-7,l=n?a-1:0,x=n?-1:1,y=r[i+l];for(l+=x,s=y&(1<<-w)-1,y>>=-w,w+=v;w>0;s=s*256+r[i+l],l+=x,w-=8);for(f=s&(1<<-w)-1,s>>=-w,w+=o;w>0;f=f*256+r[i+l],l+=x,w-=8);if(s===0)s=1-m;else{if(s===g)return f?NaN:(y?-1:1)*(1/0);f=f+Math.pow(2,o),s=s-m}return(y?-1:1)*f*Math.pow(2,s-o)},e.write=function(r,i,n,o,a,s){var f,v,g,m=s*8-a-1,w=(1<>1,x=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=o?0:s-1,S=o?1:-1,k=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(v=isNaN(i)?1:0,f=w):(f=Math.floor(Math.log(i)/Math.LN2),i*(g=Math.pow(2,-f))<1&&(f--,g*=2),f+l>=1?i+=x/g:i+=x*Math.pow(2,1-l),i*g>=2&&(f++,g/=2),f+l>=w?(v=0,f=w):f+l>=1?(v=(i*g-1)*Math.pow(2,a),f=f+l):(v=i*Math.pow(2,l-1)*Math.pow(2,a),f=0));a>=8;r[n+y]=v&255,y+=S,v/=256,a-=8);for(f=f<0;r[n+y]=f&255,y+=S,f/=256,m-=8);r[n+y-S]|=k*128}},3788:function(t,e,r){var i=r(8507),n=r(2419);t.exports=o;function o(a,s){return i(a,s)||n(a)-n(s)}},3837:function(t,e,r){t.exports=z;var i=r(4935),n=r(501),o=r(5304),a=r(6429),s=r(6444),f=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),v=ArrayBuffer,g=DataView;function m(D){return v.isView(D)&&!(D instanceof g)}function w(D){return Array.isArray(D)||m(D)}function l(D,B){return D[0]=B[0],D[1]=B[1],D[2]=B[2],D}function x(D){this.gl=D,this.pixelRatio=1,this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.autoTicks=!0,this.tickSpacing=[1,1,1],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickFontStyle=["normal","normal","normal"],this.tickFontWeight=["normal","normal","normal"],this.tickFontVariant=["normal","normal","normal"],this.tickSize=[12,12,12],this.tickAngle=[0,0,0],this.tickAlign=["auto","auto","auto"],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[10,10,10],this.lastCubeProps={cubeEdges:[0,0,0],axis:[0,0,0]},this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont=["sans-serif","sans-serif","sans-serif"],this.labelFontStyle=["normal","normal","normal"],this.labelFontWeight=["normal","normal","normal"],this.labelFontVariant=["normal","normal","normal"],this.labelSize=[20,20,20],this.labelAngle=[0,0,0],this.labelAlign=["auto","auto","auto"],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[10,10,10],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[0,0,0],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!1,!1,!1],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._firstInit=!0,this._text=null,this._lines=null,this._background=o(D)}var y=x.prototype;y.update=function(D){D=D||{};function B(Q,ut,J){if(J in D){var q=D[J],it=this[J],nt;(Q?w(q)&&w(q[0]):w(q))?this[J]=nt=[ut(q[0]),ut(q[1]),ut(q[2])]:this[J]=nt=[ut(q),ut(q),ut(q)];for(var dt=0;dt<3;++dt)if(nt[dt]!==it[dt])return!0}return!1}var R=B.bind(this,!1,Number),I=B.bind(this,!1,Boolean),F=B.bind(this,!1,String),j=B.bind(this,!0,function(Q){if(w(Q)){if(Q.length===3)return[+Q[0],+Q[1],+Q[2],1];if(Q.length===4)return[+Q[0],+Q[1],+Q[2],+Q[3]]}return[0,0,0,1]}),N,G=!1,rt=!1;if("bounds"in D)for(var ct=D.bounds,st=0;st<2;++st)for(var et=0;et<3;++et)ct[st][et]!==this.bounds[st][et]&&(rt=!0),this.bounds[st][et]=ct[st][et];if("ticks"in D){N=D.ticks,G=!0,this.autoTicks=!1;for(var st=0;st<3;++st)this.tickSpacing[st]=0}else R("tickSpacing")&&(this.autoTicks=!0,rt=!0);if(this._firstInit&&("ticks"in D||"tickSpacing"in D||(this.autoTicks=!0),rt=!0,G=!0,this._firstInit=!1),rt&&this.autoTicks&&(N=s.create(this.bounds,this.tickSpacing),G=!0),G){for(var st=0;st<3;++st)N[st].sort(function(ut,J){return ut.x-J.x});s.equal(N,this.ticks)?G=!1:this.ticks=N}I("tickEnable"),F("tickFont")&&(G=!0),F("tickFontStyle")&&(G=!0),F("tickFontWeight")&&(G=!0),F("tickFontVariant")&&(G=!0),R("tickSize"),R("tickAngle"),R("tickPad"),j("tickColor");var Z=F("labels");F("labelFont")&&(Z=!0),F("labelFontStyle")&&(Z=!0),F("labelFontWeight")&&(Z=!0),F("labelFontVariant")&&(Z=!0),I("labelEnable"),R("labelSize"),R("labelPad"),j("labelColor"),I("lineEnable"),I("lineMirror"),R("lineWidth"),j("lineColor"),I("lineTickEnable"),I("lineTickMirror"),R("lineTickLength"),R("lineTickWidth"),j("lineTickColor"),I("gridEnable"),R("gridWidth"),j("gridColor"),I("zeroEnable"),j("zeroLineColor"),R("zeroLineWidth"),I("backgroundEnable"),j("backgroundColor");var ot=[{family:this.labelFont[0],style:this.labelFontStyle[0],weight:this.labelFontWeight[0],variant:this.labelFontVariant[0]},{family:this.labelFont[1],style:this.labelFontStyle[1],weight:this.labelFontWeight[1],variant:this.labelFontVariant[1]},{family:this.labelFont[2],style:this.labelFontStyle[2],weight:this.labelFontWeight[2],variant:this.labelFontVariant[2]}],X=[{family:this.tickFont[0],style:this.tickFontStyle[0],weight:this.tickFontWeight[0],variant:this.tickFontVariant[0]},{family:this.tickFont[1],style:this.tickFontStyle[1],weight:this.tickFontWeight[1],variant:this.tickFontVariant[1]},{family:this.tickFont[2],style:this.tickFontStyle[2],weight:this.tickFontWeight[2],variant:this.tickFontVariant[2]}];this._text?this._text&&(Z||G)&&this._text.update(this.bounds,this.labels,ot,this.ticks,X):this._text=i(this.gl,this.bounds,this.labels,ot,this.ticks,X),this._lines&&G&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=n(this.gl,this.bounds,this.ticks))};function S(){this.primalOffset=[0,0,0],this.primalMinor=[0,0,0],this.mirrorOffset=[0,0,0],this.mirrorMinor=[0,0,0]}var k=[new S,new S,new S];function M(D,B,R,I,F){for(var j=D.primalOffset,N=D.primalMinor,G=D.mirrorOffset,rt=D.mirrorMinor,ct=I[B],st=0;st<3;++st)if(B!==st){var et=j,Z=G,ot=N,X=rt;ct&1<0?(ot[st]=-1,X[st]=0):(ot[st]=0,X[st]=1)}}var T=[0,0,0],c={model:f,view:f,projection:f,_ortho:!1};y.isOpaque=function(){return!0},y.isTransparent=function(){return!1},y.drawTransparent=function(D){};var h=0,b=[0,0,0],_=[0,0,0],P=[0,0,0];y.draw=function(D){D=D||c;for(var B=this.gl,R=D.model||f,I=D.view||f,F=D.projection||f,j=this.bounds,N=D._ortho||!1,G=a(R,I,F,j,N),rt=G.cubeEdges,ct=G.axis,st=I[12],et=I[13],Z=I[14],ot=I[15],X=N?2:1,Q=X*this.pixelRatio*(F[3]*st+F[7]*et+F[11]*Z+F[15]*ot)/B.drawingBufferHeight,ut=0;ut<3;++ut)this.lastCubeProps.cubeEdges[ut]=rt[ut],this.lastCubeProps.axis[ut]=ct[ut];for(var J=k,ut=0;ut<3;++ut)M(k[ut],ut,this.bounds,rt,ct);for(var B=this.gl,q=T,ut=0;ut<3;++ut)this.backgroundEnable[ut]?q[ut]=ct[ut]:q[ut]=0;this._background.draw(R,I,F,j,q,this.backgroundColor),this._lines.bind(R,I,F,this);for(var ut=0;ut<3;++ut){var it=[0,0,0];ct[ut]>0?it[ut]=j[1][ut]:it[ut]=j[0][ut];for(var nt=0;nt<2;++nt){var dt=(ut+1+nt)%3,Tt=(ut+1+(nt^1))%3;this.gridEnable[dt]&&this._lines.drawGrid(dt,Tt,this.bounds,it,this.gridColor[dt],this.gridWidth[dt]*this.pixelRatio)}for(var nt=0;nt<2;++nt){var dt=(ut+1+nt)%3,Tt=(ut+1+(nt^1))%3;this.zeroEnable[Tt]&&Math.min(j[0][Tt],j[1][Tt])<=0&&Math.max(j[0][Tt],j[1][Tt])>=0&&this._lines.drawZero(dt,Tt,this.bounds,it,this.zeroLineColor[Tt],this.zeroLineWidth[Tt]*this.pixelRatio)}}for(var ut=0;ut<3;++ut){this.lineEnable[ut]&&this._lines.drawAxisLine(ut,this.bounds,J[ut].primalOffset,this.lineColor[ut],this.lineWidth[ut]*this.pixelRatio),this.lineMirror[ut]&&this._lines.drawAxisLine(ut,this.bounds,J[ut].mirrorOffset,this.lineColor[ut],this.lineWidth[ut]*this.pixelRatio);for(var wt=l(b,J[ut].primalMinor),Ct=l(_,J[ut].mirrorMinor),It=this.lineTickLength,nt=0;nt<3;++nt){var Nt=Q/R[5*nt];wt[nt]*=It[nt]*Nt,Ct[nt]*=It[nt]*Nt}this.lineTickEnable[ut]&&this._lines.drawAxisTicks(ut,J[ut].primalOffset,wt,this.lineTickColor[ut],this.lineTickWidth[ut]*this.pixelRatio),this.lineTickMirror[ut]&&this._lines.drawAxisTicks(ut,J[ut].mirrorOffset,Ct,this.lineTickColor[ut],this.lineTickWidth[ut]*this.pixelRatio)}this._lines.unbind(),this._text.bind(R,I,F,this.pixelRatio);var te,Jt=.5,ee,Zt;function mt(ue){Zt=[0,0,0],Zt[ue]=1}function bt(ue,Me,Ce){var We=(ue+1)%3,qe=(ue+2)%3,vr=Me[We],_r=Me[qe],er=Ce[We],Mr=Ce[qe];if(vr>0&&Mr>0){mt(We);return}else if(vr>0&&Mr<0){mt(We);return}else if(vr<0&&Mr>0){mt(We);return}else if(vr<0&&Mr<0){mt(We);return}else if(_r>0&&er>0){mt(qe);return}else if(_r>0&&er<0){mt(qe);return}else if(_r<0&&er>0){mt(qe);return}else if(_r<0&&er<0){mt(qe);return}}for(var ut=0;ut<3;++ut){for(var vt=J[ut].primalMinor,Ut=J[ut].mirrorMinor,re=l(P,J[ut].primalOffset),nt=0;nt<3;++nt)this.lineTickEnable[ut]&&(re[nt]+=Q*vt[nt]*Math.max(this.lineTickLength[nt],0)/R[5*nt]);var Kt=[0,0,0];if(Kt[ut]=1,this.tickEnable[ut]){this.tickAngle[ut]===-3600?(this.tickAngle[ut]=0,this.tickAlign[ut]="auto"):this.tickAlign[ut]=-1,ee=1,te=[this.tickAlign[ut],Jt,ee],te[0]==="auto"?te[0]=h:te[0]=parseInt(""+te[0]),Zt=[0,0,0],bt(ut,vt,Ut);for(var nt=0;nt<3;++nt)re[nt]+=Q*vt[nt]*this.tickPad[nt]/R[5*nt];this._text.drawTicks(ut,this.tickSize[ut],this.tickAngle[ut],re,this.tickColor[ut],Kt,Zt,te)}if(this.labelEnable[ut]){ee=0,Zt=[0,0,0],this.labels[ut].length>4&&(mt(ut),ee=1),te=[this.labelAlign[ut],Jt,ee],te[0]==="auto"?te[0]=h:te[0]=parseInt(""+te[0]);for(var nt=0;nt<3;++nt)re[nt]+=Q*vt[nt]*this.labelPad[nt]/R[5*nt];re[ut]+=.5*(j[0][ut]+j[1][ut]),this._text.drawLabel(ut,this.labelSize[ut],this.labelAngle[ut],re,this.labelColor[ut],[0,0,0],Zt,te)}}this._text.unbind()},y.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null};function z(D,B){var R=new x(D);return R.update(B),R}},3840:function(t){t.exports=k;var e=0,r=1;function i(M,T,c,h,b,_){this._color=M,this.key=T,this.value=c,this.left=h,this.right=b,this._count=_}function n(M){return new i(M._color,M.key,M.value,M.left,M.right,M._count)}function o(M,T){return new i(M,T.key,T.value,T.left,T.right,T._count)}function a(M){M._count=1+(M.left?M.left._count:0)+(M.right?M.right._count:0)}function s(M,T){this._compare=M,this.root=T}var f=s.prototype;Object.defineProperty(f,"keys",{get:function(){var M=[];return this.forEach(function(T,c){M.push(T)}),M}}),Object.defineProperty(f,"values",{get:function(){var M=[];return this.forEach(function(T,c){M.push(c)}),M}}),Object.defineProperty(f,"length",{get:function(){return this.root?this.root._count:0}}),f.insert=function(M,T){for(var c=this._compare,h=this.root,b=[],_=[];h;){var P=c(M,h.key);b.push(h),_.push(P),P<=0?h=h.left:h=h.right}b.push(new i(e,M,T,null,null,1));for(var z=b.length-2;z>=0;--z){var h=b[z];_[z]<=0?b[z]=new i(h._color,h.key,h.value,b[z+1],h.right,h._count+1):b[z]=new i(h._color,h.key,h.value,h.left,b[z+1],h._count+1)}for(var z=b.length-1;z>1;--z){var D=b[z-1],h=b[z];if(D._color===r||h._color===r)break;var B=b[z-2];if(B.left===D)if(D.left===h){var R=B.right;if(R&&R._color===e)D._color=r,B.right=o(r,R),B._color=e,z-=1;else{if(B._color=e,B.left=D.right,D._color=r,D.right=B,b[z-2]=D,b[z-1]=h,a(B),a(D),z>=3){var I=b[z-3];I.left===B?I.left=D:I.right=D}break}}else{var R=B.right;if(R&&R._color===e)D._color=r,B.right=o(r,R),B._color=e,z-=1;else{if(D.right=h.left,B._color=e,B.left=h.right,h._color=r,h.left=D,h.right=B,b[z-2]=h,b[z-1]=D,a(B),a(D),a(h),z>=3){var I=b[z-3];I.left===B?I.left=h:I.right=h}break}}else if(D.right===h){var R=B.left;if(R&&R._color===e)D._color=r,B.left=o(r,R),B._color=e,z-=1;else{if(B._color=e,B.right=D.left,D._color=r,D.left=B,b[z-2]=D,b[z-1]=h,a(B),a(D),z>=3){var I=b[z-3];I.right===B?I.right=D:I.left=D}break}}else{var R=B.left;if(R&&R._color===e)D._color=r,B.left=o(r,R),B._color=e,z-=1;else{if(D.left=h.right,B._color=e,B.right=h.left,h._color=r,h.right=D,h.left=B,b[z-2]=h,b[z-1]=D,a(B),a(D),a(h),z>=3){var I=b[z-3];I.right===B?I.right=h:I.left=h}break}}}return b[0]._color=r,new s(c,b[0])};function v(M,T){if(T.left){var c=v(M,T.left);if(c)return c}var c=M(T.key,T.value);if(c)return c;if(T.right)return v(M,T.right)}function g(M,T,c,h){var b=T(M,h.key);if(b<=0){if(h.left){var _=g(M,T,c,h.left);if(_)return _}var _=c(h.key,h.value);if(_)return _}if(h.right)return g(M,T,c,h.right)}function m(M,T,c,h,b){var _=c(M,b.key),P=c(T,b.key),z;if(_<=0&&(b.left&&(z=m(M,T,c,h,b.left),z)||P>0&&(z=h(b.key,b.value),z)))return z;if(P>0&&b.right)return m(M,T,c,h,b.right)}f.forEach=function(M,T,c){if(this.root)switch(arguments.length){case 1:return v(M,this.root);case 2:return g(T,this._compare,M,this.root);case 3:return this._compare(T,c)>=0?void 0:m(T,c,this._compare,M,this.root)}},Object.defineProperty(f,"begin",{get:function(){for(var M=[],T=this.root;T;)M.push(T),T=T.left;return new w(this,M)}}),Object.defineProperty(f,"end",{get:function(){for(var M=[],T=this.root;T;)M.push(T),T=T.right;return new w(this,M)}}),f.at=function(M){if(M<0)return new w(this,[]);for(var T=this.root,c=[];;){if(c.push(T),T.left){if(M=T.right._count)break;T=T.right}else break}return new w(this,[])},f.ge=function(M){for(var T=this._compare,c=this.root,h=[],b=0;c;){var _=T(M,c.key);h.push(c),_<=0&&(b=h.length),_<=0?c=c.left:c=c.right}return h.length=b,new w(this,h)},f.gt=function(M){for(var T=this._compare,c=this.root,h=[],b=0;c;){var _=T(M,c.key);h.push(c),_<0&&(b=h.length),_<0?c=c.left:c=c.right}return h.length=b,new w(this,h)},f.lt=function(M){for(var T=this._compare,c=this.root,h=[],b=0;c;){var _=T(M,c.key);h.push(c),_>0&&(b=h.length),_<=0?c=c.left:c=c.right}return h.length=b,new w(this,h)},f.le=function(M){for(var T=this._compare,c=this.root,h=[],b=0;c;){var _=T(M,c.key);h.push(c),_>=0&&(b=h.length),_<0?c=c.left:c=c.right}return h.length=b,new w(this,h)},f.find=function(M){for(var T=this._compare,c=this.root,h=[];c;){var b=T(M,c.key);if(h.push(c),b===0)return new w(this,h);b<=0?c=c.left:c=c.right}return new w(this,[])},f.remove=function(M){var T=this.find(M);return T?T.remove():this},f.get=function(M){for(var T=this._compare,c=this.root;c;){var h=T(M,c.key);if(h===0)return c.value;h<=0?c=c.left:c=c.right}};function w(M,T){this.tree=M,this._stack=T}var l=w.prototype;Object.defineProperty(l,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(l,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),l.clone=function(){return new w(this.tree,this._stack.slice())};function x(M,T){M.key=T.key,M.value=T.value,M.left=T.left,M.right=T.right,M._color=T._color,M._count=T._count}function y(M){for(var T,c,h,b,_=M.length-1;_>=0;--_){if(T=M[_],_===0){T._color=r;return}if(c=M[_-1],c.left===T){if(h=c.right,h.right&&h.right._color===e){if(h=c.right=n(h),b=h.right=n(h.right),c.right=h.left,h.left=c,h.right=b,h._color=c._color,T._color=r,c._color=r,b._color=r,a(c),a(h),_>1){var P=M[_-2];P.left===c?P.left=h:P.right=h}M[_-1]=h;return}else if(h.left&&h.left._color===e){if(h=c.right=n(h),b=h.left=n(h.left),c.right=b.left,h.left=b.right,b.left=c,b.right=h,b._color=c._color,c._color=r,h._color=r,T._color=r,a(c),a(h),a(b),_>1){var P=M[_-2];P.left===c?P.left=b:P.right=b}M[_-1]=b;return}if(h._color===r)if(c._color===e){c._color=r,c.right=o(e,h);return}else{c.right=o(e,h);continue}else{if(h=n(h),c.right=h.left,h.left=c,h._color=c._color,c._color=e,a(c),a(h),_>1){var P=M[_-2];P.left===c?P.left=h:P.right=h}M[_-1]=h,M[_]=c,_+11){var P=M[_-2];P.right===c?P.right=h:P.left=h}M[_-1]=h;return}else if(h.right&&h.right._color===e){if(h=c.left=n(h),b=h.right=n(h.right),c.left=b.right,h.right=b.left,b.right=c,b.left=h,b._color=c._color,c._color=r,h._color=r,T._color=r,a(c),a(h),a(b),_>1){var P=M[_-2];P.right===c?P.right=b:P.left=b}M[_-1]=b;return}if(h._color===r)if(c._color===e){c._color=r,c.left=o(e,h);return}else{c.left=o(e,h);continue}else{if(h=n(h),c.left=h.right,h.right=c,h._color=c._color,c._color=e,a(c),a(h),_>1){var P=M[_-2];P.right===c?P.right=h:P.left=h}M[_-1]=h,M[_]=c,_+1=0;--h){var c=M[h];c.left===M[h+1]?T[h]=new i(c._color,c.key,c.value,T[h+1],c.right,c._count):T[h]=new i(c._color,c.key,c.value,c.left,T[h+1],c._count)}if(c=T[T.length-1],c.left&&c.right){var b=T.length;for(c=c.left;c.right;)T.push(c),c=c.right;var _=T[b-1];T.push(new i(c._color,_.key,_.value,c.left,c.right,c._count)),T[b-1].key=c.key,T[b-1].value=c.value;for(var h=T.length-2;h>=b;--h)c=T[h],T[h]=new i(c._color,c.key,c.value,c.left,T[h+1],c._count);T[b-1].left=T[b]}if(c=T[T.length-1],c._color===e){var P=T[T.length-2];P.left===c?P.left=null:P.right===c&&(P.right=null),T.pop();for(var h=0;h0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(l,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(l,"index",{get:function(){var M=0,T=this._stack;if(T.length===0){var c=this.tree.root;return c?c._count:0}else T[T.length-1].left&&(M=T[T.length-1].left._count);for(var h=T.length-2;h>=0;--h)T[h+1]===T[h].right&&(++M,T[h].left&&(M+=T[h].left._count));return M},enumerable:!0}),l.next=function(){var M=this._stack;if(M.length!==0){var T=M[M.length-1];if(T.right)for(T=T.right;T;)M.push(T),T=T.left;else for(M.pop();M.length>0&&M[M.length-1].right===T;)T=M[M.length-1],M.pop()}},Object.defineProperty(l,"hasNext",{get:function(){var M=this._stack;if(M.length===0)return!1;if(M[M.length-1].right)return!0;for(var T=M.length-1;T>0;--T)if(M[T-1].left===M[T])return!0;return!1}}),l.update=function(M){var T=this._stack;if(T.length===0)throw new Error("Can't update empty node!");var c=new Array(T.length),h=T[T.length-1];c[c.length-1]=new i(h._color,h.key,M,h.left,h.right,h._count);for(var b=T.length-2;b>=0;--b)h=T[b],h.left===T[b+1]?c[b]=new i(h._color,h.key,h.value,c[b+1],h.right,h._count):c[b]=new i(h._color,h.key,h.value,h.left,c[b+1],h._count);return new s(this.tree._compare,c[0])},l.prev=function(){var M=this._stack;if(M.length!==0){var T=M[M.length-1];if(T.left)for(T=T.left;T;)M.push(T),T=T.right;else for(M.pop();M.length>0&&M[M.length-1].left===T;)T=M[M.length-1],M.pop()}},Object.defineProperty(l,"hasPrev",{get:function(){var M=this._stack;if(M.length===0)return!1;if(M[M.length-1].left)return!0;for(var T=M.length-1;T>0;--T)if(M[T-1].right===M[T])return!0;return!1}});function S(M,T){return MT?1:0}function k(M){return new s(M||S,null)}},3865:function(t,e,r){var i=r(869);t.exports=n;function n(o,a){return i(o[0].mul(a[1]).add(a[0].mul(o[1])),o[1].mul(a[1]))}},3952:function(t,e,r){t.exports=o;var i=r(3250);function n(a,s){for(var f=new Array(s+1),v=0;v20?52:f+32}},4040:function(t){t.exports=e;function e(r,i,n,o,a,s,f){var v=1/(i-n),g=1/(o-a),m=1/(s-f);return r[0]=-2*v,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*g,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*m,r[11]=0,r[12]=(i+n)*v,r[13]=(a+o)*g,r[14]=(f+s)*m,r[15]=1,r}},4041:function(t){t.exports=e;function e(r,i,n){var o=i[0],a=i[1],s=i[2],f=n[0],v=n[1],g=n[2],m=n[3],w=m*o+v*s-g*a,l=m*a+g*o-f*s,x=m*s+f*a-v*o,y=-f*o-v*a-g*s;return r[0]=w*m+y*-f+l*-g-x*-v,r[1]=l*m+y*-v+x*-f-w*-g,r[2]=x*m+y*-g+w*-v-l*-f,r[3]=i[3],r}},4081:function(t){t.exports=e;function e(r,i,n,o,a,s,f,v,g,m){var w=i+s+m;if(l>0){var l=Math.sqrt(w+1);r[0]=.5*(f-g)/l,r[1]=.5*(v-o)/l,r[2]=.5*(n-s)/l,r[3]=.5*l}else{var x=Math.max(i,s,m),l=Math.sqrt(2*x-w+1);i>=x?(r[0]=.5*l,r[1]=.5*(a+n)/l,r[2]=.5*(v+o)/l,r[3]=.5*(f-g)/l):s>=x?(r[0]=.5*(n+a)/l,r[1]=.5*l,r[2]=.5*(g+f)/l,r[3]=.5*(v-o)/l):(r[0]=.5*(o+v)/l,r[1]=.5*(f+g)/l,r[2]=.5*l,r[3]=.5*(n-a)/l)}return r}},4100:function(t,e,r){var i=r(4437),n=r(3837),o=r(5445),a=r(4449),s=r(3589),f=r(2260),v=r(7169),g=r(351),m=r(4772),w=r(4040),l=r(799),x=r(9216)({tablet:!0,featureDetect:!0});t.exports={createScene:T,createCamera:i};function y(){this.mouse=[-1,-1],this.screen=null,this.distance=1/0,this.index=null,this.dataCoordinate=null,this.dataPosition=null,this.object=null,this.data=null}function S(h,b){var _=null;try{_=h.getContext("webgl",b),_||(_=h.getContext("experimental-webgl",b))}catch{return null}return _}function k(h){var b=Math.round(Math.log(Math.abs(h))/Math.log(10));if(b<0){var _=Math.round(Math.pow(10,-b));return Math.ceil(h*_)/_}else if(b>0){var _=Math.round(Math.pow(10,b));return Math.ceil(h/_)*_}return Math.ceil(h)}function M(h){return typeof h=="boolean"?h:!0}function T(h){h=h||{},h.camera=h.camera||{};var b=h.canvas;if(!b)if(b=document.createElement("canvas"),h.container){var _=h.container;_.appendChild(b)}else document.body.appendChild(b);var P=h.gl;if(P||(h.glOptions&&(x=!!h.glOptions.preserveDrawingBuffer),P=S(b,h.glOptions||{premultipliedAlpha:!0,antialias:!0,preserveDrawingBuffer:x})),!P)throw new Error("webgl not supported");var z=h.bounds||[[-10,-10,-10],[10,10,10]],D=new y,B=f(P,P.drawingBufferWidth,P.drawingBufferHeight,{preferFloat:!x}),R=l(P),I=h.cameraObject&&h.cameraObject._ortho===!0||h.camera.projection&&h.camera.projection.type==="orthographic"||!1,F={eye:h.camera.eye||[2,0,0],center:h.camera.center||[0,0,0],up:h.camera.up||[0,1,0],zoomMin:h.camera.zoomMax||.1,zoomMax:h.camera.zoomMin||100,mode:h.camera.mode||"turntable",_ortho:I},j=h.axes||{},N=n(P,j);N.enable=!j.disable;var G=h.spikes||{},rt=a(P,G),ct=[],st=[],et=[],Z=[],ot=!0,J=!0,X=new Array(16),Q=new Array(16),ut={view:null,projection:X,model:Q,_ortho:!1},J=!0,q=[P.drawingBufferWidth,P.drawingBufferHeight],it=h.cameraObject||i(b,F),nt={gl:P,contextLost:!1,pixelRatio:h.pixelRatio||1,canvas:b,selection:D,camera:it,axes:N,axesPixels:null,spikes:rt,bounds:z,objects:ct,shape:q,aspect:h.aspectRatio||[1,1,1],pickRadius:h.pickRadius||10,zNear:h.zNear||.01,zFar:h.zFar||1e3,fovy:h.fovy||Math.PI/4,clearColor:h.clearColor||[0,0,0,0],autoResize:M(h.autoResize),autoBounds:M(h.autoBounds),autoScale:!!h.autoScale,autoCenter:M(h.autoCenter),clipToBounds:M(h.clipToBounds),snapToData:!!h.snapToData,onselect:h.onselect||null,onrender:h.onrender||null,onclick:h.onclick||null,cameraParams:ut,oncontextloss:null,mouseListener:null,_stopped:!1,getAspectratio:function(){return{x:this.aspect[0],y:this.aspect[1],z:this.aspect[2]}},setAspectratio:function(Zt){this.aspect[0]=Zt.x,this.aspect[1]=Zt.y,this.aspect[2]=Zt.z,J=!0},setBounds:function(Zt,mt){this.bounds[0][Zt]=mt.min,this.bounds[1][Zt]=mt.max},setClearColor:function(Zt){this.clearColor=Zt},clearRGBA:function(){this.gl.clearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}},dt=[P.drawingBufferWidth/nt.pixelRatio|0,P.drawingBufferHeight/nt.pixelRatio|0];function Tt(){if(!nt._stopped&&nt.autoResize){var Zt=b.parentNode,mt=1,bt=1;Zt&&Zt!==document.body?(mt=Zt.clientWidth,bt=Zt.clientHeight):(mt=window.innerWidth,bt=window.innerHeight);var vt=Math.ceil(mt*nt.pixelRatio)|0,Ut=Math.ceil(bt*nt.pixelRatio)|0;if(vt!==b.width||Ut!==b.height){b.width=vt,b.height=Ut;var re=b.style;re.position=re.position||"absolute",re.left="0px",re.top="0px",re.width=mt+"px",re.height=bt+"px",ot=!0}}}nt.autoResize&&Tt(),window.addEventListener("resize",Tt);function wt(){for(var Zt=ct.length,mt=Z.length,bt=0;bt0&&et[mt-1]===0;)et.pop(),Z.pop().dispose()}nt.update=function(Zt){nt._stopped||(ot=!0,J=!0)},nt.add=function(Zt){nt._stopped||(Zt.axes=N,ct.push(Zt),st.push(-1),ot=!0,J=!0,wt())},nt.remove=function(Zt){if(!nt._stopped){var mt=ct.indexOf(Zt);mt<0||(ct.splice(mt,1),st.pop(),ot=!0,J=!0,wt())}},nt.dispose=function(){if(!nt._stopped&&(nt._stopped=!0,window.removeEventListener("resize",Tt),b.removeEventListener("webglcontextlost",Ct),nt.mouseListener.enabled=!1,!nt.contextLost)){N.dispose(),rt.dispose();for(var Zt=0;ZtD.distance)continue;for(var Ce=0;Cem;){var c=l[T-2],h=l[T-1];if(cl[w+1]:!0}function v(m,w,l,x){m*=2;var y=x[m];return y>1,M=k-x,T=k+x,c=y,h=M,b=k,_=T,P=S,z=m+1,D=w-1,B=0;f(c,h,l)&&(B=c,c=h,h=B),f(_,P,l)&&(B=_,_=P,P=B),f(c,b,l)&&(B=c,c=b,b=B),f(h,b,l)&&(B=h,h=b,b=B),f(c,_,l)&&(B=c,c=_,_=B),f(b,_,l)&&(B=b,b=_,_=B),f(h,P,l)&&(B=h,h=P,P=B),f(h,b,l)&&(B=h,h=b,b=B),f(_,P,l)&&(B=_,_=P,P=B);for(var R=l[2*h],I=l[2*h+1],F=l[2*_],j=l[2*_+1],N=2*c,G=2*b,rt=2*P,ct=2*y,st=2*k,et=2*S,Z=0;Z<2;++Z){var ot=l[N+Z],X=l[G+Z],Q=l[rt+Z];l[ct+Z]=ot,l[st+Z]=X,l[et+Z]=Q}o(M,m,l),o(T,w,l);for(var ut=z;ut<=D;++ut)if(v(ut,R,I,l))ut!==z&&n(ut,z,l),++z;else if(!v(ut,F,j,l))for(;;)if(v(D,F,j,l)){v(D,R,I,l)?(a(ut,z,D,l),++z,--D):(n(ut,D,l),--D);break}else{if(--D0)if(y[0]!==k[1][0])S=x,x=x.right;else{var h=g(x.right,y);if(h)return h;x=x.left}else{if(y[0]!==k[1][0])return x;var h=g(x.right,y);if(h)return h;x=x.left}}return S}f.castUp=function(x){var y=i.le(this.coordinates,x[0]);if(y<0)return-1;this.slabs[y];var S=g(this.slabs[y],x),k=-1;if(S&&(k=S.value),this.coordinates[y]===x[0]){var M=null;if(S&&(M=S.key),y>0){var T=g(this.slabs[y-1],x);T&&(M?a(T.key,M)>0&&(M=T.key,k=T.value):(k=T.value,M=T.key))}var c=this.horizontal[y];if(c.length>0){var h=i.ge(c,x[1],v);if(h=c.length)return k;b=c[h]}}if(b.start)if(M){var _=o(M[0],M[1],[x[0],b.y]);M[0][0]>M[1][0]&&(_=-_),_>0&&(k=b.index)}else k=b.index;else b.y!==x[1]&&(k=b.index)}}}return k};function m(x,y,S,k){this.y=x,this.index=y,this.start=S,this.closed=k}function w(x,y,S,k){this.x=x,this.segment=y,this.create=S,this.index=k}function l(x){for(var y=x.length,S=2*y,k=new Array(S),M=0;MMath.abs(h))l.rotate(P,0,0,-c*b*Math.PI*M.rotateSpeed/window.innerWidth);else if(!M._ortho){var z=-M.zoomSpeed*_*h/window.innerHeight*(P-l.lastT())/20;l.pan(P,0,0,y*(Math.exp(z)-1))}}},!0)},M.enableMouseListeners(),M}},4449:function(t,e,r){var i=r(2762),n=r(8116),o=r(1493);t.exports=w;var a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function s(l,x,y,S){this.gl=l,this.buffer=x,this.vao=y,this.shader=S,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}var f=s.prototype,v=[0,0,0],g=[0,0,0],m=[0,0];f.isTransparent=function(){return!1},f.drawTransparent=function(l){},f.draw=function(l){var x=this.gl,y=this.vao,S=this.shader;y.bind(),S.bind();var k=l.model||a,M=l.view||a,T=l.projection||a,c;this.axes&&(c=this.axes.lastCubeProps.axis);for(var h=v,b=g,_=0;_<3;++_)c&&c[_]<0?(h[_]=this.bounds[0][_],b[_]=this.bounds[1][_]):(h[_]=this.bounds[1][_],b[_]=this.bounds[0][_]);m[0]=x.drawingBufferWidth,m[1]=x.drawingBufferHeight,S.uniforms.model=k,S.uniforms.view=M,S.uniforms.projection=T,S.uniforms.coordinates=[this.position,h,b],S.uniforms.colors=this.colors,S.uniforms.screenShape=m;for(var _=0;_<3;++_)S.uniforms.lineWidth=this.lineWidth[_]*this.pixelRatio,this.enabled[_]&&(y.draw(x.TRIANGLES,6,6*_),this.drawSides[_]&&y.draw(x.TRIANGLES,12,18+12*_));y.unbind()},f.update=function(l){l&&("bounds"in l&&(this.bounds=l.bounds),"position"in l&&(this.position=l.position),"lineWidth"in l&&(this.lineWidth=l.lineWidth),"colors"in l&&(this.colors=l.colors),"enabled"in l&&(this.enabled=l.enabled),"drawSides"in l&&(this.drawSides=l.drawSides))},f.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()};function w(l,x){var y=[];function S(h,b,_,P,z,D){var B=[h,b,_,0,0,0,1];B[P+3]=1,B[P]=z,y.push.apply(y,B),B[6]=-1,y.push.apply(y,B),B[P]=D,y.push.apply(y,B),y.push.apply(y,B),B[6]=1,y.push.apply(y,B),B[P]=z,y.push.apply(y,B)}S(0,0,0,0,0,1),S(0,0,0,1,0,1),S(0,0,0,2,0,1),S(1,0,0,1,-1,1),S(1,0,0,2,-1,1),S(0,1,0,0,-1,1),S(0,1,0,2,-1,1),S(0,0,1,0,-1,1),S(0,0,1,1,-1,1);var k=i(l,y),M=n(l,[{type:l.FLOAT,buffer:k,size:3,offset:0,stride:28},{type:l.FLOAT,buffer:k,size:3,offset:12,stride:28},{type:l.FLOAT,buffer:k,size:1,offset:24,stride:28}]),T=o(l);T.attributes.position.location=0,T.attributes.color.location=1,T.attributes.weight.location=2;var c=new s(l,k,M,T);return c.update(x),c}},4494:function(t){t.exports=e;function e(r,i){return r[0]=1/i[0],r[1]=1/i[1],r[2]=1/i[2],r[3]=1/i[3],r}},4505:function(t,e,r){t.exports=r(5847)},4578:function(t){t.exports=e;function e(r,i,n,o,a){return r[0]=i,r[1]=n,r[2]=o,r[3]=a,r}},4623:function(t){"use restrict";t.exports=e;function e(r){this.roots=new Array(r),this.ranks=new Array(r);for(var i=0;i0)return 1<=0)return 1<=0;--l)f[l]=v*i[l]+g*n[l]+m*o[l]+w*a[l];return f}return v*i+g*n+m*o[l]+w*a}function r(i,n,o,a,s,f){var v=s-1,g=s*s,m=v*v,w=(1+2*s)*m,l=s*m,x=g*(3-2*s),y=g*v;if(i.length){f||(f=new Array(i.length));for(var S=i.length-1;S>=0;--S)f[S]=w*i[S]+l*n[S]+x*o[S]+y*a[S];return f}return w*i+l*n+x*o+y*a}t.exports=r,t.exports.derivative=e},4772:function(t){t.exports=e;function e(r,i,n,o,a){var s=1/Math.tan(i/2),f=1/(o-a);return r[0]=s/n,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=s,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=(a+o)*f,r[11]=-1,r[12]=0,r[13]=0,r[14]=2*a*o*f,r[15]=0,r}},4793:function(t,e,r){function i(lt,yt){if(!(lt instanceof yt))throw new TypeError("Cannot call a class as a function")}function n(lt,yt){for(var St=0;StT)throw new RangeError('The value "'+lt+'" is invalid for option "size"');var yt=new Uint8Array(lt);return Object.setPrototypeOf(yt,b.prototype),yt}function b(lt,yt,St){if(typeof lt=="number"){if(typeof yt=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return D(lt)}return _(lt,yt,St)}b.poolSize=8192;function _(lt,yt,St){if(typeof lt=="string")return B(lt,yt);if(ArrayBuffer.isView(lt))return I(lt);if(lt==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+y(lt));if(Ir(lt,ArrayBuffer)||lt&&Ir(lt.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ir(lt,SharedArrayBuffer)||lt&&Ir(lt.buffer,SharedArrayBuffer)))return F(lt,yt,St);if(typeof lt=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var Ht=lt.valueOf&<.valueOf();if(Ht!=null&&Ht!==lt)return b.from(Ht,yt,St);var Yt=j(lt);if(Yt)return Yt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof lt[Symbol.toPrimitive]=="function")return b.from(lt[Symbol.toPrimitive]("string"),yt,St);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+y(lt))}b.from=function(lt,yt,St){return _(lt,yt,St)},Object.setPrototypeOf(b.prototype,Uint8Array.prototype),Object.setPrototypeOf(b,Uint8Array);function P(lt){if(typeof lt!="number")throw new TypeError('"size" argument must be of type number');if(lt<0)throw new RangeError('The value "'+lt+'" is invalid for option "size"')}function z(lt,yt,St){return P(lt),lt<=0?h(lt):yt!==void 0?typeof St=="string"?h(lt).fill(yt,St):h(lt).fill(yt):h(lt)}b.alloc=function(lt,yt,St){return z(lt,yt,St)};function D(lt){return P(lt),h(lt<0?0:N(lt)|0)}b.allocUnsafe=function(lt){return D(lt)},b.allocUnsafeSlow=function(lt){return D(lt)};function B(lt,yt){if((typeof yt!="string"||yt==="")&&(yt="utf8"),!b.isEncoding(yt))throw new TypeError("Unknown encoding: "+yt);var St=G(lt,yt)|0,Ht=h(St),Yt=Ht.write(lt,yt);return Yt!==St&&(Ht=Ht.slice(0,Yt)),Ht}function R(lt){for(var yt=lt.length<0?0:N(lt.length)|0,St=h(yt),Ht=0;Ht=T)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+T.toString(16)+" bytes");return lt|0}b.isBuffer=function(lt){return lt!=null&<._isBuffer===!0&<!==b.prototype},b.compare=function(lt,yt){if(Ir(lt,Uint8Array)&&(lt=b.from(lt,lt.offset,lt.byteLength)),Ir(yt,Uint8Array)&&(yt=b.from(yt,yt.offset,yt.byteLength)),!b.isBuffer(lt)||!b.isBuffer(yt))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(lt===yt)return 0;for(var St=lt.length,Ht=yt.length,Yt=0,se=Math.min(St,Ht);YtHt.length?(b.isBuffer(se)||(se=b.from(se)),se.copy(Ht,Yt)):Uint8Array.prototype.set.call(Ht,se,Yt);else if(b.isBuffer(se))se.copy(Ht,Yt);else throw new TypeError('"list" argument must be an Array of Buffers');Yt+=se.length}return Ht};function G(lt,yt){if(b.isBuffer(lt))return lt.length;if(ArrayBuffer.isView(lt)||Ir(lt,ArrayBuffer))return lt.byteLength;if(typeof lt!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+y(lt));var St=lt.length,Ht=arguments.length>2&&arguments[2]===!0;if(!Ht&&St===0)return 0;for(var Yt=!1;;)switch(yt){case"ascii":case"latin1":case"binary":return St;case"utf8":case"utf-8":return qe(lt).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return St*2;case"hex":return St>>>1;case"base64":return er(lt).length;default:if(Yt)return Ht?-1:qe(lt).length;yt=(""+yt).toLowerCase(),Yt=!0}}b.byteLength=G;function rt(lt,yt,St){var Ht=!1;if((yt===void 0||yt<0)&&(yt=0),yt>this.length||((St===void 0||St>this.length)&&(St=this.length),St<=0)||(St>>>=0,yt>>>=0,St<=yt))return"";for(lt||(lt="utf8");;)switch(lt){case"hex":return wt(this,yt,St);case"utf8":case"utf-8":return q(this,yt,St);case"ascii":return dt(this,yt,St);case"latin1":case"binary":return Tt(this,yt,St);case"base64":return J(this,yt,St);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ct(this,yt,St);default:if(Ht)throw new TypeError("Unknown encoding: "+lt);lt=(lt+"").toLowerCase(),Ht=!0}}b.prototype._isBuffer=!0;function ct(lt,yt,St){var Ht=lt[yt];lt[yt]=lt[St],lt[St]=Ht}b.prototype.swap16=function(){var lt=this.length;if(lt%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var yt=0;ytyt&&(lt+=" ... "),""},M&&(b.prototype[M]=b.prototype.inspect),b.prototype.compare=function(lt,yt,St,Ht,Yt){if(Ir(lt,Uint8Array)&&(lt=b.from(lt,lt.offset,lt.byteLength)),!b.isBuffer(lt))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+y(lt));if(yt===void 0&&(yt=0),St===void 0&&(St=lt?lt.length:0),Ht===void 0&&(Ht=0),Yt===void 0&&(Yt=this.length),yt<0||St>lt.length||Ht<0||Yt>this.length)throw new RangeError("out of range index");if(Ht>=Yt&&yt>=St)return 0;if(Ht>=Yt)return-1;if(yt>=St)return 1;if(yt>>>=0,St>>>=0,Ht>>>=0,Yt>>>=0,this===lt)return 0;for(var se=Yt-Ht,ke=St-yt,Ee=Math.min(se,ke),Ue=this.slice(Ht,Yt),ir=lt.slice(yt,St),ar=0;ar2147483647?St=2147483647:St<-2147483648&&(St=-2147483648),St=+St,de(St)&&(St=Yt?0:lt.length-1),St<0&&(St=lt.length+St),St>=lt.length){if(Yt)return-1;St=lt.length-1}else if(St<0)if(Yt)St=0;else return-1;if(typeof yt=="string"&&(yt=b.from(yt,Ht)),b.isBuffer(yt))return yt.length===0?-1:et(lt,yt,St,Ht,Yt);if(typeof yt=="number")return yt=yt&255,typeof Uint8Array.prototype.indexOf=="function"?Yt?Uint8Array.prototype.indexOf.call(lt,yt,St):Uint8Array.prototype.lastIndexOf.call(lt,yt,St):et(lt,[yt],St,Ht,Yt);throw new TypeError("val must be string, number or Buffer")}function et(lt,yt,St,Ht,Yt){var se=1,ke=lt.length,Ee=yt.length;if(Ht!==void 0&&(Ht=String(Ht).toLowerCase(),Ht==="ucs2"||Ht==="ucs-2"||Ht==="utf16le"||Ht==="utf-16le")){if(lt.length<2||yt.length<2)return-1;se=2,ke/=2,Ee/=2,St/=2}function Ue(pn,dn){return se===1?pn[dn]:pn.readUInt16BE(dn*se)}var ir;if(Yt){var ar=-1;for(ir=St;irke&&(St=ke-Ee),ir=St;ir>=0;ir--){for(var Ye=!0,Er=0;ErYt&&(Ht=Yt)):Ht=Yt;var se=yt.length;Ht>se/2&&(Ht=se/2);var ke;for(ke=0;ke>>0,isFinite(St)?(St=St>>>0,Ht===void 0&&(Ht="utf8")):(Ht=St,St=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var Yt=this.length-yt;if((St===void 0||St>Yt)&&(St=Yt),lt.length>0&&(St<0||yt<0)||yt>this.length)throw new RangeError("Attempt to write outside buffer bounds");Ht||(Ht="utf8");for(var se=!1;;)switch(Ht){case"hex":return Z(this,lt,yt,St);case"utf8":case"utf-8":return ot(this,lt,yt,St);case"ascii":case"latin1":case"binary":return X(this,lt,yt,St);case"base64":return Q(this,lt,yt,St);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,lt,yt,St);default:if(se)throw new TypeError("Unknown encoding: "+Ht);Ht=(""+Ht).toLowerCase(),se=!0}},b.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function J(lt,yt,St){return yt===0&&St===lt.length?S.fromByteArray(lt):S.fromByteArray(lt.slice(yt,St))}function q(lt,yt,St){St=Math.min(lt.length,St);for(var Ht=[],Yt=yt;Yt239?4:se>223?3:se>191?2:1;if(Yt+Ee<=St){var Ue=void 0,ir=void 0,ar=void 0,Ye=void 0;switch(Ee){case 1:se<128&&(ke=se);break;case 2:Ue=lt[Yt+1],(Ue&192)===128&&(Ye=(se&31)<<6|Ue&63,Ye>127&&(ke=Ye));break;case 3:Ue=lt[Yt+1],ir=lt[Yt+2],(Ue&192)===128&&(ir&192)===128&&(Ye=(se&15)<<12|(Ue&63)<<6|ir&63,Ye>2047&&(Ye<55296||Ye>57343)&&(ke=Ye));break;case 4:Ue=lt[Yt+1],ir=lt[Yt+2],ar=lt[Yt+3],(Ue&192)===128&&(ir&192)===128&&(ar&192)===128&&(Ye=(se&15)<<18|(Ue&63)<<12|(ir&63)<<6|ar&63,Ye>65535&&Ye<1114112&&(ke=Ye))}}ke===null?(ke=65533,Ee=1):ke>65535&&(ke-=65536,Ht.push(ke>>>10&1023|55296),ke=56320|ke&1023),Ht.push(ke),Yt+=Ee}return nt(Ht)}var it=4096;function nt(lt){var yt=lt.length;if(yt<=it)return String.fromCharCode.apply(String,lt);for(var St="",Ht=0;HtHt)&&(St=Ht);for(var Yt="",se=yt;seSt&&(lt=St),yt<0?(yt+=St,yt<0&&(yt=0)):yt>St&&(yt=St),ytSt)throw new RangeError("Trying to access beyond buffer length")}b.prototype.readUintLE=b.prototype.readUIntLE=function(lt,yt,St){lt=lt>>>0,yt=yt>>>0,St||It(lt,yt,this.length);for(var Ht=this[lt],Yt=1,se=0;++se>>0,yt=yt>>>0,St||It(lt,yt,this.length);for(var Ht=this[lt+--yt],Yt=1;yt>0&&(Yt*=256);)Ht+=this[lt+--yt]*Yt;return Ht},b.prototype.readUint8=b.prototype.readUInt8=function(lt,yt){return lt=lt>>>0,yt||It(lt,1,this.length),this[lt]},b.prototype.readUint16LE=b.prototype.readUInt16LE=function(lt,yt){return lt=lt>>>0,yt||It(lt,2,this.length),this[lt]|this[lt+1]<<8},b.prototype.readUint16BE=b.prototype.readUInt16BE=function(lt,yt){return lt=lt>>>0,yt||It(lt,2,this.length),this[lt]<<8|this[lt+1]},b.prototype.readUint32LE=b.prototype.readUInt32LE=function(lt,yt){return lt=lt>>>0,yt||It(lt,4,this.length),(this[lt]|this[lt+1]<<8|this[lt+2]<<16)+this[lt+3]*16777216},b.prototype.readUint32BE=b.prototype.readUInt32BE=function(lt,yt){return lt=lt>>>0,yt||It(lt,4,this.length),this[lt]*16777216+(this[lt+1]<<16|this[lt+2]<<8|this[lt+3])},b.prototype.readBigUInt64LE=qt(function(lt){lt=lt>>>0,ue(lt,"offset");var yt=this[lt],St=this[lt+7];(yt===void 0||St===void 0)&&Me(lt,this.length-8);var Ht=yt+this[++lt]*Math.pow(2,8)+this[++lt]*Math.pow(2,16)+this[++lt]*Math.pow(2,24),Yt=this[++lt]+this[++lt]*Math.pow(2,8)+this[++lt]*Math.pow(2,16)+St*Math.pow(2,24);return BigInt(Ht)+(BigInt(Yt)<>>0,ue(lt,"offset");var yt=this[lt],St=this[lt+7];(yt===void 0||St===void 0)&&Me(lt,this.length-8);var Ht=yt*Math.pow(2,24)+this[++lt]*Math.pow(2,16)+this[++lt]*Math.pow(2,8)+this[++lt],Yt=this[++lt]*Math.pow(2,24)+this[++lt]*Math.pow(2,16)+this[++lt]*Math.pow(2,8)+St;return(BigInt(Ht)<>>0,yt=yt>>>0,St||It(lt,yt,this.length);for(var Ht=this[lt],Yt=1,se=0;++se=Yt&&(Ht-=Math.pow(2,8*yt)),Ht},b.prototype.readIntBE=function(lt,yt,St){lt=lt>>>0,yt=yt>>>0,St||It(lt,yt,this.length);for(var Ht=yt,Yt=1,se=this[lt+--Ht];Ht>0&&(Yt*=256);)se+=this[lt+--Ht]*Yt;return Yt*=128,se>=Yt&&(se-=Math.pow(2,8*yt)),se},b.prototype.readInt8=function(lt,yt){return lt=lt>>>0,yt||It(lt,1,this.length),this[lt]&128?(255-this[lt]+1)*-1:this[lt]},b.prototype.readInt16LE=function(lt,yt){lt=lt>>>0,yt||It(lt,2,this.length);var St=this[lt]|this[lt+1]<<8;return St&32768?St|4294901760:St},b.prototype.readInt16BE=function(lt,yt){lt=lt>>>0,yt||It(lt,2,this.length);var St=this[lt+1]|this[lt]<<8;return St&32768?St|4294901760:St},b.prototype.readInt32LE=function(lt,yt){return lt=lt>>>0,yt||It(lt,4,this.length),this[lt]|this[lt+1]<<8|this[lt+2]<<16|this[lt+3]<<24},b.prototype.readInt32BE=function(lt,yt){return lt=lt>>>0,yt||It(lt,4,this.length),this[lt]<<24|this[lt+1]<<16|this[lt+2]<<8|this[lt+3]},b.prototype.readBigInt64LE=qt(function(lt){lt=lt>>>0,ue(lt,"offset");var yt=this[lt],St=this[lt+7];(yt===void 0||St===void 0)&&Me(lt,this.length-8);var Ht=this[lt+4]+this[lt+5]*Math.pow(2,8)+this[lt+6]*Math.pow(2,16)+(St<<24);return(BigInt(Ht)<>>0,ue(lt,"offset");var yt=this[lt],St=this[lt+7];(yt===void 0||St===void 0)&&Me(lt,this.length-8);var Ht=(yt<<24)+this[++lt]*Math.pow(2,16)+this[++lt]*Math.pow(2,8)+this[++lt];return(BigInt(Ht)<>>0,yt||It(lt,4,this.length),k.read(this,lt,!0,23,4)},b.prototype.readFloatBE=function(lt,yt){return lt=lt>>>0,yt||It(lt,4,this.length),k.read(this,lt,!1,23,4)},b.prototype.readDoubleLE=function(lt,yt){return lt=lt>>>0,yt||It(lt,8,this.length),k.read(this,lt,!0,52,8)},b.prototype.readDoubleBE=function(lt,yt){return lt=lt>>>0,yt||It(lt,8,this.length),k.read(this,lt,!1,52,8)};function Nt(lt,yt,St,Ht,Yt,se){if(!b.isBuffer(lt))throw new TypeError('"buffer" argument must be a Buffer instance');if(yt>Yt||ytlt.length)throw new RangeError("Index out of range")}b.prototype.writeUintLE=b.prototype.writeUIntLE=function(lt,yt,St,Ht){if(lt=+lt,yt=yt>>>0,St=St>>>0,!Ht){var Yt=Math.pow(2,8*St)-1;Nt(this,lt,yt,St,Yt,0)}var se=1,ke=0;for(this[yt]=lt&255;++ke>>0,St=St>>>0,!Ht){var Yt=Math.pow(2,8*St)-1;Nt(this,lt,yt,St,Yt,0)}var se=St-1,ke=1;for(this[yt+se]=lt&255;--se>=0&&(ke*=256);)this[yt+se]=lt/ke&255;return yt+St},b.prototype.writeUint8=b.prototype.writeUInt8=function(lt,yt,St){return lt=+lt,yt=yt>>>0,St||Nt(this,lt,yt,1,255,0),this[yt]=lt&255,yt+1},b.prototype.writeUint16LE=b.prototype.writeUInt16LE=function(lt,yt,St){return lt=+lt,yt=yt>>>0,St||Nt(this,lt,yt,2,65535,0),this[yt]=lt&255,this[yt+1]=lt>>>8,yt+2},b.prototype.writeUint16BE=b.prototype.writeUInt16BE=function(lt,yt,St){return lt=+lt,yt=yt>>>0,St||Nt(this,lt,yt,2,65535,0),this[yt]=lt>>>8,this[yt+1]=lt&255,yt+2},b.prototype.writeUint32LE=b.prototype.writeUInt32LE=function(lt,yt,St){return lt=+lt,yt=yt>>>0,St||Nt(this,lt,yt,4,4294967295,0),this[yt+3]=lt>>>24,this[yt+2]=lt>>>16,this[yt+1]=lt>>>8,this[yt]=lt&255,yt+4},b.prototype.writeUint32BE=b.prototype.writeUInt32BE=function(lt,yt,St){return lt=+lt,yt=yt>>>0,St||Nt(this,lt,yt,4,4294967295,0),this[yt]=lt>>>24,this[yt+1]=lt>>>16,this[yt+2]=lt>>>8,this[yt+3]=lt&255,yt+4};function te(lt,yt,St,Ht,Yt){Kt(yt,Ht,Yt,lt,St,7);var se=Number(yt&BigInt(4294967295));lt[St++]=se,se=se>>8,lt[St++]=se,se=se>>8,lt[St++]=se,se=se>>8,lt[St++]=se;var ke=Number(yt>>BigInt(32)&BigInt(4294967295));return lt[St++]=ke,ke=ke>>8,lt[St++]=ke,ke=ke>>8,lt[St++]=ke,ke=ke>>8,lt[St++]=ke,St}function Jt(lt,yt,St,Ht,Yt){Kt(yt,Ht,Yt,lt,St,7);var se=Number(yt&BigInt(4294967295));lt[St+7]=se,se=se>>8,lt[St+6]=se,se=se>>8,lt[St+5]=se,se=se>>8,lt[St+4]=se;var ke=Number(yt>>BigInt(32)&BigInt(4294967295));return lt[St+3]=ke,ke=ke>>8,lt[St+2]=ke,ke=ke>>8,lt[St+1]=ke,ke=ke>>8,lt[St]=ke,St+8}b.prototype.writeBigUInt64LE=qt(function(lt){var yt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return te(this,lt,yt,BigInt(0),BigInt("0xffffffffffffffff"))}),b.prototype.writeBigUInt64BE=qt(function(lt){var yt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Jt(this,lt,yt,BigInt(0),BigInt("0xffffffffffffffff"))}),b.prototype.writeIntLE=function(lt,yt,St,Ht){if(lt=+lt,yt=yt>>>0,!Ht){var Yt=Math.pow(2,8*St-1);Nt(this,lt,yt,St,Yt-1,-Yt)}var se=0,ke=1,Ee=0;for(this[yt]=lt&255;++se>0)-Ee&255;return yt+St},b.prototype.writeIntBE=function(lt,yt,St,Ht){if(lt=+lt,yt=yt>>>0,!Ht){var Yt=Math.pow(2,8*St-1);Nt(this,lt,yt,St,Yt-1,-Yt)}var se=St-1,ke=1,Ee=0;for(this[yt+se]=lt&255;--se>=0&&(ke*=256);)lt<0&&Ee===0&&this[yt+se+1]!==0&&(Ee=1),this[yt+se]=(lt/ke>>0)-Ee&255;return yt+St},b.prototype.writeInt8=function(lt,yt,St){return lt=+lt,yt=yt>>>0,St||Nt(this,lt,yt,1,127,-128),lt<0&&(lt=255+lt+1),this[yt]=lt&255,yt+1},b.prototype.writeInt16LE=function(lt,yt,St){return lt=+lt,yt=yt>>>0,St||Nt(this,lt,yt,2,32767,-32768),this[yt]=lt&255,this[yt+1]=lt>>>8,yt+2},b.prototype.writeInt16BE=function(lt,yt,St){return lt=+lt,yt=yt>>>0,St||Nt(this,lt,yt,2,32767,-32768),this[yt]=lt>>>8,this[yt+1]=lt&255,yt+2},b.prototype.writeInt32LE=function(lt,yt,St){return lt=+lt,yt=yt>>>0,St||Nt(this,lt,yt,4,2147483647,-2147483648),this[yt]=lt&255,this[yt+1]=lt>>>8,this[yt+2]=lt>>>16,this[yt+3]=lt>>>24,yt+4},b.prototype.writeInt32BE=function(lt,yt,St){return lt=+lt,yt=yt>>>0,St||Nt(this,lt,yt,4,2147483647,-2147483648),lt<0&&(lt=4294967295+lt+1),this[yt]=lt>>>24,this[yt+1]=lt>>>16,this[yt+2]=lt>>>8,this[yt+3]=lt&255,yt+4},b.prototype.writeBigInt64LE=qt(function(lt){var yt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return te(this,lt,yt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),b.prototype.writeBigInt64BE=qt(function(lt){var yt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Jt(this,lt,yt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ee(lt,yt,St,Ht,Yt,se){if(St+Ht>lt.length)throw new RangeError("Index out of range");if(St<0)throw new RangeError("Index out of range")}function Zt(lt,yt,St,Ht,Yt){return yt=+yt,St=St>>>0,Yt||ee(lt,yt,St,4),k.write(lt,yt,St,Ht,23,4),St+4}b.prototype.writeFloatLE=function(lt,yt,St){return Zt(this,lt,yt,!0,St)},b.prototype.writeFloatBE=function(lt,yt,St){return Zt(this,lt,yt,!1,St)};function mt(lt,yt,St,Ht,Yt){return yt=+yt,St=St>>>0,Yt||ee(lt,yt,St,8),k.write(lt,yt,St,Ht,52,8),St+8}b.prototype.writeDoubleLE=function(lt,yt,St){return mt(this,lt,yt,!0,St)},b.prototype.writeDoubleBE=function(lt,yt,St){return mt(this,lt,yt,!1,St)},b.prototype.copy=function(lt,yt,St,Ht){if(!b.isBuffer(lt))throw new TypeError("argument should be a Buffer");if(St||(St=0),!Ht&&Ht!==0&&(Ht=this.length),yt>=lt.length&&(yt=lt.length),yt||(yt=0),Ht>0&&Ht=this.length)throw new RangeError("Index out of range");if(Ht<0)throw new RangeError("sourceEnd out of bounds");Ht>this.length&&(Ht=this.length),lt.length-yt>>0,St=St===void 0?this.length:St>>>0,lt||(lt=0);var se;if(typeof lt=="number")for(se=yt;seMath.pow(2,32)?Yt=Ut(String(St)):typeof St=="bigint"&&(Yt=String(St),(St>Math.pow(BigInt(2),BigInt(32))||St<-Math.pow(BigInt(2),BigInt(32)))&&(Yt=Ut(Yt)),Yt+="n"),Ht+=" It must be ".concat(yt,". Received ").concat(Yt),Ht},RangeError);function Ut(lt){for(var yt="",St=lt.length,Ht=lt[0]==="-"?1:0;St>=Ht+4;St-=3)yt="_".concat(lt.slice(St-3,St)).concat(yt);return"".concat(lt.slice(0,St)).concat(yt)}function re(lt,yt,St){ue(yt,"offset"),(lt[yt]===void 0||lt[yt+St]===void 0)&&Me(yt,lt.length-(St+1))}function Kt(lt,yt,St,Ht,Yt,se){if(lt>St||lt= 0".concat(ke," and < 2").concat(ke," ** ").concat((se+1)*8).concat(ke):Ee=">= -(2".concat(ke," ** ").concat((se+1)*8-1).concat(ke,") and < 2 ** ")+"".concat((se+1)*8-1).concat(ke),new bt.ERR_OUT_OF_RANGE("value",Ee,lt)}re(Ht,Yt,se)}function ue(lt,yt){if(typeof lt!="number")throw new bt.ERR_INVALID_ARG_TYPE(yt,"number",lt)}function Me(lt,yt,St){throw Math.floor(lt)!==lt?(ue(lt,St),new bt.ERR_OUT_OF_RANGE("offset","an integer",lt)):yt<0?new bt.ERR_BUFFER_OUT_OF_BOUNDS:new bt.ERR_OUT_OF_RANGE("offset",">= ".concat(0," and <= ").concat(yt),lt)}var Ce=/[^+/0-9A-Za-z-_]/g;function We(lt){if(lt=lt.split("=")[0],lt=lt.trim().replace(Ce,""),lt.length<2)return"";for(;lt.length%4!==0;)lt=lt+"=";return lt}function qe(lt,yt){yt=yt||1/0;for(var St,Ht=lt.length,Yt=null,se=[],ke=0;ke55295&&St<57344){if(!Yt){if(St>56319){(yt-=3)>-1&&se.push(239,191,189);continue}else if(ke+1===Ht){(yt-=3)>-1&&se.push(239,191,189);continue}Yt=St;continue}if(St<56320){(yt-=3)>-1&&se.push(239,191,189),Yt=St;continue}St=(Yt-55296<<10|St-56320)+65536}else Yt&&(yt-=3)>-1&&se.push(239,191,189);if(Yt=null,St<128){if((yt-=1)<0)break;se.push(St)}else if(St<2048){if((yt-=2)<0)break;se.push(St>>6|192,St&63|128)}else if(St<65536){if((yt-=3)<0)break;se.push(St>>12|224,St>>6&63|128,St&63|128)}else if(St<1114112){if((yt-=4)<0)break;se.push(St>>18|240,St>>12&63|128,St>>6&63|128,St&63|128)}else throw new Error("Invalid code point")}return se}function vr(lt){for(var yt=[],St=0;St>8,Yt=St%256,se.push(Yt),se.push(Ht);return se}function er(lt){return S.toByteArray(We(lt))}function Mr(lt,yt,St,Ht){var Yt;for(Yt=0;Yt=yt.length||Yt>=lt.length);++Yt)yt[Yt+St]=lt[Yt];return Yt}function Ir(lt,yt){return lt instanceof yt||lt!=null&<.constructor!=null&<.constructor.name!=null&<.constructor.name===yt.name}function de(lt){return lt!==lt}var Dt=(function(){for(var lt="0123456789abcdef",yt=new Array(256),St=0;St<16;++St)for(var Ht=St*16,Yt=0;Yt<16;++Yt)yt[Ht+Yt]=lt[St]+lt[Yt];return yt})();function qt(lt){return typeof BigInt>"u"?_t:lt}function _t(){throw new Error("BigInt not supported")}},4844:function(t){t.exports=e;function e(r,i,n,o){return r[0]=i[0]+n[0]*o,r[1]=i[1]+n[1]*o,r[2]=i[2]+n[2]*o,r[3]=i[3]+n[3]*o,r}},4905:function(t,e,r){var i=r(5874);t.exports=n;function n(o,a){var s=i(a),f=[];return f=f.concat(s(o)),f=f.concat(s(null)),f}},4935:function(t,e,r){t.exports=x;var i=r(2762),n=r(8116),o=r(4359),a=r(1879).Q,s=window||process.global||{},f=s.__TEXT_CACHE||{};s.__TEXT_CACHE={};var v=3;function g(y,S,k,M){this.gl=y,this.shader=S,this.buffer=k,this.vao=M,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}var m=g.prototype,w=[0,0];m.bind=function(y,S,k,M){this.vao.bind(),this.shader.bind();var T=this.shader.uniforms;T.model=y,T.view=S,T.projection=k,T.pixelScale=M,w[0]=this.gl.drawingBufferWidth,w[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=w},m.unbind=function(){this.vao.unbind()},m.update=function(y,S,k,M,T){var c=[];function h(j,N,G,rt,ct,st){var et=[G.style,G.weight,G.variant,G.family].join("_"),Z=f[et];Z||(Z=f[et]={});var ot=Z[N];ot||(ot=Z[N]=l(N,{triangles:!0,font:G.family,fontStyle:G.style,fontWeight:G.weight,fontVariant:G.variant,textAlign:"center",textBaseline:"middle",lineSpacing:ct,styletags:st}));for(var X=(rt||12)/12,Q=ot.positions,ut=ot.cells,J=0,q=ut.length;J=0;--nt){var dt=Q[it[nt]];c.push(X*dt[0],-X*dt[1],j)}}for(var b=[0,0,0],_=[0,0,0],P=[0,0,0],z=[0,0,0],D=1.25,B={breaklines:!0,bolds:!0,italics:!0,subscripts:!0,superscripts:!0},R=0;R<3;++R){P[R]=c.length/v|0,h(.5*(y[0][R]+y[1][R]),S[R],k[R],12,D,B),z[R]=(c.length/v|0)-P[R],b[R]=c.length/v|0;for(var I=0;I0||S.length>0;){for(;y.length>0;){var h=y.pop();if(k[h]!==-x){k[h]=x;for(var b=M[h],_=0;_<3;++_){var P=c[3*h+_];P>=0&&k[P]===0&&(T[3*h+_]?S.push(P):(y.push(P),k[P]=x))}}}var z=S;S=y,y=z,S.length=0,x=-x}var D=f(M,k,m);return w?D.concat(l.boundary):D}},5033:function(t){t.exports=e;function e(r,i,n){var o=i||0,a=n||1;return[[r[12]+r[0],r[13]+r[1],r[14]+r[2],r[15]+r[3]],[r[12]-r[0],r[13]-r[1],r[14]-r[2],r[15]-r[3]],[r[12]+r[4],r[13]+r[5],r[14]+r[6],r[15]+r[7]],[r[12]-r[4],r[13]-r[5],r[14]-r[6],r[15]-r[7]],[o*r[12]+r[8],o*r[13]+r[9],o*r[14]+r[10],o*r[15]+r[11]],[a*r[12]-r[8],a*r[13]-r[9],a*r[14]-r[10],a*r[15]-r[11]]]}},5085:function(t,e,r){t.exports=x;var i=r(3250)[3],n=r(4209),o=r(3352),a=r(2478);function s(){return!0}function f(y){return function(S,k){var M=y[S];return M?!!M.queryPoint(k,s):!1}}function v(y){for(var S={},k=0;k0&&S[M]===k[0])T=y[M-1];else return 1;for(var c=1;T;){var h=T.key,b=i(k,h[0],h[1]);if(h[0][0]0)c=-1,T=T.right;else return 0;else if(b>0)T=T.left;else if(b<0)c=1,T=T.right;else return 0}return c}}function m(y){return 1}function w(y){return function(S){return y(S[0],S[1])?0:1}}function l(y,S){return function(k){return y(k[0],k[1])?0:S(k)}}function x(y){for(var S=y.length,k=[],M=[],T=0,c=0;c"u"?r(606):WeakMap,a=new o,s=0;function f(S,k,M,T,c,h,b){this.id=S,this.src=k,this.type=M,this.shader=T,this.count=h,this.programs=[],this.cache=b}f.prototype.dispose=function(){if(--this.count===0){for(var S=this.cache,k=S.gl,M=this.programs,T=0,c=M.length;T0&&(f=1/Math.sqrt(f),r[0]=n*f,r[1]=o*f,r[2]=a*f,r[3]=s*f),r}},5202:function(t,e,r){var i=r(1944),n=r(8210);t.exports=s,t.exports.positive=f,t.exports.negative=v;function o(g,m){var w=n(i(g,m),[m[m.length-1]]);return w[w.length-1]}function a(g,m,w,l){var x=l-m,y=-m/x;y<0?y=0:y>1&&(y=1);for(var S=1-y,k=g.length,M=new Array(k),T=0;T0||x>0&&M<0){var T=a(y,M,S,x);w.push(T),l.push(T.slice())}M<0?l.push(S.slice()):M>0?w.push(S.slice()):(w.push(S.slice()),l.push(S.slice())),x=M}return{positive:w,negative:l}}function f(g,m){for(var w=[],l=o(g[g.length-1],m),x=g[g.length-1],y=g[0],S=0;S0||l>0&&k<0)&&w.push(a(x,k,y,l)),k>=0&&w.push(y.slice()),l=k}return w}function v(g,m){for(var w=[],l=o(g[g.length-1],m),x=g[g.length-1],y=g[0],S=0;S0||l>0&&k<0)&&w.push(a(x,k,y,l)),k<=0&&w.push(y.slice()),l=k}return w}},5219:function(t){t.exports=function(e){for(var r=e.length,i,n=0;n13)&&i!==32&&i!==133&&i!==160&&i!==5760&&i!==6158&&(i<8192||i>8205)&&i!==8232&&i!==8233&&i!==8239&&i!==8287&&i!==8288&&i!==12288&&i!==65279)return!1;return!0}},5250:function(t){t.exports=r;var e=+(Math.pow(2,27)+1);function r(i,n,o){var a=i*n,s=e*i,f=s-i,v=s-f,g=i-v,m=e*n,w=m-n,l=m-w,x=n-l,y=a-v*l,S=y-g*l,k=S-v*x,M=g*x-k;return o?(o[0]=M,o[1]=a,o):[M,a]}},5298:function(t,e){var r={"float64,2,1,0":function(){return function(v,g,m,w,l){var x=v[0],y=v[1],S=v[2],k=m[0],M=m[1],T=m[2];w|=0;var c=0,h=0,b=0,_=T,P=M-S*T,z=k-y*M;for(b=0;b0;){R<64?(k=R,R=0):(k=64,R-=64);for(var I=v[1]|0;I>0;){I<64?(M=I,I=0):(M=64,I-=64),w=D+R*c+I*h,y=B+R*_+I*P;var F=0,j=0,N=0,G=b,rt=c-T*b,ct=h-k*c,st=z,et=_-T*z,Z=P-k*_;for(N=0;N0;){P<64?(k=P,P=0):(k=64,P-=64);for(var z=v[0]|0;z>0;){z<64?(S=z,z=0):(S=64,z-=64),w=b+P*T+z*M,y=_+P*h+z*c;var D=0,B=0,R=T,I=M-k*T,F=h,j=c-k*h;for(B=0;B0;){B<64?(M=B,B=0):(M=64,B-=64);for(var R=v[0]|0;R>0;){R<64?(S=R,R=0):(S=64,R-=64);for(var I=v[1]|0;I>0;){I<64?(k=I,I=0):(k=64,I-=64),w=z+B*h+R*T+I*c,y=D+B*P+R*b+I*_;var F=0,j=0,N=0,G=h,rt=T-M*h,ct=c-S*T,st=P,et=b-M*P,Z=_-S*b;for(N=0;N=0}})(),o.removeTriangle=function(f,v,g){var m=this.stars;a(m[f],v,g),a(m[v],g,f),a(m[g],f,v)},o.addTriangle=function(f,v,g){var m=this.stars;m[f].push(v,g),m[v].push(g,f),m[g].push(f,v)},o.opposite=function(f,v){for(var g=this.stars[v],m=1,w=g.length;m0;){var l=g.pop();f[l]=!1;for(var x=s[l],m=0;m0){for(var et=0;et<24;++et)z.push(z[z.length-12]);I+=2,rt=!0}continue t}F[0][_]=Math.min(F[0][_],ct[_],st[_]),F[1][_]=Math.max(F[1][_],ct[_],st[_])}var Z,ot;Array.isArray(N[0])?(Z=N.length>b-1?N[b-1]:N.length>0?N[N.length-1]:[0,0,0,1],ot=N.length>b?N[b]:N.length>0?N[N.length-1]:[0,0,0,1]):Z=ot=N,Z.length===3&&(Z=[Z[0],Z[1],Z[2],1]),ot.length===3&&(ot=[ot[0],ot[1],ot[2],1]),!this.hasAlpha&&Z[3]<1&&(this.hasAlpha=!0);var X;Array.isArray(G)?X=G.length>b-1?G[b-1]:G.length>0?G[G.length-1]:[0,0,0,1]:X=G;var Q=R;if(R+=y(ct,st),rt){for(_=0;_<2;++_)z.push(ct[0],ct[1],ct[2],st[0],st[1],st[2],Q,X,Z[0],Z[1],Z[2],Z[3]);I+=2,rt=!1}z.push(ct[0],ct[1],ct[2],st[0],st[1],st[2],Q,X,Z[0],Z[1],Z[2],Z[3],ct[0],ct[1],ct[2],st[0],st[1],st[2],Q,-X,Z[0],Z[1],Z[2],Z[3],st[0],st[1],st[2],ct[0],ct[1],ct[2],R,-X,ot[0],ot[1],ot[2],ot[3],st[0],st[1],st[2],ct[0],ct[1],ct[2],R,X,ot[0],ot[1],ot[2],ot[3]),I+=4}}if(this.buffer.update(z),D.push(R),B.push(j[j.length-1].slice()),this.bounds=F,this.vertexCount=I,this.points=B,this.arcLength=D,"dashes"in h){var ut=h.dashes,J=ut.slice();for(J.unshift(0),b=1;br[n][0]&&(n=o);return in?[[n],[i]]:[[i]]}},5771:function(t,e,r){var i=r(8507),n=r(3788),o=r(2419);t.exports=a;function a(s){s.sort(n);for(var f=s.length,v=0,g=0;g0){var l=s[v-1];if(i(m,l)===0&&o(l)!==w){v-=1;continue}}s[v++]=m}}return s.length=v,s}},5838:function(t,e,r){t.exports=n;var i=r(7842);function n(o){for(var a=new Array(o.length),s=0;s0)continue;Ut=mt.slice(0,1).join("")}return J(Ut),rt+=Ut.length,F=F.slice(Ut.length),F.length}while(!0)}function te(){return/[^a-fA-F0-9]/.test(R)?(J(F.join("")),B=f,z):(F.push(R),I=R,z+1)}function Jt(){return R==="."||/[eE]/.test(R)?(F.push(R),B=y,I=R,z+1):R==="x"&&F.length===1&&F[0]==="0"?(B=h,F.push(R),I=R,z+1):/[^\d]/.test(R)?(J(F.join("")),B=f,z):(F.push(R),I=R,z+1)}function ee(){return R==="f"&&(F.push(R),I=R,z+=1),/[eE]/.test(R)||(R==="-"||R==="+")&&/[eE]/.test(I)?(F.push(R),I=R,z+1):/[^\d]/.test(R)?(J(F.join("")),B=f,z):(F.push(R),I=R,z+1)}function Zt(){if(/[^\d\w_]/.test(R)){var mt=F.join("");return ut[mt]?B=M:Q[mt]?B=k:B=S,J(F.join("")),B=f,z}return F.push(R),I=R,z+1}}},5878:function(t,e,r){t.exports=a;var i=r(3250),n=r(2014);function o(s,f,v){var g=Math.abs(i(s,f,v)),m=Math.sqrt(Math.pow(f[0]-v[0],2)+Math.pow(f[1]-v[1],2));return g/m}function a(s,f,v){for(var g=f.length,m=s.length,w=new Array(g),l=new Array(g),x=new Array(g),y=new Array(g),S=0;S>1:(et>>1)-1}function P(et){for(var Z=b(et);;){var ot=Z,X=2*et+1,Q=2*(et+1),ut=et;if(X0;){var ot=_(et);if(ot>=0){var X=b(ot);if(Z0){var et=I[0];return h(0,N-1),N-=1,P(0),et}return-1}function B(et,Z){var ot=I[et];return x[ot]===Z?et:(x[ot]=-1/0,z(et),D(),x[ot]=Z,N+=1,z(N-1))}function R(et){if(!y[et]){y[et]=!0;var Z=w[et],ot=l[et];w[ot]>=0&&(w[ot]=Z),l[Z]>=0&&(l[Z]=ot),F[Z]>=0&&B(F[Z],c(Z)),F[ot]>=0&&B(F[ot],c(ot))}}for(var I=[],F=new Array(g),S=0;S>1;S>=0;--S)P(S);for(;;){var G=D();if(G<0||x[G]>v)break;R(G)}for(var rt=[],S=0;S=0&&ot>=0&&Z!==ot){var X=F[Z],Q=F[ot];X!==Q&&st.push([X,Q])}}),n.unique(n.normalize(st)),{positions:rt,edges:st}}},5911:function(t){t.exports=e;function e(r,i,n){var o=i[0],a=i[1],s=i[2],f=n[0],v=n[1],g=n[2];return r[0]=a*g-s*v,r[1]=s*f-o*g,r[2]=o*v-a*f,r}},5964:function(t){t.exports=function(e){return!e&&e!==0?"":e.toString()}},5995:function(t,e,r){t.exports=o;var i=r(7642),n=r(6037);function o(a,s){return i(s).filter(function(f){for(var v=new Array(f.length),g=0;g2&&b[1]>2&&T(h.pick(-1,-1).lo(1,1).hi(b[0]-2,b[1]-2),c.pick(-1,-1,0).lo(1,1).hi(b[0]-2,b[1]-2),c.pick(-1,-1,1).lo(1,1).hi(b[0]-2,b[1]-2)),b[1]>2&&(M(h.pick(0,-1).lo(1).hi(b[1]-2),c.pick(0,-1,1).lo(1).hi(b[1]-2)),k(c.pick(0,-1,0).lo(1).hi(b[1]-2))),b[1]>2&&(M(h.pick(b[0]-1,-1).lo(1).hi(b[1]-2),c.pick(b[0]-1,-1,1).lo(1).hi(b[1]-2)),k(c.pick(b[0]-1,-1,0).lo(1).hi(b[1]-2))),b[0]>2&&(M(h.pick(-1,0).lo(1).hi(b[0]-2),c.pick(-1,0,0).lo(1).hi(b[0]-2)),k(c.pick(-1,0,1).lo(1).hi(b[0]-2))),b[0]>2&&(M(h.pick(-1,b[1]-1).lo(1).hi(b[0]-2),c.pick(-1,b[1]-1,0).lo(1).hi(b[0]-2)),k(c.pick(-1,b[1]-1,1).lo(1).hi(b[0]-2))),c.set(0,0,0,0),c.set(0,0,1,0),c.set(b[0]-1,0,0,0),c.set(b[0]-1,0,1,0),c.set(0,b[1]-1,0,0),c.set(0,b[1]-1,1,0),c.set(b[0]-1,b[1]-1,0,0),c.set(b[0]-1,b[1]-1,1,0),c}}function y(S){var k=S.join(),b=g[k];if(b)return b;for(var M=S.length,T=[m,w],c=1;c<=M;++c)T.push(l(c));var h=x,b=h.apply(void 0,T);return g[k]=b,b}t.exports=function(S,k,M){if(Array.isArray(M)||(typeof M=="string"?M=i(k.dimension,M):M=i(k.dimension,"clamp")),k.size===0)return S;if(k.dimension===0)return S.set(0),S;var T=y(M);return T(S,k)}},6204:function(t){t.exports=e;function e(r){var i,n,o,a=r.length,s=0;for(i=0;ig&&(g=i.length(z)),_&&!b){var D=2*i.distance(k,P)/(i.length(M)+i.length(z));D?(c=Math.min(c,D),h=!1):h=!0}h||(k=P,M=z),T.push(z)}var B=[m,l,y],R=[w,x,S];a&&(a[0]=B,a[1]=R),g===0&&(g=1);var I=1/g;isFinite(c)||(c=1),v.vectorScale=c;var F=o.coneSize||(b?1:.5);o.absoluteConeSize&&(F=o.absoluteConeSize*I),v.coneScale=F;for(var _=0,j=0;_rt&&(R|=1<rt){R|=1<v[z][1])&&(ut=z);for(var J=-1,z=0;z<3;++z){var q=ut^1<v[it][0]&&(it=q)}}var nt=y;nt[0]=nt[1]=nt[2]=0,nt[i.log2(J^ut)]=ut&J,nt[i.log2(ut^it)]=ut⁢var dt=it^7;dt===R||dt===Q?(dt=J^7,nt[i.log2(it^dt)]=dt&it):nt[i.log2(J^dt)]=dt&J;for(var Tt=S,wt=R,j=0;j<3;++j)wt&1<=0&&(v=s.length-f-1);var g=Math.pow(10,v),m=Math.round(o*a*g),w=m+"";if(w.indexOf("e")>=0)return w;var l=m/g,x=m%g;m<0?(l=-Math.ceil(l)|0,x=-x|0):(l=Math.floor(l)|0,x=x|0);var y=""+l;if(m<0&&(y="-"+y),v){for(var S=""+x;S.length=o[0][f];--m)v.push({x:m*a[f],text:r(a[f],m)});s.push(v)}return s}function n(o,a){for(var s=0;s<3;++s){if(o[s].length!==a[s].length)return!1;for(var f=0;fk+1)throw new Error(y+" map requires nshades to be at least size "+x.length);Array.isArray(v.alpha)?v.alpha.length!==2?M=[1,1]:M=v.alpha.slice():typeof v.alpha=="number"?M=[v.alpha,v.alpha]:M=[1,1],g=x.map(function(P){return Math.round(P.index*k)}),M[0]=Math.min(Math.max(M[0],0),1),M[1]=Math.min(Math.max(M[1],0),1);var c=x.map(function(P,z){var D=x[z].index,B=x[z].rgb.slice();return B.length===4&&B[3]>=0&&B[3]<=1||(B[3]=M[0]+(M[1]-M[0])*D),B}),h=[];for(T=0;T 0 U ||b|| > 0. + // Assign z = 0, x = -b, y = a: + // a*-b + b*a + c*0 = -ba + ba + 0 = 0 + if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) { + return normalize(vec3(-v.y, v.x, 0.0)); + } else { + return normalize(vec3(0.0, v.z, -v.y)); + } +} + +// Calculate the tube vertex and normal at the given index. +// +// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d. +// +// Each tube segment is made up of a ring of vertices. +// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array. +// The indexes of tube segments run from 0 to 8. +// +vec3 getTubePosition(vec3 d, float index, out vec3 normal) { + float segmentCount = 8.0; + + float angle = 2.0 * 3.14159 * (index / segmentCount); + + vec3 u = getOrthogonalVector(d); + vec3 v = normalize(cross(u, d)); + + vec3 x = u * cos(angle) * length(d); + vec3 y = v * sin(angle) * length(d); + vec3 v3 = x + y; + + normal = normalize(v3); + + return v3; +} + +attribute vec4 vector; +attribute vec4 color, position; +attribute vec2 uv; + +uniform float vectorScale, tubeScale; +uniform mat4 model, view, projection, inverseModel; +uniform vec3 eyePosition, lightPosition; + +varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position; +varying vec4 f_color; +varying vec2 f_uv; + +void main() { + // Scale the vector magnitude to stay constant with + // model & view changes. + vec3 normal; + vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal); + vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0); + + //Lighting geometry parameters + vec4 cameraCoordinate = view * tubePosition; + cameraCoordinate.xyz /= cameraCoordinate.w; + f_lightDirection = lightPosition - cameraCoordinate.xyz; + f_eyeDirection = eyePosition - cameraCoordinate.xyz; + f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz); + + // vec4 m_position = model * vec4(tubePosition, 1.0); + vec4 t_position = view * tubePosition; + gl_Position = projection * t_position; + + f_color = color; + f_data = tubePosition.xyz; + f_position = position.xyz; + f_uv = uv; +} +`]),o=i([`#extension GL_OES_standard_derivatives : enable + +precision highp float; +#define GLSLIFY 1 + +float beckmannDistribution(float x, float roughness) { + float NdotH = max(x, 0.0001); + float cos2Alpha = NdotH * NdotH; + float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha; + float roughness2 = roughness * roughness; + float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha; + return exp(tan2Alpha / roughness2) / denom; +} + +float cookTorranceSpecular( + vec3 lightDirection, + vec3 viewDirection, + vec3 surfaceNormal, + float roughness, + float fresnel) { + + float VdotN = max(dot(viewDirection, surfaceNormal), 0.0); + float LdotN = max(dot(lightDirection, surfaceNormal), 0.0); + + //Half angle vector + vec3 H = normalize(lightDirection + viewDirection); + + //Geometric term + float NdotH = max(dot(surfaceNormal, H), 0.0); + float VdotH = max(dot(viewDirection, H), 0.000001); + float LdotH = max(dot(lightDirection, H), 0.000001); + float G1 = (2.0 * NdotH * VdotN) / VdotH; + float G2 = (2.0 * NdotH * LdotN) / LdotH; + float G = min(1.0, min(G1, G2)); + + //Distribution term + float D = beckmannDistribution(NdotH, roughness); + + //Fresnel term + float F = pow(1.0 - VdotN, fresnel); + + //Multiply terms and done + return G * F * D / max(3.14159265 * VdotN, 0.000001); +} + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec3 clipBounds[2]; +uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity; +uniform sampler2D texture; + +varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position; +varying vec4 f_color; +varying vec2 f_uv; + +void main() { + if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard; + vec3 N = normalize(f_normal); + vec3 L = normalize(f_lightDirection); + vec3 V = normalize(f_eyeDirection); + + if(gl_FrontFacing) { + N = -N; + } + + float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel))); + float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0); + + vec4 surfaceColor = f_color * texture2D(texture, f_uv); + vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0); + + gl_FragColor = litColor * opacity; +} +`]),a=i([`precision highp float; + +precision highp float; +#define GLSLIFY 1 + +vec3 getOrthogonalVector(vec3 v) { + // Return up-vector for only-z vector. + // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0). + // From the above if-statement we have ||a|| > 0 U ||b|| > 0. + // Assign z = 0, x = -b, y = a: + // a*-b + b*a + c*0 = -ba + ba + 0 = 0 + if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) { + return normalize(vec3(-v.y, v.x, 0.0)); + } else { + return normalize(vec3(0.0, v.z, -v.y)); + } +} + +// Calculate the tube vertex and normal at the given index. +// +// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d. +// +// Each tube segment is made up of a ring of vertices. +// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array. +// The indexes of tube segments run from 0 to 8. +// +vec3 getTubePosition(vec3 d, float index, out vec3 normal) { + float segmentCount = 8.0; + + float angle = 2.0 * 3.14159 * (index / segmentCount); + + vec3 u = getOrthogonalVector(d); + vec3 v = normalize(cross(u, d)); + + vec3 x = u * cos(angle) * length(d); + vec3 y = v * sin(angle) * length(d); + vec3 v3 = x + y; + + normal = normalize(v3); + + return v3; +} + +attribute vec4 vector; +attribute vec4 position; +attribute vec4 id; + +uniform mat4 model, view, projection; +uniform float tubeScale; + +varying vec3 f_position; +varying vec4 f_id; + +void main() { + vec3 normal; + vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal); + vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0); + + gl_Position = projection * (view * tubePosition); + f_id = id; + f_position = position.xyz; +} +`]),s=i([`precision highp float; +#define GLSLIFY 1 + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec3 clipBounds[2]; +uniform float pickId; + +varying vec3 f_position; +varying vec4 f_id; + +void main() { + if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard; + + gl_FragColor = vec4(pickId, f_id.xyz); +}`]);e.meshShader={vertex:n,fragment:o,attributes:[{name:"position",type:"vec4"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec4"}]},e.pickShader={vertex:a,fragment:s,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec4"}]}},6743:function(t){t.exports=e;function e(r,i,n){var o=i[0],a=i[1],s=i[2],f=i[3],v=o+o,g=a+a,m=s+s,w=o*v,l=o*g,x=o*m,y=a*g,S=a*m,k=s*m,M=f*v,T=f*g,c=f*m;return r[0]=1-(y+k),r[1]=l+c,r[2]=x-T,r[3]=0,r[4]=l-c,r[5]=1-(w+k),r[6]=S+M,r[7]=0,r[8]=x+T,r[9]=S-M,r[10]=1-(w+y),r[11]=0,r[12]=n[0],r[13]=n[1],r[14]=n[2],r[15]=1,r}},6760:function(t){t.exports=e;function e(r,i,n){var o=i[0],a=i[1],s=i[2],f=i[3],v=i[4],g=i[5],m=i[6],w=i[7],l=i[8],x=i[9],y=i[10],S=i[11],k=i[12],M=i[13],T=i[14],c=i[15],h=n[0],b=n[1],_=n[2],P=n[3];return r[0]=h*o+b*v+_*l+P*k,r[1]=h*a+b*g+_*x+P*M,r[2]=h*s+b*m+_*y+P*T,r[3]=h*f+b*w+_*S+P*c,h=n[4],b=n[5],_=n[6],P=n[7],r[4]=h*o+b*v+_*l+P*k,r[5]=h*a+b*g+_*x+P*M,r[6]=h*s+b*m+_*y+P*T,r[7]=h*f+b*w+_*S+P*c,h=n[8],b=n[9],_=n[10],P=n[11],r[8]=h*o+b*v+_*l+P*k,r[9]=h*a+b*g+_*x+P*M,r[10]=h*s+b*m+_*y+P*T,r[11]=h*f+b*w+_*S+P*c,h=n[12],b=n[13],_=n[14],P=n[15],r[12]=h*o+b*v+_*l+P*k,r[13]=h*a+b*g+_*x+P*M,r[14]=h*s+b*m+_*y+P*T,r[15]=h*f+b*w+_*S+P*c,r}},6768:function(t,e,r){var i=r(6859);t.exports=n;function n(o){return new i(o)}},6803:function(t,e,r){r(8828),r(1755);function i(n,o){var a=n.length,s=n.length-o.length,f=Math.min;if(s)return s;switch(a){case 0:return 0;case 1:return n[0]-o[0];case 2:var l=n[0]+n[1]-o[0]-o[1];return l||f(n[0],n[1])-f(o[0],o[1]);case 3:var v=n[0]+n[1],g=o[0]+o[1];if(l=v+n[2]-(g+o[2]),l)return l;var m=f(n[0],n[1]),w=f(o[0],o[1]),l=f(m,n[2])-f(w,o[2]);return l||f(m+n[2],v)-f(w+o[2],g);default:var x=n.slice(0);x.sort();var y=o.slice(0);y.sort();for(var S=0;S0?I:F},s.min=function(I,F){return I.cmp(F)<0?I:F},s.prototype._init=function(I,F,j){if(typeof I=="number")return this._initNumber(I,F,j);if(typeof I=="object")return this._initArray(I,F,j);F==="hex"&&(F=16),o(F===(F|0)&&F>=2&&F<=36),I=I.toString().replace(/\s+/g,"");var N=0;I[0]==="-"&&(N++,this.negative=1),N=0;N-=3)rt=I[N]|I[N-1]<<8|I[N-2]<<16,this.words[G]|=rt<>>26-ct&67108863,ct+=24,ct>=26&&(ct-=26,G++);else if(j==="le")for(N=0,G=0;N>>26-ct&67108863,ct+=24,ct>=26&&(ct-=26,G++);return this.strip()};function v(I,F){var j=I.charCodeAt(F);return j>=65&&j<=70?j-55:j>=97&&j<=102?j-87:j-48&15}function g(I,F,j){var N=v(I,j);return j-1>=F&&(N|=v(I,j-1)<<4),N}s.prototype._parseHex=function(I,F,j){this.length=Math.ceil((I.length-F)/6),this.words=new Array(this.length);for(var N=0;N=F;N-=2)ct=g(I,F,N)<=18?(G-=18,rt+=1,this.words[rt]|=ct>>>26):G+=8;else{var st=I.length-F;for(N=st%2===0?F+1:F;N=18?(G-=18,rt+=1,this.words[rt]|=ct>>>26):G+=8}this.strip()};function m(I,F,j,N){for(var G=0,rt=Math.min(I.length,j),ct=F;ct=49?G+=st-49+10:st>=17?G+=st-17+10:G+=st}return G}s.prototype._parseBase=function(I,F,j){this.words=[0],this.length=1;for(var N=0,G=1;G<=67108863;G*=F)N++;N--,G=G/F|0;for(var rt=I.length-j,ct=rt%N,st=Math.min(rt,rt-ct)+j,et=0,Z=j;Z1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],x=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(I,F){I=I||10,F=F|0||1;var j;if(I===16||I==="hex"){j="";for(var N=0,G=0,rt=0;rt>>24-N&16777215,G!==0||rt!==this.length-1?j=w[6-st.length]+st+j:j=st+j,N+=2,N>=26&&(N-=26,rt--)}for(G!==0&&(j=G.toString(16)+j);j.length%F!==0;)j="0"+j;return this.negative!==0&&(j="-"+j),j}if(I===(I|0)&&I>=2&&I<=36){var et=l[I],Z=x[I];j="";var ot=this.clone();for(ot.negative=0;!ot.isZero();){var X=ot.modn(Z).toString(I);ot=ot.idivn(Z),ot.isZero()?j=X+j:j=w[et-X.length]+X+j}for(this.isZero()&&(j="0"+j);j.length%F!==0;)j="0"+j;return this.negative!==0&&(j="-"+j),j}o(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var I=this.words[0];return this.length===2?I+=this.words[1]*67108864:this.length===3&&this.words[2]===1?I+=4503599627370496+this.words[1]*67108864:this.length>2&&o(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-I:I},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(I,F){return o(typeof f<"u"),this.toArrayLike(f,I,F)},s.prototype.toArray=function(I,F){return this.toArrayLike(Array,I,F)},s.prototype.toArrayLike=function(I,F,j){var N=this.byteLength(),G=j||Math.max(1,N);o(N<=G,"byte array longer than desired length"),o(G>0,"Requested array length <= 0"),this.strip();var rt=F==="le",ct=new I(G),st,et,Z=this.clone();if(rt){for(et=0;!Z.isZero();et++)st=Z.andln(255),Z.iushrn(8),ct[et]=st;for(;et=4096&&(j+=13,F>>>=13),F>=64&&(j+=7,F>>>=7),F>=8&&(j+=4,F>>>=4),F>=2&&(j+=2,F>>>=2),j+F},s.prototype._zeroBits=function(I){if(I===0)return 26;var F=I,j=0;return(F&8191)===0&&(j+=13,F>>>=13),(F&127)===0&&(j+=7,F>>>=7),(F&15)===0&&(j+=4,F>>>=4),(F&3)===0&&(j+=2,F>>>=2),(F&1)===0&&j++,j},s.prototype.bitLength=function(){var I=this.words[this.length-1],F=this._countBits(I);return(this.length-1)*26+F};function y(I){for(var F=new Array(I.bitLength()),j=0;j>>G}return F}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var I=0,F=0;FI.length?this.clone().ior(I):I.clone().ior(this)},s.prototype.uor=function(I){return this.length>I.length?this.clone().iuor(I):I.clone().iuor(this)},s.prototype.iuand=function(I){var F;this.length>I.length?F=I:F=this;for(var j=0;jI.length?this.clone().iand(I):I.clone().iand(this)},s.prototype.uand=function(I){return this.length>I.length?this.clone().iuand(I):I.clone().iuand(this)},s.prototype.iuxor=function(I){var F,j;this.length>I.length?(F=this,j=I):(F=I,j=this);for(var N=0;NI.length?this.clone().ixor(I):I.clone().ixor(this)},s.prototype.uxor=function(I){return this.length>I.length?this.clone().iuxor(I):I.clone().iuxor(this)},s.prototype.inotn=function(I){o(typeof I=="number"&&I>=0);var F=Math.ceil(I/26)|0,j=I%26;this._expand(F),j>0&&F--;for(var N=0;N0&&(this.words[N]=~this.words[N]&67108863>>26-j),this.strip()},s.prototype.notn=function(I){return this.clone().inotn(I)},s.prototype.setn=function(I,F){o(typeof I=="number"&&I>=0);var j=I/26|0,N=I%26;return this._expand(j+1),F?this.words[j]=this.words[j]|1<I.length?(j=this,N=I):(j=I,N=this);for(var G=0,rt=0;rt>>26;for(;G!==0&&rt>>26;if(this.length=j.length,G!==0)this.words[this.length]=G,this.length++;else if(j!==this)for(;rtI.length?this.clone().iadd(I):I.clone().iadd(this)},s.prototype.isub=function(I){if(I.negative!==0){I.negative=0;var F=this.iadd(I);return I.negative=1,F._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(I),this.negative=1,this._normSign();var j=this.cmp(I);if(j===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,G;j>0?(N=this,G=I):(N=I,G=this);for(var rt=0,ct=0;ct>26,this.words[ct]=F&67108863;for(;rt!==0&&ct>26,this.words[ct]=F&67108863;if(rt===0&&ct>>26,X=et&67108863,Q=Math.min(Z,F.length-1),ut=Math.max(0,Z-I.length+1);ut<=Q;ut++){var J=Z-ut|0;G=I.words[J]|0,rt=F.words[ut]|0,ct=G*rt+X,ot+=ct/67108864|0,X=ct&67108863}j.words[Z]=X|0,et=ot|0}return et!==0?j.words[Z]=et|0:j.length--,j.strip()}var k=function(I,F,j){var N=I.words,G=F.words,rt=j.words,ct=0,st,et,Z,ot=N[0]|0,X=ot&8191,Q=ot>>>13,ut=N[1]|0,J=ut&8191,q=ut>>>13,it=N[2]|0,nt=it&8191,dt=it>>>13,Tt=N[3]|0,wt=Tt&8191,Ct=Tt>>>13,It=N[4]|0,Nt=It&8191,te=It>>>13,Jt=N[5]|0,ee=Jt&8191,Zt=Jt>>>13,mt=N[6]|0,bt=mt&8191,vt=mt>>>13,Ut=N[7]|0,re=Ut&8191,Kt=Ut>>>13,ue=N[8]|0,Me=ue&8191,Ce=ue>>>13,We=N[9]|0,qe=We&8191,vr=We>>>13,_r=G[0]|0,er=_r&8191,Mr=_r>>>13,Ir=G[1]|0,de=Ir&8191,Dt=Ir>>>13,qt=G[2]|0,_t=qt&8191,lt=qt>>>13,yt=G[3]|0,St=yt&8191,Ht=yt>>>13,Yt=G[4]|0,se=Yt&8191,ke=Yt>>>13,Ee=G[5]|0,Ue=Ee&8191,ir=Ee>>>13,ar=G[6]|0,Ye=ar&8191,Er=ar>>>13,pn=G[7]|0,dn=pn&8191,bn=pn>>>13,Zn=G[8]|0,En=Zn&8191,gn=Zn>>>13,da=G[9]|0,ra=da&8191,Se=da>>>13;j.negative=I.negative^F.negative,j.length=19,st=Math.imul(X,er),et=Math.imul(X,Mr),et=et+Math.imul(Q,er)|0,Z=Math.imul(Q,Mr);var Re=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(Re>>>26)|0,Re&=67108863,st=Math.imul(J,er),et=Math.imul(J,Mr),et=et+Math.imul(q,er)|0,Z=Math.imul(q,Mr),st=st+Math.imul(X,de)|0,et=et+Math.imul(X,Dt)|0,et=et+Math.imul(Q,de)|0,Z=Z+Math.imul(Q,Dt)|0;var Ze=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,st=Math.imul(nt,er),et=Math.imul(nt,Mr),et=et+Math.imul(dt,er)|0,Z=Math.imul(dt,Mr),st=st+Math.imul(J,de)|0,et=et+Math.imul(J,Dt)|0,et=et+Math.imul(q,de)|0,Z=Z+Math.imul(q,Dt)|0,st=st+Math.imul(X,_t)|0,et=et+Math.imul(X,lt)|0,et=et+Math.imul(Q,_t)|0,Z=Z+Math.imul(Q,lt)|0;var tr=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(tr>>>26)|0,tr&=67108863,st=Math.imul(wt,er),et=Math.imul(wt,Mr),et=et+Math.imul(Ct,er)|0,Z=Math.imul(Ct,Mr),st=st+Math.imul(nt,de)|0,et=et+Math.imul(nt,Dt)|0,et=et+Math.imul(dt,de)|0,Z=Z+Math.imul(dt,Dt)|0,st=st+Math.imul(J,_t)|0,et=et+Math.imul(J,lt)|0,et=et+Math.imul(q,_t)|0,Z=Z+Math.imul(q,lt)|0,st=st+Math.imul(X,St)|0,et=et+Math.imul(X,Ht)|0,et=et+Math.imul(Q,St)|0,Z=Z+Math.imul(Q,Ht)|0;var zr=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(zr>>>26)|0,zr&=67108863,st=Math.imul(Nt,er),et=Math.imul(Nt,Mr),et=et+Math.imul(te,er)|0,Z=Math.imul(te,Mr),st=st+Math.imul(wt,de)|0,et=et+Math.imul(wt,Dt)|0,et=et+Math.imul(Ct,de)|0,Z=Z+Math.imul(Ct,Dt)|0,st=st+Math.imul(nt,_t)|0,et=et+Math.imul(nt,lt)|0,et=et+Math.imul(dt,_t)|0,Z=Z+Math.imul(dt,lt)|0,st=st+Math.imul(J,St)|0,et=et+Math.imul(J,Ht)|0,et=et+Math.imul(q,St)|0,Z=Z+Math.imul(q,Ht)|0,st=st+Math.imul(X,se)|0,et=et+Math.imul(X,ke)|0,et=et+Math.imul(Q,se)|0,Z=Z+Math.imul(Q,ke)|0;var tn=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(tn>>>26)|0,tn&=67108863,st=Math.imul(ee,er),et=Math.imul(ee,Mr),et=et+Math.imul(Zt,er)|0,Z=Math.imul(Zt,Mr),st=st+Math.imul(Nt,de)|0,et=et+Math.imul(Nt,Dt)|0,et=et+Math.imul(te,de)|0,Z=Z+Math.imul(te,Dt)|0,st=st+Math.imul(wt,_t)|0,et=et+Math.imul(wt,lt)|0,et=et+Math.imul(Ct,_t)|0,Z=Z+Math.imul(Ct,lt)|0,st=st+Math.imul(nt,St)|0,et=et+Math.imul(nt,Ht)|0,et=et+Math.imul(dt,St)|0,Z=Z+Math.imul(dt,Ht)|0,st=st+Math.imul(J,se)|0,et=et+Math.imul(J,ke)|0,et=et+Math.imul(q,se)|0,Z=Z+Math.imul(q,ke)|0,st=st+Math.imul(X,Ue)|0,et=et+Math.imul(X,ir)|0,et=et+Math.imul(Q,Ue)|0,Z=Z+Math.imul(Q,ir)|0;var Yr=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,st=Math.imul(bt,er),et=Math.imul(bt,Mr),et=et+Math.imul(vt,er)|0,Z=Math.imul(vt,Mr),st=st+Math.imul(ee,de)|0,et=et+Math.imul(ee,Dt)|0,et=et+Math.imul(Zt,de)|0,Z=Z+Math.imul(Zt,Dt)|0,st=st+Math.imul(Nt,_t)|0,et=et+Math.imul(Nt,lt)|0,et=et+Math.imul(te,_t)|0,Z=Z+Math.imul(te,lt)|0,st=st+Math.imul(wt,St)|0,et=et+Math.imul(wt,Ht)|0,et=et+Math.imul(Ct,St)|0,Z=Z+Math.imul(Ct,Ht)|0,st=st+Math.imul(nt,se)|0,et=et+Math.imul(nt,ke)|0,et=et+Math.imul(dt,se)|0,Z=Z+Math.imul(dt,ke)|0,st=st+Math.imul(J,Ue)|0,et=et+Math.imul(J,ir)|0,et=et+Math.imul(q,Ue)|0,Z=Z+Math.imul(q,ir)|0,st=st+Math.imul(X,Ye)|0,et=et+Math.imul(X,Er)|0,et=et+Math.imul(Q,Ye)|0,Z=Z+Math.imul(Q,Er)|0;var $r=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+($r>>>26)|0,$r&=67108863,st=Math.imul(re,er),et=Math.imul(re,Mr),et=et+Math.imul(Kt,er)|0,Z=Math.imul(Kt,Mr),st=st+Math.imul(bt,de)|0,et=et+Math.imul(bt,Dt)|0,et=et+Math.imul(vt,de)|0,Z=Z+Math.imul(vt,Dt)|0,st=st+Math.imul(ee,_t)|0,et=et+Math.imul(ee,lt)|0,et=et+Math.imul(Zt,_t)|0,Z=Z+Math.imul(Zt,lt)|0,st=st+Math.imul(Nt,St)|0,et=et+Math.imul(Nt,Ht)|0,et=et+Math.imul(te,St)|0,Z=Z+Math.imul(te,Ht)|0,st=st+Math.imul(wt,se)|0,et=et+Math.imul(wt,ke)|0,et=et+Math.imul(Ct,se)|0,Z=Z+Math.imul(Ct,ke)|0,st=st+Math.imul(nt,Ue)|0,et=et+Math.imul(nt,ir)|0,et=et+Math.imul(dt,Ue)|0,Z=Z+Math.imul(dt,ir)|0,st=st+Math.imul(J,Ye)|0,et=et+Math.imul(J,Er)|0,et=et+Math.imul(q,Ye)|0,Z=Z+Math.imul(q,Er)|0,st=st+Math.imul(X,dn)|0,et=et+Math.imul(X,bn)|0,et=et+Math.imul(Q,dn)|0,Z=Z+Math.imul(Q,bn)|0;var In=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(In>>>26)|0,In&=67108863,st=Math.imul(Me,er),et=Math.imul(Me,Mr),et=et+Math.imul(Ce,er)|0,Z=Math.imul(Ce,Mr),st=st+Math.imul(re,de)|0,et=et+Math.imul(re,Dt)|0,et=et+Math.imul(Kt,de)|0,Z=Z+Math.imul(Kt,Dt)|0,st=st+Math.imul(bt,_t)|0,et=et+Math.imul(bt,lt)|0,et=et+Math.imul(vt,_t)|0,Z=Z+Math.imul(vt,lt)|0,st=st+Math.imul(ee,St)|0,et=et+Math.imul(ee,Ht)|0,et=et+Math.imul(Zt,St)|0,Z=Z+Math.imul(Zt,Ht)|0,st=st+Math.imul(Nt,se)|0,et=et+Math.imul(Nt,ke)|0,et=et+Math.imul(te,se)|0,Z=Z+Math.imul(te,ke)|0,st=st+Math.imul(wt,Ue)|0,et=et+Math.imul(wt,ir)|0,et=et+Math.imul(Ct,Ue)|0,Z=Z+Math.imul(Ct,ir)|0,st=st+Math.imul(nt,Ye)|0,et=et+Math.imul(nt,Er)|0,et=et+Math.imul(dt,Ye)|0,Z=Z+Math.imul(dt,Er)|0,st=st+Math.imul(J,dn)|0,et=et+Math.imul(J,bn)|0,et=et+Math.imul(q,dn)|0,Z=Z+Math.imul(q,bn)|0,st=st+Math.imul(X,En)|0,et=et+Math.imul(X,gn)|0,et=et+Math.imul(Q,En)|0,Z=Z+Math.imul(Q,gn)|0;var Nn=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,st=Math.imul(qe,er),et=Math.imul(qe,Mr),et=et+Math.imul(vr,er)|0,Z=Math.imul(vr,Mr),st=st+Math.imul(Me,de)|0,et=et+Math.imul(Me,Dt)|0,et=et+Math.imul(Ce,de)|0,Z=Z+Math.imul(Ce,Dt)|0,st=st+Math.imul(re,_t)|0,et=et+Math.imul(re,lt)|0,et=et+Math.imul(Kt,_t)|0,Z=Z+Math.imul(Kt,lt)|0,st=st+Math.imul(bt,St)|0,et=et+Math.imul(bt,Ht)|0,et=et+Math.imul(vt,St)|0,Z=Z+Math.imul(vt,Ht)|0,st=st+Math.imul(ee,se)|0,et=et+Math.imul(ee,ke)|0,et=et+Math.imul(Zt,se)|0,Z=Z+Math.imul(Zt,ke)|0,st=st+Math.imul(Nt,Ue)|0,et=et+Math.imul(Nt,ir)|0,et=et+Math.imul(te,Ue)|0,Z=Z+Math.imul(te,ir)|0,st=st+Math.imul(wt,Ye)|0,et=et+Math.imul(wt,Er)|0,et=et+Math.imul(Ct,Ye)|0,Z=Z+Math.imul(Ct,Er)|0,st=st+Math.imul(nt,dn)|0,et=et+Math.imul(nt,bn)|0,et=et+Math.imul(dt,dn)|0,Z=Z+Math.imul(dt,bn)|0,st=st+Math.imul(J,En)|0,et=et+Math.imul(J,gn)|0,et=et+Math.imul(q,En)|0,Z=Z+Math.imul(q,gn)|0,st=st+Math.imul(X,ra)|0,et=et+Math.imul(X,Se)|0,et=et+Math.imul(Q,ra)|0,Z=Z+Math.imul(Q,Se)|0;var Kn=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(Kn>>>26)|0,Kn&=67108863,st=Math.imul(qe,de),et=Math.imul(qe,Dt),et=et+Math.imul(vr,de)|0,Z=Math.imul(vr,Dt),st=st+Math.imul(Me,_t)|0,et=et+Math.imul(Me,lt)|0,et=et+Math.imul(Ce,_t)|0,Z=Z+Math.imul(Ce,lt)|0,st=st+Math.imul(re,St)|0,et=et+Math.imul(re,Ht)|0,et=et+Math.imul(Kt,St)|0,Z=Z+Math.imul(Kt,Ht)|0,st=st+Math.imul(bt,se)|0,et=et+Math.imul(bt,ke)|0,et=et+Math.imul(vt,se)|0,Z=Z+Math.imul(vt,ke)|0,st=st+Math.imul(ee,Ue)|0,et=et+Math.imul(ee,ir)|0,et=et+Math.imul(Zt,Ue)|0,Z=Z+Math.imul(Zt,ir)|0,st=st+Math.imul(Nt,Ye)|0,et=et+Math.imul(Nt,Er)|0,et=et+Math.imul(te,Ye)|0,Z=Z+Math.imul(te,Er)|0,st=st+Math.imul(wt,dn)|0,et=et+Math.imul(wt,bn)|0,et=et+Math.imul(Ct,dn)|0,Z=Z+Math.imul(Ct,bn)|0,st=st+Math.imul(nt,En)|0,et=et+Math.imul(nt,gn)|0,et=et+Math.imul(dt,En)|0,Z=Z+Math.imul(dt,gn)|0,st=st+Math.imul(J,ra)|0,et=et+Math.imul(J,Se)|0,et=et+Math.imul(q,ra)|0,Z=Z+Math.imul(q,Se)|0;var $n=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+($n>>>26)|0,$n&=67108863,st=Math.imul(qe,_t),et=Math.imul(qe,lt),et=et+Math.imul(vr,_t)|0,Z=Math.imul(vr,lt),st=st+Math.imul(Me,St)|0,et=et+Math.imul(Me,Ht)|0,et=et+Math.imul(Ce,St)|0,Z=Z+Math.imul(Ce,Ht)|0,st=st+Math.imul(re,se)|0,et=et+Math.imul(re,ke)|0,et=et+Math.imul(Kt,se)|0,Z=Z+Math.imul(Kt,ke)|0,st=st+Math.imul(bt,Ue)|0,et=et+Math.imul(bt,ir)|0,et=et+Math.imul(vt,Ue)|0,Z=Z+Math.imul(vt,ir)|0,st=st+Math.imul(ee,Ye)|0,et=et+Math.imul(ee,Er)|0,et=et+Math.imul(Zt,Ye)|0,Z=Z+Math.imul(Zt,Er)|0,st=st+Math.imul(Nt,dn)|0,et=et+Math.imul(Nt,bn)|0,et=et+Math.imul(te,dn)|0,Z=Z+Math.imul(te,bn)|0,st=st+Math.imul(wt,En)|0,et=et+Math.imul(wt,gn)|0,et=et+Math.imul(Ct,En)|0,Z=Z+Math.imul(Ct,gn)|0,st=st+Math.imul(nt,ra)|0,et=et+Math.imul(nt,Se)|0,et=et+Math.imul(dt,ra)|0,Z=Z+Math.imul(dt,Se)|0;var ia=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(ia>>>26)|0,ia&=67108863,st=Math.imul(qe,St),et=Math.imul(qe,Ht),et=et+Math.imul(vr,St)|0,Z=Math.imul(vr,Ht),st=st+Math.imul(Me,se)|0,et=et+Math.imul(Me,ke)|0,et=et+Math.imul(Ce,se)|0,Z=Z+Math.imul(Ce,ke)|0,st=st+Math.imul(re,Ue)|0,et=et+Math.imul(re,ir)|0,et=et+Math.imul(Kt,Ue)|0,Z=Z+Math.imul(Kt,ir)|0,st=st+Math.imul(bt,Ye)|0,et=et+Math.imul(bt,Er)|0,et=et+Math.imul(vt,Ye)|0,Z=Z+Math.imul(vt,Er)|0,st=st+Math.imul(ee,dn)|0,et=et+Math.imul(ee,bn)|0,et=et+Math.imul(Zt,dn)|0,Z=Z+Math.imul(Zt,bn)|0,st=st+Math.imul(Nt,En)|0,et=et+Math.imul(Nt,gn)|0,et=et+Math.imul(te,En)|0,Z=Z+Math.imul(te,gn)|0,st=st+Math.imul(wt,ra)|0,et=et+Math.imul(wt,Se)|0,et=et+Math.imul(Ct,ra)|0,Z=Z+Math.imul(Ct,Se)|0;var Cn=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,st=Math.imul(qe,se),et=Math.imul(qe,ke),et=et+Math.imul(vr,se)|0,Z=Math.imul(vr,ke),st=st+Math.imul(Me,Ue)|0,et=et+Math.imul(Me,ir)|0,et=et+Math.imul(Ce,Ue)|0,Z=Z+Math.imul(Ce,ir)|0,st=st+Math.imul(re,Ye)|0,et=et+Math.imul(re,Er)|0,et=et+Math.imul(Kt,Ye)|0,Z=Z+Math.imul(Kt,Er)|0,st=st+Math.imul(bt,dn)|0,et=et+Math.imul(bt,bn)|0,et=et+Math.imul(vt,dn)|0,Z=Z+Math.imul(vt,bn)|0,st=st+Math.imul(ee,En)|0,et=et+Math.imul(ee,gn)|0,et=et+Math.imul(Zt,En)|0,Z=Z+Math.imul(Zt,gn)|0,st=st+Math.imul(Nt,ra)|0,et=et+Math.imul(Nt,Se)|0,et=et+Math.imul(te,ra)|0,Z=Z+Math.imul(te,Se)|0;var Fa=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(Fa>>>26)|0,Fa&=67108863,st=Math.imul(qe,Ue),et=Math.imul(qe,ir),et=et+Math.imul(vr,Ue)|0,Z=Math.imul(vr,ir),st=st+Math.imul(Me,Ye)|0,et=et+Math.imul(Me,Er)|0,et=et+Math.imul(Ce,Ye)|0,Z=Z+Math.imul(Ce,Er)|0,st=st+Math.imul(re,dn)|0,et=et+Math.imul(re,bn)|0,et=et+Math.imul(Kt,dn)|0,Z=Z+Math.imul(Kt,bn)|0,st=st+Math.imul(bt,En)|0,et=et+Math.imul(bt,gn)|0,et=et+Math.imul(vt,En)|0,Z=Z+Math.imul(vt,gn)|0,st=st+Math.imul(ee,ra)|0,et=et+Math.imul(ee,Se)|0,et=et+Math.imul(Zt,ra)|0,Z=Z+Math.imul(Zt,Se)|0;var Ga=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(Ga>>>26)|0,Ga&=67108863,st=Math.imul(qe,Ye),et=Math.imul(qe,Er),et=et+Math.imul(vr,Ye)|0,Z=Math.imul(vr,Er),st=st+Math.imul(Me,dn)|0,et=et+Math.imul(Me,bn)|0,et=et+Math.imul(Ce,dn)|0,Z=Z+Math.imul(Ce,bn)|0,st=st+Math.imul(re,En)|0,et=et+Math.imul(re,gn)|0,et=et+Math.imul(Kt,En)|0,Z=Z+Math.imul(Kt,gn)|0,st=st+Math.imul(bt,ra)|0,et=et+Math.imul(bt,Se)|0,et=et+Math.imul(vt,ra)|0,Z=Z+Math.imul(vt,Se)|0;var ve=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(ve>>>26)|0,ve&=67108863,st=Math.imul(qe,dn),et=Math.imul(qe,bn),et=et+Math.imul(vr,dn)|0,Z=Math.imul(vr,bn),st=st+Math.imul(Me,En)|0,et=et+Math.imul(Me,gn)|0,et=et+Math.imul(Ce,En)|0,Z=Z+Math.imul(Ce,gn)|0,st=st+Math.imul(re,ra)|0,et=et+Math.imul(re,Se)|0,et=et+Math.imul(Kt,ra)|0,Z=Z+Math.imul(Kt,Se)|0;var ge=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(ge>>>26)|0,ge&=67108863,st=Math.imul(qe,En),et=Math.imul(qe,gn),et=et+Math.imul(vr,En)|0,Z=Math.imul(vr,gn),st=st+Math.imul(Me,ra)|0,et=et+Math.imul(Me,Se)|0,et=et+Math.imul(Ce,ra)|0,Z=Z+Math.imul(Ce,Se)|0;var dr=(ct+st|0)+((et&8191)<<13)|0;ct=(Z+(et>>>13)|0)+(dr>>>26)|0,dr&=67108863,st=Math.imul(qe,ra),et=Math.imul(qe,Se),et=et+Math.imul(vr,ra)|0,Z=Math.imul(vr,Se);var br=(ct+st|0)+((et&8191)<<13)|0;return ct=(Z+(et>>>13)|0)+(br>>>26)|0,br&=67108863,rt[0]=Re,rt[1]=Ze,rt[2]=tr,rt[3]=zr,rt[4]=tn,rt[5]=Yr,rt[6]=$r,rt[7]=In,rt[8]=Nn,rt[9]=Kn,rt[10]=$n,rt[11]=ia,rt[12]=Cn,rt[13]=Fa,rt[14]=Ga,rt[15]=ve,rt[16]=ge,rt[17]=dr,rt[18]=br,ct!==0&&(rt[19]=ct,j.length++),j};Math.imul||(k=S);function M(I,F,j){j.negative=F.negative^I.negative,j.length=I.length+F.length;for(var N=0,G=0,rt=0;rt>>26)|0,G+=ct>>>26,ct&=67108863}j.words[rt]=st,N=ct,ct=G}return N!==0?j.words[rt]=N:j.length--,j.strip()}function T(I,F,j){var N=new c;return N.mulp(I,F,j)}s.prototype.mulTo=function(I,F){var j,N=this.length+I.length;return this.length===10&&I.length===10?j=k(this,I,F):N<63?j=S(this,I,F):N<1024?j=M(this,I,F):j=T(this,I,F),j};function c(I,F){this.x=I,this.y=F}c.prototype.makeRBT=function(I){for(var F=new Array(I),j=s.prototype._countBits(I)-1,N=0;N>=1;return N},c.prototype.permute=function(I,F,j,N,G,rt){for(var ct=0;ct>>1)G++;return 1<>>13,j[2*rt+1]=G&8191,G=G>>>13;for(rt=2*F;rt>=26,F+=N/67108864|0,F+=G>>>26,this.words[j]=G&67108863}return F!==0&&(this.words[j]=F,this.length++),this},s.prototype.muln=function(I){return this.clone().imuln(I)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(I){var F=y(I);if(F.length===0)return new s(1);for(var j=this,N=0;N=0);var F=I%26,j=(I-F)/26,N=67108863>>>26-F<<26-F,G;if(F!==0){var rt=0;for(G=0;G>>26-F}rt&&(this.words[G]=rt,this.length++)}if(j!==0){for(G=this.length-1;G>=0;G--)this.words[G+j]=this.words[G];for(G=0;G=0);var N;F?N=(F-F%26)/26:N=0;var G=I%26,rt=Math.min((I-G)/26,this.length),ct=67108863^67108863>>>G<rt)for(this.length-=rt,et=0;et=0&&(Z!==0||et>=N);et--){var ot=this.words[et]|0;this.words[et]=Z<<26-G|ot>>>G,Z=ot&ct}return st&&Z!==0&&(st.words[st.length++]=Z),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(I,F,j){return o(this.negative===0),this.iushrn(I,F,j)},s.prototype.shln=function(I){return this.clone().ishln(I)},s.prototype.ushln=function(I){return this.clone().iushln(I)},s.prototype.shrn=function(I){return this.clone().ishrn(I)},s.prototype.ushrn=function(I){return this.clone().iushrn(I)},s.prototype.testn=function(I){o(typeof I=="number"&&I>=0);var F=I%26,j=(I-F)/26,N=1<=0);var F=I%26,j=(I-F)/26;if(o(this.negative===0,"imaskn works only with positive numbers"),this.length<=j)return this;if(F!==0&&j++,this.length=Math.min(j,this.length),F!==0){var N=67108863^67108863>>>F<=67108864;F++)this.words[F]-=67108864,F===this.length-1?this.words[F+1]=1:this.words[F+1]++;return this.length=Math.max(this.length,F+1),this},s.prototype.isubn=function(I){if(o(typeof I=="number"),o(I<67108864),I<0)return this.iaddn(-I);if(this.negative!==0)return this.negative=0,this.iaddn(I),this.negative=1,this;if(this.words[0]-=I,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var F=0;F>26)-(st/67108864|0),this.words[G+j]=rt&67108863}for(;G>26,this.words[G+j]=rt&67108863;if(ct===0)return this.strip();for(o(ct===-1),ct=0,G=0;G>26,this.words[G]=rt&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(I,F){var j=this.length-I.length,N=this.clone(),G=I,rt=G.words[G.length-1]|0,ct=this._countBits(rt);j=26-ct,j!==0&&(G=G.ushln(j),N.iushln(j),rt=G.words[G.length-1]|0);var st=N.length-G.length,et;if(F!=="mod"){et=new s(null),et.length=st+1,et.words=new Array(et.length);for(var Z=0;Z=0;X--){var Q=(N.words[G.length+X]|0)*67108864+(N.words[G.length+X-1]|0);for(Q=Math.min(Q/rt|0,67108863),N._ishlnsubmul(G,Q,X);N.negative!==0;)Q--,N.negative=0,N._ishlnsubmul(G,1,X),N.isZero()||(N.negative^=1);et&&(et.words[X]=Q)}return et&&et.strip(),N.strip(),F!=="div"&&j!==0&&N.iushrn(j),{div:et||null,mod:N}},s.prototype.divmod=function(I,F,j){if(o(!I.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var N,G,rt;return this.negative!==0&&I.negative===0?(rt=this.neg().divmod(I,F),F!=="mod"&&(N=rt.div.neg()),F!=="div"&&(G=rt.mod.neg(),j&&G.negative!==0&&G.iadd(I)),{div:N,mod:G}):this.negative===0&&I.negative!==0?(rt=this.divmod(I.neg(),F),F!=="mod"&&(N=rt.div.neg()),{div:N,mod:rt.mod}):(this.negative&I.negative)!==0?(rt=this.neg().divmod(I.neg(),F),F!=="div"&&(G=rt.mod.neg(),j&&G.negative!==0&&G.isub(I)),{div:rt.div,mod:G}):I.length>this.length||this.cmp(I)<0?{div:new s(0),mod:this}:I.length===1?F==="div"?{div:this.divn(I.words[0]),mod:null}:F==="mod"?{div:null,mod:new s(this.modn(I.words[0]))}:{div:this.divn(I.words[0]),mod:new s(this.modn(I.words[0]))}:this._wordDiv(I,F)},s.prototype.div=function(I){return this.divmod(I,"div",!1).div},s.prototype.mod=function(I){return this.divmod(I,"mod",!1).mod},s.prototype.umod=function(I){return this.divmod(I,"mod",!0).mod},s.prototype.divRound=function(I){var F=this.divmod(I);if(F.mod.isZero())return F.div;var j=F.div.negative!==0?F.mod.isub(I):F.mod,N=I.ushrn(1),G=I.andln(1),rt=j.cmp(N);return rt<0||G===1&&rt===0?F.div:F.div.negative!==0?F.div.isubn(1):F.div.iaddn(1)},s.prototype.modn=function(I){o(I<=67108863);for(var F=67108864%I,j=0,N=this.length-1;N>=0;N--)j=(F*j+(this.words[N]|0))%I;return j},s.prototype.idivn=function(I){o(I<=67108863);for(var F=0,j=this.length-1;j>=0;j--){var N=(this.words[j]|0)+F*67108864;this.words[j]=N/I|0,F=N%I}return this.strip()},s.prototype.divn=function(I){return this.clone().idivn(I)},s.prototype.egcd=function(I){o(I.negative===0),o(!I.isZero());var F=this,j=I.clone();F.negative!==0?F=F.umod(I):F=F.clone();for(var N=new s(1),G=new s(0),rt=new s(0),ct=new s(1),st=0;F.isEven()&&j.isEven();)F.iushrn(1),j.iushrn(1),++st;for(var et=j.clone(),Z=F.clone();!F.isZero();){for(var ot=0,X=1;(F.words[0]&X)===0&&ot<26;++ot,X<<=1);if(ot>0)for(F.iushrn(ot);ot-- >0;)(N.isOdd()||G.isOdd())&&(N.iadd(et),G.isub(Z)),N.iushrn(1),G.iushrn(1);for(var Q=0,ut=1;(j.words[0]&ut)===0&&Q<26;++Q,ut<<=1);if(Q>0)for(j.iushrn(Q);Q-- >0;)(rt.isOdd()||ct.isOdd())&&(rt.iadd(et),ct.isub(Z)),rt.iushrn(1),ct.iushrn(1);F.cmp(j)>=0?(F.isub(j),N.isub(rt),G.isub(ct)):(j.isub(F),rt.isub(N),ct.isub(G))}return{a:rt,b:ct,gcd:j.iushln(st)}},s.prototype._invmp=function(I){o(I.negative===0),o(!I.isZero());var F=this,j=I.clone();F.negative!==0?F=F.umod(I):F=F.clone();for(var N=new s(1),G=new s(0),rt=j.clone();F.cmpn(1)>0&&j.cmpn(1)>0;){for(var ct=0,st=1;(F.words[0]&st)===0&&ct<26;++ct,st<<=1);if(ct>0)for(F.iushrn(ct);ct-- >0;)N.isOdd()&&N.iadd(rt),N.iushrn(1);for(var et=0,Z=1;(j.words[0]&Z)===0&&et<26;++et,Z<<=1);if(et>0)for(j.iushrn(et);et-- >0;)G.isOdd()&&G.iadd(rt),G.iushrn(1);F.cmp(j)>=0?(F.isub(j),N.isub(G)):(j.isub(F),G.isub(N))}var ot;return F.cmpn(1)===0?ot=N:ot=G,ot.cmpn(0)<0&&ot.iadd(I),ot},s.prototype.gcd=function(I){if(this.isZero())return I.abs();if(I.isZero())return this.abs();var F=this.clone(),j=I.clone();F.negative=0,j.negative=0;for(var N=0;F.isEven()&&j.isEven();N++)F.iushrn(1),j.iushrn(1);do{for(;F.isEven();)F.iushrn(1);for(;j.isEven();)j.iushrn(1);var G=F.cmp(j);if(G<0){var rt=F;F=j,j=rt}else if(G===0||j.cmpn(1)===0)break;F.isub(j)}while(!0);return j.iushln(N)},s.prototype.invm=function(I){return this.egcd(I).a.umod(I)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(I){return this.words[0]&I},s.prototype.bincn=function(I){o(typeof I=="number");var F=I%26,j=(I-F)/26,N=1<>>26,ct&=67108863,this.words[rt]=ct}return G!==0&&(this.words[rt]=G,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(I){var F=I<0;if(this.negative!==0&&!F)return-1;if(this.negative===0&&F)return 1;this.strip();var j;if(this.length>1)j=1;else{F&&(I=-I),o(I<=67108863,"Number is too big");var N=this.words[0]|0;j=N===I?0:NI.length)return 1;if(this.length=0;j--){var N=this.words[j]|0,G=I.words[j]|0;if(N!==G){NG&&(F=1);break}}return F},s.prototype.gtn=function(I){return this.cmpn(I)===1},s.prototype.gt=function(I){return this.cmp(I)===1},s.prototype.gten=function(I){return this.cmpn(I)>=0},s.prototype.gte=function(I){return this.cmp(I)>=0},s.prototype.ltn=function(I){return this.cmpn(I)===-1},s.prototype.lt=function(I){return this.cmp(I)===-1},s.prototype.lten=function(I){return this.cmpn(I)<=0},s.prototype.lte=function(I){return this.cmp(I)<=0},s.prototype.eqn=function(I){return this.cmpn(I)===0},s.prototype.eq=function(I){return this.cmp(I)===0},s.red=function(I){return new B(I)},s.prototype.toRed=function(I){return o(!this.red,"Already a number in reduction context"),o(this.negative===0,"red works only with positives"),I.convertTo(this)._forceRed(I)},s.prototype.fromRed=function(){return o(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(I){return this.red=I,this},s.prototype.forceRed=function(I){return o(!this.red,"Already a number in reduction context"),this._forceRed(I)},s.prototype.redAdd=function(I){return o(this.red,"redAdd works only with red numbers"),this.red.add(this,I)},s.prototype.redIAdd=function(I){return o(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,I)},s.prototype.redSub=function(I){return o(this.red,"redSub works only with red numbers"),this.red.sub(this,I)},s.prototype.redISub=function(I){return o(this.red,"redISub works only with red numbers"),this.red.isub(this,I)},s.prototype.redShl=function(I){return o(this.red,"redShl works only with red numbers"),this.red.shl(this,I)},s.prototype.redMul=function(I){return o(this.red,"redMul works only with red numbers"),this.red._verify2(this,I),this.red.mul(this,I)},s.prototype.redIMul=function(I){return o(this.red,"redMul works only with red numbers"),this.red._verify2(this,I),this.red.imul(this,I)},s.prototype.redSqr=function(){return o(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return o(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return o(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return o(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return o(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(I){return o(this.red&&!I.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,I)};var h={k256:null,p224:null,p192:null,p25519:null};function b(I,F){this.name=I,this.p=new s(F,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}b.prototype._tmp=function(){var I=new s(null);return I.words=new Array(Math.ceil(this.n/13)),I},b.prototype.ireduce=function(I){var F=I,j;do this.split(F,this.tmp),F=this.imulK(F),F=F.iadd(this.tmp),j=F.bitLength();while(j>this.n);var N=j0?F.isub(this.p):F.strip!==void 0?F.strip():F._strip(),F},b.prototype.split=function(I,F){I.iushrn(this.n,0,F)},b.prototype.imulK=function(I){return I.imul(this.k)};function _(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}a(_,b),_.prototype.split=function(I,F){for(var j=4194303,N=Math.min(I.length,9),G=0;G>>22,rt=ct}rt>>>=22,I.words[G-10]=rt,rt===0&&I.length>10?I.length-=10:I.length-=9},_.prototype.imulK=function(I){I.words[I.length]=0,I.words[I.length+1]=0,I.length+=2;for(var F=0,j=0;j>>=26,I.words[j]=G,F=N}return F!==0&&(I.words[I.length++]=F),I},s._prime=function(I){if(h[I])return h[I];var F;if(I==="k256")F=new _;else if(I==="p224")F=new P;else if(I==="p192")F=new z;else if(I==="p25519")F=new D;else throw new Error("Unknown prime "+I);return h[I]=F,F};function B(I){if(typeof I=="string"){var F=s._prime(I);this.m=F.p,this.prime=F}else o(I.gtn(1),"modulus must be greater than 1"),this.m=I,this.prime=null}B.prototype._verify1=function(I){o(I.negative===0,"red works only with positives"),o(I.red,"red works only with red numbers")},B.prototype._verify2=function(I,F){o((I.negative|F.negative)===0,"red works only with positives"),o(I.red&&I.red===F.red,"red works only with red numbers")},B.prototype.imod=function(I){return this.prime?this.prime.ireduce(I)._forceRed(this):I.umod(this.m)._forceRed(this)},B.prototype.neg=function(I){return I.isZero()?I.clone():this.m.sub(I)._forceRed(this)},B.prototype.add=function(I,F){this._verify2(I,F);var j=I.add(F);return j.cmp(this.m)>=0&&j.isub(this.m),j._forceRed(this)},B.prototype.iadd=function(I,F){this._verify2(I,F);var j=I.iadd(F);return j.cmp(this.m)>=0&&j.isub(this.m),j},B.prototype.sub=function(I,F){this._verify2(I,F);var j=I.sub(F);return j.cmpn(0)<0&&j.iadd(this.m),j._forceRed(this)},B.prototype.isub=function(I,F){this._verify2(I,F);var j=I.isub(F);return j.cmpn(0)<0&&j.iadd(this.m),j},B.prototype.shl=function(I,F){return this._verify1(I),this.imod(I.ushln(F))},B.prototype.imul=function(I,F){return this._verify2(I,F),this.imod(I.imul(F))},B.prototype.mul=function(I,F){return this._verify2(I,F),this.imod(I.mul(F))},B.prototype.isqr=function(I){return this.imul(I,I.clone())},B.prototype.sqr=function(I){return this.mul(I,I)},B.prototype.sqrt=function(I){if(I.isZero())return I.clone();var F=this.m.andln(3);if(o(F%2===1),F===3){var j=this.m.add(new s(1)).iushrn(2);return this.pow(I,j)}for(var N=this.m.subn(1),G=0;!N.isZero()&&N.andln(1)===0;)G++,N.iushrn(1);o(!N.isZero());var rt=new s(1).toRed(this),ct=rt.redNeg(),st=this.m.subn(1).iushrn(1),et=this.m.bitLength();for(et=new s(2*et*et).toRed(this);this.pow(et,st).cmp(ct)!==0;)et.redIAdd(ct);for(var Z=this.pow(et,N),ot=this.pow(I,N.addn(1).iushrn(1)),X=this.pow(I,N),Q=G;X.cmp(rt)!==0;){for(var ut=X,J=0;ut.cmp(rt)!==0;J++)ut=ut.redSqr();o(J=0;G--){for(var Z=F.words[G],ot=et-1;ot>=0;ot--){var X=Z>>ot&1;if(rt!==N[0]&&(rt=this.sqr(rt)),X===0&&ct===0){st=0;continue}ct<<=1,ct|=X,st++,!(st!==j&&(G!==0||ot!==0))&&(rt=this.mul(rt,N[ct]),st=0,ct=0)}et=26}return rt},B.prototype.convertTo=function(I){var F=I.umod(this.m);return F===I?F.clone():F},B.prototype.convertFrom=function(I){var F=I.clone();return F.red=null,F},s.mont=function(I){return new R(I)};function R(I){B.call(this,I),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}a(R,B),R.prototype.convertTo=function(I){return this.imod(I.ushln(this.shift))},R.prototype.convertFrom=function(I){var F=this.imod(I.mul(this.rinv));return F.red=null,F},R.prototype.imul=function(I,F){if(I.isZero()||F.isZero())return I.words[0]=0,I.length=1,I;var j=I.imul(F),N=j.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),G=j.isub(N).iushrn(this.shift),rt=G;return G.cmp(this.m)>=0?rt=G.isub(this.m):G.cmpn(0)<0&&(rt=G.iadd(this.m)),rt._forceRed(this)},R.prototype.mul=function(I,F){if(I.isZero()||F.isZero())return new s(0)._forceRed(this);var j=I.mul(F),N=j.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),G=j.isub(N).iushrn(this.shift),rt=G;return G.cmp(this.m)>=0?rt=G.isub(this.m):G.cmpn(0)<0&&(rt=G.iadd(this.m)),rt._forceRed(this)},R.prototype.invm=function(I){var F=this.imod(I._invmp(this.m).mul(this.r2));return F._forceRed(this)}})(t,this)},6860:function(t){t.exports=e;function e(r,i,n){return r[0]=i[0]-n[0],r[1]=i[1]-n[1],r[2]=i[2]-n[2],r[3]=i[3]-n[3],r}},6864:function(t){t.exports=e;function e(){var r=new Float32Array(16);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}},6867:function(t,e,r){t.exports=l;var i=r(1888),n=r(855),o=r(7150);function a(x,y){for(var S=0;S>>1;if(!(c<=0)){var h,b=i.mallocDouble(2*c*M),_=i.mallocInt32(M);if(M=s(x,c,b,_),M>0){if(c===1&&k)n.init(M),h=n.sweepComplete(c,S,0,M,b,_,0,M,b,_);else{var P=i.mallocDouble(2*c*T),z=i.mallocInt32(T);T=s(y,c,P,z),T>0&&(n.init(M+T),c===1?h=n.sweepBipartite(c,S,0,M,b,_,0,T,P,z):h=o(c,S,k,M,b,_,T,P,z),i.free(P),i.free(z))}i.free(b),i.free(_)}return h}}}var v;function g(x,y){v.push([x,y])}function m(x){return v=[],f(x,x,g,!0),v}function w(x,y){return v=[],f(x,y,g,!1),v}function l(x,y,S){switch(arguments.length){case 1:return m(x);case 2:return typeof y=="function"?f(x,x,y,!0):w(x,y);case 3:return f(x,y,S,!1);default:throw new Error("box-intersect: Invalid arguments")}}},6894:function(t){t.exports=e;function e(r,i,n,o){var a=n[1],s=n[2],f=i[1]-a,v=i[2]-s,g=Math.sin(o),m=Math.cos(o);return r[0]=i[0],r[1]=a+f*m-v*g,r[2]=s+f*g+v*m,r}},7004:function(t){t.exports=e;function e(r){for(var i=r.length,n=r[r.length-1],o=i,a=i-2;a>=0;--a){var s=n,f=r[a];n=s+f;var v=n-s,g=f-v;g&&(r[--o]=n,n=g)}for(var m=0,a=o;a=p0)&&!(p1>=hi)"),y=g("lo===p0"),S=g("lo0;){ot-=1;var ut=ot*c,J=_[ut],q=_[ut+1],it=_[ut+2],nt=_[ut+3],dt=_[ut+4],Tt=_[ut+5],wt=ot*h,Ct=P[wt],It=P[wt+1],Nt=Tt&1,te=!!(Tt&16),Jt=rt,ee=ct,Zt=et,mt=Z;if(Nt&&(Jt=et,ee=Z,Zt=rt,mt=ct),!(Tt&2&&(it=S(F,J,q,it,Jt,ee,It),q>=it))&&!(Tt&4&&(q=k(F,J,q,it,Jt,ee,Ct),q>=it))){var bt=it-q,vt=dt-nt;if(te){if(F*bt*(bt+vt)"u"?r(1538):WeakMap,n=r(2762),o=r(8116),a=new i;function s(f){var v=a.get(f),g=v&&(v._triangleBuffer.handle||v._triangleBuffer.buffer);if(!g||!f.isBuffer(g)){var m=n(f,new Float32Array([-1,-1,-1,4,4,-1]));v=o(f,[{buffer:m,type:f.FLOAT,size:2}]),v._triangleBuffer=m,a.set(f,v)}v.bind(),f.drawArrays(f.TRIANGLES,0,3),v.unbind()}t.exports=s},7182:function(t,e,r){var i={identity:r(7894),translate:r(7656),multiply:r(6760),create:r(6864),scale:r(2504),fromRotationTranslation:r(6743)};i.create();var n=i.create();t.exports=function(o,a,s,f,v,g){return i.identity(o),i.fromRotationTranslation(o,g,a),o[3]=v[0],o[7]=v[1],o[11]=v[2],o[15]=v[3],i.identity(n),f[2]!==0&&(n[9]=f[2],i.multiply(o,o,n)),f[1]!==0&&(n[9]=0,n[8]=f[1],i.multiply(o,o,n)),f[0]!==0&&(n[8]=0,n[4]=f[0],i.multiply(o,o,n)),i.scale(o,o,s),o}},7201:function(t,e,r){var i=1e-6,n=1e-6,o=r(9405),a=r(2762),s=r(8116),f=r(7766),v=r(8406),g=r(6760),m=r(7608),w=r(9618),l=r(6729),x=r(7765),y=r(1888),S=r(840),k=r(7626),M=S.meshShader,T=S.wireShader,c=S.pointShader,h=S.pickShader,b=S.pointPickShader,_=S.contourShader,P=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function z(et,Z,ot,X,Q,ut,J,q,it,nt,dt,Tt,wt,Ct,It,Nt,te,Jt,ee,Zt,mt,bt,vt,Ut,re,Kt,ue){this.gl=et,this.pixelRatio=1,this.cells=[],this.positions=[],this.intensity=[],this.texture=Z,this.dirty=!0,this.triShader=ot,this.lineShader=X,this.pointShader=Q,this.pickShader=ut,this.pointPickShader=J,this.contourShader=q,this.trianglePositions=it,this.triangleColors=dt,this.triangleNormals=wt,this.triangleUVs=Tt,this.triangleIds=nt,this.triangleVAO=Ct,this.triangleCount=0,this.lineWidth=1,this.edgePositions=It,this.edgeColors=te,this.edgeUVs=Jt,this.edgeIds=Nt,this.edgeVAO=ee,this.edgeCount=0,this.pointPositions=Zt,this.pointColors=bt,this.pointUVs=vt,this.pointSizes=Ut,this.pointIds=mt,this.pointVAO=re,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=Kt,this.contourVAO=ue,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickVertex=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this.hasAlpha=!1,this.opacityscale=!1,this._model=P,this._view=P,this._projection=P,this._resolution=[1,1]}var D=z.prototype;D.isOpaque=function(){return!this.hasAlpha},D.isTransparent=function(){return this.hasAlpha},D.pickSlots=1,D.setPickBase=function(et){this.pickId=et};function B(et,Z){if(!Z||!Z.length)return 1;for(var ot=0;otet&&ot>0){var X=(Z[ot][0]-et)/(Z[ot][0]-Z[ot-1][0]);return Z[ot][1]*(1-X)+X*Z[ot-1][1]}}return 1}function R(et,Z){for(var ot=l({colormap:et,nshades:256,format:"rgba"}),X=new Uint8Array(1024),Q=0;Q<256;++Q){for(var ut=ot[Q],J=0;J<3;++J)X[4*Q+J]=ut[J];Z?X[4*Q+3]=255*B(Q/255,Z):X[4*Q+3]=255*ut[3]}return w(X,[256,256,4],[4,0,1])}function I(et){for(var Z=et.length,ot=new Array(Z),X=0;X0){var wt=this.triShader;wt.bind(),wt.uniforms=q,this.triangleVAO.bind(),Z.drawArrays(Z.TRIANGLES,0,this.triangleCount*3),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var wt=this.lineShader;wt.bind(),wt.uniforms=q,this.edgeVAO.bind(),Z.lineWidth(this.lineWidth*this.pixelRatio),Z.drawArrays(Z.LINES,0,this.edgeCount*2),this.edgeVAO.unbind()}if(this.pointCount>0){var wt=this.pointShader;wt.bind(),wt.uniforms=q,this.pointVAO.bind(),Z.drawArrays(Z.POINTS,0,this.pointCount),this.pointVAO.unbind()}if(this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0){var wt=this.contourShader;wt.bind(),wt.uniforms=q,this.contourVAO.bind(),Z.drawArrays(Z.LINES,0,this.contourCount),this.contourVAO.unbind()}},D.drawPick=function(et){et=et||{};for(var Z=this.gl,ot=et.model||P,X=et.view||P,Q=et.projection||P,ut=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],J=0;J<3;++J)ut[0][J]=Math.max(ut[0][J],this.clipBounds[0][J]),ut[1][J]=Math.min(ut[1][J],this.clipBounds[1][J]);this._model=[].slice.call(ot),this._view=[].slice.call(X),this._projection=[].slice.call(Q),this._resolution=[Z.drawingBufferWidth,Z.drawingBufferHeight];var q={model:ot,view:X,projection:Q,clipBounds:ut,pickId:this.pickId/255},it=this.pickShader;if(it.bind(),it.uniforms=q,this.triangleCount>0&&(this.triangleVAO.bind(),Z.drawArrays(Z.TRIANGLES,0,this.triangleCount*3),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),Z.lineWidth(this.lineWidth*this.pixelRatio),Z.drawArrays(Z.LINES,0,this.edgeCount*2),this.edgeVAO.unbind()),this.pointCount>0){var it=this.pointPickShader;it.bind(),it.uniforms=q,this.pointVAO.bind(),Z.drawArrays(Z.POINTS,0,this.pointCount),this.pointVAO.unbind()}},D.pick=function(et){if(!et||et.id!==this.pickId)return null;for(var Z=et.value[0]+256*et.value[1]+65536*et.value[2],ot=this.cells[Z],X=this.positions,Q=new Array(ot.length),ut=0;utMath.max(M,T)?c[2]=1:M>Math.max(k,T)?c[0]=1:c[1]=1;for(var h=0,b=0,_=0;_<3;++_)h+=S[_]*S[_],b+=c[_]*S[_];for(var _=0;_<3;++_)c[_]-=b/h*S[_];return s(c,c),c}function w(S,k,M,T,c,h,b,_){this.center=i(M),this.up=i(T),this.right=i(c),this.radius=i([h]),this.angle=i([b,_]),this.angle.bounds=[[-1/0,-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(S,k),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var P=0;P<16;++P)this.computedMatrix[P]=.5;this.recalcMatrix(0)}var l=w.prototype;l.setDistanceLimits=function(S,k){S>0?S=Math.log(S):S=-1/0,k>0?k=Math.log(k):k=1/0,k=Math.max(k,S),this.radius.bounds[0][0]=S,this.radius.bounds[1][0]=k},l.getDistanceLimits=function(S){var k=this.radius.bounds[0];return S?(S[0]=Math.exp(k[0][0]),S[1]=Math.exp(k[1][0]),S):[Math.exp(k[0][0]),Math.exp(k[1][0])]},l.recalcMatrix=function(S){this.center.curve(S),this.up.curve(S),this.right.curve(S),this.radius.curve(S),this.angle.curve(S);for(var k=this.computedUp,M=this.computedRight,T=0,c=0,h=0;h<3;++h)c+=k[h]*M[h],T+=k[h]*k[h];for(var b=Math.sqrt(T),_=0,h=0;h<3;++h)M[h]-=k[h]*c/T,_+=M[h]*M[h],k[h]/=b;for(var P=Math.sqrt(_),h=0;h<3;++h)M[h]/=P;var z=this.computedToward;a(z,k,M),s(z,z);for(var D=Math.exp(this.computedRadius[0]),B=this.computedAngle[0],R=this.computedAngle[1],I=Math.cos(B),F=Math.sin(B),j=Math.cos(R),N=Math.sin(R),G=this.computedCenter,rt=I*j,ct=F*j,st=N,et=-I*N,Z=-F*N,ot=j,X=this.computedEye,Q=this.computedMatrix,h=0;h<3;++h){var ut=rt*M[h]+ct*z[h]+st*k[h];Q[4*h+1]=et*M[h]+Z*z[h]+ot*k[h],Q[4*h+2]=ut,Q[4*h+3]=0}var J=Q[1],q=Q[5],it=Q[9],nt=Q[2],dt=Q[6],Tt=Q[10],wt=q*Tt-it*dt,Ct=it*nt-J*Tt,It=J*dt-q*nt,Nt=v(wt,Ct,It);wt/=Nt,Ct/=Nt,It/=Nt,Q[0]=wt,Q[4]=Ct,Q[8]=It;for(var h=0;h<3;++h)X[h]=G[h]+Q[2+4*h]*D;for(var h=0;h<3;++h){for(var _=0,te=0;te<3;++te)_+=Q[h+4*te]*X[te];Q[12+h]=-_}Q[15]=1},l.getMatrix=function(S,k){this.recalcMatrix(S);var M=this.computedMatrix;if(k){for(var T=0;T<16;++T)k[T]=M[T];return k}return M};var x=[0,0,0];l.rotate=function(S,k,M,T){if(this.angle.move(S,k,M),T){this.recalcMatrix(S);var c=this.computedMatrix;x[0]=c[2],x[1]=c[6],x[2]=c[10];for(var h=this.computedUp,b=this.computedRight,_=this.computedToward,P=0;P<3;++P)c[4*P]=h[P],c[4*P+1]=b[P],c[4*P+2]=_[P];o(c,c,T,x);for(var P=0;P<3;++P)h[P]=c[4*P],b[P]=c[4*P+1];this.up.set(S,h[0],h[1],h[2]),this.right.set(S,b[0],b[1],b[2])}},l.pan=function(S,k,M,T){k=k||0,M=M||0,T=T||0,this.recalcMatrix(S);var c=this.computedMatrix;Math.exp(this.computedRadius[0]);var h=c[1],b=c[5],_=c[9],P=v(h,b,_);h/=P,b/=P,_/=P;var z=c[0],D=c[4],B=c[8],R=z*h+D*b+B*_;z-=h*R,D-=b*R,B-=_*R;var I=v(z,D,B);z/=I,D/=I,B/=I;var F=z*k+h*M,j=D*k+b*M,N=B*k+_*M;this.center.move(S,F,j,N);var G=Math.exp(this.computedRadius[0]);G=Math.max(1e-4,G+T),this.radius.set(S,Math.log(G))},l.translate=function(S,k,M,T){this.center.move(S,k||0,M||0,T||0)},l.setMatrix=function(S,k,M,T){var c=1;typeof M=="number"&&(c=M|0),(c<0||c>3)&&(c=1);var h=(c+2)%3;k||(this.recalcMatrix(S),k=this.computedMatrix);var b=k[c],_=k[c+4],P=k[c+8];if(T){var z=Math.abs(b),D=Math.abs(_),B=Math.abs(P),R=Math.max(z,D,B);z===R?(b=b<0?-1:1,_=P=0):B===R?(P=P<0?-1:1,b=_=0):(_=_<0?-1:1,b=P=0)}else{var I=v(b,_,P);b/=I,_/=I,P/=I}var F=k[h],j=k[h+4],N=k[h+8],G=F*b+j*_+N*P;F-=b*G,j-=_*G,N-=P*G;var rt=v(F,j,N);F/=rt,j/=rt,N/=rt;var ct=_*N-P*j,st=P*F-b*N,et=b*j-_*F,Z=v(ct,st,et);ct/=Z,st/=Z,et/=Z,this.center.jump(S,mt,bt,vt),this.radius.idle(S),this.up.jump(S,b,_,P),this.right.jump(S,F,j,N);var ot,X;if(c===2){var Q=k[1],ut=k[5],J=k[9],q=Q*F+ut*j+J*N,it=Q*ct+ut*st+J*et;wt<0?ot=-Math.PI/2:ot=Math.PI/2,X=Math.atan2(it,q)}else{var nt=k[2],dt=k[6],Tt=k[10],wt=nt*b+dt*_+Tt*P,Ct=nt*F+dt*j+Tt*N,It=nt*ct+dt*st+Tt*et;ot=Math.asin(g(wt)),X=Math.atan2(It,Ct)}this.angle.jump(S,X,ot),this.recalcMatrix(S);var Nt=k[2],te=k[6],Jt=k[10],ee=this.computedMatrix;n(ee,k);var Zt=ee[15],mt=ee[12]/Zt,bt=ee[13]/Zt,vt=ee[14]/Zt,Ut=Math.exp(this.computedRadius[0]);this.center.jump(S,mt-Nt*Ut,bt-te*Ut,vt-Jt*Ut)},l.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},l.idle=function(S){this.center.idle(S),this.up.idle(S),this.right.idle(S),this.radius.idle(S),this.angle.idle(S)},l.flush=function(S){this.center.flush(S),this.up.flush(S),this.right.flush(S),this.radius.flush(S),this.angle.flush(S)},l.setDistance=function(S,k){k>0&&this.radius.set(S,Math.log(k))},l.lookAt=function(S,k,M,T){this.recalcMatrix(S),k=k||this.computedEye,M=M||this.computedCenter,T=T||this.computedUp;var c=T[0],h=T[1],b=T[2],_=v(c,h,b);if(!(_<1e-6)){c/=_,h/=_,b/=_;var P=k[0]-M[0],z=k[1]-M[1],D=k[2]-M[2],B=v(P,z,D);if(!(B<1e-6)){P/=B,z/=B,D/=B;var R=this.computedRight,I=R[0],F=R[1],j=R[2],N=c*I+h*F+b*j;I-=N*c,F-=N*h,j-=N*b;var G=v(I,F,j);if(!(G<.01&&(I=h*D-b*z,F=b*P-c*D,j=c*z-h*P,G=v(I,F,j),G<1e-6))){I/=G,F/=G,j/=G,this.up.set(S,c,h,b),this.right.set(S,I,F,j),this.center.set(S,M[0],M[1],M[2]),this.radius.set(S,Math.log(B));var rt=h*j-b*F,ct=b*I-c*j,st=c*F-h*I,et=v(rt,ct,st);rt/=et,ct/=et,st/=et;var Z=c*P+h*z+b*D,ot=I*P+F*z+j*D,X=rt*P+ct*z+st*D,Q=Math.asin(g(Z)),ut=Math.atan2(X,ot),J=this.angle._state,q=J[J.length-1],it=J[J.length-2];q=q%(2*Math.PI);var nt=Math.abs(q+2*Math.PI-ut),dt=Math.abs(q-ut),Tt=Math.abs(q-2*Math.PI-ut);nt max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform vec3 clipBounds[2]; +uniform sampler2D dashTexture; +uniform float dashScale; +uniform float opacity; + +varying vec3 worldPosition; +varying float pixelArcLength; +varying vec4 fragColor; + +void main() { + if ( + outOfRange(clipBounds[0], clipBounds[1], worldPosition) || + fragColor.a * opacity == 0. + ) discard; + + float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r; + if(dashWeight < 0.5) { + discard; + } + gl_FragColor = fragColor * opacity; +} +`]),s=i([`precision highp float; +#define GLSLIFY 1 + +#define FLOAT_MAX 1.70141184e38 +#define FLOAT_MIN 1.17549435e-38 + +// https://github.com/mikolalysenko/glsl-read-float/blob/master/index.glsl +vec4 packFloat(float v) { + float av = abs(v); + + //Handle special cases + if(av < FLOAT_MIN) { + return vec4(0.0, 0.0, 0.0, 0.0); + } else if(v > FLOAT_MAX) { + return vec4(127.0, 128.0, 0.0, 0.0) / 255.0; + } else if(v < -FLOAT_MAX) { + return vec4(255.0, 128.0, 0.0, 0.0) / 255.0; + } + + vec4 c = vec4(0,0,0,0); + + //Compute exponent and mantissa + float e = floor(log2(av)); + float m = av * pow(2.0, -e) - 1.0; + + //Unpack mantissa + c[1] = floor(128.0 * m); + m -= c[1] / 128.0; + c[2] = floor(32768.0 * m); + m -= c[2] / 32768.0; + c[3] = floor(8388608.0 * m); + + //Unpack exponent + float ebias = e + 127.0; + c[0] = floor(ebias / 2.0); + ebias -= c[0] * 2.0; + c[1] += floor(ebias) * 128.0; + + //Unpack sign bit + c[0] += 128.0 * step(0.0, -v); + + //Scale back to range + return c / 255.0; +} + +bool outOfRange(float a, float b, float p) { + return ((p > max(a, b)) || + (p < min(a, b))); +} + +bool outOfRange(vec2 a, vec2 b, vec2 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y)); +} + +bool outOfRange(vec3 a, vec3 b, vec3 p) { + return (outOfRange(a.x, b.x, p.x) || + outOfRange(a.y, b.y, p.y) || + outOfRange(a.z, b.z, p.z)); +} + +bool outOfRange(vec4 a, vec4 b, vec4 p) { + return outOfRange(a.xyz, b.xyz, p.xyz); +} + +uniform float pickId; +uniform vec3 clipBounds[2]; + +varying vec3 worldPosition; +varying float pixelArcLength; +varying vec4 fragColor; + +void main() { + if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard; + + gl_FragColor = vec4(pickId/255.0, packFloat(pixelArcLength).xyz); +}`]),f=[{name:"position",type:"vec3"},{name:"nextPosition",type:"vec3"},{name:"arcLength",type:"float"},{name:"lineWidth",type:"float"},{name:"color",type:"vec4"}];e.createShader=function(v){return n(v,o,a,null,f)},e.createPickShader=function(v){return n(v,o,s,null,f)}},7352:function(t,e,r){var i=r(5721),n=r(4750),o=r(2690);t.exports=a;function a(s){var f=s.length;if(f===0)return[];if(f===1)return[[0]];var v=s[0].length;return v===0?[]:v===1?i(s):v===2?n(s):o(s,v)}},7399:function(t){t.exports=e;function e(r,i){var n=i[0],o=i[1],a=i[2],s=i[3],f=n+n,v=o+o,g=a+a,m=n*f,w=o*f,l=o*v,x=a*f,y=a*v,S=a*g,k=s*f,M=s*v,T=s*g;return r[0]=1-l-S,r[1]=w+T,r[2]=x-M,r[3]=0,r[4]=w-T,r[5]=1-m-S,r[6]=y+k,r[7]=0,r[8]=x+M,r[9]=y-k,r[10]=1-m-l,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}},7417:function(t){t.exports=e;function e(r,i,n){return r[0]=Math.max(i[0],n[0]),r[1]=Math.max(i[1],n[1]),r[2]=Math.max(i[2],n[2]),r}},7442:function(t,e,r){var i=r(6658),n=r(7182),o=r(2652),a=r(9921),s=r(8648),f=w(),v=w(),g=w();t.exports=m;function m(y,S,k,M){if(a(S)===0||a(k)===0)return!1;var T=o(S,f.translate,f.scale,f.skew,f.perspective,f.quaternion),c=o(k,v.translate,v.scale,v.skew,v.perspective,v.quaternion);return!T||!c?!1:(i(g.translate,f.translate,v.translate,M),i(g.skew,f.skew,v.skew,M),i(g.scale,f.scale,v.scale,M),i(g.perspective,f.perspective,v.perspective,M),s(g.quaternion,f.quaternion,v.quaternion,M),n(y,g.translate,g.scale,g.skew,g.perspective,g.quaternion),!0)}function w(){return{translate:l(),scale:l(1),skew:l(),perspective:x(),quaternion:x()}}function l(y){return[y||0,y||0,y||0]}function x(){return[0,0,0,1]}},7507:function(t,e){e.byteLength=v,e.toByteArray=m,e.fromByteArray=x;for(var r=[],i=[],n=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var k=y.indexOf("=");k===-1&&(k=S);var M=k===S?0:4-k%4;return[k,M]}function v(y){var S=f(y),k=S[0],M=S[1];return(k+M)*3/4-M}function g(y,S,k){return(S+k)*3/4-k}function m(y){var S,k=f(y),M=k[0],T=k[1],c=new n(g(y,M,T)),h=0,b=T>0?M-4:M,_;for(_=0;_>16&255,c[h++]=S>>8&255,c[h++]=S&255;return T===2&&(S=i[y.charCodeAt(_)]<<2|i[y.charCodeAt(_+1)]>>4,c[h++]=S&255),T===1&&(S=i[y.charCodeAt(_)]<<10|i[y.charCodeAt(_+1)]<<4|i[y.charCodeAt(_+2)]>>2,c[h++]=S>>8&255,c[h++]=S&255),c}function w(y){return r[y>>18&63]+r[y>>12&63]+r[y>>6&63]+r[y&63]}function l(y,S,k){for(var M,T=[],c=S;cb?b:h+c));return M===1?(S=y[k-1],T.push(r[S>>2]+r[S<<4&63]+"==")):M===2&&(S=(y[k-2]<<8)+y[k-1],T.push(r[S>>10]+r[S>>4&63]+r[S<<2&63]+"=")),T.join("")}},7518:function(t,e,r){var i=r(1433);function n(s,f,v,g,m,w){this.location=s,this.dimension=f,this.a=v,this.b=g,this.c=m,this.d=w}n.prototype.bind=function(s){switch(this.dimension){case 1:s.vertexAttrib1f(this.location,this.a);break;case 2:s.vertexAttrib2f(this.location,this.a,this.b);break;case 3:s.vertexAttrib3f(this.location,this.a,this.b,this.c);break;case 4:s.vertexAttrib4f(this.location,this.a,this.b,this.c,this.d);break}};function o(s,f,v){this.gl=s,this._ext=f,this.handle=v,this._attribs=[],this._useElements=!1,this._elementsType=s.UNSIGNED_SHORT}o.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var s=0;s1.0001)return null;_+=b[k]}return Math.abs(_-1)>.001?null:[M,f(g,b),b]}},7636:function(t){t.exports=e;function e(r,i){i=i||1;var n=Math.random()*2*Math.PI,o=Math.random()*2-1,a=Math.sqrt(1-o*o)*i;return r[0]=Math.cos(n)*a,r[1]=Math.sin(n)*a,r[2]=o*i,r}},7640:function(t,e,r){var i=r(1888);function n(m){return m==="uint32"?[i.mallocUint32,i.freeUint32]:null}var o={"uint32,1,0":function(m,w){return function(l,x,y,S,k,M,T,c,h,b,_){var P,z,D,B=l*k+S,R,I=m(c),F,j,N,G;for(P=l+1;P<=x;++P){for(z=P,B+=k,D=B,F=0,j=B,R=0;Rl;){F=0,j=D-k;e:for(R=0;RG)break e;j+=b,F+=_}for(F=D,j=D-k,R=0;R>1,F=I-D,j=I+D,N=B,G=F,rt=I,ct=j,st=R,et=y+1,Z=S-1,ot=!0,X,Q,ut,J,q,it,nt,dt,Tt,wt=0,Ct=0,It=0,Nt,te,Jt,ee,Zt,mt,bt,vt,Ut,re,Kt,ue,Me,Ce,We,qe,vr=b,_r=w(vr),er=w(vr);te=T*N,Jt=T*G,qe=M;t:for(Nt=0;Nt0){Q=N,N=G,G=Q;break t}if(It<0)break t;qe+=P}te=T*ct,Jt=T*st,qe=M;t:for(Nt=0;Nt0){Q=ct,ct=st,st=Q;break t}if(It<0)break t;qe+=P}te=T*N,Jt=T*rt,qe=M;t:for(Nt=0;Nt0){Q=N,N=rt,rt=Q;break t}if(It<0)break t;qe+=P}te=T*G,Jt=T*rt,qe=M;t:for(Nt=0;Nt0){Q=G,G=rt,rt=Q;break t}if(It<0)break t;qe+=P}te=T*N,Jt=T*ct,qe=M;t:for(Nt=0;Nt0){Q=N,N=ct,ct=Q;break t}if(It<0)break t;qe+=P}te=T*rt,Jt=T*ct,qe=M;t:for(Nt=0;Nt0){Q=rt,rt=ct,ct=Q;break t}if(It<0)break t;qe+=P}te=T*G,Jt=T*st,qe=M;t:for(Nt=0;Nt0){Q=G,G=st,st=Q;break t}if(It<0)break t;qe+=P}te=T*G,Jt=T*rt,qe=M;t:for(Nt=0;Nt0){Q=G,G=rt,rt=Q;break t}if(It<0)break t;qe+=P}te=T*ct,Jt=T*st,qe=M;t:for(Nt=0;Nt0){Q=ct,ct=st,st=Q;break t}if(It<0)break t;qe+=P}for(te=T*N,Jt=T*G,ee=T*rt,Zt=T*ct,mt=T*st,bt=T*B,vt=T*I,Ut=T*R,We=0,qe=M,Nt=0;Nt0)Z--;else if(It<0){for(te=T*it,Jt=T*et,ee=T*Z,qe=M,Nt=0;Nt0)for(;;){nt=M+Z*T,We=0;t:for(Nt=0;Nt0){if(--ZR){t:for(;;){for(nt=M+et*T,We=0,qe=M,Nt=0;Nt1&&x?S(l,x[0],x[1]):S(l)}var v={"uint32,1,0":function(m,w){return function(l){var x=l.data,y=l.offset|0,S=l.shape,k=l.stride,M=k[0]|0,T=S[0]|0,c=k[1]|0,h=S[1]|0,b=c,_=c,P=1;T<=32?m(0,T-1,x,y,M,c,T,h,b,_,P):w(0,T-1,x,y,M,c,T,h,b,_,P)}}};function g(m,w){var l=[w,m].join(","),x=v[l],y=a(m,w),S=f(m,w,y);return x(y,S)}t.exports=g},7642:function(t,e,r){var i=r(8954),n=r(1682);t.exports=f;function o(v,g){this.point=v,this.index=g}function a(v,g){for(var m=v.point,w=g.point,l=m.length,x=0;x=2)return!1;B[I]=F}return!0}):D=D.filter(function(B){for(var R=0;R<=w;++R){var I=b[B[R]];if(I<0)return!1;B[R]=I}return!0}),w&1)for(var y=0;y",j="",N=F.length,G=j.length,rt=B[0]===x||B[0]===k,ct=0,st=-G;ct>-1&&(ct=R.indexOf(F,ct),!(ct===-1||(st=R.indexOf(j,ct+N),st===-1)||st<=ct));){for(var et=ct;et=st)I[et]=null,R=R.substr(0,et)+" "+R.substr(et+1);else if(I[et]!==null){var Z=I[et].indexOf(B[0]);Z===-1?I[et]+=B:rt&&(I[et]=I[et].substr(0,Z+1)+(1+parseInt(I[et][Z+1]))+I[et].substr(Z+2))}var ot=ct+N,X=R.substr(ot,st-ot),Q=X.indexOf(F);Q!==-1?ct=Q:ct=st+G}return I}function c(D,B,R){for(var I=B.textAlign||"start",F=B.textBaseline||"alphabetic",j=[1073741824,1073741824],N=[0,0],G=D.length,rt=0;rt/g,` +`):R=R.replace(/\/g," ");var N="",G=[];for(q=0;q-1?parseInt(vt[1+Kt]):0,Ce=ue>-1?parseInt(Ut[1+ue]):0;Me!==Ce&&(re=re.replace(It(),"?px "),dt*=Math.pow(.75,Ce-Me),re=re.replace("?px ",It())),nt+=.25*Z*(Ce-Me)}if(j.superscripts===!0){var We=vt.indexOf(x),qe=Ut.indexOf(x),vr=We>-1?parseInt(vt[1+We]):0,_r=qe>-1?parseInt(Ut[1+qe]):0;vr!==_r&&(re=re.replace(It(),"?px "),dt*=Math.pow(.75,_r-vr),re=re.replace("?px ",It())),nt-=.25*Z*(_r-vr)}if(j.bolds===!0){var er=vt.indexOf(g)>-1,Mr=Ut.indexOf(g)>-1;!er&&Mr&&(Ir?re=re.replace("italic ","italic bold "):re="bold "+re),er&&!Mr&&(re=re.replace("bold ",""))}if(j.italics===!0){var Ir=vt.indexOf(w)>-1,de=Ut.indexOf(w)>-1;!Ir&&de&&(re="italic "+re),Ir&&!de&&(re=re.replace("italic ",""))}B.font=re}for(J=0;J0&&(F=I.size),I.lineSpacing&&I.lineSpacing>0&&(j=I.lineSpacing),I.styletags&&I.styletags.breaklines&&(N.breaklines=!!I.styletags.breaklines),I.styletags&&I.styletags.bolds&&(N.bolds=!!I.styletags.bolds),I.styletags&&I.styletags.italics&&(N.italics=!!I.styletags.italics),I.styletags&&I.styletags.subscripts&&(N.subscripts=!!I.styletags.subscripts),I.styletags&&I.styletags.superscripts&&(N.superscripts=!!I.styletags.superscripts)),R.font=[I.fontStyle,I.fontVariant,I.fontWeight,F+"px",I.font].filter(function(rt){return rt}).join(" "),R.textAlign="start",R.textBaseline="alphabetic",R.direction="ltr";var G=h(B,R,D,F,j,N);return P(G,I,F)}},7721:function(t,e,r){var i=r(5716);t.exports=n;function n(o){return i(o[0])*i(o[1])}},7765:function(t,e,r){t.exports=l;var i=r(9618),n=r(1888),o=r(446),a=r(1570);function s(x){for(var y=x.length,S=0,k=0;k"u"&&(k=s(x));var M=x.length;if(M===0||k<1)return{cells:[],vertexIds:[],vertexWeights:[]};var T=f(y,+S),c=v(x,k),h=g(c,y,T,+S),b=m(c,y.length|0),_=a(k)(x,c.data,b,T),P=w(c),z=[].slice.call(h.data,0,h.shape[0]);return n.free(T),n.free(c.data),n.free(h.data),n.free(b),{cells:_,vertexIds:P,vertexWeights:z}}},7766:function(t,e,r){var i=r(9618),n=r(5298),o=r(1888);t.exports=h;var a=null,s=null,f=null;function v(b){a=[b.LINEAR,b.NEAREST_MIPMAP_LINEAR,b.LINEAR_MIPMAP_NEAREST,b.LINEAR_MIPMAP_NEAREST],s=[b.NEAREST,b.LINEAR,b.NEAREST_MIPMAP_NEAREST,b.NEAREST_MIPMAP_LINEAR,b.LINEAR_MIPMAP_NEAREST,b.LINEAR_MIPMAP_LINEAR],f=[b.REPEAT,b.CLAMP_TO_EDGE,b.MIRRORED_REPEAT]}function g(b){return typeof HTMLCanvasElement<"u"&&b instanceof HTMLCanvasElement||typeof HTMLImageElement<"u"&&b instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&b instanceof HTMLVideoElement||typeof ImageData<"u"&&b instanceof ImageData}var m=function(b,_){n.muls(b,_,255)};function w(b,_,P){var z=b.gl,D=z.getParameter(z.MAX_TEXTURE_SIZE);if(_<0||_>D||P<0||P>D)throw new Error("gl-texture2d: Invalid texture size");return b._shape=[_,P],b.bind(),z.texImage2D(z.TEXTURE_2D,0,b.format,_,P,0,b.format,b.type,null),b._mipLevels=[0],b}function l(b,_,P,z,D,B){this.gl=b,this.handle=_,this.format=D,this.type=B,this._shape=[P,z],this._mipLevels=[0],this._magFilter=b.NEAREST,this._minFilter=b.NEAREST,this._wrapS=b.CLAMP_TO_EDGE,this._wrapT=b.CLAMP_TO_EDGE,this._anisoSamples=1;var R=this,I=[this._wrapS,this._wrapT];Object.defineProperties(I,[{get:function(){return R._wrapS},set:function(j){return R.wrapS=j}},{get:function(){return R._wrapT},set:function(j){return R.wrapT=j}}]),this._wrapVector=I;var F=[this._shape[0],this._shape[1]];Object.defineProperties(F,[{get:function(){return R._shape[0]},set:function(j){return R.width=j}},{get:function(){return R._shape[1]},set:function(j){return R.height=j}}]),this._shapeVector=F}var x=l.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(b){this.bind();var _=this.gl;if(this.type===_.FLOAT&&a.indexOf(b)>=0&&(_.getExtension("OES_texture_float_linear")||(b=_.NEAREST)),s.indexOf(b)<0)throw new Error("gl-texture2d: Unknown filter mode "+b);return _.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,b),this._minFilter=b}},magFilter:{get:function(){return this._magFilter},set:function(b){this.bind();var _=this.gl;if(this.type===_.FLOAT&&a.indexOf(b)>=0&&(_.getExtension("OES_texture_float_linear")||(b=_.NEAREST)),s.indexOf(b)<0)throw new Error("gl-texture2d: Unknown filter mode "+b);return _.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,b),this._magFilter=b}},mipSamples:{get:function(){return this._anisoSamples},set:function(b){var _=this._anisoSamples;if(this._anisoSamples=Math.max(b,1)|0,_!==this._anisoSamples){var P=this.gl.getExtension("EXT_texture_filter_anisotropic");P&&this.gl.texParameterf(this.gl.TEXTURE_2D,P.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(b){if(this.bind(),f.indexOf(b)<0)throw new Error("gl-texture2d: Unknown wrap mode "+b);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,b),this._wrapS=b}},wrapT:{get:function(){return this._wrapT},set:function(b){if(this.bind(),f.indexOf(b)<0)throw new Error("gl-texture2d: Unknown wrap mode "+b);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,b),this._wrapT=b}},wrap:{get:function(){return this._wrapVector},set:function(b){if(Array.isArray(b)||(b=[b,b]),b.length!==2)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var _=0;_<2;++_)if(f.indexOf(b[_])<0)throw new Error("gl-texture2d: Unknown wrap mode "+b);this._wrapS=b[0],this._wrapT=b[1];var P=this.gl;return this.bind(),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_WRAP_S,this._wrapS),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_WRAP_T,this._wrapT),b}},shape:{get:function(){return this._shapeVector},set:function(b){if(!Array.isArray(b))b=[b|0,b|0];else if(b.length!==2)throw new Error("gl-texture2d: Invalid texture shape");return w(this,b[0]|0,b[1]|0),[b[0]|0,b[1]|0]}},width:{get:function(){return this._shape[0]},set:function(b){return b=b|0,w(this,b,this._shape[1]),b}},height:{get:function(){return this._shape[1]},set:function(b){return b=b|0,w(this,this._shape[0],b),b}}}),x.bind=function(b){var _=this.gl;return b!==void 0&&_.activeTexture(_.TEXTURE0+(b|0)),_.bindTexture(_.TEXTURE_2D,this.handle),b!==void 0?b|0:_.getParameter(_.ACTIVE_TEXTURE)-_.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var b=Math.min(this._shape[0],this._shape[1]),_=0;b>0;++_,b>>>=1)this._mipLevels.indexOf(_)<0&&this._mipLevels.push(_)},x.setPixels=function(b,_,P,z){var D=this.gl;this.bind(),Array.isArray(_)?(z=P,P=_[1]|0,_=_[0]|0):(_=_||0,P=P||0),z=z||0;var B=g(b)?b:b.raw;if(B){var R=this._mipLevels.indexOf(z)<0;R?(D.texImage2D(D.TEXTURE_2D,0,this.format,this.format,this.type,B),this._mipLevels.push(z)):D.texSubImage2D(D.TEXTURE_2D,z,_,P,this.format,this.type,B)}else if(b.shape&&b.stride&&b.data){if(b.shape.length<2||_+b.shape[1]>this._shape[1]>>>z||P+b.shape[0]>this._shape[0]>>>z||_<0||P<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");S(D,_,P,z,this.format,this.type,this._mipLevels,b)}else throw new Error("gl-texture2d: Unsupported data type")};function y(b,_){return b.length===3?_[2]===1&&_[1]===b[0]*b[2]&&_[0]===b[2]:_[0]===1&&_[1]===b[0]}function S(b,_,P,z,D,B,R,I){var F=I.dtype,j=I.shape.slice();if(j.length<2||j.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var N=0,G=0,rt=y(j,I.stride.slice());if(F==="float32"?N=b.FLOAT:F==="float64"?(N=b.FLOAT,rt=!1,F="float32"):F==="uint8"?N=b.UNSIGNED_BYTE:(N=b.UNSIGNED_BYTE,rt=!1,F="uint8"),j.length===2)G=b.LUMINANCE,j=[j[0],j[1],1],I=i(I.data,j,[I.stride[0],I.stride[1],1],I.offset);else if(j.length===3){if(j[2]===1)G=b.ALPHA;else if(j[2]===2)G=b.LUMINANCE_ALPHA;else if(j[2]===3)G=b.RGB;else if(j[2]===4)G=b.RGBA;else throw new Error("gl-texture2d: Invalid shape for pixel coords");j[2]}else throw new Error("gl-texture2d: Invalid shape for texture");if((G===b.LUMINANCE||G===b.ALPHA)&&(D===b.LUMINANCE||D===b.ALPHA)&&(G=D),G!==D)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var ct=I.size,st=R.indexOf(z)<0;if(st&&R.push(z),N===B&&rt)I.offset===0&&I.data.length===ct?st?b.texImage2D(b.TEXTURE_2D,z,D,j[0],j[1],0,D,B,I.data):b.texSubImage2D(b.TEXTURE_2D,z,_,P,j[0],j[1],D,B,I.data):st?b.texImage2D(b.TEXTURE_2D,z,D,j[0],j[1],0,D,B,I.data.subarray(I.offset,I.offset+ct)):b.texSubImage2D(b.TEXTURE_2D,z,_,P,j[0],j[1],D,B,I.data.subarray(I.offset,I.offset+ct));else{var et;B===b.FLOAT?et=o.mallocFloat32(ct):et=o.mallocUint8(ct);var Z=i(et,j,[j[2],j[2]*j[0],1]);N===b.FLOAT&&B===b.UNSIGNED_BYTE?m(Z,I):n.assign(Z,I),st?b.texImage2D(b.TEXTURE_2D,z,D,j[0],j[1],0,D,B,et.subarray(0,ct)):b.texSubImage2D(b.TEXTURE_2D,z,_,P,j[0],j[1],D,B,et.subarray(0,ct)),B===b.FLOAT?o.freeFloat32(et):o.freeUint8(et)}}function k(b){var _=b.createTexture();return b.bindTexture(b.TEXTURE_2D,_),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE),_}function M(b,_,P,z,D){var B=b.getParameter(b.MAX_TEXTURE_SIZE);if(_<0||_>B||P<0||P>B)throw new Error("gl-texture2d: Invalid texture shape");if(D===b.FLOAT&&!b.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var R=k(b);return b.texImage2D(b.TEXTURE_2D,0,z,_,P,0,z,D,null),new l(b,R,_,P,z,D)}function T(b,_,P,z,D,B){var R=k(b);return b.texImage2D(b.TEXTURE_2D,0,D,D,B,_),new l(b,R,P,z,D,B)}function c(b,_){var P=_.dtype,z=_.shape.slice(),D=b.getParameter(b.MAX_TEXTURE_SIZE);if(z[0]<0||z[0]>D||z[1]<0||z[1]>D)throw new Error("gl-texture2d: Invalid texture size");var B=y(z,_.stride.slice()),R=0;P==="float32"?R=b.FLOAT:P==="float64"?(R=b.FLOAT,B=!1,P="float32"):P==="uint8"?R=b.UNSIGNED_BYTE:(R=b.UNSIGNED_BYTE,B=!1,P="uint8");var I=0;if(z.length===2)I=b.LUMINANCE,z=[z[0],z[1],1],_=i(_.data,z,[_.stride[0],_.stride[1],1],_.offset);else if(z.length===3)if(z[2]===1)I=b.ALPHA;else if(z[2]===2)I=b.LUMINANCE_ALPHA;else if(z[2]===3)I=b.RGB;else if(z[2]===4)I=b.RGBA;else throw new Error("gl-texture2d: Invalid shape for pixel coords");else throw new Error("gl-texture2d: Invalid shape for texture");R===b.FLOAT&&!b.getExtension("OES_texture_float")&&(R=b.UNSIGNED_BYTE,B=!1);var F,j,N=_.size;if(B)_.offset===0&&_.data.length===N?F=_.data:F=_.data.subarray(_.offset,_.offset+N);else{var G=[z[2],z[2]*z[0],1];j=o.malloc(N,P);var rt=i(j,z,G,0);(P==="float32"||P==="float64")&&R===b.UNSIGNED_BYTE?m(rt,_):n.assign(rt,_),F=j.subarray(0,N)}var ct=k(b);return b.texImage2D(b.TEXTURE_2D,0,I,z[0],z[1],0,I,R,F),B||o.free(j),new l(b,ct,z[0],z[1],I,R)}function h(b){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(a||v(b),typeof arguments[1]=="number")return M(b,arguments[1],arguments[2],arguments[3]||b.RGBA,arguments[4]||b.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return M(b,arguments[1][0]|0,arguments[1][1]|0,arguments[2]||b.RGBA,arguments[3]||b.UNSIGNED_BYTE);if(typeof arguments[1]=="object"){var _=arguments[1],P=g(_)?_:_.raw;if(P)return T(b,P,_.width|0,_.height|0,arguments[2]||b.RGBA,arguments[3]||b.UNSIGNED_BYTE);if(_.shape&&_.data&&_.stride)return c(b,_)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}},7790:function(){},7815:function(t,e,r){var i=r(2931),n=r(9970),o=["xyz","xzy","yxz","yzx","zxy","zyx"],a=function(y,S,k,M){for(var T=y.points,c=y.velocities,h=y.divergences,b=[],_=[],P=[],z=[],D=[],B=[],R=0,I=0,F=n.create(),j=n.create(),N=8,G=0;G0)for(var et=0;etS)return M-1}return M},v=function(y,S,k){return yk?k:y},g=function(y,S,k){var M=S.vectors,T=S.meshgrid,c=y[0],h=y[1],b=y[2],_=T[0].length,P=T[1].length,z=T[2].length,D=f(T[0],c),B=f(T[1],h),R=f(T[2],b),I=D+1,F=B+1,j=R+1;if(D=v(D,0,_-1),I=v(I,0,_-1),B=v(B,0,P-1),F=v(F,0,P-1),R=v(R,0,z-1),j=v(j,0,z-1),D<0||B<0||R<0||I>_-1||F>P-1||j>z-1)return i.create();var N=T[0][D],G=T[0][I],rt=T[1][B],ct=T[1][F],st=T[2][R],et=T[2][j],Z=(c-N)/(G-N),ot=(h-rt)/(ct-rt),X=(b-st)/(et-st);isFinite(Z)||(Z=.5),isFinite(ot)||(ot=.5),isFinite(X)||(X=.5);var Q,ut,J,q,it,nt;switch(k.reversedX&&(D=_-1-D,I=_-1-I),k.reversedY&&(B=P-1-B,F=P-1-F),k.reversedZ&&(R=z-1-R,j=z-1-j),k.filled){case 5:it=R,nt=j,J=B*z,q=F*z,Q=D*z*P,ut=I*z*P;break;case 4:it=R,nt=j,Q=D*z,ut=I*z,J=B*z*_,q=F*z*_;break;case 3:J=B,q=F,it=R*P,nt=j*P,Q=D*P*z,ut=I*P*z;break;case 2:J=B,q=F,Q=D*P,ut=I*P,it=R*P*_,nt=j*P*_;break;case 1:Q=D,ut=I,it=R*_,nt=j*_,J=B*_*z,q=F*_*z;break;default:Q=D,ut=I,J=B*_,q=F*_,it=R*_*P,nt=j*_*P;break}var dt=M[Q+J+it],Tt=M[Q+J+nt],wt=M[Q+q+it],Ct=M[Q+q+nt],It=M[ut+J+it],Nt=M[ut+J+nt],te=M[ut+q+it],Jt=M[ut+q+nt],ee=i.create(),Zt=i.create(),mt=i.create(),bt=i.create();i.lerp(ee,dt,It,Z),i.lerp(Zt,Tt,Nt,Z),i.lerp(mt,wt,te,Z),i.lerp(bt,Ct,Jt,Z);var vt=i.create(),Ut=i.create();i.lerp(vt,ee,mt,ot),i.lerp(Ut,Zt,bt,ot);var re=i.create();return i.lerp(re,vt,Ut,X),re},m=function(y){var S=1/0;y.sort(function(c,h){return c-h});for(var k=y.length,M=1;MI||JtF||eej)},G=i.distance(S[0],S[1]),rt=10*G/M,ct=rt*rt,st=1,et=0,Z=k.length;Z>1&&(st=w(k));for(var ot=0;otet&&(et=dt),it.push(dt),z.push({points:Q,velocities:ut,divergences:it});for(var Tt=0;Ttct&&i.scale(wt,wt,rt/Math.sqrt(Ct)),i.add(wt,wt,X),J=_(wt),i.squaredDistance(q,wt)-ct>-1e-4*ct){Q.push(wt),q=wt,ut.push(J);var nt=P(wt,J),dt=i.length(nt);isFinite(dt)&&dt>et&&(et=dt),it.push(dt)}X=wt}}var It=s(z,y.colormap,et,st);return c?It.tubeScale=c:(et===0&&(et=1),It.tubeScale=T*.5*st/et),It};var l=r(6740),x=r(6405).createMesh;t.exports.createTubeMesh=function(y,S){return x(y,S,{shaders:l,traceType:"streamtube"})}},7827:function(t){t.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},7842:function(t,e,r){var i=r(6330),n=r(1533),o=r(2651),a=r(6768),s=r(869),f=r(8697);t.exports=v;function v(g,m){if(i(g))return m?f(g,v(m)):[g[0].clone(),g[1].clone()];var w=0,l,x;if(n(g))l=g.clone();else if(typeof g=="string")l=a(g);else{if(g===0)return[o(0),o(1)];if(g===Math.floor(g))l=o(g);else{for(;g!==Math.floor(g);)g=g*Math.pow(2,256),w-=256;l=o(g)}}if(i(m))l.mul(m[1]),x=m[0].clone();else if(n(m))x=m.clone();else if(typeof m=="string")x=a(m);else if(!m)x=o(1);else if(m===Math.floor(m))x=o(m);else{for(;m!==Math.floor(m);)m=m*Math.pow(2,256),w+=256;x=o(m)}return w>0?l=l.ushln(w):w<0&&(x=x.ushln(-w)),s(l,x)}},7894:function(t){t.exports=e;function e(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}},7932:function(t,e,r){var i=r(620);t.exports=i.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"])},7960:function(t){t.exports=e;function e(r,i){var n=i[0]-r[0],o=i[1]-r[1],a=i[2]-r[2],s=i[3]-r[3];return n*n+o*o+a*a+s*s}},8105:function(t){t.exports=r;var e={"lo===p0":i,"lo=p0)&&!(p1>=hi)":v};function r(g){return e[g]}function i(g,m,w,l,x,y,S){for(var k=2*g,M=k*w,T=M,c=w,h=m,b=g+m,_=w;l>_;++_,M+=k){var P=x[M+h];if(P===S)if(c===_)c+=1,T+=k;else{for(var z=0;k>z;++z){var D=x[M+z];x[M+z]=x[T],x[T++]=D}var B=y[_];y[_]=y[c],y[c++]=B}}return c}function n(g,m,w,l,x,y,S){for(var k=2*g,M=k*w,T=M,c=w,h=m,b=g+m,_=w;l>_;++_,M+=k){var P=x[M+h];if(Pz;++z){var D=x[M+z];x[M+z]=x[T],x[T++]=D}var B=y[_];y[_]=y[c],y[c++]=B}}return c}function o(g,m,w,l,x,y,S){for(var k=2*g,M=k*w,T=M,c=w,h=m,b=g+m,_=w;l>_;++_,M+=k){var P=x[M+b];if(P<=S)if(c===_)c+=1,T+=k;else{for(var z=0;k>z;++z){var D=x[M+z];x[M+z]=x[T],x[T++]=D}var B=y[_];y[_]=y[c],y[c++]=B}}return c}function a(g,m,w,l,x,y,S){for(var k=2*g,M=k*w,T=M,c=w,h=m,b=g+m,_=w;l>_;++_,M+=k){var P=x[M+b];if(P<=S)if(c===_)c+=1,T+=k;else{for(var z=0;k>z;++z){var D=x[M+z];x[M+z]=x[T],x[T++]=D}var B=y[_];y[_]=y[c],y[c++]=B}}return c}function s(g,m,w,l,x,y,S){for(var k=2*g,M=k*w,T=M,c=w,h=m,b=g+m,_=w;l>_;++_,M+=k){var P=x[M+h],z=x[M+b];if(P<=S&&S<=z)if(c===_)c+=1,T+=k;else{for(var D=0;k>D;++D){var B=x[M+D];x[M+D]=x[T],x[T++]=B}var R=y[_];y[_]=y[c],y[c++]=R}}return c}function f(g,m,w,l,x,y,S){for(var k=2*g,M=k*w,T=M,c=w,h=m,b=g+m,_=w;l>_;++_,M+=k){var P=x[M+h],z=x[M+b];if(PD;++D){var B=x[M+D];x[M+D]=x[T],x[T++]=B}var R=y[_];y[_]=y[c],y[c++]=R}}return c}function v(g,m,w,l,x,y,S,k){for(var M=2*g,T=M*w,c=T,h=w,b=m,_=g+m,P=w;l>P;++P,T+=M){var z=x[T+b],D=x[T+_];if(!(z>=S)&&!(k>=D))if(h===P)h+=1,c+=M;else{for(var B=0;M>B;++B){var R=x[T+B];x[T+B]=x[c],x[c++]=R}var I=y[P];y[P]=y[h],y[h++]=I}}return h}},8107:function(t){t.exports=e;function e(r,i,n){return r[0]=Math.min(i[0],n[0]),r[1]=Math.min(i[1],n[1]),r[2]=Math.min(i[2],n[2]),r}},8116:function(t,e,r){var i=r(7518),n=r(870);function o(s){this.bindVertexArrayOES=s.bindVertexArray.bind(s),this.createVertexArrayOES=s.createVertexArray.bind(s),this.deleteVertexArrayOES=s.deleteVertexArray.bind(s)}function a(s,f,v,g){var m=s.createVertexArray?new o(s):s.getExtension("OES_vertex_array_object"),w;return m?w=i(s,m):w=n(s),w.update(f,v,g),w}t.exports=a},8192:function(t,e,r){t.exports=a;var i=r(2825),n=r(3536),o=r(244);function a(s,f){var v=i(s[0],s[1],s[2]),g=i(f[0],f[1],f[2]);n(v,v),n(g,g);var m=o(v,g);return m>1?0:Math.acos(m)}},8210:function(t){t.exports=r;function e(i,n){var o=i+n,a=o-i,s=o-a,f=n-a,v=i-s,g=v+f;return g?[g,o]:[o]}function r(i,n){var o=i.length|0,a=n.length|0;if(o===1&&a===1)return e(i[0],n[0]);var s=o+a,f=new Array(s),v=0,g=0,m=0,w=Math.abs,l=i[g],x=w(l),y=n[m],S=w(y),k,M;x=a?(k=l,g+=1,gv)for(var P=f[l],z=1/Math.sqrt(c*b),_=0;_<3;++_){var D=(_+1)%3,B=(_+2)%3;P[_]+=z*(h[D]*T[B]-h[B]*T[D])}}for(var g=0;gv)for(var z=1/Math.sqrt(R),_=0;_<3;++_)P[_]*=z;else for(var _=0;_<3;++_)P[_]=0}return f},e.faceNormals=function(n,o,a){for(var s=n.length,f=new Array(s),v=a===void 0?i:a,g=0;gv?k=1/Math.sqrt(k):k=0;for(var l=0;l<3;++l)S[l]*=k;f[g]=S}return f}},8418:function(t,e,r){var i=r(5219),n=r(2762),o=r(8116),a=r(1888),s=r(6760),f=r(1283),v=r(9366),g=r(5964),m=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],w=ArrayBuffer,l=DataView;function x(Q){return w.isView(Q)&&!(Q instanceof l)}function y(Q){return Array.isArray(Q)||x(Q)}t.exports=X;function S(Q,ut){var J=Q[0],q=Q[1],it=Q[2],nt=Q[3];return Q[0]=ut[0]*J+ut[4]*q+ut[8]*it+ut[12]*nt,Q[1]=ut[1]*J+ut[5]*q+ut[9]*it+ut[13]*nt,Q[2]=ut[2]*J+ut[6]*q+ut[10]*it+ut[14]*nt,Q[3]=ut[3]*J+ut[7]*q+ut[11]*it+ut[15]*nt,Q}function k(Q,ut,J,q){return S(q,q),S(q,q),S(q,q)}function M(Q,ut){this.index=Q,this.dataCoordinate=this.position=ut}function T(Q){return Q===!0||Q>1?1:Q}function c(Q,ut,J,q,it,nt,dt,Tt,wt,Ct,It,Nt){this.gl=Q,this.pixelRatio=1,this.shader=ut,this.orthoShader=J,this.projectShader=q,this.pointBuffer=it,this.colorBuffer=nt,this.glyphBuffer=dt,this.idBuffer=Tt,this.vao=wt,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.hasAlpha=!1,this.lineWidth=0,this.projectScale=[.6666666666666666,.6666666666666666,.6666666666666666],this.projectOpacity=[1,1,1],this.projectHasAlpha=!1,this.pickId=0,this.pickPerspectiveShader=Ct,this.pickOrthoShader=It,this.pickProjectShader=Nt,this.points=[],this._selectResult=new M(0,[0,0,0]),this.useOrtho=!0,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.axesProject=[!0,!0,!0],this.axesBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.highlightId=[1,1,1,1],this.highlightScale=2,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.dirty=!0}var h=c.prototype;h.pickSlots=1,h.setPickBase=function(Q){this.pickId=Q},h.isTransparent=function(){if(this.hasAlpha)return!0;for(var Q=0;Q<3;++Q)if(this.axesProject[Q]&&this.projectHasAlpha)return!0;return!1},h.isOpaque=function(){if(!this.hasAlpha)return!0;for(var Q=0;Q<3;++Q)if(this.axesProject[Q]&&!this.projectHasAlpha)return!0;return!1};var b=[0,0],_=[0,0,0],P=[0,0,0],z=[0,0,0,1],D=[0,0,0,1],B=m.slice(),R=[0,0,0],I=[[0,0,0],[0,0,0]];function F(Q){return Q[0]=Q[1]=Q[2]=0,Q}function j(Q,ut){return Q[0]=ut[0],Q[1]=ut[1],Q[2]=ut[2],Q[3]=1,Q}function N(Q,ut,J,q){return Q[0]=ut[0],Q[1]=ut[1],Q[2]=ut[2],Q[J]=q,Q}function G(Q){for(var ut=I,J=0;J<2;++J)for(var q=0;q<3;++q)ut[J][q]=Math.max(Math.min(Q[J][q],1e8),-1e8);return ut}function rt(Q,ut,J,q){var it=ut.axesProject,nt=ut.gl,dt=Q.uniforms,Tt=J.model||m,wt=J.view||m,Ct=J.projection||m,It=ut.axesBounds,Nt=G(ut.clipBounds),te;ut.axes&&ut.axes.lastCubeProps?te=ut.axes.lastCubeProps.axis:te=[1,1,1],b[0]=2/nt.drawingBufferWidth,b[1]=2/nt.drawingBufferHeight,Q.bind(),dt.view=wt,dt.projection=Ct,dt.screenSize=b,dt.highlightId=ut.highlightId,dt.highlightScale=ut.highlightScale,dt.clipBounds=Nt,dt.pickGroup=ut.pickId/255,dt.pixelRatio=q;for(var Jt=0;Jt<3;++Jt)if(it[Jt]){dt.scale=ut.projectScale[Jt],dt.opacity=ut.projectOpacity[Jt];for(var ee=B,Zt=0;Zt<16;++Zt)ee[Zt]=0;for(var Zt=0;Zt<4;++Zt)ee[5*Zt]=1;ee[5*Jt]=0,te[Jt]<0?ee[12+Jt]=It[0][Jt]:ee[12+Jt]=It[1][Jt],s(ee,Tt,ee),dt.model=ee;var mt=(Jt+1)%3,bt=(Jt+2)%3,vt=F(_),Ut=F(P);vt[mt]=1,Ut[bt]=1;var re=k(Ct,wt,Tt,j(z,vt)),Kt=k(Ct,wt,Tt,j(D,Ut));if(Math.abs(re[1])>Math.abs(Kt[1])){var ue=re;re=Kt,Kt=ue,ue=vt,vt=Ut,Ut=ue;var Me=mt;mt=bt,bt=Me}re[0]<0&&(vt[mt]=-1),Kt[1]>0&&(Ut[bt]=-1);for(var Ce=0,We=0,Zt=0;Zt<4;++Zt)Ce+=Math.pow(Tt[4*mt+Zt],2),We+=Math.pow(Tt[4*bt+Zt],2);vt[mt]/=Math.sqrt(Ce),Ut[bt]/=Math.sqrt(We),dt.axes[0]=vt,dt.axes[1]=Ut,dt.fragClipBounds[0]=N(R,Nt[0],Jt,-1e8),dt.fragClipBounds[1]=N(R,Nt[1],Jt,1e8),ut.vao.bind(),ut.vao.draw(nt.TRIANGLES,ut.vertexCount),ut.lineWidth>0&&(nt.lineWidth(ut.lineWidth*q),ut.vao.draw(nt.LINES,ut.lineVertexCount,ut.vertexCount)),ut.vao.unbind()}}var ct=[-1e8,-1e8,-1e8],st=[1e8,1e8,1e8],et=[ct,st];function Z(Q,ut,J,q,it,nt,dt){var Tt=J.gl;if((nt===J.projectHasAlpha||dt)&&rt(ut,J,q,it),nt===J.hasAlpha||dt){Q.bind();var wt=Q.uniforms;wt.model=q.model||m,wt.view=q.view||m,wt.projection=q.projection||m,b[0]=2/Tt.drawingBufferWidth,b[1]=2/Tt.drawingBufferHeight,wt.screenSize=b,wt.highlightId=J.highlightId,wt.highlightScale=J.highlightScale,wt.fragClipBounds=et,wt.clipBounds=J.axes.bounds,wt.opacity=J.opacity,wt.pickGroup=J.pickId/255,wt.pixelRatio=it,J.vao.bind(),J.vao.draw(Tt.TRIANGLES,J.vertexCount),J.lineWidth>0&&(Tt.lineWidth(J.lineWidth*it),J.vao.draw(Tt.LINES,J.lineVertexCount,J.vertexCount)),J.vao.unbind()}}h.draw=function(Q){var ut=this.useOrtho?this.orthoShader:this.shader;Z(ut,this.projectShader,this,Q,this.pixelRatio,!1,!1)},h.drawTransparent=function(Q){var ut=this.useOrtho?this.orthoShader:this.shader;Z(ut,this.projectShader,this,Q,this.pixelRatio,!0,!1)},h.drawPick=function(Q){var ut=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;Z(ut,this.pickProjectShader,this,Q,1,!0,!0)},h.pick=function(Q){if(!Q||Q.id!==this.pickId)return null;var ut=Q.value[2]+(Q.value[1]<<8)+(Q.value[0]<<16);if(ut>=this.pointCount||ut<0)return null;var J=this.points[ut],q=this._selectResult;q.index=ut;for(var it=0;it<3;++it)q.position[it]=q.dataCoordinate[it]=J[it];return q},h.highlight=function(Q){if(!Q)this.highlightId=[1,1,1,1];else{var ut=Q.index,J=ut&255,q=ut>>8&255,it=ut>>16&255;this.highlightId=[J/255,q/255,it/255,0]}};function ot(Q,ut,J,q){var it;y(Q)?ut0){var Ir=0,de=bt,Dt=[0,0,0,1],qt=[0,0,0,1],_t=y(te)&&y(te[0]),lt=y(Zt)&&y(Zt[0]);t:for(var q=0;q0?1-We[0][0]:Ee<0?1+We[1][0]:1,Ue*=Ue>0?1-We[0][1]:Ue<0?1+We[1][1]:1;for(var ir=[Ee,Ue],ar=Me.cells||[],Ye=Me.positions||[],Kt=0;Kt=a?(k=l,g+=1,g0?1:0}},8648:function(t,e,r){t.exports=r(783)},8692:function(t){t.exports=e;function e(r,i,n,o){var a=n[0],s=n[1],f=i[0]-a,v=i[1]-s,g=Math.sin(o),m=Math.cos(o);return r[0]=a+f*m-v*g,r[1]=s+f*g+v*m,r[2]=i[2],r}},8697:function(t,e,r){var i=r(869);t.exports=n;function n(o,a){return i(o[0].mul(a[1]),o[1].mul(a[0]))}},8731:function(t,e,r){t.exports=v;var i=r(8866);function n(g,m,w,l,x,y){this._gl=g,this._wrapper=m,this._index=w,this._locations=l,this._dimension=x,this._constFunc=y}var o=n.prototype;o.pointer=function(g,m,w,l){var x=this,y=x._gl,S=x._locations[x._index];y.vertexAttribPointer(S,x._dimension,g||y.FLOAT,!!m,w||0,l||0),y.enableVertexAttribArray(S)},o.set=function(g,m,w,l){return this._constFunc(this._locations[this._index],g,m,w,l)},Object.defineProperty(o,"location",{get:function(){return this._locations[this._index]},set:function(g){return g!==this._locations[this._index]&&(this._locations[this._index]=g|0,this._wrapper.program=null),g|0}});var a=[function(g,m,w){return w.length===void 0?g.vertexAttrib1f(m,w):g.vertexAttrib1fv(m,w)},function(g,m,w,l){return w.length===void 0?g.vertexAttrib2f(m,w,l):g.vertexAttrib2fv(m,w)},function(g,m,w,l,x){return w.length===void 0?g.vertexAttrib3f(m,w,l,x):g.vertexAttrib3fv(m,w)},function(g,m,w,l,x,y){return w.length===void 0?g.vertexAttrib4f(m,w,l,x,y):g.vertexAttrib4fv(m,w)}];function s(g,m,w,l,x,y,S){var k=a[x],M=new n(g,m,w,l,x,k);Object.defineProperty(y,S,{set:function(T){return g.disableVertexAttribArray(l[w]),k(g,l[w],T),T},get:function(){return M},enumerable:!0})}function f(g,m,w,l,x,y,S){for(var k=new Array(x),M=new Array(x),T=0;T=0){var h=T.charCodeAt(T.length-1)-48;if(h<2||h>4)throw new i("","Invalid data type for attribute "+M+": "+T);s(g,m,c[0],l,h,x,M)}else if(T.indexOf("mat")>=0){var h=T.charCodeAt(T.length-1)-48;if(h<2||h>4)throw new i("","Invalid data type for attribute "+M+": "+T);f(g,m,c,l,h,x,M)}else throw new i("","Unknown data type for attribute "+M+": "+T);break}}return x}},8828:function(t,e){"use restrict";var r=32;e.INT_BITS=r,e.INT_MAX=2147483647,e.INT_MIN=-1<0)-(o<0)},e.abs=function(o){var a=o>>r-1;return(o^a)-a},e.min=function(o,a){return a^(o^a)&-(o65535)<<4,o>>>=a,s=(o>255)<<3,o>>>=s,a|=s,s=(o>15)<<2,o>>>=s,a|=s,s=(o>3)<<1,o>>>=s,a|=s,a|o>>1},e.log10=function(o){return o>=1e9?9:o>=1e8?8:o>=1e7?7:o>=1e6?6:o>=1e5?5:o>=1e4?4:o>=1e3?3:o>=100?2:o>=10?1:0},e.popCount=function(o){return o=o-(o>>>1&1431655765),o=(o&858993459)+(o>>>2&858993459),(o+(o>>>4)&252645135)*16843009>>>24};function i(o){var a=32;return o&=-o,o&&a--,o&65535&&(a-=16),o&16711935&&(a-=8),o&252645135&&(a-=4),o&858993459&&(a-=2),o&1431655765&&(a-=1),a}e.countTrailingZeros=i,e.nextPow2=function(o){return o+=o===0,--o,o|=o>>>1,o|=o>>>2,o|=o>>>4,o|=o>>>8,o|=o>>>16,o+1},e.prevPow2=function(o){return o|=o>>>1,o|=o>>>2,o|=o>>>4,o|=o>>>8,o|=o>>>16,o-(o>>>1)},e.parity=function(o){return o^=o>>>16,o^=o>>>8,o^=o>>>4,o&=15,27030>>>o&1};var n=new Array(256);(function(o){for(var a=0;a<256;++a){var s=a,f=a,v=7;for(s>>>=1;s;s>>>=1)f<<=1,f|=s&1,--v;o[a]=f<>>8&255]<<16|n[o>>>16&255]<<8|n[o>>>24&255]},e.interleave2=function(o,a){return o&=65535,o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,a&=65535,a=(a|a<<8)&16711935,a=(a|a<<4)&252645135,a=(a|a<<2)&858993459,a=(a|a<<1)&1431655765,o|a<<1},e.deinterleave2=function(o,a){return o=o>>>a&1431655765,o=(o|o>>>1)&858993459,o=(o|o>>>2)&252645135,o=(o|o>>>4)&16711935,o=(o|o>>>16)&65535,o<<16>>16},e.interleave3=function(o,a,s){return o&=1023,o=(o|o<<16)&4278190335,o=(o|o<<8)&251719695,o=(o|o<<4)&3272356035,o=(o|o<<2)&1227133513,a&=1023,a=(a|a<<16)&4278190335,a=(a|a<<8)&251719695,a=(a|a<<4)&3272356035,a=(a|a<<2)&1227133513,o|=a<<1,s&=1023,s=(s|s<<16)&4278190335,s=(s|s<<8)&251719695,s=(s|s<<4)&3272356035,s=(s|s<<2)&1227133513,o|s<<2},e.deinterleave3=function(o,a){return o=o>>>a&1227133513,o=(o|o>>>2)&3272356035,o=(o|o>>>4)&251719695,o=(o|o>>>8)&4278190335,o=(o|o>>>16)&1023,o<<22>>22},e.nextCombination=function(o){var a=o|o-1;return a+1|(~a&-~a)-1>>>i(o)+1}},8866:function(t){function e(r,i,n){this.shortMessage=i||"",this.longMessage=n||"",this.rawError=r||"",this.message="gl-shader: "+(i||r||"")+(n?` +`+n:""),this.stack=new Error().stack}e.prototype=new Error,e.prototype.name="GLError",e.prototype.constructor=e,t.exports=e},8902:function(t,e,r){var i=r(2478),n=r(3250)[3],o=0,a=1,s=2;t.exports=S;function f(k,M,T,c,h){this.a=k,this.b=M,this.idx=T,this.lowerIds=c,this.upperIds=h}function v(k,M,T,c){this.a=k,this.b=M,this.type=T,this.idx=c}function g(k,M){var T=k.a[0]-M.a[0]||k.a[1]-M.a[1]||k.type-M.type;return T||k.type!==o&&(T=n(k.a,k.b,M.b),T)?T:k.idx-M.idx}function m(k,M){return n(k.a,k.b,M)}function w(k,M,T,c,h){for(var b=i.lt(M,c,m),_=i.gt(M,c,m),P=b;P<_;++P){for(var z=M[P],D=z.lowerIds,B=D.length;B>1&&n(T[D[B-2]],T[D[B-1]],c)>0;)k.push([D[B-1],D[B-2],h]),B-=1;D.length=B,D.push(h);for(var R=z.upperIds,B=R.length;B>1&&n(T[R[B-2]],T[R[B-1]],c)<0;)k.push([R[B-2],R[B-1],h]),B-=1;R.length=B,R.push(h)}}function l(k,M){var T;return k.a[0]z[0]&&h.push(new v(z,P,s,b),new v(P,z,a,b))}h.sort(g);for(var D=h[0].a[0]-(1+Math.abs(h[0].a[0]))*Math.pow(2,-52),B=[new f([D,1],[D,0],-1,[],[])],R=[],b=0,I=h.length;b0;){x=c.pop();for(var h=x.adjacent,b=0;b<=S;++b){var _=h[b];if(!(!_.boundary||_.lastVisited<=-k)){for(var P=_.vertices,z=0;z<=S;++z){var D=P[z];D<0?M[z]=y:M[z]=T[D]}var B=this.orient();if(B>0)return _;_.lastVisited=-k,B===0&&c.push(_)}}}return null},w.walk=function(x,y){var S=this.vertices.length-1,k=this.dimension,M=this.vertices,T=this.tuple,c=y?this.interior.length*Math.random()|0:this.interior.length-1,h=this.interior[c];t:for(;!h.boundary;){for(var b=h.vertices,_=h.adjacent,P=0;P<=k;++P)T[P]=M[b[P]];h.lastVisited=S;for(var P=0;P<=k;++P){var z=_[P];if(!(z.lastVisited>=S)){var D=T[P];T[P]=x;var B=this.orient();if(T[P]=D,B<0){h=z;continue t}else z.boundary?z.lastVisited=-S:z.lastVisited=S}}return}return h},w.addPeaks=function(x,y){var S=this.vertices.length-1,k=this.dimension,M=this.vertices,T=this.tuple,c=this.interior,h=this.simplices,b=[y];y.lastVisited=S,y.vertices[y.vertices.indexOf(-1)]=S,y.boundary=!1,c.push(y);for(var _=[];b.length>0;){var y=b.pop(),P=y.vertices,z=y.adjacent,D=P.indexOf(S);if(!(D<0)){for(var B=0;B<=k;++B)if(B!==D){var R=z[B];if(!(!R.boundary||R.lastVisited>=S)){var I=R.vertices;if(R.lastVisited!==-S){for(var F=0,j=0;j<=k;++j)I[j]<0?(F=j,T[j]=x):T[j]=M[I[j]];var N=this.orient();if(N>0){I[F]=S,R.boundary=!1,c.push(R),b.push(R),R.lastVisited=S;continue}else R.lastVisited=-S}var G=R.adjacent,rt=P.slice(),ct=z.slice(),st=new o(rt,ct,!0);h.push(st);var et=G.indexOf(y);if(!(et<0)){G[et]=st,ct[D]=R,rt[B]=-1,ct[B]=y,z[B]=st,st.flip();for(var j=0;j<=k;++j){var Z=rt[j];if(!(Z<0||Z===S)){for(var ot=new Array(k-1),X=0,Q=0;Q<=k;++Q){var ut=rt[Q];ut<0||Q===j||(ot[X++]=ut)}_.push(new a(ot,st,j))}}}}}}}_.sort(s);for(var B=0;B+1<_.length;B+=2){var J=_[B],q=_[B+1],it=J.index,nt=q.index;it<0||nt<0||(J.cell.adjacent[J.index]=q.cell,q.cell.adjacent[q.index]=J.cell)}},w.insert=function(x,y){var S=this.vertices;S.push(x);var k=this.walk(x,y);if(k){for(var M=this.dimension,T=this.tuple,c=0;c<=M;++c){var h=k.vertices[c];h<0?T[c]=x:T[c]=S[h]}var b=this.orient(T);b<0||b===0&&(k=this.handleBoundaryDegeneracy(k,x),!k)||this.addPeaks(x,k)}},w.boundary=function(){for(var x=this.dimension,y=[],S=this.simplices,k=S.length,M=0;M=0?c[b++]=h[P]:_=P&1;if(_===(x&1)){var z=c[0];c[0]=c[1],c[1]=z}y.push(c)}}return y};function l(x,y){var S=x.length;if(S===0)throw new Error("Must have at least d+1 points");var k=x[0].length;if(S<=k)throw new Error("Must input at least d+1 points");var M=x.slice(0,k+1),T=i.apply(void 0,M);if(T===0)throw new Error("Input not in general position");for(var c=new Array(k+1),h=0;h<=k;++h)c[h]=h;T<0&&(c[0]=1,c[1]=0);for(var b=new o(c,new Array(k+1),!1),_=b.adjacent,P=new Array(k+2),h=0;h<=k;++h){for(var z=c.slice(),D=0;D<=k;++D)D===h&&(z[D]=-1);var B=z[0];z[0]=z[1],z[1]=B;var R=new o(z,new Array(k+1),!0);_[h]=R,P[h]=R}P[k+1]=b;for(var h=0;h<=k;++h)for(var z=_[h].vertices,I=_[h].adjacent,D=0;D<=k;++D){var F=z[D];if(F<0){I[D]=b;continue}for(var j=0;j<=k;++j)_[j].vertices.indexOf(F)<0&&(I[D]=_[j])}for(var N=new m(k,M,P),G=!!y,h=k+1;h=1},l.isTransparent=function(){return this.opacity<1},l.pickSlots=1,l.setPickBase=function(T){this.pickId=T};function x(T){for(var c=g({colormap:T,nshades:256,format:"rgba"}),h=new Uint8Array(1024),b=0;b<256;++b){for(var _=c[b],P=0;P<3;++P)h[4*b+P]=_[P];h[4*b+3]=_[3]*255}return v(h,[256,256,4],[4,0,1])}function y(T){for(var c=T.length,h=new Array(c),b=0;b0){var j=this.triShader;j.bind(),j.uniforms=D,this.triangleVAO.bind(),c.drawArrays(c.TRIANGLES,0,this.triangleCount*3),this.triangleVAO.unbind()}},l.drawPick=function(T){T=T||{};for(var c=this.gl,h=T.model||m,b=T.view||m,_=T.projection||m,P=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],z=0;z<3;++z)P[0][z]=Math.max(P[0][z],this.clipBounds[0][z]),P[1][z]=Math.min(P[1][z],this.clipBounds[1][z]);this._model=[].slice.call(h),this._view=[].slice.call(b),this._projection=[].slice.call(_),this._resolution=[c.drawingBufferWidth,c.drawingBufferHeight];var D={model:h,view:b,projection:_,clipBounds:P,tubeScale:this.tubeScale,vectorScale:this.vectorScale,coneScale:this.coneScale,coneOffset:this.coneOffset,pickId:this.pickId/255},B=this.pickShader;B.bind(),B.uniforms=D,this.triangleCount>0&&(this.triangleVAO.bind(),c.drawArrays(c.TRIANGLES,0,this.triangleCount*3),this.triangleVAO.unbind())},l.pick=function(T){if(!T||T.id!==this.pickId)return null;var c=T.value[0]+256*T.value[1]+65536*T.value[2],h=this.cells[c],b=this.positions[h[1]].slice(0,3),_={position:b,dataCoordinate:b,index:Math.floor(h[1]/48)};return this.traceType==="cone"?_.index=Math.floor(h[1]/48):this.traceType==="streamtube"&&(_.intensity=this.intensity[h[1]],_.velocity=this.vectors[h[1]].slice(0,3),_.divergence=this.vectors[h[1]][3],_.index=c),_},l.dispose=function(){this.texture.dispose(),this.triShader.dispose(),this.pickShader.dispose(),this.triangleVAO.dispose(),this.trianglePositions.dispose(),this.triangleVectors.dispose(),this.triangleColors.dispose(),this.triangleUVs.dispose(),this.triangleIds.dispose()};function S(T,c){var h=i(T,c.meshShader.vertex,c.meshShader.fragment,null,c.meshShader.attributes);return h.attributes.position.location=0,h.attributes.color.location=2,h.attributes.uv.location=3,h.attributes.vector.location=4,h}function k(T,c){var h=i(T,c.pickShader.vertex,c.pickShader.fragment,null,c.pickShader.attributes);return h.attributes.position.location=0,h.attributes.id.location=1,h.attributes.vector.location=4,h}function M(T,c,h){var b=h.shaders;arguments.length===1&&(c=T,T=c.gl);var _=S(T,b),P=k(T,b),z=a(T,v(new Uint8Array([255,255,255,255]),[1,1,4]));z.generateMipmap(),z.minFilter=T.LINEAR_MIPMAP_LINEAR,z.magFilter=T.LINEAR;var D=n(T),B=n(T),R=n(T),I=n(T),F=n(T),j=o(T,[{buffer:D,type:T.FLOAT,size:4},{buffer:F,type:T.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:R,type:T.FLOAT,size:4},{buffer:I,type:T.FLOAT,size:2},{buffer:B,type:T.FLOAT,size:4}]),N=new w(T,z,_,P,D,B,F,R,I,j,h.traceType||"cone");return N.update(c),N}t.exports=M},9127:function(t,e,r){t.exports=o;var i=r(6204),n=r(5771);function o(a){return n(i(a))}},9131:function(t,e,r){var i=r(5177),n=r(9288);t.exports=o;function o(a,s){return s=s||1,a[0]=Math.random(),a[1]=Math.random(),a[2]=Math.random(),a[3]=Math.random(),i(a,a),n(a,a,s),a}},9165:function(t,e,r){t.exports=w;var i=r(2762),n=r(8116),o=r(3436),a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function s(l,x,y,S){this.gl=l,this.shader=S,this.buffer=x,this.vao=y,this.pixelRatio=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1,this.hasAlpha=!1}var f=s.prototype;f.isOpaque=function(){return!this.hasAlpha},f.isTransparent=function(){return this.hasAlpha},f.drawTransparent=f.draw=function(l){var x=this.gl,y=this.shader.uniforms;this.shader.bind();var S=y.view=l.view||a,k=y.projection=l.projection||a;y.model=l.model||a,y.clipBounds=this.clipBounds,y.opacity=this.opacity;var M=S[12],T=S[13],c=S[14],h=S[15],b=l._ortho||!1,_=b?2:1,P=_*this.pixelRatio*(k[3]*M+k[7]*T+k[11]*c+k[15]*h)/x.drawingBufferHeight;this.vao.bind();for(var z=0;z<3;++z)x.lineWidth(this.lineWidth[z]*this.pixelRatio),y.capSize=this.capSize[z]*P,this.lineCount[z]&&x.drawArrays(x.LINES,this.lineOffset[z],this.lineCount[z]);this.vao.unbind()};function v(l,x){for(var y=0;y<3;++y)l[0][y]=Math.min(l[0][y],x[y]),l[1][y]=Math.max(l[1][y],x[y])}var g=(function(){for(var l=new Array(3),x=0;x<3;++x){for(var y=[],S=1;S<=2;++S)for(var k=-1;k<=1;k+=2){var M=(S+x)%3,T=[0,0,0];T[M]=k,y.push(T)}l[x]=y}return l})();function m(l,x,y,S){for(var k=g[S],M=0;M0){var D=b.slice();D[c]+=P[1][c],k.push(b[0],b[1],b[2],z[0],z[1],z[2],z[3],0,0,0,D[0],D[1],D[2],z[0],z[1],z[2],z[3],0,0,0),v(this.bounds,D),T+=2+m(k,D,z,c)}}}this.lineCount[c]=T-this.lineOffset[c]}this.buffer.update(k)}},f.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()};function w(l){var x=l.gl,y=i(x),S=n(x,[{buffer:y,type:x.FLOAT,size:3,offset:0,stride:40},{buffer:y,type:x.FLOAT,size:4,offset:12,stride:40},{buffer:y,type:x.FLOAT,size:3,offset:28,stride:40}]),k=o(x);k.attributes.position.location=0,k.attributes.color.location=1,k.attributes.offset.location=2;var M=new s(x,y,S,k);return M.update(l),M}},9215:function(t,e,r){t.exports=v;var i=r(4769),n=r(2478);function o(g,m,w){return Math.min(m,Math.max(g,w))}function a(g,m,w){this.dimension=g.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var l=0;l=w-1)for(var T=y.length-1,h=g-m[w-1],c=0;c=w-1)for(var M=y.length-1,T=g-m[w-1],c=0;c=0;--w)if(g[--m])return!1;return!0},s.jump=function(g){var m=this.lastT(),w=this.dimension;if(!(g0;--c)l.push(o(k[c-1],M[c-1],arguments[c])),x.push(0)}},s.push=function(g){var m=this.lastT(),w=this.dimension;if(!(g1e-6?1/S:0;this._time.push(g);for(var h=w;h>0;--h){var b=o(M[h-1],T[h-1],arguments[h]);l.push(b),x.push((b-l[y++])*c)}}},s.set=function(g){var m=this.dimension;if(!(g0;--k)w.push(o(y[k-1],S[k-1],arguments[k])),l.push(0)}},s.move=function(g){var m=this.lastT(),w=this.dimension;if(!(g<=m||arguments.length!==w+1)){var l=this._state,x=this._velocity,y=l.length-this.dimension,S=this.bounds,k=S[0],M=S[1],T=g-m,c=T>1e-6?1/T:0;this._time.push(g);for(var h=w;h>0;--h){var b=arguments[h];l.push(o(k[h-1],M[h-1],l[y++]+b)),x.push(b*c)}}},s.idle=function(g){var m=this.lastT();if(!(g=0;--c)l.push(o(k[c],M[c],l[y]+T*x[y])),x.push(0),y+=1}};function f(g){for(var m=new Array(g),w=0;w1&&a.indexOf("Macintosh")!==-1&&a.indexOf("Safari")!==-1&&(s=!0),s}},9226:function(t){t.exports=e;function e(r,i){return r[0]=Math.ceil(i[0]),r[1]=Math.ceil(i[1]),r[2]=Math.ceil(i[2]),r}},9265:function(t){t.exports=e;function e(r,i){return r[0]===i[0]&&r[1]===i[1]&&r[2]===i[2]}},9288:function(t){t.exports=e;function e(r,i,n){return r[0]=i[0]*n,r[1]=i[1]*n,r[2]=i[2]*n,r[3]=i[3]*n,r}},9346:function(t){var e=new Float64Array(4),r=new Float64Array(4),i=new Float64Array(4);function n(o,a,s,f,v){e.length=m?(h=1,_=m+2*x+S):(h=-x/m,_=x*h+S)):(h=0,y>=0?(b=0,_=S):-y>=l?(b=1,_=l+2*y+S):(b=-y/l,_=y*b+S));else if(b<0)b=0,x>=0?(h=0,_=S):-x>=m?(h=1,_=m+2*x+S):(h=-x/m,_=x*h+S);else{var P=1/c;h*=P,b*=P,_=h*(m*h+w*b+2*x)+b*(w*h+l*b+2*y)+S}else{var z,D,B,R;h<0?(z=w+x,D=l+y,D>z?(B=D-z,R=m-2*w+l,B>=R?(h=1,b=0,_=m+2*x+S):(h=B/R,b=1-h,_=h*(m*h+w*b+2*x)+b*(w*h+l*b+2*y)+S)):(h=0,D<=0?(b=1,_=l+2*y+S):y>=0?(b=0,_=S):(b=-y/l,_=y*b+S))):b<0?(z=w+y,D=m+x,D>z?(B=D-z,R=m-2*w+l,B>=R?(b=1,h=0,_=l+2*y+S):(b=B/R,h=1-b,_=h*(m*h+w*b+2*x)+b*(w*h+l*b+2*y)+S)):(b=0,D<=0?(h=1,_=m+2*x+S):x>=0?(h=0,_=S):(h=-x/m,_=x*h+S))):(B=l+y-w-x,B<=0?(h=0,b=1,_=l+2*y+S):(R=m-2*w+l,B>=R?(h=1,b=0,_=m+2*x+S):(h=B/R,b=1-h,_=h*(m*h+w*b+2*x)+b*(w*h+l*b+2*y)+S)))}for(var I=1-h-b,g=0;gy)for(l=y;lx)for(l=x;l=0){for(var I=R.type.charAt(R.type.length-1)|0,F=new Array(I),j=0;j=0;)N+=1;D[B]=N}var G=new Array(y.length);function rt(){M.program=a.program(T,M._vref,M._fref,z,D);for(var ct=0;ctJ&&it>0){var nt=(q[it][0]-J)/(q[it][0]-q[it-1][0]);return q[it][1]*(1-nt)+nt*q[it-1][1]}}return 1}var j=[0,0,0],N={showSurface:!1,showContour:!1,projections:[_.slice(),_.slice(),_.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function G(J,q){var it,nt,dt,Tt=q.axes&&q.axes.lastCubeProps.axis||j,wt=q.showSurface,Ct=q.showContour;for(it=0;it<3;++it)for(wt=wt||q.surfaceProject[it],nt=0;nt<3;++nt)Ct=Ct||q.contourProject[it][nt];for(it=0;it<3;++it){var It=N.projections[it];for(nt=0;nt<16;++nt)It[nt]=0;for(nt=0;nt<4;++nt)It[5*nt]=1;It[5*it]=0,It[12+it]=q.axesBounds[+(Tt[it]>0)][it],l(It,J.model,It);var Nt=N.clipBounds[it];for(dt=0;dt<2;++dt)for(nt=0;nt<3;++nt)Nt[dt][nt]=J.clipBounds[dt][nt];Nt[0][it]=-1e8,Nt[1][it]=1e8}return N.showSurface=wt,N.showContour=Ct,N}var rt={model:_,view:_,projection:_,inverseModel:_.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,objectOffset:[0,0,0],kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1,vertexColor:0},ct=_.slice(),st=[1,0,0,0,1,0,0,0,1];function et(J,q){J=J||{};var it=this.gl;it.disable(it.CULL_FACE),this._colorMap.bind(0);var nt=rt;nt.model=J.model||_,nt.view=J.view||_,nt.projection=J.projection||_,nt.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],nt.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],nt.objectOffset=this.objectOffset,nt.contourColor=this.contourColor[0],nt.inverseModel=x(nt.inverseModel,nt.model);for(var dt=0;dt<2;++dt)for(var Tt=nt.clipBounds[dt],wt=0;wt<3;++wt)Tt[wt]=Math.min(Math.max(this.clipBounds[dt][wt],-1e8),1e8);nt.kambient=this.ambientLight,nt.kdiffuse=this.diffuseLight,nt.kspecular=this.specularLight,nt.roughness=this.roughness,nt.fresnel=this.fresnel,nt.opacity=this.opacity,nt.height=0,nt.permutation=st,nt.vertexColor=this.vertexColor;var Ct=ct;for(l(Ct,nt.view,nt.model),l(Ct,nt.projection,Ct),x(Ct,Ct),dt=0;dt<3;++dt)nt.eyePosition[dt]=Ct[12+dt]/Ct[15];var It=Ct[15];for(dt=0;dt<3;++dt)It+=this.lightPosition[dt]*Ct[4*dt+3];for(dt=0;dt<3;++dt){var Nt=Ct[12+dt];for(wt=0;wt<3;++wt)Nt+=Ct[4*wt+dt]*this.lightPosition[wt];nt.lightPosition[dt]=Nt/It}var te=G(nt,this);if(te.showSurface){for(this._shader.bind(),this._shader.uniforms=nt,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(it.TRIANGLES,this._vertexCount),dt=0;dt<3;++dt)!this.surfaceProject[dt]||!this.vertexCount||(this._shader.uniforms.model=te.projections[dt],this._shader.uniforms.clipBounds=te.clipBounds[dt],this._vao.draw(it.TRIANGLES,this._vertexCount));this._vao.unbind()}if(te.showContour){var Jt=this._contourShader;nt.kambient=1,nt.kdiffuse=0,nt.kspecular=0,nt.opacity=1,Jt.bind(),Jt.uniforms=nt;var ee=this._contourVAO;for(ee.bind(),dt=0;dt<3;++dt)for(Jt.uniforms.permutation=z[dt],it.lineWidth(this.contourWidth[dt]*this.pixelRatio),wt=0;wt>4)/16)/255,dt=Math.floor(nt),Tt=nt-dt,wt=q[1]*(J.value[1]+(J.value[2]&15)/16)/255,Ct=Math.floor(wt),It=wt-Ct;dt+=1,Ct+=1;var Nt=it.position;Nt[0]=Nt[1]=Nt[2]=0;for(var te=0;te<2;++te)for(var Jt=te?Tt:1-Tt,ee=0;ee<2;++ee)for(var Zt=ee?It:1-It,mt=dt+te,bt=Ct+ee,vt=Jt*Zt,Ut=0;Ut<3;++Ut)Nt[Ut]+=this._field[Ut].get(mt,bt)*vt;for(var re=this._pickResult.level,Kt=0;Kt<3;++Kt)if(re[Kt]=y.le(this.contourLevels[Kt],Nt[Kt]),re[Kt]<0)this.contourLevels[Kt].length>0&&(re[Kt]=0);else if(re[Kt]Math.abs(Me-Nt[Kt])&&(re[Kt]+=1)}for(it.index[0]=Tt<.5?dt:dt+1,it.index[1]=It<.5?Ct:Ct+1,it.uv[0]=nt/q[0],it.uv[1]=wt/q[1],Ut=0;Ut<3;++Ut)it.dataCoordinate[Ut]=this._field[Ut].get(it.index[0],it.index[1]);return it},I.padField=function(J,q){var it=q.shape.slice(),nt=J.shape.slice();v.assign(J.lo(1,1).hi(it[0],it[1]),q),v.assign(J.lo(1).hi(it[0],1),q.hi(it[0],1)),v.assign(J.lo(1,nt[1]-1).hi(it[0],1),q.lo(0,it[1]-1).hi(it[0],1)),v.assign(J.lo(0,1).hi(1,it[1]),q.hi(1)),v.assign(J.lo(nt[0]-1,1).hi(1,it[1]),q.lo(it[0]-1)),J.set(0,0,q.get(0,0)),J.set(0,nt[1]-1,q.get(0,it[1]-1)),J.set(nt[0]-1,0,q.get(it[0]-1,0)),J.set(nt[0]-1,nt[1]-1,q.get(it[0]-1,it[1]-1))};function ot(J,q){return Array.isArray(J)?[q(J[0]),q(J[1]),q(J[2])]:[q(J),q(J),q(J)]}function X(J){return Array.isArray(J)?J.length===3?[J[0],J[1],J[2],1]:[J[0],J[1],J[2],J[3]]:[0,0,0,1]}function Q(J){if(Array.isArray(J)){if(Array.isArray(J))return[X(J[0]),X(J[1]),X(J[2])];var q=X(J);return[q.slice(),q.slice(),q.slice()]}}I.update=function(J){J=J||{},this.objectOffset=J.objectOffset||this.objectOffset,this.dirty=!0,"contourWidth"in J&&(this.contourWidth=ot(J.contourWidth,Number)),"showContour"in J&&(this.showContour=ot(J.showContour,Boolean)),"showSurface"in J&&(this.showSurface=!!J.showSurface),"contourTint"in J&&(this.contourTint=ot(J.contourTint,Boolean)),"contourColor"in J&&(this.contourColor=Q(J.contourColor)),"contourProject"in J&&(this.contourProject=ot(J.contourProject,function(ia){return ot(ia,Boolean)})),"surfaceProject"in J&&(this.surfaceProject=J.surfaceProject),"dynamicColor"in J&&(this.dynamicColor=Q(J.dynamicColor)),"dynamicTint"in J&&(this.dynamicTint=ot(J.dynamicTint,Number)),"dynamicWidth"in J&&(this.dynamicWidth=ot(J.dynamicWidth,Number)),"opacity"in J&&(this.opacity=J.opacity),"opacityscale"in J&&(this.opacityscale=J.opacityscale),"colorBounds"in J&&(this.colorBounds=J.colorBounds),"vertexColor"in J&&(this.vertexColor=J.vertexColor?1:0),"colormap"in J&&this._colorMap.setPixels(this.genColormap(J.colormap,this.opacityscale));var q=J.field||J.coords&&J.coords[2]||null,it=!1;if(q||(this._field[2].shape[0]||this._field[2].shape[2]?q=this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):q=this._field[2].hi(0,0)),"field"in J||"coords"in J){var nt=(q.shape[0]+2)*(q.shape[1]+2);nt>this._field[2].data.length&&(s.freeFloat(this._field[2].data),this._field[2].data=s.mallocFloat(i.nextPow2(nt))),this._field[2]=m(this._field[2].data,[q.shape[0]+2,q.shape[1]+2]),this.padField(this._field[2],q),this.shape=q.shape.slice();for(var dt=this.shape,Tt=0;Tt<2;++Tt)this._field[2].size>this._field[Tt].data.length&&(s.freeFloat(this._field[Tt].data),this._field[Tt].data=s.mallocFloat(this._field[2].size)),this._field[Tt]=m(this._field[Tt].data,[dt[0]+2,dt[1]+2]);if(J.coords){var wt=J.coords;if(!Array.isArray(wt)||wt.length!==3)throw new Error("gl-surface: invalid coordinates for x/y");for(Tt=0;Tt<2;++Tt){var Ct=wt[Tt];for(ee=0;ee<2;++ee)if(Ct.shape[ee]!==dt[ee])throw new Error("gl-surface: coords have incorrect shape");this.padField(this._field[Tt],Ct)}}else if(J.ticks){var It=J.ticks;if(!Array.isArray(It)||It.length!==2)throw new Error("gl-surface: invalid ticks");for(Tt=0;Tt<2;++Tt){var Nt=It[Tt];if((Array.isArray(Nt)||Nt.length)&&(Nt=m(Nt)),Nt.shape[0]!==dt[Tt])throw new Error("gl-surface: invalid tick length");var te=m(Nt.data,dt);te.stride[Tt]=Nt.stride[0],te.stride[Tt^1]=0,this.padField(this._field[Tt],te)}}else{for(Tt=0;Tt<2;++Tt){var Jt=[0,0];Jt[Tt]=1,this._field[Tt]=m(this._field[Tt].data,[dt[0]+2,dt[1]+2],Jt,0)}this._field[0].set(0,0,0);for(var ee=0;ee0){for(var Kn=0;Kn<5;++Kn)ar.pop();_t-=1}continue t}}}dn.push(_t)}this._contourOffsets[Ye]=pn,this._contourCounts[Ye]=dn}var $n=s.mallocFloat(ar.length);for(Tt=0;Tt=0&&(T=k|0,M+=h*T,c-=T),new y(this.data,c,h,M)},S.step=function(k){var M=this.shape[0],T=this.stride[0],c=this.offset,h=0,b=Math.ceil;return typeof k=="number"&&(h=k|0,h<0?(c+=T*(M-1),M=b(-M/h)):M=b(M/h),T*=h),new y(this.data,M,T,c)},S.transpose=function(k){k=k===void 0?0:k|0;var M=this.shape,T=this.stride;return new y(this.data,M[k],T[k],this.offset)},S.pick=function(k){var M=[],T=[],c=this.offset;typeof k=="number"&&k>=0?c=c+this.stride[0]*k|0:(M.push(this.shape[0]),T.push(this.stride[0]));var h=l[M.length+1];return h(this.data,M,T,c)},function(k,M,T,c){return new y(k,M[0],T[0],c)}},2:function(w,l,x){function y(k,M,T,c,h,b){this.data=k,this.shape=[M,T],this.stride=[c,h],this.offset=b|0}var S=y.prototype;return S.dtype=w,S.dimension=2,Object.defineProperty(S,"size",{get:function(){return this.shape[0]*this.shape[1]}}),Object.defineProperty(S,"order",{get:function(){return Math.abs(this.stride[0])>Math.abs(this.stride[1])?[1,0]:[0,1]}}),S.set=function(k,M,T){return w==="generic"?this.data.set(this.offset+this.stride[0]*k+this.stride[1]*M,T):this.data[this.offset+this.stride[0]*k+this.stride[1]*M]=T},S.get=function(k,M){return w==="generic"?this.data.get(this.offset+this.stride[0]*k+this.stride[1]*M):this.data[this.offset+this.stride[0]*k+this.stride[1]*M]},S.index=function(k,M){return this.offset+this.stride[0]*k+this.stride[1]*M},S.hi=function(k,M){return new y(this.data,typeof k!="number"||k<0?this.shape[0]:k|0,typeof M!="number"||M<0?this.shape[1]:M|0,this.stride[0],this.stride[1],this.offset)},S.lo=function(k,M){var T=this.offset,c=0,h=this.shape[0],b=this.shape[1],_=this.stride[0],P=this.stride[1];return typeof k=="number"&&k>=0&&(c=k|0,T+=_*c,h-=c),typeof M=="number"&&M>=0&&(c=M|0,T+=P*c,b-=c),new y(this.data,h,b,_,P,T)},S.step=function(k,M){var T=this.shape[0],c=this.shape[1],h=this.stride[0],b=this.stride[1],_=this.offset,P=0,z=Math.ceil;return typeof k=="number"&&(P=k|0,P<0?(_+=h*(T-1),T=z(-T/P)):T=z(T/P),h*=P),typeof M=="number"&&(P=M|0,P<0?(_+=b*(c-1),c=z(-c/P)):c=z(c/P),b*=P),new y(this.data,T,c,h,b,_)},S.transpose=function(k,M){k=k===void 0?0:k|0,M=M===void 0?1:M|0;var T=this.shape,c=this.stride;return new y(this.data,T[k],T[M],c[k],c[M],this.offset)},S.pick=function(k,M){var T=[],c=[],h=this.offset;typeof k=="number"&&k>=0?h=h+this.stride[0]*k|0:(T.push(this.shape[0]),c.push(this.stride[0])),typeof M=="number"&&M>=0?h=h+this.stride[1]*M|0:(T.push(this.shape[1]),c.push(this.stride[1]));var b=l[T.length+1];return b(this.data,T,c,h)},function(k,M,T,c){return new y(k,M[0],M[1],T[0],T[1],c)}},3:function(w,l,x){function y(k,M,T,c,h,b,_,P){this.data=k,this.shape=[M,T,c],this.stride=[h,b,_],this.offset=P|0}var S=y.prototype;return S.dtype=w,S.dimension=3,Object.defineProperty(S,"size",{get:function(){return this.shape[0]*this.shape[1]*this.shape[2]}}),Object.defineProperty(S,"order",{get:function(){var k=Math.abs(this.stride[0]),M=Math.abs(this.stride[1]),T=Math.abs(this.stride[2]);return k>M?M>T?[2,1,0]:k>T?[1,2,0]:[1,0,2]:k>T?[2,0,1]:T>M?[0,1,2]:[0,2,1]}}),S.set=function(k,M,T,c){return w==="generic"?this.data.set(this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T,c):this.data[this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T]=c},S.get=function(k,M,T){return w==="generic"?this.data.get(this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T):this.data[this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T]},S.index=function(k,M,T){return this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T},S.hi=function(k,M,T){return new y(this.data,typeof k!="number"||k<0?this.shape[0]:k|0,typeof M!="number"||M<0?this.shape[1]:M|0,typeof T!="number"||T<0?this.shape[2]:T|0,this.stride[0],this.stride[1],this.stride[2],this.offset)},S.lo=function(k,M,T){var c=this.offset,h=0,b=this.shape[0],_=this.shape[1],P=this.shape[2],z=this.stride[0],D=this.stride[1],B=this.stride[2];return typeof k=="number"&&k>=0&&(h=k|0,c+=z*h,b-=h),typeof M=="number"&&M>=0&&(h=M|0,c+=D*h,_-=h),typeof T=="number"&&T>=0&&(h=T|0,c+=B*h,P-=h),new y(this.data,b,_,P,z,D,B,c)},S.step=function(k,M,T){var c=this.shape[0],h=this.shape[1],b=this.shape[2],_=this.stride[0],P=this.stride[1],z=this.stride[2],D=this.offset,B=0,R=Math.ceil;return typeof k=="number"&&(B=k|0,B<0?(D+=_*(c-1),c=R(-c/B)):c=R(c/B),_*=B),typeof M=="number"&&(B=M|0,B<0?(D+=P*(h-1),h=R(-h/B)):h=R(h/B),P*=B),typeof T=="number"&&(B=T|0,B<0?(D+=z*(b-1),b=R(-b/B)):b=R(b/B),z*=B),new y(this.data,c,h,b,_,P,z,D)},S.transpose=function(k,M,T){k=k===void 0?0:k|0,M=M===void 0?1:M|0,T=T===void 0?2:T|0;var c=this.shape,h=this.stride;return new y(this.data,c[k],c[M],c[T],h[k],h[M],h[T],this.offset)},S.pick=function(k,M,T){var c=[],h=[],b=this.offset;typeof k=="number"&&k>=0?b=b+this.stride[0]*k|0:(c.push(this.shape[0]),h.push(this.stride[0])),typeof M=="number"&&M>=0?b=b+this.stride[1]*M|0:(c.push(this.shape[1]),h.push(this.stride[1])),typeof T=="number"&&T>=0?b=b+this.stride[2]*T|0:(c.push(this.shape[2]),h.push(this.stride[2]));var _=l[c.length+1];return _(this.data,c,h,b)},function(k,M,T,c){return new y(k,M[0],M[1],M[2],T[0],T[1],T[2],c)}},4:function(w,l,x){function y(k,M,T,c,h,b,_,P,z,D){this.data=k,this.shape=[M,T,c,h],this.stride=[b,_,P,z],this.offset=D|0}var S=y.prototype;return S.dtype=w,S.dimension=4,Object.defineProperty(S,"size",{get:function(){return this.shape[0]*this.shape[1]*this.shape[2]*this.shape[3]}}),Object.defineProperty(S,"order",{get:x}),S.set=function(k,M,T,c,h){return w==="generic"?this.data.set(this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T+this.stride[3]*c,h):this.data[this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T+this.stride[3]*c]=h},S.get=function(k,M,T,c){return w==="generic"?this.data.get(this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T+this.stride[3]*c):this.data[this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T+this.stride[3]*c]},S.index=function(k,M,T,c){return this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T+this.stride[3]*c},S.hi=function(k,M,T,c){return new y(this.data,typeof k!="number"||k<0?this.shape[0]:k|0,typeof M!="number"||M<0?this.shape[1]:M|0,typeof T!="number"||T<0?this.shape[2]:T|0,typeof c!="number"||c<0?this.shape[3]:c|0,this.stride[0],this.stride[1],this.stride[2],this.stride[3],this.offset)},S.lo=function(k,M,T,c){var h=this.offset,b=0,_=this.shape[0],P=this.shape[1],z=this.shape[2],D=this.shape[3],B=this.stride[0],R=this.stride[1],I=this.stride[2],F=this.stride[3];return typeof k=="number"&&k>=0&&(b=k|0,h+=B*b,_-=b),typeof M=="number"&&M>=0&&(b=M|0,h+=R*b,P-=b),typeof T=="number"&&T>=0&&(b=T|0,h+=I*b,z-=b),typeof c=="number"&&c>=0&&(b=c|0,h+=F*b,D-=b),new y(this.data,_,P,z,D,B,R,I,F,h)},S.step=function(k,M,T,c){var h=this.shape[0],b=this.shape[1],_=this.shape[2],P=this.shape[3],z=this.stride[0],D=this.stride[1],B=this.stride[2],R=this.stride[3],I=this.offset,F=0,j=Math.ceil;return typeof k=="number"&&(F=k|0,F<0?(I+=z*(h-1),h=j(-h/F)):h=j(h/F),z*=F),typeof M=="number"&&(F=M|0,F<0?(I+=D*(b-1),b=j(-b/F)):b=j(b/F),D*=F),typeof T=="number"&&(F=T|0,F<0?(I+=B*(_-1),_=j(-_/F)):_=j(_/F),B*=F),typeof c=="number"&&(F=c|0,F<0?(I+=R*(P-1),P=j(-P/F)):P=j(P/F),R*=F),new y(this.data,h,b,_,P,z,D,B,R,I)},S.transpose=function(k,M,T,c){k=k===void 0?0:k|0,M=M===void 0?1:M|0,T=T===void 0?2:T|0,c=c===void 0?3:c|0;var h=this.shape,b=this.stride;return new y(this.data,h[k],h[M],h[T],h[c],b[k],b[M],b[T],b[c],this.offset)},S.pick=function(k,M,T,c){var h=[],b=[],_=this.offset;typeof k=="number"&&k>=0?_=_+this.stride[0]*k|0:(h.push(this.shape[0]),b.push(this.stride[0])),typeof M=="number"&&M>=0?_=_+this.stride[1]*M|0:(h.push(this.shape[1]),b.push(this.stride[1])),typeof T=="number"&&T>=0?_=_+this.stride[2]*T|0:(h.push(this.shape[2]),b.push(this.stride[2])),typeof c=="number"&&c>=0?_=_+this.stride[3]*c|0:(h.push(this.shape[3]),b.push(this.stride[3]));var P=l[h.length+1];return P(this.data,h,b,_)},function(k,M,T,c){return new y(k,M[0],M[1],M[2],M[3],T[0],T[1],T[2],T[3],c)}},5:function(w,l,x){function y(k,M,T,c,h,b,_,P,z,D,B,R){this.data=k,this.shape=[M,T,c,h,b],this.stride=[_,P,z,D,B],this.offset=R|0}var S=y.prototype;return S.dtype=w,S.dimension=5,Object.defineProperty(S,"size",{get:function(){return this.shape[0]*this.shape[1]*this.shape[2]*this.shape[3]*this.shape[4]}}),Object.defineProperty(S,"order",{get:x}),S.set=function(k,M,T,c,h,b){return w==="generic"?this.data.set(this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T+this.stride[3]*c+this.stride[4]*h,b):this.data[this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T+this.stride[3]*c+this.stride[4]*h]=b},S.get=function(k,M,T,c,h){return w==="generic"?this.data.get(this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T+this.stride[3]*c+this.stride[4]*h):this.data[this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T+this.stride[3]*c+this.stride[4]*h]},S.index=function(k,M,T,c,h){return this.offset+this.stride[0]*k+this.stride[1]*M+this.stride[2]*T+this.stride[3]*c+this.stride[4]*h},S.hi=function(k,M,T,c,h){return new y(this.data,typeof k!="number"||k<0?this.shape[0]:k|0,typeof M!="number"||M<0?this.shape[1]:M|0,typeof T!="number"||T<0?this.shape[2]:T|0,typeof c!="number"||c<0?this.shape[3]:c|0,typeof h!="number"||h<0?this.shape[4]:h|0,this.stride[0],this.stride[1],this.stride[2],this.stride[3],this.stride[4],this.offset)},S.lo=function(k,M,T,c,h){var b=this.offset,_=0,P=this.shape[0],z=this.shape[1],D=this.shape[2],B=this.shape[3],R=this.shape[4],I=this.stride[0],F=this.stride[1],j=this.stride[2],N=this.stride[3],G=this.stride[4];return typeof k=="number"&&k>=0&&(_=k|0,b+=I*_,P-=_),typeof M=="number"&&M>=0&&(_=M|0,b+=F*_,z-=_),typeof T=="number"&&T>=0&&(_=T|0,b+=j*_,D-=_),typeof c=="number"&&c>=0&&(_=c|0,b+=N*_,B-=_),typeof h=="number"&&h>=0&&(_=h|0,b+=G*_,R-=_),new y(this.data,P,z,D,B,R,I,F,j,N,G,b)},S.step=function(k,M,T,c,h){var b=this.shape[0],_=this.shape[1],P=this.shape[2],z=this.shape[3],D=this.shape[4],B=this.stride[0],R=this.stride[1],I=this.stride[2],F=this.stride[3],j=this.stride[4],N=this.offset,G=0,rt=Math.ceil;return typeof k=="number"&&(G=k|0,G<0?(N+=B*(b-1),b=rt(-b/G)):b=rt(b/G),B*=G),typeof M=="number"&&(G=M|0,G<0?(N+=R*(_-1),_=rt(-_/G)):_=rt(_/G),R*=G),typeof T=="number"&&(G=T|0,G<0?(N+=I*(P-1),P=rt(-P/G)):P=rt(P/G),I*=G),typeof c=="number"&&(G=c|0,G<0?(N+=F*(z-1),z=rt(-z/G)):z=rt(z/G),F*=G),typeof h=="number"&&(G=h|0,G<0?(N+=j*(D-1),D=rt(-D/G)):D=rt(D/G),j*=G),new y(this.data,b,_,P,z,D,B,R,I,F,j,N)},S.transpose=function(k,M,T,c,h){k=k===void 0?0:k|0,M=M===void 0?1:M|0,T=T===void 0?2:T|0,c=c===void 0?3:c|0,h=h===void 0?4:h|0;var b=this.shape,_=this.stride;return new y(this.data,b[k],b[M],b[T],b[c],b[h],_[k],_[M],_[T],_[c],_[h],this.offset)},S.pick=function(k,M,T,c,h){var b=[],_=[],P=this.offset;typeof k=="number"&&k>=0?P=P+this.stride[0]*k|0:(b.push(this.shape[0]),_.push(this.stride[0])),typeof M=="number"&&M>=0?P=P+this.stride[1]*M|0:(b.push(this.shape[1]),_.push(this.stride[1])),typeof T=="number"&&T>=0?P=P+this.stride[2]*T|0:(b.push(this.shape[2]),_.push(this.stride[2])),typeof c=="number"&&c>=0?P=P+this.stride[3]*c|0:(b.push(this.shape[3]),_.push(this.stride[3])),typeof h=="number"&&h>=0?P=P+this.stride[4]*h|0:(b.push(this.shape[4]),_.push(this.stride[4]));var z=l[b.length+1];return z(this.data,b,_,P)},function(k,M,T,c){return new y(k,M[0],M[1],M[2],M[3],M[4],T[0],T[1],T[2],T[3],T[4],c)}}};function f(w,l){var x=l===-1?"T":String(l),y=s[x];return l===-1?y(w):l===0?y(w,g[w][0]):y(w,g[w],a)}function v(w){if(i(w))return"buffer";if(n)switch(Object.prototype.toString.call(w)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(w)?"array":"generic"}var g={generic:[],buffer:[],array:[],float32:[],float64:[],int8:[],int16:[],int32:[],uint8_clamped:[],uint8:[],uint16:[],uint32:[],bigint64:[],biguint64:[]};function m(w,l,x,y){if(w===void 0){var h=g.array[0];return h([])}else typeof w=="number"&&(w=[w]);l===void 0&&(l=[w.length]);var S=l.length;if(x===void 0){x=new Array(S);for(var k=S-1,M=1;k>=0;--k)x[k]=M,M*=l[k]}if(y===void 0){y=0;for(var k=0;k1e-6?(x[0]=S/c,x[1]=k/c,x[2]=M/c,x[3]=T/c):(x[0]=x[1]=x[2]=0,x[3]=1)}function m(x,y,S){this.radius=i([S]),this.center=i(y),this.rotation=i(x),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}var w=m.prototype;w.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},w.recalcMatrix=function(x){this.radius.curve(x),this.center.curve(x),this.rotation.curve(x);var y=this.computedRotation;g(y,y);var S=this.computedMatrix;o(S,y);var k=this.computedCenter,M=this.computedEye,T=this.computedUp,c=Math.exp(this.computedRadius[0]);M[0]=k[0]+c*S[2],M[1]=k[1]+c*S[6],M[2]=k[2]+c*S[10],T[0]=S[1],T[1]=S[5],T[2]=S[9];for(var h=0;h<3;++h){for(var b=0,_=0;_<3;++_)b+=S[h+4*_]*M[_];S[12+h]=-b}},w.getMatrix=function(x,y){this.recalcMatrix(x);var S=this.computedMatrix;if(y){for(var k=0;k<16;++k)y[k]=S[k];return y}return S},w.idle=function(x){this.center.idle(x),this.radius.idle(x),this.rotation.idle(x)},w.flush=function(x){this.center.flush(x),this.radius.flush(x),this.rotation.flush(x)},w.pan=function(x,y,S,k){y=y||0,S=S||0,k=k||0,this.recalcMatrix(x);var M=this.computedMatrix,T=M[1],c=M[5],h=M[9],b=f(T,c,h);T/=b,c/=b,h/=b;var _=M[0],P=M[4],z=M[8],D=_*T+P*c+z*h;_-=T*D,P-=c*D,z-=h*D;var B=f(_,P,z);_/=B,P/=B,z/=B,M[2],M[6],M[10];var R=_*y+T*S,I=P*y+c*S,F=z*y+h*S;this.center.move(x,R,I,F);var j=Math.exp(this.computedRadius[0]);j=Math.max(1e-4,j+k),this.radius.set(x,Math.log(j))},w.rotate=function(x,y,S,k){this.recalcMatrix(x),y=y||0,S=S||0;var M=this.computedMatrix,T=M[0],c=M[4],h=M[8],b=M[1],_=M[5],P=M[9],z=M[2],D=M[6],B=M[10],R=y*T+S*b,I=y*c+S*_,F=y*h+S*P,j=-(D*F-B*I),N=-(B*R-z*F),G=-(z*I-D*R),rt=Math.sqrt(Math.max(0,1-Math.pow(j,2)-Math.pow(N,2)-Math.pow(G,2))),ct=v(j,N,G,rt);ct>1e-6?(j/=ct,N/=ct,G/=ct,rt/=ct):(j=N=G=0,rt=1);var st=this.computedRotation,et=st[0],Z=st[1],ot=st[2],X=st[3],Q=et*rt+X*j+Z*G-ot*N,ut=Z*rt+X*N+ot*j-et*G,J=ot*rt+X*G+et*N-Z*j,q=X*rt-et*j-Z*N-ot*G;if(k){j=z,N=D,G=B;var it=Math.sin(k)/f(j,N,G);j*=it,N*=it,G*=it,rt=Math.cos(y),Q=Q*rt+q*j+ut*G-J*N,ut=ut*rt+q*N+J*j-Q*G,J=J*rt+q*G+Q*N-ut*j,q=q*rt-Q*j-ut*N-J*G}var nt=v(Q,ut,J,q);nt>1e-6?(Q/=nt,ut/=nt,J/=nt,q/=nt):(Q=ut=J=0,q=1),this.rotation.set(x,Q,ut,J,q)},w.lookAt=function(x,y,S,k){this.recalcMatrix(x),S=S||this.computedCenter,y=y||this.computedEye,k=k||this.computedUp;var M=this.computedMatrix;n(M,y,S,k);var T=this.computedRotation;s(T,M[0],M[1],M[2],M[4],M[5],M[6],M[8],M[9],M[10]),g(T,T),this.rotation.set(x,T[0],T[1],T[2],T[3]);for(var c=0,h=0;h<3;++h)c+=Math.pow(S[h]-y[h],2);this.radius.set(x,.5*Math.log(Math.max(c,1e-6))),this.center.set(x,S[0],S[1],S[2])},w.translate=function(x,y,S,k){this.center.move(x,y||0,S||0,k||0)},w.setMatrix=function(x,y){var S=this.computedRotation;s(S,y[0],y[1],y[2],y[4],y[5],y[6],y[8],y[9],y[10]),g(S,S),this.rotation.set(x,S[0],S[1],S[2],S[3]);var k=this.computedMatrix;a(k,y);var M=k[15];if(Math.abs(M)>1e-6){var T=k[12]/M,c=k[13]/M,h=k[14]/M;this.recalcMatrix(x);var b=Math.exp(this.computedRadius[0]);this.center.set(x,T-k[2]*b,c-k[6]*b,h-k[10]*b),this.radius.idle(x)}else this.center.idle(x),this.radius.idle(x)},w.setDistance=function(x,y){y>0&&this.radius.set(x,Math.log(y))},w.setDistanceLimits=function(x,y){x>0?x=Math.log(x):x=-1/0,y>0?y=Math.log(y):y=1/0,y=Math.max(y,x),this.radius.bounds[0][0]=x,this.radius.bounds[1][0]=y},w.getDistanceLimits=function(x){var y=this.radius.bounds;return x?(x[0]=Math.exp(y[0][0]),x[1]=Math.exp(y[1][0]),x):[Math.exp(y[0][0]),Math.exp(y[1][0])]},w.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},w.fromJSON=function(x){var y=this.lastT(),S=x.center;S&&this.center.set(y,S[0],S[1],S[2]);var k=x.rotation;k&&this.rotation.set(y,k[0],k[1],k[2],k[3]);var M=x.distance;M&&M>0&&this.radius.set(y,Math.log(M)),this.setDistanceLimits(x.zoomMin,x.zoomMax)};function l(x){x=x||{};var y=x.center||[0,0,0],S=x.rotation||[0,0,0,1],k=x.radius||1;y=[].slice.call(y,0,3),S=[].slice.call(S,0,4),g(S,S);var M=new m(S,y,Math.log(k));return M.setDistanceLimits(x.zoomMin,x.zoomMax),("eye"in x||"up"in x)&&M.lookAt(0,x.eye,x.center,x.up),M}},9994:function(t,e,r){var i=r(9618),n=r(8277);t.exports=function(o,a){for(var s=[],f=o,v=1;Array.isArray(f);)s.push(f.length),v*=f.length,f=f[0];return s.length===0?i():(a||(a=i(new Float64Array(v),s)),n(a,o),a)}}},d={};function E(t){var e=d[t];if(e!==void 0)return e.exports;var r=d[t]={id:t,loaded:!1,exports:{}};return u[t].call(r.exports,r,r.exports,E),r.loaded=!0,r.exports}(function(){E.g=(function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}})()})(),(function(){E.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t}})();var A=E(1964);V.exports=A})()}),k3=Vt((K,V)=>{V.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}}),I8=Vt((K,V)=>{var u=k3();V.exports=E;var d={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function E(A){var t,e=[],r=1,i;if(typeof A=="string")if(A=A.toLowerCase(),u[A])e=u[A].slice(),i="rgb";else if(A==="transparent")r=0,i="rgb",e=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(A)){var n=A.slice(1),o=n.length,a=o<=4;r=1,a?(e=[parseInt(n[0]+n[0],16),parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16)],o===4&&(r=parseInt(n[3]+n[3],16)/255)):(e=[parseInt(n[0]+n[1],16),parseInt(n[2]+n[3],16),parseInt(n[4]+n[5],16)],o===8&&(r=parseInt(n[6]+n[7],16)/255)),e[0]||(e[0]=0),e[1]||(e[1]=0),e[2]||(e[2]=0),i="rgb"}else if(t=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(A)){var s=t[1],f=s==="rgb",n=s.replace(/a$/,"");i=n;var o=n==="cmyk"?4:n==="gray"?1:3;e=t[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(m,w){if(/%$/.test(m))return w===o?parseFloat(m)/100:n==="rgb"?parseFloat(m)*255/100:parseFloat(m);if(n[w]==="h"){if(/deg$/.test(m))return parseFloat(m);if(d[m]!==void 0)return d[m]}return parseFloat(m)}),s===n&&e.push(1),r=f||e[o]===void 0?1:e[o],e=e.slice(0,o)}else A.length>10&&/[0-9](?:\s|\/)/.test(A)&&(e=A.match(/([0-9]+)/g).map(function(v){return parseFloat(v)}),i=A.match(/([a-z])/ig).join("").toLowerCase());else isNaN(A)?Array.isArray(A)||A.length?(e=[A[0],A[1],A[2]],i="rgb",r=A.length===4?A[3]:1):A instanceof Object&&(A.r!=null||A.red!=null||A.R!=null?(i="rgb",e=[A.r||A.red||A.R||0,A.g||A.green||A.G||0,A.b||A.blue||A.B||0]):(i="hsl",e=[A.h||A.hue||A.H||0,A.s||A.saturation||A.S||0,A.l||A.lightness||A.L||A.b||A.brightness]),r=A.a||A.alpha||A.opacity||1,A.opacity!=null&&(r/=100)):(i="rgb",e=[A>>>16,(A&65280)>>>8,A&255]);return{space:i,values:e,alpha:r}}}),P8=Vt((K,V)=>{var u=I8();V.exports=function(E){Array.isArray(E)&&E.raw&&(E=String.raw.apply(null,arguments));var A,t=u(E);if(!t.space)return[];var e=[0,0,0],r=t.space[0]==="h"?[360,100,100]:[255,255,255];return A=Array(3),A[0]=Math.min(Math.max(t.values[0],e[0]),r[0]),A[1]=Math.min(Math.max(t.values[1],e[1]),r[1]),A[2]=Math.min(Math.max(t.values[2],e[2]),r[2]),t.space[0]==="h"&&(A=d(A)),A.push(Math.min(Math.max(t.alpha,0),1)),A};function d(E){var A=E[0]/360,t=E[1]/100,e=E[2]/100,r,i,n,o,a,s=0;if(t===0)return a=e*255,[a,a,a];for(i=e<.5?e*(1+t):e+t-e*t,r=2*e-i,o=[0,0,0];s<3;)n=A+1/3*-(s-1),n<0?n++:n>1&&n--,a=6*n<1?r+(i-r)*6*n:2*n<1?i:3*n<2?r+(i-r)*(2/3-n)*6:r,o[s++]=a*255;return o}}),Ev=Vt((K,V)=>{V.exports=u;function u(d,E,A){return EA?A:d:dE?E:d}}),Ax=Vt((K,V)=>{V.exports=function(u){switch(u){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}}),Nd=Vt((K,V)=>{var u=P8(),d=Ev(),E=Ax();V.exports=function(t,e){(e==="float"||!e)&&(e="array"),e==="uint"&&(e="uint8"),e==="uint_clamped"&&(e="uint8_clamped");var r=E(e),i=new r(4),n=e!=="uint8"&&e!=="uint8_clamped";return(!t.length||typeof t=="string")&&(t=u(t),t[0]/=255,t[1]/=255,t[2]/=255),A(t)?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3]!=null?t[3]:255,n&&(i[0]/=255,i[1]/=255,i[2]/=255,i[3]/=255),i):(n?(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3]!=null?t[3]:1):(i[0]=d(Math.floor(t[0]*255),0,255),i[1]=d(Math.floor(t[1]*255),0,255),i[2]=d(Math.floor(t[2]*255),0,255),i[3]=t[3]==null?255:d(Math.floor(t[3]*255),0,255)),i)};function A(t){return!!(t instanceof Uint8Array||t instanceof Uint8ClampedArray||Array.isArray(t)&&(t[0]>1||t[0]===0)&&(t[1]>1||t[1]===0)&&(t[2]>1||t[2]===0)&&(!t[3]||t[3]>1))}}),Vp=Vt((K,V)=>{var u=Nd();function d(E){return E?u(E):[0,0,0,1]}V.exports=d}),Hp=Vt((K,V)=>{var u=Lo(),d=Af(),E=Nd(),A=xu(),t=af().defaultLine,e=nh().isArrayOrTypedArray,r=E(t),i=1;function n(v,g){var m=v;return m[3]*=g,m}function o(v){if(u(v))return r;var g=E(v);return g.length?g:r}function a(v){return u(v)?v:i}function s(v,g,m){var w=v.color;w&&w._inputArray&&(w=w._inputArray);var l=e(w),x=e(g),y=A.extractOpts(v),S=[],k,M,T,c,h;if(y.colorscale!==void 0?k=A.makeColorScaleFuncFromTrace(v):k=o,l?M=function(_,P){return _[P]===void 0?r:E(k(_[P]))}:M=o,x?T=function(_,P){return _[P]===void 0?i:a(_[P])}:T=a,l||x)for(var b=0;b{V.exports={solid:[[],0],dot:[[.5,1],200],dash:[[.5,1],50],longdash:[[.5,1],10],dashdot:[[.5,.625,.875,1],50],longdashdot:[[.5,.7,.8,1],10]}}),Mx=Vt((K,V)=>{V.exports={circle:"●","circle-open":"○",square:"■","square-open":"□",diamond:"◆","diamond-open":"◇",cross:"+",x:"❌"}}),O8=Vt((K,V)=>{var u=ji();function d(t,e,r,i){if(!e||!e.visible)return null;for(var n=u.getComponentMethod("errorbars","makeComputeError")(e),o=new Array(t.length),a=0;a0){var m=i.c2l(v);i._lowerLogErrorBound||(i._lowerLogErrorBound=m),i._lowerErrorBound=Math.min(i._lowerLogErrorBound,m)}}else o[a]=[-s[0]*r,s[1]*r]}return o}function E(t){for(var e=0;e{var u=Bf().gl_line3d,d=Bf().gl_scatter3d,E=Bf().gl_error3d,A=Bf().gl_mesh3d,t=Bf().delaunay_triangulate,e=Xr(),r=Vp(),i=Hp().formatColor,n=Tm(),o=A3(),a=Mx(),s=yo(),f=mh().appendArrayPointValue,v=O8();function g(P,z){this.scene=P,this.uid=z,this.linePlot=null,this.scatterPlot=null,this.errorBars=null,this.textMarkers=null,this.delaunayMesh=null,this.color=null,this.mode="",this.dataPoints=[],this.axesBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.textLabels=null,this.data=null}var m=g.prototype;m.handlePick=function(P){if(P.object&&(P.object===this.linePlot||P.object===this.delaunayMesh||P.object===this.textMarkers||P.object===this.scatterPlot)){var z=P.index=P.data.index;return P.object.highlight&&P.object.highlight(null),this.scatterPlot&&(P.object=this.scatterPlot,this.scatterPlot.highlight(P.data)),P.textLabel="",this.textLabels&&(e.isArrayOrTypedArray(this.textLabels)?(this.textLabels[z]||this.textLabels[z]===0)&&(P.textLabel=this.textLabels[z]):P.textLabel=this.textLabels),P.traceCoordinate=[this.data.x[z],this.data.y[z],this.data.z[z]],!0}};function w(P,z,D){var B=(D+1)%3,R=(D+2)%3,I=[],F=[],j;for(j=0;j-1?-1:P.indexOf("right")>-1?1:0}function y(P){return P==null?0:P.indexOf("top")>-1?-1:P.indexOf("bottom")>-1?1:0}function S(P){var z=0,D=0,B=[z,D];if(Array.isArray(P))for(var R=0;R=0){var G=w(j.position,j.delaunayColor,j.delaunayAxis);G.opacity=P.opacity,this.delaunayMesh?this.delaunayMesh.update(G):(G.gl=z,this.delaunayMesh=A(G),this.delaunayMesh._trace=this,this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},m.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())};function _(P,z){var D=new g(P,z.uid);return D.update(z),D}V.exports=_}),M3=Vt((K,V)=>{var u=dc(),d=yu(),E=Wl(),A=hc().axisHoverFormat,{hovertemplateAttrs:t,texttemplateAttrs:e,templatefallbackAttrs:r}=yl(),i=kl(),n=A3(),o=Mx(),a=So().extendFlat,s=Cu().overrideAll,f=Td(),v=u.line,g=u.marker,m=g.line,w=a({width:v.width,dash:{valType:"enumerated",values:f(n),dflt:"solid"}},E("line"));function l(y){return{show:{valType:"boolean",dflt:!1},opacity:{valType:"number",min:0,max:1,dflt:1},scale:{valType:"number",min:0,max:10,dflt:2/3}}}var x=V.exports=s({x:u.x,y:u.y,z:{valType:"data_array"},text:a({},u.text,{}),texttemplate:e(),texttemplatefallback:r({editType:"calc"}),hovertext:a({},u.hovertext,{}),hovertemplate:t(),hovertemplatefallback:r(),xhoverformat:A("x"),yhoverformat:A("y"),zhoverformat:A("z"),mode:a({},u.mode,{dflt:"lines+markers"}),surfaceaxis:{valType:"enumerated",values:[-1,0,1,2],dflt:-1},surfacecolor:{valType:"color"},projection:{x:l(),y:l(),z:l()},connectgaps:u.connectgaps,line:w,marker:a({symbol:{valType:"enumerated",values:f(o),dflt:"circle",arrayOk:!0},size:a({},g.size,{dflt:8}),sizeref:g.sizeref,sizemin:g.sizemin,sizemode:g.sizemode,opacity:a({},g.opacity,{arrayOk:!1}),colorbar:g.colorbar,line:a({width:a({},m.width,{arrayOk:!1})},E("marker.line"))},E("marker")),textposition:a({},u.textposition,{dflt:"top center"}),textfont:d({noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0,editType:"calc",colorEditType:"style",arrayOk:!0,variantValues:["normal","small-caps"]}),opacity:i.opacity,hoverinfo:a({},i.hoverinfo)},"calc","nested");x.x.editType=x.y.editType=x.z.editType="calc+clearAxisTypes"}),F8=Vt((K,V)=>{var u=ji(),d=Xr(),E=nu(),A=Lh(),t=Bh(),e=Rh(),r=M3();V.exports=function(n,o,a,s){function f(S,k){return d.coerce(n,o,r,S,k)}var v=i(n,o,f,s);if(!v){o.visible=!1;return}f("text"),f("hovertext"),f("hovertemplate"),f("hovertemplatefallback"),f("xhoverformat"),f("yhoverformat"),f("zhoverformat"),f("mode"),E.hasMarkers(o)&&A(n,o,a,s,f,{noSelect:!0,noAngle:!0}),E.hasLines(o)&&(f("connectgaps"),t(n,o,a,s,f)),E.hasText(o)&&(f("texttemplate"),f("texttemplatefallback"),e(n,o,s,f,{noSelect:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0}));var g=(o.line||{}).color,m=(o.marker||{}).color;f("surfaceaxis")>=0&&f("surfacecolor",g||m);for(var w=["x","y","z"],l=0;l<3;++l){var x="projection."+w[l];f(x+".show")&&(f(x+".opacity"),f(x+".scale"))}var y=u.getComponentMethod("errorbars","supplyDefaults");y(n,o,g||m||a,{axis:"z"}),y(n,o,g||m||a,{axis:"y",inherit:"z"}),y(n,o,g||m||a,{axis:"x",inherit:"z"})};function i(n,o,a,s){var f=0,v=a("x"),g=a("y"),m=a("z"),w=u.getComponentMethod("calendars","handleTraceDefaults");return w(n,o,["x","y","z"],s),v&&g&&m&&(f=Math.min(v.length,g.length,m.length),o._length=o._xlength=o._ylength=o._zlength=f),f}}),B8=Vt((K,V)=>{var u=yp(),d=Nh();V.exports=function(E,A){var t=[{x:!1,y:!1,trace:A,t:{}}];return u(t,A),d(E,A),t}}),R8=Vt((K,V)=>{V.exports=u;function u(d,E){if(typeof d!="string")throw new TypeError("must specify type string");if(E=E||{},typeof document>"u"&&!E.canvas)return null;var A=E.canvas||document.createElement("canvas");typeof E.width=="number"&&(A.width=E.width),typeof E.height=="number"&&(A.height=E.height);var t=E,e;try{var r=[d];d.indexOf("webgl")===0&&r.push("experimental-"+d);for(var i=0;i{var u=R8();V.exports=function(d){return u("webgl",d)}}),S3=Vt((K,V)=>{var u=Pi(),d=function(){};V.exports=function(E){for(var A in E)typeof E[A]=="function"&&(E[A]=d);E.destroy=function(){E.container.parentNode.removeChild(E.container)};var t=document.createElement("div");t.className="no-webgl",t.style.cursor="pointer",t.style.fontSize="24px",t.style.color=u.defaults[0],t.style.position="absolute",t.style.left=t.style.top="0px",t.style.width=t.style.height="100%",t.style["background-color"]=u.lightLine,t.style["z-index"]=30;var e=document.createElement("p");return e.textContent="WebGL is not supported by your browser - visit https://get.webgl.org for more info",e.style.position="relative",e.style.top="50%",e.style.left="50%",e.style.height="30%",e.style.width="50%",e.style.margin="-15% 0 0 -25%",t.appendChild(e),E.container.appendChild(t),E.container.style.background="#FFFFFF",E.container.onclick=function(){window.open("https://get.webgl.org")},!1}}),j8=Vt((K,V)=>{var u=Vp(),d=Xr(),E=["xaxis","yaxis","zaxis"];function A(){this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickSize=[12,12,12],this.tickFontWeight=["normal","normal","normal","normal"],this.tickFontStyle=["normal","normal","normal","normal"],this.tickFontVariant=["normal","normal","normal","normal"],this.tickAngle=[0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[18,18,18],this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont=["Open Sans","Open Sans","Open Sans"],this.labelSize=[20,20,20],this.labelFontWeight=["normal","normal","normal","normal"],this.labelFontStyle=["normal","normal","normal","normal"],this.labelFontVariant=["normal","normal","normal","normal"],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[30,30,30],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[10,10,10],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!0,!0,!0],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._defaultTickPad=this.tickPad.slice(),this._defaultLabelPad=this.labelPad.slice(),this._defaultLineTickLength=this.lineTickLength.slice()}var t=A.prototype;t.merge=function(r,i){for(var n=this,o=0;o<3;++o){var a=i[E[o]];if(!a.visible){n.tickEnable[o]=!1,n.labelEnable[o]=!1,n.lineEnable[o]=!1,n.lineTickEnable[o]=!1,n.gridEnable[o]=!1,n.zeroEnable[o]=!1,n.backgroundEnable[o]=!1;continue}n.labels[o]=r._meta?d.templateString(a.title.text,r._meta):a.title.text,"font"in a.title&&(a.title.font.color&&(n.labelColor[o]=u(a.title.font.color)),a.title.font.family&&(n.labelFont[o]=a.title.font.family),a.title.font.size&&(n.labelSize[o]=a.title.font.size),a.title.font.weight&&(n.labelFontWeight[o]=a.title.font.weight),a.title.font.style&&(n.labelFontStyle[o]=a.title.font.style),a.title.font.variant&&(n.labelFontVariant[o]=a.title.font.variant)),"showline"in a&&(n.lineEnable[o]=a.showline),"linecolor"in a&&(n.lineColor[o]=u(a.linecolor)),"linewidth"in a&&(n.lineWidth[o]=a.linewidth),"showgrid"in a&&(n.gridEnable[o]=a.showgrid),"gridcolor"in a&&(n.gridColor[o]=u(a.gridcolor)),"gridwidth"in a&&(n.gridWidth[o]=a.gridwidth),a.type==="log"?n.zeroEnable[o]=!1:"zeroline"in a&&(n.zeroEnable[o]=a.zeroline),"zerolinecolor"in a&&(n.zeroLineColor[o]=u(a.zerolinecolor)),"zerolinewidth"in a&&(n.zeroLineWidth[o]=a.zerolinewidth),"ticks"in a&&a.ticks?n.lineTickEnable[o]=!0:n.lineTickEnable[o]=!1,"ticklen"in a&&(n.lineTickLength[o]=n._defaultLineTickLength[o]=a.ticklen),"tickcolor"in a&&(n.lineTickColor[o]=u(a.tickcolor)),"tickwidth"in a&&(n.lineTickWidth[o]=a.tickwidth),"tickangle"in a&&(n.tickAngle[o]=a.tickangle==="auto"?-3600:Math.PI*-a.tickangle/180),"showticklabels"in a&&(n.tickEnable[o]=a.showticklabels),"tickfont"in a&&(a.tickfont.color&&(n.tickColor[o]=u(a.tickfont.color)),a.tickfont.family&&(n.tickFont[o]=a.tickfont.family),a.tickfont.size&&(n.tickSize[o]=a.tickfont.size),a.tickfont.weight&&(n.tickFontWeight[o]=a.tickfont.weight),a.tickfont.style&&(n.tickFontStyle[o]=a.tickfont.style),a.tickfont.variant&&(n.tickFontVariant[o]=a.tickfont.variant)),"mirror"in a?["ticks","all","allticks"].indexOf(a.mirror)!==-1?(n.lineTickMirror[o]=!0,n.lineMirror[o]=!0):a.mirror===!0?(n.lineTickMirror[o]=!1,n.lineMirror[o]=!0):(n.lineTickMirror[o]=!1,n.lineMirror[o]=!1):n.lineMirror[o]=!1,"showbackground"in a&&a.showbackground!==!1?(n.backgroundEnable[o]=!0,n.backgroundColor[o]=u(a.backgroundcolor)):n.backgroundEnable[o]=!1}};function e(r,i){var n=new A;return n.merge(r,i),n}V.exports=e}),U8=Vt((K,V)=>{var u=Vp(),d=["xaxis","yaxis","zaxis"];function E(){this.enabled=[!0,!0,!0],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.drawSides=[!0,!0,!0],this.lineWidth=[1,1,1]}var A=E.prototype;A.merge=function(e){for(var r=0;r<3;++r){var i=e[d[r]];if(!i.visible){this.enabled[r]=!1,this.drawSides[r]=!1;continue}this.enabled[r]=i.showspikes,this.colors[r]=u(i.spikecolor),this.drawSides[r]=i.spikesides,this.lineWidth[r]=i.spikethickness}};function t(e){var r=new E;return r.merge(e),r}V.exports=t}),V8=Vt((K,V)=>{V.exports=t;var u=yo(),d=Xr(),E=["xaxis","yaxis","zaxis"];function A(e){for(var r=new Array(3),i=0;i<3;++i){for(var n=e[i],o=new Array(n.length),a=0;a/g," "));o[a]=g,s.tickmode=f}}r.ticks=o;for(var a=0;a<3;++a){.5*(e.glplot.bounds[0][a]+e.glplot.bounds[1][a]);for(var m=0;m<2;++m)r.bounds[m][a]=e.glplot.bounds[m][a]}e.contourLevels=A(o)}}),H8=Vt((K,V)=>{var u=Bf().gl_plot3d,d=u.createCamera,E=u.createScene,A=N8(),t=Gy(),e=ji(),r=Xr(),i=r.preserveDrawingBuffer(),n=yo(),o=pc(),a=Vp(),s=S3(),f=qb(),v=j8(),g=U8(),m=V8(),w=Yh().applyAutorangeOptions,l,x,y=!1;function S(D,B){var R=document.createElement("div"),I=D.container;this.graphDiv=D.graphDiv;var F=document.createElementNS("http://www.w3.org/2000/svg","svg");F.style.position="absolute",F.style.top=F.style.left="0px",F.style.width=F.style.height="100%",F.style["z-index"]=20,F.style["pointer-events"]="none",R.appendChild(F),this.svgContainer=F,R.id=D.id,R.style.position="absolute",R.style.top=R.style.left="0px",R.style.width=R.style.height="100%",I.appendChild(R),this.fullLayout=B,this.id=D.id||"scene",this.fullSceneLayout=B[this.id],this.plotArgs=[[],{},{}],this.axesOptions=v(B,B[this.id]),this.spikeOptions=g(B[this.id]),this.container=R,this.staticMode=!!D.staticPlot,this.pixelRatio=this.pixelRatio||D.plotGlPixelRatio||2,this.dataScale=[1,1,1],this.contourLevels=[[],[],[]],this.convertAnnotations=e.getComponentMethod("annotations3d","convert"),this.drawAnnotations=e.getComponentMethod("annotations3d","draw"),this.initializeGLPlot()}var k=S.prototype;k.prepareOptions=function(){var D=this,B={canvas:D.canvas,gl:D.gl,glOptions:{preserveDrawingBuffer:i,premultipliedAlpha:!0,antialias:!0},container:D.container,axes:D.axesOptions,spikes:D.spikeOptions,pickRadius:10,snapToData:!0,autoScale:!0,autoBounds:!1,cameraObject:D.camera,pixelRatio:D.pixelRatio};if(D.staticMode){if(!x&&(l=document.createElement("canvas"),x=A({canvas:l,preserveDrawingBuffer:!0,premultipliedAlpha:!0,antialias:!0}),!x))throw new Error("error creating static canvas/context for image server");B.gl=x,B.canvas=l}return B};var M=!0;k.tryCreatePlot=function(){var D=this,B=D.prepareOptions(),R=!0;try{D.glplot=E(B)}catch{if(D.staticMode||!M||i)R=!1;else{r.warn(["webgl setup failed possibly due to","false preserveDrawingBuffer config.","The mobile/tablet device may not be detected by is-mobile module.","Enabling preserveDrawingBuffer in second attempt to create webgl scene..."].join(" "));try{i=B.glOptions.preserveDrawingBuffer=!0,D.glplot=E(B)}catch{i=B.glOptions.preserveDrawingBuffer=!1,R=!1}}}return M=!1,R},k.initializeGLCamera=function(){var D=this,B=D.fullSceneLayout.camera,R=B.projection.type==="orthographic";D.camera=d(D.container,{center:[B.center.x,B.center.y,B.center.z],eye:[B.eye.x,B.eye.y,B.eye.z],up:[B.up.x,B.up.y,B.up.z],_ortho:R,zoomMin:.01,zoomMax:100,mode:"orbit"})},k.initializeGLPlot=function(){var D=this;D.initializeGLCamera();var B=D.tryCreatePlot();if(!B)return s(D);D.traces={},D.make4thDimension();var R=D.graphDiv,I=R.layout,F=function(){var N={};return D.isCameraChanged(I)&&(N[D.id+".camera"]=D.getCamera()),D.isAspectChanged(I)&&(N[D.id+".aspectratio"]=D.glplot.getAspectratio(),I[D.id].aspectmode!=="manual"&&(D.fullSceneLayout.aspectmode=I[D.id].aspectmode=N[D.id+".aspectmode"]="manual")),N},j=function(N){if(N.fullSceneLayout.dragmode!==!1){var G=F();N.saveLayout(I),N.graphDiv.emit("plotly_relayout",G)}};return D.glplot.canvas&&(D.glplot.canvas.addEventListener("mouseup",function(){j(D)}),D.glplot.canvas.addEventListener("touchstart",function(){y=!0}),D.glplot.canvas.addEventListener("wheel",function(N){if(R._context._scrollZoom.gl3d){if(D.camera._ortho){var G=N.deltaX>N.deltaY?1.1:.9090909090909091,rt=D.glplot.getAspectratio();D.glplot.setAspectratio({x:G*rt.x,y:G*rt.y,z:G*rt.z})}j(D)}},t?{passive:!1}:!1),D.glplot.canvas.addEventListener("mousemove",function(){if(D.fullSceneLayout.dragmode!==!1&&D.camera.mouseListener.buttons!==0){var N=F();D.graphDiv.emit("plotly_relayouting",N)}}),D.staticMode||D.glplot.canvas.addEventListener("webglcontextlost",function(N){R&&R.emit&&R.emit("plotly_webglcontextlost",{event:N,layer:D.id})},!1)),D.glplot.oncontextloss=function(){D.recoverContext()},D.glplot.onrender=function(){D.render()},!0},k.render=function(){var D=this,B=D.graphDiv,R,I=D.svgContainer,F=D.container.getBoundingClientRect();B._fullLayout._calcInverseTransform(B);var j=B._fullLayout._invScaleX,N=B._fullLayout._invScaleY,G=F.width*j,rt=F.height*N;I.setAttributeNS(null,"viewBox","0 0 "+G+" "+rt),I.setAttributeNS(null,"width",G),I.setAttributeNS(null,"height",rt),m(D),D.glplot.axes.update(D.axesOptions);for(var ct=Object.keys(D.traces),st=null,et=D.glplot.selection,Z=0;Z")):R.type==="isosurface"||R.type==="volume"?(J.valueLabel=n.hoverLabelText(D._mockAxis,D._mockAxis.d2l(et.traceCoordinate[3]),R.valuehoverformat),Tt.push("value: "+J.valueLabel),et.textLabel&&Tt.push(et.textLabel),dt=Tt.join("
          ")):dt=et.textLabel;var wt={x:et.traceCoordinate[0],y:et.traceCoordinate[1],z:et.traceCoordinate[2],data:Q._input,fullData:Q,curveNumber:Q.index,pointNumber:ut};o.appendArrayPointValue(wt,Q,ut),R._module.eventData&&(wt=Q._module.eventData(wt,et,Q,{},ut));var Ct={points:[wt]};if(D.fullSceneLayout.hovermode){var It=[];o.loneHover({trace:Q,x:(.5+.5*X[0]/X[3])*G,y:(.5-.5*X[1]/X[3])*rt,xLabel:J.xLabel,yLabel:J.yLabel,zLabel:J.zLabel,text:dt,name:st.name,color:o.castHoverOption(Q,ut,"bgcolor")||st.color,borderColor:o.castHoverOption(Q,ut,"bordercolor"),fontFamily:o.castHoverOption(Q,ut,"font.family"),fontSize:o.castHoverOption(Q,ut,"font.size"),fontColor:o.castHoverOption(Q,ut,"font.color"),nameLength:o.castHoverOption(Q,ut,"namelength"),textAlign:o.castHoverOption(Q,ut,"align"),hovertemplate:r.castOption(Q,ut,"hovertemplate"),hovertemplateLabels:r.extendFlat({},wt,J),eventData:[wt]},{container:I,gd:B,inOut_bbox:It}),wt.bbox=It[0]}et.distance<5&&(et.buttons||y)?B.emit("plotly_click",Ct):B.emit("plotly_hover",Ct),this.oldEventData=Ct}else o.loneUnhover(I),this.oldEventData&&B.emit("plotly_unhover",this.oldEventData),this.oldEventData=void 0;D.drawAnnotations(D)},k.recoverContext=function(){var D=this;D.glplot.dispose();var B=function(){if(D.glplot.gl.isContextLost()){requestAnimationFrame(B);return}if(!D.initializeGLPlot()){r.error("Catastrophic and unrecoverable WebGL error. Context lost.");return}D.plot.apply(D,D.plotArgs)};requestAnimationFrame(B)};var T=["xaxis","yaxis","zaxis"];function c(D,B,R){for(var I=D.fullSceneLayout,F=0;F<3;F++){var j=T[F],N=j.charAt(0),G=I[j],rt=B[N],ct=B[N+"calendar"],st=B["_"+N+"length"];if(!r.isArrayOrTypedArray(rt))R[0][F]=Math.min(R[0][F],0),R[1][F]=Math.max(R[1][F],st-1);else for(var et,Z=0;Z<(st||rt.length);Z++)if(r.isArrayOrTypedArray(rt[Z]))for(var ot=0;otQ[1][N])Q[0][N]=-1,Q[1][N]=1;else{var te=Q[1][N]-Q[0][N];Q[0][N]-=te/32,Q[1][N]+=te/32}if(q=[Q[0][N],Q[1][N]],q=w(q,rt),Q[0][N]=q[0],Q[1][N]=q[1],rt.isReversed()){var Jt=Q[0][N];Q[0][N]=Q[1][N],Q[1][N]=Jt}}else q=rt.range,Q[0][N]=rt.r2l(q[0]),Q[1][N]=rt.r2l(q[1]);Q[0][N]===Q[1][N]&&(Q[0][N]-=1,Q[1][N]+=1),ut[N]=Q[1][N]-Q[0][N],rt.range=[Q[0][N],Q[1][N]],rt.limitRange(),I.glplot.setBounds(N,{min:rt.range[0]*ot[N],max:rt.range[1]*ot[N]})}var ee,Zt=st.aspectmode;if(Zt==="cube")ee=[1,1,1];else if(Zt==="manual"){var mt=st.aspectratio;ee=[mt.x,mt.y,mt.z]}else if(Zt==="auto"||Zt==="data"){var bt=[1,1,1];for(N=0;N<3;++N){rt=st[T[N]],ct=rt.type;var vt=J[ct];bt[N]=Math.pow(vt.acc,1/vt.count)/ot[N]}Zt==="data"||Math.max.apply(null,bt)/Math.min.apply(null,bt)<=4?ee=bt:ee=[1,1,1]}else throw new Error("scene.js aspectRatio was not one of the enumerated types");st.aspectratio.x=et.aspectratio.x=ee[0],st.aspectratio.y=et.aspectratio.y=ee[1],st.aspectratio.z=et.aspectratio.z=ee[2],I.glplot.setAspectratio(st.aspectratio),I.viewInitial.aspectratio||(I.viewInitial.aspectratio={x:st.aspectratio.x,y:st.aspectratio.y,z:st.aspectratio.z}),I.viewInitial.aspectmode||(I.viewInitial.aspectmode=st.aspectmode);var Ut=st.domain||null,re=B._size||null;if(Ut&&re){var Kt=I.container.style;Kt.position="absolute",Kt.left=re.l+Ut.x[0]*re.w+"px",Kt.top=re.t+(1-Ut.y[1])*re.h+"px",Kt.width=re.w*(Ut.x[1]-Ut.x[0])+"px",Kt.height=re.h*(Ut.y[1]-Ut.y[0])+"px"}I.glplot.redraw()}},k.destroy=function(){var D=this;D.glplot&&(D.camera.mouseListener.enabled=!1,D.container.removeEventListener("wheel",D.camera.wheelListener),D.camera=null,D.glplot.dispose(),D.container.parentNode.removeChild(D.container),D.glplot=null)};function b(D){return[[D.eye.x,D.eye.y,D.eye.z],[D.center.x,D.center.y,D.center.z],[D.up.x,D.up.y,D.up.z]]}function _(D){return{up:{x:D.up[0],y:D.up[1],z:D.up[2]},center:{x:D.center[0],y:D.center[1],z:D.center[2]},eye:{x:D.eye[0],y:D.eye[1],z:D.eye[2]},projection:{type:D._ortho===!0?"orthographic":"perspective"}}}k.getCamera=function(){var D=this;return D.camera.view.recalcMatrix(D.camera.view.lastT()),_(D.camera)},k.setViewport=function(D){var B=this,R=D.camera;B.camera.lookAt.apply(this,b(R)),B.glplot.setAspectratio(D.aspectratio);var I=R.projection.type==="orthographic",F=B.camera._ortho;I!==F&&(B.glplot.redraw(),B.glplot.clearRGBA(),B.glplot.dispose(),B.initializeGLPlot())},k.isCameraChanged=function(D){var B=this,R=B.getCamera(),I=r.nestedProperty(D,B.id+".camera"),F=I.get();function j(ct,st,et,Z){var ot=["up","center","eye"],X=["x","y","z"];return st[ot[et]]&&ct[ot[et]][X[Z]]===st[ot[et]][X[Z]]}var N=!1;if(F===void 0)N=!0;else{for(var G=0;G<3;G++)for(var rt=0;rt<3;rt++)if(!j(R,F,G,rt)){N=!0;break}(!F.projection||R.projection&&R.projection.type!==F.projection.type)&&(N=!0)}return N},k.isAspectChanged=function(D){var B=this,R=B.glplot.getAspectratio(),I=r.nestedProperty(D,B.id+".aspectratio"),F=I.get();return F===void 0||F.x!==R.x||F.y!==R.y||F.z!==R.z},k.saveLayout=function(D){var B=this,R=B.fullLayout,I,F,j,N,G,rt,ct=B.isCameraChanged(D),st=B.isAspectChanged(D),et=ct||st;if(et){var Z={};if(ct&&(I=B.getCamera(),F=r.nestedProperty(D,B.id+".camera"),j=F.get(),Z[B.id+".camera"]=j),st&&(N=B.glplot.getAspectratio(),G=r.nestedProperty(D,B.id+".aspectratio"),rt=G.get(),Z[B.id+".aspectratio"]=rt),e.call("_storeDirectGUIEdit",D,R._preGUI,Z),ct){F.set(I);var ot=r.nestedProperty(R,B.id+".camera");ot.set(I)}if(st){G.set(N);var X=r.nestedProperty(R,B.id+".aspectratio");X.set(N),B.glplot.redraw()}}return et},k.updateFx=function(D,B){var R=this,I=R.camera;if(I)if(D==="orbit")I.mode="orbit",I.keyBindingMode="rotate";else if(D==="turntable"){I.up=[0,0,1],I.mode="turntable",I.keyBindingMode="rotate";var F=R.graphDiv,j=F._fullLayout,N=R.fullSceneLayout.camera,G=N.up.x,rt=N.up.y,ct=N.up.z;if(ct/Math.sqrt(G*G+rt*rt+ct*ct)<.999){var st=R.id+".camera.up",et={x:0,y:0,z:1},Z={};Z[st]=et;var ot=F.layout;e.call("_storeDirectGUIEdit",ot,j._preGUI,Z),N.up=et,r.nestedProperty(ot,st).set(et)}}else I.keyBindingMode=D;R.fullSceneLayout.hovermode=B};function P(D,B,R){for(var I=0,F=R-1;I0)for(var G=255/N,rt=0;rt<3;++rt)D[j+rt]=Math.min(G*D[j+rt],255)}}k.toImage=function(D){var B=this;D||(D="png"),B.staticMode&&B.container.appendChild(l),B.glplot.redraw();var R=B.glplot.gl,I=R.drawingBufferWidth,F=R.drawingBufferHeight;R.bindFramebuffer(R.FRAMEBUFFER,null);var j=new Uint8Array(I*F*4);R.readPixels(0,0,I,F,R.RGBA,R.UNSIGNED_BYTE,j),P(j,I,F),z(j,I,F);var N=document.createElement("canvas");N.width=I,N.height=F;var G=N.getContext("2d",{willReadFrequently:!0}),rt=G.createImageData(I,F);rt.data.set(j),G.putImageData(rt,0,0);var ct;switch(D){case"jpeg":ct=N.toDataURL("image/jpeg");break;case"webp":ct=N.toDataURL("image/webp");break;default:ct=N.toDataURL("image/png")}return B.staticMode&&B.container.removeChild(l),ct},k.setConvert=function(){for(var D=this,B=0;B<3;B++){var R=D.fullSceneLayout[T[B]];n.setConvert(R,D.fullLayout),R.setScale=r.noop}},k.make4thDimension=function(){var D=this,B=D.graphDiv,R=B._fullLayout;D._mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},n.setConvert(D._mockAxis,R)},V.exports=S}),q8=Vt((K,V)=>{V.exports={scene:{valType:"subplotid",dflt:"scene",editType:"calc+clearAxisTypes"}}}),E3=Vt((K,V)=>{var u=Pi(),d=Of(),E=So().extendFlat,A=Cu().overrideAll;V.exports=A({visible:d.visible,showspikes:{valType:"boolean",dflt:!0},spikesides:{valType:"boolean",dflt:!0},spikethickness:{valType:"number",min:0,dflt:2},spikecolor:{valType:"color",dflt:u.defaultLine},showbackground:{valType:"boolean",dflt:!1},backgroundcolor:{valType:"color",dflt:"rgba(204, 204, 204, 0.5)"},showaxeslabels:{valType:"boolean",dflt:!0},color:d.color,categoryorder:d.categoryorder,categoryarray:d.categoryarray,title:{text:d.title.text,font:d.title.font},type:E({},d.type,{values:["-","linear","log","date","category"]}),autotypenumbers:d.autotypenumbers,autorange:d.autorange,autorangeoptions:{minallowed:d.autorangeoptions.minallowed,maxallowed:d.autorangeoptions.maxallowed,clipmin:d.autorangeoptions.clipmin,clipmax:d.autorangeoptions.clipmax,include:d.autorangeoptions.include,editType:"plot"},rangemode:d.rangemode,minallowed:d.minallowed,maxallowed:d.maxallowed,range:E({},d.range,{items:[{valType:"any",editType:"plot",impliedEdits:{"^autorange":!1}},{valType:"any",editType:"plot",impliedEdits:{"^autorange":!1}}],anim:!1}),tickmode:d.minor.tickmode,nticks:d.nticks,tick0:d.tick0,dtick:d.dtick,tickvals:d.tickvals,ticktext:d.ticktext,ticks:d.ticks,mirror:d.mirror,ticklen:d.ticklen,tickwidth:d.tickwidth,tickcolor:d.tickcolor,showticklabels:d.showticklabels,labelalias:d.labelalias,tickfont:d.tickfont,tickangle:d.tickangle,tickprefix:d.tickprefix,showtickprefix:d.showtickprefix,ticksuffix:d.ticksuffix,showticksuffix:d.showticksuffix,showexponent:d.showexponent,exponentformat:d.exponentformat,minexponent:d.minexponent,separatethousands:d.separatethousands,tickformat:d.tickformat,tickformatstops:d.tickformatstops,hoverformat:d.hoverformat,showline:d.showline,linecolor:d.linecolor,linewidth:d.linewidth,showgrid:d.showgrid,gridcolor:E({},d.gridcolor,{dflt:"rgb(204, 204, 204)"}),gridwidth:d.gridwidth,zeroline:d.zeroline,zerolinecolor:d.zerolinecolor,zerolinewidth:d.zerolinewidth},"plot","from-root")}),z3=Vt((K,V)=>{var u=E3(),d=Hu().attributes,E=So().extendFlat,A=Xr().counterRegex;function t(e,r,i){return{x:{valType:"number",dflt:e,editType:"camera"},y:{valType:"number",dflt:r,editType:"camera"},z:{valType:"number",dflt:i,editType:"camera"},editType:"camera"}}V.exports={_arrayAttrRegexps:[A("scene",".annotations",!0)],bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"plot"},camera:{up:E(t(0,0,1),{}),center:E(t(0,0,0),{}),eye:E(t(1.25,1.25,1.25),{}),projection:{type:{valType:"enumerated",values:["perspective","orthographic"],dflt:"perspective",editType:"calc"},editType:"calc"},editType:"camera"},domain:d({name:"scene",editType:"plot"}),aspectmode:{valType:"enumerated",values:["auto","cube","data","manual"],dflt:"auto",editType:"plot",impliedEdits:{"aspectratio.x":void 0,"aspectratio.y":void 0,"aspectratio.z":void 0}},aspectratio:{x:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},y:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},z:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},editType:"plot",impliedEdits:{aspectmode:"manual"}},xaxis:u,yaxis:u,zaxis:u,dragmode:{valType:"enumerated",values:["orbit","turntable","zoom","pan",!1],editType:"plot"},hovermode:{valType:"enumerated",values:["closest",!1],dflt:"closest",editType:"modebar"},uirevision:{valType:"any",editType:"none"},editType:"plot"}}),W8=Vt((K,V)=>{var u=Af().mix,d=Xr(),E=cl(),A=E3(),t=Vb(),e=Kg(),r=["xaxis","yaxis","zaxis"],i=13600/187;V.exports=function(n,o,a){var s,f;function v(w,l){return d.coerce(s,f,A,w,l)}for(var g=0;g{var u=Xr(),d=Pi(),E=ji(),A=Cd(),t=W8(),e=z3(),r=Pf().getSubplotData,i="gl3d";V.exports=function(o,a,s){var f=a._basePlotModules.length>1;function v(g){if(!f){var m=u.validate(o[g],e[g]);if(m)return o[g]}}A(o,a,s,{type:i,attributes:e,handleDefaults:n,fullLayout:a,font:a.font,fullData:s,getDfltFromLayout:v,autotypenumbersDflt:a.autotypenumbers,paper_bgcolor:a.paper_bgcolor,calendar:a.calendar})};function n(o,a,s,f){for(var v=s("bgcolor"),g=d.combine(v,f.paper_bgcolor),m=["up","center","eye"],w=0;w.999)&&(k="turntable")}else k="turntable";s("dragmode",k),s("hovermode",f.getDfltFromLayout("hovermode"))}}),jd=Vt(K=>{var V=Cu().overrideAll,u=_d(),d=H8(),E=Pf().getSubplotData,A=Xr(),t=zh(),e="gl3d",r="scene";K.name=e,K.attr=r,K.idRoot=r,K.idRegex=K.attrRegex=A.counterRegex("scene"),K.attributes=q8(),K.layoutAttributes=z3(),K.baseLayoutAttrOverrides=V({hoverlabel:u.hoverlabel},"plot","nested"),K.supplyLayoutDefaults=G8(),K.plot=function(i){for(var n=i._fullLayout,o=i._fullData,a=n._subplots[e],s=0;s{V.exports={plot:D8(),attributes:M3(),markerSymbols:Mx(),supplyDefaults:F8(),colorbar:[{container:"marker",min:"cmin",max:"cmax"},{container:"line",min:"cmin",max:"cmax"}],calc:B8(),moduleType:"trace",name:"scatter3d",basePlotModule:jd(),categories:["gl3d","symbols","showLegend","scatter-like"],meta:{}}}),K8=Vt((K,V)=>{V.exports=Z8()}),zv=Vt((K,V)=>{var u=Pi(),d=Wl(),E=hc().axisHoverFormat,{hovertemplateAttrs:A,templatefallbackAttrs:t}=yl(),e=kl(),r=So().extendFlat,i=Cu().overrideAll;function n(s){return{valType:"boolean",dflt:!1}}function o(s){return{show:{valType:"boolean",dflt:!1},start:{valType:"number",dflt:null,editType:"plot"},end:{valType:"number",dflt:null,editType:"plot"},size:{valType:"number",dflt:null,min:0,editType:"plot"},project:{x:n(),y:n(),z:n()},color:{valType:"color",dflt:u.defaultLine},usecolormap:{valType:"boolean",dflt:!1},width:{valType:"number",min:1,max:16,dflt:2},highlight:{valType:"boolean",dflt:!0},highlightcolor:{valType:"color",dflt:u.defaultLine},highlightwidth:{valType:"number",min:1,max:16,dflt:2}}}var a=V.exports=i(r({z:{valType:"data_array"},x:{valType:"data_array"},y:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},hovertext:{valType:"string",dflt:"",arrayOk:!0},hovertemplate:A(),hovertemplatefallback:t(),xhoverformat:E("x"),yhoverformat:E("y"),zhoverformat:E("z"),connectgaps:{valType:"boolean",dflt:!1,editType:"calc"},surfacecolor:{valType:"data_array"}},d("",{colorAttr:"z or surfacecolor",showScaleDflt:!0,autoColorDflt:!1,editTypeOverride:"calc"}),{contours:{x:o(),y:o(),z:o()},hidesurface:{valType:"boolean",dflt:!1},lightposition:{x:{valType:"number",min:-1e5,max:1e5,dflt:10},y:{valType:"number",min:-1e5,max:1e5,dflt:1e4},z:{valType:"number",min:-1e5,max:1e5,dflt:0}},lighting:{ambient:{valType:"number",min:0,max:1,dflt:.8},diffuse:{valType:"number",min:0,max:1,dflt:.8},specular:{valType:"number",min:0,max:2,dflt:.05,description:"Represents the level that incident rays are reflected in a single direction, causing shine."},roughness:{valType:"number",min:0,max:1,dflt:.5,description:"Alters specular reflection; the rougher the surface, the wider and less contrasty the shine."},fresnel:{valType:"number",min:0,max:5,dflt:.2}},opacity:{valType:"number",min:0,max:1,dflt:1},opacityscale:{valType:"any",editType:"calc"},hoverinfo:r({},e.hoverinfo),showlegend:r({},e.showlegend,{dflt:!1})}),"calc","nested");a.x.editType=a.y.editType=a.z.editType="calc+clearAxisTypes"}),L3=Vt((K,V)=>{var u=ji(),d=Xr(),E=vf(),A=zv(),t=.1;function e(o,a){for(var s=[],f=32,v=0;v{var u=ih();V.exports=function(d,E){E.surfacecolor?u(d,E,{vals:E.surfacecolor,containerStr:"",cLetter:"c"}):u(d,E,{vals:E.z,containerStr:"",cLetter:"c"})}}),X8=Vt((K,V)=>{var u=Bf().gl_surface3d,d=Bf().ndarray,E=Bf().ndarray_linear_interpolate.d2,A=w1(),t=T1(),e=Xr().isArrayOrTypedArray,r=Hp().parseColorScale,i=Vp(),n=xu().extractOpts;function o(b,_,P){this.scene=b,this.uid=P,this.surface=_,this.data=null,this.showContour=[!1,!1,!1],this.contourStart=[null,null,null],this.contourEnd=[null,null,null],this.contourSize=[0,0,0],this.minValues=[1/0,1/0,1/0],this.maxValues=[-1/0,-1/0,-1/0],this.dataScaleX=1,this.dataScaleY=1,this.refineData=!0,this.objectOffset=[0,0,0]}var a=o.prototype;a.getXat=function(b,_,P,z){var D=e(this.data.x)?e(this.data.x[0])?this.data.x[_][b]:this.data.x[b]:b;return P===void 0?D:z.d2l(D,0,P)},a.getYat=function(b,_,P,z){var D=e(this.data.y)?e(this.data.y[0])?this.data.y[_][b]:this.data.y[_]:_;return P===void 0?D:z.d2l(D,0,P)},a.getZat=function(b,_,P,z){var D=this.data.z[_][b];return D===null&&this.data.connectgaps&&this.data._interpolatedZ&&(D=this.data._interpolatedZ[_][b]),P===void 0?D:z.d2l(D,0,P)},a.handlePick=function(b){if(b.object===this.surface){var _=(b.data.index[0]-1)/this.dataScaleX-1,P=(b.data.index[1]-1)/this.dataScaleY-1,z=Math.max(Math.min(Math.round(_),this.data.z[0].length-1),0),D=Math.max(Math.min(Math.round(P),this.data._ylength-1),0);b.index=[z,D],b.traceCoordinate=[this.getXat(z,D),this.getYat(z,D),this.getZat(z,D)],b.dataCoordinate=[this.getXat(z,D,this.data.xcalendar,this.scene.fullSceneLayout.xaxis),this.getYat(z,D,this.data.ycalendar,this.scene.fullSceneLayout.yaxis),this.getZat(z,D,this.data.zcalendar,this.scene.fullSceneLayout.zaxis)];for(var B=0;B<3;B++){var R=b.dataCoordinate[B];R!=null&&(b.dataCoordinate[B]*=this.scene.dataScale[B])}var I=this.data.hovertext||this.data.text;return e(I)&&I[D]&&I[D][z]!==void 0?b.textLabel=I[D][z]:I?b.textLabel=I:b.textLabel="",b.data.dataCoordinate=b.dataCoordinate.slice(),this.surface.highlight(b.data),this.scene.glplot.spikes.position=b.dataCoordinate,!0}};function s(b){var _=b[0].rgb,P=b[b.length-1].rgb;return _[0]===P[0]&&_[1]===P[1]&&_[2]===P[2]&&_[3]===P[3]}var f=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999];function v(b,_){if(b<_)return 0;for(var P=0;Math.floor(b%_)===0;)b/=_,P++;return P}function g(b){for(var _=[],P=0;P0){P=f[z];break}return P}function w(b,_){if(!(b<1||_<1)){for(var P=g(b),z=g(_),D=1,B=0;BS;)z--,z/=m(z),z++,z1?D:1};function k(b,_,P){var z=P[8]+P[2]*_[0]+P[5]*_[1];return b[0]=(P[6]+P[0]*_[0]+P[3]*_[1])/z,b[1]=(P[7]+P[1]*_[0]+P[4]*_[1])/z,b}function M(b,_,P){return T(b,_,k,P),b}function T(b,_,P,z){for(var D=[0,0],B=b.shape[0],R=b.shape[1],I=0;I0&&this.contourStart[z]!==null&&this.contourEnd[z]!==null&&this.contourEnd[z]>this.contourStart[z]))for(_[z]=!0,D=this.contourStart[z];Drt&&(this.minValues[j]=rt),this.maxValues[j]{V.exports={attributes:zv(),supplyDefaults:L3().supplyDefaults,colorbar:{min:"cmin",max:"cmax"},calc:Y8(),plot:X8(),moduleType:"trace",name:"surface",basePlotModule:jd(),categories:["gl3d","2dMap","showLegend"],meta:{}}}),J8=Vt((K,V)=>{V.exports=$8()}),Zm=Vt((K,V)=>{var u=Wl(),d=hc().axisHoverFormat,{hovertemplateAttrs:E,templatefallbackAttrs:A}=yl(),t=zv(),e=kl(),r=So().extendFlat;V.exports=r({x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},z:{valType:"data_array",editType:"calc+clearAxisTypes"},i:{valType:"data_array",editType:"calc"},j:{valType:"data_array",editType:"calc"},k:{valType:"data_array",editType:"calc"},text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertemplate:E({editType:"calc"}),hovertemplatefallback:A({editType:"calc"}),xhoverformat:d("x"),yhoverformat:d("y"),zhoverformat:d("z"),delaunayaxis:{valType:"enumerated",values:["x","y","z"],dflt:"z",editType:"calc"},alphahull:{valType:"number",dflt:-1,editType:"calc"},intensity:{valType:"data_array",editType:"calc"},intensitymode:{valType:"enumerated",values:["vertex","cell"],dflt:"vertex",editType:"calc"},color:{valType:"color",editType:"calc"},vertexcolor:{valType:"data_array",editType:"calc"},facecolor:{valType:"data_array",editType:"calc"}},u("",{colorAttr:"`intensity`",showScaleDflt:!0,editTypeOverride:"calc"}),{opacity:t.opacity,flatshading:{valType:"boolean",dflt:!1,editType:"calc"},contour:{show:r({},t.contours.x.show,{}),color:t.contours.x.color,width:t.contours.x.width,editType:"calc"},lightposition:{x:r({},t.lightposition.x,{dflt:1e5}),y:r({},t.lightposition.y,{dflt:1e5}),z:r({},t.lightposition.z,{dflt:0}),editType:"calc"},lighting:r({vertexnormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-12,editType:"calc",description:"Epsilon for vertex normals calculation avoids math issues arising from degenerate geometry."},facenormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-6,editType:"calc",description:"Epsilon for face normals calculation avoids math issues arising from degenerate geometry."},editType:"calc"},t.lighting),hoverinfo:r({},e.hoverinfo,{editType:"calc"}),showlegend:r({},e.showlegend,{dflt:!1})})}),Sx=Vt((K,V)=>{var u=Wl(),d=hc().axisHoverFormat,{hovertemplateAttrs:E,templatefallbackAttrs:A}=yl(),t=Zm(),e=kl(),r=So().extendFlat,i=Cu().overrideAll;function n(s){return{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}}}function o(s){return{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}}}var a=V.exports=i(r({x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},value:{valType:"data_array"},isomin:{valType:"number"},isomax:{valType:"number"},surface:{show:{valType:"boolean",dflt:!0},count:{valType:"integer",dflt:2,min:1},fill:{valType:"number",min:0,max:1,dflt:1},pattern:{valType:"flaglist",flags:["A","B","C","D","E"],extras:["all","odd","even"],dflt:"all"}},spaceframe:{show:{valType:"boolean",dflt:!1},fill:{valType:"number",min:0,max:1,dflt:.15}},slices:{x:n(),y:n(),z:n()},caps:{x:o(),y:o(),z:o()},text:{valType:"string",dflt:"",arrayOk:!0},hovertext:{valType:"string",dflt:"",arrayOk:!0},hovertemplate:E(),hovertemplatefallback:A(),xhoverformat:d("x"),yhoverformat:d("y"),zhoverformat:d("z"),valuehoverformat:d("value",1),showlegend:r({},e.showlegend,{dflt:!1})},u("",{colorAttr:"`value`",showScaleDflt:!0,editTypeOverride:"calc"}),{opacity:t.opacity,lightposition:t.lightposition,lighting:t.lighting,flatshading:t.flatshading,contour:t.contour,hoverinfo:r({},e.hoverinfo)}),"calc","nested");a.flatshading.dflt=!0,a.lighting.facenormalsepsilon.dflt=0,a.x.editType=a.y.editType=a.z.editType=a.value.editType="calc+clearAxisTypes"}),C3=Vt((K,V)=>{var u=Xr(),d=ji(),E=Sx(),A=vf();function t(r,i,n,o){function a(s,f){return u.coerce(r,i,E,s,f)}e(r,i,n,o,a)}function e(r,i,n,o,a){var s=a("isomin"),f=a("isomax");f!=null&&s!==void 0&&s!==null&&s>f&&(i.isomin=null,i.isomax=null);var v=a("x"),g=a("y"),m=a("z"),w=a("value");if(!v||!v.length||!g||!g.length||!m||!m.length||!w||!w.length){i.visible=!1;return}var l=d.getComponentMethod("calendars","handleTraceDefaults");l(r,i,["x","y","z"],o),a("valuehoverformat"),["x","y","z"].forEach(function(k){a(k+"hoverformat");var M="caps."+k,T=a(M+".show");T&&a(M+".fill");var c="slices."+k,h=a(c+".show");h&&(a(c+".fill"),a(c+".locations"))});var x=a("spaceframe.show");x&&a("spaceframe.fill");var y=a("surface.show");y&&(a("surface.count"),a("surface.fill"),a("surface.pattern"));var S=a("contour.show");S&&(a("contour.color"),a("contour.width")),["text","hovertext","hovertemplate","lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lighting.vertexnormalsepsilon","lighting.facenormalsepsilon","lightposition.x","lightposition.y","lightposition.z","flatshading","opacity"].forEach(function(k){a(k)}),A(r,i,o,a,{prefix:"",cLetter:"c"}),i._length=null}V.exports={supplyDefaults:t,supplyIsoDefaults:e}}),Ex=Vt((K,V)=>{var u=Xr(),d=ih();function E(r,i){i._len=Math.min(i.u.length,i.v.length,i.w.length,i.x.length,i.y.length,i.z.length),i._u=e(i.u,i._len),i._v=e(i.v,i._len),i._w=e(i.w,i._len),i._x=e(i.x,i._len),i._y=e(i.y,i._len),i._z=e(i.z,i._len);var n=A(i);i._gridFill=n.fill,i._Xs=n.Xs,i._Ys=n.Ys,i._Zs=n.Zs,i._len=n.len;var o=0,a,s,f;i.starts&&(a=e(i.starts.x||[]),s=e(i.starts.y||[]),f=e(i.starts.z||[]),o=Math.min(a.length,s.length,f.length)),i._startsX=a||[],i._startsY=s||[],i._startsZ=f||[];var v=0,g=1/0,m;for(m=0;m1&&(h=i[a-1],_=n[a-1],z=o[a-1]),s=0;sh?"-":"+")+"x"),S=S.replace("y",(b>_?"-":"+")+"y"),S=S.replace("z",(P>z?"-":"+")+"z");var I=function(){a=0,D=[],B=[],R=[]};(!a||a{var u=ih(),d=Ex().processGrid,E=Ex().filter;V.exports=function(A,t){t._len=Math.min(t.x.length,t.y.length,t.z.length,t.value.length),t._x=E(t.x,t._len),t._y=E(t.y,t._len),t._z=E(t.z,t._len),t._value=E(t.value,t._len);var e=d(t);t._gridFill=e.fill,t._Xs=e.Xs,t._Ys=e.Ys,t._Zs=e.Zs,t._len=e.len;for(var r=1/0,i=-1/0,n=0;n{V.exports=function(u,d,E,A){A=A||u.length;for(var t=new Array(A),e=0;e{var u=Bf().gl_mesh3d,d=Hp().parseColorScale,E=Xr().isArrayOrTypedArray,A=Vp(),t=xu().extractOpts,e=Km(),r=function(f,v){for(var g=v.length-1;g>0;g--){var m=Math.min(v[g],v[g-1]),w=Math.max(v[g],v[g-1]);if(w>m&&m-1}function it(de,Dt){return de===null?Dt:de}function nt(de,Dt,qt){ct();var _t=[Dt],lt=[qt];if(Q>=1)_t=[Dt],lt=[qt];else if(Q>0){var yt=J(Dt,qt);_t=yt.xyzv,lt=yt.abc}for(var St=0;St<_t.length;St++){Dt=_t[St],qt=lt[St];for(var Ht=[],Yt=0;Yt<3;Yt++){var se=Dt[Yt][0],ke=Dt[Yt][1],Ee=Dt[Yt][2],Ue=Dt[Yt][3],ir=qt[Yt]>-1?qt[Yt]:rt(se,ke,Ee);ir>-1?Ht[Yt]=ir:Ht[Yt]=et(se,ke,Ee,it(de,Ue))}Z(Ht[0],Ht[1],Ht[2])}}function dt(de,Dt,qt){var _t=function(lt,yt,St){nt(de,[Dt[lt],Dt[yt],Dt[St]],[qt[lt],qt[yt],qt[St]])};_t(0,1,2),_t(2,3,0)}function Tt(de,Dt,qt){var _t=function(lt,yt,St){nt(de,[Dt[lt],Dt[yt],Dt[St]],[qt[lt],qt[yt],qt[St]])};_t(0,1,2),_t(3,0,1),_t(2,3,0),_t(1,2,3)}function wt(de,Dt,qt,_t){var lt=de[3];lt_t&&(lt=_t);for(var yt=(de[3]-lt)/(de[3]-Dt[3]+1e-9),St=[],Ht=0;Ht<4;Ht++)St[Ht]=(1-yt)*de[Ht]+yt*Dt[Ht];return St}function Ct(de,Dt,qt){return de>=Dt&&de<=qt}function It(de){var Dt=.001*(I-R);return de>=R-Dt&&de<=I+Dt}function Nt(de){for(var Dt=[],qt=0;qt<4;qt++){var _t=de[qt];Dt.push([f._x[_t],f._y[_t],f._z[_t],f._value[_t]])}return Dt}var te=3;function Jt(de,Dt,qt,_t,lt,yt){yt||(yt=1),qt=[-1,-1,-1];var St=!1,Ht=[Ct(Dt[0][3],_t,lt),Ct(Dt[1][3],_t,lt),Ct(Dt[2][3],_t,lt)];if(!Ht[0]&&!Ht[1]&&!Ht[2])return!1;var Yt=function(ke,Ee,Ue){return It(Ee[0][3])&&It(Ee[1][3])&&It(Ee[2][3])?(nt(ke,Ee,Ue),!0):ytHt?[D,yt]:[yt,B];We(Dt,Yt[0],Yt[1])}}var se=[[Math.min(R,B),Math.max(R,B)],[Math.min(D,I),Math.max(D,I)]];["x","y","z"].forEach(function(ke){for(var Ee=[],Ue=0;Ue0&&(dn.push(En.id),ke==="x"?bn.push([En.distRatio,0,0]):ke==="y"?bn.push([0,En.distRatio,0]):bn.push([0,0,En.distRatio]))}else ke==="x"?pn=er(1,h-1):ke==="y"?pn=er(1,b-1):pn=er(1,_-1);dn.length>0&&(ke==="x"?Ee[ir]=qe(de,dn,ar,Ye,bn,Ee[ir]):ke==="y"?Ee[ir]=vr(de,dn,ar,Ye,bn,Ee[ir]):Ee[ir]=_r(de,dn,ar,Ye,bn,Ee[ir]),ir++),pn.length>0&&(ke==="x"?Ee[ir]=re(de,pn,ar,Ye,Ee[ir]):ke==="y"?Ee[ir]=Kt(de,pn,ar,Ye,Ee[ir]):Ee[ir]=ue(de,pn,ar,Ye,Ee[ir]),ir++)}var gn=f.caps[ke];gn.show&&gn.fill&&(ut(gn.fill),ke==="x"?Ee[ir]=re(de,[0,h-1],ar,Ye,Ee[ir]):ke==="y"?Ee[ir]=Kt(de,[0,b-1],ar,Ye,Ee[ir]):Ee[ir]=ue(de,[0,_-1],ar,Ye,Ee[ir]),ir++)}}),y===0&&st(),f._meshX=F,f._meshY=j,f._meshZ=N,f._meshIntensity=G,f._Xs=M,f._Ys=T,f._Zs=c}return Ir(),f}function s(f,v){var g=f.glplot.gl,m=u({gl:g}),w=new i(f,m,v.uid);return m._trace=w,w.update(v),f.glplot.add(m),w}V.exports={findNearestOnAxis:r,generateIsoMeshes:a,createIsosurfaceTrace:s}}),Q8=Vt((K,V)=>{V.exports={attributes:Sx(),supplyDefaults:C3().supplyDefaults,calc:I3(),colorbar:{min:"cmin",max:"cmax"},plot:zx().createIsosurfaceTrace,moduleType:"trace",name:"isosurface",basePlotModule:jd(),categories:["gl3d","showLegend"],meta:{}}}),tE=Vt((K,V)=>{V.exports=Q8()}),P3=Vt((K,V)=>{var u=Wl(),d=Sx(),E=zv(),A=kl(),t=So().extendFlat,e=Cu().overrideAll,r=V.exports=e(t({x:d.x,y:d.y,z:d.z,value:d.value,isomin:d.isomin,isomax:d.isomax,surface:d.surface,spaceframe:{show:{valType:"boolean",dflt:!1},fill:{valType:"number",min:0,max:1,dflt:1}},slices:d.slices,caps:d.caps,text:d.text,hovertext:d.hovertext,xhoverformat:d.xhoverformat,yhoverformat:d.yhoverformat,zhoverformat:d.zhoverformat,valuehoverformat:d.valuehoverformat,hovertemplate:d.hovertemplate,hovertemplatefallback:d.hovertemplatefallback},u("",{colorAttr:"`value`",showScaleDflt:!0,editTypeOverride:"calc"}),{colorbar:d.colorbar,opacity:d.opacity,opacityscale:E.opacityscale,lightposition:d.lightposition,lighting:d.lighting,flatshading:d.flatshading,contour:d.contour,hoverinfo:t({},A.hoverinfo),showlegend:t({},A.showlegend,{dflt:!1})}),"calc","nested");r.x.editType=r.y.editType=r.z.editType=r.value.editType="calc+clearAxisTypes"}),eE=Vt((K,V)=>{var u=Xr(),d=P3(),E=C3().supplyIsoDefaults,A=L3().opacityscaleDefaults;V.exports=function(t,e,r,i){function n(o,a){return u.coerce(t,e,d,o,a)}E(t,e,r,i,n),A(t,e,i,n)}}),rE=Vt((K,V)=>{var u=Bf().gl_mesh3d,d=Hp().parseColorScale,E=Xr().isArrayOrTypedArray,A=Vp(),t=xu().extractOpts,e=Km(),r=zx().findNearestOnAxis,i=zx().generateIsoMeshes;function n(s,f,v){this.scene=s,this.uid=v,this.mesh=f,this.name="",this.data=null,this.showContour=!1}var o=n.prototype;o.handlePick=function(s){if(s.object===this.mesh){var f=s.data.index,v=this.data._meshX[f],g=this.data._meshY[f],m=this.data._meshZ[f],w=this.data._Ys.length,l=this.data._Zs.length,x=r(v,this.data._Xs).id,y=r(g,this.data._Ys).id,S=r(m,this.data._Zs).id,k=s.index=S+l*y+l*w*x;s.traceCoordinate=[this.data._meshX[k],this.data._meshY[k],this.data._meshZ[k],this.data._value[k]];var M=this.data.hovertext||this.data.text;return E(M)&&M[k]!==void 0?s.textLabel=M[k]:M&&(s.textLabel=M),!0}},o.update=function(s){var f=this.scene,v=f.fullSceneLayout;this.data=i(s);function g(y,S,k,M){return S.map(function(T){return y.d2l(T,0,M)*k})}var m=e(g(v.xaxis,s._meshX,f.dataScale[0],s.xcalendar),g(v.yaxis,s._meshY,f.dataScale[1],s.ycalendar),g(v.zaxis,s._meshZ,f.dataScale[2],s.zcalendar)),w=e(s._meshI,s._meshJ,s._meshK),l={positions:m,cells:w,lightPosition:[s.lightposition.x,s.lightposition.y,s.lightposition.z],ambient:s.lighting.ambient,diffuse:s.lighting.diffuse,specular:s.lighting.specular,roughness:s.lighting.roughness,fresnel:s.lighting.fresnel,vertexNormalsEpsilon:s.lighting.vertexnormalsepsilon,faceNormalsEpsilon:s.lighting.facenormalsepsilon,opacity:s.opacity,opacityscale:s.opacityscale,contourEnable:s.contour.show,contourColor:A(s.contour.color).slice(0,3),contourWidth:s.contour.width,useFacetNormals:s.flatshading},x=t(s);l.vertexIntensity=s._meshIntensity,l.vertexIntensityBounds=[x.min,x.max],l.colormap=d(s),this.mesh.update(l)},o.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()};function a(s,f){var v=s.glplot.gl,g=u({gl:v}),m=new n(s,g,f.uid);return g._trace=m,m.update(f),s.glplot.add(g),m}V.exports=a}),nE=Vt((K,V)=>{V.exports={attributes:P3(),supplyDefaults:eE(),calc:I3(),colorbar:{min:"cmin",max:"cmax"},plot:rE(),moduleType:"trace",name:"volume",basePlotModule:jd(),categories:["gl3d","showLegend"],meta:{}}}),aE=Vt((K,V)=>{V.exports=nE()}),iE=Vt((K,V)=>{var u=ji(),d=Xr(),E=vf(),A=Zm();V.exports=function(t,e,r,i){function n(v,g){return d.coerce(t,e,A,v,g)}function o(v){var g=v.map(function(m){var w=n(m);return w&&d.isArrayOrTypedArray(w)?w:null});return g.every(function(m){return m&&m.length===g[0].length})&&g}var a=o(["x","y","z"]);if(!a){e.visible=!1;return}if(o(["i","j","k"]),e.i&&(!e.j||!e.k)||e.j&&(!e.k||!e.i)||e.k&&(!e.i||!e.j)){e.visible=!1;return}var s=u.getComponentMethod("calendars","handleTraceDefaults");s(t,e,["x","y","z"],i),["lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lighting.vertexnormalsepsilon","lighting.facenormalsepsilon","lightposition.x","lightposition.y","lightposition.z","flatshading","alphahull","delaunayaxis","opacity"].forEach(function(v){n(v)});var f=n("contour.show");f&&(n("contour.color"),n("contour.width")),"intensity"in t?(n("intensity"),n("intensitymode"),E(t,e,i,n,{prefix:"",cLetter:"c"})):(e.showscale=!1,"facecolor"in t?n("facecolor"):"vertexcolor"in t?n("vertexcolor"):n("color",r)),n("text"),n("hovertext"),n("hovertemplate"),n("hovertemplatefallback"),n("xhoverformat"),n("yhoverformat"),n("zhoverformat"),e._length=null}}),oE=Vt((K,V)=>{var u=ih();V.exports=function(d,E){E.intensity&&u(d,E,{vals:E.intensity,containerStr:"",cLetter:"c"})}}),sE=Vt((K,V)=>{var u=Bf().gl_mesh3d,d=Bf().delaunay_triangulate,E=Bf().alpha_shape,A=Bf().convex_hull,t=Hp().parseColorScale,e=Xr().isArrayOrTypedArray,r=Vp(),i=xu().extractOpts,n=Km();function o(l,x,y){this.scene=l,this.uid=y,this.mesh=x,this.name="",this.color="#fff",this.data=null,this.showContour=!1}var a=o.prototype;a.handlePick=function(l){if(l.object===this.mesh){var x=l.index=l.data.index;l.data._cellCenter?l.traceCoordinate=l.data.dataCoordinate:l.traceCoordinate=[this.data.x[x],this.data.y[x],this.data.z[x]];var y=this.data.hovertext||this.data.text;return e(y)&&y[x]!==void 0?l.textLabel=y[x]:y&&(l.textLabel=y),!0}};function s(l){for(var x=[],y=l.length,S=0;S=x-.5)return!1;return!0}a.update=function(l){var x=this.scene,y=x.fullSceneLayout;this.data=l;var S=l.x.length,k=n(f(y.xaxis,l.x,x.dataScale[0],l.xcalendar),f(y.yaxis,l.y,x.dataScale[1],l.ycalendar),f(y.zaxis,l.z,x.dataScale[2],l.zcalendar)),M;if(l.i&&l.j&&l.k){if(l.i.length!==l.j.length||l.j.length!==l.k.length||!m(l.i,S)||!m(l.j,S)||!m(l.k,S))return;M=n(v(l.i),v(l.j),v(l.k))}else l.alphahull===0?M=A(k):l.alphahull>0?M=E(l.alphahull,k):M=g(l.delaunayaxis,k);var T={positions:k,cells:M,lightPosition:[l.lightposition.x,l.lightposition.y,l.lightposition.z],ambient:l.lighting.ambient,diffuse:l.lighting.diffuse,specular:l.lighting.specular,roughness:l.lighting.roughness,fresnel:l.lighting.fresnel,vertexNormalsEpsilon:l.lighting.vertexnormalsepsilon,faceNormalsEpsilon:l.lighting.facenormalsepsilon,opacity:l.opacity,contourEnable:l.contour.show,contourColor:r(l.contour.color).slice(0,3),contourWidth:l.contour.width,useFacetNormals:l.flatshading};if(l.intensity){var c=i(l);this.color="#fff";var h=l.intensitymode;T[h+"Intensity"]=l.intensity,T[h+"IntensityBounds"]=[c.min,c.max],T.colormap=t(l)}else l.vertexcolor?(this.color=l.vertexcolor[0],T.vertexColors=s(l.vertexcolor)):l.facecolor?(this.color=l.facecolor[0],T.cellColors=s(l.facecolor)):(this.color=l.color,T.meshColor=r(l.color));this.mesh.update(T)},a.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()};function w(l,x){var y=l.glplot.gl,S=u({gl:y}),k=new o(l,S,x.uid);return S._trace=k,k.update(x),l.glplot.add(S),k}V.exports=w}),lE=Vt((K,V)=>{V.exports={attributes:Zm(),supplyDefaults:iE(),calc:oE(),colorbar:{min:"cmin",max:"cmax"},plot:sE(),moduleType:"trace",name:"mesh3d",basePlotModule:jd(),categories:["gl3d","showLegend"],meta:{}}}),uE=Vt((K,V)=>{V.exports=lE()}),O3=Vt((K,V)=>{var u=Wl(),d=hc().axisHoverFormat,{hovertemplateAttrs:E,templatefallbackAttrs:A}=yl(),t=Zm(),e=kl(),r=So().extendFlat,i={x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},z:{valType:"data_array",editType:"calc+clearAxisTypes"},u:{valType:"data_array",editType:"calc"},v:{valType:"data_array",editType:"calc"},w:{valType:"data_array",editType:"calc"},sizemode:{valType:"enumerated",values:["scaled","absolute","raw"],editType:"calc",dflt:"scaled"},sizeref:{valType:"number",editType:"calc",min:0},anchor:{valType:"enumerated",editType:"calc",values:["tip","tail","cm","center"],dflt:"cm"},text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertemplate:E({editType:"calc"},{keys:["norm"]}),hovertemplatefallback:A({editType:"calc"}),uhoverformat:d("u",1),vhoverformat:d("v",1),whoverformat:d("w",1),xhoverformat:d("x"),yhoverformat:d("y"),zhoverformat:d("z"),showlegend:r({},e.showlegend,{dflt:!1})};r(i,u("",{colorAttr:"u/v/w norm",showScaleDflt:!0,editTypeOverride:"calc"}));var n=["opacity","lightposition","lighting"];n.forEach(function(o){i[o]=t[o]}),i.hoverinfo=r({},e.hoverinfo,{editType:"calc",flags:["x","y","z","u","v","w","norm","text","name"],dflt:"x+y+z+norm+text+name"}),V.exports=i}),cE=Vt((K,V)=>{var u=Xr(),d=vf(),E=O3();V.exports=function(A,t,e,r){function i(m,w){return u.coerce(A,t,E,m,w)}var n=i("u"),o=i("v"),a=i("w"),s=i("x"),f=i("y"),v=i("z");if(!n||!n.length||!o||!o.length||!a||!a.length||!s||!s.length||!f||!f.length||!v||!v.length){t.visible=!1;return}var g=i("sizemode");i("sizeref",g==="raw"?1:.5),i("anchor"),i("lighting.ambient"),i("lighting.diffuse"),i("lighting.specular"),i("lighting.roughness"),i("lighting.fresnel"),i("lightposition.x"),i("lightposition.y"),i("lightposition.z"),d(A,t,r,i,{prefix:"",cLetter:"c"}),i("text"),i("hovertext"),i("hovertemplate"),i("hovertemplatefallback"),i("uhoverformat"),i("vhoverformat"),i("whoverformat"),i("xhoverformat"),i("yhoverformat"),i("zhoverformat"),t._length=null}}),fE=Vt((K,V)=>{var u=ih();V.exports=function(d,E){for(var A=E.u,t=E.v,e=E.w,r=Math.min(E.x.length,E.y.length,E.z.length,A.length,t.length,e.length),i=-1/0,n=1/0,o=0;o{var u=Bf().gl_cone3d,d=Bf().gl_cone3d.createConeMesh,E=Xr().simpleMap,A=Hp().parseColorScale,t=xu().extractOpts,e=Xr().isArrayOrTypedArray,r=Km();function i(g,m){this.scene=g,this.uid=m,this.mesh=null,this.data=null}var n=i.prototype;n.handlePick=function(g){if(g.object===this.mesh){var m=g.index=g.data.index,w=this.data.x[m],l=this.data.y[m],x=this.data.z[m],y=this.data.u[m],S=this.data.v[m],k=this.data.w[m];g.traceCoordinate=[w,l,x,y,S,k,Math.sqrt(y*y+S*S+k*k)];var M=this.data.hovertext||this.data.text;return e(M)&&M[m]!==void 0?g.textLabel=M[m]:M&&(g.textLabel=M),!0}};var o={xaxis:0,yaxis:1,zaxis:2},a={tip:1,tail:0,cm:.25,center:.5},s={tip:1,tail:1,cm:.75,center:.5};function f(g,m){var w=g.fullSceneLayout,l=g.dataScale,x={};function y(c,h){var b=w[h],_=l[o[h]];return E(c,function(P){return b.d2l(P)*_})}x.vectors=r(y(m.u,"xaxis"),y(m.v,"yaxis"),y(m.w,"zaxis"),m._len),x.positions=r(y(m.x,"xaxis"),y(m.y,"yaxis"),y(m.z,"zaxis"),m._len);var S=t(m);x.colormap=A(m),x.vertexIntensityBounds=[S.min/m._normMax,S.max/m._normMax],x.coneOffset=a[m.anchor];var k=m.sizemode;k==="scaled"?x.coneSize=m.sizeref||.5:k==="absolute"?x.coneSize=m.sizeref&&m._normMax?m.sizeref/m._normMax:.5:k==="raw"&&(x.coneSize=m.sizeref),x.coneSizemode=k;var M=u(x),T=m.lightposition;return M.lightPosition=[T.x,T.y,T.z],M.ambient=m.lighting.ambient,M.diffuse=m.lighting.diffuse,M.specular=m.lighting.specular,M.roughness=m.lighting.roughness,M.fresnel=m.lighting.fresnel,M.opacity=m.opacity,m._pad=s[m.anchor]*M.vectorScale*M.coneScale*m._normMax,M}n.update=function(g){this.data=g;var m=f(this.scene,g);this.mesh.update(m)},n.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()};function v(g,m){var w=g.glplot.gl,l=f(g,m),x=d(w,l),y=new i(g,m.uid);return y.mesh=x,y.data=m,x._trace=y,g.glplot.add(x),y}V.exports=v}),pE=Vt((K,V)=>{V.exports={moduleType:"trace",name:"cone",basePlotModule:jd(),categories:["gl3d","showLegend"],attributes:O3(),supplyDefaults:cE(),colorbar:{min:"cmin",max:"cmax"},calc:fE(),plot:hE(),eventData:function(u,d){return u.norm=d.traceCoordinate[6],u},meta:{}}}),dE=Vt((K,V)=>{V.exports=pE()}),D3=Vt((K,V)=>{var u=Wl(),d=hc().axisHoverFormat,{hovertemplateAttrs:E,templatefallbackAttrs:A}=yl(),t=Zm(),e=kl(),r=So().extendFlat,i={x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},z:{valType:"data_array",editType:"calc+clearAxisTypes"},u:{valType:"data_array",editType:"calc"},v:{valType:"data_array",editType:"calc"},w:{valType:"data_array",editType:"calc"},starts:{x:{valType:"data_array",editType:"calc"},y:{valType:"data_array",editType:"calc"},z:{valType:"data_array",editType:"calc"},editType:"calc"},maxdisplayed:{valType:"integer",min:0,dflt:1e3,editType:"calc"},sizeref:{valType:"number",editType:"calc",min:0,dflt:1},text:{valType:"string",dflt:"",editType:"calc"},hovertext:{valType:"string",dflt:"",editType:"calc"},hovertemplate:E({editType:"calc"},{keys:["tubex","tubey","tubez","tubeu","tubev","tubew","norm","divergence"]}),hovertemplatefallback:A({editType:"calc"}),uhoverformat:d("u",1),vhoverformat:d("v",1),whoverformat:d("w",1),xhoverformat:d("x"),yhoverformat:d("y"),zhoverformat:d("z"),showlegend:r({},e.showlegend,{dflt:!1})};r(i,u("",{colorAttr:"u/v/w norm",showScaleDflt:!0,editTypeOverride:"calc"}));var n=["opacity","lightposition","lighting"];n.forEach(function(o){i[o]=t[o]}),i.hoverinfo=r({},e.hoverinfo,{editType:"calc",flags:["x","y","z","u","v","w","norm","divergence","text","name"],dflt:"x+y+z+norm+text+name"}),V.exports=i}),mE=Vt((K,V)=>{var u=Xr(),d=vf(),E=D3();V.exports=function(A,t,e,r){function i(g,m){return u.coerce(A,t,E,g,m)}var n=i("u"),o=i("v"),a=i("w"),s=i("x"),f=i("y"),v=i("z");if(!n||!n.length||!o||!o.length||!a||!a.length||!s||!s.length||!f||!f.length||!v||!v.length){t.visible=!1;return}i("starts.x"),i("starts.y"),i("starts.z"),i("maxdisplayed"),i("sizeref"),i("lighting.ambient"),i("lighting.diffuse"),i("lighting.specular"),i("lighting.roughness"),i("lighting.fresnel"),i("lightposition.x"),i("lightposition.y"),i("lightposition.z"),d(A,t,r,i,{prefix:"",cLetter:"c"}),i("text"),i("hovertext"),i("hovertemplate"),i("hovertemplatefallback"),i("uhoverformat"),i("vhoverformat"),i("whoverformat"),i("xhoverformat"),i("yhoverformat"),i("zhoverformat"),t._length=null}}),gE=Vt((K,V)=>{var u=Bf().gl_streamtube3d,d=u.createTubeMesh,E=Xr(),A=Hp().parseColorScale,t=xu().extractOpts,e=Km(),r={xaxis:0,yaxis:1,zaxis:2};function i(v,g){this.scene=v,this.uid=g,this.mesh=null,this.data=null}var n=i.prototype;n.handlePick=function(v){var g=this.scene.fullSceneLayout,m=this.scene.dataScale;function w(y,S){var k=g[S],M=m[r[S]];return k.l2c(y)/M}if(v.object===this.mesh){var l=v.data.position,x=v.data.velocity;return v.traceCoordinate=[w(l[0],"xaxis"),w(l[1],"yaxis"),w(l[2],"zaxis"),w(x[0],"xaxis"),w(x[1],"yaxis"),w(x[2],"zaxis"),v.data.intensity*this.data._normMax,v.data.divergence],v.textLabel=this.data.hovertext||this.data.text,!0}};function o(v){var g=v.length,m;return g>2?m=v.slice(1,g-1):g===2?m=[(v[0]+v[1])/2]:m=v,m}function a(v){var g=v.length;return g===1?[.5,.5]:[v[1]-v[0],v[g-1]-v[g-2]]}function s(v,g){var m=v.fullSceneLayout,w=v.dataScale,l=g._len,x={};function y(et,Z){var ot=m[Z],X=w[r[Z]];return E.simpleMap(et,function(Q){return ot.d2l(Q)*X})}if(x.vectors=e(y(g._u,"xaxis"),y(g._v,"yaxis"),y(g._w,"zaxis"),l),!l)return{positions:[],cells:[]};var S=y(g._Xs,"xaxis"),k=y(g._Ys,"yaxis"),M=y(g._Zs,"zaxis");x.meshgrid=[S,k,M],x.gridFill=g._gridFill;var T=g._slen;if(T)x.startingPositions=e(y(g._startsX,"xaxis"),y(g._startsY,"yaxis"),y(g._startsZ,"zaxis"));else{for(var c=k[0],h=o(S),b=o(M),_=new Array(h.length*b.length),P=0,z=0;z{V.exports={moduleType:"trace",name:"streamtube",basePlotModule:jd(),categories:["gl3d","showLegend"],attributes:D3(),supplyDefaults:mE(),colorbar:{min:"cmin",max:"cmax"},calc:Ex().calc,plot:gE(),eventData:function(u,d){return u.tubex=u.x,u.tubey=u.y,u.tubez=u.z,u.tubeu=d.traceCoordinate[3],u.tubev=d.traceCoordinate[4],u.tubew=d.traceCoordinate[5],u.norm=d.traceCoordinate[6],u.divergence=d.traceCoordinate[7],delete u.x,delete u.y,delete u.z,u},meta:{}}}),yE=Vt((K,V)=>{V.exports=vE()}),L0=Vt((K,V)=>{var{hovertemplateAttrs:u,texttemplateAttrs:d,templatefallbackAttrs:E}=yl(),A=Jh(),t=dc(),e=kl(),r=Wl(),i=If().dash,n=So().extendFlat,o=Cu().overrideAll,a=t.marker,s=t.line,f=a.line;V.exports=o({lon:{valType:"data_array"},lat:{valType:"data_array"},locations:{valType:"data_array"},locationmode:{valType:"enumerated",values:["ISO-3","USA-states","country names","geojson-id"],dflt:"ISO-3"},geojson:{valType:"any",editType:"calc"},featureidkey:{valType:"string",editType:"calc",dflt:"id"},mode:n({},t.mode,{dflt:"markers"}),text:n({},t.text,{}),texttemplate:d({editType:"plot"},{keys:["lat","lon","location","text"]}),texttemplatefallback:E({editType:"plot"}),hovertext:n({},t.hovertext,{}),textfont:t.textfont,textposition:t.textposition,line:{color:s.color,width:s.width,dash:i},connectgaps:t.connectgaps,marker:n({symbol:a.symbol,opacity:a.opacity,angle:a.angle,angleref:n({},a.angleref,{values:["previous","up","north"]}),standoff:a.standoff,size:a.size,sizeref:a.sizeref,sizemin:a.sizemin,sizemode:a.sizemode,colorbar:a.colorbar,line:n({width:f.width},r("marker.line")),gradient:a.gradient},r("marker")),fill:{valType:"enumerated",values:["none","toself"],dflt:"none"},fillcolor:A(),selected:t.selected,unselected:t.unselected,hoverinfo:n({},e.hoverinfo,{flags:["lon","lat","location","text","name"]}),hovertemplate:u(),hovertemplatefallback:E()},"calc","nested")}),xE=Vt((K,V)=>{var u=Xr(),d=nu(),E=Lh(),A=Bh(),t=Rh(),e=tp(),r=L0(),i=["The library used by the *country names* `locationmode` option is changing in the next major version.","Some country names in existing plots may not work in the new version.","To ensure consistent behavior, consider setting `locationmode` to *ISO-3*."].join(" ");V.exports=function(n,o,a,s){function f(S,k){return u.coerce(n,o,r,S,k)}var v=f("locations"),g;if(v&&v.length){var m=f("geojson"),w;(typeof m=="string"&&m!==""||u.isPlainObject(m))&&(w="geojson-id");var l=f("locationmode",w);l==="country names"&&u.warn(i),l==="geojson-id"&&f("featureidkey"),g=v.length}else{var x=f("lon")||[],y=f("lat")||[];g=Math.min(x.length,y.length)}if(!g){o.visible=!1;return}o._length=g,f("text"),f("hovertext"),f("hovertemplate"),f("hovertemplatefallback"),f("mode"),d.hasMarkers(o)&&E(n,o,a,s,f,{gradient:!0}),d.hasLines(o)&&(A(n,o,a,s,f),f("connectgaps")),d.hasText(o)&&(f("texttemplate"),f("texttemplatefallback"),t(n,o,s,f)),f("fill"),o.fill!=="none"&&e(n,o,a,f),u.coerceSelectionMarkerOpacity(o,f)}}),_E=Vt((K,V)=>{var u=yo();V.exports=function(d,E,A){var t={},e=A[E.geo]._subplot,r=e.mockAxis,i=d.lonlat;return t.lonLabel=u.tickText(r,r.c2l(i[0]),!0).text,t.latLabel=u.tickText(r,r.c2l(i[1]),!0).text,t}}),Lx=Vt((K,V)=>{var u=Lo(),d=ks().BADNUM,E=Nh(),A=yp(),t=jh(),e=Xr().isArrayOrTypedArray,r=Xr()._;function i(n){return n&&typeof n=="string"}V.exports=function(n,o){var a=e(o.locations),s=a?o.locations.length:o._length,f=new Array(s),v;o.geojson?v=function(y){return i(y)||u(y)}:v=i;for(var g=0;g{K.projNames={airy:"airy",aitoff:"aitoff","albers usa":"albersUsa",albers:"albers",august:"august","azimuthal equal area":"azimuthalEqualArea","azimuthal equidistant":"azimuthalEquidistant",baker:"baker",bertin1953:"bertin1953",boggs:"boggs",bonne:"bonne",bottomley:"bottomley",bromley:"bromley",collignon:"collignon","conic conformal":"conicConformal","conic equal area":"conicEqualArea","conic equidistant":"conicEquidistant",craig:"craig",craster:"craster","cylindrical equal area":"cylindricalEqualArea","cylindrical stereographic":"cylindricalStereographic",eckert1:"eckert1",eckert2:"eckert2",eckert3:"eckert3",eckert4:"eckert4",eckert5:"eckert5",eckert6:"eckert6",eisenlohr:"eisenlohr","equal earth":"equalEarth",equirectangular:"equirectangular",fahey:"fahey","foucaut sinusoidal":"foucautSinusoidal",foucaut:"foucaut",ginzburg4:"ginzburg4",ginzburg5:"ginzburg5",ginzburg6:"ginzburg6",ginzburg8:"ginzburg8",ginzburg9:"ginzburg9",gnomonic:"gnomonic","gringorten quincuncial":"gringortenQuincuncial",gringorten:"gringorten",guyou:"guyou",hammer:"hammer",hill:"hill",homolosine:"homolosine",hufnagel:"hufnagel",hyperelliptical:"hyperelliptical",kavrayskiy7:"kavrayskiy7",lagrange:"lagrange",larrivee:"larrivee",laskowski:"laskowski",loximuthal:"loximuthal",mercator:"mercator",miller:"miller",mollweide:"mollweide","mt flat polar parabolic":"mtFlatPolarParabolic","mt flat polar quartic":"mtFlatPolarQuartic","mt flat polar sinusoidal":"mtFlatPolarSinusoidal","natural earth":"naturalEarth","natural earth1":"naturalEarth1","natural earth2":"naturalEarth2","nell hammer":"nellHammer",nicolosi:"nicolosi",orthographic:"orthographic",patterson:"patterson","peirce quincuncial":"peirceQuincuncial",polyconic:"polyconic","rectangular polyconic":"rectangularPolyconic",robinson:"robinson",satellite:"satellite","sinu mollweide":"sinuMollweide",sinusoidal:"sinusoidal",stereographic:"stereographic",times:"times","transverse mercator":"transverseMercator","van der grinten":"vanDerGrinten","van der grinten2":"vanDerGrinten2","van der grinten3":"vanDerGrinten3","van der grinten4":"vanDerGrinten4",wagner4:"wagner4",wagner6:"wagner6",wiechel:"wiechel","winkel tripel":"winkel3",winkel3:"winkel3"},K.axesNames=["lonaxis","lataxis"],K.lonaxisSpan={orthographic:180,"azimuthal equal area":360,"azimuthal equidistant":360,"conic conformal":180,gnomonic:160,stereographic:180,"transverse mercator":180,"*":360},K.lataxisSpan={"conic conformal":150,stereographic:179.5,"*":180},K.scopeDefaults={world:{lonaxisRange:[-180,180],lataxisRange:[-90,90],projType:"equirectangular",projRotate:[0,0,0]},usa:{lonaxisRange:[-180,-50],lataxisRange:[15,80],projType:"albers usa"},europe:{lonaxisRange:[-30,60],lataxisRange:[30,85],projType:"conic conformal",projRotate:[15,0,0],projParallels:[0,60]},asia:{lonaxisRange:[22,160],lataxisRange:[-15,55],projType:"mercator",projRotate:[0,0,0]},africa:{lonaxisRange:[-30,60],lataxisRange:[-40,40],projType:"mercator",projRotate:[0,0,0]},"north america":{lonaxisRange:[-180,-45],lataxisRange:[5,85],projType:"conic conformal",projRotate:[-100,0,0],projParallels:[29.5,45.5]},"south america":{lonaxisRange:[-100,-30],lataxisRange:[-60,15],projType:"mercator",projRotate:[0,0,0]},antarctica:{lonaxisRange:[-180,180],lataxisRange:[-90,-60],projType:"equirectangular",projRotate:[0,0,0]},oceania:{lonaxisRange:[-180,180],lataxisRange:[-50,25],projType:"equirectangular",projRotate:[0,0,0]}},K.clipPad=.001,K.precision=.1,K.landColor="#F0DC82",K.waterColor="#3399FF",K.locationmodeToLayer={"ISO-3":"countries","USA-states":"subunits","country names":"countries"},K.sphereSVG={type:"Sphere"},K.fillLayers={ocean:1,land:1,lakes:1},K.lineLayers={subunits:1,countries:1,coastlines:1,rivers:1,frame:1},K.layers=["bg","ocean","land","lakes","subunits","countries","coastlines","rivers","lataxis","lonaxis","frame","backplot","frontplot"],K.layersForChoropleth=["bg","ocean","land","subunits","countries","coastlines","lataxis","lonaxis","frame","backplot","rivers","lakes","frontplot"],K.layerNameToAdjective={ocean:"ocean",land:"land",lakes:"lake",subunits:"subunit",countries:"country",coastlines:"coastline",rivers:"river",frame:"frame"}}),F3=Vt((K,V)=>{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K):(u=u||self,d(u.topojson=u.topojson||{}))})(K,function(u){function d(y){return y}function E(y){if(y==null)return d;var S,k,M=y.scale[0],T=y.scale[1],c=y.translate[0],h=y.translate[1];return function(b,_){_||(S=k=0);var P=2,z=b.length,D=new Array(z);for(D[0]=(S+=b[0])*M+c,D[1]=(k+=b[1])*T+h;Pc&&(c=P[0]),P[1]h&&(h=P[1])}function _(P){switch(P.type){case"GeometryCollection":P.geometries.forEach(_);break;case"Point":b(P.coordinates);break;case"MultiPoint":P.coordinates.forEach(b);break}}y.arcs.forEach(function(P){for(var z=-1,D=P.length,B;++zc&&(c=B[0]),B[1]h&&(h=B[1])});for(k in y.objects)_(y.objects[k]);return[M,T,c,h]}function t(y,S){for(var k,M=y.length,T=M-S;T<--M;)k=y[T],y[T++]=y[M],y[M]=k}function e(y,S){return typeof S=="string"&&(S=y.objects[S]),S.type==="GeometryCollection"?{type:"FeatureCollection",features:S.geometries.map(function(k){return r(y,k)})}:r(y,S)}function r(y,S){var k=S.id,M=S.bbox,T=S.properties==null?{}:S.properties,c=i(y,S);return k==null&&M==null?{type:"Feature",properties:T,geometry:c}:M==null?{type:"Feature",id:k,properties:T,geometry:c}:{type:"Feature",id:k,bbox:M,properties:T,geometry:c}}function i(y,S){var k=E(y.transform),M=y.arcs;function T(z,D){D.length&&D.pop();for(var B=M[z<0?~z:z],R=0,I=B.length;R1)M=s(y,S,k);else for(T=0,M=new Array(c=y.arcs.length);T1)for(var D=1,B=b(P[0]),R,I;DB&&(I=P[0],P[0]=P[D],P[D]=I,B=R);return P}).filter(function(_){return _.length>0})}}function m(y,S){for(var k=0,M=y.length;k>>1;y[T]=2))throw new Error("n must be ≥2");_=y.bbox||A(y);var k=_[0],M=_[1],T=_[2],c=_[3],h;S={scale:[T-k?(T-k)/(h-1):1,c-M?(c-M)/(h-1):1],translate:[k,M]}}else _=y.bbox;var b=l(S),_,P,z=y.objects,D={};function B(F){return b(F)}function R(F){var j;switch(F.type){case"GeometryCollection":j={type:"GeometryCollection",geometries:F.geometries.map(R)};break;case"Point":j={type:"Point",coordinates:B(F.coordinates)};break;case"MultiPoint":j={type:"MultiPoint",coordinates:F.coordinates.map(B)};break;default:return F}return F.id!=null&&(j.id=F.id),F.bbox!=null&&(j.bbox=F.bbox),F.properties!=null&&(j.properties=F.properties),j}function I(F){var j=0,N=1,G=F.length,rt,ct=new Array(G);for(ct[0]=b(F[0],0);++j{var u=V.exports={},d=Lv().locationmodeToLayer,E=F3().feature;u.getTopojsonName=function(A){return[A.scope.replace(/ /g,"-"),"_",A.resolution.toString(),"m"].join("")},u.getTopojsonPath=function(A,t){return A+=A.endsWith("/")?"":"/",`${A}${t}.json`},u.getTopojsonFeatures=function(A,t){var e=d[A.locationmode],r=t.objects[e];return E(t,r).features}}),Ud=Vt(K=>{var V=ks().BADNUM;K.calcTraceToLineCoords=function(u){for(var d=u[0].trace,E=d.connectgaps,A=[],t=[],e=0;e0&&(A.push(t),t=[])}return t.length>0&&A.push(t),A},K.makeLine=function(u){return u.length===1?{type:"LineString",coordinates:u[0]}:{type:"MultiLineString",coordinates:u}},K.makePolygon=function(u){if(u.length===1)return{type:"Polygon",coordinates:u};for(var d=new Array(u.length),E=0;E{V.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|ç)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|é)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|é)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|ã)o.?tom(e|é)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}}),Ix=Vt(K=>{Object.defineProperty(K,"__esModule",{value:!0});var V=63710088e-1,u={centimeters:V*100,centimetres:V*100,degrees:360/(2*Math.PI),feet:V*3.28084,inches:V*39.37,kilometers:V/1e3,kilometres:V/1e3,meters:V,metres:V,miles:V/1609.344,millimeters:V*1e3,millimetres:V*1e3,nauticalmiles:V/1852,radians:1,yards:V*1.0936},d={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function E(z,D,B={}){let R={type:"Feature"};return(B.id===0||B.id)&&(R.id=B.id),B.bbox&&(R.bbox=B.bbox),R.properties=D||{},R.geometry=z,R}function A(z,D,B={}){switch(z){case"Point":return t(D).geometry;case"LineString":return n(D).geometry;case"Polygon":return r(D).geometry;case"MultiPoint":return f(D).geometry;case"MultiLineString":return s(D).geometry;case"MultiPolygon":return v(D).geometry;default:throw new Error(z+" is invalid")}}function t(z,D,B={}){if(!z)throw new Error("coordinates is required");if(!Array.isArray(z))throw new Error("coordinates must be an Array");if(z.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!h(z[0])||!h(z[1]))throw new Error("coordinates must contain numbers");return E({type:"Point",coordinates:z},D,B)}function e(z,D,B={}){return a(z.map(R=>t(R,D)),B)}function r(z,D,B={}){for(let R of z){if(R.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(R[R.length-1].length!==R[0].length)throw new Error("First and last Position are not equivalent.");for(let I=0;Ir(R,D)),B)}function n(z,D,B={}){if(z.length<2)throw new Error("coordinates must be an array of two or more positions");return E({type:"LineString",coordinates:z},D,B)}function o(z,D,B={}){return a(z.map(R=>n(R,D)),B)}function a(z,D={}){let B={type:"FeatureCollection"};return D.id&&(B.id=D.id),D.bbox&&(B.bbox=D.bbox),B.features=z,B}function s(z,D,B={}){return E({type:"MultiLineString",coordinates:z},D,B)}function f(z,D,B={}){return E({type:"MultiPoint",coordinates:z},D,B)}function v(z,D,B={}){return E({type:"MultiPolygon",coordinates:z},D,B)}function g(z,D,B={}){return E({type:"GeometryCollection",geometries:z},D,B)}function m(z,D=0){if(D&&!(D>=0))throw new Error("precision must be a positive number");let B=Math.pow(10,D||0);return Math.round(z*B)/B}function w(z,D="kilometers"){let B=u[D];if(!B)throw new Error(D+" units is invalid");return z*B}function l(z,D="kilometers"){let B=u[D];if(!B)throw new Error(D+" units is invalid");return z/B}function x(z,D){return k(l(z,D))}function y(z){let D=z%360;return D<0&&(D+=360),D}function S(z){return z=z%360,z>180?z-360:z<-180?z+360:z}function k(z){return z%(2*Math.PI)*180/Math.PI}function M(z){return z%360*Math.PI/180}function T(z,D="kilometers",B="kilometers"){if(!(z>=0))throw new Error("length must be a positive number");return w(l(z,D),B)}function c(z,D="meters",B="kilometers"){if(!(z>=0))throw new Error("area must be a positive number");let R=d[D];if(!R)throw new Error("invalid original units");let I=d[B];if(!I)throw new Error("invalid final units");return z/R*I}function h(z){return!isNaN(z)&&z!==null&&!Array.isArray(z)}function b(z){return z!==null&&typeof z=="object"&&!Array.isArray(z)}function _(z){if(!z)throw new Error("bbox is required");if(!Array.isArray(z))throw new Error("bbox must be an Array");if(z.length!==4&&z.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");z.forEach(D=>{if(!h(D))throw new Error("bbox must only contain numbers")})}function P(z){if(!z)throw new Error("id is required");if(["string","number"].indexOf(typeof z)===-1)throw new Error("id must be a number or a string")}K.areaFactors=d,K.azimuthToBearing=S,K.bearingToAzimuth=y,K.convertArea=c,K.convertLength=T,K.degreesToRadians=M,K.earthRadius=V,K.factors=u,K.feature=E,K.featureCollection=a,K.geometry=A,K.geometryCollection=g,K.isNumber=h,K.isObject=b,K.lengthToDegrees=x,K.lengthToRadians=l,K.lineString=n,K.lineStrings=o,K.multiLineString=s,K.multiPoint=f,K.multiPolygon=v,K.point=t,K.points=e,K.polygon=r,K.polygons=i,K.radiansToDegrees=k,K.radiansToLength=w,K.round=m,K.validateBBox=_,K.validateId=P}),Px=Vt(K=>{Object.defineProperty(K,"__esModule",{value:!0});var V=Ix();function u(l,x,y){if(l!==null)for(var S,k,M,T,c,h,b,_=0,P=0,z,D=l.type,B=D==="FeatureCollection",R=D==="Feature",I=B?l.features.length:1,F=0;Fh||B>b||R>_){c=P,h=S,b=B,_=R,M=0;return}var I=V.lineString.call(void 0,[c,P],y.properties);if(x(I,S,k,R,M)===!1)return!1;M++,c=P})===!1)return!1}}})}function f(l,x,y){var S=y,k=!1;return s(l,function(M,T,c,h,b){k===!1&&y===void 0?S=M:S=x(S,M,T,c,h,b),k=!0}),S}function v(l,x){if(!l)throw new Error("geojson is required");o(l,function(y,S,k){if(y.geometry!==null){var M=y.geometry.type,T=y.geometry.coordinates;switch(M){case"LineString":if(x(y,S,k,0,0)===!1)return!1;break;case"Polygon":for(var c=0;c{Object.defineProperty(K,"__esModule",{value:!0});var V=Ix(),u=Px();function d(n){return u.geomReduce.call(void 0,n,(o,a)=>o+E(a),0)}function E(n){let o=0,a;switch(n.type){case"Polygon":return A(n.coordinates);case"MultiPolygon":for(a=0;a0){o+=Math.abs(r(n[0]));for(let a=1;a=o?(s+2)%o:s+2],m=f[0]*e,w=v[1]*e,l=g[0]*e;a+=(l-m)*Math.sin(w),s++}return a*t}var i=d;K.area=d,K.default=i}),TE=Vt(K=>{Object.defineProperty(K,"__esModule",{value:!0});var V=Ix(),u=Px();function d(A,t={}){let e=0,r=0,i=0;return u.coordEach.call(void 0,A,function(n){e+=n[0],r+=n[1],i++},!0),V.point.call(void 0,[e/i,r/i],t.properties)}var E=d;K.centroid=d,K.default=E}),kE=Vt(K=>{Object.defineProperty(K,"__esModule",{value:!0});var V=Px();function u(E,A={}){if(E.bbox!=null&&A.recompute!==!0)return E.bbox;let t=[1/0,1/0,-1/0,-1/0];return V.coordEach.call(void 0,E,e=>{t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]{var u=Ni(),d=bE(),{area:E}=wE(),{centroid:A}=TE(),{bbox:t}=kE(),e=Rg(),r=wd(),i=Fp(),n=Og(),o=qg(),a=Object.keys(d),s={"ISO-3":e,"USA-states":e,"country names":f};function f(S){for(var k=0;k0&&D[B+1][0]<0)return B;return null}switch(T==="RUS"||T==="FJI"?h=function(D){var B;if(z(D)===null)B=D;else for(B=new Array(D.length),P=0;PB?R[I++]=[D[P][0]+360,D[P][1]]:P===B?(R[I++]=D[P],R[I++]=[D[P][0],-90]):R[I++]=D[P];var F=o.tester(R);F.pts.pop(),c.push(F)}:h=function(D){c.push(o.tester(D))},k.type){case"MultiPolygon":for(b=0;b0?F.properties.ct=l(F):F.properties.ct=[NaN,NaN],R.fIn=D,R.fOut=F,c.push(F)}else r.log(["Location",R.loc,"does not have a valid GeoJSON geometry.","Traces with locationmode *geojson-id* only support","*Polygon* and *MultiPolygon* geometries."].join(" "))}delete T[B]}switch(M.type){case"FeatureCollection":var P=M.features;for(h=0;hc&&(c=_,M=b)}else M=k;return A(M).geometry.coordinates}function x(S){var k=window.PlotlyGeoAssets||{},M=[];function T(P){return new Promise(function(z,D){u.json(P,function(B,R){if(B){delete k[P];var I=B.status===404?'GeoJSON at URL "'+P+'" does not exist.':"Unexpected error while fetching from "+P;return D(new Error(I))}return k[P]=R,z(R)})})}function c(P){return new Promise(function(z,D){var B=0,R=setInterval(function(){if(k[P]&&k[P]!=="pending")return clearInterval(R),z(k[P]);if(B>100)return clearInterval(R),D("Unexpected error while fetching from "+P);B++},50)})}for(var h=0;h{var u=Ni(),d=Eo(),E=Pi(),A=gh(),t=A.stylePoints,e=A.styleText;V.exports=function(i,n){n&&r(i,n)};function r(i,n){var o=n[0].trace,a=n[0].node3;a.style("opacity",n[0].trace.opacity),t(a,o,i),e(a,o,i),a.selectAll("path.js-line").style("fill","none").each(function(s){var f=u.select(this),v=s.trace,g=v.line||{};f.call(E.stroke,g.color).call(d.dashLine,g.dash||"",g.width||0),v.fill!=="none"&&f.call(E.fill,v.fillcolor)})}}),R3=Vt((K,V)=>{var u=Ni(),d=Xr(),E=Cx().getTopojsonFeatures,A=Ud(),t=Vd(),e=Yh().findExtremes,r=ks().BADNUM,i=Uh().calcMarkerSize,n=nu(),o=B3();function a(f,v,g){var m=v.layers.frontplot.select(".scatterlayer"),w=d.makeTraceGroups(m,g,"trace scattergeo");function l(x,y){x.lonlat[0]===r&&u.select(y).remove()}w.selectAll("*").remove(),w.each(function(x){var y=u.select(this),S=x[0].trace;if(n.hasLines(S)||S.fill!=="none"){var k=A.calcTraceToLineCoords(x),M=S.fill!=="none"?A.makePolygon(k):A.makeLine(k);y.selectAll("path.js-line").data([{geojson:M,trace:S}]).enter().append("path").classed("js-line",!0).style("stroke-miterlimit",2)}n.hasMarkers(S)&&y.selectAll("path.point").data(d.identity).enter().append("path").classed("point",!0).each(function(T){l(T,this)}),n.hasText(S)&&y.selectAll("g").data(d.identity).enter().append("g").append("text").each(function(T){l(T,this)}),o(f,x)})}function s(f,v){var g=f[0].trace,m=v[g.geo],w=m._subplot,l=g._length,x,y;if(d.isArrayOrTypedArray(g.locations)){var S=g.locationmode,k=S==="geojson-id"?t.extractTraceFeature(f):E(g,w.topojson);for(x=0;x{var u=pc(),d=ks().BADNUM,E=zm(),A=Xr().fillText,t=L0();V.exports=function(r,i,n){var o=r.cd,a=o[0].trace,s=r.xa,f=r.ya,v=r.subplot,g=v.projection.isLonLatOverEdges,m=v.project;function w(T){var c=T.lonlat;if(c[0]===d||g(c))return 1/0;var h=m(c),b=m([i,n]),_=Math.abs(h[0]-b[0]),P=Math.abs(h[1]-b[1]),z=Math.max(3,T.mrc||0);return Math.max(Math.sqrt(_*_+P*P)-z,1-3/z)}if(u.getClosest(o,w,r),r.index!==!1){var l=o[r.index],x=l.lonlat,y=[s.c2p(x),f.c2p(x)],S=l.mrc||1;r.x0=y[0]-S,r.x1=y[0]+S,r.y0=y[1]-S,r.y1=y[1]+S,r.loc=l.loc,r.lon=x[0],r.lat=x[1];var k={};k[a.geo]={_subplot:v};var M=a._module.formatLabels(l,a,k);return r.lonLabel=M.lonLabel,r.latLabel=M.latLabel,r.color=E(a,l),r.extraText=e(a,l,r,o[0].t.labels),r.hovertemplate=a.hovertemplate,[r]}};function e(r,i,n,o){if(r.hovertemplate)return;var a=i.hi||r.hoverinfo,s=a==="all"?t.hoverinfo.flags:a.split("+"),f=s.indexOf("location")!==-1&&Array.isArray(r.locations),v=s.indexOf("lon")!==-1,g=s.indexOf("lat")!==-1,m=s.indexOf("text")!==-1,w=[];function l(x){return x+"°"}return f?w.push(i.loc):v&&g?w.push("("+l(n.latLabel)+", "+l(n.lonLabel)+")"):v?w.push(o.lon+l(n.lonLabel)):g&&w.push(o.lat+l(n.latLabel)),m&&A(i,r,w),w.join("
          ")}}),ME=Vt((K,V)=>{V.exports=function(u,d,E,A,t){u.lon=d.lon,u.lat=d.lat,u.location=d.loc?d.loc:null;var e=A[t];return e.fIn&&e.fIn.properties&&(u.properties=e.fIn.properties),u}}),SE=Vt((K,V)=>{var u=nu(),d=ks().BADNUM;V.exports=function(E,A){var t=E.cd,e=E.xaxis,r=E.yaxis,i=[],n=t[0].trace,o,a,s,f,v,g=!u.hasMarkers(n)&&!u.hasText(n);if(g)return[];if(A===!1)for(v=0;v{(function(u,d){d(typeof K=="object"&&typeof V<"u"?K:u.d3=u.d3||{})})(K,function(u){function d(X,Q){return XQ?1:X>=Q?0:NaN}function E(X){return X.length===1&&(X=A(X)),{left:function(Q,ut,J,q){for(J==null&&(J=0),q==null&&(q=Q.length);J>>1;X(Q[it],ut)<0?J=it+1:q=it}return J},right:function(Q,ut,J,q){for(J==null&&(J=0),q==null&&(q=Q.length);J>>1;X(Q[it],ut)>0?q=it:J=it+1}return J}}}function A(X){return function(Q,ut){return d(X(Q),ut)}}var t=E(d),e=t.right,r=t.left;function i(X,Q){Q==null&&(Q=n);for(var ut=0,J=X.length-1,q=X[0],it=new Array(J<0?0:J);utX?1:Q>=X?0:NaN}function s(X){return X===null?NaN:+X}function f(X,Q){var ut=X.length,J=0,q=-1,it=0,nt,dt,Tt=0;if(Q==null)for(;++q1)return Tt/(J-1)}function v(X,Q){var ut=f(X,Q);return ut&&Math.sqrt(ut)}function g(X,Q){var ut=X.length,J=-1,q,it,nt;if(Q==null){for(;++J=q)for(it=nt=q;++Jq&&(it=q),nt=q)for(it=nt=q;++Jq&&(it=q),nt0)return[X];if((J=Q0)for(X=Math.ceil(X/dt),Q=Math.floor(Q/dt),nt=new Array(it=Math.ceil(Q-X+1));++q=0?(it>=k?10:it>=M?5:it>=T?2:1)*Math.pow(10,q):-Math.pow(10,-q)/(it>=k?10:it>=M?5:it>=T?2:1)}function b(X,Q,ut){var J=Math.abs(Q-X)/Math.max(0,ut),q=Math.pow(10,Math.floor(Math.log(J)/Math.LN10)),it=J/q;return it>=k?q*=10:it>=M?q*=5:it>=T&&(q*=2),QIt;)Nt.pop(),--te;var Jt=new Array(te+1),ee;for(it=0;it<=te;++it)ee=Jt[it]=[],ee.x0=it>0?Nt[it-1]:Ct,ee.x1=it=1)return+ut(X[J-1],J-1,X);var J,q=(J-1)*Q,it=Math.floor(q),nt=+ut(X[it],it,X),dt=+ut(X[it+1],it+1,X);return nt+(dt-nt)*(q-it)}}function D(X,Q,ut){return X=l.call(X,s).sort(d),Math.ceil((ut-Q)/(2*(z(X,.75)-z(X,.25))*Math.pow(X.length,-1/3)))}function B(X,Q,ut){return Math.ceil((ut-Q)/(3.5*v(X)*Math.pow(X.length,-1/3)))}function R(X,Q){var ut=X.length,J=-1,q,it;if(Q==null){for(;++J=q)for(it=q;++Jit&&(it=q)}else for(;++J=q)for(it=q;++Jit&&(it=q);return it}function I(X,Q){var ut=X.length,J=ut,q=-1,it,nt=0;if(Q==null)for(;++q=0;)for(nt=X[Q],ut=nt.length;--ut>=0;)it[--q]=nt[ut];return it}function N(X,Q){var ut=X.length,J=-1,q,it;if(Q==null){for(;++J=q)for(it=q;++Jq&&(it=q)}else for(;++J=q)for(it=q;++Jq&&(it=q);return it}function G(X,Q){for(var ut=Q.length,J=new Array(ut);ut--;)J[ut]=X[Q[ut]];return J}function rt(X,Q){if(ut=X.length){var ut,J=0,q=0,it,nt=X[q];for(Q==null&&(Q=d);++J{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K,Cv()):(u=u||self,d(u.d3=u.d3||{},u.d3))})(K,function(u,d){function E(){return new A}function A(){this.reset()}A.prototype={constructor:A,reset:function(){this.s=this.t=0},add:function(Xe){e(t,Xe,this.t),e(this,t.s,this.s),this.s?this.t+=t.t:this.s=t.t},valueOf:function(){return this.s}};var t=new A;function e(Xe,yr,Kr){var Rr=Xe.s=yr+Kr,mn=Rr-yr,Pn=Rr-mn;Xe.t=yr-Pn+(Kr-mn)}var r=1e-6,i=1e-12,n=Math.PI,o=n/2,a=n/4,s=n*2,f=180/n,v=n/180,g=Math.abs,m=Math.atan,w=Math.atan2,l=Math.cos,x=Math.ceil,y=Math.exp,S=Math.log,k=Math.pow,M=Math.sin,T=Math.sign||function(Xe){return Xe>0?1:Xe<0?-1:0},c=Math.sqrt,h=Math.tan;function b(Xe){return Xe>1?0:Xe<-1?n:Math.acos(Xe)}function _(Xe){return Xe>1?o:Xe<-1?-o:Math.asin(Xe)}function P(Xe){return(Xe=M(Xe/2))*Xe}function z(){}function D(Xe,yr){Xe&&R.hasOwnProperty(Xe.type)&&R[Xe.type](Xe,yr)}var B={Feature:function(Xe,yr){D(Xe.geometry,yr)},FeatureCollection:function(Xe,yr){for(var Kr=Xe.features,Rr=-1,mn=Kr.length;++Rr=0?1:-1,mn=Rr*Kr,Pn=l(yr),ha=M(yr),Ta=Z*ha,Ua=et*Pn+Ta*l(mn),Ya=Ta*Rr*M(mn);N.add(w(Ya,Ua)),st=Xe,et=Pn,Z=ha}function q(Xe){return G.reset(),j(Xe,ot),G*2}function it(Xe){return[w(Xe[1],Xe[0]),_(Xe[2])]}function nt(Xe){var yr=Xe[0],Kr=Xe[1],Rr=l(Kr);return[Rr*l(yr),Rr*M(yr),M(Kr)]}function dt(Xe,yr){return Xe[0]*yr[0]+Xe[1]*yr[1]+Xe[2]*yr[2]}function Tt(Xe,yr){return[Xe[1]*yr[2]-Xe[2]*yr[1],Xe[2]*yr[0]-Xe[0]*yr[2],Xe[0]*yr[1]-Xe[1]*yr[0]]}function wt(Xe,yr){Xe[0]+=yr[0],Xe[1]+=yr[1],Xe[2]+=yr[2]}function Ct(Xe,yr){return[Xe[0]*yr,Xe[1]*yr,Xe[2]*yr]}function It(Xe){var yr=c(Xe[0]*Xe[0]+Xe[1]*Xe[1]+Xe[2]*Xe[2]);Xe[0]/=yr,Xe[1]/=yr,Xe[2]/=yr}var Nt,te,Jt,ee,Zt,mt,bt,vt,Ut=E(),re,Kt,ue={point:Me,lineStart:We,lineEnd:qe,polygonStart:function(){ue.point=vr,ue.lineStart=_r,ue.lineEnd=er,Ut.reset(),ot.polygonStart()},polygonEnd:function(){ot.polygonEnd(),ue.point=Me,ue.lineStart=We,ue.lineEnd=qe,N<0?(Nt=-(Jt=180),te=-(ee=90)):Ut>r?ee=90:Ut<-r&&(te=-90),Kt[0]=Nt,Kt[1]=Jt},sphere:function(){Nt=-(Jt=180),te=-(ee=90)}};function Me(Xe,yr){re.push(Kt=[Nt=Xe,Jt=Xe]),yree&&(ee=yr)}function Ce(Xe,yr){var Kr=nt([Xe*v,yr*v]);if(vt){var Rr=Tt(vt,Kr),mn=[Rr[1],-Rr[0],0],Pn=Tt(mn,Rr);It(Pn),Pn=it(Pn);var ha=Xe-Zt,Ta=ha>0?1:-1,Ua=Pn[0]*f*Ta,Ya,va=g(ha)>180;va^(Ta*Ztee&&(ee=Ya)):(Ua=(Ua+360)%360-180,va^(Ta*Ztee&&(ee=yr))),va?XeMr(Nt,Jt)&&(Jt=Xe):Mr(Xe,Jt)>Mr(Nt,Jt)&&(Nt=Xe):Jt>=Nt?(XeJt&&(Jt=Xe)):Xe>Zt?Mr(Nt,Xe)>Mr(Nt,Jt)&&(Jt=Xe):Mr(Xe,Jt)>Mr(Nt,Jt)&&(Nt=Xe)}else re.push(Kt=[Nt=Xe,Jt=Xe]);yree&&(ee=yr),vt=Kr,Zt=Xe}function We(){ue.point=Ce}function qe(){Kt[0]=Nt,Kt[1]=Jt,ue.point=Me,vt=null}function vr(Xe,yr){if(vt){var Kr=Xe-Zt;Ut.add(g(Kr)>180?Kr+(Kr>0?360:-360):Kr)}else mt=Xe,bt=yr;ot.point(Xe,yr),Ce(Xe,yr)}function _r(){ot.lineStart()}function er(){vr(mt,bt),ot.lineEnd(),g(Ut)>r&&(Nt=-(Jt=180)),Kt[0]=Nt,Kt[1]=Jt,vt=null}function Mr(Xe,yr){return(yr-=Xe)<0?yr+360:yr}function Ir(Xe,yr){return Xe[0]-yr[0]}function de(Xe,yr){return Xe[0]<=Xe[1]?Xe[0]<=yr&&yr<=Xe[1]:yrMr(Rr[0],Rr[1])&&(Rr[1]=mn[1]),Mr(mn[0],Rr[1])>Mr(Rr[0],Rr[1])&&(Rr[0]=mn[0])):Pn.push(Rr=mn);for(ha=-1/0,Kr=Pn.length-1,yr=0,Rr=Pn[Kr];yr<=Kr;Rr=mn,++yr)mn=Pn[yr],(Ta=Mr(Rr[1],mn[0]))>ha&&(ha=Ta,Nt=mn[0],Jt=Rr[1])}return re=Kt=null,Nt===1/0||te===1/0?[[NaN,NaN],[NaN,NaN]]:[[Nt,te],[Jt,ee]]}var qt,_t,lt,yt,St,Ht,Yt,se,ke,Ee,Ue,ir,ar,Ye,Er,pn,dn={sphere:z,point:bn,lineStart:En,lineEnd:ra,polygonStart:function(){dn.lineStart=Se,dn.lineEnd=Re},polygonEnd:function(){dn.lineStart=En,dn.lineEnd=ra}};function bn(Xe,yr){Xe*=v,yr*=v;var Kr=l(yr);Zn(Kr*l(Xe),Kr*M(Xe),M(yr))}function Zn(Xe,yr,Kr){++qt,lt+=(Xe-lt)/qt,yt+=(yr-yt)/qt,St+=(Kr-St)/qt}function En(){dn.point=gn}function gn(Xe,yr){Xe*=v,yr*=v;var Kr=l(yr);Ye=Kr*l(Xe),Er=Kr*M(Xe),pn=M(yr),dn.point=da,Zn(Ye,Er,pn)}function da(Xe,yr){Xe*=v,yr*=v;var Kr=l(yr),Rr=Kr*l(Xe),mn=Kr*M(Xe),Pn=M(yr),ha=w(c((ha=Er*Pn-pn*mn)*ha+(ha=pn*Rr-Ye*Pn)*ha+(ha=Ye*mn-Er*Rr)*ha),Ye*Rr+Er*mn+pn*Pn);_t+=ha,Ht+=ha*(Ye+(Ye=Rr)),Yt+=ha*(Er+(Er=mn)),se+=ha*(pn+(pn=Pn)),Zn(Ye,Er,pn)}function ra(){dn.point=bn}function Se(){dn.point=Ze}function Re(){tr(ir,ar),dn.point=bn}function Ze(Xe,yr){ir=Xe,ar=yr,Xe*=v,yr*=v,dn.point=tr;var Kr=l(yr);Ye=Kr*l(Xe),Er=Kr*M(Xe),pn=M(yr),Zn(Ye,Er,pn)}function tr(Xe,yr){Xe*=v,yr*=v;var Kr=l(yr),Rr=Kr*l(Xe),mn=Kr*M(Xe),Pn=M(yr),ha=Er*Pn-pn*mn,Ta=pn*Rr-Ye*Pn,Ua=Ye*mn-Er*Rr,Ya=c(ha*ha+Ta*Ta+Ua*Ua),va=_(Ya),Ba=Ya&&-va/Ya;ke+=Ba*ha,Ee+=Ba*Ta,Ue+=Ba*Ua,_t+=va,Ht+=va*(Ye+(Ye=Rr)),Yt+=va*(Er+(Er=mn)),se+=va*(pn+(pn=Pn)),Zn(Ye,Er,pn)}function zr(Xe){qt=_t=lt=yt=St=Ht=Yt=se=ke=Ee=Ue=0,j(Xe,dn);var yr=ke,Kr=Ee,Rr=Ue,mn=yr*yr+Kr*Kr+Rr*Rr;return mnn?Xe+Math.round(-Xe/s)*s:Xe,yr]}$r.invert=$r;function In(Xe,yr,Kr){return(Xe%=s)?yr||Kr?Yr(Kn(Xe),$n(yr,Kr)):Kn(Xe):yr||Kr?$n(yr,Kr):$r}function Nn(Xe){return function(yr,Kr){return yr+=Xe,[yr>n?yr-s:yr<-n?yr+s:yr,Kr]}}function Kn(Xe){var yr=Nn(Xe);return yr.invert=Nn(-Xe),yr}function $n(Xe,yr){var Kr=l(Xe),Rr=M(Xe),mn=l(yr),Pn=M(yr);function ha(Ta,Ua){var Ya=l(Ua),va=l(Ta)*Ya,Ba=M(Ta)*Ya,za=M(Ua),ca=za*Kr+va*Rr;return[w(Ba*mn-ca*Pn,va*Kr-za*Rr),_(ca*mn+Ba*Pn)]}return ha.invert=function(Ta,Ua){var Ya=l(Ua),va=l(Ta)*Ya,Ba=M(Ta)*Ya,za=M(Ua),ca=za*mn-Ba*Pn;return[w(Ba*mn+za*Pn,va*Kr+ca*Rr),_(ca*Kr-va*Rr)]},ha}function ia(Xe){Xe=In(Xe[0]*v,Xe[1]*v,Xe.length>2?Xe[2]*v:0);function yr(Kr){return Kr=Xe(Kr[0]*v,Kr[1]*v),Kr[0]*=f,Kr[1]*=f,Kr}return yr.invert=function(Kr){return Kr=Xe.invert(Kr[0]*v,Kr[1]*v),Kr[0]*=f,Kr[1]*=f,Kr},yr}function Cn(Xe,yr,Kr,Rr,mn,Pn){if(Kr){var ha=l(yr),Ta=M(yr),Ua=Rr*Kr;mn==null?(mn=yr+Rr*s,Pn=yr-Ua/2):(mn=Fa(ha,mn),Pn=Fa(ha,Pn),(Rr>0?mnPn)&&(mn+=Rr*s));for(var Ya,va=mn;Rr>0?va>Pn:va1&&Xe.push(Xe.pop().concat(Xe.shift()))},result:function(){var Kr=Xe;return Xe=[],yr=null,Kr}}}function ge(Xe,yr){return g(Xe[0]-yr[0])=0;--Ta)mn.point((Ba=va[Ta])[0],Ba[1]);else Rr(za.x,za.p.x,-1,mn);za=za.p}za=za.o,va=za.z,ca=!ca}while(!za.v);mn.lineEnd()}}}function Tr(Xe){if(yr=Xe.length){for(var yr,Kr=0,Rr=Xe[0],mn;++Kr=0?1:-1,ys=Ps*ss,Os=ys>n,Yo=Vi*$i;if(mr.add(w(Yo*Ps*M(ys),Oi*Do+Yo*l(ys))),ha+=Os?ss+Ps*s:ss,Os^ca>=Kr^ni>=Kr){var ll=Tt(nt(za),nt(Xi));It(ll);var el=Tt(Pn,ll);It(el);var Rs=(Os^ss>=0?-1:1)*_(el[2]);(Rr>Rs||Rr===Rs&&(ll[0]||ll[1]))&&(Ta+=Os^ss>=0?1:-1)}}return(ha<-r||ha0){for(Ua||(mn.polygonStart(),Ua=!0),mn.lineStart(),Do=0;Do1&&Za&2&&$i.push($i.pop().concat($i.shift())),va.push($i.filter(pe))}}return za}}function pe(Xe){return Xe.length>1}function Ke(Xe,yr){return((Xe=Xe.x)[0]<0?Xe[1]-o-r:o-Xe[1])-((yr=yr.x)[0]<0?yr[1]-o-r:o-yr[1])}var xr=Or(function(){return!0},Gr,wn,[-n,-o]);function Gr(Xe){var yr=NaN,Kr=NaN,Rr=NaN,mn;return{lineStart:function(){Xe.lineStart(),mn=1},point:function(Pn,ha){var Ta=Pn>0?n:-n,Ua=g(Pn-yr);g(Ua-n)0?o:-o),Xe.point(Rr,Kr),Xe.lineEnd(),Xe.lineStart(),Xe.point(Ta,Kr),Xe.point(Pn,Kr),mn=0):Rr!==Ta&&Ua>=n&&(g(yr-Rr)r?m((M(yr)*(Pn=l(Rr))*M(Kr)-M(Rr)*(mn=l(yr))*M(Xe))/(mn*Pn*ha)):(yr+Rr)/2}function wn(Xe,yr,Kr,Rr){var mn;if(Xe==null)mn=Kr*o,Rr.point(-n,mn),Rr.point(0,mn),Rr.point(n,mn),Rr.point(n,0),Rr.point(n,-mn),Rr.point(0,-mn),Rr.point(-n,-mn),Rr.point(-n,0),Rr.point(-n,mn);else if(g(Xe[0]-yr[0])>r){var Pn=Xe[0]0,mn=g(yr)>r;function Pn(va,Ba,za,ca){Cn(ca,Xe,Kr,za,va,Ba)}function ha(va,Ba){return l(va)*l(Ba)>yr}function Ta(va){var Ba,za,ca,ei,Vi;return{lineStart:function(){ei=ca=!1,Vi=1},point:function(Oi,Wi){var Xi=[Oi,Wi],ni,Za=ha(Oi,Wi),$i=Rr?Za?0:Ya(Oi,Wi):Za?Ya(Oi+(Oi<0?n:-n),Wi):0;if(!Ba&&(ei=ca=Za)&&va.lineStart(),Za!==ca&&(ni=Ua(Ba,Xi),(!ni||ge(Ba,ni)||ge(Xi,ni))&&(Xi[2]=1)),Za!==ca)Vi=0,Za?(va.lineStart(),ni=Ua(Xi,Ba),va.point(ni[0],ni[1])):(ni=Ua(Ba,Xi),va.point(ni[0],ni[1],2),va.lineEnd()),Ba=ni;else if(mn&&Ba&&Rr^Za){var Do;!($i&za)&&(Do=Ua(Xi,Ba,!0))&&(Vi=0,Rr?(va.lineStart(),va.point(Do[0][0],Do[0][1]),va.point(Do[1][0],Do[1][1]),va.lineEnd()):(va.point(Do[1][0],Do[1][1]),va.lineEnd(),va.lineStart(),va.point(Do[0][0],Do[0][1],3)))}Za&&(!Ba||!ge(Ba,Xi))&&va.point(Xi[0],Xi[1]),Ba=Xi,ca=Za,za=$i},lineEnd:function(){ca&&va.lineEnd(),Ba=null},clean:function(){return Vi|(ei&&ca)<<1}}}function Ua(va,Ba,za){var ca=nt(va),ei=nt(Ba),Vi=[1,0,0],Oi=Tt(ca,ei),Wi=dt(Oi,Oi),Xi=Oi[0],ni=Wi-Xi*Xi;if(!ni)return!za&&va;var Za=yr*Wi/ni,$i=-yr*Xi/ni,Do=Tt(Vi,Oi),ss=Ct(Vi,Za),Ps=Ct(Oi,$i);wt(ss,Ps);var ys=Do,Os=dt(ss,ys),Yo=dt(ys,ys),ll=Os*Os-Yo*(dt(ss,ss)-1);if(!(ll<0)){var el=c(ll),Rs=Ct(ys,(-Os-el)/Yo);if(wt(Rs,ss),Rs=it(Rs),!za)return Rs;var bi=va[0],so=Ba[0],ws=va[1],fs=Ba[1],Ll;so0^Rs[1]<(g(Rs[0]-bi)n^(bi<=Rs[0]&&Rs[0]<=so)){var Jl=Ct(ys,(-Os+el)/Yo);return wt(Jl,ss),[Rs,it(Jl)]}}}function Ya(va,Ba){var za=Rr?Xe:n-Xe,ca=0;return va<-za?ca|=1:va>za&&(ca|=2),Ba<-za?ca|=4:Ba>za&&(ca|=8),ca}return Or(ha,Ta,Pn,Rr?[0,-Xe]:[-n,Xe-n])}function Qr(Xe,yr,Kr,Rr,mn,Pn){var ha=Xe[0],Ta=Xe[1],Ua=yr[0],Ya=yr[1],va=0,Ba=1,za=Ua-ha,ca=Ya-Ta,ei;if(ei=Kr-ha,!(!za&&ei>0)){if(ei/=za,za<0){if(ei0){if(ei>Ba)return;ei>va&&(va=ei)}if(ei=mn-ha,!(!za&&ei<0)){if(ei/=za,za<0){if(ei>Ba)return;ei>va&&(va=ei)}else if(za>0){if(ei0)){if(ei/=ca,ca<0){if(ei0){if(ei>Ba)return;ei>va&&(va=ei)}if(ei=Pn-Ta,!(!ca&&ei<0)){if(ei/=ca,ca<0){if(ei>Ba)return;ei>va&&(va=ei)}else if(ca>0){if(ei0&&(Xe[0]=ha+va*za,Xe[1]=Ta+va*ca),Ba<1&&(yr[0]=ha+Ba*za,yr[1]=Ta+Ba*ca),!0}}}}}var vn=1e9,Oa=-vn;function Qn(Xe,yr,Kr,Rr){function mn(Ya,va){return Xe<=Ya&&Ya<=Kr&&yr<=va&&va<=Rr}function Pn(Ya,va,Ba,za){var ca=0,ei=0;if(Ya==null||(ca=ha(Ya,Ba))!==(ei=ha(va,Ba))||Ua(Ya,va)<0^Ba>0)do za.point(ca===0||ca===3?Xe:Kr,ca>1?Rr:yr);while((ca=(ca+Ba+4)%4)!==ei);else za.point(va[0],va[1])}function ha(Ya,va){return g(Ya[0]-Xe)0?0:3:g(Ya[0]-Kr)0?2:1:g(Ya[1]-yr)0?1:0:va>0?3:2}function Ta(Ya,va){return Ua(Ya.x,va.x)}function Ua(Ya,va){var Ba=ha(Ya,1),za=ha(va,1);return Ba!==za?Ba-za:Ba===0?va[1]-Ya[1]:Ba===1?Ya[0]-va[0]:Ba===2?Ya[1]-va[1]:va[0]-Ya[0]}return function(Ya){var va=Ya,Ba=ve(),za,ca,ei,Vi,Oi,Wi,Xi,ni,Za,$i,Do,ss={point:Ps,lineStart:ll,lineEnd:el,polygonStart:Os,polygonEnd:Yo};function Ps(bi,so){mn(bi,so)&&va.point(bi,so)}function ys(){for(var bi=0,so=0,ws=ca.length;soRr&&(Ru-Bu)*(Rr-Jl)>(nl-Jl)*(Xe-Bu)&&++bi:nl<=Rr&&(Ru-Bu)*(Rr-Jl)<(nl-Jl)*(Xe-Bu)&&--bi;return bi}function Os(){va=Ba,za=[],ca=[],Do=!0}function Yo(){var bi=ys(),so=Do&&bi,ws=(za=d.merge(za)).length;(so||ws)&&(Ya.polygonStart(),so&&(Ya.lineStart(),Pn(null,null,1,Ya),Ya.lineEnd()),ws&&br(za,Ta,bi,Pn,Ya),Ya.polygonEnd()),va=Ya,za=ca=ei=null}function ll(){ss.point=Rs,ca&&ca.push(ei=[]),$i=!0,Za=!1,Xi=ni=NaN}function el(){za&&(Rs(Vi,Oi),Wi&&Za&&Ba.rejoin(),za.push(Ba.result())),ss.point=Ps,Za&&va.lineEnd()}function Rs(bi,so){var ws=mn(bi,so);if(ca&&ei.push([bi,so]),$i)Vi=bi,Oi=so,Wi=ws,$i=!1,ws&&(va.lineStart(),va.point(bi,so));else if(ws&&Za)va.point(bi,so);else{var fs=[Xi=Math.max(Oa,Math.min(vn,Xi)),ni=Math.max(Oa,Math.min(vn,ni))],Ll=[bi=Math.max(Oa,Math.min(vn,bi)),so=Math.max(Oa,Math.min(vn,so))];Qr(fs,Ll,Xe,yr,Kr,Rr)?(Za||(va.lineStart(),va.point(fs[0],fs[1])),va.point(Ll[0],Ll[1]),ws||va.lineEnd(),Do=!1):ws&&(va.lineStart(),va.point(bi,so),Do=!1)}Xi=bi,ni=so,Za=ws}return ss}}function Qa(){var Xe=0,yr=0,Kr=960,Rr=500,mn,Pn,ha;return ha={stream:function(Ta){return mn&&Pn===Ta?mn:mn=Qn(Xe,yr,Kr,Rr)(Pn=Ta)},extent:function(Ta){return arguments.length?(Xe=+Ta[0][0],yr=+Ta[0][1],Kr=+Ta[1][0],Rr=+Ta[1][1],mn=Pn=null,ha):[[Xe,yr],[Kr,Rr]]}}}var Ja=E(),wi,ci,Ti,Ra={sphere:z,point:z,lineStart:Qi,lineEnd:z,polygonStart:z,polygonEnd:z};function Qi(){Ra.point=Ho,Ra.lineEnd=Hi}function Hi(){Ra.point=Ra.lineEnd=z}function Ho(Xe,yr){Xe*=v,yr*=v,wi=Xe,ci=M(yr),Ti=l(yr),Ra.point=Ci}function Ci(Xe,yr){Xe*=v,yr*=v;var Kr=M(yr),Rr=l(yr),mn=g(Xe-wi),Pn=l(mn),ha=M(mn),Ta=Rr*ha,Ua=Ti*Kr-ci*Rr*Pn,Ya=ci*Kr+Ti*Rr*Pn;Ja.add(w(c(Ta*Ta+Ua*Ua),Ya)),wi=Xe,ci=Kr,Ti=Rr}function zo(Xe){return Ja.reset(),j(Xe,Ra),+Ja}var qi=[null,null],qo={type:"LineString",coordinates:qi};function Po(Xe,yr){return qi[0]=Xe,qi[1]=yr,zo(qo)}var hs={Feature:function(Xe,yr){return uo(Xe.geometry,yr)},FeatureCollection:function(Xe,yr){for(var Kr=Xe.features,Rr=-1,mn=Kr.length;++Rr0&&(mn=Po(Xe[Pn],Xe[Pn-1]),mn>0&&Kr<=mn&&Rr<=mn&&(Kr+Rr-mn)*(1-Math.pow((Kr-Rr)/mn,2))r}).map(za)).concat(d.range(x(Pn/Ya)*Ya,mn,Ya).filter(function(ni){return g(ni%Ba)>r}).map(ca))}return Wi.lines=function(){return Xi().map(function(ni){return{type:"LineString",coordinates:ni}})},Wi.outline=function(){return{type:"Polygon",coordinates:[ei(Rr).concat(Vi(ha).slice(1),ei(Kr).reverse().slice(1),Vi(Ta).reverse().slice(1))]}},Wi.extent=function(ni){return arguments.length?Wi.extentMajor(ni).extentMinor(ni):Wi.extentMinor()},Wi.extentMajor=function(ni){return arguments.length?(Rr=+ni[0][0],Kr=+ni[1][0],Ta=+ni[0][1],ha=+ni[1][1],Rr>Kr&&(ni=Rr,Rr=Kr,Kr=ni),Ta>ha&&(ni=Ta,Ta=ha,ha=ni),Wi.precision(Oi)):[[Rr,Ta],[Kr,ha]]},Wi.extentMinor=function(ni){return arguments.length?(yr=+ni[0][0],Xe=+ni[1][0],Pn=+ni[0][1],mn=+ni[1][1],yr>Xe&&(ni=yr,yr=Xe,Xe=ni),Pn>mn&&(ni=Pn,Pn=mn,mn=ni),Wi.precision(Oi)):[[yr,Pn],[Xe,mn]]},Wi.step=function(ni){return arguments.length?Wi.stepMajor(ni).stepMinor(ni):Wi.stepMinor()},Wi.stepMajor=function(ni){return arguments.length?(va=+ni[0],Ba=+ni[1],Wi):[va,Ba]},Wi.stepMinor=function(ni){return arguments.length?(Ua=+ni[0],Ya=+ni[1],Wi):[Ua,Ya]},Wi.precision=function(ni){return arguments.length?(Oi=+ni,za=Da(Pn,mn,90),ca=li(yr,Xe,Oi),ei=Da(Ta,ha,90),Vi=li(Rr,Kr,Oi),Wi):Oi},Wi.extentMajor([[-180,-90+r],[180,90-r]]).extentMinor([[-180,-80-r],[180,80+r]])}function Ms(){return wo()()}function Di(Xe,yr){var Kr=Xe[0]*v,Rr=Xe[1]*v,mn=yr[0]*v,Pn=yr[1]*v,ha=l(Rr),Ta=M(Rr),Ua=l(Pn),Ya=M(Pn),va=ha*l(Kr),Ba=ha*M(Kr),za=Ua*l(mn),ca=Ua*M(mn),ei=2*_(c(P(Pn-Rr)+ha*Ua*P(mn-Kr))),Vi=M(ei),Oi=ei?function(Wi){var Xi=M(Wi*=ei)/Vi,ni=M(ei-Wi)/Vi,Za=ni*va+Xi*za,$i=ni*Ba+Xi*ca,Do=ni*Ta+Xi*Ya;return[w($i,Za)*f,w(Do,c(Za*Za+$i*$i))*f]}:function(){return[Kr*f,Rr*f]};return Oi.distance=ei,Oi}function _s(Xe){return Xe}var No=E(),is=E(),al,ii,io,co,Is={point:z,lineStart:z,lineEnd:z,polygonStart:function(){Is.lineStart=Wo,Is.lineEnd=fl},polygonEnd:function(){Is.lineStart=Is.lineEnd=Is.point=z,No.add(g(is)),is.reset()},result:function(){var Xe=No/2;return No.reset(),Xe}};function Wo(){Is.point=Bi}function Bi(Xe,yr){Is.point=$s,al=io=Xe,ii=co=yr}function $s(Xe,yr){is.add(co*Xe-io*yr),io=Xe,co=yr}function fl(){$s(al,ii)}var Jo=1/0,us=Jo,Ss=-Jo,Ls=Ss,xl={point:bu,lineStart:z,lineEnd:z,polygonStart:z,polygonEnd:z,result:function(){var Xe=[[Jo,us],[Ss,Ls]];return Ss=Ls=-(us=Jo=1/0),Xe}};function bu(Xe,yr){XeSs&&(Ss=Xe),yrLs&&(Ls=yr)}var au=0,fu=0,zc=0,_c=0,cs=0,Gl=0,Lc=0,Al=0,_l=0,Ml,hu,Fs,bl,Fo={point:bs,lineStart:Iu,lineEnd:qs,polygonStart:function(){Fo.lineStart=sf,Fo.lineEnd=Oo},polygonEnd:function(){Fo.point=bs,Fo.lineStart=Iu,Fo.lineEnd=qs},result:function(){var Xe=_l?[Lc/_l,Al/_l]:Gl?[_c/Gl,cs/Gl]:zc?[au/zc,fu/zc]:[NaN,NaN];return au=fu=zc=_c=cs=Gl=Lc=Al=_l=0,Xe}};function bs(Xe,yr){au+=Xe,fu+=yr,++zc}function Iu(){Fo.point=Nl}function Nl(Xe,yr){Fo.point=qu,bs(Fs=Xe,bl=yr)}function qu(Xe,yr){var Kr=Xe-Fs,Rr=yr-bl,mn=c(Kr*Kr+Rr*Rr);_c+=mn*(Fs+Xe)/2,cs+=mn*(bl+yr)/2,Gl+=mn,bs(Fs=Xe,bl=yr)}function qs(){Fo.point=bs}function sf(){Fo.point=yf}function Oo(){os(Ml,hu)}function yf(Xe,yr){Fo.point=os,bs(Ml=Fs=Xe,hu=bl=yr)}function os(Xe,yr){var Kr=Xe-Fs,Rr=yr-bl,mn=c(Kr*Kr+Rr*Rr);_c+=mn*(Fs+Xe)/2,cs+=mn*(bl+yr)/2,Gl+=mn,mn=bl*Xe-Fs*yr,Lc+=mn*(Fs+Xe),Al+=mn*(bl+yr),_l+=mn*3,bs(Fs=Xe,bl=yr)}function Fi(Xe){this._context=Xe}Fi.prototype={_radius:4.5,pointRadius:function(Xe){return this._radius=Xe,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(Xe,yr){switch(this._point){case 0:{this._context.moveTo(Xe,yr),this._point=1;break}case 1:{this._context.lineTo(Xe,yr);break}default:{this._context.moveTo(Xe+this._radius,yr),this._context.arc(Xe,yr,this._radius,0,s);break}}},result:z};var ac=E(),pu,ml,Cc,Wu,mc,wl={point:z,lineStart:function(){wl.point=Xc},lineEnd:function(){pu&&Bc(ml,Cc),wl.point=z},polygonStart:function(){pu=!0},polygonEnd:function(){pu=null},result:function(){var Xe=+ac;return ac.reset(),Xe}};function Xc(Xe,yr){wl.point=Bc,ml=Wu=Xe,Cc=mc=yr}function Bc(Xe,yr){Wu-=Xe,mc-=yr,ac.add(c(Wu*Wu+mc*mc)),Wu=Xe,mc=yr}function gc(){this._string=[]}gc.prototype={_radius:4.5,_circle:Gu(4.5),pointRadius:function(Xe){return(Xe=+Xe)!==this._radius&&(this._radius=Xe,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(Xe,yr){switch(this._point){case 0:{this._string.push("M",Xe,",",yr),this._point=1;break}case 1:{this._string.push("L",Xe,",",yr);break}default:{this._circle==null&&(this._circle=Gu(this._radius)),this._string.push("M",Xe,",",yr,this._circle);break}}},result:function(){if(this._string.length){var Xe=this._string.join("");return this._string=[],Xe}else return null}};function Gu(Xe){return"m0,"+Xe+"a"+Xe+","+Xe+" 0 1,1 0,"+-2*Xe+"a"+Xe+","+Xe+" 0 1,1 0,"+2*Xe+"z"}function Ic(Xe,yr){var Kr=4.5,Rr,mn;function Pn(ha){return ha&&(typeof Kr=="function"&&mn.pointRadius(+Kr.apply(this,arguments)),j(ha,Rr(mn))),mn.result()}return Pn.area=function(ha){return j(ha,Rr(Is)),Is.result()},Pn.measure=function(ha){return j(ha,Rr(wl)),wl.result()},Pn.bounds=function(ha){return j(ha,Rr(xl)),xl.result()},Pn.centroid=function(ha){return j(ha,Rr(Fo)),Fo.result()},Pn.projection=function(ha){return arguments.length?(Rr=ha==null?(Xe=null,_s):(Xe=ha).stream,Pn):Xe},Pn.context=function(ha){return arguments.length?(mn=ha==null?(yr=null,new gc):new Fi(yr=ha),typeof Kr!="function"&&mn.pointRadius(Kr),Pn):yr},Pn.pointRadius=function(ha){return arguments.length?(Kr=typeof ha=="function"?ha:(mn.pointRadius(+ha),+ha),Pn):Kr},Pn.projection(Xe).context(yr)}function Pc(Xe){return{stream:du(Xe)}}function du(Xe){return function(yr){var Kr=new Rc;for(var Rr in Xe)Kr[Rr]=Xe[Rr];return Kr.stream=yr,Kr}}function Rc(){}Rc.prototype={constructor:Rc,point:function(Xe,yr){this.stream.point(Xe,yr)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Pu(Xe,yr,Kr){var Rr=Xe.clipExtent&&Xe.clipExtent();return Xe.scale(150).translate([0,0]),Rr!=null&&Xe.clipExtent(null),j(Kr,Xe.stream(xl)),yr(xl.result()),Rr!=null&&Xe.clipExtent(Rr),Xe}function wu(Xe,yr,Kr){return Pu(Xe,function(Rr){var mn=yr[1][0]-yr[0][0],Pn=yr[1][1]-yr[0][1],ha=Math.min(mn/(Rr[1][0]-Rr[0][0]),Pn/(Rr[1][1]-Rr[0][1])),Ta=+yr[0][0]+(mn-ha*(Rr[1][0]+Rr[0][0]))/2,Ua=+yr[0][1]+(Pn-ha*(Rr[1][1]+Rr[0][1]))/2;Xe.scale(150*ha).translate([Ta,Ua])},Kr)}function Tl(Xe,yr,Kr){return wu(Xe,[[0,0],yr],Kr)}function Qu(Xe,yr,Kr){return Pu(Xe,function(Rr){var mn=+yr,Pn=mn/(Rr[1][0]-Rr[0][0]),ha=(mn-Pn*(Rr[1][0]+Rr[0][0]))/2,Ta=-Pn*Rr[0][1];Xe.scale(150*Pn).translate([ha,Ta])},Kr)}function Oc(Xe,yr,Kr){return Pu(Xe,function(Rr){var mn=+yr,Pn=mn/(Rr[1][1]-Rr[0][1]),ha=-Pn*Rr[0][0],Ta=(mn-Pn*(Rr[1][1]+Rr[0][1]))/2;Xe.scale(150*Pn).translate([ha,Ta])},Kr)}var Es=16,bc=l(30*v);function lf(Xe,yr){return+yr?vc(Xe,yr):Nc(Xe)}function Nc(Xe){return du({point:function(yr,Kr){yr=Xe(yr,Kr),this.stream.point(yr[0],yr[1])}})}function vc(Xe,yr){function Kr(Rr,mn,Pn,ha,Ta,Ua,Ya,va,Ba,za,ca,ei,Vi,Oi){var Wi=Ya-Rr,Xi=va-mn,ni=Wi*Wi+Xi*Xi;if(ni>4*yr&&Vi--){var Za=ha+za,$i=Ta+ca,Do=Ua+ei,ss=c(Za*Za+$i*$i+Do*Do),Ps=_(Do/=ss),ys=g(g(Do)-1)yr||g((Wi*el+Xi*Rs)/ni-.5)>.3||ha*za+Ta*ca+Ua*ei2?bi[2]%360*v:0,el()):[Ta*f,Ua*f,Ya*f]},Yo.angle=function(bi){return arguments.length?(Ba=bi%360*v,el()):Ba*f},Yo.reflectX=function(bi){return arguments.length?(za=bi?-1:1,el()):za<0},Yo.reflectY=function(bi){return arguments.length?(ca=bi?-1:1,el()):ca<0},Yo.precision=function(bi){return arguments.length?(Do=lf(ss,$i=bi*bi),Rs()):c($i)},Yo.fitExtent=function(bi,so){return wu(Yo,bi,so)},Yo.fitSize=function(bi,so){return Tl(Yo,bi,so)},Yo.fitWidth=function(bi,so){return Qu(Yo,bi,so)},Yo.fitHeight=function(bi,so){return Oc(Yo,bi,so)};function el(){var bi=rl(Kr,0,0,za,ca,Ba).apply(null,yr(Pn,ha)),so=(Ba?rl:Uc)(Kr,Rr-bi[0],mn-bi[1],za,ca,Ba);return va=In(Ta,Ua,Ya),ss=Yr(yr,so),Ps=Yr(va,ss),Do=lf(ss,$i),Rs()}function Rs(){return ys=Os=null,Yo}return function(){return yr=Xe.apply(this,arguments),Yo.invert=yr.invert&&ll,el()}}function Bs(Xe){var yr=0,Kr=n/3,Rr=Zu(Xe),mn=Rr(yr,Kr);return mn.parallels=function(Pn){return arguments.length?Rr(yr=Pn[0]*v,Kr=Pn[1]*v):[yr*f,Kr*f]},mn}function Ou(Xe){var yr=l(Xe);function Kr(Rr,mn){return[Rr*yr,M(mn)/yr]}return Kr.invert=function(Rr,mn){return[Rr/yr,_(mn*yr)]},Kr}function Rl(Xe,yr){var Kr=M(Xe),Rr=(Kr+M(yr))/2;if(g(Rr)=.12&&Oi<.234&&Vi>=-.425&&Vi<-.214?mn:Oi>=.166&&Oi<.234&&Vi>=-.214&&Vi<-.115?ha:Kr).invert(za)},va.stream=function(za){return Xe&&yr===za?Xe:Xe=ic([Kr.stream(yr=za),mn.stream(za),ha.stream(za)])},va.precision=function(za){return arguments.length?(Kr.precision(za),mn.precision(za),ha.precision(za),Ba()):Kr.precision()},va.scale=function(za){return arguments.length?(Kr.scale(za),mn.scale(za*.35),ha.scale(za),va.translate(Kr.translate())):Kr.scale()},va.translate=function(za){if(!arguments.length)return Kr.translate();var ca=Kr.scale(),ei=+za[0],Vi=+za[1];return Rr=Kr.translate(za).clipExtent([[ei-.455*ca,Vi-.238*ca],[ei+.455*ca,Vi+.238*ca]]).stream(Ya),Pn=mn.translate([ei-.307*ca,Vi+.201*ca]).clipExtent([[ei-.425*ca+r,Vi+.12*ca+r],[ei-.214*ca-r,Vi+.234*ca-r]]).stream(Ya),Ta=ha.translate([ei-.205*ca,Vi+.212*ca]).clipExtent([[ei-.214*ca+r,Vi+.166*ca+r],[ei-.115*ca-r,Vi+.234*ca-r]]).stream(Ya),Ba()},va.fitExtent=function(za,ca){return wu(va,za,ca)},va.fitSize=function(za,ca){return Tl(va,za,ca)},va.fitWidth=function(za,ca){return Qu(va,za,ca)},va.fitHeight=function(za,ca){return Oc(va,za,ca)};function Ba(){return Xe=yr=null,va}return va.scale(1070)}function Ku(Xe){return function(yr,Kr){var Rr=l(yr),mn=l(Kr),Pn=Xe(Rr*mn);return[Pn*mn*M(yr),Pn*M(Kr)]}}function wc(Xe){return function(yr,Kr){var Rr=c(yr*yr+Kr*Kr),mn=Xe(Rr),Pn=M(mn),ha=l(mn);return[w(yr*Pn,Rr*ha),_(Rr&&Kr*Pn/Rr)]}}var uf=Ku(function(Xe){return c(2/(1+Xe))});uf.invert=wc(function(Xe){return 2*_(Xe/2)});function Sf(){return Kl(uf).scale(124.75).clipAngle(180-.001)}var oc=Ku(function(Xe){return(Xe=b(Xe))&&Xe/M(Xe)});oc.invert=wc(function(Xe){return Xe});function Tc(){return Kl(oc).scale(79.4188).clipAngle(180-.001)}function Fl(Xe,yr){return[Xe,S(h((o+yr)/2))]}Fl.invert=function(Xe,yr){return[Xe,2*m(y(yr))-o]};function sc(){return iu(Fl).scale(961/s)}function iu(Xe){var yr=Kl(Xe),Kr=yr.center,Rr=yr.scale,mn=yr.translate,Pn=yr.clipExtent,ha=null,Ta,Ua,Ya;yr.scale=function(Ba){return arguments.length?(Rr(Ba),va()):Rr()},yr.translate=function(Ba){return arguments.length?(mn(Ba),va()):mn()},yr.center=function(Ba){return arguments.length?(Kr(Ba),va()):Kr()},yr.clipExtent=function(Ba){return arguments.length?(Ba==null?ha=Ta=Ua=Ya=null:(ha=+Ba[0][0],Ta=+Ba[0][1],Ua=+Ba[1][0],Ya=+Ba[1][1]),va()):ha==null?null:[[ha,Ta],[Ua,Ya]]};function va(){var Ba=n*Rr(),za=yr(ia(yr.rotate()).invert([0,0]));return Pn(ha==null?[[za[0]-Ba,za[1]-Ba],[za[0]+Ba,za[1]+Ba]]:Xe===Fl?[[Math.max(za[0]-Ba,ha),Ta],[Math.min(za[0]+Ba,Ua),Ya]]:[[ha,Math.max(za[1]-Ba,Ta)],[Ua,Math.min(za[1]+Ba,Ya)]])}return va()}function lc(Xe){return h((o+Xe)/2)}function kc(Xe,yr){var Kr=l(Xe),Rr=Xe===yr?M(Xe):S(Kr/l(yr))/S(lc(yr)/lc(Xe)),mn=Kr*k(lc(Xe),Rr)/Rr;if(!Rr)return Fl;function Pn(ha,Ta){mn>0?Ta<-o+r&&(Ta=-o+r):Ta>o-r&&(Ta=o-r);var Ua=mn/k(lc(Ta),Rr);return[Ua*M(Rr*ha),mn-Ua*l(Rr*ha)]}return Pn.invert=function(ha,Ta){var Ua=mn-Ta,Ya=T(Rr)*c(ha*ha+Ua*Ua),va=w(ha,g(Ua))*T(Ua);return Ua*Rr<0&&(va-=n*T(ha)*T(Ua)),[va/Rr,2*m(k(mn/Ya,1/Rr))-o]},Pn}function ku(){return Bs(kc).scale(109.5).parallels([30,30])}function Gs(Xe,yr){return[Xe,yr]}Gs.invert=Gs;function Du(){return Kl(Gs).scale(152.63)}function Xl(Xe,yr){var Kr=l(Xe),Rr=Xe===yr?M(Xe):(Kr-l(yr))/(yr-Xe),mn=Kr/Rr+Xe;if(g(Rr)r&&--Rr>0);return[Xe/(.8707+(Pn=Kr*Kr)*(-.131979+Pn*(-.013791+Pn*Pn*Pn*(.003971-.001529*Pn)))),Kr]};function Au(){return Kl(Fu).scale(175.295)}function il(Xe,yr){return[l(yr)*M(Xe),M(yr)]}il.invert=wc(_);function Cs(){return Kl(il).scale(249.5).clipAngle(90+r)}function Mu(Xe,yr){var Kr=l(yr),Rr=1+l(Xe)*Kr;return[Kr*M(Xe)/Rr,M(yr)/Rr]}Mu.invert=wc(function(Xe){return 2*m(Xe)});function uc(){return Kl(Mu).scale(250).clipAngle(142)}function Su(Xe,yr){return[S(h((o+yr)/2)),-Xe]}Su.invert=function(Xe,yr){return[-yr,2*m(y(Xe))-o]};function Dc(){var Xe=iu(Su),yr=Xe.center,Kr=Xe.rotate;return Xe.center=function(Rr){return arguments.length?yr([-Rr[1],Rr[0]]):(Rr=yr(),[Rr[1],-Rr[0]])},Xe.rotate=function(Rr){return arguments.length?Kr([Rr[0],Rr[1],Rr.length>2?Rr[2]+90:90]):(Rr=Kr(),[Rr[0],Rr[1],Rr[2]-90])},Kr([0,0,90]).scale(159.155)}u.geoAlbers=Ws,u.geoAlbersUsa=Tu,u.geoArea=q,u.geoAzimuthalEqualArea=Sf,u.geoAzimuthalEqualAreaRaw=uf,u.geoAzimuthalEquidistant=Tc,u.geoAzimuthalEquidistantRaw=oc,u.geoBounds=Dt,u.geoCentroid=zr,u.geoCircle=Ga,u.geoClipAntimeridian=xr,u.geoClipCircle=rn,u.geoClipExtent=Qa,u.geoClipRectangle=Qn,u.geoConicConformal=ku,u.geoConicConformalRaw=kc,u.geoConicEqualArea=Yl,u.geoConicEqualAreaRaw=Rl,u.geoConicEquidistant=$c,u.geoConicEquidistantRaw=Xl,u.geoContains=_o,u.geoDistance=Po,u.geoEqualEarth=cf,u.geoEqualEarthRaw=xc,u.geoEquirectangular=Du,u.geoEquirectangularRaw=Gs,u.geoGnomonic=Vc,u.geoGnomonicRaw=zl,u.geoGraticule=wo,u.geoGraticule10=Ms,u.geoIdentity=su,u.geoInterpolate=Di,u.geoLength=zo,u.geoMercator=sc,u.geoMercatorRaw=Fl,u.geoNaturalEarth1=Au,u.geoNaturalEarth1Raw=Fu,u.geoOrthographic=Cs,u.geoOrthographicRaw=il,u.geoPath=Ic,u.geoProjection=Kl,u.geoProjectionMutator=Zu,u.geoRotation=ia,u.geoStereographic=uc,u.geoStereographicRaw=Mu,u.geoStream=j,u.geoTransform=Pc,u.geoTransverseMercator=Dc,u.geoTransverseMercatorRaw=Su,Object.defineProperty(u,"__esModule",{value:!0})})}),EE=Vt((K,V)=>{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K,N3(),Cv()):d(u.d3=u.d3||{},u.d3,u.d3)})(K,function(u,d,E){var A=Math.abs,t=Math.atan,e=Math.atan2,r=Math.cos,i=Math.exp,n=Math.floor,o=Math.log,a=Math.max,s=Math.min,f=Math.pow,v=Math.round,g=Math.sign||function(Rt){return Rt>0?1:Rt<0?-1:0},m=Math.sin,w=Math.tan,l=1e-6,x=1e-12,y=Math.PI,S=y/2,k=y/4,M=Math.SQRT1_2,T=B(2),c=B(y),h=y*2,b=180/y,_=y/180;function P(Rt){return Rt?Rt/Math.sin(Rt):1}function z(Rt){return Rt>1?S:Rt<-1?-S:Math.asin(Rt)}function D(Rt){return Rt>1?0:Rt<-1?y:Math.acos(Rt)}function B(Rt){return Rt>0?Math.sqrt(Rt):0}function R(Rt){return Rt=i(2*Rt),(Rt-1)/(Rt+1)}function I(Rt){return(i(Rt)-i(-Rt))/2}function F(Rt){return(i(Rt)+i(-Rt))/2}function j(Rt){return o(Rt+B(Rt*Rt+1))}function N(Rt){return o(Rt+B(Rt*Rt-1))}function G(Rt){var Gt=w(Rt/2),ae=2*o(r(Rt/2))/(Gt*Gt);function ce(Te,ye){var ze=r(Te),rr=r(ye),fr=m(ye),gr=rr*ze,Lr=-((1-gr?o((1+gr)/2)/(1-gr):-.5)+ae/(1+gr));return[Lr*rr*m(Te),Lr*fr]}return ce.invert=function(Te,ye){var ze=B(Te*Te+ye*ye),rr=-Rt/2,fr=50,gr;if(!ze)return[0,0];do{var Lr=rr/2,Hr=r(Lr),nn=m(Lr),cn=nn/Hr,Mn=-o(A(Hr));rr-=gr=(2/cn*Mn-ae*cn-ze)/(-Mn/(nn*nn)+1-ae/(2*Hr*Hr))*(Hr<0?.7:1)}while(A(gr)>l&&--fr>0);var Jn=m(rr);return[e(Te*Jn,ze*r(rr)),z(ye*Jn/ze)]},ce}function rt(){var Rt=S,Gt=d.geoProjectionMutator(G),ae=Gt(Rt);return ae.radius=function(ce){return arguments.length?Gt(Rt=ce*_):Rt*b},ae.scale(179.976).clipAngle(147)}function ct(Rt,Gt){var ae=r(Gt),ce=P(D(ae*r(Rt/=2)));return[2*ae*m(Rt)*ce,m(Gt)*ce]}ct.invert=function(Rt,Gt){if(!(Rt*Rt+4*Gt*Gt>y*y+l)){var ae=Rt,ce=Gt,Te=25;do{var ye=m(ae),ze=m(ae/2),rr=r(ae/2),fr=m(ce),gr=r(ce),Lr=m(2*ce),Hr=fr*fr,nn=gr*gr,cn=ze*ze,Mn=1-nn*rr*rr,Jn=Mn?D(gr*rr)*B(_a=1/Mn):_a=0,_a,xa=2*Jn*gr*ze-Rt,La=Jn*fr-Gt,ai=_a*(nn*cn+Jn*gr*rr*Hr),Ai=_a*(.5*ye*Lr-Jn*2*fr*ze),mi=_a*.25*(Lr*ze-Jn*fr*nn*ye),Yi=_a*(Hr*rr+Jn*cn*gr),Go=Ai*mi-Yi*ai;if(!Go)break;var Xo=(La*Ai-xa*Yi)/Go,po=(xa*mi-La*ai)/Go;ae-=Xo,ce-=po}while((A(Xo)>l||A(po)>l)&&--Te>0);return[ae,ce]}};function st(){return d.geoProjection(ct).scale(152.63)}function et(Rt){var Gt=m(Rt),ae=r(Rt),ce=Rt>=0?1:-1,Te=w(ce*Rt),ye=(1+Gt-ae)/2;function ze(rr,fr){var gr=r(fr),Lr=r(rr/=2);return[(1+gr)*m(rr),(ce*fr>-e(Lr,Te)-.001?0:-ce*10)+ye+m(fr)*ae-(1+gr)*Gt*Lr]}return ze.invert=function(rr,fr){var gr=0,Lr=0,Hr=50;do{var nn=r(gr),cn=m(gr),Mn=r(Lr),Jn=m(Lr),_a=1+Mn,xa=_a*cn-rr,La=ye+Jn*ae-_a*Gt*nn-fr,ai=_a*nn/2,Ai=-cn*Jn,mi=Gt*_a*cn/2,Yi=ae*Mn+Gt*nn*Jn,Go=Ai*mi-Yi*ai,Xo=(La*Ai-xa*Yi)/Go/2,po=(xa*mi-La*ai)/Go;A(po)>2&&(po/=2),gr-=Xo,Lr-=po}while((A(Xo)>l||A(po)>l)&&--Hr>0);return ce*Lr>-e(r(gr),Te)-.001?[gr*2,Lr]:null},ze}function Z(){var Rt=20*_,Gt=Rt>=0?1:-1,ae=w(Gt*Rt),ce=d.geoProjectionMutator(et),Te=ce(Rt),ye=Te.stream;return Te.parallel=function(ze){return arguments.length?(ae=w((Gt=(Rt=ze*_)>=0?1:-1)*Rt),ce(Rt)):Rt*b},Te.stream=function(ze){var rr=Te.rotate(),fr=ye(ze),gr=(Te.rotate([0,0]),ye(ze)),Lr=Te.precision();return Te.rotate(rr),fr.sphere=function(){gr.polygonStart(),gr.lineStart();for(var Hr=Gt*-180;Gt*Hr<180;Hr+=Gt*90)gr.point(Hr,Gt*90);if(Rt)for(;Gt*(Hr-=3*Gt*Lr)>=-180;)gr.point(Hr,Gt*-e(r(Hr*_/2),ae)*b);gr.lineEnd(),gr.polygonEnd()},fr},Te.scale(218.695).center([0,28.0974])}function ot(Rt,Gt){var ae=w(Gt/2),ce=B(1-ae*ae),Te=1+ce*r(Rt/=2),ye=m(Rt)*ce/Te,ze=ae/Te,rr=ye*ye,fr=ze*ze;return[4/3*ye*(3+rr-3*fr),4/3*ze*(3+3*rr-fr)]}ot.invert=function(Rt,Gt){if(Rt*=3/8,Gt*=3/8,!Rt&&A(Gt)>1)return null;var ae=Rt*Rt,ce=Gt*Gt,Te=1+ae+ce,ye=B((Te-B(Te*Te-4*Gt*Gt))/2),ze=z(ye)/3,rr=ye?N(A(Gt/ye))/3:j(A(Rt))/3,fr=r(ze),gr=F(rr),Lr=gr*gr-fr*fr;return[g(Rt)*2*e(I(rr)*fr,.25-Lr),g(Gt)*2*e(gr*m(ze),.25+Lr)]};function X(){return d.geoProjection(ot).scale(66.1603)}var Q=B(8),ut=o(1+T);function J(Rt,Gt){var ae=A(Gt);return aex&&--ce>0);return[Rt/(r(ae)*(Q-1/m(ae))),g(Gt)*ae]};function q(){return d.geoProjection(J).scale(112.314)}function it(Rt){var Gt=2*y/Rt;function ae(ce,Te){var ye=d.geoAzimuthalEquidistantRaw(ce,Te);if(A(ce)>S){var ze=e(ye[1],ye[0]),rr=B(ye[0]*ye[0]+ye[1]*ye[1]),fr=Gt*v((ze-S)/Gt)+S,gr=e(m(ze-=fr),2-r(ze));ze=fr+z(y/rr*m(gr))-gr,ye[0]=rr*r(ze),ye[1]=rr*m(ze)}return ye}return ae.invert=function(ce,Te){var ye=B(ce*ce+Te*Te);if(ye>S){var ze=e(Te,ce),rr=Gt*v((ze-S)/Gt)+S,fr=ze>rr?-1:1,gr=ye*r(rr-ze),Lr=1/w(fr*D((gr-y)/B(y*(y-2*gr)+ye*ye)));ze=rr+2*t((Lr+fr*B(Lr*Lr-3))/3),ce=ye*r(ze),Te=ye*m(ze)}return d.geoAzimuthalEquidistantRaw.invert(ce,Te)},ae}function nt(){var Rt=5,Gt=d.geoProjectionMutator(it),ae=Gt(Rt),ce=ae.stream,Te=.01,ye=-r(Te*_),ze=m(Te*_);return ae.lobes=function(rr){return arguments.length?Gt(Rt=+rr):Rt},ae.stream=function(rr){var fr=ae.rotate(),gr=ce(rr),Lr=(ae.rotate([0,0]),ce(rr));return ae.rotate(fr),gr.sphere=function(){Lr.polygonStart(),Lr.lineStart();for(var Hr=0,nn=360/Rt,cn=2*y/Rt,Mn=90-180/Rt,Jn=S;Hr0&&A(Te)>l);return ce<0?NaN:ae}function It(Rt,Gt,ae){return Gt===void 0&&(Gt=40),ae===void 0&&(ae=x),function(ce,Te,ye,ze){var rr,fr,gr;ye=ye===void 0?0:+ye,ze=ze===void 0?0:+ze;for(var Lr=0;Lrrr){ye-=fr/=2,ze-=gr/=2;continue}rr=Mn;var Jn=(ye>0?-1:1)*ae,_a=(ze>0?-1:1)*ae,xa=Rt(ye+Jn,ze),La=Rt(ye,ze+_a),ai=(xa[0]-Hr[0])/Jn,Ai=(xa[1]-Hr[1])/Jn,mi=(La[0]-Hr[0])/_a,Yi=(La[1]-Hr[1])/_a,Go=Yi*ai-Ai*mi,Xo=(A(Go)<.5?.5:1)/Go;if(fr=(cn*mi-nn*Yi)*Xo,gr=(nn*Ai-cn*ai)*Xo,ye+=fr,ze+=gr,A(fr)0&&(rr[1]*=1+fr/1.5*rr[0]*rr[0]),rr}return ce.invert=It(ce),ce}function te(){return d.geoProjection(Nt()).rotate([-16.5,-42]).scale(176.57).center([7.93,.09])}function Jt(Rt,Gt){var ae=Rt*m(Gt),ce=30,Te;do Gt-=Te=(Gt+m(Gt)-ae)/(1+r(Gt));while(A(Te)>l&&--ce>0);return Gt/2}function ee(Rt,Gt,ae){function ce(Te,ye){return[Rt*Te*r(ye=Jt(ae,ye)),Gt*m(ye)]}return ce.invert=function(Te,ye){return ye=z(ye/Gt),[Te/(Rt*r(ye)),z((2*ye+m(2*ye))/ae)]},ce}var Zt=ee(T/S,T,y);function mt(){return d.geoProjection(Zt).scale(169.529)}var bt=2.00276,vt=1.11072;function Ut(Rt,Gt){var ae=Jt(y,Gt);return[bt*Rt/(1/r(Gt)+vt/r(ae)),(Gt+T*m(ae))/bt]}Ut.invert=function(Rt,Gt){var ae=bt*Gt,ce=Gt<0?-k:k,Te=25,ye,ze;do ze=ae-T*m(ce),ce-=ye=(m(2*ce)+2*ce-y*m(ze))/(2*r(2*ce)+2+y*r(ze)*T*r(ce));while(A(ye)>l&&--Te>0);return ze=ae-T*m(ce),[Rt*(1/r(ze)+vt/r(ce))/bt,ze]};function re(){return d.geoProjection(Ut).scale(160.857)}function Kt(Rt){var Gt=0,ae=d.geoProjectionMutator(Rt),ce=ae(Gt);return ce.parallel=function(Te){return arguments.length?ae(Gt=Te*_):Gt*b},ce}function ue(Rt,Gt){return[Rt*r(Gt),Gt]}ue.invert=function(Rt,Gt){return[Rt/r(Gt),Gt]};function Me(){return d.geoProjection(ue).scale(152.63)}function Ce(Rt){if(!Rt)return ue;var Gt=1/w(Rt);function ae(ce,Te){var ye=Gt+Rt-Te,ze=ye&&ce*r(Te)/ye;return[ye*m(ze),Gt-ye*r(ze)]}return ae.invert=function(ce,Te){var ye=B(ce*ce+(Te=Gt-Te)*Te),ze=Gt+Rt-ye;return[ye/r(ze)*e(ce,Te),ze]},ae}function We(){return Kt(Ce).scale(123.082).center([0,26.1441]).parallel(45)}function qe(Rt){function Gt(ae,ce){var Te=S-ce,ye=Te&&ae*Rt*m(Te)/Te;return[Te*m(ye)/Rt,S-Te*r(ye)]}return Gt.invert=function(ae,ce){var Te=ae*Rt,ye=S-ce,ze=B(Te*Te+ye*ye),rr=e(Te,ye);return[(ze?ze/m(ze):1)*rr/Rt,S-ze]},Gt}function vr(){var Rt=.5,Gt=d.geoProjectionMutator(qe),ae=Gt(Rt);return ae.fraction=function(ce){return arguments.length?Gt(Rt=+ce):Rt},ae.scale(158.837)}var _r=ee(1,4/y,y);function er(){return d.geoProjection(_r).scale(152.63)}function Mr(Rt,Gt,ae,ce,Te,ye){var ze=r(ye),rr;if(A(Rt)>1||A(ye)>1)rr=D(ae*Te+Gt*ce*ze);else{var fr=m(Rt/2),gr=m(ye/2);rr=2*z(B(fr*fr+Gt*ce*gr*gr))}return A(rr)>l?[rr,e(ce*m(ye),Gt*Te-ae*ce*ze)]:[0,0]}function Ir(Rt,Gt,ae){return D((Rt*Rt+Gt*Gt-ae*ae)/(2*Rt*Gt))}function de(Rt){return Rt-2*y*n((Rt+y)/(2*y))}function Dt(Rt,Gt,ae){for(var ce=[[Rt[0],Rt[1],m(Rt[1]),r(Rt[1])],[Gt[0],Gt[1],m(Gt[1]),r(Gt[1])],[ae[0],ae[1],m(ae[1]),r(ae[1])]],Te=ce[2],ye,ze=0;ze<3;++ze,Te=ye)ye=ce[ze],Te.v=Mr(ye[1]-Te[1],Te[3],Te[2],ye[3],ye[2],ye[0]-Te[0]),Te.point=[0,0];var rr=Ir(ce[0].v[0],ce[2].v[0],ce[1].v[0]),fr=Ir(ce[0].v[0],ce[1].v[0],ce[2].v[0]),gr=y-rr;ce[2].point[1]=0,ce[0].point[0]=-(ce[1].point[0]=ce[0].v[0]/2);var Lr=[ce[2].point[0]=ce[0].point[0]+ce[2].v[0]*r(rr),2*(ce[0].point[1]=ce[1].point[1]=ce[2].v[0]*m(rr))];function Hr(nn,cn){var Mn=m(cn),Jn=r(cn),_a=new Array(3),xa;for(xa=0;xa<3;++xa){var La=ce[xa];if(_a[xa]=Mr(cn-La[1],La[3],La[2],Jn,Mn,nn-La[0]),!_a[xa][0])return La.point;_a[xa][1]=de(_a[xa][1]-La.v[1])}var ai=Lr.slice();for(xa=0;xa<3;++xa){var Ai=xa==2?0:xa+1,mi=Ir(ce[xa].v[0],_a[xa][0],_a[Ai][0]);_a[xa][1]<0&&(mi=-mi),xa?xa==1?(mi=fr-mi,ai[0]-=_a[xa][0]*r(mi),ai[1]-=_a[xa][0]*m(mi)):(mi=gr-mi,ai[0]+=_a[xa][0]*r(mi),ai[1]+=_a[xa][0]*m(mi)):(ai[0]+=_a[xa][0]*r(mi),ai[1]-=_a[xa][0]*m(mi))}return ai[0]/=3,ai[1]/=3,ai}return Hr}function qt(Rt){return Rt[0]*=_,Rt[1]*=_,Rt}function _t(){return lt([0,22],[45,22],[22.5,-22]).scale(380).center([22.5,2])}function lt(Rt,Gt,ae){var ce=d.geoCentroid({type:"MultiPoint",coordinates:[Rt,Gt,ae]}),Te=[-ce[0],-ce[1]],ye=d.geoRotation(Te),ze=Dt(qt(ye(Rt)),qt(ye(Gt)),qt(ye(ae)));ze.invert=It(ze);var rr=d.geoProjection(ze).rotate(Te),fr=rr.center;return delete rr.rotate,rr.center=function(gr){return arguments.length?fr(ye(gr)):ye.invert(fr())},rr.clipAngle(90)}function yt(Rt,Gt){var ae=B(1-m(Gt));return[2/c*Rt*ae,c*(1-ae)]}yt.invert=function(Rt,Gt){var ae=(ae=Gt/c-1)*ae;return[ae>0?Rt*B(y/ae)/2:0,z(1-ae)]};function St(){return d.geoProjection(yt).scale(95.6464).center([0,30])}function Ht(Rt){var Gt=w(Rt);function ae(ce,Te){return[ce,(ce?ce/m(ce):1)*(m(Te)*r(ce)-Gt*r(Te))]}return ae.invert=Gt?function(ce,Te){ce&&(Te*=m(ce)/ce);var ye=r(ce);return[ce,2*e(B(ye*ye+Gt*Gt-Te*Te)-ye,Gt-Te)]}:function(ce,Te){return[ce,z(ce?Te*w(ce)/ce:Te)]},ae}function Yt(){return Kt(Ht).scale(249.828).clipAngle(90)}var se=B(3);function ke(Rt,Gt){return[se*Rt*(2*r(2*Gt/3)-1)/c,se*c*m(Gt/3)]}ke.invert=function(Rt,Gt){var ae=3*z(Gt/(se*c));return[c*Rt/(se*(2*r(2*ae/3)-1)),ae]};function Ee(){return d.geoProjection(ke).scale(156.19)}function Ue(Rt){var Gt=r(Rt);function ae(ce,Te){return[ce*Gt,m(Te)/Gt]}return ae.invert=function(ce,Te){return[ce/Gt,z(Te*Gt)]},ae}function ir(){return Kt(Ue).parallel(38.58).scale(195.044)}function ar(Rt){var Gt=r(Rt);function ae(ce,Te){return[ce*Gt,(1+Gt)*w(Te/2)]}return ae.invert=function(ce,Te){return[ce/Gt,t(Te/(1+Gt))*2]},ae}function Ye(){return Kt(ar).scale(124.75)}function Er(Rt,Gt){var ae=B(8/(3*y));return[ae*Rt*(1-A(Gt)/y),ae*Gt]}Er.invert=function(Rt,Gt){var ae=B(8/(3*y)),ce=Gt/ae;return[Rt/(ae*(1-A(ce)/y)),ce]};function pn(){return d.geoProjection(Er).scale(165.664)}function dn(Rt,Gt){var ae=B(4-3*m(A(Gt)));return[2/B(6*y)*Rt*ae,g(Gt)*B(2*y/3)*(2-ae)]}dn.invert=function(Rt,Gt){var ae=2-A(Gt)/B(2*y/3);return[Rt*B(6*y)/(2*ae),g(Gt)*z((4-ae*ae)/3)]};function bn(){return d.geoProjection(dn).scale(165.664)}function Zn(Rt,Gt){var ae=B(y*(4+y));return[2/ae*Rt*(1+B(1-4*Gt*Gt/(y*y))),4/ae*Gt]}Zn.invert=function(Rt,Gt){var ae=B(y*(4+y))/2;return[Rt*ae/(1+B(1-Gt*Gt*(4+y)/(4*y))),Gt*ae/2]};function En(){return d.geoProjection(Zn).scale(180.739)}function gn(Rt,Gt){var ae=(2+S)*m(Gt);Gt/=2;for(var ce=0,Te=1/0;ce<10&&A(Te)>l;ce++){var ye=r(Gt);Gt-=Te=(Gt+m(Gt)*(ye+2)-ae)/(2*ye*(1+ye))}return[2/B(y*(4+y))*Rt*(1+r(Gt)),2*B(y/(4+y))*m(Gt)]}gn.invert=function(Rt,Gt){var ae=Gt*B((4+y)/y)/2,ce=z(ae),Te=r(ce);return[Rt/(2/B(y*(4+y))*(1+Te)),z((ce+ae*(Te+2))/(2+S))]};function da(){return d.geoProjection(gn).scale(180.739)}function ra(Rt,Gt){return[Rt*(1+r(Gt))/B(2+y),2*Gt/B(2+y)]}ra.invert=function(Rt,Gt){var ae=B(2+y),ce=Gt*ae/2;return[ae*Rt/(1+r(ce)),ce]};function Se(){return d.geoProjection(ra).scale(173.044)}function Re(Rt,Gt){for(var ae=(1+S)*m(Gt),ce=0,Te=1/0;ce<10&&A(Te)>l;ce++)Gt-=Te=(Gt+m(Gt)-ae)/(1+r(Gt));return ae=B(2+y),[Rt*(1+r(Gt))/ae,2*Gt/ae]}Re.invert=function(Rt,Gt){var ae=1+S,ce=B(ae/2);return[Rt*2*ce/(1+r(Gt*=ce)),z((Gt+m(Gt))/ae)]};function Ze(){return d.geoProjection(Re).scale(173.044)}var tr=3+2*T;function zr(Rt,Gt){var ae=m(Rt/=2),ce=r(Rt),Te=B(r(Gt)),ye=r(Gt/=2),ze=m(Gt)/(ye+T*ce*Te),rr=B(2/(1+ze*ze)),fr=B((T*ye+(ce+ae)*Te)/(T*ye+(ce-ae)*Te));return[tr*(rr*(fr-1/fr)-2*o(fr)),tr*(rr*ze*(fr+1/fr)-2*t(ze))]}zr.invert=function(Rt,Gt){if(!(ye=ot.invert(Rt/1.2,Gt*1.065)))return null;var ae=ye[0],ce=ye[1],Te=20,ye;Rt/=tr,Gt/=tr;do{var ze=ae/2,rr=ce/2,fr=m(ze),gr=r(ze),Lr=m(rr),Hr=r(rr),nn=r(ce),cn=B(nn),Mn=Lr/(Hr+T*gr*cn),Jn=Mn*Mn,_a=B(2/(1+Jn)),xa=T*Hr+(gr+fr)*cn,La=T*Hr+(gr-fr)*cn,ai=xa/La,Ai=B(ai),mi=Ai-1/Ai,Yi=Ai+1/Ai,Go=_a*mi-2*o(Ai)-Rt,Xo=_a*Mn*Yi-2*t(Mn)-Gt,po=Lr&&M*cn*fr*Jn/Lr,Qo=(T*gr*Hr+cn)/(2*(Hr+T*gr*cn)*(Hr+T*gr*cn)*cn),Js=-.5*Mn*_a*_a*_a,Us=Js*po,To=Js*Qo,ko=(ko=2*Hr+T*cn*(gr-fr))*ko*Ai,hl=(T*gr*Hr*cn+nn)/ko,Sl=-(T*fr*Lr)/(cn*ko),tu=mi*Us-2*hl/Ai+_a*(hl+hl/ai),gt=mi*To-2*Sl/Ai+_a*(Sl+Sl/ai),Et=Mn*Yi*Us-2*po/(1+Jn)+_a*Yi*po+_a*Mn*(hl-hl/ai),Xt=Mn*Yi*To-2*Qo/(1+Jn)+_a*Yi*Qo+_a*Mn*(Sl-Sl/ai),fe=gt*Et-Xt*tu;if(!fe)break;var me=(Xo*gt-Go*Xt)/fe,we=(Go*Et-Xo*tu)/fe;ae-=me,ce=a(-S,s(S,ce-we))}while((A(me)>l||A(we)>l)&&--Te>0);return A(A(ce)-S)ce){var Hr=B(Lr),nn=e(gr,fr),cn=ae*v(nn/ae),Mn=nn-cn,Jn=Rt*r(Mn),_a=(Rt*m(Mn)-Mn*m(Jn))/(S-Jn),xa=ge(Mn,_a),La=(y-Rt)/dr(xa,Jn,y);fr=Hr;var ai=50,Ai;do fr-=Ai=(Rt+dr(xa,Jn,fr)*La-Hr)/(xa(fr)*La);while(A(Ai)>l&&--ai>0);gr=Mn*m(fr),frce){var fr=B(rr),gr=e(ze,ye),Lr=ae*v(gr/ae),Hr=gr-Lr;ye=fr*r(Hr),ze=fr*m(Hr);for(var nn=ye-S,cn=m(ye),Mn=ze/cn,Jn=yel||A(Mn)>l)&&--Jn>0);return[Hr,nn]},fr}var mr=Tr(2.8284,-1.6988,.75432,-.18071,1.76003,-.38914,.042555);function kr(){return d.geoProjection(mr).scale(149.995)}var Ur=Tr(2.583819,-.835827,.170354,-.038094,1.543313,-.411435,.082742);function Or(){return d.geoProjection(Ur).scale(153.93)}var pe=Tr(5/6*y,-.62636,-.0344,0,1.3493,-.05524,0,.045);function Ke(){return d.geoProjection(pe).scale(130.945)}function xr(Rt,Gt){var ae=Rt*Rt,ce=Gt*Gt;return[Rt*(1-.162388*ce)*(.87-952426e-9*ae*ae),Gt*(1+ce/12)]}xr.invert=function(Rt,Gt){var ae=Rt,ce=Gt,Te=50,ye;do{var ze=ce*ce;ce-=ye=(ce*(1+ze/12)-Gt)/(1+ze/4)}while(A(ye)>l&&--Te>0);Te=50,Rt/=1-.162388*ze;do{var rr=(rr=ae*ae)*rr;ae-=ye=(ae*(.87-952426e-9*rr)-Rt)/(.87-.00476213*rr)}while(A(ye)>l&&--Te>0);return[ae,ce]};function Gr(){return d.geoProjection(xr).scale(131.747)}var ln=Tr(2.6516,-.76534,.19123,-.047094,1.36289,-.13965,.031762);function wn(){return d.geoProjection(ln).scale(131.087)}function rn(Rt){var Gt=Rt(S,0)[0]-Rt(-S,0)[0];function ae(ce,Te){var ye=ce>0?-.5:.5,ze=Rt(ce+ye*y,Te);return ze[0]-=ye*Gt,ze}return Rt.invert&&(ae.invert=function(ce,Te){var ye=ce>0?-.5:.5,ze=Rt.invert(ce+ye*Gt,Te),rr=ze[0]-ye*y;return rr<-y?rr+=2*y:rr>y&&(rr-=2*y),ze[0]=rr,ze}),ae}function Qr(Rt,Gt){var ae=g(Rt),ce=g(Gt),Te=r(Gt),ye=r(Rt)*Te,ze=m(Rt)*Te,rr=m(ce*Gt);Rt=A(e(ze,rr)),Gt=z(ye),A(Rt-S)>l&&(Rt%=S);var fr=vn(Rt>y/4?S-Rt:Rt,Gt);return Rt>y/4&&(rr=fr[0],fr[0]=-fr[1],fr[1]=-rr),fr[0]*=ae,fr[1]*=-ce,fr}Qr.invert=function(Rt,Gt){A(Rt)>1&&(Rt=g(Rt)*2-Rt),A(Gt)>1&&(Gt=g(Gt)*2-Gt);var ae=g(Rt),ce=g(Gt),Te=-ae*Rt,ye=-ce*Gt,ze=ye/Te<1,rr=Oa(ze?ye:Te,ze?Te:ye),fr=rr[0],gr=rr[1],Lr=r(gr);return ze&&(fr=-S-fr),[ae*(e(m(fr)*Lr,-m(gr))+y),ce*z(r(fr)*Lr)]};function vn(Rt,Gt){if(Gt===S)return[0,0];var ae=m(Gt),ce=ae*ae,Te=ce*ce,ye=1+Te,ze=1+3*Te,rr=1-Te,fr=z(1/B(ye)),gr=rr+ce*ye*fr,Lr=(1-ae)/gr,Hr=B(Lr),nn=Lr*ye,cn=B(nn),Mn=Hr*rr,Jn,_a;if(Rt===0)return[0,-(Mn+ce*cn)];var xa=r(Gt),La=1/xa,ai=2*ae*xa,Ai=(-3*ce+fr*ze)*ai,mi=(-gr*xa-(1-ae)*Ai)/(gr*gr),Yi=.5*mi/Hr,Go=rr*Yi-2*ce*Hr*ai,Xo=ce*ye*mi+Lr*ze*ai,po=-La*ai,Qo=-La*Xo,Js=-2*La*Go,Us=4*Rt/y,To;if(Rt>.222*y||Gt.175*y){if(Jn=(Mn+ce*B(nn*(1+Te)-Mn*Mn))/(1+Te),Rt>y/4)return[Jn,Jn];var ko=Jn,hl=.5*Jn;Jn=.5*(hl+ko),_a=50;do{var Sl=B(nn-Jn*Jn),tu=Jn*(Js+po*Sl)+Qo*z(Jn/cn)-Us;if(!tu)break;tu<0?hl=Jn:ko=Jn,Jn=.5*(hl+ko)}while(A(ko-hl)>l&&--_a>0)}else{Jn=l,_a=25;do{var gt=Jn*Jn,Et=B(nn-gt),Xt=Js+po*Et,fe=Jn*Xt+Qo*z(Jn/cn)-Us,me=Xt+(Qo-po*gt)/Et;Jn-=To=Et?fe/me:0}while(A(To)>l&&--_a>0)}return[Jn,-Mn-ce*B(nn-Jn*Jn)]}function Oa(Rt,Gt){for(var ae=0,ce=1,Te=.5,ye=50;;){var ze=Te*Te,rr=B(Te),fr=z(1/B(1+ze)),gr=1-ze+Te*(1+ze)*fr,Lr=(1-rr)/gr,Hr=B(Lr),nn=Lr*(1+ze),cn=Hr*(1-ze),Mn=nn-Rt*Rt,Jn=B(Mn),_a=Gt+cn+Te*Jn;if(A(ce-ae)0?ae=Te:ce=Te,Te=.5*(ae+ce)}if(!ye)return null;var xa=z(rr),La=r(xa),ai=1/La,Ai=2*rr*La,mi=(-3*Te+fr*(1+3*ze))*Ai,Yi=(-gr*La-(1-rr)*mi)/(gr*gr),Go=.5*Yi/Hr,Xo=(1-ze)*Go-2*Te*Hr*Ai,po=-2*ai*Xo,Qo=-ai*Ai,Js=-ai*(Te*(1+ze)*Yi+Lr*(1+3*ze)*Ai);return[y/4*(Rt*(po+Qo*Jn)+Js*z(Rt/B(nn))),xa]}function Qn(){return d.geoProjection(rn(Qr)).scale(239.75)}function Qa(Rt,Gt,ae){var ce,Te,ye;return Rt?(ce=Ja(Rt,ae),Gt?(Te=Ja(Gt,1-ae),ye=Te[1]*Te[1]+ae*ce[0]*ce[0]*Te[0]*Te[0],[[ce[0]*Te[2]/ye,ce[1]*ce[2]*Te[0]*Te[1]/ye],[ce[1]*Te[1]/ye,-ce[0]*ce[2]*Te[0]*Te[2]/ye],[ce[2]*Te[1]*Te[2]/ye,-ae*ce[0]*ce[1]*Te[0]/ye]]):[[ce[0],0],[ce[1],0],[ce[2],0]]):(Te=Ja(Gt,1-ae),[[0,Te[0]/Te[1]],[1/Te[1],0],[Te[2]/Te[1],0]])}function Ja(Rt,Gt){var ae,ce,Te,ye,ze;if(Gt=1-l)return ae=(1-Gt)/4,ce=F(Rt),ye=R(Rt),Te=1/ce,ze=ce*I(Rt),[ye+ae*(ze-Rt)/(ce*ce),Te-ae*ye*Te*(ze-Rt),Te+ae*ye*Te*(ze+Rt),2*t(i(Rt))-S+ae*(ze-Rt)/ce];var rr=[1,0,0,0,0,0,0,0,0],fr=[B(Gt),0,0,0,0,0,0,0,0],gr=0;for(ce=B(1-Gt),ze=1;A(fr[gr]/rr[gr])>l&&gr<8;)ae=rr[gr++],fr[gr]=(ae-ce)/2,rr[gr]=(ae+ce)/2,ce=B(ae*ce),ze*=2;Te=ze*rr[gr]*Rt;do ye=fr[gr]*m(ce=Te)/rr[gr],Te=(z(ye)+Te)/2;while(--gr);return[m(Te),ye=r(Te),ye/r(Te-ce),Te]}function wi(Rt,Gt,ae){var ce=A(Rt),Te=A(Gt),ye=I(Te);if(ce){var ze=1/m(ce),rr=1/(w(ce)*w(ce)),fr=-(rr+ae*(ye*ye*ze*ze)-1+ae),gr=(ae-1)*rr,Lr=(-fr+B(fr*fr-4*gr))/2;return[ci(t(1/B(Lr)),ae)*g(Rt),ci(t(B((Lr/rr-1)/ae)),1-ae)*g(Gt)]}return[0,ci(t(ye),1-ae)*g(Gt)]}function ci(Rt,Gt){if(!Gt)return Rt;if(Gt===1)return o(w(Rt/2+k));for(var ae=1,ce=B(1-Gt),Te=B(Gt),ye=0;A(Te)>l;ye++){if(Rt%y){var ze=t(ce*w(Rt)/ae);ze<0&&(ze+=y),Rt+=ze+~~(Rt/y)*y}else Rt+=Rt;Te=(ae+ce)/2,ce=B(ae*ce),Te=((ae=Te)-ce)/2}return Rt/(f(2,ye)*ae)}function Ti(Rt,Gt){var ae=(T-1)/(T+1),ce=B(1-ae*ae),Te=ci(S,ce*ce),ye=-1,ze=o(w(y/4+A(Gt)/2)),rr=i(ye*ze)/B(ae),fr=Ra(rr*r(ye*Rt),rr*m(ye*Rt)),gr=wi(fr[0],fr[1],ce*ce);return[-gr[1],(Gt>=0?1:-1)*(.5*Te-gr[0])]}function Ra(Rt,Gt){var ae=Rt*Rt,ce=Gt+1,Te=1-ae-Gt*Gt;return[.5*((Rt>=0?S:-S)-e(Te,2*Rt)),-.25*o(Te*Te+4*ae)+.5*o(ce*ce+ae)]}function Qi(Rt,Gt){var ae=Gt[0]*Gt[0]+Gt[1]*Gt[1];return[(Rt[0]*Gt[0]+Rt[1]*Gt[1])/ae,(Rt[1]*Gt[0]-Rt[0]*Gt[1])/ae]}Ti.invert=function(Rt,Gt){var ae=(T-1)/(T+1),ce=B(1-ae*ae),Te=ci(S,ce*ce),ye=-1,ze=Qa(.5*Te-Gt,-Rt,ce*ce),rr=Qi(ze[0],ze[1]),fr=e(rr[1],rr[0])/ye;return[fr,2*t(i(.5/ye*o(ae*rr[0]*rr[0]+ae*rr[1]*rr[1])))-S]};function Hi(){return d.geoProjection(rn(Ti)).scale(151.496)}function Ho(Rt){var Gt=m(Rt),ae=r(Rt),ce=Ci(Rt);ce.invert=Ci(-Rt);function Te(ye,ze){var rr=ce(ye,ze);ye=rr[0],ze=rr[1];var fr=m(ze),gr=r(ze),Lr=r(ye),Hr=D(Gt*fr+ae*gr*Lr),nn=m(Hr),cn=A(nn)>l?Hr/nn:1;return[cn*ae*m(ye),(A(ye)>S?cn:-cn)*(Gt*gr-ae*fr*Lr)]}return Te.invert=function(ye,ze){var rr=B(ye*ye+ze*ze),fr=-m(rr),gr=r(rr),Lr=rr*gr,Hr=-ze*fr,nn=rr*Gt,cn=B(Lr*Lr+Hr*Hr-nn*nn),Mn=e(Lr*nn+Hr*cn,Hr*nn-Lr*cn),Jn=(rr>S?-1:1)*e(ye*fr,rr*r(Mn)*gr+ze*m(Mn)*fr);return ce.invert(Jn,Mn)},Te}function Ci(Rt){var Gt=m(Rt),ae=r(Rt);return function(ce,Te){var ye=r(Te),ze=r(ce)*ye,rr=m(ce)*ye,fr=m(Te);return[e(rr,ze*ae-fr*Gt),z(fr*ae+ze*Gt)]}}function zo(){var Rt=0,Gt=d.geoProjectionMutator(Ho),ae=Gt(Rt),ce=ae.rotate,Te=ae.stream,ye=d.geoCircle();return ae.parallel=function(ze){if(!arguments.length)return Rt*b;var rr=ae.rotate();return Gt(Rt=ze*_).rotate(rr)},ae.rotate=function(ze){return arguments.length?(ce.call(ae,[ze[0],ze[1]-Rt*b]),ye.center([-ze[0],-ze[1]]),ae):(ze=ce.call(ae),ze[1]+=Rt*b,ze)},ae.stream=function(ze){return ze=Te(ze),ze.sphere=function(){ze.polygonStart();var rr=.01,fr=ye.radius(90-rr)().coordinates[0],gr=fr.length-1,Lr=-1,Hr;for(ze.lineStart();++Lr=0;)ze.point((Hr=fr[Lr])[0],Hr[1]);ze.lineEnd(),ze.polygonEnd()},ze},ae.scale(79.4187).parallel(45).clipAngle(180-.001)}var qi=3,qo=z(1-1/qi)*b,Po=Ue(0);function hs(Rt){var Gt=qo*_,ae=yt(y,Gt)[0]-yt(-y,Gt)[0],ce=Po(0,Gt)[1],Te=yt(0,Gt)[1],ye=c-Te,ze=h/Rt,rr=4/h,fr=ce+ye*ye*4/h;function gr(Lr,Hr){var nn,cn=A(Hr);if(cn>Gt){var Mn=s(Rt-1,a(0,n((Lr+y)/ze)));Lr+=y*(Rt-1)/Rt-Mn*ze,nn=yt(Lr,cn),nn[0]=nn[0]*h/ae-h*(Rt-1)/(2*Rt)+Mn*h/Rt,nn[1]=ce+(nn[1]-Te)*4*ye/h,Hr<0&&(nn[1]=-nn[1])}else nn=Po(Lr,Hr);return nn[0]*=rr,nn[1]/=fr,nn}return gr.invert=function(Lr,Hr){Lr/=rr,Hr*=fr;var nn=A(Hr);if(nn>ce){var cn=s(Rt-1,a(0,n((Lr+y)/ze)));Lr=(Lr+y*(Rt-1)/Rt-cn*ze)*ae/h;var Mn=yt.invert(Lr,.25*(nn-ce)*h/ye+Te);return Mn[0]-=y*(Rt-1)/Rt-cn*ze,Hr<0&&(Mn[1]=-Mn[1]),Mn}return Po.invert(Lr,Hr)},gr}function Gi(Rt,Gt){return[Rt,Gt&1?90-l:qo]}function uo(Rt,Gt){return[Rt,Gt&1?-90+l:-qo]}function yi(Rt){return[Rt[0]*(1-l),Rt[1]]}function ao(Rt){var Gt=[].concat(E.range(-180,180+Rt/2,Rt).map(Gi),E.range(180,-180-Rt/2,-Rt).map(uo));return{type:"Polygon",coordinates:[Rt===180?Gt.map(yi):Gt]}}function ts(){var Rt=4,Gt=d.geoProjectionMutator(hs),ae=Gt(Rt),ce=ae.stream;return ae.lobes=function(Te){return arguments.length?Gt(Rt=+Te):Rt},ae.stream=function(Te){var ye=ae.rotate(),ze=ce(Te),rr=(ae.rotate([0,0]),ce(Te));return ae.rotate(ye),ze.sphere=function(){d.geoStream(ao(180/Rt),rr)},ze},ae.scale(239.75)}function vs(Rt){var Gt=1+Rt,ae=m(1/Gt),ce=z(ae),Te=2*B(y/(ye=y+4*ce*Gt)),ye,ze=.5*Te*(Gt+B(Rt*(2+Rt))),rr=Rt*Rt,fr=Gt*Gt;function gr(Lr,Hr){var nn=1-m(Hr),cn,Mn;if(nn&&nn<2){var Jn=S-Hr,_a=25,xa;do{var La=m(Jn),ai=r(Jn),Ai=ce+e(La,Gt-ai),mi=1+fr-2*Gt*ai;Jn-=xa=(Jn-rr*ce-Gt*La+mi*Ai-.5*nn*ye)/(2*Gt*La*Ai)}while(A(xa)>x&&--_a>0);cn=Te*B(mi),Mn=Lr*Ai/y}else cn=Te*(Rt+nn),Mn=Lr*ce/y;return[cn*m(Mn),ze-cn*r(Mn)]}return gr.invert=function(Lr,Hr){var nn=Lr*Lr+(Hr-=ze)*Hr,cn=(1+fr-nn/(Te*Te))/(2*Gt),Mn=D(cn),Jn=m(Mn),_a=ce+e(Jn,Gt-cn);return[z(Lr/B(nn))*y/_a,z(1-2*(Mn-rr*ce-Gt*Jn+(1+fr-2*Gt*cn)*_a)/ye)]},gr}function As(){var Rt=1,Gt=d.geoProjectionMutator(vs),ae=Gt(Rt);return ae.ratio=function(ce){return arguments.length?Gt(Rt=+ce):Rt},ae.scale(167.774).center([0,18.67])}var _o=.7109889596207567,Da=.0528035274542;function li(Rt,Gt){return Gt>-_o?(Rt=Zt(Rt,Gt),Rt[1]+=Da,Rt):ue(Rt,Gt)}li.invert=function(Rt,Gt){return Gt>-_o?Zt.invert(Rt,Gt-Da):ue.invert(Rt,Gt)};function wo(){return d.geoProjection(li).rotate([-20,-55]).scale(164.263).center([0,-5.4036])}function Ms(Rt,Gt){return A(Gt)>_o?(Rt=Zt(Rt,Gt),Rt[1]-=Gt>0?Da:-Da,Rt):ue(Rt,Gt)}Ms.invert=function(Rt,Gt){return A(Gt)>_o?Zt.invert(Rt,Gt+(Gt>0?Da:-Da)):ue.invert(Rt,Gt)};function Di(){return d.geoProjection(Ms).scale(152.63)}function _s(Rt,Gt,ae,ce){var Te=B(4*y/(2*ae+(1+Rt-Gt/2)*m(2*ae)+(Rt+Gt)/2*m(4*ae)+Gt/2*m(6*ae))),ye=B(ce*m(ae)*B((1+Rt*r(2*ae)+Gt*r(4*ae))/(1+Rt+Gt))),ze=ae*fr(1);function rr(Hr){return B(1+Rt*r(2*Hr)+Gt*r(4*Hr))}function fr(Hr){var nn=Hr*ae;return(2*nn+(1+Rt-Gt/2)*m(2*nn)+(Rt+Gt)/2*m(4*nn)+Gt/2*m(6*nn))/ae}function gr(Hr){return rr(Hr)*m(Hr)}var Lr=function(Hr,nn){var cn=ae*Ct(fr,ze*m(nn)/ae,nn/y);isNaN(cn)&&(cn=ae*g(nn));var Mn=Te*rr(cn);return[Mn*ye*Hr/y*r(cn),Mn/ye*m(cn)]};return Lr.invert=function(Hr,nn){var cn=Ct(gr,nn*ye/Te);return[Hr*y/(r(cn)*Te*ye*rr(cn)),z(ae*fr(cn/ae)/ze)]},ae===0&&(Te=B(ce/y),Lr=function(Hr,nn){return[Hr*Te,m(nn)/Te]},Lr.invert=function(Hr,nn){return[Hr/Te,z(nn*Te)]}),Lr}function No(){var Rt=1,Gt=0,ae=45*_,ce=2,Te=d.geoProjectionMutator(_s),ye=Te(Rt,Gt,ae,ce);return ye.a=function(ze){return arguments.length?Te(Rt=+ze,Gt,ae,ce):Rt},ye.b=function(ze){return arguments.length?Te(Rt,Gt=+ze,ae,ce):Gt},ye.psiMax=function(ze){return arguments.length?Te(Rt,Gt,ae=+ze*_,ce):ae*b},ye.ratio=function(ze){return arguments.length?Te(Rt,Gt,ae,ce=+ze):ce},ye.scale(180.739)}function is(Rt,Gt,ae,ce,Te,ye,ze,rr,fr,gr,Lr){if(Lr.nanEncountered)return NaN;var Hr,nn,cn,Mn,Jn,_a,xa,La,ai,Ai;if(Hr=ae-Gt,nn=Rt(Gt+Hr*.25),cn=Rt(ae-Hr*.25),isNaN(nn)){Lr.nanEncountered=!0;return}if(isNaN(cn)){Lr.nanEncountered=!0;return}return Mn=Hr*(ce+4*nn+Te)/12,Jn=Hr*(Te+4*cn+ye)/12,_a=Mn+Jn,Ai=(_a-ze)/15,gr>fr?(Lr.maxDepthCount++,_a+Ai):Math.abs(Ai)>1;do fr[_a]>cn?Jn=_a:Mn=_a,_a=Mn+Jn>>1;while(_a>Mn);var xa=fr[_a+1]-fr[_a];return xa&&(xa=(cn-fr[_a+1])/xa),(_a+1+xa)/ze}var Hr=2*Lr(1)/y*ye/ae,nn=function(cn,Mn){var Jn=Lr(A(m(Mn))),_a=ce(Jn)*cn;return Jn/=Hr,[_a,Mn>=0?Jn:-Jn]};return nn.invert=function(cn,Mn){var Jn;return Mn*=Hr,A(Mn)<1&&(Jn=g(Mn)*z(Te(A(Mn))*ye)),[cn/ce(A(Mn)),Jn]},nn}function io(){var Rt=0,Gt=2.5,ae=1.183136,ce=d.geoProjectionMutator(ii),Te=ce(Rt,Gt,ae);return Te.alpha=function(ye){return arguments.length?ce(Rt=+ye,Gt,ae):Rt},Te.k=function(ye){return arguments.length?ce(Rt,Gt=+ye,ae):Gt},Te.gamma=function(ye){return arguments.length?ce(Rt,Gt,ae=+ye):ae},Te.scale(152.63)}function co(Rt,Gt){return A(Rt[0]-Gt[0])=0;--fr)ae=Rt[1][fr],ce=ae[0][0],Te=ae[0][1],ye=ae[1][1],ze=ae[2][0],rr=ae[2][1],Gt.push(Is([[ze-l,rr-l],[ze-l,ye+l],[ce+l,ye+l],[ce+l,Te-l]],30));return{type:"Polygon",coordinates:[E.merge(Gt)]}}function Bi(Rt,Gt,ae){var ce,Te;function ye(fr,gr){for(var Lr=gr<0?-1:1,Hr=Gt[+(gr<0)],nn=0,cn=Hr.length-1;nnHr[nn][2][0];++nn);var Mn=Rt(fr-Hr[nn][1][0],gr);return Mn[0]+=Rt(Hr[nn][1][0],Lr*gr>Lr*Hr[nn][0][1]?Hr[nn][0][1]:gr)[0],Mn}ae?ye.invert=ae(ye):Rt.invert&&(ye.invert=function(fr,gr){for(var Lr=Te[+(gr<0)],Hr=Gt[+(gr<0)],nn=0,cn=Lr.length;nnMn&&(Jn=cn,cn=Mn,Mn=Jn),[[Hr,cn],[nn,Mn]]})}),ze):Gt.map(function(gr){return gr.map(function(Lr){return[[Lr[0][0]*b,Lr[0][1]*b],[Lr[1][0]*b,Lr[1][1]*b],[Lr[2][0]*b,Lr[2][1]*b]]})})},Gt!=null&&ze.lobes(Gt),ze}var $s=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]];function fl(){return Bi(Ut,$s).scale(160.857)}var Jo=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]];function us(){return Bi(Ms,Jo).scale(152.63)}var Ss=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]];function Ls(){return Bi(Zt,Ss).scale(169.529)}var xl=[[[[-180,0],[-90,90],[0,0]],[[0,0],[90,90],[180,0]]],[[[-180,0],[-90,-90],[0,0]],[[0,0],[90,-90],[180,0]]]];function bu(){return Bi(Zt,xl).scale(169.529).rotate([20,0])}var au=[[[[-180,35],[-30,90],[0,35]],[[0,35],[30,90],[180,35]]],[[[-180,-10],[-102,-90],[-65,-10]],[[-65,-10],[5,-90],[77,-10]],[[77,-10],[103,-90],[180,-10]]]];function fu(){return Bi(li,au,It).rotate([-20,-55]).scale(164.263).center([0,-5.4036])}var zc=[[[[-180,0],[-110,90],[-40,0]],[[-40,0],[0,90],[40,0]],[[40,0],[110,90],[180,0]]],[[[-180,0],[-110,-90],[-40,0]],[[-40,0],[0,-90],[40,0]],[[40,0],[110,-90],[180,0]]]];function _c(){return Bi(ue,zc).scale(152.63).rotate([-20,0])}function cs(Rt,Gt){return[3/h*Rt*B(y*y/3-Gt*Gt),Gt]}cs.invert=function(Rt,Gt){return[h/3*Rt/B(y*y/3-Gt*Gt),Gt]};function Gl(){return d.geoProjection(cs).scale(158.837)}function Lc(Rt){function Gt(ae,ce){if(A(A(ce)-S)2)return null;ae/=2,ce/=2;var ye=ae*ae,ze=ce*ce,rr=2*ce/(1+ye+ze);return rr=f((1+rr)/(1-rr),1/Rt),[e(2*ae,1-ye-ze)/Rt,z((rr-1)/(rr+1))]},Gt}function Al(){var Rt=.5,Gt=d.geoProjectionMutator(Lc),ae=Gt(Rt);return ae.spacing=function(ce){return arguments.length?Gt(Rt=+ce):Rt},ae.scale(124.75)}var _l=y/T;function Ml(Rt,Gt){return[Rt*(1+B(r(Gt)))/2,Gt/(r(Gt/2)*r(Rt/6))]}Ml.invert=function(Rt,Gt){var ae=A(Rt),ce=A(Gt),Te=l,ye=S;ce<_l?ye*=ce/_l:Te+=6*D(_l/ce);for(var ze=0;ze<25;ze++){var rr=m(ye),fr=B(r(ye)),gr=m(ye/2),Lr=r(ye/2),Hr=m(Te/6),nn=r(Te/6),cn=.5*Te*(1+fr)-ae,Mn=ye/(Lr*nn)-ce,Jn=fr?-.25*Te*rr/fr:0,_a=.5*(1+fr),xa=(1+.5*ye*gr/Lr)/(Lr*nn),La=ye/Lr*(Hr/6)/(nn*nn),ai=Jn*La-xa*_a,Ai=(cn*La-Mn*_a)/ai,mi=(Mn*Jn-cn*xa)/ai;if(ye-=Ai,Te-=mi,A(Ai)l||A(_a)>l)&&--Te>0);return Te&&[ae,ce]};function bl(){return d.geoProjection(Fs).scale(139.98)}function Fo(Rt,Gt){return[m(Rt)/r(Gt),w(Gt)*r(Rt)]}Fo.invert=function(Rt,Gt){var ae=Rt*Rt,ce=Gt*Gt,Te=ce+1,ye=ae+Te,ze=Rt?M*B((ye-B(ye*ye-4*ae))/ae):1/B(Te);return[z(Rt*ze),g(Gt)*D(ze)]};function bs(){return d.geoProjection(Fo).scale(144.049).clipAngle(90-.001)}function Iu(Rt){var Gt=r(Rt),ae=w(k+Rt/2);function ce(Te,ye){var ze=ye-Rt,rr=A(ze)=0;)Lr=Rt[gr],Hr=Lr[0]+rr*(cn=Hr)-fr*nn,nn=Lr[1]+rr*nn+fr*cn;return Hr=rr*(cn=Hr)-fr*nn,nn=rr*nn+fr*cn,[Hr,nn]}return ae.invert=function(ce,Te){var ye=20,ze=ce,rr=Te;do{for(var fr=Gt,gr=Rt[fr],Lr=gr[0],Hr=gr[1],nn=0,cn=0,Mn;--fr>=0;)gr=Rt[fr],nn=Lr+ze*(Mn=nn)-rr*cn,cn=Hr+ze*cn+rr*Mn,Lr=gr[0]+ze*(Mn=Lr)-rr*Hr,Hr=gr[1]+ze*Hr+rr*Mn;nn=Lr+ze*(Mn=nn)-rr*cn,cn=Hr+ze*cn+rr*Mn,Lr=ze*(Mn=Lr)-rr*Hr-ce,Hr=ze*Hr+rr*Mn-Te;var Jn=nn*nn+cn*cn,_a,xa;ze-=_a=(Lr*nn+Hr*cn)/Jn,rr-=xa=(Hr*nn-Lr*cn)/Jn}while(A(_a)+A(xa)>l*l&&--ye>0);if(ye){var La=B(ze*ze+rr*rr),ai=2*t(La*.5),Ai=m(ai);return[e(ze*Ai,La*r(ai)),La?z(rr*Ai/La):0]}},ae}var Oo=[[.9972523,0],[.0052513,-.0041175],[.0074606,.0048125],[-.0153783,-.1968253],[.0636871,-.1408027],[.3660976,-.2937382]],yf=[[.98879,0],[0,0],[-.050909,0],[0,0],[.075528,0]],os=[[.984299,0],[.0211642,.0037608],[-.1036018,-.0575102],[-.0329095,-.0320119],[.0499471,.1223335],[.026046,.0899805],[7388e-7,-.1435792],[.0075848,-.1334108],[-.0216473,.0776645],[-.0225161,.0853673]],Fi=[[.9245,0],[0,0],[.01943,0]],ac=[[.721316,0],[0,0],[-.00881625,-.00617325]];function pu(){return wl(Oo,[152,-64]).scale(1400).center([-160.908,62.4864]).clipAngle(30).angle(7.8)}function ml(){return wl(yf,[95,-38]).scale(1e3).clipAngle(55).center([-96.5563,38.8675])}function Cc(){return wl(os,[120,-45]).scale(359.513).clipAngle(55).center([-117.474,53.0628])}function Wu(){return wl(Fi,[-20,-18]).scale(209.091).center([20,16.7214]).clipAngle(82)}function mc(){return wl(ac,[165,10]).scale(250).clipAngle(130).center([-165,-10])}function wl(Rt,Gt){var ae=d.geoProjection(sf(Rt)).rotate(Gt).clipAngle(90),ce=d.geoRotation(Gt),Te=ae.center;return delete ae.rotate,ae.center=function(ye){return arguments.length?Te(ce(ye)):ce.invert(Te())},ae}var Xc=B(6),Bc=B(7);function gc(Rt,Gt){var ae=z(7*m(Gt)/(3*Xc));return[Xc*Rt*(2*r(2*ae/3)-1)/Bc,9*m(ae/3)/Bc]}gc.invert=function(Rt,Gt){var ae=3*z(Gt*Bc/9);return[Rt*Bc/(Xc*(2*r(2*ae/3)-1)),z(m(ae)*3*Xc/7)]};function Gu(){return d.geoProjection(gc).scale(164.859)}function Ic(Rt,Gt){for(var ae=(1+M)*m(Gt),ce=Gt,Te=0,ye;Te<25&&(ce-=ye=(m(ce/2)+m(ce)-ae)/(.5*r(ce/2)+r(ce)),!(A(ye)x&&--ce>0);return ye=ae*ae,ze=ye*ye,rr=ye*ze,[Rt/(.84719-.13063*ye+rr*rr*(-.04515+.05494*ye-.02326*ze+.00331*rr)),ae]};function wu(){return d.geoProjection(Pu).scale(175.295)}function Tl(Rt,Gt){return[Rt*(1+r(Gt))/2,2*(Gt-w(Gt/2))]}Tl.invert=function(Rt,Gt){for(var ae=Gt/2,ce=0,Te=1/0;ce<10&&A(Te)>l;++ce){var ye=r(Gt/2);Gt-=Te=(Gt-w(Gt/2)-ae)/(1-.5/(ye*ye))}return[2*Rt/(1+r(Gt)),Gt]};function Qu(){return d.geoProjection(Tl).scale(152.63)}var Oc=[[[[-180,0],[-90,90],[0,0]],[[0,0],[90,90],[180,0]]],[[[-180,0],[-90,-90],[0,0]],[[0,0],[90,-90],[180,0]]]];function Es(){return Bi(dt(1/0),Oc).rotate([20,0]).scale(152.63)}function bc(Rt,Gt){var ae=m(Gt),ce=r(Gt),Te=g(Rt);if(Rt===0||A(Gt)===S)return[0,Gt];if(Gt===0)return[Rt,0];if(A(Rt)===S)return[Rt*ce,S*ae];var ye=y/(2*Rt)-2*Rt/y,ze=2*Gt/y,rr=(1-ze*ze)/(ae-ze),fr=ye*ye,gr=rr*rr,Lr=1+fr/gr,Hr=1+gr/fr,nn=(ye*ae/rr-ye/2)/Lr,cn=(gr*ae/fr+rr/2)/Hr,Mn=nn*nn+ce*ce/Lr,Jn=cn*cn-(gr*ae*ae/fr+rr*ae-1)/Hr;return[S*(nn+B(Mn)*Te),S*(cn+B(Jn<0?0:Jn)*g(-Gt*ye)*Te)]}bc.invert=function(Rt,Gt){Rt/=S,Gt/=S;var ae=Rt*Rt,ce=Gt*Gt,Te=ae+ce,ye=y*y;return[Rt?(Te-1+B((1-Te)*(1-Te)+4*ae))/(2*Rt)*S:0,Ct(function(ze){return Te*(y*m(ze)-2*ze)*y+4*ze*ze*(Gt-m(ze))+2*y*ze-ye*Gt},0)]};function lf(){return d.geoProjection(bc).scale(127.267)}var Nc=1.0148,vc=.23185,jc=-.14499,Zl=.02406,Uc=Nc,rl=5*vc,Kl=7*jc,Zu=9*Zl,Bs=1.790857183;function Ou(Rt,Gt){var ae=Gt*Gt;return[Rt,Gt*(Nc+ae*ae*(vc+ae*(jc+Zl*ae)))]}Ou.invert=function(Rt,Gt){Gt>Bs?Gt=Bs:Gt<-Bs&&(Gt=-Bs);var ae=Gt,ce;do{var Te=ae*ae;ae-=ce=(ae*(Nc+Te*Te*(vc+Te*(jc+Zl*Te)))-Gt)/(Uc+Te*Te*(rl+Te*(Kl+Zu*Te)))}while(A(ce)>l);return[Rt,ae]};function Rl(){return d.geoProjection(Ou).scale(139.319)}function Yl(Rt,Gt){if(A(Gt)l&&--Te>0);return ze=w(ce),[(A(Gt)=0;)if(ce=Gt[rr],ae[0]===ce[0]&&ae[1]===ce[1]){if(ye)return[ye,ae];ye=ae}}}function iu(Rt){for(var Gt=Rt.length,ae=[],ce=Rt[Gt-1],Te=0;Te0?[-ce[0],0]:[180-ce[0],180])};var Gt=ku.map(function(ae){return{face:ae,project:Rt(ae)}});return[-1,0,0,1,0,1,4,5].forEach(function(ae,ce){var Te=Gt[ae];Te&&(Te.children||(Te.children=[])).push(Gt[ce])}),oc(Gt[0],function(ae,ce){return Gt[ae<-y/2?ce<0?6:4:ae<0?ce<0?2:0:aece^cn>ce&&ae<(nn-gr)*(ce-Lr)/(cn-Lr)+gr&&(Te=!Te)}return Te}function zl(Rt,Gt){var ae=Gt.stream,ce;if(!ae)throw new Error("invalid projection");switch(Rt&&Rt.type){case"Feature":ce=su;break;case"FeatureCollection":ce=Vc;break;default:ce=Au;break}return ce(Rt,ae)}function Vc(Rt,Gt){return{type:"FeatureCollection",features:Rt.features.map(function(ae){return su(ae,Gt)})}}function su(Rt,Gt){return{type:"Feature",id:Rt.id,properties:Rt.properties,geometry:Au(Rt.geometry,Gt)}}function Fu(Rt,Gt){return{type:"GeometryCollection",geometries:Rt.geometries.map(function(ae){return Au(ae,Gt)})}}function Au(Rt,Gt){if(!Rt)return null;if(Rt.type==="GeometryCollection")return Fu(Rt,Gt);var ae;switch(Rt.type){case"Point":ae=Mu;break;case"MultiPoint":ae=Mu;break;case"LineString":ae=uc;break;case"MultiLineString":ae=uc;break;case"Polygon":ae=Su;break;case"MultiPolygon":ae=Su;break;case"Sphere":ae=Su;break;default:return null}return d.geoStream(Rt,Gt(ae)),ae.result()}var il=[],Cs=[],Mu={point:function(Rt,Gt){il.push([Rt,Gt])},result:function(){var Rt=il.length?il.length<2?{type:"Point",coordinates:il[0]}:{type:"MultiPoint",coordinates:il}:null;return il=[],Rt}},uc={lineStart:Xu,point:function(Rt,Gt){il.push([Rt,Gt])},lineEnd:function(){il.length&&(Cs.push(il),il=[])},result:function(){var Rt=Cs.length?Cs.length<2?{type:"LineString",coordinates:Cs[0]}:{type:"MultiLineString",coordinates:Cs}:null;return Cs=[],Rt}},Su={polygonStart:Xu,lineStart:Xu,point:function(Rt,Gt){il.push([Rt,Gt])},lineEnd:function(){var Rt=il.length;if(Rt){do il.push(il[0].slice());while(++Rt<4);Cs.push(il),il=[]}},polygonEnd:Xu,result:function(){if(!Cs.length)return null;var Rt=[],Gt=[];return Cs.forEach(function(ae){xc(ae)?Rt.push([ae]):Gt.push(ae)}),Gt.forEach(function(ae){var ce=ae[0];Rt.some(function(Te){if(cf(Te[0],ce))return Te.push(ae),!0})||Rt.push([ae])}),Cs=[],Rt.length?Rt.length>1?{type:"MultiPolygon",coordinates:Rt}:{type:"Polygon",coordinates:Rt[0]}:null}};function Dc(Rt){var Gt=Rt(S,0)[0]-Rt(-S,0)[0];function ae(ce,Te){var ye=A(ce)0?ce-y:ce+y,Te),rr=(ze[0]-ze[1])*M,fr=(ze[0]+ze[1])*M;if(ye)return[rr,fr];var gr=Gt*M,Lr=rr>0^fr>0?-1:1;return[Lr*rr-g(fr)*gr,Lr*fr-g(rr)*gr]}return Rt.invert&&(ae.invert=function(ce,Te){var ye=(ce+Te)*M,ze=(Te-ce)*M,rr=A(ye)<.5*Gt&&A(ze)<.5*Gt;if(!rr){var fr=Gt*M,gr=ye>0^ze>0?-1:1,Lr=-gr*ce+(ze>0?1:-1)*fr,Hr=-gr*Te+(ye>0?1:-1)*fr;ye=(-Lr-Hr)*M,ze=(Lr-Hr)*M}var nn=Rt.invert(ye,ze);return rr||(nn[0]+=ye>0?y:-y),nn}),d.geoProjection(ae).rotate([-90,-90,45]).clipAngle(180-.001)}function Xe(){return Dc(Qr).scale(176.423)}function yr(){return Dc(Ti).scale(111.48)}function Kr(Rt,Gt){if(!(0<=(Gt=+Gt)&&Gt<=20))throw new Error("invalid digits");function ae(gr){var Lr=gr.length,Hr=2,nn=new Array(Lr);for(nn[0]=+gr[0].toFixed(Gt),nn[1]=+gr[1].toFixed(Gt);Hr2||cn[0]!=Lr[0]||cn[1]!=Lr[1])&&(Hr.push(cn),Lr=cn)}return Hr.length===1&&gr.length>1&&Hr.push(ae(gr[gr.length-1])),Hr}function ye(gr){return gr.map(Te)}function ze(gr){if(gr==null)return gr;var Lr;switch(gr.type){case"GeometryCollection":Lr={type:"GeometryCollection",geometries:gr.geometries.map(ze)};break;case"Point":Lr={type:"Point",coordinates:ae(gr.coordinates)};break;case"MultiPoint":Lr={type:gr.type,coordinates:ce(gr.coordinates)};break;case"LineString":Lr={type:gr.type,coordinates:Te(gr.coordinates)};break;case"MultiLineString":case"Polygon":Lr={type:gr.type,coordinates:ye(gr.coordinates)};break;case"MultiPolygon":Lr={type:"MultiPolygon",coordinates:gr.coordinates.map(ye)};break;default:return gr}return gr.bbox!=null&&(Lr.bbox=gr.bbox),Lr}function rr(gr){var Lr={type:"Feature",properties:gr.properties,geometry:ze(gr.geometry)};return gr.id!=null&&(Lr.id=gr.id),gr.bbox!=null&&(Lr.bbox=gr.bbox),Lr}if(Rt!=null)switch(Rt.type){case"Feature":return rr(Rt);case"FeatureCollection":{var fr={type:"FeatureCollection",features:Rt.features.map(rr)};return Rt.bbox!=null&&(fr.bbox=Rt.bbox),fr}default:return ze(Rt)}return Rt}function Rr(Rt){var Gt=m(Rt);function ae(ce,Te){var ye=Gt?w(ce*Gt/2)/Gt:ce/2;if(!Te)return[2*ye,-Rt];var ze=2*t(ye*m(Te)),rr=1/w(Te);return[m(ze)*rr,Te+(1-r(ze))*rr-Rt]}return ae.invert=function(ce,Te){if(A(Te+=Rt)l&&--rr>0);var nn=ce*(gr=w(ze)),cn=w(A(Te)0?S:-S)*(fr+Te*(Lr-ze)/2+Te*Te*(Lr-2*fr+ze)/2)]}ha.invert=function(Rt,Gt){var ae=Gt/S,ce=ae*90,Te=s(18,A(ce/5)),ye=a(0,n(Te));do{var ze=Pn[ye][1],rr=Pn[ye+1][1],fr=Pn[s(19,ye+2)][1],gr=fr-ze,Lr=fr-2*rr+ze,Hr=2*(A(ae)-rr)/gr,nn=Lr/gr,cn=Hr*(1-nn*Hr*(1-2*nn*Hr));if(cn>=0||ye===1){ce=(Gt>=0?5:-5)*(cn+Te);var Mn=50,Jn;do Te=s(18,A(ce)/5),ye=n(Te),cn=Te-ye,ze=Pn[ye][1],rr=Pn[ye+1][1],fr=Pn[s(19,ye+2)][1],ce-=(Jn=(Gt>=0?S:-S)*(rr+cn*(fr-ze)/2+cn*cn*(fr-2*rr+ze)/2)-Gt)*b;while(A(Jn)>x&&--Mn>0);break}}while(--ye>=0);var _a=Pn[ye][0],xa=Pn[ye+1][0],La=Pn[s(19,ye+2)][0];return[Rt/(xa+cn*(La-_a)/2+cn*cn*(La-2*xa+_a)/2),ce*_]};function Ta(){return d.geoProjection(ha).scale(152.63)}function Ua(Rt){function Gt(ae,ce){var Te=r(ce),ye=(Rt-1)/(Rt-Te*r(ae));return[ye*Te*m(ae),ye*m(ce)]}return Gt.invert=function(ae,ce){var Te=ae*ae+ce*ce,ye=B(Te),ze=(Rt-B(1-Te*(Rt+1)/(Rt-1)))/((Rt-1)/ye+ye/(Rt-1));return[e(ae*ze,ye*B(1-ze*ze)),ye?z(ce*ze/ye):0]},Gt}function Ya(Rt,Gt){var ae=Ua(Rt);if(!Gt)return ae;var ce=r(Gt),Te=m(Gt);function ye(ze,rr){var fr=ae(ze,rr),gr=fr[1],Lr=gr*Te/(Rt-1)+ce;return[fr[0]*ce/Lr,gr/Lr]}return ye.invert=function(ze,rr){var fr=(Rt-1)/(Rt-1-rr*Te);return ae.invert(fr*ze,fr*rr*ce)},ye}function va(){var Rt=2,Gt=0,ae=d.geoProjectionMutator(Ya),ce=ae(Rt,Gt);return ce.distance=function(Te){return arguments.length?ae(Rt=+Te,Gt):Rt},ce.tilt=function(Te){return arguments.length?ae(Rt,Gt=Te*_):Gt*b},ce.scale(432.147).clipAngle(D(1/Rt)*b-1e-6)}var Ba=1e-4,za=1e4,ca=-180,ei=ca+Ba,Vi=180,Oi=Vi-Ba,Wi=-90,Xi=Wi+Ba,ni=90,Za=ni-Ba;function $i(Rt){return Rt.length>0}function Do(Rt){return Math.floor(Rt*za)/za}function ss(Rt){return Rt===Wi||Rt===ni?[0,Rt]:[ca,Do(Rt)]}function Ps(Rt){var Gt=Rt[0],ae=Rt[1],ce=!1;return Gt<=ei?(Gt=ca,ce=!0):Gt>=Oi&&(Gt=Vi,ce=!0),ae<=Xi?(ae=Wi,ce=!0):ae>=Za&&(ae=ni,ce=!0),ce?[Gt,ae]:Rt}function ys(Rt){return Rt.map(Ps)}function Os(Rt,Gt,ae){for(var ce=0,Te=Rt.length;ce=Oi||Lr<=Xi||Lr>=Za){ye[ze]=Ps(fr);for(var Hr=ze+1;Hrei&&cnXi&&Mn=rr)break;ae.push({index:-1,polygon:Gt,ring:ye=ye.slice(Hr-1)}),ye[0]=ss(ye[0][1]),ze=-1,rr=ye.length}}}}function Yo(Rt){var Gt,ae=Rt.length,ce={},Te={},ye,ze,rr,fr,gr;for(Gt=0;Gt0?y-rr:rr)*b],gr=d.geoProjection(Rt(ze)).rotate(fr),Lr=d.geoRotation(fr),Hr=gr.center;return delete gr.rotate,gr.center=function(nn){return arguments.length?Hr(Lr(nn)):Lr.invert(Hr())},gr.clipAngle(90)}function fs(Rt){var Gt=r(Rt);function ae(ce,Te){var ye=d.geoGnomonicRaw(ce,Te);return ye[0]*=Gt,ye}return ae.invert=function(ce,Te){return d.geoGnomonicRaw.invert(ce/Gt,Te)},ae}function Ll(){return $l([-158,21.5],[-77,39]).clipAngle(60).scale(400)}function $l(Rt,Gt){return ws(fs,Rt,Gt)}function jl(Rt){if(!(Rt*=2))return d.geoAzimuthalEquidistantRaw;var Gt=-Rt/2,ae=-Gt,ce=Rt*Rt,Te=w(ae),ye=.5/m(ae);function ze(rr,fr){var gr=D(r(fr)*r(rr-Gt)),Lr=D(r(fr)*r(rr-ae)),Hr=fr<0?-1:1;return gr*=gr,Lr*=Lr,[(gr-Lr)/(2*Rt),Hr*B(4*ce*Lr-(ce-gr+Lr)*(ce-gr+Lr))/(2*Rt)]}return ze.invert=function(rr,fr){var gr=fr*fr,Lr=r(B(gr+(nn=rr+Gt)*nn)),Hr=r(B(gr+(nn=rr+ae)*nn)),nn,cn;return[e(cn=Lr-Hr,nn=(Lr+Hr)*Te),(fr<0?-1:1)*D(B(nn*nn+cn*cn)*ye)]},ze}function Bu(){return Jl([-158,21.5],[-77,39]).clipAngle(130).scale(122.571)}function Jl(Rt,Gt){return ws(jl,Rt,Gt)}function Ru(Rt,Gt){if(A(Gt)l&&--rr>0);return[g(Rt)*(B(Te*Te+4)+Te)*y/4,S*ze]};function Fc(){return d.geoProjection(ul).scale(127.16)}function Pt(Rt,Gt,ae,ce,Te){function ye(ze,rr){var fr=ae*m(ce*rr),gr=B(1-fr*fr),Lr=B(2/(1+gr*r(ze*=Te)));return[Rt*gr*Lr*m(ze),Gt*fr*Lr]}return ye.invert=function(ze,rr){var fr=ze/Rt,gr=rr/Gt,Lr=B(fr*fr+gr*gr),Hr=2*z(Lr/2);return[e(ze*w(Hr),Rt*Lr)/Te,Lr&&z(rr*m(Hr)/(Gt*ae*Lr))/ce]},ye}function L(Rt,Gt,ae,ce){var Te=y/3;Rt=a(Rt,l),Gt=a(Gt,l),Rt=s(Rt,S),Gt=s(Gt,y-l),ae=a(ae,0),ae=s(ae,100-l),ce=a(ce,l);var ye=ae/100+1,ze=ce/100,rr=D(ye*r(Te))/Te,fr=m(Rt)/m(rr*S),gr=Gt/y,Lr=B(ze*m(Rt/2)/m(Gt/2)),Hr=Lr/B(gr*fr*rr),nn=1/(Lr*B(gr*fr*rr));return Pt(Hr,nn,fr,rr,gr)}function at(){var Rt=65*_,Gt=60*_,ae=20,ce=200,Te=d.geoProjectionMutator(L),ye=Te(Rt,Gt,ae,ce);return ye.poleline=function(ze){return arguments.length?Te(Rt=+ze*_,Gt,ae,ce):Rt*b},ye.parallels=function(ze){return arguments.length?Te(Rt,Gt=+ze*_,ae,ce):Gt*b},ye.inflation=function(ze){return arguments.length?Te(Rt,Gt,ae=+ze,ce):ae},ye.ratio=function(ze){return arguments.length?Te(Rt,Gt,ae,ce=+ze):ce},ye.scale(163.775)}function xt(){return at().poleline(65).parallels(60).inflation(0).ratio(200).scale(172.633)}var kt=4*y+3*B(3),Lt=2*B(2*y*B(3)/kt),le=ee(Lt*B(3)/y,Lt,kt/6);function xe(){return d.geoProjection(le).scale(176.84)}function Pe(Rt,Gt){return[Rt*B(1-3*Gt*Gt/(y*y)),Gt]}Pe.invert=function(Rt,Gt){return[Rt/B(1-3*Gt*Gt/(y*y)),Gt]};function $e(){return d.geoProjection(Pe).scale(152.63)}function hr(Rt,Gt){var ae=r(Gt),ce=r(Rt)*ae,Te=1-ce,ye=r(Rt=e(m(Rt)*ae,-m(Gt))),ze=m(Rt);return ae=B(1-ce*ce),[ze*ae-ye*Te,-ye*ae-ze*Te]}hr.invert=function(Rt,Gt){var ae=(Rt*Rt+Gt*Gt)/-2,ce=B(-ae*(2+ae)),Te=Gt*ae+Rt*ce,ye=Rt*ae-Gt*ce,ze=B(ye*ye+Te*Te);return[e(ce*Te,ze*(1+ae)),ze?-z(ce*ye/ze):0]};function pr(){return d.geoProjection(hr).rotate([0,-90,45]).scale(124.75).clipAngle(180-.001)}function Br(Rt,Gt){var ae=ct(Rt,Gt);return[(ae[0]+Rt/S)/2,(ae[1]+Gt)/2]}Br.invert=function(Rt,Gt){var ae=Rt,ce=Gt,Te=25;do{var ye=r(ce),ze=m(ce),rr=m(2*ce),fr=ze*ze,gr=ye*ye,Lr=m(ae),Hr=r(ae/2),nn=m(ae/2),cn=nn*nn,Mn=1-gr*Hr*Hr,Jn=Mn?D(ye*Hr)*B(_a=1/Mn):_a=0,_a,xa=.5*(2*Jn*ye*nn+ae/S)-Rt,La=.5*(Jn*ze+ce)-Gt,ai=.5*_a*(gr*cn+Jn*ye*Hr*fr)+.5/S,Ai=_a*(Lr*rr/4-Jn*ze*nn),mi=.125*_a*(rr*nn-Jn*ze*gr*Lr),Yi=.5*_a*(fr*Hr+Jn*cn*ye)+.5,Go=Ai*mi-Yi*ai,Xo=(La*Ai-xa*Yi)/Go,po=(xa*mi-La*ai)/Go;ae-=Xo,ce-=po}while((A(Xo)>l||A(po)>l)&&--Te>0);return[ae,ce]};function Jr(){return d.geoProjection(Br).scale(158.837)}u.geoNaturalEarth=d.geoNaturalEarth1,u.geoNaturalEarthRaw=d.geoNaturalEarth1Raw,u.geoAiry=rt,u.geoAiryRaw=G,u.geoAitoff=st,u.geoAitoffRaw=ct,u.geoArmadillo=Z,u.geoArmadilloRaw=et,u.geoAugust=X,u.geoAugustRaw=ot,u.geoBaker=q,u.geoBakerRaw=J,u.geoBerghaus=nt,u.geoBerghausRaw=it,u.geoBertin1953=te,u.geoBertin1953Raw=Nt,u.geoBoggs=re,u.geoBoggsRaw=Ut,u.geoBonne=We,u.geoBonneRaw=Ce,u.geoBottomley=vr,u.geoBottomleyRaw=qe,u.geoBromley=er,u.geoBromleyRaw=_r,u.geoChamberlin=lt,u.geoChamberlinRaw=Dt,u.geoChamberlinAfrica=_t,u.geoCollignon=St,u.geoCollignonRaw=yt,u.geoCraig=Yt,u.geoCraigRaw=Ht,u.geoCraster=Ee,u.geoCrasterRaw=ke,u.geoCylindricalEqualArea=ir,u.geoCylindricalEqualAreaRaw=Ue,u.geoCylindricalStereographic=Ye,u.geoCylindricalStereographicRaw=ar,u.geoEckert1=pn,u.geoEckert1Raw=Er,u.geoEckert2=bn,u.geoEckert2Raw=dn,u.geoEckert3=En,u.geoEckert3Raw=Zn,u.geoEckert4=da,u.geoEckert4Raw=gn,u.geoEckert5=Se,u.geoEckert5Raw=ra,u.geoEckert6=Ze,u.geoEckert6Raw=Re,u.geoEisenlohr=tn,u.geoEisenlohrRaw=zr,u.geoFahey=In,u.geoFaheyRaw=$r,u.geoFoucaut=Kn,u.geoFoucautRaw=Nn,u.geoFoucautSinusoidal=ia,u.geoFoucautSinusoidalRaw=$n,u.geoGilbert=Ga,u.geoGingery=br,u.geoGingeryRaw=ve,u.geoGinzburg4=kr,u.geoGinzburg4Raw=mr,u.geoGinzburg5=Or,u.geoGinzburg5Raw=Ur,u.geoGinzburg6=Ke,u.geoGinzburg6Raw=pe,u.geoGinzburg8=Gr,u.geoGinzburg8Raw=xr,u.geoGinzburg9=wn,u.geoGinzburg9Raw=ln,u.geoGringorten=Qn,u.geoGringortenRaw=Qr,u.geoGuyou=Hi,u.geoGuyouRaw=Ti,u.geoHammer=wt,u.geoHammerRaw=dt,u.geoHammerRetroazimuthal=zo,u.geoHammerRetroazimuthalRaw=Ho,u.geoHealpix=ts,u.geoHealpixRaw=hs,u.geoHill=As,u.geoHillRaw=vs,u.geoHomolosine=Di,u.geoHomolosineRaw=Ms,u.geoHufnagel=No,u.geoHufnagelRaw=_s,u.geoHyperelliptical=io,u.geoHyperellipticalRaw=ii,u.geoInterrupt=Bi,u.geoInterruptedBoggs=fl,u.geoInterruptedHomolosine=us,u.geoInterruptedMollweide=Ls,u.geoInterruptedMollweideHemispheres=bu,u.geoInterruptedSinuMollweide=fu,u.geoInterruptedSinusoidal=_c,u.geoKavrayskiy7=Gl,u.geoKavrayskiy7Raw=cs,u.geoLagrange=Al,u.geoLagrangeRaw=Lc,u.geoLarrivee=hu,u.geoLarriveeRaw=Ml,u.geoLaskowski=bl,u.geoLaskowskiRaw=Fs,u.geoLittrow=bs,u.geoLittrowRaw=Fo,u.geoLoximuthal=Nl,u.geoLoximuthalRaw=Iu,u.geoMiller=qs,u.geoMillerRaw=qu,u.geoModifiedStereographic=wl,u.geoModifiedStereographicRaw=sf,u.geoModifiedStereographicAlaska=pu,u.geoModifiedStereographicGs48=ml,u.geoModifiedStereographicGs50=Cc,u.geoModifiedStereographicMiller=Wu,u.geoModifiedStereographicLee=mc,u.geoMollweide=mt,u.geoMollweideRaw=Zt,u.geoMtFlatPolarParabolic=Gu,u.geoMtFlatPolarParabolicRaw=gc,u.geoMtFlatPolarQuartic=Pc,u.geoMtFlatPolarQuarticRaw=Ic,u.geoMtFlatPolarSinusoidal=Rc,u.geoMtFlatPolarSinusoidalRaw=du,u.geoNaturalEarth2=wu,u.geoNaturalEarth2Raw=Pu,u.geoNellHammer=Qu,u.geoNellHammerRaw=Tl,u.geoInterruptedQuarticAuthalic=Es,u.geoNicolosi=lf,u.geoNicolosiRaw=bc,u.geoPatterson=Rl,u.geoPattersonRaw=Ou,u.geoPolyconic=Ws,u.geoPolyconicRaw=Yl,u.geoPolyhedral=oc,u.geoPolyhedralButterfly=Gs,u.geoPolyhedralCollignon=$c,u.geoPolyhedralWaterman=Vs,u.geoProject=zl,u.geoGringortenQuincuncial=Xe,u.geoPeirceQuincuncial=yr,u.geoPierceQuincuncial=yr,u.geoQuantize=Kr,u.geoQuincuncial=Dc,u.geoRectangularPolyconic=mn,u.geoRectangularPolyconicRaw=Rr,u.geoRobinson=Ta,u.geoRobinsonRaw=ha,u.geoSatellite=va,u.geoSatelliteRaw=Ya,u.geoSinuMollweide=wo,u.geoSinuMollweideRaw=li,u.geoSinusoidal=Me,u.geoSinusoidalRaw=ue,u.geoStitch=Rs,u.geoTimes=so,u.geoTimesRaw=bi,u.geoTwoPointAzimuthal=$l,u.geoTwoPointAzimuthalRaw=fs,u.geoTwoPointAzimuthalUsa=Ll,u.geoTwoPointEquidistant=Jl,u.geoTwoPointEquidistantRaw=jl,u.geoTwoPointEquidistantUsa=Bu,u.geoVanDerGrinten=nl,u.geoVanDerGrintenRaw=Ru,u.geoVanDerGrinten2=Ui,u.geoVanDerGrinten2Raw=Nu,u.geoVanDerGrinten3=Ql,u.geoVanDerGrinten3Raw=fo,u.geoVanDerGrinten4=Fc,u.geoVanDerGrinten4Raw=ul,u.geoWagner=at,u.geoWagner7=xt,u.geoWagnerRaw=L,u.geoWagner4=xe,u.geoWagner4Raw=le,u.geoWagner6=$e,u.geoWagner6Raw=Pe,u.geoWiechel=pr,u.geoWiechelRaw=hr,u.geoWinkel3=Jr,u.geoWinkel3Raw=Br,Object.defineProperty(u,"__esModule",{value:!0})})}),zE=Vt((K,V)=>{var u=Ni(),d=Xr(),E=ji(),A=Math.PI/180,t=180/Math.PI,e={cursor:"pointer"},r={cursor:"auto"};function i(b,_){var P=b.projection,z;return _._isScoped?z=a:_._isClipped?z=f:z=s,z(b,P)}V.exports=i;function n(b,_){return u.behavior.zoom().translate(_.translate()).scale(_.scale())}function o(b,_,P){var z=b.id,D=b.graphDiv,B=D.layout,R=B[z],I=D._fullLayout,F=I[z],j={},N={};function G(rt,ct){j[z+"."+rt]=d.nestedProperty(R,rt).get(),E.call("_storeDirectGUIEdit",B,I._preGUI,j);var st=d.nestedProperty(F,rt);st.get()!==ct&&(st.set(ct),d.nestedProperty(R,rt).set(ct),N[z+"."+rt]=ct)}P(G),G("projection.scale",_.scale()/b.fitScale),G("fitbounds",!1),D.emit("plotly_relayout",N)}function a(b,_){var P=n(b,_);function z(){u.select(this).style(e)}function D(){_.scale(u.event.scale).translate(u.event.translate),b.render(!0);var I=_.invert(b.midPt);b.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":_.scale()/b.fitScale,"geo.center.lon":I[0],"geo.center.lat":I[1]})}function B(I){var F=_.invert(b.midPt);I("center.lon",F[0]),I("center.lat",F[1])}function R(){u.select(this).style(r),o(b,_,B)}return P.on("zoomstart",z).on("zoom",D).on("zoomend",R),P}function s(b,_){var P=n(b,_),z=2,D,B,R,I,F,j,N,G,rt;function ct(Q){return _.invert(Q)}function st(Q){var ut=ct(Q);if(!ut)return!0;var J=_(ut);return Math.abs(J[0]-Q[0])>z||Math.abs(J[1]-Q[1])>z}function et(){u.select(this).style(e),D=u.mouse(this),B=_.rotate(),R=_.translate(),I=B,F=ct(D)}function Z(){if(j=u.mouse(this),st(D)){P.scale(_.scale()),P.translate(_.translate());return}_.scale(u.event.scale),_.translate([R[0],u.event.translate[1]]),F?ct(j)&&(G=ct(j),N=[I[0]+(G[0]-F[0]),B[1],B[2]],_.rotate(N),I=N):(D=j,F=ct(D)),rt=!0,b.render(!0);var Q=_.rotate(),ut=_.invert(b.midPt);b.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":_.scale()/b.fitScale,"geo.center.lon":ut[0],"geo.center.lat":ut[1],"geo.projection.rotation.lon":-Q[0]})}function ot(){u.select(this).style(r),rt&&o(b,_,X)}function X(Q){var ut=_.rotate(),J=_.invert(b.midPt);Q("projection.rotation.lon",-ut[0]),Q("center.lon",J[0]),Q("center.lat",J[1])}return P.on("zoomstart",et).on("zoom",Z).on("zoomend",ot),P}function f(b,_){_.rotate(),_.scale();var P=n(b,_),z=h(P,"zoomstart","zoom","zoomend"),D=0,B=P.on,R;P.on("zoomstart",function(){u.select(this).style(e);var G=u.mouse(this),rt=_.rotate(),ct=rt,st=_.translate(),et=g(rt);R=v(_,G),B.call(P,"zoom",function(){var Z=u.mouse(this);if(_.scale(u.event.scale),!R)G=Z,R=v(_,G);else if(v(_,Z)){_.rotate(rt).translate(st);var ot=v(_,Z),X=w(R,ot),Q=k(m(et,X)),ut=l(Q,R,ct);(!isFinite(ut[0])||!isFinite(ut[1])||!isFinite(ut[2]))&&(ut=ct),_.rotate(ut),ct=ut}F(z.of(this,arguments))}),I(z.of(this,arguments))}).on("zoomend",function(){u.select(this).style(r),B.call(P,"zoom",null),j(z.of(this,arguments)),o(b,_,N)}).on("zoom.redraw",function(){b.render(!0);var G=_.rotate();b.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":_.scale()/b.fitScale,"geo.projection.rotation.lon":-G[0],"geo.projection.rotation.lat":-G[1]})});function I(G){D++||G({type:"zoomstart"})}function F(G){G({type:"zoom"})}function j(G){--D||G({type:"zoomend"})}function N(G){var rt=_.rotate();G("projection.rotation.lon",-rt[0]),G("projection.rotation.lat",-rt[1])}return u.rebind(P,z,"on")}function v(b,_){var P=b.invert(_);return P&&isFinite(P[0])&&isFinite(P[1])&&M(P)}function g(b){var _=.5*b[0]*A,P=.5*b[1]*A,z=.5*b[2]*A,D=Math.sin(_),B=Math.cos(_),R=Math.sin(P),I=Math.cos(P),F=Math.sin(z),j=Math.cos(z);return[B*I*j+D*R*F,D*I*j-B*R*F,B*R*j+D*I*F,B*I*F-D*R*j]}function m(b,_){var P=b[0],z=b[1],D=b[2],B=b[3],R=_[0],I=_[1],F=_[2],j=_[3];return[P*R-z*I-D*F-B*j,P*I+z*R+D*j-B*F,P*F-z*j+D*R+B*I,P*j+z*F-D*I+B*R]}function w(b,_){if(!(!b||!_)){var P=c(b,_),z=Math.sqrt(T(P,P)),D=.5*Math.acos(Math.max(-1,Math.min(1,T(b,_)))),B=Math.sin(D)/z;return z&&[Math.cos(D),P[2]*B,-P[1]*B,P[0]*B]}}function l(b,_,P){var z=S(_,2,b[0]);z=S(z,1,b[1]),z=S(z,0,b[2]-P[2]);var D=_[0],B=_[1],R=_[2],I=z[0],F=z[1],j=z[2],N=Math.atan2(B,D)*t,G=Math.sqrt(D*D+B*B),rt,ct;Math.abs(F)>G?(ct=(F>0?90:-90)-N,rt=0):(ct=Math.asin(F/G)*t-N,rt=Math.sqrt(G*G-F*F));var st=180-ct-2*N,et=(Math.atan2(j,I)-Math.atan2(R,rt))*t,Z=(Math.atan2(j,I)-Math.atan2(R,-rt))*t,ot=x(P[0],P[1],ct,et),X=x(P[0],P[1],st,Z);return ot<=X?[ct,et,P[2]]:[st,Z,P[2]]}function x(b,_,P,z){var D=y(P-b),B=y(z-_);return Math.sqrt(D*D+B*B)}function y(b){return(b%360+540)%360-180}function S(b,_,P){var z=P*A,D=b.slice(),B=_===0?1:0,R=_===2?1:2,I=Math.cos(z),F=Math.sin(z);return D[B]=b[B]*I-b[R]*F,D[R]=b[R]*I+b[B]*F,D}function k(b){return[Math.atan2(2*(b[0]*b[1]+b[2]*b[3]),1-2*(b[1]*b[1]+b[2]*b[2]))*t,Math.asin(Math.max(-1,Math.min(1,2*(b[0]*b[2]-b[3]*b[1]))))*t,Math.atan2(2*(b[0]*b[3]+b[1]*b[2]),1-2*(b[2]*b[2]+b[3]*b[3]))*t]}function M(b){var _=b[0]*A,P=b[1]*A,z=Math.cos(P);return[z*Math.cos(_),z*Math.sin(_),Math.sin(P)]}function T(b,_){for(var P=0,z=0,D=b.length;z{var u=Ni(),d=N3(),E=d.geoPath,A=d.geoDistance,t=EE(),e=ji(),r=Xr(),i=r.strTranslate,n=Pi(),o=Eo(),a=pc(),s=Vu(),f=yo(),v=Yh().getAutoRange,g=oh(),m=Ec().prepSelect,w=Ec().clearOutline,l=Ec().selectOnClick,x=zE(),y=Lv(),S=Vd(),k=Cx(),M=F3().feature;function T(P){this.id=P.id,this.graphDiv=P.graphDiv,this.container=P.container,this.topojsonURL=P.topojsonURL,this.isStatic=P.staticPlot,this.topojsonName=null,this.topojson=null,this.projection=null,this.scope=null,this.viewInitial=null,this.fitScale=null,this.bounds=null,this.midPt=null,this.hasChoropleth=!1,this.traceHash={},this.layers={},this.basePaths={},this.dataPaths={},this.dataPoints={},this.clipDef=null,this.clipRect=null,this.bgRect=null,this.makeFramework()}var c=T.prototype;V.exports=function(P){return new T(P)},c.plot=function(P,z,D,B){var R=this;if(B)return R.update(P,z,!0);R._geoCalcData=P,R._fullLayout=z;var I=z[this.id],F=[],j=!1;for(var N in y.layerNameToAdjective)if(N!=="frame"&&I["show"+N]){j=!0;break}for(var G=!1,rt=0;rt0&&F._module.calcGeoJSON(I,z)}if(!D){var j=this.updateProjection(P,z);if(j)return;(!this.viewInitial||this.scope!==B.scope)&&this.saveViewInitial(B)}this.scope=B.scope,this.updateBaseLayers(z,B),this.updateDims(z,B),this.updateFx(z,B),s.generalUpdatePerTraceModule(this.graphDiv,this,P,B);var N=this.layers.frontplot.select(".scatterlayer");this.dataPoints.point=N.selectAll(".point"),this.dataPoints.text=N.selectAll("text"),this.dataPaths.line=N.selectAll(".js-line");var G=this.layers.backplot.select(".choroplethlayer");this.dataPaths.choropleth=G.selectAll("path"),this._render()},c.updateProjection=function(P,z){var D=this.graphDiv,B=z[this.id],R=z._size,I=B.domain,F=B.projection,j=B.lonaxis,N=B.lataxis,G=j._ax,rt=N._ax,ct=this.projection=h(B),st=[[R.l+R.w*I.x[0],R.t+R.h*(1-I.y[1])],[R.l+R.w*I.x[1],R.t+R.h*(1-I.y[0])]],et=B.center||{},Z=F.rotation||{},ot=j.range||[],X=N.range||[];if(B.fitbounds){G._length=st[1][0]-st[0][0],rt._length=st[1][1]-st[0][1],G.range=v(D,G),rt.range=v(D,rt);var Q=(G.range[0]+G.range[1])/2,ut=(rt.range[0]+rt.range[1])/2;if(B._isScoped)et={lon:Q,lat:ut};else if(B._isClipped){et={lon:Q,lat:ut},Z={lon:Q,lat:ut,roll:Z.roll};var J=F.type,q=y.lonaxisSpan[J]/2||180,it=y.lataxisSpan[J]/2||90;ot=[Q-q,Q+q],X=[ut-it,ut+it]}else et={lon:Q,lat:ut},Z={lon:Q,lat:Z.lat,roll:Z.roll}}ct.center([et.lon-Z.lon,et.lat-Z.lat]).rotate([-Z.lon,-Z.lat,Z.roll]).parallels(F.parallels);var nt=_(ot,X);ct.fitExtent(st,nt);var dt=this.bounds=ct.getBounds(nt),Tt=this.fitScale=ct.scale(),wt=ct.translate();if(B.fitbounds){var Ct=ct.getBounds(_(G.range,rt.range)),It=Math.min((dt[1][0]-dt[0][0])/(Ct[1][0]-Ct[0][0]),(dt[1][1]-dt[0][1])/(Ct[1][1]-Ct[0][1]));isFinite(It)?ct.scale(It*Tt):r.warn("Something went wrong during"+this.id+"fitbounds computations.")}else ct.scale(F.scale*Tt);var Nt=this.midPt=[(dt[0][0]+dt[1][0])/2,(dt[0][1]+dt[1][1])/2];if(ct.translate([wt[0]+(Nt[0]-wt[0]),wt[1]+(Nt[1]-wt[1])]).clipExtent(dt),B._isAlbersUsa){var te=ct([et.lon,et.lat]),Jt=ct.translate();ct.translate([Jt[0]-(te[0]-Jt[0]),Jt[1]-(te[1]-Jt[1])])}},c.updateBaseLayers=function(P,z){var D=this,B=D.topojson,R=D.layers,I=D.basePaths;function F(st){return st==="lonaxis"||st==="lataxis"}function j(st){return!!y.lineLayers[st]}function N(st){return!!y.fillLayers[st]}var G=this.hasChoropleth?y.layersForChoropleth:y.layers,rt=G.filter(function(st){return j(st)||N(st)?z["show"+st]:F(st)?z[st].showgrid:!0}),ct=D.framework.selectAll(".layer").data(rt,String);ct.exit().each(function(st){delete R[st],delete I[st],u.select(this).remove()}),ct.enter().append("g").attr("class",function(st){return"layer "+st}).each(function(st){var et=R[st]=u.select(this);st==="bg"?D.bgRect=et.append("rect").style("pointer-events","all"):F(st)?I[st]=et.append("path").style("fill","none"):st==="backplot"?et.append("g").classed("choroplethlayer",!0):st==="frontplot"?et.append("g").classed("scatterlayer",!0):j(st)?I[st]=et.append("path").style("fill","none").style("stroke-miterlimit",2):N(st)&&(I[st]=et.append("path").style("stroke","none"))}),ct.order(),ct.each(function(st){var et=I[st],Z=y.layerNameToAdjective[st];st==="frame"?et.datum(y.sphereSVG):j(st)||N(st)?et.datum(M(B,B.objects[st])):F(st)&&et.datum(b(st,z,P)).call(n.stroke,z[st].gridcolor).call(o.dashLine,z[st].griddash,z[st].gridwidth),j(st)?et.call(n.stroke,z[Z+"color"]).call(o.dashLine,"",z[Z+"width"]):N(st)&&et.call(n.fill,z[Z+"color"])})},c.updateDims=function(P,z){var D=this.bounds,B=(z.framewidth||0)/2,R=D[0][0]-B,I=D[0][1]-B,F=D[1][0]-R+B,j=D[1][1]-I+B;o.setRect(this.clipRect,R,I,F,j),this.bgRect.call(o.setRect,R,I,F,j).call(n.fill,z.bgcolor),this.xaxis._offset=R,this.xaxis._length=F,this.yaxis._offset=I,this.yaxis._length=j},c.updateFx=function(P,z){var D=this,B=D.graphDiv,R=D.bgRect,I=P.dragmode,F=P.clickmode;if(D.isStatic)return;function j(){var ct=D.viewInitial,st={};for(var et in ct)st[D.id+"."+et]=ct[et];e.call("_guiRelayout",B,st),B.emit("plotly_doubleclick",null)}function N(ct){return D.projection.invert([ct[0]+D.xaxis._offset,ct[1]+D.yaxis._offset])}var G=function(ct,st){if(st.isRect){var et=ct.range={};et[D.id]=[N([st.xmin,st.ymin]),N([st.xmax,st.ymax])]}else{var Z=ct.lassoPoints={};Z[D.id]=st.map(N)}},rt={element:D.bgRect.node(),gd:B,plotinfo:{id:D.id,xaxis:D.xaxis,yaxis:D.yaxis,fillRangeItems:G},xaxes:[D.xaxis],yaxes:[D.yaxis],subplot:D.id,clickFn:function(ct){ct===2&&w(B)}};I==="pan"?(R.node().onmousedown=null,R.call(x(D,z)),R.on("dblclick.zoom",j),B._context._scrollZoom.geo||R.on("wheel.zoom",null)):(I==="select"||I==="lasso")&&(R.on(".zoom",null),rt.prepFn=function(ct,st,et){m(ct,st,et,rt,I)},g.init(rt)),R.on("mousemove",function(){var ct=D.projection.invert(r.getPositionFromD3Event());if(!ct)return g.unhover(B,u.event);D.xaxis.p2c=function(){return ct[0]},D.yaxis.p2c=function(){return ct[1]},a.hover(B,u.event,D.id)}),R.on("mouseout",function(){B._dragging||g.unhover(B,u.event)}),R.on("click",function(){I!=="select"&&I!=="lasso"&&(F.indexOf("select")>-1&&l(u.event,B,[D.xaxis],[D.yaxis],D.id,rt),F.indexOf("event")>-1&&a.click(B,u.event))})},c.makeFramework=function(){var P=this,z=P.graphDiv,D=z._fullLayout,B="clip"+D._uid+P.id;P.clipDef=D._clips.append("clipPath").attr("id",B),P.clipRect=P.clipDef.append("rect"),P.framework=u.select(P.container).append("g").attr("class","geo "+P.id).call(o.setClipUrl,B,z),P.project=function(R){var I=P.projection(R);return I?[I[0]-P.xaxis._offset,I[1]-P.yaxis._offset]:[null,null]},P.xaxis={_id:"x",c2p:function(R){return P.project(R)[0]}},P.yaxis={_id:"y",c2p:function(R){return P.project(R)[1]}},P.mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},f.setConvert(P.mockAxis,D)},c.saveViewInitial=function(P){var z=P.center||{},D=P.projection,B=D.rotation||{};this.viewInitial={fitbounds:P.fitbounds,"projection.scale":D.scale};var R;P._isScoped?R={"center.lon":z.lon,"center.lat":z.lat}:P._isClipped?R={"projection.rotation.lon":B.lon,"projection.rotation.lat":B.lat}:R={"center.lon":z.lon,"center.lat":z.lat,"projection.rotation.lon":B.lon},r.extendFlat(this.viewInitial,R)},c.render=function(P){this._hasMarkerAngles&&P?this.plot(this._geoCalcData,this._fullLayout,[],!0):this._render()},c._render=function(){var P=this.projection,z=P.getPath(),D;function B(I){var F=P(I.lonlat);return F?i(F[0],F[1]):null}function R(I){return P.isLonLatOverEdges(I.lonlat)?"none":null}for(D in this.basePaths)this.basePaths[D].attr("d",z);for(D in this.dataPaths)this.dataPaths[D].attr("d",function(I){return z(I.geojson)});for(D in this.dataPoints)this.dataPoints[D].attr("display",R).attr("transform",B)};function h(P){var z=P.projection,D=z.type,B=y.projNames[D];B="geo"+r.titleCase(B);for(var R=d[B]||t[B],I=R(),F=P._isSatellite?Math.acos(1/z.distance)*180/Math.PI:P._isClipped?y.lonaxisSpan[D]/2:null,j=["center","rotate","parallels","clipExtent"],N=function(ct){return ct?I:[]},G=0;GZ}else return!1},I.getPath=function(){return E().projection(I)},I.getBounds=function(ct){return I.getPath().bounds(ct)},I.precision(y.precision),P._isSatellite&&I.tilt(z.tilt).distance(z.distance),F&&I.clipAngle(F-y.clipPad),I}function b(P,z,D){var B=1e-6,R=2.5,I=z[P],F=y.scopeDefaults[z.scope],j,N,G;P==="lonaxis"?(j=F.lonaxisRange,N=F.lataxisRange,G=function(ut,J){return[ut,J]}):P==="lataxis"&&(j=F.lataxisRange,N=F.lonaxisRange,G=function(ut,J){return[J,ut]});var rt={type:"linear",range:[j[0],j[1]-B],tick0:I.tick0,dtick:I.dtick};f.setConvert(rt,D);var ct=f.calcTicks(rt);!z.isScoped&&P==="lonaxis"&&ct.pop();for(var st=ct.length,et=new Array(st),Z=0;Z0&&R<0&&(R+=360);var j=(R-B)/4;return{type:"Polygon",coordinates:[[[B,I],[B,F],[B+j,F],[B+2*j,F],[B+3*j,F],[R,F],[R,I],[R-j,I],[R-2*j,I],[R-3*j,I],[B,I]]]}}}),j3=Vt((K,V)=>{var u=af(),d=Hu().attributes,E=If().dash,A=Lv(),t=Cu().overrideAll,e=Td(),r={range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},showgrid:{valType:"boolean",dflt:!1},tick0:{valType:"number",dflt:0},dtick:{valType:"number"},gridcolor:{valType:"color",dflt:u.lightLine},gridwidth:{valType:"number",min:0,dflt:1},griddash:E},i=V.exports=t({domain:d({name:"geo"},{}),fitbounds:{valType:"enumerated",values:[!1,"locations","geojson"],dflt:!1,editType:"plot"},resolution:{valType:"enumerated",values:[110,50],dflt:110,coerceNumber:!0},scope:{valType:"enumerated",values:e(A.scopeDefaults),dflt:"world"},projection:{type:{valType:"enumerated",values:e(A.projNames)},rotation:{lon:{valType:"number"},lat:{valType:"number"},roll:{valType:"number"}},tilt:{valType:"number",dflt:0},distance:{valType:"number",min:1.001,dflt:2},parallels:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},scale:{valType:"number",min:0,dflt:1}},center:{lon:{valType:"number"},lat:{valType:"number"}},visible:{valType:"boolean",dflt:!0},showcoastlines:{valType:"boolean"},coastlinecolor:{valType:"color",dflt:u.defaultLine},coastlinewidth:{valType:"number",min:0,dflt:1},showland:{valType:"boolean",dflt:!1},landcolor:{valType:"color",dflt:A.landColor},showocean:{valType:"boolean",dflt:!1},oceancolor:{valType:"color",dflt:A.waterColor},showlakes:{valType:"boolean",dflt:!1},lakecolor:{valType:"color",dflt:A.waterColor},showrivers:{valType:"boolean",dflt:!1},rivercolor:{valType:"color",dflt:A.waterColor},riverwidth:{valType:"number",min:0,dflt:1},showcountries:{valType:"boolean"},countrycolor:{valType:"color",dflt:u.defaultLine},countrywidth:{valType:"number",min:0,dflt:1},showsubunits:{valType:"boolean"},subunitcolor:{valType:"color",dflt:u.defaultLine},subunitwidth:{valType:"number",min:0,dflt:1},showframe:{valType:"boolean"},framecolor:{valType:"color",dflt:u.defaultLine},framewidth:{valType:"number",min:0,dflt:1},bgcolor:{valType:"color",dflt:u.background},lonaxis:r,lataxis:r},"plot","from-root");i.uirevision={valType:"any",editType:"none"}}),CE=Vt((K,V)=>{var u=Xr(),d=Cd(),E=Pf().getSubplotData,A=Lv(),t=j3(),e=A.axesNames;V.exports=function(i,n,o){d(i,n,o,{type:"geo",attributes:t,handleDefaults:r,fullData:o,partition:"y"})};function r(i,n,o,a){var s=E(a.fullData,"geo",a.id),f=s.map(function(X){return X.index}),v=o("resolution"),g=o("scope"),m=A.scopeDefaults[g],w=o("projection.type",m.projType),l=n._isAlbersUsa=w==="albers usa";l&&(g=n.scope="usa");var x=n._isScoped=g!=="world",y=n._isSatellite=w==="satellite",S=n._isConic=w.indexOf("conic")!==-1||w==="albers",k=n._isClipped=!!A.lonaxisSpan[w];if(i.visible===!1){var M=u.extendDeep({},n._template);M.showcoastlines=!1,M.showcountries=!1,M.showframe=!1,M.showlakes=!1,M.showland=!1,M.showocean=!1,M.showrivers=!1,M.showsubunits=!1,M.lonaxis&&(M.lonaxis.showgrid=!1),M.lataxis&&(M.lataxis.showgrid=!1),n._template=M}for(var T=o("visible"),c,h=0;h0&&N<0&&(N+=360);var G=(j+N)/2,rt;if(!l){var ct=x?m.projRotate:[G,0,0];rt=o("projection.rotation.lon",ct[0]),o("projection.rotation.lat",ct[1]),o("projection.rotation.roll",ct[2]),c=o("showcoastlines",!x&&T),c&&(o("coastlinecolor"),o("coastlinewidth")),c=o("showocean",T?void 0:!1),c&&o("oceancolor")}var st,et;if(l?(st=-96.6,et=38.7):(st=x?G:rt,et=(F[0]+F[1])/2),o("center.lon",st),o("center.lat",et),y&&(o("projection.tilt"),o("projection.distance")),S){var Z=m.projParallels||[0,60];o("projection.parallels",Z)}o("projection.scale"),c=o("showland",T?void 0:!1),c&&o("landcolor"),c=o("showlakes",T?void 0:!1),c&&o("lakecolor"),c=o("showrivers",T?void 0:!1),c&&(o("rivercolor"),o("riverwidth")),c=o("showcountries",x&&g!=="usa"&&T),c&&(o("countrycolor"),o("countrywidth")),(g==="usa"||g==="north america"&&v===50)&&(o("showsubunits",T),o("subunitcolor"),o("subunitwidth")),x||(c=o("showframe",T),c&&(o("framecolor"),o("framewidth"))),o("bgcolor");var ot=o("fitbounds");ot&&(delete n.projection.scale,x?(delete n.center.lon,delete n.center.lat):k?(delete n.center.lon,delete n.center.lat,delete n.projection.rotation.lon,delete n.projection.rotation.lat,delete n.lonaxis.range,delete n.lataxis.range):(delete n.center.lon,delete n.center.lat,delete n.projection.rotation.lon))}}),U3=Vt((K,V)=>{var u=Pf().getSubplotCalcData,d=Xr().counterRegex,E=LE(),A="geo",t=d(A),e={};e[A]={valType:"subplotid",dflt:A,editType:"calc"};function r(o){for(var a=o._fullLayout,s=o.calcdata,f=a._subplots[A],v=0;v{V.exports={attributes:L0(),supplyDefaults:xE(),colorbar:Zf(),formatLabels:_E(),calc:Lx(),calcGeoJSON:R3().calcGeoJSON,plot:R3().plot,style:B3(),styleOnSelect:gh().styleOnSelect,hoverPoints:AE(),eventData:ME(),selectPoints:SE(),moduleType:"trace",name:"scattergeo",basePlotModule:U3(),categories:["geo","symbols","showLegend","scatter-like"],meta:{}}}),PE=Vt((K,V)=>{V.exports=IE()}),Ym=Vt((K,V)=>{var{hovertemplateAttrs:u,templatefallbackAttrs:d}=yl(),E=L0(),A=Wl(),t=kl(),e=af().defaultLine,r=So().extendFlat,i=E.marker.line;V.exports=r({locations:{valType:"data_array",editType:"calc"},locationmode:E.locationmode,z:{valType:"data_array",editType:"calc"},geojson:r({},E.geojson,{}),featureidkey:E.featureidkey,text:r({},E.text,{}),hovertext:r({},E.hovertext,{}),marker:{line:{color:r({},i.color,{dflt:e}),width:r({},i.width,{dflt:1}),editType:"calc"},opacity:{valType:"number",arrayOk:!0,min:0,max:1,dflt:1,editType:"style"},editType:"calc"},selected:{marker:{opacity:E.selected.marker.opacity,editType:"plot"},editType:"plot"},unselected:{marker:{opacity:E.unselected.marker.opacity,editType:"plot"},editType:"plot"},hoverinfo:r({},t.hoverinfo,{editType:"calc",flags:["location","z","text","name"]}),hovertemplate:u(),hovertemplatefallback:d(),showlegend:r({},t.showlegend,{dflt:!1})},A("",{cLetter:"z",editTypeOverride:"calc"}))}),OE=Vt((K,V)=>{var u=Xr(),d=vf(),E=Ym(),A=["The library used by the *country names* `locationmode` option is changing in the next major version.","Some country names in existing plots may not work in the new version.","To ensure consistent behavior, consider setting `locationmode` to *ISO-3*."].join(" ");V.exports=function(t,e,r,i){function n(m,w){return u.coerce(t,e,E,m,w)}var o=n("locations"),a=n("z");if(!(o&&o.length&&u.isArrayOrTypedArray(a)&&a.length)){e.visible=!1;return}e._length=Math.min(o.length,a.length);var s=n("geojson"),f;(typeof s=="string"&&s!==""||u.isPlainObject(s))&&(f="geojson-id");var v=n("locationmode",f);v==="country names"&&u.warn(A),v==="geojson-id"&&n("featureidkey"),n("text"),n("hovertext"),n("hovertemplate"),n("hovertemplatefallback");var g=n("marker.line.width");g&&n("marker.line.color"),n("marker.opacity"),d(t,e,i,n,{prefix:"",cLetter:"z"}),u.coerceSelectionMarkerOpacity(e,n)}}),Ox=Vt((K,V)=>{var u=Lo(),d=ks().BADNUM,E=ih(),A=yp(),t=jh();function e(r){return r&&typeof r=="string"}V.exports=function(r,i){var n=i._length,o=new Array(n),a;i.geojson?a=function(m){return e(m)||u(m)}:a=e;for(var s=0;s{var u=Ni(),d=Pi(),E=Eo(),A=xu();function t(i,n){n&&e(i,n)}function e(i,n){var o=n[0].trace,a=n[0].node3,s=a.selectAll(".choroplethlocation"),f=o.marker||{},v=f.line||{},g=A.makeColorScaleFuncFromTrace(o);s.each(function(m){u.select(this).attr("fill",g(m.z)).call(d.stroke,m.mlc||v.color).call(E.dashLine,"",m.mlw||v.width||0).style("opacity",f.opacity)}),E.selectedPointStyle(s,o)}function r(i,n){var o=n[0].node3,a=n[0].trace;a.selectedpoints?E.selectedPointStyle(o.selectAll(".choroplethlocation"),a):e(i,n)}V.exports={style:t,styleOnSelect:r}}),V3=Vt((K,V)=>{var u=Ni(),d=Xr(),E=Vd(),A=Cx().getTopojsonFeatures,t=Yh().findExtremes,e=Dx().style;function r(n,o,a){var s=o.layers.backplot.select(".choroplethlayer");d.makeTraceGroups(s,a,"trace choropleth").each(function(f){var v=u.select(this),g=v.selectAll("path.choroplethlocation").data(d.identity);g.enter().append("path").classed("choroplethlocation",!0),g.exit().remove(),e(n,f)})}function i(n,o){for(var a=n[0].trace,s=o[a.geo],f=s._subplot,v=a.locationmode,g=a._length,m=v==="geojson-id"?E.extractTraceFeature(n):A(a,f.topojson),w=[],l=[],x=0;x{var u=yo(),d=Ym(),E=Xr().fillText;V.exports=function(t,e,r){var i=t.cd,n=i[0].trace,o=t.subplot,a,s,f,v,g=[e,r],m=[e+360,r];for(s=0;s")}}}),Bx=Vt((K,V)=>{V.exports=function(u,d,E,A,t){u.location=d.location,u.z=d.z;var e=A[t];return e.fIn&&e.fIn.properties&&(u.properties=e.fIn.properties),u.ct=e.ct,u}}),Rx=Vt((K,V)=>{V.exports=function(u,d){var E=u.cd,A=u.xaxis,t=u.yaxis,e=[],r,i,n,o,a;if(d===!1)for(r=0;r{V.exports={attributes:Ym(),supplyDefaults:OE(),colorbar:Ld(),calc:Ox(),calcGeoJSON:V3().calcGeoJSON,plot:V3().plot,style:Dx().style,styleOnSelect:Dx().styleOnSelect,hoverPoints:Fx(),eventData:Bx(),selectPoints:Rx(),moduleType:"trace",name:"choropleth",basePlotModule:U3(),categories:["geo","noOpacity","showLegend"],meta:{}}}),FE=Vt((K,V)=>{V.exports=DE()}),Nx=Vt((K,V)=>{var u=ji(),d=Xr(),E=zm();function A(e,r,i,n){var o=e.cd,a=o[0].t,s=o[0].trace,f=e.xa,v=e.ya,g=a.x,m=a.y,w=f.c2p(r),l=v.c2p(i),x=e.distance,y;if(a.tree){var S=f.p2c(w-x),k=f.p2c(w+x),M=v.p2c(l-x),T=v.p2c(l+x);n==="x"?y=a.tree.range(Math.min(S,k),Math.min(v._rl[0],v._rl[1]),Math.max(S,k),Math.max(v._rl[0],v._rl[1])):y=a.tree.range(Math.min(S,k),Math.min(M,T),Math.max(S,k),Math.max(M,T))}else y=a.ids;var c,h,b,_,P,z,D,B,R,I=x;if(n==="x"){var F=!!s.xperiodalignment,j=!!s.yperiodalignment;for(P=0;P=Math.min(N,G)&&w<=Math.max(N,G)?0:1/0}if(z=Math.min(rt,ct)&&l<=Math.max(rt,ct)?0:1/0}R=Math.sqrt(z*z+D*D),h=y[P]}}}else for(P=y.length-1;P>-1;P--)c=y[P],b=g[c],_=m[c],z=f.c2p(b)-w,D=v.c2p(_)-l,B=Math.sqrt(z*z+D*D),B{var u=20;V.exports={TOO_MANY_POINTS:1e5,SYMBOL_SDF_SIZE:200,SYMBOL_SIZE:u,SYMBOL_STROKE:u/20,DOT_RE:/-dot/,OPEN_RE:/-open/,DASHES:{solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}}}),Iv=Vt((K,V)=>{var u=kl(),d=yu(),E=Jh(),A=dc(),t=hc().axisHoverFormat,e=Wl(),r=Td(),i=So().extendFlat,n=Cu().overrideAll,o=Hd().DASHES,a=A.line,s=A.marker,f=s.line,v=V.exports=n({x:A.x,x0:A.x0,dx:A.dx,y:A.y,y0:A.y0,dy:A.dy,xperiod:A.xperiod,yperiod:A.yperiod,xperiod0:A.xperiod0,yperiod0:A.yperiod0,xperiodalignment:A.xperiodalignment,yperiodalignment:A.yperiodalignment,xhoverformat:t("x"),yhoverformat:t("y"),text:A.text,hovertext:A.hovertext,textposition:A.textposition,textfont:d({noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0,editType:"calc",colorEditType:"style",arrayOk:!0,noNumericWeightValues:!0,variantValues:["normal","small-caps"]}),mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},line:{color:a.color,width:a.width,shape:{valType:"enumerated",values:["linear","hv","vh","hvh","vhv"],dflt:"linear",editType:"plot"},dash:{valType:"enumerated",values:r(o),dflt:"solid"}},marker:i({},e("marker"),{symbol:s.symbol,angle:s.angle,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,opacity:s.opacity,colorbar:s.colorbar,line:i({},e("marker.line"),{width:f.width})}),connectgaps:A.connectgaps,fill:i({},A.fill,{dflt:"none"}),fillcolor:E(),selected:{marker:A.selected.marker,textfont:A.selected.textfont},unselected:{marker:A.unselected.marker,textfont:A.unselected.textfont},opacity:u.opacity},"calc","nested");v.x.editType=v.y.editType=v.x0.editType=v.y0.editType="calc+clearAxisTypes",v.hovertemplate=A.hovertemplate,v.hovertemplatefallback=A.hovertemplatefallback,v.texttemplate=A.texttemplate,v.texttemplatefallback=A.texttemplatefallback}),jx=Vt(K=>{var V=Hd();K.isOpenSymbol=function(u){return typeof u=="string"?V.OPEN_RE.test(u):u%200>100},K.isDotSymbol=function(u){return typeof u=="string"?V.DOT_RE.test(u):u>200}}),BE=Vt((K,V)=>{var u=Xr(),d=ji(),E=jx(),A=Iv(),t=vp(),e=nu(),r=Mm(),i=Qh(),n=Lh(),o=Bh(),a=tp(),s=Rh();V.exports=function(f,v,g,m){function w(c,h){return u.coerce(f,v,A,c,h)}var l=f.marker?E.isOpenSymbol(f.marker.symbol):!1,x=e.isBubble(f),y=r(f,v,m,w);if(!y){v.visible=!1;return}i(f,v,m,w),w("xhoverformat"),w("yhoverformat");var S=y{var u=n1();V.exports=function(d,E,A){var t=d.i;return"x"in d||(d.x=E._x[t]),"y"in d||(d.y=E._y[t]),u(d,E,A)}}),NE=Vt((K,V)=>{function u(r,i,n,o,a){for(var s=a+1;o<=a;){var f=o+a>>>1,v=r[f],g=n!==void 0?n(v,i):v-i;g>=0?(s=f,a=f-1):o=f+1}return s}function d(r,i,n,o,a){for(var s=a+1;o<=a;){var f=o+a>>>1,v=r[f],g=n!==void 0?n(v,i):v-i;g>0?(s=f,a=f-1):o=f+1}return s}function E(r,i,n,o,a){for(var s=o-1;o<=a;){var f=o+a>>>1,v=r[f],g=n!==void 0?n(v,i):v-i;g<0?(s=f,o=f+1):a=f-1}return s}function A(r,i,n,o,a){for(var s=o-1;o<=a;){var f=o+a>>>1,v=r[f],g=n!==void 0?n(v,i):v-i;g<=0?(s=f,o=f+1):a=f-1}return s}function t(r,i,n,o,a){for(;o<=a;){var s=o+a>>>1,f=r[s],v=n!==void 0?n(f,i):f-i;if(v===0)return s;v<=0?o=s+1:a=s-1}return-1}function e(r,i,n,o,a,s){return typeof n=="function"?s(r,i,n,o===void 0?0:o|0,a===void 0?r.length-1:a|0):s(r,i,void 0,n===void 0?0:n|0,o===void 0?r.length-1:o|0)}V.exports={ge:function(r,i,n,o,a){return e(r,i,n,o,a,u)},gt:function(r,i,n,o,a){return e(r,i,n,o,a,d)},lt:function(r,i,n,o,a){return e(r,i,n,o,a,E)},le:function(r,i,n,o,a){return e(r,i,n,o,a,A)},eq:function(r,i,n,o,a){return e(r,i,n,o,a,t)}}}),bp=Vt((K,V)=>{V.exports=function(E,A,t){var e={},r,i;if(typeof A=="string"&&(A=d(A)),Array.isArray(A)){var n={};for(i=0;i{var u=bp();V.exports=d;function d(E){var A;return arguments.length>1&&(E=arguments),typeof E=="string"?E=E.split(/\s/).map(parseFloat):typeof E=="number"&&(E=[E]),E.length&&typeof E[0]=="number"?E.length===1?A={width:E[0],height:E[0],x:0,y:0}:E.length===2?A={width:E[0],height:E[1],x:0,y:0}:A={x:E[0],y:E[1],width:E[2]-E[0]||0,height:E[3]-E[1]||0}:E&&(E=u(E,{left:"x l left Left",top:"y t top Top",width:"w width W Width",height:"h height W Width",bottom:"b bottom Bottom",right:"r right Right"}),A={x:E.left||0,y:E.top||0},E.width==null?E.right?A.width=E.right-A.x:A.width=0:A.width=E.width,E.height==null?E.bottom?A.height=E.bottom-A.y:A.height=0:A.height=E.height),A}}),C0=Vt((K,V)=>{V.exports=u;function u(d,E){if(!d||d.length==null)throw Error("Argument should be an array");E==null?E=1:E=Math.floor(E);for(var A=Array(E*2),t=0;te&&(e=d[i]),d[i]{V.exports=function(){for(var u=0;u{var u=Ax();V.exports=d;function d(E,A,t){if(!E)throw new TypeError("must specify data as first parameter");if(t=+(t||0)|0,Array.isArray(E)&&E[0]&&typeof E[0][0]=="number"){var e=E[0].length,r=E.length*e,i,n,o,a;(!A||typeof A=="string")&&(A=new(u(A||"float32"))(r+t));var s=A.length-t;if(r!==s)throw new Error("source length "+r+" ("+e+"x"+E.length+") does not match destination length "+s);for(i=0,o=t;i{V.exports=function(u){var d=typeof u;return u!==null&&(d==="object"||d==="function")}}),VE=Vt((K,V)=>{V.exports=Math.log2||function(u){return Math.log(u)*Math.LOG2E}}),HE=Vt((K,V)=>{var u=NE(),d=Ev(),E=Xm(),A=C0(),t=bp(),e=jE(),r=I0(),i=UE(),n=Ax(),o=VE(),a=1073741824;V.exports=function(f,v){v||(v={}),f=r(f,"float64"),v=t(v,{bounds:"range bounds dataBox databox",maxDepth:"depth maxDepth maxdepth level maxLevel maxlevel levels",dtype:"type dtype format out dst output destination"});let g=e(v.maxDepth,255),m=e(v.bounds,A(f,2));m[0]===m[2]&&m[2]++,m[1]===m[3]&&m[3]++;let w=s(f,m),l=f.length>>>1,x;v.dtype||(v.dtype="array"),typeof v.dtype=="string"?x=new(n(v.dtype))(l):v.dtype&&(x=v.dtype,Array.isArray(x)&&(x.length=l));for(let P=0;Pg||I>a){for(let Q=0;Qit||N>nt||G=ct||J===q)return;let dt=y[ut];q===void 0&&(q=dt.length);for(let Zt=J;Zt=B&&bt<=I&&vt>=R&&vt<=F&&st.push(mt)}let Tt=S[ut],wt=Tt[J*4+0],Ct=Tt[J*4+1],It=Tt[J*4+2],Nt=Tt[J*4+3],te=Z(Tt,J+1),Jt=Q*.5,ee=ut+1;et(ot,X,Jt,ee,wt,Ct||It||Nt||te),et(ot,X+Jt,Jt,ee,Ct,It||Nt||te),et(ot+Jt,X,Jt,ee,It,Nt||te),et(ot+Jt,X+Jt,Jt,ee,Nt,te)}function Z(ot,X){let Q=null,ut=0;for(;Q===null;)if(Q=ot[X*4+ut],ut++,ut>ot.length)return null;return Q}return st}function b(P,z,D,B,R){let I=[];for(let F=0;F{V.exports=HE()}),H3=Vt((K,V)=>{V.exports=u;function u(d){var E=0,A=0,t=0,e=0;return d.map(function(r){r=r.slice();var i=r[0],n=i.toUpperCase();if(i!=n)switch(r[0]=n,i){case"a":r[6]+=t,r[7]+=e;break;case"v":r[1]+=e;break;case"h":r[1]+=t;break;default:for(var o=1;o{Object.defineProperty(K,"__esModule",{value:!0});var u=(function(){function i(n,o){var a=[],s=!0,f=!1,v=void 0;try{for(var g=n[Symbol.iterator](),m;!(s=(m=g.next()).done)&&(a.push(m.value),!(o&&a.length===o));s=!0);}catch(w){f=!0,v=w}finally{try{!s&&g.return&&g.return()}finally{if(f)throw v}}return a}return function(n,o){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return i(n,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=Math.PI*2,E=function(i,n,o,a,s,f,v){var g=i.x,m=i.y;g*=n,m*=o;var w=a*g-s*m,l=s*g+a*m;return{x:w+f,y:l+v}},A=function(i,n){var o=n===1.5707963267948966?.551915024494:n===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(n/4),a=Math.cos(i),s=Math.sin(i),f=Math.cos(i+n),v=Math.sin(i+n);return[{x:a-s*o,y:s+a*o},{x:f+v*o,y:v-f*o},{x:f,y:v}]},t=function(i,n,o,a){var s=i*a-n*o<0?-1:1,f=i*o+n*a;return f>1&&(f=1),f<-1&&(f=-1),s*Math.acos(f)},e=function(i,n,o,a,s,f,v,g,m,w,l,x){var y=Math.pow(s,2),S=Math.pow(f,2),k=Math.pow(l,2),M=Math.pow(x,2),T=y*S-y*M-S*k;T<0&&(T=0),T/=y*M+S*k,T=Math.sqrt(T)*(v===g?-1:1);var c=T*s/f*x,h=T*-f/s*l,b=w*c-m*h+(i+o)/2,_=m*c+w*h+(n+a)/2,P=(l-c)/s,z=(x-h)/f,D=(-l-c)/s,B=(-x-h)/f,R=t(1,0,P,z),I=t(P,z,D,B);return g===0&&I>0&&(I-=d),g===1&&I<0&&(I+=d),[b,_,R,I]},r=function(i){var n=i.px,o=i.py,a=i.cx,s=i.cy,f=i.rx,v=i.ry,g=i.xAxisRotation,m=g===void 0?0:g,w=i.largeArcFlag,l=w===void 0?0:w,x=i.sweepFlag,y=x===void 0?0:x,S=[];if(f===0||v===0)return[];var k=Math.sin(m*d/360),M=Math.cos(m*d/360),T=M*(n-a)/2+k*(o-s)/2,c=-k*(n-a)/2+M*(o-s)/2;if(T===0&&c===0)return[];f=Math.abs(f),v=Math.abs(v);var h=Math.pow(T,2)/Math.pow(f,2)+Math.pow(c,2)/Math.pow(v,2);h>1&&(f*=Math.sqrt(h),v*=Math.sqrt(h));var b=e(n,o,a,s,f,v,l,y,k,M,T,c),_=u(b,4),P=_[0],z=_[1],D=_[2],B=_[3],R=Math.abs(B)/(d/4);Math.abs(1-R)<1e-7&&(R=1);var I=Math.max(Math.ceil(R),1);B/=I;for(var F=0;F{V.exports=d;var u=qE();function d(t){for(var e,r=[],i=0,n=0,o=0,a=0,s=null,f=null,v=0,g=0,m=0,w=t.length;m4?(i=l[l.length-4],n=l[l.length-3]):(i=v,n=g),r.push(l)}return r}function E(t,e,r,i){return["C",t,e,r,i,r,i]}function A(t,e,r,i,n,o){return["C",t/3+2/3*r,e/3+2/3*i,n/3+2/3*r,o/3+2/3*i,n,o]}}),q3=Vt((K,V)=>{V.exports=function(u){return typeof u!="string"?!1:(u=u.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(u)&&/[\dz]$/i.test(u)&&u.length>4))}}),GE=Vt((K,V)=>{var u=Ng(),d=H3(),E=WE(),A=q3(),t=lv();V.exports=e;function e(r){if(Array.isArray(r)&&r.length===1&&typeof r[0]=="string"&&(r=r[0]),typeof r=="string"&&(t(A(r),"String is not an SVG path."),r=u(r)),t(Array.isArray(r),"Argument should be a string or an array of path segments."),r=d(r),r=E(r),!r.length)return[0,0,0,0];for(var i=[1/0,1/0,-1/0,-1/0],n=0,o=r.length;ni[2]&&(i[2]=a[s+0]),a[s+1]>i[3]&&(i[3]=a[s+1]);return i}}),ZE=Vt((K,V)=>{var u=Math.PI,d=i(120);V.exports=E;function E(n){for(var o,a=[],s=0,f=0,v=0,g=0,m=null,w=null,l=0,x=0,y=0,S=n.length;y7&&(a.push(k.splice(0,7)),k.unshift("C"));break;case"S":var T=l,c=x;(o=="C"||o=="S")&&(T+=T-s,c+=c-f),k=["C",T,c,k[1],k[2],k[3],k[4]];break;case"T":o=="Q"||o=="T"?(m=l*2-m,w=x*2-w):(m=l,w=x),k=t(l,x,m,w,k[1],k[2]);break;case"Q":m=k[1],w=k[2],k=t(l,x,k[1],k[2],k[3],k[4]);break;case"L":k=A(l,x,k[1],k[2]);break;case"H":k=A(l,x,k[1],x);break;case"V":k=A(l,x,l,k[1]);break;case"Z":k=A(l,x,v,g);break}o=M,l=k[k.length-2],x=k[k.length-1],k.length>4?(s=k[k.length-4],f=k[k.length-3]):(s=l,f=x),a.push(k)}return a}function A(n,o,a,s){return["C",n,o,a,s,a,s]}function t(n,o,a,s,f,v){return["C",n/3+2/3*a,o/3+2/3*s,f/3+2/3*a,v/3+2/3*s,f,v]}function e(n,o,a,s,f,v,g,m,w,l){if(l)_=l[0],P=l[1],h=l[2],b=l[3];else{var x=r(n,o,-f);n=x.x,o=x.y,x=r(m,w,-f),m=x.x,w=x.y;var y=(n-m)/2,S=(o-w)/2,k=y*y/(a*a)+S*S/(s*s);k>1&&(k=Math.sqrt(k),a=k*a,s=k*s);var M=a*a,T=s*s,c=(v==g?-1:1)*Math.sqrt(Math.abs((M*T-M*S*S-T*y*y)/(M*S*S+T*y*y)));c==1/0&&(c=1);var h=c*a*S/s+(n+m)/2,b=c*-s*y/a+(o+w)/2,_=Math.asin(((o-b)/s).toFixed(9)),P=Math.asin(((w-b)/s).toFixed(9));_=nP&&(_=_-u*2),!g&&P>_&&(P=P-u*2)}if(Math.abs(P-_)>d){var z=P,D=m,B=w;P=_+d*(g&&P>_?1:-1),m=h+a*Math.cos(P),w=b+s*Math.sin(P);var R=e(m,w,a,s,f,0,g,D,B,[P,z,h,b])}var I=Math.tan((P-_)/4),F=4/3*a*I,j=4/3*s*I,N=[2*n-(n+F*Math.sin(_)),2*o-(o-j*Math.cos(_)),m+F*Math.sin(P),w-j*Math.cos(P),m,w];if(l)return N;R&&(N=N.concat(R));for(var G=0;G{var u=H3(),d=ZE(),E={M:"moveTo",C:"bezierCurveTo"};V.exports=function(A,t){A.beginPath(),d(u(t)).forEach(function(e){var r=e[0],i=e.slice(1);A[E[r]].apply(A,i)}),A.closePath()}}),YE=Vt((K,V)=>{var u=Ev();V.exports=E;var d=1e20;function E(e,r){r||(r={});var i=r.cutoff==null?.25:r.cutoff,n=r.radius==null?8:r.radius,o=r.channel||0,a,s,f,v,g,m,w,l,x,y,S;if(ArrayBuffer.isView(e)||Array.isArray(e)){if(!r.width||!r.height)throw Error("For raw data width and height should be provided by options");a=r.width,s=r.height,v=e,r.stride?m=r.stride:m=Math.floor(e.length/a/s)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(l=e,w=l.getContext("2d"),a=l.width,s=l.height,x=w.getImageData(0,0,a,s),v=x.data,m=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(l=e.canvas,w=e,a=l.width,s=l.height,x=w.getImageData(0,0,a,s),v=x.data,m=4):window.ImageData&&e instanceof window.ImageData&&(x=e,a=e.width,s=e.height,v=x.data,m=4);if(f=Math.max(a,s),window.Uint8ClampedArray&&v instanceof window.Uint8ClampedArray||window.Uint8Array&&v instanceof window.Uint8Array)for(g=v,v=Array(a*s),y=0,S=g.length;y{var u=GE(),d=Ng(),E=KE(),A=q3(),t=YE(),e=document.createElement("canvas"),r=e.getContext("2d");V.exports=i;function i(a,s){if(!A(a))throw Error("Argument should be valid svg path string");s||(s={});var f,v;s.shape?(f=s.shape[0],v=s.shape[1]):(f=e.width=s.w||s.width||200,v=e.height=s.h||s.height||200);var g=Math.min(f,v),m=s.stroke||0,w=s.viewbox||s.viewBox||u(a),l=[f/(w[2]-w[0]),v/(w[3]-w[1])],x=Math.min(l[0]||0,l[1]||0)/2;if(r.fillStyle="black",r.fillRect(0,0,f,v),r.fillStyle="white",m&&(typeof m!="number"&&(m=1),m>0?r.strokeStyle="white":r.strokeStyle="black",r.lineWidth=Math.abs(m)),r.translate(f*.5,v*.5),r.scale(x,x),o()){var y=new Path2D(a);r.fill(y),m&&r.stroke(y)}else{var S=d(a);E(r,S),r.fill(),m&&r.stroke()}r.setTransform(1,0,0,1,0,0);var k=t(r,{cutoff:s.cutoff!=null?s.cutoff:.5,radius:s.radius!=null?s.radius:g*.5});return k}var n;function o(){if(n!=null)return n;var a=document.createElement("canvas").getContext("2d");if(a.canvas.width=a.canvas.height=1,!window.Path2D)return n=!1;var s=new Path2D("M0,0h1v1h-1v-1Z");a.fillStyle="black",a.fill(s);var f=a.getImageData(0,0,1,1);return n=f&&f.data&&f.data[3]===255}}),P0=Vt((K,V)=>{var u=Lo(),d=XE(),E=Nd(),A=ji(),t=Xr(),e=t.isArrayOrTypedArray,r=Eo(),i=fc(),n=Hp().formatColor,o=nu(),a=Tm(),s=jx(),f=Hd(),v=bd().DESELECTDIM,g={start:1,left:1,end:-1,right:-1,middle:0,center:0,bottom:1,top:-1},m=mh().appendArrayPointValue;function w(R,I){var F,j={marker:void 0,markerSel:void 0,markerUnsel:void 0,line:void 0,fill:void 0,errorX:void 0,errorY:void 0,text:void 0,textSel:void 0,textUnsel:void 0},N=R._context.plotGlPixelRatio;if(I.visible!==!0)return j;if(o.hasText(I)&&(j.text=l(R,I),j.textSel=k(R,I,I.selected),j.textUnsel=k(R,I,I.unselected)),o.hasMarkers(I)&&(j.marker=y(R,I),j.markerSel=S(R,I,I.selected),j.markerUnsel=S(R,I,I.unselected),!I.unselected&&e(I.marker.opacity))){var G=I.marker.opacity;for(j.markerUnsel.opacity=new Array(G.length),F=0;F500?"bold":"normal":R}function y(R,I){var F=I._length,j=I.marker,N={},G,rt=e(j.symbol),ct=e(j.angle),st=e(j.color),et=e(j.line.color),Z=e(j.opacity),ot=e(j.size),X=e(j.line.width),Q;if(rt||(Q=s.isOpenSymbol(j.symbol)),rt||st||et||Z||ct){N.symbols=new Array(F),N.angles=new Array(F),N.colors=new Array(F),N.borderColors=new Array(F);var ut=j.symbol,J=j.angle,q=n(j,j.opacity,F),it=n(j.line,j.opacity,F);if(!e(it[0])){var nt=it;for(it=Array(F),G=0;Gf.TOO_MANY_POINTS||o.hasMarkers(I)?"rect":"round";if(et&&I.connectgaps){var ot=G[0],X=G[1];for(rt=0;rt1?st[rt]:st[0]:st,Q=e(et)?et.length>1?et[rt]:et[0]:et,ut=g[X],J=g[Q],q=Z?Z/.8+1:0,it=-J*q-J*.5;G.offset[rt]=[ut*q/ot,it/ot]}}return G}V.exports={style:w,markerStyle:y,markerSelection:S,linePositions:z,errorBarPositions:D,textPosition:B}}),W3=Vt((K,V)=>{var u=Xr();V.exports=function(d,E){var A=E._scene,t={count:0,dirty:!0,lineOptions:[],fillOptions:[],markerOptions:[],markerSelectedOptions:[],markerUnselectedOptions:[],errorXOptions:[],errorYOptions:[],textOptions:[],textSelectedOptions:[],textUnselectedOptions:[],selectBatch:[],unselectBatch:[]},e={fill2d:!1,scatter2d:!1,error2d:!1,line2d:!1,glText:!1,select2d:!1};return E._scene||(A=E._scene={},A.init=function(){u.extendFlat(A,e,t)},A.init(),A.update=function(r){var i=u.repeat(r,A.count);if(A.fill2d&&A.fill2d.update(i),A.scatter2d&&A.scatter2d.update(i),A.line2d&&A.line2d.update(i),A.error2d&&A.error2d.update(i.concat(i)),A.select2d&&A.select2d.update(i),A.glText)for(var n=0;n{var u=Ux(),d=Xr(),E=fc(),A=Yh().findExtremes,t=ep(),e=Uh(),r=e.calcMarkerSize,i=e.calcAxisExpansion,n=e.setFirstScatter,o=Nh(),a=P0(),s=W3(),f=ks().BADNUM,v=Hd().TOO_MANY_POINTS;V.exports=function(w,l){var x=w._fullLayout,y=l._xA=E.getFromId(w,l.xaxis,"x"),S=l._yA=E.getFromId(w,l.yaxis,"y"),k=x._plots[l.xaxis+l.yaxis],M=l._length,T=M>=v,c=M*2,h={},b,_=y.makeCalcdata(l,"x"),P=S.makeCalcdata(l,"y"),z=t(l,y,"x",_),D=t(l,S,"y",P),B=z.vals,R=D.vals;l._x=B,l._y=R,l.xperiodalignment&&(l._origX=_,l._xStarts=z.starts,l._xEnds=z.ends),l.yperiodalignment&&(l._origY=P,l._yStarts=D.starts,l._yEnds=D.ends);var I=new Array(c),F=new Array(M);for(b=0;b1&&d.extendFlat(M.line,a.linePositions(w,x,y)),M.errorX||M.errorY){var T=a.errorBarPositions(w,x,y,S,k);M.errorX&&d.extendFlat(M.errorX,T.x),M.errorY&&d.extendFlat(M.errorY,T.y)}return M.text&&(d.extendFlat(M.text,{positions:y},a.textPosition(w,x,M.text,M.marker)),d.extendFlat(M.textSel,{positions:y},a.textPosition(w,x,M.text,M.markerSel)),d.extendFlat(M.textUnsel,{positions:y},a.textPosition(w,x,M.text,M.markerUnsel))),M}}),G3=Vt((K,V)=>{var u=Xr(),d=Pi(),E=bd().DESELECTDIM;function A(t){var e=t[0],r=e.trace,i=e.t,n=i._scene,o=i.index,a=n.selectBatch[o],s=n.unselectBatch[o],f=n.textOptions[o],v=n.textSelectedOptions[o]||{},g=n.textUnselectedOptions[o]||{},m=u.extendFlat({},f),w,l;if(a.length||s.length){var x=v.color,y=g.color,S=f.color,k=u.isArrayOrTypedArray(S);for(m.color=new Array(r._length),w=0;w{var u=nu(),d=G3().styleTextSelection;V.exports=function(E,A){var t=E.cd,e=E.xaxis,r=E.yaxis,i=[],n=t[0].trace,o=t[0].t,a=n._length,s=o.x,f=o.y,v=o._scene,g=o.index;if(!v)return i;var m=u.hasText(n),w=u.hasMarkers(n),l=!w&&!m;if(n.visible!==!0||l)return i;var x=[],y=[];if(A!==!1&&!A.degenerate)for(var S=0;S{var u=Nx();V.exports={moduleType:"trace",name:"scattergl",basePlotModule:Yc(),categories:["gl","regl","cartesian","symbols","errorBarsOK","showLegend","scatter-like"],attributes:Iv(),supplyDefaults:BE(),crossTraceDefaults:Nb(),colorbar:Zf(),formatLabels:RE(),calc:$E(),hoverPoints:u.hoverPoints,selectPoints:Z3(),meta:{}}}),QE=Vt((K,V)=>{var u=Ev();V.exports=d,V.exports.to=d,V.exports.from=E;function d(A,t){t==null&&(t=!0);var e=A[0],r=A[1],i=A[2],n=A[3];n==null&&(n=t?1:255),t&&(e*=255,r*=255,i*=255,n*=255),e=u(e,0,255)&255,r=u(r,0,255)&255,i=u(i,0,255)&255,n=u(n,0,255)&255;var o=e*16777216+(r<<16)+(i<<8)+n;return o}function E(A,t){A=+A;var e=A>>>24,r=(A&16711680)>>>16,i=(A&65280)>>>8,n=A&255;return t===!1?[e,r,i,n]:[e/255,r/255,i/255,n/255]}}),of=Vt((K,V)=>{var u=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;function A(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function t(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var r={},i=0;i<10;i++)r["_"+String.fromCharCode(i)]=i;var n=Object.getOwnPropertyNames(r).map(function(a){return r[a]});if(n.join("")!=="0123456789")return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(a){o[a]=a}),Object.keys(Object.assign({},o)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}V.exports=t()?Object.assign:function(e,r){for(var i,n=A(e),o,a=1;a{V.exports=function(u){typeof u=="string"&&(u=[u]);for(var d=[].slice.call(arguments,1),E=[],A=0;A{V.exports=function(u,d,E){Array.isArray(E)||(E=[].slice.call(arguments,2));for(var A=0,t=E.length;A{V.exports=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion))}),Vx=Vt((K,V)=>{V.exports=E,V.exports.float32=V.exports.float=E,V.exports.fract32=V.exports.fract=d;var u=new Float32Array(1);function d(A,t){if(A.length){if(A instanceof Float32Array)return new Float32Array(A.length);t instanceof Float32Array||(t=E(A));for(var e=0,r=t.length;e{function u(b,_){var P=b==null?null:typeof Symbol<"u"&&b[Symbol.iterator]||b["@@iterator"];if(P!=null){var z,D,B,R,I=[],F=!0,j=!1;try{if(B=(P=P.call(b)).next,_!==0)for(;!(F=(z=B.call(P)).done)&&(I.push(z.value),I.length!==_);F=!0);}catch(N){j=!0,D=N}finally{try{if(!F&&P.return!=null&&(R=P.return(),Object(R)!==R))return}finally{if(j)throw D}}return I}}function d(b,_){return t(b)||u(b,_)||r(b,_)||o()}function E(b){return A(b)||e(b)||r(b)||n()}function A(b){if(Array.isArray(b))return i(b)}function t(b){if(Array.isArray(b))return b}function e(b){if(typeof Symbol<"u"&&b[Symbol.iterator]!=null||b["@@iterator"]!=null)return Array.from(b)}function r(b,_){if(b){if(typeof b=="string")return i(b,_);var P=Object.prototype.toString.call(b).slice(8,-1);if(P==="Object"&&b.constructor&&(P=b.constructor.name),P==="Map"||P==="Set")return Array.from(b);if(P==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(P))return i(b,_)}}function i(b,_){(_==null||_>b.length)&&(_=b.length);for(var P=0,z=new Array(_);P<_;P++)z[P]=b[P];return z}function n(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=Nd(),s=C0(),f=QE(),v=Ux(),g=of(),m=t7(),w=bp(),l=K3(),x=I0(),y=e7(),S=Vx(),k=Xm(),M=T;function T(b,_){var P=this;if(!(this instanceof T))return new T(b,_);typeof b=="function"?(_||(_={}),_.regl=b):(_=b,b=null),_&&_.length&&(_.positions=_),b=_.regl;var z=b._gl,D,B=[],R={},I=[],F=[null],j=[null],N=255,G=100;this.tooManyColors=y,D=b.texture({data:new Uint8Array(N*4),width:N,height:1,type:"uint8",format:"rgba",wrapS:"clamp",wrapT:"clamp",mag:"nearest",min:"nearest"}),g(this,{regl:b,gl:z,groups:I,markerCache:j,markerTextures:F,palette:B,paletteIds:R,paletteTexture:D,maxColors:N,maxSize:G,canvas:z.canvas}),this.update(_);var rt={uniforms:{constPointSize:!!_.constPointSize,opacity:b.prop("opacity"),paletteSize:function(et,Z){return[P.tooManyColors?0:N,D.height]},pixelRatio:b.context("pixelRatio"),scale:b.prop("scale"),scaleFract:b.prop("scaleFract"),translate:b.prop("translate"),translateFract:b.prop("translateFract"),markerTexture:b.prop("markerTexture"),paletteTexture:D},attributes:{x:function(et,Z){return Z.xAttr||{buffer:Z.positionBuffer,stride:8,offset:0}},y:function(et,Z){return Z.yAttr||{buffer:Z.positionBuffer,stride:8,offset:4}},xFract:function(et,Z){return Z.xAttr?{constant:[0,0]}:{buffer:Z.positionFractBuffer,stride:8,offset:0}},yFract:function(et,Z){return Z.yAttr?{constant:[0,0]}:{buffer:Z.positionFractBuffer,stride:8,offset:4}},size:function(et,Z){return Z.size.length?{buffer:Z.sizeBuffer,stride:2,offset:0}:{constant:[Math.round(Z.size*255/P.maxSize)]}},borderSize:function(et,Z){return Z.borderSize.length?{buffer:Z.sizeBuffer,stride:2,offset:1}:{constant:[Math.round(Z.borderSize*255/P.maxSize)]}},colorId:function(et,Z){return Z.color.length?{buffer:Z.colorBuffer,stride:P.tooManyColors?8:4,offset:0}:{constant:P.tooManyColors?B.slice(Z.color*4,Z.color*4+4):[Z.color]}},borderColorId:function(et,Z){return Z.borderColor.length?{buffer:Z.colorBuffer,stride:P.tooManyColors?8:4,offset:P.tooManyColors?4:2}:{constant:P.tooManyColors?B.slice(Z.borderColor*4,Z.borderColor*4+4):[Z.borderColor]}},isActive:function(et,Z){return Z.activation===!0?{constant:[1]}:Z.activation?Z.activation:{constant:[0]}}},blend:{enable:!0,color:[0,0,0,1],func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},scissor:{enable:!0,box:b.prop("viewport")},viewport:b.prop("viewport"),stencil:{enable:!1},depth:{enable:!1},elements:b.prop("elements"),count:b.prop("count"),offset:b.prop("offset"),primitive:"points"},ct=g({},rt);ct.frag=m([`precision highp float; +#define GLSLIFY 1 + +uniform float opacity; +uniform sampler2D markerTexture; + +varying vec4 fragColor, fragBorderColor; +varying float fragWidth, fragBorderColorLevel, fragColorLevel; + +float smoothStep(float x, float y) { + return 1.0 / (1.0 + exp(50.0*(x - y))); +} + +void main() { + float dist = texture2D(markerTexture, gl_PointCoord).r, delta = fragWidth; + + // max-distance alpha + if (dist < 0.003) discard; + + // null-border case + if (fragBorderColorLevel == fragColorLevel || fragBorderColor.a == 0.) { + float colorAmt = smoothstep(.5 - delta, .5 + delta, dist); + gl_FragColor = vec4(fragColor.rgb, colorAmt * fragColor.a * opacity); + } + else { + float borderColorAmt = smoothstep(fragBorderColorLevel - delta, fragBorderColorLevel + delta, dist); + float colorAmt = smoothstep(fragColorLevel - delta, fragColorLevel + delta, dist); + + vec4 color = fragBorderColor; + color.a *= borderColorAmt; + color = mix(color, fragColor, colorAmt); + color.a *= opacity; + + gl_FragColor = color; + } + +} +`]),ct.vert=m([`precision highp float; +#define GLSLIFY 1 + +attribute float x, y, xFract, yFract; +attribute float size, borderSize; +attribute vec4 colorId, borderColorId; +attribute float isActive; + +// \`invariant\` effectively turns off optimizations for the position. +// We need this because -fast-math on M1 Macs is re-ordering +// floating point operations in a way that causes floating point +// precision limits to put points in the wrong locations. +invariant gl_Position; + +uniform bool constPointSize; +uniform float pixelRatio; +uniform vec2 scale, scaleFract, translate, translateFract, paletteSize; +uniform sampler2D paletteTexture; + +const float maxSize = 100.; +const float borderLevel = .5; + +varying vec4 fragColor, fragBorderColor; +varying float fragPointSize, fragBorderRadius, fragWidth, fragBorderColorLevel, fragColorLevel; + +float pointSizeScale = (constPointSize) ? 2. : pixelRatio; + +bool isDirect = (paletteSize.x < 1.); + +vec4 getColor(vec4 id) { + return isDirect ? id / 255. : texture2D(paletteTexture, + vec2( + (id.x + .5) / paletteSize.x, + (id.y + .5) / paletteSize.y + ) + ); +} + +void main() { + // ignore inactive points + if (isActive == 0.) return; + + vec2 position = vec2(x, y); + vec2 positionFract = vec2(xFract, yFract); + + vec4 color = getColor(colorId); + vec4 borderColor = getColor(borderColorId); + + float size = size * maxSize / 255.; + float borderSize = borderSize * maxSize / 255.; + + gl_PointSize = 2. * size * pointSizeScale; + fragPointSize = size * pixelRatio; + + vec2 pos = (position + translate) * scale + + (positionFract + translateFract) * scale + + (position + translate) * scaleFract + + (positionFract + translateFract) * scaleFract; + + gl_Position = vec4(pos * 2. - 1., 0., 1.); + + fragColor = color; + fragBorderColor = borderColor; + fragWidth = 1. / gl_PointSize; + + fragBorderColorLevel = clamp(borderLevel - borderLevel * borderSize / size, 0., 1.); + fragColorLevel = clamp(borderLevel + (1. - borderLevel) * borderSize / size, 0., 1.); +} +`]),this.drawMarker=b(ct);var st=g({},rt);st.frag=m([`precision highp float; +#define GLSLIFY 1 + +varying vec4 fragColor, fragBorderColor; +varying float fragBorderRadius, fragWidth; + +uniform float opacity; + +float smoothStep(float edge0, float edge1, float x) { + float t; + t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0); + return t * t * (3.0 - 2.0 * t); +} + +void main() { + float radius, alpha = 1.0, delta = fragWidth; + + radius = length(2.0 * gl_PointCoord.xy - 1.0); + + if (radius > 1.0 + delta) { + discard; + } + + alpha -= smoothstep(1.0 - delta, 1.0 + delta, radius); + + float borderRadius = fragBorderRadius; + float ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius); + vec4 color = mix(fragColor, fragBorderColor, ratio); + color.a *= alpha * opacity; + gl_FragColor = color; +} +`]),st.vert=m([`precision highp float; +#define GLSLIFY 1 + +attribute float x, y, xFract, yFract; +attribute float size, borderSize; +attribute vec4 colorId, borderColorId; +attribute float isActive; + +// \`invariant\` effectively turns off optimizations for the position. +// We need this because -fast-math on M1 Macs is re-ordering +// floating point operations in a way that causes floating point +// precision limits to put points in the wrong locations. +invariant gl_Position; + +uniform bool constPointSize; +uniform float pixelRatio; +uniform vec2 paletteSize, scale, scaleFract, translate, translateFract; +uniform sampler2D paletteTexture; + +const float maxSize = 100.; + +varying vec4 fragColor, fragBorderColor; +varying float fragBorderRadius, fragWidth; + +float pointSizeScale = (constPointSize) ? 2. : pixelRatio; + +bool isDirect = (paletteSize.x < 1.); + +vec4 getColor(vec4 id) { + return isDirect ? id / 255. : texture2D(paletteTexture, + vec2( + (id.x + .5) / paletteSize.x, + (id.y + .5) / paletteSize.y + ) + ); +} + +void main() { + // ignore inactive points + if (isActive == 0.) return; + + vec2 position = vec2(x, y); + vec2 positionFract = vec2(xFract, yFract); + + vec4 color = getColor(colorId); + vec4 borderColor = getColor(borderColorId); + + float size = size * maxSize / 255.; + float borderSize = borderSize * maxSize / 255.; + + gl_PointSize = (size + borderSize) * pointSizeScale; + + vec2 pos = (position + translate) * scale + + (positionFract + translateFract) * scale + + (position + translate) * scaleFract + + (positionFract + translateFract) * scaleFract; + + gl_Position = vec4(pos * 2. - 1., 0., 1.); + + fragBorderRadius = 1. - 2. * borderSize / (size + borderSize); + fragColor = color; + fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor; + fragWidth = 1. / gl_PointSize; +} +`]),y&&(st.frag=st.frag.replace("smoothstep","smoothStep"),ct.frag=ct.frag.replace("smoothstep","smoothStep")),this.drawCircle=b(st)}T.defaults={color:"black",borderColor:"transparent",borderSize:0,size:12,opacity:1,marker:void 0,viewport:null,range:null,pixelSize:null,count:0,offset:0,bounds:null,positions:[],snap:1e4},T.prototype.render=function(){return arguments.length&&this.update.apply(this,arguments),this.draw(),this},T.prototype.draw=function(){for(var b=this,_=arguments.length,P=new Array(_),z=0;z<_;z++)P[z]=arguments[z];var D=this.groups;if(P.length===1&&Array.isArray(P[0])&&(P[0][0]===null||Array.isArray(P[0][0]))&&(P=P[0]),this.regl._refresh(),P.length)for(var B=0;Bmt)?ee.tree=v(Jt,{bounds:Kt}):mt&&mt.length&&(ee.tree=mt),ee.tree){var ue={primitive:"points",usage:"static",data:ee.tree,type:"uint32"};ee.elements?ee.elements(ue):ee.elements=R.elements(ue)}var Me=S.float32(Jt);bt({data:Me,usage:"dynamic"});var Ce=S.fract32(Jt,Me);return vt({data:Ce,usage:"dynamic"}),Ut({data:new Uint8Array(re),type:"uint8",usage:"stream"}),Jt}},{marker:function(Jt,ee,Zt){var mt=ee.activation;if(mt.forEach(function(Ce){return Ce&&Ce.destroy&&Ce.destroy()}),mt.length=0,!Jt||typeof Jt[0]=="number"){var bt=b.addMarker(Jt);mt[bt]=!0}else{for(var vt=[],Ut=0,re=Math.min(Jt.length,ee.count);Ut=0)return D;var B;if(b instanceof Uint8Array||b instanceof Uint8ClampedArray)B=b;else{B=new Uint8Array(b.length);for(var R=0,I=b.length;Rz*4&&(this.tooManyColors=!0),this.updatePalette(P),D.length===1?D[0]:D},T.prototype.updatePalette=function(b){if(!this.tooManyColors){var _=this.maxColors,P=this.paletteTexture,z=Math.ceil(b.length*.25/_);if(z>1){b=b.slice();for(var D=b.length*.25%_;D{V.exports=u,V.exports.default=u;function u(R,I,F){F=F||2;var j=I&&I.length,N=j?I[0]*F:R.length,G=d(R,0,N,F,!0),rt=[];if(!G||G.next===G.prev)return rt;var ct,st,et,Z,ot,X,Q;if(j&&(G=n(R,I,G,F)),R.length>80*F){ct=et=R[0],st=Z=R[1];for(var ut=F;utet&&(et=ot),X>Z&&(Z=X);Q=Math.max(et-ct,Z-st),Q=Q!==0?32767/Q:0}return A(G,rt,F,ct,st,Q,0),rt}function d(R,I,F,j,N){var G,rt;if(N===B(R,I,F,j)>0)for(G=I;G=I;G-=j)rt=P(G,R[G],R[G+1],rt);return rt&&S(rt,rt.next)&&(z(rt),rt=rt.next),rt}function E(R,I){if(!R)return R;I||(I=R);var F=R,j;do if(j=!1,!F.steiner&&(S(F,F.next)||y(F.prev,F,F.next)===0)){if(z(F),F=I=F.prev,F===F.next)break;j=!0}else F=F.next;while(j||F!==I);return I}function A(R,I,F,j,N,G,rt){if(R){!rt&&G&&v(R,j,N,G);for(var ct=R,st,et;R.prev!==R.next;){if(st=R.prev,et=R.next,G?e(R,j,N,G):t(R)){I.push(st.i/F|0),I.push(R.i/F|0),I.push(et.i/F|0),z(R),R=et.next,ct=et.next;continue}if(R=et,R===ct){rt?rt===1?(R=r(E(R),I,F),A(R,I,F,j,N,G,2)):rt===2&&i(R,I,F,j,N,G):A(E(R),I,F,j,N,G,1);break}}}}function t(R){var I=R.prev,F=R,j=R.next;if(y(I,F,j)>=0)return!1;for(var N=I.x,G=F.x,rt=j.x,ct=I.y,st=F.y,et=j.y,Z=NG?N>rt?N:rt:G>rt?G:rt,Q=ct>st?ct>et?ct:et:st>et?st:et,ut=j.next;ut!==I;){if(ut.x>=Z&&ut.x<=X&&ut.y>=ot&&ut.y<=Q&&l(N,ct,G,st,rt,et,ut.x,ut.y)&&y(ut.prev,ut,ut.next)>=0)return!1;ut=ut.next}return!0}function e(R,I,F,j){var N=R.prev,G=R,rt=R.next;if(y(N,G,rt)>=0)return!1;for(var ct=N.x,st=G.x,et=rt.x,Z=N.y,ot=G.y,X=rt.y,Q=ctst?ct>et?ct:et:st>et?st:et,q=Z>ot?Z>X?Z:X:ot>X?ot:X,it=m(Q,ut,I,F,j),nt=m(J,q,I,F,j),dt=R.prevZ,Tt=R.nextZ;dt&&dt.z>=it&&Tt&&Tt.z<=nt;){if(dt.x>=Q&&dt.x<=J&&dt.y>=ut&&dt.y<=q&&dt!==N&&dt!==rt&&l(ct,Z,st,ot,et,X,dt.x,dt.y)&&y(dt.prev,dt,dt.next)>=0||(dt=dt.prevZ,Tt.x>=Q&&Tt.x<=J&&Tt.y>=ut&&Tt.y<=q&&Tt!==N&&Tt!==rt&&l(ct,Z,st,ot,et,X,Tt.x,Tt.y)&&y(Tt.prev,Tt,Tt.next)>=0))return!1;Tt=Tt.nextZ}for(;dt&&dt.z>=it;){if(dt.x>=Q&&dt.x<=J&&dt.y>=ut&&dt.y<=q&&dt!==N&&dt!==rt&&l(ct,Z,st,ot,et,X,dt.x,dt.y)&&y(dt.prev,dt,dt.next)>=0)return!1;dt=dt.prevZ}for(;Tt&&Tt.z<=nt;){if(Tt.x>=Q&&Tt.x<=J&&Tt.y>=ut&&Tt.y<=q&&Tt!==N&&Tt!==rt&&l(ct,Z,st,ot,et,X,Tt.x,Tt.y)&&y(Tt.prev,Tt,Tt.next)>=0)return!1;Tt=Tt.nextZ}return!0}function r(R,I,F){var j=R;do{var N=j.prev,G=j.next.next;!S(N,G)&&k(N,j,j.next,G)&&h(N,G)&&h(G,N)&&(I.push(N.i/F|0),I.push(j.i/F|0),I.push(G.i/F|0),z(j),z(j.next),j=R=G),j=j.next}while(j!==R);return E(j)}function i(R,I,F,j,N,G){var rt=R;do{for(var ct=rt.next.next;ct!==rt.prev;){if(rt.i!==ct.i&&x(rt,ct)){var st=_(rt,ct);rt=E(rt,rt.next),st=E(st,st.next),A(rt,I,F,j,N,G,0),A(st,I,F,j,N,G,0);return}ct=ct.next}rt=rt.next}while(rt!==R)}function n(R,I,F,j){var N=[],G,rt,ct,st,et;for(G=0,rt=I.length;G=F.next.y&&F.next.y!==F.y){var ct=F.x+(N-F.y)*(F.next.x-F.x)/(F.next.y-F.y);if(ct<=j&&ct>G&&(G=ct,rt=F.x=F.x&&F.x>=et&&j!==F.x&&l(Nrt.x||F.x===rt.x&&f(rt,F)))&&(rt=F,ot=X)),F=F.next;while(F!==st);return rt}function f(R,I){return y(R.prev,R,I.prev)<0&&y(I.next,R,R.next)<0}function v(R,I,F,j){var N=R;do N.z===0&&(N.z=m(N.x,N.y,I,F,j)),N.prevZ=N.prev,N.nextZ=N.next,N=N.next;while(N!==R);N.prevZ.nextZ=null,N.prevZ=null,g(N)}function g(R){var I,F,j,N,G,rt,ct,st,et=1;do{for(F=R,R=null,G=null,rt=0;F;){for(rt++,j=F,ct=0,I=0;I0||st>0&&j;)ct!==0&&(st===0||!j||F.z<=j.z)?(N=F,F=F.nextZ,ct--):(N=j,j=j.nextZ,st--),G?G.nextZ=N:R=N,N.prevZ=G,G=N;F=j}G.nextZ=null,et*=2}while(rt>1);return R}function m(R,I,F,j,N){return R=(R-F)*N|0,I=(I-j)*N|0,R=(R|R<<8)&16711935,R=(R|R<<4)&252645135,R=(R|R<<2)&858993459,R=(R|R<<1)&1431655765,I=(I|I<<8)&16711935,I=(I|I<<4)&252645135,I=(I|I<<2)&858993459,I=(I|I<<1)&1431655765,R|I<<1}function w(R){var I=R,F=R;do(I.x=(R-rt)*(G-ct)&&(R-rt)*(j-ct)>=(F-rt)*(I-ct)&&(F-rt)*(G-ct)>=(N-rt)*(j-ct)}function x(R,I){return R.next.i!==I.i&&R.prev.i!==I.i&&!c(R,I)&&(h(R,I)&&h(I,R)&&b(R,I)&&(y(R.prev,R,I.prev)||y(R,I.prev,I))||S(R,I)&&y(R.prev,R,R.next)>0&&y(I.prev,I,I.next)>0)}function y(R,I,F){return(I.y-R.y)*(F.x-I.x)-(I.x-R.x)*(F.y-I.y)}function S(R,I){return R.x===I.x&&R.y===I.y}function k(R,I,F,j){var N=T(y(R,I,F)),G=T(y(R,I,j)),rt=T(y(F,j,R)),ct=T(y(F,j,I));return!!(N!==G&&rt!==ct||N===0&&M(R,F,I)||G===0&&M(R,j,I)||rt===0&&M(F,R,j)||ct===0&&M(F,I,j))}function M(R,I,F){return I.x<=Math.max(R.x,F.x)&&I.x>=Math.min(R.x,F.x)&&I.y<=Math.max(R.y,F.y)&&I.y>=Math.min(R.y,F.y)}function T(R){return R>0?1:R<0?-1:0}function c(R,I){var F=R;do{if(F.i!==R.i&&F.next.i!==R.i&&F.i!==I.i&&F.next.i!==I.i&&k(F,F.next,R,I))return!0;F=F.next}while(F!==R);return!1}function h(R,I){return y(R.prev,R,R.next)<0?y(R,I,R.next)>=0&&y(R,R.prev,I)>=0:y(R,I,R.prev)<0||y(R,R.next,I)<0}function b(R,I){var F=R,j=!1,N=(R.x+I.x)/2,G=(R.y+I.y)/2;do F.y>G!=F.next.y>G&&F.next.y!==F.y&&N<(F.next.x-F.x)*(G-F.y)/(F.next.y-F.y)+F.x&&(j=!j),F=F.next;while(F!==R);return j}function _(R,I){var F=new D(R.i,R.x,R.y),j=new D(I.i,I.x,I.y),N=R.next,G=I.prev;return R.next=I,I.prev=R,F.next=N,N.prev=F,j.next=F,F.prev=j,G.next=j,j.prev=G,j}function P(R,I,F,j){var N=new D(R,I,F);return j?(N.next=j.next,N.prev=j,j.next.prev=N,j.next=N):(N.prev=N,N.next=N),N}function z(R){R.next.prev=R.prev,R.prev.next=R.next,R.prevZ&&(R.prevZ.nextZ=R.nextZ),R.nextZ&&(R.nextZ.prevZ=R.prevZ)}function D(R,I,F){this.i=R,this.x=I,this.y=F,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}u.deviation=function(R,I,F,j){var N=I&&I.length,G=N?I[0]*F:R.length,rt=Math.abs(B(R,0,G,F));if(N)for(var ct=0,st=I.length;ct0&&(j+=R[N-1].length,F.holes.push(j))}return F}}),n7=Vt((K,V)=>{var u=C0();V.exports=d;function d(E,A,t){if(!E||E.length==null)throw Error("Argument should be an array");A==null&&(A=1),t==null&&(t=u(E,A));for(var e=0;e{V.exports=function(){var u,d;if(typeof WeakMap!="function")return!1;try{u=new WeakMap([[d={},"one"],[{},"two"],[{},"three"]])}catch{return!1}return!(String(u)!=="[object WeakMap]"||typeof u.set!="function"||u.set({},1)!==u||typeof u.delete!="function"||typeof u.has!="function"||u.get(d)!=="one")}}),i7=Vt((K,V)=>{V.exports=function(){}}),qd=Vt((K,V)=>{var u=i7()();V.exports=function(d){return d!==u&&d!==null}}),X3=Vt((K,V)=>{var u=Object.create,d=Object.getPrototypeOf,E={};V.exports=function(){var A=Object.setPrototypeOf,t=arguments[0]||u;return typeof A!="function"?!1:d(A(t(null),E))===E}}),$3=Vt((K,V)=>{var u=qd(),d={function:!0,object:!0};V.exports=function(E){return u(E)&&d[typeof E]||!1}}),qp=Vt((K,V)=>{var u=qd();V.exports=function(d){if(!u(d))throw new TypeError("Cannot use null or undefined");return d}}),o7=Vt((K,V)=>{var u=Object.create,d;X3()()||(d=J3()),V.exports=(function(){var E,A,t;return!d||d.level!==1?u:(E={},A={},t={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach(function(e){if(e==="__proto__"){A[e]={configurable:!0,enumerable:!1,writable:!0,value:void 0};return}A[e]=t}),Object.defineProperties(E,A),Object.defineProperty(d,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:E}),function(e,r){return u(e===null?E:e,r)})})()}),J3=Vt((K,V)=>{var u=$3(),d=qp(),E=Object.prototype.isPrototypeOf,A=Object.defineProperty,t={configurable:!0,enumerable:!1,writable:!0,value:void 0},e;e=function(r,i){if(d(r),i===null||u(i))return r;throw new TypeError("Prototype must be null or an object")},V.exports=(function(r){var i,n;return r?(r.level===2?r.set?(n=r.set,i=function(o,a){return n.call(e(o,a),a),o}):i=function(o,a){return e(o,a).__proto__=a,o}:i=function o(a,s){var f;return e(a,s),f=E.call(o.nullPolyfill,a),f&&delete o.nullPolyfill.__proto__,s===null&&(s=o.nullPolyfill),a.__proto__=s,f&&A(o.nullPolyfill,"__proto__",t),a},Object.defineProperty(i,"level",{configurable:!1,enumerable:!1,writable:!1,value:r.level})):null})((function(){var r=Object.create(null),i={},n,o=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");if(o){try{n=o.set,n.call(r,i)}catch{}if(Object.getPrototypeOf(r)===i)return{set:n,level:2}}return r.__proto__=i,Object.getPrototypeOf(r)===i?{level:2}:(r={},r.__proto__=i,Object.getPrototypeOf(r)===i?{level:1}:!1)})()),o7()}),Hx=Vt((K,V)=>{V.exports=X3()()?Object.setPrototypeOf:J3()}),s7=Vt((K,V)=>{var u=$3();V.exports=function(d){if(!u(d))throw new TypeError(d+" is not an Object");return d}}),l7=Vt((K,V)=>{var u=Object.create(null),d=Math.random;V.exports=function(){var E;do E=d().toString(36).slice(2);while(u[E]);return E}}),O0=Vt((K,V)=>{var u=void 0;V.exports=function(d){return d!==u&&d!==null}}),qx=Vt((K,V)=>{var u=O0(),d={object:!0,function:!0,undefined:!0};V.exports=function(E){return u(E)?hasOwnProperty.call(d,typeof E):!1}}),u7=Vt((K,V)=>{var u=qx();V.exports=function(d){if(!u(d))return!1;try{return d.constructor?d.constructor.prototype===d:!1}catch{return!1}}}),c7=Vt((K,V)=>{var u=u7();V.exports=function(d){if(typeof d!="function"||!hasOwnProperty.call(d,"length"))return!1;try{if(typeof d.length!="number"||typeof d.call!="function"||typeof d.apply!="function")return!1}catch{return!1}return!u(d)}}),Q3=Vt((K,V)=>{var u=c7(),d=/^\s*class[\s{/}]/,E=Function.prototype.toString;V.exports=function(A){return!(!u(A)||d.test(E.call(A)))}}),f7=Vt((K,V)=>{V.exports=function(){var u=Object.assign,d;return typeof u!="function"?!1:(d={foo:"raz"},u(d,{bar:"dwa"},{trzy:"trzy"}),d.foo+d.bar+d.trzy==="razdwatrzy")}}),h7=Vt((K,V)=>{V.exports=function(){try{return Object.keys("primitive"),!0}catch{return!1}}}),p7=Vt((K,V)=>{var u=qd(),d=Object.keys;V.exports=function(E){return d(u(E)?Object(E):E)}}),d7=Vt((K,V)=>{V.exports=h7()()?Object.keys:p7()}),m7=Vt((K,V)=>{var u=d7(),d=qp(),E=Math.max;V.exports=function(A,t){var e,r,i=E(arguments.length,2),n;for(A=Object(d(A)),n=function(o){try{A[o]=t[o]}catch(a){e||(e=a)}},r=1;r{V.exports=f7()()?Object.assign:m7()}),t5=Vt((K,V)=>{var u=qd(),d=Array.prototype.forEach,E=Object.create,A=function(t,e){var r;for(r in t)e[r]=t[r]};V.exports=function(t){var e=E(null);return d.call(arguments,function(r){u(r)&&A(Object(r),e)}),e}}),g7=Vt((K,V)=>{var u="razdwatrzy";V.exports=function(){return typeof u.contains!="function"?!1:u.contains("dwa")===!0&&u.contains("foo")===!1}}),v7=Vt((K,V)=>{var u=String.prototype.indexOf;V.exports=function(d){return u.call(this,d,arguments[1])>-1}}),e5=Vt((K,V)=>{V.exports=g7()()?String.prototype.contains:v7()}),Wp=Vt((K,V)=>{var u=O0(),d=Q3(),E=Wx(),A=t5(),t=e5(),e=V.exports=function(r,i){var n,o,a,s,f;return arguments.length<2||typeof r!="string"?(s=i,i=r,r=null):s=arguments[2],u(r)?(n=t.call(r,"c"),o=t.call(r,"e"),a=t.call(r,"w")):(n=a=!0,o=!1),f={value:i,configurable:n,enumerable:o,writable:a},s?E(A(s),f):f};e.gs=function(r,i,n){var o,a,s,f;return typeof r!="string"?(s=n,n=i,i=r,r=null):s=arguments[3],u(i)?d(i)?u(n)?d(n)||(s=n,n=void 0):n=void 0:(s=i,i=n=void 0):i=void 0,u(r)?(o=t.call(r,"c"),a=t.call(r,"e")):(o=!0,a=!1),f={get:i,set:n,configurable:o,enumerable:a},s?E(A(s),f):f}}),Pv=Vt((K,V)=>{var u=Object.prototype.toString,d=u.call((function(){return arguments})());V.exports=function(E){return u.call(E)===d}}),Ov=Vt((K,V)=>{var u=Object.prototype.toString,d=u.call("");V.exports=function(E){return typeof E=="string"||E&&typeof E=="object"&&(E instanceof String||u.call(E)===d)||!1}}),y7=Vt((K,V)=>{V.exports=function(){return typeof globalThis!="object"||!globalThis?!1:globalThis.Array===Array}}),x7=Vt((K,V)=>{var u=function(){if(typeof self=="object"&&self)return self;if(typeof window=="object"&&window)return window;throw new Error("Unable to resolve global `this`")};V.exports=(function(){if(this)return this;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch{return u()}try{return __global__||u()}finally{delete Object.prototype.__global__}})()}),Dv=Vt((K,V)=>{V.exports=y7()()?globalThis:x7()}),_7=Vt((K,V)=>{var u=Dv(),d={object:!0,symbol:!0};V.exports=function(){var E=u.Symbol,A;if(typeof E!="function")return!1;A=E("test symbol");try{String(A)}catch{return!1}return!(!d[typeof E.iterator]||!d[typeof E.toPrimitive]||!d[typeof E.toStringTag])}}),b7=Vt((K,V)=>{V.exports=function(u){return u?typeof u=="symbol"?!0:!u.constructor||u.constructor.name!=="Symbol"?!1:u[u.constructor.toStringTag]==="Symbol":!1}}),r5=Vt((K,V)=>{var u=b7();V.exports=function(d){if(!u(d))throw new TypeError(d+" is not a symbol");return d}}),w7=Vt((K,V)=>{var u=Wp(),d=Object.create,E=Object.defineProperty,A=Object.prototype,t=d(null);V.exports=function(e){for(var r=0,i,n;t[e+(r||"")];)++r;return e+=r||"",t[e]=!0,i="@@"+e,E(A,i,u.gs(null,function(o){n||(n=!0,E(this,i,u(o)),n=!1)})),i}}),T7=Vt((K,V)=>{var u=Wp(),d=Dv().Symbol;V.exports=function(E){return Object.defineProperties(E,{hasInstance:u("",d&&d.hasInstance||E("hasInstance")),isConcatSpreadable:u("",d&&d.isConcatSpreadable||E("isConcatSpreadable")),iterator:u("",d&&d.iterator||E("iterator")),match:u("",d&&d.match||E("match")),replace:u("",d&&d.replace||E("replace")),search:u("",d&&d.search||E("search")),species:u("",d&&d.species||E("species")),split:u("",d&&d.split||E("split")),toPrimitive:u("",d&&d.toPrimitive||E("toPrimitive")),toStringTag:u("",d&&d.toStringTag||E("toStringTag")),unscopables:u("",d&&d.unscopables||E("unscopables"))})}}),k7=Vt((K,V)=>{var u=Wp(),d=r5(),E=Object.create(null);V.exports=function(A){return Object.defineProperties(A,{for:u(function(t){return E[t]?E[t]:E[t]=A(String(t))}),keyFor:u(function(t){var e;d(t);for(e in E)if(E[e]===t)return e})})}}),A7=Vt((K,V)=>{var u=Wp(),d=r5(),E=Dv().Symbol,A=w7(),t=T7(),e=k7(),r=Object.create,i=Object.defineProperties,n=Object.defineProperty,o,a,s;if(typeof E=="function")try{String(E()),s=!0}catch{}else E=null;a=function(f){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return o(f)},V.exports=o=function f(v){var g;if(this instanceof f)throw new TypeError("Symbol is not a constructor");return s?E(v):(g=r(a.prototype),v=v===void 0?"":String(v),i(g,{__description__:u("",v),__name__:u("",A(v))}))},t(o),e(o),i(a.prototype,{constructor:u(o),toString:u("",function(){return this.__name__})}),i(o.prototype,{toString:u(function(){return"Symbol ("+d(this).__description__+")"}),valueOf:u(function(){return d(this)})}),n(o.prototype,o.toPrimitive,u("",function(){var f=d(this);return typeof f=="symbol"?f:f.toString()})),n(o.prototype,o.toStringTag,u("c","Symbol")),n(a.prototype,o.toStringTag,u("c",o.prototype[o.toStringTag])),n(a.prototype,o.toPrimitive,u("c",o.prototype[o.toPrimitive]))}),Wd=Vt((K,V)=>{V.exports=_7()()?Dv().Symbol:A7()}),M7=Vt((K,V)=>{var u=qp();V.exports=function(){return u(this).length=0,this}}),$m=Vt((K,V)=>{V.exports=function(u){if(typeof u!="function")throw new TypeError(u+" is not a function");return u}}),S7=Vt((K,V)=>{var u=O0(),d=qx(),E=Object.prototype.toString;V.exports=function(A){if(!u(A))return null;if(d(A)){var t=A.toString;if(typeof t!="function"||t===E)return null}try{return""+A}catch{return null}}}),E7=Vt((K,V)=>{V.exports=function(u){try{return u.toString()}catch{try{return String(u)}catch{return null}}}}),z7=Vt((K,V)=>{var u=E7(),d=/[\n\r\u2028\u2029]/g;V.exports=function(E){var A=u(E);return A===null?"":(A.length>100&&(A=A.slice(0,99)+"…"),A=A.replace(d,function(t){switch(t){case` +`:return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}}),A)}}),n5=Vt((K,V)=>{var u=O0(),d=qx(),E=S7(),A=z7(),t=function(e,r){return e.replace("%v",A(r))};V.exports=function(e,r,i){if(!d(i))throw new TypeError(t(r,e));if(!u(e)){if("default"in i)return i.default;if(i.isOptional)return null}var n=E(i.errorMessage);throw u(n)||(n=r),new TypeError(t(n,e))}}),L7=Vt((K,V)=>{var u=n5(),d=O0();V.exports=function(E){return d(E)?E:u(E,"Cannot use %v",arguments[1])}}),C7=Vt((K,V)=>{var u=n5(),d=Q3();V.exports=function(E){return d(E)?E:u(E,"%v is not a plain function",arguments[1])}}),I7=Vt((K,V)=>{V.exports=function(){var u=Array.from,d,E;return typeof u!="function"?!1:(d=["raz","dwa"],E=u(d),!!(E&&E!==d&&E[1]==="dwa"))}}),P7=Vt((K,V)=>{var u=Object.prototype.toString,d=RegExp.prototype.test.bind(/^[object [A-Za-z0-9]*Function]$/);V.exports=function(E){return typeof E=="function"&&d(u.call(E))}}),O7=Vt((K,V)=>{V.exports=function(){var u=Math.sign;return typeof u!="function"?!1:u(10)===1&&u(-20)===-1}}),D7=Vt((K,V)=>{V.exports=function(u){return u=Number(u),isNaN(u)||u===0?u:u>0?1:-1}}),F7=Vt((K,V)=>{V.exports=O7()()?Math.sign:D7()}),B7=Vt((K,V)=>{var u=F7(),d=Math.abs,E=Math.floor;V.exports=function(A){return isNaN(A)?0:(A=Number(A),A===0||!isFinite(A)?A:u(A)*E(d(A)))}}),R7=Vt((K,V)=>{var u=B7(),d=Math.max;V.exports=function(E){return d(0,u(E))}}),N7=Vt((K,V)=>{var u=Wd().iterator,d=Pv(),E=P7(),A=R7(),t=$m(),e=qp(),r=qd(),i=Ov(),n=Array.isArray,o=Function.prototype.call,a={configurable:!0,enumerable:!0,writable:!0,value:null},s=Object.defineProperty;V.exports=function(f){var v=arguments[1],g=arguments[2],m,w,l,x,y,S,k,M,T,c;if(f=Object(e(f)),r(v)&&t(v),!this||this===Array||!E(this)){if(!v){if(d(f))return y=f.length,y!==1?Array.apply(null,f):(x=new Array(1),x[0]=f[0],x);if(n(f)){for(x=new Array(y=f.length),w=0;w=55296&&S<=56319&&(c+=f[++w])),c=v?o.call(v,g,c,l):c,m?(a.value=c,s(x,l,a)):x[l]=c,++l;y=l}}if(y===void 0)for(y=A(f.length),m&&(x=new m(y)),w=0;w{V.exports=I7()()?Array.from:N7()}),U7=Vt((K,V)=>{var u=j7(),d=Wx(),E=qp();V.exports=function(A){var t=Object(E(A)),e=arguments[1],r=Object(arguments[2]);if(t!==A&&!e)return t;var i={};return e?u(e,function(n){(r.ensure||n in A)&&(i[n]=A[n])}):d(i,A),i}}),V7=Vt((K,V)=>{var u=$m(),d=qp(),E=Function.prototype.bind,A=Function.prototype.call,t=Object.keys,e=Object.prototype.propertyIsEnumerable;V.exports=function(r,i){return function(n,o){var a,s=arguments[2],f=arguments[3];return n=Object(d(n)),u(o),a=t(n),f&&a.sort(typeof f=="function"?E.call(f,n):void 0),typeof r!="function"&&(r=a[r]),A.call(r,a,function(v,g){return e.call(n,v)?A.call(o,s,n[v],v,n,g):i})}}}),H7=Vt((K,V)=>{V.exports=V7()("forEach")}),q7=Vt((K,V)=>{var u=$m(),d=H7(),E=Function.prototype.call;V.exports=function(A,t){var e={},r=arguments[2];return u(t),d(A,function(i,n,o,a){e[n]=E.call(t,r,i,n,o,a)}),e}}),W7=Vt((K,V)=>{var u=O0(),d=L7(),E=C7(),A=U7(),t=t5(),e=q7(),r=Function.prototype.bind,i=Object.defineProperty,n=Object.prototype.hasOwnProperty,o;o=function(a,s,f){var v=d(s)&&E(s.value),g;return g=A(s),delete g.writable,delete g.value,g.get=function(){return!f.overwriteDefinition&&n.call(this,a)?v:(s.value=r.call(v,f.resolveContext?f.resolveContext(this):this),i(this,a,s),this[a])},g},V.exports=function(a){var s=t(arguments[1]);return u(s.resolveContext)&&E(s.resolveContext),e(a,function(f,v){return o(v,f,s)})}}),a5=Vt((K,V)=>{var u=M7(),d=Wx(),E=$m(),A=qp(),t=Wp(),e=W7(),r=Wd(),i=Object.defineProperty,n=Object.defineProperties,o;V.exports=o=function(a,s){if(!(this instanceof o))throw new TypeError("Constructor requires 'new'");n(this,{__list__:t("w",A(a)),__context__:t("w",s),__nextIndex__:t("w",0)}),s&&(E(s.on),s.on("_add",this._onAdd),s.on("_delete",this._onDelete),s.on("_clear",this._onClear))},delete o.prototype.constructor,n(o.prototype,d({_next:t(function(){var a;if(this.__list__){if(this.__redo__&&(a=this.__redo__.shift(),a!==void 0))return a;if(this.__nextIndex__=this.__nextIndex__)){if(++this.__nextIndex__,!this.__redo__){i(this,"__redo__",t("c",[a]));return}this.__redo__.forEach(function(s,f){s>=a&&(this.__redo__[f]=++s)},this),this.__redo__.push(a)}}),_onDelete:t(function(a){var s;a>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(s=this.__redo__.indexOf(a),s!==-1&&this.__redo__.splice(s,1),this.__redo__.forEach(function(f,v){f>a&&(this.__redo__[v]=--f)},this)))}),_onClear:t(function(){this.__redo__&&u.call(this.__redo__),this.__nextIndex__=0})}))),i(o.prototype,r.iterator,t(function(){return this}))}),G7=Vt((K,V)=>{var u=Hx(),d=e5(),E=Wp(),A=Wd(),t=a5(),e=Object.defineProperty,r;r=V.exports=function(i,n){if(!(this instanceof r))throw new TypeError("Constructor requires 'new'");t.call(this,i),n?d.call(n,"key+value")?n="key+value":d.call(n,"key")?n="key":n="value":n="value",e(this,"__kind__",E("",n))},u&&u(r,t),delete r.prototype.constructor,r.prototype=Object.create(t.prototype,{_resolve:E(function(i){return this.__kind__==="value"?this.__list__[i]:this.__kind__==="key+value"?[i,this.__list__[i]]:i})}),e(r.prototype,A.toStringTag,E("c","Array Iterator"))}),Z7=Vt((K,V)=>{var u=Hx(),d=Wp(),E=Wd(),A=a5(),t=Object.defineProperty,e;e=V.exports=function(r){if(!(this instanceof e))throw new TypeError("Constructor requires 'new'");r=String(r),A.call(this,r),t(this,"__length__",d("",r.length))},u&&u(e,A),delete e.prototype.constructor,e.prototype=Object.create(A.prototype,{_next:d(function(){if(this.__list__){if(this.__nextIndex__=55296&&n<=56319?i+this.__list__[this.__nextIndex__++]:i)})}),t(e.prototype,E.toStringTag,d("c","String Iterator"))}),K7=Vt((K,V)=>{var u=Pv(),d=qd(),E=Ov(),A=Wd().iterator,t=Array.isArray;V.exports=function(e){return d(e)?t(e)||E(e)||u(e)?!0:typeof e[A]=="function":!1}}),Y7=Vt((K,V)=>{var u=K7();V.exports=function(d){if(!u(d))throw new TypeError(d+" is not iterable");return d}}),i5=Vt((K,V)=>{var u=Pv(),d=Ov(),E=G7(),A=Z7(),t=Y7(),e=Wd().iterator;V.exports=function(r){return typeof t(r)[e]=="function"?r[e]():u(r)?new E(r):d(r)?new A(r):new E(r)}}),X7=Vt((K,V)=>{var u=Pv(),d=$m(),E=Ov(),A=i5(),t=Array.isArray,e=Function.prototype.call,r=Array.prototype.some;V.exports=function(i,n){var o,a=arguments[2],s,f,v,g,m,w,l;if(t(i)||u(i)?o="array":E(i)?o="string":i=A(i),d(n),f=function(){v=!0},o==="array"){r.call(i,function(x){return e.call(n,a,x,f),v});return}if(o==="string"){for(m=i.length,g=0;g=55296&&l<=56319&&(w+=i[++g])),e.call(n,a,w,f),!v);++g);return}for(s=i.next();!s.done;){if(e.call(n,a,s.value,f),v)return;s=i.next()}}}),$7=Vt((K,V)=>{V.exports=(function(){return typeof WeakMap!="function"?!1:Object.prototype.toString.call(new WeakMap)==="[object WeakMap]"})()}),J7=Vt((K,V)=>{var u=qd(),d=Hx(),E=s7(),A=qp(),t=l7(),e=Wp(),r=i5(),i=X7(),n=Wd().toStringTag,o=$7(),a=Array.isArray,s=Object.defineProperty,f=Object.prototype.hasOwnProperty,v=Object.getPrototypeOf,g;V.exports=g=function(){var m=arguments[0],w;if(!(this instanceof g))throw new TypeError("Constructor requires 'new'");return w=o&&d&&WeakMap!==g?d(new WeakMap,v(this)):this,u(m)&&(a(m)||(m=r(m))),s(w,"__weakMapData__",e("c","$weakMap$"+t())),m&&i(m,function(l){A(l),w.set(l[0],l[1])}),w},o&&(d&&d(g,WeakMap),g.prototype=Object.create(WeakMap.prototype,{constructor:e(g)})),Object.defineProperties(g.prototype,{delete:e(function(m){return f.call(E(m),this.__weakMapData__)?(delete m[this.__weakMapData__],!0):!1}),get:e(function(m){if(f.call(E(m),this.__weakMapData__))return m[this.__weakMapData__]}),has:e(function(m){return f.call(E(m),this.__weakMapData__)}),set:e(function(m,w){return s(E(m),this.__weakMapData__,e("c",w)),this}),toString:e(function(){return"[object WeakMap]"})}),s(g.prototype,n,e("c","WeakMap"))}),o5=Vt((K,V)=>{V.exports=a7()()?WeakMap:J7()}),Q7=Vt((K,V)=>{V.exports=function(u,d,E){if(typeof Array.prototype.findIndex=="function")return u.findIndex(d,E);if(typeof d!="function")throw new TypeError("predicate must be a function");var A=Object(u),t=A.length;if(t===0)return-1;for(var e=0;e{var u=Nd(),d=C0(),E=of(),A=bp(),t=I0(),e=r7(),r=n7(),{float32:i,fract32:n}=Vx(),o=o5(),a=Xm(),s=Q7(),f=` +precision highp float; + +attribute vec2 aCoord, bCoord, aCoordFract, bCoordFract; +attribute vec4 color; +attribute float lineEnd, lineTop; + +uniform vec2 scale, scaleFract, translate, translateFract; +uniform float thickness, pixelRatio, id, depth; +uniform vec4 viewport; + +varying vec4 fragColor; +varying vec2 tangent; + +vec2 project(vec2 position, vec2 positionFract, vec2 scale, vec2 scaleFract, vec2 translate, vec2 translateFract) { + // the order is important + return position * scale + translate + + positionFract * scale + translateFract + + position * scaleFract + + positionFract * scaleFract; +} + +void main() { + float lineStart = 1. - lineEnd; + float lineOffset = lineTop * 2. - 1.; + + vec2 diff = (bCoord + bCoordFract - aCoord - aCoordFract); + tangent = normalize(diff * scale * viewport.zw); + vec2 normal = vec2(-tangent.y, tangent.x); + + vec2 position = project(aCoord, aCoordFract, scale, scaleFract, translate, translateFract) * lineStart + + project(bCoord, bCoordFract, scale, scaleFract, translate, translateFract) * lineEnd + + + thickness * normal * .5 * lineOffset / viewport.zw; + + gl_Position = vec4(position * 2.0 - 1.0, depth, 1); + + fragColor = color / 255.; +} +`,v=` +precision highp float; + +uniform float dashLength, pixelRatio, thickness, opacity, id; +uniform sampler2D dashTexture; + +varying vec4 fragColor; +varying vec2 tangent; + +void main() { + float alpha = 1.; + + float t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25; + float dash = texture2D(dashTexture, vec2(t, .5)).r; + + gl_FragColor = fragColor; + gl_FragColor.a *= alpha * opacity * dash; +} +`,g=` +precision highp float; + +attribute vec2 position, positionFract; + +uniform vec4 color; +uniform vec2 scale, scaleFract, translate, translateFract; +uniform float pixelRatio, id; +uniform vec4 viewport; +uniform float opacity; + +varying vec4 fragColor; + +const float MAX_LINES = 256.; + +void main() { + float depth = (MAX_LINES - 4. - id) / (MAX_LINES); + + vec2 position = position * scale + translate + + positionFract * scale + translateFract + + position * scaleFract + + positionFract * scaleFract; + + gl_Position = vec4(position * 2.0 - 1.0, depth, 1); + + fragColor = color / 255.; + fragColor.a *= opacity; +} +`,m=` +precision highp float; +varying vec4 fragColor; + +void main() { + gl_FragColor = fragColor; +} +`,w=` +precision highp float; + +attribute vec2 aCoord, bCoord, nextCoord, prevCoord; +attribute vec4 aColor, bColor; +attribute float lineEnd, lineTop; + +uniform vec2 scale, translate; +uniform float thickness, pixelRatio, id, depth; +uniform vec4 viewport; +uniform float miterLimit, miterMode; + +varying vec4 fragColor; +varying vec4 startCutoff, endCutoff; +varying vec2 tangent; +varying vec2 startCoord, endCoord; +varying float enableStartMiter, enableEndMiter; + +const float REVERSE_THRESHOLD = -.875; +const float MIN_DIFF = 1e-6; + +// TODO: possible optimizations: avoid overcalculating all for vertices and calc just one instead +// TODO: precalculate dot products, normalize things beforehead etc. +// TODO: refactor to rectangular algorithm + +float distToLine(vec2 p, vec2 a, vec2 b) { + vec2 diff = b - a; + vec2 perp = normalize(vec2(-diff.y, diff.x)); + return dot(p - a, perp); +} + +bool isNaN( float val ){ + return ( val < 0.0 || 0.0 < val || val == 0.0 ) ? false : true; +} + +void main() { + vec2 aCoord = aCoord, bCoord = bCoord, prevCoord = prevCoord, nextCoord = nextCoord; + + vec2 adjustedScale; + adjustedScale.x = (abs(scale.x) < MIN_DIFF) ? MIN_DIFF : scale.x; + adjustedScale.y = (abs(scale.y) < MIN_DIFF) ? MIN_DIFF : scale.y; + + vec2 scaleRatio = adjustedScale * viewport.zw; + vec2 normalWidth = thickness / scaleRatio; + + float lineStart = 1. - lineEnd; + float lineBot = 1. - lineTop; + + fragColor = (lineStart * aColor + lineEnd * bColor) / 255.; + + if (isNaN(aCoord.x) || isNaN(aCoord.y) || isNaN(bCoord.x) || isNaN(bCoord.y)) return; + + if (aCoord == prevCoord) prevCoord = aCoord + normalize(bCoord - aCoord); + if (bCoord == nextCoord) nextCoord = bCoord - normalize(bCoord - aCoord); + + + vec2 prevDiff = aCoord - prevCoord; + vec2 currDiff = bCoord - aCoord; + vec2 nextDiff = nextCoord - bCoord; + + vec2 prevTangent = normalize(prevDiff * scaleRatio); + vec2 currTangent = normalize(currDiff * scaleRatio); + vec2 nextTangent = normalize(nextDiff * scaleRatio); + + vec2 prevNormal = vec2(-prevTangent.y, prevTangent.x); + vec2 currNormal = vec2(-currTangent.y, currTangent.x); + vec2 nextNormal = vec2(-nextTangent.y, nextTangent.x); + + vec2 startJoinDirection = normalize(prevTangent - currTangent); + vec2 endJoinDirection = normalize(currTangent - nextTangent); + + // collapsed/unidirectional segment cases + // FIXME: there should be more elegant solution + vec2 prevTanDiff = abs(prevTangent - currTangent); + vec2 nextTanDiff = abs(nextTangent - currTangent); + if (max(prevTanDiff.x, prevTanDiff.y) < MIN_DIFF) { + startJoinDirection = currNormal; + } + if (max(nextTanDiff.x, nextTanDiff.y) < MIN_DIFF) { + endJoinDirection = currNormal; + } + if (aCoord == bCoord) { + endJoinDirection = startJoinDirection; + currNormal = prevNormal; + currTangent = prevTangent; + } + + tangent = currTangent; + + //calculate join shifts relative to normals + float startJoinShift = dot(currNormal, startJoinDirection); + float endJoinShift = dot(currNormal, endJoinDirection); + + float startMiterRatio = abs(1. / startJoinShift); + float endMiterRatio = abs(1. / endJoinShift); + + vec2 startJoin = startJoinDirection * startMiterRatio; + vec2 endJoin = endJoinDirection * endMiterRatio; + + vec2 startTopJoin, startBotJoin, endTopJoin, endBotJoin; + startTopJoin = sign(startJoinShift) * startJoin * .5; + startBotJoin = -startTopJoin; + + endTopJoin = sign(endJoinShift) * endJoin * .5; + endBotJoin = -endTopJoin; + + vec2 aTopCoord = aCoord + normalWidth * startTopJoin; + vec2 bTopCoord = bCoord + normalWidth * endTopJoin; + vec2 aBotCoord = aCoord + normalWidth * startBotJoin; + vec2 bBotCoord = bCoord + normalWidth * endBotJoin; + + //miter anti-clipping + float baClipping = distToLine(bCoord, aCoord, aBotCoord) / dot(normalize(normalWidth * endBotJoin), normalize(normalWidth.yx * vec2(-startBotJoin.y, startBotJoin.x))); + float abClipping = distToLine(aCoord, bCoord, bTopCoord) / dot(normalize(normalWidth * startBotJoin), normalize(normalWidth.yx * vec2(-endBotJoin.y, endBotJoin.x))); + + //prevent close to reverse direction switch + bool prevReverse = dot(currTangent, prevTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, prevNormal)) * min(length(prevDiff), length(currDiff)) < length(normalWidth * currNormal); + bool nextReverse = dot(currTangent, nextTangent) <= REVERSE_THRESHOLD && abs(dot(currTangent, nextNormal)) * min(length(nextDiff), length(currDiff)) < length(normalWidth * currNormal); + + if (prevReverse) { + //make join rectangular + vec2 miterShift = normalWidth * startJoinDirection * miterLimit * .5; + float normalAdjust = 1. - min(miterLimit / startMiterRatio, 1.); + aBotCoord = aCoord + miterShift - normalAdjust * normalWidth * currNormal * .5; + aTopCoord = aCoord + miterShift + normalAdjust * normalWidth * currNormal * .5; + } + else if (!nextReverse && baClipping > 0. && baClipping < length(normalWidth * endBotJoin)) { + //handle miter clipping + bTopCoord -= normalWidth * endTopJoin; + bTopCoord += normalize(endTopJoin * normalWidth) * baClipping; + } + + if (nextReverse) { + //make join rectangular + vec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5; + float normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.); + bBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5; + bTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5; + } + else if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) { + //handle miter clipping + aBotCoord -= normalWidth * startBotJoin; + aBotCoord += normalize(startBotJoin * normalWidth) * abClipping; + } + + vec2 aTopPosition = (aTopCoord) * adjustedScale + translate; + vec2 aBotPosition = (aBotCoord) * adjustedScale + translate; + + vec2 bTopPosition = (bTopCoord) * adjustedScale + translate; + vec2 bBotPosition = (bBotCoord) * adjustedScale + translate; + + //position is normalized 0..1 coord on the screen + vec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd; + + startCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy; + endCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy; + + gl_Position = vec4(position * 2.0 - 1.0, depth, 1); + + enableStartMiter = step(dot(currTangent, prevTangent), .5); + enableEndMiter = step(dot(currTangent, nextTangent), .5); + + //bevel miter cutoffs + if (miterMode == 1.) { + if (enableStartMiter == 1.) { + vec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5; + startCutoff = vec4(aCoord, aCoord); + startCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio; + startCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw; + startCutoff += viewport.xyxy; + startCutoff += startMiterWidth.xyxy; + } + + if (enableEndMiter == 1.) { + vec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5; + endCutoff = vec4(bCoord, bCoord); + endCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio; + endCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw; + endCutoff += viewport.xyxy; + endCutoff += endMiterWidth.xyxy; + } + } + + //round miter cutoffs + else if (miterMode == 2.) { + if (enableStartMiter == 1.) { + vec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5; + startCutoff = vec4(aCoord, aCoord); + startCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio; + startCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw; + startCutoff += viewport.xyxy; + startCutoff += startMiterWidth.xyxy; + } + + if (enableEndMiter == 1.) { + vec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5; + endCutoff = vec4(bCoord, bCoord); + endCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio; + endCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw; + endCutoff += viewport.xyxy; + endCutoff += endMiterWidth.xyxy; + } + } +} +`,l=` +precision highp float; + +uniform float dashLength, pixelRatio, thickness, opacity, id, miterMode; +uniform sampler2D dashTexture; + +varying vec4 fragColor; +varying vec2 tangent; +varying vec4 startCutoff, endCutoff; +varying vec2 startCoord, endCoord; +varying float enableStartMiter, enableEndMiter; + +float distToLine(vec2 p, vec2 a, vec2 b) { + vec2 diff = b - a; + vec2 perp = normalize(vec2(-diff.y, diff.x)); + return dot(p - a, perp); +} + +void main() { + float alpha = 1., distToStart, distToEnd; + float cutoff = thickness * .5; + + //bevel miter + if (miterMode == 1.) { + if (enableStartMiter == 1.) { + distToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw); + if (distToStart < -1.) { + discard; + return; + } + alpha *= min(max(distToStart + 1., 0.), 1.); + } + + if (enableEndMiter == 1.) { + distToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw); + if (distToEnd < -1.) { + discard; + return; + } + alpha *= min(max(distToEnd + 1., 0.), 1.); + } + } + + // round miter + else if (miterMode == 2.) { + if (enableStartMiter == 1.) { + distToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw); + if (distToStart < 0.) { + float radius = length(gl_FragCoord.xy - startCoord); + + if(radius > cutoff + .5) { + discard; + return; + } + + alpha -= smoothstep(cutoff - .5, cutoff + .5, radius); + } + } + + if (enableEndMiter == 1.) { + distToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw); + if (distToEnd < 0.) { + float radius = length(gl_FragCoord.xy - endCoord); + + if(radius > cutoff + .5) { + discard; + return; + } + + alpha -= smoothstep(cutoff - .5, cutoff + .5, radius); + } + } + } + + float t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25; + float dash = texture2D(dashTexture, vec2(t, .5)).r; + + gl_FragColor = fragColor; + gl_FragColor.a *= alpha * opacity * dash; +} +`;V.exports=x;function x(y,S){if(!(this instanceof x))return new x(y,S);if(typeof y=="function"?(S||(S={}),S.regl=y):S=y,S.length&&(S.positions=S),y=S.regl,!y.hasExtension("ANGLE_instanced_arrays"))throw Error("regl-error2d: `ANGLE_instanced_arrays` extension should be enabled");this.gl=y._gl,this.regl=y,this.passes=[],this.shaders=x.shaders.has(y)?x.shaders.get(y):x.shaders.set(y,x.createShaders(y)).get(y),this.update(S)}x.dashMult=2,x.maxPatternLength=256,x.precisionThreshold=3e6,x.maxPoints=1e4,x.maxLines=2048,x.shaders=new o,x.createShaders=function(y){let S=y.buffer({usage:"static",type:"float",data:[0,1,0,0,1,1,1,0]}),k={primitive:"triangle strip",instances:y.prop("count"),count:4,offset:0,uniforms:{miterMode:(c,h)=>h.join==="round"?2:1,miterLimit:y.prop("miterLimit"),scale:y.prop("scale"),scaleFract:y.prop("scaleFract"),translateFract:y.prop("translateFract"),translate:y.prop("translate"),thickness:y.prop("thickness"),dashTexture:y.prop("dashTexture"),opacity:y.prop("opacity"),pixelRatio:y.context("pixelRatio"),id:y.prop("id"),dashLength:y.prop("dashLength"),viewport:(c,h)=>[h.viewport.x,h.viewport.y,c.viewportWidth,c.viewportHeight],depth:y.prop("depth")},blend:{enable:!0,color:[0,0,0,0],equation:{rgb:"add",alpha:"add"},func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},depth:{enable:(c,h)=>!h.overlay},stencil:{enable:!1},scissor:{enable:!0,box:y.prop("viewport")},viewport:y.prop("viewport")},M=y(E({vert:f,frag:v,attributes:{lineEnd:{buffer:S,divisor:0,stride:8,offset:0},lineTop:{buffer:S,divisor:0,stride:8,offset:4},aCoord:{buffer:y.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:y.prop("positionBuffer"),stride:8,offset:16,divisor:1},aCoordFract:{buffer:y.prop("positionFractBuffer"),stride:8,offset:8,divisor:1},bCoordFract:{buffer:y.prop("positionFractBuffer"),stride:8,offset:16,divisor:1},color:{buffer:y.prop("colorBuffer"),stride:4,offset:0,divisor:1}}},k)),T;try{T=y(E({cull:{enable:!0,face:"back"},vert:w,frag:l,attributes:{lineEnd:{buffer:S,divisor:0,stride:8,offset:0},lineTop:{buffer:S,divisor:0,stride:8,offset:4},aColor:{buffer:y.prop("colorBuffer"),stride:4,offset:0,divisor:1},bColor:{buffer:y.prop("colorBuffer"),stride:4,offset:4,divisor:1},prevCoord:{buffer:y.prop("positionBuffer"),stride:8,offset:0,divisor:1},aCoord:{buffer:y.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:y.prop("positionBuffer"),stride:8,offset:16,divisor:1},nextCoord:{buffer:y.prop("positionBuffer"),stride:8,offset:24,divisor:1}}},k))}catch{T=M}return{fill:y({primitive:"triangle",elements:(c,h)=>h.triangles,offset:0,vert:g,frag:m,uniforms:{scale:y.prop("scale"),color:y.prop("fill"),scaleFract:y.prop("scaleFract"),translateFract:y.prop("translateFract"),translate:y.prop("translate"),opacity:y.prop("opacity"),pixelRatio:y.context("pixelRatio"),id:y.prop("id"),viewport:(c,h)=>[h.viewport.x,h.viewport.y,c.viewportWidth,c.viewportHeight]},attributes:{position:{buffer:y.prop("positionBuffer"),stride:8,offset:8},positionFract:{buffer:y.prop("positionFractBuffer"),stride:8,offset:8}},blend:k.blend,depth:{enable:!1},scissor:k.scissor,stencil:k.stencil,viewport:k.viewport}),rect:M,miter:T}},x.defaults={dashes:null,join:"miter",miterLimit:1,thickness:10,cap:"square",color:"black",opacity:1,overlay:!1,viewport:null,range:null,close:!1,fill:null},x.prototype.render=function(...y){y.length&&this.update(...y),this.draw()},x.prototype.draw=function(...y){return(y.length?y:this.passes).forEach((S,k)=>{if(S&&Array.isArray(S))return this.draw(...S);typeof S=="number"&&(S=this.passes[S]),S&&S.count>1&&S.opacity&&(this.regl._refresh(),S.fill&&S.triangles&&S.triangles.length>2&&this.shaders.fill(S),S.thickness&&(S.scale[0]*S.viewport.width>x.precisionThreshold||S.scale[1]*S.viewport.height>x.precisionThreshold?this.shaders.rect(S):S.join==="rect"||!S.join&&(S.thickness<=2||S.count>=x.maxPoints)?this.shaders.rect(S):this.shaders.miter(S)))}),this},x.prototype.update=function(y){if(!y)return;y.length!=null?typeof y[0]=="number"&&(y=[{positions:y}]):Array.isArray(y)||(y=[y]);let{regl:S,gl:k}=this;if(y.forEach((T,c)=>{let h=this.passes[c];if(T!==void 0){if(T===null){this.passes[c]=null;return}if(typeof T[0]=="number"&&(T={positions:T}),T=A(T,{positions:"positions points data coords",thickness:"thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth",join:"lineJoin linejoin join type mode",miterLimit:"miterlimit miterLimit",dashes:"dash dashes dasharray dash-array dashArray",color:"color colour stroke colors colours stroke-color strokeColor",fill:"fill fill-color fillColor",opacity:"alpha opacity",overlay:"overlay crease overlap intersect",close:"closed close closed-path closePath",range:"range dataBox",viewport:"viewport viewBox",hole:"holes hole hollow",splitNull:"splitNull"}),h||(this.passes[c]=h={id:c,scale:null,scaleFract:null,translate:null,translateFract:null,count:0,hole:[],depth:0,dashLength:1,dashTexture:S.texture({channels:1,data:new Uint8Array([255]),width:1,height:1,mag:"linear",min:"linear"}),colorBuffer:S.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array}),positionBuffer:S.buffer({usage:"dynamic",type:"float",data:new Uint8Array}),positionFractBuffer:S.buffer({usage:"dynamic",type:"float",data:new Uint8Array})},T=E({},x.defaults,T)),T.thickness!=null&&(h.thickness=parseFloat(T.thickness)),T.opacity!=null&&(h.opacity=parseFloat(T.opacity)),T.miterLimit!=null&&(h.miterLimit=parseFloat(T.miterLimit)),T.overlay!=null&&(h.overlay=!!T.overlay,cst-et),G=[],rt=0,ct=h.hole!=null?h.hole[0]:null;if(ct!=null){let st=s(N,et=>et>=ct);N=N.slice(0,st),N.push(ct)}for(let st=0;stX-ct+(N[st]-rt)),ot=e(et,Z);ot=ot.map(X=>X+rt+(X+rt{y.colorBuffer.destroy(),y.positionBuffer.destroy(),y.dashTexture.destroy()}),this.passes.length=0,this}}),t9=Vt((K,V)=>{var u=C0(),d=Nd(),E=K3(),A=bp(),t=of(),e=I0(),{float32:r,fract32:i}=Vx();V.exports=o;var n=[[1,0,0,1,0,0],[1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,1,0,0],[1,0,0,1,0,0],[1,0,-1,0,0,1],[1,0,-1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,1],[1,0,-1,0,0,1],[-1,0,-1,0,0,1],[-1,0,-1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,1],[-1,0,-1,0,0,1],[0,1,1,0,0,0],[0,1,-1,0,0,0],[0,-1,-1,0,0,0],[0,-1,-1,0,0,0],[0,1,1,0,0,0],[0,-1,1,0,0,0],[0,1,0,-1,1,0],[0,1,0,-1,-1,0],[0,1,0,1,-1,0],[0,1,0,1,1,0],[0,1,0,-1,1,0],[0,1,0,1,-1,0],[0,-1,0,-1,1,0],[0,-1,0,-1,-1,0],[0,-1,0,1,-1,0],[0,-1,0,1,1,0],[0,-1,0,-1,1,0],[0,-1,0,1,-1,0]];function o(a,s){if(typeof a=="function"?(s||(s={}),s.regl=a):s=a,s.length&&(s.positions=s),a=s.regl,!a.hasExtension("ANGLE_instanced_arrays"))throw Error("regl-error2d: `ANGLE_instanced_arrays` extension should be enabled");let f=a._gl,v,g,m,w,l,x,y={color:"black",capSize:5,lineWidth:1,opacity:1,viewport:null,range:null,offset:0,count:0,bounds:null,positions:[],errors:[]},S=[];return w=a.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array(0)}),g=a.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)}),m=a.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)}),l=a.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)}),x=a.buffer({usage:"static",type:"float",data:n}),c(s),v=a({vert:` + precision highp float; + + attribute vec2 position, positionFract; + attribute vec4 error; + attribute vec4 color; + + attribute vec2 direction, lineOffset, capOffset; + + uniform vec4 viewport; + uniform float lineWidth, capSize; + uniform vec2 scale, scaleFract, translate, translateFract; + + varying vec4 fragColor; + + void main() { + fragColor = color / 255.; + + vec2 pixelOffset = lineWidth * lineOffset + (capSize + lineWidth) * capOffset; + + vec2 dxy = -step(.5, direction.xy) * error.xz + step(direction.xy, vec2(-.5)) * error.yw; + + vec2 position = position + dxy; + + vec2 pos = (position + translate) * scale + + (positionFract + translateFract) * scale + + (position + translate) * scaleFract + + (positionFract + translateFract) * scaleFract; + + pos += pixelOffset / viewport.zw; + + gl_Position = vec4(pos * 2. - 1., 0, 1); + } + `,frag:` + precision highp float; + + varying vec4 fragColor; + + uniform float opacity; + + void main() { + gl_FragColor = fragColor; + gl_FragColor.a *= opacity; + } + `,uniforms:{range:a.prop("range"),lineWidth:a.prop("lineWidth"),capSize:a.prop("capSize"),opacity:a.prop("opacity"),scale:a.prop("scale"),translate:a.prop("translate"),scaleFract:a.prop("scaleFract"),translateFract:a.prop("translateFract"),viewport:(b,_)=>[_.viewport.x,_.viewport.y,b.viewportWidth,b.viewportHeight]},attributes:{color:{buffer:w,offset:(b,_)=>_.offset*4,divisor:1},position:{buffer:g,offset:(b,_)=>_.offset*8,divisor:1},positionFract:{buffer:m,offset:(b,_)=>_.offset*8,divisor:1},error:{buffer:l,offset:(b,_)=>_.offset*16,divisor:1},direction:{buffer:x,stride:24,offset:0},lineOffset:{buffer:x,stride:24,offset:8},capOffset:{buffer:x,stride:24,offset:16}},primitive:"triangles",blend:{enable:!0,color:[0,0,0,0],equation:{rgb:"add",alpha:"add"},func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},depth:{enable:!1},scissor:{enable:!0,box:a.prop("viewport")},viewport:a.prop("viewport"),stencil:!1,instances:a.prop("count"),count:n.length}),t(k,{update:c,draw:M,destroy:h,regl:a,gl:f,canvas:f.canvas,groups:S}),k;function k(b){b?c(b):b===null&&h(),M()}function M(b){if(typeof b=="number")return T(b);b&&!Array.isArray(b)&&(b=[b]),a._refresh(),S.forEach((_,P)=>{if(_){if(b&&(b[P]?_.draw=!0:_.draw=!1),!_.draw){_.draw=!0;return}T(P)}})}function T(b){typeof b=="number"&&(b=S[b]),b!=null&&b&&b.count&&b.color&&b.opacity&&b.positions&&b.positions.length>1&&(b.scaleRatio=[b.scale[0]*b.viewport.width,b.scale[1]*b.viewport.height],v(b),b.after&&b.after(b))}function c(b){if(!b)return;b.length!=null?typeof b[0]=="number"&&(b=[{positions:b}]):Array.isArray(b)||(b=[b]);let _=0,P=0;if(k.groups=S=b.map((B,R)=>{let I=S[R];if(B)typeof B=="function"?B={after:B}:typeof B[0]=="number"&&(B={positions:B});else return I;return B=A(B,{color:"color colors fill",capSize:"capSize cap capsize cap-size",lineWidth:"lineWidth line-width width line thickness",opacity:"opacity alpha",range:"range dataBox",viewport:"viewport viewBox",errors:"errors error",positions:"positions position data points"}),I||(S[R]=I={id:R,scale:null,translate:null,scaleFract:null,translateFract:null,draw:!0},B=t({},y,B)),E(I,B,[{lineWidth:F=>+F*.5,capSize:F=>+F*.5,opacity:parseFloat,errors:F=>(F=e(F),P+=F.length,F),positions:(F,j)=>(F=e(F,"float64"),j.count=Math.floor(F.length/2),j.bounds=u(F,2),j.offset=_,_+=j.count,F)},{color:(F,j)=>{let N=j.count;if(F||(F="transparent"),!Array.isArray(F)||typeof F[0]=="number"){let rt=F;F=Array(N);for(let ct=0;ct{let G=j.bounds;return F||(F=G),j.scale=[1/(F[2]-F[0]),1/(F[3]-F[1])],j.translate=[-F[0],-F[1]],j.scaleFract=i(j.scale),j.translateFract=i(j.translate),F},viewport:F=>{let j;return Array.isArray(F)?j={x:F[0],y:F[1],width:F[2]-F[0],height:F[3]-F[1]}:F?(j={x:F.x||F.left||0,y:F.y||F.top||0},F.right?j.width=F.right-j.x:j.width=F.w||F.width||0,F.bottom?j.height=F.bottom-j.y:j.height=F.h||F.height||0):j={x:0,y:0,width:f.drawingBufferWidth,height:f.drawingBufferHeight},j}}]),I}),_||P){let B=S.reduce((j,N,G)=>j+(N?N.count:0),0),R=new Float64Array(B*2),I=new Uint8Array(B*4),F=new Float32Array(B*4);S.forEach((j,N)=>{if(!j)return;let{positions:G,count:rt,offset:ct,color:st,errors:et}=j;rt&&(I.set(st,ct*4),F.set(et,ct*4),R.set(G,ct*2))});var z=r(R);g(z);var D=i(R,z);m(D),w(I),l(F)}}function h(){g.destroy(),m.destroy(),w.destroy(),l.destroy(),x.destroy()}}}),e9=Vt((K,V)=>{var u=/[\'\"]/;V.exports=function(d){return d?(u.test(d.charAt(0))&&(d=d.substr(1)),u.test(d.charAt(d.length-1))&&(d=d.substr(0,d.length-1)),d):""}}),l5=Vt((K,V)=>{V.exports=["inherit","initial","unset"]}),u5=Vt((K,V)=>{V.exports=["caption","icon","menu","message-box","small-caption","status-bar"]}),c5=Vt((K,V)=>{V.exports=["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]}),f5=Vt((K,V)=>{V.exports=["normal","italic","oblique"]}),h5=Vt((K,V)=>{V.exports=["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]}),r9=Vt((K,V)=>{function u(A,t){if(typeof A!="string")return[A];var e=[A];typeof t=="string"||Array.isArray(t)?t={brackets:t}:t||(t={});var r=t.brackets?Array.isArray(t.brackets)?t.brackets:[t.brackets]:["{}","[]","()"],i=t.escape||"___",n=!!t.flat;r.forEach(function(s){var f=new RegExp(["\\",s[0],"[^\\",s[0],"\\",s[1],"]*\\",s[1]].join("")),v=[];function g(m,w,l){var x=e.push(m.slice(s[0].length,-s[1].length))-1;return v.push(x),i+x+i}e.forEach(function(m,w){for(var l,x=0;m!=l;)if(l=m,m=m.replace(f,g),x++>1e4)throw Error("References have circular dependency. Please, check them.");e[w]=m}),v=v.reverse(),e=e.map(function(m){return v.forEach(function(w){m=m.replace(new RegExp("(\\"+i+w+"\\"+i+")","g"),s[0]+"$1"+s[1])}),m})});var o=new RegExp("\\"+i+"([0-9]+)\\"+i);function a(s,f,v){for(var g=[],m,w=0;m=o.exec(s);){if(w++>1e4)throw Error("Circular references in parenthesis");g.push(s.slice(0,m.index)),g.push(a(f[m[1]],f)),s=s.slice(m.index+m[0].length)}return g.push(s),g}return n?e:a(e[0],e)}function d(A,t){if(t&&t.flat){var e=t&&t.escape||"___",r=A[0],i;if(!r)return"";for(var n=new RegExp("\\"+e+"([0-9]+)\\"+e),o=0;r!=i;){if(o++>1e4)throw Error("Circular references in "+A);i=r,r=r.replace(n,a)}return r}return A.reduce(function s(f,v){return Array.isArray(v)&&(v=v.reduce(s,"")),f+v},"");function a(s,f){if(A[f]==null)throw Error("Reference "+f+"is undefined");return A[f]}}function E(A,t){return Array.isArray(A)?d(A,t):u(A,t)}E.parse=u,E.stringify=d,V.exports=E}),n9=Vt((K,V)=>{var u=r9();V.exports=function(d,E,A){if(d==null)throw Error("First argument should be a string");if(E==null)throw Error("Separator should be a string or a RegExp");A?(typeof A=="string"||Array.isArray(A))&&(A={ignore:A}):A={},A.escape==null&&(A.escape=!0),A.ignore==null?A.ignore=["[]","()","{}","<>",'""',"''","``","“”","«»"]:(typeof A.ignore=="string"&&(A.ignore=[A.ignore]),A.ignore=A.ignore.map(function(s){return s.length===1&&(s=s+s),s}));var t=u.parse(d,{flat:!0,brackets:A.ignore}),e=t[0],r=e.split(E);if(A.escape){for(var i=[],n=0;n{V.exports=["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]}),p5=Vt((K,V)=>{var u=a9();V.exports={isSize:function(d){return/^[\d\.]/.test(d)||d.indexOf("/")!==-1||u.indexOf(d)!==-1}}}),i9=Vt((K,V)=>{var u=e9(),d=l5(),E=u5(),A=c5(),t=f5(),e=h5(),r=n9(),i=p5().isSize;V.exports=o;var n=o.cache={};function o(s){if(typeof s!="string")throw new Error("Font argument must be a string.");if(n[s])return n[s];if(s==="")throw new Error("Cannot parse an empty string.");if(E.indexOf(s)!==-1)return n[s]={system:s};for(var f={style:"normal",variant:"normal",weight:"normal",stretch:"normal",lineHeight:"normal",size:"1rem",family:["serif"]},v=r(s,/\s+/),g;g=v.shift();){if(d.indexOf(g)!==-1)return["style","variant","weight","stretch"].forEach(function(w){f[w]=g}),n[s]=f;if(t.indexOf(g)!==-1){f.style=g;continue}if(g==="normal"||g==="small-caps"){f.variant=g;continue}if(e.indexOf(g)!==-1){f.stretch=g;continue}if(A.indexOf(g)!==-1){f.weight=g;continue}if(i(g)){var m=r(g,"/");if(f.size=m[0],m[1]!=null?f.lineHeight=a(m[1]):v[0]==="/"&&(v.shift(),f.lineHeight=a(v.shift())),!v.length)throw new Error("Missing required font-family.");return f.family=r(v.join(" "),/\s*,\s*/).map(u),n[s]=f}throw new Error("Unknown or unsupported font token: "+g)}throw new Error("Missing required font-size.")}function a(s){var f=parseFloat(s);return f.toString()===s?f:s}}),d5=Vt((K,V)=>{var u=bp(),d=p5().isSize,E=s(l5()),A=s(u5()),t=s(c5()),e=s(f5()),r=s(h5()),i={normal:1,"small-caps":1},n={serif:1,"sans-serif":1,monospace:1,cursive:1,fantasy:1,"system-ui":1},o={size:"1rem",family:"serif"};V.exports=function(f){if(f=u(f,{style:"style fontstyle fontStyle font-style slope distinction",variant:"variant font-variant fontVariant fontvariant var capitalization",weight:"weight w font-weight fontWeight fontweight",stretch:"stretch font-stretch fontStretch fontstretch width",size:"size s font-size fontSize fontsize height em emSize",lineHeight:"lh line-height lineHeight lineheight leading",family:"font family fontFamily font-family fontfamily type typeface face",system:"system reserved default global"}),f.system)return f.system&&a(f.system,A),f.system;if(a(f.style,e),a(f.variant,i),a(f.weight,t),a(f.stretch,r),f.size==null&&(f.size=o.size),typeof f.size=="number"&&(f.size+="px"),!d)throw Error("Bad size value `"+f.size+"`");f.family||(f.family=o.family),Array.isArray(f.family)&&(f.family.length||(f.family=[o.family]),f.family=f.family.map(function(g){return n[g]?g:'"'+g+'"'}).join(", "));var v=[];return v.push(f.style),f.variant!==f.style&&v.push(f.variant),f.weight!==f.variant&&f.weight!==f.style&&v.push(f.weight),f.stretch!==f.weight&&f.stretch!==f.variant&&f.stretch!==f.style&&v.push(f.stretch),v.push(f.size+(f.lineHeight==null||f.lineHeight==="normal"||f.lineHeight+""=="1"?"":"/"+f.lineHeight)),v.push(f.family),v.filter(Boolean).join(" ")};function a(f,v){if(f&&!v[f]&&!E[f])throw Error("Unknown keyword `"+f+"`");return f}function s(f){for(var v={},g=0;g{V.exports={parse:i9(),stringify:d5()}}),s9=Vt((K,V)=>{(function(u,d){typeof K=="object"&&typeof V<"u"?V.exports=d():u.createREGL=d()})(K,function(){var u=function(ie,nr){for(var cr=Object.keys(nr),sn=0;sn1&&nr===cr&&(nr==='"'||nr==="'"))return['"'+r(ie.substr(1,ie.length-2))+'"'];var sn=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(ie);if(sn)return i(ie.substr(0,sn.index)).concat(i(sn[1])).concat(i(ie.substr(sn.index+sn[0].length)));var zn=ie.split(".");if(zn.length===1)return['"'+r(ie)+'"'];for(var Tn=[],qr=0;qr"u"?1:window.devicePixelRatio,ka=!1,Ka={},Va=function(Nr){},fa=function(){};if(typeof nr=="string"?cr=document.querySelector(nr):typeof nr=="object"&&(x(nr)?cr=nr:y(nr)?(Tn=nr,zn=Tn.canvas):("gl"in nr?Tn=nr.gl:"canvas"in nr?zn=k(nr.canvas):"container"in nr&&(sn=k(nr.container)),"attributes"in nr&&(qr=nr.attributes),"extensions"in nr&&(Sn=S(nr.extensions)),"optionalExtensions"in nr&&(sa=S(nr.optionalExtensions)),"onDone"in nr&&(Va=nr.onDone),"profile"in nr&&(ka=!!nr.profile),"pixelRatio"in nr&&(ea=+nr.pixelRatio),"cachedCode"in nr&&(Ka=nr.cachedCode))),cr&&(cr.nodeName.toLowerCase()==="canvas"?zn=cr:sn=cr),!Tn){if(!zn){var Un=w(sn||document.body,Va,ea);if(!Un)return null;zn=Un.canvas,fa=Un.onDestroy}qr.premultipliedAlpha===void 0&&(qr.premultipliedAlpha=!0),Tn=l(zn,qr)}return Tn?{gl:Tn,canvas:zn,container:sn,extensions:Sn,optionalExtensions:sa,pixelRatio:ea,profile:ka,cachedCode:Ka,onDone:Va,onDestroy:fa}:(fa(),Va("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function T(ie,nr){var cr={};function sn(qr){var Sn=qr.toLowerCase(),sa;try{sa=cr[Sn]=ie.getExtension(Sn)}catch{}return!!sa}for(var zn=0;zn65535)<<4,ie>>>=nr,cr=(ie>255)<<3,ie>>>=cr,nr|=cr,cr=(ie>15)<<2,ie>>>=cr,nr|=cr,cr=(ie>3)<<1,ie>>>=cr,nr|=cr,nr|ie>>1}function F(){var ie=c(8,function(){return[]});function nr(Tn){var qr=R(Tn),Sn=ie[I(qr)>>2];return Sn.length>0?Sn.pop():new ArrayBuffer(qr)}function cr(Tn){ie[I(Tn.byteLength)>>2].push(Tn)}function sn(Tn,qr){var Sn=null;switch(Tn){case h:Sn=new Int8Array(nr(qr),0,qr);break;case b:Sn=new Uint8Array(nr(qr),0,qr);break;case _:Sn=new Int16Array(nr(2*qr),0,qr);break;case P:Sn=new Uint16Array(nr(2*qr),0,qr);break;case z:Sn=new Int32Array(nr(4*qr),0,qr);break;case D:Sn=new Uint32Array(nr(4*qr),0,qr);break;case B:Sn=new Float32Array(nr(4*qr),0,qr);break;default:return null}return Sn.length!==qr?Sn.subarray(0,qr):Sn}function zn(Tn){cr(Tn.buffer)}return{alloc:nr,free:cr,allocType:sn,freeType:zn}}var j=F();j.zero=F();var N=3408,G=3410,rt=3411,ct=3412,st=3413,et=3414,Z=3415,ot=33901,X=33902,Q=3379,ut=3386,J=34921,q=36347,it=36348,nt=35661,dt=35660,Tt=34930,wt=36349,Ct=34076,It=34024,Nt=7936,te=7937,Jt=7938,ee=35724,Zt=34047,mt=36063,bt=34852,vt=3553,Ut=34067,re=34069,Kt=33984,ue=6408,Me=5126,Ce=5121,We=36160,qe=36053,vr=36064,_r=16384,er=function(ie,nr){var cr=1;nr.ext_texture_filter_anisotropic&&(cr=ie.getParameter(Zt));var sn=1,zn=1;nr.webgl_draw_buffers&&(sn=ie.getParameter(bt),zn=ie.getParameter(mt));var Tn=!!nr.oes_texture_float;if(Tn){var qr=ie.createTexture();ie.bindTexture(vt,qr),ie.texImage2D(vt,0,ue,1,1,0,ue,Me,null);var Sn=ie.createFramebuffer();if(ie.bindFramebuffer(We,Sn),ie.framebufferTexture2D(We,vr,vt,qr,0),ie.bindTexture(vt,null),ie.checkFramebufferStatus(We)!==qe)Tn=!1;else{ie.viewport(0,0,1,1),ie.clearColor(1,0,0,1),ie.clear(_r);var sa=j.allocType(Me,4);ie.readPixels(0,0,1,1,ue,Me,sa),ie.getError()?Tn=!1:(ie.deleteFramebuffer(Sn),ie.deleteTexture(qr),Tn=sa[0]===1),j.freeType(sa)}}var ea=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),ka=!0;if(!ea){var Ka=ie.createTexture(),Va=j.allocType(Ce,36);ie.activeTexture(Kt),ie.bindTexture(Ut,Ka),ie.texImage2D(re,0,ue,3,3,0,ue,Ce,Va),j.freeType(Va),ie.bindTexture(Ut,null),ie.deleteTexture(Ka),ka=!ie.getError()}return{colorBits:[ie.getParameter(G),ie.getParameter(rt),ie.getParameter(ct),ie.getParameter(st)],depthBits:ie.getParameter(et),stencilBits:ie.getParameter(Z),subpixelBits:ie.getParameter(N),extensions:Object.keys(nr).filter(function(fa){return!!nr[fa]}),maxAnisotropic:cr,maxDrawbuffers:sn,maxColorAttachments:zn,pointSizeDims:ie.getParameter(ot),lineWidthDims:ie.getParameter(X),maxViewportDims:ie.getParameter(ut),maxCombinedTextureUnits:ie.getParameter(nt),maxCubeMapSize:ie.getParameter(Ct),maxRenderbufferSize:ie.getParameter(It),maxTextureUnits:ie.getParameter(Tt),maxTextureSize:ie.getParameter(Q),maxAttributes:ie.getParameter(J),maxVertexUniforms:ie.getParameter(q),maxVertexTextureUnits:ie.getParameter(dt),maxVaryingVectors:ie.getParameter(it),maxFragmentUniforms:ie.getParameter(wt),glsl:ie.getParameter(ee),renderer:ie.getParameter(te),vendor:ie.getParameter(Nt),version:ie.getParameter(Jt),readFloat:Tn,npotTextureCube:ka}},Mr=function(ie){return ie instanceof Uint8Array||ie instanceof Uint16Array||ie instanceof Uint32Array||ie instanceof Int8Array||ie instanceof Int16Array||ie instanceof Int32Array||ie instanceof Float32Array||ie instanceof Float64Array||ie instanceof Uint8ClampedArray};function Ir(ie){return!!ie&&typeof ie=="object"&&Array.isArray(ie.shape)&&Array.isArray(ie.stride)&&typeof ie.offset=="number"&&ie.shape.length===ie.stride.length&&(Array.isArray(ie.data)||Mr(ie.data))}var de=function(ie){return Object.keys(ie).map(function(nr){return ie[nr]})},Dt={shape:Ht,flatten:St};function qt(ie,nr,cr){for(var sn=0;sn0){var qa;if(Array.isArray(fn[0])){ya=gn(fn);for(var Rn=1,An=1;An0){if(typeof Rn[0]=="number"){var aa=j.allocType(kn.dtype,Rn.length);zr(aa,Rn),ya(aa,Pa),j.freeType(aa)}else if(Array.isArray(Rn[0])||Mr(Rn[0])){ba=gn(Rn);var oa=En(Rn,ba,kn.dtype);ya(oa,Pa),j.freeType(oa)}}}else if(Ir(Rn)){ba=Rn.shape;var Sa=Rn.stride,_i=0,pi=0,Ma=0,Na=0;ba.length===1?(_i=ba[0],pi=1,Ma=Sa[0],Na=0):ba.length===2&&(_i=ba[0],pi=ba[1],Ma=Sa[0],Na=Sa[1]);var ui=Array.isArray(Rn.data)?kn.dtype:tr(Rn.data),gi=j.allocType(ui,_i*pi);tn(gi,Rn.data,_i,pi,Ma,Na,Rn.offset),ya(gi,Pa),j.freeType(gi)}return Ia}return Xn||Ia(Nr),Ia._reglType="buffer",Ia._buffer=kn,Ia.subdata=qa,cr.profile&&(Ia.stats=kn.stats),Ia.destroy=function(){Va(kn)},Ia}function Un(){de(Tn).forEach(function(Nr){Nr.buffer=ie.createBuffer(),ie.bindBuffer(Nr.type,Nr.buffer),ie.bufferData(Nr.type,Nr.persistentData||Nr.byteLength,Nr.usage)})}return cr.profile&&(nr.getTotalBufferSize=function(){var Nr=0;return Object.keys(Tn).forEach(function(fn){Nr+=Tn[fn].stats.size}),Nr}),{create:fa,createStream:sa,destroyStream:ea,clear:function(){de(Tn).forEach(Va),Sn.forEach(Va)},getBuffer:function(Nr){return Nr&&Nr._buffer instanceof qr?Nr._buffer:null},restore:Un,_initBuffer:Ka}}var $r=0,In=0,Nn=1,Kn=1,$n=4,ia=4,Cn={points:$r,point:In,lines:Nn,line:Kn,triangles:$n,triangle:ia,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},Fa=0,Ga=1,ve=4,ge=5120,dr=5121,br=5122,Tr=5123,mr=5124,kr=5125,Ur=34963,Or=35040,pe=35044;function Ke(ie,nr,cr,sn){var zn={},Tn=0,qr={uint8:dr,uint16:Tr};nr.oes_element_index_uint&&(qr.uint32=kr);function Sn(Un){this.id=Tn++,zn[this.id]=this,this.buffer=Un,this.primType=ve,this.vertCount=0,this.type=0}Sn.prototype.bind=function(){this.buffer.bind()};var sa=[];function ea(Un){var Nr=sa.pop();return Nr||(Nr=new Sn(cr.create(null,Ur,!0,!1)._buffer)),Ka(Nr,Un,Or,-1,-1,0,0),Nr}function ka(Un){sa.push(Un)}function Ka(Un,Nr,fn,Xn,jn,kn,Ia){Un.buffer.bind();var ya;if(Nr){var qa=Ia;!Ia&&(!Mr(Nr)||Ir(Nr)&&!Mr(Nr.data))&&(qa=nr.oes_element_index_uint?kr:Tr),cr._initBuffer(Un.buffer,Nr,fn,qa,3)}else ie.bufferData(Ur,kn,fn),Un.buffer.dtype=ya||dr,Un.buffer.usage=fn,Un.buffer.dimension=3,Un.buffer.byteLength=kn;if(ya=Ia,!Ia){switch(Un.buffer.dtype){case dr:case ge:ya=dr;break;case Tr:case br:ya=Tr;break;case kr:case mr:ya=kr;break}Un.buffer.dtype=ya}Un.type=ya;var Rn=jn;Rn<0&&(Rn=Un.buffer.byteLength,ya===Tr?Rn>>=1:ya===kr&&(Rn>>=2)),Un.vertCount=Rn;var An=Xn;if(Xn<0){An=ve;var Pa=Un.buffer.dimension;Pa===1&&(An=Fa),Pa===2&&(An=Ga),Pa===3&&(An=ve)}Un.primType=An}function Va(Un){sn.elementsCount--,delete zn[Un.id],Un.buffer.destroy(),Un.buffer=null}function fa(Un,Nr){var fn=cr.create(null,Ur,!0),Xn=new Sn(fn._buffer);sn.elementsCount++;function jn(kn){if(!kn)fn(),Xn.primType=ve,Xn.vertCount=0,Xn.type=dr;else if(typeof kn=="number")fn(kn),Xn.primType=ve,Xn.vertCount=kn|0,Xn.type=dr;else{var Ia=null,ya=pe,qa=-1,Rn=-1,An=0,Pa=0;Array.isArray(kn)||Mr(kn)||Ir(kn)?Ia=kn:("data"in kn&&(Ia=kn.data),"usage"in kn&&(ya=Zn[kn.usage]),"primitive"in kn&&(qa=Cn[kn.primitive]),"count"in kn&&(Rn=kn.count|0),"type"in kn&&(Pa=qr[kn.type]),"length"in kn?An=kn.length|0:(An=Rn,Pa===Tr||Pa===br?An*=2:(Pa===kr||Pa===mr)&&(An*=4))),Ka(Xn,Ia,ya,qa,Rn,An,Pa)}return jn}return jn(Un),jn._reglType="elements",jn._elements=Xn,jn.subdata=function(kn,Ia){return fn.subdata(kn,Ia),jn},jn.destroy=function(){Va(Xn)},jn}return{create:fa,createStream:ea,destroyStream:ka,getElements:function(Un){return typeof Un=="function"&&Un._elements instanceof Sn?Un._elements:null},clear:function(){de(zn).forEach(Va)}}}var xr=new Float32Array(1),Gr=new Uint32Array(xr.buffer),ln=5123;function wn(ie){for(var nr=j.allocType(ln,ie.length),cr=0;cr>>31<<15,Tn=(sn<<1>>>24)-127,qr=sn>>13&1023;if(Tn<-24)nr[cr]=zn;else if(Tn<-14){var Sn=-14-Tn;nr[cr]=zn+(qr+1024>>Sn)}else Tn>15?nr[cr]=zn+31744:nr[cr]=zn+(Tn+15<<10)+qr}return nr}function rn(ie){return Array.isArray(ie)||Mr(ie)}var Qr=34467,vn=3553,Oa=34067,Qn=34069,Qa=6408,Ja=6406,wi=6407,ci=6409,Ti=6410,Ra=32854,Qi=32855,Hi=36194,Ho=32819,Ci=32820,zo=33635,qi=34042,qo=6402,Po=34041,hs=35904,Gi=35906,uo=36193,yi=33776,ao=33777,ts=33778,vs=33779,As=35986,_o=35987,Da=34798,li=35840,wo=35841,Ms=35842,Di=35843,_s=36196,No=5121,is=5123,al=5125,ii=5126,io=10242,co=10243,Is=10497,Wo=33071,Bi=33648,$s=10240,fl=10241,Jo=9728,us=9729,Ss=9984,Ls=9985,xl=9986,bu=9987,au=33170,fu=4352,zc=4353,_c=4354,cs=34046,Gl=3317,Lc=37440,Al=37441,_l=37443,Ml=37444,hu=33984,Fs=[Ss,xl,Ls,bu],bl=[0,ci,Ti,wi,Qa],Fo={};Fo[ci]=Fo[Ja]=Fo[qo]=1,Fo[Po]=Fo[Ti]=2,Fo[wi]=Fo[hs]=3,Fo[Qa]=Fo[Gi]=4;function bs(ie){return"[object "+ie+"]"}var Iu=bs("HTMLCanvasElement"),Nl=bs("OffscreenCanvas"),qu=bs("CanvasRenderingContext2D"),qs=bs("ImageBitmap"),sf=bs("HTMLImageElement"),Oo=bs("HTMLVideoElement"),yf=Object.keys(Yt).concat([Iu,Nl,qu,qs,sf,Oo]),os=[];os[No]=1,os[ii]=4,os[uo]=2,os[is]=2,os[al]=4;var Fi=[];Fi[Ra]=2,Fi[Qi]=2,Fi[Hi]=2,Fi[Po]=4,Fi[yi]=.5,Fi[ao]=.5,Fi[ts]=1,Fi[vs]=1,Fi[As]=.5,Fi[_o]=1,Fi[Da]=1,Fi[li]=.5,Fi[wo]=.25,Fi[Ms]=.5,Fi[Di]=.25,Fi[_s]=.5;function ac(ie){return Array.isArray(ie)&&(ie.length===0||typeof ie[0]=="number")}function pu(ie){if(!Array.isArray(ie))return!1;var nr=ie.length;return!(nr===0||!rn(ie[0]))}function ml(ie){return Object.prototype.toString.call(ie)}function Cc(ie){return ml(ie)===Iu}function Wu(ie){return ml(ie)===Nl}function mc(ie){return ml(ie)===qu}function wl(ie){return ml(ie)===qs}function Xc(ie){return ml(ie)===sf}function Bc(ie){return ml(ie)===Oo}function gc(ie){if(!ie)return!1;var nr=ml(ie);return yf.indexOf(nr)>=0?!0:ac(ie)||pu(ie)||Ir(ie)}function Gu(ie){return Yt[Object.prototype.toString.call(ie)]|0}function Ic(ie,nr){var cr=nr.length;switch(ie.type){case No:case is:case al:case ii:var sn=j.allocType(ie.type,cr);sn.set(nr),ie.data=sn;break;case uo:ie.data=wn(nr);break}}function Pc(ie,nr){return j.allocType(ie.type===uo?ii:ie.type,nr)}function du(ie,nr){ie.type===uo?(ie.data=wn(nr),j.freeType(nr)):ie.data=nr}function Rc(ie,nr,cr,sn,zn,Tn){for(var qr=ie.width,Sn=ie.height,sa=ie.channels,ea=qr*Sn*sa,ka=Pc(ie,ea),Ka=0,Va=0;Va=1;)Sn+=qr*sa*sa,sa/=2;return Sn}else return qr*cr*sn}function wu(ie,nr,cr,sn,zn,Tn,qr){var Sn={"don't care":fu,"dont care":fu,nice:_c,fast:zc},sa={repeat:Is,clamp:Wo,mirror:Bi},ea={nearest:Jo,linear:us},ka=u({mipmap:bu,"nearest mipmap nearest":Ss,"linear mipmap nearest":Ls,"nearest mipmap linear":xl,"linear mipmap linear":bu},ea),Ka={none:0,browser:Ml},Va={uint8:No,rgba4:Ho,rgb565:zo,"rgb5 a1":Ci},fa={alpha:Ja,luminance:ci,"luminance alpha":Ti,rgb:wi,rgba:Qa,rgba4:Ra,"rgb5 a1":Qi,rgb565:Hi},Un={};nr.ext_srgb&&(fa.srgb=hs,fa.srgba=Gi),nr.oes_texture_float&&(Va.float32=Va.float=ii),nr.oes_texture_half_float&&(Va.float16=Va["half float"]=uo),nr.webgl_depth_texture&&(u(fa,{depth:qo,"depth stencil":Po}),u(Va,{uint16:is,uint32:al,"depth stencil":qi})),nr.webgl_compressed_texture_s3tc&&u(Un,{"rgb s3tc dxt1":yi,"rgba s3tc dxt1":ao,"rgba s3tc dxt3":ts,"rgba s3tc dxt5":vs}),nr.webgl_compressed_texture_atc&&u(Un,{"rgb atc":As,"rgba atc explicit alpha":_o,"rgba atc interpolated alpha":Da}),nr.webgl_compressed_texture_pvrtc&&u(Un,{"rgb pvrtc 4bppv1":li,"rgb pvrtc 2bppv1":wo,"rgba pvrtc 4bppv1":Ms,"rgba pvrtc 2bppv1":Di}),nr.webgl_compressed_texture_etc1&&(Un["rgb etc1"]=_s);var Nr=Array.prototype.slice.call(ie.getParameter(Qr));Object.keys(Un).forEach(function(U){var tt=Un[U];Nr.indexOf(tt)>=0&&(fa[U]=tt)});var fn=Object.keys(fa);cr.textureFormats=fn;var Xn=[];Object.keys(fa).forEach(function(U){var tt=fa[U];Xn[tt]=U});var jn=[];Object.keys(Va).forEach(function(U){var tt=Va[U];jn[tt]=U});var kn=[];Object.keys(ea).forEach(function(U){var tt=ea[U];kn[tt]=U});var Ia=[];Object.keys(ka).forEach(function(U){var tt=ka[U];Ia[tt]=U});var ya=[];Object.keys(sa).forEach(function(U){var tt=sa[U];ya[tt]=U});var qa=fn.reduce(function(U,tt){var Y=fa[tt];return Y===ci||Y===Ja||Y===ci||Y===Ti||Y===qo||Y===Po||nr.ext_srgb&&(Y===hs||Y===Gi)?U[Y]=Y:Y===Qi||tt.indexOf("rgba")>=0?U[Y]=Qa:U[Y]=wi,U},{});function Rn(){this.internalformat=Qa,this.format=Qa,this.type=No,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=Ml,this.width=0,this.height=0,this.channels=0}function An(U,tt){U.internalformat=tt.internalformat,U.format=tt.format,U.type=tt.type,U.compressed=tt.compressed,U.premultiplyAlpha=tt.premultiplyAlpha,U.flipY=tt.flipY,U.unpackAlignment=tt.unpackAlignment,U.colorSpace=tt.colorSpace,U.width=tt.width,U.height=tt.height,U.channels=tt.channels}function Pa(U,tt){if(!(typeof tt!="object"||!tt)){if("premultiplyAlpha"in tt&&(U.premultiplyAlpha=tt.premultiplyAlpha),"flipY"in tt&&(U.flipY=tt.flipY),"alignment"in tt&&(U.unpackAlignment=tt.alignment),"colorSpace"in tt&&(U.colorSpace=Ka[tt.colorSpace]),"type"in tt){var Y=tt.type;U.type=Va[Y]}var ft=U.width,zt=U.height,Qt=U.channels,ne=!1;"shape"in tt?(ft=tt.shape[0],zt=tt.shape[1],tt.shape.length===3&&(Qt=tt.shape[2],ne=!0)):("radius"in tt&&(ft=zt=tt.radius),"width"in tt&&(ft=tt.width),"height"in tt&&(zt=tt.height),"channels"in tt&&(Qt=tt.channels,ne=!0)),U.width=ft|0,U.height=zt|0,U.channels=Qt|0;var Ft=!1;if("format"in tt){var $t=tt.format,he=U.internalformat=fa[$t];U.format=qa[he],$t in Va&&("type"in tt||(U.type=Va[$t])),$t in Un&&(U.compressed=!0),Ft=!0}!ne&&Ft?U.channels=Fo[U.format]:ne&&!Ft&&U.channels!==bl[U.format]&&(U.format=U.internalformat=bl[U.channels])}}function ba(U){ie.pixelStorei(Lc,U.flipY),ie.pixelStorei(Al,U.premultiplyAlpha),ie.pixelStorei(_l,U.colorSpace),ie.pixelStorei(Gl,U.unpackAlignment)}function aa(){Rn.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function oa(U,tt){var Y=null;if(gc(tt)?Y=tt:tt&&(Pa(U,tt),"x"in tt&&(U.xOffset=tt.x|0),"y"in tt&&(U.yOffset=tt.y|0),gc(tt.data)&&(Y=tt.data)),tt.copy){var ft=zn.viewportWidth,zt=zn.viewportHeight;U.width=U.width||ft-U.xOffset,U.height=U.height||zt-U.yOffset,U.needsCopy=!0}else if(!Y)U.width=U.width||1,U.height=U.height||1,U.channels=U.channels||4;else if(Mr(Y))U.channels=U.channels||4,U.data=Y,!("type"in tt)&&U.type===No&&(U.type=Gu(Y));else if(ac(Y))U.channels=U.channels||4,Ic(U,Y),U.alignment=1,U.needsFree=!0;else if(Ir(Y)){var Qt=Y.data;!Array.isArray(Qt)&&U.type===No&&(U.type=Gu(Qt));var ne=Y.shape,Ft=Y.stride,$t,he,Ne,Ie,Fe,He;ne.length===3?(Ne=ne[2],He=Ft[2]):(Ne=1,He=1),$t=ne[0],he=ne[1],Ie=Ft[0],Fe=Ft[1],U.alignment=1,U.width=$t,U.height=he,U.channels=Ne,U.format=U.internalformat=bl[Ne],U.needsFree=!0,Rc(U,Qt,Ie,Fe,He,Y.offset)}else if(Cc(Y)||Wu(Y)||mc(Y))Cc(Y)||Wu(Y)?U.element=Y:U.element=Y.canvas,U.width=U.element.width,U.height=U.element.height,U.channels=4;else if(wl(Y))U.element=Y,U.width=Y.width,U.height=Y.height,U.channels=4;else if(Xc(Y))U.element=Y,U.width=Y.naturalWidth,U.height=Y.naturalHeight,U.channels=4;else if(Bc(Y))U.element=Y,U.width=Y.videoWidth,U.height=Y.videoHeight,U.channels=4;else if(pu(Y)){var Ge=U.width||Y[0].length,Ae=U.height||Y.length,Oe=U.channels;rn(Y[0][0])?Oe=Oe||Y[0][0].length:Oe=Oe||1;for(var Le=Dt.shape(Y),ur=1,Dr=0;Dr>=zt,Y.height>>=zt,oa(Y,ft[zt]),U.mipmask|=1<=0&&!("faces"in tt)&&(U.genMipmaps=!0)}if("mag"in tt){var ft=tt.mag;U.magFilter=ea[ft]}var zt=U.wrapS,Qt=U.wrapT;if("wrap"in tt){var ne=tt.wrap;typeof ne=="string"?zt=Qt=sa[ne]:Array.isArray(ne)&&(zt=sa[ne[0]],Qt=sa[ne[1]])}else{if("wrapS"in tt){var Ft=tt.wrapS;zt=sa[Ft]}if("wrapT"in tt){var $t=tt.wrapT;Qt=sa[$t]}}if(U.wrapS=zt,U.wrapT=Qt,"anisotropic"in tt&&(tt.anisotropic,U.anisotropic=tt.anisotropic),"mipmap"in tt){var he=!1;switch(typeof tt.mipmap){case"string":U.mipmapHint=Sn[tt.mipmap],U.genMipmaps=!0,he=!0;break;case"boolean":he=U.genMipmaps=tt.mipmap;break;case"object":U.genMipmaps=!1,he=!0;break}he&&!("min"in tt)&&(U.minFilter=Ss)}}function El(U,tt){ie.texParameteri(tt,fl,U.minFilter),ie.texParameteri(tt,$s,U.magFilter),ie.texParameteri(tt,io,U.wrapS),ie.texParameteri(tt,co,U.wrapT),nr.ext_texture_filter_anisotropic&&ie.texParameteri(tt,cs,U.anisotropic),U.genMipmaps&&(ie.hint(au,U.mipmapHint),ie.generateMipmap(tt))}var Cl=0,Hs={},js=cr.maxTextureUnits,Ks=Array(js).map(function(){return null});function Mi(U){Rn.call(this),this.mipmask=0,this.internalformat=Qa,this.id=Cl++,this.refCount=1,this.target=U,this.texture=ie.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new Zo,qr.profile&&(this.stats={size:0})}function Ys(U){ie.activeTexture(hu),ie.bindTexture(U.target,U.texture)}function Uo(){var U=Ks[0];U?ie.bindTexture(U.target,U.texture):ie.bindTexture(vn,null)}function tl(U){var tt=U.texture,Y=U.unit,ft=U.target;Y>=0&&(ie.activeTexture(hu+Y),ie.bindTexture(ft,null),Ks[Y]=null),ie.deleteTexture(tt),U.texture=null,U.params=null,U.pixels=null,U.refCount=0,delete Hs[U.id],Tn.textureCount--}u(Mi.prototype,{bind:function(){var U=this;U.bindCount+=1;var tt=U.unit;if(tt<0){for(var Y=0;Y0)continue;ft.unit=-1}Ks[Y]=U,tt=Y;break}qr.profile&&Tn.maxTextureUnits>Fe)-Ne,He.height=He.height||(Y.height>>Fe)-Ie,Ys(Y),_i(He,vn,Ne,Ie,Fe),Uo(),Na(He),ft}function Qt(ne,Ft){var $t=ne|0,he=Ft|0||$t;if($t===Y.width&&he===Y.height)return ft;ft.width=Y.width=$t,ft.height=Y.height=he,Ys(Y);for(var Ne=0;Y.mipmask>>Ne;++Ne){var Ie=$t>>Ne,Fe=he>>Ne;if(!Ie||!Fe)break;ie.texImage2D(vn,Ne,Y.format,Ie,Fe,0,Y.format,Y.type,null)}return Uo(),qr.profile&&(Y.stats.size=Pu(Y.internalformat,Y.type,$t,he,!1,!1)),ft}return ft(U,tt),ft.subimage=zt,ft.resize=Qt,ft._reglType="texture2d",ft._texture=Y,qr.profile&&(ft.stats=Y.stats),ft.destroy=function(){Y.decRef()},ft}function vi(U,tt,Y,ft,zt,Qt){var ne=new Mi(Oa);Hs[ne.id]=ne,Tn.cubeCount++;var Ft=new Array(6);function $t(Ie,Fe,He,Ge,Ae,Oe){var Le,ur=ne.texInfo;for(Zo.call(ur),Le=0;Le<6;++Le)Ft[Le]=Zi();if(typeof Ie=="number"||!Ie){var Dr=Ie|0||1;for(Le=0;Le<6;++Le)gi(Ft[Le],Dr,Dr)}else if(typeof Ie=="object")if(Fe)Ri(Ft[0],Ie),Ri(Ft[1],Fe),Ri(Ft[2],He),Ri(Ft[3],Ge),Ri(Ft[4],Ae),Ri(Ft[5],Oe);else if(Qs(ur,Ie),Pa(ne,Ie),"faces"in Ie){var jr=Ie.faces;for(Le=0;Le<6;++Le)An(Ft[Le],ne),Ri(Ft[Le],jr[Le])}else for(Le=0;Le<6;++Le)Ri(Ft[Le],Ie);for(An(ne,Ft[0]),ur.genMipmaps?ne.mipmask=(Ft[0].width<<1)-1:ne.mipmask=Ft[0].mipmask,ne.internalformat=Ft[0].internalformat,$t.width=Ft[0].width,$t.height=Ft[0].height,Ys(ne),Le=0;Le<6;++Le)ds(Ft[Le],Qn+Le);for(El(ur,Oa),Uo(),qr.profile&&(ne.stats.size=Pu(ne.internalformat,ne.type,$t.width,$t.height,ur.genMipmaps,!0)),$t.format=Xn[ne.internalformat],$t.type=jn[ne.type],$t.mag=kn[ur.magFilter],$t.min=Ia[ur.minFilter],$t.wrapS=ya[ur.wrapS],$t.wrapT=ya[ur.wrapT],Le=0;Le<6;++Le)Zs(Ft[Le]);return $t}function he(Ie,Fe,He,Ge,Ae){var Oe=He|0,Le=Ge|0,ur=Ae|0,Dr=Ma();return An(Dr,ne),Dr.width=0,Dr.height=0,oa(Dr,Fe),Dr.width=Dr.width||(ne.width>>ur)-Oe,Dr.height=Dr.height||(ne.height>>ur)-Le,Ys(ne),_i(Dr,Qn+Ie,Oe,Le,ur),Uo(),Na(Dr),$t}function Ne(Ie){var Fe=Ie|0;if(Fe!==ne.width){$t.width=ne.width=Fe,$t.height=ne.height=Fe,Ys(ne);for(var He=0;He<6;++He)for(var Ge=0;ne.mipmask>>Ge;++Ge)ie.texImage2D(Qn+He,Ge,ne.format,Fe>>Ge,Fe>>Ge,0,ne.format,ne.type,null);return Uo(),qr.profile&&(ne.stats.size=Pu(ne.internalformat,ne.type,$t.width,$t.height,!1,!0)),$t}}return $t(U,tt,Y,ft,zt,Qt),$t.subimage=he,$t.resize=Ne,$t._reglType="textureCube",$t._texture=ne,qr.profile&&($t.stats=ne.stats),$t.destroy=function(){ne.decRef()},$t}function lo(){for(var U=0;U>ft,Y.height>>ft,0,Y.internalformat,Y.type,null);else for(var zt=0;zt<6;++zt)ie.texImage2D(Qn+zt,ft,Y.internalformat,Y.width>>ft,Y.height>>ft,0,Y.internalformat,Y.type,null);El(Y.texInfo,Y.target)})}function $o(){for(var U=0;U=0?Zs=!0:sa.indexOf(Zo)>=0&&(Zs=!1))),("depthTexture"in Mi||"depthStencilTexture"in Mi)&&(Ks=!!(Mi.depthTexture||Mi.depthStencilTexture)),"depth"in Mi&&(typeof Mi.depth=="boolean"?ds=Mi.depth:(Cl=Mi.depth,rs=!1)),"stencil"in Mi&&(typeof Mi.stencil=="boolean"?rs=Mi.stencil:(Hs=Mi.stencil,ds=!1)),"depthStencil"in Mi&&(typeof Mi.depthStencil=="boolean"?ds=rs=Mi.depthStencil:(js=Mi.depthStencil,ds=!1,rs=!1))}var Uo=null,tl=null,Il=null,vi=null;if(Array.isArray(Zi))Uo=Zi.map(Un);else if(Zi)Uo=[Un(Zi)];else for(Uo=new Array(El),ui=0;ui0&&(Na.depth=oa[0].depth,Na.stencil=oa[0].stencil,Na.depthStencil=oa[0].depthStencil),oa[Ma]?oa[Ma](Na):oa[Ma]=An(Na)}return u(Sa,{width:ui,height:ui,color:Zo})}function _i(pi){var Ma,Na=pi|0;if(Na===Sa.width)return Sa;var ui=Sa.color;for(Ma=0;Ma=ui.byteLength?gi.subdata(ui):(gi.destroy(),An.buffers[pi]=null)),An.buffers[pi]||(gi=An.buffers[pi]=zn.create(Ma,kc,!1,!0)),Na.buffer=zn.getBuffer(gi),Na.size=Na.buffer.dimension|0,Na.normalized=!1,Na.type=Na.buffer.dtype,Na.offset=0,Na.stride=0,Na.divisor=0,Na.state=1,Sa[pi]=1}else zn.getBuffer(Ma)?(Na.buffer=zn.getBuffer(Ma),Na.size=Na.buffer.dimension|0,Na.normalized=!1,Na.type=Na.buffer.dtype,Na.offset=0,Na.stride=0,Na.divisor=0,Na.state=1):zn.getBuffer(Ma.buffer)?(Na.buffer=zn.getBuffer(Ma.buffer),Na.size=(+Ma.size||Na.buffer.dimension)|0,Na.normalized=!!Ma.normalized||!1,"type"in Ma?Na.type=pn[Ma.type]:Na.type=Na.buffer.dtype,Na.offset=(Ma.offset||0)|0,Na.stride=(Ma.stride||0)|0,Na.divisor=(Ma.divisor||0)|0,Na.state=1):"x"in Ma&&(Na.x=+Ma.x||0,Na.y=+Ma.y||0,Na.z=+Ma.z||0,Na.w=+Ma.w||0,Na.state=2)}for(var Ri=0;Ri1)for(var ba=0;baNr&&(Nr=fn.stats.uniformsCount)}),Nr},cr.getMaxAttributesCount=function(){var Nr=0;return ka.forEach(function(fn){fn.stats.attributesCount>Nr&&(Nr=fn.stats.attributesCount)}),Nr});function Un(){zn={},Tn={};for(var Nr=0;Nr>>4&15)+nr.charAt(sn&15);return cr}function Fu(ie){for(var nr="",cr=-1,sn,zn;++cr>>6&31,128|sn&63):sn<=65535?nr+=String.fromCharCode(224|sn>>>12&15,128|sn>>>6&63,128|sn&63):sn<=2097151&&(nr+=String.fromCharCode(240|sn>>>18&7,128|sn>>>12&63,128|sn>>>6&63,128|sn&63));return nr}function Au(ie){for(var nr=Array(ie.length>>2),cr=0;cr>5]|=(ie.charCodeAt(cr/8)&255)<<24-cr%32;return nr}function il(ie){for(var nr="",cr=0;cr>5]>>>24-cr%32&255);return nr}function Cs(ie,nr){return ie>>>nr|ie<<32-nr}function Mu(ie,nr){return ie>>>nr}function uc(ie,nr,cr){return ie&nr^~ie&cr}function Su(ie,nr,cr){return ie&nr^ie&cr^nr&cr}function Dc(ie){return Cs(ie,2)^Cs(ie,13)^Cs(ie,22)}function Xe(ie){return Cs(ie,6)^Cs(ie,11)^Cs(ie,25)}function yr(ie){return Cs(ie,7)^Cs(ie,18)^Mu(ie,3)}function Kr(ie){return Cs(ie,17)^Cs(ie,19)^Mu(ie,10)}var Rr=new Array(1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998);function mn(ie,nr){var cr=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),sn=new Array(64),zn,Tn,qr,Sn,sa,ea,ka,Ka,Va,fa,Un,Nr;for(ie[nr>>5]|=128<<24-nr%32,ie[(nr+64>>9<<4)+15]=nr,Va=0;Va>16)+(nr>>16)+(cr>>16);return sn<<16|cr&65535}function ha(ie){return Array.prototype.slice.call(ie)}function Ta(ie){return ha(ie).join("")}function Ua(ie){var nr=ie&&ie.cache,cr=0,sn=[],zn=[],Tn=[];function qr(Un,Nr){var fn=Nr&&Nr.stable;if(!fn){for(var Xn=0;Xn0&&(Un.push(jn,"="),Un.push.apply(Un,ha(arguments)),Un.push(";")),jn}return u(Nr,{def:Xn,toString:function(){return Ta([fn.length>0?"var "+fn.join(",")+";":"",Ta(Un)])}})}function sa(){var Un=Sn(),Nr=Sn(),fn=Un.toString,Xn=Nr.toString;function jn(kn,Ia){Nr(kn,Ia,"=",Un.def(kn,Ia),";")}return u(function(){Un.apply(Un,ha(arguments))},{def:Un.def,entry:Un,exit:Nr,save:jn,set:function(kn,Ia,ya){jn(kn,Ia),Un(kn,Ia,"=",ya,";")},toString:function(){return fn()+Xn()}})}function ea(){var Un=Ta(arguments),Nr=sa(),fn=sa(),Xn=Nr.toString,jn=fn.toString;return u(Nr,{then:function(){return Nr.apply(Nr,ha(arguments)),this},else:function(){return fn.apply(fn,ha(arguments)),this},toString:function(){var kn=jn();return kn&&(kn="else{"+kn+"}"),Ta(["if(",Un,"){",Xn(),"}",kn])}})}var ka=Sn(),Ka={};function Va(Un,Nr){var fn=[];function Xn(){var qa="a"+fn.length;return fn.push(qa),qa}Nr=Nr||0;for(var jn=0;jn":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Bn={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Hn={cw:Xt,ccw:fe};function Yn(ie){return Array.isArray(ie)||Mr(ie)||Ir(ie)}function na(ie){return ie.sort(function(nr,cr){return nr===ul?-1:cr===ul?1:nr=1,sn>=2,nr)}else if(cr===Wi){var zn=ie.data;return new _n(zn.thisDep,zn.contextDep,zn.propDep,nr)}else{if(cr===Xi)return new _n(!1,!1,!1,nr);if(cr===ni){for(var Tn=!1,qr=!1,Sn=!1,sa=0;sa=1&&(qr=!0),ka>=2&&(Sn=!0)}else ea.type===Wi&&(Tn=Tn||ea.data.thisDep,qr=qr||ea.data.contextDep,Sn=Sn||ea.data.propDep)}return new _n(Tn,qr,Sn,nr)}else return new _n(cr===Oi,cr===Vi,cr===ei,nr)}}var xi=new _n(!1,!1,!1,function(){});function ki(ie,nr,cr,sn,zn,Tn,qr,Sn,sa,ea,ka,Ka,Va,fa,Un,Nr){var fn=ea.Record,Xn={add:32774,subtract:32778,"reverse subtract":32779};cr.ext_blend_minmax&&(Xn.min=me,Xn.max=we);var jn=cr.angle_instanced_arrays,kn=cr.webgl_draw_buffers,Ia=cr.oes_vertex_array_object,ya={dirty:!0,profile:Nr.profile},qa={},Rn=[],An={},Pa={};function ba(Ft){return Ft.replace(".","_")}function aa(Ft,$t,he){var Ne=ba(Ft);Rn.push(Ft),qa[Ne]=ya[Ne]=!!he,An[Ne]=$t}function oa(Ft,$t,he){var Ne=ba(Ft);Rn.push(Ft),Array.isArray(he)?(ya[Ne]=he.slice(),qa[Ne]=he.slice()):ya[Ne]=qa[Ne]=he,Pa[Ne]=$t}function Sa(Ft){return!!isNaN(Ft)}aa(Za,gr),aa($i,fr),oa(Do,"blendColor",[0,0,0,0]),oa(ss,"blendEquationSeparate",[Sr,Sr]),oa(Ps,"blendFuncSeparate",[Cr,or,Cr,or]),aa(ys,Hr,!0),oa(Os,"depthFunc",Wr),oa(Yo,"depthRange",[0,1]),oa(ll,"depthMask",!0),oa(el,el,[!0,!0,!0,!0]),aa(Rs,rr),oa(bi,"cullFace",Et),oa(so,so,fe),oa(ws,ws,1),aa(fs,cn),oa(Ll,"polygonOffset",[0,0]),aa($l,Mn),aa(jl,Jn),oa(Bu,"sampleCoverage",[1,!1]),aa(Jl,Lr),oa(Ru,"stencilMask",-1),oa(nl,"stencilFunc",[Ve,0,-1]),oa(Nu,"stencilOpSeparate",[gt,je,je,je]),oa(Ui,"stencilOpSeparate",[Et,je,je,je]),aa(fo,nn),oa(Ql,"scissor",[0,0,ie.drawingBufferWidth,ie.drawingBufferHeight]),oa(ul,ul,[0,0,ie.drawingBufferWidth,ie.drawingBufferHeight]);var _i={gl:ie,context:Va,strings:nr,next:qa,current:ya,draw:Ka,elements:Tn,buffer:zn,shader:ka,attributes:ea.state,vao:ea,uniforms:sa,framebuffer:Sn,extensions:cr,timer:fa,isBufferArgs:Yn},pi={primTypes:Cn,compareFuncs:hn,blendFuncs:ta,blendEquations:Xn,stencilOps:Bn,glTypes:pn,orientationType:Hn};kn&&(pi.backBuffer=[Et],pi.drawBuffer=c(sn.maxDrawbuffers,function(Ft){return Ft===0?[0]:c(Ft,function($t){return on+$t})}));var Ma=0;function Na(){var Ft=Ua({cache:Un}),$t=Ft.link,he=Ft.global;Ft.id=Ma++,Ft.batchId="0";var Ne=$t(_i),Ie=Ft.shared={props:"a0"};Object.keys(_i).forEach(function(Oe){Ie[Oe]=he.def(Ne,".",Oe)});var Fe=Ft.next={},He=Ft.current={};Object.keys(Pa).forEach(function(Oe){Array.isArray(ya[Oe])&&(Fe[Oe]=he.def(Ie.next,".",Oe),He[Oe]=he.def(Ie.current,".",Oe))});var Ge=Ft.constants={};Object.keys(pi).forEach(function(Oe){Ge[Oe]=he.def(JSON.stringify(pi[Oe]))}),Ft.invoke=function(Oe,Le){switch(Le.type){case ca:var ur=["this",Ie.context,Ie.props,Ft.batchId];return Oe.def($t(Le.data),".call(",ur.slice(0,Math.max(Le.data.length+1,4)),")");case ei:return Oe.def(Ie.props,Le.data);case Vi:return Oe.def(Ie.context,Le.data);case Oi:return Oe.def("this",Le.data);case Wi:return Le.data.append(Ft,Oe),Le.data.ref;case Xi:return Le.data.toString();case ni:return Le.data.map(function(Dr){return Ft.invoke(Oe,Dr)})}},Ft.attribCache={};var Ae={};return Ft.scopeAttrib=function(Oe){var Le=nr.id(Oe);if(Le in Ae)return Ae[Le];var ur=ea.scope[Le];ur||(ur=ea.scope[Le]=new fn);var Dr=Ae[Le]=$t(ur);return Dr},Ft}function ui(Ft){var $t=Ft.static,he=Ft.dynamic,Ne;if(Fc in $t){var Ie=!!$t[Fc];Ne=Wa(function(He,Ge){return Ie}),Ne.enable=Ie}else if(Fc in he){var Fe=he[Fc];Ne=ri(Fe,function(He,Ge){return He.invoke(Ge,Fe)})}return Ne}function gi(Ft,$t){var he=Ft.static,Ne=Ft.dynamic;if(Pt in he){var Ie=he[Pt];return Ie?(Ie=Sn.getFramebuffer(Ie),Wa(function(He,Ge){var Ae=He.link(Ie),Oe=He.shared;Ge.set(Oe.framebuffer,".next",Ae);var Le=Oe.context;return Ge.set(Le,"."+pr,Ae+".width"),Ge.set(Le,"."+Br,Ae+".height"),Ae})):Wa(function(He,Ge){var Ae=He.shared;Ge.set(Ae.framebuffer,".next","null");var Oe=Ae.context;return Ge.set(Oe,"."+pr,Oe+"."+ae),Ge.set(Oe,"."+Br,Oe+"."+ce),"null"})}else if(Pt in Ne){var Fe=Ne[Pt];return ri(Fe,function(He,Ge){var Ae=He.invoke(Ge,Fe),Oe=He.shared,Le=Oe.framebuffer,ur=Ge.def(Le,".getFramebuffer(",Ae,")");Ge.set(Le,".next",ur);var Dr=Oe.context;return Ge.set(Dr,"."+pr,ur+"?"+ur+".width:"+Dr+"."+ae),Ge.set(Dr,"."+Br,ur+"?"+ur+".height:"+Dr+"."+ce),ur})}else return null}function Ri(Ft,$t,he){var Ne=Ft.static,Ie=Ft.dynamic;function Fe(Ae){if(Ae in Ne){var Oe=Ne[Ae],Le=!0,ur=Oe.x|0,Dr=Oe.y|0,jr,On;return"width"in Oe?jr=Oe.width|0:Le=!1,"height"in Oe?On=Oe.height|0:Le=!1,new _n(!Le&&$t&&$t.thisDep,!Le&&$t&&$t.contextDep,!Le&&$t&&$t.propDep,function(Wn,Dn){var la=Wn.shared.context,qn=jr;"width"in Oe||(qn=Dn.def(la,".",pr,"-",ur));var Gn=On;return"height"in Oe||(Gn=Dn.def(la,".",Br,"-",Dr)),[ur,Dr,qn,Gn]})}else if(Ae in Ie){var Ln=Ie[Ae],xn=ri(Ln,function(Wn,Dn){var la=Wn.invoke(Dn,Ln),qn=Wn.shared.context,Gn=Dn.def(la,".x|0"),ma=Dn.def(la,".y|0"),ti=Dn.def('"width" in ',la,"?",la,".width|0:","(",qn,".",pr,"-",Gn,")"),si=Dn.def('"height" in ',la,"?",la,".height|0:","(",qn,".",Br,"-",ma,")");return[Gn,ma,ti,si]});return $t&&(xn.thisDep=xn.thisDep||$t.thisDep,xn.contextDep=xn.contextDep||$t.contextDep,xn.propDep=xn.propDep||$t.propDep),xn}else return $t?new _n($t.thisDep,$t.contextDep,$t.propDep,function(Wn,Dn){var la=Wn.shared.context;return[0,0,Dn.def(la,".",pr),Dn.def(la,".",Br)]}):null}var He=Fe(ul);if(He){var Ge=He;He=new _n(He.thisDep,He.contextDep,He.propDep,function(Ae,Oe){var Le=Ge.append(Ae,Oe),ur=Ae.shared.context;return Oe.set(ur,"."+Jr,Le[2]),Oe.set(ur,"."+Rt,Le[3]),Le})}return{viewport:He,scissor_box:Fe(Ql)}}function ds(Ft,$t){var he=Ft.static,Ne=typeof he[at]=="string"&&typeof he[L]=="string";if(Ne){if(Object.keys($t.dynamic).length>0)return null;var Ie=$t.static,Fe=Object.keys(Ie);if(Fe.length>0&&typeof Ie[Fe[0]]=="number"){for(var He=[],Ge=0;Ge"+Gn+"?"+Le+".constant["+Gn+"]:0;"}).join(""),"}}else{","if(",jr,"(",Le,".buffer)){",Wn,"=",On,".createStream(",ye,",",Le,".buffer);","}else{",Wn,"=",On,".getBuffer(",Le,".buffer);","}",Dn,'="type" in ',Le,"?",Dr.glTypes,"[",Le,".type]:",Wn,".dtype;",Ln.normalized,"=!!",Le,".normalized;");function la(qn){Oe(Ln[qn],"=",Le,".",qn,"|0;")}return la("size"),la("offset"),la("stride"),la("divisor"),Oe("}}"),Oe.exit("if(",Ln.isStream,"){",On,".destroyStream(",Wn,");","}"),Ln}Ie[Fe]=ri(He,Ge)}),Ie}function El(Ft){var $t=Ft.static,he=Ft.dynamic,Ne={};return Object.keys($t).forEach(function(Ie){var Fe=$t[Ie];Ne[Ie]=Wa(function(He,Ge){return typeof Fe=="number"||typeof Fe=="boolean"?""+Fe:He.link(Fe)})}),Object.keys(he).forEach(function(Ie){var Fe=he[Ie];Ne[Ie]=ri(Fe,function(He,Ge){return He.invoke(Ge,Fe)})}),Ne}function Cl(Ft,$t,he,Ne,Ie){Ft.static,Ft.dynamic;var Fe=ds(Ft,$t),He=gi(Ft),Ge=Ri(Ft,He),Ae=Zi(Ft),Oe=Zs(Ft),Le=rs(Ft,Ie,Fe);function ur(Wn){var Dn=Ge[Wn];Dn&&(Oe[Wn]=Dn)}ur(ul),ur(ba(Ql));var Dr=Object.keys(Oe).length>0,jr={framebuffer:He,draw:Ae,shader:Le,state:Oe,dirty:Dr,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(jr.profile=ui(Ft),jr.uniforms=Zo(he),jr.drawVAO=jr.scopeVAO=Ae.vao,!jr.drawVAO&&Le.program&&!Fe&&cr.angle_instanced_arrays&&Ae.static.elements){var On=!0,Ln=Le.program.attributes.map(function(Wn){var Dn=$t.static[Wn];return On=On&&!!Dn,Dn});if(On&&Ln.length>0){var xn=ea.getVAO(ea.createVAO({attributes:Ln,elements:Ae.static.elements}));jr.drawVAO=new _n(null,null,null,function(Wn,Dn){return Wn.link(xn)}),jr.useVAO=!0}}return Fe?jr.useVAO=!0:jr.attributes=Qs($t),jr.context=El(Ne),jr}function Hs(Ft,$t,he){var Ne=Ft.shared,Ie=Ne.context,Fe=Ft.scope();Object.keys(he).forEach(function(He){$t.save(Ie,"."+He);var Ge=he[He],Ae=Ge.append(Ft,$t);Array.isArray(Ae)?Fe(Ie,".",He,"=[",Ae.join(),"];"):Fe(Ie,".",He,"=",Ae,";")}),$t(Fe)}function js(Ft,$t,he,Ne){var Ie=Ft.shared,Fe=Ie.gl,He=Ie.framebuffer,Ge;kn&&(Ge=$t.def(Ie.extensions,".webgl_draw_buffers"));var Ae=Ft.constants,Oe=Ae.drawBuffer,Le=Ae.backBuffer,ur;he?ur=he.append(Ft,$t):ur=$t.def(He,".next"),Ne||$t("if(",ur,"!==",He,".cur){"),$t("if(",ur,"){",Fe,".bindFramebuffer(",an,",",ur,".framebuffer);"),kn&&$t(Ge,".drawBuffersWEBGL(",Oe,"[",ur,".colorAttachments.length]);"),$t("}else{",Fe,".bindFramebuffer(",an,",null);"),kn&&$t(Ge,".drawBuffersWEBGL(",Le,");"),$t("}",He,".cur=",ur,";"),Ne||$t("}")}function Ks(Ft,$t,he){var Ne=Ft.shared,Ie=Ne.gl,Fe=Ft.current,He=Ft.next,Ge=Ne.current,Ae=Ne.next,Oe=Ft.cond(Ge,".dirty");Rn.forEach(function(Le){var ur=ba(Le);if(!(ur in he.state)){var Dr,jr;if(ur in He){Dr=He[ur],jr=Fe[ur];var On=c(ya[ur].length,function(xn){return Oe.def(Dr,"[",xn,"]")});Oe(Ft.cond(On.map(function(xn,Wn){return xn+"!=="+jr+"["+Wn+"]"}).join("||")).then(Ie,".",Pa[ur],"(",On,");",On.map(function(xn,Wn){return jr+"["+Wn+"]="+xn}).join(";"),";"))}else{Dr=Oe.def(Ae,".",ur);var Ln=Ft.cond(Dr,"!==",Ge,".",ur);Oe(Ln),ur in An?Ln(Ft.cond(Dr).then(Ie,".enable(",An[ur],");").else(Ie,".disable(",An[ur],");"),Ge,".",ur,"=",Dr,";"):Ln(Ie,".",Pa[ur],"(",Dr,");",Ge,".",ur,"=",Dr,";")}}}),Object.keys(he.state).length===0&&Oe(Ge,".dirty=false;"),$t(Oe)}function Mi(Ft,$t,he,Ne){var Ie=Ft.shared,Fe=Ft.current,He=Ie.current,Ge=Ie.gl,Ae;na(Object.keys(he)).forEach(function(Oe){var Le=he[Oe];if(!(Ne&&!Ne(Le))){var ur=Le.append(Ft,$t);if(An[Oe]){var Dr=An[Oe];Ha(Le)?(Ae=Ft.link(ur,{stable:!0}),$t(Ft.cond(Ae).then(Ge,".enable(",Dr,");").else(Ge,".disable(",Dr,");")),$t(He,".",Oe,"=",Ae,";")):($t(Ft.cond(ur).then(Ge,".enable(",Dr,");").else(Ge,".disable(",Dr,");")),$t(He,".",Oe,"=",ur,";"))}else if(rn(ur)){var jr=Fe[Oe];$t(Ge,".",Pa[Oe],"(",ur,");",ur.map(function(On,Ln){return jr+"["+Ln+"]="+On}).join(";"),";")}else Ha(Le)?(Ae=Ft.link(ur,{stable:!0}),$t(Ge,".",Pa[Oe],"(",Ae,");",He,".",Oe,"=",Ae,";")):$t(Ge,".",Pa[Oe],"(",ur,");",He,".",Oe,"=",ur,";")}})}function Ys(Ft,$t){jn&&(Ft.instancing=$t.def(Ft.shared.extensions,".angle_instanced_arrays"))}function Uo(Ft,$t,he,Ne,Ie){var Fe=Ft.shared,He=Ft.stats,Ge=Fe.current,Ae=Fe.timer,Oe=he.profile;function Le(){return typeof performance>"u"?"Date.now()":"performance.now()"}var ur,Dr;function jr(la){ur=$t.def(),la(ur,"=",Le(),";"),typeof Ie=="string"?la(He,".count+=",Ie,";"):la(He,".count++;"),fa&&(Ne?(Dr=$t.def(),la(Dr,"=",Ae,".getNumPendingQueries();")):la(Ae,".beginQuery(",He,");"))}function On(la){la(He,".cpuTime+=",Le(),"-",ur,";"),fa&&(Ne?la(Ae,".pushScopeStats(",Dr,",",Ae,".getNumPendingQueries(),",He,");"):la(Ae,".endQuery();"))}function Ln(la){var qn=$t.def(Ge,".profile");$t(Ge,".profile=",la,";"),$t.exit(Ge,".profile=",qn,";")}var xn;if(Oe){if(Ha(Oe)){Oe.enable?(jr($t),On($t.exit),Ln("true")):Ln("false");return}xn=Oe.append(Ft,$t),Ln(xn)}else xn=$t.def(Ge,".profile");var Wn=Ft.block();jr(Wn),$t("if(",xn,"){",Wn,"}");var Dn=Ft.block();On(Dn),$t.exit("if(",xn,"){",Dn,"}")}function tl(Ft,$t,he,Ne,Ie){var Fe=Ft.shared;function He(Ae){switch(Ae){case xa:case mi:case po:return 2;case La:case Yi:case Qo:return 3;case ai:case Go:case Js:return 4;default:return 1}}function Ge(Ae,Oe,Le){var ur=Fe.gl,Dr=$t.def(Ae,".location"),jr=$t.def(Fe.attributes,"[",Dr,"]"),On=Le.state,Ln=Le.buffer,xn=[Le.x,Le.y,Le.z,Le.w],Wn=["buffer","normalized","offset","stride"];function Dn(){$t("if(!",jr,".buffer){",ur,".enableVertexAttribArray(",Dr,");}");var qn=Le.type,Gn;if(Le.size?Gn=$t.def(Le.size,"||",Oe):Gn=Oe,$t("if(",jr,".type!==",qn,"||",jr,".size!==",Gn,"||",Wn.map(function(ti){return jr+"."+ti+"!=="+Le[ti]}).join("||"),"){",ur,".bindBuffer(",ye,",",Ln,".buffer);",ur,".vertexAttribPointer(",[Dr,Gn,qn,Le.normalized,Le.stride,Le.offset],");",jr,".type=",qn,";",jr,".size=",Gn,";",Wn.map(function(ti){return jr+"."+ti+"="+Le[ti]+";"}).join(""),"}"),jn){var ma=Le.divisor;$t("if(",jr,".divisor!==",ma,"){",Ft.instancing,".vertexAttribDivisorANGLE(",[Dr,ma],");",jr,".divisor=",ma,";}")}}function la(){$t("if(",jr,".buffer){",ur,".disableVertexAttribArray(",Dr,");",jr,".buffer=null;","}if(",Ya.map(function(qn,Gn){return jr+"."+qn+"!=="+xn[Gn]}).join("||"),"){",ur,".vertexAttrib4f(",Dr,",",xn,");",Ya.map(function(qn,Gn){return jr+"."+qn+"="+xn[Gn]+";"}).join(""),"}")}On===Ba?Dn():On===za?la():($t("if(",On,"===",Ba,"){"),Dn(),$t("}else{"),la(),$t("}"))}Ne.forEach(function(Ae){var Oe=Ae.name,Le=he.attributes[Oe],ur;if(Le){if(!Ie(Le))return;ur=Le.append(Ft,$t)}else{if(!Ie(xi))return;var Dr=Ft.scopeAttrib(Oe);ur={},Object.keys(new fn).forEach(function(jr){ur[jr]=$t.def(Dr,".",jr)})}Ge(Ft.link(Ae),He(Ae.info.type),ur)})}function Il(Ft,$t,he,Ne,Ie,Fe){for(var He=Ft.shared,Ge=He.gl,Ae,Oe=0;Oe1){for(var Li=[],to=[],ls=0;ls>1)",Ln],");")}function ma(){he(xn,".drawArraysInstancedANGLE(",[Dr,jr,On,Ln],");")}Le&&Le!=="null"?Dn?Gn():(he("if(",Le,"){"),Gn(),he("}else{"),ma(),he("}")):ma()}function qn(){function Gn(){he(Fe+".drawElements("+[Dr,On,Wn,jr+"<<(("+Wn+"-"+va+")>>1)"]+");")}function ma(){he(Fe+".drawArrays("+[Dr,jr,On]+");")}Le&&Le!=="null"?Dn?Gn():(he("if(",Le,"){"),Gn(),he("}else{"),ma(),he("}")):ma()}jn&&(typeof Ln!="number"||Ln>=0)?typeof Ln=="string"?(he("if(",Ln,">0){"),la(),he("}else if(",Ln,"<0){"),qn(),he("}")):la():qn()}function lo(Ft,$t,he,Ne,Ie){var Fe=Na(),He=Fe.proc("body",Ie);return jn&&(Fe.instancing=He.def(Fe.shared.extensions,".angle_instanced_arrays")),Ft(Fe,He,he,Ne),Fe.compile().body}function ns(Ft,$t,he,Ne){Ys(Ft,$t),he.useVAO?he.drawVAO?$t(Ft.shared.vao,".setVAO(",he.drawVAO.append(Ft,$t),");"):$t(Ft.shared.vao,".setVAO(",Ft.shared.vao,".targetVAO);"):($t(Ft.shared.vao,".setVAO(null);"),tl(Ft,$t,he,Ne.attributes,function(){return!0})),Il(Ft,$t,he,Ne.uniforms,function(){return!0},!1),vi(Ft,$t,$t,he)}function $o(Ft,$t){var he=Ft.proc("draw",1);Ys(Ft,he),Hs(Ft,he,$t.context),js(Ft,he,$t.framebuffer),Ks(Ft,he,$t),Mi(Ft,he,$t.state),Uo(Ft,he,$t,!1,!0);var Ne=$t.shader.progVar.append(Ft,he);if(he(Ft.shared.gl,".useProgram(",Ne,".program);"),$t.shader.program)ns(Ft,he,$t,$t.shader.program);else{he(Ft.shared.vao,".setVAO(null);");var Ie=Ft.global.def("{}"),Fe=he.def(Ne,".id"),He=he.def(Ie,"[",Fe,"]");he(Ft.cond(He).then(He,".call(this,a0);").else(He,"=",Ie,"[",Fe,"]=",Ft.link(function(Ge){return lo(ns,Ft,$t,Ge,1)}),"(",Ne,");",He,".call(this,a0);"))}Object.keys($t.state).length>0&&he(Ft.shared.current,".dirty=true;"),Ft.shared.vao&&he(Ft.shared.vao,".setVAO(null);")}function U(Ft,$t,he,Ne){Ft.batchId="a1",Ys(Ft,$t);function Ie(){return!0}tl(Ft,$t,he,Ne.attributes,Ie),Il(Ft,$t,he,Ne.uniforms,Ie,!1),vi(Ft,$t,$t,he)}function tt(Ft,$t,he,Ne){Ys(Ft,$t);var Ie=he.contextDep,Fe=$t.def(),He="a0",Ge="a1",Ae=$t.def();Ft.shared.props=Ae,Ft.batchId=Fe;var Oe=Ft.scope(),Le=Ft.scope();$t(Oe.entry,"for(",Fe,"=0;",Fe,"<",Ge,";++",Fe,"){",Ae,"=",He,"[",Fe,"];",Le,"}",Oe.exit);function ur(Wn){return Wn.contextDep&&Ie||Wn.propDep}function Dr(Wn){return!ur(Wn)}if(he.needsContext&&Hs(Ft,Le,he.context),he.needsFramebuffer&&js(Ft,Le,he.framebuffer),Mi(Ft,Le,he.state,ur),he.profile&&ur(he.profile)&&Uo(Ft,Le,he,!1,!0),Ne)he.useVAO?he.drawVAO?ur(he.drawVAO)?Le(Ft.shared.vao,".setVAO(",he.drawVAO.append(Ft,Le),");"):Oe(Ft.shared.vao,".setVAO(",he.drawVAO.append(Ft,Oe),");"):Oe(Ft.shared.vao,".setVAO(",Ft.shared.vao,".targetVAO);"):(Oe(Ft.shared.vao,".setVAO(null);"),tl(Ft,Oe,he,Ne.attributes,Dr),tl(Ft,Le,he,Ne.attributes,ur)),Il(Ft,Oe,he,Ne.uniforms,Dr,!1),Il(Ft,Le,he,Ne.uniforms,ur,!0),vi(Ft,Oe,Le,he);else{var jr=Ft.global.def("{}"),On=he.shader.progVar.append(Ft,Le),Ln=Le.def(On,".id"),xn=Le.def(jr,"[",Ln,"]");Le(Ft.shared.gl,".useProgram(",On,".program);","if(!",xn,"){",xn,"=",jr,"[",Ln,"]=",Ft.link(function(Wn){return lo(U,Ft,he,Wn,2)}),"(",On,");}",xn,".call(this,a0[",Fe,"],",Fe,");")}}function Y(Ft,$t){var he=Ft.proc("batch",2);Ft.batchId="0",Ys(Ft,he);var Ne=!1,Ie=!0;Object.keys($t.context).forEach(function(jr){Ne=Ne||$t.context[jr].propDep}),Ne||(Hs(Ft,he,$t.context),Ie=!1);var Fe=$t.framebuffer,He=!1;Fe?(Fe.propDep?Ne=He=!0:Fe.contextDep&&Ne&&(He=!0),He||js(Ft,he,Fe)):js(Ft,he,null),$t.state.viewport&&$t.state.viewport.propDep&&(Ne=!0);function Ge(jr){return jr.contextDep&&Ne||jr.propDep}Ks(Ft,he,$t),Mi(Ft,he,$t.state,function(jr){return!Ge(jr)}),(!$t.profile||!Ge($t.profile))&&Uo(Ft,he,$t,!1,"a1"),$t.contextDep=Ne,$t.needsContext=Ie,$t.needsFramebuffer=He;var Ae=$t.shader.progVar;if(Ae.contextDep&&Ne||Ae.propDep)tt(Ft,he,$t,null);else{var Oe=Ae.append(Ft,he);if(he(Ft.shared.gl,".useProgram(",Oe,".program);"),$t.shader.program)tt(Ft,he,$t,$t.shader.program);else{he(Ft.shared.vao,".setVAO(null);");var Le=Ft.global.def("{}"),ur=he.def(Oe,".id"),Dr=he.def(Le,"[",ur,"]");he(Ft.cond(Dr).then(Dr,".call(this,a0,a1);").else(Dr,"=",Le,"[",ur,"]=",Ft.link(function(jr){return lo(tt,Ft,$t,jr,2)}),"(",Oe,");",Dr,".call(this,a0,a1);"))}}Object.keys($t.state).length>0&&he(Ft.shared.current,".dirty=true;"),Ft.shared.vao&&he(Ft.shared.vao,".setVAO(null);")}function ft(Ft,$t){var he=Ft.proc("scope",3);Ft.batchId="a2";var Ne=Ft.shared,Ie=Ne.current;if(Hs(Ft,he,$t.context),$t.framebuffer&&$t.framebuffer.append(Ft,he),na(Object.keys($t.state)).forEach(function(Ge){var Ae=$t.state[Ge],Oe=Ae.append(Ft,he);rn(Oe)?Oe.forEach(function(Le,ur){Sa(Le)?he.set(Ft.next[Ge],"["+ur+"]",Le):he.set(Ft.next[Ge],"["+ur+"]",Ft.link(Le,{stable:!0}))}):Ha(Ae)?he.set(Ne.next,"."+Ge,Ft.link(Oe,{stable:!0})):he.set(Ne.next,"."+Ge,Oe)}),Uo(Ft,he,$t,!0,!0),[xt,le,Lt,xe,kt].forEach(function(Ge){var Ae=$t.draw[Ge];if(Ae){var Oe=Ae.append(Ft,he);Sa(Oe)?he.set(Ne.draw,"."+Ge,Oe):he.set(Ne.draw,"."+Ge,Ft.link(Oe),{stable:!0})}}),Object.keys($t.uniforms).forEach(function(Ge){var Ae=$t.uniforms[Ge].append(Ft,he);Array.isArray(Ae)&&(Ae="["+Ae.map(function(Oe){return Sa(Oe)?Oe:Ft.link(Oe,{stable:!0})})+"]"),he.set(Ne.uniforms,"["+Ft.link(nr.id(Ge),{stable:!0})+"]",Ae)}),Object.keys($t.attributes).forEach(function(Ge){var Ae=$t.attributes[Ge].append(Ft,he),Oe=Ft.scopeAttrib(Ge);Object.keys(new fn).forEach(function(Le){he.set(Oe,"."+Le,Ae[Le])})}),$t.scopeVAO){var Fe=$t.scopeVAO.append(Ft,he);Sa(Fe)?he.set(Ne.vao,".targetVAO",Fe):he.set(Ne.vao,".targetVAO",Ft.link(Fe,{stable:!0}))}function He(Ge){var Ae=$t.shader[Ge];if(Ae){var Oe=Ae.append(Ft,he);Sa(Oe)?he.set(Ne.shader,"."+Ge,Oe):he.set(Ne.shader,"."+Ge,Ft.link(Oe,{stable:!0}))}}He(L),He(at),Object.keys($t.state).length>0&&(he(Ie,".dirty=true;"),he.exit(Ie,".dirty=true;")),he("a1(",Ft.shared.context,",a0,",Ft.batchId,");")}function zt(Ft){if(!(typeof Ft!="object"||rn(Ft))){for(var $t=Object.keys(Ft),he=0;he<$t.length;++he)if(f.isDynamic(Ft[$t[he]]))return!0;return!1}}function Qt(Ft,$t,he){var Ne=$t.static[he];if(!Ne||!zt(Ne))return;var Ie=Ft.global,Fe=Object.keys(Ne),He=!1,Ge=!1,Ae=!1,Oe=Ft.global.def("{}");Fe.forEach(function(ur){var Dr=Ne[ur];if(f.isDynamic(Dr)){typeof Dr=="function"&&(Dr=Ne[ur]=f.unbox(Dr));var jr=ri(Dr,null);He=He||jr.thisDep,Ae=Ae||jr.propDep,Ge=Ge||jr.contextDep}else{switch(Ie(Oe,".",ur,"="),typeof Dr){case"number":Ie(Dr);break;case"string":Ie('"',Dr,'"');break;case"object":Array.isArray(Dr)&&Ie("[",Dr.join(),"]");break;default:Ie(Ft.link(Dr));break}Ie(";")}});function Le(ur,Dr){Fe.forEach(function(jr){var On=Ne[jr];if(f.isDynamic(On)){var Ln=ur.invoke(Dr,On);Dr(Oe,".",jr,"=",Ln,";")}})}$t.dynamic[he]=new f.DynamicVariable(Wi,{thisDep:He,contextDep:Ge,propDep:Ae,ref:Oe,append:Le}),delete $t.static[he]}function ne(Ft,$t,he,Ne,Ie){var Fe=Na();Fe.stats=Fe.link(Ie),Object.keys($t.static).forEach(function(Ge){Qt(Fe,$t,Ge)}),Te.forEach(function(Ge){Qt(Fe,Ft,Ge)});var He=Cl(Ft,$t,he,Ne,Fe);return He.shader.program&&(He.shader.program.attributes.sort(function(Ge,Ae){return Ge.name=0;--vi){var lo=Sa[vi];lo&&lo(fa,null,0)}cr.flush(),ea&&ea.update()}function gi(){!Na&&Sa.length>0&&(Na=v.next(ui))}function Ri(){Na&&(v.cancel(ui),Na=null)}function ds(vi){vi.preventDefault(),Ri(),_i.forEach(function(lo){lo()})}function rs(vi){cr.getError(),zn.restore(),ya.restore(),Xn.restore(),qa.restore(),Rn.restore(),An.restore(),kn.restore(),ea&&ea.restore(),Pa.procs.refresh(),gi(),pi.forEach(function(lo){lo()})}oa&&(oa.addEventListener(Bo,ds,!1),oa.addEventListener(Ds,rs,!1));function Zi(){Sa.length=0,Ri(),oa&&(oa.removeEventListener(Bo,ds),oa.removeEventListener(Ds,rs)),ya.clear(),An.clear(),Rn.clear(),kn.clear(),qa.clear(),jn.clear(),Xn.clear(),ea&&ea.clear(),Ma.forEach(function(vi){vi()})}function Zs(vi){function lo(Ie){var Fe=u({},Ie);delete Fe.uniforms,delete Fe.attributes,delete Fe.context,delete Fe.vao,"stencil"in Fe&&Fe.stencil.op&&(Fe.stencil.opBack=Fe.stencil.opFront=Fe.stencil.op,delete Fe.stencil.op);function He(Ge){if(Ge in Fe){var Ae=Fe[Ge];delete Fe[Ge],Object.keys(Ae).forEach(function(Oe){Fe[Ge+"."+Oe]=Ae[Oe]})}}return He("blend"),He("depth"),He("cull"),He("stencil"),He("polygonOffset"),He("scissor"),He("sample"),"vao"in Ie&&(Fe.vao=Ie.vao),Fe}function ns(Ie,Fe){var He={},Ge={};return Object.keys(Ie).forEach(function(Ae){var Oe=Ie[Ae];if(f.isDynamic(Oe)){Ge[Ae]=f.unbox(Oe,Ae);return}else if(Fe&&Array.isArray(Oe)){for(var Le=0;Le0)return ne.call(this,he(Ie|0),Ie|0)}else if(Array.isArray(Ie)){if(Ie.length)return ne.call(this,Ie,Ie.length)}else return Qt.call(this,Ie)}return u(Ne,{stats:ft,destroy:function(){zt.destroy()}})}var Zo=An.setFBO=Zs({framebuffer:f.define.call(null,Ts,"framebuffer")});function Qs(vi,lo){var ns=0;Pa.procs.poll();var $o=lo.color;$o&&(cr.clearColor(+$o[0]||0,+$o[1]||0,+$o[2]||0,+$o[3]||0),ns|=pl),"depth"in lo&&(cr.clearDepth(+lo.depth),ns|=Ns),"stencil"in lo&&(cr.clearStencil(lo.stencil|0),ns|=fi),cr.clear(ns)}function El(vi){if("framebuffer"in vi)if(vi.framebuffer&&vi.framebuffer_reglType==="framebufferCube")for(var lo=0;lo<6;++lo)Zo(u({framebuffer:vi.framebuffer.faces[lo]},vi),Qs);else Zo(vi,Qs);else Qs(null,vi)}function Cl(vi){Sa.push(vi);function lo(){var ns=zs(Sa,vi);function $o(){var U=zs(Sa,$o);Sa[U]=Sa[Sa.length-1],Sa.length-=1,Sa.length<=0&&Ri()}Sa[ns]=$o}return gi(),{cancel:lo}}function Hs(){var vi=aa.viewport,lo=aa.scissor_box;vi[0]=vi[1]=lo[0]=lo[1]=0,fa.viewportWidth=fa.framebufferWidth=fa.drawingBufferWidth=vi[2]=lo[2]=cr.drawingBufferWidth,fa.viewportHeight=fa.framebufferHeight=fa.drawingBufferHeight=vi[3]=lo[3]=cr.drawingBufferHeight}function js(){fa.tick+=1,fa.time=Mi(),Hs(),Pa.procs.poll()}function Ks(){qa.refresh(),Hs(),Pa.procs.refresh(),ea&&ea.update()}function Mi(){return(g()-ka)/1e3}Ks();function Ys(vi,lo){var ns;switch(vi){case"frame":return Cl(lo);case"lost":ns=_i;break;case"restore":ns=pi;break;case"destroy":ns=Ma;break}return ns.push(lo),{cancel:function(){for(var $o=0;$o=0},read:ba,destroy:Zi,_gl:cr,_refresh:Ks,poll:function(){js(),ea&&ea.update()},now:Mi,stats:qr,getCachedCode:Uo,preloadCachedCode:tl});return nr.onDone(null,Il),Il}return Eu})}),l9=Vt((K,V)=>{var u=bp();V.exports=function(r){if(r?typeof r=="string"&&(r={container:r}):r={},E(r)?r={container:r}:A(r)?r={container:r}:t(r)?r={gl:r}:r=u(r,{container:"container target element el canvas holder parent parentNode wrapper use ref root node",gl:"gl context webgl glContext",attrs:"attributes attrs contextAttributes",pixelRatio:"pixelRatio pxRatio px ratio pxratio pixelratio",width:"w width",height:"h height"},!0),r.pixelRatio||(r.pixelRatio=window.pixelRatio||1),r.gl)return r.gl;if(r.canvas&&(r.container=r.canvas.parentNode),r.container){if(typeof r.container=="string"){var i=document.querySelector(r.container);if(!i)throw Error("Element "+r.container+" is not found");r.container=i}E(r.container)?(r.canvas=r.container,r.container=r.canvas.parentNode):r.canvas||(r.canvas=e(),r.container.appendChild(r.canvas),d(r))}else if(!r.canvas)if(typeof document<"u")r.container=document.body||document.documentElement,r.canvas=e(),r.container.appendChild(r.canvas),d(r);else throw Error("Not DOM environment. Use headless-gl.");return r.gl||["webgl","experimental-webgl","webgl-experimental"].some(function(n){try{r.gl=r.canvas.getContext(n,r.attrs)}catch{}return r.gl}),r.gl};function d(r){if(r.container)if(r.container==document.body)document.body.style.width||(r.canvas.width=r.width||r.pixelRatio*window.innerWidth),document.body.style.height||(r.canvas.height=r.height||r.pixelRatio*window.innerHeight);else{var i=r.container.getBoundingClientRect();r.canvas.width=r.width||i.right-i.left,r.canvas.height=r.height||i.bottom-i.top}}function E(r){return typeof r.getContext=="function"&&"width"in r&&"height"in r}function A(r){return typeof r.nodeName=="string"&&typeof r.appendChild=="function"&&typeof r.getBoundingClientRect=="function"}function t(r){return typeof r.drawArrays=="function"||typeof r.drawElements=="function"}function e(){var r=document.createElement("canvas");return r.style.position="absolute",r.style.top=0,r.style.left=0,r}}),u9=Vt((K,V)=>{var u=d5(),d=[32,126];V.exports=E;function E(A){A=A||{};var t=A.shape?A.shape:A.canvas?[A.canvas.width,A.canvas.height]:[512,512],e=A.canvas||document.createElement("canvas"),r=A.font,i=typeof A.step=="number"?[A.step,A.step]:A.step||[32,32],n=A.chars||d;if(r&&typeof r!="string"&&(r=u(r)),!Array.isArray(n))n=String(n).split("");else if(n.length===2&&typeof n[0]=="number"&&typeof n[1]=="number"){for(var o=[],a=n[0],s=0;a<=n[1];a++)o[s++]=String.fromCharCode(a);n=o}t=t.slice(),e.width=t[0],e.height=t[1];var f=e.getContext("2d");f.fillStyle="#000",f.fillRect(0,0,e.width,e.height),f.font=r,f.textAlign="center",f.textBaseline="middle",f.fillStyle="#fff";for(var v=i[0]/2,g=i[1]/2,a=0;at[0]-i[0]/2&&(v=i[0]/2,g+=i[1]);return e}}),m5=Vt(K=>{"use restrict";var V=32;K.INT_BITS=V,K.INT_MAX=2147483647,K.INT_MIN=-1<0)-(E<0)},K.abs=function(E){var A=E>>V-1;return(E^A)-A},K.min=function(E,A){return A^(E^A)&-(E65535)<<4,E>>>=A,t=(E>255)<<3,E>>>=t,A|=t,t=(E>15)<<2,E>>>=t,A|=t,t=(E>3)<<1,E>>>=t,A|=t,A|E>>1},K.log10=function(E){return E>=1e9?9:E>=1e8?8:E>=1e7?7:E>=1e6?6:E>=1e5?5:E>=1e4?4:E>=1e3?3:E>=100?2:E>=10?1:0},K.popCount=function(E){return E=E-(E>>>1&1431655765),E=(E&858993459)+(E>>>2&858993459),(E+(E>>>4)&252645135)*16843009>>>24};function u(E){var A=32;return E&=-E,E&&A--,E&65535&&(A-=16),E&16711935&&(A-=8),E&252645135&&(A-=4),E&858993459&&(A-=2),E&1431655765&&(A-=1),A}K.countTrailingZeros=u,K.nextPow2=function(E){return E+=E===0,--E,E|=E>>>1,E|=E>>>2,E|=E>>>4,E|=E>>>8,E|=E>>>16,E+1},K.prevPow2=function(E){return E|=E>>>1,E|=E>>>2,E|=E>>>4,E|=E>>>8,E|=E>>>16,E-(E>>>1)},K.parity=function(E){return E^=E>>>16,E^=E>>>8,E^=E>>>4,E&=15,27030>>>E&1};var d=new Array(256);(function(E){for(var A=0;A<256;++A){var t=A,e=A,r=7;for(t>>>=1;t;t>>>=1)e<<=1,e|=t&1,--r;E[A]=e<>>8&255]<<16|d[E>>>16&255]<<8|d[E>>>24&255]},K.interleave2=function(E,A){return E&=65535,E=(E|E<<8)&16711935,E=(E|E<<4)&252645135,E=(E|E<<2)&858993459,E=(E|E<<1)&1431655765,A&=65535,A=(A|A<<8)&16711935,A=(A|A<<4)&252645135,A=(A|A<<2)&858993459,A=(A|A<<1)&1431655765,E|A<<1},K.deinterleave2=function(E,A){return E=E>>>A&1431655765,E=(E|E>>>1)&858993459,E=(E|E>>>2)&252645135,E=(E|E>>>4)&16711935,E=(E|E>>>16)&65535,E<<16>>16},K.interleave3=function(E,A,t){return E&=1023,E=(E|E<<16)&4278190335,E=(E|E<<8)&251719695,E=(E|E<<4)&3272356035,E=(E|E<<2)&1227133513,A&=1023,A=(A|A<<16)&4278190335,A=(A|A<<8)&251719695,A=(A|A<<4)&3272356035,A=(A|A<<2)&1227133513,E|=A<<1,t&=1023,t=(t|t<<16)&4278190335,t=(t|t<<8)&251719695,t=(t|t<<4)&3272356035,t=(t|t<<2)&1227133513,E|t<<2},K.deinterleave3=function(E,A){return E=E>>>A&1227133513,E=(E|E>>>2)&3272356035,E=(E|E>>>4)&251719695,E=(E|E>>>8)&4278190335,E=(E|E>>>16)&1023,E<<22>>22},K.nextCombination=function(E){var A=E|E-1;return A+1|(~A&-~A)-1>>>u(E)+1}}),c9=Vt((K,V)=>{function u(A,t,e){var r=A[e]|0;if(r<=0)return[];var i=new Array(r),n;if(e===A.length-1)for(n=0;n"u"&&(t=0),typeof A){case"number":if(A>0)return d(A|0,t);break;case"object":if(typeof A.length=="number")return u(A,t,0);break}return[]}V.exports=E}),f9=Vt(K=>{var V=m5(),u=c9(),d=v0().Buffer;window.__TYPEDARRAY_POOL||(window.__TYPEDARRAY_POOL={UINT8:u([32,0]),UINT16:u([32,0]),UINT32:u([32,0]),BIGUINT64:u([32,0]),INT8:u([32,0]),INT16:u([32,0]),INT32:u([32,0]),BIGINT64:u([32,0]),FLOAT:u([32,0]),DOUBLE:u([32,0]),DATA:u([32,0]),UINT8C:u([32,0]),BUFFER:u([32,0])});var E=typeof Uint8ClampedArray<"u",A=typeof BigUint64Array<"u",t=typeof BigInt64Array<"u",e=window.__TYPEDARRAY_POOL;e.UINT8C||(e.UINT8C=u([32,0])),e.BIGUINT64||(e.BIGUINT64=u([32,0])),e.BIGINT64||(e.BIGINT64=u([32,0])),e.BUFFER||(e.BUFFER=u([32,0]));var r=e.DATA,i=e.BUFFER;K.free=function(c){if(d.isBuffer(c))i[V.log2(c.length)].push(c);else{if(Object.prototype.toString.call(c)!=="[object ArrayBuffer]"&&(c=c.buffer),!c)return;var h=c.length||c.byteLength,b=V.log2(h)|0;r[b].push(c)}};function n(c){if(c){var h=c.length||c.byteLength,b=V.log2(h);r[b].push(c)}}function o(c){n(c.buffer)}K.freeUint8=K.freeUint16=K.freeUint32=K.freeBigUint64=K.freeInt8=K.freeInt16=K.freeInt32=K.freeBigInt64=K.freeFloat32=K.freeFloat=K.freeFloat64=K.freeDouble=K.freeUint8Clamped=K.freeDataView=o,K.freeArrayBuffer=n,K.freeBuffer=function(c){i[V.log2(c.length)].push(c)},K.malloc=function(c,h){if(h===void 0||h==="arraybuffer")return a(c);switch(h){case"uint8":return s(c);case"uint16":return f(c);case"uint32":return v(c);case"int8":return g(c);case"int16":return m(c);case"int32":return w(c);case"float":case"float32":return l(c);case"double":case"float64":return x(c);case"uint8_clamped":return y(c);case"bigint64":return k(c);case"biguint64":return S(c);case"buffer":return T(c);case"data":case"dataview":return M(c);default:return null}return null};function a(h){var h=V.nextPow2(h),b=V.log2(h),_=r[b];return _.length>0?_.pop():new ArrayBuffer(h)}K.mallocArrayBuffer=a;function s(c){return new Uint8Array(a(c),0,c)}K.mallocUint8=s;function f(c){return new Uint16Array(a(2*c),0,c)}K.mallocUint16=f;function v(c){return new Uint32Array(a(4*c),0,c)}K.mallocUint32=v;function g(c){return new Int8Array(a(c),0,c)}K.mallocInt8=g;function m(c){return new Int16Array(a(2*c),0,c)}K.mallocInt16=m;function w(c){return new Int32Array(a(4*c),0,c)}K.mallocInt32=w;function l(c){return new Float32Array(a(4*c),0,c)}K.mallocFloat32=K.mallocFloat=l;function x(c){return new Float64Array(a(8*c),0,c)}K.mallocFloat64=K.mallocDouble=x;function y(c){return E?new Uint8ClampedArray(a(c),0,c):s(c)}K.mallocUint8Clamped=y;function S(c){return A?new BigUint64Array(a(8*c),0,c):null}K.mallocBigUint64=S;function k(c){return t?new BigInt64Array(a(8*c),0,c):null}K.mallocBigInt64=k;function M(c){return new DataView(a(c),0,c)}K.mallocDataView=M;function T(c){c=V.nextPow2(c);var h=V.log2(c),b=i[h];return b.length>0?b.pop():new d(c)}K.mallocBuffer=T,K.clearCache=function(){for(var c=0;c<32;++c)e.UINT8[c].length=0,e.UINT16[c].length=0,e.UINT32[c].length=0,e.INT8[c].length=0,e.INT16[c].length=0,e.INT32[c].length=0,e.FLOAT[c].length=0,e.DOUBLE[c].length=0,e.BIGUINT64[c].length=0,e.BIGINT64[c].length=0,e.UINT8C[c].length=0,r[c].length=0,i[c].length=0}}),h9=Vt((K,V)=>{var u=Object.prototype.toString;V.exports=function(d){var E;return u.call(d)==="[object Object]"&&(E=Object.getPrototypeOf(d),E===null||E===Object.getPrototypeOf({}))}}),g5=Vt((K,V)=>{V.exports=function(u,d){d||(d=[0,""]),u=String(u);var E=parseFloat(u,10);return d[0]=E,d[1]=u.match(/[\d.\-\+]*\s*(.*)/)[1]||"",d}}),p9=Vt((K,V)=>{var u=g5();V.exports=t;var d=96;function E(e,r){var i=u(getComputedStyle(e).getPropertyValue(r));return i[0]*t(i[1],e)}function A(e,r){var i=document.createElement("div");i.style["font-size"]="128"+e,r.appendChild(i);var n=E(i,"font-size")/128;return r.removeChild(i),n}function t(e,r){switch(r=r||document.body,e=(e||"px").trim().toLowerCase(),(r===window||r===document)&&(r=document.body),e){case"%":return r.clientHeight/100;case"ch":case"ex":return A(e,r);case"em":return E(r,"font-size");case"rem":return E(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return d;case"cm":return d/2.54;case"mm":return d/25.4;case"pt":return d/72;case"pc":return d/6}return 1}}),d9=Vt((K,V)=>{V.exports=A;var u=A.canvas=document.createElement("canvas"),d=u.getContext("2d"),E=t([32,126]);A.createPairs=t,A.ascii=E;function A(e,r){Array.isArray(e)&&(e=e.join(", "));var i={},n,o=16,a=.05;r&&(r.length===2&&typeof r[0]=="number"?n=t(r):Array.isArray(r)?n=r:(r.o?n=t(r.o):r.pairs&&(n=r.pairs),r.fontSize&&(o=r.fontSize),r.threshold!=null&&(a=r.threshold))),n||(n=E),d.font=o+"px "+e;for(var s=0;so*a){var m=(g-v)/o;i[f]=m*1e3}}return i}function t(e){for(var r=[],i=e[0];i<=e[1];i++)for(var n=String.fromCharCode(i),o=e[0];o{V.exports=u,u.canvas=document.createElement("canvas"),u.cache={};function u(a,e){e||(e={}),(typeof a=="string"||Array.isArray(a))&&(e.family=a);var r=Array.isArray(e.family)?e.family.join(", "):e.family;if(!r)throw Error("`family` must be defined");var i=e.size||e.fontSize||e.em||48,n=e.weight||e.fontWeight||"",o=e.style||e.fontStyle||"",a=[o,n,i].join(" ")+"px "+r,s=e.origin||"top";if(u.cache[r]&&i<=u.cache[r].em)return d(u.cache[r],s);var f=e.canvas||u.canvas,v=f.getContext("2d"),g={upper:e.upper!==void 0?e.upper:"H",lower:e.lower!==void 0?e.lower:"x",descent:e.descent!==void 0?e.descent:"p",ascent:e.ascent!==void 0?e.ascent:"h",tittle:e.tittle!==void 0?e.tittle:"i",overshoot:e.overshoot!==void 0?e.overshoot:"O"},m=Math.ceil(i*1.5);f.height=m,f.width=m*.5,v.font=a;var w="H",l={top:0};v.clearRect(0,0,m,m),v.textBaseline="top",v.fillStyle="black",v.fillText(w,0,0);var x=E(v.getImageData(0,0,m,m));v.clearRect(0,0,m,m),v.textBaseline="bottom",v.fillText(w,0,m);var y=E(v.getImageData(0,0,m,m));l.lineHeight=l.bottom=m-y+x,v.clearRect(0,0,m,m),v.textBaseline="alphabetic",v.fillText(w,0,m);var S=E(v.getImageData(0,0,m,m)),k=m-S-1+x;l.baseline=l.alphabetic=k,v.clearRect(0,0,m,m),v.textBaseline="middle",v.fillText(w,0,m*.5);var M=E(v.getImageData(0,0,m,m));l.median=l.middle=m-M-1+x-m*.5,v.clearRect(0,0,m,m),v.textBaseline="hanging",v.fillText(w,0,m*.5);var T=E(v.getImageData(0,0,m,m));l.hanging=m-T-1+x-m*.5,v.clearRect(0,0,m,m),v.textBaseline="ideographic",v.fillText(w,0,m);var c=E(v.getImageData(0,0,m,m));if(l.ideographic=m-c-1+x,g.upper&&(v.clearRect(0,0,m,m),v.textBaseline="top",v.fillText(g.upper,0,0),l.upper=E(v.getImageData(0,0,m,m)),l.capHeight=l.baseline-l.upper),g.lower&&(v.clearRect(0,0,m,m),v.textBaseline="top",v.fillText(g.lower,0,0),l.lower=E(v.getImageData(0,0,m,m)),l.xHeight=l.baseline-l.lower),g.tittle&&(v.clearRect(0,0,m,m),v.textBaseline="top",v.fillText(g.tittle,0,0),l.tittle=E(v.getImageData(0,0,m,m))),g.ascent&&(v.clearRect(0,0,m,m),v.textBaseline="top",v.fillText(g.ascent,0,0),l.ascent=E(v.getImageData(0,0,m,m))),g.descent&&(v.clearRect(0,0,m,m),v.textBaseline="top",v.fillText(g.descent,0,0),l.descent=A(v.getImageData(0,0,m,m))),g.overshoot){v.clearRect(0,0,m,m),v.textBaseline="top",v.fillText(g.overshoot,0,0);var h=A(v.getImageData(0,0,m,m));l.overshoot=h-k}for(var b in l)l[b]/=i;return l.em=i,u.cache[r]=l,d(l,s)}function d(t,e){var r={};typeof e=="string"&&(e=t[e]);for(var i in t)i!=="em"&&(r[i]=t[i]-e);return r}function E(t){for(var e=t.height,r=t.data,i=3;i0;i-=4)if(r[i]!==0)return Math.floor((i-3)*.25/e)}}),g9=Vt((K,V)=>{var u=o9(),d=bp(),E=s9(),A=l9(),t=o5(),e=Nd(),r=u9(),i=f9(),n=Xm(),o=h9(),a=g5(),s=p9(),f=d9(),v=of(),g=m9(),m=I0(),w=m5(),l=w.nextPow2,x=new t,y=!1;document.body&&(S=document.body.appendChild(document.createElement("div")),S.style.font="italic small-caps bold condensed 16px/2 cursive",getComputedStyle(S).fontStretch&&(y=!0),document.body.removeChild(S));var S,k=function(T){M(T)?(T={regl:T},this.gl=T.regl._gl):this.gl=A(T),this.shader=x.get(this.gl),this.shader?this.regl=this.shader.regl:this.regl=T.regl||E({gl:this.gl}),this.charBuffer=this.regl.buffer({type:"uint8",usage:"stream"}),this.sizeBuffer=this.regl.buffer({type:"float",usage:"stream"}),this.shader||(this.shader=this.createShader(),x.set(this.gl,this.shader)),this.batch=[],this.fontSize=[],this.font=[],this.fontAtlas=[],this.draw=this.shader.draw.bind(this),this.render=function(){this.regl._refresh(),this.draw(this.batch)},this.canvas=this.gl.canvas,this.update(o(T)?T:{})};k.prototype.createShader=function(){var T=this.regl,c=T({blend:{enable:!0,color:[0,0,0,1],func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},stencil:{enable:!1},depth:{enable:!1},count:T.prop("count"),offset:T.prop("offset"),attributes:{charOffset:{offset:4,stride:8,buffer:T.this("sizeBuffer")},width:{offset:0,stride:8,buffer:T.this("sizeBuffer")},char:T.this("charBuffer"),position:T.this("position")},uniforms:{atlasSize:function(b,_){return[_.atlas.width,_.atlas.height]},atlasDim:function(b,_){return[_.atlas.cols,_.atlas.rows]},atlas:function(b,_){return _.atlas.texture},charStep:function(b,_){return _.atlas.step},em:function(b,_){return _.atlas.em},color:T.prop("color"),opacity:T.prop("opacity"),viewport:T.this("viewportArray"),scale:T.this("scale"),align:T.prop("align"),baseline:T.prop("baseline"),translate:T.this("translate"),positionOffset:T.prop("positionOffset")},primitive:"points",viewport:T.this("viewport"),vert:` + precision highp float; + attribute float width, charOffset, char; + attribute vec2 position; + uniform float fontSize, charStep, em, align, baseline; + uniform vec4 viewport; + uniform vec4 color; + uniform vec2 atlasSize, atlasDim, scale, translate, positionOffset; + varying vec2 charCoord, charId; + varying float charWidth; + varying vec4 fontColor; + void main () { + vec2 offset = floor(em * (vec2(align + charOffset, baseline) + + vec2(positionOffset.x, -positionOffset.y))) + / (viewport.zw * scale.xy); + + vec2 position = (position + translate) * scale; + position += offset * scale; + + charCoord = position * viewport.zw + viewport.xy; + + gl_Position = vec4(position * 2. - 1., 0, 1); + + gl_PointSize = charStep; + + charId.x = mod(char, atlasDim.x); + charId.y = floor(char / atlasDim.x); + + charWidth = width * em; + + fontColor = color / 255.; + }`,frag:` + precision highp float; + uniform float fontSize, charStep, opacity; + uniform vec2 atlasSize; + uniform vec4 viewport; + uniform sampler2D atlas; + varying vec4 fontColor; + varying vec2 charCoord, charId; + varying float charWidth; + + float lightness(vec4 color) { + return color.r * 0.299 + color.g * 0.587 + color.b * 0.114; + } + + void main () { + vec2 uv = gl_FragCoord.xy - charCoord + charStep * .5; + float halfCharStep = floor(charStep * .5 + .5); + + // invert y and shift by 1px (FF expecially needs that) + uv.y = charStep - uv.y; + + // ignore points outside of character bounding box + float halfCharWidth = ceil(charWidth * .5); + if (floor(uv.x) > halfCharStep + halfCharWidth || + floor(uv.x) < halfCharStep - halfCharWidth) return; + + uv += charId * charStep; + uv = uv / atlasSize; + + vec4 color = fontColor; + vec4 mask = texture2D(atlas, uv); + + float maskY = lightness(mask); + // float colorY = lightness(color); + color.a *= maskY; + color.a *= opacity; + + // color.a += .1; + + // antialiasing, see yiq color space y-channel formula + // color.rgb += (1. - color.rgb) * (1. - mask.rgb); + + gl_FragColor = color; + }`}),h={};return{regl:T,draw:c,atlas:h}},k.prototype.update=function(T){var c=this;if(typeof T=="string")T={text:T};else if(!T)return;T=d(T,{position:"position positions coord coords coordinates",font:"font fontFace fontface typeface cssFont css-font family fontFamily",fontSize:"fontSize fontsize size font-size",text:"text texts chars characters value values symbols",align:"align alignment textAlign textbaseline",baseline:"baseline textBaseline textbaseline",direction:"dir direction textDirection",color:"color colour fill fill-color fillColor textColor textcolor",kerning:"kerning kern",range:"range dataBox",viewport:"vp viewport viewBox viewbox viewPort",opacity:"opacity alpha transparency visible visibility opaque",offset:"offset positionOffset padding shift indent indentation"},!0),T.opacity!=null&&(Array.isArray(T.opacity)?this.opacity=T.opacity.map(function(bt){return parseFloat(bt)}):this.opacity=parseFloat(T.opacity)),T.viewport!=null&&(this.viewport=n(T.viewport),this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),this.viewport==null&&(this.viewport={x:0,y:0,width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight},this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),T.kerning!=null&&(this.kerning=T.kerning),T.offset!=null&&(typeof T.offset=="number"&&(T.offset=[T.offset,0]),this.positionOffset=m(T.offset)),T.direction&&(this.direction=T.direction),T.range&&(this.range=T.range,this.scale=[1/(T.range[2]-T.range[0]),1/(T.range[3]-T.range[1])],this.translate=[-T.range[0],-T.range[1]]),T.scale&&(this.scale=T.scale),T.translate&&(this.translate=T.translate),this.scale||(this.scale=[1/this.viewport.width,1/this.viewport.height]),this.translate||(this.translate=[0,0]),!this.font.length&&!T.font&&(T.font=k.baseFontSize+"px sans-serif");var h=!1,b=!1;if(T.font&&(Array.isArray(T.font)?T.font:[T.font]).forEach(function(bt,vt){if(typeof bt=="string")try{bt=u.parse(bt)}catch{bt=u.parse(k.baseFontSize+"px "+bt)}else{var Ut=bt.style,re=bt.weight,Kt=bt.stretch,ue=bt.variant;bt=u.parse(u.stringify(bt)),Ut&&(bt.style=Ut),re&&(bt.weight=re),Kt&&(bt.stretch=Kt),ue&&(bt.variant=ue)}var Me=u.stringify({size:k.baseFontSize,family:bt.family,stretch:y?bt.stretch:void 0,variant:bt.variant,weight:bt.weight,style:bt.style}),Ce=a(bt.size),We=Math.round(Ce[0]*s(Ce[1]));if(We!==c.fontSize[vt]&&(b=!0,c.fontSize[vt]=We),(!c.font[vt]||Me!=c.font[vt].baseString)&&(h=!0,c.font[vt]=k.fonts[Me],!c.font[vt])){var qe=bt.family.join(", "),vr=[bt.style];bt.style!=bt.variant&&vr.push(bt.variant),bt.variant!=bt.weight&&vr.push(bt.weight),y&&bt.weight!=bt.stretch&&vr.push(bt.stretch),c.font[vt]={baseString:Me,family:qe,weight:bt.weight,stretch:bt.stretch,style:bt.style,variant:bt.variant,width:{},kerning:{},metrics:g(qe,{origin:"top",fontSize:k.baseFontSize,fontStyle:vr.join(" ")})},k.fonts[Me]=c.font[vt]}}),(h||b)&&this.font.forEach(function(bt,vt){var Ut=u.stringify({size:c.fontSize[vt],family:bt.family,stretch:y?bt.stretch:void 0,variant:bt.variant,weight:bt.weight,style:bt.style});if(c.fontAtlas[vt]=c.shader.atlas[Ut],!c.fontAtlas[vt]){var re=bt.metrics;c.shader.atlas[Ut]=c.fontAtlas[vt]={fontString:Ut,step:Math.ceil(c.fontSize[vt]*re.bottom*.5)*2,em:c.fontSize[vt],cols:0,rows:0,height:0,width:0,chars:[],ids:{},texture:c.regl.texture()}}T.text==null&&(T.text=c.text)}),typeof T.text=="string"&&T.position&&T.position.length>2){for(var _=Array(T.position.length*.5),P=0;P<_.length;P++)_[P]=T.text;T.text=_}var z;if(T.text!=null||h){if(this.textOffsets=[0],Array.isArray(T.text)){this.count=T.text[0].length,this.counts=[this.count];for(var D=1;D2){for(var B=!T.position[0].length,R=i.mallocFloat(this.count*2),I=0,F=0;I1?c.align[vt]:c.align[0]:c.align;if(typeof Ut=="number")return Ut;switch(Ut){case"right":case"end":return-bt;case"center":case"centre":case"middle":return-bt*.5}return 0})),this.baseline==null&&T.baseline==null&&(T.baseline=0),T.baseline!=null&&(this.baseline=T.baseline,Array.isArray(this.baseline)||(this.baseline=[this.baseline]),this.baselineOffset=this.baseline.map(function(bt,vt){var Ut=(c.font[vt]||c.font[0]).metrics,re=0;return re+=Ut.bottom*.5,typeof bt=="number"?re+=bt-Ut.baseline:re+=-Ut[bt],re*=-1,re})),T.color!=null)if(T.color||(T.color="transparent"),typeof T.color=="string"||!isNaN(T.color))this.color=e(T.color,"uint8");else{var wt;if(typeof T.color[0]=="number"&&T.color.length>this.counts.length){var Ct=T.color.length;wt=i.mallocUint8(Ct);for(var It=(T.color.subarray||T.color.slice).bind(T.color),Nt=0;Nt4||this.baselineOffset.length>1||this.align&&this.align.length>1||this.fontAtlas.length>1||this.positionOffset.length>2;if(ee){var Zt=Math.max(this.position.length*.5||0,this.color.length*.25||0,this.baselineOffset.length||0,this.alignOffset.length||0,this.font.length||0,this.opacity.length||0,this.positionOffset.length*.5||0);this.batch=Array(Zt);for(var mt=0;mt1?this.counts[mt]:this.counts[0],offset:this.textOffsets.length>1?this.textOffsets[mt]:this.textOffsets[0],color:this.color?this.color.length<=4?this.color:this.color.subarray(mt*4,mt*4+4):[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[mt]:this.opacity,baseline:this.baselineOffset[mt]!=null?this.baselineOffset[mt]:this.baselineOffset[0],align:this.align?this.alignOffset[mt]!=null?this.alignOffset[mt]:this.alignOffset[0]:0,atlas:this.fontAtlas[mt]||this.fontAtlas[0],positionOffset:this.positionOffset.length>2?this.positionOffset.subarray(mt*2,mt*2+2):this.positionOffset}}else this.count?this.batch=[{count:this.count,offset:0,color:this.color||[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[0]:this.opacity,baseline:this.baselineOffset[0],align:this.alignOffset?this.alignOffset[0]:0,atlas:this.fontAtlas[0],positionOffset:this.positionOffset}]:this.batch=[]}},k.prototype.destroy=function(){},k.prototype.kerning=!0,k.prototype.position={constant:new Float32Array(2)},k.prototype.translate=null,k.prototype.scale=null,k.prototype.font=null,k.prototype.text="",k.prototype.positionOffset=[0,0],k.prototype.opacity=1,k.prototype.color=new Uint8Array([0,0,0,255]),k.prototype.alignOffset=[0,0],k.maxAtlasSize=1024,k.atlasCanvas=document.createElement("canvas"),k.atlasContext=k.atlasCanvas.getContext("2d",{alpha:!1}),k.baseFontSize=64,k.fonts={};function M(T){return typeof T=="function"&&T._gl&&T.prop&&T.texture&&T.buffer}V.exports=k}),v9=Vt((K,V)=>{(function(u,d){typeof K=="object"&&typeof V<"u"?V.exports=d():u.createREGL=d()})(K,function(){var u=function(ie,nr){for(var cr=Object.keys(nr),sn=0;sn1&&nr===cr&&(nr==='"'||nr==="'"))return['"'+r(ie.substr(1,ie.length-2))+'"'];var sn=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(ie);if(sn)return i(ie.substr(0,sn.index)).concat(i(sn[1])).concat(i(ie.substr(sn.index+sn[0].length)));var zn=ie.split(".");if(zn.length===1)return['"'+r(ie)+'"'];for(var Tn=[],qr=0;qr"u"?1:window.devicePixelRatio,ka=!1,Ka={},Va=function(Nr){},fa=function(){};if(typeof nr=="string"?cr=document.querySelector(nr):typeof nr=="object"&&(x(nr)?cr=nr:y(nr)?(Tn=nr,zn=Tn.canvas):("gl"in nr?Tn=nr.gl:"canvas"in nr?zn=k(nr.canvas):"container"in nr&&(sn=k(nr.container)),"attributes"in nr&&(qr=nr.attributes),"extensions"in nr&&(Sn=S(nr.extensions)),"optionalExtensions"in nr&&(sa=S(nr.optionalExtensions)),"onDone"in nr&&(Va=nr.onDone),"profile"in nr&&(ka=!!nr.profile),"pixelRatio"in nr&&(ea=+nr.pixelRatio),"cachedCode"in nr&&(Ka=nr.cachedCode))),cr&&(cr.nodeName.toLowerCase()==="canvas"?zn=cr:sn=cr),!Tn){if(!zn){var Un=w(sn||document.body,Va,ea);if(!Un)return null;zn=Un.canvas,fa=Un.onDestroy}qr.premultipliedAlpha===void 0&&(qr.premultipliedAlpha=!0),Tn=l(zn,qr)}return Tn?{gl:Tn,canvas:zn,container:sn,extensions:Sn,optionalExtensions:sa,pixelRatio:ea,profile:ka,cachedCode:Ka,onDone:Va,onDestroy:fa}:(fa(),Va("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function T(ie,nr){var cr={};function sn(qr){var Sn=qr.toLowerCase(),sa;try{sa=cr[Sn]=ie.getExtension(Sn)}catch{}return!!sa}for(var zn=0;zn65535)<<4,ie>>>=nr,cr=(ie>255)<<3,ie>>>=cr,nr|=cr,cr=(ie>15)<<2,ie>>>=cr,nr|=cr,cr=(ie>3)<<1,ie>>>=cr,nr|=cr,nr|ie>>1}function F(){var ie=c(8,function(){return[]});function nr(Tn){var qr=R(Tn),Sn=ie[I(qr)>>2];return Sn.length>0?Sn.pop():new ArrayBuffer(qr)}function cr(Tn){ie[I(Tn.byteLength)>>2].push(Tn)}function sn(Tn,qr){var Sn=null;switch(Tn){case h:Sn=new Int8Array(nr(qr),0,qr);break;case b:Sn=new Uint8Array(nr(qr),0,qr);break;case _:Sn=new Int16Array(nr(2*qr),0,qr);break;case P:Sn=new Uint16Array(nr(2*qr),0,qr);break;case z:Sn=new Int32Array(nr(4*qr),0,qr);break;case D:Sn=new Uint32Array(nr(4*qr),0,qr);break;case B:Sn=new Float32Array(nr(4*qr),0,qr);break;default:return null}return Sn.length!==qr?Sn.subarray(0,qr):Sn}function zn(Tn){cr(Tn.buffer)}return{alloc:nr,free:cr,allocType:sn,freeType:zn}}var j=F();j.zero=F();var N=3408,G=3410,rt=3411,ct=3412,st=3413,et=3414,Z=3415,ot=33901,X=33902,Q=3379,ut=3386,J=34921,q=36347,it=36348,nt=35661,dt=35660,Tt=34930,wt=36349,Ct=34076,It=34024,Nt=7936,te=7937,Jt=7938,ee=35724,Zt=34047,mt=36063,bt=34852,vt=3553,Ut=34067,re=34069,Kt=33984,ue=6408,Me=5126,Ce=5121,We=36160,qe=36053,vr=36064,_r=16384,er=function(ie,nr){var cr=1;nr.ext_texture_filter_anisotropic&&(cr=ie.getParameter(Zt));var sn=1,zn=1;nr.webgl_draw_buffers&&(sn=ie.getParameter(bt),zn=ie.getParameter(mt));var Tn=!!nr.oes_texture_float;if(Tn){var qr=ie.createTexture();ie.bindTexture(vt,qr),ie.texImage2D(vt,0,ue,1,1,0,ue,Me,null);var Sn=ie.createFramebuffer();if(ie.bindFramebuffer(We,Sn),ie.framebufferTexture2D(We,vr,vt,qr,0),ie.bindTexture(vt,null),ie.checkFramebufferStatus(We)!==qe)Tn=!1;else{ie.viewport(0,0,1,1),ie.clearColor(1,0,0,1),ie.clear(_r);var sa=j.allocType(Me,4);ie.readPixels(0,0,1,1,ue,Me,sa),ie.getError()?Tn=!1:(ie.deleteFramebuffer(Sn),ie.deleteTexture(qr),Tn=sa[0]===1),j.freeType(sa)}}var ea=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),ka=!0;if(!ea){var Ka=ie.createTexture(),Va=j.allocType(Ce,36);ie.activeTexture(Kt),ie.bindTexture(Ut,Ka),ie.texImage2D(re,0,ue,3,3,0,ue,Ce,Va),j.freeType(Va),ie.bindTexture(Ut,null),ie.deleteTexture(Ka),ka=!ie.getError()}return{colorBits:[ie.getParameter(G),ie.getParameter(rt),ie.getParameter(ct),ie.getParameter(st)],depthBits:ie.getParameter(et),stencilBits:ie.getParameter(Z),subpixelBits:ie.getParameter(N),extensions:Object.keys(nr).filter(function(fa){return!!nr[fa]}),maxAnisotropic:cr,maxDrawbuffers:sn,maxColorAttachments:zn,pointSizeDims:ie.getParameter(ot),lineWidthDims:ie.getParameter(X),maxViewportDims:ie.getParameter(ut),maxCombinedTextureUnits:ie.getParameter(nt),maxCubeMapSize:ie.getParameter(Ct),maxRenderbufferSize:ie.getParameter(It),maxTextureUnits:ie.getParameter(Tt),maxTextureSize:ie.getParameter(Q),maxAttributes:ie.getParameter(J),maxVertexUniforms:ie.getParameter(q),maxVertexTextureUnits:ie.getParameter(dt),maxVaryingVectors:ie.getParameter(it),maxFragmentUniforms:ie.getParameter(wt),glsl:ie.getParameter(ee),renderer:ie.getParameter(te),vendor:ie.getParameter(Nt),version:ie.getParameter(Jt),readFloat:Tn,npotTextureCube:ka}},Mr=function(ie){return ie instanceof Uint8Array||ie instanceof Uint16Array||ie instanceof Uint32Array||ie instanceof Int8Array||ie instanceof Int16Array||ie instanceof Int32Array||ie instanceof Float32Array||ie instanceof Float64Array||ie instanceof Uint8ClampedArray};function Ir(ie){return!!ie&&typeof ie=="object"&&Array.isArray(ie.shape)&&Array.isArray(ie.stride)&&typeof ie.offset=="number"&&ie.shape.length===ie.stride.length&&(Array.isArray(ie.data)||Mr(ie.data))}var de=function(ie){return Object.keys(ie).map(function(nr){return ie[nr]})},Dt={shape:Ht,flatten:St};function qt(ie,nr,cr){for(var sn=0;sn0){var qa;if(Array.isArray(fn[0])){ya=gn(fn);for(var Rn=1,An=1;An0){if(typeof Rn[0]=="number"){var aa=j.allocType(kn.dtype,Rn.length);zr(aa,Rn),ya(aa,Pa),j.freeType(aa)}else if(Array.isArray(Rn[0])||Mr(Rn[0])){ba=gn(Rn);var oa=En(Rn,ba,kn.dtype);ya(oa,Pa),j.freeType(oa)}}}else if(Ir(Rn)){ba=Rn.shape;var Sa=Rn.stride,_i=0,pi=0,Ma=0,Na=0;ba.length===1?(_i=ba[0],pi=1,Ma=Sa[0],Na=0):ba.length===2&&(_i=ba[0],pi=ba[1],Ma=Sa[0],Na=Sa[1]);var ui=Array.isArray(Rn.data)?kn.dtype:tr(Rn.data),gi=j.allocType(ui,_i*pi);tn(gi,Rn.data,_i,pi,Ma,Na,Rn.offset),ya(gi,Pa),j.freeType(gi)}return Ia}return Xn||Ia(Nr),Ia._reglType="buffer",Ia._buffer=kn,Ia.subdata=qa,cr.profile&&(Ia.stats=kn.stats),Ia.destroy=function(){Va(kn)},Ia}function Un(){de(Tn).forEach(function(Nr){Nr.buffer=ie.createBuffer(),ie.bindBuffer(Nr.type,Nr.buffer),ie.bufferData(Nr.type,Nr.persistentData||Nr.byteLength,Nr.usage)})}return cr.profile&&(nr.getTotalBufferSize=function(){var Nr=0;return Object.keys(Tn).forEach(function(fn){Nr+=Tn[fn].stats.size}),Nr}),{create:fa,createStream:sa,destroyStream:ea,clear:function(){de(Tn).forEach(Va),Sn.forEach(Va)},getBuffer:function(Nr){return Nr&&Nr._buffer instanceof qr?Nr._buffer:null},restore:Un,_initBuffer:Ka}}var $r=0,In=0,Nn=1,Kn=1,$n=4,ia=4,Cn={points:$r,point:In,lines:Nn,line:Kn,triangles:$n,triangle:ia,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},Fa=0,Ga=1,ve=4,ge=5120,dr=5121,br=5122,Tr=5123,mr=5124,kr=5125,Ur=34963,Or=35040,pe=35044;function Ke(ie,nr,cr,sn){var zn={},Tn=0,qr={uint8:dr,uint16:Tr};nr.oes_element_index_uint&&(qr.uint32=kr);function Sn(Un){this.id=Tn++,zn[this.id]=this,this.buffer=Un,this.primType=ve,this.vertCount=0,this.type=0}Sn.prototype.bind=function(){this.buffer.bind()};var sa=[];function ea(Un){var Nr=sa.pop();return Nr||(Nr=new Sn(cr.create(null,Ur,!0,!1)._buffer)),Ka(Nr,Un,Or,-1,-1,0,0),Nr}function ka(Un){sa.push(Un)}function Ka(Un,Nr,fn,Xn,jn,kn,Ia){Un.buffer.bind();var ya;if(Nr){var qa=Ia;!Ia&&(!Mr(Nr)||Ir(Nr)&&!Mr(Nr.data))&&(qa=nr.oes_element_index_uint?kr:Tr),cr._initBuffer(Un.buffer,Nr,fn,qa,3)}else ie.bufferData(Ur,kn,fn),Un.buffer.dtype=ya||dr,Un.buffer.usage=fn,Un.buffer.dimension=3,Un.buffer.byteLength=kn;if(ya=Ia,!Ia){switch(Un.buffer.dtype){case dr:case ge:ya=dr;break;case Tr:case br:ya=Tr;break;case kr:case mr:ya=kr;break}Un.buffer.dtype=ya}Un.type=ya;var Rn=jn;Rn<0&&(Rn=Un.buffer.byteLength,ya===Tr?Rn>>=1:ya===kr&&(Rn>>=2)),Un.vertCount=Rn;var An=Xn;if(Xn<0){An=ve;var Pa=Un.buffer.dimension;Pa===1&&(An=Fa),Pa===2&&(An=Ga),Pa===3&&(An=ve)}Un.primType=An}function Va(Un){sn.elementsCount--,delete zn[Un.id],Un.buffer.destroy(),Un.buffer=null}function fa(Un,Nr){var fn=cr.create(null,Ur,!0),Xn=new Sn(fn._buffer);sn.elementsCount++;function jn(kn){if(!kn)fn(),Xn.primType=ve,Xn.vertCount=0,Xn.type=dr;else if(typeof kn=="number")fn(kn),Xn.primType=ve,Xn.vertCount=kn|0,Xn.type=dr;else{var Ia=null,ya=pe,qa=-1,Rn=-1,An=0,Pa=0;Array.isArray(kn)||Mr(kn)||Ir(kn)?Ia=kn:("data"in kn&&(Ia=kn.data),"usage"in kn&&(ya=Zn[kn.usage]),"primitive"in kn&&(qa=Cn[kn.primitive]),"count"in kn&&(Rn=kn.count|0),"type"in kn&&(Pa=qr[kn.type]),"length"in kn?An=kn.length|0:(An=Rn,Pa===Tr||Pa===br?An*=2:(Pa===kr||Pa===mr)&&(An*=4))),Ka(Xn,Ia,ya,qa,Rn,An,Pa)}return jn}return jn(Un),jn._reglType="elements",jn._elements=Xn,jn.subdata=function(kn,Ia){return fn.subdata(kn,Ia),jn},jn.destroy=function(){Va(Xn)},jn}return{create:fa,createStream:ea,destroyStream:ka,getElements:function(Un){return typeof Un=="function"&&Un._elements instanceof Sn?Un._elements:null},clear:function(){de(zn).forEach(Va)}}}var xr=new Float32Array(1),Gr=new Uint32Array(xr.buffer),ln=5123;function wn(ie){for(var nr=j.allocType(ln,ie.length),cr=0;cr>>31<<15,Tn=(sn<<1>>>24)-127,qr=sn>>13&1023;if(Tn<-24)nr[cr]=zn;else if(Tn<-14){var Sn=-14-Tn;nr[cr]=zn+(qr+1024>>Sn)}else Tn>15?nr[cr]=zn+31744:nr[cr]=zn+(Tn+15<<10)+qr}return nr}function rn(ie){return Array.isArray(ie)||Mr(ie)}var Qr=34467,vn=3553,Oa=34067,Qn=34069,Qa=6408,Ja=6406,wi=6407,ci=6409,Ti=6410,Ra=32854,Qi=32855,Hi=36194,Ho=32819,Ci=32820,zo=33635,qi=34042,qo=6402,Po=34041,hs=35904,Gi=35906,uo=36193,yi=33776,ao=33777,ts=33778,vs=33779,As=35986,_o=35987,Da=34798,li=35840,wo=35841,Ms=35842,Di=35843,_s=36196,No=5121,is=5123,al=5125,ii=5126,io=10242,co=10243,Is=10497,Wo=33071,Bi=33648,$s=10240,fl=10241,Jo=9728,us=9729,Ss=9984,Ls=9985,xl=9986,bu=9987,au=33170,fu=4352,zc=4353,_c=4354,cs=34046,Gl=3317,Lc=37440,Al=37441,_l=37443,Ml=37444,hu=33984,Fs=[Ss,xl,Ls,bu],bl=[0,ci,Ti,wi,Qa],Fo={};Fo[ci]=Fo[Ja]=Fo[qo]=1,Fo[Po]=Fo[Ti]=2,Fo[wi]=Fo[hs]=3,Fo[Qa]=Fo[Gi]=4;function bs(ie){return"[object "+ie+"]"}var Iu=bs("HTMLCanvasElement"),Nl=bs("OffscreenCanvas"),qu=bs("CanvasRenderingContext2D"),qs=bs("ImageBitmap"),sf=bs("HTMLImageElement"),Oo=bs("HTMLVideoElement"),yf=Object.keys(Yt).concat([Iu,Nl,qu,qs,sf,Oo]),os=[];os[No]=1,os[ii]=4,os[uo]=2,os[is]=2,os[al]=4;var Fi=[];Fi[Ra]=2,Fi[Qi]=2,Fi[Hi]=2,Fi[Po]=4,Fi[yi]=.5,Fi[ao]=.5,Fi[ts]=1,Fi[vs]=1,Fi[As]=.5,Fi[_o]=1,Fi[Da]=1,Fi[li]=.5,Fi[wo]=.25,Fi[Ms]=.5,Fi[Di]=.25,Fi[_s]=.5;function ac(ie){return Array.isArray(ie)&&(ie.length===0||typeof ie[0]=="number")}function pu(ie){if(!Array.isArray(ie))return!1;var nr=ie.length;return!(nr===0||!rn(ie[0]))}function ml(ie){return Object.prototype.toString.call(ie)}function Cc(ie){return ml(ie)===Iu}function Wu(ie){return ml(ie)===Nl}function mc(ie){return ml(ie)===qu}function wl(ie){return ml(ie)===qs}function Xc(ie){return ml(ie)===sf}function Bc(ie){return ml(ie)===Oo}function gc(ie){if(!ie)return!1;var nr=ml(ie);return yf.indexOf(nr)>=0?!0:ac(ie)||pu(ie)||Ir(ie)}function Gu(ie){return Yt[Object.prototype.toString.call(ie)]|0}function Ic(ie,nr){var cr=nr.length;switch(ie.type){case No:case is:case al:case ii:var sn=j.allocType(ie.type,cr);sn.set(nr),ie.data=sn;break;case uo:ie.data=wn(nr);break}}function Pc(ie,nr){return j.allocType(ie.type===uo?ii:ie.type,nr)}function du(ie,nr){ie.type===uo?(ie.data=wn(nr),j.freeType(nr)):ie.data=nr}function Rc(ie,nr,cr,sn,zn,Tn){for(var qr=ie.width,Sn=ie.height,sa=ie.channels,ea=qr*Sn*sa,ka=Pc(ie,ea),Ka=0,Va=0;Va=1;)Sn+=qr*sa*sa,sa/=2;return Sn}else return qr*cr*sn}function wu(ie,nr,cr,sn,zn,Tn,qr){var Sn={"don't care":fu,"dont care":fu,nice:_c,fast:zc},sa={repeat:Is,clamp:Wo,mirror:Bi},ea={nearest:Jo,linear:us},ka=u({mipmap:bu,"nearest mipmap nearest":Ss,"linear mipmap nearest":Ls,"nearest mipmap linear":xl,"linear mipmap linear":bu},ea),Ka={none:0,browser:Ml},Va={uint8:No,rgba4:Ho,rgb565:zo,"rgb5 a1":Ci},fa={alpha:Ja,luminance:ci,"luminance alpha":Ti,rgb:wi,rgba:Qa,rgba4:Ra,"rgb5 a1":Qi,rgb565:Hi},Un={};nr.ext_srgb&&(fa.srgb=hs,fa.srgba=Gi),nr.oes_texture_float&&(Va.float32=Va.float=ii),nr.oes_texture_half_float&&(Va.float16=Va["half float"]=uo),nr.webgl_depth_texture&&(u(fa,{depth:qo,"depth stencil":Po}),u(Va,{uint16:is,uint32:al,"depth stencil":qi})),nr.webgl_compressed_texture_s3tc&&u(Un,{"rgb s3tc dxt1":yi,"rgba s3tc dxt1":ao,"rgba s3tc dxt3":ts,"rgba s3tc dxt5":vs}),nr.webgl_compressed_texture_atc&&u(Un,{"rgb atc":As,"rgba atc explicit alpha":_o,"rgba atc interpolated alpha":Da}),nr.webgl_compressed_texture_pvrtc&&u(Un,{"rgb pvrtc 4bppv1":li,"rgb pvrtc 2bppv1":wo,"rgba pvrtc 4bppv1":Ms,"rgba pvrtc 2bppv1":Di}),nr.webgl_compressed_texture_etc1&&(Un["rgb etc1"]=_s);var Nr=Array.prototype.slice.call(ie.getParameter(Qr));Object.keys(Un).forEach(function(U){var tt=Un[U];Nr.indexOf(tt)>=0&&(fa[U]=tt)});var fn=Object.keys(fa);cr.textureFormats=fn;var Xn=[];Object.keys(fa).forEach(function(U){var tt=fa[U];Xn[tt]=U});var jn=[];Object.keys(Va).forEach(function(U){var tt=Va[U];jn[tt]=U});var kn=[];Object.keys(ea).forEach(function(U){var tt=ea[U];kn[tt]=U});var Ia=[];Object.keys(ka).forEach(function(U){var tt=ka[U];Ia[tt]=U});var ya=[];Object.keys(sa).forEach(function(U){var tt=sa[U];ya[tt]=U});var qa=fn.reduce(function(U,tt){var Y=fa[tt];return Y===ci||Y===Ja||Y===ci||Y===Ti||Y===qo||Y===Po||nr.ext_srgb&&(Y===hs||Y===Gi)?U[Y]=Y:Y===Qi||tt.indexOf("rgba")>=0?U[Y]=Qa:U[Y]=wi,U},{});function Rn(){this.internalformat=Qa,this.format=Qa,this.type=No,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=Ml,this.width=0,this.height=0,this.channels=0}function An(U,tt){U.internalformat=tt.internalformat,U.format=tt.format,U.type=tt.type,U.compressed=tt.compressed,U.premultiplyAlpha=tt.premultiplyAlpha,U.flipY=tt.flipY,U.unpackAlignment=tt.unpackAlignment,U.colorSpace=tt.colorSpace,U.width=tt.width,U.height=tt.height,U.channels=tt.channels}function Pa(U,tt){if(!(typeof tt!="object"||!tt)){if("premultiplyAlpha"in tt&&(U.premultiplyAlpha=tt.premultiplyAlpha),"flipY"in tt&&(U.flipY=tt.flipY),"alignment"in tt&&(U.unpackAlignment=tt.alignment),"colorSpace"in tt&&(U.colorSpace=Ka[tt.colorSpace]),"type"in tt){var Y=tt.type;U.type=Va[Y]}var ft=U.width,zt=U.height,Qt=U.channels,ne=!1;"shape"in tt?(ft=tt.shape[0],zt=tt.shape[1],tt.shape.length===3&&(Qt=tt.shape[2],ne=!0)):("radius"in tt&&(ft=zt=tt.radius),"width"in tt&&(ft=tt.width),"height"in tt&&(zt=tt.height),"channels"in tt&&(Qt=tt.channels,ne=!0)),U.width=ft|0,U.height=zt|0,U.channels=Qt|0;var Ft=!1;if("format"in tt){var $t=tt.format,he=U.internalformat=fa[$t];U.format=qa[he],$t in Va&&("type"in tt||(U.type=Va[$t])),$t in Un&&(U.compressed=!0),Ft=!0}!ne&&Ft?U.channels=Fo[U.format]:ne&&!Ft&&U.channels!==bl[U.format]&&(U.format=U.internalformat=bl[U.channels])}}function ba(U){ie.pixelStorei(Lc,U.flipY),ie.pixelStorei(Al,U.premultiplyAlpha),ie.pixelStorei(_l,U.colorSpace),ie.pixelStorei(Gl,U.unpackAlignment)}function aa(){Rn.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function oa(U,tt){var Y=null;if(gc(tt)?Y=tt:tt&&(Pa(U,tt),"x"in tt&&(U.xOffset=tt.x|0),"y"in tt&&(U.yOffset=tt.y|0),gc(tt.data)&&(Y=tt.data)),tt.copy){var ft=zn.viewportWidth,zt=zn.viewportHeight;U.width=U.width||ft-U.xOffset,U.height=U.height||zt-U.yOffset,U.needsCopy=!0}else if(!Y)U.width=U.width||1,U.height=U.height||1,U.channels=U.channels||4;else if(Mr(Y))U.channels=U.channels||4,U.data=Y,!("type"in tt)&&U.type===No&&(U.type=Gu(Y));else if(ac(Y))U.channels=U.channels||4,Ic(U,Y),U.alignment=1,U.needsFree=!0;else if(Ir(Y)){var Qt=Y.data;!Array.isArray(Qt)&&U.type===No&&(U.type=Gu(Qt));var ne=Y.shape,Ft=Y.stride,$t,he,Ne,Ie,Fe,He;ne.length===3?(Ne=ne[2],He=Ft[2]):(Ne=1,He=1),$t=ne[0],he=ne[1],Ie=Ft[0],Fe=Ft[1],U.alignment=1,U.width=$t,U.height=he,U.channels=Ne,U.format=U.internalformat=bl[Ne],U.needsFree=!0,Rc(U,Qt,Ie,Fe,He,Y.offset)}else if(Cc(Y)||Wu(Y)||mc(Y))Cc(Y)||Wu(Y)?U.element=Y:U.element=Y.canvas,U.width=U.element.width,U.height=U.element.height,U.channels=4;else if(wl(Y))U.element=Y,U.width=Y.width,U.height=Y.height,U.channels=4;else if(Xc(Y))U.element=Y,U.width=Y.naturalWidth,U.height=Y.naturalHeight,U.channels=4;else if(Bc(Y))U.element=Y,U.width=Y.videoWidth,U.height=Y.videoHeight,U.channels=4;else if(pu(Y)){var Ge=U.width||Y[0].length,Ae=U.height||Y.length,Oe=U.channels;rn(Y[0][0])?Oe=Oe||Y[0][0].length:Oe=Oe||1;for(var Le=Dt.shape(Y),ur=1,Dr=0;Dr>=zt,Y.height>>=zt,oa(Y,ft[zt]),U.mipmask|=1<=0&&!("faces"in tt)&&(U.genMipmaps=!0)}if("mag"in tt){var ft=tt.mag;U.magFilter=ea[ft]}var zt=U.wrapS,Qt=U.wrapT;if("wrap"in tt){var ne=tt.wrap;typeof ne=="string"?zt=Qt=sa[ne]:Array.isArray(ne)&&(zt=sa[ne[0]],Qt=sa[ne[1]])}else{if("wrapS"in tt){var Ft=tt.wrapS;zt=sa[Ft]}if("wrapT"in tt){var $t=tt.wrapT;Qt=sa[$t]}}if(U.wrapS=zt,U.wrapT=Qt,"anisotropic"in tt&&(tt.anisotropic,U.anisotropic=tt.anisotropic),"mipmap"in tt){var he=!1;switch(typeof tt.mipmap){case"string":U.mipmapHint=Sn[tt.mipmap],U.genMipmaps=!0,he=!0;break;case"boolean":he=U.genMipmaps=tt.mipmap;break;case"object":U.genMipmaps=!1,he=!0;break}he&&!("min"in tt)&&(U.minFilter=Ss)}}function El(U,tt){ie.texParameteri(tt,fl,U.minFilter),ie.texParameteri(tt,$s,U.magFilter),ie.texParameteri(tt,io,U.wrapS),ie.texParameteri(tt,co,U.wrapT),nr.ext_texture_filter_anisotropic&&ie.texParameteri(tt,cs,U.anisotropic),U.genMipmaps&&(ie.hint(au,U.mipmapHint),ie.generateMipmap(tt))}var Cl=0,Hs={},js=cr.maxTextureUnits,Ks=Array(js).map(function(){return null});function Mi(U){Rn.call(this),this.mipmask=0,this.internalformat=Qa,this.id=Cl++,this.refCount=1,this.target=U,this.texture=ie.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new Zo,qr.profile&&(this.stats={size:0})}function Ys(U){ie.activeTexture(hu),ie.bindTexture(U.target,U.texture)}function Uo(){var U=Ks[0];U?ie.bindTexture(U.target,U.texture):ie.bindTexture(vn,null)}function tl(U){var tt=U.texture,Y=U.unit,ft=U.target;Y>=0&&(ie.activeTexture(hu+Y),ie.bindTexture(ft,null),Ks[Y]=null),ie.deleteTexture(tt),U.texture=null,U.params=null,U.pixels=null,U.refCount=0,delete Hs[U.id],Tn.textureCount--}u(Mi.prototype,{bind:function(){var U=this;U.bindCount+=1;var tt=U.unit;if(tt<0){for(var Y=0;Y0)continue;ft.unit=-1}Ks[Y]=U,tt=Y;break}qr.profile&&Tn.maxTextureUnits>Fe)-Ne,He.height=He.height||(Y.height>>Fe)-Ie,Ys(Y),_i(He,vn,Ne,Ie,Fe),Uo(),Na(He),ft}function Qt(ne,Ft){var $t=ne|0,he=Ft|0||$t;if($t===Y.width&&he===Y.height)return ft;ft.width=Y.width=$t,ft.height=Y.height=he,Ys(Y);for(var Ne=0;Y.mipmask>>Ne;++Ne){var Ie=$t>>Ne,Fe=he>>Ne;if(!Ie||!Fe)break;ie.texImage2D(vn,Ne,Y.format,Ie,Fe,0,Y.format,Y.type,null)}return Uo(),qr.profile&&(Y.stats.size=Pu(Y.internalformat,Y.type,$t,he,!1,!1)),ft}return ft(U,tt),ft.subimage=zt,ft.resize=Qt,ft._reglType="texture2d",ft._texture=Y,qr.profile&&(ft.stats=Y.stats),ft.destroy=function(){Y.decRef()},ft}function vi(U,tt,Y,ft,zt,Qt){var ne=new Mi(Oa);Hs[ne.id]=ne,Tn.cubeCount++;var Ft=new Array(6);function $t(Ie,Fe,He,Ge,Ae,Oe){var Le,ur=ne.texInfo;for(Zo.call(ur),Le=0;Le<6;++Le)Ft[Le]=Zi();if(typeof Ie=="number"||!Ie){var Dr=Ie|0||1;for(Le=0;Le<6;++Le)gi(Ft[Le],Dr,Dr)}else if(typeof Ie=="object")if(Fe)Ri(Ft[0],Ie),Ri(Ft[1],Fe),Ri(Ft[2],He),Ri(Ft[3],Ge),Ri(Ft[4],Ae),Ri(Ft[5],Oe);else if(Qs(ur,Ie),Pa(ne,Ie),"faces"in Ie){var jr=Ie.faces;for(Le=0;Le<6;++Le)An(Ft[Le],ne),Ri(Ft[Le],jr[Le])}else for(Le=0;Le<6;++Le)Ri(Ft[Le],Ie);for(An(ne,Ft[0]),ur.genMipmaps?ne.mipmask=(Ft[0].width<<1)-1:ne.mipmask=Ft[0].mipmask,ne.internalformat=Ft[0].internalformat,$t.width=Ft[0].width,$t.height=Ft[0].height,Ys(ne),Le=0;Le<6;++Le)ds(Ft[Le],Qn+Le);for(El(ur,Oa),Uo(),qr.profile&&(ne.stats.size=Pu(ne.internalformat,ne.type,$t.width,$t.height,ur.genMipmaps,!0)),$t.format=Xn[ne.internalformat],$t.type=jn[ne.type],$t.mag=kn[ur.magFilter],$t.min=Ia[ur.minFilter],$t.wrapS=ya[ur.wrapS],$t.wrapT=ya[ur.wrapT],Le=0;Le<6;++Le)Zs(Ft[Le]);return $t}function he(Ie,Fe,He,Ge,Ae){var Oe=He|0,Le=Ge|0,ur=Ae|0,Dr=Ma();return An(Dr,ne),Dr.width=0,Dr.height=0,oa(Dr,Fe),Dr.width=Dr.width||(ne.width>>ur)-Oe,Dr.height=Dr.height||(ne.height>>ur)-Le,Ys(ne),_i(Dr,Qn+Ie,Oe,Le,ur),Uo(),Na(Dr),$t}function Ne(Ie){var Fe=Ie|0;if(Fe!==ne.width){$t.width=ne.width=Fe,$t.height=ne.height=Fe,Ys(ne);for(var He=0;He<6;++He)for(var Ge=0;ne.mipmask>>Ge;++Ge)ie.texImage2D(Qn+He,Ge,ne.format,Fe>>Ge,Fe>>Ge,0,ne.format,ne.type,null);return Uo(),qr.profile&&(ne.stats.size=Pu(ne.internalformat,ne.type,$t.width,$t.height,!1,!0)),$t}}return $t(U,tt,Y,ft,zt,Qt),$t.subimage=he,$t.resize=Ne,$t._reglType="textureCube",$t._texture=ne,qr.profile&&($t.stats=ne.stats),$t.destroy=function(){ne.decRef()},$t}function lo(){for(var U=0;U>ft,Y.height>>ft,0,Y.internalformat,Y.type,null);else for(var zt=0;zt<6;++zt)ie.texImage2D(Qn+zt,ft,Y.internalformat,Y.width>>ft,Y.height>>ft,0,Y.internalformat,Y.type,null);El(Y.texInfo,Y.target)})}function $o(){for(var U=0;U=0?Zs=!0:sa.indexOf(Zo)>=0&&(Zs=!1))),("depthTexture"in Mi||"depthStencilTexture"in Mi)&&(Ks=!!(Mi.depthTexture||Mi.depthStencilTexture)),"depth"in Mi&&(typeof Mi.depth=="boolean"?ds=Mi.depth:(Cl=Mi.depth,rs=!1)),"stencil"in Mi&&(typeof Mi.stencil=="boolean"?rs=Mi.stencil:(Hs=Mi.stencil,ds=!1)),"depthStencil"in Mi&&(typeof Mi.depthStencil=="boolean"?ds=rs=Mi.depthStencil:(js=Mi.depthStencil,ds=!1,rs=!1))}var Uo=null,tl=null,Il=null,vi=null;if(Array.isArray(Zi))Uo=Zi.map(Un);else if(Zi)Uo=[Un(Zi)];else for(Uo=new Array(El),ui=0;ui0&&(Na.depth=oa[0].depth,Na.stencil=oa[0].stencil,Na.depthStencil=oa[0].depthStencil),oa[Ma]?oa[Ma](Na):oa[Ma]=An(Na)}return u(Sa,{width:ui,height:ui,color:Zo})}function _i(pi){var Ma,Na=pi|0;if(Na===Sa.width)return Sa;var ui=Sa.color;for(Ma=0;Ma=ui.byteLength?gi.subdata(ui):(gi.destroy(),An.buffers[pi]=null)),An.buffers[pi]||(gi=An.buffers[pi]=zn.create(Ma,kc,!1,!0)),Na.buffer=zn.getBuffer(gi),Na.size=Na.buffer.dimension|0,Na.normalized=!1,Na.type=Na.buffer.dtype,Na.offset=0,Na.stride=0,Na.divisor=0,Na.state=1,Sa[pi]=1}else zn.getBuffer(Ma)?(Na.buffer=zn.getBuffer(Ma),Na.size=Na.buffer.dimension|0,Na.normalized=!1,Na.type=Na.buffer.dtype,Na.offset=0,Na.stride=0,Na.divisor=0,Na.state=1):zn.getBuffer(Ma.buffer)?(Na.buffer=zn.getBuffer(Ma.buffer),Na.size=(+Ma.size||Na.buffer.dimension)|0,Na.normalized=!!Ma.normalized||!1,"type"in Ma?Na.type=pn[Ma.type]:Na.type=Na.buffer.dtype,Na.offset=(Ma.offset||0)|0,Na.stride=(Ma.stride||0)|0,Na.divisor=(Ma.divisor||0)|0,Na.state=1):"x"in Ma&&(Na.x=+Ma.x||0,Na.y=+Ma.y||0,Na.z=+Ma.z||0,Na.w=+Ma.w||0,Na.state=2)}for(var Ri=0;Ri1)for(var ba=0;baNr&&(Nr=fn.stats.uniformsCount)}),Nr},cr.getMaxAttributesCount=function(){var Nr=0;return ka.forEach(function(fn){fn.stats.attributesCount>Nr&&(Nr=fn.stats.attributesCount)}),Nr});function Un(){zn={},Tn={};for(var Nr=0;Nr>>4&15)+nr.charAt(sn&15);return cr}function Fu(ie){for(var nr="",cr=-1,sn,zn;++cr>>6&31,128|sn&63):sn<=65535?nr+=String.fromCharCode(224|sn>>>12&15,128|sn>>>6&63,128|sn&63):sn<=2097151&&(nr+=String.fromCharCode(240|sn>>>18&7,128|sn>>>12&63,128|sn>>>6&63,128|sn&63));return nr}function Au(ie){for(var nr=Array(ie.length>>2),cr=0;cr>5]|=(ie.charCodeAt(cr/8)&255)<<24-cr%32;return nr}function il(ie){for(var nr="",cr=0;cr>5]>>>24-cr%32&255);return nr}function Cs(ie,nr){return ie>>>nr|ie<<32-nr}function Mu(ie,nr){return ie>>>nr}function uc(ie,nr,cr){return ie&nr^~ie&cr}function Su(ie,nr,cr){return ie&nr^ie&cr^nr&cr}function Dc(ie){return Cs(ie,2)^Cs(ie,13)^Cs(ie,22)}function Xe(ie){return Cs(ie,6)^Cs(ie,11)^Cs(ie,25)}function yr(ie){return Cs(ie,7)^Cs(ie,18)^Mu(ie,3)}function Kr(ie){return Cs(ie,17)^Cs(ie,19)^Mu(ie,10)}var Rr=new Array(1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998);function mn(ie,nr){var cr=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),sn=new Array(64),zn,Tn,qr,Sn,sa,ea,ka,Ka,Va,fa,Un,Nr;for(ie[nr>>5]|=128<<24-nr%32,ie[(nr+64>>9<<4)+15]=nr,Va=0;Va>16)+(nr>>16)+(cr>>16);return sn<<16|cr&65535}function ha(ie){return Array.prototype.slice.call(ie)}function Ta(ie){return ha(ie).join("")}function Ua(ie){var nr=ie&&ie.cache,cr=0,sn=[],zn=[],Tn=[];function qr(Un,Nr){var fn=Nr&&Nr.stable;if(!fn){for(var Xn=0;Xn0&&(Un.push(jn,"="),Un.push.apply(Un,ha(arguments)),Un.push(";")),jn}return u(Nr,{def:Xn,toString:function(){return Ta([fn.length>0?"var "+fn.join(",")+";":"",Ta(Un)])}})}function sa(){var Un=Sn(),Nr=Sn(),fn=Un.toString,Xn=Nr.toString;function jn(kn,Ia){Nr(kn,Ia,"=",Un.def(kn,Ia),";")}return u(function(){Un.apply(Un,ha(arguments))},{def:Un.def,entry:Un,exit:Nr,save:jn,set:function(kn,Ia,ya){jn(kn,Ia),Un(kn,Ia,"=",ya,";")},toString:function(){return fn()+Xn()}})}function ea(){var Un=Ta(arguments),Nr=sa(),fn=sa(),Xn=Nr.toString,jn=fn.toString;return u(Nr,{then:function(){return Nr.apply(Nr,ha(arguments)),this},else:function(){return fn.apply(fn,ha(arguments)),this},toString:function(){var kn=jn();return kn&&(kn="else{"+kn+"}"),Ta(["if(",Un,"){",Xn(),"}",kn])}})}var ka=Sn(),Ka={};function Va(Un,Nr){var fn=[];function Xn(){var qa="a"+fn.length;return fn.push(qa),qa}Nr=Nr||0;for(var jn=0;jn":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Bn={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Hn={cw:Xt,ccw:fe};function Yn(ie){return Array.isArray(ie)||Mr(ie)||Ir(ie)}function na(ie){return ie.sort(function(nr,cr){return nr===ul?-1:cr===ul?1:nr=1,sn>=2,nr)}else if(cr===Wi){var zn=ie.data;return new _n(zn.thisDep,zn.contextDep,zn.propDep,nr)}else{if(cr===Xi)return new _n(!1,!1,!1,nr);if(cr===ni){for(var Tn=!1,qr=!1,Sn=!1,sa=0;sa=1&&(qr=!0),ka>=2&&(Sn=!0)}else ea.type===Wi&&(Tn=Tn||ea.data.thisDep,qr=qr||ea.data.contextDep,Sn=Sn||ea.data.propDep)}return new _n(Tn,qr,Sn,nr)}else return new _n(cr===Oi,cr===Vi,cr===ei,nr)}}var xi=new _n(!1,!1,!1,function(){});function ki(ie,nr,cr,sn,zn,Tn,qr,Sn,sa,ea,ka,Ka,Va,fa,Un,Nr){var fn=ea.Record,Xn={add:32774,subtract:32778,"reverse subtract":32779};cr.ext_blend_minmax&&(Xn.min=me,Xn.max=we);var jn=cr.angle_instanced_arrays,kn=cr.webgl_draw_buffers,Ia=cr.oes_vertex_array_object,ya={dirty:!0,profile:Nr.profile},qa={},Rn=[],An={},Pa={};function ba(Ft){return Ft.replace(".","_")}function aa(Ft,$t,he){var Ne=ba(Ft);Rn.push(Ft),qa[Ne]=ya[Ne]=!!he,An[Ne]=$t}function oa(Ft,$t,he){var Ne=ba(Ft);Rn.push(Ft),Array.isArray(he)?(ya[Ne]=he.slice(),qa[Ne]=he.slice()):ya[Ne]=qa[Ne]=he,Pa[Ne]=$t}function Sa(Ft){return!!isNaN(Ft)}aa(Za,gr),aa($i,fr),oa(Do,"blendColor",[0,0,0,0]),oa(ss,"blendEquationSeparate",[Sr,Sr]),oa(Ps,"blendFuncSeparate",[Cr,or,Cr,or]),aa(ys,Hr,!0),oa(Os,"depthFunc",Wr),oa(Yo,"depthRange",[0,1]),oa(ll,"depthMask",!0),oa(el,el,[!0,!0,!0,!0]),aa(Rs,rr),oa(bi,"cullFace",Et),oa(so,so,fe),oa(ws,ws,1),aa(fs,cn),oa(Ll,"polygonOffset",[0,0]),aa($l,Mn),aa(jl,Jn),oa(Bu,"sampleCoverage",[1,!1]),aa(Jl,Lr),oa(Ru,"stencilMask",-1),oa(nl,"stencilFunc",[Ve,0,-1]),oa(Nu,"stencilOpSeparate",[gt,je,je,je]),oa(Ui,"stencilOpSeparate",[Et,je,je,je]),aa(fo,nn),oa(Ql,"scissor",[0,0,ie.drawingBufferWidth,ie.drawingBufferHeight]),oa(ul,ul,[0,0,ie.drawingBufferWidth,ie.drawingBufferHeight]);var _i={gl:ie,context:Va,strings:nr,next:qa,current:ya,draw:Ka,elements:Tn,buffer:zn,shader:ka,attributes:ea.state,vao:ea,uniforms:sa,framebuffer:Sn,extensions:cr,timer:fa,isBufferArgs:Yn},pi={primTypes:Cn,compareFuncs:hn,blendFuncs:ta,blendEquations:Xn,stencilOps:Bn,glTypes:pn,orientationType:Hn};kn&&(pi.backBuffer=[Et],pi.drawBuffer=c(sn.maxDrawbuffers,function(Ft){return Ft===0?[0]:c(Ft,function($t){return on+$t})}));var Ma=0;function Na(){var Ft=Ua({cache:Un}),$t=Ft.link,he=Ft.global;Ft.id=Ma++,Ft.batchId="0";var Ne=$t(_i),Ie=Ft.shared={props:"a0"};Object.keys(_i).forEach(function(Oe){Ie[Oe]=he.def(Ne,".",Oe)});var Fe=Ft.next={},He=Ft.current={};Object.keys(Pa).forEach(function(Oe){Array.isArray(ya[Oe])&&(Fe[Oe]=he.def(Ie.next,".",Oe),He[Oe]=he.def(Ie.current,".",Oe))});var Ge=Ft.constants={};Object.keys(pi).forEach(function(Oe){Ge[Oe]=he.def(JSON.stringify(pi[Oe]))}),Ft.invoke=function(Oe,Le){switch(Le.type){case ca:var ur=["this",Ie.context,Ie.props,Ft.batchId];return Oe.def($t(Le.data),".call(",ur.slice(0,Math.max(Le.data.length+1,4)),")");case ei:return Oe.def(Ie.props,Le.data);case Vi:return Oe.def(Ie.context,Le.data);case Oi:return Oe.def("this",Le.data);case Wi:return Le.data.append(Ft,Oe),Le.data.ref;case Xi:return Le.data.toString();case ni:return Le.data.map(function(Dr){return Ft.invoke(Oe,Dr)})}},Ft.attribCache={};var Ae={};return Ft.scopeAttrib=function(Oe){var Le=nr.id(Oe);if(Le in Ae)return Ae[Le];var ur=ea.scope[Le];ur||(ur=ea.scope[Le]=new fn);var Dr=Ae[Le]=$t(ur);return Dr},Ft}function ui(Ft){var $t=Ft.static,he=Ft.dynamic,Ne;if(Fc in $t){var Ie=!!$t[Fc];Ne=Wa(function(He,Ge){return Ie}),Ne.enable=Ie}else if(Fc in he){var Fe=he[Fc];Ne=ri(Fe,function(He,Ge){return He.invoke(Ge,Fe)})}return Ne}function gi(Ft,$t){var he=Ft.static,Ne=Ft.dynamic;if(Pt in he){var Ie=he[Pt];return Ie?(Ie=Sn.getFramebuffer(Ie),Wa(function(He,Ge){var Ae=He.link(Ie),Oe=He.shared;Ge.set(Oe.framebuffer,".next",Ae);var Le=Oe.context;return Ge.set(Le,"."+pr,Ae+".width"),Ge.set(Le,"."+Br,Ae+".height"),Ae})):Wa(function(He,Ge){var Ae=He.shared;Ge.set(Ae.framebuffer,".next","null");var Oe=Ae.context;return Ge.set(Oe,"."+pr,Oe+"."+ae),Ge.set(Oe,"."+Br,Oe+"."+ce),"null"})}else if(Pt in Ne){var Fe=Ne[Pt];return ri(Fe,function(He,Ge){var Ae=He.invoke(Ge,Fe),Oe=He.shared,Le=Oe.framebuffer,ur=Ge.def(Le,".getFramebuffer(",Ae,")");Ge.set(Le,".next",ur);var Dr=Oe.context;return Ge.set(Dr,"."+pr,ur+"?"+ur+".width:"+Dr+"."+ae),Ge.set(Dr,"."+Br,ur+"?"+ur+".height:"+Dr+"."+ce),ur})}else return null}function Ri(Ft,$t,he){var Ne=Ft.static,Ie=Ft.dynamic;function Fe(Ae){if(Ae in Ne){var Oe=Ne[Ae],Le=!0,ur=Oe.x|0,Dr=Oe.y|0,jr,On;return"width"in Oe?jr=Oe.width|0:Le=!1,"height"in Oe?On=Oe.height|0:Le=!1,new _n(!Le&&$t&&$t.thisDep,!Le&&$t&&$t.contextDep,!Le&&$t&&$t.propDep,function(Wn,Dn){var la=Wn.shared.context,qn=jr;"width"in Oe||(qn=Dn.def(la,".",pr,"-",ur));var Gn=On;return"height"in Oe||(Gn=Dn.def(la,".",Br,"-",Dr)),[ur,Dr,qn,Gn]})}else if(Ae in Ie){var Ln=Ie[Ae],xn=ri(Ln,function(Wn,Dn){var la=Wn.invoke(Dn,Ln),qn=Wn.shared.context,Gn=Dn.def(la,".x|0"),ma=Dn.def(la,".y|0"),ti=Dn.def('"width" in ',la,"?",la,".width|0:","(",qn,".",pr,"-",Gn,")"),si=Dn.def('"height" in ',la,"?",la,".height|0:","(",qn,".",Br,"-",ma,")");return[Gn,ma,ti,si]});return $t&&(xn.thisDep=xn.thisDep||$t.thisDep,xn.contextDep=xn.contextDep||$t.contextDep,xn.propDep=xn.propDep||$t.propDep),xn}else return $t?new _n($t.thisDep,$t.contextDep,$t.propDep,function(Wn,Dn){var la=Wn.shared.context;return[0,0,Dn.def(la,".",pr),Dn.def(la,".",Br)]}):null}var He=Fe(ul);if(He){var Ge=He;He=new _n(He.thisDep,He.contextDep,He.propDep,function(Ae,Oe){var Le=Ge.append(Ae,Oe),ur=Ae.shared.context;return Oe.set(ur,"."+Jr,Le[2]),Oe.set(ur,"."+Rt,Le[3]),Le})}return{viewport:He,scissor_box:Fe(Ql)}}function ds(Ft,$t){var he=Ft.static,Ne=typeof he[at]=="string"&&typeof he[L]=="string";if(Ne){if(Object.keys($t.dynamic).length>0)return null;var Ie=$t.static,Fe=Object.keys(Ie);if(Fe.length>0&&typeof Ie[Fe[0]]=="number"){for(var He=[],Ge=0;Ge"+Gn+"?"+Le+".constant["+Gn+"]:0;"}).join(""),"}}else{","if(",jr,"(",Le,".buffer)){",Wn,"=",On,".createStream(",ye,",",Le,".buffer);","}else{",Wn,"=",On,".getBuffer(",Le,".buffer);","}",Dn,'="type" in ',Le,"?",Dr.glTypes,"[",Le,".type]:",Wn,".dtype;",Ln.normalized,"=!!",Le,".normalized;");function la(qn){Oe(Ln[qn],"=",Le,".",qn,"|0;")}return la("size"),la("offset"),la("stride"),la("divisor"),Oe("}}"),Oe.exit("if(",Ln.isStream,"){",On,".destroyStream(",Wn,");","}"),Ln}Ie[Fe]=ri(He,Ge)}),Ie}function El(Ft){var $t=Ft.static,he=Ft.dynamic,Ne={};return Object.keys($t).forEach(function(Ie){var Fe=$t[Ie];Ne[Ie]=Wa(function(He,Ge){return typeof Fe=="number"||typeof Fe=="boolean"?""+Fe:He.link(Fe)})}),Object.keys(he).forEach(function(Ie){var Fe=he[Ie];Ne[Ie]=ri(Fe,function(He,Ge){return He.invoke(Ge,Fe)})}),Ne}function Cl(Ft,$t,he,Ne,Ie){Ft.static,Ft.dynamic;var Fe=ds(Ft,$t),He=gi(Ft),Ge=Ri(Ft,He),Ae=Zi(Ft),Oe=Zs(Ft),Le=rs(Ft,Ie,Fe);function ur(Wn){var Dn=Ge[Wn];Dn&&(Oe[Wn]=Dn)}ur(ul),ur(ba(Ql));var Dr=Object.keys(Oe).length>0,jr={framebuffer:He,draw:Ae,shader:Le,state:Oe,dirty:Dr,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(jr.profile=ui(Ft),jr.uniforms=Zo(he),jr.drawVAO=jr.scopeVAO=Ae.vao,!jr.drawVAO&&Le.program&&!Fe&&cr.angle_instanced_arrays&&Ae.static.elements){var On=!0,Ln=Le.program.attributes.map(function(Wn){var Dn=$t.static[Wn];return On=On&&!!Dn,Dn});if(On&&Ln.length>0){var xn=ea.getVAO(ea.createVAO({attributes:Ln,elements:Ae.static.elements}));jr.drawVAO=new _n(null,null,null,function(Wn,Dn){return Wn.link(xn)}),jr.useVAO=!0}}return Fe?jr.useVAO=!0:jr.attributes=Qs($t),jr.context=El(Ne),jr}function Hs(Ft,$t,he){var Ne=Ft.shared,Ie=Ne.context,Fe=Ft.scope();Object.keys(he).forEach(function(He){$t.save(Ie,"."+He);var Ge=he[He],Ae=Ge.append(Ft,$t);Array.isArray(Ae)?Fe(Ie,".",He,"=[",Ae.join(),"];"):Fe(Ie,".",He,"=",Ae,";")}),$t(Fe)}function js(Ft,$t,he,Ne){var Ie=Ft.shared,Fe=Ie.gl,He=Ie.framebuffer,Ge;kn&&(Ge=$t.def(Ie.extensions,".webgl_draw_buffers"));var Ae=Ft.constants,Oe=Ae.drawBuffer,Le=Ae.backBuffer,ur;he?ur=he.append(Ft,$t):ur=$t.def(He,".next"),Ne||$t("if(",ur,"!==",He,".cur){"),$t("if(",ur,"){",Fe,".bindFramebuffer(",an,",",ur,".framebuffer);"),kn&&$t(Ge,".drawBuffersWEBGL(",Oe,"[",ur,".colorAttachments.length]);"),$t("}else{",Fe,".bindFramebuffer(",an,",null);"),kn&&$t(Ge,".drawBuffersWEBGL(",Le,");"),$t("}",He,".cur=",ur,";"),Ne||$t("}")}function Ks(Ft,$t,he){var Ne=Ft.shared,Ie=Ne.gl,Fe=Ft.current,He=Ft.next,Ge=Ne.current,Ae=Ne.next,Oe=Ft.cond(Ge,".dirty");Rn.forEach(function(Le){var ur=ba(Le);if(!(ur in he.state)){var Dr,jr;if(ur in He){Dr=He[ur],jr=Fe[ur];var On=c(ya[ur].length,function(xn){return Oe.def(Dr,"[",xn,"]")});Oe(Ft.cond(On.map(function(xn,Wn){return xn+"!=="+jr+"["+Wn+"]"}).join("||")).then(Ie,".",Pa[ur],"(",On,");",On.map(function(xn,Wn){return jr+"["+Wn+"]="+xn}).join(";"),";"))}else{Dr=Oe.def(Ae,".",ur);var Ln=Ft.cond(Dr,"!==",Ge,".",ur);Oe(Ln),ur in An?Ln(Ft.cond(Dr).then(Ie,".enable(",An[ur],");").else(Ie,".disable(",An[ur],");"),Ge,".",ur,"=",Dr,";"):Ln(Ie,".",Pa[ur],"(",Dr,");",Ge,".",ur,"=",Dr,";")}}}),Object.keys(he.state).length===0&&Oe(Ge,".dirty=false;"),$t(Oe)}function Mi(Ft,$t,he,Ne){var Ie=Ft.shared,Fe=Ft.current,He=Ie.current,Ge=Ie.gl,Ae;na(Object.keys(he)).forEach(function(Oe){var Le=he[Oe];if(!(Ne&&!Ne(Le))){var ur=Le.append(Ft,$t);if(An[Oe]){var Dr=An[Oe];Ha(Le)?(Ae=Ft.link(ur,{stable:!0}),$t(Ft.cond(Ae).then(Ge,".enable(",Dr,");").else(Ge,".disable(",Dr,");")),$t(He,".",Oe,"=",Ae,";")):($t(Ft.cond(ur).then(Ge,".enable(",Dr,");").else(Ge,".disable(",Dr,");")),$t(He,".",Oe,"=",ur,";"))}else if(rn(ur)){var jr=Fe[Oe];$t(Ge,".",Pa[Oe],"(",ur,");",ur.map(function(On,Ln){return jr+"["+Ln+"]="+On}).join(";"),";")}else Ha(Le)?(Ae=Ft.link(ur,{stable:!0}),$t(Ge,".",Pa[Oe],"(",Ae,");",He,".",Oe,"=",Ae,";")):$t(Ge,".",Pa[Oe],"(",ur,");",He,".",Oe,"=",ur,";")}})}function Ys(Ft,$t){jn&&(Ft.instancing=$t.def(Ft.shared.extensions,".angle_instanced_arrays"))}function Uo(Ft,$t,he,Ne,Ie){var Fe=Ft.shared,He=Ft.stats,Ge=Fe.current,Ae=Fe.timer,Oe=he.profile;function Le(){return typeof performance>"u"?"Date.now()":"performance.now()"}var ur,Dr;function jr(la){ur=$t.def(),la(ur,"=",Le(),";"),typeof Ie=="string"?la(He,".count+=",Ie,";"):la(He,".count++;"),fa&&(Ne?(Dr=$t.def(),la(Dr,"=",Ae,".getNumPendingQueries();")):la(Ae,".beginQuery(",He,");"))}function On(la){la(He,".cpuTime+=",Le(),"-",ur,";"),fa&&(Ne?la(Ae,".pushScopeStats(",Dr,",",Ae,".getNumPendingQueries(),",He,");"):la(Ae,".endQuery();"))}function Ln(la){var qn=$t.def(Ge,".profile");$t(Ge,".profile=",la,";"),$t.exit(Ge,".profile=",qn,";")}var xn;if(Oe){if(Ha(Oe)){Oe.enable?(jr($t),On($t.exit),Ln("true")):Ln("false");return}xn=Oe.append(Ft,$t),Ln(xn)}else xn=$t.def(Ge,".profile");var Wn=Ft.block();jr(Wn),$t("if(",xn,"){",Wn,"}");var Dn=Ft.block();On(Dn),$t.exit("if(",xn,"){",Dn,"}")}function tl(Ft,$t,he,Ne,Ie){var Fe=Ft.shared;function He(Ae){switch(Ae){case xa:case mi:case po:return 2;case La:case Yi:case Qo:return 3;case ai:case Go:case Js:return 4;default:return 1}}function Ge(Ae,Oe,Le){var ur=Fe.gl,Dr=$t.def(Ae,".location"),jr=$t.def(Fe.attributes,"[",Dr,"]"),On=Le.state,Ln=Le.buffer,xn=[Le.x,Le.y,Le.z,Le.w],Wn=["buffer","normalized","offset","stride"];function Dn(){$t("if(!",jr,".buffer){",ur,".enableVertexAttribArray(",Dr,");}");var qn=Le.type,Gn;if(Le.size?Gn=$t.def(Le.size,"||",Oe):Gn=Oe,$t("if(",jr,".type!==",qn,"||",jr,".size!==",Gn,"||",Wn.map(function(ti){return jr+"."+ti+"!=="+Le[ti]}).join("||"),"){",ur,".bindBuffer(",ye,",",Ln,".buffer);",ur,".vertexAttribPointer(",[Dr,Gn,qn,Le.normalized,Le.stride,Le.offset],");",jr,".type=",qn,";",jr,".size=",Gn,";",Wn.map(function(ti){return jr+"."+ti+"="+Le[ti]+";"}).join(""),"}"),jn){var ma=Le.divisor;$t("if(",jr,".divisor!==",ma,"){",Ft.instancing,".vertexAttribDivisorANGLE(",[Dr,ma],");",jr,".divisor=",ma,";}")}}function la(){$t("if(",jr,".buffer){",ur,".disableVertexAttribArray(",Dr,");",jr,".buffer=null;","}if(",Ya.map(function(qn,Gn){return jr+"."+qn+"!=="+xn[Gn]}).join("||"),"){",ur,".vertexAttrib4f(",Dr,",",xn,");",Ya.map(function(qn,Gn){return jr+"."+qn+"="+xn[Gn]+";"}).join(""),"}")}On===Ba?Dn():On===za?la():($t("if(",On,"===",Ba,"){"),Dn(),$t("}else{"),la(),$t("}"))}Ne.forEach(function(Ae){var Oe=Ae.name,Le=he.attributes[Oe],ur;if(Le){if(!Ie(Le))return;ur=Le.append(Ft,$t)}else{if(!Ie(xi))return;var Dr=Ft.scopeAttrib(Oe);ur={},Object.keys(new fn).forEach(function(jr){ur[jr]=$t.def(Dr,".",jr)})}Ge(Ft.link(Ae),He(Ae.info.type),ur)})}function Il(Ft,$t,he,Ne,Ie,Fe){for(var He=Ft.shared,Ge=He.gl,Ae,Oe=0;Oe1){for(var Li=[],to=[],ls=0;ls>1)",Ln],");")}function ma(){he(xn,".drawArraysInstancedANGLE(",[Dr,jr,On,Ln],");")}Le&&Le!=="null"?Dn?Gn():(he("if(",Le,"){"),Gn(),he("}else{"),ma(),he("}")):ma()}function qn(){function Gn(){he(Fe+".drawElements("+[Dr,On,Wn,jr+"<<(("+Wn+"-"+va+")>>1)"]+");")}function ma(){he(Fe+".drawArrays("+[Dr,jr,On]+");")}Le&&Le!=="null"?Dn?Gn():(he("if(",Le,"){"),Gn(),he("}else{"),ma(),he("}")):ma()}jn&&(typeof Ln!="number"||Ln>=0)?typeof Ln=="string"?(he("if(",Ln,">0){"),la(),he("}else if(",Ln,"<0){"),qn(),he("}")):la():qn()}function lo(Ft,$t,he,Ne,Ie){var Fe=Na(),He=Fe.proc("body",Ie);return jn&&(Fe.instancing=He.def(Fe.shared.extensions,".angle_instanced_arrays")),Ft(Fe,He,he,Ne),Fe.compile().body}function ns(Ft,$t,he,Ne){Ys(Ft,$t),he.useVAO?he.drawVAO?$t(Ft.shared.vao,".setVAO(",he.drawVAO.append(Ft,$t),");"):$t(Ft.shared.vao,".setVAO(",Ft.shared.vao,".targetVAO);"):($t(Ft.shared.vao,".setVAO(null);"),tl(Ft,$t,he,Ne.attributes,function(){return!0})),Il(Ft,$t,he,Ne.uniforms,function(){return!0},!1),vi(Ft,$t,$t,he)}function $o(Ft,$t){var he=Ft.proc("draw",1);Ys(Ft,he),Hs(Ft,he,$t.context),js(Ft,he,$t.framebuffer),Ks(Ft,he,$t),Mi(Ft,he,$t.state),Uo(Ft,he,$t,!1,!0);var Ne=$t.shader.progVar.append(Ft,he);if(he(Ft.shared.gl,".useProgram(",Ne,".program);"),$t.shader.program)ns(Ft,he,$t,$t.shader.program);else{he(Ft.shared.vao,".setVAO(null);");var Ie=Ft.global.def("{}"),Fe=he.def(Ne,".id"),He=he.def(Ie,"[",Fe,"]");he(Ft.cond(He).then(He,".call(this,a0);").else(He,"=",Ie,"[",Fe,"]=",Ft.link(function(Ge){return lo(ns,Ft,$t,Ge,1)}),"(",Ne,");",He,".call(this,a0);"))}Object.keys($t.state).length>0&&he(Ft.shared.current,".dirty=true;"),Ft.shared.vao&&he(Ft.shared.vao,".setVAO(null);")}function U(Ft,$t,he,Ne){Ft.batchId="a1",Ys(Ft,$t);function Ie(){return!0}tl(Ft,$t,he,Ne.attributes,Ie),Il(Ft,$t,he,Ne.uniforms,Ie,!1),vi(Ft,$t,$t,he)}function tt(Ft,$t,he,Ne){Ys(Ft,$t);var Ie=he.contextDep,Fe=$t.def(),He="a0",Ge="a1",Ae=$t.def();Ft.shared.props=Ae,Ft.batchId=Fe;var Oe=Ft.scope(),Le=Ft.scope();$t(Oe.entry,"for(",Fe,"=0;",Fe,"<",Ge,";++",Fe,"){",Ae,"=",He,"[",Fe,"];",Le,"}",Oe.exit);function ur(Wn){return Wn.contextDep&&Ie||Wn.propDep}function Dr(Wn){return!ur(Wn)}if(he.needsContext&&Hs(Ft,Le,he.context),he.needsFramebuffer&&js(Ft,Le,he.framebuffer),Mi(Ft,Le,he.state,ur),he.profile&&ur(he.profile)&&Uo(Ft,Le,he,!1,!0),Ne)he.useVAO?he.drawVAO?ur(he.drawVAO)?Le(Ft.shared.vao,".setVAO(",he.drawVAO.append(Ft,Le),");"):Oe(Ft.shared.vao,".setVAO(",he.drawVAO.append(Ft,Oe),");"):Oe(Ft.shared.vao,".setVAO(",Ft.shared.vao,".targetVAO);"):(Oe(Ft.shared.vao,".setVAO(null);"),tl(Ft,Oe,he,Ne.attributes,Dr),tl(Ft,Le,he,Ne.attributes,ur)),Il(Ft,Oe,he,Ne.uniforms,Dr,!1),Il(Ft,Le,he,Ne.uniforms,ur,!0),vi(Ft,Oe,Le,he);else{var jr=Ft.global.def("{}"),On=he.shader.progVar.append(Ft,Le),Ln=Le.def(On,".id"),xn=Le.def(jr,"[",Ln,"]");Le(Ft.shared.gl,".useProgram(",On,".program);","if(!",xn,"){",xn,"=",jr,"[",Ln,"]=",Ft.link(function(Wn){return lo(U,Ft,he,Wn,2)}),"(",On,");}",xn,".call(this,a0[",Fe,"],",Fe,");")}}function Y(Ft,$t){var he=Ft.proc("batch",2);Ft.batchId="0",Ys(Ft,he);var Ne=!1,Ie=!0;Object.keys($t.context).forEach(function(jr){Ne=Ne||$t.context[jr].propDep}),Ne||(Hs(Ft,he,$t.context),Ie=!1);var Fe=$t.framebuffer,He=!1;Fe?(Fe.propDep?Ne=He=!0:Fe.contextDep&&Ne&&(He=!0),He||js(Ft,he,Fe)):js(Ft,he,null),$t.state.viewport&&$t.state.viewport.propDep&&(Ne=!0);function Ge(jr){return jr.contextDep&&Ne||jr.propDep}Ks(Ft,he,$t),Mi(Ft,he,$t.state,function(jr){return!Ge(jr)}),(!$t.profile||!Ge($t.profile))&&Uo(Ft,he,$t,!1,"a1"),$t.contextDep=Ne,$t.needsContext=Ie,$t.needsFramebuffer=He;var Ae=$t.shader.progVar;if(Ae.contextDep&&Ne||Ae.propDep)tt(Ft,he,$t,null);else{var Oe=Ae.append(Ft,he);if(he(Ft.shared.gl,".useProgram(",Oe,".program);"),$t.shader.program)tt(Ft,he,$t,$t.shader.program);else{he(Ft.shared.vao,".setVAO(null);");var Le=Ft.global.def("{}"),ur=he.def(Oe,".id"),Dr=he.def(Le,"[",ur,"]");he(Ft.cond(Dr).then(Dr,".call(this,a0,a1);").else(Dr,"=",Le,"[",ur,"]=",Ft.link(function(jr){return lo(tt,Ft,$t,jr,2)}),"(",Oe,");",Dr,".call(this,a0,a1);"))}}Object.keys($t.state).length>0&&he(Ft.shared.current,".dirty=true;"),Ft.shared.vao&&he(Ft.shared.vao,".setVAO(null);")}function ft(Ft,$t){var he=Ft.proc("scope",3);Ft.batchId="a2";var Ne=Ft.shared,Ie=Ne.current;if(Hs(Ft,he,$t.context),$t.framebuffer&&$t.framebuffer.append(Ft,he),na(Object.keys($t.state)).forEach(function(Ge){var Ae=$t.state[Ge],Oe=Ae.append(Ft,he);rn(Oe)?Oe.forEach(function(Le,ur){Sa(Le)?he.set(Ft.next[Ge],"["+ur+"]",Le):he.set(Ft.next[Ge],"["+ur+"]",Ft.link(Le,{stable:!0}))}):Ha(Ae)?he.set(Ne.next,"."+Ge,Ft.link(Oe,{stable:!0})):he.set(Ne.next,"."+Ge,Oe)}),Uo(Ft,he,$t,!0,!0),[xt,le,Lt,xe,kt].forEach(function(Ge){var Ae=$t.draw[Ge];if(Ae){var Oe=Ae.append(Ft,he);Sa(Oe)?he.set(Ne.draw,"."+Ge,Oe):he.set(Ne.draw,"."+Ge,Ft.link(Oe),{stable:!0})}}),Object.keys($t.uniforms).forEach(function(Ge){var Ae=$t.uniforms[Ge].append(Ft,he);Array.isArray(Ae)&&(Ae="["+Ae.map(function(Oe){return Sa(Oe)?Oe:Ft.link(Oe,{stable:!0})})+"]"),he.set(Ne.uniforms,"["+Ft.link(nr.id(Ge),{stable:!0})+"]",Ae)}),Object.keys($t.attributes).forEach(function(Ge){var Ae=$t.attributes[Ge].append(Ft,he),Oe=Ft.scopeAttrib(Ge);Object.keys(new fn).forEach(function(Le){he.set(Oe,"."+Le,Ae[Le])})}),$t.scopeVAO){var Fe=$t.scopeVAO.append(Ft,he);Sa(Fe)?he.set(Ne.vao,".targetVAO",Fe):he.set(Ne.vao,".targetVAO",Ft.link(Fe,{stable:!0}))}function He(Ge){var Ae=$t.shader[Ge];if(Ae){var Oe=Ae.append(Ft,he);Sa(Oe)?he.set(Ne.shader,"."+Ge,Oe):he.set(Ne.shader,"."+Ge,Ft.link(Oe,{stable:!0}))}}He(L),He(at),Object.keys($t.state).length>0&&(he(Ie,".dirty=true;"),he.exit(Ie,".dirty=true;")),he("a1(",Ft.shared.context,",a0,",Ft.batchId,");")}function zt(Ft){if(!(typeof Ft!="object"||rn(Ft))){for(var $t=Object.keys(Ft),he=0;he<$t.length;++he)if(f.isDynamic(Ft[$t[he]]))return!0;return!1}}function Qt(Ft,$t,he){var Ne=$t.static[he];if(!Ne||!zt(Ne))return;var Ie=Ft.global,Fe=Object.keys(Ne),He=!1,Ge=!1,Ae=!1,Oe=Ft.global.def("{}");Fe.forEach(function(ur){var Dr=Ne[ur];if(f.isDynamic(Dr)){typeof Dr=="function"&&(Dr=Ne[ur]=f.unbox(Dr));var jr=ri(Dr,null);He=He||jr.thisDep,Ae=Ae||jr.propDep,Ge=Ge||jr.contextDep}else{switch(Ie(Oe,".",ur,"="),typeof Dr){case"number":Ie(Dr);break;case"string":Ie('"',Dr,'"');break;case"object":Array.isArray(Dr)&&Ie("[",Dr.join(),"]");break;default:Ie(Ft.link(Dr));break}Ie(";")}});function Le(ur,Dr){Fe.forEach(function(jr){var On=Ne[jr];if(f.isDynamic(On)){var Ln=ur.invoke(Dr,On);Dr(Oe,".",jr,"=",Ln,";")}})}$t.dynamic[he]=new f.DynamicVariable(Wi,{thisDep:He,contextDep:Ge,propDep:Ae,ref:Oe,append:Le}),delete $t.static[he]}function ne(Ft,$t,he,Ne,Ie){var Fe=Na();Fe.stats=Fe.link(Ie),Object.keys($t.static).forEach(function(Ge){Qt(Fe,$t,Ge)}),Te.forEach(function(Ge){Qt(Fe,Ft,Ge)});var He=Cl(Ft,$t,he,Ne,Fe);return He.shader.program&&(He.shader.program.attributes.sort(function(Ge,Ae){return Ge.name=0;--vi){var lo=Sa[vi];lo&&lo(fa,null,0)}cr.flush(),ea&&ea.update()}function gi(){!Na&&Sa.length>0&&(Na=v.next(ui))}function Ri(){Na&&(v.cancel(ui),Na=null)}function ds(vi){vi.preventDefault(),Ri(),_i.forEach(function(lo){lo()})}function rs(vi){cr.getError(),zn.restore(),ya.restore(),Xn.restore(),qa.restore(),Rn.restore(),An.restore(),kn.restore(),ea&&ea.restore(),Pa.procs.refresh(),gi(),pi.forEach(function(lo){lo()})}oa&&(oa.addEventListener(Bo,ds,!1),oa.addEventListener(Ds,rs,!1));function Zi(){Sa.length=0,Ri(),oa&&(oa.removeEventListener(Bo,ds),oa.removeEventListener(Ds,rs)),ya.clear(),An.clear(),Rn.clear(),kn.clear(),qa.clear(),jn.clear(),Xn.clear(),ea&&ea.clear(),Ma.forEach(function(vi){vi()})}function Zs(vi){function lo(Ie){var Fe=u({},Ie);delete Fe.uniforms,delete Fe.attributes,delete Fe.context,delete Fe.vao,"stencil"in Fe&&Fe.stencil.op&&(Fe.stencil.opBack=Fe.stencil.opFront=Fe.stencil.op,delete Fe.stencil.op);function He(Ge){if(Ge in Fe){var Ae=Fe[Ge];delete Fe[Ge],Object.keys(Ae).forEach(function(Oe){Fe[Ge+"."+Oe]=Ae[Oe]})}}return He("blend"),He("depth"),He("cull"),He("stencil"),He("polygonOffset"),He("scissor"),He("sample"),"vao"in Ie&&(Fe.vao=Ie.vao),Fe}function ns(Ie,Fe){var He={},Ge={};return Object.keys(Ie).forEach(function(Ae){var Oe=Ie[Ae];if(f.isDynamic(Oe)){Ge[Ae]=f.unbox(Oe,Ae);return}else if(Fe&&Array.isArray(Oe)){for(var Le=0;Le0)return ne.call(this,he(Ie|0),Ie|0)}else if(Array.isArray(Ie)){if(Ie.length)return ne.call(this,Ie,Ie.length)}else return Qt.call(this,Ie)}return u(Ne,{stats:ft,destroy:function(){zt.destroy()}})}var Zo=An.setFBO=Zs({framebuffer:f.define.call(null,Ts,"framebuffer")});function Qs(vi,lo){var ns=0;Pa.procs.poll();var $o=lo.color;$o&&(cr.clearColor(+$o[0]||0,+$o[1]||0,+$o[2]||0,+$o[3]||0),ns|=pl),"depth"in lo&&(cr.clearDepth(+lo.depth),ns|=Ns),"stencil"in lo&&(cr.clearStencil(lo.stencil|0),ns|=fi),cr.clear(ns)}function El(vi){if("framebuffer"in vi)if(vi.framebuffer&&vi.framebuffer_reglType==="framebufferCube")for(var lo=0;lo<6;++lo)Zo(u({framebuffer:vi.framebuffer.faces[lo]},vi),Qs);else Zo(vi,Qs);else Qs(null,vi)}function Cl(vi){Sa.push(vi);function lo(){var ns=zs(Sa,vi);function $o(){var U=zs(Sa,$o);Sa[U]=Sa[Sa.length-1],Sa.length-=1,Sa.length<=0&&Ri()}Sa[ns]=$o}return gi(),{cancel:lo}}function Hs(){var vi=aa.viewport,lo=aa.scissor_box;vi[0]=vi[1]=lo[0]=lo[1]=0,fa.viewportWidth=fa.framebufferWidth=fa.drawingBufferWidth=vi[2]=lo[2]=cr.drawingBufferWidth,fa.viewportHeight=fa.framebufferHeight=fa.drawingBufferHeight=vi[3]=lo[3]=cr.drawingBufferHeight}function js(){fa.tick+=1,fa.time=Mi(),Hs(),Pa.procs.poll()}function Ks(){qa.refresh(),Hs(),Pa.procs.refresh(),ea&&ea.update()}function Mi(){return(g()-ka)/1e3}Ks();function Ys(vi,lo){var ns;switch(vi){case"frame":return Cl(lo);case"lost":ns=_i;break;case"restore":ns=pi;break;case"destroy":ns=Ma;break}return ns.push(lo),{cancel:function(){for(var $o=0;$o=0},read:ba,destroy:Zi,_gl:cr,_refresh:Ks,poll:function(){js(),ea&&ea.update()},now:Mi,stats:qr,getCachedCode:Uo,preloadCachedCode:tl});return nr.onDone(null,Il),Il}return Eu})}),Gx=Vt((K,V)=>{var u=S3(),d=v9();V.exports=function(E,A,t){var e=E._fullLayout,r=!0;return e._glcanvas.each(function(i){if(i.regl){i.regl.preloadCachedCode(t);return}if(!(i.pick&&!e._has("parcoords"))){try{i.regl=d({canvas:this,attributes:{antialias:!i.pick,preserveDrawingBuffer:!0},pixelRatio:E._context.plotGlPixelRatio||window.devicePixelRatio,extensions:A||[],cachedCode:t||{}})}catch{r=!1}i.regl||(r=!1),r&&this.addEventListener("webglcontextlost",function(n){E&&E.emit&&E.emit("plotly_webglcontextlost",{event:n,layer:i.key})},!1)}}),r||u({container:e._glcontainer.node()}),r}}),v5=Vt((f,V)=>{var u=Y3(),d=s5(),E=t9(),A=g9(),t=Xr(),e=$h().selectMode,r=Gx(),i=nu(),n=Ub(),o=G3().styleTextSelection,a={};function s(v,g,m,w){var l=v._size,x=v.width*w,y=v.height*w,S=l.l*w,k=l.b*w,M=l.r*w,T=l.t*w,c=l.w*w,h=l.h*w;return[S+g.domain[0]*c,k+m.domain[0]*h,x-M-(1-g.domain[1])*c,y-T-(1-m.domain[1])*h]}var f=V.exports=function(v,g,m){if(m.length){var w=v._fullLayout,l=g._scene,x=g.xaxis,y=g.yaxis,S,k;if(l){var M=r(v,["ANGLE_instanced_arrays","OES_element_index_uint"],a);if(!M){l.init();return}var T=l.count,c=w._glcanvas.data()[0].regl;if(n(v,g,m),l.dirty){if((l.line2d||l.error2d)&&!(l.scatter2d||l.fill2d||l.glText)&&c.clear({color:!0,depth:!0}),l.error2d===!0&&(l.error2d=E(c)),l.line2d===!0&&(l.line2d=d(c)),l.scatter2d===!0&&(l.scatter2d=u(c)),l.fill2d===!0&&(l.fill2d=d(c)),l.glText===!0)for(l.glText=new Array(T),S=0;Sl.glText.length){var h=T-l.glText.length;for(S=0;Sit&&(isNaN(q[nt])||isNaN(q[nt+1]));)nt-=2;J.positions=q.slice(it,nt+2)}return J}),l.line2d.update(l.lineOptions)),l.error2d){var P=(l.errorXOptions||[]).concat(l.errorYOptions||[]);l.error2d.update(P)}l.scatter2d&&l.scatter2d.update(l.markerOptions),l.fillOrder=t.repeat(null,T),l.fill2d&&(l.fillOptions=l.fillOptions.map(function(J,q){var it=m[q];if(!(!J||!it||!it[0]||!it[0].trace)){var nt=it[0],dt=nt.trace,Tt=nt.t,wt=l.lineOptions[q],Ct,It,Nt=[];dt._ownfill&&Nt.push(q),dt._nexttrace&&Nt.push(q+1),Nt.length&&(l.fillOrder[q]=Nt);var te=[],Jt=wt&&wt.positions||Tt.positions,ee,Zt;if(dt.fill==="tozeroy"){for(ee=0;eeee&&isNaN(Jt[Zt+1]);)Zt-=2;Jt[ee+1]!==0&&(te=[Jt[ee],0]),te=te.concat(Jt.slice(ee,Zt+2)),Jt[Zt+1]!==0&&(te=te.concat([Jt[Zt],0]))}else if(dt.fill==="tozerox"){for(ee=0;eeee&&isNaN(Jt[Zt]);)Zt-=2;Jt[ee]!==0&&(te=[0,Jt[ee+1]]),te=te.concat(Jt.slice(ee,Zt+2)),Jt[Zt]!==0&&(te=te.concat([0,Jt[Zt+1]]))}else if(dt.fill==="toself"||dt.fill==="tonext"){for(te=[],Ct=0,J.splitNull=!0,It=0;It-1;for(S=0;S{var u=JE();u.plot=v5(),V.exports=u}),x9=Vt((K,V)=>{V.exports=y9()}),y5=Vt((K,V)=>{var u=dc(),d=Wl(),E=hc().axisHoverFormat,{hovertemplateAttrs:A,templatefallbackAttrs:t}=yl(),e=Iv(),r=Mf().idRegex,i=cl().templatedArray,n=So().extendFlat,o=u.marker,a=o.line,s=n(d("marker.line",{editTypeOverride:"calc"}),{width:n({},a.width,{editType:"calc"}),editType:"calc"}),f=n(d("marker"),{symbol:o.symbol,angle:o.angle,size:n({},o.size,{editType:"markerSize"}),sizeref:o.sizeref,sizemin:o.sizemin,sizemode:o.sizemode,opacity:o.opacity,colorbar:o.colorbar,line:s,editType:"calc"});f.color.editType=f.cmin.editType=f.cmax.editType="style";function v(g){return{valType:"info_array",freeLength:!0,editType:"calc",items:{valType:"subplotid",regex:r[g],editType:"plot"}}}V.exports={dimensions:i("dimension",{visible:{valType:"boolean",dflt:!0,editType:"calc"},label:{valType:"string",editType:"calc"},values:{valType:"data_array",editType:"calc+clearAxisTypes"},axis:{type:{valType:"enumerated",values:["linear","log","date","category"],editType:"calc+clearAxisTypes"},matches:{valType:"boolean",dflt:!1,editType:"calc"},editType:"calc+clearAxisTypes"},editType:"calc+clearAxisTypes"}),text:n({},e.text,{}),hovertext:n({},e.hovertext,{}),hovertemplate:A(),hovertemplatefallback:t(),xhoverformat:E("x"),yhoverformat:E("y"),marker:f,xaxes:v("x"),yaxes:v("y"),diagonal:{visible:{valType:"boolean",dflt:!0,editType:"calc"},editType:"calc"},showupperhalf:{valType:"boolean",dflt:!0,editType:"calc"},showlowerhalf:{valType:"boolean",dflt:!0,editType:"calc"},selected:{marker:e.selected.marker,editType:"calc"},unselected:{marker:e.unselected.marker,editType:"calc"},opacity:e.opacity}}),Zx=Vt((K,V)=>{V.exports=function(u,d,E,A){A||(A=1/0);var t,e;for(t=0;t{var u=Xr(),d=Gf(),E=y5(),A=nu(),t=Lh(),e=Zx(),r=jx().isOpenSymbol;V.exports=function(o,a,s,f){function v(k,M){return u.coerce(o,a,E,k,M)}var g=d(o,a,{name:"dimensions",handleItemDefaults:i}),m=v("diagonal.visible"),w=v("showupperhalf"),l=v("showlowerhalf"),x=e(a,g,"values");if(!x||!m&&!w&&!l){a.visible=!1;return}v("text"),v("hovertext"),v("hovertemplate"),v("hovertemplatefallback"),v("xhoverformat"),v("yhoverformat"),t(o,a,s,f,v,{noAngleRef:!0,noStandOff:!0});var y=r(a.marker.symbol),S=A.isBubble(a);v("marker.line.width",y||S?1:0),n(o,a,f,v),u.coerceSelectionMarkerOpacity(a,v)};function i(o,a){function s(v,g){return u.coerce(o,a,E.dimensions,v,g)}s("label");var f=s("values");f&&f.length?s("visible"):a.visible=!1,s("axis.type"),s("axis.matches")}function n(o,a,s,f){var v=a.dimensions,g=v.length,m=a.showupperhalf,w=a.showlowerhalf,l=a.diagonal.visible,x,y,S=new Array(g),k=new Array(g);for(x=0;xy&&m||x{var u=Xr();V.exports=function(d,E){var A=d._fullLayout,t=E.uid,e=A._splomScenes;e||(e=A._splomScenes={});var r={dirty:!0,selectBatch:[],unselectBatch:[]},i={matrix:!1,selectBatch:[],unselectBatch:[]},n=e[E.uid];return n||(n=e[t]=u.extendFlat({},r,i),n.draw=function(){n.matrix&&n.matrix.draw&&(n.selectBatch.length||n.unselectBatch.length?n.matrix.draw(n.unselectBatch,n.selectBatch):n.matrix.draw()),n.dirty=!1},n.destroy=function(){n.matrix&&n.matrix.destroy&&n.matrix.destroy(),n.matrixOptions=null,n.selectBatch=null,n.unselectBatch=null,n=null}),n.dirty||u.extendFlat(n,r),n}}),w9=Vt((K,V)=>{var u=Xr(),d=fc(),E=Uh().calcMarkerSize,A=Uh().calcAxisExpansion,t=Nh(),e=P0().markerSelection,r=P0().markerStyle,i=b9(),n=ks().BADNUM,o=Hd().TOO_MANY_POINTS;V.exports=function(a,s){var f=s.dimensions,v=s._length,g={},m=g.cdata=[],w=g.data=[],l=s._visibleDims=[],x,y,S,k,M;function T(P,z){for(var D=P.makeCalcdata({v:z.values,vcalendar:s.calendar},"v"),B=0;Bo,b;for(h?b=g.sizeAvg||Math.max(g.size,3):b=E(s,v),y=0;y{(function(){var u,d,E,A,t,e;typeof performance<"u"&&performance!==null&&performance.now?V.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(V.exports=function(){return(u()-t)/1e6},d=process.hrtime,u=function(){var r;return r=d(),r[0]*1e9+r[1]},A=u(),e=process.uptime()*1e9,t=A-e):Date.now?(V.exports=function(){return Date.now()-E},E=Date.now()):(V.exports=function(){return new Date().getTime()-E},E=new Date().getTime())}).call(K)}),k9=Vt((K,V)=>{var u=T9(),d=window,E=["moz","webkit"],A="AnimationFrame",t=d["request"+A],e=d["cancel"+A]||d["cancelRequest"+A];for(r=0;!t&&r{V.exports=function(u,d){var E=typeof u=="number",A=typeof d=="number";E&&!A?(d=u,u=0):!E&&!A&&(u=0,d=0),u=u|0,d=d|0;var t=d-u;if(t<0)throw new Error("array length must be positive");for(var e=new Array(t),r=0,i=u;r{var u=Y3(),d=bp(),E=C0(),A=k9(),t=A9(),e=Xm(),r=I0();V.exports=i;function i(s,f){if(!(this instanceof i))return new i(s);this.traces=[],this.passes={},this.regl=s,this.scatter=u(s),this.canvas=this.scatter.canvas}i.prototype.render=function(...s){return s.length&&this.update(...s),this.regl.attributes.preserveDrawingBuffer?this.draw():(this.dirty?this.planned==null&&(this.planned=A(()=>{this.draw(),this.dirty=!0,this.planned=null})):(this.draw(),this.dirty=!0,A(()=>{this.dirty=!1})),this)},i.prototype.update=function(...s){if(!s.length)return;for(let g=0;g_||!m.lower&&b<_)continue;let P=n(m.id,b,_),z=this.passes[P]||(this.passes[P]={});if(g.data&&(g.transpose?z.positions={x:{buffer:m.buffer,offset:_,count:y,stride:x},y:{buffer:m.buffer,offset:b,count:y,stride:x}}:z.positions={x:{buffer:m.buffer,offset:_*y,count:y},y:{buffer:m.buffer,offset:b*y,count:y}},z.bounds=o(m.bounds,b,_)),g.domain||g.viewport||g.data){let D=l?o(m.padding,b,_):m.padding;if(m.domain){let[B,R,I,F]=o(m.domain,b,_);z.viewport=[M+B*S+D[0],T+R*k+D[1],M+I*S-D[2],T+F*k-D[3]]}else z.viewport=[M+_*c+c*D[0],T+b*h+h*D[1],M+(_+1)*c-c*D[2],T+(b+1)*h-h*D[3]]}g.color&&(z.color=m.color),g.size&&(z.size=m.size),g.marker&&(z.marker=m.marker),g.borderSize&&(z.borderSize=m.borderSize),g.borderColor&&(z.borderColor=m.borderColor),g.opacity&&(z.opacity=m.opacity),g.range&&(z.range=w?o(m.range,b,_):m.range||z.bounds),m.passes.push(P)}return this},i.prototype.draw=function(...s){if(!s.length)this.scatter.draw();else{let f=[];for(let v=0;v{f[w+x]=g})}this.scatter.draw(...f)}return this},i.prototype.destroy=function(){return this.traces.forEach(s=>{s.buffer&&s.buffer.destroy&&s.buffer.destroy()}),this.traces=null,this.passes=null,this.scatter.destroy(),this};function n(s,f,v){let g=s.id!=null?s.id:s,m=f,w=v;return g<<16|(m&255)<<8|w&255}function o(s,f,v){let g,m,w,l,x=s[f],y=s[v];return x.length>2?(x[0],x[2],g=x[1],m=x[3]):x.length?(g=x[0],m=x[1]):(x.x,g=x.y,x.x+x.width,m=x.y+x.height),y.length>2?(w=y[0],l=y[2],y[1],y[3]):y.length?(w=y[0],l=y[1]):(w=y.x,y.y,l=y.x+y.width,y.y+y.height),[w,g,l,m]}function a(s){if(typeof s=="number")return[s,s,s,s];if(s.length===2)return[s[0],s[1],s[0],s[1]];{let f=e(s);return[f.x,f.y,f.x+f.width,f.y+f.height]}}}),S9=Vt((K,V)=>{var u=M9(),d=Xr(),E=fc(),A=$h().selectMode;V.exports=function(e,r,i){if(i.length)for(var n=0;n-1,R=A(m)||!!o.selectedpoints||B,I=!0;if(R){var F=o._length;if(o.selectedpoints){s.selectBatch=o.selectedpoints;var j=o.selectedpoints,N={};for(x=0;x{K.getDimIndex=function(V,u){for(var d=u._id,E=d.charAt(0),A={x:0,y:1}[E],t=V._visibleDims,e=0;e{var u=x5(),d=Nx().calcHover,E=yo().getFromId,A=So().extendFlat;function t(r,i,n,o,a){a||(a={});var s=(o||"").charAt(0)==="x",f=(o||"").charAt(0)==="y",v=e(r,i,n);if((s||f)&&a.hoversubplots==="axis"&&v[0])for(var g=(s?r.xa:r.ya)._subplotsWith,m=a.gd,w=A({},r),l=0;l{var u=Xr(),d=u.pushUnique,E=nu(),A=x5();V.exports=function(t,e){var r=t.cd,i=r[0].trace,n=r[0].t,o=t.scene,a=o.matrixOptions.cdata,s=t.xaxis,f=t.yaxis,v=[];if(!o)return v;var g=!E.hasMarkers(i)&&!E.hasText(i);if(i.visible!==!0||g)return v;var m=A.getDimIndex(i,s),w=A.getDimIndex(i,f);if(m===!1||w===!1)return v;var l=n.xpx[m],x=n.ypx[w],y=a[m],S=a[w],k=(t.scene.selectBatch||[]).slice(),M=[];if(e!==!1&&!e.degenerate)for(var T=0;T{var u=Xr(),d=Nh(),E=P0().markerStyle;V.exports=function(A,t){var e=t.trace,r=A._fullLayout._splomScenes[e.uid];if(r){d(A,e),u.extendFlat(r.matrixOptions,E(A,e));var i=u.extendFlat({},r.matrixOptions,r.viewOpts);r.matrix.update(i,null)}}}),C9=Vt((K,V)=>{var u=ji(),d=$b();V.exports={moduleType:"trace",name:"splom",categories:["gl","regl","cartesian","symbols","showLegend","scatter-like"],attributes:y5(),supplyDefaults:_9(),colorbar:Zf(),calc:w9(),plot:S9(),hoverPoints:E9().hoverPoints,selectPoints:z9(),editStyle:L9(),meta:{}},u.register(d)}),I9=Vt((K,V)=>{var u=s5(),d=ji(),E=Gx(),A=Pf().getModuleCalcData,t=Yc(),e=fc().getFromId,r=yo().shouldShowZeroLine,i="splom",n={};function o(m){var w=m._fullLayout,l=d.getModule(i),x=A(m.calcdata,l)[0],y=E(m,["ANGLE_instanced_arrays","OES_element_index_uint"],n);y&&(w._hasOnlyLargeSploms&&f(m),l.plot(m,{},x))}function a(m){var w=m.calcdata,l=m._fullLayout;l._hasOnlyLargeSploms&&f(m);for(var x=0;x{var u=C9();u.basePlotModule=I9(),V.exports=u}),O9=Vt((K,V)=>{V.exports=P9()}),_5=Vt((K,V)=>{var u=Wl(),d=Of(),E=yu(),A=Hu().attributes,t=So().extendFlat,e=cl().templatedArray;V.exports={domain:A({name:"parcoords",trace:!0,editType:"plot"}),labelangle:{valType:"angle",dflt:0,editType:"plot"},labelside:{valType:"enumerated",values:["top","bottom"],dflt:"top",editType:"plot"},labelfont:E({editType:"plot"}),tickfont:E({autoShadowDflt:!0,editType:"plot"}),rangefont:E({editType:"plot"}),dimensions:e("dimension",{label:{valType:"string",editType:"plot"},tickvals:t({},d.tickvals,{editType:"plot"}),ticktext:t({},d.ticktext,{editType:"plot"}),tickformat:t({},d.tickformat,{editType:"plot"}),visible:{valType:"boolean",dflt:!0,editType:"plot"},range:{valType:"info_array",items:[{valType:"number",editType:"plot"},{valType:"number",editType:"plot"}],editType:"plot"},constraintrange:{valType:"info_array",freeLength:!0,dimensions:"1-2",items:[{valType:"any",editType:"plot"},{valType:"any",editType:"plot"}],editType:"plot"},multiselect:{valType:"boolean",dflt:!0,editType:"plot"},values:{valType:"data_array",editType:"calc"},editType:"calc"}),line:t({editType:"calc"},u("line",{colorscaleDflt:"Viridis",autoColorDflt:!1,editTypeOverride:"calc"})),unselected:{line:{color:{valType:"color",dflt:"#7f7f7f",editType:"plot"},opacity:{valType:"number",min:0,max:1,dflt:"auto",editType:"plot"},editType:"plot"},editType:"plot"}}}),Fv=Vt((K,V)=>{V.exports={maxDimensionCount:60,overdrag:45,verticalPadding:2,tickDistance:50,canvasPixelRatio:1,blockLineCount:5e3,layers:["contextLineLayer","focusLineLayer","pickLineLayer"],axisTitleOffset:28,axisExtentOffset:10,bar:{width:4,captureWidth:10,fillColor:"magenta",fillOpacity:1,snapDuration:150,snapRatio:.25,snapClose:.01,strokeOpacity:1,strokeWidth:1,handleHeight:8,handleOpacity:1,handleOverlap:0},cn:{axisExtentText:"axis-extent-text",parcoordsLineLayers:"parcoords-line-layers",parcoordsLineLayer:"parcoords-lines",parcoords:"parcoords",parcoordsControlView:"parcoords-control-view",yAxis:"y-axis",axisOverlays:"axis-overlays",axis:"axis",axisHeading:"axis-heading",axisTitle:"axis-title",axisExtent:"axis-extent",axisExtentTop:"axis-extent-top",axisExtentTopText:"axis-extent-top-text",axisExtentBottom:"axis-extent-bottom",axisExtentBottomText:"axis-extent-bottom-text",axisBrush:"axis-brush"},id:{filterBarPattern:"filter-bar-pattern"}}}),wp=Vt((K,V)=>{var u=Rg();function d(E){return[E]}V.exports={keyFun:function(E){return E.key},repeat:d,descend:u,wrap:d,unwrap:function(E){return E[0]}}}),b5=Vt((K,V)=>{var u=Fv(),d=Ni(),E=wp().keyFun,A=wp().repeat,t=Xr().sorterAsc,e=Xr().strTranslate,r=u.bar.snapRatio;function i(N,G){return N*(1-r)+G*r}var n=u.bar.snapClose;function o(N,G){return N*(1-n)+G*n}function a(N,G,rt,ct){if(s(rt,ct))return rt;var st=N?-1:1,et=0,Z=G.length-1;if(st<0){var ot=et;et=Z,Z=ot}for(var X=G[et],Q=X,ut=et;st*ut=G[rt][0]&&N<=G[rt][1])return!0;return!1}function f(N){N.attr("x",-u.bar.captureWidth/2).attr("width",u.bar.captureWidth)}function v(N){N.attr("visibility","visible").style("visibility","visible").attr("fill","yellow").attr("opacity",0)}function g(N){if(!N.brush.filterSpecified)return"0,"+N.height;for(var G=m(N.brush.filter.getConsolidated(),N.height),rt=[0],ct,st,et,Z=G.length?G[0][0]:null,ot=0;otN[1]+rt||G=.9*N[1]+.1*N[0]?"n":G<=.9*N[0]+.1*N[1]?"s":"ns"}function l(){d.select(document.body).style("cursor",null)}function x(N){N.attr("stroke-dasharray",g)}function y(N,G){var rt=d.select(N).selectAll(".highlight, .highlight-shadow"),ct=G?rt.transition().duration(u.bar.snapDuration).each("end",G):rt;x(ct)}function S(N,G){var rt=N.brush,ct=rt.filterSpecified,st=NaN,et={},Z;if(ct){var ot=N.height,X=rt.filter.getConsolidated(),Q=m(X,ot),ut=NaN,J=NaN,q=NaN;for(Z=0;Z<=Q.length;Z++){var it=Q[Z];if(it&&it[0]<=G&&G<=it[1]){ut=Z;break}else if(J=Z?Z-1:NaN,it&&it[0]>G){q=Z;break}}if(st=ut,isNaN(st)&&(isNaN(J)||isNaN(q)?st=isNaN(J)?q:J:st=G-Q[J][1]=Ct[0]&&wt<=Ct[1]){et.clickableOrdinalRange=Ct;break}}}return et}function k(N,G){d.event.sourceEvent.stopPropagation();var rt=G.height-d.mouse(N)[1]-2*u.verticalPadding,ct=G.unitToPaddedPx.invert(rt),st=G.brush,et=S(G,rt),Z=et.interval,ot=st.svgBrush;if(ot.wasDragged=!1,ot.grabbingBar=et.region==="ns",ot.grabbingBar){var X=Z.map(G.unitToPaddedPx);ot.grabPoint=rt-X[0]-u.verticalPadding,ot.barLength=X[1]-X[0]}ot.clickableOrdinalRange=et.clickableOrdinalRange,ot.stayingIntervals=G.multiselect&&st.filterSpecified?st.filter.getConsolidated():[],Z&&(ot.stayingIntervals=ot.stayingIntervals.filter(function(Q){return Q[0]!==Z[0]&&Q[1]!==Z[1]})),ot.startExtent=et.region?Z[et.region==="s"?1:0]:ct,G.parent.inBrushDrag=!0,ot.brushStartCallback()}function M(N,G){d.event.sourceEvent.stopPropagation();var rt=G.height-d.mouse(N)[1]-2*u.verticalPadding,ct=G.brush.svgBrush;ct.wasDragged=!0,ct._dragging=!0,ct.grabbingBar?ct.newExtent=[rt-ct.grabPoint,rt+ct.barLength-ct.grabPoint].map(G.unitToPaddedPx.invert):ct.newExtent=[ct.startExtent,G.unitToPaddedPx.invert(rt)].sort(t),G.brush.filterSpecified=!0,ct.extent=ct.stayingIntervals.concat([ct.newExtent]),ct.brushCallback(G),y(N.parentNode)}function T(N,G){var rt=G.brush,ct=rt.filter,st=rt.svgBrush;st._dragging||(c(N,G),M(N,G),G.brush.svgBrush.wasDragged=!1),st._dragging=!1;var et=d.event;et.sourceEvent.stopPropagation();var Z=st.grabbingBar;if(st.grabbingBar=!1,st.grabLocation=void 0,G.parent.inBrushDrag=!1,l(),!st.wasDragged){st.wasDragged=void 0,st.clickableOrdinalRange?rt.filterSpecified&&G.multiselect?st.extent.push(st.clickableOrdinalRange):(st.extent=[st.clickableOrdinalRange],rt.filterSpecified=!0):Z?(st.extent=st.stayingIntervals,st.extent.length===0&&D(rt)):D(rt),st.brushCallback(G),y(N.parentNode),st.brushEndCallback(rt.filterSpecified?ct.getConsolidated():[]);return}var ot=function(){ct.set(ct.getConsolidated())};if(G.ordinal){var X=G.unitTickvals;X[X.length-1]st.newExtent[0];st.extent=st.stayingIntervals.concat(Q?[st.newExtent]:[]),st.extent.length||D(rt),st.brushCallback(G),Q?y(N.parentNode,ot):(ot(),y(N.parentNode))}else ot();st.brushEndCallback(rt.filterSpecified?ct.getConsolidated():[])}function c(N,G){var rt=G.height-d.mouse(N)[1]-2*u.verticalPadding,ct=S(G,rt),st="crosshair";ct.clickableOrdinalRange?st="pointer":ct.region&&(st=ct.region+"-resize"),d.select(document.body).style("cursor",st)}function h(N){N.on("mousemove",function(G){d.event.preventDefault(),G.parent.inBrushDrag||c(this,G)}).on("mouseleave",function(G){G.parent.inBrushDrag||l()}).call(d.behavior.drag().on("dragstart",function(G){k(this,G)}).on("drag",function(G){M(this,G)}).on("dragend",function(G){T(this,G)}))}function b(N,G){return N[0]-G[0]}function _(N,G,rt){var ct=rt._context.staticPlot,st=N.selectAll(".background").data(A);st.enter().append("rect").classed("background",!0).call(f).call(v).style("pointer-events",ct?"none":"auto").attr("transform",e(0,u.verticalPadding)),st.call(h).attr("height",function(ot){return ot.height-u.verticalPadding});var et=N.selectAll(".highlight-shadow").data(A);et.enter().append("line").classed("highlight-shadow",!0).attr("x",-u.bar.width/2).attr("stroke-width",u.bar.width+u.bar.strokeWidth).attr("stroke",G).attr("opacity",u.bar.strokeOpacity).attr("stroke-linecap","butt"),et.attr("y1",function(ot){return ot.height}).call(x);var Z=N.selectAll(".highlight").data(A);Z.enter().append("line").classed("highlight",!0).attr("x",-u.bar.width/2).attr("stroke-width",u.bar.width-u.bar.strokeWidth).attr("stroke",u.bar.fillColor).attr("opacity",u.bar.fillOpacity).attr("stroke-linecap","butt"),Z.attr("y1",function(ot){return ot.height}).call(x)}function P(N,G,rt){var ct=N.selectAll("."+u.cn.axisBrush).data(A,E);ct.enter().append("g").classed(u.cn.axisBrush,!0),_(ct,G,rt)}function z(N){return N.svgBrush.extent.map(function(G){return G.slice()})}function D(N){N.filterSpecified=!1,N.svgBrush.extent=[[-1/0,1/0]]}function B(N){return function(G){var rt=G.brush,ct=z(rt),st=ct.slice();rt.filter.set(st),N()}}function R(N){for(var G=N.slice(),rt=[],ct,st=G.shift();st;){for(ct=st.slice();(st=G.shift())&&st[0]<=ct[1];)ct[1]=Math.max(ct[1],st[1]);rt.push(ct)}return rt.length===1&&rt[0][0]>rt[0][1]&&(rt=[]),rt}function I(){var N=[],G,rt;return{set:function(ct){N=ct.map(function(st){return st.slice().sort(t)}).sort(b),N.length===1&&N[0][0]===-1/0&&N[0][1]===1/0&&(N=[[0,-1]]),G=R(N),rt=N.reduce(function(st,et){return[Math.min(st[0],et[0]),Math.max(st[1],et[1])]},[1/0,-1/0])},get:function(){return N.slice()},getConsolidated:function(){return G},getBounds:function(){return rt}}}function F(N,G,rt,ct,st,et){var Z=I();return Z.set(rt),{filter:Z,filterSpecified:G,svgBrush:{extent:[],brushStartCallback:ct,brushCallback:B(st),brushEndCallback:et}}}function j(N,G){if(Array.isArray(N[0])?(N=N.map(function(ct){return ct.sort(t)}),G.multiselect?N=R(N.sort(b)):N=[N[0]]):N=[N.sort(t)],G.tickvals){var rt=G.tickvals.slice().sort(t);if(N=N.map(function(ct){var st=[a(0,rt,ct[0],[]),a(1,rt,ct[1],[])];if(st[1]>st[0])return st}).filter(function(ct){return ct}),!N.length)return}return N.length>1?N:N[0]}V.exports={makeBrush:F,ensureAxisBrush:P,cleanRanges:j}}),D9=Vt((K,V)=>{var u=Xr(),d=ah().hasColorscale,E=vf(),A=Hu().defaults,t=Gf(),e=yo(),r=_5(),i=b5(),n=Fv().maxDimensionCount,o=Zx();function a(f,v,g,m,w){var l=w("line.color",g);if(d(f,"line")&&u.isArrayOrTypedArray(l)){if(l.length)return w("line.colorscale"),E(f,v,m,w,{prefix:"line.",cLetter:"c"}),l.length;v.line.color=g}return 1/0}function s(f,v,g,m){function w(k,M){return u.coerce(f,v,r.dimensions,k,M)}var l=w("values"),x=w("visible");if(l&&l.length||(x=v.visible=!1),x){w("label"),w("tickvals"),w("ticktext"),w("tickformat");var y=w("range");v._ax={_id:"y",type:"linear",showexponent:"all",exponentformat:"B",range:y},e.setConvert(v._ax,m.layout),w("multiselect");var S=w("constraintrange");S&&(v.constraintrange=i.cleanRanges(S,v))}}V.exports=function(f,v,g,m){function w(k,M){return u.coerce(f,v,r,k,M)}var l=f.dimensions;Array.isArray(l)&&l.length>n&&(u.log("parcoords traces support up to "+n+" dimensions at the moment"),l.splice(n));var x=t(f,v,{name:"dimensions",layout:m,handleItemDefaults:s}),y=a(f,v,g,m,w);A(v,m,w),(!Array.isArray(x)||!x.length)&&(v.visible=!1),o(v,x,"values",y);var S=u.extendFlat({},m.font,{size:Math.round(m.font.size/1.2)});u.coerceFont(w,"labelfont",S),u.coerceFont(w,"tickfont",S,{autoShadowDflt:!0}),u.coerceFont(w,"rangefont",S),w("labelangle"),w("labelside"),w("unselected.line.color"),w("unselected.line.opacity")}}),F9=Vt((K,V)=>{var u=Xr().isArrayOrTypedArray,d=xu(),E=wp().wrap;V.exports=function(t,e){var r,i;return d.hasColorscale(e,"line")&&u(e.line.color)?(r=e.line.color,i=d.extractOpts(e.line).colorscale,d.calc(t,e,{vals:r,containerStr:"line",cLetter:"c"})):(r=A(e._length),i=[[0,e.line.color],[1,e.line.color]]),E({lineColor:r,cscale:i})};function A(t){for(var e=new Array(t),r=0;r>>16,(K&65280)>>>8,K&255],alpha:1};if(typeof K=="number")return{space:"rgb",values:[K>>>16,(K&65280)>>>8,K&255],alpha:1};if(K=String(K).toLowerCase(),Kx.default[K])E=Kx.default[K].slice(),t="rgb";else if(K==="transparent")A=0,t="rgb",E=[0,0,0];else if(K[0]==="#"){var e=K.slice(1),r=e.length,i=r<=4;A=1,i?(E=[parseInt(e[0]+e[0],16),parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16)],r===4&&(A=parseInt(e[3]+e[3],16)/255)):(E=[parseInt(e[0]+e[1],16),parseInt(e[2]+e[3],16),parseInt(e[4]+e[5],16)],r===8&&(A=parseInt(e[6]+e[7],16)/255)),E[0]||(E[0]=0),E[1]||(E[1]=0),E[2]||(E[2]=0),t="rgb"}else if(d=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(K)){var n=d[1];t=n.replace(/a$/,"");var o=t==="cmyk"?4:t==="gray"?1:3;E=d[2].trim().split(/\s*[,\/]\s*|\s+/),t==="color"&&(t=E.shift()),E=E.map(function(a,s){if(a[a.length-1]==="%")return a=parseFloat(a)/100,s===3?a:t==="rgb"?a*255:t[0]==="h"||t[0]==="l"&&!s?a*100:t==="lab"?a*125:t==="lch"?s<2?a*150:a*360:t[0]==="o"&&!s?a:t==="oklab"?a*.4:t==="oklch"?s<2?a*.4:a*360:a;if(t[s]==="h"||s===2&&t[t.length-1]==="h"){if(Yx[a]!==void 0)return Yx[a];if(a.endsWith("deg"))return parseFloat(a);if(a.endsWith("turn"))return parseFloat(a)*360;if(a.endsWith("grad"))return parseFloat(a)*360/400;if(a.endsWith("rad"))return parseFloat(a)*180/Math.PI}return a==="none"?0:parseFloat(a)}),A=E.length>o?E.pop():1}else/[0-9](?:\s|\/|,)/.test(K)&&(E=K.match(/([0-9]+)/g).map(function(a){return parseFloat(a)}),t=((u=(V=K.match(/([a-z])/ig))==null?void 0:V.join(""))==null?void 0:u.toLowerCase())||"rgb");return{space:t,values:E,alpha:A}}var Kx,w5,Yx,R9=Bl(()=>{Kx=Z4(k3()),w5=B9,Yx={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}}),Bv,T5=Bl(()=>{Bv={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}}),Rv,N9=Bl(()=>{T5(),Rv={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(K){var V=K[0]/360,u=K[1]/100,d=K[2]/100,E,A,t,e,r,i=0;if(u===0)return r=d*255,[r,r,r];for(A=d<.5?d*(1+u):d+u-d*u,E=2*d-A,e=[0,0,0];i<3;)t=V+1/3*-(i-1),t<0?t++:t>1&&t--,r=6*t<1?E+(A-E)*6*t:2*t<1?A:3*t<2?E+(A-E)*(2/3-t)*6:E,e[i++]=r*255;return e}},Bv.hsl=function(K){var V=K[0]/255,u=K[1]/255,d=K[2]/255,E=Math.min(V,u,d),A=Math.max(V,u,d),t=A-E,e,r,i;return A===E?e=0:V===A?e=(u-d)/t:u===A?e=2+(d-V)/t:d===A&&(e=4+(V-u)/t),e=Math.min(e*60,360),e<0&&(e+=360),i=(E+A)/2,A===E?r=0:i<=.5?r=t/(A+E):r=t/(2-A-E),[e,r*100,i*100]}}),k5={};$_(k5,{default:()=>j9});function j9(K){Array.isArray(K)&&K.raw&&(K=String.raw(...arguments)),K instanceof Number&&(K=+K);var V,u=w5(K);if(!u.space)return[];let d=u.space[0]==="h"?Rv.min:Bv.min,E=u.space[0]==="h"?Rv.max:Bv.max;return V=Array(3),V[0]=Math.min(Math.max(u.values[0],d[0]),E[0]),V[1]=Math.min(Math.max(u.values[1],d[1]),E[1]),V[2]=Math.min(Math.max(u.values[2],d[2]),E[2]),u.space[0]==="h"&&(V=Rv.rgb(V)),V.push(Math.min(Math.max(u.alpha,0),1)),V}var U9=Bl(()=>{R9(),T5(),N9()}),A5=Vt(K=>{var V=Xr().isTypedArray;K.convertTypedArray=function(u){return V(u)?Array.prototype.slice.call(u):u},K.isOrdinal=function(u){return!!u.tickvals},K.isVisible=function(u){return u.visible||!("visible"in u)}}),V9=Vt((K,V)=>{var u=["precision highp float;","","varying vec4 fragColor;","","attribute vec4 p01_04, p05_08, p09_12, p13_16,"," p17_20, p21_24, p25_28, p29_32,"," p33_36, p37_40, p41_44, p45_48,"," p49_52, p53_56, p57_60, colors;","","uniform mat4 dim0A, dim1A, dim0B, dim1B, dim0C, dim1C, dim0D, dim1D,"," loA, hiA, loB, hiB, loC, hiC, loD, hiD;","","uniform vec2 resolution, viewBoxPos, viewBoxSize;","uniform float maskHeight;","uniform float drwLayer; // 0: context, 1: focus, 2: pick","uniform vec4 contextColor;","uniform sampler2D maskTexture, palette;","","bool isPick = (drwLayer > 1.5);","bool isContext = (drwLayer < 0.5);","","const vec4 ZEROS = vec4(0.0, 0.0, 0.0, 0.0);","const vec4 UNITS = vec4(1.0, 1.0, 1.0, 1.0);","","float val(mat4 p, mat4 v) {"," return dot(matrixCompMult(p, v) * UNITS, UNITS);","}","","float axisY(float ratio, mat4 A, mat4 B, mat4 C, mat4 D) {"," float y1 = val(A, dim0A) + val(B, dim0B) + val(C, dim0C) + val(D, dim0D);"," float y2 = val(A, dim1A) + val(B, dim1B) + val(C, dim1C) + val(D, dim1D);"," return y1 * (1.0 - ratio) + y2 * ratio;","}","","int iMod(int a, int b) {"," return a - b * (a / b);","}","","bool fOutside(float p, float lo, float hi) {"," return (lo < hi) && (lo > p || p > hi);","}","","bool vOutside(vec4 p, vec4 lo, vec4 hi) {"," return ("," fOutside(p[0], lo[0], hi[0]) ||"," fOutside(p[1], lo[1], hi[1]) ||"," fOutside(p[2], lo[2], hi[2]) ||"," fOutside(p[3], lo[3], hi[3])"," );","}","","bool mOutside(mat4 p, mat4 lo, mat4 hi) {"," return ("," vOutside(p[0], lo[0], hi[0]) ||"," vOutside(p[1], lo[1], hi[1]) ||"," vOutside(p[2], lo[2], hi[2]) ||"," vOutside(p[3], lo[3], hi[3])"," );","}","","bool outsideBoundingBox(mat4 A, mat4 B, mat4 C, mat4 D) {"," return mOutside(A, loA, hiA) ||"," mOutside(B, loB, hiB) ||"," mOutside(C, loC, hiC) ||"," mOutside(D, loD, hiD);","}","","bool outsideRasterMask(mat4 A, mat4 B, mat4 C, mat4 D) {"," mat4 pnts[4];"," pnts[0] = A;"," pnts[1] = B;"," pnts[2] = C;"," pnts[3] = D;",""," for(int i = 0; i < 4; ++i) {"," for(int j = 0; j < 4; ++j) {"," for(int k = 0; k < 4; ++k) {"," if(0 == iMod("," int(255.0 * texture2D(maskTexture,"," vec2("," (float(i * 2 + j / 2) + 0.5) / 8.0,"," (pnts[i][j][k] * (maskHeight - 1.0) + 1.0) / maskHeight"," ))[3]"," ) / int(pow(2.0, float(iMod(j * 4 + k, 8)))),"," 2"," )) return true;"," }"," }"," }"," return false;","}","","vec4 position(bool isContext, float v, mat4 A, mat4 B, mat4 C, mat4 D) {"," float x = 0.5 * sign(v) + 0.5;"," float y = axisY(x, A, B, C, D);"," float z = 1.0 - abs(v);",""," z += isContext ? 0.0 : 2.0 * float("," outsideBoundingBox(A, B, C, D) ||"," outsideRasterMask(A, B, C, D)"," );",""," return vec4("," 2.0 * (vec2(x, y) * viewBoxSize + viewBoxPos) / resolution - 1.0,"," z,"," 1.0"," );","}","","void main() {"," mat4 A = mat4(p01_04, p05_08, p09_12, p13_16);"," mat4 B = mat4(p17_20, p21_24, p25_28, p29_32);"," mat4 C = mat4(p33_36, p37_40, p41_44, p45_48);"," mat4 D = mat4(p49_52, p53_56, p57_60, ZEROS);",""," float v = colors[3];",""," gl_Position = position(isContext, v, A, B, C, D);",""," fragColor ="," isContext ? vec4(contextColor) :"," isPick ? vec4(colors.rgb, 1.0) : texture2D(palette, vec2(abs(v), 0.5));","}"].join(` +`),d=["precision highp float;","","varying vec4 fragColor;","","void main() {"," gl_FragColor = fragColor;","}"].join(` +`),E=Fv().maxDimensionCount,A=Xr(),t=1e-6,e=2048,r=new Uint8Array(4),i=new Uint8Array(4),n={shape:[256,1],format:"rgba",type:"uint8",mag:"nearest",min:"nearest"};function o(T){T.read({x:0,y:0,width:1,height:1,data:r})}function a(T,c,h,b,_){var P=T._gl;P.enable(P.SCISSOR_TEST),P.scissor(c,h,b,_),T.clear({color:[0,0,0,0],depth:1})}function s(T,c,h,b,_,P){var z=P.key;function D(B){var R=Math.min(b,_-B*b);B===0&&(window.cancelAnimationFrame(h.currentRafs[z]),delete h.currentRafs[z],a(T,P.scissorX,P.scissorY,P.scissorWidth,P.viewBoxSize[1])),!h.clearOnly&&(P.count=2*R,P.offset=2*B*b,c(P),B*b+R<_&&(h.currentRafs[z]=window.requestAnimationFrame(function(){D(B+1)})),h.drawCompleted=!1)}h.drawCompleted||(o(T),h.drawCompleted=!0),D(0)}function f(T){return Math.max(t,Math.min(1-t,T))}function v(T,c){for(var h=new Array(256),b=0;b<256;b++)h[b]=T(b/255).concat(c);return h}function g(T,c){return(T>>>8*c)%256/255}function m(T,c,h){for(var b=new Array(T*(E+4)),_=0,P=0;PIt&&(It=J[dt].dim1.canvasX,wt=dt);nt===0&&a(_,0,0,R.canvasWidth,R.canvasHeight);var Nt=Z(h);for(dt=0;dt{var u=Ni(),d=Xr(),E=d.isArrayOrTypedArray,A=d.numberFormat,t=(U9(),xd(k5)).default,e=yo(),r=d.strRotate,i=d.strTranslate,n=Dl(),o=Eo(),a=xu(),s=wp(),f=s.keyFun,v=s.repeat,g=s.unwrap,m=A5(),w=Fv(),l=b5(),x=V9();function y(ct,st,et){return d.aggNums(ct,null,st,et)}function S(ct,st){return M(y(Math.min,ct,st),y(Math.max,ct,st))}function k(ct){var st=ct.range;return st?M(st[0],st[1]):S(ct.values,ct._length)}function M(ct,st){return(isNaN(ct)||!isFinite(ct))&&(ct=0),(isNaN(st)||!isFinite(st))&&(st=0),ct===st&&(ct===0?(ct-=1,st+=1):(ct*=.9,st*=1.1)),[ct,st]}function T(ct,st){return st?function(et,Z){var ot=st[Z];return ot??ct(et)}:ct}function c(ct,st,et,Z,ot){var X=k(et);return Z?u.scale.ordinal().domain(Z.map(T(A(et.tickformat),ot))).range(Z.map(function(Q){var ut=(Q-X[0])/(X[1]-X[0]);return ct-st+ut*(2*st-ct)})):u.scale.linear().domain(X).range([ct-st,st])}function h(ct,st){return u.scale.linear().range([st,ct-st])}function b(ct,st){return u.scale.linear().domain(k(ct)).range([st,1-st])}function _(ct){if(ct.tickvals){var st=k(ct);return u.scale.ordinal().domain(ct.tickvals).range(ct.tickvals.map(function(et){return(et-st[0])/(st[1]-st[0])}))}}function P(ct){var st=ct.map(function(X){return X[0]}),et=ct.map(function(X){var Q=t(X[1]);return u.rgb("rgb("+Q[0]+","+Q[1]+","+Q[2]+")")}),Z=function(X){return function(Q){return Q[X]}},ot="rgb".split("").map(function(X){return u.scale.linear().clamp(!0).domain(st).range(et.map(Z(X)))});return function(X){return ot.map(function(Q){return Q(X)})}}function z(ct){return ct.dimensions.some(function(st){return st.brush.filterSpecified})}function D(ct,st,et){var Z=g(st),ot=Z.trace,X=m.convertTypedArray(Z.lineColor),Q=ot.line,ut={color:t(ot.unselected.line.color),opacity:ot.unselected.line.opacity},J=a.extractOpts(Q),q=J.reversescale?a.flipScale(Z.cscale):Z.cscale,it=ot.domain,nt=ot.dimensions,dt=ct.width,Tt=ot.labelangle,wt=ot.labelside,Ct=ot.labelfont,It=ot.tickfont,Nt=ot.rangefont,te=d.extendDeepNoArrays({},Q,{color:X.map(u.scale.linear().domain(k({values:X,range:[J.min,J.max],_length:ot._length}))),blockLineCount:w.blockLineCount,canvasOverdrag:w.overdrag*w.canvasPixelRatio}),Jt=Math.floor(dt*(it.x[1]-it.x[0])),ee=Math.floor(ct.height*(it.y[1]-it.y[0])),Zt=ct.margin||{l:80,r:80,t:100,b:80},mt=Jt,bt=ee;return{key:et,colCount:nt.filter(m.isVisible).length,dimensions:nt,tickDistance:w.tickDistance,unitToColor:P(q),lines:te,deselectedLines:ut,labelAngle:Tt,labelSide:wt,labelFont:Ct,tickFont:It,rangeFont:Nt,layoutWidth:dt,layoutHeight:ct.height,domain:it,translateX:it.x[0]*dt,translateY:ct.height-it.y[1]*ct.height,pad:Zt,canvasWidth:mt*w.canvasPixelRatio+2*te.canvasOverdrag,canvasHeight:bt*w.canvasPixelRatio,width:mt,height:bt,canvasPixelRatio:w.canvasPixelRatio}}function B(ct,st,et){var Z=et.width,ot=et.height,X=et.dimensions,Q=et.canvasPixelRatio,ut=function(dt){return Z*dt/Math.max(1,et.colCount-1)},J=w.verticalPadding/ot,q=h(ot,w.verticalPadding),it={key:et.key,xScale:ut,model:et,inBrushDrag:!1},nt={};return it.dimensions=X.filter(m.isVisible).map(function(dt,Tt){var wt=b(dt,J),Ct=nt[dt.label];nt[dt.label]=(Ct||0)+1;var It=dt.label+(Ct?"__"+Ct:""),Nt=dt.constraintrange,te=Nt&&Nt.length;te&&!E(Nt[0])&&(Nt=[Nt]);var Jt=te?Nt.map(function(Me){return Me.map(wt)}):[[-1/0,1/0]],ee=function(){var Me=it;Me.focusLayer&&Me.focusLayer.render(Me.panels,!0);var Ce=z(Me);!ct.contextShown()&&Ce?(Me.contextLayer&&Me.contextLayer.render(Me.panels,!0),ct.contextShown(!0)):ct.contextShown()&&!Ce&&(Me.contextLayer&&Me.contextLayer.render(Me.panels,!0,!0),ct.contextShown(!1))},Zt=dt.values;Zt.length>dt._length&&(Zt=Zt.slice(0,dt._length));var mt=dt.tickvals,bt;function vt(Me,Ce){return{val:Me,text:bt[Ce]}}function Ut(Me,Ce){return Me.val-Ce.val}if(E(mt)&&mt.length){d.isTypedArray(mt)&&(mt=Array.from(mt)),bt=dt.ticktext,!E(bt)||!bt.length?bt=mt.map(A(dt.tickformat)):bt.length>mt.length?bt=bt.slice(0,mt.length):mt.length>bt.length&&(mt=mt.slice(0,bt.length));for(var re=1;re=Me||vr>=Ce)return;var _r=Kt.lineLayer.readPixel(qe,Ce-1-vr),er=_r[3]!==0,Mr=er?_r[2]+256*(_r[1]+256*_r[0]):null,Ir={x:qe,y:vr,clientX:ue.clientX,clientY:ue.clientY,dataIndex:Kt.model.key,curveNumber:Mr};Mr!==Tt&&(er?Z.hover(Ir):Z.unhover&&Z.unhover(Ir),Tt=Mr)}}),dt.style("opacity",function(Kt){return Kt.pick?0:1}),Q.style("background","rgba(255, 255, 255, 0)");var Ct=Q.selectAll("."+w.cn.parcoords).data(nt,f);Ct.exit().remove(),Ct.enter().append("g").classed(w.cn.parcoords,!0).style("shape-rendering","crispEdges").style("pointer-events","none"),Ct.attr("transform",function(Kt){return i(Kt.model.translateX,Kt.model.translateY)});var It=Ct.selectAll("."+w.cn.parcoordsControlView).data(v,f);It.enter().append("g").classed(w.cn.parcoordsControlView,!0),It.attr("transform",function(Kt){return i(Kt.model.pad.l,Kt.model.pad.t)});var Nt=It.selectAll("."+w.cn.yAxis).data(function(Kt){return Kt.dimensions},f);Nt.enter().append("g").classed(w.cn.yAxis,!0),It.each(function(Kt){j(Nt,Kt,J)}),dt.each(function(Kt){if(Kt.viewModel){!Kt.lineLayer||Z?Kt.lineLayer=x(this,Kt):Kt.lineLayer.update(Kt),(Kt.key||Kt.key===0)&&(Kt.viewModel[Kt.key]=Kt.lineLayer);var ue=!Kt.context||Z;Kt.lineLayer.render(Kt.viewModel.panels,ue)}}),Nt.attr("transform",function(Kt){return i(Kt.xScale(Kt.xIndex),0)}),Nt.call(u.behavior.drag().origin(function(Kt){return Kt}).on("drag",function(Kt){var ue=Kt.parent;it.linePickActive(!1),Kt.x=Math.max(-w.overdrag,Math.min(Kt.model.width+w.overdrag,u.event.x)),Kt.canvasX=Kt.x*Kt.model.canvasPixelRatio,Nt.sort(function(Me,Ce){return Me.x-Ce.x}).each(function(Me,Ce){Me.xIndex=Ce,Me.x=Kt===Me?Me.x:Me.xScale(Me.xIndex),Me.canvasX=Me.x*Me.model.canvasPixelRatio}),j(Nt,ue,J),Nt.filter(function(Me){return Math.abs(Kt.xIndex-Me.xIndex)!==0}).attr("transform",function(Me){return i(Me.xScale(Me.xIndex),0)}),u.select(this).attr("transform",i(Kt.x,0)),Nt.each(function(Me,Ce,We){We===Kt.parent.key&&(ue.dimensions[Ce]=Me)}),ue.contextLayer&&ue.contextLayer.render(ue.panels,!1,!z(ue)),ue.focusLayer.render&&ue.focusLayer.render(ue.panels)}).on("dragend",function(Kt){var ue=Kt.parent;Kt.x=Kt.xScale(Kt.xIndex),Kt.canvasX=Kt.x*Kt.model.canvasPixelRatio,j(Nt,ue,J),u.select(this).attr("transform",function(Me){return i(Me.x,0)}),ue.contextLayer&&ue.contextLayer.render(ue.panels,!1,!z(ue)),ue.focusLayer&&ue.focusLayer.render(ue.panels),ue.pickLayer&&ue.pickLayer.render(ue.panels,!0),it.linePickActive(!0),Z&&Z.axesMoved&&Z.axesMoved(ue.key,ue.dimensions.map(function(Me){return Me.crossfilterDimensionIndex}))})),Nt.exit().remove();var te=Nt.selectAll("."+w.cn.axisOverlays).data(v,f);te.enter().append("g").classed(w.cn.axisOverlays,!0),te.selectAll("."+w.cn.axis).remove();var Jt=te.selectAll("."+w.cn.axis).data(v,f);Jt.enter().append("g").classed(w.cn.axis,!0),Jt.each(function(Kt){var ue=Kt.model.height/Kt.model.tickDistance,Me=Kt.domainScale,Ce=Me.domain();u.select(this).call(u.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(ue,Kt.tickFormat).tickValues(Kt.ordinal?Ce:null).tickFormat(function(We){return m.isOrdinal(Kt)?We:G(Kt.model.dimensions[Kt.visibleIndex],We)}).scale(Me)),o.font(Jt.selectAll("text"),Kt.model.tickFont)}),Jt.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),Jt.selectAll("text").style("cursor","default");var ee=te.selectAll("."+w.cn.axisHeading).data(v,f);ee.enter().append("g").classed(w.cn.axisHeading,!0);var Zt=ee.selectAll("."+w.cn.axisTitle).data(v,f);Zt.enter().append("text").classed(w.cn.axisTitle,!0).attr("text-anchor","middle").style("cursor","ew-resize").style("pointer-events",ot?"none":"auto"),Zt.text(function(Kt){return Kt.label}).each(function(Kt){var ue=u.select(this);o.font(ue,Kt.model.labelFont),n.convertToTspans(ue,ct)}).attr("transform",function(Kt){var ue=F(Kt.model.labelAngle,Kt.model.labelSide),Me=w.axisTitleOffset;return(ue.dir>0?"":i(0,2*Me+Kt.model.height))+r(ue.degrees)+i(-Me*ue.dx,-Me*ue.dy)}).attr("text-anchor",function(Kt){var ue=F(Kt.model.labelAngle,Kt.model.labelSide),Me=Math.abs(ue.dx),Ce=Math.abs(ue.dy);return 2*Me>Ce?ue.dir*ue.dx<0?"start":"end":"middle"});var mt=te.selectAll("."+w.cn.axisExtent).data(v,f);mt.enter().append("g").classed(w.cn.axisExtent,!0);var bt=mt.selectAll("."+w.cn.axisExtentTop).data(v,f);bt.enter().append("g").classed(w.cn.axisExtentTop,!0),bt.attr("transform",i(0,-w.axisExtentOffset));var vt=bt.selectAll("."+w.cn.axisExtentTopText).data(v,f);vt.enter().append("text").classed(w.cn.axisExtentTopText,!0).call(R),vt.text(function(Kt){return rt(Kt,!0)}).each(function(Kt){o.font(u.select(this),Kt.model.rangeFont)});var Ut=mt.selectAll("."+w.cn.axisExtentBottom).data(v,f);Ut.enter().append("g").classed(w.cn.axisExtentBottom,!0),Ut.attr("transform",function(Kt){return i(0,Kt.model.height+w.axisExtentOffset)});var re=Ut.selectAll("."+w.cn.axisExtentBottomText).data(v,f);re.enter().append("text").classed(w.cn.axisExtentBottomText,!0).attr("dy","0.75em").call(R),re.text(function(Kt){return rt(Kt,!1)}).each(function(Kt){o.font(u.select(this),Kt.model.rangeFont)}),l.ensureAxisBrush(te,q,ct)}}),M5=Vt((r,V)=>{var u=H9(),d=Gx(),E=A5().isVisible,A={};function t(i,n,o){var a=n.indexOf(o),s=i.indexOf(a);return s===-1&&(s+=n.length),s}function e(i,n){return function(o,a){return t(i,n,o)-t(i,n,a)}}var r=V.exports=function(i,n){var o=i._fullLayout,a=d(i,[],A);if(a){var s={},f={},v={},g={},m=o._size;n.forEach(function(S,k){var M=S[0].trace;v[k]=M.index;var T=g[k]=M.index;s[k]=i.data[T].dimensions,f[k]=i.data[T].dimensions.slice()});var w=function(S,k,M){var T=f[S][k],c=M.map(function(D){return D.slice()}),h="dimensions["+k+"].constraintrange",b=o._tracePreGUI[i._fullData[v[S]]._fullInput.uid];if(b[h]===void 0){var _=T.constraintrange;b[h]=_||null}var P=i._fullData[v[S]].dimensions[k];c.length?(c.length===1&&(c=c[0]),T.constraintrange=c,P.constraintrange=c.slice(),c=[c]):(delete T.constraintrange,delete P.constraintrange,c=null);var z={};z[h]=c,i.emit("plotly_restyle",[z,[g[S]]])},l=function(S){i.emit("plotly_hover",S)},x=function(S){i.emit("plotly_unhover",S)},y=function(S,k){var M=e(k,f[S].filter(E));s[S].sort(M),f[S].filter(function(T){return!E(T)}).sort(function(T){return f[S].indexOf(T)}).forEach(function(T){s[S].splice(s[S].indexOf(T),1),s[S].splice(f[S].indexOf(T),0,T)}),i.emit("plotly_restyle",[{dimensions:[s[S]]},[g[S]]])};u(i,n,{width:m.w,height:m.h,margin:{t:m.t,r:m.r,b:m.b,l:m.l}},{filterChanged:w,hover:l,unhover:x,axesMoved:y})}};r.reglPrecompiled=A}),q9=Vt(K=>{var V=Ni(),u=Pf().getModuleCalcData,d=M5(),E=zh();K.name="parcoords",K.plot=function(A){var t=u(A.calcdata,"parcoords")[0];t.length&&d(A,t)},K.clean=function(A,t,e,r){var i=r._has&&r._has("parcoords"),n=t._has&&t._has("parcoords");i&&!n&&(r._paperdiv.selectAll(".parcoords").remove(),r._glimages.selectAll("*").remove())},K.toSVG=function(A){var t=A._fullLayout._glimages,e=V.select(A).selectAll(".svg-container"),r=e.filter(function(n,o){return o===e.size()-1}).selectAll(".gl-canvas-context, .gl-canvas-focus");function i(){var n=this,o=n.toDataURL("image/png"),a=t.append("svg:image");a.attr({xmlns:E.svg,"xlink:href":o,preserveAspectRatio:"none",x:0,y:0,width:n.style.width,height:n.style.height})}r.each(i),window.setTimeout(function(){V.selectAll("#filterBarPattern").attr("id","filterBarPattern")},60)}}),W9=Vt((K,V)=>{V.exports={attributes:_5(),supplyDefaults:D9(),calc:F9(),colorbar:{container:"line",min:"cmin",max:"cmax"},moduleType:"trace",name:"parcoords",basePlotModule:q9(),categories:["gl","regl","noOpacity","noHover"],meta:{}}}),G9=Vt((K,V)=>{var u=W9();u.plot=M5(),V.exports=u}),Z9=Vt((K,V)=>{V.exports=G9()}),S5=Vt((K,V)=>{var u=So().extendFlat,d=kl(),E=yu(),A=Wl(),{hovertemplateAttrs:t,templatefallbackAttrs:e}=yl(),r=Hu().attributes,i=u({editType:"calc"},A("line",{editTypeOverride:"calc"}),{shape:{valType:"enumerated",values:["linear","hspline"],dflt:"linear",editType:"plot"},hovertemplate:t({editType:"plot",arrayOk:!1},{keys:["count","probability"]}),hovertemplatefallback:e({editType:"plot"})});V.exports={domain:r({name:"parcats",trace:!0,editType:"calc"}),hoverinfo:u({},d.hoverinfo,{flags:["count","probability"],editType:"plot",arrayOk:!1}),hoveron:{valType:"enumerated",values:["category","color","dimension"],dflt:"category",editType:"plot"},hovertemplate:t({editType:"plot",arrayOk:!1},{keys:["count","probability","category","categorycount","colorcount","bandcolorcount"]}),hovertemplatefallback:e({editType:"plot"}),arrangement:{valType:"enumerated",values:["perpendicular","freeform","fixed"],dflt:"perpendicular",editType:"plot"},bundlecolors:{valType:"boolean",dflt:!0,editType:"plot"},sortpaths:{valType:"enumerated",values:["forward","backward"],dflt:"forward",editType:"plot"},labelfont:E({editType:"calc"}),tickfont:E({autoShadowDflt:!0,editType:"calc"}),dimensions:{_isLinkedToArray:"dimension",label:{valType:"string",editType:"calc"},categoryorder:{valType:"enumerated",values:["trace","category ascending","category descending","array"],dflt:"trace",editType:"calc"},categoryarray:{valType:"data_array",editType:"calc"},ticktext:{valType:"data_array",editType:"calc"},values:{valType:"data_array",dflt:[],editType:"calc"},displayindex:{valType:"integer",editType:"calc"},editType:"calc",visible:{valType:"boolean",dflt:!0,editType:"calc"}},line:i,counts:{valType:"number",min:0,dflt:1,arrayOk:!0,editType:"calc"},customdata:void 0,hoverlabel:void 0,ids:void 0,legend:void 0,legendgroup:void 0,legendrank:void 0,opacity:void 0,selectedpoints:void 0,showlegend:void 0}}),K9=Vt((K,V)=>{var u=Xr(),d=ah().hasColorscale,E=vf(),A=Hu().defaults,t=Gf(),e=S5(),r=Zx(),i=nh().isTypedArraySpec;function n(a,s,f,v,g){g("line.shape"),g("line.hovertemplate"),g("line.hovertemplatefallback");var m=g("line.color",v.colorway[0]);if(d(a,"line")&&u.isArrayOrTypedArray(m)){if(m.length)return g("line.colorscale"),E(a,s,v,g,{prefix:"line.",cLetter:"c"}),m.length;s.line.color=f}return 1/0}function o(a,s){function f(y,S){return u.coerce(a,s,e.dimensions,y,S)}var v=f("values"),g=f("visible");if(v&&v.length||(g=s.visible=!1),g){f("label"),f("displayindex",s._index);var m=a.categoryarray,w=u.isArrayOrTypedArray(m)&&m.length>0||i(m),l;w&&(l="array");var x=f("categoryorder",l);x==="array"?(f("categoryarray"),f("ticktext")):(delete a.categoryarray,delete a.ticktext),!w&&x==="array"&&(s.categoryorder="trace")}}V.exports=function(a,s,f,v){function g(x,y){return u.coerce(a,s,e,x,y)}var m=t(a,s,{name:"dimensions",handleItemDefaults:o}),w=n(a,s,f,v,g);A(s,v,g),(!Array.isArray(m)||!m.length)&&(s.visible=!1),r(s,m,"values",w),g("hoveron"),g("hovertemplate"),g("hovertemplatefallback"),g("arrangement"),g("bundlecolors"),g("sortpaths"),g("counts");var l=v.font;u.coerceFont(g,"labelfont",l,{overrideDflt:{size:Math.round(l.size)}}),u.coerceFont(g,"tickfont",l,{autoShadowDflt:!0,overrideDflt:{size:Math.round(l.size/1.2)}})}}),Y9=Vt((K,V)=>{var u=wp().wrap,d=ah().hasColorscale,E=ih(),A=sb(),t=Eo(),e=Xr(),r=Lo();V.exports=function(l,x){var y=e.filterVisible(x.dimensions);if(y.length===0)return[];var S=y.map(function(et){var Z;if(et.categoryorder==="trace")Z=null;else if(et.categoryorder==="array")Z=et.categoryarray;else{Z=A(et.values);for(var ot=!0,X=0;X=l.length||x[l[y]]!==void 0)return!1;x[l[y]]=!0}return!0}}),X9=Vt((K,V)=>{var u=Ni(),d=(E0(),xd(Rd)).interpolateNumber,E=t1(),A=pc(),t=Xr(),e=t.strTranslate,r=Eo(),i=Af(),n=Dl();function o(Q,ut,J,q){var it=ut._context.staticPlot,nt=Q.map(st.bind(0,ut,J)),dt=q.selectAll("g.parcatslayer").data([null]);dt.enter().append("g").attr("class","parcatslayer").style("pointer-events",it?"none":"all");var Tt=dt.selectAll("g.trace.parcats").data(nt,a),wt=Tt.enter().append("g").attr("class","trace parcats");Tt.attr("transform",function(vt){return e(vt.x,vt.y)}),wt.append("g").attr("class","paths");var Ct=Tt.select("g.paths"),It=Ct.selectAll("path.path").data(function(vt){return vt.paths},a);It.attr("fill",function(vt){return vt.model.color});var Nt=It.enter().append("path").attr("class","path").attr("stroke-opacity",0).attr("fill",function(vt){return vt.model.color}).attr("fill-opacity",0);x(Nt),It.attr("d",function(vt){return vt.svgD}),Nt.empty()||It.sort(f),It.exit().remove(),It.on("mouseover",v).on("mouseout",g).on("click",l),wt.append("g").attr("class","dimensions");var te=Tt.select("g.dimensions"),Jt=te.selectAll("g.dimension").data(function(vt){return vt.dimensions},a);Jt.enter().append("g").attr("class","dimension"),Jt.attr("transform",function(vt){return e(vt.x,0)}),Jt.exit().remove();var ee=Jt.selectAll("g.category").data(function(vt){return vt.categories},a),Zt=ee.enter().append("g").attr("class","category");ee.attr("transform",function(vt){return e(0,vt.y)}),Zt.append("rect").attr("class","catrect").attr("pointer-events","none"),ee.select("rect.catrect").attr("fill","none").attr("width",function(vt){return vt.width}).attr("height",function(vt){return vt.height}),k(Zt);var mt=ee.selectAll("rect.bandrect").data(function(vt){return vt.bands},a);mt.each(function(){t.raiseToTop(this)}),mt.attr("fill",function(vt){return vt.color});var bt=mt.enter().append("rect").attr("class","bandrect").attr("stroke-opacity",0).attr("fill",function(vt){return vt.color}).attr("fill-opacity",0);mt.attr("fill",function(vt){return vt.color}).attr("width",function(vt){return vt.width}).attr("height",function(vt){return vt.height}).attr("y",function(vt){return vt.y}).attr("cursor",function(vt){return vt.parcatsViewModel.arrangement==="fixed"?"default":vt.parcatsViewModel.arrangement==="perpendicular"?"ns-resize":"move"}),T(bt),mt.exit().remove(),Zt.append("text").attr("class","catlabel").attr("pointer-events","none"),ee.select("text.catlabel").attr("text-anchor",function(vt){return s(vt)?"start":"end"}).attr("alignment-baseline","middle").style("fill","rgb(0, 0, 0)").attr("x",function(vt){return s(vt)?vt.width+5:-5}).attr("y",function(vt){return vt.height/2}).text(function(vt){return vt.model.categoryLabel}).each(function(vt){r.font(u.select(this),vt.parcatsViewModel.categorylabelfont),n.convertToTspans(u.select(this),ut)}),Zt.append("text").attr("class","dimlabel"),ee.select("text.dimlabel").attr("text-anchor","middle").attr("alignment-baseline","baseline").attr("cursor",function(vt){return vt.parcatsViewModel.arrangement==="fixed"?"default":"ew-resize"}).attr("x",function(vt){return vt.width/2}).attr("y",-5).text(function(vt,Ut){return Ut===0?vt.parcatsViewModel.model.dimensions[vt.model.dimensionInd].dimensionLabel:null}).each(function(vt){r.font(u.select(this),vt.parcatsViewModel.labelfont)}),ee.selectAll("rect.bandrect").on("mouseover",R).on("mouseout",I),ee.exit().remove(),Jt.call(u.behavior.drag().origin(function(vt){return{x:vt.x,y:0}}).on("dragstart",F).on("drag",j).on("dragend",N)),Tt.each(function(vt){vt.traceSelection=u.select(this),vt.pathSelection=u.select(this).selectAll("g.paths").selectAll("path.path"),vt.dimensionSelection=u.select(this).selectAll("g.dimensions").selectAll("g.dimension")}),Tt.exit().remove()}V.exports=function(Q,ut,J,q){o(J,Q,q,ut)};function a(Q){return Q.key}function s(Q){var ut=Q.parcatsViewModel.dimensions.length,J=Q.parcatsViewModel.dimensions[ut-1].model.dimensionInd;return Q.model.dimensionInd===J}function f(Q,ut){return Q.model.rawColor>ut.model.rawColor?1:Q.model.rawColor"),ue=u.mouse(it)[0];A.loneHover({trace:nt,x:ee-Tt.left+wt.left,y:Zt-Tt.top+wt.top,text:Kt,color:Q.model.color,borderColor:"black",fontFamily:'Monaco, "Courier New", monospace',fontSize:10,fontColor:mt,idealAlign:ue1&&Ct.displayInd===wt.dimensions.length-1?(te=dt.left,Jt="left"):(te=dt.left+dt.width,Jt="right");var ee=Tt.model.count,Zt=Tt.model.categoryLabel,mt=ee/Tt.parcatsViewModel.model.count,bt={countLabel:ee,categoryLabel:Zt,probabilityLabel:mt.toFixed(3)},vt=[];Tt.parcatsViewModel.hoverinfoItems.indexOf("count")!==-1&&vt.push(["Count:",bt.countLabel].join(" ")),Tt.parcatsViewModel.hoverinfoItems.indexOf("probability")!==-1&&vt.push(["P("+bt.categoryLabel+"):",bt.probabilityLabel].join(" "));var Ut=vt.join("
          ");return{trace:It,x:q*(te-ut.left),y:it*(Nt-ut.top),text:Ut,color:"lightgray",borderColor:"black",fontFamily:'Monaco, "Courier New", monospace',fontSize:12,fontColor:"black",idealAlign:Jt,hovertemplate:It.hovertemplate,hovertemplateLabels:bt,eventData:[{data:It._input,fullData:It,count:ee,category:Zt,probability:mt}]}}function D(Q,ut,J){var q=[];return u.select(J.parentNode.parentNode).selectAll("g.category").select("rect.catrect").each(function(){var it=this;q.push(z(Q,ut,it))}),q}function B(Q,ut,J){Q._fullLayout._calcInverseTransform(Q);var q=Q._fullLayout._invScaleX,it=Q._fullLayout._invScaleY,nt=J.getBoundingClientRect(),dt=u.select(J).datum(),Tt=dt.categoryViewModel,wt=Tt.parcatsViewModel,Ct=wt.model.dimensions[Tt.model.dimensionInd],It=wt.trace,Nt=nt.y+nt.height/2,te,Jt;wt.dimensions.length>1&&Ct.displayInd===wt.dimensions.length-1?(te=nt.left,Jt="left"):(te=nt.left+nt.width,Jt="right");var ee=Tt.model.categoryLabel,Zt=dt.parcatsViewModel.model.count,mt=0;dt.categoryViewModel.bands.forEach(function(qe){qe.color===dt.color&&(mt+=qe.count)});var bt=Tt.model.count,vt=0;wt.pathSelection.each(function(qe){qe.model.color===dt.color&&(vt+=qe.model.count)});var Ut=mt/Zt,re=mt/vt,Kt=mt/bt,ue={countLabel:mt,categoryLabel:ee,probabilityLabel:Ut.toFixed(3)},Me=[];Tt.parcatsViewModel.hoverinfoItems.indexOf("count")!==-1&&Me.push(["Count:",ue.countLabel].join(" ")),Tt.parcatsViewModel.hoverinfoItems.indexOf("probability")!==-1&&(Me.push("P(color ∩ "+ee+"): "+ue.probabilityLabel),Me.push("P("+ee+" | color): "+re.toFixed(3)),Me.push("P(color | "+ee+"): "+Kt.toFixed(3)));var Ce=Me.join("
          "),We=i.mostReadable(dt.color,["black","white"]);return{trace:It,x:q*(te-ut.left),y:it*(Nt-ut.top),text:Ce,color:dt.color,borderColor:"black",fontFamily:'Monaco, "Courier New", monospace',fontColor:We,fontSize:10,idealAlign:Jt,hovertemplate:It.hovertemplate,hovertemplateLabels:ue,eventData:[{data:It._input,fullData:It,category:ee,count:Zt,probability:Ut,categorycount:bt,colorcount:vt,bandcolorcount:mt}]}}function R(Q){if(!Q.parcatsViewModel.dragDimension&&Q.parcatsViewModel.hoverinfoItems.indexOf("skip")===-1){var ut=u.mouse(this)[1];if(ut<-1)return;var J=Q.parcatsViewModel.graphDiv,q=J._fullLayout,it=q._paperdiv.node().getBoundingClientRect(),nt=Q.parcatsViewModel.hoveron,dt=this;if(nt==="color"?(b(dt),P(dt,"plotly_hover",u.event)):(h(dt),_(dt,"plotly_hover",u.event)),Q.parcatsViewModel.hoverinfoItems.indexOf("none")===-1){var Tt;nt==="category"?Tt=z(J,it,dt):nt==="color"?Tt=B(J,it,dt):nt==="dimension"&&(Tt=D(J,it,dt)),Tt&&A.loneHover(Tt,{container:q._hoverlayer.node(),outerContainer:q._paper.node(),gd:J})}}}function I(Q){var ut=Q.parcatsViewModel;if(!ut.dragDimension&&(x(ut.pathSelection),k(ut.dimensionSelection.selectAll("g.category")),T(ut.dimensionSelection.selectAll("g.category").selectAll("rect.bandrect")),A.loneUnhover(ut.graphDiv._fullLayout._hoverlayer.node()),ut.pathSelection.sort(f),ut.hoverinfoItems.indexOf("skip")===-1)){var J=Q.parcatsViewModel.hoveron,q=this;J==="color"?P(q,"plotly_unhover",u.event):_(q,"plotly_unhover",u.event)}}function F(Q){Q.parcatsViewModel.arrangement!=="fixed"&&(Q.dragDimensionDisplayInd=Q.model.displayInd,Q.initialDragDimensionDisplayInds=Q.parcatsViewModel.model.dimensions.map(function(ut){return ut.displayInd}),Q.dragHasMoved=!1,Q.dragCategoryDisplayInd=null,u.select(this).selectAll("g.category").select("rect.catrect").each(function(ut){var J=u.mouse(this)[0],q=u.mouse(this)[1];-2<=J&&J<=ut.width+2&&-2<=q&&q<=ut.height+2&&(Q.dragCategoryDisplayInd=ut.model.displayInd,Q.initialDragCategoryDisplayInds=Q.model.categories.map(function(it){return it.displayInd}),ut.model.dragY=ut.y,t.raiseToTop(this.parentNode),u.select(this.parentNode).selectAll("rect.bandrect").each(function(it){it.yIt.y+It.height/2&&(nt.model.displayInd=It.model.displayInd,It.model.displayInd=Tt),Q.dragCategoryDisplayInd=nt.model.displayInd}if(Q.dragCategoryDisplayInd===null||Q.parcatsViewModel.arrangement==="freeform"){it.model.dragX=u.event.x;var Nt=Q.parcatsViewModel.dimensions[J],te=Q.parcatsViewModel.dimensions[q];Nt!==void 0&&it.model.dragXte.x&&(it.model.displayInd=te.model.displayInd,te.model.displayInd=Q.dragDimensionDisplayInd),Q.dragDimensionDisplayInd=it.model.displayInd}ot(Q.parcatsViewModel),Z(Q.parcatsViewModel),ct(Q.parcatsViewModel),rt(Q.parcatsViewModel)}}function N(Q){if(Q.parcatsViewModel.arrangement!=="fixed"&&Q.dragDimensionDisplayInd!==null){u.select(this).selectAll("text").attr("font-weight","normal");var ut={},J=G(Q.parcatsViewModel),q=Q.parcatsViewModel.model.dimensions.map(function(te){return te.displayInd}),it=Q.initialDragDimensionDisplayInds.some(function(te,Jt){return te!==q[Jt]});it&&q.forEach(function(te,Jt){var ee=Q.parcatsViewModel.model.dimensions[Jt].containerInd;ut["dimensions["+ee+"].displayindex"]=te});var nt=!1;if(Q.dragCategoryDisplayInd!==null){var dt=Q.model.categories.map(function(te){return te.displayInd});if(nt=Q.initialDragCategoryDisplayInds.some(function(te,Jt){return te!==dt[Jt]}),nt){var Tt=Q.model.categories.slice().sort(function(te,Jt){return te.displayInd-Jt.displayInd}),wt=Tt.map(function(te){return te.categoryValue}),Ct=Tt.map(function(te){return te.categoryLabel});ut["dimensions["+Q.model.containerInd+"].categoryarray"]=[wt],ut["dimensions["+Q.model.containerInd+"].ticktext"]=[Ct],ut["dimensions["+Q.model.containerInd+"].categoryorder"]="array"}}if(Q.parcatsViewModel.hoverinfoItems.indexOf("skip")===-1&&!Q.dragHasMoved&&Q.potentialClickBand&&(Q.parcatsViewModel.hoveron==="color"?P(Q.potentialClickBand,"plotly_click",u.event.sourceEvent):_(Q.potentialClickBand,"plotly_click",u.event.sourceEvent)),Q.model.dragX=null,Q.dragCategoryDisplayInd!==null){var It=Q.parcatsViewModel.dimensions[Q.dragDimensionDisplayInd].categories[Q.dragCategoryDisplayInd];It.model.dragY=null,Q.dragCategoryDisplayInd=null}Q.dragDimensionDisplayInd=null,Q.parcatsViewModel.dragDimension=null,Q.dragHasMoved=null,Q.potentialClickBand=null,ot(Q.parcatsViewModel),Z(Q.parcatsViewModel);var Nt=u.transition().duration(300).ease("cubic-in-out");Nt.each(function(){ct(Q.parcatsViewModel,!0),rt(Q.parcatsViewModel,!0)}).each("end",function(){(it||nt)&&E.restyle(Q.parcatsViewModel.graphDiv,ut,[J])})}}function G(Q){for(var ut,J=Q.graphDiv._fullData,q=0;q=0;wt--)Ct+="C"+dt[wt]+","+(ut[wt+1]+q)+" "+nt[wt]+","+(ut[wt]+q)+" "+(Q[wt]+J[wt])+","+(ut[wt]+q),Ct+="l-"+J[wt]+",0 ";return Ct+="Z",Ct}function Z(Q){var ut=Q.dimensions,J=Q.model,q=ut.map(function(er){return er.categories.map(function(Mr){return Mr.y})}),it=Q.model.dimensions.map(function(er){return er.categories.map(function(Mr){return Mr.displayInd})}),nt=Q.model.dimensions.map(function(er){return er.displayInd}),dt=Q.dimensions.map(function(er){return er.model.dimensionInd}),Tt=ut.map(function(er){return er.x}),wt=ut.map(function(er){return er.width}),Ct=[];for(var It in J.paths)J.paths.hasOwnProperty(It)&&Ct.push(J.paths[It]);function Nt(er){var Mr=er.categoryInds.map(function(de,Dt){return it[Dt][de]}),Ir=dt.map(function(de){return Mr[de]});return Ir}Ct.sort(function(er,Mr){var Ir=Nt(er),de=Nt(Mr);return Q.sortpaths==="backward"&&(Ir.reverse(),de.reverse()),Ir.push(er.valueInds[0]),de.push(Mr.valueInds[0]),Q.bundlecolors&&(Ir.unshift(er.rawColor),de.unshift(Mr.rawColor)),Irde?1:0});for(var te=new Array(Ct.length),Jt=ut[0].model.count,ee=ut[0].categories.map(function(er){return er.height}).reduce(function(er,Mr){return er+Mr}),Zt=0;Zt0?bt=ee*(mt.count/Jt):bt=0;for(var vt=new Array(q.length),Ut=0;Ut1?dt=(Q.width-2*J-q)/(it-1):dt=0,Tt=J,wt=Tt+dt*nt;var Ct=[],It=Q.model.maxCats,Nt=ut.categories.length,te=8,Jt=ut.count,ee=Q.height-te*(It-1),Zt,mt,bt,vt,Ut,re=(It-Nt)*te/2,Kt=ut.categories.map(function(ue){return{displayInd:ue.displayInd,categoryInd:ue.categoryInd}});for(Kt.sort(function(ue,Me){return ue.displayInd-Me.displayInd}),Ut=0;Ut0?Zt=mt.count/Jt*ee:Zt=0,bt={key:mt.valueInds[0],model:mt,width:q,height:Zt,y:mt.dragY!==null?mt.dragY:re,bands:[],parcatsViewModel:Q},re=re+Zt+te,Ct.push(bt);return{key:ut.dimensionInd,x:ut.dragX!==null?ut.dragX:wt,y:0,width:q,model:ut,categories:Ct,parcatsViewModel:Q,dragCategoryDisplayInd:null,dragDimensionDisplayInd:null,initialDragDimensionDisplayInds:null,initialDragCategoryDisplayInds:null,dragHasMoved:null,potentialClickBand:null}}}),E5=Vt((K,V)=>{var u=X9();V.exports=function(d,E,A,t){var e=d._fullLayout,r=e._paper,i=e._size;u(d,r,E,{width:i.w,height:i.h,margin:{t:i.t,r:i.r,b:i.b,l:i.l}},A,t)}}),$9=Vt(K=>{var V=Pf().getModuleCalcData,u=E5(),d="parcats";K.name=d,K.plot=function(E,A,t,e){var r=V(E.calcdata,d);if(r.length){var i=r[0];u(E,i,t,e)}},K.clean=function(E,A,t,e){var r=e._has&&e._has("parcats"),i=A._has&&A._has("parcats");r&&!i&&e._paperdiv.selectAll(".parcats").remove()}}),J9=Vt((K,V)=>{V.exports={attributes:S5(),supplyDefaults:K9(),calc:Y9(),plot:E5(),colorbar:{container:"line",min:"cmin",max:"cmax"},moduleType:"trace",name:"parcats",basePlotModule:$9(),categories:["noOpacity"],meta:{}}}),Q9=Vt((K,V)=>{V.exports=J9()}),Gp=Vt((K,V)=>{var u=Td(),d="1.13.4",E='© OpenStreetMap contributors',A=['© Carto',E].join(" "),t=['Map tiles by Stamen Design','under CC BY 3.0',"|",'Data by OpenStreetMap contributors','under ODbL'].join(" "),e=['Map tiles by Stamen Design','under CC BY 3.0',"|",'Data by OpenStreetMap contributors','under CC BY SA'].join(" "),r={"open-street-map":{id:"osm",version:8,sources:{"plotly-osm-tiles":{type:"raster",attribution:E,tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png","https://b.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-osm-tiles",type:"raster",source:"plotly-osm-tiles",minzoom:0,maxzoom:22}],glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"},"white-bg":{id:"white-bg",version:8,sources:{},layers:[{id:"white-bg",type:"background",paint:{"background-color":"#FFFFFF"},minzoom:0,maxzoom:22}],glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"},"carto-positron":{id:"carto-positron",version:8,sources:{"plotly-carto-positron":{type:"raster",attribution:A,tiles:["https://cartodb-basemaps-c.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-carto-positron",type:"raster",source:"plotly-carto-positron",minzoom:0,maxzoom:22}],glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"},"carto-darkmatter":{id:"carto-darkmatter",version:8,sources:{"plotly-carto-darkmatter":{type:"raster",attribution:A,tiles:["https://cartodb-basemaps-c.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-carto-darkmatter",type:"raster",source:"plotly-carto-darkmatter",minzoom:0,maxzoom:22}],glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"},"stamen-terrain":{id:"stamen-terrain",version:8,sources:{"plotly-stamen-terrain":{type:"raster",attribution:t,tiles:["https://tiles.stadiamaps.com/tiles/stamen_terrain/{z}/{x}/{y}.png?api_key="],tileSize:256}},layers:[{id:"plotly-stamen-terrain",type:"raster",source:"plotly-stamen-terrain",minzoom:0,maxzoom:22}],glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"},"stamen-toner":{id:"stamen-toner",version:8,sources:{"plotly-stamen-toner":{type:"raster",attribution:t,tiles:["https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}.png?api_key="],tileSize:256}},layers:[{id:"plotly-stamen-toner",type:"raster",source:"plotly-stamen-toner",minzoom:0,maxzoom:22}],glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"},"stamen-watercolor":{id:"stamen-watercolor",version:8,sources:{"plotly-stamen-watercolor":{type:"raster",attribution:e,tiles:["https://tiles.stadiamaps.com/tiles/stamen_watercolor/{z}/{x}/{y}.jpg?api_key="],tileSize:256}},layers:[{id:"plotly-stamen-watercolor",type:"raster",source:"plotly-stamen-watercolor",minzoom:0,maxzoom:22}],glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"}},i=u(r);V.exports={requiredVersion:d,styleUrlPrefix:"mapbox://styles/mapbox/",styleUrlSuffix:"v9",styleValuesMapbox:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],styleValueDflt:"basic",stylesNonMapbox:r,styleValuesNonMapbox:i,traceLayerPrefix:"plotly-trace-layer-",layoutLayerPrefix:"plotly-layout-layer-",wrongVersionErrorMsg:["Your custom plotly.js bundle is not using the correct mapbox-gl version","Please install @plotly/mapbox-gl@"+d+"."].join(` +`),noAccessTokenErrorMsg:["Missing Mapbox access token.","Mapbox trace type require a Mapbox access token to be registered.","For example:"," Plotly.newPlot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });","More info here: https://www.mapbox.com/help/define-access-token/"].join(` +`),missingStyleErrorMsg:["No valid mapbox style found, please set `mapbox.style` to one of:",i.join(", "),"or register a Mapbox access token to use a Mapbox-served style."].join(` +`),multipleTokensErrorMsg:["Set multiple mapbox access token across different mapbox subplot,","using first token found as mapbox-gl does not allow multipleaccess tokens on the same page."].join(` +`),mapOnErrorMsg:"Mapbox error.",mapboxLogo:{path0:"m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z",path1:"M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z",path2:"M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z",polygon:"11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34"},styleRules:{map:"overflow:hidden;position:relative;","missing-css":"display:none;",canary:"background-color:salmon;","ctrl-bottom-left":"position: absolute; pointer-events: none; z-index: 2; bottom: 0; left: 0;","ctrl-bottom-right":"position: absolute; pointer-events: none; z-index: 2; right: 0; bottom: 0;",ctrl:"clear: both; pointer-events: auto; transform: translate(0, 0);","ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner":"display: none;","ctrl-attrib.mapboxgl-compact:hover .mapboxgl-ctrl-attrib-inner":"display: block; margin-top:2px","ctrl-attrib.mapboxgl-compact:hover":"padding: 2px 24px 2px 4px; visibility: visible; margin-top: 6px;","ctrl-attrib.mapboxgl-compact::after":`content: ""; cursor: pointer; position: absolute; background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E %3Cpath fill="%23333333" fill-rule="evenodd" d="M4,10a6,6 0 1,0 12,0a6,6 0 1,0 -12,0 M9,7a1,1 0 1,0 2,0a1,1 0 1,0 -2,0 M9,10a1,1 0 1,1 2,0l0,3a1,1 0 1,1 -2,0"/%3E %3C/svg%3E'); background-color: rgba(255, 255, 255, 0.5); width: 24px; height: 24px; box-sizing: border-box; border-radius: 12px;`,"ctrl-attrib.mapboxgl-compact":"min-height: 20px; padding: 0; margin: 10px; position: relative; background-color: #fff; border-radius: 3px 12px 12px 3px;","ctrl-bottom-right > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; right: 0","ctrl-bottom-left > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; left: 0","ctrl-bottom-left .mapboxgl-ctrl":"margin: 0 0 10px 10px; float: left;","ctrl-bottom-right .mapboxgl-ctrl":"margin: 0 10px 10px 0; float: right;","ctrl-attrib":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a:hover":"color: inherit; text-decoration: underline;","ctrl-attrib .mapbox-improve-map":"font-weight: bold; margin-left: 2px;","attrib-empty":"display: none;","ctrl-logo":`display:block; width: 21px; height: 21px; background-image: url('data:image/svg+xml;charset=utf-8,%3C?xml version="1.0" encoding="utf-8"?%3E %3Csvg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 21 21" style="enable-background:new 0 0 21 21;" xml:space="preserve"%3E%3Cg transform="translate(0,0.01)"%3E%3Cpath d="m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z" style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3Cpath d="M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z" style="opacity:0.35;enable-background:new" class="st1"/%3E%3Cpath d="M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z" style="opacity:0.35;enable-background:new" class="st1"/%3E%3Cpolygon points="11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34 " style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3C/g%3E%3C/svg%3E')`}}}),Nv=Vt((K,V)=>{var u=Xr(),d=Pi().defaultLine,E=Hu().attributes,A=yu(),t=dc().textposition,e=Cu().overrideAll,r=cl().templatedArray,i=Gp(),n=A({noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0});n.family.dflt="Open Sans Regular, Arial Unicode MS Regular";var o=V.exports=e({_arrayAttrRegexps:[u.counterRegex("mapbox",".layers",!0)],domain:E({name:"mapbox"}),accesstoken:{valType:"string",noBlank:!0,strict:!0},style:{valType:"any",values:i.styleValuesMapbox.concat(i.styleValuesNonMapbox),dflt:i.styleValueDflt},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},bounds:{west:{valType:"number"},east:{valType:"number"},south:{valType:"number"},north:{valType:"number"}},layers:r("layer",{visible:{valType:"boolean",dflt:!0},sourcetype:{valType:"enumerated",values:["geojson","vector","raster","image"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},sourceattribution:{valType:"string"},type:{valType:"enumerated",values:["circle","line","fill","symbol","raster"],dflt:"circle"},coordinates:{valType:"any"},below:{valType:"string"},color:{valType:"color",dflt:d},opacity:{valType:"number",min:0,max:1,dflt:1},minzoom:{valType:"number",min:0,max:24,dflt:0},maxzoom:{valType:"number",min:0,max:24,dflt:24},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2},dash:{valType:"data_array"}},fill:{outlinecolor:{valType:"color",dflt:d}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},placement:{valType:"enumerated",values:["point","line","line-center"],dflt:"point"},textfont:n,textposition:u.extendFlat({},t,{arrayOk:!1})}})},"plot","from-root");o.uirevision={valType:"any",editType:"none"}}),Xx=Vt((K,V)=>{var{hovertemplateAttrs:u,texttemplateAttrs:d,templatefallbackAttrs:E}=yl(),A=Jh(),t=L0(),e=dc(),r=Nv(),i=kl(),n=Wl(),o=So().extendFlat,a=Cu().overrideAll,s=Nv(),f=t.line,v=t.marker;V.exports=a({lon:t.lon,lat:t.lat,cluster:{enabled:{valType:"boolean"},maxzoom:o({},s.layers.maxzoom,{}),step:{valType:"number",arrayOk:!0,dflt:-1,min:-1},size:{valType:"number",arrayOk:!0,dflt:20,min:0},color:{valType:"color",arrayOk:!0},opacity:o({},v.opacity,{dflt:1})},mode:o({},e.mode,{dflt:"markers"}),text:o({},e.text,{}),texttemplate:d({editType:"plot"},{keys:["lat","lon","text"]}),texttemplatefallback:E({editType:"plot"}),hovertext:o({},e.hovertext,{}),line:{color:f.color,width:f.width},connectgaps:e.connectgaps,marker:o({symbol:{valType:"string",dflt:"circle",arrayOk:!0},angle:{valType:"number",dflt:"auto",arrayOk:!0},allowoverlap:{valType:"boolean",dflt:!1},opacity:v.opacity,size:v.size,sizeref:v.sizeref,sizemin:v.sizemin,sizemode:v.sizemode},n("marker")),fill:t.fill,fillcolor:A(),textfont:r.layers.symbol.textfont,textposition:r.layers.symbol.textposition,below:{valType:"string"},selected:{marker:e.selected.marker},unselected:{marker:e.unselected.marker},hoverinfo:o({},i.hoverinfo,{flags:["lon","lat","text","name"]}),hovertemplate:u(),hovertemplatefallback:E()},"calc","nested")}),z5=Vt((K,V)=>{var u=["Metropolis Black Italic","Metropolis Black","Metropolis Bold Italic","Metropolis Bold","Metropolis Extra Bold Italic","Metropolis Extra Bold","Metropolis Extra Light Italic","Metropolis Extra Light","Metropolis Light Italic","Metropolis Light","Metropolis Medium Italic","Metropolis Medium","Metropolis Regular Italic","Metropolis Regular","Metropolis Semi Bold Italic","Metropolis Semi Bold","Metropolis Thin Italic","Metropolis Thin","Open Sans Bold Italic","Open Sans Bold","Open Sans Extrabold Italic","Open Sans Extrabold","Open Sans Italic","Open Sans Light Italic","Open Sans Light","Open Sans Regular","Open Sans Semibold Italic","Open Sans Semibold","Klokantech Noto Sans Bold","Klokantech Noto Sans CJK Bold","Klokantech Noto Sans CJK Regular","Klokantech Noto Sans Italic","Klokantech Noto Sans Regular"];V.exports={isSupportedFont:function(d){return u.indexOf(d)!==-1}}}),tz=Vt((K,V)=>{var u=Xr(),d=nu(),E=Lh(),A=Bh(),t=Rh(),e=tp(),r=Xx(),i=z5().isSupportedFont;V.exports=function(o,a,s,f){function v(h,b){return u.coerce(o,a,r,h,b)}function g(h,b){return u.coerce2(o,a,r,h,b)}var m=n(o,a,v);if(!m){a.visible=!1;return}if(v("text"),v("texttemplate"),v("texttemplatefallback"),v("hovertext"),v("hovertemplate"),v("hovertemplatefallback"),v("mode"),v("below"),d.hasMarkers(a)){E(o,a,s,f,v,{noLine:!0,noAngle:!0}),v("marker.allowoverlap"),v("marker.angle");var w=a.marker;w.symbol!=="circle"&&(u.isArrayOrTypedArray(w.size)&&(w.size=w.size[0]),u.isArrayOrTypedArray(w.color)&&(w.color=w.color[0]))}d.hasLines(a)&&(A(o,a,s,f,v,{noDash:!0}),v("connectgaps"));var l=g("cluster.maxzoom"),x=g("cluster.step"),y=g("cluster.color",a.marker&&a.marker.color||s),S=g("cluster.size"),k=g("cluster.opacity"),M=l!==!1||x!==!1||y!==!1||S!==!1||k!==!1,T=v("cluster.enabled",M);if(T||d.hasText(a)){var c=f.font.family;t(o,a,f,v,{noSelect:!0,noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0,font:{family:i(c)?c:"Open Sans Regular",weight:f.font.weight,style:f.font.style,size:f.font.size,color:f.font.color}})}v("fill"),a.fill!=="none"&&e(o,a,s,v),u.coerceSelectionMarkerOpacity(a,v)};function n(o,a,s){var f=s("lon")||[],v=s("lat")||[],g=Math.min(f.length,v.length);return a._length=g,g}}),L5=Vt((K,V)=>{var u=yo();V.exports=function(d,E,A){var t={},e=A[E.subplot]._subplot,r=e.mockAxis,i=d.lonlat;return t.lonLabel=u.tickText(r,r.c2l(i[0]),!0).text,t.latLabel=u.tickText(r,r.c2l(i[1]),!0).text,t}}),C5=Vt((K,V)=>{var u=Xr();V.exports=function(d,E){var A=d.split(" "),t=A[0],e=A[1],r=u.isArrayOrTypedArray(E)?u.mean(E):E,i=.5+r/100,n=1.5+r/100,o=["",""],a=[0,0];switch(t){case"top":o[0]="top",a[1]=-n;break;case"bottom":o[0]="bottom",a[1]=n;break}switch(e){case"left":o[1]="right",a[0]=-i;break;case"right":o[1]="left",a[0]=i;break}var s;return o[0]&&o[1]?s=o.join("-"):o[0]?s=o[0]:o[1]?s=o[1]:s="center",{anchor:s,offset:a}}}),ez=Vt((K,V)=>{var u=Lo(),d=Xr(),E=ks().BADNUM,A=Ud(),t=xu(),e=Eo(),r=Tm(),i=nu(),n=z5().isSupportedFont,o=C5(),a=mh().appendArrayPointValue,s=Dl().NEWLINES,f=Dl().BR_TAG_ALL;V.exports=function(k,M){var T=M[0].trace,c=T.visible===!0&&T._length!==0,h=T.fill!=="none",b=i.hasLines(T),_=i.hasMarkers(T),P=i.hasText(T),z=_&&T.marker.symbol==="circle",D=_&&T.marker.symbol!=="circle",B=T.cluster&&T.cluster.enabled,R=v("fill"),I=v("line"),F=v("circle"),j=v("symbol"),N={fill:R,line:I,circle:F,symbol:j};if(!c)return N;var G;if((h||b)&&(G=A.calcTraceToLineCoords(M)),h&&(R.geojson=A.makePolygon(G),R.layout.visibility="visible",d.extendFlat(R.paint,{"fill-color":T.fillcolor})),b&&(I.geojson=A.makeLine(G),I.layout.visibility="visible",d.extendFlat(I.paint,{"line-width":T.line.width,"line-color":T.line.color,"line-opacity":T.opacity})),z){var rt=g(M);F.geojson=rt.geojson,F.layout.visibility="visible",B&&(F.filter=["!",["has","point_count"]],N.cluster={type:"circle",filter:["has","point_count"],layout:{visibility:"visible"},paint:{"circle-color":y(T.cluster.color,T.cluster.step),"circle-radius":y(T.cluster.size,T.cluster.step),"circle-opacity":y(T.cluster.opacity,T.cluster.step)}},N.clusterCount={type:"symbol",filter:["has","point_count"],paint:{},layout:{"text-field":"{point_count_abbreviated}","text-font":S(T),"text-size":12}}),d.extendFlat(F.paint,{"circle-color":rt.mcc,"circle-radius":rt.mrc,"circle-opacity":rt.mo})}if(z&&B&&(F.filter=["!",["has","point_count"]]),(D||P)&&(j.geojson=m(M,k),d.extendFlat(j.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),D&&(d.extendFlat(j.layout,{"icon-size":T.marker.size/10}),"angle"in T.marker&&T.marker.angle!=="auto"&&d.extendFlat(j.layout,{"icon-rotate":{type:"identity",property:"angle"},"icon-rotation-alignment":"map"}),j.layout["icon-allow-overlap"]=T.marker.allowoverlap,d.extendFlat(j.paint,{"icon-opacity":T.opacity*T.marker.opacity,"icon-color":T.marker.color})),P)){var ct=(T.marker||{}).size,st=o(T.textposition,ct);d.extendFlat(j.layout,{"text-size":T.textfont.size,"text-anchor":st.anchor,"text-offset":st.offset,"text-font":S(T)}),d.extendFlat(j.paint,{"text-color":T.textfont.color,"text-opacity":T.opacity})}return N};function v(k){return{type:k,geojson:A.makeBlank(),layout:{visibility:"none"},filter:null,paint:{}}}function g(k){var M=k[0].trace,T=M.marker,c=M.selectedpoints,h=d.isArrayOrTypedArray(T.color),b=d.isArrayOrTypedArray(T.size),_=d.isArrayOrTypedArray(T.opacity),P;function z(st){return M.opacity*st}function D(st){return st/2}var B;h&&(t.hasColorscale(M,"marker")?B=t.makeColorScaleFuncFromTrace(T):B=d.identity);var R;b&&(R=r(M));var I;_&&(I=function(st){var et=u(st)?+d.constrain(st,0,1):0;return z(et)});var F=[];for(P=0;P850?P+=" Black":h>750?P+=" Extra Bold":h>650?P+=" Bold":h>550?P+=" Semi Bold":h>450?P+=" Medium":h>350?P+=" Regular":h>250?P+=" Light":h>150?P+=" Extra Light":P+=" Thin"):b.slice(0,2).join(" ")==="Open Sans"?(P="Open Sans",h>750?P+=" Extrabold":h>650?P+=" Bold":h>550?P+=" Semibold":h>350?P+=" Regular":P+=" Light"):b.slice(0,3).join(" ")==="Klokantech Noto Sans"&&(P="Klokantech Noto Sans",b[3]==="CJK"&&(P+=" CJK"),P+=h>500?" Bold":" Regular")),_&&(P+=" Italic"),P==="Open Sans Regular Italic"?P="Open Sans Italic":P==="Open Sans Regular Bold"?P="Open Sans Bold":P==="Open Sans Regular Bold Italic"?P="Open Sans Bold Italic":P==="Klokantech Noto Sans Regular Italic"&&(P="Klokantech Noto Sans Italic"),n(P)||(P=T);var z=P.split(", ");return z}}),rz=Vt((K,V)=>{var u=Xr(),d=ez(),E=Gp().traceLayerPrefix,A={cluster:["cluster","clusterCount","circle"],nonCluster:["fill","line","circle","symbol"]};function t(r,i,n,o){this.type="scattermapbox",this.subplot=r,this.uid=i,this.clusterEnabled=n,this.isHidden=o,this.sourceIds={fill:"source-"+i+"-fill",line:"source-"+i+"-line",circle:"source-"+i+"-circle",symbol:"source-"+i+"-symbol",cluster:"source-"+i+"-circle",clusterCount:"source-"+i+"-circle"},this.layerIds={fill:E+i+"-fill",line:E+i+"-line",circle:E+i+"-circle",symbol:E+i+"-symbol",cluster:E+i+"-cluster",clusterCount:E+i+"-cluster-count"},this.below=null}var e=t.prototype;e.addSource=function(r,i,n){var o={type:"geojson",data:i.geojson};n&&n.enabled&&u.extendFlat(o,{cluster:!0,clusterMaxZoom:n.maxzoom});var a=this.subplot.map.getSource(this.sourceIds[r]);a?a.setData(i.geojson):this.subplot.map.addSource(this.sourceIds[r],o)},e.setSourceData=function(r,i){this.subplot.map.getSource(this.sourceIds[r]).setData(i.geojson)},e.addLayer=function(r,i,n){var o={type:i.type,id:this.layerIds[r],source:this.sourceIds[r],layout:i.layout,paint:i.paint};i.filter&&(o.filter=i.filter);for(var a=this.layerIds[r],s,f=this.subplot.getMapLayers(),v=0;v=0;b--){var _=h[b];o.removeLayer(g.layerIds[_])}c||o.removeSource(g.sourceIds.circle)}function l(c){for(var h=A.nonCluster,b=0;b=0;b--){var _=h[b];o.removeLayer(g.layerIds[_]),c||o.removeSource(g.sourceIds[_])}}function y(c){v?w(c):x(c)}function S(c){f?m(c):l(c)}function k(){for(var c=f?A.cluster:A.nonCluster,h=0;h=0;n--){var o=i[n];r.removeLayer(this.layerIds[o]),r.removeSource(this.sourceIds[o])}},V.exports=function(r,i){var n=i[0].trace,o=n.cluster&&n.cluster.enabled,a=n.visible!==!0,s=new t(r,n.uid,o,a),f=d(r.gd,i),v=s.below=r.belowLookup["trace-"+n.uid],g,m,w;if(o)for(s.addSource("circle",f.circle,n.cluster),g=0;g{var u=pc(),d=Xr(),E=zm(),A=d.fillText,t=ks().BADNUM,e=Gp().traceLayerPrefix;function r(n,o,a){var s=n.cd,f=s[0].trace,v=n.xa,g=n.ya,m=n.subplot,w=[],l=e+f.uid+"-circle",x=f.cluster&&f.cluster.enabled;if(x){var y=m.map.queryRenderedFeatures(null,{layers:[l]});w=y.map(function(R){return R.id})}var S=o>=0?Math.floor((o+180)/360):Math.ceil((o-180)/360),k=S*360,M=o-k;function T(R){var I=R.lonlat;if(I[0]===t||x&&w.indexOf(R.i+1)===-1)return 1/0;var F=d.modHalf(I[0],360),j=I[1],N=m.project([F,j]),G=N.x-v.c2p([M,j]),rt=N.y-g.c2p([F,a]),ct=Math.max(3,R.mrc||0);return Math.max(Math.sqrt(G*G+rt*rt)-ct,1-3/ct)}if(u.getClosest(s,T,n),n.index!==!1){var c=s[n.index],h=c.lonlat,b=[d.modHalf(h[0],360)+k,h[1]],_=v.c2p(b),P=g.c2p(b),z=c.mrc||1;n.x0=_-z,n.x1=_+z,n.y0=P-z,n.y1=P+z;var D={};D[f.subplot]={_subplot:m};var B=f._module.formatLabels(c,f,D);return n.lonLabel=B.lonLabel,n.latLabel=B.latLabel,n.color=E(f,c),n.extraText=i(f,c,s[0].t.labels),n.hovertemplate=f.hovertemplate,[n]}}function i(n,o,a){if(n.hovertemplate)return;var s=o.hi||n.hoverinfo,f=s.split("+"),v=f.indexOf("all")!==-1,g=f.indexOf("lon")!==-1,m=f.indexOf("lat")!==-1,w=o.lonlat,l=[];function x(y){return y+"°"}return v||g&&m?l.push("("+x(w[1])+", "+x(w[0])+")"):g?l.push(a.lon+x(w[0])):m&&l.push(a.lat+x(w[1])),(v||f.indexOf("text")!==-1)&&A(o,n,l),l.join("
          ")}V.exports={hoverPoints:r,getExtraText:i}}),nz=Vt((K,V)=>{V.exports=function(u,d){return u.lon=d.lon,u.lat=d.lat,u}}),az=Vt((K,V)=>{var u=Xr(),d=nu(),E=ks().BADNUM;V.exports=function(A,t){var e=A.cd,r=A.xaxis,i=A.yaxis,n=[],o=e[0].trace,a;if(!d.hasMarkers(o))return[];if(t===!1)for(a=0;a{(function(u,d){typeof K=="object"&&typeof V<"u"?V.exports=d():(u=u||self,u.mapboxgl=d())})(K,function(){var u,d,E;function A(t,e){if(!u)u=e;else if(!d)d=e;else{var r="var sharedChunk = {}; ("+u+")(sharedChunk); ("+d+")(sharedChunk);",i={};u(i),E=e(i),typeof window<"u"&&(E.workerUrl=window.URL.createObjectURL(new Blob([r],{type:"text/javascript"})))}}return A(["exports"],function(t){function e(p,O){return O={exports:{}},p(O,O.exports),O.exports}var r="1.13.4",i=n;function n(p,O,W,pt){this.cx=3*p,this.bx=3*(W-p)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*O,this.by=3*(pt-O)-this.cy,this.ay=1-this.cy-this.by,this.p1x=p,this.p1y=pt,this.p2x=W,this.p2y=pt}n.prototype.sampleCurveX=function(p){return((this.ax*p+this.bx)*p+this.cx)*p},n.prototype.sampleCurveY=function(p){return((this.ay*p+this.by)*p+this.cy)*p},n.prototype.sampleCurveDerivativeX=function(p){return(3*this.ax*p+2*this.bx)*p+this.cx},n.prototype.solveCurveX=function(p,O){typeof O>"u"&&(O=1e-6);var W,pt,At,Ot,Wt;for(At=p,Wt=0;Wt<8;Wt++){if(Ot=this.sampleCurveX(At)-p,Math.abs(Ot)pt)return pt;for(;WOt?W=At:pt=At,At=(pt-W)*.5+W}return At},n.prototype.solve=function(p,O){return this.sampleCurveY(this.solveCurveX(p,O))};var o=a;function a(p,O){this.x=p,this.y=O}a.prototype={clone:function(){return new a(this.x,this.y)},add:function(p){return this.clone()._add(p)},sub:function(p){return this.clone()._sub(p)},multByPoint:function(p){return this.clone()._multByPoint(p)},divByPoint:function(p){return this.clone()._divByPoint(p)},mult:function(p){return this.clone()._mult(p)},div:function(p){return this.clone()._div(p)},rotate:function(p){return this.clone()._rotate(p)},rotateAround:function(p,O){return this.clone()._rotateAround(p,O)},matMult:function(p){return this.clone()._matMult(p)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(p){return this.x===p.x&&this.y===p.y},dist:function(p){return Math.sqrt(this.distSqr(p))},distSqr:function(p){var O=p.x-this.x,W=p.y-this.y;return O*O+W*W},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(p){return Math.atan2(this.y-p.y,this.x-p.x)},angleWith:function(p){return this.angleWithSep(p.x,p.y)},angleWithSep:function(p,O){return Math.atan2(this.x*O-this.y*p,this.x*p+this.y*O)},_matMult:function(p){var O=p[0]*this.x+p[1]*this.y,W=p[2]*this.x+p[3]*this.y;return this.x=O,this.y=W,this},_add:function(p){return this.x+=p.x,this.y+=p.y,this},_sub:function(p){return this.x-=p.x,this.y-=p.y,this},_mult:function(p){return this.x*=p,this.y*=p,this},_div:function(p){return this.x/=p,this.y/=p,this},_multByPoint:function(p){return this.x*=p.x,this.y*=p.y,this},_divByPoint:function(p){return this.x/=p.x,this.y/=p.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var p=this.y;return this.y=this.x,this.x=-p,this},_rotate:function(p){var O=Math.cos(p),W=Math.sin(p),pt=O*this.x-W*this.y,At=W*this.x+O*this.y;return this.x=pt,this.y=At,this},_rotateAround:function(p,O){var W=Math.cos(p),pt=Math.sin(p),At=O.x+W*(this.x-O.x)-pt*(this.y-O.y),Ot=O.y+pt*(this.x-O.x)+W*(this.y-O.y);return this.x=At,this.y=Ot,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},a.convert=function(p){return p instanceof a?p:Array.isArray(p)?new a(p[0],p[1]):p};var s=typeof self<"u"?self:{};function f(p,O){if(Array.isArray(p)){if(!Array.isArray(O)||p.length!==O.length)return!1;for(var W=0;W=1)return 1;var O=p*p,W=O*p;return 4*(p<.5?W:3*(p-O)+W-.75)}function m(p,O,W,pt){var At=new i(p,O,W,pt);return function(Ot){return At.solve(Ot)}}var w=m(.25,.1,.25,1);function l(p,O,W){return Math.min(W,Math.max(O,p))}function x(p,O,W){var pt=W-O,At=((p-O)%pt+pt)%pt+O;return At===O?W:At}function y(p,O,W){if(!p.length)return W(null,[]);var pt=p.length,At=new Array(p.length),Ot=null;p.forEach(function(Wt,_e){O(Wt,function(De,Je){De&&(Ot=De),At[_e]=Je,--pt===0&&W(Ot,At)})})}function S(p){var O=[];for(var W in p)O.push(p[W]);return O}function k(p,O){var W=[];for(var pt in p)pt in O||W.push(pt);return W}function M(p){for(var O=[],W=arguments.length-1;W-- >0;)O[W]=arguments[W+1];for(var pt=0,At=O;pt>O/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,p)}return p()}function _(p){return p<=1?1:Math.pow(2,Math.ceil(Math.log(p)/Math.LN2))}function P(p){return p?/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(p):!1}function z(p,O){p.forEach(function(W){O[W]&&(O[W]=O[W].bind(O))})}function D(p,O){return p.indexOf(O,p.length-O.length)!==-1}function B(p,O,W){var pt={};for(var At in p)pt[At]=O.call(W||this,p[At],At,p);return pt}function R(p,O,W){var pt={};for(var At in p)O.call(W||this,p[At],At,p)&&(pt[At]=p[At]);return pt}function I(p){return Array.isArray(p)?p.map(I):typeof p=="object"&&p?B(p,I):p}function F(p,O){for(var W=0;W=0)return!0;return!1}var j={};function N(p){j[p]||(typeof console<"u"&&console.warn(p),j[p]=!0)}function G(p,O,W){return(W.y-p.y)*(O.x-p.x)>(O.y-p.y)*(W.x-p.x)}function rt(p){for(var O=0,W=0,pt=p.length,At=pt-1,Ot=void 0,Wt=void 0;W@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,W={};if(p.replace(O,function(At,Ot,Wt,_e){var De=Wt||_e;return W[Ot]=De?De.toLowerCase():!0,""}),W["max-age"]){var pt=parseInt(W["max-age"],10);isNaN(pt)?delete W["max-age"]:W["max-age"]=pt}return W}var Z=null;function ot(p){if(Z==null){var O=p.navigator?p.navigator.userAgent:null;Z=!!p.safari||!!(O&&(/\b(iPad|iPhone|iPod)\b/.test(O)||O.match("Safari")&&!O.match("Chrome")))}return Z}function X(p){try{var O=s[p];return O.setItem("_mapbox_test_",1),O.removeItem("_mapbox_test_"),!0}catch{return!1}}function Q(p){return s.btoa(encodeURIComponent(p).replace(/%([0-9A-F]{2})/g,function(O,W){return String.fromCharCode(+("0x"+W))}))}function ut(p){return decodeURIComponent(s.atob(p).split("").map(function(O){return"%"+("00"+O.charCodeAt(0).toString(16)).slice(-2)}).join(""))}var J=s.performance&&s.performance.now?s.performance.now.bind(s.performance):Date.now.bind(Date),q=s.requestAnimationFrame||s.mozRequestAnimationFrame||s.webkitRequestAnimationFrame||s.msRequestAnimationFrame,it=s.cancelAnimationFrame||s.mozCancelAnimationFrame||s.webkitCancelAnimationFrame||s.msCancelAnimationFrame,nt,dt,Tt={now:J,frame:function(p){var O=q(p);return{cancel:function(){return it(O)}}},getImageData:function(p,O){O===void 0&&(O=0);var W=s.document.createElement("canvas"),pt=W.getContext("2d");if(!pt)throw new Error("failed to create canvas 2d context");return W.width=p.width,W.height=p.height,pt.drawImage(p,0,0,p.width,p.height),pt.getImageData(-O,-O,p.width+2*O,p.height+2*O)},resolveURL:function(p){return nt||(nt=s.document.createElement("a")),nt.href=p,nt.href},hardwareConcurrency:s.navigator&&s.navigator.hardwareConcurrency||4,get devicePixelRatio(){return s.devicePixelRatio},get prefersReducedMotion(){return s.matchMedia?(dt==null&&(dt=s.matchMedia("(prefers-reduced-motion: reduce)")),dt.matches):!1}},wt={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?this.API_URL.indexOf("https://api.mapbox.cn")===0?"https://events.mapbox.cn/events/v2":this.API_URL.indexOf("https://api.mapbox.com")===0?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},Ct={supported:!1,testSupport:ee},It,Nt=!1,te,Jt=!1;s.document&&(te=s.document.createElement("img"),te.onload=function(){It&&Zt(It),It=null,Jt=!0},te.onerror=function(){Nt=!0,It=null},te.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function ee(p){Nt||!te||(Jt?Zt(p):It=p)}function Zt(p){var O=p.createTexture();p.bindTexture(p.TEXTURE_2D,O);try{if(p.texImage2D(p.TEXTURE_2D,0,p.RGBA,p.RGBA,p.UNSIGNED_BYTE,te),p.isContextLost())return;Ct.supported=!0}catch{}p.deleteTexture(O),Nt=!0}var mt="01";function bt(){for(var p="1",O="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",W="",pt=0;pt<10;pt++)W+=O[Math.floor(Math.random()*62)];var At=720*60*1e3,Ot=[p,mt,W].join(""),Wt=Date.now()+At;return{token:Ot,tokenExpiresAt:Wt}}var vt=function(p,O){this._transformRequestFn=p,this._customAccessToken=O,this._createSkuToken()};vt.prototype._createSkuToken=function(){var p=bt();this._skuToken=p.token,this._skuTokenExpiresAt=p.tokenExpiresAt},vt.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},vt.prototype.transformRequest=function(p,O){return this._transformRequestFn?this._transformRequestFn(p,O)||{url:p}:{url:p}},vt.prototype.normalizeStyleURL=function(p,O){if(!Ut(p))return p;var W=We(p);return W.path="/styles/v1"+W.path,this._makeAPIURL(W,this._customAccessToken||O)},vt.prototype.normalizeGlyphsURL=function(p,O){if(!Ut(p))return p;var W=We(p);return W.path="/fonts/v1"+W.path,this._makeAPIURL(W,this._customAccessToken||O)},vt.prototype.normalizeSourceURL=function(p,O){if(!Ut(p))return p;var W=We(p);return W.path="/v4/"+W.authority+".json",W.params.push("secure"),this._makeAPIURL(W,this._customAccessToken||O)},vt.prototype.normalizeSpriteURL=function(p,O,W,pt){var At=We(p);return Ut(p)?(At.path="/styles/v1"+At.path+"/sprite"+O+W,this._makeAPIURL(At,this._customAccessToken||pt)):(At.path+=""+O+W,qe(At))},vt.prototype.normalizeTileURL=function(p,O){if(this._isSkuTokenExpired()&&this._createSkuToken(),p&&!Ut(p))return p;var W=We(p),pt=/(\.(png|jpg)\d*)(?=$)/,At=/^.+\/v4\//,Ot=Tt.devicePixelRatio>=2||O===512?"@2x":"",Wt=Ct.supported?".webp":"$1";W.path=W.path.replace(pt,""+Ot+Wt),W.path=W.path.replace(At,"/"),W.path="/v4"+W.path;var _e=this._customAccessToken||Me(W.params)||wt.ACCESS_TOKEN;return wt.REQUIRE_ACCESS_TOKEN&&_e&&this._skuToken&&W.params.push("sku="+this._skuToken),this._makeAPIURL(W,_e)},vt.prototype.canonicalizeTileURL=function(p,O){var W="/v4/",pt=/\.[\w]+$/,At=We(p);if(!At.path.match(/(^\/v4\/)/)||!At.path.match(pt))return p;var Ot="mapbox://tiles/";Ot+=At.path.replace(W,"");var Wt=At.params;return O&&(Wt=Wt.filter(function(_e){return!_e.match(/^access_token=/)})),Wt.length&&(Ot+="?"+Wt.join("&")),Ot},vt.prototype.canonicalizeTileset=function(p,O){for(var W=O?Ut(O):!1,pt=[],At=0,Ot=p.tiles||[];At=0&&p.params.splice(At,1)}if(pt.path!=="/"&&(p.path=""+pt.path+p.path),!wt.REQUIRE_ACCESS_TOKEN)return qe(p);if(O=O||wt.ACCESS_TOKEN,!O)throw new Error("An API access token is required to use Mapbox GL. "+W);if(O[0]==="s")throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+W);return p.params=p.params.filter(function(Ot){return Ot.indexOf("access_token")===-1}),p.params.push("access_token="+O),qe(p)};function Ut(p){return p.indexOf("mapbox:")===0}var re=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function Kt(p){return re.test(p)}function ue(p){return p.indexOf("sku=")>0&&Kt(p)}function Me(p){for(var O=0,W=p;O=1&&s.localStorage.setItem(O,JSON.stringify(this.eventData))}catch{N("Unable to write to LocalStorage")}},er.prototype.processRequests=function(p){},er.prototype.postEvent=function(p,O,W,pt){var At=this;if(wt.EVENTS_URL){var Ot=We(wt.EVENTS_URL);Ot.params.push("access_token="+(pt||wt.ACCESS_TOKEN||""));var Wt={event:this.type,created:new Date(p).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:r,skuId:mt,userId:this.anonId},_e=O?M(Wt,O):Wt,De={url:qe(Ot),headers:{"Content-Type":"text/plain"},body:JSON.stringify([_e])};this.pendingRequest=$r(De,function(Je){At.pendingRequest=null,W(Je),At.saveEventData(),At.processRequests(pt)})}},er.prototype.queueRequest=function(p,O){this.queue.push(p),this.processRequests(O)};var Mr=(function(p){function O(){p.call(this,"map.load"),this.success={},this.skuToken=""}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype.postMapLoadEvent=function(W,pt,At,Ot){this.skuToken=At,(wt.EVENTS_URL&&Ot||wt.ACCESS_TOKEN&&Array.isArray(W)&&W.some(function(Wt){return Ut(Wt)||Kt(Wt)}))&&this.queueRequest({id:pt,timestamp:Date.now()},Ot)},O.prototype.processRequests=function(W){var pt=this;if(!(this.pendingRequest||this.queue.length===0)){var At=this.queue.shift(),Ot=At.id,Wt=At.timestamp;Ot&&this.success[Ot]||(this.anonId||this.fetchEventData(),P(this.anonId)||(this.anonId=b()),this.postEvent(Wt,{skuToken:this.skuToken},function(_e){_e||Ot&&(pt.success[Ot]=!0)},W))}},O})(er),Ir=(function(p){function O(W){p.call(this,"appUserTurnstile"),this._customAccessToken=W}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype.postTurnstileEvent=function(W,pt){wt.EVENTS_URL&&wt.ACCESS_TOKEN&&Array.isArray(W)&&W.some(function(At){return Ut(At)||Kt(At)})&&this.queueRequest(Date.now(),pt)},O.prototype.processRequests=function(W){var pt=this;if(!(this.pendingRequest||this.queue.length===0)){(!this.anonId||!this.eventData.lastSuccess||!this.eventData.tokenU)&&this.fetchEventData();var At=_r(wt.ACCESS_TOKEN),Ot=At?At.u:wt.ACCESS_TOKEN,Wt=Ot!==this.eventData.tokenU;P(this.anonId)||(this.anonId=b(),Wt=!0);var _e=this.queue.shift();if(this.eventData.lastSuccess){var De=new Date(this.eventData.lastSuccess),Je=new Date(_e),sr=(_e-this.eventData.lastSuccess)/(1440*60*1e3);Wt=Wt||sr>=1||sr<-1||De.getDate()!==Je.getDate()}else Wt=!0;if(!Wt)return this.processRequests();this.postEvent(_e,{"enabled.telemetry":!1},function(Ar){Ar||(pt.eventData.lastSuccess=_e,pt.eventData.tokenU=Ot)},W)}},O})(er),de=new Ir,Dt=de.postTurnstileEvent.bind(de),qt=new Mr,_t=qt.postMapLoadEvent.bind(qt),lt="mapbox-tiles",yt=500,St=50,Ht=1e3*60*7,Yt;function se(){s.caches&&!Yt&&(Yt=s.caches.open(lt))}var ke;function Ee(p,O){if(ke===void 0)try{new Response(new ReadableStream),ke=!0}catch{ke=!1}ke?O(p.body):p.blob().then(O)}function Ue(p,O,W){if(se(),!!Yt){var pt={status:O.status,statusText:O.statusText,headers:new s.Headers};O.headers.forEach(function(Wt,_e){return pt.headers.set(_e,Wt)});var At=et(O.headers.get("Cache-Control")||"");if(!At["no-store"]){At["max-age"]&&pt.headers.set("Expires",new Date(W+At["max-age"]*1e3).toUTCString());var Ot=new Date(pt.headers.get("Expires")).getTime()-W;OtDate.now()&&!W["no-cache"]}var Er=1/0;function pn(p){Er++,Er>St&&(p.getActor().send("enforceCacheSizeLimit",yt),Er=0)}function dn(p){se(),Yt&&Yt.then(function(O){O.keys().then(function(W){for(var pt=0;pt=200&&W.status<300||W.status===0)&&W.response!==null){var At=W.response;if(p.type==="json")try{At=JSON.parse(W.response)}catch(Ot){return O(Ot)}O(null,At,W.getResponseHeader("Cache-Control"),W.getResponseHeader("Expires"))}else O(new ra(W.statusText,W.status,p.url))},W.send(p.body),{cancel:function(){return W.abort()}}}var zr=function(p,O){if(!Re(p.url)){if(s.fetch&&s.Request&&s.AbortController&&s.Request.prototype.hasOwnProperty("signal"))return Ze(p,O);if(st()&&self.worker&&self.worker.actor){var W=!0;return self.worker.actor.send("getResource",p,O,void 0,W)}}return tr(p,O)},tn=function(p,O){return zr(M(p,{type:"json"}),O)},Yr=function(p,O){return zr(M(p,{type:"arrayBuffer"}),O)},$r=function(p,O){return zr(M(p,{method:"POST"}),O)};function In(p){var O=s.document.createElement("a");return O.href=p,O.protocol===s.document.location.protocol&&O.host===s.document.location.host}var Nn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Kn(p,O,W,pt){var At=new s.Image,Ot=s.URL;At.onload=function(){O(null,At),Ot.revokeObjectURL(At.src),At.onload=null,s.requestAnimationFrame(function(){At.src=Nn})},At.onerror=function(){return O(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))};var Wt=new s.Blob([new Uint8Array(p)],{type:"image/png"});At.cacheControl=W,At.expires=pt,At.src=p.byteLength?Ot.createObjectURL(Wt):Nn}function $n(p,O){var W=new s.Blob([new Uint8Array(p)],{type:"image/png"});s.createImageBitmap(W).then(function(pt){O(null,pt)}).catch(function(pt){O(new Error("Could not load image because of "+pt.message+". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))})}var ia,Cn,Fa=function(){ia=[],Cn=0};Fa();var Ga=function(p,O){if(Ct.supported&&(p.headers||(p.headers={}),p.headers.accept="image/webp,*/*"),Cn>=wt.MAX_PARALLEL_IMAGE_REQUESTS){var W={requestParameters:p,callback:O,cancelled:!1,cancel:function(){this.cancelled=!0}};return ia.push(W),W}Cn++;var pt=!1,At=function(){if(!pt)for(pt=!0,Cn--;ia.length&&Cn0||this._oneTimeListeners&&this._oneTimeListeners[p]&&this._oneTimeListeners[p].length>0||this._eventedParent&&this._eventedParent.listens(p)},mr.prototype.setEventedParent=function(p,O){return this._eventedParent=p,this._eventedParentData=O,this};var kr=8,Ur={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Or={"*":{type:"source"}},pe=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],Ke={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},xr={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Gr={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},ln={type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},wn={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},rn={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Qr={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},vn=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],Oa={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qn={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qa={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ja={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},wi={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ci={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ti={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ra={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qi={type:"array",value:"*"},Hi={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},Ho={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},Ci={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},zo={type:"array",value:"*",minimum:1},qi={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},qo=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],Po={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},hs={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},Gi={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},uo={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},yi={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},ao={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},ts={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},vs={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},As={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},_o={"*":{type:"string"}},Da={$version:kr,$root:Ur,sources:Or,source:pe,source_vector:Ke,source_raster:xr,source_raster_dem:Gr,source_geojson:ln,source_video:wn,source_image:rn,layer:Qr,layout:vn,layout_background:Oa,layout_fill:Qn,layout_circle:Qa,layout_heatmap:Ja,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:wi,layout_symbol:ci,layout_raster:Ti,layout_hillshade:Ra,filter:Qi,filter_operator:Hi,geometry_type:Ho,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:Ci,expression:zo,light:qi,paint:qo,paint_fill:Po,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:hs,paint_circle:Gi,paint_heatmap:uo,paint_symbol:yi,paint_raster:ao,paint_hillshade:ts,paint_background:vs,transition:As,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:_o},li=function(p,O,W,pt){this.message=(p?p+": ":"")+W,pt&&(this.identifier=pt),O!=null&&O.__line__&&(this.line=O.__line__)};function wo(p){var O=p.key,W=p.value;return W?[new li(O,W,"constants have been deprecated as of v8")]:[]}function Ms(p){for(var O=[],W=arguments.length-1;W-- >0;)O[W]=arguments[W+1];for(var pt=0,At=O;pt":p.itemType.kind==="value"?"array":"array<"+O+">"}else return p.kind}var xl=[al,ii,io,co,Is,Jo,Wo,Ss(Bi),us];function bu(p,O){if(O.kind==="error")return null;if(p.kind==="array"){if(O.kind==="array"&&(O.N===0&&O.itemType.kind==="value"||!bu(p.itemType,O.itemType))&&(typeof p.N!="number"||p.N===O.N))return null}else{if(p.kind===O.kind)return null;if(p.kind==="value")for(var W=0,pt=xl;W255?255:Je}function At(Je){return Je<0?0:Je>1?1:Je}function Ot(Je){return Je[Je.length-1]==="%"?pt(parseFloat(Je)/100*255):pt(parseInt(Je))}function Wt(Je){return Je[Je.length-1]==="%"?At(parseFloat(Je)/100):At(parseFloat(Je))}function _e(Je,sr,Ar){return Ar<0?Ar+=1:Ar>1&&(Ar-=1),Ar*6<1?Je+(sr-Je)*Ar*6:Ar*2<1?sr:Ar*3<2?Je+(sr-Je)*(2/3-Ar)*6:Je}function De(Je){var sr=Je.replace(/ /g,"").toLowerCase();if(sr in W)return W[sr].slice();if(sr[0]==="#"){if(sr.length===4){var Ar=parseInt(sr.substr(1),16);return Ar>=0&&Ar<=4095?[(Ar&3840)>>4|(Ar&3840)>>8,Ar&240|(Ar&240)>>4,Ar&15|(Ar&15)<<4,1]:null}else if(sr.length===7){var Ar=parseInt(sr.substr(1),16);return Ar>=0&&Ar<=16777215?[(Ar&16711680)>>16,(Ar&65280)>>8,Ar&255,1]:null}return null}var Pr=sr.indexOf("("),Vr=sr.indexOf(")");if(Pr!==-1&&Vr+1===sr.length){var un=sr.substr(0,Pr),Fn=sr.substr(Pr+1,Vr-(Pr+1)).split(","),ga=1;switch(un){case"rgba":if(Fn.length!==4)return null;ga=Wt(Fn.pop());case"rgb":return Fn.length!==3?null:[Ot(Fn[0]),Ot(Fn[1]),Ot(Fn[2]),ga];case"hsla":if(Fn.length!==4)return null;ga=Wt(Fn.pop());case"hsl":if(Fn.length!==3)return null;var pa=(parseFloat(Fn[0])%360+360)%360/360,Ea=Wt(Fn[1]),ja=Wt(Fn[2]),Aa=ja<=.5?ja*(Ea+1):ja+Ea-ja*Ea,$a=ja*2-Aa;return[pt(_e($a,Aa,pa+1/3)*255),pt(_e($a,Aa,pa)*255),pt(_e($a,Aa,pa-1/3)*255),ga];default:return null}}return null}try{O.parseCSSColor=De}catch{}}),_c=zc.parseCSSColor,cs=function(p,O,W,pt){pt===void 0&&(pt=1),this.r=p,this.g=O,this.b=W,this.a=pt};cs.parse=function(p){if(p){if(p instanceof cs)return p;if(typeof p=="string"){var O=_c(p);if(O)return new cs(O[0]/255*O[3],O[1]/255*O[3],O[2]/255*O[3],O[3])}}},cs.prototype.toString=function(){var p=this.toArray(),O=p[0],W=p[1],pt=p[2],At=p[3];return"rgba("+Math.round(O)+","+Math.round(W)+","+Math.round(pt)+","+At+")"},cs.prototype.toArray=function(){var p=this,O=p.r,W=p.g,pt=p.b,At=p.a;return At===0?[0,0,0,0]:[O*255/At,W*255/At,pt*255/At,At]},cs.black=new cs(0,0,0,1),cs.white=new cs(1,1,1,1),cs.transparent=new cs(0,0,0,0),cs.red=new cs(1,0,0,1);var Gl=function(p,O,W){p?this.sensitivity=O?"variant":"case":this.sensitivity=O?"accent":"base",this.locale=W,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};Gl.prototype.compare=function(p,O){return this.collator.compare(p,O)},Gl.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var Lc=function(p,O,W,pt,At){this.text=p,this.image=O,this.scale=W,this.fontStack=pt,this.textColor=At},Al=function(p){this.sections=p};Al.fromString=function(p){return new Al([new Lc(p,null,null,null,null)])},Al.prototype.isEmpty=function(){return this.sections.length===0?!0:!this.sections.some(function(p){return p.text.length!==0||p.image&&p.image.name.length!==0})},Al.factory=function(p){return p instanceof Al?p:Al.fromString(p)},Al.prototype.toString=function(){return this.sections.length===0?"":this.sections.map(function(p){return p.text}).join("")},Al.prototype.serialize=function(){for(var p=["format"],O=0,W=this.sections;O=0&&p<=255&&typeof O=="number"&&O>=0&&O<=255&&typeof W=="number"&&W>=0&&W<=255)){var At=typeof pt=="number"?[p,O,W,pt]:[p,O,W];return"Invalid rgba value ["+At.join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}return typeof pt>"u"||typeof pt=="number"&&pt>=0&&pt<=1?null:"Invalid rgba value ["+[p,O,W,pt].join(", ")+"]: 'a' must be between 0 and 1."}function hu(p){if(p===null||typeof p=="string"||typeof p=="boolean"||typeof p=="number"||p instanceof cs||p instanceof Gl||p instanceof Al||p instanceof _l)return!0;if(Array.isArray(p)){for(var O=0,W=p;O2){var Wt=p[1];if(typeof Wt!="string"||!(Wt in Iu)||Wt==="object")return O.error('The item type argument of "array" must be one of string, number, boolean',1);Ot=Iu[Wt],W++}else Ot=Bi;var _e;if(p.length>3){if(p[2]!==null&&(typeof p[2]!="number"||p[2]<0||p[2]!==Math.floor(p[2])))return O.error('The length argument to "array" must be a positive integer literal',2);_e=p[2],W++}pt=Ss(Ot,_e)}else pt=Iu[At];for(var De=[];W1)&&O.push(pt)}}return O.concat(this.args.map(function(At){return At.serialize()}))};var qu=function(p){this.type=Jo,this.sections=p};qu.parse=function(p,O){if(p.length<2)return O.error("Expected at least one argument.");var W=p[1];if(!Array.isArray(W)&&typeof W=="object")return O.error("First argument must be an image or text section.");for(var pt=[],At=!1,Ot=1;Ot<=p.length-1;++Ot){var Wt=p[Ot];if(At&&typeof Wt=="object"&&!Array.isArray(Wt)){At=!1;var _e=null;if(Wt["font-scale"]&&(_e=O.parse(Wt["font-scale"],1,ii),!_e))return null;var De=null;if(Wt["text-font"]&&(De=O.parse(Wt["text-font"],1,Ss(io)),!De))return null;var Je=null;if(Wt["text-color"]&&(Je=O.parse(Wt["text-color"],1,Is),!Je))return null;var sr=pt[pt.length-1];sr.scale=_e,sr.font=De,sr.textColor=Je}else{var Ar=O.parse(p[Ot],1,Bi);if(!Ar)return null;var Pr=Ar.type.kind;if(Pr!=="string"&&Pr!=="value"&&Pr!=="null"&&Pr!=="resolvedImage")return O.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");At=!0,pt.push({content:Ar,scale:null,font:null,textColor:null})}}return new qu(pt)},qu.prototype.evaluate=function(p){var O=function(W){var pt=W.content.evaluate(p);return Fs(pt)===us?new Lc("",pt,null,null,null):new Lc(bl(pt),null,W.scale?W.scale.evaluate(p):null,W.font?W.font.evaluate(p).join(","):null,W.textColor?W.textColor.evaluate(p):null)};return new Al(this.sections.map(O))},qu.prototype.eachChild=function(p){for(var O=0,W=this.sections;O-1),W},qs.prototype.eachChild=function(p){p(this.input)},qs.prototype.outputDefined=function(){return!1},qs.prototype.serialize=function(){return["image",this.input.serialize()]};var sf={"to-boolean":co,"to-color":Is,"to-number":ii,"to-string":io},Oo=function(p,O){this.type=p,this.args=O};Oo.parse=function(p,O){if(p.length<2)return O.error("Expected at least one argument.");var W=p[0];if((W==="to-boolean"||W==="to-string")&&p.length!==2)return O.error("Expected one argument.");for(var pt=sf[W],At=[],Ot=1;Ot4?W="Invalid rbga value "+JSON.stringify(O)+": expected an array containing either three or four numeric values.":W=Ml(O[0],O[1],O[2],O[3]),!W))return new cs(O[0]/255,O[1]/255,O[2]/255,O[3])}throw new bs(W||"Could not parse color from value '"+(typeof O=="string"?O:String(JSON.stringify(O)))+"'")}else if(this.type.kind==="number"){for(var _e=null,De=0,Je=this.args;De=O[2]||p[1]<=O[1]||p[3]>=O[3])}function Xc(p,O){var W=Wu(p[0]),pt=mc(p[1]),At=Math.pow(2,O.z);return[Math.round(W*At*ml),Math.round(pt*At*ml)]}function Bc(p,O,W){var pt=p[0]-O[0],At=p[1]-O[1],Ot=p[0]-W[0],Wt=p[1]-W[1];return pt*Wt-Ot*At===0&&pt*Ot<=0&&At*Wt<=0}function gc(p,O,W){return O[1]>p[1]!=W[1]>p[1]&&p[0]<(W[0]-O[0])*(p[1]-O[1])/(W[1]-O[1])+O[0]}function Gu(p,O){for(var W=!1,pt=0,At=O.length;pt0&&Ar<0||sr<0&&Ar>0}function Rc(p,O,W,pt){var At=[O[0]-p[0],O[1]-p[1]],Ot=[pt[0]-W[0],pt[1]-W[1]];return Pc(Ot,At)===0?!1:!!(du(p,O,W,pt)&&du(W,pt,p,O))}function Pu(p,O,W){for(var pt=0,At=W;ptW[2]){var At=pt*.5,Ot=p[0]-W[0]>At?-pt:W[0]-p[0]>At?pt:0;Ot===0&&(Ot=p[0]-W[2]>At?-pt:W[2]-p[0]>At?pt:0),p[0]+=Ot}Cc(O,p)}function bc(p){p[0]=p[1]=1/0,p[2]=p[3]=-1/0}function lf(p,O,W,pt){for(var At=Math.pow(2,pt.z)*ml,Ot=[pt.x*ml,pt.y*ml],Wt=[],_e=0,De=p;_e=0)return!1;var W=!0;return p.eachChild(function(pt){W&&!Kl(pt,O)&&(W=!1)}),W}var Zu=function(p,O){this.type=O.type,this.name=p,this.boundExpression=O};Zu.parse=function(p,O){if(p.length!==2||typeof p[1]!="string")return O.error("'var' expression requires exactly one string literal argument.");var W=p[1];return O.scope.has(W)?new Zu(W,O.scope.get(W)):O.error('Unknown variable "'+W+'". Make sure "'+W+'" has been bound in an enclosing "let" expression before using it.',1)},Zu.prototype.evaluate=function(p){return this.boundExpression.evaluate(p)},Zu.prototype.eachChild=function(){},Zu.prototype.outputDefined=function(){return!1},Zu.prototype.serialize=function(){return["var",this.name]};var Bs=function(p,O,W,pt,At){O===void 0&&(O=[]),pt===void 0&&(pt=new is),At===void 0&&(At=[]),this.registry=p,this.path=O,this.key=O.map(function(Ot){return"["+Ot+"]"}).join(""),this.scope=pt,this.errors=At,this.expectedType=W};Bs.prototype.parse=function(p,O,W,pt,At){return At===void 0&&(At={}),O?this.concat(O,W,pt)._parse(p,At):this._parse(p,At)},Bs.prototype._parse=function(p,O){(p===null||typeof p=="string"||typeof p=="boolean"||typeof p=="number")&&(p=["literal",p]);function W(Je,sr,Ar){return Ar==="assert"?new Nl(sr,[Je]):Ar==="coerce"?new Oo(sr,[Je]):Je}if(Array.isArray(p)){if(p.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var pt=p[0];if(typeof pt!="string")return this.error("Expression name must be a string, but found "+typeof pt+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var At=this.registry[pt];if(At){var Ot=At.parse(p,this);if(!Ot)return null;if(this.expectedType){var Wt=this.expectedType,_e=Ot.type;if((Wt.kind==="string"||Wt.kind==="number"||Wt.kind==="boolean"||Wt.kind==="object"||Wt.kind==="array")&&_e.kind==="value")Ot=W(Ot,Wt,O.typeAnnotation||"assert");else if((Wt.kind==="color"||Wt.kind==="formatted"||Wt.kind==="resolvedImage")&&(_e.kind==="value"||_e.kind==="string"))Ot=W(Ot,Wt,O.typeAnnotation||"coerce");else if(this.checkSubtype(Wt,_e))return null}if(!(Ot instanceof Fo)&&Ot.type.kind!=="resolvedImage"&&Ou(Ot)){var De=new os;try{Ot=new Fo(Ot.type,Ot.evaluate(De))}catch(Je){return this.error(Je.message),null}}return Ot}return this.error('Unknown expression "'+pt+'". If you wanted a literal array, use ["literal", [...]].',0)}else return typeof p>"u"?this.error("'undefined' value invalid. Use null instead."):typeof p=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof p+" instead.")},Bs.prototype.concat=function(p,O,W){var pt=typeof p=="number"?this.path.concat(p):this.path,At=W?this.scope.concat(W):this.scope;return new Bs(this.registry,pt,O||null,At,this.errors)},Bs.prototype.error=function(p){for(var O=[],W=arguments.length-1;W-- >0;)O[W]=arguments[W+1];var pt=""+this.key+O.map(function(At){return"["+At+"]"}).join("");this.errors.push(new No(pt,p))},Bs.prototype.checkSubtype=function(p,O){var W=bu(p,O);return W&&this.error(W),W};function Ou(p){if(p instanceof Zu)return Ou(p.boundExpression);if(p instanceof Fi&&p.name==="error"||p instanceof pu||p instanceof Zl)return!1;var O=p instanceof Oo||p instanceof Nl,W=!0;return p.eachChild(function(pt){O?W=W&&Ou(pt):W=W&&pt instanceof Fo}),W?Uc(p)&&Kl(p,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}function Rl(p,O){for(var W=p.length-1,pt=0,At=W,Ot=0,Wt,_e;pt<=At;)if(Ot=Math.floor((pt+At)/2),Wt=p[Ot],_e=p[Ot+1],Wt<=O){if(Ot===W||O<_e)return Ot;pt=Ot+1}else if(Wt>O)At=Ot-1;else throw new bs("Input is not a number.");return 0}var Yl=function(p,O,W){this.type=p,this.input=O,this.labels=[],this.outputs=[];for(var pt=0,At=W;pt=Wt)return O.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',De);var sr=O.parse(_e,Je,At);if(!sr)return null;At=At||sr.type,pt.push([Wt,sr])}return new Yl(At,W,pt)},Yl.prototype.evaluate=function(p){var O=this.labels,W=this.outputs;if(O.length===1)return W[0].evaluate(p);var pt=this.input.evaluate(p);if(pt<=O[0])return W[0].evaluate(p);var At=O.length;if(pt>=O[At-1])return W[At-1].evaluate(p);var Ot=Rl(O,pt);return W[Ot].evaluate(p)},Yl.prototype.eachChild=function(p){p(this.input);for(var O=0,W=this.outputs;O0&&p.push(this.labels[O]),p.push(this.outputs[O].serialize());return p};function Ws(p,O,W){return p*(1-W)+O*W}function ic(p,O,W){return new cs(Ws(p.r,O.r,W),Ws(p.g,O.g,W),Ws(p.b,O.b,W),Ws(p.a,O.a,W))}function Tu(p,O,W){return p.map(function(pt,At){return Ws(pt,O[At],W)})}var Ku=Object.freeze({__proto__:null,number:Ws,color:ic,array:Tu}),wc=.95047,uf=1,Sf=1.08883,oc=4/29,Tc=6/29,Fl=3*Tc*Tc,sc=Tc*Tc*Tc,iu=Math.PI/180,lc=180/Math.PI;function kc(p){return p>sc?Math.pow(p,1/3):p/Fl+oc}function ku(p){return p>Tc?p*p*p:Fl*(p-oc)}function Gs(p){return 255*(p<=.0031308?12.92*p:1.055*Math.pow(p,1/2.4)-.055)}function Du(p){return p/=255,p<=.04045?p/12.92:Math.pow((p+.055)/1.055,2.4)}function Xl(p){var O=Du(p.r),W=Du(p.g),pt=Du(p.b),At=kc((.4124564*O+.3575761*W+.1804375*pt)/wc),Ot=kc((.2126729*O+.7151522*W+.072175*pt)/uf),Wt=kc((.0193339*O+.119192*W+.9503041*pt)/Sf);return{l:116*Ot-16,a:500*(At-Ot),b:200*(Ot-Wt),alpha:p.a}}function $c(p){var O=(p.l+16)/116,W=isNaN(p.a)?O:O+p.a/500,pt=isNaN(p.b)?O:O-p.b/200;return O=uf*ku(O),W=wc*ku(W),pt=Sf*ku(pt),new cs(Gs(3.2404542*W-1.5371385*O-.4985314*pt),Gs(-.969266*W+1.8760108*O+.041556*pt),Gs(.0556434*W-.2040259*O+1.0572252*pt),p.alpha)}function Vs(p,O,W){return{l:Ws(p.l,O.l,W),a:Ws(p.a,O.a,W),b:Ws(p.b,O.b,W),alpha:Ws(p.alpha,O.alpha,W)}}function yc(p){var O=Xl(p),W=O.l,pt=O.a,At=O.b,Ot=Math.atan2(At,pt)*lc;return{h:Ot<0?Ot+360:Ot,c:Math.sqrt(pt*pt+At*At),l:W,alpha:p.a}}function Yu(p){var O=p.h*iu,W=p.c,pt=p.l;return $c({l:pt,a:Math.cos(O)*W,b:Math.sin(O)*W,alpha:p.alpha})}function ou(p,O,W){var pt=O-p;return p+W*(pt>180||pt<-180?pt-360*Math.round(pt/360):pt)}function tc(p,O,W){return{h:ou(p.h,O.h,W),c:Ws(p.c,O.c,W),l:Ws(p.l,O.l,W),alpha:Ws(p.alpha,O.alpha,W)}}var Xu={forward:Xl,reverse:$c,interpolate:Vs},xc={forward:yc,reverse:Yu,interpolate:tc},cf=Object.freeze({__proto__:null,lab:Xu,hcl:xc}),zl=function(p,O,W,pt,At){this.type=p,this.operator=O,this.interpolation=W,this.input=pt,this.labels=[],this.outputs=[];for(var Ot=0,Wt=At;Ot1}))return O.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);pt={name:"cubic-bezier",controlPoints:_e}}else return O.error("Unknown interpolation type "+String(pt[0]),1,0);if(p.length-1<4)return O.error("Expected at least 4 arguments, but found only "+(p.length-1)+".");if((p.length-1)%2!==0)return O.error("Expected an even number of arguments.");if(At=O.parse(At,2,ii),!At)return null;var De=[],Je=null;W==="interpolate-hcl"||W==="interpolate-lab"?Je=Is:O.expectedType&&O.expectedType.kind!=="value"&&(Je=O.expectedType);for(var sr=0;sr=Ar)return O.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',Vr);var Fn=O.parse(Pr,un,Je);if(!Fn)return null;Je=Je||Fn.type,De.push([Ar,Fn])}return Je.kind!=="number"&&Je.kind!=="color"&&!(Je.kind==="array"&&Je.itemType.kind==="number"&&typeof Je.N=="number")?O.error("Type "+Ls(Je)+" is not interpolatable."):new zl(Je,W,pt,At,De)},zl.prototype.evaluate=function(p){var O=this.labels,W=this.outputs;if(O.length===1)return W[0].evaluate(p);var pt=this.input.evaluate(p);if(pt<=O[0])return W[0].evaluate(p);var At=O.length;if(pt>=O[At-1])return W[At-1].evaluate(p);var Ot=Rl(O,pt),Wt=O[Ot],_e=O[Ot+1],De=zl.interpolationFactor(this.interpolation,pt,Wt,_e),Je=W[Ot].evaluate(p),sr=W[Ot+1].evaluate(p);return this.operator==="interpolate"?Ku[this.type.kind.toLowerCase()](Je,sr,De):this.operator==="interpolate-hcl"?xc.reverse(xc.interpolate(xc.forward(Je),xc.forward(sr),De)):Xu.reverse(Xu.interpolate(Xu.forward(Je),Xu.forward(sr),De))},zl.prototype.eachChild=function(p){p(this.input);for(var O=0,W=this.outputs;O=W.length)throw new bs("Array index out of bounds: "+O+" > "+(W.length-1)+".");if(O!==Math.floor(O))throw new bs("Array index must be an integer, but found "+O+" instead.");return W[O]},Au.prototype.eachChild=function(p){p(this.index),p(this.input)},Au.prototype.outputDefined=function(){return!1},Au.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var il=function(p,O){this.type=co,this.needle=p,this.haystack=O};il.parse=function(p,O){if(p.length!==3)return O.error("Expected 2 arguments, but found "+(p.length-1)+" instead.");var W=O.parse(p[1],1,Bi),pt=O.parse(p[2],2,Bi);return!W||!pt?null:au(W.type,[co,io,ii,al,Bi])?new il(W,pt):O.error("Expected first argument to be of type boolean, string, number or null, but found "+Ls(W.type)+" instead")},il.prototype.evaluate=function(p){var O=this.needle.evaluate(p),W=this.haystack.evaluate(p);if(!W)return!1;if(!fu(O,["boolean","string","number","null"]))throw new bs("Expected first argument to be of type boolean, string, number or null, but found "+Ls(Fs(O))+" instead.");if(!fu(W,["string","array"]))throw new bs("Expected second argument to be of type array or string, but found "+Ls(Fs(W))+" instead.");return W.indexOf(O)>=0},il.prototype.eachChild=function(p){p(this.needle),p(this.haystack)},il.prototype.outputDefined=function(){return!0},il.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var Cs=function(p,O,W){this.type=ii,this.needle=p,this.haystack=O,this.fromIndex=W};Cs.parse=function(p,O){if(p.length<=2||p.length>=5)return O.error("Expected 3 or 4 arguments, but found "+(p.length-1)+" instead.");var W=O.parse(p[1],1,Bi),pt=O.parse(p[2],2,Bi);if(!W||!pt)return null;if(!au(W.type,[co,io,ii,al,Bi]))return O.error("Expected first argument to be of type boolean, string, number or null, but found "+Ls(W.type)+" instead");if(p.length===4){var At=O.parse(p[3],3,ii);return At?new Cs(W,pt,At):null}else return new Cs(W,pt)},Cs.prototype.evaluate=function(p){var O=this.needle.evaluate(p),W=this.haystack.evaluate(p);if(!fu(O,["boolean","string","number","null"]))throw new bs("Expected first argument to be of type boolean, string, number or null, but found "+Ls(Fs(O))+" instead.");if(!fu(W,["string","array"]))throw new bs("Expected second argument to be of type array or string, but found "+Ls(Fs(W))+" instead.");if(this.fromIndex){var pt=this.fromIndex.evaluate(p);return W.indexOf(O,pt)}return W.indexOf(O)},Cs.prototype.eachChild=function(p){p(this.needle),p(this.haystack),this.fromIndex&&p(this.fromIndex)},Cs.prototype.outputDefined=function(){return!1},Cs.prototype.serialize=function(){if(this.fromIndex!=null&&this.fromIndex!==void 0){var p=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),p]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var Mu=function(p,O,W,pt,At,Ot){this.inputType=p,this.type=O,this.input=W,this.cases=pt,this.outputs=At,this.otherwise=Ot};Mu.parse=function(p,O){if(p.length<5)return O.error("Expected at least 4 arguments, but found only "+(p.length-1)+".");if(p.length%2!==1)return O.error("Expected an even number of arguments.");var W,pt;O.expectedType&&O.expectedType.kind!=="value"&&(pt=O.expectedType);for(var At={},Ot=[],Wt=2;WtNumber.MAX_SAFE_INTEGER)return Je.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if(typeof Pr=="number"&&Math.floor(Pr)!==Pr)return Je.error("Numeric branch labels must be integer values.");if(!W)W=Fs(Pr);else if(Je.checkSubtype(W,Fs(Pr)))return null;if(typeof At[String(Pr)]<"u")return Je.error("Branch labels must be unique.");At[String(Pr)]=Ot.length}var Vr=O.parse(De,Wt,pt);if(!Vr)return null;pt=pt||Vr.type,Ot.push(Vr)}var un=O.parse(p[1],1,Bi);if(!un)return null;var Fn=O.parse(p[p.length-1],p.length-1,pt);return!Fn||un.type.kind!=="value"&&O.concat(1).checkSubtype(W,un.type)?null:new Mu(W,pt,un,At,Ot,Fn)},Mu.prototype.evaluate=function(p){var O=this.input.evaluate(p),W=Fs(O)===this.inputType&&this.outputs[this.cases[O]]||this.otherwise;return W.evaluate(p)},Mu.prototype.eachChild=function(p){p(this.input),this.outputs.forEach(p),p(this.otherwise)},Mu.prototype.outputDefined=function(){return this.outputs.every(function(p){return p.outputDefined()})&&this.otherwise.outputDefined()},Mu.prototype.serialize=function(){for(var p=this,O=["match",this.input.serialize()],W=Object.keys(this.cases).sort(),pt=[],At={},Ot=0,Wt=W;Ot=5)return O.error("Expected 3 or 4 arguments, but found "+(p.length-1)+" instead.");var W=O.parse(p[1],1,Bi),pt=O.parse(p[2],2,ii);if(!W||!pt)return null;if(!au(W.type,[Ss(Bi),io,Bi]))return O.error("Expected first argument to be of type array or string, but found "+Ls(W.type)+" instead");if(p.length===4){var At=O.parse(p[3],3,ii);return At?new Su(W.type,W,pt,At):null}else return new Su(W.type,W,pt)},Su.prototype.evaluate=function(p){var O=this.input.evaluate(p),W=this.beginIndex.evaluate(p);if(!fu(O,["string","array"]))throw new bs("Expected first argument to be of type array or string, but found "+Ls(Fs(O))+" instead.");if(this.endIndex){var pt=this.endIndex.evaluate(p);return O.slice(W,pt)}return O.slice(W)},Su.prototype.eachChild=function(p){p(this.input),p(this.beginIndex),this.endIndex&&p(this.endIndex)},Su.prototype.outputDefined=function(){return!1},Su.prototype.serialize=function(){if(this.endIndex!=null&&this.endIndex!==void 0){var p=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),p]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};function Dc(p,O){return p==="=="||p==="!="?O.kind==="boolean"||O.kind==="string"||O.kind==="number"||O.kind==="null"||O.kind==="value":O.kind==="string"||O.kind==="number"||O.kind==="value"}function Xe(p,O,W){return O===W}function yr(p,O,W){return O!==W}function Kr(p,O,W){return OW}function mn(p,O,W){return O<=W}function Pn(p,O,W){return O>=W}function ha(p,O,W,pt){return pt.compare(O,W)===0}function Ta(p,O,W,pt){return!ha(p,O,W,pt)}function Ua(p,O,W,pt){return pt.compare(O,W)<0}function Ya(p,O,W,pt){return pt.compare(O,W)>0}function va(p,O,W,pt){return pt.compare(O,W)<=0}function Ba(p,O,W,pt){return pt.compare(O,W)>=0}function za(p,O,W){var pt=p!=="=="&&p!=="!=";return(function(){function At(Ot,Wt,_e){this.type=co,this.lhs=Ot,this.rhs=Wt,this.collator=_e,this.hasUntypedArgument=Ot.type.kind==="value"||Wt.type.kind==="value"}return At.parse=function(Ot,Wt){if(Ot.length!==3&&Ot.length!==4)return Wt.error("Expected two or three arguments.");var _e=Ot[0],De=Wt.parse(Ot[1],1,Bi);if(!De)return null;if(!Dc(_e,De.type))return Wt.concat(1).error('"'+_e+`" comparisons are not supported for type '`+Ls(De.type)+"'.");var Je=Wt.parse(Ot[2],2,Bi);if(!Je)return null;if(!Dc(_e,Je.type))return Wt.concat(2).error('"'+_e+`" comparisons are not supported for type '`+Ls(Je.type)+"'.");if(De.type.kind!==Je.type.kind&&De.type.kind!=="value"&&Je.type.kind!=="value")return Wt.error("Cannot compare types '"+Ls(De.type)+"' and '"+Ls(Je.type)+"'.");pt&&(De.type.kind==="value"&&Je.type.kind!=="value"?De=new Nl(Je.type,[De]):De.type.kind!=="value"&&Je.type.kind==="value"&&(Je=new Nl(De.type,[Je])));var sr=null;if(Ot.length===4){if(De.type.kind!=="string"&&Je.type.kind!=="string"&&De.type.kind!=="value"&&Je.type.kind!=="value")return Wt.error("Cannot use collator to compare non-string types.");if(sr=Wt.parse(Ot[3],3,fl),!sr)return null}return new At(De,Je,sr)},At.prototype.evaluate=function(Ot){var Wt=this.lhs.evaluate(Ot),_e=this.rhs.evaluate(Ot);if(pt&&this.hasUntypedArgument){var De=Fs(Wt),Je=Fs(_e);if(De.kind!==Je.kind||!(De.kind==="string"||De.kind==="number"))throw new bs('Expected arguments for "'+p+'" to be (string, string) or (number, number), but found ('+De.kind+", "+Je.kind+") instead.")}if(this.collator&&!pt&&this.hasUntypedArgument){var sr=Fs(Wt),Ar=Fs(_e);if(sr.kind!=="string"||Ar.kind!=="string")return O(Ot,Wt,_e)}return this.collator?W(Ot,Wt,_e,this.collator.evaluate(Ot)):O(Ot,Wt,_e)},At.prototype.eachChild=function(Ot){Ot(this.lhs),Ot(this.rhs),this.collator&&Ot(this.collator)},At.prototype.outputDefined=function(){return!0},At.prototype.serialize=function(){var Ot=[p];return this.eachChild(function(Wt){Ot.push(Wt.serialize())}),Ot},At})()}var ca=za("==",Xe,ha),ei=za("!=",yr,Ta),Vi=za("<",Kr,Ua),Oi=za(">",Rr,Ya),Wi=za("<=",mn,va),Xi=za(">=",Pn,Ba),ni=function(p,O,W,pt,At){this.type=io,this.number=p,this.locale=O,this.currency=W,this.minFractionDigits=pt,this.maxFractionDigits=At};ni.parse=function(p,O){if(p.length!==3)return O.error("Expected two arguments.");var W=O.parse(p[1],1,ii);if(!W)return null;var pt=p[2];if(typeof pt!="object"||Array.isArray(pt))return O.error("NumberFormat options argument must be an object.");var At=null;if(pt.locale&&(At=O.parse(pt.locale,1,io),!At))return null;var Ot=null;if(pt.currency&&(Ot=O.parse(pt.currency,1,io),!Ot))return null;var Wt=null;if(pt["min-fraction-digits"]&&(Wt=O.parse(pt["min-fraction-digits"],1,ii),!Wt))return null;var _e=null;return pt["max-fraction-digits"]&&(_e=O.parse(pt["max-fraction-digits"],1,ii),!_e)?null:new ni(W,At,Ot,Wt,_e)},ni.prototype.evaluate=function(p){return new Intl.NumberFormat(this.locale?this.locale.evaluate(p):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(p):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(p):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(p):void 0}).format(this.number.evaluate(p))},ni.prototype.eachChild=function(p){p(this.number),this.locale&&p(this.locale),this.currency&&p(this.currency),this.minFractionDigits&&p(this.minFractionDigits),this.maxFractionDigits&&p(this.maxFractionDigits)},ni.prototype.outputDefined=function(){return!1},ni.prototype.serialize=function(){var p={};return this.locale&&(p.locale=this.locale.serialize()),this.currency&&(p.currency=this.currency.serialize()),this.minFractionDigits&&(p["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(p["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),p]};var Za=function(p){this.type=ii,this.input=p};Za.parse=function(p,O){if(p.length!==2)return O.error("Expected 1 argument, but found "+(p.length-1)+" instead.");var W=O.parse(p[1],1);return W?W.type.kind!=="array"&&W.type.kind!=="string"&&W.type.kind!=="value"?O.error("Expected argument of type string or array, but found "+Ls(W.type)+" instead."):new Za(W):null},Za.prototype.evaluate=function(p){var O=this.input.evaluate(p);if(typeof O=="string"||Array.isArray(O))return O.length;throw new bs("Expected value to be of type string or array, but found "+Ls(Fs(O))+" instead.")},Za.prototype.eachChild=function(p){p(this.input)},Za.prototype.outputDefined=function(){return!1},Za.prototype.serialize=function(){var p=["length"];return this.eachChild(function(O){p.push(O.serialize())}),p};var $i={"==":ca,"!=":ei,">":Oi,"<":Vi,">=":Xi,"<=":Wi,array:Nl,at:Au,boolean:Nl,case:uc,coalesce:su,collator:pu,format:qu,image:qs,in:il,"index-of":Cs,interpolate:zl,"interpolate-hcl":zl,"interpolate-lab":zl,length:Za,let:Fu,literal:Fo,match:Mu,number:Nl,"number-format":ni,object:Nl,slice:Su,step:Yl,string:Nl,"to-boolean":Oo,"to-color":Oo,"to-number":Oo,"to-string":Oo,var:Zu,within:Zl};function Do(p,O){var W=O[0],pt=O[1],At=O[2],Ot=O[3];W=W.evaluate(p),pt=pt.evaluate(p),At=At.evaluate(p);var Wt=Ot?Ot.evaluate(p):1,_e=Ml(W,pt,At,Wt);if(_e)throw new bs(_e);return new cs(W/255*Wt,pt/255*Wt,At/255*Wt,Wt)}function ss(p,O){return p in O}function Ps(p,O){var W=O[p];return typeof W>"u"?null:W}function ys(p,O,W,pt){for(;W<=pt;){var At=W+pt>>1;if(O[At]===p)return!0;O[At]>p?pt=At-1:W=At+1}return!1}function Os(p){return{type:p}}Fi.register($i,{error:[$s,[io],function(p,O){var W=O[0];throw new bs(W.evaluate(p))}],typeof:[io,[Bi],function(p,O){var W=O[0];return Ls(Fs(W.evaluate(p)))}],"to-rgba":[Ss(ii,4),[Is],function(p,O){var W=O[0];return W.evaluate(p).toArray()}],rgb:[Is,[ii,ii,ii],Do],rgba:[Is,[ii,ii,ii,ii],Do],has:{type:co,overloads:[[[io],function(p,O){var W=O[0];return ss(W.evaluate(p),p.properties())}],[[io,Wo],function(p,O){var W=O[0],pt=O[1];return ss(W.evaluate(p),pt.evaluate(p))}]]},get:{type:Bi,overloads:[[[io],function(p,O){var W=O[0];return Ps(W.evaluate(p),p.properties())}],[[io,Wo],function(p,O){var W=O[0],pt=O[1];return Ps(W.evaluate(p),pt.evaluate(p))}]]},"feature-state":[Bi,[io],function(p,O){var W=O[0];return Ps(W.evaluate(p),p.featureState||{})}],properties:[Wo,[],function(p){return p.properties()}],"geometry-type":[io,[],function(p){return p.geometryType()}],id:[Bi,[],function(p){return p.id()}],zoom:[ii,[],function(p){return p.globals.zoom}],"heatmap-density":[ii,[],function(p){return p.globals.heatmapDensity||0}],"line-progress":[ii,[],function(p){return p.globals.lineProgress||0}],accumulated:[Bi,[],function(p){return p.globals.accumulated===void 0?null:p.globals.accumulated}],"+":[ii,Os(ii),function(p,O){for(var W=0,pt=0,At=O;pt":[co,[io,Bi],function(p,O){var W=O[0],pt=O[1],At=p.properties()[W.value],Ot=pt.value;return typeof At==typeof Ot&&At>Ot}],"filter-id->":[co,[Bi],function(p,O){var W=O[0],pt=p.id(),At=W.value;return typeof pt==typeof At&&pt>At}],"filter-<=":[co,[io,Bi],function(p,O){var W=O[0],pt=O[1],At=p.properties()[W.value],Ot=pt.value;return typeof At==typeof Ot&&At<=Ot}],"filter-id-<=":[co,[Bi],function(p,O){var W=O[0],pt=p.id(),At=W.value;return typeof pt==typeof At&&pt<=At}],"filter->=":[co,[io,Bi],function(p,O){var W=O[0],pt=O[1],At=p.properties()[W.value],Ot=pt.value;return typeof At==typeof Ot&&At>=Ot}],"filter-id->=":[co,[Bi],function(p,O){var W=O[0],pt=p.id(),At=W.value;return typeof pt==typeof At&&pt>=At}],"filter-has":[co,[Bi],function(p,O){var W=O[0];return W.value in p.properties()}],"filter-has-id":[co,[],function(p){return p.id()!==null&&p.id()!==void 0}],"filter-type-in":[co,[Ss(io)],function(p,O){var W=O[0];return W.value.indexOf(p.geometryType())>=0}],"filter-id-in":[co,[Ss(Bi)],function(p,O){var W=O[0];return W.value.indexOf(p.id())>=0}],"filter-in-small":[co,[io,Ss(Bi)],function(p,O){var W=O[0],pt=O[1];return pt.value.indexOf(p.properties()[W.value])>=0}],"filter-in-large":[co,[io,Ss(Bi)],function(p,O){var W=O[0],pt=O[1];return ys(p.properties()[W.value],pt.value,0,pt.value.length-1)}],all:{type:co,overloads:[[[co,co],function(p,O){var W=O[0],pt=O[1];return W.evaluate(p)&&pt.evaluate(p)}],[Os(co),function(p,O){for(var W=0,pt=O;W-1}function bi(p){return!!p.expression&&p.expression.interpolated}function so(p){return p instanceof Number?"number":p instanceof String?"string":p instanceof Boolean?"boolean":Array.isArray(p)?"array":p===null?"null":typeof p}function ws(p){return typeof p=="object"&&p!==null&&!Array.isArray(p)}function fs(p){return p}function Ll(p,O){var W=O.type==="color",pt=p.stops&&typeof p.stops[0][0]=="object",At=pt||p.property!==void 0,Ot=pt||!At,Wt=p.type||(bi(O)?"exponential":"interval");if(W&&(p=Ms({},p),p.stops&&(p.stops=p.stops.map(function(Ei){return[Ei[0],cs.parse(Ei[1])]})),p.default?p.default=cs.parse(p.default):p.default=cs.parse(O.default)),p.colorSpace&&p.colorSpace!=="rgb"&&!cf[p.colorSpace])throw new Error("Unknown color space: "+p.colorSpace);var _e,De,Je;if(Wt==="exponential")_e=Jl;else if(Wt==="interval")_e=Bu;else if(Wt==="categorical"){_e=jl,De=Object.create(null);for(var sr=0,Ar=p.stops;sr=p.stops[pt-1][0])return p.stops[pt-1][1];var At=Rl(p.stops.map(function(Ot){return Ot[0]}),W);return p.stops[At][1]}function Jl(p,O,W){var pt=p.base!==void 0?p.base:1;if(so(W)!=="number")return $l(p.default,O.default);var At=p.stops.length;if(At===1||W<=p.stops[0][0])return p.stops[0][1];if(W>=p.stops[At-1][0])return p.stops[At-1][1];var Ot=Rl(p.stops.map(function(Ar){return Ar[0]}),W),Wt=nl(W,pt,p.stops[Ot][0],p.stops[Ot+1][0]),_e=p.stops[Ot][1],De=p.stops[Ot+1][1],Je=Ku[O.type]||fs;if(p.colorSpace&&p.colorSpace!=="rgb"){var sr=cf[p.colorSpace];Je=function(Ar,Pr){return sr.reverse(sr.interpolate(sr.forward(Ar),sr.forward(Pr),Wt))}}return typeof _e.evaluate=="function"?{evaluate:function(){for(var Ar=[],Pr=arguments.length;Pr--;)Ar[Pr]=arguments[Pr];var Vr=_e.evaluate.apply(void 0,Ar),un=De.evaluate.apply(void 0,Ar);if(!(Vr===void 0||un===void 0))return Je(Vr,un,Wt)}}:Je(_e,De,Wt)}function Ru(p,O,W){return O.type==="color"?W=cs.parse(W):O.type==="formatted"?W=Al.fromString(W.toString()):O.type==="resolvedImage"?W=_l.fromString(W.toString()):so(W)!==O.type&&(O.type!=="enum"||!O.values[W])&&(W=void 0),$l(W,p.default,O.default)}function nl(p,O,W,pt){var At=pt-W,Ot=p-W;return At===0?0:O===1?Ot/At:(Math.pow(O,Ot)-1)/(Math.pow(O,At)-1)}var Nu=function(p,O){this.expression=p,this._warningHistory={},this._evaluator=new os,this._defaultValue=O?kt(O):null,this._enumValues=O&&O.type==="enum"?O.values:null};Nu.prototype.evaluateWithoutErrorHandling=function(p,O,W,pt,At,Ot){return this._evaluator.globals=p,this._evaluator.feature=O,this._evaluator.featureState=W,this._evaluator.canonical=pt,this._evaluator.availableImages=At||null,this._evaluator.formattedSection=Ot,this.expression.evaluate(this._evaluator)},Nu.prototype.evaluate=function(p,O,W,pt,At,Ot){this._evaluator.globals=p,this._evaluator.feature=O||null,this._evaluator.featureState=W||null,this._evaluator.canonical=pt,this._evaluator.availableImages=At||null,this._evaluator.formattedSection=Ot||null;try{var Wt=this.expression.evaluate(this._evaluator);if(Wt==null||typeof Wt=="number"&&Wt!==Wt)return this._defaultValue;if(this._enumValues&&!(Wt in this._enumValues))throw new bs("Expected value to be one of "+Object.keys(this._enumValues).map(function(_e){return JSON.stringify(_e)}).join(", ")+", but found "+JSON.stringify(Wt)+" instead.");return Wt}catch(_e){return this._warningHistory[_e.message]||(this._warningHistory[_e.message]=!0,typeof console<"u"&&console.warn(_e.message)),this._defaultValue}};function Ui(p){return Array.isArray(p)&&p.length>0&&typeof p[0]=="string"&&p[0]in $i}function fo(p,O){var W=new Bs($i,[],O?xt(O):void 0),pt=W.parse(p,void 0,void 0,void 0,O&&O.type==="string"?{typeAnnotation:"coerce"}:void 0);return pt?Yo(new Nu(pt,O)):ll(W.errors)}var Ql=function(p,O){this.kind=p,this._styleExpression=O,this.isStateDependent=p!=="constant"&&!rl(O.expression)};Ql.prototype.evaluateWithoutErrorHandling=function(p,O,W,pt,At,Ot){return this._styleExpression.evaluateWithoutErrorHandling(p,O,W,pt,At,Ot)},Ql.prototype.evaluate=function(p,O,W,pt,At,Ot){return this._styleExpression.evaluate(p,O,W,pt,At,Ot)};var ul=function(p,O,W,pt){this.kind=p,this.zoomStops=W,this._styleExpression=O,this.isStateDependent=p!=="camera"&&!rl(O.expression),this.interpolationType=pt};ul.prototype.evaluateWithoutErrorHandling=function(p,O,W,pt,At,Ot){return this._styleExpression.evaluateWithoutErrorHandling(p,O,W,pt,At,Ot)},ul.prototype.evaluate=function(p,O,W,pt,At,Ot){return this._styleExpression.evaluate(p,O,W,pt,At,Ot)},ul.prototype.interpolationFactor=function(p,O,W){return this.interpolationType?zl.interpolationFactor(this.interpolationType,p,O,W):0};function Fc(p,O){if(p=fo(p,O),p.result==="error")return p;var W=p.value.expression,pt=Uc(W);if(!pt&&!el(O))return ll([new No("","data expressions not supported")]);var At=Kl(W,["zoom"]);if(!At&&!Rs(O))return ll([new No("","zoom expressions not supported")]);var Ot=at(W);if(!Ot&&!At)return ll([new No("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(Ot instanceof No)return ll([Ot]);if(Ot instanceof zl&&!bi(O))return ll([new No("",'"interpolate" expressions cannot be used with this property')]);if(!Ot)return Yo(pt?new Ql("constant",p.value):new Ql("source",p.value));var Wt=Ot instanceof zl?Ot.interpolation:void 0;return Yo(pt?new ul("camera",p.value,Ot.labels,Wt):new ul("composite",p.value,Ot.labels,Wt))}var Pt=function(p,O){this._parameters=p,this._specification=O,Ms(this,Ll(this._parameters,this._specification))};Pt.deserialize=function(p){return new Pt(p._parameters,p._specification)},Pt.serialize=function(p){return{_parameters:p._parameters,_specification:p._specification}};function L(p,O){if(ws(p))return new Pt(p,O);if(Ui(p)){var W=Fc(p,O);if(W.result==="error")throw new Error(W.value.map(function(At){return At.key+": "+At.message}).join(", "));return W.value}else{var pt=p;return typeof p=="string"&&O.type==="color"&&(pt=cs.parse(p)),{kind:"constant",evaluate:function(){return pt}}}}function at(p){var O=null;if(p instanceof Fu)O=at(p.result);else if(p instanceof su)for(var W=0,pt=p.args;Wpt.maximum?[new li(O,W,W+" is greater than the maximum value "+pt.maximum)]:[]}function Pe(p){var O=p.valueSpec,W=Di(p.value.type),pt,At={},Ot,Wt,_e=W!=="categorical"&&p.value.property===void 0,De=!_e,Je=so(p.value.stops)==="array"&&so(p.value.stops[0])==="array"&&so(p.value.stops[0][0])==="object",sr=Lt({key:p.key,value:p.value,valueSpec:p.styleSpec.function,style:p.style,styleSpec:p.styleSpec,objectElementValidators:{stops:Ar,default:un}});return W==="identity"&&_e&&sr.push(new li(p.key,p.value,'missing required property "property"')),W!=="identity"&&!p.value.stops&&sr.push(new li(p.key,p.value,'missing required property "stops"')),W==="exponential"&&p.valueSpec.expression&&!bi(p.valueSpec)&&sr.push(new li(p.key,p.value,"exponential functions not supported")),p.styleSpec.$version>=8&&(De&&!el(p.valueSpec)?sr.push(new li(p.key,p.value,"property functions not supported")):_e&&!Rs(p.valueSpec)&&sr.push(new li(p.key,p.value,"zoom functions not supported"))),(W==="categorical"||Je)&&p.value.property===void 0&&sr.push(new li(p.key,p.value,'"property" property is required')),sr;function Ar(Fn){if(W==="identity")return[new li(Fn.key,Fn.value,'identity function may not have a "stops" property')];var ga=[],pa=Fn.value;return ga=ga.concat(le({key:Fn.key,value:pa,valueSpec:Fn.valueSpec,style:Fn.style,styleSpec:Fn.styleSpec,arrayElementValidator:Pr})),so(pa)==="array"&&pa.length===0&&ga.push(new li(Fn.key,pa,"array must have at least one stop")),ga}function Pr(Fn){var ga=[],pa=Fn.value,Ea=Fn.key;if(so(pa)!=="array")return[new li(Ea,pa,"array expected, "+so(pa)+" found")];if(pa.length!==2)return[new li(Ea,pa,"array length 2 expected, length "+pa.length+" found")];if(Je){if(so(pa[0])!=="object")return[new li(Ea,pa,"object expected, "+so(pa[0])+" found")];if(pa[0].zoom===void 0)return[new li(Ea,pa,"object stop key must have zoom")];if(pa[0].value===void 0)return[new li(Ea,pa,"object stop key must have value")];if(Wt&&Wt>Di(pa[0].zoom))return[new li(Ea,pa[0].zoom,"stop zoom values must appear in ascending order")];Di(pa[0].zoom)!==Wt&&(Wt=Di(pa[0].zoom),Ot=void 0,At={}),ga=ga.concat(Lt({key:Ea+"[0]",value:pa[0],valueSpec:{zoom:{}},style:Fn.style,styleSpec:Fn.styleSpec,objectElementValidators:{zoom:xe,value:Vr}}))}else ga=ga.concat(Vr({key:Ea+"[0]",value:pa[0],style:Fn.style,styleSpec:Fn.styleSpec},pa));return Ui(_s(pa[1]))?ga.concat([new li(Ea+"[1]",pa[1],"expressions are not allowed in function stops.")]):ga.concat(Xo({key:Ea+"[1]",value:pa[1],valueSpec:O,style:Fn.style,styleSpec:Fn.styleSpec}))}function Vr(Fn,ga){var pa=so(Fn.value),Ea=Di(Fn.value),ja=Fn.value!==null?Fn.value:ga;if(!pt)pt=pa;else if(pa!==pt)return[new li(Fn.key,ja,pa+" stop domain type must match previous stop domain type "+pt)];if(pa!=="number"&&pa!=="string"&&pa!=="boolean")return[new li(Fn.key,ja,"stop domain value must be a number, string, or boolean")];if(pa!=="number"&&W!=="categorical"){var Aa="number expected, "+pa+" found";return el(O)&&W===void 0&&(Aa+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new li(Fn.key,ja,Aa)]}return W==="categorical"&&pa==="number"&&(!isFinite(Ea)||Math.floor(Ea)!==Ea)?[new li(Fn.key,ja,"integer expected, found "+Ea)]:W!=="categorical"&&pa==="number"&&Ot!==void 0&&Ea=2&&p[1]!=="$id"&&p[1]!=="$type";case"in":return p.length>=3&&(typeof p[1]!="string"||Array.isArray(p[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return p.length!==3||Array.isArray(p[1])||Array.isArray(p[2]);case"any":case"all":for(var O=0,W=p.slice(1);OO?1:0}function ce(p){if(!Array.isArray(p))return!1;if(p[0]==="within")return!0;for(var O=1;O"||O==="<="||O===">="?ye(p[1],p[2],O):O==="any"?ze(p.slice(1)):O==="all"?["all"].concat(p.slice(1).map(Te)):O==="none"?["all"].concat(p.slice(1).map(Te).map(gr)):O==="in"?rr(p[1],p.slice(2)):O==="!in"?gr(rr(p[1],p.slice(2))):O==="has"?fr(p[1]):O==="!has"?gr(fr(p[1])):O==="within"?p:!0;return W}function ye(p,O,W){switch(p){case"$type":return["filter-type-"+W,O];case"$id":return["filter-id-"+W,O];default:return["filter-"+W,p,O]}}function ze(p){return["any"].concat(p.map(Te))}function rr(p,O){if(O.length===0)return!1;switch(p){case"$type":return["filter-type-in",["literal",O]];case"$id":return["filter-id-in",["literal",O]];default:return O.length>200&&!O.some(function(W){return typeof W!=typeof O[0]})?["filter-in-large",p,["literal",O.sort(ae)]]:["filter-in-small",p,["literal",O]]}}function fr(p){switch(p){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",p]}}function gr(p){return["!",p]}function Lr(p){return Jr(_s(p.value))?$e(Ms({},p,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Hr(p)}function Hr(p){var O=p.value,W=p.key;if(so(O)!=="array")return[new li(W,O,"array expected, "+so(O)+" found")];var pt=p.styleSpec,At,Ot=[];if(O.length<1)return[new li(W,O,"filter array must have at least 1 element")];switch(Ot=Ot.concat(Br({key:W+"[0]",value:O[0],valueSpec:pt.filter_operator,style:p.style,styleSpec:p.styleSpec})),Di(O[0])){case"<":case"<=":case">":case">=":O.length>=2&&Di(O[1])==="$type"&&Ot.push(new li(W,O,'"$type" cannot be use with operator "'+O[0]+'"'));case"==":case"!=":O.length!==3&&Ot.push(new li(W,O,'filter array for operator "'+O[0]+'" must have 3 elements'));case"in":case"!in":O.length>=2&&(At=so(O[1]),At!=="string"&&Ot.push(new li(W+"[1]",O[1],"string expected, "+At+" found")));for(var Wt=2;Wt=sr[Vr+0]&&pt>=sr[Vr+1])?(Wt[Pr]=!0,Ot.push(Je[Pr])):Wt[Pr]=!1}}},Xt.prototype._forEachCell=function(p,O,W,pt,At,Ot,Wt,_e){for(var De=this._convertToCellCoord(p),Je=this._convertToCellCoord(O),sr=this._convertToCellCoord(W),Ar=this._convertToCellCoord(pt),Pr=De;Pr<=sr;Pr++)for(var Vr=Je;Vr<=Ar;Vr++){var un=this.d*Vr+Pr;if(!(_e&&!_e(this._convertFromCellCoord(Pr),this._convertFromCellCoord(Vr),this._convertFromCellCoord(Pr+1),this._convertFromCellCoord(Vr+1)))&&At.call(this,p,O,W,pt,un,Ot,Wt,_e))return}},Xt.prototype._convertFromCellCoord=function(p){return(p-this.padding)/this.scale},Xt.prototype._convertToCellCoord=function(p){return Math.max(0,Math.min(this.d-1,Math.floor(p*this.scale)+this.padding))},Xt.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var p=this.cells,O=Et+this.cells.length+1+1,W=0,pt=0;pt=0)){var Ar=p[sr];Je[sr]=we[De].shallow.indexOf(sr)>=0?Ar:Sr(Ar,O)}p instanceof Error&&(Je.message=p.message)}if(Je.$name)throw new Error("$name property is reserved for worker serialization logic.");return De!=="Object"&&(Je.$name=De),Je}throw new Error("can't serialize object of type "+typeof p)}function Wr(p){if(p==null||typeof p=="boolean"||typeof p=="number"||typeof p=="string"||p instanceof Boolean||p instanceof Number||p instanceof String||p instanceof Date||p instanceof RegExp||or(p)||Cr(p)||ArrayBuffer.isView(p)||p instanceof fe)return p;if(Array.isArray(p))return p.map(Wr);if(typeof p=="object"){var O=p.$name||"Object",W=we[O],pt=W.klass;if(!pt)throw new Error("can't deserialize unregistered class "+O);if(pt.deserialize)return pt.deserialize(p);for(var At=Object.create(pt.prototype),Ot=0,Wt=Object.keys(p);Ot=0?De:Wr(De)}}return At}throw new Error("can't deserialize object of type "+typeof p)}var an=function(){this.first=!0};an.prototype.update=function(p,O){var W=Math.floor(p);return this.first?(this.first=!1,this.lastIntegerZoom=W,this.lastIntegerZoomTime=0,this.lastZoom=p,this.lastFloorZoom=W,!0):(this.lastFloorZoom>W?(this.lastIntegerZoom=W+1,this.lastIntegerZoomTime=O):this.lastFloorZoom=128&&p<=255},Arabic:function(p){return p>=1536&&p<=1791},"Arabic Supplement":function(p){return p>=1872&&p<=1919},"Arabic Extended-A":function(p){return p>=2208&&p<=2303},"Hangul Jamo":function(p){return p>=4352&&p<=4607},"Unified Canadian Aboriginal Syllabics":function(p){return p>=5120&&p<=5759},Khmer:function(p){return p>=6016&&p<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(p){return p>=6320&&p<=6399},"General Punctuation":function(p){return p>=8192&&p<=8303},"Letterlike Symbols":function(p){return p>=8448&&p<=8527},"Number Forms":function(p){return p>=8528&&p<=8591},"Miscellaneous Technical":function(p){return p>=8960&&p<=9215},"Control Pictures":function(p){return p>=9216&&p<=9279},"Optical Character Recognition":function(p){return p>=9280&&p<=9311},"Enclosed Alphanumerics":function(p){return p>=9312&&p<=9471},"Geometric Shapes":function(p){return p>=9632&&p<=9727},"Miscellaneous Symbols":function(p){return p>=9728&&p<=9983},"Miscellaneous Symbols and Arrows":function(p){return p>=11008&&p<=11263},"CJK Radicals Supplement":function(p){return p>=11904&&p<=12031},"Kangxi Radicals":function(p){return p>=12032&&p<=12255},"Ideographic Description Characters":function(p){return p>=12272&&p<=12287},"CJK Symbols and Punctuation":function(p){return p>=12288&&p<=12351},Hiragana:function(p){return p>=12352&&p<=12447},Katakana:function(p){return p>=12448&&p<=12543},Bopomofo:function(p){return p>=12544&&p<=12591},"Hangul Compatibility Jamo":function(p){return p>=12592&&p<=12687},Kanbun:function(p){return p>=12688&&p<=12703},"Bopomofo Extended":function(p){return p>=12704&&p<=12735},"CJK Strokes":function(p){return p>=12736&&p<=12783},"Katakana Phonetic Extensions":function(p){return p>=12784&&p<=12799},"Enclosed CJK Letters and Months":function(p){return p>=12800&&p<=13055},"CJK Compatibility":function(p){return p>=13056&&p<=13311},"CJK Unified Ideographs Extension A":function(p){return p>=13312&&p<=19903},"Yijing Hexagram Symbols":function(p){return p>=19904&&p<=19967},"CJK Unified Ideographs":function(p){return p>=19968&&p<=40959},"Yi Syllables":function(p){return p>=40960&&p<=42127},"Yi Radicals":function(p){return p>=42128&&p<=42191},"Hangul Jamo Extended-A":function(p){return p>=43360&&p<=43391},"Hangul Syllables":function(p){return p>=44032&&p<=55215},"Hangul Jamo Extended-B":function(p){return p>=55216&&p<=55295},"Private Use Area":function(p){return p>=57344&&p<=63743},"CJK Compatibility Ideographs":function(p){return p>=63744&&p<=64255},"Arabic Presentation Forms-A":function(p){return p>=64336&&p<=65023},"Vertical Forms":function(p){return p>=65040&&p<=65055},"CJK Compatibility Forms":function(p){return p>=65072&&p<=65103},"Small Form Variants":function(p){return p>=65104&&p<=65135},"Arabic Presentation Forms-B":function(p){return p>=65136&&p<=65279},"Halfwidth and Fullwidth Forms":function(p){return p>=65280&&p<=65519}};function ta(p){for(var O=0,W=p;O=65097&&p<=65103)||on["CJK Compatibility Ideographs"](p)||on["CJK Compatibility"](p)||on["CJK Radicals Supplement"](p)||on["CJK Strokes"](p)||on["CJK Symbols and Punctuation"](p)&&!(p>=12296&&p<=12305)&&!(p>=12308&&p<=12319)&&p!==12336||on["CJK Unified Ideographs Extension A"](p)||on["CJK Unified Ideographs"](p)||on["Enclosed CJK Letters and Months"](p)||on["Hangul Compatibility Jamo"](p)||on["Hangul Jamo Extended-A"](p)||on["Hangul Jamo Extended-B"](p)||on["Hangul Jamo"](p)||on["Hangul Syllables"](p)||on.Hiragana(p)||on["Ideographic Description Characters"](p)||on.Kanbun(p)||on["Kangxi Radicals"](p)||on["Katakana Phonetic Extensions"](p)||on.Katakana(p)&&p!==12540||on["Halfwidth and Fullwidth Forms"](p)&&p!==65288&&p!==65289&&p!==65293&&!(p>=65306&&p<=65310)&&p!==65339&&p!==65341&&p!==65343&&!(p>=65371&&p<=65503)&&p!==65507&&!(p>=65512&&p<=65519)||on["Small Form Variants"](p)&&!(p>=65112&&p<=65118)&&!(p>=65123&&p<=65126)||on["Unified Canadian Aboriginal Syllabics"](p)||on["Unified Canadian Aboriginal Syllabics Extended"](p)||on["Vertical Forms"](p)||on["Yijing Hexagram Symbols"](p)||on["Yi Syllables"](p)||on["Yi Radicals"](p))}function na(p){return!!(on["Latin-1 Supplement"](p)&&(p===167||p===169||p===174||p===177||p===188||p===189||p===190||p===215||p===247)||on["General Punctuation"](p)&&(p===8214||p===8224||p===8225||p===8240||p===8241||p===8251||p===8252||p===8258||p===8263||p===8264||p===8265||p===8273)||on["Letterlike Symbols"](p)||on["Number Forms"](p)||on["Miscellaneous Technical"](p)&&(p>=8960&&p<=8967||p>=8972&&p<=8991||p>=8996&&p<=9e3||p===9003||p>=9085&&p<=9114||p>=9150&&p<=9165||p===9167||p>=9169&&p<=9179||p>=9186&&p<=9215)||on["Control Pictures"](p)&&p!==9251||on["Optical Character Recognition"](p)||on["Enclosed Alphanumerics"](p)||on["Geometric Shapes"](p)||on["Miscellaneous Symbols"](p)&&!(p>=9754&&p<=9759)||on["Miscellaneous Symbols and Arrows"](p)&&(p>=11026&&p<=11055||p>=11088&&p<=11097||p>=11192&&p<=11243)||on["CJK Symbols and Punctuation"](p)||on.Katakana(p)||on["Private Use Area"](p)||on["CJK Compatibility Forms"](p)||on["Small Form Variants"](p)||on["Halfwidth and Fullwidth Forms"](p)||p===8734||p===8756||p===8757||p>=9984&&p<=10087||p>=10102&&p<=10131||p===65532||p===65533)}function _n(p){return!(Yn(p)||na(p))}function Ha(p){return on.Arabic(p)||on["Arabic Supplement"](p)||on["Arabic Extended-A"](p)||on["Arabic Presentation Forms-A"](p)||on["Arabic Presentation Forms-B"](p)}function Wa(p){return p>=1424&&p<=2303||on["Arabic Presentation Forms-A"](p)||on["Arabic Presentation Forms-B"](p)}function ri(p,O){return!(!O&&Wa(p)||p>=2304&&p<=3583||p>=3840&&p<=4255||on.Khmer(p))}function xi(p){for(var O=0,W=p;O-1&&(Ii=zi.error),jo&&jo(p)};function pl(){Ns.fire(new br("pluginStateChange",{pluginStatus:Ii,pluginURL:Ji}))}var Ns=new mr,fi=function(){return Ii},Ao=function(p){return p({pluginStatus:Ii,pluginURL:Ji}),Ns.on("pluginStateChange",p),p},Bo=function(p,O,W){if(W===void 0&&(W=!1),Ii===zi.deferred||Ii===zi.loading||Ii===zi.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ji=Tt.resolveURL(p),Ii=zi.deferred,jo=O,pl(),W||Ds()},Ds=function(){if(Ii!==zi.deferred||!Ji)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ii=zi.loading,pl(),Ji&&Yr({url:Ji},function(p){p?es(p):(Ii=zi.loaded,pl())})},Ts={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return Ii===zi.loaded||Ts.applyArabicShaping!=null},isLoading:function(){return Ii===zi.loading},setState:function(p){Ii=p.pluginStatus,Ji=p.pluginURL},isParsed:function(){return Ts.applyArabicShaping!=null&&Ts.processBidirectionalText!=null&&Ts.processStyledBidirectionalText!=null},getPluginURL:function(){return Ji}},lu=function(){!Ts.isLoading()&&!Ts.isLoaded()&&fi()==="deferred"&&Ds()},ps=function(p,O){this.zoom=p,O?(this.now=O.now,this.fadeDuration=O.fadeDuration,this.zoomHistory=O.zoomHistory,this.transition=O.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new an,this.transition={})};ps.prototype.isSupportedScript=function(p){return ki(p,Ts.isLoaded())},ps.prototype.crossFadingFactor=function(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},ps.prototype.getCrossfadeParameters=function(){var p=this.zoom,O=p-Math.floor(p),W=this.crossFadingFactor();return p>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:O+(1-O)*W}:{fromScale:.5,toScale:1,t:1-(1-W)*O}};var zs=function(p,O){this.property=p,this.value=O,this.expression=L(O===void 0?p.specification.default:O,p.specification)};zs.prototype.isDataDriven=function(){return this.expression.kind==="source"||this.expression.kind==="composite"},zs.prototype.possiblyEvaluate=function(p,O,W){return this.property.possiblyEvaluate(this,p,O,W)};var Eu=function(p){this.property=p,this.value=new zs(p,void 0)};Eu.prototype.transitioned=function(p,O){return new nr(this.property,this.value,O,M({},p.transition,this.transition),p.now)},Eu.prototype.untransitioned=function(){return new nr(this.property,this.value,null,{},0)};var ie=function(p){this._properties=p,this._values=Object.create(p.defaultTransitionablePropertyValues)};ie.prototype.getValue=function(p){return I(this._values[p].value.value)},ie.prototype.setValue=function(p,O){this._values.hasOwnProperty(p)||(this._values[p]=new Eu(this._values[p].property)),this._values[p].value=new zs(this._values[p].property,O===null?void 0:I(O))},ie.prototype.getTransition=function(p){return I(this._values[p].transition)},ie.prototype.setTransition=function(p,O){this._values.hasOwnProperty(p)||(this._values[p]=new Eu(this._values[p].property)),this._values[p].transition=I(O)||void 0},ie.prototype.serialize=function(){for(var p={},O=0,W=Object.keys(this._values);Othis.end)return this.prior=null,At;if(this.value.isDataDriven())return this.prior=null,At;if(ptOt.zoomHistory.lastIntegerZoom?{from:W,to:pt}:{from:At,to:pt}},O.prototype.interpolate=function(W){return W},O})(Sn),ea=function(p){this.specification=p};ea.prototype.possiblyEvaluate=function(p,O,W,pt){if(p.value!==void 0)if(p.expression.kind==="constant"){var At=p.expression.evaluate(O,null,{},W,pt);return this._calculate(At,At,At,O)}else return this._calculate(p.expression.evaluate(new ps(Math.floor(O.zoom-1),O)),p.expression.evaluate(new ps(Math.floor(O.zoom),O)),p.expression.evaluate(new ps(Math.floor(O.zoom+1),O)),O)},ea.prototype._calculate=function(p,O,W,pt){var At=pt.zoom;return At>pt.zoomHistory.lastIntegerZoom?{from:p,to:O}:{from:W,to:O}},ea.prototype.interpolate=function(p){return p};var ka=function(p){this.specification=p};ka.prototype.possiblyEvaluate=function(p,O,W,pt){return!!p.expression.evaluate(O,null,{},W,pt)},ka.prototype.interpolate=function(){return!1};var Ka=function(p){this.properties=p,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(var O in p){var W=p[O];W.specification.overridable&&this.overridableProperties.push(O);var pt=this.defaultPropertyValues[O]=new zs(W,void 0),At=this.defaultTransitionablePropertyValues[O]=new Eu(W);this.defaultTransitioningPropertyValues[O]=At.untransitioned(),this.defaultPossiblyEvaluatedValues[O]=pt.possiblyEvaluate({})}};Ve("DataDrivenProperty",Sn),Ve("DataConstantProperty",qr),Ve("CrossFadedDataDrivenProperty",sa),Ve("CrossFadedProperty",ea),Ve("ColorRampProperty",ka);var Va="-transition",fa=(function(p){function O(W,pt){if(p.call(this),this.id=W.id,this.type=W.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},W.type!=="custom"&&(W=W,this.metadata=W.metadata,this.minzoom=W.minzoom,this.maxzoom=W.maxzoom,W.type!=="background"&&(this.source=W.source,this.sourceLayer=W["source-layer"],this.filter=W.filter),pt.layout&&(this._unevaluatedLayout=new sn(pt.layout)),pt.paint)){this._transitionablePaint=new ie(pt.paint);for(var At in W.paint)this.setPaintProperty(At,W.paint[At],{validate:!1});for(var Ot in W.layout)this.setLayoutProperty(Ot,W.layout[Ot],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Tn(pt.paint)}}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},O.prototype.getLayoutProperty=function(W){return W==="visibility"?this.visibility:this._unevaluatedLayout.getValue(W)},O.prototype.setLayoutProperty=function(W,pt,At){if(At===void 0&&(At={}),pt!=null){var Ot="layers."+this.id+".layout."+W;if(this._validate(Sl,Ot,W,pt,At))return}if(W==="visibility"){this.visibility=pt;return}this._unevaluatedLayout.setValue(W,pt)},O.prototype.getPaintProperty=function(W){return D(W,Va)?this._transitionablePaint.getTransition(W.slice(0,-Va.length)):this._transitionablePaint.getValue(W)},O.prototype.setPaintProperty=function(W,pt,At){if(At===void 0&&(At={}),pt!=null){var Ot="layers."+this.id+".paint."+W;if(this._validate(hl,Ot,W,pt,At))return!1}if(D(W,Va))return this._transitionablePaint.setTransition(W.slice(0,-Va.length),pt||void 0),!1;var Wt=this._transitionablePaint._values[W],_e=Wt.property.specification["property-type"]==="cross-faded-data-driven",De=Wt.value.isDataDriven(),Je=Wt.value;this._transitionablePaint.setValue(W,pt),this._handleSpecialPaintPropertyUpdate(W);var sr=this._transitionablePaint._values[W].value,Ar=sr.isDataDriven();return Ar||De||_e||this._handleOverridablePaintPropertyUpdate(W,Je,sr)},O.prototype._handleSpecialPaintPropertyUpdate=function(W){},O.prototype._handleOverridablePaintPropertyUpdate=function(W,pt,At){return!1},O.prototype.isHidden=function(W){return this.minzoom&&W=this.maxzoom?!0:this.visibility==="none"},O.prototype.updateTransitions=function(W){this._transitioningPaint=this._transitionablePaint.transitioned(W,this._transitioningPaint)},O.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},O.prototype.recalculate=function(W,pt){W.getCrossfadeParameters&&(this._crossfadeParameters=W.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(W,void 0,pt)),this.paint=this._transitioningPaint.possiblyEvaluate(W,void 0,pt)},O.prototype.serialize=function(){var W={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(W.layout=W.layout||{},W.layout.visibility=this.visibility),R(W,function(pt,At){return pt!==void 0&&!(At==="layout"&&!Object.keys(pt).length)&&!(At==="paint"&&!Object.keys(pt).length)})},O.prototype._validate=function(W,pt,At,Ot,Wt){return Wt===void 0&&(Wt={}),Wt&&Wt.validate===!1?!1:tu(this,W.call(To,{key:pt,layerType:this.type,objectKey:At,value:Ot,styleSpec:Da,style:{glyphs:!0,sprite:!0}}))},O.prototype.is3D=function(){return!1},O.prototype.isTileClipped=function(){return!1},O.prototype.hasOffscreenPass=function(){return!1},O.prototype.resize=function(){},O.prototype.isStateDependent=function(){for(var W in this.paint._values){var pt=this.paint.get(W);if(!(!(pt instanceof zn)||!el(pt.property.specification))&&(pt.value.kind==="source"||pt.value.kind==="composite")&&pt.value.isStateDependent)return!0}return!1},O})(mr),Un={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Nr=function(p,O){this._structArray=p,this._pos1=O*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},fn=128,Xn=5,jn=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};jn.serialize=function(p,O){return p._trim(),O&&(p.isTransferred=!0,O.push(p.arrayBuffer)),{length:p.length,arrayBuffer:p.arrayBuffer}},jn.deserialize=function(p){var O=Object.create(this.prototype);return O.arrayBuffer=p.arrayBuffer,O.length=p.length,O.capacity=p.arrayBuffer.byteLength/O.bytesPerElement,O._refreshViews(),O},jn.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},jn.prototype.clear=function(){this.length=0},jn.prototype.resize=function(p){this.reserve(p),this.length=p},jn.prototype.reserve=function(p){if(p>this.capacity){this.capacity=Math.max(p,Math.floor(this.capacity*Xn),fn),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var O=this.uint8;this._refreshViews(),O&&this.uint8.set(O)}},jn.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};function kn(p,O){O===void 0&&(O=1);var W=0,pt=0,At=p.map(function(Wt){var _e=Ia(Wt.type),De=W=ya(W,Math.max(O,_e)),Je=Wt.components||1;return pt=Math.max(pt,_e),W+=_e*Je,{name:Wt.name,type:Wt.type,components:Je,offset:De}}),Ot=ya(W,Math.max(pt,O));return{members:At,size:Ot,alignment:O}}function Ia(p){return Un[p].BYTES_PER_ELEMENT}function ya(p,O){return Math.ceil(p/O)*O}var qa=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt){var At=this.length;return this.resize(At+1),this.emplace(At,W,pt)},O.prototype.emplace=function(W,pt,At){var Ot=W*2;return this.int16[Ot+0]=pt,this.int16[Ot+1]=At,W},O})(jn);qa.prototype.bytesPerElement=4,Ve("StructArrayLayout2i4",qa);var Rn=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At,Ot){var Wt=this.length;return this.resize(Wt+1),this.emplace(Wt,W,pt,At,Ot)},O.prototype.emplace=function(W,pt,At,Ot,Wt){var _e=W*4;return this.int16[_e+0]=pt,this.int16[_e+1]=At,this.int16[_e+2]=Ot,this.int16[_e+3]=Wt,W},O})(jn);Rn.prototype.bytesPerElement=8,Ve("StructArrayLayout4i8",Rn);var An=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At,Ot,Wt,_e){var De=this.length;return this.resize(De+1),this.emplace(De,W,pt,At,Ot,Wt,_e)},O.prototype.emplace=function(W,pt,At,Ot,Wt,_e,De){var Je=W*6;return this.int16[Je+0]=pt,this.int16[Je+1]=At,this.int16[Je+2]=Ot,this.int16[Je+3]=Wt,this.int16[Je+4]=_e,this.int16[Je+5]=De,W},O})(jn);An.prototype.bytesPerElement=12,Ve("StructArrayLayout2i4i12",An);var Pa=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At,Ot,Wt,_e){var De=this.length;return this.resize(De+1),this.emplace(De,W,pt,At,Ot,Wt,_e)},O.prototype.emplace=function(W,pt,At,Ot,Wt,_e,De){var Je=W*4,sr=W*8;return this.int16[Je+0]=pt,this.int16[Je+1]=At,this.uint8[sr+4]=Ot,this.uint8[sr+5]=Wt,this.uint8[sr+6]=_e,this.uint8[sr+7]=De,W},O})(jn);Pa.prototype.bytesPerElement=8,Ve("StructArrayLayout2i4ub8",Pa);var ba=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt){var At=this.length;return this.resize(At+1),this.emplace(At,W,pt)},O.prototype.emplace=function(W,pt,At){var Ot=W*2;return this.float32[Ot+0]=pt,this.float32[Ot+1]=At,W},O})(jn);ba.prototype.bytesPerElement=8,Ve("StructArrayLayout2f8",ba);var aa=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At,Ot,Wt,_e,De,Je,sr,Ar){var Pr=this.length;return this.resize(Pr+1),this.emplace(Pr,W,pt,At,Ot,Wt,_e,De,Je,sr,Ar)},O.prototype.emplace=function(W,pt,At,Ot,Wt,_e,De,Je,sr,Ar,Pr){var Vr=W*10;return this.uint16[Vr+0]=pt,this.uint16[Vr+1]=At,this.uint16[Vr+2]=Ot,this.uint16[Vr+3]=Wt,this.uint16[Vr+4]=_e,this.uint16[Vr+5]=De,this.uint16[Vr+6]=Je,this.uint16[Vr+7]=sr,this.uint16[Vr+8]=Ar,this.uint16[Vr+9]=Pr,W},O})(jn);aa.prototype.bytesPerElement=20,Ve("StructArrayLayout10ui20",aa);var oa=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At,Ot,Wt,_e,De,Je,sr,Ar,Pr,Vr){var un=this.length;return this.resize(un+1),this.emplace(un,W,pt,At,Ot,Wt,_e,De,Je,sr,Ar,Pr,Vr)},O.prototype.emplace=function(W,pt,At,Ot,Wt,_e,De,Je,sr,Ar,Pr,Vr,un){var Fn=W*12;return this.int16[Fn+0]=pt,this.int16[Fn+1]=At,this.int16[Fn+2]=Ot,this.int16[Fn+3]=Wt,this.uint16[Fn+4]=_e,this.uint16[Fn+5]=De,this.uint16[Fn+6]=Je,this.uint16[Fn+7]=sr,this.int16[Fn+8]=Ar,this.int16[Fn+9]=Pr,this.int16[Fn+10]=Vr,this.int16[Fn+11]=un,W},O})(jn);oa.prototype.bytesPerElement=24,Ve("StructArrayLayout4i4ui4i24",oa);var Sa=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At){var Ot=this.length;return this.resize(Ot+1),this.emplace(Ot,W,pt,At)},O.prototype.emplace=function(W,pt,At,Ot){var Wt=W*3;return this.float32[Wt+0]=pt,this.float32[Wt+1]=At,this.float32[Wt+2]=Ot,W},O})(jn);Sa.prototype.bytesPerElement=12,Ve("StructArrayLayout3f12",Sa);var _i=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W){var pt=this.length;return this.resize(pt+1),this.emplace(pt,W)},O.prototype.emplace=function(W,pt){var At=W*1;return this.uint32[At+0]=pt,W},O})(jn);_i.prototype.bytesPerElement=4,Ve("StructArrayLayout1ul4",_i);var pi=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At,Ot,Wt,_e,De,Je,sr){var Ar=this.length;return this.resize(Ar+1),this.emplace(Ar,W,pt,At,Ot,Wt,_e,De,Je,sr)},O.prototype.emplace=function(W,pt,At,Ot,Wt,_e,De,Je,sr,Ar){var Pr=W*10,Vr=W*5;return this.int16[Pr+0]=pt,this.int16[Pr+1]=At,this.int16[Pr+2]=Ot,this.int16[Pr+3]=Wt,this.int16[Pr+4]=_e,this.int16[Pr+5]=De,this.uint32[Vr+3]=Je,this.uint16[Pr+8]=sr,this.uint16[Pr+9]=Ar,W},O})(jn);pi.prototype.bytesPerElement=20,Ve("StructArrayLayout6i1ul2ui20",pi);var Ma=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At,Ot,Wt,_e){var De=this.length;return this.resize(De+1),this.emplace(De,W,pt,At,Ot,Wt,_e)},O.prototype.emplace=function(W,pt,At,Ot,Wt,_e,De){var Je=W*6;return this.int16[Je+0]=pt,this.int16[Je+1]=At,this.int16[Je+2]=Ot,this.int16[Je+3]=Wt,this.int16[Je+4]=_e,this.int16[Je+5]=De,W},O})(jn);Ma.prototype.bytesPerElement=12,Ve("StructArrayLayout2i2i2i12",Ma);var Na=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At,Ot,Wt){var _e=this.length;return this.resize(_e+1),this.emplace(_e,W,pt,At,Ot,Wt)},O.prototype.emplace=function(W,pt,At,Ot,Wt,_e){var De=W*4,Je=W*8;return this.float32[De+0]=pt,this.float32[De+1]=At,this.float32[De+2]=Ot,this.int16[Je+6]=Wt,this.int16[Je+7]=_e,W},O})(jn);Na.prototype.bytesPerElement=16,Ve("StructArrayLayout2f1f2i16",Na);var ui=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At,Ot){var Wt=this.length;return this.resize(Wt+1),this.emplace(Wt,W,pt,At,Ot)},O.prototype.emplace=function(W,pt,At,Ot,Wt){var _e=W*12,De=W*3;return this.uint8[_e+0]=pt,this.uint8[_e+1]=At,this.float32[De+1]=Ot,this.float32[De+2]=Wt,W},O})(jn);ui.prototype.bytesPerElement=12,Ve("StructArrayLayout2ub2f12",ui);var gi=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At){var Ot=this.length;return this.resize(Ot+1),this.emplace(Ot,W,pt,At)},O.prototype.emplace=function(W,pt,At,Ot){var Wt=W*3;return this.uint16[Wt+0]=pt,this.uint16[Wt+1]=At,this.uint16[Wt+2]=Ot,W},O})(jn);gi.prototype.bytesPerElement=6,Ve("StructArrayLayout3ui6",gi);var Ri=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At,Ot,Wt,_e,De,Je,sr,Ar,Pr,Vr,un,Fn,ga,pa,Ea){var ja=this.length;return this.resize(ja+1),this.emplace(ja,W,pt,At,Ot,Wt,_e,De,Je,sr,Ar,Pr,Vr,un,Fn,ga,pa,Ea)},O.prototype.emplace=function(W,pt,At,Ot,Wt,_e,De,Je,sr,Ar,Pr,Vr,un,Fn,ga,pa,Ea,ja){var Aa=W*24,$a=W*12,hi=W*48;return this.int16[Aa+0]=pt,this.int16[Aa+1]=At,this.uint16[Aa+2]=Ot,this.uint16[Aa+3]=Wt,this.uint32[$a+2]=_e,this.uint32[$a+3]=De,this.uint32[$a+4]=Je,this.uint16[Aa+10]=sr,this.uint16[Aa+11]=Ar,this.uint16[Aa+12]=Pr,this.float32[$a+7]=Vr,this.float32[$a+8]=un,this.uint8[hi+36]=Fn,this.uint8[hi+37]=ga,this.uint8[hi+38]=pa,this.uint32[$a+10]=Ea,this.int16[Aa+22]=ja,W},O})(jn);Ri.prototype.bytesPerElement=48,Ve("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ri);var ds=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At,Ot,Wt,_e,De,Je,sr,Ar,Pr,Vr,un,Fn,ga,pa,Ea,ja,Aa,$a,hi,Si,Ei,ro,no,go,Mo,Vo){var vo=this.length;return this.resize(vo+1),this.emplace(vo,W,pt,At,Ot,Wt,_e,De,Je,sr,Ar,Pr,Vr,un,Fn,ga,pa,Ea,ja,Aa,$a,hi,Si,Ei,ro,no,go,Mo,Vo)},O.prototype.emplace=function(W,pt,At,Ot,Wt,_e,De,Je,sr,Ar,Pr,Vr,un,Fn,ga,pa,Ea,ja,Aa,$a,hi,Si,Ei,ro,no,go,Mo,Vo,vo){var bo=W*34,ol=W*17;return this.int16[bo+0]=pt,this.int16[bo+1]=At,this.int16[bo+2]=Ot,this.int16[bo+3]=Wt,this.int16[bo+4]=_e,this.int16[bo+5]=De,this.int16[bo+6]=Je,this.int16[bo+7]=sr,this.uint16[bo+8]=Ar,this.uint16[bo+9]=Pr,this.uint16[bo+10]=Vr,this.uint16[bo+11]=un,this.uint16[bo+12]=Fn,this.uint16[bo+13]=ga,this.uint16[bo+14]=pa,this.uint16[bo+15]=Ea,this.uint16[bo+16]=ja,this.uint16[bo+17]=Aa,this.uint16[bo+18]=$a,this.uint16[bo+19]=hi,this.uint16[bo+20]=Si,this.uint16[bo+21]=Ei,this.uint16[bo+22]=ro,this.uint32[ol+12]=no,this.float32[ol+13]=go,this.float32[ol+14]=Mo,this.float32[ol+15]=Vo,this.float32[ol+16]=vo,W},O})(jn);ds.prototype.bytesPerElement=68,Ve("StructArrayLayout8i15ui1ul4f68",ds);var rs=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W){var pt=this.length;return this.resize(pt+1),this.emplace(pt,W)},O.prototype.emplace=function(W,pt){var At=W*1;return this.float32[At+0]=pt,W},O})(jn);rs.prototype.bytesPerElement=4,Ve("StructArrayLayout1f4",rs);var Zi=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At){var Ot=this.length;return this.resize(Ot+1),this.emplace(Ot,W,pt,At)},O.prototype.emplace=function(W,pt,At,Ot){var Wt=W*3;return this.int16[Wt+0]=pt,this.int16[Wt+1]=At,this.int16[Wt+2]=Ot,W},O})(jn);Zi.prototype.bytesPerElement=6,Ve("StructArrayLayout3i6",Zi);var Zs=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At){var Ot=this.length;return this.resize(Ot+1),this.emplace(Ot,W,pt,At)},O.prototype.emplace=function(W,pt,At,Ot){var Wt=W*2,_e=W*4;return this.uint32[Wt+0]=pt,this.uint16[_e+2]=At,this.uint16[_e+3]=Ot,W},O})(jn);Zs.prototype.bytesPerElement=8,Ve("StructArrayLayout1ul2ui8",Zs);var Zo=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt){var At=this.length;return this.resize(At+1),this.emplace(At,W,pt)},O.prototype.emplace=function(W,pt,At){var Ot=W*2;return this.uint16[Ot+0]=pt,this.uint16[Ot+1]=At,W},O})(jn);Zo.prototype.bytesPerElement=4,Ve("StructArrayLayout2ui4",Zo);var Qs=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W){var pt=this.length;return this.resize(pt+1),this.emplace(pt,W)},O.prototype.emplace=function(W,pt){var At=W*1;return this.uint16[At+0]=pt,W},O})(jn);Qs.prototype.bytesPerElement=2,Ve("StructArrayLayout1ui2",Qs);var El=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},O.prototype.emplaceBack=function(W,pt,At,Ot){var Wt=this.length;return this.resize(Wt+1),this.emplace(Wt,W,pt,At,Ot)},O.prototype.emplace=function(W,pt,At,Ot,Wt){var _e=W*4;return this.float32[_e+0]=pt,this.float32[_e+1]=At,this.float32[_e+2]=Ot,this.float32[_e+3]=Wt,W},O})(jn);El.prototype.bytesPerElement=16,Ve("StructArrayLayout4f16",El);var Cl=(function(p){function O(){p.apply(this,arguments)}p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O;var W={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return W.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},W.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},W.x1.get=function(){return this._structArray.int16[this._pos2+2]},W.y1.get=function(){return this._structArray.int16[this._pos2+3]},W.x2.get=function(){return this._structArray.int16[this._pos2+4]},W.y2.get=function(){return this._structArray.int16[this._pos2+5]},W.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},W.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},W.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},W.anchorPoint.get=function(){return new o(this.anchorPointX,this.anchorPointY)},Object.defineProperties(O.prototype,W),O})(Nr);Cl.prototype.size=20;var Hs=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype.get=function(W){return new Cl(this,W)},O})(pi);Ve("CollisionBoxArray",Hs);var js=(function(p){function O(){p.apply(this,arguments)}p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O;var W={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return W.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},W.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},W.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},W.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},W.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},W.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},W.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},W.segment.get=function(){return this._structArray.uint16[this._pos2+10]},W.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},W.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},W.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},W.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},W.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},W.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},W.placedOrientation.set=function(pt){this._structArray.uint8[this._pos1+37]=pt},W.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},W.hidden.set=function(pt){this._structArray.uint8[this._pos1+38]=pt},W.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},W.crossTileID.set=function(pt){this._structArray.uint32[this._pos4+10]=pt},W.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(O.prototype,W),O})(Nr);js.prototype.size=48;var Ks=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype.get=function(W){return new js(this,W)},O})(Ri);Ve("PlacedSymbolArray",Ks);var Mi=(function(p){function O(){p.apply(this,arguments)}p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O;var W={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return W.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},W.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},W.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},W.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},W.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},W.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},W.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},W.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},W.key.get=function(){return this._structArray.uint16[this._pos2+8]},W.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},W.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},W.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},W.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},W.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},W.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},W.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},W.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},W.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},W.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},W.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},W.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},W.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},W.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},W.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},W.crossTileID.set=function(pt){this._structArray.uint32[this._pos4+12]=pt},W.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},W.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},W.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},W.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(O.prototype,W),O})(Nr);Mi.prototype.size=68;var Ys=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype.get=function(W){return new Mi(this,W)},O})(ds);Ve("SymbolInstanceArray",Ys);var Uo=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype.getoffsetX=function(W){return this.float32[W*1+0]},O})(rs);Ve("GlyphOffsetArray",Uo);var tl=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype.getx=function(W){return this.int16[W*3+0]},O.prototype.gety=function(W){return this.int16[W*3+1]},O.prototype.gettileUnitDistanceFromAnchor=function(W){return this.int16[W*3+2]},O})(Zi);Ve("SymbolLineVertexArray",tl);var Il=(function(p){function O(){p.apply(this,arguments)}p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O;var W={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return W.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},W.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},W.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(O.prototype,W),O})(Nr);Il.prototype.size=8;var vi=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype.get=function(W){return new Il(this,W)},O})(Zs);Ve("FeatureIndexArray",vi);var lo=kn([{name:"a_pos",components:2,type:"Int16"}],4),ns=lo.members,$o=function(p){p===void 0&&(p=[]),this.segments=p};$o.prototype.prepareSegment=function(p,O,W,pt){var At=this.segments[this.segments.length-1];return p>$o.MAX_VERTEX_ARRAY_LENGTH&&N("Max vertices per segment is "+$o.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+p),(!At||At.vertexLength+p>$o.MAX_VERTEX_ARRAY_LENGTH||At.sortKey!==pt)&&(At={vertexOffset:O.length,primitiveOffset:W.length,vertexLength:0,primitiveLength:0},pt!==void 0&&(At.sortKey=pt),this.segments.push(At)),At},$o.prototype.get=function(){return this.segments},$o.prototype.destroy=function(){for(var p=0,O=this.segments;p>>16)*De&65535)<<16)&4294967295,sr=sr<<15|sr>>>17,sr=(sr&65535)*Je+(((sr>>>16)*Je&65535)<<16)&4294967295,Wt^=sr,Wt=Wt<<13|Wt>>>19,_e=(Wt&65535)*5+(((Wt>>>16)*5&65535)<<16)&4294967295,Wt=(_e&65535)+27492+(((_e>>>16)+58964&65535)<<16);switch(sr=0,At){case 3:sr^=(W.charCodeAt(Ar+2)&255)<<16;case 2:sr^=(W.charCodeAt(Ar+1)&255)<<8;case 1:sr^=W.charCodeAt(Ar)&255,sr=(sr&65535)*De+(((sr>>>16)*De&65535)<<16)&4294967295,sr=sr<<15|sr>>>17,sr=(sr&65535)*Je+(((sr>>>16)*Je&65535)<<16)&4294967295,Wt^=sr}return Wt^=W.length,Wt^=Wt>>>16,Wt=(Wt&65535)*2246822507+(((Wt>>>16)*2246822507&65535)<<16)&4294967295,Wt^=Wt>>>13,Wt=(Wt&65535)*3266489909+(((Wt>>>16)*3266489909&65535)<<16)&4294967295,Wt^=Wt>>>16,Wt>>>0}p.exports=O}),ft=e(function(p){function O(W,pt){for(var At=W.length,Ot=pt^At,Wt=0,_e;At>=4;)_e=W.charCodeAt(Wt)&255|(W.charCodeAt(++Wt)&255)<<8|(W.charCodeAt(++Wt)&255)<<16|(W.charCodeAt(++Wt)&255)<<24,_e=(_e&65535)*1540483477+(((_e>>>16)*1540483477&65535)<<16),_e^=_e>>>24,_e=(_e&65535)*1540483477+(((_e>>>16)*1540483477&65535)<<16),Ot=(Ot&65535)*1540483477+(((Ot>>>16)*1540483477&65535)<<16)^_e,At-=4,++Wt;switch(At){case 3:Ot^=(W.charCodeAt(Wt+2)&255)<<16;case 2:Ot^=(W.charCodeAt(Wt+1)&255)<<8;case 1:Ot^=W.charCodeAt(Wt)&255,Ot=(Ot&65535)*1540483477+(((Ot>>>16)*1540483477&65535)<<16)}return Ot^=Ot>>>13,Ot=(Ot&65535)*1540483477+(((Ot>>>16)*1540483477&65535)<<16),Ot^=Ot>>>15,Ot>>>0}p.exports=O}),zt=Y,Qt=Y,ne=ft;zt.murmur3=Qt,zt.murmur2=ne;var Ft=function(){this.ids=[],this.positions=[],this.indexed=!1};Ft.prototype.add=function(p,O,W,pt){this.ids.push(he(p)),this.positions.push(O,W,pt)},Ft.prototype.getPositions=function(p){for(var O=he(p),W=0,pt=this.ids.length-1;W>1;this.ids[At]>=O?pt=At:W=At+1}for(var Ot=[];this.ids[W]===O;){var Wt=this.positions[3*W],_e=this.positions[3*W+1],De=this.positions[3*W+2];Ot.push({index:Wt,start:_e,end:De}),W++}return Ot},Ft.serialize=function(p,O){var W=new Float64Array(p.ids),pt=new Uint32Array(p.positions);return Ne(W,pt,0,W.length-1),O&&O.push(W.buffer,pt.buffer),{ids:W,positions:pt}},Ft.deserialize=function(p){var O=new Ft;return O.ids=p.ids,O.positions=p.positions,O.indexed=!0,O};var $t=Math.pow(2,53)-1;function he(p){var O=+p;return!isNaN(O)&&O<=$t?O:zt(String(p))}function Ne(p,O,W,pt){for(;W>1],Ot=W-1,Wt=pt+1;;){do Ot++;while(p[Ot]At);if(Ot>=Wt)break;Ie(p,Ot,Wt),Ie(O,3*Ot,3*Wt),Ie(O,3*Ot+1,3*Wt+1),Ie(O,3*Ot+2,3*Wt+2)}Wt-WWt.x+1||DeWt.y+1)&&N("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return W}function gs(p,O){return{type:p.type,id:p.id,properties:p.properties,geometry:O?Ko(p):[]}}function Pl(p,O,W,pt,At){p.emplaceBack(O*2+(pt+1)/2,W*2+(At+1)/2)}var mo=function(p){this.zoom=p.zoom,this.overscaling=p.overscaling,this.layers=p.layers,this.layerIds=this.layers.map(function(O){return O.id}),this.index=p.index,this.hasPattern=!1,this.layoutVertexArray=new qa,this.indexArray=new gi,this.segments=new $o,this.programConfigurations=new Gn(p.layers,p.zoom),this.stateDependentLayerIds=this.layers.filter(function(O){return O.isStateDependent()}).map(function(O){return O.id})};mo.prototype.populate=function(p,O,W){var pt=this.layers[0],At=[],Ot=null;pt.type==="circle"&&(Ot=pt.layout.get("circle-sort-key"));for(var Wt=0,_e=p;Wt<_e.length;Wt+=1){var De=_e[Wt],Je=De.feature,sr=De.id,Ar=De.index,Pr=De.sourceLayerIndex,Vr=this.layers[0]._featureFilter.needGeometry,un=gs(Je,Vr);if(this.layers[0]._featureFilter.filter(new ps(this.zoom),un,W)){var Fn=Ot?Ot.evaluate(un,{},W):void 0,ga={id:sr,properties:Je.properties,type:Je.type,sourceLayerIndex:Pr,index:Ar,geometry:Vr?un.geometry:Ko(Je),patterns:{},sortKey:Fn};At.push(ga)}}Ot&&At.sort(function(ro,no){return ro.sortKey-no.sortKey});for(var pa=0,Ea=At;pa=Li||Ar<0||Ar>=Li)){var Pr=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,p.sortKey),Vr=Pr.vertexLength;Pl(this.layoutVertexArray,sr,Ar,-1,-1),Pl(this.layoutVertexArray,sr,Ar,1,-1),Pl(this.layoutVertexArray,sr,Ar,1,1),Pl(this.layoutVertexArray,sr,Ar,-1,1),this.indexArray.emplaceBack(Vr,Vr+1,Vr+2),this.indexArray.emplaceBack(Vr,Vr+3,Vr+2),Pr.vertexLength+=4,Pr.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,p,W,{},pt)},Ve("CircleBucket",mo,{omit:["layers"]});function Xs(p,O){for(var W=0;W=3){for(var Ot=0;Ot1){if(Kf(p,O))return!0;for(var pt=0;pt1?p.distSqr(W):p.distSqr(W.sub(O)._mult(At)._add(O))}function Xf(p,O){for(var W=!1,pt,At,Ot,Wt=0;WtO.y!=Ot.y>O.y&&O.x<(Ot.x-At.x)*(O.y-At.y)/(Ot.y-At.y)+At.x&&(W=!W)}return W}function xf(p,O){for(var W=!1,pt=0,At=p.length-1;ptO.y!=Wt.y>O.y&&O.x<(Wt.x-Ot.x)*(O.y-Ot.y)/(Wt.y-Ot.y)+Ot.x&&(W=!W)}return W}function Ih(p,O,W,pt,At){for(var Ot=0,Wt=p;Ot=_e.x&&At>=_e.y)return!0}var De=[new o(O,W),new o(O,At),new o(pt,At),new o(pt,W)];if(p.length>2)for(var Je=0,sr=De;JeAt.x&&O.x>At.x||p.yAt.y&&O.y>At.y)return!1;var Ot=G(p,O,W[0]);return Ot!==G(p,O,W[1])||Ot!==G(p,O,W[2])||Ot!==G(p,O,W[3])}function $f(p,O,W){var pt=O.paint.get(p).value;return pt.kind==="constant"?pt.value:W.programConfigurations.get(O.id).getMaxValue(p)}function Jf(p){return Math.sqrt(p[0]*p[0]+p[1]*p[1])}function zf(p,O,W,pt,At){if(!O[0]&&!O[1])return p;var Ot=o.convert(O)._mult(At);W==="viewport"&&Ot._rotate(-pt);for(var Wt=[],_e=0;_e0&&(Ot=1/Math.sqrt(Ot)),p[0]=O[0]*Ot,p[1]=O[1]*Ot,p[2]=O[2]*Ot,p}function p_(p,O){return p[0]*O[0]+p[1]*O[1]+p[2]*O[2]}function d_(p,O,W){var pt=O[0],At=O[1],Ot=O[2],Wt=W[0],_e=W[1],De=W[2];return p[0]=At*De-Ot*_e,p[1]=Ot*Wt-pt*De,p[2]=pt*_e-At*Wt,p}function m_(p,O,W){var pt=O[0],At=O[1],Ot=O[2];return p[0]=pt*W[0]+At*W[3]+Ot*W[6],p[1]=pt*W[1]+At*W[4]+Ot*W[7],p[2]=pt*W[2]+At*W[5]+Ot*W[8],p}var g_=Jm;(function(){var p=F0();return function(O,W,pt,At,Ot,Wt){var _e,De;for(W||(W=3),pt||(pt=0),At?De=Math.min(At*W+pt,O.length):De=O.length,_e=pt;_ep.width||At.height>p.height||W.x>p.width-At.width||W.y>p.height-At.height)throw new RangeError("out of range source coordinates for image copy");if(At.width>O.width||At.height>O.height||pt.x>O.width-At.width||pt.y>O.height-At.height)throw new RangeError("out of range destination coordinates for image copy");for(var Wt=p.data,_e=O.data,De=0;De80*W){_e=Je=p[0],De=sr=p[1];for(var un=W;unJe&&(Je=Ar),Pr>sr&&(sr=Pr);Vr=Math.max(Je-_e,sr-De),Vr=Vr!==0?1/Vr:0}return Ep(Ot,Wt,W,_e,De,Vr),Wt}function rg(p,O,W,pt,At){var Ot,Wt;if(At===lg(p,O,W,pt)>0)for(Ot=O;Ot=O;Ot-=pt)Wt=Yv(Ot,p[Ot],p[Ot+1],Wt);return Wt&&td(Wt,Wt.next)&&($d(Wt),Wt=Wt.next),Wt}function Zh(p,O){if(!p)return p;O||(O=p);var W=p,pt;do if(pt=!1,!W.steiner&&(td(W,W.next)||cc(W.prev,W,W.next)===0)){if($d(W),W=O=W.prev,W===W.next)break;pt=!0}else W=W.next;while(pt||W!==O);return O}function Ep(p,O,W,pt,At,Ot,Wt){if(p){!Wt&&Ot&&ag(p,pt,At,Ot);for(var _e=p,De,Je;p.prev!==p.next;){if(De=p.prev,Je=p.next,Ot?T_(p,pt,At,Ot):ng(p)){O.push(De.i/W),O.push(p.i/W),O.push(Je.i/W),$d(p),p=Je.next,_e=Je.next;continue}if(p=Je,p===_e){Wt?Wt===1?(p=k_(Zh(p),O,W),Ep(p,O,W,pt,At,Ot,2)):Wt===2&&Gv(p,O,W,pt,At,Ot):Ep(Zh(p),O,W,pt,At,Ot,1);break}}}}function ng(p){var O=p.prev,W=p,pt=p.next;if(cc(O,W,pt)>=0)return!1;for(var At=p.next.next;At!==p.prev;){if(cp(O.x,O.y,W.x,W.y,pt.x,pt.y,At.x,At.y)&&cc(At.prev,At,At.next)>=0)return!1;At=At.next}return!0}function T_(p,O,W,pt){var At=p.prev,Ot=p,Wt=p.next;if(cc(At,Ot,Wt)>=0)return!1;for(var _e=At.xOt.x?At.x>Wt.x?At.x:Wt.x:Ot.x>Wt.x?Ot.x:Wt.x,sr=At.y>Ot.y?At.y>Wt.y?At.y:Wt.y:Ot.y>Wt.y?Ot.y:Wt.y,Ar=ig(_e,De,O,W,pt),Pr=ig(Je,sr,O,W,pt),Vr=p.prevZ,un=p.nextZ;Vr&&Vr.z>=Ar&&un&&un.z<=Pr;){if(Vr!==p.prev&&Vr!==p.next&&cp(At.x,At.y,Ot.x,Ot.y,Wt.x,Wt.y,Vr.x,Vr.y)&&cc(Vr.prev,Vr,Vr.next)>=0||(Vr=Vr.prevZ,un!==p.prev&&un!==p.next&&cp(At.x,At.y,Ot.x,Ot.y,Wt.x,Wt.y,un.x,un.y)&&cc(un.prev,un,un.next)>=0))return!1;un=un.nextZ}for(;Vr&&Vr.z>=Ar;){if(Vr!==p.prev&&Vr!==p.next&&cp(At.x,At.y,Ot.x,Ot.y,Wt.x,Wt.y,Vr.x,Vr.y)&&cc(Vr.prev,Vr,Vr.next)>=0)return!1;Vr=Vr.prevZ}for(;un&&un.z<=Pr;){if(un!==p.prev&&un!==p.next&&cp(At.x,At.y,Ot.x,Ot.y,Wt.x,Wt.y,un.x,un.y)&&cc(un.prev,un,un.next)>=0)return!1;un=un.nextZ}return!0}function k_(p,O,W){var pt=p;do{var At=pt.prev,Ot=pt.next.next;!td(At,Ot)&&zp(At,pt,pt.next,Ot)&&ed(At,Ot)&&ed(Ot,At)&&(O.push(At.i/W),O.push(pt.i/W),O.push(Ot.i/W),$d(pt),$d(pt.next),pt=p=Ot),pt=pt.next}while(pt!==p);return Zh(pt)}function Gv(p,O,W,pt,At,Ot){var Wt=p;do{for(var _e=Wt.next.next;_e!==Wt.prev;){if(Wt.i!==_e.i&&M_(Wt,_e)){var De=sg(Wt,_e);Wt=Zh(Wt,Wt.next),De=Zh(De,De.next),Ep(Wt,O,W,pt,At,Ot),Ep(De,O,W,pt,At,Ot);return}_e=_e.next}Wt=Wt.next}while(Wt!==p)}function Zv(p,O,W,pt){var At=[],Ot,Wt,_e,De,Je;for(Ot=0,Wt=O.length;Ot=W.next.y&&W.next.y!==W.y){var _e=W.x+(At-W.y)*(W.next.x-W.x)/(W.next.y-W.y);if(_e<=pt&&_e>Ot){if(Ot=_e,_e===pt){if(At===W.y)return W;if(At===W.next.y)return W.next}Wt=W.x=W.x&&W.x>=Je&&pt!==W.x&&cp(AtWt.x||W.x===Wt.x&&Kv(Wt,W)))&&(Wt=W,Ar=Pr)),W=W.next;while(W!==De);return Wt}function Kv(p,O){return cc(p.prev,p,O.prev)<0&&cc(O.next,p,p.next)<0}function ag(p,O,W,pt){var At=p;do At.z===null&&(At.z=ig(At.x,At.y,O,W,pt)),At.prevZ=At.prev,At.nextZ=At.next,At=At.next;while(At!==p);At.prevZ.nextZ=null,At.prevZ=null,A_(At)}function A_(p){var O,W,pt,At,Ot,Wt,_e,De,Je=1;do{for(W=p,p=null,Ot=null,Wt=0;W;){for(Wt++,pt=W,_e=0,O=0;O0||De>0&&pt;)_e!==0&&(De===0||!pt||W.z<=pt.z)?(At=W,W=W.nextZ,_e--):(At=pt,pt=pt.nextZ,De--),Ot?Ot.nextZ=At:p=At,At.prevZ=Ot,Ot=At;W=pt}Ot.nextZ=null,Je*=2}while(Wt>1);return p}function ig(p,O,W,pt,At){return p=32767*(p-W)*At,O=32767*(O-pt)*At,p=(p|p<<8)&16711935,p=(p|p<<4)&252645135,p=(p|p<<2)&858993459,p=(p|p<<1)&1431655765,O=(O|O<<8)&16711935,O=(O|O<<4)&252645135,O=(O|O<<2)&858993459,O=(O|O<<1)&1431655765,p|O<<1}function W0(p){var O=p,W=p;do(O.x=0&&(p-Wt)*(pt-_e)-(W-Wt)*(O-_e)>=0&&(W-Wt)*(Ot-_e)-(At-Wt)*(pt-_e)>=0}function M_(p,O){return p.next.i!==O.i&&p.prev.i!==O.i&&!og(p,O)&&(ed(p,O)&&ed(O,p)&&G0(p,O)&&(cc(p.prev,p,O.prev)||cc(p,O.prev,O))||td(p,O)&&cc(p.prev,p,p.next)>0&&cc(O.prev,O,O.next)>0)}function cc(p,O,W){return(O.y-p.y)*(W.x-O.x)-(O.x-p.x)*(W.y-O.y)}function td(p,O){return p.x===O.x&&p.y===O.y}function zp(p,O,W,pt){var At=Xd(cc(p,O,W)),Ot=Xd(cc(p,O,pt)),Wt=Xd(cc(W,pt,p)),_e=Xd(cc(W,pt,O));return!!(At!==Ot&&Wt!==_e||At===0&&Yd(p,W,O)||Ot===0&&Yd(p,pt,O)||Wt===0&&Yd(W,p,pt)||_e===0&&Yd(W,O,pt))}function Yd(p,O,W){return O.x<=Math.max(p.x,W.x)&&O.x>=Math.min(p.x,W.x)&&O.y<=Math.max(p.y,W.y)&&O.y>=Math.min(p.y,W.y)}function Xd(p){return p>0?1:p<0?-1:0}function og(p,O){var W=p;do{if(W.i!==p.i&&W.next.i!==p.i&&W.i!==O.i&&W.next.i!==O.i&&zp(W,W.next,p,O))return!0;W=W.next}while(W!==p);return!1}function ed(p,O){return cc(p.prev,p,p.next)<0?cc(p,O,p.next)>=0&&cc(p,p.prev,O)>=0:cc(p,O,p.prev)<0||cc(p,p.next,O)<0}function G0(p,O){var W=p,pt=!1,At=(p.x+O.x)/2,Ot=(p.y+O.y)/2;do W.y>Ot!=W.next.y>Ot&&W.next.y!==W.y&&At<(W.next.x-W.x)*(Ot-W.y)/(W.next.y-W.y)+W.x&&(pt=!pt),W=W.next;while(W!==p);return pt}function sg(p,O){var W=new Z0(p.i,p.x,p.y),pt=new Z0(O.i,O.x,O.y),At=p.next,Ot=O.prev;return p.next=O,O.prev=p,W.next=At,At.prev=W,pt.next=W,W.prev=pt,Ot.next=pt,pt.prev=Ot,pt}function Yv(p,O,W,pt){var At=new Z0(p,O,W);return pt?(At.next=pt.next,At.prev=pt,pt.next.prev=At,pt.next=At):(At.prev=At,At.next=At),At}function $d(p){p.next.prev=p.prev,p.prev.next=p.next,p.prevZ&&(p.prevZ.nextZ=p.nextZ),p.nextZ&&(p.nextZ.prevZ=p.prevZ)}function Z0(p,O,W){this.i=p,this.x=O,this.y=W,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}q0.deviation=function(p,O,W,pt){var At=O&&O.length,Ot=At?O[0]*W:p.length,Wt=Math.abs(lg(p,0,Ot,W));if(At)for(var _e=0,De=O.length;_e0&&(pt+=p[At-1].length,W.holes.push(pt))}return W},H0.default=Wv;function S_(p,O,W,pt,At){Xv(p,O,W,pt||p.length-1,At||ug)}function Xv(p,O,W,pt,At){for(;pt>W;){if(pt-W>600){var Ot=pt-W+1,Wt=O-W+1,_e=Math.log(Ot),De=.5*Math.exp(2*_e/3),Je=.5*Math.sqrt(_e*De*(Ot-De)/Ot)*(Wt-Ot/2<0?-1:1),sr=Math.max(W,Math.floor(O-Wt*De/Ot+Je)),Ar=Math.min(pt,Math.floor(O+(Ot-Wt)*De/Ot+Je));Xv(p,O,sr,Ar,At)}var Pr=p[O],Vr=W,un=pt;for(Jd(p,W,O),At(p[pt],Pr)>0&&Jd(p,W,pt);Vr0;)un--}At(p[W],Pr)===0?Jd(p,W,un):(un++,Jd(p,un,pt)),un<=O&&(W=un+1),O<=un&&(pt=un-1)}}function Jd(p,O,W){var pt=p[O];p[O]=p[W],p[W]=pt}function ug(p,O){return pO?1:0}function Oh(p,O){var W=p.length;if(W<=1)return[p];for(var pt=[],At,Ot,Wt=0;Wt1)for(var De=0;De>3}if(pt--,W===1||W===2)At+=p.readSVarint(),Ot+=p.readSVarint(),W===1&&(_e&&Wt.push(_e),_e=[]),_e.push(new o(At,Ot));else if(W===7)_e&&_e.push(_e[0].clone());else throw new Error("unknown command "+W)}return _e&&Wt.push(_e),Wt},Lp.prototype.bbox=function(){var p=this._pbf;p.pos=this._geometry;for(var O=p.readVarint()+p.pos,W=1,pt=0,At=0,Ot=0,Wt=1/0,_e=-1/0,De=1/0,Je=-1/0;p.pos>3}if(pt--,W===1||W===2)At+=p.readSVarint(),Ot+=p.readSVarint(),At_e&&(_e=At),OtJe&&(Je=Ot);else if(W!==7)throw new Error("unknown command "+W)}return[Wt,De,_e,Je]},Lp.prototype.toGeoJSON=function(p,O,W){var pt=this.extent*Math.pow(2,W),At=this.extent*p,Ot=this.extent*O,Wt=this.loadGeometry(),_e=Lp.types[this.type],De,Je;function sr(Vr){for(var un=0;un>3;O=pt===1?p.readString():pt===2?p.readFloat():pt===3?p.readDouble():pt===4?p.readVarint64():pt===5?p.readVarint():pt===6?p.readSVarint():pt===7?p.readBoolean():null}return O}iy.prototype.feature=function(p){if(p<0||p>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[p];var O=this._pbf.readVarint()+this._pbf.pos;return new rd(this._pbf,O,this.extent,this._keys,this._values)};var sy=ly;function ly(p,O){this.layers=p.readFields(uy,{},O)}function uy(p,O,W){if(p===3){var pt=new hg(W,W.readVarint()+W.pos);pt.length&&(O[pt.name]=pt)}}var cy=sy,E_=rd,z_=hg,Cp={VectorTile:cy,VectorTileFeature:E_,VectorTileLayer:z_},nd=Cp.VectorTileFeature.types,fy=500,ad=Math.pow(2,13);function id(p,O,W,pt,At,Ot,Wt,_e){p.emplaceBack(O,W,Math.floor(pt*ad)*2+Wt,At*ad*2,Ot*ad*2,Math.round(_e))}var ch=function(p){this.zoom=p.zoom,this.overscaling=p.overscaling,this.layers=p.layers,this.layerIds=this.layers.map(function(O){return O.id}),this.index=p.index,this.hasPattern=!1,this.layoutVertexArray=new An,this.indexArray=new gi,this.programConfigurations=new Gn(p.layers,p.zoom),this.segments=new $o,this.stateDependentLayerIds=this.layers.filter(function(O){return O.isStateDependent()}).map(function(O){return O.id})};ch.prototype.populate=function(p,O,W){this.features=[],this.hasPattern=K0("fill-extrusion",this.layers,O);for(var pt=0,At=p;pt=1){var ja=Fn[pa-1];if(!X0(Ea,ja)){Pr.vertexLength+4>$o.MAX_VERTEX_ARRAY_LENGTH&&(Pr=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var Aa=Ea.sub(ja)._perp()._unit(),$a=ja.dist(Ea);ga+$a>32768&&(ga=0),id(this.layoutVertexArray,Ea.x,Ea.y,Aa.x,Aa.y,0,0,ga),id(this.layoutVertexArray,Ea.x,Ea.y,Aa.x,Aa.y,0,1,ga),ga+=$a,id(this.layoutVertexArray,ja.x,ja.y,Aa.x,Aa.y,0,0,ga),id(this.layoutVertexArray,ja.x,ja.y,Aa.x,Aa.y,0,1,ga);var hi=Pr.vertexLength;this.indexArray.emplaceBack(hi,hi+2,hi+1),this.indexArray.emplaceBack(hi+1,hi+2,hi+3),Pr.vertexLength+=4,Pr.primitiveLength+=2}}}}if(Pr.vertexLength+De>$o.MAX_VERTEX_ARRAY_LENGTH&&(Pr=this.segments.prepareSegment(De,this.layoutVertexArray,this.indexArray)),nd[p.type]==="Polygon"){for(var Si=[],Ei=[],ro=Pr.vertexLength,no=0,go=_e;noLi)||p.y===O.y&&(p.y<0||p.y>Li)}function $0(p){return p.every(function(O){return O.x<0})||p.every(function(O){return O.x>Li})||p.every(function(O){return O.y<0})||p.every(function(O){return O.y>Li})}var L_=new Ka({"fill-extrusion-opacity":new qr(Da["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Sn(Da["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new qr(Da["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new qr(Da["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new sa(Da["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Sn(Da["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Sn(Da["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new qr(Da["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),C_={paint:L_},I_=(function(p){function O(W){p.call(this,W,C_)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype.createBucket=function(W){return new ch(W)},O.prototype.queryRadius=function(){return Jf(this.paint.get("fill-extrusion-translate"))},O.prototype.is3D=function(){return!0},O.prototype.queryIntersectsFeature=function(W,pt,At,Ot,Wt,_e,De,Je){var sr=zf(W,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),_e.angle,De),Ar=this.paint.get("fill-extrusion-height").evaluate(pt,At),Pr=this.paint.get("fill-extrusion-base").evaluate(pt,At),Vr=hy(sr,Je,_e,0),un=pg(Ot,Pr,Ar,Je),Fn=un[0],ga=un[1];return hp(Fn,ga,Vr)},O})(fa);function Dh(p,O){return p.x*O.x+p.y*O.y}function ff(p,O){if(p.length===1){for(var W=0,pt=O[W++],At;!At||pt.equals(At);)if(At=O[W++],!At)return 1/0;for(;W=2&&p[De-1].equals(p[De-2]);)De--;for(var Je=0;Je0;if(Si&&pa>Je){var ro=Pr.dist(Vr);if(ro>2*sr){var no=Pr.sub(Pr.sub(Vr)._mult(sr/ro)._round());this.updateDistance(Vr,no),this.addCurrentVertex(no,Fn,0,0,Ar),Vr=no}}var go=Vr&&un,Mo=go?W:_e?"butt":pt;if(go&&Mo==="round"&&($aAt&&(Mo="bevel"),Mo==="bevel"&&($a>2&&(Mo="flipbevel"),$a100)Ea=ga.mult(-1);else{var Vo=$a*Fn.add(ga).mag()/Fn.sub(ga).mag();Ea._perp()._mult(Vo*(Ei?-1:1))}this.addCurrentVertex(Pr,Ea,0,0,Ar),this.addCurrentVertex(Pr,Ea.mult(-1),0,0,Ar)}else if(Mo==="bevel"||Mo==="fakeround"){var vo=-Math.sqrt($a*$a-1),bo=Ei?vo:0,ol=Ei?0:vo;if(Vr&&this.addCurrentVertex(Pr,Fn,bo,ol,Ar),Mo==="fakeround")for(var Hl=Math.round(hi*180/Math.PI/gg),vu=1;vu2*sr){var Kc=Pr.add(un.sub(Pr)._mult(sr/kf)._round());this.updateDistance(Pr,Kc),this.addCurrentVertex(Kc,ga,0,0,Ar),Pr=Kc}}}}},bf.prototype.addCurrentVertex=function(p,O,W,pt,At,Ot){Ot===void 0&&(Ot=!1);var Wt=O.x+O.y*W,_e=O.y-O.x*W,De=-O.x+O.y*pt,Je=-O.y-O.x*pt;this.addHalfVertex(p,Wt,_e,Ot,!1,W,At),this.addHalfVertex(p,De,Je,Ot,!0,-pt,At),this.distance>J0/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(p,O,W,pt,At,Ot))},bf.prototype.addHalfVertex=function(p,O,W,pt,At,Ot,Wt){var _e=p.x,De=p.y,Je=this.lineClips?this.scaledDistance*(J0-1):this.scaledDistance,sr=Je*od;if(this.layoutVertexArray.emplaceBack((_e<<1)+(pt?1:0),(De<<1)+(At?1:0),Math.round(gy*O)+128,Math.round(gy*W)+128,(Ot===0?0:Ot<0?-1:1)+1|(sr&63)<<2,sr>>6),this.lineClips){var Ar=this.scaledDistance-this.lineClips.start,Pr=this.lineClips.end-this.lineClips.start,Vr=Ar/Pr;this.layoutVertexArray2.emplaceBack(Vr,this.lineClipsArray.length)}var un=Wt.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,un),Wt.primitiveLength++),At?this.e2=un:this.e1=un},bf.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance},bf.prototype.updateDistance=function(p,O){this.distance+=p.dist(O),this.updateScaledDistance()},Ve("LineBucket",bf,{omit:["layers","patternFeatures"]});var vg=new Ka({"line-cap":new qr(Da.layout_line["line-cap"]),"line-join":new Sn(Da.layout_line["line-join"]),"line-miter-limit":new qr(Da.layout_line["line-miter-limit"]),"line-round-limit":new qr(Da.layout_line["line-round-limit"]),"line-sort-key":new Sn(Da.layout_line["line-sort-key"])}),Q0=new Ka({"line-opacity":new Sn(Da.paint_line["line-opacity"]),"line-color":new Sn(Da.paint_line["line-color"]),"line-translate":new qr(Da.paint_line["line-translate"]),"line-translate-anchor":new qr(Da.paint_line["line-translate-anchor"]),"line-width":new Sn(Da.paint_line["line-width"]),"line-gap-width":new Sn(Da.paint_line["line-gap-width"]),"line-offset":new Sn(Da.paint_line["line-offset"]),"line-blur":new Sn(Da.paint_line["line-blur"]),"line-dasharray":new ea(Da.paint_line["line-dasharray"]),"line-pattern":new sa(Da.paint_line["line-pattern"]),"line-gradient":new ka(Da.paint_line["line-gradient"])}),sd={paint:Q0,layout:vg},yg=(function(p){function O(){p.apply(this,arguments)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype.possiblyEvaluate=function(W,pt){return pt=new ps(Math.floor(pt.zoom),{now:pt.now,fadeDuration:pt.fadeDuration,zoomHistory:pt.zoomHistory,transition:pt.transition}),p.prototype.possiblyEvaluate.call(this,W,pt)},O.prototype.evaluate=function(W,pt,At,Ot){return pt=M({},pt,{zoom:Math.floor(pt.zoom)}),p.prototype.evaluate.call(this,W,pt,At,Ot)},O})(Sn),tm=new yg(sd.paint.properties["line-width"].specification);tm.useIntegerZoom=!0;var xg=(function(p){function O(W){p.call(this,W,sd),this.gradientVersion=0}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype._handleSpecialPaintPropertyUpdate=function(W){if(W==="line-gradient"){var pt=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=pt._styleExpression.expression instanceof Yl,this.gradientVersion=(this.gradientVersion+1)%v}},O.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},O.prototype.recalculate=function(W,pt){p.prototype.recalculate.call(this,W,pt),this.paint._values["line-floorwidth"]=tm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,W)},O.prototype.createBucket=function(W){return new bf(W)},O.prototype.queryRadius=function(W){var pt=W,At=xy($f("line-width",this,pt),$f("line-gap-width",this,pt)),Ot=$f("line-offset",this,pt);return At/2+Math.abs(Ot)+Jf(this.paint.get("line-translate"))},O.prototype.queryIntersectsFeature=function(W,pt,At,Ot,Wt,_e,De){var Je=zf(W,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),_e.angle,De),sr=De/2*xy(this.paint.get("line-width").evaluate(pt,At),this.paint.get("line-gap-width").evaluate(pt,At)),Ar=this.paint.get("line-offset").evaluate(pt,At);return Ar&&(Ot=H(Ot,Ar*De)),uh(Je,Ot,sr)},O.prototype.isTileClipped=function(){return!0},O})(fa);function xy(p,O){return O>0?O+2*p:p}function H(p,O){for(var W=[],pt=new o(0,0),At=0;At":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Qe(p){for(var O="",W=0;W>1,sr=-7,Ar=W?At-1:0,Pr=W?-1:1,Vr=p[O+Ar];for(Ar+=Pr,Ot=Vr&(1<<-sr)-1,Vr>>=-sr,sr+=_e;sr>0;Ot=Ot*256+p[O+Ar],Ar+=Pr,sr-=8);for(Wt=Ot&(1<<-sr)-1,Ot>>=-sr,sr+=pt;sr>0;Wt=Wt*256+p[O+Ar],Ar+=Pr,sr-=8);if(Ot===0)Ot=1-Je;else{if(Ot===De)return Wt?NaN:(Vr?-1:1)*(1/0);Wt=Wt+Math.pow(2,pt),Ot=Ot-Je}return(Vr?-1:1)*Wt*Math.pow(2,Ot-pt)},Fr=function(p,O,W,pt,At,Ot){var Wt,_e,De,Je=Ot*8-At-1,sr=(1<>1,Pr=At===23?Math.pow(2,-24)-Math.pow(2,-77):0,Vr=pt?0:Ot-1,un=pt?1:-1,Fn=O<0||O===0&&1/O<0?1:0;for(O=Math.abs(O),isNaN(O)||O===1/0?(_e=isNaN(O)?1:0,Wt=sr):(Wt=Math.floor(Math.log(O)/Math.LN2),O*(De=Math.pow(2,-Wt))<1&&(Wt--,De*=2),Wt+Ar>=1?O+=Pr/De:O+=Pr*Math.pow(2,1-Ar),O*De>=2&&(Wt++,De/=2),Wt+Ar>=sr?(_e=0,Wt=sr):Wt+Ar>=1?(_e=(O*De-1)*Math.pow(2,At),Wt=Wt+Ar):(_e=O*Math.pow(2,Ar-1)*Math.pow(2,At),Wt=0));At>=8;p[W+Vr]=_e&255,Vr+=un,_e/=256,At-=8);for(Wt=Wt<0;p[W+Vr]=Wt&255,Vr+=un,Wt/=256,Je-=8);p[W+Vr-un]|=Fn*128},Zr={read:wr,write:Fr},en=yn;function yn(p){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(p)?p:new Uint8Array(p||0),this.pos=0,this.type=0,this.length=this.buf.length}yn.Varint=0,yn.Fixed64=1,yn.Bytes=2,yn.Fixed32=5;var Vn=65536*65536,Ca=1/Vn,ua=12,wa=typeof TextDecoder>"u"?null:new TextDecoder("utf8");yn.prototype={destroy:function(){this.buf=null},readFields:function(p,O,W){for(W=W||this.length;this.pos>3,Ot=this.pos;this.type=pt&7,p(At,O,this),this.pos===Ot&&this.skip(pt)}return O},readMessage:function(p,O){return this.readFields(p,O,this.readVarint()+this.pos)},readFixed32:function(){var p=Qf(this.buf,this.pos);return this.pos+=4,p},readSFixed32:function(){var p=qc(this.buf,this.pos);return this.pos+=4,p},readFixed64:function(){var p=Qf(this.buf,this.pos)+Qf(this.buf,this.pos+4)*Vn;return this.pos+=8,p},readSFixed64:function(){var p=Qf(this.buf,this.pos)+qc(this.buf,this.pos+4)*Vn;return this.pos+=8,p},readFloat:function(){var p=Zr.read(this.buf,this.pos,!0,23,4);return this.pos+=4,p},readDouble:function(){var p=Zr.read(this.buf,this.pos,!0,52,8);return this.pos+=8,p},readVarint:function(p){var O=this.buf,W,pt;return pt=O[this.pos++],W=pt&127,pt<128||(pt=O[this.pos++],W|=(pt&127)<<7,pt<128)||(pt=O[this.pos++],W|=(pt&127)<<14,pt<128)||(pt=O[this.pos++],W|=(pt&127)<<21,pt<128)?W:(pt=O[this.pos],W|=(pt&15)<<28,Xa(W,p,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var p=this.readVarint();return p%2===1?(p+1)/-2:p/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var p=this.readVarint()+this.pos,O=this.pos;return this.pos=p,p-O>=ua&&wa?Nf(this.buf,O,p):Rf(this.buf,O,p)},readBytes:function(){var p=this.readVarint()+this.pos,O=this.buf.subarray(this.pos,p);return this.pos=p,O},readPackedVarint:function(p,O){if(this.type!==yn.Bytes)return p.push(this.readVarint(O));var W=di(this);for(p=p||[];this.pos127;);else if(O===yn.Bytes)this.pos=this.readVarint()+this.pos;else if(O===yn.Fixed32)this.pos+=4;else if(O===yn.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+O)},writeTag:function(p,O){this.writeVarint(p<<3|O)},realloc:function(p){for(var O=this.length||16;O268435455||p<0){as(p,this);return}this.realloc(4),this.buf[this.pos++]=p&127|(p>127?128:0),!(p<=127)&&(this.buf[this.pos++]=(p>>>=7)&127|(p>127?128:0),!(p<=127)&&(this.buf[this.pos++]=(p>>>=7)&127|(p>127?128:0),!(p<=127)&&(this.buf[this.pos++]=p>>>7&127)))},writeSVarint:function(p){this.writeVarint(p<0?-p*2-1:p*2)},writeBoolean:function(p){this.writeVarint(!!p)},writeString:function(p){p=String(p),this.realloc(p.length*4),this.pos++;var O=this.pos;this.pos=jf(this.buf,p,this.pos);var W=this.pos-O;W>=128&&Co(O,W,this),this.pos=O-1,this.writeVarint(W),this.pos+=W},writeFloat:function(p){this.realloc(4),Zr.write(this.buf,p,this.pos,!0,23,4),this.pos+=4},writeDouble:function(p){this.realloc(8),Zr.write(this.buf,p,this.pos,!0,52,8),this.pos+=8},writeBytes:function(p){var O=p.length;this.writeVarint(O),this.realloc(O);for(var W=0;W=128&&Co(W,pt,this),this.pos=W-1,this.writeVarint(pt),this.pos+=pt},writeMessage:function(p,O,W){this.writeTag(p,yn.Bytes),this.writeRawMessage(O,W)},writePackedVarint:function(p,O){O.length&&this.writeMessage(p,xo,O)},writePackedSVarint:function(p,O){O.length&&this.writeMessage(p,ho,O)},writePackedBoolean:function(p,O){O.length&&this.writeMessage(p,Io,O)},writePackedFloat:function(p,O){O.length&&this.writeMessage(p,oi,O)},writePackedDouble:function(p,O){O.length&&this.writeMessage(p,Ro,O)},writePackedFixed32:function(p,O){O.length&&this.writeMessage(p,xs,O)},writePackedSFixed32:function(p,O){O.length&&this.writeMessage(p,mu,O)},writePackedFixed64:function(p,O){O.length&&this.writeMessage(p,uu,O)},writePackedSFixed64:function(p,O){O.length&&this.writeMessage(p,ef,O)},writeBytesField:function(p,O){this.writeTag(p,yn.Bytes),this.writeBytes(O)},writeFixed32Field:function(p,O){this.writeTag(p,yn.Fixed32),this.writeFixed32(O)},writeSFixed32Field:function(p,O){this.writeTag(p,yn.Fixed32),this.writeSFixed32(O)},writeFixed64Field:function(p,O){this.writeTag(p,yn.Fixed64),this.writeFixed64(O)},writeSFixed64Field:function(p,O){this.writeTag(p,yn.Fixed64),this.writeSFixed64(O)},writeVarintField:function(p,O){this.writeTag(p,yn.Varint),this.writeVarint(O)},writeSVarintField:function(p,O){this.writeTag(p,yn.Varint),this.writeSVarint(O)},writeStringField:function(p,O){this.writeTag(p,yn.Bytes),this.writeString(O)},writeFloatField:function(p,O){this.writeTag(p,yn.Fixed32),this.writeFloat(O)},writeDoubleField:function(p,O){this.writeTag(p,yn.Fixed64),this.writeDouble(O)},writeBooleanField:function(p,O){this.writeVarintField(p,!!O)}};function Xa(p,O,W){var pt=W.buf,At,Ot;if(Ot=pt[W.pos++],At=(Ot&112)>>4,Ot<128||(Ot=pt[W.pos++],At|=(Ot&127)<<3,Ot<128)||(Ot=pt[W.pos++],At|=(Ot&127)<<10,Ot<128)||(Ot=pt[W.pos++],At|=(Ot&127)<<17,Ot<128)||(Ot=pt[W.pos++],At|=(Ot&127)<<24,Ot<128)||(Ot=pt[W.pos++],At|=(Ot&1)<<31,Ot<128))return oo(p,At,O);throw new Error("Expected varint not more than 10 bytes")}function di(p){return p.type===yn.Bytes?p.readVarint()+p.pos:p.pos+1}function oo(p,O,W){return W?O*4294967296+(p>>>0):(O>>>0)*4294967296+(p>>>0)}function as(p,O){var W,pt;if(p>=0?(W=p%4294967296|0,pt=p/4294967296|0):(W=~(-p%4294967296),pt=~(-p/4294967296),W^4294967295?W=W+1|0:(W=0,pt=pt+1|0)),p>=18446744073709552e3||p<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");O.realloc(10),eo(W,pt,O),Ki(pt,O)}function eo(p,O,W){W.buf[W.pos++]=p&127|128,p>>>=7,W.buf[W.pos++]=p&127|128,p>>>=7,W.buf[W.pos++]=p&127|128,p>>>=7,W.buf[W.pos++]=p&127|128,p>>>=7,W.buf[W.pos]=p&127}function Ki(p,O){var W=(p&7)<<4;O.buf[O.pos++]|=W|((p>>>=3)?128:0),p&&(O.buf[O.pos++]=p&127|((p>>>=7)?128:0),p&&(O.buf[O.pos++]=p&127|((p>>>=7)?128:0),p&&(O.buf[O.pos++]=p&127|((p>>>=7)?128:0),p&&(O.buf[O.pos++]=p&127|((p>>>=7)?128:0),p&&(O.buf[O.pos++]=p&127)))))}function Co(p,O,W){var pt=O<=16383?1:O<=2097151?2:O<=268435455?3:Math.floor(Math.log(O)/(Math.LN2*7));W.realloc(pt);for(var At=W.pos-1;At>=p;At--)W.buf[At+pt]=W.buf[At]}function xo(p,O){for(var W=0;W>>8,p[W+2]=O>>>16,p[W+3]=O>>>24}function qc(p,O){return(p[O]|p[O+1]<<8|p[O+2]<<16)+(p[O+3]<<24)}function Rf(p,O,W){for(var pt="",At=O;At239?4:Ot>223?3:Ot>191?2:1;if(At+_e>W)break;var De,Je,sr;_e===1?Ot<128&&(Wt=Ot):_e===2?(De=p[At+1],(De&192)===128&&(Wt=(Ot&31)<<6|De&63,Wt<=127&&(Wt=null))):_e===3?(De=p[At+1],Je=p[At+2],(De&192)===128&&(Je&192)===128&&(Wt=(Ot&15)<<12|(De&63)<<6|Je&63,(Wt<=2047||Wt>=55296&&Wt<=57343)&&(Wt=null))):_e===4&&(De=p[At+1],Je=p[At+2],sr=p[At+3],(De&192)===128&&(Je&192)===128&&(sr&192)===128&&(Wt=(Ot&15)<<18|(De&63)<<12|(Je&63)<<6|sr&63,(Wt<=65535||Wt>=1114112)&&(Wt=null))),Wt===null?(Wt=65533,_e=1):Wt>65535&&(Wt-=65536,pt+=String.fromCharCode(Wt>>>10&1023|55296),Wt=56320|Wt&1023),pt+=String.fromCharCode(Wt),At+=_e}return pt}function Nf(p,O,W){return wa.decode(p.subarray(O,W))}function jf(p,O,W){for(var pt=0,At,Ot;pt55295&&At<57344)if(Ot)if(At<56320){p[W++]=239,p[W++]=191,p[W++]=189,Ot=At;continue}else At=Ot-55296<<10|At-56320|65536,Ot=null;else{At>56319||pt+1===O.length?(p[W++]=239,p[W++]=191,p[W++]=189):Ot=At;continue}else Ot&&(p[W++]=239,p[W++]=191,p[W++]=189,Ot=null);At<128?p[W++]=At:(At<2048?p[W++]=At>>6|192:(At<65536?p[W++]=At>>12|224:(p[W++]=At>>18|240,p[W++]=At>>12&63|128),p[W++]=At>>6&63|128),p[W++]=At&63|128)}return W}var nc=3;function rf(p,O,W){p===1&&W.readMessage(Lf,O)}function Lf(p,O,W){if(p===3){var pt=W.readMessage(wf,{}),At=pt.id,Ot=pt.bitmap,Wt=pt.width,_e=pt.height,De=pt.left,Je=pt.top,sr=pt.advance;O.push({id:At,bitmap:new Hc({width:Wt+2*nc,height:_e+2*nc},Ot),metrics:{width:Wt,height:_e,left:De,top:Je,advance:sr}})}}function wf(p,O,W){p===1?O.id=W.readVarint():p===2?O.bitmap=W.readBytes():p===3?O.width=W.readVarint():p===4?O.height=W.readVarint():p===5?O.left=W.readSVarint():p===6?O.top=W.readSVarint():p===7&&(O.advance=W.readVarint())}function Uf(p){return new en(p).readFields(rf,[])}var hf=nc;function fh(p){for(var O=0,W=0,pt=0,At=p;pt=0;Vr--){var un=_e[Vr];if(!(Pr.w>un.w||Pr.h>un.h)){if(Pr.x=un.x,Pr.y=un.y,Je=Math.max(Je,Pr.y+Pr.h),De=Math.max(De,Pr.x+Pr.w),Pr.w===un.w&&Pr.h===un.h){var Fn=_e.pop();Vr<_e.length&&(_e[Vr]=Fn)}else Pr.h===un.h?(un.x+=Pr.w,un.w-=Pr.w):Pr.w===un.w?(un.y+=Pr.h,un.h-=Pr.h):(_e.push({x:un.x+Pr.w,y:un.y,w:un.w-Pr.w,h:Pr.h}),un.y+=Pr.h,un.h-=Pr.h);break}}return{w:De,h:Je,fill:O/(De*Je)||0}}var zu=1,vl=function(p,O){var W=O.pixelRatio,pt=O.version,At=O.stretchX,Ot=O.stretchY,Wt=O.content;this.paddedRect=p,this.pixelRatio=W,this.stretchX=At,this.stretchY=Ot,this.content=Wt,this.version=pt},Vl={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};Vl.tl.get=function(){return[this.paddedRect.x+zu,this.paddedRect.y+zu]},Vl.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-zu,this.paddedRect.y+this.paddedRect.h-zu]},Vl.tlbr.get=function(){return this.tl.concat(this.br)},Vl.displaySize.get=function(){return[(this.paddedRect.w-zu*2)/this.pixelRatio,(this.paddedRect.h-zu*2)/this.pixelRatio]},Object.defineProperties(vl.prototype,Vl);var eu=function(p,O){var W={},pt={};this.haveRenderCallbacks=[];var At=[];this.addImages(p,W,At),this.addImages(O,pt,At);var Ot=fh(At),Wt=Ot.w,_e=Ot.h,De=new _f({width:Wt||1,height:_e||1});for(var Je in p){var sr=p[Je],Ar=W[Je].paddedRect;_f.copy(sr.data,De,{x:0,y:0},{x:Ar.x+zu,y:Ar.y+zu},sr.data)}for(var Pr in O){var Vr=O[Pr],un=pt[Pr].paddedRect,Fn=un.x+zu,ga=un.y+zu,pa=Vr.data.width,Ea=Vr.data.height;_f.copy(Vr.data,De,{x:0,y:0},{x:Fn,y:ga},Vr.data),_f.copy(Vr.data,De,{x:0,y:Ea-1},{x:Fn,y:ga-1},{width:pa,height:1}),_f.copy(Vr.data,De,{x:0,y:0},{x:Fn,y:ga+Ea},{width:pa,height:1}),_f.copy(Vr.data,De,{x:pa-1,y:0},{x:Fn-1,y:ga},{width:1,height:Ea}),_f.copy(Vr.data,De,{x:0,y:0},{x:Fn+pa,y:ga},{width:1,height:Ea})}this.image=De,this.iconPositions=W,this.patternPositions=pt};eu.prototype.addImages=function(p,O,W){for(var pt in p){var At=p[pt],Ot={x:0,y:0,w:At.data.width+2*zu,h:At.data.height+2*zu};W.push(Ot),O[pt]=new vl(Ot,At),At.hasRenderCallback&&this.haveRenderCallbacks.push(pt)}},eu.prototype.patchUpdatedImages=function(p,O){p.dispatchRenderCallbacks(this.haveRenderCallbacks);for(var W in p.updatedImages)this.patchUpdatedImage(this.iconPositions[W],p.getImage(W),O),this.patchUpdatedImage(this.patternPositions[W],p.getImage(W),O)},eu.prototype.patchUpdatedImage=function(p,O,W){if(!(!p||!O)&&p.version!==O.version){p.version=O.version;var pt=p.tl,At=pt[0],Ot=pt[1];W.update(O.data,void 0,{x:At,y:Ot})}},Ve("ImagePosition",vl),Ve("ImageAtlas",eu);var $u={horizontal:1,vertical:2,horizontalOnly:3},Lu=-17;function ld(p){for(var O=0,W=p;O=0&&pt>=p&&hh[this.text.charCodeAt(pt)];pt--)W--;this.text=this.text.substring(p,W),this.sectionIndex=this.sectionIndex.slice(p,W)},gu.prototype.substring=function(p,O){var W=new gu;return W.text=this.text.substring(p,O),W.sectionIndex=this.sectionIndex.slice(p,O),W.sections=this.sections,W},gu.prototype.toString=function(){return this.text},gu.prototype.getMaxScale=function(){var p=this;return this.sectionIndex.reduce(function(O,W){return Math.max(O,p.sections[W].scale)},0)},gu.prototype.addTextSection=function(p,O){this.text+=p.text,this.sections.push(Cf.forText(p.scale,p.fontStack||O));for(var W=this.sections.length-1,pt=0;pt=Ah?null:++this.imageSectionID:(this.imageSectionID=kh,this.imageSectionID)};function pf(p,O){for(var W=[],pt=p.text,At=0,Ot=0,Wt=O;Ot=0,sr=0,Ar=0;Ar0&&cu>ro&&(ro=cu)}else{var Sc=W[go.fontStack],kf=Sc&&Sc[Vo];if(kf&&kf.rect)ol=kf.rect,bo=kf.metrics;else{var Kc=O[go.fontStack],Hf=Kc&&Kc[Vo];if(!Hf)continue;bo=Hf.metrics}vo=($a-go.scale)*lr}dl?(p.verticalizable=!0,Ei.push({glyph:Vo,imageName:Hl,x:Pr,y:Vr+vo,vertical:dl,scale:go.scale,fontStack:go.fontStack,sectionIndex:Mo,metrics:bo,rect:ol}),Pr+=vu*go.scale+Je):(Ei.push({glyph:Vo,imageName:Hl,x:Pr,y:Vr+vo,vertical:dl,scale:go.scale,fontStack:go.fontStack,sectionIndex:Mo,metrics:bo,rect:ol}),Pr+=bo.advance*go.scale+Je)}if(Ei.length!==0){var qf=Pr-Je;un=Math.max(qf,un),D_(Ei,0,Ei.length-1,ga,ro)}Pr=0;var Wf=Ot*$a+ro;Si.lineOffset=Math.max(ro,hi),Vr+=Wf,Fn=Math.max(Wf,Fn),++pa}var mf=Vr-Lu,th=Ag(Wt),eh=th.horizontalAlign,nf=th.verticalAlign;F_(p.positionedLines,ga,eh,nf,un,Fn,Ot,mf,At.length),p.top+=-nf*mf,p.bottom=p.top+mf,p.left+=-eh*un,p.right=p.left+un}function D_(p,O,W,pt,At){if(!(!pt&&!At))for(var Ot=p[W],Wt=Ot.metrics.advance*Ot.scale,_e=(p[W].x+Wt)*pt,De=O;De<=W;De++)p[De].x-=_e,p[De].y+=At}function F_(p,O,W,pt,At,Ot,Wt,_e,De){var Je=(O-W)*At,sr=0;Ot!==Wt?sr=-_e*pt-Lu:sr=(-pt*De+.5)*Wt;for(var Ar=0,Pr=p;Ar-W/2;){if(Wt--,Wt<0)return!1;_e-=p[Wt].dist(Ot),Ot=p[Wt]}_e+=p[Wt].dist(p[Wt+1]),Wt++;for(var De=[],Je=0;_ept;)Je-=De.shift().angleDelta;if(Je>At)return!1;Wt++,_e+=Ar.dist(Pr)}return!0}function Tf(p){for(var O=0,W=0;WJe){var un=(Je-De)/Vr,Fn=Ws(Ar.x,Pr.x,un),ga=Ws(Ar.y,Pr.y,un),pa=new ud(Fn,ga,Pr.angleTo(Ar),sr);return pa._round(),!Wt||wy(p,pa,_e,Wt,O)?pa:void 0}De+=Vr}}function Ip(p,O,W,pt,At,Ot,Wt,_e,De){var Je=ph(pt,Ot,Wt),sr=pp(pt,At),Ar=sr*Wt,Pr=p[0].x===0||p[0].x===De||p[0].y===0||p[0].y===De;O-Ar=0&&Aa=0&&$a=0&&Pr+Je<=sr){var hi=new ud(Aa,$a,Ea,un);hi._round(),(!pt||wy(p,hi,Ot,pt,At))&&Vr.push(hi)}}Ar+=pa}return!_e&&!Vr.length&&!Wt&&(Vr=Sh(p,Ar/2,W,pt,At,Ot,Wt,!0,De)),Vr}function x4(p,O,W,pt,At){for(var Ot=[],Wt=0;Wt=pt&&Ar.x>=pt)&&(sr.x>=pt?sr=new o(pt,sr.y+(Ar.y-sr.y)*((pt-sr.x)/(Ar.x-sr.x)))._round():Ar.x>=pt&&(Ar=new o(pt,sr.y+(Ar.y-sr.y)*((pt-sr.x)/(Ar.x-sr.x)))._round()),!(sr.y>=At&&Ar.y>=At)&&(sr.y>=At?sr=new o(sr.x+(Ar.x-sr.x)*((At-sr.y)/(Ar.y-sr.y)),At)._round():Ar.y>=At&&(Ar=new o(sr.x+(Ar.x-sr.x)*((At-sr.y)/(Ar.y-sr.y)),At)._round()),(!De||!sr.equals(De[De.length-1]))&&(De=[sr],Ot.push(De)),De.push(Ar)))))}return Ot}var rm=zu;function _4(p,O,W,pt){var At=[],Ot=p.image,Wt=Ot.pixelRatio,_e=Ot.paddedRect.w-2*rm,De=Ot.paddedRect.h-2*rm,Je=p.right-p.left,sr=p.bottom-p.top,Ar=Ot.stretchX||[[0,_e]],Pr=Ot.stretchY||[[0,De]],Vr=function(ql,sl){return ql+sl[1]-sl[0]},un=Ar.reduce(Vr,0),Fn=Pr.reduce(Vr,0),ga=_e-un,pa=De-Fn,Ea=0,ja=un,Aa=0,$a=Fn,hi=0,Si=ga,Ei=0,ro=pa;if(Ot.content&&pt){var no=Ot.content;Ea=Ty(Ar,0,no[0]),Aa=Ty(Pr,0,no[1]),ja=Ty(Ar,no[0],no[2]),$a=Ty(Pr,no[1],no[3]),hi=no[0]-Ea,Ei=no[1]-Aa,Si=no[2]-no[0]-ja,ro=no[3]-no[1]-$a}var go=function(ql,sl,ju,cu){var Sc=ky(ql.stretch-Ea,ja,Je,p.left),kf=Ay(ql.fixed-hi,Si,ql.stretch,un),Kc=ky(sl.stretch-Aa,$a,sr,p.top),Hf=Ay(sl.fixed-Ei,ro,sl.stretch,Fn),qf=ky(ju.stretch-Ea,ja,Je,p.left),Wf=Ay(ju.fixed-hi,Si,ju.stretch,un),mf=ky(cu.stretch-Aa,$a,sr,p.top),th=Ay(cu.fixed-Ei,ro,cu.stretch,Fn),eh=new o(Sc,Kc),nf=new o(qf,Kc),rh=new o(qf,mf),_h=new o(Sc,mf),Dp=new o(kf/Wt,Hf/Wt),pd=new o(Wf/Wt,th/Wt),dd=O*Math.PI/180;if(dd){var md=Math.sin(dd),cm=Math.cos(dd),Fh=[cm,-md,md,cm];eh._matMult(Fh),nf._matMult(Fh),_h._matMult(Fh),rh._matMult(Fh)}var Cy=ql.stretch+ql.fixed,G_=ju.stretch+ju.fixed,Iy=sl.stretch+sl.fixed,Z_=cu.stretch+cu.fixed,Eh={x:Ot.paddedRect.x+rm+Cy,y:Ot.paddedRect.y+rm+Iy,w:G_-Cy,h:Z_-Iy},fm=Si/Wt/Je,Py=ro/Wt/sr;return{tl:eh,tr:nf,bl:_h,br:rh,tex:Eh,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Dp,pixelOffsetBR:pd,minFontScaleX:fm,minFontScaleY:Py,isSDF:W}};if(!pt||!Ot.stretchX&&!Ot.stretchY)At.push(go({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_e+1},{fixed:0,stretch:De+1}));else for(var Mo=b4(Ar,ga,un),Vo=b4(Pr,pa,Fn),vo=0;vo0&&(Vr=Math.max(10,Vr),this.circleDiameter=Vr)}else{var un=Ot.top*Wt-_e,Fn=Ot.bottom*Wt+_e,ga=Ot.left*Wt-_e,pa=Ot.right*Wt+_e,Ea=Ot.collisionPadding;if(Ea&&(ga-=Ea[0]*Wt,un-=Ea[1]*Wt,pa+=Ea[2]*Wt,Fn+=Ea[3]*Wt),Je){var ja=new o(ga,un),Aa=new o(pa,un),$a=new o(ga,Fn),hi=new o(pa,Fn),Si=Je*Math.PI/180;ja._rotate(Si),Aa._rotate(Si),$a._rotate(Si),hi._rotate(Si),ga=Math.min(ja.x,Aa.x,$a.x,hi.x),pa=Math.max(ja.x,Aa.x,$a.x,hi.x),un=Math.min(ja.y,Aa.y,$a.y,hi.y),Fn=Math.max(ja.y,Aa.y,$a.y,hi.y)}p.emplaceBack(O.x,O.y,ga,un,pa,Fn,W,pt,At)}this.boxEndIndex=p.length},nm=function(p,O){if(p===void 0&&(p=[]),O===void 0&&(O=oI),this.data=p,this.length=this.data.length,this.compare=O,this.length>0)for(var W=(this.length>>1)-1;W>=0;W--)this._down(W)};nm.prototype.push=function(p){this.data.push(p),this.length++,this._up(this.length-1)},nm.prototype.pop=function(){if(this.length!==0){var p=this.data[0],O=this.data.pop();return this.length--,this.length>0&&(this.data[0]=O,this._down(0)),p}},nm.prototype.peek=function(){return this.data[0]},nm.prototype._up=function(p){for(var O=this,W=O.data,pt=O.compare,At=W[p];p>0;){var Ot=p-1>>1,Wt=W[Ot];if(pt(At,Wt)>=0)break;W[p]=Wt,p=Ot}W[p]=At},nm.prototype._down=function(p){for(var O=this,W=O.data,pt=O.compare,At=this.length>>1,Ot=W[p];p=0)break;W[p]=_e,p=Wt}W[p]=Ot};function oI(p,O){return pO?1:0}function sI(p,O,W){W===void 0&&(W=!1);for(var pt=1/0,At=1/0,Ot=-1/0,Wt=-1/0,_e=p[0],De=0;De<_e.length;De++){var Je=_e[De];(!De||Je.xOt)&&(Ot=Je.x),(!De||Je.y>Wt)&&(Wt=Je.y)}var sr=Ot-pt,Ar=Wt-At,Pr=Math.min(sr,Ar),Vr=Pr/2,un=new nm([],lI);if(Pr===0)return new o(pt,At);for(var Fn=pt;Fnpa.d||!pa.d)&&(pa=ja,W&&console.log("found best %d after %d probes",Math.round(1e4*ja.d)/1e4,Ea)),!(ja.max-pa.d<=O)&&(Vr=ja.h/2,un.push(new am(ja.p.x-Vr,ja.p.y-Vr,Vr,p)),un.push(new am(ja.p.x+Vr,ja.p.y-Vr,Vr,p)),un.push(new am(ja.p.x-Vr,ja.p.y+Vr,Vr,p)),un.push(new am(ja.p.x+Vr,ja.p.y+Vr,Vr,p)),Ea+=4)}return W&&(console.log("num probes: "+Ea),console.log("best distance: "+pa.d)),pa.p}function lI(p,O){return O.max-p.max}function am(p,O,W,pt){this.p=new o(p,O),this.h=W,this.d=uI(this.p,pt),this.max=this.d+this.h*Math.SQRT2}function uI(p,O){for(var W=!1,pt=1/0,At=0;Atp.y!=sr.y>p.y&&p.x<(sr.x-Je.x)*(p.y-Je.y)/(sr.y-Je.y)+Je.x&&(W=!W),pt=Math.min(pt,Ef(p,Je,sr))}return(W?1:-1)*Math.sqrt(pt)}function cI(p){for(var O=0,W=0,pt=0,At=p[0],Ot=0,Wt=At.length,_e=Wt-1;Ot=Li||Fh.y<0||Fh.y>=Li||pI(p,Fh,cm,W,pt,At,Vo,p.layers[0],p.collisionBoxArray,O.index,O.sourceLayerIndex,p.index,pa,$a,Ei,De,ja,hi,ro,Vr,O,Ot,Je,sr,Wt)};if(no==="line")for(var bo=0,ol=x4(O.geometry,0,0,Li,Li);bo1){var Kc=Mh(kf,Si,W.vertical||un,pt,Fn,Ea);Kc&&vo(kf,Kc)}}else if(O.type==="Polygon")for(var Hf=0,qf=Oh(O.geometry,0);Hffd&&N(p.layerIds[0]+': Value for "text-size" is >= '+Sg+'. Reduce your "text-size".')):ga.kind==="composite"&&(pa=[Wc*Vr.compositeTextSizes[0].evaluate(Wt,{},un),Wc*Vr.compositeTextSizes[1].evaluate(Wt,{},un)],(pa[0]>fd||pa[1]>fd)&&N(p.layerIds[0]+': Value for "text-size" is >= '+Sg+'. Reduce your "text-size".')),p.addSymbols(p.text,Fn,pa,_e,Ot,Wt,Je,O,De.lineStartIndex,De.lineLength,Pr,un);for(var Ea=0,ja=sr;Eafd&&N(p.layerIds[0]+': Value for "icon-size" is >= '+Sg+'. Reduce your "icon-size".')):eh.kind==="composite"&&(nf=[Wc*$a.compositeIconSizes[0].evaluate(Aa,{},Si),Wc*$a.compositeIconSizes[1].evaluate(Aa,{},Si)],(nf[0]>fd||nf[1]>fd)&&N(p.layerIds[0]+': Value for "icon-size" is >= '+Sg+'. Reduce your "icon-size".')),p.addSymbols(p.icon,mf,nf,ja,Ea,Aa,!1,O,no.lineStartIndex,no.lineLength,-1,Si),dl=p.icon.placedSymbolArray.length-1,th&&(ol=th.length*4,p.addSymbols(p.icon,th,nf,ja,Ea,Aa,$u.vertical,O,no.lineStartIndex,no.lineLength,-1,Si),ql=p.icon.placedSymbolArray.length-1)}for(var rh in pt.horizontal){var _h=pt.horizontal[rh];if(!go){ju=zt(_h.text);var Dp=_e.layout.get("text-rotate").evaluate(Aa,{},Si);go=new My(De,O,Je,sr,Ar,_h,Pr,Vr,un,Dp)}var pd=_h.positionedLines.length===1;if(Hl+=T4(p,O,_h,Ot,_e,un,Aa,Fn,no,pt.vertical?$u.horizontal:$u.horizontalOnly,pd?Object.keys(pt.horizontal):[rh],sl,dl,$a,Si),pd)break}pt.vertical&&(vu+=T4(p,O,pt.vertical,Ot,_e,un,Aa,Fn,no,$u.vertical,["vertical"],sl,ql,$a,Si));var dd=go?go.boxStartIndex:p.collisionBoxArray.length,md=go?go.boxEndIndex:p.collisionBoxArray.length,cm=Vo?Vo.boxStartIndex:p.collisionBoxArray.length,Fh=Vo?Vo.boxEndIndex:p.collisionBoxArray.length,Cy=Mo?Mo.boxStartIndex:p.collisionBoxArray.length,G_=Mo?Mo.boxEndIndex:p.collisionBoxArray.length,Iy=vo?vo.boxStartIndex:p.collisionBoxArray.length,Z_=vo?vo.boxEndIndex:p.collisionBoxArray.length,Eh=-1,fm=function(Lg,j4){return Lg&&Lg.circleDiameter?Math.max(Lg.circleDiameter,j4):j4};Eh=fm(go,Eh),Eh=fm(Vo,Eh),Eh=fm(Mo,Eh),Eh=fm(vo,Eh);var Py=Eh>-1?1:0;Py&&(Eh*=Ei/lr),p.glyphOffsetArray.length>=ru.MAX_GLYPHS&&N("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Aa.sortKey!==void 0&&p.addToSortKeyRanges(p.symbolInstances.length,Aa.sortKey),p.symbolInstances.emplaceBack(O.x,O.y,sl.right>=0?sl.right:-1,sl.center>=0?sl.center:-1,sl.left>=0?sl.left:-1,sl.vertical||-1,dl,ql,ju,dd,md,cm,Fh,Cy,G_,Iy,Z_,Je,Hl,vu,bo,ol,Py,0,Pr,cu,Sc,Eh)}function dI(p,O,W,pt){var At=p.compareText;if(!(O in At))At[O]=[];else for(var Ot=At[O],Wt=Ot.length-1;Wt>=0;Wt--)if(pt.dist(Ot[Wt])0)&&(Ot.value.kind!=="constant"||Ot.value.value.length>0),Je=_e.value.kind!=="constant"||!!_e.value.value||Object.keys(_e.parameters).length>0,sr=At.get("symbol-sort-key");if(this.features=[],!(!De&&!Je)){for(var Ar=O.iconDependencies,Pr=O.glyphDependencies,Vr=O.availableImages,un=new ps(this.zoom),Fn=0,ga=p;Fn=0;for(var Hl=0,vu=Ei.sections;Hl=0;_e--)Ot[_e]={x:O[_e].x,y:O[_e].y,tileUnitDistanceFromAnchor:At},_e>0&&(At+=O[_e-1].dist(O[_e]));for(var De=0;De0},ru.prototype.hasIconData=function(){return this.icon.segments.get().length>0},ru.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},ru.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},ru.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},ru.prototype.addIndicesForPlacedSymbol=function(p,O){for(var W=p.placedSymbolArray.get(O),pt=W.vertexStartIndex+W.numGlyphs*4,At=W.vertexStartIndex;At1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(p),this.sortedAngle=p,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var W=0,pt=this.symbolInstanceIndexes;W=0&&De.indexOf(Wt)===_e&&O.addIndicesForPlacedSymbol(O.text,Wt)}),Ot.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,Ot.verticalPlacedTextSymbolIndex),Ot.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,Ot.placedIconSymbolIndex),Ot.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,Ot.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},Ve("SymbolBucket",ru,{omit:["layers","collisionBoxArray","features","compareText"]}),ru.MAX_GLYPHS=65535,ru.addDynamicAttributes=U_;function yI(p,O){return O.replace(/{([^{}]+)}/g,function(W,pt){return pt in p?String(p[pt]):""})}var xI=new Ka({"symbol-placement":new qr(Da.layout_symbol["symbol-placement"]),"symbol-spacing":new qr(Da.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new qr(Da.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Sn(Da.layout_symbol["symbol-sort-key"]),"symbol-z-order":new qr(Da.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new qr(Da.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new qr(Da.layout_symbol["icon-ignore-placement"]),"icon-optional":new qr(Da.layout_symbol["icon-optional"]),"icon-rotation-alignment":new qr(Da.layout_symbol["icon-rotation-alignment"]),"icon-size":new Sn(Da.layout_symbol["icon-size"]),"icon-text-fit":new qr(Da.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new qr(Da.layout_symbol["icon-text-fit-padding"]),"icon-image":new Sn(Da.layout_symbol["icon-image"]),"icon-rotate":new Sn(Da.layout_symbol["icon-rotate"]),"icon-padding":new qr(Da.layout_symbol["icon-padding"]),"icon-keep-upright":new qr(Da.layout_symbol["icon-keep-upright"]),"icon-offset":new Sn(Da.layout_symbol["icon-offset"]),"icon-anchor":new Sn(Da.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new qr(Da.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new qr(Da.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new qr(Da.layout_symbol["text-rotation-alignment"]),"text-field":new Sn(Da.layout_symbol["text-field"]),"text-font":new Sn(Da.layout_symbol["text-font"]),"text-size":new Sn(Da.layout_symbol["text-size"]),"text-max-width":new Sn(Da.layout_symbol["text-max-width"]),"text-line-height":new qr(Da.layout_symbol["text-line-height"]),"text-letter-spacing":new Sn(Da.layout_symbol["text-letter-spacing"]),"text-justify":new Sn(Da.layout_symbol["text-justify"]),"text-radial-offset":new Sn(Da.layout_symbol["text-radial-offset"]),"text-variable-anchor":new qr(Da.layout_symbol["text-variable-anchor"]),"text-anchor":new Sn(Da.layout_symbol["text-anchor"]),"text-max-angle":new qr(Da.layout_symbol["text-max-angle"]),"text-writing-mode":new qr(Da.layout_symbol["text-writing-mode"]),"text-rotate":new Sn(Da.layout_symbol["text-rotate"]),"text-padding":new qr(Da.layout_symbol["text-padding"]),"text-keep-upright":new qr(Da.layout_symbol["text-keep-upright"]),"text-transform":new Sn(Da.layout_symbol["text-transform"]),"text-offset":new Sn(Da.layout_symbol["text-offset"]),"text-allow-overlap":new qr(Da.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new qr(Da.layout_symbol["text-ignore-placement"]),"text-optional":new qr(Da.layout_symbol["text-optional"])}),_I=new Ka({"icon-opacity":new Sn(Da.paint_symbol["icon-opacity"]),"icon-color":new Sn(Da.paint_symbol["icon-color"]),"icon-halo-color":new Sn(Da.paint_symbol["icon-halo-color"]),"icon-halo-width":new Sn(Da.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Sn(Da.paint_symbol["icon-halo-blur"]),"icon-translate":new qr(Da.paint_symbol["icon-translate"]),"icon-translate-anchor":new qr(Da.paint_symbol["icon-translate-anchor"]),"text-opacity":new Sn(Da.paint_symbol["text-opacity"]),"text-color":new Sn(Da.paint_symbol["text-color"],{runtimeType:Is,getOverride:function(p){return p.textColor},hasOverride:function(p){return!!p.textColor}}),"text-halo-color":new Sn(Da.paint_symbol["text-halo-color"]),"text-halo-width":new Sn(Da.paint_symbol["text-halo-width"]),"text-halo-blur":new Sn(Da.paint_symbol["text-halo-blur"]),"text-translate":new qr(Da.paint_symbol["text-translate"]),"text-translate-anchor":new qr(Da.paint_symbol["text-translate-anchor"])}),V_={paint:_I,layout:xI},sm=function(p){this.type=p.property.overrides?p.property.overrides.runtimeType:al,this.defaultValue=p};sm.prototype.evaluate=function(p){if(p.formattedSection){var O=this.defaultValue.property.overrides;if(O&&O.hasOverride(p.formattedSection))return O.getOverride(p.formattedSection)}return p.feature&&p.featureState?this.defaultValue.evaluate(p.feature,p.featureState):this.defaultValue.property.specification.default},sm.prototype.eachChild=function(p){if(!this.defaultValue.isConstant()){var O=this.defaultValue.value;p(O._styleExpression.expression)}},sm.prototype.outputDefined=function(){return!1},sm.prototype.serialize=function(){return null},Ve("FormatSectionOverride",sm,{omit:["defaultValue"]});var bI=(function(p){function O(W){p.call(this,W,V_)}return p&&(O.__proto__=p),O.prototype=Object.create(p&&p.prototype),O.prototype.constructor=O,O.prototype.recalculate=function(W,pt){if(p.prototype.recalculate.call(this,W,pt),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){var At=this.layout.get("text-writing-mode");if(At){for(var Ot=[],Wt=0,_e=At;Wt<_e.length;Wt+=1){var De=_e[Wt];Ot.indexOf(De)<0&&Ot.push(De)}this.layout._values["text-writing-mode"]=Ot}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()},O.prototype.getValueAndResolveTokens=function(W,pt,At,Ot){var Wt=this.layout.get(W).evaluate(pt,{},At,Ot),_e=this._unevaluatedLayout._values[W];return!_e.isDataDriven()&&!Ui(_e.value)&&Wt?yI(pt.properties,Wt):Wt},O.prototype.createBucket=function(W){return new ru(W)},O.prototype.queryRadius=function(){return 0},O.prototype.queryIntersectsFeature=function(){return!1},O.prototype._setPaintOverrides=function(){for(var W=0,pt=V_.paint.overridableProperties;W",targetMapId:pt,sourceMapId:Ot.mapId})}}},lm.prototype.receive=function(p){var O=p.data,W=O.id;if(W&&!(O.targetMapId&&this.mapId!==O.targetMapId))if(O.type===""){delete this.tasks[W];var pt=this.cancelCallbacks[W];delete this.cancelCallbacks[W],pt&&pt()}else st()||O.mustQueue?(this.tasks[W]=O,this.taskQueue.push(W),this.invoker.trigger()):this.processTask(W,O)},lm.prototype.process=function(){if(this.taskQueue.length){var p=this.taskQueue.shift(),O=this.tasks[p];delete this.tasks[p],this.taskQueue.length&&this.invoker.trigger(),O&&this.processTask(p,O)}},lm.prototype.processTask=function(p,O){var W=this;if(O.type===""){var pt=this.callbacks[p];delete this.callbacks[p],pt&&(O.error?pt(Wr(O.error)):pt(null,Wr(O.data)))}else{var At=!1,Ot=ot(this.globalScope)?void 0:[],Wt=O.hasCallback?function(Ar,Pr){At=!0,delete W.cancelCallbacks[p],W.target.postMessage({id:p,type:"",sourceMapId:W.mapId,error:Ar?Sr(Ar):null,data:Sr(Pr,Ot)},Ot)}:function(Ar){At=!0},_e=null,De=Wr(O.data);if(this.parent[O.type])_e=this.parent[O.type](O.sourceMapId,De,Wt);else if(this.parent.getWorkerSource){var Je=O.type.split("."),sr=this.parent.getWorkerSource(O.sourceMapId,Je[0],De.source);_e=sr[Je[1]](De,Wt)}else Wt(new Error("Could not find function "+O.type));!At&&_e&&_e.cancel&&(this.cancelCallbacks[p]=_e.cancel)}},lm.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};function II(p,O,W){O=Math.pow(2,W)-O-1;var pt=z4(p*256,O*256,W),At=z4((p+1)*256,(O+1)*256,W);return pt[0]+","+pt[1]+","+At[0]+","+At[1]}function z4(p,O,W){var pt=2*Math.PI*6378137/256/Math.pow(2,W),At=p*pt-2*Math.PI*6378137/2,Ot=O*pt-2*Math.PI*6378137/2;return[At,Ot]}var Gc=function(p,O){p&&(O?this.setSouthWest(p).setNorthEast(O):p.length===4?this.setSouthWest([p[0],p[1]]).setNorthEast([p[2],p[3]]):this.setSouthWest(p[0]).setNorthEast(p[1]))};Gc.prototype.setNorthEast=function(p){return this._ne=p instanceof Ju?new Ju(p.lng,p.lat):Ju.convert(p),this},Gc.prototype.setSouthWest=function(p){return this._sw=p instanceof Ju?new Ju(p.lng,p.lat):Ju.convert(p),this},Gc.prototype.extend=function(p){var O=this._sw,W=this._ne,pt,At;if(p instanceof Ju)pt=p,At=p;else if(p instanceof Gc){if(pt=p._sw,At=p._ne,!pt||!At)return this}else{if(Array.isArray(p))if(p.length===4||p.every(Array.isArray)){var Ot=p;return this.extend(Gc.convert(Ot))}else{var Wt=p;return this.extend(Ju.convert(Wt))}return this}return!O&&!W?(this._sw=new Ju(pt.lng,pt.lat),this._ne=new Ju(At.lng,At.lat)):(O.lng=Math.min(pt.lng,O.lng),O.lat=Math.min(pt.lat,O.lat),W.lng=Math.max(At.lng,W.lng),W.lat=Math.max(At.lat,W.lat)),this},Gc.prototype.getCenter=function(){return new Ju((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Gc.prototype.getSouthWest=function(){return this._sw},Gc.prototype.getNorthEast=function(){return this._ne},Gc.prototype.getNorthWest=function(){return new Ju(this.getWest(),this.getNorth())},Gc.prototype.getSouthEast=function(){return new Ju(this.getEast(),this.getSouth())},Gc.prototype.getWest=function(){return this._sw.lng},Gc.prototype.getSouth=function(){return this._sw.lat},Gc.prototype.getEast=function(){return this._ne.lng},Gc.prototype.getNorth=function(){return this._ne.lat},Gc.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Gc.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Gc.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Gc.prototype.contains=function(p){var O=Ju.convert(p),W=O.lng,pt=O.lat,At=this._sw.lat<=pt&&pt<=this._ne.lat,Ot=this._sw.lng<=W&&W<=this._ne.lng;return this._sw.lng>this._ne.lng&&(Ot=this._sw.lng>=W&&W>=this._ne.lng),At&&Ot},Gc.convert=function(p){return!p||p instanceof Gc?p:new Gc(p)};var L4=63710088e-1,Ju=function(p,O){if(isNaN(p)||isNaN(O))throw new Error("Invalid LngLat object: ("+p+", "+O+")");if(this.lng=+p,this.lat=+O,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};Ju.prototype.wrap=function(){return new Ju(x(this.lng,-180,180),this.lat)},Ju.prototype.toArray=function(){return[this.lng,this.lat]},Ju.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},Ju.prototype.distanceTo=function(p){var O=Math.PI/180,W=this.lat*O,pt=p.lat*O,At=Math.sin(W)*Math.sin(pt)+Math.cos(W)*Math.cos(pt)*Math.cos((p.lng-this.lng)*O),Ot=L4*Math.acos(Math.min(At,1));return Ot},Ju.prototype.toBounds=function(p){p===void 0&&(p=0);var O=40075017,W=360*p/O,pt=W/Math.cos(Math.PI/180*this.lat);return new Gc(new Ju(this.lng-pt,this.lat-W),new Ju(this.lng+pt,this.lat+W))},Ju.convert=function(p){if(p instanceof Ju)return p;if(Array.isArray(p)&&(p.length===2||p.length===3))return new Ju(Number(p[0]),Number(p[1]));if(!Array.isArray(p)&&typeof p=="object"&&p!==null)return new Ju(Number("lng"in p?p.lng:p.lon),Number(p.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")};var C4=2*Math.PI*L4;function I4(p){return C4*Math.cos(p*Math.PI/180)}function P4(p){return(180+p)/360}function O4(p){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+p*Math.PI/360)))/360}function D4(p,O){return p/I4(O)}function PI(p){return p*360-180}function q_(p){var O=180-p*360;return 360/Math.PI*Math.atan(Math.exp(O*Math.PI/180))-90}function OI(p,O){return p*I4(q_(O))}function DI(p){return 1/Math.cos(p*Math.PI/180)}var e0=function(p,O,W){W===void 0&&(W=0),this.x=+p,this.y=+O,this.z=+W};e0.fromLngLat=function(p,O){O===void 0&&(O=0);var W=Ju.convert(p);return new e0(P4(W.lng),O4(W.lat),D4(O,W.lat))},e0.prototype.toLngLat=function(){return new Ju(PI(this.x),q_(this.y))},e0.prototype.toAltitude=function(){return OI(this.z,this.y)},e0.prototype.meterInMercatorCoordinateUnits=function(){return 1/C4*DI(q_(this.y))};var r0=function(p,O,W){this.z=p,this.x=O,this.y=W,this.key=zg(0,p,p,O,W)};r0.prototype.equals=function(p){return this.z===p.z&&this.x===p.x&&this.y===p.y},r0.prototype.url=function(p,O){var W=II(this.x,this.y,this.z),pt=FI(this.z,this.x,this.y);return p[(this.x+this.y)%p.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",String(this.z)).replace("{x}",String(this.x)).replace("{y}",String(O==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",pt).replace("{bbox-epsg-3857}",W)},r0.prototype.getTilePoint=function(p){var O=Math.pow(2,this.z);return new o((p.x*O-this.x)*Li,(p.y*O-this.y)*Li)},r0.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var F4=function(p,O){this.wrap=p,this.canonical=O,this.key=zg(p,O.z,O.z,O.x,O.y)},Zc=function(p,O,W,pt,At){this.overscaledZ=p,this.wrap=O,this.canonical=new r0(W,+pt,+At),this.key=zg(O,p,W,pt,At)};Zc.prototype.equals=function(p){return this.overscaledZ===p.overscaledZ&&this.wrap===p.wrap&&this.canonical.equals(p.canonical)},Zc.prototype.scaledTo=function(p){var O=this.canonical.z-p;return p>this.canonical.z?new Zc(p,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Zc(p,this.wrap,p,this.canonical.x>>O,this.canonical.y>>O)},Zc.prototype.calculateScaledKey=function(p,O){var W=this.canonical.z-p;return p>this.canonical.z?zg(this.wrap*+O,p,this.canonical.z,this.canonical.x,this.canonical.y):zg(this.wrap*+O,p,p,this.canonical.x>>W,this.canonical.y>>W)},Zc.prototype.isChildOf=function(p){if(p.wrap!==this.wrap)return!1;var O=this.canonical.z-p.canonical.z;return p.overscaledZ===0||p.overscaledZ>O&&p.canonical.y===this.canonical.y>>O},Zc.prototype.children=function(p){if(this.overscaledZ>=p)return[new Zc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var O=this.canonical.z+1,W=this.canonical.x*2,pt=this.canonical.y*2;return[new Zc(O,this.wrap,O,W,pt),new Zc(O,this.wrap,O,W+1,pt),new Zc(O,this.wrap,O,W,pt+1),new Zc(O,this.wrap,O,W+1,pt+1)]},Zc.prototype.isLessThan=function(p){return this.wrapp.wrap?!1:this.overscaledZp.overscaledZ?!1:this.canonical.xp.canonical.x?!1:this.canonical.y0;Ot--)At=1<=this.dim+1||O<-1||O>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(O+1)*this.stride+(p+1)},Pp.prototype._unpackMapbox=function(p,O,W){return(p*256*256+O*256+W)/10-1e4},Pp.prototype._unpackTerrarium=function(p,O,W){return p*256+O+W/256-32768},Pp.prototype.getPixels=function(){return new _f({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Pp.prototype.backfillBorder=function(p,O,W){if(this.dim!==p.dim)throw new Error("dem dimension mismatch");var pt=O*this.dim,At=O*this.dim+this.dim,Ot=W*this.dim,Wt=W*this.dim+this.dim;switch(O){case-1:pt=At-1;break;case 1:At=pt+1;break}switch(W){case-1:Ot=Wt-1;break;case 1:Wt=Ot+1;break}for(var _e=-O*this.dim,De=-W*this.dim,Je=Ot;Je=0&&sr[3]>=0&&_e.insert(Wt,sr[0],sr[1],sr[2],sr[3])}},Op.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Cp.VectorTile(new en(this.rawTileData)).layers,this.sourceLayerCoder=new zy(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Op.prototype.query=function(p,O,W,pt){var At=this;this.loadVTLayers();for(var Ot=p.params||{},Wt=Li/p.tileSize/p.scale,_e=Gt(Ot.filter),De=p.queryGeometry,Je=p.queryPadding*Wt,sr=R4(De),Ar=this.grid.query(sr.minX-Je,sr.minY-Je,sr.maxX+Je,sr.maxY+Je),Pr=R4(p.cameraQueryGeometry),Vr=this.grid3D.query(Pr.minX-Je,Pr.minY-Je,Pr.maxX+Je,Pr.maxY+Je,function($a,hi,Si,Ei){return Ih(p.cameraQueryGeometry,$a-Je,hi-Je,Si+Je,Ei+Je)}),un=0,Fn=Vr;unpt)At=!1;else if(!O)At=!0;else if(this.expirationTime=mr.maxzoom)&&mr.visibility!=="none"){f(Tr,this.zoom,Ze);var kr=In[mr.id]=mr.createBucket({index:$r.bucketLayerIDs.length,layers:Tr,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Cn,sourceID:this.source});kr.populate(Fa,Nn,this.tileID.canonical),$r.bucketLayerIDs.push(Tr.map(function(rn){return rn.id}))}}}}var Ur,Or,pe,Ke,xr=t.mapObject(Nn.glyphDependencies,function(rn){return Object.keys(rn).map(Number)});Object.keys(xr).length?tr.send("getGlyphs",{uid:this.uid,stacks:xr},function(rn,Qr){Ur||(Ur=rn,Or=Qr,wn.call(tn))}):Or={};var Gr=Object.keys(Nn.iconDependencies);Gr.length?tr.send("getImages",{icons:Gr,source:this.source,tileID:this.tileID,type:"icons"},function(rn,Qr){Ur||(Ur=rn,pe=Qr,wn.call(tn))}):pe={};var ln=Object.keys(Nn.patternDependencies);ln.length?tr.send("getImages",{icons:ln,source:this.source,tileID:this.tileID,type:"patterns"},function(rn,Qr){Ur||(Ur=rn,Ke=Qr,wn.call(tn))}):Ke={},wn.call(this);function wn(){if(Ur)return zr(Ur);if(Or&&pe&&Ke){var rn=new a(Or),Qr=new t.ImageAtlas(pe,Ke);for(var vn in In){var Oa=In[vn];Oa instanceof t.SymbolBucket?(f(Oa.layers,this.zoom,Ze),t.performSymbolLayout(Oa,Or,rn.positions,pe,Qr.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):Oa.hasPattern&&(Oa instanceof t.LineBucket||Oa instanceof t.FillBucket||Oa instanceof t.FillExtrusionBucket)&&(f(Oa.layers,this.zoom,Ze),Oa.addFeatures(Nn,this.tileID.canonical,Qr.patternPositions))}this.status="done",zr(null,{buckets:t.values(In).filter(function(Qn){return!Qn.isEmpty()}),featureIndex:$r,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:rn.image,imageAtlas:Qr,glyphMap:this.returnDependencies?Or:null,iconMap:this.returnDependencies?pe:null,glyphPositions:this.returnDependencies?rn.positions:null})}}};function f(Se,Re,Ze){for(var tr=new t.EvaluationParameters(Re),zr=0,tn=Se;zr=0!=!!Re&&Se.reverse()}var k=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,M=function(Se){this._feature=Se,this.extent=t.EXTENT,this.type=Se.type,this.properties=Se.tags,"id"in Se&&!isNaN(Se.id)&&(this.id=parseInt(Se.id,10))};M.prototype.loadGeometry=function(){if(this._feature.type===1){for(var Se=[],Re=0,Ze=this._feature.geometry;Re"u"&&(tr.push($r),In=tr.length-1,tn[$r]=In),Re.writeVarint(In);var Nn=Ze.properties[$r],Kn=typeof Nn;Kn!=="string"&&Kn!=="boolean"&&Kn!=="number"&&(Nn=JSON.stringify(Nn));var $n=Kn+":"+Nn,ia=Yr[$n];typeof ia>"u"&&(zr.push(Nn),ia=zr.length-1,Yr[$n]=ia),Re.writeVarint(ia)}}function rt(Se,Re){return(Re<<3)+(Se&7)}function ct(Se){return Se<<1^Se>>31}function st(Se,Re){for(var Ze=Se.loadGeometry(),tr=Se.type,zr=0,tn=0,Yr=Ze.length,$r=0;$r>1;ot(Se,Re,Yr,tr,zr,tn%2),Z(Se,Re,Ze,tr,Yr-1,tn+1),Z(Se,Re,Ze,Yr+1,zr,tn+1)}}function ot(Se,Re,Ze,tr,zr,tn){for(;zr>tr;){if(zr-tr>600){var Yr=zr-tr+1,$r=Ze-tr+1,In=Math.log(Yr),Nn=.5*Math.exp(2*In/3),Kn=.5*Math.sqrt(In*Nn*(Yr-Nn)/Yr)*($r-Yr/2<0?-1:1),$n=Math.max(tr,Math.floor(Ze-$r*Nn/Yr+Kn)),ia=Math.min(zr,Math.floor(Ze+(Yr-$r)*Nn/Yr+Kn));ot(Se,Re,Ze,$n,ia,tn)}var Cn=Re[2*Ze+tn],Fa=tr,Ga=zr;for(X(Se,Re,tr,Ze),Re[2*zr+tn]>Cn&&X(Se,Re,tr,zr);FaCn;)Ga--}Re[2*tr+tn]===Cn?X(Se,Re,tr,Ga):(Ga++,X(Se,Re,Ga,zr)),Ga<=Ze&&(tr=Ga+1),Ze<=Ga&&(zr=Ga-1)}}function X(Se,Re,Ze,tr){Q(Se,Ze,tr),Q(Re,2*Ze,2*tr),Q(Re,2*Ze+1,2*tr+1)}function Q(Se,Re,Ze){var tr=Se[Re];Se[Re]=Se[Ze],Se[Ze]=tr}function ut(Se,Re,Ze,tr,zr,tn,Yr){for(var $r=[0,Se.length-1,0],In=[],Nn,Kn;$r.length;){var $n=$r.pop(),ia=$r.pop(),Cn=$r.pop();if(ia-Cn<=Yr){for(var Fa=Cn;Fa<=ia;Fa++)Nn=Re[2*Fa],Kn=Re[2*Fa+1],Nn>=Ze&&Nn<=zr&&Kn>=tr&&Kn<=tn&&In.push(Se[Fa]);continue}var Ga=Math.floor((Cn+ia)/2);Nn=Re[2*Ga],Kn=Re[2*Ga+1],Nn>=Ze&&Nn<=zr&&Kn>=tr&&Kn<=tn&&In.push(Se[Ga]);var ve=($n+1)%2;($n===0?Ze<=Nn:tr<=Kn)&&($r.push(Cn),$r.push(Ga-1),$r.push(ve)),($n===0?zr>=Nn:tn>=Kn)&&($r.push(Ga+1),$r.push(ia),$r.push(ve))}return In}function J(Se,Re,Ze,tr,zr,tn){for(var Yr=[0,Se.length-1,0],$r=[],In=zr*zr;Yr.length;){var Nn=Yr.pop(),Kn=Yr.pop(),$n=Yr.pop();if(Kn-$n<=tn){for(var ia=$n;ia<=Kn;ia++)q(Re[2*ia],Re[2*ia+1],Ze,tr)<=In&&$r.push(Se[ia]);continue}var Cn=Math.floor(($n+Kn)/2),Fa=Re[2*Cn],Ga=Re[2*Cn+1];q(Fa,Ga,Ze,tr)<=In&&$r.push(Se[Cn]);var ve=(Nn+1)%2;(Nn===0?Ze-zr<=Fa:tr-zr<=Ga)&&(Yr.push($n),Yr.push(Cn-1),Yr.push(ve)),(Nn===0?Ze+zr>=Fa:tr+zr>=Ga)&&(Yr.push(Cn+1),Yr.push(Kn),Yr.push(ve))}return $r}function q(Se,Re,Ze,tr){var zr=Se-Ze,tn=Re-tr;return zr*zr+tn*tn}var it=function(Se){return Se[0]},nt=function(Se){return Se[1]},dt=function(Se,Re,Ze,tr,zr){Re===void 0&&(Re=it),Ze===void 0&&(Ze=nt),tr===void 0&&(tr=64),zr===void 0&&(zr=Float64Array),this.nodeSize=tr,this.points=Se;for(var tn=Se.length<65536?Uint16Array:Uint32Array,Yr=this.ids=new tn(Se.length),$r=this.coords=new zr(Se.length*2),In=0;In=tr;Nn--){var Kn=+Date.now();$r=this._cluster($r,Nn),this.trees[Nn]=new dt($r,vt,Ut,tn,Float32Array),Ze&&console.log("z%d: %d clusters in %dms",Nn,$r.length,+Date.now()-Kn)}return Ze&&console.timeEnd("total time"),this},wt.prototype.getClusters=function(Se,Re){var Ze=((Se[0]+180)%360+360)%360-180,tr=Math.max(-90,Math.min(90,Se[1])),zr=Se[2]===180?180:((Se[2]+180)%360+360)%360-180,tn=Math.max(-90,Math.min(90,Se[3]));if(Se[2]-Se[0]>=360)Ze=-180,zr=180;else if(Ze>zr){var Yr=this.getClusters([Ze,tr,180,tn],Re),$r=this.getClusters([-180,tr,zr,tn],Re);return Yr.concat($r)}for(var In=this.trees[this._limitZoom(Re)],Nn=In.range(Jt(Ze),ee(tn),Jt(zr),ee(tr)),Kn=[],$n=0,ia=Nn;$nRe&&(Fa+=dr.numPoints||1)}if(Fa>=$r){for(var br=Kn.x*Cn,Tr=Kn.y*Cn,mr=Yr&&Cn>1?this._map(Kn,!0):null,kr=(Nn<<5)+(Re+1)+this.points.length,Ur=0,Or=ia;Ur1)for(var Gr=0,ln=ia;Gr>5},wt.prototype._getOriginZoom=function(Se){return(Se-this.points.length)%32},wt.prototype._map=function(Se,Re){if(Se.numPoints)return Re?bt({},Se.properties):Se.properties;var Ze=this.points[Se.index].properties,tr=this.options.map(Ze);return Re&&tr===Ze?bt({},tr):tr};function Ct(Se,Re,Ze,tr,zr){return{x:Se,y:Re,zoom:1/0,id:Ze,parentId:-1,numPoints:tr,properties:zr}}function It(Se,Re){var Ze=Se.geometry.coordinates,tr=Ze[0],zr=Ze[1];return{x:Jt(tr),y:ee(zr),zoom:1/0,index:Re,parentId:-1}}function Nt(Se){return{type:"Feature",id:Se.id,properties:te(Se),geometry:{type:"Point",coordinates:[Zt(Se.x),mt(Se.y)]}}}function te(Se){var Re=Se.numPoints,Ze=Re>=1e4?Math.round(Re/1e3)+"k":Re>=1e3?Math.round(Re/100)/10+"k":Re;return bt(bt({},Se.properties),{cluster:!0,cluster_id:Se.id,point_count:Re,point_count_abbreviated:Ze})}function Jt(Se){return Se/360+.5}function ee(Se){var Re=Math.sin(Se*Math.PI/180),Ze=.5-.25*Math.log((1+Re)/(1-Re))/Math.PI;return Ze<0?0:Ze>1?1:Ze}function Zt(Se){return(Se-.5)*360}function mt(Se){var Re=(180-Se*360)*Math.PI/180;return 360*Math.atan(Math.exp(Re))/Math.PI-90}function bt(Se,Re){for(var Ze in Re)Se[Ze]=Re[Ze];return Se}function vt(Se){return Se.x}function Ut(Se){return Se.y}function re(Se,Re,Ze,tr){for(var zr=tr,tn=Ze-Re>>1,Yr=Ze-Re,$r,In=Se[Re],Nn=Se[Re+1],Kn=Se[Ze],$n=Se[Ze+1],ia=Re+3;iazr)$r=ia,zr=Cn;else if(Cn===zr){var Fa=Math.abs(ia-tn);Fatr&&($r-Re>3&&re(Se,Re,$r,tr),Se[$r+2]=zr,Ze-$r>3&&re(Se,$r,Ze,tr))}function Kt(Se,Re,Ze,tr,zr,tn){var Yr=zr-Ze,$r=tn-tr;if(Yr!==0||$r!==0){var In=((Se-Ze)*Yr+(Re-tr)*$r)/(Yr*Yr+$r*$r);In>1?(Ze=zr,tr=tn):In>0&&(Ze+=Yr*In,tr+=$r*In)}return Yr=Se-Ze,$r=Re-tr,Yr*Yr+$r*$r}function ue(Se,Re,Ze,tr){var zr={id:typeof Se>"u"?null:Se,type:Re,geometry:Ze,tags:tr,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return Me(zr),zr}function Me(Se){var Re=Se.geometry,Ze=Se.type;if(Ze==="Point"||Ze==="MultiPoint"||Ze==="LineString")Ce(Se,Re);else if(Ze==="Polygon"||Ze==="MultiLineString")for(var tr=0;tr0&&(tr?Yr+=(zr*Nn-In*tn)/2:Yr+=Math.sqrt(Math.pow(In-zr,2)+Math.pow(Nn-tn,2))),zr=In,tn=Nn}var Kn=Re.length-3;Re[2]=1,re(Re,0,Kn,Ze),Re[Kn+2]=1,Re.size=Math.abs(Yr),Re.start=0,Re.end=Re.size}function er(Se,Re,Ze,tr){for(var zr=0;zr1?1:Ze}function de(Se,Re,Ze,tr,zr,tn,Yr,$r){if(Ze/=Re,tr/=Re,tn>=Ze&&Yr=tr)return null;for(var In=[],Nn=0;Nn=Ze&&Fa=tr)continue;var Ga=[];if(ia==="Point"||ia==="MultiPoint")Dt($n,Ga,Ze,tr,zr);else if(ia==="LineString")qt($n,Ga,Ze,tr,zr,!1,$r.lineMetrics);else if(ia==="MultiLineString")lt($n,Ga,Ze,tr,zr,!1);else if(ia==="Polygon")lt($n,Ga,Ze,tr,zr,!0);else if(ia==="MultiPolygon")for(var ve=0;ve<$n.length;ve++){var ge=[];lt($n[ve],ge,Ze,tr,zr,!0),ge.length&&Ga.push(ge)}if(Ga.length){if($r.lineMetrics&&ia==="LineString"){for(ve=0;ve=Ze&&Yr<=tr&&(Re.push(Se[tn]),Re.push(Se[tn+1]),Re.push(Se[tn+2]))}}function qt(Se,Re,Ze,tr,zr,tn,Yr){for(var $r=_t(Se),In=zr===0?St:Ht,Nn=Se.start,Kn,$n,ia=0;iaZe&&($n=In($r,Cn,Fa,ve,ge,Ze),Yr&&($r.start=Nn+Kn*$n)):dr>tr?br=Ze&&($n=In($r,Cn,Fa,ve,ge,Ze),Tr=!0),br>tr&&dr<=tr&&($n=In($r,Cn,Fa,ve,ge,tr),Tr=!0),!tn&&Tr&&(Yr&&($r.end=Nn+Kn*$n),Re.push($r),$r=_t(Se)),Yr&&(Nn+=Kn)}var mr=Se.length-3;Cn=Se[mr],Fa=Se[mr+1],Ga=Se[mr+2],dr=zr===0?Cn:Fa,dr>=Ze&&dr<=tr&&yt($r,Cn,Fa,Ga),mr=$r.length-3,tn&&mr>=3&&($r[mr]!==$r[0]||$r[mr+1]!==$r[1])&&yt($r,$r[0],$r[1],$r[2]),$r.length&&Re.push($r)}function _t(Se){var Re=[];return Re.size=Se.size,Re.start=Se.start,Re.end=Se.end,Re}function lt(Se,Re,Ze,tr,zr,tn){for(var Yr=0;YrYr.maxX&&(Yr.maxX=Kn),$n>Yr.maxY&&(Yr.maxY=$n)}return Yr}function ar(Se,Re,Ze,tr){var zr=Re.geometry,tn=Re.type,Yr=[];if(tn==="Point"||tn==="MultiPoint")for(var $r=0;$r0&&Re.size<(zr?Yr:tr)){Ze.numPoints+=Re.length/3;return}for(var $r=[],In=0;InYr)&&(Ze.numSimplified++,$r.push(Re[In]),$r.push(Re[In+1])),Ze.numPoints++;zr&&Er($r,tn),Se.push($r)}function Er(Se,Re){for(var Ze=0,tr=0,zr=Se.length,tn=zr-2;tr0===Re)for(tr=0,zr=Se.length;tr24)throw new Error("maxZoom should be in the 0-24 range");if(Re.promoteId&&Re.generateId)throw new Error("promoteId and generateId cannot be used together.");var tr=We(Se,Re);this.tiles={},this.tileCoords=[],Ze&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Re.indexMaxZoom,Re.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),tr=Yt(tr,Re),tr.length&&this.splitTile(tr,0,0,0),Ze&&(tr.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}dn.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},dn.prototype.splitTile=function(Se,Re,Ze,tr,zr,tn,Yr){for(var $r=[Se,Re,Ze,tr],In=this.options,Nn=In.debug;$r.length;){tr=$r.pop(),Ze=$r.pop(),Re=$r.pop(),Se=$r.pop();var Kn=1<1&&console.time("creation"),ia=this.tiles[$n]=ir(Se,Re,Ze,tr,In),this.tileCoords.push({z:Re,x:Ze,y:tr}),Nn)){Nn>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Re,Ze,tr,ia.numFeatures,ia.numPoints,ia.numSimplified),console.timeEnd("creation"));var Cn="z"+Re;this.stats[Cn]=(this.stats[Cn]||0)+1,this.total++}if(ia.source=Se,zr){if(Re===In.maxZoom||Re===zr)continue;var Fa=1<1&&console.time("clipping");var Ga=.5*In.buffer/In.extent,ve=.5-Ga,ge=.5+Ga,dr=1+Ga,br,Tr,mr,kr,Ur,Or;br=Tr=mr=kr=null,Ur=de(Se,Kn,Ze-Ga,Ze+ge,0,ia.minX,ia.maxX,In),Or=de(Se,Kn,Ze+ve,Ze+dr,0,ia.minX,ia.maxX,In),Se=null,Ur&&(br=de(Ur,Kn,tr-Ga,tr+ge,1,ia.minY,ia.maxY,In),Tr=de(Ur,Kn,tr+ve,tr+dr,1,ia.minY,ia.maxY,In),Ur=null),Or&&(mr=de(Or,Kn,tr-Ga,tr+ge,1,ia.minY,ia.maxY,In),kr=de(Or,Kn,tr+ve,tr+dr,1,ia.minY,ia.maxY,In),Or=null),Nn>1&&console.timeEnd("clipping"),$r.push(br||[],Re+1,Ze*2,tr*2),$r.push(Tr||[],Re+1,Ze*2,tr*2+1),$r.push(mr||[],Re+1,Ze*2+1,tr*2),$r.push(kr||[],Re+1,Ze*2+1,tr*2+1)}}},dn.prototype.getTile=function(Se,Re,Ze){var tr=this.options,zr=tr.extent,tn=tr.debug;if(Se<0||Se>24)return null;var Yr=1<1&&console.log("drilling down to z%d-%d-%d",Se,Re,Ze);for(var In=Se,Nn=Re,Kn=Ze,$n;!$n&&In>0;)In--,Nn=Math.floor(Nn/2),Kn=Math.floor(Kn/2),$n=this.tiles[bn(In,Nn,Kn)];return!$n||!$n.source?null:(tn>1&&console.log("found parent tile z%d-%d-%d",In,Nn,Kn),tn>1&&console.time("drilling down"),this.splitTile($n.source,In,Nn,Kn,Se,Re,Ze),tn>1&&console.timeEnd("drilling down"),this.tiles[$r]?Ee(this.tiles[$r],zr):null)};function bn(Se,Re,Ze){return((1<=0?0:U.button},r.remove=function(U){U.parentNode&&U.parentNode.removeChild(U)};function m(U,tt,Y){var ft,zt,Qt,ne=t.browser.devicePixelRatio>1?"@2x":"",Ft=t.getJSON(tt.transformRequest(tt.normalizeSpriteURL(U,ne,".json"),t.ResourceType.SpriteJSON),function(Ne,Ie){Ft=null,Qt||(Qt=Ne,ft=Ie,he())}),$t=t.getImage(tt.transformRequest(tt.normalizeSpriteURL(U,ne,".png"),t.ResourceType.SpriteImage),function(Ne,Ie){$t=null,Qt||(Qt=Ne,zt=Ie,he())});function he(){if(Qt)Y(Qt);else if(ft&&zt){var Ne=t.browser.getImageData(zt),Ie={};for(var Fe in ft){var He=ft[Fe],Ge=He.width,Ae=He.height,Oe=He.x,Le=He.y,ur=He.sdf,Dr=He.pixelRatio,jr=He.stretchX,On=He.stretchY,Ln=He.content,xn=new t.RGBAImage({width:Ge,height:Ae});t.RGBAImage.copy(Ne,xn,{x:Oe,y:Le},{x:0,y:0},{width:Ge,height:Ae}),Ie[Fe]={data:xn,pixelRatio:Dr,sdf:ur,stretchX:jr,stretchY:On,content:Ln}}Y(null,Ie)}}return{cancel:function(){Ft&&(Ft.cancel(),Ft=null),$t&&($t.cancel(),$t=null)}}}function w(U){var tt=U.userImage;if(tt&&tt.render){var Y=tt.render();if(Y)return U.data.replace(new Uint8Array(tt.data.buffer)),!0}return!1}var l=1,x=(function(U){function tt(){U.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}return U&&(tt.__proto__=U),tt.prototype=Object.create(U&&U.prototype),tt.prototype.constructor=tt,tt.prototype.isLoaded=function(){return this.loaded},tt.prototype.setLoaded=function(Y){if(this.loaded!==Y&&(this.loaded=Y,Y)){for(var ft=0,zt=this.requestors;ft=0?1.2:1))}T.prototype.draw=function(U){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.fillText(U,this.buffer,this.middle);for(var tt=this.ctx.getImageData(0,0,this.size,this.size),Y=new Uint8ClampedArray(this.size*this.size),ft=0;ft65535){he(new Error("glyphs > 65535 not supported"));return}if(Fe.ranges[Ge]){he(null,{stack:Ne,id:Ie,glyph:He});return}var Ae=Fe.requests[Ge];Ae||(Ae=Fe.requests[Ge]=[],b.loadGlyphRange(Ne,Ge,Y.url,Y.requestManager,function(Oe,Le){if(Le){for(var ur in Le)Y._doesCharSupportLocalGlyph(+ur)||(Fe.glyphs[+ur]=Le[+ur]);Fe.ranges[Ge]=!0}for(var Dr=0,jr=Ae;Dr1&&($t=U[++Ft]);var Ne=Math.abs(he-$t.left),Ie=Math.abs(he-$t.right),Fe=Math.min(Ne,Ie),He=void 0,Ge=zt/Y*(ft+1);if($t.isDash){var Ae=ft-Math.abs(Ge);He=Math.sqrt(Fe*Fe+Ae*Ae)}else He=ft-Math.sqrt(Fe*Fe+Ge*Ge);this.data[ne+he]=Math.max(0,Math.min(255,He+128))}},B.prototype.addRegularDash=function(U){for(var tt=U.length-1;tt>=0;--tt){var Y=U[tt],ft=U[tt+1];Y.zeroLength?U.splice(tt,1):ft&&ft.isDash===Y.isDash&&(ft.left=Y.left,U.splice(tt,1))}var zt=U[0],Qt=U[U.length-1];zt.isDash===Qt.isDash&&(zt.left=Qt.left-this.width,Qt.right=zt.right+this.width);for(var ne=this.width*this.nextRow,Ft=0,$t=U[Ft],he=0;he1&&($t=U[++Ft]);var Ne=Math.abs(he-$t.left),Ie=Math.abs(he-$t.right),Fe=Math.min(Ne,Ie),He=$t.isDash?Fe:-Fe;this.data[ne+he]=Math.max(0,Math.min(255,He+128))}},B.prototype.addDash=function(U,tt){var Y=tt?7:0,ft=2*Y+1;if(this.nextRow+ft>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var zt=0,Qt=0;Qt=Y.minX&&U.x=Y.minY&&U.y0&&(he[new t.OverscaledTileID(Y.overscaledZ,ne,ft.z,Qt,ft.y-1).key]={backfilled:!1},he[new t.OverscaledTileID(Y.overscaledZ,Y.wrap,ft.z,ft.x,ft.y-1).key]={backfilled:!1},he[new t.OverscaledTileID(Y.overscaledZ,$t,ft.z,Ft,ft.y-1).key]={backfilled:!1}),ft.y+10&&(zt.resourceTiming=Y._resourceTiming,Y._resourceTiming=[]),Y.fire(new t.Event("data",zt))})},tt.prototype.onAdd=function(Y){this.map=Y,this.load()},tt.prototype.setData=function(Y){var ft=this;return this._data=Y,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(zt){if(zt){ft.fire(new t.ErrorEvent(zt));return}var Qt={dataType:"source",sourceDataType:"content"};ft._collectResourceTiming&&ft._resourceTiming&&ft._resourceTiming.length>0&&(Qt.resourceTiming=ft._resourceTiming,ft._resourceTiming=[]),ft.fire(new t.Event("data",Qt))}),this},tt.prototype.getClusterExpansionZoom=function(Y,ft){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:Y,source:this.id},ft),this},tt.prototype.getClusterChildren=function(Y,ft){return this.actor.send("geojson.getClusterChildren",{clusterId:Y,source:this.id},ft),this},tt.prototype.getClusterLeaves=function(Y,ft,zt,Qt){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:Y,limit:ft,offset:zt},Qt),this},tt.prototype._updateWorkerData=function(Y){var ft=this;this._loaded=!1;var zt=t.extend({},this.workerOptions),Qt=this._data;typeof Qt=="string"?(zt.request=this.map._requestManager.transformRequest(t.browser.resolveURL(Qt),t.ResourceType.Source),zt.request.collectResourceTiming=this._collectResourceTiming):zt.data=JSON.stringify(Qt),this.actor.send(this.type+".loadData",zt,function(ne,Ft){ft._removed||Ft&&Ft.abandoned||(ft._loaded=!0,Ft&&Ft.resourceTiming&&Ft.resourceTiming[ft.id]&&(ft._resourceTiming=Ft.resourceTiming[ft.id].slice(0)),ft.actor.send(ft.type+".coalesce",{source:zt.source},null),Y(ne))})},tt.prototype.loaded=function(){return this._loaded},tt.prototype.loadTile=function(Y,ft){var zt=this,Qt=Y.actor?"reloadTile":"loadTile";Y.actor=this.actor;var ne={type:this.type,uid:Y.uid,tileID:Y.tileID,zoom:Y.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};Y.request=this.actor.send(Qt,ne,function(Ft,$t){return delete Y.request,Y.unloadVectorData(),Y.aborted?ft(null):Ft?ft(Ft):(Y.loadVectorData($t,zt.map.painter,Qt==="reloadTile"),ft(null))})},tt.prototype.abortTile=function(Y){Y.request&&(Y.request.cancel(),delete Y.request),Y.aborted=!0},tt.prototype.unloadTile=function(Y){Y.unloadVectorData(),this.actor.send("removeTile",{uid:Y.uid,type:this.type,source:this.id})},tt.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},tt.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},tt.prototype.hasTransition=function(){return!1},tt})(t.Evented),ct=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),st=(function(U){function tt(Y,ft,zt,Qt){U.call(this),this.id=Y,this.dispatcher=zt,this.coordinates=ft.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(Qt),this.options=ft}return U&&(tt.__proto__=U),tt.prototype=Object.create(U&&U.prototype),tt.prototype.constructor=tt,tt.prototype.load=function(Y,ft){var zt=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),function(Qt,ne){zt._loaded=!0,Qt?zt.fire(new t.ErrorEvent(Qt)):ne&&(zt.image=ne,Y&&(zt.coordinates=Y),ft&&ft(),zt._finishLoading())})},tt.prototype.loaded=function(){return this._loaded},tt.prototype.updateImage=function(Y){var ft=this;return!this.image||!Y.url?this:(this.options.url=Y.url,this.load(Y.coordinates,function(){ft.texture=null}),this)},tt.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},tt.prototype.onAdd=function(Y){this.map=Y,this.load()},tt.prototype.setCoordinates=function(Y){var ft=this;this.coordinates=Y;var zt=Y.map(t.MercatorCoordinate.fromLngLat);this.tileID=et(zt),this.minzoom=this.maxzoom=this.tileID.z;var Qt=zt.map(function(ne){return ft.tileID.getTilePoint(ne)._round()});return this._boundsArray=new t.StructArrayLayout4i8,this._boundsArray.emplaceBack(Qt[0].x,Qt[0].y,0,0),this._boundsArray.emplaceBack(Qt[1].x,Qt[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(Qt[3].x,Qt[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(Qt[2].x,Qt[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this},tt.prototype.prepare=function(){if(!(Object.keys(this.tiles).length===0||!this.image)){var Y=this.map.painter.context,ft=Y.gl;this.boundsBuffer||(this.boundsBuffer=Y.createVertexBuffer(this._boundsArray,ct.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new t.Texture(Y,this.image,ft.RGBA),this.texture.bind(ft.LINEAR,ft.CLAMP_TO_EDGE));for(var zt in this.tiles){var Qt=this.tiles[zt];Qt.state!=="loaded"&&(Qt.state="loaded",Qt.texture=this.texture)}}},tt.prototype.loadTile=function(Y,ft){this.tileID&&this.tileID.equals(Y.tileID.canonical)?(this.tiles[String(Y.tileID.wrap)]=Y,Y.buckets={},ft(null)):(Y.state="errored",ft(null))},tt.prototype.serialize=function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}},tt.prototype.hasTransition=function(){return!1},tt})(t.Evented);function et(U){for(var tt=1/0,Y=1/0,ft=-1/0,zt=-1/0,Qt=0,ne=U;Qtft.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+ft.start(0)+" and "+ft.end(0)+"-second mark."))):this.video.currentTime=Y}},tt.prototype.getVideo=function(){return this.video},tt.prototype.onAdd=function(Y){this.map||(this.map=Y,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},tt.prototype.prepare=function(){if(!(Object.keys(this.tiles).length===0||this.video.readyState<2)){var Y=this.map.painter.context,ft=Y.gl;this.boundsBuffer||(this.boundsBuffer=Y.createVertexBuffer(this._boundsArray,ct.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(ft.LINEAR,ft.CLAMP_TO_EDGE),ft.texSubImage2D(ft.TEXTURE_2D,0,0,0,ft.RGBA,ft.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(Y,this.video,ft.RGBA),this.texture.bind(ft.LINEAR,ft.CLAMP_TO_EDGE));for(var zt in this.tiles){var Qt=this.tiles[zt];Qt.state!=="loaded"&&(Qt.state="loaded",Qt.texture=this.texture)}}},tt.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},tt.prototype.hasTransition=function(){return this.video&&!this.video.paused},tt})(st),ot=(function(U){function tt(Y,ft,zt,Qt){U.call(this,Y,ft,zt,Qt),ft.coordinates?(!Array.isArray(ft.coordinates)||ft.coordinates.length!==4||ft.coordinates.some(function(ne){return!Array.isArray(ne)||ne.length!==2||ne.some(function(Ft){return typeof Ft!="number"})}))&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+Y,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+Y,null,'missing required property "coordinates"'))),ft.animate&&typeof ft.animate!="boolean"&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+Y,null,'optional "animate" property must be a boolean value'))),ft.canvas?typeof ft.canvas!="string"&&!(ft.canvas instanceof t.window.HTMLCanvasElement)&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+Y,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+Y,null,'missing required property "canvas"'))),this.options=ft,this.animate=ft.animate!==void 0?ft.animate:!0}return U&&(tt.__proto__=U),tt.prototype=Object.create(U&&U.prototype),tt.prototype.constructor=tt,tt.prototype.load=function(){if(this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()){this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero.")));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading()},tt.prototype.getCanvas=function(){return this.canvas},tt.prototype.onAdd=function(Y){this.map=Y,this.load(),this.canvas&&this.animate&&this.play()},tt.prototype.onRemove=function(){this.pause()},tt.prototype.prepare=function(){var Y=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,Y=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,Y=!0),!this._hasInvalidDimensions()&&Object.keys(this.tiles).length!==0){var ft=this.map.painter.context,zt=ft.gl;this.boundsBuffer||(this.boundsBuffer=ft.createVertexBuffer(this._boundsArray,ct.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(Y||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(ft,this.canvas,zt.RGBA,{premultiply:!0});for(var Qt in this.tiles){var ne=this.tiles[Qt];ne.state!=="loaded"&&(ne.state="loaded",ne.texture=this.texture)}}},tt.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},tt.prototype.hasTransition=function(){return this._playing},tt.prototype._hasInvalidDimensions=function(){for(var Y=0,ft=[this.canvas.width,this.canvas.height];Ythis.max){var ne=this._getAndRemoveByKey(this.order[0]);ne&&this.onRemove(ne)}return this},It.prototype.has=function(U){return U.wrapped().key in this.data},It.prototype.getAndRemove=function(U){return this.has(U)?this._getAndRemoveByKey(U.wrapped().key):null},It.prototype._getAndRemoveByKey=function(U){var tt=this.data[U].shift();return tt.timeout&&clearTimeout(tt.timeout),this.data[U].length===0&&delete this.data[U],this.order.splice(this.order.indexOf(U),1),tt.value},It.prototype.getByKey=function(U){var tt=this.data[U];return tt?tt[0].value:null},It.prototype.get=function(U){if(!this.has(U))return null;var tt=this.data[U.wrapped().key][0];return tt.value},It.prototype.remove=function(U,tt){if(!this.has(U))return this;var Y=U.wrapped().key,ft=tt===void 0?0:this.data[Y].indexOf(tt),zt=this.data[Y][ft];return this.data[Y].splice(ft,1),zt.timeout&&clearTimeout(zt.timeout),this.data[Y].length===0&&delete this.data[Y],this.onRemove(zt.value),this.order.splice(this.order.indexOf(Y),1),this},It.prototype.setMaxSize=function(U){for(this.max=U;this.order.length>this.max;){var tt=this._getAndRemoveByKey(this.order[0]);tt&&this.onRemove(tt)}return this},It.prototype.filter=function(U){var tt=[];for(var Y in this.data)for(var ft=0,zt=this.data[Y];ft1||(Math.abs(Ne)>1&&(Math.abs(Ne+Fe)===1?Ne+=Fe:Math.abs(Ne-Fe)===1&&(Ne-=Fe)),!(!he.dem||!$t.dem)&&($t.dem.backfillBorder(he.dem,Ne,Ie),$t.neighboringTiles&&$t.neighboringTiles[He]&&($t.neighboringTiles[He].backfilled=!0)))}},tt.prototype.getTile=function(Y){return this.getTileByID(Y.key)},tt.prototype.getTileByID=function(Y){return this._tiles[Y]},tt.prototype._retainLoadedChildren=function(Y,ft,zt,Qt){for(var ne in this._tiles){var Ft=this._tiles[ne];if(!(Qt[ne]||!Ft.hasData()||Ft.tileID.overscaledZ<=ft||Ft.tileID.overscaledZ>zt)){for(var $t=Ft.tileID;Ft&&Ft.tileID.overscaledZ>ft+1;){var he=Ft.tileID.scaledTo(Ft.tileID.overscaledZ-1);Ft=this._tiles[he.key],Ft&&Ft.hasData()&&($t=he)}for(var Ne=$t;Ne.overscaledZ>ft;)if(Ne=Ne.scaledTo(Ne.overscaledZ-1),Y[Ne.key]){Qt[$t.key]=$t;break}}}},tt.prototype.findLoadedParent=function(Y,ft){if(Y.key in this._loadedParentTiles){var zt=this._loadedParentTiles[Y.key];return zt&&zt.tileID.overscaledZ>=ft?zt:null}for(var Qt=Y.overscaledZ-1;Qt>=ft;Qt--){var ne=Y.scaledTo(Qt),Ft=this._getLoadedTile(ne);if(Ft)return Ft}},tt.prototype._getLoadedTile=function(Y){var ft=this._tiles[Y.key];if(ft&&ft.hasData())return ft;var zt=this._cache.getByKey(Y.wrapped().key);return zt},tt.prototype.updateCacheSize=function(Y){var ft=Math.ceil(Y.width/this._source.tileSize)+1,zt=Math.ceil(Y.height/this._source.tileSize)+1,Qt=ft*zt,ne=5,Ft=Math.floor(Qt*ne),$t=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,Ft):Ft;this._cache.setMaxSize($t)},tt.prototype.handleWrapJump=function(Y){var ft=this._prevLng===void 0?Y:this._prevLng,zt=Y-ft,Qt=zt/360,ne=Math.round(Qt);if(this._prevLng=Y,ne){var Ft={};for(var $t in this._tiles){var he=this._tiles[$t];he.tileID=he.tileID.unwrapTo(he.tileID.wrap+ne),Ft[he.tileID.key]=he}this._tiles=Ft;for(var Ne in this._timers)clearTimeout(this._timers[Ne]),delete this._timers[Ne];for(var Ie in this._tiles){var Fe=this._tiles[Ie];this._setTileReloadTimer(Ie,Fe)}}},tt.prototype.update=function(Y){var ft=this;if(this.transform=Y,!(!this._sourceLoaded||this._paused)){this.updateCacheSize(Y),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={};var zt;this.used?this._source.tileID?zt=Y.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(Dn){return new t.OverscaledTileID(Dn.canonical.z,Dn.wrap,Dn.canonical.z,Dn.canonical.x,Dn.canonical.y)}):(zt=Y.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(zt=zt.filter(function(Dn){return ft._source.hasTile(Dn)}))):zt=[];var Qt=Y.coveringZoomLevel(this._source),ne=Math.max(Qt-tt.maxOverzooming,this._source.minzoom),Ft=Math.max(Qt+tt.maxUnderzooming,this._source.minzoom),$t=this._updateRetainedTiles(zt,Qt);if(In(this._source.type)){for(var he={},Ne={},Ie=Object.keys($t),Fe=0,He=Ie;Fethis._source.maxzoom){var Le=Ae.children(this._source.maxzoom)[0],ur=this.getTile(Le);if(ur&&ur.hasData()){zt[Le.key]=Le;continue}}else{var Dr=Ae.children(this._source.maxzoom);if(zt[Dr[0].key]&&zt[Dr[1].key]&&zt[Dr[2].key]&&zt[Dr[3].key])continue}for(var jr=Oe.wasRequested(),On=Ae.overscaledZ-1;On>=ne;--On){var Ln=Ae.scaledTo(On);if(Qt[Ln.key]||(Qt[Ln.key]=!0,Oe=this.getTile(Ln),!Oe&&jr&&(Oe=this._addTile(Ln)),Oe&&(zt[Ln.key]=Ln,jr=Oe.wasRequested(),Oe.hasData())))break}}}return zt},tt.prototype._updateLoadedParentTileCache=function(){this._loadedParentTiles={};for(var Y in this._tiles){for(var ft=[],zt=void 0,Qt=this._tiles[Y].tileID;Qt.overscaledZ>0;){if(Qt.key in this._loadedParentTiles){zt=this._loadedParentTiles[Qt.key];break}ft.push(Qt.key);var ne=Qt.scaledTo(Qt.overscaledZ-1);if(zt=this._getLoadedTile(ne),zt)break;Qt=ne}for(var Ft=0,$t=ft;Ft<$t.length;Ft+=1){var he=$t[Ft];this._loadedParentTiles[he]=zt}}},tt.prototype._addTile=function(Y){var ft=this._tiles[Y.key];if(ft)return ft;ft=this._cache.getAndRemove(Y),ft&&(this._setTileReloadTimer(Y.key,ft),ft.tileID=Y,this._state.initializeTileState(ft,this.map?this.map.painter:null),this._cacheTimers[Y.key]&&(clearTimeout(this._cacheTimers[Y.key]),delete this._cacheTimers[Y.key],this._setTileReloadTimer(Y.key,ft)));var zt=!!ft;return zt||(ft=new t.Tile(Y,this._source.tileSize*Y.overscaleFactor()),this._loadTile(ft,this._tileLoaded.bind(this,ft,Y.key,ft.state))),ft?(ft.uses++,this._tiles[Y.key]=ft,zt||this._source.fire(new t.Event("dataloading",{tile:ft,coord:ft.tileID,dataType:"source"})),ft):null},tt.prototype._setTileReloadTimer=function(Y,ft){var zt=this;Y in this._timers&&(clearTimeout(this._timers[Y]),delete this._timers[Y]);var Qt=ft.getExpiryTimeout();Qt&&(this._timers[Y]=setTimeout(function(){zt._reloadTile(Y,"expired"),delete zt._timers[Y]},Qt))},tt.prototype._removeTile=function(Y){var ft=this._tiles[Y];ft&&(ft.uses--,delete this._tiles[Y],this._timers[Y]&&(clearTimeout(this._timers[Y]),delete this._timers[Y]),!(ft.uses>0)&&(ft.hasData()&&ft.state!=="reloading"?this._cache.add(ft.tileID,ft,ft.getExpiryTimeout()):(ft.aborted=!0,this._abortTile(ft),this._unloadTile(ft))))},tt.prototype.clearTiles=function(){this._shouldReloadOnResume=!1,this._paused=!1;for(var Y in this._tiles)this._removeTile(Y);this._cache.reset()},tt.prototype.tilesIn=function(Y,ft,zt){var Qt=this,ne=[],Ft=this.transform;if(!Ft)return ne;for(var $t=zt?Ft.getCameraQueryGeometry(Y):Y,he=Y.map(function(On){return Ft.pointCoordinate(On)}),Ne=$t.map(function(On){return Ft.pointCoordinate(On)}),Ie=this.getIds(),Fe=1/0,He=1/0,Ge=-1/0,Ae=-1/0,Oe=0,Le=Ne;Oe=0&&la[1].y+Dn>=0){var qn=he.map(function(ma){return xn.getTilePoint(ma)}),Gn=Ne.map(function(ma){return xn.getTilePoint(ma)});ne.push({tile:Ln,tileID:xn,queryGeometry:qn,cameraQueryGeometry:Gn,scale:Wn})}}},jr=0;jr=t.browser.now())return!0}return!1},tt.prototype.setFeatureState=function(Y,ft,zt){Y=Y||"_geojsonTileLayer",this._state.updateState(Y,ft,zt)},tt.prototype.removeFeatureState=function(Y,ft,zt){Y=Y||"_geojsonTileLayer",this._state.removeFeatureState(Y,ft,zt)},tt.prototype.getFeatureState=function(Y,ft){return Y=Y||"_geojsonTileLayer",this._state.getState(Y,ft)},tt.prototype.setDependencies=function(Y,ft,zt){var Qt=this._tiles[Y];Qt&&Qt.setDependencies(ft,zt)},tt.prototype.reloadTilesForDependencies=function(Y,ft){for(var zt in this._tiles){var Qt=this._tiles[zt];Qt.hasDependency(Y,ft)&&this._reloadTile(zt,"reloading")}this._cache.filter(function(ne){return!ne.hasDependency(Y,ft)})},tt})(t.Evented);Yr.maxOverzooming=10,Yr.maxUnderzooming=3;function $r(U,tt){var Y=Math.abs(U.wrap*2)-+(U.wrap<0),ft=Math.abs(tt.wrap*2)-+(tt.wrap<0);return U.overscaledZ-tt.overscaledZ||ft-Y||tt.canonical.y-U.canonical.y||tt.canonical.x-U.canonical.x}function In(U){return U==="raster"||U==="image"||U==="video"}function Nn(){return new t.window.Worker($o.workerUrl)}var Kn="mapboxgl_preloaded_worker_pool",$n=function(){this.active={}};$n.prototype.acquire=function(U){if(!this.workers)for(this.workers=[];this.workers.length<$n.workerCount;)this.workers.push(new Nn);return this.active[U]=!0,this.workers.slice()},$n.prototype.release=function(U){delete this.active[U],this.numActive()===0&&(this.workers.forEach(function(tt){tt.terminate()}),this.workers=null)},$n.prototype.isPreloaded=function(){return!!this.active[Kn]},$n.prototype.numActive=function(){return Object.keys(this.active).length};var ia=Math.floor(t.browser.hardwareConcurrency/2);$n.workerCount=Math.max(Math.min(ia,6),1);var Cn;function Fa(){return Cn||(Cn=new $n),Cn}function Ga(){var U=Fa();U.acquire(Kn)}function ve(){var U=Cn;U&&(U.isPreloaded()&&U.numActive()===1?(U.release(Kn),Cn=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))}function ge(U,tt){var Y={};for(var ft in U)ft!=="ref"&&(Y[ft]=U[ft]);return t.refProperties.forEach(function(zt){zt in tt&&(Y[zt]=tt[zt])}),Y}function dr(U){U=U.slice();for(var tt=Object.create(null),Y=0;Y0?(ft-Qt)/ne:0;return this.points[zt].mult(1-Ft).add(this.points[tt].mult(Ft))};var Qr=function(U,tt,Y){var ft=this.boxCells=[],zt=this.circleCells=[];this.xCellCount=Math.ceil(U/Y),this.yCellCount=Math.ceil(tt/Y);for(var Qt=0;Qtthis.width||ft<0||tt>this.height)return zt?!1:[];var ne=[];if(U<=0&&tt<=0&&this.width<=Y&&this.height<=ft){if(zt)return!0;for(var Ft=0;Ft0:ne}},Qr.prototype._queryCircle=function(U,tt,Y,ft,zt){var Qt=U-Y,ne=U+Y,Ft=tt-Y,$t=tt+Y;if(ne<0||Qt>this.width||$t<0||Ft>this.height)return ft?!1:[];var he=[],Ne={hitTest:ft,circle:{x:U,y:tt,radius:Y},seenUids:{box:{},circle:{}}};return this._forEachCell(Qt,Ft,ne,$t,this._queryCellCircle,he,Ne,zt),ft?he.length>0:he},Qr.prototype.query=function(U,tt,Y,ft,zt){return this._query(U,tt,Y,ft,!1,zt)},Qr.prototype.hitTest=function(U,tt,Y,ft,zt){return this._query(U,tt,Y,ft,!0,zt)},Qr.prototype.hitTestCircle=function(U,tt,Y,ft){return this._queryCircle(U,tt,Y,!0,ft)},Qr.prototype._queryCell=function(U,tt,Y,ft,zt,Qt,ne,Ft){var $t=ne.seenUids,he=this.boxCells[zt];if(he!==null)for(var Ne=this.bboxes,Ie=0,Fe=he;Ie=Ne[Ge+0]&&ft>=Ne[Ge+1]&&(!Ft||Ft(this.boxKeys[He]))){if(ne.hitTest)return Qt.push(!0),!0;Qt.push({key:this.boxKeys[He],x1:Ne[Ge],y1:Ne[Ge+1],x2:Ne[Ge+2],y2:Ne[Ge+3]})}}}var Ae=this.circleCells[zt];if(Ae!==null)for(var Oe=this.circles,Le=0,ur=Ae;Lene*ne+Ft*Ft},Qr.prototype._circleAndRectCollide=function(U,tt,Y,ft,zt,Qt,ne){var Ft=(Qt-ft)/2,$t=Math.abs(U-(ft+Ft));if($t>Ft+Y)return!1;var he=(ne-zt)/2,Ne=Math.abs(tt-(zt+he));if(Ne>he+Y)return!1;if($t<=Ft||Ne<=he)return!0;var Ie=$t-Ft,Fe=Ne-he;return Ie*Ie+Fe*Fe<=Y*Y};function vn(U,tt,Y,ft,zt){var Qt=t.create();return tt?(t.scale(Qt,Qt,[1/zt,1/zt,1]),Y||t.rotateZ(Qt,Qt,ft.angle)):t.multiply(Qt,ft.labelPlaneMatrix,U),Qt}function Oa(U,tt,Y,ft,zt){if(tt){var Qt=t.clone(U);return t.scale(Qt,Qt,[zt,zt,1]),Y||t.rotateZ(Qt,Qt,-ft.angle),Qt}else return ft.glCoordMatrix}function Qn(U,tt){var Y=[U.x,U.y,0,1];zo(Y,Y,tt);var ft=Y[3];return{point:new t.Point(Y[0]/ft,Y[1]/ft),signedDistanceFromCamera:ft}}function Qa(U,tt){return .5+.5*(U/tt)}function Ja(U,tt){var Y=U[0]/U[3],ft=U[1]/U[3],zt=Y>=-tt[0]&&Y<=tt[0]&&ft>=-tt[1]&&ft<=tt[1];return zt}function wi(U,tt,Y,ft,zt,Qt,ne,Ft){var $t=ft?U.textSizeData:U.iconSizeData,he=t.evaluateSizeForZoom($t,Y.transform.zoom),Ne=[256/Y.width*2+1,256/Y.height*2+1],Ie=ft?U.text.dynamicLayoutVertexArray:U.icon.dynamicLayoutVertexArray;Ie.clear();for(var Fe=U.lineVertexArray,He=ft?U.text.placedSymbolArray:U.icon.placedSymbolArray,Ge=Y.transform.width/Y.transform.height,Ae=!1,Oe=0;OeQt)return{useVertical:!0}}return(U===t.WritingMode.vertical?tt.yY.x)?{needsFlipping:!0}:null}function Ra(U,tt,Y,ft,zt,Qt,ne,Ft,$t,he,Ne,Ie,Fe,He){var Ge=tt/24,Ae=U.lineOffsetX*Ge,Oe=U.lineOffsetY*Ge,Le;if(U.numGlyphs>1){var ur=U.glyphStartIndex+U.numGlyphs,Dr=U.lineStartIndex,jr=U.lineStartIndex+U.lineLength,On=ci(Ge,Ft,Ae,Oe,Y,Ne,Ie,U,$t,Qt,Fe);if(!On)return{notEnoughRoom:!0};var Ln=Qn(On.first.point,ne).point,xn=Qn(On.last.point,ne).point;if(ft&&!Y){var Wn=Ti(U.writingMode,Ln,xn,He);if(Wn)return Wn}Le=[On.first];for(var Dn=U.glyphStartIndex+1;Dn0?ma.point:Qi(Ie,Gn,la,1,zt),si=Ti(U.writingMode,la,ti,He);if(si)return si}var Li=Hi(Ge*Ft.getoffsetX(U.glyphStartIndex),Ae,Oe,Y,Ne,Ie,U.segment,U.lineStartIndex,U.lineStartIndex+U.lineLength,$t,Qt,Fe);if(!Li)return{notEnoughRoom:!0};Le=[Li]}for(var to=0,ls=Le;to0?1:-1,Ge=0;ft&&(He*=-1,Ge=Math.PI),He<0&&(Ge+=Math.PI);for(var Ae=He>0?Ft+ne:Ft+ne+1,Oe=zt,Le=zt,ur=0,Dr=0,jr=Math.abs(Fe),On=[];ur+Dr<=jr;){if(Ae+=He,Ae=$t)return null;if(Le=Oe,On.push(Oe),Oe=Ie[Ae],Oe===void 0){var Ln=new t.Point(he.getx(Ae),he.gety(Ae)),xn=Qn(Ln,Ne);if(xn.signedDistanceFromCamera>0)Oe=Ie[Ae]=xn.point;else{var Wn=Ae-He,Dn=ur===0?Qt:new t.Point(he.getx(Wn),he.gety(Wn));Oe=Qi(Dn,Ln,Le,jr-ur+1,Ne)}}ur+=Dr,Dr=Le.dist(Oe)}var la=(jr-ur)/Dr,qn=Oe.sub(Le),Gn=qn.mult(la)._add(Le);Gn._add(qn._unit()._perp()._mult(Y*He));var ma=Ge+Math.atan2(Oe.y-Le.y,Oe.x-Le.x);return On.push(Gn),{point:Gn,angle:ma,path:On}}var Ho=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ci(U,tt){for(var Y=0;Y=1;ls--)to.push(si.path[ls]);for(var ms=1;ms0){for(var mo=to[0].clone(),Xs=to[0].clone(),ec=1;ec=Gn.x&&Xs.x<=ma.x&&mo.y>=Gn.y&&Xs.y<=ma.y?Pl=[to]:Xs.xma.x||Xs.yma.y?Pl=[]:Pl=t.clipLine([to],Gn.x,Gn.y,ma.x,ma.y)}for(var Ac=0,uh=Pl;Ac=this.screenRightBoundary||ftthis.screenBottomBoundary},qo.prototype.isInsideGrid=function(U,tt,Y,ft){return Y>=0&&U=0&&tt0){var Dr;return this.prevPlacement&&this.prevPlacement.variableOffsets[Ie.crossTileID]&&this.prevPlacement.placements[Ie.crossTileID]&&this.prevPlacement.placements[Ie.crossTileID].text&&(Dr=this.prevPlacement.variableOffsets[Ie.crossTileID].anchor),this.variableOffsets[Ie.crossTileID]={textOffset:Ae,width:Y,height:ft,anchor:U,textBoxScale:zt,prevAnchor:Dr},this.markUsedJustification(Fe,U,Ie,He),Fe.allowVerticalPlacement&&(this.markUsedOrientation(Fe,He,Ie),this.placedOrientations[Ie.crossTileID]=He),{shift:Oe,placedGlyphBoxes:Le}}},_o.prototype.placeLayerBucketPart=function(U,tt,Y){var ft=this,zt=U.parameters,Qt=zt.bucket,ne=zt.layout,Ft=zt.posMatrix,$t=zt.textLabelPlaneMatrix,he=zt.labelToScreenMatrix,Ne=zt.textPixelRatio,Ie=zt.holdingForFade,Fe=zt.collisionBoxArray,He=zt.partiallyEvaluatedTextSize,Ge=zt.collisionGroup,Ae=ne.get("text-optional"),Oe=ne.get("icon-optional"),Le=ne.get("text-allow-overlap"),ur=ne.get("icon-allow-overlap"),Dr=ne.get("text-rotation-alignment")==="map",jr=ne.get("text-pitch-alignment")==="map",On=ne.get("icon-text-fit")!=="none",Ln=ne.get("symbol-z-order")==="viewport-y",xn=Le&&(ur||!Qt.hasIconData()||Oe),Wn=ur&&(Le||!Qt.hasTextData()||Ae);!Qt.collisionArrays&&Fe&&Qt.deserializeCollisionBoxes(Fe);var Dn=function(si,Li){if(!tt[si.crossTileID]){if(Ie){ft.placements[si.crossTileID]=new uo(!1,!1,!1);return}var to=!1,ls=!1,ms=!0,Ko=null,gs={box:null,offscreen:null},Pl={box:null,offscreen:null},mo=null,Xs=null,ec=null,Ac=0,uh=0,vh=0;Li.textFeatureIndex?Ac=Li.textFeatureIndex:si.useRuntimeCollisionCircles&&(Ac=si.featureIndex),Li.verticalTextFeatureIndex&&(uh=Li.verticalTextFeatureIndex);var Kf=Li.textBox;if(Kf){var Yf=function(rc){var tf=t.WritingMode.horizontal;if(Qt.allowVerticalPlacement&&!rc&&ft.prevPlacement){var Ol=ft.prevPlacement.placedOrientations[si.crossTileID];Ol&&(ft.placedOrientations[si.crossTileID]=Ol,tf=Ol,ft.markUsedOrientation(Qt,tf,si))}return tf},bh=function(rc,tf){if(Qt.allowVerticalPlacement&&si.numVerticalGlyphVertices>0&&Li.verticalTextBox)for(var Ol=0,Mp=Qt.writingModes;Ol0&&(Ef=Ef.filter(function(rc){return rc!==Xf.anchor}),Ef.unshift(Xf.anchor))}var xf=function(rc,tf,Ol){for(var Mp=rc.x2-rc.x1,Yp=rc.y2-rc.y1,D0=si.textBoxScale,Ul=On&&!ur?tf:null,Gh={box:[],offscreen:!1},F0=Le?Ef.length*2:Ef.length,Sp=0;Sp=Ef.length,Xp=ft.attemptAnchorPlacement(Th,rc,Mp,Yp,D0,Dr,jr,Ne,Ft,Ge,Jm,si,Qt,Ol,Ul);if(Xp&&(Gh=Xp.placedGlyphBoxes,Gh&&Gh.box&&Gh.box.length)){to=!0,Ko=Xp.shift;break}}return Gh},Ih=function(){return xf(Kf,Li.iconBox,t.WritingMode.horizontal)},ap=function(){var rc=Li.verticalTextBox,tf=gs&&gs.box&&gs.box.length;return Qt.allowVerticalPlacement&&!tf&&si.numVerticalGlyphVertices>0&&rc?xf(rc,Li.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}};bh(Ih,ap),gs&&(to=gs.box,ms=gs.offscreen);var $f=Yf(gs&&gs.box);if(!to&&ft.prevPlacement){var Jf=ft.prevPlacement.variableOffsets[si.crossTileID];Jf&&(ft.variableOffsets[si.crossTileID]=Jf,ft.markUsedJustification(Qt,Jf.anchor,si,$f))}}else{var zf=function(rc,tf){var Ol=ft.collisionIndex.placeCollisionBox(rc,Le,Ne,Ft,Ge.predicate);return Ol&&Ol.box&&Ol.box.length&&(ft.markUsedOrientation(Qt,tf,si),ft.placedOrientations[si.crossTileID]=tf),Ol},ip=function(){return zf(Kf,t.WritingMode.horizontal)},Tp=function(){var rc=Li.verticalTextBox;return Qt.allowVerticalPlacement&&si.numVerticalGlyphVertices>0&&rc?zf(rc,t.WritingMode.vertical):{box:null,offscreen:null}};bh(ip,Tp),Yf(gs&&gs.box&&gs.box.length)}}if(mo=gs,to=mo&&mo.box&&mo.box.length>0,ms=mo&&mo.offscreen,si.useRuntimeCollisionCircles){var op=Qt.text.placedSymbolArray.get(si.centerJustifiedTextSymbolIndex),Jc=t.evaluateSizeForFeature(Qt.textSizeData,He,op),Wh=ne.get("text-padding"),kp=si.collisionCircleDiameter;Xs=ft.collisionIndex.placeCollisionCircles(Le,op,Qt.lineVertexArray,Qt.glyphOffsetArray,Jc,Ft,$t,he,Y,jr,Ge.predicate,kp,Wh),to=Le||Xs.circles.length>0&&!Xs.collisionDetected,ms=ms&&Xs.offscreen}if(Li.iconFeatureIndex&&(vh=Li.iconFeatureIndex),Li.iconBox){var Qc=function(rc){var tf=On&&Ko?As(rc,Ko.x,Ko.y,Dr,jr,ft.transform.angle):rc;return ft.collisionIndex.placeCollisionBox(tf,ur,Ne,Ft,Ge.predicate)};Pl&&Pl.box&&Pl.box.length&&Li.verticalIconBox?(ec=Qc(Li.verticalIconBox),ls=ec.box.length>0):(ec=Qc(Li.iconBox),ls=ec.box.length>0),ms=ms&&ec.offscreen}var sp=Ae||si.numHorizontalGlyphVertices===0&&si.numVerticalGlyphVertices===0,Zp=Oe||si.numIconVertices===0;if(!sp&&!Zp?ls=to=ls&&to:Zp?sp||(ls=ls&&to):to=ls&&to,to&&mo&&mo.box&&(Pl&&Pl.box&&uh?ft.collisionIndex.insertCollisionBox(mo.box,ne.get("text-ignore-placement"),Qt.bucketInstanceId,uh,Ge.ID):ft.collisionIndex.insertCollisionBox(mo.box,ne.get("text-ignore-placement"),Qt.bucketInstanceId,Ac,Ge.ID)),ls&&ec&&ft.collisionIndex.insertCollisionBox(ec.box,ne.get("icon-ignore-placement"),Qt.bucketInstanceId,vh,Ge.ID),Xs&&(to&&ft.collisionIndex.insertCollisionCircles(Xs.circles,ne.get("text-ignore-placement"),Qt.bucketInstanceId,Ac,Ge.ID),Y)){var Kp=Qt.bucketInstanceId,wh=ft.collisionCircleArrays[Kp];wh===void 0&&(wh=ft.collisionCircleArrays[Kp]=new yi);for(var Ap=0;Ap=0;--qn){var Gn=la[qn];Dn(Qt.symbolInstances.get(Gn),Qt.collisionArrays[Gn])}else for(var ma=U.symbolInstanceStart;ma=0&&(Qt>=0&&he!==Qt?U.text.placedSymbolArray.get(he).crossTileID=0:U.text.placedSymbolArray.get(he).crossTileID=Y.crossTileID)}},_o.prototype.markUsedOrientation=function(U,tt,Y){for(var ft=tt===t.WritingMode.horizontal||tt===t.WritingMode.horizontalOnly?tt:0,zt=tt===t.WritingMode.vertical?tt:0,Qt=[Y.leftJustifiedTextSymbolIndex,Y.centerJustifiedTextSymbolIndex,Y.rightJustifiedTextSymbolIndex],ne=0,Ft=Qt;ne0||jr>0,Dn=ur.numIconVertices>0,la=ft.placedOrientations[ur.crossTileID],qn=la===t.WritingMode.vertical,Gn=la===t.WritingMode.horizontal||la===t.WritingMode.horizontalOnly;if(Wn){var ma=al(xn.text),ti=qn?ii:ma;He(U.text,Dr,ti);var si=Gn?ii:ma;He(U.text,jr,si);var Li=xn.text.isHidden();[ur.rightJustifiedTextSymbolIndex,ur.centerJustifiedTextSymbolIndex,ur.leftJustifiedTextSymbolIndex].forEach(function(vh){vh>=0&&(U.text.placedSymbolArray.get(vh).hidden=Li||qn?1:0)}),ur.verticalPlacedTextSymbolIndex>=0&&(U.text.placedSymbolArray.get(ur.verticalPlacedTextSymbolIndex).hidden=Li||Gn?1:0);var to=ft.variableOffsets[ur.crossTileID];to&&ft.markUsedJustification(U,to.anchor,ur,la);var ls=ft.placedOrientations[ur.crossTileID];ls&&(ft.markUsedJustification(U,"left",ur,ls),ft.markUsedOrientation(U,ls,ur))}if(Dn){var ms=al(xn.icon),Ko=!(Ie&&ur.verticalPlacedIconSymbolIndex&&qn);if(ur.placedIconSymbolIndex>=0){var gs=Ko?ms:ii;He(U.icon,ur.numIconVertices,gs),U.icon.placedSymbolArray.get(ur.placedIconSymbolIndex).hidden=xn.icon.isHidden()}if(ur.verticalPlacedIconSymbolIndex>=0){var Pl=Ko?ii:ms;He(U.icon,ur.numVerticalIconVertices,Pl),U.icon.placedSymbolArray.get(ur.verticalPlacedIconSymbolIndex).hidden=xn.icon.isHidden()}}if(U.hasIconCollisionBoxData()||U.hasTextCollisionBoxData()){var mo=U.collisionArrays[Le];if(mo){var Xs=new t.Point(0,0);if(mo.textBox||mo.verticalTextBox){var ec=!0;if($t){var Ac=ft.variableOffsets[On];Ac?(Xs=vs(Ac.anchor,Ac.width,Ac.height,Ac.textOffset,Ac.textBoxScale),he&&Xs._rotate(Ne?ft.transform.angle:-ft.transform.angle)):ec=!1}mo.textBox&&Da(U.textCollisionBox.collisionVertexArray,xn.text.placed,!ec||qn,Xs.x,Xs.y),mo.verticalTextBox&&Da(U.textCollisionBox.collisionVertexArray,xn.text.placed,!ec||Gn,Xs.x,Xs.y)}var uh=!!(!Gn&&mo.verticalIconBox);mo.iconBox&&Da(U.iconCollisionBox.collisionVertexArray,xn.icon.placed,uh,Ie?Xs.x:0,Ie?Xs.y:0),mo.verticalIconBox&&Da(U.iconCollisionBox.collisionVertexArray,xn.icon.placed,!uh,Ie?Xs.x:0,Ie?Xs.y:0)}}},Ae=0;AeU},_o.prototype.setStale=function(){this.stale=!0};function Da(U,tt,Y,ft,zt){U.emplaceBack(tt?1:0,Y?1:0,ft||0,zt||0),U.emplaceBack(tt?1:0,Y?1:0,ft||0,zt||0),U.emplaceBack(tt?1:0,Y?1:0,ft||0,zt||0),U.emplaceBack(tt?1:0,Y?1:0,ft||0,zt||0)}var li=Math.pow(2,25),wo=Math.pow(2,24),Ms=Math.pow(2,17),Di=Math.pow(2,16),_s=Math.pow(2,9),No=Math.pow(2,8),is=Math.pow(2,1);function al(U){if(U.opacity===0&&!U.placed)return 0;if(U.opacity===1&&U.placed)return 4294967295;var tt=U.placed?1:0,Y=Math.floor(U.opacity*127);return Y*li+tt*wo+Y*Ms+tt*Di+Y*_s+tt*No+Y*is+tt}var ii=0,io=function(U){this._sortAcrossTiles=U.layout.get("symbol-z-order")!=="viewport-y"&&U.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};io.prototype.continuePlacement=function(U,tt,Y,ft,zt){for(var Qt=this._bucketParts;this._currentTileIndex2};this._currentPlacementIndex>=0;){var ne=U[this._currentPlacementIndex],Ft=tt[ne],$t=this.placement.collisionIndex.transform.zoom;if(Ft.type==="symbol"&&(!Ft.minzoom||Ft.minzoom<=$t)&&(!Ft.maxzoom||Ft.maxzoom>$t)){this._inProgressLayer||(this._inProgressLayer=new io(Ft));var he=this._inProgressLayer.continuePlacement(Y[Ft.source],this.placement,this._showCollisionBoxes,Ft,Qt);if(he)return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},co.prototype.commit=function(U){return this.placement.commit(U),this.placement};var Is=512/t.EXTENT/2,Wo=function(U,tt,Y){this.tileID=U,this.indexedSymbolInstances={},this.bucketInstanceId=Y;for(var ft=0;ftU.overscaledZ)for(var $t in Ft){var he=Ft[$t];he.tileID.isChildOf(U)&&he.findMatches(tt.symbolInstances,U,Qt)}else{var Ne=U.scaledTo(Number(ne)),Ie=Ft[Ne.key];Ie&&Ie.findMatches(tt.symbolInstances,U,Qt)}}for(var Fe=0;Fe0)throw new Error("Unimplemented: "+Qt.map(function(ne){return ne.command}).join(", ")+".");return zt.forEach(function(ne){ne.command!=="setTransition"&&ft[ne.command].apply(ft,ne.args)}),this.stylesheet=Y,!0},tt.prototype.addImage=function(Y,ft){if(this.getImage(Y))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(Y,ft),this._afterImageUpdated(Y)},tt.prototype.updateImage=function(Y,ft){this.imageManager.updateImage(Y,ft)},tt.prototype.getImage=function(Y){return this.imageManager.getImage(Y)},tt.prototype.removeImage=function(Y){if(!this.getImage(Y))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(Y),this._afterImageUpdated(Y)},tt.prototype._afterImageUpdated=function(Y){this._availableImages=this.imageManager.listImages(),this._changedImages[Y]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))},tt.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},tt.prototype.addSource=function(Y,ft,zt){var Qt=this;if(zt===void 0&&(zt={}),this._checkLoaded(),this.sourceCaches[Y]!==void 0)throw new Error("There is already a source with this ID");if(!ft.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(ft).join(", ")+".");var ne=["vector","raster","geojson","video","image"],Ft=ne.indexOf(ft.type)>=0;if(!(Ft&&this._validate(t.validateStyle.source,"sources."+Y,ft,null,zt))){this.map&&this.map._collectResourceTiming&&(ft.collectResourceTiming=!0);var $t=this.sourceCaches[Y]=new Yr(Y,ft,this.dispatcher);$t.style=this,$t.setEventedParent(this,function(){return{isSourceLoaded:Qt.loaded(),source:$t.serialize(),sourceId:Y}}),$t.onAdd(this.map),this._changed=!0}},tt.prototype.removeSource=function(Y){if(this._checkLoaded(),this.sourceCaches[Y]===void 0)throw new Error("There is no source with this ID");for(var ft in this._layers)if(this._layers[ft].source===Y)return this.fire(new t.ErrorEvent(new Error('Source "'+Y+'" cannot be removed while layer "'+ft+'" is using it.')));var zt=this.sourceCaches[Y];delete this.sourceCaches[Y],delete this._updatedSources[Y],zt.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:Y})),zt.setEventedParent(null),zt.clearTiles(),zt.onRemove&&zt.onRemove(this.map),this._changed=!0},tt.prototype.setGeoJSONSourceData=function(Y,ft){this._checkLoaded();var zt=this.sourceCaches[Y].getSource();zt.setData(ft),this._changed=!0},tt.prototype.getSource=function(Y){return this.sourceCaches[Y]&&this.sourceCaches[Y].getSource()},tt.prototype.addLayer=function(Y,ft,zt){zt===void 0&&(zt={}),this._checkLoaded();var Qt=Y.id;if(this.getLayer(Qt)){this.fire(new t.ErrorEvent(new Error('Layer with id "'+Qt+'" already exists on this map')));return}var ne;if(Y.type==="custom"){if(Jo(this,t.validateCustomStyleLayer(Y)))return;ne=t.createStyleLayer(Y)}else{if(typeof Y.source=="object"&&(this.addSource(Qt,Y.source),Y=t.clone$1(Y),Y=t.extend(Y,{source:Qt})),this._validate(t.validateStyle.layer,"layers."+Qt,Y,{arrayIndex:-1},zt))return;ne=t.createStyleLayer(Y),this._validateLayer(ne),ne.setEventedParent(this,{layer:{id:Qt}}),this._serializedLayers[ne.id]=ne.serialize()}var Ft=ft?this._order.indexOf(ft):this._order.length;if(ft&&Ft===-1){this.fire(new t.ErrorEvent(new Error('Layer with id "'+ft+'" does not exist on this map.')));return}if(this._order.splice(Ft,0,Qt),this._layerOrderChanged=!0,this._layers[Qt]=ne,this._removedLayers[Qt]&&ne.source&&ne.type!=="custom"){var $t=this._removedLayers[Qt];delete this._removedLayers[Qt],$t.type!==ne.type?this._updatedSources[ne.source]="clear":(this._updatedSources[ne.source]="reload",this.sourceCaches[ne.source].pause())}this._updateLayer(ne),ne.onAdd&&ne.onAdd(this.map)},tt.prototype.moveLayer=function(Y,ft){this._checkLoaded(),this._changed=!0;var zt=this._layers[Y];if(!zt){this.fire(new t.ErrorEvent(new Error("The layer '"+Y+"' does not exist in the map's style and cannot be moved.")));return}if(Y!==ft){var Qt=this._order.indexOf(Y);this._order.splice(Qt,1);var ne=ft?this._order.indexOf(ft):this._order.length;if(ft&&ne===-1){this.fire(new t.ErrorEvent(new Error('Layer with id "'+ft+'" does not exist on this map.')));return}this._order.splice(ne,0,Y),this._layerOrderChanged=!0}},tt.prototype.removeLayer=function(Y){this._checkLoaded();var ft=this._layers[Y];if(!ft){this.fire(new t.ErrorEvent(new Error("The layer '"+Y+"' does not exist in the map's style and cannot be removed.")));return}ft.setEventedParent(null);var zt=this._order.indexOf(Y);this._order.splice(zt,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[Y]=ft,delete this._layers[Y],delete this._serializedLayers[Y],delete this._updatedLayers[Y],delete this._updatedPaintProps[Y],ft.onRemove&&ft.onRemove(this.map)},tt.prototype.getLayer=function(Y){return this._layers[Y]},tt.prototype.hasLayer=function(Y){return Y in this._layers},tt.prototype.setLayerZoomRange=function(Y,ft,zt){this._checkLoaded();var Qt=this.getLayer(Y);if(!Qt){this.fire(new t.ErrorEvent(new Error("The layer '"+Y+"' does not exist in the map's style and cannot have zoom extent.")));return}Qt.minzoom===ft&&Qt.maxzoom===zt||(ft!=null&&(Qt.minzoom=ft),zt!=null&&(Qt.maxzoom=zt),this._updateLayer(Qt))},tt.prototype.setFilter=function(Y,ft,zt){zt===void 0&&(zt={}),this._checkLoaded();var Qt=this.getLayer(Y);if(!Qt){this.fire(new t.ErrorEvent(new Error("The layer '"+Y+"' does not exist in the map's style and cannot be filtered.")));return}if(!t.deepEqual(Qt.filter,ft)){if(ft==null){Qt.filter=void 0,this._updateLayer(Qt);return}this._validate(t.validateStyle.filter,"layers."+Qt.id+".filter",ft,null,zt)||(Qt.filter=t.clone$1(ft),this._updateLayer(Qt))}},tt.prototype.getFilter=function(Y){return t.clone$1(this.getLayer(Y).filter)},tt.prototype.setLayoutProperty=function(Y,ft,zt,Qt){Qt===void 0&&(Qt={}),this._checkLoaded();var ne=this.getLayer(Y);if(!ne){this.fire(new t.ErrorEvent(new Error("The layer '"+Y+"' does not exist in the map's style and cannot be styled.")));return}t.deepEqual(ne.getLayoutProperty(ft),zt)||(ne.setLayoutProperty(ft,zt,Qt),this._updateLayer(ne))},tt.prototype.getLayoutProperty=function(Y,ft){var zt=this.getLayer(Y);if(!zt){this.fire(new t.ErrorEvent(new Error("The layer '"+Y+"' does not exist in the map's style.")));return}return zt.getLayoutProperty(ft)},tt.prototype.setPaintProperty=function(Y,ft,zt,Qt){Qt===void 0&&(Qt={}),this._checkLoaded();var ne=this.getLayer(Y);if(!ne){this.fire(new t.ErrorEvent(new Error("The layer '"+Y+"' does not exist in the map's style and cannot be styled.")));return}if(!t.deepEqual(ne.getPaintProperty(ft),zt)){var Ft=ne.setPaintProperty(ft,zt,Qt);Ft&&this._updateLayer(ne),this._changed=!0,this._updatedPaintProps[Y]=!0}},tt.prototype.getPaintProperty=function(Y,ft){return this.getLayer(Y).getPaintProperty(ft)},tt.prototype.setFeatureState=function(Y,ft){this._checkLoaded();var zt=Y.source,Qt=Y.sourceLayer,ne=this.sourceCaches[zt];if(ne===void 0){this.fire(new t.ErrorEvent(new Error("The source '"+zt+"' does not exist in the map's style.")));return}var Ft=ne.getSource().type;if(Ft==="geojson"&&Qt){this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(Ft==="vector"&&!Qt){this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));return}Y.id===void 0&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),ne.setFeatureState(Qt,Y.id,ft)},tt.prototype.removeFeatureState=function(Y,ft){this._checkLoaded();var zt=Y.source,Qt=this.sourceCaches[zt];if(Qt===void 0){this.fire(new t.ErrorEvent(new Error("The source '"+zt+"' does not exist in the map's style.")));return}var ne=Qt.getSource().type,Ft=ne==="vector"?Y.sourceLayer:void 0;if(ne==="vector"&&!Ft){this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(ft&&typeof Y.id!="string"&&typeof Y.id!="number"){this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));return}Qt.removeFeatureState(Ft,Y.id,ft)},tt.prototype.getFeatureState=function(Y){this._checkLoaded();var ft=Y.source,zt=Y.sourceLayer,Qt=this.sourceCaches[ft];if(Qt===void 0){this.fire(new t.ErrorEvent(new Error("The source '"+ft+"' does not exist in the map's style.")));return}var ne=Qt.getSource().type;if(ne==="vector"&&!zt){this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return Y.id===void 0&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),Qt.getFeatureState(zt,Y.id)},tt.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},tt.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,function(Y){return Y.serialize()}),layers:this._serializeLayers(this._order)},function(Y){return Y!==void 0})},tt.prototype._updateLayer=function(Y){this._updatedLayers[Y.id]=!0,Y.source&&!this._updatedSources[Y.source]&&this.sourceCaches[Y.source].getSource().type!=="raster"&&(this._updatedSources[Y.source]="reload",this.sourceCaches[Y.source].pause()),this._changed=!0},tt.prototype._flattenAndSortRenderedFeatures=function(Y){for(var ft=this,zt=function(Gn){return ft._layers[Gn].type==="fill-extrusion"},Qt={},ne=[],Ft=this._order.length-1;Ft>=0;Ft--){var $t=this._order[Ft];if(zt($t)){Qt[$t]=Ft;for(var he=0,Ne=Y;he=0;Le--){var ur=this._order[Le];if(zt(ur))for(var Dr=ne.length-1;Dr>=0;Dr--){var jr=ne[Dr].feature;if(Qt[jr.layer.id] 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`,wl=`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,Xc=`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 +? a_pos +: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`,Bc=`#ifdef GL_ES +precision highp float; +#endif +uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,gc="uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}",Gu=`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; +#define PI 3.141592653589793 +void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,Ic="uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}",Pc=`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,du=` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`,Rc=`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,Pu=` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`,wu=`uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,Tl=` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`,Qu=`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,Oc=` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`,Es=`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,bc="uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}",lf=`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,Nc=`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}`,vc=`#define SDF_PX 8.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,jc=`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`,Zl=`#define SDF_PX 8.0 +#define SDF 1.0 +#define ICON 0.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,Uc=`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`,rl=Vs(au,fu),Kl=Vs(zc,_c),Zu=Vs(cs,Gl),Bs=Vs(Lc,Al),Ou=Vs(_l,Ml),Rl=Vs(hu,Fs),Yl=Vs(bl,Fo),Ws=Vs(bs,Iu),ic=Vs(Nl,qu),Tu=Vs(qs,sf),Ku=Vs(Oo,yf),wc=Vs(os,Fi),uf=Vs(ac,pu),Sf=Vs(ml,Cc),oc=Vs(Wu,mc),Tc=Vs(wl,Xc),Fl=Vs(Bc,gc),sc=Vs(Gu,Ic),iu=Vs(Pc,du),lc=Vs(Rc,Pu),kc=Vs(wu,Tl),ku=Vs(Qu,Oc),Gs=Vs(Es,bc),Du=Vs(lf,Nc),Xl=Vs(vc,jc),$c=Vs(Zl,Uc);function Vs(U,tt){var Y=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,ft=tt.match(/attribute ([\w]+) ([\w]+)/g),zt=U.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),Qt=tt.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),ne=Qt?Qt.concat(zt):zt,Ft={};return U=U.replace(Y,function($t,he,Ne,Ie,Fe){return Ft[Fe]=!0,he==="define"?` +#ifndef HAS_UNIFORM_u_`+Fe+` +varying `+Ne+" "+Ie+" "+Fe+`; +#else +uniform `+Ne+" "+Ie+" u_"+Fe+`; +#endif +`:` +#ifdef HAS_UNIFORM_u_`+Fe+` + `+Ne+" "+Ie+" "+Fe+" = u_"+Fe+`; +#endif +`}),tt=tt.replace(Y,function($t,he,Ne,Ie,Fe){var He=Ie==="float"?"vec2":"vec4",Ge=Fe.match(/color/)?"color":He;return Ft[Fe]?he==="define"?` +#ifndef HAS_UNIFORM_u_`+Fe+` +uniform lowp float u_`+Fe+`_t; +attribute `+Ne+" "+He+" a_"+Fe+`; +varying `+Ne+" "+Ie+" "+Fe+`; +#else +uniform `+Ne+" "+Ie+" u_"+Fe+`; +#endif +`:Ge==="vec4"?` +#ifndef HAS_UNIFORM_u_`+Fe+` + `+Fe+" = a_"+Fe+`; +#else + `+Ne+" "+Ie+" "+Fe+" = u_"+Fe+`; +#endif +`:` +#ifndef HAS_UNIFORM_u_`+Fe+` + `+Fe+" = unpack_mix_"+Ge+"(a_"+Fe+", u_"+Fe+`_t); +#else + `+Ne+" "+Ie+" "+Fe+" = u_"+Fe+`; +#endif +`:he==="define"?` +#ifndef HAS_UNIFORM_u_`+Fe+` +uniform lowp float u_`+Fe+`_t; +attribute `+Ne+" "+He+" a_"+Fe+`; +#else +uniform `+Ne+" "+Ie+" u_"+Fe+`; +#endif +`:Ge==="vec4"?` +#ifndef HAS_UNIFORM_u_`+Fe+` + `+Ne+" "+Ie+" "+Fe+" = a_"+Fe+`; +#else + `+Ne+" "+Ie+" "+Fe+" = u_"+Fe+`; +#endif +`:` +#ifndef HAS_UNIFORM_u_`+Fe+` + `+Ne+" "+Ie+" "+Fe+" = unpack_mix_"+Ge+"(a_"+Fe+", u_"+Fe+`_t); +#else + `+Ne+" "+Ie+" "+Fe+" = u_"+Fe+`; +#endif +`}),{fragmentSource:U,vertexSource:tt,staticAttributes:ft,staticUniforms:ne}}var yc=Object.freeze({__proto__:null,prelude:rl,background:Kl,backgroundPattern:Zu,circle:Bs,clippingMask:Ou,heatmap:Rl,heatmapTexture:Yl,collisionBox:Ws,collisionCircle:ic,debug:Tu,fill:Ku,fillOutline:wc,fillOutlinePattern:uf,fillPattern:Sf,fillExtrusion:oc,fillExtrusionPattern:Tc,hillshadePrepare:Fl,hillshade:sc,line:iu,lineGradient:lc,linePattern:kc,lineSDF:ku,raster:Gs,symbolIcon:Du,symbolSDF:Xl,symbolTextAndIcon:$c}),Yu=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};Yu.prototype.bind=function(U,tt,Y,ft,zt,Qt,ne,Ft){this.context=U;for(var $t=this.boundPaintVertexBuffers.length!==ft.length,he=0;!$t&&he>16,Ft>>16],u_pixel_coord_lower:[ne&65535,Ft&65535]}}function xc(U,tt,Y,ft){var zt=Y.imageManager.getPattern(U.from.toString()),Qt=Y.imageManager.getPattern(U.to.toString()),ne=Y.imageManager.getPixelSize(),Ft=ne.width,$t=ne.height,he=Math.pow(2,ft.tileID.overscaledZ),Ne=ft.tileSize*Math.pow(2,Y.transform.tileZoom)/he,Ie=Ne*(ft.tileID.canonical.x+ft.tileID.wrap*he),Fe=Ne*ft.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:zt.tl,u_pattern_br_a:zt.br,u_pattern_tl_b:Qt.tl,u_pattern_br_b:Qt.br,u_texsize:[Ft,$t],u_mix:tt.t,u_pattern_size_a:zt.displaySize,u_pattern_size_b:Qt.displaySize,u_scale_a:tt.fromScale,u_scale_b:tt.toScale,u_tile_units_to_pixels:1/Po(ft,1,Y.transform.tileZoom),u_pixel_coord_upper:[Ie>>16,Fe>>16],u_pixel_coord_lower:[Ie&65535,Fe&65535]}}var cf=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_lightpos:new t.Uniform3f(U,tt.u_lightpos),u_lightintensity:new t.Uniform1f(U,tt.u_lightintensity),u_lightcolor:new t.Uniform3f(U,tt.u_lightcolor),u_vertical_gradient:new t.Uniform1f(U,tt.u_vertical_gradient),u_opacity:new t.Uniform1f(U,tt.u_opacity)}},zl=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_lightpos:new t.Uniform3f(U,tt.u_lightpos),u_lightintensity:new t.Uniform1f(U,tt.u_lightintensity),u_lightcolor:new t.Uniform3f(U,tt.u_lightcolor),u_vertical_gradient:new t.Uniform1f(U,tt.u_vertical_gradient),u_height_factor:new t.Uniform1f(U,tt.u_height_factor),u_image:new t.Uniform1i(U,tt.u_image),u_texsize:new t.Uniform2f(U,tt.u_texsize),u_pixel_coord_upper:new t.Uniform2f(U,tt.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(U,tt.u_pixel_coord_lower),u_scale:new t.Uniform3f(U,tt.u_scale),u_fade:new t.Uniform1f(U,tt.u_fade),u_opacity:new t.Uniform1f(U,tt.u_opacity)}},Vc=function(U,tt,Y,ft){var zt=tt.style.light,Qt=zt.properties.get("position"),ne=[Qt.x,Qt.y,Qt.z],Ft=t.create$1();zt.properties.get("anchor")==="viewport"&&t.fromRotation(Ft,-tt.transform.angle),t.transformMat3(ne,ne,Ft);var $t=zt.properties.get("color");return{u_matrix:U,u_lightpos:ne,u_lightintensity:zt.properties.get("intensity"),u_lightcolor:[$t.r,$t.g,$t.b],u_vertical_gradient:+Y,u_opacity:ft}},su=function(U,tt,Y,ft,zt,Qt,ne){return t.extend(Vc(U,tt,Y,ft),Xu(Qt,tt,ne),{u_height_factor:-Math.pow(2,zt.overscaledZ)/ne.tileSize/8})},Fu=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix)}},Au=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_image:new t.Uniform1i(U,tt.u_image),u_texsize:new t.Uniform2f(U,tt.u_texsize),u_pixel_coord_upper:new t.Uniform2f(U,tt.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(U,tt.u_pixel_coord_lower),u_scale:new t.Uniform3f(U,tt.u_scale),u_fade:new t.Uniform1f(U,tt.u_fade)}},il=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_world:new t.Uniform2f(U,tt.u_world)}},Cs=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_world:new t.Uniform2f(U,tt.u_world),u_image:new t.Uniform1i(U,tt.u_image),u_texsize:new t.Uniform2f(U,tt.u_texsize),u_pixel_coord_upper:new t.Uniform2f(U,tt.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(U,tt.u_pixel_coord_lower),u_scale:new t.Uniform3f(U,tt.u_scale),u_fade:new t.Uniform1f(U,tt.u_fade)}},Mu=function(U){return{u_matrix:U}},uc=function(U,tt,Y,ft){return t.extend(Mu(U),Xu(Y,tt,ft))},Su=function(U,tt){return{u_matrix:U,u_world:tt}},Dc=function(U,tt,Y,ft,zt){return t.extend(uc(U,tt,Y,ft),{u_world:zt})},Xe=function(U,tt){return{u_camera_to_center_distance:new t.Uniform1f(U,tt.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(U,tt.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(U,tt.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(U,tt.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(U,tt.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(U,tt.u_matrix)}},yr=function(U,tt,Y,ft){var zt=U.transform,Qt,ne;if(ft.paint.get("circle-pitch-alignment")==="map"){var Ft=Po(Y,1,zt.zoom);Qt=!0,ne=[Ft,Ft]}else Qt=!1,ne=zt.pixelsToGLUnits;return{u_camera_to_center_distance:zt.cameraToCenterDistance,u_scale_with_map:+(ft.paint.get("circle-pitch-scale")==="map"),u_matrix:U.translatePosMatrix(tt.posMatrix,Y,ft.paint.get("circle-translate"),ft.paint.get("circle-translate-anchor")),u_pitch_with_map:+Qt,u_device_pixel_ratio:t.browser.devicePixelRatio,u_extrude_scale:ne}},Kr=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_camera_to_center_distance:new t.Uniform1f(U,tt.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(U,tt.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(U,tt.u_extrude_scale),u_overscale_factor:new t.Uniform1f(U,tt.u_overscale_factor)}},Rr=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_inv_matrix:new t.UniformMatrix4f(U,tt.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(U,tt.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(U,tt.u_viewport_size)}},mn=function(U,tt,Y){var ft=Po(Y,1,tt.zoom),zt=Math.pow(2,tt.zoom-Y.tileID.overscaledZ),Qt=Y.tileID.overscaleFactor();return{u_matrix:U,u_camera_to_center_distance:tt.cameraToCenterDistance,u_pixels_to_tile_units:ft,u_extrude_scale:[tt.pixelsToGLUnits[0]/(ft*zt),tt.pixelsToGLUnits[1]/(ft*zt)],u_overscale_factor:Qt}},Pn=function(U,tt,Y){return{u_matrix:U,u_inv_matrix:tt,u_camera_to_center_distance:Y.cameraToCenterDistance,u_viewport_size:[Y.width,Y.height]}},ha=function(U,tt){return{u_color:new t.UniformColor(U,tt.u_color),u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_overlay:new t.Uniform1i(U,tt.u_overlay),u_overlay_scale:new t.Uniform1f(U,tt.u_overlay_scale)}},Ta=function(U,tt,Y){return Y===void 0&&(Y=1),{u_matrix:U,u_color:tt,u_overlay:0,u_overlay_scale:Y}},Ua=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix)}},Ya=function(U){return{u_matrix:U}},va=function(U,tt){return{u_extrude_scale:new t.Uniform1f(U,tt.u_extrude_scale),u_intensity:new t.Uniform1f(U,tt.u_intensity),u_matrix:new t.UniformMatrix4f(U,tt.u_matrix)}},Ba=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_world:new t.Uniform2f(U,tt.u_world),u_image:new t.Uniform1i(U,tt.u_image),u_color_ramp:new t.Uniform1i(U,tt.u_color_ramp),u_opacity:new t.Uniform1f(U,tt.u_opacity)}},za=function(U,tt,Y,ft){return{u_matrix:U,u_extrude_scale:Po(tt,1,Y),u_intensity:ft}},ca=function(U,tt,Y,ft){var zt=t.create();t.ortho(zt,0,U.width,U.height,0,0,1);var Qt=U.context.gl;return{u_matrix:zt,u_world:[Qt.drawingBufferWidth,Qt.drawingBufferHeight],u_image:Y,u_color_ramp:ft,u_opacity:tt.paint.get("heatmap-opacity")}},ei=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_image:new t.Uniform1i(U,tt.u_image),u_latrange:new t.Uniform2f(U,tt.u_latrange),u_light:new t.Uniform2f(U,tt.u_light),u_shadow:new t.UniformColor(U,tt.u_shadow),u_highlight:new t.UniformColor(U,tt.u_highlight),u_accent:new t.UniformColor(U,tt.u_accent)}},Vi=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_image:new t.Uniform1i(U,tt.u_image),u_dimension:new t.Uniform2f(U,tt.u_dimension),u_zoom:new t.Uniform1f(U,tt.u_zoom),u_unpack:new t.Uniform4f(U,tt.u_unpack)}},Oi=function(U,tt,Y){var ft=Y.paint.get("hillshade-shadow-color"),zt=Y.paint.get("hillshade-highlight-color"),Qt=Y.paint.get("hillshade-accent-color"),ne=Y.paint.get("hillshade-illumination-direction")*(Math.PI/180);Y.paint.get("hillshade-illumination-anchor")==="viewport"&&(ne-=U.transform.angle);var Ft=!U.options.moving;return{u_matrix:U.transform.calculatePosMatrix(tt.tileID.toUnwrapped(),Ft),u_image:0,u_latrange:Xi(U,tt.tileID),u_light:[Y.paint.get("hillshade-exaggeration"),ne],u_shadow:ft,u_highlight:zt,u_accent:Qt}},Wi=function(U,tt){var Y=tt.stride,ft=t.create();return t.ortho(ft,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(ft,ft,[0,-t.EXTENT,0]),{u_matrix:ft,u_image:1,u_dimension:[Y,Y],u_zoom:U.overscaledZ,u_unpack:tt.getUnpackVector()}};function Xi(U,tt){var Y=Math.pow(2,tt.canonical.z),ft=tt.canonical.y;return[new t.MercatorCoordinate(0,ft/Y).toLngLat().lat,new t.MercatorCoordinate(0,(ft+1)/Y).toLngLat().lat]}var ni=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_ratio:new t.Uniform1f(U,tt.u_ratio),u_device_pixel_ratio:new t.Uniform1f(U,tt.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(U,tt.u_units_to_pixels)}},Za=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_ratio:new t.Uniform1f(U,tt.u_ratio),u_device_pixel_ratio:new t.Uniform1f(U,tt.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(U,tt.u_units_to_pixels),u_image:new t.Uniform1i(U,tt.u_image),u_image_height:new t.Uniform1f(U,tt.u_image_height)}},$i=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_texsize:new t.Uniform2f(U,tt.u_texsize),u_ratio:new t.Uniform1f(U,tt.u_ratio),u_device_pixel_ratio:new t.Uniform1f(U,tt.u_device_pixel_ratio),u_image:new t.Uniform1i(U,tt.u_image),u_units_to_pixels:new t.Uniform2f(U,tt.u_units_to_pixels),u_scale:new t.Uniform3f(U,tt.u_scale),u_fade:new t.Uniform1f(U,tt.u_fade)}},Do=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_ratio:new t.Uniform1f(U,tt.u_ratio),u_device_pixel_ratio:new t.Uniform1f(U,tt.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(U,tt.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(U,tt.u_patternscale_a),u_patternscale_b:new t.Uniform2f(U,tt.u_patternscale_b),u_sdfgamma:new t.Uniform1f(U,tt.u_sdfgamma),u_image:new t.Uniform1i(U,tt.u_image),u_tex_y_a:new t.Uniform1f(U,tt.u_tex_y_a),u_tex_y_b:new t.Uniform1f(U,tt.u_tex_y_b),u_mix:new t.Uniform1f(U,tt.u_mix)}},ss=function(U,tt,Y){var ft=U.transform;return{u_matrix:ll(U,tt,Y),u_ratio:1/Po(tt,1,ft.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_units_to_pixels:[1/ft.pixelsToGLUnits[0],1/ft.pixelsToGLUnits[1]]}},Ps=function(U,tt,Y,ft){return t.extend(ss(U,tt,Y),{u_image:0,u_image_height:ft})},ys=function(U,tt,Y,ft){var zt=U.transform,Qt=Yo(tt,zt);return{u_matrix:ll(U,tt,Y),u_texsize:tt.imageAtlasTexture.size,u_ratio:1/Po(tt,1,zt.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_image:0,u_scale:[Qt,ft.fromScale,ft.toScale],u_fade:ft.t,u_units_to_pixels:[1/zt.pixelsToGLUnits[0],1/zt.pixelsToGLUnits[1]]}},Os=function(U,tt,Y,ft,zt){var Qt=U.transform,ne=U.lineAtlas,Ft=Yo(tt,Qt),$t=Y.layout.get("line-cap")==="round",he=ne.getDash(ft.from,$t),Ne=ne.getDash(ft.to,$t),Ie=he.width*zt.fromScale,Fe=Ne.width*zt.toScale;return t.extend(ss(U,tt,Y),{u_patternscale_a:[Ft/Ie,-he.height/2],u_patternscale_b:[Ft/Fe,-Ne.height/2],u_sdfgamma:ne.width/(Math.min(Ie,Fe)*256*t.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:he.y,u_tex_y_b:Ne.y,u_mix:zt.t})};function Yo(U,tt){return 1/Po(U,1,tt.tileZoom)}function ll(U,tt,Y){return U.translatePosMatrix(tt.tileID.posMatrix,tt,Y.paint.get("line-translate"),Y.paint.get("line-translate-anchor"))}var el=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_tl_parent:new t.Uniform2f(U,tt.u_tl_parent),u_scale_parent:new t.Uniform1f(U,tt.u_scale_parent),u_buffer_scale:new t.Uniform1f(U,tt.u_buffer_scale),u_fade_t:new t.Uniform1f(U,tt.u_fade_t),u_opacity:new t.Uniform1f(U,tt.u_opacity),u_image0:new t.Uniform1i(U,tt.u_image0),u_image1:new t.Uniform1i(U,tt.u_image1),u_brightness_low:new t.Uniform1f(U,tt.u_brightness_low),u_brightness_high:new t.Uniform1f(U,tt.u_brightness_high),u_saturation_factor:new t.Uniform1f(U,tt.u_saturation_factor),u_contrast_factor:new t.Uniform1f(U,tt.u_contrast_factor),u_spin_weights:new t.Uniform3f(U,tt.u_spin_weights)}},Rs=function(U,tt,Y,ft,zt){return{u_matrix:U,u_tl_parent:tt,u_scale_parent:Y,u_buffer_scale:1,u_fade_t:ft.mix,u_opacity:ft.opacity*zt.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:zt.paint.get("raster-brightness-min"),u_brightness_high:zt.paint.get("raster-brightness-max"),u_saturation_factor:ws(zt.paint.get("raster-saturation")),u_contrast_factor:so(zt.paint.get("raster-contrast")),u_spin_weights:bi(zt.paint.get("raster-hue-rotate"))}};function bi(U){U*=Math.PI/180;var tt=Math.sin(U),Y=Math.cos(U);return[(2*Y+1)/3,(-Math.sqrt(3)*tt-Y+1)/3,(Math.sqrt(3)*tt-Y+1)/3]}function so(U){return U>0?1/(1-U):1+U}function ws(U){return U>0?1-1/(1.001-U):-U}var fs=function(U,tt){return{u_is_size_zoom_constant:new t.Uniform1i(U,tt.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(U,tt.u_is_size_feature_constant),u_size_t:new t.Uniform1f(U,tt.u_size_t),u_size:new t.Uniform1f(U,tt.u_size),u_camera_to_center_distance:new t.Uniform1f(U,tt.u_camera_to_center_distance),u_pitch:new t.Uniform1f(U,tt.u_pitch),u_rotate_symbol:new t.Uniform1i(U,tt.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(U,tt.u_aspect_ratio),u_fade_change:new t.Uniform1f(U,tt.u_fade_change),u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(U,tt.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(U,tt.u_coord_matrix),u_is_text:new t.Uniform1i(U,tt.u_is_text),u_pitch_with_map:new t.Uniform1i(U,tt.u_pitch_with_map),u_texsize:new t.Uniform2f(U,tt.u_texsize),u_texture:new t.Uniform1i(U,tt.u_texture)}},Ll=function(U,tt){return{u_is_size_zoom_constant:new t.Uniform1i(U,tt.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(U,tt.u_is_size_feature_constant),u_size_t:new t.Uniform1f(U,tt.u_size_t),u_size:new t.Uniform1f(U,tt.u_size),u_camera_to_center_distance:new t.Uniform1f(U,tt.u_camera_to_center_distance),u_pitch:new t.Uniform1f(U,tt.u_pitch),u_rotate_symbol:new t.Uniform1i(U,tt.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(U,tt.u_aspect_ratio),u_fade_change:new t.Uniform1f(U,tt.u_fade_change),u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(U,tt.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(U,tt.u_coord_matrix),u_is_text:new t.Uniform1i(U,tt.u_is_text),u_pitch_with_map:new t.Uniform1i(U,tt.u_pitch_with_map),u_texsize:new t.Uniform2f(U,tt.u_texsize),u_texture:new t.Uniform1i(U,tt.u_texture),u_gamma_scale:new t.Uniform1f(U,tt.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(U,tt.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(U,tt.u_is_halo)}},$l=function(U,tt){return{u_is_size_zoom_constant:new t.Uniform1i(U,tt.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(U,tt.u_is_size_feature_constant),u_size_t:new t.Uniform1f(U,tt.u_size_t),u_size:new t.Uniform1f(U,tt.u_size),u_camera_to_center_distance:new t.Uniform1f(U,tt.u_camera_to_center_distance),u_pitch:new t.Uniform1f(U,tt.u_pitch),u_rotate_symbol:new t.Uniform1i(U,tt.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(U,tt.u_aspect_ratio),u_fade_change:new t.Uniform1f(U,tt.u_fade_change),u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(U,tt.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(U,tt.u_coord_matrix),u_is_text:new t.Uniform1i(U,tt.u_is_text),u_pitch_with_map:new t.Uniform1i(U,tt.u_pitch_with_map),u_texsize:new t.Uniform2f(U,tt.u_texsize),u_texsize_icon:new t.Uniform2f(U,tt.u_texsize_icon),u_texture:new t.Uniform1i(U,tt.u_texture),u_texture_icon:new t.Uniform1i(U,tt.u_texture_icon),u_gamma_scale:new t.Uniform1f(U,tt.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(U,tt.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(U,tt.u_is_halo)}},jl=function(U,tt,Y,ft,zt,Qt,ne,Ft,$t,he){var Ne=zt.transform;return{u_is_size_zoom_constant:+(U==="constant"||U==="source"),u_is_size_feature_constant:+(U==="constant"||U==="camera"),u_size_t:tt?tt.uSizeT:0,u_size:tt?tt.uSize:0,u_camera_to_center_distance:Ne.cameraToCenterDistance,u_pitch:Ne.pitch/360*2*Math.PI,u_rotate_symbol:+Y,u_aspect_ratio:Ne.width/Ne.height,u_fade_change:zt.options.fadeDuration?zt.symbolFadeChange:1,u_matrix:Qt,u_label_plane_matrix:ne,u_coord_matrix:Ft,u_is_text:+$t,u_pitch_with_map:+ft,u_texsize:he,u_texture:0}},Bu=function(U,tt,Y,ft,zt,Qt,ne,Ft,$t,he,Ne){var Ie=zt.transform;return t.extend(jl(U,tt,Y,ft,zt,Qt,ne,Ft,$t,he),{u_gamma_scale:ft?Math.cos(Ie._pitch)*Ie.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:1})},Jl=function(U,tt,Y,ft,zt,Qt,ne,Ft,$t,he){return t.extend(Bu(U,tt,Y,ft,zt,Qt,ne,Ft,!0,$t),{u_texsize_icon:he,u_texture_icon:1})},Ru=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_opacity:new t.Uniform1f(U,tt.u_opacity),u_color:new t.UniformColor(U,tt.u_color)}},nl=function(U,tt){return{u_matrix:new t.UniformMatrix4f(U,tt.u_matrix),u_opacity:new t.Uniform1f(U,tt.u_opacity),u_image:new t.Uniform1i(U,tt.u_image),u_pattern_tl_a:new t.Uniform2f(U,tt.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(U,tt.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(U,tt.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(U,tt.u_pattern_br_b),u_texsize:new t.Uniform2f(U,tt.u_texsize),u_mix:new t.Uniform1f(U,tt.u_mix),u_pattern_size_a:new t.Uniform2f(U,tt.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(U,tt.u_pattern_size_b),u_scale_a:new t.Uniform1f(U,tt.u_scale_a),u_scale_b:new t.Uniform1f(U,tt.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(U,tt.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(U,tt.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(U,tt.u_tile_units_to_pixels)}},Nu=function(U,tt,Y){return{u_matrix:U,u_opacity:tt,u_color:Y}},Ui=function(U,tt,Y,ft,zt,Qt){return t.extend(xc(ft,Qt,Y,zt),{u_matrix:U,u_opacity:tt})},fo={fillExtrusion:cf,fillExtrusionPattern:zl,fill:Fu,fillPattern:Au,fillOutline:il,fillOutlinePattern:Cs,circle:Xe,collisionBox:Kr,collisionCircle:Rr,debug:ha,clippingMask:Ua,heatmap:va,heatmapTexture:Ba,hillshade:ei,hillshadePrepare:Vi,line:ni,lineGradient:Za,linePattern:$i,lineSDF:Do,raster:el,symbolIcon:fs,symbolSDF:Ll,symbolTextAndIcon:$l,background:Ru,backgroundPattern:nl},Ql;function ul(U,tt,Y,ft,zt,Qt,ne){for(var Ft=U.context,$t=Ft.gl,he=U.useProgram("collisionBox"),Ne=[],Ie=0,Fe=0,He=0;He0){var jr=t.create(),On=Le;t.mul(jr,Oe.placementInvProjMatrix,U.transform.glCoordMatrix),t.mul(jr,jr,Oe.placementViewportMatrix),Ne.push({circleArray:Dr,circleOffset:Fe,transform:On,invTransform:jr}),Ie+=Dr.length/4,Fe=Ie}ur&&he.draw(Ft,$t.LINES,bn.disabled,gn.disabled,U.colorModeForRenderPass(),zr.disabled,mn(Le,U.transform,Ae),Y.id,ur.layoutVertexBuffer,ur.indexBuffer,ur.segments,null,U.transform.zoom,null,null,ur.collisionVertexBuffer)}}if(!(!ne||!Ne.length)){var Ln=U.useProgram("collisionCircle"),xn=new t.StructArrayLayout2f1f2i16;xn.resize(Ie*4),xn._trim();for(var Wn=0,Dn=0,la=Ne;Dn=0&&(Ge[Oe.associatedIconIndex]={shiftedAnchor:ma,angle:ti})}}if(Ne){He.clear();for(var Li=U.icon.placedSymbolArray,to=0;to0){var ne=t.browser.now(),Ft=(ne-U.timeAdded)/Qt,$t=tt?(ne-tt.timeAdded)/Qt:-1,he=Y.getSource(),Ne=zt.coveringZoomLevel({tileSize:he.tileSize,roundZoom:he.roundZoom}),Ie=!tt||Math.abs(tt.tileID.overscaledZ-Ne)>Math.abs(U.tileID.overscaledZ-Ne),Fe=Ie&&U.refreshedUponExpiration?1:t.clamp(Ie?Ft:1-$t,0,1);return U.refreshedUponExpiration&&Ft>=1&&(U.refreshedUponExpiration=!1),tt?{opacity:1,mix:1-Fe}:{opacity:Fe,mix:0}}else return{opacity:1,mix:0}}function gr(U,tt,Y){var ft=Y.paint.get("background-color"),zt=Y.paint.get("background-opacity");if(zt!==0){var Qt=U.context,ne=Qt.gl,Ft=U.transform,$t=Ft.tileSize,he=Y.paint.get("background-pattern");if(!U.isPatternMissing(he)){var Ne=!he&&ft.a===1&&zt===1&&U.opaquePassEnabledForLayer()?"opaque":"translucent";if(U.renderPass===Ne){var Ie=gn.disabled,Fe=U.depthModeForSublayer(0,Ne==="opaque"?bn.ReadWrite:bn.ReadOnly),He=U.colorModeForRenderPass(),Ge=U.useProgram(he?"backgroundPattern":"background"),Ae=Ft.coveringTiles({tileSize:$t});he&&(Qt.activeTexture.set(ne.TEXTURE0),U.imageManager.bind(U.context));for(var Oe=Y.getCrossfadeParameters(),Le=0,ur=Ae;Le "+Y.overscaledZ);var Le=Oe+" "+He+"kb";Yi(U,Le),ne.draw(ft,zt.TRIANGLES,Ft,$t,Re.alphaBlended,zr.disabled,Ta(Qt,t.Color.transparent,Ae),Ne,U.debugBuffer,U.quadTriangleIndexBuffer,U.debugSegments)}function Yi(U,tt){U.initDebugOverlayCanvas();var Y=U.debugOverlayCanvas,ft=U.context.gl,zt=U.debugOverlayCanvas.getContext("2d");zt.clearRect(0,0,Y.width,Y.height),zt.shadowColor="white",zt.shadowBlur=2,zt.lineWidth=1.5,zt.strokeStyle="white",zt.textBaseline="top",zt.font="bold 36px Open Sans, sans-serif",zt.fillText(tt,5,5),zt.strokeText(tt,5,5),U.debugOverlayTexture.update(Y),U.debugOverlayTexture.bind(ft.LINEAR,ft.CLAMP_TO_EDGE)}function Go(U,tt,Y){var ft=U.context,zt=Y.implementation;if(U.renderPass==="offscreen"){var Qt=zt.prerender;Qt&&(U.setCustomLayerDefaults(),ft.setColorMode(U.colorModeForRenderPass()),Qt.call(zt,ft.gl,U.transform.customLayerMatrix()),ft.setDirty(),U.setBaseState())}else if(U.renderPass==="translucent"){U.setCustomLayerDefaults(),ft.setColorMode(U.colorModeForRenderPass()),ft.setStencilMode(gn.disabled);var ne=zt.renderingMode==="3d"?new bn(U.context.gl.LEQUAL,bn.ReadWrite,U.depthRangeFor3D):U.depthModeForSublayer(0,bn.ReadOnly);ft.setDepthMode(ne),zt.render(ft.gl,U.transform.customLayerMatrix()),ft.setDirty(),U.setBaseState(),ft.bindFramebuffer.set(null)}}var Xo={symbol:L,circle:Pe,heatmap:$e,line:Jr,fill:Rt,"fill-extrusion":ae,hillshade:Te,raster:rr,background:gr,debug:Ai,custom:Go},po=function(U,tt){this.context=new tn(U),this.transform=tt,this._tileTextures={},this.setup(),this.numSublayers=Yr.maxUnderzooming+Yr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new fl,this.gpuTimers={}};po.prototype.resize=function(U,tt){if(this.width=U*t.browser.devicePixelRatio,this.height=tt*t.browser.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var Y=0,ft=this.style._order;Y256&&this.clearStencil(),Y.setColorMode(Re.disabled),Y.setDepthMode(bn.disabled);var zt=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var Qt=0,ne=tt;Qt256&&this.clearStencil();var U=this.nextStencilID++,tt=this.context.gl;return new gn({func:tt.NOTEQUAL,mask:255},U,255,tt.KEEP,tt.KEEP,tt.REPLACE)},po.prototype.stencilModeForClipping=function(U){var tt=this.context.gl;return new gn({func:tt.EQUAL,mask:255},this._tileClippingMaskIDs[U.key],0,tt.KEEP,tt.KEEP,tt.REPLACE)},po.prototype.stencilConfigForOverlap=function(U){var tt,Y=this.context.gl,ft=U.sort(function($t,he){return he.overscaledZ-$t.overscaledZ}),zt=ft[ft.length-1].overscaledZ,Qt=ft[0].overscaledZ-zt+1;if(Qt>1){this.currentStencilSource=void 0,this.nextStencilID+Qt>256&&this.clearStencil();for(var ne={},Ft=0;Ft=0;this.currentLayer--){var Dr=this.style._layers[ft[this.currentLayer]],jr=zt[Dr.source],On=Ft[Dr.source];this._renderTileClippingMasks(Dr,On),this.renderLayer(this,jr,Dr,On)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer0?tt.pop():null},po.prototype.isPatternMissing=function(U){if(!U)return!1;if(!U.from||!U.to)return!0;var tt=this.imageManager.getPattern(U.from.toString()),Y=this.imageManager.getPattern(U.to.toString());return!tt||!Y},po.prototype.useProgram=function(U,tt){this.cache=this.cache||{};var Y=""+U+(tt?tt.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[Y]||(this.cache[Y]=new tc(this.context,U,yc[U],tt,fo[U],this._showOverdrawInspector)),this.cache[Y]},po.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},po.prototype.setBaseState=function(){var U=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(U.FUNC_ADD)},po.prototype.initDebugOverlayCanvas=function(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;var U=this.context.gl;this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,U.RGBA)}},po.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var Qo=function(U,tt){this.points=U,this.planes=tt};Qo.fromInvProjectionMatrix=function(U,tt,Y){var ft=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]],zt=Math.pow(2,Y),Qt=ft.map(function($t){return t.transformMat4([],$t,U)}).map(function($t){return t.scale$1([],$t,1/$t[3]/tt*zt)}),ne=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],Ft=ne.map(function($t){var he=t.sub([],Qt[$t[0]],Qt[$t[1]]),Ne=t.sub([],Qt[$t[2]],Qt[$t[1]]),Ie=t.normalize([],t.cross([],he,Ne)),Fe=-t.dot(Ie,Qt[$t[1]]);return Ie.concat(Fe)});return new Qo(Qt,Ft)};var Js=function(U,tt){this.min=U,this.max=tt,this.center=t.scale$2([],t.add([],this.min,this.max),.5)};Js.prototype.quadrant=function(U){for(var tt=[U%2===0,U<2],Y=t.clone$2(this.min),ft=t.clone$2(this.max),zt=0;zt=0;if(Qt===0)return 0;Qt!==tt.length&&(Y=!1)}if(Y)return 2;for(var Ft=0;Ft<3;Ft++){for(var $t=Number.MAX_VALUE,he=-Number.MAX_VALUE,Ne=0;Nethis.max[Ft]-this.min[Ft])return 0}return 1};var Us=function(U,tt,Y,ft){if(U===void 0&&(U=0),tt===void 0&&(tt=0),Y===void 0&&(Y=0),ft===void 0&&(ft=0),isNaN(U)||U<0||isNaN(tt)||tt<0||isNaN(Y)||Y<0||isNaN(ft)||ft<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=U,this.bottom=tt,this.left=Y,this.right=ft};Us.prototype.interpolate=function(U,tt,Y){return tt.top!=null&&U.top!=null&&(this.top=t.number(U.top,tt.top,Y)),tt.bottom!=null&&U.bottom!=null&&(this.bottom=t.number(U.bottom,tt.bottom,Y)),tt.left!=null&&U.left!=null&&(this.left=t.number(U.left,tt.left,Y)),tt.right!=null&&U.right!=null&&(this.right=t.number(U.right,tt.right,Y)),this},Us.prototype.getCenter=function(U,tt){var Y=t.clamp((this.left+U-this.right)/2,0,U),ft=t.clamp((this.top+tt-this.bottom)/2,0,tt);return new t.Point(Y,ft)},Us.prototype.equals=function(U){return this.top===U.top&&this.bottom===U.bottom&&this.left===U.left&&this.right===U.right},Us.prototype.clone=function(){return new Us(this.top,this.bottom,this.left,this.right)},Us.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var To=function(U,tt,Y,ft,zt){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=zt===void 0?!0:zt,this._minZoom=U||0,this._maxZoom=tt||22,this._minPitch=Y??0,this._maxPitch=ft??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Us,this._posMatrixCache={},this._alignedPosMatrixCache={}},ko={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};To.prototype.clone=function(){var U=new To(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return U.tileSize=this.tileSize,U.latRange=this.latRange,U.width=this.width,U.height=this.height,U._center=this._center,U.zoom=this.zoom,U.angle=this.angle,U._fov=this._fov,U._pitch=this._pitch,U._unmodified=this._unmodified,U._edgeInsets=this._edgeInsets.clone(),U._calcMatrices(),U},ko.minZoom.get=function(){return this._minZoom},ko.minZoom.set=function(U){this._minZoom!==U&&(this._minZoom=U,this.zoom=Math.max(this.zoom,U))},ko.maxZoom.get=function(){return this._maxZoom},ko.maxZoom.set=function(U){this._maxZoom!==U&&(this._maxZoom=U,this.zoom=Math.min(this.zoom,U))},ko.minPitch.get=function(){return this._minPitch},ko.minPitch.set=function(U){this._minPitch!==U&&(this._minPitch=U,this.pitch=Math.max(this.pitch,U))},ko.maxPitch.get=function(){return this._maxPitch},ko.maxPitch.set=function(U){this._maxPitch!==U&&(this._maxPitch=U,this.pitch=Math.min(this.pitch,U))},ko.renderWorldCopies.get=function(){return this._renderWorldCopies},ko.renderWorldCopies.set=function(U){U===void 0?U=!0:U===null&&(U=!1),this._renderWorldCopies=U},ko.worldSize.get=function(){return this.tileSize*this.scale},ko.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},ko.size.get=function(){return new t.Point(this.width,this.height)},ko.bearing.get=function(){return-this.angle/Math.PI*180},ko.bearing.set=function(U){var tt=-t.wrap(U,-180,180)*Math.PI/180;this.angle!==tt&&(this._unmodified=!1,this.angle=tt,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},ko.pitch.get=function(){return this._pitch/Math.PI*180},ko.pitch.set=function(U){var tt=t.clamp(U,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==tt&&(this._unmodified=!1,this._pitch=tt,this._calcMatrices())},ko.fov.get=function(){return this._fov/Math.PI*180},ko.fov.set=function(U){U=Math.max(.01,Math.min(60,U)),this._fov!==U&&(this._unmodified=!1,this._fov=U/180*Math.PI,this._calcMatrices())},ko.zoom.get=function(){return this._zoom},ko.zoom.set=function(U){var tt=Math.min(Math.max(U,this.minZoom),this.maxZoom);this._zoom!==tt&&(this._unmodified=!1,this._zoom=tt,this.scale=this.zoomScale(tt),this.tileZoom=Math.floor(tt),this.zoomFraction=tt-this.tileZoom,this._constrain(),this._calcMatrices())},ko.center.get=function(){return this._center},ko.center.set=function(U){U.lat===this._center.lat&&U.lng===this._center.lng||(this._unmodified=!1,this._center=U,this._constrain(),this._calcMatrices())},ko.padding.get=function(){return this._edgeInsets.toJSON()},ko.padding.set=function(U){this._edgeInsets.equals(U)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,U,1),this._calcMatrices())},ko.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},To.prototype.isPaddingEqual=function(U){return this._edgeInsets.equals(U)},To.prototype.interpolatePadding=function(U,tt,Y){this._unmodified=!1,this._edgeInsets.interpolate(U,tt,Y),this._constrain(),this._calcMatrices()},To.prototype.coveringZoomLevel=function(U){var tt=(U.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/U.tileSize));return Math.max(0,tt)},To.prototype.getVisibleUnwrappedCoordinates=function(U){var tt=[new t.UnwrappedTileID(0,U)];if(this._renderWorldCopies)for(var Y=this.pointCoordinate(new t.Point(0,0)),ft=this.pointCoordinate(new t.Point(this.width,0)),zt=this.pointCoordinate(new t.Point(this.width,this.height)),Qt=this.pointCoordinate(new t.Point(0,this.height)),ne=Math.floor(Math.min(Y.x,ft.x,zt.x,Qt.x)),Ft=Math.floor(Math.max(Y.x,ft.x,zt.x,Qt.x)),$t=1,he=ne-$t;he<=Ft+$t;he++)he!==0&&tt.push(new t.UnwrappedTileID(he,U));return tt},To.prototype.coveringTiles=function(U){var tt=this.coveringZoomLevel(U),Y=tt;if(U.minzoom!==void 0&&ttU.maxzoom&&(tt=U.maxzoom);var ft=t.MercatorCoordinate.fromLngLat(this.center),zt=Math.pow(2,tt),Qt=[zt*ft.x,zt*ft.y,0],ne=Qo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,tt),Ft=U.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(Ft=tt);var $t=3,he=function(qn){return{aabb:new Js([qn*zt,0,0],[(qn+1)*zt,zt,0]),zoom:0,x:0,y:0,wrap:qn,fullyVisible:!1}},Ne=[],Ie=[],Fe=tt,He=U.reparseOverscaled?Y:tt;if(this._renderWorldCopies)for(var Ge=1;Ge<=3;Ge++)Ne.push(he(-Ge)),Ne.push(he(Ge));for(Ne.push(he(0));Ne.length>0;){var Ae=Ne.pop(),Oe=Ae.x,Le=Ae.y,ur=Ae.fullyVisible;if(!ur){var Dr=Ae.aabb.intersects(ne);if(Dr===0)continue;ur=Dr===2}var jr=Ae.aabb.distanceX(Qt),On=Ae.aabb.distanceY(Qt),Ln=Math.max(Math.abs(jr),Math.abs(On)),xn=$t+(1<xn&&Ae.zoom>=Ft){Ie.push({tileID:new t.OverscaledTileID(Ae.zoom===Fe?He:Ae.zoom,Ae.wrap,Ae.zoom,Oe,Le),distanceSq:t.sqrLen([Qt[0]-.5-Oe,Qt[1]-.5-Le])});continue}for(var Wn=0;Wn<4;Wn++){var Dn=(Oe<<1)+Wn%2,la=(Le<<1)+(Wn>>1);Ne.push({aabb:Ae.aabb.quadrant(Wn),zoom:Ae.zoom+1,x:Dn,y:la,wrap:Ae.wrap,fullyVisible:ur})}}return Ie.sort(function(qn,Gn){return qn.distanceSq-Gn.distanceSq}).map(function(qn){return qn.tileID})},To.prototype.resize=function(U,tt){this.width=U,this.height=tt,this.pixelsToGLUnits=[2/U,-2/tt],this._constrain(),this._calcMatrices()},ko.unmodified.get=function(){return this._unmodified},To.prototype.zoomScale=function(U){return Math.pow(2,U)},To.prototype.scaleZoom=function(U){return Math.log(U)/Math.LN2},To.prototype.project=function(U){var tt=t.clamp(U.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(U.lng)*this.worldSize,t.mercatorYfromLat(tt)*this.worldSize)},To.prototype.unproject=function(U){return new t.MercatorCoordinate(U.x/this.worldSize,U.y/this.worldSize).toLngLat()},ko.point.get=function(){return this.project(this.center)},To.prototype.setLocationAtPoint=function(U,tt){var Y=this.pointCoordinate(tt),ft=this.pointCoordinate(this.centerPoint),zt=this.locationCoordinate(U),Qt=new t.MercatorCoordinate(zt.x-(Y.x-ft.x),zt.y-(Y.y-ft.y));this.center=this.coordinateLocation(Qt),this._renderWorldCopies&&(this.center=this.center.wrap())},To.prototype.locationPoint=function(U){return this.coordinatePoint(this.locationCoordinate(U))},To.prototype.pointLocation=function(U){return this.coordinateLocation(this.pointCoordinate(U))},To.prototype.locationCoordinate=function(U){return t.MercatorCoordinate.fromLngLat(U)},To.prototype.coordinateLocation=function(U){return U.toLngLat()},To.prototype.pointCoordinate=function(U){var tt=0,Y=[U.x,U.y,0,1],ft=[U.x,U.y,1,1];t.transformMat4(Y,Y,this.pixelMatrixInverse),t.transformMat4(ft,ft,this.pixelMatrixInverse);var zt=Y[3],Qt=ft[3],ne=Y[0]/zt,Ft=ft[0]/Qt,$t=Y[1]/zt,he=ft[1]/Qt,Ne=Y[2]/zt,Ie=ft[2]/Qt,Fe=Ne===Ie?0:(tt-Ne)/(Ie-Ne);return new t.MercatorCoordinate(t.number(ne,Ft,Fe)/this.worldSize,t.number($t,he,Fe)/this.worldSize)},To.prototype.coordinatePoint=function(U){var tt=[U.x*this.worldSize,U.y*this.worldSize,0,1];return t.transformMat4(tt,tt,this.pixelMatrix),new t.Point(tt[0]/tt[3],tt[1]/tt[3])},To.prototype.getBounds=function(){return new t.LngLatBounds().extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))},To.prototype.getMaxBounds=function(){return!this.latRange||this.latRange.length!==2||!this.lngRange||this.lngRange.length!==2?null:new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]])},To.prototype.setMaxBounds=function(U){U?(this.lngRange=[U.getWest(),U.getEast()],this.latRange=[U.getSouth(),U.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},To.prototype.calculatePosMatrix=function(U,tt){tt===void 0&&(tt=!1);var Y=U.key,ft=tt?this._alignedPosMatrixCache:this._posMatrixCache;if(ft[Y])return ft[Y];var zt=U.canonical,Qt=this.worldSize/this.zoomScale(zt.z),ne=zt.x+Math.pow(2,zt.z)*U.wrap,Ft=t.identity(new Float64Array(16));return t.translate(Ft,Ft,[ne*Qt,zt.y*Qt,0]),t.scale(Ft,Ft,[Qt/t.EXTENT,Qt/t.EXTENT,1]),t.multiply(Ft,tt?this.alignedProjMatrix:this.projMatrix,Ft),ft[Y]=new Float32Array(Ft),ft[Y]},To.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},To.prototype._constrain=function(){if(!(!this.center||!this.width||!this.height||this._constraining)){this._constraining=!0;var U=-90,tt=90,Y=-180,ft=180,zt,Qt,ne,Ft,$t=this.size,he=this._unmodified;if(this.latRange){var Ne=this.latRange;U=t.mercatorYfromLat(Ne[1])*this.worldSize,tt=t.mercatorYfromLat(Ne[0])*this.worldSize,zt=tt-U<$t.y?$t.y/(tt-U):0}if(this.lngRange){var Ie=this.lngRange;Y=t.mercatorXfromLng(Ie[0])*this.worldSize,ft=t.mercatorXfromLng(Ie[1])*this.worldSize,Qt=ft-Y<$t.x?$t.x/(ft-Y):0}var Fe=this.point,He=Math.max(Qt||0,zt||0);if(He){this.center=this.unproject(new t.Point(Qt?(ft+Y)/2:Fe.x,zt?(tt+U)/2:Fe.y)),this.zoom+=this.scaleZoom(He),this._unmodified=he,this._constraining=!1;return}if(this.latRange){var Ge=Fe.y,Ae=$t.y/2;Ge-Aett&&(Ft=tt-Ae)}if(this.lngRange){var Oe=Fe.x,Le=$t.x/2;Oe-Left&&(ne=ft-Le)}(ne!==void 0||Ft!==void 0)&&(this.center=this.unproject(new t.Point(ne!==void 0?ne:Fe.x,Ft!==void 0?Ft:Fe.y))),this._unmodified=he,this._constraining=!1}},To.prototype._calcMatrices=function(){if(this.height){var U=this._fov/2,tt=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(U)*this.height;var Y=Math.PI/2+this._pitch,ft=this._fov*(.5+tt.y/this.height),zt=Math.sin(ft)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-Y-ft,.01,Math.PI-.01)),Qt=this.point,ne=Qt.x,Ft=Qt.y,$t=Math.cos(Math.PI/2-this._pitch)*zt+this.cameraToCenterDistance,he=$t*1.01,Ne=this.height/50,Ie=new Float64Array(16);t.perspective(Ie,this._fov,this.width/this.height,Ne,he),Ie[8]=-tt.x*2/this.width,Ie[9]=tt.y*2/this.height,t.scale(Ie,Ie,[1,-1,1]),t.translate(Ie,Ie,[0,0,-this.cameraToCenterDistance]),t.rotateX(Ie,Ie,this._pitch),t.rotateZ(Ie,Ie,this.angle),t.translate(Ie,Ie,[-ne,-Ft,0]),this.mercatorMatrix=t.scale([],Ie,[this.worldSize,this.worldSize,this.worldSize]),t.scale(Ie,Ie,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=Ie,this.invProjMatrix=t.invert([],this.projMatrix);var Fe=this.width%2/2,He=this.height%2/2,Ge=Math.cos(this.angle),Ae=Math.sin(this.angle),Oe=ne-Math.round(ne)+Ge*Fe+Ae*He,Le=Ft-Math.round(Ft)+Ge*He+Ae*Fe,ur=new Float64Array(Ie);if(t.translate(ur,ur,[Oe>.5?Oe-1:Oe,Le>.5?Le-1:Le,0]),this.alignedProjMatrix=ur,Ie=t.create(),t.scale(Ie,Ie,[this.width/2,-this.height/2,1]),t.translate(Ie,Ie,[1,-1,0]),this.labelPlaneMatrix=Ie,Ie=t.create(),t.scale(Ie,Ie,[1,-1,1]),t.translate(Ie,Ie,[-1,-1,0]),t.scale(Ie,Ie,[2/this.width,2/this.height,1]),this.glCoordMatrix=Ie,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),Ie=t.invert(new Float64Array(16),this.pixelMatrix),!Ie)throw new Error("failed to invert matrix");this.pixelMatrixInverse=Ie,this._posMatrixCache={},this._alignedPosMatrixCache={}}},To.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var U=this.pointCoordinate(new t.Point(0,0)),tt=[U.x*this.worldSize,U.y*this.worldSize,0,1],Y=t.transformMat4(tt,tt,this.pixelMatrix);return Y[3]/this.cameraToCenterDistance},To.prototype.getCameraPoint=function(){var U=this._pitch,tt=Math.tan(U)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,tt))},To.prototype.getCameraQueryGeometry=function(U){var tt=this.getCameraPoint();if(U.length===1)return[U[0],tt];for(var Y=tt.x,ft=tt.y,zt=tt.x,Qt=tt.y,ne=0,Ft=U;ne=3&&!U.some(function(Y){return isNaN(Y)})){var tt=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(U[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+U[2],+U[1]],zoom:+U[0],bearing:tt,pitch:+(U[4]||0)}),!0}return!1},Sl.prototype._updateHashUnthrottled=function(){var U=t.window.location.href.replace(/(#.+)?$/,this.getHashString());try{t.window.history.replaceState(t.window.history.state,null,U)}catch{}};var tu={linearity:.3,easing:t.bezier(0,0,.3,1)},gt=t.extend({deceleration:2500,maxSpeed:1400},tu),Et=t.extend({deceleration:20,maxSpeed:1400},tu),Xt=t.extend({deceleration:1e3,maxSpeed:360},tu),fe=t.extend({deceleration:1e3,maxSpeed:90},tu),me=function(U){this._map=U,this.clear()};me.prototype.clear=function(){this._inertiaBuffer=[]},me.prototype.record=function(U){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.browser.now(),settings:U})},me.prototype._drainInertiaBuffer=function(){for(var U=this._inertiaBuffer,tt=t.browser.now(),Y=160;U.length>0&&tt-U[0].time>Y;)U.shift()},me.prototype._onMoveEnd=function(U){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var tt={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0},Y=0,ft=this._inertiaBuffer;Y=this._clickTolerance||this._map.fire(new je(U.type,this._map,U))},Sr.prototype.dblclick=function(U){return this._firePreventable(new je(U.type,this._map,U))},Sr.prototype.mouseover=function(U){this._map.fire(new je(U.type,this._map,U))},Sr.prototype.mouseout=function(U){this._map.fire(new je(U.type,this._map,U))},Sr.prototype.touchstart=function(U){return this._firePreventable(new or(U.type,this._map,U))},Sr.prototype.touchmove=function(U){this._map.fire(new or(U.type,this._map,U))},Sr.prototype.touchend=function(U){this._map.fire(new or(U.type,this._map,U))},Sr.prototype.touchcancel=function(U){this._map.fire(new or(U.type,this._map,U))},Sr.prototype._firePreventable=function(U){if(this._map.fire(U),U.defaultPrevented)return{}},Sr.prototype.isEnabled=function(){return!0},Sr.prototype.isActive=function(){return!1},Sr.prototype.enable=function(){},Sr.prototype.disable=function(){};var Wr=function(U){this._map=U};Wr.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Wr.prototype.mousemove=function(U){this._map.fire(new je(U.type,this._map,U))},Wr.prototype.mousedown=function(){this._delayContextMenu=!0},Wr.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new je("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Wr.prototype.contextmenu=function(U){this._delayContextMenu?this._contextMenuEvent=U:this._map.fire(new je(U.type,this._map,U)),this._map.listens("contextmenu")&&U.preventDefault()},Wr.prototype.isEnabled=function(){return!0},Wr.prototype.isActive=function(){return!1},Wr.prototype.enable=function(){},Wr.prototype.disable=function(){};var an=function(U,tt){this._map=U,this._el=U.getCanvasContainer(),this._container=U.getContainer(),this._clickTolerance=tt.clickTolerance||1};an.prototype.isEnabled=function(){return!!this._enabled},an.prototype.isActive=function(){return!!this._active},an.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},an.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},an.prototype.mousedown=function(U,tt){this.isEnabled()&&U.shiftKey&&U.button===0&&(r.disableDrag(),this._startPos=this._lastPos=tt,this._active=!0)},an.prototype.mousemoveWindow=function(U,tt){if(this._active){var Y=tt;if(!(this._lastPos.equals(Y)||!this._box&&Y.dist(this._startPos)this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=U.timeStamp),Y.length===this.numTouches&&(this.centroid=ta(tt),this.touches=on(Y,tt)))},Yn.prototype.touchmove=function(U,tt,Y){if(!(this.aborted||!this.centroid)){var ft=on(Y,tt);for(var zt in this.touches){var Qt=this.touches[zt],ne=ft[zt];(!ne||ne.dist(Qt)>Hn)&&(this.aborted=!0)}}},Yn.prototype.touchend=function(U,tt,Y){if((!this.centroid||U.timeStamp-this.startTime>Bn)&&(this.aborted=!0),Y.length===0){var ft=!this.aborted&&this.centroid;if(this.reset(),ft)return ft}};var na=function(U){this.singleTap=new Yn(U),this.numTaps=U.numTaps,this.reset()};na.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},na.prototype.touchstart=function(U,tt,Y){this.singleTap.touchstart(U,tt,Y)},na.prototype.touchmove=function(U,tt,Y){this.singleTap.touchmove(U,tt,Y)},na.prototype.touchend=function(U,tt,Y){var ft=this.singleTap.touchend(U,tt,Y);if(ft){var zt=U.timeStamp-this.lastTime0&&(this._active=!0);var ft=on(Y,tt),zt=new t.Point(0,0),Qt=new t.Point(0,0),ne=0;for(var Ft in ft){var $t=ft[Ft],he=this._touches[Ft];he&&(zt._add($t),Qt._add($t.sub(he)),ne++,ft[Ft]=$t)}if(this._touches=ft,!(neMath.abs(U.x)}var ps=100,zs=(function(U){function tt(){U.apply(this,arguments)}return U&&(tt.__proto__=U),tt.prototype=Object.create(U&&U.prototype),tt.prototype.constructor=tt,tt.prototype.reset=function(){U.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},tt.prototype._start=function(Y){this._lastPoints=Y,lu(Y[0].sub(Y[1]))&&(this._valid=!1)},tt.prototype._move=function(Y,ft,zt){var Qt=Y[0].sub(this._lastPoints[0]),ne=Y[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(Qt,ne,zt.timeStamp),!!this._valid){this._lastPoints=Y,this._active=!0;var Ft=(Qt.y+ne.y)/2,$t=-.5;return{pitchDelta:Ft*$t}}},tt.prototype.gestureBeginsVertically=function(Y,ft,zt){if(this._valid!==void 0)return this._valid;var Qt=2,ne=Y.mag()>=Qt,Ft=ft.mag()>=Qt;if(!(!ne&&!Ft)){if(!ne||!Ft)return this._firstMove===void 0&&(this._firstMove=zt),zt-this._firstMove0==ft.y>0;return lu(Y)&&lu(ft)&&$t}},tt})(es),Eu={panStep:100,bearingStep:15,pitchStep:10},ie=function(){var U=Eu;this._panStep=U.panStep,this._bearingStep=U.bearingStep,this._pitchStep=U.pitchStep,this._rotationDisabled=!1};ie.prototype.reset=function(){this._active=!1},ie.prototype.keydown=function(U){var tt=this;if(!(U.altKey||U.ctrlKey||U.metaKey)){var Y=0,ft=0,zt=0,Qt=0,ne=0;switch(U.keyCode){case 61:case 107:case 171:case 187:Y=1;break;case 189:case 109:case 173:Y=-1;break;case 37:U.shiftKey?ft=-1:(U.preventDefault(),Qt=-1);break;case 39:U.shiftKey?ft=1:(U.preventDefault(),Qt=1);break;case 38:U.shiftKey?zt=1:(U.preventDefault(),ne=-1);break;case 40:U.shiftKey?zt=-1:(U.preventDefault(),ne=1);break;default:return}return this._rotationDisabled&&(ft=0,zt=0),{cameraAnimation:function(Ft){var $t=Ft.getZoom();Ft.easeTo({duration:300,easeId:"keyboardHandler",easing:nr,zoom:Y?Math.round($t)+Y*(U.shiftKey?2:1):$t,bearing:Ft.getBearing()+ft*tt._bearingStep,pitch:Ft.getPitch()+zt*tt._pitchStep,offset:[-Qt*tt._panStep,-ne*tt._panStep],center:Ft.getCenter()},{originalEvent:U})}}}},ie.prototype.enable=function(){this._enabled=!0},ie.prototype.disable=function(){this._enabled=!1,this.reset()},ie.prototype.isEnabled=function(){return this._enabled},ie.prototype.isActive=function(){return this._active},ie.prototype.disableRotation=function(){this._rotationDisabled=!0},ie.prototype.enableRotation=function(){this._rotationDisabled=!1};function nr(U){return U*(2-U)}var cr=4.000244140625,sn=1/100,zn=1/450,Tn=2,qr=function(U,tt){this._map=U,this._el=U.getCanvasContainer(),this._handler=tt,this._delta=0,this._defaultZoomRate=sn,this._wheelZoomRate=zn,t.bindAll(["_onTimeout"],this)};qr.prototype.setZoomRate=function(U){this._defaultZoomRate=U},qr.prototype.setWheelZoomRate=function(U){this._wheelZoomRate=U},qr.prototype.isEnabled=function(){return!!this._enabled},qr.prototype.isActive=function(){return!!this._active||this._finishTimeout!==void 0},qr.prototype.isZooming=function(){return!!this._zooming},qr.prototype.enable=function(U){this.isEnabled()||(this._enabled=!0,this._aroundCenter=U&&U.around==="center")},qr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},qr.prototype.wheel=function(U){if(this.isEnabled()){var tt=U.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?U.deltaY*40:U.deltaY,Y=t.browser.now(),ft=Y-(this._lastWheelEventTime||0);this._lastWheelEventTime=Y,tt!==0&&tt%cr===0?this._type="wheel":tt!==0&&Math.abs(tt)<4?this._type="trackpad":ft>400?(this._type=null,this._lastValue=tt,this._timeout=setTimeout(this._onTimeout,40,U)):this._type||(this._type=Math.abs(ft*tt)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,tt+=this._lastValue)),U.shiftKey&&tt&&(tt=tt/4),this._type&&(this._lastWheelEvent=U,this._delta-=tt,this._active||this._start(U)),U.preventDefault()}},qr.prototype._onTimeout=function(U){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(U)},qr.prototype._start=function(U){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var tt=r.mousePos(this._el,U);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(tt)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},qr.prototype.renderFrame=function(){var U=this;if(this._frameId&&(this._frameId=null,!!this.isActive())){var tt=this._map.transform;if(this._delta!==0){var Y=this._type==="wheel"&&Math.abs(this._delta)>cr?this._wheelZoomRate:this._defaultZoomRate,ft=Tn/(1+Math.exp(-Math.abs(this._delta*Y)));this._delta<0&&ft!==0&&(ft=1/ft);var zt=typeof this._targetZoom=="number"?tt.zoomScale(this._targetZoom):tt.scale;this._targetZoom=Math.min(tt.maxZoom,Math.max(tt.minZoom,tt.scaleZoom(zt*ft))),this._type==="wheel"&&(this._startZoom=tt.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var Qt=typeof this._targetZoom=="number"?this._targetZoom:tt.zoom,ne=this._startZoom,Ft=this._easing,$t=!1,he;if(this._type==="wheel"&&ne&&Ft){var Ne=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),Ie=Ft(Ne);he=t.number(ne,Qt,Ie),Ne<1?this._frameId||(this._frameId=!0):$t=!0}else he=Qt,$t=!0;return this._active=!0,$t&&(this._active=!1,this._finishTimeout=setTimeout(function(){U._zooming=!1,U._handler._triggerRenderFrame(),delete U._targetZoom,delete U._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!$t,zoomDelta:he-tt.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},qr.prototype._smoothOutEasing=function(U){var tt=t.ease;if(this._prevEase){var Y=this._prevEase,ft=(t.browser.now()-Y.start)/Y.duration,zt=Y.easing(ft+.01)-Y.easing(ft),Qt=.27/Math.sqrt(zt*zt+1e-4)*.01,ne=Math.sqrt(.27*.27-Qt*Qt);tt=t.bezier(Qt,ne,.25,1)}return this._prevEase={start:t.browser.now(),duration:U,easing:tt},tt},qr.prototype.reset=function(){this._active=!1};var Sn=function(U,tt){this._clickZoom=U,this._tapZoom=tt};Sn.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},Sn.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},Sn.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},Sn.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var sa=function(){this.reset()};sa.prototype.reset=function(){this._active=!1},sa.prototype.dblclick=function(U,tt){return U.preventDefault(),{cameraAnimation:function(Y){Y.easeTo({duration:300,zoom:Y.getZoom()+(U.shiftKey?-1:1),around:Y.unproject(tt)},{originalEvent:U})}}},sa.prototype.enable=function(){this._enabled=!0},sa.prototype.disable=function(){this._enabled=!1,this.reset()},sa.prototype.isEnabled=function(){return this._enabled},sa.prototype.isActive=function(){return this._active};var ea=function(){this._tap=new na({numTouches:1,numTaps:1}),this.reset()};ea.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},ea.prototype.touchstart=function(U,tt,Y){this._swipePoint||(this._tapTime&&U.timeStamp-this._tapTime>hn&&this.reset(),this._tapTime?Y.length>0&&(this._swipePoint=tt[0],this._swipeTouch=Y[0].identifier):this._tap.touchstart(U,tt,Y))},ea.prototype.touchmove=function(U,tt,Y){if(!this._tapTime)this._tap.touchmove(U,tt,Y);else if(this._swipePoint){if(Y[0].identifier!==this._swipeTouch)return;var ft=tt[0],zt=ft.y-this._swipePoint.y;return this._swipePoint=ft,U.preventDefault(),this._active=!0,{zoomDelta:zt/128}}},ea.prototype.touchend=function(U,tt,Y){if(this._tapTime)this._swipePoint&&Y.length===0&&this.reset();else{var ft=this._tap.touchend(U,tt,Y);ft&&(this._tapTime=U.timeStamp)}},ea.prototype.touchcancel=function(){this.reset()},ea.prototype.enable=function(){this._enabled=!0},ea.prototype.disable=function(){this._enabled=!1,this.reset()},ea.prototype.isEnabled=function(){return this._enabled},ea.prototype.isActive=function(){return this._active};var ka=function(U,tt,Y){this._el=U,this._mousePan=tt,this._touchPan=Y};ka.prototype.enable=function(U){this._inertiaOptions=U||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")},ka.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")},ka.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},ka.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var Ka=function(U,tt,Y){this._pitchWithRotate=U.pitchWithRotate,this._mouseRotate=tt,this._mousePitch=Y};Ka.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},Ka.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},Ka.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},Ka.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var Va=function(U,tt,Y,ft){this._el=U,this._touchZoom=tt,this._touchRotate=Y,this._tapDragZoom=ft,this._rotationDisabled=!1,this._enabled=!0};Va.prototype.enable=function(U){this._touchZoom.enable(U),this._rotationDisabled||this._touchRotate.enable(U),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")},Va.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")},Va.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},Va.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},Va.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},Va.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var fa=function(U){return U.zoom||U.drag||U.pitch||U.rotate},Un=(function(U){function tt(){U.apply(this,arguments)}return U&&(tt.__proto__=U),tt.prototype=Object.create(U&&U.prototype),tt.prototype.constructor=tt,tt})(t.Event);function Nr(U){return U.panDelta&&U.panDelta.mag()||U.zoomDelta||U.bearingDelta||U.pitchDelta}var fn=function(U,tt){this._map=U,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new me(U),this._bearingSnap=tt.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(tt),t.bindAll(["handleEvent","handleWindowEvent"],this);var Y=this._el;this._listeners=[[Y,"touchstart",{passive:!0}],[Y,"touchmove",{passive:!1}],[Y,"touchend",void 0],[Y,"touchcancel",void 0],[Y,"mousedown",void 0],[Y,"mousemove",void 0],[Y,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[Y,"mouseover",void 0],[Y,"mouseout",void 0],[Y,"dblclick",void 0],[Y,"click",void 0],[Y,"keydown",{capture:!1}],[Y,"keyup",void 0],[Y,"wheel",{passive:!1}],[Y,"contextmenu",void 0],[t.window,"blur",void 0]];for(var ft=0,zt=this._listeners;ftne?Math.min(2,jr):Math.max(.5,jr),qn=Math.pow(la,1-Wn),Gn=Qt.unproject(ur.add(Dr.mult(Wn*qn)).mult(Dn));Qt.setLocationAtPoint(Qt.renderWorldCopies?Gn.wrap():Gn,Ae)}zt._fireMoveEvents(ft)},function(Wn){zt._afterEase(ft,Wn)},Y),this},tt.prototype._prepareEase=function(Y,ft,zt){zt===void 0&&(zt={}),this._moving=!0,!ft&&!zt.moving&&this.fire(new t.Event("movestart",Y)),this._zooming&&!zt.zooming&&this.fire(new t.Event("zoomstart",Y)),this._rotating&&!zt.rotating&&this.fire(new t.Event("rotatestart",Y)),this._pitching&&!zt.pitching&&this.fire(new t.Event("pitchstart",Y))},tt.prototype._fireMoveEvents=function(Y){this.fire(new t.Event("move",Y)),this._zooming&&this.fire(new t.Event("zoom",Y)),this._rotating&&this.fire(new t.Event("rotate",Y)),this._pitching&&this.fire(new t.Event("pitch",Y))},tt.prototype._afterEase=function(Y,ft){if(!(this._easeId&&ft&&this._easeId===ft)){delete this._easeId;var zt=this._zooming,Qt=this._rotating,ne=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,zt&&this.fire(new t.Event("zoomend",Y)),Qt&&this.fire(new t.Event("rotateend",Y)),ne&&this.fire(new t.Event("pitchend",Y)),this.fire(new t.Event("moveend",Y))}},tt.prototype.flyTo=function(Y,ft){var zt=this;if(!Y.essential&&t.browser.prefersReducedMotion){var Qt=t.pick(Y,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Qt,ft)}this.stop(),Y=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},Y);var ne=this.transform,Ft=this.getZoom(),$t=this.getBearing(),he=this.getPitch(),Ne=this.getPadding(),Ie="zoom"in Y?t.clamp(+Y.zoom,ne.minZoom,ne.maxZoom):Ft,Fe="bearing"in Y?this._normalizeBearing(Y.bearing,$t):$t,He="pitch"in Y?+Y.pitch:he,Ge="padding"in Y?Y.padding:ne.padding,Ae=ne.zoomScale(Ie-Ft),Oe=t.Point.convert(Y.offset),Le=ne.centerPoint.add(Oe),ur=ne.pointLocation(Le),Dr=t.LngLat.convert(Y.center||ur);this._normalizeCenter(Dr);var jr=ne.project(ur),On=ne.project(Dr).sub(jr),Ln=Y.curve,xn=Math.max(ne.width,ne.height),Wn=xn/Ae,Dn=On.mag();if("minZoom"in Y){var la=t.clamp(Math.min(Y.minZoom,Ft,Ie),ne.minZoom,ne.maxZoom),qn=xn/ne.zoomScale(la-Ft);Ln=Math.sqrt(qn/Dn*2)}var Gn=Ln*Ln;function ma(mo){var Xs=(Wn*Wn-xn*xn+(mo?-1:1)*Gn*Gn*Dn*Dn)/(2*(mo?Wn:xn)*Gn*Dn);return Math.log(Math.sqrt(Xs*Xs+1)-Xs)}function ti(mo){return(Math.exp(mo)-Math.exp(-mo))/2}function si(mo){return(Math.exp(mo)+Math.exp(-mo))/2}function Li(mo){return ti(mo)/si(mo)}var to=ma(0),ls=function(mo){return si(to)/si(to+Ln*mo)},ms=function(mo){return xn*((si(to)*Li(to+Ln*mo)-ti(to))/Gn)/Dn},Ko=(ma(1)-to)/Ln;if(Math.abs(Dn)<1e-6||!isFinite(Ko)){if(Math.abs(xn-Wn)<1e-6)return this.easeTo(Y,ft);var gs=WnY.maxDuration&&(Y.duration=0),this._zooming=!0,this._rotating=$t!==Fe,this._pitching=He!==he,this._padding=!ne.isPaddingEqual(Ge),this._prepareEase(ft,!1),this._ease(function(mo){var Xs=mo*Ko,ec=1/ls(Xs);ne.zoom=mo===1?Ie:Ft+ne.scaleZoom(ec),zt._rotating&&(ne.bearing=t.number($t,Fe,mo)),zt._pitching&&(ne.pitch=t.number(he,He,mo)),zt._padding&&(ne.interpolatePadding(Ne,Ge,mo),Le=ne.centerPoint.add(Oe));var Ac=mo===1?Dr:ne.unproject(jr.add(On.mult(ms(Xs))).mult(ec));ne.setLocationAtPoint(ne.renderWorldCopies?Ac.wrap():Ac,Le),zt._fireMoveEvents(ft)},function(){return zt._afterEase(ft)},Y),this},tt.prototype.isEasing=function(){return!!this._easeFrameId},tt.prototype.stop=function(){return this._stop()},tt.prototype._stop=function(Y,ft){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var zt=this._onEaseEnd;delete this._onEaseEnd,zt.call(this,ft)}if(!Y){var Qt=this.handlers;Qt&&Qt.stop(!1)}return this},tt.prototype._ease=function(Y,ft,zt){zt.animate===!1||zt.duration===0?(Y(1),ft()):(this._easeStart=t.browser.now(),this._easeOptions=zt,this._onEaseFrame=Y,this._onEaseEnd=ft,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},tt.prototype._renderFrameCallback=function(){var Y=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(Y)),Y<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},tt.prototype._normalizeBearing=function(Y,ft){Y=t.wrap(Y,-180,180);var zt=Math.abs(Y-ft);return Math.abs(Y-360-ft)180?-360:zt<-180?360:0}},tt})(t.Evented),jn=function(U){U===void 0&&(U={}),this.options=U,t.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)};jn.prototype.getDefaultPosition=function(){return"bottom-right"},jn.prototype.onAdd=function(U){var tt=this.options&&this.options.compact;return this._map=U,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=r.create("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=r.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),tt&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),tt===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},jn.prototype.onRemove=function(){r.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0},jn.prototype._setElementTitle=function(U,tt){var Y=this._map._getUIString("AttributionControl."+tt);U.title=Y,U.setAttribute("aria-label",Y)},jn.prototype._toggleAttribution=function(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","true"))},jn.prototype._updateEditLink=function(){var U=this._editLink;U||(U=this._editLink=this._container.querySelector(".mapbox-improve-map"));var tt=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(U){var Y=tt.reduce(function(ft,zt,Qt){return zt.value&&(ft+=zt.key+"="+zt.value+(Qt=0)return!1;return!0});var ne=U.join(" | ");ne!==this._attribHTML&&(this._attribHTML=ne,U.length?(this._innerContainer.innerHTML=ne,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}},jn.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")};var kn=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};kn.prototype.onAdd=function(U){this._map=U,this._container=r.create("div","mapboxgl-ctrl");var tt=r.create("a","mapboxgl-ctrl-logo");return tt.target="_blank",tt.rel="noopener nofollow",tt.href="https://www.mapbox.com/",tt.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),tt.setAttribute("rel","noopener nofollow"),this._container.appendChild(tt),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},kn.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},kn.prototype.getDefaultPosition=function(){return"bottom-left"},kn.prototype._updateLogo=function(U){(!U||U.sourceDataType==="metadata")&&(this._container.style.display=this._logoRequired()?"block":"none")},kn.prototype._logoRequired=function(){if(this._map.style){var U=this._map.style.sourceCaches;for(var tt in U){var Y=U[tt].getSource();if(Y.mapbox_logo)return!0}return!1}},kn.prototype._updateCompact=function(){var U=this._container.children;if(U.length){var tt=U[0];this._map.getCanvasContainer().offsetWidth<250?tt.classList.add("mapboxgl-compact"):tt.classList.remove("mapboxgl-compact")}};var Ia=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};Ia.prototype.add=function(U){var tt=++this._id,Y=this._queue;return Y.push({callback:U,id:tt,cancelled:!1}),tt},Ia.prototype.remove=function(U){for(var tt=this._currentlyRunning,Y=tt?this._queue.concat(tt):this._queue,ft=0,zt=Y;ftft.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(ft.minPitch!=null&&ft.maxPitch!=null&&ft.minPitch>ft.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(ft.minPitch!=null&&ft.minPitchoa)throw new Error("maxPitch must be less than or equal to "+oa);var Qt=new To(ft.minZoom,ft.maxZoom,ft.minPitch,ft.maxPitch,ft.renderWorldCopies);if(U.call(this,Qt,ft),this._interactive=ft.interactive,this._maxTileCacheSize=ft.maxTileCacheSize,this._failIfMajorPerformanceCaveat=ft.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=ft.preserveDrawingBuffer,this._antialias=ft.antialias,this._trackResize=ft.trackResize,this._bearingSnap=ft.bearingSnap,this._refreshExpiredTiles=ft.refreshExpiredTiles,this._fadeDuration=ft.fadeDuration,this._crossSourceCollisions=ft.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=ft.collectResourceTiming,this._renderTaskQueue=new Ia,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},ya,ft.locale),this._clickTolerance=ft.clickTolerance,this._requestManager=new t.RequestManager(ft.transformRequest,ft.accessToken),typeof ft.container=="string"){if(this._container=t.window.document.getElementById(ft.container),!this._container)throw new Error("Container '"+ft.container+"' not found.")}else if(ft.container instanceof Rn)this._container=ft.container;else throw new Error("Invalid type: 'container' must be a String or HTMLElement.");if(ft.maxBounds&&this.setMaxBounds(ft.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",function(){return zt._update(!1)}),this.on("moveend",function(){return zt._update(!1)}),this.on("zoom",function(){return zt._update(!0)}),typeof t.window<"u"&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1),t.window.addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new fn(this,ft);var ne=typeof ft.hash=="string"&&ft.hash||void 0;this._hash=ft.hash&&new Sl(ne).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:ft.center,zoom:ft.zoom,bearing:ft.bearing,pitch:ft.pitch}),ft.bounds&&(this.resize(),this.fitBounds(ft.bounds,t.extend({},ft.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=ft.localIdeographFontFamily,ft.style&&this.setStyle(ft.style,{localIdeographFontFamily:ft.localIdeographFontFamily}),ft.attributionControl&&this.addControl(new jn({customAttribution:ft.customAttribution})),this.addControl(new kn,ft.logoPosition),this.on("style.load",function(){zt.transform.unmodified&&zt.jumpTo(zt.style.stylesheet)}),this.on("data",function(Ft){zt._update(Ft.dataType==="style"),zt.fire(new t.Event(Ft.dataType+"data",Ft))}),this.on("dataloading",function(Ft){zt.fire(new t.Event(Ft.dataType+"dataloading",Ft))})}U&&(tt.__proto__=U),tt.prototype=Object.create(U&&U.prototype),tt.prototype.constructor=tt;var Y={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return tt.prototype._getMapId=function(){return this._mapId},tt.prototype.addControl=function(ft,zt){if(zt===void 0&&(ft.getDefaultPosition?zt=ft.getDefaultPosition():zt="top-right"),!ft||!ft.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var Qt=ft.onAdd(this);this._controls.push(ft);var ne=this._controlPositions[zt];return zt.indexOf("bottom")!==-1?ne.insertBefore(Qt,ne.firstChild):ne.appendChild(Qt),this},tt.prototype.removeControl=function(ft){if(!ft||!ft.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var zt=this._controls.indexOf(ft);return zt>-1&&this._controls.splice(zt,1),ft.onRemove(this),this},tt.prototype.hasControl=function(ft){return this._controls.indexOf(ft)>-1},tt.prototype.resize=function(ft){var zt=this._containerDimensions(),Qt=zt[0],ne=zt[1];this._resizeCanvas(Qt,ne),this.transform.resize(Qt,ne),this.painter.resize(Qt,ne);var Ft=!this._moving;return Ft&&(this.stop(),this.fire(new t.Event("movestart",ft)).fire(new t.Event("move",ft))),this.fire(new t.Event("resize",ft)),Ft&&this.fire(new t.Event("moveend",ft)),this},tt.prototype.getBounds=function(){return this.transform.getBounds()},tt.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},tt.prototype.setMaxBounds=function(ft){return this.transform.setMaxBounds(t.LngLatBounds.convert(ft)),this._update()},tt.prototype.setMinZoom=function(ft){if(ft=ft??Pa,ft>=Pa&&ft<=this.transform.maxZoom)return this.transform.minZoom=ft,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=ft,this._update(),this.getZoom()>ft&&this.setZoom(ft),this;throw new Error("maxZoom must be greater than the current minZoom")},tt.prototype.getMaxZoom=function(){return this.transform.maxZoom},tt.prototype.setMinPitch=function(ft){if(ft=ft??aa,ft=aa&&ft<=this.transform.maxPitch)return this.transform.minPitch=ft,this._update(),this.getPitch()oa)throw new Error("maxPitch must be less than or equal to "+oa);if(ft>=this.transform.minPitch)return this.transform.maxPitch=ft,this._update(),this.getPitch()>ft&&this.setPitch(ft),this;throw new Error("maxPitch must be greater than the current minPitch")},tt.prototype.getMaxPitch=function(){return this.transform.maxPitch},tt.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},tt.prototype.setRenderWorldCopies=function(ft){return this.transform.renderWorldCopies=ft,this._update()},tt.prototype.project=function(ft){return this.transform.locationPoint(t.LngLat.convert(ft))},tt.prototype.unproject=function(ft){return this.transform.pointLocation(t.Point.convert(ft))},tt.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},tt.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},tt.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},tt.prototype._createDelegatedListener=function(ft,zt,Qt){var ne=this,Ft;if(ft==="mouseenter"||ft==="mouseover"){var $t=!1,he=function(Ae){var Oe=ne.getLayer(zt)?ne.queryRenderedFeatures(Ae.point,{layers:[zt]}):[];Oe.length?$t||($t=!0,Qt.call(ne,new je(ft,ne,Ae.originalEvent,{features:Oe}))):$t=!1},Ne=function(){$t=!1};return{layer:zt,listener:Qt,delegates:{mousemove:he,mouseout:Ne}}}else if(ft==="mouseleave"||ft==="mouseout"){var Ie=!1,Fe=function(Ae){var Oe=ne.getLayer(zt)?ne.queryRenderedFeatures(Ae.point,{layers:[zt]}):[];Oe.length?Ie=!0:Ie&&(Ie=!1,Qt.call(ne,new je(ft,ne,Ae.originalEvent)))},He=function(Ae){Ie&&(Ie=!1,Qt.call(ne,new je(ft,ne,Ae.originalEvent)))};return{layer:zt,listener:Qt,delegates:{mousemove:Fe,mouseout:He}}}else{var Ge=function(Ae){var Oe=ne.getLayer(zt)?ne.queryRenderedFeatures(Ae.point,{layers:[zt]}):[];Oe.length&&(Ae.features=Oe,Qt.call(ne,Ae),delete Ae.features)};return{layer:zt,listener:Qt,delegates:(Ft={},Ft[ft]=Ge,Ft)}}},tt.prototype.on=function(ft,zt,Qt){if(Qt===void 0)return U.prototype.on.call(this,ft,zt);var ne=this._createDelegatedListener(ft,zt,Qt);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[ft]=this._delegatedListeners[ft]||[],this._delegatedListeners[ft].push(ne);for(var Ft in ne.delegates)this.on(Ft,ne.delegates[Ft]);return this},tt.prototype.once=function(ft,zt,Qt){if(Qt===void 0)return U.prototype.once.call(this,ft,zt);var ne=this._createDelegatedListener(ft,zt,Qt);for(var Ft in ne.delegates)this.once(Ft,ne.delegates[Ft]);return this},tt.prototype.off=function(ft,zt,Qt){var ne=this;if(Qt===void 0)return U.prototype.off.call(this,ft,zt);var Ft=function($t){for(var he=$t[ft],Ne=0;Ne180;){var ne=Y.locationPoint(U);if(ne.x>=0&&ne.y>=0&&ne.x<=Y.width&&ne.y<=Y.height)break;U.lng>Y.center.lng?U.lng-=360:U.lng+=360}return U}var Ri={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function ds(U,tt,Y){var ft=U.classList;for(var zt in Ri)ft.remove("mapboxgl-"+Y+"-anchor-"+zt);ft.add("mapboxgl-"+Y+"-anchor-"+tt)}var rs=(function(U){function tt(Y,ft){if(U.call(this),(Y instanceof t.window.HTMLElement||ft)&&(Y=t.extend({element:Y},ft)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=Y&&Y.anchor||"center",this._color=Y&&Y.color||"#3FB1CE",this._scale=Y&&Y.scale||1,this._draggable=Y&&Y.draggable||!1,this._clickTolerance=Y&&Y.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=Y&&Y.rotation||0,this._rotationAlignment=Y&&Y.rotationAlignment||"auto",this._pitchAlignment=Y&&Y.pitchAlignment&&Y.pitchAlignment!=="auto"?Y.pitchAlignment:this._rotationAlignment,!Y||!Y.element){this._defaultMarker=!0,this._element=r.create("div"),this._element.setAttribute("aria-label","Map marker");var zt=r.createNS("http://www.w3.org/2000/svg","svg"),Qt=41,ne=27;zt.setAttributeNS(null,"display","block"),zt.setAttributeNS(null,"height",Qt+"px"),zt.setAttributeNS(null,"width",ne+"px"),zt.setAttributeNS(null,"viewBox","0 0 "+ne+" "+Qt);var Ft=r.createNS("http://www.w3.org/2000/svg","g");Ft.setAttributeNS(null,"stroke","none"),Ft.setAttributeNS(null,"stroke-width","1"),Ft.setAttributeNS(null,"fill","none"),Ft.setAttributeNS(null,"fill-rule","evenodd");var $t=r.createNS("http://www.w3.org/2000/svg","g");$t.setAttributeNS(null,"fill-rule","nonzero");var he=r.createNS("http://www.w3.org/2000/svg","g");he.setAttributeNS(null,"transform","translate(3.0, 29.0)"),he.setAttributeNS(null,"fill","#000000");for(var Ne=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}],Ie=0,Fe=Ne;Ie=ft}this._isDragging&&(this._pos=Y.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")))},tt.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new t.Event("dragend")),this._state="inactive"},tt.prototype._addDragHandler=function(Y){this._element.contains(Y.originalEvent.target)&&(Y.preventDefault(),this._positionDelta=Y.point.sub(this._pos).add(this._offset),this._pointerdownPos=Y.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},tt.prototype.setDraggable=function(Y){return this._draggable=!!Y,this._map&&(Y?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this},tt.prototype.isDraggable=function(){return this._draggable},tt.prototype.setRotation=function(Y){return this._rotation=Y||0,this._update(),this},tt.prototype.getRotation=function(){return this._rotation},tt.prototype.setRotationAlignment=function(Y){return this._rotationAlignment=Y||"auto",this._update(),this},tt.prototype.getRotationAlignment=function(){return this._rotationAlignment},tt.prototype.setPitchAlignment=function(Y){return this._pitchAlignment=Y&&Y!=="auto"?Y:this._rotationAlignment,this._update(),this},tt.prototype.getPitchAlignment=function(){return this._pitchAlignment},tt})(t.Evented),Zi={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Zs;function Zo(U){Zs!==void 0?U(Zs):t.window.navigator.permissions!==void 0?t.window.navigator.permissions.query({name:"geolocation"}).then(function(tt){Zs=tt.state!=="denied",U(Zs)}):(Zs=!!t.window.navigator.geolocation,U(Zs))}var Qs=0,El=!1,Cl=(function(U){function tt(Y){U.call(this),this.options=t.extend({},Zi,Y),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return U&&(tt.__proto__=U),tt.prototype=Object.create(U&&U.prototype),tt.prototype.constructor=tt,tt.prototype.onAdd=function(Y){return this._map=Y,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),Zo(this._setupUI),this._container},tt.prototype.onRemove=function(){this._geolocationWatchID!==void 0&&(t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),r.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Qs=0,El=!1},tt.prototype._isOutOfMapMaxBounds=function(Y){var ft=this._map.getMaxBounds(),zt=Y.coords;return ft&&(zt.longitudeft.getEast()||zt.latitudeft.getNorth())},tt.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break}},tt.prototype._onSuccess=function(Y){if(this._map){if(this._isOutOfMapMaxBounds(Y)){this._setErrorState(),this.fire(new t.Event("outofmaxbounds",Y)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=Y,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(Y),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(Y),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",Y)),this._finish()}},tt.prototype._updateCamera=function(Y){var ft=new t.LngLat(Y.coords.longitude,Y.coords.latitude),zt=Y.coords.accuracy,Qt=this._map.getBearing(),ne=t.extend({bearing:Qt},this.options.fitBoundsOptions);this._map.fitBounds(ft.toBounds(zt),ne,{geolocateSource:!0})},tt.prototype._updateMarker=function(Y){if(Y){var ft=new t.LngLat(Y.coords.longitude,Y.coords.latitude);this._accuracyCircleMarker.setLngLat(ft).addTo(this._map),this._userLocationDotMarker.setLngLat(ft).addTo(this._map),this._accuracy=Y.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},tt.prototype._updateCircleRadius=function(){var Y=this._map._container.clientHeight/2,ft=this._map.unproject([0,Y]),zt=this._map.unproject([1,Y]),Qt=ft.distanceTo(zt),ne=Math.ceil(2*this._accuracy/Qt);this._circleElement.style.width=ne+"px",this._circleElement.style.height=ne+"px"},tt.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},tt.prototype._onError=function(Y){if(this._map){if(this.options.trackUserLocation)if(Y.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var ft=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=ft,this._geolocateButton.setAttribute("aria-label",ft),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(Y.code===3&&El)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",Y)),this._finish()}},tt.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},tt.prototype._setupUI=function(Y){var ft=this;if(this._container.addEventListener("contextmenu",function(ne){return ne.preventDefault()}),this._geolocateButton=r.create("button","mapboxgl-ctrl-geolocate",this._container),r.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",Y===!1){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var zt=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=zt,this._geolocateButton.setAttribute("aria-label",zt)}else{var Qt=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=Qt,this._geolocateButton.setAttribute("aria-label",Qt)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=r.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new rs(this._dotElement),this._circleElement=r.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new rs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",function(ne){var Ft=ne.originalEvent&&ne.originalEvent.type==="resize";!ne.geolocateSource&&ft._watchState==="ACTIVE_LOCK"&&!Ft&&(ft._watchState="BACKGROUND",ft._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),ft._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),ft.fire(new t.Event("trackuserlocationend")))})},tt.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Qs--,El=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"));break}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error");break}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Qs++;var Y;Qs>1?(Y={maximumAge:6e5,timeout:0},El=!0):(Y=this.options.positionOptions,El=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,Y)}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},tt.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},tt})(t.Evented),Hs={maxWidth:100,unit:"metric"},js=function(U){this.options=t.extend({},Hs,U),t.bindAll(["_onMove","setUnit"],this)};js.prototype.getDefaultPosition=function(){return"bottom-left"},js.prototype._onMove=function(){Ks(this._map,this._container,this.options)},js.prototype.onAdd=function(U){return this._map=U,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",U.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},js.prototype.onRemove=function(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},js.prototype.setUnit=function(U){this.options.unit=U,Ks(this._map,this._container,this.options)};function Ks(U,tt,Y){var ft=Y&&Y.maxWidth||100,zt=U._container.clientHeight/2,Qt=U.unproject([0,zt]),ne=U.unproject([ft,zt]),Ft=Qt.distanceTo(ne);if(Y&&Y.unit==="imperial"){var $t=3.2808*Ft;if($t>5280){var he=$t/5280;Mi(tt,ft,he,U._getUIString("ScaleControl.Miles"))}else Mi(tt,ft,$t,U._getUIString("ScaleControl.Feet"))}else if(Y&&Y.unit==="nautical"){var Ne=Ft/1852;Mi(tt,ft,Ne,U._getUIString("ScaleControl.NauticalMiles"))}else Ft>=1e3?Mi(tt,ft,Ft/1e3,U._getUIString("ScaleControl.Kilometers")):Mi(tt,ft,Ft,U._getUIString("ScaleControl.Meters"))}function Mi(U,tt,Y,ft){var zt=Uo(Y),Qt=zt/Y;U.style.width=tt*Qt+"px",U.innerHTML=zt+" "+ft}function Ys(U){var tt=Math.pow(10,Math.ceil(-Math.log(U)/Math.LN10));return Math.round(U*tt)/tt}function Uo(U){var tt=Math.pow(10,(""+Math.floor(U)).length-1),Y=U/tt;return Y=Y>=10?10:Y>=5?5:Y>=3?3:Y>=2?2:Y>=1?1:Ys(Y),tt*Y}var tl=function(U){this._fullscreen=!1,U&&U.container&&(U.container instanceof t.window.HTMLElement?this._container=U.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.window.document&&(this._fullscreenchange="MSFullscreenChange")};tl.prototype.onAdd=function(U){return this._map=U,this._container||(this._container=this._map.getContainer()),this._controlContainer=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},tl.prototype.onRemove=function(){r.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},tl.prototype._checkFullscreenSupport=function(){return!!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},tl.prototype._setupUI=function(){var U=this._fullscreenButton=r.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);r.create("span","mapboxgl-ctrl-icon",U).setAttribute("aria-hidden",!0),U.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},tl.prototype._updateTitle=function(){var U=this._getTitle();this._fullscreenButton.setAttribute("aria-label",U),this._fullscreenButton.title=U},tl.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},tl.prototype._isFullscreen=function(){return this._fullscreen},tl.prototype._changeIcon=function(){var U=t.window.document.fullscreenElement||t.window.document.mozFullScreenElement||t.window.document.webkitFullscreenElement||t.window.document.msFullscreenElement;U===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},tl.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.mozCancelFullScreen?t.window.document.mozCancelFullScreen():t.window.document.msExitFullscreen?t.window.document.msExitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var Il={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},vi=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),lo=(function(U){function tt(Y){U.call(this),this.options=t.extend(Object.create(Il),Y),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return U&&(tt.__proto__=U),tt.prototype=Object.create(U&&U.prototype),tt.prototype.constructor=tt,tt.prototype.addTo=function(Y){return this._map&&this.remove(),this._map=Y,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},tt.prototype.isOpen=function(){return!!this._map},tt.prototype.remove=function(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this},tt.prototype.getLngLat=function(){return this._lngLat},tt.prototype.setLngLat=function(Y){return this._lngLat=t.LngLat.convert(Y),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this},tt.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this},tt.prototype.getElement=function(){return this._container},tt.prototype.setText=function(Y){return this.setDOMContent(t.window.document.createTextNode(Y))},tt.prototype.setHTML=function(Y){var ft=t.window.document.createDocumentFragment(),zt=t.window.document.createElement("body"),Qt;for(zt.innerHTML=Y;Qt=zt.firstChild,!!Qt;)ft.appendChild(Qt);return this.setDOMContent(ft)},tt.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},tt.prototype.setMaxWidth=function(Y){return this.options.maxWidth=Y,this._update(),this},tt.prototype.setDOMContent=function(Y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=r.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(Y),this._createCloseButton(),this._update(),this._focusFirstElement(),this},tt.prototype.addClassName=function(Y){this._container&&this._container.classList.add(Y)},tt.prototype.removeClassName=function(Y){this._container&&this._container.classList.remove(Y)},tt.prototype.setOffset=function(Y){return this.options.offset=Y,this._update(),this},tt.prototype.toggleClassName=function(Y){if(this._container)return this._container.classList.toggle(Y)},tt.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=r.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))},tt.prototype._onMouseUp=function(Y){this._update(Y.point)},tt.prototype._onMouseMove=function(Y){this._update(Y.point)},tt.prototype._onDrag=function(Y){this._update(Y.point)},tt.prototype._update=function(Y){var ft=this,zt=this._lngLat||this._trackPointer;if(!(!this._map||!zt||!this._content)&&(this._container||(this._container=r.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(function(Fe){return ft._container.classList.add(Fe)}),this._trackPointer&&this._container.classList.add("mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=gi(this._lngLat,this._pos,this._map.transform)),!(this._trackPointer&&!Y))){var Qt=this._pos=this._trackPointer&&Y?Y:this._map.project(this._lngLat),ne=this.options.anchor,Ft=ns(this.options.offset);if(!ne){var $t=this._container.offsetWidth,he=this._container.offsetHeight,Ne;Qt.y+Ft.bottom.ythis._map.transform.height-he?Ne=["bottom"]:Ne=[],Qt.x<$t/2?Ne.push("left"):Qt.x>this._map.transform.width-$t/2&&Ne.push("right"),Ne.length===0?ne="bottom":ne=Ne.join("-")}var Ie=Qt.add(Ft[ne]).round();r.setTransform(this._container,Ri[ne]+" translate("+Ie.x+"px,"+Ie.y+"px)"),ds(this._container,ne,"popup")}},tt.prototype._focusFirstElement=function(){if(!(!this.options.focusAfterOpen||!this._container)){var Y=this._container.querySelector(vi);Y&&Y.focus()}},tt.prototype._onClose=function(){this.remove()},tt})(t.Evented);function ns(U){if(U)if(typeof U=="number"){var tt=Math.round(Math.sqrt(.5*Math.pow(U,2)));return{center:new t.Point(0,0),top:new t.Point(0,U),"top-left":new t.Point(tt,tt),"top-right":new t.Point(-tt,tt),bottom:new t.Point(0,-U),"bottom-left":new t.Point(tt,-tt),"bottom-right":new t.Point(-tt,-tt),left:new t.Point(U,0),right:new t.Point(-U,0)}}else if(U instanceof t.Point||Array.isArray(U)){var Y=t.Point.convert(U);return{center:Y,top:Y,"top-left":Y,"top-right":Y,bottom:Y,"bottom-left":Y,"bottom-right":Y,left:Y,right:Y}}else return{center:t.Point.convert(U.center||[0,0]),top:t.Point.convert(U.top||[0,0]),"top-left":t.Point.convert(U["top-left"]||[0,0]),"top-right":t.Point.convert(U["top-right"]||[0,0]),bottom:t.Point.convert(U.bottom||[0,0]),"bottom-left":t.Point.convert(U["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(U["bottom-right"]||[0,0]),left:t.Point.convert(U.left||[0,0]),right:t.Point.convert(U.right||[0,0])};else return ns(new t.Point(0,0))}var $o={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:_i,NavigationControl:Na,GeolocateControl:Cl,AttributionControl:jn,ScaleControl:js,FullscreenControl:tl,Popup:lo,Marker:rs,Style:xl,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,prewarm:Ga,clearPrewarmedResources:ve,get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(U){t.config.ACCESS_TOKEN=U},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(U){t.config.API_URL=U},get workerCount(){return $n.workerCount},set workerCount(U){$n.workerCount=U},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(U){t.config.MAX_PARALLEL_IMAGE_REQUESTS=U},clearStorage:function(U){t.clearTileCache(U)},workerUrl:""};return $o}),E})}),iz=Vt((K,V)=>{var u=Xr(),d=Dl().sanitizeHTML,E=C5(),A=Gp();function t(o,a){this.subplot=o,this.uid=o.uid+"-"+a,this.index=a,this.idSource="source-"+this.uid,this.idLayer=A.layoutLayerPrefix+this.uid,this.sourceType=null,this.source=null,this.layerType=null,this.below=null,this.visible=!1}var e=t.prototype;e.update=function(o){this.visible?this.needsNewImage(o)?this.updateImage(o):this.needsNewSource(o)?(this.removeLayer(),this.updateSource(o),this.updateLayer(o)):this.needsNewLayer(o)?this.updateLayer(o):this.updateStyle(o):(this.updateSource(o),this.updateLayer(o)),this.visible=r(o)},e.needsNewImage=function(o){var a=this.subplot.map;return a.getSource(this.idSource)&&this.sourceType==="image"&&o.sourcetype==="image"&&(this.source!==o.source||JSON.stringify(this.coordinates)!==JSON.stringify(o.coordinates))},e.needsNewSource=function(o){return this.sourceType!==o.sourcetype||JSON.stringify(this.source)!==JSON.stringify(o.source)||this.layerType!==o.type},e.needsNewLayer=function(o){return this.layerType!==o.type||this.below!==this.subplot.belowLookup["layout-"+this.index]},e.lookupBelow=function(){return this.subplot.belowLookup["layout-"+this.index]},e.updateImage=function(o){var a=this.subplot.map;a.getSource(this.idSource).updateImage({url:o.source,coordinates:o.coordinates});var s=this.findFollowingMapboxLayerId(this.lookupBelow());s!==null&&this.subplot.map.moveLayer(this.idLayer,s)},e.updateSource=function(o){var a=this.subplot.map;if(a.getSource(this.idSource)&&a.removeSource(this.idSource),this.sourceType=o.sourcetype,this.source=o.source,!!r(o)){var s=n(o);a.addSource(this.idSource,s)}},e.findFollowingMapboxLayerId=function(o){if(o==="traces")for(var a=this.subplot.getMapLayers(),s=0;s0){for(var s=0;s0}function i(o){var a={},s={};switch(o.type){case"circle":u.extendFlat(s,{"circle-radius":o.circle.radius,"circle-color":o.color,"circle-opacity":o.opacity});break;case"line":u.extendFlat(s,{"line-width":o.line.width,"line-color":o.color,"line-opacity":o.opacity,"line-dasharray":o.line.dash});break;case"fill":u.extendFlat(s,{"fill-color":o.color,"fill-outline-color":o.fill.outlinecolor,"fill-opacity":o.opacity});break;case"symbol":var f=o.symbol,v=E(f.textposition,f.iconsize);u.extendFlat(a,{"icon-image":f.icon+"-15","icon-size":f.iconsize/10,"text-field":f.text,"text-size":f.textfont.size,"text-anchor":v.anchor,"text-offset":v.offset,"symbol-placement":f.placement}),u.extendFlat(s,{"icon-color":o.color,"text-color":f.textfont.color,"text-opacity":o.opacity});break;case"raster":u.extendFlat(s,{"raster-fade-duration":0,"raster-opacity":o.opacity});break}return{layout:a,paint:s}}function n(o){var a=o.sourcetype,s=o.source,f={type:a},v;return a==="geojson"?v="data":a==="vector"?v=typeof s=="string"?"url":"tiles":a==="raster"?(v="tiles",f.tileSize=256):a==="image"&&(v="url",f.coordinates=o.coordinates),f[v]=s,o.sourceattribution&&(f.attribution=d(o.sourceattribution)),f}V.exports=function(o,a,s){var f=new t(o,a);return f.update(s),f}}),oz=Vt((K,V)=>{var u=I5(),d=Xr(),E=Vd(),A=ji(),t=yo(),e=oh(),r=pc(),i=$h(),n=i.drawMode,o=i.selectMode,a=Ec().prepSelect,s=Ec().clearOutline,f=Ec().clearSelectionsCache,v=Ec().selectOnClick,g=Gp(),m=iz();function w(M,T){this.id=T,this.gd=M;var c=M._fullLayout,h=M._context;this.container=c._glcontainer.node(),this.isStatic=h.staticPlot,this.uid=c._uid+"-"+this.id,this.div=null,this.xaxis=null,this.yaxis=null,this.createFramework(c),this.map=null,this.accessToken=null,this.styleObj=null,this.traceHash={},this.layerList=[],this.belowLookup={},this.dragging=!1,this.wheeling=!1}var l=w.prototype;l.plot=function(M,T,c){var h=this,b=T[h.id];h.map&&b.accesstoken!==h.accessToken&&(h.map.remove(),h.map=null,h.styleObj=null,h.traceHash={},h.layerList=[]);var _;h.map?_=new Promise(function(P,z){h.updateMap(M,T,P,z)}):_=new Promise(function(P,z){h.createMap(M,T,P,z)}),c.push(_)},l.createMap=function(M,T,c,h){var b=this,_=T[b.id],P=b.styleObj=y(_.style,T);b.accessToken=_.accesstoken;var z=_.bounds,D=z?[[z.west,z.south],[z.east,z.north]]:null,B=b.map=new u.Map({container:b.div,style:P.style,center:k(_.center),zoom:_.zoom,bearing:_.bearing,pitch:_.pitch,maxBounds:D,interactive:!b.isStatic,preserveDrawingBuffer:b.isStatic,doubleClickZoom:!1,boxZoom:!1,attributionControl:!1}).addControl(new u.AttributionControl({compact:!0}));B._canvas.style.left="0px",B._canvas.style.top="0px",b.rejectOnError(h),b.isStatic||b.initFx(M,T);var R=[];R.push(new Promise(function(I){B.once("load",I)})),R=R.concat(E.fetchTraceGeoData(M)),Promise.all(R).then(function(){b.fillBelowLookup(M,T),b.updateData(M),b.updateLayout(T),b.resolveOnRender(c)}).catch(h)},l.updateMap=function(M,T,c,h){var b=this,_=b.map,P=T[this.id];b.rejectOnError(h);var z=[],D=y(P.style,T);JSON.stringify(b.styleObj)!==JSON.stringify(D)&&(b.styleObj=D,_.setStyle(D.style),b.traceHash={},z.push(new Promise(function(B){_.once("styledata",B)}))),z=z.concat(E.fetchTraceGeoData(M)),Promise.all(z).then(function(){b.fillBelowLookup(M,T),b.updateData(M),b.updateLayout(T),b.resolveOnRender(c)}).catch(h)},l.fillBelowLookup=function(M,T){var c=T[this.id],h=c.layers,b,_,P=this.belowLookup={},z=!1;for(b=0;b1)for(b=0;b-1&&v(D.originalEvent,h,[c.xaxis],[c.yaxis],c.id,z),B.indexOf("event")>-1&&r.click(h,D.originalEvent)}}},l.updateFx=function(M){var T=this,c=T.map,h=T.gd;if(T.isStatic)return;function b(D){var B=T.map.unproject(D);return[B.lng,B.lat]}var _=M.dragmode,P;P=function(D,B){if(B.isRect){var R=D.range={};R[T.id]=[b([B.xmin,B.ymin]),b([B.xmax,B.ymax])]}else{var I=D.lassoPoints={};I[T.id]=B.map(b)}};var z=T.dragOptions;T.dragOptions=d.extendDeep(z||{},{dragmode:M.dragmode,element:T.div,gd:h,plotinfo:{id:T.id,domain:M[T.id].domain,xaxis:T.xaxis,yaxis:T.yaxis,fillRangeItems:P},xaxes:[T.xaxis],yaxes:[T.yaxis],subplot:T.id}),c.off("click",T.onClickInPanHandler),o(_)||n(_)?(c.dragPan.disable(),c.on("zoomstart",T.clearOutline),T.dragOptions.prepFn=function(D,B,R){a(D,B,R,T.dragOptions,_)},e.init(T.dragOptions)):(c.dragPan.enable(),c.off("zoomstart",T.clearOutline),T.div.onmousedown=null,T.div.ontouchstart=null,T.div.removeEventListener("touchstart",T.div._ontouchstart),T.onClickInPanHandler=T.onClickInPanFn(T.dragOptions),c.on("click",T.onClickInPanHandler))},l.updateFramework=function(M){var T=M[this.id].domain,c=M._size,h=this.div.style;h.width=c.w*(T.x[1]-T.x[0])+"px",h.height=c.h*(T.y[1]-T.y[0])+"px",h.left=c.l+T.x[0]*c.w+"px",h.top=c.t+(1-T.y[1])*c.h+"px",this.xaxis._offset=c.l+T.x[0]*c.w,this.xaxis._length=c.w*(T.x[1]-T.x[0]),this.yaxis._offset=c.t+(1-T.y[1])*c.h,this.yaxis._length=c.h*(T.y[1]-T.y[0])},l.updateLayers=function(M){var T=M[this.id],c=T.layers,h=this.layerList,b;if(c.length!==h.length){for(b=0;b{var u=Xr(),d=Cd(),E=Gf(),A=Nv();V.exports=function(r,i,n){d(r,i,n,{type:"mapbox",attributes:A,handleDefaults:t,partition:"y",accessToken:i._mapboxAccessToken})};function t(r,i,n,o){n("accesstoken",o.accessToken),n("style"),n("center.lon"),n("center.lat"),n("zoom"),n("bearing"),n("pitch");var a=n("bounds.west"),s=n("bounds.east"),f=n("bounds.south"),v=n("bounds.north");(a===void 0||s===void 0||f===void 0||v===void 0)&&delete i.bounds,E(r,i,{name:"layers",handleItemDefaults:e}),i._input=r}function e(r,i){function n(g,m){return u.coerce(r,i,A.layers,g,m)}var o=n("visible");if(o){var a=n("sourcetype"),s=a==="raster"||a==="image";n("source"),n("sourceattribution"),a==="vector"&&n("sourcelayer"),a==="image"&&n("coordinates");var f;s&&(f="raster");var v=n("type",f);s&&v!=="raster"&&(v=i.type="raster",u.log("Source types *raster* and *image* must drawn *raster* layer type.")),n("below"),n("color"),n("opacity"),n("minzoom"),n("maxzoom"),v==="circle"&&n("circle.radius"),v==="line"&&(n("line.width"),n("line.dash")),v==="fill"&&n("fill.outlinecolor"),v==="symbol"&&(n("symbol.icon"),n("symbol.iconsize"),n("symbol.text"),u.coerceFont(n,"symbol.textfont",void 0,{noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0}),n("symbol.textposition"),n("symbol.placement"))}}}),Jx=Vt(K=>{var V=I5(),u=Xr(),d=u.strTranslate,E=u.strScale,A=Pf().getSubplotCalcData,t=zh(),e=Ni(),r=Eo(),i=Dl(),n=oz(),o="mapbox",a=K.constants=Gp();K.name=o,K.attr="subplot",K.idRoot=o,K.idRegex=K.attrRegex=u.counterRegex(o);var s=["mapbox subplots and traces are deprecated!","Please consider switching to `map` subplots and traces.","Learn more at: https://plotly.com/python/maplibre-migration/","as well as https://plotly.com/javascript/maplibre-migration/"].join(" ");K.attributes={subplot:{valType:"subplotid",dflt:"mapbox",editType:"calc"}},K.layoutAttributes=Nv(),K.supplyLayoutDefaults=sz();var f=!0;K.plot=function(m){f&&(f=!1,u.warn(s));var w=m._fullLayout,l=m.calcdata,x=w._subplots[o];if(V.version!==a.requiredVersion)throw new Error(a.wrongVersionErrorMsg);var y=v(m,x);V.accessToken=y;for(var S=0;SR/2){var I=P.split("|").join("
          ");D.text(I).attr("data-unformatted",I).call(i.convertToTspans,m),B=r.bBox(D.node())}D.attr("transform",d(-3,-B.height+8)),z.insert("rect",".static-attribution").attr({x:-B.width-6,y:-B.height-3,width:B.width+6,height:B.height+3,fill:"rgba(255, 255, 255, 0.75)"});var F=1;B.width+6>R&&(F=R/(B.width+6));var j=[x.l+x.w*k.x[1],x.t+x.h*(1-k.y[0])];z.attr("transform",d(j[0],j[1])+E(F))}};function v(m,w){var l=m._fullLayout,x=m._context;if(x.mapboxAccessToken==="")return"";for(var y=[],S=[],k=!1,M=!1,T=0;T1&&u.warn(a.multipleTokensErrorMsg),y[0]):(S.length&&u.log(["Listed mapbox access token(s)",S.join(","),"but did not use a Mapbox map style, ignoring token(s)."].join(" ")),"")}function g(m){return typeof m=="string"&&(a.styleValuesMapbox.indexOf(m)!==-1||m.indexOf("mapbox://")===0||m.indexOf("stamen")===0)}K.updateFx=function(m){for(var w=m._fullLayout,l=w._subplots[o],x=0;x{V.exports={attributes:Xx(),supplyDefaults:tz(),colorbar:Zf(),formatLabels:L5(),calc:Lx(),plot:rz(),hoverPoints:$x().hoverPoints,eventData:nz(),selectPoints:az(),styleOnSelect:function(u,d){if(d){var E=d[0].trace;E._glTrace.update(d)}},moduleType:"trace",name:"scattermapbox",basePlotModule:Jx(),categories:["mapbox","gl","symbols","showLegend","scatter-like"],meta:{}}}),uz=Vt((K,V)=>{V.exports=lz()}),P5=Vt((K,V)=>{var u=Ym(),d=Wl(),{hovertemplateAttrs:E,templatefallbackAttrs:A}=yl(),t=kl(),e=So().extendFlat;V.exports=e({locations:{valType:"data_array",editType:"calc"},z:{valType:"data_array",editType:"calc"},geojson:{valType:"any",editType:"calc"},featureidkey:e({},u.featureidkey,{}),below:{valType:"string",editType:"plot"},text:u.text,hovertext:u.hovertext,marker:{line:{color:e({},u.marker.line.color,{editType:"plot"}),width:e({},u.marker.line.width,{editType:"plot"}),editType:"calc"},opacity:e({},u.marker.opacity,{editType:"plot"}),editType:"calc"},selected:{marker:{opacity:e({},u.selected.marker.opacity,{editType:"plot"}),editType:"plot"},editType:"plot"},unselected:{marker:{opacity:e({},u.unselected.marker.opacity,{editType:"plot"}),editType:"plot"},editType:"plot"},hoverinfo:u.hoverinfo,hovertemplate:E({},{keys:["properties"]}),hovertemplatefallback:A(),showlegend:e({},t.showlegend,{dflt:!1})},d("",{cLetter:"z",editTypeOverride:"calc"}))}),cz=Vt((K,V)=>{var u=Xr(),d=vf(),E=P5();V.exports=function(A,t,e,r){function i(f,v){return u.coerce(A,t,E,f,v)}var n=i("locations"),o=i("z"),a=i("geojson");if(!u.isArrayOrTypedArray(n)||!n.length||!u.isArrayOrTypedArray(o)||!o.length||!(typeof a=="string"&&a!==""||u.isPlainObject(a))){t.visible=!1;return}i("featureidkey"),t._length=Math.min(n.length,o.length),i("below"),i("text"),i("hovertext"),i("hovertemplate"),i("hovertemplatefallback");var s=i("marker.line.width");s&&i("marker.line.color"),i("marker.opacity"),d(A,t,r,i,{prefix:"",cLetter:"z"}),u.coerceSelectionMarkerOpacity(t,i)}}),O5=Vt((K,V)=>{var u=Lo(),d=Xr(),E=xu(),A=Eo(),t=Ud().makeBlank,e=Vd();function r(n){var o=n[0].trace,a=o.visible===!0&&o._length!==0,s={layout:{visibility:"none"},paint:{}},f={layout:{visibility:"none"},paint:{}},v=o._opts={fill:s,line:f,geojson:t()};if(!a)return v;var g=e.extractTraceFeature(n);if(!g)return v;var m=E.makeColorScaleFuncFromTrace(o),w=o.marker,l=w.line||{},x;d.isArrayOrTypedArray(w.opacity)&&(x=function(b){var _=b.mo;return u(_)?+d.constrain(_,0,1):0});var y;d.isArrayOrTypedArray(l.color)&&(y=function(b){return b.mlc});var S;d.isArrayOrTypedArray(l.width)&&(S=function(b){return b.mlw});for(var k=0;k{var u=O5().convert,d=O5().convertOnSelect,E=Gp().traceLayerPrefix;function A(e,r){this.type="choroplethmapbox",this.subplot=e,this.uid=r,this.sourceId="source-"+r,this.layerList=[["fill",E+r+"-fill"],["line",E+r+"-line"]],this.below=null}var t=A.prototype;t.update=function(e){this._update(u(e)),e[0].trace._glTrace=this},t.updateOnSelect=function(e){this._update(d(e))},t._update=function(e){var r=this.subplot,i=this.layerList,n=r.belowLookup["trace-"+this.uid];r.map.getSource(this.sourceId).setData(e.geojson),n!==this.below&&(this._removeLayers(),this._addLayers(e,n),this.below=n);for(var o=0;o=0;i--)e.removeLayer(r[i][1])},t.dispose=function(){var e=this.subplot.map;this._removeLayers(),e.removeSource(this.sourceId)},V.exports=function(e,r){var i=r[0].trace,n=new A(e,i.uid),o=n.sourceId,a=u(r),s=n.below=e.belowLookup["trace-"+i.uid];return e.map.addSource(o,{type:"geojson",data:a.geojson}),n._addLayers(a,s),r[0].trace._glTrace=n,n}}),hz=Vt((K,V)=>{V.exports={attributes:P5(),supplyDefaults:cz(),colorbar:Ld(),calc:Ox(),plot:fz(),hoverPoints:Fx(),eventData:Bx(),selectPoints:Rx(),styleOnSelect:function(u,d){if(d){var E=d[0].trace;E._glTrace.updateOnSelect(d)}},getBelow:function(u,d){for(var E=d.getMapLayers(),A=E.length-2;A>=0;A--){var t=E[A].id;if(typeof t=="string"&&t.indexOf("water")===0){for(var e=A+1;e{V.exports=hz()}),D5=Vt((K,V)=>{var u=Wl(),{hovertemplateAttrs:d,templatefallbackAttrs:E}=yl(),A=kl(),t=Xx(),e=So().extendFlat;V.exports=e({lon:t.lon,lat:t.lat,z:{valType:"data_array",editType:"calc"},radius:{valType:"number",editType:"plot",arrayOk:!0,min:1,dflt:30},below:{valType:"string",editType:"plot"},text:t.text,hovertext:t.hovertext,hoverinfo:e({},A.hoverinfo,{flags:["lon","lat","z","text","name"]}),hovertemplate:d(),hovertemplatefallback:E(),showlegend:e({},A.showlegend,{dflt:!1})},u("",{cLetter:"z",editTypeOverride:"calc"}))}),dz=Vt((K,V)=>{var u=Xr(),d=vf(),E=D5();V.exports=function(A,t,e,r){function i(s,f){return u.coerce(A,t,E,s,f)}var n=i("lon")||[],o=i("lat")||[],a=Math.min(n.length,o.length);if(!a){t.visible=!1;return}t._length=a,i("z"),i("radius"),i("below"),i("text"),i("hovertext"),i("hovertemplate"),i("hovertemplatefallback"),d(A,t,r,i,{prefix:"",cLetter:"z"})}}),mz=Vt((K,V)=>{var u=Lo(),d=Xr().isArrayOrTypedArray,E=ks().BADNUM,A=ih(),t=Xr()._;V.exports=function(e,r){for(var i=r._length,n=new Array(i),o=r.z,a=d(o)&&o.length,s=0;s{var u=Lo(),d=Xr(),E=Pi(),A=xu(),t=ks().BADNUM,e=Ud().makeBlank;V.exports=function(r){var i=r[0].trace,n=i.visible===!0&&i._length!==0,o={layout:{visibility:"none"},paint:{}},a=i._opts={heatmap:o,geojson:e()};if(!n)return a;var s=[],f,v=i.z,g=i.radius,m=d.isArrayOrTypedArray(v)&&v.length,w=d.isArrayOrTypedArray(g);for(f=0;f0?+g[f]:0),s.push({type:"Feature",geometry:{type:"Point",coordinates:x},properties:y})}}var k=A.extractOpts(i),M=k.reversescale?A.flipScale(k.colorscale):k.colorscale,T=M[0][1],c=E.opacity(T)<1?T:E.addOpacity(T,0),h=["interpolate",["linear"],["heatmap-density"],0,c];for(f=1;f{var u=gz(),d=Gp().traceLayerPrefix;function E(t,e){this.type="densitymapbox",this.subplot=t,this.uid=e,this.sourceId="source-"+e,this.layerList=[["heatmap",d+e+"-heatmap"]],this.below=null}var A=E.prototype;A.update=function(t){var e=this.subplot,r=this.layerList,i=u(t),n=e.belowLookup["trace-"+this.uid];e.map.getSource(this.sourceId).setData(i.geojson),n!==this.below&&(this._removeLayers(),this._addLayers(i,n),this.below=n);for(var o=0;o=0;r--)t.removeLayer(e[r][1])},A.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},V.exports=function(t,e){var r=e[0].trace,i=new E(t,r.uid),n=i.sourceId,o=u(e),a=i.below=t.belowLookup["trace-"+r.uid];return t.map.addSource(n,{type:"geojson",data:o.geojson}),i._addLayers(o,a),i}}),yz=Vt((K,V)=>{var u=yo(),d=$x().hoverPoints,E=$x().getExtraText;V.exports=function(A,t,e){var r=d(A,t,e);if(r){var i=r[0],n=i.cd,o=n[0].trace,a=n[i.index];if(delete i.color,"z"in a){var s=i.subplot.mockAxis;i.z=a.z,i.zLabel=u.tickText(s,s.c2l(a.z),"hover").text}return i.extraText=E(o,a,n[0].t.labels),[i]}}}),xz=Vt((K,V)=>{V.exports=function(u,d){return u.lon=d.lon,u.lat=d.lat,u.z=d.z,u}}),_z=Vt((K,V)=>{V.exports={attributes:D5(),supplyDefaults:dz(),colorbar:Ld(),formatLabels:L5(),calc:mz(),plot:vz(),hoverPoints:yz(),eventData:xz(),getBelow:function(u,d){for(var E=d.getMapLayers(),A=0;A{V.exports=_z()}),wz=Vt((K,V)=>{V.exports={version:8,name:"orto",metadata:{"maputnik:renderer":"mlgljs"},center:[1.537786,41.837539],zoom:12,bearing:0,pitch:0,light:{anchor:"viewport",color:"white",intensity:.4,position:[1.15,45,30]},sources:{ortoEsri:{type:"raster",tiles:["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],tileSize:256,maxzoom:18,attribution:"ESRI © ESRI"},ortoInstaMaps:{type:"raster",tiles:["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],tileSize:256,maxzoom:13},ortoICGC:{type:"raster",tiles:["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],tileSize:256,minzoom:13.1,maxzoom:20},openmaptiles:{type:"vector",url:"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},sprite:"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1",glyphs:"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"#F4F9F4"}},{id:"ortoEsri",type:"raster",source:"ortoEsri",maxzoom:16,layout:{visibility:"visible"}},{id:"ortoICGC",type:"raster",source:"ortoICGC",minzoom:13.1,maxzoom:19,layout:{visibility:"visible"}},{id:"ortoInstaMaps",type:"raster",source:"ortoInstaMaps",maxzoom:13,layout:{visibility:"visible"}},{id:"waterway_tunnel",type:"line",source:"openmaptiles","source-layer":"waterway",minzoom:14,filter:["all",["in","class","river","stream","canal"],["==","brunnel","tunnel"]],layout:{"line-cap":"round"},paint:{"line-color":"#a0c8f0","line-width":{base:1.3,stops:[[13,.5],[20,6]]},"line-dasharray":[2,4]}},{id:"waterway-other",type:"line",metadata:{"mapbox:group":"1444849382550.77"},source:"openmaptiles","source-layer":"waterway",filter:["!in","class","canal","river","stream"],layout:{"line-cap":"round"},paint:{"line-color":"#a0c8f0","line-width":{base:1.3,stops:[[13,.5],[20,2]]}}},{id:"waterway-stream-canal",type:"line",metadata:{"mapbox:group":"1444849382550.77"},source:"openmaptiles","source-layer":"waterway",filter:["all",["in","class","canal","stream"],["!=","brunnel","tunnel"]],layout:{"line-cap":"round"},paint:{"line-color":"#a0c8f0","line-width":{base:1.3,stops:[[13,.5],[20,6]]}}},{id:"waterway-river",type:"line",metadata:{"mapbox:group":"1444849382550.77"},source:"openmaptiles","source-layer":"waterway",filter:["all",["==","class","river"],["!=","brunnel","tunnel"]],layout:{"line-cap":"round"},paint:{"line-color":"#a0c8f0","line-width":{base:1.2,stops:[[10,.8],[20,4]]},"line-opacity":.5}},{id:"water-offset",type:"fill",metadata:{"mapbox:group":"1444849382550.77"},source:"openmaptiles","source-layer":"water",maxzoom:8,filter:["==","$type","Polygon"],layout:{visibility:"visible"},paint:{"fill-opacity":0,"fill-color":"#a0c8f0","fill-translate":{base:1,stops:[[6,[2,0]],[8,[0,0]]]}}},{id:"water",type:"fill",metadata:{"mapbox:group":"1444849382550.77"},source:"openmaptiles","source-layer":"water",layout:{visibility:"visible"},paint:{"fill-color":"hsl(210, 67%, 85%)","fill-opacity":0}},{id:"water-pattern",type:"fill",metadata:{"mapbox:group":"1444849382550.77"},source:"openmaptiles","source-layer":"water",layout:{visibility:"visible"},paint:{"fill-translate":[0,2.5],"fill-pattern":"wave","fill-opacity":1}},{id:"landcover-ice-shelf",type:"fill",metadata:{"mapbox:group":"1444849382550.77"},source:"openmaptiles","source-layer":"landcover",filter:["==","subclass","ice_shelf"],layout:{visibility:"visible"},paint:{"fill-color":"#fff","fill-opacity":{base:1,stops:[[0,.9],[10,.3]]}}},{id:"tunnel-service-track-casing",type:"line",metadata:{"mapbox:group":"1444849354174.1904"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","tunnel"],["in","class","service","track"]],layout:{"line-join":"round"},paint:{"line-color":"#cfcdca","line-dasharray":[.5,.25],"line-width":{base:1.2,stops:[[15,1],[16,4],[20,11]]}}},{id:"tunnel-minor-casing",type:"line",metadata:{"mapbox:group":"1444849354174.1904"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","tunnel"],["==","class","minor"]],layout:{"line-join":"round"},paint:{"line-color":"#cfcdca","line-opacity":{stops:[[12,0],[12.5,1]]},"line-width":{base:1.2,stops:[[12,.5],[13,1],[14,4],[20,15]]}}},{id:"tunnel-secondary-tertiary-casing",type:"line",metadata:{"mapbox:group":"1444849354174.1904"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","tunnel"],["in","class","secondary","tertiary"]],layout:{"line-join":"round"},paint:{"line-color":"#e9ac77","line-opacity":1,"line-width":{base:1.2,stops:[[8,1.5],[20,17]]}}},{id:"tunnel-trunk-primary-casing",type:"line",metadata:{"mapbox:group":"1444849354174.1904"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","tunnel"],["in","class","primary","trunk"]],layout:{"line-join":"round"},paint:{"line-color":"#e9ac77","line-width":{base:1.2,stops:[[5,.4],[6,.6],[7,1.5],[20,22]]},"line-opacity":.7}},{id:"tunnel-motorway-casing",type:"line",metadata:{"mapbox:group":"1444849354174.1904"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","tunnel"],["==","class","motorway"]],layout:{"line-join":"round",visibility:"visible"},paint:{"line-color":"#e9ac77","line-dasharray":[.5,.25],"line-width":{base:1.2,stops:[[5,.4],[6,.6],[7,1.5],[20,22]]},"line-opacity":.5}},{id:"tunnel-path",type:"line",metadata:{"mapbox:group":"1444849354174.1904"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","brunnel","tunnel"],["==","class","path"]]],paint:{"line-color":"#cba","line-dasharray":[1.5,.75],"line-width":{base:1.2,stops:[[15,1.2],[20,4]]}}},{id:"tunnel-service-track",type:"line",metadata:{"mapbox:group":"1444849354174.1904"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","tunnel"],["in","class","service","track"]],layout:{"line-join":"round"},paint:{"line-color":"#fff","line-width":{base:1.2,stops:[[15.5,0],[16,2],[20,7.5]]}}},{id:"tunnel-minor",type:"line",metadata:{"mapbox:group":"1444849354174.1904"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","tunnel"],["==","class","minor_road"]],layout:{"line-join":"round"},paint:{"line-color":"#fff","line-opacity":1,"line-width":{base:1.2,stops:[[13.5,0],[14,2.5],[20,11.5]]}}},{id:"tunnel-secondary-tertiary",type:"line",metadata:{"mapbox:group":"1444849354174.1904"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","tunnel"],["in","class","secondary","tertiary"]],layout:{"line-join":"round"},paint:{"line-color":"#fff4c6","line-width":{base:1.2,stops:[[6.5,0],[7,.5],[20,10]]}}},{id:"tunnel-trunk-primary",type:"line",metadata:{"mapbox:group":"1444849354174.1904"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","tunnel"],["in","class","primary","trunk"]],layout:{"line-join":"round"},paint:{"line-color":"#fff4c6","line-width":{base:1.2,stops:[[6.5,0],[7,.5],[20,18]]},"line-opacity":.5}},{id:"tunnel-motorway",type:"line",metadata:{"mapbox:group":"1444849354174.1904"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","tunnel"],["==","class","motorway"]],layout:{"line-join":"round",visibility:"visible"},paint:{"line-color":"#ffdaa6","line-width":{base:1.2,stops:[[6.5,0],[7,.5],[20,18]]},"line-opacity":.5}},{id:"tunnel-railway",type:"line",metadata:{"mapbox:group":"1444849354174.1904"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","tunnel"],["==","class","rail"]],paint:{"line-color":"#bbb","line-width":{base:1.4,stops:[[14,.4],[15,.75],[20,2]]},"line-dasharray":[2,2]}},{id:"ferry",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["in","class","ferry"]],layout:{"line-join":"round",visibility:"visible"},paint:{"line-color":"rgba(108, 159, 182, 1)","line-width":1.1,"line-dasharray":[2,2]}},{id:"aeroway-taxiway-casing",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["all",["in","class","taxiway"]],layout:{"line-cap":"round","line-join":"round",visibility:"visible"},paint:{"line-color":"rgba(153, 153, 153, 1)","line-width":{base:1.5,stops:[[11,2],[17,12]]},"line-opacity":1}},{id:"aeroway-runway-casing",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["all",["in","class","runway"]],layout:{"line-cap":"round","line-join":"round",visibility:"visible"},paint:{"line-color":"rgba(153, 153, 153, 1)","line-width":{base:1.5,stops:[[11,5],[17,55]]},"line-opacity":1}},{id:"aeroway-taxiway",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in","class","taxiway"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round",visibility:"visible"},paint:{"line-color":"rgba(255, 255, 255, 1)","line-width":{base:1.5,stops:[[11,1],[17,10]]},"line-opacity":{base:1,stops:[[11,0],[12,1]]}}},{id:"aeroway-runway",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in","class","runway"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round",visibility:"visible"},paint:{"line-color":"rgba(255, 255, 255, 1)","line-width":{base:1.5,stops:[[11,4],[17,50]]},"line-opacity":{base:1,stops:[[11,0],[12,1]]}}},{id:"highway-motorway-link-casing",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",minzoom:12,filter:["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway_link"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#e9ac77","line-opacity":1,"line-width":{base:1.2,stops:[[12,1],[13,3],[14,4],[20,15]]}}},{id:"highway-link-casing",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["!in","brunnel","bridge","tunnel"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],layout:{"line-cap":"round","line-join":"round",visibility:"visible"},paint:{"line-color":"#e9ac77","line-opacity":1,"line-width":{base:1.2,stops:[[12,1],[13,3],[14,4],[20,15]]}}},{id:"highway-minor-casing",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["!=","brunnel","tunnel"],["in","class","minor","service","track"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#cfcdca","line-opacity":{stops:[[12,0],[12.5,0]]},"line-width":{base:1.2,stops:[[12,.5],[13,1],[14,4],[20,15]]}}},{id:"highway-secondary-tertiary-casing",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["!in","brunnel","bridge","tunnel"],["in","class","secondary","tertiary"]],layout:{"line-cap":"butt","line-join":"round",visibility:"visible"},paint:{"line-color":"#e9ac77","line-opacity":.5,"line-width":{base:1.2,stops:[[8,1.5],[20,17]]}}},{id:"highway-primary-casing",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",minzoom:5,filter:["all",["!in","brunnel","bridge","tunnel"],["in","class","primary"]],layout:{"line-cap":"butt","line-join":"round",visibility:"visible"},paint:{"line-color":"#e9ac77","line-opacity":{stops:[[7,0],[8,.6]]},"line-width":{base:1.2,stops:[[7,0],[8,.6],[9,1.5],[20,22]]}}},{id:"highway-trunk-casing",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",minzoom:5,filter:["all",["!in","brunnel","bridge","tunnel"],["in","class","trunk"]],layout:{"line-cap":"butt","line-join":"round",visibility:"visible"},paint:{"line-color":"#e9ac77","line-opacity":{stops:[[5,0],[6,.5]]},"line-width":{base:1.2,stops:[[5,0],[6,.6],[7,1.5],[20,22]]}}},{id:"highway-motorway-casing",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",minzoom:4,filter:["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway"]],layout:{"line-cap":"butt","line-join":"round",visibility:"visible"},paint:{"line-color":"#e9ac77","line-width":{base:1.2,stops:[[4,0],[5,.4],[6,.6],[7,1.5],[20,22]]},"line-opacity":{stops:[[4,0],[5,.5]]}}},{id:"highway-path",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["==","class","path"]]],paint:{"line-color":"#cba","line-dasharray":[1.5,.75],"line-width":{base:1.2,stops:[[15,1.2],[20,4]]}}},{id:"highway-motorway-link",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",minzoom:12,filter:["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway_link"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fc8","line-width":{base:1.2,stops:[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{id:"highway-link",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["!in","brunnel","bridge","tunnel"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],layout:{"line-cap":"round","line-join":"round",visibility:"visible"},paint:{"line-color":"#fea","line-width":{base:1.2,stops:[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{id:"highway-minor",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["!=","brunnel","tunnel"],["in","class","minor","service","track"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fff","line-opacity":.5,"line-width":{base:1.2,stops:[[13.5,0],[14,2.5],[20,11.5]]}}},{id:"highway-secondary-tertiary",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["!in","brunnel","bridge","tunnel"],["in","class","secondary","tertiary"]],layout:{"line-cap":"round","line-join":"round",visibility:"visible"},paint:{"line-color":"#fea","line-width":{base:1.2,stops:[[6.5,0],[8,.5],[20,13]]},"line-opacity":.5}},{id:"highway-primary",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["in","class","primary"]]],layout:{"line-cap":"round","line-join":"round",visibility:"visible"},paint:{"line-color":"#fea","line-width":{base:1.2,stops:[[8.5,0],[9,.5],[20,18]]},"line-opacity":0}},{id:"highway-trunk",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["in","class","trunk"]]],layout:{"line-cap":"round","line-join":"round",visibility:"visible"},paint:{"line-color":"#fea","line-width":{base:1.2,stops:[[6.5,0],[7,.5],[20,18]]},"line-opacity":.5}},{id:"highway-motorway",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",minzoom:5,filter:["all",["==","$type","LineString"],["all",["!in","brunnel","bridge","tunnel"],["==","class","motorway"]]],layout:{"line-cap":"round","line-join":"round",visibility:"visible"},paint:{"line-color":"#fc8","line-width":{base:1.2,stops:[[6.5,0],[7,.5],[20,18]]},"line-opacity":.5}},{id:"railway-transit",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","class","transit"],["!in","brunnel","tunnel"]]],layout:{visibility:"visible"},paint:{"line-color":"hsla(0, 0%, 73%, 0.77)","line-width":{base:1.4,stops:[[14,.4],[20,1]]}}},{id:"railway-transit-hatching",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","class","transit"],["!in","brunnel","tunnel"]]],layout:{visibility:"visible"},paint:{"line-color":"hsla(0, 0%, 73%, 0.68)","line-dasharray":[.2,8],"line-width":{base:1.4,stops:[[14.5,0],[15,2],[20,6]]}}},{id:"railway-service",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","class","rail"],["has","service"]]],paint:{"line-color":"hsla(0, 0%, 73%, 0.77)","line-width":{base:1.4,stops:[[14,.4],[20,1]]}}},{id:"railway-service-hatching",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","class","rail"],["has","service"]]],layout:{visibility:"visible"},paint:{"line-color":"hsla(0, 0%, 73%, 0.68)","line-dasharray":[.2,8],"line-width":{base:1.4,stops:[[14.5,0],[15,2],[20,6]]}}},{id:"railway",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["!has","service"],["!in","brunnel","bridge","tunnel"],["==","class","rail"]]],paint:{"line-color":"#bbb","line-width":{base:1.4,stops:[[14,.4],[15,.75],[20,2]]}}},{id:"railway-hatching",type:"line",metadata:{"mapbox:group":"1444849345966.4436"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["!has","service"],["!in","brunnel","bridge","tunnel"],["==","class","rail"]]],paint:{"line-color":"#bbb","line-dasharray":[.2,8],"line-width":{base:1.4,stops:[[14.5,0],[15,3],[20,8]]}}},{id:"bridge-motorway-link-casing",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","bridge"],["==","class","motorway_link"]],layout:{"line-join":"round"},paint:{"line-color":"#e9ac77","line-opacity":1,"line-width":{base:1.2,stops:[[12,1],[13,3],[14,4],[20,15]]}}},{id:"bridge-link-casing",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","bridge"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],layout:{"line-join":"round"},paint:{"line-color":"#e9ac77","line-opacity":1,"line-width":{base:1.2,stops:[[12,1],[13,3],[14,4],[20,15]]}}},{id:"bridge-secondary-tertiary-casing",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","bridge"],["in","class","secondary","tertiary"]],layout:{"line-join":"round"},paint:{"line-color":"#e9ac77","line-opacity":1,"line-width":{base:1.2,stops:[[8,1.5],[20,28]]}}},{id:"bridge-trunk-primary-casing",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","bridge"],["in","class","primary","trunk"]],layout:{"line-join":"round"},paint:{"line-color":"hsl(28, 76%, 67%)","line-width":{base:1.2,stops:[[5,.4],[6,.6],[7,1.5],[20,26]]}}},{id:"bridge-motorway-casing",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","bridge"],["==","class","motorway"]],layout:{"line-join":"round"},paint:{"line-color":"#e9ac77","line-width":{base:1.2,stops:[[5,.4],[6,.6],[7,1.5],[20,22]]},"line-opacity":.5}},{id:"bridge-path-casing",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["==","class","path"]]],paint:{"line-color":"#f8f4f0","line-width":{base:1.2,stops:[[15,1.2],[20,18]]}}},{id:"bridge-path",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["==","class","path"]]],paint:{"line-color":"#cba","line-width":{base:1.2,stops:[[15,1.2],[20,4]]},"line-dasharray":[1.5,.75]}},{id:"bridge-motorway-link",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","bridge"],["==","class","motorway_link"]],layout:{"line-join":"round"},paint:{"line-color":"#fc8","line-width":{base:1.2,stops:[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{id:"bridge-link",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","bridge"],["in","class","primary_link","secondary_link","tertiary_link","trunk_link"]],layout:{"line-join":"round"},paint:{"line-color":"#fea","line-width":{base:1.2,stops:[[12.5,0],[13,1.5],[14,2.5],[20,11.5]]}}},{id:"bridge-secondary-tertiary",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","bridge"],["in","class","secondary","tertiary"]],layout:{"line-join":"round"},paint:{"line-color":"#fea","line-width":{base:1.2,stops:[[6.5,0],[7,.5],[20,20]]}}},{id:"bridge-trunk-primary",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","bridge"],["in","class","primary","trunk"]],layout:{"line-join":"round"},paint:{"line-color":"#fea","line-width":{base:1.2,stops:[[6.5,0],[7,.5],[20,18]]}}},{id:"bridge-motorway",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","bridge"],["==","class","motorway"]],layout:{"line-join":"round"},paint:{"line-color":"#fc8","line-width":{base:1.2,stops:[[6.5,0],[7,.5],[20,18]]},"line-opacity":.5}},{id:"bridge-railway",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","bridge"],["==","class","rail"]],paint:{"line-color":"#bbb","line-width":{base:1.4,stops:[[14,.4],[15,.75],[20,2]]}}},{id:"bridge-railway-hatching",type:"line",metadata:{"mapbox:group":"1444849334699.1902"},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","brunnel","bridge"],["==","class","rail"]],paint:{"line-color":"#bbb","line-dasharray":[.2,8],"line-width":{base:1.4,stops:[[14.5,0],[15,3],[20,8]]}}},{id:"cablecar",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["==","class","cable_car"],layout:{visibility:"visible","line-cap":"round"},paint:{"line-color":"hsl(0, 0%, 70%)","line-width":{base:1,stops:[[11,1],[19,2.5]]}}},{id:"cablecar-dash",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["==","class","cable_car"],layout:{visibility:"visible","line-cap":"round"},paint:{"line-color":"hsl(0, 0%, 70%)","line-width":{base:1,stops:[[11,3],[19,5.5]]},"line-dasharray":[2,3]}},{id:"boundary-land-level-4",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",[">=","admin_level",4],["<=","admin_level",8],["!=","maritime",1]],layout:{"line-join":"round"},paint:{"line-color":"#9e9cab","line-dasharray":[3,1,1,1],"line-width":{base:1.4,stops:[[4,.4],[5,1],[12,3]]},"line-opacity":.6}},{id:"boundary-land-level-2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==","admin_level",2],["!=","maritime",1],["!=","disputed",1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"hsl(248, 7%, 66%)","line-width":{base:1,stops:[[0,.6],[4,1.4],[5,2],[12,2]]}}},{id:"boundary-land-disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=","maritime",1],["==","disputed",1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"hsl(248, 7%, 70%)","line-dasharray":[1,3],"line-width":{base:1,stops:[[0,.6],[4,1.4],[5,2],[12,8]]}}},{id:"boundary-water",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["in","admin_level",2,4],["==","maritime",1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(154, 189, 214, 1)","line-width":{base:1,stops:[[0,.6],[4,1],[5,1],[12,1]]},"line-opacity":{stops:[[6,0],[10,0]]}}},{id:"waterway-name",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:13,filter:["all",["==","$type","LineString"],["has","name"]],layout:{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin} {name:nonlatin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"line","text-letter-spacing":.2,"symbol-spacing":350},paint:{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{id:"water-name-lakeline",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==","$type","LineString"],layout:{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":`{name:latin} +{name:nonlatin}`,"text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"line","symbol-spacing":350,"text-letter-spacing":.2},paint:{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{id:"water-name-ocean",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["all",["==","$type","Point"],["==","class","ocean"]],layout:{"text-font":["Noto Sans Italic"],"text-size":14,"text-field":"{name:latin}","text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":.2},paint:{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{id:"water-name-other",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["all",["==","$type","Point"],["!in","class","ocean"]],layout:{"text-font":["Noto Sans Italic"],"text-size":{stops:[[0,10],[6,14]]},"text-field":`{name:latin} +{name:nonlatin}`,"text-max-width":5,"text-rotation-alignment":"map","symbol-placement":"point","symbol-spacing":350,"text-letter-spacing":.2,visibility:"visible"},paint:{"text-color":"#74aee9","text-halo-width":1.5,"text-halo-color":"rgba(255,255,255,0.7)"}},{id:"poi-level-3",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:16,filter:["all",["==","$type","Point"],[">=","rank",25]],layout:{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":`{name:latin} +{name:nonlatin}`,"text-offset":[0,.6],"text-size":12,"text-max-width":9},paint:{"text-halo-blur":.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{id:"poi-level-2",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:15,filter:["all",["==","$type","Point"],["<=","rank",24],[">=","rank",15]],layout:{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":`{name:latin} +{name:nonlatin}`,"text-offset":[0,.6],"text-size":12,"text-max-width":9},paint:{"text-halo-blur":.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{id:"poi-level-1",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:14,filter:["all",["==","$type","Point"],["<=","rank",14],["has","name"]],layout:{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":`{name:latin} +{name:nonlatin}`,"text-offset":[0,.6],"text-size":11,"text-max-width":9},paint:{"text-halo-blur":.5,"text-color":"rgba(191, 228, 172, 1)","text-halo-width":1,"text-halo-color":"rgba(30, 29, 29, 1)"}},{id:"poi-railway",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:13,filter:["all",["==","$type","Point"],["has","name"],["==","class","railway"],["==","subclass","station"]],layout:{"text-padding":2,"text-font":["Noto Sans Regular"],"text-anchor":"top","icon-image":"{class}_11","text-field":`{name:latin} +{name:nonlatin}`,"text-offset":[0,.6],"text-size":12,"text-max-width":9,"icon-optional":!1,"icon-ignore-placement":!1,"icon-allow-overlap":!1,"text-ignore-placement":!1,"text-allow-overlap":!1,"text-optional":!0},paint:{"text-halo-blur":.5,"text-color":"#666","text-halo-width":1,"text-halo-color":"#ffffff"}},{id:"road_oneway",type:"symbol",source:"openmaptiles","source-layer":"transportation",minzoom:15,filter:["all",["==","oneway",1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],layout:{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":90,"icon-size":{stops:[[15,.5],[19,1]]}},paint:{"icon-opacity":.5}},{id:"road_oneway_opposite",type:"symbol",source:"openmaptiles","source-layer":"transportation",minzoom:15,filter:["all",["==","oneway",-1],["in","class","motorway","trunk","primary","secondary","tertiary","minor","service"]],layout:{"symbol-placement":"line","icon-image":"oneway","symbol-spacing":75,"icon-padding":2,"icon-rotation-alignment":"map","icon-rotate":-90,"icon-size":{stops:[[15,.5],[19,1]]}},paint:{"icon-opacity":.5}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==","class","path"],layout:{"text-size":{base:1,stops:[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},paint:{"text-halo-color":"#f8f4f0","text-color":"hsl(30, 23%, 62%)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==","$type","LineString"],["in","class","minor","service","track"]],layout:{"text-size":{base:1,stops:[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},paint:{"text-halo-blur":.5,"text-color":"#765","text-halo-width":1}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["in","class","primary","secondary","tertiary","trunk"],layout:{"text-size":{base:1,stops:[[13,12],[14,13]]},"text-font":["Noto Sans Regular"],"text-field":"{name:latin} {name:nonlatin}","symbol-placement":"line","text-rotation-alignment":"map"},paint:{"text-halo-blur":.5,"text-color":"#765","text-halo-width":1}},{id:"highway-shield",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:8,filter:["all",["<=","ref_length",6],["==","$type","LineString"],["!in","network","us-interstate","us-highway","us-state"]],layout:{"text-size":10,"icon-image":"road_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{base:1,stops:[[10,"point"],[11,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},paint:{"text-opacity":1,"text-color":"rgba(20, 19, 19, 1)","text-halo-color":"rgba(230, 221, 221, 0)","text-halo-width":2,"icon-color":"rgba(183, 18, 18, 1)","icon-opacity":.3,"icon-halo-color":"rgba(183, 55, 55, 0)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:7,filter:["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-interstate"]],layout:{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{base:1,stops:[[7,"point"],[7,"line"],[8,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},paint:{"text-color":"rgba(0, 0, 0, 1)"}},{id:"highway-shield-us-other",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:9,filter:["all",["<=","ref_length",6],["==","$type","LineString"],["in","network","us-highway","us-state"]],layout:{"text-size":10,"icon-image":"{network}_{ref_length}","icon-rotation-alignment":"viewport","symbol-spacing":200,"text-font":["Noto Sans Regular"],"symbol-placement":{base:1,stops:[[10,"point"],[11,"line"]]},"text-rotation-alignment":"viewport","icon-size":1,"text-field":"{ref}"},paint:{"text-color":"rgba(0, 0, 0, 1)"}},{id:"place-other",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",minzoom:12,filter:["!in","class","city","town","village","country","continent"],layout:{"text-letter-spacing":.1,"text-size":{base:1.2,stops:[[12,10],[15,14]]},"text-font":["Noto Sans Bold"],"text-field":`{name:latin} +{name:nonlatin}`,"text-transform":"uppercase","text-max-width":9,visibility:"visible"},paint:{"text-color":"rgba(255,255,255,1)","text-halo-width":1.2,"text-halo-color":"rgba(57, 28, 28, 1)"}},{id:"place-village",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",minzoom:10,filter:["==","class","village"],layout:{"text-font":["Noto Sans Regular"],"text-size":{base:1.2,stops:[[10,12],[15,16]]},"text-field":`{name:latin} +{name:nonlatin}`,"text-max-width":8,visibility:"visible"},paint:{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(10, 9, 9, 0.8)"}},{id:"place-town",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["==","class","town"],layout:{"text-font":["Noto Sans Regular"],"text-size":{base:1.2,stops:[[10,14],[15,24]]},"text-field":`{name:latin} +{name:nonlatin}`,"text-max-width":8,visibility:"visible"},paint:{"text-color":"rgba(255, 255, 255, 1)","text-halo-width":1.2,"text-halo-color":"rgba(22, 22, 22, 0.8)"}},{id:"place-city",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["!=","capital",2],["==","class","city"]],layout:{"text-font":["Noto Sans Regular"],"text-size":{base:1.2,stops:[[7,14],[11,24]]},"text-field":`{name:latin} +{name:nonlatin}`,"text-max-width":8,visibility:"visible"},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-city-capital",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","capital",2],["==","class","city"]],layout:{"text-font":["Noto Sans Regular"],"text-size":{base:1.2,stops:[[7,14],[11,24]]},"text-field":`{name:latin} +{name:nonlatin}`,"text-max-width":8,"icon-image":"star_11","text-offset":[.4,0],"icon-size":.8,"text-anchor":"left",visibility:"visible"},paint:{"text-color":"#333","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-other",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],[">=","rank",3],["!has","iso_a2"]],layout:{"text-font":["Noto Sans Italic"],"text-field":"{name:latin}","text-size":{stops:[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-3",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],[">=","rank",3],["has","iso_a2"]],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{stops:[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-2",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],["==","rank",2],["has","iso_a2"]],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{stops:[[2,11],[5,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-1",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],["==","rank",1],["has","iso_a2"]],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{stops:[[1,11],[4,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-continent",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",maxzoom:1,filter:["==","class","continent"],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":14,"text-max-width":6.25,"text-transform":"uppercase",visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}}],id:"qebnlkra6"}}),Tz=Vt((K,V)=>{V.exports={version:8,name:"orto",metadata:{},center:[1.537786,41.837539],zoom:12,bearing:0,pitch:0,light:{anchor:"viewport",color:"white",intensity:.4,position:[1.15,45,30]},sources:{ortoEsri:{type:"raster",tiles:["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],tileSize:256,maxzoom:18,attribution:"ESRI © ESRI"},ortoInstaMaps:{type:"raster",tiles:["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],tileSize:256,maxzoom:13},ortoICGC:{type:"raster",tiles:["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],tileSize:256,minzoom:13.1,maxzoom:20},openmaptiles:{type:"vector",url:"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},sprite:"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1",glyphs:"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"#F4F9F4"}},{id:"ortoEsri",type:"raster",source:"ortoEsri",maxzoom:16,layout:{visibility:"visible"}},{id:"ortoICGC",type:"raster",source:"ortoICGC",minzoom:13.1,maxzoom:19,layout:{visibility:"visible"}},{id:"ortoInstaMaps",type:"raster",source:"ortoInstaMaps",maxzoom:13,layout:{visibility:"visible"}}]}}),Gd=Vt((K,V)=>{var u=Td(),d=wz(),E=Tz(),A='© OpenStreetMap contributors',t="https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",e="https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",r="https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json",i="https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json",n="https://basemaps.cartocdn.com/gl/dark-matter-nolabels-gl-style/style.json",o="https://basemaps.cartocdn.com/gl/voyager-nolabels-gl-style/style.json",a={basic:r,streets:r,outdoors:r,light:t,dark:e,satellite:E,"satellite-streets":d,"open-street-map":{id:"osm",version:8,sources:{"plotly-osm-tiles":{type:"raster",attribution:A,tiles:["https://tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-osm-tiles",type:"raster",source:"plotly-osm-tiles",minzoom:0,maxzoom:22}],glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"},"white-bg":{id:"white-bg",version:8,sources:{},layers:[{id:"white-bg",type:"background",paint:{"background-color":"#FFFFFF"},minzoom:0,maxzoom:22}],glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"},"carto-positron":t,"carto-darkmatter":e,"carto-voyager":r,"carto-positron-nolabels":i,"carto-darkmatter-nolabels":n,"carto-voyager-nolabels":o},s=u(a);V.exports={styleValueDflt:"basic",stylesMap:a,styleValuesMap:s,traceLayerPrefix:"plotly-trace-layer-",layoutLayerPrefix:"plotly-layout-layer-",missingStyleErrorMsg:["No valid maplibre style found, please set `map.style` to one of:",s.join(", "),"or use a tile service."].join(` +`),mapOnErrorMsg:"Map error."}}),jv=Vt((K,V)=>{var u=Xr(),d=Pi().defaultLine,E=Hu().attributes,A=yu(),t=dc().textposition,e=Cu().overrideAll,r=cl().templatedArray,i=Gd(),n=A({noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0});n.family.dflt="Open Sans Regular, Arial Unicode MS Regular";var o=V.exports=e({_arrayAttrRegexps:[u.counterRegex("map",".layers",!0)],domain:E({name:"map"}),style:{valType:"any",values:i.styleValuesMap,dflt:i.styleValueDflt},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},bounds:{west:{valType:"number"},east:{valType:"number"},south:{valType:"number"},north:{valType:"number"}},layers:r("layer",{visible:{valType:"boolean",dflt:!0},sourcetype:{valType:"enumerated",values:["geojson","vector","raster","image"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},sourceattribution:{valType:"string"},type:{valType:"enumerated",values:["circle","line","fill","symbol","raster"],dflt:"circle"},coordinates:{valType:"any"},below:{valType:"string"},color:{valType:"color",dflt:d},opacity:{valType:"number",min:0,max:1,dflt:1},minzoom:{valType:"number",min:0,max:24,dflt:0},maxzoom:{valType:"number",min:0,max:24,dflt:24},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2},dash:{valType:"data_array"}},fill:{outlinecolor:{valType:"color",dflt:d}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},placement:{valType:"enumerated",values:["point","line","line-center"],dflt:"point"},textfont:n,textposition:u.extendFlat({},t,{arrayOk:!1})}})},"plot","from-root");o.uirevision={valType:"any",editType:"none"}}),Qx=Vt((K,V)=>{var{hovertemplateAttrs:u,texttemplateAttrs:d,templatefallbackAttrs:E}=yl(),A=Jh(),t=L0(),e=dc(),r=jv(),i=kl(),n=Wl(),o=So().extendFlat,a=Cu().overrideAll,s=jv(),f=t.line,v=t.marker;V.exports=a({lon:t.lon,lat:t.lat,cluster:{enabled:{valType:"boolean"},maxzoom:o({},s.layers.maxzoom,{}),step:{valType:"number",arrayOk:!0,dflt:-1,min:-1},size:{valType:"number",arrayOk:!0,dflt:20,min:0},color:{valType:"color",arrayOk:!0},opacity:o({},v.opacity,{dflt:1})},mode:o({},e.mode,{dflt:"markers"}),text:o({},e.text,{}),texttemplate:d({editType:"plot"},{keys:["lat","lon","text"]}),texttemplatefallback:E({editType:"plot"}),hovertext:o({},e.hovertext,{}),line:{color:f.color,width:f.width},connectgaps:e.connectgaps,marker:o({symbol:{valType:"string",dflt:"circle",arrayOk:!0},angle:{valType:"number",dflt:"auto",arrayOk:!0},allowoverlap:{valType:"boolean",dflt:!1},opacity:v.opacity,size:v.size,sizeref:v.sizeref,sizemin:v.sizemin,sizemode:v.sizemode},n("marker")),fill:t.fill,fillcolor:A(),textfont:r.layers.symbol.textfont,textposition:r.layers.symbol.textposition,below:{valType:"string"},selected:{marker:e.selected.marker},unselected:{marker:e.unselected.marker},hoverinfo:o({},i.hoverinfo,{flags:["lon","lat","text","name"]}),hovertemplate:u(),hovertemplatefallback:E()},"calc","nested")}),F5=Vt((K,V)=>{var u=["Metropolis Black Italic","Metropolis Black","Metropolis Bold Italic","Metropolis Bold","Metropolis Extra Bold Italic","Metropolis Extra Bold","Metropolis Extra Light Italic","Metropolis Extra Light","Metropolis Light Italic","Metropolis Light","Metropolis Medium Italic","Metropolis Medium","Metropolis Regular Italic","Metropolis Regular","Metropolis Semi Bold Italic","Metropolis Semi Bold","Metropolis Thin Italic","Metropolis Thin","Open Sans Bold Italic","Open Sans Bold","Open Sans Extrabold Italic","Open Sans Extrabold","Open Sans Italic","Open Sans Light Italic","Open Sans Light","Open Sans Regular","Open Sans Semibold Italic","Open Sans Semibold","Klokantech Noto Sans Bold","Klokantech Noto Sans CJK Bold","Klokantech Noto Sans CJK Regular","Klokantech Noto Sans Italic","Klokantech Noto Sans Regular"];V.exports={isSupportedFont:function(d){return u.indexOf(d)!==-1}}}),kz=Vt((K,V)=>{var u=Xr(),d=nu(),E=Lh(),A=Bh(),t=Rh(),e=tp(),r=Qx(),i=F5().isSupportedFont;V.exports=function(o,a,s,f){function v(h,b){return u.coerce(o,a,r,h,b)}function g(h,b){return u.coerce2(o,a,r,h,b)}var m=n(o,a,v);if(!m){a.visible=!1;return}if(v("text"),v("texttemplate"),v("texttemplatefallback"),v("hovertext"),v("hovertemplate"),v("hovertemplatefallback"),v("mode"),v("below"),d.hasMarkers(a)){E(o,a,s,f,v,{noLine:!0,noAngle:!0}),v("marker.allowoverlap"),v("marker.angle");var w=a.marker;w.symbol!=="circle"&&(u.isArrayOrTypedArray(w.size)&&(w.size=w.size[0]),u.isArrayOrTypedArray(w.color)&&(w.color=w.color[0]))}d.hasLines(a)&&(A(o,a,s,f,v,{noDash:!0}),v("connectgaps"));var l=g("cluster.maxzoom"),x=g("cluster.step"),y=g("cluster.color",a.marker&&a.marker.color||s),S=g("cluster.size"),k=g("cluster.opacity"),M=l!==!1||x!==!1||y!==!1||S!==!1||k!==!1,T=v("cluster.enabled",M);if(T||d.hasText(a)){var c=f.font.family;t(o,a,f,v,{noSelect:!0,noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0,font:{family:i(c)?c:"Open Sans Regular",weight:f.font.weight,style:f.font.style,size:f.font.size,color:f.font.color}})}v("fill"),a.fill!=="none"&&e(o,a,s,v),u.coerceSelectionMarkerOpacity(a,v)};function n(o,a,s){var f=s("lon")||[],v=s("lat")||[],g=Math.min(f.length,v.length);return a._length=g,g}}),B5=Vt((K,V)=>{var u=yo();V.exports=function(d,E,A){var t={},e=A[E.subplot]._subplot,r=e.mockAxis,i=d.lonlat;return t.lonLabel=u.tickText(r,r.c2l(i[0]),!0).text,t.latLabel=u.tickText(r,r.c2l(i[1]),!0).text,t}}),R5=Vt((K,V)=>{var u=Xr();V.exports=function(d,E){var A=d.split(" "),t=A[0],e=A[1],r=u.isArrayOrTypedArray(E)?u.mean(E):E,i=.5+r/100,n=1.5+r/100,o=["",""],a=[0,0];switch(t){case"top":o[0]="top",a[1]=-n;break;case"bottom":o[0]="bottom",a[1]=n;break}switch(e){case"left":o[1]="right",a[0]=-i;break;case"right":o[1]="left",a[0]=i;break}var s;return o[0]&&o[1]?s=o.join("-"):o[0]?s=o[0]:o[1]?s=o[1]:s="center",{anchor:s,offset:a}}}),Az=Vt((K,V)=>{var u=Lo(),d=Xr(),E=ks().BADNUM,A=Ud(),t=xu(),e=Eo(),r=Tm(),i=nu(),n=F5().isSupportedFont,o=R5(),a=mh().appendArrayPointValue,s=Dl().NEWLINES,f=Dl().BR_TAG_ALL;V.exports=function(k,M){var T=M[0].trace,c=T.visible===!0&&T._length!==0,h=T.fill!=="none",b=i.hasLines(T),_=i.hasMarkers(T),P=i.hasText(T),z=_&&T.marker.symbol==="circle",D=_&&T.marker.symbol!=="circle",B=T.cluster&&T.cluster.enabled,R=v("fill"),I=v("line"),F=v("circle"),j=v("symbol"),N={fill:R,line:I,circle:F,symbol:j};if(!c)return N;var G;if((h||b)&&(G=A.calcTraceToLineCoords(M)),h&&(R.geojson=A.makePolygon(G),R.layout.visibility="visible",d.extendFlat(R.paint,{"fill-color":T.fillcolor})),b&&(I.geojson=A.makeLine(G),I.layout.visibility="visible",d.extendFlat(I.paint,{"line-width":T.line.width,"line-color":T.line.color,"line-opacity":T.opacity})),z){var rt=g(M);F.geojson=rt.geojson,F.layout.visibility="visible",B&&(F.filter=["!",["has","point_count"]],N.cluster={type:"circle",filter:["has","point_count"],layout:{visibility:"visible"},paint:{"circle-color":y(T.cluster.color,T.cluster.step),"circle-radius":y(T.cluster.size,T.cluster.step),"circle-opacity":y(T.cluster.opacity,T.cluster.step)}},N.clusterCount={type:"symbol",filter:["has","point_count"],paint:{},layout:{"text-field":"{point_count_abbreviated}","text-font":S(T),"text-size":12}}),d.extendFlat(F.paint,{"circle-color":rt.mcc,"circle-radius":rt.mrc,"circle-opacity":rt.mo})}if(z&&B&&(F.filter=["!",["has","point_count"]]),(D||P)&&(j.geojson=m(M,k),d.extendFlat(j.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),D&&(d.extendFlat(j.layout,{"icon-size":T.marker.size/10}),"angle"in T.marker&&T.marker.angle!=="auto"&&d.extendFlat(j.layout,{"icon-rotate":{type:"identity",property:"angle"},"icon-rotation-alignment":"map"}),j.layout["icon-allow-overlap"]=T.marker.allowoverlap,d.extendFlat(j.paint,{"icon-opacity":T.opacity*T.marker.opacity,"icon-color":T.marker.color})),P)){var ct=(T.marker||{}).size,st=o(T.textposition,ct);d.extendFlat(j.layout,{"text-size":T.textfont.size,"text-anchor":st.anchor,"text-offset":st.offset,"text-font":S(T)}),d.extendFlat(j.paint,{"text-color":T.textfont.color,"text-opacity":T.opacity})}return N};function v(k){return{type:k,geojson:A.makeBlank(),layout:{visibility:"none"},filter:null,paint:{}}}function g(k){var M=k[0].trace,T=M.marker,c=M.selectedpoints,h=d.isArrayOrTypedArray(T.color),b=d.isArrayOrTypedArray(T.size),_=d.isArrayOrTypedArray(T.opacity),P;function z(st){return M.opacity*st}function D(st){return st/2}var B;h&&(t.hasColorscale(M,"marker")?B=t.makeColorScaleFuncFromTrace(T):B=d.identity);var R;b&&(R=r(M));var I;_&&(I=function(st){var et=u(st)?+d.constrain(st,0,1):0;return z(et)});var F=[];for(P=0;P850?P+=" Black":h>750?P+=" Extra Bold":h>650?P+=" Bold":h>550?P+=" Semi Bold":h>450?P+=" Medium":h>350?P+=" Regular":h>250?P+=" Light":h>150?P+=" Extra Light":P+=" Thin"):b.slice(0,2).join(" ")==="Open Sans"?(P="Open Sans",h>750?P+=" Extrabold":h>650?P+=" Bold":h>550?P+=" Semibold":h>350?P+=" Regular":P+=" Light"):b.slice(0,3).join(" ")==="Klokantech Noto Sans"&&(P="Klokantech Noto Sans",b[3]==="CJK"&&(P+=" CJK"),P+=h>500?" Bold":" Regular")),_&&(P+=" Italic"),P==="Open Sans Regular Italic"?P="Open Sans Italic":P==="Open Sans Regular Bold"?P="Open Sans Bold":P==="Open Sans Regular Bold Italic"?P="Open Sans Bold Italic":P==="Klokantech Noto Sans Regular Italic"&&(P="Klokantech Noto Sans Italic"),n(P)||(P=T);var z=P.split(", ");return z}}),Mz=Vt((K,V)=>{var u=Xr(),d=Az(),E=Gd().traceLayerPrefix,A={cluster:["cluster","clusterCount","circle"],nonCluster:["fill","line","circle","symbol"]};function t(r,i,n,o){this.type="scattermap",this.subplot=r,this.uid=i,this.clusterEnabled=n,this.isHidden=o,this.sourceIds={fill:"source-"+i+"-fill",line:"source-"+i+"-line",circle:"source-"+i+"-circle",symbol:"source-"+i+"-symbol",cluster:"source-"+i+"-circle",clusterCount:"source-"+i+"-circle"},this.layerIds={fill:E+i+"-fill",line:E+i+"-line",circle:E+i+"-circle",symbol:E+i+"-symbol",cluster:E+i+"-cluster",clusterCount:E+i+"-cluster-count"},this.below=null}var e=t.prototype;e.addSource=function(r,i,n){var o={type:"geojson",data:i.geojson};n&&n.enabled&&u.extendFlat(o,{cluster:!0,clusterMaxZoom:n.maxzoom});var a=this.subplot.map.getSource(this.sourceIds[r]);a?a.setData(i.geojson):this.subplot.map.addSource(this.sourceIds[r],o)},e.setSourceData=function(r,i){this.subplot.map.getSource(this.sourceIds[r]).setData(i.geojson)},e.addLayer=function(r,i,n){var o={type:i.type,id:this.layerIds[r],source:this.sourceIds[r],layout:i.layout,paint:i.paint};i.filter&&(o.filter=i.filter);for(var a=this.layerIds[r],s,f=this.subplot.getMapLayers(),v=0;v=0;b--){var _=h[b];o.removeLayer(g.layerIds[_])}c||o.removeSource(g.sourceIds.circle)}function l(c){for(var h=A.nonCluster,b=0;b=0;b--){var _=h[b];o.removeLayer(g.layerIds[_]),c||o.removeSource(g.sourceIds[_])}}function y(c){v?w(c):x(c)}function S(c){f?m(c):l(c)}function k(){for(var c=f?A.cluster:A.nonCluster,h=0;h=0;n--){var o=i[n];r.removeLayer(this.layerIds[o]),r.removeSource(this.sourceIds[o])}},V.exports=function(r,i){var n=i[0].trace,o=n.cluster&&n.cluster.enabled,a=n.visible!==!0,s=new t(r,n.uid,o,a),f=d(r.gd,i),v=s.below=r.belowLookup["trace-"+n.uid],g,m,w;if(o)for(s.addSource("circle",f.circle,n.cluster),g=0;g{var u=pc(),d=Xr(),E=zm(),A=d.fillText,t=ks().BADNUM,e=Gd().traceLayerPrefix;function r(n,o,a){var s=n.cd,f=s[0].trace,v=n.xa,g=n.ya,m=n.subplot,w=[],l=e+f.uid+"-circle",x=f.cluster&&f.cluster.enabled;if(x){var y=m.map.queryRenderedFeatures(null,{layers:[l]});w=y.map(function(R){return R.id})}var S=o>=0?Math.floor((o+180)/360):Math.ceil((o-180)/360),k=S*360,M=o-k;function T(R){var I=R.lonlat;if(I[0]===t||x&&w.indexOf(R.i+1)===-1)return 1/0;var F=d.modHalf(I[0],360),j=I[1],N=m.project([F,j]),G=N.x-v.c2p([M,j]),rt=N.y-g.c2p([F,a]),ct=Math.max(3,R.mrc||0);return Math.max(Math.sqrt(G*G+rt*rt)-ct,1-3/ct)}if(u.getClosest(s,T,n),n.index!==!1){var c=s[n.index],h=c.lonlat,b=[d.modHalf(h[0],360)+k,h[1]],_=v.c2p(b),P=g.c2p(b),z=c.mrc||1;n.x0=_-z,n.x1=_+z,n.y0=P-z,n.y1=P+z;var D={};D[f.subplot]={_subplot:m};var B=f._module.formatLabels(c,f,D);return n.lonLabel=B.lonLabel,n.latLabel=B.latLabel,n.color=E(f,c),n.extraText=i(f,c,s[0].t.labels),n.hovertemplate=f.hovertemplate,[n]}}function i(n,o,a){if(n.hovertemplate)return;var s=o.hi||n.hoverinfo,f=s.split("+"),v=f.indexOf("all")!==-1,g=f.indexOf("lon")!==-1,m=f.indexOf("lat")!==-1,w=o.lonlat,l=[];function x(y){return y+"°"}return v||g&&m?l.push("("+x(w[1])+", "+x(w[0])+")"):g?l.push(a.lon+x(w[0])):m&&l.push(a.lat+x(w[1])),(v||f.indexOf("text")!==-1)&&A(o,n,l),l.join("
          ")}V.exports={hoverPoints:r,getExtraText:i}}),Sz=Vt((K,V)=>{V.exports=function(u,d){return u.lon=d.lon,u.lat=d.lat,u}}),Ez=Vt((K,V)=>{var u=Xr(),d=nu(),E=ks().BADNUM;V.exports=function(A,t){var e=A.cd,r=A.xaxis,i=A.yaxis,n=[],o=e[0].trace,a;if(!d.hasMarkers(o))return[];if(t===!1)for(a=0;a{(function(u,d){typeof K=="object"&&typeof V<"u"?V.exports=d():(u=typeof globalThis<"u"?globalThis:u||self,u.maplibregl=d())})(K,function(){var u={},d={};function E(t,e,r){if(d[t]=r,t==="index"){var i="var sharedModule = {}; ("+d.shared+")(sharedModule); ("+d.worker+")(sharedModule);",n={};return d.shared(n),d.index(u,n),typeof window<"u"&&u.setWorkerUrl(window.URL.createObjectURL(new Blob([i],{type:"text/javascript"}))),u}}E("shared",["exports"],function(t){function e(H,C,$,ht){return new($||($=Promise))(function(Mt,Bt){function jt(Be){try{be(ht.next(Be))}catch(Qe){Bt(Qe)}}function oe(Be){try{be(ht.throw(Be))}catch(Qe){Bt(Qe)}}function be(Be){var Qe;Be.done?Mt(Be.value):(Qe=Be.value,Qe instanceof $?Qe:new $(function(lr){lr(Qe)})).then(jt,oe)}be((ht=ht.apply(H,C||[])).next())})}function r(H){return H&&H.__esModule&&Object.prototype.hasOwnProperty.call(H,"default")?H.default:H}typeof SuppressedError=="function"&&SuppressedError;var i=n;function n(H,C){this.x=H,this.y=C}n.prototype={clone:function(){return new n(this.x,this.y)},add:function(H){return this.clone()._add(H)},sub:function(H){return this.clone()._sub(H)},multByPoint:function(H){return this.clone()._multByPoint(H)},divByPoint:function(H){return this.clone()._divByPoint(H)},mult:function(H){return this.clone()._mult(H)},div:function(H){return this.clone()._div(H)},rotate:function(H){return this.clone()._rotate(H)},rotateAround:function(H,C){return this.clone()._rotateAround(H,C)},matMult:function(H){return this.clone()._matMult(H)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(H){return this.x===H.x&&this.y===H.y},dist:function(H){return Math.sqrt(this.distSqr(H))},distSqr:function(H){var C=H.x-this.x,$=H.y-this.y;return C*C+$*$},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(H){return Math.atan2(this.y-H.y,this.x-H.x)},angleWith:function(H){return this.angleWithSep(H.x,H.y)},angleWithSep:function(H,C){return Math.atan2(this.x*C-this.y*H,this.x*H+this.y*C)},_matMult:function(H){var C=H[2]*this.x+H[3]*this.y;return this.x=H[0]*this.x+H[1]*this.y,this.y=C,this},_add:function(H){return this.x+=H.x,this.y+=H.y,this},_sub:function(H){return this.x-=H.x,this.y-=H.y,this},_mult:function(H){return this.x*=H,this.y*=H,this},_div:function(H){return this.x/=H,this.y/=H,this},_multByPoint:function(H){return this.x*=H.x,this.y*=H.y,this},_divByPoint:function(H){return this.x/=H.x,this.y/=H.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var H=this.y;return this.y=this.x,this.x=-H,this},_rotate:function(H){var C=Math.cos(H),$=Math.sin(H),ht=$*this.x+C*this.y;return this.x=C*this.x-$*this.y,this.y=ht,this},_rotateAround:function(H,C){var $=Math.cos(H),ht=Math.sin(H),Mt=C.y+ht*(this.x-C.x)+$*(this.y-C.y);return this.x=C.x+$*(this.x-C.x)-ht*(this.y-C.y),this.y=Mt,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(H){return H instanceof n?H:Array.isArray(H)?new n(H[0],H[1]):H};var o=r(i),a=s;function s(H,C,$,ht){this.cx=3*H,this.bx=3*($-H)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*C,this.by=3*(ht-C)-this.cy,this.ay=1-this.cy-this.by,this.p1x=H,this.p1y=C,this.p2x=$,this.p2y=ht}s.prototype={sampleCurveX:function(H){return((this.ax*H+this.bx)*H+this.cx)*H},sampleCurveY:function(H){return((this.ay*H+this.by)*H+this.cy)*H},sampleCurveDerivativeX:function(H){return(3*this.ax*H+2*this.bx)*H+this.cx},solveCurveX:function(H,C){if(C===void 0&&(C=1e-6),H<0)return 0;if(H>1)return 1;for(var $=H,ht=0;ht<8;ht++){var Mt=this.sampleCurveX($)-H;if(Math.abs(Mt)Mt?jt=$:oe=$,$=.5*(oe-jt)+jt;return $},solve:function(H,C){return this.sampleCurveY(this.solveCurveX(H,C))}};var f=r(a);let v,g;function m(){return v==null&&(v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),v}function w(){if(g==null&&(g=!1,m())){let H=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(H){for(let $=0;$<25;$++){let ht=4*$;H.fillStyle=`rgb(${ht},${ht+1},${ht+2})`,H.fillRect($%5,Math.floor($/5),1,1)}let C=H.getImageData(0,0,5,5).data;for(let $=0;$<100;$++)if($%4!=3&&C[$]!==$){g=!0;break}}}return g||!1}function l(H,C,$,ht){let Mt=new f(H,C,$,ht);return Bt=>Mt.solve(Bt)}let x=l(.25,.1,.25,1);function y(H,C,$){return Math.min($,Math.max(C,H))}function S(H,C,$){let ht=$-C,Mt=((H-C)%ht+ht)%ht+C;return Mt===C?$:Mt}function k(H,...C){for(let $ of C)for(let ht in $)H[ht]=$[ht];return H}let M=1;function T(H,C,$){let ht={};for(let Mt in H)ht[Mt]=C.call(this,H[Mt],Mt,H);return ht}function c(H,C,$){let ht={};for(let Mt in H)C.call(this,H[Mt],Mt,H)&&(ht[Mt]=H[Mt]);return ht}function h(H){return Array.isArray(H)?H.map(h):typeof H=="object"&&H?T(H,h):H}let b={};function _(H){b[H]||(typeof console<"u"&&console.warn(H),b[H]=!0)}function P(H,C,$){return($.y-H.y)*(C.x-H.x)>(C.y-H.y)*($.x-H.x)}function z(H){return typeof WorkerGlobalScope<"u"&&H!==void 0&&H instanceof WorkerGlobalScope}let D=null;function B(H){return typeof ImageBitmap<"u"&&H instanceof ImageBitmap}let R="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function I(H,C,$,ht,Mt){return e(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let Bt=new VideoFrame(H,{timestamp:0});try{let jt=Bt?.format;if(!jt||!jt.startsWith("BGR")&&!jt.startsWith("RGB"))throw new Error(`Unrecognized format ${jt}`);let oe=jt.startsWith("BGR"),be=new Uint8ClampedArray(ht*Mt*4);if(yield Bt.copyTo(be,(function(Be,Qe,lr,wr,Fr){let Zr=4*Math.max(-Qe,0),en=(Math.max(0,lr)-lr)*wr*4+Zr,yn=4*wr,Vn=Math.max(0,Qe),Ca=Math.max(0,lr);return{rect:{x:Vn,y:Ca,width:Math.min(Be.width,Qe+wr)-Vn,height:Math.min(Be.height,lr+Fr)-Ca},layout:[{offset:en,stride:yn}]}})(H,C,$,ht,Mt)),oe)for(let Be=0;Bez(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,ot=function(H,C){if(/:\/\//.test(H.url)&&!/^https?:|^file:/.test(H.url)){let ht=ct(H.url);if(ht)return ht(H,C);if(z(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:H,targetMapId:st},C)}if(!(/^file:/.test($=H.url)||/^file:/.test(Z())&&!/^\w+:/.test($))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(ht,Mt){return e(this,void 0,void 0,function*(){let Bt=new Request(ht.url,{method:ht.method||"GET",body:ht.body,credentials:ht.credentials,headers:ht.headers,cache:ht.cache,referrer:Z(),signal:Mt.signal});ht.type!=="json"||Bt.headers.has("Accept")||Bt.headers.set("Accept","application/json");let jt=yield fetch(Bt);if(!jt.ok){let Be=yield jt.blob();throw new et(jt.status,jt.statusText,ht.url,Be)}let oe;oe=ht.type==="arrayBuffer"||ht.type==="image"?jt.arrayBuffer():ht.type==="json"?jt.json():jt.text();let be=yield oe;if(Mt.signal.aborted)throw G();return{data:be,cacheControl:jt.headers.get("Cache-Control"),expires:jt.headers.get("Expires")}})})(H,C);if(z(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:H,mustQueue:!0,targetMapId:st},C)}var $;return(function(ht,Mt){return new Promise((Bt,jt)=>{var oe;let be=new XMLHttpRequest;be.open(ht.method||"GET",ht.url,!0),ht.type!=="arrayBuffer"&&ht.type!=="image"||(be.responseType="arraybuffer");for(let Be in ht.headers)be.setRequestHeader(Be,ht.headers[Be]);ht.type==="json"&&(be.responseType="text",!((oe=ht.headers)===null||oe===void 0)&&oe.Accept||be.setRequestHeader("Accept","application/json")),be.withCredentials=ht.credentials==="include",be.onerror=()=>{jt(new Error(be.statusText))},be.onload=()=>{if(!Mt.signal.aborted)if((be.status>=200&&be.status<300||be.status===0)&&be.response!==null){let Be=be.response;if(ht.type==="json")try{Be=JSON.parse(be.response)}catch(Qe){return void jt(Qe)}Bt({data:Be,cacheControl:be.getResponseHeader("Cache-Control"),expires:be.getResponseHeader("Expires")})}else{let Be=new Blob([be.response],{type:be.getResponseHeader("Content-Type")});jt(new et(be.status,be.statusText,ht.url,Be))}},Mt.signal.addEventListener("abort",()=>{be.abort(),jt(G())}),be.send(ht.body)})})(H,C)};function X(H){if(!H||H.indexOf("://")<=0||H.indexOf("data:image/")===0||H.indexOf("blob:")===0)return!0;let C=new URL(H),$=window.location;return C.protocol===$.protocol&&C.host===$.host}function Q(H,C,$){$[H]&&$[H].indexOf(C)!==-1||($[H]=$[H]||[],$[H].push(C))}function ut(H,C,$){if($&&$[H]){let ht=$[H].indexOf(C);ht!==-1&&$[H].splice(ht,1)}}class J{constructor(C,$={}){k(this,$),this.type=C}}class q extends J{constructor(C,$={}){super("error",k({error:C},$))}}class it{on(C,$){return this._listeners=this._listeners||{},Q(C,$,this._listeners),this}off(C,$){return ut(C,$,this._listeners),ut(C,$,this._oneTimeListeners),this}once(C,$){return $?(this._oneTimeListeners=this._oneTimeListeners||{},Q(C,$,this._oneTimeListeners),this):new Promise(ht=>this.once(C,ht))}fire(C,$){typeof C=="string"&&(C=new J(C,$||{}));let ht=C.type;if(this.listens(ht)){C.target=this;let Mt=this._listeners&&this._listeners[ht]?this._listeners[ht].slice():[];for(let oe of Mt)oe.call(this,C);let Bt=this._oneTimeListeners&&this._oneTimeListeners[ht]?this._oneTimeListeners[ht].slice():[];for(let oe of Bt)ut(ht,oe,this._oneTimeListeners),oe.call(this,C);let jt=this._eventedParent;jt&&(k(C,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),jt.fire(C))}else C instanceof q&&console.error(C.error);return this}listens(C){return this._listeners&&this._listeners[C]&&this._listeners[C].length>0||this._oneTimeListeners&&this._oneTimeListeners[C]&&this._oneTimeListeners[C].length>0||this._eventedParent&&this._eventedParent.listens(C)}setEventedParent(C,$){return this._eventedParent=C,this._eventedParentData=$,this}}var nt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};let dt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Tt(H,C){let $={};for(let ht in H)ht!=="ref"&&($[ht]=H[ht]);return dt.forEach(ht=>{ht in C&&($[ht]=C[ht])}),$}function wt(H,C){if(Array.isArray(H)){if(!Array.isArray(C)||H.length!==C.length)return!1;for(let $=0;$`:H.itemType.kind==="value"?"array":`array<${C}>`}return H.kind}let _t=[Kt,ue,Me,Ce,We,er,qe,Dt(vr),Mr,Ir,de];function lt(H,C){if(C.kind==="error")return null;if(H.kind==="array"){if(C.kind==="array"&&(C.N===0&&C.itemType.kind==="value"||!lt(H.itemType,C.itemType))&&(typeof H.N!="number"||H.N===C.N))return null}else{if(H.kind===C.kind)return null;if(H.kind==="value"){for(let $ of _t)if(!lt($,C))return null}}return`Expected ${qt(H)} but found ${qt(C)} instead.`}function yt(H,C){return C.some($=>$.kind===H.kind)}function St(H,C){return C.some($=>$==="null"?H===null:$==="array"?Array.isArray(H):$==="object"?H&&!Array.isArray(H)&&typeof H=="object":$===typeof H)}function Ht(H,C){return H.kind==="array"&&C.kind==="array"?H.itemType.kind===C.itemType.kind&&typeof H.N=="number":H.kind===C.kind}let Yt=.96422,se=.82521,ke=4/29,Ee=6/29,Ue=3*Ee*Ee,ir=Ee*Ee*Ee,ar=Math.PI/180,Ye=180/Math.PI;function Er(H){return(H%=360)<0&&(H+=360),H}function pn([H,C,$,ht]){let Mt,Bt,jt=bn((.2225045*(H=dn(H))+.7168786*(C=dn(C))+.0606169*($=dn($)))/1);H===C&&C===$?Mt=Bt=jt:(Mt=bn((.4360747*H+.3850649*C+.1430804*$)/Yt),Bt=bn((.0139322*H+.0971045*C+.7141733*$)/se));let oe=116*jt-16;return[oe<0?0:oe,500*(Mt-jt),200*(jt-Bt),ht]}function dn(H){return H<=.04045?H/12.92:Math.pow((H+.055)/1.055,2.4)}function bn(H){return H>ir?Math.pow(H,1/3):H/Ue+ke}function Zn([H,C,$,ht]){let Mt=(H+16)/116,Bt=isNaN(C)?Mt:Mt+C/500,jt=isNaN($)?Mt:Mt-$/200;return Mt=1*gn(Mt),Bt=Yt*gn(Bt),jt=se*gn(jt),[En(3.1338561*Bt-1.6168667*Mt-.4906146*jt),En(-.9787684*Bt+1.9161415*Mt+.033454*jt),En(.0719453*Bt-.2289914*Mt+1.4052427*jt),ht]}function En(H){return(H=H<=.00304?12.92*H:1.055*Math.pow(H,1/2.4)-.055)<0?0:H>1?1:H}function gn(H){return H>Ee?H*H*H:Ue*(H-ke)}function da(H){return parseInt(H.padEnd(2,H),16)/255}function ra(H,C){return Se(C?H/100:H,0,1)}function Se(H,C,$){return Math.min(Math.max(C,H),$)}function Re(H){return!H.some(Number.isNaN)}let Ze={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class tr{constructor(C,$,ht,Mt=1,Bt=!0){this.r=C,this.g=$,this.b=ht,this.a=Mt,Bt||(this.r*=Mt,this.g*=Mt,this.b*=Mt,Mt||this.overwriteGetter("rgb",[C,$,ht,Mt]))}static parse(C){if(C instanceof tr)return C;if(typeof C!="string")return;let $=(function(ht){if((ht=ht.toLowerCase().trim())==="transparent")return[0,0,0,0];let Mt=Ze[ht];if(Mt){let[jt,oe,be]=Mt;return[jt/255,oe/255,be/255,1]}if(ht.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(ht)){let jt=ht.length<6?1:2,oe=1;return[da(ht.slice(oe,oe+=jt)),da(ht.slice(oe,oe+=jt)),da(ht.slice(oe,oe+=jt)),da(ht.slice(oe,oe+jt)||"ff")]}if(ht.startsWith("rgb")){let jt=ht.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(jt){let[oe,be,Be,Qe,lr,wr,Fr,Zr,en,yn,Vn,Ca]=jt,ua=[Qe||" ",Fr||" ",yn].join("");if(ua===" "||ua===" /"||ua===",,"||ua===",,,"){let wa=[Be,wr,en].join(""),Xa=wa==="%%%"?100:wa===""?255:0;if(Xa){let di=[Se(+be/Xa,0,1),Se(+lr/Xa,0,1),Se(+Zr/Xa,0,1),Vn?ra(+Vn,Ca):1];if(Re(di))return di}}return}}let Bt=ht.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(Bt){let[jt,oe,be,Be,Qe,lr,wr,Fr,Zr]=Bt,en=[be||" ",Qe||" ",wr].join("");if(en===" "||en===" /"||en===",,"||en===",,,"){let yn=[+oe,Se(+Be,0,100),Se(+lr,0,100),Fr?ra(+Fr,Zr):1];if(Re(yn))return(function([Vn,Ca,ua,wa]){function Xa(di){let oo=(di+Vn/30)%12,as=Ca*Math.min(ua,1-ua);return ua-as*Math.max(-1,Math.min(oo-3,9-oo,1))}return Vn=Er(Vn),Ca/=100,ua/=100,[Xa(0),Xa(8),Xa(4),wa]})(yn)}}})(C);return $?new tr(...$,!1):void 0}get rgb(){let{r:C,g:$,b:ht,a:Mt}=this,Bt=Mt||1/0;return this.overwriteGetter("rgb",[C/Bt,$/Bt,ht/Bt,Mt])}get hcl(){return this.overwriteGetter("hcl",(function(C){let[$,ht,Mt,Bt]=pn(C),jt=Math.sqrt(ht*ht+Mt*Mt);return[Math.round(1e4*jt)?Er(Math.atan2(Mt,ht)*Ye):NaN,jt,$,Bt]})(this.rgb))}get lab(){return this.overwriteGetter("lab",pn(this.rgb))}overwriteGetter(C,$){return Object.defineProperty(this,C,{value:$}),$}toString(){let[C,$,ht,Mt]=this.rgb;return`rgba(${[C,$,ht].map(Bt=>Math.round(255*Bt)).join(",")},${Mt})`}}tr.black=new tr(0,0,0,1),tr.white=new tr(1,1,1,1),tr.transparent=new tr(0,0,0,0),tr.red=new tr(1,0,0,1);class zr{constructor(C,$,ht){this.sensitivity=C?$?"variant":"case":$?"accent":"base",this.locale=ht,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(C,$){return this.collator.compare(C,$)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class tn{constructor(C,$,ht,Mt,Bt){this.text=C,this.image=$,this.scale=ht,this.fontStack=Mt,this.textColor=Bt}}class Yr{constructor(C){this.sections=C}static fromString(C){return new Yr([new tn(C,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(C=>C.text.length!==0||C.image&&C.image.name.length!==0)}static factory(C){return C instanceof Yr?C:Yr.fromString(C)}toString(){return this.sections.length===0?"":this.sections.map(C=>C.text).join("")}}class $r{constructor(C){this.values=C.slice()}static parse(C){if(C instanceof $r)return C;if(typeof C=="number")return new $r([C,C,C,C]);if(Array.isArray(C)&&!(C.length<1||C.length>4)){for(let $ of C)if(typeof $!="number")return;switch(C.length){case 1:C=[C[0],C[0],C[0],C[0]];break;case 2:C=[C[0],C[1],C[0],C[1]];break;case 3:C=[C[0],C[1],C[2],C[1]]}return new $r(C)}}toString(){return JSON.stringify(this.values)}}let In=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Nn{constructor(C){this.values=C.slice()}static parse(C){if(C instanceof Nn)return C;if(Array.isArray(C)&&!(C.length<1)&&C.length%2==0){for(let $=0;$=0&&H<=255&&typeof C=="number"&&C>=0&&C<=255&&typeof $=="number"&&$>=0&&$<=255?ht===void 0||typeof ht=="number"&&ht>=0&&ht<=1?null:`Invalid rgba value [${[H,C,$,ht].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof ht=="number"?[H,C,$,ht]:[H,C,$]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ia(H){if(H===null||typeof H=="string"||typeof H=="boolean"||typeof H=="number"||H instanceof tr||H instanceof zr||H instanceof Yr||H instanceof $r||H instanceof Nn||H instanceof Kn)return!0;if(Array.isArray(H)){for(let C of H)if(!ia(C))return!1;return!0}if(typeof H=="object"){for(let C in H)if(!ia(H[C]))return!1;return!0}return!1}function Cn(H){if(H===null)return Kt;if(typeof H=="string")return Me;if(typeof H=="boolean")return Ce;if(typeof H=="number")return ue;if(H instanceof tr)return We;if(H instanceof zr)return _r;if(H instanceof Yr)return er;if(H instanceof $r)return Mr;if(H instanceof Nn)return de;if(H instanceof Kn)return Ir;if(Array.isArray(H)){let C=H.length,$;for(let ht of H){let Mt=Cn(ht);if($){if($===Mt)continue;$=vr;break}$=Mt}return Dt($||vr,C)}return qe}function Fa(H){let C=typeof H;return H===null?"":C==="string"||C==="number"||C==="boolean"?String(H):H instanceof tr||H instanceof Yr||H instanceof $r||H instanceof Nn||H instanceof Kn?H.toString():JSON.stringify(H)}class Ga{constructor(C,$){this.type=C,this.value=$}static parse(C,$){if(C.length!==2)return $.error(`'literal' expression requires exactly one argument, but found ${C.length-1} instead.`);if(!ia(C[1]))return $.error("invalid value");let ht=C[1],Mt=Cn(ht),Bt=$.expectedType;return Mt.kind!=="array"||Mt.N!==0||!Bt||Bt.kind!=="array"||typeof Bt.N=="number"&&Bt.N!==0||(Mt=Bt),new Ga(Mt,ht)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ve{constructor(C){this.name="ExpressionEvaluationError",this.message=C}toJSON(){return this.message}}let ge={string:Me,number:ue,boolean:Ce,object:qe};class dr{constructor(C,$){this.type=C,this.args=$}static parse(C,$){if(C.length<2)return $.error("Expected at least one argument.");let ht,Mt=1,Bt=C[0];if(Bt==="array"){let oe,be;if(C.length>2){let Be=C[1];if(typeof Be!="string"||!(Be in ge)||Be==="object")return $.error('The item type argument of "array" must be one of string, number, boolean',1);oe=ge[Be],Mt++}else oe=vr;if(C.length>3){if(C[2]!==null&&(typeof C[2]!="number"||C[2]<0||C[2]!==Math.floor(C[2])))return $.error('The length argument to "array" must be a positive integer literal',2);be=C[2],Mt++}ht=Dt(oe,be)}else{if(!ge[Bt])throw new Error(`Types doesn't contain name = ${Bt}`);ht=ge[Bt]}let jt=[];for(;MtC.outputDefined())}}let br={"to-boolean":Ce,"to-color":We,"to-number":ue,"to-string":Me};class Tr{constructor(C,$){this.type=C,this.args=$}static parse(C,$){if(C.length<2)return $.error("Expected at least one argument.");let ht=C[0];if(!br[ht])throw new Error(`Can't parse ${ht} as it is not part of the known types`);if((ht==="to-boolean"||ht==="to-string")&&C.length!==2)return $.error("Expected one argument.");let Mt=br[ht],Bt=[];for(let jt=1;jt4?`Invalid rbga value ${JSON.stringify($)}: expected an array containing either three or four numeric values.`:$n($[0],$[1],$[2],$[3]),!ht))return new tr($[0]/255,$[1]/255,$[2]/255,$[3])}throw new ve(ht||`Could not parse color from value '${typeof $=="string"?$:JSON.stringify($)}'`)}case"padding":{let $;for(let ht of this.args){$=ht.evaluate(C);let Mt=$r.parse($);if(Mt)return Mt}throw new ve(`Could not parse padding from value '${typeof $=="string"?$:JSON.stringify($)}'`)}case"variableAnchorOffsetCollection":{let $;for(let ht of this.args){$=ht.evaluate(C);let Mt=Nn.parse($);if(Mt)return Mt}throw new ve(`Could not parse variableAnchorOffsetCollection from value '${typeof $=="string"?$:JSON.stringify($)}'`)}case"number":{let $=null;for(let ht of this.args){if($=ht.evaluate(C),$===null)return 0;let Mt=Number($);if(!isNaN(Mt))return Mt}throw new ve(`Could not convert ${JSON.stringify($)} to number.`)}case"formatted":return Yr.fromString(Fa(this.args[0].evaluate(C)));case"resolvedImage":return Kn.fromString(Fa(this.args[0].evaluate(C)));default:return Fa(this.args[0].evaluate(C))}}eachChild(C){this.args.forEach(C)}outputDefined(){return this.args.every(C=>C.outputDefined())}}let mr=["Unknown","Point","LineString","Polygon"];class kr{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?mr[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(C){let $=this._parseColorCache[C];return $||($=this._parseColorCache[C]=tr.parse(C)),$}}class Ur{constructor(C,$,ht=[],Mt,Bt=new re,jt=[]){this.registry=C,this.path=ht,this.key=ht.map(oe=>`[${oe}]`).join(""),this.scope=Bt,this.errors=jt,this.expectedType=Mt,this._isConstant=$}parse(C,$,ht,Mt,Bt={}){return $?this.concat($,ht,Mt)._parse(C,Bt):this._parse(C,Bt)}_parse(C,$){function ht(Mt,Bt,jt){return jt==="assert"?new dr(Bt,[Mt]):jt==="coerce"?new Tr(Bt,[Mt]):Mt}if(C!==null&&typeof C!="string"&&typeof C!="boolean"&&typeof C!="number"||(C=["literal",C]),Array.isArray(C)){if(C.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let Mt=C[0];if(typeof Mt!="string")return this.error(`Expression name must be a string, but found ${typeof Mt} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let Bt=this.registry[Mt];if(Bt){let jt=Bt.parse(C,this);if(!jt)return null;if(this.expectedType){let oe=this.expectedType,be=jt.type;if(oe.kind!=="string"&&oe.kind!=="number"&&oe.kind!=="boolean"&&oe.kind!=="object"&&oe.kind!=="array"||be.kind!=="value")if(oe.kind!=="color"&&oe.kind!=="formatted"&&oe.kind!=="resolvedImage"||be.kind!=="value"&&be.kind!=="string")if(oe.kind!=="padding"||be.kind!=="value"&&be.kind!=="number"&&be.kind!=="array")if(oe.kind!=="variableAnchorOffsetCollection"||be.kind!=="value"&&be.kind!=="array"){if(this.checkSubtype(oe,be))return null}else jt=ht(jt,oe,$.typeAnnotation||"coerce");else jt=ht(jt,oe,$.typeAnnotation||"coerce");else jt=ht(jt,oe,$.typeAnnotation||"coerce");else jt=ht(jt,oe,$.typeAnnotation||"assert")}if(!(jt instanceof Ga)&&jt.type.kind!=="resolvedImage"&&this._isConstant(jt)){let oe=new kr;try{jt=new Ga(jt.type,jt.evaluate(oe))}catch(be){return this.error(be.message),null}}return jt}return this.error(`Unknown expression "${Mt}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(C===void 0?"'undefined' value invalid. Use null instead.":typeof C=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof C} instead.`)}concat(C,$,ht){let Mt=typeof C=="number"?this.path.concat(C):this.path,Bt=ht?this.scope.concat(ht):this.scope;return new Ur(this.registry,this._isConstant,Mt,$||null,Bt,this.errors)}error(C,...$){let ht=`${this.key}${$.map(Mt=>`[${Mt}]`).join("")}`;this.errors.push(new Ut(ht,C))}checkSubtype(C,$){let ht=lt(C,$);return ht&&this.error(ht),ht}}class Or{constructor(C,$){this.type=$.type,this.bindings=[].concat(C),this.result=$}evaluate(C){return this.result.evaluate(C)}eachChild(C){for(let $ of this.bindings)C($[1]);C(this.result)}static parse(C,$){if(C.length<4)return $.error(`Expected at least 3 arguments, but found ${C.length-1} instead.`);let ht=[];for(let Bt=1;Bt=ht.length)throw new ve(`Array index out of bounds: ${$} > ${ht.length-1}.`);if($!==Math.floor($))throw new ve(`Array index must be an integer, but found ${$} instead.`);return ht[$]}eachChild(C){C(this.index),C(this.input)}outputDefined(){return!1}}class xr{constructor(C,$){this.type=Ce,this.needle=C,this.haystack=$}static parse(C,$){if(C.length!==3)return $.error(`Expected 2 arguments, but found ${C.length-1} instead.`);let ht=$.parse(C[1],1,vr),Mt=$.parse(C[2],2,vr);return ht&&Mt?yt(ht.type,[Ce,Me,ue,Kt,vr])?new xr(ht,Mt):$.error(`Expected first argument to be of type boolean, string, number or null, but found ${qt(ht.type)} instead`):null}evaluate(C){let $=this.needle.evaluate(C),ht=this.haystack.evaluate(C);if(!ht)return!1;if(!St($,["boolean","string","number","null"]))throw new ve(`Expected first argument to be of type boolean, string, number or null, but found ${qt(Cn($))} instead.`);if(!St(ht,["string","array"]))throw new ve(`Expected second argument to be of type array or string, but found ${qt(Cn(ht))} instead.`);return ht.indexOf($)>=0}eachChild(C){C(this.needle),C(this.haystack)}outputDefined(){return!0}}class Gr{constructor(C,$,ht){this.type=ue,this.needle=C,this.haystack=$,this.fromIndex=ht}static parse(C,$){if(C.length<=2||C.length>=5)return $.error(`Expected 3 or 4 arguments, but found ${C.length-1} instead.`);let ht=$.parse(C[1],1,vr),Mt=$.parse(C[2],2,vr);if(!ht||!Mt)return null;if(!yt(ht.type,[Ce,Me,ue,Kt,vr]))return $.error(`Expected first argument to be of type boolean, string, number or null, but found ${qt(ht.type)} instead`);if(C.length===4){let Bt=$.parse(C[3],3,ue);return Bt?new Gr(ht,Mt,Bt):null}return new Gr(ht,Mt)}evaluate(C){let $=this.needle.evaluate(C),ht=this.haystack.evaluate(C);if(!St($,["boolean","string","number","null"]))throw new ve(`Expected first argument to be of type boolean, string, number or null, but found ${qt(Cn($))} instead.`);let Mt;if(this.fromIndex&&(Mt=this.fromIndex.evaluate(C)),St(ht,["string"])){let Bt=ht.indexOf($,Mt);return Bt===-1?-1:[...ht.slice(0,Bt)].length}if(St(ht,["array"]))return ht.indexOf($,Mt);throw new ve(`Expected second argument to be of type array or string, but found ${qt(Cn(ht))} instead.`)}eachChild(C){C(this.needle),C(this.haystack),this.fromIndex&&C(this.fromIndex)}outputDefined(){return!1}}class ln{constructor(C,$,ht,Mt,Bt,jt){this.inputType=C,this.type=$,this.input=ht,this.cases=Mt,this.outputs=Bt,this.otherwise=jt}static parse(C,$){if(C.length<5)return $.error(`Expected at least 4 arguments, but found only ${C.length-1}.`);if(C.length%2!=1)return $.error("Expected an even number of arguments.");let ht,Mt;$.expectedType&&$.expectedType.kind!=="value"&&(Mt=$.expectedType);let Bt={},jt=[];for(let Be=2;BeNumber.MAX_SAFE_INTEGER)return wr.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Zr=="number"&&Math.floor(Zr)!==Zr)return wr.error("Numeric branch labels must be integer values.");if(ht){if(wr.checkSubtype(ht,Cn(Zr)))return null}else ht=Cn(Zr);if(Bt[String(Zr)]!==void 0)return wr.error("Branch labels must be unique.");Bt[String(Zr)]=jt.length}let Fr=$.parse(lr,Be,Mt);if(!Fr)return null;Mt=Mt||Fr.type,jt.push(Fr)}let oe=$.parse(C[1],1,vr);if(!oe)return null;let be=$.parse(C[C.length-1],C.length-1,Mt);return be?oe.type.kind!=="value"&&$.concat(1).checkSubtype(ht,oe.type)?null:new ln(ht,Mt,oe,Bt,jt,be):null}evaluate(C){let $=this.input.evaluate(C);return(Cn($)===this.inputType&&this.outputs[this.cases[$]]||this.otherwise).evaluate(C)}eachChild(C){C(this.input),this.outputs.forEach(C),C(this.otherwise)}outputDefined(){return this.outputs.every(C=>C.outputDefined())&&this.otherwise.outputDefined()}}class wn{constructor(C,$,ht){this.type=C,this.branches=$,this.otherwise=ht}static parse(C,$){if(C.length<4)return $.error(`Expected at least 3 arguments, but found only ${C.length-1}.`);if(C.length%2!=0)return $.error("Expected an odd number of arguments.");let ht;$.expectedType&&$.expectedType.kind!=="value"&&(ht=$.expectedType);let Mt=[];for(let jt=1;jt$.outputDefined())&&this.otherwise.outputDefined()}}class rn{constructor(C,$,ht,Mt){this.type=C,this.input=$,this.beginIndex=ht,this.endIndex=Mt}static parse(C,$){if(C.length<=2||C.length>=5)return $.error(`Expected 3 or 4 arguments, but found ${C.length-1} instead.`);let ht=$.parse(C[1],1,vr),Mt=$.parse(C[2],2,ue);if(!ht||!Mt)return null;if(!yt(ht.type,[Dt(vr),Me,vr]))return $.error(`Expected first argument to be of type array or string, but found ${qt(ht.type)} instead`);if(C.length===4){let Bt=$.parse(C[3],3,ue);return Bt?new rn(ht.type,ht,Mt,Bt):null}return new rn(ht.type,ht,Mt)}evaluate(C){let $=this.input.evaluate(C),ht=this.beginIndex.evaluate(C),Mt;if(this.endIndex&&(Mt=this.endIndex.evaluate(C)),St($,["string"]))return[...$].slice(ht,Mt).join("");if(St($,["array"]))return $.slice(ht,Mt);throw new ve(`Expected first argument to be of type array or string, but found ${qt(Cn($))} instead.`)}eachChild(C){C(this.input),C(this.beginIndex),this.endIndex&&C(this.endIndex)}outputDefined(){return!1}}function Qr(H,C){let $=H.length-1,ht,Mt,Bt=0,jt=$,oe=0;for(;Bt<=jt;)if(oe=Math.floor((Bt+jt)/2),ht=H[oe],Mt=H[oe+1],ht<=C){if(oe===$||CC))throw new ve("Input is not a number.");jt=oe-1}return 0}class vn{constructor(C,$,ht){this.type=C,this.input=$,this.labels=[],this.outputs=[];for(let[Mt,Bt]of ht)this.labels.push(Mt),this.outputs.push(Bt)}static parse(C,$){if(C.length-1<4)return $.error(`Expected at least 4 arguments, but found only ${C.length-1}.`);if((C.length-1)%2!=0)return $.error("Expected an even number of arguments.");let ht=$.parse(C[1],1,ue);if(!ht)return null;let Mt=[],Bt=null;$.expectedType&&$.expectedType.kind!=="value"&&(Bt=$.expectedType);for(let jt=1;jt=oe)return $.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',Be);let lr=$.parse(be,Qe,Bt);if(!lr)return null;Bt=Bt||lr.type,Mt.push([oe,lr])}return new vn(Bt,ht,Mt)}evaluate(C){let $=this.labels,ht=this.outputs;if($.length===1)return ht[0].evaluate(C);let Mt=this.input.evaluate(C);if(Mt<=$[0])return ht[0].evaluate(C);let Bt=$.length;return Mt>=$[Bt-1]?ht[Bt-1].evaluate(C):ht[Qr($,Mt)].evaluate(C)}eachChild(C){C(this.input);for(let $ of this.outputs)C($)}outputDefined(){return this.outputs.every(C=>C.outputDefined())}}function Oa(H){return H&&H.__esModule&&Object.prototype.hasOwnProperty.call(H,"default")?H.default:H}var Qn=Qa;function Qa(H,C,$,ht){this.cx=3*H,this.bx=3*($-H)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*C,this.by=3*(ht-C)-this.cy,this.ay=1-this.cy-this.by,this.p1x=H,this.p1y=C,this.p2x=$,this.p2y=ht}Qa.prototype={sampleCurveX:function(H){return((this.ax*H+this.bx)*H+this.cx)*H},sampleCurveY:function(H){return((this.ay*H+this.by)*H+this.cy)*H},sampleCurveDerivativeX:function(H){return(3*this.ax*H+2*this.bx)*H+this.cx},solveCurveX:function(H,C){if(C===void 0&&(C=1e-6),H<0)return 0;if(H>1)return 1;for(var $=H,ht=0;ht<8;ht++){var Mt=this.sampleCurveX($)-H;if(Math.abs(Mt)Mt?jt=$:oe=$,$=.5*(oe-jt)+jt;return $},solve:function(H,C){return this.sampleCurveY(this.solveCurveX(H,C))}};var Ja=Oa(Qn);function wi(H,C,$){return H+$*(C-H)}function ci(H,C,$){return H.map((ht,Mt)=>wi(ht,C[Mt],$))}let Ti={number:wi,color:function(H,C,$,ht="rgb"){switch(ht){case"rgb":{let[Mt,Bt,jt,oe]=ci(H.rgb,C.rgb,$);return new tr(Mt,Bt,jt,oe,!1)}case"hcl":{let[Mt,Bt,jt,oe]=H.hcl,[be,Be,Qe,lr]=C.hcl,wr,Fr;if(isNaN(Mt)||isNaN(be))isNaN(Mt)?isNaN(be)?wr=NaN:(wr=be,jt!==1&&jt!==0||(Fr=Be)):(wr=Mt,Qe!==1&&Qe!==0||(Fr=Bt));else{let Ca=be-Mt;be>Mt&&Ca>180?Ca-=360:be180&&(Ca+=360),wr=Mt+$*Ca}let[Zr,en,yn,Vn]=(function([Ca,ua,wa,Xa]){return Ca=isNaN(Ca)?0:Ca*ar,Zn([wa,Math.cos(Ca)*ua,Math.sin(Ca)*ua,Xa])})([wr,Fr??wi(Bt,Be,$),wi(jt,Qe,$),wi(oe,lr,$)]);return new tr(Zr,en,yn,Vn,!1)}case"lab":{let[Mt,Bt,jt,oe]=Zn(ci(H.lab,C.lab,$));return new tr(Mt,Bt,jt,oe,!1)}}},array:ci,padding:function(H,C,$){return new $r(ci(H.values,C.values,$))},variableAnchorOffsetCollection:function(H,C,$){let ht=H.values,Mt=C.values;if(ht.length!==Mt.length)throw new ve(`Cannot interpolate values of different length. from: ${H.toString()}, to: ${C.toString()}`);let Bt=[];for(let jt=0;jttypeof Qe!="number"||Qe<0||Qe>1))return $.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);Mt={name:"cubic-bezier",controlPoints:Be}}}if(C.length-1<4)return $.error(`Expected at least 4 arguments, but found only ${C.length-1}.`);if((C.length-1)%2!=0)return $.error("Expected an even number of arguments.");if(Bt=$.parse(Bt,2,ue),!Bt)return null;let oe=[],be=null;ht==="interpolate-hcl"||ht==="interpolate-lab"?be=We:$.expectedType&&$.expectedType.kind!=="value"&&(be=$.expectedType);for(let Be=0;Be=Qe)return $.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',wr);let Zr=$.parse(lr,Fr,be);if(!Zr)return null;be=be||Zr.type,oe.push([Qe,Zr])}return Ht(be,ue)||Ht(be,We)||Ht(be,Mr)||Ht(be,de)||Ht(be,Dt(ue))?new Ra(be,ht,Mt,Bt,oe):$.error(`Type ${qt(be)} is not interpolatable.`)}evaluate(C){let $=this.labels,ht=this.outputs;if($.length===1)return ht[0].evaluate(C);let Mt=this.input.evaluate(C);if(Mt<=$[0])return ht[0].evaluate(C);let Bt=$.length;if(Mt>=$[Bt-1])return ht[Bt-1].evaluate(C);let jt=Qr($,Mt),oe=Ra.interpolationFactor(this.interpolation,Mt,$[jt],$[jt+1]),be=ht[jt].evaluate(C),Be=ht[jt+1].evaluate(C);switch(this.operator){case"interpolate":return Ti[this.type.kind](be,Be,oe);case"interpolate-hcl":return Ti.color(be,Be,oe,"hcl");case"interpolate-lab":return Ti.color(be,Be,oe,"lab")}}eachChild(C){C(this.input);for(let $ of this.outputs)C($)}outputDefined(){return this.outputs.every(C=>C.outputDefined())}}function Qi(H,C,$,ht){let Mt=ht-$,Bt=H-$;return Mt===0?0:C===1?Bt/Mt:(Math.pow(C,Bt)-1)/(Math.pow(C,Mt)-1)}class Hi{constructor(C,$){this.type=C,this.args=$}static parse(C,$){if(C.length<2)return $.error("Expectected at least one argument.");let ht=null,Mt=$.expectedType;Mt&&Mt.kind!=="value"&&(ht=Mt);let Bt=[];for(let oe of C.slice(1)){let be=$.parse(oe,1+Bt.length,ht,void 0,{typeAnnotation:"omit"});if(!be)return null;ht=ht||be.type,Bt.push(be)}if(!ht)throw new Error("No output type");let jt=Mt&&Bt.some(oe=>lt(Mt,oe.type));return new Hi(jt?vr:ht,Bt)}evaluate(C){let $,ht=null,Mt=0;for(let Bt of this.args)if(Mt++,ht=Bt.evaluate(C),ht&&ht instanceof Kn&&!ht.available&&($||($=ht.name),ht=null,Mt===this.args.length&&(ht=$)),ht!==null)break;return ht}eachChild(C){this.args.forEach(C)}outputDefined(){return this.args.every(C=>C.outputDefined())}}function Ho(H,C){return H==="=="||H==="!="?C.kind==="boolean"||C.kind==="string"||C.kind==="number"||C.kind==="null"||C.kind==="value":C.kind==="string"||C.kind==="number"||C.kind==="value"}function Ci(H,C,$,ht){return ht.compare(C,$)===0}function zo(H,C,$){let ht=H!=="=="&&H!=="!=";return class W4{constructor(Bt,jt,oe){this.type=Ce,this.lhs=Bt,this.rhs=jt,this.collator=oe,this.hasUntypedArgument=Bt.type.kind==="value"||jt.type.kind==="value"}static parse(Bt,jt){if(Bt.length!==3&&Bt.length!==4)return jt.error("Expected two or three arguments.");let oe=Bt[0],be=jt.parse(Bt[1],1,vr);if(!be)return null;if(!Ho(oe,be.type))return jt.concat(1).error(`"${oe}" comparisons are not supported for type '${qt(be.type)}'.`);let Be=jt.parse(Bt[2],2,vr);if(!Be)return null;if(!Ho(oe,Be.type))return jt.concat(2).error(`"${oe}" comparisons are not supported for type '${qt(Be.type)}'.`);if(be.type.kind!==Be.type.kind&&be.type.kind!=="value"&&Be.type.kind!=="value")return jt.error(`Cannot compare types '${qt(be.type)}' and '${qt(Be.type)}'.`);ht&&(be.type.kind==="value"&&Be.type.kind!=="value"?be=new dr(Be.type,[be]):be.type.kind!=="value"&&Be.type.kind==="value"&&(Be=new dr(be.type,[Be])));let Qe=null;if(Bt.length===4){if(be.type.kind!=="string"&&Be.type.kind!=="string"&&be.type.kind!=="value"&&Be.type.kind!=="value")return jt.error("Cannot use collator to compare non-string types.");if(Qe=jt.parse(Bt[3],3,_r),!Qe)return null}return new W4(be,Be,Qe)}evaluate(Bt){let jt=this.lhs.evaluate(Bt),oe=this.rhs.evaluate(Bt);if(ht&&this.hasUntypedArgument){let be=Cn(jt),Be=Cn(oe);if(be.kind!==Be.kind||be.kind!=="string"&&be.kind!=="number")throw new ve(`Expected arguments for "${H}" to be (string, string) or (number, number), but found (${be.kind}, ${Be.kind}) instead.`)}if(this.collator&&!ht&&this.hasUntypedArgument){let be=Cn(jt),Be=Cn(oe);if(be.kind!=="string"||Be.kind!=="string")return C(Bt,jt,oe)}return this.collator?$(Bt,jt,oe,this.collator.evaluate(Bt)):C(Bt,jt,oe)}eachChild(Bt){Bt(this.lhs),Bt(this.rhs),this.collator&&Bt(this.collator)}outputDefined(){return!0}}}let qi=zo("==",function(H,C,$){return C===$},Ci),qo=zo("!=",function(H,C,$){return C!==$},function(H,C,$,ht){return!Ci(0,C,$,ht)}),Po=zo("<",function(H,C,$){return C<$},function(H,C,$,ht){return ht.compare(C,$)<0}),hs=zo(">",function(H,C,$){return C>$},function(H,C,$,ht){return ht.compare(C,$)>0}),Gi=zo("<=",function(H,C,$){return C<=$},function(H,C,$,ht){return ht.compare(C,$)<=0}),uo=zo(">=",function(H,C,$){return C>=$},function(H,C,$,ht){return ht.compare(C,$)>=0});class yi{constructor(C,$,ht){this.type=_r,this.locale=ht,this.caseSensitive=C,this.diacriticSensitive=$}static parse(C,$){if(C.length!==2)return $.error("Expected one argument.");let ht=C[1];if(typeof ht!="object"||Array.isArray(ht))return $.error("Collator options argument must be an object.");let Mt=$.parse(ht["case-sensitive"]!==void 0&&ht["case-sensitive"],1,Ce);if(!Mt)return null;let Bt=$.parse(ht["diacritic-sensitive"]!==void 0&&ht["diacritic-sensitive"],1,Ce);if(!Bt)return null;let jt=null;return ht.locale&&(jt=$.parse(ht.locale,1,Me),!jt)?null:new yi(Mt,Bt,jt)}evaluate(C){return new zr(this.caseSensitive.evaluate(C),this.diacriticSensitive.evaluate(C),this.locale?this.locale.evaluate(C):null)}eachChild(C){C(this.caseSensitive),C(this.diacriticSensitive),this.locale&&C(this.locale)}outputDefined(){return!1}}class ao{constructor(C,$,ht,Mt,Bt){this.type=Me,this.number=C,this.locale=$,this.currency=ht,this.minFractionDigits=Mt,this.maxFractionDigits=Bt}static parse(C,$){if(C.length!==3)return $.error("Expected two arguments.");let ht=$.parse(C[1],1,ue);if(!ht)return null;let Mt=C[2];if(typeof Mt!="object"||Array.isArray(Mt))return $.error("NumberFormat options argument must be an object.");let Bt=null;if(Mt.locale&&(Bt=$.parse(Mt.locale,1,Me),!Bt))return null;let jt=null;if(Mt.currency&&(jt=$.parse(Mt.currency,1,Me),!jt))return null;let oe=null;if(Mt["min-fraction-digits"]&&(oe=$.parse(Mt["min-fraction-digits"],1,ue),!oe))return null;let be=null;return Mt["max-fraction-digits"]&&(be=$.parse(Mt["max-fraction-digits"],1,ue),!be)?null:new ao(ht,Bt,jt,oe,be)}evaluate(C){return new Intl.NumberFormat(this.locale?this.locale.evaluate(C):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(C):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(C):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(C):void 0}).format(this.number.evaluate(C))}eachChild(C){C(this.number),this.locale&&C(this.locale),this.currency&&C(this.currency),this.minFractionDigits&&C(this.minFractionDigits),this.maxFractionDigits&&C(this.maxFractionDigits)}outputDefined(){return!1}}class ts{constructor(C){this.type=er,this.sections=C}static parse(C,$){if(C.length<2)return $.error("Expected at least one argument.");let ht=C[1];if(!Array.isArray(ht)&&typeof ht=="object")return $.error("First argument must be an image or text section.");let Mt=[],Bt=!1;for(let jt=1;jt<=C.length-1;++jt){let oe=C[jt];if(Bt&&typeof oe=="object"&&!Array.isArray(oe)){Bt=!1;let be=null;if(oe["font-scale"]&&(be=$.parse(oe["font-scale"],1,ue),!be))return null;let Be=null;if(oe["text-font"]&&(Be=$.parse(oe["text-font"],1,Dt(Me)),!Be))return null;let Qe=null;if(oe["text-color"]&&(Qe=$.parse(oe["text-color"],1,We),!Qe))return null;let lr=Mt[Mt.length-1];lr.scale=be,lr.font=Be,lr.textColor=Qe}else{let be=$.parse(C[jt],1,vr);if(!be)return null;let Be=be.type.kind;if(Be!=="string"&&Be!=="value"&&Be!=="null"&&Be!=="resolvedImage")return $.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");Bt=!0,Mt.push({content:be,scale:null,font:null,textColor:null})}}return new ts(Mt)}evaluate(C){return new Yr(this.sections.map($=>{let ht=$.content.evaluate(C);return Cn(ht)===Ir?new tn("",ht,null,null,null):new tn(Fa(ht),null,$.scale?$.scale.evaluate(C):null,$.font?$.font.evaluate(C).join(","):null,$.textColor?$.textColor.evaluate(C):null)}))}eachChild(C){for(let $ of this.sections)C($.content),$.scale&&C($.scale),$.font&&C($.font),$.textColor&&C($.textColor)}outputDefined(){return!1}}class vs{constructor(C){this.type=Ir,this.input=C}static parse(C,$){if(C.length!==2)return $.error("Expected two arguments.");let ht=$.parse(C[1],1,Me);return ht?new vs(ht):$.error("No image name provided.")}evaluate(C){let $=this.input.evaluate(C),ht=Kn.fromString($);return ht&&C.availableImages&&(ht.available=C.availableImages.indexOf($)>-1),ht}eachChild(C){C(this.input)}outputDefined(){return!1}}class As{constructor(C){this.type=ue,this.input=C}static parse(C,$){if(C.length!==2)return $.error(`Expected 1 argument, but found ${C.length-1} instead.`);let ht=$.parse(C[1],1);return ht?ht.type.kind!=="array"&&ht.type.kind!=="string"&&ht.type.kind!=="value"?$.error(`Expected argument of type string or array, but found ${qt(ht.type)} instead.`):new As(ht):null}evaluate(C){let $=this.input.evaluate(C);if(typeof $=="string")return[...$].length;if(Array.isArray($))return $.length;throw new ve(`Expected value to be of type string or array, but found ${qt(Cn($))} instead.`)}eachChild(C){C(this.input)}outputDefined(){return!1}}let _o=8192;function Da(H,C){let $=(180+H[0])/360,ht=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+H[1]*Math.PI/360)))/360,Mt=Math.pow(2,C.z);return[Math.round($*Mt*_o),Math.round(ht*Mt*_o)]}function li(H,C){let $=Math.pow(2,C.z);return[(Mt=(H[0]/_o+C.x)/$,360*Mt-180),(ht=(H[1]/_o+C.y)/$,360/Math.PI*Math.atan(Math.exp((180-360*ht)*Math.PI/180))-90)];var ht,Mt}function wo(H,C){H[0]=Math.min(H[0],C[0]),H[1]=Math.min(H[1],C[1]),H[2]=Math.max(H[2],C[0]),H[3]=Math.max(H[3],C[1])}function Ms(H,C){return!(H[0]<=C[0]||H[2]>=C[2]||H[1]<=C[1]||H[3]>=C[3])}function Di(H,C,$){let ht=H[0]-C[0],Mt=H[1]-C[1],Bt=H[0]-$[0],jt=H[1]-$[1];return ht*jt-Bt*Mt==0&&ht*Bt<=0&&Mt*jt<=0}function _s(H,C,$,ht){return(Mt=[ht[0]-$[0],ht[1]-$[1]])[0]*(Bt=[C[0]-H[0],C[1]-H[1]])[1]-Mt[1]*Bt[0]!=0&&!(!co(H,C,$,ht)||!co($,ht,H,C));var Mt,Bt}function No(H,C,$){for(let ht of $)for(let Mt=0;Mt(Mt=H)[1]!=(jt=oe[be+1])[1]>Mt[1]&&Mt[0]<(jt[0]-Bt[0])*(Mt[1]-Bt[1])/(jt[1]-Bt[1])+Bt[0]&&(ht=!ht)}var Mt,Bt,jt;return ht}function al(H,C){for(let $ of C)if(is(H,$))return!0;return!1}function ii(H,C){for(let $ of H)if(!is($,C))return!1;for(let $=0;$0&&oe<0||jt<0&&oe>0}function Is(H,C,$){let ht=[];for(let Mt=0;Mt$[2]){let Mt=.5*ht,Bt=H[0]-$[0]>Mt?-ht:$[0]-H[0]>Mt?ht:0;Bt===0&&(Bt=H[0]-$[2]>Mt?-ht:$[2]-H[0]>Mt?ht:0),H[0]+=Bt}wo(C,H)}function $s(H,C,$,ht){let Mt=Math.pow(2,ht.z)*_o,Bt=[ht.x*_o,ht.y*_o],jt=[];for(let oe of H)for(let be of oe){let Be=[be.x+Bt[0],be.y+Bt[1]];Bi(Be,C,$,Mt),jt.push(Be)}return jt}function fl(H,C,$,ht){let Mt=Math.pow(2,ht.z)*_o,Bt=[ht.x*_o,ht.y*_o],jt=[];for(let be of H){let Be=[];for(let Qe of be){let lr=[Qe.x+Bt[0],Qe.y+Bt[1]];wo(C,lr),Be.push(lr)}jt.push(Be)}if(C[2]-C[0]<=Mt/2){(oe=C)[0]=oe[1]=1/0,oe[2]=oe[3]=-1/0;for(let be of jt)for(let Be of be)Bi(Be,C,$,Mt)}var oe;return jt}class Jo{constructor(C,$){this.type=Ce,this.geojson=C,this.geometries=$}static parse(C,$){if(C.length!==2)return $.error(`'within' expression requires exactly one argument, but found ${C.length-1} instead.`);if(ia(C[1])){let ht=C[1];if(ht.type==="FeatureCollection"){let Mt=[];for(let Bt of ht.features){let{type:jt,coordinates:oe}=Bt.geometry;jt==="Polygon"&&Mt.push(oe),jt==="MultiPolygon"&&Mt.push(...oe)}if(Mt.length)return new Jo(ht,{type:"MultiPolygon",coordinates:Mt})}else if(ht.type==="Feature"){let Mt=ht.geometry.type;if(Mt==="Polygon"||Mt==="MultiPolygon")return new Jo(ht,ht.geometry)}else if(ht.type==="Polygon"||ht.type==="MultiPolygon")return new Jo(ht,ht)}return $.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(C){if(C.geometry()!=null&&C.canonicalID()!=null){if(C.geometryType()==="Point")return(function($,ht){let Mt=[1/0,1/0,-1/0,-1/0],Bt=[1/0,1/0,-1/0,-1/0],jt=$.canonicalID();if(ht.type==="Polygon"){let oe=Is(ht.coordinates,Bt,jt),be=$s($.geometry(),Mt,Bt,jt);if(!Ms(Mt,Bt))return!1;for(let Be of be)if(!is(Be,oe))return!1}if(ht.type==="MultiPolygon"){let oe=Wo(ht.coordinates,Bt,jt),be=$s($.geometry(),Mt,Bt,jt);if(!Ms(Mt,Bt))return!1;for(let Be of be)if(!al(Be,oe))return!1}return!0})(C,this.geometries);if(C.geometryType()==="LineString")return(function($,ht){let Mt=[1/0,1/0,-1/0,-1/0],Bt=[1/0,1/0,-1/0,-1/0],jt=$.canonicalID();if(ht.type==="Polygon"){let oe=Is(ht.coordinates,Bt,jt),be=fl($.geometry(),Mt,Bt,jt);if(!Ms(Mt,Bt))return!1;for(let Be of be)if(!ii(Be,oe))return!1}if(ht.type==="MultiPolygon"){let oe=Wo(ht.coordinates,Bt,jt),be=fl($.geometry(),Mt,Bt,jt);if(!Ms(Mt,Bt))return!1;for(let Be of be)if(!io(Be,oe))return!1}return!0})(C,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let us=class{constructor(H=[],C=($,ht)=>$ht?1:0){if(this.data=H,this.length=this.data.length,this.compare=C,this.length>0)for(let $=(this.length>>1)-1;$>=0;$--)this._down($)}push(H){this.data.push(H),this._up(this.length++)}pop(){if(this.length===0)return;let H=this.data[0],C=this.data.pop();return--this.length>0&&(this.data[0]=C,this._down(0)),H}peek(){return this.data[0]}_up(H){let{data:C,compare:$}=this,ht=C[H];for(;H>0;){let Mt=H-1>>1,Bt=C[Mt];if($(ht,Bt)>=0)break;C[H]=Bt,H=Mt}C[H]=ht}_down(H){let{data:C,compare:$}=this,ht=this.length>>1,Mt=C[H];for(;H=0)break;C[H]=C[Bt],H=Bt}C[H]=Mt}};function Ss(H,C,$,ht,Mt){Ls(H,C,$,ht||H.length-1,Mt||bu)}function Ls(H,C,$,ht,Mt){for(;ht>$;){if(ht-$>600){var Bt=ht-$+1,jt=C-$+1,oe=Math.log(Bt),be=.5*Math.exp(2*oe/3),Be=.5*Math.sqrt(oe*be*(Bt-be)/Bt)*(jt-Bt/2<0?-1:1);Ls(H,C,Math.max($,Math.floor(C-jt*be/Bt+Be)),Math.min(ht,Math.floor(C+(Bt-jt)*be/Bt+Be)),Mt)}var Qe=H[C],lr=$,wr=ht;for(xl(H,$,C),Mt(H[ht],Qe)>0&&xl(H,$,ht);lr0;)wr--}Mt(H[$],Qe)===0?xl(H,$,wr):xl(H,++wr,ht),wr<=C&&($=wr+1),C<=wr&&(ht=wr-1)}}function xl(H,C,$){var ht=H[C];H[C]=H[$],H[$]=ht}function bu(H,C){return HC?1:0}function au(H,C){if(H.length<=1)return[H];let $=[],ht,Mt;for(let Bt of H){let jt=zc(Bt);jt!==0&&(Bt.area=Math.abs(jt),Mt===void 0&&(Mt=jt<0),Mt===jt<0?(ht&&$.push(ht),ht=[Bt]):ht.push(Bt))}if(ht&&$.push(ht),C>1)for(let Bt=0;Bt<$.length;Bt++)$[Bt].length<=C||(Ss($[Bt],C,1,$[Bt].length-1,fu),$[Bt]=$[Bt].slice(0,C));return $}function fu(H,C){return C.area-H.area}function zc(H){let C=0;for(let $,ht,Mt=0,Bt=H.length,jt=Bt-1;Mt1?(Be=C[be+1][0],Qe=C[be+1][1]):Fr>0&&(Be+=lr/this.kx*Fr,Qe+=wr/this.ky*Fr)),lr=this.wrap($[0]-Be)*this.kx,wr=($[1]-Qe)*this.ky;let Zr=lr*lr+wr*wr;Zr180;)C-=360;return C}}function Al(H,C){return C[0]-H[0]}function _l(H){return H[1]-H[0]+1}function Ml(H,C){return H[1]>=H[0]&&H[1]H[1])return[null,null];let $=_l(H);if(C){if($===2)return[H,null];let Mt=Math.floor($/2);return[[H[0],H[0]+Mt],[H[0]+Mt,H[1]]]}if($===1)return[H,null];let ht=Math.floor($/2)-1;return[[H[0],H[0]+ht],[H[0]+ht+1,H[1]]]}function Fs(H,C){if(!Ml(C,H.length))return[1/0,1/0,-1/0,-1/0];let $=[1/0,1/0,-1/0,-1/0];for(let ht=C[0];ht<=C[1];++ht)wo($,H[ht]);return $}function bl(H){let C=[1/0,1/0,-1/0,-1/0];for(let $ of H)for(let ht of $)wo(C,ht);return C}function Fo(H){return H[0]!==-1/0&&H[1]!==-1/0&&H[2]!==1/0&&H[3]!==1/0}function bs(H,C,$){if(!Fo(H)||!Fo(C))return NaN;let ht=0,Mt=0;return H[2]C[2]&&(ht=H[0]-C[2]),H[1]>C[3]&&(Mt=H[1]-C[3]),H[3]=ht)return ht;if(Ms(Mt,Bt)){if(yf(H,C))return 0}else if(yf(C,H))return 0;let jt=1/0;for(let oe of H)for(let be=0,Be=oe.length,Qe=Be-1;be0;){let be=jt.pop();if(be[0]>=Bt)continue;let Be=be[1],Qe=C?50:100;if(_l(Be)<=Qe){if(!Ml(Be,H.length))return NaN;if(C){let lr=Oo(H,Be,$,ht);if(isNaN(lr)||lr===0)return lr;Bt=Math.min(Bt,lr)}else for(let lr=Be[0];lr<=Be[1];++lr){let wr=sf(H[lr],$,ht);if(Bt=Math.min(Bt,wr),Bt===0)return 0}}else{let lr=hu(Be,C);Fi(jt,Bt,ht,H,oe,lr[0]),Fi(jt,Bt,ht,H,oe,lr[1])}}return Bt}function ml(H,C,$,ht,Mt,Bt=1/0){let jt=Math.min(Bt,Mt.distance(H[0],$[0]));if(jt===0)return jt;let oe=new us([[0,[0,H.length-1],[0,$.length-1]]],Al);for(;oe.length>0;){let be=oe.pop();if(be[0]>=jt)continue;let Be=be[1],Qe=be[2],lr=C?50:100,wr=ht?50:100;if(_l(Be)<=lr&&_l(Qe)<=wr){if(!Ml(Be,H.length)&&Ml(Qe,$.length))return NaN;let Fr;if(C&&ht)Fr=qu(H,Be,$,Qe,Mt),jt=Math.min(jt,Fr);else if(C&&!ht){let Zr=H.slice(Be[0],Be[1]+1);for(let en=Qe[0];en<=Qe[1];++en)if(Fr=Iu($[en],Zr,Mt),jt=Math.min(jt,Fr),jt===0)return jt}else if(!C&&ht){let Zr=$.slice(Qe[0],Qe[1]+1);for(let en=Be[0];en<=Be[1];++en)if(Fr=Iu(H[en],Zr,Mt),jt=Math.min(jt,Fr),jt===0)return jt}else Fr=qs(H,Be,$,Qe,Mt),jt=Math.min(jt,Fr)}else{let Fr=hu(Be,C),Zr=hu(Qe,ht);ac(oe,jt,Mt,H,$,Fr[0],Zr[0]),ac(oe,jt,Mt,H,$,Fr[0],Zr[1]),ac(oe,jt,Mt,H,$,Fr[1],Zr[0]),ac(oe,jt,Mt,H,$,Fr[1],Zr[1])}}return jt}function Cc(H){return H.type==="MultiPolygon"?H.coordinates.map(C=>({type:"Polygon",coordinates:C})):H.type==="MultiLineString"?H.coordinates.map(C=>({type:"LineString",coordinates:C})):H.type==="MultiPoint"?H.coordinates.map(C=>({type:"Point",coordinates:C})):[H]}class Wu{constructor(C,$){this.type=ue,this.geojson=C,this.geometries=$}static parse(C,$){if(C.length!==2)return $.error(`'distance' expression requires exactly one argument, but found ${C.length-1} instead.`);if(ia(C[1])){let ht=C[1];if(ht.type==="FeatureCollection")return new Wu(ht,ht.features.map(Mt=>Cc(Mt.geometry)).flat());if(ht.type==="Feature")return new Wu(ht,Cc(ht.geometry));if("type"in ht&&"coordinates"in ht)return new Wu(ht,Cc(ht))}return $.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(C){if(C.geometry()!=null&&C.canonicalID()!=null){if(C.geometryType()==="Point")return(function($,ht){let Mt=$.geometry(),Bt=Mt.flat().map(be=>li([be.x,be.y],$.canonical));if(Mt.length===0)return NaN;let jt=new Lc(Bt[0][1]),oe=1/0;for(let be of ht){switch(be.type){case"Point":oe=Math.min(oe,ml(Bt,!1,[be.coordinates],!1,jt,oe));break;case"LineString":oe=Math.min(oe,ml(Bt,!1,be.coordinates,!0,jt,oe));break;case"Polygon":oe=Math.min(oe,pu(Bt,!1,be.coordinates,jt,oe))}if(oe===0)return oe}return oe})(C,this.geometries);if(C.geometryType()==="LineString")return(function($,ht){let Mt=$.geometry(),Bt=Mt.flat().map(be=>li([be.x,be.y],$.canonical));if(Mt.length===0)return NaN;let jt=new Lc(Bt[0][1]),oe=1/0;for(let be of ht){switch(be.type){case"Point":oe=Math.min(oe,ml(Bt,!0,[be.coordinates],!1,jt,oe));break;case"LineString":oe=Math.min(oe,ml(Bt,!0,be.coordinates,!0,jt,oe));break;case"Polygon":oe=Math.min(oe,pu(Bt,!0,be.coordinates,jt,oe))}if(oe===0)return oe}return oe})(C,this.geometries);if(C.geometryType()==="Polygon")return(function($,ht){let Mt=$.geometry();if(Mt.length===0||Mt[0].length===0)return NaN;let Bt=au(Mt,0).map(be=>be.map(Be=>Be.map(Qe=>li([Qe.x,Qe.y],$.canonical)))),jt=new Lc(Bt[0][0][0][1]),oe=1/0;for(let be of ht)for(let Be of Bt){switch(be.type){case"Point":oe=Math.min(oe,pu([be.coordinates],!1,Be,jt,oe));break;case"LineString":oe=Math.min(oe,pu(be.coordinates,!0,Be,jt,oe));break;case"Polygon":oe=Math.min(oe,os(Be,be.coordinates,jt,oe))}if(oe===0)return oe}return oe})(C,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let mc={"==":qi,"!=":qo,">":hs,"<":Po,">=":uo,"<=":Gi,array:dr,at:Ke,boolean:dr,case:wn,coalesce:Hi,collator:yi,format:ts,image:vs,in:xr,"index-of":Gr,interpolate:Ra,"interpolate-hcl":Ra,"interpolate-lab":Ra,length:As,let:Or,literal:Ga,match:ln,number:dr,"number-format":ao,object:dr,slice:rn,step:vn,string:dr,"to-boolean":Tr,"to-color":Tr,"to-number":Tr,"to-string":Tr,var:pe,within:Jo,distance:Wu};class wl{constructor(C,$,ht,Mt){this.name=C,this.type=$,this._evaluate=ht,this.args=Mt}evaluate(C){return this._evaluate(C,this.args)}eachChild(C){this.args.forEach(C)}outputDefined(){return!1}static parse(C,$){let ht=C[0],Mt=wl.definitions[ht];if(!Mt)return $.error(`Unknown expression "${ht}". If you wanted a literal array, use ["literal", [...]].`,0);let Bt=Array.isArray(Mt)?Mt[0]:Mt.type,jt=Array.isArray(Mt)?[[Mt[1],Mt[2]]]:Mt.overloads,oe=jt.filter(([Be])=>!Array.isArray(Be)||Be.length===C.length-1),be=null;for(let[Be,Qe]of oe){be=new Ur($.registry,Ic,$.path,null,$.scope);let lr=[],wr=!1;for(let Fr=1;Fr{return wr=lr,Array.isArray(wr)?`(${wr.map(qt).join(", ")})`:`(${qt(wr.type)}...)`;var wr}).join(" | "),Qe=[];for(let lr=1;lr{$=C?$&&Ic(ht):$&&ht instanceof Ga}),!!$&&Pc(H)&&Rc(H,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Pc(H){if(H instanceof wl&&(H.name==="get"&&H.args.length===1||H.name==="feature-state"||H.name==="has"&&H.args.length===1||H.name==="properties"||H.name==="geometry-type"||H.name==="id"||/^filter-/.test(H.name))||H instanceof Jo||H instanceof Wu)return!1;let C=!0;return H.eachChild($=>{C&&!Pc($)&&(C=!1)}),C}function du(H){if(H instanceof wl&&H.name==="feature-state")return!1;let C=!0;return H.eachChild($=>{C&&!du($)&&(C=!1)}),C}function Rc(H,C){if(H instanceof wl&&C.indexOf(H.name)>=0)return!1;let $=!0;return H.eachChild(ht=>{$&&!Rc(ht,C)&&($=!1)}),$}function Pu(H){return{result:"success",value:H}}function wu(H){return{result:"error",value:H}}function Tl(H){return H["property-type"]==="data-driven"||H["property-type"]==="cross-faded-data-driven"}function Qu(H){return!!H.expression&&H.expression.parameters.indexOf("zoom")>-1}function Oc(H){return!!H.expression&&H.expression.interpolated}function Es(H){return H instanceof Number?"number":H instanceof String?"string":H instanceof Boolean?"boolean":Array.isArray(H)?"array":H===null?"null":typeof H}function bc(H){return typeof H=="object"&&H!==null&&!Array.isArray(H)}function lf(H){return H}function Nc(H,C){let $=C.type==="color",ht=H.stops&&typeof H.stops[0][0]=="object",Mt=ht||!(ht||H.property!==void 0),Bt=H.type||(Oc(C)?"exponential":"interval");if($||C.type==="padding"){let Qe=$?tr.parse:$r.parse;(H=vt({},H)).stops&&(H.stops=H.stops.map(lr=>[lr[0],Qe(lr[1])])),H.default=Qe(H.default?H.default:C.default)}if(H.colorSpace&&(jt=H.colorSpace)!=="rgb"&&jt!=="hcl"&&jt!=="lab")throw new Error(`Unknown color space: "${H.colorSpace}"`);var jt;let oe,be,Be;if(Bt==="exponential")oe=Uc;else if(Bt==="interval")oe=Zl;else if(Bt==="categorical"){oe=jc,be=Object.create(null);for(let Qe of H.stops)be[Qe[0]]=Qe[1];Be=typeof H.stops[0][0]}else{if(Bt!=="identity")throw new Error(`Unknown function type "${Bt}"`);oe=rl}if(ht){let Qe={},lr=[];for(let Zr=0;ZrZr[0]),evaluate:({zoom:Zr},en)=>Uc({stops:wr,base:H.base},C,Zr).evaluate(Zr,en)}}if(Mt){let Qe=Bt==="exponential"?{name:"exponential",base:H.base!==void 0?H.base:1}:null;return{kind:"camera",interpolationType:Qe,interpolationFactor:Ra.interpolationFactor.bind(void 0,Qe),zoomStops:H.stops.map(lr=>lr[0]),evaluate:({zoom:lr})=>oe(H,C,lr,be,Be)}}return{kind:"source",evaluate(Qe,lr){let wr=lr&&lr.properties?lr.properties[H.property]:void 0;return wr===void 0?vc(H.default,C.default):oe(H,C,wr,be,Be)}}}function vc(H,C,$){return H!==void 0?H:C!==void 0?C:$!==void 0?$:void 0}function jc(H,C,$,ht,Mt){return vc(typeof $===Mt?ht[$]:void 0,H.default,C.default)}function Zl(H,C,$){if(Es($)!=="number")return vc(H.default,C.default);let ht=H.stops.length;if(ht===1||$<=H.stops[0][0])return H.stops[0][1];if($>=H.stops[ht-1][0])return H.stops[ht-1][1];let Mt=Qr(H.stops.map(Bt=>Bt[0]),$);return H.stops[Mt][1]}function Uc(H,C,$){let ht=H.base!==void 0?H.base:1;if(Es($)!=="number")return vc(H.default,C.default);let Mt=H.stops.length;if(Mt===1||$<=H.stops[0][0])return H.stops[0][1];if($>=H.stops[Mt-1][0])return H.stops[Mt-1][1];let Bt=Qr(H.stops.map(Qe=>Qe[0]),$),jt=(function(Qe,lr,wr,Fr){let Zr=Fr-wr,en=Qe-wr;return Zr===0?0:lr===1?en/Zr:(Math.pow(lr,en)-1)/(Math.pow(lr,Zr)-1)})($,ht,H.stops[Bt][0],H.stops[Bt+1][0]),oe=H.stops[Bt][1],be=H.stops[Bt+1][1],Be=Ti[C.type]||lf;return typeof oe.evaluate=="function"?{evaluate(...Qe){let lr=oe.evaluate.apply(void 0,Qe),wr=be.evaluate.apply(void 0,Qe);if(lr!==void 0&&wr!==void 0)return Be(lr,wr,jt,H.colorSpace)}}:Be(oe,be,jt,H.colorSpace)}function rl(H,C,$){switch(C.type){case"color":$=tr.parse($);break;case"formatted":$=Yr.fromString($.toString());break;case"resolvedImage":$=Kn.fromString($.toString());break;case"padding":$=$r.parse($);break;default:Es($)===C.type||C.type==="enum"&&C.values[$]||($=void 0)}return vc($,H.default,C.default)}wl.register(mc,{error:[{kind:"error"},[Me],(H,[C])=>{throw new ve(C.evaluate(H))}],typeof:[Me,[vr],(H,[C])=>qt(Cn(C.evaluate(H)))],"to-rgba":[Dt(ue,4),[We],(H,[C])=>{let[$,ht,Mt,Bt]=C.evaluate(H).rgb;return[255*$,255*ht,255*Mt,Bt]}],rgb:[We,[ue,ue,ue],Xc],rgba:[We,[ue,ue,ue,ue],Xc],has:{type:Ce,overloads:[[[Me],(H,[C])=>Bc(C.evaluate(H),H.properties())],[[Me,qe],(H,[C,$])=>Bc(C.evaluate(H),$.evaluate(H))]]},get:{type:vr,overloads:[[[Me],(H,[C])=>gc(C.evaluate(H),H.properties())],[[Me,qe],(H,[C,$])=>gc(C.evaluate(H),$.evaluate(H))]]},"feature-state":[vr,[Me],(H,[C])=>gc(C.evaluate(H),H.featureState||{})],properties:[qe,[],H=>H.properties()],"geometry-type":[Me,[],H=>H.geometryType()],id:[vr,[],H=>H.id()],zoom:[ue,[],H=>H.globals.zoom],"heatmap-density":[ue,[],H=>H.globals.heatmapDensity||0],"line-progress":[ue,[],H=>H.globals.lineProgress||0],accumulated:[vr,[],H=>H.globals.accumulated===void 0?null:H.globals.accumulated],"+":[ue,Gu(ue),(H,C)=>{let $=0;for(let ht of C)$+=ht.evaluate(H);return $}],"*":[ue,Gu(ue),(H,C)=>{let $=1;for(let ht of C)$*=ht.evaluate(H);return $}],"-":{type:ue,overloads:[[[ue,ue],(H,[C,$])=>C.evaluate(H)-$.evaluate(H)],[[ue],(H,[C])=>-C.evaluate(H)]]},"/":[ue,[ue,ue],(H,[C,$])=>C.evaluate(H)/$.evaluate(H)],"%":[ue,[ue,ue],(H,[C,$])=>C.evaluate(H)%$.evaluate(H)],ln2:[ue,[],()=>Math.LN2],pi:[ue,[],()=>Math.PI],e:[ue,[],()=>Math.E],"^":[ue,[ue,ue],(H,[C,$])=>Math.pow(C.evaluate(H),$.evaluate(H))],sqrt:[ue,[ue],(H,[C])=>Math.sqrt(C.evaluate(H))],log10:[ue,[ue],(H,[C])=>Math.log(C.evaluate(H))/Math.LN10],ln:[ue,[ue],(H,[C])=>Math.log(C.evaluate(H))],log2:[ue,[ue],(H,[C])=>Math.log(C.evaluate(H))/Math.LN2],sin:[ue,[ue],(H,[C])=>Math.sin(C.evaluate(H))],cos:[ue,[ue],(H,[C])=>Math.cos(C.evaluate(H))],tan:[ue,[ue],(H,[C])=>Math.tan(C.evaluate(H))],asin:[ue,[ue],(H,[C])=>Math.asin(C.evaluate(H))],acos:[ue,[ue],(H,[C])=>Math.acos(C.evaluate(H))],atan:[ue,[ue],(H,[C])=>Math.atan(C.evaluate(H))],min:[ue,Gu(ue),(H,C)=>Math.min(...C.map($=>$.evaluate(H)))],max:[ue,Gu(ue),(H,C)=>Math.max(...C.map($=>$.evaluate(H)))],abs:[ue,[ue],(H,[C])=>Math.abs(C.evaluate(H))],round:[ue,[ue],(H,[C])=>{let $=C.evaluate(H);return $<0?-Math.round(-$):Math.round($)}],floor:[ue,[ue],(H,[C])=>Math.floor(C.evaluate(H))],ceil:[ue,[ue],(H,[C])=>Math.ceil(C.evaluate(H))],"filter-==":[Ce,[Me,vr],(H,[C,$])=>H.properties()[C.value]===$.value],"filter-id-==":[Ce,[vr],(H,[C])=>H.id()===C.value],"filter-type-==":[Ce,[Me],(H,[C])=>H.geometryType()===C.value],"filter-<":[Ce,[Me,vr],(H,[C,$])=>{let ht=H.properties()[C.value],Mt=$.value;return typeof ht==typeof Mt&&ht{let $=H.id(),ht=C.value;return typeof $==typeof ht&&$":[Ce,[Me,vr],(H,[C,$])=>{let ht=H.properties()[C.value],Mt=$.value;return typeof ht==typeof Mt&&ht>Mt}],"filter-id->":[Ce,[vr],(H,[C])=>{let $=H.id(),ht=C.value;return typeof $==typeof ht&&$>ht}],"filter-<=":[Ce,[Me,vr],(H,[C,$])=>{let ht=H.properties()[C.value],Mt=$.value;return typeof ht==typeof Mt&&ht<=Mt}],"filter-id-<=":[Ce,[vr],(H,[C])=>{let $=H.id(),ht=C.value;return typeof $==typeof ht&&$<=ht}],"filter->=":[Ce,[Me,vr],(H,[C,$])=>{let ht=H.properties()[C.value],Mt=$.value;return typeof ht==typeof Mt&&ht>=Mt}],"filter-id->=":[Ce,[vr],(H,[C])=>{let $=H.id(),ht=C.value;return typeof $==typeof ht&&$>=ht}],"filter-has":[Ce,[vr],(H,[C])=>C.value in H.properties()],"filter-has-id":[Ce,[],H=>H.id()!==null&&H.id()!==void 0],"filter-type-in":[Ce,[Dt(Me)],(H,[C])=>C.value.indexOf(H.geometryType())>=0],"filter-id-in":[Ce,[Dt(vr)],(H,[C])=>C.value.indexOf(H.id())>=0],"filter-in-small":[Ce,[Me,Dt(vr)],(H,[C,$])=>$.value.indexOf(H.properties()[C.value])>=0],"filter-in-large":[Ce,[Me,Dt(vr)],(H,[C,$])=>(function(ht,Mt,Bt,jt){for(;Bt<=jt;){let oe=Bt+jt>>1;if(Mt[oe]===ht)return!0;Mt[oe]>ht?jt=oe-1:Bt=oe+1}return!1})(H.properties()[C.value],$.value,0,$.value.length-1)],all:{type:Ce,overloads:[[[Ce,Ce],(H,[C,$])=>C.evaluate(H)&&$.evaluate(H)],[Gu(Ce),(H,C)=>{for(let $ of C)if(!$.evaluate(H))return!1;return!0}]]},any:{type:Ce,overloads:[[[Ce,Ce],(H,[C,$])=>C.evaluate(H)||$.evaluate(H)],[Gu(Ce),(H,C)=>{for(let $ of C)if($.evaluate(H))return!0;return!1}]]},"!":[Ce,[Ce],(H,[C])=>!C.evaluate(H)],"is-supported-script":[Ce,[Me],(H,[C])=>{let $=H.globals&&H.globals.isSupportedScript;return!$||$(C.evaluate(H))}],upcase:[Me,[Me],(H,[C])=>C.evaluate(H).toUpperCase()],downcase:[Me,[Me],(H,[C])=>C.evaluate(H).toLowerCase()],concat:[Me,Gu(vr),(H,C)=>C.map($=>Fa($.evaluate(H))).join("")],"resolved-locale":[Me,[_r],(H,[C])=>C.evaluate(H).resolvedLocale()]});class Kl{constructor(C,$){var ht;this.expression=C,this._warningHistory={},this._evaluator=new kr,this._defaultValue=$?(ht=$).type==="color"&&bc(ht.default)?new tr(0,0,0,0):ht.type==="color"?tr.parse(ht.default)||null:ht.type==="padding"?$r.parse(ht.default)||null:ht.type==="variableAnchorOffsetCollection"?Nn.parse(ht.default)||null:ht.default===void 0?null:ht.default:null,this._enumValues=$&&$.type==="enum"?$.values:null}evaluateWithoutErrorHandling(C,$,ht,Mt,Bt,jt){return this._evaluator.globals=C,this._evaluator.feature=$,this._evaluator.featureState=ht,this._evaluator.canonical=Mt,this._evaluator.availableImages=Bt||null,this._evaluator.formattedSection=jt,this.expression.evaluate(this._evaluator)}evaluate(C,$,ht,Mt,Bt,jt){this._evaluator.globals=C,this._evaluator.feature=$||null,this._evaluator.featureState=ht||null,this._evaluator.canonical=Mt,this._evaluator.availableImages=Bt||null,this._evaluator.formattedSection=jt||null;try{let oe=this.expression.evaluate(this._evaluator);if(oe==null||typeof oe=="number"&&oe!=oe)return this._defaultValue;if(this._enumValues&&!(oe in this._enumValues))throw new ve(`Expected value to be one of ${Object.keys(this._enumValues).map(be=>JSON.stringify(be)).join(", ")}, but found ${JSON.stringify(oe)} instead.`);return oe}catch(oe){return this._warningHistory[oe.message]||(this._warningHistory[oe.message]=!0,typeof console<"u"&&console.warn(oe.message)),this._defaultValue}}}function Zu(H){return Array.isArray(H)&&H.length>0&&typeof H[0]=="string"&&H[0]in mc}function Bs(H,C){let $=new Ur(mc,Ic,[],C?(function(Mt){let Bt={color:We,string:Me,number:ue,enum:Me,boolean:Ce,formatted:er,padding:Mr,resolvedImage:Ir,variableAnchorOffsetCollection:de};return Mt.type==="array"?Dt(Bt[Mt.value]||vr,Mt.length):Bt[Mt.type]})(C):void 0),ht=$.parse(H,void 0,void 0,void 0,C&&C.type==="string"?{typeAnnotation:"coerce"}:void 0);return ht?Pu(new Kl(ht,C)):wu($.errors)}class Ou{constructor(C,$){this.kind=C,this._styleExpression=$,this.isStateDependent=C!=="constant"&&!du($.expression)}evaluateWithoutErrorHandling(C,$,ht,Mt,Bt,jt){return this._styleExpression.evaluateWithoutErrorHandling(C,$,ht,Mt,Bt,jt)}evaluate(C,$,ht,Mt,Bt,jt){return this._styleExpression.evaluate(C,$,ht,Mt,Bt,jt)}}class Rl{constructor(C,$,ht,Mt){this.kind=C,this.zoomStops=ht,this._styleExpression=$,this.isStateDependent=C!=="camera"&&!du($.expression),this.interpolationType=Mt}evaluateWithoutErrorHandling(C,$,ht,Mt,Bt,jt){return this._styleExpression.evaluateWithoutErrorHandling(C,$,ht,Mt,Bt,jt)}evaluate(C,$,ht,Mt,Bt,jt){return this._styleExpression.evaluate(C,$,ht,Mt,Bt,jt)}interpolationFactor(C,$,ht){return this.interpolationType?Ra.interpolationFactor(this.interpolationType,C,$,ht):0}}function Yl(H,C){let $=Bs(H,C);if($.result==="error")return $;let ht=$.value.expression,Mt=Pc(ht);if(!Mt&&!Tl(C))return wu([new Ut("","data expressions not supported")]);let Bt=Rc(ht,["zoom"]);if(!Bt&&!Qu(C))return wu([new Ut("","zoom expressions not supported")]);let jt=ic(ht);return jt||Bt?jt instanceof Ut?wu([jt]):jt instanceof Ra&&!Oc(C)?wu([new Ut("",'"interpolate" expressions cannot be used with this property')]):Pu(jt?new Rl(Mt?"camera":"composite",$.value,jt.labels,jt instanceof Ra?jt.interpolation:void 0):new Ou(Mt?"constant":"source",$.value)):wu([new Ut("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ws{constructor(C,$){this._parameters=C,this._specification=$,vt(this,Nc(this._parameters,this._specification))}static deserialize(C){return new Ws(C._parameters,C._specification)}static serialize(C){return{_parameters:C._parameters,_specification:C._specification}}}function ic(H){let C=null;if(H instanceof Or)C=ic(H.result);else if(H instanceof Hi){for(let $ of H.args)if(C=ic($),C)break}else(H instanceof vn||H instanceof Ra)&&H.input instanceof wl&&H.input.name==="zoom"&&(C=H);return C instanceof Ut||H.eachChild($=>{let ht=ic($);ht instanceof Ut?C=ht:!C&&ht?C=new Ut("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):C&&ht&&C!==ht&&(C=new Ut("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),C}function Tu(H){if(H===!0||H===!1)return!0;if(!Array.isArray(H)||H.length===0)return!1;switch(H[0]){case"has":return H.length>=2&&H[1]!=="$id"&&H[1]!=="$type";case"in":return H.length>=3&&(typeof H[1]!="string"||Array.isArray(H[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return H.length!==3||Array.isArray(H[1])||Array.isArray(H[2]);case"any":case"all":for(let C of H.slice(1))if(!Tu(C)&&typeof C!="boolean")return!1;return!0;default:return!0}}let Ku={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function wc(H){if(H==null)return{filter:()=>!0,needGeometry:!1};Tu(H)||(H=oc(H));let C=Bs(H,Ku);if(C.result==="error")throw new Error(C.value.map($=>`${$.key}: ${$.message}`).join(", "));return{filter:($,ht,Mt)=>C.value.evaluate($,ht,{},Mt),needGeometry:Sf(H)}}function uf(H,C){return HC?1:0}function Sf(H){if(!Array.isArray(H))return!1;if(H[0]==="within"||H[0]==="distance")return!0;for(let C=1;C"||C==="<="||C===">="?Tc(H[1],H[2],C):C==="any"?($=H.slice(1),["any"].concat($.map(oc))):C==="all"?["all"].concat(H.slice(1).map(oc)):C==="none"?["all"].concat(H.slice(1).map(oc).map(iu)):C==="in"?Fl(H[1],H.slice(2)):C==="!in"?iu(Fl(H[1],H.slice(2))):C==="has"?sc(H[1]):C!=="!has"||iu(sc(H[1]));var $}function Tc(H,C,$){switch(H){case"$type":return[`filter-type-${$}`,C];case"$id":return[`filter-id-${$}`,C];default:return[`filter-${$}`,H,C]}}function Fl(H,C){if(C.length===0)return!1;switch(H){case"$type":return["filter-type-in",["literal",C]];case"$id":return["filter-id-in",["literal",C]];default:return C.length>200&&!C.some($=>typeof $!=typeof C[0])?["filter-in-large",H,["literal",C.sort(uf)]]:["filter-in-small",H,["literal",C]]}}function sc(H){switch(H){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",H]}}function iu(H){return["!",H]}function lc(H){let C=typeof H;if(C==="number"||C==="boolean"||C==="string"||H==null)return JSON.stringify(H);if(Array.isArray(H)){let Mt="[";for(let Bt of H)Mt+=`${lc(Bt)},`;return`${Mt}]`}let $=Object.keys(H).sort(),ht="{";for(let Mt=0;Mt<$.length;Mt++)ht+=`${JSON.stringify($[Mt])}:${lc(H[$[Mt]])},`;return`${ht}}`}function kc(H){let C="";for(let $ of dt)C+=`/${lc(H[$])}`;return C}function ku(H){let C=H.value;return C?[new bt(H.key,C,"constants have been deprecated as of v8")]:[]}function Gs(H){return H instanceof Number||H instanceof String||H instanceof Boolean?H.valueOf():H}function Du(H){if(Array.isArray(H))return H.map(Du);if(H instanceof Object&&!(H instanceof Number||H instanceof String||H instanceof Boolean)){let C={};for(let $ in H)C[$]=Du(H[$]);return C}return Gs(H)}function Xl(H){let C=H.key,$=H.value,ht=H.valueSpec||{},Mt=H.objectElementValidators||{},Bt=H.style,jt=H.styleSpec,oe=H.validateSpec,be=[],Be=Es($);if(Be!=="object")return[new bt(C,$,`object expected, ${Be} found`)];for(let Qe in $){let lr=Qe.split(".")[0],wr=ht[lr]||ht["*"],Fr;if(Mt[lr])Fr=Mt[lr];else if(ht[lr])Fr=oe;else if(Mt["*"])Fr=Mt["*"];else{if(!ht["*"]){be.push(new bt(C,$[Qe],`unknown property "${Qe}"`));continue}Fr=oe}be=be.concat(Fr({key:(C&&`${C}.`)+Qe,value:$[Qe],valueSpec:wr,style:Bt,styleSpec:jt,object:$,objectKey:Qe,validateSpec:oe},$))}for(let Qe in ht)Mt[Qe]||ht[Qe].required&&ht[Qe].default===void 0&&$[Qe]===void 0&&be.push(new bt(C,$,`missing required property "${Qe}"`));return be}function $c(H){let C=H.value,$=H.valueSpec,ht=H.style,Mt=H.styleSpec,Bt=H.key,jt=H.arrayElementValidator||H.validateSpec;if(Es(C)!=="array")return[new bt(Bt,C,`array expected, ${Es(C)} found`)];if($.length&&C.length!==$.length)return[new bt(Bt,C,`array length ${$.length} expected, length ${C.length} found`)];if($["min-length"]&&C.length<$["min-length"])return[new bt(Bt,C,`array length at least ${$["min-length"]} expected, length ${C.length} found`)];let oe={type:$.value,values:$.values};Mt.$version<7&&(oe.function=$.function),Es($.value)==="object"&&(oe=$.value);let be=[];for(let Be=0;Beht.maximum?[new bt(C,$,`${$} is greater than the maximum value ${ht.maximum}`)]:[]}function yc(H){let C=H.valueSpec,$=Gs(H.value.type),ht,Mt,Bt,jt={},oe=$!=="categorical"&&H.value.property===void 0,be=!oe,Be=Es(H.value.stops)==="array"&&Es(H.value.stops[0])==="array"&&Es(H.value.stops[0][0])==="object",Qe=Xl({key:H.key,value:H.value,valueSpec:H.styleSpec.function,validateSpec:H.validateSpec,style:H.style,styleSpec:H.styleSpec,objectElementValidators:{stops:function(Fr){if($==="identity")return[new bt(Fr.key,Fr.value,'identity function may not have a "stops" property')];let Zr=[],en=Fr.value;return Zr=Zr.concat($c({key:Fr.key,value:en,valueSpec:Fr.valueSpec,validateSpec:Fr.validateSpec,style:Fr.style,styleSpec:Fr.styleSpec,arrayElementValidator:lr})),Es(en)==="array"&&en.length===0&&Zr.push(new bt(Fr.key,en,"array must have at least one stop")),Zr},default:function(Fr){return Fr.validateSpec({key:Fr.key,value:Fr.value,valueSpec:C,validateSpec:Fr.validateSpec,style:Fr.style,styleSpec:Fr.styleSpec})}}});return $==="identity"&&oe&&Qe.push(new bt(H.key,H.value,'missing required property "property"')),$==="identity"||H.value.stops||Qe.push(new bt(H.key,H.value,'missing required property "stops"')),$==="exponential"&&H.valueSpec.expression&&!Oc(H.valueSpec)&&Qe.push(new bt(H.key,H.value,"exponential functions not supported")),H.styleSpec.$version>=8&&(be&&!Tl(H.valueSpec)?Qe.push(new bt(H.key,H.value,"property functions not supported")):oe&&!Qu(H.valueSpec)&&Qe.push(new bt(H.key,H.value,"zoom functions not supported"))),$!=="categorical"&&!Be||H.value.property!==void 0||Qe.push(new bt(H.key,H.value,'"property" property is required')),Qe;function lr(Fr){let Zr=[],en=Fr.value,yn=Fr.key;if(Es(en)!=="array")return[new bt(yn,en,`array expected, ${Es(en)} found`)];if(en.length!==2)return[new bt(yn,en,`array length 2 expected, length ${en.length} found`)];if(Be){if(Es(en[0])!=="object")return[new bt(yn,en,`object expected, ${Es(en[0])} found`)];if(en[0].zoom===void 0)return[new bt(yn,en,"object stop key must have zoom")];if(en[0].value===void 0)return[new bt(yn,en,"object stop key must have value")];if(Bt&&Bt>Gs(en[0].zoom))return[new bt(yn,en[0].zoom,"stop zoom values must appear in ascending order")];Gs(en[0].zoom)!==Bt&&(Bt=Gs(en[0].zoom),Mt=void 0,jt={}),Zr=Zr.concat(Xl({key:`${yn}[0]`,value:en[0],valueSpec:{zoom:{}},validateSpec:Fr.validateSpec,style:Fr.style,styleSpec:Fr.styleSpec,objectElementValidators:{zoom:Vs,value:wr}}))}else Zr=Zr.concat(wr({key:`${yn}[0]`,value:en[0],validateSpec:Fr.validateSpec,style:Fr.style,styleSpec:Fr.styleSpec},en));return Zu(Du(en[1]))?Zr.concat([new bt(`${yn}[1]`,en[1],"expressions are not allowed in function stops.")]):Zr.concat(Fr.validateSpec({key:`${yn}[1]`,value:en[1],valueSpec:C,validateSpec:Fr.validateSpec,style:Fr.style,styleSpec:Fr.styleSpec}))}function wr(Fr,Zr){let en=Es(Fr.value),yn=Gs(Fr.value),Vn=Fr.value!==null?Fr.value:Zr;if(ht){if(en!==ht)return[new bt(Fr.key,Vn,`${en} stop domain type must match previous stop domain type ${ht}`)]}else ht=en;if(en!=="number"&&en!=="string"&&en!=="boolean")return[new bt(Fr.key,Vn,"stop domain value must be a number, string, or boolean")];if(en!=="number"&&$!=="categorical"){let Ca=`number expected, ${en} found`;return Tl(C)&&$===void 0&&(Ca+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new bt(Fr.key,Vn,Ca)]}return $!=="categorical"||en!=="number"||isFinite(yn)&&Math.floor(yn)===yn?$!=="categorical"&&en==="number"&&Mt!==void 0&&ynnew bt(`${H.key}${ht.key}`,H.value,ht.message));let $=C.value.expression||C.value._styleExpression.expression;if(H.expressionContext==="property"&&H.propertyKey==="text-font"&&!$.outputDefined())return[new bt(H.key,H.value,`Invalid data expression for "${H.propertyKey}". Output values must be contained as literals within the expression.`)];if(H.expressionContext==="property"&&H.propertyType==="layout"&&!du($))return[new bt(H.key,H.value,'"feature-state" data expressions are not supported with layout properties.')];if(H.expressionContext==="filter"&&!du($))return[new bt(H.key,H.value,'"feature-state" data expressions are not supported with filters.')];if(H.expressionContext&&H.expressionContext.indexOf("cluster")===0){if(!Rc($,["zoom","feature-state"]))return[new bt(H.key,H.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(H.expressionContext==="cluster-initial"&&!Pc($))return[new bt(H.key,H.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ou(H){let C=H.key,$=H.value,ht=H.valueSpec,Mt=[];return Array.isArray(ht.values)?ht.values.indexOf(Gs($))===-1&&Mt.push(new bt(C,$,`expected one of [${ht.values.join(", ")}], ${JSON.stringify($)} found`)):Object.keys(ht.values).indexOf(Gs($))===-1&&Mt.push(new bt(C,$,`expected one of [${Object.keys(ht.values).join(", ")}], ${JSON.stringify($)} found`)),Mt}function tc(H){return Tu(Du(H.value))?Yu(vt({},H,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Xu(H)}function Xu(H){let C=H.value,$=H.key;if(Es(C)!=="array")return[new bt($,C,`array expected, ${Es(C)} found`)];let ht=H.styleSpec,Mt,Bt=[];if(C.length<1)return[new bt($,C,"filter array must have at least 1 element")];switch(Bt=Bt.concat(ou({key:`${$}[0]`,value:C[0],valueSpec:ht.filter_operator,style:H.style,styleSpec:H.styleSpec})),Gs(C[0])){case"<":case"<=":case">":case">=":C.length>=2&&Gs(C[1])==="$type"&&Bt.push(new bt($,C,`"$type" cannot be use with operator "${C[0]}"`));case"==":case"!=":C.length!==3&&Bt.push(new bt($,C,`filter array for operator "${C[0]}" must have 3 elements`));case"in":case"!in":C.length>=2&&(Mt=Es(C[1]),Mt!=="string"&&Bt.push(new bt(`${$}[1]`,C[1],`string expected, ${Mt} found`)));for(let jt=2;jt{Be in $&&C.push(new bt(ht,$[Be],`"${Be}" is prohibited for ref layers`))}),Mt.layers.forEach(Be=>{Gs(Be.id)===oe&&(be=Be)}),be?be.ref?C.push(new bt(ht,$.ref,"ref cannot reference another ref layer")):jt=Gs(be.type):C.push(new bt(ht,$.ref,`ref layer "${oe}" not found`))}else if(jt!=="background")if($.source){let be=Mt.sources&&Mt.sources[$.source],Be=be&&Gs(be.type);be?Be==="vector"&&jt==="raster"?C.push(new bt(ht,$.source,`layer "${$.id}" requires a raster source`)):Be!=="raster-dem"&&jt==="hillshade"?C.push(new bt(ht,$.source,`layer "${$.id}" requires a raster-dem source`)):Be==="raster"&&jt!=="raster"?C.push(new bt(ht,$.source,`layer "${$.id}" requires a vector source`)):Be!=="vector"||$["source-layer"]?Be==="raster-dem"&&jt!=="hillshade"?C.push(new bt(ht,$.source,"raster-dem source can only be used with layer type 'hillshade'.")):jt!=="line"||!$.paint||!$.paint["line-gradient"]||Be==="geojson"&&be.lineMetrics||C.push(new bt(ht,$,`layer "${$.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):C.push(new bt(ht,$,`layer "${$.id}" must specify a "source-layer"`)):C.push(new bt(ht,$.source,`source "${$.source}" not found`))}else C.push(new bt(ht,$,'missing required property "source"'));return C=C.concat(Xl({key:ht,value:$,valueSpec:Bt.layer,style:H.style,styleSpec:H.styleSpec,validateSpec:H.validateSpec,objectElementValidators:{"*":()=>[],type:()=>H.validateSpec({key:`${ht}.type`,value:$.type,valueSpec:Bt.layer.type,style:H.style,styleSpec:H.styleSpec,validateSpec:H.validateSpec,object:$,objectKey:"type"}),filter:tc,layout:be=>Xl({layer:$,key:be.key,value:be.value,style:be.style,styleSpec:be.styleSpec,validateSpec:be.validateSpec,objectElementValidators:{"*":Be=>zl(vt({layerType:jt},Be))}}),paint:be=>Xl({layer:$,key:be.key,value:be.value,style:be.style,styleSpec:be.styleSpec,validateSpec:be.validateSpec,objectElementValidators:{"*":Be=>cf(vt({layerType:jt},Be))}})}})),C}function su(H){let C=H.value,$=H.key,ht=Es(C);return ht!=="string"?[new bt($,C,`string expected, ${ht} found`)]:[]}let Fu={promoteId:function({key:H,value:C}){if(Es(C)==="string")return su({key:H,value:C});{let $=[];for(let ht in C)$.push(...su({key:`${H}.${ht}`,value:C[ht]}));return $}}};function Au(H){let C=H.value,$=H.key,ht=H.styleSpec,Mt=H.style,Bt=H.validateSpec;if(!C.type)return[new bt($,C,'"type" is required')];let jt=Gs(C.type),oe;switch(jt){case"vector":case"raster":return oe=Xl({key:$,value:C,valueSpec:ht[`source_${jt.replace("-","_")}`],style:H.style,styleSpec:ht,objectElementValidators:Fu,validateSpec:Bt}),oe;case"raster-dem":return oe=(function(be){var Be;let Qe=(Be=be.sourceName)!==null&&Be!==void 0?Be:"",lr=be.value,wr=be.styleSpec,Fr=wr.source_raster_dem,Zr=be.style,en=[],yn=Es(lr);if(lr===void 0)return en;if(yn!=="object")return en.push(new bt("source_raster_dem",lr,`object expected, ${yn} found`)),en;let Vn=Gs(lr.encoding)==="custom",Ca=["redFactor","greenFactor","blueFactor","baseShift"],ua=be.value.encoding?`"${be.value.encoding}"`:"Default";for(let wa in lr)!Vn&&Ca.includes(wa)?en.push(new bt(wa,lr[wa],`In "${Qe}": "${wa}" is only valid when "encoding" is set to "custom". ${ua} encoding found`)):Fr[wa]?en=en.concat(be.validateSpec({key:wa,value:lr[wa],valueSpec:Fr[wa],validateSpec:be.validateSpec,style:Zr,styleSpec:wr})):en.push(new bt(wa,lr[wa],`unknown property "${wa}"`));return en})({sourceName:$,value:C,style:H.style,styleSpec:ht,validateSpec:Bt}),oe;case"geojson":if(oe=Xl({key:$,value:C,valueSpec:ht.source_geojson,style:Mt,styleSpec:ht,validateSpec:Bt,objectElementValidators:Fu}),C.cluster)for(let be in C.clusterProperties){let[Be,Qe]=C.clusterProperties[be],lr=typeof Be=="string"?[Be,["accumulated"],["get",be]]:Be;oe.push(...Yu({key:`${$}.${be}.map`,value:Qe,expressionContext:"cluster-map"})),oe.push(...Yu({key:`${$}.${be}.reduce`,value:lr,expressionContext:"cluster-reduce"}))}return oe;case"video":return Xl({key:$,value:C,valueSpec:ht.source_video,style:Mt,validateSpec:Bt,styleSpec:ht});case"image":return Xl({key:$,value:C,valueSpec:ht.source_image,style:Mt,validateSpec:Bt,styleSpec:ht});case"canvas":return[new bt($,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ou({key:`${$}.type`,value:C.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function il(H){let C=H.value,$=H.styleSpec,ht=$.light,Mt=H.style,Bt=[],jt=Es(C);if(C===void 0)return Bt;if(jt!=="object")return Bt=Bt.concat([new bt("light",C,`object expected, ${jt} found`)]),Bt;for(let oe in C){let be=oe.match(/^(.*)-transition$/);Bt=Bt.concat(be&&ht[be[1]]&&ht[be[1]].transition?H.validateSpec({key:oe,value:C[oe],valueSpec:$.transition,validateSpec:H.validateSpec,style:Mt,styleSpec:$}):ht[oe]?H.validateSpec({key:oe,value:C[oe],valueSpec:ht[oe],validateSpec:H.validateSpec,style:Mt,styleSpec:$}):[new bt(oe,C[oe],`unknown property "${oe}"`)])}return Bt}function Cs(H){let C=H.value,$=H.styleSpec,ht=$.sky,Mt=H.style,Bt=Es(C);if(C===void 0)return[];if(Bt!=="object")return[new bt("sky",C,`object expected, ${Bt} found`)];let jt=[];for(let oe in C)jt=jt.concat(ht[oe]?H.validateSpec({key:oe,value:C[oe],valueSpec:ht[oe],style:Mt,styleSpec:$}):[new bt(oe,C[oe],`unknown property "${oe}"`)]);return jt}function Mu(H){let C=H.value,$=H.styleSpec,ht=$.terrain,Mt=H.style,Bt=[],jt=Es(C);if(C===void 0)return Bt;if(jt!=="object")return Bt=Bt.concat([new bt("terrain",C,`object expected, ${jt} found`)]),Bt;for(let oe in C)Bt=Bt.concat(ht[oe]?H.validateSpec({key:oe,value:C[oe],valueSpec:ht[oe],validateSpec:H.validateSpec,style:Mt,styleSpec:$}):[new bt(oe,C[oe],`unknown property "${oe}"`)]);return Bt}function uc(H){let C=[],$=H.value,ht=H.key;if(Array.isArray($)){let Mt=[],Bt=[];for(let jt in $)$[jt].id&&Mt.includes($[jt].id)&&C.push(new bt(ht,$,`all the sprites' ids must be unique, but ${$[jt].id} is duplicated`)),Mt.push($[jt].id),$[jt].url&&Bt.includes($[jt].url)&&C.push(new bt(ht,$,`all the sprites' URLs must be unique, but ${$[jt].url} is duplicated`)),Bt.push($[jt].url),C=C.concat(Xl({key:`${ht}[${jt}]`,value:$[jt],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:H.validateSpec}));return C}return su({key:ht,value:$})}let Su={"*":()=>[],array:$c,boolean:function(H){let C=H.value,$=H.key,ht=Es(C);return ht!=="boolean"?[new bt($,C,`boolean expected, ${ht} found`)]:[]},number:Vs,color:function(H){let C=H.key,$=H.value,ht=Es($);return ht!=="string"?[new bt(C,$,`color expected, ${ht} found`)]:tr.parse(String($))?[]:[new bt(C,$,`color expected, "${$}" found`)]},constants:ku,enum:ou,filter:tc,function:yc,layer:Vc,object:Xl,source:Au,light:il,sky:Cs,terrain:Mu,projection:function(H){let C=H.value,$=H.styleSpec,ht=$.projection,Mt=H.style,Bt=Es(C);if(C===void 0)return[];if(Bt!=="object")return[new bt("projection",C,`object expected, ${Bt} found`)];let jt=[];for(let oe in C)jt=jt.concat(ht[oe]?H.validateSpec({key:oe,value:C[oe],valueSpec:ht[oe],style:Mt,styleSpec:$}):[new bt(oe,C[oe],`unknown property "${oe}"`)]);return jt},string:su,formatted:function(H){return su(H).length===0?[]:Yu(H)},resolvedImage:function(H){return su(H).length===0?[]:Yu(H)},padding:function(H){let C=H.key,$=H.value;if(Es($)==="array"){if($.length<1||$.length>4)return[new bt(C,$,`padding requires 1 to 4 values; ${$.length} values found`)];let ht={type:"number"},Mt=[];for(let Bt=0;Bt<$.length;Bt++)Mt=Mt.concat(H.validateSpec({key:`${C}[${Bt}]`,value:$[Bt],validateSpec:H.validateSpec,valueSpec:ht}));return Mt}return Vs({key:C,value:$,valueSpec:{}})},variableAnchorOffsetCollection:function(H){let C=H.key,$=H.value,ht=Es($),Mt=H.styleSpec;if(ht!=="array"||$.length<1||$.length%2!=0)return[new bt(C,$,"variableAnchorOffsetCollection requires a non-empty array of even length")];let Bt=[];for(let jt=0;jt<$.length;jt+=2)Bt=Bt.concat(ou({key:`${C}[${jt}]`,value:$[jt],valueSpec:Mt.layout_symbol["text-anchor"]})),Bt=Bt.concat($c({key:`${C}[${jt+1}]`,value:$[jt+1],valueSpec:{length:2,value:"number"},validateSpec:H.validateSpec,style:H.style,styleSpec:Mt}));return Bt},sprite:uc};function Dc(H){let C=H.value,$=H.valueSpec,ht=H.styleSpec;return H.validateSpec=Dc,$.expression&&bc(Gs(C))?yc(H):$.expression&&Zu(Du(C))?Yu(H):$.type&&Su[$.type]?Su[$.type](H):Xl(vt({},H,{valueSpec:$.type?ht[$.type]:$}))}function Xe(H){let C=H.value,$=H.key,ht=su(H);return ht.length||(C.indexOf("{fontstack}")===-1&&ht.push(new bt($,C,'"glyphs" url must include a "{fontstack}" token')),C.indexOf("{range}")===-1&&ht.push(new bt($,C,'"glyphs" url must include a "{range}" token'))),ht}function yr(H,C=nt){let $=[];return $=$.concat(Dc({key:"",value:H,valueSpec:C.$root,styleSpec:C,style:H,validateSpec:Dc,objectElementValidators:{glyphs:Xe,"*":()=>[]}})),H.constants&&($=$.concat(ku({key:"constants",value:H.constants}))),Rr($)}function Kr(H){return function(C){return H(dm(yd({},C),{validateSpec:Dc}))}}function Rr(H){return[].concat(H).sort((C,$)=>C.line-$.line)}function mn(H){return function(...C){return Rr(H.apply(this,C))}}yr.source=mn(Kr(Au)),yr.sprite=mn(Kr(uc)),yr.glyphs=mn(Kr(Xe)),yr.light=mn(Kr(il)),yr.sky=mn(Kr(Cs)),yr.terrain=mn(Kr(Mu)),yr.layer=mn(Kr(Vc)),yr.filter=mn(Kr(tc)),yr.paintProperty=mn(Kr(cf)),yr.layoutProperty=mn(Kr(zl));let Pn=yr,ha=Pn.light,Ta=Pn.sky,Ua=Pn.paintProperty,Ya=Pn.layoutProperty;function va(H,C){let $=!1;if(C&&C.length)for(let ht of C)H.fire(new q(new Error(ht.message))),$=!0;return $}class Ba{constructor(C,$,ht){let Mt=this.cells=[];if(C instanceof ArrayBuffer){this.arrayBuffer=C;let jt=new Int32Array(this.arrayBuffer);C=jt[0],this.d=($=jt[1])+2*(ht=jt[2]);for(let be=0;be=lr[Zr+0]&&Mt>=lr[Zr+1])?(oe[Fr]=!0,jt.push(Qe[Fr])):oe[Fr]=!1}}}}_forEachCell(C,$,ht,Mt,Bt,jt,oe,be){let Be=this._convertToCellCoord(C),Qe=this._convertToCellCoord($),lr=this._convertToCellCoord(ht),wr=this._convertToCellCoord(Mt);for(let Fr=Be;Fr<=lr;Fr++)for(let Zr=Qe;Zr<=wr;Zr++){let en=this.d*Zr+Fr;if((!be||be(this._convertFromCellCoord(Fr),this._convertFromCellCoord(Zr),this._convertFromCellCoord(Fr+1),this._convertFromCellCoord(Zr+1)))&&Bt.call(this,C,$,ht,Mt,en,jt,oe,be))return}}_convertFromCellCoord(C){return(C-this.padding)/this.scale}_convertToCellCoord(C){return Math.max(0,Math.min(this.d-1,Math.floor(C*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let C=this.cells,$=3+this.cells.length+1+1,ht=0;for(let jt=0;jt=0)continue;let jt=H[Bt];Mt[Bt]=za[$].shallow.indexOf(Bt)>=0?jt:Wi(jt,C)}H instanceof Error&&(Mt.message=H.message)}if(Mt.$name)throw new Error("$name property is reserved for worker serialization logic.");return $!=="Object"&&(Mt.$name=$),Mt}function Xi(H){if(Oi(H))return H;if(Array.isArray(H))return H.map(Xi);if(typeof H!="object")throw new Error("can't deserialize object of type "+typeof H);let C=Vi(H)||"Object";if(!za[C])throw new Error(`can't deserialize unregistered class ${C}`);let{klass:$}=za[C];if(!$)throw new Error(`can't deserialize unregistered class ${C}`);if($.deserialize)return $.deserialize(H);let ht=Object.create($.prototype);for(let Mt of Object.keys(H)){if(Mt==="$name")continue;let Bt=H[Mt];ht[Mt]=za[C].shallow.indexOf(Mt)>=0?Bt:Xi(Bt)}return ht}class ni{constructor(){this.first=!0}update(C,$){let ht=Math.floor(C);return this.first?(this.first=!1,this.lastIntegerZoom=ht,this.lastIntegerZoomTime=0,this.lastZoom=C,this.lastFloorZoom=ht,!0):(this.lastFloorZoom>ht?(this.lastIntegerZoom=ht+1,this.lastIntegerZoomTime=$):this.lastFloorZoomH>=128&&H<=255,"Hangul Jamo":H=>H>=4352&&H<=4607,Khmer:H=>H>=6016&&H<=6143,"General Punctuation":H=>H>=8192&&H<=8303,"Letterlike Symbols":H=>H>=8448&&H<=8527,"Number Forms":H=>H>=8528&&H<=8591,"Miscellaneous Technical":H=>H>=8960&&H<=9215,"Control Pictures":H=>H>=9216&&H<=9279,"Optical Character Recognition":H=>H>=9280&&H<=9311,"Enclosed Alphanumerics":H=>H>=9312&&H<=9471,"Geometric Shapes":H=>H>=9632&&H<=9727,"Miscellaneous Symbols":H=>H>=9728&&H<=9983,"Miscellaneous Symbols and Arrows":H=>H>=11008&&H<=11263,"Ideographic Description Characters":H=>H>=12272&&H<=12287,"CJK Symbols and Punctuation":H=>H>=12288&&H<=12351,Katakana:H=>H>=12448&&H<=12543,Kanbun:H=>H>=12688&&H<=12703,"CJK Strokes":H=>H>=12736&&H<=12783,"Enclosed CJK Letters and Months":H=>H>=12800&&H<=13055,"CJK Compatibility":H=>H>=13056&&H<=13311,"Yijing Hexagram Symbols":H=>H>=19904&&H<=19967,"Private Use Area":H=>H>=57344&&H<=63743,"Vertical Forms":H=>H>=65040&&H<=65055,"CJK Compatibility Forms":H=>H>=65072&&H<=65103,"Small Form Variants":H=>H>=65104&&H<=65135,"Halfwidth and Fullwidth Forms":H=>H>=65280&&H<=65519};function $i(H){for(let C of H)if(Yo(C.charCodeAt(0)))return!0;return!1}function Do(H){for(let C of H)if(!ys(C.charCodeAt(0)))return!1;return!0}function ss(H){let C=H.map($=>{try{return new RegExp(`\\p{sc=${$}}`,"u").source}catch{return null}}).filter($=>$);return new RegExp(C.join("|"),"u")}let Ps=ss(["Arab","Dupl","Mong","Ougr","Syrc"]);function ys(H){return!Ps.test(String.fromCodePoint(H))}let Os=ss(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Yo(H){return!(H!==746&&H!==747&&(H<4352||!(Za["CJK Compatibility Forms"](H)&&!(H>=65097&&H<=65103)||Za["CJK Compatibility"](H)||Za["CJK Strokes"](H)||!(!Za["CJK Symbols and Punctuation"](H)||H>=12296&&H<=12305||H>=12308&&H<=12319||H===12336)||Za["Enclosed CJK Letters and Months"](H)||Za["Ideographic Description Characters"](H)||Za.Kanbun(H)||Za.Katakana(H)&&H!==12540||!(!Za["Halfwidth and Fullwidth Forms"](H)||H===65288||H===65289||H===65293||H>=65306&&H<=65310||H===65339||H===65341||H===65343||H>=65371&&H<=65503||H===65507||H>=65512&&H<=65519)||!(!Za["Small Form Variants"](H)||H>=65112&&H<=65118||H>=65123&&H<=65126)||Za["Vertical Forms"](H)||Za["Yijing Hexagram Symbols"](H)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(H))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(H))||Os.test(String.fromCodePoint(H)))))}function ll(H){return!(Yo(H)||(function(C){return!!(Za["Latin-1 Supplement"](C)&&(C===167||C===169||C===174||C===177||C===188||C===189||C===190||C===215||C===247)||Za["General Punctuation"](C)&&(C===8214||C===8224||C===8225||C===8240||C===8241||C===8251||C===8252||C===8258||C===8263||C===8264||C===8265||C===8273)||Za["Letterlike Symbols"](C)||Za["Number Forms"](C)||Za["Miscellaneous Technical"](C)&&(C>=8960&&C<=8967||C>=8972&&C<=8991||C>=8996&&C<=9e3||C===9003||C>=9085&&C<=9114||C>=9150&&C<=9165||C===9167||C>=9169&&C<=9179||C>=9186&&C<=9215)||Za["Control Pictures"](C)&&C!==9251||Za["Optical Character Recognition"](C)||Za["Enclosed Alphanumerics"](C)||Za["Geometric Shapes"](C)||Za["Miscellaneous Symbols"](C)&&!(C>=9754&&C<=9759)||Za["Miscellaneous Symbols and Arrows"](C)&&(C>=11026&&C<=11055||C>=11088&&C<=11097||C>=11192&&C<=11243)||Za["CJK Symbols and Punctuation"](C)||Za.Katakana(C)||Za["Private Use Area"](C)||Za["CJK Compatibility Forms"](C)||Za["Small Form Variants"](C)||Za["Halfwidth and Fullwidth Forms"](C)||C===8734||C===8756||C===8757||C>=9984&&C<=10087||C>=10102&&C<=10131||C===65532||C===65533)})(H))}let el=ss(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Rs(H){return el.test(String.fromCodePoint(H))}function bi(H,C){return!(!C&&Rs(H)||H>=2304&&H<=3583||H>=3840&&H<=4255||Za.Khmer(H))}function so(H){for(let C of H)if(Rs(C.charCodeAt(0)))return!0;return!1}let ws=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(H){this.pluginStatus=H.pluginStatus,this.pluginURL=H.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(H){this.applyArabicShaping=H.applyArabicShaping,this.processBidirectionalText=H.processBidirectionalText,this.processStyledBidirectionalText=H.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class fs{constructor(C,$){this.zoom=C,$?(this.now=$.now,this.fadeDuration=$.fadeDuration,this.zoomHistory=$.zoomHistory,this.transition=$.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ni,this.transition={})}isSupportedScript(C){return(function($,ht){for(let Mt of $)if(!bi(Mt.charCodeAt(0),ht))return!1;return!0})(C,ws.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let C=this.zoom,$=C-Math.floor(C),ht=this.crossFadingFactor();return C>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:$+(1-$)*ht}:{fromScale:.5,toScale:1,t:1-(1-ht)*$}}}class Ll{constructor(C,$){this.property=C,this.value=$,this.expression=(function(ht,Mt){if(bc(ht))return new Ws(ht,Mt);if(Zu(ht)){let Bt=Yl(ht,Mt);if(Bt.result==="error")throw new Error(Bt.value.map(jt=>`${jt.key}: ${jt.message}`).join(", "));return Bt.value}{let Bt=ht;return Mt.type==="color"&&typeof ht=="string"?Bt=tr.parse(ht):Mt.type!=="padding"||typeof ht!="number"&&!Array.isArray(ht)?Mt.type==="variableAnchorOffsetCollection"&&Array.isArray(ht)&&(Bt=Nn.parse(ht)):Bt=$r.parse(ht),{kind:"constant",evaluate:()=>Bt}}})($===void 0?C.specification.default:$,C.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(C,$,ht){return this.property.possiblyEvaluate(this,C,$,ht)}}class $l{constructor(C){this.property=C,this.value=new Ll(C,void 0)}transitioned(C,$){return new Bu(this.property,this.value,$,k({},C.transition,this.transition),C.now)}untransitioned(){return new Bu(this.property,this.value,null,{},0)}}class jl{constructor(C){this._properties=C,this._values=Object.create(C.defaultTransitionablePropertyValues)}getValue(C){return h(this._values[C].value.value)}setValue(C,$){Object.prototype.hasOwnProperty.call(this._values,C)||(this._values[C]=new $l(this._values[C].property)),this._values[C].value=new Ll(this._values[C].property,$===null?void 0:h($))}getTransition(C){return h(this._values[C].transition)}setTransition(C,$){Object.prototype.hasOwnProperty.call(this._values,C)||(this._values[C]=new $l(this._values[C].property)),this._values[C].transition=h($)||void 0}serialize(){let C={};for(let $ of Object.keys(this._values)){let ht=this.getValue($);ht!==void 0&&(C[$]=ht);let Mt=this.getTransition($);Mt!==void 0&&(C[`${$}-transition`]=Mt)}return C}transitioned(C,$){let ht=new Jl(this._properties);for(let Mt of Object.keys(this._values))ht._values[Mt]=this._values[Mt].transitioned(C,$._values[Mt]);return ht}untransitioned(){let C=new Jl(this._properties);for(let $ of Object.keys(this._values))C._values[$]=this._values[$].untransitioned();return C}}class Bu{constructor(C,$,ht,Mt,Bt){this.property=C,this.value=$,this.begin=Bt+Mt.delay||0,this.end=this.begin+Mt.duration||0,C.specification.transition&&(Mt.delay||Mt.duration)&&(this.prior=ht)}possiblyEvaluate(C,$,ht){let Mt=C.now||0,Bt=this.value.possiblyEvaluate(C,$,ht),jt=this.prior;if(jt){if(Mt>this.end)return this.prior=null,Bt;if(this.value.isDataDriven())return this.prior=null,Bt;if(Mt=1)return 1;let Be=be*be,Qe=Be*be;return 4*(be<.5?Qe:3*(be-Be)+Qe-.75)})(oe))}}return Bt}}class Jl{constructor(C){this._properties=C,this._values=Object.create(C.defaultTransitioningPropertyValues)}possiblyEvaluate(C,$,ht){let Mt=new Nu(this._properties);for(let Bt of Object.keys(this._values))Mt._values[Bt]=this._values[Bt].possiblyEvaluate(C,$,ht);return Mt}hasTransition(){for(let C of Object.keys(this._values))if(this._values[C].prior)return!0;return!1}}class Ru{constructor(C){this._properties=C,this._values=Object.create(C.defaultPropertyValues)}hasValue(C){return this._values[C].value!==void 0}getValue(C){return h(this._values[C].value)}setValue(C,$){this._values[C]=new Ll(this._values[C].property,$===null?void 0:h($))}serialize(){let C={};for(let $ of Object.keys(this._values)){let ht=this.getValue($);ht!==void 0&&(C[$]=ht)}return C}possiblyEvaluate(C,$,ht){let Mt=new Nu(this._properties);for(let Bt of Object.keys(this._values))Mt._values[Bt]=this._values[Bt].possiblyEvaluate(C,$,ht);return Mt}}class nl{constructor(C,$,ht){this.property=C,this.value=$,this.parameters=ht}isConstant(){return this.value.kind==="constant"}constantOr(C){return this.value.kind==="constant"?this.value.value:C}evaluate(C,$,ht,Mt){return this.property.evaluate(this.value,this.parameters,C,$,ht,Mt)}}class Nu{constructor(C){this._properties=C,this._values=Object.create(C.defaultPossiblyEvaluatedValues)}get(C){return this._values[C]}}class Ui{constructor(C){this.specification=C}possiblyEvaluate(C,$){if(C.isDataDriven())throw new Error("Value should not be data driven");return C.expression.evaluate($)}interpolate(C,$,ht){let Mt=Ti[this.specification.type];return Mt?Mt(C,$,ht):C}}class fo{constructor(C,$){this.specification=C,this.overrides=$}possiblyEvaluate(C,$,ht,Mt){return new nl(this,C.expression.kind==="constant"||C.expression.kind==="camera"?{kind:"constant",value:C.expression.evaluate($,null,{},ht,Mt)}:C.expression,$)}interpolate(C,$,ht){if(C.value.kind!=="constant"||$.value.kind!=="constant")return C;if(C.value.value===void 0||$.value.value===void 0)return new nl(this,{kind:"constant",value:void 0},C.parameters);let Mt=Ti[this.specification.type];if(Mt){let Bt=Mt(C.value.value,$.value.value,ht);return new nl(this,{kind:"constant",value:Bt},C.parameters)}return C}evaluate(C,$,ht,Mt,Bt,jt){return C.kind==="constant"?C.value:C.evaluate($,ht,Mt,Bt,jt)}}class Ql extends fo{possiblyEvaluate(C,$,ht,Mt){if(C.value===void 0)return new nl(this,{kind:"constant",value:void 0},$);if(C.expression.kind==="constant"){let Bt=C.expression.evaluate($,null,{},ht,Mt),jt=C.property.specification.type==="resolvedImage"&&typeof Bt!="string"?Bt.name:Bt,oe=this._calculate(jt,jt,jt,$);return new nl(this,{kind:"constant",value:oe},$)}if(C.expression.kind==="camera"){let Bt=this._calculate(C.expression.evaluate({zoom:$.zoom-1}),C.expression.evaluate({zoom:$.zoom}),C.expression.evaluate({zoom:$.zoom+1}),$);return new nl(this,{kind:"constant",value:Bt},$)}return new nl(this,C.expression,$)}evaluate(C,$,ht,Mt,Bt,jt){if(C.kind==="source"){let oe=C.evaluate($,ht,Mt,Bt,jt);return this._calculate(oe,oe,oe,$)}return C.kind==="composite"?this._calculate(C.evaluate({zoom:Math.floor($.zoom)-1},ht,Mt),C.evaluate({zoom:Math.floor($.zoom)},ht,Mt),C.evaluate({zoom:Math.floor($.zoom)+1},ht,Mt),$):C.value}_calculate(C,$,ht,Mt){return Mt.zoom>Mt.zoomHistory.lastIntegerZoom?{from:C,to:$}:{from:ht,to:$}}interpolate(C){return C}}class ul{constructor(C){this.specification=C}possiblyEvaluate(C,$,ht,Mt){if(C.value!==void 0){if(C.expression.kind==="constant"){let Bt=C.expression.evaluate($,null,{},ht,Mt);return this._calculate(Bt,Bt,Bt,$)}return this._calculate(C.expression.evaluate(new fs(Math.floor($.zoom-1),$)),C.expression.evaluate(new fs(Math.floor($.zoom),$)),C.expression.evaluate(new fs(Math.floor($.zoom+1),$)),$)}}_calculate(C,$,ht,Mt){return Mt.zoom>Mt.zoomHistory.lastIntegerZoom?{from:C,to:$}:{from:ht,to:$}}interpolate(C){return C}}class Fc{constructor(C){this.specification=C}possiblyEvaluate(C,$,ht,Mt){return!!C.expression.evaluate($,null,{},ht,Mt)}interpolate(){return!1}}class Pt{constructor(C){this.properties=C,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let $ in C){let ht=C[$];ht.specification.overridable&&this.overridableProperties.push($);let Mt=this.defaultPropertyValues[$]=new Ll(ht,void 0),Bt=this.defaultTransitionablePropertyValues[$]=new $l(ht);this.defaultTransitioningPropertyValues[$]=Bt.untransitioned(),this.defaultPossiblyEvaluatedValues[$]=Mt.possiblyEvaluate({})}}}ca("DataDrivenProperty",fo),ca("DataConstantProperty",Ui),ca("CrossFadedDataDrivenProperty",Ql),ca("CrossFadedProperty",ul),ca("ColorRampProperty",Fc);let L="-transition";class at extends it{constructor(C,$){if(super(),this.id=C.id,this.type=C.type,this._featureFilter={filter:()=>!0,needGeometry:!1},C.type!=="custom"&&(this.metadata=C.metadata,this.minzoom=C.minzoom,this.maxzoom=C.maxzoom,C.type!=="background"&&(this.source=C.source,this.sourceLayer=C["source-layer"],this.filter=C.filter),$.layout&&(this._unevaluatedLayout=new Ru($.layout)),$.paint)){this._transitionablePaint=new jl($.paint);for(let ht in C.paint)this.setPaintProperty(ht,C.paint[ht],{validate:!1});for(let ht in C.layout)this.setLayoutProperty(ht,C.layout[ht],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Nu($.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(C){return C==="visibility"?this.visibility:this._unevaluatedLayout.getValue(C)}setLayoutProperty(C,$,ht={}){$!=null&&this._validate(Ya,`layers.${this.id}.layout.${C}`,C,$,ht)||(C!=="visibility"?this._unevaluatedLayout.setValue(C,$):this.visibility=$)}getPaintProperty(C){return C.endsWith(L)?this._transitionablePaint.getTransition(C.slice(0,-11)):this._transitionablePaint.getValue(C)}setPaintProperty(C,$,ht={}){if($!=null&&this._validate(Ua,`layers.${this.id}.paint.${C}`,C,$,ht))return!1;if(C.endsWith(L))return this._transitionablePaint.setTransition(C.slice(0,-11),$||void 0),!1;{let Mt=this._transitionablePaint._values[C],Bt=Mt.property.specification["property-type"]==="cross-faded-data-driven",jt=Mt.value.isDataDriven(),oe=Mt.value;this._transitionablePaint.setValue(C,$),this._handleSpecialPaintPropertyUpdate(C);let be=this._transitionablePaint._values[C].value;return be.isDataDriven()||jt||Bt||this._handleOverridablePaintPropertyUpdate(C,oe,be)}}_handleSpecialPaintPropertyUpdate(C){}_handleOverridablePaintPropertyUpdate(C,$,ht){return!1}isHidden(C){return!!(this.minzoom&&C=this.maxzoom)||this.visibility==="none"}updateTransitions(C){this._transitioningPaint=this._transitionablePaint.transitioned(C,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(C,$){C.getCrossfadeParameters&&(this._crossfadeParameters=C.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(C,void 0,$)),this.paint=this._transitioningPaint.possiblyEvaluate(C,void 0,$)}serialize(){let C={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(C.layout=C.layout||{},C.layout.visibility=this.visibility),c(C,($,ht)=>!($===void 0||ht==="layout"&&!Object.keys($).length||ht==="paint"&&!Object.keys($).length))}_validate(C,$,ht,Mt,Bt={}){return(!Bt||Bt.validate!==!1)&&va(this,C.call(Pn,{key:$,layerType:this.type,objectKey:ht,value:Mt,styleSpec:nt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let C in this.paint._values){let $=this.paint.get(C);if($ instanceof nl&&Tl($.property.specification)&&($.value.kind==="source"||$.value.kind==="composite")&&$.value.isStateDependent)return!0}return!1}}let xt={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class kt{constructor(C,$){this._structArray=C,this._pos1=$*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Lt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(C,$){return C._trim(),$&&(C.isTransferred=!0,$.push(C.arrayBuffer)),{length:C.length,arrayBuffer:C.arrayBuffer}}static deserialize(C){let $=Object.create(this.prototype);return $.arrayBuffer=C.arrayBuffer,$.length=C.length,$.capacity=C.arrayBuffer.byteLength/$.bytesPerElement,$._refreshViews(),$}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(C){this.reserve(C),this.length=C}reserve(C){if(C>this.capacity){this.capacity=Math.max(C,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let $=this.uint8;this._refreshViews(),$&&this.uint8.set($)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function le(H,C=1){let $=0,ht=0;return{members:H.map(Mt=>{let Bt=xt[Mt.type].BYTES_PER_ELEMENT,jt=$=xe($,Math.max(C,Bt)),oe=Mt.components||1;return ht=Math.max(ht,Bt),$+=Bt*oe,{name:Mt.name,type:Mt.type,components:oe,offset:jt}}),size:xe($,Math.max(ht,C)),alignment:C}}function xe(H,C){return Math.ceil(H/C)*C}class Pe extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(C,$){let ht=this.length;return this.resize(ht+1),this.emplace(ht,C,$)}emplace(C,$,ht){let Mt=2*C;return this.int16[Mt+0]=$,this.int16[Mt+1]=ht,C}}Pe.prototype.bytesPerElement=4,ca("StructArrayLayout2i4",Pe);class $e extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(C,$,ht){let Mt=this.length;return this.resize(Mt+1),this.emplace(Mt,C,$,ht)}emplace(C,$,ht,Mt){let Bt=3*C;return this.int16[Bt+0]=$,this.int16[Bt+1]=ht,this.int16[Bt+2]=Mt,C}}$e.prototype.bytesPerElement=6,ca("StructArrayLayout3i6",$e);class hr extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(C,$,ht,Mt){let Bt=this.length;return this.resize(Bt+1),this.emplace(Bt,C,$,ht,Mt)}emplace(C,$,ht,Mt,Bt){let jt=4*C;return this.int16[jt+0]=$,this.int16[jt+1]=ht,this.int16[jt+2]=Mt,this.int16[jt+3]=Bt,C}}hr.prototype.bytesPerElement=8,ca("StructArrayLayout4i8",hr);class pr extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(C,$,ht,Mt,Bt,jt){let oe=this.length;return this.resize(oe+1),this.emplace(oe,C,$,ht,Mt,Bt,jt)}emplace(C,$,ht,Mt,Bt,jt,oe){let be=6*C;return this.int16[be+0]=$,this.int16[be+1]=ht,this.int16[be+2]=Mt,this.int16[be+3]=Bt,this.int16[be+4]=jt,this.int16[be+5]=oe,C}}pr.prototype.bytesPerElement=12,ca("StructArrayLayout2i4i12",pr);class Br extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(C,$,ht,Mt,Bt,jt){let oe=this.length;return this.resize(oe+1),this.emplace(oe,C,$,ht,Mt,Bt,jt)}emplace(C,$,ht,Mt,Bt,jt,oe){let be=4*C,Be=8*C;return this.int16[be+0]=$,this.int16[be+1]=ht,this.uint8[Be+4]=Mt,this.uint8[Be+5]=Bt,this.uint8[Be+6]=jt,this.uint8[Be+7]=oe,C}}Br.prototype.bytesPerElement=8,ca("StructArrayLayout2i4ub8",Br);class Jr extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(C,$){let ht=this.length;return this.resize(ht+1),this.emplace(ht,C,$)}emplace(C,$,ht){let Mt=2*C;return this.float32[Mt+0]=$,this.float32[Mt+1]=ht,C}}Jr.prototype.bytesPerElement=8,ca("StructArrayLayout2f8",Jr);class Rt extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(C,$,ht,Mt,Bt,jt,oe,be,Be,Qe){let lr=this.length;return this.resize(lr+1),this.emplace(lr,C,$,ht,Mt,Bt,jt,oe,be,Be,Qe)}emplace(C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr){let wr=10*C;return this.uint16[wr+0]=$,this.uint16[wr+1]=ht,this.uint16[wr+2]=Mt,this.uint16[wr+3]=Bt,this.uint16[wr+4]=jt,this.uint16[wr+5]=oe,this.uint16[wr+6]=be,this.uint16[wr+7]=Be,this.uint16[wr+8]=Qe,this.uint16[wr+9]=lr,C}}Rt.prototype.bytesPerElement=20,ca("StructArrayLayout10ui20",Rt);class Gt extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr){let Fr=this.length;return this.resize(Fr+1),this.emplace(Fr,C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr)}emplace(C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr,Fr){let Zr=12*C;return this.int16[Zr+0]=$,this.int16[Zr+1]=ht,this.int16[Zr+2]=Mt,this.int16[Zr+3]=Bt,this.uint16[Zr+4]=jt,this.uint16[Zr+5]=oe,this.uint16[Zr+6]=be,this.uint16[Zr+7]=Be,this.int16[Zr+8]=Qe,this.int16[Zr+9]=lr,this.int16[Zr+10]=wr,this.int16[Zr+11]=Fr,C}}Gt.prototype.bytesPerElement=24,ca("StructArrayLayout4i4ui4i24",Gt);class ae extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(C,$,ht){let Mt=this.length;return this.resize(Mt+1),this.emplace(Mt,C,$,ht)}emplace(C,$,ht,Mt){let Bt=3*C;return this.float32[Bt+0]=$,this.float32[Bt+1]=ht,this.float32[Bt+2]=Mt,C}}ae.prototype.bytesPerElement=12,ca("StructArrayLayout3f12",ae);class ce extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(C){let $=this.length;return this.resize($+1),this.emplace($,C)}emplace(C,$){return this.uint32[1*C+0]=$,C}}ce.prototype.bytesPerElement=4,ca("StructArrayLayout1ul4",ce);class Te extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(C,$,ht,Mt,Bt,jt,oe,be,Be){let Qe=this.length;return this.resize(Qe+1),this.emplace(Qe,C,$,ht,Mt,Bt,jt,oe,be,Be)}emplace(C,$,ht,Mt,Bt,jt,oe,be,Be,Qe){let lr=10*C,wr=5*C;return this.int16[lr+0]=$,this.int16[lr+1]=ht,this.int16[lr+2]=Mt,this.int16[lr+3]=Bt,this.int16[lr+4]=jt,this.int16[lr+5]=oe,this.uint32[wr+3]=be,this.uint16[lr+8]=Be,this.uint16[lr+9]=Qe,C}}Te.prototype.bytesPerElement=20,ca("StructArrayLayout6i1ul2ui20",Te);class ye extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(C,$,ht,Mt,Bt,jt){let oe=this.length;return this.resize(oe+1),this.emplace(oe,C,$,ht,Mt,Bt,jt)}emplace(C,$,ht,Mt,Bt,jt,oe){let be=6*C;return this.int16[be+0]=$,this.int16[be+1]=ht,this.int16[be+2]=Mt,this.int16[be+3]=Bt,this.int16[be+4]=jt,this.int16[be+5]=oe,C}}ye.prototype.bytesPerElement=12,ca("StructArrayLayout2i2i2i12",ye);class ze extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(C,$,ht,Mt,Bt){let jt=this.length;return this.resize(jt+1),this.emplace(jt,C,$,ht,Mt,Bt)}emplace(C,$,ht,Mt,Bt,jt){let oe=4*C,be=8*C;return this.float32[oe+0]=$,this.float32[oe+1]=ht,this.float32[oe+2]=Mt,this.int16[be+6]=Bt,this.int16[be+7]=jt,C}}ze.prototype.bytesPerElement=16,ca("StructArrayLayout2f1f2i16",ze);class rr extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(C,$,ht,Mt,Bt,jt){let oe=this.length;return this.resize(oe+1),this.emplace(oe,C,$,ht,Mt,Bt,jt)}emplace(C,$,ht,Mt,Bt,jt,oe){let be=16*C,Be=4*C,Qe=8*C;return this.uint8[be+0]=$,this.uint8[be+1]=ht,this.float32[Be+1]=Mt,this.float32[Be+2]=Bt,this.int16[Qe+6]=jt,this.int16[Qe+7]=oe,C}}rr.prototype.bytesPerElement=16,ca("StructArrayLayout2ub2f2i16",rr);class fr extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(C,$,ht){let Mt=this.length;return this.resize(Mt+1),this.emplace(Mt,C,$,ht)}emplace(C,$,ht,Mt){let Bt=3*C;return this.uint16[Bt+0]=$,this.uint16[Bt+1]=ht,this.uint16[Bt+2]=Mt,C}}fr.prototype.bytesPerElement=6,ca("StructArrayLayout3ui6",fr);class gr extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr,Fr,Zr,en,yn,Vn){let Ca=this.length;return this.resize(Ca+1),this.emplace(Ca,C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr,Fr,Zr,en,yn,Vn)}emplace(C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr,Fr,Zr,en,yn,Vn,Ca){let ua=24*C,wa=12*C,Xa=48*C;return this.int16[ua+0]=$,this.int16[ua+1]=ht,this.uint16[ua+2]=Mt,this.uint16[ua+3]=Bt,this.uint32[wa+2]=jt,this.uint32[wa+3]=oe,this.uint32[wa+4]=be,this.uint16[ua+10]=Be,this.uint16[ua+11]=Qe,this.uint16[ua+12]=lr,this.float32[wa+7]=wr,this.float32[wa+8]=Fr,this.uint8[Xa+36]=Zr,this.uint8[Xa+37]=en,this.uint8[Xa+38]=yn,this.uint32[wa+10]=Vn,this.int16[ua+22]=Ca,C}}gr.prototype.bytesPerElement=48,ca("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",gr);class Lr extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr,Fr,Zr,en,yn,Vn,Ca,ua,wa,Xa,di,oo,as,eo,Ki,Co,xo){let ho=this.length;return this.resize(ho+1),this.emplace(ho,C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr,Fr,Zr,en,yn,Vn,Ca,ua,wa,Xa,di,oo,as,eo,Ki,Co,xo)}emplace(C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr,Fr,Zr,en,yn,Vn,Ca,ua,wa,Xa,di,oo,as,eo,Ki,Co,xo,ho){let oi=32*C,Ro=16*C;return this.int16[oi+0]=$,this.int16[oi+1]=ht,this.int16[oi+2]=Mt,this.int16[oi+3]=Bt,this.int16[oi+4]=jt,this.int16[oi+5]=oe,this.int16[oi+6]=be,this.int16[oi+7]=Be,this.uint16[oi+8]=Qe,this.uint16[oi+9]=lr,this.uint16[oi+10]=wr,this.uint16[oi+11]=Fr,this.uint16[oi+12]=Zr,this.uint16[oi+13]=en,this.uint16[oi+14]=yn,this.uint16[oi+15]=Vn,this.uint16[oi+16]=Ca,this.uint16[oi+17]=ua,this.uint16[oi+18]=wa,this.uint16[oi+19]=Xa,this.uint16[oi+20]=di,this.uint16[oi+21]=oo,this.uint16[oi+22]=as,this.uint32[Ro+12]=eo,this.float32[Ro+13]=Ki,this.float32[Ro+14]=Co,this.uint16[oi+30]=xo,this.uint16[oi+31]=ho,C}}Lr.prototype.bytesPerElement=64,ca("StructArrayLayout8i15ui1ul2f2ui64",Lr);class Hr extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(C){let $=this.length;return this.resize($+1),this.emplace($,C)}emplace(C,$){return this.float32[1*C+0]=$,C}}Hr.prototype.bytesPerElement=4,ca("StructArrayLayout1f4",Hr);class nn extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(C,$,ht){let Mt=this.length;return this.resize(Mt+1),this.emplace(Mt,C,$,ht)}emplace(C,$,ht,Mt){let Bt=3*C;return this.uint16[6*C+0]=$,this.float32[Bt+1]=ht,this.float32[Bt+2]=Mt,C}}nn.prototype.bytesPerElement=12,ca("StructArrayLayout1ui2f12",nn);class cn extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(C,$,ht){let Mt=this.length;return this.resize(Mt+1),this.emplace(Mt,C,$,ht)}emplace(C,$,ht,Mt){let Bt=4*C;return this.uint32[2*C+0]=$,this.uint16[Bt+2]=ht,this.uint16[Bt+3]=Mt,C}}cn.prototype.bytesPerElement=8,ca("StructArrayLayout1ul2ui8",cn);class Mn extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(C,$){let ht=this.length;return this.resize(ht+1),this.emplace(ht,C,$)}emplace(C,$,ht){let Mt=2*C;return this.uint16[Mt+0]=$,this.uint16[Mt+1]=ht,C}}Mn.prototype.bytesPerElement=4,ca("StructArrayLayout2ui4",Mn);class Jn extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(C){let $=this.length;return this.resize($+1),this.emplace($,C)}emplace(C,$){return this.uint16[1*C+0]=$,C}}Jn.prototype.bytesPerElement=2,ca("StructArrayLayout1ui2",Jn);class _a extends Lt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(C,$,ht,Mt){let Bt=this.length;return this.resize(Bt+1),this.emplace(Bt,C,$,ht,Mt)}emplace(C,$,ht,Mt,Bt){let jt=4*C;return this.float32[jt+0]=$,this.float32[jt+1]=ht,this.float32[jt+2]=Mt,this.float32[jt+3]=Bt,C}}_a.prototype.bytesPerElement=16,ca("StructArrayLayout4f16",_a);class xa extends kt{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new o(this.anchorPointX,this.anchorPointY)}}xa.prototype.size=20;class La extends Te{get(C){return new xa(this,C)}}ca("CollisionBoxArray",La);class ai extends kt{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(C){this._structArray.uint8[this._pos1+37]=C}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(C){this._structArray.uint8[this._pos1+38]=C}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(C){this._structArray.uint32[this._pos4+10]=C}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}ai.prototype.size=48;class Ai extends gr{get(C){return new ai(this,C)}}ca("PlacedSymbolArray",Ai);class mi extends kt{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(C){this._structArray.uint32[this._pos4+12]=C}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}mi.prototype.size=64;class Yi extends Lr{get(C){return new mi(this,C)}}ca("SymbolInstanceArray",Yi);class Go extends Hr{getoffsetX(C){return this.float32[1*C+0]}}ca("GlyphOffsetArray",Go);class Xo extends $e{getx(C){return this.int16[3*C+0]}gety(C){return this.int16[3*C+1]}gettileUnitDistanceFromAnchor(C){return this.int16[3*C+2]}}ca("SymbolLineVertexArray",Xo);class po extends kt{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}po.prototype.size=12;class Qo extends nn{get(C){return new po(this,C)}}ca("TextAnchorOffsetArray",Qo);class Js extends kt{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}Js.prototype.size=8;class Us extends cn{get(C){return new Js(this,C)}}ca("FeatureIndexArray",Us);class To extends Pe{}class ko extends Pe{}class hl extends Pe{}class Sl extends pr{}class tu extends Br{}class gt extends Jr{}class Et extends Rt{}class Xt extends Gt{}class fe extends ae{}class me extends ce{}class we extends ye{}class Ve extends rr{}class je extends fr{}class or extends Mn{}let Cr=le([{name:"a_pos",components:2,type:"Int16"}],4),{members:Sr}=Cr;class Wr{constructor(C=[]){this.segments=C}prepareSegment(C,$,ht,Mt){let Bt=this.segments[this.segments.length-1];return C>Wr.MAX_VERTEX_ARRAY_LENGTH&&_(`Max vertices per segment is ${Wr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${C}`),(!Bt||Bt.vertexLength+C>Wr.MAX_VERTEX_ARRAY_LENGTH||Bt.sortKey!==Mt)&&(Bt={vertexOffset:$.length,primitiveOffset:ht.length,vertexLength:0,primitiveLength:0},Mt!==void 0&&(Bt.sortKey=Mt),this.segments.push(Bt)),Bt}get(){return this.segments}destroy(){for(let C of this.segments)for(let $ in C.vaos)C.vaos[$].destroy()}static simpleSegment(C,$,ht,Mt){return new Wr([{vertexOffset:C,primitiveOffset:$,vertexLength:ht,primitiveLength:Mt,vaos:{},sortKey:0}])}}function an(H,C){return 256*(H=y(Math.floor(H),0,255))+y(Math.floor(C),0,255)}Wr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ca("SegmentVector",Wr);let on=le([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var ta={exports:{}},hn={exports:{}};hn.exports=function(H,C){var $,ht,Mt,Bt,jt,oe,be,Be;for(ht=H.length-($=3&H.length),Mt=C,jt=3432918353,oe=461845907,Be=0;Be>>16)*jt&65535)<<16)&4294967295)<<15|be>>>17))*oe+(((be>>>16)*oe&65535)<<16)&4294967295)<<13|Mt>>>19))+((5*(Mt>>>16)&65535)<<16)&4294967295))+((58964+(Bt>>>16)&65535)<<16);switch(be=0,$){case 3:be^=(255&H.charCodeAt(Be+2))<<16;case 2:be^=(255&H.charCodeAt(Be+1))<<8;case 1:Mt^=be=(65535&(be=(be=(65535&(be^=255&H.charCodeAt(Be)))*jt+(((be>>>16)*jt&65535)<<16)&4294967295)<<15|be>>>17))*oe+(((be>>>16)*oe&65535)<<16)&4294967295}return Mt^=H.length,Mt=2246822507*(65535&(Mt^=Mt>>>16))+((2246822507*(Mt>>>16)&65535)<<16)&4294967295,Mt=3266489909*(65535&(Mt^=Mt>>>13))+((3266489909*(Mt>>>16)&65535)<<16)&4294967295,(Mt^=Mt>>>16)>>>0};var Bn=hn.exports,Hn={exports:{}};Hn.exports=function(H,C){for(var $,ht=H.length,Mt=C^ht,Bt=0;ht>=4;)$=1540483477*(65535&($=255&H.charCodeAt(Bt)|(255&H.charCodeAt(++Bt))<<8|(255&H.charCodeAt(++Bt))<<16|(255&H.charCodeAt(++Bt))<<24))+((1540483477*($>>>16)&65535)<<16),Mt=1540483477*(65535&Mt)+((1540483477*(Mt>>>16)&65535)<<16)^($=1540483477*(65535&($^=$>>>24))+((1540483477*($>>>16)&65535)<<16)),ht-=4,++Bt;switch(ht){case 3:Mt^=(255&H.charCodeAt(Bt+2))<<16;case 2:Mt^=(255&H.charCodeAt(Bt+1))<<8;case 1:Mt=1540483477*(65535&(Mt^=255&H.charCodeAt(Bt)))+((1540483477*(Mt>>>16)&65535)<<16)}return Mt=1540483477*(65535&(Mt^=Mt>>>13))+((1540483477*(Mt>>>16)&65535)<<16),(Mt^=Mt>>>15)>>>0};var Yn=Bn,na=Hn.exports;ta.exports=Yn,ta.exports.murmur3=Yn,ta.exports.murmur2=na;var _n=r(ta.exports);class Ha{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(C,$,ht,Mt){this.ids.push(Wa(C)),this.positions.push($,ht,Mt)}getPositions(C){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let $=Wa(C),ht=0,Mt=this.ids.length-1;for(;ht>1;this.ids[jt]>=$?Mt=jt:ht=jt+1}let Bt=[];for(;this.ids[ht]===$;)Bt.push({index:this.positions[3*ht],start:this.positions[3*ht+1],end:this.positions[3*ht+2]}),ht++;return Bt}static serialize(C,$){let ht=new Float64Array(C.ids),Mt=new Uint32Array(C.positions);return ri(ht,Mt,0,ht.length-1),$&&$.push(ht.buffer,Mt.buffer),{ids:ht,positions:Mt}}static deserialize(C){let $=new Ha;return $.ids=C.ids,$.positions=C.positions,$.indexed=!0,$}}function Wa(H){let C=+H;return!isNaN(C)&&C<=Number.MAX_SAFE_INTEGER?C:_n(String(H))}function ri(H,C,$,ht){for(;$>1],Bt=$-1,jt=ht+1;for(;;){do Bt++;while(H[Bt]Mt);if(Bt>=jt)break;xi(H,Bt,jt),xi(C,3*Bt,3*jt),xi(C,3*Bt+1,3*jt+1),xi(C,3*Bt+2,3*jt+2)}jt-$`u_${Mt}`),this.type=ht}setUniform(C,$,ht){C.set(ht.constantOr(this.value))}getBinding(C,$,ht){return this.type==="color"?new Ii(C,$):new zi(C,$)}}class Ns{constructor(C,$){this.uniformNames=$.map(ht=>`u_${ht}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(C,$){this.pixelRatioFrom=$.pixelRatio,this.pixelRatioTo=C.pixelRatio,this.patternFrom=$.tlbr,this.patternTo=C.tlbr}setUniform(C,$,ht,Mt){let Bt=Mt==="u_pattern_to"?this.patternTo:Mt==="u_pattern_from"?this.patternFrom:Mt==="u_pixel_ratio_to"?this.pixelRatioTo:Mt==="u_pixel_ratio_from"?this.pixelRatioFrom:null;Bt&&C.set(Bt)}getBinding(C,$,ht){return ht.substr(0,9)==="u_pattern"?new jo(C,$):new zi(C,$)}}class fi{constructor(C,$,ht,Mt){this.expression=C,this.type=ht,this.maxValue=0,this.paintVertexAttributes=$.map(Bt=>({name:`a_${Bt}`,type:"Float32",components:ht==="color"?2:1,offset:0})),this.paintVertexArray=new Mt}populatePaintArray(C,$,ht,Mt,Bt){let jt=this.paintVertexArray.length,oe=this.expression.evaluate(new fs(0),$,{},Mt,[],Bt);this.paintVertexArray.resize(C),this._setPaintValue(jt,C,oe)}updatePaintArray(C,$,ht,Mt){let Bt=this.expression.evaluate({zoom:0},ht,Mt);this._setPaintValue(C,$,Bt)}_setPaintValue(C,$,ht){if(this.type==="color"){let Mt=es(ht);for(let Bt=C;Bt<$;Bt++)this.paintVertexArray.emplace(Bt,Mt[0],Mt[1])}else{for(let Mt=C;Mt<$;Mt++)this.paintVertexArray.emplace(Mt,ht);this.maxValue=Math.max(this.maxValue,Math.abs(ht))}}upload(C){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=C.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ao{constructor(C,$,ht,Mt,Bt,jt){this.expression=C,this.uniformNames=$.map(oe=>`u_${oe}_t`),this.type=ht,this.useIntegerZoom=Mt,this.zoom=Bt,this.maxValue=0,this.paintVertexAttributes=$.map(oe=>({name:`a_${oe}`,type:"Float32",components:ht==="color"?4:2,offset:0})),this.paintVertexArray=new jt}populatePaintArray(C,$,ht,Mt,Bt){let jt=this.expression.evaluate(new fs(this.zoom),$,{},Mt,[],Bt),oe=this.expression.evaluate(new fs(this.zoom+1),$,{},Mt,[],Bt),be=this.paintVertexArray.length;this.paintVertexArray.resize(C),this._setPaintValue(be,C,jt,oe)}updatePaintArray(C,$,ht,Mt){let Bt=this.expression.evaluate({zoom:this.zoom},ht,Mt),jt=this.expression.evaluate({zoom:this.zoom+1},ht,Mt);this._setPaintValue(C,$,Bt,jt)}_setPaintValue(C,$,ht,Mt){if(this.type==="color"){let Bt=es(ht),jt=es(Mt);for(let oe=C;oe<$;oe++)this.paintVertexArray.emplace(oe,Bt[0],Bt[1],jt[0],jt[1])}else{for(let Bt=C;Bt<$;Bt++)this.paintVertexArray.emplace(Bt,ht,Mt);this.maxValue=Math.max(this.maxValue,Math.abs(ht),Math.abs(Mt))}}upload(C){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=C.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(C,$){let ht=this.useIntegerZoom?Math.floor($.zoom):$.zoom,Mt=y(this.expression.interpolationFactor(ht,this.zoom,this.zoom+1),0,1);C.set(Mt)}getBinding(C,$,ht){return new zi(C,$)}}class Bo{constructor(C,$,ht,Mt,Bt,jt){this.expression=C,this.type=$,this.useIntegerZoom=ht,this.zoom=Mt,this.layerId=jt,this.zoomInPaintVertexArray=new Bt,this.zoomOutPaintVertexArray=new Bt}populatePaintArray(C,$,ht){let Mt=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(C),this.zoomOutPaintVertexArray.resize(C),this._setPaintValues(Mt,C,$.patterns&&$.patterns[this.layerId],ht)}updatePaintArray(C,$,ht,Mt,Bt){this._setPaintValues(C,$,ht.patterns&&ht.patterns[this.layerId],Bt)}_setPaintValues(C,$,ht,Mt){if(!Mt||!ht)return;let{min:Bt,mid:jt,max:oe}=ht,be=Mt[Bt],Be=Mt[jt],Qe=Mt[oe];if(be&&Be&&Qe)for(let lr=C;lr<$;lr++)this.zoomInPaintVertexArray.emplace(lr,Be.tl[0],Be.tl[1],Be.br[0],Be.br[1],be.tl[0],be.tl[1],be.br[0],be.br[1],Be.pixelRatio,be.pixelRatio),this.zoomOutPaintVertexArray.emplace(lr,Be.tl[0],Be.tl[1],Be.br[0],Be.br[1],Qe.tl[0],Qe.tl[1],Qe.br[0],Qe.br[1],Be.pixelRatio,Qe.pixelRatio)}upload(C){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=C.createVertexBuffer(this.zoomInPaintVertexArray,on.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=C.createVertexBuffer(this.zoomOutPaintVertexArray,on.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ds{constructor(C,$,ht){this.binders={},this._buffers=[];let Mt=[];for(let Bt in C.paint._values){if(!ht(Bt))continue;let jt=C.paint.get(Bt);if(!(jt instanceof nl&&Tl(jt.property.specification)))continue;let oe=lu(Bt,C.type),be=jt.value,Be=jt.property.specification.type,Qe=jt.property.useIntegerZoom,lr=jt.property.specification["property-type"],wr=lr==="cross-faded"||lr==="cross-faded-data-driven";if(be.kind==="constant")this.binders[Bt]=wr?new Ns(be.value,oe):new pl(be.value,oe,Be),Mt.push(`/u_${Bt}`);else if(be.kind==="source"||wr){let Fr=ps(Bt,Be,"source");this.binders[Bt]=wr?new Bo(be,Be,Qe,$,Fr,C.id):new fi(be,oe,Be,Fr),Mt.push(`/a_${Bt}`)}else{let Fr=ps(Bt,Be,"composite");this.binders[Bt]=new Ao(be,oe,Be,Qe,$,Fr),Mt.push(`/z_${Bt}`)}}this.cacheKey=Mt.sort().join("")}getMaxValue(C){let $=this.binders[C];return $ instanceof fi||$ instanceof Ao?$.maxValue:0}populatePaintArrays(C,$,ht,Mt,Bt){for(let jt in this.binders){let oe=this.binders[jt];(oe instanceof fi||oe instanceof Ao||oe instanceof Bo)&&oe.populatePaintArray(C,$,ht,Mt,Bt)}}setConstantPatternPositions(C,$){for(let ht in this.binders){let Mt=this.binders[ht];Mt instanceof Ns&&Mt.setConstantPatternPositions(C,$)}}updatePaintArrays(C,$,ht,Mt,Bt){let jt=!1;for(let oe in C){let be=$.getPositions(oe);for(let Be of be){let Qe=ht.feature(Be.index);for(let lr in this.binders){let wr=this.binders[lr];if((wr instanceof fi||wr instanceof Ao||wr instanceof Bo)&&wr.expression.isStateDependent===!0){let Fr=Mt.paint.get(lr);wr.expression=Fr.value,wr.updatePaintArray(Be.start,Be.end,Qe,C[oe],Bt),jt=!0}}}}return jt}defines(){let C=[];for(let $ in this.binders){let ht=this.binders[$];(ht instanceof pl||ht instanceof Ns)&&C.push(...ht.uniformNames.map(Mt=>`#define HAS_UNIFORM_${Mt}`))}return C}getBinderAttributes(){let C=[];for(let $ in this.binders){let ht=this.binders[$];if(ht instanceof fi||ht instanceof Ao)for(let Mt=0;Mt!0){this.programConfigurations={};for(let Mt of C)this.programConfigurations[Mt.id]=new Ds(Mt,$,ht);this.needsUpload=!1,this._featureMap=new Ha,this._bufferOffset=0}populatePaintArrays(C,$,ht,Mt,Bt,jt){for(let oe in this.programConfigurations)this.programConfigurations[oe].populatePaintArrays(C,$,Mt,Bt,jt);$.id!==void 0&&this._featureMap.add($.id,ht,this._bufferOffset,C),this._bufferOffset=C,this.needsUpload=!0}updatePaintArrays(C,$,ht,Mt){for(let Bt of ht)this.needsUpload=this.programConfigurations[Bt.id].updatePaintArrays(C,this._featureMap,$,Bt,Mt)||this.needsUpload}get(C){return this.programConfigurations[C]}upload(C){if(this.needsUpload){for(let $ in this.programConfigurations)this.programConfigurations[$].upload(C);this.needsUpload=!1}}destroy(){for(let C in this.programConfigurations)this.programConfigurations[C].destroy()}}function lu(H,C){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[H]||[H.replace(`${C}-`,"").replace(/-/g,"_")]}function ps(H,C,$){let ht={color:{source:Jr,composite:_a},number:{source:Hr,composite:Jr}},Mt=(function(Bt){return{"line-pattern":{source:Et,composite:Et},"fill-pattern":{source:Et,composite:Et},"fill-extrusion-pattern":{source:Et,composite:Et}}[Bt]})(H);return Mt&&Mt[$]||ht[C][$]}ca("ConstantBinder",pl),ca("CrossFadedConstantBinder",Ns),ca("SourceExpressionBinder",fi),ca("CrossFadedCompositeBinder",Bo),ca("CompositeExpressionBinder",Ao),ca("ProgramConfiguration",Ds,{omit:["_buffers"]}),ca("ProgramConfigurationSet",Ts);let zs=8192,Eu=Math.pow(2,14)-1,ie=-Eu-1;function nr(H){let C=zs/H.extent,$=H.loadGeometry();for(let ht=0;ht<$.length;ht++){let Mt=$[ht];for(let Bt=0;Btjt.x+1||bejt.y+1)&&_("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return $}function cr(H,C){return{type:H.type,id:H.id,properties:H.properties,geometry:C?nr(H):[]}}function sn(H,C,$,ht,Mt){H.emplaceBack(2*C+(ht+1)/2,2*$+(Mt+1)/2)}class zn{constructor(C){this.zoom=C.zoom,this.overscaling=C.overscaling,this.layers=C.layers,this.layerIds=this.layers.map($=>$.id),this.index=C.index,this.hasPattern=!1,this.layoutVertexArray=new ko,this.indexArray=new je,this.segments=new Wr,this.programConfigurations=new Ts(C.layers,C.zoom),this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id)}populate(C,$,ht){let Mt=this.layers[0],Bt=[],jt=null,oe=!1;Mt.type==="circle"&&(jt=Mt.layout.get("circle-sort-key"),oe=!jt.isConstant());for(let{feature:be,id:Be,index:Qe,sourceLayerIndex:lr}of C){let wr=this.layers[0]._featureFilter.needGeometry,Fr=cr(be,wr);if(!this.layers[0]._featureFilter.filter(new fs(this.zoom),Fr,ht))continue;let Zr=oe?jt.evaluate(Fr,{},ht):void 0,en={id:Be,properties:be.properties,type:be.type,sourceLayerIndex:lr,index:Qe,geometry:wr?Fr.geometry:nr(be),patterns:{},sortKey:Zr};Bt.push(en)}oe&&Bt.sort((be,Be)=>be.sortKey-Be.sortKey);for(let be of Bt){let{geometry:Be,index:Qe,sourceLayerIndex:lr}=be,wr=C[Qe].feature;this.addFeature(be,Be,Qe,ht),$.featureIndex.insert(wr,Be,Qe,lr,this.index)}}update(C,$,ht){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(C,$,this.stateDependentLayers,ht)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(C){this.uploaded||(this.layoutVertexBuffer=C.createVertexBuffer(this.layoutVertexArray,Sr),this.indexBuffer=C.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(C),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(C,$,ht,Mt){for(let Bt of $)for(let jt of Bt){let oe=jt.x,be=jt.y;if(oe<0||oe>=zs||be<0||be>=zs)continue;let Be=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,C.sortKey),Qe=Be.vertexLength;sn(this.layoutVertexArray,oe,be,-1,-1),sn(this.layoutVertexArray,oe,be,1,-1),sn(this.layoutVertexArray,oe,be,1,1),sn(this.layoutVertexArray,oe,be,-1,1),this.indexArray.emplaceBack(Qe,Qe+1,Qe+2),this.indexArray.emplaceBack(Qe,Qe+3,Qe+2),Be.vertexLength+=4,Be.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,C,ht,{},Mt)}}function Tn(H,C){for(let $=0;$1){if(ea(H,C))return!0;for(let ht=0;ht1?$:$.sub(C)._mult(Mt)._add(C))}function fa(H,C){let $,ht,Mt,Bt=!1;for(let jt=0;jtC.y!=Mt.y>C.y&&C.x<(Mt.x-ht.x)*(C.y-ht.y)/(Mt.y-ht.y)+ht.x&&(Bt=!Bt)}return Bt}function Un(H,C){let $=!1;for(let ht=0,Mt=H.length-1;htC.y!=jt.y>C.y&&C.x<(jt.x-Bt.x)*(C.y-Bt.y)/(jt.y-Bt.y)+Bt.x&&($=!$)}return $}function Nr(H,C,$){let ht=$[0],Mt=$[2];if(H.xMt.x&&C.x>Mt.x||H.yMt.y&&C.y>Mt.y)return!1;let Bt=P(H,C,$[0]);return Bt!==P(H,C,$[1])||Bt!==P(H,C,$[2])||Bt!==P(H,C,$[3])}function fn(H,C,$){let ht=C.paint.get(H).value;return ht.kind==="constant"?ht.value:$.programConfigurations.get(C.id).getMaxValue(H)}function Xn(H){return Math.sqrt(H[0]*H[0]+H[1]*H[1])}function jn(H,C,$,ht,Mt){if(!C[0]&&!C[1])return H;let Bt=o.convert(C)._mult(Mt);$==="viewport"&&Bt._rotate(-ht);let jt=[];for(let oe=0;oe_i(yn,en))})(Be,be),Fr=lr?Qe*oe:Qe;for(let Zr of Mt)for(let en of Zr){let yn=lr?en:_i(en,be),Vn=Fr,Ca=oa([],[en.x,en.y,0,1],be);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Vn*=Ca[3]/jt.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Vn*=jt.cameraToCenterDistance/Ca[3]),qr(wr,yn,Vn))return!0}return!1}}function _i(H,C){let $=oa([],[H.x,H.y,0,1],C);return new o($[0]/$[3],$[1]/$[3])}class pi extends zn{}let Ma;ca("HeatmapBucket",pi,{omit:["layers"]});var Na={get paint(){return Ma=Ma||new Pt({"heatmap-radius":new fo(nt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new fo(nt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ui(nt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Fc(nt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ui(nt.paint_heatmap["heatmap-opacity"])})}};function ui(H,{width:C,height:$},ht,Mt){if(Mt){if(Mt instanceof Uint8ClampedArray)Mt=new Uint8Array(Mt.buffer);else if(Mt.length!==C*$*ht)throw new RangeError(`mismatched image size. expected: ${Mt.length} but got: ${C*$*ht}`)}else Mt=new Uint8Array(C*$*ht);return H.width=C,H.height=$,H.data=Mt,H}function gi(H,{width:C,height:$},ht){if(C===H.width&&$===H.height)return;let Mt=ui({},{width:C,height:$},ht);Ri(H,Mt,{x:0,y:0},{x:0,y:0},{width:Math.min(H.width,C),height:Math.min(H.height,$)},ht),H.width=C,H.height=$,H.data=Mt.data}function Ri(H,C,$,ht,Mt,Bt){if(Mt.width===0||Mt.height===0)return C;if(Mt.width>H.width||Mt.height>H.height||$.x>H.width-Mt.width||$.y>H.height-Mt.height)throw new RangeError("out of range source coordinates for image copy");if(Mt.width>C.width||Mt.height>C.height||ht.x>C.width-Mt.width||ht.y>C.height-Mt.height)throw new RangeError("out of range destination coordinates for image copy");let jt=H.data,oe=C.data;if(jt===oe)throw new Error("srcData equals dstData, so image is already copied");for(let be=0;be{C[H.evaluationKey]=be;let Be=H.expression.evaluate(C);Mt.data[jt+oe+0]=Math.floor(255*Be.r/Be.a),Mt.data[jt+oe+1]=Math.floor(255*Be.g/Be.a),Mt.data[jt+oe+2]=Math.floor(255*Be.b/Be.a),Mt.data[jt+oe+3]=Math.floor(255*Be.a)};if(H.clips)for(let jt=0,oe=0;jt80*$){oe=1/0,be=1/0;let Qe=-1/0,lr=-1/0;for(let wr=$;wrQe&&(Qe=Fr),Zr>lr&&(lr=Zr)}Be=Math.max(Qe-oe,lr-be),Be=Be!==0?32767/Be:0}return Uo(Bt,jt,$,oe,be,Be,0),jt}function Mi(H,C,$,ht,Mt){let Bt;if(Mt===(function(jt,oe,be,Be){let Qe=0;for(let lr=oe,wr=be-Be;lr0)for(let jt=C;jt<$;jt+=ht)Bt=Fe(jt/ht|0,H[jt],H[jt+1],Bt);else for(let jt=$-ht;jt>=C;jt-=ht)Bt=Fe(jt/ht|0,H[jt],H[jt+1],Bt);return Bt&&ne(Bt,Bt.next)&&(He(Bt),Bt=Bt.next),Bt}function Ys(H,C){if(!H)return H;C||(C=H);let $,ht=H;do if($=!1,ht.steiner||!ne(ht,ht.next)&&Qt(ht.prev,ht,ht.next)!==0)ht=ht.next;else{if(He(ht),ht=C=ht.prev,ht===ht.next)break;$=!0}while($||ht!==C);return C}function Uo(H,C,$,ht,Mt,Bt,jt){if(!H)return;!jt&&Bt&&(function(be,Be,Qe,lr){let wr=be;do wr.z===0&&(wr.z=tt(wr.x,wr.y,Be,Qe,lr)),wr.prevZ=wr.prev,wr.nextZ=wr.next,wr=wr.next;while(wr!==be);wr.prevZ.nextZ=null,wr.prevZ=null,(function(Fr){let Zr,en=1;do{let yn,Vn=Fr;Fr=null;let Ca=null;for(Zr=0;Vn;){Zr++;let ua=Vn,wa=0;for(let di=0;di0||Xa>0&&ua;)wa!==0&&(Xa===0||!ua||Vn.z<=ua.z)?(yn=Vn,Vn=Vn.nextZ,wa--):(yn=ua,ua=ua.nextZ,Xa--),Ca?Ca.nextZ=yn:Fr=yn,yn.prevZ=Ca,Ca=yn;Vn=ua}Ca.nextZ=null,en*=2}while(Zr>1)})(wr)})(H,ht,Mt,Bt);let oe=H;for(;H.prev!==H.next;){let be=H.prev,Be=H.next;if(Bt?Il(H,ht,Mt,Bt):tl(H))C.push(be.i,H.i,Be.i),He(H),H=Be.next,oe=Be.next;else if((H=Be)===oe){jt?jt===1?Uo(H=vi(Ys(H),C),C,$,ht,Mt,Bt,2):jt===2&&lo(H,C,$,ht,Mt,Bt):Uo(Ys(H),C,$,ht,Mt,Bt,1);break}}}function tl(H){let C=H.prev,$=H,ht=H.next;if(Qt(C,$,ht)>=0)return!1;let Mt=C.x,Bt=$.x,jt=ht.x,oe=C.y,be=$.y,Be=ht.y,Qe=MtBt?Mt>jt?Mt:jt:Bt>jt?Bt:jt,Fr=oe>be?oe>Be?oe:Be:be>Be?be:Be,Zr=ht.next;for(;Zr!==C;){if(Zr.x>=Qe&&Zr.x<=wr&&Zr.y>=lr&&Zr.y<=Fr&&ft(Mt,oe,Bt,be,jt,Be,Zr.x,Zr.y)&&Qt(Zr.prev,Zr,Zr.next)>=0)return!1;Zr=Zr.next}return!0}function Il(H,C,$,ht){let Mt=H.prev,Bt=H,jt=H.next;if(Qt(Mt,Bt,jt)>=0)return!1;let oe=Mt.x,be=Bt.x,Be=jt.x,Qe=Mt.y,lr=Bt.y,wr=jt.y,Fr=oebe?oe>Be?oe:Be:be>Be?be:Be,yn=Qe>lr?Qe>wr?Qe:wr:lr>wr?lr:wr,Vn=tt(Fr,Zr,C,$,ht),Ca=tt(en,yn,C,$,ht),ua=H.prevZ,wa=H.nextZ;for(;ua&&ua.z>=Vn&&wa&&wa.z<=Ca;){if(ua.x>=Fr&&ua.x<=en&&ua.y>=Zr&&ua.y<=yn&&ua!==Mt&&ua!==jt&&ft(oe,Qe,be,lr,Be,wr,ua.x,ua.y)&&Qt(ua.prev,ua,ua.next)>=0||(ua=ua.prevZ,wa.x>=Fr&&wa.x<=en&&wa.y>=Zr&&wa.y<=yn&&wa!==Mt&&wa!==jt&&ft(oe,Qe,be,lr,Be,wr,wa.x,wa.y)&&Qt(wa.prev,wa,wa.next)>=0))return!1;wa=wa.nextZ}for(;ua&&ua.z>=Vn;){if(ua.x>=Fr&&ua.x<=en&&ua.y>=Zr&&ua.y<=yn&&ua!==Mt&&ua!==jt&&ft(oe,Qe,be,lr,Be,wr,ua.x,ua.y)&&Qt(ua.prev,ua,ua.next)>=0)return!1;ua=ua.prevZ}for(;wa&&wa.z<=Ca;){if(wa.x>=Fr&&wa.x<=en&&wa.y>=Zr&&wa.y<=yn&&wa!==Mt&&wa!==jt&&ft(oe,Qe,be,lr,Be,wr,wa.x,wa.y)&&Qt(wa.prev,wa,wa.next)>=0)return!1;wa=wa.nextZ}return!0}function vi(H,C){let $=H;do{let ht=$.prev,Mt=$.next.next;!ne(ht,Mt)&&Ft(ht,$,$.next,Mt)&&Ne(ht,Mt)&&Ne(Mt,ht)&&(C.push(ht.i,$.i,Mt.i),He($),He($.next),$=H=Mt),$=$.next}while($!==H);return Ys($)}function lo(H,C,$,ht,Mt,Bt){let jt=H;do{let oe=jt.next.next;for(;oe!==jt.prev;){if(jt.i!==oe.i&&zt(jt,oe)){let be=Ie(jt,oe);return jt=Ys(jt,jt.next),be=Ys(be,be.next),Uo(jt,C,$,ht,Mt,Bt,0),void Uo(be,C,$,ht,Mt,Bt,0)}oe=oe.next}jt=jt.next}while(jt!==H)}function ns(H,C){return H.x-C.x}function $o(H,C){let $=(function(Mt,Bt){let jt=Bt,oe=Mt.x,be=Mt.y,Be,Qe=-1/0;do{if(be<=jt.y&&be>=jt.next.y&&jt.next.y!==jt.y){let en=jt.x+(be-jt.y)*(jt.next.x-jt.x)/(jt.next.y-jt.y);if(en<=oe&&en>Qe&&(Qe=en,Be=jt.x=jt.x&&jt.x>=wr&&oe!==jt.x&&ft(beBe.x||jt.x===Be.x&&U(Be,jt)))&&(Be=jt,Zr=en)}jt=jt.next}while(jt!==lr);return Be})(H,C);if(!$)return C;let ht=Ie($,H);return Ys(ht,ht.next),Ys($,$.next)}function U(H,C){return Qt(H.prev,H,C.prev)<0&&Qt(C.next,H,H.next)<0}function tt(H,C,$,ht,Mt){return(H=1431655765&((H=858993459&((H=252645135&((H=16711935&((H=(H-$)*Mt|0)|H<<8))|H<<4))|H<<2))|H<<1))|(C=1431655765&((C=858993459&((C=252645135&((C=16711935&((C=(C-ht)*Mt|0)|C<<8))|C<<4))|C<<2))|C<<1))<<1}function Y(H){let C=H,$=H;do(C.x<$.x||C.x===$.x&&C.y<$.y)&&($=C),C=C.next;while(C!==H);return $}function ft(H,C,$,ht,Mt,Bt,jt,oe){return(Mt-jt)*(C-oe)>=(H-jt)*(Bt-oe)&&(H-jt)*(ht-oe)>=($-jt)*(C-oe)&&($-jt)*(Bt-oe)>=(Mt-jt)*(ht-oe)}function zt(H,C){return H.next.i!==C.i&&H.prev.i!==C.i&&!(function($,ht){let Mt=$;do{if(Mt.i!==$.i&&Mt.next.i!==$.i&&Mt.i!==ht.i&&Mt.next.i!==ht.i&&Ft(Mt,Mt.next,$,ht))return!0;Mt=Mt.next}while(Mt!==$);return!1})(H,C)&&(Ne(H,C)&&Ne(C,H)&&(function($,ht){let Mt=$,Bt=!1,jt=($.x+ht.x)/2,oe=($.y+ht.y)/2;do Mt.y>oe!=Mt.next.y>oe&&Mt.next.y!==Mt.y&&jt<(Mt.next.x-Mt.x)*(oe-Mt.y)/(Mt.next.y-Mt.y)+Mt.x&&(Bt=!Bt),Mt=Mt.next;while(Mt!==$);return Bt})(H,C)&&(Qt(H.prev,H,C.prev)||Qt(H,C.prev,C))||ne(H,C)&&Qt(H.prev,H,H.next)>0&&Qt(C.prev,C,C.next)>0)}function Qt(H,C,$){return(C.y-H.y)*($.x-C.x)-(C.x-H.x)*($.y-C.y)}function ne(H,C){return H.x===C.x&&H.y===C.y}function Ft(H,C,$,ht){let Mt=he(Qt(H,C,$)),Bt=he(Qt(H,C,ht)),jt=he(Qt($,ht,H)),oe=he(Qt($,ht,C));return Mt!==Bt&&jt!==oe||!(Mt!==0||!$t(H,$,C))||!(Bt!==0||!$t(H,ht,C))||!(jt!==0||!$t($,H,ht))||!(oe!==0||!$t($,C,ht))}function $t(H,C,$){return C.x<=Math.max(H.x,$.x)&&C.x>=Math.min(H.x,$.x)&&C.y<=Math.max(H.y,$.y)&&C.y>=Math.min(H.y,$.y)}function he(H){return H>0?1:H<0?-1:0}function Ne(H,C){return Qt(H.prev,H,H.next)<0?Qt(H,C,H.next)>=0&&Qt(H,H.prev,C)>=0:Qt(H,C,H.prev)<0||Qt(H,H.next,C)<0}function Ie(H,C){let $=Ge(H.i,H.x,H.y),ht=Ge(C.i,C.x,C.y),Mt=H.next,Bt=C.prev;return H.next=C,C.prev=H,$.next=Mt,Mt.prev=$,ht.next=$,$.prev=ht,Bt.next=ht,ht.prev=Bt,ht}function Fe(H,C,$,ht){let Mt=Ge(H,C,$);return ht?(Mt.next=ht.next,Mt.prev=ht,ht.next.prev=Mt,ht.next=Mt):(Mt.prev=Mt,Mt.next=Mt),Mt}function He(H){H.next.prev=H.prev,H.prev.next=H.next,H.prevZ&&(H.prevZ.nextZ=H.nextZ),H.nextZ&&(H.nextZ.prevZ=H.prevZ)}function Ge(H,C,$){return{i:H,x:C,y:$,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ae(H,C,$){let ht=$.patternDependencies,Mt=!1;for(let Bt of C){let jt=Bt.paint.get(`${H}-pattern`);jt.isConstant()||(Mt=!0);let oe=jt.constantOr(null);oe&&(Mt=!0,ht[oe.to]=!0,ht[oe.from]=!0)}return Mt}function Oe(H,C,$,ht,Mt){let Bt=Mt.patternDependencies;for(let jt of C){let oe=jt.paint.get(`${H}-pattern`).value;if(oe.kind!=="constant"){let be=oe.evaluate({zoom:ht-1},$,{},Mt.availableImages),Be=oe.evaluate({zoom:ht},$,{},Mt.availableImages),Qe=oe.evaluate({zoom:ht+1},$,{},Mt.availableImages);be=be&&be.name?be.name:be,Be=Be&&Be.name?Be.name:Be,Qe=Qe&&Qe.name?Qe.name:Qe,Bt[be]=!0,Bt[Be]=!0,Bt[Qe]=!0,$.patterns[jt.id]={min:be,mid:Be,max:Qe}}}return $}class Le{constructor(C){this.zoom=C.zoom,this.overscaling=C.overscaling,this.layers=C.layers,this.layerIds=this.layers.map($=>$.id),this.index=C.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new hl,this.indexArray=new je,this.indexArray2=new or,this.programConfigurations=new Ts(C.layers,C.zoom),this.segments=new Wr,this.segments2=new Wr,this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id)}populate(C,$,ht){this.hasPattern=Ae("fill",this.layers,$);let Mt=this.layers[0].layout.get("fill-sort-key"),Bt=!Mt.isConstant(),jt=[];for(let{feature:oe,id:be,index:Be,sourceLayerIndex:Qe}of C){let lr=this.layers[0]._featureFilter.needGeometry,wr=cr(oe,lr);if(!this.layers[0]._featureFilter.filter(new fs(this.zoom),wr,ht))continue;let Fr=Bt?Mt.evaluate(wr,{},ht,$.availableImages):void 0,Zr={id:be,properties:oe.properties,type:oe.type,sourceLayerIndex:Qe,index:Be,geometry:lr?wr.geometry:nr(oe),patterns:{},sortKey:Fr};jt.push(Zr)}Bt&&jt.sort((oe,be)=>oe.sortKey-be.sortKey);for(let oe of jt){let{geometry:be,index:Be,sourceLayerIndex:Qe}=oe;if(this.hasPattern){let lr=Oe("fill",this.layers,oe,this.zoom,$);this.patternFeatures.push(lr)}else this.addFeature(oe,be,Be,ht,{});$.featureIndex.insert(C[Be].feature,be,Be,Qe,this.index)}}update(C,$,ht){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(C,$,this.stateDependentLayers,ht)}addFeatures(C,$,ht){for(let Mt of this.patternFeatures)this.addFeature(Mt,Mt.geometry,Mt.index,$,ht)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(C){this.uploaded||(this.layoutVertexBuffer=C.createVertexBuffer(this.layoutVertexArray,js),this.indexBuffer=C.createIndexBuffer(this.indexArray),this.indexBuffer2=C.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(C),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(C,$,ht,Mt,Bt){for(let jt of au($,500)){let oe=0;for(let Fr of jt)oe+=Fr.length;let be=this.segments.prepareSegment(oe,this.layoutVertexArray,this.indexArray),Be=be.vertexLength,Qe=[],lr=[];for(let Fr of jt){if(Fr.length===0)continue;Fr!==jt[0]&&lr.push(Qe.length/2);let Zr=this.segments2.prepareSegment(Fr.length,this.layoutVertexArray,this.indexArray2),en=Zr.vertexLength;this.layoutVertexArray.emplaceBack(Fr[0].x,Fr[0].y),this.indexArray2.emplaceBack(en+Fr.length-1,en),Qe.push(Fr[0].x),Qe.push(Fr[0].y);for(let yn=1;yn>3}if(Mt--,ht===1||ht===2)Bt+=H.readSVarint(),jt+=H.readSVarint(),ht===1&&(C&&oe.push(C),C=[]),C.push(new la(Bt,jt));else{if(ht!==7)throw new Error("unknown command "+ht);C&&C.push(C[0].clone())}}return C&&oe.push(C),oe},Gn.prototype.bbox=function(){var H=this._pbf;H.pos=this._geometry;for(var C=H.readVarint()+H.pos,$=1,ht=0,Mt=0,Bt=0,jt=1/0,oe=-1/0,be=1/0,Be=-1/0;H.pos>3}if(ht--,$===1||$===2)(Mt+=H.readSVarint())oe&&(oe=Mt),(Bt+=H.readSVarint())Be&&(Be=Bt);else if($!==7)throw new Error("unknown command "+$)}return[jt,be,oe,Be]},Gn.prototype.toGeoJSON=function(H,C,$){var ht,Mt,Bt=this.extent*Math.pow(2,$),jt=this.extent*H,oe=this.extent*C,be=this.loadGeometry(),Be=Gn.types[this.type];function Qe(Fr){for(var Zr=0;Zr>3;Mt=jt===1?ht.readString():jt===2?ht.readFloat():jt===3?ht.readDouble():jt===4?ht.readVarint64():jt===5?ht.readVarint():jt===6?ht.readSVarint():jt===7?ht.readBoolean():null}return Mt})($))}to.prototype.feature=function(H){if(H<0||H>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[H];var C=this._pbf.readVarint()+this._pbf.pos;return new si(this._pbf,C,this.extent,this._keys,this._values)};var ms=Li;function Ko(H,C,$){if(H===3){var ht=new ms($,$.readVarint()+$.pos);ht.length&&(C[ht.name]=ht)}}Dn.VectorTile=function(H,C){this.layers=H.readFields(Ko,{},C)},Dn.VectorTileFeature=qn,Dn.VectorTileLayer=Li;let gs=Dn.VectorTileFeature.types,Pl=Math.pow(2,13);function mo(H,C,$,ht,Mt,Bt,jt,oe){H.emplaceBack(C,$,2*Math.floor(ht*Pl)+jt,Mt*Pl*2,Bt*Pl*2,Math.round(oe))}class Xs{constructor(C){this.zoom=C.zoom,this.overscaling=C.overscaling,this.layers=C.layers,this.layerIds=this.layers.map($=>$.id),this.index=C.index,this.hasPattern=!1,this.layoutVertexArray=new Sl,this.centroidVertexArray=new To,this.indexArray=new je,this.programConfigurations=new Ts(C.layers,C.zoom),this.segments=new Wr,this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id)}populate(C,$,ht){this.features=[],this.hasPattern=Ae("fill-extrusion",this.layers,$);for(let{feature:Mt,id:Bt,index:jt,sourceLayerIndex:oe}of C){let be=this.layers[0]._featureFilter.needGeometry,Be=cr(Mt,be);if(!this.layers[0]._featureFilter.filter(new fs(this.zoom),Be,ht))continue;let Qe={id:Bt,sourceLayerIndex:oe,index:jt,geometry:be?Be.geometry:nr(Mt),properties:Mt.properties,type:Mt.type,patterns:{}};this.hasPattern?this.features.push(Oe("fill-extrusion",this.layers,Qe,this.zoom,$)):this.addFeature(Qe,Qe.geometry,jt,ht,{}),$.featureIndex.insert(Mt,Qe.geometry,jt,oe,this.index,!0)}}addFeatures(C,$,ht){for(let Mt of this.features){let{geometry:Bt}=Mt;this.addFeature(Mt,Bt,Mt.index,$,ht)}}update(C,$,ht){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(C,$,this.stateDependentLayers,ht)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(C){this.uploaded||(this.layoutVertexBuffer=C.createVertexBuffer(this.layoutVertexArray,Wn),this.centroidVertexBuffer=C.createVertexBuffer(this.centroidVertexArray,xn.members,!0),this.indexBuffer=C.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(C),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(C,$,ht,Mt,Bt){for(let jt of au($,500)){let oe={x:0,y:0,vertexCount:0},be=0;for(let Zr of jt)be+=Zr.length;let Be=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let Zr of jt){if(Zr.length===0||Ac(Zr))continue;let en=0;for(let yn=0;yn=1){let Ca=Zr[yn-1];if(!ec(Vn,Ca)){Be.vertexLength+4>Wr.MAX_VERTEX_ARRAY_LENGTH&&(Be=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let ua=Vn.sub(Ca)._perp()._unit(),wa=Ca.dist(Vn);en+wa>32768&&(en=0),mo(this.layoutVertexArray,Vn.x,Vn.y,ua.x,ua.y,0,0,en),mo(this.layoutVertexArray,Vn.x,Vn.y,ua.x,ua.y,0,1,en),oe.x+=2*Vn.x,oe.y+=2*Vn.y,oe.vertexCount+=2,en+=wa,mo(this.layoutVertexArray,Ca.x,Ca.y,ua.x,ua.y,0,0,en),mo(this.layoutVertexArray,Ca.x,Ca.y,ua.x,ua.y,0,1,en),oe.x+=2*Ca.x,oe.y+=2*Ca.y,oe.vertexCount+=2;let Xa=Be.vertexLength;this.indexArray.emplaceBack(Xa,Xa+2,Xa+1),this.indexArray.emplaceBack(Xa+1,Xa+2,Xa+3),Be.vertexLength+=4,Be.primitiveLength+=2}}}}if(Be.vertexLength+be>Wr.MAX_VERTEX_ARRAY_LENGTH&&(Be=this.segments.prepareSegment(be,this.layoutVertexArray,this.indexArray)),gs[C.type]!=="Polygon")continue;let Qe=[],lr=[],wr=Be.vertexLength;for(let Zr of jt)if(Zr.length!==0){Zr!==jt[0]&&lr.push(Qe.length/2);for(let en=0;enzs)||H.y===C.y&&(H.y<0||H.y>zs)}function Ac(H){return H.every(C=>C.x<0)||H.every(C=>C.x>zs)||H.every(C=>C.y<0)||H.every(C=>C.y>zs)}let uh;ca("FillExtrusionBucket",Xs,{omit:["layers","features"]});var vh={get paint(){return uh=uh||new Pt({"fill-extrusion-opacity":new Ui(nt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new fo(nt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ui(nt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ui(nt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ql(nt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new fo(nt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new fo(nt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ui(nt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Kf extends at{constructor(C){super(C,vh)}createBucket(C){return new Xs(C)}queryRadius(){return Xn(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(C,$,ht,Mt,Bt,jt,oe,be){let Be=jn(C,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),jt.angle,oe),Qe=this.paint.get("fill-extrusion-height").evaluate($,ht),lr=this.paint.get("fill-extrusion-base").evaluate($,ht),wr=(function(Zr,en,yn,Vn){let Ca=[];for(let ua of Zr){let wa=[ua.x,ua.y,0,1];oa(wa,wa,en),Ca.push(new o(wa[0]/wa[3],wa[1]/wa[3]))}return Ca})(Be,be),Fr=(function(Zr,en,yn,Vn){let Ca=[],ua=[],wa=Vn[8]*en,Xa=Vn[9]*en,di=Vn[10]*en,oo=Vn[11]*en,as=Vn[8]*yn,eo=Vn[9]*yn,Ki=Vn[10]*yn,Co=Vn[11]*yn;for(let xo of Zr){let ho=[],oi=[];for(let Ro of xo){let Io=Ro.x,xs=Ro.y,mu=Vn[0]*Io+Vn[4]*xs+Vn[12],uu=Vn[1]*Io+Vn[5]*xs+Vn[13],ef=Vn[2]*Io+Vn[6]*xs+Vn[14],Qf=Vn[3]*Io+Vn[7]*xs+Vn[15],Mc=ef+di,qc=Qf+oo,Rf=mu+as,Nf=uu+eo,jf=ef+Ki,nc=Qf+Co,rf=new o((mu+wa)/qc,(uu+Xa)/qc);rf.z=Mc/qc,ho.push(rf);let Lf=new o(Rf/nc,Nf/nc);Lf.z=jf/nc,oi.push(Lf)}Ca.push(ho),ua.push(oi)}return[Ca,ua]})(Mt,lr,Qe,be);return(function(Zr,en,yn){let Vn=1/0;Sn(yn,en)&&(Vn=bh(yn,en[0]));for(let Ca=0;Ca$.id),this.index=C.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach($=>{this.gradients[$.id]={}}),this.layoutVertexArray=new tu,this.layoutVertexArray2=new gt,this.indexArray=new je,this.programConfigurations=new Ts(C.layers,C.zoom),this.segments=new Wr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id)}populate(C,$,ht){this.hasPattern=Ae("line",this.layers,$);let Mt=this.layers[0].layout.get("line-sort-key"),Bt=!Mt.isConstant(),jt=[];for(let{feature:oe,id:be,index:Be,sourceLayerIndex:Qe}of C){let lr=this.layers[0]._featureFilter.needGeometry,wr=cr(oe,lr);if(!this.layers[0]._featureFilter.filter(new fs(this.zoom),wr,ht))continue;let Fr=Bt?Mt.evaluate(wr,{},ht):void 0,Zr={id:be,properties:oe.properties,type:oe.type,sourceLayerIndex:Qe,index:Be,geometry:lr?wr.geometry:nr(oe),patterns:{},sortKey:Fr};jt.push(Zr)}Bt&&jt.sort((oe,be)=>oe.sortKey-be.sortKey);for(let oe of jt){let{geometry:be,index:Be,sourceLayerIndex:Qe}=oe;if(this.hasPattern){let lr=Oe("line",this.layers,oe,this.zoom,$);this.patternFeatures.push(lr)}else this.addFeature(oe,be,Be,ht,{});$.featureIndex.insert(C[Be].feature,be,Be,Qe,this.index)}}update(C,$,ht){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(C,$,this.stateDependentLayers,ht)}addFeatures(C,$,ht){for(let Mt of this.patternFeatures)this.addFeature(Mt,Mt.geometry,Mt.index,$,ht)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(C){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=C.createVertexBuffer(this.layoutVertexArray2,Ih)),this.layoutVertexBuffer=C.createVertexBuffer(this.layoutVertexArray,Xf),this.indexBuffer=C.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(C),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(C){if(C.properties&&Object.prototype.hasOwnProperty.call(C.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(C.properties,"mapbox_clip_end"))return{start:+C.properties.mapbox_clip_start,end:+C.properties.mapbox_clip_end}}addFeature(C,$,ht,Mt,Bt){let jt=this.layers[0].layout,oe=jt.get("line-join").evaluate(C,{}),be=jt.get("line-cap"),Be=jt.get("line-miter-limit"),Qe=jt.get("line-round-limit");this.lineClips=this.lineFeatureClips(C);for(let lr of $)this.addLine(lr,C,oe,be,Be,Qe);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,C,ht,Bt,Mt)}addLine(C,$,ht,Mt,Bt,jt){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Vn=0;Vn=2&&C[be-1].equals(C[be-2]);)be--;let Be=0;for(;Be0;if(oo&&Vn>Be){let Co=wr.dist(Fr);if(Co>2*Qe){let xo=wr.sub(wr.sub(Fr)._mult(Qe/Co)._round());this.updateDistance(Fr,xo),this.addCurrentVertex(xo,en,0,0,lr),Fr=xo}}let eo=Fr&&Zr,Ki=eo?ht:oe?"butt":Mt;if(eo&&Ki==="round"&&(XaBt&&(Ki="bevel"),Ki==="bevel"&&(Xa>2&&(Ki="flipbevel"),Xa100)Ca=yn.mult(-1);else{let Co=Xa*en.add(yn).mag()/en.sub(yn).mag();Ca._perp()._mult(Co*(as?-1:1))}this.addCurrentVertex(wr,Ca,0,0,lr),this.addCurrentVertex(wr,Ca.mult(-1),0,0,lr)}else if(Ki==="bevel"||Ki==="fakeround"){let Co=-Math.sqrt(Xa*Xa-1),xo=as?Co:0,ho=as?0:Co;if(Fr&&this.addCurrentVertex(wr,en,xo,ho,lr),Ki==="fakeround"){let oi=Math.round(180*di/Math.PI/20);for(let Ro=1;Ro2*Qe){let xo=wr.add(Zr.sub(wr)._mult(Qe/Co)._round());this.updateDistance(wr,xo),this.addCurrentVertex(xo,yn,0,0,lr),wr=xo}}}}addCurrentVertex(C,$,ht,Mt,Bt,jt=!1){let oe=$.y*Mt-$.x,be=-$.y-$.x*Mt;this.addHalfVertex(C,$.x+$.y*ht,$.y-$.x*ht,jt,!1,ht,Bt),this.addHalfVertex(C,oe,be,jt,!0,-Mt,Bt),this.distance>Jf/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(C,$,ht,Mt,Bt,jt))}addHalfVertex({x:C,y:$},ht,Mt,Bt,jt,oe,be){let Be=.5*(this.lineClips?this.scaledDistance*(Jf-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((C<<1)+(Bt?1:0),($<<1)+(jt?1:0),Math.round(63*ht)+128,Math.round(63*Mt)+128,1+(oe===0?0:oe<0?-1:1)|(63&Be)<<2,Be>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let Qe=be.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,Qe),be.primitiveLength++),jt?this.e2=Qe:this.e1=Qe}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(C,$){this.distance+=C.dist($),this.updateScaledDistance()}}let ip,Tp;ca("LineBucket",zf,{omit:["layers","patternFeatures"]});var op={get paint(){return Tp=Tp||new Pt({"line-opacity":new fo(nt.paint_line["line-opacity"]),"line-color":new fo(nt.paint_line["line-color"]),"line-translate":new Ui(nt.paint_line["line-translate"]),"line-translate-anchor":new Ui(nt.paint_line["line-translate-anchor"]),"line-width":new fo(nt.paint_line["line-width"]),"line-gap-width":new fo(nt.paint_line["line-gap-width"]),"line-offset":new fo(nt.paint_line["line-offset"]),"line-blur":new fo(nt.paint_line["line-blur"]),"line-dasharray":new ul(nt.paint_line["line-dasharray"]),"line-pattern":new Ql(nt.paint_line["line-pattern"]),"line-gradient":new Fc(nt.paint_line["line-gradient"])})},get layout(){return ip=ip||new Pt({"line-cap":new Ui(nt.layout_line["line-cap"]),"line-join":new fo(nt.layout_line["line-join"]),"line-miter-limit":new Ui(nt.layout_line["line-miter-limit"]),"line-round-limit":new Ui(nt.layout_line["line-round-limit"]),"line-sort-key":new fo(nt.layout_line["line-sort-key"])})}};class Jc extends fo{possiblyEvaluate(C,$){return $=new fs(Math.floor($.zoom),{now:$.now,fadeDuration:$.fadeDuration,zoomHistory:$.zoomHistory,transition:$.transition}),super.possiblyEvaluate(C,$)}evaluate(C,$,ht,Mt){return $=k({},$,{zoom:Math.floor($.zoom)}),super.evaluate(C,$,ht,Mt)}}let Wh;class kp extends at{constructor(C){super(C,op),this.gradientVersion=0,Wh||(Wh=new Jc(op.paint.properties["line-width"].specification),Wh.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(C){if(C==="line-gradient"){let $=this.gradientExpression();this.stepInterpolant=!!(function(ht){return ht._styleExpression!==void 0})($)&&$._styleExpression.expression instanceof vn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(C,$){super.recalculate(C,$),this.paint._values["line-floorwidth"]=Wh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,C)}createBucket(C){return new zf(C)}queryRadius(C){let $=C,ht=Qc(fn("line-width",this,$),fn("line-gap-width",this,$)),Mt=fn("line-offset",this,$);return ht/2+Math.abs(Mt)+Xn(this.paint.get("line-translate"))}queryIntersectsFeature(C,$,ht,Mt,Bt,jt,oe){let be=jn(C,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),jt.angle,oe),Be=oe/2*Qc(this.paint.get("line-width").evaluate($,ht),this.paint.get("line-gap-width").evaluate($,ht)),Qe=this.paint.get("line-offset").evaluate($,ht);return Qe&&(Mt=(function(lr,wr){let Fr=[];for(let Zr=0;Zr=3){for(let yn=0;yn0?C+2*H:H}let sp=le([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Zp=le([{name:"a_projected_pos",components:3,type:"Float32"}],4);le([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let Kp=le([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);le([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let wh=le([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ap=le([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function rc(H,C,$){return H.sections.forEach(ht=>{ht.text=(function(Mt,Bt,jt){let oe=Bt.layout.get("text-transform").evaluate(jt,{});return oe==="uppercase"?Mt=Mt.toLocaleUpperCase():oe==="lowercase"&&(Mt=Mt.toLocaleLowerCase()),ws.applyArabicShaping&&(Mt=ws.applyArabicShaping(Mt)),Mt})(ht.text,C,$)}),H}le([{name:"triangle",components:3,type:"Uint16"}]),le([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),le([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),le([{type:"Float32",name:"offsetX"}]),le([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),le([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let tf={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Ol=24,Mp=Ul,Yp=function(H,C,$,ht,Mt){var Bt,jt,oe=8*Mt-ht-1,be=(1<>1,Qe=-7,lr=Mt-1,wr=-1,Fr=H[C+lr];for(lr+=wr,Bt=Fr&(1<<-Qe)-1,Fr>>=-Qe,Qe+=oe;Qe>0;Bt=256*Bt+H[C+lr],lr+=wr,Qe-=8);for(jt=Bt&(1<<-Qe)-1,Bt>>=-Qe,Qe+=ht;Qe>0;jt=256*jt+H[C+lr],lr+=wr,Qe-=8);if(Bt===0)Bt=1-Be;else{if(Bt===be)return jt?NaN:1/0*(Fr?-1:1);jt+=Math.pow(2,ht),Bt-=Be}return(Fr?-1:1)*jt*Math.pow(2,Bt-ht)},D0=function(H,C,$,ht,Mt,Bt){var jt,oe,be,Be=8*Bt-Mt-1,Qe=(1<>1,wr=Mt===23?Math.pow(2,-24)-Math.pow(2,-77):0,Fr=0,Zr=1,en=C<0||C===0&&1/C<0?1:0;for(C=Math.abs(C),isNaN(C)||C===1/0?(oe=isNaN(C)?1:0,jt=Qe):(jt=Math.floor(Math.log(C)/Math.LN2),C*(be=Math.pow(2,-jt))<1&&(jt--,be*=2),(C+=jt+lr>=1?wr/be:wr*Math.pow(2,1-lr))*be>=2&&(jt++,be/=2),jt+lr>=Qe?(oe=0,jt=Qe):jt+lr>=1?(oe=(C*be-1)*Math.pow(2,Mt),jt+=lr):(oe=C*Math.pow(2,lr-1)*Math.pow(2,Mt),jt=0));Mt>=8;H[$+Fr]=255&oe,Fr+=Zr,oe/=256,Mt-=8);for(jt=jt<0;H[$+Fr]=255&jt,Fr+=Zr,jt/=256,Be-=8);H[$+Fr-Zr]|=128*en};function Ul(H){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(H)?H:new Uint8Array(H||0),this.pos=0,this.type=0,this.length=this.buf.length}Ul.Varint=0,Ul.Fixed64=1,Ul.Bytes=2,Ul.Fixed32=5;var Gh=4294967296,F0=1/Gh,Sp=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Th(H){return H.type===Ul.Bytes?H.readVarint()+H.pos:H.pos+1}function Jm(H,C,$){return $?4294967296*C+(H>>>0):4294967296*(C>>>0)+(H>>>0)}function Xp(H,C,$){var ht=C<=16383?1:C<=2097151?2:C<=268435455?3:Math.floor(Math.log(C)/(7*Math.LN2));$.realloc(ht);for(var Mt=$.pos-1;Mt>=H;Mt--)$.buf[Mt+ht]=$.buf[Mt]}function h_(H,C){for(var $=0;$>>8,H[$+2]=C>>>16,H[$+3]=C>>>24}function Vv(H,C){return(H[C]|H[C+1]<<8|H[C+2]<<16)+(H[C+3]<<24)}Ul.prototype={destroy:function(){this.buf=null},readFields:function(H,C,$){for($=$||this.length;this.pos<$;){var ht=this.readVarint(),Mt=ht>>3,Bt=this.pos;this.type=7&ht,H(Mt,C,this),this.pos===Bt&&this.skip(ht)}return C},readMessage:function(H,C){return this.readFields(H,C,this.readVarint()+this.pos)},readFixed32:function(){var H=R0(this.buf,this.pos);return this.pos+=4,H},readSFixed32:function(){var H=Vv(this.buf,this.pos);return this.pos+=4,H},readFixed64:function(){var H=R0(this.buf,this.pos)+R0(this.buf,this.pos+4)*Gh;return this.pos+=8,H},readSFixed64:function(){var H=R0(this.buf,this.pos)+Vv(this.buf,this.pos+4)*Gh;return this.pos+=8,H},readFloat:function(){var H=Yp(this.buf,this.pos,!0,23,4);return this.pos+=4,H},readDouble:function(){var H=Yp(this.buf,this.pos,!0,52,8);return this.pos+=8,H},readVarint:function(H){var C,$,ht=this.buf;return C=127&($=ht[this.pos++]),$<128?C:(C|=(127&($=ht[this.pos++]))<<7,$<128?C:(C|=(127&($=ht[this.pos++]))<<14,$<128?C:(C|=(127&($=ht[this.pos++]))<<21,$<128?C:(function(Mt,Bt,jt){var oe,be,Be=jt.buf;if(oe=(112&(be=Be[jt.pos++]))>>4,be<128||(oe|=(127&(be=Be[jt.pos++]))<<3,be<128)||(oe|=(127&(be=Be[jt.pos++]))<<10,be<128)||(oe|=(127&(be=Be[jt.pos++]))<<17,be<128)||(oe|=(127&(be=Be[jt.pos++]))<<24,be<128)||(oe|=(1&(be=Be[jt.pos++]))<<31,be<128))return Jm(Mt,oe,Bt);throw new Error("Expected varint not more than 10 bytes")})(C|=(15&($=ht[this.pos]))<<28,H,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var H=this.readVarint();return H%2==1?(H+1)/-2:H/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var H=this.readVarint()+this.pos,C=this.pos;return this.pos=H,H-C>=12&&Sp?(function($,ht,Mt){return Sp.decode($.subarray(ht,Mt))})(this.buf,C,H):(function($,ht,Mt){for(var Bt="",jt=ht;jt239?4:Qe>223?3:Qe>191?2:1;if(jt+wr>Mt)break;wr===1?Qe<128&&(lr=Qe):wr===2?(192&(oe=$[jt+1]))==128&&(lr=(31&Qe)<<6|63&oe)<=127&&(lr=null):wr===3?(be=$[jt+2],(192&(oe=$[jt+1]))==128&&(192&be)==128&&((lr=(15&Qe)<<12|(63&oe)<<6|63&be)<=2047||lr>=55296&&lr<=57343)&&(lr=null)):wr===4&&(be=$[jt+2],Be=$[jt+3],(192&(oe=$[jt+1]))==128&&(192&be)==128&&(192&Be)==128&&((lr=(15&Qe)<<18|(63&oe)<<12|(63&be)<<6|63&Be)<=65535||lr>=1114112)&&(lr=null)),lr===null?(lr=65533,wr=1):lr>65535&&(lr-=65536,Bt+=String.fromCharCode(lr>>>10&1023|55296),lr=56320|1023&lr),Bt+=String.fromCharCode(lr),jt+=wr}return Bt})(this.buf,C,H)},readBytes:function(){var H=this.readVarint()+this.pos,C=this.buf.subarray(this.pos,H);return this.pos=H,C},readPackedVarint:function(H,C){if(this.type!==Ul.Bytes)return H.push(this.readVarint(C));var $=Th(this);for(H=H||[];this.pos<$;)H.push(this.readVarint(C));return H},readPackedSVarint:function(H){if(this.type!==Ul.Bytes)return H.push(this.readSVarint());var C=Th(this);for(H=H||[];this.pos127;);else if(C===Ul.Bytes)this.pos=this.readVarint()+this.pos;else if(C===Ul.Fixed32)this.pos+=4;else{if(C!==Ul.Fixed64)throw new Error("Unimplemented type: "+C);this.pos+=8}},writeTag:function(H,C){this.writeVarint(H<<3|C)},realloc:function(H){for(var C=this.length||16;C268435455||H<0?(function(C,$){var ht,Mt;if(C>=0?(ht=C%4294967296|0,Mt=C/4294967296|0):(Mt=~(-C/4294967296),4294967295^(ht=~(-C%4294967296))?ht=ht+1|0:(ht=0,Mt=Mt+1|0)),C>=18446744073709552e3||C<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");$.realloc(10),(function(Bt,jt,oe){oe.buf[oe.pos++]=127&Bt|128,Bt>>>=7,oe.buf[oe.pos++]=127&Bt|128,Bt>>>=7,oe.buf[oe.pos++]=127&Bt|128,Bt>>>=7,oe.buf[oe.pos++]=127&Bt|128,oe.buf[oe.pos]=127&(Bt>>>=7)})(ht,0,$),(function(Bt,jt){var oe=(7&Bt)<<4;jt.buf[jt.pos++]|=oe|((Bt>>>=3)?128:0),Bt&&(jt.buf[jt.pos++]=127&Bt|((Bt>>>=7)?128:0),Bt&&(jt.buf[jt.pos++]=127&Bt|((Bt>>>=7)?128:0),Bt&&(jt.buf[jt.pos++]=127&Bt|((Bt>>>=7)?128:0),Bt&&(jt.buf[jt.pos++]=127&Bt|((Bt>>>=7)?128:0),Bt&&(jt.buf[jt.pos++]=127&Bt)))))})(Mt,$)})(H,this):(this.realloc(4),this.buf[this.pos++]=127&H|(H>127?128:0),H<=127||(this.buf[this.pos++]=127&(H>>>=7)|(H>127?128:0),H<=127||(this.buf[this.pos++]=127&(H>>>=7)|(H>127?128:0),H<=127||(this.buf[this.pos++]=H>>>7&127))))},writeSVarint:function(H){this.writeVarint(H<0?2*-H-1:2*H)},writeBoolean:function(H){this.writeVarint(!!H)},writeString:function(H){H=String(H),this.realloc(4*H.length),this.pos++;var C=this.pos;this.pos=(function(ht,Mt,Bt){for(var jt,oe,be=0;be55295&&jt<57344){if(!oe){jt>56319||be+1===Mt.length?(ht[Bt++]=239,ht[Bt++]=191,ht[Bt++]=189):oe=jt;continue}if(jt<56320){ht[Bt++]=239,ht[Bt++]=191,ht[Bt++]=189,oe=jt;continue}jt=oe-55296<<10|jt-56320|65536,oe=null}else oe&&(ht[Bt++]=239,ht[Bt++]=191,ht[Bt++]=189,oe=null);jt<128?ht[Bt++]=jt:(jt<2048?ht[Bt++]=jt>>6|192:(jt<65536?ht[Bt++]=jt>>12|224:(ht[Bt++]=jt>>18|240,ht[Bt++]=jt>>12&63|128),ht[Bt++]=jt>>6&63|128),ht[Bt++]=63&jt|128)}return Bt})(this.buf,H,this.pos);var $=this.pos-C;$>=128&&Xp(C,$,this),this.pos=C-1,this.writeVarint($),this.pos+=$},writeFloat:function(H){this.realloc(4),D0(this.buf,H,this.pos,!0,23,4),this.pos+=4},writeDouble:function(H){this.realloc(8),D0(this.buf,H,this.pos,!0,52,8),this.pos+=8},writeBytes:function(H){var C=H.length;this.writeVarint(C),this.realloc(C);for(var $=0;$=128&&Xp($,ht,this),this.pos=$-1,this.writeVarint(ht),this.pos+=ht},writeMessage:function(H,C,$){this.writeTag(H,Ul.Bytes),this.writeRawMessage(C,$)},writePackedVarint:function(H,C){C.length&&this.writeMessage(H,h_,C)},writePackedSVarint:function(H,C){C.length&&this.writeMessage(H,p_,C)},writePackedBoolean:function(H,C){C.length&&this.writeMessage(H,g_,C)},writePackedFloat:function(H,C){C.length&&this.writeMessage(H,d_,C)},writePackedDouble:function(H,C){C.length&&this.writeMessage(H,m_,C)},writePackedFixed32:function(H,C){C.length&&this.writeMessage(H,v_,C)},writePackedSFixed32:function(H,C){C.length&&this.writeMessage(H,y_,C)},writePackedFixed64:function(H,C){C.length&&this.writeMessage(H,x_,C)},writePackedSFixed64:function(H,C){C.length&&this.writeMessage(H,B0,C)},writeBytesField:function(H,C){this.writeTag(H,Ul.Bytes),this.writeBytes(C)},writeFixed32Field:function(H,C){this.writeTag(H,Ul.Fixed32),this.writeFixed32(C)},writeSFixed32Field:function(H,C){this.writeTag(H,Ul.Fixed32),this.writeSFixed32(C)},writeFixed64Field:function(H,C){this.writeTag(H,Ul.Fixed64),this.writeFixed64(C)},writeSFixed64Field:function(H,C){this.writeTag(H,Ul.Fixed64),this.writeSFixed64(C)},writeVarintField:function(H,C){this.writeTag(H,Ul.Varint),this.writeVarint(C)},writeSVarintField:function(H,C){this.writeTag(H,Ul.Varint),this.writeSVarint(C)},writeStringField:function(H,C){this.writeTag(H,Ul.Bytes),this.writeString(C)},writeFloatField:function(H,C){this.writeTag(H,Ul.Fixed32),this.writeFloat(C)},writeDoubleField:function(H,C){this.writeTag(H,Ul.Fixed64),this.writeDouble(C)},writeBooleanField:function(H,C){this.writeVarintField(H,!!C)}};var Qm=r(Mp);let N0=3;function __(H,C,$){H===1&&$.readMessage(Hv,C)}function Hv(H,C,$){if(H===3){let{id:ht,bitmap:Mt,width:Bt,height:jt,left:oe,top:be,advance:Be}=$.readMessage(tg,{});C.push({id:ht,bitmap:new ds({width:Bt+2*N0,height:jt+2*N0},Mt),metrics:{width:Bt,height:jt,left:oe,top:be,advance:Be}})}}function tg(H,C,$){H===1?C.id=$.readVarint():H===2?C.bitmap=$.readBytes():H===3?C.width=$.readVarint():H===4?C.height=$.readVarint():H===5?C.left=$.readSVarint():H===6?C.top=$.readSVarint():H===7&&(C.advance=$.readVarint())}let eg=N0;function j0(H){let C=0,$=0;for(let jt of H)C+=jt.w*jt.h,$=Math.max($,jt.w);H.sort((jt,oe)=>oe.h-jt.h);let ht=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(C/.95)),$),h:1/0}],Mt=0,Bt=0;for(let jt of H)for(let oe=ht.length-1;oe>=0;oe--){let be=ht[oe];if(!(jt.w>be.w||jt.h>be.h)){if(jt.x=be.x,jt.y=be.y,Bt=Math.max(Bt,jt.y+jt.h),Mt=Math.max(Mt,jt.x+jt.w),jt.w===be.w&&jt.h===be.h){let Be=ht.pop();oe=0&&ht>=C&&V0[this.text.charCodeAt(ht)];ht--)$--;this.text=this.text.substring(C,$),this.sectionIndex=this.sectionIndex.slice(C,$)}substring(C,$){let ht=new Qp;return ht.text=this.text.substring(C,$),ht.sectionIndex=this.sectionIndex.slice(C,$),ht.sections=this.sections,ht}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((C,$)=>Math.max(C,this.sections[$].scale),0)}addTextSection(C,$){this.text+=C.text,this.sections.push(Zd.forText(C.scale,C.fontStack||$));let ht=this.sections.length-1;for(let Mt=0;Mt=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function U0(H,C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr,Fr,Zr){let en=Qp.fromFeature(H,Mt),yn;lr===t.ah.vertical&&en.verticalizePunctuation();let{processBidirectionalText:Vn,processStyledBidirectionalText:Ca}=ws;if(Vn&&en.sections.length===1){yn=[];let Xa=Vn(en.toString(),Ep(en,Be,Bt,C,ht,Fr));for(let di of Xa){let oo=new Qp;oo.text=di,oo.sections=en.sections;for(let as=0;as0&&xh>hf&&(hf=xh)}else{let gu=oo[vl.fontStack],pf=gu&&gu[eu];if(pf&&pf.rect)ld=pf.rect,Lu=pf.metrics;else{let xh=di[vl.fontStack],hh=xh&&xh[eu];if(!hh)continue;Lu=hh.metrics}$u=(rf-vl.scale)*Ol}Cf?(Xa.verticalizable=!0,Uf.push({glyph:eu,imageName:kh,x:xs,y:mu+$u,vertical:Cf,scale:vl.scale,fontStack:vl.fontStack,sectionIndex:Vl,metrics:Lu,rect:ld}),xs+=Ah*vl.scale+oi):(Uf.push({glyph:eu,imageName:kh,x:xs,y:mu+$u,vertical:Cf,scale:vl.scale,fontStack:vl.fontStack,sectionIndex:Vl,metrics:Lu,rect:ld}),xs+=Lu.advance*vl.scale+oi)}Uf.length!==0&&(uu=Math.max(xs-oi,uu),T_(Uf,0,Uf.length-1,Qf,hf)),xs=0;let fh=Ki*rf+hf;wf.lineOffset=Math.max(hf,Lf),mu+=fh,ef=Math.max(fh,ef),++Mc}var qc;let Rf=mu-Jp,{horizontalAlign:Nf,verticalAlign:jf}=ng(Co);(function(nc,rf,Lf,wf,Uf,hf,fh,zu,vl){let Vl=(rf-Lf)*Uf,eu=0;eu=hf!==fh?-zu*wf-Jp:(-wf*vl+.5)*fh;for(let $u of nc)for(let Lu of $u.positionedGlyphs)Lu.x+=Vl,Lu.y+=eu})(Xa.positionedLines,Qf,Nf,jf,uu,ef,Ki,Rf,eo.length),Xa.top+=-jf*Rf,Xa.bottom=Xa.top+Rf,Xa.left+=-Nf*uu,Xa.right=Xa.left+uu})(wa,C,$,ht,yn,jt,oe,be,lr,Be,wr,Zr),!(function(Xa){for(let di of Xa)if(di.positionedGlyphs.length!==0)return!1;return!0})(ua)&&wa}let V0={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},b_={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},w_={40:!0};function H0(H,C,$,ht,Mt,Bt){if(C.imageName){let jt=ht[C.imageName];return jt?jt.displaySize[0]*C.scale*Ol/Bt+Mt:0}{let jt=$[C.fontStack],oe=jt&&jt[H];return oe?oe.metrics.advance*C.scale+Mt:0}}function Wv(H,C,$,ht){let Mt=Math.pow(H-C,2);return ht?H=0,Be=0;for(let lr=0;lrBe){let Qe=Math.ceil(Bt/Be);Mt*=Qe/jt,jt=Qe}return{x1:ht,y1:Mt,x2:ht+Bt,y2:Mt+jt}}function Zv(H,C,$,ht,Mt,Bt){let jt=H.image,oe;if(jt.content){let yn=jt.content,Vn=jt.pixelRatio||1;oe=[yn[0]/Vn,yn[1]/Vn,jt.displaySize[0]-yn[2]/Vn,jt.displaySize[1]-yn[3]/Vn]}let be=C.left*Bt,Be=C.right*Bt,Qe,lr,wr,Fr;$==="width"||$==="both"?(Fr=Mt[0]+be-ht[3],lr=Mt[0]+Be+ht[1]):(Fr=Mt[0]+(be+Be-jt.displaySize[0])/2,lr=Fr+jt.displaySize[0]);let Zr=C.top*Bt,en=C.bottom*Bt;return $==="height"||$==="both"?(Qe=Mt[1]+Zr-ht[0],wr=Mt[1]+en+ht[2]):(Qe=Mt[1]+(Zr+en-jt.displaySize[1])/2,wr=Qe+jt.displaySize[1]),{image:jt,top:Qe,right:lr,bottom:wr,left:Fr,collisionPadding:oe}}let Kd=255,Ph=128,up=Kd*Ph;function Kv(H,C){let{expression:$}=C;if($.kind==="constant")return{kind:"constant",layoutSize:$.evaluate(new fs(H+1))};if($.kind==="source")return{kind:"source"};{let{zoomStops:ht,interpolationType:Mt}=$,Bt=0;for(;Btjt.id),this.index=C.index,this.pixelRatio=C.pixelRatio,this.sourceLayerIndex=C.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=An([]),this.placementViewportMatrix=An([]);let $=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Kv(this.zoom,$["text-size"]),this.iconSizeData=Kv(this.zoom,$["icon-size"]);let ht=this.layers[0].layout,Mt=ht.get("symbol-sort-key"),Bt=ht.get("symbol-z-order");this.canOverlap=ag(ht,"text-overlap","text-allow-overlap")!=="never"||ag(ht,"icon-overlap","icon-allow-overlap")!=="never"||ht.get("text-ignore-placement")||ht.get("icon-ignore-placement"),this.sortFeaturesByKey=Bt!=="viewport-y"&&!Mt.isConstant(),this.sortFeaturesByY=(Bt==="viewport-y"||Bt==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,ht.get("symbol-placement")==="point"&&(this.writingModes=ht.get("text-writing-mode").map(jt=>t.ah[jt])),this.stateDependentLayerIds=this.layers.filter(jt=>jt.isStateDependent()).map(jt=>jt.id),this.sourceID=C.sourceID}createArrays(){this.text=new cc(new Ts(this.layers,this.zoom,C=>/^text/.test(C))),this.icon=new cc(new Ts(this.layers,this.zoom,C=>/^icon/.test(C))),this.glyphOffsetArray=new Go,this.lineVertexArray=new Xo,this.symbolInstances=new Yi,this.textAnchorOffsets=new Qo}calculateGlyphDependencies(C,$,ht,Mt,Bt){for(let jt=0;jt0)&&(jt.value.kind!=="constant"||jt.value.value.length>0),Qe=be.value.kind!=="constant"||!!be.value.value||Object.keys(be.parameters).length>0,lr=Bt.get("symbol-sort-key");if(this.features=[],!Be&&!Qe)return;let wr=$.iconDependencies,Fr=$.glyphDependencies,Zr=$.availableImages,en=new fs(this.zoom);for(let{feature:yn,id:Vn,index:Ca,sourceLayerIndex:ua}of C){let wa=Mt._featureFilter.needGeometry,Xa=cr(yn,wa);if(!Mt._featureFilter.filter(en,Xa,ht))continue;let di,oo;if(wa||(Xa.geometry=nr(yn)),Be){let eo=Mt.getValueAndResolveTokens("text-field",Xa,ht,Zr),Ki=Yr.factory(eo),Co=this.hasRTLText=this.hasRTLText||M_(Ki);(!Co||ws.getRTLTextPluginStatus()==="unavailable"||Co&&ws.isParsed())&&(di=rc(Ki,Mt,Xa))}if(Qe){let eo=Mt.getValueAndResolveTokens("icon-image",Xa,ht,Zr);oo=eo instanceof Kn?eo:Kn.fromString(eo)}if(!di&&!oo)continue;let as=this.sortFeaturesByKey?lr.evaluate(Xa,{},ht):void 0;if(this.features.push({id:Vn,text:di,icon:oo,index:Ca,sourceLayerIndex:ua,geometry:Xa.geometry,properties:yn.properties,type:A_[yn.type],sortKey:as}),oo&&(wr[oo.name]=!0),di){let eo=jt.evaluate(Xa,{},ht).join(","),Ki=Bt.get("text-rotation-alignment")!=="viewport"&&Bt.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.ah.vertical)>=0;for(let Co of di.sections)if(Co.image)wr[Co.image.name]=!0;else{let xo=$i(di.toString()),ho=Co.fontStack||eo,oi=Fr[ho]=Fr[ho]||{};this.calculateGlyphDependencies(Co.text,oi,Ki,this.allowVerticalPlacement,xo)}}}Bt.get("symbol-placement")==="line"&&(this.features=(function(yn){let Vn={},Ca={},ua=[],wa=0;function Xa(eo){ua.push(yn[eo]),wa++}function di(eo,Ki,Co){let xo=Ca[eo];return delete Ca[eo],Ca[Ki]=xo,ua[xo].geometry[0].pop(),ua[xo].geometry[0]=ua[xo].geometry[0].concat(Co[0]),xo}function oo(eo,Ki,Co){let xo=Vn[Ki];return delete Vn[Ki],Vn[eo]=xo,ua[xo].geometry[0].shift(),ua[xo].geometry[0]=Co[0].concat(ua[xo].geometry[0]),xo}function as(eo,Ki,Co){let xo=Co?Ki[0][Ki[0].length-1]:Ki[0][0];return`${eo}:${xo.x}:${xo.y}`}for(let eo=0;eoeo.geometry)})(this.features)),this.sortFeaturesByKey&&this.features.sort((yn,Vn)=>yn.sortKey-Vn.sortKey)}update(C,$,ht){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(C,$,this.layers,ht),this.icon.programConfigurations.updatePaintArrays(C,$,this.layers,ht))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(C){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(C),this.iconCollisionBox.upload(C)),this.text.upload(C,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(C,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(C,$){let ht=this.lineVertexArray.length;if(C.segment!==void 0){let Mt=C.dist($[C.segment+1]),Bt=C.dist($[C.segment]),jt={};for(let oe=C.segment+1;oe<$.length;oe++)jt[oe]={x:$[oe].x,y:$[oe].y,tileUnitDistanceFromAnchor:Mt},oe<$.length-1&&(Mt+=$[oe+1].dist($[oe]));for(let oe=C.segment||0;oe>=0;oe--)jt[oe]={x:$[oe].x,y:$[oe].y,tileUnitDistanceFromAnchor:Bt},oe>0&&(Bt+=$[oe-1].dist($[oe]));for(let oe=0;oe<$.length;oe++){let be=jt[oe];this.lineVertexArray.emplaceBack(be.x,be.y,be.tileUnitDistanceFromAnchor)}}return{lineStartIndex:ht,lineLength:this.lineVertexArray.length-ht}}addSymbols(C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr){let Fr=C.indexArray,Zr=C.layoutVertexArray,en=C.segments.prepareSegment(4*$.length,Zr,Fr,this.canOverlap?jt.sortKey:void 0),yn=this.glyphOffsetArray.length,Vn=en.vertexLength,Ca=this.allowVerticalPlacement&&oe===t.ah.vertical?Math.PI/2:0,ua=jt.text&&jt.text.sections;for(let wa=0;wa<$.length;wa++){let{tl:Xa,tr:di,bl:oo,br:as,tex:eo,pixelOffsetTL:Ki,pixelOffsetBR:Co,minFontScaleX:xo,minFontScaleY:ho,glyphOffset:oi,isSDF:Ro,sectionIndex:Io}=$[wa],xs=en.vertexLength,mu=oi[1];W0(Zr,be.x,be.y,Xa.x,mu+Xa.y,eo.x,eo.y,ht,Ro,Ki.x,Ki.y,xo,ho),W0(Zr,be.x,be.y,di.x,mu+di.y,eo.x+eo.w,eo.y,ht,Ro,Co.x,Ki.y,xo,ho),W0(Zr,be.x,be.y,oo.x,mu+oo.y,eo.x,eo.y+eo.h,ht,Ro,Ki.x,Co.y,xo,ho),W0(Zr,be.x,be.y,as.x,mu+as.y,eo.x+eo.w,eo.y+eo.h,ht,Ro,Co.x,Co.y,xo,ho),cp(C.dynamicLayoutVertexArray,be,Ca),Fr.emplaceBack(xs,xs+1,xs+2),Fr.emplaceBack(xs+1,xs+2,xs+3),en.vertexLength+=4,en.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(oi[0]),wa!==$.length-1&&Io===$[wa+1].sectionIndex||C.programConfigurations.populatePaintArrays(Zr.length,jt,jt.index,{},wr,ua&&ua[Io])}C.placedSymbolArray.emplaceBack(be.x,be.y,yn,this.glyphOffsetArray.length-yn,Vn,Be,Qe,be.segment,ht?ht[0]:0,ht?ht[1]:0,Mt[0],Mt[1],oe,0,!1,0,lr)}_addCollisionDebugVertex(C,$,ht,Mt,Bt,jt){return $.emplaceBack(0,0),C.emplaceBack(ht.x,ht.y,Mt,Bt,Math.round(jt.x),Math.round(jt.y))}addCollisionDebugVertices(C,$,ht,Mt,Bt,jt,oe){let be=Bt.segments.prepareSegment(4,Bt.layoutVertexArray,Bt.indexArray),Be=be.vertexLength,Qe=Bt.layoutVertexArray,lr=Bt.collisionVertexArray,wr=oe.anchorX,Fr=oe.anchorY;this._addCollisionDebugVertex(Qe,lr,jt,wr,Fr,new o(C,$)),this._addCollisionDebugVertex(Qe,lr,jt,wr,Fr,new o(ht,$)),this._addCollisionDebugVertex(Qe,lr,jt,wr,Fr,new o(ht,Mt)),this._addCollisionDebugVertex(Qe,lr,jt,wr,Fr,new o(C,Mt)),be.vertexLength+=4;let Zr=Bt.indexArray;Zr.emplaceBack(Be,Be+1),Zr.emplaceBack(Be+1,Be+2),Zr.emplaceBack(Be+2,Be+3),Zr.emplaceBack(Be+3,Be),be.primitiveLength+=4}addDebugCollisionBoxes(C,$,ht,Mt){for(let Bt=C;Bt<$;Bt++){let jt=this.collisionBoxArray.get(Bt);this.addCollisionDebugVertices(jt.x1,jt.y1,jt.x2,jt.y2,Mt?this.textCollisionBox:this.iconCollisionBox,jt.anchorPoint,ht)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new td(we,wh.members,or),this.iconCollisionBox=new td(we,wh.members,or);for(let C=0;C0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(C,$){let ht=C.placedSymbolArray.get($),Mt=ht.vertexStartIndex+4*ht.numGlyphs;for(let Bt=ht.vertexStartIndex;BtMt[oe]-Mt[be]||Bt[be]-Bt[oe]),jt}addToSortKeyRanges(C,$){let ht=this.sortKeyRanges[this.sortKeyRanges.length-1];ht&&ht.sortKey===$?ht.symbolInstanceEnd=C+1:this.sortKeyRanges.push({sortKey:$,symbolInstanceStart:C,symbolInstanceEnd:C+1})}sortFeatures(C){if(this.sortFeaturesByY&&this.sortedAngle!==C&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(C),this.sortedAngle=C,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let $ of this.symbolInstanceIndexes){let ht=this.symbolInstances.get($);this.featureSortOrder.push(ht.featureIndex),[ht.rightJustifiedTextSymbolIndex,ht.centerJustifiedTextSymbolIndex,ht.leftJustifiedTextSymbolIndex].forEach((Mt,Bt,jt)=>{Mt>=0&&jt.indexOf(Mt)===Bt&&this.addIndicesForPlacedSymbol(this.text,Mt)}),ht.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,ht.verticalPlacedTextSymbolIndex),ht.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,ht.placedIconSymbolIndex),ht.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,ht.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Yd,Xd;ca("SymbolBucket",zp,{omit:["layers","collisionBoxArray","features","compareText"]}),zp.MAX_GLYPHS=65535,zp.addDynamicAttributes=cp;var og={get paint(){return Xd=Xd||new Pt({"icon-opacity":new fo(nt.paint_symbol["icon-opacity"]),"icon-color":new fo(nt.paint_symbol["icon-color"]),"icon-halo-color":new fo(nt.paint_symbol["icon-halo-color"]),"icon-halo-width":new fo(nt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new fo(nt.paint_symbol["icon-halo-blur"]),"icon-translate":new Ui(nt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ui(nt.paint_symbol["icon-translate-anchor"]),"text-opacity":new fo(nt.paint_symbol["text-opacity"]),"text-color":new fo(nt.paint_symbol["text-color"],{runtimeType:We,getOverride:H=>H.textColor,hasOverride:H=>!!H.textColor}),"text-halo-color":new fo(nt.paint_symbol["text-halo-color"]),"text-halo-width":new fo(nt.paint_symbol["text-halo-width"]),"text-halo-blur":new fo(nt.paint_symbol["text-halo-blur"]),"text-translate":new Ui(nt.paint_symbol["text-translate"]),"text-translate-anchor":new Ui(nt.paint_symbol["text-translate-anchor"])})},get layout(){return Yd=Yd||new Pt({"symbol-placement":new Ui(nt.layout_symbol["symbol-placement"]),"symbol-spacing":new Ui(nt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ui(nt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new fo(nt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ui(nt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ui(nt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ui(nt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ui(nt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ui(nt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ui(nt.layout_symbol["icon-rotation-alignment"]),"icon-size":new fo(nt.layout_symbol["icon-size"]),"icon-text-fit":new Ui(nt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ui(nt.layout_symbol["icon-text-fit-padding"]),"icon-image":new fo(nt.layout_symbol["icon-image"]),"icon-rotate":new fo(nt.layout_symbol["icon-rotate"]),"icon-padding":new fo(nt.layout_symbol["icon-padding"]),"icon-keep-upright":new Ui(nt.layout_symbol["icon-keep-upright"]),"icon-offset":new fo(nt.layout_symbol["icon-offset"]),"icon-anchor":new fo(nt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ui(nt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ui(nt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ui(nt.layout_symbol["text-rotation-alignment"]),"text-field":new fo(nt.layout_symbol["text-field"]),"text-font":new fo(nt.layout_symbol["text-font"]),"text-size":new fo(nt.layout_symbol["text-size"]),"text-max-width":new fo(nt.layout_symbol["text-max-width"]),"text-line-height":new Ui(nt.layout_symbol["text-line-height"]),"text-letter-spacing":new fo(nt.layout_symbol["text-letter-spacing"]),"text-justify":new fo(nt.layout_symbol["text-justify"]),"text-radial-offset":new fo(nt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ui(nt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new fo(nt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new fo(nt.layout_symbol["text-anchor"]),"text-max-angle":new Ui(nt.layout_symbol["text-max-angle"]),"text-writing-mode":new Ui(nt.layout_symbol["text-writing-mode"]),"text-rotate":new fo(nt.layout_symbol["text-rotate"]),"text-padding":new Ui(nt.layout_symbol["text-padding"]),"text-keep-upright":new Ui(nt.layout_symbol["text-keep-upright"]),"text-transform":new fo(nt.layout_symbol["text-transform"]),"text-offset":new fo(nt.layout_symbol["text-offset"]),"text-allow-overlap":new Ui(nt.layout_symbol["text-allow-overlap"]),"text-overlap":new Ui(nt.layout_symbol["text-overlap"]),"text-ignore-placement":new Ui(nt.layout_symbol["text-ignore-placement"]),"text-optional":new Ui(nt.layout_symbol["text-optional"])})}};class ed{constructor(C){if(C.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=C.property.overrides?C.property.overrides.runtimeType:Kt,this.defaultValue=C}evaluate(C){if(C.formattedSection){let $=this.defaultValue.property.overrides;if($&&$.hasOverride(C.formattedSection))return $.getOverride(C.formattedSection)}return C.feature&&C.featureState?this.defaultValue.evaluate(C.feature,C.featureState):this.defaultValue.property.specification.default}eachChild(C){this.defaultValue.isConstant()||C(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ca("FormatSectionOverride",ed,{omit:["defaultValue"]});class G0 extends at{constructor(C){super(C,og)}recalculate(C,$){if(super.recalculate(C,$),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let ht=this.layout.get("text-writing-mode");if(ht){let Mt=[];for(let Bt of ht)Mt.indexOf(Bt)<0&&Mt.push(Bt);this.layout._values["text-writing-mode"]=Mt}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(C,$,ht,Mt){let Bt=this.layout.get(C).evaluate($,{},ht,Mt),jt=this._unevaluatedLayout._values[C];return jt.isDataDriven()||Zu(jt.value)||!Bt?Bt:(function(oe,be){return be.replace(/{([^{}]+)}/g,(Be,Qe)=>oe&&Qe in oe?String(oe[Qe]):"")})($.properties,Bt)}createBucket(C){return new zp(C)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let C of og.paint.overridableProperties){if(!G0.hasPaintOverride(this.layout,C))continue;let $=this.paint.get(C),ht=new ed($),Mt=new Kl(ht,$.property.specification),Bt=null;Bt=$.value.kind==="constant"||$.value.kind==="source"?new Ou("source",Mt):new Rl("composite",Mt,$.value.zoomStops),this.paint._values[C]=new nl($.property,Bt,$.parameters)}}_handleOverridablePaintPropertyUpdate(C,$,ht){return!(!this.layout||$.isDataDriven()||ht.isDataDriven())&&G0.hasPaintOverride(this.layout,C)}static hasPaintOverride(C,$){let ht=C.get("text-field"),Mt=og.paint.properties[$],Bt=!1,jt=oe=>{for(let be of oe)if(Mt.overrides&&Mt.overrides.hasOverride(be))return void(Bt=!0)};if(ht.value.kind==="constant"&&ht.value.value instanceof Yr)jt(ht.value.value.sections);else if(ht.value.kind==="source"){let oe=Be=>{Bt||(Be instanceof Ga&&Cn(Be.value)===er?jt(Be.value.sections):Be instanceof ts?jt(Be.sections):Be.eachChild(oe))},be=ht.value;be._styleExpression&&oe(be._styleExpression.expression)}return Bt}}let sg;var Yv={get paint(){return sg=sg||new Pt({"background-color":new Ui(nt.paint_background["background-color"]),"background-pattern":new ul(nt.paint_background["background-pattern"]),"background-opacity":new Ui(nt.paint_background["background-opacity"])})}};class $d extends at{constructor(C){super(C,Yv)}}let Z0;var lg={get paint(){return Z0=Z0||new Pt({"raster-opacity":new Ui(nt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ui(nt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ui(nt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ui(nt.paint_raster["raster-brightness-max"]),"raster-saturation":new Ui(nt.paint_raster["raster-saturation"]),"raster-contrast":new Ui(nt.paint_raster["raster-contrast"]),"raster-resampling":new Ui(nt.paint_raster["raster-resampling"]),"raster-fade-duration":new Ui(nt.paint_raster["raster-fade-duration"])})}};class S_ extends at{constructor(C){super(C,lg)}}class Xv extends at{constructor(C){super(C,{}),this.onAdd=$=>{this.implementation.onAdd&&this.implementation.onAdd($,$.painter.context.gl)},this.onRemove=$=>{this.implementation.onRemove&&this.implementation.onRemove($,$.painter.context.gl)},this.implementation=C}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Jd{constructor(C){this._methodToThrottle=C,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let ug=63710088e-1;class Oh{constructor(C,$){if(isNaN(C)||isNaN($))throw new Error(`Invalid LngLat object: (${C}, ${$})`);if(this.lng=+C,this.lat=+$,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Oh(S(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(C){let $=Math.PI/180,ht=this.lat*$,Mt=C.lat*$,Bt=Math.sin(ht)*Math.sin(Mt)+Math.cos(ht)*Math.cos(Mt)*Math.cos((C.lng-this.lng)*$);return ug*Math.acos(Math.min(Bt,1))}static convert(C){if(C instanceof Oh)return C;if(Array.isArray(C)&&(C.length===2||C.length===3))return new Oh(Number(C[0]),Number(C[1]));if(!Array.isArray(C)&&typeof C=="object"&&C!==null)return new Oh(Number("lng"in C?C.lng:C.lon),Number(C.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}let $v=2*Math.PI*ug;function K0(H){return $v*Math.cos(H*Math.PI/180)}function Y0(H){return(180+H)/360}function Jv(H){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+H*Math.PI/360)))/360}function yh(H,C){return H/K0(C)}function cg(H){return 360/Math.PI*Math.atan(Math.exp((180-360*H)*Math.PI/180))-90}class Qd{constructor(C,$,ht=0){this.x=+C,this.y=+$,this.z=+ht}static fromLngLat(C,$=0){let ht=Oh.convert(C);return new Qd(Y0(ht.lng),Jv(ht.lat),yh($,ht.lat))}toLngLat(){return new Oh(360*this.x-180,cg(this.y))}toAltitude(){return this.z*K0(cg(this.y))}meterInMercatorCoordinateUnits(){return 1/$v*(C=cg(this.y),1/Math.cos(C*Math.PI/180));var C}}function Qv(H,C,$){var ht=2*Math.PI*6378137/256/Math.pow(2,$);return[H*ht-2*Math.PI*6378137/2,C*ht-2*Math.PI*6378137/2]}class fg{constructor(C,$,ht){if(!(function(Mt,Bt,jt){return!(Mt<0||Mt>25||jt<0||jt>=Math.pow(2,Mt)||Bt<0||Bt>=Math.pow(2,Mt))})(C,$,ht))throw new Error(`x=${$}, y=${ht}, z=${C} outside of bounds. 0<=x<${Math.pow(2,C)}, 0<=y<${Math.pow(2,C)} 0<=z<=25 `);this.z=C,this.x=$,this.y=ht,this.key=rd(0,C,C,$,ht)}equals(C){return this.z===C.z&&this.x===C.x&&this.y===C.y}url(C,$,ht){let Mt=(jt=this.y,oe=this.z,be=Qv(256*(Bt=this.x),256*(jt=Math.pow(2,oe)-jt-1),oe),Be=Qv(256*(Bt+1),256*(jt+1),oe),be[0]+","+be[1]+","+Be[0]+","+Be[1]);var Bt,jt,oe,be,Be;let Qe=(function(lr,wr,Fr){let Zr,en="";for(let yn=lr;yn>0;yn--)Zr=1<1?"@2x":"").replace(/{quadkey}/g,Qe).replace(/{bbox-epsg-3857}/g,Mt)}isChildOf(C){let $=this.z-C.z;return $>0&&C.x===this.x>>$&&C.y===this.y>>$}getTilePoint(C){let $=Math.pow(2,this.z);return new o((C.x*$-this.x)*zs,(C.y*$-this.y)*zs)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ty{constructor(C,$){this.wrap=C,this.canonical=$,this.key=rd(C,$.z,$.z,$.x,$.y)}}class dh{constructor(C,$,ht,Mt,Bt){if(C= z; overscaledZ = ${C}; z = ${ht}`);this.overscaledZ=C,this.wrap=$,this.canonical=new fg(ht,+Mt,+Bt),this.key=rd($,C,ht,Mt,Bt)}clone(){return new dh(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(C){return this.overscaledZ===C.overscaledZ&&this.wrap===C.wrap&&this.canonical.equals(C.canonical)}scaledTo(C){if(C>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${C}; overscaledZ = ${this.overscaledZ}`);let $=this.canonical.z-C;return C>this.canonical.z?new dh(C,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new dh(C,this.wrap,C,this.canonical.x>>$,this.canonical.y>>$)}calculateScaledKey(C,$){if(C>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${C}; overscaledZ = ${this.overscaledZ}`);let ht=this.canonical.z-C;return C>this.canonical.z?rd(this.wrap*+$,C,this.canonical.z,this.canonical.x,this.canonical.y):rd(this.wrap*+$,C,C,this.canonical.x>>ht,this.canonical.y>>ht)}isChildOf(C){if(C.wrap!==this.wrap)return!1;let $=this.canonical.z-C.canonical.z;return C.overscaledZ===0||C.overscaledZ>$&&C.canonical.y===this.canonical.y>>$}children(C){if(this.overscaledZ>=C)return[new dh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let $=this.canonical.z+1,ht=2*this.canonical.x,Mt=2*this.canonical.y;return[new dh($,this.wrap,$,ht,Mt),new dh($,this.wrap,$,ht+1,Mt),new dh($,this.wrap,$,ht,Mt+1),new dh($,this.wrap,$,ht+1,Mt+1)]}isLessThan(C){return this.wrapC.wrap)&&(this.overscaledZC.overscaledZ)&&(this.canonical.xC.canonical.x)&&this.canonical.ythis.max&&(this.max=lr),lr=this.dim+1||$<-1||$>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return($+1)*this.stride+(C+1)}unpack(C,$,ht){return C*this.redFactor+$*this.greenFactor+ht*this.blueFactor-this.baseShift}getPixels(){return new rs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(C,$,ht){if(this.dim!==C.dim)throw new Error("dem dimension mismatch");let Mt=$*this.dim,Bt=$*this.dim+this.dim,jt=ht*this.dim,oe=ht*this.dim+this.dim;switch($){case-1:Mt=Bt-1;break;case 1:Bt=Mt+1}switch(ht){case-1:jt=oe-1;break;case 1:oe=jt+1}let be=-$*this.dim,Be=-ht*this.dim;for(let Qe=jt;Qe=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${C} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[C]}}class ry{constructor(C,$,ht,Mt,Bt){this.type="Feature",this._vectorTileFeature=C,C._z=$,C._x=ht,C._y=Mt,this.properties=C.properties,this.id=Bt}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(C){this._geometry=C}toJSON(){let C={geometry:this.geometry};for(let $ in this)$!=="_geometry"&&$!=="_vectorTileFeature"&&(C[$]=this[$]);return C}}class ny{constructor(C,$){this.tileID=C,this.x=C.canonical.x,this.y=C.canonical.y,this.z=C.canonical.z,this.grid=new Ba(zs,16,0),this.grid3D=new Ba(zs,16,0),this.featureIndexArray=new Us,this.promoteId=$}insert(C,$,ht,Mt,Bt,jt){let oe=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(ht,Mt,Bt);let be=jt?this.grid3D:this.grid;for(let Be=0;Be<$.length;Be++){let Qe=$[Be],lr=[1/0,1/0,-1/0,-1/0];for(let wr=0;wr=0&&lr[3]>=0&&be.insert(oe,lr[0],lr[1],lr[2],lr[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Dn.VectorTile(new Qm(this.rawTileData)).layers,this.sourceLayerCoder=new ey(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(C,$,ht,Mt){this.loadVTLayers();let Bt=C.params||{},jt=zs/C.tileSize/C.scale,oe=wc(Bt.filter),be=C.queryGeometry,Be=C.queryPadding*jt,Qe=hg(be),lr=this.grid.query(Qe.minX-Be,Qe.minY-Be,Qe.maxX+Be,Qe.maxY+Be),wr=hg(C.cameraQueryGeometry),Fr=this.grid3D.query(wr.minX-Be,wr.minY-Be,wr.maxX+Be,wr.maxY+Be,(yn,Vn,Ca,ua)=>(function(wa,Xa,di,oo,as){for(let Ki of wa)if(Xa<=Ki.x&&di<=Ki.y&&oo>=Ki.x&&as>=Ki.y)return!0;let eo=[new o(Xa,di),new o(Xa,as),new o(oo,as),new o(oo,di)];if(wa.length>2){for(let Ki of eo)if(Un(wa,Ki))return!0}for(let Ki=0;Ki(ua||(ua=nr(wa)),Xa.queryIntersectsFeature(be,wa,di,ua,this.z,C.transform,jt,C.pixelPosMatrix)))}return Zr}loadMatchingFeature(C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr){let wr=this.bucketLayerIDs[$];if(jt&&!(function(yn,Vn){for(let Ca=0;Ca=0)return!0;return!1})(jt,wr))return;let Fr=this.sourceLayerCoder.decode(ht),Zr=this.vtLayers[Fr].feature(Mt);if(Bt.needGeometry){let yn=cr(Zr,!0);if(!Bt.filter(new fs(this.tileID.overscaledZ),yn,this.tileID.canonical))return}else if(!Bt.filter(new fs(this.tileID.overscaledZ),Zr))return;let en=this.getId(Zr,Fr);for(let yn=0;yn{let oe=C instanceof Nu?C.get(jt):null;return oe&&oe.evaluate?oe.evaluate($,ht,Mt):oe})}function hg(H){let C=1/0,$=1/0,ht=-1/0,Mt=-1/0;for(let Bt of H)C=Math.min(C,Bt.x),$=Math.min($,Bt.y),ht=Math.max(ht,Bt.x),Mt=Math.max(Mt,Bt.y);return{minX:C,minY:$,maxX:ht,maxY:Mt}}function iy(H,C){return C-H}function oy(H,C,$,ht,Mt){let Bt=[];for(let jt=0;jt=ht&&lr.x>=ht||(Qe.x>=ht?Qe=new o(ht,Qe.y+(ht-Qe.x)/(lr.x-Qe.x)*(lr.y-Qe.y))._round():lr.x>=ht&&(lr=new o(ht,Qe.y+(ht-Qe.x)/(lr.x-Qe.x)*(lr.y-Qe.y))._round()),Qe.y>=Mt&&lr.y>=Mt||(Qe.y>=Mt?Qe=new o(Qe.x+(Mt-Qe.y)/(lr.y-Qe.y)*(lr.x-Qe.x),Mt)._round():lr.y>=Mt&&(lr=new o(Qe.x+(Mt-Qe.y)/(lr.y-Qe.y)*(lr.x-Qe.x),Mt)._round()),be&&Qe.equals(be[be.length-1])||(be=[Qe],Bt.push(be)),be.push(lr)))))}}return Bt}ca("FeatureIndex",ny,{omit:["rawTileData","sourceLayerCoder"]});class fp extends o{constructor(C,$,ht,Mt){super(C,$),this.angle=ht,Mt!==void 0&&(this.segment=Mt)}clone(){return new fp(this.x,this.y,this.angle,this.segment)}}function sy(H,C,$,ht,Mt){if(C.segment===void 0||$===0)return!0;let Bt=C,jt=C.segment+1,oe=0;for(;oe>-$/2;){if(jt--,jt<0)return!1;oe-=H[jt].dist(Bt),Bt=H[jt]}oe+=H[jt].dist(H[jt+1]),jt++;let be=[],Be=0;for(;oe<$/2;){let Qe=H[jt],lr=H[jt+1];if(!lr)return!1;let wr=H[jt-1].angleTo(Qe)-Qe.angleTo(lr);for(wr=Math.abs((wr+3*Math.PI)%(2*Math.PI)-Math.PI),be.push({distance:oe,angleDelta:wr}),Be+=wr;oe-be[0].distance>ht;)Be-=be.shift().angleDelta;if(Be>Mt)return!1;jt++,oe+=Qe.dist(lr)}return!0}function ly(H){let C=0;for(let $=0;$Be){let Zr=(Be-be)/Fr,en=Ti.number(lr.x,wr.x,Zr),yn=Ti.number(lr.y,wr.y,Zr),Vn=new fp(en,yn,wr.angleTo(lr),Qe);return Vn._round(),!jt||sy(H,Vn,oe,jt,C)?Vn:void 0}be+=Fr}}function z_(H,C,$,ht,Mt,Bt,jt,oe,be){let Be=uy(ht,Bt,jt),Qe=cy(ht,Mt),lr=Qe*jt,wr=H[0].x===0||H[0].x===be||H[0].y===0||H[0].y===be;return C-lr=0&&wa=0&&Xa=0&&wr+Be<=Qe){let di=new fp(wa,Xa,Ca,Zr);di._round(),ht&&!sy(H,di,Bt,ht,Mt)||Fr.push(di)}}lr+=Vn}return oe||Fr.length||jt||(Fr=Cp(H,lr/2,$,ht,Mt,Bt,jt,!0,be)),Fr}ca("Anchor",fp);let nd=Hc;function fy(H,C,$,ht){let Mt=[],Bt=H.image,jt=Bt.pixelRatio,oe=Bt.paddedRect.w-2*nd,be=Bt.paddedRect.h-2*nd,Be={x1:H.left,y1:H.top,x2:H.right,y2:H.bottom},Qe=Bt.stretchX||[[0,oe]],lr=Bt.stretchY||[[0,be]],wr=(oi,Ro)=>oi+Ro[1]-Ro[0],Fr=Qe.reduce(wr,0),Zr=lr.reduce(wr,0),en=oe-Fr,yn=be-Zr,Vn=0,Ca=Fr,ua=0,wa=Zr,Xa=0,di=en,oo=0,as=yn;if(Bt.content&&ht){let oi=Bt.content,Ro=oi[2]-oi[0],Io=oi[3]-oi[1];(Bt.textFitWidth||Bt.textFitHeight)&&(Be=Gv(H)),Vn=ad(Qe,0,oi[0]),ua=ad(lr,0,oi[1]),Ca=ad(Qe,oi[0],oi[2]),wa=ad(lr,oi[1],oi[3]),Xa=oi[0]-Vn,oo=oi[1]-ua,di=Ro-Ca,as=Io-wa}let eo=Be.x1,Ki=Be.y1,Co=Be.x2-eo,xo=Be.y2-Ki,ho=(oi,Ro,Io,xs)=>{let mu=ch(oi.stretch-Vn,Ca,Co,eo),uu=X0(oi.fixed-Xa,di,oi.stretch,Fr),ef=ch(Ro.stretch-ua,wa,xo,Ki),Qf=X0(Ro.fixed-oo,as,Ro.stretch,Zr),Mc=ch(Io.stretch-Vn,Ca,Co,eo),qc=X0(Io.fixed-Xa,di,Io.stretch,Fr),Rf=ch(xs.stretch-ua,wa,xo,Ki),Nf=X0(xs.fixed-oo,as,xs.stretch,Zr),jf=new o(mu,ef),nc=new o(Mc,ef),rf=new o(Mc,Rf),Lf=new o(mu,Rf),wf=new o(uu/jt,Qf/jt),Uf=new o(qc/jt,Nf/jt),hf=C*Math.PI/180;if(hf){let vl=Math.sin(hf),Vl=Math.cos(hf),eu=[Vl,-vl,vl,Vl];jf._matMult(eu),nc._matMult(eu),Lf._matMult(eu),rf._matMult(eu)}let fh=oi.stretch+oi.fixed,zu=Ro.stretch+Ro.fixed;return{tl:jf,tr:nc,bl:Lf,br:rf,tex:{x:Bt.paddedRect.x+nd+fh,y:Bt.paddedRect.y+nd+zu,w:Io.stretch+Io.fixed-fh,h:xs.stretch+xs.fixed-zu},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:wf,pixelOffsetBR:Uf,minFontScaleX:di/jt/Co,minFontScaleY:as/jt/xo,isSDF:$}};if(ht&&(Bt.stretchX||Bt.stretchY)){let oi=id(Qe,en,Fr),Ro=id(lr,yn,Zr);for(let Io=0;Io0&&(en=Math.max(10,en),this.circleDiameter=en)}else{let wr=!((lr=jt.image)===null||lr===void 0)&&lr.content&&(jt.image.textFitWidth||jt.image.textFitHeight)?Gv(jt):{x1:jt.left,y1:jt.top,x2:jt.right,y2:jt.bottom};wr.y1=wr.y1*oe-be[0],wr.y2=wr.y2*oe+be[2],wr.x1=wr.x1*oe-be[3],wr.x2=wr.x2*oe+be[1];let Fr=jt.collisionPadding;if(Fr&&(wr.x1-=Fr[0]*oe,wr.y1-=Fr[1]*oe,wr.x2+=Fr[2]*oe,wr.y2+=Fr[3]*oe),Qe){let Zr=new o(wr.x1,wr.y1),en=new o(wr.x2,wr.y1),yn=new o(wr.x1,wr.y2),Vn=new o(wr.x2,wr.y2),Ca=Qe*Math.PI/180;Zr._rotate(Ca),en._rotate(Ca),yn._rotate(Ca),Vn._rotate(Ca),wr.x1=Math.min(Zr.x,en.x,yn.x,Vn.x),wr.x2=Math.max(Zr.x,en.x,yn.x,Vn.x),wr.y1=Math.min(Zr.y,en.y,yn.y,Vn.y),wr.y2=Math.max(Zr.y,en.y,yn.y,Vn.y)}C.emplaceBack($.x,$.y,wr.x1,wr.y1,wr.x2,wr.y2,ht,Mt,Bt)}this.boxEndIndex=C.length}}class L_{constructor(C=[],$=(ht,Mt)=>htMt?1:0){if(this.data=C,this.length=this.data.length,this.compare=$,this.length>0)for(let ht=(this.length>>1)-1;ht>=0;ht--)this._down(ht)}push(C){this.data.push(C),this._up(this.length++)}pop(){if(this.length===0)return;let C=this.data[0],$=this.data.pop();return--this.length>0&&(this.data[0]=$,this._down(0)),C}peek(){return this.data[0]}_up(C){let{data:$,compare:ht}=this,Mt=$[C];for(;C>0;){let Bt=C-1>>1,jt=$[Bt];if(ht(Mt,jt)>=0)break;$[C]=jt,C=Bt}$[C]=Mt}_down(C){let{data:$,compare:ht}=this,Mt=this.length>>1,Bt=$[C];for(;C=0)break;$[C]=$[jt],C=jt}$[C]=Bt}}function C_(H,C=1,$=!1){let ht=1/0,Mt=1/0,Bt=-1/0,jt=-1/0,oe=H[0];for(let Fr=0;FrBt)&&(Bt=Zr.x),(!Fr||Zr.y>jt)&&(jt=Zr.y)}let be=Math.min(Bt-ht,jt-Mt),Be=be/2,Qe=new L_([],I_);if(be===0)return new o(ht,Mt);for(let Fr=ht;Frlr.d||!lr.d)&&(lr=Fr,$&&console.log("found best %d after %d probes",Math.round(1e4*Fr.d)/1e4,wr)),Fr.max-lr.d<=C||(Be=Fr.h/2,Qe.push(new Dh(Fr.p.x-Be,Fr.p.y-Be,Be,H)),Qe.push(new Dh(Fr.p.x+Be,Fr.p.y-Be,Be,H)),Qe.push(new Dh(Fr.p.x-Be,Fr.p.y+Be,Be,H)),Qe.push(new Dh(Fr.p.x+Be,Fr.p.y+Be,Be,H)),wr+=4)}return $&&(console.log(`num probes: ${wr}`),console.log(`best distance: ${lr.d}`)),lr.p}function I_(H,C){return C.max-H.max}function Dh(H,C,$,ht){this.p=new o(H,C),this.h=$,this.d=(function(Mt,Bt){let jt=!1,oe=1/0;for(let be=0;beMt.y!=Zr.y>Mt.y&&Mt.x<(Zr.x-Fr.x)*(Mt.y-Fr.y)/(Zr.y-Fr.y)+Fr.x&&(jt=!jt),oe=Math.min(oe,Va(Mt,Fr,Zr))}}return(jt?1:-1)*Math.sqrt(oe)})(this.p,ht),this.max=this.d+this.h*Math.SQRT2}var ff;t.aq=void 0,(ff=t.aq||(t.aq={}))[ff.center=1]="center",ff[ff.left=2]="left",ff[ff.right=3]="right",ff[ff.top=4]="top",ff[ff.bottom=5]="bottom",ff[ff["top-left"]=6]="top-left",ff[ff["top-right"]=7]="top-right",ff[ff["bottom-left"]=8]="bottom-left",ff[ff["bottom-right"]=9]="bottom-right";let hp=7,pg=Number.POSITIVE_INFINITY;function hy(H,C){return C[1]!==pg?(function($,ht,Mt){let Bt=0,jt=0;switch(ht=Math.abs(ht),Mt=Math.abs(Mt),$){case"top-right":case"top-left":case"top":jt=Mt-hp;break;case"bottom-right":case"bottom-left":case"bottom":jt=-Mt+hp}switch($){case"top-right":case"bottom-right":case"right":Bt=-ht;break;case"top-left":case"bottom-left":case"left":Bt=ht}return[Bt,jt]})(H,C[0],C[1]):(function($,ht){let Mt=0,Bt=0;ht<0&&(ht=0);let jt=ht/Math.SQRT2;switch($){case"top-right":case"top-left":Bt=jt-hp;break;case"bottom-right":case"bottom-left":Bt=-jt+hp;break;case"bottom":Bt=-ht+hp;break;case"top":Bt=ht-hp}switch($){case"top-right":case"bottom-right":Mt=-jt;break;case"top-left":case"bottom-left":Mt=jt;break;case"left":Mt=ht;break;case"right":Mt=-ht}return[Mt,Bt]})(H,C[0])}function py(H,C,$){var ht;let Mt=H.layout,Bt=(ht=Mt.get("text-variable-anchor-offset"))===null||ht===void 0?void 0:ht.evaluate(C,{},$);if(Bt){let oe=Bt.values,be=[];for(let Be=0;Bewr*Ol);Qe.startsWith("top")?lr[1]-=hp:Qe.startsWith("bottom")&&(lr[1]+=hp),be[Be+1]=lr}return new Nn(be)}let jt=Mt.get("text-variable-anchor");if(jt){let oe;oe=H._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[Mt.get("text-radial-offset").evaluate(C,{},$)*Ol,pg]:Mt.get("text-offset").evaluate(C,{},$).map(Be=>Be*Ol);let be=[];for(let Be of jt)be.push(Be,hy(Be,oe));return new Nn(be)}return null}function dg(H){switch(H){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function P_(H,C,$,ht,Mt,Bt,jt,oe,be,Be,Qe){let lr=Bt.textMaxSize.evaluate(C,{});lr===void 0&&(lr=jt);let wr=H.layers[0].layout,Fr=wr.get("icon-offset").evaluate(C,{},Qe),Zr=my($.horizontal),en=jt/24,yn=H.tilePixelRatio*en,Vn=H.tilePixelRatio*lr/24,Ca=H.tilePixelRatio*oe,ua=H.tilePixelRatio*wr.get("symbol-spacing"),wa=wr.get("text-padding")*H.tilePixelRatio,Xa=(function(oi,Ro,Io,xs=1){let mu=oi.get("icon-padding").evaluate(Ro,{},Io),uu=mu&&mu.values;return[uu[0]*xs,uu[1]*xs,uu[2]*xs,uu[3]*xs]})(wr,C,Qe,H.tilePixelRatio),di=wr.get("text-max-angle")/180*Math.PI,oo=wr.get("text-rotation-alignment")!=="viewport"&&wr.get("symbol-placement")!=="point",as=wr.get("icon-rotation-alignment")==="map"&&wr.get("symbol-placement")!=="point",eo=wr.get("symbol-placement"),Ki=ua/2,Co=wr.get("icon-text-fit"),xo;ht&&Co!=="none"&&(H.allowVerticalPlacement&&$.vertical&&(xo=Zv(ht,$.vertical,Co,wr.get("icon-text-fit-padding"),Fr,en)),Zr&&(ht=Zv(ht,Zr,Co,wr.get("icon-text-fit-padding"),Fr,en)));let ho=(oi,Ro)=>{Ro.x<0||Ro.x>=zs||Ro.y<0||Ro.y>=zs||(function(Io,xs,mu,uu,ef,Qf,Mc,qc,Rf,Nf,jf,nc,rf,Lf,wf,Uf,hf,fh,zu,vl,Vl,eu,$u,Lu,ld){let kh=Io.addToLineVertexArray(xs,mu),Ah,Cf,gu,pf,xh=0,hh=0,Vf=0,_g=0,bg=-1,em=-1,Kh={},wg=_n("");if(Io.allowVerticalPlacement&&uu.vertical){let Tf=qc.layout.get("text-rotate").evaluate(Vl,{},Lu)+90;gu=new $0(Rf,xs,Nf,jf,nc,uu.vertical,rf,Lf,wf,Tf),Mc&&(pf=new $0(Rf,xs,Nf,jf,nc,Mc,hf,fh,wf,Tf))}if(ef){let Tf=qc.layout.get("icon-rotate").evaluate(Vl,{}),ph=qc.layout.get("icon-text-fit")!=="none",pp=fy(ef,Tf,$u,ph),Mh=Mc?fy(Mc,Tf,$u,ph):void 0;Cf=new $0(Rf,xs,Nf,jf,nc,ef,hf,fh,!1,Tf),xh=4*pp.length;let Ip=Io.iconSizeData,Sh=null;Ip.kind==="source"?(Sh=[Ph*qc.layout.get("icon-size").evaluate(Vl,{})],Sh[0]>up&&_(`${Io.layerIds[0]}: Value for "icon-size" is >= ${Kd}. Reduce your "icon-size".`)):Ip.kind==="composite"&&(Sh=[Ph*eu.compositeIconSizes[0].evaluate(Vl,{},Lu),Ph*eu.compositeIconSizes[1].evaluate(Vl,{},Lu)],(Sh[0]>up||Sh[1]>up)&&_(`${Io.layerIds[0]}: Value for "icon-size" is >= ${Kd}. Reduce your "icon-size".`)),Io.addSymbols(Io.icon,pp,Sh,vl,zu,Vl,t.ah.none,xs,kh.lineStartIndex,kh.lineLength,-1,Lu),bg=Io.icon.placedSymbolArray.length-1,Mh&&(hh=4*Mh.length,Io.addSymbols(Io.icon,Mh,Sh,vl,zu,Vl,t.ah.vertical,xs,kh.lineStartIndex,kh.lineLength,-1,Lu),em=Io.icon.placedSymbolArray.length-1)}let Tg=Object.keys(uu.horizontal);for(let Tf of Tg){let ph=uu.horizontal[Tf];if(!Ah){wg=_n(ph.text);let Mh=qc.layout.get("text-rotate").evaluate(Vl,{},Lu);Ah=new $0(Rf,xs,Nf,jf,nc,ph,rf,Lf,wf,Mh)}let pp=ph.positionedLines.length===1;if(Vf+=dy(Io,xs,ph,Qf,qc,wf,Vl,Uf,kh,uu.vertical?t.ah.horizontal:t.ah.horizontalOnly,pp?Tg:[Tf],Kh,bg,eu,Lu),pp)break}uu.vertical&&(_g+=dy(Io,xs,uu.vertical,Qf,qc,wf,Vl,Uf,kh,t.ah.vertical,["vertical"],Kh,em,eu,Lu));let kg=Ah?Ah.boxStartIndex:Io.collisionBoxArray.length,Ag=Ah?Ah.boxEndIndex:Io.collisionBoxArray.length,O_=gu?gu.boxStartIndex:Io.collisionBoxArray.length,D_=gu?gu.boxEndIndex:Io.collisionBoxArray.length,F_=Cf?Cf.boxStartIndex:Io.collisionBoxArray.length,B_=Cf?Cf.boxEndIndex:Io.collisionBoxArray.length,_y=pf?pf.boxStartIndex:Io.collisionBoxArray.length,ud=pf?pf.boxEndIndex:Io.collisionBoxArray.length,Wc=-1,cd=(Tf,ph)=>Tf&&Tf.circleDiameter?Math.max(Tf.circleDiameter,ph):ph;Wc=cd(Ah,Wc),Wc=cd(gu,Wc),Wc=cd(Cf,Wc),Wc=cd(pf,Wc);let Mg=Wc>-1?1:0;Mg&&(Wc*=ld/Ol),Io.glyphOffsetArray.length>=zp.MAX_GLYPHS&&_("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Vl.sortKey!==void 0&&Io.addToSortKeyRanges(Io.symbolInstances.length,Vl.sortKey);let by=py(qc,Vl,Lu),[R_,wy]=(function(Tf,ph){let pp=Tf.length,Mh=ph?.values;if(Mh?.length>0)for(let Ip=0;Ip=0?Kh.right:-1,Kh.center>=0?Kh.center:-1,Kh.left>=0?Kh.left:-1,Kh.vertical||-1,bg,em,wg,kg,Ag,O_,D_,F_,B_,_y,ud,Nf,Vf,_g,xh,hh,Mg,0,rf,Wc,R_,wy)})(H,Ro,oi,$,ht,Mt,xo,H.layers[0],H.collisionBoxArray,C.index,C.sourceLayerIndex,H.index,yn,[wa,wa,wa,wa],oo,be,Ca,Xa,as,Fr,C,Bt,Be,Qe,jt)};if(eo==="line")for(let oi of oy(C.geometry,0,0,zs,zs)){let Ro=z_(oi,ua,di,$.vertical||Zr,ht,24,Vn,H.overscaling,zs);for(let Io of Ro)Zr&&gy(H,Zr.text,Ki,Io)||ho(oi,Io)}else if(eo==="line-center"){for(let oi of C.geometry)if(oi.length>1){let Ro=E_(oi,di,$.vertical||Zr,ht,24,Vn);Ro&&ho(oi,Ro)}}else if(C.type==="Polygon")for(let oi of au(C.geometry,0)){let Ro=C_(oi,16);ho(oi[0],new fp(Ro.x,Ro.y,0))}else if(C.type==="LineString")for(let oi of C.geometry)ho(oi,new fp(oi[0].x,oi[0].y,0));else if(C.type==="Point")for(let oi of C.geometry)for(let Ro of oi)ho([Ro],new fp(Ro.x,Ro.y,0))}function dy(H,C,$,ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr,Fr,Zr){let en=(function(Ca,ua,wa,Xa,di,oo,as,eo){let Ki=Xa.layout.get("text-rotate").evaluate(oo,{})*Math.PI/180,Co=[];for(let xo of ua.positionedLines)for(let ho of xo.positionedGlyphs){if(!ho.rect)continue;let oi=ho.rect||{},Ro=eg+1,Io=!0,xs=1,mu=0,uu=(di||eo)&&ho.vertical,ef=ho.metrics.advance*ho.scale/2;if(eo&&ua.verticalizable&&(mu=xo.lineOffset/2-(ho.imageName?-(Ol-ho.metrics.width*ho.scale)/2:(ho.scale-1)*Ol)),ho.imageName){let vl=as[ho.imageName];Io=vl.sdf,xs=vl.pixelRatio,Ro=Hc/xs}let Qf=di?[ho.x+ef,ho.y]:[0,0],Mc=di?[0,0]:[ho.x+ef+wa[0],ho.y+wa[1]-mu],qc=[0,0];uu&&(qc=Mc,Mc=[0,0]);let Rf=ho.metrics.isDoubleResolution?2:1,Nf=(ho.metrics.left-Ro)*ho.scale-ef+Mc[0],jf=(-ho.metrics.top-Ro)*ho.scale+Mc[1],nc=Nf+oi.w/Rf*ho.scale/xs,rf=jf+oi.h/Rf*ho.scale/xs,Lf=new o(Nf,jf),wf=new o(nc,jf),Uf=new o(Nf,rf),hf=new o(nc,rf);if(uu){let vl=new o(-ef,ef-Jp),Vl=-Math.PI/2,eu=Ol/2-ef,$u=new o(5-Jp-eu,-(ho.imageName?eu:0)),Lu=new o(...qc);Lf._rotateAround(Vl,vl)._add($u)._add(Lu),wf._rotateAround(Vl,vl)._add($u)._add(Lu),Uf._rotateAround(Vl,vl)._add($u)._add(Lu),hf._rotateAround(Vl,vl)._add($u)._add(Lu)}if(Ki){let vl=Math.sin(Ki),Vl=Math.cos(Ki),eu=[Vl,-vl,vl,Vl];Lf._matMult(eu),wf._matMult(eu),Uf._matMult(eu),hf._matMult(eu)}let fh=new o(0,0),zu=new o(0,0);Co.push({tl:Lf,tr:wf,bl:Uf,br:hf,tex:oi,writingMode:ua.writingMode,glyphOffset:Qf,sectionIndex:ho.sectionIndex,isSDF:Io,pixelOffsetTL:fh,pixelOffsetBR:zu,minFontScaleX:0,minFontScaleY:0})}return Co})(0,$,oe,Mt,Bt,jt,ht,H.allowVerticalPlacement),yn=H.textSizeData,Vn=null;yn.kind==="source"?(Vn=[Ph*Mt.layout.get("text-size").evaluate(jt,{})],Vn[0]>up&&_(`${H.layerIds[0]}: Value for "text-size" is >= ${Kd}. Reduce your "text-size".`)):yn.kind==="composite"&&(Vn=[Ph*Fr.compositeTextSizes[0].evaluate(jt,{},Zr),Ph*Fr.compositeTextSizes[1].evaluate(jt,{},Zr)],(Vn[0]>up||Vn[1]>up)&&_(`${H.layerIds[0]}: Value for "text-size" is >= ${Kd}. Reduce your "text-size".`)),H.addSymbols(H.text,en,Vn,oe,Bt,jt,Be,C,be.lineStartIndex,be.lineLength,wr,Zr);for(let Ca of Qe)lr[Ca]=H.text.placedSymbolArray.length-1;return 4*en.length}function my(H){for(let C in H)return H[C];return null}function gy(H,C,$,ht){let Mt=H.compareText;if(C in Mt){let Bt=Mt[C];for(let jt=Bt.length-1;jt>=0;jt--)if(ht.dist(Bt[jt])<$)return!0}else Mt[C]=[];return Mt[C].push(ht),!1}let vy=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class mg{static from(C){if(!(C instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[$,ht]=new Uint8Array(C,0,2);if($!==219)throw new Error("Data does not appear to be in a KDBush format.");let Mt=ht>>4;if(Mt!==1)throw new Error(`Got v${Mt} data when expected v1.`);let Bt=vy[15&ht];if(!Bt)throw new Error("Unrecognized array type.");let[jt]=new Uint16Array(C,2,1),[oe]=new Uint32Array(C,4,1);return new mg(oe,jt,Bt,C)}constructor(C,$=64,ht=Float64Array,Mt){if(isNaN(C)||C<0)throw new Error(`Unpexpected numItems value: ${C}.`);this.numItems=+C,this.nodeSize=Math.min(Math.max(+$,2),65535),this.ArrayType=ht,this.IndexArrayType=C<65536?Uint16Array:Uint32Array;let Bt=vy.indexOf(this.ArrayType),jt=2*C*this.ArrayType.BYTES_PER_ELEMENT,oe=C*this.IndexArrayType.BYTES_PER_ELEMENT,be=(8-oe%8)%8;if(Bt<0)throw new Error(`Unexpected typed array class: ${ht}.`);Mt&&Mt instanceof ArrayBuffer?(this.data=Mt,this.ids=new this.IndexArrayType(this.data,8,C),this.coords=new this.ArrayType(this.data,8+oe+be,2*C),this._pos=2*C,this._finished=!0):(this.data=new ArrayBuffer(8+jt+oe+be),this.ids=new this.IndexArrayType(this.data,8,C),this.coords=new this.ArrayType(this.data,8+oe+be,2*C),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+Bt]),new Uint16Array(this.data,2,1)[0]=$,new Uint32Array(this.data,4,1)[0]=C)}add(C,$){let ht=this._pos>>1;return this.ids[ht]=ht,this.coords[this._pos++]=C,this.coords[this._pos++]=$,ht}finish(){let C=this._pos>>1;if(C!==this.numItems)throw new Error(`Added ${C} items when expected ${this.numItems}.`);return gg(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(C,$,ht,Mt){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:Bt,coords:jt,nodeSize:oe}=this,be=[0,Bt.length-1,0],Be=[];for(;be.length;){let Qe=be.pop()||0,lr=be.pop()||0,wr=be.pop()||0;if(lr-wr<=oe){for(let yn=wr;yn<=lr;yn++){let Vn=jt[2*yn],Ca=jt[2*yn+1];Vn>=C&&Vn<=ht&&Ca>=$&&Ca<=Mt&&Be.push(Bt[yn])}continue}let Fr=wr+lr>>1,Zr=jt[2*Fr],en=jt[2*Fr+1];Zr>=C&&Zr<=ht&&en>=$&&en<=Mt&&Be.push(Bt[Fr]),(Qe===0?C<=Zr:$<=en)&&(be.push(wr),be.push(Fr-1),be.push(1-Qe)),(Qe===0?ht>=Zr:Mt>=en)&&(be.push(Fr+1),be.push(lr),be.push(1-Qe))}return Be}within(C,$,ht){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:Mt,coords:Bt,nodeSize:jt}=this,oe=[0,Mt.length-1,0],be=[],Be=ht*ht;for(;oe.length;){let Qe=oe.pop()||0,lr=oe.pop()||0,wr=oe.pop()||0;if(lr-wr<=jt){for(let yn=wr;yn<=lr;yn++)bf(Bt[2*yn],Bt[2*yn+1],C,$)<=Be&&be.push(Mt[yn]);continue}let Fr=wr+lr>>1,Zr=Bt[2*Fr],en=Bt[2*Fr+1];bf(Zr,en,C,$)<=Be&&be.push(Mt[Fr]),(Qe===0?C-ht<=Zr:$-ht<=en)&&(oe.push(wr),oe.push(Fr-1),oe.push(1-Qe)),(Qe===0?C+ht>=Zr:$+ht>=en)&&(oe.push(Fr+1),oe.push(lr),oe.push(1-Qe))}return be}}function gg(H,C,$,ht,Mt,Bt){if(Mt-ht<=$)return;let jt=ht+Mt>>1;yy(H,C,jt,ht,Mt,Bt),gg(H,C,$,ht,jt-1,1-Bt),gg(H,C,$,jt+1,Mt,1-Bt)}function yy(H,C,$,ht,Mt,Bt){for(;Mt>ht;){if(Mt-ht>600){let Be=Mt-ht+1,Qe=$-ht+1,lr=Math.log(Be),wr=.5*Math.exp(2*lr/3),Fr=.5*Math.sqrt(lr*wr*(Be-wr)/Be)*(Qe-Be/2<0?-1:1);yy(H,C,$,Math.max(ht,Math.floor($-Qe*wr/Be+Fr)),Math.min(Mt,Math.floor($+(Be-Qe)*wr/Be+Fr)),Bt)}let jt=C[2*$+Bt],oe=ht,be=Mt;for(od(H,C,ht,$),C[2*Mt+Bt]>jt&&od(H,C,ht,Mt);oejt;)be--}C[2*ht+Bt]===jt?od(H,C,ht,be):(be++,od(H,C,be,Mt)),be<=$&&(ht=be+1),$<=be&&(Mt=be-1)}}function od(H,C,$,ht){J0(H,$,ht),J0(C,2*$,2*ht),J0(C,2*$+1,2*ht+1)}function J0(H,C,$){let ht=H[C];H[C]=H[$],H[$]=ht}function bf(H,C,$,ht){let Mt=H-$,Bt=C-ht;return Mt*Mt+Bt*Bt}var vg;t.bg=void 0,(vg=t.bg||(t.bg={})).create="create",vg.load="load",vg.fullLoad="fullLoad";let Q0=null,sd=[],yg=1e3/60,tm="loadTime",xg="fullLoadTime",xy={mark(H){performance.mark(H)},frame(H){let C=H;Q0!=null&&sd.push(C-Q0),Q0=C},clearMetrics(){Q0=null,sd=[],performance.clearMeasures(tm),performance.clearMeasures(xg);for(let H in t.bg)performance.clearMarks(t.bg[H])},getPerformanceMetrics(){performance.measure(tm,t.bg.create,t.bg.load),performance.measure(xg,t.bg.create,t.bg.fullLoad);let H=performance.getEntriesByName(tm)[0].duration,C=performance.getEntriesByName(xg)[0].duration,$=sd.length,ht=1/(sd.reduce((Bt,jt)=>Bt+jt,0)/$/1e3),Mt=sd.filter(Bt=>Bt>yg).reduce((Bt,jt)=>Bt+(jt-yg)/yg,0);return{loadTime:H,fullLoadTime:C,fps:ht,percentDroppedFrames:Mt/($+Mt)*100,totalFrames:$}}};t.$=class extends hr{},t.A=Rn,t.B=Ta,t.C=function(H){if(D==null){let C=H.navigator?H.navigator.userAgent:null;D=!!H.safari||!(!C||!(/\b(iPad|iPhone|iPod)\b/.test(C)||C.match("Safari")&&!C.match("Chrome")))}return D},t.D=Ui,t.E=it,t.F=class{constructor(H,C){this.target=H,this.mapId=C,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Jd(()=>this.process()),this.subscription=(function($,ht,Mt,Bt){return $.addEventListener(ht,Mt,!1),{unsubscribe:()=>{$.removeEventListener(ht,Mt,!1)}}})(this.target,"message",$=>this.receive($)),this.globalScope=z(self)?H:window}registerMessageHandler(H,C){this.messageHandlers[H]=C}sendAsync(H,C){return new Promise(($,ht)=>{let Mt=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[Mt]={resolve:$,reject:ht},C&&C.signal.addEventListener("abort",()=>{delete this.resolveRejects[Mt];let oe={id:Mt,type:"",origin:location.origin,targetMapId:H.targetMapId,sourceMapId:this.mapId};this.target.postMessage(oe)},{once:!0});let Bt=[],jt=Object.assign(Object.assign({},H),{id:Mt,sourceMapId:this.mapId,origin:location.origin,data:Wi(H.data,Bt)});this.target.postMessage(jt,{transfer:Bt})})}receive(H){let C=H.data,$=C.id;if(!(C.origin!=="file://"&&location.origin!=="file://"&&C.origin!=="resource://android"&&location.origin!=="resource://android"&&C.origin!==location.origin||C.targetMapId&&this.mapId!==C.targetMapId)){if(C.type===""){delete this.tasks[$];let ht=this.abortControllers[$];return delete this.abortControllers[$],void(ht&&ht.abort())}if(z(self)||C.mustQueue)return this.tasks[$]=C,this.taskQueue.push($),void this.invoker.trigger();this.processTask($,C)}}process(){if(this.taskQueue.length===0)return;let H=this.taskQueue.shift(),C=this.tasks[H];delete this.tasks[H],this.taskQueue.length>0&&this.invoker.trigger(),C&&this.processTask(H,C)}processTask(H,C){return e(this,void 0,void 0,function*(){if(C.type===""){let Mt=this.resolveRejects[H];return delete this.resolveRejects[H],Mt?void(C.error?Mt.reject(Xi(C.error)):Mt.resolve(Xi(C.data))):void 0}if(!this.messageHandlers[C.type])return void this.completeTask(H,new Error(`Could not find a registered handler for ${C.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let $=Xi(C.data),ht=new AbortController;this.abortControllers[H]=ht;try{let Mt=yield this.messageHandlers[C.type](C.sourceMapId,$,ht);this.completeTask(H,null,Mt)}catch(Mt){this.completeTask(H,Mt)}})}completeTask(H,C,$){let ht=[];delete this.abortControllers[H];let Mt={id:H,type:"",sourceMapId:this.mapId,origin:location.origin,error:C?Wi(C):null,data:Wi($,ht)};this.target.postMessage(Mt,{transfer:ht})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},t.G=st,t.H=function(){var H=new Rn(16);return Rn!=Float32Array&&(H[1]=0,H[2]=0,H[3]=0,H[4]=0,H[6]=0,H[7]=0,H[8]=0,H[9]=0,H[11]=0,H[12]=0,H[13]=0,H[14]=0),H[0]=1,H[5]=1,H[10]=1,H[15]=1,H},t.I=_f,t.J=function(H,C,$){var ht,Mt,Bt,jt,oe,be,Be,Qe,lr,wr,Fr,Zr,en=$[0],yn=$[1],Vn=$[2];return C===H?(H[12]=C[0]*en+C[4]*yn+C[8]*Vn+C[12],H[13]=C[1]*en+C[5]*yn+C[9]*Vn+C[13],H[14]=C[2]*en+C[6]*yn+C[10]*Vn+C[14],H[15]=C[3]*en+C[7]*yn+C[11]*Vn+C[15]):(Mt=C[1],Bt=C[2],jt=C[3],oe=C[4],be=C[5],Be=C[6],Qe=C[7],lr=C[8],wr=C[9],Fr=C[10],Zr=C[11],H[0]=ht=C[0],H[1]=Mt,H[2]=Bt,H[3]=jt,H[4]=oe,H[5]=be,H[6]=Be,H[7]=Qe,H[8]=lr,H[9]=wr,H[10]=Fr,H[11]=Zr,H[12]=ht*en+oe*yn+lr*Vn+C[12],H[13]=Mt*en+be*yn+wr*Vn+C[13],H[14]=Bt*en+Be*yn+Fr*Vn+C[14],H[15]=jt*en+Qe*yn+Zr*Vn+C[15]),H},t.K=function(H,C,$){var ht=$[0],Mt=$[1],Bt=$[2];return H[0]=C[0]*ht,H[1]=C[1]*ht,H[2]=C[2]*ht,H[3]=C[3]*ht,H[4]=C[4]*Mt,H[5]=C[5]*Mt,H[6]=C[6]*Mt,H[7]=C[7]*Mt,H[8]=C[8]*Bt,H[9]=C[9]*Bt,H[10]=C[10]*Bt,H[11]=C[11]*Bt,H[12]=C[12],H[13]=C[13],H[14]=C[14],H[15]=C[15],H},t.L=Pa,t.M=function(H,C){let $={};for(let ht=0;ht{let C=window.document.createElement("video");return C.muted=!0,new Promise($=>{C.onloadstart=()=>{$(C)};for(let ht of H){let Mt=window.document.createElement("source");X(ht)||(C.crossOrigin="Anonymous"),Mt.src=ht,C.appendChild(Mt)}})},t.a4=function(){return M++},t.a5=La,t.a6=zp,t.a7=wc,t.a8=cr,t.a9=ry,t.aA=function(H){if(H.type==="custom")return new Xv(H);switch(H.type){case"background":return new $d(H);case"circle":return new Sa(H);case"fill":return new On(H);case"fill-extrusion":return new Kf(H);case"heatmap":return new Zo(H);case"hillshade":return new Cl(H);case"line":return new kp(H);case"raster":return new S_(H);case"symbol":return new G0(H)}},t.aB=h,t.aC=function(H,C){if(!H)return[{command:"setStyle",args:[C]}];let $=[];try{if(!wt(H.version,C.version))return[{command:"setStyle",args:[C]}];wt(H.center,C.center)||$.push({command:"setCenter",args:[C.center]}),wt(H.zoom,C.zoom)||$.push({command:"setZoom",args:[C.zoom]}),wt(H.bearing,C.bearing)||$.push({command:"setBearing",args:[C.bearing]}),wt(H.pitch,C.pitch)||$.push({command:"setPitch",args:[C.pitch]}),wt(H.sprite,C.sprite)||$.push({command:"setSprite",args:[C.sprite]}),wt(H.glyphs,C.glyphs)||$.push({command:"setGlyphs",args:[C.glyphs]}),wt(H.transition,C.transition)||$.push({command:"setTransition",args:[C.transition]}),wt(H.light,C.light)||$.push({command:"setLight",args:[C.light]}),wt(H.terrain,C.terrain)||$.push({command:"setTerrain",args:[C.terrain]}),wt(H.sky,C.sky)||$.push({command:"setSky",args:[C.sky]}),wt(H.projection,C.projection)||$.push({command:"setProjection",args:[C.projection]});let ht={},Mt=[];(function(jt,oe,be,Be){let Qe;for(Qe in oe=oe||{},jt=jt||{})Object.prototype.hasOwnProperty.call(jt,Qe)&&(Object.prototype.hasOwnProperty.call(oe,Qe)||Nt(Qe,be,Be));for(Qe in oe)Object.prototype.hasOwnProperty.call(oe,Qe)&&(Object.prototype.hasOwnProperty.call(jt,Qe)?wt(jt[Qe],oe[Qe])||(jt[Qe].type==="geojson"&&oe[Qe].type==="geojson"&&Jt(jt,oe,Qe)?Ct(be,{command:"setGeoJSONSourceData",args:[Qe,oe[Qe].data]}):te(Qe,oe,be,Be)):It(Qe,oe,be))})(H.sources,C.sources,Mt,ht);let Bt=[];H.layers&&H.layers.forEach(jt=>{"source"in jt&&ht[jt.source]?$.push({command:"removeLayer",args:[jt.id]}):Bt.push(jt)}),$=$.concat(Mt),(function(jt,oe,be){oe=oe||[];let Be=(jt=jt||[]).map(Zt),Qe=oe.map(Zt),lr=jt.reduce(mt,{}),wr=oe.reduce(mt,{}),Fr=Be.slice(),Zr=Object.create(null),en,yn,Vn,Ca,ua;for(let wa=0,Xa=0;wa@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,($,ht,Mt,Bt)=>{let jt=Mt||Bt;return C[ht]=!jt||jt.toLowerCase(),""}),C["max-age"]){let $=parseInt(C["max-age"],10);isNaN($)?delete C["max-age"]:C["max-age"]=$}return C},t.ab=function(H,C){let $=[];for(let ht in H)ht in C||$.push(ht);return $},t.ac=y,t.ad=function(H,C,$){var ht=Math.sin($),Mt=Math.cos($),Bt=C[0],jt=C[1],oe=C[2],be=C[3],Be=C[4],Qe=C[5],lr=C[6],wr=C[7];return C!==H&&(H[8]=C[8],H[9]=C[9],H[10]=C[10],H[11]=C[11],H[12]=C[12],H[13]=C[13],H[14]=C[14],H[15]=C[15]),H[0]=Bt*Mt+Be*ht,H[1]=jt*Mt+Qe*ht,H[2]=oe*Mt+lr*ht,H[3]=be*Mt+wr*ht,H[4]=Be*Mt-Bt*ht,H[5]=Qe*Mt-jt*ht,H[6]=lr*Mt-oe*ht,H[7]=wr*Mt-be*ht,H},t.ae=function(H){var C=new Rn(16);return C[0]=H[0],C[1]=H[1],C[2]=H[2],C[3]=H[3],C[4]=H[4],C[5]=H[5],C[6]=H[6],C[7]=H[7],C[8]=H[8],C[9]=H[9],C[10]=H[10],C[11]=H[11],C[12]=H[12],C[13]=H[13],C[14]=H[14],C[15]=H[15],C},t.af=oa,t.ag=function(H,C){let $=0,ht=0;if(H.kind==="constant")ht=H.layoutSize;else if(H.kind!=="source"){let{interpolationType:Mt,minZoom:Bt,maxZoom:jt}=H,oe=Mt?y(Ra.interpolationFactor(Mt,C,Bt,jt),0,1):0;H.kind==="camera"?ht=Ti.number(H.minSize,H.maxSize,oe):$=oe}return{uSizeT:$,uSize:ht}},t.ai=function(H,{uSize:C,uSizeT:$},{lowerSize:ht,upperSize:Mt}){return H.kind==="source"?ht/Ph:H.kind==="composite"?Ti.number(ht/Ph,Mt/Ph,$):C},t.aj=cp,t.ak=function(H,C,$,ht){let Mt=C.y-H.y,Bt=C.x-H.x,jt=ht.y-$.y,oe=ht.x-$.x,be=jt*Bt-oe*Mt;if(be===0)return null;let Be=(oe*(H.y-$.y)-jt*(H.x-$.x))/be;return new o(H.x+Be*Bt,H.y+Be*Mt)},t.al=oy,t.am=Tn,t.an=An,t.ao=function(H){let C=1/0,$=1/0,ht=-1/0,Mt=-1/0;for(let Bt of H)C=Math.min(C,Bt.x),$=Math.min($,Bt.y),ht=Math.max(ht,Bt.x),Mt=Math.max(Mt,Bt.y);return[C,$,ht,Mt]},t.ap=Ol,t.ar=ag,t.as=function(H,C){var $=C[0],ht=C[1],Mt=C[2],Bt=C[3],jt=C[4],oe=C[5],be=C[6],Be=C[7],Qe=C[8],lr=C[9],wr=C[10],Fr=C[11],Zr=C[12],en=C[13],yn=C[14],Vn=C[15],Ca=$*oe-ht*jt,ua=$*be-Mt*jt,wa=$*Be-Bt*jt,Xa=ht*be-Mt*oe,di=ht*Be-Bt*oe,oo=Mt*Be-Bt*be,as=Qe*en-lr*Zr,eo=Qe*yn-wr*Zr,Ki=Qe*Vn-Fr*Zr,Co=lr*yn-wr*en,xo=lr*Vn-Fr*en,ho=wr*Vn-Fr*yn,oi=Ca*ho-ua*xo+wa*Co+Xa*Ki-di*eo+oo*as;return oi?(H[0]=(oe*ho-be*xo+Be*Co)*(oi=1/oi),H[1]=(Mt*xo-ht*ho-Bt*Co)*oi,H[2]=(en*oo-yn*di+Vn*Xa)*oi,H[3]=(wr*di-lr*oo-Fr*Xa)*oi,H[4]=(be*Ki-jt*ho-Be*eo)*oi,H[5]=($*ho-Mt*Ki+Bt*eo)*oi,H[6]=(yn*wa-Zr*oo-Vn*ua)*oi,H[7]=(Qe*oo-wr*wa+Fr*ua)*oi,H[8]=(jt*xo-oe*Ki+Be*as)*oi,H[9]=(ht*Ki-$*xo-Bt*as)*oi,H[10]=(Zr*di-en*wa+Vn*Ca)*oi,H[11]=(lr*wa-Qe*di-Fr*Ca)*oi,H[12]=(oe*eo-jt*Co-be*as)*oi,H[13]=($*Co-ht*eo+Mt*as)*oi,H[14]=(en*ua-Zr*Xa-yn*Ca)*oi,H[15]=(Qe*Xa-lr*ua+wr*Ca)*oi,H):null},t.at=dg,t.au=ng,t.av=mg,t.aw=function(){let H={},C=nt.$version;for(let $ in nt.$root){let ht=nt.$root[$];if(ht.required){let Mt=null;Mt=$==="version"?C:ht.type==="array"?[]:{},Mt!=null&&(H[$]=Mt)}}return H},t.ax=ni,t.ay=Z,t.az=function(H){H=H.slice();let C=Object.create(null);for(let $=0;$25||ht<0||ht>=1||$<0||$>=1)},t.bc=function(H,C){return H[0]=C[0],H[1]=0,H[2]=0,H[3]=0,H[4]=0,H[5]=C[1],H[6]=0,H[7]=0,H[8]=0,H[9]=0,H[10]=C[2],H[11]=0,H[12]=0,H[13]=0,H[14]=0,H[15]=1,H},t.bd=class extends $e{},t.be=ug,t.bf=xy,t.bh=et,t.bi=function(H,C){rt.REGISTERED_PROTOCOLS[H]=C},t.bj=function(H){delete rt.REGISTERED_PROTOCOLS[H]},t.bk=function(H,C){let $={};for(let Mt=0;Mtho*Ol)}let eo=jt?"center":$.get("text-justify").evaluate(Be,{},H.canonical),Ki=$.get("symbol-placement")==="point"?$.get("text-max-width").evaluate(Be,{},H.canonical)*Ol:1/0,Co=()=>{H.bucket.allowVerticalPlacement&&$i(wa)&&(Zr.vertical=U0(en,H.glyphMap,H.glyphPositions,H.imagePositions,Qe,Ki,Bt,oo,"left",di,Vn,t.ah.vertical,!0,wr,lr))};if(!jt&&as){let xo=new Set;if(eo==="auto")for(let oi=0;oie(void 0,void 0,void 0,function*(){if(H.byteLength===0)return createImageBitmap(new ImageData(1,1));let C=new Blob([new Uint8Array(H)],{type:"image/png"});try{return createImageBitmap(C)}catch($){throw new Error(`Could not load image because of ${$.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),t.e=k,t.f=H=>new Promise((C,$)=>{let ht=new Image;ht.onload=()=>{C(ht),URL.revokeObjectURL(ht.src),ht.onload=null,window.requestAnimationFrame(()=>{ht.src=R})},ht.onerror=()=>$(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let Mt=new Blob([new Uint8Array(H)],{type:"image/png"});ht.src=H.byteLength?URL.createObjectURL(Mt):R}),t.g=ct,t.h=(H,C)=>ot(k(H,{type:"json"}),C),t.i=z,t.j=q,t.k=J,t.l=(H,C)=>ot(k(H,{type:"arrayBuffer"}),C),t.m=ot,t.n=function(H){return new Qm(H).readFields(__,[])},t.o=ds,t.p=j0,t.q=Pt,t.r=ha,t.s=X,t.t=va,t.u=Pn,t.v=nt,t.w=_,t.x=function([H,C,$]){return C+=90,C*=Math.PI/180,$*=Math.PI/180,{x:H*Math.cos(C)*Math.sin($),y:H*Math.sin(C)*Math.sin($),z:H*Math.cos($)}},t.y=Ti,t.z=fs}),E("worker",["./shared"],function(t){class e{constructor(Dt){this.keyCache={},Dt&&this.replace(Dt)}replace(Dt){this._layerConfigs={},this._layers={},this.update(Dt,[])}update(Dt,qt){for(let lt of Dt){this._layerConfigs[lt.id]=lt;let yt=this._layers[lt.id]=t.aA(lt);yt._featureFilter=t.a7(yt.filter),this.keyCache[lt.id]&&delete this.keyCache[lt.id]}for(let lt of qt)delete this.keyCache[lt],delete this._layerConfigs[lt],delete this._layers[lt];this.familiesBySource={};let _t=t.bk(Object.values(this._layerConfigs),this.keyCache);for(let lt of _t){let yt=lt.map(Ee=>this._layers[Ee.id]),St=yt[0];if(St.visibility==="none")continue;let Ht=St.source||"",Yt=this.familiesBySource[Ht];Yt||(Yt=this.familiesBySource[Ht]={});let se=St.sourceLayer||"_geojsonTileLayer",ke=Yt[se];ke||(ke=Yt[se]=[]),ke.push(yt)}}}class r{constructor(Dt){let qt={},_t=[];for(let Ht in Dt){let Yt=Dt[Ht],se=qt[Ht]={};for(let ke in Yt){let Ee=Yt[+ke];if(!Ee||Ee.bitmap.width===0||Ee.bitmap.height===0)continue;let Ue={x:0,y:0,w:Ee.bitmap.width+2,h:Ee.bitmap.height+2};_t.push(Ue),se[ke]={rect:Ue,metrics:Ee.metrics}}}let{w:lt,h:yt}=t.p(_t),St=new t.o({width:lt||1,height:yt||1});for(let Ht in Dt){let Yt=Dt[Ht];for(let se in Yt){let ke=Yt[+se];if(!ke||ke.bitmap.width===0||ke.bitmap.height===0)continue;let Ee=qt[Ht][se].rect;t.o.copy(ke.bitmap,St,{x:0,y:0},{x:Ee.x+1,y:Ee.y+1},ke.bitmap)}}this.image=St,this.positions=qt}}t.bl("GlyphAtlas",r);class i{constructor(Dt){this.tileID=new t.S(Dt.tileID.overscaledZ,Dt.tileID.wrap,Dt.tileID.canonical.z,Dt.tileID.canonical.x,Dt.tileID.canonical.y),this.uid=Dt.uid,this.zoom=Dt.zoom,this.pixelRatio=Dt.pixelRatio,this.tileSize=Dt.tileSize,this.source=Dt.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Dt.showCollisionBoxes,this.collectResourceTiming=!!Dt.collectResourceTiming,this.returnDependencies=!!Dt.returnDependencies,this.promoteId=Dt.promoteId,this.inFlightDependencies=[]}parse(Dt,qt,_t,lt){return t._(this,void 0,void 0,function*(){this.status="parsing",this.data=Dt,this.collisionBoxArray=new t.a5;let yt=new t.bm(Object.keys(Dt.layers).sort()),St=new t.bn(this.tileID,this.promoteId);St.bucketLayerIDs=[];let Ht={},Yt={featureIndex:St,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:_t},se=qt.familiesBySource[this.source];for(let En in se){let gn=Dt.layers[En];if(!gn)continue;gn.version===1&&t.w(`Vector tile source "${this.source}" layer "${En}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let da=yt.encode(En),ra=[];for(let Se=0;Se=Re.maxzoom||Re.visibility!=="none"&&(n(Se,this.zoom,_t),(Ht[Re.id]=Re.createBucket({index:St.bucketLayerIDs.length,layers:Se,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:da,sourceID:this.source})).populate(ra,Yt,this.tileID.canonical),St.bucketLayerIDs.push(Se.map(Ze=>Ze.id)))}}let ke=t.aF(Yt.glyphDependencies,En=>Object.keys(En).map(Number));this.inFlightDependencies.forEach(En=>En?.abort()),this.inFlightDependencies=[];let Ee=Promise.resolve({});if(Object.keys(ke).length){let En=new AbortController;this.inFlightDependencies.push(En),Ee=lt.sendAsync({type:"GG",data:{stacks:ke,source:this.source,tileID:this.tileID,type:"glyphs"}},En)}let Ue=Object.keys(Yt.iconDependencies),ir=Promise.resolve({});if(Ue.length){let En=new AbortController;this.inFlightDependencies.push(En),ir=lt.sendAsync({type:"GI",data:{icons:Ue,source:this.source,tileID:this.tileID,type:"icons"}},En)}let ar=Object.keys(Yt.patternDependencies),Ye=Promise.resolve({});if(ar.length){let En=new AbortController;this.inFlightDependencies.push(En),Ye=lt.sendAsync({type:"GI",data:{icons:ar,source:this.source,tileID:this.tileID,type:"patterns"}},En)}let[Er,pn,dn]=yield Promise.all([Ee,ir,Ye]),bn=new r(Er),Zn=new t.bo(pn,dn);for(let En in Ht){let gn=Ht[En];gn instanceof t.a6?(n(gn.layers,this.zoom,_t),t.bp({bucket:gn,glyphMap:Er,glyphPositions:bn.positions,imageMap:pn,imagePositions:Zn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):gn.hasPattern&&(gn instanceof t.bq||gn instanceof t.br||gn instanceof t.bs)&&(n(gn.layers,this.zoom,_t),gn.addFeatures(Yt,this.tileID.canonical,Zn.patternPositions))}return this.status="done",{buckets:Object.values(Ht).filter(En=>!En.isEmpty()),featureIndex:St,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:bn.image,imageAtlas:Zn,glyphMap:this.returnDependencies?Er:null,iconMap:this.returnDependencies?pn:null,glyphPositions:this.returnDependencies?bn.positions:null}})}}function n(de,Dt,qt){let _t=new t.z(Dt);for(let lt of de)lt.recalculate(_t,qt)}class o{constructor(Dt,qt,_t){this.actor=Dt,this.layerIndex=qt,this.availableImages=_t,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(Dt,qt){return t._(this,void 0,void 0,function*(){let _t=yield t.l(Dt.request,qt);try{return{vectorTile:new t.bt.VectorTile(new t.bu(_t.data)),rawData:_t.data,cacheControl:_t.cacheControl,expires:_t.expires}}catch(lt){let yt=new Uint8Array(_t.data),St=`Unable to parse the tile at ${Dt.request.url}, `;throw St+=yt[0]===31&&yt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${lt.message}`,new Error(St)}})}loadTile(Dt){return t._(this,void 0,void 0,function*(){let qt=Dt.uid,_t=!!(Dt&&Dt.request&&Dt.request.collectResourceTiming)&&new t.bv(Dt.request),lt=new i(Dt);this.loading[qt]=lt;let yt=new AbortController;lt.abort=yt;try{let St=yield this.loadVectorTile(Dt,yt);if(delete this.loading[qt],!St)return null;let Ht=St.rawData,Yt={};St.expires&&(Yt.expires=St.expires),St.cacheControl&&(Yt.cacheControl=St.cacheControl);let se={};if(_t){let Ee=_t.finish();Ee&&(se.resourceTiming=JSON.parse(JSON.stringify(Ee)))}lt.vectorTile=St.vectorTile;let ke=lt.parse(St.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[qt]=lt,this.fetching[qt]={rawTileData:Ht,cacheControl:Yt,resourceTiming:se};try{let Ee=yield ke;return t.e({rawTileData:Ht.slice(0)},Ee,Yt,se)}finally{delete this.fetching[qt]}}catch(St){throw delete this.loading[qt],lt.status="done",this.loaded[qt]=lt,St}})}reloadTile(Dt){return t._(this,void 0,void 0,function*(){let qt=Dt.uid;if(!this.loaded||!this.loaded[qt])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let _t=this.loaded[qt];if(_t.showCollisionBoxes=Dt.showCollisionBoxes,_t.status==="parsing"){let lt=yield _t.parse(_t.vectorTile,this.layerIndex,this.availableImages,this.actor),yt;if(this.fetching[qt]){let{rawTileData:St,cacheControl:Ht,resourceTiming:Yt}=this.fetching[qt];delete this.fetching[qt],yt=t.e({rawTileData:St.slice(0)},lt,Ht,Yt)}else yt=lt;return yt}if(_t.status==="done"&&_t.vectorTile)return _t.parse(_t.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(Dt){return t._(this,void 0,void 0,function*(){let qt=this.loading,_t=Dt.uid;qt&&qt[_t]&&qt[_t].abort&&(qt[_t].abort.abort(),delete qt[_t])})}removeTile(Dt){return t._(this,void 0,void 0,function*(){this.loaded&&this.loaded[Dt.uid]&&delete this.loaded[Dt.uid]})}}class a{constructor(){this.loaded={}}loadTile(Dt){return t._(this,void 0,void 0,function*(){let{uid:qt,encoding:_t,rawImageData:lt,redFactor:yt,greenFactor:St,blueFactor:Ht,baseShift:Yt}=Dt,se=lt.width+2,ke=lt.height+2,Ee=t.b(lt)?new t.R({width:se,height:ke},yield t.bw(lt,-1,-1,se,ke)):lt,Ue=new t.bx(qt,Ee,_t,yt,St,Ht,Yt);return this.loaded=this.loaded||{},this.loaded[qt]=Ue,Ue})}removeTile(Dt){let qt=this.loaded,_t=Dt.uid;qt&&qt[_t]&&delete qt[_t]}}function s(de,Dt){if(de.length!==0){f(de[0],Dt);for(var qt=1;qt=Math.abs(Ht)?qt-Yt+Ht:Ht-Yt+qt,qt=Yt}qt+_t>=0!=!!Dt&&de.reverse()}var v=t.by(function de(Dt,qt){var _t,lt=Dt&&Dt.type;if(lt==="FeatureCollection")for(_t=0;_t>31}function z(de,Dt){for(var qt=de.loadGeometry(),_t=de.type,lt=0,yt=0,St=qt.length,Ht=0;Htde},I=Math.fround||(F=new Float32Array(1),de=>(F[0]=+de,F[0]));var F;let j=3,N=5,G=6;class rt{constructor(Dt){this.options=Object.assign(Object.create(R),Dt),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(Dt){let{log:qt,minZoom:_t,maxZoom:lt}=this.options;qt&&console.time("total time");let yt=`prepare ${Dt.length} points`;qt&&console.time(yt),this.points=Dt;let St=[];for(let Yt=0;Yt=_t;Yt--){let se=+Date.now();Ht=this.trees[Yt]=this._createTree(this._cluster(Ht,Yt)),qt&&console.log("z%d: %d clusters in %dms",Yt,Ht.numItems,+Date.now()-se)}return qt&&console.timeEnd("total time"),this}getClusters(Dt,qt){let _t=((Dt[0]+180)%360+360)%360-180,lt=Math.max(-90,Math.min(90,Dt[1])),yt=Dt[2]===180?180:((Dt[2]+180)%360+360)%360-180,St=Math.max(-90,Math.min(90,Dt[3]));if(Dt[2]-Dt[0]>=360)_t=-180,yt=180;else if(_t>yt){let Ee=this.getClusters([_t,lt,180,St],qt),Ue=this.getClusters([-180,lt,yt,St],qt);return Ee.concat(Ue)}let Ht=this.trees[this._limitZoom(qt)],Yt=Ht.range(et(_t),Z(St),et(yt),Z(lt)),se=Ht.data,ke=[];for(let Ee of Yt){let Ue=this.stride*Ee;ke.push(se[Ue+N]>1?ct(se,Ue,this.clusterProps):this.points[se[Ue+j]])}return ke}getChildren(Dt){let qt=this._getOriginId(Dt),_t=this._getOriginZoom(Dt),lt="No cluster with the specified id.",yt=this.trees[_t];if(!yt)throw new Error(lt);let St=yt.data;if(qt*this.stride>=St.length)throw new Error(lt);let Ht=this.options.radius/(this.options.extent*Math.pow(2,_t-1)),Yt=yt.within(St[qt*this.stride],St[qt*this.stride+1],Ht),se=[];for(let ke of Yt){let Ee=ke*this.stride;St[Ee+4]===Dt&&se.push(St[Ee+N]>1?ct(St,Ee,this.clusterProps):this.points[St[Ee+j]])}if(se.length===0)throw new Error(lt);return se}getLeaves(Dt,qt,_t){let lt=[];return this._appendLeaves(lt,Dt,qt=qt||10,_t=_t||0,0),lt}getTile(Dt,qt,_t){let lt=this.trees[this._limitZoom(Dt)],yt=Math.pow(2,Dt),{extent:St,radius:Ht}=this.options,Yt=Ht/St,se=(_t-Yt)/yt,ke=(_t+1+Yt)/yt,Ee={features:[]};return this._addTileFeatures(lt.range((qt-Yt)/yt,se,(qt+1+Yt)/yt,ke),lt.data,qt,_t,yt,Ee),qt===0&&this._addTileFeatures(lt.range(1-Yt/yt,se,1,ke),lt.data,yt,_t,yt,Ee),qt===yt-1&&this._addTileFeatures(lt.range(0,se,Yt/yt,ke),lt.data,-1,_t,yt,Ee),Ee.features.length?Ee:null}getClusterExpansionZoom(Dt){let qt=this._getOriginZoom(Dt)-1;for(;qt<=this.options.maxZoom;){let _t=this.getChildren(Dt);if(qt++,_t.length!==1)break;Dt=_t[0].properties.cluster_id}return qt}_appendLeaves(Dt,qt,_t,lt,yt){let St=this.getChildren(qt);for(let Ht of St){let Yt=Ht.properties;if(Yt&&Yt.cluster?yt+Yt.point_count<=lt?yt+=Yt.point_count:yt=this._appendLeaves(Dt,Yt.cluster_id,_t,lt,yt):yt1,ke,Ee,Ue;if(se)ke=st(qt,Yt,this.clusterProps),Ee=qt[Yt],Ue=qt[Yt+1];else{let Ye=this.points[qt[Yt+j]];ke=Ye.properties;let[Er,pn]=Ye.geometry.coordinates;Ee=et(Er),Ue=Z(pn)}let ir={type:1,geometry:[[Math.round(this.options.extent*(Ee*yt-_t)),Math.round(this.options.extent*(Ue*yt-lt))]],tags:ke},ar;ar=se||this.options.generateId?qt[Yt+j]:this.points[qt[Yt+j]].id,ar!==void 0&&(ir.id=ar),St.features.push(ir)}}_limitZoom(Dt){return Math.max(this.options.minZoom,Math.min(Math.floor(+Dt),this.options.maxZoom+1))}_cluster(Dt,qt){let{radius:_t,extent:lt,reduce:yt,minPoints:St}=this.options,Ht=_t/(lt*Math.pow(2,qt)),Yt=Dt.data,se=[],ke=this.stride;for(let Ee=0;Eeqt&&(Er+=Yt[dn+N])}if(Er>Ye&&Er>=St){let pn,dn=Ue*Ye,bn=ir*Ye,Zn=-1,En=((Ee/ke|0)<<5)+(qt+1)+this.points.length;for(let gn of ar){let da=gn*ke;if(Yt[da+2]<=qt)continue;Yt[da+2]=qt;let ra=Yt[da+N];dn+=Yt[da]*ra,bn+=Yt[da+1]*ra,Yt[da+4]=En,yt&&(pn||(pn=this._map(Yt,Ee,!0),Zn=this.clusterProps.length,this.clusterProps.push(pn)),yt(pn,this._map(Yt,da)))}Yt[Ee+4]=En,se.push(dn/Er,bn/Er,1/0,En,-1,Er),yt&&se.push(Zn)}else{for(let pn=0;pn1)for(let pn of ar){let dn=pn*ke;if(!(Yt[dn+2]<=qt)){Yt[dn+2]=qt;for(let bn=0;bn>5}_getOriginZoom(Dt){return(Dt-this.points.length)%32}_map(Dt,qt,_t){if(Dt[qt+N]>1){let St=this.clusterProps[Dt[qt+G]];return _t?Object.assign({},St):St}let lt=this.points[Dt[qt+j]].properties,yt=this.options.map(lt);return _t&&yt===lt?Object.assign({},yt):yt}}function ct(de,Dt,qt){return{type:"Feature",id:de[Dt+j],properties:st(de,Dt,qt),geometry:{type:"Point",coordinates:[(_t=de[Dt],360*(_t-.5)),ot(de[Dt+1])]}};var _t}function st(de,Dt,qt){let _t=de[Dt+N],lt=_t>=1e4?`${Math.round(_t/1e3)}k`:_t>=1e3?Math.round(_t/100)/10+"k":_t,yt=de[Dt+G],St=yt===-1?{}:Object.assign({},qt[yt]);return Object.assign(St,{cluster:!0,cluster_id:de[Dt+j],point_count:_t,point_count_abbreviated:lt})}function et(de){return de/360+.5}function Z(de){let Dt=Math.sin(de*Math.PI/180),qt=.5-.25*Math.log((1+Dt)/(1-Dt))/Math.PI;return qt<0?0:qt>1?1:qt}function ot(de){let Dt=(180-360*de)*Math.PI/180;return 360*Math.atan(Math.exp(Dt))/Math.PI-90}function X(de,Dt,qt,_t){let lt=_t,yt=Dt+(qt-Dt>>1),St,Ht=qt-Dt,Yt=de[Dt],se=de[Dt+1],ke=de[qt],Ee=de[qt+1];for(let Ue=Dt+3;Uelt)St=Ue,lt=ir;else if(ir===lt){let ar=Math.abs(Ue-yt);ar_t&&(St-Dt>3&&X(de,Dt,St,_t),de[St+2]=lt,qt-St>3&&X(de,St,qt,_t))}function Q(de,Dt,qt,_t,lt,yt){let St=lt-qt,Ht=yt-_t;if(St!==0||Ht!==0){let Yt=((de-qt)*St+(Dt-_t)*Ht)/(St*St+Ht*Ht);Yt>1?(qt=lt,_t=yt):Yt>0&&(qt+=St*Yt,_t+=Ht*Yt)}return St=de-qt,Ht=Dt-_t,St*St+Ht*Ht}function ut(de,Dt,qt,_t){let lt={id:de??null,type:Dt,geometry:qt,tags:_t,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(Dt==="Point"||Dt==="MultiPoint"||Dt==="LineString")J(lt,qt);else if(Dt==="Polygon")J(lt,qt[0]);else if(Dt==="MultiLineString")for(let yt of qt)J(lt,yt);else if(Dt==="MultiPolygon")for(let yt of qt)J(lt,yt[0]);return lt}function J(de,Dt){for(let qt=0;qt0&&(St+=_t?(lt*ke-se*yt)/2:Math.sqrt(Math.pow(se-lt,2)+Math.pow(ke-yt,2))),lt=se,yt=ke}let Ht=Dt.length-3;Dt[2]=1,X(Dt,0,Ht,qt),Dt[Ht+2]=1,Dt.size=Math.abs(St),Dt.start=0,Dt.end=Dt.size}function dt(de,Dt,qt,_t){for(let lt=0;lt1?1:qt}function Ct(de,Dt,qt,_t,lt,yt,St,Ht){if(_t/=Dt,yt>=(qt/=Dt)&&St<_t)return de;if(St=_t)return null;let Yt=[];for(let se of de){let ke=se.geometry,Ee=se.type,Ue=lt===0?se.minX:se.minY,ir=lt===0?se.maxX:se.maxY;if(Ue>=qt&&ir<_t){Yt.push(se);continue}if(ir=_t)continue;let ar=[];if(Ee==="Point"||Ee==="MultiPoint")It(ke,ar,qt,_t,lt);else if(Ee==="LineString")Nt(ke,ar,qt,_t,lt,!1,Ht.lineMetrics);else if(Ee==="MultiLineString")Jt(ke,ar,qt,_t,lt,!1);else if(Ee==="Polygon")Jt(ke,ar,qt,_t,lt,!0);else if(Ee==="MultiPolygon")for(let Ye of ke){let Er=[];Jt(Ye,Er,qt,_t,lt,!0),Er.length&&ar.push(Er)}if(ar.length){if(Ht.lineMetrics&&Ee==="LineString"){for(let Ye of ar)Yt.push(ut(se.id,Ee,Ye,se.tags));continue}Ee!=="LineString"&&Ee!=="MultiLineString"||(ar.length===1?(Ee="LineString",ar=ar[0]):Ee="MultiLineString"),Ee!=="Point"&&Ee!=="MultiPoint"||(Ee=ar.length===3?"Point":"MultiPoint"),Yt.push(ut(se.id,Ee,ar,se.tags))}}return Yt.length?Yt:null}function It(de,Dt,qt,_t,lt){for(let yt=0;yt=qt&&St<=_t&&ee(Dt,de[yt],de[yt+1],de[yt+2])}}function Nt(de,Dt,qt,_t,lt,yt,St){let Ht=te(de),Yt=lt===0?Zt:mt,se,ke,Ee=de.start;for(let Er=0;Erqt&&(ke=Yt(Ht,pn,dn,Zn,En,qt),St&&(Ht.start=Ee+se*ke)):gn>_t?da<_t&&(ke=Yt(Ht,pn,dn,Zn,En,_t),St&&(Ht.start=Ee+se*ke)):ee(Ht,pn,dn,bn),da=qt&&(ke=Yt(Ht,pn,dn,Zn,En,qt),ra=!0),da>_t&&gn<=_t&&(ke=Yt(Ht,pn,dn,Zn,En,_t),ra=!0),!yt&&ra&&(St&&(Ht.end=Ee+se*ke),Dt.push(Ht),Ht=te(de)),St&&(Ee+=se)}let Ue=de.length-3,ir=de[Ue],ar=de[Ue+1],Ye=lt===0?ir:ar;Ye>=qt&&Ye<=_t&&ee(Ht,ir,ar,de[Ue+2]),Ue=Ht.length-3,yt&&Ue>=3&&(Ht[Ue]!==Ht[0]||Ht[Ue+1]!==Ht[1])&&ee(Ht,Ht[0],Ht[1],Ht[2]),Ht.length&&Dt.push(Ht)}function te(de){let Dt=[];return Dt.size=de.size,Dt.start=de.start,Dt.end=de.end,Dt}function Jt(de,Dt,qt,_t,lt,yt){for(let St of de)Nt(St,Dt,qt,_t,lt,yt,!1)}function ee(de,Dt,qt,_t){de.push(Dt,qt,_t)}function Zt(de,Dt,qt,_t,lt,yt){let St=(yt-Dt)/(_t-Dt);return ee(de,yt,qt+(lt-qt)*St,1),St}function mt(de,Dt,qt,_t,lt,yt){let St=(yt-qt)/(lt-qt);return ee(de,Dt+(_t-Dt)*St,yt,1),St}function bt(de,Dt){let qt=[];for(let _t=0;_t0&&Dt.size<(lt?St:_t))return void(qt.numPoints+=Dt.length/3);let Ht=[];for(let Yt=0;YtSt)&&(qt.numSimplified++,Ht.push(Dt[Yt],Dt[Yt+1])),qt.numPoints++;lt&&(function(Yt,se){let ke=0;for(let Ee=0,Ue=Yt.length,ir=Ue-2;Ee0===se)for(let Ee=0,Ue=Yt.length;Ee24)throw new Error("maxZoom should be in the 0-24 range");if(qt.promoteId&&qt.generateId)throw new Error("promoteId and generateId cannot be used together.");let lt=(function(yt,St){let Ht=[];if(yt.type==="FeatureCollection")for(let Yt=0;Yt1&&console.time("creation"),ir=this.tiles[Ue]=Kt(Dt,qt,_t,lt,se),this.tileCoords.push({z:qt,x:_t,y:lt}),ke)){ke>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",qt,_t,lt,ir.numFeatures,ir.numPoints,ir.numSimplified),console.timeEnd("creation"));let ra=`z${qt}`;this.stats[ra]=(this.stats[ra]||0)+1,this.total++}if(ir.source=Dt,yt==null){if(qt===se.indexMaxZoom||ir.numPoints<=se.indexMaxPoints)continue}else{if(qt===se.maxZoom||qt===yt)continue;if(yt!=null){let ra=yt-qt;if(_t!==St>>ra||lt!==Ht>>ra)continue}}if(ir.source=null,Dt.length===0)continue;ke>1&&console.time("clipping");let ar=.5*se.buffer/se.extent,Ye=.5-ar,Er=.5+ar,pn=1+ar,dn=null,bn=null,Zn=null,En=null,gn=Ct(Dt,Ee,_t-ar,_t+Er,0,ir.minX,ir.maxX,se),da=Ct(Dt,Ee,_t+Ye,_t+pn,0,ir.minX,ir.maxX,se);Dt=null,gn&&(dn=Ct(gn,Ee,lt-ar,lt+Er,1,ir.minY,ir.maxY,se),bn=Ct(gn,Ee,lt+Ye,lt+pn,1,ir.minY,ir.maxY,se),gn=null),da&&(Zn=Ct(da,Ee,lt-ar,lt+Er,1,ir.minY,ir.maxY,se),En=Ct(da,Ee,lt+Ye,lt+pn,1,ir.minY,ir.maxY,se),da=null),ke>1&&console.timeEnd("clipping"),Yt.push(dn||[],qt+1,2*_t,2*lt),Yt.push(bn||[],qt+1,2*_t,2*lt+1),Yt.push(Zn||[],qt+1,2*_t+1,2*lt),Yt.push(En||[],qt+1,2*_t+1,2*lt+1)}}getTile(Dt,qt,_t){Dt=+Dt,qt=+qt,_t=+_t;let lt=this.options,{extent:yt,debug:St}=lt;if(Dt<0||Dt>24)return null;let Ht=1<1&&console.log("drilling down to z%d-%d-%d",Dt,qt,_t);let se,ke=Dt,Ee=qt,Ue=_t;for(;!se&&ke>0;)ke--,Ee>>=1,Ue>>=1,se=this.tiles[qe(ke,Ee,Ue)];return se&&se.source?(St>1&&(console.log("found parent tile z%d-%d-%d",ke,Ee,Ue),console.time("drilling down")),this.splitTile(se.source,ke,Ee,Ue,Dt,qt,_t),St>1&&console.timeEnd("drilling down"),this.tiles[Yt]?Ut(this.tiles[Yt],yt):null):null}}function qe(de,Dt,qt){return 32*((1<{Ee.properties=ir;let ar={};for(let Ye of Ue)ar[Ye]=Yt[Ye].evaluate(ke,Ee);return ar},St.reduce=(ir,ar)=>{Ee.properties=ar;for(let Ye of Ue)ke.accumulated=ir[Ye],ir[Ye]=se[Ye].evaluate(ke,Ee)},St})(Dt)).load((yield this._pendingData).features):(lt=yield this._pendingData,new We(lt,Dt.geojsonVtOptions)),this.loaded={};let yt={};if(_t){let St=_t.finish();St&&(yt.resourceTiming={},yt.resourceTiming[Dt.source]=JSON.parse(JSON.stringify(St)))}return yt}catch(yt){if(delete this._pendingRequest,t.bB(yt))return{abandoned:!0};throw yt}var lt})}getData(){return t._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(Dt){let qt=this.loaded;return qt&&qt[Dt.uid]?super.reloadTile(Dt):this.loadTile(Dt)}loadAndProcessGeoJSON(Dt,qt){return t._(this,void 0,void 0,function*(){let _t=yield this.loadGeoJSON(Dt,qt);if(delete this._pendingRequest,typeof _t!="object")throw new Error(`Input data given to '${Dt.source}' is not a valid GeoJSON object.`);if(v(_t,!0),Dt.filter){let lt=t.bC(Dt.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(lt.result==="error")throw new Error(lt.value.map(yt=>`${yt.key}: ${yt.message}`).join(", "));_t={type:"FeatureCollection",features:_t.features.filter(yt=>lt.value.evaluate({zoom:0},yt))}}return _t})}loadGeoJSON(Dt,qt){return t._(this,void 0,void 0,function*(){let{promoteId:_t}=Dt;if(Dt.request){let lt=yield t.h(Dt.request,qt);return this._dataUpdateable=_r(lt.data,_t)?er(lt.data,_t):void 0,lt.data}if(typeof Dt.data=="string")try{let lt=JSON.parse(Dt.data);return this._dataUpdateable=_r(lt,_t)?er(lt,_t):void 0,lt}catch{throw new Error(`Input data given to '${Dt.source}' is not a valid GeoJSON object.`)}if(!Dt.dataDiff)throw new Error(`Input data given to '${Dt.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${Dt.source}`);return(function(lt,yt,St){var Ht,Yt,se,ke;if(yt.removeAll&<.clear(),yt.remove)for(let Ee of yt.remove)lt.delete(Ee);if(yt.add)for(let Ee of yt.add){let Ue=vr(Ee,St);Ue!=null&<.set(Ue,Ee)}if(yt.update)for(let Ee of yt.update){let Ue=lt.get(Ee.id);if(Ue==null)continue;let ir=!Ee.removeAllProperties&&(((Ht=Ee.removeProperties)===null||Ht===void 0?void 0:Ht.length)>0||((Yt=Ee.addOrUpdateProperties)===null||Yt===void 0?void 0:Yt.length)>0);if((Ee.newGeometry||Ee.removeAllProperties||ir)&&(Ue=Object.assign({},Ue),lt.set(Ee.id,Ue),ir&&(Ue.properties=Object.assign({},Ue.properties))),Ee.newGeometry&&(Ue.geometry=Ee.newGeometry),Ee.removeAllProperties)Ue.properties={};else if(((se=Ee.removeProperties)===null||se===void 0?void 0:se.length)>0)for(let ar of Ee.removeProperties)Object.prototype.hasOwnProperty.call(Ue.properties,ar)&&delete Ue.properties[ar];if(((ke=Ee.addOrUpdateProperties)===null||ke===void 0?void 0:ke.length)>0)for(let{key:ar,value:Ye}of Ee.addOrUpdateProperties)Ue.properties[ar]=Ye}})(this._dataUpdateable,Dt.dataDiff,_t),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(Dt){return t._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(Dt){return this._geoJSONIndex.getClusterExpansionZoom(Dt.clusterId)}getClusterChildren(Dt){return this._geoJSONIndex.getChildren(Dt.clusterId)}getClusterLeaves(Dt){return this._geoJSONIndex.getLeaves(Dt.clusterId,Dt.limit,Dt.offset)}}class Ir{constructor(Dt){this.self=Dt,this.actor=new t.F(Dt),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(qt,_t)=>{if(this.externalWorkerSourceTypes[qt])throw new Error(`Worker source with name "${qt}" already registered.`);this.externalWorkerSourceTypes[qt]=_t},this.self.addProtocol=t.bi,this.self.removeProtocol=t.bj,this.self.registerRTLTextPlugin=qt=>{if(t.bD.isParsed())throw new Error("RTL text plugin already registered.");t.bD.setMethods(qt)},this.actor.registerMessageHandler("LDT",(qt,_t)=>this._getDEMWorkerSource(qt,_t.source).loadTile(_t)),this.actor.registerMessageHandler("RDT",(qt,_t)=>t._(this,void 0,void 0,function*(){this._getDEMWorkerSource(qt,_t.source).removeTile(_t)})),this.actor.registerMessageHandler("GCEZ",(qt,_t)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(qt,_t.type,_t.source).getClusterExpansionZoom(_t)})),this.actor.registerMessageHandler("GCC",(qt,_t)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(qt,_t.type,_t.source).getClusterChildren(_t)})),this.actor.registerMessageHandler("GCL",(qt,_t)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(qt,_t.type,_t.source).getClusterLeaves(_t)})),this.actor.registerMessageHandler("LD",(qt,_t)=>this._getWorkerSource(qt,_t.type,_t.source).loadData(_t)),this.actor.registerMessageHandler("GD",(qt,_t)=>this._getWorkerSource(qt,_t.type,_t.source).getData()),this.actor.registerMessageHandler("LT",(qt,_t)=>this._getWorkerSource(qt,_t.type,_t.source).loadTile(_t)),this.actor.registerMessageHandler("RT",(qt,_t)=>this._getWorkerSource(qt,_t.type,_t.source).reloadTile(_t)),this.actor.registerMessageHandler("AT",(qt,_t)=>this._getWorkerSource(qt,_t.type,_t.source).abortTile(_t)),this.actor.registerMessageHandler("RMT",(qt,_t)=>this._getWorkerSource(qt,_t.type,_t.source).removeTile(_t)),this.actor.registerMessageHandler("RS",(qt,_t)=>t._(this,void 0,void 0,function*(){if(!this.workerSources[qt]||!this.workerSources[qt][_t.type]||!this.workerSources[qt][_t.type][_t.source])return;let lt=this.workerSources[qt][_t.type][_t.source];delete this.workerSources[qt][_t.type][_t.source],lt.removeSource!==void 0&<.removeSource(_t)})),this.actor.registerMessageHandler("RM",qt=>t._(this,void 0,void 0,function*(){delete this.layerIndexes[qt],delete this.availableImages[qt],delete this.workerSources[qt],delete this.demWorkerSources[qt]})),this.actor.registerMessageHandler("SR",(qt,_t)=>t._(this,void 0,void 0,function*(){this.referrer=_t})),this.actor.registerMessageHandler("SRPS",(qt,_t)=>this._syncRTLPluginState(qt,_t)),this.actor.registerMessageHandler("IS",(qt,_t)=>t._(this,void 0,void 0,function*(){this.self.importScripts(_t)})),this.actor.registerMessageHandler("SI",(qt,_t)=>this._setImages(qt,_t)),this.actor.registerMessageHandler("UL",(qt,_t)=>t._(this,void 0,void 0,function*(){this._getLayerIndex(qt).update(_t.layers,_t.removedIds)})),this.actor.registerMessageHandler("SL",(qt,_t)=>t._(this,void 0,void 0,function*(){this._getLayerIndex(qt).replace(_t)}))}_setImages(Dt,qt){return t._(this,void 0,void 0,function*(){this.availableImages[Dt]=qt;for(let _t in this.workerSources[Dt]){let lt=this.workerSources[Dt][_t];for(let yt in lt)lt[yt].availableImages=qt}})}_syncRTLPluginState(Dt,qt){return t._(this,void 0,void 0,function*(){if(t.bD.isParsed())return t.bD.getState();if(qt.pluginStatus!=="loading")return t.bD.setState(qt),qt;let _t=qt.pluginURL;if(this.self.importScripts(_t),t.bD.isParsed()){let lt={pluginStatus:"loaded",pluginURL:_t};return t.bD.setState(lt),lt}throw t.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${_t}`)})}_getAvailableImages(Dt){let qt=this.availableImages[Dt];return qt||(qt=[]),qt}_getLayerIndex(Dt){let qt=this.layerIndexes[Dt];return qt||(qt=this.layerIndexes[Dt]=new e),qt}_getWorkerSource(Dt,qt,_t){if(this.workerSources[Dt]||(this.workerSources[Dt]={}),this.workerSources[Dt][qt]||(this.workerSources[Dt][qt]={}),!this.workerSources[Dt][qt][_t]){let lt={sendAsync:(yt,St)=>(yt.targetMapId=Dt,this.actor.sendAsync(yt,St))};switch(qt){case"vector":this.workerSources[Dt][qt][_t]=new o(lt,this._getLayerIndex(Dt),this._getAvailableImages(Dt));break;case"geojson":this.workerSources[Dt][qt][_t]=new Mr(lt,this._getLayerIndex(Dt),this._getAvailableImages(Dt));break;default:this.workerSources[Dt][qt][_t]=new this.externalWorkerSourceTypes[qt](lt,this._getLayerIndex(Dt),this._getAvailableImages(Dt))}}return this.workerSources[Dt][qt][_t]}_getDEMWorkerSource(Dt,qt){return this.demWorkerSources[Dt]||(this.demWorkerSources[Dt]={}),this.demWorkerSources[Dt][qt]||(this.demWorkerSources[Dt][qt]=new a),this.demWorkerSources[Dt][qt]}}return t.i(self)&&(self.worker=new Ir(self)),Ir}),E("index",["exports","./shared"],function(t,e){var r="4.7.1";let i,n,o={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:Pt=>new Promise((L,at)=>{let xt=requestAnimationFrame(L);Pt.signal.addEventListener("abort",()=>{cancelAnimationFrame(xt),at(e.c())})}),getImageData(Pt,L=0){return this.getImageCanvasContext(Pt).getImageData(-L,-L,Pt.width+2*L,Pt.height+2*L)},getImageCanvasContext(Pt){let L=window.document.createElement("canvas"),at=L.getContext("2d",{willReadFrequently:!0});if(!at)throw new Error("failed to create canvas 2d context");return L.width=Pt.width,L.height=Pt.height,at.drawImage(Pt,0,0,Pt.width,Pt.height),at},resolveURL:Pt=>(i||(i=document.createElement("a")),i.href=Pt,i.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(n==null&&(n=matchMedia("(prefers-reduced-motion: reduce)")),n.matches)}};class a{static testProp(L){if(!a.docStyle)return L[0];for(let at=0;at{window.removeEventListener("click",a.suppressClickInternal,!0)},0)}static getScale(L){let at=L.getBoundingClientRect();return{x:at.width/L.offsetWidth||1,y:at.height/L.offsetHeight||1,boundingClientRect:at}}static getPoint(L,at,xt){let kt=at.boundingClientRect;return new e.P((xt.clientX-kt.left)/at.x-L.clientLeft,(xt.clientY-kt.top)/at.y-L.clientTop)}static mousePos(L,at){let xt=a.getScale(L);return a.getPoint(L,xt,at)}static touchPos(L,at){let xt=[],kt=a.getScale(L);for(let Lt=0;Lt{f&&w(f),f=null,m=!0},v.onerror=()=>{g=!0,f=null},v.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),(function(Pt){let L,at,xt,kt;Pt.resetRequestQueue=()=>{L=[],at=0,xt=0,kt={}},Pt.addThrottleControl=Pe=>{let $e=xt++;return kt[$e]=Pe,$e},Pt.removeThrottleControl=Pe=>{delete kt[Pe],le()},Pt.getImage=(Pe,$e,hr=!0)=>new Promise((pr,Br)=>{s.supported&&(Pe.headers||(Pe.headers={}),Pe.headers.accept="image/webp,*/*"),e.e(Pe,{type:"image"}),L.push({abortController:$e,requestParameters:Pe,supportImageRefresh:hr,state:"queued",onError:Jr=>{Br(Jr)},onSuccess:Jr=>{pr(Jr)}}),le()});let Lt=Pe=>e._(this,void 0,void 0,function*(){Pe.state="running";let{requestParameters:$e,supportImageRefresh:hr,onError:pr,onSuccess:Br,abortController:Jr}=Pe,Rt=hr===!1&&!e.i(self)&&!e.g($e.url)&&(!$e.headers||Object.keys($e.headers).reduce((ce,Te)=>ce&&Te==="accept",!0));at++;let Gt=Rt?xe($e,Jr):e.m($e,Jr);try{let ce=yield Gt;delete Pe.abortController,Pe.state="completed",ce.data instanceof HTMLImageElement||e.b(ce.data)?Br(ce):ce.data&&Br({data:yield(ae=ce.data,typeof createImageBitmap=="function"?e.d(ae):e.f(ae)),cacheControl:ce.cacheControl,expires:ce.expires})}catch(ce){delete Pe.abortController,pr(ce)}finally{at--,le()}var ae}),le=()=>{let Pe=(()=>{for(let $e of Object.keys(kt))if(kt[$e]())return!0;return!1})()?e.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:e.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let $e=at;$e0;$e++){let hr=L.shift();hr.abortController.signal.aborted?$e--:Lt(hr)}},xe=(Pe,$e)=>new Promise((hr,pr)=>{let Br=new Image,Jr=Pe.url,Rt=Pe.credentials;Rt&&Rt==="include"?Br.crossOrigin="use-credentials":(Rt&&Rt==="same-origin"||!e.s(Jr))&&(Br.crossOrigin="anonymous"),$e.signal.addEventListener("abort",()=>{Br.src="",pr(e.c())}),Br.fetchPriority="high",Br.onload=()=>{Br.onerror=Br.onload=null,hr({data:Br})},Br.onerror=()=>{Br.onerror=Br.onload=null,$e.signal.aborted||pr(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},Br.src=Jr})})(l||(l={})),l.resetRequestQueue();class x{constructor(L){this._transformRequestFn=L}transformRequest(L,at){return this._transformRequestFn&&this._transformRequestFn(L,at)||{url:L}}setTransformRequest(L){this._transformRequestFn=L}}function y(Pt){var L=new e.A(3);return L[0]=Pt[0],L[1]=Pt[1],L[2]=Pt[2],L}var S,k=function(Pt,L,at){return Pt[0]=L[0]-at[0],Pt[1]=L[1]-at[1],Pt[2]=L[2]-at[2],Pt};S=new e.A(3),e.A!=Float32Array&&(S[0]=0,S[1]=0,S[2]=0);var M=function(Pt){var L=Pt[0],at=Pt[1];return L*L+at*at};function T(Pt){let L=[];if(typeof Pt=="string")L.push({id:"default",url:Pt});else if(Pt&&Pt.length>0){let at=[];for(let{id:xt,url:kt}of Pt){let Lt=`${xt}${kt}`;at.indexOf(Lt)===-1&&(at.push(Lt),L.push({id:xt,url:kt}))}}return L}function c(Pt,L,at){let xt=Pt.split("?");return xt[0]+=`${L}${at}`,xt.join("?")}(function(){var Pt=new e.A(2);e.A!=Float32Array&&(Pt[0]=0,Pt[1]=0)})();class h{constructor(L,at,xt,kt){this.context=L,this.format=xt,this.texture=L.gl.createTexture(),this.update(at,kt)}update(L,at,xt){let{width:kt,height:Lt}=L,le=!(this.size&&this.size[0]===kt&&this.size[1]===Lt||xt),{context:xe}=this,{gl:Pe}=xe;if(this.useMipmap=!!(at&&at.useMipmap),Pe.bindTexture(Pe.TEXTURE_2D,this.texture),xe.pixelStoreUnpackFlipY.set(!1),xe.pixelStoreUnpack.set(1),xe.pixelStoreUnpackPremultiplyAlpha.set(this.format===Pe.RGBA&&(!at||at.premultiply!==!1)),le)this.size=[kt,Lt],L instanceof HTMLImageElement||L instanceof HTMLCanvasElement||L instanceof HTMLVideoElement||L instanceof ImageData||e.b(L)?Pe.texImage2D(Pe.TEXTURE_2D,0,this.format,this.format,Pe.UNSIGNED_BYTE,L):Pe.texImage2D(Pe.TEXTURE_2D,0,this.format,kt,Lt,0,this.format,Pe.UNSIGNED_BYTE,L.data);else{let{x:$e,y:hr}=xt||{x:0,y:0};L instanceof HTMLImageElement||L instanceof HTMLCanvasElement||L instanceof HTMLVideoElement||L instanceof ImageData||e.b(L)?Pe.texSubImage2D(Pe.TEXTURE_2D,0,$e,hr,Pe.RGBA,Pe.UNSIGNED_BYTE,L):Pe.texSubImage2D(Pe.TEXTURE_2D,0,$e,hr,kt,Lt,Pe.RGBA,Pe.UNSIGNED_BYTE,L.data)}this.useMipmap&&this.isSizePowerOfTwo()&&Pe.generateMipmap(Pe.TEXTURE_2D)}bind(L,at,xt){let{context:kt}=this,{gl:Lt}=kt;Lt.bindTexture(Lt.TEXTURE_2D,this.texture),xt!==Lt.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(xt=Lt.LINEAR),L!==this.filter&&(Lt.texParameteri(Lt.TEXTURE_2D,Lt.TEXTURE_MAG_FILTER,L),Lt.texParameteri(Lt.TEXTURE_2D,Lt.TEXTURE_MIN_FILTER,xt||L),this.filter=L),at!==this.wrap&&(Lt.texParameteri(Lt.TEXTURE_2D,Lt.TEXTURE_WRAP_S,at),Lt.texParameteri(Lt.TEXTURE_2D,Lt.TEXTURE_WRAP_T,at),this.wrap=at)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:L}=this.context;L.deleteTexture(this.texture),this.texture=null}}function b(Pt){let{userImage:L}=Pt;return!!(L&&L.render&&L.render())&&(Pt.data.replace(new Uint8Array(L.data.buffer)),!0)}class _ extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(L){if(this.loaded!==L&&(this.loaded=L,L)){for(let{ids:at,promiseResolve:xt}of this.requestors)xt(this._getImagesForIds(at));this.requestors=[]}}getImage(L){let at=this.images[L];if(at&&!at.data&&at.spriteData){let xt=at.spriteData;at.data=new e.R({width:xt.width,height:xt.height},xt.context.getImageData(xt.x,xt.y,xt.width,xt.height).data),at.spriteData=null}return at}addImage(L,at){if(this.images[L])throw new Error(`Image id ${L} already exist, use updateImage instead`);this._validate(L,at)&&(this.images[L]=at)}_validate(L,at){let xt=!0,kt=at.data||at.spriteData;return this._validateStretch(at.stretchX,kt&&kt.width)||(this.fire(new e.j(new Error(`Image "${L}" has invalid "stretchX" value`))),xt=!1),this._validateStretch(at.stretchY,kt&&kt.height)||(this.fire(new e.j(new Error(`Image "${L}" has invalid "stretchY" value`))),xt=!1),this._validateContent(at.content,at)||(this.fire(new e.j(new Error(`Image "${L}" has invalid "content" value`))),xt=!1),xt}_validateStretch(L,at){if(!L)return!0;let xt=0;for(let kt of L){if(kt[0]{let kt=!0;if(!this.isLoaded())for(let Lt of L)this.images[Lt]||(kt=!1);this.isLoaded()||kt?at(this._getImagesForIds(L)):this.requestors.push({ids:L,promiseResolve:at})})}_getImagesForIds(L){let at={};for(let xt of L){let kt=this.getImage(xt);kt||(this.fire(new e.k("styleimagemissing",{id:xt})),kt=this.getImage(xt)),kt?at[xt]={data:kt.data.clone(),pixelRatio:kt.pixelRatio,sdf:kt.sdf,version:kt.version,stretchX:kt.stretchX,stretchY:kt.stretchY,content:kt.content,textFitWidth:kt.textFitWidth,textFitHeight:kt.textFitHeight,hasRenderCallback:!!(kt.userImage&&kt.userImage.render)}:e.w(`Image "${xt}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return at}getPixelSize(){let{width:L,height:at}=this.atlasImage;return{width:L,height:at}}getPattern(L){let at=this.patterns[L],xt=this.getImage(L);if(!xt)return null;if(at&&at.position.version===xt.version)return at.position;if(at)at.position.version=xt.version;else{let kt={w:xt.data.width+2,h:xt.data.height+2,x:0,y:0},Lt=new e.I(kt,xt);this.patterns[L]={bin:kt,position:Lt}}return this._updatePatternAtlas(),this.patterns[L].position}bind(L){let at=L.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new h(L,this.atlasImage,at.RGBA),this.atlasTexture.bind(at.LINEAR,at.CLAMP_TO_EDGE)}_updatePatternAtlas(){let L=[];for(let Lt in this.patterns)L.push(this.patterns[Lt].bin);let{w:at,h:xt}=e.p(L),kt=this.atlasImage;kt.resize({width:at||1,height:xt||1});for(let Lt in this.patterns){let{bin:le}=this.patterns[Lt],xe=le.x+1,Pe=le.y+1,$e=this.getImage(Lt).data,hr=$e.width,pr=$e.height;e.R.copy($e,kt,{x:0,y:0},{x:xe,y:Pe},{width:hr,height:pr}),e.R.copy($e,kt,{x:0,y:pr-1},{x:xe,y:Pe-1},{width:hr,height:1}),e.R.copy($e,kt,{x:0,y:0},{x:xe,y:Pe+pr},{width:hr,height:1}),e.R.copy($e,kt,{x:hr-1,y:0},{x:xe-1,y:Pe},{width:1,height:pr}),e.R.copy($e,kt,{x:0,y:0},{x:xe+hr,y:Pe},{width:1,height:pr})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(L){for(let at of L){if(this.callbackDispatchedThisFrame[at])continue;this.callbackDispatchedThisFrame[at]=!0;let xt=this.getImage(at);xt||e.w(`Image with ID: "${at}" was not found`),b(xt)&&this.updateImage(at,xt)}}}let P=1e20;function z(Pt,L,at,xt,kt,Lt,le,xe,Pe){for(let $e=L;$e-1);Pe++,Lt[Pe]=xe,le[Pe]=$e,le[Pe+1]=P}for(let xe=0,Pe=0;xe65535)throw new Error("glyphs > 65535 not supported");if(xt.ranges[Lt])return{stack:L,id:at,glyph:kt};if(!this.url)throw new Error("glyphsUrl is not set");if(!xt.requests[Lt]){let xe=B.loadGlyphRange(L,Lt,this.url,this.requestManager);xt.requests[Lt]=xe}let le=yield xt.requests[Lt];for(let xe in le)this._doesCharSupportLocalGlyph(+xe)||(xt.glyphs[+xe]=le[+xe]);return xt.ranges[Lt]=!0,{stack:L,id:at,glyph:le[at]||null}})}_doesCharSupportLocalGlyph(L){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(L))}_tinySDF(L,at,xt){let kt=this.localIdeographFontFamily;if(!kt||!this._doesCharSupportLocalGlyph(xt))return;let Lt=L.tinySDF;if(!Lt){let xe="400";/bold/i.test(at)?xe="900":/medium/i.test(at)?xe="500":/light/i.test(at)&&(xe="200"),Lt=L.tinySDF=new B.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:kt,fontWeight:xe})}let le=Lt.draw(String.fromCharCode(xt));return{id:xt,bitmap:new e.o({width:le.width||60,height:le.height||60},le.data),metrics:{width:le.glyphWidth/2||24,height:le.glyphHeight/2||24,left:le.glyphLeft/2+.5||0,top:le.glyphTop/2-27.5||-8,advance:le.glyphAdvance/2||24,isDoubleResolution:!0}}}}B.loadGlyphRange=function(Pt,L,at,xt){return e._(this,void 0,void 0,function*(){let kt=256*L,Lt=kt+255,le=xt.transformRequest(at.replace("{fontstack}",Pt).replace("{range}",`${kt}-${Lt}`),"Glyphs"),xe=yield e.l(le,new AbortController);if(!xe||!xe.data)throw new Error(`Could not load glyph range. range: ${L}, ${kt}-${Lt}`);let Pe={};for(let $e of e.n(xe.data))Pe[$e.id]=$e;return Pe})},B.TinySDF=class{constructor({fontSize:Pt=24,buffer:L=3,radius:at=8,cutoff:xt=.25,fontFamily:kt="sans-serif",fontWeight:Lt="normal",fontStyle:le="normal"}={}){this.buffer=L,this.cutoff=xt,this.radius=at;let xe=this.size=Pt+4*L,Pe=this._createCanvas(xe),$e=this.ctx=Pe.getContext("2d",{willReadFrequently:!0});$e.font=`${le} ${Lt} ${Pt}px ${kt}`,$e.textBaseline="alphabetic",$e.textAlign="left",$e.fillStyle="black",this.gridOuter=new Float64Array(xe*xe),this.gridInner=new Float64Array(xe*xe),this.f=new Float64Array(xe),this.z=new Float64Array(xe+1),this.v=new Uint16Array(xe)}_createCanvas(Pt){let L=document.createElement("canvas");return L.width=L.height=Pt,L}draw(Pt){let{width:L,actualBoundingBoxAscent:at,actualBoundingBoxDescent:xt,actualBoundingBoxLeft:kt,actualBoundingBoxRight:Lt}=this.ctx.measureText(Pt),le=Math.ceil(at),xe=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(Lt-kt))),Pe=Math.min(this.size-this.buffer,le+Math.ceil(xt)),$e=xe+2*this.buffer,hr=Pe+2*this.buffer,pr=Math.max($e*hr,0),Br=new Uint8ClampedArray(pr),Jr={data:Br,width:$e,height:hr,glyphWidth:xe,glyphHeight:Pe,glyphTop:le,glyphLeft:0,glyphAdvance:L};if(xe===0||Pe===0)return Jr;let{ctx:Rt,buffer:Gt,gridInner:ae,gridOuter:ce}=this;Rt.clearRect(Gt,Gt,xe,Pe),Rt.fillText(Pt,Gt,Gt+le);let Te=Rt.getImageData(Gt,Gt,xe,Pe);ce.fill(P,0,pr),ae.fill(0,0,pr);for(let ye=0;ye0?gr*gr:0,ae[fr]=gr<0?gr*gr:0}}z(ce,0,0,$e,hr,$e,this.f,this.v,this.z),z(ae,Gt,Gt,xe,Pe,$e,this.f,this.v,this.z);for(let ye=0;ye1&&(Pe=L[++xe]);let hr=Math.abs($e-Pe.left),pr=Math.abs($e-Pe.right),Br=Math.min(hr,pr),Jr,Rt=Lt/xt*(kt+1);if(Pe.isDash){let Gt=kt-Math.abs(Rt);Jr=Math.sqrt(Br*Br+Gt*Gt)}else Jr=kt-Math.sqrt(Br*Br+Rt*Rt);this.data[le+$e]=Math.max(0,Math.min(255,Jr+128))}}}addRegularDash(L){for(let xe=L.length-1;xe>=0;--xe){let Pe=L[xe],$e=L[xe+1];Pe.zeroLength?L.splice(xe,1):$e&&$e.isDash===Pe.isDash&&($e.left=Pe.left,L.splice(xe,1))}let at=L[0],xt=L[L.length-1];at.isDash===xt.isDash&&(at.left=xt.left-this.width,xt.right=at.right+this.width);let kt=this.width*this.nextRow,Lt=0,le=L[Lt];for(let xe=0;xe1&&(le=L[++Lt]);let Pe=Math.abs(xe-le.left),$e=Math.abs(xe-le.right),hr=Math.min(Pe,$e);this.data[kt+xe]=Math.max(0,Math.min(255,(le.isDash?hr:-hr)+128))}}addDash(L,at){let xt=at?7:0,kt=2*xt+1;if(this.nextRow+kt>this.height)return e.w("LineAtlas out of space"),null;let Lt=0;for(let xe=0;xe{at.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[rt]}numActive(){return Object.keys(this.active).length}}let st=Math.floor(o.hardwareConcurrency/2),et,Z;function ot(){return et||(et=new ct),et}ct.workerCount=e.C(globalThis)?Math.max(Math.min(st,3),1):1;class X{constructor(L,at){this.workerPool=L,this.actors=[],this.currentActor=0,this.id=at;let xt=this.workerPool.acquire(at);for(let kt=0;kt{at.remove()}),this.actors=[],L&&this.workerPool.release(this.id)}registerMessageHandler(L,at){for(let xt of this.actors)xt.registerMessageHandler(L,at)}}function Q(){return Z||(Z=new X(ot(),e.G),Z.registerMessageHandler("GR",(Pt,L,at)=>e.m(L,at))),Z}function ut(Pt,L){let at=e.H();return e.J(at,at,[1,1,0]),e.K(at,at,[.5*Pt.width,.5*Pt.height,1]),e.L(at,at,Pt.calculatePosMatrix(L.toUnwrapped()))}function J(Pt,L,at,xt,kt,Lt){let le=(function(pr,Br,Jr){if(pr)for(let Rt of pr){let Gt=Br[Rt];if(Gt&&Gt.source===Jr&&Gt.type==="fill-extrusion")return!0}else for(let Rt in Br){let Gt=Br[Rt];if(Gt.source===Jr&&Gt.type==="fill-extrusion")return!0}return!1})(kt&&kt.layers,L,Pt.id),xe=Lt.maxPitchScaleFactor(),Pe=Pt.tilesIn(xt,xe,le);Pe.sort(q);let $e=[];for(let pr of Pe)$e.push({wrappedTileID:pr.tileID.wrapped().key,queryResults:pr.tile.queryRenderedFeatures(L,at,Pt._state,pr.queryGeometry,pr.cameraQueryGeometry,pr.scale,kt,Lt,xe,ut(Pt.transform,pr.tileID))});let hr=(function(pr){let Br={},Jr={};for(let Rt of pr){let Gt=Rt.queryResults,ae=Rt.wrappedTileID,ce=Jr[ae]=Jr[ae]||{};for(let Te in Gt){let ye=Gt[Te],ze=ce[Te]=ce[Te]||{},rr=Br[Te]=Br[Te]||[];for(let fr of ye)ze[fr.featureIndex]||(ze[fr.featureIndex]=!0,rr.push(fr))}}return Br})($e);for(let pr in hr)hr[pr].forEach(Br=>{let Jr=Br.feature,Rt=Pt.getFeatureState(Jr.layer["source-layer"],Jr.id);Jr.source=Jr.layer.source,Jr.layer["source-layer"]&&(Jr.sourceLayer=Jr.layer["source-layer"]),Jr.state=Rt});return hr}function q(Pt,L){let at=Pt.tileID,xt=L.tileID;return at.overscaledZ-xt.overscaledZ||at.canonical.y-xt.canonical.y||at.wrap-xt.wrap||at.canonical.x-xt.canonical.x}function it(Pt,L,at){return e._(this,void 0,void 0,function*(){let xt=Pt;if(Pt.url?xt=(yield e.h(L.transformRequest(Pt.url,"Source"),at)).data:yield o.frameAsync(at),!xt)return null;let kt=e.M(e.e(xt,Pt),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in xt&&xt.vector_layers&&(kt.vectorLayerIds=xt.vector_layers.map(Lt=>Lt.id)),kt})}class nt{constructor(L,at){L&&(at?this.setSouthWest(L).setNorthEast(at):Array.isArray(L)&&(L.length===4?this.setSouthWest([L[0],L[1]]).setNorthEast([L[2],L[3]]):this.setSouthWest(L[0]).setNorthEast(L[1])))}setNorthEast(L){return this._ne=L instanceof e.N?new e.N(L.lng,L.lat):e.N.convert(L),this}setSouthWest(L){return this._sw=L instanceof e.N?new e.N(L.lng,L.lat):e.N.convert(L),this}extend(L){let at=this._sw,xt=this._ne,kt,Lt;if(L instanceof e.N)kt=L,Lt=L;else{if(!(L instanceof nt))return Array.isArray(L)?L.length===4||L.every(Array.isArray)?this.extend(nt.convert(L)):this.extend(e.N.convert(L)):L&&("lng"in L||"lon"in L)&&"lat"in L?this.extend(e.N.convert(L)):this;if(kt=L._sw,Lt=L._ne,!kt||!Lt)return this}return at||xt?(at.lng=Math.min(kt.lng,at.lng),at.lat=Math.min(kt.lat,at.lat),xt.lng=Math.max(Lt.lng,xt.lng),xt.lat=Math.max(Lt.lat,xt.lat)):(this._sw=new e.N(kt.lng,kt.lat),this._ne=new e.N(Lt.lng,Lt.lat)),this}getCenter(){return new e.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new e.N(this.getWest(),this.getNorth())}getSouthEast(){return new e.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(L){let{lng:at,lat:xt}=e.N.convert(L),kt=this._sw.lng<=at&&at<=this._ne.lng;return this._sw.lng>this._ne.lng&&(kt=this._sw.lng>=at&&at>=this._ne.lng),this._sw.lat<=xt&&xt<=this._ne.lat&&kt}static convert(L){return L instanceof nt?L:L&&new nt(L)}static fromLngLat(L,at=0){let xt=360*at/40075017,kt=xt/Math.cos(Math.PI/180*L.lat);return new nt(new e.N(L.lng-kt,L.lat-xt),new e.N(L.lng+kt,L.lat+xt))}adjustAntiMeridian(){let L=new e.N(this._sw.lng,this._sw.lat),at=new e.N(this._ne.lng,this._ne.lat);return new nt(L,L.lng>at.lng?new e.N(at.lng+360,at.lat):at)}}class dt{constructor(L,at,xt){this.bounds=nt.convert(this.validateBounds(L)),this.minzoom=at||0,this.maxzoom=xt||24}validateBounds(L){return Array.isArray(L)&&L.length===4?[Math.max(-180,L[0]),Math.max(-90,L[1]),Math.min(180,L[2]),Math.min(90,L[3])]:[-180,-90,180,90]}contains(L){let at=Math.pow(2,L.z),xt=Math.floor(e.O(this.bounds.getWest())*at),kt=Math.floor(e.Q(this.bounds.getNorth())*at),Lt=Math.ceil(e.O(this.bounds.getEast())*at),le=Math.ceil(e.Q(this.bounds.getSouth())*at);return L.x>=xt&&L.x=kt&&L.y{this._options.tiles=L}),this}setUrl(L){return this.setSourceProperty(()=>{this.url=L,this._options.url=L}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return e.e({},this._options)}loadTile(L){return e._(this,void 0,void 0,function*(){let at=L.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),xt={request:this.map._requestManager.transformRequest(at,"Tile"),uid:L.uid,tileID:L.tileID,zoom:L.tileID.overscaledZ,tileSize:this.tileSize*L.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};xt.request.collectResourceTiming=this._collectResourceTiming;let kt="RT";if(L.actor&&L.state!=="expired"){if(L.state==="loading")return new Promise((Lt,le)=>{L.reloadPromise={resolve:Lt,reject:le}})}else L.actor=this.dispatcher.getActor(),kt="LT";L.abortController=new AbortController;try{let Lt=yield L.actor.sendAsync({type:kt,data:xt},L.abortController);if(delete L.abortController,L.aborted)return;this._afterTileLoadWorkerResponse(L,Lt)}catch(Lt){if(delete L.abortController,L.aborted)return;if(Lt&&Lt.status!==404)throw Lt;this._afterTileLoadWorkerResponse(L,null)}})}_afterTileLoadWorkerResponse(L,at){if(at&&at.resourceTiming&&(L.resourceTiming=at.resourceTiming),at&&this.map._refreshExpiredTiles&&L.setExpiryData(at),L.loadVectorData(at,this.map.painter),L.reloadPromise){let xt=L.reloadPromise;L.reloadPromise=null,this.loadTile(L).then(xt.resolve).catch(xt.reject)}}abortTile(L){return e._(this,void 0,void 0,function*(){L.abortController&&(L.abortController.abort(),delete L.abortController),L.actor&&(yield L.actor.sendAsync({type:"AT",data:{uid:L.uid,type:this.type,source:this.id}}))})}unloadTile(L){return e._(this,void 0,void 0,function*(){L.unloadVectorData(),L.actor&&(yield L.actor.sendAsync({type:"RMT",data:{uid:L.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class wt extends e.E{constructor(L,at,xt,kt){super(),this.id=L,this.dispatcher=xt,this.setEventedParent(kt),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.e({type:"raster"},at),e.e(this,e.M(at,["url","scheme","tileSize"]))}load(){return e._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new e.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let L=yield it(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,L&&(e.e(this,L),L.bounds&&(this.tileBounds=new dt(L.bounds,this.minzoom,this.maxzoom)),this.fire(new e.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.k("data",{dataType:"source",sourceDataType:"content"})))}catch(L){this._tileJSONRequest=null,this.fire(new e.j(L))}})}loaded(){return this._loaded}onAdd(L){this.map=L,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(L){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),L(),this.load()}setTiles(L){return this.setSourceProperty(()=>{this._options.tiles=L}),this}setUrl(L){return this.setSourceProperty(()=>{this.url=L,this._options.url=L}),this}serialize(){return e.e({},this._options)}hasTile(L){return!this.tileBounds||this.tileBounds.contains(L.canonical)}loadTile(L){return e._(this,void 0,void 0,function*(){let at=L.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);L.abortController=new AbortController;try{let xt=yield l.getImage(this.map._requestManager.transformRequest(at,"Tile"),L.abortController,this.map._refreshExpiredTiles);if(delete L.abortController,L.aborted)return void(L.state="unloaded");if(xt&&xt.data){this.map._refreshExpiredTiles&&xt.cacheControl&&xt.expires&&L.setExpiryData({cacheControl:xt.cacheControl,expires:xt.expires});let kt=this.map.painter.context,Lt=kt.gl,le=xt.data;L.texture=this.map.painter.getTileTexture(le.width),L.texture?L.texture.update(le,{useMipmap:!0}):(L.texture=new h(kt,le,Lt.RGBA,{useMipmap:!0}),L.texture.bind(Lt.LINEAR,Lt.CLAMP_TO_EDGE,Lt.LINEAR_MIPMAP_NEAREST)),L.state="loaded"}}catch(xt){if(delete L.abortController,L.aborted)L.state="unloaded";else if(xt)throw L.state="errored",xt}})}abortTile(L){return e._(this,void 0,void 0,function*(){L.abortController&&(L.abortController.abort(),delete L.abortController)})}unloadTile(L){return e._(this,void 0,void 0,function*(){L.texture&&this.map.painter.saveTileTexture(L.texture)})}hasTransition(){return!1}}class Ct extends wt{constructor(L,at,xt,kt){super(L,at,xt,kt),this.type="raster-dem",this.maxzoom=22,this._options=e.e({type:"raster-dem"},at),this.encoding=at.encoding||"mapbox",this.redFactor=at.redFactor,this.greenFactor=at.greenFactor,this.blueFactor=at.blueFactor,this.baseShift=at.baseShift}loadTile(L){return e._(this,void 0,void 0,function*(){let at=L.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),xt=this.map._requestManager.transformRequest(at,"Tile");L.neighboringTiles=this._getNeighboringTiles(L.tileID),L.abortController=new AbortController;try{let kt=yield l.getImage(xt,L.abortController,this.map._refreshExpiredTiles);if(delete L.abortController,L.aborted)return void(L.state="unloaded");if(kt&&kt.data){let Lt=kt.data;this.map._refreshExpiredTiles&&kt.cacheControl&&kt.expires&&L.setExpiryData({cacheControl:kt.cacheControl,expires:kt.expires});let le=e.b(Lt)&&e.U()?Lt:yield this.readImageNow(Lt),xe={type:this.type,uid:L.uid,source:this.id,rawImageData:le,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!L.actor||L.state==="expired"){L.actor=this.dispatcher.getActor();let Pe=yield L.actor.sendAsync({type:"LDT",data:xe});L.dem=Pe,L.needsHillshadePrepare=!0,L.needsTerrainPrepare=!0,L.state="loaded"}}}catch(kt){if(delete L.abortController,L.aborted)L.state="unloaded";else if(kt)throw L.state="errored",kt}})}readImageNow(L){return e._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&e.V()){let at=L.width+2,xt=L.height+2;try{return new e.R({width:at,height:xt},yield e.W(L,-1,-1,at,xt))}catch{}}return o.getImageData(L,1)})}_getNeighboringTiles(L){let at=L.canonical,xt=Math.pow(2,at.z),kt=(at.x-1+xt)%xt,Lt=at.x===0?L.wrap-1:L.wrap,le=(at.x+1+xt)%xt,xe=at.x+1===xt?L.wrap+1:L.wrap,Pe={};return Pe[new e.S(L.overscaledZ,Lt,at.z,kt,at.y).key]={backfilled:!1},Pe[new e.S(L.overscaledZ,xe,at.z,le,at.y).key]={backfilled:!1},at.y>0&&(Pe[new e.S(L.overscaledZ,Lt,at.z,kt,at.y-1).key]={backfilled:!1},Pe[new e.S(L.overscaledZ,L.wrap,at.z,at.x,at.y-1).key]={backfilled:!1},Pe[new e.S(L.overscaledZ,xe,at.z,le,at.y-1).key]={backfilled:!1}),at.y+10&&e.e(Lt,{resourceTiming:kt}),this.fire(new e.k("data",Object.assign(Object.assign({},Lt),{sourceDataType:"metadata"}))),this.fire(new e.k("data",Object.assign(Object.assign({},Lt),{sourceDataType:"content"})))}catch(xt){if(this._pendingLoads--,this._removed)return void this.fire(new e.k("dataabort",{dataType:"source"}));this.fire(new e.j(xt))}})}loaded(){return this._pendingLoads===0}loadTile(L){return e._(this,void 0,void 0,function*(){let at=L.actor?"RT":"LT";L.actor=this.actor;let xt={type:this.type,uid:L.uid,tileID:L.tileID,zoom:L.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};L.abortController=new AbortController;let kt=yield this.actor.sendAsync({type:at,data:xt},L.abortController);delete L.abortController,L.unloadVectorData(),L.aborted||L.loadVectorData(kt,this.map.painter,at==="RT")})}abortTile(L){return e._(this,void 0,void 0,function*(){L.abortController&&(L.abortController.abort(),delete L.abortController),L.aborted=!0})}unloadTile(L){return e._(this,void 0,void 0,function*(){L.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:L.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return e.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Nt=e.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class te extends e.E{constructor(L,at,xt,kt){super(),this.id=L,this.dispatcher=xt,this.coordinates=at.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(kt),this.options=at}load(L){return e._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new e.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let at=yield l.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,at&&at.data&&(this.image=at.data,L&&(this.coordinates=L),this._finishLoading())}catch(at){this._request=null,this._loaded=!0,this.fire(new e.j(at))}})}loaded(){return this._loaded}updateImage(L){return L.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=L.url,this.load(L.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(L){this.map=L,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(L){this.coordinates=L;let at=L.map(e.Z.fromLngLat);this.tileID=(function(kt){let Lt=1/0,le=1/0,xe=-1/0,Pe=-1/0;for(let Br of kt)Lt=Math.min(Lt,Br.x),le=Math.min(le,Br.y),xe=Math.max(xe,Br.x),Pe=Math.max(Pe,Br.y);let $e=Math.max(xe-Lt,Pe-le),hr=Math.max(0,Math.floor(-Math.log($e)/Math.LN2)),pr=Math.pow(2,hr);return new e.a1(hr,Math.floor((Lt+xe)/2*pr),Math.floor((le+Pe)/2*pr))})(at),this.minzoom=this.maxzoom=this.tileID.z;let xt=at.map(kt=>this.tileID.getTilePoint(kt)._round());return this._boundsArray=new e.$,this._boundsArray.emplaceBack(xt[0].x,xt[0].y,0,0),this._boundsArray.emplaceBack(xt[1].x,xt[1].y,e.X,0),this._boundsArray.emplaceBack(xt[3].x,xt[3].y,0,e.X),this._boundsArray.emplaceBack(xt[2].x,xt[2].y,e.X,e.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new e.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let L=this.map.painter.context,at=L.gl;this.boundsBuffer||(this.boundsBuffer=L.createVertexBuffer(this._boundsArray,Nt.members)),this.boundsSegments||(this.boundsSegments=e.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new h(L,this.image,at.RGBA),this.texture.bind(at.LINEAR,at.CLAMP_TO_EDGE));let xt=!1;for(let kt in this.tiles){let Lt=this.tiles[kt];Lt.state!=="loaded"&&(Lt.state="loaded",Lt.texture=this.texture,xt=!0)}xt&&this.fire(new e.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(L){return e._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(L.tileID.canonical)?(this.tiles[String(L.tileID.wrap)]=L,L.buckets={}):L.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Jt extends te{constructor(L,at,xt,kt){super(L,at,xt,kt),this.roundZoom=!0,this.type="video",this.options=at}load(){return e._(this,void 0,void 0,function*(){this._loaded=!1;let L=this.options;this.urls=[];for(let at of L.urls)this.urls.push(this.map._requestManager.transformRequest(at,"Source").url);try{let at=yield e.a3(this.urls);if(this._loaded=!0,!at)return;this.video=at,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(at){this.fire(new e.j(at))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(L){if(this.video){let at=this.video.seekable;Lat.end(0)?this.fire(new e.j(new e.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${at.start(0)} and ${at.end(0)}-second mark.`))):this.video.currentTime=L}}getVideo(){return this.video}onAdd(L){this.map||(this.map=L,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let L=this.map.painter.context,at=L.gl;this.boundsBuffer||(this.boundsBuffer=L.createVertexBuffer(this._boundsArray,Nt.members)),this.boundsSegments||(this.boundsSegments=e.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(at.LINEAR,at.CLAMP_TO_EDGE),at.texSubImage2D(at.TEXTURE_2D,0,0,0,at.RGBA,at.UNSIGNED_BYTE,this.video)):(this.texture=new h(L,this.video,at.RGBA),this.texture.bind(at.LINEAR,at.CLAMP_TO_EDGE));let xt=!1;for(let kt in this.tiles){let Lt=this.tiles[kt];Lt.state!=="loaded"&&(Lt.state="loaded",Lt.texture=this.texture,xt=!0)}xt&&this.fire(new e.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class ee extends te{constructor(L,at,xt,kt){super(L,at,xt,kt),at.coordinates?Array.isArray(at.coordinates)&&at.coordinates.length===4&&!at.coordinates.some(Lt=>!Array.isArray(Lt)||Lt.length!==2||Lt.some(le=>typeof le!="number"))||this.fire(new e.j(new e.a2(`sources.${L}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.j(new e.a2(`sources.${L}`,null,'missing required property "coordinates"'))),at.animate&&typeof at.animate!="boolean"&&this.fire(new e.j(new e.a2(`sources.${L}`,null,'optional "animate" property must be a boolean value'))),at.canvas?typeof at.canvas=="string"||at.canvas instanceof HTMLCanvasElement||this.fire(new e.j(new e.a2(`sources.${L}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.j(new e.a2(`sources.${L}`,null,'missing required property "canvas"'))),this.options=at,this.animate=at.animate===void 0||at.animate}load(){return e._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(L){this.map=L,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let L=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,L=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,L=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let at=this.map.painter.context,xt=at.gl;this.boundsBuffer||(this.boundsBuffer=at.createVertexBuffer(this._boundsArray,Nt.members)),this.boundsSegments||(this.boundsSegments=e.a0.simpleSegment(0,0,4,2)),this.texture?(L||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new h(at,this.canvas,xt.RGBA,{premultiply:!0});let kt=!1;for(let Lt in this.tiles){let le=this.tiles[Lt];le.state!=="loaded"&&(le.state="loaded",le.texture=this.texture,kt=!0)}kt&&this.fire(new e.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let L of[this.canvas.width,this.canvas.height])if(isNaN(L)||L<=0)return!0;return!1}}let Zt={},mt=Pt=>{switch(Pt){case"geojson":return It;case"image":return te;case"raster":return wt;case"raster-dem":return Ct;case"vector":return Tt;case"video":return Jt;case"canvas":return ee}return Zt[Pt]},bt="RTLPluginLoaded";class vt extends e.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Q()}_syncState(L){return this.status=L,this.dispatcher.broadcast("SRPS",{pluginStatus:L,pluginURL:this.url}).catch(at=>{throw this.status="error",at})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(L){return e._(this,arguments,void 0,function*(at,xt=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=o.resolveURL(at),!this.url)throw new Error(`requested url ${at} is invalid`);if(this.status==="unavailable"){if(!xt)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return e._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new e.k(bt))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Ut=null;function re(){return Ut||(Ut=new vt),Ut}class Kt{constructor(L,at){this.timeAdded=0,this.fadeEndTime=0,this.tileID=L,this.uid=e.a4(),this.uses=0,this.tileSize=at,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(L){let at=L+this.timeAdded;atLt.getLayer($e)).filter(Boolean);if(Pe.length!==0){xe.layers=Pe,xe.stateDependentLayerIds&&(xe.stateDependentLayers=xe.stateDependentLayerIds.map($e=>Pe.filter(hr=>hr.id===$e)[0]));for(let $e of Pe)le[$e.id]=xe}}return le})(L.buckets,at.style),this.hasSymbolBuckets=!1;for(let kt in this.buckets){let Lt=this.buckets[kt];if(Lt instanceof e.a6){if(this.hasSymbolBuckets=!0,!xt)break;Lt.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let kt in this.buckets){let Lt=this.buckets[kt];if(Lt instanceof e.a6&&Lt.hasRTLText){this.hasRTLText=!0,re().lazyLoad();break}}this.queryPadding=0;for(let kt in this.buckets){let Lt=this.buckets[kt];this.queryPadding=Math.max(this.queryPadding,at.style.getLayer(kt).queryRadius(Lt))}L.imageAtlas&&(this.imageAtlas=L.imageAtlas),L.glyphAtlasImage&&(this.glyphAtlasImage=L.glyphAtlasImage)}else this.collisionBoxArray=new e.a5}unloadVectorData(){for(let L in this.buckets)this.buckets[L].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(L){return this.buckets[L.id]}upload(L){for(let xt in this.buckets){let kt=this.buckets[xt];kt.uploadPending()&&kt.upload(L)}let at=L.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new h(L,this.imageAtlas.image,at.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new h(L,this.glyphAtlasImage,at.ALPHA),this.glyphAtlasImage=null)}prepare(L){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(L,this.imageAtlasTexture)}queryRenderedFeatures(L,at,xt,kt,Lt,le,xe,Pe,$e,hr){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:kt,cameraQueryGeometry:Lt,scale:le,tileSize:this.tileSize,pixelPosMatrix:hr,transform:Pe,params:xe,queryPadding:this.queryPadding*$e},L,at,xt):{}}querySourceFeatures(L,at){let xt=this.latestFeatureIndex;if(!xt||!xt.rawTileData)return;let kt=xt.loadVTLayers(),Lt=at&&at.sourceLayer?at.sourceLayer:"",le=kt._geojsonTileLayer||kt[Lt];if(!le)return;let xe=e.a7(at&&at.filter),{z:Pe,x:$e,y:hr}=this.tileID.canonical,pr={z:Pe,x:$e,y:hr};for(let Br=0;Brxt)kt=!1;else if(at)if(this.expirationTime{this.remove(L,Lt)},xt)),this.data[kt].push(Lt),this.order.push(kt),this.order.length>this.max){let le=this._getAndRemoveByKey(this.order[0]);le&&this.onRemove(le)}return this}has(L){return L.wrapped().key in this.data}getAndRemove(L){return this.has(L)?this._getAndRemoveByKey(L.wrapped().key):null}_getAndRemoveByKey(L){let at=this.data[L].shift();return at.timeout&&clearTimeout(at.timeout),this.data[L].length===0&&delete this.data[L],this.order.splice(this.order.indexOf(L),1),at.value}getByKey(L){let at=this.data[L];return at?at[0].value:null}get(L){return this.has(L)?this.data[L.wrapped().key][0].value:null}remove(L,at){if(!this.has(L))return this;let xt=L.wrapped().key,kt=at===void 0?0:this.data[xt].indexOf(at),Lt=this.data[xt][kt];return this.data[xt].splice(kt,1),Lt.timeout&&clearTimeout(Lt.timeout),this.data[xt].length===0&&delete this.data[xt],this.onRemove(Lt.value),this.order.splice(this.order.indexOf(xt),1),this}setMaxSize(L){for(this.max=L;this.order.length>this.max;){let at=this._getAndRemoveByKey(this.order[0]);at&&this.onRemove(at)}return this}filter(L){let at=[];for(let xt in this.data)for(let kt of this.data[xt])L(kt.value)||at.push(kt);for(let xt of at)this.remove(xt.value.tileID,xt)}}class Me{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(L,at,xt){let kt=String(at);if(this.stateChanges[L]=this.stateChanges[L]||{},this.stateChanges[L][kt]=this.stateChanges[L][kt]||{},e.e(this.stateChanges[L][kt],xt),this.deletedStates[L]===null){this.deletedStates[L]={};for(let Lt in this.state[L])Lt!==kt&&(this.deletedStates[L][Lt]=null)}else if(this.deletedStates[L]&&this.deletedStates[L][kt]===null){this.deletedStates[L][kt]={};for(let Lt in this.state[L][kt])xt[Lt]||(this.deletedStates[L][kt][Lt]=null)}else for(let Lt in xt)this.deletedStates[L]&&this.deletedStates[L][kt]&&this.deletedStates[L][kt][Lt]===null&&delete this.deletedStates[L][kt][Lt]}removeFeatureState(L,at,xt){if(this.deletedStates[L]===null)return;let kt=String(at);if(this.deletedStates[L]=this.deletedStates[L]||{},xt&&at!==void 0)this.deletedStates[L][kt]!==null&&(this.deletedStates[L][kt]=this.deletedStates[L][kt]||{},this.deletedStates[L][kt][xt]=null);else if(at!==void 0)if(this.stateChanges[L]&&this.stateChanges[L][kt])for(xt in this.deletedStates[L][kt]={},this.stateChanges[L][kt])this.deletedStates[L][kt][xt]=null;else this.deletedStates[L][kt]=null;else this.deletedStates[L]=null}getState(L,at){let xt=String(at),kt=e.e({},(this.state[L]||{})[xt],(this.stateChanges[L]||{})[xt]);if(this.deletedStates[L]===null)return{};if(this.deletedStates[L]){let Lt=this.deletedStates[L][at];if(Lt===null)return{};for(let le in Lt)delete kt[le]}return kt}initializeTileState(L,at){L.setFeatureState(this.state,at)}coalesceChanges(L,at){let xt={};for(let kt in this.stateChanges){this.state[kt]=this.state[kt]||{};let Lt={};for(let le in this.stateChanges[kt])this.state[kt][le]||(this.state[kt][le]={}),e.e(this.state[kt][le],this.stateChanges[kt][le]),Lt[le]=this.state[kt][le];xt[kt]=Lt}for(let kt in this.deletedStates){this.state[kt]=this.state[kt]||{};let Lt={};if(this.deletedStates[kt]===null)for(let le in this.state[kt])Lt[le]={},this.state[kt][le]={};else for(let le in this.deletedStates[kt]){if(this.deletedStates[kt][le]===null)this.state[kt][le]={};else for(let xe of Object.keys(this.deletedStates[kt][le]))delete this.state[kt][le][xe];Lt[le]=this.state[kt][le]}xt[kt]=xt[kt]||{},e.e(xt[kt],Lt)}if(this.stateChanges={},this.deletedStates={},Object.keys(xt).length!==0)for(let kt in L)L[kt].setFeatureState(xt,at)}}class Ce extends e.E{constructor(L,at,xt){super(),this.id=L,this.dispatcher=xt,this.on("data",kt=>this._dataHandler(kt)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((kt,Lt,le,xe)=>{let Pe=new(mt(Lt.type))(kt,Lt,le,xe);if(Pe.id!==kt)throw new Error(`Expected Source id to be ${kt} instead of ${Pe.id}`);return Pe})(L,at,xt,this),this._tiles={},this._cache=new ue(0,kt=>this._unloadTile(kt)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Me,this._didEmitContent=!1,this._updated=!1}onAdd(L){this.map=L,this._maxTileCacheSize=L?L._maxTileCacheSize:null,this._maxTileCacheZoomLevels=L?L._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(L)}onRemove(L){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(L)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let L in this._tiles){let at=this._tiles[L];if(at.state!=="loaded"&&at.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let L=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,L&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(L,at,xt){return e._(this,void 0,void 0,function*(){try{yield this._source.loadTile(L),this._tileLoaded(L,at,xt)}catch(kt){L.state="errored",kt.status!==404?this._source.fire(new e.j(kt,{tile:L})):this.update(this.transform,this.terrain)}})}_unloadTile(L){this._source.unloadTile&&this._source.unloadTile(L)}_abortTile(L){this._source.abortTile&&this._source.abortTile(L),this._source.fire(new e.k("dataabort",{tile:L,coord:L.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(L){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let at in this._tiles){let xt=this._tiles[at];xt.upload(L),xt.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(L=>L.tileID).sort(We).map(L=>L.key)}getRenderableIds(L){let at=[];for(let xt in this._tiles)this._isIdRenderable(xt,L)&&at.push(this._tiles[xt]);return L?at.sort((xt,kt)=>{let Lt=xt.tileID,le=kt.tileID,xe=new e.P(Lt.canonical.x,Lt.canonical.y)._rotate(this.transform.angle),Pe=new e.P(le.canonical.x,le.canonical.y)._rotate(this.transform.angle);return Lt.overscaledZ-le.overscaledZ||Pe.y-xe.y||Pe.x-xe.x}).map(xt=>xt.tileID.key):at.map(xt=>xt.tileID).sort(We).map(xt=>xt.key)}hasRenderableParent(L){let at=this.findLoadedParent(L,0);return!!at&&this._isIdRenderable(at.tileID.key)}_isIdRenderable(L,at){return this._tiles[L]&&this._tiles[L].hasData()&&!this._coveredTiles[L]&&(at||!this._tiles[L].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let L in this._tiles)this._tiles[L].state!=="errored"&&this._reloadTile(L,"reloading")}}_reloadTile(L,at){return e._(this,void 0,void 0,function*(){let xt=this._tiles[L];xt&&(xt.state!=="loading"&&(xt.state=at),yield this._loadTile(xt,L,at))})}_tileLoaded(L,at,xt){L.timeAdded=o.now(),xt==="expired"&&(L.refreshedUponExpiration=!0),this._setTileReloadTimer(at,L),this.getSource().type==="raster-dem"&&L.dem&&this._backfillDEM(L),this._state.initializeTileState(L,this.map?this.map.painter:null),L.aborted||this._source.fire(new e.k("data",{dataType:"source",tile:L,coord:L.tileID}))}_backfillDEM(L){let at=this.getRenderableIds();for(let kt=0;kt1||(Math.abs(le)>1&&(Math.abs(le+Pe)===1?le+=Pe:Math.abs(le-Pe)===1&&(le-=Pe)),Lt.dem&&kt.dem&&(kt.dem.backfillBorder(Lt.dem,le,xe),kt.neighboringTiles&&kt.neighboringTiles[$e]&&(kt.neighboringTiles[$e].backfilled=!0)))}}getTile(L){return this.getTileByID(L.key)}getTileByID(L){return this._tiles[L]}_retainLoadedChildren(L,at,xt,kt){for(let Lt in this._tiles){let le=this._tiles[Lt];if(kt[Lt]||!le.hasData()||le.tileID.overscaledZ<=at||le.tileID.overscaledZ>xt)continue;let xe=le.tileID;for(;le&&le.tileID.overscaledZ>at+1;){let $e=le.tileID.scaledTo(le.tileID.overscaledZ-1);le=this._tiles[$e.key],le&&le.hasData()&&(xe=$e)}let Pe=xe;for(;Pe.overscaledZ>at;)if(Pe=Pe.scaledTo(Pe.overscaledZ-1),L[Pe.key]){kt[xe.key]=xe;break}}}findLoadedParent(L,at){if(L.key in this._loadedParentTiles){let xt=this._loadedParentTiles[L.key];return xt&&xt.tileID.overscaledZ>=at?xt:null}for(let xt=L.overscaledZ-1;xt>=at;xt--){let kt=L.scaledTo(xt),Lt=this._getLoadedTile(kt);if(Lt)return Lt}}findLoadedSibling(L){return this._getLoadedTile(L)}_getLoadedTile(L){let at=this._tiles[L.key];return at&&at.hasData()?at:this._cache.getByKey(L.wrapped().key)}updateCacheSize(L){let at=Math.ceil(L.width/this._source.tileSize)+1,xt=Math.ceil(L.height/this._source.tileSize)+1,kt=Math.floor(at*xt*(this._maxTileCacheZoomLevels===null?e.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),Lt=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,kt):kt;this._cache.setMaxSize(Lt)}handleWrapJump(L){let at=Math.round((L-(this._prevLng===void 0?L:this._prevLng))/360);if(this._prevLng=L,at){let xt={};for(let kt in this._tiles){let Lt=this._tiles[kt];Lt.tileID=Lt.tileID.unwrapTo(Lt.tileID.wrap+at),xt[Lt.tileID.key]=Lt}this._tiles=xt;for(let kt in this._timers)clearTimeout(this._timers[kt]),delete this._timers[kt];for(let kt in this._tiles)this._setTileReloadTimer(kt,this._tiles[kt])}}_updateCoveredAndRetainedTiles(L,at,xt,kt,Lt,le){let xe={},Pe={},$e=Object.keys(L),hr=o.now();for(let pr of $e){let Br=L[pr],Jr=this._tiles[pr];if(!Jr||Jr.fadeEndTime!==0&&Jr.fadeEndTime<=hr)continue;let Rt=this.findLoadedParent(Br,at),Gt=this.findLoadedSibling(Br),ae=Rt||Gt||null;ae&&(this._addTile(ae.tileID),xe[ae.tileID.key]=ae.tileID),Pe[pr]=Br}this._retainLoadedChildren(Pe,kt,xt,L);for(let pr in xe)L[pr]||(this._coveredTiles[pr]=!0,L[pr]=xe[pr]);if(le){let pr={},Br={};for(let Jr of Lt)this._tiles[Jr.key].hasData()?pr[Jr.key]=Jr:Br[Jr.key]=Jr;for(let Jr in Br){let Rt=Br[Jr].children(this._source.maxzoom);this._tiles[Rt[0].key]&&this._tiles[Rt[1].key]&&this._tiles[Rt[2].key]&&this._tiles[Rt[3].key]&&(pr[Rt[0].key]=L[Rt[0].key]=Rt[0],pr[Rt[1].key]=L[Rt[1].key]=Rt[1],pr[Rt[2].key]=L[Rt[2].key]=Rt[2],pr[Rt[3].key]=L[Rt[3].key]=Rt[3],delete Br[Jr])}for(let Jr in Br){let Rt=Br[Jr],Gt=this.findLoadedParent(Rt,this._source.minzoom),ae=this.findLoadedSibling(Rt),ce=Gt||ae||null;if(ce){pr[ce.tileID.key]=L[ce.tileID.key]=ce.tileID;for(let Te in pr)pr[Te].isChildOf(ce.tileID)&&delete pr[Te]}}for(let Jr in this._tiles)pr[Jr]||(this._coveredTiles[Jr]=!0)}}update(L,at){if(!this._sourceLoaded||this._paused)return;let xt;this.transform=L,this.terrain=at,this.updateCacheSize(L),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?xt=L.getVisibleUnwrappedCoordinates(this._source.tileID).map(hr=>new e.S(hr.canonical.z,hr.wrap,hr.canonical.z,hr.canonical.x,hr.canonical.y)):(xt=L.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:at}),this._source.hasTile&&(xt=xt.filter(hr=>this._source.hasTile(hr)))):xt=[];let kt=L.coveringZoomLevel(this._source),Lt=Math.max(kt-Ce.maxOverzooming,this._source.minzoom),le=Math.max(kt+Ce.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let hr={};for(let pr of xt)if(pr.canonical.z>this._source.minzoom){let Br=pr.scaledTo(pr.canonical.z-1);hr[Br.key]=Br;let Jr=pr.scaledTo(Math.max(this._source.minzoom,Math.min(pr.canonical.z,5)));hr[Jr.key]=Jr}xt=xt.concat(Object.values(hr))}let xe=xt.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,xe&&this.fire(new e.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let Pe=this._updateRetainedTiles(xt,kt);qe(this._source.type)&&this._updateCoveredAndRetainedTiles(Pe,Lt,le,kt,xt,at);for(let hr in Pe)this._tiles[hr].clearFadeHold();let $e=e.ab(this._tiles,Pe);for(let hr of $e){let pr=this._tiles[hr];pr.hasSymbolBuckets&&!pr.holdingForFade()?pr.setHoldDuration(this.map._fadeDuration):pr.hasSymbolBuckets&&!pr.symbolFadeFinished()||this._removeTile(hr)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let L in this._tiles)this._tiles[L].holdingForFade()&&this._removeTile(L)}_updateRetainedTiles(L,at){var xt;let kt={},Lt={},le=Math.max(at-Ce.maxOverzooming,this._source.minzoom),xe=Math.max(at+Ce.maxUnderzooming,this._source.minzoom),Pe={};for(let $e of L){let hr=this._addTile($e);kt[$e.key]=$e,hr.hasData()||atthis._source.maxzoom){let Br=$e.children(this._source.maxzoom)[0],Jr=this.getTile(Br);if(Jr&&Jr.hasData()){kt[Br.key]=Br;continue}}else{let Br=$e.children(this._source.maxzoom);if(kt[Br[0].key]&&kt[Br[1].key]&&kt[Br[2].key]&&kt[Br[3].key])continue}let pr=hr.wasRequested();for(let Br=$e.overscaledZ-1;Br>=le;--Br){let Jr=$e.scaledTo(Br);if(Lt[Jr.key])break;if(Lt[Jr.key]=!0,hr=this.getTile(Jr),!hr&&pr&&(hr=this._addTile(Jr)),hr){let Rt=hr.hasData();if((Rt||!(!((xt=this.map)===null||xt===void 0)&&xt.cancelPendingTileRequestsWhileZooming)||pr)&&(kt[Jr.key]=Jr),pr=hr.wasRequested(),Rt)break}}}return kt}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let L in this._tiles){let at=[],xt,kt=this._tiles[L].tileID;for(;kt.overscaledZ>0;){if(kt.key in this._loadedParentTiles){xt=this._loadedParentTiles[kt.key];break}at.push(kt.key);let Lt=kt.scaledTo(kt.overscaledZ-1);if(xt=this._getLoadedTile(Lt),xt)break;kt=Lt}for(let Lt of at)this._loadedParentTiles[Lt]=xt}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let L in this._tiles){let at=this._tiles[L].tileID,xt=this._getLoadedTile(at);this._loadedSiblingTiles[at.key]=xt}}_addTile(L){let at=this._tiles[L.key];if(at)return at;at=this._cache.getAndRemove(L),at&&(this._setTileReloadTimer(L.key,at),at.tileID=L,this._state.initializeTileState(at,this.map?this.map.painter:null),this._cacheTimers[L.key]&&(clearTimeout(this._cacheTimers[L.key]),delete this._cacheTimers[L.key],this._setTileReloadTimer(L.key,at)));let xt=at;return at||(at=new Kt(L,this._source.tileSize*L.overscaleFactor()),this._loadTile(at,L.key,at.state)),at.uses++,this._tiles[L.key]=at,xt||this._source.fire(new e.k("dataloading",{tile:at,coord:at.tileID,dataType:"source"})),at}_setTileReloadTimer(L,at){L in this._timers&&(clearTimeout(this._timers[L]),delete this._timers[L]);let xt=at.getExpiryTimeout();xt&&(this._timers[L]=setTimeout(()=>{this._reloadTile(L,"expired"),delete this._timers[L]},xt))}_removeTile(L){let at=this._tiles[L];at&&(at.uses--,delete this._tiles[L],this._timers[L]&&(clearTimeout(this._timers[L]),delete this._timers[L]),at.uses>0||(at.hasData()&&at.state!=="reloading"?this._cache.add(at.tileID,at,at.getExpiryTimeout()):(at.aborted=!0,this._abortTile(at),this._unloadTile(at))))}_dataHandler(L){let at=L.sourceDataType;L.dataType==="source"&&at==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&L.dataType==="source"&&at==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let L in this._tiles)this._removeTile(L);this._cache.reset()}tilesIn(L,at,xt){let kt=[],Lt=this.transform;if(!Lt)return kt;let le=xt?Lt.getCameraQueryGeometry(L):L,xe=L.map(Rt=>Lt.pointCoordinate(Rt,this.terrain)),Pe=le.map(Rt=>Lt.pointCoordinate(Rt,this.terrain)),$e=this.getIds(),hr=1/0,pr=1/0,Br=-1/0,Jr=-1/0;for(let Rt of Pe)hr=Math.min(hr,Rt.x),pr=Math.min(pr,Rt.y),Br=Math.max(Br,Rt.x),Jr=Math.max(Jr,Rt.y);for(let Rt=0;Rt<$e.length;Rt++){let Gt=this._tiles[$e[Rt]];if(Gt.holdingForFade())continue;let ae=Gt.tileID,ce=Math.pow(2,Lt.zoom-Gt.tileID.overscaledZ),Te=at*Gt.queryPadding*e.X/Gt.tileSize/ce,ye=[ae.getTilePoint(new e.Z(hr,pr)),ae.getTilePoint(new e.Z(Br,Jr))];if(ye[0].x-Te=0&&ye[1].y+Te>=0){let ze=xe.map(fr=>ae.getTilePoint(fr)),rr=Pe.map(fr=>ae.getTilePoint(fr));kt.push({tile:Gt,tileID:ae,queryGeometry:ze,cameraQueryGeometry:rr,scale:ce})}}return kt}getVisibleCoordinates(L){let at=this.getRenderableIds(L).map(xt=>this._tiles[xt].tileID);for(let xt of at)xt.posMatrix=this.transform.calculatePosMatrix(xt.toUnwrapped());return at}hasTransition(){if(this._source.hasTransition())return!0;if(qe(this._source.type)){let L=o.now();for(let at in this._tiles)if(this._tiles[at].fadeEndTime>=L)return!0}return!1}setFeatureState(L,at,xt){this._state.updateState(L=L||"_geojsonTileLayer",at,xt)}removeFeatureState(L,at,xt){this._state.removeFeatureState(L=L||"_geojsonTileLayer",at,xt)}getFeatureState(L,at){return this._state.getState(L=L||"_geojsonTileLayer",at)}setDependencies(L,at,xt){let kt=this._tiles[L];kt&&kt.setDependencies(at,xt)}reloadTilesForDependencies(L,at){for(let xt in this._tiles)this._tiles[xt].hasDependency(L,at)&&this._reloadTile(xt,"reloading");this._cache.filter(xt=>!xt.hasDependency(L,at))}}function We(Pt,L){let at=Math.abs(2*Pt.wrap)-+(Pt.wrap<0),xt=Math.abs(2*L.wrap)-+(L.wrap<0);return Pt.overscaledZ-L.overscaledZ||xt-at||L.canonical.y-Pt.canonical.y||L.canonical.x-Pt.canonical.x}function qe(Pt){return Pt==="raster"||Pt==="image"||Pt==="video"}Ce.maxOverzooming=10,Ce.maxUnderzooming=3;class vr{constructor(L,at){this.reset(L,at)}reset(L,at){this.points=L||[],this._distances=[0];for(let xt=1;xt0?(kt-le)/xe:0;return this.points[Lt].mult(1-Pe).add(this.points[at].mult(Pe))}}function _r(Pt,L){let at=!0;return Pt==="always"||Pt!=="never"&&L!=="never"||(at=!1),at}class er{constructor(L,at,xt){let kt=this.boxCells=[],Lt=this.circleCells=[];this.xCellCount=Math.ceil(L/xt),this.yCellCount=Math.ceil(at/xt);for(let le=0;lethis.width||kt<0||at>this.height)return[];let Pe=[];if(L<=0&&at<=0&&this.width<=xt&&this.height<=kt){if(Lt)return[{key:null,x1:L,y1:at,x2:xt,y2:kt}];for(let $e=0;$e0}hitTestCircle(L,at,xt,kt,Lt){let le=L-xt,xe=L+xt,Pe=at-xt,$e=at+xt;if(xe<0||le>this.width||$e<0||Pe>this.height)return!1;let hr=[];return this._forEachCell(le,Pe,xe,$e,this._queryCellCircle,hr,{hitTest:!0,overlapMode:kt,circle:{x:L,y:at,radius:xt},seenUids:{box:{},circle:{}}},Lt),hr.length>0}_queryCell(L,at,xt,kt,Lt,le,xe,Pe){let{seenUids:$e,hitTest:hr,overlapMode:pr}=xe,Br=this.boxCells[Lt];if(Br!==null){let Rt=this.bboxes;for(let Gt of Br)if(!$e.box[Gt]){$e.box[Gt]=!0;let ae=4*Gt,ce=this.boxKeys[Gt];if(L<=Rt[ae+2]&&at<=Rt[ae+3]&&xt>=Rt[ae+0]&&kt>=Rt[ae+1]&&(!Pe||Pe(ce))&&(!hr||!_r(pr,ce.overlapMode))&&(le.push({key:ce,x1:Rt[ae],y1:Rt[ae+1],x2:Rt[ae+2],y2:Rt[ae+3]}),hr))return!0}}let Jr=this.circleCells[Lt];if(Jr!==null){let Rt=this.circles;for(let Gt of Jr)if(!$e.circle[Gt]){$e.circle[Gt]=!0;let ae=3*Gt,ce=this.circleKeys[Gt];if(this._circleAndRectCollide(Rt[ae],Rt[ae+1],Rt[ae+2],L,at,xt,kt)&&(!Pe||Pe(ce))&&(!hr||!_r(pr,ce.overlapMode))){let Te=Rt[ae],ye=Rt[ae+1],ze=Rt[ae+2];if(le.push({key:ce,x1:Te-ze,y1:ye-ze,x2:Te+ze,y2:ye+ze}),hr)return!0}}}return!1}_queryCellCircle(L,at,xt,kt,Lt,le,xe,Pe){let{circle:$e,seenUids:hr,overlapMode:pr}=xe,Br=this.boxCells[Lt];if(Br!==null){let Rt=this.bboxes;for(let Gt of Br)if(!hr.box[Gt]){hr.box[Gt]=!0;let ae=4*Gt,ce=this.boxKeys[Gt];if(this._circleAndRectCollide($e.x,$e.y,$e.radius,Rt[ae+0],Rt[ae+1],Rt[ae+2],Rt[ae+3])&&(!Pe||Pe(ce))&&!_r(pr,ce.overlapMode))return le.push(!0),!0}}let Jr=this.circleCells[Lt];if(Jr!==null){let Rt=this.circles;for(let Gt of Jr)if(!hr.circle[Gt]){hr.circle[Gt]=!0;let ae=3*Gt,ce=this.circleKeys[Gt];if(this._circlesCollide(Rt[ae],Rt[ae+1],Rt[ae+2],$e.x,$e.y,$e.radius)&&(!Pe||Pe(ce))&&!_r(pr,ce.overlapMode))return le.push(!0),!0}}}_forEachCell(L,at,xt,kt,Lt,le,xe,Pe){let $e=this._convertToXCellCoord(L),hr=this._convertToYCellCoord(at),pr=this._convertToXCellCoord(xt),Br=this._convertToYCellCoord(kt);for(let Jr=$e;Jr<=pr;Jr++)for(let Rt=hr;Rt<=Br;Rt++)if(Lt.call(this,L,at,xt,kt,this.xCellCount*Rt+Jr,le,xe,Pe))return}_convertToXCellCoord(L){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(L*this.xScale)))}_convertToYCellCoord(L){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(L*this.yScale)))}_circlesCollide(L,at,xt,kt,Lt,le){let xe=kt-L,Pe=Lt-at,$e=xt+le;return $e*$e>xe*xe+Pe*Pe}_circleAndRectCollide(L,at,xt,kt,Lt,le,xe){let Pe=(le-kt)/2,$e=Math.abs(L-(kt+Pe));if($e>Pe+xt)return!1;let hr=(xe-Lt)/2,pr=Math.abs(at-(Lt+hr));if(pr>hr+xt)return!1;if($e<=Pe||pr<=hr)return!0;let Br=$e-Pe,Jr=pr-hr;return Br*Br+Jr*Jr<=xt*xt}}function Mr(Pt,L,at,xt,kt){let Lt=e.H();return L?(e.K(Lt,Lt,[1/kt,1/kt,1]),at||e.ad(Lt,Lt,xt.angle)):e.L(Lt,xt.labelPlaneMatrix,Pt),Lt}function Ir(Pt,L,at,xt,kt){if(L){let Lt=e.ae(Pt);return e.K(Lt,Lt,[kt,kt,1]),at||e.ad(Lt,Lt,-xt.angle),Lt}return xt.glCoordMatrix}function de(Pt,L,at,xt){let kt;xt?(kt=[Pt,L,xt(Pt,L),1],e.af(kt,kt,at)):(kt=[Pt,L,0,1],Ye(kt,kt,at));let Lt=kt[3];return{point:new e.P(kt[0]/Lt,kt[1]/Lt),signedDistanceFromCamera:Lt,isOccluded:!1}}function Dt(Pt,L){return .5+Pt/L*.5}function qt(Pt,L){return Pt.x>=-L[0]&&Pt.x<=L[0]&&Pt.y>=-L[1]&&Pt.y<=L[1]}function _t(Pt,L,at,xt,kt,Lt,le,xe,Pe,$e,hr,pr,Br,Jr,Rt){let Gt=xt?Pt.textSizeData:Pt.iconSizeData,ae=e.ag(Gt,at.transform.zoom),ce=[256/at.width*2+1,256/at.height*2+1],Te=xt?Pt.text.dynamicLayoutVertexArray:Pt.icon.dynamicLayoutVertexArray;Te.clear();let ye=Pt.lineVertexArray,ze=xt?Pt.text.placedSymbolArray:Pt.icon.placedSymbolArray,rr=at.transform.width/at.transform.height,fr=!1;for(let gr=0;grMath.abs(at.x-L.x)*xt?{useVertical:!0}:(Pt===e.ah.vertical?L.yat.x)?{needsFlipping:!0}:null}function St(Pt,L,at,xt,kt,Lt,le,xe,Pe,$e,hr){let pr=at/24,Br=L.lineOffsetX*pr,Jr=L.lineOffsetY*pr,Rt;if(L.numGlyphs>1){let Gt=L.glyphStartIndex+L.numGlyphs,ae=L.lineStartIndex,ce=L.lineStartIndex+L.lineLength,Te=lt(pr,xe,Br,Jr,xt,L,hr,Pt);if(!Te)return{notEnoughRoom:!0};let ye=de(Te.first.point.x,Te.first.point.y,le,Pt.getElevation).point,ze=de(Te.last.point.x,Te.last.point.y,le,Pt.getElevation).point;if(kt&&!xt){let rr=yt(L.writingMode,ye,ze,$e);if(rr)return rr}Rt=[Te.first];for(let rr=L.glyphStartIndex+1;rr0?ye.point:(function(fr,gr,Lr,Hr,nn,cn){return Ht(fr,gr,Lr,1,nn,cn)})(Pt.tileAnchorPoint,Te,ae,0,Lt,Pt),rr=yt(L.writingMode,ae,ze,$e);if(rr)return rr}let Gt=Ue(pr*xe.getoffsetX(L.glyphStartIndex),Br,Jr,xt,L.segment,L.lineStartIndex,L.lineStartIndex+L.lineLength,Pt,hr);if(!Gt||Pt.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};Rt=[Gt]}for(let Gt of Rt)e.aj(Pe,Gt.point,Gt.angle);return{}}function Ht(Pt,L,at,xt,kt,Lt){let le=Pt.add(Pt.sub(L)._unit()),xe=kt!==void 0?de(le.x,le.y,kt,Lt.getElevation).point:se(le.x,le.y,Lt).point,Pe=at.sub(xe);return at.add(Pe._mult(xt/Pe.mag()))}function Yt(Pt,L,at){let xt=L.projectionCache;if(xt.projections[Pt])return xt.projections[Pt];let kt=new e.P(L.lineVertexArray.getx(Pt),L.lineVertexArray.gety(Pt)),Lt=se(kt.x,kt.y,L);if(Lt.signedDistanceFromCamera>0)return xt.projections[Pt]=Lt.point,xt.anyProjectionOccluded=xt.anyProjectionOccluded||Lt.isOccluded,Lt.point;let le=Pt-at.direction;return(function(xe,Pe,$e,hr,pr){return Ht(xe,Pe,$e,hr,void 0,pr)})(at.distanceFromAnchor===0?L.tileAnchorPoint:new e.P(L.lineVertexArray.getx(le),L.lineVertexArray.gety(le)),kt,at.previousVertex,at.absOffsetX-at.distanceFromAnchor+1,L)}function se(Pt,L,at){let xt=Pt+at.translation[0],kt=L+at.translation[1],Lt;return!at.pitchWithMap&&at.projection.useSpecialProjectionForSymbols?(Lt=at.projection.projectTileCoordinates(xt,kt,at.unwrappedTileID,at.getElevation),Lt.point.x=(.5*Lt.point.x+.5)*at.width,Lt.point.y=(.5*-Lt.point.y+.5)*at.height):(Lt=de(xt,kt,at.labelPlaneMatrix,at.getElevation),Lt.isOccluded=!1),Lt}function ke(Pt,L,at){return Pt._unit()._perp()._mult(L*at)}function Ee(Pt,L,at,xt,kt,Lt,le,xe,Pe){if(xe.projectionCache.offsets[Pt])return xe.projectionCache.offsets[Pt];let $e=at.add(L);if(Pt+Pe.direction=kt)return xe.projectionCache.offsets[Pt]=$e,$e;let hr=Yt(Pt+Pe.direction,xe,Pe),pr=ke(hr.sub(at),le,Pe.direction),Br=at.add(pr),Jr=hr.add(pr);return xe.projectionCache.offsets[Pt]=e.ak(Lt,$e,Br,Jr)||$e,xe.projectionCache.offsets[Pt]}function Ue(Pt,L,at,xt,kt,Lt,le,xe,Pe){let $e=xt?Pt-L:Pt+L,hr=$e>0?1:-1,pr=0;xt&&(hr*=-1,pr=Math.PI),hr<0&&(pr+=Math.PI);let Br,Jr=hr>0?Lt+kt:Lt+kt+1;xe.projectionCache.cachedAnchorPoint?Br=xe.projectionCache.cachedAnchorPoint:(Br=se(xe.tileAnchorPoint.x,xe.tileAnchorPoint.y,xe).point,xe.projectionCache.cachedAnchorPoint=Br);let Rt,Gt,ae=Br,ce=Br,Te=0,ye=0,ze=Math.abs($e),rr=[],fr;for(;Te+ye<=ze;){if(Jr+=hr,Jr=le)return null;Te+=ye,ce=ae,Gt=Rt;let Hr={absOffsetX:ze,direction:hr,distanceFromAnchor:Te,previousVertex:ce};if(ae=Yt(Jr,xe,Hr),at===0)rr.push(ce),fr=ae.sub(ce);else{let nn,cn=ae.sub(ce);nn=cn.mag()===0?ke(Yt(Jr+hr,xe,Hr).sub(ae),at,hr):ke(cn,at,hr),Gt||(Gt=ce.add(nn)),Rt=Ee(Jr,nn,ae,Lt,le,Gt,at,xe,Hr),rr.push(Gt),fr=Rt.sub(Gt)}ye=fr.mag()}let gr=fr._mult((ze-Te)/ye)._add(Gt||ce),Lr=pr+Math.atan2(ae.y-ce.y,ae.x-ce.x);return rr.push(gr),{point:gr,angle:Pe?Lr:0,path:rr}}let ir=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ar(Pt,L){for(let at=0;at=1;mi--)La.push(_a.path[mi]);for(let mi=1;miYi.signedDistanceFromCamera<=0)?[]:mi.map(Yi=>Yi.point)}let Ai=[];if(La.length>0){let mi=La[0].clone(),Yi=La[0].clone();for(let Go=1;Go=cn.x&&Yi.x<=Mn.x&&mi.y>=cn.y&&Yi.y<=Mn.y?[La]:Yi.xMn.x||Yi.yMn.y?[]:e.al([La],cn.x,cn.y,Mn.x,Mn.y)}for(let mi of Ai){Jn.reset(mi,.25*nn);let Yi=0;Yi=Jn.length<=.5*nn?1:Math.ceil(Jn.paddedLength/ai)+1;for(let Go=0;Gode(kt.x,kt.y,xt,at.getElevation))}queryRenderedSymbols(L){if(L.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let at=[],xt=1/0,kt=1/0,Lt=-1/0,le=-1/0;for(let hr of L){let pr=new e.P(hr.x+Er,hr.y+Er);xt=Math.min(xt,pr.x),kt=Math.min(kt,pr.y),Lt=Math.max(Lt,pr.x),le=Math.max(le,pr.y),at.push(pr)}let xe=this.grid.query(xt,kt,Lt,le).concat(this.ignoredGrid.query(xt,kt,Lt,le)),Pe={},$e={};for(let hr of xe){let pr=hr.key;if(Pe[pr.bucketInstanceId]===void 0&&(Pe[pr.bucketInstanceId]={}),Pe[pr.bucketInstanceId][pr.featureIndex])continue;let Br=[new e.P(hr.x1,hr.y1),new e.P(hr.x2,hr.y1),new e.P(hr.x2,hr.y2),new e.P(hr.x1,hr.y2)];e.am(at,Br)&&(Pe[pr.bucketInstanceId][pr.featureIndex]=!0,$e[pr.bucketInstanceId]===void 0&&($e[pr.bucketInstanceId]=[]),$e[pr.bucketInstanceId].push(pr.featureIndex))}return $e}insertCollisionBox(L,at,xt,kt,Lt,le){(xt?this.ignoredGrid:this.grid).insert({bucketInstanceId:kt,featureIndex:Lt,collisionGroupID:le,overlapMode:at},L[0],L[1],L[2],L[3])}insertCollisionCircles(L,at,xt,kt,Lt,le){let xe=xt?this.ignoredGrid:this.grid,Pe={bucketInstanceId:kt,featureIndex:Lt,collisionGroupID:le,overlapMode:at};for(let $e=0;$e=this.screenRightBoundary||ktthis.screenBottomBoundary}isInsideGrid(L,at,xt,kt){return xt>=0&&L=0&&atthis.projectAndGetPerspectiveRatio(xt,nn.x,nn.y,kt,$e));Lr=Hr.some(nn=>!nn.isOccluded),gr=Hr.map(nn=>nn.point)}else Lr=!0;return{box:e.ao(gr),allPointsOccluded:!Lr}}}function dn(Pt,L,at){return L*(e.X/(Pt.tileSize*Math.pow(2,at-Pt.tileID.overscaledZ)))}class bn{constructor(L,at,xt,kt){this.opacity=L?Math.max(0,Math.min(1,L.opacity+(L.placed?at:-at))):kt&&xt?1:0,this.placed=xt}isHidden(){return this.opacity===0&&!this.placed}}class Zn{constructor(L,at,xt,kt,Lt){this.text=new bn(L?L.text:null,at,xt,Lt),this.icon=new bn(L?L.icon:null,at,kt,Lt)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class En{constructor(L,at,xt){this.text=L,this.icon=at,this.skipFade=xt}}class gn{constructor(){this.invProjMatrix=e.H(),this.viewportMatrix=e.H(),this.circles=[]}}class da{constructor(L,at,xt,kt,Lt){this.bucketInstanceId=L,this.featureIndex=at,this.sourceLayerIndex=xt,this.bucketIndex=kt,this.tileID=Lt}}class ra{constructor(L){this.crossSourceCollisions=L,this.maxGroupID=0,this.collisionGroups={}}get(L){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[L]){let at=++this.maxGroupID;this.collisionGroups[L]={ID:at,predicate:xt=>xt.collisionGroupID===at}}return this.collisionGroups[L]}}function Se(Pt,L,at,xt,kt){let{horizontalAlign:Lt,verticalAlign:le}=e.au(Pt);return new e.P(-(Lt-.5)*L+xt[0]*kt,-(le-.5)*at+xt[1]*kt)}class Re{constructor(L,at,xt,kt,Lt,le){this.transform=L.clone(),this.terrain=xt,this.collisionIndex=new pn(this.transform,at),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=kt,this.retainedQueryData={},this.collisionGroups=new ra(Lt),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=le,le&&(le.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(L){let at=this.terrain;return at?(xt,kt)=>at.getElevation(L,xt,kt):null}getBucketParts(L,at,xt,kt){let Lt=xt.getBucket(at),le=xt.latestFeatureIndex;if(!Lt||!le||at.id!==Lt.layerIds[0])return;let xe=xt.collisionBoxArray,Pe=Lt.layers[0].layout,$e=Lt.layers[0].paint,hr=Math.pow(2,this.transform.zoom-xt.tileID.overscaledZ),pr=xt.tileSize/e.X,Br=xt.tileID.toUnwrapped(),Jr=this.transform.calculatePosMatrix(Br),Rt=Pe.get("text-pitch-alignment")==="map",Gt=Pe.get("text-rotation-alignment")==="map",ae=dn(xt,1,this.transform.zoom),ce=this.collisionIndex.mapProjection.translatePosition(this.transform,xt,$e.get("text-translate"),$e.get("text-translate-anchor")),Te=this.collisionIndex.mapProjection.translatePosition(this.transform,xt,$e.get("icon-translate"),$e.get("icon-translate-anchor")),ye=Mr(Jr,Rt,Gt,this.transform,ae),ze=null;if(Rt){let fr=Ir(Jr,Rt,Gt,this.transform,ae);ze=e.L([],this.transform.labelPlaneMatrix,fr)}this.retainedQueryData[Lt.bucketInstanceId]=new da(Lt.bucketInstanceId,le,Lt.sourceLayerIndex,Lt.index,xt.tileID);let rr={bucket:Lt,layout:Pe,translationText:ce,translationIcon:Te,posMatrix:Jr,unwrappedTileID:Br,textLabelPlaneMatrix:ye,labelToScreenMatrix:ze,scale:hr,textPixelRatio:pr,holdingForFade:xt.holdingForFade(),collisionBoxArray:xe,partiallyEvaluatedTextSize:e.ag(Lt.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(Lt.sourceID)};if(kt)for(let fr of Lt.sortKeyRanges){let{sortKey:gr,symbolInstanceStart:Lr,symbolInstanceEnd:Hr}=fr;L.push({sortKey:gr,symbolInstanceStart:Lr,symbolInstanceEnd:Hr,parameters:rr})}else L.push({symbolInstanceStart:0,symbolInstanceEnd:Lt.symbolInstances.length,parameters:rr})}attemptAnchorPlacement(L,at,xt,kt,Lt,le,xe,Pe,$e,hr,pr,Br,Jr,Rt,Gt,ae,ce,Te,ye){let ze=e.aq[L.textAnchor],rr=[L.textOffset0,L.textOffset1],fr=Se(ze,xt,kt,rr,Lt),gr=this.collisionIndex.placeCollisionBox(at,Br,Pe,$e,hr,xe,le,ae,pr.predicate,ye,fr);if((!Te||this.collisionIndex.placeCollisionBox(Te,Br,Pe,$e,hr,xe,le,ce,pr.predicate,ye,fr).placeable)&&gr.placeable){let Lr;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Jr.crossTileID]&&this.prevPlacement.placements[Jr.crossTileID]&&this.prevPlacement.placements[Jr.crossTileID].text&&(Lr=this.prevPlacement.variableOffsets[Jr.crossTileID].anchor),Jr.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Jr.crossTileID]={textOffset:rr,width:xt,height:kt,anchor:ze,textBoxScale:Lt,prevAnchor:Lr},this.markUsedJustification(Rt,ze,Jr,Gt),Rt.allowVerticalPlacement&&(this.markUsedOrientation(Rt,Gt,Jr),this.placedOrientations[Jr.crossTileID]=Gt),{shift:fr,placedGlyphBoxes:gr}}}placeLayerBucketPart(L,at,xt){let{bucket:kt,layout:Lt,translationText:le,translationIcon:xe,posMatrix:Pe,unwrappedTileID:$e,textLabelPlaneMatrix:hr,labelToScreenMatrix:pr,textPixelRatio:Br,holdingForFade:Jr,collisionBoxArray:Rt,partiallyEvaluatedTextSize:Gt,collisionGroup:ae}=L.parameters,ce=Lt.get("text-optional"),Te=Lt.get("icon-optional"),ye=e.ar(Lt,"text-overlap","text-allow-overlap"),ze=ye==="always",rr=e.ar(Lt,"icon-overlap","icon-allow-overlap"),fr=rr==="always",gr=Lt.get("text-rotation-alignment")==="map",Lr=Lt.get("text-pitch-alignment")==="map",Hr=Lt.get("icon-text-fit")!=="none",nn=Lt.get("symbol-z-order")==="viewport-y",cn=ze&&(fr||!kt.hasIconData()||Te),Mn=fr&&(ze||!kt.hasTextData()||ce);!kt.collisionArrays&&Rt&&kt.deserializeCollisionBoxes(Rt);let Jn=this._getTerrainElevationFunc(this.retainedQueryData[kt.bucketInstanceId].tileID),_a=(xa,La,ai)=>{var Ai,mi;if(at[xa.crossTileID])return;if(Jr)return void(this.placements[xa.crossTileID]=new En(!1,!1,!1));let Yi=!1,Go=!1,Xo=!0,po=null,Qo={box:null,placeable:!1,offscreen:null},Js={placeable:!1},Us=null,To=null,ko=null,hl=0,Sl=0,tu=0;La.textFeatureIndex?hl=La.textFeatureIndex:xa.useRuntimeCollisionCircles&&(hl=xa.featureIndex),La.verticalTextFeatureIndex&&(Sl=La.verticalTextFeatureIndex);let gt=La.textBox;if(gt){let me=or=>{let Cr=e.ah.horizontal;if(kt.allowVerticalPlacement&&!or&&this.prevPlacement){let Sr=this.prevPlacement.placedOrientations[xa.crossTileID];Sr&&(this.placedOrientations[xa.crossTileID]=Sr,Cr=Sr,this.markUsedOrientation(kt,Cr,xa))}return Cr},we=(or,Cr)=>{if(kt.allowVerticalPlacement&&xa.numVerticalGlyphVertices>0&&La.verticalTextBox){for(let Sr of kt.writingModes)if(Sr===e.ah.vertical?(Qo=Cr(),Js=Qo):Qo=or(),Qo&&Qo.placeable)break}else Qo=or()},Ve=xa.textAnchorOffsetStartIndex,je=xa.textAnchorOffsetEndIndex;if(je===Ve){let or=(Cr,Sr)=>{let Wr=this.collisionIndex.placeCollisionBox(Cr,ye,Br,Pe,$e,Lr,gr,le,ae.predicate,Jn);return Wr&&Wr.placeable&&(this.markUsedOrientation(kt,Sr,xa),this.placedOrientations[xa.crossTileID]=Sr),Wr};we(()=>or(gt,e.ah.horizontal),()=>{let Cr=La.verticalTextBox;return kt.allowVerticalPlacement&&xa.numVerticalGlyphVertices>0&&Cr?or(Cr,e.ah.vertical):{box:null,offscreen:null}}),me(Qo&&Qo.placeable)}else{let or=e.aq[(mi=(Ai=this.prevPlacement)===null||Ai===void 0?void 0:Ai.variableOffsets[xa.crossTileID])===null||mi===void 0?void 0:mi.anchor],Cr=(Wr,an,on)=>{let ta=Wr.x2-Wr.x1,hn=Wr.y2-Wr.y1,Bn=xa.textBoxScale,Hn=Hr&&rr==="never"?an:null,Yn=null,na=ye==="never"?1:2,_n="never";or&&na++;for(let Ha=0;HaCr(gt,La.iconBox,e.ah.horizontal),()=>{let Wr=La.verticalTextBox;return kt.allowVerticalPlacement&&(!Qo||!Qo.placeable)&&xa.numVerticalGlyphVertices>0&&Wr?Cr(Wr,La.verticalIconBox,e.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Qo&&(Yi=Qo.placeable,Xo=Qo.offscreen);let Sr=me(Qo&&Qo.placeable);if(!Yi&&this.prevPlacement){let Wr=this.prevPlacement.variableOffsets[xa.crossTileID];Wr&&(this.variableOffsets[xa.crossTileID]=Wr,this.markUsedJustification(kt,Wr.anchor,xa,Sr))}}}if(Us=Qo,Yi=Us&&Us.placeable,Xo=Us&&Us.offscreen,xa.useRuntimeCollisionCircles){let me=kt.text.placedSymbolArray.get(xa.centerJustifiedTextSymbolIndex),we=e.ai(kt.textSizeData,Gt,me),Ve=Lt.get("text-padding");To=this.collisionIndex.placeCollisionCircles(ye,me,kt.lineVertexArray,kt.glyphOffsetArray,we,Pe,$e,hr,pr,xt,Lr,ae.predicate,xa.collisionCircleDiameter,Ve,le,Jn),To.circles.length&&To.collisionDetected&&!xt&&e.w("Collisions detected, but collision boxes are not shown"),Yi=ze||To.circles.length>0&&!To.collisionDetected,Xo=Xo&&To.offscreen}if(La.iconFeatureIndex&&(tu=La.iconFeatureIndex),La.iconBox){let me=we=>this.collisionIndex.placeCollisionBox(we,rr,Br,Pe,$e,Lr,gr,xe,ae.predicate,Jn,Hr&&po?po:void 0);Js&&Js.placeable&&La.verticalIconBox?(ko=me(La.verticalIconBox),Go=ko.placeable):(ko=me(La.iconBox),Go=ko.placeable),Xo=Xo&&ko.offscreen}let Et=ce||xa.numHorizontalGlyphVertices===0&&xa.numVerticalGlyphVertices===0,Xt=Te||xa.numIconVertices===0;Et||Xt?Xt?Et||(Go=Go&&Yi):Yi=Go&&Yi:Go=Yi=Go&&Yi;let fe=Go&&ko.placeable;if(Yi&&Us.placeable&&this.collisionIndex.insertCollisionBox(Us.box,ye,Lt.get("text-ignore-placement"),kt.bucketInstanceId,Js&&Js.placeable&&Sl?Sl:hl,ae.ID),fe&&this.collisionIndex.insertCollisionBox(ko.box,rr,Lt.get("icon-ignore-placement"),kt.bucketInstanceId,tu,ae.ID),To&&Yi&&this.collisionIndex.insertCollisionCircles(To.circles,ye,Lt.get("text-ignore-placement"),kt.bucketInstanceId,hl,ae.ID),xt&&this.storeCollisionData(kt.bucketInstanceId,ai,La,Us,ko,To),xa.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(kt.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[xa.crossTileID]=new En(Yi||cn,Go||Mn,Xo||kt.justReloaded),at[xa.crossTileID]=!0};if(nn){if(L.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let xa=kt.getSortedSymbolIndexes(this.transform.angle);for(let La=xa.length-1;La>=0;--La){let ai=xa[La];_a(kt.symbolInstances.get(ai),kt.collisionArrays[ai],ai)}}else for(let xa=L.symbolInstanceStart;xa=0&&(L.text.placedSymbolArray.get(xe).crossTileID=Lt>=0&&xe!==Lt?0:xt.crossTileID)}markUsedOrientation(L,at,xt){let kt=at===e.ah.horizontal||at===e.ah.horizontalOnly?at:0,Lt=at===e.ah.vertical?at:0,le=[xt.leftJustifiedTextSymbolIndex,xt.centerJustifiedTextSymbolIndex,xt.rightJustifiedTextSymbolIndex];for(let xe of le)L.text.placedSymbolArray.get(xe).placedOrientation=kt;xt.verticalPlacedTextSymbolIndex&&(L.text.placedSymbolArray.get(xt.verticalPlacedTextSymbolIndex).placedOrientation=Lt)}commit(L){this.commitTime=L,this.zoomAtLastRecencyCheck=this.transform.zoom;let at=this.prevPlacement,xt=!1;this.prevZoomAdjustment=at?at.zoomAdjustment(this.transform.zoom):0;let kt=at?at.symbolFadeChange(L):1,Lt=at?at.opacities:{},le=at?at.variableOffsets:{},xe=at?at.placedOrientations:{};for(let Pe in this.placements){let $e=this.placements[Pe],hr=Lt[Pe];hr?(this.opacities[Pe]=new Zn(hr,kt,$e.text,$e.icon),xt=xt||$e.text!==hr.text.placed||$e.icon!==hr.icon.placed):(this.opacities[Pe]=new Zn(null,kt,$e.text,$e.icon,$e.skipFade),xt=xt||$e.text||$e.icon)}for(let Pe in Lt){let $e=Lt[Pe];if(!this.opacities[Pe]){let hr=new Zn($e,kt,!1,!1);hr.isHidden()||(this.opacities[Pe]=hr,xt=xt||$e.text.placed||$e.icon.placed)}}for(let Pe in le)this.variableOffsets[Pe]||!this.opacities[Pe]||this.opacities[Pe].isHidden()||(this.variableOffsets[Pe]=le[Pe]);for(let Pe in xe)this.placedOrientations[Pe]||!this.opacities[Pe]||this.opacities[Pe].isHidden()||(this.placedOrientations[Pe]=xe[Pe]);if(at&&at.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");xt?this.lastPlacementChangeTime=L:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=at?at.lastPlacementChangeTime:L)}updateLayerOpacities(L,at){let xt={};for(let kt of at){let Lt=kt.getBucket(L);Lt&&kt.latestFeatureIndex&&L.id===Lt.layerIds[0]&&this.updateBucketOpacities(Lt,kt.tileID,xt,kt.collisionBoxArray)}}updateBucketOpacities(L,at,xt,kt){L.hasTextData()&&(L.text.opacityVertexArray.clear(),L.text.hasVisibleVertices=!1),L.hasIconData()&&(L.icon.opacityVertexArray.clear(),L.icon.hasVisibleVertices=!1),L.hasIconCollisionBoxData()&&L.iconCollisionBox.collisionVertexArray.clear(),L.hasTextCollisionBoxData()&&L.textCollisionBox.collisionVertexArray.clear();let Lt=L.layers[0],le=Lt.layout,xe=new Zn(null,0,!1,!1,!0),Pe=le.get("text-allow-overlap"),$e=le.get("icon-allow-overlap"),hr=Lt._unevaluatedLayout.hasValue("text-variable-anchor")||Lt._unevaluatedLayout.hasValue("text-variable-anchor-offset"),pr=le.get("text-rotation-alignment")==="map",Br=le.get("text-pitch-alignment")==="map",Jr=le.get("icon-text-fit")!=="none",Rt=new Zn(null,0,Pe&&($e||!L.hasIconData()||le.get("icon-optional")),$e&&(Pe||!L.hasTextData()||le.get("text-optional")),!0);!L.collisionArrays&&kt&&(L.hasIconCollisionBoxData()||L.hasTextCollisionBoxData())&&L.deserializeCollisionBoxes(kt);let Gt=(ce,Te,ye)=>{for(let ze=0;ze0,Lr=this.placedOrientations[Te.crossTileID],Hr=Lr===e.ah.vertical,nn=Lr===e.ah.horizontal||Lr===e.ah.horizontalOnly;if(ye>0||ze>0){let Mn=Kn(fr.text);Gt(L.text,ye,Hr?$n:Mn),Gt(L.text,ze,nn?$n:Mn);let Jn=fr.text.isHidden();[Te.rightJustifiedTextSymbolIndex,Te.centerJustifiedTextSymbolIndex,Te.leftJustifiedTextSymbolIndex].forEach(La=>{La>=0&&(L.text.placedSymbolArray.get(La).hidden=Jn||Hr?1:0)}),Te.verticalPlacedTextSymbolIndex>=0&&(L.text.placedSymbolArray.get(Te.verticalPlacedTextSymbolIndex).hidden=Jn||nn?1:0);let _a=this.variableOffsets[Te.crossTileID];_a&&this.markUsedJustification(L,_a.anchor,Te,Lr);let xa=this.placedOrientations[Te.crossTileID];xa&&(this.markUsedJustification(L,"left",Te,xa),this.markUsedOrientation(L,xa,Te))}if(gr){let Mn=Kn(fr.icon),Jn=!(Jr&&Te.verticalPlacedIconSymbolIndex&&Hr);Te.placedIconSymbolIndex>=0&&(Gt(L.icon,Te.numIconVertices,Jn?Mn:$n),L.icon.placedSymbolArray.get(Te.placedIconSymbolIndex).hidden=fr.icon.isHidden()),Te.verticalPlacedIconSymbolIndex>=0&&(Gt(L.icon,Te.numVerticalIconVertices,Jn?$n:Mn),L.icon.placedSymbolArray.get(Te.verticalPlacedIconSymbolIndex).hidden=fr.icon.isHidden())}let cn=ae&&ae.has(ce)?ae.get(ce):{text:null,icon:null};if(L.hasIconCollisionBoxData()||L.hasTextCollisionBoxData()){let Mn=L.collisionArrays[ce];if(Mn){let Jn=new e.P(0,0);if(Mn.textBox||Mn.verticalTextBox){let _a=!0;if(hr){let xa=this.variableOffsets[rr];xa?(Jn=Se(xa.anchor,xa.width,xa.height,xa.textOffset,xa.textBoxScale),pr&&Jn._rotate(Br?this.transform.angle:-this.transform.angle)):_a=!1}if(Mn.textBox||Mn.verticalTextBox){let xa;Mn.textBox&&(xa=Hr),Mn.verticalTextBox&&(xa=nn),Ze(L.textCollisionBox.collisionVertexArray,fr.text.placed,!_a||xa,cn.text,Jn.x,Jn.y)}}if(Mn.iconBox||Mn.verticalIconBox){let _a=!!(!nn&&Mn.verticalIconBox),xa;Mn.iconBox&&(xa=_a),Mn.verticalIconBox&&(xa=!_a),Ze(L.iconCollisionBox.collisionVertexArray,fr.icon.placed,xa,cn.icon,Jr?Jn.x:0,Jr?Jn.y:0)}}}}if(L.sortFeatures(this.transform.angle),this.retainedQueryData[L.bucketInstanceId]&&(this.retainedQueryData[L.bucketInstanceId].featureSortOrder=L.featureSortOrder),L.hasTextData()&&L.text.opacityVertexBuffer&&L.text.opacityVertexBuffer.updateData(L.text.opacityVertexArray),L.hasIconData()&&L.icon.opacityVertexBuffer&&L.icon.opacityVertexBuffer.updateData(L.icon.opacityVertexArray),L.hasIconCollisionBoxData()&&L.iconCollisionBox.collisionVertexBuffer&&L.iconCollisionBox.collisionVertexBuffer.updateData(L.iconCollisionBox.collisionVertexArray),L.hasTextCollisionBoxData()&&L.textCollisionBox.collisionVertexBuffer&&L.textCollisionBox.collisionVertexBuffer.updateData(L.textCollisionBox.collisionVertexArray),L.text.opacityVertexArray.length!==L.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${L.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${L.text.layoutVertexArray.length}) / 4`);if(L.icon.opacityVertexArray.length!==L.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${L.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${L.icon.layoutVertexArray.length}) / 4`);if(L.bucketInstanceId in this.collisionCircleArrays){let ce=this.collisionCircleArrays[L.bucketInstanceId];L.placementInvProjMatrix=ce.invProjMatrix,L.placementViewportMatrix=ce.viewportMatrix,L.collisionCircleArray=ce.circles,delete this.collisionCircleArrays[L.bucketInstanceId]}}symbolFadeChange(L){return this.fadeDuration===0?1:(L-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(L){return Math.max(0,(this.transform.zoom-L)/1.5)}hasTransitions(L){return this.stale||L-this.lastPlacementChangeTimeL}setStale(){this.stale=!0}}function Ze(Pt,L,at,xt,kt,Lt){xt&&xt.length!==0||(xt=[0,0,0,0]);let le=xt[0]-Er,xe=xt[1]-Er,Pe=xt[2]-Er,$e=xt[3]-Er;Pt.emplaceBack(L?1:0,at?1:0,kt||0,Lt||0,le,xe),Pt.emplaceBack(L?1:0,at?1:0,kt||0,Lt||0,Pe,xe),Pt.emplaceBack(L?1:0,at?1:0,kt||0,Lt||0,Pe,$e),Pt.emplaceBack(L?1:0,at?1:0,kt||0,Lt||0,le,$e)}let tr=Math.pow(2,25),zr=Math.pow(2,24),tn=Math.pow(2,17),Yr=Math.pow(2,16),$r=Math.pow(2,9),In=Math.pow(2,8),Nn=Math.pow(2,1);function Kn(Pt){if(Pt.opacity===0&&!Pt.placed)return 0;if(Pt.opacity===1&&Pt.placed)return 4294967295;let L=Pt.placed?1:0,at=Math.floor(127*Pt.opacity);return at*tr+L*zr+at*tn+L*Yr+at*$r+L*In+at*Nn+L}let $n=0;function ia(){return{isOccluded:(Pt,L,at)=>!1,getPitchedTextCorrection:(Pt,L,at)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(Pt,L,at,xt){throw new Error("Not implemented.")},translatePosition:(Pt,L,at,xt)=>(function(kt,Lt,le,xe,Pe=!1){if(!le[0]&&!le[1])return[0,0];let $e=Pe?xe==="map"?kt.angle:0:xe==="viewport"?-kt.angle:0;if($e){let hr=Math.sin($e),pr=Math.cos($e);le=[le[0]*pr-le[1]*hr,le[0]*hr+le[1]*pr]}return[Pe?le[0]:dn(Lt,le[0],kt.zoom),Pe?le[1]:dn(Lt,le[1],kt.zoom)]})(Pt,L,at,xt),getCircleRadiusCorrection:Pt=>1}}class Cn{constructor(L){this._sortAcrossTiles=L.layout.get("symbol-z-order")!=="viewport-y"&&!L.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(L,at,xt,kt,Lt){let le=this._bucketParts;for(;this._currentTileIndexxe.sortKey-Pe.sortKey));this._currentPartIndex!this._forceFullPlacement&&o.now()-kt>2;for(;this._currentPlacementIndex>=0;){let le=at[L[this._currentPlacementIndex]],xe=this.placement.collisionIndex.transform.zoom;if(le.type==="symbol"&&(!le.minzoom||le.minzoom<=xe)&&(!le.maxzoom||le.maxzoom>xe)){if(this._inProgressLayer||(this._inProgressLayer=new Cn(le)),this._inProgressLayer.continuePlacement(xt[le.source],this.placement,this._showCollisionBoxes,le,Lt))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(L){return this.placement.commit(L),this.placement}}let Ga=512/e.X/2;class ve{constructor(L,at,xt){this.tileID=L,this.bucketInstanceId=xt,this._symbolsByKey={};let kt=new Map;for(let Lt=0;Lt({x:Math.floor(Pe.anchorX*Ga),y:Math.floor(Pe.anchorY*Ga)})),crossTileIDs:le.map(Pe=>Pe.crossTileID)};if(xe.positions.length>128){let Pe=new e.av(xe.positions.length,16,Uint16Array);for(let{x:$e,y:hr}of xe.positions)Pe.add($e,hr);Pe.finish(),delete xe.positions,xe.index=Pe}this._symbolsByKey[Lt]=xe}}getScaledCoordinates(L,at){let{x:xt,y:kt,z:Lt}=this.tileID.canonical,{x:le,y:xe,z:Pe}=at.canonical,$e=Ga/Math.pow(2,Pe-Lt),hr=(xe*e.X+L.anchorY)*$e,pr=kt*e.X*Ga;return{x:Math.floor((le*e.X+L.anchorX)*$e-xt*e.X*Ga),y:Math.floor(hr-pr)}}findMatches(L,at,xt){let kt=this.tileID.canonical.zL)}}class ge{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class dr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(L){let at=Math.round((L-this.lng)/360);if(at!==0)for(let xt in this.indexes){let kt=this.indexes[xt],Lt={};for(let le in kt){let xe=kt[le];xe.tileID=xe.tileID.unwrapTo(xe.tileID.wrap+at),Lt[xe.tileID.key]=xe}this.indexes[xt]=Lt}this.lng=L}addBucket(L,at,xt){if(this.indexes[L.overscaledZ]&&this.indexes[L.overscaledZ][L.key]){if(this.indexes[L.overscaledZ][L.key].bucketInstanceId===at.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(L.overscaledZ,this.indexes[L.overscaledZ][L.key])}for(let Lt=0;LtL.overscaledZ)for(let xe in le){let Pe=le[xe];Pe.tileID.isChildOf(L)&&Pe.findMatches(at.symbolInstances,L,kt)}else{let xe=le[L.scaledTo(Number(Lt)).key];xe&&xe.findMatches(at.symbolInstances,L,kt)}}for(let Lt=0;Lt{at[xt]=!0});for(let xt in this.layerIndexes)at[xt]||delete this.layerIndexes[xt]}}let Tr=(Pt,L)=>e.t(Pt,L&&L.filter(at=>at.identifier!=="source.canvas")),mr=e.aw();class kr extends e.E{constructor(L,at={}){super(),this._rtlPluginLoaded=()=>{for(let xt in this.sourceCaches){let kt=this.sourceCaches[xt].getSource().type;kt!=="vector"&&kt!=="geojson"||this.sourceCaches[xt].reload()}},this.map=L,this.dispatcher=new X(ot(),L._getMapId()),this.dispatcher.registerMessageHandler("GG",(xt,kt)=>this.getGlyphs(xt,kt)),this.dispatcher.registerMessageHandler("GI",(xt,kt)=>this.getImages(xt,kt)),this.imageManager=new _,this.imageManager.setEventedParent(this),this.glyphManager=new B(L._requestManager,at.localIdeographFontFamily),this.lineAtlas=new G(256,512),this.crossTileSymbolIndex=new br,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new e.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",e.ay()),re().on(bt,this._rtlPluginLoaded),this.on("data",xt=>{if(xt.dataType!=="source"||xt.sourceDataType!=="metadata")return;let kt=this.sourceCaches[xt.sourceId];if(!kt)return;let Lt=kt.getSource();if(Lt&&Lt.vectorLayerIds)for(let le in this._layers){let xe=this._layers[le];xe.source===Lt.id&&this._validateLayer(xe)}})}loadURL(L,at={},xt){this.fire(new e.k("dataloading",{dataType:"style"})),at.validate=typeof at.validate!="boolean"||at.validate;let kt=this.map._requestManager.transformRequest(L,"Style");this._loadStyleRequest=new AbortController;let Lt=this._loadStyleRequest;e.h(kt,this._loadStyleRequest).then(le=>{this._loadStyleRequest=null,this._load(le.data,at,xt)}).catch(le=>{this._loadStyleRequest=null,le&&!Lt.signal.aborted&&this.fire(new e.j(le))})}loadJSON(L,at={},xt){this.fire(new e.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,o.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,at.validate=at.validate!==!1,this._load(L,at,xt)}).catch(()=>{})}loadEmpty(){this.fire(new e.k("dataloading",{dataType:"style"})),this._load(mr,{validate:!1})}_load(L,at,xt){var kt;let Lt=at.transformStyle?at.transformStyle(xt,L):L;if(!at.validate||!Tr(this,e.u(Lt))){this._loaded=!0,this.stylesheet=Lt;for(let le in Lt.sources)this.addSource(le,Lt.sources[le],{validate:!1});Lt.sprite?this._loadSprite(Lt.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(Lt.glyphs),this._createLayers(),this.light=new F(this.stylesheet.light),this.sky=new N(this.stylesheet.sky),this.map.setTerrain((kt=this.stylesheet.terrain)!==null&&kt!==void 0?kt:null),this.fire(new e.k("data",{dataType:"style"})),this.fire(new e.k("style.load"))}}_createLayers(){let L=e.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",L),this._order=L.map(at=>at.id),this._layers={},this._serializedLayers=null;for(let at of L){let xt=e.aA(at);xt.setEventedParent(this,{layer:{id:at.id}}),this._layers[at.id]=xt}}_loadSprite(L,at=!1,xt=void 0){let kt;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,(function(Lt,le,xe,Pe){return e._(this,void 0,void 0,function*(){let $e=T(Lt),hr=xe>1?"@2x":"",pr={},Br={};for(let{id:Jr,url:Rt}of $e){let Gt=le.transformRequest(c(Rt,hr,".json"),"SpriteJSON");pr[Jr]=e.h(Gt,Pe);let ae=le.transformRequest(c(Rt,hr,".png"),"SpriteImage");Br[Jr]=l.getImage(ae,Pe)}return yield Promise.all([...Object.values(pr),...Object.values(Br)]),(function(Jr,Rt){return e._(this,void 0,void 0,function*(){let Gt={};for(let ae in Jr){Gt[ae]={};let ce=o.getImageCanvasContext((yield Rt[ae]).data),Te=(yield Jr[ae]).data;for(let ye in Te){let{width:ze,height:rr,x:fr,y:gr,sdf:Lr,pixelRatio:Hr,stretchX:nn,stretchY:cn,content:Mn,textFitWidth:Jn,textFitHeight:_a}=Te[ye];Gt[ae][ye]={data:null,pixelRatio:Hr,sdf:Lr,stretchX:nn,stretchY:cn,content:Mn,textFitWidth:Jn,textFitHeight:_a,spriteData:{width:ze,height:rr,x:fr,y:gr,context:ce}}}}return Gt})})(pr,Br)})})(L,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(Lt=>{if(this._spriteRequest=null,Lt)for(let le in Lt){this._spritesImagesIds[le]=[];let xe=this._spritesImagesIds[le]?this._spritesImagesIds[le].filter(Pe=>!(Pe in Lt)):[];for(let Pe of xe)this.imageManager.removeImage(Pe),this._changedImages[Pe]=!0;for(let Pe in Lt[le]){let $e=le==="default"?Pe:`${le}:${Pe}`;this._spritesImagesIds[le].push($e),$e in this.imageManager.images?this.imageManager.updateImage($e,Lt[le][Pe],!1):this.imageManager.addImage($e,Lt[le][Pe]),at&&(this._changedImages[$e]=!0)}}}).catch(Lt=>{this._spriteRequest=null,kt=Lt,this.fire(new e.j(kt))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),at&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"})),xt&&xt(kt)})}_unloadSprite(){for(let L of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(L),this._changedImages[L]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"}))}_validateLayer(L){let at=this.sourceCaches[L.source];if(!at)return;let xt=L.sourceLayer;if(!xt)return;let kt=at.getSource();(kt.type==="geojson"||kt.vectorLayerIds&&kt.vectorLayerIds.indexOf(xt)===-1)&&this.fire(new e.j(new Error(`Source layer "${xt}" does not exist on source "${kt.id}" as specified by style layer "${L.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let L in this.sourceCaches)if(!this.sourceCaches[L].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(L,at=!1){let xt=this._serializedAllLayers();if(!L||L.length===0)return Object.values(at?e.aB(xt):xt);let kt=[];for(let Lt of L)if(xt[Lt]){let le=at?e.aB(xt[Lt]):xt[Lt];kt.push(le)}return kt}_serializedAllLayers(){let L=this._serializedLayers;if(L)return L;L=this._serializedLayers={};let at=Object.keys(this._layers);for(let xt of at){let kt=this._layers[xt];kt.type!=="custom"&&(L[xt]=kt.serialize())}return L}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(let L in this.sourceCaches)if(this.sourceCaches[L].hasTransition())return!0;for(let L in this._layers)if(this._layers[L].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(L){if(!this._loaded)return;let at=this._changed;if(at){let kt=Object.keys(this._updatedLayers),Lt=Object.keys(this._removedLayers);(kt.length||Lt.length)&&this._updateWorkerLayers(kt,Lt);for(let le in this._updatedSources){let xe=this._updatedSources[le];if(xe==="reload")this._reloadSource(le);else{if(xe!=="clear")throw new Error(`Invalid action ${xe}`);this._clearSource(le)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let le in this._updatedPaintProps)this._layers[le].updateTransitions(L);this.light.updateTransitions(L),this.sky.updateTransitions(L),this._resetUpdates()}let xt={};for(let kt in this.sourceCaches){let Lt=this.sourceCaches[kt];xt[kt]=Lt.used,Lt.used=!1}for(let kt of this._order){let Lt=this._layers[kt];Lt.recalculate(L,this._availableImages),!Lt.isHidden(L.zoom)&&Lt.source&&(this.sourceCaches[Lt.source].used=!0)}for(let kt in xt){let Lt=this.sourceCaches[kt];!!xt[kt]!=!!Lt.used&&Lt.fire(new e.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:kt}))}this.light.recalculate(L),this.sky.recalculate(L),this.z=L.zoom,at&&this.fire(new e.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){let L=Object.keys(this._changedImages);if(L.length){for(let at in this.sourceCaches)this.sourceCaches[at].reloadTilesForDependencies(["icons","patterns"],L);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let L in this.sourceCaches)this.sourceCaches[L].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(L,at){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(L,!1),removedIds:at})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(L,at={}){var xt;this._checkLoaded();let kt=this.serialize();if(L=at.transformStyle?at.transformStyle(kt,L):L,((xt=at.validate)===null||xt===void 0||xt)&&Tr(this,e.u(L)))return!1;(L=e.aB(L)).layers=e.az(L.layers);let Lt=e.aC(kt,L),le=this._getOperationsToPerform(Lt);if(le.unimplemented.length>0)throw new Error(`Unimplemented: ${le.unimplemented.join(", ")}.`);if(le.operations.length===0)return!1;for(let xe of le.operations)xe();return this.stylesheet=L,this._serializedLayers=null,!0}_getOperationsToPerform(L){let at=[],xt=[];for(let kt of L)switch(kt.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":at.push(()=>this.addLayer.apply(this,kt.args));break;case"removeLayer":at.push(()=>this.removeLayer.apply(this,kt.args));break;case"setPaintProperty":at.push(()=>this.setPaintProperty.apply(this,kt.args));break;case"setLayoutProperty":at.push(()=>this.setLayoutProperty.apply(this,kt.args));break;case"setFilter":at.push(()=>this.setFilter.apply(this,kt.args));break;case"addSource":at.push(()=>this.addSource.apply(this,kt.args));break;case"removeSource":at.push(()=>this.removeSource.apply(this,kt.args));break;case"setLayerZoomRange":at.push(()=>this.setLayerZoomRange.apply(this,kt.args));break;case"setLight":at.push(()=>this.setLight.apply(this,kt.args));break;case"setGeoJSONSourceData":at.push(()=>this.setGeoJSONSourceData.apply(this,kt.args));break;case"setGlyphs":at.push(()=>this.setGlyphs.apply(this,kt.args));break;case"setSprite":at.push(()=>this.setSprite.apply(this,kt.args));break;case"setSky":at.push(()=>this.setSky.apply(this,kt.args));break;case"setTerrain":at.push(()=>this.map.setTerrain.apply(this,kt.args));break;case"setTransition":at.push(()=>{});break;default:xt.push(kt.command)}return{operations:at,unimplemented:xt}}addImage(L,at){if(this.getImage(L))return this.fire(new e.j(new Error(`An image named "${L}" already exists.`)));this.imageManager.addImage(L,at),this._afterImageUpdated(L)}updateImage(L,at){this.imageManager.updateImage(L,at)}getImage(L){return this.imageManager.getImage(L)}removeImage(L){if(!this.getImage(L))return this.fire(new e.j(new Error(`An image named "${L}" does not exist.`)));this.imageManager.removeImage(L),this._afterImageUpdated(L)}_afterImageUpdated(L){this._availableImages=this.imageManager.listImages(),this._changedImages[L]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(L,at,xt={}){if(this._checkLoaded(),this.sourceCaches[L]!==void 0)throw new Error(`Source "${L}" already exists.`);if(!at.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(at).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(at.type)>=0&&this._validate(e.u.source,`sources.${L}`,at,null,xt))return;this.map&&this.map._collectResourceTiming&&(at.collectResourceTiming=!0);let kt=this.sourceCaches[L]=new Ce(L,at,this.dispatcher);kt.style=this,kt.setEventedParent(this,()=>({isSourceLoaded:kt.loaded(),source:kt.serialize(),sourceId:L})),kt.onAdd(this.map),this._changed=!0}removeSource(L){if(this._checkLoaded(),this.sourceCaches[L]===void 0)throw new Error("There is no source with this ID");for(let xt in this._layers)if(this._layers[xt].source===L)return this.fire(new e.j(new Error(`Source "${L}" cannot be removed while layer "${xt}" is using it.`)));let at=this.sourceCaches[L];delete this.sourceCaches[L],delete this._updatedSources[L],at.fire(new e.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:L})),at.setEventedParent(null),at.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(L,at){if(this._checkLoaded(),this.sourceCaches[L]===void 0)throw new Error(`There is no source with this ID=${L}`);let xt=this.sourceCaches[L].getSource();if(xt.type!=="geojson")throw new Error(`geojsonSource.type is ${xt.type}, which is !== 'geojson`);xt.setData(at),this._changed=!0}getSource(L){return this.sourceCaches[L]&&this.sourceCaches[L].getSource()}addLayer(L,at,xt={}){this._checkLoaded();let kt=L.id;if(this.getLayer(kt))return void this.fire(new e.j(new Error(`Layer "${kt}" already exists on this map.`)));let Lt;if(L.type==="custom"){if(Tr(this,e.aD(L)))return;Lt=e.aA(L)}else{if("source"in L&&typeof L.source=="object"&&(this.addSource(kt,L.source),L=e.aB(L),L=e.e(L,{source:kt})),this._validate(e.u.layer,`layers.${kt}`,L,{arrayIndex:-1},xt))return;Lt=e.aA(L),this._validateLayer(Lt),Lt.setEventedParent(this,{layer:{id:kt}})}let le=at?this._order.indexOf(at):this._order.length;if(at&&le===-1)this.fire(new e.j(new Error(`Cannot add layer "${kt}" before non-existing layer "${at}".`)));else{if(this._order.splice(le,0,kt),this._layerOrderChanged=!0,this._layers[kt]=Lt,this._removedLayers[kt]&&Lt.source&&Lt.type!=="custom"){let xe=this._removedLayers[kt];delete this._removedLayers[kt],xe.type!==Lt.type?this._updatedSources[Lt.source]="clear":(this._updatedSources[Lt.source]="reload",this.sourceCaches[Lt.source].pause())}this._updateLayer(Lt),Lt.onAdd&&Lt.onAdd(this.map)}}moveLayer(L,at){if(this._checkLoaded(),this._changed=!0,!this._layers[L])return void this.fire(new e.j(new Error(`The layer '${L}' does not exist in the map's style and cannot be moved.`)));if(L===at)return;let xt=this._order.indexOf(L);this._order.splice(xt,1);let kt=at?this._order.indexOf(at):this._order.length;at&&kt===-1?this.fire(new e.j(new Error(`Cannot move layer "${L}" before non-existing layer "${at}".`))):(this._order.splice(kt,0,L),this._layerOrderChanged=!0)}removeLayer(L){this._checkLoaded();let at=this._layers[L];if(!at)return void this.fire(new e.j(new Error(`Cannot remove non-existing layer "${L}".`)));at.setEventedParent(null);let xt=this._order.indexOf(L);this._order.splice(xt,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[L]=at,delete this._layers[L],this._serializedLayers&&delete this._serializedLayers[L],delete this._updatedLayers[L],delete this._updatedPaintProps[L],at.onRemove&&at.onRemove(this.map)}getLayer(L){return this._layers[L]}getLayersOrder(){return[...this._order]}hasLayer(L){return L in this._layers}setLayerZoomRange(L,at,xt){this._checkLoaded();let kt=this.getLayer(L);kt?kt.minzoom===at&&kt.maxzoom===xt||(at!=null&&(kt.minzoom=at),xt!=null&&(kt.maxzoom=xt),this._updateLayer(kt)):this.fire(new e.j(new Error(`Cannot set the zoom range of non-existing layer "${L}".`)))}setFilter(L,at,xt={}){this._checkLoaded();let kt=this.getLayer(L);if(kt){if(!e.aE(kt.filter,at))return at==null?(kt.filter=void 0,void this._updateLayer(kt)):void(this._validate(e.u.filter,`layers.${kt.id}.filter`,at,null,xt)||(kt.filter=e.aB(at),this._updateLayer(kt)))}else this.fire(new e.j(new Error(`Cannot filter non-existing layer "${L}".`)))}getFilter(L){return e.aB(this.getLayer(L).filter)}setLayoutProperty(L,at,xt,kt={}){this._checkLoaded();let Lt=this.getLayer(L);Lt?e.aE(Lt.getLayoutProperty(at),xt)||(Lt.setLayoutProperty(at,xt,kt),this._updateLayer(Lt)):this.fire(new e.j(new Error(`Cannot style non-existing layer "${L}".`)))}getLayoutProperty(L,at){let xt=this.getLayer(L);if(xt)return xt.getLayoutProperty(at);this.fire(new e.j(new Error(`Cannot get style of non-existing layer "${L}".`)))}setPaintProperty(L,at,xt,kt={}){this._checkLoaded();let Lt=this.getLayer(L);Lt?e.aE(Lt.getPaintProperty(at),xt)||(Lt.setPaintProperty(at,xt,kt)&&this._updateLayer(Lt),this._changed=!0,this._updatedPaintProps[L]=!0,this._serializedLayers=null):this.fire(new e.j(new Error(`Cannot style non-existing layer "${L}".`)))}getPaintProperty(L,at){return this.getLayer(L).getPaintProperty(at)}setFeatureState(L,at){this._checkLoaded();let xt=L.source,kt=L.sourceLayer,Lt=this.sourceCaches[xt];if(Lt===void 0)return void this.fire(new e.j(new Error(`The source '${xt}' does not exist in the map's style.`)));let le=Lt.getSource().type;le==="geojson"&&kt?this.fire(new e.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):le!=="vector"||kt?(L.id===void 0&&this.fire(new e.j(new Error("The feature id parameter must be provided."))),Lt.setFeatureState(kt,L.id,at)):this.fire(new e.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(L,at){this._checkLoaded();let xt=L.source,kt=this.sourceCaches[xt];if(kt===void 0)return void this.fire(new e.j(new Error(`The source '${xt}' does not exist in the map's style.`)));let Lt=kt.getSource().type,le=Lt==="vector"?L.sourceLayer:void 0;Lt!=="vector"||le?at&&typeof L.id!="string"&&typeof L.id!="number"?this.fire(new e.j(new Error("A feature id is required to remove its specific state property."))):kt.removeFeatureState(le,L.id,at):this.fire(new e.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(L){this._checkLoaded();let at=L.source,xt=L.sourceLayer,kt=this.sourceCaches[at];if(kt!==void 0)return kt.getSource().type!=="vector"||xt?(L.id===void 0&&this.fire(new e.j(new Error("The feature id parameter must be provided."))),kt.getFeatureState(xt,L.id)):void this.fire(new e.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new e.j(new Error(`The source '${at}' does not exist in the map's style.`)))}getTransition(){return e.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let L=e.aF(this.sourceCaches,Lt=>Lt.serialize()),at=this._serializeByIds(this._order,!0),xt=this.map.getTerrain()||void 0,kt=this.stylesheet;return e.aG({version:kt.version,name:kt.name,metadata:kt.metadata,light:kt.light,sky:kt.sky,center:kt.center,zoom:kt.zoom,bearing:kt.bearing,pitch:kt.pitch,sprite:kt.sprite,glyphs:kt.glyphs,transition:kt.transition,sources:L,layers:at,terrain:xt},Lt=>Lt!==void 0)}_updateLayer(L){this._updatedLayers[L.id]=!0,L.source&&!this._updatedSources[L.source]&&this.sourceCaches[L.source].getSource().type!=="raster"&&(this._updatedSources[L.source]="reload",this.sourceCaches[L.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(L){let at=le=>this._layers[le].type==="fill-extrusion",xt={},kt=[];for(let le=this._order.length-1;le>=0;le--){let xe=this._order[le];if(at(xe)){xt[xe]=le;for(let Pe of L){let $e=Pe[xe];if($e)for(let hr of $e)kt.push(hr)}}}kt.sort((le,xe)=>xe.intersectionZ-le.intersectionZ);let Lt=[];for(let le=this._order.length-1;le>=0;le--){let xe=this._order[le];if(at(xe))for(let Pe=kt.length-1;Pe>=0;Pe--){let $e=kt[Pe].feature;if(xt[$e.layer.id]{let Lr=ce.featureSortOrder;if(Lr){let Hr=Lr.indexOf(fr.featureIndex);return Lr.indexOf(gr.featureIndex)-Hr}return gr.featureIndex-fr.featureIndex});for(let fr of rr)ze.push(fr)}}for(let ce in Rt)Rt[ce].forEach(Te=>{let ye=Te.feature,ze=$e[xe[ce].source].getFeatureState(ye.layer["source-layer"],ye.id);ye.source=ye.layer.source,ye.layer["source-layer"]&&(ye.sourceLayer=ye.layer["source-layer"]),ye.state=ze});return Rt})(this._layers,le,this.sourceCaches,L,at,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(Lt)}querySourceFeatures(L,at){at&&at.filter&&this._validate(e.u.filter,"querySourceFeatures.filter",at.filter,null,at);let xt=this.sourceCaches[L];return xt?(function(kt,Lt){let le=kt.getRenderableIds().map($e=>kt.getTileByID($e)),xe=[],Pe={};for(let $e=0;$eBr.getTileByID(Jr)).sort((Jr,Rt)=>Rt.tileID.overscaledZ-Jr.tileID.overscaledZ||(Jr.tileID.isLessThan(Rt.tileID)?-1:1))}let pr=this.crossTileSymbolIndex.addLayer(hr,Pe[hr.source],L.center.lng);le=le||pr}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((Lt=Lt||this._layerOrderChanged||xt===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.now(),L.zoom))&&(this.pauseablePlacement=new Fa(L,this.map.terrain,this._order,Lt,at,xt,kt,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,Pe),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(o.now()),xe=!0),le&&this.pauseablePlacement.placement.setStale()),xe||le)for(let $e of this._order){let hr=this._layers[$e];hr.type==="symbol"&&this.placement.updateLayerOpacities(hr,Pe[hr.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.now())}_releaseSymbolFadeTiles(){for(let L in this.sourceCaches)this.sourceCaches[L].releaseSymbolFadeTiles()}getImages(L,at){return e._(this,void 0,void 0,function*(){let xt=yield this.imageManager.getImages(at.icons);this._updateTilesForChangedImages();let kt=this.sourceCaches[at.source];return kt&&kt.setDependencies(at.tileID.key,at.type,at.icons),xt})}getGlyphs(L,at){return e._(this,void 0,void 0,function*(){let xt=yield this.glyphManager.getGlyphs(at.stacks),kt=this.sourceCaches[at.source];return kt&&kt.setDependencies(at.tileID.key,at.type,[""]),xt})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(L,at={}){this._checkLoaded(),L&&this._validate(e.u.glyphs,"glyphs",L,null,at)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=L,this.glyphManager.entries={},this.glyphManager.setURL(L))}addSprite(L,at,xt={},kt){this._checkLoaded();let Lt=[{id:L,url:at}],le=[...T(this.stylesheet.sprite),...Lt];this._validate(e.u.sprite,"sprite",le,null,xt)||(this.stylesheet.sprite=le,this._loadSprite(Lt,!0,kt))}removeSprite(L){this._checkLoaded();let at=T(this.stylesheet.sprite);if(at.find(xt=>xt.id===L)){if(this._spritesImagesIds[L])for(let xt of this._spritesImagesIds[L])this.imageManager.removeImage(xt),this._changedImages[xt]=!0;at.splice(at.findIndex(xt=>xt.id===L),1),this.stylesheet.sprite=at.length>0?at:void 0,delete this._spritesImagesIds[L],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"}))}else this.fire(new e.j(new Error(`Sprite "${L}" doesn't exists on this map.`)))}getSprite(){return T(this.stylesheet.sprite)}setSprite(L,at={},xt){this._checkLoaded(),L&&this._validate(e.u.sprite,"sprite",L,null,at)||(this.stylesheet.sprite=L,L?this._loadSprite(L,!0,xt):(this._unloadSprite(),xt&&xt(null)))}}var Ur=e.Y([{name:"a_pos",type:"Int16",components:2}]);let Or={prelude:pe(`#ifdef GL_ES +precision mediump float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +`,`#ifdef GL_ES +precision highp float; +#else +#if !defined(lowp) +#define lowp +#endif +#if !defined(mediump) +#define mediump +#endif +#if !defined(highp) +#define highp +#endif +#endif +vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 +);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;} +#ifdef TERRAIN3D +uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; +#endif +const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { +#ifdef TERRAIN3D +highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); +#else +return 1.0; +#endif +}float calculate_visibility(vec4 pos) { +#ifdef TERRAIN3D +vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; +#else +return 1.0; +#endif +}float ele(vec2 pos) { +#ifdef TERRAIN3D +vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; +#else +return 0.0; +#endif +}float get_elevation(vec2 pos) { +#ifdef TERRAIN3D +vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; +#else +return 0.0; +#endif +}`),background:pe(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:pe(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:pe(`varying vec3 v_data;varying float v_visibility; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define mediump float radius +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define mediump float radius +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define highp vec4 stroke_color +#pragma mapbox: define mediump float stroke_width +#pragma mapbox: define lowp float stroke_opacity +void main(void) { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize mediump float radius +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize highp vec4 stroke_color +#pragma mapbox: initialize mediump float stroke_width +#pragma mapbox: initialize lowp float stroke_opacity +vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:pe("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:pe(`uniform highp float u_intensity;varying vec2 v_extrude; +#pragma mapbox: define highp float weight +#define GAUSS_COEF 0.3989422804014327 +void main() { +#pragma mapbox: initialize highp float weight +float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude; +#pragma mapbox: define highp float weight +#pragma mapbox: define mediump float radius +const highp float ZERO=1.0/255.0/16.0; +#define GAUSS_COEF 0.3989422804014327 +void main(void) { +#pragma mapbox: initialize highp float weight +#pragma mapbox: initialize mediump float radius +vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:pe(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(0.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:pe("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:pe("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:pe("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:pe(`#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_FragColor=color*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float opacity +gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:pe(`varying vec2 v_pos; +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; +#pragma mapbox: define highp vec4 outline_color +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 outline_color +#pragma mapbox: initialize lowp float opacity +gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:pe(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:pe(`#ifdef GL_ES +precision highp float; +#endif +uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:pe(`varying vec4 v_color;void main() {gl_FragColor=v_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying vec4 v_color; +#pragma mapbox: define highp float base +#pragma mapbox: define highp float height +#pragma mapbox: define highp vec4 color +void main() { +#pragma mapbox: initialize highp float base +#pragma mapbox: initialize highp float height +#pragma mapbox: initialize highp vec4 color +vec3 normal=a_normal_ed.xyz; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#else +float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; +#endif +base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:pe(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to; +#ifdef TERRAIN3D +float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); +#else +float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; +#endif +base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 +? a_pos +: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:pe(`#ifdef GL_ES +precision highp float; +#endif +uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:pe(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; +#define PI 3.141592653589793 +void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:pe(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_width2=vec2(outset,inset);}`),lineGradient:pe(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_width2=vec2(outset,inset);}`),linePattern:pe(`#ifdef GL_ES +precision highp float; +#endif +uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +#pragma mapbox: define lowp vec4 pattern_from +#pragma mapbox: define lowp vec4 pattern_to +#pragma mapbox: define lowp float pixel_ratio_from +#pragma mapbox: define lowp float pixel_ratio_to +void main() { +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +#pragma mapbox: initialize mediump vec4 pattern_from +#pragma mapbox: initialize mediump vec4 pattern_to +#pragma mapbox: initialize lowp float pixel_ratio_from +#pragma mapbox: initialize lowp float pixel_ratio_to +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:pe(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +#pragma mapbox: define mediump float gapwidth +#pragma mapbox: define lowp float offset +#pragma mapbox: define mediump float width +#pragma mapbox: define lowp float floorwidth +void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump float gapwidth +#pragma mapbox: initialize lowp float offset +#pragma mapbox: initialize mediump float width +#pragma mapbox: initialize lowp float floorwidth +float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:pe(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:pe(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:pe(`#define SDF_PX 8.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:pe(`#define SDF_PX 8.0 +#define SDF 1.0 +#define ICON 0.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? +camera_to_anchor_distance/u_camera_to_center_distance : +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:pe("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:pe("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:pe("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:pe("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function pe(Pt,L){let at=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,xt=L.match(/attribute ([\w]+) ([\w]+)/g),kt=Pt.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),Lt=L.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),le=Lt?Lt.concat(kt):kt,xe={};return{fragmentSource:Pt=Pt.replace(at,(Pe,$e,hr,pr,Br)=>(xe[Br]=!0,$e==="define"?` +#ifndef HAS_UNIFORM_u_${Br} +varying ${hr} ${pr} ${Br}; +#else +uniform ${hr} ${pr} u_${Br}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${Br} + ${hr} ${pr} ${Br} = u_${Br}; +#endif +`)),vertexSource:L=L.replace(at,(Pe,$e,hr,pr,Br)=>{let Jr=pr==="float"?"vec2":"vec4",Rt=Br.match(/color/)?"color":Jr;return xe[Br]?$e==="define"?` +#ifndef HAS_UNIFORM_u_${Br} +uniform lowp float u_${Br}_t; +attribute ${hr} ${Jr} a_${Br}; +varying ${hr} ${pr} ${Br}; +#else +uniform ${hr} ${pr} u_${Br}; +#endif +`:Rt==="vec4"?` +#ifndef HAS_UNIFORM_u_${Br} + ${Br} = a_${Br}; +#else + ${hr} ${pr} ${Br} = u_${Br}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${Br} + ${Br} = unpack_mix_${Rt}(a_${Br}, u_${Br}_t); +#else + ${hr} ${pr} ${Br} = u_${Br}; +#endif +`:$e==="define"?` +#ifndef HAS_UNIFORM_u_${Br} +uniform lowp float u_${Br}_t; +attribute ${hr} ${Jr} a_${Br}; +#else +uniform ${hr} ${pr} u_${Br}; +#endif +`:Rt==="vec4"?` +#ifndef HAS_UNIFORM_u_${Br} + ${hr} ${pr} ${Br} = a_${Br}; +#else + ${hr} ${pr} ${Br} = u_${Br}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${Br} + ${hr} ${pr} ${Br} = unpack_mix_${Rt}(a_${Br}, u_${Br}_t); +#else + ${hr} ${pr} ${Br} = u_${Br}; +#endif +`}),staticAttributes:xt,staticUniforms:le}}class Ke{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(L,at,xt,kt,Lt,le,xe,Pe,$e){this.context=L;let hr=this.boundPaintVertexBuffers.length!==kt.length;for(let pr=0;!hr&&pr({u_matrix:Pt,u_texture:0,u_ele_delta:L,u_fog_matrix:at,u_fog_color:xt?xt.properties.get("fog-color"):e.aM.white,u_fog_ground_blend:xt?xt.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:xt?xt.calculateFogBlendOpacity(kt):0,u_horizon_color:xt?xt.properties.get("horizon-color"):e.aM.white,u_horizon_fog_blend:xt?xt.properties.get("horizon-fog-blend"):1});function Gr(Pt){let L=[];for(let at=0;at({u_depth:new e.aH(fr,gr.u_depth),u_terrain:new e.aH(fr,gr.u_terrain),u_terrain_dim:new e.aI(fr,gr.u_terrain_dim),u_terrain_matrix:new e.aJ(fr,gr.u_terrain_matrix),u_terrain_unpack:new e.aK(fr,gr.u_terrain_unpack),u_terrain_exaggeration:new e.aI(fr,gr.u_terrain_exaggeration)}))(L,rr),this.binderUniforms=xt?xt.getUniforms(L,rr):[]}draw(L,at,xt,kt,Lt,le,xe,Pe,$e,hr,pr,Br,Jr,Rt,Gt,ae,ce,Te){let ye=L.gl;if(this.failedToCreate)return;if(L.program.set(this.program),L.setDepthMode(xt),L.setStencilMode(kt),L.setColorMode(Lt),L.setCullFace(le),Pe){L.activeTexture.set(ye.TEXTURE2),ye.bindTexture(ye.TEXTURE_2D,Pe.depthTexture),L.activeTexture.set(ye.TEXTURE3),ye.bindTexture(ye.TEXTURE_2D,Pe.texture);for(let rr in this.terrainUniforms)this.terrainUniforms[rr].set(Pe[rr])}for(let rr in this.fixedUniforms)this.fixedUniforms[rr].set(xe[rr]);Gt&&Gt.setUniforms(L,this.binderUniforms,Jr,{zoom:Rt});let ze=0;switch(at){case ye.LINES:ze=2;break;case ye.TRIANGLES:ze=3;break;case ye.LINE_STRIP:ze=1}for(let rr of Br.get()){let fr=rr.vaos||(rr.vaos={});(fr[$e]||(fr[$e]=new Ke)).bind(L,this,hr,Gt?Gt.getPaintVertexBuffers():[],pr,rr.vertexOffset,ae,ce,Te),ye.drawElements(at,rr.primitiveLength*ze,ye.UNSIGNED_SHORT,rr.primitiveOffset*ze*2)}}}function wn(Pt,L,at){let xt=1/dn(at,1,L.transform.tileZoom),kt=Math.pow(2,at.tileID.overscaledZ),Lt=at.tileSize*Math.pow(2,L.transform.tileZoom)/kt,le=Lt*(at.tileID.canonical.x+at.tileID.wrap*kt),xe=Lt*at.tileID.canonical.y;return{u_image:0,u_texsize:at.imageAtlasTexture.size,u_scale:[xt,Pt.fromScale,Pt.toScale],u_fade:Pt.t,u_pixel_coord_upper:[le>>16,xe>>16],u_pixel_coord_lower:[65535&le,65535&xe]}}let rn=(Pt,L,at,xt)=>{let kt=L.style.light,Lt=kt.properties.get("position"),le=[Lt.x,Lt.y,Lt.z],xe=(function(){var $e=new e.A(9);return e.A!=Float32Array&&($e[1]=0,$e[2]=0,$e[3]=0,$e[5]=0,$e[6]=0,$e[7]=0),$e[0]=1,$e[4]=1,$e[8]=1,$e})();kt.properties.get("anchor")==="viewport"&&(function($e,hr){var pr=Math.sin(hr),Br=Math.cos(hr);$e[0]=Br,$e[1]=pr,$e[2]=0,$e[3]=-pr,$e[4]=Br,$e[5]=0,$e[6]=0,$e[7]=0,$e[8]=1})(xe,-L.transform.angle),(function($e,hr,pr){var Br=hr[0],Jr=hr[1],Rt=hr[2];$e[0]=Br*pr[0]+Jr*pr[3]+Rt*pr[6],$e[1]=Br*pr[1]+Jr*pr[4]+Rt*pr[7],$e[2]=Br*pr[2]+Jr*pr[5]+Rt*pr[8]})(le,le,xe);let Pe=kt.properties.get("color");return{u_matrix:Pt,u_lightpos:le,u_lightintensity:kt.properties.get("intensity"),u_lightcolor:[Pe.r,Pe.g,Pe.b],u_vertical_gradient:+at,u_opacity:xt}},Qr=(Pt,L,at,xt,kt,Lt,le)=>e.e(rn(Pt,L,at,xt),wn(Lt,L,le),{u_height_factor:-Math.pow(2,kt.overscaledZ)/le.tileSize/8}),vn=Pt=>({u_matrix:Pt}),Oa=(Pt,L,at,xt)=>e.e(vn(Pt),wn(at,L,xt)),Qn=(Pt,L)=>({u_matrix:Pt,u_world:L}),Qa=(Pt,L,at,xt,kt)=>e.e(Oa(Pt,L,at,xt),{u_world:kt}),Ja=(Pt,L,at,xt)=>{let kt=Pt.transform,Lt,le;if(xt.paint.get("circle-pitch-alignment")==="map"){let xe=dn(at,1,kt.zoom);Lt=!0,le=[xe,xe]}else Lt=!1,le=kt.pixelsToGLUnits;return{u_camera_to_center_distance:kt.cameraToCenterDistance,u_scale_with_map:+(xt.paint.get("circle-pitch-scale")==="map"),u_matrix:Pt.translatePosMatrix(L.posMatrix,at,xt.paint.get("circle-translate"),xt.paint.get("circle-translate-anchor")),u_pitch_with_map:+Lt,u_device_pixel_ratio:Pt.pixelRatio,u_extrude_scale:le}},wi=(Pt,L,at)=>({u_matrix:Pt,u_inv_matrix:L,u_camera_to_center_distance:at.cameraToCenterDistance,u_viewport_size:[at.width,at.height]}),ci=(Pt,L,at=1)=>({u_matrix:Pt,u_color:L,u_overlay:0,u_overlay_scale:at}),Ti=Pt=>({u_matrix:Pt}),Ra=(Pt,L,at,xt)=>({u_matrix:Pt,u_extrude_scale:dn(L,1,at),u_intensity:xt}),Qi=(Pt,L,at,xt)=>{let kt=e.H();e.aP(kt,0,Pt.width,Pt.height,0,0,1);let Lt=Pt.context.gl;return{u_matrix:kt,u_world:[Lt.drawingBufferWidth,Lt.drawingBufferHeight],u_image:at,u_color_ramp:xt,u_opacity:L.paint.get("heatmap-opacity")}};function Hi(Pt,L){let at=Math.pow(2,L.canonical.z),xt=L.canonical.y;return[new e.Z(0,xt/at).toLngLat().lat,new e.Z(0,(xt+1)/at).toLngLat().lat]}let Ho=(Pt,L,at,xt)=>{let kt=Pt.transform;return{u_matrix:Po(Pt,L,at,xt),u_ratio:1/dn(L,1,kt.zoom),u_device_pixel_ratio:Pt.pixelRatio,u_units_to_pixels:[1/kt.pixelsToGLUnits[0],1/kt.pixelsToGLUnits[1]]}},Ci=(Pt,L,at,xt,kt)=>e.e(Ho(Pt,L,at,kt),{u_image:0,u_image_height:xt}),zo=(Pt,L,at,xt,kt)=>{let Lt=Pt.transform,le=qo(L,Lt);return{u_matrix:Po(Pt,L,at,kt),u_texsize:L.imageAtlasTexture.size,u_ratio:1/dn(L,1,Lt.zoom),u_device_pixel_ratio:Pt.pixelRatio,u_image:0,u_scale:[le,xt.fromScale,xt.toScale],u_fade:xt.t,u_units_to_pixels:[1/Lt.pixelsToGLUnits[0],1/Lt.pixelsToGLUnits[1]]}},qi=(Pt,L,at,xt,kt,Lt)=>{let le=Pt.lineAtlas,xe=qo(L,Pt.transform),Pe=at.layout.get("line-cap")==="round",$e=le.getDash(xt.from,Pe),hr=le.getDash(xt.to,Pe),pr=$e.width*kt.fromScale,Br=hr.width*kt.toScale;return e.e(Ho(Pt,L,at,Lt),{u_patternscale_a:[xe/pr,-$e.height/2],u_patternscale_b:[xe/Br,-hr.height/2],u_sdfgamma:le.width/(256*Math.min(pr,Br)*Pt.pixelRatio)/2,u_image:0,u_tex_y_a:$e.y,u_tex_y_b:hr.y,u_mix:kt.t})};function qo(Pt,L){return 1/dn(Pt,1,L.tileZoom)}function Po(Pt,L,at,xt){return Pt.translatePosMatrix(xt?xt.posMatrix:L.tileID.posMatrix,L,at.paint.get("line-translate"),at.paint.get("line-translate-anchor"))}let hs=(Pt,L,at,xt,kt)=>{return{u_matrix:Pt,u_tl_parent:L,u_scale_parent:at,u_buffer_scale:1,u_fade_t:xt.mix,u_opacity:xt.opacity*kt.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:kt.paint.get("raster-brightness-min"),u_brightness_high:kt.paint.get("raster-brightness-max"),u_saturation_factor:(le=kt.paint.get("raster-saturation"),le>0?1-1/(1.001-le):-le),u_contrast_factor:(Lt=kt.paint.get("raster-contrast"),Lt>0?1/(1-Lt):1+Lt),u_spin_weights:Gi(kt.paint.get("raster-hue-rotate"))};var Lt,le};function Gi(Pt){Pt*=Math.PI/180;let L=Math.sin(Pt),at=Math.cos(Pt);return[(2*at+1)/3,(-Math.sqrt(3)*L-at+1)/3,(Math.sqrt(3)*L-at+1)/3]}let uo=(Pt,L,at,xt,kt,Lt,le,xe,Pe,$e,hr,pr,Br,Jr)=>{let Rt=le.transform;return{u_is_size_zoom_constant:+(Pt==="constant"||Pt==="source"),u_is_size_feature_constant:+(Pt==="constant"||Pt==="camera"),u_size_t:L?L.uSizeT:0,u_size:L?L.uSize:0,u_camera_to_center_distance:Rt.cameraToCenterDistance,u_pitch:Rt.pitch/360*2*Math.PI,u_rotate_symbol:+at,u_aspect_ratio:Rt.width/Rt.height,u_fade_change:le.options.fadeDuration?le.symbolFadeChange:1,u_matrix:xe,u_label_plane_matrix:Pe,u_coord_matrix:$e,u_is_text:+pr,u_pitch_with_map:+xt,u_is_along_line:kt,u_is_variable_anchor:Lt,u_texsize:Br,u_texture:0,u_translation:hr,u_pitched_scale:Jr}},yi=(Pt,L,at,xt,kt,Lt,le,xe,Pe,$e,hr,pr,Br,Jr,Rt)=>{let Gt=le.transform;return e.e(uo(Pt,L,at,xt,kt,Lt,le,xe,Pe,$e,hr,pr,Br,Rt),{u_gamma_scale:xt?Math.cos(Gt._pitch)*Gt.cameraToCenterDistance:1,u_device_pixel_ratio:le.pixelRatio,u_is_halo:1})},ao=(Pt,L,at,xt,kt,Lt,le,xe,Pe,$e,hr,pr,Br,Jr)=>e.e(yi(Pt,L,at,xt,kt,Lt,le,xe,Pe,$e,hr,!0,pr,!0,Jr),{u_texsize_icon:Br,u_texture_icon:1}),ts=(Pt,L,at)=>({u_matrix:Pt,u_opacity:L,u_color:at}),vs=(Pt,L,at,xt,kt,Lt)=>e.e((function(le,xe,Pe,$e){let hr=Pe.imageManager.getPattern(le.from.toString()),pr=Pe.imageManager.getPattern(le.to.toString()),{width:Br,height:Jr}=Pe.imageManager.getPixelSize(),Rt=Math.pow(2,$e.tileID.overscaledZ),Gt=$e.tileSize*Math.pow(2,Pe.transform.tileZoom)/Rt,ae=Gt*($e.tileID.canonical.x+$e.tileID.wrap*Rt),ce=Gt*$e.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:hr.tl,u_pattern_br_a:hr.br,u_pattern_tl_b:pr.tl,u_pattern_br_b:pr.br,u_texsize:[Br,Jr],u_mix:xe.t,u_pattern_size_a:hr.displaySize,u_pattern_size_b:pr.displaySize,u_scale_a:xe.fromScale,u_scale_b:xe.toScale,u_tile_units_to_pixels:1/dn($e,1,Pe.transform.tileZoom),u_pixel_coord_upper:[ae>>16,ce>>16],u_pixel_coord_lower:[65535&ae,65535&ce]}})(xt,Lt,at,kt),{u_matrix:Pt,u_opacity:L}),As={fillExtrusion:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_lightpos:new e.aN(Pt,L.u_lightpos),u_lightintensity:new e.aI(Pt,L.u_lightintensity),u_lightcolor:new e.aN(Pt,L.u_lightcolor),u_vertical_gradient:new e.aI(Pt,L.u_vertical_gradient),u_opacity:new e.aI(Pt,L.u_opacity)}),fillExtrusionPattern:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_lightpos:new e.aN(Pt,L.u_lightpos),u_lightintensity:new e.aI(Pt,L.u_lightintensity),u_lightcolor:new e.aN(Pt,L.u_lightcolor),u_vertical_gradient:new e.aI(Pt,L.u_vertical_gradient),u_height_factor:new e.aI(Pt,L.u_height_factor),u_image:new e.aH(Pt,L.u_image),u_texsize:new e.aO(Pt,L.u_texsize),u_pixel_coord_upper:new e.aO(Pt,L.u_pixel_coord_upper),u_pixel_coord_lower:new e.aO(Pt,L.u_pixel_coord_lower),u_scale:new e.aN(Pt,L.u_scale),u_fade:new e.aI(Pt,L.u_fade),u_opacity:new e.aI(Pt,L.u_opacity)}),fill:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix)}),fillPattern:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_image:new e.aH(Pt,L.u_image),u_texsize:new e.aO(Pt,L.u_texsize),u_pixel_coord_upper:new e.aO(Pt,L.u_pixel_coord_upper),u_pixel_coord_lower:new e.aO(Pt,L.u_pixel_coord_lower),u_scale:new e.aN(Pt,L.u_scale),u_fade:new e.aI(Pt,L.u_fade)}),fillOutline:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_world:new e.aO(Pt,L.u_world)}),fillOutlinePattern:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_world:new e.aO(Pt,L.u_world),u_image:new e.aH(Pt,L.u_image),u_texsize:new e.aO(Pt,L.u_texsize),u_pixel_coord_upper:new e.aO(Pt,L.u_pixel_coord_upper),u_pixel_coord_lower:new e.aO(Pt,L.u_pixel_coord_lower),u_scale:new e.aN(Pt,L.u_scale),u_fade:new e.aI(Pt,L.u_fade)}),circle:(Pt,L)=>({u_camera_to_center_distance:new e.aI(Pt,L.u_camera_to_center_distance),u_scale_with_map:new e.aH(Pt,L.u_scale_with_map),u_pitch_with_map:new e.aH(Pt,L.u_pitch_with_map),u_extrude_scale:new e.aO(Pt,L.u_extrude_scale),u_device_pixel_ratio:new e.aI(Pt,L.u_device_pixel_ratio),u_matrix:new e.aJ(Pt,L.u_matrix)}),collisionBox:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_pixel_extrude_scale:new e.aO(Pt,L.u_pixel_extrude_scale)}),collisionCircle:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_inv_matrix:new e.aJ(Pt,L.u_inv_matrix),u_camera_to_center_distance:new e.aI(Pt,L.u_camera_to_center_distance),u_viewport_size:new e.aO(Pt,L.u_viewport_size)}),debug:(Pt,L)=>({u_color:new e.aL(Pt,L.u_color),u_matrix:new e.aJ(Pt,L.u_matrix),u_overlay:new e.aH(Pt,L.u_overlay),u_overlay_scale:new e.aI(Pt,L.u_overlay_scale)}),clippingMask:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix)}),heatmap:(Pt,L)=>({u_extrude_scale:new e.aI(Pt,L.u_extrude_scale),u_intensity:new e.aI(Pt,L.u_intensity),u_matrix:new e.aJ(Pt,L.u_matrix)}),heatmapTexture:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_world:new e.aO(Pt,L.u_world),u_image:new e.aH(Pt,L.u_image),u_color_ramp:new e.aH(Pt,L.u_color_ramp),u_opacity:new e.aI(Pt,L.u_opacity)}),hillshade:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_image:new e.aH(Pt,L.u_image),u_latrange:new e.aO(Pt,L.u_latrange),u_light:new e.aO(Pt,L.u_light),u_shadow:new e.aL(Pt,L.u_shadow),u_highlight:new e.aL(Pt,L.u_highlight),u_accent:new e.aL(Pt,L.u_accent)}),hillshadePrepare:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_image:new e.aH(Pt,L.u_image),u_dimension:new e.aO(Pt,L.u_dimension),u_zoom:new e.aI(Pt,L.u_zoom),u_unpack:new e.aK(Pt,L.u_unpack)}),line:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_ratio:new e.aI(Pt,L.u_ratio),u_device_pixel_ratio:new e.aI(Pt,L.u_device_pixel_ratio),u_units_to_pixels:new e.aO(Pt,L.u_units_to_pixels)}),lineGradient:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_ratio:new e.aI(Pt,L.u_ratio),u_device_pixel_ratio:new e.aI(Pt,L.u_device_pixel_ratio),u_units_to_pixels:new e.aO(Pt,L.u_units_to_pixels),u_image:new e.aH(Pt,L.u_image),u_image_height:new e.aI(Pt,L.u_image_height)}),linePattern:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_texsize:new e.aO(Pt,L.u_texsize),u_ratio:new e.aI(Pt,L.u_ratio),u_device_pixel_ratio:new e.aI(Pt,L.u_device_pixel_ratio),u_image:new e.aH(Pt,L.u_image),u_units_to_pixels:new e.aO(Pt,L.u_units_to_pixels),u_scale:new e.aN(Pt,L.u_scale),u_fade:new e.aI(Pt,L.u_fade)}),lineSDF:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_ratio:new e.aI(Pt,L.u_ratio),u_device_pixel_ratio:new e.aI(Pt,L.u_device_pixel_ratio),u_units_to_pixels:new e.aO(Pt,L.u_units_to_pixels),u_patternscale_a:new e.aO(Pt,L.u_patternscale_a),u_patternscale_b:new e.aO(Pt,L.u_patternscale_b),u_sdfgamma:new e.aI(Pt,L.u_sdfgamma),u_image:new e.aH(Pt,L.u_image),u_tex_y_a:new e.aI(Pt,L.u_tex_y_a),u_tex_y_b:new e.aI(Pt,L.u_tex_y_b),u_mix:new e.aI(Pt,L.u_mix)}),raster:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_tl_parent:new e.aO(Pt,L.u_tl_parent),u_scale_parent:new e.aI(Pt,L.u_scale_parent),u_buffer_scale:new e.aI(Pt,L.u_buffer_scale),u_fade_t:new e.aI(Pt,L.u_fade_t),u_opacity:new e.aI(Pt,L.u_opacity),u_image0:new e.aH(Pt,L.u_image0),u_image1:new e.aH(Pt,L.u_image1),u_brightness_low:new e.aI(Pt,L.u_brightness_low),u_brightness_high:new e.aI(Pt,L.u_brightness_high),u_saturation_factor:new e.aI(Pt,L.u_saturation_factor),u_contrast_factor:new e.aI(Pt,L.u_contrast_factor),u_spin_weights:new e.aN(Pt,L.u_spin_weights)}),symbolIcon:(Pt,L)=>({u_is_size_zoom_constant:new e.aH(Pt,L.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aH(Pt,L.u_is_size_feature_constant),u_size_t:new e.aI(Pt,L.u_size_t),u_size:new e.aI(Pt,L.u_size),u_camera_to_center_distance:new e.aI(Pt,L.u_camera_to_center_distance),u_pitch:new e.aI(Pt,L.u_pitch),u_rotate_symbol:new e.aH(Pt,L.u_rotate_symbol),u_aspect_ratio:new e.aI(Pt,L.u_aspect_ratio),u_fade_change:new e.aI(Pt,L.u_fade_change),u_matrix:new e.aJ(Pt,L.u_matrix),u_label_plane_matrix:new e.aJ(Pt,L.u_label_plane_matrix),u_coord_matrix:new e.aJ(Pt,L.u_coord_matrix),u_is_text:new e.aH(Pt,L.u_is_text),u_pitch_with_map:new e.aH(Pt,L.u_pitch_with_map),u_is_along_line:new e.aH(Pt,L.u_is_along_line),u_is_variable_anchor:new e.aH(Pt,L.u_is_variable_anchor),u_texsize:new e.aO(Pt,L.u_texsize),u_texture:new e.aH(Pt,L.u_texture),u_translation:new e.aO(Pt,L.u_translation),u_pitched_scale:new e.aI(Pt,L.u_pitched_scale)}),symbolSDF:(Pt,L)=>({u_is_size_zoom_constant:new e.aH(Pt,L.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aH(Pt,L.u_is_size_feature_constant),u_size_t:new e.aI(Pt,L.u_size_t),u_size:new e.aI(Pt,L.u_size),u_camera_to_center_distance:new e.aI(Pt,L.u_camera_to_center_distance),u_pitch:new e.aI(Pt,L.u_pitch),u_rotate_symbol:new e.aH(Pt,L.u_rotate_symbol),u_aspect_ratio:new e.aI(Pt,L.u_aspect_ratio),u_fade_change:new e.aI(Pt,L.u_fade_change),u_matrix:new e.aJ(Pt,L.u_matrix),u_label_plane_matrix:new e.aJ(Pt,L.u_label_plane_matrix),u_coord_matrix:new e.aJ(Pt,L.u_coord_matrix),u_is_text:new e.aH(Pt,L.u_is_text),u_pitch_with_map:new e.aH(Pt,L.u_pitch_with_map),u_is_along_line:new e.aH(Pt,L.u_is_along_line),u_is_variable_anchor:new e.aH(Pt,L.u_is_variable_anchor),u_texsize:new e.aO(Pt,L.u_texsize),u_texture:new e.aH(Pt,L.u_texture),u_gamma_scale:new e.aI(Pt,L.u_gamma_scale),u_device_pixel_ratio:new e.aI(Pt,L.u_device_pixel_ratio),u_is_halo:new e.aH(Pt,L.u_is_halo),u_translation:new e.aO(Pt,L.u_translation),u_pitched_scale:new e.aI(Pt,L.u_pitched_scale)}),symbolTextAndIcon:(Pt,L)=>({u_is_size_zoom_constant:new e.aH(Pt,L.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aH(Pt,L.u_is_size_feature_constant),u_size_t:new e.aI(Pt,L.u_size_t),u_size:new e.aI(Pt,L.u_size),u_camera_to_center_distance:new e.aI(Pt,L.u_camera_to_center_distance),u_pitch:new e.aI(Pt,L.u_pitch),u_rotate_symbol:new e.aH(Pt,L.u_rotate_symbol),u_aspect_ratio:new e.aI(Pt,L.u_aspect_ratio),u_fade_change:new e.aI(Pt,L.u_fade_change),u_matrix:new e.aJ(Pt,L.u_matrix),u_label_plane_matrix:new e.aJ(Pt,L.u_label_plane_matrix),u_coord_matrix:new e.aJ(Pt,L.u_coord_matrix),u_is_text:new e.aH(Pt,L.u_is_text),u_pitch_with_map:new e.aH(Pt,L.u_pitch_with_map),u_is_along_line:new e.aH(Pt,L.u_is_along_line),u_is_variable_anchor:new e.aH(Pt,L.u_is_variable_anchor),u_texsize:new e.aO(Pt,L.u_texsize),u_texsize_icon:new e.aO(Pt,L.u_texsize_icon),u_texture:new e.aH(Pt,L.u_texture),u_texture_icon:new e.aH(Pt,L.u_texture_icon),u_gamma_scale:new e.aI(Pt,L.u_gamma_scale),u_device_pixel_ratio:new e.aI(Pt,L.u_device_pixel_ratio),u_is_halo:new e.aH(Pt,L.u_is_halo),u_translation:new e.aO(Pt,L.u_translation),u_pitched_scale:new e.aI(Pt,L.u_pitched_scale)}),background:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_opacity:new e.aI(Pt,L.u_opacity),u_color:new e.aL(Pt,L.u_color)}),backgroundPattern:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_opacity:new e.aI(Pt,L.u_opacity),u_image:new e.aH(Pt,L.u_image),u_pattern_tl_a:new e.aO(Pt,L.u_pattern_tl_a),u_pattern_br_a:new e.aO(Pt,L.u_pattern_br_a),u_pattern_tl_b:new e.aO(Pt,L.u_pattern_tl_b),u_pattern_br_b:new e.aO(Pt,L.u_pattern_br_b),u_texsize:new e.aO(Pt,L.u_texsize),u_mix:new e.aI(Pt,L.u_mix),u_pattern_size_a:new e.aO(Pt,L.u_pattern_size_a),u_pattern_size_b:new e.aO(Pt,L.u_pattern_size_b),u_scale_a:new e.aI(Pt,L.u_scale_a),u_scale_b:new e.aI(Pt,L.u_scale_b),u_pixel_coord_upper:new e.aO(Pt,L.u_pixel_coord_upper),u_pixel_coord_lower:new e.aO(Pt,L.u_pixel_coord_lower),u_tile_units_to_pixels:new e.aI(Pt,L.u_tile_units_to_pixels)}),terrain:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_texture:new e.aH(Pt,L.u_texture),u_ele_delta:new e.aI(Pt,L.u_ele_delta),u_fog_matrix:new e.aJ(Pt,L.u_fog_matrix),u_fog_color:new e.aL(Pt,L.u_fog_color),u_fog_ground_blend:new e.aI(Pt,L.u_fog_ground_blend),u_fog_ground_blend_opacity:new e.aI(Pt,L.u_fog_ground_blend_opacity),u_horizon_color:new e.aL(Pt,L.u_horizon_color),u_horizon_fog_blend:new e.aI(Pt,L.u_horizon_fog_blend)}),terrainDepth:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_ele_delta:new e.aI(Pt,L.u_ele_delta)}),terrainCoords:(Pt,L)=>({u_matrix:new e.aJ(Pt,L.u_matrix),u_texture:new e.aH(Pt,L.u_texture),u_terrain_coords_id:new e.aI(Pt,L.u_terrain_coords_id),u_ele_delta:new e.aI(Pt,L.u_ele_delta)}),sky:(Pt,L)=>({u_sky_color:new e.aL(Pt,L.u_sky_color),u_horizon_color:new e.aL(Pt,L.u_horizon_color),u_horizon:new e.aI(Pt,L.u_horizon),u_sky_horizon_blend:new e.aI(Pt,L.u_sky_horizon_blend)})};class _o{constructor(L,at,xt){this.context=L;let kt=L.gl;this.buffer=kt.createBuffer(),this.dynamicDraw=!!xt,this.context.unbindVAO(),L.bindElementBuffer.set(this.buffer),kt.bufferData(kt.ELEMENT_ARRAY_BUFFER,at.arrayBuffer,this.dynamicDraw?kt.DYNAMIC_DRAW:kt.STATIC_DRAW),this.dynamicDraw||delete at.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(L){let at=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),at.bufferSubData(at.ELEMENT_ARRAY_BUFFER,0,L.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Da={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class li{constructor(L,at,xt,kt){this.length=at.length,this.attributes=xt,this.itemSize=at.bytesPerElement,this.dynamicDraw=kt,this.context=L;let Lt=L.gl;this.buffer=Lt.createBuffer(),L.bindVertexBuffer.set(this.buffer),Lt.bufferData(Lt.ARRAY_BUFFER,at.arrayBuffer,this.dynamicDraw?Lt.DYNAMIC_DRAW:Lt.STATIC_DRAW),this.dynamicDraw||delete at.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(L){if(L.length!==this.length)throw new Error(`Length of new data is ${L.length}, which doesn't match current length of ${this.length}`);let at=this.context.gl;this.bind(),at.bufferSubData(at.ARRAY_BUFFER,0,L.arrayBuffer)}enableAttributes(L,at){for(let xt=0;xt0){let fr=e.H();e.aQ(fr,ye.placementInvProjMatrix,Pt.transform.glCoordMatrix),e.aQ(fr,fr,ye.placementViewportMatrix),Pe.push({circleArray:rr,circleOffset:hr,transform:Te.posMatrix,invTransform:fr,coord:Te}),$e+=rr.length/4,hr=$e}ze&&xe.draw(Lt,le.LINES,Oo.disabled,os.disabled,Pt.colorModeForRenderPass(),Fi.disabled,{u_matrix:Te.posMatrix,u_pixel_extrude_scale:[1/(pr=Pt.transform).width,1/pr.height]},Pt.style.map.terrain&&Pt.style.map.terrain.getTerrainData(Te),at.id,ze.layoutVertexBuffer,ze.indexBuffer,ze.segments,null,Pt.transform.zoom,null,null,ze.collisionVertexBuffer)}var pr;if(!kt||!Pe.length)return;let Br=Pt.useProgram("collisionCircle"),Jr=new e.aR;Jr.resize(4*$e),Jr._trim();let Rt=0;for(let ce of Pe)for(let Te=0;Te=0&&(ce[ye.associatedIconIndex]={shiftedAnchor:ai,angle:Ai})}else ar(ye.numGlyphs,Gt)}if($e){ae.clear();let Te=Pt.icon.placedSymbolArray;for(let ye=0;yePt.style.map.terrain.getElevation(cn,on,ta):null,an=at.layout.get("text-rotation-alignment")==="map";_t(Jn,cn.posMatrix,Pt,kt,Sl,gt,ce,$e,an,Gt,cn.toUnwrapped(),Rt.width,Rt.height,Et,Wr)}let me=cn.posMatrix,we=kt&&Lr||fe,Ve=Te||we?ml:Sl,je=tu,or=La&&at.paint.get(kt?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Cr;Cr=La?Jn.iconsInText?ao(ai.kind,Yi,ye,ce,Te,we,Pt,me,Ve,je,Et,Xo,Us,nn):yi(ai.kind,Yi,ye,ce,Te,we,Pt,me,Ve,je,Et,kt,Xo,!0,nn):uo(ai.kind,Yi,ye,ce,Te,we,Pt,me,Ve,je,Et,kt,Xo,nn);let Sr={program:mi,buffers:_a,uniformValues:Cr,atlasTexture:po,atlasTextureIcon:To,atlasInterpolation:Qo,atlasInterpolationIcon:Js,isSDF:La,hasHalo:or};if(rr&&Jn.canOverlap){fr=!0;let Wr=_a.segments.get();for(let an of Wr)Hr.push({segments:new e.a0([an]),sortKey:an.sortKey,state:Sr,terrainData:Go})}else Hr.push({segments:_a.segments,sortKey:0,state:Sr,terrainData:Go})}fr&&Hr.sort((cn,Mn)=>cn.sortKey-Mn.sortKey);for(let cn of Hr){let Mn=cn.state;if(Br.activeTexture.set(Jr.TEXTURE0),Mn.atlasTexture.bind(Mn.atlasInterpolation,Jr.CLAMP_TO_EDGE),Mn.atlasTextureIcon&&(Br.activeTexture.set(Jr.TEXTURE1),Mn.atlasTextureIcon&&Mn.atlasTextureIcon.bind(Mn.atlasInterpolationIcon,Jr.CLAMP_TO_EDGE)),Mn.isSDF){let Jn=Mn.uniformValues;Mn.hasHalo&&(Jn.u_is_halo=1,Bc(Mn.buffers,cn.segments,at,Pt,Mn.program,gr,hr,pr,Jn,cn.terrainData)),Jn.u_is_halo=0}Bc(Mn.buffers,cn.segments,at,Pt,Mn.program,gr,hr,pr,Mn.uniformValues,cn.terrainData)}}function Bc(Pt,L,at,xt,kt,Lt,le,xe,Pe,$e){let hr=xt.context;kt.draw(hr,hr.gl.TRIANGLES,Lt,le,xe,Fi.disabled,Pe,$e,at.id,Pt.layoutVertexBuffer,Pt.indexBuffer,L,at.paint,xt.transform.zoom,Pt.programConfigurations.get(at.id),Pt.dynamicLayoutVertexBuffer,Pt.opacityVertexBuffer)}function gc(Pt,L,at,xt){let kt=Pt.context,Lt=kt.gl,le=os.disabled,xe=new qs([Lt.ONE,Lt.ONE],e.aM.transparent,[!0,!0,!0,!0]),Pe=L.getBucket(at);if(!Pe)return;let $e=xt.key,hr=at.heatmapFbos.get($e);hr||(hr=Ic(kt,L.tileSize,L.tileSize),at.heatmapFbos.set($e,hr)),kt.bindFramebuffer.set(hr.framebuffer),kt.viewport.set([0,0,L.tileSize,L.tileSize]),kt.clear({color:e.aM.transparent});let pr=Pe.programConfigurations.get(at.id),Br=Pt.useProgram("heatmap",pr),Jr=Pt.style.map.terrain.getTerrainData(xt);Br.draw(kt,Lt.TRIANGLES,Oo.disabled,le,xe,Fi.disabled,Ra(xt.posMatrix,L,Pt.transform.zoom,at.paint.get("heatmap-intensity")),Jr,at.id,Pe.layoutVertexBuffer,Pe.indexBuffer,Pe.segments,at.paint,Pt.transform.zoom,pr)}function Gu(Pt,L,at){let xt=Pt.context,kt=xt.gl;xt.setColorMode(Pt.colorModeForRenderPass());let Lt=Pc(xt,L),le=at.key,xe=L.heatmapFbos.get(le);xe&&(xt.activeTexture.set(kt.TEXTURE0),kt.bindTexture(kt.TEXTURE_2D,xe.colorAttachment.get()),xt.activeTexture.set(kt.TEXTURE1),Lt.bind(kt.LINEAR,kt.CLAMP_TO_EDGE),Pt.useProgram("heatmapTexture").draw(xt,kt.TRIANGLES,Oo.disabled,os.disabled,Pt.colorModeForRenderPass(),Fi.disabled,Qi(Pt,L,0,1),null,L.id,Pt.rasterBoundsBuffer,Pt.quadTriangleIndexBuffer,Pt.rasterBoundsSegments,L.paint,Pt.transform.zoom),xe.destroy(),L.heatmapFbos.delete(le))}function Ic(Pt,L,at){var xt,kt;let Lt=Pt.gl,le=Lt.createTexture();Lt.bindTexture(Lt.TEXTURE_2D,le),Lt.texParameteri(Lt.TEXTURE_2D,Lt.TEXTURE_WRAP_S,Lt.CLAMP_TO_EDGE),Lt.texParameteri(Lt.TEXTURE_2D,Lt.TEXTURE_WRAP_T,Lt.CLAMP_TO_EDGE),Lt.texParameteri(Lt.TEXTURE_2D,Lt.TEXTURE_MIN_FILTER,Lt.LINEAR),Lt.texParameteri(Lt.TEXTURE_2D,Lt.TEXTURE_MAG_FILTER,Lt.LINEAR);let xe=(xt=Pt.HALF_FLOAT)!==null&&xt!==void 0?xt:Lt.UNSIGNED_BYTE,Pe=(kt=Pt.RGBA16F)!==null&&kt!==void 0?kt:Lt.RGBA;Lt.texImage2D(Lt.TEXTURE_2D,0,Pe,L,at,0,Lt.RGBA,xe,null);let $e=Pt.createFramebuffer(L,at,!1,!1);return $e.colorAttachment.set(le),$e}function Pc(Pt,L){return L.colorRampTexture||(L.colorRampTexture=new h(Pt,L.colorRamp,Pt.gl.RGBA)),L.colorRampTexture}function du(Pt,L,at,xt,kt){if(!at||!xt||!xt.imageAtlas)return;let Lt=xt.imageAtlas.patternPositions,le=Lt[at.to.toString()],xe=Lt[at.from.toString()];if(!le&&xe&&(le=xe),!xe&&le&&(xe=le),!le||!xe){let Pe=kt.getPaintProperty(L);le=Lt[Pe],xe=Lt[Pe]}le&&xe&&Pt.setConstantPatternPositions(le,xe)}function Rc(Pt,L,at,xt,kt,Lt,le){let xe=Pt.context.gl,Pe="fill-pattern",$e=at.paint.get(Pe),hr=$e&&$e.constantOr(1),pr=at.getCrossfadeParameters(),Br,Jr,Rt,Gt,ae;le?(Jr=hr&&!at.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Br=xe.LINES):(Jr=hr?"fillPattern":"fill",Br=xe.TRIANGLES);let ce=$e.constantOr(null);for(let Te of xt){let ye=L.getTile(Te);if(hr&&!ye.patternsLoaded())continue;let ze=ye.getBucket(at);if(!ze)continue;let rr=ze.programConfigurations.get(at.id),fr=Pt.useProgram(Jr,rr),gr=Pt.style.map.terrain&&Pt.style.map.terrain.getTerrainData(Te);hr&&(Pt.context.activeTexture.set(xe.TEXTURE0),ye.imageAtlasTexture.bind(xe.LINEAR,xe.CLAMP_TO_EDGE),rr.updatePaintBuffers(pr)),du(rr,Pe,ce,ye,at);let Lr=gr?Te:null,Hr=Pt.translatePosMatrix(Lr?Lr.posMatrix:Te.posMatrix,ye,at.paint.get("fill-translate"),at.paint.get("fill-translate-anchor"));if(le){Gt=ze.indexBuffer2,ae=ze.segments2;let nn=[xe.drawingBufferWidth,xe.drawingBufferHeight];Rt=Jr==="fillOutlinePattern"&&hr?Qa(Hr,Pt,pr,ye,nn):Qn(Hr,nn)}else Gt=ze.indexBuffer,ae=ze.segments,Rt=hr?Oa(Hr,Pt,pr,ye):vn(Hr);fr.draw(Pt.context,Br,kt,Pt.stencilModeForClipping(Te),Lt,Fi.disabled,Rt,gr,at.id,ze.layoutVertexBuffer,Gt,ae,at.paint,Pt.transform.zoom,rr)}}function Pu(Pt,L,at,xt,kt,Lt,le){let xe=Pt.context,Pe=xe.gl,$e="fill-extrusion-pattern",hr=at.paint.get($e),pr=hr.constantOr(1),Br=at.getCrossfadeParameters(),Jr=at.paint.get("fill-extrusion-opacity"),Rt=hr.constantOr(null);for(let Gt of xt){let ae=L.getTile(Gt),ce=ae.getBucket(at);if(!ce)continue;let Te=Pt.style.map.terrain&&Pt.style.map.terrain.getTerrainData(Gt),ye=ce.programConfigurations.get(at.id),ze=Pt.useProgram(pr?"fillExtrusionPattern":"fillExtrusion",ye);pr&&(Pt.context.activeTexture.set(Pe.TEXTURE0),ae.imageAtlasTexture.bind(Pe.LINEAR,Pe.CLAMP_TO_EDGE),ye.updatePaintBuffers(Br)),du(ye,$e,Rt,ae,at);let rr=Pt.translatePosMatrix(Gt.posMatrix,ae,at.paint.get("fill-extrusion-translate"),at.paint.get("fill-extrusion-translate-anchor")),fr=at.paint.get("fill-extrusion-vertical-gradient"),gr=pr?Qr(rr,Pt,fr,Jr,Gt,Br,ae):rn(rr,Pt,fr,Jr);ze.draw(xe,xe.gl.TRIANGLES,kt,Lt,le,Fi.backCCW,gr,Te,at.id,ce.layoutVertexBuffer,ce.indexBuffer,ce.segments,at.paint,Pt.transform.zoom,ye,Pt.style.map.terrain&&ce.centroidVertexBuffer)}}function wu(Pt,L,at,xt,kt,Lt,le){let xe=Pt.context,Pe=xe.gl,$e=at.fbo;if(!$e)return;let hr=Pt.useProgram("hillshade"),pr=Pt.style.map.terrain&&Pt.style.map.terrain.getTerrainData(L);xe.activeTexture.set(Pe.TEXTURE0),Pe.bindTexture(Pe.TEXTURE_2D,$e.colorAttachment.get()),hr.draw(xe,Pe.TRIANGLES,kt,Lt,le,Fi.disabled,((Br,Jr,Rt,Gt)=>{let ae=Rt.paint.get("hillshade-shadow-color"),ce=Rt.paint.get("hillshade-highlight-color"),Te=Rt.paint.get("hillshade-accent-color"),ye=Rt.paint.get("hillshade-illumination-direction")*(Math.PI/180);Rt.paint.get("hillshade-illumination-anchor")==="viewport"&&(ye-=Br.transform.angle);let ze=!Br.options.moving;return{u_matrix:Gt?Gt.posMatrix:Br.transform.calculatePosMatrix(Jr.tileID.toUnwrapped(),ze),u_image:0,u_latrange:Hi(0,Jr.tileID),u_light:[Rt.paint.get("hillshade-exaggeration"),ye],u_shadow:ae,u_highlight:ce,u_accent:Te}})(Pt,at,xt,pr?L:null),pr,xt.id,Pt.rasterBoundsBuffer,Pt.quadTriangleIndexBuffer,Pt.rasterBoundsSegments)}function Tl(Pt,L,at,xt,kt,Lt){let le=Pt.context,xe=le.gl,Pe=L.dem;if(Pe&&Pe.data){let $e=Pe.dim,hr=Pe.stride,pr=Pe.getPixels();if(le.activeTexture.set(xe.TEXTURE1),le.pixelStoreUnpackPremultiplyAlpha.set(!1),L.demTexture=L.demTexture||Pt.getTileTexture(hr),L.demTexture){let Jr=L.demTexture;Jr.update(pr,{premultiply:!1}),Jr.bind(xe.NEAREST,xe.CLAMP_TO_EDGE)}else L.demTexture=new h(le,pr,xe.RGBA,{premultiply:!1}),L.demTexture.bind(xe.NEAREST,xe.CLAMP_TO_EDGE);le.activeTexture.set(xe.TEXTURE0);let Br=L.fbo;if(!Br){let Jr=new h(le,{width:$e,height:$e,data:null},xe.RGBA);Jr.bind(xe.LINEAR,xe.CLAMP_TO_EDGE),Br=L.fbo=le.createFramebuffer($e,$e,!0,!1),Br.colorAttachment.set(Jr.texture)}le.bindFramebuffer.set(Br.framebuffer),le.viewport.set([0,0,$e,$e]),Pt.useProgram("hillshadePrepare").draw(le,xe.TRIANGLES,xt,kt,Lt,Fi.disabled,((Jr,Rt)=>{let Gt=Rt.stride,ae=e.H();return e.aP(ae,0,e.X,-e.X,0,0,1),e.J(ae,ae,[0,-e.X,0]),{u_matrix:ae,u_image:1,u_dimension:[Gt,Gt],u_zoom:Jr.overscaledZ,u_unpack:Rt.getUnpackVector()}})(L.tileID,Pe),null,at.id,Pt.rasterBoundsBuffer,Pt.quadTriangleIndexBuffer,Pt.rasterBoundsSegments),L.needsHillshadePrepare=!1}}function Qu(Pt,L,at,xt,kt,Lt){let le=xt.paint.get("raster-fade-duration");if(!Lt&&le>0){let xe=o.now(),Pe=(xe-Pt.timeAdded)/le,$e=L?(xe-L.timeAdded)/le:-1,hr=at.getSource(),pr=kt.coveringZoomLevel({tileSize:hr.tileSize,roundZoom:hr.roundZoom}),Br=!L||Math.abs(L.tileID.overscaledZ-pr)>Math.abs(Pt.tileID.overscaledZ-pr),Jr=Br&&Pt.refreshedUponExpiration?1:e.ac(Br?Pe:1-$e,0,1);return Pt.refreshedUponExpiration&&Pe>=1&&(Pt.refreshedUponExpiration=!1),L?{opacity:1,mix:1-Jr}:{opacity:Jr,mix:0}}return{opacity:1,mix:0}}let Oc=new e.aM(1,0,0,1),Es=new e.aM(0,1,0,1),bc=new e.aM(0,0,1,1),lf=new e.aM(1,0,1,1),Nc=new e.aM(0,1,1,1);function vc(Pt,L,at,xt){Zl(Pt,0,L+at/2,Pt.transform.width,at,xt)}function jc(Pt,L,at,xt){Zl(Pt,L-at/2,0,at,Pt.transform.height,xt)}function Zl(Pt,L,at,xt,kt,Lt){let le=Pt.context,xe=le.gl;xe.enable(xe.SCISSOR_TEST),xe.scissor(L*Pt.pixelRatio,at*Pt.pixelRatio,xt*Pt.pixelRatio,kt*Pt.pixelRatio),le.clear({color:Lt}),xe.disable(xe.SCISSOR_TEST)}function Uc(Pt,L,at){let xt=Pt.context,kt=xt.gl,Lt=at.posMatrix,le=Pt.useProgram("debug"),xe=Oo.disabled,Pe=os.disabled,$e=Pt.colorModeForRenderPass(),hr="$debug",pr=Pt.style.map.terrain&&Pt.style.map.terrain.getTerrainData(at);xt.activeTexture.set(kt.TEXTURE0);let Br=L.getTileByID(at.key).latestRawTileData,Jr=Math.floor((Br&&Br.byteLength||0)/1024),Rt=L.getTile(at).tileSize,Gt=512/Math.min(Rt,512)*(at.overscaledZ/Pt.transform.zoom)*.5,ae=at.canonical.toString();at.overscaledZ!==at.canonical.z&&(ae+=` => ${at.overscaledZ}`),(function(ce,Te){ce.initDebugOverlayCanvas();let ye=ce.debugOverlayCanvas,ze=ce.context.gl,rr=ce.debugOverlayCanvas.getContext("2d");rr.clearRect(0,0,ye.width,ye.height),rr.shadowColor="white",rr.shadowBlur=2,rr.lineWidth=1.5,rr.strokeStyle="white",rr.textBaseline="top",rr.font="bold 36px Open Sans, sans-serif",rr.fillText(Te,5,5),rr.strokeText(Te,5,5),ce.debugOverlayTexture.update(ye),ce.debugOverlayTexture.bind(ze.LINEAR,ze.CLAMP_TO_EDGE)})(Pt,`${ae} ${Jr}kB`),le.draw(xt,kt.TRIANGLES,xe,Pe,qs.alphaBlended,Fi.disabled,ci(Lt,e.aM.transparent,Gt),null,hr,Pt.debugBuffer,Pt.quadTriangleIndexBuffer,Pt.debugSegments),le.draw(xt,kt.LINE_STRIP,xe,Pe,$e,Fi.disabled,ci(Lt,e.aM.red),pr,hr,Pt.debugBuffer,Pt.tileBorderIndexBuffer,Pt.debugSegments)}function rl(Pt,L,at){let xt=Pt.context,kt=xt.gl,Lt=Pt.colorModeForRenderPass(),le=new Oo(kt.LEQUAL,Oo.ReadWrite,Pt.depthRangeFor3D),xe=Pt.useProgram("terrain"),Pe=L.getTerrainMesh();xt.bindFramebuffer.set(null),xt.viewport.set([0,0,Pt.width,Pt.height]);for(let $e of at){let hr=Pt.renderToTexture.getTexture($e),pr=L.getTerrainData($e.tileID);xt.activeTexture.set(kt.TEXTURE0),kt.bindTexture(kt.TEXTURE_2D,hr.texture);let Br=Pt.transform.calculatePosMatrix($e.tileID.toUnwrapped()),Jr=L.getMeshFrameDelta(Pt.transform.zoom),Rt=Pt.transform.calculateFogMatrix($e.tileID.toUnwrapped()),Gt=xr(Br,Jr,Rt,Pt.style.sky,Pt.transform.pitch);xe.draw(xt,kt.TRIANGLES,le,os.disabled,Lt,Fi.backCCW,Gt,pr,"terrain",Pe.vertexBuffer,Pe.indexBuffer,Pe.segments)}}class Kl{constructor(L,at,xt){this.vertexBuffer=L,this.indexBuffer=at,this.segments=xt}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Zu{constructor(L,at){this.context=new sf(L),this.transform=at,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:e.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ce.maxUnderzooming+Ce.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new br}resize(L,at,xt){if(this.width=Math.floor(L*xt),this.height=Math.floor(at*xt),this.pixelRatio=xt,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let kt of this.style._order)this.style._layers[kt].resize()}setup(){let L=this.context,at=new e.aX;at.emplaceBack(0,0),at.emplaceBack(e.X,0),at.emplaceBack(0,e.X),at.emplaceBack(e.X,e.X),this.tileExtentBuffer=L.createVertexBuffer(at,Ur.members),this.tileExtentSegments=e.a0.simpleSegment(0,0,4,2);let xt=new e.aX;xt.emplaceBack(0,0),xt.emplaceBack(e.X,0),xt.emplaceBack(0,e.X),xt.emplaceBack(e.X,e.X),this.debugBuffer=L.createVertexBuffer(xt,Ur.members),this.debugSegments=e.a0.simpleSegment(0,0,4,5);let kt=new e.$;kt.emplaceBack(0,0,0,0),kt.emplaceBack(e.X,0,e.X,0),kt.emplaceBack(0,e.X,0,e.X),kt.emplaceBack(e.X,e.X,e.X,e.X),this.rasterBoundsBuffer=L.createVertexBuffer(kt,Nt.members),this.rasterBoundsSegments=e.a0.simpleSegment(0,0,4,2);let Lt=new e.aX;Lt.emplaceBack(0,0),Lt.emplaceBack(1,0),Lt.emplaceBack(0,1),Lt.emplaceBack(1,1),this.viewportBuffer=L.createVertexBuffer(Lt,Ur.members),this.viewportSegments=e.a0.simpleSegment(0,0,4,2);let le=new e.aZ;le.emplaceBack(0),le.emplaceBack(1),le.emplaceBack(3),le.emplaceBack(2),le.emplaceBack(0),this.tileBorderIndexBuffer=L.createIndexBuffer(le);let xe=new e.aY;xe.emplaceBack(0,1,2),xe.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=L.createIndexBuffer(xe);let Pe=this.context.gl;this.stencilClearMode=new os({func:Pe.ALWAYS,mask:0},0,255,Pe.ZERO,Pe.ZERO,Pe.ZERO)}clearStencil(){let L=this.context,at=L.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let xt=e.H();e.aP(xt,0,this.width,this.height,0,0,1),e.K(xt,xt,[at.drawingBufferWidth,at.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(L,at.TRIANGLES,Oo.disabled,this.stencilClearMode,qs.disabled,Fi.disabled,Ti(xt),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(L,at){if(this.currentStencilSource===L.source||!L.isTileClipped()||!at||!at.length)return;this.currentStencilSource=L.source;let xt=this.context,kt=xt.gl;this.nextStencilID+at.length>256&&this.clearStencil(),xt.setColorMode(qs.disabled),xt.setDepthMode(Oo.disabled);let Lt=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let le of at){let xe=this._tileClippingMaskIDs[le.key]=this.nextStencilID++,Pe=this.style.map.terrain&&this.style.map.terrain.getTerrainData(le);Lt.draw(xt,kt.TRIANGLES,Oo.disabled,new os({func:kt.ALWAYS,mask:0},xe,255,kt.KEEP,kt.KEEP,kt.REPLACE),qs.disabled,Fi.disabled,Ti(le.posMatrix),Pe,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let L=this.nextStencilID++,at=this.context.gl;return new os({func:at.NOTEQUAL,mask:255},L,255,at.KEEP,at.KEEP,at.REPLACE)}stencilModeForClipping(L){let at=this.context.gl;return new os({func:at.EQUAL,mask:255},this._tileClippingMaskIDs[L.key],0,at.KEEP,at.KEEP,at.REPLACE)}stencilConfigForOverlap(L){let at=this.context.gl,xt=L.sort((le,xe)=>xe.overscaledZ-le.overscaledZ),kt=xt[xt.length-1].overscaledZ,Lt=xt[0].overscaledZ-kt+1;if(Lt>1){this.currentStencilSource=void 0,this.nextStencilID+Lt>256&&this.clearStencil();let le={};for(let xe=0;xe({u_sky_color:ce.properties.get("sky-color"),u_horizon_color:ce.properties.get("horizon-color"),u_horizon:(Te.height/2+Te.getHorizon())*ye,u_sky_horizon_blend:ce.properties.get("sky-horizon-blend")*Te.height/2*ye}))($e,Pe.style.map.transform,Pe.pixelRatio),Jr=new Oo(pr.LEQUAL,Oo.ReadWrite,[0,1]),Rt=os.disabled,Gt=Pe.colorModeForRenderPass(),ae=Pe.useProgram("sky");if(!$e.mesh){let ce=new e.aX;ce.emplaceBack(-1,-1),ce.emplaceBack(1,-1),ce.emplaceBack(1,1),ce.emplaceBack(-1,1);let Te=new e.aY;Te.emplaceBack(0,1,2),Te.emplaceBack(0,2,3),$e.mesh=new Kl(hr.createVertexBuffer(ce,Ur.members),hr.createIndexBuffer(Te),e.a0.simpleSegment(0,0,ce.length,Te.length))}ae.draw(hr,pr.TRIANGLES,Jr,Rt,Gt,Fi.disabled,Br,void 0,"sky",$e.mesh.vertexBuffer,$e.mesh.indexBuffer,$e.mesh.segments)})(this,this.style.sky),this._showOverdrawInspector=at.showOverdrawInspector,this.depthRangeFor3D=[0,1-(L._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=xt.length-1;this.currentLayer>=0;this.currentLayer--){let Pe=this.style._layers[xt[this.currentLayer]],$e=kt[Pe.source],hr=Lt[Pe.source];this._renderTileClippingMasks(Pe,hr),this.renderLayer(this,$e,Pe,hr)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerae.source&&!ae.isHidden(hr)?[$e.sourceCaches[ae.source]]:[]),Jr=Br.filter(ae=>ae.getSource().type==="vector"),Rt=Br.filter(ae=>ae.getSource().type!=="vector"),Gt=ae=>{(!pr||pr.getSource().maxzoomGt(ae)),pr||Rt.forEach(ae=>Gt(ae)),pr})(this.style,this.transform.zoom);Pe&&(function($e,hr,pr){for(let Br=0;Br0),kt&&(e.b0(at,xt),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(Lt,le){let xe=Lt.context,Pe=xe.gl,$e=qs.unblended,hr=new Oo(Pe.LEQUAL,Oo.ReadWrite,[0,1]),pr=le.getTerrainMesh(),Br=le.sourceCache.getRenderableTiles(),Jr=Lt.useProgram("terrainDepth");xe.bindFramebuffer.set(le.getFramebuffer("depth").framebuffer),xe.viewport.set([0,0,Lt.width/devicePixelRatio,Lt.height/devicePixelRatio]),xe.clear({color:e.aM.transparent,depth:1});for(let Rt of Br){let Gt=le.getTerrainData(Rt.tileID),ae={u_matrix:Lt.transform.calculatePosMatrix(Rt.tileID.toUnwrapped()),u_ele_delta:le.getMeshFrameDelta(Lt.transform.zoom)};Jr.draw(xe,Pe.TRIANGLES,hr,os.disabled,$e,Fi.backCCW,ae,Gt,"terrain",pr.vertexBuffer,pr.indexBuffer,pr.segments)}xe.bindFramebuffer.set(null),xe.viewport.set([0,0,Lt.width,Lt.height])})(this,this.style.map.terrain),(function(Lt,le){let xe=Lt.context,Pe=xe.gl,$e=qs.unblended,hr=new Oo(Pe.LEQUAL,Oo.ReadWrite,[0,1]),pr=le.getTerrainMesh(),Br=le.getCoordsTexture(),Jr=le.sourceCache.getRenderableTiles(),Rt=Lt.useProgram("terrainCoords");xe.bindFramebuffer.set(le.getFramebuffer("coords").framebuffer),xe.viewport.set([0,0,Lt.width/devicePixelRatio,Lt.height/devicePixelRatio]),xe.clear({color:e.aM.transparent,depth:1}),le.coordsIndex=[];for(let Gt of Jr){let ae=le.getTerrainData(Gt.tileID);xe.activeTexture.set(Pe.TEXTURE0),Pe.bindTexture(Pe.TEXTURE_2D,Br.texture);let ce={u_matrix:Lt.transform.calculatePosMatrix(Gt.tileID.toUnwrapped()),u_terrain_coords_id:(255-le.coordsIndex.length)/255,u_texture:0,u_ele_delta:le.getMeshFrameDelta(Lt.transform.zoom)};Rt.draw(xe,Pe.TRIANGLES,hr,os.disabled,$e,Fi.backCCW,ce,ae,"terrain",pr.vertexBuffer,pr.indexBuffer,pr.segments),le.coordsIndex.push(Gt.tileID.key)}xe.bindFramebuffer.set(null),xe.viewport.set([0,0,Lt.width,Lt.height])})(this,this.style.map.terrain))}renderLayer(L,at,xt,kt){if(!xt.isHidden(this.transform.zoom)&&(xt.type==="background"||xt.type==="custom"||(kt||[]).length))switch(this.id=xt.id,xt.type){case"symbol":(function(Lt,le,xe,Pe,$e){if(Lt.renderPass!=="translucent")return;let hr=os.disabled,pr=Lt.colorModeForRenderPass();(xe._unevaluatedLayout.hasValue("text-variable-anchor")||xe._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(Br,Jr,Rt,Gt,ae,ce,Te,ye,ze){let rr=Jr.transform,fr=ia(),gr=ae==="map",Lr=ce==="map";for(let Hr of Br){let nn=Gt.getTile(Hr),cn=nn.getBucket(Rt);if(!cn||!cn.text||!cn.text.segments.get().length)continue;let Mn=e.ag(cn.textSizeData,rr.zoom),Jn=dn(nn,1,Jr.transform.zoom),_a=Mr(Hr.posMatrix,Lr,gr,Jr.transform,Jn),xa=Rt.layout.get("icon-text-fit")!=="none"&&cn.hasIconData();if(Mn){let La=Math.pow(2,rr.zoom-nn.tileID.overscaledZ),ai=Jr.style.map.terrain?(mi,Yi)=>Jr.style.map.terrain.getElevation(Hr,mi,Yi):null,Ai=fr.translatePosition(rr,nn,Te,ye);mc(cn,gr,Lr,ze,rr,_a,Hr.posMatrix,La,Mn,xa,fr,Ai,Hr.toUnwrapped(),ai)}}})(Pe,Lt,xe,le,xe.layout.get("text-rotation-alignment"),xe.layout.get("text-pitch-alignment"),xe.paint.get("text-translate"),xe.paint.get("text-translate-anchor"),$e),xe.paint.get("icon-opacity").constantOr(1)!==0&&Xc(Lt,le,xe,Pe,!1,xe.paint.get("icon-translate"),xe.paint.get("icon-translate-anchor"),xe.layout.get("icon-rotation-alignment"),xe.layout.get("icon-pitch-alignment"),xe.layout.get("icon-keep-upright"),hr,pr),xe.paint.get("text-opacity").constantOr(1)!==0&&Xc(Lt,le,xe,Pe,!0,xe.paint.get("text-translate"),xe.paint.get("text-translate-anchor"),xe.layout.get("text-rotation-alignment"),xe.layout.get("text-pitch-alignment"),xe.layout.get("text-keep-upright"),hr,pr),le.map.showCollisionBoxes&&(pu(Lt,le,xe,Pe,!0),pu(Lt,le,xe,Pe,!1))})(L,at,xt,kt,this.style.placement.variableOffsets);break;case"circle":(function(Lt,le,xe,Pe){if(Lt.renderPass!=="translucent")return;let $e=xe.paint.get("circle-opacity"),hr=xe.paint.get("circle-stroke-width"),pr=xe.paint.get("circle-stroke-opacity"),Br=!xe.layout.get("circle-sort-key").isConstant();if($e.constantOr(1)===0&&(hr.constantOr(1)===0||pr.constantOr(1)===0))return;let Jr=Lt.context,Rt=Jr.gl,Gt=Lt.depthModeForSublayer(0,Oo.ReadOnly),ae=os.disabled,ce=Lt.colorModeForRenderPass(),Te=[];for(let ye=0;yeye.sortKey-ze.sortKey);for(let ye of Te){let{programConfiguration:ze,program:rr,layoutVertexBuffer:fr,indexBuffer:gr,uniformValues:Lr,terrainData:Hr}=ye.state;rr.draw(Jr,Rt.TRIANGLES,Gt,ae,ce,Fi.disabled,Lr,Hr,xe.id,fr,gr,ye.segments,xe.paint,Lt.transform.zoom,ze)}})(L,at,xt,kt);break;case"heatmap":(function(Lt,le,xe,Pe){if(xe.paint.get("heatmap-opacity")===0)return;let $e=Lt.context;if(Lt.style.map.terrain){for(let hr of Pe){let pr=le.getTile(hr);le.hasRenderableParent(hr)||(Lt.renderPass==="offscreen"?gc(Lt,pr,xe,hr):Lt.renderPass==="translucent"&&Gu(Lt,xe,hr))}$e.viewport.set([0,0,Lt.width,Lt.height])}else Lt.renderPass==="offscreen"?(function(hr,pr,Br,Jr){let Rt=hr.context,Gt=Rt.gl,ae=os.disabled,ce=new qs([Gt.ONE,Gt.ONE],e.aM.transparent,[!0,!0,!0,!0]);(function(Te,ye,ze){let rr=Te.gl;Te.activeTexture.set(rr.TEXTURE1),Te.viewport.set([0,0,ye.width/4,ye.height/4]);let fr=ze.heatmapFbos.get(e.aU);fr?(rr.bindTexture(rr.TEXTURE_2D,fr.colorAttachment.get()),Te.bindFramebuffer.set(fr.framebuffer)):(fr=Ic(Te,ye.width/4,ye.height/4),ze.heatmapFbos.set(e.aU,fr))})(Rt,hr,Br),Rt.clear({color:e.aM.transparent});for(let Te=0;Te20&&hr.texParameterf(hr.TEXTURE_2D,$e.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,$e.extTextureFilterAnisotropicMax);let cn=Lt.style.map.terrain&&Lt.style.map.terrain.getTerrainData(Te),Mn=cn?Te:null,Jn=Mn?Mn.posMatrix:Lt.transform.calculatePosMatrix(Te.toUnwrapped(),ce),_a=hs(Jn,Hr||[0,0],Lr||1,gr,xe);pr instanceof te?Br.draw($e,hr.TRIANGLES,ye,os.disabled,Jr,Fi.disabled,_a,cn,xe.id,pr.boundsBuffer,Lt.quadTriangleIndexBuffer,pr.boundsSegments):Br.draw($e,hr.TRIANGLES,ye,Rt[Te.overscaledZ],Jr,Fi.disabled,_a,cn,xe.id,Lt.rasterBoundsBuffer,Lt.quadTriangleIndexBuffer,Lt.rasterBoundsSegments)}})(L,at,xt,kt);break;case"background":(function(Lt,le,xe,Pe){let $e=xe.paint.get("background-color"),hr=xe.paint.get("background-opacity");if(hr===0)return;let pr=Lt.context,Br=pr.gl,Jr=Lt.transform,Rt=Jr.tileSize,Gt=xe.paint.get("background-pattern");if(Lt.isPatternMissing(Gt))return;let ae=!Gt&&$e.a===1&&hr===1&&Lt.opaquePassEnabledForLayer()?"opaque":"translucent";if(Lt.renderPass!==ae)return;let ce=os.disabled,Te=Lt.depthModeForSublayer(0,ae==="opaque"?Oo.ReadWrite:Oo.ReadOnly),ye=Lt.colorModeForRenderPass(),ze=Lt.useProgram(Gt?"backgroundPattern":"background"),rr=Pe||Jr.coveringTiles({tileSize:Rt,terrain:Lt.style.map.terrain});Gt&&(pr.activeTexture.set(Br.TEXTURE0),Lt.imageManager.bind(Lt.context));let fr=xe.getCrossfadeParameters();for(let gr of rr){let Lr=Pe?gr.posMatrix:Lt.transform.calculatePosMatrix(gr.toUnwrapped()),Hr=Gt?vs(Lr,hr,Lt,Gt,{tileID:gr,tileSize:Rt},fr):ts(Lr,hr,$e),nn=Lt.style.map.terrain&&Lt.style.map.terrain.getTerrainData(gr);ze.draw(pr,Br.TRIANGLES,Te,ce,ye,Fi.disabled,Hr,nn,xe.id,Lt.tileExtentBuffer,Lt.quadTriangleIndexBuffer,Lt.tileExtentSegments)}})(L,0,xt,kt);break;case"custom":(function(Lt,le,xe){let Pe=Lt.context,$e=xe.implementation;if(Lt.renderPass==="offscreen"){let hr=$e.prerender;hr&&(Lt.setCustomLayerDefaults(),Pe.setColorMode(Lt.colorModeForRenderPass()),hr.call($e,Pe.gl,Lt.transform.customLayerMatrix()),Pe.setDirty(),Lt.setBaseState())}else if(Lt.renderPass==="translucent"){Lt.setCustomLayerDefaults(),Pe.setColorMode(Lt.colorModeForRenderPass()),Pe.setStencilMode(os.disabled);let hr=$e.renderingMode==="3d"?new Oo(Lt.context.gl.LEQUAL,Oo.ReadWrite,Lt.depthRangeFor3D):Lt.depthModeForSublayer(0,Oo.ReadOnly);Pe.setDepthMode(hr),$e.render(Pe.gl,Lt.transform.customLayerMatrix(),{farZ:Lt.transform.farZ,nearZ:Lt.transform.nearZ,fov:Lt.transform._fov,modelViewProjectionMatrix:Lt.transform.modelViewProjectionMatrix,projectionMatrix:Lt.transform.projectionMatrix}),Pe.setDirty(),Lt.setBaseState(),Pe.bindFramebuffer.set(null)}})(L,0,xt)}}translatePosMatrix(L,at,xt,kt,Lt){if(!xt[0]&&!xt[1])return L;let le=Lt?kt==="map"?this.transform.angle:0:kt==="viewport"?-this.transform.angle:0;if(le){let $e=Math.sin(le),hr=Math.cos(le);xt=[xt[0]*hr-xt[1]*$e,xt[0]*$e+xt[1]*hr]}let xe=[Lt?xt[0]:dn(at,xt[0],this.transform.zoom),Lt?xt[1]:dn(at,xt[1],this.transform.zoom),0],Pe=new Float32Array(16);return e.J(Pe,L,xe),Pe}saveTileTexture(L){let at=this._tileTextures[L.size[0]];at?at.push(L):this._tileTextures[L.size[0]]=[L]}getTileTexture(L){let at=this._tileTextures[L];return at&&at.length>0?at.pop():null}isPatternMissing(L){if(!L)return!1;if(!L.from||!L.to)return!0;let at=this.imageManager.getPattern(L.from.toString()),xt=this.imageManager.getPattern(L.to.toString());return!at||!xt}useProgram(L,at){this.cache=this.cache||{};let xt=L+(at?at.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[xt]||(this.cache[xt]=new ln(this.context,Or[L],at,As[L],this._showOverdrawInspector,this.style.map.terrain)),this.cache[xt]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let L=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(L.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new h(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:L,drawingBufferHeight:at}=this.context.gl;return this.width!==L||this.height!==at}}class Bs{constructor(L,at){this.points=L,this.planes=at}static fromInvProjectionMatrix(L,at,xt){let kt=Math.pow(2,xt),Lt=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(xe=>{let Pe=1/(xe=e.af([],xe,L))[3]/at*kt;return e.b1(xe,xe,[Pe,Pe,1/xe[3],Pe])}),le=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(xe=>{let Pe=(function(Br,Jr){var Rt=Jr[0],Gt=Jr[1],ae=Jr[2],ce=Rt*Rt+Gt*Gt+ae*ae;return ce>0&&(ce=1/Math.sqrt(ce)),Br[0]=Jr[0]*ce,Br[1]=Jr[1]*ce,Br[2]=Jr[2]*ce,Br})([],(function(Br,Jr,Rt){var Gt=Jr[0],ae=Jr[1],ce=Jr[2],Te=Rt[0],ye=Rt[1],ze=Rt[2];return Br[0]=ae*ze-ce*ye,Br[1]=ce*Te-Gt*ze,Br[2]=Gt*ye-ae*Te,Br})([],k([],Lt[xe[0]],Lt[xe[1]]),k([],Lt[xe[2]],Lt[xe[1]]))),$e=-((hr=Pe)[0]*(pr=Lt[xe[1]])[0]+hr[1]*pr[1]+hr[2]*pr[2]);var hr,pr;return Pe.concat($e)});return new Bs(Lt,le)}}class Ou{constructor(L,at){this.min=L,this.max=at,this.center=(function(xt,kt,Lt){return xt[0]=.5*kt[0],xt[1]=.5*kt[1],xt[2]=.5*kt[2],xt})([],(function(xt,kt,Lt){return xt[0]=kt[0]+Lt[0],xt[1]=kt[1]+Lt[1],xt[2]=kt[2]+Lt[2],xt})([],this.min,this.max))}quadrant(L){let at=[L%2==0,L<2],xt=y(this.min),kt=y(this.max);for(let Lt=0;Lt=0&&le++;if(le===0)return 0;le!==at.length&&(xt=!1)}if(xt)return 2;for(let kt=0;kt<3;kt++){let Lt=Number.MAX_VALUE,le=-Number.MAX_VALUE;for(let xe=0;xethis.max[kt]-this.min[kt])return 0}return 1}}class Rl{constructor(L=0,at=0,xt=0,kt=0){if(isNaN(L)||L<0||isNaN(at)||at<0||isNaN(xt)||xt<0||isNaN(kt)||kt<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=L,this.bottom=at,this.left=xt,this.right=kt}interpolate(L,at,xt){return at.top!=null&&L.top!=null&&(this.top=e.y.number(L.top,at.top,xt)),at.bottom!=null&&L.bottom!=null&&(this.bottom=e.y.number(L.bottom,at.bottom,xt)),at.left!=null&&L.left!=null&&(this.left=e.y.number(L.left,at.left,xt)),at.right!=null&&L.right!=null&&(this.right=e.y.number(L.right,at.right,xt)),this}getCenter(L,at){let xt=e.ac((this.left+L-this.right)/2,0,L),kt=e.ac((this.top+at-this.bottom)/2,0,at);return new e.P(xt,kt)}equals(L){return this.top===L.top&&this.bottom===L.bottom&&this.left===L.left&&this.right===L.right}clone(){return new Rl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}let Yl=85.051129;class Ws{constructor(L,at,xt,kt,Lt){this.tileSize=512,this._renderWorldCopies=Lt===void 0||!!Lt,this._minZoom=L||0,this._maxZoom=at||22,this._minPitch=xt??0,this._maxPitch=kt??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new e.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Rl,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){let L=new Ws(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return L.apply(this),L}apply(L){this.tileSize=L.tileSize,this.latRange=L.latRange,this.lngRange=L.lngRange,this.width=L.width,this.height=L.height,this._center=L._center,this._elevation=L._elevation,this.minElevationForCurrentTile=L.minElevationForCurrentTile,this.zoom=L.zoom,this.angle=L.angle,this._fov=L._fov,this._pitch=L._pitch,this._unmodified=L._unmodified,this._edgeInsets=L._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(L){this._minZoom!==L&&(this._minZoom=L,this.zoom=Math.max(this.zoom,L))}get maxZoom(){return this._maxZoom}set maxZoom(L){this._maxZoom!==L&&(this._maxZoom=L,this.zoom=Math.min(this.zoom,L))}get minPitch(){return this._minPitch}set minPitch(L){this._minPitch!==L&&(this._minPitch=L,this.pitch=Math.max(this.pitch,L))}get maxPitch(){return this._maxPitch}set maxPitch(L){this._maxPitch!==L&&(this._maxPitch=L,this.pitch=Math.min(this.pitch,L))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(L){L===void 0?L=!0:L===null&&(L=!1),this._renderWorldCopies=L}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(L){let at=-e.b3(L,-180,180)*Math.PI/180;this.angle!==at&&(this._unmodified=!1,this.angle=at,this._calcMatrices(),this.rotationMatrix=(function(){var xt=new e.A(4);return e.A!=Float32Array&&(xt[1]=0,xt[2]=0),xt[0]=1,xt[3]=1,xt})(),(function(xt,kt,Lt){var le=kt[0],xe=kt[1],Pe=kt[2],$e=kt[3],hr=Math.sin(Lt),pr=Math.cos(Lt);xt[0]=le*pr+Pe*hr,xt[1]=xe*pr+$e*hr,xt[2]=le*-hr+Pe*pr,xt[3]=xe*-hr+$e*pr})(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(L){let at=e.ac(L,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==at&&(this._unmodified=!1,this._pitch=at,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(L){L=Math.max(.01,Math.min(60,L)),this._fov!==L&&(this._unmodified=!1,this._fov=L/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(L){let at=Math.min(Math.max(L,this.minZoom),this.maxZoom);this._zoom!==at&&(this._unmodified=!1,this._zoom=at,this.tileZoom=Math.max(0,Math.floor(at)),this.scale=this.zoomScale(at),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(L){L.lat===this._center.lat&&L.lng===this._center.lng||(this._unmodified=!1,this._center=L,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(L){L!==this._elevation&&(this._elevation=L,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(L){this._edgeInsets.equals(L)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,L,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(L){return this._edgeInsets.equals(L)}interpolatePadding(L,at,xt){this._unmodified=!1,this._edgeInsets.interpolate(L,at,xt),this._constrain(),this._calcMatrices()}coveringZoomLevel(L){let at=(L.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/L.tileSize));return Math.max(0,at)}getVisibleUnwrappedCoordinates(L){let at=[new e.b4(0,L)];if(this._renderWorldCopies){let xt=this.pointCoordinate(new e.P(0,0)),kt=this.pointCoordinate(new e.P(this.width,0)),Lt=this.pointCoordinate(new e.P(this.width,this.height)),le=this.pointCoordinate(new e.P(0,this.height)),xe=Math.floor(Math.min(xt.x,kt.x,Lt.x,le.x)),Pe=Math.floor(Math.max(xt.x,kt.x,Lt.x,le.x)),$e=1;for(let hr=xe-$e;hr<=Pe+$e;hr++)hr!==0&&at.push(new e.b4(hr,L))}return at}coveringTiles(L){var at,xt;let kt=this.coveringZoomLevel(L),Lt=kt;if(L.minzoom!==void 0&&ktL.maxzoom&&(kt=L.maxzoom);let le=this.pointCoordinate(this.getCameraPoint()),xe=e.Z.fromLngLat(this.center),Pe=Math.pow(2,kt),$e=[Pe*le.x,Pe*le.y,0],hr=[Pe*xe.x,Pe*xe.y,0],pr=Bs.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,kt),Br=L.minzoom||0;!L.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Br=kt);let Jr=L.terrain?2/Math.min(this.tileSize,L.tileSize)*this.tileSize:3,Rt=ye=>({aabb:new Ou([ye*Pe,0,0],[(ye+1)*Pe,Pe,0]),zoom:0,x:0,y:0,wrap:ye,fullyVisible:!1}),Gt=[],ae=[],ce=kt,Te=L.reparseOverscaled?Lt:kt;if(this._renderWorldCopies)for(let ye=1;ye<=3;ye++)Gt.push(Rt(-ye)),Gt.push(Rt(ye));for(Gt.push(Rt(0));Gt.length>0;){let ye=Gt.pop(),ze=ye.x,rr=ye.y,fr=ye.fullyVisible;if(!fr){let cn=ye.aabb.intersects(pr);if(cn===0)continue;fr=cn===2}let gr=L.terrain?$e:hr,Lr=ye.aabb.distanceX(gr),Hr=ye.aabb.distanceY(gr),nn=Math.max(Math.abs(Lr),Math.abs(Hr));if(ye.zoom===ce||nn>Jr+(1<=Br){let cn=ce-ye.zoom,Mn=$e[0]-.5-(ze<>1),_a=ye.zoom+1,xa=ye.aabb.quadrant(cn);if(L.terrain){let La=new e.S(_a,ye.wrap,_a,Mn,Jn),ai=L.terrain.getMinMaxElevation(La),Ai=(at=ai.minElevation)!==null&&at!==void 0?at:this.elevation,mi=(xt=ai.maxElevation)!==null&&xt!==void 0?xt:this.elevation;xa=new Ou([xa.min[0],xa.min[1],Ai],[xa.max[0],xa.max[1],mi])}Gt.push({aabb:xa,zoom:_a,x:Mn,y:Jn,wrap:ye.wrap,fullyVisible:fr})}}return ae.sort((ye,ze)=>ye.distanceSq-ze.distanceSq).map(ye=>ye.tileID)}resize(L,at){this.width=L,this.height=at,this.pixelsToGLUnits=[2/L,-2/at],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(L){return Math.pow(2,L)}scaleZoom(L){return Math.log(L)/Math.LN2}project(L){let at=e.ac(L.lat,-85.051129,Yl);return new e.P(e.O(L.lng)*this.worldSize,e.Q(at)*this.worldSize)}unproject(L){return new e.Z(L.x/this.worldSize,L.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(L){let at=this.elevation,xt=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,kt=this.pointLocation(this.centerPoint,L),Lt=L.getElevationForLngLatZoom(kt,this.tileZoom);if(!(this.elevation-Lt))return;let le=xt+at-Lt,xe=Math.cos(this._pitch)*this.cameraToCenterDistance/le/e.b5(1,kt.lat),Pe=this.scaleZoom(xe/this.tileSize);this._elevation=Lt,this._center=kt,this.zoom=Pe}setLocationAtPoint(L,at){let xt=this.pointCoordinate(at),kt=this.pointCoordinate(this.centerPoint),Lt=this.locationCoordinate(L),le=new e.Z(Lt.x-(xt.x-kt.x),Lt.y-(xt.y-kt.y));this.center=this.coordinateLocation(le),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(L,at){return at?this.coordinatePoint(this.locationCoordinate(L),at.getElevationForLngLatZoom(L,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(L))}pointLocation(L,at){return this.coordinateLocation(this.pointCoordinate(L,at))}locationCoordinate(L){return e.Z.fromLngLat(L)}coordinateLocation(L){return L&&L.toLngLat()}pointCoordinate(L,at){if(at){let Br=at.pointCoordinate(L);if(Br!=null)return Br}let xt=[L.x,L.y,0,1],kt=[L.x,L.y,1,1];e.af(xt,xt,this.pixelMatrixInverse),e.af(kt,kt,this.pixelMatrixInverse);let Lt=xt[3],le=kt[3],xe=xt[1]/Lt,Pe=kt[1]/le,$e=xt[2]/Lt,hr=kt[2]/le,pr=$e===hr?0:(0-$e)/(hr-$e);return new e.Z(e.y.number(xt[0]/Lt,kt[0]/le,pr)/this.worldSize,e.y.number(xe,Pe,pr)/this.worldSize)}coordinatePoint(L,at=0,xt=this.pixelMatrix){let kt=[L.x*this.worldSize,L.y*this.worldSize,at,1];return e.af(kt,kt,xt),new e.P(kt[0]/kt[3],kt[1]/kt[3])}getBounds(){let L=Math.max(0,this.height/2-this.getHorizon());return new nt().extend(this.pointLocation(new e.P(0,L))).extend(this.pointLocation(new e.P(this.width,L))).extend(this.pointLocation(new e.P(this.width,this.height))).extend(this.pointLocation(new e.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new nt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(L){L?(this.lngRange=[L.getWest(),L.getEast()],this.latRange=[L.getSouth(),L.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Yl])}calculateTileMatrix(L){let at=L.canonical,xt=this.worldSize/this.zoomScale(at.z),kt=at.x+Math.pow(2,at.z)*L.wrap,Lt=e.an(new Float64Array(16));return e.J(Lt,Lt,[kt*xt,at.y*xt,0]),e.K(Lt,Lt,[xt/e.X,xt/e.X,1]),Lt}calculatePosMatrix(L,at=!1){let xt=L.key,kt=at?this._alignedPosMatrixCache:this._posMatrixCache;if(kt[xt])return kt[xt];let Lt=this.calculateTileMatrix(L);return e.L(Lt,at?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,Lt),kt[xt]=new Float32Array(Lt),kt[xt]}calculateFogMatrix(L){let at=L.key,xt=this._fogMatrixCache;if(xt[at])return xt[at];let kt=this.calculateTileMatrix(L);return e.L(kt,this.fogMatrix,kt),xt[at]=new Float32Array(kt),xt[at]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(L,at){at=e.ac(+at,this.minZoom,this.maxZoom);let xt={center:new e.N(L.lng,L.lat),zoom:at},kt=this.lngRange;if(!this._renderWorldCopies&&kt===null){let ye=179.9999999999;kt=[-ye,ye]}let Lt=this.tileSize*this.zoomScale(xt.zoom),le=0,xe=Lt,Pe=0,$e=Lt,hr=0,pr=0,{x:Br,y:Jr}=this.size;if(this.latRange){let ye=this.latRange;le=e.Q(ye[1])*Lt,xe=e.Q(ye[0])*Lt,xe-lexe&&(ce=xe-ye)}if(kt){let ye=(Pe+$e)/2,ze=Rt;this._renderWorldCopies&&(ze=e.b3(Rt,ye-Lt/2,ye+Lt/2));let rr=Br/2;ze-rr$e&&(ae=$e-rr)}if(ae!==void 0||ce!==void 0){let ye=new e.P(ae??Rt,ce??Gt);xt.center=this.unproject.call({worldSize:Lt},ye).wrap()}return xt}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let L=this._unmodified,{center:at,zoom:xt}=this.getConstrained(this.center,this.zoom);this.center=at,this.zoom=xt,this._unmodified=L,this._constraining=!1}_calcMatrices(){if(!this.height)return;let L=this.centerOffset,at=this.point.x,xt=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=e.b5(1,this.center.lat)*this.worldSize;let kt=e.an(new Float64Array(16));e.K(kt,kt,[this.width/2,-this.height/2,1]),e.J(kt,kt,[1,-1,0]),this.labelPlaneMatrix=kt,kt=e.an(new Float64Array(16)),e.K(kt,kt,[1,-1,1]),e.J(kt,kt,[-1,-1,0]),e.K(kt,kt,[2/this.width,2/this.height,1]),this.glCoordMatrix=kt;let Lt=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),le=Math.min(this.elevation,this.minElevationForCurrentTile),xe=Lt-le*this._pixelPerMeter/Math.cos(this._pitch),Pe=le<0?xe:Lt,$e=Math.PI/2+this._pitch,hr=this._fov*(.5+L.y/this.height),pr=Math.sin(hr)*Pe/Math.sin(e.ac(Math.PI-$e-hr,.01,Math.PI-.01)),Br=this.getHorizon(),Jr=2*Math.atan(Br/this.cameraToCenterDistance)*(.5+L.y/(2*Br)),Rt=Math.sin(Jr)*Pe/Math.sin(e.ac(Math.PI-$e-Jr,.01,Math.PI-.01)),Gt=Math.min(pr,Rt);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*Gt+Pe),this.nearZ=this.height/50,kt=new Float64Array(16),e.b6(kt,this._fov,this.width/this.height,this.nearZ,this.farZ),kt[8]=2*-L.x/this.width,kt[9]=2*L.y/this.height,this.projectionMatrix=e.ae(kt),e.K(kt,kt,[1,-1,1]),e.J(kt,kt,[0,0,-this.cameraToCenterDistance]),e.b7(kt,kt,this._pitch),e.ad(kt,kt,this.angle),e.J(kt,kt,[-at,-xt,0]),this.mercatorMatrix=e.K([],kt,[this.worldSize,this.worldSize,this.worldSize]),e.K(kt,kt,[1,1,this._pixelPerMeter]),this.pixelMatrix=e.L(new Float64Array(16),this.labelPlaneMatrix,kt),e.J(kt,kt,[0,0,-this.elevation]),this.modelViewProjectionMatrix=kt,this.invModelViewProjectionMatrix=e.as([],kt),this.fogMatrix=new Float64Array(16),e.b6(this.fogMatrix,this._fov,this.width/this.height,Lt,this.farZ),this.fogMatrix[8]=2*-L.x/this.width,this.fogMatrix[9]=2*L.y/this.height,e.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),e.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),e.b7(this.fogMatrix,this.fogMatrix,this._pitch),e.ad(this.fogMatrix,this.fogMatrix,this.angle),e.J(this.fogMatrix,this.fogMatrix,[-at,-xt,0]),e.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),e.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=e.L(new Float64Array(16),this.labelPlaneMatrix,kt);let ae=this.width%2/2,ce=this.height%2/2,Te=Math.cos(this.angle),ye=Math.sin(this.angle),ze=at-Math.round(at)+Te*ae+ye*ce,rr=xt-Math.round(xt)+Te*ce+ye*ae,fr=new Float64Array(kt);if(e.J(fr,fr,[ze>.5?ze-1:ze,rr>.5?rr-1:rr,0]),this.alignedModelViewProjectionMatrix=fr,kt=e.as(new Float64Array(16),this.pixelMatrix),!kt)throw new Error("failed to invert matrix");this.pixelMatrixInverse=kt,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let L=this.pointCoordinate(new e.P(0,0)),at=[L.x*this.worldSize,L.y*this.worldSize,0,1];return e.af(at,at,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let L=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,L))}getCameraQueryGeometry(L){let at=this.getCameraPoint();if(L.length===1)return[L[0],at];{let xt=at.x,kt=at.y,Lt=at.x,le=at.y;for(let xe of L)xt=Math.min(xt,xe.x),kt=Math.min(kt,xe.y),Lt=Math.max(Lt,xe.x),le=Math.max(le,xe.y);return[new e.P(xt,kt),new e.P(Lt,kt),new e.P(Lt,le),new e.P(xt,le),new e.P(xt,kt)]}}lngLatToCameraDepth(L,at){let xt=this.locationCoordinate(L),kt=[xt.x*this.worldSize,xt.y*this.worldSize,at,1];return e.af(kt,kt,this.modelViewProjectionMatrix),kt[2]/kt[3]}}function ic(Pt,L){let at,xt=!1,kt=null,Lt=null,le=()=>{kt=null,xt&&(Pt.apply(Lt,at),kt=setTimeout(le,L),xt=!1)};return(...xe)=>(xt=!0,Lt=this,at=xe,kt||le(),kt)}class Tu{constructor(L){this._getCurrentHash=()=>{let at=window.location.hash.replace("#","");if(this._hashName){let xt;return at.split("&").map(kt=>kt.split("=")).forEach(kt=>{kt[0]===this._hashName&&(xt=kt)}),(xt&&xt[1]||"").split("/")}return at.split("/")},this._onHashChange=()=>{let at=this._getCurrentHash();if(at.length>=3&&!at.some(xt=>isNaN(xt))){let xt=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(at[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+at[2],+at[1]],zoom:+at[0],bearing:xt,pitch:+(at[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{let at=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,at)},this._removeHash=()=>{let at=this._getCurrentHash();if(at.length===0)return;let xt=at.join("/"),kt=xt;kt.split("&").length>0&&(kt=kt.split("&")[0]),this._hashName&&(kt=`${this._hashName}=${xt}`);let Lt=window.location.hash.replace(kt,"");Lt.startsWith("#&")?Lt=Lt.slice(0,1)+Lt.slice(2):Lt==="#"&&(Lt="");let le=window.location.href.replace(/(#.+)?$/,Lt);le=le.replace("&&","&"),window.history.replaceState(window.history.state,null,le)},this._updateHash=ic(this._updateHashUnthrottled,300),this._hashName=L&&encodeURIComponent(L)}addTo(L){return this._map=L,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(L){let at=this._map.getCenter(),xt=Math.round(100*this._map.getZoom())/100,kt=Math.ceil((xt*Math.LN2+Math.log(512/360/.5))/Math.LN10),Lt=Math.pow(10,kt),le=Math.round(at.lng*Lt)/Lt,xe=Math.round(at.lat*Lt)/Lt,Pe=this._map.getBearing(),$e=this._map.getPitch(),hr="";if(hr+=L?`/${le}/${xe}/${xt}`:`${xt}/${xe}/${le}`,(Pe||$e)&&(hr+="/"+Math.round(10*Pe)/10),$e&&(hr+=`/${Math.round($e)}`),this._hashName){let pr=this._hashName,Br=!1,Jr=window.location.hash.slice(1).split("&").map(Rt=>{let Gt=Rt.split("=")[0];return Gt===pr?(Br=!0,`${Gt}=${hr}`):Rt}).filter(Rt=>Rt);return Br||Jr.push(`${pr}=${hr}`),`#${Jr.join("&")}`}return`#${hr}`}}let Ku={linearity:.3,easing:e.b8(0,0,.3,1)},wc=e.e({deceleration:2500,maxSpeed:1400},Ku),uf=e.e({deceleration:20,maxSpeed:1400},Ku),Sf=e.e({deceleration:1e3,maxSpeed:360},Ku),oc=e.e({deceleration:1e3,maxSpeed:90},Ku);class Tc{constructor(L){this._map=L,this.clear()}clear(){this._inertiaBuffer=[]}record(L){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.now(),settings:L})}_drainInertiaBuffer(){let L=this._inertiaBuffer,at=o.now();for(;L.length>0&&at-L[0].time>160;)L.shift()}_onMoveEnd(L){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let at={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:Lt}of this._inertiaBuffer)at.zoom+=Lt.zoomDelta||0,at.bearing+=Lt.bearingDelta||0,at.pitch+=Lt.pitchDelta||0,Lt.panDelta&&at.pan._add(Lt.panDelta),Lt.around&&(at.around=Lt.around),Lt.pinchAround&&(at.pinchAround=Lt.pinchAround);let xt=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,kt={};if(at.pan.mag()){let Lt=sc(at.pan.mag(),xt,e.e({},wc,L||{}));kt.offset=at.pan.mult(Lt.amount/at.pan.mag()),kt.center=this._map.transform.center,Fl(kt,Lt)}if(at.zoom){let Lt=sc(at.zoom,xt,uf);kt.zoom=this._map.transform.zoom+Lt.amount,Fl(kt,Lt)}if(at.bearing){let Lt=sc(at.bearing,xt,Sf);kt.bearing=this._map.transform.bearing+e.ac(Lt.amount,-179,179),Fl(kt,Lt)}if(at.pitch){let Lt=sc(at.pitch,xt,oc);kt.pitch=this._map.transform.pitch+Lt.amount,Fl(kt,Lt)}if(kt.zoom||kt.bearing){let Lt=at.pinchAround===void 0?at.around:at.pinchAround;kt.around=Lt?this._map.unproject(Lt):this._map.getCenter()}return this.clear(),e.e(kt,{noMoveStart:!0})}}function Fl(Pt,L){(!Pt.duration||Pt.durationat.unproject(Pe)),xe=Lt.reduce((Pe,$e,hr,pr)=>Pe.add($e.div(pr.length)),new e.P(0,0));super(L,{points:Lt,point:xe,lngLats:le,lngLat:at.unproject(xe),originalEvent:xt}),this._defaultPrevented=!1}}class kc extends e.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(L,at,xt){super(L,{originalEvent:xt}),this._defaultPrevented=!1}}class ku{constructor(L,at){this._map=L,this._clickTolerance=at.clickTolerance}reset(){delete this._mousedownPos}wheel(L){return this._firePreventable(new kc(L.type,this._map,L))}mousedown(L,at){return this._mousedownPos=at,this._firePreventable(new iu(L.type,this._map,L))}mouseup(L){this._map.fire(new iu(L.type,this._map,L))}click(L,at){this._mousedownPos&&this._mousedownPos.dist(at)>=this._clickTolerance||this._map.fire(new iu(L.type,this._map,L))}dblclick(L){return this._firePreventable(new iu(L.type,this._map,L))}mouseover(L){this._map.fire(new iu(L.type,this._map,L))}mouseout(L){this._map.fire(new iu(L.type,this._map,L))}touchstart(L){return this._firePreventable(new lc(L.type,this._map,L))}touchmove(L){this._map.fire(new lc(L.type,this._map,L))}touchend(L){this._map.fire(new lc(L.type,this._map,L))}touchcancel(L){this._map.fire(new lc(L.type,this._map,L))}_firePreventable(L){if(this._map.fire(L),L.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Gs{constructor(L){this._map=L}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(L){this._map.fire(new iu(L.type,this._map,L))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new iu("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(L){this._delayContextMenu?this._contextMenuEvent=L:this._ignoreContextMenu||this._map.fire(new iu(L.type,this._map,L)),this._map.listens("contextmenu")&&L.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Du{constructor(L){this._map=L}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(L){return this.transform.pointLocation(e.P.convert(L),this._map.terrain)}}class Xl{constructor(L,at){this._map=L,this._tr=new Du(L),this._el=L.getCanvasContainer(),this._container=L.getContainer(),this._clickTolerance=at.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(L,at){this.isEnabled()&&L.shiftKey&&L.button===0&&(a.disableDrag(),this._startPos=this._lastPos=at,this._active=!0)}mousemoveWindow(L,at){if(!this._active)return;let xt=at;if(this._lastPos.equals(xt)||!this._box&&xt.dist(this._startPos)Lt.fitScreenCoordinates(xt,kt,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",L)}keydown(L){this._active&&L.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",L))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(a.remove(this._box),this._box=null),a.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(L,at){return this._map.fire(new e.k(L,{originalEvent:at}))}}function $c(Pt,L){if(Pt.length!==L.length)throw new Error(`The number of touches and points are not equal - touches ${Pt.length}, points ${L.length}`);let at={};for(let xt=0;xtthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=L.timeStamp),xt.length===this.numTouches&&(this.centroid=(function(kt){let Lt=new e.P(0,0);for(let le of kt)Lt._add(le);return Lt.div(kt.length)})(at),this.touches=$c(xt,at)))}touchmove(L,at,xt){if(this.aborted||!this.centroid)return;let kt=$c(xt,at);for(let Lt in this.touches){let le=kt[Lt];(!le||le.dist(this.touches[Lt])>30)&&(this.aborted=!0)}}touchend(L,at,xt){if((!this.centroid||L.timeStamp-this.startTime>500)&&(this.aborted=!0),xt.length===0){let kt=!this.aborted&&this.centroid;if(this.reset(),kt)return kt}}}class yc{constructor(L){this.singleTap=new Vs(L),this.numTaps=L.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(L,at,xt){this.singleTap.touchstart(L,at,xt)}touchmove(L,at,xt){this.singleTap.touchmove(L,at,xt)}touchend(L,at,xt){let kt=this.singleTap.touchend(L,at,xt);if(kt){let Lt=L.timeStamp-this.lastTime<500,le=!this.lastTap||this.lastTap.dist(kt)<30;if(Lt&&le||this.reset(),this.count++,this.lastTime=L.timeStamp,this.lastTap=kt,this.count===this.numTaps)return this.reset(),kt}}}class Yu{constructor(L){this._tr=new Du(L),this._zoomIn=new yc({numTouches:1,numTaps:2}),this._zoomOut=new yc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(L,at,xt){this._zoomIn.touchstart(L,at,xt),this._zoomOut.touchstart(L,at,xt)}touchmove(L,at,xt){this._zoomIn.touchmove(L,at,xt),this._zoomOut.touchmove(L,at,xt)}touchend(L,at,xt){let kt=this._zoomIn.touchend(L,at,xt),Lt=this._zoomOut.touchend(L,at,xt),le=this._tr;return kt?(this._active=!0,L.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:xe=>xe.easeTo({duration:300,zoom:le.zoom+1,around:le.unproject(kt)},{originalEvent:L})}):Lt?(this._active=!0,L.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:xe=>xe.easeTo({duration:300,zoom:le.zoom-1,around:le.unproject(Lt)},{originalEvent:L})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ou{constructor(L){this._enabled=!!L.enable,this._moveStateManager=L.moveStateManager,this._clickTolerance=L.clickTolerance||1,this._moveFunction=L.move,this._activateOnStart=!!L.activateOnStart,L.assignEvents(this),this.reset()}reset(L){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(L)}_move(...L){let at=this._moveFunction(...L);if(at.bearingDelta||at.pitchDelta||at.around||at.panDelta)return this._active=!0,at}dragStart(L,at){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(L)&&(this._moveStateManager.startMove(L),this._lastPoint=at.length?at[0]:at,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(L,at){if(!this.isEnabled())return;let xt=this._lastPoint;if(!xt)return;if(L.preventDefault(),!this._moveStateManager.isValidMoveEvent(L))return void this.reset(L);let kt=at.length?at[0]:at;return!this._moved&&kt.dist(xt){Pt.mousedown=Pt.dragStart,Pt.mousemoveWindow=Pt.dragMove,Pt.mouseup=Pt.dragEnd,Pt.contextmenu=L=>{L.preventDefault()}},zl=({enable:Pt,clickTolerance:L,bearingDegreesPerPixelMoved:at=.8})=>{let xt=new Xu({checkCorrectEvent:kt=>a.mouseButton(kt)===0&&kt.ctrlKey||a.mouseButton(kt)===2});return new ou({clickTolerance:L,move:(kt,Lt)=>({bearingDelta:(Lt.x-kt.x)*at}),moveStateManager:xt,enable:Pt,assignEvents:cf})},Vc=({enable:Pt,clickTolerance:L,pitchDegreesPerPixelMoved:at=-.5})=>{let xt=new Xu({checkCorrectEvent:kt=>a.mouseButton(kt)===0&&kt.ctrlKey||a.mouseButton(kt)===2});return new ou({clickTolerance:L,move:(kt,Lt)=>({pitchDelta:(Lt.y-kt.y)*at}),moveStateManager:xt,enable:Pt,assignEvents:cf})};class su{constructor(L,at){this._clickTolerance=L.clickTolerance||1,this._map=at,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}_shouldBePrevented(L){return L<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(L,at,xt){return this._calculateTransform(L,at,xt)}touchmove(L,at,xt){if(this._active){if(!this._shouldBePrevented(xt.length))return L.preventDefault(),this._calculateTransform(L,at,xt);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",L)}}touchend(L,at,xt){this._calculateTransform(L,at,xt),this._active&&this._shouldBePrevented(xt.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(L,at,xt){xt.length>0&&(this._active=!0);let kt=$c(xt,at),Lt=new e.P(0,0),le=new e.P(0,0),xe=0;for(let $e in kt){let hr=kt[$e],pr=this._touches[$e];pr&&(Lt._add(hr),le._add(hr.sub(pr)),xe++,kt[$e]=hr)}if(this._touches=kt,this._shouldBePrevented(xe)||!le.mag())return;let Pe=le.div(xe);return this._sum._add(Pe),this._sum.mag()Math.abs(Pt.x)}class Dc extends Fu{constructor(L){super(),this._currentTouchCount=0,this._map=L}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(L,at,xt){super.touchstart(L,at,xt),this._currentTouchCount=xt.length}_start(L){this._lastPoints=L,Su(L[0].sub(L[1]))&&(this._valid=!1)}_move(L,at,xt){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let kt=L[0].sub(this._lastPoints[0]),Lt=L[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(kt,Lt,xt.timeStamp),this._valid?(this._lastPoints=L,this._active=!0,{pitchDelta:(kt.y+Lt.y)/2*-.5}):void 0}gestureBeginsVertically(L,at,xt){if(this._valid!==void 0)return this._valid;let kt=L.mag()>=2,Lt=at.mag()>=2;if(!kt&&!Lt)return;if(!kt||!Lt)return this._firstMove===void 0&&(this._firstMove=xt),xt-this._firstMove<100&&void 0;let le=L.y>0==at.y>0;return Su(L)&&Su(at)&&le}}let Xe={panStep:100,bearingStep:15,pitchStep:10};class yr{constructor(L){this._tr=new Du(L);let at=Xe;this._panStep=at.panStep,this._bearingStep=at.bearingStep,this._pitchStep=at.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(L){if(L.altKey||L.ctrlKey||L.metaKey)return;let at=0,xt=0,kt=0,Lt=0,le=0;switch(L.keyCode){case 61:case 107:case 171:case 187:at=1;break;case 189:case 109:case 173:at=-1;break;case 37:L.shiftKey?xt=-1:(L.preventDefault(),Lt=-1);break;case 39:L.shiftKey?xt=1:(L.preventDefault(),Lt=1);break;case 38:L.shiftKey?kt=1:(L.preventDefault(),le=-1);break;case 40:L.shiftKey?kt=-1:(L.preventDefault(),le=1);break;default:return}return this._rotationDisabled&&(xt=0,kt=0),{cameraAnimation:xe=>{let Pe=this._tr;xe.easeTo({duration:300,easeId:"keyboardHandler",easing:Kr,zoom:at?Math.round(Pe.zoom)+at*(L.shiftKey?2:1):Pe.zoom,bearing:Pe.bearing+xt*this._bearingStep,pitch:Pe.pitch+kt*this._pitchStep,offset:[-Lt*this._panStep,-le*this._panStep],center:Pe.center},{originalEvent:L})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Kr(Pt){return Pt*(2-Pt)}let Rr=4.000244140625;class mn{constructor(L,at){this._onTimeout=xt=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(xt)},this._map=L,this._tr=new Du(L),this._triggerRenderFrame=at,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(L){this._defaultZoomRate=L}setWheelZoomRate(L){this._wheelZoomRate=L}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(L){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!L&&L.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(L){return!!this._map.cooperativeGestures.isEnabled()&&!(L.ctrlKey||this._map.cooperativeGestures.isBypassed(L))}wheel(L){if(!this.isEnabled())return;if(this._shouldBePrevented(L))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",L);let at=L.deltaMode===WheelEvent.DOM_DELTA_LINE?40*L.deltaY:L.deltaY,xt=o.now(),kt=xt-(this._lastWheelEventTime||0);this._lastWheelEventTime=xt,at!==0&&at%Rr==0?this._type="wheel":at!==0&&Math.abs(at)<4?this._type="trackpad":kt>400?(this._type=null,this._lastValue=at,this._timeout=setTimeout(this._onTimeout,40,L)):this._type||(this._type=Math.abs(kt*at)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,at+=this._lastValue)),L.shiftKey&&at&&(at/=4),this._type&&(this._lastWheelEvent=L,this._delta-=at,this._active||this._start(L)),L.preventDefault()}_start(L){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let at=a.mousePos(this._map.getCanvas(),L),xt=this._tr;this._around=at.y>xt.transform.height/2-xt.transform.getHorizon()?e.N.convert(this._aroundCenter?xt.center:xt.unproject(at)):e.N.convert(xt.center),this._aroundPoint=xt.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let L=this._tr.transform;if(this._delta!==0){let Pe=this._type==="wheel"&&Math.abs(this._delta)>Rr?this._wheelZoomRate:this._defaultZoomRate,$e=2/(1+Math.exp(-Math.abs(this._delta*Pe)));this._delta<0&&$e!==0&&($e=1/$e);let hr=typeof this._targetZoom=="number"?L.zoomScale(this._targetZoom):L.scale;this._targetZoom=Math.min(L.maxZoom,Math.max(L.minZoom,L.scaleZoom(hr*$e))),this._type==="wheel"&&(this._startZoom=L.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let at=typeof this._targetZoom=="number"?this._targetZoom:L.zoom,xt=this._startZoom,kt=this._easing,Lt,le=!1,xe=o.now()-this._lastWheelEventTime;if(this._type==="wheel"&&xt&&kt&&xe){let Pe=Math.min(xe/200,1),$e=kt(Pe);Lt=e.y.number(xt,at,$e),Pe<1?this._frameId||(this._frameId=!0):le=!0}else Lt=at,le=!0;return this._active=!0,le&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!le,zoomDelta:Lt-L.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(L){let at=e.b9;if(this._prevEase){let xt=this._prevEase,kt=(o.now()-xt.start)/xt.duration,Lt=xt.easing(kt+.01)-xt.easing(kt),le=.27/Math.sqrt(Lt*Lt+1e-4)*.01,xe=Math.sqrt(.0729-le*le);at=e.b8(le,xe,.25,1)}return this._prevEase={start:o.now(),duration:L,easing:at},at}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Pn{constructor(L,at){this._clickZoom=L,this._tapZoom=at}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class ha{constructor(L){this._tr=new Du(L),this.reset()}reset(){this._active=!1}dblclick(L,at){return L.preventDefault(),{cameraAnimation:xt=>{xt.easeTo({duration:300,zoom:this._tr.zoom+(L.shiftKey?-1:1),around:this._tr.unproject(at)},{originalEvent:L})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ta{constructor(){this._tap=new yc({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(L,at,xt){if(!this._swipePoint)if(this._tapTime){let kt=at[0],Lt=L.timeStamp-this._tapTime<500,le=this._tapPoint.dist(kt)<30;Lt&&le?xt.length>0&&(this._swipePoint=kt,this._swipeTouch=xt[0].identifier):this.reset()}else this._tap.touchstart(L,at,xt)}touchmove(L,at,xt){if(this._tapTime){if(this._swipePoint){if(xt[0].identifier!==this._swipeTouch)return;let kt=at[0],Lt=kt.y-this._swipePoint.y;return this._swipePoint=kt,L.preventDefault(),this._active=!0,{zoomDelta:Lt/128}}}else this._tap.touchmove(L,at,xt)}touchend(L,at,xt){if(this._tapTime)this._swipePoint&&xt.length===0&&this.reset();else{let kt=this._tap.touchend(L,at,xt);kt&&(this._tapTime=L.timeStamp,this._tapPoint=kt)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ua{constructor(L,at,xt){this._el=L,this._mousePan=at,this._touchPan=xt}enable(L){this._inertiaOptions=L||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Ya{constructor(L,at,xt){this._pitchWithRotate=L.pitchWithRotate,this._mouseRotate=at,this._mousePitch=xt}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class va{constructor(L,at,xt,kt){this._el=L,this._touchZoom=at,this._touchRotate=xt,this._tapDragZoom=kt,this._rotationDisabled=!1,this._enabled=!0}enable(L){this._touchZoom.enable(L),this._rotationDisabled||this._touchRotate.enable(L),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Ba{constructor(L,at){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=L,this._options=at,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let L=this._map.getCanvasContainer();L.classList.add("maplibregl-cooperative-gestures"),this._container=a.create("div","maplibregl-cooperative-gesture-screen",L);let at=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(at=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let xt=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),kt=document.createElement("div");kt.className="maplibregl-desktop-message",kt.textContent=at,this._container.appendChild(kt);let Lt=document.createElement("div");Lt.className="maplibregl-mobile-message",Lt.textContent=xt,this._container.appendChild(Lt),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(a.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(L){return L[this._bypassKey]}notifyGestureBlocked(L,at){this._enabled&&(this._map.fire(new e.k("cooperativegestureprevented",{gestureType:L,originalEvent:at})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let za=Pt=>Pt.zoom||Pt.drag||Pt.pitch||Pt.rotate;class ca extends e.k{}function ei(Pt){return Pt.panDelta&&Pt.panDelta.mag()||Pt.zoomDelta||Pt.bearingDelta||Pt.pitchDelta}class Vi{constructor(L,at){this.handleWindowEvent=kt=>{this.handleEvent(kt,`${kt.type}Window`)},this.handleEvent=(kt,Lt)=>{if(kt.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let le=kt.type==="renderFrame"?void 0:kt,xe={needsRenderFrame:!1},Pe={},$e={},hr=kt.touches,pr=hr?this._getMapTouches(hr):void 0,Br=pr?a.touchPos(this._map.getCanvas(),pr):a.mousePos(this._map.getCanvas(),kt);for(let{handlerName:Gt,handler:ae,allowed:ce}of this._handlers){if(!ae.isEnabled())continue;let Te;this._blockedByActive($e,ce,Gt)?ae.reset():ae[Lt||kt.type]&&(Te=ae[Lt||kt.type](kt,Br,pr),this.mergeHandlerResult(xe,Pe,Te,Gt,le),Te&&Te.needsRenderFrame&&this._triggerRenderFrame()),(Te||ae.isActive())&&($e[Gt]=ae)}let Jr={};for(let Gt in this._previousActiveHandlers)$e[Gt]||(Jr[Gt]=le);this._previousActiveHandlers=$e,(Object.keys(Jr).length||ei(xe))&&(this._changes.push([xe,Pe,Jr]),this._triggerRenderFrame()),(Object.keys($e).length||ei(xe))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:Rt}=xe;Rt&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],Rt(this._map))},this._map=L,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Tc(L),this._bearingSnap=at.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(at);let xt=this._el;this._listeners=[[xt,"touchstart",{passive:!0}],[xt,"touchmove",{passive:!1}],[xt,"touchend",void 0],[xt,"touchcancel",void 0],[xt,"mousedown",void 0],[xt,"mousemove",void 0],[xt,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[xt,"mouseover",void 0],[xt,"mouseout",void 0],[xt,"dblclick",void 0],[xt,"click",void 0],[xt,"keydown",{capture:!1}],[xt,"keyup",void 0],[xt,"wheel",{passive:!1}],[xt,"contextmenu",void 0],[window,"blur",void 0]];for(let[kt,Lt,le]of this._listeners)a.addEventListener(kt,Lt,kt===document?this.handleWindowEvent:this.handleEvent,le)}destroy(){for(let[L,at,xt]of this._listeners)a.removeEventListener(L,at,L===document?this.handleWindowEvent:this.handleEvent,xt)}_addDefaultHandlers(L){let at=this._map,xt=at.getCanvasContainer();this._add("mapEvent",new ku(at,L));let kt=at.boxZoom=new Xl(at,L);this._add("boxZoom",kt),L.interactive&&L.boxZoom&&kt.enable();let Lt=at.cooperativeGestures=new Ba(at,L.cooperativeGestures);this._add("cooperativeGestures",Lt),L.cooperativeGestures&&Lt.enable();let le=new Yu(at),xe=new ha(at);at.doubleClickZoom=new Pn(xe,le),this._add("tapZoom",le),this._add("clickZoom",xe),L.interactive&&L.doubleClickZoom&&at.doubleClickZoom.enable();let Pe=new Ta;this._add("tapDragZoom",Pe);let $e=at.touchPitch=new Dc(at);this._add("touchPitch",$e),L.interactive&&L.touchPitch&&at.touchPitch.enable(L.touchPitch);let hr=zl(L),pr=Vc(L);at.dragRotate=new Ya(L,hr,pr),this._add("mouseRotate",hr,["mousePitch"]),this._add("mousePitch",pr,["mouseRotate"]),L.interactive&&L.dragRotate&&at.dragRotate.enable();let Br=(({enable:Te,clickTolerance:ye})=>{let ze=new Xu({checkCorrectEvent:rr=>a.mouseButton(rr)===0&&!rr.ctrlKey});return new ou({clickTolerance:ye,move:(rr,fr)=>({around:fr,panDelta:fr.sub(rr)}),activateOnStart:!0,moveStateManager:ze,enable:Te,assignEvents:cf})})(L),Jr=new su(L,at);at.dragPan=new Ua(xt,Br,Jr),this._add("mousePan",Br),this._add("touchPan",Jr,["touchZoom","touchRotate"]),L.interactive&&L.dragPan&&at.dragPan.enable(L.dragPan);let Rt=new uc,Gt=new Cs;at.touchZoomRotate=new va(xt,Gt,Rt,Pe),this._add("touchRotate",Rt,["touchPan","touchZoom"]),this._add("touchZoom",Gt,["touchPan","touchRotate"]),L.interactive&&L.touchZoomRotate&&at.touchZoomRotate.enable(L.touchZoomRotate);let ae=at.scrollZoom=new mn(at,()=>this._triggerRenderFrame());this._add("scrollZoom",ae,["mousePan"]),L.interactive&&L.scrollZoom&&at.scrollZoom.enable(L.scrollZoom);let ce=at.keyboard=new yr(at);this._add("keyboard",ce),L.interactive&&L.keyboard&&at.keyboard.enable(),this._add("blockableMapEvent",new Gs(at))}_add(L,at,xt){this._handlers.push({handlerName:L,handler:at,allowed:xt}),this._handlersById[L]=at}stop(L){if(!this._updatingCamera){for(let{handler:at}of this._handlers)at.reset();this._inertia.clear(),this._fireEvents({},{},L),this._changes=[]}}isActive(){for(let{handler:L}of this._handlers)if(L.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!za(this._eventsInProgress)||this.isZooming()}_blockedByActive(L,at,xt){for(let kt in L)if(kt!==xt&&(!at||at.indexOf(kt)<0))return!0;return!1}_getMapTouches(L){let at=[];for(let xt of L)this._el.contains(xt.target)&&at.push(xt);return at}mergeHandlerResult(L,at,xt,kt,Lt){if(!xt)return;e.e(L,xt);let le={handlerName:kt,originalEvent:xt.originalEvent||Lt};xt.zoomDelta!==void 0&&(at.zoom=le),xt.panDelta!==void 0&&(at.drag=le),xt.pitchDelta!==void 0&&(at.pitch=le),xt.bearingDelta!==void 0&&(at.rotate=le)}_applyChanges(){let L={},at={},xt={};for(let[kt,Lt,le]of this._changes)kt.panDelta&&(L.panDelta=(L.panDelta||new e.P(0,0))._add(kt.panDelta)),kt.zoomDelta&&(L.zoomDelta=(L.zoomDelta||0)+kt.zoomDelta),kt.bearingDelta&&(L.bearingDelta=(L.bearingDelta||0)+kt.bearingDelta),kt.pitchDelta&&(L.pitchDelta=(L.pitchDelta||0)+kt.pitchDelta),kt.around!==void 0&&(L.around=kt.around),kt.pinchAround!==void 0&&(L.pinchAround=kt.pinchAround),kt.noInertia&&(L.noInertia=kt.noInertia),e.e(at,Lt),e.e(xt,le);this._updateMapTransform(L,at,xt),this._changes=[]}_updateMapTransform(L,at,xt){let kt=this._map,Lt=kt._getTransformForUpdate(),le=kt.terrain;if(!(ei(L)||le&&this._terrainMovement))return this._fireEvents(at,xt,!0);let{panDelta:xe,zoomDelta:Pe,bearingDelta:$e,pitchDelta:hr,around:pr,pinchAround:Br}=L;Br!==void 0&&(pr=Br),kt._stop(!0),pr=pr||kt.transform.centerPoint;let Jr=Lt.pointLocation(xe?pr.sub(xe):pr);$e&&(Lt.bearing+=$e),hr&&(Lt.pitch+=hr),Pe&&(Lt.zoom+=Pe),le?this._terrainMovement||!at.drag&&!at.zoom?at.drag&&this._terrainMovement?Lt.center=Lt.pointLocation(Lt.centerPoint.sub(xe)):Lt.setLocationAtPoint(Jr,pr):(this._terrainMovement=!0,this._map._elevationFreeze=!0,Lt.setLocationAtPoint(Jr,pr)):Lt.setLocationAtPoint(Jr,pr),kt._applyUpdatedTransform(Lt),this._map._update(),L.noInertia||this._inertia.record(L),this._fireEvents(at,xt,!0)}_fireEvents(L,at,xt){let kt=za(this._eventsInProgress),Lt=za(L),le={};for(let pr in L){let{originalEvent:Br}=L[pr];this._eventsInProgress[pr]||(le[`${pr}start`]=Br),this._eventsInProgress[pr]=L[pr]}!kt&&Lt&&this._fireEvent("movestart",Lt.originalEvent);for(let pr in le)this._fireEvent(pr,le[pr]);Lt&&this._fireEvent("move",Lt.originalEvent);for(let pr in L){let{originalEvent:Br}=L[pr];this._fireEvent(pr,Br)}let xe={},Pe;for(let pr in this._eventsInProgress){let{handlerName:Br,originalEvent:Jr}=this._eventsInProgress[pr];this._handlersById[Br].isActive()||(delete this._eventsInProgress[pr],Pe=at[Br]||Jr,xe[`${pr}end`]=Pe)}for(let pr in xe)this._fireEvent(pr,xe[pr]);let $e=za(this._eventsInProgress),hr=(kt||Lt)&&!$e;if(hr&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let pr=this._map._getTransformForUpdate();pr.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(pr)}if(xt&&hr){this._updatingCamera=!0;let pr=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),Br=Jr=>Jr!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new ca("renderFrame",{timeStamp:L})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Oi extends e.E{constructor(L,at){super(),this._renderFrameCallback=()=>{let xt=Math.min((o.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(xt)),xt<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=L,this._bearingSnap=at.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new e.N(this.transform.center.lng,this.transform.center.lat)}setCenter(L,at){return this.jumpTo({center:L},at)}panBy(L,at,xt){return L=e.P.convert(L).mult(-1),this.panTo(this.transform.center,e.e({offset:L},at),xt)}panTo(L,at,xt){return this.easeTo(e.e({center:L},at),xt)}getZoom(){return this.transform.zoom}setZoom(L,at){return this.jumpTo({zoom:L},at),this}zoomTo(L,at,xt){return this.easeTo(e.e({zoom:L},at),xt)}zoomIn(L,at){return this.zoomTo(this.getZoom()+1,L,at),this}zoomOut(L,at){return this.zoomTo(this.getZoom()-1,L,at),this}getBearing(){return this.transform.bearing}setBearing(L,at){return this.jumpTo({bearing:L},at),this}getPadding(){return this.transform.padding}setPadding(L,at){return this.jumpTo({padding:L},at),this}rotateTo(L,at,xt){return this.easeTo(e.e({bearing:L},at),xt)}resetNorth(L,at){return this.rotateTo(0,e.e({duration:1e3},L),at),this}resetNorthPitch(L,at){return this.easeTo(e.e({bearing:0,pitch:0,duration:1e3},L),at),this}snapToNorth(L,at){return Math.abs(this.getBearing()){if(this._zooming&&(kt.zoom=e.y.number(Lt,ae,gr)),this._rotating&&(kt.bearing=e.y.number(le,$e,gr)),this._pitching&&(kt.pitch=e.y.number(xe,hr,gr)),this._padding&&(kt.interpolatePadding(Pe,pr,gr),Jr=kt.centerPoint.add(Br)),this.terrain&&!L.freezeElevation&&this._updateElevation(gr),ze)kt.setLocationAtPoint(ze,rr);else{let Lr=kt.zoomScale(kt.zoom-Lt),Hr=ae>Lt?Math.min(2,ye):Math.max(.5,ye),nn=Math.pow(Hr,1-gr),cn=kt.unproject(ce.add(Te.mult(gr*nn)).mult(Lr));kt.setLocationAtPoint(kt.renderWorldCopies?cn.wrap():cn,Jr)}this._applyUpdatedTransform(kt),this._fireMoveEvents(at)},gr=>{this.terrain&&L.freezeElevation&&this._finalizeElevation(),this._afterEase(at,gr)},L),this}_prepareEase(L,at,xt={}){this._moving=!0,at||xt.moving||this.fire(new e.k("movestart",L)),this._zooming&&!xt.zooming&&this.fire(new e.k("zoomstart",L)),this._rotating&&!xt.rotating&&this.fire(new e.k("rotatestart",L)),this._pitching&&!xt.pitching&&this.fire(new e.k("pitchstart",L))}_prepareElevation(L){this._elevationCenter=L,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(L,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(L){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let at=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(L<1&&at!==this._elevationTarget){let xt=this._elevationTarget-this._elevationStart;this._elevationStart+=L*(xt-(at-(xt*L+this._elevationStart))/(1-L)),this._elevationTarget=at}this.transform.elevation=e.y.number(this._elevationStart,this._elevationTarget,L)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(L){let at=L.getCameraPosition(),xt=this.terrain.getElevationForLngLatZoom(at.lngLat,L.zoom);if(at.altitudethis._elevateCameraIfInsideTerrain(kt)),this.transformCameraUpdate&&at.push(kt=>this.transformCameraUpdate(kt)),!at.length)return;let xt=L.clone();for(let kt of at){let Lt=xt.clone(),{center:le,zoom:xe,pitch:Pe,bearing:$e,elevation:hr}=kt(Lt);le&&(Lt.center=le),xe!==void 0&&(Lt.zoom=xe),Pe!==void 0&&(Lt.pitch=Pe),$e!==void 0&&(Lt.bearing=$e),hr!==void 0&&(Lt.elevation=hr),xt.apply(Lt)}this.transform.apply(xt)}_fireMoveEvents(L){this.fire(new e.k("move",L)),this._zooming&&this.fire(new e.k("zoom",L)),this._rotating&&this.fire(new e.k("rotate",L)),this._pitching&&this.fire(new e.k("pitch",L))}_afterEase(L,at){if(this._easeId&&at&&this._easeId===at)return;delete this._easeId;let xt=this._zooming,kt=this._rotating,Lt=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,xt&&this.fire(new e.k("zoomend",L)),kt&&this.fire(new e.k("rotateend",L)),Lt&&this.fire(new e.k("pitchend",L)),this.fire(new e.k("moveend",L))}flyTo(L,at){var xt;if(!L.essential&&o.prefersReducedMotion){let La=e.M(L,["center","zoom","bearing","pitch","around"]);return this.jumpTo(La,at)}this.stop(),L=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.b9},L);let kt=this._getTransformForUpdate(),Lt=kt.zoom,le=kt.bearing,xe=kt.pitch,Pe=kt.padding,$e="bearing"in L?this._normalizeBearing(L.bearing,le):le,hr="pitch"in L?+L.pitch:xe,pr="padding"in L?L.padding:kt.padding,Br=e.P.convert(L.offset),Jr=kt.centerPoint.add(Br),Rt=kt.pointLocation(Jr),{center:Gt,zoom:ae}=kt.getConstrained(e.N.convert(L.center||Rt),(xt=L.zoom)!==null&&xt!==void 0?xt:Lt);this._normalizeCenter(Gt,kt);let ce=kt.zoomScale(ae-Lt),Te=kt.project(Rt),ye=kt.project(Gt).sub(Te),ze=L.curve,rr=Math.max(kt.width,kt.height),fr=rr/ce,gr=ye.mag();if("minZoom"in L){let La=e.ac(Math.min(L.minZoom,Lt,ae),kt.minZoom,kt.maxZoom),ai=rr/kt.zoomScale(La-Lt);ze=Math.sqrt(ai/gr*2)}let Lr=ze*ze;function Hr(La){let ai=(fr*fr-rr*rr+(La?-1:1)*Lr*Lr*gr*gr)/(2*(La?fr:rr)*Lr*gr);return Math.log(Math.sqrt(ai*ai+1)-ai)}function nn(La){return(Math.exp(La)-Math.exp(-La))/2}function cn(La){return(Math.exp(La)+Math.exp(-La))/2}let Mn=Hr(!1),Jn=function(La){return cn(Mn)/cn(Mn+ze*La)},_a=function(La){return rr*((cn(Mn)*(nn(ai=Mn+ze*La)/cn(ai))-nn(Mn))/Lr)/gr;var ai},xa=(Hr(!0)-Mn)/ze;if(Math.abs(gr)<1e-6||!isFinite(xa)){if(Math.abs(rr-fr)<1e-6)return this.easeTo(L,at);let La=fr0,Jn=ai=>Math.exp(La*ze*ai)}return L.duration="duration"in L?+L.duration:1e3*xa/("screenSpeed"in L?+L.screenSpeed/ze:+L.speed),L.maxDuration&&L.duration>L.maxDuration&&(L.duration=0),this._zooming=!0,this._rotating=le!==$e,this._pitching=hr!==xe,this._padding=!kt.isPaddingEqual(pr),this._prepareEase(at,!1),this.terrain&&this._prepareElevation(Gt),this._ease(La=>{let ai=La*xa,Ai=1/Jn(ai);kt.zoom=La===1?ae:Lt+kt.scaleZoom(Ai),this._rotating&&(kt.bearing=e.y.number(le,$e,La)),this._pitching&&(kt.pitch=e.y.number(xe,hr,La)),this._padding&&(kt.interpolatePadding(Pe,pr,La),Jr=kt.centerPoint.add(Br)),this.terrain&&!L.freezeElevation&&this._updateElevation(La);let mi=La===1?Gt:kt.unproject(Te.add(ye.mult(_a(ai))).mult(Ai));kt.setLocationAtPoint(kt.renderWorldCopies?mi.wrap():mi,Jr),this._applyUpdatedTransform(kt),this._fireMoveEvents(at)},()=>{this.terrain&&L.freezeElevation&&this._finalizeElevation(),this._afterEase(at)},L),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(L,at){var xt;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let kt=this._onEaseEnd;delete this._onEaseEnd,kt.call(this,at)}return L||(xt=this.handlers)===null||xt===void 0||xt.stop(!1),this}_ease(L,at,xt){xt.animate===!1||xt.duration===0?(L(1),at()):(this._easeStart=o.now(),this._easeOptions=xt,this._onEaseFrame=L,this._onEaseEnd=at,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(L,at){L=e.b3(L,-180,180);let xt=Math.abs(L-at);return Math.abs(L-360-at)180?-360:xt<-180?360:0}queryTerrainElevation(L){return this.terrain?this.terrain.getElevationForLngLatZoom(e.N.convert(L),this.transform.tileZoom)-this.transform.elevation:null}}let Wi={compact:!0,customAttribution:'MapLibre'};class Xi{constructor(L=Wi){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=at=>{!at||at.sourceDataType!=="metadata"&&at.sourceDataType!=="visibility"&&at.dataType!=="style"&&at.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=L}getDefaultPosition(){return"bottom-right"}onAdd(L){return this._map=L,this._compact=this.options.compact,this._container=a.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=a.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=a.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){a.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(L,at){let xt=this._map._getUIString(`AttributionControl.${at}`);L.title=xt,L.setAttribute("aria-label",xt)}_updateAttributions(){if(!this._map.style)return;let L=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?L=L.concat(this.options.customAttribution.map(kt=>typeof kt!="string"?"":kt)):typeof this.options.customAttribution=="string"&&L.push(this.options.customAttribution)),this._map.style.stylesheet){let kt=this._map.style.stylesheet;this.styleOwner=kt.owner,this.styleId=kt.id}let at=this._map.style.sourceCaches;for(let kt in at){let Lt=at[kt];if(Lt.used||Lt.usedForTerrain){let le=Lt.getSource();le.attribution&&L.indexOf(le.attribution)<0&&L.push(le.attribution)}}L=L.filter(kt=>String(kt).trim()),L.sort((kt,Lt)=>kt.length-Lt.length),L=L.filter((kt,Lt)=>{for(let le=Lt+1;le=0)return!1;return!0});let xt=L.join(" | ");xt!==this._attribHTML&&(this._attribHTML=xt,L.length?(this._innerContainer.innerHTML=xt,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ni{constructor(L={}){this._updateCompact=()=>{let at=this._container.children;if(at.length){let xt=at[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&xt.classList.add("maplibregl-compact"):xt.classList.remove("maplibregl-compact")}},this.options=L}getDefaultPosition(){return"bottom-left"}onAdd(L){this._map=L,this._compact=this.options&&this.options.compact,this._container=a.create("div","maplibregl-ctrl");let at=a.create("a","maplibregl-ctrl-logo");return at.target="_blank",at.rel="noopener nofollow",at.href="https://maplibre.org/",at.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),at.setAttribute("rel","noopener nofollow"),this._container.appendChild(at),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){a.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Za{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(L){let at=++this._id;return this._queue.push({callback:L,id:at,cancelled:!1}),at}remove(L){let at=this._currentlyRunning,xt=at?this._queue.concat(at):this._queue;for(let kt of xt)if(kt.id===L)return void(kt.cancelled=!0)}run(L=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let at=this._currentlyRunning=this._queue;this._queue=[];for(let xt of at)if(!xt.cancelled&&(xt.callback(L),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var $i=e.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Do extends e.E{constructor(L){super(),this.sourceCache=L,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,L.usedForTerrain=!0,L.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(L,at){this.sourceCache.update(L,at),this._renderableTilesKeys=[];let xt={};for(let kt of L.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:at}))xt[kt.key]=!0,this._renderableTilesKeys.push(kt.key),this._tiles[kt.key]||(kt.posMatrix=new Float64Array(16),e.aP(kt.posMatrix,0,e.X,0,e.X,0,1),this._tiles[kt.key]=new Kt(kt,this.tileSize));for(let kt in this._tiles)xt[kt]||delete this._tiles[kt]}freeRtt(L){for(let at in this._tiles){let xt=this._tiles[at];(!L||xt.tileID.equals(L)||xt.tileID.isChildOf(L)||L.isChildOf(xt.tileID))&&(xt.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(L=>this.getTileByID(L))}getTileByID(L){return this._tiles[L]}getTerrainCoords(L){let at={};for(let xt of this._renderableTilesKeys){let kt=this._tiles[xt].tileID;if(kt.canonical.equals(L.canonical)){let Lt=L.clone();Lt.posMatrix=new Float64Array(16),e.aP(Lt.posMatrix,0,e.X,0,e.X,0,1),at[xt]=Lt}else if(kt.canonical.isChildOf(L.canonical)){let Lt=L.clone();Lt.posMatrix=new Float64Array(16);let le=kt.canonical.z-L.canonical.z,xe=kt.canonical.x-(kt.canonical.x>>le<>le<>le;e.aP(Lt.posMatrix,0,$e,0,$e,0,1),e.J(Lt.posMatrix,Lt.posMatrix,[-xe*$e,-Pe*$e,0]),at[xt]=Lt}else if(L.canonical.isChildOf(kt.canonical)){let Lt=L.clone();Lt.posMatrix=new Float64Array(16);let le=L.canonical.z-kt.canonical.z,xe=L.canonical.x-(L.canonical.x>>le<>le<>le;e.aP(Lt.posMatrix,0,e.X,0,e.X,0,1),e.J(Lt.posMatrix,Lt.posMatrix,[xe*$e,Pe*$e,0]),e.K(Lt.posMatrix,Lt.posMatrix,[1/2**le,1/2**le,0]),at[xt]=Lt}}return at}getSourceTile(L,at){let xt=this.sourceCache._source,kt=L.overscaledZ-this.deltaZoom;if(kt>xt.maxzoom&&(kt=xt.maxzoom),kt=xt.minzoom&&(!Lt||!Lt.dem);)Lt=this.sourceCache.getTileByID(L.scaledTo(kt--).key);return Lt}tilesAfterTime(L=Date.now()){return Object.values(this._tiles).filter(at=>at.timeAdded>=L)}}class ss{constructor(L,at,xt){this.painter=L,this.sourceCache=new Do(at),this.options=xt,this.exaggeration=typeof xt.exaggeration=="number"?xt.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(L,at,xt,kt=e.X){var Lt;if(!(at>=0&&at=0&&xtL.canonical.z&&(L.canonical.z>=kt?Lt=L.canonical.z-kt:e.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let le=L.canonical.x-(L.canonical.x>>Lt<>Lt<>8<<4|Lt>>8,at[le+3]=0;let xt=new e.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(at.buffer)),kt=new h(L,xt,L.gl.RGBA,{premultiply:!1});return kt.bind(L.gl.NEAREST,L.gl.CLAMP_TO_EDGE),this._coordsTexture=kt,kt}pointCoordinate(L){this.painter.maybeDrawDepthAndCoords(!0);let at=new Uint8Array(4),xt=this.painter.context,kt=xt.gl,Lt=Math.round(L.x*this.painter.pixelRatio/devicePixelRatio),le=Math.round(L.y*this.painter.pixelRatio/devicePixelRatio),xe=Math.round(this.painter.height/devicePixelRatio);xt.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),kt.readPixels(Lt,xe-le-1,1,1,kt.RGBA,kt.UNSIGNED_BYTE,at),xt.bindFramebuffer.set(null);let Pe=at[0]+(at[2]>>4<<8),$e=at[1]+((15&at[2])<<8),hr=this.coordsIndex[255-at[3]],pr=hr&&this.sourceCache.getTileByID(hr);if(!pr)return null;let Br=this._coordsTextureSize,Jr=(1<L.id!==at),this._recentlyUsed.push(L.id)}stampObject(L){L.stamp=++this._stamp}getOrCreateFreeObject(){for(let at of this._recentlyUsed)if(!this._objects[at].inUse)return this._objects[at];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let L=this._createObject(this._objects.length);return this._objects.push(L),L}freeObject(L){L.inUse=!1}freeAllObjects(){for(let L of this._objects)this.freeObject(L)}isFull(){return!(this._objects.length!L.inUse)===!1}}let ys={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Os{constructor(L,at){this.painter=L,this.terrain=at,this.pool=new Ps(L.context,30,at.sourceCache.tileSize*at.qualityFactor)}destruct(){this.pool.destruct()}getTexture(L){return this.pool.getObjectForId(L.rtt[this._stacks.length-1].id).texture}prepareForRender(L,at){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=L._order.filter(xt=>!L._layers[xt].isHidden(at)),this._coordsDescendingInv={};for(let xt in L.sourceCaches){this._coordsDescendingInv[xt]={};let kt=L.sourceCaches[xt].getVisibleCoordinates();for(let Lt of kt){let le=this.terrain.sourceCache.getTerrainCoords(Lt);for(let xe in le)this._coordsDescendingInv[xt][xe]||(this._coordsDescendingInv[xt][xe]=[]),this._coordsDescendingInv[xt][xe].push(le[xe])}}this._coordsDescendingInvStr={};for(let xt of L._order){let kt=L._layers[xt],Lt=kt.source;if(ys[kt.type]&&!this._coordsDescendingInvStr[Lt]){this._coordsDescendingInvStr[Lt]={};for(let le in this._coordsDescendingInv[Lt])this._coordsDescendingInvStr[Lt][le]=this._coordsDescendingInv[Lt][le].map(xe=>xe.key).sort().join()}}for(let xt of this._renderableTiles)for(let kt in this._coordsDescendingInvStr){let Lt=this._coordsDescendingInvStr[kt][xt.tileID.key];Lt&&Lt!==xt.rttCoords[kt]&&(xt.rtt=[])}}renderLayer(L){if(L.isHidden(this.painter.transform.zoom))return!1;let at=L.type,xt=this.painter,kt=this._renderableLayerIds[this._renderableLayerIds.length-1]===L.id;if(ys[at]&&(this._prevType&&ys[this._prevType]||this._stacks.push([]),this._prevType=at,this._stacks[this._stacks.length-1].push(L.id),!kt))return!0;if(ys[this._prevType]||ys[at]&&kt){this._prevType=at;let Lt=this._stacks.length-1,le=this._stacks[Lt]||[];for(let xe of this._renderableTiles){if(this.pool.isFull()&&(rl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(xe),xe.rtt[Lt]){let $e=this.pool.getObjectForId(xe.rtt[Lt].id);if($e.stamp===xe.rtt[Lt].stamp){this.pool.useObject($e);continue}}let Pe=this.pool.getOrCreateFreeObject();this.pool.useObject(Pe),this.pool.stampObject(Pe),xe.rtt[Lt]={id:Pe.id,stamp:Pe.stamp},xt.context.bindFramebuffer.set(Pe.fbo.framebuffer),xt.context.clear({color:e.aM.transparent,stencil:0}),xt.currentStencilSource=void 0;for(let $e=0;$e{Pt.touchstart=Pt.dragStart,Pt.touchmoveWindow=Pt.dragMove,Pt.touchend=Pt.dragEnd},bi={showCompass:!0,showZoom:!0,visualizePitch:!1};class so{constructor(L,at,xt=!1){this.mousedown=le=>{this.startMouse(e.e({},le,{ctrlKey:!0,preventDefault:()=>le.preventDefault()}),a.mousePos(this.element,le)),a.addEventListener(window,"mousemove",this.mousemove),a.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=le=>{this.moveMouse(le,a.mousePos(this.element,le))},this.mouseup=le=>{this.mouseRotate.dragEnd(le),this.mousePitch&&this.mousePitch.dragEnd(le),this.offTemp()},this.touchstart=le=>{le.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=a.touchPos(this.element,le.targetTouches)[0],this.startTouch(le,this._startPos),a.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),a.addEventListener(window,"touchend",this.touchend))},this.touchmove=le=>{le.targetTouches.length!==1?this.reset():(this._lastPos=a.touchPos(this.element,le.targetTouches)[0],this.moveTouch(le,this._lastPos))},this.touchend=le=>{le.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;let kt=L.dragRotate._mouseRotate.getClickTolerance(),Lt=L.dragRotate._mousePitch.getClickTolerance();this.element=at,this.mouseRotate=zl({clickTolerance:kt,enable:!0}),this.touchRotate=(({enable:le,clickTolerance:xe,bearingDegreesPerPixelMoved:Pe=.8})=>{let $e=new xc;return new ou({clickTolerance:xe,move:(hr,pr)=>({bearingDelta:(pr.x-hr.x)*Pe}),moveStateManager:$e,enable:le,assignEvents:Rs})})({clickTolerance:kt,enable:!0}),this.map=L,xt&&(this.mousePitch=Vc({clickTolerance:Lt,enable:!0}),this.touchPitch=(({enable:le,clickTolerance:xe,pitchDegreesPerPixelMoved:Pe=-.5})=>{let $e=new xc;return new ou({clickTolerance:xe,move:(hr,pr)=>({pitchDelta:(pr.y-hr.y)*Pe}),moveStateManager:$e,enable:le,assignEvents:Rs})})({clickTolerance:Lt,enable:!0})),a.addEventListener(at,"mousedown",this.mousedown),a.addEventListener(at,"touchstart",this.touchstart,{passive:!1}),a.addEventListener(at,"touchcancel",this.reset)}startMouse(L,at){this.mouseRotate.dragStart(L,at),this.mousePitch&&this.mousePitch.dragStart(L,at),a.disableDrag()}startTouch(L,at){this.touchRotate.dragStart(L,at),this.touchPitch&&this.touchPitch.dragStart(L,at),a.disableDrag()}moveMouse(L,at){let xt=this.map,{bearingDelta:kt}=this.mouseRotate.dragMove(L,at)||{};if(kt&&xt.setBearing(xt.getBearing()+kt),this.mousePitch){let{pitchDelta:Lt}=this.mousePitch.dragMove(L,at)||{};Lt&&xt.setPitch(xt.getPitch()+Lt)}}moveTouch(L,at){let xt=this.map,{bearingDelta:kt}=this.touchRotate.dragMove(L,at)||{};if(kt&&xt.setBearing(xt.getBearing()+kt),this.touchPitch){let{pitchDelta:Lt}=this.touchPitch.dragMove(L,at)||{};Lt&&xt.setPitch(xt.getPitch()+Lt)}}off(){let L=this.element;a.removeEventListener(L,"mousedown",this.mousedown),a.removeEventListener(L,"touchstart",this.touchstart,{passive:!1}),a.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),a.removeEventListener(window,"touchend",this.touchend),a.removeEventListener(L,"touchcancel",this.reset),this.offTemp()}offTemp(){a.enableDrag(),a.removeEventListener(window,"mousemove",this.mousemove),a.removeEventListener(window,"mouseup",this.mouseup),a.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),a.removeEventListener(window,"touchend",this.touchend)}}let ws;function fs(Pt,L,at){let xt=new e.N(Pt.lng,Pt.lat);if(Pt=new e.N(Pt.lng,Pt.lat),L){let kt=new e.N(Pt.lng-360,Pt.lat),Lt=new e.N(Pt.lng+360,Pt.lat),le=at.locationPoint(Pt).distSqr(L);at.locationPoint(kt).distSqr(L)180;){let kt=at.locationPoint(Pt);if(kt.x>=0&&kt.y>=0&&kt.x<=at.width&&kt.y<=at.height)break;Pt.lng>at.center.lng?Pt.lng-=360:Pt.lng+=360}return Pt.lng!==xt.lng&&at.locationPoint(Pt).y>at.height/2-at.getHorizon()?Pt:xt}let Ll={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function $l(Pt,L,at){let xt=Pt.classList;for(let kt in Ll)xt.remove(`maplibregl-${at}-anchor-${kt}`);xt.add(`maplibregl-${at}-anchor-${L}`)}class jl extends e.E{constructor(L){if(super(),this._onKeyPress=at=>{let xt=at.code,kt=at.charCode||at.keyCode;xt!=="Space"&&xt!=="Enter"&&kt!==32&&kt!==13||this.togglePopup()},this._onMapClick=at=>{let xt=at.originalEvent.target,kt=this._element;this._popup&&(xt===kt||kt.contains(xt))&&this.togglePopup()},this._update=at=>{var xt;if(!this._map)return;let kt=this._map.loaded()&&!this._map.isMoving();(at?.type==="terrain"||at?.type==="render"&&!kt)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?fs(this._lngLat,this._flatPos,this._map.transform):(xt=this._lngLat)===null||xt===void 0?void 0:xt.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let Lt="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?Lt=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(Lt=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let le="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?le="rotateX(0deg)":this._pitchAlignment==="map"&&(le=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||at&&at.type!=="moveend"||(this._pos=this._pos.round()),a.setTransform(this._element,`${Ll[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${le} ${Lt}`),o.frameAsync(new AbortController).then(()=>{this._updateOpacity(at&&at.type==="moveend")}).catch(()=>{})},this._onMove=at=>{if(!this._isDragging){let xt=this._clickTolerance||this._map._clickTolerance;this._isDragging=at.point.dist(this._pointerdownPos)>=xt}this._isDragging&&(this._pos=at.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new e.k("dragstart"))),this.fire(new e.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new e.k("dragend")),this._state="inactive"},this._addDragHandler=at=>{this._element.contains(at.originalEvent.target)&&(at.preventDefault(),this._positionDelta=at.point.sub(this._pos).add(this._offset),this._pointerdownPos=at.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=L&&L.anchor||"center",this._color=L&&L.color||"#3FB1CE",this._scale=L&&L.scale||1,this._draggable=L&&L.draggable||!1,this._clickTolerance=L&&L.clickTolerance||0,this._subpixelPositioning=L&&L.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=L&&L.rotation||0,this._rotationAlignment=L&&L.rotationAlignment||"auto",this._pitchAlignment=L&&L.pitchAlignment&&L.pitchAlignment!=="auto"?L.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(L?.opacity,L?.opacityWhenCovered),L&&L.element)this._element=L.element,this._offset=e.P.convert(L&&L.offset||[0,0]);else{this._defaultMarker=!0,this._element=a.create("div");let at=a.createNS("http://www.w3.org/2000/svg","svg"),xt=41,kt=27;at.setAttributeNS(null,"display","block"),at.setAttributeNS(null,"height",`${xt}px`),at.setAttributeNS(null,"width",`${kt}px`),at.setAttributeNS(null,"viewBox",`0 0 ${kt} ${xt}`);let Lt=a.createNS("http://www.w3.org/2000/svg","g");Lt.setAttributeNS(null,"stroke","none"),Lt.setAttributeNS(null,"stroke-width","1"),Lt.setAttributeNS(null,"fill","none"),Lt.setAttributeNS(null,"fill-rule","evenodd");let le=a.createNS("http://www.w3.org/2000/svg","g");le.setAttributeNS(null,"fill-rule","nonzero");let xe=a.createNS("http://www.w3.org/2000/svg","g");xe.setAttributeNS(null,"transform","translate(3.0, 29.0)"),xe.setAttributeNS(null,"fill","#000000");let Pe=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let ce of Pe){let Te=a.createNS("http://www.w3.org/2000/svg","ellipse");Te.setAttributeNS(null,"opacity","0.04"),Te.setAttributeNS(null,"cx","10.5"),Te.setAttributeNS(null,"cy","5.80029008"),Te.setAttributeNS(null,"rx",ce.rx),Te.setAttributeNS(null,"ry",ce.ry),xe.appendChild(Te)}let $e=a.createNS("http://www.w3.org/2000/svg","g");$e.setAttributeNS(null,"fill",this._color);let hr=a.createNS("http://www.w3.org/2000/svg","path");hr.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),$e.appendChild(hr);let pr=a.createNS("http://www.w3.org/2000/svg","g");pr.setAttributeNS(null,"opacity","0.25"),pr.setAttributeNS(null,"fill","#000000");let Br=a.createNS("http://www.w3.org/2000/svg","path");Br.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),pr.appendChild(Br);let Jr=a.createNS("http://www.w3.org/2000/svg","g");Jr.setAttributeNS(null,"transform","translate(6.0, 7.0)"),Jr.setAttributeNS(null,"fill","#FFFFFF");let Rt=a.createNS("http://www.w3.org/2000/svg","g");Rt.setAttributeNS(null,"transform","translate(8.0, 8.0)");let Gt=a.createNS("http://www.w3.org/2000/svg","circle");Gt.setAttributeNS(null,"fill","#000000"),Gt.setAttributeNS(null,"opacity","0.25"),Gt.setAttributeNS(null,"cx","5.5"),Gt.setAttributeNS(null,"cy","5.5"),Gt.setAttributeNS(null,"r","5.4999962");let ae=a.createNS("http://www.w3.org/2000/svg","circle");ae.setAttributeNS(null,"fill","#FFFFFF"),ae.setAttributeNS(null,"cx","5.5"),ae.setAttributeNS(null,"cy","5.5"),ae.setAttributeNS(null,"r","5.4999962"),Rt.appendChild(Gt),Rt.appendChild(ae),le.appendChild(xe),le.appendChild($e),le.appendChild(pr),le.appendChild(Jr),le.appendChild(Rt),at.appendChild(le),at.setAttributeNS(null,"height",xt*this._scale+"px"),at.setAttributeNS(null,"width",kt*this._scale+"px"),this._element.appendChild(at),this._offset=e.P.convert(L&&L.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",at=>{at.preventDefault()}),this._element.addEventListener("mousedown",at=>{at.preventDefault()}),$l(this._element,this._anchor,"marker"),L&&L.className)for(let at of L.className.split(" "))this._element.classList.add(at);this._popup=null}addTo(L){return this.remove(),this._map=L,this._element.setAttribute("aria-label",L._getUIString("Marker.Title")),L.getCanvasContainer().appendChild(this._element),L.on("move",this._update),L.on("moveend",this._update),L.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),a.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(L){return this._lngLat=e.N.convert(L),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(L){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),L){if(!("offset"in L.options)){let at=Math.abs(13.5)/Math.SQRT2;L.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[at,-1*(38.1-13.5+at)],"bottom-right":[-at,-1*(38.1-13.5+at)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=L,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(L){return this._subpixelPositioning=L,this}getPopup(){return this._popup}togglePopup(){let L=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:L?(L.isOpen()?L.remove():(L.setLngLat(this._lngLat),L.addTo(this._map)),this):this}_updateOpacity(L=!1){var at,xt;if(!(!((at=this._map)===null||at===void 0)&&at.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(L)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let kt=this._map,Lt=kt.terrain.depthAtPoint(this._pos),le=kt.terrain.getElevationForLngLatZoom(this._lngLat,kt.transform.tileZoom);if(kt.transform.lngLatToCameraDepth(this._lngLat,le)-Lt<.006)return void(this._element.style.opacity=this._opacity);let xe=-this._offset.y/kt.transform._pixelPerMeter,Pe=Math.sin(kt.getPitch()*Math.PI/180)*xe,$e=kt.terrain.depthAtPoint(new e.P(this._pos.x,this._pos.y-this._offset.y)),hr=kt.transform.lngLatToCameraDepth(this._lngLat,le+Pe)-$e>.006;!((xt=this._popup)===null||xt===void 0)&&xt.isOpen()&&hr&&this._popup.remove(),this._element.style.opacity=hr?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(L){return this._offset=e.P.convert(L),this._update(),this}addClassName(L){this._element.classList.add(L)}removeClassName(L){this._element.classList.remove(L)}toggleClassName(L){return this._element.classList.toggle(L)}setDraggable(L){return this._draggable=!!L,this._map&&(L?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(L){return this._rotation=L||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(L){return this._rotationAlignment=L||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(L){return this._pitchAlignment=L&&L!=="auto"?L:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(L,at){return L===void 0&&at===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),L!==void 0&&(this._opacity=L),at!==void 0&&(this._opacityWhenCovered=at),this._map&&this._updateOpacity(!0),this}}let Bu={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Jl=0,Ru=!1,nl={maxWidth:100,unit:"metric"};function Nu(Pt,L,at){let xt=at&&at.maxWidth||100,kt=Pt._container.clientHeight/2,Lt=Pt.unproject([0,kt]),le=Pt.unproject([xt,kt]),xe=Lt.distanceTo(le);if(at&&at.unit==="imperial"){let Pe=3.2808*xe;Pe>5280?Ui(L,xt,Pe/5280,Pt._getUIString("ScaleControl.Miles")):Ui(L,xt,Pe,Pt._getUIString("ScaleControl.Feet"))}else at&&at.unit==="nautical"?Ui(L,xt,xe/1852,Pt._getUIString("ScaleControl.NauticalMiles")):xe>=1e3?Ui(L,xt,xe/1e3,Pt._getUIString("ScaleControl.Kilometers")):Ui(L,xt,xe,Pt._getUIString("ScaleControl.Meters"))}function Ui(Pt,L,at,xt){let kt=(function(Lt){let le=Math.pow(10,`${Math.floor(Lt)}`.length-1),xe=Lt/le;return xe=xe>=10?10:xe>=5?5:xe>=3?3:xe>=2?2:xe>=1?1:(function(Pe){let $e=Math.pow(10,Math.ceil(-Math.log(Pe)/Math.LN10));return Math.round(Pe*$e)/$e})(xe),le*xe})(at);Pt.style.width=L*(kt/at)+"px",Pt.innerHTML=`${kt} ${xt}`}let fo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Ql=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ul(Pt){if(Pt){if(typeof Pt=="number"){let L=Math.round(Math.abs(Pt)/Math.SQRT2);return{center:new e.P(0,0),top:new e.P(0,Pt),"top-left":new e.P(L,L),"top-right":new e.P(-L,L),bottom:new e.P(0,-Pt),"bottom-left":new e.P(L,-L),"bottom-right":new e.P(-L,-L),left:new e.P(Pt,0),right:new e.P(-Pt,0)}}if(Pt instanceof e.P||Array.isArray(Pt)){let L=e.P.convert(Pt);return{center:L,top:L,"top-left":L,"top-right":L,bottom:L,"bottom-left":L,"bottom-right":L,left:L,right:L}}return{center:e.P.convert(Pt.center||[0,0]),top:e.P.convert(Pt.top||[0,0]),"top-left":e.P.convert(Pt["top-left"]||[0,0]),"top-right":e.P.convert(Pt["top-right"]||[0,0]),bottom:e.P.convert(Pt.bottom||[0,0]),"bottom-left":e.P.convert(Pt["bottom-left"]||[0,0]),"bottom-right":e.P.convert(Pt["bottom-right"]||[0,0]),left:e.P.convert(Pt.left||[0,0]),right:e.P.convert(Pt.right||[0,0])}}return ul(new e.P(0,0))}let Fc=r;t.AJAXError=e.bh,t.Evented=e.E,t.LngLat=e.N,t.MercatorCoordinate=e.Z,t.Point=e.P,t.addProtocol=e.bi,t.config=e.a,t.removeProtocol=e.bj,t.AttributionControl=Xi,t.BoxZoomHandler=Xl,t.CanvasSource=ee,t.CooperativeGesturesHandler=Ba,t.DoubleClickZoomHandler=Pn,t.DragPanHandler=Ua,t.DragRotateHandler=Ya,t.EdgeInsets=Rl,t.FullscreenControl=class extends e.E{constructor(Pt={}){super(),this._onFullscreenChange=()=>{var L;let at=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((L=at?.shadowRoot)===null||L===void 0)&&L.fullscreenElement;)at=at.shadowRoot.fullscreenElement;at===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,Pt&&Pt.container&&(Pt.container instanceof HTMLElement?this._container=Pt.container:e.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(Pt){return this._map=Pt,this._container||(this._container=this._map.getContainer()),this._controlContainer=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){a.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let Pt=this._fullscreenButton=a.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);a.create("span","maplibregl-ctrl-icon",Pt).setAttribute("aria-hidden","true"),Pt.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let Pt=this._getTitle();this._fullscreenButton.setAttribute("aria-label",Pt),this._fullscreenButton.title=Pt}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new e.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new e.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},t.GeoJSONSource=It,t.GeolocateControl=class extends e.E{constructor(Pt){super(),this._onSuccess=L=>{if(this._map){if(this._isOutOfMapMaxBounds(L))return this._setErrorState(),this.fire(new e.k("outofmaxbounds",L)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=L,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(L),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(L),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new e.k("geolocate",L)),this._finish()}},this._updateCamera=L=>{let at=new e.N(L.coords.longitude,L.coords.latitude),xt=L.coords.accuracy,kt=this._map.getBearing(),Lt=e.e({bearing:kt},this.options.fitBoundsOptions),le=nt.fromLngLat(at,xt);this._map.fitBounds(le,Lt,{geolocateSource:!0})},this._updateMarker=L=>{if(L){let at=new e.N(L.coords.longitude,L.coords.latitude);this._accuracyCircleMarker.setLngLat(at).addTo(this._map),this._userLocationDotMarker.setLngLat(at).addTo(this._map),this._accuracy=L.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=L=>{if(this._map){if(this.options.trackUserLocation)if(L.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let at=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=at,this._geolocateButton.setAttribute("aria-label",at),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(L.code===3&&Ru)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new e.k("error",L)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",L=>L.preventDefault()),this._geolocateButton=a.create("button","maplibregl-ctrl-geolocate",this._container),a.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=L=>{if(this._map){if(L===!1){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");let at=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=at,this._geolocateButton.setAttribute("aria-label",at)}else{let at=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=at,this._geolocateButton.setAttribute("aria-label",at)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=a.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new jl({element:this._dotElement}),this._circleElement=a.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new jl({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",at=>{at.geolocateSource||this._watchState!=="ACTIVE_LOCK"||at.originalEvent&&at.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new e.k("trackuserlocationend")),this.fire(new e.k("userlocationlostfocus")))})}},this.options=e.e({},Bu,Pt)}onAdd(Pt){return this._map=Pt,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return e._(this,arguments,void 0,function*(L=!1){if(ws!==void 0&&!L)return ws;if(window.navigator.permissions===void 0)return ws=!!window.navigator.geolocation,ws;try{ws=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{ws=!!window.navigator.geolocation}return ws})})().then(L=>this._finishSetupUI(L)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),a.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Jl=0,Ru=!1}_isOutOfMapMaxBounds(Pt){let L=this._map.getMaxBounds(),at=Pt.coords;return L&&(at.longitudeL.getEast()||at.latitudeL.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){let Pt=this._map.getBounds(),L=Pt.getSouthEast(),at=Pt.getNorthEast(),xt=L.distanceTo(at),kt=Math.ceil(this._accuracy/(xt/this._map._container.clientHeight)*2);this._circleElement.style.width=`${kt}px`,this._circleElement.style.height=`${kt}px`}trigger(){if(!this._setup)return e.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Jl--,Ru=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new e.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.k("trackuserlocationstart")),this.fire(new e.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let Pt;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Jl++,Jl>1?(Pt={maximumAge:6e5,timeout:0},Ru=!0):(Pt=this.options.positionOptions,Ru=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,Pt)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},t.Hash=Tu,t.ImageSource=te,t.KeyboardHandler=yr,t.LngLatBounds=nt,t.LogoControl=ni,t.Map=class extends Oi{constructor(Pt){e.bf.mark(e.bg.create);let L=Object.assign(Object.assign({},el),Pt);if(L.minZoom!=null&&L.maxZoom!=null&&L.minZoom>L.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(L.minPitch!=null&&L.maxPitch!=null&&L.minPitch>L.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(L.minPitch!=null&&L.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(L.maxPitch!=null&&L.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ws(L.minZoom,L.maxZoom,L.minPitch,L.maxPitch,L.renderWorldCopies),{bearingSnap:L.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Za,this._controls=[],this._mapId=e.a4(),this._contextLost=at=>{at.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new e.k("webglcontextlost",{originalEvent:at}))},this._contextRestored=at=>{this._setupPainter(),this.resize(),this._update(),this.fire(new e.k("webglcontextrestored",{originalEvent:at}))},this._onMapScroll=at=>{if(at.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=L.interactive,this._maxTileCacheSize=L.maxTileCacheSize,this._maxTileCacheZoomLevels=L.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=L.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=L.preserveDrawingBuffer===!0,this._antialias=L.antialias===!0,this._trackResize=L.trackResize===!0,this._bearingSnap=L.bearingSnap,this._refreshExpiredTiles=L.refreshExpiredTiles===!0,this._fadeDuration=L.fadeDuration,this._crossSourceCollisions=L.crossSourceCollisions===!0,this._collectResourceTiming=L.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Yo),L.locale),this._clickTolerance=L.clickTolerance,this._overridePixelRatio=L.pixelRatio,this._maxCanvasSize=L.maxCanvasSize,this.transformCameraUpdate=L.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=L.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=l.addThrottleControl(()=>this.isMoving()),this._requestManager=new x(L.transformRequest),typeof L.container=="string"){if(this._container=document.getElementById(L.container),!this._container)throw new Error(`Container '${L.container}' not found.`)}else{if(!(L.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=L.container}if(L.maxBounds&&this.setMaxBounds(L.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let at=!1,xt=ic(kt=>{this._trackResize&&!this._removed&&(this.resize(kt),this.redraw())},50);this._resizeObserver=new ResizeObserver(kt=>{at?xt(kt):at=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Vi(this,L),this._hash=L.hash&&new Tu(typeof L.hash=="string"&&L.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:L.center,zoom:L.zoom,bearing:L.bearing,pitch:L.pitch}),L.bounds&&(this.resize(),this.fitBounds(L.bounds,e.e({},L.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=L.localIdeographFontFamily,this._validateStyle=L.validateStyle,L.style&&this.setStyle(L.style,{localIdeographFontFamily:L.localIdeographFontFamily}),L.attributionControl&&this.addControl(new Xi(typeof L.attributionControl=="boolean"?void 0:L.attributionControl)),L.maplibreLogo&&this.addControl(new ni,L.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",at=>{this._update(at.dataType==="style"),this.fire(new e.k(`${at.dataType}data`,at))}),this.on("dataloading",at=>{this.fire(new e.k(`${at.dataType}dataloading`,at))}),this.on("dataabort",at=>{this.fire(new e.k("sourcedataabort",at))})}_getMapId(){return this._mapId}addControl(Pt,L){if(L===void 0&&(L=Pt.getDefaultPosition?Pt.getDefaultPosition():"top-right"),!Pt||!Pt.onAdd)return this.fire(new e.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let at=Pt.onAdd(this);this._controls.push(Pt);let xt=this._controlPositions[L];return L.indexOf("bottom")!==-1?xt.insertBefore(at,xt.firstChild):xt.appendChild(at),this}removeControl(Pt){if(!Pt||!Pt.onRemove)return this.fire(new e.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let L=this._controls.indexOf(Pt);return L>-1&&this._controls.splice(L,1),Pt.onRemove(this),this}hasControl(Pt){return this._controls.indexOf(Pt)>-1}calculateCameraOptionsFromTo(Pt,L,at,xt){return xt==null&&this.terrain&&(xt=this.terrain.getElevationForLngLatZoom(at,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(Pt,L,at,xt)}resize(Pt){var L;let at=this._containerDimensions(),xt=at[0],kt=at[1],Lt=this._getClampedPixelRatio(xt,kt);if(this._resizeCanvas(xt,kt,Lt),this.painter.resize(xt,kt,Lt),this.painter.overLimit()){let xe=this.painter.context.gl;this._maxCanvasSize=[xe.drawingBufferWidth,xe.drawingBufferHeight];let Pe=this._getClampedPixelRatio(xt,kt);this._resizeCanvas(xt,kt,Pe),this.painter.resize(xt,kt,Pe)}this.transform.resize(xt,kt),(L=this._requestedCameraState)===null||L===void 0||L.resize(xt,kt);let le=!this._moving;return le&&(this.stop(),this.fire(new e.k("movestart",Pt)).fire(new e.k("move",Pt))),this.fire(new e.k("resize",Pt)),le&&this.fire(new e.k("moveend",Pt)),this}_getClampedPixelRatio(Pt,L){let{0:at,1:xt}=this._maxCanvasSize,kt=this.getPixelRatio(),Lt=Pt*kt,le=L*kt;return Math.min(Lt>at?at/Lt:1,le>xt?xt/le:1)*kt}getPixelRatio(){var Pt;return(Pt=this._overridePixelRatio)!==null&&Pt!==void 0?Pt:devicePixelRatio}setPixelRatio(Pt){this._overridePixelRatio=Pt,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(Pt){return this.transform.setMaxBounds(nt.convert(Pt)),this._update()}setMinZoom(Pt){if((Pt=Pt??-2)>=-2&&Pt<=this.transform.maxZoom)return this.transform.minZoom=Pt,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=Pt,this._update(),this.getZoom()>Pt&&this.setZoom(Pt),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(Pt){if((Pt=Pt??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(Pt>=0&&Pt<=this.transform.maxPitch)return this.transform.minPitch=Pt,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(Pt>=this.transform.minPitch)return this.transform.maxPitch=Pt,this._update(),this.getPitch()>Pt&&this.setPitch(Pt),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(Pt){return this.transform.renderWorldCopies=Pt,this._update()}project(Pt){return this.transform.locationPoint(e.N.convert(Pt),this.style&&this.terrain)}unproject(Pt){return this.transform.pointLocation(e.P.convert(Pt),this.terrain)}isMoving(){var Pt;return this._moving||((Pt=this.handlers)===null||Pt===void 0?void 0:Pt.isMoving())}isZooming(){var Pt;return this._zooming||((Pt=this.handlers)===null||Pt===void 0?void 0:Pt.isZooming())}isRotating(){var Pt;return this._rotating||((Pt=this.handlers)===null||Pt===void 0?void 0:Pt.isRotating())}_createDelegatedListener(Pt,L,at){if(Pt==="mouseenter"||Pt==="mouseover"){let xt=!1;return{layers:L,listener:at,delegates:{mousemove:kt=>{let Lt=L.filter(xe=>this.getLayer(xe)),le=Lt.length!==0?this.queryRenderedFeatures(kt.point,{layers:Lt}):[];le.length?xt||(xt=!0,at.call(this,new iu(Pt,this,kt.originalEvent,{features:le}))):xt=!1},mouseout:()=>{xt=!1}}}}if(Pt==="mouseleave"||Pt==="mouseout"){let xt=!1;return{layers:L,listener:at,delegates:{mousemove:kt=>{let Lt=L.filter(le=>this.getLayer(le));(Lt.length!==0?this.queryRenderedFeatures(kt.point,{layers:Lt}):[]).length?xt=!0:xt&&(xt=!1,at.call(this,new iu(Pt,this,kt.originalEvent)))},mouseout:kt=>{xt&&(xt=!1,at.call(this,new iu(Pt,this,kt.originalEvent)))}}}}{let xt=kt=>{let Lt=L.filter(xe=>this.getLayer(xe)),le=Lt.length!==0?this.queryRenderedFeatures(kt.point,{layers:Lt}):[];le.length&&(kt.features=le,at.call(this,kt),delete kt.features)};return{layers:L,listener:at,delegates:{[Pt]:xt}}}}_saveDelegatedListener(Pt,L){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[Pt]=this._delegatedListeners[Pt]||[],this._delegatedListeners[Pt].push(L)}_removeDelegatedListener(Pt,L,at){if(!this._delegatedListeners||!this._delegatedListeners[Pt])return;let xt=this._delegatedListeners[Pt];for(let kt=0;ktL.includes(le))){for(let le in Lt.delegates)this.off(le,Lt.delegates[le]);return void xt.splice(kt,1)}}}on(Pt,L,at){if(at===void 0)return super.on(Pt,L);let xt=this._createDelegatedListener(Pt,typeof L=="string"?[L]:L,at);this._saveDelegatedListener(Pt,xt);for(let kt in xt.delegates)this.on(kt,xt.delegates[kt]);return this}once(Pt,L,at){if(at===void 0)return super.once(Pt,L);let xt=typeof L=="string"?[L]:L,kt=this._createDelegatedListener(Pt,xt,at);for(let Lt in kt.delegates){let le=kt.delegates[Lt];kt.delegates[Lt]=(...xe)=>{this._removeDelegatedListener(Pt,xt,at),le(...xe)}}this._saveDelegatedListener(Pt,kt);for(let Lt in kt.delegates)this.once(Lt,kt.delegates[Lt]);return this}off(Pt,L,at){return at===void 0?super.off(Pt,L):(this._removeDelegatedListener(Pt,typeof L=="string"?[L]:L,at),this)}queryRenderedFeatures(Pt,L){if(!this.style)return[];let at,xt=Pt instanceof e.P||Array.isArray(Pt),kt=xt?Pt:[[0,0],[this.transform.width,this.transform.height]];if(L=L||(xt?{}:Pt)||{},kt instanceof e.P||typeof kt[0]=="number")at=[e.P.convert(kt)];else{let Lt=e.P.convert(kt[0]),le=e.P.convert(kt[1]);at=[Lt,new e.P(le.x,Lt.y),le,new e.P(Lt.x,le.y),Lt]}return this.style.queryRenderedFeatures(at,L,this.transform)}querySourceFeatures(Pt,L){return this.style.querySourceFeatures(Pt,L)}setStyle(Pt,L){return(L=e.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},L)).diff!==!1&&L.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&Pt?(this._diffStyle(Pt,L),this):(this._localIdeographFontFamily=L.localIdeographFontFamily,this._updateStyle(Pt,L))}setTransformRequest(Pt){return this._requestManager.setTransformRequest(Pt),this}_getUIString(Pt){let L=this._locale[Pt];if(L==null)throw new Error(`Missing UI string '${Pt}'`);return L}_updateStyle(Pt,L){if(L.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(Pt,L));let at=this.style&&L.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!Pt)),Pt?(this.style=new kr(this,L||{}),this.style.setEventedParent(this,{style:this.style}),typeof Pt=="string"?this.style.loadURL(Pt,L,at):this.style.loadJSON(Pt,L,at),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new kr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(Pt,L){if(typeof Pt=="string"){let at=this._requestManager.transformRequest(Pt,"Style");e.h(at,new AbortController).then(xt=>{this._updateDiff(xt.data,L)}).catch(xt=>{xt&&this.fire(new e.j(xt))})}else typeof Pt=="object"&&this._updateDiff(Pt,L)}_updateDiff(Pt,L){try{this.style.setState(Pt,L)&&this._update(!0)}catch(at){e.w(`Unable to perform style diff: ${at.message||at.error||at}. Rebuilding the style from scratch.`),this._updateStyle(Pt,L)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():e.w("There is no style added to the map.")}addSource(Pt,L){return this._lazyInitEmptyStyle(),this.style.addSource(Pt,L),this._update(!0)}isSourceLoaded(Pt){let L=this.style&&this.style.sourceCaches[Pt];if(L!==void 0)return L.loaded();this.fire(new e.j(new Error(`There is no source with ID '${Pt}'`)))}setTerrain(Pt){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),Pt){let L=this.style.sourceCaches[Pt.source];if(!L)throw new Error(`cannot load terrain, because there exists no source with ID: ${Pt.source}`);this.terrain===null&&L.reload();for(let at in this.style._layers){let xt=this.style._layers[at];xt.type==="hillshade"&&xt.source===Pt.source&&e.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new ss(this.painter,L,Pt),this.painter.renderToTexture=new Os(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=at=>{at.dataType==="style"?this.terrain.sourceCache.freeRtt():at.dataType==="source"&&at.tile&&(at.sourceId!==Pt.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(at.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new e.k("terrain",{terrain:Pt})),this}getTerrain(){var Pt,L;return(L=(Pt=this.terrain)===null||Pt===void 0?void 0:Pt.options)!==null&&L!==void 0?L:null}areTilesLoaded(){let Pt=this.style&&this.style.sourceCaches;for(let L in Pt){let at=Pt[L]._tiles;for(let xt in at){let kt=at[xt];if(kt.state!=="loaded"&&kt.state!=="errored")return!1}}return!0}removeSource(Pt){return this.style.removeSource(Pt),this._update(!0)}getSource(Pt){return this.style.getSource(Pt)}addImage(Pt,L,at={}){let{pixelRatio:xt=1,sdf:kt=!1,stretchX:Lt,stretchY:le,content:xe,textFitWidth:Pe,textFitHeight:$e}=at;if(this._lazyInitEmptyStyle(),!(L instanceof HTMLImageElement||e.b(L))){if(L.width===void 0||L.height===void 0)return this.fire(new e.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:hr,height:pr,data:Br}=L,Jr=L;return this.style.addImage(Pt,{data:new e.R({width:hr,height:pr},new Uint8Array(Br)),pixelRatio:xt,stretchX:Lt,stretchY:le,content:xe,textFitWidth:Pe,textFitHeight:$e,sdf:kt,version:0,userImage:Jr}),Jr.onAdd&&Jr.onAdd(this,Pt),this}}{let{width:hr,height:pr,data:Br}=o.getImageData(L);this.style.addImage(Pt,{data:new e.R({width:hr,height:pr},Br),pixelRatio:xt,stretchX:Lt,stretchY:le,content:xe,textFitWidth:Pe,textFitHeight:$e,sdf:kt,version:0})}}updateImage(Pt,L){let at=this.style.getImage(Pt);if(!at)return this.fire(new e.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let xt=L instanceof HTMLImageElement||e.b(L)?o.getImageData(L):L,{width:kt,height:Lt,data:le}=xt;if(kt===void 0||Lt===void 0)return this.fire(new e.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(kt!==at.data.width||Lt!==at.data.height)return this.fire(new e.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));let xe=!(L instanceof HTMLImageElement||e.b(L));return at.data.replace(le,xe),this.style.updateImage(Pt,at),this}getImage(Pt){return this.style.getImage(Pt)}hasImage(Pt){return Pt?!!this.style.getImage(Pt):(this.fire(new e.j(new Error("Missing required image id"))),!1)}removeImage(Pt){this.style.removeImage(Pt)}loadImage(Pt){return l.getImage(this._requestManager.transformRequest(Pt,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(Pt,L){return this._lazyInitEmptyStyle(),this.style.addLayer(Pt,L),this._update(!0)}moveLayer(Pt,L){return this.style.moveLayer(Pt,L),this._update(!0)}removeLayer(Pt){return this.style.removeLayer(Pt),this._update(!0)}getLayer(Pt){return this.style.getLayer(Pt)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(Pt,L,at){return this.style.setLayerZoomRange(Pt,L,at),this._update(!0)}setFilter(Pt,L,at={}){return this.style.setFilter(Pt,L,at),this._update(!0)}getFilter(Pt){return this.style.getFilter(Pt)}setPaintProperty(Pt,L,at,xt={}){return this.style.setPaintProperty(Pt,L,at,xt),this._update(!0)}getPaintProperty(Pt,L){return this.style.getPaintProperty(Pt,L)}setLayoutProperty(Pt,L,at,xt={}){return this.style.setLayoutProperty(Pt,L,at,xt),this._update(!0)}getLayoutProperty(Pt,L){return this.style.getLayoutProperty(Pt,L)}setGlyphs(Pt,L={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(Pt,L),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(Pt,L,at={}){return this._lazyInitEmptyStyle(),this.style.addSprite(Pt,L,at,xt=>{xt||this._update(!0)}),this}removeSprite(Pt){return this._lazyInitEmptyStyle(),this.style.removeSprite(Pt),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(Pt,L={}){return this._lazyInitEmptyStyle(),this.style.setSprite(Pt,L,at=>{at||this._update(!0)}),this}setLight(Pt,L={}){return this._lazyInitEmptyStyle(),this.style.setLight(Pt,L),this._update(!0)}getLight(){return this.style.getLight()}setSky(Pt){return this._lazyInitEmptyStyle(),this.style.setSky(Pt),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(Pt,L){return this.style.setFeatureState(Pt,L),this._update()}removeFeatureState(Pt,L){return this.style.removeFeatureState(Pt,L),this._update()}getFeatureState(Pt){return this.style.getFeatureState(Pt)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let Pt=0,L=0;return this._container&&(Pt=this._container.clientWidth||400,L=this._container.clientHeight||300),[Pt,L]}_setupContainer(){let Pt=this._container;Pt.classList.add("maplibregl-map");let L=this._canvasContainer=a.create("div","maplibregl-canvas-container",Pt);this._interactive&&L.classList.add("maplibregl-interactive"),this._canvas=a.create("canvas","maplibregl-canvas",L),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let at=this._containerDimensions(),xt=this._getClampedPixelRatio(at[0],at[1]);this._resizeCanvas(at[0],at[1],xt);let kt=this._controlContainer=a.create("div","maplibregl-control-container",Pt),Lt=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(le=>{Lt[le]=a.create("div",`maplibregl-ctrl-${le} `,kt)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(Pt,L,at){this._canvas.width=Math.floor(at*Pt),this._canvas.height=Math.floor(at*L),this._canvas.style.width=`${Pt}px`,this._canvas.style.height=`${L}px`}_setupPainter(){let Pt={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},L=null;this._canvas.addEventListener("webglcontextcreationerror",xt=>{L={requestedAttributes:Pt},xt&&(L.statusMessage=xt.statusMessage,L.type=xt.type)},{once:!0});let at=this._canvas.getContext("webgl2",Pt)||this._canvas.getContext("webgl",Pt);if(!at){let xt="Failed to initialize WebGL";throw L?(L.message=xt,new Error(JSON.stringify(L))):new Error(xt)}this.painter=new Zu(at,this.transform),s.testSupport(at)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(Pt){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||Pt,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(Pt){return this._update(),this._renderTaskQueue.add(Pt)}_cancelRenderFrame(Pt){this._renderTaskQueue.remove(Pt)}_render(Pt){let L=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(Pt),this._removed)return;let at=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let kt=this.transform.zoom,Lt=o.now();this.style.zoomHistory.update(kt,Lt);let le=new e.z(kt,{now:Lt,fadeDuration:L,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),xe=le.crossFadingFactor();xe===1&&xe===this._crossFadingFactor||(at=!0,this._crossFadingFactor=xe),this.style.update(le)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,L,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:L,showPadding:this.showPadding}),this.fire(new e.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.bf.mark(e.bg.load),this.fire(new e.k("load"))),this.style&&(this.style.hasTransitions()||at)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let xt=this._sourcesDirty||this._styleDirty||this._placementDirty;return xt||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new e.k("idle")),!this._loaded||this._fullyLoaded||xt||(this._fullyLoaded=!0,e.bf.mark(e.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var Pt;this._hash&&this._hash.remove();for(let at of this._controls)at.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),l.removeThrottleControl(this._imageQueueHandle),(Pt=this._resizeObserver)===null||Pt===void 0||Pt.disconnect();let L=this.painter.context.gl.getExtension("WEBGL_lose_context");L!=null&&L.loseContext&&L.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),a.remove(this._canvasContainer),a.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),e.bf.clearMetrics(),this._removed=!0,this.fire(new e.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,o.frameAsync(this._frameRequest).then(Pt=>{e.bf.frame(Pt),this._frameRequest=null,this._render(Pt)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(Pt){this._showTileBoundaries!==Pt&&(this._showTileBoundaries=Pt,this._update())}get showPadding(){return!!this._showPadding}set showPadding(Pt){this._showPadding!==Pt&&(this._showPadding=Pt,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(Pt){this._showCollisionBoxes!==Pt&&(this._showCollisionBoxes=Pt,Pt?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(Pt){this._showOverdrawInspector!==Pt&&(this._showOverdrawInspector=Pt,this._update())}get repaint(){return!!this._repaint}set repaint(Pt){this._repaint!==Pt&&(this._repaint=Pt,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(Pt){this._vertices=Pt,this._update()}get version(){return ll}getCameraTargetElevation(){return this.transform.elevation}},t.MapMouseEvent=iu,t.MapTouchEvent=lc,t.MapWheelEvent=kc,t.Marker=jl,t.NavigationControl=class{constructor(Pt){this._updateZoomButtons=()=>{let L=this._map.getZoom(),at=L===this._map.getMaxZoom(),xt=L===this._map.getMinZoom();this._zoomInButton.disabled=at,this._zoomOutButton.disabled=xt,this._zoomInButton.setAttribute("aria-disabled",at.toString()),this._zoomOutButton.setAttribute("aria-disabled",xt.toString())},this._rotateCompassArrow=()=>{let L=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=L},this._setButtonTitle=(L,at)=>{let xt=this._map._getUIString(`NavigationControl.${at}`);L.title=xt,L.setAttribute("aria-label",xt)},this.options=e.e({},bi,Pt),this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",L=>L.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",L=>this._map.zoomIn({},{originalEvent:L})),a.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",L=>this._map.zoomOut({},{originalEvent:L})),a.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",L=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:L}):this._map.resetNorth({},{originalEvent:L})}),this._compassIcon=a.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(Pt){return this._map=Pt,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new so(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){a.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(Pt,L){let at=a.create("button",Pt,this._container);return at.type="button",at.addEventListener("click",L),at}},t.Popup=class extends e.E{constructor(Pt){super(),this.remove=()=>(this._content&&a.remove(this._content),this._container&&(a.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new e.k("close"))),this),this._onMouseUp=L=>{this._update(L.point)},this._onMouseMove=L=>{this._update(L.point)},this._onDrag=L=>{this._update(L.point)},this._update=L=>{var at;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=a.create("div","maplibregl-popup",this._map.getContainer()),this._tip=a.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let xe of this.options.className.split(" "))this._container.classList.add(xe);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?fs(this._lngLat,this._flatPos,this._map.transform):(at=this._lngLat)===null||at===void 0?void 0:at.wrap(),this._trackPointer&&!L)return;let xt=this._flatPos=this._pos=this._trackPointer&&L?L:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&L?L:this._map.transform.locationPoint(this._lngLat));let kt=this.options.anchor,Lt=ul(this.options.offset);if(!kt){let xe=this._container.offsetWidth,Pe=this._container.offsetHeight,$e;$e=xt.y+Lt.bottom.ythis._map.transform.height-Pe?["bottom"]:[],xt.xthis._map.transform.width-xe/2&&$e.push("right"),kt=$e.length===0?"bottom":$e.join("-")}let le=xt.add(Lt[kt]);this.options.subpixelPositioning||(le=le.round()),a.setTransform(this._container,`${Ll[kt]} translate(${le.x}px,${le.y}px)`),$l(this._container,kt,"popup")},this._onClose=()=>{this.remove()},this.options=e.e(Object.create(fo),Pt)}addTo(Pt){return this._map&&this.remove(),this._map=Pt,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new e.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(Pt){return this._lngLat=e.N.convert(Pt),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(Pt){return this.setDOMContent(document.createTextNode(Pt))}setHTML(Pt){let L=document.createDocumentFragment(),at=document.createElement("body"),xt;for(at.innerHTML=Pt;xt=at.firstChild,xt;)L.appendChild(xt);return this.setDOMContent(L)}getMaxWidth(){var Pt;return(Pt=this._container)===null||Pt===void 0?void 0:Pt.style.maxWidth}setMaxWidth(Pt){return this.options.maxWidth=Pt,this._update(),this}setDOMContent(Pt){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=a.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(Pt),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(Pt){return this._container&&this._container.classList.add(Pt),this}removeClassName(Pt){return this._container&&this._container.classList.remove(Pt),this}setOffset(Pt){return this.options.offset=Pt,this._update(),this}toggleClassName(Pt){if(this._container)return this._container.classList.toggle(Pt)}setSubpixelPositioning(Pt){this.options.subpixelPositioning=Pt}_createCloseButton(){this.options.closeButton&&(this._closeButton=a.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let Pt=this._container.querySelector(Ql);Pt&&Pt.focus()}},t.RasterDEMTileSource=Ct,t.RasterTileSource=wt,t.ScaleControl=class{constructor(Pt){this._onMove=()=>{Nu(this._map,this._container,this.options)},this.setUnit=L=>{this.options.unit=L,Nu(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},nl),Pt)}getDefaultPosition(){return"bottom-left"}onAdd(Pt){return this._map=Pt,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-scale",Pt.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){a.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},t.ScrollZoomHandler=mn,t.Style=kr,t.TerrainControl=class{constructor(Pt){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=Pt}onAdd(Pt){return this._map=Pt,this._container=a.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=a.create("button","maplibregl-ctrl-terrain",this._container),a.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){a.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},t.TwoFingersTouchPitchHandler=Dc,t.TwoFingersTouchRotateHandler=uc,t.TwoFingersTouchZoomHandler=Cs,t.TwoFingersTouchZoomRotateHandler=va,t.VectorTileSource=Tt,t.VideoSource=Jt,t.addSourceType=(Pt,L)=>e._(void 0,void 0,void 0,function*(){if(mt(Pt))throw new Error(`A source type called "${Pt}" already exists.`);((at,xt)=>{Zt[at]=xt})(Pt,L)}),t.clearPrewarmedResources=function(){let Pt=et;Pt&&(Pt.isPreloaded()&&Pt.numActive()===1?(Pt.release(rt),et=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},t.getMaxParallelImageRequests=function(){return e.a.MAX_PARALLEL_IMAGE_REQUESTS},t.getRTLTextPluginStatus=function(){return re().getRTLTextPluginStatus()},t.getVersion=function(){return Fc},t.getWorkerCount=function(){return ct.workerCount},t.getWorkerUrl=function(){return e.a.WORKER_URL},t.importScriptInWorkers=function(Pt){return Q().broadcast("IS",Pt)},t.prewarm=function(){ot().acquire(rt)},t.setMaxParallelImageRequests=function(Pt){e.a.MAX_PARALLEL_IMAGE_REQUESTS=Pt},t.setRTLTextPlugin=function(Pt,L){return re().setRTLTextPlugin(Pt,L)},t.setWorkerCount=function(Pt){ct.workerCount=Pt},t.setWorkerUrl=function(Pt){e.a.WORKER_URL=Pt}});var A=u;return A})}),Lz=Vt((K,V)=>{var u=Xr(),d=Dl().sanitizeHTML,E=R5(),A=Gd();function t(o,a){this.subplot=o,this.uid=o.uid+"-"+a,this.index=a,this.idSource="source-"+this.uid,this.idLayer=A.layoutLayerPrefix+this.uid,this.sourceType=null,this.source=null,this.layerType=null,this.below=null,this.visible=!1}var e=t.prototype;e.update=function(o){this.visible?this.needsNewImage(o)?this.updateImage(o):this.needsNewSource(o)?(this.removeLayer(),this.updateSource(o),this.updateLayer(o)):this.needsNewLayer(o)?this.updateLayer(o):this.updateStyle(o):(this.updateSource(o),this.updateLayer(o)),this.visible=r(o)},e.needsNewImage=function(o){var a=this.subplot.map;return a.getSource(this.idSource)&&this.sourceType==="image"&&o.sourcetype==="image"&&(this.source!==o.source||JSON.stringify(this.coordinates)!==JSON.stringify(o.coordinates))},e.needsNewSource=function(o){return this.sourceType!==o.sourcetype||JSON.stringify(this.source)!==JSON.stringify(o.source)||this.layerType!==o.type},e.needsNewLayer=function(o){return this.layerType!==o.type||this.below!==this.subplot.belowLookup["layout-"+this.index]},e.lookupBelow=function(){return this.subplot.belowLookup["layout-"+this.index]},e.updateImage=function(o){var a=this.subplot.map;a.getSource(this.idSource).updateImage({url:o.source,coordinates:o.coordinates});var s=this.findFollowingMapLayerId(this.lookupBelow());s!==null&&this.subplot.map.moveLayer(this.idLayer,s)},e.updateSource=function(o){var a=this.subplot.map;if(a.getSource(this.idSource)&&a.removeSource(this.idSource),this.sourceType=o.sourcetype,this.source=o.source,!!r(o)){var s=n(o);a.addSource(this.idSource,s)}},e.findFollowingMapLayerId=function(o){if(o==="traces")for(var a=this.subplot.getMapLayers(),s=0;s0){for(var s=0;s0}function i(o){var a={},s={};switch(o.type){case"circle":u.extendFlat(s,{"circle-radius":o.circle.radius,"circle-color":o.color,"circle-opacity":o.opacity});break;case"line":u.extendFlat(s,{"line-width":o.line.width,"line-color":o.color,"line-opacity":o.opacity,"line-dasharray":o.line.dash});break;case"fill":u.extendFlat(s,{"fill-color":o.color,"fill-outline-color":o.fill.outlinecolor,"fill-opacity":o.opacity});break;case"symbol":var f=o.symbol,v=E(f.textposition,f.iconsize);u.extendFlat(a,{"icon-image":f.icon+"-15","icon-size":f.iconsize/10,"text-field":f.text,"text-size":f.textfont.size,"text-anchor":v.anchor,"text-offset":v.offset,"symbol-placement":f.placement}),u.extendFlat(s,{"icon-color":o.color,"text-color":f.textfont.color,"text-opacity":o.opacity});break;case"raster":u.extendFlat(s,{"raster-fade-duration":0,"raster-opacity":o.opacity});break}return{layout:a,paint:s}}function n(o){var a=o.sourcetype,s=o.source,f={type:a},v;return a==="geojson"?v="data":a==="vector"?v=typeof s=="string"?"url":"tiles":a==="raster"?(v="tiles",f.tileSize=256):a==="image"&&(v="url",f.coordinates=o.coordinates),f[v]=s,o.sourceattribution&&(f.attribution=d(o.sourceattribution)),f}V.exports=function(o,a,s){var f=new t(o,a);return f.update(s),f}}),Cz=Vt((K,V)=>{var u=zz(),d=Xr(),E=Vd(),A=ji(),t=yo(),e=oh(),r=pc(),i=$h(),n=i.drawMode,o=i.selectMode,a=Ec().prepSelect,s=Ec().clearOutline,f=Ec().clearSelectionsCache,v=Ec().selectOnClick,g=Gd(),m=Lz();function w(M,T){this.id=T,this.gd=M;var c=M._fullLayout,h=M._context;this.container=c._glcontainer.node(),this.isStatic=h.staticPlot,this.uid=c._uid+"-"+this.id,this.div=null,this.xaxis=null,this.yaxis=null,this.createFramework(c),this.map=null,this.styleObj=null,this.traceHash={},this.layerList=[],this.belowLookup={},this.dragging=!1,this.wheeling=!1}var l=w.prototype;l.plot=function(M,T,c){var h=this,b;h.map?b=new Promise(function(_,P){h.updateMap(M,T,_,P)}):b=new Promise(function(_,P){h.createMap(M,T,_,P)}),c.push(b)},l.createMap=function(M,T,c,h){var b=this,_=T[b.id],P=b.styleObj=y(_.style),z=_.bounds,D=z?[[z.west,z.south],[z.east,z.north]]:null,B=b.map=new u.Map({container:b.div,style:P.style,center:k(_.center),zoom:_.zoom,bearing:_.bearing,pitch:_.pitch,maxBounds:D,interactive:!b.isStatic,preserveDrawingBuffer:b.isStatic,doubleClickZoom:!1,boxZoom:!1,attributionControl:!1}).addControl(new u.AttributionControl({compact:!0})),R={};B.on("styleimagemissing",function(F){var j=F.id;if(!R[j]&&j.includes("-15")){R[j]=!0;var N=new Image(15,15);N.onload=function(){B.addImage(j,N)},N.crossOrigin="Anonymous",N.src="https://unpkg.com/maki@2.1.0/icons/"+j+".svg"}}),B.setTransformRequest(function(F){return F=F.replace("https://fonts.openmaptiles.org/Open Sans Extrabold","https://fonts.openmaptiles.org/Open Sans Extra Bold"),F=F.replace("https://tiles.basemaps.cartocdn.com/fonts/Open Sans Extrabold","https://fonts.openmaptiles.org/Open Sans Extra Bold"),F=F.replace("https://fonts.openmaptiles.org/Open Sans Regular,Arial Unicode MS Regular","https://fonts.openmaptiles.org/Klokantech Noto Sans Regular"),{url:F}}),B._canvas.style.left="0px",B._canvas.style.top="0px",b.rejectOnError(h),b.isStatic||b.initFx(M,T);var I=[];I.push(new Promise(function(F){B.once("load",F)})),I=I.concat(E.fetchTraceGeoData(M)),Promise.all(I).then(function(){b.fillBelowLookup(M,T),b.updateData(M),b.updateLayout(T),b.resolveOnRender(c)}).catch(h)},l.updateMap=function(M,T,c,h){var b=this,_=b.map,P=T[this.id];b.rejectOnError(h);var z=[],D=y(P.style);JSON.stringify(b.styleObj)!==JSON.stringify(D)&&(b.styleObj=D,_.setStyle(D.style),b.traceHash={},z.push(new Promise(function(B){_.once("styledata",B)}))),z=z.concat(E.fetchTraceGeoData(M)),Promise.all(z).then(function(){b.fillBelowLookup(M,T),b.updateData(M),b.updateLayout(T),b.resolveOnRender(c)}).catch(h)},l.fillBelowLookup=function(M,T){var c=T[this.id],h=c.layers,b,_,P=this.belowLookup={},z=!1;for(b=0;b1)for(b=0;b-1&&v(D.originalEvent,h,[c.xaxis],[c.yaxis],c.id,z),B.indexOf("event")>-1&&r.click(h,D.originalEvent)}}},l.updateFx=function(M){var T=this,c=T.map,h=T.gd;if(T.isStatic)return;function b(D){var B=T.map.unproject(D);return[B.lng,B.lat]}var _=M.dragmode,P;P=function(D,B){if(B.isRect){var R=D.range={};R[T.id]=[b([B.xmin,B.ymin]),b([B.xmax,B.ymax])]}else{var I=D.lassoPoints={};I[T.id]=B.map(b)}};var z=T.dragOptions;T.dragOptions=d.extendDeep(z||{},{dragmode:M.dragmode,element:T.div,gd:h,plotinfo:{id:T.id,domain:M[T.id].domain,xaxis:T.xaxis,yaxis:T.yaxis,fillRangeItems:P},xaxes:[T.xaxis],yaxes:[T.yaxis],subplot:T.id}),c.off("click",T.onClickInPanHandler),o(_)||n(_)?(c.dragPan.disable(),c.on("zoomstart",T.clearOutline),T.dragOptions.prepFn=function(D,B,R){a(D,B,R,T.dragOptions,_)},e.init(T.dragOptions)):(c.dragPan.enable(),c.off("zoomstart",T.clearOutline),T.div.onmousedown=null,T.div.ontouchstart=null,T.div.removeEventListener("touchstart",T.div._ontouchstart),T.onClickInPanHandler=T.onClickInPanFn(T.dragOptions),c.on("click",T.onClickInPanHandler))},l.updateFramework=function(M){var T=M[this.id].domain,c=M._size,h=this.div.style;h.width=c.w*(T.x[1]-T.x[0])+"px",h.height=c.h*(T.y[1]-T.y[0])+"px",h.left=c.l+T.x[0]*c.w+"px",h.top=c.t+(1-T.y[1])*c.h+"px",this.xaxis._offset=c.l+T.x[0]*c.w,this.xaxis._length=c.w*(T.x[1]-T.x[0]),this.yaxis._offset=c.t+(1-T.y[1])*c.h,this.yaxis._length=c.h*(T.y[1]-T.y[0])},l.updateLayers=function(M){var T=M[this.id],c=T.layers,h=this.layerList,b;if(c.length!==h.length){for(b=0;b{var u=Xr(),d=Cd(),E=Gf(),A=jv();V.exports=function(r,i,n){d(r,i,n,{type:"map",attributes:A,handleDefaults:t,partition:"y"})};function t(r,i,n){n("style"),n("center.lon"),n("center.lat"),n("zoom"),n("bearing"),n("pitch");var o=n("bounds.west"),a=n("bounds.east"),s=n("bounds.south"),f=n("bounds.north");(o===void 0||a===void 0||s===void 0||f===void 0)&&delete i.bounds,E(r,i,{name:"layers",handleItemDefaults:e}),i._input=r}function e(r,i){function n(g,m){return u.coerce(r,i,A.layers,g,m)}var o=n("visible");if(o){var a=n("sourcetype"),s=a==="raster"||a==="image";n("source"),n("sourceattribution"),a==="vector"&&n("sourcelayer"),a==="image"&&n("coordinates");var f;s&&(f="raster");var v=n("type",f);s&&v!=="raster"&&(v=i.type="raster",u.log("Source types *raster* and *image* must drawn *raster* layer type.")),n("below"),n("color"),n("opacity"),n("minzoom"),n("maxzoom"),v==="circle"&&n("circle.radius"),v==="line"&&(n("line.width"),n("line.dash")),v==="fill"&&n("fill.outlinecolor"),v==="symbol"&&(n("symbol.icon"),n("symbol.iconsize"),n("symbol.text"),u.coerceFont(n,"symbol.textfont",void 0,{noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0}),n("symbol.textposition"),n("symbol.placement"))}}}),e_=Vt(K=>{var V=Xr(),u=V.strTranslate,d=V.strScale,E=Pf().getSubplotCalcData,A=zh(),t=Ni(),e=Eo(),r=Dl(),i=Cz(),n="map";K.name=n,K.attr="subplot",K.idRoot=n,K.idRegex=K.attrRegex=V.counterRegex(n),K.attributes={subplot:{valType:"subplotid",dflt:"map",editType:"calc"}},K.layoutAttributes=jv(),K.supplyLayoutDefaults=Iz(),K.plot=function(o){for(var a=o._fullLayout,s=o.calcdata,f=a._subplots[n],v=0;vc/2){var h=S.split("|").join("
          ");M.text(h).attr("data-unformatted",h).call(r.convertToTspans,o),T=e.bBox(M.node())}M.attr("transform",u(-3,-T.height+8)),k.insert("rect",".static-attribution").attr({x:-T.width-6,y:-T.height-3,width:T.width+6,height:T.height+3,fill:"rgba(255, 255, 255, 0.75)"});var b=1;T.width+6>c&&(b=c/(T.width+6));var _=[f.l+f.w*m.x[1],f.t+f.h*(1-m.y[0])];k.attr("transform",u(_[0],_[1])+d(b))}},K.updateFx=function(o){for(var a=o._fullLayout,s=a._subplots[n],f=0;f{V.exports={attributes:Qx(),supplyDefaults:kz(),colorbar:Zf(),formatLabels:B5(),calc:Lx(),plot:Mz(),hoverPoints:t_().hoverPoints,eventData:Sz(),selectPoints:Ez(),styleOnSelect:function(u,d){if(d){var E=d[0].trace;E._glTrace.update(d)}},moduleType:"trace",name:"scattermap",basePlotModule:e_(),categories:["map","gl","symbols","showLegend","scatter-like"],meta:{}}}),Oz=Vt((K,V)=>{V.exports=Pz()}),N5=Vt((K,V)=>{var u=Ym(),d=Wl(),{hovertemplateAttrs:E,templatefallbackAttrs:A}=yl(),t=kl(),e=So().extendFlat;V.exports=e({locations:{valType:"data_array",editType:"calc"},z:{valType:"data_array",editType:"calc"},geojson:{valType:"any",editType:"calc"},featureidkey:e({},u.featureidkey,{}),below:{valType:"string",editType:"plot"},text:u.text,hovertext:u.hovertext,marker:{line:{color:e({},u.marker.line.color,{editType:"plot"}),width:e({},u.marker.line.width,{editType:"plot"}),editType:"calc"},opacity:e({},u.marker.opacity,{editType:"plot"}),editType:"calc"},selected:{marker:{opacity:e({},u.selected.marker.opacity,{editType:"plot"}),editType:"plot"},editType:"plot"},unselected:{marker:{opacity:e({},u.unselected.marker.opacity,{editType:"plot"}),editType:"plot"},editType:"plot"},hoverinfo:u.hoverinfo,hovertemplate:E({},{keys:["properties"]}),hovertemplatefallback:A(),showlegend:e({},t.showlegend,{dflt:!1})},d("",{cLetter:"z",editTypeOverride:"calc"}))}),Dz=Vt((K,V)=>{var u=Xr(),d=vf(),E=N5();V.exports=function(A,t,e,r){function i(f,v){return u.coerce(A,t,E,f,v)}var n=i("locations"),o=i("z"),a=i("geojson");if(!u.isArrayOrTypedArray(n)||!n.length||!u.isArrayOrTypedArray(o)||!o.length||!(typeof a=="string"&&a!==""||u.isPlainObject(a))){t.visible=!1;return}i("featureidkey"),t._length=Math.min(n.length,o.length),i("below"),i("text"),i("hovertext"),i("hovertemplate"),i("hovertemplatefallback");var s=i("marker.line.width");s&&i("marker.line.color"),i("marker.opacity"),d(A,t,r,i,{prefix:"",cLetter:"z"}),u.coerceSelectionMarkerOpacity(t,i)}}),j5=Vt((K,V)=>{var u=Lo(),d=Xr(),E=xu(),A=Eo(),t=Ud().makeBlank,e=Vd();function r(n){var o=n[0].trace,a=o.visible===!0&&o._length!==0,s={layout:{visibility:"none"},paint:{}},f={layout:{visibility:"none"},paint:{}},v=o._opts={fill:s,line:f,geojson:t()};if(!a)return v;var g=e.extractTraceFeature(n);if(!g)return v;var m=E.makeColorScaleFuncFromTrace(o),w=o.marker,l=w.line||{},x;d.isArrayOrTypedArray(w.opacity)&&(x=function(b){var _=b.mo;return u(_)?+d.constrain(_,0,1):0});var y;d.isArrayOrTypedArray(l.color)&&(y=function(b){return b.mlc});var S;d.isArrayOrTypedArray(l.width)&&(S=function(b){return b.mlw});for(var k=0;k{var u=j5().convert,d=j5().convertOnSelect,E=Gd().traceLayerPrefix;function A(e,r){this.type="choroplethmap",this.subplot=e,this.uid=r,this.sourceId="source-"+r,this.layerList=[["fill",E+r+"-fill"],["line",E+r+"-line"]],this.below=null}var t=A.prototype;t.update=function(e){this._update(u(e)),e[0].trace._glTrace=this},t.updateOnSelect=function(e){this._update(d(e))},t._update=function(e){var r=this.subplot,i=this.layerList,n=r.belowLookup["trace-"+this.uid];r.map.getSource(this.sourceId).setData(e.geojson),n!==this.below&&(this._removeLayers(),this._addLayers(e,n),this.below=n);for(var o=0;o=0;i--)e.removeLayer(r[i][1])},t.dispose=function(){var e=this.subplot.map;this._removeLayers(),e.removeSource(this.sourceId)},V.exports=function(e,r){var i=r[0].trace,n=new A(e,i.uid),o=n.sourceId,a=u(r),s=n.below=e.belowLookup["trace-"+i.uid];return e.map.addSource(o,{type:"geojson",data:a.geojson}),n._addLayers(a,s),r[0].trace._glTrace=n,n}}),Bz=Vt((K,V)=>{V.exports={attributes:N5(),supplyDefaults:Dz(),colorbar:Ld(),calc:Ox(),plot:Fz(),hoverPoints:Fx(),eventData:Bx(),selectPoints:Rx(),styleOnSelect:function(u,d){if(d){var E=d[0].trace;E._glTrace.updateOnSelect(d)}},getBelow:function(u,d){for(var E=d.getMapLayers(),A=E.length-2;A>=0;A--){var t=E[A].id;if(typeof t=="string"&&t.indexOf("water")===0){for(var e=A+1;e{V.exports=Bz()}),U5=Vt((K,V)=>{var u=Wl(),{hovertemplateAttrs:d,templatefallbackAttrs:E}=yl(),A=kl(),t=Qx(),e=So().extendFlat;V.exports=e({lon:t.lon,lat:t.lat,z:{valType:"data_array",editType:"calc"},radius:{valType:"number",editType:"plot",arrayOk:!0,min:1,dflt:30},below:{valType:"string",editType:"plot"},text:t.text,hovertext:t.hovertext,hoverinfo:e({},A.hoverinfo,{flags:["lon","lat","z","text","name"]}),hovertemplate:d(),hovertemplatefallback:E(),showlegend:e({},A.showlegend,{dflt:!1})},u("",{cLetter:"z",editTypeOverride:"calc"}))}),Nz=Vt((K,V)=>{var u=Xr(),d=vf(),E=U5();V.exports=function(A,t,e,r){function i(s,f){return u.coerce(A,t,E,s,f)}var n=i("lon")||[],o=i("lat")||[],a=Math.min(n.length,o.length);if(!a){t.visible=!1;return}t._length=a,i("z"),i("radius"),i("below"),i("text"),i("hovertext"),i("hovertemplate"),i("hovertemplatefallback"),d(A,t,r,i,{prefix:"",cLetter:"z"})}}),jz=Vt((K,V)=>{var u=Lo(),d=Xr().isArrayOrTypedArray,E=ks().BADNUM,A=ih(),t=Xr()._;V.exports=function(e,r){for(var i=r._length,n=new Array(i),o=r.z,a=d(o)&&o.length,s=0;s{var u=Lo(),d=Xr(),E=Pi(),A=xu(),t=ks().BADNUM,e=Ud().makeBlank;V.exports=function(r){var i=r[0].trace,n=i.visible===!0&&i._length!==0,o={layout:{visibility:"none"},paint:{}},a=i._opts={heatmap:o,geojson:e()};if(!n)return a;var s=[],f,v=i.z,g=i.radius,m=d.isArrayOrTypedArray(v)&&v.length,w=d.isArrayOrTypedArray(g);for(f=0;f0?+g[f]:0),s.push({type:"Feature",geometry:{type:"Point",coordinates:x},properties:y})}}var k=A.extractOpts(i),M=k.reversescale?A.flipScale(k.colorscale):k.colorscale,T=M[0][1],c=E.opacity(T)<1?T:E.addOpacity(T,0),h=["interpolate",["linear"],["heatmap-density"],0,c];for(f=1;f{var u=Uz(),d=Gd().traceLayerPrefix;function E(t,e){this.type="densitymap",this.subplot=t,this.uid=e,this.sourceId="source-"+e,this.layerList=[["heatmap",d+e+"-heatmap"]],this.below=null}var A=E.prototype;A.update=function(t){var e=this.subplot,r=this.layerList,i=u(t),n=e.belowLookup["trace-"+this.uid];e.map.getSource(this.sourceId).setData(i.geojson),n!==this.below&&(this._removeLayers(),this._addLayers(i,n),this.below=n);for(var o=0;o=0;r--)t.removeLayer(e[r][1])},A.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},V.exports=function(t,e){var r=e[0].trace,i=new E(t,r.uid),n=i.sourceId,o=u(e),a=i.below=t.belowLookup["trace-"+r.uid];return t.map.addSource(n,{type:"geojson",data:o.geojson}),i._addLayers(o,a),i}}),Hz=Vt((K,V)=>{var u=yo(),d=t_().hoverPoints,E=t_().getExtraText;V.exports=function(A,t,e){var r=d(A,t,e);if(r){var i=r[0],n=i.cd,o=n[0].trace,a=n[i.index];if(delete i.color,"z"in a){var s=i.subplot.mockAxis;i.z=a.z,i.zLabel=u.tickText(s,s.c2l(a.z),"hover").text}return i.extraText=E(o,a,n[0].t.labels),[i]}}}),qz=Vt((K,V)=>{V.exports=function(u,d){return u.lon=d.lon,u.lat=d.lat,u.z=d.z,u}}),Wz=Vt((K,V)=>{V.exports={attributes:U5(),supplyDefaults:Nz(),colorbar:Ld(),formatLabels:B5(),calc:jz(),plot:Vz(),hoverPoints:Hz(),eventData:qz(),getBelow:function(u,d){for(var E=d.getMapLayers(),A=0;A{V.exports=Wz()}),V5=Vt((K,V)=>{var u=yu(),d=kl(),E=af(),A=vm(),t=Hu().attributes,{hovertemplateAttrs:e,templatefallbackAttrs:r}=yl(),i=Wl(),n=cl().templatedArray,o=hc().descriptionOnlyNumbers,a=So().extendFlat,s=Cu().overrideAll;V.exports=s({hoverinfo:a({},d.hoverinfo,{flags:[],arrayOk:!1}),hoverlabel:A.hoverlabel,domain:t({name:"sankey",trace:!0}),orientation:{valType:"enumerated",values:["v","h"],dflt:"h"},valueformat:{valType:"string",dflt:".3s",description:o("value")},valuesuffix:{valType:"string",dflt:""},arrangement:{valType:"enumerated",values:["snap","perpendicular","freeform","fixed"],dflt:"snap"},textfont:u({autoShadowDflt:!0}),customdata:void 0,node:{label:{valType:"data_array",dflt:[]},groups:{valType:"info_array",impliedEdits:{x:[],y:[]},dimensions:2,freeLength:!0,dflt:[],items:{valType:"number",editType:"calc"}},x:{valType:"data_array",dflt:[]},y:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},customdata:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:E.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:.5,arrayOk:!0}},pad:{valType:"number",arrayOk:!1,min:0,dflt:20},thickness:{valType:"number",arrayOk:!1,min:1,dflt:20},hoverinfo:{valType:"enumerated",values:["all","none","skip"],dflt:"all"},hoverlabel:A.hoverlabel,hovertemplate:e({},{keys:["value","label"]}),hovertemplatefallback:r(),align:{valType:"enumerated",values:["justify","left","right","center"],dflt:"justify"}},link:{arrowlen:{valType:"number",min:0,dflt:0},label:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},hovercolor:{valType:"color",arrayOk:!0},customdata:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:E.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}},source:{valType:"data_array",dflt:[]},target:{valType:"data_array",dflt:[]},value:{valType:"data_array",dflt:[]},hoverinfo:{valType:"enumerated",values:["all","none","skip"],dflt:"all"},hoverlabel:A.hoverlabel,hovertemplate:e({},{keys:["value","label"]}),hovertemplatefallback:r(),colorscales:n("concentrationscales",{editType:"calc",label:{valType:"string",editType:"calc",dflt:""},cmax:{valType:"number",editType:"calc",dflt:1},cmin:{valType:"number",editType:"calc",dflt:0},colorscale:a(i().colorscale,{dflt:[[0,"white"],[1,"black"]]})})}},"calc","nested")}),Zz=Vt((K,V)=>{var u=Xr(),d=V5(),E=Pi(),A=Af(),t=Hu().defaults,e=jg(),r=cl(),i=Gf();V.exports=function(o,a,s,f){function v(P,z){return u.coerce(o,a,d,P,z)}var g=u.extendDeep(f.hoverlabel,o.hoverlabel),m=o.node,w=r.newContainer(a,"node");function l(P,z){return u.coerce(m,w,d.node,P,z)}l("label"),l("groups"),l("x"),l("y"),l("pad"),l("thickness"),l("line.color"),l("line.width"),l("hoverinfo",o.hoverinfo),e(m,w,l,g),l("hovertemplate"),l("align");var x=f.colorway,y=function(P){return x[P%x.length]};l("color",w.label.map(function(P,z){return E.addOpacity(y(z),.8)})),l("customdata");var S=o.link||{},k=r.newContainer(a,"link");function M(P,z){return u.coerce(S,k,d.link,P,z)}M("label"),M("arrowlen"),M("source"),M("target"),M("value"),M("line.color"),M("line.width"),M("hoverinfo",o.hoverinfo),e(S,k,M,g),M("hovertemplate");var T=A(f.paper_bgcolor).getLuminance()<.333,c=T?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)",h=M("color",c);function b(P){var z=A(P);if(!z.isValid())return P;var D=z.getAlpha();return D<=.8?z.setAlpha(D+.2):z=T?z.brighten():z.darken(),z.toRgbString()}M("hovercolor",Array.isArray(h)?h.map(b):b(h)),M("customdata"),i(S,k,{name:"colorscales",handleItemDefaults:n}),t(a,f,v),v("orientation"),v("valueformat"),v("valuesuffix");var _;w.x.length&&w.y.length&&(_="freeform"),v("arrangement",_),u.coerceFont(v,"textfont",f.font,{autoShadowDflt:!0}),a._length=null};function n(o,a){function s(f,v){return u.coerce(o,a,d.link.colorscales,f,v)}s("label"),s("cmin"),s("cmax"),s("colorscale")}}),H5=Vt((K,V)=>{V.exports=u;function u(d){for(var E=d.length,A=new Array(E),t=new Array(E),e=new Array(E),r=new Array(E),i=new Array(E),n=new Array(E),o=0;o0;){l=y[y.length-1];var S=d[l];if(r[l]=0&&n[l].push(i[M])}r[l]=k}else{if(t[l]===A[l]){for(var T=[],c=[],h=0,k=x.length-1;k>=0;--k){var b=x[k];if(e[b]=!1,T.push(b),c.push(n[b]),h+=n[b].length,i[b]=s.length,b===l){x.length=k;break}}s.push(T);for(var _=new Array(h),k=0;k{var u=H5(),d=Xr(),E=wp().wrap,A=d.isArrayOrTypedArray,t=d.isIndex,e=xu();function r(n){var o=n.node,a=n.link,s=[],f=A(a.color),v=A(a.hovercolor),g=A(a.customdata),m={},w={},l=a.colorscales.length,x;for(x=0;xM&&(M=a.source[x]),a.target[x]>M&&(M=a.target[x]);var T=M+1;n.node._count=T;var c,h=n.node.groups,b={};for(x=0;x0&&t(R,T)&&t(I,T)&&!(b.hasOwnProperty(R)&&b.hasOwnProperty(I)&&b[R]===b[I])){b.hasOwnProperty(I)&&(I=b[I]),b.hasOwnProperty(R)&&(R=b[R]),R=+R,I=+I,m[R]=m[I]=!0;var F="";a.label&&a.label[x]&&(F=a.label[x]);var j=null;F&&w.hasOwnProperty(F)&&(j=w[F]),s.push({pointNumber:x,label:F,color:f?a.color[x]:a.color,hovercolor:v?a.hovercolor[x]:a.hovercolor,customdata:g?a.customdata[x]:a.customdata,concentrationscale:j,source:R,target:I,value:+B}),D.source.push(R),D.target.push(I)}}var N=T+h.length,G=A(o.color),rt=A(o.customdata),ct=[];for(x=0;xT-1,childrenNodes:[],pointNumber:x,label:st,color:G?o.color[x]:o.color,customdata:rt?o.customdata[x]:o.customdata})}var et=!1;return i(N,D.source,D.target)&&(et=!0),{circular:et,links:s,nodes:ct,groups:h,groupLookup:b}}function i(n,o,a){for(var s=d.init2dArray(n,0),f=0;f1})}V.exports=function(n,o){var a=r(o);return E({circular:a.circular,_nodes:a.nodes,_links:a.links,_groups:a.groups,_groupLookup:a.groupLookup})}}),Yz=Vt((K,V)=>{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K):(u=u||self,d(u.d3=u.d3||{}))})(K,function(u){function d(T){var c=+this._x.call(null,T),h=+this._y.call(null,T);return E(this.cover(c,h),c,h,T)}function E(T,c,h,b){if(isNaN(c)||isNaN(h))return T;var _,P=T._root,z={data:b},D=T._x0,B=T._y0,R=T._x1,I=T._y1,F,j,N,G,rt,ct,st,et;if(!P)return T._root=z,T;for(;P.length;)if((rt=c>=(F=(D+R)/2))?D=F:R=F,(ct=h>=(j=(B+I)/2))?B=j:I=j,_=P,!(P=P[st=ct<<1|rt]))return _[st]=z,T;if(N=+T._x.call(null,P.data),G=+T._y.call(null,P.data),c===N&&h===G)return z.next=P,_?_[st]=z:T._root=z,T;do _=_?_[st]=new Array(4):T._root=new Array(4),(rt=c>=(F=(D+R)/2))?D=F:R=F,(ct=h>=(j=(B+I)/2))?B=j:I=j;while((st=ct<<1|rt)===(et=(G>=j)<<1|N>=F));return _[et]=P,_[st]=z,T}function A(T){var c,h,b=T.length,_,P,z=new Array(b),D=new Array(b),B=1/0,R=1/0,I=-1/0,F=-1/0;for(h=0;hI&&(I=_),PF&&(F=P));if(B>I||R>F)return this;for(this.cover(B,R).cover(I,F),h=0;hT||T>=_||b>c||c>=P;)switch(R=(cI||(D=G.y0)>F||(B=G.x1)<_||(R=G.y1)=st)<<1|T>=ct)&&(G=j[j.length-1],j[j.length-1]=j[j.length-1-rt],j[j.length-1-rt]=G)}else{var et=T-+this._x.call(null,N.data),Z=c-+this._y.call(null,N.data),ot=et*et+Z*Z;if(ot=(j=(z+B)/2))?z=j:B=j,(rt=F>=(N=(D+R)/2))?D=N:R=N,c=h,!(h=h[ct=rt<<1|G]))return this;if(!h.length)break;(c[ct+1&3]||c[ct+2&3]||c[ct+3&3])&&(b=c,st=ct)}for(;h.data!==T;)if(_=h,!(h=h.next))return this;return(P=h.next)&&delete h.next,_?(P?_.next=P:delete _.next,this):c?(P?c[ct]=P:delete c[ct],(h=c[0]||c[1]||c[2]||c[3])&&h===(c[3]||c[2]||c[1]||c[0])&&!h.length&&(b?b[st]=h:this._root=h),this):(this._root=P,this)}function a(T){for(var c=0,h=T.length;c{(function(u,d){d(typeof K=="object"&&typeof V<"u"?K:u.d3=u.d3||{})})(K,function(u){var d="$";function E(){}E.prototype=A.prototype={constructor:E,has:function(m){return d+m in this},get:function(m){return this[d+m]},set:function(m,w){return this[d+m]=w,this},remove:function(m){var w=d+m;return w in this&&delete this[w]},clear:function(){for(var m in this)m[0]===d&&delete this[m]},keys:function(){var m=[];for(var w in this)w[0]===d&&m.push(w.slice(1));return m},values:function(){var m=[];for(var w in this)w[0]===d&&m.push(this[w]);return m},entries:function(){var m=[];for(var w in this)w[0]===d&&m.push({key:w.slice(1),value:this[w]});return m},size:function(){var m=0;for(var w in this)w[0]===d&&++m;return m},empty:function(){for(var m in this)if(m[0]===d)return!1;return!0},each:function(m){for(var w in this)w[0]===d&&m(this[w],w.slice(1),this)}};function A(m,w){var l=new E;if(m instanceof E)m.each(function(M,T){l.set(T,M)});else if(Array.isArray(m)){var x=-1,y=m.length,S;if(w==null)for(;++x=m.length)return l!=null&&M.sort(l),x!=null?x(M):M;for(var b=-1,_=M.length,P=m[T++],z,D,B=A(),R,I=c();++b<_;)(R=B.get(z=P(D=M[b])+""))?R.push(D):B.set(z,[D]);return B.each(function(F,j){h(I,j,S(F,T,c,h))}),I}function k(M,T){if(++T>m.length)return M;var c,h=w[T-1];return x!=null&&T>=m.length?c=M.entries():(c=[],M.each(function(b,_){c.push({key:_,values:k(b,T)})})),h!=null?c.sort(function(b,_){return h(b.key,_.key)}):c}return y={object:function(M){return S(M,0,e,r)},map:function(M){return S(M,0,i,n)},entries:function(M){return k(S(M,0,i,n),0)},key:function(M){return m.push(M),y},sortKeys:function(M){return w[m.length-1]=M,y},sortValues:function(M){return l=M,y},rollup:function(M){return x=M,y}}}function e(){return{}}function r(m,w,l){m[w]=l}function i(){return A()}function n(m,w,l){m.set(w,l)}function o(){}var a=A.prototype;o.prototype=s.prototype={constructor:o,has:a.has,add:function(m){return m+="",this[d+m]=m,this},remove:a.remove,clear:a.clear,values:a.keys,size:a.size,empty:a.empty,each:a.each};function s(m,w){var l=new o;if(m instanceof o)m.each(function(S){l.add(S)});else if(m){var x=-1,y=m.length;if(w==null)for(;++x{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K):(u=u||self,d(u.d3=u.d3||{}))})(K,function(u){var d={value:function(){}};function E(){for(var i=0,n=arguments.length,o={},a;i=0&&(a=o.slice(s+1),o=o.slice(0,s)),o&&!n.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:a}})}A.prototype=E.prototype={constructor:A,on:function(i,n){var o=this._,a=t(i+"",o),s,f=-1,v=a.length;if(arguments.length<2){for(;++f0)for(var o=new Array(s),a=0,s,f;a{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K):(u=u||self,d(u.d3=u.d3||{}))})(K,function(u){var d=0,E=0,A=0,t=1e3,e,r,i=0,n=0,o=0,a=typeof performance=="object"&&performance.now?performance:Date,s=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(T){setTimeout(T,17)};function f(){return n||(s(v),n=a.now()+o)}function v(){n=0}function g(){this._call=this._time=this._next=null}g.prototype=m.prototype={constructor:g,restart:function(T,c,h){if(typeof T!="function")throw new TypeError("callback is not a function");h=(h==null?f():+h)+(c==null?0:+c),!this._next&&r!==this&&(r?r._next=this:e=this,r=this),this._call=T,this._time=h,S()},stop:function(){this._call&&(this._call=null,this._time=1/0,S())}};function m(T,c,h){var b=new g;return b.restart(T,c,h),b}function w(){f(),++d;for(var T=e,c;T;)(c=n-T._time)>=0&&T._call.call(null,c),T=T._next;--d}function l(){n=(i=a.now())+o,d=E=0;try{w()}finally{d=0,y(),n=0}}function x(){var T=a.now(),c=T-i;c>t&&(o-=c,i=T)}function y(){for(var T,c=e,h,b=1/0;c;)c._call?(b>c._time&&(b=c._time),T=c,c=c._next):(h=c._next,c._next=null,c=T?T._next=h:e=h);r=T,S(b)}function S(T){if(!d){E&&(E=clearTimeout(E));var c=T-n;c>24?(T<1/0&&(E=setTimeout(l,T-a.now()-o)),A&&(A=clearInterval(A))):(A||(i=a.now(),A=setInterval(x,t)),d=1,s(l))}}function k(T,c,h){var b=new g;return c=c==null?0:+c,b.restart(function(_){b.stop(),T(_+c)},c,h),b}function M(T,c,h){var b=new g,_=c;return c==null?(b.restart(T,c,h),b):(c=+c,h=h==null?f():+h,b.restart(function P(z){z+=_,b.restart(P,_+=c,h),T(z)},c,h),b)}u.interval=M,u.now=f,u.timeout=k,u.timer=m,u.timerFlush=w,Object.defineProperty(u,"__esModule",{value:!0})})}),Jz=Vt((K,V)=>{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K,Yz(),r_(),Xz(),$z()):d(u.d3=u.d3||{},u.d3,u.d3,u.d3,u.d3)})(K,function(u,d,E,A,t){function e(T,c){var h;T==null&&(T=0),c==null&&(c=0);function b(){var _,P=h.length,z,D=0,B=0;for(_=0;_F.index){var it=j-ut.x-ut.vx,nt=N-ut.y-ut.vy,dt=it*it+nt*nt;dtj+q||XN+q||QB.r&&(B.r=B[R].r)}function D(){if(c){var B,R=c.length,I;for(h=new Array(R),B=0;B1?(rt==null?D.remove(G):D.set(G,N(rt)),c):D.get(G)},find:function(G,rt,ct){var st=0,et=T.length,Z,ot,X,Q,ut;for(ct==null?ct=1/0:ct*=ct,st=0;st1?(R.on(G,rt),c):R.on(G)}}}function y(){var T,c,h,b=r(-30),_,P=1,z=1/0,D=.81;function B(j){var N,G=T.length,rt=d.quadtree(T,g,m).visitAfter(I);for(h=j,N=0;N=z)){(j.data!==c||j.next)&&(ct===0&&(ct=i(),Z+=ct*ct),st===0&&(st=i(),Z+=st*st),Z{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K):(u=u||self,d(u.d3=u.d3||{}))})(K,function(u){var d=Math.PI,E=2*d,A=1e-6,t=E-A;function e(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function r(){return new e}e.prototype=r.prototype={constructor:e,moveTo:function(i,n){this._+="M"+(this._x0=this._x1=+i)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(i,n){this._+="L"+(this._x1=+i)+","+(this._y1=+n)},quadraticCurveTo:function(i,n,o,a){this._+="Q"+ +i+","+ +n+","+(this._x1=+o)+","+(this._y1=+a)},bezierCurveTo:function(i,n,o,a,s,f){this._+="C"+ +i+","+ +n+","+ +o+","+ +a+","+(this._x1=+s)+","+(this._y1=+f)},arcTo:function(i,n,o,a,s){i=+i,n=+n,o=+o,a=+a,s=+s;var f=this._x1,v=this._y1,g=o-i,m=a-n,w=f-i,l=v-n,x=w*w+l*l;if(s<0)throw new Error("negative radius: "+s);if(this._x1===null)this._+="M"+(this._x1=i)+","+(this._y1=n);else if(x>A)if(!(Math.abs(l*g-m*w)>A)||!s)this._+="L"+(this._x1=i)+","+(this._y1=n);else{var y=o-f,S=a-v,k=g*g+m*m,M=y*y+S*S,T=Math.sqrt(k),c=Math.sqrt(x),h=s*Math.tan((d-Math.acos((k+x-M)/(2*T*c)))/2),b=h/c,_=h/T;Math.abs(b-1)>A&&(this._+="L"+(i+b*w)+","+(n+b*l)),this._+="A"+s+","+s+",0,0,"+ +(l*y>w*S)+","+(this._x1=i+_*g)+","+(this._y1=n+_*m)}},arc:function(i,n,o,a,s,f){i=+i,n=+n,o=+o,f=!!f;var v=o*Math.cos(a),g=o*Math.sin(a),m=i+v,w=n+g,l=1^f,x=f?a-s:s-a;if(o<0)throw new Error("negative radius: "+o);this._x1===null?this._+="M"+m+","+w:(Math.abs(this._x1-m)>A||Math.abs(this._y1-w)>A)&&(this._+="L"+m+","+w),o&&(x<0&&(x=x%E+E),x>t?this._+="A"+o+","+o+",0,1,"+l+","+(i-v)+","+(n-g)+"A"+o+","+o+",0,1,"+l+","+(this._x1=m)+","+(this._y1=w):x>A&&(this._+="A"+o+","+o+",0,"+ +(x>=d)+","+l+","+(this._x1=i+o*Math.cos(s))+","+(this._y1=n+o*Math.sin(s))))},rect:function(i,n,o,a){this._+="M"+(this._x0=this._x1=+i)+","+(this._y0=this._y1=+n)+"h"+ +o+"v"+ +a+"h"+-o+"Z"},toString:function(){return this._}},u.path=r,Object.defineProperty(u,"__esModule",{value:!0})})}),q5=Vt((K,V)=>{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K,Qz()):(u=u||self,d(u.d3=u.d3||{},u.d3))})(K,function(u,d){function E(pe){return function(){return pe}}var A=Math.abs,t=Math.atan2,e=Math.cos,r=Math.max,i=Math.min,n=Math.sin,o=Math.sqrt,a=1e-12,s=Math.PI,f=s/2,v=2*s;function g(pe){return pe>1?0:pe<-1?s:Math.acos(pe)}function m(pe){return pe>=1?f:pe<=-1?-f:Math.asin(pe)}function w(pe){return pe.innerRadius}function l(pe){return pe.outerRadius}function x(pe){return pe.startAngle}function y(pe){return pe.endAngle}function S(pe){return pe&&pe.padAngle}function k(pe,Ke,xr,Gr,ln,wn,rn,Qr){var vn=xr-pe,Oa=Gr-Ke,Qn=rn-ln,Qa=Qr-wn,Ja=Qa*vn-Qn*Oa;if(!(Ja*Jats*ts+vs*vs&&(Po=Gi,hs=uo),{cx:Po,cy:hs,x01:-Qn,y01:-Qa,x11:Po*(ln/zo-1),y11:hs*(ln/zo-1)}}function T(){var pe=w,Ke=l,xr=E(0),Gr=null,ln=x,wn=y,rn=S,Qr=null;function vn(){var Oa,Qn,Qa=+pe.apply(this,arguments),Ja=+Ke.apply(this,arguments),wi=ln.apply(this,arguments)-f,ci=wn.apply(this,arguments)-f,Ti=A(ci-wi),Ra=ci>wi;if(Qr||(Qr=Oa=d.path()),Jaa))Qr.moveTo(0,0);else if(Ti>v-a)Qr.moveTo(Ja*e(wi),Ja*n(wi)),Qr.arc(0,0,Ja,wi,ci,!Ra),Qa>a&&(Qr.moveTo(Qa*e(ci),Qa*n(ci)),Qr.arc(0,0,Qa,ci,wi,Ra));else{var Qi=wi,Hi=ci,Ho=wi,Ci=ci,zo=Ti,qi=Ti,qo=rn.apply(this,arguments)/2,Po=qo>a&&(Gr?+Gr.apply(this,arguments):o(Qa*Qa+Ja*Ja)),hs=i(A(Ja-Qa)/2,+xr.apply(this,arguments)),Gi=hs,uo=hs,yi,ao;if(Po>a){var ts=m(Po/Qa*n(qo)),vs=m(Po/Ja*n(qo));(zo-=ts*2)>a?(ts*=Ra?1:-1,Ho+=ts,Ci-=ts):(zo=0,Ho=Ci=(wi+ci)/2),(qi-=vs*2)>a?(vs*=Ra?1:-1,Qi+=vs,Hi-=vs):(qi=0,Qi=Hi=(wi+ci)/2)}var As=Ja*e(Qi),_o=Ja*n(Qi),Da=Qa*e(Ci),li=Qa*n(Ci);if(hs>a){var wo=Ja*e(Hi),Ms=Ja*n(Hi),Di=Qa*e(Ho),_s=Qa*n(Ho),No;if(Tia?uo>a?(yi=M(Di,_s,As,_o,Ja,uo,Ra),ao=M(wo,Ms,Da,li,Ja,uo,Ra),Qr.moveTo(yi.cx+yi.x01,yi.cy+yi.y01),uoa)||!(zo>a)?Qr.lineTo(Da,li):Gi>a?(yi=M(Da,li,wo,Ms,Qa,-Gi,Ra),ao=M(As,_o,Di,_s,Qa,-Gi,Ra),Qr.lineTo(yi.cx+yi.x01,yi.cy+yi.y01),Gi=Ja;--wi)Qr.point(Hi[wi],Ho[wi]);Qr.lineEnd(),Qr.areaEnd()}Ra&&(Hi[Qa]=+pe(Ti,Qa,Qn),Ho[Qa]=+xr(Ti,Qa,Qn),Qr.point(Ke?+Ke(Ti,Qa,Qn):Hi[Qa],Gr?+Gr(Ti,Qa,Qn):Ho[Qa]))}if(Qi)return Qr=null,Qi+""||null}function Oa(){return P().defined(ln).curve(rn).context(wn)}return vn.x=function(Qn){return arguments.length?(pe=typeof Qn=="function"?Qn:E(+Qn),Ke=null,vn):pe},vn.x0=function(Qn){return arguments.length?(pe=typeof Qn=="function"?Qn:E(+Qn),vn):pe},vn.x1=function(Qn){return arguments.length?(Ke=Qn==null?null:typeof Qn=="function"?Qn:E(+Qn),vn):Ke},vn.y=function(Qn){return arguments.length?(xr=typeof Qn=="function"?Qn:E(+Qn),Gr=null,vn):xr},vn.y0=function(Qn){return arguments.length?(xr=typeof Qn=="function"?Qn:E(+Qn),vn):xr},vn.y1=function(Qn){return arguments.length?(Gr=Qn==null?null:typeof Qn=="function"?Qn:E(+Qn),vn):Gr},vn.lineX0=vn.lineY0=function(){return Oa().x(pe).y(xr)},vn.lineY1=function(){return Oa().x(pe).y(Gr)},vn.lineX1=function(){return Oa().x(Ke).y(xr)},vn.defined=function(Qn){return arguments.length?(ln=typeof Qn=="function"?Qn:E(!!Qn),vn):ln},vn.curve=function(Qn){return arguments.length?(rn=Qn,wn!=null&&(Qr=rn(wn)),vn):rn},vn.context=function(Qn){return arguments.length?(Qn==null?wn=Qr=null:Qr=rn(wn=Qn),vn):wn},vn}function D(pe,Ke){return Kepe?1:Ke>=pe?0:NaN}function B(pe){return pe}function R(){var pe=B,Ke=D,xr=null,Gr=E(0),ln=E(v),wn=E(0);function rn(Qr){var vn,Oa=Qr.length,Qn,Qa,Ja=0,wi=new Array(Oa),ci=new Array(Oa),Ti=+Gr.apply(this,arguments),Ra=Math.min(v,Math.max(-v,ln.apply(this,arguments)-Ti)),Qi,Hi=Math.min(Math.abs(Ra)/Oa,wn.apply(this,arguments)),Ho=Hi*(Ra<0?-1:1),Ci;for(vn=0;vn0&&(Ja+=Ci);for(Ke!=null?wi.sort(function(zo,qi){return Ke(ci[zo],ci[qi])}):xr!=null&&wi.sort(function(zo,qi){return xr(Qr[zo],Qr[qi])}),vn=0,Qa=Ja?(Ra-Oa*Ho)/Ja:0;vn0?Ci*Qa:0)+Ho,ci[Qn]={data:Qr[Qn],index:vn,value:Ci,startAngle:Ti,endAngle:Qi,padAngle:Hi};return ci}return rn.value=function(Qr){return arguments.length?(pe=typeof Qr=="function"?Qr:E(+Qr),rn):pe},rn.sortValues=function(Qr){return arguments.length?(Ke=Qr,xr=null,rn):Ke},rn.sort=function(Qr){return arguments.length?(xr=Qr,Ke=null,rn):xr},rn.startAngle=function(Qr){return arguments.length?(Gr=typeof Qr=="function"?Qr:E(+Qr),rn):Gr},rn.endAngle=function(Qr){return arguments.length?(ln=typeof Qr=="function"?Qr:E(+Qr),rn):ln},rn.padAngle=function(Qr){return arguments.length?(wn=typeof Qr=="function"?Qr:E(+Qr),rn):wn},rn}var I=j(h);function F(pe){this._curve=pe}F.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(pe,Ke){this._curve.point(Ke*Math.sin(pe),Ke*-Math.cos(pe))}};function j(pe){function Ke(xr){return new F(pe(xr))}return Ke._curve=pe,Ke}function N(pe){var Ke=pe.curve;return pe.angle=pe.x,delete pe.x,pe.radius=pe.y,delete pe.y,pe.curve=function(xr){return arguments.length?Ke(j(xr)):Ke()._curve},pe}function G(){return N(P().curve(I))}function rt(){var pe=z().curve(I),Ke=pe.curve,xr=pe.lineX0,Gr=pe.lineX1,ln=pe.lineY0,wn=pe.lineY1;return pe.angle=pe.x,delete pe.x,pe.startAngle=pe.x0,delete pe.x0,pe.endAngle=pe.x1,delete pe.x1,pe.radius=pe.y,delete pe.y,pe.innerRadius=pe.y0,delete pe.y0,pe.outerRadius=pe.y1,delete pe.y1,pe.lineStartAngle=function(){return N(xr())},delete pe.lineX0,pe.lineEndAngle=function(){return N(Gr())},delete pe.lineX1,pe.lineInnerRadius=function(){return N(ln())},delete pe.lineY0,pe.lineOuterRadius=function(){return N(wn())},delete pe.lineY1,pe.curve=function(rn){return arguments.length?Ke(j(rn)):Ke()._curve},pe}function ct(pe,Ke){return[(Ke=+Ke)*Math.cos(pe-=Math.PI/2),Ke*Math.sin(pe)]}var st=Array.prototype.slice;function et(pe){return pe.source}function Z(pe){return pe.target}function ot(pe){var Ke=et,xr=Z,Gr=b,ln=_,wn=null;function rn(){var Qr,vn=st.call(arguments),Oa=Ke.apply(this,vn),Qn=xr.apply(this,vn);if(wn||(wn=Qr=d.path()),pe(wn,+Gr.apply(this,(vn[0]=Oa,vn)),+ln.apply(this,vn),+Gr.apply(this,(vn[0]=Qn,vn)),+ln.apply(this,vn)),Qr)return wn=null,Qr+""||null}return rn.source=function(Qr){return arguments.length?(Ke=Qr,rn):Ke},rn.target=function(Qr){return arguments.length?(xr=Qr,rn):xr},rn.x=function(Qr){return arguments.length?(Gr=typeof Qr=="function"?Qr:E(+Qr),rn):Gr},rn.y=function(Qr){return arguments.length?(ln=typeof Qr=="function"?Qr:E(+Qr),rn):ln},rn.context=function(Qr){return arguments.length?(wn=Qr??null,rn):wn},rn}function X(pe,Ke,xr,Gr,ln){pe.moveTo(Ke,xr),pe.bezierCurveTo(Ke=(Ke+Gr)/2,xr,Ke,ln,Gr,ln)}function Q(pe,Ke,xr,Gr,ln){pe.moveTo(Ke,xr),pe.bezierCurveTo(Ke,xr=(xr+ln)/2,Gr,xr,Gr,ln)}function ut(pe,Ke,xr,Gr,ln){var wn=ct(Ke,xr),rn=ct(Ke,xr=(xr+ln)/2),Qr=ct(Gr,xr),vn=ct(Gr,ln);pe.moveTo(wn[0],wn[1]),pe.bezierCurveTo(rn[0],rn[1],Qr[0],Qr[1],vn[0],vn[1])}function J(){return ot(X)}function q(){return ot(Q)}function it(){var pe=ot(ut);return pe.angle=pe.x,delete pe.x,pe.radius=pe.y,delete pe.y,pe}var nt={draw:function(pe,Ke){var xr=Math.sqrt(Ke/s);pe.moveTo(xr,0),pe.arc(0,0,xr,0,v)}},dt={draw:function(pe,Ke){var xr=Math.sqrt(Ke/5)/2;pe.moveTo(-3*xr,-xr),pe.lineTo(-xr,-xr),pe.lineTo(-xr,-3*xr),pe.lineTo(xr,-3*xr),pe.lineTo(xr,-xr),pe.lineTo(3*xr,-xr),pe.lineTo(3*xr,xr),pe.lineTo(xr,xr),pe.lineTo(xr,3*xr),pe.lineTo(-xr,3*xr),pe.lineTo(-xr,xr),pe.lineTo(-3*xr,xr),pe.closePath()}},Tt=Math.sqrt(1/3),wt=Tt*2,Ct={draw:function(pe,Ke){var xr=Math.sqrt(Ke/wt),Gr=xr*Tt;pe.moveTo(0,-xr),pe.lineTo(Gr,0),pe.lineTo(0,xr),pe.lineTo(-Gr,0),pe.closePath()}},It=.8908130915292852,Nt=Math.sin(s/10)/Math.sin(7*s/10),te=Math.sin(v/10)*Nt,Jt=-Math.cos(v/10)*Nt,ee={draw:function(pe,Ke){var xr=Math.sqrt(Ke*It),Gr=te*xr,ln=Jt*xr;pe.moveTo(0,-xr),pe.lineTo(Gr,ln);for(var wn=1;wn<5;++wn){var rn=v*wn/5,Qr=Math.cos(rn),vn=Math.sin(rn);pe.lineTo(vn*xr,-Qr*xr),pe.lineTo(Qr*Gr-vn*ln,vn*Gr+Qr*ln)}pe.closePath()}},Zt={draw:function(pe,Ke){var xr=Math.sqrt(Ke),Gr=-xr/2;pe.rect(Gr,Gr,xr,xr)}},mt=Math.sqrt(3),bt={draw:function(pe,Ke){var xr=-Math.sqrt(Ke/(mt*3));pe.moveTo(0,xr*2),pe.lineTo(-mt*xr,-xr),pe.lineTo(mt*xr,-xr),pe.closePath()}},vt=-.5,Ut=Math.sqrt(3)/2,re=1/Math.sqrt(12),Kt=(re/2+1)*3,ue={draw:function(pe,Ke){var xr=Math.sqrt(Ke/Kt),Gr=xr/2,ln=xr*re,wn=Gr,rn=xr*re+xr,Qr=-wn,vn=rn;pe.moveTo(Gr,ln),pe.lineTo(wn,rn),pe.lineTo(Qr,vn),pe.lineTo(vt*Gr-Ut*ln,Ut*Gr+vt*ln),pe.lineTo(vt*wn-Ut*rn,Ut*wn+vt*rn),pe.lineTo(vt*Qr-Ut*vn,Ut*Qr+vt*vn),pe.lineTo(vt*Gr+Ut*ln,vt*ln-Ut*Gr),pe.lineTo(vt*wn+Ut*rn,vt*rn-Ut*wn),pe.lineTo(vt*Qr+Ut*vn,vt*vn-Ut*Qr),pe.closePath()}},Me=[nt,dt,Ct,Zt,ee,bt,ue];function Ce(){var pe=E(nt),Ke=E(64),xr=null;function Gr(){var ln;if(xr||(xr=ln=d.path()),pe.apply(this,arguments).draw(xr,+Ke.apply(this,arguments)),ln)return xr=null,ln+""||null}return Gr.type=function(ln){return arguments.length?(pe=typeof ln=="function"?ln:E(ln),Gr):pe},Gr.size=function(ln){return arguments.length?(Ke=typeof ln=="function"?ln:E(+ln),Gr):Ke},Gr.context=function(ln){return arguments.length?(xr=ln??null,Gr):xr},Gr}function We(){}function qe(pe,Ke,xr){pe._context.bezierCurveTo((2*pe._x0+pe._x1)/3,(2*pe._y0+pe._y1)/3,(pe._x0+2*pe._x1)/3,(pe._y0+2*pe._y1)/3,(pe._x0+4*pe._x1+Ke)/6,(pe._y0+4*pe._y1+xr)/6)}function vr(pe){this._context=pe}vr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:qe(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(pe,Ke){switch(pe=+pe,Ke=+Ke,this._point){case 0:this._point=1,this._line?this._context.lineTo(pe,Ke):this._context.moveTo(pe,Ke);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:qe(this,pe,Ke);break}this._x0=this._x1,this._x1=pe,this._y0=this._y1,this._y1=Ke}};function _r(pe){return new vr(pe)}function er(pe){this._context=pe}er.prototype={areaStart:We,areaEnd:We,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(pe,Ke){switch(pe=+pe,Ke=+Ke,this._point){case 0:this._point=1,this._x2=pe,this._y2=Ke;break;case 1:this._point=2,this._x3=pe,this._y3=Ke;break;case 2:this._point=3,this._x4=pe,this._y4=Ke,this._context.moveTo((this._x0+4*this._x1+pe)/6,(this._y0+4*this._y1+Ke)/6);break;default:qe(this,pe,Ke);break}this._x0=this._x1,this._x1=pe,this._y0=this._y1,this._y1=Ke}};function Mr(pe){return new er(pe)}function Ir(pe){this._context=pe}Ir.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(pe,Ke){switch(pe=+pe,Ke=+Ke,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var xr=(this._x0+4*this._x1+pe)/6,Gr=(this._y0+4*this._y1+Ke)/6;this._line?this._context.lineTo(xr,Gr):this._context.moveTo(xr,Gr);break;case 3:this._point=4;default:qe(this,pe,Ke);break}this._x0=this._x1,this._x1=pe,this._y0=this._y1,this._y1=Ke}};function de(pe){return new Ir(pe)}function Dt(pe,Ke){this._basis=new vr(pe),this._beta=Ke}Dt.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var pe=this._x,Ke=this._y,xr=pe.length-1;if(xr>0)for(var Gr=pe[0],ln=Ke[0],wn=pe[xr]-Gr,rn=Ke[xr]-ln,Qr=-1,vn;++Qr<=xr;)vn=Qr/xr,this._basis.point(this._beta*pe[Qr]+(1-this._beta)*(Gr+vn*wn),this._beta*Ke[Qr]+(1-this._beta)*(ln+vn*rn));this._x=this._y=null,this._basis.lineEnd()},point:function(pe,Ke){this._x.push(+pe),this._y.push(+Ke)}};var qt=(function pe(Ke){function xr(Gr){return Ke===1?new vr(Gr):new Dt(Gr,Ke)}return xr.beta=function(Gr){return pe(+Gr)},xr})(.85);function _t(pe,Ke,xr){pe._context.bezierCurveTo(pe._x1+pe._k*(pe._x2-pe._x0),pe._y1+pe._k*(pe._y2-pe._y0),pe._x2+pe._k*(pe._x1-Ke),pe._y2+pe._k*(pe._y1-xr),pe._x2,pe._y2)}function lt(pe,Ke){this._context=pe,this._k=(1-Ke)/6}lt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:_t(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(pe,Ke){switch(pe=+pe,Ke=+Ke,this._point){case 0:this._point=1,this._line?this._context.lineTo(pe,Ke):this._context.moveTo(pe,Ke);break;case 1:this._point=2,this._x1=pe,this._y1=Ke;break;case 2:this._point=3;default:_t(this,pe,Ke);break}this._x0=this._x1,this._x1=this._x2,this._x2=pe,this._y0=this._y1,this._y1=this._y2,this._y2=Ke}};var yt=(function pe(Ke){function xr(Gr){return new lt(Gr,Ke)}return xr.tension=function(Gr){return pe(+Gr)},xr})(0);function St(pe,Ke){this._context=pe,this._k=(1-Ke)/6}St.prototype={areaStart:We,areaEnd:We,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(pe,Ke){switch(pe=+pe,Ke=+Ke,this._point){case 0:this._point=1,this._x3=pe,this._y3=Ke;break;case 1:this._point=2,this._context.moveTo(this._x4=pe,this._y4=Ke);break;case 2:this._point=3,this._x5=pe,this._y5=Ke;break;default:_t(this,pe,Ke);break}this._x0=this._x1,this._x1=this._x2,this._x2=pe,this._y0=this._y1,this._y1=this._y2,this._y2=Ke}};var Ht=(function pe(Ke){function xr(Gr){return new St(Gr,Ke)}return xr.tension=function(Gr){return pe(+Gr)},xr})(0);function Yt(pe,Ke){this._context=pe,this._k=(1-Ke)/6}Yt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(pe,Ke){switch(pe=+pe,Ke=+Ke,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:_t(this,pe,Ke);break}this._x0=this._x1,this._x1=this._x2,this._x2=pe,this._y0=this._y1,this._y1=this._y2,this._y2=Ke}};var se=(function pe(Ke){function xr(Gr){return new Yt(Gr,Ke)}return xr.tension=function(Gr){return pe(+Gr)},xr})(0);function ke(pe,Ke,xr){var Gr=pe._x1,ln=pe._y1,wn=pe._x2,rn=pe._y2;if(pe._l01_a>a){var Qr=2*pe._l01_2a+3*pe._l01_a*pe._l12_a+pe._l12_2a,vn=3*pe._l01_a*(pe._l01_a+pe._l12_a);Gr=(Gr*Qr-pe._x0*pe._l12_2a+pe._x2*pe._l01_2a)/vn,ln=(ln*Qr-pe._y0*pe._l12_2a+pe._y2*pe._l01_2a)/vn}if(pe._l23_a>a){var Oa=2*pe._l23_2a+3*pe._l23_a*pe._l12_a+pe._l12_2a,Qn=3*pe._l23_a*(pe._l23_a+pe._l12_a);wn=(wn*Oa+pe._x1*pe._l23_2a-Ke*pe._l12_2a)/Qn,rn=(rn*Oa+pe._y1*pe._l23_2a-xr*pe._l12_2a)/Qn}pe._context.bezierCurveTo(Gr,ln,wn,rn,pe._x2,pe._y2)}function Ee(pe,Ke){this._context=pe,this._alpha=Ke}Ee.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(pe,Ke){if(pe=+pe,Ke=+Ke,this._point){var xr=this._x2-pe,Gr=this._y2-Ke;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(xr*xr+Gr*Gr,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(pe,Ke):this._context.moveTo(pe,Ke);break;case 1:this._point=2;break;case 2:this._point=3;default:ke(this,pe,Ke);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=pe,this._y0=this._y1,this._y1=this._y2,this._y2=Ke}};var Ue=(function pe(Ke){function xr(Gr){return Ke?new Ee(Gr,Ke):new lt(Gr,0)}return xr.alpha=function(Gr){return pe(+Gr)},xr})(.5);function ir(pe,Ke){this._context=pe,this._alpha=Ke}ir.prototype={areaStart:We,areaEnd:We,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(pe,Ke){if(pe=+pe,Ke=+Ke,this._point){var xr=this._x2-pe,Gr=this._y2-Ke;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(xr*xr+Gr*Gr,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=pe,this._y3=Ke;break;case 1:this._point=2,this._context.moveTo(this._x4=pe,this._y4=Ke);break;case 2:this._point=3,this._x5=pe,this._y5=Ke;break;default:ke(this,pe,Ke);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=pe,this._y0=this._y1,this._y1=this._y2,this._y2=Ke}};var ar=(function pe(Ke){function xr(Gr){return Ke?new ir(Gr,Ke):new St(Gr,0)}return xr.alpha=function(Gr){return pe(+Gr)},xr})(.5);function Ye(pe,Ke){this._context=pe,this._alpha=Ke}Ye.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(pe,Ke){if(pe=+pe,Ke=+Ke,this._point){var xr=this._x2-pe,Gr=this._y2-Ke;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(xr*xr+Gr*Gr,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:ke(this,pe,Ke);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=pe,this._y0=this._y1,this._y1=this._y2,this._y2=Ke}};var Er=(function pe(Ke){function xr(Gr){return Ke?new Ye(Gr,Ke):new Yt(Gr,0)}return xr.alpha=function(Gr){return pe(+Gr)},xr})(.5);function pn(pe){this._context=pe}pn.prototype={areaStart:We,areaEnd:We,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(pe,Ke){pe=+pe,Ke=+Ke,this._point?this._context.lineTo(pe,Ke):(this._point=1,this._context.moveTo(pe,Ke))}};function dn(pe){return new pn(pe)}function bn(pe){return pe<0?-1:1}function Zn(pe,Ke,xr){var Gr=pe._x1-pe._x0,ln=Ke-pe._x1,wn=(pe._y1-pe._y0)/(Gr||ln<0&&-0),rn=(xr-pe._y1)/(ln||Gr<0&&-0),Qr=(wn*ln+rn*Gr)/(Gr+ln);return(bn(wn)+bn(rn))*Math.min(Math.abs(wn),Math.abs(rn),.5*Math.abs(Qr))||0}function En(pe,Ke){var xr=pe._x1-pe._x0;return xr?(3*(pe._y1-pe._y0)/xr-Ke)/2:Ke}function gn(pe,Ke,xr){var Gr=pe._x0,ln=pe._y0,wn=pe._x1,rn=pe._y1,Qr=(wn-Gr)/3;pe._context.bezierCurveTo(Gr+Qr,ln+Qr*Ke,wn-Qr,rn-Qr*xr,wn,rn)}function da(pe){this._context=pe}da.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:gn(this,this._t0,En(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(pe,Ke){var xr=NaN;if(pe=+pe,Ke=+Ke,!(pe===this._x1&&Ke===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(pe,Ke):this._context.moveTo(pe,Ke);break;case 1:this._point=2;break;case 2:this._point=3,gn(this,En(this,xr=Zn(this,pe,Ke)),xr);break;default:gn(this,this._t0,xr=Zn(this,pe,Ke));break}this._x0=this._x1,this._x1=pe,this._y0=this._y1,this._y1=Ke,this._t0=xr}}};function ra(pe){this._context=new Se(pe)}(ra.prototype=Object.create(da.prototype)).point=function(pe,Ke){da.prototype.point.call(this,Ke,pe)};function Se(pe){this._context=pe}Se.prototype={moveTo:function(pe,Ke){this._context.moveTo(Ke,pe)},closePath:function(){this._context.closePath()},lineTo:function(pe,Ke){this._context.lineTo(Ke,pe)},bezierCurveTo:function(pe,Ke,xr,Gr,ln,wn){this._context.bezierCurveTo(Ke,pe,Gr,xr,wn,ln)}};function Re(pe){return new da(pe)}function Ze(pe){return new ra(pe)}function tr(pe){this._context=pe}tr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var pe=this._x,Ke=this._y,xr=pe.length;if(xr)if(this._line?this._context.lineTo(pe[0],Ke[0]):this._context.moveTo(pe[0],Ke[0]),xr===2)this._context.lineTo(pe[1],Ke[1]);else for(var Gr=zr(pe),ln=zr(Ke),wn=0,rn=1;rn=0;--Ke)ln[Ke]=(rn[Ke]-ln[Ke+1])/wn[Ke];for(wn[xr-1]=(pe[xr]+ln[xr-1])/2,Ke=0;Ke=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(pe,Ke){switch(pe=+pe,Ke=+Ke,this._point){case 0:this._point=1,this._line?this._context.lineTo(pe,Ke):this._context.moveTo(pe,Ke);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,Ke),this._context.lineTo(pe,Ke);else{var xr=this._x*(1-this._t)+pe*this._t;this._context.lineTo(xr,this._y),this._context.lineTo(xr,Ke)}break}}this._x=pe,this._y=Ke}};function $r(pe){return new Yr(pe,.5)}function In(pe){return new Yr(pe,0)}function Nn(pe){return new Yr(pe,1)}function Kn(pe,Ke){if((rn=pe.length)>1)for(var xr=1,Gr,ln,wn=pe[Ke[0]],rn,Qr=wn.length;xr=0;)xr[Ke]=Ke;return xr}function ia(pe,Ke){return pe[Ke]}function Cn(){var pe=E([]),Ke=$n,xr=Kn,Gr=ia;function ln(wn){var rn=pe.apply(this,arguments),Qr,vn=wn.length,Oa=rn.length,Qn=new Array(Oa),Qa;for(Qr=0;Qr0){for(var xr,Gr,ln=0,wn=pe[0].length,rn;ln0)for(var xr,Gr=0,ln,wn,rn,Qr,vn,Oa=pe[Ke[0]].length;Gr0?(ln[0]=rn,ln[1]=rn+=wn):wn<0?(ln[1]=Qr,ln[0]=Qr+=wn):(ln[0]=0,ln[1]=wn)}function ve(pe,Ke){if((ln=pe.length)>0){for(var xr=0,Gr=pe[Ke[0]],ln,wn=Gr.length;xr0)||!((wn=(ln=pe[Ke[0]]).length)>0))){for(var xr=0,Gr=1,ln,wn,rn;Grwn&&(wn=ln,xr=Ke);return xr}function Tr(pe){var Ke=pe.map(mr);return $n(pe).sort(function(xr,Gr){return Ke[xr]-Ke[Gr]})}function mr(pe){for(var Ke=0,xr=-1,Gr=pe.length,ln;++xr{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K,Cv(),r_(),q5()):d(u.d3=u.d3||{},u.d3,u.d3,u.d3)})(K,function(u,d,E,A){function t(h){return h.target.depth}function e(h){return h.depth}function r(h,b){return b-1-h.height}function i(h,b){return h.sourceLinks.length?h.depth:b-1}function n(h){return h.targetLinks.length?h.depth:h.sourceLinks.length?d.min(h.sourceLinks,t)-1:0}function o(h){return function(){return h}}function a(h,b){return f(h.source,b.source)||h.index-b.index}function s(h,b){return f(h.target,b.target)||h.index-b.index}function f(h,b){return h.y0-b.y0}function v(h){return h.value}function g(h){return(h.y0+h.y1)/2}function m(h){return g(h.source)*h.value}function w(h){return g(h.target)*h.value}function l(h){return h.index}function x(h){return h.nodes}function y(h){return h.links}function S(h,b){var _=h.get(b);if(!_)throw new Error("missing: "+b);return _}var k=function(){var h=0,b=0,_=1,P=1,z=24,D=8,B=l,R=i,I=x,F=y,j=32,N=2/3;function G(){var ot={nodes:I.apply(null,arguments),links:F.apply(null,arguments)};return rt(ot),ct(ot),st(ot),et(ot),Z(ot),ot}G.update=function(ot){return Z(ot),ot},G.nodeId=function(ot){return arguments.length?(B=typeof ot=="function"?ot:o(ot),G):B},G.nodeAlign=function(ot){return arguments.length?(R=typeof ot=="function"?ot:o(ot),G):R},G.nodeWidth=function(ot){return arguments.length?(z=+ot,G):z},G.nodePadding=function(ot){return arguments.length?(D=+ot,G):D},G.nodes=function(ot){return arguments.length?(I=typeof ot=="function"?ot:o(ot),G):I},G.links=function(ot){return arguments.length?(F=typeof ot=="function"?ot:o(ot),G):F},G.size=function(ot){return arguments.length?(h=b=0,_=+ot[0],P=+ot[1],G):[_-h,P-b]},G.extent=function(ot){return arguments.length?(h=+ot[0][0],_=+ot[1][0],b=+ot[0][1],P=+ot[1][1],G):[[h,b],[_,P]]},G.iterations=function(ot){return arguments.length?(j=+ot,G):j};function rt(ot){ot.nodes.forEach(function(Q,ut){Q.index=ut,Q.sourceLinks=[],Q.targetLinks=[]});var X=E.map(ot.nodes,B);ot.links.forEach(function(Q,ut){Q.index=ut;var J=Q.source,q=Q.target;typeof J!="object"&&(J=Q.source=S(X,J)),typeof q!="object"&&(q=Q.target=S(X,q)),J.sourceLinks.push(Q),q.targetLinks.push(Q)})}function ct(ot){ot.nodes.forEach(function(X){X.value=Math.max(d.sum(X.sourceLinks,v),d.sum(X.targetLinks,v))})}function st(ot){var X,Q,ut;for(X=ot.nodes,Q=[],ut=0;X.length;++ut,X=Q,Q=[])X.forEach(function(q){q.depth=ut,q.sourceLinks.forEach(function(it){Q.indexOf(it.target)<0&&Q.push(it.target)})});for(X=ot.nodes,Q=[],ut=0;X.length;++ut,X=Q,Q=[])X.forEach(function(q){q.height=ut,q.targetLinks.forEach(function(it){Q.indexOf(it.source)<0&&Q.push(it.source)})});var J=(_-h-z)/(ut-1);ot.nodes.forEach(function(q){q.x1=(q.x0=h+Math.max(0,Math.min(ut-1,Math.floor(R.call(null,q,ut))))*J)+z})}function et(ot){var X=E.nest().key(function(dt){return dt.x0}).sortKeys(d.ascending).entries(ot.nodes).map(function(dt){return dt.values});J(),nt();for(var Q=1,ut=j;ut>0;--ut)it(Q*=.99),nt(),q(Q),nt();function J(){var dt=d.max(X,function(Ct){return Ct.length}),Tt=N*(P-b)/(dt-1);D>Tt&&(D=Tt);var wt=d.min(X,function(Ct){return(P-b-(Ct.length-1)*D)/d.sum(Ct,v)});X.forEach(function(Ct){Ct.forEach(function(It,Nt){It.y1=(It.y0=Nt)+It.value*wt})}),ot.links.forEach(function(Ct){Ct.width=Ct.value*wt})}function q(dt){X.forEach(function(Tt){Tt.forEach(function(wt){if(wt.targetLinks.length){var Ct=(d.sum(wt.targetLinks,m)/d.sum(wt.targetLinks,v)-g(wt))*dt;wt.y0+=Ct,wt.y1+=Ct}})})}function it(dt){X.slice().reverse().forEach(function(Tt){Tt.forEach(function(wt){if(wt.sourceLinks.length){var Ct=(d.sum(wt.sourceLinks,w)/d.sum(wt.sourceLinks,v)-g(wt))*dt;wt.y0+=Ct,wt.y1+=Ct}})})}function nt(){X.forEach(function(dt){var Tt,wt,Ct=b,It=dt.length,Nt;for(dt.sort(f),Nt=0;Nt0&&(Tt.y0+=wt,Tt.y1+=wt),Ct=Tt.y1+D;if(wt=Ct-D-P,wt>0)for(Ct=Tt.y0-=wt,Tt.y1-=wt,Nt=It-2;Nt>=0;--Nt)Tt=dt[Nt],wt=Tt.y1+D-Ct,wt>0&&(Tt.y0-=wt,Tt.y1-=wt),Ct=Tt.y0})}}function Z(ot){ot.nodes.forEach(function(X){X.sourceLinks.sort(s),X.targetLinks.sort(a)}),ot.nodes.forEach(function(X){var Q=X.y0,ut=Q;X.sourceLinks.forEach(function(J){J.y0=Q+J.width/2,Q+=J.width}),X.targetLinks.forEach(function(J){J.y1=ut+J.width/2,ut+=J.width})})}return G};function M(h){return[h.source.x1,h.y0]}function T(h){return[h.target.x0,h.y1]}var c=function(){return A.linkHorizontal().source(M).target(T)};u.sankey=k,u.sankeyCenter=n,u.sankeyLeft=e,u.sankeyRight=r,u.sankeyJustify=i,u.sankeyLinkHorizontal=c,Object.defineProperty(u,"__esModule",{value:!0})})}),eL=Vt((K,V)=>{var u=H5();V.exports=function(d,E){var A=[],t=[],e=[],r={},i=[],n;function o(y){e[y]=!1,r.hasOwnProperty(y)&&Object.keys(r[y]).forEach(function(S){delete r[y][S],e[S]&&o(S)})}function a(y){var S=!1;t.push(y),e[y]=!0;var k,M;for(k=0;k=y})}function v(y){f(y);for(var S=d,k=u(S),M=k.components.filter(function(z){return z.length>1}),T=1/0,c,h=0;h{(function(u,d){typeof K=="object"&&typeof V<"u"?d(K,Cv(),r_(),q5(),eL()):d(u.d3=u.d3||{},u.d3,u.d3,u.d3,null)})(K,function(u,d,E,A,t){t=t&&t.hasOwnProperty("default")?t.default:t;function e(It){return It.target.depth}function r(It){return It.depth}function i(It,Nt){return Nt-1-It.height}function n(It,Nt){return It.sourceLinks.length?It.depth:Nt-1}function o(It){return It.targetLinks.length?It.depth:It.sourceLinks.length?d.min(It.sourceLinks,e)-1:0}function a(It){return function(){return It}}var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(It){return typeof It}:function(It){return It&&typeof Symbol=="function"&&It.constructor===Symbol&&It!==Symbol.prototype?"symbol":typeof It};function f(It,Nt){return g(It.source,Nt.source)||It.index-Nt.index}function v(It,Nt){return g(It.target,Nt.target)||It.index-Nt.index}function g(It,Nt){return It.partOfCycle===Nt.partOfCycle?It.y0-Nt.y0:It.circularLinkType==="top"||Nt.circularLinkType==="bottom"?-1:1}function m(It){return It.value}function w(It){return(It.y0+It.y1)/2}function l(It){return w(It.source)}function x(It){return w(It.target)}function y(It){return It.index}function S(It){return It.nodes}function k(It){return It.links}function M(It,Nt){var te=It.get(Nt);if(!te)throw new Error("missing: "+Nt);return te}function T(It,Nt){return Nt(It)}var c=25,h=10,b=.3;function _(){var It=0,Nt=0,te=1,Jt=1,ee=24,Zt,mt=y,bt=n,vt=S,Ut=k,re=32,Kt=2,ue,Me=null;function Ce(){var de={nodes:vt.apply(null,arguments),links:Ut.apply(null,arguments)};We(de),P(de,mt,Me),qe(de),er(de),z(de,mt),Mr(de,re,mt),Ir(de);for(var Dt=4,qt=0;qt"u"?"undefined":s(lt))!=="object"&&(lt=qt.source=M(Dt,lt)),(typeof yt>"u"?"undefined":s(yt))!=="object"&&(yt=qt.target=M(Dt,yt)),lt.sourceLinks.push(qt),yt.targetLinks.push(qt)}),de}function qe(de){de.nodes.forEach(function(Dt){Dt.partOfCycle=!1,Dt.value=Math.max(d.sum(Dt.sourceLinks,m),d.sum(Dt.targetLinks,m)),Dt.sourceLinks.forEach(function(qt){qt.circular&&(Dt.partOfCycle=!0,Dt.circularLinkType=qt.circularLinkType)}),Dt.targetLinks.forEach(function(qt){qt.circular&&(Dt.partOfCycle=!0,Dt.circularLinkType=qt.circularLinkType)})})}function vr(de){var Dt=0,qt=0,_t=0,lt=0,yt=d.max(de.nodes,function(St){return St.column});return de.links.forEach(function(St){St.circular&&(St.circularLinkType=="top"?Dt=Dt+St.width:qt=qt+St.width,St.target.column==0&&(lt=lt+St.width),St.source.column==yt&&(_t=_t+St.width))}),Dt=Dt>0?Dt+c+h:Dt,qt=qt>0?qt+c+h:qt,_t=_t>0?_t+c+h:_t,lt=lt>0?lt+c+h:lt,{top:Dt,bottom:qt,left:lt,right:_t}}function _r(de,Dt){var qt=d.max(de.nodes,function(se){return se.column}),_t=te-It,lt=Jt-Nt,yt=_t+Dt.right+Dt.left,St=lt+Dt.top+Dt.bottom,Ht=_t/yt,Yt=lt/St;return It=It*Ht+Dt.left,te=Dt.right==0?te:te*Ht,Nt=Nt*Yt+Dt.top,Jt=Jt*Yt,de.nodes.forEach(function(se){se.x0=It+se.column*((te-It-ee)/qt),se.x1=se.x0+ee}),Yt}function er(de){var Dt,qt,_t;for(Dt=de.nodes,qt=[],_t=0;Dt.length;++_t,Dt=qt,qt=[])Dt.forEach(function(lt){lt.depth=_t,lt.sourceLinks.forEach(function(yt){qt.indexOf(yt.target)<0&&!yt.circular&&qt.push(yt.target)})});for(Dt=de.nodes,qt=[],_t=0;Dt.length;++_t,Dt=qt,qt=[])Dt.forEach(function(lt){lt.height=_t,lt.targetLinks.forEach(function(yt){qt.indexOf(yt.source)<0&&!yt.circular&&qt.push(yt.source)})});de.nodes.forEach(function(lt){lt.column=Math.floor(bt.call(null,lt,_t))})}function Mr(de,Dt,qt){var _t=E.nest().key(function(se){return se.column}).sortKeys(d.ascending).entries(de.nodes).map(function(se){return se.values});St(qt),Yt();for(var lt=1,yt=Dt;yt>0;--yt)Ht(lt*=.99,qt),Yt();function St(se){if(ue){var ke=1/0;_t.forEach(function(ar){var Ye=Jt*ue/(ar.length+1);ke=Ye0))if(ar==0&&ir==1)Er=Ye.y1-Ye.y0,Ye.y0=Jt/2-Er/2,Ye.y1=Jt/2+Er/2;else if(ar==Ee-1&&ir==1)Er=Ye.y1-Ye.y0,Ye.y0=Jt/2-Er/2,Ye.y1=Jt/2+Er/2;else{var pn=0,dn=d.mean(Ye.sourceLinks,x),bn=d.mean(Ye.targetLinks,l);dn&&bn?pn=(dn+bn)/2:pn=dn||bn;var Zn=(pn-w(Ye))*se;Ye.y0+=Zn,Ye.y1+=Zn}})})}function Yt(){_t.forEach(function(se){var ke,Ee,Ue=Nt,ir=se.length,ar;for(se.sort(g),ar=0;ar0&&(ke.y0+=Ee,ke.y1+=Ee),Ue=ke.y1+Zt;if(Ee=Ue-Zt-Jt,Ee>0)for(Ue=ke.y0-=Ee,ke.y1-=Ee,ar=ir-2;ar>=0;--ar)ke=se[ar],Ee=ke.y1+Zt-Ue,Ee>0&&(ke.y0-=Ee,ke.y1-=Ee),Ue=ke.y0})}}function Ir(de){de.nodes.forEach(function(Dt){Dt.sourceLinks.sort(v),Dt.targetLinks.sort(f)}),de.nodes.forEach(function(Dt){var qt=Dt.y0,_t=qt,lt=Dt.y1,yt=lt;Dt.sourceLinks.forEach(function(St){St.circular?(St.y0=lt-St.width/2,lt=lt-St.width):(St.y0=qt+St.width/2,qt+=St.width)}),Dt.targetLinks.forEach(function(St){St.circular?(St.y1=yt-St.width/2,yt=yt-St.width):(St.y1=_t+St.width/2,_t+=St.width)})})}return Ce}function P(It,Nt,te){var Jt=0;if(te===null){for(var ee=[],Zt=0;ZtNt.source.column)}function R(It,Nt){var te=0;It.sourceLinks.forEach(function(ee){te=ee.circular&&!wt(ee,Nt)?te+1:te});var Jt=0;return It.targetLinks.forEach(function(ee){Jt=ee.circular&&!wt(ee,Nt)?Jt+1:Jt}),te+Jt}function I(It){var Nt=It.source.sourceLinks,te=0;Nt.forEach(function(Zt){te=Zt.circular?te+1:te});var Jt=It.target.targetLinks,ee=0;return Jt.forEach(function(Zt){ee=Zt.circular?ee+1:ee}),!(te>1||ee>1)}function F(It,Nt,te){return It.sort(G),It.forEach(function(Jt,ee){var Zt=0;if(wt(Jt,te)&&I(Jt))Jt.circularPathData.verticalBuffer=Zt+Jt.width/2;else{var mt=0;for(mt;mtZt?bt:Zt}Jt.circularPathData.verticalBuffer=Zt+Jt.width/2}}),It}function j(It,Nt,te,Jt){var ee=5,Zt=d.min(It.links,function(vt){return vt.source.y0});It.links.forEach(function(vt){vt.circular&&(vt.circularPathData={})});var mt=It.links.filter(function(vt){return vt.circularLinkType=="top"});F(mt,Nt,Jt);var bt=It.links.filter(function(vt){return vt.circularLinkType=="bottom"});F(bt,Nt,Jt),It.links.forEach(function(vt){if(vt.circular){if(vt.circularPathData.arcRadius=vt.width+h,vt.circularPathData.leftNodeBuffer=ee,vt.circularPathData.rightNodeBuffer=ee,vt.circularPathData.sourceWidth=vt.source.x1-vt.source.x0,vt.circularPathData.sourceX=vt.source.x0+vt.circularPathData.sourceWidth,vt.circularPathData.targetX=vt.target.x0,vt.circularPathData.sourceY=vt.y0,vt.circularPathData.targetY=vt.y1,wt(vt,Jt)&&I(vt))vt.circularPathData.leftSmallArcRadius=h+vt.width/2,vt.circularPathData.leftLargeArcRadius=h+vt.width/2,vt.circularPathData.rightSmallArcRadius=h+vt.width/2,vt.circularPathData.rightLargeArcRadius=h+vt.width/2,vt.circularLinkType=="bottom"?(vt.circularPathData.verticalFullExtent=vt.source.y1+c+vt.circularPathData.verticalBuffer,vt.circularPathData.verticalLeftInnerExtent=vt.circularPathData.verticalFullExtent-vt.circularPathData.leftLargeArcRadius,vt.circularPathData.verticalRightInnerExtent=vt.circularPathData.verticalFullExtent-vt.circularPathData.rightLargeArcRadius):(vt.circularPathData.verticalFullExtent=vt.source.y0-c-vt.circularPathData.verticalBuffer,vt.circularPathData.verticalLeftInnerExtent=vt.circularPathData.verticalFullExtent+vt.circularPathData.leftLargeArcRadius,vt.circularPathData.verticalRightInnerExtent=vt.circularPathData.verticalFullExtent+vt.circularPathData.rightLargeArcRadius);else{var Ut=vt.source.column,re=vt.circularLinkType,Kt=It.links.filter(function(Ce){return Ce.source.column==Ut&&Ce.circularLinkType==re});vt.circularLinkType=="bottom"?Kt.sort(ct):Kt.sort(rt);var ue=0;Kt.forEach(function(Ce,We){Ce.circularLinkID==vt.circularLinkID&&(vt.circularPathData.leftSmallArcRadius=h+vt.width/2+ue,vt.circularPathData.leftLargeArcRadius=h+vt.width/2+We*Nt+ue),ue=ue+Ce.width}),Ut=vt.target.column,Kt=It.links.filter(function(Ce){return Ce.target.column==Ut&&Ce.circularLinkType==re}),vt.circularLinkType=="bottom"?Kt.sort(et):Kt.sort(st),ue=0,Kt.forEach(function(Ce,We){Ce.circularLinkID==vt.circularLinkID&&(vt.circularPathData.rightSmallArcRadius=h+vt.width/2+ue,vt.circularPathData.rightLargeArcRadius=h+vt.width/2+We*Nt+ue),ue=ue+Ce.width}),vt.circularLinkType=="bottom"?(vt.circularPathData.verticalFullExtent=Math.max(te,vt.source.y1,vt.target.y1)+c+vt.circularPathData.verticalBuffer,vt.circularPathData.verticalLeftInnerExtent=vt.circularPathData.verticalFullExtent-vt.circularPathData.leftLargeArcRadius,vt.circularPathData.verticalRightInnerExtent=vt.circularPathData.verticalFullExtent-vt.circularPathData.rightLargeArcRadius):(vt.circularPathData.verticalFullExtent=Zt-c-vt.circularPathData.verticalBuffer,vt.circularPathData.verticalLeftInnerExtent=vt.circularPathData.verticalFullExtent+vt.circularPathData.leftLargeArcRadius,vt.circularPathData.verticalRightInnerExtent=vt.circularPathData.verticalFullExtent+vt.circularPathData.rightLargeArcRadius)}vt.circularPathData.leftInnerExtent=vt.circularPathData.sourceX+vt.circularPathData.leftNodeBuffer,vt.circularPathData.rightInnerExtent=vt.circularPathData.targetX-vt.circularPathData.rightNodeBuffer,vt.circularPathData.leftFullExtent=vt.circularPathData.sourceX+vt.circularPathData.leftLargeArcRadius+vt.circularPathData.leftNodeBuffer,vt.circularPathData.rightFullExtent=vt.circularPathData.targetX-vt.circularPathData.rightLargeArcRadius-vt.circularPathData.rightNodeBuffer}if(vt.circular)vt.path=N(vt);else{var Me=A.linkHorizontal().source(function(Ce){var We=Ce.source.x0+(Ce.source.x1-Ce.source.x0),qe=Ce.y0;return[We,qe]}).target(function(Ce){var We=Ce.target.x0,qe=Ce.y1;return[We,qe]});vt.path=Me(vt)}})}function N(It){var Nt="";return It.circularLinkType=="top"?Nt="M"+It.circularPathData.sourceX+" "+It.circularPathData.sourceY+" L"+It.circularPathData.leftInnerExtent+" "+It.circularPathData.sourceY+" A"+It.circularPathData.leftLargeArcRadius+" "+It.circularPathData.leftSmallArcRadius+" 0 0 0 "+It.circularPathData.leftFullExtent+" "+(It.circularPathData.sourceY-It.circularPathData.leftSmallArcRadius)+" L"+It.circularPathData.leftFullExtent+" "+It.circularPathData.verticalLeftInnerExtent+" A"+It.circularPathData.leftLargeArcRadius+" "+It.circularPathData.leftLargeArcRadius+" 0 0 0 "+It.circularPathData.leftInnerExtent+" "+It.circularPathData.verticalFullExtent+" L"+It.circularPathData.rightInnerExtent+" "+It.circularPathData.verticalFullExtent+" A"+It.circularPathData.rightLargeArcRadius+" "+It.circularPathData.rightLargeArcRadius+" 0 0 0 "+It.circularPathData.rightFullExtent+" "+It.circularPathData.verticalRightInnerExtent+" L"+It.circularPathData.rightFullExtent+" "+(It.circularPathData.targetY-It.circularPathData.rightSmallArcRadius)+" A"+It.circularPathData.rightLargeArcRadius+" "+It.circularPathData.rightSmallArcRadius+" 0 0 0 "+It.circularPathData.rightInnerExtent+" "+It.circularPathData.targetY+" L"+It.circularPathData.targetX+" "+It.circularPathData.targetY:Nt="M"+It.circularPathData.sourceX+" "+It.circularPathData.sourceY+" L"+It.circularPathData.leftInnerExtent+" "+It.circularPathData.sourceY+" A"+It.circularPathData.leftLargeArcRadius+" "+It.circularPathData.leftSmallArcRadius+" 0 0 1 "+It.circularPathData.leftFullExtent+" "+(It.circularPathData.sourceY+It.circularPathData.leftSmallArcRadius)+" L"+It.circularPathData.leftFullExtent+" "+It.circularPathData.verticalLeftInnerExtent+" A"+It.circularPathData.leftLargeArcRadius+" "+It.circularPathData.leftLargeArcRadius+" 0 0 1 "+It.circularPathData.leftInnerExtent+" "+It.circularPathData.verticalFullExtent+" L"+It.circularPathData.rightInnerExtent+" "+It.circularPathData.verticalFullExtent+" A"+It.circularPathData.rightLargeArcRadius+" "+It.circularPathData.rightLargeArcRadius+" 0 0 1 "+It.circularPathData.rightFullExtent+" "+It.circularPathData.verticalRightInnerExtent+" L"+It.circularPathData.rightFullExtent+" "+(It.circularPathData.targetY+It.circularPathData.rightSmallArcRadius)+" A"+It.circularPathData.rightLargeArcRadius+" "+It.circularPathData.rightSmallArcRadius+" 0 0 1 "+It.circularPathData.rightInnerExtent+" "+It.circularPathData.targetY+" L"+It.circularPathData.targetX+" "+It.circularPathData.targetY,Nt}function G(It,Nt){return Z(It)==Z(Nt)?It.circularLinkType=="bottom"?ct(It,Nt):rt(It,Nt):Z(Nt)-Z(It)}function rt(It,Nt){return It.y0-Nt.y0}function ct(It,Nt){return Nt.y0-It.y0}function st(It,Nt){return It.y1-Nt.y1}function et(It,Nt){return Nt.y1-It.y1}function Z(It){return It.target.column-It.source.column}function ot(It){return It.target.x0-It.source.x1}function X(It,Nt){var te=D(It),Jt=ot(Nt)/Math.tan(te),ee=Tt(It)=="up"?It.y1+Jt:It.y1-Jt;return ee}function Q(It,Nt){var te=D(It),Jt=ot(Nt)/Math.tan(te),ee=Tt(It)=="up"?It.y1-Jt:It.y1+Jt;return ee}function ut(It,Nt,te,Jt){It.links.forEach(function(ee){if(!ee.circular&&ee.target.column-ee.source.column>1){var Zt=ee.source.column+1,mt=ee.target.column-1,bt=1,vt=mt-Zt+1;for(bt=1;Zt<=mt;Zt++,bt++)It.nodes.forEach(function(Ut){if(Ut.column==Zt){var re=bt/(vt+1),Kt=Math.pow(1-re,3),ue=3*re*Math.pow(1-re,2),Me=3*Math.pow(re,2)*(1-re),Ce=Math.pow(re,3),We=Kt*ee.y0+ue*ee.y0+Me*ee.y1+Ce*ee.y1,qe=We-ee.width/2,vr=We+ee.width/2,_r;qe>Ut.y0&&qeUt.y0&&vrUt.y1&&q(er,_r,Nt,te)})):qeUt.y1&&(_r=vr-Ut.y0+10,Ut=q(Ut,_r,Nt,te),It.nodes.forEach(function(er){T(er,Jt)==T(Ut,Jt)||er.column!=Ut.column||er.y0Ut.y1&&q(er,_r,Nt,te)}))}})}})}function J(It,Nt){return It.y0>Nt.y0&&It.y0Nt.y0&&It.y1Nt.y1}function q(It,Nt,te,Jt){return It.y0+Nt>=te&&It.y1+Nt<=Jt&&(It.y0=It.y0+Nt,It.y1=It.y1+Nt,It.targetLinks.forEach(function(ee){ee.y1=ee.y1+Nt}),It.sourceLinks.forEach(function(ee){ee.y0=ee.y0+Nt})),It}function it(It,Nt,te,Jt){It.nodes.forEach(function(ee){Jt&&ee.y+(ee.y1-ee.y0)>Nt&&(ee.y=ee.y-(ee.y+(ee.y1-ee.y0)-Nt));var Zt=It.links.filter(function(vt){return T(vt.source,te)==T(ee,te)}),mt=Zt.length;mt>1&&Zt.sort(function(vt,Ut){if(!vt.circular&&!Ut.circular){if(vt.target.column==Ut.target.column)return vt.y1-Ut.y1;if(dt(vt,Ut)){if(vt.target.column>Ut.target.column){var re=Q(Ut,vt);return vt.y1-re}if(Ut.target.column>vt.target.column){var Kt=Q(vt,Ut);return Kt-Ut.y1}}else return vt.y1-Ut.y1}if(vt.circular&&!Ut.circular)return vt.circularLinkType=="top"?-1:1;if(Ut.circular&&!vt.circular)return Ut.circularLinkType=="top"?1:-1;if(vt.circular&&Ut.circular)return vt.circularLinkType===Ut.circularLinkType&&vt.circularLinkType=="top"?vt.target.column===Ut.target.column?vt.target.y1-Ut.target.y1:Ut.target.column-vt.target.column:vt.circularLinkType===Ut.circularLinkType&&vt.circularLinkType=="bottom"?vt.target.column===Ut.target.column?Ut.target.y1-vt.target.y1:vt.target.column-Ut.target.column:vt.circularLinkType=="top"?-1:1});var bt=ee.y0;Zt.forEach(function(vt){vt.y0=bt+vt.width/2,bt=bt+vt.width}),Zt.forEach(function(vt,Ut){if(vt.circularLinkType=="bottom"){var re=Ut+1,Kt=0;for(re;re1&&ee.sort(function(bt,vt){if(!bt.circular&&!vt.circular){if(bt.source.column==vt.source.column)return bt.y0-vt.y0;if(dt(bt,vt)){if(vt.source.column0?"up":"down"}function wt(It,Nt){return T(It.source,Nt)==T(It.target,Nt)}function Ct(It,Nt,te){var Jt=It.nodes,ee=It.links,Zt=!1,mt=!1;if(ee.forEach(function(ue){ue.circularLinkType=="top"?Zt=!0:ue.circularLinkType=="bottom"&&(mt=!0)}),Zt==!1||mt==!1){var bt=d.min(Jt,function(ue){return ue.y0}),vt=d.max(Jt,function(ue){return ue.y1}),Ut=vt-bt,re=te-Nt,Kt=re/Ut;Jt.forEach(function(ue){var Me=(ue.y1-ue.y0)*Kt;ue.y0=(ue.y0-bt)*Kt,ue.y1=ue.y0+Me}),ee.forEach(function(ue){ue.y0=(ue.y0-bt)*Kt,ue.y1=(ue.y1-bt)*Kt,ue.width=ue.width*Kt})}}u.sankeyCircular=_,u.sankeyCenter=o,u.sankeyLeft=r,u.sankeyRight=i,u.sankeyJustify=n,Object.defineProperty(u,"__esModule",{value:!0})})}),W5=Vt((K,V)=>{V.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"linear",cn:{sankey:"sankey",sankeyLinks:"sankey-links",sankeyLink:"sankey-link",sankeyNodeSet:"sankey-node-set",sankeyNode:"sankey-node",nodeRect:"node-rect",nodeLabel:"node-label"}}}),nL=Vt((K,V)=>{var u=Jz(),d=(E0(),xd(Rd)).interpolateNumber,E=Ni(),A=tL(),t=rL(),e=W5(),r=Af(),i=Pi(),n=Eo(),o=Xr(),a=o.strTranslate,s=o.strRotate,f=wp(),v=f.keyFun,g=f.repeat,m=f.unwrap,w=Dl(),l=ji(),x=gf(),y=x.CAP_SHIFT,S=x.LINE_SPACING,k=3;function M(X,Q,ut){var J=m(Q),q=J.trace,it=q.domain,nt=q.orientation==="h",dt=q.node.pad,Tt=q.node.thickness,wt={justify:A.sankeyJustify,left:A.sankeyLeft,right:A.sankeyRight,center:A.sankeyCenter}[q.node.align],Ct=X.width*(it.x[1]-it.x[0]),It=X.height*(it.y[1]-it.y[0]),Nt=J._nodes,te=J._links,Jt=J.circular,ee;Jt?ee=t.sankeyCircular().circularLinkGap(0):ee=A.sankey(),ee.iterations(e.sankeyIterations).size(nt?[Ct,It]:[It,Ct]).nodeWidth(Tt).nodePadding(dt).nodeId(function(er){return er.pointNumber}).nodeAlign(wt).nodes(Nt).links(te);var Zt=ee();ee.nodePadding()=Dt||(de=Dt-Ir.y0,de>1e-6&&(Ir.y0+=de,Ir.y1+=de)),Dt=Ir.y1+dt})}function We(er){var Mr=er.map(function(yt,St){return{x0:yt.x0,index:St}}).sort(function(yt,St){return yt.x0-St.x0}),Ir=[],de=-1,Dt,qt=-1/0,_t;for(mt=0;mtqt+Tt&&(de+=1,Dt=lt.x0),qt=lt.x0,Ir[de]||(Ir[de]=[]),Ir[de].push(lt),_t=Dt-lt.x0,lt.x0+=_t,lt.x1+=_t}return Ir}if(q.node.x.length&&q.node.y.length){for(mt=0;mt0?" L "+q.targetX+" "+q.targetY:"")+"Z"):(ut="M "+(q.targetX-Q)+" "+(q.targetY-J)+" L "+(q.rightInnerExtent-Q)+" "+(q.targetY-J)+" A "+(q.rightLargeArcRadius+J)+" "+(q.rightSmallArcRadius+J)+" 0 0 0 "+(q.rightFullExtent-J-Q)+" "+(q.targetY+q.rightSmallArcRadius)+" L "+(q.rightFullExtent-J-Q)+" "+q.verticalRightInnerExtent,it&&nt?ut+=" A "+(q.rightLargeArcRadius+J)+" "+(q.rightLargeArcRadius+J)+" 0 0 0 "+(q.rightInnerExtent-J-Q)+" "+(q.verticalFullExtent+J)+" L "+(q.rightFullExtent+J-Q-(q.rightLargeArcRadius-J))+" "+(q.verticalFullExtent+J)+" A "+(q.rightLargeArcRadius+J)+" "+(q.rightLargeArcRadius+J)+" 0 0 0 "+(q.leftFullExtent+J)+" "+q.verticalLeftInnerExtent:it?ut+=" A "+(q.rightLargeArcRadius-J)+" "+(q.rightSmallArcRadius-J)+" 0 0 1 "+(q.rightFullExtent-Q-J-(q.rightLargeArcRadius-J))+" "+(q.verticalFullExtent-J)+" L "+(q.leftFullExtent+J+(q.rightLargeArcRadius-J))+" "+(q.verticalFullExtent-J)+" A "+(q.rightLargeArcRadius-J)+" "+(q.rightSmallArcRadius-J)+" 0 0 1 "+(q.leftFullExtent+J)+" "+q.verticalLeftInnerExtent:ut+=" A "+(q.rightLargeArcRadius+J)+" "+(q.rightLargeArcRadius+J)+" 0 0 0 "+(q.rightInnerExtent-Q)+" "+(q.verticalFullExtent+J)+" L "+q.leftInnerExtent+" "+(q.verticalFullExtent+J)+" A "+(q.leftLargeArcRadius+J)+" "+(q.leftLargeArcRadius+J)+" 0 0 0 "+(q.leftFullExtent+J)+" "+q.verticalLeftInnerExtent,ut+=" L "+(q.leftFullExtent+J)+" "+(q.sourceY+q.leftSmallArcRadius)+" A "+(q.leftLargeArcRadius+J)+" "+(q.leftSmallArcRadius+J)+" 0 0 0 "+q.leftInnerExtent+" "+(q.sourceY-J)+" L "+q.sourceX+" "+(q.sourceY-J)+" L "+q.sourceX+" "+(q.sourceY+J)+" L "+q.leftInnerExtent+" "+(q.sourceY+J)+" A "+(q.leftLargeArcRadius-J)+" "+(q.leftSmallArcRadius-J)+" 0 0 1 "+(q.leftFullExtent-J)+" "+(q.sourceY+q.leftSmallArcRadius)+" L "+(q.leftFullExtent-J)+" "+q.verticalLeftInnerExtent,it&&nt?ut+=" A "+(q.rightLargeArcRadius-J)+" "+(q.rightSmallArcRadius-J)+" 0 0 1 "+(q.leftFullExtent-J-(q.rightLargeArcRadius-J))+" "+(q.verticalFullExtent-J)+" L "+(q.rightFullExtent+J-Q+(q.rightLargeArcRadius-J))+" "+(q.verticalFullExtent-J)+" A "+(q.rightLargeArcRadius-J)+" "+(q.rightSmallArcRadius-J)+" 0 0 1 "+(q.rightFullExtent+J-Q)+" "+q.verticalRightInnerExtent:it?ut+=" A "+(q.rightLargeArcRadius+J)+" "+(q.rightLargeArcRadius+J)+" 0 0 0 "+(q.leftFullExtent+J)+" "+(q.verticalFullExtent+J)+" L "+(q.rightFullExtent-Q-J)+" "+(q.verticalFullExtent+J)+" A "+(q.rightLargeArcRadius+J)+" "+(q.rightLargeArcRadius+J)+" 0 0 0 "+(q.rightFullExtent+J-Q)+" "+q.verticalRightInnerExtent:ut+=" A "+(q.leftLargeArcRadius-J)+" "+(q.leftLargeArcRadius-J)+" 0 0 1 "+q.leftInnerExtent+" "+(q.verticalFullExtent-J)+" L "+(q.rightInnerExtent-Q)+" "+(q.verticalFullExtent-J)+" A "+(q.rightLargeArcRadius-J)+" "+(q.rightLargeArcRadius-J)+" 0 0 1 "+(q.rightFullExtent+J-Q)+" "+q.verticalRightInnerExtent,ut+=" L "+(q.rightFullExtent+J-Q)+" "+(q.targetY+q.rightSmallArcRadius)+" A "+(q.rightLargeArcRadius-J)+" "+(q.rightSmallArcRadius-J)+" 0 0 1 "+(q.rightInnerExtent-Q)+" "+(q.targetY+J)+" L "+(q.targetX-Q)+" "+(q.targetY+J)+(Q>0?" L "+q.targetX+" "+q.targetY:"")+"Z"),ut}function h(){var X=.5;function Q(ut){var J=ut.linkArrowLength;if(ut.link.circular)return c(ut.link,J);var q=Math.abs((ut.link.target.x0-ut.link.source.x1)/2);J>q&&(J=q);var it=ut.link.source.x1,nt=ut.link.target.x0-J,dt=d(it,nt),Tt=dt(X),wt=dt(1-X),Ct=ut.link.y0-ut.link.width/2,It=ut.link.y0+ut.link.width/2,Nt=ut.link.y1-ut.link.width/2,te=ut.link.y1+ut.link.width/2,Jt="M"+it+","+Ct,ee="C"+Tt+","+Ct+" "+wt+","+Nt+" "+nt+","+Nt,Zt="C"+wt+","+te+" "+Tt+","+It+" "+it+","+It,mt=J>0?"L"+(nt+J)+","+(Nt+ut.link.width/2):"";return mt+="L"+nt+","+te,Jt+ee+mt+Zt+"Z"}return Q}function b(X,Q){var ut=r(Q.color),J=e.nodePadAcross,q=X.nodePad/2;Q.dx=Q.x1-Q.x0,Q.dy=Q.y1-Q.y0;var it=Q.dx,nt=Math.max(.5,Q.dy),dt="node_"+Q.pointNumber;return Q.group&&(dt=o.randstr()),Q.trace=X.trace,Q.curveNumber=X.trace.index,{index:Q.pointNumber,key:dt,partOfGroup:Q.partOfGroup||!1,group:Q.group,traceId:X.key,trace:X.trace,node:Q,nodePad:X.nodePad,nodeLineColor:X.nodeLineColor,nodeLineWidth:X.nodeLineWidth,textFont:X.textFont,size:X.horizontal?X.height:X.width,visibleWidth:Math.ceil(it),visibleHeight:nt,zoneX:-J,zoneY:-q,zoneWidth:it+2*J,zoneHeight:nt+2*q,labelY:X.horizontal?Q.dy/2+1:Q.dx/2+1,left:Q.originalLayer===1,sizeAcross:X.width,forceLayouts:X.forceLayouts,horizontal:X.horizontal,darkBackground:ut.getBrightness()<=128,tinyColorHue:i.tinyRGB(ut),tinyColorAlpha:ut.getAlpha(),valueFormat:X.valueFormat,valueSuffix:X.valueSuffix,sankey:X.sankey,graph:X.graph,arrangement:X.arrangement,uniqueNodeLabelPathId:[X.guid,X.key,dt].join("_"),interactionState:X.interactionState,figure:X}}function _(X){X.attr("transform",function(Q){return a(Q.node.x0.toFixed(3),Q.node.y0.toFixed(3))})}function P(X){X.call(_)}function z(X,Q){X.call(P),Q.attr("d",h())}function D(X){X.attr("width",function(Q){return Q.node.x1-Q.node.x0}).attr("height",function(Q){return Q.visibleHeight})}function B(X){return X.link.width>1||X.linkLineWidth>0}function R(X){var Q=a(X.translateX,X.translateY);return Q+(X.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)")}function I(X,Q,ut){X.on(".basic",null).on("mouseover.basic",function(J){!J.interactionState.dragInProgress&&!J.partOfGroup&&(ut.hover(this,J,Q),J.interactionState.hovered=[this,J])}).on("mousemove.basic",function(J){!J.interactionState.dragInProgress&&!J.partOfGroup&&(ut.follow(this,J),J.interactionState.hovered=[this,J])}).on("mouseout.basic",function(J){!J.interactionState.dragInProgress&&!J.partOfGroup&&(ut.unhover(this,J,Q),J.interactionState.hovered=!1)}).on("click.basic",function(J){J.interactionState.hovered&&(ut.unhover(this,J,Q),J.interactionState.hovered=!1),!J.interactionState.dragInProgress&&!J.partOfGroup&&ut.select(this,J,Q)})}function F(X,Q,ut,J){var q=E.behavior.drag().origin(function(it){return{x:it.node.x0+it.visibleWidth/2,y:it.node.y0+it.visibleHeight/2}}).on("dragstart",function(it){if(it.arrangement!=="fixed"&&(o.ensureSingle(J._fullLayout._infolayer,"g","dragcover",function(dt){J._fullLayout._dragCover=dt}),o.raiseToTop(this),it.interactionState.dragInProgress=it.node,st(it.node),it.interactionState.hovered&&(ut.nodeEvents.unhover.apply(0,it.interactionState.hovered),it.interactionState.hovered=!1),it.arrangement==="snap")){var nt=it.traceId+"|"+it.key;it.forceLayouts[nt]?it.forceLayouts[nt].alpha(1):j(X,nt,it),N(X,Q,it,nt,J)}}).on("drag",function(it){if(it.arrangement!=="fixed"){var nt=E.event.x,dt=E.event.y;it.arrangement==="snap"?(it.node.x0=nt-it.visibleWidth/2,it.node.x1=nt+it.visibleWidth/2,it.node.y0=dt-it.visibleHeight/2,it.node.y1=dt+it.visibleHeight/2):(it.arrangement==="freeform"&&(it.node.x0=nt-it.visibleWidth/2,it.node.x1=nt+it.visibleWidth/2),dt=Math.max(0,Math.min(it.size-it.visibleHeight/2,dt)),it.node.y0=dt-it.visibleHeight/2,it.node.y1=dt+it.visibleHeight/2),st(it.node),it.arrangement!=="snap"&&(it.sankey.update(it.graph),z(X.filter(et(it)),Q))}}).on("dragend",function(it){if(it.arrangement!=="fixed"){it.interactionState.dragInProgress=!1;for(var nt=0;nt0)window.requestAnimationFrame(it);else{var Tt=ut.node.originalX;ut.node.x0=Tt-ut.visibleWidth/2,ut.node.x1=Tt+ut.visibleWidth/2,rt(ut,q)}})}function G(X,Q,ut,J){return function(){for(var q=0,it=0;it0&&J.forceLayouts[Q].alpha(0)}}function rt(X,Q){for(var ut=[],J=[],q=0;q{var u=Ni(),d=Xr(),E=d.numberFormat,A=nL(),t=pc(),e=Pi(),r=W5().cn,i=d._;function n(y){return y!==""}function o(y,S){return y.filter(function(k){return k.key===S.traceId})}function a(y,S){u.select(y).select("path").style("fill-opacity",S),u.select(y).select("rect").style("fill-opacity",S)}function s(y){u.select(y).select("text.name").style("fill","black")}function f(y){return function(S){return y.node.sourceLinks.indexOf(S.link)!==-1||y.node.targetLinks.indexOf(S.link)!==-1}}function v(y){return function(S){return S.node.sourceLinks.indexOf(y.link)!==-1||S.node.targetLinks.indexOf(y.link)!==-1}}function g(y,S,k){S&&k&&o(k,S).selectAll("."+r.sankeyLink).filter(f(S)).call(w.bind(0,S,k,!1))}function m(y,S,k){S&&k&&o(k,S).selectAll("."+r.sankeyLink).filter(f(S)).call(l.bind(0,S,k,!1))}function w(y,S,k,M){M.style("fill",function(T){if(!T.link.concentrationscale)return T.tinyColorHoverHue}).style("fill-opacity",function(T){if(!T.link.concentrationscale)return T.tinyColorHoverAlpha}),M.each(function(T){var c=T.link.label;c!==""&&o(S,y).selectAll("."+r.sankeyLink).filter(function(h){return h.link.label===c}).style("fill",function(h){if(!h.link.concentrationscale)return h.tinyColorHoverHue}).style("fill-opacity",function(h){if(!h.link.concentrationscale)return h.tinyColorHoverAlpha})}),k&&o(S,y).selectAll("."+r.sankeyNode).filter(v(y)).call(g)}function l(y,S,k,M){M.style("fill",function(T){return T.tinyColorHue}).style("fill-opacity",function(T){return T.tinyColorAlpha}),M.each(function(T){var c=T.link.label;c!==""&&o(S,y).selectAll("."+r.sankeyLink).filter(function(h){return h.link.label===c}).style("fill",function(h){return h.tinyColorHue}).style("fill-opacity",function(h){return h.tinyColorAlpha})}),k&&o(S,y).selectAll(r.sankeyNode).filter(v(y)).call(m)}function x(y,S){var k=y.hoverlabel||{},M=d.nestedProperty(k,S).get();return Array.isArray(M)?!1:M}V.exports=function(y,S){for(var k=y._fullLayout,M=k._paper,T=k._size,c=0;c"),color:x(et,"bgcolor")||e.addOpacity(ut.color,1),borderColor:x(et,"bordercolor"),fontFamily:x(et,"font.family"),fontSize:x(et,"font.size"),fontColor:x(et,"font.color"),fontWeight:x(et,"font.weight"),fontStyle:x(et,"font.style"),fontVariant:x(et,"font.variant"),fontTextcase:x(et,"font.textcase"),fontLineposition:x(et,"font.lineposition"),fontShadow:x(et,"font.shadow"),nameLength:x(et,"namelength"),textAlign:x(et,"align"),idealAlign:u.event.x"),color:x(et,"bgcolor")||st.tinyColorHue,borderColor:x(et,"bordercolor"),fontFamily:x(et,"font.family"),fontSize:x(et,"font.size"),fontColor:x(et,"font.color"),fontWeight:x(et,"font.weight"),fontStyle:x(et,"font.style"),fontVariant:x(et,"font.variant"),fontTextcase:x(et,"font.textcase"),fontLineposition:x(et,"font.lineposition"),fontShadow:x(et,"font.shadow"),nameLength:x(et,"namelength"),textAlign:x(et,"align"),idealAlign:"left",hovertemplate:et.hovertemplate,hovertemplateLabels:q,eventData:[st.node]},{container:k._hoverlayer.node(),outerContainer:k._paper.node(),gd:y});a(dt,.85),s(dt)}}},rt=function(ct,st,et){y._fullLayout.hovermode!==!1&&(u.select(ct).call(m,st,et),st.node.trace.node.hoverinfo!=="skip"&&(st.node.fullData=st.node.trace,y.emit("plotly_unhover",{event:u.event,points:[st.node]})),t.loneUnhover(k._hoverlayer.node()))};A(y,M,S,{width:T.w,height:T.h,margin:{t:T.t,r:T.r,b:T.b,l:T.l}},{linkEvents:{hover:_,follow:I,unhover:F,select:b},nodeEvents:{hover:N,follow:G,unhover:rt,select:j}})}}),aL=Vt(K=>{var V=Cu().overrideAll,u=Pf().getModuleCalcData,d=G5(),E=_d(),A=Xh(),t=oh(),e=Ec().prepSelect,r=Xr(),i=ji(),n="sankey";K.name=n,K.baseLayoutAttrOverrides=V({hoverlabel:E.hoverlabel},"plot","nested"),K.plot=function(a){var s=u(a.calcdata,n)[0];d(a,s),K.updateFx(a)},K.clean=function(a,s,f,v){var g=v._has&&v._has(n),m=s._has&&s._has(n);g&&!m&&(v._paperdiv.selectAll(".sankey").remove(),v._paperdiv.selectAll(".bgsankey").remove())},K.updateFx=function(a){for(var s=0;s{V.exports=function(u,d){for(var E=u.cd,A=[],t=E[0].trace,e=t._sankey.graph.nodes,r=0;r{V.exports={attributes:V5(),supplyDefaults:Zz(),calc:Kz(),plot:G5(),moduleType:"trace",name:"sankey",basePlotModule:aL(),selectPoints:iL(),categories:["noOpacity"],meta:{}}}),sL=Vt((K,V)=>{V.exports=oL()}),lL=Vt(K=>{var V=Vu();K.name="indicator",K.plot=function(u,d,E,A){V.plotBasePlot(K.name,u,d,E,A)},K.clean=function(u,d,E,A){V.cleanBasePlot(K.name,u,d,E,A)}}),Z5=Vt((K,V)=>{var u=So().extendFlat,d=So().extendDeep,E=Cu().overrideAll,A=yu(),t=af(),e=Hu().attributes,r=Of(),i=cl().templatedArray,n=Dm(),o=hc().descriptionOnlyNumbers,a=A({editType:"plot",colorEditType:"plot"}),s={color:{valType:"color",editType:"plot"},line:{color:{valType:"color",dflt:t.defaultLine,editType:"plot"},width:{valType:"number",min:0,dflt:0,editType:"plot"},editType:"calc"},thickness:{valType:"number",min:0,max:1,dflt:1,editType:"plot"},editType:"calc"},f={valType:"info_array",items:[{valType:"number",editType:"plot"},{valType:"number",editType:"plot"}],editType:"plot"},v=i("step",d({},s,{range:f}));V.exports={mode:{valType:"flaglist",editType:"calc",flags:["number","delta","gauge"],dflt:"number"},value:{valType:"number",editType:"calc",anim:!0},align:{valType:"enumerated",values:["left","center","right"],editType:"plot"},domain:e({name:"indicator",trace:!0,editType:"calc"}),title:{text:{valType:"string",editType:"plot"},align:{valType:"enumerated",values:["left","center","right"],editType:"plot"},font:u({},a,{}),editType:"plot"},number:{valueformat:{valType:"string",dflt:"",editType:"plot",description:o("value")},font:u({},a,{}),prefix:{valType:"string",dflt:"",editType:"plot"},suffix:{valType:"string",dflt:"",editType:"plot"},editType:"plot"},delta:{reference:{valType:"number",editType:"calc"},position:{valType:"enumerated",values:["top","bottom","left","right"],dflt:"bottom",editType:"plot"},relative:{valType:"boolean",editType:"plot",dflt:!1},valueformat:{valType:"string",editType:"plot",description:o("value")},increasing:{symbol:{valType:"string",dflt:n.INCREASING.SYMBOL,editType:"plot"},color:{valType:"color",dflt:n.INCREASING.COLOR,editType:"plot"},editType:"plot"},decreasing:{symbol:{valType:"string",dflt:n.DECREASING.SYMBOL,editType:"plot"},color:{valType:"color",dflt:n.DECREASING.COLOR,editType:"plot"},editType:"plot"},font:u({},a,{}),prefix:{valType:"string",dflt:"",editType:"plot"},suffix:{valType:"string",dflt:"",editType:"plot"},editType:"calc"},gauge:{shape:{valType:"enumerated",editType:"plot",dflt:"angular",values:["angular","bullet"]},bar:d({},s,{color:{dflt:"green"}}),bgcolor:{valType:"color",editType:"plot"},bordercolor:{valType:"color",dflt:t.defaultLine,editType:"plot"},borderwidth:{valType:"number",min:0,dflt:1,editType:"plot"},axis:E({range:f,visible:u({},r.visible,{dflt:!0}),tickmode:r.minor.tickmode,nticks:r.nticks,tick0:r.tick0,dtick:r.dtick,tickvals:r.tickvals,ticktext:r.ticktext,ticks:u({},r.ticks,{dflt:"outside"}),ticklen:r.ticklen,tickwidth:r.tickwidth,tickcolor:r.tickcolor,ticklabelstep:r.ticklabelstep,showticklabels:r.showticklabels,labelalias:r.labelalias,tickfont:A({}),tickangle:r.tickangle,tickformat:r.tickformat,tickformatstops:r.tickformatstops,tickprefix:r.tickprefix,showtickprefix:r.showtickprefix,ticksuffix:r.ticksuffix,showticksuffix:r.showticksuffix,separatethousands:r.separatethousands,exponentformat:r.exponentformat,minexponent:r.minexponent,showexponent:r.showexponent,editType:"plot"},"plot"),steps:v,threshold:{line:{color:u({},s.line.color,{}),width:u({},s.line.width,{dflt:1}),editType:"plot"},thickness:u({},s.thickness,{dflt:.85}),value:{valType:"number",editType:"calc",dflt:!1},editType:"plot"},editType:"plot"}}}),K5=Vt((K,V)=>{V.exports={defaultNumberFontSize:80,bulletNumberDomainSize:.25,bulletPadding:.025,innerRadius:.75,valueThickness:.5,titlePadding:5,horizontalPadding:10}}),uL=Vt((K,V)=>{var u=Xr(),d=Z5(),E=Hu().defaults,A=cl(),t=Gf(),e=K5(),r=u0(),i=wm(),n=Ad(),o=Md();function a(f,v,g,m){function w(F,j){return u.coerce(f,v,d,F,j)}E(v,m,w),w("mode"),v._hasNumber=v.mode.indexOf("number")!==-1,v._hasDelta=v.mode.indexOf("delta")!==-1,v._hasGauge=v.mode.indexOf("gauge")!==-1;var l=w("value");v._range=[0,typeof l=="number"?1.5*l:1];var x=new Array(2),y;if(v._hasNumber){w("number.valueformat");var S=u.extendFlat({},m.font);S.size=void 0,u.coerceFont(w,"number.font",S),v.number.font.size===void 0&&(v.number.font.size=e.defaultNumberFontSize,x[0]=!0),w("number.prefix"),w("number.suffix"),y=v.number.font.size}var k;if(v._hasDelta){var M=u.extendFlat({},m.font);M.size=void 0,u.coerceFont(w,"delta.font",M),v.delta.font.size===void 0&&(v.delta.font.size=(v._hasNumber?.5:1)*(y||e.defaultNumberFontSize),x[1]=!0),w("delta.reference",v.value),w("delta.relative"),w("delta.valueformat",v.delta.relative?"2%":""),w("delta.increasing.symbol"),w("delta.increasing.color"),w("delta.decreasing.symbol"),w("delta.decreasing.color"),w("delta.position"),w("delta.prefix"),w("delta.suffix"),k=v.delta.font.size}v._scaleNumbers=(!v._hasNumber||x[0])&&(!v._hasDelta||x[1])||!1;var T=u.extendFlat({},m.font);T.size=.25*(y||k||e.defaultNumberFontSize),u.coerceFont(w,"title.font",T),w("title.text");var c,h,b,_;function P(F,j){return u.coerce(c,h,d.gauge,F,j)}function z(F,j){return u.coerce(b,_,d.gauge.axis,F,j)}if(v._hasGauge){c=f.gauge,c||(c={}),h=A.newContainer(v,"gauge"),P("shape");var D=v._isBullet=v.gauge.shape==="bullet";D||w("title.align","center");var B=v._isAngular=v.gauge.shape==="angular";B||w("align","center"),P("bgcolor",m.paper_bgcolor),P("borderwidth"),P("bordercolor"),P("bar.color"),P("bar.line.color"),P("bar.line.width");var R=e.valueThickness*(v.gauge.shape==="bullet"?.5:1);P("bar.thickness",R),t(c,h,{name:"steps",handleItemDefaults:s}),P("threshold.value"),P("threshold.thickness"),P("threshold.line.width"),P("threshold.line.color"),b={},c&&(b=c.axis||{}),_=A.newContainer(h,"axis"),z("visible"),v._range=z("range",v._range);var I={font:m.font,noAutotickangles:!0,outerTicks:!0,noTicklabelshift:!0,noTicklabelstandoff:!0};r(b,_,z,"linear"),o(b,_,z,"linear",I),n(b,_,z,"linear",I),i(b,_,z,I)}else w("title.align","center"),w("align","center"),v._isAngular=v._isBullet=!1;v._length=null}function s(f,v){function g(m,w){return u.coerce(f,v,d.gauge.steps,m,w)}g("color"),g("line.color"),g("line.width"),g("range"),g("thickness")}V.exports={supplyDefaults:a}}),cL=Vt((K,V)=>{function u(d,E){var A=[],t=E.value;typeof E._lastValue!="number"&&(E._lastValue=E.value);var e=E._lastValue,r=e;return E._hasDelta&&typeof E.delta.reference=="number"&&(r=E.delta.reference),A[0]={y:t,lastY:e,delta:t-r,relativeDelta:(t-r)/r},A}V.exports={calc:u}}),fL=Vt((K,V)=>{var u=Ni(),d=(E0(),xd(Rd)).interpolate,E=(E0(),xd(Rd)).interpolateNumber,A=Xr(),t=A.strScale,e=A.strTranslate,r=A.rad2deg,i=gf().MID_SHIFT,n=Eo(),o=K5(),a=Dl(),s=yo(),f=Kg(),v=i1(),g=Of(),m=Pi(),w={left:"start",center:"middle",right:"end"},l={left:0,center:.5,right:1},x=/[yzafpnµmkMGTPEZY]/;function y(D){return D&&D.duration>0}V.exports=function(D,B,R,I){var F=D._fullLayout,j;y(R)&&I&&(j=I()),A.makeTraceGroups(F._indicatorlayer,B,"trace").each(function(N){var G=N[0],rt=G.trace,ct=u.select(this),st=rt._hasGauge,et=rt._isAngular,Z=rt._isBullet,ot=rt.domain,X={w:F._size.w*(ot.x[1]-ot.x[0]),h:F._size.h*(ot.y[1]-ot.y[0]),l:F._size.l+F._size.w*ot.x[0],r:F._size.r+F._size.w*(1-ot.x[1]),t:F._size.t+F._size.h*(1-ot.y[1]),b:F._size.b+F._size.h*ot.y[0]},Q=X.l+X.w/2,ut=X.t+X.h/2,J=Math.min(X.w/2,X.h),q=o.innerRadius*J,it,nt,dt,Tt=rt.align||"center";if(nt=ut,!st)it=X.l+l[Tt]*X.w,dt=function(bt){return b(bt,X.w,X.h)};else if(et&&(it=Q,nt=ut+J/2,dt=function(bt){return _(bt,.9*q)}),Z){var wt=o.bulletPadding,Ct=1-o.bulletNumberDomainSize+wt;it=X.l+(Ct+(1-Ct)*l[Tt])*X.w,dt=function(bt){return b(bt,(o.bulletNumberDomainSize-wt)*X.w,X.h)}}M(D,ct,N,{numbersX:it,numbersY:nt,numbersScaler:dt,transitionOpts:R,onComplete:j});var It,Nt;st&&(It={range:rt.gauge.axis.range,color:rt.gauge.bgcolor,line:{color:rt.gauge.bordercolor,width:0},thickness:1},Nt={range:rt.gauge.axis.range,color:"rgba(0, 0, 0, 0)",line:{color:rt.gauge.bordercolor,width:rt.gauge.borderwidth},thickness:1});var te=ct.selectAll("g.angular").data(et?N:[]);te.exit().remove();var Jt=ct.selectAll("g.angularaxis").data(et?N:[]);Jt.exit().remove(),et&&k(D,ct,N,{radius:J,innerRadius:q,gauge:te,layer:Jt,size:X,gaugeBg:It,gaugeOutline:Nt,transitionOpts:R,onComplete:j});var ee=ct.selectAll("g.bullet").data(Z?N:[]);ee.exit().remove();var Zt=ct.selectAll("g.bulletaxis").data(Z?N:[]);Zt.exit().remove(),Z&&S(D,ct,N,{gauge:ee,layer:Zt,size:X,gaugeBg:It,gaugeOutline:Nt,transitionOpts:R,onComplete:j});var mt=ct.selectAll("text.title").data(N);mt.exit().remove(),mt.enter().append("text").classed("title",!0),mt.attr("text-anchor",function(){return Z?w.right:w[rt.title.align]}).text(rt.title.text).call(n.font,rt.title.font).call(a.convertToTspans,D),mt.attr("transform",function(){var bt=X.l+X.w*l[rt.title.align],vt,Ut=o.titlePadding,re=n.bBox(mt.node());if(st){if(et)if(rt.gauge.axis.visible){var Kt=n.bBox(Jt.node());vt=Kt.top-Ut-re.bottom}else vt=X.t+X.h/2-J/2-re.bottom-Ut;Z&&(vt=nt-(re.top+re.bottom)/2,bt=X.l-o.bulletPadding*X.w)}else vt=rt._numbersTop-Ut-re.bottom;return e(bt,vt)})})};function S(D,B,R,I){var F=R[0].trace,j=I.gauge,N=I.layer,G=I.gaugeBg,rt=I.gaugeOutline,ct=I.size,st=F.domain,et=I.transitionOpts,Z=I.onComplete,ot,X,Q,ut,J;j.enter().append("g").classed("bullet",!0),j.attr("transform",e(ct.l,ct.t)),N.enter().append("g").classed("bulletaxis",!0).classed("crisp",!0),N.selectAll("g.xbulletaxistick,path,text").remove();var q=ct.h,it=F.gauge.bar.thickness*q,nt=st.x[0],dt=st.x[0]+(st.x[1]-st.x[0])*(F._hasNumber||F._hasDelta?1-o.bulletNumberDomainSize:1);ot=h(D,F.gauge.axis),ot._id="xbulletaxis",ot.domain=[nt,dt],ot.setScale(),X=s.calcTicks(ot),Q=s.makeTransTickFn(ot),ut=s.getTickSigns(ot)[2],J=ct.t+ct.h,ot.visible&&(s.drawTicks(D,ot,{vals:ot.ticks==="inside"?s.clipEnds(ot,X):X,layer:N,path:s.makeTickPath(ot,J,ut),transFn:Q}),s.drawLabels(D,ot,{vals:X,layer:N,transFn:Q,labelFns:s.makeLabelFns(ot,J)}));function Tt(ee){ee.attr("width",function(Zt){return Math.max(0,ot.c2p(Zt.range[1])-ot.c2p(Zt.range[0]))}).attr("x",function(Zt){return ot.c2p(Zt.range[0])}).attr("y",function(Zt){return .5*(1-Zt.thickness)*q}).attr("height",function(Zt){return Zt.thickness*q})}var wt=[G].concat(F.gauge.steps),Ct=j.selectAll("g.bg-bullet").data(wt);Ct.enter().append("g").classed("bg-bullet",!0).append("rect"),Ct.select("rect").call(Tt).call(T),Ct.exit().remove();var It=j.selectAll("g.value-bullet").data([F.gauge.bar]);It.enter().append("g").classed("value-bullet",!0).append("rect"),It.select("rect").attr("height",it).attr("y",(q-it)/2).call(T),y(et)?It.select("rect").transition().duration(et.duration).ease(et.easing).each("end",function(){Z&&Z()}).each("interrupt",function(){Z&&Z()}).attr("width",Math.max(0,ot.c2p(Math.min(F.gauge.axis.range[1],R[0].y)))):It.select("rect").attr("width",typeof R[0].y=="number"?Math.max(0,ot.c2p(Math.min(F.gauge.axis.range[1],R[0].y))):0),It.exit().remove();var Nt=R.filter(function(){return F.gauge.threshold.value||F.gauge.threshold.value===0}),te=j.selectAll("g.threshold-bullet").data(Nt);te.enter().append("g").classed("threshold-bullet",!0).append("line"),te.select("line").attr("x1",ot.c2p(F.gauge.threshold.value)).attr("x2",ot.c2p(F.gauge.threshold.value)).attr("y1",(1-F.gauge.threshold.thickness)/2*q).attr("y2",(1-(1-F.gauge.threshold.thickness)/2)*q).call(m.stroke,F.gauge.threshold.line.color).style("stroke-width",F.gauge.threshold.line.width),te.exit().remove();var Jt=j.selectAll("g.gauge-outline").data([rt]);Jt.enter().append("g").classed("gauge-outline",!0).append("rect"),Jt.select("rect").call(Tt).call(T),Jt.exit().remove()}function k(D,B,R,I){var F=R[0].trace,j=I.size,N=I.radius,G=I.innerRadius,rt=I.gaugeBg,ct=I.gaugeOutline,st=[j.l+j.w/2,j.t+j.h/2+N/2],et=I.gauge,Z=I.layer,ot=I.transitionOpts,X=I.onComplete,Q=Math.PI/2;function ut(Me){var Ce=F.gauge.axis.range[0],We=F.gauge.axis.range[1],qe=(Me-Ce)/(We-Ce)*Math.PI-Q;return qe<-Q?-Q:qe>Q?Q:qe}function J(Me){return u.svg.arc().innerRadius((G+N)/2-Me/2*(N-G)).outerRadius((G+N)/2+Me/2*(N-G)).startAngle(-Q)}function q(Me){Me.attr("d",function(Ce){return J(Ce.thickness).startAngle(ut(Ce.range[0])).endAngle(ut(Ce.range[1]))()})}var it,nt,dt,Tt;et.enter().append("g").classed("angular",!0),et.attr("transform",e(st[0],st[1])),Z.enter().append("g").classed("angularaxis",!0).classed("crisp",!0),Z.selectAll("g.xangularaxistick,path,text").remove(),it=h(D,F.gauge.axis),it.type="linear",it.range=F.gauge.axis.range,it._id="xangularaxis",it.ticklabeloverflow="allow",it.setScale();var wt=function(Me){return(it.range[0]-Me.x)/(it.range[1]-it.range[0])*Math.PI+Math.PI},Ct={},It=s.makeLabelFns(it,0),Nt=It.labelStandoff;Ct.xFn=function(Me){var Ce=wt(Me);return Math.cos(Ce)*Nt},Ct.yFn=function(Me){var Ce=wt(Me),We=Math.sin(Ce)>0?.2:1;return-Math.sin(Ce)*(Nt+Me.fontSize*We)+Math.abs(Math.cos(Ce))*(Me.fontSize*i)},Ct.anchorFn=function(Me){var Ce=wt(Me),We=Math.cos(Ce);return Math.abs(We)<.1?"middle":We>0?"start":"end"},Ct.heightFn=function(Me,Ce,We){var qe=wt(Me);return-.5*(1+Math.sin(qe))*We};var te=function(Me){return e(st[0]+N*Math.cos(Me),st[1]-N*Math.sin(Me))};dt=function(Me){return te(wt(Me))};var Jt=function(Me){var Ce=wt(Me);return te(Ce)+"rotate("+-r(Ce)+")"};if(nt=s.calcTicks(it),Tt=s.getTickSigns(it)[2],it.visible){Tt=it.ticks==="inside"?-1:1;var ee=(it.linewidth||1)/2;s.drawTicks(D,it,{vals:nt,layer:Z,path:"M"+Tt*ee+",0h"+Tt*it.ticklen,transFn:Jt}),s.drawLabels(D,it,{vals:nt,layer:Z,transFn:dt,labelFns:Ct})}var Zt=[rt].concat(F.gauge.steps),mt=et.selectAll("g.bg-arc").data(Zt);mt.enter().append("g").classed("bg-arc",!0).append("path"),mt.select("path").call(q).call(T),mt.exit().remove();var bt=J(F.gauge.bar.thickness),vt=et.selectAll("g.value-arc").data([F.gauge.bar]);vt.enter().append("g").classed("value-arc",!0).append("path");var Ut=vt.select("path");y(ot)?(Ut.transition().duration(ot.duration).ease(ot.easing).each("end",function(){X&&X()}).each("interrupt",function(){X&&X()}).attrTween("d",c(bt,ut(R[0].lastY),ut(R[0].y))),F._lastValue=R[0].y):Ut.attr("d",typeof R[0].y=="number"?bt.endAngle(ut(R[0].y)):"M0,0Z"),Ut.call(T),vt.exit().remove(),Zt=[];var re=F.gauge.threshold.value;(re||re===0)&&Zt.push({range:[re,re],color:F.gauge.threshold.color,line:{color:F.gauge.threshold.line.color,width:F.gauge.threshold.line.width},thickness:F.gauge.threshold.thickness});var Kt=et.selectAll("g.threshold-arc").data(Zt);Kt.enter().append("g").classed("threshold-arc",!0).append("path"),Kt.select("path").call(q).call(T),Kt.exit().remove();var ue=et.selectAll("g.gauge-outline").data([ct]);ue.enter().append("g").classed("gauge-outline",!0).append("path"),ue.select("path").call(q).call(T),ue.exit().remove()}function M(D,B,R,I){var F=R[0].trace,j=I.numbersX,N=I.numbersY,G=F.align||"center",rt=w[G],ct=I.transitionOpts,st=I.onComplete,et=A.ensureSingle(B,"g","numbers"),Z,ot,X,Q=[];F._hasNumber&&Q.push("number"),F._hasDelta&&(Q.push("delta"),F.delta.position==="left"&&Q.reverse());var ut=et.selectAll("text").data(Q);ut.enter().append("text"),ut.attr("text-anchor",function(){return rt}).attr("class",function(te){return te}).attr("x",null).attr("y",null).attr("dx",null).attr("dy",null),ut.exit().remove();function J(te,Jt,ee,Zt){if(te.match("s")&&ee>=0!=Zt>=0&&!Jt(ee).slice(-1).match(x)&&!Jt(Zt).slice(-1).match(x)){var mt=te.slice().replace("s","f").replace(/\d+/,function(vt){return parseInt(vt)-1}),bt=h(D,{tickformat:mt});return function(vt){return Math.abs(vt)<1?s.tickText(bt,vt).text:Jt(vt)}}else return Jt}function q(){var te=h(D,{tickformat:F.number.valueformat},F._range);te.setScale(),s.prepTicks(te);var Jt=function(vt){return s.tickText(te,vt).text},ee=F.number.suffix,Zt=F.number.prefix,mt=et.select("text.number");function bt(){var vt=typeof R[0].y=="number"?Zt+Jt(R[0].y)+ee:"-";mt.text(vt).call(n.font,F.number.font).call(a.convertToTspans,D)}return y(ct)?mt.transition().duration(ct.duration).ease(ct.easing).each("end",function(){bt(),st&&st()}).each("interrupt",function(){bt(),st&&st()}).attrTween("text",function(){var vt=u.select(this),Ut=E(R[0].lastY,R[0].y);F._lastValue=R[0].y;var re=J(F.number.valueformat,Jt,R[0].lastY,R[0].y);return function(Kt){vt.text(Zt+re(Ut(Kt))+ee)}}):bt(),Z=P(Zt+Jt(R[0].y)+ee,F.number.font,rt,D),mt}function it(){var te=h(D,{tickformat:F.delta.valueformat},F._range);te.setScale(),s.prepTicks(te);var Jt=function(Kt){return s.tickText(te,Kt).text},ee=F.delta.suffix,Zt=F.delta.prefix,mt=function(Kt){var ue=F.delta.relative?Kt.relativeDelta:Kt.delta;return ue},bt=function(Kt,ue){return Kt===0||typeof Kt!="number"||isNaN(Kt)?"-":(Kt>0?F.delta.increasing.symbol:F.delta.decreasing.symbol)+Zt+ue(Kt)+ee},vt=function(Kt){return Kt.delta>=0?F.delta.increasing.color:F.delta.decreasing.color};F._deltaLastValue===void 0&&(F._deltaLastValue=mt(R[0]));var Ut=et.select("text.delta");Ut.call(n.font,F.delta.font).call(m.fill,vt({delta:F._deltaLastValue}));function re(){Ut.text(bt(mt(R[0]),Jt)).call(m.fill,vt(R[0])).call(a.convertToTspans,D)}return y(ct)?Ut.transition().duration(ct.duration).ease(ct.easing).tween("text",function(){var Kt=u.select(this),ue=mt(R[0]),Me=F._deltaLastValue,Ce=J(F.delta.valueformat,Jt,Me,ue),We=E(Me,ue);return F._deltaLastValue=ue,function(qe){Kt.text(bt(We(qe),Ce)),Kt.call(m.fill,vt({delta:We(qe)}))}}).each("end",function(){re(),st&&st()}).each("interrupt",function(){re(),st&&st()}):re(),ot=P(bt(mt(R[0]),Jt),F.delta.font,rt,D),Ut}var nt=F.mode+F.align,dt;if(F._hasDelta&&(dt=it(),nt+=F.delta.position+F.delta.font.size+F.delta.font.family+F.delta.valueformat,nt+=F.delta.increasing.symbol+F.delta.decreasing.symbol,X=ot),F._hasNumber&&(q(),nt+=F.number.font.size+F.number.font.family+F.number.valueformat+F.number.suffix+F.number.prefix,X=Z),F._hasDelta&&F._hasNumber){var Tt=[(Z.left+Z.right)/2,(Z.top+Z.bottom)/2],wt=[(ot.left+ot.right)/2,(ot.top+ot.bottom)/2],Ct,It,Nt=.75*F.delta.font.size;F.delta.position==="left"&&(Ct=z(F,"deltaPos",0,-1*(Z.width*l[F.align]+ot.width*(1-l[F.align])+Nt),nt,Math.min),It=Tt[1]-wt[1],X={width:Z.width+ot.width+Nt,height:Math.max(Z.height,ot.height),left:ot.left+Ct,right:Z.right,top:Math.min(Z.top,ot.top+It),bottom:Math.max(Z.bottom,ot.bottom+It)}),F.delta.position==="right"&&(Ct=z(F,"deltaPos",0,Z.width*(1-l[F.align])+ot.width*l[F.align]+Nt,nt,Math.max),It=Tt[1]-wt[1],X={width:Z.width+ot.width+Nt,height:Math.max(Z.height,ot.height),left:Z.left,right:ot.right+Ct,top:Math.min(Z.top,ot.top+It),bottom:Math.max(Z.bottom,ot.bottom+It)}),F.delta.position==="bottom"&&(Ct=null,It=ot.height,X={width:Math.max(Z.width,ot.width),height:Z.height+ot.height,left:Math.min(Z.left,ot.left),right:Math.max(Z.right,ot.right),top:Z.bottom-Z.height,bottom:Z.bottom+ot.height}),F.delta.position==="top"&&(Ct=null,It=Z.top,X={width:Math.max(Z.width,ot.width),height:Z.height+ot.height,left:Math.min(Z.left,ot.left),right:Math.max(Z.right,ot.right),top:Z.bottom-Z.height-ot.height,bottom:Z.bottom}),dt.attr({dx:Ct,dy:It})}(F._hasNumber||F._hasDelta)&&et.attr("transform",function(){var te=I.numbersScaler(X);nt+=te[2];var Jt=z(F,"numbersScale",1,te[0],nt,Math.min),ee;F._scaleNumbers||(Jt=1),F._isAngular?ee=N-Jt*X.bottom:ee=N-Jt*(X.top+X.bottom)/2,F._numbersTop=Jt*X.top+ee;var Zt=X[G];G==="center"&&(Zt=(X.left+X.right)/2);var mt=j-Jt*Zt;return mt=z(F,"numbersTranslate",0,mt,nt,Math.max),e(mt,ee)+t(Jt)})}function T(D){D.each(function(B){m.stroke(u.select(this),B.line.color)}).each(function(B){m.fill(u.select(this),B.color)}).style("stroke-width",function(B){return B.line.width})}function c(D,B,R){return function(){var I=d(B,R);return function(F){return D.endAngle(I(F))()}}}function h(D,B,R){var I=D._fullLayout,F=A.extendFlat({type:"linear",ticks:"outside",range:R,showline:!0},B),j={type:"linear",_id:"x"+B._id},N={letter:"x",font:I.font,noAutotickangles:!0,noHover:!0,noTickson:!0};function G(rt,ct){return A.coerce(F,j,g,rt,ct)}return f(F,j,G,N,I),v(F,j,G,N),j}function b(D,B,R){var I=Math.min(B/D.width,R/D.height);return[I,D,B+"x"+R]}function _(D,B){var R=Math.sqrt(D.width/2*(D.width/2)+D.height*D.height),I=B/R;return[I,D,B]}function P(D,B,R,I){var F=document.createElementNS("http://www.w3.org/2000/svg","text"),j=u.select(F);return j.text(D).attr("x",0).attr("y",0).attr("text-anchor",R).attr("data-unformatted",D).call(a.convertToTspans,I).call(n.font,B),n.bBox(j.node())}function z(D,B,R,I,F,j){var N="_cache"+B;D[N]&&D[N].key===F||(D[N]={key:F,value:R});var G=A.aggNums(j,null,[D[N].value,I],2);return D[N].value=G,G}}),hL=Vt((K,V)=>{V.exports={moduleType:"trace",name:"indicator",basePlotModule:lL(),categories:["svg","noOpacity","noHover"],animatable:!0,attributes:Z5(),supplyDefaults:uL().supplyDefaults,calc:cL().calc,plot:fL(),meta:{}}}),pL=Vt((K,V)=>{V.exports=hL()}),Y5=Vt((K,V)=>{var u=h0(),d=So().extendFlat,E=Cu().overrideAll,A=yu(),t=Hu().attributes,e=hc().descriptionOnlyNumbers;V.exports=E({domain:t({name:"table",trace:!0}),columnwidth:{valType:"number",arrayOk:!0,dflt:null},columnorder:{valType:"data_array"},header:{values:{valType:"data_array",dflt:[]},format:{valType:"data_array",dflt:[],description:e("cell value")},prefix:{valType:"string",arrayOk:!0,dflt:null},suffix:{valType:"string",arrayOk:!0,dflt:null},height:{valType:"number",dflt:28},align:d({},u.align,{arrayOk:!0}),line:{width:{valType:"number",arrayOk:!0,dflt:1},color:{valType:"color",arrayOk:!0,dflt:"grey"}},fill:{color:{valType:"color",arrayOk:!0,dflt:"white"}},font:d({},A({arrayOk:!0}))},cells:{values:{valType:"data_array",dflt:[]},format:{valType:"data_array",dflt:[],description:e("cell value")},prefix:{valType:"string",arrayOk:!0,dflt:null},suffix:{valType:"string",arrayOk:!0,dflt:null},height:{valType:"number",dflt:20},align:d({},u.align,{arrayOk:!0}),line:{width:{valType:"number",arrayOk:!0,dflt:1},color:{valType:"color",arrayOk:!0,dflt:"grey"}},fill:{color:{valType:"color",arrayOk:!0,dflt:"white"}},font:d({},A({arrayOk:!0}))}},"calc","from-root")}),dL=Vt((K,V)=>{var u=Xr(),d=Y5(),E=Hu().defaults;function A(t,e){for(var r=t.columnorder||[],i=t.header.values.length,n=r.slice(0,i),o=n.slice().sort(function(f,v){return f-v}),a=n.map(function(f){return o.indexOf(f)}),s=a.length;s{var u=wp().wrap;V.exports=function(){return u({})}}),X5=Vt((K,V)=>{V.exports={cellPad:8,columnExtentOffset:10,columnTitleOffset:28,emptyHeaderHeight:16,latexCheck:/^\$.*\$$/,goldenRatio:1.618,lineBreaker:"
          ",maxDimensionCount:60,overdrag:45,releaseTransitionDuration:120,releaseTransitionEase:"cubic-out",scrollbarCaptureWidth:18,scrollbarHideDelay:1e3,scrollbarHideDuration:1e3,scrollbarOffset:5,scrollbarWidth:8,transitionDuration:100,transitionEase:"cubic-out",uplift:5,wrapSpacer:" ",wrapSplitCharacter:" ",cn:{table:"table",tableControlView:"table-control-view",scrollBackground:"scroll-background",yColumn:"y-column",columnBlock:"column-block",scrollAreaClip:"scroll-area-clip",scrollAreaClipRect:"scroll-area-clip-rect",columnBoundary:"column-boundary",columnBoundaryClippath:"column-boundary-clippath",columnBoundaryRect:"column-boundary-rect",columnCells:"column-cells",columnCell:"column-cell",cellRect:"cell-rect",cellText:"cell-text",cellTextHolder:"cell-text-holder",scrollbarKit:"scrollbar-kit",scrollbar:"scrollbar",scrollbarSlider:"scrollbar-slider",scrollbarGlyph:"scrollbar-glyph",scrollbarCaptureZone:"scrollbar-capture-zone"}}}),gL=Vt((K,V)=>{var u=X5(),d=So().extendFlat,E=Lo(),A=nh().isTypedArray,t=nh().isArrayOrTypedArray;V.exports=function(v,g){var m=i(g.cells.values),w=function(G){return G.slice(g.header.values.length,G.length)},l=i(g.header.values);l.length&&!l[0].length&&(l[0]=[""],l=i(l));var x=l.concat(w(m).map(function(){return n((l[0]||[""]).length)})),y=g.domain,S=Math.floor(v._fullLayout._size.w*(y.x[1]-y.x[0])),k=Math.floor(v._fullLayout._size.h*(y.y[1]-y.y[0])),M=g.header.values.length?x[0].map(function(){return g.header.height}):[u.emptyHeaderHeight],T=m.length?m[0].map(function(){return g.cells.height}):[],c=M.reduce(r,0),h=k-c,b=h+u.uplift,_=s(T,b),P=s(M,c),z=a(P,[]),D=a(_,z),B={},R=g._fullInput.columnorder;t(R)&&(R=Array.from(R)),R=R.concat(w(m.map(function(G,rt){return rt})));var I=x.map(function(G,rt){var ct=t(g.columnwidth)?g.columnwidth[Math.min(rt,g.columnwidth.length-1)]:g.columnwidth;return E(ct)?Number(ct):1}),F=I.reduce(r,0);I=I.map(function(G){return G/F*S});var j=Math.max(e(g.header.line.width),e(g.cells.line.width)),N={key:g.uid+v._context.staticPlot,translateX:y.x[0]*v._fullLayout._size.w,translateY:v._fullLayout._size.h*(1-y.y[1]),size:v._fullLayout._size,width:S,maxLineWidth:j,height:k,columnOrder:R,groupHeight:k,rowBlocks:D,headerRowBlocks:z,scrollY:0,cells:d({},g.cells,{values:m}),headerCells:d({},g.header,{values:x}),gdColumns:x.map(function(G){return G[0]}),gdColumnsOriginalOrder:x.map(function(G){return G[0]}),prevPages:[0,0],scrollbarState:{scrollbarScrollInProgress:!1},columns:x.map(function(G,rt){var ct=B[G];B[G]=(ct||0)+1;var st=G+"__"+B[G];return{key:st,label:G,specIndex:rt,xIndex:R[rt],xScale:o,x:void 0,calcdata:void 0,columnWidth:I[rt]}})};return N.columns.forEach(function(G){G.calcdata=N,G.x=o(G)}),N};function e(v){if(t(v)){for(var g=0,m=0;m=g||M===v.length-1)&&(m[l]=y,y.key=k++,y.firstRowIndex=S,y.lastRowIndex=M,y=f(),l+=x,S=M+1,x=0);return m}function f(){return{firstRowIndex:null,lastRowIndex:null,rows:[]}}}),vL=Vt(K=>{var V=So().extendFlat;K.splitToPanels=function(d){var E=[0,0],A=V({},d,{key:"header",type:"header",page:0,prevPages:E,currentRepaint:[null,null],dragHandle:!0,values:d.calcdata.headerCells.values[d.specIndex],rowBlocks:d.calcdata.headerRowBlocks,calcdata:V({},d.calcdata,{cells:d.calcdata.headerCells})}),t=V({},d,{key:"cells1",type:"cells",page:0,prevPages:E,currentRepaint:[null,null],dragHandle:!1,values:d.calcdata.cells.values[d.specIndex],rowBlocks:d.calcdata.rowBlocks}),e=V({},d,{key:"cells2",type:"cells",page:1,prevPages:E,currentRepaint:[null,null],dragHandle:!1,values:d.calcdata.cells.values[d.specIndex],rowBlocks:d.calcdata.rowBlocks});return[t,e,A]},K.splitToCells=function(d){var E=u(d);return(d.values||[]).slice(E[0],E[1]).map(function(A,t){var e=typeof A=="string"&&A.match(/[<$&> ]/)?"_keybuster_"+Math.random():"";return{keyWithinBlock:t+e,key:E[0]+t,column:d,calcdata:d.calcdata,page:d.page,rowBlocks:d.rowBlocks,value:A}})};function u(d){var E=d.rowBlocks[d.page],A=E?E.rows[0].rowIndex:0,t=E?A+E.rows.length:0;return[A,t]}}),$5=Vt((K,V)=>{var u=X5(),d=Ni(),E=Xr(),A=E.numberFormat,t=wp(),e=Eo(),r=Dl(),i=Xr().raiseToTop,n=Xr().strTranslate,o=Xr().cancelTransition,a=gL(),s=vL(),f=Pi();V.exports=function(it,nt){var dt=!it._context.staticPlot,Tt=it._fullLayout._paper.selectAll("."+u.cn.table).data(nt.map(function(Kt){var ue=t.unwrap(Kt),Me=ue.trace;return a(it,Me)}),t.keyFun);Tt.exit().remove(),Tt.enter().append("g").classed(u.cn.table,!0).attr("overflow","visible").style("box-sizing","content-box").style("position","absolute").style("left",0).style("overflow","visible").style("shape-rendering","crispEdges").style("pointer-events","all"),Tt.attr("width",function(Kt){return Kt.width+Kt.size.l+Kt.size.r}).attr("height",function(Kt){return Kt.height+Kt.size.t+Kt.size.b}).attr("transform",function(Kt){return n(Kt.translateX,Kt.translateY)});var wt=Tt.selectAll("."+u.cn.tableControlView).data(t.repeat,t.keyFun),Ct=wt.enter().append("g").classed(u.cn.tableControlView,!0).style("box-sizing","content-box");if(dt){var It="onwheel"in document?"wheel":"mousewheel";Ct.on("mousemove",function(Kt){wt.filter(function(ue){return Kt===ue}).call(l,it)}).on(It,function(Kt){if(!Kt.scrollbarState.wheeling){Kt.scrollbarState.wheeling=!0;var ue=Kt.scrollY+d.event.deltaY,Me=rt(it,wt,null,ue)(Kt);Me||(d.event.stopPropagation(),d.event.preventDefault()),Kt.scrollbarState.wheeling=!1}}).call(l,it,!0)}wt.attr("transform",function(Kt){return n(Kt.size.l,Kt.size.t)});var Nt=wt.selectAll("."+u.cn.scrollBackground).data(t.repeat,t.keyFun);Nt.enter().append("rect").classed(u.cn.scrollBackground,!0).attr("fill","none"),Nt.attr("width",function(Kt){return Kt.width}).attr("height",function(Kt){return Kt.height}),wt.each(function(Kt){e.setClipUrl(d.select(this),g(it,Kt),it)});var te=wt.selectAll("."+u.cn.yColumn).data(function(Kt){return Kt.columns},t.keyFun);te.enter().append("g").classed(u.cn.yColumn,!0),te.exit().remove(),te.attr("transform",function(Kt){return n(Kt.x,0)}),dt&&te.call(d.behavior.drag().origin(function(Kt){var ue=d.select(this);return R(ue,Kt,-u.uplift),i(this),Kt.calcdata.columnDragInProgress=!0,l(wt.filter(function(Me){return Kt.calcdata.key===Me.key}),it),Kt}).on("drag",function(Kt){var ue=d.select(this),Me=function(qe){return(Kt===qe?d.event.x:qe.x)+qe.columnWidth/2};Kt.x=Math.max(-u.overdrag,Math.min(Kt.calcdata.width+u.overdrag-Kt.columnWidth,d.event.x));var Ce=w(te).filter(function(qe){return qe.calcdata.key===Kt.calcdata.key}),We=Ce.sort(function(qe,vr){return Me(qe)-Me(vr)});We.forEach(function(qe,vr){qe.xIndex=vr,qe.x=Kt===qe?qe.x:qe.xScale(qe)}),te.filter(function(qe){return Kt!==qe}).transition().ease(u.transitionEase).duration(u.transitionDuration).attr("transform",function(qe){return n(qe.x,0)}),ue.call(o).attr("transform",n(Kt.x,-u.uplift))}).on("dragend",function(Kt){var ue=d.select(this),Me=Kt.calcdata;Kt.x=Kt.xScale(Kt),Kt.calcdata.columnDragInProgress=!1,R(ue,Kt,0),D(it,Me,Me.columns.map(function(Ce){return Ce.xIndex}))})),te.each(function(Kt){e.setClipUrl(d.select(this),m(it,Kt),it)});var Jt=te.selectAll("."+u.cn.columnBlock).data(s.splitToPanels,t.keyFun);Jt.enter().append("g").classed(u.cn.columnBlock,!0).attr("id",function(Kt){return Kt.key}),Jt.style("cursor",function(Kt){return Kt.dragHandle?"ew-resize":Kt.calcdata.scrollbarState.barWiggleRoom?"ns-resize":"default"});var ee=Jt.filter(F),Zt=Jt.filter(I);dt&&Zt.call(d.behavior.drag().origin(function(Kt){return d.event.stopPropagation(),Kt}).on("drag",rt(it,wt,-1)).on("dragend",function(){})),x(it,wt,ee,Jt),x(it,wt,Zt,Jt);var mt=wt.selectAll("."+u.cn.scrollAreaClip).data(t.repeat,t.keyFun);mt.enter().append("clipPath").classed(u.cn.scrollAreaClip,!0).attr("id",function(Kt){return g(it,Kt)});var bt=mt.selectAll("."+u.cn.scrollAreaClipRect).data(t.repeat,t.keyFun);bt.enter().append("rect").classed(u.cn.scrollAreaClipRect,!0).attr("x",-u.overdrag).attr("y",-u.uplift).attr("fill","none"),bt.attr("width",function(Kt){return Kt.width+2*u.overdrag}).attr("height",function(Kt){return Kt.height+u.uplift});var vt=te.selectAll("."+u.cn.columnBoundary).data(t.repeat,t.keyFun);vt.enter().append("g").classed(u.cn.columnBoundary,!0);var Ut=te.selectAll("."+u.cn.columnBoundaryClippath).data(t.repeat,t.keyFun);Ut.enter().append("clipPath").classed(u.cn.columnBoundaryClippath,!0),Ut.attr("id",function(Kt){return m(it,Kt)});var re=Ut.selectAll("."+u.cn.columnBoundaryRect).data(t.repeat,t.keyFun);re.enter().append("rect").classed(u.cn.columnBoundaryRect,!0).attr("fill","none"),re.attr("width",function(Kt){return Kt.columnWidth+2*v(Kt)}).attr("height",function(Kt){return Kt.calcdata.height+2*v(Kt)+u.uplift}).attr("x",function(Kt){return-v(Kt)}).attr("y",function(Kt){return-v(Kt)}),G(null,Zt,wt)};function v(it){return Math.ceil(it.calcdata.maxLineWidth/2)}function g(it,nt){return"clip"+it._fullLayout._uid+"_scrollAreaBottomClip_"+nt.key}function m(it,nt){return"clip"+it._fullLayout._uid+"_columnBoundaryClippath_"+nt.calcdata.key+"_"+nt.specIndex}function w(it){return[].concat.apply([],it.map(function(nt){return nt})).map(function(nt){return nt.__data__})}function l(it,nt,dt){function Tt(Jt){var ee=Jt.rowBlocks;return X(ee,ee.length-1)+(ee.length?Q(ee[ee.length-1],1/0):1)}var wt=it.selectAll("."+u.cn.scrollbarKit).data(t.repeat,t.keyFun);wt.enter().append("g").classed(u.cn.scrollbarKit,!0).style("shape-rendering","geometricPrecision"),wt.each(function(Jt){var ee=Jt.scrollbarState;ee.totalHeight=Tt(Jt),ee.scrollableAreaHeight=Jt.groupHeight-j(Jt),ee.currentlyVisibleHeight=Math.min(ee.totalHeight,ee.scrollableAreaHeight),ee.ratio=ee.currentlyVisibleHeight/ee.totalHeight,ee.barLength=Math.max(ee.ratio*ee.currentlyVisibleHeight,u.goldenRatio*u.scrollbarWidth),ee.barWiggleRoom=ee.currentlyVisibleHeight-ee.barLength,ee.wiggleRoom=Math.max(0,ee.totalHeight-ee.scrollableAreaHeight),ee.topY=ee.barWiggleRoom===0?0:Jt.scrollY/ee.wiggleRoom*ee.barWiggleRoom,ee.bottomY=ee.topY+ee.barLength,ee.dragMultiplier=ee.wiggleRoom/ee.barWiggleRoom}).attr("transform",function(Jt){var ee=Jt.width+u.scrollbarWidth/2+u.scrollbarOffset;return n(ee,j(Jt))});var Ct=wt.selectAll("."+u.cn.scrollbar).data(t.repeat,t.keyFun);Ct.enter().append("g").classed(u.cn.scrollbar,!0);var It=Ct.selectAll("."+u.cn.scrollbarSlider).data(t.repeat,t.keyFun);It.enter().append("g").classed(u.cn.scrollbarSlider,!0),It.attr("transform",function(Jt){return n(0,Jt.scrollbarState.topY||0)});var Nt=It.selectAll("."+u.cn.scrollbarGlyph).data(t.repeat,t.keyFun);Nt.enter().append("line").classed(u.cn.scrollbarGlyph,!0).attr("stroke","black").attr("stroke-width",u.scrollbarWidth).attr("stroke-linecap","round").attr("y1",u.scrollbarWidth/2),Nt.attr("y2",function(Jt){return Jt.scrollbarState.barLength-u.scrollbarWidth/2}).attr("stroke-opacity",function(Jt){return Jt.columnDragInProgress||!Jt.scrollbarState.barWiggleRoom||dt?0:.4}),Nt.transition().delay(0).duration(0),Nt.transition().delay(u.scrollbarHideDelay).duration(u.scrollbarHideDuration).attr("stroke-opacity",0);var te=Ct.selectAll("."+u.cn.scrollbarCaptureZone).data(t.repeat,t.keyFun);te.enter().append("line").classed(u.cn.scrollbarCaptureZone,!0).attr("stroke","white").attr("stroke-opacity",.01).attr("stroke-width",u.scrollbarCaptureWidth).attr("stroke-linecap","butt").attr("y1",0).on("mousedown",function(Jt){var ee=d.event.y,Zt=this.getBoundingClientRect(),mt=Jt.scrollbarState,bt=ee-Zt.top,vt=d.scale.linear().domain([0,mt.scrollableAreaHeight]).range([0,mt.totalHeight]).clamp(!0);mt.topY<=bt&&bt<=mt.bottomY||rt(nt,it,null,vt(bt-mt.barLength/2))(Jt)}).call(d.behavior.drag().origin(function(Jt){return d.event.stopPropagation(),Jt.scrollbarState.scrollbarScrollInProgress=!0,Jt}).on("drag",rt(nt,it)).on("dragend",function(){})),te.attr("y2",function(Jt){return Jt.scrollbarState.scrollableAreaHeight}),nt._context.staticPlot&&(Nt.remove(),te.remove())}function x(it,nt,dt,Tt){var wt=y(dt),Ct=S(wt);c(Ct);var It=k(Ct);b(It);var Nt=T(Ct),te=M(Nt);h(te),_(te,nt,Tt,it),ot(Ct)}function y(it){var nt=it.selectAll("."+u.cn.columnCells).data(t.repeat,t.keyFun);return nt.enter().append("g").classed(u.cn.columnCells,!0),nt.exit().remove(),nt}function S(it){var nt=it.selectAll("."+u.cn.columnCell).data(s.splitToCells,function(dt){return dt.keyWithinBlock});return nt.enter().append("g").classed(u.cn.columnCell,!0),nt.exit().remove(),nt}function k(it){var nt=it.selectAll("."+u.cn.cellRect).data(t.repeat,function(dt){return dt.keyWithinBlock});return nt.enter().append("rect").classed(u.cn.cellRect,!0),nt}function M(it){var nt=it.selectAll("."+u.cn.cellText).data(t.repeat,function(dt){return dt.keyWithinBlock});return nt.enter().append("text").classed(u.cn.cellText,!0).style("cursor",function(){return"auto"}).on("mousedown",function(){d.event.stopPropagation()}),nt}function T(it){var nt=it.selectAll("."+u.cn.cellTextHolder).data(t.repeat,function(dt){return dt.keyWithinBlock});return nt.enter().append("g").classed(u.cn.cellTextHolder,!0).style("shape-rendering","geometricPrecision"),nt}function c(it){it.each(function(nt,dt){var Tt=nt.calcdata.cells.font,wt=nt.column.specIndex,Ct={size:B(Tt.size,wt,dt),color:B(Tt.color,wt,dt),family:B(Tt.family,wt,dt),weight:B(Tt.weight,wt,dt),style:B(Tt.style,wt,dt),variant:B(Tt.variant,wt,dt),textcase:B(Tt.textcase,wt,dt),lineposition:B(Tt.lineposition,wt,dt),shadow:B(Tt.shadow,wt,dt)};nt.rowNumber=nt.key,nt.align=B(nt.calcdata.cells.align,wt,dt),nt.cellBorderWidth=B(nt.calcdata.cells.line.width,wt,dt),nt.font=Ct})}function h(it){it.each(function(nt){e.font(d.select(this),nt.font)})}function b(it){it.attr("width",function(nt){return nt.column.columnWidth}).attr("stroke-width",function(nt){return nt.cellBorderWidth}).each(function(nt){var dt=d.select(this);f.stroke(dt,B(nt.calcdata.cells.line.color,nt.column.specIndex,nt.rowNumber)),f.fill(dt,B(nt.calcdata.cells.fill.color,nt.column.specIndex,nt.rowNumber))})}function _(it,nt,dt,Tt){it.text(function(wt){var Ct=wt.column.specIndex,It=wt.rowNumber,Nt=wt.value,te=typeof Nt=="string",Jt=te&&Nt.match(/
          /i),ee=!te||Jt;wt.mayHaveMarkup=te&&Nt.match(/[<&>]/);var Zt=P(Nt);wt.latex=Zt;var mt=Zt?"":B(wt.calcdata.cells.prefix,Ct,It)||"",bt=Zt?"":B(wt.calcdata.cells.suffix,Ct,It)||"",vt=Zt?null:B(wt.calcdata.cells.format,Ct,It)||null,Ut=mt+(vt?A(vt)(wt.value):wt.value)+bt,re;wt.wrappingNeeded=!wt.wrapped&&!ee&&!Zt&&(re=z(Ut)),wt.cellHeightMayIncrease=Jt||Zt||wt.mayHaveMarkup||(re===void 0?z(Ut):re),wt.needsConvertToTspans=wt.mayHaveMarkup||wt.wrappingNeeded||wt.latex;var Kt;if(wt.wrappingNeeded){var ue=u.wrapSplitCharacter===" "?Ut.replace(/wt&&Tt.push(Ct),wt+=te}return Tt}function G(it,nt,dt){var Tt=w(nt)[0];if(Tt!==void 0){var wt=Tt.rowBlocks,Ct=Tt.calcdata,It=X(wt,wt.length),Nt=Tt.calcdata.groupHeight-j(Tt),te=Ct.scrollY=Math.max(0,Math.min(It-Nt,Ct.scrollY)),Jt=N(wt,te,Nt);Jt.length===1&&(Jt[0]===wt.length-1?Jt.unshift(Jt[0]-1):Jt.push(Jt[0]+1)),Jt[0]%2&&Jt.reverse(),nt.each(function(ee,Zt){ee.page=Jt[Zt],ee.scrollY=te}),nt.attr("transform",function(ee){var Zt=X(ee.rowBlocks,ee.page)-ee.scrollY;return n(0,Zt)}),it&&(ct(it,dt,nt,Jt,Tt.prevPages,Tt,0),ct(it,dt,nt,Jt,Tt.prevPages,Tt,1),l(dt,it))}}function rt(it,nt,dt,Tt){return function(wt){var Ct=wt.calcdata?wt.calcdata:wt,It=nt.filter(function(ee){return Ct.key===ee.key}),Nt=dt||Ct.scrollbarState.dragMultiplier,te=Ct.scrollY;Ct.scrollY=Tt===void 0?Ct.scrollY+Nt*d.event.dy:Tt;var Jt=It.selectAll("."+u.cn.yColumn).selectAll("."+u.cn.columnBlock).filter(I);return G(it,Jt,It),Ct.scrollY===te}}function ct(it,nt,dt,Tt,wt,Ct,It){var Nt=Tt[It]!==wt[It];Nt&&(clearTimeout(Ct.currentRepaint[It]),Ct.currentRepaint[It]=setTimeout(function(){var te=dt.filter(function(Jt,ee){return ee===It&&Tt[ee]!==wt[ee]});x(it,nt,te,dt),wt[It]=Tt[It]}))}function st(it,nt,dt,Tt){return function(){var wt=d.select(nt.parentNode);wt.each(function(Ct){var It=Ct.fragments;wt.selectAll("tspan.line").each(function(vt,Ut){It[Ut].width=this.getComputedTextLength()});var Nt=It[It.length-1].width,te=It.slice(0,-1),Jt=[],ee,Zt,mt=0,bt=Ct.column.columnWidth-2*u.cellPad;for(Ct.value="";te.length;)ee=te.shift(),Zt=ee.width+Nt,mt+Zt>bt&&(Ct.value+=Jt.join(u.wrapSpacer)+u.lineBreaker,Jt=[],mt=0),Jt.push(ee.text),mt+=Zt;mt&&(Ct.value+=Jt.join(u.wrapSpacer)),Ct.wrapped=!0}),wt.selectAll("tspan.line").remove(),_(wt.select("."+u.cn.cellText),dt,it,Tt),d.select(nt.parentNode.parentNode).call(ot)}}function et(it,nt,dt,Tt,wt){return function(){if(!wt.settledY){var Ct=d.select(nt.parentNode),It=J(wt),Nt=wt.key-It.firstRowIndex,te=It.rows[Nt].rowHeight,Jt=wt.cellHeightMayIncrease?nt.parentNode.getBoundingClientRect().height+2*u.cellPad:te,ee=Math.max(Jt,te),Zt=ee-It.rows[Nt].rowHeight;Zt&&(It.rows[Nt].rowHeight=ee,it.selectAll("."+u.cn.columnCell).call(ot),G(null,it.filter(I),0),l(dt,Tt,!0)),Ct.attr("transform",function(){var mt=this,bt=mt.parentNode,vt=bt.getBoundingClientRect(),Ut=d.select(mt.parentNode).select("."+u.cn.cellRect).node().getBoundingClientRect(),re=mt.transform.baseVal.consolidate(),Kt=Ut.top-vt.top+(re?re.matrix.f:u.cellPad);return n(Z(wt,d.select(mt.parentNode).select("."+u.cn.cellTextHolder).node().getBoundingClientRect().width),Kt)}),wt.settledY=!0}}}function Z(it,nt){switch(it.align){case"left":return u.cellPad;case"right":return it.column.columnWidth-(nt||0)-u.cellPad;case"center":return(it.column.columnWidth-(nt||0))/2;default:return u.cellPad}}function ot(it){it.attr("transform",function(nt){var dt=nt.rowBlocks[0].auxiliaryBlocks.reduce(function(It,Nt){return It+Q(Nt,1/0)},0),Tt=J(nt),wt=Q(Tt,nt.key),Ct=wt+dt;return n(0,Ct)}).selectAll("."+u.cn.cellRect).attr("height",function(nt){return q(J(nt),nt.key).rowHeight})}function X(it,nt){for(var dt=0,Tt=nt-1;Tt>=0;Tt--)dt+=ut(it[Tt]);return dt}function Q(it,nt){for(var dt=0,Tt=0;Tt{var V=Pf().getModuleCalcData,u=$5(),d="table";K.name=d,K.plot=function(E){var A=V(E.calcdata,d)[0];A.length&&u(E,A)},K.clean=function(E,A,t,e){var r=e._has&&e._has(d),i=A._has&&A._has(d);r&&!i&&e._paperdiv.selectAll(".table").remove()}}),xL=Vt((K,V)=>{V.exports={attributes:Y5(),supplyDefaults:dL(),calc:mL(),plot:$5(),moduleType:"trace",name:"table",basePlotModule:yL(),categories:["noOpacity"],meta:{}}}),_L=Vt((K,V)=>{V.exports=xL()}),bL=Vt((K,V)=>{var u=yu(),d=af(),E=Of(),A=hc().descriptionWithDates,t=Cu().overrideAll,e=If().dash,r=So().extendFlat;V.exports={color:{valType:"color",editType:"calc"},smoothing:{valType:"number",dflt:1,min:0,max:1.3,editType:"calc"},title:{text:{valType:"string",dflt:"",editType:"calc"},font:u({editType:"calc"}),offset:{valType:"number",dflt:10,editType:"calc"},editType:"calc"},type:{valType:"enumerated",values:["-","linear","date","category"],dflt:"-",editType:"calc"},autotypenumbers:E.autotypenumbers,autorange:{valType:"enumerated",values:[!0,!1,"reversed"],dflt:!0,editType:"calc"},rangemode:{valType:"enumerated",values:["normal","tozero","nonnegative"],dflt:"normal",editType:"calc"},range:{valType:"info_array",editType:"calc",items:[{valType:"any",editType:"calc"},{valType:"any",editType:"calc"}]},fixedrange:{valType:"boolean",dflt:!1,editType:"calc"},cheatertype:{valType:"enumerated",values:["index","value"],dflt:"value",editType:"calc"},tickmode:{valType:"enumerated",values:["linear","array"],dflt:"array",editType:"calc"},nticks:{valType:"integer",min:0,dflt:0,editType:"calc"},tickvals:{valType:"data_array",editType:"calc"},ticktext:{valType:"data_array",editType:"calc"},showticklabels:{valType:"enumerated",values:["start","end","both","none"],dflt:"start",editType:"calc"},labelalias:r({},E.labelalias,{editType:"calc"}),tickfont:u({editType:"calc"}),tickangle:{valType:"angle",dflt:"auto",editType:"calc"},tickprefix:{valType:"string",dflt:"",editType:"calc"},showtickprefix:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",editType:"calc"},ticksuffix:{valType:"string",dflt:"",editType:"calc"},showticksuffix:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",editType:"calc"},showexponent:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",editType:"calc"},exponentformat:{valType:"enumerated",values:["none","e","E","power","SI","B","SI extended"],dflt:"B",editType:"calc"},minexponent:{valType:"number",dflt:3,min:0,editType:"calc"},separatethousands:{valType:"boolean",dflt:!1,editType:"calc"},tickformat:{valType:"string",dflt:"",editType:"calc",description:A("tick label")},tickformatstops:t(E.tickformatstops,"calc","from-root"),categoryorder:{valType:"enumerated",values:["trace","category ascending","category descending","array"],dflt:"trace",editType:"calc"},categoryarray:{valType:"data_array",editType:"calc"},labelpadding:{valType:"integer",dflt:10,editType:"calc"},labelprefix:{valType:"string",editType:"calc"},labelsuffix:{valType:"string",dflt:"",editType:"calc"},showline:{valType:"boolean",dflt:!1,editType:"calc"},linecolor:{valType:"color",dflt:d.defaultLine,editType:"calc"},linewidth:{valType:"number",min:0,dflt:1,editType:"calc"},gridcolor:{valType:"color",editType:"calc"},gridwidth:{valType:"number",min:0,dflt:1,editType:"calc"},griddash:r({},e,{editType:"calc"}),showgrid:{valType:"boolean",dflt:!0,editType:"calc"},minorgridcount:{valType:"integer",min:0,dflt:0,editType:"calc"},minorgridwidth:{valType:"number",min:0,dflt:1,editType:"calc"},minorgriddash:r({},e,{editType:"calc"}),minorgridcolor:{valType:"color",dflt:d.lightLine,editType:"calc"},startline:{valType:"boolean",editType:"calc"},startlinecolor:{valType:"color",editType:"calc"},startlinewidth:{valType:"number",dflt:1,editType:"calc"},endline:{valType:"boolean",editType:"calc"},endlinewidth:{valType:"number",dflt:1,editType:"calc"},endlinecolor:{valType:"color",editType:"calc"},tick0:{valType:"number",min:0,dflt:0,editType:"calc"},dtick:{valType:"number",min:0,dflt:1,editType:"calc"},arraytick0:{valType:"integer",min:0,dflt:0,editType:"calc"},arraydtick:{valType:"integer",min:1,dflt:1,editType:"calc"},editType:"calc"}}),n_=Vt((K,V)=>{var u=yu(),d=bL(),E=af(),A=u({editType:"calc"}),t=dc().zorder;A.family.dflt='"Open Sans", verdana, arial, sans-serif',A.size.dflt=12,A.color.dflt=E.defaultLine,V.exports={carpet:{valType:"string",editType:"calc"},x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},a:{valType:"data_array",editType:"calc"},a0:{valType:"number",dflt:0,editType:"calc"},da:{valType:"number",dflt:1,editType:"calc"},b:{valType:"data_array",editType:"calc"},b0:{valType:"number",dflt:0,editType:"calc"},db:{valType:"number",dflt:1,editType:"calc"},cheaterslope:{valType:"number",dflt:1,editType:"calc"},aaxis:d,baxis:d,font:A,color:{valType:"color",dflt:E.defaultLine,editType:"plot"},zorder:t}}),wL=Vt((K,V)=>{var u=Xr().isArray1D;V.exports=function(d,E,A){var t=A("x"),e=t&&t.length,r=A("y"),i=r&&r.length;if(!e&&!i)return!1;if(E._cheater=!t,(!e||u(t))&&(!i||u(r))){var n=e?t.length:1/0;i&&(n=Math.min(n,r.length)),E.a&&E.a.length&&(n=Math.min(n,E.a.length)),E.b&&E.b.length&&(n=Math.min(n,E.b.length)),E._length=n}else E._length=null;return!0}}),TL=Vt((K,V)=>{var u=n_(),d=Pi().addOpacity,E=ji(),A=Xr(),t=u0(),e=Ad(),r=Md(),i=a1(),n=gp(),o=km();V.exports=function(s,f,v){var g=v.letter,m=v.font||{},w=u[g+"axis"];function l(j,N){return A.coerce(s,f,w,j,N)}function x(j,N){return A.coerce2(s,f,w,j,N)}v.name&&(f._name=v.name,f._id=v.name),l("autotypenumbers",v.autotypenumbersDflt);var y=l("type");if(y==="-"&&(v.data&&a(f,v.data),f.type==="-"?f.type="linear":y=s.type=f.type),l("smoothing"),l("cheatertype"),l("showticklabels"),l("labelprefix",g+" = "),l("labelsuffix"),l("showtickprefix"),l("showticksuffix"),l("separatethousands"),l("tickformat"),l("exponentformat"),l("minexponent"),l("showexponent"),l("categoryorder"),l("tickmode"),l("tickvals"),l("ticktext"),l("tick0"),l("dtick"),f.tickmode==="array"&&(l("arraytick0"),l("arraydtick")),l("labelpadding"),f._hovertitle=g,y==="date"){var S=E.getComponentMethod("calendars","handleDefaults");S(s,f,"calendar",v.calendar)}n(f,v.fullLayout),f.c2p=A.identity;var k=l("color",v.dfltColor),M=k===s.color?k:m.color,T=l("title.text");T&&(A.coerceFont(l,"title.font",m,{overrideDflt:{size:A.bigFont(m.size),color:M}}),l("title.offset")),l("tickangle");var c=l("autorange",!f.isValidRange(s.range));c&&l("rangemode"),l("range"),f.cleanRange(),l("fixedrange"),t(s,f,l,y),r(s,f,l,y,v),e(s,f,l,y,v),i(s,f,l,{data:v.data,dataAttr:g});var h=x("gridcolor",d(k,.3)),b=x("gridwidth"),_=x("griddash"),P=l("showgrid");P||(delete f.gridcolor,delete f.gridwidth,delete f.griddash);var z=x("startlinecolor",k),D=x("startlinewidth",b),B=l("startline",f.showgrid||!!z||!!D);B||(delete f.startlinecolor,delete f.startlinewidth);var R=x("endlinecolor",k),I=x("endlinewidth",b),F=l("endline",f.showgrid||!!R||!!I);return F||(delete f.endlinecolor,delete f.endlinewidth),P?(l("minorgridcount"),l("minorgridwidth",b),l("minorgriddash",_),l("minorgridcolor",d(h,.06)),f.minorgridcount||(delete f.minorgridwidth,delete f.minorgriddash,delete f.minorgridcolor)):(delete f.gridcolor,delete f.gridwidth,delete f.griddash),f.showticklabels==="none"&&(delete f.tickfont,delete f.tickangle,delete f.showexponent,delete f.exponentformat,delete f.minexponent,delete f.tickformat,delete f.showticksuffix,delete f.showtickprefix),f.showticksuffix||delete f.ticksuffix,f.showtickprefix||delete f.tickprefix,l("tickmode"),f};function a(s,f){if(s.type==="-"){var v=s._id,g=v.charAt(0),m=g+"calendar",w=s[m];s.type=o(f,w,{autotypenumbers:s.autotypenumbers})}}}),kL=Vt((K,V)=>{var u=TL(),d=cl();V.exports=function(A,t,e,r,i){var n=r("a");n||(r("da"),r("a0"));var o=r("b");o||(r("db"),r("b0")),E(A,t,e,i)};function E(A,t,e,r){var i=["aaxis","baxis"];i.forEach(function(n){var o=n.charAt(0),a=A[n]||{},s=d.newContainer(t,n),f={noAutotickangles:!0,noTicklabelshift:!0,noTicklabelstandoff:!0,noTicklabelstep:!0,tickfont:"x",id:o+"axis",letter:o,font:t.font,name:n,data:A[o],calendar:t.calendar,dfltColor:r,bgColor:e.paper_bgcolor,autotypenumbersDflt:e.autotypenumbers,fullLayout:e};u(a,s,f),s._categories=s._categories||[],!A[n]&&a.type!=="-"&&(A[n]={type:a.type})})}}),AL=Vt((K,V)=>{var u=Xr(),d=wL(),E=kL(),A=n_(),t=af();V.exports=function(e,r,i,n){function o(f,v){return u.coerce(e,r,A,f,v)}r._clipPathId="clip"+r.uid+"carpet";var a=o("color",t.defaultLine);if(u.coerceFont(o,"font",n.font),o("carpet"),E(e,r,n,o,a),!r.a||!r.b){r.visible=!1;return}r.a.length<3&&(r.aaxis.smoothing=0),r.b.length<3&&(r.baxis.smoothing=0);var s=d(e,r,o);s||(r.visible=!1),r._cheater&&o("cheaterslope"),o("zorder")}}),J5=Vt((K,V)=>{var u=Xr().isArrayOrTypedArray;V.exports=function(d,E,A){var t;for(u(d)?d.length>E.length&&(d=d.slice(0,E.length)):d=[],t=0;t{V.exports=function(u,d,E){if(u.length===0)return"";var A,t=[],e=E?3:1;for(A=0;A{V.exports=function(u,d,E,A,t,e){var r=t[0]*u.dpdx(d),i=t[1]*u.dpdy(E),n=1,o=1;if(e){var a=Math.sqrt(t[0]*t[0]+t[1]*t[1]),s=Math.sqrt(e[0]*e[0]+e[1]*e[1]),f=(t[0]*e[0]+t[1]*e[1])/a/s;o=Math.max(0,f)}var v=Math.atan2(i,r)*180/Math.PI;return v<-90?(v+=180,n=-n):v>90&&(v-=180,n=-n),{angle:v,flip:n,p:u.c2p(A,d,E),offsetMultplier:o}}}),SL=Vt((K,V)=>{var u=Ni(),d=Eo(),E=J5(),A=Q5(),t=ML(),e=Dl(),r=Xr(),i=r.strRotate,n=r.strTranslate,o=gf();V.exports=function(l,x,y,S){var k=l._context.staticPlot,M=x.xaxis,T=x.yaxis,c=l._fullLayout,h=c._clips;r.makeTraceGroups(S,y,"trace").each(function(b){var _=u.select(this),P=b[0],z=P.trace,D=z.aaxis,B=z.baxis,R=r.ensureSingle(_,"g","minorlayer"),I=r.ensureSingle(_,"g","majorlayer"),F=r.ensureSingle(_,"g","boundarylayer"),j=r.ensureSingle(_,"g","labellayer");_.style("opacity",z.opacity),s(M,T,I,D,"a",D._gridlines,!0),s(M,T,I,B,"b",B._gridlines,!0),s(M,T,R,D,"a",D._minorgridlines,!0),s(M,T,R,B,"b",B._minorgridlines,!0),s(M,T,F,D,"a-boundary",D._boundarylines,k),s(M,T,F,B,"b-boundary",B._boundarylines,k);var N=f(l,M,T,z,P,j,D._labels,"a-label"),G=f(l,M,T,z,P,j,B._labels,"b-label");v(l,j,z,P,M,T,N,G),a(z,P,h,M,T)})};function a(l,x,y,S,k){var M,T,c,h,b=y.select("#"+l._clipPathId);b.size()||(b=y.append("clipPath").classed("carpetclip",!0));var _=r.ensureSingle(b,"path","carpetboundary"),P=x.clipsegments,z=[];for(h=0;h0?"start":"end","data-notex":1}).call(d.font,P.font).text(P.text).call(e.convertToTspans,l),F=d.bBox(this);I.attr("transform",n(D.p[0],D.p[1])+i(D.angle)+n(P.axis.labelpadding*R,F.height*.3)),b=Math.max(b,F.width+P.axis.labelpadding)}),h.exit().remove(),_.maxExtent=b,_}function v(l,x,y,S,k,M,T,c){var h,b,_,P,z=r.aggNums(Math.min,null,y.a),D=r.aggNums(Math.max,null,y.a),B=r.aggNums(Math.min,null,y.b),R=r.aggNums(Math.max,null,y.b);h=.5*(z+D),b=B,_=y.ab2xy(h,b,!0),P=y.dxyda_rough(h,b),T.angle===void 0&&r.extendFlat(T,t(y,k,M,_,y.dxydb_rough(h,b))),w(l,x,y,S,_,P,y.aaxis,k,M,T,"a-title"),h=z,b=.5*(B+R),_=y.ab2xy(h,b,!0),P=y.dxydb_rough(h,b),c.angle===void 0&&r.extendFlat(c,t(y,k,M,_,y.dxyda_rough(h,b))),w(l,x,y,S,_,P,y.baxis,k,M,c,"b-title")}var g=o.LINE_SPACING,m=(1-o.MID_SHIFT)/g+1;function w(l,x,y,S,k,M,T,c,h,b,_){var P=[];T.title.text&&P.push(T.title.text);var z=x.selectAll("text."+_).data(P),D=b.maxExtent;z.enter().append("text").classed(_,!0),z.each(function(){var B=t(y,c,h,k,M);["start","both"].indexOf(T.showticklabels)===-1&&(D=0);var R=T.title.font.size;D+=R+T.title.offset;var I=b.angle+(b.flip<0?180:0),F=(I-B.angle+450)%360,j=F>90&&F<270,N=u.select(this);N.text(T.title.text).call(e.convertToTspans,l),j&&(D=(-e.lineCount(N)+m)*g*R-D),N.attr("transform",n(B.p[0],B.p[1])+i(B.angle)+n(0,D)).attr("text-anchor","middle").call(d.font,T.title.font)}),z.exit().remove()}}),EL=Vt((K,V)=>{var u=Xr().isArrayOrTypedArray;V.exports=function(d,E,A){var t,e,r,i,n,o,a=[],s=u(d)?d.length:d,f=u(E)?E.length:E,v=u(d)?d:null,g=u(E)?E:null;v&&(r=(v.length-1)/(v[v.length-1]-v[0])/(s-1)),g&&(i=(g.length-1)/(g[g.length-1]-g[0])/(f-1));var m,w=1/0,l=-1/0;for(e=0;e{var u=Xr().isArrayOrTypedArray;V.exports=function(E){return d(E,0)};function d(E,A){if(!u(E)||A>=10)return null;for(var t=1/0,e=-1/0,r=E.length,i=0;i{var u=yo(),d=So().extendFlat;V.exports=function(E,A,t){var e,r,i,n,o,a,s,f,v,g,m,w,l,x,y=E["_"+A],S=E[A+"axis"],k=S._gridlines=[],M=S._minorgridlines=[],T=S._boundarylines=[],c=E["_"+t],h=E[t+"axis"];S.tickmode==="array"&&(S.tickvals=y.slice());var b=E._xctrl,_=E._yctrl,P=b[0].length,z=b.length,D=E._a.length,B=E._b.length;u.prepTicks(S),S.tickmode==="array"&&delete S.tickvals;var R=S.smoothing?3:1;function I(j){var N,G,rt,ct,st,et,Z,ot,X,Q,ut,J,q=[],it=[],nt={};if(A==="b")for(G=E.b2j(j),rt=Math.floor(Math.max(0,Math.min(B-2,G))),ct=G-rt,nt.length=B,nt.crossLength=D,nt.xy=function(dt){return E.evalxy([],dt,G)},nt.dxy=function(dt,Tt){return E.dxydi([],dt,rt,Tt,ct)},N=0;N0&&(X=E.dxydi([],N-1,rt,0,ct),q.push(st[0]+X[0]/3),it.push(st[1]+X[1]/3),Q=E.dxydi([],N-1,rt,1,ct),q.push(ot[0]-Q[0]/3),it.push(ot[1]-Q[1]/3)),q.push(ot[0]),it.push(ot[1]),st=ot;else for(N=E.a2i(j),et=Math.floor(Math.max(0,Math.min(D-2,N))),Z=N-et,nt.length=D,nt.crossLength=B,nt.xy=function(dt){return E.evalxy([],N,dt)},nt.dxy=function(dt,Tt){return E.dxydj([],et,dt,Z,Tt)},G=0;G0&&(ut=E.dxydj([],et,G-1,Z,0),q.push(st[0]+ut[0]/3),it.push(st[1]+ut[1]/3),J=E.dxydj([],et,G-1,Z,1),q.push(ot[0]-J[0]/3),it.push(ot[1]-J[1]/3)),q.push(ot[0]),it.push(ot[1]),st=ot;return nt.axisLetter=A,nt.axis=S,nt.crossAxis=h,nt.value=j,nt.constvar=t,nt.index=f,nt.x=q,nt.y=it,nt.smoothing=h.smoothing,nt}function F(j){var N,G,rt,ct,st,et=[],Z=[],ot={};if(ot.length=y.length,ot.crossLength=c.length,A==="b")for(rt=Math.max(0,Math.min(B-2,j)),st=Math.min(1,Math.max(0,j-rt)),ot.xy=function(X){return E.evalxy([],X,j)},ot.dxy=function(X,Q){return E.dxydi([],X,rt,Q,st)},N=0;Ny.length-1)&&k.push(d(F(r),{color:S.gridcolor,width:S.gridwidth,dash:S.griddash}));for(f=a;fy.length-1)&&!(m<0||m>y.length-1))for(w=y[i],l=y[m],e=0;ey[y.length-1])&&M.push(d(I(g),{color:S.minorgridcolor,width:S.minorgridwidth,dash:S.minorgriddash})));S.startline&&T.push(d(F(0),{color:S.startlinecolor,width:S.startlinewidth})),S.endline&&T.push(d(F(y.length-1),{color:S.endlinecolor,width:S.endlinewidth}))}else{for(n=5e-15,o=[Math.floor((y[y.length-1]-S.tick0)/S.dtick*(1+n)),Math.ceil((y[0]-S.tick0)/S.dtick/(1+n))].sort(function(j,N){return j-N}),a=o[0],s=o[1],f=a;f<=s;f++)v=S.tick0+S.dtick*f,k.push(d(I(v),{color:S.gridcolor,width:S.gridwidth,dash:S.griddash}));for(f=a-1;fy[y.length-1])&&M.push(d(I(g),{color:S.minorgridcolor,width:S.minorgridwidth,dash:S.minorgriddash}));S.startline&&T.push(d(I(y[0]),{color:S.startlinecolor,width:S.startlinewidth})),S.endline&&T.push(d(I(y[y.length-1]),{color:S.endlinecolor,width:S.endlinewidth}))}}}),CL=Vt((K,V)=>{var u=yo(),d=So().extendFlat;V.exports=function(E,A){var t,e,r,i,n,o=A._labels=[],a=A._gridlines;for(t=0;t{V.exports=function(u,d,E,A){var t,e,r,i=[],n=!!E.smoothing,o=!!A.smoothing,a=u[0].length-1,s=u.length-1;for(t=0,e=[],r=[];t<=a;t++)e[t]=u[0][t],r[t]=d[0][t];for(i.push({x:e,y:r,bicubic:n}),t=0,e=[],r=[];t<=s;t++)e[t]=u[t][a],r[t]=d[t][a];for(i.push({x:e,y:r,bicubic:o}),t=a,e=[],r=[];t>=0;t--)e[a-t]=u[s][t],r[a-t]=d[s][t];for(i.push({x:e,y:r,bicubic:n}),t=s,e=[],r=[];t>=0;t--)e[s-t]=u[t][0],r[s-t]=d[t][0];return i.push({x:e,y:r,bicubic:o}),i}}),PL=Vt((K,V)=>{var u=Xr();V.exports=function(d,E,A){var t,e,r,i=[],n=[],o=d[0].length,a=d.length;function s(G,rt){var ct=0,st,et=0;return G>0&&(st=d[rt][G-1])!==void 0&&(et++,ct+=st),G0&&(st=d[rt-1][G])!==void 0&&(et++,ct+=st),rt0&&e0&&tc);return u.log("Smoother converged to",h,"after",_,"iterations"),d}}),OL=Vt((K,V)=>{V.exports={RELATIVE_CULL_TOLERANCE:1e-6}}),DL=Vt((K,V)=>{var u=.5;V.exports=function(d,E,A,t){var e=d[0]-E[0],r=d[1]-E[1],i=A[0]-E[0],n=A[1]-E[1],o=Math.pow(e*e+r*r,u/2),a=Math.pow(i*i+n*n,u/2),s=(a*a*e-o*o*i)*t,f=(a*a*r-o*o*n)*t,v=a*(o+a)*3,g=o*(o+a)*3;return[[E[0]+(v&&s/v),E[1]+(v&&f/v)],[E[0]-(g&&s/g),E[1]-(g&&f/g)]]}}),FL=Vt((K,V)=>{var u=DL(),d=Xr().ensureArray;function E(A,t,e){var r=-.5*e[0]+1.5*t[0],i=-.5*e[1]+1.5*t[1];return[(2*r+A[0])/3,(2*i+A[1])/3]}V.exports=function(A,t,e,r,i,n){var o,a,s,f,v,g,m,w,l,x,y=e[0].length,S=e.length,k=i?3*y-2:y,M=n?3*S-2:S;for(A=d(A,M),t=d(t,M),s=0;s{V.exports=function(u,d,E,A,t){var e=d-2,r=E-2;return A&&t?function(i,n,o){i||(i=[]);var a,s,f,v,g,m,w=Math.max(0,Math.min(Math.floor(n),e)),l=Math.max(0,Math.min(Math.floor(o),r)),x=Math.max(0,Math.min(1,n-w)),y=Math.max(0,Math.min(1,o-l));w*=3,l*=3;var S=x*x,k=S*x,M=1-x,T=M*M,c=T*M,h=y*y,b=h*y,_=1-y,P=_*_,z=P*_;for(m=0;m{V.exports=function(u,d,E){return d&&E?function(A,t,e,r,i){A||(A=[]);var n,o,a,s,f,v;t*=3,e*=3;var g=r*r,m=1-r,w=m*m,l=m*r*2,x=-3*w,y=3*(w-l),S=3*(l-g),k=3*g,M=i*i,T=M*i,c=1-i,h=c*c,b=h*c;for(v=0;v{V.exports=function(u,d,E){return d&&E?function(A,t,e,r,i){A||(A=[]);var n,o,a,s,f,v;t*=3,e*=3;var g=r*r,m=g*r,w=1-r,l=w*w,x=l*w,y=i*i,S=1-i,k=S*S,M=S*i*2,T=-3*k,c=3*(k-M),h=3*(M-y),b=3*y;for(v=0;v{var u=OL(),d=Vy().findBin,E=FL(),A=BL(),t=RL(),e=NL();V.exports=function(r){var i=r._a,n=r._b,o=i.length,a=n.length,s=r.aaxis,f=r.baxis,v=i[0],g=i[o-1],m=n[0],w=n[a-1],l=i[i.length-1]-i[0],x=n[n.length-1]-n[0],y=l*u.RELATIVE_CULL_TOLERANCE,S=x*u.RELATIVE_CULL_TOLERANCE;v-=y,g+=y,m-=S,w+=S,r.isVisible=function(k,M){return k>v&&km&&Mg||Mw},r.setScale=function(){var k=r._x,M=r._y,T=E(r._xctrl,r._yctrl,k,M,s.smoothing,f.smoothing);r._xctrl=T[0],r._yctrl=T[1],r.evalxy=A([r._xctrl,r._yctrl],o,a,s.smoothing,f.smoothing),r.dxydi=t([r._xctrl,r._yctrl],s.smoothing,f.smoothing),r.dxydj=e([r._xctrl,r._yctrl],s.smoothing,f.smoothing)},r.i2a=function(k){var M=Math.max(0,Math.floor(k[0]),o-2),T=k[0]-M;return(1-T)*i[M]+T*i[M+1]},r.j2b=function(k){var M=Math.max(0,Math.floor(k[1]),o-2),T=k[1]-M;return(1-T)*n[M]+T*n[M+1]},r.ij2ab=function(k){return[r.i2a(k[0]),r.j2b(k[1])]},r.a2i=function(k){var M=Math.max(0,Math.min(d(k,i),o-2)),T=i[M],c=i[M+1];return Math.max(0,Math.min(o-1,M+(k-T)/(c-T)))},r.b2j=function(k){var M=Math.max(0,Math.min(d(k,n),a-2)),T=n[M],c=n[M+1];return Math.max(0,Math.min(a-1,M+(k-T)/(c-T)))},r.ab2ij=function(k){return[r.a2i(k[0]),r.b2j(k[1])]},r.i2c=function(k,M){return r.evalxy([],k,M)},r.ab2xy=function(k,M,T){if(!T&&(ki[o-1]|Mn[a-1]))return[!1,!1];var c=r.a2i(k),h=r.b2j(M),b=r.evalxy([],c,h);if(T){var _=0,P=0,z=[],D,B,R,I;ki[o-1]?(D=o-2,B=1,_=(k-i[o-1])/(i[o-1]-i[o-2])):(D=Math.max(0,Math.min(o-2,Math.floor(c))),B=c-D),Mn[a-1]?(R=a-2,I=1,P=(M-n[a-1])/(n[a-1]-n[a-2])):(R=Math.max(0,Math.min(a-2,Math.floor(h))),I=h-R),_&&(r.dxydi(z,D,R,B,I),b[0]+=z[0]*_,b[1]+=z[1]*_),P&&(r.dxydj(z,D,R,B,I),b[0]+=z[0]*P,b[1]+=z[1]*P)}return b},r.c2p=function(k,M,T){return[M.c2p(k[0]),T.c2p(k[1])]},r.p2x=function(k,M,T){return[M.p2c(k[0]),T.p2c(k[1])]},r.dadi=function(k){var M=Math.max(0,Math.min(i.length-2,k));return i[M+1]-i[M]},r.dbdj=function(k){var M=Math.max(0,Math.min(n.length-2,k));return n[M+1]-n[M]},r.dxyda=function(k,M,T,c){var h=r.dxydi(null,k,M,T,c),b=r.dadi(k,T);return[h[0]/b,h[1]/b]},r.dxydb=function(k,M,T,c){var h=r.dxydj(null,k,M,T,c),b=r.dbdj(M,c);return[h[0]/b,h[1]/b]},r.dxyda_rough=function(k,M,T){var c=l*(T||.1),h=r.ab2xy(k+c,M,!0),b=r.ab2xy(k-c,M,!0);return[(h[0]-b[0])*.5/c,(h[1]-b[1])*.5/c]},r.dxydb_rough=function(k,M,T){var c=x*(T||.1),h=r.ab2xy(k,M+c,!0),b=r.ab2xy(k,M-c,!0);return[(h[0]-b[0])*.5/c,(h[1]-b[1])*.5/c]},r.dpdx=function(k){return k._m},r.dpdy=function(k){return k._m}}}),UL=Vt((K,V)=>{var u=yo(),d=Xr().isArray1D,E=EL(),A=zL(),t=LL(),e=CL(),r=IL(),i=b1(),n=PL(),o=_1(),a=jL();V.exports=function(s,f){var v=u.getFromId(s,f.xaxis),g=u.getFromId(s,f.yaxis),m=f.aaxis,w=f.baxis,l=f.x,x=f.y,y=[];l&&d(l)&&y.push("x"),x&&d(x)&&y.push("y"),y.length&&o(f,m,w,"a","b",y);var S=f._a=f._a||f.a,k=f._b=f._b||f.b;l=f._x||f.x,x=f._y||f.y;var M={};if(f._cheater){var T=m.cheatertype==="index"?S.length:S,c=w.cheatertype==="index"?k.length:k;l=E(T,c,f.cheaterslope)}f._x=l=i(l),f._y=x=i(x),n(l,S,k),n(x,S,k),a(f),f.setScale();var h=A(l),b=A(x),_=.5*(h[1]-h[0]),P=.5*(h[1]+h[0]),z=.5*(b[1]-b[0]),D=.5*(b[1]+b[0]),B=1.3;return h=[P-_*B,P+_*B],b=[D-z*B,D+z*B],f._extremes[v._id]=u.findExtremes(v,h,{padded:!0}),f._extremes[g._id]=u.findExtremes(g,b,{padded:!0}),t(f,"a","b"),t(f,"b","a"),e(f,m),e(f,w),M.clipsegments=r(f._xctrl,f._yctrl,m,w),M.x=l,M.y=x,M.a=S,M.b=k,[M]}}),VL=Vt((K,V)=>{V.exports={attributes:n_(),supplyDefaults:AL(),plot:SL(),calc:UL(),animatable:!0,isContainer:!0,moduleType:"trace",name:"carpet",basePlotModule:Yc(),categories:["cartesian","svg","carpet","carpetAxis","notLegendIsolatable","noMultiCategory","noHover","noSortingByValue"],meta:{}}}),HL=Vt((K,V)=>{V.exports=VL()}),t4=Vt((K,V)=>{var u=Jh(),d=dc(),E=kl(),{hovertemplateAttrs:A,texttemplateAttrs:t,templatefallbackAttrs:e}=yl(),r=Wl(),i=So().extendFlat,n=d.marker,o=d.line,a=n.line;V.exports={carpet:{valType:"string",editType:"calc"},a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},mode:i({},d.mode,{dflt:"markers"}),text:i({},d.text,{}),texttemplate:t({editType:"plot"},{keys:["a","b","text"]}),texttemplatefallback:e({editType:"plot"}),hovertext:i({},d.hovertext,{}),line:{color:o.color,width:o.width,dash:o.dash,backoff:o.backoff,shape:i({},o.shape,{values:["linear","spline"]}),smoothing:o.smoothing,editType:"calc"},connectgaps:d.connectgaps,fill:i({},d.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:u(),marker:i({symbol:n.symbol,opacity:n.opacity,maxdisplayed:n.maxdisplayed,angle:n.angle,angleref:n.angleref,standoff:n.standoff,size:n.size,sizeref:n.sizeref,sizemin:n.sizemin,sizemode:n.sizemode,line:i({width:a.width,editType:"calc"},r("marker.line")),gradient:n.gradient,editType:"calc"},r("marker")),textfont:d.textfont,textposition:d.textposition,selected:d.selected,unselected:d.unselected,hoverinfo:i({},E.hoverinfo,{flags:["a","b","text","name"]}),hoveron:d.hoveron,hovertemplate:A(),hovertemplatefallback:e(),zorder:d.zorder}}),qL=Vt((K,V)=>{var u=Xr(),d=vp(),E=nu(),A=Lh(),t=Bh(),e=Sm(),r=Rh(),i=tp(),n=t4();V.exports=function(o,a,s,f){function v(S,k){return u.coerce(o,a,n,S,k)}v("carpet"),a.xaxis="x",a.yaxis="y";var g=v("a"),m=v("b"),w=Math.min(g.length,m.length);if(!w){a.visible=!1;return}a._length=w,v("text"),v("texttemplate"),v("texttemplatefallback"),v("hovertext");var l=w{V.exports=function(u,d){var E={},A=d._carpet,t=A.ab2ij([u.a,u.b]),e=Math.floor(t[0]),r=t[0]-e,i=Math.floor(t[1]),n=t[1]-i,o=A.evalxy([],e,i,r,n);return E.yLabel=o[1].toFixed(3),E}}),a_=Vt((K,V)=>{V.exports=function(u,d){for(var E=u._fullData.length,A,t=0;t{var u=Lo(),d=Nh(),E=yp(),A=jh(),t=Uh().calcMarkerSize,e=a_();V.exports=function(r,i){var n=i._carpetTrace=e(r,i);if(!(!n||!n.visible||n.visible==="legendonly")){var o;i.xaxis=n.xaxis,i.yaxis=n.yaxis;var a=i._length,s=new Array(a),f,v,g=!1;for(o=0;o{var u=Em(),d=yo(),E=Eo();V.exports=function(A,t,e,r){var i,n,o,a=e[0][0].carpet,s=d.getFromId(A,a.xaxis||"x"),f=d.getFromId(A,a.yaxis||"y"),v={xaxis:s,yaxis:f,plot:t.plot};for(i=0;i{var u=Lm(),d=Xr().fillText;V.exports=function(E,A,t,e){var r=u(E,A,t,e);if(!r||r[0].index===!1)return;var i=r[0];if(i.index===void 0){var n=1-i.y0/E.ya._length,o=E.xa._length,a=o*n/2,s=o-a;return i.x0=Math.max(Math.min(i.x0,s),a),i.x1=Math.max(Math.min(i.x1,s),a),r}var f=i.cd[i.index];i.a=f.a,i.b=f.b,i.xLabelVal=void 0,i.yLabelVal=void 0;var v=i.trace,g=v._carpet,m=v._module.formatLabels(f,v);i.yLabel=m.yLabel,delete i.text;var w=[];function l(S,k){var M;S.labelprefix&&S.labelprefix.length>0?M=S.labelprefix.replace(/ = $/,""):M=S._hovertitle,w.push(M+": "+k.toFixed(3)+S.labelsuffix)}if(!v.hovertemplate){var x=f.hi||v.hoverinfo,y=x.split("+");y.indexOf("all")!==-1&&(y=["a","b","text"]),y.indexOf("a")!==-1&&l(g.aaxis,f.a),y.indexOf("b")!==-1&&l(g.baxis,f.b),w.push("y: "+i.yLabel),y.indexOf("text")!==-1&&d(f,v,w),i.extraText=w.join("
          ")}return r}}),YL=Vt((K,V)=>{V.exports=function(u,d,E,A,t){var e=A[t];return u.a=e.a,u.b=e.b,u.y=e.y,u}}),XL=Vt((K,V)=>{V.exports={attributes:t4(),supplyDefaults:qL(),colorbar:Zf(),formatLabels:WL(),calc:GL(),plot:ZL(),style:gh().style,styleOnSelect:gh().styleOnSelect,hoverPoints:KL(),selectPoints:Cm(),eventData:YL(),moduleType:"trace",name:"scattercarpet",basePlotModule:Yc(),categories:["svg","carpet","symbols","showLegend","carpetDependent","zoomScale"],meta:{}}}),$L=Vt((K,V)=>{V.exports=XL()}),e4=Vt((K,V)=>{var u=Om(),d=ev(),E=Wl(),A=So().extendFlat,t=d.contours;V.exports=A({carpet:{valType:"string",editType:"calc"},z:u.z,a:u.x,a0:u.x0,da:u.dx,b:u.y,b0:u.y0,db:u.dy,text:u.text,hovertext:u.hovertext,transpose:u.transpose,atype:u.xtype,btype:u.ytype,fillcolor:d.fillcolor,autocontour:d.autocontour,ncontours:d.ncontours,contours:{type:t.type,start:t.start,end:t.end,size:t.size,coloring:{valType:"enumerated",values:["fill","lines","none"],dflt:"fill",editType:"calc"},showlines:t.showlines,showlabels:t.showlabels,labelfont:t.labelfont,labelformat:t.labelformat,operation:t.operation,value:t.value,editType:"calc",impliedEdits:{autocontour:!1}},line:{color:d.line.color,width:d.line.width,dash:d.line.dash,smoothing:d.line.smoothing,editType:"plot"},zorder:d.zorder},E("",{cLetter:"z",autoColorDflt:!1}))}),r4=Vt((K,V)=>{var u=Xr(),d=x1(),E=e4(),A=S2(),t=P1(),e=O1();V.exports=function(r,i,n,o){function a(g,m){return u.coerce(r,i,E,g,m)}function s(g){return u.coerce2(r,i,E,g)}if(a("carpet"),r.a&&r.b){var f=d(r,i,a,o,"a","b");if(!f){i.visible=!1;return}a("text");var v=a("contours.type")==="constraint";v?A(r,i,a,o,n,{hasHover:!1}):(t(r,i,a,s),e(r,i,a,o,{hasHover:!1}))}else i._defaultColor=n,i._length=null;a("zorder")}}),JL=Vt((K,V)=>{var u=ih(),d=Xr(),E=_1(),A=b1(),t=w1(),e=T1(),r=f2(),i=r4(),n=a_(),o=y2();V.exports=function(s,f){var v=f._carpetTrace=n(s,f);if(!(!v||!v.visible||v.visible==="legendonly")){if(!f.a||!f.b){var g=s.data[v.index],m=s.data[f.index];m.a||(m.a=g.a),m.b||(m.b=g.b),i(m,f,f._defaultColor,s._fullLayout)}var w=a(s,f);return o(f,f._z),w}};function a(s,f){var v=f._carpetTrace,g=v.aaxis,m=v.baxis,w,l,x,y,S,k,M;g._minDtick=0,m._minDtick=0,d.isArray1D(f.z)&&E(f,g,m,"a","b",["z"]),w=f._a=f._a||f.a,y=f._b=f._b||f.b,w=w?g.makeCalcdata(f,"_a"):[],y=y?m.makeCalcdata(f,"_b"):[],l=f.a0||0,x=f.da||1,S=f.b0||0,k=f.db||1,M=f._z=A(f._z||f.z,f.transpose),f._emptypoints=e(M),t(M,f._emptypoints);var T=d.maxRowLength(M),c=f.xtype==="scaled"?"":w,h=r(f,c,l,x,T,g),b=f.ytype==="scaled"?"":y,_=r(f,b,S,k,M.length,m),P={a:h,b:_,z:M};return f.contours.type==="levels"&&f.contours.coloring!=="none"&&u(s,f,{vals:M,containerStr:"",cLetter:"z"}),[P]}}),QL=Vt((K,V)=>{var u=Xr().isArrayOrTypedArray;V.exports=function(d,E,A,t){var e,r,i,n,o,a,s,f,v,g,m,w,l,x=u(A)?"a":"b",y=x==="a"?d.aaxis:d.baxis,S=y.smoothing,k=x==="a"?d.a2i:d.b2j,M=x==="a"?A:t,T=x==="a"?t:A,c=x==="a"?E.a.length:E.b.length,h=x==="a"?E.b.length:E.a.length,b=Math.floor(x==="a"?d.b2j(T):d.a2i(T)),_=x==="a"?function(ct){return d.evalxy([],ct,b)}:function(ct){return d.evalxy([],b,ct)};S&&(i=Math.max(0,Math.min(h-2,b)),n=b-i,r=x==="a"?function(ct,st){return d.dxydi([],ct,i,st,n)}:function(ct,st){return d.dxydj([],i,ct,n,st)});var P=k(M[0]),z=k(M[1]),D=P0?Math.floor:Math.ceil,I=D>0?Math.ceil:Math.floor,F=D>0?Math.min:Math.max,j=D>0?Math.max:Math.min,N=R(P+B),G=I(z-B);s=_(P);var rt=[[s]];for(e=N;e*D{var u=Ni(),d=J5(),E=Q5(),A=Eo(),t=Xr(),e=_2(),r=b2(),i=D1(),n=nv(),o=T2(),a=w2(),s=k2(),f=a_(),v=QL();V.exports=function(T,c,h,b){var _=c.xaxis,P=c.yaxis;t.makeTraceGroups(b,h,"contour").each(function(z){var D=u.select(this),B=z[0],R=B.trace,I=R._carpetTrace=f(T,R),F=T.calcdata[I.index][0];if(!I.visible||I.visible==="legendonly")return;var j=B.a,N=B.b,G=R.contours,rt=a(G,c,B),ct=G.type==="constraint",st=G._operation,et=ct?st==="="?"lines":"fill":G.coloring;function Z(wt){var Ct=I.ab2xy(wt[0],wt[1],!0);return[_.c2p(Ct[0]),P.c2p(Ct[1])]}var ot=[[j[0],N[N.length-1]],[j[j.length-1],N[N.length-1]],[j[j.length-1],N[0]],[j[0],N[0]]];e(rt);var X=(j[j.length-1]-j[0])*1e-8,Q=(N[N.length-1]-N[0])*1e-8;r(rt,X,Q);var ut=rt;G.type==="constraint"&&(ut=o(rt,st)),g(rt,Z);var J,q,it,nt,dt=[];for(nt=F.clipsegments.length-1;nt>=0;nt--)J=F.clipsegments[nt],q=d([],J.x,_.c2p),it=d([],J.y,P.c2p),q.reverse(),it.reverse(),dt.push(E(q,it,J.bicubic));var Tt="M"+dt.join("L")+"Z";S(D,F.clipsegments,_,P,ct,et),k(R,D,_,P,ut,ot,Z,I,F,et,Tt),m(D,rt,T,B,G,c,I),A.setClipUrl(D,I._clipPathId,T)})};function g(T,c){var h,b,_,P,z,D,B,R,I;for(h=0;hct&&(b.max=ct),b.len=b.max-b.min}function l(T,c,h){var b=T.getPointAtLength(c),_=T.getPointAtLength(h),P=_.x-b.x,z=_.y-b.y,D=Math.sqrt(P*P+z*z);return[P/D,z/D]}function x(T){var c=Math.sqrt(T[0]*T[0]+T[1]*T[1]);return[T[0]/c,T[1]/c]}function y(T,c){var h=Math.abs(T[0]*c[0]+T[1]*c[1]),b=Math.sqrt(1-h*h);return b/h}function S(T,c,h,b,_,P){var z,D,B,R,I=t.ensureSingle(T,"g","contourbg"),F=I.selectAll("path").data(P==="fill"&&!_?[0]:[]);F.enter().append("path"),F.exit().remove();var j=[];for(R=0;R=0&&(N=it,rt=ct):Math.abs(j[1]-N[1])=0&&(N=it,rt=ct):t.log("endpt to newendpt is not vert. or horz.",j,N,it)}if(rt>=0)break;R+=J(j,N),j=N}if(rt===c.edgepaths.length){t.log("unclosed perimeter path");break}B=rt,F=I.indexOf(B)===-1,F&&(B=I[0],R+=J(j,N)+"Z",j=null)}for(B=0;B{V.exports={attributes:e4(),supplyDefaults:r4(),colorbar:B1(),calc:JL(),plot:tC(),style:F1(),moduleType:"trace",name:"contourcarpet",basePlotModule:Yc(),categories:["cartesian","svg","carpet","contour","symbols","showLegend","hasLines","carpetDependent","noHover","noSortingByValue"],meta:{}}}),rC=Vt((K,V)=>{V.exports=eC()}),i_=Vt((K,V)=>{var u=Xr().extendFlat,d=dc(),E=hc().axisHoverFormat,{hovertemplateAttrs:A,templatefallbackAttrs:t}=yl(),e=If().dash,r=vm(),i=Dm(),n=i.INCREASING.COLOR,o=i.DECREASING.COLOR,a=d.line;function s(f){return{line:{color:u({},a.color,{dflt:f}),width:a.width,dash:e,editType:"style"},editType:"style"}}V.exports={xperiod:d.xperiod,xperiod0:d.xperiod0,xperiodalignment:d.xperiodalignment,xhoverformat:E("x"),yhoverformat:E("y"),x:{valType:"data_array",editType:"calc+clearAxisTypes"},open:{valType:"data_array",editType:"calc"},high:{valType:"data_array",editType:"calc"},low:{valType:"data_array",editType:"calc"},close:{valType:"data_array",editType:"calc"},line:{width:u({},a.width,{}),dash:u({},e,{}),editType:"style"},increasing:s(n),decreasing:s(o),text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertemplate:A({},{keys:["open","high","low","close"]}),hovertemplatefallback:t(),tickwidth:{valType:"number",min:0,max:.5,dflt:.3,editType:"calc"},hoverlabel:u({},r.hoverlabel,{split:{valType:"boolean",dflt:!1,editType:"style"}}),zorder:d.zorder}}),n4=Vt((K,V)=>{var u=ji(),d=Xr();V.exports=function(E,A,t,e){var r=t("x"),i=t("open"),n=t("high"),o=t("low"),a=t("close");t("hoverlabel.split");var s=u.getComponentMethod("calendars","handleTraceDefaults");if(s(E,A,["x"],e),!!(i&&n&&o&&a)){var f=Math.min(i.length,n.length,o.length,a.length);return r&&(f=Math.min(f,d.minRowLength(r))),A._length=f,f}}}),nC=Vt((K,V)=>{var u=Xr(),d=n4(),E=Qh(),A=i_();V.exports=function(e,r,i,n){function o(s,f){return u.coerce(e,r,A,s,f)}var a=d(e,r,o,n);if(!a){r.visible=!1;return}E(e,r,n,o,{x:!0}),o("xhoverformat"),o("yhoverformat"),o("line.width"),o("line.dash"),t(e,r,o,"increasing"),t(e,r,o,"decreasing"),o("text"),o("hovertext"),o("hovertemplate"),o("hovertemplatefallback"),o("tickwidth"),n._requestRangeslider[r.xaxis]=!0,o("zorder")};function t(e,r,i,n){i(n+".line.color"),i(n+".line.width",r.line.width),i(n+".line.dash",r.line.dash)}}),a4=Vt((K,V)=>{var u=Xr(),d=u._,E=yo(),A=ep(),t=ks().BADNUM;function e(o,a){var s=E.getFromId(o,a.xaxis),f=E.getFromId(o,a.yaxis),v=n(o,s,a),g=a._minDiff;a._minDiff=null;var m=a._origX;a._origX=null;var w=a._xcalc;a._xcalc=null;var l=i(o,a,m,w,f,r);return a._extremes[s._id]=E.findExtremes(s,w,{vpad:g/2}),l.length?(u.extendFlat(l[0].t,{wHover:g/2,tickLen:v}),l):[{t:{empty:!0}}]}function r(o,a,s,f){return{o,h:a,l:s,c:f}}function i(o,a,s,f,v,g){for(var m=v.makeCalcdata(a,"open"),w=v.makeCalcdata(a,"high"),l=v.makeCalcdata(a,"low"),x=v.makeCalcdata(a,"close"),y=u.isArrayOrTypedArray(a.text),S=u.isArrayOrTypedArray(a.hovertext),k=!0,M=null,T=!!a.xperiodalignment,c=[],h=0;hM):k=D>_,M=D;var B=g(_,P,z,D);B.pos=b,B.yc=(_+D)/2,B.i=h,B.dir=k?"increasing":"decreasing",B.x=B.pos,B.y=[z,P],T&&(B.orig_p=s[h]),y&&(B.tx=a.text[h]),S&&(B.htx=a.hovertext[h]),c.push(B)}else c.push({pos:b,empty:!0})}return a._extremes[v._id]=E.findExtremes(v,u.concat(l,w),{padded:!0}),c.length&&(c[0].t={labels:{open:d(o,"open:")+" ",high:d(o,"high:")+" ",low:d(o,"low:")+" ",close:d(o,"close:")+" "}}),c}function n(o,a,s){var f=s._minDiff;if(!f){var v=o._fullData,g=[];f=1/0;var m;for(m=0;m{var u=Ni(),d=Xr();V.exports=function(E,A,t,e){var r=A.yaxis,i=A.xaxis,n=!!i.rangebreaks;d.makeTraceGroups(e,t,"trace ohlc").each(function(o){var a=u.select(this),s=o[0],f=s.t,v=s.trace;if(v.visible!==!0||f.empty){a.remove();return}var g=f.tickLen,m=a.selectAll("path").data(d.identity);m.enter().append("path"),m.exit().remove(),m.attr("d",function(w){if(w.empty)return"M0,0Z";var l=i.c2p(w.pos-g,!0),x=i.c2p(w.pos+g,!0),y=n?(l+x)/2:i.c2p(w.pos,!0),S=r.c2p(w.o,!0),k=r.c2p(w.h,!0),M=r.c2p(w.l,!0),T=r.c2p(w.c,!0);return"M"+l+","+S+"H"+y+"M"+y+","+k+"V"+M+"M"+x+","+T+"H"+y})})}}),iC=Vt((K,V)=>{var u=Ni(),d=Eo(),E=Pi();V.exports=function(A,t,e){var r=e||u.select(A).selectAll("g.ohlclayer").selectAll("g.trace");r.style("opacity",function(i){return i[0].trace.opacity}),r.each(function(i){var n=i[0].trace;u.select(this).selectAll("path").each(function(o){if(!o.empty){var a=n[o.dir].line;u.select(this).style("fill","none").call(E.stroke,a.color).call(d.dashLine,a.dash,a.width).style("opacity",n.selectedpoints&&!o.selected?.3:1)}})})}}),i4=Vt((K,V)=>{var u=yo(),d=Xr(),E=pc(),A=Pi(),t=Xr().fillText,e=Dm(),r={increasing:e.INCREASING.SYMBOL,decreasing:e.DECREASING.SYMBOL};function i(s,f,v,g){var m=s.cd,w=m[0].trace;return w.hoverlabel.split?o(s,f,v,g):a(s,f,v,g)}function n(s,f,v,g){var m=s.cd,w=s.xa,l=m[0].trace,x=m[0].t,y=l.type,S=y==="ohlc"?"l":"min",k=y==="ohlc"?"h":"max",M,T,c=x.bPos||0,h=function(G){return G.pos+c-f},b=x.bdPos||x.tickLen,_=x.wHover,P=Math.min(1,b/Math.abs(w.r2c(w.range[1])-w.r2c(w.range[0])));M=s.maxHoverDistance-P,T=s.maxSpikeDistance-P;function z(G){var rt=h(G);return E.inbox(rt-_,rt+_,M)}function D(G){var rt=G[S],ct=G[k];return rt===ct||E.inbox(rt-v,ct-v,M)}function B(G){return(z(G)+D(G))/2}var R=E.getDistanceFunction(g,z,D,B);if(E.getClosest(m,R,s),s.index===!1)return null;var I=m[s.index];if(I.empty)return null;var F=I.dir,j=l[F],N=j.line.color;return A.opacity(N)&&j.line.width?s.color=N:s.color=j.fillcolor,s.x0=w.c2p(I.pos+c-b,!0),s.x1=w.c2p(I.pos+c+b,!0),s.xLabelVal=I.orig_p!==void 0?I.orig_p:I.pos,s.spikeDistance=B(I)*T/M,s.xSpike=w.c2p(I.pos,!0),s}function o(s,f,v,g){var m=s.cd,w=s.ya,l=m[0].trace,x=m[0].t,y=[],S=n(s,f,v,g);if(!S)return[];var k=m[S.index],M=k.hi||l.hoverinfo||"";if(M==="none"||M==="skip")return[];for(var T=["high","open","close","low"],c={},h=0;h"+x.labels[b]+u.hoverLabelText(w,_,l.yhoverformat)):(z=d.extendFlat({},S),z.y0=z.y1=P,z.yLabelVal=_,z.yLabel=x.labels[b]+u.hoverLabelText(w,_,l.yhoverformat),z.name="",y.push(z),c[_]=z)}return y}function a(s,f,v,g){var m=s.cd,w=s.ya,l=m[0].trace,x=m[0].t,y=n(s,f,v,g);if(!y)return[];var S=y.index,k=m[S],M=y.index=k.i,T=k.dir;function c(B){return x.labels[B]+u.hoverLabelText(w,l[B][M],l.yhoverformat)}var h=k.hi||l.hoverinfo||"",b=h.split("+"),_=h==="all",P=_||b.indexOf("y")!==-1,z=_||b.indexOf("text")!==-1,D=P?[c("open"),c("high"),c("low"),c("close")+" "+r[T]]:[];return z&&t(k,l,D),y.extraText=D.join("
          "),y.y0=y.y1=w.c2p(k.yc,!0),[y]}V.exports={hoverPoints:i,hoverSplit:o,hoverOnPoints:a}}),o4=Vt((K,V)=>{V.exports=function(u,d){var E=u.cd,A=u.xaxis,t=u.yaxis,e=[],r,i=E[0].t.bPos||0;if(d===!1)for(r=0;r{V.exports={moduleType:"trace",name:"ohlc",basePlotModule:Yc(),categories:["cartesian","svg","showLegend"],meta:{},attributes:i_(),supplyDefaults:nC(),calc:a4().calc,plot:aC(),style:iC(),hoverPoints:i4().hoverPoints,selectPoints:o4()}}),sC=Vt((K,V)=>{V.exports=oC()}),s4=Vt((K,V)=>{var u=Xr().extendFlat,d=hc().axisHoverFormat,E=i_(),A=$g();function t(e){return{line:{color:u({},A.line.color,{dflt:e}),width:A.line.width,editType:"style"},fillcolor:A.fillcolor,editType:"style"}}V.exports={xperiod:E.xperiod,xperiod0:E.xperiod0,xperiodalignment:E.xperiodalignment,xhoverformat:d("x"),yhoverformat:d("y"),x:E.x,open:E.open,high:E.high,low:E.low,close:E.close,line:{width:u({},A.line.width,{}),editType:"style"},increasing:t(E.increasing.line.color.dflt),decreasing:t(E.decreasing.line.color.dflt),text:E.text,hovertext:E.hovertext,hovertemplate:E.hovertemplate,hovertemplatefallback:E.hovertemplatefallback,whiskerwidth:u({},A.whiskerwidth,{dflt:0}),hoverlabel:E.hoverlabel,zorder:A.zorder}}),lC=Vt((K,V)=>{var u=Xr(),d=Pi(),E=n4(),A=Qh(),t=s4();V.exports=function(r,i,n,o){function a(f,v){return u.coerce(r,i,t,f,v)}var s=E(r,i,a,o);if(!s){i.visible=!1;return}A(r,i,o,a,{x:!0}),a("xhoverformat"),a("yhoverformat"),a("line.width"),e(r,i,a,"increasing"),e(r,i,a,"decreasing"),a("text"),a("hovertext"),a("hovertemplate"),a("hovertemplatefallback"),a("whiskerwidth"),o._requestRangeslider[i.xaxis]=!0,a("zorder")};function e(r,i,n,o){var a=n(o+".line.color");n(o+".line.width",i.line.width),n(o+".fillcolor",d.addOpacity(a,.5))}}),uC=Vt((K,V)=>{var u=Xr(),d=yo(),E=ep(),A=a4().calcCommon;V.exports=function(e,r){var i=e._fullLayout,n=d.getFromId(e,r.xaxis),o=d.getFromId(e,r.yaxis),a=n.makeCalcdata(r,"x"),s=E(r,n,"x",a).vals,f=A(e,r,a,s,o,t);return f.length?(u.extendFlat(f[0].t,{num:i._numBoxes,dPos:u.distinctVals(s).minDiff/2,posLetter:"x",valLetter:"y"}),i._numBoxes++,f):[{t:{empty:!0}}]};function t(e,r,i,n){return{min:i,q1:Math.min(e,n),med:n,q3:Math.max(e,n),max:r}}}),cC=Vt((K,V)=>{V.exports={moduleType:"trace",name:"candlestick",basePlotModule:Yc(),categories:["cartesian","svg","showLegend","candlestick","boxLayout"],meta:{},attributes:s4(),layoutAttributes:Jg(),supplyLayoutDefaults:m1().supplyLayoutDefaults,crossTraceCalc:g1().crossTraceCalc,supplyDefaults:lC(),calc:uC(),plot:v1().plot,layerName:"boxlayer",style:y1().style,hoverPoints:i4().hoverPoints,selectPoints:o4()}}),fC=Vt((K,V)=>{V.exports=cC()}),l4=Vt((K,V)=>{var u=Xr(),d=gp(),E=u.deg2rad,A=u.rad2deg;V.exports=function(n,o,a){switch(d(n,a),n._id){case"x":case"radialaxis":t(n,o);break;case"angularaxis":i(n,o);break}};function t(n,o){var a=o._subplot;n.setGeometry=function(){var s=n._rl[0],f=n._rl[1],v=a.innerRadius,g=(a.radius-v)/(f-s),m=v/g,w=s>f?function(l){return l<=0}:function(l){return l>=0};n.c2g=function(l){var x=n.c2l(l)-s;return(w(x)?x:0)+m},n.g2c=function(l){return n.l2c(l+s-m)},n.g2p=function(l){return l*g},n.c2p=function(l){return n.g2p(n.c2g(l))}}}function e(n,o){return o==="degrees"?E(n):n}function r(n,o){return o==="degrees"?A(n):n}function i(n,o){var a=n.type;if(a==="linear"){var s=n.d2c,f=n.c2d;n.d2c=function(v,g){return e(s(v),g)},n.c2d=function(v,g){return f(r(v,g))}}n.makeCalcdata=function(v,g){var m=v[g],w=v._length,l,x,y=function(c){return n.d2c(c,v.thetaunit)};if(m)for(l=new Array(w),x=0;x{V.exports={attr:"subplot",name:"polar",axisNames:["angularaxis","radialaxis"],axisName2dataArray:{angularaxis:"theta",radialaxis:"r"},layerNames:["draglayer","plotbg","backplot","angular-grid","radial-grid","frontplot","angular-line","radial-line","angular-axis","radial-axis"],radialDragBoxSize:50,angularDragBoxSize:30,cornerLen:25,cornerHalfWidth:2,MINDRAG:8,MINZOOM:20,OFFEDGE:20}}),s_=Vt((K,V)=>{var u=Xr(),d=qg().tester,E=u.findIndexOfMin,A=u.isAngleInsideSector,t=u.angleDelta,e=u.angleDist;function r(x,y,S,k,M){if(!A(y,k))return!1;var T,c;S[0]0?c:1/0},k=E(y,S),M=u.mod(k+1,y.length);return[y[k],y[M]]}function g(x){return Math.abs(x)>1e-10?x:0}function m(x,y,S){y=y||0,S=S||0;for(var k=x.length,M=new Array(k),T=0;T{function u(r){return r<0?-1:r>0?1:0}function d(r){var i=r[0],n=r[1];if(!isFinite(i)||!isFinite(n))return[1,0];var o=(i+1)*(i+1)+n*n;return[(i*i+n*n-1)/o,2*n/o]}function E(r,i){var n=i[0],o=i[1];return[n*r.radius+r.cx,-o*r.radius+r.cy]}function A(r,i){return i*r.radius}function t(r,i,n,o){var a=E(r,d([n,i])),s=a[0],f=a[1],v=E(r,d([o,i])),g=v[0],m=v[1];if(i===0)return["M"+s+","+f,"L"+g+","+m].join(" ");var w=A(r,1/Math.abs(i));return["M"+s+","+f,"A"+w+","+w+" 0 0,"+(i<0?1:0)+" "+g+","+m].join(" ")}function e(r,i,n,o){var a=A(r,1/(i+1)),s=E(r,d([i,n])),f=s[0],v=s[1],g=E(r,d([i,o])),m=g[0],w=g[1];if(u(n)!==u(o)){var l=E(r,d([i,0])),x=l[0],y=l[1];return["M"+f+","+v,"A"+a+","+a+" 0 0,"+(0{var u=Ni(),d=Af(),E=ji(),A=Xr(),t=A.strRotate,e=A.strTranslate,r=Pi(),i=Eo(),n=Vu(),o=yo(),a=gp(),s=l4(),f=Yh().doAutoRange,v=Db(),g=oh(),m=pc(),w=c0(),l=Ec().prepSelect,x=Ec().selectOnClick,y=Ec().clearOutline,S=Xh(),k=Ug(),M=Hg().redrawReglTraces,T=gf().MID_SHIFT,c=o_(),h=s_(),b=u4(),_=b.smith,P=b.reactanceArc,z=b.resistanceArc,D=b.smithTransform,B=A._,R=A.mod,I=A.deg2rad,F=A.rad2deg;function j(et,Z,ot){this.isSmith=ot||!1,this.id=Z,this.gd=et,this._hasClipOnAxisFalse=null,this.vangles=null,this.radialAxisAngle=null,this.traceHash={},this.layers={},this.clipPaths={},this.clipIds={},this.viewInitial={};var X=et._fullLayout,Q="clip"+X._uid+Z;this.clipIds.forTraces=Q+"-for-traces",this.clipPaths.forTraces=X._clips.append("clipPath").attr("id",this.clipIds.forTraces),this.clipPaths.forTraces.append("path"),this.framework=X["_"+(ot?"smith":"polar")+"layer"].append("g").attr("class",Z),this.getHole=function(ut){return this.isSmith?0:ut.hole},this.getSector=function(ut){return this.isSmith?[0,360]:ut.sector},this.getRadial=function(ut){return this.isSmith?ut.realaxis:ut.radialaxis},this.getAngular=function(ut){return this.isSmith?ut.imaginaryaxis:ut.angularaxis},ot||(this.radialTickLayout=null,this.angularTickLayout=null)}var N=j.prototype;V.exports=function(et,Z,ot){return new j(et,Z,ot)},N.plot=function(et,Z){for(var ot=this,X=Z[ot.id],Q=!1,ut=0;utte?(Jt=nt,ee=nt*te,bt=(dt-ee)/Q.h/2,Zt=[q[0],q[1]],mt=[it[0]+bt,it[1]-bt]):(Jt=dt/te,ee=dt,bt=(nt-Jt)/Q.w/2,Zt=[q[0]+bt,q[1]-bt],mt=[it[0],it[1]]),ot.xLength2=Jt,ot.yLength2=ee,ot.xDomain2=Zt,ot.yDomain2=mt;var vt=ot.xOffset2=Q.l+Q.w*Zt[0],Ut=ot.yOffset2=Q.t+Q.h*(1-mt[1]),re=ot.radius=Jt/Ct,Kt=ot.innerRadius=ot.getHole(Z)*re,ue=ot.cx=vt-re*wt[0],Me=ot.cy=Ut+re*wt[3],Ce=ot.cxx=ue-vt,We=ot.cyy=Me-Ut,qe=ut.side,vr;qe==="counterclockwise"?(vr=qe,qe="top"):qe==="clockwise"&&(vr=qe,qe="bottom"),ot.radialAxis=ot.mockAxis(et,Z,ut,{_id:"x",side:qe,_trueSide:vr,domain:[Kt/Q.w,re/Q.w]}),ot.angularAxis=ot.mockAxis(et,Z,J,{side:"right",domain:[0,Math.PI],autorange:!1}),ot.doAutoRange(et,Z),ot.updateAngularAxis(et,Z),ot.updateRadialAxis(et,Z),ot.updateRadialAxisTitle(et,Z),ot.xaxis=ot.mockCartesianAxis(et,Z,{_id:"x",domain:Zt}),ot.yaxis=ot.mockCartesianAxis(et,Z,{_id:"y",domain:mt});var _r=ot.pathSubplot();ot.clipPaths.forTraces.select("path").attr("d",_r).attr("transform",e(Ce,We)),X.frontplot.attr("transform",e(vt,Ut)).call(i.setClipUrl,ot._hasClipOnAxisFalse?null:ot.clipIds.forTraces,ot.gd),X.bg.attr("d",_r).attr("transform",e(ue,Me)).call(r.fill,Z.bgcolor)},N.mockAxis=function(et,Z,ot,X){var Q=A.extendFlat({},ot,X);return s(Q,Z,et),Q},N.mockCartesianAxis=function(et,Z,ot){var X=this,Q=X.isSmith,ut=ot._id,J=A.extendFlat({type:"linear"},ot);a(J,et);var q={x:[0,2],y:[1,3]};return J.setRange=function(){var it=X.sectorBBox,nt=q[ut],dt=X.radialAxis._rl,Tt=(dt[1]-dt[0])/(1-X.getHole(Z));J.range=[it[nt[0]]*Tt,it[nt[1]]*Tt]},J.isPtWithinRange=ut==="x"&&!Q?function(it){return X.isPtInside(it)}:function(){return!0},J.setRange(),J.setScale(),J},N.doAutoRange=function(et,Z){var ot=this,X=ot.gd,Q=ot.radialAxis,ut=ot.getRadial(Z);f(X,Q);var J=Q.range;if(ut.range=J.slice(),ut._input.range=J.slice(),Q._rl=[Q.r2l(J[0],null,"gregorian"),Q.r2l(J[1],null,"gregorian")],Q.minallowed!==void 0){var q=Q.r2l(Q.minallowed);Q._rl[0]>Q._rl[1]?Q._rl[1]=Math.max(Q._rl[1],q):Q._rl[0]=Math.max(Q._rl[0],q)}if(Q.maxallowed!==void 0){var it=Q.r2l(Q.maxallowed);Q._rl[0]90&&dt<=270&&(Tt.tickangle=180);var It=Ct?function(re){var Kt=D(ot,_([re.x,0]));return e(Kt[0]-q,Kt[1]-it)}:function(re){return e(Tt.l2p(re.x)+J,0)},Nt=Ct?function(re){return z(ot,re.x,-1/0,1/0)}:function(re){return ot.pathArc(Tt.r2p(re.x)+J)},te=G(nt);if(ot.radialTickLayout!==te&&(Q["radial-axis"].selectAll(".xtick").remove(),ot.radialTickLayout=te),wt){Tt.setScale();var Jt=0,ee=Ct?(Tt.tickvals||[]).filter(function(re){return re>=0}).map(function(re){return o.tickText(Tt,re,!0,!1)}):o.calcTicks(Tt),Zt=Ct?ee:o.clipEnds(Tt,ee),mt=o.getTickSigns(Tt)[2];Ct&&((Tt.ticks==="top"&&Tt.side==="bottom"||Tt.ticks==="bottom"&&Tt.side==="top")&&(mt=-mt),Tt.ticks==="top"&&Tt.side==="top"&&(Jt=-Tt.ticklen),Tt.ticks==="bottom"&&Tt.side==="bottom"&&(Jt=Tt.ticklen)),o.drawTicks(X,Tt,{vals:ee,layer:Q["radial-axis"],path:o.makeTickPath(Tt,0,mt),transFn:It,crisp:!1}),o.drawGrid(X,Tt,{vals:Zt,layer:Q["radial-grid"],path:Nt,transFn:A.noop,crisp:!1}),o.drawLabels(X,Tt,{vals:ee,layer:Q["radial-axis"],transFn:It,labelFns:o.makeLabelFns(Tt,Jt)})}var bt=ot.radialAxisAngle=ot.vangles?F(ct(I(nt.angle),ot.vangles)):nt.angle,vt=e(q,it),Ut=vt+t(-bt);st(Q["radial-axis"],wt&&(nt.showticklabels||nt.ticks),{transform:Ut}),st(Q["radial-grid"],wt&&nt.showgrid,{transform:Ct?"":vt}),st(Q["radial-line"].select("line"),wt&&nt.showline,{x1:Ct?-ut:J,y1:0,x2:ut,y2:0,transform:Ut}).attr("stroke-width",nt.linewidth).call(r.stroke,nt.linecolor)},N.updateRadialAxisTitle=function(et,Z,ot){if(!this.isSmith){var X=this,Q=X.gd,ut=X.radius,J=X.cx,q=X.cy,it=X.getRadial(Z),nt=X.id+"title",dt=0;if(it.title){var Tt=i.bBox(X.layers["radial-axis"].node()).height,wt=it.title.font.size,Ct=it.side;dt=Ct==="top"?wt:Ct==="counterclockwise"?-(Tt+wt*.4):Tt+wt*.8}var It=ot!==void 0?ot:X.radialAxisAngle,Nt=I(It),te=Math.cos(Nt),Jt=Math.sin(Nt),ee=J+ut/2*te+dt*Jt,Zt=q-ut/2*Jt+dt*te;X.layers["radial-axis-title"]=w.draw(Q,nt,{propContainer:it,propName:X.id+".radialaxis.title.text",placeholder:B(Q,"Click to enter radial axis title"),attributes:{x:ee,y:Zt,"text-anchor":"middle"},transform:{rotate:-It}})}},N.updateAngularAxis=function(et,Z){var ot=this,X=ot.gd,Q=ot.layers,ut=ot.radius,J=ot.innerRadius,q=ot.cx,it=ot.cy,nt=ot.getAngular(Z),dt=ot.angularAxis,Tt=ot.isSmith;Tt||(ot.fillViewInitialKey("angularaxis.rotation",nt.rotation),dt.setGeometry(),dt.setScale());var wt=Tt?function(Kt){var ue=D(ot,_([0,Kt.x]));return Math.atan2(ue[0]-q,ue[1]-it)-Math.PI/2}:function(Kt){return dt.t2g(Kt.x)};dt.type==="linear"&&dt.thetaunit==="radians"&&(dt.tick0=F(dt.tick0),dt.dtick=F(dt.dtick));var Ct=function(Kt){return e(q+ut*Math.cos(Kt),it-ut*Math.sin(Kt))},It=Tt?function(Kt){var ue=D(ot,_([0,Kt.x]));return e(ue[0],ue[1])}:function(Kt){return Ct(wt(Kt))},Nt=Tt?function(Kt){var ue=D(ot,_([0,Kt.x])),Me=Math.atan2(ue[0]-q,ue[1]-it)-Math.PI/2;return e(ue[0],ue[1])+t(-F(Me))}:function(Kt){var ue=wt(Kt);return Ct(ue)+t(-F(ue))},te=Tt?function(Kt){return P(ot,Kt.x,0,1/0)}:function(Kt){var ue=wt(Kt),Me=Math.cos(ue),Ce=Math.sin(ue);return"M"+[q+J*Me,it-J*Ce]+"L"+[q+ut*Me,it-ut*Ce]},Jt=o.makeLabelFns(dt,0),ee=Jt.labelStandoff,Zt={};Zt.xFn=function(Kt){var ue=wt(Kt);return Math.cos(ue)*ee},Zt.yFn=function(Kt){var ue=wt(Kt),Me=Math.sin(ue)>0?.2:1;return-Math.sin(ue)*(ee+Kt.fontSize*Me)+Math.abs(Math.cos(ue))*(Kt.fontSize*T)},Zt.anchorFn=function(Kt){var ue=wt(Kt),Me=Math.cos(ue);return Math.abs(Me)<.1?"middle":Me>0?"start":"end"},Zt.heightFn=function(Kt,ue,Me){var Ce=wt(Kt);return-.5*(1+Math.sin(Ce))*Me};var mt=G(nt);ot.angularTickLayout!==mt&&(Q["angular-axis"].selectAll("."+dt._id+"tick").remove(),ot.angularTickLayout=mt);var bt=Tt?[1/0].concat(dt.tickvals||[]).map(function(Kt){return o.tickText(dt,Kt,!0,!1)}):o.calcTicks(dt);Tt&&(bt[0].text="∞",bt[0].fontSize*=1.75);var vt;if(Z.gridshape==="linear"?(vt=bt.map(wt),A.angleDelta(vt[0],vt[1])<0&&(vt=vt.slice().reverse())):vt=null,ot.vangles=vt,dt.type==="category"&&(bt=bt.filter(function(Kt){return A.isAngleInsideSector(wt(Kt),ot.sectorInRad)})),dt.visible){var Ut=dt.ticks==="inside"?-1:1,re=(dt.linewidth||1)/2;o.drawTicks(X,dt,{vals:bt,layer:Q["angular-axis"],path:"M"+Ut*re+",0h"+Ut*dt.ticklen,transFn:Nt,crisp:!1}),o.drawGrid(X,dt,{vals:bt,layer:Q["angular-grid"],path:te,transFn:A.noop,crisp:!1}),o.drawLabels(X,dt,{vals:bt,layer:Q["angular-axis"],repositionOnUpdate:!0,transFn:It,labelFns:Zt})}st(Q["angular-line"].select("path"),nt.showline,{d:ot.pathSubplot(),transform:e(q,it)}).attr("stroke-width",nt.linewidth).call(r.stroke,nt.linecolor)},N.updateFx=function(et,Z){if(!this.gd._context.staticPlot){var ot=!this.isSmith;ot&&(this.updateAngularDrag(et),this.updateRadialDrag(et,Z,0),this.updateRadialDrag(et,Z,1)),this.updateHoverAndMainDrag(et)}},N.updateHoverAndMainDrag=function(et){var Z=this,ot=Z.isSmith,X=Z.gd,Q=Z.layers,ut=et._zoomlayer,J=c.MINZOOM,q=c.OFFEDGE,it=Z.radius,nt=Z.innerRadius,dt=Z.cx,Tt=Z.cy,wt=Z.cxx,Ct=Z.cyy,It=Z.sectorInRad,Nt=Z.vangles,te=Z.radialAxis,Jt=h.clampTiny,ee=h.findXYatLength,Zt=h.findEnclosingVertexAngles,mt=c.cornerHalfWidth,bt=c.cornerLen/2,vt,Ut,re=v.makeDragger(Q,"path","maindrag",et.dragmode===!1?"none":"crosshair");u.select(re).attr("d",Z.pathSubplot()).attr("transform",e(dt,Tt)),re.onmousemove=function(ar){m.hover(X,ar,Z.id),X._fullLayout._lasthover=re,X._fullLayout._hoversubplot=Z.id},re.onmouseout=function(ar){X._dragging||g.unhover(X,ar)};var Kt={element:re,gd:X,subplot:Z.id,plotinfo:{id:Z.id,xaxis:Z.xaxis,yaxis:Z.yaxis},xaxes:[Z.xaxis],yaxes:[Z.yaxis]},ue,Me,Ce,We,qe,vr,_r,er,Mr;function Ir(ar,Ye){return Math.sqrt(ar*ar+Ye*Ye)}function de(ar,Ye){return Ir(ar-wt,Ye-Ct)}function Dt(ar,Ye){return Math.atan2(Ct-Ye,ar-wt)}function qt(ar,Ye){return[ar*Math.cos(Ye),ar*Math.sin(-Ye)]}function _t(ar,Ye){if(ar===0)return Z.pathSector(2*mt);var Er=bt/ar,pn=Ye-Er,dn=Ye+Er,bn=Math.max(0,Math.min(ar,it)),Zn=bn-mt,En=bn+mt;return"M"+qt(Zn,pn)+"A"+[Zn,Zn]+" 0,0,0 "+qt(Zn,dn)+"L"+qt(En,dn)+"A"+[En,En]+" 0,0,1 "+qt(En,pn)+"Z"}function lt(ar,Ye,Er){if(ar===0)return Z.pathSector(2*mt);var pn=qt(ar,Ye),dn=qt(ar,Er),bn=Jt((pn[0]+dn[0])/2),Zn=Jt((pn[1]+dn[1])/2),En,gn;if(bn&&Zn){var da=Zn/bn,ra=-1/da,Se=ee(mt,da,bn,Zn);En=ee(bt,ra,Se[0][0],Se[0][1]),gn=ee(bt,ra,Se[1][0],Se[1][1])}else{var Re,Ze;Zn?(Re=bt,Ze=mt):(Re=mt,Ze=bt),En=[[bn-Re,Zn-Ze],[bn+Re,Zn-Ze]],gn=[[bn-Re,Zn+Ze],[bn+Re,Zn+Ze]]}return"M"+En.join("L")+"L"+gn.reverse().join("L")+"Z"}function yt(){Ce=null,We=null,qe=Z.pathSubplot(),vr=!1;var ar=X._fullLayout[Z.id];_r=d(ar.bgcolor).getLuminance(),er=v.makeZoombox(ut,_r,dt,Tt,qe),er.attr("fill-rule","evenodd"),Mr=v.makeCorners(ut,dt,Tt),y(X)}function St(ar,Ye){return Ye=Math.max(Math.min(Ye,it),nt),arJ?(ar-1&&ar===1&&x(Ye,X,[Z.xaxis],[Z.yaxis],Z.id,Kt),Er.indexOf("event")>-1&&m.click(X,Ye,Z.id)}Kt.prepFn=function(ar,Ye,Er){var pn=X._fullLayout.dragmode,dn=re.getBoundingClientRect();X._fullLayout._calcInverseTransform(X);var bn=X._fullLayout._invTransform;vt=X._fullLayout._invScaleX,Ut=X._fullLayout._invScaleY;var Zn=A.apply3DTransform(bn)(Ye-dn.left,Er-dn.top);if(ue=Zn[0],Me=Zn[1],Nt){var En=h.findPolygonOffset(it,It[0],It[1],Nt);ue+=wt+En[0],Me+=Ct+En[1]}switch(pn){case"zoom":Kt.clickFn=ir,ot||(Nt?Kt.moveFn=ke:Kt.moveFn=Yt,Kt.doneFn=Ee,yt());break;case"select":case"lasso":l(ar,Ye,Er,Kt,pn);break}},g.init(Kt)},N.updateRadialDrag=function(et,Z,ot){var X=this,Q=X.gd,ut=X.layers,J=X.radius,q=X.innerRadius,it=X.cx,nt=X.cy,dt=X.radialAxis,Tt=c.radialDragBoxSize,wt=Tt/2;if(!dt.visible)return;var Ct=I(X.radialAxisAngle),It=dt._rl,Nt=It[0],te=It[1],Jt=It[ot],ee=.75*(It[1]-It[0])/(1-X.getHole(Z))/J,Zt,mt,bt;ot?(Zt=it+(J+wt)*Math.cos(Ct),mt=nt-(J+wt)*Math.sin(Ct),bt="radialdrag"):(Zt=it+(q-wt)*Math.cos(Ct),mt=nt-(q-wt)*Math.sin(Ct),bt="radialdrag-inner");var vt=v.makeRectDragger(ut,bt,"crosshair",-wt,-wt,Tt,Tt),Ut={element:vt,gd:Q};et.dragmode===!1&&(Ut.dragmode=!1),st(u.select(vt),dt.visible&&q0!=(ot?ue>Nt:ue=90||Q>90&&ut>=450?Ct=1:q<=0&&nt<=0?Ct=0:Ct=Math.max(q,nt),Q<=180&&ut>=180||Q>180&&ut>=540?dt=-1:J>=0&&it>=0?dt=0:dt=Math.min(J,it),Q<=270&&ut>=270||Q>270&&ut>=630?Tt=-1:q>=0&&nt>=0?Tt=0:Tt=Math.min(q,nt),ut>=360?wt=1:J<=0&&it<=0?wt=0:wt=Math.max(J,it),[dt,Tt,wt,Ct]}function ct(et,Z){var ot=function(Q){return A.angleDist(et,Q)},X=A.findIndexOfMin(Z,ot);return Z[X]}function st(et,Z,ot){return Z?(et.attr("display",null),et.attr(ot)):et&&et.attr("display","none"),et}}),f4=Vt((K,V)=>{var u=af(),d=Of(),E=Hu().attributes,A=Xr().extendFlat,t=Cu().overrideAll,e=t({color:d.color,showline:A({},d.showline,{dflt:!0}),linecolor:d.linecolor,linewidth:d.linewidth,showgrid:A({},d.showgrid,{dflt:!0}),gridcolor:d.gridcolor,gridwidth:d.gridwidth,griddash:d.griddash},"plot","from-root"),r=t({tickmode:d.minor.tickmode,nticks:d.nticks,tick0:d.tick0,dtick:d.dtick,tickvals:d.tickvals,ticktext:d.ticktext,ticks:d.ticks,ticklen:d.ticklen,tickwidth:d.tickwidth,tickcolor:d.tickcolor,ticklabelstep:d.ticklabelstep,showticklabels:d.showticklabels,labelalias:d.labelalias,minorloglabels:d.minorloglabels,showtickprefix:d.showtickprefix,tickprefix:d.tickprefix,showticksuffix:d.showticksuffix,ticksuffix:d.ticksuffix,showexponent:d.showexponent,exponentformat:d.exponentformat,minexponent:d.minexponent,separatethousands:d.separatethousands,tickfont:d.tickfont,tickangle:d.tickangle,tickformat:d.tickformat,tickformatstops:d.tickformatstops,layer:d.layer},"plot","from-root"),i={visible:A({},d.visible,{dflt:!0}),type:A({},d.type,{values:["-","linear","log","date","category"]}),autotypenumbers:d.autotypenumbers,autorangeoptions:{minallowed:d.autorangeoptions.minallowed,maxallowed:d.autorangeoptions.maxallowed,clipmin:d.autorangeoptions.clipmin,clipmax:d.autorangeoptions.clipmax,include:d.autorangeoptions.include,editType:"plot"},autorange:A({},d.autorange,{editType:"plot"}),rangemode:{valType:"enumerated",values:["tozero","nonnegative","normal"],dflt:"tozero",editType:"calc"},minallowed:A({},d.minallowed,{editType:"plot"}),maxallowed:A({},d.maxallowed,{editType:"plot"}),range:A({},d.range,{items:[{valType:"any",editType:"plot",impliedEdits:{"^autorange":!1}},{valType:"any",editType:"plot",impliedEdits:{"^autorange":!1}}],editType:"plot"}),categoryorder:d.categoryorder,categoryarray:d.categoryarray,angle:{valType:"angle",editType:"plot"},autotickangles:d.autotickangles,side:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"clockwise",editType:"plot"},title:{text:A({},d.title.text,{editType:"plot",dflt:""}),font:A({},d.title.font,{editType:"plot"}),editType:"plot"},hoverformat:d.hoverformat,uirevision:{valType:"any",editType:"none"},editType:"calc"};A(i,e,r);var n={visible:A({},d.visible,{dflt:!0}),type:{valType:"enumerated",values:["-","linear","category"],dflt:"-",editType:"calc",_noTemplating:!0},autotypenumbers:d.autotypenumbers,categoryorder:d.categoryorder,categoryarray:d.categoryarray,thetaunit:{valType:"enumerated",values:["radians","degrees"],dflt:"degrees",editType:"calc"},period:{valType:"number",editType:"calc",min:0},direction:{valType:"enumerated",values:["counterclockwise","clockwise"],dflt:"counterclockwise",editType:"calc"},rotation:{valType:"angle",editType:"calc"},hoverformat:d.hoverformat,uirevision:{valType:"any",editType:"none"},editType:"calc"};A(n,e,r),V.exports={domain:E({name:"polar",editType:"plot"}),sector:{valType:"info_array",items:[{valType:"number",editType:"plot"},{valType:"number",editType:"plot"}],dflt:[0,360],editType:"plot"},hole:{valType:"number",min:0,max:1,dflt:0,editType:"plot"},bgcolor:{valType:"color",editType:"plot",dflt:u.background},radialaxis:i,angularaxis:n,gridshape:{valType:"enumerated",values:["circular","linear"],dflt:"circular",editType:"plot"},uirevision:{valType:"any",editType:"none"},editType:"calc"}}),hC=Vt((K,V)=>{var u=Xr(),d=Pi(),E=cl(),A=Cd(),t=Pf().getSubplotData,e=u0(),r=wm(),i=Ad(),n=Md(),o=a1(),a=Zg(),s=gb(),f=km(),v=f4(),g=l4(),m=o_(),w=m.axisNames;function l(y,S,k,M){var T=k("bgcolor");M.bgColor=d.combine(T,M.paper_bgcolor);var c=k("sector");k("hole");var h=t(M.fullData,m.name,M.id),b=M.layoutOut,_;function P(Tt,wt){return k(_+"."+Tt,wt)}for(var z=0;z{var u=Pf().getSubplotCalcData,d=Xr().counterRegex,E=c4(),A=o_(),t=A.attr,e=A.name,r=d(e),i={};i[t]={valType:"subplotid",dflt:e,editType:"calc"};function n(a){for(var s=a._fullLayout,f=a.calcdata,v=s._subplots[e],g=0;g{var{hovertemplateAttrs:u,texttemplateAttrs:d,templatefallbackAttrs:E}=yl(),A=So().extendFlat,t=Jh(),e=dc(),r=kl(),i=e.line;V.exports={mode:e.mode,r:{valType:"data_array",editType:"calc+clearAxisTypes"},theta:{valType:"data_array",editType:"calc+clearAxisTypes"},r0:{valType:"any",dflt:0,editType:"calc+clearAxisTypes"},dr:{valType:"number",dflt:1,editType:"calc"},theta0:{valType:"any",dflt:0,editType:"calc+clearAxisTypes"},dtheta:{valType:"number",editType:"calc"},thetaunit:{valType:"enumerated",values:["radians","degrees","gradians"],dflt:"degrees",editType:"calc+clearAxisTypes"},text:e.text,texttemplate:d({editType:"plot"},{keys:["r","theta","text"]}),texttemplatefallback:E({editType:"plot"}),hovertext:e.hovertext,line:{color:i.color,width:i.width,dash:i.dash,backoff:i.backoff,shape:A({},i.shape,{values:["linear","spline"]}),smoothing:i.smoothing,editType:"calc"},connectgaps:e.connectgaps,marker:e.marker,cliponaxis:A({},e.cliponaxis,{dflt:!1}),textposition:e.textposition,textfont:e.textfont,fill:A({},e.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:t(),hoverinfo:A({},r.hoverinfo,{flags:["r","theta","text","name"]}),hoveron:e.hoveron,hovertemplate:u(),hovertemplatefallback:E(),selected:e.selected,unselected:e.unselected}}),u_=Vt((K,V)=>{var u=Xr(),d=nu(),E=Lh(),A=Bh(),t=Sm(),e=Rh(),r=tp(),i=vp().PTS_LINESONLY,n=Uv();function o(s,f,v,g){function m(x,y){return u.coerce(s,f,n,x,y)}var w=a(s,f,g,m);if(!w){f.visible=!1;return}m("thetaunit"),m("mode",w{var u=Xr(),d=yo();V.exports=function(E,A,t){var e={},r=t[A.subplot]._subplot,i,n;r?(i=r.radialAxis,n=r.angularAxis):(r=t[A.subplot],i=r.radialaxis,n=r.angularaxis);var o=i.c2l(E.r);e.rLabel=d.tickText(i,o,!0).text;var a=n.thetaunit==="degrees"?u.rad2deg(E.theta):E.theta;return e.thetaLabel=d.tickText(n,a,!0).text,e}}),pC=Vt((K,V)=>{var u=Lo(),d=ks().BADNUM,E=yo(),A=Nh(),t=yp(),e=jh(),r=Uh().calcMarkerSize;V.exports=function(i,n){for(var o=i._fullLayout,a=n.subplot,s=o[a].radialaxis,f=o[a].angularaxis,v=s.makeCalcdata(n,"r"),g=f.makeCalcdata(n,"theta"),m=n._length,w=new Array(m),l=0;l{var u=Em(),d=ks().BADNUM;V.exports=function(E,A,t){for(var e=A.layers.frontplot.select("g.scatterlayer"),r=A.xaxis,i=A.yaxis,n={xaxis:r,yaxis:i,plot:A.framework,layerClipId:A._hasClipOnAxisFalse?A.clipIds.forTraces:null},o=A.radialAxis,a=A.angularAxis,s=0;s{var u=Lm();function d(A,t,e,r){var i=u(A,t,e,r);if(!(!i||i[0].index===!1)){var n=i[0];if(n.index===void 0)return i;var o=A.subplot,a=n.cd[n.index],s=n.trace;if(o.isPtInside(a))return n.xLabelVal=void 0,n.yLabelVal=void 0,E(a,s,o,n),n.hovertemplate=s.hovertemplate,i}}function E(A,t,e,r){var i=e.radialAxis,n=e.angularAxis;i._hovertitle="r",n._hovertitle="θ";var o={};o[t.subplot]={_subplot:e};var a=t._module.formatLabels(A,t,o);r.rLabel=a.rLabel,r.thetaLabel=a.thetaLabel;var s=A.hi||t.hoverinfo,f=[];function v(m,w){f.push(m._hovertitle+": "+w)}if(!t.hovertemplate){var g=s.split("+");g.indexOf("all")!==-1&&(g=["r","theta","text"]),g.indexOf("r")!==-1&&v(i,r.rLabel),g.indexOf("theta")!==-1&&v(n,r.thetaLabel),g.indexOf("text")!==-1&&r.text&&(f.push(r.text),delete r.text),r.extraText=f.join("
          ")}}V.exports={hoverPoints:d,makeHoverPointText:E}}),mC=Vt((K,V)=>{V.exports={moduleType:"trace",name:"scatterpolar",basePlotModule:l_(),categories:["polar","symbols","showLegend","scatter-like"],attributes:Uv(),supplyDefaults:u_().supplyDefaults,colorbar:Zf(),formatLabels:c_(),calc:pC(),plot:dC(),style:gh().style,styleOnSelect:gh().styleOnSelect,hoverPoints:f_().hoverPoints,selectPoints:Cm(),meta:{}}}),gC=Vt((K,V)=>{V.exports=mC()}),h4=Vt((K,V)=>{var u=Uv(),{cliponaxis:d,hoveron:E}=u,A=G4(u,["cliponaxis","hoveron"]),{connectgaps:t,line:{color:e,dash:r,width:i},fill:n,fillcolor:o,marker:a,textfont:s,textposition:f}=Iv();V.exports=dm(yd({},A),{connectgaps:t,fill:n,fillcolor:o,line:{color:e,dash:r,editType:"calc",width:i},marker:a,textfont:s,textposition:f})}),vC=Vt((K,V)=>{var u=Xr(),d=nu(),E=u_().handleRThetaDefaults,A=Lh(),t=Bh(),e=Rh(),r=tp(),i=vp().PTS_LINESONLY,n=h4();V.exports=function(o,a,s,f){function v(m,w){return u.coerce(o,a,n,m,w)}var g=E(o,a,f,v);if(!g){a.visible=!1;return}v("thetaunit"),v("mode",g{var u=c_();V.exports=function(d,E,A){var t=d.i;return"r"in d||(d.r=E._r[t]),"theta"in d||(d.theta=E._theta[t]),u(d,E,A)}}),xC=Vt((K,V)=>{var u=Nh(),d=Uh().calcMarkerSize,E=P0(),A=yo(),t=Hd().TOO_MANY_POINTS;V.exports=function(e,r){var i=e._fullLayout,n=r.subplot,o=i[n].radialaxis,a=i[n].angularaxis,s=r._r=o.makeCalcdata(r,"r"),f=r._theta=a.makeCalcdata(r,"theta"),v=r._length,g={};v{var u=Nx(),d=f_().makeHoverPointText;function E(A,t,e,r){var i=A.cd,n=i[0].t,o=n.r,a=n.theta,s=u.hoverPoints(A,t,e,r);if(!(!s||s[0].index===!1)){var f=s[0];if(f.index===void 0)return s;var v=A.subplot,g=f.cd[f.index],m=f.trace;if(g.r=o[f.index],g.theta=a[f.index],!!v.isPtInside(g))return f.xLabelVal=void 0,f.yLabelVal=void 0,d(g,m,v,f),s}}V.exports={hoverPoints:E}}),bC=Vt((K,V)=>{V.exports={moduleType:"trace",name:"scatterpolargl",basePlotModule:l_(),categories:["gl","regl","polar","symbols","showLegend","scatter-like"],attributes:h4(),supplyDefaults:vC(),colorbar:Zf(),formatLabels:yC(),calc:xC(),hoverPoints:_C().hoverPoints,selectPoints:Z3(),meta:{}}}),wC=Vt((K,V)=>{var u=Ux(),d=Lo(),E=v5(),A=W3(),t=P0(),e=Xr(),r=Hd().TOO_MANY_POINTS,i={};V.exports=function(n,o,a){if(a.length){var s=o.radialAxis,f=o.angularAxis,v=A(n,o);return a.forEach(function(g){if(!(!g||!g[0]||!g[0].trace)){var m=g[0],w=m.trace,l=m.t,x=w._length,y=l.r,S=l.theta,k=l.opts,M,T=y.slice(),c=S.slice();for(M=0;M=r&&(k.marker.cluster=l.tree),k.marker&&(k.markerSel.positions=k.markerUnsel.positions=k.marker.positions=h),k.line&&h.length>1&&e.extendFlat(k.line,t.linePositions(n,w,h)),k.text&&(e.extendFlat(k.text,{positions:h},t.textPosition(n,w,k.text,k.marker)),e.extendFlat(k.textSel,{positions:h},t.textPosition(n,w,k.text,k.markerSel)),e.extendFlat(k.textUnsel,{positions:h},t.textPosition(n,w,k.text,k.markerUnsel))),k.fill&&!v.fill2d&&(v.fill2d=!0),k.marker&&!v.scatter2d&&(v.scatter2d=!0),k.line&&!v.line2d&&(v.line2d=!0),k.text&&!v.glText&&(v.glText=!0),v.lineOptions.push(k.line),v.fillOptions.push(k.fill),v.markerOptions.push(k.marker),v.markerSelectedOptions.push(k.markerSel),v.markerUnselectedOptions.push(k.markerUnsel),v.textOptions.push(k.text),v.textSelectedOptions.push(k.textSel),v.textUnselectedOptions.push(k.textUnsel),v.selectBatch.push([]),v.unselectBatch.push([]),l.x=b,l.y=_,l.rawx=b,l.rawy=_,l.r=y,l.theta=S,l.positions=h,l._scene=v,l.index=v.count,v.count++}}),E(n,o,a)}},V.exports.reglPrecompiled=i}),TC=Vt((K,V)=>{var u=bC();u.plot=wC(),V.exports=u}),kC=Vt((K,V)=>{V.exports=TC()}),p4=Vt((K,V)=>{var{hovertemplateAttrs:u,templatefallbackAttrs:d}=yl(),E=So().extendFlat,A=Uv(),t=xp();V.exports={r:A.r,theta:A.theta,r0:A.r0,dr:A.dr,theta0:A.theta0,dtheta:A.dtheta,thetaunit:A.thetaunit,base:E({},t.base,{}),offset:E({},t.offset,{}),width:E({},t.width,{}),text:E({},t.text,{}),hovertext:E({},t.hovertext,{}),marker:e(),hoverinfo:A.hoverinfo,hovertemplate:u(),hovertemplatefallback:d(),selected:t.selected,unselected:t.unselected};function e(){var r=E({},t.marker);return delete r.cornerradius,r}}),d4=Vt((K,V)=>{V.exports={barmode:{valType:"enumerated",values:["stack","overlay"],dflt:"stack",editType:"calc"},bargap:{valType:"number",dflt:.1,min:0,max:1,editType:"calc"}}}),AC=Vt((K,V)=>{var u=Xr(),d=u_().handleRThetaDefaults,E=p1(),A=p4();V.exports=function(t,e,r,i){function n(a,s){return u.coerce(t,e,A,a,s)}var o=d(t,e,i,n);if(!o){e.visible=!1;return}n("thetaunit"),n("base"),n("offset"),n("width"),n("text"),n("hovertext"),n("hovertemplate"),n("hovertemplatefallback"),E(t,e,n,r,i),u.coerceSelectionMarkerOpacity(e,n)}}),MC=Vt((K,V)=>{var u=Xr(),d=d4();V.exports=function(E,A,t){var e={},r;function i(a,s){return u.coerce(E[r]||{},A[r],d,a,s)}for(var n=0;n{var u=ah().hasColorscale,d=ih(),E=Xr().isArrayOrTypedArray,A=Xg(),t=d0().setGroupPositions,e=jh(),r=ji().traceIs,i=Xr().extendFlat;function n(a,s){for(var f=a._fullLayout,v=s.subplot,g=f[v].radialaxis,m=f[v].angularaxis,w=g.makeCalcdata(s,"r"),l=m.makeCalcdata(s,"theta"),x=s._length,y=new Array(x),S=w,k=l,M=0;M{var u=Ni(),d=Lo(),E=Xr(),A=Eo(),t=s_();V.exports=function(r,i,n){var o=r._context.staticPlot,a=i.xaxis,s=i.yaxis,f=i.radialAxis,v=i.angularAxis,g=e(i),m=i.layers.frontplot.select("g.barlayer");E.makeTraceGroups(m,n,"trace bars").each(function(){var w=u.select(this),l=E.ensureSingle(w,"g","points"),x=l.selectAll("g.point").data(E.identity);x.enter().append("g").style("vector-effect",o?"none":"non-scaling-stroke").style("stroke-miterlimit",2).classed("point",!0),x.exit().remove(),x.each(function(y){var S=u.select(this),k=y.rp0=f.c2p(y.s0),M=y.rp1=f.c2p(y.s1),T=y.thetag0=v.c2g(y.p0),c=y.thetag1=v.c2g(y.p1),h;if(!d(k)||!d(M)||!d(T)||!d(c)||k===M||T===c)h="M0,0Z";else{var b=f.c2g(y.s1),_=(T+c)/2;y.ct=[a.c2p(b*Math.cos(_)),s.c2p(b*Math.sin(_))],h=g(k,M,T,c)}E.ensureSingle(S,"path").attr("d",h)}),A.setClipUrl(w,i._hasClipOnAxisFalse?i.clipIds.forTraces:null,r)})};function e(r){var i=r.cxx,n=r.cyy;return r.vangles?function(o,a,s,f){var v,g;E.angleDelta(s,f)>0?(v=s,g=f):(v=f,g=s);var m=t.findEnclosingVertexAngles(v,r.vangles)[0],w=t.findEnclosingVertexAngles(g,r.vangles)[1],l=[m,(v+g)/2,w];return t.pathPolygonAnnulus(o,a,v,g,l,i,n)}:function(o,a,s,f){return E.pathAnnulus(o,a,s,f,i,n)}}}),EC=Vt((K,V)=>{var u=pc(),d=Xr(),E=Im().getTraceColor,A=d.fillText,t=f_().makeHoverPointText,e=s_().isPtInsidePolygon;V.exports=function(r,i,n){var o=r.cd,a=o[0].trace,s=r.subplot,f=s.radialAxis,v=s.angularAxis,g=s.vangles,m=g?e:d.isPtInsideSector,w=r.maxHoverDistance,l=v._period||2*Math.PI,x=Math.abs(f.g2p(Math.sqrt(i*i+n*n))),y=Math.atan2(n,i);f.range[0]>f.range[1]&&(y+=Math.PI);var S=function(c){return m(x,y,[c.rp0,c.rp1],[c.thetag0,c.thetag1],g)?w+Math.min(1,Math.abs(c.thetag1-c.thetag0)/l)-1+(c.rp1-x)/(c.rp1-c.rp0)-1:1/0};if(u.getClosest(o,S,r),r.index!==!1){var k=r.index,M=o[k];r.x0=r.x1=M.ct[0],r.y0=r.y1=M.ct[1];var T=d.extendFlat({},M,{r:M.s,theta:M.p});return A(M,a,r),t(T,a,s,r),r.hovertemplate=a.hovertemplate,r.color=E(a,M),r.xLabelVal=r.yLabelVal=void 0,M.s<0&&(r.idealAlign="left"),[r]}}}),zC=Vt((K,V)=>{V.exports={moduleType:"trace",name:"barpolar",basePlotModule:l_(),categories:["polar","bar","showLegend"],attributes:p4(),layoutAttributes:d4(),supplyDefaults:AC(),supplyLayoutDefaults:MC(),calc:m4().calc,crossTraceCalc:m4().crossTraceCalc,plot:SC(),colorbar:Zf(),formatLabels:c_(),style:Vh().style,styleOnSelect:Vh().styleOnSelect,hoverPoints:EC(),selectPoints:Pm(),meta:{}}}),LC=Vt((K,V)=>{V.exports=zC()}),g4=Vt((K,V)=>{V.exports={attr:"subplot",name:"smith",axisNames:["realaxis","imaginaryaxis"],axisName2dataArray:{imaginaryaxis:"imag",realaxis:"real"}}}),v4=Vt((K,V)=>{var u=af(),d=Of(),E=Hu().attributes,A=Xr().extendFlat,t=Cu().overrideAll,e=t({color:d.color,showline:A({},d.showline,{dflt:!0}),linecolor:d.linecolor,linewidth:d.linewidth,showgrid:A({},d.showgrid,{dflt:!0}),gridcolor:d.gridcolor,gridwidth:d.gridwidth,griddash:d.griddash},"plot","from-root"),r=t({ticklen:d.ticklen,tickwidth:A({},d.tickwidth,{dflt:2}),tickcolor:d.tickcolor,showticklabels:d.showticklabels,labelalias:d.labelalias,showtickprefix:d.showtickprefix,tickprefix:d.tickprefix,showticksuffix:d.showticksuffix,ticksuffix:d.ticksuffix,tickfont:d.tickfont,tickformat:d.tickformat,hoverformat:d.hoverformat,layer:d.layer},"plot","from-root"),i=A({visible:A({},d.visible,{dflt:!0}),tickvals:{dflt:[.2,.5,1,2,5],valType:"data_array",editType:"plot"},tickangle:A({},d.tickangle,{dflt:90}),ticks:{valType:"enumerated",values:["top","bottom",""],editType:"ticks"},side:{valType:"enumerated",values:["top","bottom"],dflt:"top",editType:"plot"},editType:"calc"},e,r),n=A({visible:A({},d.visible,{dflt:!0}),tickvals:{valType:"data_array",editType:"plot"},ticks:d.ticks,editType:"calc"},e,r);V.exports={domain:E({name:"smith",editType:"plot"}),bgcolor:{valType:"color",editType:"plot",dflt:u.background},realaxis:i,imaginaryaxis:n,editType:"calc"}}),CC=Vt((K,V)=>{var u=Xr(),d=Pi(),E=cl(),A=Cd(),t=Pf().getSubplotData,e=Md(),r=Ad(),i=Zg(),n=gp(),o=v4(),a=g4(),s=a.axisNames,f=g(function(m){return u.isTypedArray(m)&&(m=Array.from(m)),m.slice().reverse().map(function(w){return-w}).concat([0]).concat(m)},String);function v(m,w,l,x){var y=l("bgcolor");x.bgColor=d.combine(y,x.paper_bgcolor);var S=t(x.fullData,a.name,x.id),k=x.layoutOut,M;function T(N,G){return l(M+"."+N,G)}for(var c=0;c{var u=Pf().getSubplotCalcData,d=Xr().counterRegex,E=c4(),A=g4(),t=A.attr,e=A.name,r=d(e),i={};i[t]={valType:"subplotid",dflt:e,editType:"calc"};function n(a){for(var s=a._fullLayout,f=a.calcdata,v=s._subplots[e],g=0;g{var{hovertemplateAttrs:u,texttemplateAttrs:d,templatefallbackAttrs:E}=yl(),A=So().extendFlat,t=Jh(),e=dc(),r=kl(),i=e.line;V.exports={mode:e.mode,real:{valType:"data_array",editType:"calc+clearAxisTypes"},imag:{valType:"data_array",editType:"calc+clearAxisTypes"},text:e.text,texttemplate:d({editType:"plot"},{keys:["real","imag","text"]}),texttemplatefallback:E({editType:"plot"}),hovertext:e.hovertext,line:{color:i.color,width:i.width,dash:i.dash,backoff:i.backoff,shape:A({},i.shape,{values:["linear","spline"]}),smoothing:i.smoothing,editType:"calc"},connectgaps:e.connectgaps,marker:e.marker,cliponaxis:A({},e.cliponaxis,{dflt:!1}),textposition:e.textposition,textfont:e.textfont,fill:A({},e.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:t(),hoverinfo:A({},r.hoverinfo,{flags:["real","imag","text","name"]}),hoveron:e.hoveron,hovertemplate:u(),hovertemplatefallback:E(),selected:e.selected,unselected:e.unselected}}),PC=Vt((K,V)=>{var u=Xr(),d=nu(),E=Lh(),A=Bh(),t=Sm(),e=Rh(),r=tp(),i=vp().PTS_LINESONLY,n=y4();V.exports=function(a,s,f,v){function g(l,x){return u.coerce(a,s,n,l,x)}var m=o(a,s,v,g);if(!m){s.visible=!1;return}g("mode",m{var u=yo();V.exports=function(d,E,A){var t={},e=A[E.subplot]._subplot;return t.realLabel=u.tickText(e.radialAxis,d.real,!0).text,t.imagLabel=u.tickText(e.angularAxis,d.imag,!0).text,t}}),DC=Vt((K,V)=>{var u=Lo(),d=ks().BADNUM,E=Nh(),A=yp(),t=jh(),e=Uh().calcMarkerSize;V.exports=function(r,i){for(var n=r._fullLayout,o=i.subplot,a=n[o].realaxis,s=n[o].imaginaryaxis,f=a.makeCalcdata(i,"real"),v=s.makeCalcdata(i,"imag"),g=i._length,m=new Array(g),w=0;w{var u=Em(),d=ks().BADNUM,E=u4(),A=E.smith;V.exports=function(t,e,r){for(var i=e.layers.frontplot.select("g.scatterlayer"),n=e.xaxis,o=e.yaxis,a={xaxis:n,yaxis:o,plot:e.framework,layerClipId:e._hasClipOnAxisFalse?e.clipIds.forTraces:null},s=0;s{var u=Lm();function d(A,t,e,r){var i=u(A,t,e,r);if(!(!i||i[0].index===!1)){var n=i[0];if(n.index===void 0)return i;var o=A.subplot,a=n.cd[n.index],s=n.trace;if(o.isPtInside(a))return n.xLabelVal=void 0,n.yLabelVal=void 0,E(a,s,o,n),n.hovertemplate=s.hovertemplate,i}}function E(A,t,e,r){var i=e.radialAxis,n=e.angularAxis;i._hovertitle="real",n._hovertitle="imag";var o={};o[t.subplot]={_subplot:e};var a=t._module.formatLabels(A,t,o);r.realLabel=a.realLabel,r.imagLabel=a.imagLabel;var s=A.hi||t.hoverinfo,f=[];function v(m,w){f.push(m._hovertitle+": "+w)}if(!t.hovertemplate){var g=s.split("+");g.indexOf("all")!==-1&&(g=["real","imag","text"]),g.indexOf("real")!==-1&&v(i,r.realLabel),g.indexOf("imag")!==-1&&v(n,r.imagLabel),g.indexOf("text")!==-1&&r.text&&(f.push(r.text),delete r.text),r.extraText=f.join("
          ")}}V.exports={hoverPoints:d,makeHoverPointText:E}}),RC=Vt((K,V)=>{V.exports={moduleType:"trace",name:"scattersmith",basePlotModule:IC(),categories:["smith","symbols","showLegend","scatter-like"],attributes:y4(),supplyDefaults:PC(),colorbar:Zf(),formatLabels:OC(),calc:DC(),plot:FC(),style:gh().style,styleOnSelect:gh().styleOnSelect,hoverPoints:BC().hoverPoints,selectPoints:Cm(),meta:{}}}),NC=Vt((K,V)=>{V.exports=RC()}),lh=Vt((K,V)=>{var u=of();function d(){this.regionalOptions=[],this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"},this.local=this.regionalOptions[""],this.calendars={},this._localCals={}}u(d.prototype,{instance:function(i,n){i=(i||"gregorian").toLowerCase(),n=n||"";var o=this._localCals[i+"-"+n];if(!o&&this.calendars[i]&&(o=new this.calendars[i](n),this._localCals[i+"-"+n]=o),!o)throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,i);return o},newDate:function(i,n,o,a,s){return a=(i!=null&&i.year?i.calendar():typeof a=="string"?this.instance(a,s):a)||this.instance(),a.newDate(i,n,o)},substituteDigits:function(i){return function(n){return(n+"").replace(/[0-9]/g,function(o){return i[o]})}},substituteChineseDigits:function(i,n){return function(o){for(var a="",s=0;o>0;){var f=o%10;a=(f===0?"":i[f]+n[s])+a,s++,o=Math.floor(o/10)}return a.indexOf(i[1]+n[1])===0&&(a=a.substr(1)),a||i[0]}}});function E(i,n,o,a){if(this._calendar=i,this._year=n,this._month=o,this._day=a,this._calendar._validateLevel===0&&!this._calendar.isValid(this._year,this._month,this._day))throw(r.local.invalidDate||r.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}function A(i,n){return i=""+i,"000000".substring(0,n-i.length)+i}u(E.prototype,{newDate:function(i,n,o){return this._calendar.newDate(i??this,n,o)},year:function(i){return arguments.length===0?this._year:this.set(i,"y")},month:function(i){return arguments.length===0?this._month:this.set(i,"m")},day:function(i){return arguments.length===0?this._day:this.set(i,"d")},date:function(i,n,o){if(!this._calendar.isValid(i,n,o))throw(r.local.invalidDate||r.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name);return this._year=i,this._month=n,this._day=o,this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(i,n){return this._calendar.add(this,i,n)},set:function(i,n){return this._calendar.set(this,i,n)},compareTo:function(i){if(this._calendar.name!==i._calendar.name)throw(r.local.differentCalendars||r.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,i._calendar.local.name);var n=this._year!==i._year?this._year-i._year:this._month!==i._month?this.monthOfYear()-i.monthOfYear():this._day-i._day;return n===0?0:n<0?-1:1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(i){return this._calendar.fromJD(i)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(i){return this._calendar.fromJSDate(i)},toString:function(){return(this.year()<0?"-":"")+A(Math.abs(this.year()),4)+"-"+A(this.month(),2)+"-"+A(this.day(),2)}});function t(){this.shortYearCutoff="+10"}u(t.prototype,{_validateLevel:0,newDate:function(i,n,o){return i==null?this.today():(i.year&&(this._validate(i,n,o,r.local.invalidDate||r.regionalOptions[""].invalidDate),o=i.day(),n=i.month(),i=i.year()),new E(this,i,n,o))},today:function(){return this.fromJSDate(new Date)},epoch:function(i){var n=this._validate(i,this.minMonth,this.minDay,r.local.invalidYear||r.regionalOptions[""].invalidYear);return n.year()<0?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(i){var n=this._validate(i,this.minMonth,this.minDay,r.local.invalidYear||r.regionalOptions[""].invalidYear);return(n.year()<0?"-":"")+A(Math.abs(n.year()),4)},monthsInYear:function(i){return this._validate(i,this.minMonth,this.minDay,r.local.invalidYear||r.regionalOptions[""].invalidYear),12},monthOfYear:function(i,n){var o=this._validate(i,n,this.minDay,r.local.invalidMonth||r.regionalOptions[""].invalidMonth);return(o.month()+this.monthsInYear(o)-this.firstMonth)%this.monthsInYear(o)+this.minMonth},fromMonthOfYear:function(i,n){var o=(n+this.firstMonth-2*this.minMonth)%this.monthsInYear(i)+this.minMonth;return this._validate(i,o,this.minDay,r.local.invalidMonth||r.regionalOptions[""].invalidMonth),o},daysInYear:function(i){var n=this._validate(i,this.minMonth,this.minDay,r.local.invalidYear||r.regionalOptions[""].invalidYear);return this.leapYear(n)?366:365},dayOfYear:function(i,n,o){var a=this._validate(i,n,o,r.local.invalidDate||r.regionalOptions[""].invalidDate);return a.toJD()-this.newDate(a.year(),this.fromMonthOfYear(a.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(i,n,o){var a=this._validate(i,n,o,r.local.invalidDate||r.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(a))+2)%this.daysInWeek()},extraInfo:function(i,n,o){return this._validate(i,n,o,r.local.invalidDate||r.regionalOptions[""].invalidDate),{}},add:function(i,n,o){return this._validate(i,this.minMonth,this.minDay,r.local.invalidDate||r.regionalOptions[""].invalidDate),this._correctAdd(i,this._add(i,n,o),n,o)},_add:function(i,n,o){if(this._validateLevel++,o==="d"||o==="w"){var a=i.toJD()+n*(o==="w"?this.daysInWeek():1),s=i.calendar().fromJD(a);return this._validateLevel--,[s.year(),s.month(),s.day()]}try{var f=i.year()+(o==="y"?n:0),v=i.monthOfYear()+(o==="m"?n:0),s=i.day(),g=function(l){for(;vx-1+l.minMonth;)f++,v-=x,x=l.monthsInYear(f)};o==="y"?(i.month()!==this.fromMonthOfYear(f,v)&&(v=this.newDate(f,i.month(),this.minDay).monthOfYear()),v=Math.min(v,this.monthsInYear(f)),s=Math.min(s,this.daysInMonth(f,this.fromMonthOfYear(f,v)))):o==="m"&&(g(this),s=Math.min(s,this.daysInMonth(f,this.fromMonthOfYear(f,v))));var m=[f,this.fromMonthOfYear(f,v),s];return this._validateLevel--,m}catch(w){throw this._validateLevel--,w}},_correctAdd:function(i,n,o,a){if(!this.hasYearZero&&(a==="y"||a==="m")&&(n[0]===0||i.year()>0!=n[0]>0)){var s={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[a],f=o<0?-1:1;n=this._add(i,o*s[0]+f*s[1],s[2])}return i.date(n[0],n[1],n[2])},set:function(i,n,o){this._validate(i,this.minMonth,this.minDay,r.local.invalidDate||r.regionalOptions[""].invalidDate);var a=o==="y"?n:i.year(),s=o==="m"?n:i.month(),f=o==="d"?n:i.day();return(o==="y"||o==="m")&&(f=Math.min(f,this.daysInMonth(a,s))),i.date(a,s,f)},isValid:function(i,n,o){this._validateLevel++;var a=this.hasYearZero||i!==0;if(a){var s=this.newDate(i,n,this.minDay);a=n>=this.minMonth&&n-this.minMonth=this.minDay&&o-this.minDay13.5?13:1),w=s-(m>2.5?4716:4715);return w<=0&&w--,this.newDate(w,m,g)},toJSDate:function(i,n,o){var a=this._validate(i,n,o,r.local.invalidDate||r.regionalOptions[""].invalidDate),s=new Date(a.year(),a.month()-1,a.day());return s.setHours(0),s.setMinutes(0),s.setSeconds(0),s.setMilliseconds(0),s.setHours(s.getHours()>12?s.getHours()+2:0),s},fromJSDate:function(i){return this.newDate(i.getFullYear(),i.getMonth()+1,i.getDate())}});var r=V.exports=new d;r.cdate=E,r.baseCalendar=t,r.calendars.gregorian=e}),jC=Vt(()=>{var K=of(),V=lh();K(V.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"}),V.local=V.regionalOptions[""],K(V.cdate.prototype,{formatDate:function(u,d){return typeof u!="string"&&(d=u,u=""),this._calendar.formatDate(u||"",this,d)}}),K(V.baseCalendar.prototype,{UNIX_EPOCH:V.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:1440*60,TICKS_EPOCH:V.instance().jdEpoch,TICKS_PER_DAY:1440*60*1e7,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(u,d,E){if(typeof u!="string"&&(E=d,d=u,u=""),!d)return"";if(d.calendar()!==this)throw V.local.invalidFormat||V.regionalOptions[""].invalidFormat;u=u||this.local.dateFormat,E=E||{};for(var A=E.dayNamesShort||this.local.dayNamesShort,t=E.dayNames||this.local.dayNames,e=E.monthNumbers||this.local.monthNumbers,r=E.monthNamesShort||this.local.monthNamesShort,i=E.monthNames||this.local.monthNames,n=E.calculateWeek||this.local.calculateWeek,o=function(S,k){for(var M=1;y+M1},a=function(S,k,M,T){var c=""+k;if(o(S,T))for(;c.length1},x=function(P,z){var D=l(P,z),B=[2,3,D?4:2,D?4:2,10,11,20]["oyYJ@!".indexOf(P)+1],R=new RegExp("^-?\\d{1,"+B+"}"),I=d.substring(c).match(R);if(!I)throw(V.local.missingNumberAt||V.regionalOptions[""].missingNumberAt).replace(/\{0\}/,c);return c+=I[0].length,parseInt(I[0],10)},y=this,S=function(){if(typeof i=="function"){l("m");var P=i.call(y,d.substring(c));return c+=P.length,P}return x("m")},k=function(P,z,D,B){for(var R=l(P,B)?D:z,I=0;I-1){f=1,v=g;for(var _=this.daysInMonth(s,f);v>_;_=this.daysInMonth(s,f))f++,v-=_}return a>-1?this.fromJD(a):this.newDate(s,f,v)},determineDate:function(u,d,E,A,t){E&&typeof E!="object"&&(t=A,A=E,E=null),typeof A!="string"&&(t=A,A="");var e=this,r=function(i){try{return e.parseDate(A,i,t)}catch{}i=i.toLowerCase();for(var n=(i.match(/^c/)&&E?E.newDate():null)||e.today(),o=/([+-]?[0-9]+)\s*(d|w|m|y)?/g,a=o.exec(i);a;)n.add(parseInt(a[1],10),a[2]||"d"),a=o.exec(i);return n};return d=d?d.newDate():null,u=u==null?d:typeof u=="string"?r(u):typeof u=="number"?isNaN(u)||u===1/0||u===-1/0?d:e.today().add(u,"d"):e.newDate(u),u}})}),UC=Vt(()=>{var K=lh(),V=of(),u=K.instance();function d(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}d.prototype=new K.baseCalendar,V(d.prototype,{name:"Chinese",jdEpoch:17214255e-1,hasYearZero:!1,minMonth:0,firstMonth:0,minDay:1,regionalOptions:{"":{name:"Chinese",epochs:["BEC","EC"],monthNumbers:function(a,s){if(typeof a=="string"){var f=a.match(A);return f?f[0]:""}var v=this._validateYear(a),g=a.month(),m=""+this.toChineseMonth(v,g);return s&&m.length<2&&(m="0"+m),this.isIntercalaryMonth(v,g)&&(m+="i"),m},monthNames:function(a){if(typeof a=="string"){var s=a.match(t);return s?s[0]:""}var f=this._validateYear(a),v=a.month(),g=this.toChineseMonth(f,v),m=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"][g-1];return this.isIntercalaryMonth(f,v)&&(m="闰"+m),m},monthNamesShort:function(a){if(typeof a=="string"){var s=a.match(e);return s?s[0]:""}var f=this._validateYear(a),v=a.month(),g=this.toChineseMonth(f,v),m=["一","二","三","四","五","六","七","八","九","十","十一","十二"][g-1];return this.isIntercalaryMonth(f,v)&&(m="闰"+m),m},parseMonth:function(a,s){a=this._validateYear(a);var f=parseInt(s),v;if(isNaN(f))s[0]==="闰"&&(v=!0,s=s.substring(1)),s[s.length-1]==="月"&&(s=s.substring(0,s.length-1)),f=1+["一","二","三","四","五","六","七","八","九","十","十一","十二"].indexOf(s);else{var g=s[s.length-1];v=g==="i"||g==="I"}var m=this.toMonthIndex(a,f,v);return m},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},_validateYear:function(a,s){if(a.year&&(a=a.year()),typeof a!="number"||a<1888||a>2111)throw s.replace(/\{0\}/,this.local.name);return a},toMonthIndex:function(a,s,f){var v=this.intercalaryMonth(a),g=f&&s!==v;if(g||s<1||s>12)throw K.local.invalidMonth.replace(/\{0\}/,this.local.name);var m;return v?!f&&s<=v?m=s-1:m=s:m=s-1,m},toChineseMonth:function(a,s){a.year&&(a=a.year(),s=a.month());var f=this.intercalaryMonth(a),v=f?12:11;if(s<0||s>v)throw K.local.invalidMonth.replace(/\{0\}/,this.local.name);var g;return f?s>13;return f},isIntercalaryMonth:function(a,s){a.year&&(a=a.year(),s=a.month());var f=this.intercalaryMonth(a);return!!f&&f===s},leapYear:function(a){return this.intercalaryMonth(a)!==0},weekOfYear:function(a,s,f){var v=this._validateYear(a,K.local.invalidyear),g=i[v-i[0]],m=g>>9&4095,w=g>>5&15,l=g&31,x;x=u.newDate(m,w,l),x.add(4-(x.dayOfWeek()||7),"d");var y=this.toJD(a,s,f)-x.toJD();return 1+Math.floor(y/7)},monthsInYear:function(a){return this.leapYear(a)?13:12},daysInMonth:function(a,s){a.year&&(s=a.month(),a=a.year()),a=this._validateYear(a);var f=r[a-r[0]],v=f>>13,g=v?12:11;if(s>g)throw K.local.invalidMonth.replace(/\{0\}/,this.local.name);var m=f&1<<12-s?30:29;return m},weekDay:function(a,s,f){return(this.dayOfWeek(a,s,f)||7)<6},toJD:function(a,s,f){var v=this._validate(a,m,f,K.local.invalidDate);a=this._validateYear(v.year()),s=v.month(),f=v.day();var g=this.isIntercalaryMonth(a,s),m=this.toChineseMonth(a,s),w=o(a,m,f,g);return u.toJD(w.year,w.month,w.day)},fromJD:function(a){var s=u.fromJD(a),f=n(s.year(),s.month(),s.day()),v=this.toMonthIndex(f.year,f.month,f.isIntercalary);return this.newDate(f.year,v,f.day)},fromString:function(a){var s=a.match(E),f=this._validateYear(+s[1]),v=+s[2],g=!!s[3],m=this.toMonthIndex(f,v,g),w=+s[4];return this.newDate(f,m,w)},add:function(a,s,f){var v=a.year(),g=a.month(),m=this.isIntercalaryMonth(v,g),w=this.toChineseMonth(v,g),l=Object.getPrototypeOf(d.prototype).add.call(this,a,s,f);if(f==="y"){var x=l.year(),y=l.month(),S=this.isIntercalaryMonth(x,w),k=m&&S?this.toMonthIndex(x,w,!0):this.toMonthIndex(x,w,!1);k!==y&&l.month(k)}return l}});var E=/^\s*(-?\d\d\d\d|\d\d)[-/](\d?\d)([iI]?)[-/](\d?\d)/m,A=/^\d?\d[iI]?/m,t=/^闰?十?[一二三四五六七八九]?月/m,e=/^闰?十?[一二三四五六七八九]?/m;K.calendars.chinese=d;var r=[1887,5780,5802,19157,2742,50359,1198,2646,46378,7466,3412,30122,5482,67949,2396,5294,43597,6732,6954,36181,2772,4954,18781,2396,54427,5274,6730,47781,5800,6868,21210,4790,59703,2350,5270,46667,3402,3496,38325,1388,4782,18735,2350,52374,6804,7498,44457,2906,1388,29294,4700,63789,6442,6804,56138,5802,2772,38235,1210,4698,22827,5418,63125,3476,5802,43701,2484,5302,27223,2646,70954,7466,3412,54698,5482,2412,38062,5294,2636,32038,6954,60245,2772,4826,43357,2394,5274,39501,6730,72357,5800,5844,53978,4790,2358,38039,5270,87627,3402,3496,54708,5484,4782,43311,2350,3222,27978,7498,68965,2904,5484,45677,4700,6444,39573,6804,6986,19285,2772,62811,1210,4698,47403,5418,5780,38570,5546,76469,2420,5302,51799,2646,5414,36501,3412,5546,18869,2412,54446,5276,6732,48422,6822,2900,28010,4826,92509,2394,5274,55883,6730,6820,47956,5812,2778,18779,2358,62615,5270,5450,46757,3492,5556,27318,4718,67887,2350,3222,52554,7498,3428,38252,5468,4700,31022,6444,64149,6804,6986,43861,2772,5338,35421,2650,70955,5418,5780,54954,5546,2740,38074,5302,2646,29991,3366,61011,3412,5546,43445,2412,5294,35406,6732,72998,6820,6996,52586,2778,2396,38045,5274,6698,23333,6820,64338,5812,2746,43355,2358,5270,39499,5450,79525,3492,5548],i=[1887,966732,967231,967733,968265,968766,969297,969798,970298,970829,971330,971830,972362,972863,973395,973896,974397,974928,975428,975929,976461,976962,977462,977994,978494,979026,979526,980026,980558,981059,981559,982091,982593,983124,983624,984124,984656,985157,985656,986189,986690,987191,987722,988222,988753,989254,989754,990286,990788,991288,991819,992319,992851,993352,993851,994383,994885,995385,995917,996418,996918,997450,997949,998481,998982,999483,1000014,1000515,1001016,1001548,1002047,1002578,1003080,1003580,1004111,1004613,1005113,1005645,1006146,1006645,1007177,1007678,1008209,1008710,1009211,1009743,1010243,1010743,1011275,1011775,1012306,1012807,1013308,1013840,1014341,1014841,1015373,1015874,1016404,1016905,1017405,1017937,1018438,1018939,1019471,1019972,1020471,1021002,1021503,1022035,1022535,1023036,1023568,1024069,1024568,1025100,1025601,1026102,1026633,1027133,1027666,1028167,1028666,1029198,1029699,1030199,1030730,1031231,1031763,1032264,1032764,1033296,1033797,1034297,1034828,1035329,1035830,1036362,1036861,1037393,1037894,1038394,1038925,1039427,1039927,1040459,1040959,1041491,1041992,1042492,1043023,1043524,1044024,1044556,1045057,1045558,1046090,1046590,1047121,1047622,1048122,1048654,1049154,1049655,1050187,1050689,1051219,1051720,1052220,1052751,1053252,1053752,1054284,1054786,1055285,1055817,1056317,1056849,1057349,1057850,1058382,1058883,1059383,1059915,1060415,1060947,1061447,1061947,1062479,1062981,1063480,1064012,1064514,1065014,1065545,1066045,1066577,1067078,1067578,1068110,1068611,1069112,1069642,1070142,1070674,1071175,1071675,1072207,1072709,1073209,1073740,1074241,1074741,1075273,1075773,1076305,1076807,1077308,1077839,1078340,1078840,1079372,1079871,1080403,1080904];function n(a,s,f,v){var g,m;if(typeof a=="object")g=a,m=s||{};else{var w=typeof a=="number"&&a>=1888&&a<=2111;if(!w)throw new Error("Solar year outside range 1888-2111");var l=typeof s=="number"&&s>=1&&s<=12;if(!l)throw new Error("Solar month outside range 1 - 12");var x=typeof f=="number"&&f>=1&&f<=31;if(!x)throw new Error("Solar day outside range 1 - 31");g={year:a,month:s,day:f},m={}}var y=i[g.year-i[0]],S=g.year<<9|g.month<<5|g.day;m.year=S>=y?g.year:g.year-1,y=i[m.year-i[0]];var k=y>>9&4095,M=y>>5&15,T=y&31,c,h=new Date(k,M-1,T),b=new Date(g.year,g.month-1,g.day);c=Math.round((b-h)/(24*3600*1e3));var _=r[m.year-r[0]],P;for(P=0;P<13;P++){var z=_&1<<12-P?30:29;if(c>13;return!D||P=1888&&a<=2111;if(!l)throw new Error("Lunar year outside range 1888-2111");var x=typeof s=="number"&&s>=1&&s<=12;if(!x)throw new Error("Lunar month outside range 1 - 12");var y=typeof f=="number"&&f>=1&&f<=30;if(!y)throw new Error("Lunar day outside range 1 - 30");var S;typeof v=="object"?(S=!1,m=v):(S=!!v,m={}),w={year:a,month:s,day:f,isIntercalary:S}}var k;k=w.day-1;var M=r[w.year-r[0]],T=M>>13,c;T&&(w.month>T||w.isIntercalary)?c=w.month:c=w.month-1;for(var h=0;h>9&4095,z=_>>5&15,D=_&31,B=new Date(P,z-1,D+k);return m.year=B.getFullYear(),m.month=1+B.getMonth(),m.day=B.getDate(),m}}),VC=Vt(()=>{var K=lh(),V=of();function u(d){this.local=this.regionalOptions[d||""]||this.regionalOptions[""]}u.prototype=new K.baseCalendar,V(u.prototype,{name:"Coptic",jdEpoch:18250295e-1,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Coptic",epochs:["BAM","AM"],monthNames:["Thout","Paopi","Hathor","Koiak","Tobi","Meshir","Paremhat","Paremoude","Pashons","Paoni","Epip","Mesori","Pi Kogi Enavot"],monthNamesShort:["Tho","Pao","Hath","Koi","Tob","Mesh","Pat","Pad","Pash","Pao","Epi","Meso","PiK"],dayNames:["Tkyriaka","Pesnau","Pshoment","Peftoou","Ptiou","Psoou","Psabbaton"],dayNamesShort:["Tky","Pes","Psh","Pef","Pti","Pso","Psa"],dayNamesMin:["Tk","Pes","Psh","Pef","Pt","Pso","Psa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(A){var E=this._validate(A,this.minMonth,this.minDay,K.local.invalidYear),A=E.year()+(E.year()<0?1:0);return A%4===3||A%4===-1},monthsInYear:function(d){return this._validate(d,this.minMonth,this.minDay,K.local.invalidYear||K.regionalOptions[""].invalidYear),13},weekOfYear:function(d,E,A){var t=this.newDate(d,E,A);return t.add(-t.dayOfWeek(),"d"),Math.floor((t.dayOfYear()-1)/7)+1},daysInMonth:function(d,E){var A=this._validate(d,E,this.minDay,K.local.invalidMonth);return this.daysPerMonth[A.month()-1]+(A.month()===13&&this.leapYear(A.year())?1:0)},weekDay:function(d,E,A){return(this.dayOfWeek(d,E,A)||7)<6},toJD:function(d,E,A){var t=this._validate(d,E,A,K.local.invalidDate);return d=t.year(),d<0&&d++,t.day()+(t.month()-1)*30+(d-1)*365+Math.floor(d/4)+this.jdEpoch-1},fromJD:function(d){var E=Math.floor(d)+.5-this.jdEpoch,A=Math.floor((E-Math.floor((E+366)/1461))/365)+1;A<=0&&A--,E=Math.floor(d)+.5-this.newDate(A,1,1).toJD();var t=Math.floor(E/30)+1,e=E-(t-1)*30+1;return this.newDate(A,t,e)}}),K.calendars.coptic=u}),HC=Vt(()=>{var K=lh(),V=of();function u(E){this.local=this.regionalOptions[E||""]||this.regionalOptions[""]}u.prototype=new K.baseCalendar,V(u.prototype,{name:"Discworld",jdEpoch:17214255e-1,daysPerMonth:[16,32,32,32,32,32,32,32,32,32,32,32,32],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Discworld",epochs:["BUC","UC"],monthNames:["Ick","Offle","February","March","April","May","June","Grune","August","Spune","Sektober","Ember","December"],monthNamesShort:["Ick","Off","Feb","Mar","Apr","May","Jun","Gru","Aug","Spu","Sek","Emb","Dec"],dayNames:["Sunday","Octeday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Oct","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Oc","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:2,isRTL:!1}},leapYear:function(E){return this._validate(E,this.minMonth,this.minDay,K.local.invalidYear),!1},monthsInYear:function(E){return this._validate(E,this.minMonth,this.minDay,K.local.invalidYear),13},daysInYear:function(E){return this._validate(E,this.minMonth,this.minDay,K.local.invalidYear),400},weekOfYear:function(E,A,t){var e=this.newDate(E,A,t);return e.add(-e.dayOfWeek(),"d"),Math.floor((e.dayOfYear()-1)/8)+1},daysInMonth:function(E,A){var t=this._validate(E,A,this.minDay,K.local.invalidMonth);return this.daysPerMonth[t.month()-1]},daysInWeek:function(){return 8},dayOfWeek:function(E,A,t){var e=this._validate(E,A,t,K.local.invalidDate);return(e.day()+1)%8},weekDay:function(E,A,t){var e=this.dayOfWeek(E,A,t);return e>=2&&e<=6},extraInfo:function(E,A,t){var e=this._validate(E,A,t,K.local.invalidDate);return{century:d[Math.floor((e.year()-1)/100)+1]||""}},toJD:function(E,A,t){var e=this._validate(E,A,t,K.local.invalidDate);return E=e.year()+(e.year()<0?1:0),A=e.month(),t=e.day(),t+(A>1?16:0)+(A>2?(A-2)*32:0)+(E-1)*400+this.jdEpoch-1},fromJD:function(E){E=Math.floor(E+.5)-Math.floor(this.jdEpoch)-1;var A=Math.floor(E/400)+1;E-=(A-1)*400,E+=E>15?16:0;var t=Math.floor(E/32)+1,e=E-(t-1)*32+1;return this.newDate(A<=0?A-1:A,t,e)}});var d={20:"Fruitbat",21:"Anchovy"};K.calendars.discworld=u}),qC=Vt(()=>{var K=lh(),V=of();function u(d){this.local=this.regionalOptions[d||""]||this.regionalOptions[""]}u.prototype=new K.baseCalendar,V(u.prototype,{name:"Ethiopian",jdEpoch:17242205e-1,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(A){var E=this._validate(A,this.minMonth,this.minDay,K.local.invalidYear),A=E.year()+(E.year()<0?1:0);return A%4===3||A%4===-1},monthsInYear:function(d){return this._validate(d,this.minMonth,this.minDay,K.local.invalidYear||K.regionalOptions[""].invalidYear),13},weekOfYear:function(d,E,A){var t=this.newDate(d,E,A);return t.add(-t.dayOfWeek(),"d"),Math.floor((t.dayOfYear()-1)/7)+1},daysInMonth:function(d,E){var A=this._validate(d,E,this.minDay,K.local.invalidMonth);return this.daysPerMonth[A.month()-1]+(A.month()===13&&this.leapYear(A.year())?1:0)},weekDay:function(d,E,A){return(this.dayOfWeek(d,E,A)||7)<6},toJD:function(d,E,A){var t=this._validate(d,E,A,K.local.invalidDate);return d=t.year(),d<0&&d++,t.day()+(t.month()-1)*30+(d-1)*365+Math.floor(d/4)+this.jdEpoch-1},fromJD:function(d){var E=Math.floor(d)+.5-this.jdEpoch,A=Math.floor((E-Math.floor((E+366)/1461))/365)+1;A<=0&&A--,E=Math.floor(d)+.5-this.newDate(A,1,1).toJD();var t=Math.floor(E/30)+1,e=E-(t-1)*30+1;return this.newDate(A,t,e)}}),K.calendars.ethiopian=u}),WC=Vt(()=>{var K=lh(),V=of();function u(E){this.local=this.regionalOptions[E||""]||this.regionalOptions[""]}u.prototype=new K.baseCalendar,V(u.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:!1,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(E){var A=this._validate(E,this.minMonth,this.minDay,K.local.invalidYear);return this._leapYear(A.year())},_leapYear:function(E){return E=E<0?E+1:E,d(E*7+1,19)<7},monthsInYear:function(E){return this._validate(E,this.minMonth,this.minDay,K.local.invalidYear),this._leapYear(E.year?E.year():E)?13:12},weekOfYear:function(E,A,t){var e=this.newDate(E,A,t);return e.add(-e.dayOfWeek(),"d"),Math.floor((e.dayOfYear()-1)/7)+1},daysInYear:function(E){var A=this._validate(E,this.minMonth,this.minDay,K.local.invalidYear);return E=A.year(),this.toJD(E===-1?1:E+1,7,1)-this.toJD(E,7,1)},daysInMonth:function(E,A){return E.year&&(A=E.month(),E=E.year()),this._validate(E,A,this.minDay,K.local.invalidMonth),A===12&&this.leapYear(E)||A===8&&d(this.daysInYear(E),10)===5?30:A===9&&d(this.daysInYear(E),10)===3?29:this.daysPerMonth[A-1]},weekDay:function(E,A,t){return this.dayOfWeek(E,A,t)!==6},extraInfo:function(E,A,t){var e=this._validate(E,A,t,K.local.invalidDate);return{yearType:(this.leapYear(e)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(e)%10-3]}},toJD:function(E,A,t){var e=this._validate(E,A,t,K.local.invalidDate);E=e.year(),A=e.month(),t=e.day();var r=E<=0?E+1:E,i=this.jdEpoch+this._delay1(r)+this._delay2(r)+t+1;if(A<7){for(var n=7;n<=this.monthsInYear(E);n++)i+=this.daysInMonth(E,n);for(var n=1;n=this.toJD(A===-1?1:A+1,7,1);)A++;for(var t=Ethis.toJD(A,t,this.daysInMonth(A,t));)t++;var e=E-this.toJD(A,t,1)+1;return this.newDate(A,t,e)}});function d(E,A){return E-A*Math.floor(E/A)}K.calendars.hebrew=u}),GC=Vt(()=>{var K=lh(),V=of();function u(d){this.local=this.regionalOptions[d||""]||this.regionalOptions[""]}u.prototype=new K.baseCalendar,V(u.prototype,{name:"Islamic",jdEpoch:19484395e-1,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-khamīs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(d){var E=this._validate(d,this.minMonth,this.minDay,K.local.invalidYear);return(E.year()*11+14)%30<11},weekOfYear:function(d,E,A){var t=this.newDate(d,E,A);return t.add(-t.dayOfWeek(),"d"),Math.floor((t.dayOfYear()-1)/7)+1},daysInYear:function(d){return this.leapYear(d)?355:354},daysInMonth:function(d,E){var A=this._validate(d,E,this.minDay,K.local.invalidMonth);return this.daysPerMonth[A.month()-1]+(A.month()===12&&this.leapYear(A.year())?1:0)},weekDay:function(d,E,A){return this.dayOfWeek(d,E,A)!==5},toJD:function(d,E,A){var t=this._validate(d,E,A,K.local.invalidDate);return d=t.year(),E=t.month(),A=t.day(),d=d<=0?d+1:d,A+Math.ceil(29.5*(E-1))+(d-1)*354+Math.floor((3+11*d)/30)+this.jdEpoch-1},fromJD:function(d){d=Math.floor(d)+.5;var E=Math.floor((30*(d-this.jdEpoch)+10646)/10631);E=E<=0?E-1:E;var A=Math.min(12,Math.ceil((d-29-this.toJD(E,1,1))/29.5)+1),t=d-this.toJD(E,A,1)+1;return this.newDate(E,A,t)}}),K.calendars.islamic=u}),ZC=Vt(()=>{var K=lh(),V=of();function u(d){this.local=this.regionalOptions[d||""]||this.regionalOptions[""]}u.prototype=new K.baseCalendar,V(u.prototype,{name:"Julian",jdEpoch:17214235e-1,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:!1}},leapYear:function(A){var E=this._validate(A,this.minMonth,this.minDay,K.local.invalidYear),A=E.year()<0?E.year()+1:E.year();return A%4===0},weekOfYear:function(d,E,A){var t=this.newDate(d,E,A);return t.add(4-(t.dayOfWeek()||7),"d"),Math.floor((t.dayOfYear()-1)/7)+1},daysInMonth:function(d,E){var A=this._validate(d,E,this.minDay,K.local.invalidMonth);return this.daysPerMonth[A.month()-1]+(A.month()===2&&this.leapYear(A.year())?1:0)},weekDay:function(d,E,A){return(this.dayOfWeek(d,E,A)||7)<6},toJD:function(d,E,A){var t=this._validate(d,E,A,K.local.invalidDate);return d=t.year(),E=t.month(),A=t.day(),d<0&&d++,E<=2&&(d--,E+=12),Math.floor(365.25*(d+4716))+Math.floor(30.6001*(E+1))+A-1524.5},fromJD:function(d){var E=Math.floor(d+.5),A=E+1524,t=Math.floor((A-122.1)/365.25),e=Math.floor(365.25*t),r=Math.floor((A-e)/30.6001),i=r-Math.floor(r<14?1:13),n=t-Math.floor(i>2?4716:4715),o=A-e-Math.floor(30.6001*r);return n<=0&&n--,this.newDate(n,i,o)}}),K.calendars.julian=u}),KC=Vt(()=>{var K=lh(),V=of();function u(A){this.local=this.regionalOptions[A||""]||this.regionalOptions[""]}u.prototype=new K.baseCalendar,V(u.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:!0,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:!1,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(A){return this._validate(A,this.minMonth,this.minDay,K.local.invalidYear),!1},formatYear:function(A){var t=this._validate(A,this.minMonth,this.minDay,K.local.invalidYear);A=t.year();var e=Math.floor(A/400);A=A%400,A+=A<0?400:0;var r=Math.floor(A/20);return e+"."+r+"."+A%20},forYear:function(A){if(A=A.split("."),A.length<3)throw"Invalid Mayan year";for(var t=0,e=0;e19||e>0&&r<0)throw"Invalid Mayan year";t=t*20+r}return t},monthsInYear:function(A){return this._validate(A,this.minMonth,this.minDay,K.local.invalidYear),18},weekOfYear:function(A,t,e){return this._validate(A,t,e,K.local.invalidDate),0},daysInYear:function(A){return this._validate(A,this.minMonth,this.minDay,K.local.invalidYear),360},daysInMonth:function(A,t){return this._validate(A,t,this.minDay,K.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(A,t,e){var r=this._validate(A,t,e,K.local.invalidDate);return r.day()},weekDay:function(A,t,e){return this._validate(A,t,e,K.local.invalidDate),!0},extraInfo:function(A,t,e){var r=this._validate(A,t,e,K.local.invalidDate),i=r.toJD(),n=this._toHaab(i),o=this._toTzolkin(i);return{haabMonthName:this.local.haabMonths[n[0]-1],haabMonth:n[0],haabDay:n[1],tzolkinDayName:this.local.tzolkinMonths[o[0]-1],tzolkinDay:o[0],tzolkinTrecena:o[1]}},_toHaab:function(A){A-=this.jdEpoch;var t=d(A+8+340,365);return[Math.floor(t/20)+1,d(t,20)]},_toTzolkin:function(A){return A-=this.jdEpoch,[E(A+20,20),E(A+4,13)]},toJD:function(A,t,e){var r=this._validate(A,t,e,K.local.invalidDate);return r.day()+r.month()*20+r.year()*360+this.jdEpoch},fromJD:function(A){A=Math.floor(A)+.5-this.jdEpoch;var t=Math.floor(A/360);A=A%360,A+=A<0?360:0;var e=Math.floor(A/20),r=A%20;return this.newDate(t,e,r)}});function d(A,t){return A-t*Math.floor(A/t)}function E(A,t){return d(A-1,t)+1}K.calendars.mayan=u}),YC=Vt(()=>{var K=lh(),V=of();function u(E){this.local=this.regionalOptions[E||""]||this.regionalOptions[""]}u.prototype=new K.baseCalendar;var d=K.instance("gregorian");V(u.prototype,{name:"Nanakshahi",jdEpoch:22576735e-1,daysPerMonth:[31,31,31,31,31,30,30,30,30,30,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Nanakshahi",epochs:["BN","AN"],monthNames:["Chet","Vaisakh","Jeth","Harh","Sawan","Bhadon","Assu","Katak","Maghar","Poh","Magh","Phagun"],monthNamesShort:["Che","Vai","Jet","Har","Saw","Bha","Ass","Kat","Mgr","Poh","Mgh","Pha"],dayNames:["Somvaar","Mangalvar","Budhvaar","Veervaar","Shukarvaar","Sanicharvaar","Etvaar"],dayNamesShort:["Som","Mangal","Budh","Veer","Shukar","Sanichar","Et"],dayNamesMin:["So","Ma","Bu","Ve","Sh","Sa","Et"],digits:null,dateFormat:"dd-mm-yyyy",firstDay:0,isRTL:!1}},leapYear:function(E){var A=this._validate(E,this.minMonth,this.minDay,K.local.invalidYear||K.regionalOptions[""].invalidYear);return d.leapYear(A.year()+(A.year()<1?1:0)+1469)},weekOfYear:function(E,A,t){var e=this.newDate(E,A,t);return e.add(1-(e.dayOfWeek()||7),"d"),Math.floor((e.dayOfYear()-1)/7)+1},daysInMonth:function(E,A){var t=this._validate(E,A,this.minDay,K.local.invalidMonth);return this.daysPerMonth[t.month()-1]+(t.month()===12&&this.leapYear(t.year())?1:0)},weekDay:function(E,A,t){return(this.dayOfWeek(E,A,t)||7)<6},toJD:function(r,A,t){var e=this._validate(r,A,t,K.local.invalidMonth),r=e.year();r<0&&r++;for(var i=e.day(),n=1;n=this.toJD(A+1,1,1);)A++;for(var t=E-Math.floor(this.toJD(A,1,1)+.5)+1,e=1;t>this.daysInMonth(A,e);)t-=this.daysInMonth(A,e),e++;return this.newDate(A,e,t)}}),K.calendars.nanakshahi=u}),XC=Vt(()=>{var K=lh(),V=of();function u(d){this.local=this.regionalOptions[d||""]||this.regionalOptions[""]}u.prototype=new K.baseCalendar,V(u.prototype,{name:"Nepali",jdEpoch:17007095e-1,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:!1}},leapYear:function(d){return this.daysInYear(d)!==this.daysPerYear},weekOfYear:function(d,E,A){var t=this.newDate(d,E,A);return t.add(-t.dayOfWeek(),"d"),Math.floor((t.dayOfYear()-1)/7)+1},daysInYear:function(d){var E=this._validate(d,this.minMonth,this.minDay,K.local.invalidYear);if(d=E.year(),typeof this.NEPALI_CALENDAR_DATA[d]>"u")return this.daysPerYear;for(var A=0,t=this.minMonth;t<=12;t++)A+=this.NEPALI_CALENDAR_DATA[d][t];return A},daysInMonth:function(d,E){return d.year&&(E=d.month(),d=d.year()),this._validate(d,E,this.minDay,K.local.invalidMonth),typeof this.NEPALI_CALENDAR_DATA[d]>"u"?this.daysPerMonth[E-1]:this.NEPALI_CALENDAR_DATA[d][E]},weekDay:function(d,E,A){return this.dayOfWeek(d,E,A)!==6},toJD:function(d,E,A){var t=this._validate(d,E,A,K.local.invalidDate);d=t.year(),E=t.month(),A=t.day();var e=K.instance(),r=0,i=E,n=d;this._createMissingCalendarData(d);var o=d-(i>9||i===9&&A>=this.NEPALI_CALENDAR_DATA[n][0]?56:57);for(E!==9&&(r=A,i--);i!==9;)i<=0&&(i=12,n--),r+=this.NEPALI_CALENDAR_DATA[n][i],i--;return E===9?(r+=A-this.NEPALI_CALENDAR_DATA[n][0],r<0&&(r+=e.daysInYear(o))):r+=this.NEPALI_CALENDAR_DATA[n][9]-this.NEPALI_CALENDAR_DATA[n][0],e.newDate(o,1,1).add(r,"d").toJD()},fromJD:function(d){var E=K.instance(),A=E.fromJD(d),t=A.year(),e=A.dayOfYear(),r=t+56;this._createMissingCalendarData(r);for(var i=9,n=this.NEPALI_CALENDAR_DATA[r][0],o=this.NEPALI_CALENDAR_DATA[r][i]-n+1;e>o;)i++,i>12&&(i=1,r++),o+=this.NEPALI_CALENDAR_DATA[r][i];var a=this.NEPALI_CALENDAR_DATA[r][i]-(o-e);return this.newDate(r,i,a)},_createMissingCalendarData:function(d){var E=this.daysPerMonth.slice(0);E.unshift(17);for(var A=d-1;A"u"&&(this.NEPALI_CALENDAR_DATA[A]=E)},NEPALI_CALENDAR_DATA:{1970:[18,31,31,32,31,31,31,30,29,30,29,30,30],1971:[18,31,31,32,31,32,30,30,29,30,29,30,30],1972:[17,31,32,31,32,31,30,30,30,29,29,30,30],1973:[19,30,32,31,32,31,30,30,30,29,30,29,31],1974:[19,31,31,32,30,31,31,30,29,30,29,30,30],1975:[18,31,31,32,32,30,31,30,29,30,29,30,30],1976:[17,31,32,31,32,31,30,30,30,29,29,30,31],1977:[18,31,32,31,32,31,31,29,30,29,30,29,31],1978:[18,31,31,32,31,31,31,30,29,30,29,30,30],1979:[18,31,31,32,32,31,30,30,29,30,29,30,30],1980:[17,31,32,31,32,31,30,30,30,29,29,30,31],1981:[18,31,31,31,32,31,31,29,30,30,29,30,30],1982:[18,31,31,32,31,31,31,30,29,30,29,30,30],1983:[18,31,31,32,32,31,30,30,29,30,29,30,30],1984:[17,31,32,31,32,31,30,30,30,29,29,30,31],1985:[18,31,31,31,32,31,31,29,30,30,29,30,30],1986:[18,31,31,32,31,31,31,30,29,30,29,30,30],1987:[18,31,32,31,32,31,30,30,29,30,29,30,30],1988:[17,31,32,31,32,31,30,30,30,29,29,30,31],1989:[18,31,31,31,32,31,31,30,29,30,29,30,30],1990:[18,31,31,32,31,31,31,30,29,30,29,30,30],1991:[18,31,32,31,32,31,30,30,29,30,29,30,30],1992:[17,31,32,31,32,31,30,30,30,29,30,29,31],1993:[18,31,31,31,32,31,31,30,29,30,29,30,30],1994:[18,31,31,32,31,31,31,30,29,30,29,30,30],1995:[17,31,32,31,32,31,30,30,30,29,29,30,30],1996:[17,31,32,31,32,31,30,30,30,29,30,29,31],1997:[18,31,31,32,31,31,31,30,29,30,29,30,30],1998:[18,31,31,32,31,31,31,30,29,30,29,30,30],1999:[17,31,32,31,32,31,30,30,30,29,29,30,31],2e3:[17,30,32,31,32,31,30,30,30,29,30,29,31],2001:[18,31,31,32,31,31,31,30,29,30,29,30,30],2002:[18,31,31,32,32,31,30,30,29,30,29,30,30],2003:[17,31,32,31,32,31,30,30,30,29,29,30,31],2004:[17,30,32,31,32,31,30,30,30,29,30,29,31],2005:[18,31,31,32,31,31,31,30,29,30,29,30,30],2006:[18,31,31,32,32,31,30,30,29,30,29,30,30],2007:[17,31,32,31,32,31,30,30,30,29,29,30,31],2008:[17,31,31,31,32,31,31,29,30,30,29,29,31],2009:[18,31,31,32,31,31,31,30,29,30,29,30,30],2010:[18,31,31,32,32,31,30,30,29,30,29,30,30],2011:[17,31,32,31,32,31,30,30,30,29,29,30,31],2012:[17,31,31,31,32,31,31,29,30,30,29,30,30],2013:[18,31,31,32,31,31,31,30,29,30,29,30,30],2014:[18,31,31,32,32,31,30,30,29,30,29,30,30],2015:[17,31,32,31,32,31,30,30,30,29,29,30,31],2016:[17,31,31,31,32,31,31,29,30,30,29,30,30],2017:[18,31,31,32,31,31,31,30,29,30,29,30,30],2018:[18,31,32,31,32,31,30,30,29,30,29,30,30],2019:[17,31,32,31,32,31,30,30,30,29,30,29,31],2020:[17,31,31,31,32,31,31,30,29,30,29,30,30],2021:[18,31,31,32,31,31,31,30,29,30,29,30,30],2022:[17,31,32,31,32,31,30,30,30,29,29,30,30],2023:[17,31,32,31,32,31,30,30,30,29,30,29,31],2024:[17,31,31,31,32,31,31,30,29,30,29,30,30],2025:[18,31,31,32,31,31,31,30,29,30,29,30,30],2026:[17,31,32,31,32,31,30,30,30,29,29,30,31],2027:[17,30,32,31,32,31,30,30,30,29,30,29,31],2028:[17,31,31,32,31,31,31,30,29,30,29,30,30],2029:[18,31,31,32,31,32,30,30,29,30,29,30,30],2030:[17,31,32,31,32,31,30,30,30,30,30,30,31],2031:[17,31,32,31,32,31,31,31,31,31,31,31,31],2032:[17,32,32,32,32,32,32,32,32,32,32,32,32],2033:[18,31,31,32,32,31,30,30,29,30,29,30,30],2034:[17,31,32,31,32,31,30,30,30,29,29,30,31],2035:[17,30,32,31,32,31,31,29,30,30,29,29,31],2036:[17,31,31,32,31,31,31,30,29,30,29,30,30],2037:[18,31,31,32,32,31,30,30,29,30,29,30,30],2038:[17,31,32,31,32,31,30,30,30,29,29,30,31],2039:[17,31,31,31,32,31,31,29,30,30,29,30,30],2040:[17,31,31,32,31,31,31,30,29,30,29,30,30],2041:[18,31,31,32,32,31,30,30,29,30,29,30,30],2042:[17,31,32,31,32,31,30,30,30,29,29,30,31],2043:[17,31,31,31,32,31,31,29,30,30,29,30,30],2044:[17,31,31,32,31,31,31,30,29,30,29,30,30],2045:[18,31,32,31,32,31,30,30,29,30,29,30,30],2046:[17,31,32,31,32,31,30,30,30,29,29,30,31],2047:[17,31,31,31,32,31,31,30,29,30,29,30,30],2048:[17,31,31,32,31,31,31,30,29,30,29,30,30],2049:[17,31,32,31,32,31,30,30,30,29,29,30,30],2050:[17,31,32,31,32,31,30,30,30,29,30,29,31],2051:[17,31,31,31,32,31,31,30,29,30,29,30,30],2052:[17,31,31,32,31,31,31,30,29,30,29,30,30],2053:[17,31,32,31,32,31,30,30,30,29,29,30,30],2054:[17,31,32,31,32,31,30,30,30,29,30,29,31],2055:[17,31,31,32,31,31,31,30,29,30,30,29,30],2056:[17,31,31,32,31,32,30,30,29,30,29,30,30],2057:[17,31,32,31,32,31,30,30,30,29,29,30,31],2058:[17,30,32,31,32,31,30,30,30,29,30,29,31],2059:[17,31,31,32,31,31,31,30,29,30,29,30,30],2060:[17,31,31,32,32,31,30,30,29,30,29,30,30],2061:[17,31,32,31,32,31,30,30,30,29,29,30,31],2062:[17,30,32,31,32,31,31,29,30,29,30,29,31],2063:[17,31,31,32,31,31,31,30,29,30,29,30,30],2064:[17,31,31,32,32,31,30,30,29,30,29,30,30],2065:[17,31,32,31,32,31,30,30,30,29,29,30,31],2066:[17,31,31,31,32,31,31,29,30,30,29,29,31],2067:[17,31,31,32,31,31,31,30,29,30,29,30,30],2068:[17,31,31,32,32,31,30,30,29,30,29,30,30],2069:[17,31,32,31,32,31,30,30,30,29,29,30,31],2070:[17,31,31,31,32,31,31,29,30,30,29,30,30],2071:[17,31,31,32,31,31,31,30,29,30,29,30,30],2072:[17,31,32,31,32,31,30,30,29,30,29,30,30],2073:[17,31,32,31,32,31,30,30,30,29,29,30,31],2074:[17,31,31,31,32,31,31,30,29,30,29,30,30],2075:[17,31,31,32,31,31,31,30,29,30,29,30,30],2076:[16,31,32,31,32,31,30,30,30,29,29,30,30],2077:[17,31,32,31,32,31,30,30,30,29,30,29,31],2078:[17,31,31,31,32,31,31,30,29,30,29,30,30],2079:[17,31,31,32,31,31,31,30,29,30,29,30,30],2080:[16,31,32,31,32,31,30,30,30,29,29,30,30],2081:[17,31,31,32,32,31,30,30,30,29,30,30,30],2082:[17,31,32,31,32,31,30,30,30,29,30,30,30],2083:[17,31,31,32,31,31,30,30,30,29,30,30,30],2084:[17,31,31,32,31,31,30,30,30,29,30,30,30],2085:[17,31,32,31,32,31,31,30,30,29,30,30,30],2086:[17,31,32,31,32,31,30,30,30,29,30,30,30],2087:[16,31,31,32,31,31,31,30,30,29,30,30,30],2088:[16,30,31,32,32,30,31,30,30,29,30,30,30],2089:[17,31,32,31,32,31,30,30,30,29,30,30,30],2090:[17,31,32,31,32,31,30,30,30,29,30,30,30],2091:[16,31,31,32,31,31,31,30,30,29,30,30,30],2092:[16,31,31,32,32,31,30,30,30,29,30,30,30],2093:[17,31,32,31,32,31,30,30,30,29,30,30,30],2094:[17,31,31,32,31,31,30,30,30,29,30,30,30],2095:[17,31,31,32,31,31,31,30,29,30,30,30,30],2096:[17,30,31,32,32,31,30,30,29,30,29,30,30],2097:[17,31,32,31,32,31,30,30,30,29,30,30,30],2098:[17,31,31,32,31,31,31,29,30,29,30,30,31],2099:[17,31,31,32,31,31,31,30,29,29,30,30,30],2100:[17,31,32,31,32,30,31,30,29,30,29,30,30]}}),K.calendars.nepali=u}),$C=Vt(()=>{var K=lh(),V=of();function u(E){this.local=this.regionalOptions[E||""]||this.regionalOptions[""]}function d(E){var A=E-475;E<0&&A++;var t=.242197,e=t*A,r=t*(A+1),i=e-Math.floor(e),n=r-Math.floor(r);return i>n}u.prototype=new K.baseCalendar,V(u.prototype,{name:"Persian",jdEpoch:19483205e-1,daysPerMonth:[31,31,31,31,31,31,30,30,30,30,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Persian",epochs:["BP","AP"],monthNames:["Farvardin","Ordibehesht","Khordad","Tir","Mordad","Shahrivar","Mehr","Aban","Azar","Dey","Bahman","Esfand"],monthNamesShort:["Far","Ord","Kho","Tir","Mor","Sha","Meh","Aba","Aza","Dey","Bah","Esf"],dayNames:["Yekshanbeh","Doshanbeh","Seshanbeh","Chahārshanbeh","Panjshanbeh","Jom'eh","Shanbeh"],dayNamesShort:["Yek","Do","Se","Cha","Panj","Jom","Sha"],dayNamesMin:["Ye","Do","Se","Ch","Pa","Jo","Sh"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(E){var A=this._validate(E,this.minMonth,this.minDay,K.local.invalidYear);return d(A.year())},weekOfYear:function(E,A,t){var e=this.newDate(E,A,t);return e.add(-((e.dayOfWeek()+1)%7),"d"),Math.floor((e.dayOfYear()-1)/7)+1},daysInMonth:function(E,A){var t=this._validate(E,A,this.minDay,K.local.invalidMonth);return this.daysPerMonth[t.month()-1]+(t.month()===12&&this.leapYear(t.year())?1:0)},weekDay:function(E,A,t){return this.dayOfWeek(E,A,t)!==5},toJD:function(E,A,t){var e=this._validate(E,A,t,K.local.invalidDate);E=e.year(),A=e.month(),t=e.day();var r=0;if(E>0)for(var i=1;i0?E-1:E)*365+r+this.jdEpoch-1},fromJD:function(E){E=Math.floor(E)+.5;var A=475+(E-this.toJD(475,1,1))/365.242197,t=Math.floor(A);t<=0&&t--,E>this.toJD(t,12,d(t)?30:29)&&(t++,t===0&&t++);var e=E-this.toJD(t,1,1)+1,r=e<=186?Math.ceil(e/31):Math.ceil((e-6)/30),i=E-this.toJD(t,r,1)+1;return this.newDate(t,r,i)}}),K.calendars.persian=u,K.calendars.jalali=u}),JC=Vt(()=>{var K=lh(),V=of(),u=K.instance();function d(E){this.local=this.regionalOptions[E||""]||this.regionalOptions[""]}d.prototype=new K.baseCalendar,V(d.prototype,{name:"Taiwan",jdEpoch:24194025e-1,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},leapYear:function(t){var A=this._validate(t,this.minMonth,this.minDay,K.local.invalidYear),t=this._t2gYear(A.year());return u.leapYear(t)},weekOfYear:function(r,A,t){var e=this._validate(r,this.minMonth,this.minDay,K.local.invalidYear),r=this._t2gYear(e.year());return u.weekOfYear(r,e.month(),e.day())},daysInMonth:function(E,A){var t=this._validate(E,A,this.minDay,K.local.invalidMonth);return this.daysPerMonth[t.month()-1]+(t.month()===2&&this.leapYear(t.year())?1:0)},weekDay:function(E,A,t){return(this.dayOfWeek(E,A,t)||7)<6},toJD:function(r,A,t){var e=this._validate(r,A,t,K.local.invalidDate),r=this._t2gYear(e.year());return u.toJD(r,e.month(),e.day())},fromJD:function(E){var A=u.fromJD(E),t=this._g2tYear(A.year());return this.newDate(t,A.month(),A.day())},_t2gYear:function(E){return E+this.yearsOffset+(E>=-this.yearsOffset&&E<=-1?1:0)},_g2tYear:function(E){return E-this.yearsOffset-(E>=1&&E<=this.yearsOffset?1:0)}}),K.calendars.taiwan=d}),QC=Vt(()=>{var K=lh(),V=of(),u=K.instance();function d(E){this.local=this.regionalOptions[E||""]||this.regionalOptions[""]}d.prototype=new K.baseCalendar,V(d.prototype,{name:"Thai",jdEpoch:15230985e-1,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var A=this._validate(t,this.minMonth,this.minDay,K.local.invalidYear),t=this._t2gYear(A.year());return u.leapYear(t)},weekOfYear:function(r,A,t){var e=this._validate(r,this.minMonth,this.minDay,K.local.invalidYear),r=this._t2gYear(e.year());return u.weekOfYear(r,e.month(),e.day())},daysInMonth:function(E,A){var t=this._validate(E,A,this.minDay,K.local.invalidMonth);return this.daysPerMonth[t.month()-1]+(t.month()===2&&this.leapYear(t.year())?1:0)},weekDay:function(E,A,t){return(this.dayOfWeek(E,A,t)||7)<6},toJD:function(r,A,t){var e=this._validate(r,A,t,K.local.invalidDate),r=this._t2gYear(e.year());return u.toJD(r,e.month(),e.day())},fromJD:function(E){var A=u.fromJD(E),t=this._g2tYear(A.year());return this.newDate(t,A.month(),A.day())},_t2gYear:function(E){return E-this.yearsOffset-(E>=1&&E<=this.yearsOffset?1:0)},_g2tYear:function(E){return E+this.yearsOffset+(E>=-this.yearsOffset&&E<=-1?1:0)}}),K.calendars.thai=d}),tI=Vt(()=>{var K=lh(),V=of();function u(E){this.local=this.regionalOptions[E||""]||this.regionalOptions[""]}u.prototype=new K.baseCalendar,V(u.prototype,{name:"UmmAlQura",hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thalāthā’","Yawm al-Arba‘ā’","Yawm al-Khamīs","Yawm al-Jum‘a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!0}},leapYear:function(E){var A=this._validate(E,this.minMonth,this.minDay,K.local.invalidYear);return this.daysInYear(A.year())===355},weekOfYear:function(E,A,t){var e=this.newDate(E,A,t);return e.add(-e.dayOfWeek(),"d"),Math.floor((e.dayOfYear()-1)/7)+1},daysInYear:function(E){for(var A=0,t=1;t<=12;t++)A+=this.daysInMonth(E,t);return A},daysInMonth:function(E,A){for(var t=this._validate(E,A,this.minDay,K.local.invalidMonth),e=t.toJD()-24e5+.5,r=0,i=0;ie)return d[r]-d[r-1];r++}return 30},weekDay:function(E,A,t){return this.dayOfWeek(E,A,t)!==5},toJD:function(E,A,t){var e=this._validate(E,A,t,K.local.invalidDate),r=12*(e.year()-1)+e.month()-15292,i=e.day()+d[r-1]-1;return i+24e5-.5},fromJD:function(E){for(var A=E-24e5+.5,t=0,e=0;eA);e++)t++;var r=t+15292,i=Math.floor((r-1)/12),n=i+1,o=r-12*i,a=A-d[t-1]+1;return this.newDate(n,o,a)},isValid:function(E,A,t){var e=K.baseCalendar.prototype.isValid.apply(this,arguments);return e&&(E=E.year!=null?E.year:E,e=E>=1276&&E<=1500),e},_validate:function(E,A,t,e){var r=K.baseCalendar.prototype._validate.apply(this,arguments);if(r.year<1276||r.year>1500)throw e.replace(/\{0\}/,this.local.name);return r}}),K.calendars.ummalqura=u;var d=[20,50,79,109,138,168,197,227,256,286,315,345,374,404,433,463,492,522,551,581,611,641,670,700,729,759,788,818,847,877,906,936,965,995,1024,1054,1083,1113,1142,1172,1201,1231,1260,1290,1320,1350,1379,1409,1438,1468,1497,1527,1556,1586,1615,1645,1674,1704,1733,1763,1792,1822,1851,1881,1910,1940,1969,1999,2028,2058,2087,2117,2146,2176,2205,2235,2264,2294,2323,2353,2383,2413,2442,2472,2501,2531,2560,2590,2619,2649,2678,2708,2737,2767,2796,2826,2855,2885,2914,2944,2973,3003,3032,3062,3091,3121,3150,3180,3209,3239,3268,3298,3327,3357,3386,3416,3446,3476,3505,3535,3564,3594,3623,3653,3682,3712,3741,3771,3800,3830,3859,3889,3918,3948,3977,4007,4036,4066,4095,4125,4155,4185,4214,4244,4273,4303,4332,4362,4391,4421,4450,4480,4509,4539,4568,4598,4627,4657,4686,4716,4745,4775,4804,4834,4863,4893,4922,4952,4981,5011,5040,5070,5099,5129,5158,5188,5218,5248,5277,5307,5336,5366,5395,5425,5454,5484,5513,5543,5572,5602,5631,5661,5690,5720,5749,5779,5808,5838,5867,5897,5926,5956,5985,6015,6044,6074,6103,6133,6162,6192,6221,6251,6281,6311,6340,6370,6399,6429,6458,6488,6517,6547,6576,6606,6635,6665,6694,6724,6753,6783,6812,6842,6871,6901,6930,6960,6989,7019,7048,7078,7107,7137,7166,7196,7225,7255,7284,7314,7344,7374,7403,7433,7462,7492,7521,7551,7580,7610,7639,7669,7698,7728,7757,7787,7816,7846,7875,7905,7934,7964,7993,8023,8053,8083,8112,8142,8171,8201,8230,8260,8289,8319,8348,8378,8407,8437,8466,8496,8525,8555,8584,8614,8643,8673,8702,8732,8761,8791,8821,8850,8880,8909,8938,8968,8997,9027,9056,9086,9115,9145,9175,9205,9234,9264,9293,9322,9352,9381,9410,9440,9470,9499,9529,9559,9589,9618,9648,9677,9706,9736,9765,9794,9824,9853,9883,9913,9943,9972,10002,10032,10061,10090,10120,10149,10178,10208,10237,10267,10297,10326,10356,10386,10415,10445,10474,10504,10533,10562,10592,10621,10651,10680,10710,10740,10770,10799,10829,10858,10888,10917,10947,10976,11005,11035,11064,11094,11124,11153,11183,11213,11242,11272,11301,11331,11360,11389,11419,11448,11478,11507,11537,11567,11596,11626,11655,11685,11715,11744,11774,11803,11832,11862,11891,11921,11950,11980,12010,12039,12069,12099,12128,12158,12187,12216,12246,12275,12304,12334,12364,12393,12423,12453,12483,12512,12542,12571,12600,12630,12659,12688,12718,12747,12777,12807,12837,12866,12896,12926,12955,12984,13014,13043,13072,13102,13131,13161,13191,13220,13250,13280,13310,13339,13368,13398,13427,13456,13486,13515,13545,13574,13604,13634,13664,13693,13723,13752,13782,13811,13840,13870,13899,13929,13958,13988,14018,14047,14077,14107,14136,14166,14195,14224,14254,14283,14313,14342,14372,14401,14431,14461,14490,14520,14550,14579,14609,14638,14667,14697,14726,14756,14785,14815,14844,14874,14904,14933,14963,14993,15021,15051,15081,15110,15140,15169,15199,15228,15258,15287,15317,15347,15377,15406,15436,15465,15494,15524,15553,15582,15612,15641,15671,15701,15731,15760,15790,15820,15849,15878,15908,15937,15966,15996,16025,16055,16085,16114,16144,16174,16204,16233,16262,16292,16321,16350,16380,16409,16439,16468,16498,16528,16558,16587,16617,16646,16676,16705,16734,16764,16793,16823,16852,16882,16912,16941,16971,17001,17030,17060,17089,17118,17148,17177,17207,17236,17266,17295,17325,17355,17384,17414,17444,17473,17502,17532,17561,17591,17620,17650,17679,17709,17738,17768,17798,17827,17857,17886,17916,17945,17975,18004,18034,18063,18093,18122,18152,18181,18211,18241,18270,18300,18330,18359,18388,18418,18447,18476,18506,18535,18565,18595,18625,18654,18684,18714,18743,18772,18802,18831,18860,18890,18919,18949,18979,19008,19038,19068,19098,19127,19156,19186,19215,19244,19274,19303,19333,19362,19392,19422,19452,19481,19511,19540,19570,19599,19628,19658,19687,19717,19746,19776,19806,19836,19865,19895,19924,19954,19983,20012,20042,20071,20101,20130,20160,20190,20219,20249,20279,20308,20338,20367,20396,20426,20455,20485,20514,20544,20573,20603,20633,20662,20692,20721,20751,20780,20810,20839,20869,20898,20928,20957,20987,21016,21046,21076,21105,21135,21164,21194,21223,21253,21282,21312,21341,21371,21400,21430,21459,21489,21519,21548,21578,21607,21637,21666,21696,21725,21754,21784,21813,21843,21873,21902,21932,21962,21991,22021,22050,22080,22109,22138,22168,22197,22227,22256,22286,22316,22346,22375,22405,22434,22464,22493,22522,22552,22581,22611,22640,22670,22700,22730,22759,22789,22818,22848,22877,22906,22936,22965,22994,23024,23054,23083,23113,23143,23173,23202,23232,23261,23290,23320,23349,23379,23408,23438,23467,23497,23527,23556,23586,23616,23645,23674,23704,23733,23763,23792,23822,23851,23881,23910,23940,23970,23999,24029,24058,24088,24117,24147,24176,24206,24235,24265,24294,24324,24353,24383,24413,24442,24472,24501,24531,24560,24590,24619,24648,24678,24707,24737,24767,24796,24826,24856,24885,24915,24944,24974,25003,25032,25062,25091,25121,25150,25180,25210,25240,25269,25299,25328,25358,25387,25416,25446,25475,25505,25534,25564,25594,25624,25653,25683,25712,25742,25771,25800,25830,25859,25888,25918,25948,25977,26007,26037,26067,26096,26126,26155,26184,26214,26243,26272,26302,26332,26361,26391,26421,26451,26480,26510,26539,26568,26598,26627,26656,26686,26715,26745,26775,26805,26834,26864,26893,26923,26952,26982,27011,27041,27070,27099,27129,27159,27188,27218,27248,27277,27307,27336,27366,27395,27425,27454,27484,27513,27542,27572,27602,27631,27661,27691,27720,27750,27779,27809,27838,27868,27897,27926,27956,27985,28015,28045,28074,28104,28134,28163,28193,28222,28252,28281,28310,28340,28369,28399,28428,28458,28488,28517,28547,28577,28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]}),eI=Vt((K,V)=>{V.exports=lh(),jC(),UC(),VC(),HC(),qC(),WC(),GC(),ZC(),KC(),YC(),XC(),$C(),JC(),QC(),tI()}),rI=Vt((K,V)=>{var u=eI(),d=Xr(),E=ks(),A=E.EPOCHJD,t=E.ONEDAY,e={valType:"enumerated",values:d.sortObjectKeys(u.calendars),editType:"calc",dflt:"gregorian"},r=function(M,T,c,h){var b={};return b[c]=e,d.coerce(M,T,b,c,h)},i=function(M,T,c,h){for(var b=0;b{V.exports=rI()}),aI=Vt((K,V)=>{var u=D6();u.register([N6(),V6(),G6(),$6(),eA(),iA(),lA(),xA(),EA(),NA(),YA(),mS(),bS(),s8(),g8(),k8(),C8(),K8(),J8(),tE(),aE(),uE(),dE(),yE(),PE(),FE(),x9(),O9(),Z9(),Q9(),uz(),pz(),bz(),Oz(),Rz(),Gz(),sL(),pL(),_L(),HL(),$L(),rC(),sC(),fC(),gC(),kC(),LC(),NC(),nI()]),V.exports=u});return aI()})();return window.Plotly=gd,gd})})(Oy)),Oy.exports}var eP=tP();const q4=UI(eP);var rP=JI("
          ");function iP(Ig,n0){WI(n0,!1);const gd=U4();let dp=K_(n0,"value",12),mp=K_(n0,"show_label",12),a0=K_(n0,"loaded_plotly_css",12,!1),vd=U4(),hm;function Dy(){if(!a0()){hm=document.getElementById("plotly.js-style-global");const Uu=hm.cloneNode();Cg(vd).appendChild(Uu);for(const Pg of hm.sheet.cssRules)Uu.sheet.insertRule(Pg.cssText);a0(!0)}}GI(async()=>{Dy();let Uu=JSON.parse(Cg(gd));Uu.config=Uu.config||{},Uu.config.responsive=!0,Uu.responsive=!0,Uu.layout.autosize=!0,Uu.layout.margin==null&&(Uu.layout.margin={}),Uu.layout.title&&mp()&&(Uu.layout.margin.t=Math.max(100,Uu.layout.margin.t||0)),Uu.layout.margin.autoexpand=!0,q4.react(Cg(vd),Uu.data,Uu.layout,Uu.config),q4.Plots.resize(Cg(vd))}),ZI(()=>KI(dp()),()=>{V4(gd,dp()?.plot)}),YI();var i0={get value(){return dp()},set value(Uu){dp(Uu),Y_()},get show_label(){return mp()},set show_label(Uu){mp(Uu),Y_()},get loaded_plotly_css(){return a0()},set loaded_plotly_css(Uu){a0(Uu),Y_()}};VI();var pm=rP();return HI(pm,"data-testid","plotly"),qI(pm,Uu=>V4(vd,Uu),()=>Cg(vd)),XI(Ig,pm),$I(i0)}export{iP as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Plus-CDtuRS4x.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Plus-CDtuRS4x.js new file mode 100644 index 0000000000000000000000000000000000000000..09e6c68855b70301f632052524f949df1b2c3662 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Plus-CDtuRS4x.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as t,f as s}from"./index-DWyDLubb.js";var e=s('');function a(o){var r=e();t(o,r)}export{a as P}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ScrollFade-CIgHp1zY.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ScrollFade-CIgHp1zY.js new file mode 100644 index 0000000000000000000000000000000000000000..bbd2f18b4e429c937056bd97a16722295178010c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ScrollFade-CIgHp1zY.js @@ -0,0 +1 @@ +import{p as o,i as p,b as n}from"./i18n-Dnhn5Rxr.js";import{a6 as d,S as b,a as l,t as _,W as u}from"./index-DWyDLubb.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";var k=u("
          ");function x(r,s){let f=o(s,"visible",3,!1),m=o(s,"position",3,"sticky");var t=d(),c=b(t);{var v=a=>{var e=k();let i;_(()=>i=n(e,1,"scroll-fade svelte-kmbucf",null,i,{absolute:m()==="absolute"})),l(a,e)};p(c,a=>{f()&&a(v)})}l(r,t)}export{x as S}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ScrollFade-DV-0xzhB.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ScrollFade-DV-0xzhB.css new file mode 100644 index 0000000000000000000000000000000000000000..f43128a3753f07f16cdcf351a155548f4d4aa9eb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ScrollFade-DV-0xzhB.css @@ -0,0 +1 @@ +.block.svelte-1plpy97{position:relative;margin:0;box-shadow:var(--block-shadow);border-color:var(--block-border-color);border-radius:var(--block-radius);background:var(--block-background-fill);width:100%;line-height:var(--line-sm);border-width:var(--block-border-width)}.block.fullscreen.svelte-1plpy97{border-radius:0}.auto-margin.svelte-1plpy97{margin-left:auto;margin-right:auto}.block.border_focus.svelte-1plpy97{border-color:var(--color-accent)}.block.border_contrast.svelte-1plpy97{border-color:var(--body-text-color)}.padded.svelte-1plpy97{padding:var(--block-padding)}.flex.svelte-1plpy97{display:flex;flex-direction:column}.hidden.svelte-1plpy97{display:none}.hide-container.svelte-1plpy97:not(.fullscreen){margin:0;box-shadow:none;border-width:0;background:transparent;padding:0;overflow:visible}.resize-handle.svelte-1plpy97{position:absolute;bottom:0;right:0;width:10px;height:10px;fill:var(--block-border-color);cursor:nwse-resize}.fullscreen.svelte-1plpy97{position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:1000;overflow:auto}.animating.svelte-1plpy97{animation:svelte-1plpy97-pop-out .1s ease-out forwards}@keyframes svelte-1plpy97-pop-out{0%{position:fixed;top:var(--start-top);left:var(--start-left);width:var(--start-width);height:var(--start-height);z-index:100}to{position:fixed;top:0vh;left:0vw;width:100vw;height:100vh;z-index:1000}}.placeholder.svelte-1plpy97{border-radius:var(--block-radius);border-width:var(--block-border-width);border-color:var(--block-border-color);border-style:dashed}.info-text.svelte-9hc4ua{font-weight:var(--block-info-text-weight);font-size:var(--block-info-text-size);line-height:var(--line-sm);color:var(--block-info-text-color);margin-bottom:var(--spacing-md)}.info-text.svelte-9hc4ua a{color:var(--link-text-color);text-decoration:underline}.info-text.svelte-9hc4ua code{background:var(--code-background-fill);padding:.1em .3em;border-radius:3px;font-size:.9em}span.has-info.svelte-jdcl7l{margin-bottom:var(--spacing-xs)}span.svelte-jdcl7l:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-jdcl7l{display:inline-block;position:relative;z-index:var(--layer-4);border:solid var(--block-title-border-width) var(--block-title-border-color);border-radius:var(--block-title-radius);background:var(--block-title-background-fill);padding:var(--block-title-padding);color:var(--block-title-text-color);font-weight:var(--block-title-text-weight);font-size:var(--block-title-text-size);line-height:var(--line-sm)}span[dir=rtl].svelte-jdcl7l{display:block}.hide.svelte-jdcl7l{margin:0;height:0}.sr-only.svelte-jdcl7l{clip:rect(0,0,0,0);position:absolute;margin:-1px;border-width:0;padding:0;width:1px;height:1px;overflow:hidden;white-space:nowrap}label.svelte-19djge9{display:inline-flex;align-items:center;z-index:var(--layer-2);box-shadow:var(--block-label-shadow);border:var(--block-label-border-width) solid var(--block-label-border-color);border-top:none;border-left:none;border-radius:var(--block-label-radius);background:var(--block-label-background-fill);padding:var(--block-label-padding);pointer-events:none;color:var(--block-label-text-color);font-weight:var(--block-label-text-weight);font-size:var(--block-label-text-size);line-height:var(--line-sm)}.gr-group label.svelte-19djge9{border-top-left-radius:0}label.float.svelte-19djge9{position:absolute;top:var(--block-label-margin);left:var(--block-label-margin)}label.svelte-19djge9:not(.float){position:static;margin-top:var(--block-label-margin);margin-left:var(--block-label-margin)}.hide.svelte-19djge9{display:none}span.svelte-19djge9{opacity:.8;margin-right:var(--size-2);width:calc(var(--block-label-text-size) - 1px);height:calc(var(--block-label-text-size) - 1px)}.hide-label.svelte-19djge9{box-shadow:none;border-width:0;background:transparent;overflow:visible}label[dir=rtl].svelte-19djge9{border:var(--block-label-border-width) solid var(--block-label-border-color);border-top:none;border-right:none;border-bottom-left-radius:var(--block-radius);border-bottom-right-radius:var(--block-label-radius);border-top-left-radius:var(--block-label-radius)}label[dir=rtl].svelte-19djge9 span:where(.svelte-19djge9){margin-left:var(--size-2);margin-right:0}.unstyled-link.svelte-7nkusa{all:unset;cursor:pointer}button.svelte-3jwzs9{display:flex;justify-content:center;align-items:center;gap:1px;z-index:var(--layer-2);border-radius:var(--radius-xs);color:var(--block-label-text-color);border:1px solid var(--border-color);padding:var(--spacing-xxs)}button.svelte-3jwzs9:hover{background-color:var(--background-fill-secondary)}button[disabled].svelte-3jwzs9{opacity:.5;box-shadow:none}button[disabled].svelte-3jwzs9:hover{cursor:not-allowed}.padded.svelte-3jwzs9{background:var(--bg-color)}button.svelte-3jwzs9:hover,button.highlight.svelte-3jwzs9{cursor:pointer;color:var(--color-accent)}.padded.svelte-3jwzs9:hover{color:var(--block-label-text-color)}span.svelte-3jwzs9{padding:0 1px;font-size:10px}div.svelte-3jwzs9{display:flex;align-items:center;justify-content:center;transition:filter .2s ease-in-out}.x-small.svelte-3jwzs9{width:10px;height:10px}.small.svelte-3jwzs9{width:14px;height:14px}.medium.svelte-3jwzs9{width:20px;height:20px}.large.svelte-3jwzs9{width:22px;height:22px}.pending.svelte-3jwzs9{animation:svelte-3jwzs9-flash .5s infinite}@keyframes svelte-3jwzs9-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-3jwzs9{background:transparent;border:none;box-shadow:none}.empty.svelte-v95lt3{display:flex;justify-content:center;align-items:center;margin-top:calc(0px - var(--size-6));height:var(--size-full)}.icon.svelte-v95lt3{opacity:.5;height:var(--size-5);color:var(--body-text-color)}.small.svelte-v95lt3{min-height:calc(var(--size-32) - 20px)}.large.svelte-v95lt3{min-height:calc(var(--size-64) - 20px)}.unpadded_box.svelte-v95lt3{margin-top:0}.small_parent.svelte-v95lt3{min-height:100%!important}.dropdown-arrow.svelte-loyhyk,.dropdown-arrow.svelte-1w1fnc7{fill:currentColor}.circle.svelte-1w1fnc7{fill:currentColor;opacity:.1}svg.svelte-l5a973{animation:svelte-l5a973-spin 1.5s linear infinite}@keyframes svelte-l5a973-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}h2.svelte-1vmd51o{font-size:var(--text-xl)!important}p.svelte-1vmd51o,h2.svelte-1vmd51o{white-space:pre-line}.wrap.svelte-1vmd51o{display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:var(--size-60);color:var(--block-label-text-color);line-height:var(--line-md);height:100%;padding-top:var(--size-3);text-align:center;margin:auto var(--spacing-lg)}.or.svelte-1vmd51o{color:var(--body-text-color-subdued);display:flex}.icon-wrap.svelte-1vmd51o{width:30px;margin-bottom:var(--spacing-lg)}@media(min-width:768px){.wrap.svelte-1vmd51o{font-size:var(--text-lg)}}.hovered.svelte-1vmd51o{color:var(--color-accent)}.source-selection.svelte-exvkcd{display:flex;align-items:center;justify-content:center;border-top:1px solid var(--border-color-primary);width:100%;margin-left:auto;margin-right:auto;height:var(--size-10)}.icon.svelte-exvkcd{width:22px;height:22px;margin:var(--spacing-lg) var(--spacing-xs);padding:var(--spacing-xs);color:var(--neutral-400);border-radius:var(--radius-md)}.selected.svelte-exvkcd{color:var(--color-accent)}.icon.svelte-exvkcd:hover,.icon.svelte-exvkcd:focus{color:var(--color-accent)}.custom-button.svelte-gnx6f7{display:flex;align-items:center;justify-content:center;gap:var(--size-1);height:var(--size-6);padding:var(--size-1) var(--size-2);border:none;border-radius:var(--radius-sm);background:transparent;color:var(--block-title-text-color);cursor:pointer;transition:all .2s;font-size:var(--text-sm);margin-left:var(--size-1)}.custom-button.svelte-gnx6f7:hover{background:var(--background-fill-secondary);color:var(--body-text-color)}.custom-button-label.svelte-gnx6f7{white-space:nowrap}.icon-button-wrapper.svelte-1pnho82{display:flex;flex-direction:row;align-items:center;justify-content:center;z-index:var(--layer-2);gap:var(--spacing-sm);box-shadow:var(--shadow-drop);border:1px solid var(--border-color-primary);background:var(--block-background-fill);padding:var(--spacing-xxs)}.icon-button-wrapper.hide-top-corner.svelte-1pnho82{border-top:none;border-right:none;border-radius:var(--block-label-right-radius)}.icon-button-wrapper.display-top-corner.svelte-1pnho82{border-radius:var(--radius-sm) 0 0 var(--radius-sm);top:var(--spacing-sm);right:-1px}.icon-button-wrapper.svelte-1pnho82:not(.top-panel){border:1px solid var(--border-color-primary);border-radius:var(--radius-sm)}.top-panel.svelte-1pnho82{position:absolute;top:var(--block-label-margin);right:var(--block-label-margin);margin:0}.icon-button-wrapper.svelte-1pnho82 button{margin:var(--spacing-xxs);border-radius:var(--radius-xs);position:relative}.icon-button-wrapper.svelte-1pnho82 a.download-link:not(:last-child),.icon-button-wrapper.svelte-1pnho82 button:not(:last-child){margin-right:var(--spacing-xxs)}.icon-button-wrapper.svelte-1pnho82 a.download-link:not(:last-child):not(.no-border *):after,.icon-button-wrapper.svelte-1pnho82 button:not(:last-child):not(.no-border *):after{content:"";position:absolute;right:-4.5px;top:15%;height:70%;width:1px;background-color:var(--border-color-primary)}.icon-button-wrapper.svelte-1pnho82>*{height:100%}.icon-button-wrapper.no-background.svelte-1pnho82{box-shadow:none;border:none;background:none;padding:0;z-index:var(--layer-1)}.scroll-fade.svelte-kmbucf{position:sticky;bottom:calc(0px - var(--size-2-5));left:0;right:0;height:var(--size-6);background:linear-gradient(to top,var(--block-background-fill) 30%,transparent);pointer-events:none;margin-top:calc(0px - var(--size-6))}.scroll-fade.absolute.svelte-kmbucf{position:absolute;bottom:0;margin-top:0;z-index:var(--layer-2)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js new file mode 100644 index 0000000000000000000000000000000000000000..c82e908050d2cab45547ed0ef988a87bcbd5c1c1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js @@ -0,0 +1 @@ +import{B as Y,p as s,i as b,b as w,a as U,f as Z}from"./i18n-Dnhn5Rxr.js";import{p as D,E as G,h as J,e as K,t as k,a as n,X as p,W as g,V as d,aj as F,w as W,a5 as N,a0 as L,a6 as q,S as X,Y as v,f as V,R as O,T as Q}from"./index-DWyDLubb.js";import{s as $}from"./snippet-BWgYNF9D.js";function ee(r,e,c){J&&K();var x=new Y(r);D(()=>{var f=e()??null;x.ensure(f,f&&(u=>c(u,f)))},G)}var ae=g(' '),te=g("");function xe(r,e){let c=s(e,"label",3,""),x=s(e,"show_label",3,!1),f=s(e,"pending",3,!1),u=s(e,"size",3,"small"),m=s(e,"padded",3,!0),y=s(e,"highlight",3,!1),z=s(e,"disabled",3,!1),A=s(e,"hasPopup",3,!1),h=s(e,"color",3,"var(--block-label-text-color)"),C=s(e,"transparent",3,!1),H=s(e,"background",3,"var(--block-background-fill)"),E=s(e,"border",3,"transparent"),M=N(()=>y()?"var(--color-accent)":h());var i=te();let B;i.__click=function(...l){e.onclick?.apply(this,l)};let P;var j=d(i);{var I=l=>{var _=ae(),T=d(_,!0);v(_),k(()=>L(T,c())),n(l,_)};b(j,l=>{x()&&l(I)})}var S=p(j,2);let R;var t=d(S);ee(t,()=>e.Icon,(l,_)=>{_(l,{})});var a=p(t,2);{var o=l=>{var _=q(),T=X(_);$(T,()=>e.children),n(l,_)};b(a,l=>{e.children&&l(o)})}v(S),v(i),k(()=>{B=w(i,1,"icon-button svelte-3jwzs9",null,B,{pending:f(),padded:m(),highlight:y(),transparent:C()}),i.disabled=z(),U(i,"aria-label",c()),U(i,"aria-haspopup",A()),U(i,"title",c()),P=Z(i,"",P,{"--border-color":E(),color:!z()&&W(M)?W(M):"var(--block-label-text-color)","--bg-color":z()?"auto":H()}),R=w(S,1,"svelte-3jwzs9",null,R,{"x-small":u()==="x-small",small:u()==="small",large:u()==="large",medium:u()==="medium"})}),n(r,i)}F(["click"]);var le=V('');function oe(r){var e=le();n(r,e)}var re=V('');function se(r){var e=re();n(r,e)}var ne=V('');function ce(r){var e=ne();n(r,e)}var ie=V('');function de(r){var e=ie();n(r,e)}var ve=V('');function ue(r){var e=ve();n(r,e)}var he=g(''),_e=g(''),be=g(''),ge=g(''),fe=g(''),me=g(' ');function ye(r,e){O(e,!0);let c=s(e,"active_source",15),x=s(e,"handle_clear",3,()=>{}),f=s(e,"handle_select",3,()=>{}),u=N(()=>[...new Set(e.sources)]);async function m(h){x()(),c(h),f()(h)}var y=q(),z=X(y);{var A=h=>{var C=me(),H=d(C);{var E=t=>{var a=he();let o;a.__click=()=>m("upload");var l=d(a);ce(l),v(a),k(()=>o=w(a,1,"icon svelte-exvkcd",null,o,{selected:c()==="upload"||!c()})),n(t,a)};b(H,t=>{e.sources.includes("upload")&&t(E)})}var M=p(H,2);{var i=t=>{var a=_e();let o;a.__click=()=>m("microphone");var l=d(a);se(l),v(a),k(()=>o=w(a,1,"icon svelte-exvkcd",null,o,{selected:c()==="microphone"})),n(t,a)};b(M,t=>{e.sources.includes("microphone")&&t(i)})}var B=p(M,2);{var P=t=>{var a=be();let o;a.__click=()=>m("webcam");var l=d(a);ue(l),v(a),k(()=>o=w(a,1,"icon svelte-exvkcd",null,o,{selected:c()==="webcam"})),n(t,a)};b(B,t=>{e.sources.includes("webcam")&&t(P)})}var j=p(B,2);{var I=t=>{var a=ge();let o;a.__click=()=>m("webcam-video");var l=d(a);de(l),v(a),k(()=>o=w(a,1,"icon svelte-exvkcd",null,o,{selected:c()==="webcam-video"})),n(t,a)};b(j,t=>{e.sources.includes("webcam-video")&&t(I)})}var S=p(j,2);{var R=t=>{var a=fe();let o;a.__click=()=>m("clipboard");var l=d(a);oe(l),v(a),k(()=>o=w(a,1,"icon svelte-exvkcd",null,o,{selected:c()==="clipboard"})),n(t,a)};b(S,t=>{e.sources.includes("clipboard")&&t(R)})}v(C),n(h,C)};b(z,h=>{(W(u).length>1||e.sources.includes("clipboard"))&&h(A)})}n(r,y),Q()}F(["click"]);export{xe as I,se as M,ye as S,ce as U,de as V,ue as W,oe as a,ee as c}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Send-B_rl9Hxa.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Send-B_rl9Hxa.js new file mode 100644 index 0000000000000000000000000000000000000000..22a11c630694d453a0d83c7a0329894580e585e2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Send-B_rl9Hxa.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as C,f as o}from"./index-DWyDLubb.js";var M=o('');function i(L){var r=M();C(L,r)}export{i as S}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Settings-Bwz4Nb_m.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Settings-Bwz4Nb_m.js new file mode 100644 index 0000000000000000000000000000000000000000..8a8d906b14ad5244bdbeafc44e6bbcb056995dd1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Settings-Bwz4Nb_m.js @@ -0,0 +1,7 @@ +import{a as Y,q as be,z as he,m as ge,p as B,j as we,$ as _e,i as K,H as pe,I as fe,b as F}from"./i18n-Dnhn5Rxr.js";import{R as Q,S as Z,V as t,X as s,Y as a,t as P,a0 as d,Z as b,a as h,T as $,W as g,aa as ye,x as R,u as N,v as xe,w as u,a8 as L}from"./index-DWyDLubb.js";import{s as Ce}from"./Blocks-D6_IyY-z.js";import{C as ke}from"./clear-CEoTtSVi.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{b as Se}from"./Dropdown-Beu8JVME.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";/* empty css */import{C as O}from"./Checkbox-HhbcVSTv.js";import"./html-Ih_5QVTo.js";import"./size-CtOeLwIl.js";import"./state.svelte-CXxGByZZ.js";import"./index-CglBvmLb.js";import"./Clear-BF6j078A.js";import"./utils.svelte-CCyS_0CY.js";import"./clone-BkeCM4Nl.js";import"./index-DkrWwIux.js";import"./index-tFQomdd2.js";import"./snippet-BWgYNF9D.js";import"./input-DrerMDOL.js";import"./window-Uydxco8n.js";import"./BlockTitle-BMm9LakX.js";import"./Info-Dzjhnd64.js";import"./DropdownArrow-BOSZEGSp.js";import"./IconButtonWrapper-D0s9l4wW.js";import"./index-B_pwUImq.js";import"./universal-CFOISHmx.js";var Re=g('

          ',1);function Le(z,o){Q(o,!0);const i=()=>be(he,"$_",w),[w,_]=ge();var m=Re(),c=Z(m),n=t(c),p=s(n,2),f=t(p),y=s(f),x=t(y,!0);a(y),a(p),a(c);var v=s(c,2),T=t(v);ke(T),a(v),P(C=>{Y(n,"src",Ce),d(f,`${C??""} `),d(x,o.root)},[()=>i()("common.settings")]),b("click",v,()=>o.onclose?.()),h(z,m),$(),_()}const Pe="data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='%23000000'%3e%3cg%20id='SVGRepo_bgCarrier'%20stroke-width='0'%3e%3c/g%3e%3cg%20id='SVGRepo_tracerCarrier'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3c/g%3e%3cg%20id='SVGRepo_iconCarrier'%3e%3ctitle%3erecord%20[%23982]%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3c/defs%3e%3cg%20id='Page-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='Dribbble-Light-Preview'%20transform='translate(-380.000000,%20-3839.000000)'%20fill='%23808080'%3e%3cg%20id='icons'%20transform='translate(56.000000,%20160.000000)'%3e%3cpath%20d='M338,3689%20C338,3691.209%20336.209,3693%20334,3693%20C331.791,3693%20330,3691.209%20330,3689%20C330,3686.791%20331.791,3685%20334,3685%20C336.209,3685%20338,3686.791%20338,3689%20M334,3697%20C329.589,3697%20326,3693.411%20326,3689%20C326,3684.589%20329.589,3681%20334,3681%20C338.411,3681%20342,3684.589%20342,3689%20C342,3693.411%20338.411,3697%20334,3697%20M334,3679%20C328.477,3679%20324,3683.477%20324,3689%20C324,3694.523%20328.477,3699%20334,3699%20C339.523,3699%20344,3694.523%20344,3689%20C344,3683.477%20339.523,3679%20334,3679'%20id='record-[%23982]'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e";var ze=g(''),Te=g('You can install this app as a Progressive Web App on your device. Visit
          and click the install button in the URL address bar of your browser.',1),Ve=g(`Progressive Web App is not enabled for this app. To enable it, start your + Gradio app with launch(pwa=True).`,1),Ge=g(` `,1);function it(z,o){Q(o,!0);let i=B(o,"root",7),w=B(o,"allow_zoom",15),_=B(o,"allow_video_trim",15);i()===""&&i(location.protocol+"//"+location.host+location.pathname),i().endsWith("/")||i(i()+"/");function m(e){const r=new URL(window.location.href);e==="system"?(r.searchParams.delete("__theme"),R(n,"system")):(r.searchParams.set("__theme",e),R(n,e,!0)),r.searchParams.delete("view"),window.location.href=r.toString()}ye(()=>{"parentIFrame"in window&&window.parentIFrame?.scrollTo(0,0);const r=new URL(window.location.href).searchParams.get("__theme");return R(n,r||"system",!0),()=>{document.body.style.overflow="auto"}});let c=N(xe(we(_e)??"en")),n=N("system");function p(e){fe(e)}function f(e){w(e.detail)}function y(e){_(e.detail)}var x=Ge(),v=Z(x),T=t(v);Le(T,{onclose:()=>o.onclose(),get root(){return i()}}),a(v);var C=s(v,2);{var ee=e=>{var r=ze(),l=t(r),j=t(l,!0);a(l);var J=s(l,2),k=t(J),ve=t(k);a(k);var S=s(k,2),de=t(S);a(S);var A=s(S,2),me=t(A);a(A),a(J),a(r),P(ue=>{d(j,ue),F(k,1,`theme-button ${u(n)==="light"?"current-theme":"inactive-theme"}`,"svelte-1t60wb3"),F(S,1,`theme-button ${u(n)==="dark"?"current-theme":"inactive-theme"}`,"svelte-1t60wb3"),F(A,1,`theme-button ${u(n)==="system"?"current-theme":"inactive-theme"}`,"svelte-1t60wb3")},[()=>o.i18n("common.display_theme")]),b("click",ve,()=>m("light")),b("click",de,()=>m("dark")),b("click",me,()=>m("system")),h(e,r)};K(C,e=>{o.space_id===null&&e(ee)})}var V=s(C,2),G=t(V),te=t(G,!0);a(G);var q=s(G,2),ae=t(q);Se(ae,{label:"Language",get choices(){return pe},show_label:!1,on_change:()=>p(u(c)),get value(){return u(c)},set value(e){R(c,e,!0)}}),a(q),a(V);var I=s(V,2),M=t(I),re=t(M,!0);a(M);var H=s(M,2),oe=t(H);{var se=e=>{var r=Te(),l=s(Z(r)),j=t(l,!0);a(l),L(),P(()=>{Y(l,"href",i()),d(j,i())}),h(e,r)},ie=e=>{var r=Ve();L(2),h(e,r)};K(oe,e=>{o.pwa_enabled?e(se):e(ie,!1)})}a(H),a(I);var X=s(I,2),U=t(X),ne=t(U);L(),a(U);var W=s(U,2),E=s(t(W),13);O(E,{label:"Include automatic zoom in/out",interactive:!0,get value(){return w()},$$events:{change:f}});var le=s(E,2);O(le,{label:"Include automatic video trimming",interactive:!0,get value(){return _()},$$events:{change:y}}),a(W);var D=s(W,2),ce=t(D);L(),a(D),a(X),P((e,r,l)=>{d(te,e),d(re,r),d(ne,`${l??""} `),Y(ce,"src",Pe)},[()=>o.i18n("common.language"),()=>o.i18n("common.pwa"),()=>o.i18n("common.screen_studio")]),b("click",D,()=>{o.onclose?.(),o.start_recording?.()}),h(z,x),$()}export{it as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Settings-CLQaonub.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Settings-CLQaonub.css new file mode 100644 index 0000000000000000000000000000000000000000..eec2a16844aaebf9e91aa8afc9d9a952a51d10fe --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Settings-CLQaonub.css @@ -0,0 +1 @@ +h2.svelte-xaoy31{display:flex;color:var(--body-text-color);font-weight:var(--weight-semibold);font-size:var(--text-xl);gap:var(--size-3)}h2.svelte-xaoy31 img:where(.svelte-xaoy31){width:var(--size-4);display:inline-block;margin-top:.1rem}.url.svelte-xaoy31{color:var(--color-accent);font-weight:400}button.svelte-xaoy31{position:absolute;top:var(--size-5);right:var(--size-6);width:var(--size-4);color:var(--body-text-color)}button.svelte-xaoy31:hover{color:var(--color-accent)}@media(min-width:768px){button.svelte-xaoy31{top:var(--size-6)}h2.svelte-xaoy31 img:where(.svelte-xaoy31){width:var(--size-5)}}.title.svelte-xaoy31{display:flex;flex-direction:row;gap:.5rem}.banner-wrap.svelte-1t60wb3{position:relative;border-bottom:1px solid var(--border-color-primary);padding:var(--size-4) var(--size-6);font-size:var(--text-md)}.banner-wrap.svelte-1t60wb3 h2:where(.svelte-1t60wb3){font-size:var(--text-xl)}a.svelte-1t60wb3{text-decoration:underline}p.padded.svelte-1t60wb3{padding:15px 0}.theme-buttons.svelte-1t60wb3{display:flex;align-items:center}.theme-buttons.svelte-1t60wb3>:where(.svelte-1t60wb3)+:where(.svelte-1t60wb3){margin-left:var(--size-2)}.theme-button.svelte-1t60wb3,.record-button.svelte-1t60wb3{display:flex;align-items:center;border:1px solid var(--border-color-primary);border-radius:var(--radius-md);padding:var(--size-2) var(--size-2-5);line-height:1;user-select:none;text-transform:capitalize;cursor:pointer}.record-button.svelte-1t60wb3 img:where(.svelte-1t60wb3){margin-right:var(--size-1);margin-left:var(--size-1);width:var(--size-3)}.record-button.svelte-1t60wb3:hover{border-color:red}.current-theme.svelte-1t60wb3{border:1px solid var(--body-text-color-subdued);color:var(--body-text-color)}.inactive-theme.svelte-1t60wb3{color:var(--body-text-color-subdued)}.inactive-theme.svelte-1t60wb3:hover,.inactive-theme.svelte-1t60wb3:focus{box-shadow:var(--shadow-drop);color:var(--body-text-color)}.theme-button.svelte-1t60wb3 button:where(.svelte-1t60wb3){all:unset;cursor:pointer}.beta-tag.svelte-1t60wb3{position:relative;top:-5px;font-size:var(--text-xs);background-color:var(--color-accent);color:#fff;padding:2px 6px;border-radius:10px;margin-left:5px;font-weight:400;text-transform:uppercase} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ShareButton-wCSP7LoP.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ShareButton-wCSP7LoP.js new file mode 100644 index 0000000000000000000000000000000000000000..92e8b2afaa409525ee404cb233f846d672a699a2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ShareButton-wCSP7LoP.js @@ -0,0 +1 @@ +import{p as l,e as h}from"./i18n-Dnhn5Rxr.js";import{a as d,f as v,R as w,a4 as S,x as m,w as f,T as _,a3 as x,U as u,ad as y,G as A,z as Z}from"./index-DWyDLubb.js";import{I as B}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{S as C}from"./utils.svelte-CCyS_0CY.js";var I=v('');function M(s){var a=I();d(s,a)}function z(s,a){w(a,!1);const c=S();let n=l(a,"formatter",12),o=l(a,"value",12),r=l(a,"i18n",12),i=x(!1);var g={get formatter(){return n()},set formatter(e){n(e),u()},get value(){return o()},set value(e){o(e),u()},get i18n(){return r()},set i18n(e){r(e),u()}};h();{let e=y(()=>(A(r()),Z(()=>r()("common.share"))));B(s,{get Icon(){return M},get label(){return f(e)},get pending(){return f(i)},onclick:async()=>{try{m(i,!0);const t=await n()(o());c("share",{description:t})}catch(t){console.error(t);let p=t instanceof C?t.message:"Share failed.";c("error",p)}finally{m(i,!1)}}})}return _(g)}export{M as C,z as S}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/SharedSystems-D1plL92C.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/SharedSystems-D1plL92C.js new file mode 100644 index 0000000000000000000000000000000000000000..fd9563870b8eed7272bf840f87454b4142b98be7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/SharedSystems-D1plL92C.js @@ -0,0 +1,326 @@ +import{F as Oe,v as Fe,l as ie,M as g,x as Le,y as He,S as We,z as oe,E as u,e as F,H as w,I as ze,J as L,K as y,R as H,L as le,N as Ve,t as m,b as f,i as G,w as W,O as X,Q as Ne,c as Q,B as k,j as A,V as je,u as M,k as S,W as P,X as qe,a as $e,Y as ue,Z as de,_ as ce,$ as he,C as U,a0 as Ke,a1 as I,a2 as Z,D as z,a3 as Ye,a4 as Je,P as Xe,d as Qe,T as ee,a5 as te,a6 as v,a7 as Ze,a8 as et}from"./Index-cYuhm-BK.js";import{B as fe,c as tt}from"./colorToUniform-3MxHuUz8.js";var rt=`in vec2 vMaskCoord; +in vec2 vTextureCoord; + +uniform sampler2D uTexture; +uniform sampler2D uMaskTexture; + +uniform float uAlpha; +uniform vec4 uMaskClamp; +uniform float uInverse; + +out vec4 finalColor; + +void main(void) +{ + float clip = step(3.5, + step(uMaskClamp.x, vMaskCoord.x) + + step(uMaskClamp.y, vMaskCoord.y) + + step(vMaskCoord.x, uMaskClamp.z) + + step(vMaskCoord.y, uMaskClamp.w)); + + // TODO look into why this is needed + float npmAlpha = uAlpha; + vec4 original = texture(uTexture, vTextureCoord); + vec4 masky = texture(uMaskTexture, vMaskCoord); + float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a); + + float a = alphaMul * masky.r * npmAlpha * clip; + + if (uInverse == 1.0) { + a = 1.0 - a; + } + + finalColor = original * a; +} +`,st=`in vec2 aPosition; + +out vec2 vTextureCoord; +out vec2 vMaskCoord; + + +uniform vec4 uInputSize; +uniform vec4 uOutputFrame; +uniform vec4 uOutputTexture; +uniform mat3 uFilterMatrix; + +vec4 filterVertexPosition( vec2 aPosition ) +{ + vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; + + position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +vec2 filterTextureCoord( vec2 aPosition ) +{ + return aPosition * (uOutputFrame.zw * uInputSize.zw); +} + +vec2 getFilterCoord( vec2 aPosition ) +{ + return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; +} + +void main(void) +{ + gl_Position = filterVertexPosition(aPosition); + vTextureCoord = filterTextureCoord(aPosition); + vMaskCoord = getFilterCoord(aPosition); +} +`,re=`struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct MaskUniforms { + uFilterMatrix:mat3x3, + uMaskClamp:vec4, + uAlpha:f32, + uInverse:f32, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; + +@group(1) @binding(0) var filterUniforms : MaskUniforms; +@group(1) @binding(1) var uMaskTexture: texture_2d; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2, + @location(1) filterUv : vec2, +}; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord( aPosition:vec2 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getFilterCoord(aPosition:vec2 ) -> vec2 +{ + return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; +} + +fn getSize() -> vec2 +{ + return gfu.uGlobalFrame.zw; +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition), + getFilterCoord(aPosition) + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @location(1) filterUv: vec2, + @builtin(position) position: vec4 +) -> @location(0) vec4 { + + var maskClamp = filterUniforms.uMaskClamp; + var uAlpha = filterUniforms.uAlpha; + + var clip = step(3.5, + step(maskClamp.x, filterUv.x) + + step(maskClamp.y, filterUv.y) + + step(filterUv.x, maskClamp.z) + + step(filterUv.y, maskClamp.w)); + + var mask = textureSample(uMaskTexture, uSampler, filterUv); + var source = textureSample(uTexture, uSampler, uv); + var alphaMul = 1.0 - uAlpha * (1.0 - mask.a); + + var a: f32 = alphaMul * mask.r * uAlpha * clip; + + if (filterUniforms.uInverse == 1.0) { + a = 1.0 - a; + } + + return source * a; +} +`;class at extends Oe{constructor(e){const{sprite:t,...r}=e,s=new Fe(t.texture),a=new ie({uFilterMatrix:{value:new g,type:"mat3x3"},uMaskClamp:{value:s.uClampFrame,type:"vec4"},uAlpha:{value:1,type:"f32"},uInverse:{value:e.inverse?1:0,type:"f32"}}),i=Le.from({vertex:{source:re,entryPoint:"mainVertex"},fragment:{source:re,entryPoint:"mainFragment"}}),o=He.from({vertex:st,fragment:rt,name:"mask-filter"});super({...r,gpuProgram:i,glProgram:o,clipToViewport:!1,resources:{filterUniforms:a,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=s}set inverse(e){this.resources.filterUniforms.uniforms.uInverse=e?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(e,t,r,s){this._textureMatrix.texture=this.sprite.texture,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,e.applyFilter(this,t,r,s)}}const V=class pe{constructor(e,t){this.state=We.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=t,this._adaptor.init?.(this)}static getBatcher(e){return new this._availableBatchers[e]}buildStart(e){let t=this._batchersByInstructionSet[e.uid];t||(t=this._batchersByInstructionSet[e.uid]=Object.create(null),t.default||(t.default=new oe({maxTextures:this.renderer.limits.maxBatchableTextures}))),this._activeBatches=t,this._activeBatch=this._activeBatches.default;for(const r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(e,t){if(this._activeBatch.name!==e.batcherName){this._activeBatch.break(t);let r=this._activeBatches[e.batcherName];r||(r=this._activeBatches[e.batcherName]=pe.getBatcher(e.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);const t=this._activeBatches;for(const r in t){const s=t[r],a=s.geometry;a.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),a.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(e){const t=this._batchersByInstructionSet[e.uid];for(const r in t){const s=t[r],a=s.geometry;s.dirty&&(s.dirty=!1,a.buffers[0].update(s.attributeSize*4))}}execute(e){if(e.action==="startBatch"){const t=e.batcher,r=t.geometry,s=t.shader;this._adaptor.start(this,r,s)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(const e in this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}};V.extension={type:[u.WebGLPipes,u.WebGPUPipes,u.CanvasPipes],name:"batch"};V._availableBatchers=Object.create(null);let me=V;F.handleByMap(u.Batcher,me._availableBatchers);F.add(oe);const At={name:"texture-bit",vertex:{header:` + + struct TextureUniforms { + uTextureMatrix:mat3x3, + } + + @group(2) @binding(2) var textureUniforms : TextureUniforms; + `,main:` + uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy; + `},fragment:{header:` + @group(2) @binding(0) var uTexture: texture_2d; + @group(2) @binding(1) var uSampler: sampler; + + + `,main:` + outColor = textureSample(uTexture, uSampler, vUV); + `}},It={name:"texture-bit",vertex:{header:` + uniform mat3 uTextureMatrix; + `,main:` + uv = (uTextureMatrix * vec3(uv, 1.0)).xy; + `},fragment:{header:` + uniform sampler2D uTexture; + + + `,main:` + outColor = texture(uTexture, vUV); + `}},nt=new L;class it extends le{constructor(){super(),this.filters=[new at({sprite:new Ve(m.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].sprite=e}get inverse(){return this.filters[0].inverse}set inverse(e){this.filters[0].inverse=e}}class ge{constructor(e){this._activeMaskStage=[],this._renderer=e}push(e,t,r){const s=this._renderer;if(s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1,maskedContainer:t}),e.inverse=t._maskOptions.inverse,e.renderMaskToTexture){const a=e.mask;a.includeInBuild=!0,a.collectRenderables(r,s,null),a.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){const t=this._renderer,r=e.mask.renderMaskToTexture;if(e.action==="pushMaskBegin"){const s=w.get(it);if(s.inverse=e.inverse,r){e.mask.mask.measurable=!0;const a=ze(e.mask.mask,!0,nt);e.mask.mask.measurable=!1,a.ceil();const i=t.renderTarget.renderTarget.colorTexture.source,o=y.getOptimalTexture(a.width,a.height,i._resolution,i.antialias);t.renderTarget.push(o,!0),t.globalUniforms.push({offset:a,worldColor:4294967295});const l=s.sprite;l.texture=o,l.worldTransform.tx=a.minX,l.worldTransform.ty=a.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:e.maskedContainer,filterTexture:o})}else s.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:e.maskedContainer})}else if(e.action==="pushMaskEnd"){const s=this._activeMaskStage[this._activeMaskStage.length-1];r&&(t.type===H.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(e.action==="popMaskEnd"){t.filter.pop();const s=this._activeMaskStage.pop();r&&y.returnTexture(s.filterTexture),w.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}ge.extension={type:[u.WebGLPipes,u.WebGPUPipes,u.CanvasPipes],name:"alphaMask"};class _e{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,r){this._renderer.renderPipes.batch.break(r);const a=this._colorStack;a[this._colorStackIndex]=a[this._colorStackIndex-1]&e.mask;const i=this._colorStack[this._colorStackIndex];i!==this._currentColor&&(this._currentColor=i,r.add({renderPipeId:"colorMask",colorMask:i,canBundle:!1})),this._colorStackIndex++}pop(e,t,r){this._renderer.renderPipes.batch.break(r);const a=this._colorStack;this._colorStackIndex--;const i=a[this._colorStackIndex-1];i!==this._currentColor&&(this._currentColor=i,r.add({renderPipeId:"colorMask",colorMask:i,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._renderer=null,this._colorStack=null}}_e.extension={type:[u.WebGLPipes,u.WebGPUPipes,u.CanvasPipes],name:"colorMask"};class ve{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,r){var s;const a=e,i=this._renderer;i.renderPipes.batch.break(r),i.renderPipes.blendMode.setBlendMode(a.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});const o=a.mask;o.includeInBuild=!0,this._maskHash.has(a)||this._maskHash.set(a,{instructionsStart:0,instructionsLength:0});const l=this._maskHash.get(a);l.instructionsStart=r.instructionSize,o.collectRenderables(r,i,null),o.includeInBuild=!1,i.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});const d=r.instructionSize-l.instructionsStart-1;l.instructionsLength=d;const c=i.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(e,t,r){const s=e,a=this._renderer;a.renderPipes.batch.break(r),a.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:t._maskOptions.inverse,canBundle:!1});const i=this._maskHash.get(e);for(let o=0;oe.uniformStructures[o]),a=this._adaptor.createUboElements(s),i=this._generateUboSync(a.uboElements);r=this._syncFunctionHash[t]={layout:a,syncFunction:i}}return this._syncFunctionHash[t]}_generateUboSync(e){return this._adaptor.generateUboSync(e)}syncUniformGroup(e,t,r){const s=this.getUniformGroupData(e);e.buffer||(e.buffer=new Q({data:new Float32Array(s.layout.size/4),usage:k.UNIFORM|k.COPY_DST}));let a=null;return t||(t=e.buffer.data,a=e.buffer.dataInt32),r||(r=0),s.syncFunction(e.uniforms,t,a,r),!0}updateUniformGroup(e){if(e.isStatic&&!e._dirtyId)return!1;e._dirtyId=0;const t=this.syncUniformGroup(e);return e.buffer.update(),t}destroy(){this._syncFunctionHash=null}}const C=[{type:"mat3x3",test:n=>n.value.a!==void 0,ubo:` + var matrix = uv[name].toArray(true); + data[offset] = matrix[0]; + data[offset + 1] = matrix[1]; + data[offset + 2] = matrix[2]; + data[offset + 4] = matrix[3]; + data[offset + 5] = matrix[4]; + data[offset + 6] = matrix[5]; + data[offset + 8] = matrix[6]; + data[offset + 9] = matrix[7]; + data[offset + 10] = matrix[8]; + `,uniform:` + gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true)); + `},{type:"vec4",test:n=>n.type==="vec4"&&n.size===1&&n.value.width!==void 0,ubo:` + v = uv[name]; + data[offset] = v.x; + data[offset + 1] = v.y; + data[offset + 2] = v.width; + data[offset + 3] = v.height; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) { + cv[0] = v.x; + cv[1] = v.y; + cv[2] = v.width; + cv[3] = v.height; + gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height); + } + `},{type:"vec2",test:n=>n.type==="vec2"&&n.size===1&&n.value.x!==void 0,ubo:` + v = uv[name]; + data[offset] = v.x; + data[offset + 1] = v.y; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.x || cv[1] !== v.y) { + cv[0] = v.x; + cv[1] = v.y; + gl.uniform2f(ud[name].location, v.x, v.y); + } + `},{type:"vec4",test:n=>n.type==="vec4"&&n.size===1&&n.value.red!==void 0,ubo:` + v = uv[name]; + data[offset] = v.red; + data[offset + 1] = v.green; + data[offset + 2] = v.blue; + data[offset + 3] = v.alpha; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + cv[3] = v.alpha; + gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha); + } + `},{type:"vec3",test:n=>n.type==="vec3"&&n.size===1&&n.value.red!==void 0,ubo:` + v = uv[name]; + data[offset] = v.red; + data[offset + 1] = v.green; + data[offset + 2] = v.blue; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + gl.uniform3f(ud[name].location, v.red, v.green, v.blue); + } + `}];function Ot(n,e,t,r){const s=[` + var v = null; + var v2 = null; + var t = 0; + var index = 0; + var name = null; + var arrayOffset = null; + `];let a=0;for(let o=0;o1)h=l.offset/4,s.push(t(l,h-a));else{const p=r[l.data.type];h=l.offset/4,s.push(` + v = uv.${d}; + offset += ${h-a}; + ${p}; + `)}a=h}const i=s.join(` +`);return new Function("uv","data","dataInt32","offset",i)}function _(n,e){return` + for (let i = 0; i < ${n*e}; i++) { + data[offset + (((i / ${n})|0) * 4) + (i % ${n})] = v[i]; + } + `}const lt={f32:` + data[offset] = v;`,i32:` + dataInt32[offset] = v;`,"vec2":` + data[offset] = v[0]; + data[offset + 1] = v[1];`,"vec3":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2];`,"vec4":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2]; + data[offset + 3] = v[3];`,"vec2":` + dataInt32[offset] = v[0]; + dataInt32[offset + 1] = v[1];`,"vec3":` + dataInt32[offset] = v[0]; + dataInt32[offset + 1] = v[1]; + dataInt32[offset + 2] = v[2];`,"vec4":` + dataInt32[offset] = v[0]; + dataInt32[offset + 1] = v[1]; + dataInt32[offset + 2] = v[2]; + dataInt32[offset + 3] = v[3];`,"mat2x2":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 4] = v[2]; + data[offset + 5] = v[3];`,"mat3x3":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2]; + data[offset + 4] = v[3]; + data[offset + 5] = v[4]; + data[offset + 6] = v[5]; + data[offset + 8] = v[6]; + data[offset + 9] = v[7]; + data[offset + 10] = v[8];`,"mat4x4":` + for (let i = 0; i < 16; i++) { + data[offset + i] = v[i]; + }`,"mat3x2":_(3,2),"mat4x2":_(4,2),"mat2x3":_(2,3),"mat4x3":_(4,3),"mat2x4":_(2,4),"mat3x4":_(3,4)},Ft={...lt,"mat2x2":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2]; + data[offset + 3] = v[3]; + `};function ut(n,e,t,r,s,a){const i=a?1:-1;return n.identity(),n.a=1/r*2,n.d=i*(1/s*2),n.tx=-1-e*n.a,n.ty=-i-t*n.d,n}const x=new Map;je.register(x);function xe(n,e){if(!x.has(n)){const t=new m({source:new A({resource:n,...e})}),r=()=>{x.get(n)===t&&x.delete(n)};t.once("destroy",r),t.source.once("destroy",r),x.set(n,t)}return x.get(n)}function dt(n){const e=n.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}const be=class ye{constructor(e={}){if(this.uid=M("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,e={...ye.defaultOptions,...e},this.stencil=e.stencil,this.depth=e.depth,this.isRoot=e.isRoot,typeof e.colorTextures=="number"){this._managedColorTextures=!0;for(let t=0;tr.source)];const t=this.colorTexture.source;this.resize(t.width,t.height,t._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(e.depthStencilTexture||this.stencil)&&(e.depthStencilTexture instanceof m||e.depthStencilTexture instanceof S?this.depthStencilTexture=e.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){const e=this._size;return e[0]=this.pixelWidth,e[1]=this.pixelHeight,e}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(e){this.resize(e.width,e.height,e._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new S({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(e,t,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((a,i)=>{s&&i===0||a.source.resize(e,t,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(e,t,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(e=>{e.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};be.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let D=be;class Lt{constructor(e){this.rootViewPort=new P,this.viewport=new P,this.onRenderTargetChange=new qe("onRenderTargetChange"),this.projectionMatrix=new g,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=e,e.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:e,clear:t,clearColor:r,frame:s}){this._renderTargetStack.length=0,this.push(e,t,r,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=dt(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(e,t=!0,r,s){const a=this.getRenderTarget(e),i=this.renderTarget!==a;this.renderTarget=a,this.renderSurface=e;const o=this.getGpuRenderTarget(a);(a.pixelWidth!==o.width||a.pixelHeight!==o.height)&&(this.adaptor.resizeGpuRenderTarget(a),o.width=a.pixelWidth,o.height=a.pixelHeight);const l=a.colorTexture,d=this.viewport,c=l.pixelWidth,h=l.pixelHeight;if(!s&&e instanceof m&&(s=e.frame),s){const p=l._resolution;d.x=s.x*p+.5|0,d.y=s.y*p+.5|0,d.width=s.width*p+.5|0,d.height=s.height*p+.5|0}else d.x=0,d.y=0,d.width=c,d.height=h;return ut(this.projectionMatrix,0,0,d.width/l.resolution,d.height/l.resolution,!a.isRoot),this.adaptor.startRenderPass(a,t,r,d),i&&this.onRenderTargetChange.emit(a),a}clear(e,t=G.ALL,r){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=G.ALL,r,s){const a=this.bind(e,t,r,s);return this._renderTargetStack.push({renderTarget:a,frame:s}),a}pop(){this._renderTargetStack.pop();const e=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(e.renderTarget,!1,null,e.frame)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,t,r,s,a){r.x<0&&(s.width+=r.x,a.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,a.y-=r.y,r.y=0);const{pixelWidth:i,pixelHeight:o}=e;return s.width=Math.min(s.width,i-r.x),s.height=Math.min(s.height,o-r.y),this.adaptor.copyToTexture(e,t,r,s,a)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((e,t)=>{e!==t&&e.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;return A.test(e)&&(e=xe(e).source),e instanceof D?t=e:e instanceof S&&(t=new D({colorTextures:[e]}),e.source instanceof A&&(t.isRoot=!0),e.once("destroy",()=>{t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);const r=this._gpuRenderTargetHash[t.uid];r&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(e,t),t}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}resetState(){this.renderTarget=null,this.renderSurface=null}}class Ht extends $e{constructor({buffer:e,offset:t,size:r}){super(),this.uid=M("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=M("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=t|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=M("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null,this.removeAllListeners()}}class Te{constructor(e){this._renderer=e}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}}Te.extension={type:[u.WebGLPipes,u.WebGPUPipes,u.CanvasPipes],name:"customRender"};function E(n,e){const t=n.instructionSet,r=t.instructions;for(let s=0;s1?1:t,n.worldAlpha=t,n.worldColorAlpha=n.worldColor+((t*255|0)<<24)}function Me(n,e,t){if(e===n.updateTick)return;n.updateTick=e,n.didChange=!1;const r=n.localTransform;n.updateLocalTransform();const s=n.parent;if(s&&!s.renderGroup?(t|=n._updateFlags,n.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),t&se&&ae(n,s,t)):(t=n._updateFlags,n.relativeGroupTransform.copyFrom(r),t&se&&ae(n,ht,t)),!n.renderGroup){const a=n.children,i=a.length;for(let d=0;d1?1:r,n.groupAlpha=r,n.groupColorAlpha=n.groupColor+((r*255|0)<<24)}t&he&&(n.groupBlendMode=n.localBlendMode==="inherit"?e.groupBlendMode:n.localBlendMode),t&de&&(n.globalDisplayStatus=n.localDisplayStatus&e.globalDisplayStatus),n._updateFlags=0}function pt(n,e){const{list:t}=n.childrenRenderablesToUpdate;let r=!1;for(let s=0;s=0;r--)this._updateCachedRenderGroups(e.renderGroupChildren[r],t);if(e.invalidateMatrices(),e.isCachedAsTexture){if(e.textureNeedsUpdate){const r=e.root.getLocalBounds();r.ceil();const s=e.texture;e.texture&&y.returnTexture(e.texture,!0);const a=this._renderer,i=e.textureOptions.resolution||a.view.resolution,o=e.textureOptions.antialias??a.view.antialias,l=e.textureOptions.scaleMode??"linear",d=y.getOptimalTexture(r.width,r.height,i,o);d._source.style=new Ke({scaleMode:l}),e.texture=d,e._textureBounds||(e._textureBounds=new L),e._textureBounds.copyFrom(r),s!==e.texture&&e.renderGroupParent&&(e.renderGroupParent.structureDidChange=!0)}}else e.texture&&(y.returnTexture(e.texture,!0),e.texture=null)}_updateRenderGroups(e){const t=this._renderer,r=t.renderPipes;if(e.runOnRender(t),e.instructionSet.renderPipes=r,e.structureDidChange?O(e.childrenRenderablesToUpdate.list,0):pt(e,r),Ce(e),e.structureDidChange?(e.structureDidChange=!1,this._buildInstructions(e,t)):this._updateRenderables(e),e.childrenRenderablesToUpdate.index=0,t.renderPipes.batch.upload(e.instructionSet),!(e.isCachedAsTexture&&!e.textureNeedsUpdate))for(let s=0;s{if(!n.name)throw new Error("BlendMode extension must have a name property");T[n.name]=n.ref},n=>{delete T[n.name]});class Pe{constructor(e){this._blendModeStack=[],this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}pushBlendMode(e,t,r){this._blendModeStack.push(t),this.setBlendMode(e,t,r)}popBlendMode(e){this._blendModeStack.pop();const t=this._blendModeStack[this._activeBlendMode.length-1]??"normal";this.setBlendMode(null,t,e)}setBlendMode(e,t,r){const s=e instanceof Z;if(this._activeBlendMode===t){this._isAdvanced&&e&&!s&&this._renderableList?.push(e);return}this._isAdvanced&&this._endAdvancedBlendMode(r),this._activeBlendMode=t,e&&(this._isAdvanced=!!T[t],this._isAdvanced&&this._beginAdvancedBlendMode(e,r))}_beginAdvancedBlendMode(e,t){this._renderer.renderPipes.batch.break(t);const r=this._activeBlendMode;if(!T[r]){W(`Unable to assign BlendMode: '${r}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}const s=this._ensureFilterEffect(r),a=e instanceof Z,i={renderPipeId:"filter",action:"pushFilter",filterEffect:s,renderables:a?null:[e],container:a?e.root:null,canBundle:!1};this._renderableList=i.renderables,t.add(i)}_ensureFilterEffect(e){let t=this._filterHash[e];return t||(t=this._filterHash[e]=new le,t.filters=[new T[e]]),t}_endAdvancedBlendMode(e){this._isAdvanced=!1,this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){this._renderer=null,this._renderableList=null;for(const e in this._filterHash)this._filterHash[e].destroy();this._filterHash=null}}Pe.extension={type:[u.WebGLPipes,u.WebGPUPipes,u.CanvasPipes],name:"blendMode"};const B={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},j=class Ue{constructor(e){this._renderer=e}_normalizeOptions(e,t={}){return e instanceof U||e instanceof m?{target:e,...t}:{...t,...e}}async image(e){const t=z.get().createImage();return t.src=await this.base64(e),t}async base64(e){e=this._normalizeOptions(e,Ue.defaultImageOptions);const{format:t,quality:r}=e,s=this.canvas(e);if(s.toBlob!==void 0)return new Promise((a,i)=>{s.toBlob(o=>{if(!o){i(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=i,l.readAsDataURL(o)},B[t],r)});if(s.toDataURL!==void 0)return s.toDataURL(B[t],r);if(s.convertToBlob!==void 0){const a=await s.convertToBlob({type:B[t],quality:r});return new Promise((i,o)=>{const l=new FileReader;l.onload=()=>i(l.result),l.onerror=o,l.readAsDataURL(a)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){e=this._normalizeOptions(e);const t=e.target,r=this._renderer;if(t instanceof m)return r.texture.generateCanvas(t);const s=r.textureGenerator.generateTexture(e),a=r.texture.generateCanvas(s);return s.destroy(!0),a}pixels(e){e=this._normalizeOptions(e);const t=e.target,r=this._renderer,s=t instanceof m?t:r.textureGenerator.generateTexture(e),a=r.texture.getPixels(s);return t instanceof U&&s.destroy(!0),a}texture(e){return e=this._normalizeOptions(e),e.target instanceof m?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);const t=this.canvas(e),r=document.createElement("a");r.download=e.filename??"image.png",r.href=t.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(e){const t=e.width??200;e=this._normalizeOptions(e);const r=this.canvas(e),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);const a=["font-size: 1px;",`padding: ${t}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",a)}destroy(){this._renderer=null}};j.extension={type:[u.WebGLSystem,u.WebGPUSystem],name:"extract"};j.defaultImageOptions={format:"png",quality:1};let _t=j;const vt=new P,xt=new L,bt=[0,0,0,0];class Be{constructor(e){this._renderer=e}generateTexture(e){e instanceof U&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});const t=e.resolution||this._renderer.resolution,r=e.antialias||this._renderer.view.antialias,s=e.target;let a=e.clearColor;a?a=Array.isArray(a)&&a.length===4?a:I.shared.setValue(a).toArray():a=bt;const i=e.frame?.copyTo(vt)||Ye(s,xt).rectangle;i.width=Math.max(i.width,1/t)|0,i.height=Math.max(i.height,1/t)|0;const o=Je.create({...e.textureSourceOptions,width:i.width,height:i.height,resolution:t,antialias:r}),l=g.shared.translate(-i.x,-i.y);return this._renderer.render({container:s,transform:l,target:o,clearColor:a}),o.source.updateMipmaps(),o}destroy(){this._renderer=null}}Be.extension={type:[u.WebGLSystem,u.WebGPUSystem],name:"textureGenerator"};const q=class Ge{constructor(e){this._managedResources=[],this._managedResourceHashes=[],this._ready=!1,this._renderer=e}init(e){e={...Ge.defaultOptions,...e},this.maxUnusedTime=e.gcMaxUnusedTime,this._frequency=e.gcFrequency,this.enabled=e.gcActive,this.now=performance.now()}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?this._handler=this._renderer.scheduler.repeat(()=>{this._ready=!0},this._frequency,!1):(this._renderer.scheduler.cancel(this._handler),this._handler=0))}prerender({container:e}){this.now=performance.now(),e.renderGroup.gcTick=this._renderer.tick++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}postrender(){!this._ready||!this.enabled||(this.run(),this._ready=!1)}_updateInstructionGCTick(e,t){e.instructionSet.gcTick=t;for(const r of e.renderGroupChildren)this._updateInstructionGCTick(r,t)}addResource(e,t){if(e._gcLastUsed!==-1){e._gcLastUsed=this.now,e._onTouch?.(this.now);return}const r=this._managedResources.length;e._gcData={index:r,type:t},e._gcLastUsed=this.now,e._onTouch?.(this.now),e.once("unload",this.removeResource,this),this._managedResources.push(e)}removeResource(e){const t=e._gcData;if(!t)return;const r=t.index,s=this._managedResources.length-1;if(r!==s){const a=this._managedResources[s];this._managedResources[r]=a,a._gcData.index=r}this._managedResources.length--,e._gcData=null,e._gcLastUsed=-1}addResourceHash(e,t,r,s=0){this._managedResourceHashes.push({context:e,hash:t,type:r,priority:s}),this._managedResourceHashes.sort((a,i)=>a.priority-i.priority)}run(){const e=performance.now(),t=this._managedResourceHashes;for(const s of t)this.runOnHash(s,e);let r=0;for(let s=0;s{e.off("unload",this.removeResource,this)}),this._managedResources.length=0,this._managedResourceHashes.length=0,this._renderer=null}};q.extension={type:[u.WebGLSystem,u.WebGPUSystem],name:"gc",priority:0};q.defaultOptions={gcActive:!0,gcMaxUnusedTime:6e4,gcFrequency:3e4};let yt=q;class Ae{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e"},uWorldTransformMatrix:{value:new g,type:"mat3x3"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4"},uResolution:{value:[0,0],type:"vec2"}},{isStatic:!0})}destroy(){this._renderer=null,this._globalUniformDataStack.length=0,this._uniformsPool.length=0,this._activeUniforms.length=0,this._bindGroupPool.length=0,this._activeBindGroups.length=0,this._currentGlobalUniformData=null}}Ae.extension={type:[u.WebGLSystem,u.WebGPUSystem,u.CanvasSystem],name:"globalUniforms"};let Tt=1;class Ie{constructor(){this._tasks=[],this._offset=0}init(){ee.system.add(this._update,this)}repeat(e,t,r=!0){const s=Tt++;let a=0;return r&&(this._offset+=1e3,a=this._offset),this._tasks.push({func:e,duration:t,start:performance.now(),offset:a,last:performance.now(),repeat:!0,id:s}),s}cancel(e){for(let t=0;t=r.duration){const s=e-r.start;r.func(s),r.last=e}}}destroy(){ee.system.remove(this._update,this),this._tasks.length=0}}Ie.extension={type:[u.WebGLSystem,u.WebGPUSystem,u.CanvasSystem],name:"scheduler",priority:0};let ne=!1;function kt(n){if(!ne){if(z.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const e=[`%c %c %c %c %c PixiJS %c v${te} (${n}) http://www.pixijs.com/ + +`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...e)}else globalThis.console&&globalThis.console.log(`PixiJS ${te} - ${n} - http://www.pixijs.com/`);ne=!0}}class ${constructor(e){this._renderer=e}init(e){if(e.hello){let t=this._renderer.name;this._renderer.type===H.WEBGL&&(t+=` ${this._renderer.context.webGLVersion}`),kt(t)}}}$.extension={type:[u.WebGLSystem,u.WebGPUSystem,u.CanvasSystem],name:"hello",priority:-2};$.defaultOptions={hello:!1};function Ct(n){let e=!1;for(const r in n)if(n[r]==null){e=!0;break}if(!e)return n;const t=Object.create(null);for(const r in n){const s=n[r];s&&(t[r]=s)}return t}function Mt(n){let e=0;for(let t=0;tthis.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(const t of this._managedHashes)t.context[t.hash]=Ct(t.context[t.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(const t of this._managedArrays)Mt(t.context[t.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(e,t){this._managedHashes.push({context:e,hash:t})}addManagedArray(e,t){this._managedArrays.push({context:e,hash:t})}prerender({container:e}){this._now=performance.now(),e.renderGroup.gcTick=St++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}addRenderable(e){this.enabled&&(e._lastUsed===-1&&(this._managedRenderables.push(e),e.once("destroyed",this._removeRenderable,this)),e._lastUsed=this._now)}run(){const e=this._now,t=this._managedRenderables,r=this._renderer.renderPipes;let s=0;for(let a=0;athis.maxUnusedTime){if(!i.destroyed){const d=r;o&&(o.structureDidChange=!0),d[i.renderPipeId].destroyRenderable(i)}i._lastUsed=-1,s++,i.off("destroyed",this._removeRenderable,this)}else t[a-s]=i}t.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(e){const t=this._managedRenderables.indexOf(e);t>=0&&(e.off("destroyed",this._removeRenderable,this),this._managedRenderables[t]=null)}_updateInstructionGCTick(e,t){e.instructionSet.gcTick=t;for(const r of e.renderGroupChildren)this._updateInstructionGCTick(r,t)}};K.extension={type:[u.WebGLSystem,u.WebGPUSystem],name:"renderableGC",priority:0};K.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let Rt=K;const Y=class R{get count(){return this._renderer.tick}get checkCount(){return this._checkCount}set checkCount(e){v("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._checkCount=e}get maxIdle(){return this._renderer.gc.maxUnusedTime/1e3*60}set maxIdle(e){v("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.maxUnusedTime=e/60*1e3}get checkCountMax(){return Math.floor(this._renderer.gc._frequency/1e3)}set checkCountMax(e){v("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead.")}get active(){return this._renderer.gc.enabled}set active(e){v("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.enabled=e}constructor(e){this._renderer=e,this._checkCount=0}init(e){e.textureGCActive!==R.defaultOptions.textureGCActive&&(this.active=e.textureGCActive),e.textureGCMaxIdle!==R.defaultOptions.textureGCMaxIdle&&(this.maxIdle=e.textureGCMaxIdle),e.textureGCCheckCountMax!==R.defaultOptions.textureGCCheckCountMax&&(this.checkCountMax=e.textureGCCheckCountMax)}run(){v("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};Y.extension={type:[u.WebGLSystem,u.WebGPUSystem],name:"textureGC"};Y.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};let wt=Y;const J=class Ee{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(e){this.texture.source.autoDensity=e}get resolution(){return this.texture.source._resolution}set resolution(e){this.texture.source.resize(this.texture.source.width,this.texture.source.height,e)}init(e){e={...Ee.defaultOptions,...e},e.view&&(v(Ze,"ViewSystem.view has been renamed to ViewSystem.canvas"),e.canvas=e.view),this.screen=new P(0,0,e.width,e.height),this.canvas=e.canvas||z.get().createCanvas(),this.antialias=!!e.antialias,this.texture=xe(this.canvas,e),this.renderTarget=new D({colorTextures:[this.texture],depth:!!e.depth,isRoot:!0}),this.texture.source.transparent=e.backgroundAlpha<1,this.resolution=e.resolution}resize(e,t,r){this.texture.source.resize(e,t,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(e=!1){(typeof e=="boolean"?e:e?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.texture.destroy()}};J.extension={type:[u.WebGLSystem,u.WebGPUSystem,u.CanvasSystem],name:"view",priority:0};J.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let Pt=J;const Wt=[gt,Ae,$,Pt,Se,yt,wt,Be,_t,et,Rt,Ie],zt=[Pe,me,Re,ke,ge,ve,_e,Te];export{Ht as B,b as G,Lt as R,Wt as S,Et as U,zt as a,lt as b,Ot as c,C as d,Dt as e,It as f,At as t,Ft as u}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Spinner-Dhvehhrf.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Spinner-Dhvehhrf.js new file mode 100644 index 0000000000000000000000000000000000000000..ac7d7d0fded37919146b725e37a4ff4ee34b328b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Spinner-Dhvehhrf.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as e,f as a}from"./index-DWyDLubb.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";var s=a('');function l(t){var r=s();e(t,r)}export{l as S}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Square-CcB54dqq.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Square-CcB54dqq.js new file mode 100644 index 0000000000000000000000000000000000000000..e910b668895c13f925428f8bd55d7443915bead2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Square-CcB54dqq.js @@ -0,0 +1 @@ +import{p as a,a as i}from"./i18n-Dnhn5Rxr.js";import{R as n,t as u,a as w,T as p,U as l,f as d}from"./index-DWyDLubb.js";var g=d('');function k(f,t){n(t,!1);let e=a(t,"fill",12,"currentColor"),r=a(t,"stroke_width",12,1.5);var h={get fill(){return e()},set fill(o){e(o),l()},get stroke_width(){return r()},set stroke_width(o){r(o),l()}},s=g();return u(()=>{i(s,"fill",e()),i(s,"stroke-width",`${r()}`)}),w(f,s),p(h)}export{k as S}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StaticAudio-CdnK_Wm8.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StaticAudio-CdnK_Wm8.js new file mode 100644 index 0000000000000000000000000000000000000000..f2c5a4c8a68170b2fb8bed1f92422e0c4b63e4eb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StaticAudio-CdnK_Wm8.js @@ -0,0 +1,27 @@ +import{p as se,t as Xn,d as ht,F as Qn,i as Fe,f as Vs,b as wr,a as Ct}from"./i18n-Dnhn5Rxr.js";import{a as Se,f as ai,aj as kr,R as ms,aa as oi,y as Ke,t as xt,T as ps,W as Oe,u as _e,v as Jn,w as P,x as ge,V as Te,Y as ye,X as ve,a0 as Pr,S as lt,z as Zn,Z as xs,a5 as nt,a6 as Fr}from"./index-DWyDLubb.js";import{f as Mt,u as ea}from"./utils.svelte-CCyS_0CY.js";import{I as ta}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as sa}from"./BlockLabel-CZd21Hkw.js";import{D as ia}from"./DownloadLink-TGTaev7f.js";import{E as Or}from"./Empty-BIB2W5at.js";import{S as ra}from"./ShareButton-wCSP7LoP.js";import{D as na}from"./Download-Di2PsS6O.js";import{M as Hs}from"./Music-BQN2qTdy.js";import{I as aa}from"./IconButtonWrapper-D0s9l4wW.js";import{g as Nt,u as oa,p as la,s as Ii,M as ca}from"./MinimalAudioPlayer-Cb9FZeXv.js";import{V as ha,P as ua,T as da}from"./VolumeLevels-jRkFzCUK.js";import{P as fa}from"./Play-BxqeM8KI.js";import{U as ga}from"./Undo-C2-jWGVL.js";var ma=ai('');function pa(a){var e=ma();Se(a,e)}var Ea=ai('CC');function Ta(a){var e=Ea();Se(a,e)}var ya=ai('');function va(a){var e=ya();Se(a,e)}class Mr{constructor(){this.listeners={}}on(e,t,s){if(this.listeners[e]||(this.listeners[e]=new Set),s?.once){const i=(...r)=>{this.un(e,i),t(...r)};return this.listeners[e].add(i),()=>this.un(e,i)}return this.listeners[e].add(t),()=>this.un(e,t)}un(e,t){var s;(s=this.listeners[e])===null||s===void 0||s.delete(t)}once(e,t){return this.on(e,t,{once:!0})}unAll(){this.listeners={}}emit(e,...t){this.listeners[e]&&this.listeners[e].forEach((s=>s(...t)))}}class xa extends Mr{constructor(e){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=e}onInit(){}_init(e){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=e,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach((e=>e())),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}}function qt(a,e,t,s,i=3,r=0,n=100){if(!a)return()=>{};const o=matchMedia("(pointer: coarse)").matches;let l=()=>{};const c=h=>{if(h.button!==r)return;h.preventDefault(),h.stopPropagation();let u=h.clientX,d=h.clientY,g=!1;const f=Date.now(),m=A=>{if(A.preventDefault(),A.stopPropagation(),o&&Date.now()-fi||Math.abs(C)>i){const k=a.getBoundingClientRect(),{left:I,top:w}=k;g||(t?.(u-I,d-w),g=!0),e(R,C,x-I,D-w),u=x,d=D}},E=A=>{if(g){const x=A.clientX,D=A.clientY,R=a.getBoundingClientRect(),{left:C,top:k}=R;s?.(x-C,D-k)}l()},T=A=>{A.relatedTarget&&A.relatedTarget!==document.documentElement||E(A)},y=A=>{g&&(A.stopPropagation(),A.preventDefault())},v=A=>{g&&A.preventDefault()};document.addEventListener("pointermove",m),document.addEventListener("pointerup",E),document.addEventListener("pointerout",T),document.addEventListener("pointercancel",T),document.addEventListener("touchmove",v,{passive:!1}),document.addEventListener("click",y,{capture:!0}),l=()=>{document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",E),document.removeEventListener("pointerout",T),document.removeEventListener("pointercancel",T),document.removeEventListener("touchmove",v),setTimeout((()=>{document.removeEventListener("click",y,{capture:!0})}),10)}};return a.addEventListener("pointerdown",c),()=>{l(),a.removeEventListener("pointerdown",c)}}function Nr(a,e){const t=e.xmlns?document.createElementNS(e.xmlns,a):document.createElement(a);for(const[s,i]of Object.entries(e))if(s==="children"&&i)for(const[r,n]of Object.entries(i))n instanceof Node?t.appendChild(n):typeof n=="string"?t.appendChild(document.createTextNode(n)):t.appendChild(Nr(r,n));else s==="style"?Object.assign(t.style,i):s==="textContent"?t.textContent=i:t.setAttribute(s,i.toString());return t}function _t(a,e,t){const s=Nr(a,e||{});return t?.appendChild(s),s}class Di extends Mr{constructor(e,t,s=0){var i,r,n,o,l,c,h,u,d,g;super(),this.totalDuration=t,this.numberOfChannels=s,this.element=null,this.minLength=0,this.maxLength=1/0,this.contentEditable=!1,this.subscriptions=[],this.updatingSide=void 0,this.isRemoved=!1,this.subscriptions=[],this.id=e.id||`region-${Math.random().toString(32).slice(2)}`,this.start=this.clampPosition(e.start),this.end=this.clampPosition((i=e.end)!==null&&i!==void 0?i:e.start),this.drag=(r=e.drag)===null||r===void 0||r,this.resize=(n=e.resize)===null||n===void 0||n,this.resizeStart=(o=e.resizeStart)===null||o===void 0||o,this.resizeEnd=(l=e.resizeEnd)===null||l===void 0||l,this.color=(c=e.color)!==null&&c!==void 0?c:"rgba(0, 0, 0, 0.1)",this.minLength=(h=e.minLength)!==null&&h!==void 0?h:this.minLength,this.maxLength=(u=e.maxLength)!==null&&u!==void 0?u:this.maxLength,this.channelIdx=(d=e.channelIdx)!==null&&d!==void 0?d:-1,this.contentEditable=(g=e.contentEditable)!==null&&g!==void 0?g:this.contentEditable,this.element=this.initElement(),this.setContent(e.content),this.setPart(),this.renderPosition(),this.initMouseEvents()}clampPosition(e){return Math.max(0,Math.min(this.totalDuration,e))}setPart(){var e;const t=this.start===this.end;(e=this.element)===null||e===void 0||e.setAttribute("part",`${t?"marker":"region"} ${this.id}`)}addResizeHandles(e){const t={position:"absolute",zIndex:"2",width:"6px",height:"100%",top:"0",cursor:"ew-resize",wordBreak:"keep-all"},s=_t("div",{part:"region-handle region-handle-left",style:Object.assign(Object.assign({},t),{left:"0",borderLeft:"2px solid rgba(0, 0, 0, 0.5)",borderRadius:"2px 0 0 2px"})},e),i=_t("div",{part:"region-handle region-handle-right",style:Object.assign(Object.assign({},t),{right:"0",borderRight:"2px solid rgba(0, 0, 0, 0.5)",borderRadius:"0 2px 2px 0"})},e);this.subscriptions.push(qt(s,(r=>this.onResize(r,"start")),(()=>null),(()=>this.onEndResizing("start")),1),qt(i,(r=>this.onResize(r,"end")),(()=>null),(()=>this.onEndResizing("end")),1))}removeResizeHandles(e){const t=e.querySelector('[part*="region-handle-left"]'),s=e.querySelector('[part*="region-handle-right"]');t&&e.removeChild(t),s&&e.removeChild(s)}initElement(){if(this.isRemoved)return null;const e=this.start===this.end;let t=0,s=100;this.channelIdx>=0&&this.numberOfChannels>0&&this.channelIdxthis.emit("click",t))),e.addEventListener("mouseenter",(t=>this.emit("over",t))),e.addEventListener("mouseleave",(t=>this.emit("leave",t))),e.addEventListener("dblclick",(t=>this.emit("dblclick",t))),e.addEventListener("pointerdown",(()=>this.toggleCursor(!0))),e.addEventListener("pointerup",(()=>this.toggleCursor(!1))),this.subscriptions.push(qt(e,(t=>this.onMove(t)),(()=>this.toggleCursor(!0)),(()=>{this.toggleCursor(!1),this.drag&&this.emit("update-end")}))),this.contentEditable&&this.content&&(this.contentClickListener=t=>this.onContentClick(t),this.contentBlurListener=()=>this.onContentBlur(),this.content.addEventListener("click",this.contentClickListener),this.content.addEventListener("blur",this.contentBlurListener)))}_onUpdate(e,t,s){var i;if(!(!((i=this.element)===null||i===void 0)&&i.parentElement))return;const{width:r}=this.element.parentElement.getBoundingClientRect(),n=e/r*this.totalDuration;let o=t&&t!=="start"?this.start:this.start+n,l=t&&t!=="end"?this.end:this.end+n;const c=s!==void 0;c&&this.updatingSide&&this.updatingSide!==t&&(this.updatingSide==="start"?o=s:l=s),o=Math.max(0,o),l=Math.min(this.totalDuration,l);const h=l-o;this.updatingSide=t;const u=h>=this.minLength&&h<=this.maxLength;o<=l&&(u||c)&&(this.start=o,this.end=l,this.renderPosition(),this.emit("update",t))}onMove(e){this.drag&&this._onUpdate(e)}onResize(e,t){this.resize&&(this.resizeStart||t!=="start")&&(this.resizeEnd||t!=="end")&&this._onUpdate(e,t)}onEndResizing(e){this.resize&&(this.emit("update-end",e),this.updatingSide=void 0)}onContentClick(e){e.stopPropagation(),e.target.focus(),this.emit("click",e)}onContentBlur(){this.emit("update-end")}_setTotalDuration(e){this.totalDuration=e,this.renderPosition()}play(e){this.emit("play",e&&this.end!==this.start?this.end:void 0)}getContent(e=!1){var t;return e?this.content||void 0:this.element instanceof HTMLElement?((t=this.content)===null||t===void 0?void 0:t.innerHTML)||void 0:""}setContent(e){var t;if(this.element)if(this.content&&this.contentEditable&&(this.contentClickListener&&this.content.removeEventListener("click",this.contentClickListener),this.contentBlurListener&&this.content.removeEventListener("blur",this.contentBlurListener)),(t=this.content)===null||t===void 0||t.remove(),e){if(typeof e=="string"){const s=this.start===this.end;this.content=_t("div",{style:{padding:`0.2em ${s?.2:.4}em`,display:"inline-block"},textContent:e})}else this.content=e;this.contentEditable&&(this.content.contentEditable="true",this.contentClickListener=s=>this.onContentClick(s),this.contentBlurListener=()=>this.onContentBlur(),this.content.addEventListener("click",this.contentClickListener),this.content.addEventListener("blur",this.contentBlurListener)),this.content.setAttribute("part","region-content"),this.element.appendChild(this.content),this.emit("content-changed")}else this.content=void 0}setOptions(e){var t,s;if(this.element){if(e.color&&(this.color=e.color,this.element.style.backgroundColor=this.color),e.drag!==void 0&&(this.drag=e.drag,this.element.style.cursor=this.drag?"grab":"default"),e.start!==void 0||e.end!==void 0){const i=this.start===this.end;this.start=this.clampPosition((t=e.start)!==null&&t!==void 0?t:this.start),this.end=this.clampPosition((s=e.end)!==null&&s!==void 0?s:i?this.start:this.end),this.renderPosition(),this.setPart()}if(e.content&&this.setContent(e.content),e.id&&(this.id=e.id,this.setPart()),e.resize!==void 0&&e.resize!==this.resize){const i=this.start===this.end;this.resize=e.resize,this.resize&&!i?this.addResizeHandles(this.element):this.removeResizeHandles(this.element)}e.resizeStart!==void 0&&(this.resizeStart=e.resizeStart),e.resizeEnd!==void 0&&(this.resizeEnd=e.resizeEnd)}}remove(){this.isRemoved=!0,this.emit("remove"),this.subscriptions.forEach((e=>e())),this.element&&(this.element.remove(),this.element=null)}}class li extends xa{constructor(e){super(e),this.regions=[],this.regionsContainer=this.initRegionsContainer()}static create(e){return new li(e)}onInit(){if(!this.wavesurfer)throw Error("WaveSurfer is not initialized");this.wavesurfer.getWrapper().appendChild(this.regionsContainer),this.subscriptions.push(this.wavesurfer.on("ready",(t=>{this.regions.forEach((s=>s._setTotalDuration(t)))})));let e=[];this.subscriptions.push(this.wavesurfer.on("timeupdate",(t=>{const s=this.regions.filter((i=>i.start<=t&&(i.end===i.start?i.start+.05:i.end)>=t));s.forEach((i=>{e.includes(i)||this.emit("region-in",i)})),e.forEach((i=>{s.includes(i)||this.emit("region-out",i)})),e=s})))}initRegionsContainer(){return _t("div",{part:"regions-container",style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",zIndex:"5",pointerEvents:"none"}})}getRegions(){return this.regions}avoidOverlapping(e){e.content&&setTimeout((()=>{const t=e.content,s=t.getBoundingClientRect(),i=this.regions.map((r=>{if(r===e||!r.content)return 0;const n=r.content.getBoundingClientRect();return s.leftr+n),0);t.style.marginTop=`${i}px`}),10)}adjustScroll(e){var t,s;if(!e.element)return;const i=(s=(t=this.wavesurfer)===null||t===void 0?void 0:t.getWrapper())===null||s===void 0?void 0:s.parentElement;if(!i)return;const{clientWidth:r,scrollWidth:n}=i;if(n<=r)return;const o=i.getBoundingClientRect(),l=e.element.getBoundingClientRect(),c=l.left-o.left,h=l.right-o.left;c<0?i.scrollLeft+=c:h>r&&(i.scrollLeft+=h-r)}virtualAppend(e,t,s){const i=()=>{if(!this.wavesurfer)return;const r=this.wavesurfer.getWidth(),n=this.wavesurfer.getScroll(),o=t.clientWidth,l=this.wavesurfer.getDuration(),c=Math.round(e.start/l*o),h=c+(Math.round((e.end-e.start)/l*o)||1)>n&&c{if(!this.wavesurfer||!e.element)return;i();const r=this.wavesurfer.on("scroll",i),n=this.wavesurfer.on("zoom",i);this.subscriptions.push(r,n),e.once("remove",(()=>{r(),n()}))}),0)}saveRegion(e){if(!e.element)return;this.virtualAppend(e,this.regionsContainer,e.element),this.avoidOverlapping(e),this.regions.push(e);const t=[e.on("update",(s=>{s||this.adjustScroll(e),this.emit("region-update",e,s)})),e.on("update-end",(s=>{this.avoidOverlapping(e),this.emit("region-updated",e,s)})),e.on("play",(s=>{var i;(i=this.wavesurfer)===null||i===void 0||i.play(e.start,s)})),e.on("click",(s=>{this.emit("region-clicked",e,s)})),e.on("dblclick",(s=>{this.emit("region-double-clicked",e,s)})),e.on("content-changed",(()=>{this.emit("region-content-changed",e)})),e.once("remove",(()=>{t.forEach((s=>s())),this.regions=this.regions.filter((s=>s!==e)),this.emit("region-removed",e)}))];this.subscriptions.push(...t),this.emit("region-created",e)}addRegion(e){var t,s;if(!this.wavesurfer)throw Error("WaveSurfer is not initialized");const i=this.wavesurfer.getDuration(),r=(s=(t=this.wavesurfer)===null||t===void 0?void 0:t.getDecodedData())===null||s===void 0?void 0:s.numberOfChannels,n=new Di(e,i,r);return this.emit("region-initialized",n),i?this.saveRegion(n):this.subscriptions.push(this.wavesurfer.once("ready",(o=>{n._setTotalDuration(o),this.saveRegion(n)}))),n}enableDragSelection(e,t=3){var s;const i=(s=this.wavesurfer)===null||s===void 0?void 0:s.getWrapper();if(!(i&&i instanceof HTMLElement))return()=>{};let r=null,n=0,o=0;return qt(i,((l,c,h)=>{r&&r._onUpdate(l,h>n?"end":"start",o)}),(l=>{var c,h;if(n=l,!this.wavesurfer)return;const u=this.wavesurfer.getDuration(),d=(h=(c=this.wavesurfer)===null||c===void 0?void 0:c.getDecodedData())===null||h===void 0?void 0:h.numberOfChannels,{width:g}=this.wavesurfer.getWrapper().getBoundingClientRect();o=n/g*u;const f=l/g*u,m=(l+5)/g*u;r=new Di(Object.assign(Object.assign({},e),{start:f,end:m}),u,d),this.emit("region-initialized",r),r.element&&this.regionsContainer.appendChild(r.element)}),(()=>{r&&(this.saveRegion(r),r.updatingSide=void 0,r=null)}),t)}clearRegions(){this.regions.slice().forEach((e=>e.remove())),this.regions=[]}destroy(){this.clearRegions(),super.destroy(),this.regionsContainer.remove()}}var Sa=Oe('');function La(a,e){ms(e,!0);let t=se(e,"currentVolume",15),s=se(e,"show_volume_slider",15),i;oi(()=>{r()});const r=()=>{let o=i;o&&(o.style.background=`linear-gradient(to right, var(--color-accent) ${t()*100}%, var(--neutral-400) ${t()*100}%)`)};Ke(()=>{t(),r()});var n=Sa();Xn(n),n.__focusout=()=>s(!1),n.__input=o=>{o.target instanceof HTMLInputElement&&(t(parseFloat(o.target.value)),e.waveform?.setVolume(t()))},ht(n,o=>i=o,()=>i),xt(()=>Qn(n,t())),Se(a,n),ps()}kr(["focusout","input"]);var Aa=Oe(''),Ra=Oe(''),ba=Oe(''),Ia=Oe(' ',1),Da=Oe(" ",1),Ca=Oe('
          ');function _a(a,e){ms(e,!0);let t=se(e,"show_redo",3,!1),s=se(e,"interactive",3,!1),i=se(e,"mode",15),r=se(e,"waveform_options",19,()=>({})),n=se(e,"trim_region_settings",19,()=>({})),o=se(e,"show_volume_slider",15),l=se(e,"editable",3,!0),c=se(e,"subtitles_toggle",15),h=se(e,"show_subtitles",3,!1),u=se(e,"trimDuration",15),d=[.5,1,1.5,2],g=_e(Jn(d[1])),f=_e(null),m=_e(null),E=_e(null),T=_e(null),y=_e(""),v=_e(1);function A(){e.container&&e.waveform&&!P(f)&&ge(f,e.waveform.registerPlugin(li.create()),!0)}oi(()=>{A()}),Ke(()=>{if(!P(f))return;const z=J=>{J.play()};return P(f).on("region-out",z),()=>{P(f)?.un("region-out",z)}}),Ke(()=>{if(!P(f))return;const z=J=>{u(J.end-J.start)};return P(f).on("region-updated",z),()=>{P(f)?.un("region-updated",z)}}),Ke(()=>{if(!P(f))return;const z=(J,he)=>{he.stopPropagation(),ge(m,J,!0),J.play()};return P(f).on("region-clicked",z),()=>{P(f)?.un("region-clicked",z)}});const x=()=>{P(f)&&(ge(m,P(f)?.addRegion({start:e.audio_duration/4,end:e.audio_duration/2,...n()}),!0),u(P(m).end-P(m).start))};Ke(()=>{if(P(m)){const z=e.container.children[0].shadowRoot;ge(T,z.querySelector('[data-resize="right"]'),!0),ge(E,z.querySelector('[data-resize="left"]'),!0),P(E)&&P(T)&&(P(E).setAttribute("role","button"),P(T).setAttribute("role","button"),P(E)?.setAttribute("aria-label","Drag to adjust start time"),P(T)?.setAttribute("aria-label","Drag to adjust end time"),P(E)?.setAttribute("tabindex","0"),P(T)?.setAttribute("tabindex","0"),P(E).addEventListener("focus",()=>{P(f)&&ge(y,"left")}),P(T).addEventListener("focus",()=>{P(f)&&ge(y,"right")}))}});const D=()=>{if(e.waveform&&P(f)&&P(m)){const z=P(m).start,J=P(m).end;e.handle_trim_audio(z,J),i(""),ge(m,null)}},R=()=>{P(f)?.getRegions().forEach(z=>{z.remove()}),P(f)?.clearRegions()},C=()=>{R(),i()?i(""):(i("edit"),A(),x())},k=()=>{c(!c())},I=(z,J)=>{let he,Ue;P(m)&&(z==="left"?J==="ArrowLeft"?(he=P(m).start-.05,Ue=P(m).end):(he=P(m).start+.05,Ue=P(m).end):J==="ArrowLeft"?(he=P(m).start,Ue=P(m).end-.05):(he=P(m).start,Ue=P(m).end+.05),P(m).setOptions({start:he,end:Ue}),u(P(m).end-P(m).start))};Ke(()=>{if(P(f)){const z=J=>{J.key==="ArrowLeft"?I(P(y),"ArrowLeft"):J.key==="ArrowRight"&&I(P(y),"ArrowRight")};return window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z)}}});var w=Ca(),B=Te(w),F=Te(B);F.__click=()=>o(!o());let G;var H=Te(F);ha(H,{get currentVolume(){return P(v)}}),ye(F);var U=ve(F,2);{var Z=z=>{La(z,{get waveform(){return e.waveform},get currentVolume(){return P(v)},set currentVolume(J){ge(v,J,!0)},get show_volume_slider(){return o()},set show_volume_slider(J){o(J)}})};Fe(U,z=>{o()&&z(Z)})}var q=ve(U,2);let O;q.__click=()=>{ge(g,d[(d.indexOf(P(g))+1)%d.length],!0),e.waveform?.setPlaybackRate(P(g))};var M=Te(q),ee=Te(M);ye(M),ye(q),ye(B);var j=ve(B,2),X=Te(j);X.__click=()=>e.waveform?.skip(Nt(e.audio_duration,r().skip_length)*-1);var ae=Te(X);pa(ae),ye(X);var re=ve(X,2);re.__click=()=>e.waveform?.playPause();var de=Te(re);{var Re=z=>{ua(z)},Y=z=>{fa(z)};Fe(de,z=>{e.playing?z(Re):z(Y,!1)})}ye(re);var $=ve(re,2);$.__click=()=>e.waveform?.skip(Nt(e.audio_duration,r().skip_length));var fe=Te($);va(fe),ye($),ye(j);var oe=ve(j,2),be=Te(oe);{var Me=z=>{var J=Aa();J.__click=k;var he=Te(J);Ta(he),ye(J),xt(()=>Vs(J,`color: ${c()?"var(--color-accent)":"var(--neutral-400)"}`)),Se(z,J)};Fe(be,z=>{h()&&z(Me)})}var Ne=ve(be,2);{var et=z=>{var J=Da(),he=lt(J);{var Ue=ke=>{var De=Ra();De.__click=()=>{e.handle_reset_value(),R(),i("")};var ue=Te(De);ga(ue),ye(De),Se(ke,De)};Fe(he,ke=>{t()&&!i()&&ke(Ue)})}var Ot=ve(he,2);{var ys=ke=>{var De=ba();De.__click=C;var ue=Te(De);da(ue),ye(De),Se(ke,De)},vs=ke=>{var De=Ia(),ue=lt(De);ue.__click=D;var Pe=ve(ue,2);Pe.__click=C,Se(ke,De)};Fe(Ot,ke=>{i()?ke(vs,!1):ke(ys)})}Se(z,J)};Fe(Ne,z=>{l()&&s()&&z(et)})}ye(oe),ye(w),xt((z,J,he,Ue)=>{G=Vs(F,"",G,{color:o()?"var(--color-accent)":"var(--neutral-400)"}),O=wr(q,1,"playback icon svelte-72dh9g",null,O,{hidden:o()}),Ct(q,"aria-label",z),Pr(ee,`${P(g)??""}x`),Ct(X,"aria-label",J),Ct(re,"aria-label",he),Ct($,"aria-label",`Skip forward by ${Ue??""} seconds`)},[()=>`Adjust playback speed to ${d[(d.indexOf(P(g))+1)%d.length]}x`,()=>`Skip backwards by ${Nt(e.audio_duration,r().skip_length)} seconds`,()=>e.playing?e.i18n("audio.pause"):e.i18n("audio.play"),()=>Nt(e.audio_duration,r().skip_length)]),Se(a,w),ps()}kr(["click"]);function wa(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Ur={exports:{}};(function(a,e){(function(t){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,c,h){if(h=h||{},l=l.trim(),c=c.trim(),!c){if(!h.alwaysNormalize)return l;var u=o.parseURL(l);if(!u)throw new Error("Error trying to parse base URL.");return u.path=o.normalizePath(u.path),o.buildURLFromParts(u)}var d=o.parseURL(c);if(!d)throw new Error("Error trying to parse relative URL.");if(d.scheme)return h.alwaysNormalize?(d.path=o.normalizePath(d.path),o.buildURLFromParts(d)):c;var g=o.parseURL(l);if(!g)throw new Error("Error trying to parse base URL.");if(!g.netLoc&&g.path&&g.path[0]!=="/"){var f=i.exec(g.path);g.netLoc=f[1],g.path=f[2]}g.netLoc&&!g.path&&(g.path="/");var m={scheme:g.scheme,netLoc:d.netLoc,path:null,params:d.params,query:d.query,fragment:d.fragment};if(!d.netLoc&&(m.netLoc=g.netLoc,d.path[0]!=="/"))if(!d.path)m.path=g.path,d.params||(m.params=g.params,d.query||(m.query=g.query));else{var E=g.path,T=E.substring(0,E.lastIndexOf("/")+1)+d.path;m.path=o.normalizePath(T)}return m.path===null&&(m.path=h.alwaysNormalize?o.normalizePath(d.path):d.path),o.buildURLFromParts(m)},parseURL:function(l){var c=s.exec(l);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(r,"");l.length!==(l=l.replace(n,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};a.exports=o})()})(Ur);var ci=Ur.exports;function Ci(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(a);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(a,i).enumerable})),t.push.apply(t,s)}return t}function Le(a){for(var e=1;e`):ut}function Ua(a,...e){e.forEach(function(t){wt[t]=a[t]?a[t].bind(a):Na(t)})}function Ba(a,e){if(typeof console=="object"&&a===!0||typeof a=="object"){Ua(a,"debug","log","info","warn","error");try{wt.log(`Debug logs enabled for "${e}" in hls.js version 1.5.13`)}catch{wt=Ws}}else wt=Ws}const S=wt,Ga=/^(\d+)x(\d+)$/,_i=/(.+?)=(".*?"|.*?)(?:,|$)/g;class ce{constructor(e){typeof e=="string"&&(e=ce.parseAttrList(e)),me(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const s=new Uint8Array(t.length/2);for(let i=0;iNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const s=this[e];return s?parseFloat(s):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Ga.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const s={};for(_i.lastIndex=0;(t=_i.exec(e))!==null;){let r=t[2];r.indexOf('"')===0&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1));const n=t[1].trim();s[n]=r}return s}}function $a(a){return a!=="ID"&&a!=="CLASS"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function Ka(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"}class Br{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const s=t.attr;for(const i in s)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==s[i]){S.warn(`DATERANGE tag attribute: "${i}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=i;break}e=me(new ce({}),s,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=new Date(this.attr["END-DATE"]);N(s.getTime())&&(this._endDate=s)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(N(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&N(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class Es{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var ie={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Gr{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[ie.AUDIO]:null,[ie.VIDEO]:null,[ie.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const s=e.split("@",2);let i;s.length===1?i=t?.byteRangeEndOffset||0:i=parseInt(s[1]),this._byteRange=[i,parseInt(s[0])+i]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=ci.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class Ss extends Gr{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new Es,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const s=Object.keys(this.levelkeys);if(s.length===1)return this._decryptdata=this.levelkeys[s[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!N(this.programDateTime))return null;const e=N(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),s=t.length;if(s>1||s===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,s,i,r,n=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:s,startDTS:i,endDTS:r,partial:n};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,s),l.startDTS=Math.min(l.startDTS,i),l.endDTS=Math.max(l.endDTS,r)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[ie.AUDIO]=null,e[ie.VIDEO]=null,e[ie.AUDIOVIDEO]=null}}class Va extends Gr{constructor(e,t,s,i,r){super(s),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new Es,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=i;const n=e.enumeratedString("BYTERANGE");n&&this.setByteRange(n,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}const Ha=10;class Wa{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&s>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?N(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Ha}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function hi(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function Ya(a){const e=Ys(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function ja(a){const e=function(s,i,r){const n=s[i];s[i]=s[r],s[r]=n};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function za(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const s=e[1].split(";"),i=s[s.length-1].split(",");if(i.length===2){const r=i[0]==="base64",n=i[1];r?(s.splice(-1,1),t=hi(n)):t=Ya(n)}}return t}function Ys(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}const At=typeof self<"u"?self:void 0;var le={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},we={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function wi(a){switch(a){case we.FAIRPLAY:return le.FAIRPLAY;case we.PLAYREADY:return le.PLAYREADY;case we.WIDEVINE:return le.WIDEVINE;case we.CLEARKEY:return le.CLEARKEY}}var $r={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function qa(a){if(a===$r.WIDEVINE)return le.WIDEVINE}function ki(a){switch(a){case le.FAIRPLAY:return we.FAIRPLAY;case le.PLAYREADY:return we.PLAYREADY;case le.WIDEVINE:return we.WIDEVINE;case le.CLEARKEY:return we.CLEARKEY}}function Ls(a){const{drmSystems:e,widevineLicenseUrl:t}=a,s=e?[le.FAIRPLAY,le.WIDEVINE,le.PLAYREADY,le.CLEARKEY].filter(i=>!!e[i]):[];return!s[le.WIDEVINE]&&t&&s.push(le.WIDEVINE),s}const Kr=(function(a){return At!=null&&(a=At.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function Xa(a,e,t,s){let i;switch(a){case le.FAIRPLAY:i=["cenc","sinf"];break;case le.WIDEVINE:case le.PLAYREADY:i=["cenc"];break;case le.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return Qa(i,e,t,s)}function Qa(a,e,t,s){return[{initDataTypes:a,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs="${r}"`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(r=>({contentType:`video/mp4; codecs="${r}"`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function ft(a,e,t){return Uint8Array.prototype.slice?a.slice(e,t):new Uint8Array(Array.prototype.slice.call(a,e,t))}const ui=(a,e)=>e+10<=a.length&&a[e]===73&&a[e+1]===68&&a[e+2]===51&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128,Vr=(a,e)=>e+10<=a.length&&a[e]===51&&a[e+1]===68&&a[e+2]===73&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128,kt=(a,e)=>{const t=e;let s=0;for(;ui(a,e);){s+=10;const i=Ts(a,e+6);s+=i,Vr(a,e+10)&&(s+=10),e+=s}if(s>0)return a.subarray(t,t+s)},Ts=(a,e)=>{let t=0;return t=(a[e]&127)<<21,t|=(a[e+1]&127)<<14,t|=(a[e+2]&127)<<7,t|=a[e+3]&127,t},Ja=(a,e)=>ui(a,e)&&Ts(a,e+6)+10<=a.length-e,di=a=>{const e=Wr(a);for(let t=0;ta&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp",Za=a=>{const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=Ts(a,4),s=10;return{type:e,size:t,data:a.subarray(s,s+t)}},Wr=a=>{let e=0;const t=[];for(;ui(a,e);){const s=Ts(a,e+6);e+=10;const i=e+s;for(;e+8a.type==="PRIV"?to(a):a.type[0]==="W"?io(a):so(a),to=a=>{if(a.size<2)return;const e=Je(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}},so=a=>{if(a.size<2)return;if(a.type==="TXXX"){let t=1;const s=Je(a.data.subarray(t),!0);t+=s.length+1;const i=Je(a.data.subarray(t));return{key:a.type,info:s,data:i}}const e=Je(a.data.subarray(1));return{key:a.type,data:e}},io=a=>{if(a.type==="WXXX"){if(a.size<2)return;let t=1;const s=Je(a.data.subarray(t),!0);t+=s.length+1;const i=Je(a.data.subarray(t));return{key:a.type,info:s,data:i}}const e=Je(a.data);return{key:a.type,data:e}},ro=a=>{if(a.data.byteLength===8){const e=new Uint8Array(a.data),t=e[3]&1;let s=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return s/=45,t&&(s+=4772185884e-2),Math.round(s)}},Je=(a,e=!1)=>{const t=no();if(t){const c=t.decode(a);if(e){const h=c.indexOf("\0");return h!==-1?c.substring(0,h):c}return c.replace(/\0/g,"")}const s=a.length;let i,r,n,o="",l=0;for(;l>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(i);break;case 12:case 13:r=a[l++],o+=String.fromCharCode((i&31)<<6|r&63);break;case 14:r=a[l++],n=a[l++],o+=String.fromCharCode((i&15)<<12|(r&63)<<6|(n&63)<<0);break}}return o};let As;function no(){if(!navigator.userAgent.includes("PlayStation 4"))return!As&&typeof self.TextDecoder<"u"&&(As=new self.TextDecoder("utf-8")),As}const ze={hexDump:function(a){let e="";for(let t=0;t>24,a[e+1]=t>>16&255,a[e+2]=t>>8&255,a[e+3]=t&255}function oo(a){const e=a.byteLength;for(let t=0;t8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=s>1?t+s:e}return!1}function Q(a,e){const t=[];if(!e.length)return t;const s=a.byteLength;for(let i=0;i1?i+r:s;if(n===e[0])if(e.length===1)t.push(a.subarray(i+8,o));else{const l=Q(a.subarray(i+8,o),e.slice(1));l.length&&ao.apply(t,l)}i=o}return t}function lo(a){const e=[],t=a[0];let s=8;const i=K(a,s);s+=4;let r=0,n=0;t===0?(r=K(a,s),n=K(a,s+4),s+=8):(r=Pi(a,s),n=Pi(a,s+8),s+=16),s+=2;let o=a.length+n;const l=jr(a,s);s+=2;for(let c=0;c>>31===1)return S.warn("SIDX has hierarchical references (not supported)"),null;const f=K(a,h);h+=4,e.push({referenceSize:d,subsegmentDuration:f,info:{duration:f/i,start:o,end:o+d-1}}),o+=d,h+=4,s=h}return{earliestPresentationTime:r,timescale:i,version:t,referencesCount:l,references:e}}function qr(a){const e=[],t=Q(a,["moov","trak"]);for(let i=0;i{const r=K(i,4),n=e[r];n&&(n.default={duration:K(i,12),flags:K(i,20)})}),e}function co(a){const e=a.subarray(8),t=e.subarray(86),s=pe(e.subarray(4,8));let i=s;const r=s==="enca"||s==="encv";if(r){const o=Q(e,[s])[0].subarray(s==="enca"?28:78);Q(o,["sinf"]).forEach(c=>{const h=Q(c,["schm"])[0];if(h){const u=pe(h.subarray(4,8));if(u==="cbcs"||u==="cenc"){const d=Q(c,["frma"])[0];d&&(i=pe(d))}}})}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const n=Q(t,["avcC"])[0];i+="."+Ut(n[1])+Ut(n[2])+Ut(n[3]);break}case"mp4a":{const n=Q(e,[s])[0],o=Q(n.subarray(28),["esds"])[0];if(o&&o.length>12){let l=4;if(o[l++]!==3)break;l=bs(o,l),l+=2;const c=o[l++];if(c&128&&(l+=2),c&64&&(l+=o[l++]),o[l++]!==4)break;l=bs(o,l);const h=o[l++];if(h===64)i+="."+Ut(h);else break;if(l+=12,o[l++]!==5)break;l=bs(o,l);const u=o[l++];let d=(u&248)>>3;d===31&&(d+=1+((u&7)<<3)+((o[l]&224)>>5)),i+="."+d}break}case"hvc1":case"hev1":{const n=Q(t,["hvcC"])[0],o=n[1],l=["","A","B","C"][o>>6],c=o&31,h=K(n,2),u=(o&32)>>5?"H":"L",d=n[12],g=n.subarray(6,12);i+="."+l+c,i+="."+h.toString(16).toUpperCase(),i+="."+u+d;let f="";for(let m=g.length;m--;){const E=g[m];(E||f)&&(f="."+E.toString(16).toUpperCase()+f)}i+=f;break}case"dvh1":case"dvhe":{const n=Q(t,["dvcC"])[0],o=n[2]>>1&127,l=n[2]<<5&32|n[3]>>3&31;i+="."+je(o)+"."+je(l);break}case"vp09":{const n=Q(t,["vpcC"])[0],o=n[4],l=n[5],c=n[6]>>4&15;i+="."+je(o)+"."+je(l)+"."+je(c);break}case"av01":{const n=Q(t,["av1C"])[0],o=n[1]>>>5,l=n[1]&31,c=n[2]>>>7?"H":"M",h=(n[2]&64)>>6,u=(n[2]&32)>>5,d=o===2&&h?u?12:10:h?10:8,g=(n[2]&16)>>4,f=(n[2]&8)>>3,m=(n[2]&4)>>2,E=n[2]&3;i+="."+o+"."+je(l)+c+"."+je(d)+"."+g+"."+f+m+E+"."+je(1)+"."+je(1)+"."+je(1)+"."+0;break}}return{codec:i,encrypted:r}}function bs(a,e){const t=e+5;for(;a[e++]&128&&e{const n=Q(i,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=Q(n,["enca"]);const l=o.length>0;l||(o=Q(n,["encv"])),o.forEach(c=>{const h=l?c.subarray(28):c.subarray(78);Q(h,["sinf"]).forEach(d=>{const g=Xr(d);if(g){const f=g.subarray(8,24);f.some(m=>m!==0)||(S.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${ze.hexDump(f)} -> ${ze.hexDump(t)}`),g.set(t,8))}})})}),a}function Xr(a){const e=Q(a,["schm"])[0];if(e){const t=pe(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return Q(a,["schi","tenc"])[0]}return S.error("[eme] missing 'schm' box"),null}function uo(a,e){return Q(e,["moof","traf"]).reduce((t,s)=>{const i=Q(s,["tfdt"])[0],r=i[0],n=Q(s,["tfhd"]).reduce((o,l)=>{const c=K(l,4),h=a[c];if(h){let u=K(i,4);if(r===1){if(u===rs)return S.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;u*=rs+1,u+=K(i,8)}const d=h.timescale||9e4,g=u/d;if(N(g)&&(o===null||gg+f.info.duration||0,0);o=Math.max(o,d+u.earliestPresentationTime/u.timescale),l=o-n}}if(l&&N(l))return l}return s||i}function go(a){const e=K(a,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let s=0;const i=K(a,4);for(let r=0;r{Q(s,["tfhd"]).forEach(i=>{const r=K(i,4),n=a[r];if(!n)return;const o=n.timescale||9e4;Q(s,["tfdt"]).forEach(l=>{const c=l[0],h=t*o;if(h){let u=K(l,4);if(c===0)u-=h,u=Math.max(u,0),Rs(l,4,u);else{u*=Math.pow(2,32),u+=K(l,8),u-=h,u=Math.max(u,0);const d=Math.floor(u/(rs+1)),g=Math.floor(u%(rs+1));Rs(l,4,d),Rs(l,8,g)}}})})})}function po(a){const e={valid:null,remainder:null},t=Q(a,["moof"]);if(t.length<2)return e.remainder=a,e;const s=t[t.length-1];return e.valid=ft(a,0,s.byteOffset-8),e.remainder=ft(a,s.byteOffset-8),e}function Ve(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function Fi(a,e){const t=[],s=e.samples,i=e.timescale,r=e.id;let n=!1;return Q(s,["moof"]).map(l=>{const c=l.byteOffset-8;Q(l,["traf"]).map(u=>{const d=Q(u,["tfdt"]).map(g=>{const f=g[0];let m=K(g,4);return f===1&&(m*=Math.pow(2,32),m+=K(g,8)),m/i})[0];return d!==void 0&&(a=d),Q(u,["tfhd"]).map(g=>{const f=K(g,4),m=K(g,0)&16777215,E=(m&1)!==0,T=(m&2)!==0,y=(m&8)!==0;let v=0;const A=(m&16)!==0;let x=0;const D=(m&32)!==0;let R=8;f===r&&(E&&(R+=8),T&&(R+=4),y&&(v=K(g,R),R+=4),A&&(x=K(g,R),R+=4),D&&(R+=4),e.type==="video"&&(n=Eo(e.codec)),Q(u,["trun"]).map(C=>{const k=C[0],I=K(C,0)&16777215,w=(I&1)!==0;let B=0;const F=(I&4)!==0,G=(I&256)!==0;let H=0;const U=(I&512)!==0;let Z=0;const q=(I&1024)!==0,O=(I&2048)!==0;let M=0;const ee=K(C,4);let j=8;w&&(B=K(C,j),j+=4),F&&(j+=4);let X=B+c;for(let ae=0;ae>1&63;return t===39||t===40}else return(e&31)===6}function Qr(a,e,t,s){const i=Jr(a);let r=0;r+=e;let n=0,o=0,l=0;for(;r=i.length)break;l=i[r++],n+=l}while(l===255);o=0;do{if(r>=i.length)break;l=i[r++],o+=l}while(l===255);const c=i.length-r;let h=r;if(oc){S.error(`Malformed SEI payload. ${o} is too small, only ${c} bytes left to parse.`);break}if(n===4){if(i[h++]===181){const d=jr(i,h);if(h+=2,d===49){const g=K(i,h);if(h+=4,g===1195456820){const f=i[h++];if(f===3){const m=i[h++],E=31&m,T=64&m,y=T?2+E*3:0,v=new Uint8Array(y);if(T){v[0]=m;for(let A=1;A16){const u=[];for(let f=0;f<16;f++){const m=i[h++].toString(16);u.push(m.length==1?"0"+m:m),(f===3||f===5||f===7||f===9)&&u.push("-")}const d=o-16,g=new Uint8Array(d);for(let f=0;f>24&255,r[1]=s>>16&255,r[2]=s>>8&255,r[3]=s&255,r.set(a,4),i=0,s=8;i0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;const n=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(n.buffer).setUint32(0,t.byteLength,!1),vo([112,115,115,104],new Uint8Array([s,0,0,0]),a,r,i,n,t||new Uint8Array)}function So(a){if(!(a instanceof ArrayBuffer)||a.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(a),s=t.getUint32(0);if(a.byteLength!==s&&s>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=ze.hexDump(new Uint8Array(a,12,16));const r=t.getUint32(28);if(e.version===0){if(s-32=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case we.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=xo(s,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),r=String.fromCharCode.apply(null,Array.from(i)),n=r.substring(r.indexOf("<"),r.length),c=new DOMParser().parseFromString(n,"text/xml").getElementsByTagName("KID")[0];if(c){const h=c.childNodes[0]?c.childNodes[0].nodeValue:c.getAttribute("VALUE");if(h){const u=hi(h).subarray(0,16);ja(u),this.keyId=u}}break}default:{let s=t.subarray(0,16);if(s.length!==16){const i=new Uint8Array(16);i.set(s,16-s.length),s=i}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s=Bt[this.uri];if(!s){const i=Object.keys(Bt).length%Number.MAX_SAFE_INTEGER;s=new Uint8Array(16),new DataView(s.buffer,12,4).setUint32(0,i),Bt[this.uri]=s}this.keyId=s}return this}}function Lo(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const Zr=/\{\$([a-zA-Z0-9-_]+)\}/g;function Oi(a){return Zr.test(a)}function Ce(a,e,t){if(a.variableList!==null||a.hasVariableRefs)for(let s=t.length;s--;){const i=t[s],r=e[i];r&&(e[i]=js(a,r))}}function js(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(Zr,s=>{const i=s.substring(2,s.length-1),r=t?.[i];return r===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),s):r})}return e}function Mi(a,e,t){let s=a.variableList;s||(a.variableList=s={});let i,r;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const n=new self.URL(t).searchParams;if(n.has(i))r=n.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(n){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${n.message}`))}}else i=e.NAME,r=e.VALUE;i in s?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):s[i]=r||""}function Ao(a,e,t){const s=e.IMPORT;if(t&&s in t){let i=a.variableList;i||(a.variableList=i={}),i[s]=t[s]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}function gt(a=!0){return typeof self>"u"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Ro(a){return typeof self<"u"&&a===self.ManagedMediaSource}const ns={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function bo(a,e){const t=ns[e];return!!t&&!!t[a.slice(0,4)]}function Is(a,e,t=!0){return!a.split(",").some(s=>!en(s,e,t))}function en(a,e,t=!0){var s;const i=gt(t);return(s=i?.isTypeSupported(Ft(a,e)))!=null?s:!1}function Ft(a,e){return`${e}/mp4;codecs="${a}"`}function Ni(a){if(a){const e=a.substring(0,4);return ns.video[e]}return 2}function as(a){return a.split(",").reduce((e,t)=>{const s=ns.video[t];return s?(s*2+e)/(e?3:2):(ns.audio[t]+e)/(e?2:1)},0)}const Ds={};function Io(a,e=!0){if(Ds[a])return Ds[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[a];for(let s=0;sIo(t.toLowerCase(),e))}function Ui(a,e){return a&&a!=="mp4a"?a:e&&e.split(",")[0]}function Co(a){const e=a.split(",");for(let t=0;t2){let i=s.shift()+".";i+=parseInt(s.shift()).toString(16),i+=("000"+parseInt(s.shift()).toString(16)).slice(-4),e[t]=i}}return e.join(",")}const Bi=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Gi=/#EXT-X-MEDIA:(.*)/g,_o=/^#EXT(?:INF|-X-TARGETDURATION):/m,$i=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),wo=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Xe{static findGroup(e,t){for(let s=0;s0&&r.length({id:c.attrs.AUDIO,audioCodec:c.audioCodec})),SUBTITLES:n.map(c=>({id:c.attrs.SUBTITLES,textCodec:c.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(Gi.lastIndex=0;(i=Gi.exec(e))!==null;){const c=new ce(i[1]),h=c.TYPE;if(h){const u=o[h],d=r[h]||[];r[h]=d,Ce(s,c,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const g=c.LANGUAGE,f=c["ASSOC-LANGUAGE"],m=c.CHANNELS,E=c.CHARACTERISTICS,T=c["INSTREAM-ID"],y={attrs:c,bitrate:0,id:l++,groupId:c["GROUP-ID"]||"",name:c.NAME||g||"",type:h,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:g,url:c.URI?Xe.resolve(c.URI,t):""};if(f&&(y.assocLang=f),m&&(y.channels=m),E&&(y.characteristics=E),T&&(y.instreamId=T),u!=null&&u.length){const v=Xe.findGroup(u,y.groupId)||u[0];Hi(y,v,"audioCodec"),Hi(y,v,"textCodec")}d.push(y)}}return r}static parseLevelPlaylist(e,t,s,i,r,n){const o=new Wa(t),l=o.fragments;let c=null,h=0,u=0,d=0,g=0,f=null,m=new Ss(i,t),E,T,y,v=-1,A=!1,x=null;for($i.lastIndex=0,o.m3u8=e,o.hasVariableRefs=Oi(e);(E=$i.exec(e))!==null;){A&&(A=!1,m=new Ss(i,t),m.start=d,m.sn=h,m.cc=g,m.level=s,c&&(m.initSegment=c,m.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,x&&(m.setByteRange(x),x=null)));const k=E[1];if(k){m.duration=parseFloat(k);const I=(" "+E[2]).slice(1);m.title=I||null,m.tagList.push(I?["INF",k,I]:["INF",k])}else if(E[3]){if(N(m.duration)){m.start=d,y&&ji(m,y,o),m.sn=h,m.level=s,m.cc=g,l.push(m);const I=(" "+E[3]).slice(1);m.relurl=js(o,I),Wi(m,f),f=m,d+=m.duration,h++,u=0,A=!0}}else if(E[4]){const I=(" "+E[4]).slice(1);f?m.setByteRange(I,f):m.setByteRange(I)}else if(E[5])m.rawProgramDateTime=(" "+E[5]).slice(1),m.tagList.push(["PROGRAM-DATE-TIME",m.rawProgramDateTime]),v===-1&&(v=l.length);else{if(E=E[0].match(wo),!E){S.warn("No matches on slow regex match for level playlist!");continue}for(T=1;T0&&F.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=F.optionalFloat("PART-HOLD-BACK",0),o.holdBack=F.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const F=new ce(w);o.partTarget=F.decimalFloatingPoint("PART-TARGET");break}case"PART":{let F=o.partList;F||(F=o.partList=[]);const G=u>0?F[F.length-1]:void 0,H=u++,U=new ce(w);Ce(o,U,["BYTERANGE","URI"]);const Z=new Va(U,m,t,H,G);F.push(Z),m.duration+=Z.duration;break}case"PRELOAD-HINT":{const F=new ce(w);Ce(o,F,["URI"]),o.preloadHint=F;break}case"RENDITION-REPORT":{const F=new ce(w);Ce(o,F,["URI"]),o.renditionReports=o.renditionReports||[],o.renditionReports.push(F);break}default:S.warn(`line parsed but not handled: ${E}`);break}}}f&&!f.relurl?(l.pop(),d-=f.duration,o.partList&&(o.fragmentHint=f)):o.partList&&(Wi(m,f),m.cc=g,o.fragmentHint=m,y&&ji(m,y,o));const D=l.length,R=l[0],C=l[D-1];if(d+=o.skippedSegments*o.targetduration,d>0&&D&&C){o.averagetargetduration=d/D;const k=C.sn;o.endSN=k!=="initSegment"?k:0,o.live||(C.endList=!0),R&&(o.startCC=R.cc)}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(d+=o.fragmentHint.duration),o.totalduration=d,o.endCC=g,v>0&&Po(l,v),o}}function Ki(a,e,t){var s,i;const r=new ce(a);Ce(t,r,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const n=(s=r.METHOD)!=null?s:"",o=r.URI,l=r.hexadecimalInteger("IV"),c=r.KEYFORMATVERSIONS,h=(i=r.KEYFORMAT)!=null?i:"identity";o&&r.IV&&!l&&S.error(`Invalid IV: ${r.IV}`);const u=o?Xe.resolve(o,e):"",d=(c||"1").split("/").map(Number).filter(Number.isFinite);return new Pt(n,u,h,d,l)}function Vi(a){const t=new ce(a).decimalFloatingPoint("TIME-OFFSET");return N(t)?t:null}function ko(a,e){let t=(a||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const i=t.filter(r=>bo(r,s));i.length&&(e[`${s}Codec`]=i.join(","),t=t.filter(r=>i.indexOf(r)===-1))}),e.unknownCodecs=t}function Hi(a,e,t){const s=e[t];s&&(a[t]=s)}function Po(a,e){let t=a[e];for(let s=e;s--;){const i=a[s];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function Wi(a,e){a.rawProgramDateTime?a.programDateTime=Date.parse(a.rawProgramDateTime):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime),N(a.programDateTime)||(a.programDateTime=null,a.rawProgramDateTime=null)}function Yi(a,e,t,s){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",s&&(a.levelkeys=s),a.initSegment=null}function ji(a,e,t){a.levelkeys=e;const{encryptedFragments:s}=t;(!s.length||s[s.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&s.push(a)}var te={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},V={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function zi(a){const{type:e}=a;switch(e){case te.AUDIO_TRACK:return V.AUDIO;case te.SUBTITLE_TRACK:return V.SUBTITLE;default:return V.MAIN}}function Cs(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Fo{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,s=t.pLoader,i=t.loader,r=s||i,n=new r(t);return this.loaders[e.type]=n,n}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:s}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:te.MANIFEST,url:s,deliveryDirectives:null})}onLevelLoading(e,t){const{id:s,level:i,pathwayId:r,url:n,deliveryDirectives:o}=t;this.load({id:s,level:i,pathwayId:r,responseType:"text",type:te.LEVEL,url:n,deliveryDirectives:o})}onAudioTrackLoading(e,t){const{id:s,groupId:i,url:r,deliveryDirectives:n}=t;this.load({id:s,groupId:i,level:null,responseType:"text",type:te.AUDIO_TRACK,url:r,deliveryDirectives:n})}onSubtitleTrackLoading(e,t){const{id:s,groupId:i,url:r,deliveryDirectives:n}=t;this.load({id:s,groupId:i,level:null,responseType:"text",type:te.SUBTITLE_TRACK,url:r,deliveryDirectives:n})}load(e){var t;const s=this.hls.config;let i=this.getInternalLoader(e);if(i){const c=i.context;if(c&&c.url===e.url&&c.level===e.level){S.trace("[playlist-loader]: playlist request ongoing");return}S.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let r;if(e.type===te.MANIFEST?r=s.manifestLoadPolicy.default:r=me({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),N((t=e.deliveryDirectives)==null?void 0:t.part)){let c;if(e.type===te.LEVEL&&e.level!==null?c=this.hls.levels[e.level].details:e.type===te.AUDIO_TRACK&&e.id!==null?c=this.hls.audioTracks[e.id].details:e.type===te.SUBTITLE_TRACK&&e.id!==null&&(c=this.hls.subtitleTracks[e.id].details),c){const h=c.partTarget,u=c.targetduration;if(h&&u){const d=Math.max(h*3,u*.8)*1e3;r=me({},r,{maxTimeToFirstByteMs:Math.min(d,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(d,r.maxTimeToFirstByteMs)})}}}const n=r.errorRetry||r.timeoutRetry||{},o={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:n.maxNumRetry||0,retryDelay:n.retryDelayMs||0,maxRetryDelay:n.maxRetryDelayMs||0},l={onSuccess:(c,h,u,d)=>{const g=this.getInternalLoader(u);this.resetInternalLoader(u.type);const f=c.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(c,u,new Error("no EXTM3U delimiter"),d||null,h);return}h.parsing.start=performance.now(),Xe.isMediaPlaylist(f)?this.handleTrackOrLevelPlaylist(c,h,u,d||null,g):this.handleMasterPlaylist(c,h,u,d)},onError:(c,h,u,d)=>{this.handleNetworkError(h,u,!1,c,d)},onTimeout:(c,h,u)=>{this.handleNetworkError(h,u,!0,void 0,c)}};i.load(e,o,l)}handleMasterPlaylist(e,t,s,i){const r=this.hls,n=e.data,o=Cs(e,s),l=Xe.parseMasterPlaylist(n,o);if(l.playlistParsingError){this.handleManifestParsingError(e,s,l.playlistParsingError,i,t);return}const{contentSteering:c,levels:h,sessionData:u,sessionKeys:d,startTimeOffset:g,variableList:f}=l;this.variableList=f;const{AUDIO:m=[],SUBTITLES:E,"CLOSED-CAPTIONS":T}=Xe.parseMasterPlaylistMedia(n,o,l);m.length&&!m.some(v=>!v.url)&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(S.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ce({}),bitrate:0,url:""})),r.trigger(p.MANIFEST_LOADED,{levels:h,audioTracks:m,subtitles:E,captions:T,contentSteering:c,url:o,stats:t,networkDetails:i,sessionData:u,sessionKeys:d,startTimeOffset:g,variableList:f})}handleTrackOrLevelPlaylist(e,t,s,i,r){const n=this.hls,{id:o,level:l,type:c}=s,h=Cs(e,s),u=0,d=N(l)?l:N(o)?o:0,g=zi(s),f=Xe.parseLevelPlaylist(e.data,h,d,g,u,this.variableList);if(c===te.MANIFEST){const m={attrs:new ce({}),bitrate:0,details:f,name:"",url:h};n.trigger(p.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:h,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),s.levelDetails=f,this.handlePlaylistLoaded(f,e,t,s,i,r)}handleManifestParsingError(e,t,s,i,r){this.hls.trigger(p.ERROR,{type:W.NETWORK_ERROR,details:b.MANIFEST_PARSING_ERROR,fatal:t.type===te.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:t,networkDetails:i,stats:r})}handleNetworkError(e,t,s=!1,i,r){let n=`A network ${s?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===te.LEVEL?n+=`: ${e.level} id: ${e.id}`:(e.type===te.AUDIO_TRACK||e.type===te.SUBTITLE_TRACK)&&(n+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(n);S.warn(`[playlist-loader]: ${n}`);let l=b.UNKNOWN,c=!1;const h=this.getInternalLoader(e);switch(e.type){case te.MANIFEST:l=s?b.MANIFEST_LOAD_TIMEOUT:b.MANIFEST_LOAD_ERROR,c=!0;break;case te.LEVEL:l=s?b.LEVEL_LOAD_TIMEOUT:b.LEVEL_LOAD_ERROR,c=!1;break;case te.AUDIO_TRACK:l=s?b.AUDIO_TRACK_LOAD_TIMEOUT:b.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case te.SUBTITLE_TRACK:l=s?b.SUBTITLE_TRACK_LOAD_TIMEOUT:b.SUBTITLE_LOAD_ERROR,c=!1;break}h&&this.resetInternalLoader(e.type);const u={type:W.NETWORK_ERROR,details:l,fatal:c,url:e.url,loader:h,context:e,error:o,networkDetails:t,stats:r};if(i){const d=t?.url||e.url;u.response=Le({url:d,data:void 0},i)}this.hls.trigger(p.ERROR,u)}handlePlaylistLoaded(e,t,s,i,r,n){const o=this.hls,{type:l,level:c,id:h,groupId:u,deliveryDirectives:d}=i,g=Cs(t,i),f=zi(i),m=typeof i.level=="number"&&f===V.MAIN?c:void 0;if(!e.fragments.length){const T=new Error("No Segments found in Playlist");o.trigger(p.ERROR,{type:W.NETWORK_ERROR,details:b.LEVEL_EMPTY_ERROR,fatal:!1,url:g,error:T,reason:T.message,response:t,context:i,level:m,parent:f,networkDetails:r,stats:s});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const E=e.playlistParsingError;if(E){o.trigger(p.ERROR,{type:W.NETWORK_ERROR,details:b.LEVEL_PARSING_ERROR,fatal:!1,url:g,error:E,reason:E.message,response:t,context:i,level:m,parent:f,networkDetails:r,stats:s});return}switch(e.live&&n&&(n.getCacheAge&&(e.ageHeader=n.getCacheAge()||0),(!n.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case te.MANIFEST:case te.LEVEL:o.trigger(p.LEVEL_LOADED,{details:e,level:m||0,id:h||0,stats:s,networkDetails:r,deliveryDirectives:d});break;case te.AUDIO_TRACK:o.trigger(p.AUDIO_TRACK_LOADED,{details:e,id:h||0,groupId:u||"",stats:s,networkDetails:r,deliveryDirectives:d});break;case te.SUBTITLE_TRACK:o.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,id:h||0,groupId:u||"",stats:s,networkDetails:r,deliveryDirectives:d});break}}}function tn(a,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=a,e.dispatchEvent(t)}function sn(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues&&!a.cues.getCueById(e.id))try{if(a.addCue(e),!a.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(s){S.debug(`[texttrack-utils]: ${s}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,a.addCue(i)}catch(i){S.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(a.mode=t)}function vt(a){const e=a.mode;if(e==="disabled"&&(a.mode="hidden"),a.cues)for(let t=a.cues.length;t--;)a.removeCue(a.cues[t]);e==="disabled"&&(a.mode=e)}function zs(a,e,t,s){const i=a.mode;if(i==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const r=Mo(a.cues,e,t);for(let n=0;na[t].endTime)return-1;let s=0,i=t;for(;s<=i;){const r=Math.floor((i+s)/2);if(ea[r].startTime&&s-1)for(let r=i,n=a.length;r=e&&o.endTime<=t)s.push(o);else if(o.startTime>t)return s}return s}function Xt(a){const e=[];for(let t=0;t"u"))return self.VTTCue||self.TextTrackCue}function qi(a,e,t,s,i){let r=new a(e,t,"");try{r.value=s,i&&(r.type=i)}catch{r=new a(e,t,JSON.stringify(i?Le({type:i},s):s))}return r}const Gt=(()=>{const a=qs();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function _s(a,e){return a.getTime()/1e3-e}function Uo(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class Bo{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(vt(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tGt&&(u=Gt),u-h<=0&&(u=h+No);for(let g=0;gh.type===Ye.audioId3&&l:i==="video"?c=h=>h.type===Ye.emsg&&o:c=h=>h.type===Ye.audioId3&&l||h.type===Ye.emsg&&o,zs(r,t,s,c)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:s,id3Track:i}=this,{dateRanges:r}=t,n=Object.keys(r);if(i){const h=Object.keys(s).filter(u=>!n.includes(u));for(let u=h.length;u--;){const d=h[u];Object.keys(s[d].cues).forEach(g=>{i.removeCue(s[d].cues[g])}),delete s[d]}}const o=t.fragments[t.fragments.length-1];if(n.length===0||!N(o?.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=o.programDateTime/1e3-o.start,c=qs();for(let h=0;h{if(D!==d.id){const R=r[D];if(R.class===d.class&&R.startDate>d.startDate&&(!x||d.startDatethis.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:s,targetduration:i}=e,{liveSyncDuration:r,liveSyncDurationCount:n,lowLatencyMode:o}=this.config,l=this.hls.userConfig;let c=o&&s||t;(l.liveSyncDuration||l.liveSyncDurationCount||c===0)&&(c=r!==void 0?r:n*i);const h=i;return c+Math.min(this.stallCount*1,h)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,s=this.levelDetails;if(e===null||t===null||s===null)return null;const i=s.edge,r=e-t-this.edgeStalled,n=i-s.totalduration,o=i-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(n,r),o)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const s=e.buffered.length;return(s?e.buffered.end(s-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(p.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(p.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var s;t.details===b.BUFFER_STALLED_ERROR&&(this.stallCount++,(s=this.levelDetails)!=null&&s.live&&S.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const s=this.computeLatency();if(s===null)return;this._latency=s;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:r}=this.config;if(!i||r===1||!t.live)return;const n=this.targetLatency;if(n===null)return;const o=s-n,l=Math.min(this.maxLatency,n+t.targetduration);if(o.05&&this.forwardBufferLength>1){const h=Math.min(2,Math.max(1,r)),u=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;e.playbackRate=Math.min(h,Math.max(1,u))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const Xs=["NONE","TYPE-0","TYPE-1",null];function $o(a){return Xs.indexOf(a)>-1}const ls=["SDR","PQ","HLG"];function Ko(a){return!!a&&ls.indexOf(a)>-1}var Qt={No:"",Yes:"YES",v2:"v2"};function Xi(a){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=a,i=s!!t).map(t=>t.substring(0,4)).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Ji(this._audioGroups,e)}hasSubtitleGroup(e){return Ji(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(t)===-1&&s.push(t)}else if(e==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(t)===-1&&s.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function Ji(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function ws(a,e){const t=e.startPTS;if(N(t)){let s=0,i;e.sn>a.sn?(s=t-a.start,i=a):(s=a.start-t,i=e),i.duration!==s&&(i.duration=s)}else e.sn>a.sn?a.cc===e.cc&&a.minEndPTS?e.start=a.start+(a.minEndPTS-a.start):e.start=a.start+a.duration:e.start=Math.max(a.start-e.duration,0)}function rn(a,e,t,s,i,r){s-t<=0&&(S.warn("Fragment should have a positive duration",e),s=t+e.duration,r=i+e.duration);let o=t,l=s;const c=e.startPTS,h=e.endPTS;if(N(c)){const E=Math.abs(c-t);N(e.deltaPTS)?e.deltaPTS=Math.max(E,e.deltaPTS):e.deltaPTS=E,o=Math.max(t,c),t=Math.min(t,c),i=Math.min(i,e.startDTS),l=Math.min(s,h),s=Math.max(s,h),r=Math.max(r,e.endDTS)}const u=t-e.start;e.start!==0&&(e.start=t),e.duration=s-e.start,e.startPTS=t,e.maxStartPTS=o,e.startDTS=i,e.endPTS=s,e.minEndPTS=l,e.endDTS=r;const d=e.sn;if(!a||da.endSN)return 0;let g;const f=d-a.startSN,m=a.fragments;for(m[f]=e,g=f;g>0;g--)ws(m[g],m[g-1]);for(g=f;g=0;l--){const c=s[l].initSegment;if(c){t=c;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let i=0,r;if(Yo(a,e,(l,c)=>{l.relurl&&(i=l.cc-c.cc),N(l.startPTS)&&N(l.endPTS)&&(c.start=c.startPTS=l.startPTS,c.startDTS=l.startDTS,c.maxStartPTS=l.maxStartPTS,c.endPTS=l.endPTS,c.endDTS=l.endDTS,c.minEndPTS=l.minEndPTS,c.duration=l.endPTS-l.startPTS,c.duration&&(r=c),e.PTSKnown=e.alignedSliding=!0),c.elementaryStreams=l.elementaryStreams,c.loader=l.loader,c.stats=l.stats,l.initSegment&&(c.initSegment=l.initSegment,t=l.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(c=>{var h;c&&(!c.initSegment||c.initSegment.relurl===((h=t)==null?void 0:h.relurl))&&(c.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(l=>!l),e.deltaUpdateFailed){S.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let l=e.skippedSegments;l--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=Ho(a.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const n=e.fragments;if(i){S.warn("discontinuity sliding from playlist, take drift into account");for(let l=0;l{c.elementaryStreams=l.elementaryStreams,c.stats=l.stats}),r?rn(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):nn(a,e),n.length&&(e.totalduration=e.edge-n[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const o=e.advancedDateTime;if(e.advanced&&o){const l=e.edge;e.driftStart||(e.driftStartTime=o,e.driftStart=l),e.driftEndTime=o,e.driftEnd=l}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime}function Ho(a,e,t){const s=me({},a);return t&&t.forEach(i=>{delete s[i]}),Object.keys(e).forEach(i=>{const r=new Br(e[i].attr,s[i]);r.isValid?s[i]=r:S.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[i].attr)}"`)}),s}function Wo(a,e,t){if(a&&e){let s=0;for(let i=0,r=a.length;i<=r;i++){const n=a[i],o=e[i+s];n&&o&&n.index===o.index&&n.fragment.sn===o.fragment.sn?t(n,o):s--}}}function Yo(a,e,t){const s=e.skippedSegments,i=Math.max(a.startSN,e.startSN)-e.startSN,r=(a.fragmentHint?1:0)+(s?e.endSN:Math.min(a.endSN,e.endSN))-e.startSN,n=e.startSN-a.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;for(let c=i;c<=r;c++){const h=l[n+c];let u=o[c];s&&!u&&c=s.length||Qs(e,s[t].start)}function Qs(a,e){if(e){const t=a.fragments;for(let s=a.skippedSegments;se){const r=s[s.length-1].duration*1e3;r{const{details:s}=e;s!=null&&s.fragments&&s.fragments.forEach(i=>{i.level=t})})}function cs(a){switch(a.details){case b.FRAG_LOAD_TIMEOUT:case b.KEY_LOAD_TIMEOUT:case b.LEVEL_LOAD_TIMEOUT:case b.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function er(a,e){const t=cs(e);return a.default[`${t?"timeout":"error"}Retry`]}function fi(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function tr(a){return Le(Le({},a),{errorRetry:null,timeoutRetry:null})}function hs(a,e,t,s){if(!a)return!1;const i=s?.code,r=e499)}const ln={search:function(a,e){let t=0,s=a.length-1,i=null,r=null;for(;t<=s;){i=(t+s)/2|0,r=a[i];const n=e(r);if(n>0)t=i+1;else if(n<0)s=i-1;else return r}return null}};function Xo(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!N(e))return null;const s=a[0].programDateTime;if(e<(s||0))return null;const i=a[a.length-1].endProgramDateTime;if(e>=(i||0))return null;t=t||0;for(let r=0;r0&&o<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&((!a||a.level===r.level)&&Js(t,s,r)===0||Qo(r,a,Math.min(i,s))))return r;const n=ln.search(e,Js.bind(null,t,s));return n&&(n!==a||!r)?n:r}function Qo(a,e,t){if(e&&e.start===0&&e.level0){const s=e.tagList.reduce((i,r)=>(r[0]==="INF"&&(i+=parseFloat(r[1])),i),t);return a.start<=s}return!1}function Js(a=0,e=0,t){if(t.start<=a&&t.start+t.duration>a)return 0;const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-s<=a?1:t.start-s>a&&t.start?-1:0}function Jo(a,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>a}function Zo(a,e){return ln.search(a,t=>t.cce?-1:0)}var Ae={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},He={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2};class el{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=S.log.bind(S,"[info]:"),this.warn=S.warn.bind(S,"[warning]:"),this.error=S.error.bind(S,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.ERROR,this.onError,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.ERROR,this.onError,this),e.off(p.ERROR,this.onErrorOut,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===V.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var s,i;if(t.fatal)return;const r=this.hls,n=t.context;switch(t.details){case b.FRAG_LOAD_ERROR:case b.FRAG_LOAD_TIMEOUT:case b.KEY_LOAD_ERROR:case b.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case b.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction={action:Ae.DoNothing,flags:He.None};return}case b.FRAG_GAP:case b.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Ae.SendAlternateToPenaltyBox;return}case b.LEVEL_EMPTY_ERROR:case b.LEVEL_PARSING_ERROR:{var o,l;const c=t.parent===V.MAIN?t.level:r.loadLevel;t.details===b.LEVEL_EMPTY_ERROR&&((o=t.context)!=null&&(l=o.levelDetails)!=null&&l.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case b.LEVEL_LOAD_ERROR:case b.LEVEL_LOAD_TIMEOUT:typeof n?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level));return;case b.AUDIO_TRACK_LOAD_ERROR:case b.AUDIO_TRACK_LOAD_TIMEOUT:case b.SUBTITLE_LOAD_ERROR:case b.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){const c=r.levels[r.loadLevel];if(c&&(n.type===te.AUDIO_TRACK&&c.hasAudioGroup(n.groupId)||n.type===te.SUBTITLE_TRACK&&c.hasSubtitleGroup(n.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=Ae.SendAlternateToPenaltyBox,t.errorAction.flags=He.MoveAllAlternatesMatchingHost;return}}return;case b.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const c=r.levels[r.loadLevel],h=c?.attrs["HDCP-LEVEL"];h?t.errorAction={action:Ae.SendAlternateToPenaltyBox,flags:He.MoveAllAlternatesMatchingHDCP,hdcpLevel:h}:this.keySystemError(t)}return;case b.BUFFER_ADD_CODEC_ERROR:case b.REMUX_ALLOC_ERROR:case b.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(i=t.level)!=null?i:r.loadLevel);return;case b.INTERNAL_EXCEPTION:case b.BUFFER_APPENDING_ERROR:case b.BUFFER_FULL_ERROR:case b.LEVEL_SWITCH_ERROR:case b.BUFFER_STALLED_ERROR:case b.BUFFER_SEEK_OVER_HOLE:case b.BUFFER_NUDGE_ON_STALL:t.errorAction={action:Ae.DoNothing,flags:He.None};return}t.type===W.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const s=this.hls,i=er(s.config.playlistLoadPolicy,e),r=this.playlistError++;if(hs(i,r,cs(e),e.response))return{action:Ae.RetryRequest,flags:He.None,retryConfig:i,retryCount:r};const o=this.getLevelSwitchAction(e,t);return i&&(o.retryConfig=i,o.retryCount=r),o}getFragRetryOrSwitchAction(e){const t=this.hls,s=this.getVariantLevelIndex(e.frag),i=t.levels[s],{fragLoadPolicy:r,keyLoadPolicy:n}=t.config,o=er(e.details.startsWith("key")?n:r,e),l=t.levels.reduce((h,u)=>h+u.fragmentError,0);if(i&&(e.details!==b.FRAG_GAP&&i.fragmentError++,hs(o,l,cs(e),e.response)))return{action:Ae.RetryRequest,flags:He.None,retryConfig:o,retryCount:l};const c=this.getLevelSwitchAction(e,s);return o&&(c.retryConfig=o,c.retryCount=l),c}getLevelSwitchAction(e,t){const s=this.hls;t==null&&(t=s.loadLevel);const i=this.hls.levels[t];if(i){var r,n;const c=e.details;i.loadError++,c===b.BUFFER_APPEND_ERROR&&i.fragmentError++;let h=-1;const{levels:u,loadLevel:d,minAutoLevel:g,maxAutoLevel:f}=s;s.autoLevelEnabled||(s.loadLevel=-1);const m=(r=e.frag)==null?void 0:r.type,T=(m===V.AUDIO&&c===b.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(c===b.BUFFER_ADD_CODEC_ERROR||c===b.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:D})=>i.audioCodec!==D),v=e.sourceBufferName==="video"&&(c===b.BUFFER_ADD_CODEC_ERROR||c===b.BUFFER_APPEND_ERROR)&&u.some(({codecSet:D,audioCodec:R})=>i.codecSet!==D&&i.audioCodec===R),{type:A,groupId:x}=(n=e.context)!=null?n:{};for(let D=u.length;D--;){const R=(D+d)%u.length;if(R!==d&&R>=g&&R<=f&&u[R].loadError===0){var o,l;const C=u[R];if(c===b.FRAG_GAP&&m===V.MAIN&&e.frag){const k=u[R].details;if(k){const I=us(e.frag,k.fragments,e.frag.start);if(I!=null&&I.gap)continue}}else{if(A===te.AUDIO_TRACK&&C.hasAudioGroup(x)||A===te.SUBTITLE_TRACK&&C.hasSubtitleGroup(x))continue;if(m===V.AUDIO&&(o=i.audioGroups)!=null&&o.some(k=>C.hasAudioGroup(k))||m===V.SUBTITLE&&(l=i.subtitleGroups)!=null&&l.some(k=>C.hasSubtitleGroup(k))||T&&i.audioCodec===C.audioCodec||!T&&i.audioCodec!==C.audioCodec||v&&i.codecSet===C.codecSet)continue}h=R;break}}if(h>-1&&s.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:Ae.SendAlternateToPenaltyBox,flags:He.None,nextAutoLevel:h}}return{action:Ae.SendAlternateToPenaltyBox,flags:He.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case Ae.DoNothing:break;case Ae.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==b.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,s=e.errorAction;if(!s)return;const{flags:i,hdcpLevel:r,nextAutoLevel:n}=s;switch(i){case He.None:this.switchLevel(e,n);break;case He.MoveAllAlternatesMatchingHDCP:r&&(t.maxHdcpLevel=Xs[Xs.indexOf(r)-1],s.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}s.resolved||this.switchLevel(e,n)}switchLevel(e,t){t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}class gi{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=S.log.bind(S,`${t}:`),this.warn=S.warn.bind(S,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,s){const i=t?.renditionReports;if(i){let r=-1;for(let n=0;n=0&&h>t.partTarget&&(l+=1)}const c=s&&Xi(s);return new Qi(o,l>=0?l:void 0,c)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,s){const{details:i,stats:r}=t,n=self.performance.now(),o=r.loading.first?Math.max(0,n-r.loading.first):0;if(i.advancedDateTime=Date.now()-o,i.live||s!=null&&s.live){if(i.reloaded(s),s&&this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),s&&i.fragments.length>0&&Vo(s,i),!this.canLoad||!i.live)return;let l,c,h;if(i.canBlockReload&&i.endSN&&i.advanced){const E=this.hls.config.lowLatencyMode,T=i.lastPartSn,y=i.endSN,v=i.lastPartIndex,A=v!==-1,x=T===y,D=E?0:v;A?(c=x?y+1:T,h=x?D:v+1):c=y+1;const R=i.age,C=R+i.ageHeader;let k=Math.min(C-i.partTarget,i.targetduration*1.5);if(k>0){if(s&&k>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${k} with playlist age: ${i.age}`),k=0;else{const I=Math.floor(k/i.targetduration);if(c+=I,h!==void 0){const w=Math.round(k%i.targetduration/i.partTarget);h+=w}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${R.toFixed(2)}s goal: ${k} skip sn ${I} to part ${h}`)}i.tuneInGoal=k}if(l=this.getDeliveryDirectives(i,t.deliveryDirectives,c,h),E||!x){this.loadPlaylist(l);return}}else(i.canBlockReload||i.canSkipUntil)&&(l=this.getDeliveryDirectives(i,t.deliveryDirectives,c,h));const u=this.hls.mainForwardBufferInfo,d=u?u.end-u.len:0,g=(i.edge-d)*1e3,f=jo(i,g);i.updated&&n>this.requestScheduled+f&&(this.requestScheduled=r.loading.start),c!==void 0&&i.canBlockReload?this.requestScheduled=r.loading.first+f-(i.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+fthis.loadPlaylist(l),m)}else this.clearTimer()}getDeliveryDirectives(e,t,s,i){let r=Xi(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,i=t.part,r=Qt.No),new Qi(s,i,r)}checkRetry(e){const t=e.details,s=cs(e),i=e.errorAction,{action:r,retryCount:n=0,retryConfig:o}=i||{},l=!!i&&!!o&&(r===Ae.RetryRequest||!i.resolved&&r===Ae.SendAlternateToPenaltyBox);if(l){var c;if(this.requestScheduled=-1,n>=o.maxNumRetry)return!1;if(s&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${n+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const h=fi(o,n);this.timer=self.setTimeout(()=>this.loadPlaylist(),h),this.warn(`Retrying playlist loading ${n+1}/${o.maxNumRetry} after "${t}" in ${h}ms`)}e.levelRetry=!0,i.resolved=!0}return l}}class mt{constructor(e,t=0,s=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=s}sample(e,t){const s=Math.pow(this.alpha_,e);this.estimate_=t*(1-s)+s*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class tl{constructor(e,t,s,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new mt(e),this.fast_=new mt(t),this.defaultTTFB_=i,this.ttfb_=new mt(e)}update(e,t){const{slow_:s,fast_:i,ttfb_:r}=this;s.halfLife!==e&&(this.slow_=new mt(e,s.getEstimate(),s.getTotalWeight())),i.halfLife!==t&&(this.fast_=new mt(t,i.getEstimate(),i.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new mt(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const s=8*t,i=e/1e3,r=s/i;this.fast_.sample(i,r),this.slow_.sample(i,r)}sampleTTFB(e){const t=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(s,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const cn={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},sr={};function sl(a,e,t,s,i,r){const n=a.audioCodec?a.audioGroups:null,o=r?.audioCodec,l=r?.channels,c=l?parseInt(l):o?1/0:2;let h=null;if(n!=null&&n.length)try{n.length===1&&n[0]?h=e.groups[n[0]].channels:h=n.reduce((u,d)=>{if(d){const g=e.groups[d];if(!g)throw new Error(`Audio track group ${d} not found`);Object.keys(g.channels).forEach(f=>{u[f]=(u[f]||0)+g.channels[f]})}return u},{2:0})}catch{return!0}return a.videoCodec!==void 0&&(a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(s,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(i,8e6))||!!h&&N(c)&&Object.keys(h).some(u=>parseInt(u)>c)}function il(a,e,t){const s=a.videoCodec,i=a.audioCodec;if(!s||!i||!t)return Promise.resolve(cn);const r={width:a.width,height:a.height,bitrate:Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)),framerate:a.frameRate||30},n=a.videoRange;n!=="SDR"&&(r.transferFunction=n.toLowerCase());const o=s.split(",").map(l=>({type:"media-source",video:Le(Le({},r),{},{contentType:Ft(l,"video")})}));return i&&a.audioGroups&&a.audioGroups.forEach(l=>{var c;l&&((c=e.groups[l])==null||c.tracks.forEach(h=>{if(h.groupId===l){const u=h.channels||"",d=parseFloat(u);N(d)&&d>2&&o.push.apply(o,i.split(",").map(g=>({type:"media-source",audio:{contentType:Ft(g,"audio"),channels:""+d}})))}}))}),Promise.all(o.map(l=>{const c=rl(l);return sr[c]||(sr[c]=t.decodingInfo(l))})).then(l=>({supported:!l.some(c=>!c.supported),configurations:o,decodingInfoResults:l})).catch(l=>({supported:!1,configurations:o,decodingInfoResults:[],error:l}))}function rl(a){const{audio:e,video:t}=a,s=t||e;if(s){const i=s.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${i}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${i}`}return""}function nl(){if(typeof matchMedia=="function"){const a=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(a.media!==e.media)return a.matches===!0}return!1}function al(a,e){let t=!1,s=[];return a&&(t=a!=="SDR",s=[a]),e&&(s=e.allowedVideoRanges||ls.slice(0),t=e.preferHDR!==void 0?e.preferHDR:nl(),t?s=s.filter(i=>i!=="SDR"):s=["SDR"]),{preferHDR:t,allowedVideoRanges:s}}function ol(a,e,t,s,i){const r=Object.keys(a),n=s?.channels,o=s?.audioCodec,l=n&&parseInt(n)===2;let c=!0,h=!1,u=1/0,d=1/0,g=1/0,f=0,m=[];const{preferHDR:E,allowedVideoRanges:T}=al(e,i);for(let x=r.length;x--;){const D=a[r[x]];c=D.channels[2]>0,u=Math.min(u,D.minHeight),d=Math.min(d,D.minFramerate),g=Math.min(g,D.minBitrate);const R=T.filter(C=>D.videoRanges[C]>0);R.length>0&&(h=!0,m=R)}u=N(u)?u:0,d=N(d)?d:0;const y=Math.max(1080,u),v=Math.max(30,d);return g=N(g)?g:t,t=Math.max(g,t),h||(e=void 0,m=[]),{codecSet:r.reduce((x,D)=>{const R=a[D];if(D===x)return x;if(R.minBitrate>t)return tt(D,`min bitrate of ${R.minBitrate} > current estimate of ${t}`),x;if(!R.hasDefaultAudio)return tt(D,"no renditions with default or auto-select sound found"),x;if(o&&D.indexOf(o.substring(0,4))%5!==0)return tt(D,`audio codec preference "${o}" not found`),x;if(n&&!l){if(!R.channels[n])return tt(D,`no renditions with ${n} channel sound found (channels options: ${Object.keys(R.channels)})`),x}else if((!o||l)&&c&&R.channels[2]===0)return tt(D,"no renditions with stereo sound found"),x;return R.minHeight>y?(tt(D,`min resolution of ${R.minHeight} > maximum of ${y}`),x):R.minFramerate>v?(tt(D,`min framerate of ${R.minFramerate} > maximum of ${v}`),x):m.some(C=>R.videoRanges[C]>0)?R.maxScore=as(x)||R.fragmentError>a[x].fragmentError)?x:(f=R.maxScore,D):(tt(D,`no variants with VIDEO-RANGE of ${JSON.stringify(m)} found`),x)},void 0),videoRanges:m,preferHDR:E,minFramerate:d,minBitrate:g}}function tt(a,e){S.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function ll(a){return a.reduce((e,t)=>{let s=e.groups[t.groupId];s||(s=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(t);const i=t.channels||"2";return s.channels[i]=(s.channels[i]||0)+1,s.hasDefault=s.hasDefault||t.default,s.hasAutoSelect=s.hasAutoSelect||t.autoselect,s.hasDefault&&(e.hasDefaultAudio=!0),s.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function cl(a,e,t,s){return a.slice(t,s+1).reduce((i,r)=>{if(!r.codecSet)return i;const n=r.audioGroups;let o=i[r.codecSet];o||(i[r.codecSet]=o={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!n,fragmentError:0}),o.minBitrate=Math.min(o.minBitrate,r.bitrate);const l=Math.min(r.height,r.width);return o.minHeight=Math.min(o.minHeight,l),o.minFramerate=Math.min(o.minFramerate,r.frameRate),o.maxScore=Math.max(o.maxScore,r.score),o.fragmentError+=r.fragmentError,o.videoRanges[r.videoRange]=(o.videoRanges[r.videoRange]||0)+1,n&&n.forEach(c=>{if(!c)return;const h=e.groups[c];h&&(o.hasDefaultAudio=o.hasDefaultAudio||e.hasDefaultAudio?h.hasDefault:h.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(h.channels).forEach(u=>{o.channels[u]=(o.channels[u]||0)+h.channels[u]}))}),i},{})}function Qe(a,e,t){if("attrs"in a){const s=e.indexOf(a);if(s!==-1)return s}for(let s=0;ss.indexOf(i)===-1)}function pt(a,e){const{audioCodec:t,channels:s}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(s===void 0||s===(e.channels||"2"))}function ul(a,e,t,s,i){const r=e[s],o=e.reduce((d,g,f)=>{const m=g.uri;return(d[m]||(d[m]=[])).push(f),d},{})[r.uri];o.length>1&&(s=Math.max.apply(Math,o));const l=r.videoRange,c=r.frameRate,h=r.codecSet.substring(0,4),u=ir(e,s,d=>{if(d.videoRange!==l||d.frameRate!==c||d.codecSet.substring(0,4)!==h)return!1;const g=d.audioGroups,f=t.filter(m=>!g||g.indexOf(m.groupId)!==-1);return Qe(a,f,i)>-1});return u>-1?u:ir(e,s,d=>{const g=d.audioGroups,f=t.filter(m=>!g||g.indexOf(m.groupId)!==-1);return Qe(a,f,i)>-1})}function ir(a,e,t){for(let s=e;s;s--)if(t(a[s]))return s;for(let s=e+1;s{const{fragCurrent:t,partCurrent:s,hls:i}=this,{autoLevelEnabled:r,media:n}=i;if(!t||!n)return;const o=performance.now(),l=s?s.stats:t.stats,c=s?s.duration:t.duration,h=o-l.loading.start,u=i.minAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||t.level<=u){this.clearTimer(),this._nextAutoLevel=-1;return}if(!r||n.paused||!n.playbackRate||!n.readyState)return;const d=i.mainForwardBufferInfo;if(d===null)return;const g=this.bwEstimator.getEstimateTTFB(),f=Math.abs(n.playbackRate);if(h<=Math.max(g,1e3*(c/(f*2))))return;const m=d.len/f,E=l.loading.first?l.loading.first-l.loading.start:-1,T=l.loaded&&E>-1,y=this.getBwEstimate(),v=i.levels,A=v[t.level],x=l.total||Math.max(l.loaded,Math.round(c*A.averageBitrate/8));let D=T?h-E:h;D<1&&T&&(D=Math.min(h,l.loaded*8/y));const R=T?l.loaded*1e3/D:0,C=R?(x-l.loaded)/R:x*8/y+g/1e3;if(C<=m)return;const k=R?R*8:y;let I=Number.POSITIVE_INFINITY,w;for(w=t.level-1;w>u;w--){const F=v[w].maxBitrate;if(I=this.getTimeToLoadFrag(g/1e3,k,c*F,!v[w].details),I=C||I>c*10)return;i.nextLoadLevel=i.nextAutoLevel=w,T?this.bwEstimator.sample(h-Math.min(g,E),l.loaded):this.bwEstimator.sampleTTFB(h);const B=v[w].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>B&&this.resetEstimator(B),this.clearTimer(),S.warn(`[abr] Fragment ${t.sn}${s?" part "+s.index:""} of level ${t.level} is loading too slowly; + Time to underbuffer: ${m.toFixed(3)} s + Estimated load time for current fragment: ${C.toFixed(3)} s + Estimated load time for down switch fragment: ${I.toFixed(3)} s + TTFB estimate: ${E|0} ms + Current BW estimate: ${N(y)?y|0:"Unknown"} bps + New BW estimate: ${this.getBwEstimate()|0} bps + Switching to level ${w} @ ${B|0} bps`),i.trigger(p.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:s,stats:l})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(S.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new tl(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(p.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const s=t.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var i;this.fragCurrent=s,this.partCurrent=(i=t.part)!=null?i:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case b.BUFFER_ADD_CODEC_ERROR:case b.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case b.FRAG_LOAD_TIMEOUT:{const s=t.frag,{fragCurrent:i,partCurrent:r}=this;if(s&&i&&s.sn===i.sn&&s.level===i.level){const n=performance.now(),o=r?r.stats:s.stats,l=n-o.loading.start,c=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&c>-1){const u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(u,c),o.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,s,i){const r=e+s/t,n=i?this.lastLevelLoadSec:0;return r+n}onLevelLoaded(e,t){const s=this.hls.config,{loading:i}=t.stats,r=i.end-i.start;N(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:s}){const i=s?s.stats:t.stats;if(t.type===V.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const r=s?s.duration:t.duration,n=this.hls.levels[t.level],o=(n.loaded?n.loaded.bytes:0)+i.loaded,l=(n.loaded?n.loaded.duration:0)+r;n.loaded={bytes:o,duration:l},n.realBitrate=Math.round(8*o/l)}if(t.bitrateTest){const r={stats:i,frag:t,part:s,id:t.type};this.onFragBuffered(p.FRAG_BUFFERED,r),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:s,part:i}=t,r=i!=null&&i.stats.loaded?i.stats:s.stats;if(r.aborted||this.ignoreFragment(s))return;const n=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(n,r.loaded),r.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=n/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==V.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,s=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,r=this.findBestLevel(s,t,e,0,i,1,1);if(r>-1)return r;const n=this.hls.firstLevel,o=Math.min(Math.max(n,t),e);return S.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${n} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!s||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const r=s&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const n=this.hls.levels;if(n.length>Math.max(e,r)&&n[e].loadError<=n[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:s}=this,{maxAutoLevel:i,config:r,minAutoLevel:n}=s,o=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),c=this.getStarvationDelay();let h=r.abrBandWidthFactor,u=r.abrBandWidthUpFactor;if(c){const E=this.findBestLevel(l,n,i,c,0,h,u);if(E>=0)return E}let d=o?Math.min(o,r.maxStarvationDelay):r.maxStarvationDelay;if(!c){const E=this.bitrateTestDelay;E&&(d=(o?Math.min(o,r.maxLoadingDelay):r.maxLoadingDelay)-E,S.info(`[abr] bitrate test took ${Math.round(1e3*E)}ms, set first fragment max fetchDuration to ${Math.round(1e3*d)} ms`),h=u=1)}const g=this.findBestLevel(l,n,i,c,d,h,u);if(S.info(`[abr] ${c?"rebuffering expected":"buffer is empty"}, optimal quality level ${g}`),g>-1)return g;const f=s.levels[n],m=s.levels[s.loadLevel];return f?.bitrate=t;H--){var G;const U=f[H],Z=H>u;if(!U)continue;if(T.useMediaCapabilities&&!U.supportedResult&&!U.supportedPromise){const ae=navigator.mediaCapabilities;typeof ae?.decodingInfo=="function"&&sl(U,I,D,R,e,C)?(U.supportedPromise=il(U,I,ae),U.supportedPromise.then(re=>{if(!this.hls)return;U.supportedResult=re;const de=this.hls.levels,Re=de.indexOf(U);re.error?S.warn(`[abr] MediaCapabilities decodingInfo error: "${re.error}" for level ${Re} ${JSON.stringify(re)}`):re.supported||(S.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${Re} ${JSON.stringify(re)}`),Re>-1&&de.length>1&&(S.log(`[abr] Removing unsupported level ${Re}`),this.hls.removeLevel(Re)))})):U.supportedResult=cn}if(x&&U.codecSet!==x||D&&U.videoRange!==D||Z&&R>U.frameRate||!Z&&R>0&&R=w*2&&r===0?f[H].averageBitrate:f[H].maxBitrate,j=this.getTimeToLoadFrag(B,M,ee*O,q===void 0);if(M>=ee&&(H===h||U.loadError===0&&U.fragmentError===0)&&(j<=B||!N(j)||v&&!this.bitrateTestDelay||j${H} adjustedbw(${Math.round(M)})-bitrate=${Math.round(M-ee)} ttfb:${B.toFixed(1)} avgDuration:${O.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${j.toFixed(1)} firstSelection:${A} codecSet:${x} videoRange:${D} hls.loadLevel:${E}`)),A&&(this.firstSelection=H),H}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:s}=this.hls,i=Math.min(Math.max(e,s),t);this._nextAutoLevel!==i&&(this.nextAutoLevelKey="",this._nextAutoLevel=i)}}class fl{constructor(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var xe={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class gl{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const s=this.activePartLists[t];if(s)for(let i=s.length;i--;){const r=s[i];if(!r)break;const n=r.end;if(r.start<=e&&n!==null&&e<=n)return r}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:s}=this,i=Object.keys(s);for(let r=i.length;r--;){const n=s[i[r]];if(n?.body.type===t&&n.buffered){const o=n.body;if(o.start<=e&&e<=o.end)return o}}return null}detectEvictedFragments(e,t,s,i){this.timeRanges&&(this.timeRanges[e]=t);const r=i?.fragment.sn||-1;Object.keys(this.fragments).forEach(n=>{const o=this.fragments[n];if(!o||r>=o.body.sn)return;if(!o.buffered&&!o.loaded){o.body.type===s&&this.removeFragment(o.body);return}const l=o.range[e];l&&l.time.some(c=>{const h=!this.isTimeBuffered(c.startPTS,c.endPTS,t);return h&&this.removeFragment(o.body),h})})}detectPartialFragments(e){const t=this.timeRanges,{frag:s,part:i}=e;if(!t||s.sn==="initSegment")return;const r=Et(s),n=this.fragments[r];if(!n||n.buffered&&s.gap)return;const o=!s.relurl;Object.keys(t).forEach(l=>{const c=s.elementaryStreams[l];if(!c)return;const h=t[l],u=o||c.partial===!0;n.range[l]=this.getBufferedTimes(s,i,u,h)}),n.loaded=null,Object.keys(n.range).length?(n.buffered=!0,(n.body.endList=s.endList||n.body.endList)&&(this.endListFragments[n.body.type]=n),$t(n)||this.removeParts(s.sn-1,s.type)):this.removeFragment(n.body)}removeParts(e,t){const s=this.activePartLists[t];s&&(this.activePartLists[t]=s.filter(i=>i.fragment.sn>=e))}fragBuffered(e,t){const s=Et(e);let i=this.fragments[s];!i&&t&&(i=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(e,t,s,i){const r={time:[],partial:s},n=e.start,o=e.end,l=e.minEndPTS||o,c=e.maxStartPTS||n;for(let h=0;h=u&&l<=d){r.time.push({startPTS:Math.max(n,i.start(h)),endPTS:Math.min(o,i.end(h))});break}else if(nu){const g=Math.max(n,i.start(h)),f=Math.min(o,i.end(h));f>g&&(r.partial=!0,r.time.push({startPTS:g,endPTS:f}))}else if(o<=u)break}return r}getPartialFragment(e){let t=null,s,i,r,n=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(c=>{const h=l[c];h&&$t(h)&&(i=h.body.start-o,r=h.body.end+o,e>=i&&e<=r&&(s=Math.min(e-i,r-e),n<=s&&(t=h.body,n=s)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||$t(t))}getState(e){const t=Et(e),s=this.fragments[t];return s?s.buffered?$t(s)?xe.PARTIAL:xe.OK:xe.APPENDING:xe.NOT_LOADED}isTimeBuffered(e,t,s){let i,r;for(let n=0;n=i&&t<=r)return!0;if(t<=i)return!1}return!1}onFragLoaded(e,t){const{frag:s,part:i}=t;if(s.sn==="initSegment"||s.bitrateTest)return;const r=i?null:t,n=Et(s);this.fragments[n]={body:s,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:s,part:i,timeRanges:r}=t;if(s.sn==="initSegment")return;const n=s.type;if(i){let o=this.activePartLists[n];o||(this.activePartLists[n]=o=[]),o.push(i)}this.timeRanges=r,Object.keys(r).forEach(o=>{const l=r[o];this.detectEvictedFragments(o,l,n,i)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Et(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,s,i,r){i&&!this.hasGaps||Object.keys(this.fragments).forEach(n=>{const o=this.fragments[n];if(!o)return;const l=o.body;l.type!==s||i&&!l.gap||l.starte&&(o.buffered||r)&&this.removeFragment(l)})}removeFragment(e){const t=Et(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const i=e.sn;this.activePartLists[e.type]=s.filter(r=>r.fragment.sn!==i)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function $t(a){var e,t,s;return a.buffered&&(a.body.gap||((e=a.range.video)==null?void 0:e.partial)||((t=a.range.audio)==null?void 0:t.partial)||((s=a.range.audiovideo)==null?void 0:s.partial))}function Et(a){return`${a.type}_${a.level}_${a.sn}`}const ml={length:0,start:()=>0,end:()=>0};class ne{static isBuffered(e,t){try{if(e){const s=ne.getBuffered(e);for(let i=0;i=s.start(i)&&t<=s.end(i))return!0}}catch{}return!1}static bufferInfo(e,t,s){try{if(e){const i=ne.getBuffered(e),r=[];let n;for(n=0;nu&&(i[h-1].end=e[c].end):i.push(e[c])}else i.push(e[c])}else i=e;let r=0,n,o=t,l=t;for(let c=0;c=h&&tt.startCC||a&&a.cc{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(g=>g[0]==="GAP")){l(or(e));return}else e.gap=!1;const c=this.loader=e.loader=r?new r(i):new n(i),h=ar(e),u=tr(i.fragLoadPolicy.default),d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:nr};e.stats=c.stats,c.load(h,d,{onSuccess:(g,f,m,E)=>{this.resetLoader(e,c);let T=g.data;m.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(T.slice(0,16)),T=T.slice(16)),o({frag:e,part:null,payload:T,networkDetails:E})},onError:(g,f,m,E)=>{this.resetLoader(e,c),l(new it({type:W.NETWORK_ERROR,details:b.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Le({url:s,data:void 0},g),error:new Error(`HTTP Error ${g.code} ${g.text}`),networkDetails:m,stats:E}))},onAbort:(g,f,m)=>{this.resetLoader(e,c),l(new it({type:W.NETWORK_ERROR,details:b.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:m,stats:g}))},onTimeout:(g,f,m)=>{this.resetLoader(e,c),l(new it({type:W.NETWORK_ERROR,details:b.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:m,stats:g}))},onProgress:(g,f,m,E)=>{t&&t({frag:e,part:null,payload:m,networkDetails:E})}})})}loadPart(e,t,s){this.abort();const i=this.config,r=i.fLoader,n=i.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(or(e,t));return}const c=this.loader=e.loader=r?new r(i):new n(i),h=ar(e,t),u=tr(i.fragLoadPolicy.default),d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:nr};t.stats=c.stats,c.load(h,d,{onSuccess:(g,f,m,E)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const T={frag:e,part:t,payload:g.data,networkDetails:E};s(T),o(T)},onError:(g,f,m,E)=>{this.resetLoader(e,c),l(new it({type:W.NETWORK_ERROR,details:b.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Le({url:h.url,data:void 0},g),error:new Error(`HTTP Error ${g.code} ${g.text}`),networkDetails:m,stats:E}))},onAbort:(g,f,m)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),l(new it({type:W.NETWORK_ERROR,details:b.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:m,stats:g}))},onTimeout:(g,f,m)=>{this.resetLoader(e,c),l(new it({type:W.NETWORK_ERROR,details:b.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:m,stats:g}))}})})}updateStatsFromPart(e,t){const s=e.stats,i=t.stats,r=i.total;if(s.loaded+=i.loaded,r){const l=Math.round(e.duration/t.duration),c=Math.min(Math.round(s.loaded/r),l),u=(l-c)*Math.round(s.loaded/c);s.total=s.loaded+u}else s.total=Math.max(s.loaded,s.total);const n=s.loading,o=i.loading;n.start?n.first+=o.first-o.start:(n.start=o.start,n.first=o.first),n.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function ar(a,e=null){const t=e||a,s={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,r=t.byteRangeEndOffset;if(N(i)&&N(r)){var n;let o=i,l=r;if(a.sn==="initSegment"&&((n=a.decryptdata)==null?void 0:n.method)==="AES-128"){const c=r-i;c%16&&(l=r+(16-c%16)),i!==0&&(s.resetIV=!0,o=i-16)}s.rangeStart=o,s.rangeEnd=l}return s}function or(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),s={type:W.MEDIA_ERROR,details:b.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(s.part=e),(e||a).stats.aborted=!0,new it(s)}class it extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class xl{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class Sl{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function Ll(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?ft(a,0,e-t):a}class Al{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),s=new Uint32Array(4);for(let i=0;i<4;i++)s[i]=t.getUint32(i*4);return s}initTable(){const e=this.sBox,t=this.invSBox,s=this.subMix,i=s[0],r=s[1],n=s[2],o=s[3],l=this.invSubMix,c=l[0],h=l[1],u=l[2],d=l[3],g=new Uint32Array(256);let f=0,m=0,E=0;for(E=0;E<256;E++)E<128?g[E]=E<<1:g[E]=E<<1^283;for(E=0;E<256;E++){let T=m^m<<1^m<<2^m<<3^m<<4;T=T>>>8^T&255^99,e[f]=T,t[T]=f;const y=g[f],v=g[y],A=g[v];let x=g[T]*257^T*16843008;i[f]=x<<24|x>>>8,r[f]=x<<16|x>>>16,n[f]=x<<8|x>>>24,o[f]=x,x=A*16843009^v*65537^y*257^f*16843008,c[T]=x<<24|x>>>8,h[T]=x<<16|x>>>16,u[T]=x<<8|x>>>24,d[T]=x,f?(f=y^g[g[g[A^y]]],m^=g[g[m]]):f=m=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let s=!0,i=0;for(;ithis.subtle?(this.logOnce("WebCrypto AES decrypt"),new xl(this.subtle,new Uint8Array(s)).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(S.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,s)))}onWebCryptoError(e,t,s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,s);const i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const s=e.length-e.length%Rl;return s!==e.length&&(t=ft(e,0,s),this.remainderData=ft(e,s)),t}logOnce(e){this.logEnabled&&(S.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const bl={toString:function(a){let e="";const t=a.length;for(let s=0;so.end){const u=n>h;(n{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${r.part?" p: "+r.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(r)};this._doFragLoad(e,t,s,i).then(r=>{if(!r)return;const n=this.state;if(this.fragContextChanged(e)){(n===_.FRAG_LOADING||!this.fragCurrent&&n===_.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=_.IDLE);return}"payload"in r&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(p.FRAG_LOADED,r)),this._handleFragmentLoadComplete(r)}).catch(r=>{this.state===_.STOPPED||this.state===_.ERROR||(this.warn(`Frag error: ${r?.message||r}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:s}=this;if(s.getState(e)===xe.APPENDING){const r=e.type,n=this.getFwdBufferInfo(this.mediaBuffer,r),o=Math.max(e.duration,n?n.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&s.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?s.removeAllFragments():s.hasParts(e.type)&&(s.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),s.getState(e)===xe.PARTIAL&&s.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,s=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:s};this.hls.trigger(p.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{if(!s||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:i}=this,{payload:r}=s,n=e.decryptdata;if(r&&r.byteLength>0&&n!=null&&n.key&&n.iv&&n.method==="AES-128"){const o=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),n.key.buffer,n.iv.buffer).catch(l=>{throw i.trigger(p.ERROR,{type:W.MEDIA_ERROR,details:b.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:e}),l}).then(l=>{const c=self.performance.now();return i.trigger(p.FRAG_DECRYPTED,{frag:e,payload:l,stats:{tstart:o,tdecrypt:c}}),s.payload=l,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===_.STOPPED||this.state===_.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const s=e.frag.stats;this.state=_.IDLE,e.frag.data=new Uint8Array(e.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var s,i,r,n;const o=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===V.MAIN?"level":"track"} ${e.level} (frag:[${((s=e.startPTS)!=null?s:NaN).toFixed(3)}-${((i=e.endPTS)!=null?i:NaN).toFixed(3)}] > buffer:${o?bl.toString(ne.getBuffered(o)):"(detached)"})`),e.sn!=="initSegment"){var l;if(e.type!==V.SUBTITLE){const h=e.elementaryStreams;if(!Object.keys(h).some(u=>!!h[u])){this.state=_.IDLE;return}}const c=(l=this.levels)==null?void 0:l[e.level];c!=null&&c.fragmentError&&(this.log(`Resetting level fragment error count of ${c.fragmentError} on frag buffered`),c.fragmentError=0)}this.state=_.IDLE,o&&(!this.loadedmetadata&&e.type==V.MAIN&&o.buffered.length&&((r=this.fragCurrent)==null?void 0:r.sn)===((n=this.fragPrevious)==null?void 0:n.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:s,part:i,partsLoaded:r}=e,n=!r||r.length===0||r.some(l=>!l),o=new mi(s.level,s.sn,s.stats.chunkCount+1,0,i?i.index:-1,!n);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,i){var r;const n=t?.details;if(!this.levels||!n)throw new Error(`frag load aborted, missing level${n?"":" detail"}s`);let o=null;if(e.encrypted&&!((r=e.decryptdata)!=null&&r.key)?(this.log(`Loading key for ${e.sn} of [${n.startSN}-${n.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=_.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(h=>{if(!this.fragContextChanged(h.frag))return this.hls.trigger(p.KEY_LOADED,h),this.state===_.KEY_LOADING&&(this.state=_.IDLE),h}),this.hls.trigger(p.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&n.encryptedFragments.length&&this.keyLoader.loadClear(e,n.encryptedFragments),s=Math.max(e.start,s||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const h=n.partList;if(h&&i){s>e.end&&n.fragmentHint&&(e=n.fragmentHint);const u=this.getNextPart(h,e,s);if(u>-1){const d=h[u];this.log(`Loading part sn: ${e.sn} p: ${d.index} cc: ${e.cc} of playlist [${n.startSN}-${n.endSN}] parts [0-${u}-${h.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=d.start+d.duration,this.state=_.FRAG_LOADING;let g;return o?g=o.then(f=>!f||this.fragContextChanged(f.frag)?null:this.doFragPartsLoad(e,d,t,i)).catch(f=>this.handleFragLoadError(f)):g=this.doFragPartsLoad(e,d,t,i).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:d,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):g}else if(!e.url||this.loadedEndOfParts(h,s))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${n?"of ["+n.startSN+"-"+n.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(s.toFixed(3))}`),N(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=_.FRAG_LOADING;const l=this.config.progressive;let c;return l&&o?c=o.then(h=>!h||this.fragContextChanged(h?.frag)?null:this.fragmentLoader.load(e,i)).catch(h=>this.handleFragLoadError(h)):c=Promise.all([this.fragmentLoader.load(e,l?i:void 0),o]).then(([h])=>(!l&&h&&i&&i(h),h)).catch(h=>this.handleFragLoadError(h)),this.hls.trigger(p.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c}doFragPartsLoad(e,t,s,i){return new Promise((r,n)=>{var o;const l=[],c=(o=s.details)==null?void 0:o.partList,h=u=>{this.fragmentLoader.loadPart(e,u,i).then(d=>{l[u.index]=d;const g=d.part;this.hls.trigger(p.FRAG_LOADED,d);const f=Zi(s,e.sn,u.index+1)||an(c,e.sn,u.index+1);if(f)h(f);else return r({frag:e,part:g,partsLoaded:l})}).catch(n)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===b.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(p.ERROR,t)}else this.hls.trigger(p.ERROR,{type:W.OTHER_ERROR,details:b.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==_.PARSING){!this.fragCurrent&&this.state!==_.STOPPED&&this.state!==_.ERROR&&(this.state=_.IDLE);return}const{frag:s,part:i,level:r}=t,n=self.performance.now();s.stats.parsing.end=n,i&&(i.stats.parsing.end=n),this.updateLevelTiming(s,i,r,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:s}=this,{level:i,sn:r,part:n}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${r} of level ${i}. The current chunk will not be buffered.`),null;const o=t[i],l=n>-1?Zi(o,r,n):null,c=l?l.fragment:zo(o,r,s);return c?(s&&s!==c&&(c.stats=s.stats),{frag:c,part:l,level:o}):null}bufferFragmentData(e,t,s,i,r){var n;if(!e||this.state!==_.PARSING)return;const{data1:o,data2:l}=e;let c=o;if(o&&l&&(c=Ve(o,l)),!((n=c)!=null&&n.length))return;const h={type:e.type,frag:t,part:s,chunkMeta:i,parent:t.type,data:c};if(this.hls.trigger(p.BUFFER_APPENDING,h),e.dropped&&e.independent&&!s){if(r)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!ne.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const s=t.currentTime,i=ne.bufferInfo(t,s,0),r=e.duration,n=Math.min(this.config.maxFragLookUpTolerance*2,r*.25),o=Math.max(Math.min(e.start-n,i.end-n),s+n);e.start-o>n&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){const s=this.getLoadPosition();return N(s)?this.getFwdBufferInfoAtPos(e,s,t):null}getFwdBufferInfoAtPos(e,t,s){const{config:{maxBufferHole:i}}=this,r=ne.bufferInfo(e,t,i);if(r.len===0&&r.nextStart!==void 0){const n=this.fragmentTracker.getBufferedFrag(t,s);if(n&&r.nextStart=i?(s.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0):!1}getAppendedFrag(e,t=V.MAIN){const s=this.fragmentTracker.getAppendedFrag(e,V.MAIN);return s&&"fragment"in s?s.fragment:s}getNextFragment(e,t){const s=t.fragments,i=s.length;if(!i)return null;const{config:r}=this,n=s[0].start;let o;if(t.live){const l=r.initialLiveManifestSize;if(it}getNextFragmentLoopLoading(e,t,s,i,r){const n=e.gap,o=this.getNextFragment(this.nextLoadPosition,t);if(o===null)return o;if(e=o,n&&e&&!e.gap&&s.nextStart){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,i);if(l!==null&&s.len+l.len>=r)return this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,s){let i=-1,r=!1,n=!0;for(let o=0,l=e.length;o-1&&ss.start&&s.loaded}getInitialLiveFragment(e,t){const s=this.fragPrevious;let i=null;if(s){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),i=Xo(t,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const r=s.sn+1;if(r>=e.startSN&&r<=e.endSN){const n=t[r-e.startSN];s.cc===n.cc&&(i=n,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=Zo(t,s.cc),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const r=this.hls.liveSyncPosition;r!==null&&(i=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,s){const{config:i}=this;let{fragPrevious:r}=this,{fragments:n,endSN:o}=s;const{fragmentHint:l}=s,{maxFragLookUpTolerance:c}=i,h=s.partList,u=!!(i.lowLatencyMode&&h!=null&&h.length&&l);u&&l&&!this.bitrateTest&&(n=n.concat(l),o=l.sn);let d;if(et-c?0:c;d=us(r,n,e,g)}else d=n[n.length-1];if(d){const g=d.sn-s.startSN,f=this.fragmentTracker.getState(d);if((f===xe.OK||f===xe.PARTIAL&&d.gap)&&(r=d),r&&d.sn===r.sn&&(!u||h[0].fragment.sn>d.sn)&&r&&d.level===r.level){const E=n[g+1];d.sn=n-t.maxFragLookUpTolerance&&r<=o;if(i!==null&&s.duration>i&&(r${e.startSN} prev-sn: ${l?l.sn:"na"} fragments: ${i}`),c}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let s=this.startPosition;if(s ${(i=this.fragCurrent)==null?void 0:i.url}`);return}const r=t.details===b.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(s,!0);const n=t.errorAction,{action:o,retryCount:l=0,retryConfig:c}=n||{};if(n&&o===Ae.RetryRequest&&c){this.resetStartWhenNotLoaded(this.levelLastLoaded);const h=fi(c,l);this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${t.details}, retrying loading ${l+1}/${c.maxNumRetry} in ${h}ms`),n.resolved=!0,this.retryDate=self.performance.now()+h,this.state=_.FRAG_LOADING_WAITING_RETRY}else if(c&&n)if(this.resetFragmentErrors(e),l.5;r&&this.reduceMaxBufferLength(i.len,t?.duration||10);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${s} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(e){e===V.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==_.STOPPED&&(this.state=_.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;const i=ne.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,s),this.state===_.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=_.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,s,i){var r;const n=s.details;if(!n){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,c)=>{const h=e.elementaryStreams[c];if(h){const u=h.endPTS-h.startPTS;if(u<=0)return this.warn(`Could not parse fragment ${e.sn} ${c} duration reliably (${u})`),l||!1;const d=i?0:rn(n,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:n,level:s,drift:d,type:c,frag:e,start:h.startPTS,end:h.endPTS}),!0}return l},!1)&&((r=this.transmuxer)==null?void 0:r.error)===null){const l=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(s.fragmentError===0&&(s.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(l.message),this.hls.trigger(p.ERROR,{type:W.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of level "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=_.PARSED,this.hls.trigger(p.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class un{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let s;if(e.length)e.length===1?s=e[0]:s=Il(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function Il(a,e){const t=new Uint8Array(e);let s=0;for(let i=0;i0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Ye.audioId3,duration:Number.POSITIVE_INFINITY});i{if(N(a))return a*90;const s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};function kl(a,e,t,s){let i,r,n,o;const l=navigator.userAgent.toLowerCase(),c=s,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];i=((e[t+2]&192)>>>6)+1;const u=(e[t+2]&60)>>>2;if(u>h.length-1){const d=new Error(`invalid ADTS sampling index:${u}`);a.emit(p.ERROR,p.ERROR,{type:W.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,fatal:!0,error:d,reason:d.message});return}return n=(e[t+2]&1)<<2,n|=(e[t+3]&192)>>>6,S.log(`manifest codec:${s}, ADTS type:${i}, samplingIndex:${u}`),/firefox/i.test(l)?u>=6?(i=5,o=new Array(4),r=u-3):(i=2,o=new Array(2),r=u):l.indexOf("android")!==-1?(i=2,o=new Array(2),r=u):(i=5,o=new Array(4),s&&(s.indexOf("mp4a.40.29")!==-1||s.indexOf("mp4a.40.5")!==-1)||!s&&u>=6?r=u-3:((s&&s.indexOf("mp4a.40.2")!==-1&&(u>=6&&n===1||/vivaldi/i.test(l))||!s&&n===1)&&(i=2,o=new Array(2)),r=u)),o[0]=i<<3,o[0]|=(u&14)>>1,o[1]|=(u&1)<<7,o[1]|=n<<3,i===5&&(o[1]|=(r&14)>>1,o[2]=(r&1)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:h[u],channelCount:n,codec:"mp4a.40."+i,manifestCodec:c}}function dn(a,e){return a[e]===255&&(a[e+1]&246)===240}function fn(a,e){return a[e+1]&1?7:9}function yi(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function Pl(a,e){return e+5=a.length)return!1;const s=yi(a,e);if(s<=t)return!1;const i=e+s;return i===a.length||fs(a,i)}return!1}function gn(a,e,t,s,i){if(!a.samplerate){const r=kl(e,t,s,i);if(!r)return;a.config=r.config,a.samplerate=r.samplerate,a.channelCount=r.channelCount,a.codec=r.codec,a.manifestCodec=r.manifestCodec,S.log(`parsed codec:${a.codec}, rate:${r.samplerate}, channels:${r.channelCount}`)}}function mn(a){return 1024*9e4/a}function Ml(a,e){const t=fn(a,e);if(e+t<=a.length){const s=yi(a,e)-t;if(s>0)return{headerLength:t,frameLength:s}}}function pn(a,e,t,s,i){const r=mn(a.samplerate),n=s+i*r,o=Ml(e,t);let l;if(o){const{frameLength:u,headerLength:d}=o,g=d+u,f=Math.max(0,t+g-e.length);f?(l=new Uint8Array(g-d),l.set(e.subarray(t+d,e.length),0)):l=e.subarray(t+d,t+g);const m={unit:l,pts:n};return f||a.samples.push(m),{sample:m,length:g,missing:f}}const c=e.length-t;return l=new Uint8Array(c),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:n},length:c,missing:-1}}let Vt=null;const Nl=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Ul=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Bl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Gl=[0,1,1,4];function En(a,e,t,s,i){if(t+24>e.length)return;const r=Tn(e,t);if(r&&t+r.frameLength<=e.length){const n=r.samplesPerFrame*9e4/r.sampleRate,o=s+i*n,l={unit:e.subarray(t,t+r.frameLength),pts:o,dts:o};return a.config=[],a.channelCount=r.channelCount,a.samplerate=r.sampleRate,a.samples.push(l),{sample:l,length:r.frameLength,missing:0}}}function Tn(a,e){const t=a[e+1]>>3&3,s=a[e+1]>>1&3,i=a[e+2]>>4&15,r=a[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&r!==3){const n=a[e+2]>>1&1,o=a[e+3]>>6,l=t===3?3-s:s===3?3:4,c=Nl[l*14+i-1]*1e3,u=Ul[(t===3?0:t===2?1:2)*3+r],d=o===3?1:2,g=Bl[t][s],f=Gl[s],m=g*8*f,E=Math.floor(g*c/u+n)*f;if(Vt===null){const v=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Vt=v?parseInt(v[1]):0}return Vt&&Vt<=87&&s===2&&c>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:u,channelCount:d,frameLength:E,samplesPerFrame:m}}}function vi(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function yn(a,e){return e+1{const n=yo(r);if(Vl.test(n.schemeIdUri)){const o=N(n.presentationTime)?n.presentationTime/n.timeScale:t+n.presentationTimeDelta/n.timeScale;let l=n.eventDuration===4294967295?Number.POSITIVE_INFINITY:n.eventDuration/n.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const c=n.payload;s.samples.push({data:c,len:c.byteLength,dts:o,pts:o,type:Ye.emsg,duration:l})}})}return s}demuxSampleAes(e,t,s){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const xn=(a,e)=>{let t=0,s=5;e+=s;const i=new Uint32Array(1),r=new Uint32Array(1),n=new Uint8Array(1);for(;s>0;){n[0]=a[e];const o=Math.min(s,8),l=8-o;r[0]=4278190080>>>24+l<>l,t=t?t<e.length||e[t]!==11||e[t+1]!==119)return-1;const r=e[t+4]>>6;if(r>=3)return-1;const o=[48e3,44100,32e3][r],l=e[t+4]&63,h=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][l*3+r]*2;if(t+h>e.length)return-1;const u=e[t+6]>>5;let d=0;u===2?d+=2:(u&1&&u!==1&&(d+=2),u&4&&(d+=2));const g=(e[t+6]<<8|e[t+7])>>12-d&1,m=[2,1,2,3,3,4,4,5][u]+g,E=e[t+5]>>3,T=e[t+5]&7,y=new Uint8Array([r<<6|E<<1|T>>2,(T&3)<<6|u<<3|g<<2|l>>4,l<<4&224]),v=1536/o*9e4,A=s+i*v,x=e.subarray(t,t+h);return a.config=y,a.channelCount=m,a.samplerate=o,a.samples.push({unit:x,pts:A}),h}class Yl{constructor(){this.VideoSample=null}createVideoSample(e,t,s,i){return{key:e,frame:!1,pts:t,dts:s,units:[],debug:i,length:0}}getLastNalUnit(e){var t;let s=this.VideoSample,i;if((!s||s.units.length===0)&&(s=e[e.length-1]),(t=s)!=null&&t.units){const r=s.units;i=r[r.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const s=t.samples,i=s.length;if(i){const r=s[i-1];e.pts=r.pts,e.dts=r.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&S.log(e.pts+"/"+e.dts+":"+e.debug)}}class lr{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,s=e.byteLength-t,i=new Uint8Array(4),r=Math.min(4,t);if(r===0)throw new Error("no bytes available");i.set(e.subarray(s,s+r)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=r*8,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const s=this.word>>>32-t;if(e>32&&S.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?s<>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,s=8,i;for(let r=0;r{var u;switch(h.type){case 1:{let m=!1;l=!0;const E=h.data;if(c&&E.length>4){const T=new lr(E).readSliceType();(T===2||T===4||T===7||T===9)&&(m=!0)}if(m){var d;(d=o)!=null&&d.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts,"")),o.frame=!0,o.key=m;break}case 5:l=!0,(u=o)!=null&&u.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts,"")),o.key=!0,o.frame=!0;break;case 6:{l=!0,Qr(h.data,1,s.pts,t.samples);break}case 7:{var g,f;l=!0,c=!0;const m=h.data,T=new lr(m).readSPS();if(!e.sps||e.width!==T.width||e.height!==T.height||((g=e.pixelRatio)==null?void 0:g[0])!==T.pixelRatio[0]||((f=e.pixelRatio)==null?void 0:f[1])!==T.pixelRatio[1]){e.width=T.width,e.height=T.height,e.pixelRatio=T.pixelRatio,e.sps=[m],e.duration=r;const y=m.subarray(1,4);let v="avc1.";for(let A=0;A<3;A++){let x=y[A].toString(16);x.length<2&&(x="0"+x),v+=x}e.codec=v}break}case 8:l=!0,e.pps=[h.data];break;case 9:l=!0,e.audFound=!0,o&&this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts,"");break;case 12:l=!0;break;default:l=!1,o&&(o.debug+="unknown NAL "+h.type+" ");break}o&&l&&o.units.push(h)}),i&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}parseAVCNALu(e,t){const s=t.byteLength;let i=e.naluState||0;const r=i,n=[];let o=0,l,c,h,u=-1,d=0;for(i===-1&&(u=0,d=t[0]&31,i=0,o=1);o=0){const g={data:t.subarray(u,c),type:d};n.push(g)}else{const g=this.getLastNalUnit(e.samples);g&&(r&&o<=4-r&&g.state&&(g.data=g.data.subarray(0,g.data.byteLength-r)),c>0&&(g.data=Ve(g.data,t.subarray(0,c)),g.state=0))}o=0&&i>=0){const g={data:t.subarray(u,s),type:d,state:i};n.push(g)}if(n.length===0){const g=this.getLastNalUnit(e.samples);g&&(g.data=Ve(g.data,t))}return e.naluState=i,n}}class zl{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new pi(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,s){const i=e[t].unit;if(i.length<=16)return;const r=i.subarray(16,i.length-i.length%16),n=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(n).then(o=>{const l=new Uint8Array(o);i.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s)})}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length){s();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(t);let i=0;for(let r=32;r{r.data=this.getAvcDecryptedUnit(n,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,i)})}decryptAvcSamples(e,t,s,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,s=0){if(t>=e.length){i();return}const r=e[t].units;for(;!(s>=r.length);s++){const n=r[s];if(!(n.data.length<=48||n.type!==1&&n.type!==5)&&(this.decryptAvcSample(e,t,s,i,n),!this.decrypter.isSync()))return}}}}const Ee=188;class ot{constructor(e,t,s){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.videoParser=new jl}static probe(e){const t=ot.syncOffset(e);return t>0&&S.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let s=Math.min(Ee*5,t-Ee)+1,i=0;for(;i1&&(n===0&&o>2||l+Ee>s))return n}else{if(o)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Yr[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,s,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=ot.createTrack("video"),this._audioTrack=ot.createTrack("audio",i),this._id3Track=ot.createTrack("id3"),this._txtTrack=ot.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s,this._duration=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,s=!1,i=!1){s||(this.sampleAes=null);let r;const n=this._videoTrack,o=this._audioTrack,l=this._id3Track,c=this._txtTrack;let h=n.pid,u=n.pesData,d=o.pid,g=l.pid,f=o.pesData,m=l.pesData,E=null,T=this.pmtParsed,y=this._pmtId,v=e.length;if(this.remainderData&&(e=Ve(this.remainderData,e),v=e.length,this.remainderData=null),v>4;let w;if(I>1){if(w=R+5+e[R+4],w===R+Ee)continue}else w=R+4;switch(k){case h:C&&(u&&(r=Tt(u))&&this.videoParser.parseAVCPES(n,c,r,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(e.subarray(w,R+Ee)),u.size+=R+Ee-w);break;case d:if(C){if(f&&(r=Tt(f)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,r);break;case"mp3":this.parseMPEGPES(o,r);break;case"ac3":this.parseAC3PES(o,r);break}f={data:[],size:0}}f&&(f.data.push(e.subarray(w,R+Ee)),f.size+=R+Ee-w);break;case g:C&&(m&&(r=Tt(m))&&this.parseID3PES(l,r),m={data:[],size:0}),m&&(m.data.push(e.subarray(w,R+Ee)),m.size+=R+Ee-w);break;case 0:C&&(w+=e[w]+1),y=this._pmtId=ql(e,w);break;case y:{C&&(w+=e[w]+1);const B=Xl(e,w,this.typeSupported,s,this.observer);h=B.videoPid,h>0&&(n.pid=h,n.segmentCodec=B.segmentVideoCodec),d=B.audioPid,d>0&&(o.pid=d,o.segmentCodec=B.segmentAudioCodec),g=B.id3Pid,g>0&&(l.pid=g),E!==null&&!T&&(S.warn(`MPEG-TS PMT found at ${R} after unknown PID '${E}'. Backtracking to sync byte @${A} to parse all TS packets.`),E=null,R=A-188),T=this.pmtParsed=!0;break}case 17:case 8191:break;default:E=k;break}}else x++;x>0&&gs(this.observer,new Error(`Found ${x} TS packet/s that do not start with 0x47`)),n.pesData=u,o.pesData=f,l.pesData=m;const D={audioTrack:o,videoTrack:n,id3Track:l,textTrack:c};return i&&this.extractRemainingSamples(D),D}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:s,id3Track:i,textTrack:r}=e,n=s.pesData,o=t.pesData,l=i.pesData;let c;if(n&&(c=Tt(n))?(this.videoParser.parseAVCPES(s,r,c,!0,this._duration),s.pesData=null):s.pesData=n,o&&(c=Tt(o))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,c);break;case"mp3":this.parseMPEGPES(t,c);break;case"ac3":this.parseAC3PES(t,c);break}t.pesData=null}else o!=null&&o.size&&S.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;l&&(c=Tt(l))?(this.parseID3PES(i,c),i.pesData=null):i.pesData=l}demuxSampleAes(e,t,s){const i=this.demux(e,s,!0,!this.config.progressive),r=this.sampleAes=new zl(this.observer,this.config,t);return this.decrypt(i,r)}decrypt(e,t){return new Promise(s=>{const{audioTrack:i,videoTrack:r}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,()=>{s(e)}):s(e)}):r.samples&&t.decryptAvcSamples(r.samples,0,0,()=>{s(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let s=0;const i=this.aacOverFlow;let r=t.data;if(i){this.aacOverFlow=null;const u=i.missing,d=i.sample.unit.byteLength;if(u===-1)r=Ve(i.sample.unit,r);else{const g=d-u;i.sample.unit.set(r.subarray(0,u),g),e.samples.push(i.sample),s=i.missing}}let n,o;for(n=s,o=r.length;n0;)o+=l}}parseID3PES(e,t){if(t.pts===void 0){S.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=me({},t,{type:this._videoTrack?Ye.emsg:Ye.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}}function Zs(a,e){return((a[e+1]&31)<<8)+a[e+2]}function ql(a,e){return(a[e+10]&31)<<8|a[e+11]}function Xl(a,e,t,s,i){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},n=(a[e+1]&15)<<8|a[e+2],o=e+3+n-4,l=(a[e+10]&15)<<8|a[e+11];for(e+=12+l;e0){let u=e+5,d=h;for(;d>2;){a[u]===106&&(t.ac3!==!0?S.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=c,r.segmentAudioCodec="ac3"));const f=a[u+1]+2;u+=f,d-=f}}break;case 194:case 135:return gs(i,new Error("Unsupported EC-3 in M2TS found")),r;case 36:return gs(i,new Error("Unsupported HEVC in M2TS found")),r}e+=h+5}return r}function gs(a,e,t){S.warn(`parsing error: ${e.message}`),a.emit(p.ERROR,p.ERROR,{type:W.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function ks(a){S.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function Tt(a){let e=0,t,s,i,r,n;const o=a.data;if(!a||a.size===0)return null;for(;o[0].length<19&&o.length>1;)o[0]=Ve(o[0],o[1]),o.splice(1,1);if(t=o[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(s=(t[4]<<8)+t[5],s&&s>a.size-6)return null;const c=t[7];c&192&&(r=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,c&64?(n=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,r-n>60*9e4&&(S.warn(`${Math.round((r-n)/9e4)}s delta between PTS and DTS, align them`),r=n)):n=r),i=t[8];let h=i+9;if(a.size<=h)return null;a.size-=h;const u=new Uint8Array(a.size);for(let d=0,g=o.length;df){h-=f;continue}else t=t.subarray(h),f-=h,h=0;u.set(t,e),e+=f}return s&&(s-=i+3),{data:u,pts:r,dts:n,len:s}}return null}class Ql extends Ti{resetInitSegment(e,t,s,i){super.resetInitSegment(e,t,s,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=kt(e,0);let s=t?.length||0;if(t&&e[s]===11&&e[s+1]===119&&di(t)!==void 0&&xn(e,s)<=16)return!1;for(let i=e.length;s>24&255,n[1]=s>>16&255,n[2]=s>>8&255,n[3]=s&255,n.set(e,4),i=0,s=8;i>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return L.box(L.types.mdia,L.mdhd(e.timescale,e.duration),L.hdlr(e.type),L.minf(e))}static mfhd(e){return L.box(L.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?L.box(L.types.minf,L.box(L.types.smhd,L.SMHD),L.DINF,L.stbl(e)):L.box(L.types.minf,L.box(L.types.vmhd,L.VMHD),L.DINF,L.stbl(e))}static moof(e,t,s){return L.box(L.types.moof,L.mfhd(e),L.traf(s,t))}static moov(e){let t=e.length;const s=[];for(;t--;)s[t]=L.trak(e[t]);return L.box.apply(null,[L.types.moov,L.mvhd(e[0].timescale,e[0].duration)].concat(s).concat(L.mvex(e)))}static mvex(e){let t=e.length;const s=[];for(;t--;)s[t]=L.trex(e[t]);return L.box.apply(null,[L.types.mvex,...s])}static mvhd(e,t){t*=e;const s=Math.floor(t/(at+1)),i=Math.floor(t%(at+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,i>>24,i>>16&255,i>>8&255,i&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return L.box(L.types.mvhd,r)}static sdtp(e){const t=e.samples||[],s=new Uint8Array(4+t.length);let i,r;for(i=0;i>>8&255),t.push(n&255),t=t.concat(Array.prototype.slice.call(r));for(i=0;i>>8&255),s.push(n&255),s=s.concat(Array.prototype.slice.call(r));const o=L.box(L.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(s))),l=e.width,c=e.height,h=e.pixelRatio[0],u=e.pixelRatio[1];return L.box(L.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,L.box(L.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),L.box(L.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,u>>24,u>>16&255,u>>8&255,u&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return L.box(L.types.mp4a,L.audioStsd(e),L.box(L.types.esds,L.esds(e)))}static mp3(e){return L.box(L.types[".mp3"],L.audioStsd(e))}static ac3(e){return L.box(L.types["ac-3"],L.audioStsd(e),L.box(L.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?L.box(L.types.stsd,L.STSD,L.mp3(e)):e.segmentCodec==="ac3"?L.box(L.types.stsd,L.STSD,L.ac3(e)):L.box(L.types.stsd,L.STSD,L.mp4a(e)):L.box(L.types.stsd,L.STSD,L.avc1(e))}static tkhd(e){const t=e.id,s=e.duration*e.timescale,i=e.width,r=e.height,n=Math.floor(s/(at+1)),o=Math.floor(s%(at+1));return L.box(L.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,i&255,0,0,r>>8&255,r&255,0,0]))}static traf(e,t){const s=L.sdtp(e),i=e.id,r=Math.floor(t/(at+1)),n=Math.floor(t%(at+1));return L.box(L.types.traf,L.box(L.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),L.box(L.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,n>>24,n>>16&255,n>>8&255,n&255])),L.trun(e,s.length+16+20+8+16+8+8),s)}static trak(e){return e.duration=e.duration||4294967295,L.box(L.types.trak,L.tkhd(e),L.mdia(e))}static trex(e){const t=e.id;return L.box(L.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const s=e.samples||[],i=s.length,r=12+16*i,n=new Uint8Array(r);let o,l,c,h,u,d;for(t+=8+r,n.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o>>24&255,c>>>16&255,c>>>8&255,c&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,u.degradPrio&61440,u.degradPrio&15,d>>>24&255,d>>>16&255,d>>>8&255,d&255],12+16*o);return L.box(L.types.trun,n)}static initSegment(e){L.types||L.init();const t=L.moov(e);return Ve(L.FTYP,t)}}L.types=void 0;L.HDLR_TYPES=void 0;L.STTS=void 0;L.STSC=void 0;L.STCO=void 0;L.STSZ=void 0;L.VMHD=void 0;L.SMHD=void 0;L.STSD=void 0;L.FTYP=void 0;L.DINF=void 0;const Ln=9e4;function xi(a,e,t=1,s=!1){const i=a*e*t;return s?Math.round(i):i}function Jl(a,e,t=1,s=!1){return xi(a,e,1/t,s)}function Dt(a,e=!1){return xi(a,1e3,1/Ln,e)}function Zl(a,e=1){return xi(a,Ln,1/e)}const ec=10*1e3,hr=1024,tc=1152,sc=1536;let yt=null,Ps=null;class Zt{constructor(e,t,s,i=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.ISGenerated=!1,yt===null){const n=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);yt=n?parseInt(n[1]):0}if(Ps===null){const r=navigator.userAgent.match(/Safari\/(\d+)/i);Ps=r?parseInt(r[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){S.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){S.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){S.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const s=e.reduce((i,r)=>{const n=r.pts-i;return n<-4294967296?(t=!0,Ge(i,r.pts)):n>0?i:r.pts},e[0].pts);return t&&S.debug("PTS rollover detected"),s}remux(e,t,s,i,r,n,o,l){let c,h,u,d,g,f,m=r,E=r;const T=e.pid>-1,y=t.pid>-1,v=t.samples.length,A=e.samples.length>0,x=o&&v>0||v>1;if((!T||A)&&(!y||x)||this.ISGenerated||o){if(this.ISGenerated){var R,C,k,I;const G=this.videoTrackConfig;G&&(t.width!==G.width||t.height!==G.height||((R=t.pixelRatio)==null?void 0:R[0])!==((C=G.pixelRatio)==null?void 0:C[0])||((k=t.pixelRatio)==null?void 0:k[1])!==((I=G.pixelRatio)==null?void 0:I[1]))&&this.resetInitSegment()}else u=this.generateIS(e,t,r,n);const w=this.isVideoContiguous;let B=-1,F;if(x&&(B=ic(t.samples),!w&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,B>0){S.warn(`[mp4-remuxer]: Dropped ${B} out of ${v} video samples due to a missing keyframe`);const G=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(B),t.dropped+=B,E+=(t.samples[0].pts-G)/t.inputTimeScale,F=E}else B===-1&&(S.warn(`[mp4-remuxer]: No keyframe found out of ${v} video samples`),f=!1);if(this.ISGenerated){if(A&&x){const G=this.getVideoStartPts(t.samples),U=(Ge(e.samples[0].pts,G)-G)/t.inputTimeScale;m+=Math.max(0,U),E+=Math.max(0,-U)}if(A){if(e.samplerate||(S.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(e,t,r,n)),h=this.remuxAudio(e,m,this.isAudioContiguous,n,y||x||l===V.AUDIO?E:void 0),x){const G=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(S.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(e,t,r,n)),c=this.remuxVideo(t,E,w,G)}}else x&&(c=this.remuxVideo(t,E,w,0));c&&(c.firstKeyFrame=B,c.independent=B!==-1,c.firstKeyFramePTS=F)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(g=An(s,r,this._initPTS,this._initDTS)),i.samples.length&&(d=Rn(i,r,this._initPTS))),{audio:h,video:c,initSegment:u,independent:f,text:d,id3:g}}generateIS(e,t,s,i){const r=e.samples,n=t.samples,o=this.typeSupported,l={},c=this._initPTS;let h=!c||i,u="audio/mp4",d,g,f;if(h&&(d=g=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(u="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:u,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):L.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(f=e.inputTimeScale,!c||f!==c.timescale?d=g=r[0].pts-Math.round(f*s):h=!1)}if(t.sps&&t.pps&&n.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:L.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(f=t.inputTimeScale,!c||f!==c.timescale){const m=this.getVideoStartPts(n),E=Math.round(f*s);g=Math.min(g,Ge(n[0].dts,m)-E),d=Math.min(d,m-E)}else h=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,h?(this._initPTS={baseTime:d,timescale:f},this._initDTS={baseTime:g,timescale:f}):d=f=void 0,{tracks:l,initPTS:d,timescale:f}}remuxVideo(e,t,s,i){const r=e.inputTimeScale,n=e.samples,o=[],l=n.length,c=this._initPTS;let h=this.nextAvcDts,u=8,d=this.videoSampleDuration,g,f,m=Number.POSITIVE_INFINITY,E=Number.NEGATIVE_INFINITY,T=!1;if(!s||h===null){const O=t*r,M=n[0].pts-Ge(n[0].dts,n[0].pts);yt&&h!==null&&Math.abs(O-M-h)<15e3?s=!0:h=O-M}const y=c.baseTime*r/c.timescale;for(let O=0;O0?O-1:O].dts&&(T=!0)}T&&n.sort(function(O,M){const ee=O.dts-M.dts,j=O.pts-M.pts;return ee||j}),g=n[0].dts,f=n[n.length-1].dts;const v=f-g,A=v?Math.round(v/(l-1)):d||e.inputTimeScale/30;if(s){const O=g-h,M=O>A,ee=O<-1;if((M||ee)&&(M?S.warn(`AVC: ${Dt(O,!0)} ms (${O}dts) hole between fragments detected at ${t.toFixed(3)}`):S.warn(`AVC: ${Dt(-O,!0)} ms (${O}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!ee||h>=n[0].pts||yt)){g=h;const j=n[0].pts-O;if(M)n[0].dts=g,n[0].pts=j;else for(let X=0;Xj);X++)n[X].dts-=O,n[X].pts-=O;S.log(`Video: Initial PTS/DTS adjusted: ${Dt(j,!0)}/${Dt(g,!0)}, delta: ${Dt(O,!0)} ms`)}}g=Math.max(0,g);let x=0,D=0,R=g;for(let O=0;O0?M.dts-n[O-1].dts:A;if(X=O>0?M.pts-n[O-1].pts:A,re.stretchShortVideoTrack&&this.nextAudioPts!==null){const Re=Math.floor(re.maxBufferHole*r),Y=(i?m+i*r:this.nextAudioPts)-M.pts;Y>Re?(d=Y-de,d<0?d=de:w=!0,S.log(`[mp4-remuxer]: It is approximately ${Y/90} ms to the next segment; using duration ${d/90} ms for the last video frame.`)):d=de}else d=de}const ae=Math.round(M.pts-M.dts);B=Math.min(B,d),G=Math.max(G,d),F=Math.min(F,X),H=Math.max(H,X),o.push(new ur(M.key,d,j,ae))}if(o.length){if(yt){if(yt<70){const O=o[0].flags;O.dependsOn=2,O.isNonSync=0}}else if(Ps&&H-F0&&(i&&Math.abs(y-T)<9e3||Math.abs(Ge(m[0].pts-v,y)-T)<20*h),m.forEach(function(U){U.pts=Ge(U.pts-v,y)}),!s||T<0){if(m=m.filter(U=>U.pts>=0),!m.length)return;r===0?T=0:i&&!f?T=Math.max(0,y):T=m[0].pts}if(e.segmentCodec==="aac"){const U=this.config.maxAudioFramesDrift;for(let Z=0,q=T;Z=U*h&&j0){R+=E;try{D=new Uint8Array(R)}catch(j){this.observer.emit(p.ERROR,p.ERROR,{type:W.MUX_ERROR,details:b.REMUX_ALLOC_ERROR,fatal:!1,error:j,bytes:R,reason:`fail allocating audio mdat ${R}`});return}d||(new DataView(D.buffer).setUint32(0,R),D.set(L.types.mdat,4))}else return;D.set(O,E);const ee=O.byteLength;E+=ee,g.push(new ur(!0,c,ee,0)),x=M}const k=g.length;if(!k)return;const I=g[g.length-1];this.nextAudioPts=T=x+l*I.duration;const w=d?new Uint8Array(0):L.moof(e.sequenceNumber++,A/l,me({},e,{samples:g}));e.samples=[];const B=A/n,F=T/n,H={data1:w,data2:D,startPTS:B,endPTS:F,startDTS:B,endDTS:F,type:"audio",hasAudio:!0,hasVideo:!1,nb:k};return this.isAudioContiguous=!0,H}remuxEmptyAudio(e,t,s,i){const r=e.inputTimeScale,n=e.samplerate?e.samplerate:r,o=r/n,l=this.nextAudioPts,c=this._initDTS,h=c.baseTime*9e4/c.timescale,u=(l!==null?l:i.startDTS*r)+h,d=i.endDTS*r+h,g=o*hr,f=Math.ceil((d-u)/g),m=cr.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(S.warn("[mp4-remuxer]: remux empty Audio"),!m){S.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const E=[];for(let T=0;T4294967296;)a+=t;return a}function ic(a){for(let e=0;en.pts-o.pts);const r=a.samples;return a.samples=[],{samples:r}}class ur{constructor(e,t,s,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=s,this.cts=i,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class rc{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,s,i){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(ho(e,i)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:s}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const i=this.initData=qr(e);i.audio&&(t=dr(i.audio,ie.AUDIO)),i.video&&(s=dr(i.video,ie.VIDEO));const r={};i.audio&&i.video?r.audiovideo={container:"video/mp4",codec:t+","+s,initSegment:e,id:"main"}:i.audio?r.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?r.video={container:"video/mp4",codec:s,initSegment:e,id:"main"}:S.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r}remux(e,t,s,i,r,n){var o,l;let{initPTS:c,lastEndTime:h}=this;const u={audio:void 0,video:void 0,text:i,id3:s,initSegment:void 0};N(h)||(h=this.lastEndTime=r||0);const d=t.samples;if(!(d!=null&&d.length))return u;const g={initPTS:void 0,timescale:1};let f=this.initData;if((o=f)!=null&&o.length||(this.generateInitSegment(d),f=this.initData),!((l=f)!=null&&l.length))return S.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=!1);const m=fo(d,f),E=uo(f,d),T=E===null?r:E;(nc(c,T,r,m)||g.timescale!==c.timescale&&n)&&(g.initPTS=T-r,c&&c.timescale===1&&S.warn(`Adjusting initPTS by ${g.initPTS-c.baseTime}`),this.initPTS=c={baseTime:g.initPTS,timescale:1});const y=e?T-c.baseTime/c.timescale:h,v=y+m;mo(f,d,c.baseTime/c.timescale),m>0?this.lastEndTime=v:(S.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const A=!!f.audio,x=!!f.video;let D="";A&&(D+="audio"),x&&(D+="video");const R={data1:d,startPTS:y,startDTS:y,endPTS:v,endDTS:v,type:D,hasAudio:A,hasVideo:x,nb:1,dropped:0};return u.audio=R.type==="audio"?R:void 0,u.video=R.type!=="audio"?R:void 0,u.initSegment=g,u.id3=An(s,r,c,c),i.samples.length&&(u.text=Rn(i,r,c)),u}}function nc(a,e,t,s){if(a===null)return!0;const i=Math.max(s,1),r=e-a.baseTime/a.timescale;return Math.abs(r-t)>i}function dr(a,e){const t=a?.codec;if(t&&t.length>4)return t;if(e===ie.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return os(t,!1);const s="mp4a.40.5";return S.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${s}"`),s}return S.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let rt;try{rt=self.performance.now.bind(self.performance)}catch{S.debug("Unable to use Performance API on this environment"),rt=At?.Date.now}const es=[{demux:Hl,remux:rc},{demux:ot,remux:Zt},{demux:Kl,remux:Zt},{demux:Ql,remux:Zt}];es.splice(2,0,{demux:Wl,remux:Zt});class fr{constructor(e,t,s,i,r){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=s,this.vendor=i,this.id=r}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,s,i){const r=s.transmuxing;r.executeStart=rt();let n=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:l}=this;i&&(this.currentTransmuxState=i);const{contiguous:c,discontinuity:h,trackSwitch:u,accurateTimeOffset:d,timeOffset:g,initSegmentChange:f}=i||o,{audioCodec:m,videoCodec:E,defaultInitPts:T,duration:y,initSegmentData:v}=l,A=ac(n,t);if(A&&A.method==="AES-128"){const C=this.getDecrypter();if(C.isSync()){let k=C.softwareDecrypt(n,A.key.buffer,A.iv.buffer);if(s.part>-1&&(k=C.flush()),!k)return r.executeEnd=rt(),Fs(s);n=new Uint8Array(k)}else return this.decryptionPromise=C.webCryptoDecrypt(n,A.key.buffer,A.iv.buffer).then(k=>{const I=this.push(k,null,s);return this.decryptionPromise=null,I}),this.decryptionPromise}const x=this.needsProbing(h,u);if(x){const C=this.configureTransmuxer(n);if(C)return S.warn(`[transmuxer] ${C.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:W.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,fatal:!1,error:C,reason:C.message}),r.executeEnd=rt(),Fs(s)}(h||u||f||x)&&this.resetInitSegment(v,m,E,y,t),(h||f||x)&&this.resetInitialTimestamp(T),c||this.resetContiguity();const D=this.transmux(n,A,g,d,s),R=this.currentTransmuxState;return R.contiguous=!0,R.discontinuity=!1,R.trackSwitch=!1,r.executeEnd=rt(),D}flush(e){const t=e.transmuxing;t.executeStart=rt();const{decrypter:s,currentTransmuxState:i,decryptionPromise:r}=this;if(r)return r.then(()=>this.flush(e));const n=[],{timeOffset:o}=i;if(s){const u=s.flush();u&&n.push(this.push(u,null,e))}const{demuxer:l,remuxer:c}=this;if(!l||!c)return t.executeEnd=rt(),[Fs(e)];const h=l.flush(o);return ts(h)?h.then(u=>(this.flushRemux(n,u,e),n)):(this.flushRemux(n,h,e),n)}flushRemux(e,t,s){const{audioTrack:i,videoTrack:r,id3Track:n,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:c}=this.currentTransmuxState;S.log(`[transmuxer.ts]: Flushed fragment ${s.sn}${s.part>-1?" p: "+s.part:""} of level ${s.level}`);const h=this.remuxer.remux(i,r,n,o,c,l,!0,this.id);e.push({remuxResult:h,chunkMeta:s}),s.transmuxing.executeEnd=rt()}resetInitialTimestamp(e){const{demuxer:t,remuxer:s}=this;!t||!s||(t.resetTimeStamp(e),s.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,s,i,r){const{demuxer:n,remuxer:o}=this;!n||!o||(n.resetInitSegment(e,t,s,i),o.resetInitSegment(e,t,s,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,s,i,r){let n;return t&&t.method==="SAMPLE-AES"?n=this.transmuxSampleAes(e,t,s,i,r):n=this.transmuxUnencrypted(e,s,i,r),n}transmuxUnencrypted(e,t,s,i){const{audioTrack:r,videoTrack:n,id3Track:o,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,n,o,l,t,s,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,s,i,r){return this.demuxer.demuxSampleAes(e,t,s).then(n=>({remuxResult:this.remuxer.remux(n.audioTrack,n.videoTrack,n.id3Track,n.textTrack,s,i,!1,this.id),chunkMeta:r}))}configureTransmuxer(e){const{config:t,observer:s,typeSupported:i,vendor:r}=this;let n;for(let d=0,g=es.length;d0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Fs=a=>({remuxResult:{},chunkMeta:a});function ts(a){return"then"in a&&a.then instanceof Function}class oc{constructor(e,t,s,i,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=s,this.duration=i,this.defaultInitPts=r||null}}class lc{constructor(e,t,s,i,r,n){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=s,this.trackSwitch=i,this.timeOffset=r,this.initSegmentChange=n}}var bn={exports:{}};(function(a){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function i(l,c,h){this.fn=l,this.context=c,this.once=h||!1}function r(l,c,h,u,d){if(typeof h!="function")throw new TypeError("The listener must be a function");var g=new i(h,u||l,d),f=t?t+c:c;return l._events[f]?l._events[f].fn?l._events[f]=[l._events[f],g]:l._events[f].push(g):(l._events[f]=g,l._eventsCount++),l}function n(l,c){--l._eventsCount===0?l._events=new s:delete l._events[c]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],h,u;if(this._eventsCount===0)return c;for(u in h=this._events)e.call(h,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(h)):c},o.prototype.listeners=function(c){var h=t?t+c:c,u=this._events[h];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,g=u.length,f=new Array(g);d{h=h||{},h.frag=this.frag,h.id=this.id,c===p.ERROR&&(this.error=h.error),this.hls.trigger(c,h)};this.observer=new Si,this.observer.on(p.FRAG_DECRYPTED,n),this.observer.on(p.ERROR,n);const o=gt(r.preferManagedMediaSource)||{isTypeSupported:()=>!1},l={mpeg:o.isTypeSupported("audio/mpeg"),mp3:o.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:o.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&typeof Worker<"u"&&(r.workerPath||Dl())){try{r.workerPath?(S.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=_l(r.workerPath)):(S.log(`injecting Web Worker for "${t}"`),this.workerContext=Cl()),this.onwmsg=u=>this.onWorkerMessage(u);const{worker:h}=this.workerContext;h.addEventListener("message",this.onwmsg),h.onerror=u=>{const d=new Error(`${u.message} (${u.filename}:${u.lineno})`);r.enableWorker=!1,S.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(p.ERROR,{type:W.OTHER_ERROR,details:b.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:d})},h.postMessage({cmd:"init",typeSupported:l,vendor:"",id:t,config:JSON.stringify(r)})}catch(h){S.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.resetWorker(),this.error=null,this.transmuxer=new fr(this.observer,l,r,"",t)}return}this.transmuxer=new fr(this.observer,l,r,"",t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,s,i,r,n,o,l,c,h){var u,d;c.transmuxing.start=self.performance.now();const{transmuxer:g}=this,f=n?n.start:r.start,m=r.decryptdata,E=this.frag,T=!(E&&r.cc===E.cc),y=!(E&&c.level===E.level),v=E?c.sn-E.sn:-1,A=this.part?c.part-this.part.index:-1,x=v===0&&c.id>1&&c.id===E?.stats.chunkCount,D=!y&&(v===1||v===0&&(A===1||x&&A<=0)),R=self.performance.now();(y||v||r.stats.parsing.start===0)&&(r.stats.parsing.start=R),n&&(A||!D)&&(n.stats.parsing.start=R);const C=!(E&&((u=r.initSegment)==null?void 0:u.url)===((d=E.initSegment)==null?void 0:d.url)),k=new lc(T,D,l,y,f,C);if(!D||T||C){S.log(`[transmuxer-interface, ${r.type}]: Starting new transmux session for sn: ${c.sn} p: ${c.part} level: ${c.level} id: ${c.id} + discontinuity: ${T} + trackSwitch: ${y} + contiguous: ${D} + accurateTimeOffset: ${l} + timeOffset: ${f} + initSegmentChange: ${C}`);const I=new oc(s,i,t,o,h);this.configureTransmuxer(I)}if(this.frag=r,this.part=n,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:m,chunkMeta:c,state:k},e instanceof ArrayBuffer?[e]:[]);else if(g){const I=g.push(e,m,c,k);ts(I)?(g.async=!0,I.then(w=>{this.handleTransmuxComplete(w)}).catch(w=>{this.transmuxerError(w,c,"transmuxer-interface push error")})):(g.async=!1,this.handleTransmuxComplete(I))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let s=t.flush(e);ts(s)||t.async?(ts(s)||(s=Promise.resolve(s)),s.then(r=>{this.handleFlushResult(r,e)}).catch(r=>{this.transmuxerError(r,e,"transmuxer-interface flush error")})):this.handleFlushResult(s,e)}}transmuxerError(e,t,s){this.hls&&(this.error=e,this.hls.trigger(p.ERROR,{type:W.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:s}))}handleFlushResult(e,t){e.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(!(t!=null&&t.event)){S.warn(`worker message received with no ${t?"event name":"data"}`);return}const s=this.hls;if(this.hls)switch(t.event){case"init":{var i;const r=(i=this.workerContext)==null?void 0:i.objectURL;r&&self.URL.revokeObjectURL(r);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":S[t.data.logType]&&S[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,s.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function Dn(a,e){if(a.length!==e.length)return!1;for(let t=0;ta[i]!==e[i])}function ei(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}const gr=100;class hc extends Ei{constructor(e,t,s){super(e,t,s,"[audio-stream-controller]",V.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.ERROR,this.onError,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.ERROR,this.onError,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:s,initPTS:i,timescale:r}){if(s==="main"){const n=t.cc;this.initPTS[t.cc]={baseTime:i,timescale:r},this.log(`InitPTS for cc: ${n} found from main: ${i}`),this.videoTrackCC=n,this.state===_.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=_.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(gr),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=_.IDLE):(this.loadedmetadata=!1,this.state=_.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case _.IDLE:this.doTickIdle();break;case _.WAITING_TRACK:{var e;const{levels:s,trackId:i}=this,r=s==null||(e=s[i])==null?void 0:e.details;if(r){if(this.waitForCdnTuneIn(r))break;this.state=_.WAITING_INIT_PTS}break}case _.FRAG_LOADING_WAITING_RETRY:{var t;const s=performance.now(),i=this.retryDate;if(!i||s>=i||(t=this.media)!=null&&t.seeking){const{levels:r,trackId:n}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(r?.[n]||null),this.state=_.IDLE}break}case _.WAITING_INIT_PTS:{const s=this.waitingData;if(s){const{frag:i,part:r,cache:n,complete:o}=s;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=_.FRAG_LOADING;const l=n.flush(),c={frag:i,part:r,payload:l,networkDetails:null};this._handleFragmentLoadProgress(c),o&&super._handleFragmentLoadComplete(c)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${i.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const l=this.getLoadPosition(),c=ne.bufferInfo(this.mediaBuffer,l,this.config.maxBufferHole);Js(c.end,this.config.maxFragLookUpTolerance,i)<0&&(this.log(`Waiting fragment cc (${i.cc}) @ ${i.start} cancelled because another fragment at ${c.end} is needed`),this.clearWaitingFragment())}}else this.state=_.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=_.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:s,trackId:i}=this,r=e.config;if(!s&&(this.startFragRequested||!r.startFragPrefetch)||!(t!=null&&t[i]))return;const n=t[i],o=n.details;if(!o||o.live&&this.levelLastLoaded!==n||this.waitForCdnTuneIn(o)){this.state=_.WAITING_TRACK;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,ie.AUDIO,V.AUDIO));const c=this.getFwdBufferInfo(l,V.AUDIO);if(c===null)return;const{bufferedTrack:h,switchingTrack:u}=this;if(!u&&this._streamEnded(c,o)){e.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=_.ENDED;return}const d=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,V.MAIN),g=c.len,f=this.getMaxBufferLength(d?.len),m=o.fragments,E=m[0].start;let T=this.flushing?this.getLoadPosition():c.end;if(u&&s){const x=this.getLoadPosition();h&&!bt(u.attrs,h.attrs)&&(T=x),o.PTSKnown&&xE||c.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=E+.05)}if(g>=f&&!u&&Td.end+o.targetduration;if(A||!(d!=null&&d.len)&&c.len){const x=this.getAppendedFrag(y.start,V.MAIN);if(x===null||(v||(v=!!x.gap||!!A&&d.len===0),A&&!v||v&&c.nextStart&&c.nextStartnew Rt(s))}onAudioTrackSwitching(e,t){const s=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),s?this.setInterval(gr):this.resetTransmuxer(),s?(this.switchingTrack=t,this.state=_.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=_.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(p.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var s;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:i}=this,{details:r,id:n}=t;if(!i){this.warn(`Audio tracks were reset while loading level ${n}`);return}this.log(`Audio track ${n} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const o=i[n];let l=0;if(r.live||(s=o.details)!=null&&s.live){this.checkLiveUpdate(r);const h=this.mainDetails;if(r.deltaUpdateFailed||!h)return;if(!o.details&&r.hasProgramDateTime&&h.hasProgramDateTime)ds(r,h),l=r.fragments[0].start;else{var c;l=this.alignPlaylists(r,o.details,(c=this.levelLastLoaded)==null?void 0:c.details)}}o.details=r,this.levelLastLoaded=o,!this.startFragRequested&&(this.mainDetails||!r.live)&&this.setStartPosition(this.mainDetails||r,l),this.state===_.WAITING_TRACK&&!this.waitForCdnTuneIn(r)&&(this.state=_.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:s,part:i,payload:r}=e,{config:n,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const c=l[o];if(!c){this.warn("Audio track is undefined on fragment load progress");return}const h=c.details;if(!h){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const u=n.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let d=this.transmuxer;d||(d=this.transmuxer=new In(this.hls,V.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const g=this.initPTS[s.cc],f=(t=s.initSegment)==null?void 0:t.data;if(g!==void 0){const E=i?i.index:-1,T=E!==-1,y=new mi(s.level,s.sn,s.stats.chunkCount,r.byteLength,E,T);d.push(r,f,u,"",s,i,h.totalduration,!1,y,g)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${h.startSN} ,${h.endSN}],track ${o}`);const{cache:m}=this.waitingData=this.waitingData||{frag:s,part:i,cache:new un,complete:!1};m.push(new Uint8Array(r)),this.waitingVideoCC=this.videoTrackCC,this.state=_.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:s,part:i}=t;if(s.type!==V.AUDIO){if(!this.loadedmetadata&&s.type===V.MAIN){const r=this.videoBuffer||this.media;r&&ne.getBuffered(r).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${i?" p: "+i.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(s.sn!=="initSegment"){this.fragPrevious=s;const r=this.switchingTrack;r&&(this.bufferedTrack=r,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,Le({},r)))}this.fragBufferedComplete(s,i)}onError(e,t){var s;if(t.fatal){this.state=_.ERROR;return}switch(t.details){case b.FRAG_GAP:case b.FRAG_PARSING_ERROR:case b.FRAG_DECRYPT_ERROR:case b.FRAG_LOAD_ERROR:case b.FRAG_LOAD_TIMEOUT:case b.KEY_LOAD_ERROR:case b.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(V.AUDIO,t);break;case b.AUDIO_TRACK_LOAD_ERROR:case b.AUDIO_TRACK_LOAD_TIMEOUT:case b.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===_.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===te.AUDIO_TRACK&&(this.state=_.IDLE);break;case b.BUFFER_APPEND_ERROR:case b.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===b.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case b.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==ie.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==ie.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===_.ENDED&&(this.state=_.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,t,V.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const s="audio",{hls:i}=this,{remuxResult:r,chunkMeta:n}=e,o=this.getCurrentContext(n);if(!o){this.resetWhenMissingContext(n);return}const{frag:l,part:c,level:h}=o,{details:u}=h,{audio:d,text:g,id3:f,initSegment:m}=r;if(this.fragContextChanged(l)||!u){this.fragmentTracker.removeFragment(l);return}if(this.state=_.PARSING,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),m!=null&&m.tracks){const E=l.initSegment||l;this._bufferInitSegment(h,m.tracks,E,n),i.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:E,id:s,tracks:m.tracks})}if(d){const{startPTS:E,endPTS:T,startDTS:y,endDTS:v}=d;c&&(c.elementaryStreams[ie.AUDIO]={startPTS:E,endPTS:T,startDTS:y,endDTS:v}),l.setElementaryStreamInfo(ie.AUDIO,E,T,y,v),this.bufferFragmentData(d,l,c,n)}if(f!=null&&(t=f.samples)!=null&&t.length){const E=me({id:s,frag:l,details:u},f);i.trigger(p.FRAG_PARSING_METADATA,E)}if(g){const E=me({id:s,frag:l,details:u},g);i.trigger(p.FRAG_PARSING_USERDATA,E)}}_bufferInitSegment(e,t,s,i){if(this.state!==_.PARSING)return;t.video&&delete t.video;const r=t.audio;if(!r)return;r.id="audio";const n=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${n}/${r.codec}]`),n&&n.split(",").length===1&&(r.levelCodec=n),this.hls.trigger(p.BUFFER_CODECS,t);const o=r.initSegment;if(o!=null&&o.byteLength){const l={type:"audio",frag:s,part:null,chunkMeta:i,parent:s.type,data:o};this.hls.trigger(p.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,s){const i=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||i===xe.NOT_LOADED||i===xe.PARTIAL){var r;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((r=t.details)!=null&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=_.WAITING_INIT_PTS;const n=this.mainDetails;n&&n.fragments[0].start!==t.details.fragments[0].start&&ds(t.details,n)}else this.startFragRequested=!0,super.loadFragment(e,t,s)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:s}=this,i=s?.attrs,r=e.attrs;t&&i&&(i.CHANNELS!==r.CHANNELS||s.name!==e.name||s.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(p.AUDIO_TRACK_SWITCHED,Le({},e))}}class uc extends gi{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:s,groupId:i,details:r}=t,n=this.tracksInGroup[s];if(!n||n.groupId!==i){this.warn(`Audio track with id:${s} and group:${i} not found in active group ${n?.groupId}`);return}const o=n.details;n.details=t.details,this.log(`Audio track ${s} "${n.name}" lang:${n.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.audioGroups||null,i=this.groupIds;let r=this.currentTrack;if(!s||i?.length!==s?.length||s!=null&&s.some(o=>i?.indexOf(o)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(d=>!s||s.indexOf(d.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(d=>d.default)&&(this.selectDefaultTrack=!1),o.forEach((d,g)=>{d.id=g});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!r&&l){const d=Qe(l,o,pt);if(d>-1)r=o[d];else{const g=Qe(l,this.tracks);r=this.tracks[g]}}let c=this.findTrackId(r);c===-1&&r&&(c=this.findTrackId(null));const h={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${s?.join(",")}`),this.hls.trigger(p.AUDIO_TRACKS_UPDATED,h);const u=this.trackId;if(c!==-1&&u===-1)this.setAudioTrack(c);else if(o.length&&u===-1){var n;const d=new Error(`No audio track selected for current audio group-ID(s): ${(n=this.groupIds)==null?void 0:n.join(",")} track count: ${o.length}`);this.warn(d.message),this.hls.trigger(p.ERROR,{type:W.MEDIA_ERROR,details:b.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:d})}}else this.shouldReloadPlaylist(r)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===te.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-1,this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){const i=this.currentTrack;if(i&&St(e,i,pt))return i;const r=Qe(e,this.tracksInGroup,pt);if(r>-1){const n=this.tracksInGroup[r];return this.setAudioTrack(r),n}else if(i){let n=t.loadLevel;n===-1&&(n=t.firstAutoLevel);const o=ul(e,t.levels,s,n,pt);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const n=Qe(e,s);if(n>-1)return s[n]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const s=this.currentTrack,i=t[e],r=i.details&&!i.details.live;if(e===this.trackId&&i===s&&r||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(p.AUDIO_TRACK_SWITCHING,Le({},i)),r))return;const n=this.switchParams(i.url,s?.details,i.details);this.loadPlaylist(n)}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s=r[c].start&&o<=r[c].end){n=r[c];break}const l=s.start+s.duration;n?n.end=l:(n={start:o,end:l},r.push(n)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null)}onBufferFlushing(e,t){const{startOffset:s,endOffset:i}=t;if(s===0&&i!==Number.POSITIVE_INFINITY){const r=i-1;if(r<=0)return;t.endOffsetSubtitles=Math.max(0,r),this.tracksBuffered.forEach(n=>{for(let o=0;onew Rt(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{const i=new Rt(s);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,V.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var s;if(this.currentTrackId=t.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(mr)}onSubtitleTrackLoaded(e,t){var s;const{currentTrackId:i,levels:r}=this,{details:n,id:o}=t;if(!r){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=r[o];if(o>=r.length||!l)return;this.log(`Subtitle track ${o} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(n.live||(s=l.details)!=null&&s.live){const u=this.mainDetails;if(n.deltaUpdateFailed||!u)return;const d=u.fragments[0];if(!l.details)n.hasProgramDateTime&&u.hasProgramDateTime?(ds(n,u),c=n.fragments[0].start):d&&(c=d.start,Qs(n,c));else{var h;c=this.alignPlaylists(n,l.details,(h=this.levelLastLoaded)==null?void 0:h.details),c===0&&d&&(c=d.start,Qs(n,c))}}l.details=n,this.levelLastLoaded=l,o===i&&(!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(this.mainDetails||n,c),this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===_.IDLE&&(us(null,n.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:s}=e,i=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&s&&s.byteLength>0&&i!=null&&i.key&&i.iv&&i.method==="AES-128"){const n=performance.now();this.decrypter.decrypt(new Uint8Array(s),i.key.buffer,i.iv.buffer).catch(o=>{throw r.trigger(p.ERROR,{type:W.MEDIA_ERROR,details:b.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const l=performance.now();r.trigger(p.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:n,tdecrypt:l}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=_.IDLE})}}doTick(){if(!this.media){this.state=_.IDLE;return}if(this.state===_.IDLE){const{currentTrackId:e,levels:t}=this,s=t?.[e];if(!s||!t.length||!s.details)return;const{config:i}=this,r=this.getLoadPosition(),n=ne.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,i.maxBufferHole),{end:o,len:l}=n,c=this.getFwdBufferInfo(this.media,V.MAIN),h=s.details,u=this.getMaxBufferLength(c?.len)+h.levelTargetDuration;if(l>u)return;const d=h.fragments,g=d.length,f=h.edge;let m=null;const E=this.fragPrevious;if(of-T?0:T;m=us(E,d,Math.max(d[0].start,o),y),!m&&E&&E.start{if(i=i>>>0,i>r-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${r})`);return e[i][s]};this.buffered={get length(){return e.length},end(s){return t("end",s,e.length)},start(s){return t("start",s,e.length)}}}}class gc extends gi{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const s=Xt(this.media.textTracks);for(let r=0;r-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Xt(this.media.textTracks).forEach(t=>{vt(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:s,groupId:i,details:r}=t,n=this.tracksInGroup[s];if(!n||n.groupId!==i){this.warn(`Subtitle track with id:${s} and group:${i} not found in active group ${n?.groupId}`);return}const o=n.details;n.details=t.details,this.log(`Subtitle track ${s} "${n.name}" lang:${n.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.subtitleGroups||null,i=this.groupIds;let r=this.currentTrack;if(!s||i?.length!==s?.length||s!=null&&s.some(n=>i?.indexOf(n)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const n=this.tracks.filter(h=>!s||s.indexOf(h.groupId)!==-1);if(n.length)this.selectDefaultTrack&&!n.some(h=>h.default)&&(this.selectDefaultTrack=!1),n.forEach((h,u)=>{h.id=u});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=n;const o=this.hls.config.subtitlePreference;if(!r&&o){this.selectDefaultTrack=!1;const h=Qe(o,n);if(h>-1)r=n[h];else{const u=Qe(o,this.tracks);r=this.tracks[u]}}let l=this.findTrackId(r);l===-1&&r&&(l=this.findTrackId(null));const c={subtitleTracks:n};this.log(`Updating subtitle tracks, ${n.length} track(s) found in "${s?.join(",")}" group-id`),this.hls.trigger(p.SUBTITLE_TRACKS_UPDATED,c),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}else this.shouldReloadPlaylist(r)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,s=this.selectDefaultTrack;for(let i=0;i-1){const r=this.tracksInGroup[i];return this.setSubtitleTrack(i),r}else{if(s)return null;{const r=Qe(e,t);if(r>-1)return t[r]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const s=t.id,i=t.groupId;let r=t.url;if(e)try{r=e.addDirectives(r)}catch(n){this.warn(`Could not construct new URL with HLS Delivery Directives: ${n}`)}this.log(`Loading subtitle playlist for id ${s}`),this.hls.trigger(p.SUBTITLE_TRACK_LOADING,{url:r,id:s,groupId:i,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Xt(e.textTracks),s=this.currentTrack;let i;if(s&&(i=t.filter(r=>ei(s,r))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${s.name}" and language "${s.lang}"`)),[].slice.call(t).forEach(r=>{r.mode!=="disabled"&&r!==i&&(r.mode="disabled")}),i){const r=this.subtitleDisplay?"showing":"hidden";i.mode!==r&&(i.mode=r)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!N(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const s=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:e});return}const r=!!i.details&&!i.details.live;if(e===this.trackId&&i===s&&r)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:n,groupId:o="",name:l,type:c,url:h}=i;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:n,groupId:o,name:l,type:c,url:h});const u=this.switchParams(i.url,s?.details,i.details);this.loadPlaylist(u)}}class mc{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,s){const i=this.queues[t];i.push(e),i.length===1&&!s&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const s=new Promise(r=>{t=r}),i={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(i,e),s}executeNext(e){const t=this.queues[e];if(t.length){const s=t[0];try{s.execute()}catch(i){S.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${i}`),s.onError(i);const r=this.buffers[e];r!=null&&r.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const pr=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class pc{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=s=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:s,mediaSource:i}=this;this.log("Media source opened"),s&&(s.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(p.MEDIA_ATTACHED,{media:s,mediaSource:i})),i&&i.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:s,_objectUrl:i}=this;s!==i&&S.error(`Media element src was set while attaching MediaSource (${i} > ${s})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=Ro(gt(e.config.preferManagedMediaSource)),this.log=S.log.bind(S,t),this.warn=S.warn.bind(S,t),this.error=S.error.bind(S,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_APPENDING,this.onBufferAppending,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.BUFFER_EOS,this.onBufferEos,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.FRAG_PARSED,this.onFragParsed,this),e.on(p.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_APPENDING,this.onBufferAppending,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_EOS,this.onBufferEos,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.FRAG_PARSED,this.onFragParsed,this),e.off(p.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new mc(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let s=2;(t.audio&&!t.video||!t.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const s=this.media=t.media,i=gt(this.appendSource);if(s&&i){var r;const n=this.mediaSource=new i;this.log(`created media source: ${(r=n.constructor)==null?void 0:r.name}`),n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(n.addEventListener("startstreaming",this._onStartStreaming),n.addEventListener("endstreaming",this._onEndStreaming));const o=this._objectUrl=self.URL.createObjectURL(n);if(this.appendSource)try{s.removeAttribute("src");const l=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||l&&n instanceof l,Er(s),Ec(s,o),s.load()}catch{s.src=o}else s.src=o;s.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:s}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(i){this.warn(`onMediaDetaching: ${i.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),s&&self.URL.revokeObjectURL(s),this.mediaSrc===s?(e.removeAttribute("src"),this.appendSource&&Er(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(p.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var s;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(s=this.mediaSource)!=null&&s.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(i){this.warn(`onBufferReset ${e}`,i)}}onBufferCodecs(e,t){const s=this.getSourceBufferTypes().length,i=Object.keys(t);if(i.forEach(n=>{if(s){const l=this.tracks[n];if(l&&typeof l.buffer.changeType=="function"){var o;const{id:c,codec:h,levelCodec:u,container:d,metadata:g}=t[n],f=Ui(l.codec,l.levelCodec),m=f?.replace(pr,"$1");let E=Ui(h,u);const T=(o=E)==null?void 0:o.replace(pr,"$1");if(E&&m!==T){n.slice(0,5)==="audio"&&(E=os(E,this.appendSource));const y=`${d};codecs=${E}`;this.appendChangeType(n,y),this.log(`switching codec ${f} to ${E}`),this.tracks[n]={buffer:l.buffer,codec:h,container:d,levelCodec:u,metadata:g,id:c}}}}else this.pendingTracks[n]=t[n]}),s)return;const r=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==r&&(this.log(`${r} bufferCodec event(s) expected ${i.join(",")}`),this.bufferCodecEventsExpected=r),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:s}=this,i={execute:()=>{const r=this.sourceBuffer[e];r&&(this.log(`changing ${e} sourceBuffer type to ${t}`),r.changeType(t)),s.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:r=>{this.warn(`Failed to change ${e} SourceBuffer type`,r)}};s.append(i,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:s,operationQueue:i,tracks:r}=this,{data:n,type:o,frag:l,part:c,chunkMeta:h}=t,u=h.buffering[o],d=self.performance.now();u.start=d;const g=l.stats.buffering,f=c?c.stats.buffering:null;g.start===0&&(g.start=d),f&&f.start===0&&(f.start=d);const m=r.audio;let E=!1;o==="audio"&&m?.container==="audio/mpeg"&&(E=!this.lastMpegAudioChunk||h.id===1||this.lastMpegAudioChunk.sn!==h.sn,this.lastMpegAudioChunk=h);const T=l.start,y={execute:()=>{if(u.executeStart=self.performance.now(),E){const v=this.sourceBuffer[o];if(v){const A=T-v.timestampOffset;Math.abs(A)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${T} (delta: ${A}) sn: ${l.sn})`),v.timestampOffset=T)}}this.appendExecutor(n,o)},onStart:()=>{},onComplete:()=>{const v=self.performance.now();u.executeEnd=u.end=v,g.first===0&&(g.first=v),f&&f.first===0&&(f.first=v);const{sourceBuffer:A}=this,x={};for(const D in A)x[D]=ne.getBuffered(A[D]);this.appendErrors[o]=0,o==="audio"||o==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(p.BUFFER_APPENDED,{type:o,frag:l,part:c,chunkMeta:h,parent:l.type,timeRanges:x})},onError:v=>{const A={type:W.MEDIA_ERROR,parent:l.type,details:b.BUFFER_APPEND_ERROR,sourceBufferName:o,frag:l,part:c,chunkMeta:h,error:v,err:v,fatal:!1};if(v.code===DOMException.QUOTA_EXCEEDED_ERR)A.details=b.BUFFER_FULL_ERROR;else{const x=++this.appendErrors[o];A.details=b.BUFFER_APPEND_ERROR,this.warn(`Failed ${x}/${s.config.appendErrorMaxRetry} times to append segment in "${o}" sourceBuffer`),x>=s.config.appendErrorMaxRetry&&(A.fatal=!0)}s.trigger(p.ERROR,A)}};i.append(y,o,!!this.pendingTracks[o])}onBufferFlushing(e,t){const{operationQueue:s}=this,i=r=>({execute:this.removeExecutor.bind(this,r,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(p.BUFFER_FLUSHED,{type:r})},onError:n=>{this.warn(`Failed to remove from ${r} SourceBuffer`,n)}});t.type?s.append(i(t.type),t.type):this.getSourceBufferTypes().forEach(r=>{s.append(i(r),r)})}onFragParsed(e,t){const{frag:s,part:i}=t,r=[],n=i?i.elementaryStreams:s.elementaryStreams;n[ie.AUDIOVIDEO]?r.push("audiovideo"):(n[ie.AUDIO]&&r.push("audio"),n[ie.VIDEO]&&r.push("video"));const o=()=>{const l=self.performance.now();s.stats.buffering.end=l,i&&(i.stats.buffering.end=l);const c=i?i.stats:s.stats;this.hls.trigger(p.FRAG_BUFFERED,{frag:s,part:i,stats:c,id:s.type})};r.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(o,r)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((i,r)=>{const n=this.sourceBuffer[r];return n&&(!t.type||t.type===r)&&(n.ending=!0,n.ended||(n.ended=!0,this.log(`${r} sourceBuffer now EOS`))),i&&!!(!n||n.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(r=>{const n=this.sourceBuffer[r];n&&(n.ending=!1)});const{mediaSource:i}=this;if(!i||i.readyState!=="open"){i&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${i.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),i.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:s}=this;if(!s||t===null||!this.getSourceBufferTypes().length)return;const r=e.config,n=s.currentTime,o=t.levelTargetDuration,l=t.live&&r.liveBackBufferLength!==null?r.liveBackBufferLength:r.backBufferLength;if(N(l)&&l>0){const c=Math.max(l,o),h=Math.floor(n/o)*o-c;this.flushBackBuffer(n,o,h)}if(N(r.frontBufferFlushThreshold)&&r.frontBufferFlushThreshold>0){const c=Math.max(r.maxBufferLength,r.frontBufferFlushThreshold),h=Math.max(c,o),u=Math.floor(n/o)*o+h;this.flushFrontBuffer(n,o,u)}}flushBackBuffer(e,t,s){const{details:i,sourceBuffer:r}=this;this.getSourceBufferTypes().forEach(o=>{const l=r[o];if(l){const c=ne.getBuffered(l);if(c.length>0&&s>c.start(0)){if(this.hls.trigger(p.BACK_BUFFER_REACHED,{bufferEnd:s}),i!=null&&i.live)this.hls.trigger(p.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(l.ended&&c.end(c.length-1)-e{const o=i[n];if(o){const l=ne.getBuffered(o),c=l.length;if(c<2)return;const h=l.start(c-1),u=l.end(c-1);if(s>h||e>=h&&e<=u)return;if(o.ended&&e-u<2*t){this.log(`Cannot flush ${n} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:h,endOffset:1/0,type:n})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:s,mediaSource:i}=this,r=e.fragments[0].start+e.totalduration,n=s.duration,o=N(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(e)):(r>o&&r>n||!N(n))&&(this.log(`Updating Media Source duration to ${r.toFixed(3)}`),i.duration=r)}updateSeekableRange(e){const t=this.mediaSource,s=e.fragments;if(s.length&&e.live&&t!=null&&t.setLiveSeekableRange){const r=Math.max(0,s[0].start),n=Math.max(r,r+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${r}-${n}.`),t.setLiveSeekableRange(r,n)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:s}=this,i=Object.keys(s).length;if(i&&(!e||i===2||"audiovideo"in s)){this.createSourceBuffers(s),this.pendingTracks={};const r=this.getSourceBufferTypes();if(r.length)this.hls.trigger(p.BUFFER_CREATED,{tracks:this.tracks}),r.forEach(n=>{t.executeNext(n)});else{const n=new Error("could not create source buffer for media codec(s)");this.hls.trigger(p.ERROR,{type:W.MEDIA_ERROR,details:b.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:n,reason:n.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:s}=this;if(!s)throw Error("createSourceBuffers called when mediaSource was null");for(const r in e)if(!t[r]){var i;const n=e[r];if(!n)throw Error(`source buffer exists for track ${r}, however track does not`);let o=((i=n.levelCodec)==null?void 0:i.indexOf(","))===-1?n.levelCodec:n.codec;o&&r.slice(0,5)==="audio"&&(o=os(o,this.appendSource));const l=`${n.container};codecs=${o}`;this.log(`creating sourceBuffer(${l})`);try{const c=t[r]=s.addSourceBuffer(l),h=r;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(h,"bufferedchange",(u,d)=>{const g=d.removedRanges;g!=null&&g.length&&this.hls.trigger(p.BUFFER_FLUSHED,{type:r})}),this.tracks[r]={buffer:c,codec:o,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id}}catch(c){this.error(`error while trying to add sourceBuffer: ${c.message}`),this.hls.trigger(p.ERROR,{type:W.MEDIA_ERROR,details:b.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,sourceBufferName:r,mimeType:l})}}}get mediaSrc(){var e;const t=((e=this.media)==null?void 0:e.firstChild)||this.media;return t?.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:s}=this;s.current(e).onComplete(),s.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var s;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(s=this.mediaSource)==null?void 0:s.readyState}`);this.error(`${i}`,t),this.hls.trigger(p.ERROR,{type:W.MEDIA_ERROR,details:b.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const r=this.operationQueue.current(e);r&&r.onError(i)}removeExecutor(e,t,s){const{media:i,mediaSource:r,operationQueue:n,sourceBuffer:o}=this,l=o[e];if(!i||!r||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),n.shiftAndExecuteNext(e);return}const c=N(i.duration)?i.duration:1/0,h=N(r.duration)?r.duration:1/0,u=Math.max(0,t),d=Math.min(s,c,h);d>u&&(!l.ending||l.ended)?(l.ended=!1,this.log(`Removing [${u},${d}] from the ${e} SourceBuffer`),l.remove(u,d)):n.shiftAndExecuteNext(e)}appendExecutor(e,t){const s=this.sourceBuffer[t];if(!s){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}s.ended=!1,s.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:s}=this,i=t.map(r=>s.appendBlocker(r));Promise.all(i).then(()=>{e(),t.forEach(r=>{const n=this.sourceBuffer[r];n!=null&&n.updating||s.shiftAndExecuteNext(r)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,s){const i=this.sourceBuffer[e];if(!i)return;const r=s.bind(this,e);this.listeners[e].push({event:t,listener:r}),i.addEventListener(t,r)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(s=>{t.removeEventListener(s.event,s.listener)})}}function Er(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function Ec(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}const Tc={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Cn=a=>String.fromCharCode(Tc[a]||a),We=15,st=100,yc={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},vc={17:2,18:4,21:6,22:8,23:10,19:13,20:15},xc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Sc={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Lc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Ac{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const s=typeof t=="function"?t():t;S.log(`${this.time} [${e}] ${s}`)}}}const ct=function(e){const t=[];for(let s=0;sst&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=st)}moveCursor(e){const t=this.pos+e;if(e>1)for(let s=this.pos+1;s=144&&this.backSpace();const t=Cn(e);if(this.pos>=st){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t"pacData = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let s="",i=-1;for(let r=0;r0&&(e?s="["+t.join(" | ")+"]":s=t.join(` +`)),s}getTextAndFormat(){return this.rows}}class Tr{constructor(e,t,s){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Os(s),this.nonDisplayedMemory=new Os(s),this.lastOutputScreen=new Os(s),this.currRollUpRow=this.displayedMemory.rows[We-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[We-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let s=0;st+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const s=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[s]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class yr{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Dc(),this.logger=void 0;const i=this.logger=new Ac;this.channels=[null,new Tr(e,t,i),new Tr(e+1,s,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let s=0;s"["+ct([t[s],t[s+1]])+"] -> ("+ct([i,r])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(Ic(i,r,l)){Ht(null,null,l),this.logger.log(3,()=>"Repeated command ("+ct([i,r])+") is dropped");continue}Ht(i,r,this.cmdHistory),n=this.parseCmd(i,r),n||(n=this.parseMidrow(i,r)),n||(n=this.parsePAC(i,r)),n||(n=this.parseBackgroundAttributes(i,r))}else Ht(null,null,l);if(!n&&(o=this.parseChars(i,r),o)){const h=this.currentChannel;h&&h>0?this.channels[h].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!n&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+ct([i,r])+" orig: "+ct([t[s],t[s+1]]))}}parseCmd(e,t){const s=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(s||i))return!1;const r=e===20||e===21||e===23?1:2,n=this.channels[r];return e===20||e===21||e===28||e===29?t===32?n.ccRCL():t===33?n.ccBS():t===34?n.ccAOF():t===35?n.ccAON():t===36?n.ccDER():t===37?n.ccRU(2):t===38?n.ccRU(3):t===39?n.ccRU(4):t===40?n.ccFON():t===41?n.ccRDC():t===42?n.ccTR():t===43?n.ccRTD():t===44?n.ccEDM():t===45?n.ccCR():t===46?n.ccENM():t===47&&n.ccEOC():n.ccTO(t-32),this.currentChannel=r,!0}parseMidrow(e,t){let s=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[s];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+ct([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let s;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,r=(e===16||e===24)&&t>=64&&t<=95;if(!(i||r))return!1;const n=e<=23?1:2;t>=64&&t<=95?s=n===1?yc[e]:xc[e]:s=n===1?vc[e]:Sc[e];const o=this.channels[n];return o?(o.setPAC(this.interpretPAC(s,t)),this.currentChannel=n,!0):!1}interpretPAC(e,t){let s;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?s=t-96:s=t-64,i.underline=(s&1)===1,s<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((s-16)/2)*4,i}parseChars(e,t){let s,i=null,r=null;if(e>=25?(s=2,r=e-8):(s=1,r=e),r>=17&&r<=19){let n;r===17?n=t+80:r===18?n=t+112:n=t+144,this.logger.log(2,()=>"Special char '"+Cn(n)+"' in channel "+s),i=[n]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+ct(i).join(",")),i}parseBackgroundAttributes(e,t){const s=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(s||i))return!1;let r;const n={};e===16||e===24?(r=Math.floor((t-32)/2),n.background=Lc[r],t%2===1&&(n.background=n.background+"_semi")):t===45?n.background="transparent":(n.foreground="black",t===47&&(n.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(n),!0}reset(){for(let e=0;ee)&&(this.startTime=e),this.endTime=t,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var Li=(function(){if(At!=null&&At.VTTCue)return self.VTTCue;const a=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,l){if(typeof l!="string"||!Array.isArray(o))return!1;const c=l.toLowerCase();return~o.indexOf(c)?c:!1}function s(o){return t(a,o)}function i(o){return t(e,o)}function r(o,...l){let c=1;for(;c100)throw new Error("Position must be between 0 and 100.");D=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",r({},u,{get:function(){return R},set:function(I){const w=i(I);if(!w)throw new SyntaxError("An invalid or illegal string was specified.");R=w,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",r({},u,{get:function(){return C},set:function(I){if(I<0||I>100)throw new Error("Size must be between 0 and 100.");C=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",r({},u,{get:function(){return k},set:function(I){const w=i(I);if(!w)throw new SyntaxError("An invalid or illegal string was specified.");k=w,this.hasBeenReset=!0}})),h.displayState=void 0}return n.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},n})();class Cc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function wn(a){function e(s,i,r,n){return(s|0)*3600+(i|0)*60+(r|0)+parseFloat(n||0)}const t=a.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class _c{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,s){return s?this.has(e)?this.values[e]:t[s]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,s){for(let i=0;i=0&&s<=100)return this.set(e,s),!0}return!1}}function kn(a,e,t,s){const i=s?a.split(s):[a];for(const r in i){if(typeof i[r]!="string")continue;const n=i[r].split(t);if(n.length!==2)continue;const o=n[0],l=n[1];e(o,l)}}const ti=new Li(0,0,""),Yt=ti.align==="middle"?"middle":"center";function wc(a,e,t){const s=a;function i(){const o=wn(a);if(o===null)throw new Error("Malformed timestamp: "+s);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function r(o,l){const c=new _c;kn(o,function(d,g){let f;switch(d){case"region":for(let m=t.length-1;m>=0;m--)if(t[m].id===g){c.set(d,t[m].region);break}break;case"vertical":c.alt(d,g,["rl","lr"]);break;case"line":f=g.split(","),c.integer(d,f[0]),c.percent(d,f[0])&&c.set("snapToLines",!1),c.alt(d,f[0],["auto"]),f.length===2&&c.alt("lineAlign",f[1],["start",Yt,"end"]);break;case"position":f=g.split(","),c.percent(d,f[0]),f.length===2&&c.alt("positionAlign",f[1],["start",Yt,"end","line-left","line-right","auto"]);break;case"size":c.percent(d,g);break;case"align":c.alt(d,g,["start",Yt,"end","left","right"]);break}},/:/,/\s/),l.region=c.get("region",null),l.vertical=c.get("vertical","");let h=c.get("line","auto");h==="auto"&&ti.line===-1&&(h=-1),l.line=h,l.lineAlign=c.get("lineAlign","start"),l.snapToLines=c.get("snapToLines",!0),l.size=c.get("size",100),l.align=c.get("align",Yt);let u=c.get("position","auto");u==="auto"&&ti.position===50&&(u=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=u}function n(){a=a.replace(/^\s+/,"")}if(n(),e.startTime=i(),n(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);a=a.slice(3),n(),e.endTime=i(),n(),r(a,e)}function Pn(a){return a.replace(//gi,` +`)}class kc{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Cc,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function s(){let r=t.buffer,n=0;for(r=Pn(r);n")===-1){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{wc(r,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=r.indexOf("-->")!==-1;if(!r||o&&(n=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=` +`),t.cue.text+=r}continue;case"BADCUE":r||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=` + +`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const Pc=/\r\n|\n\r|\n|\r/g,Ms=function(e,t,s=0){return e.slice(s,s+t.length)===t},Fc=function(e){let t=parseInt(e.slice(-3));const s=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!N(t)||!N(s)||!N(i)||!N(r))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*s,t+=60*1e3*i,t+=3600*1e3*r,t},Ns=function(e){let t=5381,s=e.length;for(;s;)t=t*33^e.charCodeAt(--s);return(t>>>0).toString()};function Ai(a,e,t){return Ns(a.toString())+Ns(e.toString())+Ns(t)}const Oc=function(e,t,s){let i=e[t],r=e[i.prevCC];if(!r||!r.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=!1;return}for(;(n=r)!=null&&n.new;){var n;e.ccOffset+=i.start-r.start,i.new=!1,i=r,r=e[i.prevCC]}e.presentationOffset=s};function Mc(a,e,t,s,i,r,n){const o=new kc,l=Je(new Uint8Array(a)).trim().replace(Pc,` +`).split(` +`),c=[],h=e?Zl(e.baseTime,e.timescale):0;let u="00:00.000",d=0,g=0,f,m=!0;o.oncue=function(E){const T=t[s];let y=t.ccOffset;const v=(d-h)/9e4;if(T!=null&&T.new&&(g!==void 0?y=t.ccOffset=T.start:Oc(t,s,v)),v){if(!e){f=new Error("Missing initPTS for VTT MPEGTS");return}y=v-t.presentationOffset}const A=E.endTime-E.startTime,x=Ge((E.startTime+y-g)*9e4,i*9e4)/9e4;E.startTime=Math.max(x,0),E.endTime=Math.max(x+A,0);const D=E.text.trim();E.text=decodeURIComponent(encodeURIComponent(D)),E.id||(E.id=Ai(E.startTime,E.endTime,D)),E.endTime>0&&c.push(E)},o.onparsingerror=function(E){f=E},o.onflush=function(){if(f){n(f);return}r(c)},l.forEach(E=>{if(m)if(Ms(E,"X-TIMESTAMP-MAP=")){m=!1,E.slice(16).split(",").forEach(T=>{Ms(T,"LOCAL:")?u=T.slice(6):Ms(T,"MPEGTS:")&&(d=parseInt(T.slice(7)))});try{g=Fc(u)/1e3}catch(T){f=T}return}else E===""&&(m=!1);o.parse(E+` +`)}),o.flush()}const Us="stpp.ttml.im1t",Fn=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,On=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Nc={left:"start",center:"center",right:"end",start:"start",end:"end"};function vr(a,e,t,s){const i=Q(new Uint8Array(a),["mdat"]);if(i.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const r=i.map(o=>Je(o)),n=Jl(e.baseTime,1,e.timescale);try{r.forEach(o=>t(Uc(o,n)))}catch(o){s(o)}}function Uc(a,e){const i=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},n=Object.keys(r).reduce((u,d)=>(u[d]=i.getAttribute(`ttp:${d}`)||r[d],u),{}),o=i.getAttribute("xml:space")!=="preserve",l=xr(Bs(i,"styling","style")),c=xr(Bs(i,"layout","region")),h=Bs(i,"body","[begin]");return[].map.call(h,u=>{const d=Mn(u,o);if(!d||!u.hasAttribute("begin"))return null;const g=$s(u.getAttribute("begin"),n),f=$s(u.getAttribute("dur"),n);let m=$s(u.getAttribute("end"),n);if(g===null)throw Sr(u);if(m===null){if(f===null)throw Sr(u);m=g+f}const E=new Li(g-e,m-e,d);E.id=Ai(E.startTime,E.endTime,E.text);const T=c[u.getAttribute("region")],y=l[u.getAttribute("style")],v=Bc(T,y,l),{textAlign:A}=v;if(A){const x=Nc[A];x&&(E.lineAlign=x),E.align=A}return me(E,v),E}).filter(u=>u!==null)}function Bs(a,e,t){const s=a.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(t)):[]}function xr(a){return a.reduce((e,t)=>{const s=t.getAttribute("xml:id");return s&&(e[s]=t),e},{})}function Mn(a,e){return[].slice.call(a.childNodes).reduce((t,s,i)=>{var r;return s.nodeName==="br"&&i?t+` +`:(r=s.childNodes)!=null&&r.length?Mn(s,e):e?t+s.textContent.trim().replace(/\s+/g," "):t+s.textContent},"")}function Bc(a,e,t){const s="http://www.w3.org/ns/ttml#styling";let i=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],n=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return n&&t.hasOwnProperty(n)&&(i=t[n]),r.reduce((o,l)=>{const c=Gs(e,s,l)||Gs(a,s,l)||Gs(i,s,l);return c&&(o[l]=c),o},{})}function Gs(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function Sr(a){return new Error(`Could not parse ttml timestamp ${a}`)}function $s(a,e){if(!a)return null;let t=wn(a);return t===null&&(Fn.test(a)?t=Gc(a,e):On.test(a)&&(t=$c(a,e))),t}function Gc(a,e){const t=Fn.exec(a),s=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+s/e.frameRate}function $c(a,e){const t=On.exec(a),s=Number(t[1]);switch(t[2]){case"h":return s*3600;case"m":return s*60;case"ms":return s*1e3;case"f":return s/e.frameRate;case"t":return s/e.tickRate}return s}class Kc{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Ar(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new Wt(this,"textTrack1"),t=new Wt(this,"textTrack2"),s=new Wt(this,"textTrack3"),i=new Wt(this,"textTrack4");this.cea608Parser1=new yr(1,e,t),this.cea608Parser2=new yr(3,s,i)}}addCues(e,t,s,i,r){let n=!1;for(let o=r.length;o--;){const l=r[o],c=Vc(l[0],l[1],t,s);if(c>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],s),n=!0,c/(s-t)>.5))return}if(n||r.push([t,s]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,s,i)}else{const o=this.Cues.newCue(null,t,s,i);this.hls.trigger(p.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:s,initPTS:i,timescale:r}){const{unparsedVttFrags:n}=this;s==="main"&&(this.initPTS[t.cc]={baseTime:i,timescale:r}),n.length&&(this.unparsedVttFrags=[],n.forEach(o=>{this.onFragLoaded(p.FRAG_LOADED,o)}))}getExistingTrack(e,t){const{media:s}=this;if(s)for(let i=0;i{vt(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Ar(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let s=0;sr.textCodec===Us);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(Dn(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const n=this.media,o=n?Xt(n.textTracks):null;if(this.tracks.forEach((l,c)=>{let h;if(o){let u=null;for(let d=0;dc!==null).map(c=>c.label);l.length&&S.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const n=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:n})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(s=>{const i=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!i)return;const r=`textTrack${i[1]}`,n=this.captionsProperties[r];n&&(n.label=s.name,s.lang&&(n.languageCode=s.lang),n.media=s)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===V.MAIN){var s,i;const{cea608Parser1:r,cea608Parser2:n,lastSn:o}=this,{cc:l,sn:c}=t.frag,h=(s=(i=t.part)==null?void 0:i.index)!=null?s:-1;r&&n&&(c!==o+1||c===o&&h!==this.lastPartIndex+1||l!==this.lastCc)&&(r.reset(),n.reset()),this.lastCc=l,this.lastSn=c,this.lastPartIndex=h}}onFragLoaded(e,t){const{frag:s,payload:i}=t;if(s.type===V.SUBTITLE)if(i.byteLength){const r=s.decryptdata,n="stats"in t;if(r==null||!r.encrypted||n){const o=this.tracks[s.level],l=this.vttCCs;l[s.cc]||(l[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),o&&o.textCodec===Us?this._parseIMSC1(s,i):this._parseVTTs(t)}}else this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const s=this.hls;vr(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),s.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{S.log(`Failed to parse IMSC1: ${i}`),s.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:s,payload:i}=e,{initPTS:r,unparsedVttFrags:n}=this,o=r.length-1;if(!r[s.cc]&&o===-1){n.push(e);return}const l=this.hls,c=(t=s.initSegment)!=null&&t.data?Ve(s.initSegment.data,new Uint8Array(i)):i;Mc(c,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,h=>{this._appendCues(h,s.level),l.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},h=>{const u=h.message==="Missing initPTS for VTT MPEGTS";u?n.push(e):this._fallbackToIMSC1(s,i),S.log(`Failed to parse VTT cue: ${h}`),!(u&&o>s.cc)&&l.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:h})})}_fallbackToIMSC1(e,t){const s=this.tracks[e.level];s.textCodec||vr(t,this.initPTS[e.cc],()=>{s.textCodec=Us,this._parseIMSC1(e,t)},()=>{s.textCodec="wvtt"})}_appendCues(e,t){const s=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(r=>sn(i,r))}else{const i=this.tracks[t];if(!i)return;const r=i.default?"default":"subtitles"+t;s.trigger(p.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:s}=t;s.type===V.SUBTITLE&&this.onFragLoaded(p.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:s,cea608Parser2:i}=this;if(!this.enabled||!s||!i)return;const{frag:r,samples:n}=t;if(!(r.type===V.MAIN&&this.closedCaptionsForLevel(r)==="NONE"))for(let o=0;ozs(o[l],t,s))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>zs(o[l],t,i))}}}extractCea608Data(e){const t=[[],[]],s=e[0]&31;let i=2;for(let r=0;rthis.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const s=t.filter((i,r)=>this.isLevelAllowed(i)&&r<=e);return this.clientRect=null,Ri.getMaxLevelByMediaSize(s,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const s=e.getBoundingClientRect();t.width=s.width,t.height=s.height,!t.width&&!t.height&&(t.width=s.right-s.left||e.width||0,t.height=s.bottom-s.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}isLevelAllowed(e){return!this.restrictedLevels.some(s=>e.bitrate===s.bitrate&&e.width===s.width&&e.height===s.height)}static getMaxLevelByMediaSize(e,t,s){if(!(e!=null&&e.length))return-1;const i=(o,l)=>l?o.width!==l.width||o.height!==l.height:!0;let r=e.length-1;const n=Math.max(t,s);for(let o=0;o=n||l.height>=n)&&i(l,e[o+1])){r=o;break}}return r}}class Hc{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const s=this.hls.config;if(s.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,s){const i=performance.now();if(t){if(this.lastTime){const r=i-this.lastTime,n=s-this.lastDroppedFrames,o=t-this.lastDecodedFrames,l=1e3*n/r,c=this.hls;if(c.trigger(p.FPS_DROP,{currentDropped:n,currentDecoded:o,totalDroppedFrames:s}),l>0&&n>c.config.fpsDroppedMonitoringThreshold*o){let h=c.currentLevel;S.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=h)&&(h=h-1,c.trigger(p.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:c.currentLevel}),c.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=s,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}const jt="[eme]";class Lt{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Lt.CDMCleanupPromise?[Lt.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=S.debug.bind(S,jt),this.log=S.log.bind(S,jt),this.warn=S.warn.bind(S,jt),this.error=S.error.bind(S,jt),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(p.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(p.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:s}=this.config,i=t[e];if(i)return i.licenseUrl;if(e===le.WIDEVINE&&s)return s;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,s=t[e];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,s=(n,o,l)=>!!n&&l.indexOf(n)===o,i=t.map(n=>n.audioCodec).filter(s),r=t.map(n=>n.videoCodec).filter(s);return i.length+r.length===0&&r.push("avc1.42e01e"),new Promise((n,o)=>{const l=c=>{const h=c.shift();this.getMediaKeysPromise(h,i,r).then(u=>n({keySystem:h,mediaKeys:u})).catch(u=>{c.length?l(c):u instanceof Be?o(u):o(new Be({type:W.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_NO_ACCESS,error:u,fatal:!0},u.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${s}`;return Kr===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return s(e,t)}getMediaKeysPromise(e,t,s){const i=Xa(e,t,s,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e];let n=r?.keySystemAccess;if(!n){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(i)}`),n=this.requestMediaKeySystemAccess(e,i);const o=this.keySystemAccessPromises[e]={keySystemAccess:n};return n.catch(l=>{this.log(`Failed to obtain access to key-system "${e}": ${l}`)}),n.then(l=>{this.log(`Access for key-system "${l.keySystem}" obtained`);const c=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),o.mediaKeys=l.createMediaKeys().then(h=>(this.log(`Media-keys created for "${e}"`),c.then(u=>u?this.setMediaKeysServerCertificate(h,e,u):h))),o.mediaKeys.catch(h=>{this.error(`Failed to create media-keys for "${e}"}: ${h}`)}),o.mediaKeys})}return n.then(()=>r.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:s}){this.log(`Creating key-system session "${t}" keyId: ${ze.hexDump(e.keyId||[])}`);const i=s.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:s,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const s=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),r="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(s,r,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return ze.hexDump(e.keyId)}updateKeySession(e,t){var s;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${ze.hexDump(((s=e.decryptdata)==null?void 0:s.keyId)||[])} + } (data length: ${t&&t.byteLength})`),i.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,s)=>{const i=Ls(this.config),r=e.map(wi).filter(n=>!!n&&i.indexOf(n)!==-1);return this.getKeySystemSelectionPromise(r).then(({keySystem:n})=>{const o=ki(n);o?t(o):s(new Error(`Unable to find format for key-system "${n}"`))}).catch(s)})}loadKey(e){const t=e.keyInfo.decryptdata,s=this.getKeyIdString(t),i=`(keyId: ${s} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let r=this.keyIdToKeySessionPromise[s];return r||(r=this.keyIdToKeySessionPromise[s]=this.getKeySystemForKeyPromise(t).then(({keySystem:n,mediaKeys:o})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${i}`),this.attemptSetMediaKeys(n,o).then(()=>{this.throwIfDestroyed();const l=this.createMediaKeySessionContext({keySystem:n,mediaKeys:o,decryptdata:t});return this.generateRequestWithPreferredKeySession(l,"cenc",t.pssh,"playlist-key")}))),r.catch(n=>this.handleError(n))),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Be?this.hls.trigger(p.ERROR,e.data):this.hls.trigger(p.ERROR,{type:W.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),s=this.keyIdToKeySessionPromise[t];if(!s){const i=wi(e.keyFormat),r=i?[i]:Ls(this.config);return this.attemptKeySystemAccess(r)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=Ls(this.config)),e.length===0)throw new Be({type:W.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:s}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),s===null)return;let i,r;if(t==="sinf"&&this.config.drmSystems[le.FAIRPLAY]){const h=pe(new Uint8Array(s));try{const u=hi(JSON.parse(h).sinf),d=Xr(new Uint8Array(u));if(!d)return;i=d.subarray(8,24),r=le.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const h=So(s);if(h===null)return;h.version===0&&h.systemId===$r.WIDEVINE&&h.data&&(i=h.data.subarray(8,24)),r=qa(h.systemId)}if(!r||!i)return;const n=ze.hexDump(i),{keyIdToKeySessionPromise:o,mediaKeySessions:l}=this;let c=o[n];for(let h=0;hthis.generateRequestWithPreferredKeySession(u,t,s,"encrypted-event-key-match"));break}}c||(c=o[n]=this.getKeySystemSelectionPromise([r]).then(({keySystem:h,mediaKeys:u})=>{var d;this.throwIfDestroyed();const g=new Pt("ISO-23001-7",n,(d=ki(h))!=null?d:"");return g.pssh=new Uint8Array(s),g.keyId=i,this.attemptSetMediaKeys(h,u).then(()=>{this.throwIfDestroyed();const f=this.createMediaKeySessionContext({decryptdata:g,keySystem:h,mediaKeys:u});return this.generateRequestWithPreferredKeySession(f,t,s,"encrypted-event-no-match")})})),c.catch(h=>this.handleError(h))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(s).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(r=>s.indexOf(r)===-1)})}generateRequestWithPreferredKeySession(e,t,s,i){var r,n;const o=(r=this.config.drmSystems)==null||(n=r[e.keySystem])==null?void 0:n.generateRequest;if(o)try{const f=o.call(this.hls,t,s,e);if(!f)throw new Error("Invalid response from configured generateRequest filter");t=f.initDataType,s=e.decryptdata.pssh=f.initData?new Uint8Array(f.initData):null}catch(f){var l;if(this.warn(f.message),(l=this.hls)!=null&&l.config.debug)throw f}if(s===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const c=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${c} (init data type: ${t} length: ${s?s.byteLength:null})`);const h=new Si,u=e._onmessage=f=>{const m=e.mediaKeysSession;if(!m){h.emit("error",new Error("invalid state"));return}const{messageType:E,message:T}=f;this.log(`"${E}" message event for session "${m.sessionId}" message size: ${T.byteLength}`),E==="license-request"||E==="license-renewal"?this.renewLicense(e,T).catch(y=>{this.handleError(y),h.emit("error",y)}):E==="license-release"?e.keySystem===le.FAIRPLAY&&(this.updateKeySession(e,Ys("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${E}"`)},d=e._onkeystatuseschange=f=>{if(!e.mediaKeysSession){h.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const E=e.keyStatus;h.emit("keyStatus",E),E==="expired"&&(this.warn(`${e.keySystem} expired for key ${c}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",u),e.mediaKeysSession.addEventListener("keystatuseschange",d);const g=new Promise((f,m)=>{h.on("error",m),h.on("keyStatus",E=>{E.startsWith("usable")?f():E==="output-restricted"?m(new Be({type:W.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):E==="internal-error"?m(new Be({type:W.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${E}"`)):E==="expired"?m(new Error("key expired while generating request")):this.warn(`unhandled key status change "${E}"`)})});return e.mediaKeysSession.generateRequest(t,s).then(()=>{var f;this.log(`Request generated for key-session "${(f=e.mediaKeysSession)==null?void 0:f.sessionId}" keyId: ${c}`)}).catch(f=>{throw new Be({type:W.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_NO_SESSION,error:f,fatal:!1},`Error generating key-session request: ${f}`)}).then(()=>g).catch(f=>{throw h.removeAllListeners(),this.removeSession(e),f}).then(()=>(h.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,s)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${ze.hexDump("buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s))} session keyId: ${ze.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,s=t.loader,i=new s(t),r=this.getServerCertificateUrl(e);return r?(this.log(`Fetching server certificate for "${e}"`),new Promise((n,o)=>{const l={responseType:"arraybuffer",url:r},c=t.certLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(d,g,f,m)=>{n(d.data)},onError:(d,g,f,m)=>{o(new Be({type:W.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:Le({url:l.url,data:void 0},d)},`"${e}" certificate request failed (${r}). Status: ${d.code} (${d.text})`))},onTimeout:(d,g,f)=>{o(new Be({type:W.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${r})`))},onAbort:(d,g,f)=>{o(new Error("aborted"))}};i.load(l,h,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,s){return new Promise((i,r)=>{e.setServerCertificate(s).then(n=>{this.log(`setServerCertificate ${n?"success":"not supported by CDM"} (${s?.byteLength}) on "${t}"`),i(e)}).catch(n=>{r(new Be({type:W.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:n,fatal:!0},n.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(s=>this.updateKeySession(e,new Uint8Array(s)).catch(i=>{throw new Be({type:W.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:i,fatal:!0},i.message)}))}unpackPlayReadyKeyMessage(e,t){const s=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!s.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(s,"application/xml"),r=i.querySelectorAll("HttpHeader");if(r.length>0){let h;for(let u=0,d=r.length;u in key message");return Ys(atob(c))}setupLicenseXHR(e,t,s,i){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,s,i)}).catch(n=>{if(!s.decryptdata)throw n;return e.open("POST",t,!0),r.call(this.hls,e,t,s,i)}).then(n=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:n||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const s=this.config.keyLoadPolicy.default;return new Promise((i,r)=>{const n=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${n}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let l=o.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const c=this.config.licenseResponseCallback;if(c)try{l=c.call(this.hls,o,n,e)}catch(h){this.error(h)}i(l)}else{const l=s.errorRetry,c=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||o.status>=400&&o.status<500)r(new Be({type:W.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:n,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${n}). Status: ${o.status} (${o.statusText})`));else{const h=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} attempts left`),this.requestLicense(e,t).then(i,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,n,e,t).then(({xhr:l,licenseChallenge:c})=>{e.keySystem==le.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(l,c)),l.send(c)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,s.addEventListener("encrypted",this.onMediaEncrypted),s.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Pt.clearKeyUriToKeyIdMap();const s=t.length;Lt.CDMCleanupPromise=Promise.all(t.map(i=>this.removeSession(i)).concat(e?.setMediaKeys(null).catch(i=>{this.log(`Could not clear media keys: ${i}`)}))).then(()=>{s&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(i=>{this.log(`Could not close sessions and clear media keys: ${i}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=t.reduce((i,r)=>(i.indexOf(r.keyFormat)===-1&&i.push(r.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:s}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);return i>-1&&this.mediaKeySessions.splice(i,1),t.remove().catch(r=>{this.log(`Could not remove session: ${r}`)}).then(()=>t.close()).catch(r=>{this.log(`Could not close session: ${r}`)})}}}Lt.CDMCleanupPromise=void 0;class Be extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var Ie;(function(a){a.MANIFEST="m",a.AUDIO="a",a.VIDEO="v",a.MUXED="av",a.INIT="i",a.CAPTION="c",a.TIMED_TEXT="tt",a.KEY="k",a.OTHER="o"})(Ie||(Ie={}));var si;(function(a){a.DASH="d",a.HLS="h",a.SMOOTH="s",a.OTHER="o"})(si||(si={}));var dt;(function(a){a.OBJECT="CMCD-Object",a.REQUEST="CMCD-Request",a.SESSION="CMCD-Session",a.STATUS="CMCD-Status"})(dt||(dt={}));const Wc={[dt.OBJECT]:["br","d","ot","tb"],[dt.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[dt.SESSION]:["cid","pr","sf","sid","st","v"],[dt.STATUS]:["bs","rtp"]};class It{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(s=>s instanceof It?s:new It(s))),this.value=e,this.params=t}}class Un{constructor(e){this.description=void 0,this.description=e}}const Yc="Dict";function jc(a){return Array.isArray(a)?JSON.stringify(a):a instanceof Map?"Map{}":a instanceof Set?"Set{}":typeof a=="object"?JSON.stringify(a):String(a)}function zc(a,e,t,s){return new Error(`failed to ${a} "${jc(e)}" as ${t}`,{cause:s})}const Rr="Bare Item",qc="Boolean",Xc="Byte Sequence",Qc="Decimal",Jc="Integer";function Zc(a){return a<-999999999999999||99999999999999912)throw Ze(a,Qc);const t=e.toString();return t.includes(".")?t:`${t}.0`}const lh="String";function ch(a){if(eh.test(a))throw Ze(a,lh);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function hh(a){return a.description||a.toString().slice(7,-1)}function br(a){const e=hh(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Ze(e,th);return e}function ii(a){switch(typeof a){case"number":if(!N(a))throw Ze(a,Rr);return Number.isInteger(a)?Bn(a):oh(a);case"string":return ch(a);case"symbol":return br(a);case"boolean":return ih(a);case"object":if(a instanceof Date)return ah(a);if(a instanceof Uint8Array)return nh(a);if(a instanceof Un)return br(a);default:throw Ze(a,Rr)}}function ri(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw Ze(a,sh);return a}function bi(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${ri(e)}`:`;${ri(e)}=${ii(t)}`).join("")}function $n(a){return a instanceof It?`${ii(a.value)}${bi(a.params)}`:ii(a)}function uh(a){return`(${a.value.map($n).join(" ")})${bi(a.params)}`}function dh(a,e={whitespace:!0}){if(typeof a!="object")throw Ze(a,Yc);const t=a instanceof Map?a.entries():Object.entries(a),s=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,r])=>{r instanceof It||(r=new It(r));let n=ri(i);return r.value===!0?n+=bi(r.params):(n+="=",Array.isArray(r.value)?n+=uh(r):n+=$n(r)),n}).join(`,${s}`)}function fh(a,e){return dh(a,e)}const gh=a=>a==="ot"||a==="sf"||a==="st",mh=a=>typeof a=="number"?N(a):a!=null&&a!==""&&a!==!1;function ph(a,e){const t=new URL(a),s=new URL(e);if(t.origin!==s.origin)return a;const i=t.pathname.split("/").slice(1),r=s.pathname.split("/").slice(1,-1);for(;i[0]===r[0];)i.shift(),r.shift();for(;r.length;)r.shift(),i.unshift("..");return i.join("/")}function Eh(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const r=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?r:r&3|8).toString(16)})}}}const ss=a=>Math.round(a),Th=(a,e)=>(e!=null&&e.baseUrl&&(a=ph(a,e.baseUrl)),encodeURIComponent(a)),zt=a=>ss(a/100)*100,yh={br:ss,d:ss,bl:zt,dl:zt,mtp:zt,nor:Th,rtp:zt,tb:ss};function vh(a,e){const t={};if(a==null||typeof a!="object")return t;const s=Object.keys(a).sort(),i=me({},yh,e?.formatters),r=e?.filter;return s.forEach(n=>{if(r!=null&&r(n))return;let o=a[n];const l=i[n];l&&(o=l(o,e)),!(n==="v"&&o===1)&&(n=="pr"&&o===1||mh(o)&&(gh(n)&&typeof o=="string"&&(o=new Un(o)),t[n]=o))}),t}function Kn(a,e={}){return a?fh(vh(a,e),me({whitespace:!1},e)):""}function xh(a,e={}){if(!a)return{};const t=Object.entries(a),s=Object.entries(Wc).concat(Object.entries(e?.customHeaderMap||{})),i=t.reduce((r,n)=>{var o,l;const[c,h]=n,u=((o=s.find(d=>d[1].includes(c)))==null?void 0:o[0])||dt.REQUEST;return(l=r[u])!=null||(r[u]={}),r[u][c]=h,r},{});return Object.entries(i).reduce((r,[n,o])=>(r[n]=Kn(o,e),r),{})}function Sh(a,e,t){return me(a,xh(e,t))}const Lh="CMCD";function Ah(a,e={}){if(!a)return"";const t=Kn(a,e);return`${Lh}=${encodeURIComponent(t)}`}const Ir=/CMCD=[^&#]+/;function Rh(a,e,t){const s=Ah(e,t);if(!s)return a;if(Ir.test(a))return a.replace(Ir,s);const i=a.includes("?")?"&":"?";return`${a}${i}${s}`}class bh{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=i=>{try{this.apply(i,{ot:Ie.MANIFEST,su:!this.initialized})}catch(r){S.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=i=>{try{const r=i.frag,n=this.hls.levels[r.level],o=this.getObjectType(r),l={d:r.duration*1e3,ot:o};(o===Ie.VIDEO||o===Ie.AUDIO||o==Ie.MUXED)&&(l.br=n.bitrate/1e3,l.tb=this.getTopBandwidth(o)/1e3,l.bl=this.getBufferLength(o)),this.apply(i,l)}catch(r){S.warn("Could not generate segment CMCD data.",r)}},this.hls=e;const t=this.config=e.config,{cmcd:s}=t;s!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||Eh(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.includeKeys=s.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHED,this.onMediaDetached,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHED,this.onMediaDetached,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var s,i;this.audioBuffer=(s=t.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:si.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){me(t,this.createData());const s=t.ot===Ie.INIT||t.ot===Ie.VIDEO||t.ot===Ie.MUXED;this.starved&&s&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((r,n)=>(i.includes(n)&&(r[n]=t[n]),r),{})),this.useHeaders?(e.headers||(e.headers={}),Sh(e.headers,t)):e.url=Rh(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Ie.TIMED_TEXT;if(e.sn==="initSegment")return Ie.INIT;if(t==="audio")return Ie.AUDIO;if(t==="main")return this.hls.audioTracks.length?Ie.VIDEO:Ie.MUXED}getTopBandwidth(e){let t=0,s;const i=this.hls;if(e===Ie.AUDIO)s=i.audioTracks;else{const r=i.maxAutoLevel,n=r>-1?r+1:i.levels.length;s=i.levels.slice(0,n)}for(const r of s)r.bitrate>t&&(t=r.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,s=e===Ie.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!t?NaN:ne.bufferInfo(s,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new s(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,n,o){t(r),this.loader.load(r,n,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,s=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new s(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,n,o){t(r),this.loader.load(r,n,o)}}}}const Ih=3e5;class Dh{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=S.log.bind(S,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(s=>s!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:s}=t;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:s}=t;if(s?.action===Ae.SendAlternateToPenaltyBox&&s.flags===He.MoveAllAlternatesMatchingHost){const i=this.levels;let r=this.pathwayPriority,n=this.pathwayId;if(t.context){const{groupId:o,pathwayId:l,type:c}=t.context;o&&i?n=this.getPathwayForGroupId(o,c,n):l&&(n=l)}n in this.penalizedPathways||(this.penalizedPathways[n]=performance.now()),!r&&i&&(r=i.reduce((o,l)=>(o.indexOf(l.pathwayId)===-1&&o.push(l.pathwayId),o),[])),r&&r.length>1&&(this.updatePathwayPriority(r),s.resolved=this.pathwayId!==n),s.resolved||S.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${n} levels: ${i&&i.length} priorities: ${JSON.stringify(r)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),t=this.getLevelsForPathway(s),this.pathwayId=s}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const s=this.penalizedPathways,i=performance.now();Object.keys(s).forEach(r=>{i-s[r]>Ih&&delete s[r]});for(let r=0;r0){this.log(`Setting Pathway to "${n}"`),this.pathwayId=n,on(t),this.hls.trigger(p.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[o];l&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,s){const i=this.getLevelsForPathway(s).concat(this.levels||[]);for(let r=0;r{const{ID:n,"BASE-ID":o,"URI-REPLACEMENT":l}=r;if(t.some(h=>h.pathwayId===n))return;const c=this.getLevelsForPathway(o).map(h=>{const u=new ce(h.attrs);u["PATHWAY-ID"]=n;const d=u.AUDIO&&`${u.AUDIO}_clone_${n}`,g=u.SUBTITLES&&`${u.SUBTITLES}_clone_${n}`;d&&(s[u.AUDIO]=d,u.AUDIO=d),g&&(i[u.SUBTITLES]=g,u.SUBTITLES=g);const f=Vn(h.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),m=new Rt({attrs:u,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:f,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let E=1;E{this.log(`Loaded steering manifest: "${i}"`);const f=h.data;if(f.VERSION!==1){this.log(`Steering VERSION ${f.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=f.TTL;const{"RELOAD-URI":m,"PATHWAY-CLONES":E,"PATHWAY-PRIORITY":T}=f;if(m)try{this.uri=new self.URL(m,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${m}`);return}this.scheduleRefresh(this.uri||d.url),E&&this.clonePathways(E);const y={steeringManifest:f,url:i.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,y),T&&this.updatePathwayPriority(T)},onError:(h,u,d,g)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${u.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${u.url} no longer available`);return}let f=this.timeToLoad*1e3;if(h.code===429){const m=this.loader;if(typeof m?.getResponseHeader=="function"){const E=m.getResponseHeader("Retry-After");E&&(f=parseFloat(E)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,f)},onTimeout:(h,u,d)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(r,l,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;const i=(s=this.hls)==null?void 0:s.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Dr(a,e,t,s){a&&Object.keys(e).forEach(i=>{const r=a.filter(n=>n.groupId===i).map(n=>{const o=me({},n);return o.details=void 0,o.attrs=new ce(o.attrs),o.url=o.attrs.URI=Vn(n.url,n.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[i],o.attrs["PATHWAY-ID"]=s,o});a.push(...r)})}function Vn(a,e,t,s){const{HOST:i,PARAMS:r,[t]:n}=s;let o;e&&(o=n?.[e],o&&(a=o));const l=new self.URL(a);return i&&!o&&(l.host=i),r&&Object.keys(r).sort().forEach(c=>{c&&l.searchParams.set(c,r[c])}),l.href}const Ch=/^age:\s*[\d.]+\s*$/im;class Hn{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Es,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=s,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const s=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!(this.loader!==s||this.stats.aborted))return r(s,t.url)}).catch(n=>{if(!(this.loader!==s||this.stats.aborted))return s.open("GET",t.url,!0),r(s,t.url)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,t,e)}).catch(n=>{this.callbacks.onError({code:s.status,text:n.message},t,s,i)}):this.openAndSendXhr(s,t,e)}openAndSendXhr(e,t,s){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:n}=s.loadPolicy;if(i)for(const o in i)e.setRequestHeader(o,i[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),s.timeout=r&&N(r)?r:n,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:s}=this;if(!e||!t)return;const i=t.readyState,r=this.config;if(!s.aborted&&i>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const n=t.status,o=t.responseType!=="text";if(n>=200&&n<300&&(o&&t.response||t.responseText!==null)){s.loading.end=Math.max(self.performance.now(),s.loading.first);const l=o?t.response:t.responseText,c=t.responseType==="arraybuffer"?l.byteLength:l.length;if(s.loaded=s.total=c,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first),!this.callbacks)return;const h=this.callbacks.onProgress;if(h&&h(s,e,l,t),!this.callbacks)return;const u={url:t.responseURL,data:l,code:n};this.callbacks.onSuccess(u,s,e,t)}else{const l=r.loadPolicy.errorRetry,c=s.retry,h={url:e.url,data:void 0,code:n};hs(l,c,!1,h)?this.retry(l):(S.error(`${n} while loading ${e.url}`),this.callbacks.onError({code:n,text:t.statusText},e,t,s))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(hs(e,t,!0))this.retry(e);else{var s;S.warn(`timeout while loading ${(s=this.context)==null?void 0:s.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:s}=this;this.retryDelay=fi(e,s.retry),s.retry++,S.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${s.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Ch.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}function _h(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const wh=/(\d+)-(\d+)\/(\d+)/;class Cr{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Oh,this.controller=new self.AbortController,this.stats=new Es}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,s){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const r=kh(e,this.controller.signal),n=s.onProgress,o=e.responseType==="arraybuffer",l=o?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:h}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=s,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=c&&N(c)?c:h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),s.onTimeout(i,e,this.response)},t.timeout),self.fetch(this.request).then(u=>{this.response=this.loader=u;const d=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),s.onTimeout(i,e,this.response)},h-(d-i.loading.start)),!u.ok){const{status:g,statusText:f}=u;throw new Mh(f||"fetch, bad network response",g,u)}return i.loading.first=d,i.total=Fh(u.headers)||i.total,n&&N(t.highWaterMark)?this.loadProgressively(u,i,e,t.highWaterMark,n):o?u.arrayBuffer():e.responseType==="json"?u.json():u.text()}).then(u=>{const d=this.response;if(!d)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const g=u[l];g&&(i.loaded=i.total=g);const f={url:d.url,data:u,code:d.status};n&&!N(t.highWaterMark)&&n(i,e,u,d),s.onSuccess(f,i,e,d)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;const d=u&&u.code||0,g=u?u.message:null;s.onError({code:d,text:g},e,u?u.details:null,i)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,s,i=0,r){const n=new un,o=e.body.getReader(),l=()=>o.read().then(c=>{if(c.done)return n.dataLength&&r(t,s,n.flush(),e),Promise.resolve(new ArrayBuffer(0));const h=c.value,u=h.length;return t.loaded+=u,u=i&&r(t,s,n.flush(),e)):r(t,s,h,e),l()}).catch(()=>Promise.reject());return l()}}function kh(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(me({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function Ph(a){const e=wh.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Fh(a){const e=a.get("Content-Range");if(e){const s=Ph(e);if(N(s))return s}const t=a.get("Content-Length");if(t)return parseInt(t)}function Oh(a,e){return new self.Request(a.url,e)}class Mh extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const Nh=/\s/,Uh={newCue(a,e,t,s){const i=[];let r,n,o,l,c;const h=self.VTTCue||self.TextTrackCue;for(let d=0;d=16?l--:l++;const g=Pn(c.trim()),f=Ai(e,t,g);a!=null&&(u=a.cues)!=null&&u.getCueById(f)||(n=new h(e,t,g),n.id=f,n.line=d+1,n.align="left",n.position=10+Math.min(80,Math.floor(l*8/32)*10),i.push(n))}return a&&i.length&&(i.sort((d,g)=>d.line==="auto"||g.line==="auto"?0:d.line>8&&g.line>8?g.line-d.line:d.line-g.line),i.forEach(d=>sn(a,d))),i}},Bh={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Wn=Le(Le({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Hn,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:dl,bufferController:pc,capLevelController:Ri,errorController:el,fpsController:Hc,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Kr,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:Bh},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Gh()),{},{subtitleStreamController:dc,subtitleTrackController:gc,timelineController:Kc,audioStreamController:hc,audioTrackController:uc,emeController:Lt,cmcdController:bh,contentSteeringController:Dh});function Gh(){return{cueHandler:Uh,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function $h(a,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=ni(a),s=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return s.forEach(r=>{const n=`${r==="level"?"playlist":r}LoadPolicy`,o=e[n]===void 0,l=[];i.forEach(c=>{const h=`${r}Loading${c}`,u=e[h];if(u!==void 0&&o){l.push(h);const d=t[n].default;switch(e[n]={default:d},c){case"TimeOut":d.maxLoadTimeMs=u,d.maxTimeToFirstByteMs=u;break;case"MaxRetry":d.errorRetry.maxNumRetry=u,d.timeoutRetry.maxNumRetry=u;break;case"RetryDelay":d.errorRetry.retryDelayMs=u,d.timeoutRetry.retryDelayMs=u;break;case"MaxRetryTimeout":d.errorRetry.maxRetryDelayMs=u,d.timeoutRetry.maxRetryDelayMs=u;break}}}),l.length&&S.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${n}": ${JSON.stringify(e[n])}`)}),Le(Le({},t),e)}function ni(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(ni):Object.keys(a).reduce((e,t)=>(e[t]=ni(a[t]),e),{}):a}function Kh(a){const e=a.loader;e!==Cr&&e!==Hn?(S.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):_h()&&(a.loader=Cr,a.progressive=!0,a.enableSoftwareAES=!0,S.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Ks;class Vh extends gi{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const s=this.hls.config.preferManagedMediaSource,i=[],r={},n={};let o=!1,l=!1,c=!1;t.levels.forEach(h=>{var u,d;const g=h.attrs;let{audioCodec:f,videoCodec:m}=h;((u=f)==null?void 0:u.indexOf("mp4a.40.34"))!==-1&&(Ks||(Ks=/chrome|firefox/i.test(navigator.userAgent)),Ks&&(h.audioCodec=f=void 0)),f&&(h.audioCodec=f=os(f,s)),((d=m)==null?void 0:d.indexOf("avc1"))===0&&(m=h.videoCodec=Co(m));const{width:E,height:T,unknownCodecs:y}=h;if(o||(o=!!(E&&T)),l||(l=!!m),c||(c=!!f),y!=null&&y.length||f&&!Is(f,"audio",s)||m&&!Is(m,"video",s))return;const{CODECS:v,"FRAME-RATE":A,"HDCP-LEVEL":x,"PATHWAY-ID":D,RESOLUTION:R,"VIDEO-RANGE":C}=g,I=`${`${D||"."}-`}${h.bitrate}-${R}-${A}-${v}-${C}-${x}`;if(r[I])if(r[I].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const w=n[I]+=1;h.attrs["PATHWAY-ID"]=new Array(w+1).join(".");const B=new Rt(h);r[I]=B,i.push(B)}else r[I].addGroupId("audio",g.AUDIO),r[I].addGroupId("text",g.SUBTITLES);else{const w=new Rt(h);r[I]=w,n[I]=1,i.push(w)}}),this.filterAndSortMediaOptions(i,t,o,l,c)}filterAndSortMediaOptions(e,t,s,i,r){let n=[],o=[],l=e;if((s||i)&&r&&(l=l.filter(({videoCodec:f,videoRange:m,width:E,height:T})=>(!!f||!!(E&&T))&&Ko(m))),l.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const f=new Error("no level with compatible codecs found in manifest");this.hls.trigger(p.ERROR,{type:W.MEDIA_ERROR,details:b.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:f,reason:f.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:f}=this.hls.config;n=t.audioTracks.filter(m=>!m.audioCodec||Is(m.audioCodec,"audio",f)),_r(n)}t.subtitles&&(o=t.subtitles,_r(o));const c=l.slice(0);l.sort((f,m)=>{if(f.attrs["HDCP-LEVEL"]!==m.attrs["HDCP-LEVEL"])return(f.attrs["HDCP-LEVEL"]||"")>(m.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&f.height!==m.height)return f.height-m.height;if(f.frameRate!==m.frameRate)return f.frameRate-m.frameRate;if(f.videoRange!==m.videoRange)return ls.indexOf(f.videoRange)-ls.indexOf(m.videoRange);if(f.videoCodec!==m.videoCodec){const E=Ni(f.videoCodec),T=Ni(m.videoCodec);if(E!==T)return T-E}if(f.uri===m.uri&&f.codecSet!==m.codecSet){const E=as(f.codecSet),T=as(m.codecSet);if(E!==T)return T-E}return f.averageBitrate!==m.averageBitrate?f.averageBitrate-m.averageBitrate:0});let h=c[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==c.length)){for(let f=0;fE&&E===Wn.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=T)}break}const d=r&&!i,g={levels:l,audioTracks:n,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:i,altAudio:!d&&n.some(f=>!!f.url)};this.hls.trigger(p.MANIFEST_PARSED,g),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const h=new Error("invalid level idx"),u=e<0;if(this.hls.trigger(p.ERROR,{type:W.OTHER_ERROR,details:b.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:h,reason:h.message}),u)return;e=Math.min(e,t.length-1)}const s=this.currentLevelIndex,i=this.currentLevel,r=i?i.attrs["PATHWAY-ID"]:void 0,n=t[e],o=n.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=n,s===e&&n.details&&i&&r===o)return;this.log(`Switching to level ${e} (${n.height?n.height+"p ":""}${n.videoRange?n.videoRange+" ":""}${n.codecSet?n.codecSet+" ":""}@${n.bitrate})${o?" with Pathway "+o:""} from level ${s}${r?" with Pathway "+r:""}`);const l={level:e,attrs:n.attrs,details:n.details,bitrate:n.bitrate,averageBitrate:n.averageBitrate,maxBitrate:n.maxBitrate,realBitrate:n.realBitrate,width:n.width,height:n.height,codecSet:n.codecSet,audioCodec:n.audioCodec,videoCodec:n.videoCodec,audioGroups:n.audioGroups,subtitleGroups:n.subtitleGroups,loaded:n.loaded,loadError:n.loadError,fragmentError:n.fragmentError,name:n.name,id:n.id,uri:n.uri,url:n.url,urlId:0,audioGroupIds:n.audioGroupIds,textGroupIds:n.textGroupIds};this.hls.trigger(p.LEVEL_SWITCHING,l);const c=n.details;if(!c||c.live){const h=this.switchParams(n.uri,i?.details,c);this.loadPlaylist(h)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===te.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===V.MAIN){const s=t.elementaryStreams;if(!Object.keys(s).some(r=>!!s[r]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var s;const{level:i,details:r}=t,n=this._levels[i];if(!n){var o;this.warn(`Invalid level index ${i}`),(o=t.deliveryDirectives)!=null&&o.skip&&(r.deltaUpdateFailed=!0);return}i===this.currentLevelIndex?(n.fragmentError===0&&(n.loadError=0),this.playlistLoaded(i,t,n.details)):(s=t.deliveryDirectives)!=null&&s.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,s=this.currentLevel;if(s&&this.shouldLoadPlaylist(s)){let i=s.uri;if(e)try{i=e.addDirectives(i)}catch(n){this.warn(`Could not construct new URL with HLS Delivery Directives: ${n}`)}const r=s.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${e?.msn!==void 0?" at sn "+e.msn+" part "+e.part:""} with${r?" Pathway "+r:""} ${i}`),this.clearTimer(),this.hls.trigger(p.LEVEL_LOADING,{url:i,level:t,pathwayId:s.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const s=this._levels.filter((i,r)=>r!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(n=>n.level=-1)),!1));on(s),this._levels=s,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(p.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(p.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function _r(a){const e={};a.forEach(t=>{const s=t.groupId||"";t.id=e[s]=e[s]||0,e[s]++})}class Hh{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const s in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[s].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=b.KEY_LOAD_ERROR,s,i,r){return new it({type:W.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:s,networkDetails:i})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:s,cc:i}=e;for(let r=0;r{n.setKeyFormat(o)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var s,i;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const c=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,b.KEY_LOAD_ERROR,c))}const n=r.uri;if(!n)return Promise.reject(this.createKeyLoadError(e,b.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${n}"`)));let o=this.keyUriToKeyInfo[n];if((s=o)!=null&&s.decryptdata.key)return r.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((i=o)!=null&&i.keyLoadPromise){var l;switch((l=o.mediaKeySessionContext)==null?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(c=>(r.key=c.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}}switch(o=this.keyUriToKeyInfo[n]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return r.keyFormat==="identity"?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,b.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const s={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(s);if(i)return(e.keyLoadPromise=i.then(r=>(e.mediaKeySessionContext=r,s))).catch(r=>{throw e.keyLoadPromise=null,r})}return Promise.resolve(s)}loadKeyHTTP(e,t){const s=this.config,i=s.loader,r=new i(s);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((n,o)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},c=s.keyLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(d,g,f,m)=>{const{frag:E,keyInfo:T,url:y}=f;if(!E.decryptdata||T!==this.keyUriToKeyInfo[y])return o(this.createKeyLoadError(E,b.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),m));T.decryptdata.key=E.decryptdata.key=new Uint8Array(d.data),E.keyLoader=null,T.loader=null,n({frag:E,keyInfo:T})},onError:(d,g,f,m)=>{this.resetLoader(g),o(this.createKeyLoadError(t,b.KEY_LOAD_ERROR,new Error(`HTTP Error ${d.code} loading key ${d.text}`),f,Le({url:l.url,data:void 0},d)))},onTimeout:(d,g,f)=>{this.resetLoader(g),o(this.createKeyLoadError(t,b.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),f))},onAbort:(d,g,f)=>{this.resetLoader(g),o(this.createKeyLoadError(t,b.INTERNAL_ABORTED,new Error("key loading aborted"),f))}};r.load(l,h,u)})}resetLoader(e){const{frag:t,keyInfo:s,url:i}=e,r=s.loader;t.keyLoader===r&&(t.keyLoader=null,s.loader=null),delete this.keyUriToKeyInfo[i],r&&r.destroy()}}function Yn(){return self.SourceBuffer||self.WebKitSourceBuffer}function jn(){if(!gt())return!1;const e=Yn();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Wh(){if(!jn())return!1;const a=gt();return typeof a?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>a.isTypeSupported(Ft(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(Ft(e,"audio"))))}function Yh(){var a;const e=Yn();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const jh=250,is=2,zh=.1,qh=.05;class Xh{constructor(e,t,s,i){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=s,this.hls=i}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:s,media:i,stalled:r}=this;if(i===null)return;const{currentTime:n,seeking:o}=i,l=this.seeking&&!o,c=!this.seeking&&o;if(this.seeking=o,n!==e){if(this.moved=!0,o||(this.nudgeRetry=0),r!==null){if(this.stallReported){const E=self.performance.now()-r;S.warn(`playback not stuck anymore @${n}, after ${Math.round(E)}ms`),this.stallReported=!1}this.stalled=null}return}if(c||l){this.stalled=null;return}if(i.paused&&!o||i.ended||i.playbackRate===0||!ne.getBuffered(i).length){this.nudgeRetry=0;return}const h=ne.bufferInfo(i,n,0),u=h.nextStart||0;if(o){const E=h.len>is,T=!u||t&&t.start<=n||u-n>is&&!this.fragmentTracker.getPartialFragment(n);if(E||T)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var d;if(!(h.len>0)&&!u)return;const T=Math.max(u,h.start||0)-n,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,A=(y==null||(d=y.details)==null?void 0:d.live)?y.details.targetduration*2:is,x=this.fragmentTracker.getPartialFragment(n);if(T>0&&(T<=A||x)){i.paused||this._trySkipBufferHole(x);return}}const g=self.performance.now();if(r===null){this.stalled=g;return}const f=g-r;if(!o&&f>=jh&&(this._reportStall(h),!this.media))return;const m=ne.bufferInfo(i,n,s.maxBufferHole);this._tryFixBufferStall(m,f)}_tryFixBufferStall(e,t){const{config:s,fragmentTracker:i,media:r}=this;if(r===null)return;const n=r.currentTime,o=i.getPartialFragment(n);o&&(this._trySkipBufferHole(o)||!this.media)||(e.len>s.maxBufferHole||e.nextStart&&e.nextStart-ns.highBufferWatchdogPeriod*1e3&&(S.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:s,stallReported:i}=this;if(!i&&s){this.stallReported=!0;const r=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${JSON.stringify(e)})`);S.warn(r.message),t.trigger(p.ERROR,{type:W.MEDIA_ERROR,details:b.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:s,media:i}=this;if(i===null)return 0;const r=i.currentTime,n=ne.bufferInfo(i,r,0),o=r0&&n.len<1&&i.readyState<3,h=o-r;if(h>0&&(l||c)){if(h>t.maxBufferHole){const{fragmentTracker:d}=this;let g=!1;if(r===0){const f=d.getAppendedFrag(0,V.MAIN);f&&o1?(i=0,this.bitrateTest=!0):i=s.firstAutoLevel),s.nextLoadLevel=i,this.level=s.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=_.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=_.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case _.WAITING_LEVEL:{const{levels:t,level:s}=this,i=t?.[s],r=i?.details;if(r&&(!r.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(r))break;this.state=_.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=_.IDLE;break}break}case _.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),s=this.retryDate;if(!s||t>=s||(e=this.media)!=null&&e.seeking){const{levels:i,level:r}=this,n=i?.[r];this.resetStartWhenNotLoaded(n||null),this.state=_.IDLE}}break}this.state===_.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:s,media:i}=this;if(t===null||!i&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const r=e.nextLoadLevel;if(!(s!=null&&s[r]))return;const n=s[r],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const m={};this.altAudio&&(m.type="video"),this.hls.trigger(p.BUFFER_EOS,m),this.state=_.ENDED;return}e.loadLevel!==r&&e.manualLevel===-1&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const c=n.details;if(!c||this.state===_.WAITING_LEVEL||c.live&&this.levelLastLoaded!==n){this.level=r,this.state=_.WAITING_LEVEL;return}const h=o.len,u=this.getMaxBufferLength(n.maxBitrate);if(h>=u)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const d=this.backtrackFragment?this.backtrackFragment.start:o.end;let g=this.getNextFragment(d,c);if(this.couldBacktrack&&!this.fragPrevious&&g&&g.sn!=="initSegment"&&this.fragmentTracker.getState(g)!==xe.OK){var f;const E=((f=this.backtrackFragment)!=null?f:g).sn-c.startSN,T=c.fragments[E-1];T&&g.cc===T.cc&&(g=T,this.fragmentTracker.removeFragment(T))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(g&&this.isLoopLoading(g,d)){if(!g.gap){const E=this.audioOnly&&!this.altAudio?ie.AUDIO:ie.VIDEO,T=(E===ie.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;T&&this.afterBufferFlushed(T,E,V.MAIN)}g=this.getNextFragmentLoopLoading(g,c,o,V.MAIN,u)}g&&(g.initSegment&&!g.initSegment.data&&!this.bitrateTest&&(g=g.initSegment),this.loadFragment(g,n,d))}loadFragment(e,t,s){const i=this.fragmentTracker.getState(e);this.fragCurrent=e,i===xe.NOT_LOADED||i===xe.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,s)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,V.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let s;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const r=this.getLevelDetails();if(r!=null&&r.live){const o=this.getMainFwdBufferInfo();if(!o||o.len{const n=r.audioCodec;n&&(s=s||n.indexOf("mp4a.40.2")!==-1,i=i||n.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=s&&i&&!Yh(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:s}=this;if(!s||this.state!==_.IDLE)return;const i=s[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=_.WAITING_LEVEL)}onLevelLoaded(e,t){var s;const{levels:i}=this,r=t.level,n=t.details,o=n.totalduration;if(!i){this.warn(`Levels were reset while loading level ${r}`);return}this.log(`Level ${r} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""}, cc [${n.startCC}, ${n.endCC}] duration:${o}`);const l=i[r],c=this.fragCurrent;c&&(this.state===_.FRAG_LOADING||this.state===_.FRAG_LOADING_WAITING_RETRY)&&c.level!==t.level&&c.loader&&this.abortCurrentFrag();let h=0;if(n.live||(s=l.details)!=null&&s.live){var u;if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;h=this.alignPlaylists(n,l.details,(u=this.levelLastLoaded)==null?void 0:u.details)}if(l.details=n,this.levelLastLoaded=l,this.hls.trigger(p.LEVEL_UPDATED,{details:n,level:r}),this.state===_.WAITING_LEVEL){if(this.waitForCdnTuneIn(n))return;this.state=_.IDLE}this.startFragRequested?n.live&&this.synchronizeToLiveEdge(n):this.setStartPosition(n,h),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:s,part:i,payload:r}=e,{levels:n}=this;if(!n){this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const o=n[s.level],l=o.details;if(!l){this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),this.fragmentTracker.removeFragment(s);return}const c=o.videoCodec,h=l.PTSKnown||!l.live,u=(t=s.initSegment)==null?void 0:t.data,d=this._getAudioCodec(o),g=this.transmuxer=this.transmuxer||new In(this.hls,V.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=i?i.index:-1,m=f!==-1,E=new mi(s.level,s.sn,s.stats.chunkCount,r.byteLength,f,m),T=this.initPTS[s.cc];g.push(r,u,d,c,s,i,l.totalduration,h,E,T)}onAudioTrackSwitching(e,t){const s=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const n=this.fragCurrent;n&&(this.log("Switching to main audio track, cancel main fragment load"),n.abortRequests(),this.fragmentTracker.removeFragment(n)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const r=this.hls;s&&(r.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),r.trigger(p.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const s=t.id,i=!!this.hls.audioTracks[s].url;if(i){const r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=i,this.tick()}onBufferCreated(e,t){const s=t.tracks;let i,r,n=!1;for(const o in s){const l=s[o];if(l.id==="main"){if(r=o,i=l,o==="video"){const c=s[o];c&&(this.videoBuffer=c.buffer)}}else n=!0}n&&i?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:s,part:i}=t;if(s&&s.type!==V.MAIN)return;if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${i?" p: "+i.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===_.PARSED&&(this.state=_.IDLE);return}const r=i?i.stats:s.stats;this.fragLastKbps=Math.round(8*r.total/(r.buffering.end-r.loading.first)),s.sn!=="initSegment"&&(this.fragPrevious=s),this.fragBufferedComplete(s,i)}onError(e,t){var s;if(t.fatal){this.state=_.ERROR;return}switch(t.details){case b.FRAG_GAP:case b.FRAG_PARSING_ERROR:case b.FRAG_DECRYPT_ERROR:case b.FRAG_LOAD_ERROR:case b.FRAG_LOAD_TIMEOUT:case b.KEY_LOAD_ERROR:case b.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(V.MAIN,t);break;case b.LEVEL_LOAD_ERROR:case b.LEVEL_LOAD_TIMEOUT:case b.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===_.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===te.LEVEL&&(this.state=_.IDLE);break;case b.BUFFER_APPEND_ERROR:case b.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===b.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case b.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!ne.getBuffered(e).length){const s=this.state!==_.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,s)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=_.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==ie.AUDIO||this.audioOnly&&!this.altAudio){const s=(t===ie.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(s,t,V.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let s=this.startPosition;if(s>=0&&t0&&(n{const{hls:i}=this;if(!s||this.fragContextChanged(e))return;t.fragmentError=0,this.state=_.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const r=e.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),i.trigger(p.FRAG_LOADED,s),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const s="main",{hls:i}=this,{remuxResult:r,chunkMeta:n}=e,o=this.getCurrentContext(n);if(!o){this.resetWhenMissingContext(n);return}const{frag:l,part:c,level:h}=o,{video:u,text:d,id3:g,initSegment:f}=r,{details:m}=h,E=this.altAudio?void 0:r.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=_.PARSING,f){if(f!=null&&f.tracks){const v=l.initSegment||l;this._bufferInitSegment(h,f.tracks,v,n),i.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:v,id:s,tracks:f.tracks})}const T=f.initPTS,y=f.timescale;N(T)&&(this.initPTS[l.cc]={baseTime:T,timescale:y},i.trigger(p.INIT_PTS_FOUND,{frag:l,id:s,initPTS:T,timescale:y}))}if(u&&m&&l.sn!=="initSegment"){const T=m.fragments[l.sn-1-m.startSN],y=l.sn===m.startSN,v=!T||l.cc>T.cc;if(r.independent!==!1){const{startPTS:A,endPTS:x,startDTS:D,endDTS:R}=u;if(c)c.elementaryStreams[u.type]={startPTS:A,endPTS:x,startDTS:D,endDTS:R};else if(u.firstKeyFrame&&u.independent&&n.id===1&&!v&&(this.couldBacktrack=!0),u.dropped&&u.independent){const C=this.getMainFwdBufferInfo(),k=(C?C.end:this.getLoadPosition())+this.config.maxBufferHole,I=u.firstKeyFramePTS?u.firstKeyFramePTS:A;if(!y&&kis&&(l.gap=!0);l.setElementaryStreamInfo(u.type,A,x,D,R),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(u,l,c,n,y||v)}else if(y||v)l.gap=!0;else{this.backtrack(l);return}}if(E){const{startPTS:T,endPTS:y,startDTS:v,endDTS:A}=E;c&&(c.elementaryStreams[ie.AUDIO]={startPTS:T,endPTS:y,startDTS:v,endDTS:A}),l.setElementaryStreamInfo(ie.AUDIO,T,y,v,A),this.bufferFragmentData(E,l,c,n)}if(m&&g!=null&&(t=g.samples)!=null&&t.length){const T={id:s,frag:l,details:m,samples:g.samples};i.trigger(p.FRAG_PARSING_METADATA,T)}if(m&&d){const T={id:s,frag:l,details:m,samples:d.samples};i.trigger(p.FRAG_PARSING_USERDATA,T)}}_bufferInitSegment(e,t,s,i){if(this.state!==_.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:r,video:n,audiovideo:o}=t;if(r){let l=e.audioCodec;const c=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5");const h=r.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&c.indexOf("firefox")===-1&&(l="mp4a.40.5")}l&&l.indexOf("mp4a.40.5")!==-1&&c.indexOf("android")!==-1&&r.container!=="audio/mpeg"&&(l="mp4a.40.2",this.log(`Android: force audio codec to ${l}`)),e.audioCodec&&e.audioCodec!==l&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${l}"`),r.levelCodec=l,r.id="main",this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${r.codec}]`)}n&&(n.levelCodec=e.videoCodec,n.id="main",this.log(`Init video buffer, container:${n.container}, codecs[level/parsed]=[${e.videoCodec||""}/${n.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),this.hls.trigger(p.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{const h=t[l].initSegment;h!=null&&h.byteLength&&this.hls.trigger(p.BUFFER_APPENDING,{type:l,data:h,frag:s,part:null,chunkMeta:i,parent:s.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,V.MAIN)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=_.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(ne.isBuffered(e,s)?t=this.getAppendedFrag(s):ne.isBuffered(e,s+.1)&&(t=this.getAppendedFrag(s+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,r=t.level;(!i||t.sn!==i.sn||i.level!==r)&&(this.fragPlaying=t,this.hls.trigger(p.FRAG_CHANGED,{frag:t}),(!i||i.level!==r)&&this.hls.trigger(p.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,s=this.currentFrag;if(s&&N(t)&&N(s.programDateTime)){const i=s.programDateTime+(t-s.start)*1e3;return new Date(i)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class $e{static get version(){return"1.5.13"}static isMSESupported(){return jn()}static isSupported(){return Wh()}static getMediaSource(){return gt()}static get Events(){return p}static get ErrorTypes(){return W}static get ErrorDetails(){return b}static get DefaultConfig(){return $e.defaultConfig?$e.defaultConfig:Wn}static set DefaultConfig(e){$e.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Si,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,Ba(e.debug||!1,"Hls instance");const t=this.config=$h($e.DefaultConfig,e);this.userConfig=e,t.progressive&&Kh(t);const{abrController:s,bufferController:i,capLevelController:r,errorController:n,fpsController:o}=t,l=new n(this),c=this.abrController=new s(this),h=this.bufferController=new i(this),u=this.capLevelController=new r(this),d=new o(this),g=new Fo(this),f=new Bo(this),m=t.contentSteeringController,E=m?new m(this):null,T=this.levelController=new Vh(this,E),y=new gl(this),v=new Hh(this.config),A=this.streamController=new Jh(this,y,v);u.setStreamController(A),d.setStreamController(A);const x=[g,T,A];E&&x.splice(1,0,E),this.networkControllers=x;const D=[c,h,u,d,f,y];this.audioTrackController=this.createController(t.audioTrackController,x);const R=t.audioStreamController;R&&x.push(new R(this,y,v)),this.subtitleTrackController=this.createController(t.subtitleTrackController,x);const C=t.subtitleStreamController;C&&x.push(new C(this,y,v)),this.createController(t.timelineController,D),v.emeController=this.emeController=this.createController(t.emeController,D),this.cmcdController=this.createController(t.cmcdController,D),this.latencyController=this.createController(Go,D),this.coreComponents=D,x.push(l);const k=l.onErrorOut;typeof k=="function"&&this.on(p.ERROR,k,l)}createController(e,t){if(e){const s=new e(this);return t&&t.push(s),s}return null}on(e,t,s=this){this._emitter.on(e,t,s)}once(e,t,s=this){this._emitter.once(e,t,s)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,s=this,i){this._emitter.off(e,t,s,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,s){return this._emitter.emit(e,t,s)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(s){if(S.error("An internal error happened while handling event "+e+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const i=e===p.ERROR;this.trigger(p.ERROR,{type:W.OTHER_ERROR,details:b.INTERNAL_EXCEPTION,fatal:i,event:e,error:s}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){S.log("destroy"),this.trigger(p.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){S.log("attachMedia"),this._media=e,this.trigger(p.MEDIA_ATTACHING,{media:e})}detachMedia(){S.log("detachMedia"),this.trigger(p.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,s=this.url,i=this.url=ci.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,S.log(`loadSource:${i}`),t&&s&&(s!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(p.MANIFEST_LOADING,{url:e})}startLoad(e=-1){S.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){S.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){S.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){S.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){S.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){S.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){S.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){S.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){S.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(S.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){$o(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const s=e.length;for(let i=0;i=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:s}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,s)for(let r=i;r--;){const n=e[r].attrs["HDCP-LEVEL"];if(n&&n<=s)return r}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}$e.defaultConfig=void 0;var Zh=Oe(''),eu=Oe('
          '),tu=Oe(' ',1);function su(a,e){ms(e,!0);let t=se(e,"value",3,null),s=se(e,"subtitles",3,null),i=se(e,"dispatch_blob",3,()=>Promise.resolve()),r=se(e,"interactive",3,!1),n=se(e,"editable",3,!0),o=se(e,"trim_region_settings",19,()=>({})),l=se(e,"mode",15),c=se(e,"handle_reset_value",3,()=>{}),h=se(e,"playback_position",15),u=nt(()=>t()?.url),d=_e(0),g,f,m=_e(!1),E,T=_e(!1),y,v,A,x=_e(0),D=_e(0),R=_e(!1),C,k=!1,I=_e(!0),w=[],B=nt(()=>e.waveform_options.show_recording_waveform&&!t()?.is_stream);Ke(()=>{P(m)&&P(d)!==h()&&P(x)&&(f?.seekTo(h()/P(x)),ge(d,h(),!0))});const F=()=>{f=oa.create({container:g,...e.waveform_settings}),s()&&f&&(P(I)?Z(f,s()):q()),f?.on("init",()=>{ge(m,!0)}),f?.on("decode",$=>{ge(x,$,!0),A&&(A.textContent=Mt($))});let Y=!0;f?.on("timeupdate",$=>{if(v&&(v.textContent=Mt($)),Y){Y=!1;return}h($),ge(d,$,!0)}),f?.on("interaction",()=>{const $=f?.getCurrentTime()||0;v&&(v.textContent=Mt($)),h($),ge(d,$,!0)}),f?.on("ready",()=>{e.waveform_settings.autoplay?f?.play():f?.stop()}),f?.on("finish",()=>{e.loop?f?.play():(ge(T,!1),e.onstop?.())}),f?.on("pause",()=>{ge(T,!1),e.onpause?.()}),f?.on("play",()=>{ge(T,!0),e.onplay?.()}),f?.on("load",()=>{e.onload?.()})};Ke(()=>{P(u)&&P(m)&&Zn(()=>{t()?.url&&f&&f.load(t().url).catch(Y=>{Y.name!=="AbortError"&&console.error("Waveform load error:",Y)})})});const G=async(Y,$)=>{l("");const fe=f?.getDecodedData();if(fe){const oe=await la(fe,Y,$,e.waveform_settings.sampleRate);await i()([oe],"change")}e.onedit?.()};async function H(Y){k=!1,e.waveform_options.show_recording_waveform?f?.load(Y):C&&(C.src=Y)}Ke(()=>{s()&&f&&(P(I)?Z(f,s()):q())});function U(Y){if(!(!Y||!Y.is_stream||!Y.url))if($e.isSupported()&&!k){const $=new $e({maxBufferLength:1,maxMaxBufferLength:1,lowLatencyMode:!0});$.loadSource(Y.url),$.attachMedia(C),$.on($e.Events.MANIFEST_PARSED,function(){e.waveform_settings.autoplay&&C.play()}),$.on($e.Events.ERROR,function(fe,oe){if(console.error("HLS error:",fe,oe),oe.fatal)switch(oe.type){case $e.ErrorTypes.NETWORK_ERROR:console.error("Fatal network error encountered, trying to recover"),$.startLoad();break;case $e.ErrorTypes.MEDIA_ERROR:console.error("Fatal media error encountered, trying to recover"),$.recoverMediaError();break;default:console.error("Fatal error, cannot recover"),$.destroy();break}}),k=!0}else k||(C.src=Y.url,e.waveform_settings.autoplay&&C.play(),k=!0)}Ke(()=>{C&&P(u)&&P(m)&&P(u)&&H(P(u))}),Ke(()=>{C&&t()?.is_stream&&U(t())}),oi(()=>{F();const Y=$=>{!f||P(R)||!(E&&E.contains(document.activeElement))||($.key==="ArrowRight"&&l()!=="edit"?Ii(f,.1):$.key==="ArrowLeft"&&l()!=="edit"&&Ii(f,-.1))};return window.addEventListener("keydown",Y),()=>{f?.destroy(),window.removeEventListener("keydown",Y)}});async function Z(Y,$){O();try{let fe;if(Array.isArray($))fe=$;else{const be=await(await fetch($)).text();fe=M(be)}if(fe.length>0){let oe="";if(y){y.style.display="";const be=Me=>{const Ne=fe.find(et=>Me>=et.start&&Me<=et.end);Ne&&Ne.text!==oe?(oe=Ne.text,y.textContent=oe):!Ne&&oe!==""&&(oe="",y.textContent="")};Y.on("audioprocess",be),w.push(()=>{Y.un("audioprocess",be)})}}}catch{}}function q(){y&&(y.style.display="none")}function O(){y&&(y.textContent=""),w.forEach(Y=>Y()),w=[]}function M(Y){const $=Y.split(` +`),fe=[];for(let oe=0;oe<$.length;oe++){const be=$[oe].trim();if(be.includes(" --> ")){const[Me,Ne]=be.split(" --> "),et=ee(Me),z=ee(Ne);let J="";for(let he=oe+1;he<$.length&&$[he].trim()!=="";he++)J&&(J+=" "),J+=$[he].trim();J&&fe.push({start:et,end:z,text:J})}}return fe}function ee(Y){const $=Y.split(":");if($.length===3){const fe=parseInt($[0]),oe=parseInt($[1]),be=parseFloat($[2]);return fe*3600+oe*60+be}return 0}var j=tu(),X=lt(j);let ae;ht(X,Y=>C=Y,()=>C);var re=ve(X,2);{var de=Y=>{Or(Y,{size:"small",children:($,fe)=>{Hs($)},$$slots:{default:!0}})},Re=Y=>{var $=Fr(),fe=lt($);{var oe=be=>{var Me=eu(),Ne=Te(Me),et=Te(Ne);let z;ht(et,ue=>g=ue,()=>g),ye(Ne);var J=ve(Ne,2),he=Te(J);ht(he,ue=>v=ue,()=>v);var Ue=ve(he,2),Ot=Te(Ue);{var ys=ue=>{var Pe=Zh(),zn=Te(Pe,!0);ye(Pe),xt(qn=>Pr(zn,qn),[()=>Mt(P(D))]),Se(ue,Pe)};Fe(Ot,ue=>{l()==="edit"&&P(D)>0&&ue(ys)})}var vs=ve(Ot,2);ht(vs,ue=>A=ue,()=>A),ye(Ue),ye(J);var ke=ve(J,2);ht(ke,ue=>y=ue,()=>y);var De=ve(ke,2);{let ue=nt(()=>s()!==null);_a(De,{get container(){return g},get waveform(){return f},get playing(){return P(T)},get audio_duration(){return P(x)},get i18n(){return e.i18n},get interactive(){return r()},handle_trim_audio:G,get show_redo(){return r()},get handle_reset_value(){return c()},get waveform_options(){return e.waveform_options},get trim_region_settings(){return o()},get editable(){return n()},get show_subtitles(){return P(ue)},get mode(){return l()},set mode(Pe){l(Pe)},get trimDuration(){return P(D)},set trimDuration(Pe){ge(D,Pe,!0)},get show_volume_slider(){return P(R)},set show_volume_slider(Pe){ge(R,Pe,!0)},get subtitles_toggle(){return P(I)},set subtitles_toggle(Pe){ge(I,Pe,!0)}})}ye(Me),ht(Me,ue=>E=ue,()=>E),xt(()=>{Ct(Me,"data-testid",e.label?"waveform-"+e.label:"unlabelled-audio"),z=Vs(et,"",z,{height:g?null:"58px"})}),Se(be,Me)};Fe(fe,be=>{P(B)&&be(oe)},!0)}Se(Y,$)};Fe(re,Y=>{t()===null?Y(de):Y(Re,!1)})}xt(()=>{ae=wr(X,1,"standard-player svelte-1ffmt2w",null,ae,{hidden:P(B)}),X.autoplay=e.waveform_settings.autoplay}),xs("load",X,function(...Y){e.onload?.apply(this,Y)}),xs("ended",X,()=>e.onstop?.()),xs("play",X,()=>e.onplay?.()),Se(a,j),ps()}var iu=Oe(" ",1),ru=Oe(" ",1),nu=Oe(" ",1);function au(a,e){ms(e,!0);let t=se(e,"value",3,null),s=se(e,"subtitles",3,null),i=se(e,"show_label",3,!0),r=se(e,"buttons",19,()=>[]),n=se(e,"on_custom_button_click",3,null),o=se(e,"waveform_settings",19,()=>({})),l=se(e,"waveform_options",19,()=>({show_recording_waveform:!0})),c=se(e,"editable",3,!0),h=se(e,"display_icon_button_wrapper_top_corner",3,!1),u=se(e,"minimal",3,!1),d=se(e,"playback_position",15);Ke(()=>{t()&&e.onchange?.(t())});var g=nu(),f=lt(g);{let y=nt(()=>e.label||e.i18n("audio.audio"));sa(f,{get show_label(){return i()},get Icon(){return Hs},float:!1,get label(){return P(y)}})}var m=ve(f,2);{var E=y=>{var v=Fr(),A=lt(v);{var x=R=>{{let C=nt(()=>e.label||e.i18n("audio.audio"));ca(R,{get value(){return t()},get label(){return P(C)},get loop(){return e.loop}})}},D=R=>{var C=ru(),k=lt(C);aa(k,{get display_top_corner(){return h()},get buttons(){return r()},get on_custom_button_click(){return n()},children:(w,B)=>{var F=iu(),G=lt(F);{var H=q=>{{let O=nt(()=>t().is_stream?t().url?.replace("playlist.m3u8","playlist-file"):t().url),M=nt(()=>t().orig_name||t().path);ia(q,{get href(){return P(O)},get download(){return P(M)},children:(ee,j)=>{{let X=nt(()=>e.i18n("common.download"));ta(ee,{get Icon(){return na},get label(){return P(X)}})}},$$slots:{default:!0}})}};Fe(G,q=>{r().some(O=>typeof O=="string"&&O==="download")&&q(H)})}var U=ve(G,2);{var Z=q=>{ra(q,{get i18n(){return e.i18n},get onerror(){return e.onerror},get onshare(){return e.onshare},formatter:async O=>!O||!O.url?"":``,get value(){return t()}})};Fe(U,q=>{r().some(O=>typeof O=="string"&&O==="share")&&q(Z)})}Se(w,F)},$$slots:{default:!0}});var I=ve(k,2);{let w=nt(()=>Array.isArray(s())?s():s()?.url);su(I,{get value(){return t()},get subtitles(){return P(w)},get label(){return e.label},get i18n(){return e.i18n},get waveform_settings(){return o()},get waveform_options(){return l()},get editable(){return c()},get loop(){return e.loop},get onpause(){return e.onpause},get onplay(){return e.onplay},get onstop(){return e.onstop},onload:()=>{},get playback_position(){return d()},set playback_position(B){d(B)}})}Se(R,C)};Fe(A,R=>{u()?R(x):R(D,!1)})}Se(y,v)},T=y=>{Or(y,{size:"small",children:(v,A)=>{Hs(v)},$$slots:{default:!0}})};Fe(m,y=>{t()!==null?y(E):y(T,!1)})}Se(a,g),ps()}const Au=Object.freeze(Object.defineProperty({__proto__:null,default:au},Symbol.toStringTag,{value:"Module"}));export{su as A,au as S,_a as W,Au as a}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StaticAudio-aRR9yp0X.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StaticAudio-aRR9yp0X.css new file mode 100644 index 0000000000000000000000000000000000000000..52e8a7118f4a89bca8e2ce5adc0e9beea96f7ddb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StaticAudio-aRR9yp0X.css @@ -0,0 +1 @@ +.volume-slider.svelte-c0ird4{-webkit-appearance:none;appearance:none;width:var(--size-20);accent-color:var(--color-accent);height:4px;cursor:pointer;outline:none;border-radius:15px;background-color:var(--neutral-400)}input[type=range].svelte-c0ird4::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;height:15px;width:15px;background-color:var(--color-accent);border-radius:50%;border:none;transition:.2s ease-in-out}input[type=range].svelte-c0ird4::-moz-range-thumb{height:15px;width:15px;background-color:var(--color-accent);border-radius:50%;border:none;transition:.2s ease-in-out}.settings-wrapper.svelte-72dh9g{display:flex;justify-self:self-end;align-items:center;grid-area:editing}.text-button.svelte-72dh9g{border:1px solid var(--neutral-400);border-radius:var(--radius-sm);font-weight:300;font-size:var(--size-3);text-align:center;color:var(--neutral-400);height:var(--size-5);font-weight:700;padding:0 5px;margin-left:5px}.text-button.svelte-72dh9g:hover,.text-button.svelte-72dh9g:focus{color:var(--color-accent);border-color:var(--color-accent)}.controls.svelte-72dh9g{display:grid;grid-template-columns:1fr 1fr 1fr;grid-template-areas:"controls playback editing";margin-top:5px;align-items:center;position:relative;flex-wrap:wrap;justify-content:space-between}.controls.svelte-72dh9g div:where(.svelte-72dh9g){margin:var(--size-1) 0}@media(max-width:600px){.controls.svelte-72dh9g{grid-template-columns:1fr 1fr;grid-template-rows:auto auto;grid-template-areas:"playback playback" "controls editing"}}@media(max-width:319px){.controls.svelte-72dh9g{overflow-x:scroll}}.hidden.svelte-72dh9g{display:none}.control-wrapper.svelte-72dh9g{display:flex;justify-self:self-start;align-items:center;justify-content:space-between;grid-area:controls}.action.svelte-72dh9g{width:var(--size-5);color:var(--neutral-400);margin-left:var(--spacing-md)}.icon.svelte-72dh9g:hover,.icon.svelte-72dh9g:focus{color:var(--color-accent)}.play-pause-wrapper.svelte-72dh9g{display:flex;justify-self:center;grid-area:playback}.cc-button.svelte-72dh9g{width:var(--size-8)}@media(max-width:600px){.play-pause-wrapper.svelte-72dh9g{margin:var(--spacing-md)}}.playback.svelte-72dh9g{border:1px solid var(--neutral-400);border-radius:var(--radius-sm);width:5.5ch;font-weight:300;font-size:var(--size-3);text-align:center;color:var(--neutral-400);height:var(--size-5);font-weight:700}.playback.svelte-72dh9g:hover,.playback.svelte-72dh9g:focus{color:var(--color-accent);border-color:var(--color-accent)}.rewind.svelte-72dh9g,.skip.svelte-72dh9g{margin:0 10px;color:var(--neutral-400)}.play-pause-button.svelte-72dh9g{width:var(--size-8);display:flex;align-items:center;justify-content:center;color:var(--neutral-400);fill:var(--neutral-400)}.volume.svelte-72dh9g{position:relative;display:flex;justify-content:center;margin-right:var(--spacing-xl);width:var(--size-5)}.component-wrapper.svelte-1ffmt2w{padding:var(--size-3);width:100%}::part(wrapper){margin-bottom:var(--size-2)}.timestamps.svelte-1ffmt2w{display:flex;justify-content:space-between;align-items:center;width:100%;padding:var(--size-1) 0}#time.svelte-1ffmt2w,#duration.svelte-1ffmt2w{color:var(--neutral-400)}#trim-duration.svelte-1ffmt2w{color:var(--color-accent);margin-right:var(--spacing-sm)}.waveform-container.svelte-1ffmt2w{display:flex;align-items:center;justify-content:center;width:var(--size-full)}#waveform.svelte-1ffmt2w{width:100%;height:100%;position:relative}.standard-player.svelte-1ffmt2w{width:100%;padding:var(--size-2)}.subtitle-display.svelte-1ffmt2w{color:var(--text-secondary);font-size:var(--text-lg);text-align:center;max-width:600px;line-height:1.3;min-height:var(--size-4);font-family:var(--font-sans);font-weight:400;margin:var(--size-2) auto;padding:var(--size-1) var(--size-2);border-radius:2px;transition:opacity .2s ease-in-out}.hidden.svelte-1ffmt2w,.subtitle-display.svelte-1ffmt2w:empty{display:none} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StreamingBar-CMuqaV2j.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StreamingBar-CMuqaV2j.css new file mode 100644 index 0000000000000000000000000000000000000000..e8f8606b06d3d195d725435e4e85c478dfd8e186 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StreamingBar-CMuqaV2j.css @@ -0,0 +1 @@ +svg.svelte-1vhirvf{width:var(--size-20);height:var(--size-20)}svg.svelte-1vhirvf path:where(.svelte-1vhirvf){fill:var(--loader-color)}div.svelte-1vhirvf{z-index:var(--layer-2)}.margin.svelte-1vhirvf{margin:var(--size-4)}.wrap.svelte-1uj8rng{display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:var(--layer-3);transition:opacity .1s ease-in-out;border-radius:var(--block-radius);background:var(--block-background-fill);padding:0 var(--size-6);overflow:hidden}.no-click.svelte-1uj8rng{pointer-events:none}.wrap.center.svelte-1uj8rng{top:0;right:0;left:0}.wrap.default.svelte-1uj8rng{inset:0}.hide.svelte-1uj8rng{opacity:0;pointer-events:none}.generating.svelte-1uj8rng{animation:svelte-1uj8rng-pulseStart 1s cubic-bezier(.4,0,.6,1),svelte-1uj8rng-pulse 2s cubic-bezier(.4,0,.6,1) 1s infinite;border:2px solid var(--color-accent);background:transparent;z-index:var(--layer-1);pointer-events:none}.translucent.svelte-1uj8rng{background:none}@keyframes svelte-1uj8rng-pulseStart{0%{opacity:0}to{opacity:1}}@keyframes svelte-1uj8rng-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-1uj8rng{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-1uj8rng{position:absolute;inset:0;transform-origin:left;opacity:.8;z-index:var(--layer-1);transition:10ms;background:var(--background-fill-secondary)}.progress-bar-wrap.svelte-1uj8rng{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-1uj8rng{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-1uj8rng{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-1uj8rng{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-1uj8rng{position:absolute;bottom:0;right:0;z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text-center.svelte-1uj8rng{display:flex;position:absolute;top:0;right:0;justify-content:center;align-items:center;transform:translateY(var(--size-6));z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono);text-align:center}.error.svelte-1uj8rng{box-shadow:var(--shadow-drop);border:solid 1px var(--error-border-color);border-radius:var(--radius-full);background:var(--error-background-fill);padding-right:var(--size-4);padding-left:var(--size-4);color:var(--error-text-color);font-weight:var(--weight-semibold);font-size:var(--text-lg);line-height:var(--line-lg);font-family:var(--font)}.validation-error.svelte-1uj8rng{pointer-events:auto;color:var(--error-text-color);font-weight:var(--weight-semibold);font-size:var(--text-lg);line-height:var(--line-lg);font-family:var(--font);position:absolute;background:var(--error-background-fill);top:0;right:0;z-index:var(--layer-3);padding:var(--size-1) var(--size-2);font-size:var(--text-md);text-align:center;border-bottom-left-radius:var(--radius-sm);border-bottom:1px solid var(--error-border-color);border-left:1px solid var(--error-border-color);display:flex;justify-content:space-between;align-items:center;gap:var(--spacing-xl)}.minimal.svelte-1uj8rng{pointer-events:none}.minimal.svelte-1uj8rng .progress-text:where(.svelte-1uj8rng){background:var(--block-background-fill)}.border.svelte-1uj8rng{border:1px solid var(--border-color-primary)}.clear-status.svelte-1uj8rng{position:absolute;display:flex;top:var(--size-2);right:var(--size-2);justify-content:flex-end;gap:var(--spacing-sm);z-index:var(--layer-1)}.cache-indicator.svelte-1uj8rng{position:absolute;bottom:0;right:0;z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono);pointer-events:none;background:var(--block-background-fill);opacity:1;transition:opacity .5s ease-out}.cache-indicator.fade-out.svelte-1uj8rng{opacity:0}.toast-body.svelte-irmu64{display:flex;flex-direction:column;position:relative;right:0;left:0;margin:auto;border-radius:var(--radius-sm);overflow:hidden;pointer-events:auto;background:var(--background-fill-secondary);border:1px solid var(--border-color-primary);box-shadow:var(--shadow-drop);touch-action:pan-y;user-select:none}.dark .toast-body.svelte-irmu64{background:var(--background-fill-primary)}.toast-body.error.svelte-irmu64{--toast-color: var(--color-red-700)}.toast-body.warning.svelte-irmu64{--toast-color: var(--color-yellow-700)}.toast-body.info.svelte-irmu64{--toast-color: var(--color-grey-700)}.toast-body.success.svelte-irmu64{--toast-color: var(--color-green-700)}.dark .toast-body.error.svelte-irmu64{--toast-color: var(--color-red-500)}.dark .toast-body.warning.svelte-irmu64{--toast-color: var(--color-yellow-500)}.dark .toast-body.info.svelte-irmu64{--toast-color: var(--color-grey-500)}.dark .toast-body.success.svelte-irmu64{--toast-color: var(--color-green-500)}.toast-header.svelte-irmu64{display:flex;align-items:center;padding:var(--size-3) var(--size-3);cursor:pointer}.toast-header.svelte-irmu64:hover{opacity:.9}.toast-title-row.svelte-irmu64{flex:1;display:flex;align-items:center;gap:var(--size-2)}.chevron.svelte-irmu64{display:flex;align-items:center;width:var(--size-4);height:var(--size-4);transition:transform .2s ease;opacity:.6}.chevron.visible.svelte-irmu64{opacity:1}.chevron.expanded.svelte-irmu64{transform:rotate(180deg)}.toast-title.svelte-irmu64{display:flex;align-items:center;font-weight:var(--weight-bold);font-size:var(--text-lg);line-height:var(--line-sm)}.toast-count.svelte-irmu64{margin-left:var(--size-1);font-weight:var(--weight-semibold)}.toast-close.svelte-irmu64{margin:0 var(--size-1);border-radius:var(--radius-lg);padding:var(--size-1);font-size:var(--text-xl);line-height:1;background:transparent;border:none;cursor:pointer;transition:all .2s ease;display:flex;align-items:center;justify-content:center;width:var(--size-7);height:var(--size-7);opacity:.6;flex-shrink:0}.toast-close.svelte-irmu64:hover{opacity:1;transform:scale(1.1)}.toast-close.svelte-irmu64:active{transform:scale(.95)}.toast-close.svelte-irmu64{color:var(--body-text-color)}.toast-icon.svelte-irmu64{display:flex;position:relative;flex-shrink:0;justify-content:center;align-items:center;margin-right:var(--size-2);border-radius:var(--radius-full);padding:var(--size-1-5);width:var(--size-8);height:var(--size-8)}.toast-icon.svelte-irmu64{color:var(--toast-color)}.toast-messages.svelte-irmu64{display:flex;flex-direction:column;gap:var(--size-2);padding:0 var(--size-3) var(--size-2) var(--size-3)}.toast-message-item.svelte-irmu64{padding:var(--size-1-5) var(--size-1-5) var(--size-1-5) var(--size-1-5);border-radius:var(--radius-lg)}.toast-separator.svelte-irmu64{height:1px;background:var(--border-color-primary);margin:0}.toast-message-text.svelte-irmu64{font-size:var(--text-md);line-height:1.5;word-wrap:break-word;overflow-wrap:break-word;word-break:break-word;color:var(--body-text-color)}.toast-message-text.svelte-irmu64 a{text-decoration:underline}@keyframes svelte-irmu64-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.timer.svelte-irmu64{position:absolute;bottom:0;left:0;transform-origin:0 0;animation:svelte-irmu64-countdown 10s linear forwards;width:100%;height:var(--size-1)}.timer.svelte-irmu64{background:var(--toast-color)}@media(max-width:640px){.toast-header.svelte-irmu64{padding:var(--size-2) var(--size-2)}.toast-messages.svelte-irmu64{gap:var(--size-1);padding:0 var(--size-2) var(--size-1-5) var(--size-2)}.toast-message-item.svelte-irmu64{padding:0 var(--size-1) var(--size-1) var(--size-1)}}.toast-wrap.svelte-1qhecvt{--toast-top: var(--size-4);display:flex;position:fixed;top:calc(var(--toast-top) + var(--size-3));flex-direction:column;gap:var(--size-2);z-index:var(--layer-top);right:var(--size-3);left:var(--size-3);align-items:end;max-width:none}.toast-item.svelte-1qhecvt{width:100%}@media(min-width:640px){.toast-wrap.svelte-1qhecvt{left:auto;width:calc(var(--size-96) + var(--size-10))}}.streaming-bar.svelte-1au5sp1{position:absolute;bottom:0;left:0;right:0;height:4px;background-color:var(--primary-600);animation:svelte-1au5sp1-countdown linear forwards;z-index:1}@keyframes svelte-1au5sp1-countdown{0%{transform:translate(0)}to{transform:translate(-100%)}} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StreamingBar-Cb4g-rUI.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StreamingBar-Cb4g-rUI.js new file mode 100644 index 0000000000000000000000000000000000000000..65d0ea5c9a45493b373df48cefd05049c9b3c7aa --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StreamingBar-Cb4g-rUI.js @@ -0,0 +1 @@ +import{i as l,f as n}from"./i18n-Dnhn5Rxr.js";import{a6 as v,S as _,a as m,t as d,W as c}from"./index-DWyDLubb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";var p=c('
          ');function b(s,t){var i=v(),o=_(i);{var f=a=>{var e=p();let r;d(()=>r=n(e,"",r,{"animation-duration":`${t.time_limit??""}s`})),m(a,e)};l(o,a=>{t.time_limit&&a(f)})}m(s,i)}export{b as S}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js new file mode 100644 index 0000000000000000000000000000000000000000..51143e7ab8ffeaac7260b1b42c378a251ebaf108 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js @@ -0,0 +1,3 @@ +import{p as _t,i as L,d as St,b as N,f as ht,k as Lt}from"./i18n-Dnhn5Rxr.js";import{b as Nt,aW as jt,E as $t,aX as It,aY as Ot,A as Rt,z as Bt,aZ as Wt,a_ as Ut,a$ as Dt,ac as yt,b0 as Ht,O as Pt,b1 as P,a as y,f as Y,D as Xt,b2 as Yt,aj as Vt,R as qt,y as Gt,w as u,X as O,t as K,a0 as pt,T as Kt,u as Z,a5 as X,x as W,V as A,a6 as nt,S as J,W as U,Y as C}from"./index-DWyDLubb.js";import{h as Zt}from"./html-Ih_5QVTo.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{A as Jt}from"./index-B_pwUImq.js";const Qt=()=>performance.now(),F={tick:e=>requestAnimationFrame(e),now:()=>Qt(),tasks:new Set};function kt(){const e=F.now();F.tasks.forEach(t=>{t.c(e)||(F.tasks.delete(t),t.f())}),F.tasks.size!==0&&F.tick(kt)}function te(e){let t;return F.tasks.size===0&&F.tick(kt),{promise:new Promise(r=>{F.tasks.add(t={c:e,f:r})}),abort(){F.tasks.delete(t)}}}function Q(e,t){yt(()=>{e.dispatchEvent(new CustomEvent(t))})}function ee(e){if(e==="float")return"cssFloat";if(e==="offset")return"cssOffset";if(e.startsWith("--"))return e;const t=e.split("-");return t.length===1?t[0]:t[0]+t.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function mt(e){const t={},r=e.split(";");for(const o of r){const[n,i]=o.split(":");if(!n||i===void 0)break;const v=ee(n.trim());t[v]=i.trim()}return t}const ae=e=>e;function st(e,t,r,o){var n=(e&Ut)!==0,i=(e&Dt)!==0,v=n&&i,f=(e&Wt)!==0,x=v?"both":n?"in":"out",l,s=t.inert,b=t.style.overflow,m,h;function k(){return yt(()=>l??=r()(t,o?.()??{},{direction:x}))}var c={is_global:f,in(){if(t.inert=s,!n){h?.abort(),h?.reset?.();return}i||m?.abort(),Q(t,"introstart"),m=dt(t,k(),h,1,()=>{Q(t,"introend"),m?.abort(),m=l=void 0,t.style.overflow=b})},out(j){if(!i){j?.(),l=void 0;return}t.inert=!0,Q(t,"outrostart"),h=dt(t,k(),m,0,()=>{Q(t,"outroend"),j?.()})},stop:()=>{m?.abort(),h?.abort()}},p=Nt;if((p.nodes.t??=[]).push(c),n&&jt){var d=f;if(!d){for(var g=p.parent;g&&(g.f&$t)!==0;)for(;(g=g.parent)&&(g.f&It)===0;);d=!g||(g.f&Ot)!==0}d&&Rt(()=>{Bt(()=>c.in())})}}function dt(e,t,r,o,n){var i=o===1;if(Ht(t)){var v,f=!1;return Pt(()=>{if(!f){var p=t({direction:i?"in":"out"});v=dt(e,p,r,o,n)}}),{abort:()=>{f=!0,v?.abort()},deactivate:()=>v.deactivate(),reset:()=>v.reset(),t:()=>v.t()}}if(r?.deactivate(),!t?.duration)return n(),{abort:P,deactivate:P,reset:P,t:()=>o};const{delay:x=0,css:l,tick:s,easing:b=ae}=t;var m=[];if(i&&r===void 0&&(s&&s(0,1),l)){var h=mt(l(0,1));m.push(h,h)}var k=()=>1-o,c=e.animate(m,{duration:x,fill:"forwards"});return c.onfinish=()=>{c.cancel();var p=r?.t()??1-o;r?.abort();var d=o-p,g=t.duration*Math.abs(d),j=[];if(g>0){var w=!1;if(l)for(var E=Math.ceil(g/16.666666666666668),z=0;z<=E;z+=1){var V=p+d*b(z/E),q=mt(l(V,1-V));j.push(q),w||=q.overflow==="hidden"}w&&(e.style.overflow="hidden"),k=()=>{var R=c.currentTime;return p+d*b(R/g)},s&&te(()=>{if(c.playState!=="running")return!1;var R=k();return s(R,1-R),!0})}c=e.animate(j,{duration:g,fill:"forwards"}),c.onfinish=()=>{k=()=>o,s?.(o,1-o),n()}},{abort:()=>{c&&(c.cancel(),c.effect=null,c.onfinish=P)},deactivate:()=>{n=P},reset:()=>{o===0&&s?.(1,0)},t:()=>k()}}var re=Y('');function oe(e){var t=re();y(e,t)}var ie=Y('');function ne(e){var t=ie();y(e,t)}var se=Y('');function ce(e){var t=se();y(e,t)}var de=Y('');function le(e){var t=de();y(e,t)}var ue=Y('');function ve(e){var t=ue();y(e,t)}const fe=(e,t=location.href)=>{try{return!!e&&new URL(e).origin!==new URL(t).origin}catch{return!1}};function _e(e){const t=new Jt,r=new DOMParser().parseFromString(e,"text/html");return bt(r.body,"A",o=>{o instanceof HTMLElement&&"target"in o&&fe(o.getAttribute("href"),location.href)&&(o.setAttribute("target","_blank"),o.setAttribute("rel","noopener noreferrer"))}),t.sanitize(r).body.innerHTML}function bt(e,t,r){e&&(e.nodeName===t||typeof t=="function")&&r(e);const o=e?.childNodes||[];for(let n=0;ne;function xt(e){const t=e-1;return t*t*t+1}function gt(e){const t=typeof e=="string"&&e.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return t?[parseFloat(t[1]),t[2]||"px"]:[e,"px"]}function wt(e,{delay:t=0,duration:r=400,easing:o=he}={}){const n=+getComputedStyle(e).opacity;return{delay:t,duration:r,easing:o,css:i=>`opacity: ${i*n}`}}function Fe(e,{delay:t=0,duration:r=400,easing:o=xt,x:n=0,y:i=0,opacity:v=0}={}){const f=getComputedStyle(e),x=+f.opacity,l=f.transform==="none"?"":f.transform,s=x*(1-v),[b,m]=gt(n),[h,k]=gt(i);return{delay:t,duration:r,easing:o,css:(c,p)=>` + transform: ${l} translate(${(1-c)*b}${m}, ${(1-c)*h}${k}); + opacity: ${x-s*p}`}}var ct=!1;function pe(e,{delay:t=0,duration:r=400,easing:o=xt,axis:n="y"}={}){const i=getComputedStyle(e);Xt&&!ct&&/(contents|inline|table)/.test(i.display)&&(ct=!0,Promise.resolve().then(()=>ct=!1),Yt(i.display));const v=+i.opacity,f=n==="y"?"height":"width",x=parseFloat(i[f]),l=n==="y"?["top","bottom"]:["left","right"],s=l.map(d=>`${d[0].toUpperCase()}${d.slice(1)}`),b=parseFloat(i[`padding${s[0]}`]),m=parseFloat(i[`padding${s[1]}`]),h=parseFloat(i[`margin${s[0]}`]),k=parseFloat(i[`margin${s[1]}`]),c=parseFloat(i[`border${s[0]}Width`]),p=parseFloat(i[`border${s[1]}Width`]);return{delay:t,duration:r,easing:o,css:d=>`overflow: hidden;opacity: ${Math.min(d*20,1)*v};${f}: ${d*x}px;padding-${l[0]}: ${d*b}px;padding-${l[1]}: ${d*m}px;margin-${l[0]}: ${d*h}px;margin-${l[1]}: ${d*k}px;border-${l[0]}-width: ${d*c}px;border-${l[1]}-width: ${d*p}px;min-${f}: 0`}}var me=U(' '),ge=U('
          '),we=U('
          ',1),ye=U('
          '),ke=U("
          "),be=U('
          ');function Ee(e,t){qt(t,!0);let r=_t(t,"messages",19,()=>[]),o=_t(t,"expanded",3,!0),n=Z(0),i=Z(0),v=Z(0),f=Z(!1),x;const l={error:"An error occurred.",warning:"Warning.",success:"Success.",info:"Info."};let s=X(()=>r().length),b=X(()=>r()[0]),m=X(()=>t.type.charAt(0).toUpperCase()+t.type.slice(1)),h=X(()=>u(b)?.duration!==null),k=X(()=>u(h)?`${u(b).duration}s`:"0s");function c(){t.ontoggle?.()}function p(){r().forEach(a=>{t.onclose?.(a.id)})}function d(a){W(n,a.touches[0].clientX,!0),W(i,a.touches[0].clientY,!0),W(f,!0)}function g(a){if(!u(f))return;const _=a.touches[0].clientX,M=a.touches[0].clientY,$=_-u(n),D=M-u(i);Math.abs($)>Math.abs(D)&&Math.abs($)>10&&(a.preventDefault(),W(v,$))}function j(){u(f)&&(Math.abs(u(v))>100?p():W(v,0),W(f,!1))}Gt(()=>{u(h)&&r().length===1&&setTimeout(p,u(b).duration*1e3)});var w=be();w.__touchstart=d,w.__touchmove=g,w.__touchend=j;var E=A(w);E.__click=c,E.__keydown=a=>{(a.key==="Enter"||a.key===" ")&&c()};var z=A(E),V=A(z);{var q=a=>{ve(a)},R=a=>{var _=nt(),M=J(_);{var $=T=>{ce(T)},D=T=>{var I=nt(),H=J(I);{var at=S=>{le(S)},rt=S=>{var B=nt(),ot=J(B);{var zt=it=>{ne(it)};L(ot,it=>{t.type==="error"&&it(zt)},!0)}y(S,B)};L(H,S=>{t.type==="success"?S(at):S(rt,!1)},!0)}y(T,I)};L(M,T=>{t.type==="info"?T($):T(D,!1)},!0)}y(a,_)};L(V,a=>{t.type==="warning"?a(q):a(R,!1)})}C(z);var tt=O(z,2),G=A(tt),lt=A(G),Ct=O(lt);{var Mt=a=>{var _=me(),M=A(_);C(_),K(()=>pt(M,`(${u(s)??""})`)),y(a,_)};L(Ct,a=>{u(s)>1&&a(Mt)})}C(G);var et=O(G,2);let ut;var Tt=A(et);oe(Tt),C(et),C(tt);var vt=O(tt,2);vt.__click=a=>{a.stopPropagation(),p()},C(E);var ft=O(E,2);{var At=a=>{var _=ye();Lt(_,23,r,M=>M.id,(M,$,D)=>{var T=we(),I=J(T),H=A(I),at=A(H);Zt(at,()=>_e(u($).message||l[t.type])),C(H),C(I);var rt=O(I,2);{var S=B=>{var ot=ge();y(B,ot)};L(rt,B=>{u(D){N(I,1,`toast-message-item ${t.type??""}`,"svelte-irmu64"),N(H,1,`toast-message-text ${t.type??""}`,"svelte-irmu64")}),y(M,T)}),C(_),st(3,_,()=>pe,()=>({duration:200})),y(a,_)};L(ft,a=>{o()&&a(At)})}var Ft=O(ft,2);{var Et=a=>{var _=ke();K(()=>{N(_,1,`timer ${t.type??""}`,"svelte-irmu64"),ht(_,`animation-duration: ${u(k)??""}`)}),y(a,_)};L(Ft,a=>{u(h)&&a(Et)})}C(w),St(w,a=>x=a,()=>x),K(a=>{N(w,1,`toast-body ${t.type??""}`,"svelte-irmu64"),ht(w,`transform: translateX(${u(v)??""}px); opacity: ${a??""};`),N(z,1,`toast-icon ${t.type??""}`,"svelte-irmu64"),N(G,1,`toast-title ${t.type??""}`,"svelte-irmu64"),pt(lt,`${u(m)??""} `),ut=N(et,1,"chevron svelte-irmu64",null,ut,{expanded:o(),visible:u(s)>0}),N(vt,1,`toast-close ${t.type??""}`,"svelte-irmu64")},[()=>1-Math.abs(u(v))/300]),st(1,w,()=>wt,()=>({duration:200,delay:100})),st(2,w,()=>wt,()=>({duration:200})),y(e,w),Kt()}Vt(["touchstart","touchmove","touchend","click","keydown"]);export{Ee as T,Fe as a,wt as f,te as l,F as r,pe as s,st as t}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Textbox-B5AH0EoL.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Textbox-B5AH0EoL.css new file mode 100644 index 0000000000000000000000000000000000000000..0bfbead708cbbae18046d21c4ec9eec2c36f7620 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Textbox-B5AH0EoL.css @@ -0,0 +1 @@ +label.svelte-1hguek3{display:block;width:100%}input[type=text].svelte-1hguek3,input[type=password].svelte-1hguek3,input[type=email].svelte-1hguek3,textarea.svelte-1hguek3{flex-grow:1;margin-top:0;margin-bottom:0;resize:none;z-index:1;display:block;position:relative;outline:none!important;background:var(--input-background-fill);padding:var(--input-padding);width:100%;color:var(--body-text-color);font-weight:var(--input-text-weight);font-size:var(--input-text-size);line-height:var(--line-sm);border:none}textarea.no-label.svelte-1hguek3{padding-top:5px;padding-bottom:5px}label.show_textbox_border.svelte-1hguek3 input:where(.svelte-1hguek3),label.show_textbox_border.svelte-1hguek3 textarea:where(.svelte-1hguek3){box-shadow:var(--input-shadow)}label.svelte-1hguek3:not(.container),label.svelte-1hguek3:not(.container) input:where(.svelte-1hguek3),label.svelte-1hguek3:not(.container) textarea:where(.svelte-1hguek3){height:100%}label.container.show_textbox_border.svelte-1hguek3 input:where(.svelte-1hguek3),label.container.show_textbox_border.svelte-1hguek3 textarea:where(.svelte-1hguek3){border:var(--input-border-width) solid var(--input-border-color);border-radius:var(--input-radius)}input.svelte-1hguek3:disabled,textarea.svelte-1hguek3:disabled{-webkit-opacity:1;opacity:1}label.container.show_textbox_border.svelte-1hguek3 input:where(.svelte-1hguek3):focus,label.container.show_textbox_border.svelte-1hguek3 textarea:where(.svelte-1hguek3):focus{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus);background:var(--input-background-fill-focus)}input.svelte-1hguek3::placeholder,textarea.svelte-1hguek3::placeholder{color:var(--input-placeholder-color)}.input-container.svelte-1hguek3{display:flex;position:relative;align-items:flex-end}.submit-button.svelte-1hguek3,.stop-button.svelte-1hguek3{border:none;text-align:center;text-decoration:none;font-size:14px;cursor:pointer;border-radius:15px;min-width:30px;height:30px;flex-shrink:0;display:flex;justify-content:center;align-items:center;z-index:var(--layer-1)}.stop-button.svelte-1hguek3,.submit-button.svelte-1hguek3{background:var(--button-secondary-background-fill);color:var(--button-secondary-text-color)}.stop-button.svelte-1hguek3:hover,.submit-button.svelte-1hguek3:hover{background:var(--button-secondary-background-fill-hover)}.stop-button.svelte-1hguek3:disabled,.submit-button.svelte-1hguek3:disabled{background:var(--button-secondary-background-fill);cursor:pointer}.stop-button.svelte-1hguek3:active,.submit-button.svelte-1hguek3:active{box-shadow:var(--button-shadow-active)}.submit-button.svelte-1hguek3 svg{height:22px;width:22px}.stop-button.svelte-1hguek3 svg{height:16px;width:16px}.padded-button.svelte-1hguek3{padding:0 10px}div.validation-error.svelte-1hguek3{color:var(--error-icon-color);font-size:var(--font-sans);margin-top:var(--spacing-sm);font-weight:var(--weight-semibold)}label.container.svelte-1hguek3 input.validation-error:where(.svelte-1hguek3),label.container.svelte-1hguek3 textarea.validation-error:where(.svelte-1hguek3){border-color:transparent!important;box-shadow:0 0 3px 1px var(--error-icon-color),var(--shadow-inset)!important} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Textbox-BuFR2fNz.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Textbox-BuFR2fNz.js new file mode 100644 index 0000000000000000000000000000000000000000..efb3b30ab3274cec99c0c52891f755754045eefd --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Textbox-BuFR2fNz.js @@ -0,0 +1 @@ +import{p as u,i as y,b as C,d as U,a as o,f as yt,t as ut}from"./i18n-Dnhn5Rxr.js";import{R as Nt,y as F,x as H,ai as Vt,w as _,S as Y,t as w,a as m,T as Xt,u as D,M as L,X as P,a5 as dt,W as T,aj as Zt,V as A,a0 as $,a6 as tt,a8 as Jt,Y as M,ak as Qt,al as et,A as Ut,Z as h,a7 as wt}from"./index-DWyDLubb.js";import{a as $t}from"./actions-CLThs9VH.js";import{b as at}from"./input-DrerMDOL.js";import{I as te}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as ee}from"./BlockTitle-BMm9LakX.js";import{C as ae}from"./Check-DUAHzS2-.js";import{C as le}from"./Copy-ChCbTvli.js";import{S as oe}from"./Send-B_rl9Hxa.js";import{S as ne}from"./Square-CcB54dqq.js";import{I as ie}from"./IconButtonWrapper-D0s9l4wW.js";var re=T('
          '),se=T(" ",1),ce=T(''),ue=T(''),de=T(''),_e=T(''),fe=T(''),ve=T(''),he=T('');function Ce(Ht,l){Nt(l,!0);let x=u(l,"value",15,""),Tt=u(l,"value_is_output",15,!1),k=u(l,"lines",3,1),K=u(l,"placeholder",3,""),zt=u(l,"info",3,void 0),O=u(l,"disabled",3,!1),lt=u(l,"show_label",3,!0),Ct=u(l,"container",3,!0),ot=u(l,"max_lines",3,void 0),R=u(l,"type",3,"text"),W=u(l,"buttons",3,null),It=u(l,"oncustombuttonclick",3,null),I=u(l,"submit_btn",3,null),B=u(l,"stop_btn",3,null),_t=u(l,"rtl",3,!1),E=u(l,"autofocus",3,!1),j=u(l,"text_align",3,void 0),ft=u(l,"autoscroll",3,!0),q=u(l,"max_length",3,void 0),n=u(l,"html_attributes",3,null),z=u(l,"validation_error",3,void 0),f,G=D(!1),nt,it=D(!1),vt=D(0),N=D(!1),p=D(1);const St=!I();F(()=>{ot()===void 0||ot()===null?R()==="text"?H(p,Math.max(k(),20),!0):H(p,1):H(p,Math.max(ot(),k()),!0)}),F(()=>{x(),z(),f&&k()!==_(p)&&_(p)>1&&Z({target:f})}),F(()=>{x()===null&&x("")}),Vt(()=>{!_(N)&&f&&f.offsetHeight+f.scrollTop>f.scrollHeight-100&&H(it,!0)});const Bt=()=>{_(it)&&ft()&&!_(N)&&f.scrollTo(0,f.scrollHeight)};async function Et(){await L(),l.onchange?.(x())}F(()=>{E()&&f&&f.focus(),_(it)&&ft()&&Bt(),Tt(!1)}),F(()=>{x(),Et()});async function Ft(){if("clipboard"in navigator){try{await navigator.clipboard.writeText(x()),l.oncopy?.({value:x()})}catch(a){console.error("COPYING CLIPBOARD FAILED",a)}Yt()}}function Yt(){H(G,!0),nt&&clearTimeout(nt),nt=setTimeout(()=>{H(G,!1)},1e3)}function V(a){const t=a.target,r=t.value,i=[t.selectionStart,t.selectionEnd];l.onselect?.({value:r.substring(...i),index:i})}async function X(a){a.key==="Enter"&&a.shiftKey&&k()>1?(a.preventDefault(),await L(),l.onsubmit?.()):a.key==="Enter"&&!a.shiftKey&&k()===1&&_(p)>=1&&(a.preventDefault(),await L(),l.onsubmit?.()),await L(),l.oninput?.(x())}function Dt(a){const t=a.target,r=t.scrollTop;r<_(vt)&&H(N,!0),H(vt,r,!0);const i=t.scrollHeight-t.clientHeight;r>=i&&H(N,!1)}function Lt(){l.onstop?.()}function Pt(){l.onsubmit?.()}async function Z(a){if(await L(),k()===_(p))return;const t=a.target,r=window.getComputedStyle(t),i=parseFloat(r.paddingTop),b=parseFloat(r.paddingBottom),v=parseFloat(r.lineHeight);let e=_(p)===void 0?!1:i+b+v*_(p),s=i+b+k()*v;t.style.height="1px";let g;e&&t.scrollHeight>e?g=e:t.scrollHeightr+i?a.style.overflowY="scroll":a.style.overflowY="hidden"}function Mt(a,t){if(!(k()===_(p)||k()===1&&_(p)===1))return a.addEventListener("input",Z),t.trim()&&(a.style.overflowY="scroll",Z({target:a})),{destroy:()=>a.removeEventListener("input",Z)}}var J=he();let ht;var bt=A(J);{var Kt=a=>{ie(a,{get buttons(){return W()},get on_custom_button_click(){return It()},children:(t,r)=>{var i=tt(),b=Y(i);{var v=e=>{{let s=dt(()=>_(G)?ae:le),g=dt(()=>_(G)?"Copied":"Copy");te(e,{get Icon(){return _(s)},onclick:Ft,get label(){return _(g)}})}};y(b,e=>{W().some(s=>typeof s=="string"&&s==="copy")&&e(v)})}m(t,i)},$$slots:{default:!0}})};y(bt,a=>{lt()&&W()&&W().length>0&&a(Kt)})}var mt=P(bt,2);{let a=dt(()=>z()?!0:lt());ee(mt,{get show_label(){return _(a)},get info(){return zt()},children:(t,r)=>{Jt();var i=se(),b=Y(i),v=P(b);{var e=s=>{var g=re(),rt=A(g,!0);M(g),w(()=>$(rt,z())),m(s,g)};y(v,s=>{z()&&s(e)})}w(()=>$(b,`${l.label??""} `)),m(t,i)},$$slots:{default:!0}})}var gt=P(mt,2),xt=A(gt);{var Ot=a=>{var t=tt(),r=Y(t);{var i=v=>{var e=ce();ut(e);let s;et(e,E()),U(e,g=>f=g,()=>f),w(()=>{s=C(e,1,"scroll-hide svelte-1hguek3",null,s,{"validation-error":z()}),o(e,"dir",_t()?"rtl":"ltr"),o(e,"placeholder",K()),e.disabled=O(),o(e,"maxlength",q()),yt(e,j()?"text-align: "+j():""),o(e,"autocapitalize",n()?.autocapitalize),o(e,"autocorrect",n()?.autocorrect),o(e,"spellcheck",n()?.spellcheck),o(e,"autocomplete",n()?.autocomplete),o(e,"tabindex",n()?.tabindex),o(e,"enterkeyhint",n()?.enterkeyhint),o(e,"lang",n()?.lang),e.dir=e.dir}),h("keypress",e,X),h("blur",e,()=>l.onblur?.()),h("select",e,V),h("focus",e,()=>l.onfocus?.()),at(e,x),m(v,e)},b=v=>{var e=tt(),s=Y(e);{var g=S=>{var c=ue();ut(c);let Q;et(c,E()),U(c,st=>f=st,()=>f),w(()=>{Q=C(c,1,"scroll-hide svelte-1hguek3",null,Q,{"validation-error":z()}),o(c,"placeholder",K()),c.disabled=O(),o(c,"maxlength",q()),o(c,"autocapitalize",n()?.autocapitalize),o(c,"autocorrect",n()?.autocorrect),o(c,"spellcheck",n()?.spellcheck),o(c,"tabindex",n()?.tabindex),o(c,"enterkeyhint",n()?.enterkeyhint),o(c,"lang",n()?.lang)}),h("keypress",c,X),h("blur",c,()=>l.onblur?.()),h("select",c,V),h("focus",c,()=>l.onfocus?.()),at(c,x),m(S,c)},rt=S=>{var c=tt(),Q=Y(c);{var st=ct=>{var d=de();ut(d);let kt;et(d,E()),U(d,Gt=>f=Gt,()=>f),w(()=>{kt=C(d,1,"scroll-hide svelte-1hguek3",null,kt,{"validation-error":z()}),o(d,"placeholder",K()),d.disabled=O(),o(d,"maxlength",q()),o(d,"autocapitalize",n()?.autocapitalize),o(d,"autocorrect",n()?.autocorrect),o(d,"spellcheck",n()?.spellcheck),o(d,"tabindex",n()?.tabindex),o(d,"enterkeyhint",n()?.enterkeyhint),o(d,"lang",n()?.lang)}),h("keypress",d,X),h("blur",d,()=>l.onblur?.()),h("select",d,V),h("focus",d,()=>l.onfocus?.()),at(d,x),m(ct,d)};y(Q,ct=>{R()==="email"&&ct(st)},!0)}m(S,c)};y(s,S=>{R()==="password"?S(g):S(rt,!1)},!0)}m(v,e)};y(r,v=>{R()==="text"?v(i):v(b,!1)})}m(a,t)},Rt=a=>{var t=_e();Qt(t),et(t,E());let r;$t(t,(i,b)=>Mt?.(i,b),x),Ut(()=>at(t,x)),U(t,i=>f=i,()=>f),w(()=>{o(t,"dir",_t()?"rtl":"ltr"),o(t,"placeholder",K()),o(t,"rows",k()),t.disabled=O(),o(t,"maxlength",q()),yt(t,j()?"text-align: "+j():""),o(t,"autocapitalize",n()?.autocapitalize),o(t,"autocorrect",n()?.autocorrect),o(t,"spellcheck",n()?.spellcheck),o(t,"autocomplete",n()?.autocomplete),o(t,"tabindex",n()?.tabindex),o(t,"enterkeyhint",n()?.enterkeyhint),o(t,"lang",n()?.lang),r=C(t,1,"svelte-1hguek3",null,r,{"no-label":!lt()&&(I()||B()),"validation-error":z()}),t.dir=t.dir}),h("keypress",t,X),h("blur",t,()=>l.onblur?.()),h("select",t,V),h("focus",t,()=>l.onfocus?.()),h("scroll",t,Dt),m(a,t)};y(xt,a=>{k()===1&&_(p)===1?a(Ot):a(Rt,!1)})}var pt=P(xt,2);{var Wt=a=>{var t=fe();let r;t.__click=Pt;var i=A(t);{var b=e=>{oe(e)},v=e=>{var s=wt();w(()=>$(s,I())),m(e,s)};y(i,e=>{I()===!0?e(b):e(v,!1)})}M(t),w(()=>r=C(t,1,"submit-button svelte-1hguek3",null,r,{"padded-button":I()!==!0})),m(a,t)};y(pt,a=>{I()&&a(Wt)})}var jt=P(pt,2);{var qt=a=>{var t=ve();let r;t.__click=Lt;var i=A(t);{var b=e=>{ne(e,{fill:"none",stroke_width:2.5})},v=e=>{var s=wt();w(()=>$(s,B())),m(e,s)};y(i,e=>{B()===!0?e(b):e(v,!1)})}M(t),w(()=>r=C(t,1,"stop-button svelte-1hguek3",null,r,{"padded-button":B()!==!0})),m(a,t)};y(jt,a=>{B()&&a(qt)})}M(gt),M(J),w(()=>ht=C(J,1,"svelte-1hguek3",null,ht,{container:Ct(),show_textbox_border:St})),m(Ht,J),Xt()}Zt(["click"]);export{Ce as T}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Trash-D2U3jAj_.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Trash-D2U3jAj_.js new file mode 100644 index 0000000000000000000000000000000000000000..ef12d8e39f4dc69047ecafc94dad48af8a808322 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Trash-D2U3jAj_.js @@ -0,0 +1,3 @@ +import"./i18n-Dnhn5Rxr.js";import{a as r,f as a}from"./index-DWyDLubb.js";var h=a(``);function c(t){var e=h();r(t,e)}export{c as T}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Undo-C2-jWGVL.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Undo-C2-jWGVL.js new file mode 100644 index 0000000000000000000000000000000000000000..8970f7aa2b886b957b110b446d034a53bd15e939 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Undo-C2-jWGVL.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as t,f as e}from"./index-DWyDLubb.js";var a=e('');function i(o){var r=a();t(o,r)}export{i as U}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Upload-C2I0h_eD.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Upload-C2I0h_eD.css new file mode 100644 index 0000000000000000000000000000000000000000..9edd0729c8f1c48b08412f79d5e00e47a8b820d4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Upload-C2I0h_eD.css @@ -0,0 +1 @@ +.wrap.svelte-ua961l{overflow-y:auto;transition:opacity .5s ease-in-out;background:var(--block-background-fill);position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:var(--size-40);width:var(--size-full)}.wrap.svelte-ua961l:after{content:"";position:absolute;top:0;left:0;width:var(--upload-progress-width);height:100%;transition:all .5s ease-in-out;z-index:1}.uploading.svelte-ua961l{font-size:var(--text-lg);font-family:var(--font);z-index:2}.file-name.svelte-ua961l{margin:var(--spacing-md);font-size:var(--text-lg);color:var(--body-text-color-subdued)}.file.svelte-ua961l{font-size:var(--text-md);z-index:2;display:flex;align-items:center}.file.svelte-ua961l progress:where(.svelte-ua961l){display:inline;height:var(--size-1);width:100%;transition:all .5s ease-in-out;color:var(--color-accent);border:none}.file.svelte-ua961l progress[value]:where(.svelte-ua961l)::-webkit-progress-value{background-color:var(--color-accent);border-radius:20px}.file.svelte-ua961l progress[value]:where(.svelte-ua961l)::-webkit-progress-bar{background-color:var(--border-color-accent);border-radius:20px}.progress-bar.svelte-ua961l{width:14px;height:14px;border-radius:50%;background:radial-gradient(closest-side,var(--block-background-fill) 64%,transparent 53% 100%),conic-gradient(var(--color-accent) var(--upload-progress-width),var(--border-color-accent) 0);transition:all .5s ease-in-out}button.svelte-8prmba{cursor:pointer;width:var(--size-full)}.center.svelte-8prmba{display:flex;justify-content:center}.flex.svelte-8prmba{display:flex;flex-direction:column;justify-content:center;align-items:center}.hidden.svelte-8prmba{display:none;position:absolute;flex-grow:0}.hidden.svelte-8prmba svg{display:none}.disable_click.svelte-8prmba{cursor:default}.icon-mode.svelte-8prmba{position:absolute!important;width:var(--size-4);height:var(--size-4);padding:0;min-height:0;border-radius:var(--radius-circle)}.icon-mode.svelte-8prmba svg{width:var(--size-4);height:var(--size-4)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Upload-HitvyI7k.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Upload-HitvyI7k.js new file mode 100644 index 0000000000000000000000000000000000000000..ed325f2e0a85625091ec8006e8d33586c29ec261 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Upload-HitvyI7k.js @@ -0,0 +1,2 @@ +import{i as j,b as ee,F as Ee,p as _,a as q,f as ie}from"./i18n-Dnhn5Rxr.js";import{R as oe,u as B,v as Le,aa as Ae,w as v,x as C,ae as ke,y as de,V as L,Y as A,X as se,t as G,a0 as $,a as k,T as ue,a5 as Pe,W as H,a6 as R,S as J,au as We,M as Te,aj as Fe}from"./index-DWyDLubb.js";import{s as le}from"./snippet-BWgYNF9D.js";import{a as Ce}from"./actions-CLThs9VH.js";var ze=H('
          '),De=H('
          ');function Ue(i,e){oe(e,!0);let s,P=B(!1),d=B(void 0),c=Pe(()=>v(d)||v(m)[0]),m=B(Le(e.files.map(u=>({...u,progress:0}))));function T(u,l){C(m,v(m).map(p=>(p.orig_name===u&&(p.progress+=l),p)),!0)}function b(u){return u.progress*100/(u.size||0)||0}Ae(async()=>{if(s=await e.stream_handler(new URL(`${e.root}/gradio_api/upload_progress?upload_id=${e.upload_id}`)),s==null)throw new Error("Event source is not defined");s.onmessage=async function(u){const l=JSON.parse(u.data);v(P)||C(P,!0),l.msg==="done"?(s?.close(),e.ondone?.()):(C(d,l,!0),T(l.orig_name,l.chunk_size))}}),ke(()=>{(s!=null||s!=null)&&s.close()});function w(u){let l=0;return u.forEach(p=>{l+=b(p)}),document.documentElement.style.setProperty("--upload-progress-width",(l/u.length).toFixed(2)+"%"),l/u.length}de(()=>{w(v(m))});var h=De();let n;var x=L(h),z=L(x);A(x);var K=se(x,2);{var Q=u=>{var l=ze(),p=L(l),I=L(p),M=L(I),D=L(M,!0);A(M),A(I),A(p);var U=se(p,2),W=L(U,!0);A(U),A(l),G((N,te)=>{Ee(M,N),$(D,te),$(W,v(c).orig_name)},[()=>b(v(c)),()=>b(v(c))]),k(u,l)};j(K,u=>{v(c)&&u(Q)})}A(h),G(()=>{n=ee(h,1,"wrap svelte-ua961l",null,n,{progress:v(P)}),$(z,`Uploading ${v(m).length??""} + ${v(m).length>1?"files":"file"}...`)}),k(i,h),ue()}function Oe(){let i,e;return{drag(s,P={}){e=P;function d(){i=document.createElement("input"),i.type="file",i.style.display="none",i.setAttribute("aria-label","File upload"),i.setAttribute("data-testid","file-upload");const n=Array.isArray(e.accepted_types)?e.accepted_types.join(","):e.accepted_types||void 0;n&&(i.accept=n),i.multiple=e.mode==="multiple"||!1,e.mode==="directory"&&(i.webkitdirectory=!0,i.setAttribute("directory",""),i.setAttribute("mozdirectory","")),s.appendChild(i)}d();function c(n){n.preventDefault(),n.stopPropagation()}function m(n){n.preventDefault(),n.stopPropagation(),e.on_drag_change?.(!0)}function T(n){n.preventDefault(),n.stopPropagation(),e.on_drag_change?.(!1)}function b(n){if(n.preventDefault(),n.stopPropagation(),e.on_drag_change?.(!1),!n.dataTransfer?.files)return;const x=Array.from(n.dataTransfer.files);x.length>0&&e.on_files?.(x)}function w(){e.disable_click||(i.value="",i.click())}function h(){if(i.files){const n=Array.from(i.files);n.length>0&&e.on_files?.(n)}}return s.addEventListener("drag",c),s.addEventListener("dragstart",c),s.addEventListener("dragend",c),s.addEventListener("dragover",c),s.addEventListener("dragenter",m),s.addEventListener("dragleave",T),s.addEventListener("drop",b),s.addEventListener("click",w),i.addEventListener("change",h),{update(n){e=n,i.remove(),d(),i.addEventListener("change",h)},destroy(){s.removeEventListener("drag",c),s.removeEventListener("dragstart",c),s.removeEventListener("dragend",c),s.removeEventListener("dragover",c),s.removeEventListener("dragenter",m),s.removeEventListener("dragleave",T),s.removeEventListener("drop",b),s.removeEventListener("click",w),i.removeEventListener("change",h),i.remove()}}},open_file_upload(){i&&(i.value="",i.click())}}}var je=H(""),Ie=H('');function Ne(i,e){oe(e,!0);const{drag:s,open_file_upload:P}=Oe();let d=_(e,"filetype",3,null),c=_(e,"dragging",15,!1),m=_(e,"boundedheight",3,!0),T=_(e,"center",3,!0),b=_(e,"flex",3,!0),w=_(e,"file_count",3,"single"),h=_(e,"disable_click",3,!1),n=_(e,"hidden",3,!1),x=_(e,"format",3,"file"),z=_(e,"uploading",15,!1),K=_(e,"show_progress",3,!0),Q=_(e,"max_file_size",3,null),u=_(e,"icon_upload",3,!1),l=_(e,"height",3,void 0),p=_(e,"aria_label",3,void 0),I=_(e,"upload_promise",15);function M(){P()}let D="",U,W=B(null),N=null,V=(()=>{if(typeof navigator<"u"){const t=navigator.userAgent.toLowerCase();return t.indexOf("iphone")>-1||t.indexOf("ipad")>-1}return!1})();const fe=["image","video","audio","text","file"],Z=t=>V&&t.startsWith(".")?(N=!0,t):V&&t.includes("file/*")?"*":t.startsWith(".")||t.endsWith("/*")?t:fe.includes(t)?t+"/*":"."+t;de(()=>{if(d()==null)C(W,null);else if(typeof d()=="string")C(W,Z(d()),!0);else if(V&&d().includes("file/*"))C(W,"*");else{const t=d().map(Z);C(W,t.join(", "),!0)}});function ae(){navigator.clipboard.read().then(async t=>{for(let r=0;ra.startsWith("image/"));if(o){t[r].getType(o).then(async a=>{const g=new File([a],`clipboard.${o.replace("image/","")}`);await X([g])});break}}})}function ce(){P()}async function _e(t,r){return r?D=r:D=Math.random().toString(36).substring(2,15),await Te(),z(!0),I(new Promise(async o=>{try{const a=await e.upload(t,e.root,D,Q()??1/0);e.onload?.(w()==="single"?a?.[0]:a),o(a||[]),z(!1)}catch(a){e.onerror?.(a.message),z(!1),o([])}})),I()}function ge(t,r,o){if(!t||t==="*"||t==="file/*"||Array.isArray(t)&&t.some(g=>g==="*"||g==="file/*"))return!0;let a;if(typeof t=="string")a=t.split(",").map(g=>g.trim());else if(Array.isArray(t))a=t;else return!1;return a.includes(r)||a.some(g=>{const[y]=g.split("/").map(f=>f.trim());return g.endsWith("/*")&&o.startsWith(y+"/")})}async function X(t,r){if(!t.length)return;let o=t.map(a=>new File([a],a instanceof File?a.name:"file",{type:a.type}));return V&&N&&(o=o.filter(a=>re(a)?!0:(e.onerror?.(`Invalid file type: ${a.name}. Only ${d()} allowed.`),!1)),o.length===0)?[]:(U=await We(o),await _e(U,r))}function re(t){return d()?(Array.isArray(d())?d():[d()]).some(o=>{const a=Z(o);if(a.startsWith("."))return t.name.toLowerCase().endsWith(a.toLowerCase());if(a==="*")return!0;if(a.endsWith("/*")){const[g]=a.split("/");return t.type.startsWith(g+"/")}return t.type===a}):!0}async function ve(t){const r=t.filter(o=>{const a="."+o.name.toLowerCase().split(".").pop();return a&&ge(v(W),a,o.type)||(a&&Array.isArray(d())?d().includes(a):a===d())?!0:(e.onerror?.(`Invalid file type only ${d()} allowed.`),!1)});if(x()!="blob")await X(r);else{if(w()==="single"){e.onload?.(r[0]);return}e.onload?.(r)}}async function me(t){if(c(!1),!t.dataTransfer?.files)return;const r=Array.from(t.dataTransfer.files).filter(re);if(x()!="blob")await X(r);else{if(w()==="single"){e.onload?.(r[0]);return}e.onload?.(r)}}var pe={open_upload:M,paste_clipboard:ae,open_file_upload:ce,load_files:X,load_files_from_drop:me},ne=R(),he=J(ne);{var ye=t=>{var r=je();r.__click=ae;let o,a;var g=L(r);{var y=f=>{var F=R(),O=J(F);le(O,()=>e.children),k(f,F)};j(g,f=>{e.children&&f(y)})}A(r),G(()=>{q(r,"tabindex",n()?-1:0),q(r,"aria-label",p()||"Paste from clipboard"),o=ee(r,1,"svelte-8prmba",null,o,{hidden:n(),center:T(),boundedheight:m(),flex:b(),"icon-mode":u()}),a=ie(r,"",a,{height:u()?"":l()?typeof l()=="number"?l()+"px":l():"100%"})}),k(t,r)},be=t=>{var r=R(),o=J(r);{var a=y=>{var f=R(),F=J(f);{var O=S=>{Ue(S,{get root(){return e.root},get upload_id(){return D},get files(){return U},get stream_handler(){return e.stream_handler}})};j(F,S=>{n()||S(O)})}k(y,f)},g=y=>{var f=Ie();let F,O;var S=L(f);{var we=E=>{var Y=R(),xe=J(Y);le(xe,()=>e.children),k(E,Y)};j(S,E=>{e.children&&E(we)})}A(f),Ce(f,(E,Y)=>s?.(E,Y),()=>({on_drag_change:E=>c(E),on_files:E=>ve(E),accepted_types:v(W),mode:w(),disable_click:h()})),G(()=>{q(f,"tabindex",n()?-1:0),q(f,"aria-label",p()||"Click to upload or drop files"),F=ee(f,1,"svelte-8prmba",null,F,{hidden:n(),center:T(),boundedheight:m(),flex:b(),disable_click:h(),"icon-mode":u()}),O=ie(f,"",O,{height:u()?"":l()?typeof l()=="number"?l()+"px":l():"100%"})}),k(y,f)};j(o,y=>{z()&&K()?y(a):y(g,!1)},!0)}k(t,r)};j(he,t=>{d()==="clipboard"?t(ye):t(be,!1)})}return k(i,ne),ue(pe)}Fe(["click"]);export{Ne as U,Ue as a,Oe as c}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/UploadText-oRnvaG4b.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/UploadText-oRnvaG4b.js new file mode 100644 index 0000000000000000000000000000000000000000..f7d09b13da43e4b720890a7ceb7439d9ede3dd6e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/UploadText-oRnvaG4b.js @@ -0,0 +1 @@ +import{p,e as O,i as b,b as Q}from"./i18n-Dnhn5Rxr.js";import{R as Z,a1 as $,w as d,G as c,a2 as ee,X as R,t as U,a as f,T as ae,a3 as P,U as m,V as k,S as A,z as D,a0 as w,W as u,at as te,x as V,Y as E}from"./index-DWyDLubb.js";import{a as re,U as se}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";const oe=/^(#\s*)(.+)$/m;function W(S){const a=S.trim(),s=a.match(oe);if(!s)return[!1,a||!1];const[l,,i]=s,t=i.trim();if(a===l)return[t,!1];const v=s.index!==void 0?s.index+l.length:0,g=a.substring(v).trim()||!1;return[t,g]}var le=u('

          '),ne=u('

          '),de=u(" ",1),ie=u(' ',1),_e=u(" ",1),ve=u('
          ');function me(S,a){Z(a,!1);const s=P(),l=P();let i=p(a,"type",12,"file"),t=p(a,"i18n",12),v=p(a,"message",12,void 0),G=p(a,"mode",12,"full"),g=p(a,"hovered",12,!1),h=p(a,"placeholder",12,void 0);const H={image:"upload_text.drop_image",video:"upload_text.drop_video",audio:"upload_text.drop_audio",file:"upload_text.drop_file",csv:"upload_text.drop_csv",gallery:"upload_text.drop_gallery",clipboard:"upload_text.paste_clipboard"};$(()=>(d(s),d(l),c(h()),W),()=>{(e=>{var n=te(e,2);V(s,n[0]),V(l,n[1])})(h()?W(h()):[!1,!1])}),ee();var X={get type(){return i()},set type(e){i(e),m()},get i18n(){return t()},set i18n(e){t(e),m()},get message(){return v()},set message(e){v(e),m()},get mode(){return G()},set mode(e){G(e),m()},get hovered(){return g()},set hovered(e){g(e),m()},get placeholder(){return h()},set placeholder(e){h(e),m()}};O();var T=ve(),I=k(T);let N;var Y=k(I);{var q=e=>{re(e)},B=e=>{se(e)};b(Y,e=>{i()==="clipboard"?e(q):e(B,!1)})}E(I);var C=R(I,2);{var F=e=>{var n=de(),x=A(n);{var j=o=>{var r=le(),y=k(r,!0);E(r),U(()=>w(y,d(s))),f(o,r)};b(x,o=>{d(s)&&o(j)})}var z=R(x,2);{var _=o=>{var r=ne(),y=k(r,!0);E(r),U(()=>w(y,d(l))),f(o,r)};b(z,o=>{d(l)&&o(_)})}f(e,n)},J=e=>{var n=_e(),x=A(n),j=R(x);{var z=_=>{var o=ie(),r=A(o),y=k(r);E(r);var K=R(r);U((L,M)=>{w(y,`- ${L??""} -`),w(K,` ${M??""}`)},[()=>(c(t()),D(()=>t()("common.or"))),()=>(c(v()),c(t()),D(()=>v()||t()("upload_text.click_to_upload")))]),f(_,o)};b(j,_=>{G()!=="short"&&_(z)})}U(_=>w(x,`${_??""} `),[()=>(c(t()),c(i()),D(()=>t()(H[i()]||H.file)))]),f(e,n)};b(C,e=>{d(s)||d(l)?e(F):e(J,!1)})}return E(T),U(()=>N=Q(I,1,"icon-wrap svelte-1vmd51o",null,N,{hovered:g()})),f(S,T),ae(X)}export{me as U}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Video-B_oD6cFy.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Video-B_oD6cFy.js new file mode 100644 index 0000000000000000000000000000000000000000..db05d5acd05002489b79b6d90229b62d9bd78ecb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Video-B_oD6cFy.js @@ -0,0 +1,40 @@ +import{p as Oe,i as Xa,d as za,b as Qa,a as bs}from"./i18n-Dnhn5Rxr.js";import{B as Za,N as Ja,ab as eo,A as ss,R as to,y as ji,x as qi,S as Xi,t as so,Z as We,a as zi,T as io,u as ro,w as no,X as ao,W as oo,aj as lo,V as co,a6 as ho,Y as uo}from"./index-DWyDLubb.js";import{s as fo}from"./snippet-BWgYNF9D.js";import{a as go}from"./actions-CLThs9VH.js";import{b as mo}from"./universal-CFOISHmx.js";function po(a,e,t=e){var s,i,r=()=>{cancelAnimationFrame(s),a.paused||(s=requestAnimationFrame(r));var n=a.currentTime;i!==n&&t(i=n)};s=requestAnimationFrame(r),a.addEventListener("timeupdate",r),Za(()=>{var n=Number(e());i!==n&&!isNaN(n)&&(a.currentTime=i=n)}),Ja(()=>{cancelAnimationFrame(s),a.removeEventListener("timeupdate",r)})}function Eo(a,e,t=e){var s=e(),i=()=>{s!==a.paused&&t(s=a.paused)};eo(a,["play","pause","canplay"],i,s==null),ss(()=>{(s=!!e())!==a.paused&&(s?a.pause():a.play().catch(()=>{t(s=!0)}))})}const yo=new Error("failed to get response body reader"),To=new Error("failed to complete download"),vo="Content-Length",So=async(a,e)=>{const t=await fetch(a);let s;try{const i=parseInt(t.headers.get(vo)||"-1"),r=t.body?.getReader();if(!r)throw yo;const n=[];let o=0;for(;;){const{done:h,value:d}=await r.read(),u=d?d.length:0;if(h){if(i!=-1&&i!==o)throw To;e&&e({url:a,total:i,received:o,delta:u,done:h});break}n.push(d),o+=u,e&&e({url:a,total:i,received:o,delta:u,done:h})}const c=new Uint8Array(o);let l=0;for(const h of n)c.set(h,l),l+=h.length;s=c.buffer}catch(i){console.log("failed to send download progress event: ",i),s=await t.arrayBuffer()}return s},Zs=async(a,e,t=!1,s)=>{const i=t?await So(a,s):await(await fetch(a)).arrayBuffer(),r=new Blob([i],{type:e});return URL.createObjectURL(r)};var te;(function(a){a.LOAD="LOAD",a.EXEC="EXEC",a.FFPROBE="FFPROBE",a.WRITE_FILE="WRITE_FILE",a.READ_FILE="READ_FILE",a.DELETE_FILE="DELETE_FILE",a.RENAME="RENAME",a.CREATE_DIR="CREATE_DIR",a.LIST_DIR="LIST_DIR",a.DELETE_DIR="DELETE_DIR",a.ERROR="ERROR",a.DOWNLOAD="DOWNLOAD",a.PROGRESS="PROGRESS",a.LOG="LOG",a.MOUNT="MOUNT",a.UNMOUNT="UNMOUNT"})(te||(te={}));const xo=(()=>{let a=0;return()=>a++})(),Ao=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),Io=new Error("called FFmpeg.terminate()");class Lo{#t=null;#i={};#s={};#r=[];#n=[];loaded=!1;#a=()=>{this.#t&&(this.#t.onmessage=({data:{id:e,type:t,data:s}})=>{switch(t){case te.LOAD:this.loaded=!0,this.#i[e](s);break;case te.MOUNT:case te.UNMOUNT:case te.EXEC:case te.FFPROBE:case te.WRITE_FILE:case te.READ_FILE:case te.DELETE_FILE:case te.RENAME:case te.CREATE_DIR:case te.LIST_DIR:case te.DELETE_DIR:this.#i[e](s);break;case te.LOG:this.#r.forEach(i=>i(s));break;case te.PROGRESS:this.#n.forEach(i=>i(s));break;case te.ERROR:this.#s[e](s);break}delete this.#i[e],delete this.#s[e]})};#e=({type:e,data:t},s=[],i)=>this.#t?new Promise((r,n)=>{const o=xo();this.#t&&this.#t.postMessage({id:o,type:e,data:t},s),this.#i[o]=r,this.#s[o]=n,i?.addEventListener("abort",()=>{n(new DOMException(`Message # ${o} was aborted`,"AbortError"))},{once:!0})}):Promise.reject(Ao);on(e,t){e==="log"?this.#r.push(t):e==="progress"&&this.#n.push(t)}off(e,t){e==="log"?this.#r=this.#r.filter(s=>s!==t):e==="progress"&&(this.#n=this.#n.filter(s=>s!==t))}load=({classWorkerURL:e,...t}={},{signal:s}={})=>(this.#t||(this.#t=e?new Worker(new URL(e,import.meta.url),{type:"module"}):new Worker(new URL(""+new URL("worker-BAOIWoxA.js",import.meta.url).href,import.meta.url),{type:"module"}),this.#a()),this.#e({type:te.LOAD,data:t},void 0,s));exec=(e,t=-1,{signal:s}={})=>this.#e({type:te.EXEC,data:{args:e,timeout:t}},void 0,s);ffprobe=(e,t=-1,{signal:s}={})=>this.#e({type:te.FFPROBE,data:{args:e,timeout:t}},void 0,s);terminate=()=>{const e=Object.keys(this.#s);for(const t of e)this.#s[t](Io),delete this.#s[t],delete this.#i[t];this.#t&&(this.#t.terminate(),this.#t=null,this.loaded=!1)};writeFile=(e,t,{signal:s}={})=>{const i=[];return t instanceof Uint8Array&&i.push(t.buffer),this.#e({type:te.WRITE_FILE,data:{path:e,data:t}},i,s)};mount=(e,t,s)=>{const i=[];return this.#e({type:te.MOUNT,data:{fsType:e,options:t,mountPoint:s}},i)};unmount=e=>{const t=[];return this.#e({type:te.UNMOUNT,data:{mountPoint:e}},t)};readFile=(e,t="binary",{signal:s}={})=>this.#e({type:te.READ_FILE,data:{path:e,encoding:t}},void 0,s);deleteFile=(e,{signal:t}={})=>this.#e({type:te.DELETE_FILE,data:{path:e}},void 0,t);rename=(e,t,{signal:s}={})=>this.#e({type:te.RENAME,data:{oldPath:e,newPath:t}},void 0,s);createDir=(e,{signal:t}={})=>this.#e({type:te.CREATE_DIR,data:{path:e}},void 0,t);listDir=(e,{signal:t}={})=>this.#e({type:te.LIST_DIR,data:{path:e}},void 0,t);deleteDir=(e,{signal:t}={})=>this.#e({type:te.DELETE_DIR,data:{path:e}},void 0,t)}var Qi;(function(a){a.MEMFS="MEMFS",a.NODEFS="NODEFS",a.NODERAWFS="NODERAWFS",a.IDBFS="IDBFS",a.WORKERFS="WORKERFS",a.PROXYFS="PROXYFS"})(Qi||(Qi={}));const Ro={"3g2":"video/3gpp2","3gp":"video/3gpp","3gpp":"video/3gpp","3mf":"model/3mf",aac:"audio/aac",ac:"application/pkix-attr-cert",adp:"audio/adpcm",adts:"audio/aac",ai:"application/postscript",aml:"application/automationml-aml+xml",amlx:"application/automationml-amlx+zip",amr:"audio/amr",apng:"image/apng",appcache:"text/cache-manifest",appinstaller:"application/appinstaller",appx:"application/appx",appxbundle:"application/appxbundle",asc:"application/pgp-keys",atom:"application/atom+xml",atomcat:"application/atomcat+xml",atomdeleted:"application/atomdeleted+xml",atomsvc:"application/atomsvc+xml",au:"audio/basic",avci:"image/avci",avcs:"image/avcs",avif:"image/avif",aw:"application/applixware",bdoc:"application/bdoc",bin:"application/octet-stream",bmp:"image/bmp",bpk:"application/octet-stream",btf:"image/prs.btif",btif:"image/prs.btif",buffer:"application/octet-stream",ccxml:"application/ccxml+xml",cdfx:"application/cdfx+xml",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",cer:"application/pkix-cert",cgm:"image/cgm",cjs:"application/node",class:"application/java-vm",coffee:"text/coffeescript",conf:"text/plain",cpl:"application/cpl+xml",cpt:"application/mac-compactpro",crl:"application/pkix-crl",css:"text/css",csv:"text/csv",cu:"application/cu-seeme",cwl:"application/cwl",cww:"application/prs.cww",davmount:"application/davmount+xml",dbk:"application/docbook+xml",deb:"application/octet-stream",def:"text/plain",deploy:"application/octet-stream",dib:"image/bmp","disposition-notification":"message/disposition-notification",dist:"application/octet-stream",distz:"application/octet-stream",dll:"application/octet-stream",dmg:"application/octet-stream",dms:"application/octet-stream",doc:"application/msword",dot:"application/msword",dpx:"image/dpx",drle:"image/dicom-rle",dsc:"text/prs.lines.tag",dssc:"application/dssc+der",dtd:"application/xml-dtd",dump:"application/octet-stream",dwd:"application/atsc-dwd+xml",ear:"application/java-archive",ecma:"application/ecmascript",elc:"application/octet-stream",emf:"image/emf",eml:"message/rfc822",emma:"application/emma+xml",emotionml:"application/emotionml+xml",eps:"application/postscript",epub:"application/epub+zip",exe:"application/octet-stream",exi:"application/exi",exp:"application/express",exr:"image/aces",ez:"application/andrew-inset",fdf:"application/fdf",fdt:"application/fdt+xml",fits:"image/fits",g3:"image/g3fax",gbr:"application/rpki-ghostbusters",geojson:"application/geo+json",gif:"image/gif",glb:"model/gltf-binary",gltf:"model/gltf+json",gml:"application/gml+xml",gpx:"application/gpx+xml",gram:"application/srgs",grxml:"application/srgs+xml",gxf:"application/gxf",gz:"application/gzip",h261:"video/h261",h263:"video/h263",h264:"video/h264",heic:"image/heic",heics:"image/heic-sequence",heif:"image/heif",heifs:"image/heif-sequence",hej2:"image/hej2k",held:"application/atsc-held+xml",hjson:"application/hjson",hlp:"application/winhlp",hqx:"application/mac-binhex40",hsj2:"image/hsj2",htm:"text/html",html:"text/html",ics:"text/calendar",ief:"image/ief",ifb:"text/calendar",iges:"model/iges",igs:"model/iges",img:"application/octet-stream",in:"text/plain",ini:"text/plain",ink:"application/inkml+xml",inkml:"application/inkml+xml",ipfix:"application/ipfix",iso:"application/octet-stream",its:"application/its+xml",jade:"text/jade",jar:"application/java-archive",jhc:"image/jphc",jls:"image/jls",jp2:"image/jp2",jpe:"image/jpeg",jpeg:"image/jpeg",jpf:"image/jpx",jpg:"image/jpeg",jpg2:"image/jp2",jpgm:"image/jpm",jpgv:"video/jpeg",jph:"image/jph",jpm:"image/jpm",jpx:"image/jpx",js:"text/javascript",json:"application/json",json5:"application/json5",jsonld:"application/ld+json",jsonml:"application/jsonml+json",jsx:"text/jsx",jt:"model/jt",jxl:"image/jxl",jxr:"image/jxr",jxra:"image/jxra",jxrs:"image/jxrs",jxs:"image/jxs",jxsc:"image/jxsc",jxsi:"image/jxsi",jxss:"image/jxss",kar:"audio/midi",ktx:"image/ktx",ktx2:"image/ktx2",less:"text/less",lgr:"application/lgr+xml",list:"text/plain",litcoffee:"text/coffeescript",log:"text/plain",lostxml:"application/lost+xml",lrf:"application/octet-stream",m1v:"video/mpeg",m21:"application/mp21",m2a:"audio/mpeg",m2t:"video/mp2t",m2ts:"video/mp2t",m2v:"video/mpeg",m3a:"audio/mpeg",m4a:"audio/mp4",m4p:"application/mp4",m4s:"video/iso.segment",ma:"application/mathematica",mads:"application/mads+xml",maei:"application/mmt-aei+xml",man:"text/troff",manifest:"text/cache-manifest",map:"application/json",mar:"application/octet-stream",markdown:"text/markdown",mathml:"application/mathml+xml",mb:"application/mathematica",mbox:"application/mbox",md:"text/markdown",mdx:"text/mdx",me:"text/troff",mesh:"model/mesh",meta4:"application/metalink4+xml",metalink:"application/metalink+xml",mets:"application/mets+xml",mft:"application/rpki-manifest",mid:"audio/midi",midi:"audio/midi",mime:"message/rfc822",mj2:"video/mj2",mjp2:"video/mj2",mjs:"text/javascript",mml:"text/mathml",mods:"application/mods+xml",mov:"video/quicktime",mp2:"audio/mpeg",mp21:"application/mp21",mp2a:"audio/mpeg",mp3:"audio/mpeg",mp4:"video/mp4",mp4a:"audio/mp4",mp4s:"application/mp4",mp4v:"video/mp4",mpd:"application/dash+xml",mpe:"video/mpeg",mpeg:"video/mpeg",mpf:"application/media-policy-dataset+xml",mpg:"video/mpeg",mpg4:"video/mp4",mpga:"audio/mpeg",mpp:"application/dash-patch+xml",mrc:"application/marc",mrcx:"application/marcxml+xml",ms:"text/troff",mscml:"application/mediaservercontrol+xml",msh:"model/mesh",msi:"application/octet-stream",msix:"application/msix",msixbundle:"application/msixbundle",msm:"application/octet-stream",msp:"application/octet-stream",mtl:"model/mtl",mts:"video/mp2t",musd:"application/mmt-usd+xml",mxf:"application/mxf",mxmf:"audio/mobile-xmf",mxml:"application/xv+xml",n3:"text/n3",nb:"application/mathematica",nq:"application/n-quads",nt:"application/n-triples",obj:"model/obj",oda:"application/oda",oga:"audio/ogg",ogg:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",omdoc:"application/omdoc+xml",onepkg:"application/onenote",onetmp:"application/onenote",onetoc:"application/onenote",onetoc2:"application/onenote",opf:"application/oebps-package+xml",opus:"audio/ogg",otf:"font/otf",owl:"application/rdf+xml",oxps:"application/oxps",p10:"application/pkcs10",p7c:"application/pkcs7-mime",p7m:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p8:"application/pkcs8",pdf:"application/pdf",pfr:"application/font-tdpfr",pgp:"application/pgp-encrypted",pkg:"application/octet-stream",pki:"application/pkixcmp",pkipath:"application/pkix-pkipath",pls:"application/pls+xml",png:"image/png",prc:"model/prc",prf:"application/pics-rules",provx:"application/provenance+xml",ps:"application/postscript",pskcxml:"application/pskc+xml",pti:"image/prs.pti",qt:"video/quicktime",raml:"application/raml+yaml",rapd:"application/route-apd+xml",rdf:"application/rdf+xml",relo:"application/p2p-overlay+xml",rif:"application/reginfo+xml",rl:"application/resource-lists+xml",rld:"application/resource-lists-diff+xml",rmi:"audio/midi",rnc:"application/relax-ng-compact-syntax",rng:"application/xml",roa:"application/rpki-roa",roff:"text/troff",rq:"application/sparql-query",rs:"application/rls-services+xml",rsat:"application/atsc-rsat+xml",rsd:"application/rsd+xml",rsheet:"application/urc-ressheet+xml",rss:"application/rss+xml",rtf:"text/rtf",rtx:"text/richtext",rusd:"application/route-usd+xml",s3m:"audio/s3m",sbml:"application/sbml+xml",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",sdp:"application/sdp",senmlx:"application/senml+xml",sensmlx:"application/sensml+xml",ser:"application/java-serialized-object",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",sgi:"image/sgi",sgm:"text/sgml",sgml:"text/sgml",shex:"text/shex",shf:"application/shf+xml",shtml:"text/html",sieve:"application/sieve",sig:"application/pgp-signature",sil:"audio/silk",silo:"model/mesh",siv:"application/sieve",slim:"text/slim",slm:"text/slim",sls:"application/route-s-tsid+xml",smi:"application/smil+xml",smil:"application/smil+xml",snd:"audio/basic",so:"application/octet-stream",spdx:"text/spdx",spp:"application/scvp-vp-response",spq:"application/scvp-vp-request",spx:"audio/ogg",sql:"application/sql",sru:"application/sru+xml",srx:"application/sparql-results+xml",ssdl:"application/ssdl+xml",ssml:"application/ssml+xml",stk:"application/hyperstudio",stl:"model/stl",stpx:"model/step+xml",stpxz:"model/step-xml+zip",stpz:"model/step+zip",styl:"text/stylus",stylus:"text/stylus",svg:"image/svg+xml",svgz:"image/svg+xml",swidtag:"application/swid+xml",t:"text/troff",t38:"image/t38",td:"application/urc-targetdesc+xml",tei:"application/tei+xml",teicorpus:"application/tei+xml",text:"text/plain",tfi:"application/thraud+xml",tfx:"image/tiff-fx",tif:"image/tiff",tiff:"image/tiff",toml:"application/toml",tr:"text/troff",trig:"application/trig",ts:"video/mp2t",tsd:"application/timestamped-data",tsv:"text/tab-separated-values",ttc:"font/collection",ttf:"font/ttf",ttl:"text/turtle",ttml:"application/ttml+xml",txt:"text/plain",u3d:"model/u3d",u8dsn:"message/global-delivery-status",u8hdr:"message/global-headers",u8mdn:"message/global-disposition-notification",u8msg:"message/global",ubj:"application/ubjson",uri:"text/uri-list",uris:"text/uri-list",urls:"text/uri-list",vcard:"text/vcard",vrml:"model/vrml",vtt:"text/vtt",vxml:"application/voicexml+xml",war:"application/java-archive",wasm:"application/wasm",wav:"audio/wav",weba:"audio/webm",webm:"video/webm",webmanifest:"application/manifest+json",webp:"image/webp",wgsl:"text/wgsl",wgt:"application/widget",wif:"application/watcherinfo+xml",wmf:"image/wmf",woff:"font/woff",woff2:"font/woff2",wrl:"model/vrml",wsdl:"application/wsdl+xml",wspolicy:"application/wspolicy+xml",x3d:"model/x3d+xml",x3db:"model/x3d+fastinfoset",x3dbz:"model/x3d+binary",x3dv:"model/x3d-vrml",x3dvz:"model/x3d+vrml",x3dz:"model/x3d+xml",xaml:"application/xaml+xml",xav:"application/xcap-att+xml",xca:"application/xcap-caps+xml",xcs:"application/calendar+xml",xdf:"application/xcap-diff+xml",xdssc:"application/dssc+xml",xel:"application/xcap-el+xml",xenc:"application/xenc+xml",xer:"application/patch-ops-error+xml",xfdf:"application/xfdf",xht:"application/xhtml+xml",xhtml:"application/xhtml+xml",xhvml:"application/xv+xml",xlf:"application/xliff+xml",xm:"audio/xm",xml:"text/xml",xns:"application/xcap-ns+xml",xop:"application/xop+xml",xpl:"application/xproc+xml",xsd:"application/xml",xsf:"application/prs.xsf+xml",xsl:"application/xml",xslt:"application/xml",xspf:"application/xspf+xml",xvm:"application/xv+xml",xvml:"application/xv+xml",yaml:"text/yaml",yang:"application/yang",yin:"application/yin+xml",yml:"text/yaml",zip:"application/zip"};function bo(a){let e=(""+a).trim().toLowerCase(),t=e.lastIndexOf(".");return Ro[~t?e.substring(++t):e]}const $u=a=>{let e=["B","KB","MB","GB","PB"],t=0;for(;a>1024;)a/=1024,t++;let s=e[t];return a.toFixed(1)+" "+s},Gu=()=>!0;function _o(a,{autoplay:e}){async function t(){e&&await a.play()}return a.addEventListener("loadeddata",t),{destroy(){a.removeEventListener("loadeddata",t)}}}async function Ku(){const a=new Lo,e="https://unpkg.com/@ffmpeg/core@0.12.4/dist/esm";return await a.load({coreURL:await Zs(`${e}/ffmpeg-core.js`,"text/javascript"),wasmURL:await Zs(`${e}/ffmpeg-core.wasm`,"application/wasm")}),a}async function Vu(a,e,t,s){const i=s.src,r=bo(s.src)||"video/mp4",n=await Zs(i,r),c=await(await fetch(n)).blob(),l=Do(r)||"mp4",h=`input.${l}`,d=`output.${l}`;try{if(e===0&&t===0)return c;await a.writeFile(h,new Uint8Array(await c.arrayBuffer()));let u=["-i",h,...e!==0?["-ss",e.toString()]:[],...t!==0?["-to",t.toString()]:[],"-c:a","copy",d];await a.exec(u);const f=await a.readFile(d);return new Blob([f],{type:`video/${l}`})}catch(u){return console.error("Error initializing FFmpeg:",u),c}}const Do=a=>({"video/mp4":"mp4","video/webm":"webm","video/ogg":"ogv","video/quicktime":"mov","video/x-msvideo":"avi","video/x-matroska":"mkv","video/mpeg":"mpeg","video/3gpp":"3gp","video/3gpp2":"3g2","video/h261":"h261","video/h263":"h263","video/h264":"h264","video/jpeg":"jpgv","video/jpm":"jpm","video/mj2":"mj2","video/mpv":"mpv","video/vnd.ms-playready.media.pyv":"pyv","video/vnd.uvvu.mp4":"uvu","video/vnd.vivo":"viv","video/x-f4v":"f4v","video/x-fli":"fli","video/x-flv":"flv","video/x-m4v":"m4v","video/x-ms-asf":"asf","video/x-ms-wm":"wm","video/x-ms-wmv":"wmv","video/x-ms-wmx":"wmx","video/x-ms-wvx":"wvx","video/x-sgi-movie":"movie","video/x-smv":"smv"})[a]||null,M=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},Co=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=Po},Po=Number.MAX_SAFE_INTEGER||9007199254740991;let V=(function(a){return a.NETWORK_ERROR="networkError",a.MEDIA_ERROR="mediaError",a.KEY_SYSTEM_ERROR="keySystemError",a.MUX_ERROR="muxError",a.OTHER_ERROR="otherError",a})({}),b=(function(a){return a.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",a.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",a.KEY_SYSTEM_NO_SESSION="keySystemNoSession",a.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",a.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",a.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",a.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",a.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",a.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",a.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",a.MANIFEST_LOAD_ERROR="manifestLoadError",a.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",a.MANIFEST_PARSING_ERROR="manifestParsingError",a.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",a.LEVEL_EMPTY_ERROR="levelEmptyError",a.LEVEL_LOAD_ERROR="levelLoadError",a.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",a.LEVEL_PARSING_ERROR="levelParsingError",a.LEVEL_SWITCH_ERROR="levelSwitchError",a.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",a.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",a.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",a.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",a.FRAG_LOAD_ERROR="fragLoadError",a.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",a.FRAG_DECRYPT_ERROR="fragDecryptError",a.FRAG_PARSING_ERROR="fragParsingError",a.FRAG_GAP="fragGap",a.REMUX_ALLOC_ERROR="remuxAllocError",a.KEY_LOAD_ERROR="keyLoadError",a.KEY_LOAD_TIMEOUT="keyLoadTimeOut",a.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",a.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",a.BUFFER_APPEND_ERROR="bufferAppendError",a.BUFFER_APPENDING_ERROR="bufferAppendingError",a.BUFFER_STALLED_ERROR="bufferStalledError",a.BUFFER_FULL_ERROR="bufferFullError",a.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",a.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",a.ASSET_LIST_LOAD_ERROR="assetListLoadError",a.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",a.ASSET_LIST_PARSING_ERROR="assetListParsingError",a.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",a.INTERNAL_EXCEPTION="internalException",a.INTERNAL_ABORTED="aborted",a.ATTACH_MEDIA_ERROR="attachMediaError",a.UNKNOWN="unknown",a})({}),m=(function(a){return a.MEDIA_ATTACHING="hlsMediaAttaching",a.MEDIA_ATTACHED="hlsMediaAttached",a.MEDIA_DETACHING="hlsMediaDetaching",a.MEDIA_DETACHED="hlsMediaDetached",a.MEDIA_ENDED="hlsMediaEnded",a.STALL_RESOLVED="hlsStallResolved",a.BUFFER_RESET="hlsBufferReset",a.BUFFER_CODECS="hlsBufferCodecs",a.BUFFER_CREATED="hlsBufferCreated",a.BUFFER_APPENDING="hlsBufferAppending",a.BUFFER_APPENDED="hlsBufferAppended",a.BUFFER_EOS="hlsBufferEos",a.BUFFERED_TO_END="hlsBufferedToEnd",a.BUFFER_FLUSHING="hlsBufferFlushing",a.BUFFER_FLUSHED="hlsBufferFlushed",a.MANIFEST_LOADING="hlsManifestLoading",a.MANIFEST_LOADED="hlsManifestLoaded",a.MANIFEST_PARSED="hlsManifestParsed",a.LEVEL_SWITCHING="hlsLevelSwitching",a.LEVEL_SWITCHED="hlsLevelSwitched",a.LEVEL_LOADING="hlsLevelLoading",a.LEVEL_LOADED="hlsLevelLoaded",a.LEVEL_UPDATED="hlsLevelUpdated",a.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",a.LEVELS_UPDATED="hlsLevelsUpdated",a.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",a.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",a.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",a.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",a.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",a.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",a.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",a.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",a.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",a.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",a.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",a.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",a.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",a.CUES_PARSED="hlsCuesParsed",a.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",a.INIT_PTS_FOUND="hlsInitPtsFound",a.FRAG_LOADING="hlsFragLoading",a.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",a.FRAG_LOADED="hlsFragLoaded",a.FRAG_DECRYPTED="hlsFragDecrypted",a.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",a.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",a.FRAG_PARSING_METADATA="hlsFragParsingMetadata",a.FRAG_PARSED="hlsFragParsed",a.FRAG_BUFFERED="hlsFragBuffered",a.FRAG_CHANGED="hlsFragChanged",a.FPS_DROP="hlsFpsDrop",a.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",a.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",a.ERROR="hlsError",a.DESTROYING="hlsDestroying",a.KEY_LOADING="hlsKeyLoading",a.KEY_LOADED="hlsKeyLoaded",a.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",a.BACK_BUFFER_REACHED="hlsBackBufferReached",a.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",a.ASSET_LIST_LOADING="hlsAssetListLoading",a.ASSET_LIST_LOADED="hlsAssetListLoaded",a.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",a.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",a.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",a.INTERSTITIAL_STARTED="hlsInterstitialStarted",a.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",a.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",a.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",a.INTERSTITIAL_ENDED="hlsInterstitialEnded",a.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",a.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",a.EVENT_CUE_ENTER="hlsEventCueEnter",a})({});var Q={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},B={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class ft{constructor(e,t=0,s=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=s}sample(e,t){const s=Math.pow(this.alpha_,e);this.estimate_=t*(1-s)+s*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class ko{constructor(e,t,s,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ft(e),this.fast_=new ft(t),this.defaultTTFB_=i,this.ttfb_=new ft(e)}update(e,t){const{slow_:s,fast_:i,ttfb_:r}=this;s.halfLife!==e&&(this.slow_=new ft(e,s.getEstimate(),s.getTotalWeight())),i.halfLife!==t&&(this.fast_=new ft(t,i.getEstimate(),i.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new ft(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const s=8*t,i=e/1e3,r=s/i;this.fast_.sample(i,r),this.slow_.sample(i,r)}sampleTTFB(e){const t=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(s,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function wo(a,e,t){return(e=Fo(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function re(){return re=Object.assign?Object.assign.bind():function(a){for(var e=1;e`):Je}function Ji(a,e,t){return e[a]?e[a].bind(e):No(a,t)}const ei=Js();function Bo(a,e,t){const s=Js();if(typeof console=="object"&&a===!0||typeof a=="object"){const i=["debug","log","info","warn","error"];i.forEach(r=>{s[r]=Ji(r,a,t)});try{s.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch{return Js()}i.forEach(r=>{ei[r]=Ji(r,a)})}else re(ei,s);return s}const ie=ei;function st(a=!0){return typeof self>"u"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Uo(a){return typeof self<"u"&&a===self.ManagedMediaSource}function pn(a,e){const t=Object.keys(a),s=Object.keys(e),i=t.length,r=s.length;return!i||!r||i===r&&!t.some(n=>s.indexOf(n)===-1)}function _e(a,e=!1){if(typeof TextDecoder<"u"){const l=new TextDecoder("utf-8").decode(a);if(e){const h=l.indexOf("\0");return h!==-1?l.substring(0,h):l}return l.replace(/\0/g,"")}const t=a.length;let s,i,r,n="",o=0;for(;o>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(s);break;case 12:case 13:i=a[o++],n+=String.fromCharCode((s&31)<<6|i&63);break;case 14:i=a[o++],r=a[o++],n+=String.fromCharCode((s&15)<<12|(i&63)<<6|(r&63)<<0);break}}return n}function pe(a){let e="";for(let t=0;t1||i===1&&(t=this.levelkeys[s[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!M(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return he(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var s;const i=t[e];i&&!((s=this._decryptdata)!=null&&s.keyId)&&(this._decryptdata=i.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,s,i,r,n=!1){const{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:s,startDTS:i,endDTS:r,partial:n};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,s),c.startDTS=Math.min(c.startDTS,i),c.endDTS=Math.max(c.endDTS,r)}}class Ko extends yn{constructor(e,t,s,i,r){super(s),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=i;const n=e.enumeratedString("BYTERANGE");n&&this.setByteRange(n,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function Tn(a,e){const t=Object.getPrototypeOf(a);if(t){const s=Object.getOwnPropertyDescriptor(t,e);return s||Tn(t,e)}}function Vo(a,e){const t=Tn(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const tr=Math.pow(2,32)-1,Ho=[].push,vn={video:1,audio:2,id3:3,text:4};function de(a){return String.fromCharCode.apply(null,a)}function Sn(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function W(a,e){const t=xn(a,e);return t<0?4294967296+t:t}function sr(a,e){let t=W(a,e);return t*=Math.pow(2,32),t+=W(a,e+4),t}function xn(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function Yo(a){const e=a.byteLength;for(let t=0;t8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=s>1?t+s:e}return!1}function z(a,e){const t=[];if(!e.length)return t;const s=a.byteLength;for(let i=0;i1?i+r:s;if(n===e[0])if(e.length===1)t.push(a.subarray(i+8,o));else{const c=z(a.subarray(i+8,o),e.slice(1));c.length&&Ho.apply(t,c)}i=o}return t}function Wo(a){const e=[],t=a[0];let s=8;const i=W(a,s);s+=4;let r=0,n=0;t===0?(r=W(a,s),n=W(a,s+4),s+=8):(r=sr(a,s),n=sr(a,s+8),s+=16),s+=2;let o=a.length+n;const c=Sn(a,s);s+=2;for(let l=0;l>>31===1)return ie.warn("SIDX has hierarchical references (not supported)"),null;const g=W(a,h);h+=4,e.push({referenceSize:u,subsegmentDuration:g,info:{duration:g/i,start:o,end:o+u-1}}),o+=u,h+=4,s=h}return{earliestPresentationTime:r,timescale:i,version:t,referencesCount:c,references:e}}function An(a){const e=[],t=z(a,["moov","trak"]);for(let i=0;i{const r=W(i,4),n=e[r];n&&(n.default={duration:W(i,12),flags:W(i,20)})}),e}function jo(a){const e=a.subarray(8),t=e.subarray(86),s=de(e.subarray(4,8));let i=s,r;const n=s==="enca"||s==="encv";if(n){const l=z(e,[s])[0].subarray(s==="enca"?28:78);z(l,["sinf"]).forEach(d=>{const u=z(d,["schm"])[0];if(u){const f=de(u.subarray(4,8));if(f==="cbcs"||f==="cenc"){const g=z(d,["frma"])[0];g&&(i=de(g))}}})}const o=i;switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const c=z(t,["avcC"])[0];c&&c.length>3&&(i+="."+Kt(c[1])+Kt(c[2])+Kt(c[3]),r=Gt(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=z(e,[s])[0],l=z(c.subarray(28),["esds"])[0];if(l&&l.length>7){let h=4;if(l[h++]!==3)break;h=Cs(l,h),h+=2;const d=l[h++];if(d&128&&(h+=2),d&64&&(h+=l[h++]),l[h++]!==4)break;h=Cs(l,h);const u=l[h++];if(u===64)i+="."+Kt(u);else break;if(h+=12,l[h++]!==5)break;h=Cs(l,h);const f=l[h++];let g=(f&248)>>3;g===31&&(g+=1+((f&7)<<3)+((l[h]&224)>>5)),i+="."+g}break}case"hvc1":case"hev1":{const c=z(t,["hvcC"])[0];if(c&&c.length>12){const l=c[1],h=["","A","B","C"][l>>6],d=l&31,u=W(c,2),f=(l&32)>>5?"H":"L",g=c[12],E=c.subarray(6,12);i+="."+h+d,i+="."+qo(u).toString(16).toUpperCase(),i+="."+f+g;let p="";for(let y=E.length;y--;){const T=E[y];(T||p)&&(p="."+T.toString(16).toUpperCase()+p)}i+=p}r=Gt(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{i=Gt(i,t)||i;break}case"vp09":{const c=z(t,["vpcC"])[0];if(c&&c.length>6){const l=c[4],h=c[5],d=c[6]>>4&15;i+="."+$e(l)+"."+$e(h)+"."+$e(d)}break}case"av01":{const c=z(t,["av1C"])[0];if(c&&c.length>2){const l=c[1]>>>5,h=c[1]&31,d=c[2]>>>7?"H":"M",u=(c[2]&64)>>6,f=(c[2]&32)>>5,g=l===2&&u?f?12:10:u?10:8,E=(c[2]&16)>>4,p=(c[2]&8)>>3,y=(c[2]&4)>>2,T=c[2]&3;i+="."+l+"."+$e(h)+d+"."+$e(g)+"."+E+"."+p+y+T+"."+$e(1)+"."+$e(1)+"."+$e(1)+"."+0,r=Gt("dav1",t)}break}}return{codec:i,encrypted:n,supplemental:r}}function Gt(a,e){const t=z(e,["dvvC"]),s=t.length?t[0]:z(e,["dvcC"])[0];if(s){const i=s[2]>>1&127,r=s[2]<<5&32|s[3]>>3&31;return a+"."+$e(i)+"."+$e(r)}}function qo(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function Cs(a,e){const t=e+5;for(;a[e++]&128&&e{const r=s.subarray(8,24);r.some(n=>n!==0)||(ie.log(`[eme] Patching keyId in 'enc${i?"a":"v"}>sinf>>tenc' box: ${pe(r)} -> ${pe(t)}`),s.set(t,8))})}function zo(a){const e=[];return In(a,t=>e.push(t.subarray(8,24))),e}function In(a,e){z(a,["moov","trak"]).forEach(s=>{const i=z(s,["mdia","minf","stbl","stsd"])[0];if(!i)return;const r=i.subarray(8);let n=z(r,["enca"]);const o=n.length>0;o||(n=z(r,["encv"])),n.forEach(c=>{const l=o?c.subarray(28):c.subarray(78);z(l,["sinf"]).forEach(d=>{const u=Ln(d);u&&e(u,o)})})})}function Ln(a){const e=z(a,["schm"])[0];if(e){const t=de(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const s=z(a,["schi","tenc"])[0];if(s)return s}}}function Qo(a,e,t){const s={},i=z(a,["moof","traf"]);for(let r=0;rs[r].duration)){let r=1/0,n=0;const o=z(a,["sidx"]);for(let c=0;cd+u.info.duration||0,0);n=Math.max(n,h+l.earliestPresentationTime/l.timescale)}}n&&M(n)&&Object.keys(s).forEach(c=>{s[c].duration||(s[c].duration=n*s[c].timescale-s[c].start)})}return s}function Zo(a){const e={valid:null,remainder:null},t=z(a,["moof"]);if(t.length<2)return e.remainder=a,e;const s=t[t.length-1];return e.valid=a.slice(0,s.byteOffset-8),e.remainder=a.slice(s.byteOffset-8),e}function Pe(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function ir(a,e){const t=[],s=e.samples,i=e.timescale,r=e.id;let n=!1;return z(s,["moof"]).map(c=>{const l=c.byteOffset-8;z(c,["traf"]).map(d=>{const u=z(d,["tfdt"]).map(f=>{const g=f[0];let E=W(f,4);return g===1&&(E*=Math.pow(2,32),E+=W(f,8)),E/i})[0];return u!==void 0&&(a=u),z(d,["tfhd"]).map(f=>{const g=W(f,4),E=W(f,0)&16777215,p=(E&1)!==0,y=(E&2)!==0,T=(E&8)!==0;let v=0;const S=(E&16)!==0;let x=0;const D=(E&32)!==0;let A=8;g===r&&(p&&(A+=8),y&&(A+=4),T&&(v=W(f,A),A+=4),S&&(x=W(f,A),A+=4),D&&(A+=4),e.type==="video"&&(n=xs(e.codec)),z(d,["trun"]).map(R=>{const _=R[0],I=W(R,0)&16777215,P=(I&1)!==0;let F=0;const U=(I&4)!==0,H=(I&256)!==0;let $=0;const k=(I&512)!==0;let G=0;const N=(I&1024)!==0,K=(I&2048)!==0;let Y=0;const w=W(R,4);let O=8;P&&(F=W(R,O),O+=4),U&&(O+=4);let q=F+l;for(let ee=0;ee>1&63;return t===39||t===40}else return(e&31)===6}function vi(a,e,t,s){const i=Rn(a);let r=0;r+=e;let n=0,o=0,c=0;for(;r=i.length)break;c=i[r++],n+=c}while(c===255);o=0;do{if(r>=i.length)break;c=i[r++],o+=c}while(c===255);const l=i.length-r;let h=r;if(ol){ie.error(`Malformed SEI payload. ${o} is too small, only ${l} bytes left to parse.`);break}if(n===4){if(i[h++]===181){const u=Sn(i,h);if(h+=2,u===49){const f=W(i,h);if(h+=4,f===1195456820){const g=i[h++];if(g===3){const E=i[h++],p=31&E,y=64&E,T=y?2+p*3:0,v=new Uint8Array(T);if(y){v[0]=E;for(let S=1;S16){const d=[];for(let g=0;g<16;g++){const E=i[h++].toString(16);d.push(E.length==1?"0"+E:E),(g===3||g===5||g===7||g===9)&&d.push("-")}const u=o-16,f=new Uint8Array(u);for(let g=0;g>24&255,r[1]=s>>16&255,r[2]=s>>8&255,r[3]=s&255,r.set(a,4),i=0,s=8;i0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;const n=new Uint8Array(4);return t.byteLength>0&&new DataView(n.buffer).setUint32(0,t.byteLength,!1),tl([112,115,115,104],new Uint8Array([s,0,0,0]),a,r,i,n,t)}function il(a){const e=[];if(a instanceof ArrayBuffer){const t=a.byteLength;let s=0;for(;s+32>>24;if(r!==0&&r!==1)return{offset:t,size:e};const n=a.buffer,o=pe(new Uint8Array(n,t+12,16));let c=null,l=null,h=0;if(r===0)h=28;else{const u=a.getUint32(28);if(!u||s<32+u*16)return{offset:t,size:e};c=[];for(let f=0;f/\(Windows.+Firefox\//i.test(navigator.userAgent),It={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Si(a,e){const t=It[e];return!!t&&!!t[a.slice(0,4)]}function wt(a,e,t=!0){return!a.split(",").some(s=>!xi(s,e,t))}function xi(a,e,t=!0){var s;const i=st(t);return(s=i?.isTypeSupported(Ot(a,e)))!=null?s:!1}function Ot(a,e){return`${e}/mp4;codecs=${a}`}function rr(a){if(a){const e=a.substring(0,4);return It.video[e]}return 2}function ds(a){const e=bn();return a.split(",").reduce((t,s)=>{const r=e&&xs(s)?9:It.video[s];return r?(r*2+t)/(t?3:2):(It.audio[s]+t)/(t?2:1)},0)}const Ps={};function nl(a,e=!0){if(Ps[a])return Ps[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[a];for(let i=0;inl(t.toLowerCase(),e))}function ol(a,e){const t=[];if(a){const s=a.split(",");for(let i=0;i4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1)&&(nr(a,"audio")||nr(a,"video")))return a;if(e){const t=e.split(",");if(t.length>1){if(a){for(let s=t.length;s--;)if(t[s].substring(0,4)===a.substring(0,4))return t[s]}return t[0]}}return e||a}function nr(a,e){return Si(a,e)&&xi(a,e)}function ll(a){const e=a.split(",");for(let t=0;t2&&s[0]==="avc1"&&(e[t]=`avc1.${parseInt(s[1]).toString(16)}${("000"+parseInt(s[2]).toString(16)).slice(-4)}`)}return e.join(",")}function cl(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let s=e.length;s>4&&s<10;s++)e[s]=t[s-4];return e.join(".")}return a}function ar(a){const e=st(a)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function ti(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const hl={supported:!0,powerEfficient:!0,smooth:!0},dl={supported:!1,smooth:!1,powerEfficient:!1},_n={supported:!0,configurations:[],decodingInfoResults:[hl]};function Dn(a,e){return{supported:!1,configurations:e,decodingInfoResults:[dl],error:a}}function ul(a,e,t,s,i,r){const n=a.videoCodec,o=a.audioCodec?a.audioGroups:null,c=r?.audioCodec,l=r?.channels,h=l?parseInt(l):c?1/0:2;let d=null;if(o!=null&&o.length)try{o.length===1&&o[0]?d=e.groups[o[0]].channels:d=o.reduce((u,f)=>{if(f){const g=e.groups[f];if(!g)throw new Error(`Audio track group ${f} not found`);Object.keys(g.channels).forEach(E=>{u[E]=(u[E]||0)+g.channels[E]})}return u},{2:0})}catch{return!0}return n!==void 0&&(n.split(",").some(u=>xs(u))||a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(s,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(i,8e6))||!!d&&M(h)&&Object.keys(d).some(u=>parseInt(u)>h)}function Cn(a,e,t,s={}){const i=a.videoCodec;if(!i&&!a.audioCodec||!t)return Promise.resolve(_n);const r=[],n=fl(a),o=n.length,c=gl(a,e,o>0),l=c.length;for(let h=o||1*l||1;h--;){const d={type:"media-source"};if(o&&(d.video=n[h%o]),l){d.audio=c[h%l];const u=d.audio.bitrate;d.video&&u&&(d.video.bitrate-=u)}r.push(d)}if(i){const h=navigator.userAgent;if(i.split(",").some(d=>xs(d))&&bn())return Promise.resolve(Dn(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${h})`),r))}return Promise.all(r.map(h=>{const d=pl(h);return s[d]||(s[d]=t.decodingInfo(h))})).then(h=>({supported:!h.some(d=>!d.supported),configurations:r,decodingInfoResults:h})).catch(h=>({supported:!1,configurations:r,decodingInfoResults:[],error:h}))}function fl(a){var e;const t=(e=a.videoCodec)==null?void 0:e.split(","),s=Pn(a),i=a.width||640,r=a.height||480,n=a.frameRate||30,o=a.videoRange.toLowerCase();return t?t.map(c=>{const l={contentType:Ot(cl(c),"video"),width:i,height:r,bitrate:s,framerate:n};return o!=="sdr"&&(l.transferFunction=o),l}):[]}function gl(a,e,t){var s;const i=(s=a.audioCodec)==null?void 0:s.split(","),r=Pn(a);return i&&a.audioGroups?a.audioGroups.reduce((n,o)=>{var c;const l=o?(c=e.groups[o])==null?void 0:c.tracks:null;return l?l.reduce((h,d)=>{if(d.groupId===o){const u=parseFloat(d.channels||"");i.forEach(f=>{const g={contentType:Ot(f,"audio"),bitrate:t?ml(f,r):r};u&&(g.channels=""+u),h.push(g)})}return h},n):n},[]):[]}function ml(a,e){if(e<=1)return 1;let t=128e3;return a==="ec-3"?t=768e3:a==="ac-3"&&(t=64e4),Math.min(e/2,t)}function Pn(a){return Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)/1e3)*1e3||1}function pl(a){let e="";const{audio:t,video:s}=a;if(s){const i=ti(s.contentType);e+=`${i}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||"sd"}_${Math.ceil(s.bitrate/1e5)}`}if(t){const i=ti(t.contentType);e+=`${s?"_":""}${i}_c${t.channels}`}return e}const si=["NONE","TYPE-0","TYPE-1",null];function El(a){return si.indexOf(a)>-1}const fs=["SDR","PQ","HLG"];function yl(a){return!!a&&fs.indexOf(a)>-1}var rs={No:"",Yes:"YES",v2:"v2"};function or(a){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=a,i=s!!s).map(s=>s.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const s=(t=e.supplemental)==null?void 0:t.videoCodec;s&&s!==e.videoCodec&&(this.codecSet+=`,${s.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return cr(this._audioGroups,e)}hasSubtitleGroup(e){return cr(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(t)===-1&&s.push(t)}else if(e==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(t)===-1&&s.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function cr(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function Tl(){if(typeof matchMedia=="function"){const a=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(a.media!==e.media)return a.matches===!0}return!1}function vl(a,e){let t=!1,s=[];if(a&&(t=a!=="SDR",s=[a]),e){s=e.allowedVideoRanges||fs.slice(0);const i=s.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:i&&Tl(),t||(s=["SDR"])}return{preferHDR:t,allowedVideoRanges:s}}const Sl=a=>{const e=new WeakSet;return(t,s)=>{if(a&&(s=a(t,s)),typeof s=="object"&&s!==null){if(e.has(s))return;e.add(s)}return s}},ae=(a,e)=>JSON.stringify(a,Sl(e));function xl(a,e,t,s,i){const r=Object.keys(a),n=s?.channels,o=s?.audioCodec,c=i?.videoCodec,l=n&&parseInt(n)===2;let h=!1,d=!1,u=1/0,f=1/0,g=1/0,E=1/0,p=0,y=[];const{preferHDR:T,allowedVideoRanges:v}=vl(e,i);for(let R=r.length;R--;){const _=a[r[R]];h||(h=_.channels[2]>0),u=Math.min(u,_.minHeight),f=Math.min(f,_.minFramerate),g=Math.min(g,_.minBitrate),v.filter(P=>_.videoRanges[P]>0).length>0&&(d=!0)}u=M(u)?u:0,f=M(f)?f:0;const S=Math.max(1080,u),x=Math.max(30,f);g=M(g)?g:t,t=Math.max(g,t),d||(e=void 0);const D=r.length>1;return{codecSet:r.reduce((R,_)=>{const I=a[_];if(_===R)return R;if(y=d?v.filter(P=>I.videoRanges[P]>0):[],D){if(I.minBitrate>t)return Be(_,`min bitrate of ${I.minBitrate} > current estimate of ${t}`),R;if(!I.hasDefaultAudio)return Be(_,"no renditions with default or auto-select sound found"),R;if(o&&_.indexOf(o.substring(0,4))%5!==0)return Be(_,`audio codec preference "${o}" not found`),R;if(n&&!l){if(!I.channels[n])return Be(_,`no renditions with ${n} channel sound found (channels options: ${Object.keys(I.channels)})`),R}else if((!o||l)&&h&&I.channels[2]===0)return Be(_,"no renditions with stereo sound found"),R;if(I.minHeight>S)return Be(_,`min resolution of ${I.minHeight} > maximum of ${S}`),R;if(I.minFramerate>x)return Be(_,`min framerate of ${I.minFramerate} > maximum of ${x}`),R;if(!y.some(P=>I.videoRanges[P]>0))return Be(_,`no variants with VIDEO-RANGE of ${ae(y)} found`),R;if(c&&_.indexOf(c.substring(0,4))%5!==0)return Be(_,`video codec preference "${c}" not found`),R;if(I.maxScore=ds(R)||I.fragmentError>a[R].fragmentError)?R:(E=I.minIndex,p=I.maxScore,_)},void 0),videoRanges:y,preferHDR:T,minFramerate:f,minBitrate:g,minIndex:E}}function Be(a,e){ie.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function kn(a){return a.reduce((e,t)=>{let s=e.groups[t.groupId];s||(s=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(t);const i=t.channels||"2";return s.channels[i]=(s.channels[i]||0)+1,s.hasDefault=s.hasDefault||t.default,s.hasAutoSelect=s.hasAutoSelect||t.autoselect,s.hasDefault&&(e.hasDefaultAudio=!0),s.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Al(a,e,t,s){return a.slice(t,s+1).reduce((i,r,n)=>{if(!r.codecSet)return i;const o=r.audioGroups;let c=i[r.codecSet];c||(i[r.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:n,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,r.bitrate);const l=Math.min(r.height,r.width);return c.minHeight=Math.min(c.minHeight,l),c.minFramerate=Math.min(c.minFramerate,r.frameRate),c.minIndex=Math.min(c.minIndex,n),c.maxScore=Math.max(c.maxScore,r.score),c.fragmentError+=r.fragmentError,c.videoRanges[r.videoRange]=(c.videoRanges[r.videoRange]||0)+1,o&&o.forEach(h=>{if(!h)return;const d=e.groups[h];d&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(u=>{c.channels[u]=(c.channels[u]||0)+d.channels[u]}))}),i},{})}function hr(a){if(!a)return a;const{lang:e,assocLang:t,characteristics:s,channels:i,audioCodec:r}=a;return{lang:e,assocLang:t,characteristics:s,channels:i,audioCodec:r}}function Ke(a,e,t){if("attrs"in a){const s=e.indexOf(a);if(s!==-1)return s}for(let s=0;ss.indexOf(i)===-1)}function ct(a,e){const{audioCodec:t,channels:s}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(s===void 0||s===(e.channels||"2"))}function Rl(a,e,t,s,i){const r=e[s],o=e.reduce((u,f,g)=>{const E=f.uri;return(u[E]||(u[E]=[])).push(g),u},{})[r.uri];o.length>1&&(s=Math.max.apply(Math,o));const c=r.videoRange,l=r.frameRate,h=r.codecSet.substring(0,4),d=dr(e,s,u=>{if(u.videoRange!==c||u.frameRate!==l||u.codecSet.substring(0,4)!==h)return!1;const f=u.audioGroups,g=t.filter(E=>!f||f.indexOf(E.groupId)!==-1);return Ke(a,g,i)>-1});return d>-1?d:dr(e,s,u=>{const f=u.audioGroups,g=t.filter(E=>!f||f.indexOf(E.groupId)!==-1);return Ke(a,g,i)>-1})}function dr(a,e,t){for(let s=e;s>-1;s--)if(t(a[s]))return s;for(let s=e+1;s{var s;const{fragCurrent:i,partCurrent:r,hls:n}=this,{autoLevelEnabled:o,media:c}=n;if(!i||!c)return;const l=performance.now(),h=r?r.stats:i.stats,d=r?r.duration:i.duration,u=l-h.loading.start,f=n.minAutoLevel,g=i.level,E=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||g<=f){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const p=E>-1&&E!==g,y=!!t||p;if(!y&&(c.paused||!c.playbackRate||!c.readyState))return;const T=n.mainForwardBufferInfo;if(!y&&T===null)return;const v=this.bwEstimator.getEstimateTTFB(),S=Math.abs(c.playbackRate);if(u<=Math.max(v,1e3*(d/(S*2))))return;const x=T?T.len/S:0,D=h.loading.first?h.loading.first-h.loading.start:-1,A=h.loaded&&D>-1,R=this.getBwEstimate(),_=n.levels,I=_[g],P=Math.max(h.loaded,Math.round(d*(i.bitrate||I.averageBitrate)/8));let F=A?u-D:u;F<1&&A&&(F=Math.min(u,h.loaded*8/R));const U=A?h.loaded*1e3/F:0,H=v/1e3,$=U?(P-h.loaded)/U:P*8/R+H;if($<=x)return;const k=U?U*8:R,G=((s=t?.details||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,N=this.hls.config.abrBandWidthUpFactor;let K=Number.POSITIVE_INFINITY,Y;for(Y=g-1;Y>f;Y--){const ee=_[Y].maxBitrate,X=!_[Y].details||G;if(K=this.getTimeToLoadFrag(H,k,d*ee,X),K=$||K>d*10)return;A?this.bwEstimator.sample(u-Math.min(v,D),h.loaded):this.bwEstimator.sampleTTFB(u);const w=_[Y].maxBitrate;this.getBwEstimate()*N>w&&this.resetEstimator(w);const O=this.findBestLevel(w,f,Y,0,x,1,1);O>-1&&(Y=O),this.warn(`Fragment ${i.sn}${r?" part "+r.index:""} of level ${g} is loading too slowly; + Fragment duration: ${i.duration.toFixed(3)} + Time to underbuffer: ${x.toFixed(3)} s + Estimated load time for current fragment: ${$.toFixed(3)} s + Estimated load time for down switch fragment: ${K.toFixed(3)} s + TTFB estimate: ${D|0} ms + Current BW estimate: ${M(R)?R|0:"Unknown"} bps + New BW estimate: ${this.getBwEstimate()|0} bps + Switching to level ${Y} @ ${w|0} bps`),n.nextLoadLevel=n.nextAutoLevel=Y,this.clearTimer();const q=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===Y&&Y>0){const ee=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${Y>0?"and switching down":""} + Fragment duration: ${i.duration.toFixed(3)} s + Time to underbuffer: ${ee.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,Y>f){let X=this.findBestLevel(this.hls.levels[f].bitrate,f,Y,0,ee,1,1);X===-1&&(X=f),this.hls.nextLoadLevel=this.hls.nextAutoLevel=X,this.resetEstimator(this.hls.levels[X].bitrate)}}};p||$>K*2?q():this.timer=self.setInterval(q,K*1e3),n.trigger(m.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:r,stats:h})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new ko(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.FRAG_LOADING,this.onFragLoading,this),e.on(m.FRAG_LOADED,this.onFragLoaded,this),e.on(m.FRAG_BUFFERED,this.onFragBuffered,this),e.on(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(m.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(m.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.FRAG_LOADING,this.onFragLoading,this),e.off(m.FRAG_LOADED,this.onFragLoaded,this),e.off(m.FRAG_BUFFERED,this.onFragBuffered,this),e.off(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(m.LEVEL_LOADED,this.onLevelLoaded,this),e.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(m.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(m.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const s=t.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var i;this.fragCurrent=s,this.partCurrent=(i=t.part)!=null?i:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case b.BUFFER_ADD_CODEC_ERROR:case b.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case b.FRAG_LOAD_TIMEOUT:{const s=t.frag,{fragCurrent:i,partCurrent:r}=this;if(s&&i&&s.sn===i.sn&&s.level===i.level){const n=performance.now(),o=r?r.stats:s.stats,c=n-o.loading.start,l=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&l>-1){const d=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(d,l),o.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,s,i){const r=e+s/t,n=i?e+this.lastLevelLoadSec:0;return r+n}onLevelLoaded(e,t){const s=this.hls.config,{loading:i}=t.stats,r=i.end-i.first;M(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:s}){const i=s?s.stats:t.stats;if(t.type===B.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const r=s?s.duration:t.duration,n=this.hls.levels[t.level],o=(n.loaded?n.loaded.bytes:0)+i.loaded,c=(n.loaded?n.loaded.duration:0)+r;n.loaded={bytes:o,duration:c},n.realBitrate=Math.round(8*o/c)}if(t.bitrateTest){const r={stats:i,frag:t,part:s,id:t.type};this.onFragBuffered(m.FRAG_BUFFERED,r),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:s,part:i}=t,r=i!=null&&i.stats.loaded?i.stats:s.stats;if(r.aborted||this.ignoreFragment(s))return;const n=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(n,r.loaded),r.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=n/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==B.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,s=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,r=this.findBestLevel(s,t,e,0,i,1,1);if(r>-1)return r;const n=this.hls.firstLevel,o=Math.min(Math.max(n,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${n} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!s||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const r=s&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const n=this.hls.levels;if(n.length>Math.max(e,r)&&n[e].loadError<=n[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:s}=this;if(s.levels.length<=1)return s.loadLevel;const{maxAutoLevel:i,config:r,minAutoLevel:n}=s,o=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),l=this.getStarvationDelay();let h=r.abrBandWidthFactor,d=r.abrBandWidthUpFactor;if(l){const p=this.findBestLevel(c,n,i,l,0,h,d);if(p>=0)return this.rebufferNotice=-1,p}let u=o?Math.min(o,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const p=this.bitrateTestDelay;p&&(u=(o?Math.min(o,r.maxLoadingDelay):r.maxLoadingDelay)-p,this.info(`bitrate test took ${Math.round(1e3*p)}ms, set first fragment max fetchDuration to ${Math.round(1e3*u)} ms`),h=d=1)}const f=this.findBestLevel(c,n,i,l,u,h,d);if(this.rebufferNotice!==f&&(this.rebufferNotice=f,this.info(`${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${f}`)),f>-1)return f;const g=s.levels[n],E=s.loadLevelObj;return E&&g?.bitrate=t;k--){var $;const G=g[k],N=k>d;if(!G)continue;if(y.useMediaCapabilities&&!G.supportedResult&&!G.supportedPromise){const X=navigator.mediaCapabilities;typeof X?.decodingInfo=="function"&&ul(G,I,D,A,e,R)?(G.supportedPromise=Cn(G,I,X,this.supportedCache),G.supportedPromise.then(Z=>{if(!this.hls)return;G.supportedResult=Z;const ye=this.hls.levels,ge=ye.indexOf(G);Z.error?this.warn(`MediaCapabilities decodingInfo error: "${Z.error}" for level ${ge} ${ae(Z)}`):Z.supported?Z.decodingInfoResults.some(De=>De.smooth===!1||De.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${ge} not smooth or powerEfficient: ${ae(Z)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${ge} ${ae(Z)}`),ge>-1&&ye.length>1&&(this.log(`Removing unsupported level ${ge}`),this.hls.removeLevel(ge),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(Z=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${Z}`)})):G.supportedResult=_n}if((x&&G.codecSet!==x||D&&G.videoRange!==D||N&&A>G.frameRate||!N&&A>0&&AX.smooth===!1))&&(!S||k!==P)){H.push(k);continue}const K=G.details,Y=(f?K?.partTarget:K?.averagetargetduration)||F;let w;N?w=o*e:w=n*e;const O=F&&i>=F*2&&r===0?G.averageBitrate:G.maxBitrate,q=this.getTimeToLoadFrag(U,w,O*Y,K===void 0);if(w>=O&&(k===h||G.loadError===0&&G.fragmentError===0)&&(q<=U||!M(q)||v&&!this.bitrateTestDelay||q${k} adjustedbw(${Math.round(w)})-bitrate=${Math.round(w-O)} ttfb:${U.toFixed(1)} avgDuration:${Y.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${q.toFixed(1)} firstSelection:${S} codecSet:${G.codecSet} videoRange:${G.videoRange} hls.loadLevel:${p}`)),S&&(this.firstSelection=k),k}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:s}=this.hls;return Math.min(Math.max(e,s),t)}}const wn={search:function(a,e){let t=0,s=a.length-1,i=null,r=null;for(;t<=s;){i=(t+s)/2|0,r=a[i];const n=e(r);if(n>0)t=i+1;else if(n<0)s=i-1;else return r}return null}};function _l(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!M(e))return null;const s=a[0].programDateTime;if(e<(s||0))return null;const i=a[a.length-1].endProgramDateTime;if(e>=(i||0))return null;for(let r=0;r0&&o<15e-7&&(t+=15e-7),r&&a.level!==r.level&&r.end<=a.end&&(r=e[2+a.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&((!a||a.level===r.level)&&ur(t,s,r)===0||Dl(r,a,Math.min(i,s))))return r;const n=wn.search(e,ur.bind(null,t,s));return n&&(n!==a||!r)?n:r}function Dl(a,e,t){if(e&&e.start===0&&e.level0){const s=e.tagList.reduce((i,r)=>(r[0]==="INF"&&(i+=parseFloat(r[1])),i),t);return a.start<=s}return!1}function ur(a=0,e=0,t){if(t.start<=a&&t.start+t.duration>a)return 0;const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-s<=a?1:t.start-s>a&&t.start?-1:0}function Cl(a,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>a}function On(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){let s=a.fragments;const{fragmentHint:i}=a;i&&(s=s.concat(i));let r;return wn.search(s,n=>n.cce?-1:(r=n,n.end<=t?1:n.start>t?-1:0)),r||null}return null}function ms(a){switch(a.details){case b.FRAG_LOAD_TIMEOUT:case b.KEY_LOAD_TIMEOUT:case b.LEVEL_LOAD_TIMEOUT:case b.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Fn(a){return a.details.startsWith("key")}function Mn(a){return Fn(a)&&!!a.frag&&!a.frag.decryptdata}function fr(a,e){const t=ms(e);return a.default[`${t?"timeout":"error"}Retry`]}function Ai(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function gr(a){return se(se({},a),{errorRetry:null,timeoutRetry:null})}function ps(a,e,t,s){if(!a)return!1;const i=s?.code,r=e499)}function ii(a){return a===0&&navigator.onLine===!1}var me={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},Ie={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};class kl extends ke{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(m.ERROR,this.onError,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(m.ERROR,this.onError,this),e.off(m.ERROR,this.onErrorOut,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===B.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,s=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||s===-1?t.loadLevel:s}variantHasKey(e,t){if(e){var s;if((s=e.details)!=null&&s.hasKey(t))return!0;const i=e.audioGroups;if(i)return this.hls.allAudioTracks.filter(n=>i.indexOf(n.groupId)>=0).some(n=>{var o;return(o=n.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var s;if(t.fatal)return;const i=this.hls,r=t.context;switch(t.details){case b.FRAG_LOAD_ERROR:case b.FRAG_LOAD_TIMEOUT:case b.KEY_LOAD_ERROR:case b.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case b.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction=vt();return}case b.FRAG_GAP:case b.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=me.SendAlternateToPenaltyBox;return}case b.LEVEL_EMPTY_ERROR:case b.LEVEL_PARSING_ERROR:{var n;const c=t.parent===B.MAIN?t.level:i.loadLevel;t.details===b.LEVEL_EMPTY_ERROR&&((n=t.context)!=null&&(n=n.levelDetails)!=null&&n.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case b.LEVEL_LOAD_ERROR:case b.LEVEL_LOAD_TIMEOUT:typeof r?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level));return;case b.AUDIO_TRACK_LOAD_ERROR:case b.AUDIO_TRACK_LOAD_TIMEOUT:case b.SUBTITLE_LOAD_ERROR:case b.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const c=i.loadLevelObj;if(c&&(r.type===Q.AUDIO_TRACK&&c.hasAudioGroup(r.groupId)||r.type===Q.SUBTITLE_TRACK&&c.hasSubtitleGroup(r.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=me.SendAlternateToPenaltyBox,t.errorAction.flags=Ie.MoveAllAlternatesMatchingHost;return}}return;case b.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:me.SendAlternateToPenaltyBox,flags:Ie.MoveAllAlternatesMatchingHDCP};return;case b.KEY_SYSTEM_SESSION_UPDATE_FAILED:case b.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case b.KEY_SYSTEM_NO_SESSION:t.errorAction={action:me.SendAlternateToPenaltyBox,flags:Ie.MoveAllAlternatesMatchingKey};return;case b.BUFFER_ADD_CODEC_ERROR:case b.REMUX_ALLOC_ERROR:case b.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:i.loadLevel)}return;case b.INTERNAL_EXCEPTION:case b.BUFFER_APPENDING_ERROR:case b.BUFFER_FULL_ERROR:case b.LEVEL_SWITCH_ERROR:case b.BUFFER_STALLED_ERROR:case b.BUFFER_SEEK_OVER_HOLE:case b.BUFFER_NUDGE_ON_STALL:t.errorAction=vt();return}t.type===V.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=vt())}getPlaylistRetryOrSwitchAction(e,t){const s=this.hls,i=fr(s.config.playlistLoadPolicy,e),r=this.playlistError++;if(ps(i,r,ms(e),e.response))return{action:me.RetryRequest,flags:Ie.None,retryConfig:i,retryCount:r};const o=this.getLevelSwitchAction(e,t);return i&&(o.retryConfig=i,o.retryCount=r),o}getFragRetryOrSwitchAction(e){const t=this.hls,s=this.getVariantLevelIndex(e.frag),i=t.levels[s],{fragLoadPolicy:r,keyLoadPolicy:n}=t.config,o=fr(Fn(e)?n:r,e),c=t.levels.reduce((h,d)=>h+d.fragmentError,0);if(i&&(e.details!==b.FRAG_GAP&&i.fragmentError++,!Mn(e)&&ps(o,c,ms(e),e.response)))return{action:me.RetryRequest,flags:Ie.None,retryConfig:o,retryCount:c};const l=this.getLevelSwitchAction(e,s);return o&&(l.retryConfig=o,l.retryCount=c),l}getLevelSwitchAction(e,t){const s=this.hls;t==null&&(t=s.loadLevel);const i=this.hls.levels[t];if(i){var r,n;const l=e.details;i.loadError++,l===b.BUFFER_APPEND_ERROR&&i.fragmentError++;let h=-1;const{levels:d,loadLevel:u,minAutoLevel:f,maxAutoLevel:g}=s;!s.autoLevelEnabled&&!s.config.preserveManualLevelOnError&&(s.loadLevel=-1);const E=(r=e.frag)==null?void 0:r.type,y=(E===B.AUDIO&&l===b.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(l===b.BUFFER_ADD_CODEC_ERROR||l===b.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:D})=>i.audioCodec!==D),v=e.sourceBufferName==="video"&&(l===b.BUFFER_ADD_CODEC_ERROR||l===b.BUFFER_APPEND_ERROR)&&d.some(({codecSet:D,audioCodec:A})=>i.codecSet!==D&&i.audioCodec===A),{type:S,groupId:x}=(n=e.context)!=null?n:{};for(let D=d.length;D--;){const A=(D+u)%d.length;if(A!==u&&A>=f&&A<=g&&d[A].loadError===0){var o,c;const R=d[A];if(l===b.FRAG_GAP&&E===B.MAIN&&e.frag){const _=d[A].details;if(_){const I=dt(e.frag,_.fragments,e.frag.start);if(I!=null&&I.gap)continue}}else{if(S===Q.AUDIO_TRACK&&R.hasAudioGroup(x)||S===Q.SUBTITLE_TRACK&&R.hasSubtitleGroup(x))continue;if(E===B.AUDIO&&(o=i.audioGroups)!=null&&o.some(_=>R.hasAudioGroup(_))||E===B.SUBTITLE&&(c=i.subtitleGroups)!=null&&c.some(_=>R.hasSubtitleGroup(_))||y&&i.audioCodec===R.audioCodec||v&&i.codecSet===R.codecSet||!y&&i.codecSet!==R.codecSet)continue}h=A;break}}if(h>-1&&s.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:me.SendAlternateToPenaltyBox,flags:Ie.None,nextAutoLevel:h}}return{action:me.SendAlternateToPenaltyBox,flags:Ie.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case me.DoNothing:break;case me.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==b.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,s=e.errorAction;if(!s)return;const{flags:i}=s,r=s.nextAutoLevel;switch(i){case Ie.None:this.switchLevel(e,r);break;case Ie.MoveAllAlternatesMatchingHDCP:{const c=this.getVariantLevelIndex(e.frag),l=t.levels[c],h=l?.attrs["HDCP-LEVEL"];if(s.hdcpLevel=h,h==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(h){t.maxHdcpLevel=si[si.indexOf(h)-1],s.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case Ie.MoveAllAlternatesMatchingKey:{const c=e.decryptdata;if(c){const l=this.hls.levels,h=l.length;for(let u=h;u--;)if(this.variantHasKey(l[u],c)){var n,o;this.log(`Banned key found in level ${u} (${l[u].bitrate}bps) or audio group "${(n=l[u].audioGroups)==null?void 0:n.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${pe(c.keyId||[])}`),l[u].fragmentError++,l[u].loadError++,this.log(`Removing level ${u} with key error (${e.error})`),this.hls.removeLevel(u)}const d=e.frag;if(this.hls.levels.length{const c=this.fragments[o];if(!c||n>=c.body.sn)return;if(!c.buffered&&(!c.loaded||r)){c.body.type===s&&this.removeFragment(c.body);return}const l=c.range[e];if(l){if(l.time.length===0){this.removeFragment(c.body);return}l.time.some(h=>{const d=!this.isTimeBuffered(h.startPTS,h.endPTS,t);return d&&this.removeFragment(c.body),d})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const s=e.frag,i=gt(s),r=this.fragments[i];if(!r||r.buffered&&s.gap)return;const n=!s.relurl;Object.keys(t).forEach(o=>{const c=s.elementaryStreams[o];if(!c)return;const l=t[o],h=n||c.partial===!0;r.range[o]=this.getBufferedTimes(s,e.part,h,l)}),r.loaded=null,Object.keys(r.range).length?(this.bufferedEnd(r,s),Vt(r)||this.removeParts(s.sn-1,s.type)):this.removeFragment(r.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const s=this.activePartLists[t];s&&(this.activePartLists[t]=mr(s,i=>i.fragment.sn>=e))}fragBuffered(e,t){const s=gt(e);let i=this.fragments[s];!i&&t&&(i=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,this.bufferedEnd(i,e))}getBufferedTimes(e,t,s,i){const r={time:[],partial:s},n=e.start,o=e.end,c=e.minEndPTS||o,l=e.maxStartPTS||n;for(let h=0;h=d&&c<=u){r.time.push({startPTS:Math.max(n,i.start(h)),endPTS:Math.min(o,i.end(h))});break}else if(nd){const f=Math.max(n,i.start(h)),g=Math.min(o,i.end(h));g>f&&(r.partial=!0,r.time.push({startPTS:f,endPTS:g}))}else if(o<=d)break}return r}getPartialFragment(e){let t=null,s,i,r,n=0;const{bufferPadding:o,fragments:c}=this;return Object.keys(c).forEach(l=>{const h=c[l];h&&Vt(h)&&(i=h.body.start-o,r=h.body.end+o,e>=i&&e<=r&&(s=Math.min(e-i,r-e),n<=s&&(t=h.body,n=s)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Vt(t))}getState(e){const t=gt(e),s=this.fragments[t];return s?s.buffered?Vt(s)?ue.PARTIAL:ue.OK:ue.APPENDING:ue.NOT_LOADED}isTimeBuffered(e,t,s){let i,r;for(let n=0;n=i&&t<=r)return!0;if(t<=i)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const s=t.frag,i=t.part?null:t,r=gt(s);this.fragments[r]={body:s,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:s,part:i,timeRanges:r,type:n}=t;if(s.sn==="initSegment")return;const o=s.type;if(i){let l=this.activePartLists[o];l||(this.activePartLists[o]=l=[]),l.push(i)}this.timeRanges=r;const c=r[n];this.detectEvictedFragments(n,c,o,i)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=gt(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,s=Object.keys(t);if(!e)return s.length>0;for(let i=s.length;i--;){const r=t[s[i]];if(r?.body.type===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,s,i,r){i&&!this.hasGaps||Object.keys(this.fragments).forEach(n=>{const o=this.fragments[n];if(!o)return;const c=o.body;c.type!==s||i&&!c.gap||c.starte&&(o.buffered||r)&&this.removeFragment(c)})}removeFragment(e){const t=gt(e);e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const i=e.sn;this.activePartLists[e.type]=mr(s,r=>r.fragment.sn!==i)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(s=>s.clearElementaryStreamInfo())}}function Vt(a){var e,t,s;return a.buffered&&!!(a.body.gap||(e=a.range.video)!=null&&e.partial||(t=a.range.audio)!=null&&t.partial||(s=a.range.audiovideo)!=null&&s.partial)}function gt(a){return`${a.type}_${a.level}_${a.sn}`}function mr(a,e){return a.filter(t=>{const s=e(t);return s||t.clearElementaryStreamInfo(),s})}var it={cbc:0,ctr:1};class Ol{constructor(e,t,s){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=s}decrypt(e,t){switch(this.aesMode){case it.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case it.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function Fl(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class Ml{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),s=new Uint32Array(4);for(let i=0;i<4;i++)s[i]=t.getUint32(i*4);return s}initTable(){const e=this.sBox,t=this.invSBox,s=this.subMix,i=s[0],r=s[1],n=s[2],o=s[3],c=this.invSubMix,l=c[0],h=c[1],d=c[2],u=c[3],f=new Uint32Array(256);let g=0,E=0,p=0;for(p=0;p<256;p++)p<128?f[p]=p<<1:f[p]=p<<1^283;for(p=0;p<256;p++){let y=E^E<<1^E<<2^E<<3^E<<4;y=y>>>8^y&255^99,e[g]=y,t[y]=g;const T=f[g],v=f[T],S=f[v];let x=f[y]*257^y*16843008;i[g]=x<<24|x>>>8,r[g]=x<<16|x>>>16,n[g]=x<<8|x>>>24,o[g]=x,x=S*16843009^v*65537^T*257^g*16843008,l[y]=x<<24|x>>>8,h[y]=x<<16|x>>>16,d[y]=x<<8|x>>>24,u[y]=x,g?(g=T^f[f[f[S^T]]],E^=f[f[E]]):g=E=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let s=!0,i=0;for(;i{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,s,i);const c=this.flush();c?r(c.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,s,i)}softwareDecrypt(e,t,s,i){const{currentIV:r,currentResult:n,remainderData:o}=this;if(i!==it.cbc||t.byteLength!==16)return ie.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=Pe(o,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;r&&(s=r);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new Ml),l.expandKey(t);const h=n;return this.currentResult=l.decrypt(c.buffer,0,s),this.currentIV=c.slice(-16).buffer,h||null}webCryptoDecrypt(e,t,s,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,s,i));this.key=t,this.fastAesKey=new Nl(this.subtle,t,i)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Ol(this.subtle,new Uint8Array(s),i).decrypt(e.buffer,r)):Promise.reject(new Error("web crypto not initialized"))).catch(r=>(ie.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,s,i)))}onWebCryptoError(e,t,s,i){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,s,i);const n=this.flush();if(n)return n.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const s=e.length-e.length%Ul;return s!==e.length&&(t=e.slice(0,s),this.remainderData=e.slice(s)),t}logOnce(e){this.logEnabled&&(ie.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const pr=Math.pow(2,17);class $l{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const s=e.url;if(!s)return Promise.reject(new Xe({type:V.NETWORK_ERROR,details:b.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,r=i.fLoader,n=i.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(g=>g[0]==="GAP")){c(yr(e));return}else e.gap=!1;const l=this.loader=r?new r(i):new n(i),h=Er(e);e.loader=l;const d=gr(i.fragLoadPolicy.default),u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:pr};e.stats=l.stats;const f={onSuccess:(g,E,p,y)=>{this.resetLoader(e,l);let T=g.data;p.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(T.slice(0,16)),T=T.slice(16)),o({frag:e,part:null,payload:T,networkDetails:y})},onError:(g,E,p,y)=>{this.resetLoader(e,l),c(new Xe({type:V.NETWORK_ERROR,details:b.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:se({url:s,data:void 0},g),error:new Error(`HTTP Error ${g.code} ${g.text}`),networkDetails:p,stats:y}))},onAbort:(g,E,p)=>{this.resetLoader(e,l),c(new Xe({type:V.NETWORK_ERROR,details:b.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:p,stats:g}))},onTimeout:(g,E,p)=>{this.resetLoader(e,l),c(new Xe({type:V.NETWORK_ERROR,details:b.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:p,stats:g}))}};t&&(f.onProgress=(g,E,p,y)=>t({frag:e,part:null,payload:p,networkDetails:y})),l.load(h,u,f)})}loadPart(e,t,s){this.abort();const i=this.config,r=i.fLoader,n=i.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(yr(e,t));return}const l=this.loader=r?new r(i):new n(i),h=Er(e,t);e.loader=l;const d=gr(i.fragLoadPolicy.default),u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:pr};t.stats=l.stats,l.load(h,u,{onSuccess:(f,g,E,p)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const y={frag:e,part:t,payload:f.data,networkDetails:p};s(y),o(y)},onError:(f,g,E,p)=>{this.resetLoader(e,l),c(new Xe({type:V.NETWORK_ERROR,details:b.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:se({url:h.url,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:E,stats:p}))},onAbort:(f,g,E)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),c(new Xe({type:V.NETWORK_ERROR,details:b.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:E,stats:f}))},onTimeout:(f,g,E)=>{this.resetLoader(e,l),c(new Xe({type:V.NETWORK_ERROR,details:b.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:E,stats:f}))}})})}updateStatsFromPart(e,t){const s=e.stats,i=t.stats,r=i.total;if(s.loaded+=i.loaded,r){const c=Math.round(e.duration/t.duration),l=Math.min(Math.round(s.loaded/r),c),d=(c-l)*Math.round(s.loaded/l);s.total=s.loaded+d}else s.total=Math.max(s.loaded,s.total);const n=s.loading,o=i.loading;n.start?n.first+=o.first-o.start:(n.start=o.start,n.first=o.first),n.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function Er(a,e=null){const t=e||a,s={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,r=t.byteRangeEndOffset;if(M(i)&&M(r)){var n;let o=i,c=r;if(a.sn==="initSegment"&&Gl((n=a.decryptdata)==null?void 0:n.method)){const l=r-i;l%16&&(c=r+(16-l%16)),i!==0&&(s.resetIV=!0,o=i-16)}s.rangeStart=o,s.rangeEnd=c}return s}function yr(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),s={type:V.MEDIA_ERROR,details:b.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(s.part=e),(e||a).stats.aborted=!0,new Xe(s)}function Gl(a){return a==="AES-128"||a==="AES-256"}class Xe extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Nn extends ke{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class Li{constructor(e,t,s,i=0,r=-1,n=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Ht(),this.buffering={audio:Ht(),video:Ht(),audiovideo:Ht()},this.level=e,this.sn=t,this.id=s,this.size=i,this.part=r,this.partial=n}}function Ht(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Tr={length:0,start:()=>0,end:()=>0};class j{static isBuffered(e,t){if(e){const s=j.getBuffered(e);for(let i=s.length;i--;)if(t>=s.start(i)&&t<=s.end(i))return!0}return!1}static bufferedRanges(e){if(e){const t=j.getBuffered(e);return j.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let s=0;s1&&e.sort((h,d)=>h.start-d.start||d.end-h.end);let i=-1,r=[];if(s)for(let h=0;h=e[h].start&&t<=e[h].end&&(i=h);const d=r.length;if(d){const u=r[d-1].end;e[h].start-uu&&(r[d-1].end=e[h].end):r.push(e[h])}else r.push(e[h])}else r=e;let n=0,o,c=t,l=t;for(let h=0;h=d&&t<=u&&(i=h),t+s>=d&&t{const i=s.substring(2,s.length-1),r=t?.[i];return r===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),s):r})}return e}function Sr(a,e,t){let s=a.variableList;s||(a.variableList=s={});let i,r;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const n=new self.URL(t).searchParams;if(n.has(i))r=n.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(n){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${n.message}`))}}else i=e.NAME,r=e.VALUE;i in s?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):s[i]=r||""}function Kl(a,e,t){const s=e.IMPORT;if(t&&s in t){let i=a.variableList;i||(a.variableList=i={}),i[s]=t[s]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}const Vl=/^(\d+)x(\d+)$/,xr=/(.+?)=(".*?"|.*?)(?:,|$)/g;class oe{constructor(e,t){typeof e=="string"&&(e=oe.parseAttrList(e,t)),re(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const s=new Uint8Array(t.length/2);for(let i=0;iNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const s=this[e];return s?parseFloat(s):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const s=this[e];return(s?s.split(/[ ,]+/):[]).reduce((i,r)=>(i[r.toLowerCase()]=!0,i),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Vl.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let s;const i={};for(xr.lastIndex=0;(s=xr.exec(e))!==null;){const n=s[1].trim();let o=s[2];const c=o.indexOf('"')===0&&o.lastIndexOf('"')===o.length-1;let l=!1;if(c)o=o.slice(1,-1);else switch(n){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":l=!0}if(t&&(c||l))o=ri(t,o);else if(!l&&!c)switch(n){case"CLOSED-CAPTIONS":if(o==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":ie.warn(`${e}: attribute ${n} is missing quotes`)}i[n]=o}return i}}const Hl="com.apple.hls.interstitial";function Yl(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function Wl(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class Un{constructor(e,t,s=0){var i;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=(i=t?.tagOrder)!=null?i:s,t){const r=t.attr;for(const n in r)if(Object.prototype.hasOwnProperty.call(e,n)&&e[n]!==r[n]){ie.warn(`DATERANGE tag attribute: "${n}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=n;break}e=re(new oe({}),r,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const r=t?.endDate||new Date(this.attr["END-DATE"]);M(r.getTime())&&(this._endDate=r)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(ie.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(M(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===Hl}get isValid(){return!!this.id&&!this._badValueForSameId&&M(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const jl=10;class ql{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&s>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let s=t.decryptdata;return s||(t.setKeyFormat(e.keyFormat),s=t.decryptdata),!!s&&e.matches(s)})}get hasProgramDateTime(){return this.fragments.length?M(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||jl}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let s=e.length;s--;)if(e[s].index>t)return e[s].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function Es(a,e){return a.length===e.length?!a.some((t,s)=>t!==e[s]):!1}function Ar(a,e){return!a&&!e?!0:!a||!e?!1:Es(a,e)}function St(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function Ri(a){switch(a){case"AES-128":case"AES-256":return it.cbc;case"AES-256-CTR":return it.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function bi(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function ni(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function Xl(a){const e=ni(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function $n(a){const e=function(s,i,r){const n=s[i];s[i]=s[r],s[r]=n};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function Gn(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const s=e[1].split(";"),i=s[s.length-1].split(",");if(i.length===2){const r=i[0]==="base64",n=i[1];r?(s.splice(-1,1),t=bi(n)):t=Xl(n)}}return t}const ys=typeof self<"u"?self:void 0;var le={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Ee={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function ns(a){switch(a){case Ee.FAIRPLAY:return le.FAIRPLAY;case Ee.PLAYREADY:return le.PLAYREADY;case Ee.WIDEVINE:return le.WIDEVINE;case Ee.CLEARKEY:return le.CLEARKEY}}function ks(a){switch(a){case le.FAIRPLAY:return Ee.FAIRPLAY;case le.PLAYREADY:return Ee.PLAYREADY;case le.WIDEVINE:return Ee.WIDEVINE;case le.CLEARKEY:return Ee.CLEARKEY}}function Dt(a){const{drmSystems:e,widevineLicenseUrl:t}=a,s=e?[le.FAIRPLAY,le.WIDEVINE,le.PLAYREADY,le.CLEARKEY].filter(i=>!!e[i]):[];return!s[le.WIDEVINE]&&t&&s.push(le.WIDEVINE),s}const Kn=(function(a){return ys!=null&&(a=ys.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function zl(a,e,t,s){let i;switch(a){case le.FAIRPLAY:i=["cenc","sinf"];break;case le.WIDEVINE:case le.PLAYREADY:i=["cenc"];break;case le.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return Ql(i,e,t,s)}function Ql(a,e,t,s){return[{initDataTypes:a,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs=${r}`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(r=>({contentType:`video/mp4; codecs=${r}`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function Zl(a){var e;return!!a&&(a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function Vn(a){const e=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),s=t.substring(t.indexOf("<"),t.length),n=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(n){const o=n.childNodes[0]?n.childNodes[0].nodeValue:n.getAttribute("VALUE");if(o){const c=bi(o).subarray(0,16);return $n(c),c}}return null}let mt={};class tt{static clearKeyUriToKeyIdMap(){mt={}}static setKeyIdForUri(e,t){mt[e]=t}static addKeyIdForUri(e){const t=Object.keys(mt).length%Number.MAX_SAFE_INTEGER,s=new Uint8Array(16);return new DataView(s.buffer,12,4).setUint32(0,t),mt[e]=s,s}constructor(e,t,s,i=[1],r=null,n){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=s,this.keyFormatVersions=i,this.iv=r,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!St(e),n!=null&&n.startsWith("0x")&&(this.keyId=new Uint8Array(En(n)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Es(e.keyFormatVersions,this.keyFormatVersions)&&Ar(e.iv,this.iv)&&Ar(e.keyId,this.keyId)}isSupported(){if(this.method){if(St(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Ee.FAIRPLAY:case Ee.WIDEVINE:case Ee.PLAYREADY:case Ee.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(St(this.method)){let r=this.iv;return r||(typeof e!="number"&&(ie.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),r=ec(e)),new tt(this.method,this.uri,"identity",this.keyFormatVersions,r)}if(this.keyId){const r=mt[this.uri];if(r&&!Es(this.keyId,r)&&tt.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const s=Gn(this.uri);if(s)switch(this.keyFormat){case Ee.WIDEVINE:if(this.pssh=s,!this.keyId){const r=il(s.buffer);if(r.length){var i;const n=r[0];this.keyId=(i=n.kids)!=null&&i.length?n.kids[0]:null}}this.keyId||(this.keyId=Ir(t));break;case Ee.PLAYREADY:{const r=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=sl(r,null,s),this.keyId=Vn(s);break}default:{let r=s.subarray(0,16);if(r.length!==16){const n=new Uint8Array(16);n.set(r,16-r.length),r=n}this.keyId=r;break}}if(!this.keyId||this.keyId.byteLength!==16){let r;r=Jl(t),r||(r=Ir(t),r||(r=mt[this.uri])),r&&(this.keyId=r,tt.setKeyIdForUri(this.uri,r))}return this}}function Jl(a){const e=a?.[Ee.WIDEVINE];return e?e.keyId:null}function Ir(a){const e=a?.[Ee.PLAYREADY];if(e){const t=Gn(e.uri);if(t)return Vn(t)}return null}function ec(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const Lr=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Rr=/#EXT-X-MEDIA:(.*)/g,tc=/^#EXT(?:INF|-X-TARGETDURATION):/m,ws=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),sc=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Ve{static findGroup(e,t){for(let s=0;s0&&r.length({id:l.attrs.AUDIO,audioCodec:l.audioCodec})),SUBTITLES:n.map(l=>({id:l.attrs.SUBTITLES,textCodec:l.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(Rr.lastIndex=0;(i=Rr.exec(e))!==null;){const l=new oe(i[1],s),h=l.TYPE;if(h){const d=o[h],u=r[h]||[];r[h]=u;const f=l.LANGUAGE,g=l["ASSOC-LANGUAGE"],E=l.CHANNELS,p=l.CHARACTERISTICS,y=l["INSTREAM-ID"],T={attrs:l,bitrate:0,id:c++,groupId:l["GROUP-ID"]||"",name:l.NAME||f||"",type:h,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:f,url:l.URI?Ve.resolve(l.URI,t):""};if(g&&(T.assocLang=g),E&&(T.channels=E),p&&(T.characteristics=p),y&&(T.instreamId=y),d!=null&&d.length){const v=Ve.findGroup(d,T.groupId)||d[0];Cr(T,v,"audioCodec"),Cr(T,v,"textCodec")}u.push(T)}}return r}static parseLevelPlaylist(e,t,s,i,r,n){var o;const c={url:t},l=new ql(t),h=l.fragments,d=[];let u=null,f=0,g=0,E=0,p=0,y=0,T=null,v=new Ds(i,c),S,x,D,A=-1,R=!1,_=null,I;if(ws.lastIndex=0,l.m3u8=e,l.hasVariableRefs=vr(e),((o=ws.exec(e))==null?void 0:o[0])!=="#EXTM3U")return l.playlistParsingError=new Error("Missing format identifier #EXTM3U"),l;for(;(S=ws.exec(e))!==null;){R&&(R=!1,v=new Ds(i,c),v.playlistOffset=E,v.setStart(E),v.sn=f,v.cc=p,y&&(v.bitrate=y),v.level=s,u&&(v.initSegment=u,u.rawProgramDateTime&&(v.rawProgramDateTime=u.rawProgramDateTime,u.rawProgramDateTime=null),_&&(v.setByteRange(_),_=null)));const H=S[1];if(H){v.duration=parseFloat(H);const $=(" "+S[2]).slice(1);v.title=$||null,v.tagList.push($?["INF",H,$]:["INF",H])}else if(S[3]){if(M(v.duration)){v.playlistOffset=E,v.setStart(E),D&&kr(v,D,l),v.sn=f,v.level=s,v.cc=p,h.push(v);const $=(" "+S[3]).slice(1);v.relurl=ri(l,$),ai(v,T,d),T=v,E+=v.duration,f++,g=0,R=!0}}else{if(S=S[0].match(sc),!S){ie.warn("No matches on slow regex match for level playlist!");continue}for(x=1;x0&&wr(l,$,S),f=l.startSN=parseInt(k);break;case"SKIP":{l.skippedSegments&&je(l,$,S);const N=new oe(k,l),K=N.decimalInteger("SKIPPED-SEGMENTS");if(M(K)){l.skippedSegments+=K;for(let w=K;w--;)h.push(null);f+=K}const Y=N.enumeratedString("RECENTLY-REMOVED-DATERANGES");Y&&(l.recentlyRemovedDateranges=(l.recentlyRemovedDateranges||[]).concat(Y.split(" ")));break}case"TARGETDURATION":l.targetduration!==0&&je(l,$,S),l.targetduration=Math.max(parseInt(k),1);break;case"VERSION":l.version!==null&&je(l,$,S),l.version=parseInt(k);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":l.live||je(l,$,S),l.live=!1;break;case"#":(k||G)&&v.tagList.push(G?[k,G]:[k]);break;case"DISCONTINUITY":p++,v.tagList.push(["DIS"]);break;case"GAP":v.gap=!0,v.tagList.push([$]);break;case"BITRATE":v.tagList.push([$,k]),y=parseInt(k)*1e3,M(y)?v.bitrate=y:y=0;break;case"DATERANGE":{const N=new oe(k,l),K=new Un(N,l.dateRanges[N.ID],l.dateRangeTagCount);l.dateRangeTagCount++,K.isValid||l.skippedSegments?l.dateRanges[K.id]=K:ie.warn(`Ignoring invalid DATERANGE tag: "${k}"`),v.tagList.push(["EXT-X-DATERANGE",k]);break}case"DEFINE":{{const N=new oe(k,l);"IMPORT"in N?Kl(l,N,n):Sr(l,N,t)}break}case"DISCONTINUITY-SEQUENCE":l.startCC!==0?je(l,$,S):h.length>0&&wr(l,$,S),l.startCC=p=parseInt(k);break;case"KEY":{const N=br(k,t,l);if(N.isSupported()){if(N.method==="NONE"){D=void 0;break}D||(D={});const K=D[N.keyFormat];K!=null&&K.matches(N)||(K&&(D=re({},D)),D[N.keyFormat]=N)}else ie.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${k}"`);break}case"START":l.startTimeOffset=_r(k);break;case"MAP":{const N=new oe(k,l);if(v.duration){const K=new Ds(i,c);Pr(K,N,s,D),u=K,v.initSegment=u,u.rawProgramDateTime&&!v.rawProgramDateTime&&(v.rawProgramDateTime=u.rawProgramDateTime)}else{const K=v.byteRangeEndOffset;if(K){const Y=v.byteRangeStartOffset;_=`${K-Y}@${Y}`}else _=null;Pr(v,N,s,D),u=v,R=!0}u.cc=p;break}case"SERVER-CONTROL":{I&&je(l,$,S),I=new oe(k),l.canBlockReload=I.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=I.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&I.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=I.optionalFloat("PART-HOLD-BACK",0),l.holdBack=I.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{l.partTarget&&je(l,$,S);const N=new oe(k);l.partTarget=N.decimalFloatingPoint("PART-TARGET");break}case"PART":{let N=l.partList;N||(N=l.partList=[]);const K=g>0?N[N.length-1]:void 0,Y=g++,w=new oe(k,l),O=new Ko(w,v,c,Y,K);N.push(O),v.duration+=O.duration;break}case"PRELOAD-HINT":{const N=new oe(k,l);l.preloadHint=N;break}case"RENDITION-REPORT":{const N=new oe(k,l);l.renditionReports=l.renditionReports||[],l.renditionReports.push(N);break}default:ie.warn(`line parsed but not handled: ${S}`);break}}}T&&!T.relurl?(h.pop(),E-=T.duration,l.partList&&(l.fragmentHint=T)):l.partList&&(ai(v,T,d),v.cc=p,l.fragmentHint=v,D&&kr(v,D,l)),l.targetduration||(l.playlistParsingError=new Error("Missing Target Duration"));const P=h.length,F=h[0],U=h[P-1];if(E+=l.skippedSegments*l.targetduration,E>0&&P&&U){l.averagetargetduration=E/P;const H=U.sn;l.endSN=H!=="initSegment"?H:0,l.live||(U.endList=!0),A>0&&(rc(h,A),F&&d.unshift(F))}return l.fragmentHint&&(E+=l.fragmentHint.duration),l.totalduration=E,d.length&&l.dateRangeTagCount&&F&&Hn(d,l),l.endCC=p,l}}function Hn(a,e){let t=a.length;if(!t)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];a.push(o),t++}else return;const s=a[t-1],i=e.live?1/0:e.totalduration,r=Object.keys(e.dateRanges);for(let o=r.length;o--;){const c=e.dateRanges[r[o]],l=c.startDate.getTime();c.tagAnchor=s.ref;for(let h=t;h--;){var n;if(((n=a[h])==null?void 0:n.sn)=o||s===0){var n;const c=(((n=t[s+1])==null?void 0:n.start)||i)-r.start;if(e<=o+c*1e3){const l=t[s].sn-a.startSN;if(l<0)return-1;const h=a.fragments;if(h.length>t.length){const u=(t[s+1]||h[h.length-1]).sn-a.startSN;for(let f=u;f>l;f--){const g=h[f].programDateTime;if(e>=g&&es);["video","audio","text"].forEach(s=>{const i=t.filter(r=>Si(r,s));i.length&&(e[`${s}Codec`]=i.map(r=>r.split("/")[0]).join(","),t=t.filter(r=>i.indexOf(r)===-1))}),e.unknownCodecs=t}function Cr(a,e,t){const s=e[t];s&&(a[t]=s)}function rc(a,e){let t=a[e];for(let s=e;s--;){const i=a[s];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function ai(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function Pr(a,e,t,s){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",s&&(a.levelkeys=s),a.initSegment=null}function kr(a,e,t){a.levelkeys=e;const{encryptedFragments:s}=t;(!s.length||s[s.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&s.push(a)}function je(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function wr(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function Os(a,e){const t=e.startPTS;if(M(t)){let s=0,i;e.sn>a.sn?(s=t-a.start,i=a):(s=a.start-t,i=e),i.duration!==s&&i.setDuration(s)}else e.sn>a.sn?a.cc===e.cc&&a.minEndPTS?e.setStart(a.start+(a.minEndPTS-a.start)):e.setStart(a.start+a.duration):e.setStart(Math.max(a.start-e.duration,0))}function Yn(a,e,t,s,i,r,n){s-t<=0&&(n.warn("Fragment should have a positive duration",e),s=t+e.duration,r=i+e.duration);let c=t,l=s;const h=e.startPTS,d=e.endPTS;if(M(h)){const y=Math.abs(h-t);a&&y>a.totalduration?n.warn(`media timestamps and playlist times differ by ${y}s for level ${e.level} ${a.url}`):M(e.deltaPTS)?e.deltaPTS=Math.max(y,e.deltaPTS):e.deltaPTS=y,c=Math.max(t,h),t=Math.min(t,h),i=e.startDTS!==void 0?Math.min(i,e.startDTS):i,l=Math.min(s,d),s=Math.max(s,d),r=e.endDTS!==void 0?Math.max(r,e.endDTS):r}const u=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(s-e.start),e.startPTS=t,e.maxStartPTS=c,e.startDTS=i,e.endPTS=s,e.minEndPTS=l,e.endDTS=r;const f=e.sn;if(!a||fa.endSN)return 0;let g;const E=f-a.startSN,p=a.fragments;for(p[E]=e,g=E;g>0;g--)Os(p[g],p[g-1]);for(g=E;g=0;h--){const d=i[h].initSegment;if(d){s=d;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let r;lc(a,e,(h,d,u,f)=>{if((!e.startCC||e.skippedSegments)&&d.cc!==h.cc){const g=h.cc-d.cc;for(let E=u;E{var d;h&&(!h.initSegment||h.initSegment.relurl===((d=s)==null?void 0:d.relurl))&&(h.initSegment=s)}),e.skippedSegments){if(e.deltaUpdateFailed=n.some(h=>!h),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let h=e.skippedSegments;h--;)n.shift();e.startSN=n[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=ac(a.dateRanges,e,t));const h=a.fragments.filter(d=>d.rawProgramDateTime);if(a.hasProgramDateTime&&!e.hasProgramDateTime)for(let d=1;d{d.elementaryStreams=h.elementaryStreams,d.stats=h.stats}),r?Yn(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS,t):Wn(a,e),n.length&&(e.totalduration=e.edge-n[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const l=e.advancedDateTime;if(e.advanced&&l){const h=e.edge;e.driftStart||(e.driftStartTime=l,e.driftStart=h),e.driftEndTime=l,e.driftEnd=h}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=a.requestScheduled)}function ac(a,e,t){const{dateRanges:s,recentlyRemovedDateranges:i}=e,r=re({},a);i&&i.forEach(c=>{delete r[c]});const o=Object.keys(r).length;return o?(Object.keys(s).forEach(c=>{const l=r[c],h=new Un(s[c].attr,l);h.isValid?(r[c]=h,l||(h.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${ae(s[c].attr)}"`)}),r):s}function oc(a,e,t){if(a&&e){let s=0;for(let i=0,r=a.length;i<=r;i++){const n=a[i],o=e[i+s];n&&o&&n.index===o.index&&n.fragment.sn===o.fragment.sn?t(n,o):s--}}}function lc(a,e,t){const s=e.skippedSegments,i=Math.max(a.startSN,e.startSN)-e.startSN,r=(a.fragmentHint?1:0)+(s?e.endSN:Math.min(a.endSN,e.endSN))-e.startSN,n=e.startSN-a.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;for(let l=i;l<=r;l++){const h=c[n+l];let d=o[l];if(s&&!d&&h&&(d=e.fragments[l]=h),h&&d){t(h,d,l,o);const u=h.relurl,f=d.relurl;if(u&&cc(u,f)){e.playlistParsingError=Or(`media sequence mismatch ${d.sn}:`,a,e,h,d);return}else if(h.cc!==d.cc){e.playlistParsingError=Or(`discontinuity sequence mismatch (${h.cc}!=${d.cc})`,a,e,h,d);return}}}}function Or(a,e,t,s,i){return new Error(`${a} ${i.url} +Playlist starting @${e.startSN} +${e.m3u8} + +Playlist starting @${t.startSN} +${t.m3u8}`)}function Wn(a,e,t=!0){const s=e.startSN+e.skippedSegments-a.startSN,i=a.fragments,r=s>=0;let n=0;if(r&&se){const r=s[s.length-1].duration*1e3;r{var s;(s=e.details)==null||s.fragments.forEach(i=>{i.level=t,i.initSegment&&(i.initSegment.level=t)})})}function cc(a,e){return a!==e&&e?Mr(a)!==Mr(e):!1}function Mr(a){return a.replace(/\?[^?]*$/,"")}function Ct(a,e){for(let s=0,i=a.length;sa.startCC)}function Nr(a,e){const t=a.start+e;a.startPTS=t,a.setStart(t),a.endPTS=t+a.duration}function Qn(a,e){const t=e.fragments;for(let s=0,i=t.length;s{const{config:n,fragCurrent:o,media:c,mediaBuffer:l,state:h}=this,d=c?c.currentTime:0,u=j.bufferInfo(l||c,d,n.maxBufferHole),f=!u.len;if(this.log(`Media seeking to ${M(d)?d.toFixed(3):d}, state: ${h}, ${f?"out of":"in"} buffer`),this.state===C.ENDED)this.resetLoadingState();else if(o){const g=n.maxFragLookUpTolerance,E=o.start-g,p=o.start+o.duration+g;if(f||pu.end){const y=d>p;(dg&&(this.lastCurrentTime=d),!this.loadingParts){const E=Math.max(u.end,d),p=this.shouldLoadParts(this.getLevelDetails(),E);p&&(this.log(`LL-Part loading ON after seeking to ${d.toFixed(2)} with buffer @${E.toFixed(2)}`),this.loadingParts=p)}}this.hls.hasEnoughToStart||(this.log(`Setting ${f?"startPosition":"nextLoadPosition"} to ${d} for seek without enough to start`),this.nextLoadPosition=d,f&&(this.startPosition=d)),f&&this.state===C.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=r,this.hls=e,this.fragmentLoader=new $l(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Ii(e.config)}registerListeners(){const{hls:e}=this;e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(m.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===C.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=C.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const s=e.end||0,i=this.config.timelineOffset||0;if(s<=i)return!1;const r=e.buffered;this.config.maxBufferHole&&r&&r.length>1&&(e=j.bufferedInfo(r,e.start,0));const n=e.nextStart;if(n&&n>i&&n{const n=r.frag;if(this.fragContextChanged(n)){this.warn(`${n.type} sn: ${n.sn}${r.part?" part: "+r.part.index:""} of ${this.fragInfo(n,!1,r.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(n);return}n.stats.chunkCount++,this._handleFragmentLoadProgress(r)};this._doFragLoad(e,t,s,i).then(r=>{if(!r)return;const n=this.state,o=r.frag;if(this.fragContextChanged(o)){(n===C.FRAG_LOADING||!this.fragCurrent&&n===C.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=C.IDLE);return}"payload"in r&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(m.FRAG_LOADED,r)),this._handleFragmentLoadComplete(r)}).catch(r=>{this.state===C.STOPPED||this.state===C.ERROR||(this.warn(`Frag error: ${r?.message||r}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:s}=this;if(s.getState(e)===ue.APPENDING){const r=e.type,n=this.getFwdBufferInfo(this.mediaBuffer,r),o=Math.max(e.duration,n?n.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&s.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?s.removeAllFragments():s.hasParts(e.type)&&(s.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),s.getState(e)===ue.PARTIAL&&s.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return t?.live&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,s=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:s};this.hls.trigger(m.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{const i=s?.frag;if(!i||this.fragContextChanged(i)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:i}=this,{frag:r,payload:n}=s,o=r.decryptdata;if(n&&n.byteLength>0&&o!=null&&o.key&&o.iv&&St(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),o.key.buffer,o.iv.buffer,Ri(o.method)).catch(l=>{throw i.trigger(m.ERROR,{type:V.MEDIA_ERROR,details:b.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:r}),l}).then(l=>{const h=self.performance.now();return i.trigger(m.FRAG_DECRYPTED,{frag:r,payload:l,stats:{tstart:c,tdecrypt:h}}),s.payload=l,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===C.STOPPED||this.state===C.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const s=e.frag.stats;this.state!==C.STOPPED&&(this.state=C.IDLE),e.frag.data=new Uint8Array(e.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var s,i;const r=e.tracks;if(r&&!t.encrypted&&((s=r.audio)!=null&&s.encrypted||(i=r.video)!=null&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const n=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${n?"attached mediaKeys: "+n.mediaKeys:"detached"})`);return this.warn(o.message),!n||n.mediaKeys?!1:(this.hls.trigger(m.ERROR,{type:V.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${s?uc.toString(j.getBuffered(s)):"(detached)"})`),he(e)){var i;if(e.type!==B.SUBTITLE){const n=e.elementaryStreams;if(!Object.keys(n).some(o=>!!n[o])){this.state=C.IDLE;return}}const r=(i=this.levels)==null?void 0:i[e.level];r!=null&&r.fragmentError&&(this.log(`Resetting level fragment error count of ${r.fragmentError} on frag buffered`),r.fragmentError=0)}this.state=C.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:s,part:i,partsLoaded:r}=e,n=!r||r.length===0||r.some(c=>!c),o=new Li(s.level,s.sn,s.stats.chunkCount+1,0,i?i.index:-1,!n);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,i){var r;this.fragCurrent=e;const n=t.details;if(!this.levels||!n)throw new Error(`frag load aborted, missing level${n?"":" detail"}s`);let o=null;if(e.encrypted&&!((r=e.decryptdata)!=null&&r.key)){if(this.log(`Loading key for ${e.sn} of [${n.startSN}-${n.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=C.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(u=>{if(!this.fragContextChanged(u.frag))return this.hls.trigger(m.KEY_LOADED,u),this.state===C.KEY_LOADING&&(this.state=C.IDLE),u}),this.hls.trigger(m.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,n.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(he(e)&&(!c||e.sn!==c.sn)){const u=this.shouldLoadParts(t.details,e.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} loading sn ${c?.sn}->${e.sn}`),this.loadingParts=u)}if(s=Math.max(e.start,s||0),this.loadingParts&&he(e)){const u=n.partList;if(u&&i){s>n.fragmentEnd&&n.fragmentHint&&(e=n.fragmentHint);const f=this.getNextPart(u,e,s);if(f>-1){const g=u[f];e=this.fragCurrent=g.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${g.index} (${f}/${u.length-1}) of ${this.fragInfo(e,!1,g)}) cc: ${e.cc} [${n.startSN}-${n.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=g.start+g.duration,this.state=C.FRAG_LOADING;let E;return o?E=o.then(p=>!p||this.fragContextChanged(p.frag)?null:this.doFragPartsLoad(e,g,t,i)).catch(p=>this.handleFragLoadError(p)):E=this.doFragPartsLoad(e,g,t,i).catch(p=>this.handleFragLoadError(p)),this.hls.trigger(m.FRAG_LOADING,{frag:e,part:g,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):E}else if(!e.url||this.loadedEndOfParts(u,s))return Promise.resolve(null)}}if(he(e)&&this.loadingParts){var l;this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(l=n.partList)==null?void 0:l.filter(u=>u.loaded).map(u=>`[${u.start}-${u.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+n.startSN+"-"+n.endSN+"]"}, target: ${parseFloat(s.toFixed(3))}`),M(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=C.FRAG_LOADING;const h=this.config.progressive&&e.type!==B.SUBTITLE;let d;return h&&o?d=o.then(u=>!u||this.fragContextChanged(u.frag)?null:this.fragmentLoader.load(e,i)).catch(u=>this.handleFragLoadError(u)):d=Promise.all([this.fragmentLoader.load(e,h?i:void 0),o]).then(([u])=>(!h&&i&&i(u),u)).catch(u=>this.handleFragLoadError(u)),this.hls.trigger(m.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(e,t,s,i){return new Promise((r,n)=>{var o;const c=[],l=(o=s.details)==null?void 0:o.partList,h=d=>{this.fragmentLoader.loadPart(e,d,i).then(u=>{c[d.index]=u;const f=u.part;this.hls.trigger(m.FRAG_LOADED,u);const g=Fr(s.details,e.sn,d.index+1)||Xn(l,e.sn,d.index+1);if(g)h(g);else return r({frag:e,part:f,partsLoaded:c})}).catch(n)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===b.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===V.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(m.ERROR,t)}else this.hls.trigger(m.ERROR,{type:V.OTHER_ERROR,details:b.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==C.PARSING){!this.fragCurrent&&this.state!==C.STOPPED&&this.state!==C.ERROR&&(this.state=C.IDLE);return}const{frag:s,part:i,level:r}=t,n=self.performance.now();s.stats.parsing.end=n,i&&(i.stats.parsing.end=n);const o=this.getLevelDetails(),l=o&&s.sn>o.endSN||this.shouldLoadParts(o,s.end);l!==this.loadingParts&&(this.log(`LL-Part loading ${l?"ON":"OFF"} after parsing segment ending @${s.end.toFixed(2)}`),this.loadingParts=l),this.updateLevelTiming(s,i,r,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var s;const r=e.partList[0];if(r.fragment.type===B.SUBTITLE)return!1;const n=r.end+(((s=e.fragmentHint)==null?void 0:s.duration)||0);if(t>=n){var i;if((this.hls.hasEnoughToStart?((i=this.media)==null?void 0:i.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:s}=this,{level:i,sn:r,part:n}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${r} of ${this.playlistLabel()} ${i}. The current chunk will not be buffered.`),null;const o=t[i],c=o.details,l=n>-1?Fr(c,r,n):null,h=l?l.fragment:qn(c,r,s);return h?(s&&s!==h&&(h.stats=s.stats),{frag:h,part:l,level:o}):null}bufferFragmentData(e,t,s,i,r){if(this.state!==C.PARSING)return;const{data1:n,data2:o}=e;let c=n;if(o&&(c=Pe(n,o)),!c.length)return;const l=this.initPTS[t.cc],h=l?-l.baseTime/l.timescale:void 0,d={type:e.type,frag:t,part:s,chunkMeta:i,offset:h,parent:t.type,data:c};if(this.hls.trigger(m.BUFFER_APPENDING,d),e.dropped&&e.independent&&!s){if(r)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!j.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const s=t.currentTime,i=j.bufferInfo(t,s,0),r=e.duration,n=Math.min(this.config.maxFragLookUpTolerance*2,r*.25),o=Math.max(Math.min(e.start-n,i.end-n),s+n);e.start-o>n&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var s;const i=this.getLoadPosition();if(!M(i))return null;const n=this.lastCurrentTime>i||(s=this.media)!=null&&s.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,i,t,n)}getFwdBufferInfoAtPos(e,t,s,i){const r=j.bufferInfo(e,t,i);if(r.len===0&&r.nextStart!==void 0){const n=this.fragmentTracker.getBufferedFrag(t,s);if(n&&(r.nextStart<=n.end||n.gap)){const o=Math.max(Math.min(r.nextStart,n.end)-t,i);return j.bufferInfo(e,t,o)}}return r}getMaxBufferLength(e){const{config:t}=this;let s;return e?s=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):s=t.maxBufferLength,Math.min(s,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const s=this.config,i=Math.max(Math.min(e-t,s.maxBufferLength),t),r=Math.max(e-t*3,s.maxMaxBufferLength/2,i);return r>=i?(s.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0):!1}getAppendedFrag(e,t=B.MAIN){const s=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return s&&"fragment"in s?s.fragment:s}getNextFragment(e,t){const s=t.fragments,i=s.length;if(!i)return null;const{config:r}=this,n=s[0].start,o=r.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const d=r.initialLiveManifestSize;if(i=n?u:f)||c.start:e;this.log(`Setting startPosition to ${g} to match start frag at live edge. mainStart: ${u} liveSyncPosition: ${f} frag.start: ${(l=c)==null?void 0:l.start}`),this.startPosition=this.nextLoadPosition=g}}else e<=n&&(c=s[0]);if(!c){const d=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,d,t)}let h=this.filterReplacedPrimary(c,t);if(!h&&c){const d=c.sn-t.startSN;h=this.filterReplacedPrimary(s[d+1]||null,t)}return this.mapToInitFragWhenRequired(h)}isLoopLoading(e,t){const s=this.fragmentTracker.getState(e);return(s===ue.OK||s===ue.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,s,i,r){let n=null;if(e.gap&&(n=this.getNextFragment(this.nextLoadPosition,t),n&&!n.gap&&s.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,i,0);if(o!==null&&s.len+o.len>=r){const c=n.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,n}get primaryPrefetch(){if(Br(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Br(this.config)&&e.type!==B.SUBTITLE){const s=this.hls.interstitialsManager,i=s?.bufferingItem;if(i){const n=i.event;if(n){if(n.appendInPlace||Math.abs(e.start-i.start)>1||i.start===0)return null}else if(e.end<=i.start&&t?.live===!1||e.start>i.end&&i.nextEvent&&(i.nextEvent.appendInPlace||e.start-i.end>1))return null}const r=s?.playerQueue;if(r)for(let n=r.length;n--;){const o=r[n].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,s){let i=-1,r=!1,n=!0;for(let o=0,c=e.length;o-1&&ss.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,s=this.fragPrevious;let i=null;if(s){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),i=_l(t,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const r=s.sn+1;if(r>=e.startSN&&r<=e.endSN){const n=t[r-e.startSN];s.cc===n.cc&&(i=n,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=On(e,s.cc,s.end),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const r=this.hls.liveSyncPosition;r!==null&&(i=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,s){const{config:i}=this;let{fragPrevious:r}=this,{fragments:n,endSN:o}=s;const{fragmentHint:c}=s,{maxFragLookUpTolerance:l}=i,h=s.partList,d=!!(this.loadingParts&&h!=null&&h.length&&c);d&&!this.bitrateTest&&h[h.length-1].fragment.sn===c.sn&&(n=n.concat(c),o=c.sn);let u;if(et-l||(f=this.media)!=null&&f.paused||!this.startFragRequested?0:l;u=dt(r,n,e,E)}else u=n[n.length-1];if(u){const g=u.sn-s.startSN,E=this.fragmentTracker.getState(u);if((E===ue.OK||E===ue.PARTIAL&&u.gap)&&(r=u),r&&u.sn===r.sn&&(!d||h[0].fragment.sn>u.sn||!s.live)&&u.level===r.level){const y=n[g+1];u.sn${e.startSN} fragments: ${i}`),c}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let s=this.startPosition;s=0&&(s=this.nextLoadPosition),s}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&he(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==C.FRAG_LOADING_WAITING_RETRY)&&(this.state=C.IDLE)}onFragmentOrKeyLoadError(e,t){var s;if(t.chunkMeta&&!t.frag){const y=this.getCurrentContext(t.chunkMeta);y&&(t.frag=y.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var r;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const n=t.details===b.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction;if(!o){this.state=C.ERROR;return}const{action:c,flags:l,retryCount:h=0,retryConfig:d}=o,u=!!d,f=u&&c===me.RetryRequest,g=u&&!o.resolved&&l===Ie.MoveAllAlternatesMatchingHost,E=(s=this.hls.latestLevelDetails)==null?void 0:s.live;if(!f&&g&&he(i)&&!i.endList&&E&&!Mn(t))this.resetFragmentErrors(e),this.treatAsGap(i),o.resolved=!0;else if((f||g)&&h=t||s&&!ii(0))&&(s&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=C.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===C.PARSING||this.state===C.PARSED){const t=e.frag,s=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,s),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len,t?.duration||10);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${s} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(e){e===B.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==C.STOPPED&&(this.state=C.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;const i=j.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,s),this.state===C.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==C.STOPPED&&(this.state=C.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,s,i){const r=s.details;if(!r){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((c,l)=>{const h=e.elementaryStreams[l];if(h){const d=h.endPTS-h.startPTS;if(d<=0)return this.warn(`Could not parse fragment ${e.sn} ${l} duration reliably (${d})`),c||!1;const u=i?0:Yn(r,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS,this);return this.hls.trigger(m.LEVEL_PTS_UPDATED,{details:r,level:s,drift:u,type:l,frag:e,start:h.startPTS,end:h.endPTS}),!0}return c},!1)){var o;const c=((o=this.transmuxer)==null?void 0:o.error)===null;if((s.fragmentError===0||c&&(s.fragmentError<2||e.endList))&&this.treatAsGap(e,s),c){const l=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(l.message),this.hls.trigger(m.ERROR,{type:V.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=C.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(m.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===B.MAIN?"level":"track"}fragInfo(e,t=!0,s){var i,r;return`${this.playlistLabel()} ${e.level} (${s?"part":"frag"}:[${((i=t&&!s?e.startPTS:(s||e).start)!=null?i:NaN).toFixed(3)}-${((r=t&&!s?e.endPTS:(s||e).end)!=null?r:NaN).toFixed(3)}]${s&&e.type==="main"?"INDEPENDENT="+(s.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function Br(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class Jn{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let s;if(e.length)e.length===1?s=e[0]:s=fc(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function fc(a,e){const t=new Uint8Array(e);let s=0;for(let i=0;i0)return a.subarray(t,t+s)}function vc(a,e,t,s){const i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],r=e[t+2],n=r>>2&15;if(n>12){const f=new Error(`invalid ADTS sampling index:${n}`);a.emit(m.ERROR,m.ERROR,{type:V.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,fatal:!0,error:f,reason:f.message});return}const o=(r>>6&3)+1,c=e[t+3]>>6&3|(r&1)<<2,l="mp4a.40."+o,h=i[n];let d=n;(o===5||o===29)&&(d-=3);const u=[o<<3|(d&14)>>1,(d&1)<<7|c<<3];return ie.log(`manifest codec:${s}, parsed codec:${l}, channels:${c}, rate:${h} (ADTS object type:${o} sampling index:${n})`),{config:u,samplerate:h,channelCount:c,codec:l,parsedCodec:l,manifestCodec:s}}function ta(a,e){return a[e]===255&&(a[e+1]&246)===240}function sa(a,e){return a[e+1]&1?7:9}function Pi(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function Sc(a,e){return e+5=a.length)return!1;const s=Pi(a,e);if(s<=t)return!1;const i=e+s;return i===a.length||vs(a,i)}return!1}function ia(a,e,t,s,i){if(!a.samplerate){const r=vc(e,t,s,i);if(!r)return;re(a,r)}}function ra(a){return 1024*9e4/a}function Ic(a,e){const t=sa(a,e);if(e+t<=a.length){const s=Pi(a,e)-t;if(s>0)return{headerLength:t,frameLength:s}}}function na(a,e,t,s,i){const r=ra(a.samplerate),n=s+i*r,o=Ic(e,t);let c;if(o){const{frameLength:d,headerLength:u}=o,f=u+d,g=Math.max(0,t+f-e.length);g?(c=new Uint8Array(f-u),c.set(e.subarray(t+u,e.length),0)):c=e.subarray(t+u,t+f);const E={unit:c,pts:n};return g||a.samples.push(E),{sample:E,length:f,missing:g}}const l=e.length-t;return c=new Uint8Array(l),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:n},length:l,missing:-1}}function Lc(a,e){return Ci(a,e)&&As(a,e+6)+10<=a.length-e}function Rc(a){return a instanceof ArrayBuffer?a:a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer}function Ms(a,e=0,t=1/0){return bc(a,e,t,Uint8Array)}function bc(a,e,t,s){const i=_c(a);let r=1;"BYTES_PER_ELEMENT"in s&&(r=s.BYTES_PER_ELEMENT);const n=Dc(a)?a.byteOffset:0,o=(n+a.byteLength)/r,c=(n+e)/r,l=Math.floor(Math.max(0,Math.min(c,o))),h=Math.floor(Math.min(l+Math.max(t,0),o));return new s(i,l,h-l)}function _c(a){return a instanceof ArrayBuffer?a:a.buffer}function Dc(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function Cc(a){const e={key:a.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(a.size<2)return;if(a.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const s=a.data.subarray(1).indexOf(0);if(s===-1)return;const i=_e(Ms(a.data,1,s)),r=a.data[2+s],n=a.data.subarray(3+s).indexOf(0);if(n===-1)return;const o=_e(Ms(a.data,3+s,n));let c;return i==="-->"?c=_e(Ms(a.data,4+s+n)):c=Rc(a.data.subarray(4+s+n)),e.mimeType=i,e.pictureType=r,e.description=o,e.data=c,e}function Pc(a){if(a.size<2)return;const e=_e(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function kc(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const s=_e(a.data.subarray(t),!0);t+=s.length+1;const i=_e(a.data.subarray(t));return{key:a.type,info:s,data:i}}const e=_e(a.data.subarray(1));return{key:a.type,info:"",data:e}}function wc(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const s=_e(a.data.subarray(t),!0);t+=s.length+1;const i=_e(a.data.subarray(t));return{key:a.type,info:s,data:i}}const e=_e(a.data);return{key:a.type,info:"",data:e}}function Oc(a){return a.type==="PRIV"?Pc(a):a.type[0]==="W"?wc(a):a.type==="APIC"?Cc(a):kc(a)}function Fc(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=As(a,4),s=10;return{type:e,size:t,data:a.subarray(s,s+t)}}const Yt=10,Mc=10;function aa(a){let e=0;const t=[];for(;Ci(a,e);){const s=As(a,e+6);a[e+5]>>6&1&&(e+=Yt),e+=Yt;const i=e+s;for(;e+Mc0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Re.audioId3,duration:Number.POSITIVE_INFINITY});i{if(M(a))return a*90;const s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};let Wt=null;const Uc=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],$c=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Gc=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Kc=[0,1,1,4];function la(a,e,t,s,i){if(t+24>e.length)return;const r=ca(e,t);if(r&&t+r.frameLength<=e.length){const n=r.samplesPerFrame*9e4/r.sampleRate,o=s+i*n,c={unit:e.subarray(t,t+r.frameLength),pts:o,dts:o};return a.config=[],a.channelCount=r.channelCount,a.samplerate=r.sampleRate,a.samples.push(c),{sample:c,length:r.frameLength,missing:0}}}function ca(a,e){const t=a[e+1]>>3&3,s=a[e+1]>>1&3,i=a[e+2]>>4&15,r=a[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&r!==3){const n=a[e+2]>>1&1,o=a[e+3]>>6,c=t===3?3-s:s===3?3:4,l=Uc[c*14+i-1]*1e3,d=$c[(t===3?0:t===2?1:2)*3+r],u=o===3?1:2,f=Gc[t][s],g=Kc[s],E=f*8*g,p=Math.floor(f*l/d+n)*g;if(Wt===null){const v=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Wt=v?parseInt(v[1]):0}return Wt&&Wt<=87&&s===2&&l>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:d,channelCount:u,frameLength:p,samplesPerFrame:E}}}function Oi(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function ha(a,e){return e+1{let t=0,s=5;e+=s;const i=new Uint32Array(1),r=new Uint32Array(1),n=new Uint8Array(1);for(;s>0;){n[0]=a[e];const o=Math.min(s,8),c=8-o;r[0]=4278190080>>>24+c<>c,t=t?t<e.length||e[t]!==11||e[t+1]!==119)return-1;const r=e[t+4]>>6;if(r>=3)return-1;const o=[48e3,44100,32e3][r],c=e[t+4]&63,h=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][c*3+r]*2;if(t+h>e.length)return-1;const d=e[t+6]>>5;let u=0;d===2?u+=2:(d&1&&d!==1&&(u+=2),d&4&&(u+=2));const f=(e[t+6]<<8|e[t+7])>>12-u&1,E=[2,1,2,3,3,4,4,5][d]+f,p=e[t+5]>>3,y=e[t+5]&7,T=new Uint8Array([r<<6|p<<1|y>>2,(y&3)<<6|d<<3|f<<2|c>>4,c<<4&224]),v=1536/o*9e4,S=s+i*v,x=e.subarray(t,t+h);return a.config=T,a.channelCount=E,a.samplerate=o,a.samples.push({unit:x,pts:S}),h}class Wc extends wi{resetInitSegment(e,t,s,i){super.resetInitSegment(e,t,s,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Nt(e,0);let s=t?.length||0;if(t&&e[s]===11&&e[s+1]===119&&ki(t)!==void 0&&ua(e,s)<=16)return!1;for(let i=e.length;s{const n=el(r);if(jc.test(n.schemeIdUri)){const o=$r(n,t);let c=n.eventDuration===4294967295?Number.POSITIVE_INFINITY:n.eventDuration/n.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const l=n.payload;s.samples.push({data:l,len:l.byteLength,dts:o,pts:o,type:Re.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&n.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=$r(n,t);s.samples.push({data:n.payload,len:n.payload.byteLength,dts:o,pts:o,type:Re.misbklv,duration:Number.POSITIVE_INFINITY})}})}return s}demuxSampleAes(e,t,s){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function $r(a,e){return M(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class Xc{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new Ii(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,it.cbc)}decryptAacSample(e,t,s){const i=e[t].unit;if(i.length<=16)return;const r=i.subarray(16,i.length-i.length%16),n=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(n).then(o=>{const c=new Uint8Array(o);i.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s)}).catch(s)}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length){s();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(t);let i=0;for(let r=32;r{r.data=this.getAvcDecryptedUnit(n,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,i)}).catch(i)}decryptAvcSamples(e,t,s,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,s=0){if(t>=e.length){i();return}const r=e[t].units;for(;!(s>=r.length);s++){const n=r[s];if(!(n.data.length<=48||n.type!==1&&n.type!==5)&&(this.decryptAvcSample(e,t,s,i,n),!this.decrypter.isSync()))return}}}}class ga{constructor(){this.VideoSample=null}createVideoSample(e,t,s){return{key:e,frame:!1,pts:t,dts:s,units:[],length:0}}getLastNalUnit(e){var t;let s=this.VideoSample,i;if((!s||s.units.length===0)&&(s=e[e.length-1]),(t=s)!=null&&t.units){const r=s.units;i=r[r.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const s=t.samples,i=s.length;if(i){const r=s[i-1];e.pts=r.pts,e.dts=r.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,s){const i=t.byteLength;let r=e.naluState||0;const n=r,o=[];let c=0,l,h,d,u=-1,f=0;for(r===-1&&(u=0,f=this.getNALuType(t,0),r=0,c=1);c=0){const g={data:t.subarray(u,h),type:f};o.push(g)}else{const g=this.getLastNalUnit(e.samples);g&&(n&&c<=4-n&&g.state&&(g.data=g.data.subarray(0,g.data.byteLength-n)),h>0&&(g.data=Pe(g.data,t.subarray(0,h)),g.state=0))}c=0&&r>=0){const g={data:t.subarray(u,i),type:f,state:r};o.push(g)}if(o.length===0){const g=this.getLastNalUnit(e.samples);g&&(g.data=Pe(g.data,t))}return e.naluState=r,o}}class Pt{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,s=e.byteLength-t,i=new Uint8Array(4),r=Math.min(4,t);if(r===0)throw new Error("no bytes available");i.set(e.subarray(s,s+r)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=r*8,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const s=this.word>>>32-t;if(e>32&&ie.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?s<>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class zc extends ga{parsePES(e,t,s,i){const r=this.parseNALu(e,s.data,i);let n=this.VideoSample,o,c=!1;s.data=null,n&&r.length&&!e.audFound&&(this.pushAccessUnit(n,e),n=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),r.forEach(l=>{var h,d;switch(l.type){case 1:{let E=!1;o=!0;const p=l.data;if(c&&p.length>4){const y=this.readSliceType(p);(y===2||y===4||y===7||y===9)&&(E=!0)}if(E){var u;(u=n)!=null&&u.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null)}n||(n=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),n.frame=!0,n.key=E;break}case 5:o=!0,(h=n)!=null&&h.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null),n||(n=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),n.key=!0,n.frame=!0;break;case 6:{o=!0,vi(l.data,1,s.pts,t.samples);break}case 7:{var f,g;o=!0,c=!0;const E=l.data,p=this.readSPS(E);if(!e.sps||e.width!==p.width||e.height!==p.height||((f=e.pixelRatio)==null?void 0:f[0])!==p.pixelRatio[0]||((g=e.pixelRatio)==null?void 0:g[1])!==p.pixelRatio[1]){e.width=p.width,e.height=p.height,e.pixelRatio=p.pixelRatio,e.sps=[E];const y=E.subarray(1,4);let T="avc1.";for(let v=0;v<3;v++){let S=y[v].toString(16);S.length<2&&(S="0"+S),T+=S}e.codec=T}break}case 8:o=!0,e.pps=[l.data];break;case 9:o=!0,e.audFound=!0,(d=n)!=null&&d.frame&&(this.pushAccessUnit(n,e),n=null),n||(n=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;case 12:o=!0;break;default:o=!1;break}n&&o&&n.units.push(l)}),i&&n&&(this.pushAccessUnit(n,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Pt(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let s=8,i=8,r;for(let n=0;n{var h,d;switch(l.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:n||(n=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),n.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,c){var u;(u=n)!=null&&u.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null)}n||(n=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),n.key=!0,n.frame=!0;break;case 19:case 20:o=!0,(h=n)!=null&&h.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null),n||(n=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),n.key=!0,n.frame=!0;break;case 39:o=!0,vi(l.data,2,s.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=re(e.params,this.readVPS(l.data)),this.initVPS=l.data),e.vps=[l.data];break;case 33:if(o=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],l.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const f=this.readSPS(l.data);e.width=f.width,e.height=f.height,e.pixelRatio=f.pixelRatio,e.codec=f.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const g in f.params)e.params[g]=f.params[g]}this.pushParameterSet(e.sps,l.data,e.vps),n||(n=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),n.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const f=this.readPPS(l.data);for(const g in f)e.params[g]=f[g]}this.pushParameterSet(e.pps,l.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(d=n)!=null&&d.frame&&(this.pushAccessUnit(n,e),n=null),n||(n=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;default:o=!1;break}n&&o&&n.units.push(l)}),i&&n&&(this.pushAccessUnit(n,e),this.VideoSample=null)}pushParameterSet(e,t,s){(s&&s[0]===this.initVPS||!s&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let s=0;for(let i=0;i=2&&e[i]===3&&e[i-1]===0&&e[i-2]===0||(t[s]=e[i],s++);return new Uint8Array(t.buffer,0,s)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Pt(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const s=t.readBits(3),i=t.readBoolean();return{numTemporalLayers:s+1,temporalIdNested:i}}readSPS(e){const t=new Pt(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const s=t.readBits(3);t.readBoolean();const i=t.readBits(2),r=t.readBoolean(),n=t.readBits(5),o=t.readUByte(),c=t.readUByte(),l=t.readUByte(),h=t.readUByte(),d=t.readUByte(),u=t.readUByte(),f=t.readUByte(),g=t.readUByte(),E=t.readUByte(),p=t.readUByte(),y=t.readUByte(),T=[],v=[];for(let J=0;J0)for(let J=s;J<8;J++)t.readBits(2);for(let J=0;J1&&t.readEG();for(let ut=0;ut0&&at<16?(O=Ki[at-1],q=$t[at-1]):at===255&&(O=t.readBits(16),q=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),ye=t.readBoolean(),ye&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(X=t.readBits(32),Z=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const $t=t.readBoolean(),Vi=t.readBoolean();let Rt=!1;($t||Vi)&&(Rt=t.readBoolean(),Rt&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),Rt&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Hi=0;Hi<=s;Hi++){ee=t.readBoolean();const qa=ee||t.readBoolean();let Yi=!1;qa?t.readEG():Yi=t.readBoolean();const Wi=Yi?1:t.readUEG()+1;if($t)for(let bt=0;bt>J&1)<<31-J)>>>0;let Rs=Ls.toString(16);return n===1&&Rs==="2"&&(Rs="6"),{codecString:`hvc1.${rt}${n}.${Rs}.${r?"H":"L"}${y}.B0`,params:{general_tier_flag:r,general_profile_idc:n,general_profile_space:i,general_profile_compatibility_flags:[o,c,l,h],general_constraint_indicator_flags:[d,u,f,g,E,p],general_level_idc:y,bit_depth:F+8,bit_depth_luma_minus8:F,bit_depth_chroma_minus8:U,min_spatial_segmentation_idc:w,chroma_format_idc:S,frame_rate:{fixed:ee,fps:Z/X}},width:De,height:Ne,pixelRatio:[O,q]}}readPPS(e){const t=new Pt(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const i=t.readBoolean(),r=t.readBoolean();let n=1;return r&&i?n=0:r?n=3:i&&(n=2),{parallelismType:n}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const fe=188;class et{constructor(e,t,s,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.logger=i,this.videoParser=null}static probe(e,t){const s=et.syncOffset(e);return s>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${s}`),s!==-1}static syncOffset(e){const t=e.length;let s=Math.min(fe*5,t-fe)+1,i=0;for(;i1&&(n===0&&o>2||c+fe>s))return n}else{if(o)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:vn[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,s,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=et.createTrack("video"),this._videoTrack.duration=i,this._audioTrack=et.createTrack("audio",i),this._id3Track=et.createTrack("id3"),this._txtTrack=et.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,s=!1,i=!1){s||(this.sampleAes=null);let r;const n=this._videoTrack,o=this._audioTrack,c=this._id3Track,l=this._txtTrack;let h=n.pid,d=n.pesData,u=o.pid,f=c.pid,g=o.pesData,E=c.pesData,p=null,y=this.pmtParsed,T=this._pmtId,v=e.length;if(this.remainderData&&(e=Pe(this.remainderData,e),v=e.length,this.remainderData=null),v>4;let P;if(I>1){if(P=A+5+e[A+4],P===A+fe)continue}else P=A+4;switch(_){case h:R&&(d&&(r=pt(d,this.logger))&&(this.readyVideoParser(n.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(n,l,r,!1)),d={data:[],size:0}),d&&(d.data.push(e.subarray(P,A+fe)),d.size+=A+fe-P);break;case u:if(R){if(g&&(r=pt(g,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,r);break;case"mp3":this.parseMPEGPES(o,r);break;case"ac3":this.parseAC3PES(o,r);break}g={data:[],size:0}}g&&(g.data.push(e.subarray(P,A+fe)),g.size+=A+fe-P);break;case f:R&&(E&&(r=pt(E,this.logger))&&this.parseID3PES(c,r),E={data:[],size:0}),E&&(E.data.push(e.subarray(P,A+fe)),E.size+=A+fe-P);break;case 0:R&&(P+=e[P]+1),T=this._pmtId=Zc(e,P);break;case T:{R&&(P+=e[P]+1);const F=Jc(e,P,this.typeSupported,s,this.observer,this.logger);h=F.videoPid,h>0&&(n.pid=h,n.segmentCodec=F.segmentVideoCodec),u=F.audioPid,u>0&&(o.pid=u,o.segmentCodec=F.segmentAudioCodec),f=F.id3Pid,f>0&&(c.pid=f),p!==null&&!y&&(this.logger.warn(`MPEG-TS PMT found at ${A} after unknown PID '${p}'. Backtracking to sync byte @${S} to parse all TS packets.`),p=null,A=S-188),y=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=_;break}}else x++;x>0&&ci(this.observer,new Error(`Found ${x} TS packet/s that do not start with 0x47`),void 0,this.logger),n.pesData=d,o.pesData=g,c.pesData=E;const D={audioTrack:o,videoTrack:n,id3Track:c,textTrack:l};return i&&this.extractRemainingSamples(D),D}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:s,id3Track:i,textTrack:r}=e,n=s.pesData,o=t.pesData,c=i.pesData;let l;if(n&&(l=pt(n,this.logger))?(this.readyVideoParser(s.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(s,r,l,!0),s.pesData=null)):s.pesData=n,o&&(l=pt(o,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l);break}t.pesData=null}else o!=null&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;c&&(l=pt(c,this.logger))?(this.parseID3PES(i,l),i.pesData=null):i.pesData=c}demuxSampleAes(e,t,s){const i=this.demux(e,s,!0,!this.config.progressive),r=this.sampleAes=new Xc(this.observer,this.config,t);return this.decrypt(i,r)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new zc:e==="hevc"&&(this.videoParser=new Qc))}decrypt(e,t){return new Promise(s=>{const{audioTrack:i,videoTrack:r}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,()=>{s(e)}):s(e)}):r.samples&&t.decryptAvcSamples(r.samples,0,0,()=>{s(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let s=0;const i=this.aacOverFlow;let r=t.data;if(i){this.aacOverFlow=null;const d=i.missing,u=i.sample.unit.byteLength;if(d===-1)r=Pe(i.sample.unit,r);else{const f=u-d;i.sample.unit.set(r.subarray(0,d),f),e.samples.push(i.sample),s=i.missing}}let n,o;for(n=s,o=r.length;n0;)o+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=re({},t,{type:this._videoTrack?Re.emsg:Re.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}}function li(a,e){return((a[e+1]&31)<<8)+a[e+2]}function Zc(a,e){return(a[e+10]&31)<<8|a[e+11]}function Jc(a,e,t,s,i,r){const n={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(a[e+1]&15)<<8|a[e+2],c=e+3+o-4,l=(a[e+10]&15)<<8|a[e+11];for(e+=12+l;e0){let u=e+5,f=d;for(;f>2;){a[u]===106&&(t.ac3!==!0?r.log("AC-3 audio found, not supported in this browser for now"):(n.audioPid=h,n.segmentAudioCodec="ac3"));const E=a[u+1]+2;u+=E,f-=E}}break;case 194:case 135:return ci(i,new Error("Unsupported EC-3 in M2TS found"),void 0,r),n;case 36:n.videoPid===-1&&(n.videoPid=h,n.segmentVideoCodec="hevc",r.log("HEVC in M2TS found"));break}e+=d+5}return n}function ci(a,e,t,s){s.warn(`parsing error: ${e.message}`),a.emit(m.ERROR,m.ERROR,{type:V.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Ns(a,e){e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function pt(a,e){let t=0,s,i,r,n,o;const c=a.data;if(!a||a.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=Pe(c[0],c[1]),c.splice(1,1);if(s=c[0],(s[0]<<16)+(s[1]<<8)+s[2]===1){if(i=(s[4]<<8)+s[5],i&&i>a.size-6)return null;const h=s[7];h&192&&(n=(s[9]&14)*536870912+(s[10]&255)*4194304+(s[11]&254)*16384+(s[12]&255)*128+(s[13]&254)/2,h&64?(o=(s[14]&14)*536870912+(s[15]&255)*4194304+(s[16]&254)*16384+(s[17]&255)*128+(s[18]&254)/2,n-o>60*9e4&&(e.warn(`${Math.round((n-o)/9e4)}s delta between PTS and DTS, align them`),n=o)):o=n),r=s[8];let d=r+9;if(a.size<=d)return null;a.size-=d;const u=new Uint8Array(a.size);for(let f=0,g=c.length;fE){d-=E;continue}else s=s.subarray(d),E-=d,d=0;u.set(s,t),t+=E}return i&&(i-=r+3),{data:u,pts:n,dts:o,len:i}}return null}class eh{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const Qe=Math.pow(2,32)-1;class L{static init(){L.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in L.types)L.types.hasOwnProperty(e)&&(L.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),s=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);L.HDLR_TYPES={video:t,audio:s};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);L.STTS=L.STSC=L.STCO=r,L.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),L.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),L.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),L.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const n=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);L.FTYP=L.box(L.types.ftyp,n,c,n,o),L.DINF=L.box(L.types.dinf,L.box(L.types.dref,i))}static box(e,...t){let s=8,i=t.length;const r=i;for(;i--;)s+=t[i].byteLength;const n=new Uint8Array(s);for(n[0]=s>>24&255,n[1]=s>>16&255,n[2]=s>>8&255,n[3]=s&255,n.set(e,4),i=0,s=8;i>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return L.box(L.types.mdia,L.mdhd(e.timescale||0,e.duration||0),L.hdlr(e.type),L.minf(e))}static mfhd(e){return L.box(L.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?L.box(L.types.minf,L.box(L.types.smhd,L.SMHD),L.DINF,L.stbl(e)):L.box(L.types.minf,L.box(L.types.vmhd,L.VMHD),L.DINF,L.stbl(e))}static moof(e,t,s){return L.box(L.types.moof,L.mfhd(e),L.traf(s,t))}static moov(e){let t=e.length;const s=[];for(;t--;)s[t]=L.trak(e[t]);return L.box.apply(null,[L.types.moov,L.mvhd(e[0].timescale||0,e[0].duration||0)].concat(s).concat(L.mvex(e)))}static mvex(e){let t=e.length;const s=[];for(;t--;)s[t]=L.trex(e[t]);return L.box.apply(null,[L.types.mvex,...s])}static mvhd(e,t){t*=e;const s=Math.floor(t/(Qe+1)),i=Math.floor(t%(Qe+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,i>>24,i>>16&255,i>>8&255,i&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return L.box(L.types.mvhd,r)}static sdtp(e){const t=e.samples||[],s=new Uint8Array(4+t.length);let i,r;for(i=0;i>>8&255),t.push(n&255),t=t.concat(Array.prototype.slice.call(r));for(i=0;i>>8&255),s.push(n&255),s=s.concat(Array.prototype.slice.call(r));const o=L.box(L.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(s))),c=e.width,l=e.height,h=e.pixelRatio[0],d=e.pixelRatio[1];return L.box(L.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,c&255,l>>8&255,l&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,L.box(L.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),L.box(L.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,d>>24,d>>16&255,d>>8&255,d&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return L.box(L.types.mp4a,L.audioStsd(e),L.box(L.types.esds,L.esds(e)))}static mp3(e){return L.box(L.types[".mp3"],L.audioStsd(e))}static ac3(e){return L.box(L.types["ac-3"],L.audioStsd(e),L.box(L.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return L.box(L.types.stsd,L.STSD,L.mp4a(e));if(t==="ac3"&&e.config)return L.box(L.types.stsd,L.STSD,L.ac3(e));if(t==="mp3"&&e.codec==="mp3")return L.box(L.types.stsd,L.STSD,L.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return L.box(L.types.stsd,L.STSD,L.avc1(e));if(t==="hevc"&&e.vps)return L.box(L.types.stsd,L.STSD,L.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,s=(e.duration||0)*(e.timescale||0),i=e.width||0,r=e.height||0,n=Math.floor(s/(Qe+1)),o=Math.floor(s%(Qe+1));return L.box(L.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,i&255,0,0,r>>8&255,r&255,0,0]))}static traf(e,t){const s=L.sdtp(e),i=e.id,r=Math.floor(t/(Qe+1)),n=Math.floor(t%(Qe+1));return L.box(L.types.traf,L.box(L.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),L.box(L.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,n>>24,n>>16&255,n>>8&255,n&255])),L.trun(e,s.length+16+20+8+16+8+8),s)}static trak(e){return e.duration=e.duration||4294967295,L.box(L.types.trak,L.tkhd(e),L.mdia(e))}static trex(e){const t=e.id;return L.box(L.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const s=e.samples||[],i=s.length,r=12+16*i,n=new Uint8Array(r);let o,c,l,h,d,u;for(t+=8+r,n.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o>>24&255,l>>>16&255,l>>>8&255,l&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*o);return L.box(L.types.trun,n)}static initSegment(e){L.types||L.init();const t=L.moov(e);return Pe(L.FTYP,t)}static hvc1(e){const t=e.params,s=[e.vps,e.sps,e.pps],i=4,r=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),i-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),s.length]);let n=r.length;for(let g=0;g>8,s[g][E].length&255]),n),n+=2,o.set(s[g][E],n),n+=s[g][E].length}const l=L.box(L.types.hvcC,o),h=e.width,d=e.height,u=e.pixelRatio[0],f=e.pixelRatio[1];return L.box(L.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,h>>8&255,h&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l,L.box(L.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),L.box(L.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,f>>24,f>>16&255,f>>8&255,f&255])))}}L.types=void 0;L.HDLR_TYPES=void 0;L.STTS=void 0;L.STSC=void 0;L.STCO=void 0;L.STSZ=void 0;L.VMHD=void 0;L.SMHD=void 0;L.STSD=void 0;L.FTYP=void 0;L.DINF=void 0;const ma=9e4;function Fi(a,e,t=1,s=!1){const i=a*e*t;return s?Math.round(i):i}function th(a,e,t=1,s=!1){return Fi(a,e,1/t,s)}function _t(a,e=!1){return Fi(a,1e3,1/ma,e)}function sh(a,e=1){return Fi(a,ma,1/e)}function Gr(a){const{baseTime:e,timescale:t,trackId:s}=a;return`${e/t} (${e}/${t}) trackId: ${s}`}const ih=10*1e3,rh=1024,nh=1152,ah=1536;let Et=null,Bs=null;function Kr(a,e,t,s){return{duration:e,size:t,cts:s,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:a?2:1,isNonSync:a?0:1}}}class as extends ke{constructor(e,t,s,i){if(super("mp4-remuxer",i),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.ISGenerated=!1,Et===null){const n=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Et=n?parseInt(n[1]):0}if(Bs===null){const r=navigator.userAgent.match(/Safari\/(\d+)/i);Bs=r?parseInt(r[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&Gr(t)} > ${e&&Gr(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const s=e[0].pts,i=e.reduce((r,n)=>{let o=n.pts,c=o-r;return c<-4294967296&&(t=!0,o=Le(o,s),c=o-r),c>0?r:o},s);return t&&this.debug("PTS rollover detected"),i}remux(e,t,s,i,r,n,o,c){let l,h,d,u,f,g,E=r,p=r;const y=e.pid>-1,T=t.pid>-1,v=t.samples.length,S=e.samples.length>0,x=o&&v>0||v>1;if((!y||S)&&(!T||x)||this.ISGenerated||o){if(this.ISGenerated){var A,R,_,I;const H=this.videoTrackConfig;(H&&(t.width!==H.width||t.height!==H.height||((A=t.pixelRatio)==null?void 0:A[0])!==((R=H.pixelRatio)==null?void 0:R[0])||((_=t.pixelRatio)==null?void 0:_[1])!==((I=H.pixelRatio)==null?void 0:I[1]))||!H&&x||this.nextAudioTs===null&&S)&&this.resetInitSegment()}this.ISGenerated||(d=this.generateIS(e,t,r,n));const P=this.isVideoContiguous;let F=-1,U;if(x&&(F=oh(t.samples),!P&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,F>0){this.warn(`Dropped ${F} out of ${v} video samples due to a missing keyframe`);const H=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(F),t.dropped+=F,p+=(t.samples[0].pts-H)/t.inputTimeScale,U=p}else F===-1&&(this.warn(`No keyframe found out of ${v} video samples`),g=!1);if(this.ISGenerated){if(S&&x){const H=this.getVideoStartPts(t.samples),k=(Le(e.samples[0].pts,H)-H)/t.inputTimeScale;E+=Math.max(0,k),p+=Math.max(0,-k)}if(S){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),d=this.generateIS(e,t,r,n)),h=this.remuxAudio(e,E,this.isAudioContiguous,n,T||x||c===B.AUDIO?p:void 0),x){const H=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),d=this.generateIS(e,t,r,n)),l=this.remuxVideo(t,p,P,H)}}else x&&(l=this.remuxVideo(t,p,P,0));l&&(l.firstKeyFrame=F,l.independent=F!==-1,l.firstKeyFramePTS=U)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(f=pa(s,r,this._initPTS,this._initDTS)),i.samples.length&&(u=Ea(i,r,this._initPTS))),{audio:h,video:l,initSegment:d,independent:g,text:u,id3:f}}computeInitPts(e,t,s,i){const r=Math.round(s*t);let n=Le(e,r);if(n0?w-1:w].dts&&(T=!0)}T&&n.sort(function(w,O){const q=w.dts-O.dts,ee=w.pts-O.pts;return q||ee}),g=n[0].dts,E=n[n.length-1].dts;const S=E-g,x=S?Math.round(S/(c-1)):f||e.inputTimeScale/30;if(s){const w=g-v,O=w>x,q=w<-1;if((O||q)&&(O?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${_t(w,!0)} ms (${w}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${_t(-w,!0)} ms (${w}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!q||v>=n[0].pts||Et)){g=v;const ee=n[0].pts-w;if(O)n[0].dts=g,n[0].pts=ee;else{let X=!0;for(let Z=0;Zee&&X);Z++){const ye=n[Z].pts;if(n[Z].dts-=w,n[Z].pts-=w,Z0?O.dts-n[w-1].dts:x;if(X=w>0?O.pts-n[w-1].pts:x,ye.stretchShortVideoTrack&&this.nextAudioTs!==null){const De=Math.floor(ye.maxBufferHole*r),Ne=(i?p+i*r:this.nextAudioTs+h)-O.pts;Ne>De?(f=Ne-ge,f<0?f=ge:F=!0,this.log(`It is approximately ${Ne/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=ge}else f=ge}const Z=Math.round(O.pts-O.dts);U=Math.min(U,f),$=Math.max($,f),H=Math.min(H,X),k=Math.max(k,X),o.push(Kr(O.key,f,ee,Z))}if(o.length){if(Et){if(Et<70){const w=o[0].flags;w.dependsOn=2,w.isNonSync=0}}else if(Bs&&k-H<$-U&&x/$<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let w=g;for(let O=0,q=o.length;O0&&(i&&Math.abs(v-(y+T))<9e3||Math.abs(Le(E[0].pts,v)-(y+T))<20*h),E.forEach(function(k){k.pts=Le(k.pts,v)}),!s||y<0){const k=E.length;if(E=E.filter(G=>G.pts>=0),k!==E.length&&this.warn(`Removed ${E.length-k} of ${k} samples (initPTS ${T} / ${n})`),!E.length)return;r===0?y=0:i&&!g?y=Math.max(0,v-T):y=E[0].pts-T}if(e.segmentCodec==="aac"){const k=this.config.maxAudioFramesDrift;for(let G=0,N=y+T;G=k*h&&O0){A+=p;try{D=new Uint8Array(A)}catch(O){this.observer.emit(m.ERROR,m.ERROR,{type:V.MUX_ERROR,details:b.REMUX_ALLOC_ERROR,fatal:!1,error:O,bytes:A,reason:`fail allocating audio mdat ${A}`});return}u||(new DataView(D.buffer).setUint32(0,A),D.set(L.types.mdat,4))}else return;D.set(K,p);const w=K.byteLength;p+=w,f.push(Kr(!0,l,w,0)),x=Y}const _=f.length;if(!_)return;const I=f[f.length-1];y=x-T,this.nextAudioTs=y+c*I.duration;const P=u?new Uint8Array(0):L.moof(e.sequenceNumber++,S/c,re({},e,{samples:f}));e.samples=[];const F=(S-T)/n,U=this.nextAudioTs/n,$={data1:P,data2:D,startPTS:F,endPTS:U,startDTS:F,endDTS:U,type:"audio",hasAudio:!0,hasVideo:!1,nb:_};return this.isAudioContiguous=!0,$}}function Le(a,e){let t;if(e===null)return a;for(e4294967296;)a+=t;return a}function oh(a){for(let e=0;en.pts-o.pts);const r=a.samples;return a.samples=[],{samples:r}}class lh extends ke{constructor(e,t,s,i){super("passthrough-remuxer",i),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,s,i){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(e,i),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:s,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:r,video:n}=this.initData=An(e);if(t)Xo(e,t);else{const c=r||n;c!=null&&c.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${c.codec}")!`)}r&&(s=Vr(r,ne.AUDIO,this)),n&&(i=Vr(n,ne.VIDEO,this));const o={};r&&n?o.audiovideo={container:"video/mp4",codec:s+","+i,supplemental:n.supplemental,encrypted:n.encrypted,initSegment:e,id:"main"}:r?o.audio={container:"audio/mp4",codec:s,encrypted:r.encrypted,initSegment:e,id:"audio"}:n?o.video={container:"video/mp4",codec:i,supplemental:n.supplemental,encrypted:n.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,s,i,r,n){var o,c;let{initPTS:l,lastEndTime:h}=this;const d={audio:void 0,video:void 0,text:i,id3:s,initSegment:void 0};M(h)||(h=this.lastEndTime=r||0);const u=t.samples;if(!u.length)return d;const f={initPTS:void 0,timescale:void 0,trackId:void 0};let g=this.initData;if((o=g)!=null&&o.length||(this.generateInitSegment(u),g=this.initData),!((c=g)!=null&&c.length))return this.warn("Failed to generate initSegment."),d;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1);const E=Qo(u,g,this),p=g.audio?E[g.audio.id]:null,y=g.video?E[g.video.id]:null,T=jt(y,1/0),v=jt(p,1/0),S=jt(y,0,!0),x=jt(p,0,!0);let D=r,A=0;const R=p&&(!y||!l&&v0?this.lastEndTime=P:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const F=!!g.audio,U=!!g.video;let H="";F&&(H+="audio"),U&&(H+="video");const $=(g.audio?g.audio.encrypted:!1)||(g.video?g.video.encrypted:!1),k={data1:u,startPTS:I,startDTS:I,endPTS:P,endDTS:P,type:H,hasAudio:F,hasVideo:U,nb:1,dropped:0,encrypted:$};d.audio=F&&!U?k:void 0,d.video=U?k:void 0;const G=y?.sampleCount;if(G){const N=y.keyFrameIndex,K=N!==-1;k.nb=G,k.dropped=N===0||this.isVideoContiguous?0:K?N:G,k.independent=K,k.firstKeyFrame=N,K&&y.keyFrameStart&&(k.firstKeyFramePTS=(y.keyFrameStart-l.baseTime)/l.timescale),this.isVideoContiguous||(d.independent=K),this.isVideoContiguous||(this.isVideoContiguous=K),k.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${N}/${G} dropped: ${k.dropped} start: ${k.firstKeyFramePTS||"NA"}`)}return d.initSegment=f,d.id3=pa(s,r,l,l),i.samples.length&&(d.text=Ea(i,r,l)),d}}function jt(a,e,t=!1){return a?.start!==void 0?(a.start+(t?a.duration:0))/a.timescale:e}function ch(a,e,t,s){if(a===null)return!0;const i=Math.max(s,1),r=e-a.baseTime/a.timescale;return Math.abs(r-t)>i}function Vr(a,e,t){const s=a.codec;return s&&s.length>4?s:e===ne.AUDIO?s==="ec-3"||s==="ac-3"||s==="alac"?s:s==="fLaC"||s==="Opus"?us(s,!1):(t.warn(`Unhandled audio codec "${s}" in mp4 MAP`),s||"mp4a"):(t.warn(`Unhandled video codec "${s}" in mp4 MAP`),s||"avc1")}let ze;try{ze=self.performance.now.bind(self.performance)}catch{ze=Date.now}const os=[{demux:qc,remux:lh},{demux:et,remux:as},{demux:Hc,remux:as},{demux:Wc,remux:as}];os.splice(2,0,{demux:Yc,remux:as});class Hr{constructor(e,t,s,i,r,n){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=s,this.id=r,this.logger=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,s,i){const r=s.transmuxing;r.executeStart=ze();let n=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:c}=this;i&&(this.currentTransmuxState=i);const{contiguous:l,discontinuity:h,trackSwitch:d,accurateTimeOffset:u,timeOffset:f,initSegmentChange:g}=i||o,{audioCodec:E,videoCodec:p,defaultInitPts:y,duration:T,initSegmentData:v}=c,S=hh(n,t);if(S&&St(S.method)){const R=this.getDecrypter(),_=Ri(S.method);if(R.isSync()){let I=R.softwareDecrypt(n,S.key.buffer,S.iv.buffer,_);if(s.part>-1){const F=R.flush();I=F&&F.buffer}if(!I)return r.executeEnd=ze(),Us(s);n=new Uint8Array(I)}else return this.asyncResult=!0,this.decryptionPromise=R.webCryptoDecrypt(n,S.key.buffer,S.iv.buffer,_).then(I=>{const P=this.push(I,null,s);return this.decryptionPromise=null,P}),this.decryptionPromise}const x=this.needsProbing(h,d);if(x){const R=this.configureTransmuxer(n);if(R)return this.logger.warn(`[transmuxer] ${R.message}`),this.observer.emit(m.ERROR,m.ERROR,{type:V.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,fatal:!1,error:R,reason:R.message}),r.executeEnd=ze(),Us(s)}(h||d||g||x)&&this.resetInitSegment(v,E,p,T,t),(h||g||x)&&this.resetInitialTimestamp(y),l||this.resetContiguity();const D=this.transmux(n,S,f,u,s);this.asyncResult=Bt(D);const A=this.currentTransmuxState;return A.contiguous=!0,A.discontinuity=!1,A.trackSwitch=!1,r.executeEnd=ze(),D}flush(e){const t=e.transmuxing;t.executeStart=ze();const{decrypter:s,currentTransmuxState:i,decryptionPromise:r}=this;if(r)return this.asyncResult=!0,r.then(()=>this.flush(e));const n=[],{timeOffset:o}=i;if(s){const d=s.flush();d&&n.push(this.push(d.buffer,null,e))}const{demuxer:c,remuxer:l}=this;if(!c||!l){t.executeEnd=ze();const d=[Us(e)];return this.asyncResult?Promise.resolve(d):d}const h=c.flush(o);return Bt(h)?(this.asyncResult=!0,h.then(d=>(this.flushRemux(n,d,e),n))):(this.flushRemux(n,h,e),this.asyncResult?Promise.resolve(n):n)}flushRemux(e,t,s){const{audioTrack:i,videoTrack:r,id3Track:n,textTrack:o}=t,{accurateTimeOffset:c,timeOffset:l}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${s.sn}${s.part>-1?" part: "+s.part:""} of ${this.id===B.MAIN?"level":"track"} ${s.level}`);const h=this.remuxer.remux(i,r,n,o,l,c,!0,this.id);e.push({remuxResult:h,chunkMeta:s}),s.transmuxing.executeEnd=ze()}resetInitialTimestamp(e){const{demuxer:t,remuxer:s}=this;!t||!s||(t.resetTimeStamp(e),s.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,s,i,r){const{demuxer:n,remuxer:o}=this;!n||!o||(n.resetInitSegment(e,t,s,i),o.resetInitSegment(e,t,s,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,s,i,r){let n;return t&&t.method==="SAMPLE-AES"?n=this.transmuxSampleAes(e,t,s,i,r):n=this.transmuxUnencrypted(e,s,i,r),n}transmuxUnencrypted(e,t,s,i){const{audioTrack:r,videoTrack:n,id3Track:o,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,n,o,c,t,s,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,s,i,r){return this.demuxer.demuxSampleAes(e,t,s).then(n=>({remuxResult:this.remuxer.remux(n.audioTrack,n.videoTrack,n.id3Track,n.textTrack,s,i,!1,this.id),chunkMeta:r}))}configureTransmuxer(e){const{config:t,observer:s,typeSupported:i}=this;let r;for(let d=0,u=os.length;d0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Us=a=>({remuxResult:{},chunkMeta:a});function Bt(a){return"then"in a&&a.then instanceof Function}class dh{constructor(e,t,s,i,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=s,this.duration=i,this.defaultInitPts=r||null}}class uh{constructor(e,t,s,i,r,n){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=s,this.trackSwitch=i,this.timeOffset=r,this.initSegmentChange=n}}let Yr=0;class ya{constructor(e,t,s,i){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Yr++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const l=c.data,h=this.hls;if(!(!h||!(l!=null&&l.event)||l.instanceNo!==this.instanceNo))switch(l.event){case"init":{var d;const u=(d=this.workerContext)==null?void 0:d.objectURL;u&&self.URL.revokeObjectURL(u);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}case"workerLog":{h.logger[l.data.logType]&&h.logger[l.data.logType](l.data.message);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.part=this.part,l.data.id=this.id,h.trigger(l.event,l.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const l=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(m.ERROR,{type:V.OTHER_ERROR,details:b.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:l})};const r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=s,this.onFlush=i;const n=(c,l)=>{l=l||{},l.frag=this.frag||void 0,c===m.ERROR&&(l=l,l.parent=this.id,l.part=this.part,this.error=l.error),this.hls.trigger(c,l)};this.observer=new Di,this.observer.on(m.FRAG_DECRYPTED,n),this.observer.on(m.ERROR,n);const o=ar(r.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const c=this.hls.logger;if(r.workerPath||pc()){try{r.workerPath?(c.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=yc(r.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=Ec());const{worker:h}=this.workerContext;h.addEventListener("message",this.onWorkerMessage),h.addEventListener("error",this.onWorkerError),h.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:ae(r)})}catch(h){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.terminateWorker(),this.error=null,this.transmuxer=new Hr(this.observer,o,r,"",t,e.logger)}return}}this.transmuxer=new Hr(this.observer,o,r,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Yr++;const t=this.hls.config,s=ar(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:s,id:this.id,config:ae(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),Tc(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,s,i,r,n,o,c,l,h){var d,u;l.transmuxing.start=self.performance.now();const{instanceNo:f,transmuxer:g}=this,E=n?n.start:r.start,p=r.decryptdata,y=this.frag,T=!(y&&r.cc===y.cc),v=!(y&&l.level===y.level),S=y?l.sn-y.sn:-1,x=this.part?l.part-this.part.index:-1,D=S===0&&l.id>1&&l.id===y?.stats.chunkCount,A=!v&&(S===1||S===0&&(x===1||D&&x<=0)),R=self.performance.now();(v||S||r.stats.parsing.start===0)&&(r.stats.parsing.start=R),n&&(x||!A)&&(n.stats.parsing.start=R);const _=!(y&&((d=r.initSegment)==null?void 0:d.url)===((u=y.initSegment)==null?void 0:u.url)),I=new uh(T,A,c,v,E,_);if(!A||T||_){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${r.type} sn: ${l.sn}${l.part>-1?" part: "+l.part:""} ${this.id===B.MAIN?"level":"track"}: ${l.level} id: ${l.id} + discontinuity: ${T} + trackSwitch: ${v} + contiguous: ${A} + accurateTimeOffset: ${c} + timeOffset: ${E} + initSegmentChange: ${_}`);const P=new dh(s,i,t,o,h);this.configureTransmuxer(P)}if(this.frag=r,this.part=n,this.workerContext)this.workerContext.worker.postMessage({instanceNo:f,cmd:"demux",data:e,decryptdata:p,chunkMeta:l,state:I},e instanceof ArrayBuffer?[e]:[]);else if(g){const P=g.push(e,p,l,I);Bt(P)?P.then(F=>{this.handleTransmuxComplete(F)}).catch(F=>{this.transmuxerError(F,l,"transmuxer-interface push error")}):this.handleTransmuxComplete(P)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:s}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(s){const i=s.flush(e);Bt(i)?i.then(r=>{this.handleFlushResult(r,e)}).catch(r=>{this.transmuxerError(r,e,"transmuxer-interface flush error")}):this.handleFlushResult(i,e)}}transmuxerError(e,t,s){this.hls&&(this.error=e,this.hls.trigger(m.ERROR,{type:V.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:s}))}handleFlushResult(e,t){e.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:s}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):s&&s.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Wr=100;class fh extends _i{constructor(e,t,s){super(e,t,s,"audio-stream-controller",B.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(m.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(m.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(m.BUFFER_RESET,this.onBufferReset,this),e.on(m.BUFFER_CREATED,this.onBufferCreated,this),e.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(m.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(m.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(m.FRAG_LOADING,this.onFragLoading,this),e.on(m.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(m.LEVEL_LOADED,this.onLevelLoaded,this),e.off(m.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(m.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(m.BUFFER_RESET,this.onBufferReset,this),e.off(m.BUFFER_CREATED,this.onBufferCreated,this),e.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(m.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(m.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(m.FRAG_LOADING,this.onFragLoading,this),e.off(m.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:s,initPTS:i,timescale:r,trackId:n}){if(s===B.MAIN){const o=t.cc,c=this.fragCurrent;if(this.initPTS[o]={baseTime:i,timescale:r,trackId:n},this.log(`InitPTS for cc: ${o} found from main: ${i/r} (${i}/${r}) trackId: ${n}`),this.mainAnchor=t,this.state===C.WAITING_INIT_PTS){const l=this.waitingData;(!l&&!this.loadingParts||l&&l.frag.cc!==o)&&this.syncWithAnchor(t,l?.frag)}else!this.hls.hasEnoughToStart&&c&&c.cc!==o?(c.abortRequests(),this.syncWithAnchor(t,c)):this.state===C.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var s;const i=((s=this.mainFragLoading)==null?void 0:s.frag)||null;if(t&&i?.cc===t.cc)return;const r=(i||e).cc,n=this.getLevelDetails(),o=this.getLoadPosition(),c=On(n,r,o);c&&(this.log(`Syncing with main frag at ${c.start} cc ${c.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===C.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=C.STOPPED;return}const s=this.lastCurrentTime;this.stopLoad(),this.setInterval(Wr),s>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s,this.state=C.IDLE):this.state=C.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case C.IDLE:this.doTickIdle();break;case C.WAITING_TRACK:{const{levels:e,trackId:t}=this,s=e?.[t],i=s?.details;if(i&&!this.waitForLive(s)){if(this.waitForCdnTuneIn(i))break;this.state=C.WAITING_INIT_PTS}break}case C.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case C.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:s,cache:i,complete:r}=e,n=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=C.FRAG_LOADING;const o=i.flush().buffer,c={frag:t,part:s,payload:o,networkDetails:null};this._handleFragmentLoadProgress(c),r&&super._handleFragmentLoadComplete(c)}else n&&n.cc!==e.frag.cc&&this.syncWithAnchor(n,e.frag)}else this.state=C.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:s,media:i,trackId:r}=this,n=t.config;if(!this.buffering||!i&&!this.primaryPrefetch&&(this.startFragRequested||!n.startFragPrefetch)||!(s!=null&&s[r]))return;const o=s[r],c=o.details;if(!c||this.waitForLive(o)||this.waitForCdnTuneIn(c)){this.state=C.WAITING_TRACK,this.startFragRequested=!1;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,ne.AUDIO,B.AUDIO));const h=this.getFwdBufferInfo(l,B.AUDIO);if(h===null)return;if(!this.switchingTrack&&this._streamEnded(h,c)){t.trigger(m.BUFFER_EOS,{type:"audio"}),this.state=C.ENDED;return}const d=h.len,u=t.maxBufferLength,f=c.fragments,g=f[0].start,E=this.getLoadPosition(),p=this.flushing?E:h.end;if(this.switchingTrack&&i){const v=E;c.PTSKnown&&vg||h.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=g+.05)}if(d>=u&&!this.switchingTrack&&pT.end){const S=this.fragmentTracker.getFragAtPos(p,B.MAIN);S&&S.end>T.end&&(T=S,this.mainFragLoading={frag:S,targetBufferTime:null})}if(y.start>T.end)return}this.loadFragment(y,o,p)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(s=>new Ft(s))}onAudioTrackSwitching(e,t){const s=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),s?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==C.STOPPED&&(this.setInterval(Wr),this.state=C.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const s=this.cachedTrackLoadedData;s&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(m.AUDIO_TRACK_LOADED,s))}onAudioTrackLoaded(e,t){var s;const{levels:i}=this,{details:r,id:n,groupId:o,track:c}=t;if(!i){this.warn(`Audio tracks reset while loading track ${n} "${c.name}" of "${o}"`);return}const l=this.mainDetails;if(!l||r.endCC>l.endCC||l.expired){this.cachedTrackLoadedData=t,this.state!==C.STOPPED&&(this.state=C.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${n} "${c.name}" of "${o}" loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const h=i[n];let d=0;if(r.live||(s=h.details)!=null&&s.live){if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;if(h.details){var u;d=this.alignPlaylists(r,h.details,(u=this.levelLastLoaded)==null?void 0:u.details)}r.alignedSliding||(Zn(r,l),r.alignedSliding||Ts(r,l),d=r.fragmentStart)}h.details=r,this.levelLastLoaded=h,this.startFragRequested||this.setStartPosition(l,d),this.hls.trigger(m.AUDIO_TRACK_UPDATED,{details:r,id:n,groupId:t.groupId}),this.state===C.WAITING_TRACK&&!this.waitForCdnTuneIn(r)&&(this.state=C.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const s=e.frag,{part:i,payload:r}=e,{config:n,trackId:o,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const l=c[o];if(!l){this.warn("Audio track is undefined on fragment load progress");return}const h=l.details;if(!h){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const d=n.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let u=this.transmuxer;u||(u=this.transmuxer=new ya(this.hls,B.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const f=this.initPTS[s.cc],g=(t=s.initSegment)==null?void 0:t.data;if(f!==void 0){const p=i?i.index:-1,y=p!==-1,T=new Li(s.level,s.sn,s.stats.chunkCount,r.byteLength,p,y);u.push(r,g,d,"",s,i,h.totalduration,!1,T,f)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${h.startSN} ,${h.endSN}],track ${o}`);const{cache:E}=this.waitingData=this.waitingData||{frag:s,part:i,cache:new Jn,complete:!1};E.push(new Uint8Array(r)),this.state!==C.STOPPED&&(this.state=C.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===B.MAIN&&he(t.frag)&&(this.mainFragLoading=t,this.state===C.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:s,part:i}=t;if(s.type!==B.AUDIO){!this.audioOnly&&s.type===B.MAIN&&!s.elementaryStreams.video&&!s.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${i?" p: "+i.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(he(s)){this.fragPrevious=s;const r=this.switchingTrack;r&&(this.bufferedTrack=r,this.switchingTrack=null,this.hls.trigger(m.AUDIO_TRACK_SWITCHED,se({},r)))}this.fragBufferedComplete(s,i),this.media&&this.tick()}onError(e,t){var s;if(t.fatal){this.state=C.ERROR;return}switch(t.details){case b.FRAG_GAP:case b.FRAG_PARSING_ERROR:case b.FRAG_DECRYPT_ERROR:case b.FRAG_LOAD_ERROR:case b.FRAG_LOAD_TIMEOUT:case b.KEY_LOAD_ERROR:case b.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(B.AUDIO,t);break;case b.AUDIO_TRACK_LOAD_ERROR:case b.AUDIO_TRACK_LOAD_TIMEOUT:case b.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===C.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===Q.AUDIO_TRACK&&(this.state=C.IDLE);break;case b.BUFFER_ADD_CODEC_ERROR:case b.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case b.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case b.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==ne.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==ne.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===C.ENDED&&(this.state=C.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,t,B.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const s="audio",{hls:i}=this,{remuxResult:r,chunkMeta:n}=e,o=this.getCurrentContext(n);if(!o){this.resetWhenMissingContext(n);return}const{frag:c,part:l,level:h}=o,{details:d}=h,{audio:u,text:f,id3:g,initSegment:E}=r;if(this.fragContextChanged(c)||!d){this.fragmentTracker.removeFragment(c);return}if(this.state=C.PARSING,this.switchingTrack&&u&&this.completeAudioSwitch(this.switchingTrack),E!=null&&E.tracks){const p=c.initSegment||c;if(this.unhandledEncryptionError(E,c))return;this._bufferInitSegment(h,E.tracks,p,n),i.trigger(m.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:s,tracks:E.tracks})}if(u){const{startPTS:p,endPTS:y,startDTS:T,endDTS:v}=u;l&&(l.elementaryStreams[ne.AUDIO]={startPTS:p,endPTS:y,startDTS:T,endDTS:v}),c.setElementaryStreamInfo(ne.AUDIO,p,y,T,v),this.bufferFragmentData(u,c,l,n)}if(g!=null&&(t=g.samples)!=null&&t.length){const p=re({id:s,frag:c,details:d},g);i.trigger(m.FRAG_PARSING_METADATA,p)}if(f){const p=re({id:s,frag:c,details:d},f);i.trigger(m.FRAG_PARSING_USERDATA,p)}}_bufferInitSegment(e,t,s,i){if(this.state!==C.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const r=t.audio;r.id=B.AUDIO;const n=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${n}/${r.codec}]`),n&&n.split(",").length===1&&(r.levelCodec=n),this.hls.trigger(m.BUFFER_CODECS,t);const o=r.initSegment;if(o!=null&&o.byteLength){const c={type:"audio",frag:s,part:null,chunkMeta:i,parent:s.type,data:o};this.hls.trigger(m.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,s){const i=this.fragmentTracker.getState(e);if(this.switchingTrack||i===ue.NOT_LOADED||i===ue.PARTIAL){var r;if(!he(e))this._loadInitSegment(e,t);else if((r=t.details)!=null&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=C.WAITING_INIT_PTS;const n=this.mainDetails;n&&n.fragmentStart!==t.details.fragmentStart&&Ts(t.details,n)}else super.loadFragment(e,t,s)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:s,assocLang:i,characteristics:r,audioCodec:n,channels:o}=this.bufferedTrack;ht({name:t,lang:s,assocLang:i,characteristics:r,audioCodec:n,channels:o},e,ct)||(gs(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(m.AUDIO_TRACK_SWITCHED,se({},e))}}class Mi extends ke{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,s){const i=t?.renditionReports;if(i){let r=-1;for(let n=0;n=0&&h>t.partTarget&&(c+=1)}const l=s&&or(s);return new lr(o,c>=0?c:void 0,l)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}return e}playlistLoaded(e,t,s){const{details:i,stats:r}=t,n=self.performance.now(),o=r.loading.first?Math.max(0,n-r.loading.first):0;i.advancedDateTime=Date.now()-o;const c=this.hls.config.timelineOffset;if(c!==i.appliedTimelineOffset){const h=Math.max(c||0,0);i.appliedTimelineOffset=h,i.fragments.forEach(d=>{d.setStart(d.playlistOffset+h)})}if(i.live||s!=null&&s.live){const h="levelInfo"in t?t.levelInfo:t.track;if(i.reloaded(s),s&&i.fragments.length>0){nc(s,i,this);const T=i.playlistParsingError;if(T){this.warn(T);const v=this.hls;if(!v.config.ignorePlaylistParsingErrors){var l;const{networkDetails:S}=t;v.trigger(m.ERROR,{type:V.NETWORK_ERROR,details:b.LEVEL_PARSING_ERROR,fatal:!1,url:i.url,error:T,reason:T.message,level:t.level||void 0,parent:(l=i.fragments[0])==null?void 0:l.type,networkDetails:S,stats:r});return}i.playlistParsingError=null}}i.requestScheduled===-1&&(i.requestScheduled=r.loading.start);const d=this.hls.mainForwardBufferInfo,u=d?d.end-d.len:0,f=(i.edge-u)*1e3,g=jn(i,f);if(i.requestScheduled+g0){if(_>i.targetduration*3)this.log(`Playlist last advanced ${R.toFixed(2)}s ago. Omitting segment and part directives.`),p=void 0,y=void 0;else if(s!=null&&s.tuneInGoal&&_-i.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${I} with playlist age: ${i.age}`),I=0;else{const P=Math.floor(I/i.targetduration);if(p+=P,y!==void 0){const F=Math.round(I%i.targetduration/i.partTarget);y+=F}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${R.toFixed(2)}s goal: ${I} skip sn ${P} to part ${y}`)}i.tuneInGoal=I}if(E=this.getDeliveryDirectives(i,t.deliveryDirectives,p,y),T||!A){i.requestScheduled=n,this.loadingPlaylist(h,E);return}}else(i.canBlockReload||i.canSkipUntil)&&(E=this.getDeliveryDirectives(i,t.deliveryDirectives,p,y));E&&p!==void 0&&i.canBlockReload&&(i.requestScheduled=r.loading.first+Math.max(g-o*2,g/2)),this.scheduleLoading(h,E,i)}else this.clearTimer()}scheduleLoading(e,t,s){const i=s||e.details;if(!i){this.loadingPlaylist(e,t);return}const r=self.performance.now(),n=i.requestScheduled;if(r>=n){this.loadingPlaylist(e,t);return}const o=n-r;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,s,i){let r=or(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,i=t.part,r=rs.No),new lr(s,i,r)}checkRetry(e){const t=e.details,s=ms(e),i=e.errorAction,{action:r,retryCount:n=0,retryConfig:o}=i||{},c=!!i&&!!o&&(r===me.RetryRequest||!i.resolved&&r===me.SendAlternateToPenaltyBox);if(c){var l;if(n>=o.maxNumRetry)return!1;if(s&&(l=e.context)!=null&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${n+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const h=Ai(o,n);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),h),this.warn(`Retrying playlist loading ${n+1}/${o.maxNumRetry} after "${t}" in ${h}ms`)}e.levelRetry=!0,i.resolved=!0}return c}}function Ta(a,e){if(a.length!==e.length)return!1;for(let t=0;ta[i]!==e[i])}function hi(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class gh extends Mi{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.LEVEL_LOADING,this.onLevelLoading,this),e.on(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(m.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.LEVEL_LOADING,this.onLevelLoading,this),e.off(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(m.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(m.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:s,groupId:i,details:r}=t,n=this.tracksInGroup[s];if(!n||n.groupId!==i){this.warn(`Audio track with id:${s} and group:${i} not found in active group ${n?.groupId}`);return}const o=n.details;n.details=t.details,this.log(`Audio track ${s} "${n.name}" lang:${n.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.audioGroups||null,i=this.groupIds;let r=this.currentTrack;if(!s||i?.length!==s?.length||s!=null&&s.some(o=>i?.indexOf(o)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(u=>!s||s.indexOf(u.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(u=>u.default)&&(this.selectDefaultTrack=!1),o.forEach((u,f)=>{u.id=f});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!r&&c){const u=Ke(c,o,ct);if(u>-1)r=o[u];else{const f=Ke(c,this.tracks);r=this.tracks[f]}}let l=this.findTrackId(r);l===-1&&r&&(l=this.findTrackId(null));const h={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${s?.join(",")}`),this.hls.trigger(m.AUDIO_TRACKS_UPDATED,h);const d=this.trackId;if(l!==-1&&d===-1)this.setAudioTrack(l);else if(o.length&&d===-1){var n;const u=new Error(`No audio track selected for current audio group-ID(s): ${(n=this.groupIds)==null?void 0:n.join(",")} track count: ${o.length}`);this.warn(u.message),this.hls.trigger(m.ERROR,{type:V.MEDIA_ERROR,details:b.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:u})}}}onError(e,t){t.fatal||!t.context||t.context.type===Q.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){const i=this.currentTrack;if(i&&ht(e,i,ct))return i;const r=Ke(e,this.tracksInGroup,ct);if(r>-1){const n=this.tracksInGroup[r];return this.setAudioTrack(r),n}else if(i){let n=t.loadLevel;n===-1&&(n=t.firstAutoLevel);const o=Rl(e,t.levels,s,n,ct);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const n=Ke(e,s);if(n>-1)return s[n]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,i=t[e],r=i.details&&!i.details.live;if(e===this.trackId&&i===s&&r||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(m.AUDIO_TRACK_SWITCHING,se({},i)),r))return;const n=this.switchParams(i.url,s?.details,i.details);this.loadPlaylist(n)}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s{const s={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(s,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const s={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(s)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const s=(t=e[0])==null?void 0:t.label;(s==="async-blocker"||s==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(r){var s;if(i.onError(r),this.queues===null||this.tracks===null)return;const n=(s=this.tracks[e])==null?void 0:s.buffer;n!=null&&n.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"":` +${this.list("video")} +${this.list("audio")} +${this.list("audiovideo")}}`}list(e){var t,s;return(t=this.queues)!=null&&t[e]||(s=this.tracks)!=null&&s[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const s=(t=this.tracks)==null?void 0:t[e],i=s?.buffer;return i?`SourceBuffer${i.updating?" updating":""}${s.ended?" ended":""}${s.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(s=>s.label).join(", "))||""}}const jr=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,va="HlsJsTrackRemovedError";class ph extends Error{constructor(e){super(e),this.name=va}}class Eh extends ke{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=s=>{var i;this.hls&&((i=this.mediaSource)==null?void 0:i.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=s=>{const{media:i,mediaSource:r}=this;s&&this.log("Media source opened"),!(!i||!r)&&(r.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(m.MEDIA_ATTACHED,{media:i,mediaSource:r}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:s,_objectUrl:i}=this;s!==i&&this.error(`Media element src was set while attaching MediaSource (${i} > ${s})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=Uo(st(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.BUFFER_RESET,this.onBufferReset,this),e.on(m.BUFFER_APPENDING,this.onBufferAppending,this),e.on(m.BUFFER_CODECS,this.onBufferCodecs,this),e.on(m.BUFFER_EOS,this.onBufferEos,this),e.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(m.FRAG_PARSED,this.onFragParsed,this),e.on(m.FRAG_CHANGED,this.onFragChanged,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.BUFFER_RESET,this.onBufferReset,this),e.off(m.BUFFER_APPENDING,this.onBufferAppending,this),e.off(m.BUFFER_CODECS,this.onBufferCodecs,this),e.off(m.BUFFER_EOS,this.onBufferEos,this),e.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(m.FRAG_PARSED,this.onFragParsed,this),e.off(m.FRAG_CHANGED,this.onFragChanged,this),e.off(m.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const s={};if(this.operationQueue){const r=this.isUpdating();r||this.operationQueue.removeBlockers();const n=this.isQueued();(r||n)&&this.warn(`Transfering MediaSource with${n?" operations in queue":""}${r?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const i=this.transferData;return!this.sourceBufferCount&&i&&i.mediaSource===t?re(s,i.tracks):this.sourceBuffers.forEach(r=>{const[n]=r;n&&(s[n]=re({},this.tracks[n]),this.removeBuffer(n)),r[0]=r[1]=null}),{media:e,mediaSource:t,tracks:s}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var s;let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(`${i} bufferCodec event(s) expected.`),(s=this.transferData)!=null&&s.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()}onMediaAttaching(e,t){const s=this.media=t.media;this.transferData=this.overrides=void 0;const i=st(this.appendSource);if(i){const r=!!t.mediaSource;(r||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const n=this.mediaSource=t.mediaSource||new i;if(this.assignMediaSource(n),r)this._objectUrl=s.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(n);if(this.appendSource)try{s.removeAttribute("src");const c=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||c&&n instanceof c,qr(s),yh(s,o),s.load()}catch{s.src=o}else s.src=o}s.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,s;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(s=e.constructor)==null?void 0:s.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const s=this.tracks,i=t.tracks,r=i?Object.keys(i):null,n=r?r.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(i&&r&&n){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal}) +required tracks: ${ae(s,(c,l)=>c==="initSegment"?void 0:l)}; +transfer tracks: ${ae(i,(c,l)=>c==="initSegment"?void 0:l)}}`),!pn(i,s)){t.mediaSource=null,t.tracks=void 0;const c=e.currentTime,l=this.details,h=Math.max(c,l?.fragments[0].start||0);if(h-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${h}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(i)}"->"${Object.keys(s)}") start time: ${h} currentTime: ${c}`),this.onMediaDetaching(m.MEDIA_DETACHING,{}),this.onMediaAttaching(m.MEDIA_ATTACHING,t),e.currentTime=h;return}this.transferData=void 0,r.forEach(c=>{const l=c,h=i[l];if(h){const d=h.buffer;if(d){const u=this.fragmentTracker,f=h.id;if(u.hasFragments(f)||u.hasParts(f)){const p=j.getBuffered(d);u.detectEvictedFragments(l,p,f,null,!0)}const g=$s(l),E=[l,d];this.sourceBuffers[g]=E,d.updating&&this.operationQueue&&this.operationQueue.prependBlocker(l),this.trackSourceBuffer(l,h)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const s=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:i,mediaSource:r,_objectUrl:n}=this;if(r){if(this.log(`media source ${s?"transferring":"detaching"}`),s)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=r.readyState==="open";try{const c=r.sourceBuffers;for(let l=c.length;l--;)o&&c[l].abort(),r.removeSourceBuffer(c[l]);o&&r.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}r.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("sourceended",this._onMediaSourceEnded),r.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(r.removeEventListener("startstreaming",this._onStartStreaming),r.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}i&&(i.removeEventListener("emptied",this._onMediaEmptied),s||(n&&self.URL.revokeObjectURL(n),this.mediaSrc===n?(i.removeAttribute("src"),this.appendSource&&qr(i),i.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(m.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const s=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),s)try{var i;(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(s)}catch(r){this.warn(`onBufferReset ${e}`,r)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[$s(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new mh(this.tracks)}onBufferCodecs(e,t){var s;const i=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);const n="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),o=!n&&this.sourceBufferCount&&this.media&&r.some(c=>!i[c]);if(n||o){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${r}" SourceBuffers`);return}r.forEach(c=>{var l,h;const d=t[c],{id:u,codec:f,levelCodec:g,container:E,metadata:p,supplemental:y}=d;let T=i[c];const v=(l=this.transferData)==null||(l=l.tracks)==null?void 0:l[c],S=v!=null&&v.buffer?v:T,x=S?.pendingCodec||S?.codec,D=S?.levelCodec;T||(T=i[c]={buffer:void 0,listeners:[],codec:f,supplemental:y,container:E,levelCodec:g,metadata:p,id:u});const A=is(x,D),R=A?.replace(jr,"$1");let _=is(f,g);const I=(h=_)==null?void 0:h.replace(jr,"$1");_&&A&&R!==I&&(c.slice(0,5)==="audio"&&(_=us(_,this.appendSource)),this.log(`switching codec ${x} to ${_}`),_!==(T.pendingCodec||T.codec)&&(T.pendingCodec=_),T.container=E,this.appendChangeType(c,E,_))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((s=t.audio)==null?void 0:s.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const s=this.tracks[t];return e[t]={id:s.id,container:s.container,codec:s.codec,levelCodec:s.levelCodec},e},{})}appendChangeType(e,t,s){const i=`${t};codecs=${s}`,r={label:`change-type=${i}`,execute:()=>{const n=this.tracks[e];if(n){const o=n.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${i}`),o.changeType(i),n.codec=s,n.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{this.warn(`Failed to change ${e} SourceBuffer type`,n)}};this.append(r,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const s=e.start,i=s+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(s,B.MAIN))==null?void 0:t.gap)===!0)return;const n={label:"block-audio",execute:()=>{var o;const c=this.tracks.video;(this.lastVideoAppendEnd>i||c!=null&&c.buffer&&j.isBuffered(c.buffer,i)||((o=this.fragmentTracker.getAppendedFrag(i,B.MAIN))==null?void 0:o.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.blockedAudioAppend={op:n,frag:e},this.append(n,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:s}=this,{data:i,type:r,parent:n,frag:o,part:c,chunkMeta:l,offset:h}=t,d=l.buffering[r],{sn:u,cc:f}=o,g=self.performance.now();d.start=g;const E=o.stats.buffering,p=c?c.stats.buffering:null;E.start===0&&(E.start=g),p&&p.start===0&&(p.start=g);const y=s.audio;let T=!1;r==="audio"&&y?.container==="audio/mpeg"&&(T=!this.lastMpegAudioChunk||l.id===1||this.lastMpegAudioChunk.sn!==l.sn,this.lastMpegAudioChunk=l);const v=s.video,S=v?.buffer;if(S&&u!=="initSegment"){const A=c||o,R=this.blockedAudioAppend;if(r==="audio"&&n!=="main"&&!this.blockedAudioAppend&&!(v.ending||v.ended)){const I=A.start+A.duration*.05,P=S.buffered,F=this.currentOp("video");!P.length&&!F?this.blockAudio(A):!F&&!j.isBuffered(S,I)&&this.lastVideoAppendEndI||_{var A;d.executeStart=self.performance.now();const R=(A=this.tracks[r])==null?void 0:A.buffer;R&&(T?this.updateTimestampOffset(R,x,.1,r,u,f):h!==void 0&&M(h)&&this.updateTimestampOffset(R,h,1e-6,r,u,f)),this.appendExecutor(i,r)},onStart:()=>{},onComplete:()=>{const A=self.performance.now();d.executeEnd=d.end=A,E.first===0&&(E.first=A),p&&p.first===0&&(p.first=A);const R={};this.sourceBuffers.forEach(([_,I])=>{_&&(R[_]=j.getBuffered(I))}),this.appendErrors[r]=0,r==="audio"||r==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(m.BUFFER_APPENDED,{type:r,frag:o,part:c,chunkMeta:l,parent:o.type,timeRanges:R})},onError:A=>{var R;const _={type:V.MEDIA_ERROR,parent:o.type,details:b.BUFFER_APPEND_ERROR,sourceBufferName:r,frag:o,part:c,chunkMeta:l,error:A,err:A,fatal:!1},I=(R=this.media)==null?void 0:R.error;if(A.code===DOMException.QUOTA_EXCEEDED_ERR||A.name=="QuotaExceededError"||"quota"in A)_.details=b.BUFFER_FULL_ERROR;else if(A.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!I)_.errorAction=vt(!0);else if(A.name===va&&this.sourceBufferCount===0)_.errorAction=vt(!0);else{const P=++this.appendErrors[r];this.warn(`Failed ${P}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${r}" sourceBuffer (${I||"no media error"})`),(P>=this.hls.config.appendErrorMaxRetry||I)&&(_.fatal=!0)}this.hls.trigger(m.ERROR,_)}};this.log(`queuing "${r}" append sn: ${u}${c?" p: "+c.index:""} of ${o.type===B.MAIN?"level":"track"} ${o.level} cc: ${f}`),this.append(D,r,this.isPending(this.tracks[r]))}getFlushOp(e,t,s){return this.log(`queuing "${e}" remove ${t}-${s}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,s)},onStart:()=>{},onComplete:()=>{this.hls.trigger(m.BUFFER_FLUSHED,{type:e})},onError:i=>{this.warn(`Failed to remove ${t}-${s} from "${e}" SourceBuffer`,i)}}}onBufferFlushing(e,t){const{type:s,startOffset:i,endOffset:r}=t;s?this.append(this.getFlushOp(s,i,r),s):this.sourceBuffers.forEach(([n])=>{n&&this.append(this.getFlushOp(n,i,r),n)})}onFragParsed(e,t){const{frag:s,part:i}=t,r=[],n=i?i.elementaryStreams:s.elementaryStreams;n[ne.AUDIOVIDEO]?r.push("audiovideo"):(n[ne.AUDIO]&&r.push("audio"),n[ne.VIDEO]&&r.push("video"));const o=()=>{const c=self.performance.now();s.stats.buffering.end=c,i&&(i.stats.buffering.end=c);const l=i?i.stats:s.stats;this.hls.trigger(m.FRAG_BUFFERED,{frag:s,part:i,stats:l,id:s.type})};r.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(o,r).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var s;this.sourceBuffers.forEach(([n])=>{if(n){const o=this.tracks[n];(!t.type||t.type===n)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${n} buffer reached EOS`)))}});const i=((s=this.overrides)==null?void 0:s.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([n])=>{var o;return n&&!((o=this.tracks[n])!=null&&o.ended)})?i?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:n}=this;if(!n||n.readyState!=="open"){n&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${n.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),n.endOfStream(),this.hls.trigger(m.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(m.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===b.BUFFER_APPEND_ERROR&&t.frag){var s;const i=(s=t.errorAction)==null?void 0:s.nextAutoLevel;M(i)&&i!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:s}=this;if(!s||t===null||!this.sourceBufferCount)return;const i=e.config,r=s.currentTime,n=t.levelTargetDuration,o=t.live&&i.liveBackBufferLength!==null?i.liveBackBufferLength:i.backBufferLength;if(M(o)&&o>=0){const l=Math.max(o,n),h=Math.floor(r/n)*n-l;this.flushBackBuffer(r,n,h)}const c=i.frontBufferFlushThreshold;if(M(c)&&c>0){const l=Math.max(i.maxBufferLength,c),h=Math.max(l,n),d=Math.floor(r/n)*n+h;this.flushFrontBuffer(r,n,d)}}flushBackBuffer(e,t,s){this.sourceBuffers.forEach(([i,r])=>{if(r){const o=j.getBuffered(r);if(o.length>0&&s>o.start(0)){var n;this.hls.trigger(m.BACK_BUFFER_REACHED,{bufferEnd:s});const c=this.tracks[i];if((n=this.details)!=null&&n.live)this.hls.trigger(m.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(c!=null&&c.ended){this.log(`Cannot flush ${i} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(m.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:i})}}})}flushFrontBuffer(e,t,s){this.sourceBuffers.forEach(([i,r])=>{if(r){const n=j.getBuffered(r),o=n.length;if(o<2)return;const c=n.start(o-1),l=n.end(o-1);if(s>c||e>=c&&e<=l)return;this.hls.trigger(m.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:i})}})}getDurationAndRange(){var e;const{details:t,mediaSource:s}=this;if(!t||!this.media||s?.readyState!=="open")return null;const i=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&s.setLiveSeekableRange){const l=Math.max(0,t.fragmentStart),h=Math.max(l,i);return{duration:1/0,start:l,end:h}}return{duration:1/0}}const r=(e=this.overrides)==null?void 0:e.duration;if(r)return M(r)?{duration:r}:null;const n=this.media.duration,o=M(s.duration)?s.duration:0;return i>o&&i>n||!M(n)?{duration:i}:null}updateMediaSource({duration:e,start:t,end:s}){const i=this.mediaSource;!this.media||!i||i.readyState!=="open"||(i.duration!==e&&(M(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),i.duration=e),t!==void 0&&s!==void 0&&(this.log(`MediaSource duration is set to ${i.duration}. Setting seekable range to ${t}-${s}.`),i.setLiveSeekableRange(t,s)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:s}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${ae(s)}`),this.tracksReady){var i;const r=(i=this.transferData)==null?void 0:i.tracks;r&&Object.keys(r).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,s])=>{if(t){const i=this.tracks[t];e[t]={buffer:s,container:i.container,codec:i.codec,supplemental:i.supplemental,levelCodec:i.levelCodec,id:i.id,metadata:i.metadata}}}),this.hls.trigger(m.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(m.ERROR,{type:V.MEDIA_ERROR,details:b.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:s}=this;if(!s)throw new Error("createSourceBuffers called when mediaSource was null");for(const r in e){const n=r,o=e[n];if(this.isPending(o)){const c=this.getTrackCodec(o,n),l=`${o.container};codecs=${c}`;o.codec=c,this.log(`creating sourceBuffer(${l})${this.currentOp(n)?" Queued":""} ${ae(o)}`);try{const h=s.addSourceBuffer(l),d=$s(n),u=[n,h];t[d]=u,o.buffer=h}catch(h){var i;this.error(`error while trying to add sourceBuffer: ${h.message}`),this.shiftAndExecuteNext(n),(i=this.operationQueue)==null||i.removeBlockers(),delete this.tracks[n],this.hls.trigger(m.ERROR,{type:V.MEDIA_ERROR,details:b.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,sourceBufferName:n,mimeType:l,parent:o.id});return}this.trackSourceBuffer(n,o)}}this.bufferCreated()}getTrackCodec(e,t){const s=e.supplemental;let i=e.codec;s&&(t==="video"||t==="audiovideo")&&wt(s,"video")&&(i=ol(i,s));const r=is(i,e.levelCodec);return r?t.slice(0,5)==="audio"?us(r,this.appendSource):r:""}trackSourceBuffer(e,t){const s=t.buffer;if(!s)return;const i=this.getTrackCodec(t,e);this.tracks[e]={buffer:s,codec:i,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(r,n)=>{const o=n.removedRanges;o!=null&&o.length&&this.hls.trigger(m.BUFFER_FLUSHED,{type:r})})}get mediaSrc(){var e,t;const s=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return s?.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const s=this.currentOp(e);s&&(s.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var s;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(s=this.mediaSource)==null?void 0:s.readyState}`);this.error(`${i}`,t),this.hls.trigger(m.ERROR,{type:V.MEDIA_ERROR,details:b.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const r=this.currentOp(e);r&&r.onError(i)}updateTimestampOffset(e,t,s,i,r,n){const o=t-e.timestampOffset;Math.abs(o)>=s&&(this.log(`Updating ${i} SourceBuffer timestampOffset to ${t} (sn: ${r} cc: ${n})`),e.timestampOffset=t)}removeExecutor(e,t,s){const{media:i,mediaSource:r}=this,n=this.tracks[e],o=n?.buffer;if(!i||!r||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=M(i.duration)?i.duration:1/0,l=M(r.duration)?r.duration:1/0,h=Math.max(0,t),d=Math.min(s,c,l);d>h&&(!n.ending||n.ended)?(n.ended=!1,this.log(`Removing [${h},${d}] from the ${e} SourceBuffer`),o.remove(h,d)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const s=this.tracks[t],i=s?.buffer;if(!i)throw new ph(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);s.ending=!1,s.ended=!1,i.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:s}=this,i=t.map(n=>this.appendBlocker(n));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(i).then(n=>{s===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var s;const i=(s=this.tracks[t])==null?void 0:s.buffer;!i||i.updating||this.shiftAndExecuteNext(t)})}append(e,t,s){this.operationQueue&&this.operationQueue.append(e,t,s)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,s){const i=this.tracks[e];if(!i)return;const r=i.buffer;if(!r)return;const n=s.bind(this,e);i.listeners.push({event:t,listener:n}),r.addEventListener(t,n)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const s=t.buffer;s&&(t.listeners.forEach(i=>{s.removeEventListener(i.event,i.listener)}),t.listeners.length=0)}}function qr(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function yh(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}function $s(a){return a==="audio"?1:0}class Ni{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(m.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(m.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(m.BUFFER_CODECS,this.onBufferCodecs,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(m.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(m.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(m.BUFFER_CODECS,this.onBufferCodecs,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const s=this.hls.levels[t.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const s=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,s.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&M(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,s=this.getMaxLevel(e.length-1);s!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${s}: ${e[s].height}p@${e[s].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=s,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const s=t.filter((i,r)=>this.isLevelAllowed(i)&&r<=e);return this.clientRect=null,Ni.getMaxLevelByMediaSize(s,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const s=e.getBoundingClientRect();t.width=s.width,t.height=s.height,!t.width&&!t.height&&(t.width=s.right-s.left||e.width||0,t.height=s.bottom-s.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(s=>e.bitrate===s.bitrate&&e.width===s.width&&e.height===s.height)}static getMaxLevelByMediaSize(e,t,s){if(!(e!=null&&e.length))return-1;const i=(o,c)=>c?o.width!==c.width||o.height!==c.height:!0;let r=e.length-1;const n=Math.max(t,s);for(let o=0;o=n||c.height>=n)&&i(c,e[o+1])){r=o;break}}return r}}const Th={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Se=Th,vh={HLS:"h"},Sh=vh;class He{constructor(e,t){Array.isArray(e)&&(e=e.map(s=>s instanceof He?s:new He(s))),this.value=e,this.params=t}}const xh="Dict";function Ah(a){return Array.isArray(a)?JSON.stringify(a):a instanceof Map?"Map{}":a instanceof Set?"Set{}":typeof a=="object"?JSON.stringify(a):String(a)}function Ih(a,e,t,s){return new Error(`failed to ${a} "${Ah(e)}" as ${t}`,{cause:s})}function Ye(a,e,t){return Ih("serialize",a,e,t)}class Sa{constructor(e){this.description=e}}const Xr="Bare Item",Lh="Boolean";function Rh(a){if(typeof a!="boolean")throw Ye(a,Lh);return a?"?1":"?0"}function bh(a){return btoa(String.fromCharCode(...a))}const _h="Byte Sequence";function Dh(a){if(ArrayBuffer.isView(a)===!1)throw Ye(a,_h);return`:${bh(a)}:`}const Ch="Integer";function Ph(a){return a<-999999999999999||99999999999999912)throw Ye(a,wh);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Fh="String",Mh=/[\x00-\x1f\x7f]+/;function Nh(a){if(Mh.test(a))throw Ye(a,Fh);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Bh(a){return a.description||a.toString().slice(7,-1)}const Uh="Token";function zr(a){const e=Bh(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Ye(e,Uh);return e}function di(a){switch(typeof a){case"number":if(!M(a))throw Ye(a,Xr);return Number.isInteger(a)?xa(a):Oh(a);case"string":return Nh(a);case"symbol":return zr(a);case"boolean":return Rh(a);case"object":if(a instanceof Date)return kh(a);if(a instanceof Uint8Array)return Dh(a);if(a instanceof Sa)return zr(a);default:throw Ye(a,Xr)}}const $h="Key";function ui(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw Ye(a,$h);return a}function Bi(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${ui(e)}`:`;${ui(e)}=${di(t)}`).join("")}function Ia(a){return a instanceof He?`${di(a.value)}${Bi(a.params)}`:di(a)}function Gh(a){return`(${a.value.map(Ia).join(" ")})${Bi(a.params)}`}function Kh(a,e={whitespace:!0}){if(typeof a!="object"||a==null)throw Ye(a,xh);const t=a instanceof Map?a.entries():Object.entries(a),s=e?.whitespace?" ":"";return Array.from(t).map(([i,r])=>{r instanceof He||(r=new He(r));let n=ui(i);return r.value===!0?n+=Bi(r.params):(n+="=",Array.isArray(r.value)?n+=Gh(r):n+=Ia(r)),n}).join(`,${s}`)}function La(a,e){return Kh(a,e)}const Ue="CMCD-Object",ce="CMCD-Request",ot="CMCD-Session",Ze="CMCD-Status",Vh={br:Ue,ab:Ue,d:Ue,ot:Ue,tb:Ue,tpb:Ue,lb:Ue,tab:Ue,lab:Ue,url:Ue,pb:ce,bl:ce,tbl:ce,dl:ce,ltc:ce,mtp:ce,nor:ce,nrr:ce,rc:ce,sn:ce,sta:ce,su:ce,ttfb:ce,ttfbb:ce,ttlb:ce,cmsdd:ce,cmsds:ce,smrt:ce,df:ce,cs:ce,ts:ce,cid:ot,pr:ot,sf:ot,sid:ot,st:ot,v:ot,msd:ot,bs:Ze,bsd:Ze,cdn:Ze,rtp:Ze,bg:Ze,pt:Ze,ec:Ze,e:Ze},Hh={REQUEST:ce};function Yh(a){return Object.keys(a).reduce((e,t)=>{var s;return(s=a[t])===null||s===void 0||s.forEach(i=>e[i]=t),e},{})}function Wh(a,e){const t={};if(!a)return t;const s=Object.keys(a),i=e?Yh(e):{};return s.reduce((r,n)=>{var o;const c=Vh[n]||i[n]||Hh.REQUEST,l=(o=r[c])!==null&&o!==void 0?o:r[c]={};return l[n]=a[n],r},t)}function jh(a){return["ot","sf","st","e","sta"].includes(a)}function qh(a){return typeof a=="number"?M(a):a!=null&&a!==""&&a!==!1}const Ra="event";function Xh(a,e){const t=new URL(a),s=new URL(e);if(t.origin!==s.origin)return a;const i=t.pathname.split("/").slice(1),r=s.pathname.split("/").slice(1,-1);for(;i[0]===r[0];)i.shift(),r.shift();for(;r.length;)r.shift(),i.unshift("..");return i.join("/")+t.search+t.hash}const ls=a=>Math.round(a),fi=(a,e)=>Array.isArray(a)?a.map(t=>fi(t,e)):a instanceof He&&typeof a.value=="string"?new He(fi(a.value,e),a.params):(e.baseUrl&&(a=Xh(a,e.baseUrl)),e.version===1?encodeURIComponent(a):a),qt=a=>ls(a/100)*100,zh=(a,e)=>{let t=a;return e.version>=2&&(a instanceof He&&typeof a.value=="string"?t=new He([a]):typeof a=="string"&&(t=[a])),fi(t,e)},Qh={br:ls,d:ls,bl:qt,dl:qt,mtp:qt,nor:zh,rtp:qt,tb:ls},ba="request",_a="response",Ui=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],Zh=["e"],Jh=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Is(a){return Jh.test(a)}function ed(a){return Ui.includes(a)||Zh.includes(a)||Is(a)}const Da=["d","dl","nor","ot","rtp","su"];function td(a){return Ui.includes(a)||Da.includes(a)||Is(a)}const sd=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function id(a){return Ui.includes(a)||Da.includes(a)||sd.includes(a)||Is(a)}const rd=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function nd(a){return rd.includes(a)||Is(a)}const ad={[_a]:id,[Ra]:ed,[ba]:td};function Ca(a,e={}){const t={};if(a==null||typeof a!="object")return t;const s=e.version||a.v||1,i=e.reportingMode||ba,r=s===1?nd:ad[i];let n=Object.keys(a).filter(r);const o=e.filter;typeof o=="function"&&(n=n.filter(o));const c=i===_a||i===Ra;c&&!n.includes("ts")&&n.push("ts"),s>1&&!n.includes("v")&&n.push("v");const l=re({},Qh,e.formatters),h={version:s,reportingMode:i,baseUrl:e.baseUrl};return n.sort().forEach(d=>{let u=a[d];const f=l[d];if(typeof f=="function"&&(u=f(u,h)),d==="v"){if(s===1)return;u=s}d=="pr"&&u===1||(c&&d==="ts"&&!M(u)&&(u=Date.now()),qh(u)&&(jh(d)&&typeof u=="string"&&(u=new Sa(u)),t[d]=u))}),t}function od(a,e={}){const t={};if(!a)return t;const s=Ca(a,e),i=Wh(s,e?.customHeaderMap);return Object.entries(i).reduce((r,[n,o])=>{const c=La(o,{whitespace:!1});return c&&(r[n]=c),r},t)}function ld(a,e,t){return re(a,od(e,t))}const cd="CMCD";function hd(a,e={}){return a?La(Ca(a,e),{whitespace:!1}):""}function dd(a,e={}){if(!a)return"";const t=hd(a,e);return encodeURIComponent(t)}function ud(a,e={}){if(!a)return"";const t=dd(a,e);return`${cd}=${t}`}const Qr=/CMCD=[^&#]+/;function fd(a,e,t){const s=ud(e,t);if(!s)return a;if(Qr.test(a))return a.replace(Qr,s);const i=a.includes("?")?"&":"?";return`${a}${i}${s}`}class gd{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=i=>{try{this.apply(i,{ot:Se.MANIFEST,su:!this.initialized})}catch(r){this.hls.logger.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=i=>{try{const{frag:r,part:n}=i,o=this.hls.levels[r.level],c=this.getObjectType(r),l={d:(n||r).duration*1e3,ot:c};(c===Se.VIDEO||c===Se.AUDIO||c==Se.MUXED)&&(l.br=o.bitrate/1e3,l.tb=this.getTopBandwidth(c)/1e3,l.bl=this.getBufferLength(c));const h=n?this.getNextPart(n):this.getNextFrag(r);h!=null&&h.url&&h.url!==r.url&&(l.nor=h.url),this.apply(i,l)}catch(r){this.hls.logger.warn("Could not generate segment CMCD data.",r)}},this.hls=e;const t=this.config=e.config,{cmcd:s}=t;s!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||e.sessionId,this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.includeKeys=s.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHED,this.onMediaDetached,this),e.on(m.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHED,this.onMediaDetached,this),e.off(m.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var s,i;this.audioBuffer=(s=t.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:Sh.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){re(t,this.createData());const s=t.ot===Se.INIT||t.ot===Se.VIDEO||t.ot===Se.MUXED;this.starved&&s&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((n,o)=>(i.includes(o)&&(n[o]=t[o]),n),{}));const r={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),ld(e.headers,t,r)):e.url=fd(e.url,t,r)}getNextFrag(e){var t;const s=(t=this.hls.levels[e.level])==null?void 0:t.details;if(s){const i=e.sn-s.startSN;return s.fragments[i+1]}}getNextPart(e){var t;const{index:s,fragment:i}=e,r=(t=this.hls.levels[i.level])==null||(t=t.details)==null?void 0:t.partList;if(r){const{sn:n}=i;for(let o=r.length-1;o>=0;o--){const c=r[o];if(c.index===s&&c.fragment.sn===n)return r[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Se.TIMED_TEXT;if(e.sn==="initSegment")return Se.INIT;if(t==="audio")return Se.AUDIO;if(t==="main")return this.hls.audioTracks.length?Se.VIDEO:Se.MUXED}getTopBandwidth(e){let t=0,s;const i=this.hls;if(e===Se.AUDIO)s=i.audioTracks;else{const r=i.maxAutoLevel,n=r>-1?r+1:i.levels.length;s=i.levels.slice(0,n)}return s.forEach(r=>{r.bitrate>t&&(t=r.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,s=e===Se.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!t?NaN:j.bufferInfo(s,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new s(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,n,o){t(r),this.loader.load(r,n,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,s=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new s(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,n,o){t(r),this.loader.load(r,n,o)}}}}const md=3e5;class pd extends ke{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(m.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(m.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(s=>s!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:s}=t;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:s}=t;if(s?.action===me.SendAlternateToPenaltyBox&&s.flags===Ie.MoveAllAlternatesMatchingHost){const i=this.levels;let r=this._pathwayPriority,n=this.pathwayId;if(t.context){const{groupId:o,pathwayId:c,type:l}=t.context;o&&i?n=this.getPathwayForGroupId(o,l,n):c&&(n=c)}n in this.penalizedPathways||(this.penalizedPathways[n]=performance.now()),!r&&i&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),s.resolved=this.pathwayId!==n),t.details===b.BUFFER_APPEND_ERROR&&!t.fatal?s.resolved=!0:s.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${n} levels: ${i&&i.length} priorities: ${ae(r)} penalized: ${ae(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),t=this.getLevelsForPathway(s),this.pathwayId=s}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const s=this.penalizedPathways,i=performance.now();Object.keys(s).forEach(r=>{i-s[r]>md&&delete s[r]});for(let r=0;r0){this.log(`Setting Pathway to "${n}"`),this.pathwayId=n,zn(t),this.hls.trigger(m.LEVELS_UPDATED,{levels:t});const l=this.hls.levels[o];c&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${l.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,s){const i=this.getLevelsForPathway(s).concat(this.levels||[]);for(let r=0;r{const{ID:n,"BASE-ID":o,"URI-REPLACEMENT":c}=r;if(t.some(h=>h.pathwayId===n))return;const l=this.getLevelsForPathway(o).map(h=>{const d=new oe(h.attrs);d["PATHWAY-ID"]=n;const u=d.AUDIO&&`${d.AUDIO}_clone_${n}`,f=d.SUBTITLES&&`${d.SUBTITLES}_clone_${n}`;u&&(s[d.AUDIO]=u,d.AUDIO=u),f&&(i[d.SUBTITLES]=f,d.SUBTITLES=f);const g=Pa(h.uri,d["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),E=new Ft({attrs:d,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:g,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let p=1;p{this.log(`Loaded steering manifest: "${i}"`);const g=h.data;if(g?.VERSION!==1){this.log(`Steering VERSION ${g.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=g.TTL;const{"RELOAD-URI":E,"PATHWAY-CLONES":p,"PATHWAY-PRIORITY":y}=g;if(E)try{this.uri=new self.URL(E,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${E}`);return}this.scheduleRefresh(this.uri||u.url),p&&this.clonePathways(p);const T={steeringManifest:g,url:i.toString()};this.hls.trigger(m.STEERING_MANIFEST_LOADED,T),y&&this.updatePathwayPriority(y)},onError:(h,d,u,f)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${d.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${d.url} no longer available`);return}let g=this.timeToLoad*1e3;if(h.code===429){const E=this.loader;if(typeof E?.getResponseHeader=="function"){const p=E.getResponseHeader("Retry-After");p&&(g=parseFloat(p)*1e3)}this.log(`Steering manifest ${d.url} rate limited`);return}this.scheduleRefresh(this.uri||d.url,g)},onTimeout:(h,d,u)=>{this.log(`Timeout loading steering manifest (${d.url})`),this.scheduleRefresh(this.uri||d.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(r,c,l)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;const i=(s=this.hls)==null?void 0:s.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Zr(a,e,t,s){a&&Object.keys(e).forEach(i=>{const r=a.filter(n=>n.groupId===i).map(n=>{const o=re({},n);return o.details=void 0,o.attrs=new oe(o.attrs),o.url=o.attrs.URI=Pa(n.url,n.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[i],o.attrs["PATHWAY-ID"]=s,o});a.push(...r)})}function Pa(a,e,t,s){const{HOST:i,PARAMS:r,[t]:n}=s;let o;e&&(o=n?.[e],o&&(a=o));const c=new self.URL(a);return i&&!o&&(c.host=i),r&&Object.keys(r).sort().forEach(l=>{l&&c.searchParams.set(l,r[l])}),c.href}class xt extends ke{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=xt.CDMCleanupPromise?[xt.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:s,initData:i}=t,r=`"${t.type}" event: init data type: "${s}"`;if(this.debug(r),i!==null){if(!this.keyFormatPromise){let n=Object.keys(this.keySystemAccessPromises);n.length||(n=Dt(this.config));const o=n.map(ks).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(n=>{const o=ns(n);if(s!=="sinf"||o!==le.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${s}" for selected key-system ${o}`);return}let c;try{const f=de(new Uint8Array(i)),g=bi(JSON.parse(f).sinf),E=Ln(g);if(!E)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(E.subarray(8,24))}catch(f){this.warn(`${r} Failed to parse sinf: ${f}`);return}const l=pe(c),{keyIdToKeySessionPromise:h,mediaKeySessions:d}=this;let u=h[l];for(let f=0;fthis.generateRequestWithPreferredKeySession(g,s,i,"encrypted-event-key-match")),u.catch(y=>this.handleError(y));break}}u||this.handleError(new Error(`Key ID ${l} not encountered in playlist. Key-system sessions ${d.length}.`))}).catch(n=>this.handleError(n))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(m.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(m.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(m.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(m.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(m.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(m.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:s}=this.config,i=t?.[e];if(i)return i.licenseUrl;if(e===le.WIDEVINE&&s)return s}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,s=t?.[e];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,s=(n,o,c)=>!!n&&c.indexOf(n)===o,i=t.map(n=>n.audioCodec).filter(s),r=t.map(n=>n.videoCodec).filter(s);return i.length+r.length===0&&r.push("avc1.42e01e"),new Promise((n,o)=>{const c=l=>{const h=l.shift();this.getMediaKeysPromise(h,i,r).then(d=>n({keySystem:h,mediaKeys:d})).catch(d=>{l.length?c(l):d instanceof Ae?o(d):o(new Ae({type:V.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_NO_ACCESS,error:d,fatal:!0},d.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${s}`;return Kn===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return s(e,t)}getMediaKeysPromise(e,t,s){var i;const r=zl(e,t,s,this.config.drmSystemOptions||{});let n=this.keySystemAccessPromises[e],o=(i=n)==null?void 0:i.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${ae(r)}`),o=this.requestMediaKeySystemAccess(e,r);const c=n=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(l=>{this.log(`Failed to obtain access to key-system "${e}": ${l}`)}),o.then(l=>{this.log(`Access for key-system "${l.keySystem}" obtained`);const h=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const d=c.mediaKeys=l.createMediaKeys().then(u=>(this.log(`Media-keys created for "${e}"`),c.hasMediaKeys=!0,h.then(f=>f?this.setMediaKeysServerCertificate(u,e,f):u)));return d.catch(u=>{this.error(`Failed to create media-keys for "${e}"}: ${u}`)}),d})}return o.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:s}){this.log(`Creating key-system session "${t}" keyId: ${pe(e.keyId||[])} keyUri: ${e.uri}`);const i=s.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:s,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const s=this.createMediaKeySessionContext(e),i=Xt(t),r="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(s,r,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyId ${pe(e.decryptdata.keyId||[])} + } (data length: ${t.byteLength})`),s.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>ks(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:s})=>this.attemptSetMediaKeys(t,s))}selectKeySystem(e){return new Promise((t,s)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:i})=>{const r=ks(i);r?t(r):s(new Error(`Unable to find format for key-system "${i}"`))}).catch(s)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=Dt(this.config),s=e.map(ns).filter(i=>!!i&&t.indexOf(i)!==-1);return this.selectKeySystem(s)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let s=0;s(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(c,l).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:c,mediaKeys:l,decryptdata:t}))))).then(c=>{const l="cenc",h=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(c,l,h,"playlist-key")});return o.catch(c=>this.handleError(c,e.frag)),this.keyIdToKeySessionPromise[s]=o,o}return n.catch(o=>{if(o instanceof Ae){const c=se({},o.data);this.getKeyStatus(t)==="internal-error"&&(c.decryptdata=t);const l=new Ae(c,o.message);this.handleError(l,e.frag)}}),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof Ae){t&&(e.data.frag=t);const s=e.data.decryptdata;this.error(`${e.message}${s?` (${pe(s.keyId||[])})`:""}`),this.hls.trigger(m.ERROR,e.data)}else this.error(e.message),this.hls.trigger(m.ERROR,{type:V.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=Xt(e),s=this.keyIdToKeySessionPromise[t];if(!s){const i=ns(e.keyFormat),r=i?[i]:Dt(this.config);return this.attemptKeySystemAccess(r)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=Dt(this.config)),e.length===0)throw new Ae({type:V.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${ae({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(s).then(()=>this.media?this.media.setMediaKeys(t):new Promise((r,n)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return n(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(r).catch(n)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(r=>s.indexOf(r)===-1)})}generateRequestWithPreferredKeySession(e,t,s,i){var r;const n=(r=this.config.drmSystems)==null||(r=r[e.keySystem])==null?void 0:r.generateRequest;if(n)try{const g=n.call(this.hls,t,s,e);if(!g)throw new Error("Invalid response from configured generateRequest filter");t=g.initDataType,s=g.initData?g.initData:null,e.decryptdata.pssh=s?new Uint8Array(s):null}catch(g){if(this.warn(g.message),this.hls&&this.hls.config.debug)throw g}if(s===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const o=Xt(e.decryptdata),c=e.decryptdata.uri;this.log(`Generating key-session request for "${i}" keyId: ${o} URI: ${c} (init data type: ${t} length: ${s.byteLength})`);const l=new Di,h=e._onmessage=g=>{const E=e.mediaKeysSession;if(!E){l.emit("error",new Error("invalid state"));return}const{messageType:p,message:y}=g;this.log(`"${p}" message event for session "${E.sessionId}" message size: ${y.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,y).catch(T=>{l.eventNames().length?l.emit("error",T):this.handleError(T)}):p==="license-release"?e.keySystem===le.FAIRPLAY&&this.updateKeySession(e,ni("acknowledged")).then(()=>this.removeSession(e)).catch(T=>this.handleError(T)):this.warn(`unhandled media key message type "${p}"`)},d=(g,E)=>{E.keyStatus=g;let p;g.startsWith("usable")?l.emit("resolved"):g==="internal-error"||g==="output-restricted"||g==="output-downscaled"?p=Jr(g,E.decryptdata):g==="expired"?p=new Error(`key expired (keyId: ${o})`):g==="released"?p=new Error("key released"):g==="status-pending"||this.warn(`unhandled key status change "${g}" (keyId: ${o})`),p&&(l.eventNames().length?l.emit("error",p):this.handleError(p))},u=e._onkeystatuseschange=g=>{if(!e.mediaKeysSession){l.emit("error",new Error("invalid state"));return}const p=this.getKeyStatuses(e);if(!Object.keys(p).some(S=>p[S]!=="status-pending"))return;if(p[o]==="expired"){this.log(`Expired key ${ae(p)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let T=p[o];if(T)d(T,e);else{var v;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(v=e.keyStatusTimeouts)[o]||(v[o]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const x=this.getKeyStatus(e.decryptdata);if(x&&x!=="status-pending")return this.log(`No status for keyId ${o} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${x} from other session.`),d(x,e);this.log(`key status for ${o} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),T="internal-error",d(T,e)},1e3)),this.log(`No status for keyId ${o} (${ae(p)}).`)}};ve(e.mediaKeysSession,"message",h),ve(e.mediaKeysSession,"keystatuseschange",u);const f=new Promise((g,E)=>{l.on("error",E),l.on("resolved",g)});return e.mediaKeysSession.generateRequest(t,s).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o} URI: ${c}`)}).catch(g=>{throw new Ae({type:V.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_NO_SESSION,error:g,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${g}`)}).then(()=>f).catch(g=>(l.removeAllListeners(),this.removeSession(e).then(()=>{throw g}))).then(()=>(l.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((s,i)=>{if(typeof i=="string"&&typeof s=="object"){const o=i;i=s,s=o}const r="buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i);if(e.keySystem===le.PLAYREADY&&r.length===16){const o=pe(r);t[o]=s,$n(r)}const n=pe(r);s==="internal-error"&&(this.bannedKeyIds[n]=s),this.log(`key status change "${s}" for keyStatuses keyId: ${n} key-session "${e.mediaKeysSession.sessionId}"`),t[n]=s}),t}fetchServerCertificate(e){const t=this.config,s=t.loader,i=new s(t),r=this.getServerCertificateUrl(e);return r?(this.log(`Fetching server certificate for "${e}"`),new Promise((n,o)=>{const c={responseType:"arraybuffer",url:r},l=t.certLoadPolicy.default,h={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(u,f,g,E)=>{n(u.data)},onError:(u,f,g,E)=>{o(new Ae({type:V.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:se({url:c.url,data:void 0},u)},`"${e}" certificate request failed (${r}). Status: ${u.code} (${u.text})`))},onTimeout:(u,f,g)=>{o(new Ae({type:V.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${r})`))},onAbort:(u,f,g)=>{o(new Error("aborted"))}};i.load(c,h,d)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,s){return new Promise((i,r)=>{e.setServerCertificate(s).then(n=>{this.log(`setServerCertificate ${n?"success":"not supported by CDM"} (${s.byteLength}) on "${t}"`),i(e)}).catch(n=>{r(new Ae({type:V.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:n,fatal:!0},n.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(s=>this.updateKeySession(e,new Uint8Array(s)).catch(i=>{throw new Ae({type:V.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:i,fatal:!1},i.message)}))}unpackPlayReadyKeyMessage(e,t){const s=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!s.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(s,"application/xml"),r=i.querySelectorAll("HttpHeader");if(r.length>0){let h;for(let d=0,u=r.length;d in key message");return ni(atob(l))}setupLicenseXHR(e,t,s,i){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,s,i)}).catch(n=>{if(!s.decryptdata)throw n;return e.open("POST",t,!0),r.call(this.hls,e,t,s,i)}).then(n=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:n||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const s=this.config.keyLoadPolicy.default;return new Promise((i,r)=>{const n=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${n}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let c=o.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const l=this.config.licenseResponseCallback;if(l)try{c=l.call(this.hls,o,n,e)}catch(h){this.error(h)}i(c)}else{const c=s.errorRetry,l=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||o.status>=400&&o.status<500)r(new Ae({type:V.KEY_SYSTEM_ERROR,details:b.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:o,response:{url:n,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${n}). Status: ${o.status} (${o.statusText})`));else{const h=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} attempts left`),this.requestLicense(e,t).then(i,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,n,e,t).then(({xhr:c,licenseChallenge:l})=>{e.keySystem==le.PLAYREADY&&(l=this.unpackPlayReadyKeyMessage(c,l)),c.send(l)}).catch(r)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,ve(s,"encrypted",this.onMediaEncrypted),ve(s,"waitingforkey",this.onWaitingForKey);const i=this.mediaResolved;i?i():this.mediaKeys=s.mediaKeys}onMediaDetached(){const e=this.media;e&&(xe(e,"encrypted",this.onMediaEncrypted),xe(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const s=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,tt.clearKeyUriToKeyIdMap();const r=i.length;xt.CDMCleanupPromise=Promise.all(i.map(n=>this.removeSession(n)).concat((s==null||(e=s.setMediaKeys(null))==null?void 0:e.catch(n=>{this.log(`Could not clear media keys: ${n}`),this.hls&&this.hls.trigger(m.ERROR,{type:V.OTHER_ERROR,details:b.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${n}`)})}))||Promise.resolve())).catch(n=>{this.log(`Could not close sessions and clear media keys: ${n}`),this.hls&&this.hls.trigger(m.ERROR,{type:V.OTHER_ERROR,details:b.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${n}`)})}).then(()=>{r&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=t.reduce((i,r)=>(i.indexOf(r.keyFormat)===-1&&i.push(r.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:s,decryptdata:i}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${pe(i?.keyId||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);const{keyStatusTimeouts:n}=e;n&&Object.keys(n).forEach(l=>self.clearTimeout(n[l]));const{drmSystemOptions:o}=this.config;return(Zl(o)?new Promise((l,h)=>{self.setTimeout(()=>h(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(l).catch(h)}):Promise.resolve()).catch(l=>{this.log(`Could not remove session: ${l}`),this.hls&&this.hls.trigger(m.ERROR,{type:V.OTHER_ERROR,details:b.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${l}`)})}).then(()=>t.close()).catch(l=>{this.log(`Could not close session: ${l}`),this.hls&&this.hls.trigger(m.ERROR,{type:V.OTHER_ERROR,details:b.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${l}`)})})}return Promise.resolve()}}xt.CDMCleanupPromise=void 0;function Xt(a){if(!a)throw new Error("Could not read keyId of undefined decryptdata");if(a.keyId===null)throw new Error("keyId is null");return pe(a.keyId)}function Ed(a,e){if(a.keyId&&e.mediaKeysSession.keyStatuses.has(a.keyId))return e.mediaKeysSession.keyStatuses.get(a.keyId);if(a.matches(e.decryptdata))return e.keyStatus}class Ae extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function Jr(a,e){const t=a==="output-restricted",s=t?b.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:b.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Ae({type:V.KEY_SYSTEM_ERROR,details:s,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${a}"`)}class yd{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(m.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(m.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const s=this.hls.config;if(s.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,s){const i=performance.now();if(t){if(this.lastTime){const r=i-this.lastTime,n=s-this.lastDroppedFrames,o=t-this.lastDecodedFrames,c=1e3*n/r,l=this.hls;if(l.trigger(m.FPS_DROP,{currentDropped:n,currentDecoded:o,totalDroppedFrames:s}),c>0&&n>l.config.fpsDroppedMonitoringThreshold*o){let h=l.currentLevel;l.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=h)&&(h=h-1,l.trigger(m.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:l.currentLevel}),l.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=s,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function ka(a,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=a,e.dispatchEvent(t)}function wa(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues&&!a.cues.getCueById(e.id))try{if(a.addCue(e),!a.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(s){ie.debug(`[texttrack-utils]: ${s}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,a.addCue(i)}catch(i){ie.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(a.mode=t)}function Tt(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues)for(let s=a.cues.length;s--;)e&&a.cues[s].removeEventListener("enter",e),a.removeCue(a.cues[s]);t==="disabled"&&(a.mode=t)}function gi(a,e,t,s){const i=a.mode;if(i==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const r=vd(a.cues,e,t);for(let n=0;na[t].endTime)return-1;let s=0,i=t,r;for(;s<=i;)if(r=Math.floor((i+s)/2),ea[r].startTime&&s-1)for(let r=i,n=a.length;r=e&&o.endTime<=t)s.push(o);else if(o.startTime>t)return s}return s}function cs(a){const e=[];for(let t=0;tthis.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const s=cs(this.media.textTracks);for(let r=0;r-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.LEVEL_LOADING,this.onLevelLoading,this),e.on(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(m.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(m.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.LEVEL_LOADING,this.onLevelLoading,this),e.off(m.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(m.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(m.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const s=this.media;if(!s)return;const i=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||s.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,i)return;cs(s.textTracks).forEach(n=>{Tt(n)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:s,groupId:i,details:r}=t,n=this.tracksInGroup[s];if(!n||n.groupId!==i){this.warn(`Subtitle track with id:${s} and group:${i} not found in active group ${n?.groupId}`);return}const o=n.details;n.details=t.details,this.log(`Subtitle track ${s} "${n.name}" lang:${n.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.subtitleGroups||null,i=this.groupIds;let r=this.currentTrack;if(!s||i?.length!==s?.length||s!=null&&s.some(n=>i?.indexOf(n)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const n=this.tracks.filter(h=>!s||s.indexOf(h.groupId)!==-1);if(n.length)this.selectDefaultTrack&&!n.some(h=>h.default)&&(this.selectDefaultTrack=!1),n.forEach((h,d)=>{h.id=d});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=n;const o=this.hls.config.subtitlePreference;if(!r&&o){this.selectDefaultTrack=!1;const h=Ke(o,n);if(h>-1)r=n[h];else{const d=Ke(o,this.tracks);r=this.tracks[d]}}let c=this.findTrackId(r);c===-1&&r&&(c=this.findTrackId(null));const l={subtitleTracks:n};this.log(`Updating subtitle tracks, ${n.length} track(s) found in "${s?.join(",")}" group-id`),this.hls.trigger(m.SUBTITLE_TRACKS_UPDATED,l),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,s=this.selectDefaultTrack;for(let i=0;i-1){const r=this.tracksInGroup[i];return this.setSubtitleTrack(i),r}else{if(s)return null;{const r=Ke(e,t);if(r>-1)return t[r]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=e.id,i=e.groupId,r=this.getUrlWithDirectives(e.url,t),n=e.details,o=n?.age;this.log(`Loading subtitle ${s} "${e.name}" lang:${e.lang} group:${i}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&n.live?" age "+o.toFixed(1)+(n.type&&" "+n.type||""):""} ${r}`),this.hls.trigger(m.SUBTITLE_TRACK_LOADING,{url:r,id:s,groupId:i,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=cs(e.textTracks),s=this.currentTrack;let i;if(s&&(i=t.filter(r=>hi(s,r))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${s.name}" and language "${s.lang}"`)),[].slice.call(t).forEach(r=>{r.mode!=="disabled"&&r!==i&&(r.mode="disabled")}),i){const r=this.subtitleDisplay?"showing":"hidden";i.mode!==r&&(i.mode=r)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!M(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(m.SUBTITLE_TRACK_SWITCH,{id:e});return}const r=!!i.details&&!i.details.live;if(e===this.trackId&&i===s&&r)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:n,groupId:o="",name:c,type:l,url:h}=i;this.hls.trigger(m.SUBTITLE_TRACK_SWITCH,{id:n,groupId:o,name:c,type:l,url:h});const d=this.switchParams(i.url,s?.details,i.details);this.loadPlaylist(d)}}function xd(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const r=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?r:r&3|8).toString(16)})}}}function kt(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const At=.025;let Ss=(function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a})({});function Ad(a,e,t){return`${a.identifier}-${t+1}-${kt(e)}`}class Id{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const s=this.playoutLimit;return e<=0||isNaN(s)?!1:s===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>s}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return Gs(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,s=Gs(t,e);return t-s<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=M(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return Gs(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)0||this.assetListResponse!==null}toString(){return Ld(this)}}function Gs(a,e){return a-e.start":a.cue.post?"":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function yt(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Rd{constructor(e,t,s,i){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(m.PLAYOUT_LIMIT_REACHED,{})};const r=this.hls=new e(t);this.interstitial=s,this.assetItem=i;const n=()=>{this.hasDetails=!0};r.once(m.LEVEL_LOADED,n),r.once(m.AUDIO_TRACK_LOADED,n),r.once(m.SUBTITLE_TRACK_LOADED,n),r.on(m.MEDIA_ATTACHING,(o,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&r.on(m.BUFFER_APPENDED,()=>{const h=this.bufferedEnd;this.reachedPlayout(h)&&(this._bufferedEosTime=h,r.trigger(m.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=Oa(t,e.config.primarySessionId||"").href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const s=Math.min(this._bufferedEosTime||1/0,this.duration),i=this.timelineOffset,r=j.bufferInfo(e,i,0);return this.getAssetTime(r.end)>=s-.02}reachedPlayout(e){const s=this.interstitial.playoutLimit;return this.startOffset+e>=s}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=j.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const s=t-this.startOffset;if(s>0&&s1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,s=this.duration;return Math.min(Math.max(0,e-t),s)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=s=>delete s.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,s){var i;(i=this.hls)==null||i.on(e,t)}once(e,t,s){var i;(i=this.hls)==null||i.once(e,t)}off(e,t,s){var i;(i=this.hls)==null||i.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${yt(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const en=.033;class bd extends ke{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((s,i)=>e<=i.startOffset&&t>i.startOffset?(delete i.error,s+1):s,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let s=-1;e.nextEvent?s=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(s=this.findEventIndex(e.previousEvent.identifier)+1);const i=this.items;if(i)for(i[s]||(t===void 0&&(t=e.start),s=this.findItemIndexAtTime(t));s>=0&&(r=i[s])!=null&&r.event;){var r;s--}return s}findItemIndexAtTime(e,t){const s=this.items;if(s)for(let i=0;ir.start&&e1)for(let r=0;ro&&(t!o.includes(l.identifier)):[];n.length&&n.sort((l,h)=>{const d=l.cue.pre,u=l.cue.post,f=h.cue.pre,g=h.cue.post;if(d&&!f)return-1;if(f&&!d||u&&!g)return 1;if(g&&!u)return-1;if(!d&&!f&&!u&&!g){const E=l.startTime,p=h.startTime;if(E!==p)return E-p}return l.dateRange.tagOrder-h.dateRange.tagOrder}),this.events=n,c.forEach(l=>{this.removeEvent(l)}),this.updateSchedule(e,c)}updateSchedule(e,t=[],s=!1){const i=this.events||[];if(i.length||t.length||this.length<2){const r=this.items,n=this.parseSchedule(i,e);(s||t.length||r?.length!==n.length||n.some((c,l)=>Math.abs(c.playout.start-r[l].playout.start)>.005||Math.abs(c.playout.end-r[l].playout.end)>.005))&&(this.items=n,this.onScheduleUpdate(t,r))}}parseDateRanges(e,t,s){const i=[],r=Object.keys(e);for(let n=0;n!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,t);let c=0,l=0;if(e.forEach((h,d)=>{const u=h.cue.pre,f=h.cue.post,g=e[d-1]||null,E=h.appendInPlace,p=f?r:h.startOffset,y=h.duration,T=h.timelineOccupancy===Ss.Range?y:0,v=h.resumptionOffset,S=g?.startTime===p,x=p+h.cumulativeDuration;let D=E?x+y:p+v;if(u||!f&&p<=0){const R=l;l+=T,h.timelineStart=x;const _=n;n+=y,s.push({event:h,start:x,end:D,playout:{start:_,end:n},integrated:{start:R,end:l}})}else if(p<=r){if(!S){const I=p-c;if(I>en){const P=c,F=l;l+=I;const U=n;n+=I;const H={previousEvent:e[d-1]||null,nextEvent:h,start:P,end:P+I,playout:{start:U,end:n},integrated:{start:F,end:l}};s.push(H)}else I>0&&g&&(g.cumulativeDuration+=I,s[s.length-1].end=p)}f&&(D=x),h.timelineStart=x;const R=l;l+=T;const _=n;n+=y,s.push({event:h,start:x,end:D,playout:{start:_,end:n},integrated:{start:R,end:l}})}else return;const A=h.resumeTime;f||A>r?c=r:c=A}),c{const l=o.cue.pre,h=o.cue.post,d=l?0:h?i:o.startTime;this.updateAssetDurations(o),n===d?o.cumulativeDuration=r:(r=0,n=d),!h&&o.snapOptions.in&&(o.resumeAnchor=dt(null,s.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&c+1At?(this.log(`"${e.identifier}" resumption ${s} not aligned with estimated timeline end ${i}`),!1):!Object.keys(t).some(n=>{const o=t[n].details,c=o.edge;if(s>=c)return this.log(`"${e.identifier}" resumption ${s} past ${n} playlist end ${c}`),!1;const l=dt(null,o.fragments,s);if(!l)return this.log(`"${e.identifier}" resumption ${s} does not align with any fragments in ${n} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const h=n==="audio"?.175:0;return Math.abs(l.start-s){const p=u.data,y=p?.ASSETS;if(!Array.isArray(y)){const T=this.assignAssetListError(e,b.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),g.url,f,E);this.hls.trigger(m.ERROR,T);return}e.assetListResponse=p,this.hls.trigger(m.ASSET_LIST_LOADED,{event:e,assetListResponse:p,networkDetails:E})},onError:(u,f,g,E)=>{const p=this.assignAssetListError(e,b.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${u.code} ${u.text} (${f.url})`),f.url,E,g);this.hls.trigger(m.ERROR,p)},onTimeout:(u,f,g)=>{const E=this.assignAssetListError(e,b.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${f.url})`),f.url,u,g);this.hls.trigger(m.ERROR,E)}};return o.load(c,h,d),this.hls.trigger(m.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,s,i,r,n){return e.error=s,{type:V.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:i,error:s,networkDetails:n,stats:r}}}function tn(a){var e;a==null||(e=a.play())==null||e.catch(()=>{})}function zt(a,e){return`[${a}] Advancing timeline position to ${e}`}class Dd extends ke{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled||!this.schedule)return;const i=s-this.timelinePos;if(Math.abs(i)<1/7056e5)return;const n=i<=-.01;this.timelinePos=s,this.bufferedPos=s;const o=this.playingItem;if(!o){this.checkBuffer();return}if(n&&this.schedule.resetErrorsInRange(s,s-i)&&this.updateSchedule(!0),this.checkBuffer(),n&&s=o.end){var c;const f=this.findItemIndex(o);let g=this.schedule.findItemIndexAtTime(s);if(g===-1&&(g=f+(n?-1:1),this.log(`seeked ${n?"back ":""}to position not covered by schedule ${s} (resolving from ${f} to ${g})`)),!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!n&&g>f){const E=this.schedule.findJumpRestrictedIndex(f+1,g);if(E>f){this.setSchedulePosition(E);return}}this.setSchedulePosition(g);return}const l=this.playingAsset;if(!l){if(this.playingLastItem&&this.isInterstitial(o)){const f=o.event.assetList[0];f&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(s,f))}return}const h=l.timelineStart,d=l.duration||0;if(n&&s=h+d){var u;(u=o.event)!=null&&u.appendInPlace&&(this.clearAssetPlayers(o.event,o),this.flushFrontBuffer(s)),this.setScheduleToAssetAtTime(s,l)}},this.onTimeupdate=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled)return;if(s>this.timelinePos)this.timelinePos=s,s>this.bufferedPos&&this.checkBuffer();else return;const i=this.playingItem;if(!i||this.playingLastItem)return;if(s>=i.end){this.timelinePos=i.end;const o=this.findItemIndex(i);this.setSchedulePosition(o+1)}const r=this.playingAsset;if(!r)return;const n=r.timelineStart+(r.duration||0);s>=n&&this.setScheduleToAssetAtTime(s,r)},this.onScheduleUpdate=(s,i)=>{const r=this.schedule;if(!r)return;const n=this.playingItem,o=r.events||[],c=r.items||[],l=r.durations,h=s.map(E=>E.identifier),d=!!(o.length||h.length);(d||i)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o} +Schedule: ${c.map(E=>Fe(E))} pos: ${this.timelinePos}`),h.length&&this.log(`Removed events ${h}`);let u=null,f=null;n&&(u=this.updateItem(n,this.timelinePos),this.itemsMatch(n,u)?this.playingItem=u:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const g=this.bufferingItem;if(g&&(f=this.updateItem(g,this.bufferedPos),this.itemsMatch(g,f)?this.bufferingItem=f:g.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(g.event,null))),s.forEach(E=>{E.assetList.forEach(p=>{this.clearAssetPlayer(p.identifier,null)})}),this.playerQueue.forEach(E=>{if(E.interstitial.appendInPlace){const p=E.assetItem.timelineStart,y=E.timelineOffset-p;if(y)try{E.timelineOffset=p}catch(T){Math.abs(y)>At&&this.warn(`${T} ("${E.assetId}" ${E.timelineOffset}->${p})`)}}}),d||i){if(this.hls.trigger(m.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:c.slice(0),durations:l,removedIds:h}),this.isInterstitial(n)&&h.includes(n.event.identifier)){this.warn(`Interstitial "${n.event.identifier}" removed while playing`),this.primaryFallback(n.event);return}n&&this.trimInPlace(u,n),g&&f!==u&&this.trimInPlace(f,g),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new _d(e),this.schedule=new bd(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(m.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(m.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(m.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(m.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(m.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(m.BUFFER_APPENDED,this.onBufferAppended,this),e.on(m.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(m.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(m.MEDIA_ENDED,this.onMediaEnded,this),e.on(m.ERROR,this.onError,this),e.on(m.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(m.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(m.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(m.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(m.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(m.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(m.BUFFER_CODECS,this.onBufferCodecs,this),e.off(m.BUFFER_APPENDED,this.onBufferAppended,this),e.off(m.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(m.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(m.MEDIA_ENDED,this.onMediaEnded,this),e.off(m.ERROR,this.onError,this),e.off(m.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){xe(e,"play",this.onPlay),xe(e,"pause",this.onPause),xe(e,"seeking",this.onSeeking),xe(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const s=this.media=t.media;ve(s,"seeking",this.onSeeking),ve(s,"timeupdate",this.onTimeupdate),ve(s,"play",this.onPlay),ve(s,"pause",this.onPause)}onMediaAttached(e,t){const s=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,s===null)this.checkStart();else if(!i){this.clearScheduleState();const r=this.findItemIndex(s);this.setSchedulePosition(r)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const s=!!t.transferMedia,i=this.media;if(this.media=null,!s&&(i&&this.removeMediaListeners(i),this.detachedData)){const r=this.getBufferingPlayer();r&&(this.log(`Removing schedule state for detachedData and ${r}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,r.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,s=d=>d&&e.getAssetPlayer(d.identifier),i=(d,u,f,g,E)=>{if(d){let p=d[u].start;const y=d.event;if(y){if(u==="playout"||y.timelineOccupancy!==Ss.Point){const T=s(f);T?.interstitial===y&&(p+=T.assetItem.startOffset+T[E])}}else{const T=g==="bufferedPos"?n():e[g];p+=T-d.start}return p}return 0},r=(d,u)=>{var f;if(d!==0&&u!=="primary"&&(f=e.schedule)!=null&&f.length){var g;const E=e.schedule.findItemIndexAtTime(d),p=(g=e.schedule.items)==null?void 0:g[E];if(p){const y=p[u].start-p.start;return d+y}}return d},n=()=>{const d=e.bufferedPos;return d===Number.MAX_VALUE?o("primary"):Math.max(d,0)},o=d=>{var u,f;return(u=e.primaryDetails)!=null&&u.live?e.primaryDetails.edge:((f=e.schedule)==null?void 0:f.durations[d])||0},c=(d,u)=>{var f,g;const E=e.effectivePlayingItem;if(E!=null&&(f=E.event)!=null&&f.restrictions.skip||!e.schedule)return;e.log(`seek to ${d} "${u}"`);const p=e.effectivePlayingItem,y=e.schedule.findItemIndexAtTime(d,u),T=(g=e.schedule.items)==null?void 0:g[y],v=e.getBufferingPlayer(),S=v?.interstitial,x=S?.appendInPlace,D=p&&e.itemsMatch(p,T);if(p&&(x||D)){const A=s(e.playingAsset),R=A?.media||e.primaryMedia;if(R){const _=u==="primary"?R.currentTime:i(p,u,e.playingAsset,"timelinePos","currentTime"),I=d-_,P=(x?_:R.currentTime)+I;if(P>=0&&(!A||x||P<=A.duration)){R.currentTime=P;return}}}if(T){let A=d;if(u!=="primary"){const _=T[u].start,I=d-_;A=T.start+I}const R=!e.isInterstitial(T);if((!e.isInterstitial(p)||p.event.appendInPlace)&&(R||T.event.appendInPlace)){const _=e.media||(x?v?.media:null);_&&(_.currentTime=A)}else if(p){const _=e.findItemIndex(p);if(y>_){const P=e.schedule.findJumpRestrictedIndex(_+1,y);if(P>_){e.setSchedulePosition(P);return}}let I=0;if(R)e.timelinePos=A,e.checkBuffer();else{const P=T.event.assetList,F=d-(T[u]||T).start;for(let U=P.length;U--;){const H=P[U];if(H.duration&&F>=H.startOffset&&F{const d=e.effectivePlayingItem;if(e.isInterstitial(d))return d;const u=t();return e.isInterstitial(u)?u:null},h={get bufferedEnd(){const d=t(),u=e.bufferingItem;if(u&&u===d){var f;return i(u,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-u.playout.start||((f=e.bufferingAsset)==null?void 0:f.startOffset)||0}return 0},get currentTime(){const d=l(),u=e.effectivePlayingItem;return u&&u===d?i(u,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-u.playout.start:0},set currentTime(d){const u=l(),f=e.effectivePlayingItem;f&&f===u&&c(d+f.playout.start,"playout")},get duration(){const d=l();return d?d.playout.end-d.playout.start:0},get assetPlayers(){var d;const u=(d=l())==null?void 0:d.event.assetList;return u?u.map(f=>e.getAssetPlayer(f.identifier)):[]},get playingIndex(){var d;const u=(d=l())==null?void 0:d.event;return u&&e.effectivePlayingAsset?u.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return l()}};return this.manager={get events(){var d;return((d=e.schedule)==null||(d=d.events)==null?void 0:d.slice(0))||[]},get schedule(){var d;return((d=e.schedule)==null||(d=d.items)==null?void 0:d.slice(0))||[]},get interstitialPlayer(){return l()?h:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const d=t();return e.findItemIndex(d)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const d=e.effectivePlayingItem;return e.findItemIndex(d)},primary:{get bufferedEnd(){return n()},get currentTime(){const d=e.timelinePos;return d>0?d:0},set currentTime(d){c(d,"primary")},get duration(){return o("primary")},get seekableStart(){var d;return((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0}},integrated:{get bufferedEnd(){return i(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(d){c(d,"integrated")},get duration(){return o("integrated")},get seekableStart(){var d;return r(((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0,"integrated")}},skip:()=>{const d=e.effectivePlayingItem,u=d?.event;if(u&&!u.restrictions.skip){const f=e.findItemIndex(d);if(u.appendInPlace){const g=d.playout.start+d.event.duration;c(g+.001,"playout")}else e.advanceAfterAssetEnded(u,f,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,s=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!s?!1:this.findItemIndex(t)===s.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const s=this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&!s.event.appendInPlace)return;let i=this.media;!i&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(i=this.primaryMedia);const r=(t=i)==null?void 0:t.currentTime;if(!(r===void 0||!M(r)))return r}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const s=this.getAssetPlayer(e);s&&this.transferMediaFromPlayer(s,t)}transferMediaFromPlayer(e,t){const s=e.interstitial.appendInPlace,i=e.media;if(s&&i===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&i){this.detachedData={media:i};return}const r=e.transferMedia();this.log(`transfer MediaSource from ${e} ${ae(r)}`),this.detachedData=r}else t&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))}transferMediaTo(e,t){var s,i;if(e.media===t)return;let r=null;const n=this.hls,o=e!==n,c=o&&e.interstitial.appendInPlace,l=(s=this.detachedData)==null?void 0:s.mediaSource;let h;if(n.media)c&&(r=n.transferMedia(),this.detachedData=r),h="Primary";else if(l){const g=this.getBufferingPlayer();g?(r=g.transferMedia(),h=`${g}`):h="detached MediaSource"}else h="detached media";if(!r){if(l)r=this.detachedData,this.log(`using detachedData: MediaSource ${ae(r)}`);else if(!this.detachedData||n.media===t){const g=this.playerQueue;g.length>1&&g.forEach(E=>{if(o&&E.interstitial.appendInPlace!==c){const p=E.interstitial;this.clearInterstitial(E.interstitial,null),p.appendInPlace=!1,p.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${p}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const d=r&&"mediaSource"in r&&((i=r.mediaSource)==null?void 0:i.readyState)!=="closed",u=d&&r?r:t;this.log(`${d?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${h} (media.currentTime: ${t.currentTime})`);const f=this.schedule;if(u===r&&f){const g=o&&e.assetId===f.assetIdAtEnd;u.overrides={duration:f.duration,endOfStream:!o||g,cueRemoval:!o}}e.attachMedia(u)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const s=this.timelinePos,i=this.effectivePlayingItem;if(s===-1){const r=this.hls.startPosition;if(this.log(zt("checkStart",r)),this.timelinePos=r,t.length&&t[0].cue.pre){const n=e.findEventIndex(t[0].identifier);this.setSchedulePosition(n)}else if(r>=0||!this.primaryLive){const n=this.timelinePos=r>0?r:0,o=e.findItemIndexAtTime(n);this.setSchedulePosition(o)}}else if(i&&!this.playingItem){const r=e.findItemIndex(i);this.setSchedulePosition(r)}}advanceAssetBuffering(e,t){const s=e.event,i=s.findAssetIndex(t),r=Ks(s,i);if(!s.isAssetPastPlayoutLimit(r))this.bufferedToEvent(e,r);else if(this.schedule){var n;const o=(n=this.schedule.items)==null?void 0:n[this.findItemIndex(e)+1];o&&this.bufferedToItem(o)}}advanceAfterAssetEnded(e,t,s){const i=Ks(e,s);if(e.isAssetPastPlayoutLimit(i)){if(this.schedule){const r=this.schedule.items;if(r){const n=t+1,o=r.length;if(n>=o){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos=0?i[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${r&&Fe(r)}) pos: ${this.timelinePos}`);const n=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(n)){const h=n.event,d=this.playingAsset,u=d?.identifier,f=u?this.getAssetPlayer(u):null;if(f&&u&&(!this.eventItemsMatch(n,r)||t!==void 0&&u!==h.assetList[t].identifier)){var c;const g=h.findAssetIndex(d);if(this.log(`INTERSTITIAL_ASSET_ENDED ${g+1}/${h.assetList.length} ${yt(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger(m.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:g,event:h,schedule:i.slice(0),scheduleIndex:e,player:f}),n!==this.playingItem){this.itemsMatch(n,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(h,this.findItemIndex(this.playingItem),g);return}this.retreiveMediaSource(u,r),f.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&f.detachMedia()}if(!this.eventItemsMatch(n,r)&&(this.endedItem=n,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${h} ${Fe(n)}`),h.hasPlayed=!0,this.hls.trigger(m.INTERSTITIAL_ENDED,{event:h,schedule:i.slice(0),scheduleIndex:e}),h.cue.once)){var l;this.updateSchedule();const g=(l=this.schedule)==null?void 0:l.items;if(r&&g){const E=this.findItemIndex(r);this.advanceSchedule(E,g,t,n,o)}return}}this.advanceSchedule(e,i,t,n,o)}advanceSchedule(e,t,s,i,r){const n=this.schedule;if(!n)return;const o=t[e]||null,c=this.primaryMedia,l=this.playerQueue;if(l.length&&l.forEach(h=>{const d=h.interstitial,u=n.findEventIndex(d.identifier);(ue+1)&&this.clearInterstitial(d,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const h=o.event;if(s===void 0){s=n.findAssetIndex(h,this.timelinePos);const g=Ks(h,s-1);if(h.isAssetPastPlayoutLimit(g)||h.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(h,e,s);return}s=g}const d=this.waitingItem;this.assetsBuffered(o,c)||this.setBufferingItem(o);let u=this.preloadAssets(h,s);if(this.eventItemsMatch(o,d||i)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${Fe(o)} ${h.appendInPlace?"append in place":""}`),this.hls.trigger(m.INTERSTITIAL_STARTED,{event:h,schedule:t.slice(0),scheduleIndex:e})),!h.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${h}`);return}if(h.assetListLoader&&(h.assetListLoader.destroy(),h.assetListLoader=void 0),!c){this.log(`Waiting for attachMedia to start Interstitial ${h}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const f=h.assetList[s];if(!f){this.advanceAfterAssetEnded(h,e,s||0);return}if(u||(u=this.getAssetPlayer(f.identifier)),u===null||u.destroyed){const g=h.assetList.length;this.warn(`asset ${s+1}/${g} player destroyed ${h}`),u=this.createAssetPlayer(h,f,s),u.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&h.appendInPlace&&this.isAssetBuffered(f))return;this.startAssetPlayer(u,s,t,e,c),this.shouldPlay&&tn(u.media)}else o?(this.resumePrimary(o,e,i),this.shouldPlay&&tn(this.hls.media)):r&&this.isInterstitial(i)&&(this.endedItem=null,this.playingItem=i,i.event.appendInPlace||this.attachPrimary(n.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,s){var i,r;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${Fe(e)}`),!((i=this.detachedData)!=null&&i.mediaSource)){let o=this.timelinePos;(o=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(zt("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!s)return;const n=(r=this.schedule)==null?void 0:r.items;n&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Fe(e)}`),this.hls.trigger(m.INTERSTITIALS_PRIMARY_RESUMED,{schedule:n.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const s=e.start;if(this.primaryLive){const i=this.primaryDetails;if(t===0)return this.hls.startPosition;if(i&&(si.edge))return this.hls.liveSyncPosition||-1}return s}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:j.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,s){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const i=this.primaryMedia;if(!i)return;const r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,i),s&&this.startLoadingPrimaryAt(e,s)),s||(this.log(zt("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,s))}startLoadingPrimaryAt(e,t){var s;const i=this.hls;!i.loadingEnabled||!i.media||Math.abs((((s=i.mainForwardBufferInfo)==null?void 0:s.start)||i.media.currentTime)-e)>.5?i.startLoad(e,t):i.bufferingEnabled||i.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(m.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(m.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const s=this.hls.levels[t.level];if(!s.details)return;const i=se(se({},this.mediaSelection||this.altSelection),{},{main:s});this.mediaSelection=i,this.schedule.parseInterstitialDateRanges(i,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const s=this.hls.audioTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=se(se({},this.altSelection),{},{audio:s});return}const r=se(se({},i),{},{audio:s});this.mediaSelection=r}onSubtitleTrackUpdated(e,t){const s=this.hls.subtitleTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=se(se({},this.altSelection),{},{subtitles:s});return}const r=se(se({},i),{},{subtitles:s});this.mediaSelection=r}onAudioTrackSwitching(e,t){const s=hr(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setAudioOption(t)||i.setAudioOption(s)))}onSubtitleTrackSwitch(e,t){const s=hr(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setSubtitleOption(t)||t.id!==-1&&i.setSubtitleOption(s)))}onBufferCodecs(e,t){const s=t.tracks;s&&(this.requiredTracks=s)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const s=this.playingItem;if(s&&!this.itemsMatch(s,this.bufferingItem)&&!this.isInterstitial(s)){const i=this.timelinePos;this.bufferedPos=i,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos.25){e.event.assetList.forEach((r,n)=>{e.event.isAssetPastPlayoutLimit(n)&&this.clearAssetPlayer(r.identifier,null)});const s=e.end+.25,i=j.bufferInfo(this.primaryMedia,s,0);(i.end>s||(i.nextStart||0)>s)&&(this.log(`trim buffered interstitial ${Fe(e)} (was ${Fe(t)})`),this.attachPrimary(s,null,!0),this.flushFrontBuffer(s))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var s;return!!t&&(e===t||e.event.identifier===((s=t.event)==null?void 0:s.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const s=this.mediaSelection;s&&((t=this.schedule)==null||t.updateSchedule(s,[],e))}checkBuffer(e){var t;const s=(t=this.schedule)==null?void 0:t.items;if(!s)return;const i=j.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,s,e)}updateBufferedPos(e,t,s){const i=this.schedule,r=this.bufferingItem;if(this.bufferedPos>e||!i)return;if(t.length===1&&this.itemsMatch(t[0],r)){this.bufferedPos=e;return}const n=this.playingItem,o=this.findItemIndex(n);let c=i.findItemIndexAtTime(e);if(this.bufferedPos=r.end||(l=u.event)!=null&&l.appendInPlace&&e+.01>=u.start)&&(c=d),this.isInterstitial(r)){const f=r.event;if(d-o>1&&f.appendInPlace===!1||f.assetList.length===0&&f.assetListLoader)return}if(this.bufferedPos=e,c>h&&c>o)this.bufferedToItem(u);else{const f=this.primaryDetails;this.primaryLive&&f&&e>f.edge-f.targetduration&&u.start{const r=this.getAssetPlayer(i.identifier);return!(r!=null&&r.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,s=this.schedule;if(!this.itemsMatch(e,t)&&s){const{items:i,events:r}=s;if(!i||!r)return t;const n=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Fe(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(n){const l=s.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((h,d)=>{const u=this.getAssetPlayer(h.identifier);u&&(d===l&&u.loadSource(),u.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(l=>l.pauseBuffering());this.hls.trigger(m.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:r.slice(0),schedule:i.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const s=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(s!==null){this.bufferingAsset=null;const i=this.detachedData;i?i.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),s=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(s)}bufferedToEvent(e,t){const s=e.event,i=s.assetList.length===0&&!s.assetListLoader,r=s.cue.once;if(i||!r){const n=this.preloadAssets(s,t);if(n!=null&&n.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(n,o)}}}preloadAssets(e,t){const s=e.assetUrl,i=e.assetList.length,r=i===0&&!e.assetListLoader,n=e.cue.once;if(r){const c=e.timelineStart;if(e.appendInPlace){var o;const u=this.playingItem;!this.isInterstitial(u)&&(u==null||(o=u.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let l,h=0;if(!this.playingItem&&this.primaryLive&&(h=this.hls.startPosition,h===-1&&(h=this.hls.liveSyncPosition||0)),h&&!(e.cue.pre||e.cue.post)){const u=h-c;u>0&&(l=Math.round(u*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${s?1:i} ${e}${l?` live-start: ${h} start-offset: ${l}`:""}`),s)return this.createAsset(e,0,0,c,e.duration,s);const d=this.assetListLoader.loadAssetList(e,l);d&&(e.assetListLoader=d)}else if(!n&&i){for(let l=t;l{this.hls.trigger(m.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:i})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let s=0;s1){const x=t.duration;x&&S{if(S.live){var x;const R=new Error(`Interstitials MUST be VOD assets ${e}`),_={fatal:!0,type:V.OTHER_ERROR,details:b.INTERSTITIAL_ASSET_ITEM_ERROR,error:R},I=((x=this.schedule)==null?void 0:x.findEventIndex(e.identifier))||-1;this.handleAssetItemError(_,e,I,s,R.message);return}const D=S.edge-S.fragmentStart,A=t.duration;(E||A===null||D>A)&&(E=!1,this.log(`Interstitial asset "${d}" duration change ${A} > ${D}`),t.duration=D,this.updateSchedule())};g.on(m.LEVEL_UPDATED,(S,{details:x})=>p(x)),g.on(m.LEVEL_PTS_UPDATED,(S,{details:x})=>p(x)),g.on(m.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const y=(S,x)=>{const D=this.getAssetPlayer(d);if(D&&x.tracks){D.off(m.BUFFER_CODECS,y),D.tracks=x.tracks;const A=this.primaryMedia;this.bufferingAsset===D.assetItem&&A&&!D.media&&this.bufferAssetPlayer(D,A)}};g.on(m.BUFFER_CODECS,y);const T=()=>{var S;const x=this.getAssetPlayer(d);if(this.log(`buffered to end of asset ${x}`),!x||!this.schedule)return;const D=this.schedule.findEventIndex(e.identifier),A=(S=this.schedule.items)==null?void 0:S[D];this.isInterstitial(A)&&this.advanceAssetBuffering(A,t)};g.on(m.BUFFERED_TO_END,T);const v=S=>()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;this.shouldPlay=!0;const D=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,D,S)};return g.once(m.MEDIA_ENDED,v(s)),g.once(m.PLAYOUT_LIMIT_REACHED,v(1/0)),g.on(m.ERROR,(S,x)=>{if(!this.schedule)return;const D=this.getAssetPlayer(d);if(x.details===b.BUFFER_STALLED_ERROR){if(D!=null&&D.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(x,e,this.schedule.findEventIndex(e.identifier),s,`Asset player error ${x.error} ${e}`)}),g.on(m.DESTROYING,()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;const x=new Error(`Asset player destroyed unexpectedly ${d}`),D={fatal:!0,type:V.OTHER_ERROR,details:b.INTERSTITIAL_ASSET_ITEM_ERROR,error:x};this.handleAssetItemError(D,e,this.schedule.findEventIndex(e.identifier),s,x.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${yt(t)}`),this.hls.trigger(m.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:s,event:e,player:g}),g}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(s=>{this.clearAssetPlayer(s.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const s=this.playerQueue[t];this.transferMediaFromPlayer(s,null),s.resetDetails()}}clearAssetPlayer(e,t){const s=this.getAssetPlayerQueueIndex(e);if(s!==-1){const i=this.playerQueue[s];this.log(`clear ${i} toSegment: ${t&&Fe(t)}`),this.transferMediaFromPlayer(i,t),this.playerQueue.splice(s,1),i.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,s,i,r){const{interstitial:n,assetItem:o,assetId:c}=e,l=n.assetList.length,h=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!h||h.identifier!==c)&&(h&&(this.clearAssetPlayer(h.identifier,s[i]),delete h.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${l} ${yt(o)}`),this.hls.trigger(m.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:n,schedule:s.slice(0),scheduleIndex:i,player:e})),this.bufferAssetPlayer(e,r)}bufferAssetPlayer(e,t){var s,i;if(!this.schedule)return;const{interstitial:r,assetItem:n}=e,o=this.schedule.findEventIndex(r.identifier),c=(s=this.schedule.items)==null?void 0:s[o];if(!c)return;e.loadSource(),this.setBufferingItem(c),this.bufferingAsset=n;const l=this.getBufferingPlayer();if(l===e)return;const h=r.appendInPlace;if(h&&l?.interstitial.appendInPlace===!1)return;const d=l?.tracks||((i=this.detachedData)==null?void 0:i.tracks)||this.requiredTracks;if(h&&n!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(d&&!pn(d,e.tracks)){const u=new Error(`Asset ${yt(n)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),f={fatal:!0,type:V.OTHER_ERROR,details:b.INTERSTITIAL_ASSET_ITEM_ERROR,error:u},g=r.findAssetIndex(n);this.handleAssetItemError(f,r,o,g,u.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,s=this.primaryMedia;if(!t||!s)return;const i=s.currentTime,r=t.findAssetIndex(e,i),n=e.assetList[r];if(n){const o=this.getAssetPlayer(n.identifier);if(o){const c=o.currentTime||i-n.timelineStart,l=o.duration-c;if(this.warn(`Stalled at ${c} of ${c+l} in ${o} ${e} (media.currentTime: ${i})`),c&&(l/s.playbackRate<.5||o.bufferedInPlaceToEnd(s))&&o.hls){const h=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,h,r)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime!E.error))t.error=g;else for(let E=i;E{const y=parseFloat(E.DURATION);this.createAsset(r,p,h,c+h,y,E.URI),h+=y}),r.duration=h,this.log(`Loaded asset-list with duration: ${h} (was: ${l}) ${r}`);const d=this.waitingItem,u=d?.event.identifier===n;this.updateSchedule();const f=(i=this.bufferingItem)==null?void 0:i.event;if(u){var g;const E=this.schedule.findEventIndex(n),p=(g=this.schedule.items)==null?void 0:g[E];if(p){if(!this.playingItem&&this.timelinePos>p.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==E){r.error=new Error(`Interstitial ${o.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${r}`),this.log(r.error.message),this.updateSchedule(!0),this.primaryFallback(r);return}this.setBufferingItem(p)}this.setSchedulePosition(E)}else if(f?.identifier===n){const E=r.assetList[0];if(E){const p=this.getAssetPlayer(E.identifier);if(f.appendInPlace){const y=this.primaryMedia;p&&y&&this.bufferAssetPlayer(p,y)}else p&&p.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case b.ASSET_LIST_PARSING_ERROR:case b.ASSET_LIST_LOAD_ERROR:case b.ASSET_LIST_LOAD_TIMEOUT:{const s=t.interstitial;s&&(this.updateSchedule(!0),this.primaryFallback(s));break}case b.BUFFER_STALLED_ERROR:{const s=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&s.event.appendInPlace){this.handleInPlaceStall(s.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const sn=500;class Cd extends _i{constructor(e,t,s){super(e,t,s,"subtitle-stream-controller",B.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(m.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(m.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(m.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(m.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(m.LEVEL_LOADED,this.onLevelLoaded,this),e.off(m.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(m.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(m.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(m.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=C.IDLE,this.setInterval(sn),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:s,success:i}=t;if(this.fragContextChanged(s)||(he(s)&&(this.fragPrevious=s),this.state=C.IDLE),!i)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let n;const o=s.start;for(let l=0;l=r[l].start&&o<=r[l].end){n=r[l];break}const c=s.start+s.duration;n?n.end=c:(n={start:o,end:c},r.push(n)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:s,endOffset:i}=t;if(s===0&&i!==Number.POSITIVE_INFINITY){const r=i-1;if(r<=0)return;t.endOffsetSubtitles=Math.max(0,r),this.tracksBuffered.forEach(n=>{for(let o=0;onew Ft(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{const i=new Ft(s);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,B.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var s;if(this.currentTrackId=t.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.state!==C.STOPPED&&this.setInterval(sn)}onSubtitleTrackLoaded(e,t){var s;const{currentTrackId:i,levels:r}=this,{details:n,id:o}=t;if(!r){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const c=r[o];if(o>=r.length||!c)return;this.log(`Subtitle track ${o} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(n.live||(s=c.details)!=null&&s.live){if(n.deltaUpdateFailed)return;const d=this.mainDetails;if(!d){this.startFragRequested=!1;return}const u=d.fragments[0];if(!c.details)n.hasProgramDateTime&&d.hasProgramDateTime?(Ts(n,d),l=n.fragmentStart):u&&(l=u.start,oi(n,l));else{var h;l=this.alignPlaylists(n,c.details,(h=this.levelLastLoaded)==null?void 0:h.details),l===0&&u&&(l=u.start,oi(n,l))}d&&!this.startFragRequested&&this.setStartPosition(d,l)}c.details=n,this.levelLastLoaded=c,o===i&&(this.hls.trigger(m.SUBTITLE_TRACK_UPDATED,{details:n,id:o,groupId:t.groupId}),this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===C.IDLE&&(dt(null,n.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:s}=e,i=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&s&&s.byteLength>0&&i!=null&&i.key&&i.iv&&St(i.method)){const n=performance.now();this.decrypter.decrypt(new Uint8Array(s),i.key.buffer,i.iv.buffer,Ri(i.method)).catch(o=>{throw r.trigger(m.ERROR,{type:V.MEDIA_ERROR,details:b.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const c=performance.now();r.trigger(m.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:n,tdecrypt:c}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=C.IDLE})}}doTick(){if(!this.media){this.state=C.IDLE;return}if(this.state===C.IDLE){const{currentTrackId:e,levels:t}=this,s=t?.[e];if(!s||!t.length||!s.details||this.waitForLive(s))return;const{config:i}=this,r=this.getLoadPosition(),n=j.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,i.maxBufferHole),{end:o,len:c}=n,l=s.details,h=this.hls.maxBufferLength+l.levelTargetDuration;if(c>h)return;const d=l.fragments,u=d.length,f=l.edge;let g=null;const E=this.fragPrevious;if(of-T?0:T;g=dt(E,d,Math.max(d[0].start,o),v),!g&&E&&E.start{if(i=i>>>0,i>r-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${r})`);return e[i][s]};this.buffered={get length(){return e.length},end(s){return t("end",s,e.length)},start(s){return t("start",s,e.length)}}}}const kd={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Fa=a=>String.fromCharCode(kd[a]||a),Me=15,qe=100,wd={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Od={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Fd={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Md={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Nd=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Bd{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const s=typeof t=="function"?t():t;ie.log(`${this.time} [${e}] ${s}`)}}}const lt=function(e){const t=[];for(let s=0;sqe&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=qe)}moveCursor(e){const t=this.pos+e;if(e>1)for(let s=this.pos+1;s=144&&this.backSpace();const t=Fa(e);if(this.pos>=qe){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t"pacData = "+ae(e));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+ae(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let s="",i=-1;for(let r=0;r0&&(e?s="["+t.join(" | ")+"]":s=t.join(` +`)),s}getTextAndFormat(){return this.rows}}class rn{constructor(e,t,s){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Vs(s),this.nonDisplayedMemory=new Vs(s),this.lastOutputScreen=new Vs(s),this.currRollUpRow=this.displayedMemory.rows[Me-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Me-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let s=0;st+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const s=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[s]}this.logger.log(2,"MIDROW: "+ae(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class nn{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Kd(),this.logger=void 0;const i=this.logger=new Bd;this.channels=[null,new rn(e,t,i),new rn(e+1,s,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let s=0;s"["+lt([t[s],t[s+1]])+"] -> ("+lt([i,r])+")");const c=this.cmdHistory;if(i>=16&&i<=31){if(Gd(i,r,c)){Qt(null,null,c),this.logger.log(3,()=>"Repeated command ("+lt([i,r])+") is dropped");continue}Qt(i,r,this.cmdHistory),n=this.parseCmd(i,r),n||(n=this.parseMidrow(i,r)),n||(n=this.parsePAC(i,r)),n||(n=this.parseBackgroundAttributes(i,r))}else Qt(null,null,c);if(!n&&(o=this.parseChars(i,r),o)){const h=this.currentChannel;h&&h>0?this.channels[h].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!n&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+lt([i,r])+" orig: "+lt([t[s],t[s+1]]))}}parseCmd(e,t){const s=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(s||i))return!1;const r=e===20||e===21||e===23?1:2,n=this.channels[r];return e===20||e===21||e===28||e===29?t===32?n.ccRCL():t===33?n.ccBS():t===34?n.ccAOF():t===35?n.ccAON():t===36?n.ccDER():t===37?n.ccRU(2):t===38?n.ccRU(3):t===39?n.ccRU(4):t===40?n.ccFON():t===41?n.ccRDC():t===42?n.ccTR():t===43?n.ccRTD():t===44?n.ccEDM():t===45?n.ccCR():t===46?n.ccENM():t===47&&n.ccEOC():n.ccTO(t-32),this.currentChannel=r,!0}parseMidrow(e,t){let s=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[s];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+lt([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let s;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,r=(e===16||e===24)&&t>=64&&t<=95;if(!(i||r))return!1;const n=e<=23?1:2;t>=64&&t<=95?s=n===1?wd[e]:Fd[e]:s=n===1?Od[e]:Md[e];const o=this.channels[n];return o?(o.setPAC(this.interpretPAC(s,t)),this.currentChannel=n,!0):!1}interpretPAC(e,t){let s;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?s=t-96:s=t-64,i.underline=(s&1)===1,s<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((s-16)/2)*4,i}parseChars(e,t){let s,i=null,r=null;if(e>=25?(s=2,r=e-8):(s=1,r=e),r>=17&&r<=19){let n;r===17?n=t+80:r===18?n=t+112:n=t+144,this.logger.log(2,()=>"Special char '"+Fa(n)+"' in channel "+s),i=[n]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+lt(i).join(",")),i}parseBackgroundAttributes(e,t){const s=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(s||i))return!1;let r;const n={};e===16||e===24?(r=Math.floor((t-32)/2),n.background=Nd[r],t%2===1&&(n.background=n.background+"_semi")):t===45?n.background="transparent":(n.foreground="black",t===47&&(n.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(n),!0}reset(){for(let e=0;e100)throw new Error("Position must be between 0 and 100.");D=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",r({},d,{get:function(){return A},set:function(I){const P=i(I);if(!P)throw new SyntaxError("An invalid or illegal string was specified.");A=P,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",r({},d,{get:function(){return R},set:function(I){if(I<0||I>100)throw new Error("Size must be between 0 and 100.");R=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",r({},d,{get:function(){return _},set:function(I){const P=i(I);if(!P)throw new SyntaxError("An invalid or illegal string was specified.");_=P,this.hasBeenReset=!0}})),h.displayState=void 0}return n.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},n})();class Vd{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Na(a){function e(s,i,r,n){return(s|0)*3600+(i|0)*60+(r|0)+parseFloat(n||0)}const t=a.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class Hd{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,s){return s?this.has(e)?this.values[e]:t[s]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,s){for(let i=0;i=0&&s<=100)return this.set(e,s),!0}return!1}}function Ba(a,e,t,s){const i=s?a.split(s):[a];for(const r in i){if(typeof i[r]!="string")continue;const n=i[r].split(t);if(n.length!==2)continue;const o=n[0],c=n[1];e(o,c)}}const mi=new $i(0,0,""),Zt=mi.align==="middle"?"middle":"center";function Yd(a,e,t){const s=a;function i(){const o=Na(a);if(o===null)throw new Error("Malformed timestamp: "+s);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function r(o,c){const l=new Hd;Ba(o,function(u,f){let g;switch(u){case"region":for(let E=t.length-1;E>=0;E--)if(t[E].id===f){l.set(u,t[E].region);break}break;case"vertical":l.alt(u,f,["rl","lr"]);break;case"line":g=f.split(","),l.integer(u,g[0]),l.percent(u,g[0])&&l.set("snapToLines",!1),l.alt(u,g[0],["auto"]),g.length===2&&l.alt("lineAlign",g[1],["start",Zt,"end"]);break;case"position":g=f.split(","),l.percent(u,g[0]),g.length===2&&l.alt("positionAlign",g[1],["start",Zt,"end","line-left","line-right","auto"]);break;case"size":l.percent(u,f);break;case"align":l.alt(u,f,["start",Zt,"end","left","right"]);break}},/:/,/\s/),c.region=l.get("region",null),c.vertical=l.get("vertical","");let h=l.get("line","auto");h==="auto"&&mi.line===-1&&(h=-1),c.line=h,c.lineAlign=l.get("lineAlign","start"),c.snapToLines=l.get("snapToLines",!0),c.size=l.get("size",100),c.align=l.get("align",Zt);let d=l.get("position","auto");d==="auto"&&mi.position===50&&(d=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=d}function n(){a=a.replace(/^\s+/,"")}if(n(),e.startTime=i(),n(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);a=a.slice(3),n(),e.endTime=i(),n(),r(a,e)}function Ua(a){return a.replace(//gi,` +`)}class Wd{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Vd,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function s(){let r=t.buffer,n=0;for(r=Ua(r);n")===-1){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{Yd(r,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=r.indexOf("-->")!==-1;if(!r||o&&(n=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=` +`),t.cue.text+=r}continue;case"BADCUE":r||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=` + +`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const jd=/\r\n|\n\r|\n|\r/g,Hs=function(e,t,s=0){return e.slice(s,s+t.length)===t},qd=function(e){let t=parseInt(e.slice(-3));const s=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!M(t)||!M(s)||!M(i)||!M(r))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*s,t+=60*1e3*i,t+=3600*1e3*r,t};function Gi(a,e,t){return kt(a.toString())+kt(e.toString())+kt(t)}const Xd=function(e,t,s){let i=e[t],r=e[i.prevCC];if(!r||!r.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=!1;return}for(;(n=r)!=null&&n.new;){var n;e.ccOffset+=i.start-r.start,i.new=!1,i=r,r=e[i.prevCC]}e.presentationOffset=s};function zd(a,e,t,s,i,r,n){const o=new Wd,c=_e(new Uint8Array(a)).trim().replace(jd,` +`).split(` +`),l=[],h=e?sh(e.baseTime,e.timescale):0;let d="00:00.000",u=0,f=0,g,E=!0;o.oncue=function(p){const y=t[s];let T=t.ccOffset;const v=(u-h)/9e4;if(y!=null&&y.new&&(f!==void 0?T=t.ccOffset=y.start:Xd(t,s,v)),v){if(!e){g=new Error("Missing initPTS for VTT MPEGTS");return}T=v-t.presentationOffset}const S=p.endTime-p.startTime,x=Le((p.startTime+T-f)*9e4,i*9e4)/9e4;p.startTime=Math.max(x,0),p.endTime=Math.max(x+S,0);const D=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(D)),p.id||(p.id=Gi(p.startTime,p.endTime,D)),p.endTime>0&&l.push(p)},o.onparsingerror=function(p){g=p},o.onflush=function(){if(g){n(g);return}r(l)},c.forEach(p=>{if(E)if(Hs(p,"X-TIMESTAMP-MAP=")){E=!1,p.slice(16).split(",").forEach(y=>{Hs(y,"LOCAL:")?d=y.slice(6):Hs(y,"MPEGTS:")&&(u=parseInt(y.slice(7)))});try{f=qd(d)/1e3}catch(y){g=y}return}else p===""&&(E=!1);o.parse(p+` +`)}),o.flush()}const Ys="stpp.ttml.im1t",$a=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ga=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Qd={left:"start",center:"center",right:"end",start:"start",end:"end"};function an(a,e,t,s){const i=z(new Uint8Array(a),["mdat"]);if(i.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const r=i.map(o=>_e(o)),n=th(e.baseTime,1,e.timescale);try{r.forEach(o=>t(Zd(o,n)))}catch(o){s(o)}}function Zd(a,e){const i=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},n=Object.keys(r).reduce((d,u)=>(d[u]=i.getAttribute(`ttp:${u}`)||r[u],d),{}),o=i.getAttribute("xml:space")!=="preserve",c=on(Ws(i,"styling","style")),l=on(Ws(i,"layout","region")),h=Ws(i,"body","[begin]");return[].map.call(h,d=>{const u=Ka(d,o);if(!u||!d.hasAttribute("begin"))return null;const f=qs(d.getAttribute("begin"),n),g=qs(d.getAttribute("dur"),n);let E=qs(d.getAttribute("end"),n);if(f===null)throw ln(d);if(E===null){if(g===null)throw ln(d);E=f+g}const p=new $i(f-e,E-e,u);p.id=Gi(p.startTime,p.endTime,p.text);const y=l[d.getAttribute("region")],T=c[d.getAttribute("style")],v=Jd(y,T,c),{textAlign:S}=v;if(S){const x=Qd[S];x&&(p.lineAlign=x),p.align=S}return re(p,v),p}).filter(d=>d!==null)}function Ws(a,e,t){const s=a.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(t)):[]}function on(a){return a.reduce((e,t)=>{const s=t.getAttribute("xml:id");return s&&(e[s]=t),e},{})}function Ka(a,e){return[].slice.call(a.childNodes).reduce((t,s,i)=>{var r;return s.nodeName==="br"&&i?t+` +`:(r=s.childNodes)!=null&&r.length?Ka(s,e):e?t+s.textContent.trim().replace(/\s+/g," "):t+s.textContent},"")}function Jd(a,e,t){const s="http://www.w3.org/ns/ttml#styling";let i=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],n=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return n&&t.hasOwnProperty(n)&&(i=t[n]),r.reduce((o,c)=>{const l=js(e,s,c)||js(a,s,c)||js(i,s,c);return l&&(o[c]=l),o},{})}function js(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function ln(a){return new Error(`Could not parse ttml timestamp ${a}`)}function qs(a,e){if(!a)return null;let t=Na(a);return t===null&&($a.test(a)?t=eu(a,e):Ga.test(a)&&(t=tu(a,e))),t}function eu(a,e){const t=$a.exec(a),s=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+s/e.frameRate}function tu(a,e){const t=Ga.exec(a),s=Number(t[1]);switch(t[2]){case"h":return s*3600;case"m":return s*60;case"ms":return s*1e3;case"f":return s/e.frameRate;case"t":return s/e.tickRate}return s}class Jt{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,s){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class su{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=hn(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(m.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(m.FRAG_LOADING,this.onFragLoading,this),e.on(m.FRAG_LOADED,this.onFragLoaded,this),e.on(m.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(m.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(m.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(m.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(m.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(m.FRAG_LOADING,this.onFragLoading,this),e.off(m.FRAG_LOADED,this.onFragLoaded,this),e.off(m.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(m.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(m.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(m.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Jt(this,"textTrack1"),t=new Jt(this,"textTrack2"),s=new Jt(this,"textTrack3"),i=new Jt(this,"textTrack4");this.cea608Parser1=new nn(1,e,t),this.cea608Parser2=new nn(3,s,i)}addCues(e,t,s,i,r){let n=!1;for(let o=r.length;o--;){const c=r[o],l=iu(c[0],c[1],t,s);if(l>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],s),n=!0,l/(s-t)>.5))return}if(n||r.push([t,s]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,s,i)}else{const o=this.Cues.newCue(null,t,s,i);this.hls.trigger(m.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:s,initPTS:i,timescale:r,trackId:n}){const{unparsedVttFrags:o}=this;s===B.MAIN&&(this.initPTS[t.cc]={baseTime:i,timescale:r,trackId:n}),o.length&&(this.unparsedVttFrags=[],o.forEach(c=>{this.initPTS[c.frag.cc]?this.onFragLoaded(m.FRAG_LOADED,c):this.hls.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:s}=this;if(s)for(let i=0;i{Tt(i[r]),delete i[r]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=hn(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let s=0;sr.textCodec===Ys);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(Ta(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const n=this.media,o=n?cs(n.textTracks):null;if(this.tracks.forEach((c,l)=>{let h;if(o){let d=null;for(let u=0;ul!==null).map(l=>l.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const n=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(m.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:n})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(s=>{const i=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!i)return;const r=`textTrack${i[1]}`,n=this.captionsProperties[r];n&&(n.label=s.name,s.lang&&(n.languageCode=s.lang),n.media=s)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===B.MAIN){var s,i;const{cea608Parser1:r,cea608Parser2:n,lastSn:o}=this,{cc:c,sn:l}=t.frag,h=(s=(i=t.part)==null?void 0:i.index)!=null?s:-1;r&&n&&(l!==o+1||l===o&&h!==this.lastPartIndex+1||c!==this.lastCc)&&(r.reset(),n.reset()),this.lastCc=c,this.lastSn=l,this.lastPartIndex=h}}onFragLoaded(e,t){const{frag:s,payload:i}=t;if(s.type===B.SUBTITLE)if(i.byteLength){const r=s.decryptdata,n="stats"in t;if(r==null||!r.encrypted||n){const o=this.tracks[s.level],c=this.vttCCs;c[s.cc]||(c[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),o&&o.textCodec===Ys?this._parseIMSC1(s,i):this._parseVTTs(t)}}else this.hls.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const s=this.hls;an(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),s.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{s.logger.log(`Failed to parse IMSC1: ${i}`),s.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:s,payload:i}=e,{initPTS:r,unparsedVttFrags:n}=this,o=r.length-1;if(!r[s.cc]&&o===-1){n.push(e);return}const c=this.hls,l=(t=s.initSegment)!=null&&t.data?Pe(s.initSegment.data,new Uint8Array(i)).buffer:i;zd(l,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,h=>{this._appendCues(h,s.level),c.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},h=>{const d=h.message==="Missing initPTS for VTT MPEGTS";d?n.push(e):this._fallbackToIMSC1(s,i),c.logger.log(`Failed to parse VTT cue: ${h}`),!(d&&o>s.cc)&&c.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:h})})}_fallbackToIMSC1(e,t){const s=this.tracks[e.level];s.textCodec||an(t,this.initPTS[e.cc],()=>{s.textCodec=Ys,this._parseIMSC1(e,t)},()=>{s.textCodec="wvtt"})}_appendCues(e,t){const s=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(r=>wa(i,r))}else{const i=this.tracks[t];if(!i)return;const r=i.default?"default":"subtitles"+t;s.trigger(m.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:s}=t;s.type===B.SUBTITLE&&this.onFragLoaded(m.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:s,samples:i}=t;if(!(s.type===B.MAIN&&this.closedCaptionsForLevel(s)==="NONE"))for(let r=0;rgi(o[c],t,s))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(c=>gi(o[c],t,i))}}}extractCea608Data(e){const t=[[],[]],s=e[0]&31;let i=2;for(let r=0;r=16?c--:c++;const f=Ua(l.trim()),g=Gi(e,t,f);a!=null&&(d=a.cues)!=null&&d.getCueById(g)||(n=new h(e,t,f),n.id=g,n.line=u+1,n.align="left",n.position=10+Math.min(80,Math.floor(c*8/32)*10),i.push(n))}return a&&i.length&&(i.sort((u,f)=>u.line==="auto"||f.line==="auto"?0:u.line>8&&f.line>8?f.line-u.line:u.line-f.line),i.forEach(u=>wa(a,u))),i}};function au(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const ou=/(\d+)-(\d+)\/(\d+)/;class dn{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||du,this.controller=new self.AbortController,this.stats=new Ti}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,s){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const r=lu(e,this.controller.signal),n=e.responseType==="arraybuffer",o=n?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:l}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=s,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=c&&M(c)?c:l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},t.timeout),(Bt(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(d=>{var u;this.response=this.loader=d;const f=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(i,e,this.response))},l-(f-i.loading.start)),!d.ok){const{status:E,statusText:p}=d;throw new uu(p||"fetch, bad network response",E,d)}i.loading.first=f,i.total=hu(d.headers)||i.total;const g=(u=this.callbacks)==null?void 0:u.onProgress;return g&&M(t.highWaterMark)?this.loadProgressively(d,i,e,t.highWaterMark,g):n?d.arrayBuffer():e.responseType==="json"?d.json():d.text()}).then(d=>{var u,f;const g=this.response;if(!g)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const E=d[o];E&&(i.loaded=i.total=E);const p={url:g.url,data:d,code:g.status},y=(u=this.callbacks)==null?void 0:u.onProgress;y&&!M(t.highWaterMark)&&y(i,e,d,g),(f=this.callbacks)==null||f.onSuccess(p,i,e,g)}).catch(d=>{var u;if(self.clearTimeout(this.requestTimeout),i.aborted)return;const f=d&&d.code||0,g=d?d.message:null;(u=this.callbacks)==null||u.onError({code:f,text:g},e,d?d.details:null,i)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,s,i=0,r){const n=new Jn,o=e.body.getReader(),c=()=>o.read().then(l=>{if(l.done)return n.dataLength&&r(t,s,n.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const h=l.value,d=h.length;return t.loaded+=d,d=i&&r(t,s,n.flush().buffer,e)):r(t,s,h.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function lu(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(re({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function cu(a){const e=ou.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function hu(a){const e=a.get("Content-Range");if(e){const s=cu(e);if(M(s))return s}const t=a.get("Content-Length");if(t)return parseInt(t)}function du(a,e){return new self.Request(a.url,e)}class uu extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const fu=/^age:\s*[\d.]+\s*$/im;class Ha{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Ti,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=s,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const s=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!(this.loader!==s||this.stats.aborted))return r(s,t.url)}).catch(n=>{if(!(this.loader!==s||this.stats.aborted))return s.open("GET",t.url,!0),r(s,t.url)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,t,e)}).catch(n=>{var o;(o=this.callbacks)==null||o.onError({code:s.status,text:n.message},t,s,i)}):this.openAndSendXhr(s,t,e)}openAndSendXhr(e,t,s){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:n}=s.loadPolicy;if(i)for(const o in i)e.setRequestHeader(o,i[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),s.timeout=r&&M(r)?r:n,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:s}=this;if(!e||!t)return;const i=t.readyState,r=this.config;if(!s.aborted&&i>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const l=t.status,h=t.responseType==="text"?t.responseText:null;if(l>=200&&l<300){const g=h??t.response;if(g!=null){var n,o;s.loading.end=Math.max(self.performance.now(),s.loading.first);const E=t.responseType==="arraybuffer"?g.byteLength:g.length;s.loaded=s.total=E,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);const p=(n=this.callbacks)==null?void 0:n.onProgress;p&&p(s,e,g,t);const y={url:t.responseURL,data:g,code:l};(o=this.callbacks)==null||o.onSuccess(y,s,e,t);return}}const d=r.loadPolicy.errorRetry,u=s.retry,f={url:e.url,data:void 0,code:l};if(ps(d,u,!1,f))this.retry(d);else{var c;ie.error(`${l} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:l,text:t.statusText},e,t,s)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(ps(e,t,!0))this.retry(e);else{var s;ie.warn(`timeout while loading ${(s=this.context)==null?void 0:s.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:s}=this;this.retryDelay=Ai(e,s.retry),s.retry++,ie.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${s.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&fu.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const gu={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},mu=se(se({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:Ha,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:bl,bufferController:Eh,capLevelController:Ni,errorController:kl,fpsController:yd,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Kn,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:gu},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},pu()),{},{subtitleStreamController:Cd,subtitleTrackController:Sd,timelineController:su,audioStreamController:fh,audioTrackController:gh,emeController:xt,cmcdController:gd,contentSteeringController:pd,interstitialsController:Dd});function pu(){return{cueHandler:nu,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function Eu(a,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const s=pi(a),i=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(n=>{const o=`${n==="level"?"playlist":n}LoadPolicy`,c=e[o]===void 0,l=[];r.forEach(h=>{const d=`${n}Loading${h}`,u=e[d];if(u!==void 0&&c){l.push(d);const f=s[o].default;switch(e[o]={default:f},h){case"TimeOut":f.maxLoadTimeMs=u,f.maxTimeToFirstByteMs=u;break;case"MaxRetry":f.errorRetry.maxNumRetry=u,f.timeoutRetry.maxNumRetry=u;break;case"RetryDelay":f.errorRetry.retryDelayMs=u,f.timeoutRetry.retryDelayMs=u;break;case"MaxRetryTimeout":f.errorRetry.maxRetryDelayMs=u,f.timeoutRetry.maxRetryDelayMs=u;break}}}),l.length&&t.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${o}": ${ae(e[o])}`)}),se(se({},s),e)}function pi(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(pi):Object.keys(a).reduce((e,t)=>(e[t]=pi(a[t]),e),{}):a}function yu(a,e){const t=a.loader;t!==dn&&t!==Ha?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):au()&&(a.loader=dn,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const hs=2,Tu=.1,vu=.05,Su=100;class xu extends Nn{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var s;(s=this.media)!=null&&s.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var s;this.ended=((s=this.media)==null?void 0:s.currentTime)||1,this.hls.trigger(m.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(Su),this.mediaSource=t.mediaSource;const s=this.media=t.media;ve(s,"playing",this.onMediaPlaying),ve(s,"waiting",this.onMediaWaiting),ve(s,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:s}=this;s&&(xe(s,"playing",this.onMediaPlaying),xe(s,"waiting",this.onMediaWaiting),xe(s,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var s,i;const r=(s=this.hls)==null?void 0:s.config;if(!r)return;const n=this.media;if(!n)return;const{seeking:o}=n,c=this.seeking&&!o,l=!this.seeking&&o,h=n.paused&&!o||n.ended||n.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!h&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(l||c){c&&this.stallResolved(e);return}if(h){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&n.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(m.MEDIA_ENDED,{stalled:!1}));return}if(!j.getBuffered(n).length){this.nudgeRetry=0;return}const d=j.bufferInfo(n,e,0),u=d.nextStart||0,f=this.fragmentTracker;if(o&&f&&this.hls){const D=un(this.hls.inFlightFragments,e),A=d.len>hs,R=!u||D||u-e>hs&&!f.getPartialFragment(e);if(A||R)return;this.moved=!1}const g=(i=this.hls)==null?void 0:i.latestLevelDetails;if(!this.moved&&this.stalled!==null&&f){if(!(d.len>0)&&!u)return;const A=Math.max(u,d.start||0)-e,_=!!(g!=null&&g.live)?g.targetduration*2:hs,I=es(e,f);if(A>0&&(A<=_||I)){n.paused||this._trySkipBufferHole(I);return}}const E=r.detectStallWithCurrentTimeMs,p=self.performance.now(),y=this.waiting;let T=this.stalled;if(T===null)if(y>0&&p-y=E||y)&&this.hls){var S;if(((S=this.mediaSource)==null?void 0:S.readyState)==="ended"&&!(g!=null&&g.live)&&Math.abs(e-(g?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(m.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(d),!this.media||!this.hls)return}const x=j.bufferInfo(n,e,r.maxBufferHole);this._tryFixBufferStall(x,v,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const s=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(s)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(m.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var s;const i=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(s=this.buffered.audio)!=null&&s.length&&i&&i.length>1&&e>i.end(0)){const r=j.bufferedInfo(j.timeRangesToArray(this.buffered.audio),e,0);if(r.len>1&&t>=r.start){const n=j.timeRangesToArray(i),o=j.bufferedInfo(n,t,0).bufferedIndex;if(o>-1&&oo)&&h-l<1&&e-l<2){const d=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${l} -> ${h} buffered index: ${c}`);this.warn(d.message),this.media.currentTime+=1e-6;let u=es(e,this.fragmentTracker);u&&"fragment"in u?u=u.fragment:u||(u=void 0);const f=j.bufferInfo(this.media,e,0);this.hls.trigger(m.ERROR,{type:V.MEDIA_ERROR,details:b.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:d,reason:d.message,frag:u,buffer:f.len,bufferInfo:f})}}}}}_tryFixBufferStall(e,t,s){var i,r;const{fragmentTracker:n,media:o}=this,c=(i=this.hls)==null?void 0:i.config;if(!o||!n||!c)return;const l=(r=this.hls)==null?void 0:r.latestLevelDetails,h=es(s,n);if((h||l!=null&&l.live&&s1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-sc.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const s=this.fragmentTracker,i=e.nextStart;if(s&&i){const r=s.getFragAtPos(t,B.MAIN),n=s.getFragAtPos(i,B.MAIN);if(r&&n)return n.sn-r.sn<2}return!1}_reportStall(e){const{hls:t,media:s,stallReported:i,stalled:r}=this;if(!i&&r!==null&&s&&t){this.stallReported=!0;const n=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${ae(e)})`);this.warn(n.message),t.trigger(m.ERROR,{type:V.MEDIA_ERROR,details:b.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len,bufferInfo:e,stalled:{start:r}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:s,media:i}=this,r=(t=this.hls)==null?void 0:t.config;if(!i||!s||!r)return 0;const n=i.currentTime,o=j.bufferInfo(i,n,0),c=n0&&o.len<1&&i.readyState<3,u=c-n;if(u>0&&(h||d)){if(u>r.maxBufferHole){let g=!1;if(n===0){const E=s.getAppendedFrag(0,B.MAIN);E&&c"u"))return self.VTTCue||self.TextTrackCue}function Xs(a,e,t,s,i){let r=new a(e,t,"");try{r.value=s,i&&(r.type=i)}catch{r=new a(e,t,ae(i?se({type:i},s):s))}return r}const ts=(()=>{const a=Ei();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Iu{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(m.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(m.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(m.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var s;this.media=t.media,((s=t.overrides)==null?void 0:s.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&Tt(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tts&&(d=ts),d-h<=0&&(d=h+Au);for(let f=0;fh.type===Re.audioId3&&c:i==="video"?l=h=>h.type===Re.emsg&&o:l=h=>h.type===Re.audioId3&&c||h.type===Re.emsg&&o,gi(r,t,s,l)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:s,timelineOffset:i,enableDateRangeMetadataCues:r,interstitialsController:n}=this.hls.config;if(!r)return;const o=Ei();if(s&&i&&!n){const{fragmentStart:E,fragmentEnd:p}=e;let y=this.assetCue;y?(y.startTime=E,y.endTime=p):o&&(y=this.assetCue=Xs(o,E,p,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),y&&(y.id=s,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(y),y.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:c}=this,{dateRanges:l}=e,h=Object.keys(l);let d=this.dateRangeCuesAppended;if(c&&t){var u;if((u=c.cues)!=null&&u.length){const E=Object.keys(d).filter(p=>!h.includes(p));for(let p=E.length;p--;){var f;const y=E[p],T=(f=d[y])==null?void 0:f.cues;delete d[y],T&&Object.keys(T).forEach(v=>{const S=T[v];if(S){S.removeEventListener("enter",this.onEventCueEnter);try{c.removeCue(S)}catch{}}})}}else d=this.dateRangeCuesAppended={}}const g=e.fragments[e.fragments.length-1];if(!(h.length===0||!M(g?.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let E=0;E{if(F!==y.id){const U=l[F];if(U.class===y.class&&U.startDate>y.startDate&&(!P||y.startDate.01&&(F.startTime=T,F.endTime=D);else if(o){let U=y.attr[P];Wl(P)&&(U=En(U));const $=Xs(o,T,D,{key:P,data:U},Re.dateRange);$&&($.id=p,this.id3Track.addCue($),S[P]=$,n&&(P==="X-ASSET-LIST"||P==="X-ASSET-URL")&&$.addEventListener("enter",this.onEventCueEnter))}}d[p]={cues:S,dateRange:y,durationKnown:x}}}}}class Lu{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,s=this.levelDetails;if(!t||!s)return;this.currentTime=t.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||n===1||!s.live)return;const o=this.targetLatency;if(o===null)return;const c=i-o,l=Math.min(this.maxLatency,o+s.targetduration);if(c.05&&this.forwardBufferLength>1){const d=Math.min(2,Math.max(1,n)),u=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,f=Math.min(d,Math.max(1,u));this.changeMediaPlaybackRate(t,f)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:s,targetduration:i}=e,{liveSyncDuration:r,liveSyncDurationCount:n,lowLatencyMode:o}=this.config,c=this.hls.userConfig;let l=o&&s||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||l===0)&&(l=r!==void 0?r:n*i);const h=i;return l+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,h)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const s=this.levelDetails;if(s===null)return null;const i=s.edge,r=e-t-this.edgeStalled,n=i-s.totalduration,o=i-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(n,r),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const s=e.buffered.length;return(s?e.buffered.end(s-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(m.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(m.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var s;t.details===b.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(s=this.levelDetails)!=null&&s.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var s,i;e.playbackRate!==t&&((s=this.hls)==null||s.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(i=this.targetLatency)==null?void 0:i.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class Ru extends Mi{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(m.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(m.FRAG_BUFFERED,this.onFragBuffered,this),e.on(m.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(m.LEVEL_LOADED,this.onLevelLoaded,this),e.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(m.FRAG_BUFFERED,this.onFragBuffered,this),e.off(m.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const s=this.hls.config.preferManagedMediaSource,i=[],r={},n={};let o=!1,c=!1,l=!1;t.levels.forEach(h=>{const d=h.attrs;let{audioCodec:u,videoCodec:f}=h;u&&(h.audioCodec=u=us(u,s)||void 0),f&&(f=h.videoCodec=ll(f));const{width:g,height:E,unknownCodecs:p}=h,y=p?.length||0;if(o||(o=!!(g&&E)),c||(c=!!f),l||(l=!!u),y||u&&!this.isAudioSupported(u)||f&&!this.isVideoSupported(f)){this.log(`Some or all CODECS not supported "${d.CODECS}"`);return}const{CODECS:T,"FRAME-RATE":v,"HDCP-LEVEL":S,"PATHWAY-ID":x,RESOLUTION:D,"VIDEO-RANGE":A}=d,_=`${`${x||"."}-`}${h.bitrate}-${D}-${v}-${T}-${A}-${S}`;if(r[_])if(r[_].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const I=n[_]+=1;h.attrs["PATHWAY-ID"]=new Array(I+1).join(".");const P=this.createLevel(h);r[_]=P,i.push(P)}else r[_].addGroupId("audio",d.AUDIO),r[_].addGroupId("text",d.SUBTITLES);else{const I=this.createLevel(h);r[_]=I,n[_]=1,i.push(I)}}),this.filterAndSortMediaOptions(i,t,o,c,l)}createLevel(e){const t=new Ft(e),s=e.supplemental;if(s!=null&&s.videoCodec&&!this.isVideoSupported(s.videoCodec)){const i=new Error(`SUPPLEMENTAL-CODECS not supported "${s.videoCodec}"`);this.log(i.message),t.supportedResult=Dn(i,[])}return t}isAudioSupported(e){return wt(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return wt(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,s,i,r){var n;let o=[],c=[],l=e;const h=((n=t.stats)==null?void 0:n.parsing)||{};if((s||i)&&r&&(l=l.filter(({videoCodec:T,videoRange:v,width:S,height:x})=>(!!T||!!(S&&x))&&yl(v))),l.length===0){Promise.resolve().then(()=>{if(this.hls){let T="no level with compatible codecs found in manifest",v=T;t.levels.length&&(v=`one or more CODECS in variant not supported: ${ae(t.levels.map(x=>x.attrs.CODECS).filter((x,D,A)=>A.indexOf(x)===D))}`,this.warn(v),T+=` (${v})`);const S=new Error(T);this.hls.trigger(m.ERROR,{type:V.MEDIA_ERROR,details:b.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:S,reason:v})}}),h.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(T=>!T.audioCodec||this.isAudioSupported(T.audioCodec)),gn(o)),t.subtitles&&(c=t.subtitles,gn(c));const d=l.slice(0);l.sort((T,v)=>{if(T.attrs["HDCP-LEVEL"]!==v.attrs["HDCP-LEVEL"])return(T.attrs["HDCP-LEVEL"]||"")>(v.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&T.height!==v.height)return T.height-v.height;if(T.frameRate!==v.frameRate)return T.frameRate-v.frameRate;if(T.videoRange!==v.videoRange)return fs.indexOf(T.videoRange)-fs.indexOf(v.videoRange);if(T.videoCodec!==v.videoCodec){const S=rr(T.videoCodec),x=rr(v.videoCodec);if(S!==x)return x-S}if(T.uri===v.uri&&T.codecSet!==v.codecSet){const S=ds(T.codecSet),x=ds(v.codecSet);if(S!==x)return x-S}return T.averageBitrate!==v.averageBitrate?T.averageBitrate-v.averageBitrate:0});let u=d[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==d.length)){for(let T=0;TS&&S===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=x)}break}const g=r&&!i,E=this.hls.config,p=!!(E.audioStreamController&&E.audioTrackController),y={levels:l,audioTracks:o,subtitleTracks:c,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:i,altAudio:p&&!g&&o.some(T=>!!T.url)};h.end=performance.now(),this.hls.trigger(m.MANIFEST_PARSED,y)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const h=new Error("invalid level idx"),d=e<0;if(this.hls.trigger(m.ERROR,{type:V.OTHER_ERROR,details:b.LEVEL_SWITCH_ERROR,level:e,fatal:d,error:h,reason:h.message}),d)return;e=Math.min(e,t.length-1)}const s=this.currentLevelIndex,i=this.currentLevel,r=i?i.attrs["PATHWAY-ID"]:void 0,n=t[e],o=n.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=n,s===e&&i&&r===o)return;this.log(`Switching to level ${e} (${n.height?n.height+"p ":""}${n.videoRange?n.videoRange+" ":""}${n.codecSet?n.codecSet+" ":""}@${n.bitrate})${o?" with Pathway "+o:""} from level ${s}${r?" with Pathway "+r:""}`);const c={level:e,attrs:n.attrs,details:n.details,bitrate:n.bitrate,averageBitrate:n.averageBitrate,maxBitrate:n.maxBitrate,realBitrate:n.realBitrate,width:n.width,height:n.height,codecSet:n.codecSet,audioCodec:n.audioCodec,videoCodec:n.videoCodec,audioGroups:n.audioGroups,subtitleGroups:n.subtitleGroups,loaded:n.loaded,loadError:n.loadError,fragmentError:n.fragmentError,name:n.name,id:n.id,uri:n.uri,url:n.url,urlId:0,audioGroupIds:n.audioGroupIds,textGroupIds:n.textGroupIds};this.hls.trigger(m.LEVEL_SWITCHING,c);const l=n.details;if(!l||l.live){const h=this.switchParams(n.uri,i?.details,l);this.loadPlaylist(h)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),s=e.filter(i=>t.indexOf(i)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=s}}onError(e,t){t.fatal||!t.context||t.context.type===Q.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===B.MAIN){const s=t.elementaryStreams;if(!Object.keys(s).some(r=>!!s[r]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var s;const{level:i,details:r}=t,n=t.levelInfo;if(!n){var o;this.warn(`Invalid level index ${i}`),(o=t.deliveryDirectives)!=null&&o.skip&&(r.deltaUpdateFailed=!0);return}if(n===this.currentLevel||t.withoutMultiVariant){n.fragmentError===0&&(n.loadError=0);let c=n.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(i,t,c)}else(s=t.deliveryDirectives)!=null&&s.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=this.getUrlWithDirectives(e.uri,t),i=this.currentLevelIndex,r=e.attrs["PATHWAY-ID"],n=e.details,o=n?.age;this.log(`Loading level index ${i}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${r?" Pathway "+r:""}${o&&n.live?" age "+o.toFixed(1)+(n.type&&" "+n.type||""):""} ${s}`),this.hls.trigger(m.LEVEL_LOADING,{url:s,level:i,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const s=this._levels.filter((r,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(o=>o.level=-1)),!1));zn(s),this._levels=s,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const i=s.length-1;this._firstLevel=Math.min(this._firstLevel,i),this._startLevel&&(this._startLevel=Math.min(this._startLevel,i)),this.hls.trigger(m.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(m.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function gn(a){const e={};a.forEach(t=>{const s=t.groupId||"";t.id=e[s]=e[s]||0,e[s]++})}function Ya(){return self.SourceBuffer||self.WebKitSourceBuffer}function Wa(){if(!st())return!1;const e=Ya();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function bu(){if(!Wa())return!1;const a=st();return typeof a?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>a.isTypeSupported(Ot(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(Ot(e,"audio"))))}function _u(){var a;const e=Ya();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const Du=100;class Cu extends _i{constructor(e,t,s){super(e,t,s,"stream-controller",B.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const i=this.media,r=i?i.currentTime:null;if(r===null||!M(r)||(this.log(`Media seeked to ${r.toFixed(3)}`),!this.getBufferedFrag(r)))return;const n=this.getFwdBufferInfoAtPos(i,r,B.MAIN,0);if(n===null||n.len===0){this.warn(`Main forward buffer length at ${r} on "seeked" event ${n?n.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(m.MANIFEST_PARSED,this.onManifestParsed,this),e.on(m.LEVEL_LOADING,this.onLevelLoading,this),e.on(m.LEVEL_LOADED,this.onLevelLoaded,this),e.on(m.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(m.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(m.BUFFER_CREATED,this.onBufferCreated,this),e.on(m.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(m.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(m.MANIFEST_PARSED,this.onManifestParsed,this),e.off(m.LEVEL_LOADED,this.onLevelLoaded,this),e.off(m.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(m.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(m.BUFFER_CREATED,this.onBufferCreated,this),e.off(m.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(m.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:s,hls:i}=this;if(this.stopLoad(),this.setInterval(Du),this.level=-1,!this.startFragRequested){let r=i.startLevel;r===-1&&(i.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=i.firstAutoLevel),i.nextLoadLevel=r,this.level=i.loadLevel,this._hasEnoughToStart=!!t}s>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s),this.state=C.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=C.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case C.WAITING_LEVEL:{const{levels:e,level:t}=this,s=e?.[t],i=s?.details;if(i&&(!i.live||this.levelLastLoaded===s&&!this.waitForLive(s))){if(this.waitForCdnTuneIn(i))break;this.state=C.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=C.IDLE;break}break}case C.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===C.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:s,media:i}=this;if(t===null||!i&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const r=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(s!=null&&s[r]))return;const n=s[r],o=this.getMainFwdBufferInfo();if(o===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(o,c)){const E={};this.altAudio===2&&(E.type="video"),this.hls.trigger(m.BUFFER_EOS,E),this.state=C.ENDED;return}if(!this.buffering)return;e.loadLevel!==r&&e.manualLevel===-1&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const l=n.details;if(!l||this.state===C.WAITING_LEVEL||this.waitForLive(n)){this.level=r,this.state=C.WAITING_LEVEL,this.startFragRequested=!1;return}const h=o.len,d=this.getMaxBufferLength(n.maxBitrate);if(h>=d)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const u=this.backtrackFragment?this.backtrackFragment.start:o.end;let f=this.getNextFragment(u,l);if(this.couldBacktrack&&!this.fragPrevious&&f&&he(f)&&this.fragmentTracker.getState(f)!==ue.OK){var g;const p=((g=this.backtrackFragment)!=null?g:f).sn-l.startSN,y=l.fragments[p-1];y&&f.cc===y.cc&&(f=y,this.fragmentTracker.removeFragment(y))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,u)){if(!f.gap){const p=this.audioOnly&&!this.altAudio?ne.AUDIO:ne.VIDEO,y=(p===ne.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;y&&this.afterBufferFlushed(y,p,B.MAIN)}f=this.getNextFragmentLoopLoading(f,l,o,B.MAIN,d)}f&&(f.initSegment&&!f.initSegment.data&&!this.bitrateTest&&(f=f.initSegment),this.loadFragment(f,n,u))}loadFragment(e,t,s){const i=this.fragmentTracker.getState(e);i===ue.NOT_LOADED||i===ue.PARTIAL?he(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,s):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,B.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let s;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const r=this.getLevelDetails();if(r!=null&&r.live){const o=this.getMainFwdBufferInfo();if(!o||o.len=n-t.maxFragLookUpTolerance&&r<=o;if(i!==null&&s.duration>i&&(r{this.hls&&this.hls.trigger(m.AUDIO_TRACK_SWITCHED,t)}),s.trigger(m.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}s.trigger(m.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const s=gs(t.url,this.hls);if(s){const i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=s?2:0,this.tick()}onBufferCreated(e,t){const s=t.tracks;let i,r,n=!1;for(const o in s){const c=s[o];if(c.id==="main"){if(r=o,i=c,o==="video"){const l=s[o];l&&(this.videoBuffer=l.buffer)}}else n=!0}n&&i?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:s,part:i}=t,r=s.type===B.MAIN;if(r){if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${i?" p: "+i.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===C.PARSED&&(this.state=C.IDLE);return}const o=i?i.stats:s.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),he(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,i)}const n=this.media;n&&(!this._hasEnoughToStart&&j.getBuffered(n).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var s;if(t.fatal){this.state=C.ERROR;return}switch(t.details){case b.FRAG_GAP:case b.FRAG_PARSING_ERROR:case b.FRAG_DECRYPT_ERROR:case b.FRAG_LOAD_ERROR:case b.FRAG_LOAD_TIMEOUT:case b.KEY_LOAD_ERROR:case b.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(B.MAIN,t);break;case b.LEVEL_LOAD_ERROR:case b.LEVEL_LOAD_TIMEOUT:case b.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===C.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===Q.LEVEL&&(this.state=C.IDLE);break;case b.BUFFER_ADD_CODEC_ERROR:case b.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case b.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case b.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=C.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==ne.AUDIO||!this.altAudio){const s=(t===ne.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,t,B.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let s=this.startPosition;if(s>=0&&t0&&(c{const{hls:i}=this,r=s?.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=C.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=r.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),i.trigger(m.FRAG_LOADED,s),r.bitrateTest=!1}).catch(s=>{this.state===C.STOPPED||this.state===C.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:s}=this,{remuxResult:i,chunkMeta:r}=e,n=this.getCurrentContext(r);if(!n){this.resetWhenMissingContext(r);return}const{frag:o,part:c,level:l}=n,{video:h,text:d,id3:u,initSegment:f}=i,{details:g}=l,E=this.altAudio?void 0:i.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=C.PARSING,f){const p=f.tracks;if(p){const S=o.initSegment||o;if(this.unhandledEncryptionError(f,o))return;this._bufferInitSegment(l,p,S,r),s.trigger(m.FRAG_PARSING_INIT_SEGMENT,{frag:S,id:t,tracks:p})}const y=f.initPTS,T=f.timescale,v=this.initPTS[o.cc];if(M(y)&&(!v||v.baseTime!==y||v.timescale!==T)){const S=f.trackId;this.initPTS[o.cc]={baseTime:y,timescale:T,trackId:S},s.trigger(m.INIT_PTS_FOUND,{frag:o,id:t,initPTS:y,timescale:T,trackId:S})}}if(h&&g){E&&h.type==="audiovideo"&&this.logMuxedErr(o);const p=g.fragments[o.sn-1-g.startSN],y=o.sn===g.startSN,T=!p||o.cc>p.cc;if(i.independent!==!1){const{startPTS:v,endPTS:S,startDTS:x,endDTS:D}=h;if(c)c.elementaryStreams[h.type]={startPTS:v,endPTS:S,startDTS:x,endDTS:D};else if(h.firstKeyFrame&&h.independent&&r.id===1&&!T&&(this.couldBacktrack=!0),h.dropped&&h.independent){const A=this.getMainFwdBufferInfo(),R=(A?A.end:this.getLoadPosition())+this.config.maxBufferHole,_=h.firstKeyFramePTS?h.firstKeyFramePTS:v;if(!y&&R<_-this.config.maxBufferHole&&!T){this.backtrack(o);return}else T&&(o.gap=!0);o.setElementaryStreamInfo(h.type,o.start,S,o.start,D,!0)}else y&&v-(g.appliedTimelineOffset||0)>hs&&(o.gap=!0);o.setElementaryStreamInfo(h.type,v,S,x,D),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(h,o,c,r,y||T)}else if(y||T)o.gap=!0;else{this.backtrack(o);return}}if(E){const{startPTS:p,endPTS:y,startDTS:T,endDTS:v}=E;c&&(c.elementaryStreams[ne.AUDIO]={startPTS:p,endPTS:y,startDTS:T,endDTS:v}),o.setElementaryStreamInfo(ne.AUDIO,p,y,T,v),this.bufferFragmentData(E,o,c,r)}if(g&&u!=null&&u.samples.length){const p={id:t,frag:o,details:g,samples:u.samples};s.trigger(m.FRAG_PARSING_METADATA,p)}if(g&&d){const p={id:t,frag:o,details:g,samples:d.samples};s.trigger(m.FRAG_PARSING_USERDATA,p)}}logMuxedErr(e){this.warn(`${he(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,s,i){if(this.state!==C.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(s));const{audio:r,video:n,audiovideo:o}=t;if(r){const l=e.audioCodec;let h=is(r.codec,l);h==="mp4a"&&(h="mp4a.40.5");const d=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){h&&(h.indexOf("mp4a.40.5")!==-1?h="mp4a.40.2":h="mp4a.40.5");const u=r.metadata;u&&"channelCount"in u&&(u.channelCount||1)!==1&&d.indexOf("firefox")===-1&&(h="mp4a.40.5")}h&&h.indexOf("mp4a.40.5")!==-1&&d.indexOf("android")!==-1&&r.container!=="audio/mpeg"&&(h="mp4a.40.2",this.log(`Android: force audio codec to ${h}`)),l&&l!==h&&this.log(`Swapping manifest audio codec "${l}" for "${h}"`),r.levelCodec=h,r.id=B.MAIN,this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${h||""}/${l||""}/${r.codec}]`),delete t.audiovideo}if(n){n.levelCodec=e.videoCodec,n.id=B.MAIN;const l=n.codec;if(l?.length===4)switch(l){case"hvc1":case"hev1":n.codec="hvc1.1.6.L120.90";break;case"av01":n.codec="av01.0.04M.08";break;case"avc1":n.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${n.container}, codecs[level/parsed]=[${e.videoCodec||""}/${l}]${n.codec!==l?" parsed-corrected="+n.codec:""}${n.supplemental?" supplemental="+n.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const c=Object.keys(t);if(c.length){if(this.hls.trigger(m.BUFFER_CODECS,t),!this.hls)return;c.forEach(l=>{const d=t[l].initSegment;d!=null&&d.byteLength&&this.hls.trigger(m.BUFFER_APPENDING,{type:l,data:d,frag:s,part:null,chunkMeta:i,parent:s.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,B.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,s=e?.[t];return s?this.getMaxBufferLength(s.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=C.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(j.isBuffered(e,s)?t=this.getAppendedFrag(s):j.isBuffered(e,s+.1)&&(t=this.getAppendedFrag(s+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,r=t.level;(!i||t.sn!==i.sn||i.level!==r)&&(this.fragPlaying=t,this.hls.trigger(m.FRAG_CHANGED,{frag:t}),(!i||i.level!==r)&&this.hls.trigger(m.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return M(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(M(t)){const s=this.getLevelDetails(),i=this.currentFrag||(s?dt(null,s.fragments,t):null);if(i){const r=i.programDateTime;if(r!==null){const n=r+(t-i.start)*1e3;return new Date(n)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Pu extends ke{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const s in this.keyIdToKeyInfo){const i=this.keyIdToKeyInfo[s].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=b.KEY_LOAD_ERROR,s,i,r){return new Xe({type:V.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:s,networkDetails:i})}loadClear(e,t,s){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let i=0,r=t.length;i{if(!this.emeController)return;n.setKeyFormat(o);const c=ns(o);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const i=Dt(this.config);if(i.length)return this.emeController.getKeySystemAccess(i)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var s,i;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const l=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,b.KEY_LOAD_ERROR,l))}const n=r.uri;if(!n)return Promise.reject(this.createKeyLoadError(e,b.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${n}"`)));const o=zs(r);let c=this.keyIdToKeyInfo[o];if((s=c)!=null&&s.decryptdata.key)return r.key=c.decryptdata.key,Promise.resolve({frag:e,keyInfo:c});if(this.emeController&&(i=c)!=null&&i.keyLoadPromise)switch(this.emeController.getKeyStatus(c.decryptdata)){case"usable":case"usable-in-future":return c.keyLoadPromise.then(h=>{const{keyInfo:d}=h;return r.key=d.decryptdata.key,{frag:e,keyInfo:d}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${r.keyId?" keyId: "+pe(r.keyId):""} URI: ${r.uri} from ${e.type} ${e.level}`),c=this.keyIdToKeyInfo[o]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return r.keyFormat==="identity"?this.loadKeyHTTP(c,e):this.loadKeyEME(c,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(c,e);default:return Promise.reject(this.createKeyLoadError(e,b.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const s={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var i;if(!e.decryptdata.keyId&&(i=t.initSegment)!=null&&i.data){const n=zo(t.initSegment.data);if(n.length){let o=n[0];o.some(c=>c!==0)?(this.log(`Using keyId found in init segment ${pe(o)}`),tt.setKeyIdForUri(e.decryptdata.uri,o)):(o=tt.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${pe(o)}`)),e.decryptdata.keyId=o}}if(!e.decryptdata.keyId&&!he(t))return Promise.resolve(s);const r=this.emeController.loadKey(s);return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,s))).catch(n=>{throw e.keyLoadPromise=null,"data"in n&&(n.data.frag=t),n})}return Promise.resolve(s)}loadKeyHTTP(e,t){const s=this.config,i=s.loader,r=new i(s);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((n,o)=>{const c={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=s.keyLoadPolicy.default,h={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(u,f,g,E)=>{const{frag:p,keyInfo:y}=g,T=zs(y.decryptdata);if(!p.decryptdata||y!==this.keyIdToKeyInfo[T])return o(this.createKeyLoadError(p,b.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),E));y.decryptdata.key=p.decryptdata.key=new Uint8Array(u.data),p.keyLoader=null,y.loader=null,n({frag:p,keyInfo:y})},onError:(u,f,g,E)=>{this.resetLoader(f),o(this.createKeyLoadError(t,b.KEY_LOAD_ERROR,new Error(`HTTP Error ${u.code} loading key ${u.text}`),g,se({url:c.url,data:void 0},u)))},onTimeout:(u,f,g)=>{this.resetLoader(f),o(this.createKeyLoadError(t,b.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),g))},onAbort:(u,f,g)=>{this.resetLoader(f),o(this.createKeyLoadError(t,b.INTERNAL_ABORTED,new Error("key loading aborted"),g))}};r.load(c,h,d)})}resetLoader(e){const{frag:t,keyInfo:s,url:i}=e,r=s.loader;t.keyLoader===r&&(t.keyLoader=null,s.loader=null);const n=zs(s.decryptdata)||i;delete this.keyIdToKeyInfo[n],r&&r.destroy()}}function zs(a){if(a.keyFormat!==Ee.FAIRPLAY){const e=a.keyId;if(e)return pe(e)}return a.uri}function mn(a){const{type:e}=a;switch(e){case Q.AUDIO_TRACK:return B.AUDIO;case Q.SUBTITLE_TRACK:return B.SUBTITLE;default:return B.MAIN}}function Qs(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class ku{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(m.MANIFEST_LOADING,this.onManifestLoading,this),e.on(m.LEVEL_LOADING,this.onLevelLoading,this),e.on(m.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(m.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(m.MANIFEST_LOADING,this.onManifestLoading,this),e.off(m.LEVEL_LOADING,this.onLevelLoading,this),e.off(m.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(m.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,s=t.pLoader,i=t.loader,r=s||i,n=new r(t);return this.loaders[e.type]=n,n}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:s}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Q.MANIFEST,url:s,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:s,level:i,pathwayId:r,url:n,deliveryDirectives:o,levelInfo:c}=t;this.load({id:s,level:i,pathwayId:r,responseType:"text",type:Q.LEVEL,url:n,deliveryDirectives:o,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:s,groupId:i,url:r,deliveryDirectives:n,track:o}=t;this.load({id:s,groupId:i,level:null,responseType:"text",type:Q.AUDIO_TRACK,url:r,deliveryDirectives:n,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:s,groupId:i,url:r,deliveryDirectives:n,track:o}=t;this.load({id:s,groupId:i,level:null,responseType:"text",type:Q.SUBTITLE_TRACK,url:r,deliveryDirectives:n,levelOrTrack:o})}onLevelsUpdated(e,t){const s=this.loaders[Q.LEVEL];if(s){const i=s.context;i&&!t.levels.some(r=>r===i.levelOrTrack)&&(s.abort(),delete this.loaders[Q.LEVEL])}}load(e){var t;const s=this.hls.config;let i=this.getInternalLoader(e);if(i){const l=this.hls.logger,h=i.context;if(h&&h.levelOrTrack===e.levelOrTrack&&(h.url===e.url||h.deliveryDirectives&&!e.deliveryDirectives)){h.url===e.url?l.log(`[playlist-loader]: ignore ${e.url} ongoing request`):l.log(`[playlist-loader]: ignore ${e.url} in favor of ${h.url}`);return}l.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let r;if(e.type===Q.MANIFEST?r=s.manifestLoadPolicy.default:r=re({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),M((t=e.deliveryDirectives)==null?void 0:t.part)){let l;if(e.type===Q.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===Q.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===Q.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){const h=l.partTarget,d=l.targetduration;if(h&&d){const u=Math.max(h*3,d*.8)*1e3;r=re({},r,{maxTimeToFirstByteMs:Math.min(u,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(u,r.maxTimeToFirstByteMs)})}}}const n=r.errorRetry||r.timeoutRetry||{},o={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:n.maxNumRetry||0,retryDelay:n.retryDelayMs||0,maxRetryDelay:n.maxRetryDelayMs||0},c={onSuccess:(l,h,d,u)=>{const f=this.getInternalLoader(d);this.resetInternalLoader(d.type);const g=l.data;h.parsing.start=performance.now(),Ve.isMediaPlaylist(g)||d.type!==Q.MANIFEST?this.handleTrackOrLevelPlaylist(l,h,d,u||null,f):this.handleMasterPlaylist(l,h,d,u)},onError:(l,h,d,u)=>{this.handleNetworkError(h,d,!1,l,u)},onTimeout:(l,h,d)=>{this.handleNetworkError(h,d,!0,void 0,l)}};i.load(e,o,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:s}=this.hls;(e||s)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,s,i){const r=this.hls,n=e.data,o=Qs(e,s),c=Ve.parseMasterPlaylist(n,o);if(c.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,s,c.playlistParsingError,i,t);return}const{contentSteering:l,levels:h,sessionData:d,sessionKeys:u,startTimeOffset:f,variableList:g}=c;this.variableList=g,h.forEach(T=>{const{unknownCodecs:v}=T;if(v){const{preferManagedMediaSource:S}=this.hls.config;let{audioCodec:x,videoCodec:D}=T;for(let A=v.length;A--;){const R=v[A];wt(R,"audio",S)?(T.audioCodec=x=x?`${x},${R}`:R,It.audio[x.substring(0,4)]=2,v.splice(A,1)):wt(R,"video",S)&&(T.videoCodec=D=D?`${D},${R}`:R,It.video[D.substring(0,4)]=2,v.splice(A,1))}}});const{AUDIO:E=[],SUBTITLES:p,"CLOSED-CAPTIONS":y}=Ve.parseMasterPlaylistMedia(n,o,c);E.length&&!E.some(v=>!v.url)&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new oe({}),bitrate:0,url:""})),r.trigger(m.MANIFEST_LOADED,{levels:h,audioTracks:E,subtitles:p,captions:y,contentSteering:l,url:o,stats:t,networkDetails:i,sessionData:d,sessionKeys:u,startTimeOffset:f,variableList:g})}handleTrackOrLevelPlaylist(e,t,s,i,r){const n=this.hls,{id:o,level:c,type:l}=s,h=Qs(e,s),d=M(c)?c:M(o)?o:0,u=mn(s),f=Ve.parseLevelPlaylist(e.data,h,d,u,0,this.variableList);if(l===Q.MANIFEST){const g={attrs:new oe({}),bitrate:0,details:f,name:"",url:h};f.requestScheduled=t.loading.start+jn(f,0),n.trigger(m.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:h,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),s.levelDetails=f,this.handlePlaylistLoaded(f,e,t,s,i,r)}handleManifestParsingError(e,t,s,i,r){this.hls.trigger(m.ERROR,{type:V.NETWORK_ERROR,details:b.MANIFEST_PARSING_ERROR,fatal:t.type===Q.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:t,networkDetails:i,stats:r})}handleNetworkError(e,t,s=!1,i,r){let n=`A network ${s?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===Q.LEVEL?n+=`: ${e.level} id: ${e.id}`:(e.type===Q.AUDIO_TRACK||e.type===Q.SUBTITLE_TRACK)&&(n+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(n);this.hls.logger.warn(`[playlist-loader]: ${n}`);let c=b.UNKNOWN,l=!1;const h=this.getInternalLoader(e);switch(e.type){case Q.MANIFEST:c=s?b.MANIFEST_LOAD_TIMEOUT:b.MANIFEST_LOAD_ERROR,l=!0;break;case Q.LEVEL:c=s?b.LEVEL_LOAD_TIMEOUT:b.LEVEL_LOAD_ERROR,l=!1;break;case Q.AUDIO_TRACK:c=s?b.AUDIO_TRACK_LOAD_TIMEOUT:b.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Q.SUBTITLE_TRACK:c=s?b.SUBTITLE_TRACK_LOAD_TIMEOUT:b.SUBTITLE_LOAD_ERROR,l=!1;break}h&&this.resetInternalLoader(e.type);const d={type:V.NETWORK_ERROR,details:c,fatal:l,url:e.url,loader:h,context:e,error:o,networkDetails:t,stats:r};if(i){const u=t?.url||e.url;d.response=se({url:u,data:void 0},i)}this.hls.trigger(m.ERROR,d)}handlePlaylistLoaded(e,t,s,i,r,n){const o=this.hls,{type:c,level:l,levelOrTrack:h,id:d,groupId:u,deliveryDirectives:f}=i,g=Qs(t,i),E=mn(i);let p=typeof i.level=="number"&&E===B.MAIN?l:void 0;const y=e.playlistParsingError;if(y){if(this.hls.logger.warn(`${y} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(m.ERROR,{type:V.NETWORK_ERROR,details:b.LEVEL_PARSING_ERROR,fatal:!1,url:g,error:y,reason:y.message,response:t,context:i,level:p,parent:E,networkDetails:r,stats:s});return}e.playlistParsingError=null}if(!e.fragments.length){const T=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(m.ERROR,{type:V.NETWORK_ERROR,details:b.LEVEL_EMPTY_ERROR,fatal:!1,url:g,error:T,reason:T.message,response:t,context:i,level:p,parent:E,networkDetails:r,stats:s});return}switch(e.live&&n&&(n.getCacheAge&&(e.ageHeader=n.getCacheAge()||0),(!n.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case Q.MANIFEST:case Q.LEVEL:if(p){if(!h)p=0;else if(h!==o.levels[p]){const T=o.levels.indexOf(h);T>-1&&(p=T)}}o.trigger(m.LEVEL_LOADED,{details:e,levelInfo:h||o.levels[0],level:p||0,id:d||0,stats:s,networkDetails:r,deliveryDirectives:f,withoutMultiVariant:c===Q.MANIFEST});break;case Q.AUDIO_TRACK:o.trigger(m.AUDIO_TRACK_LOADED,{details:e,track:h,id:d||0,groupId:u||"",stats:s,networkDetails:r,deliveryDirectives:f});break;case Q.SUBTITLE_TRACK:o.trigger(m.SUBTITLE_TRACK_LOADED,{details:e,track:h,id:d||0,groupId:u||"",stats:s,networkDetails:r,deliveryDirectives:f});break}}}class be{static get version(){return Mt}static isMSESupported(){return Wa()}static isSupported(){return bu()}static getMediaSource(){return st()}static get Events(){return m}static get MetadataSchema(){return Re}static get ErrorTypes(){return V}static get ErrorDetails(){return b}static get DefaultConfig(){return be.defaultConfig?be.defaultConfig:mu}static set DefaultConfig(e){be.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Di,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=Bo(e.debug||!1,"Hls instance",e.assetPlayerId),s=this.config=Eu(be.DefaultConfig,e,t);this.userConfig=e,s.progressive&&yu(s,t);const{abrController:i,bufferController:r,capLevelController:n,errorController:o,fpsController:c}=s,l=new o(this),h=this.abrController=new i(this),d=new wl(this),u=s.interstitialsController,f=u?this.interstitialsController=new u(this,be):null,g=this.bufferController=new r(this,d),E=this.capLevelController=new n(this),p=new c(this),y=new ku(this),T=s.contentSteeringController,v=T?new T(this):null,S=this.levelController=new Ru(this,v),x=new Iu(this),D=new Pu(this.config,this.logger),A=this.streamController=new Cu(this,d,D),R=this.gapController=new xu(this,d);E.setStreamController(A),p.setStreamController(A);const _=[y,S,A];f&&_.splice(1,0,f),v&&_.splice(1,0,v),this.networkControllers=_;const I=[h,g,R,E,p,x,d];this.audioTrackController=this.createController(s.audioTrackController,_);const P=s.audioStreamController;P&&_.push(this.audioStreamController=new P(this,d,D)),this.subtitleTrackController=this.createController(s.subtitleTrackController,_);const F=s.subtitleStreamController;F&&_.push(this.subtititleStreamController=new F(this,d,D)),this.createController(s.timelineController,I),D.emeController=this.emeController=this.createController(s.emeController,I),this.cmcdController=this.createController(s.cmcdController,I),this.latencyController=this.createController(Lu,I),this.coreComponents=I,_.push(l);const U=l.onErrorOut;typeof U=="function"&&this.on(m.ERROR,U,l),this.on(m.MANIFEST_LOADED,y.onManifestLoaded,y)}createController(e,t){if(e){const s=new e(this);return t&&t.push(s),s}return null}on(e,t,s=this){this._emitter.on(e,t,s)}once(e,t,s=this){this._emitter.once(e,t,s)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,s=this,i){this._emitter.off(e,t,s,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,s){return this._emitter.emit(e,t,s)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(s){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const i=e===m.ERROR;this.trigger(m.ERROR,{type:V.OTHER_ERROR,details:b.INTERNAL_EXCEPTION,fatal:i,event:e,error:s}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(m.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const r=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(m.ERROR,{type:V.OTHER_ERROR,details:b.ATTACH_MEDIA_ERROR,fatal:!0,error:r});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,s=t?e.media:e,i=t?e:{media:s};this._media=s,this.trigger(m.MEDIA_ATTACHING,i)}detachMedia(){this.logger.log("detachMedia"),this.trigger(m.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(m.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,s=this._url,i=this._url=yi.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${i}`),t&&s&&(s!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(m.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", ":"")})`),this.started=!0,this.resumeBuffering();for(let s=0;s{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[B.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[B.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[B.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=xd()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){El(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const s=e.length;for(let i=0;i=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:s}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,s)for(let r=i;r--;){const n=e[r].attrs["HDCP-LEVEL"];if(n&&n<=s)return r}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const s=kn(t);return Cn(e,s,navigator.mediaCapabilities)}}be.defaultConfig=void 0;var wu=oo('
          ',3);function Wu(a,e){to(e,!0);let t=Oe(e,"src",3,void 0),s=Oe(e,"muted",3,void 0),i=Oe(e,"playsinline",3,void 0),r=Oe(e,"preload",3,void 0),n=Oe(e,"autoplay",3,void 0),o=Oe(e,"controls",3,void 0),c=Oe(e,"currentTime",15,void 0),l=Oe(e,"duration",15,void 0),h=Oe(e,"paused",15,void 0),d=Oe(e,"node",15,void 0),u=Oe(e,"processingVideo",3,!1),f=ro(!1);function g(x,D,A){if(!(!x||!D)&&be.isSupported()&&!no(f)){const R=new be({maxBufferLength:1,maxMaxBufferLength:1,lowLatencyMode:!0});R.loadSource(x),R.attachMedia(A),R.on(be.Events.MANIFEST_PARSED,function(){A.play()}),R.on(be.Events.ERROR,function(_,I){if(console.error("HLS error:",_,I),I.fatal)switch(I.type){case be.ErrorTypes.NETWORK_ERROR:console.error("Fatal network error encountered, trying to recover"),R.startLoad();break;case be.ErrorTypes.MEDIA_ERROR:console.error("Fatal media error encountered, trying to recover"),R.recoverMediaError();break;default:console.error("Fatal error, cannot recover"),R.destroy();break}}),qi(f,!0)}}ji(()=>{t(),qi(f,!1)}),ji(()=>{d()&&t()&&e.is_stream&&g(t(),e.is_stream,d())});var E=wu(),p=Xi(E);let y;var T=ao(p,2);T.__click=()=>e.onclick?.(),T.__mouseover=()=>e.onmouseover?.(),T.__mouseout=()=>e.onmouseout?.();var v=co(T);{var S=x=>{var D=ho(),A=Xi(D);fo(A,()=>e.children),zi(x,D)};Xa(v,x=>{e.children&&x(S)})}uo(T),ss(()=>po(T,c)),ss(()=>mo("duration","durationchange",T,l)),ss(()=>Eo(T,h)),za(T,x=>d(x),()=>d()),go(T,(x,D)=>_o?.(x,D),()=>({autoplay:n()??!1})),so(()=>{y=Qa(p,1,"overlay svelte-17x1mvh",null,y,{hidden:!u()}),bs(T,"src",t()),T.muted=s(),T.playsInline=i(),bs(T,"preload",r()),T.autoplay=n(),T.controls=o(),T.loop=e.loop,bs(T,"data-testid",e["data-testid"])}),We("loadeddata",T,()=>e.onloadeddata?.()),We("play",T,()=>e.onplay?.()),We("pause",T,()=>e.onpause?.()),We("ended",T,()=>e.onended?.()),We("focus",T,()=>e.onfocus?.()),We("blur",T,()=>e.onblur?.()),We("error",T,()=>e.onerror?.("Video not playable")),We("loadstart",T,()=>e.onloadstart?.()),We("loadedmetadata",T,()=>e.onloadedmetadata?.()),zi(a,E),io()}lo(["click","mouseover","mouseout"]);export{Wu as V,Gu as a,Ku as b,_o as l,$u as p,Vu as t}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Video-emdvV6JL.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Video-emdvV6JL.css new file mode 100644 index 0000000000000000000000000000000000000000..5c50f110d7b9c192d45e0ae1e40bc3ede44c8f4c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Video-emdvV6JL.css @@ -0,0 +1 @@ +.overlay.svelte-17x1mvh{position:absolute;background-color:#0006;width:100%;height:100%}.hidden.svelte-17x1mvh{display:none}.load-wrap.svelte-17x1mvh{display:flex;justify-content:center;align-items:center;height:100%}.loader.svelte-17x1mvh{display:flex;position:relative;background-color:var(--border-color-accent-subdued);animation:svelte-17x1mvh-shadowPulse 2s linear infinite;box-shadow:-24px 0 var(--border-color-accent-subdued),24px 0 var(--border-color-accent-subdued);margin:var(--spacing-md);border-radius:50%;width:10px;height:10px;scale:.5}@keyframes svelte-17x1mvh-shadowPulse{33%{box-shadow:-24px 0 var(--border-color-accent-subdued),24px 0 #fff;background:#fff}66%{box-shadow:-24px 0 #fff,24px 0 #fff;background:var(--border-color-accent-subdued)}to{box-shadow:-24px 0 #fff,24px 0 var(--border-color-accent-subdued);background:#fff}} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/VideoPreview-CgLypBdz.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/VideoPreview-CgLypBdz.css new file mode 100644 index 0000000000000000000000000000000000000000..1a41716dc518af5f3c82cc9ea983bba7ff4dd07d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/VideoPreview-CgLypBdz.css @@ -0,0 +1 @@ +.load-wrap.svelte-mctcyk{display:flex;justify-content:center;align-items:center;height:100%}.loader.svelte-mctcyk{display:flex;position:relative;background-color:var(--border-color-accent-subdued);animation:svelte-mctcyk-shadowPulse 2s linear infinite;box-shadow:-24px 0 var(--border-color-accent-subdued),24px 0 var(--border-color-accent-subdued);margin:var(--spacing-md);border-radius:50%;width:10px;height:10px;scale:.5}@keyframes svelte-mctcyk-shadowPulse{33%{box-shadow:-24px 0 var(--border-color-accent-subdued),24px 0 #fff;background:#fff}66%{box-shadow:-24px 0 #fff,24px 0 #fff;background:var(--border-color-accent-subdued)}to{box-shadow:-24px 0 #fff,24px 0 var(--border-color-accent-subdued);background:#fff}}.container.svelte-mctcyk{display:flex;flex-direction:column;align-items:center;justify-content:center;margin:var(--spacing-lg) var(--spacing-lg) 0 var(--spacing-lg)}#timeline.svelte-mctcyk{display:flex;height:var(--size-10);flex:1;position:relative}img.svelte-mctcyk{flex:1 1 auto;min-width:0;object-fit:cover;height:var(--size-12);border:1px solid var(--block-border-color);user-select:none;z-index:1}.handle.svelte-mctcyk{width:3px;background-color:var(--color-accent);cursor:ew-resize;height:var(--size-12);z-index:3;position:absolute}.opaque-layer.svelte-mctcyk{background-color:#e6672840;border:1px solid var(--color-accent);height:var(--size-12);position:absolute;z-index:2}.container.svelte-1orxdv{width:100%}time.svelte-1orxdv{color:var(--color-accent);font-weight:700;padding-left:var(--spacing-xs)}.timeline-wrapper.svelte-1orxdv{display:flex;align-items:center;justify-content:center;width:100%}.text-button.svelte-1orxdv{border:1px solid var(--neutral-400);border-radius:var(--radius-sm);font-weight:300;font-size:var(--size-3);text-align:center;color:var(--neutral-400);height:var(--size-5);font-weight:700;padding:0 5px;margin-left:5px}.text-button.svelte-1orxdv:hover,.text-button.svelte-1orxdv:focus{color:var(--color-accent);border-color:var(--color-accent)}.controls.svelte-1orxdv{display:flex;justify-content:space-between;align-items:center;margin:var(--spacing-lg);overflow:hidden}.edit-buttons.svelte-1orxdv{display:flex;gap:var(--spacing-sm)}@media(max-width:320px){.controls.svelte-1orxdv{flex-direction:column;align-items:flex-start}.edit-buttons.svelte-1orxdv{margin-top:var(--spacing-sm)}.controls.svelte-1orxdv :where(.svelte-1orxdv){margin:var(--spacing-sm)}.controls.svelte-1orxdv .text-button:where(.svelte-1orxdv){margin-left:0}}.container.svelte-1orxdv{display:flex;flex-direction:column}.hidden.svelte-1orxdv{display:none}.volume-slider.svelte-h4x5cd{-webkit-appearance:none;appearance:none;width:var(--size-20);accent-color:var(--color-accent);height:4px;cursor:pointer;outline:none;border-radius:15px;background-color:#ffffff4d;margin-left:var(--spacing-sm)}input[type=range].svelte-h4x5cd::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;height:15px;width:15px;background-color:#fff;border-radius:50%;border:none;transition:.2s ease-in-out}input[type=range].svelte-h4x5cd::-moz-range-thumb{height:15px;width:15px;background-color:#fff;border-radius:50%;border:none;transition:.2s ease-in-out}span.svelte-1k28h7x{text-shadow:0 0 8px rgba(0,0,0,.5)}progress.svelte-1k28h7x{margin-right:var(--size-3);border-radius:var(--radius-sm);width:var(--size-full);height:var(--size-2)}progress.svelte-1k28h7x::-webkit-progress-bar{border-radius:2px;background-color:#fff3;overflow:hidden}progress.svelte-1k28h7x::-webkit-progress-value{background-color:#ffffffe6}.mirror.svelte-1k28h7x{transform:scaleX(-1)}.mirror-wrap.svelte-1k28h7x{position:relative;height:100%;width:100%}.controls.svelte-1k28h7x{position:absolute;bottom:0;opacity:0;transition:.5s;margin:var(--size-2);border-radius:var(--radius-md);background:var(--color-grey-800);padding:var(--size-2) var(--size-1);width:calc(100% - .75rem);width:calc(100% - var(--size-2) * 2);z-index:10}.wrap.svelte-1k28h7x:hover .controls:where(.svelte-1k28h7x){opacity:1}:fullscreen .controls.svelte-1k28h7x{display:none}.inner.svelte-1k28h7x{display:flex;justify-content:space-between;align-items:center;padding-right:var(--size-2);padding-left:var(--size-2);width:var(--size-full);height:var(--size-full)}.icon.svelte-1k28h7x{display:flex;justify-content:center;cursor:pointer;width:var(--size-6);color:#fff}.volume-control-wrapper.svelte-1k28h7x{position:relative;display:flex;align-items:center;margin-right:var(--spacing-md)}.volume-button.svelte-1k28h7x{display:flex;justify-content:center;align-items:center;cursor:pointer;width:var(--size-6);color:#fff;border:none;background:none;padding:0}.time.svelte-1k28h7x{flex-shrink:0;margin-right:var(--size-3);margin-left:var(--size-3);color:#fff;font-size:var(--text-sm);font-family:var(--font-mono)}.wrap.svelte-1k28h7x{position:relative;background-color:var(--background-fill-secondary);height:var(--size-full);width:var(--size-full);border-radius:var(--radius-xl)}.wrap.svelte-1k28h7x video{height:var(--size-full);width:var(--size-full)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/VideoPreview-DskP-c1w.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/VideoPreview-DskP-c1w.js new file mode 100644 index 0000000000000000000000000000000000000000..00db48a26cc01c1198b6c6ba76ed3cd90a4ada82 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/VideoPreview-DskP-c1w.js @@ -0,0 +1 @@ +import{p as l,i as H,k as Fe,a as _e,u as He,f as ue,b as oe,t as je,d as Ue,F as xe}from"./i18n-Dnhn5Rxr.js";import{aj as ve,R as se,u as y,v as Oe,y as N,w as e,aa as ie,ae as Ee,V as P,Y as D,a as M,T as de,a5 as J,x as d,X as V,t as ee,Z as fe,W as R,S as Q,a0 as Te,a6 as ze,au as We,M as qe}from"./index-DWyDLubb.js";import{k as Ne}from"./key-Xd_8JrI4.js";import{I as ge,V as ke}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as Ye}from"./BlockLabel-CZd21Hkw.js";import{D as Ze}from"./DownloadLink-TGTaev7f.js";import{E as Ge}from"./Empty-BIB2W5at.js";import{S as Je}from"./ShareButton-wCSP7LoP.js";import{D as Ke}from"./Download-Di2PsS6O.js";import{I as Qe}from"./IconButtonWrapper-D0s9l4wW.js";import{f as he,u as $e}from"./utils.svelte-CCyS_0CY.js";import{M as et}from"./Maximize-QH9NIRWs.js";import{T as tt,V as at,P as rt}from"./VolumeLevels-jRkFzCUK.js";import{P as nt}from"./Play-BxqeM8KI.js";import{U as pe}from"./Undo-C2-jWGVL.js";import{b as lt,t as ot,V as it}from"./Video-B_oD6cFy.js";import"./Upload-HitvyI7k.js";import{M as st}from"./ModifyUpload-CIJNunwR.js";var dt=R('
          '),ut=R(''),vt=R('
          '),ct=R('
          ');function mt(Y,t){se(t,!0);let r=l(t,"videoElement",7),O=l(t,"trimmedDuration",15,null),j=l(t,"dragStart",15,0),g=l(t,"dragEnd",15,0),w=l(t,"loadingTimeline",15,!1),k=y(Oe([])),Z=10,X,x=y(0),E=y(100),h=y(null);const S=i=>{d(h,i,!0)};let T=J(()=>e(k).length!==Z);N(()=>{w(e(T))});const _=()=>{d(h,null)},F=(i,v)=>{if(e(h)){const b=document.getElementById("timeline");if(!b)return;const L=b.getBoundingClientRect();let u=(i.clientX-L.left)/L.width*100;if(v?u=e(h)==="left"?e(x)+v:e(E)+v:u=(i.clientX-L.left)/L.width*100,u=Math.max(0,Math.min(u,100)),e(h)==="left"){d(x,Math.min(u,e(E)),!0);const s=e(x)/100*X;r().currentTime=s,j(s)}else if(e(h)==="right"){d(E,Math.max(u,e(x)),!0);const s=e(E)/100*X;r().currentTime=s,g(s)}const f=e(x)/100*X,c=e(E)/100*X;O(c-f),d(x,e(x),!0),d(E,e(E),!0)}},a=i=>{if(e(h)){const v=1/X*100;i.key==="ArrowLeft"?F({clientX:0},-v):i.key==="ArrowRight"&&F({clientX:0},v)}},I=()=>{const i=document.createElement("canvas"),v=i.getContext("2d");if(!v)return;i.width=r().videoWidth,i.height=r().videoHeight,v.drawImage(r(),0,0,i.width,i.height);const b=i.toDataURL("image/jpeg",.7);d(k,[...e(k),b],!0)};ie(()=>{const i=()=>{X=r().duration;const v=X/Z;let b=0;const L=()=>{I(),b++,b=1?i():r().addEventListener("loadedmetadata",i)}),Ee(()=>{window.removeEventListener("mousemove",F),window.removeEventListener("mouseup",_),window.removeEventListener("keydown",a)}),ie(()=>{window.addEventListener("mousemove",F),window.addEventListener("mouseup",_),window.addEventListener("keydown",a)});var p=ct(),A=P(p);{var U=i=>{var v=dt();M(i,v)},z=i=>{var v=vt(),b=P(v);b.__mousedown=()=>S("left"),b.__keydown=c=>{(c.key==="ArrowLeft"||c.key=="ArrowRight")&&S("left")};var L=V(b,2),u=V(L,2);Fe(u,17,()=>e(k),He,(c,s,m)=>{var B=ut();_e(B,"alt",`frame-${m}`),ee(()=>_e(B,"src",e(s))),M(c,B)});var f=V(u,2);f.__mousedown=()=>S("right"),f.__keydown=c=>{(c.key==="ArrowLeft"||c.key=="ArrowRight")&&S("right")},D(v),ee(()=>{ue(b,`left: ${e(x)??""}%;`),ue(L,`left: ${e(x)??""}%; right: ${100-e(E)}%`),ue(f,`left: ${e(E)??""}%;`)}),fe("blur",b,_),fe("blur",f,_),M(i,v)};H(A,i=>{e(T)?i(U):i(z,!1)})}D(p),M(Y,p),de()}ve(["mousedown","keydown"]);var _t=R('
          '),ft=R('
          ',1),gt=R('
          '),ht=R(" ",1),bt=R('
          ',1);function wt(Y,t){se(t,!0);let r=l(t,"videoElement",3,void 0),O=l(t,"showRedo",3,!1),j=l(t,"interactive",3,!0),g=l(t,"mode",15,""),w=l(t,"processingVideo",15,!1),k=l(t,"value",3,null),Z=l(t,"show_download_button",3,!1),X=l(t,"handle_clear",3,()=>{}),x=l(t,"has_change_history",3,!1),E;ie(async()=>{E=await lt()}),N(()=>{g()==="edit"&&e(h)===null&&r()&&d(h,r().duration,!0)});let h=y(null),S=y(0),T=y(0),_=y(!1);const F=()=>{g()==="edit"?(g(""),r()&&d(h,r().duration,!0)):g("edit")};var a=bt(),I=Q(a);let p;var A=P(I);{var U=u=>{var f=_t(),c=P(f);mt(c,{get videoElement(){return r()},get dragStart(){return e(S)},set dragStart(s){d(S,s,!0)},get dragEnd(){return e(T)},set dragEnd(s){d(T,s,!0)},get trimmedDuration(){return e(h)},set trimmedDuration(s){d(h,s,!0)},get loadingTimeline(){return e(_)},set loadingTimeline(s){d(_,s,!0)}}),D(f),M(u,f)};H(A,u=>{g()==="edit"&&r()&&u(U)})}var z=V(A,2),i=P(z);{var v=u=>{var f=ft(),c=Q(f);let s;var m=P(c,!0);D(c);var B=V(c,2),q=P(B);let G;q.__click=()=>{r()&&(g(""),w(!0),ot(E,e(S),e(T),r()).then(ae=>{t.handle_trim_video(ae)}).then(()=>{w(!1)}))};var C=V(q,2);let $;C.__click=F,D(B),ee(ae=>{s=oe(c,1,"svelte-1orxdv",null,s,{hidden:e(_)}),Te(m,ae),G=oe(q,1,"text-button svelte-1orxdv",null,G,{hidden:e(_)}),$=oe(C,1,"text-button svelte-1orxdv",null,$,{hidden:e(_)})},[()=>he(e(h))]),M(u,f)},b=u=>{var f=gt();M(u,f)};H(i,u=>{g()==="edit"&&e(h)!==null?u(v):u(b,!1)})}D(z),D(I);var L=V(I,2);{let u=J(()=>Z()?k()?.url:null);st(L,{get i18n(){return t.i18n},onclear:()=>X()(),get download(){return e(u)},children:(f,c)=>{var s=ht(),m=Q(s);{var B=C=>{{let $=J(()=>w()||!x());ge(C,{get Icon(){return pe},label:"Reset video to initial value",get disabled(){return e($)},onclick:()=>{t.handle_reset_value(),g("")}})}};H(m,C=>{O()&&g()===""&&C(B)})}var q=V(m,2);{var G=C=>{ge(C,{get Icon(){return tt},label:"Trim video to selection",get disabled(){return w()},onclick:F})};H(q,C=>{j()&&g()===""&&C(G)})}M(f,s)},$$slots:{default:!0}})}ee(()=>p=oe(I,1,"container svelte-1orxdv",null,p,{hidden:g()!=="edit"})),M(Y,a),de()}ve(["click"]);var yt=R('');function kt(Y,t){se(t,!0);let r=l(t,"current_volume",15,1),O=l(t,"show_volume_slider",15,!1),j=y(void 0);ie(()=>{g()});const g=()=>{let k=e(j);k&&(k.style.background=`linear-gradient(to right, white ${r()*100}%, rgba(255, 255, 255, 0.3) ${r()*100}%)`)};N(()=>{r(),g()});var w=yt();je(w),w.__focusout=()=>O(!1),w.__input=k=>{k.target instanceof HTMLInputElement&&r(parseFloat(k.target.value))},Ue(w,k=>d(j,k),()=>e(j)),ee(()=>xe(w,r())),M(Y,w),de()}ve(["focusout","input"]);var xt=R(''),Et=R('
          '),Tt=R('
          ',1);function pt(Y,t){se(t,!0);let r=l(t,"root",3,""),O=l(t,"subtitle",3,null),j=l(t,"label",3,"test"),g=l(t,"interactive",3,!1),w=l(t,"handle_change",3,()=>{}),k=l(t,"handle_reset_value",3,()=>{}),Z=l(t,"is_stream",3,void 0),X=l(t,"show_download_button",3,!1),x=l(t,"value",3,null),E=l(t,"handle_clear",3,()=>{}),h=l(t,"has_change_history",3,!1),S=l(t,"playback_position",15),T=y(0),_=y(0),F=y(!0),a=y(void 0),I=y(!1),p=y(!1),A=y(1),U=y(!1);function z(n){if(!e(_))return;if(n.type==="click"){v(n);return}if(n.type!=="touchmove"&&!(n.buttons&1))return;const o=n.type==="touchmove"?n.touches[0].clientX:n.clientX,{left:W,right:K}=n.currentTarget.getBoundingClientRect();d(T,e(_)*(o-W)/(K-W))}async function i(){e(a)&&document.fullscreenElement!=e(a)&&(e(a).currentTime>0&&!e(a).paused&&!e(a).ended&&e(a).readyState>e(a).HAVE_CURRENT_DATA?e(a).pause():await e(a).play())}function v(n){if(!e(_))return;const{left:o,right:W}=n.currentTarget.getBoundingClientRect();d(T,e(_)*(n.clientX-o)/(W-o))}function b(){t.onstop?.(),t.onend?.()}const L=async n=>{let o=new File([n],"video.mp4");const W=await We([o]);let K=(await t.upload(W,r()))?.filter(Boolean)[0];w()(K)};function u(){e(a)&&(e(U)?document.exitFullscreen():e(a).requestFullscreen())}function f(){d(U,document.fullscreenElement===e(a)),e(a)&&(e(a).controls=e(U))}let c=1,s;const m=.001;function B(){e(a)&&Math.abs(e(a).volume-c)>m&&(d(A,e(a).volume,!0),c=e(a).volume)}ie(()=>(document.addEventListener("fullscreenchange",f),()=>{document.removeEventListener("fullscreenchange",f)})),Ee(()=>{e(a)&&e(a).removeEventListener("volumechange",B)}),N(()=>{e(a)&&e(a)!==s&&(s&&s.removeEventListener("volumechange",B),e(a).addEventListener("volumechange",B),s=e(a))}),N(()=>{S(e(T))}),N(()=>{S()!==e(T)&&e(a)&&(e(a).currentTime=S())}),N(()=>{e(a)&&!e(U)&&(Math.abs(e(a).volume-e(A))>m&&(e(a).volume=e(A),c=e(A)),e(a).controls=!1)}),N(()=>{e(a)&&e(U)&&(c=e(a).volume)});var q=Tt(),G=Q(q),C=P(G);let $;var ae=P(C);{let n=J(()=>`${j()}-player`);it(ae,{get src(){return t.src},preload:"auto",get autoplay(){return t.autoplay},get loop(){return t.loop},get is_stream(){return Z()},get controls(){return e(U)},onclick:i,onplay:()=>t.onplay?.(),onpause:()=>t.onpause?.(),onerror:o=>t.onerror?.(o),onended:b,get"data-testid"(){return e(n)},get processingVideo(){return e(I)},onloadstart:()=>t.onloadstart?.(),onloadeddata:()=>t.onloadeddata?.(),onloadedmetadata:()=>t.onloadedmetadata?.(),get currentTime(){return e(T)},set currentTime(o){d(T,o,!0)},get duration(){return e(_)},set duration(o){d(_,o,!0)},get paused(){return e(F)},set paused(o){d(F,o,!0)},get node(){return e(a)},set node(o){d(a,o,!0)},children:(o,W)=>{var K=xt();ee(()=>_e(K,"src",O())),M(o,K)},$$slots:{default:!0}})}D(C);var be=V(C,2),we=P(be),re=P(we);re.__click=i,re.__keydown=i;var Ve=P(re);{var Le=n=>{pe(n)},Pe=n=>{var o=ze(),W=Q(o);{var K=te=>{nt(te)},Xe=te=>{rt(te)};H(W,te=>{e(F)?te(K):te(Xe,!1)},!0)}M(n,o)};H(Ve,n=>{e(T)===e(_)?n(Le):n(Pe,!1)})}D(re);var ce=V(re,2),De=P(ce);D(ce);var ne=V(ce,2);ne.__mousemove=z,ne.__touchmove=n=>{n.preventDefault(),z(n)},ne.__click=n=>{n.stopPropagation(),n.preventDefault(),v(n)};var me=V(ne,2),le=P(me);le.__click=()=>d(p,!e(p));let ye;var Me=P(le);at(Me,{get currentVolume(){return e(A)}}),D(le);var Re=V(le,2);{var Se=n=>{kt(n,{get current_volume(){return e(A)},set current_volume(o){d(A,o,!0)},get show_volume_slider(){return e(p)},set show_volume_slider(o){d(p,o,!0)}})};H(Re,n=>{e(p)&&n(Se)})}D(me);var Ie=V(me,2);{var Ae=n=>{var o=Et();o.__click=u;var W=P(o);et(W),D(o),fe("keypress",o,u),M(n,o)};H(Ie,n=>{e(p)||n(Ae)})}D(we),D(be),D(G);var Be=V(G,2);{var Ce=n=>{wt(n,{get videoElement(){return e(a)},showRedo:!0,handle_trim_video:L,get handle_reset_value(){return k()},get value(){return x()},get i18n(){return t.i18n},get show_download_button(){return X()},get handle_clear(){return E()},get has_change_history(){return h()},get processingVideo(){return e(I)},set processingVideo(o){d(I,o,!0)}})};H(Be,n=>{g()&&n(Ce)})}ee((n,o)=>{$=oe(C,1,"mirror-wrap svelte-1k28h7x",null,$,{mirror:t.mirror}),Te(De,`${n??""} / ${o??""}`),xe(ne,e(T)/e(_)||0),ye=ue(le,"",ye,{color:e(p)?"var(--color-accent)":"white"})},[()=>he(e(T)),()=>he(e(_))]),M(Y,q),de()}ve(["click","keydown","mousemove","touchmove"]);var Vt=R(" ",1),Lt=R('
          ',1),Pt=R(" ",1);function Dt(Y,t){se(t,!0);let r=l(t,"value",15,null),O=l(t,"subtitle",3,null),j=l(t,"label",3,void 0),g=l(t,"show_label",3,!0),w=l(t,"buttons",3,null),k=l(t,"on_custom_button_click",3,null),Z=l(t,"display_icon_button_wrapper_top_corner",3,!1),X=l(t,"playback_position",15),x=y(null),E=y(null);N(()=>{r()&&t.onchange?.(r())}),N(()=>{async function a(){r()!==e(x)&&O()!==e(E)&&e(E)!==null&&(d(x,r(),!0),r(null),await qe(),r(e(x))),d(x,r(),!0),d(E,O())}a()});var h=Pt(),S=Q(h);{let a=J(()=>j()||"Video");Ye(S,{get show_label(){return g()},get Icon(){return ke},get label(){return e(a)}})}var T=V(S,2);{var _=a=>{Ge(a,{unpadded_box:!0,size:"large",children:(I,p)=>{ke(I)},$$slots:{default:!0}})},F=a=>{var I=Lt(),p=Q(I);Ne(p,()=>r().url,z=>{{let i=J(()=>O()?.url);pt(z,{get src(){return r().url},get subtitle(){return e(i)},get is_stream(){return r().is_stream},get autoplay(){return t.autoplay},onplay:()=>t.onplay?.(),onpause:()=>t.onpause?.(),onstop:()=>t.onstop?.(),onend:()=>t.onend?.(),onloadedmetadata:()=>{t.onload?.()},mirror:!1,get label(){return j()},get loop(){return t.loop},interactive:!1,get upload(){return t.upload},get i18n(){return t.i18n},get playback_position(){return X()},set playback_position(v){X(v)}})}});var A=V(p,2),U=P(A);{let z=J(()=>w()??["download","share"]);Qe(U,{get display_top_corner(){return Z()},get buttons(){return e(z)},get on_custom_button_click(){return k()},children:(i,v)=>{var b=Vt(),L=Q(b);{var u=s=>{{let m=J(()=>r().is_stream?r().url?.replace("playlist.m3u8","playlist-file"):r().url),B=J(()=>r().orig_name||r().path);Ze(s,{get href(){return e(m)},get download(){return e(B)},children:(q,G)=>{ge(q,{get Icon(){return Ke},label:"Download"})},$$slots:{default:!0}})}};H(L,s=>{w()?.some(m=>typeof m=="string"&&m==="download")&&s(u)})}var f=V(L,2);{var c=s=>{Je(s,{get i18n(){return t.i18n},onerror:m=>t.onerror?.(m),onshare:m=>t.onshare?.(m),get value(){return r()},formatter:async m=>m?await $e(m.data):""})};H(f,s=>{w()?.some(m=>typeof m=="string"&&m==="share")&&s(c)})}M(i,b)},$$slots:{default:!0}})}D(A),M(a,I)};H(T,a=>{!r()||r().url===void 0?a(_):a(F,!1)})}M(Y,h),de()}const Zt=Object.freeze(Object.defineProperty({__proto__:null,default:Dt},Symbol.toStringTag,{value:"Module"}));export{pt as P,Dt as V,Zt as a}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/VolumeLevels-jRkFzCUK.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/VolumeLevels-jRkFzCUK.js new file mode 100644 index 0000000000000000000000000000000000000000..2ddc206026fc84c7fe04a9f6f5e0dd0627802a24 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/VolumeLevels-jRkFzCUK.js @@ -0,0 +1 @@ +import{i as s}from"./i18n-Dnhn5Rxr.js";import{a as e,f as l,a6 as a,S as h}from"./index-DWyDLubb.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";var x=l('');function T(r){var t=x();e(r,t)}var V=l('');function b(r){var t=V();e(r,t)}var L=l('Low volume');function M(r){var t=L();e(r,t)}var _=l('High volume');function y(r){var t=_();e(r,t)}var H=l('Muted volume');function j(r){var t=H();e(r,t)}function S(r,t){var c=a(),d=h(c);{var u=o=>{j(o)},g=o=>{var v=a(),p=h(v);{var C=i=>{M(i)},f=i=>{var w=a(),k=h(w);{var m=n=>{y(n)};s(k,n=>{t.currentVolume>=.5&&n(m)},!0)}e(i,w)};s(p,i=>{t.currentVolume<.5?i(C):i(f,!1)},!0)}e(o,v)};s(d,o=>{t.currentVolume==0?o(u):o(g,!1)})}e(r,c)}export{T as P,b as T,S as V}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Walkthrough-CA8p9s2e.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Walkthrough-CA8p9s2e.css new file mode 100644 index 0000000000000000000000000000000000000000..5c23488c1d2c4377d91882fc015e39b839b92182 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Walkthrough-CA8p9s2e.css @@ -0,0 +1 @@ +.tabs.svelte-11gaq1{position:relative;flex-direction:column}.hide.svelte-11gaq1{display:none}.hidden.svelte-11gaq1{display:none!important}.tab-wrapper.svelte-11gaq1{display:flex;align-items:center;justify-content:space-between;position:relative;height:var(--size-8);padding-bottom:var(--size-2);margin-bottom:var(--layout-gap)}.tab-container.svelte-11gaq1{display:flex;align-items:center;width:100%;position:relative;overflow:hidden;height:var(--size-8)}.tab-container.svelte-11gaq1:after{content:"";position:absolute;bottom:0;left:0;right:0;height:1px;background-color:var(--border-color-primary)}.overflow-menu.svelte-11gaq1{flex-shrink:0;margin-left:var(--size-2)}button.svelte-11gaq1{margin-bottom:0;border:none;border-radius:0;padding:0 var(--size-4);color:var(--body-text-color);font-weight:var(--section-header-text-weight);font-size:var(--section-header-text-size);transition:background-color color .2s ease-out;background-color:transparent;height:100%;display:flex;align-items:center;white-space:nowrap;position:relative}button.svelte-11gaq1:disabled{opacity:.5;cursor:not-allowed}button.svelte-11gaq1:hover:not(:disabled):not(.selected){background-color:var(--background-fill-secondary);color:var(--body-text-color)}.selected.svelte-11gaq1{background-color:transparent;color:var(--color-accent);position:relative}.selected.svelte-11gaq1:after{content:"";position:absolute;bottom:0;left:0;width:100%;height:2px;background-color:var(--color-accent);animation:svelte-11gaq1-fade-grow .2s ease-out forwards;transform-origin:center;z-index:1}@keyframes svelte-11gaq1-fade-grow{0%{opacity:0;transform:scaleX(.8)}to{opacity:1;transform:scaleX(1)}}.overflow-dropdown.svelte-11gaq1{position:absolute;top:calc(100% + var(--size-2));right:0;background-color:var(--background-fill-primary);border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);z-index:var(--layer-5);box-shadow:0 2px 5px #0000001a;padding:var(--size-2);min-width:150px;width:max-content}.overflow-dropdown.svelte-11gaq1 button:where(.svelte-11gaq1){display:block;width:100%;text-align:left;padding:var(--size-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.overflow-menu.svelte-11gaq1>button:where(.svelte-11gaq1){padding:var(--size-1) var(--size-2);min-width:auto;border:1px solid var(--border-color-primary);border-radius:var(--radius-sm);display:flex;align-items:center;justify-content:center}.overflow-menu.svelte-11gaq1>button:where(.svelte-11gaq1):hover{background-color:var(--background-fill-secondary)}.overflow-menu.svelte-11gaq1 svg{width:16px;height:16px}.overflow-item-selected.svelte-11gaq1 svg{color:var(--color-accent)}.visually-hidden.svelte-11gaq1{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.stepper.svelte-1xpzbgb{position:relative;display:flex;flex-direction:column;gap:var(--layout-gap)}.compact.stepper.svelte-1xpzbgb{gap:0}.hide.svelte-1xpzbgb{display:none}.stepper-wrapper.svelte-1xpzbgb{display:flex;align-items:center;position:relative;padding-top:var(--size-4);padding-bottom:calc(var(--label-height) + var(--size-4))}.compact.svelte-1xpzbgb .stepper-wrapper:where(.svelte-1xpzbgb){padding-top:var(--size-2);padding-bottom:var(--size-6)}.stepper-container.svelte-1xpzbgb{display:flex;justify-content:space-between;align-items:flex-start;width:100%;position:relative;padding:var(--size-2);gap:var(--size-1)}.compact.svelte-1xpzbgb .stepper-container:where(.svelte-1xpzbgb){justify-content:center;gap:2px;padding:0}.step-item.svelte-1xpzbgb{display:flex;align-items:center;justify-content:center;flex:1 1 0;position:relative}.compact.svelte-1xpzbgb .step-item:where(.svelte-1xpzbgb){width:100%}.step-button.svelte-1xpzbgb{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--size-1);border:none;background:transparent;cursor:pointer;border-radius:var(--radius-md);transition:background-color .2s ease;font-size:var(--text-sm);color:var(--body-text-color-subdued);white-space:nowrap;z-index:1;position:relative}.compact.svelte-1xpzbgb .step-button:where(.svelte-1xpzbgb){padding:0;width:100%;border:none}.compact.svelte-1xpzbgb .step-number:where(.svelte-1xpzbgb){height:10px;width:100%;border-radius:0;border:none}.step-button.svelte-1xpzbgb:hover:not(:disabled){background-color:var(--background-fill-secondary)}.step-button.svelte-1xpzbgb:disabled{cursor:not-allowed;opacity:.5}.step-button.active.svelte-1xpzbgb,.step-button.completed.svelte-1xpzbgb{color:var(--body-text-color)}.step-button.pending.svelte-1xpzbgb{color:var(--body-text-color-subdued)}.step-number.svelte-1xpzbgb{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;font-size:var(--text-sm);font-weight:var(--weight-semibold);transition:background-color .2s ease;flex-shrink:0}.active.svelte-1xpzbgb .step-number:where(.svelte-1xpzbgb){background-color:var(--color-accent);color:#fff;box-shadow:0 0 0 4px rgba(var(--color-accent-rgb),.1)}.completed.svelte-1xpzbgb .step-number:where(.svelte-1xpzbgb){background-color:var(--color-accent);color:#fff}.compact.svelte-1xpzbgb .completed:where(.svelte-1xpzbgb) .step-number:where(.svelte-1xpzbgb){color:transparent}.compact.svelte-1xpzbgb .pending:where(.svelte-1xpzbgb) .step-number:where(.svelte-1xpzbgb){color:transparent;background-color:var(--body-text-color-subdued)}.compact.svelte-1xpzbgb .active:where(.svelte-1xpzbgb) .step-number:where(.svelte-1xpzbgb){color:transparent}.pending.svelte-1xpzbgb .step-number:where(.svelte-1xpzbgb){background-color:var(--button-secondary-background-fill);color:var(--button-secondary-text-color)}.compact.svelte-1xpzbgb .step-item:where(.svelte-1xpzbgb):last-child .step-number:where(.svelte-1xpzbgb){border-top-right-radius:var(--radius-xs);border-bottom-right-radius:var(--radius-xs)}.compact.svelte-1xpzbgb .step-item:where(.svelte-1xpzbgb):first-child .step-number:where(.svelte-1xpzbgb){border-top-left-radius:var(--radius-xs);border-bottom-left-radius:var(--radius-xs)}.step-label.svelte-1xpzbgb{font-size:var(--text-md);line-height:1.2;text-align:center;max-width:120px;position:absolute;bottom:-20px;display:none}.step-label.visible.svelte-1xpzbgb{display:block}.step-connector.svelte-1xpzbgb{width:100%;height:2px;background-color:var(--border-color-primary);transition:background-color .3s ease;z-index:0;transform:translateY(15px)}.step-connector.completed.svelte-1xpzbgb{background-color:var(--color-accent)}.dark .pending.svelte-1xpzbgb .step-number:where(.svelte-1xpzbgb){background-color:var(--neutral-800);color:var(--neutral-400);border-color:var(--neutral-600)}.dark .step-connector.svelte-1xpzbgb{background-color:var(--neutral-600)} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Walkthrough.svelte_svelte_type_style_lang-Bw7iC7Yg.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Walkthrough.svelte_svelte_type_style_lang-Bw7iC7Yg.js new file mode 100644 index 0000000000000000000000000000000000000000..8ebc35981eed6bf0c242c5909fdf0c96547cebff --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Walkthrough.svelte_svelte_type_style_lang-Bw7iC7Yg.js @@ -0,0 +1 @@ +import{p as M,w as Re,e as $e,i as H,s as Ae,b as B,a as O,f as Fe,q as Te,m as Me,x as P,k as oe,d as ce,u as de}from"./i18n-Dnhn5Rxr.js";import{a as h,f as Pe,R as je,a3 as f,w as e,a4 as De,aa as Ge,ax as Le,a1 as z,G as ve,a2 as Ne,Z as j,t as D,z as o,T as Ue,U as G,X as J,W as L,as as K,aw as Ce,M as Xe,x as d,V as k,a6 as _e,S as fe,Y as b,a0 as be}from"./index-DWyDLubb.js";import{s as Ye}from"./event-modifiers-CdEA5IGF.js";var Ze=Pe('');function He(Q){var u=Ze();h(Q,u)}const Je={};var Ke=L(''),Qe=L(''),ea=L(""),aa=L('
          '),sa=L("
          ");function na(Q,u){je(u,!1);const v=()=>Te(V,"$selected_tab",ue),ee=()=>Te(Y,"$selected_tab_index",ue),[ue,Ee]=Me(),me=f(),ge=f();let N=M(u,"visible",12,!0),ae=M(u,"elem_id",12,""),U=M(u,"elem_classes",28,()=>[]),w=M(u,"selected",12),R=M(u,"initial_tabs",12),l=f([...R()]),he=f([...R()]),I=f([]),T=f(!1),X=f(),se=new Set;function Se(a){for(let t=0;ta?.id===w())||0),te=De();let we=f(!1),le=f(!1),C=f({});Ge(()=>{if(!e(p))return;const a=new ResizeObserver(()=>{ne()});return a.observe(e(p)),()=>a.disconnect()}),Le(Je,{register_tab:(a,t)=>(se.add(t),K(l,e(l)[t]=a),v()===!1&&a.visible!==!1&&a.interactive&&(P(V,a.id),P(Y,t)),t),unregister_tab:(a,t)=>{se.delete(t),v()===a.id&&P(V,e(l)[0]?.id||!1),K(l,e(l)[t]=null)},selected_tab:V,selected_tab_index:Y});function ie(a){const t=e(l).find(_=>_?.id===a);a!==void 0&&t&&t.interactive&&t.visible!==!1&&v()!==t.id&&(w(a),P(V,a),P(Y,e(l).findIndex(_=>_?.id===a)),te("change"),d(T,!1))}function Be(a){e(T)&&e(X)&&!e(X).contains(a.target)&&d(T,!1)}const Oe=48;async function ne(){if(!e(p))return;await Xe(),await new Promise(n=>requestAnimationFrame(n));const a=e(p).clientWidth;let t=0,_=e(l).length;for(let n=0;n$&&$.visible!==!1&&$.visible!=="hidden")?a-Oe:a;if(t>Z){_=n;break}}d(he,e(l).slice(0,_)),d(I,e(l).slice(_)),d(le,pe(v())),d(we,e(I).filter(n=>n&&n.visible!==!1).length>0)}function pe(a){return a===!1?!1:e(I).some(t=>t?.id===a)}z(()=>ve(R()),()=>{Se(R())}),z(()=>e(l),()=>{d(me,e(l).length>0)}),z(()=>(e(l),ve(w())),()=>{e(l),w()!==null&&ie(w())}),z(()=>(e(l),e(p),e(C)),()=>{e(l),e(p),e(C),ne()}),z(()=>v(),()=>{d(le,pe(v()))}),z(()=>(e(l),ee()),()=>{d(ge,e(l)[ee()>=0?ee():0]?.scale)}),Ne();var ze={get visible(){return N()},set visible(a){N(a),G()},get elem_id(){return ae()},set elem_id(a){ae(a),G()},get elem_classes(){return U()},set elem_classes(a){U(a),G()},get selected(){return w()},set selected(a){w(a),G()},get initial_tabs(){return R()},set initial_tabs(a){R(a),G()}};$e();var E=sa();j("resize",Ce,ne),j("click",Ce,Be);let xe,qe;var ye=k(E);{var Ie=a=>{var t=aa(),_=k(t);oe(_,5,()=>e(l),de,(r,s)=>{var x=_e(),q=fe(x);{var A=y=>{var c=Ke(),i=k(c,!0);b(c),ce(c,(g,F)=>K(C,e(C)[F.id]=g),g=>e(C)?.[g.id],()=>[e(s)]),D(()=>be(i,(e(s),o(()=>e(s)?.label)))),h(y,c)};H(q,y=>{e(s),o(()=>e(s)&&e(s)?.visible!==!1&&e(s)?.visible!=="hidden")&&y(A)})}h(r,x)}),b(_);var n=J(_,2);oe(n,5,()=>e(he),de,(r,s,x)=>{var q=_e(),A=fe(q);{var y=c=>{var i=Qe();let g;var F=k(i,!0);b(i),D(()=>{O(i,"aria-selected",(e(s),v(),o(()=>e(s).id===v()))),O(i,"aria-controls",(e(s),o(()=>e(s).elem_id))),i.disabled=(e(s),o(()=>!e(s).interactive)),O(i,"aria-disabled",(e(s),o(()=>!e(s).interactive))),O(i,"id",(e(s),o(()=>e(s).elem_id?e(s).elem_id+"-button":null))),O(i,"data-tab-id",(e(s),o(()=>e(s).id))),g=B(i,1,"svelte-11gaq1",null,g,{selected:e(s).id===v()}),be(F,(e(s),o(()=>e(s)?.label!==void 0?e(s)?.label:"Tab "+(x+1))))}),j("click",i,()=>{e(s).id!==v()&&(ie(e(s).id),te("select",{value:e(s).label,index:x,id:e(s).id,component_id:e(s).component_id}))}),h(c,i)};H(A,c=>{e(s),o(()=>e(s)&&e(s)?.visible!==!1)&&c(y)})}h(r,q)}),b(n),ce(n,r=>d(p,r),()=>e(p));var m=J(n,2);let W;var S=k(m);let Z;var $=k(S);He($),b(S);var re=J(S,2);let ke;oe(re,5,()=>e(I),de,(r,s,x)=>{var q=_e(),A=fe(q);{var y=c=>{var i=ea();let g;var F=k(i,!0);b(i),D(()=>{g=B(i,1,"svelte-11gaq1",null,g,{selected:e(s)?.id===v()}),be(F,(e(s),o(()=>e(s)?.label)))}),j("click",i,()=>{ie(e(s)?.id),te("select",{value:e(s).label,index:x,id:e(s).id,component_id:e(s).component_id})}),h(c,i)};H(A,c=>{e(s),o(()=>e(s)?.visible!==!1)&&c(y)})}h(r,q)}),b(re),b(m),ce(m,r=>d(X,r),()=>e(X)),b(t),D(r=>{W=B(m,1,"overflow-menu svelte-11gaq1",null,W,r),Z=B(S,1,"svelte-11gaq1",null,Z,{"overflow-item-selected":e(le)}),ke=B(re,1,"overflow-dropdown svelte-11gaq1",null,ke,{hide:!e(T)})},[()=>({hide:!e(we)||!e(I).some(r=>r?.visible!==!1)})]),j("click",S,Ye(()=>d(T,!e(T)))),h(a,t)};H(ye,a=>{e(me)&&a(Ie)})}var Ve=J(ye,2);Ae(Ve,u,"default",{}),b(E),D(a=>{xe=B(E,1,`tabs ${a??""}`,"svelte-11gaq1",xe,{hide:N()===!1,hidden:N()==="hidden"}),O(E,"id",ae()),qe=Fe(E,"",qe,{"flex-grow":e(ge)})},[()=>(ve(U()),o(()=>U().join(" ")))]),h(Q,E);var We=Ue(ze);return Ee(),We}export{Je as T,na as a}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/WebGLRenderer-BaJ4wXpG.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/WebGLRenderer-BaJ4wXpG.js new file mode 100644 index 0000000000000000000000000000000000000000..0560843a71391a38f41a06b699e2a6ff7e1d990c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/WebGLRenderer-BaJ4wXpG.js @@ -0,0 +1,156 @@ +import{S as G,E as d,G as U,B as T,w as m,D as p,O as K,y as Be,s as F,t as b,a9 as Ae,k as $,aa as Ne,b as S,W as w,j as B,i as A,l as O,M as z,ab as Y,ac as ye,ad as q,ae as Ce,af as De,A as Ie,R as Ge,e as v}from"./Index-cYuhm-BK.js";import{b as Z}from"./colorToUniform-3MxHuUz8.js";import{e as Ue,G as Fe,c as Oe,b as Pe,U as Me,R as Le,B as Q,d as N,f as we,S as He,a as ke}from"./SharedSystems-D1plL92C.js";import"./i18n-Dnhn5Rxr.js";import"./index-DWyDLubb.js";import"./misc-vsnLZ-Y1.js";import"./utils.svelte-CCyS_0CY.js";import"./clone-BkeCM4Nl.js";import"./ImagePreview-B2ps5aDR.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./snippet-BWgYNF9D.js";import"./BlockLabel-CZd21Hkw.js";import"./DownloadLink-TGTaev7f.js";import"./Empty-BIB2W5at.js";import"./ShareButton-wCSP7LoP.js";import"./Download-Di2PsS6O.js";import"./Image-DrPceByI.js";import"./IconButtonWrapper-D0s9l4wW.js";import"./FullscreenButton-sCrcy_OJ.js";import"./Maximize-QH9NIRWs.js";import"./Image-CeW7PJs4.js";/* empty css *//* empty css */import"./Block-J4oodUWp.js";import"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";import"./Clear-BF6j078A.js";/* empty css */import"./Upload-HitvyI7k.js";import"./actions-CLThs9VH.js";/* empty css */import"./Webcam-DQkeURjU.js";import"./DropdownArrow-BOSZEGSp.js";import"./Square-CcB54dqq.js";import"./Spinner-Dhvehhrf.js";import"./StreamingBar-Cb4g-rUI.js";import"./window-Uydxco8n.js";import"./tinycolor-BQBUvzv5.js";import"./Plus-CDtuRS4x.js";import"./input-DrerMDOL.js";import"./Check-DUAHzS2-.js";import"./event-modifiers-CdEA5IGF.js";import"./ArrowUp-D69HGcoh.js";import"./Trash-D2U3jAj_.js";import"./Undo-C2-jWGVL.js";class J{constructor(){this._tempState=G.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,r,s){const n=e.renderer,i=this._didUploadHash[s.uid];n.shader.bind(s,i),i||(this._didUploadHash[s.uid]=!0),n.shader.updateUniformGroup(n.globalUniforms.uniformGroup),n.geometry.bind(r,s.glProgram)}execute(e,r){const s=e.renderer;this._tempState.blendMode=r.blendMode,s.state.set(this._tempState);const n=r.textures.textures;for(let i=0;i(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(x||{});class Ve{constructor(e,r){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=r}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}class ee{constructor(e){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._managedBuffers=new U({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"})}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={}}contextChange(){this._gl=this._renderer.gl,this.destroyAll(!0),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this.createGLBuffer(e)}bind(e){const{_gl:r}=this,s=this.getGlBuffer(e);r.bindBuffer(s.type,s.buffer)}bindBufferBase(e,r){const{_gl:s}=this;this._boundBufferBases[r]!==e&&(this._boundBufferBases[r]=e,e._lastBindBaseLocation=r,s.bindBufferBase(s.UNIFORM_BUFFER,r,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let r=this.getLastBindBaseLocation(e);if(r>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,r;let s=0,n=this._nextBindBaseIndex;for(;s<2;){n>=this._maxBindings&&(n=this._minBaseLocation,s++);const i=this._boundBufferBases[n];if(i&&i._lastBindCallId===this._bindCallId){n++;continue}break}return r=n,this._nextBindBaseIndex=n+1,s>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[r]=null,r)}getLastBindBaseLocation(e){const r=e._lastBindBaseLocation;return this._boundBufferBases[r]===e?r:-1}bindBufferRange(e,r,s,n){const{_gl:i}=this;s||(s=0),r||(r=0),this._boundBufferBases[r]=null,i.bindBufferRange(i.UNIFORM_BUFFER,r||0,e.buffer,s*256,n||256)}updateBuffer(e){const{_gl:r}=this,s=this.getGlBuffer(e);if(e._updateID===s.updateID)return s;s.updateID=e._updateID,r.bindBuffer(s.type,s.buffer);const n=e.data,i=e.descriptor.usage&T.STATIC?r.STATIC_DRAW:r.DYNAMIC_DRAW;return n?s.byteLength>=n.byteLength?r.bufferSubData(s.type,0,n,0,e._updateSize/n.BYTES_PER_ELEMENT):(s.byteLength=n.byteLength,r.bufferData(s.type,n,i)):(s.byteLength=e.descriptor.size,r.bufferData(s.type,s.byteLength,i)),s}destroyAll(e=!1){this._managedBuffers.removeAll(e)}onBufferUnload(e,r=!1){const s=e._gpuData[this._renderer.uid];s&&(r||this._gl.deleteBuffer(s.buffer))}createGLBuffer(e){const{_gl:r}=this;let s=x.ARRAY_BUFFER;e.descriptor.usage&T.INDEX?s=x.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&T.UNIFORM&&(s=x.UNIFORM_BUFFER);const n=new Ve(r.createBuffer(),s);return e._gpuData[this._renderer.uid]=n,this._managedBuffers.add(e),n}resetState(){this._boundBufferBases=Object.create(null)}}ee.extension={type:[d.WebGLSystem],name:"buffer"};const P=class te{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...te.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(m("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=p.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{const s=this._renderer.background.alpha<1,n=e.premultipliedAlpha??!0,i=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:s,premultipliedAlpha:n,antialias:i,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&m("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:r}=this;(r.width{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){const r=e.getContextAttributes();r&&!r.stencil&&m("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=this.supports,n=this.webGLVersion===2,i=this.extensions;s.uint32Indices=n||!!i.uint32ElementIndex,s.uniformBufferObject=n,s.vertexArrayObject=n||!!i.vertexArrayObject,s.srgbTextures=n||!!i.srgb,s.nonPowOf2wrapping=n,s.nonPowOf2mipmaps=n,s.msaa=n,s.uint32Indices||m("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};P.extension={type:[d.WebGLSystem],name:"context"};P.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let Xe=P;var D=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(D||{}),re=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(re||{}),f=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(f||{});const H={uint8x2:f.UNSIGNED_BYTE,uint8x4:f.UNSIGNED_BYTE,sint8x2:f.BYTE,sint8x4:f.BYTE,unorm8x2:f.UNSIGNED_BYTE,unorm8x4:f.UNSIGNED_BYTE,snorm8x2:f.BYTE,snorm8x4:f.BYTE,uint16x2:f.UNSIGNED_SHORT,uint16x4:f.UNSIGNED_SHORT,sint16x2:f.SHORT,sint16x4:f.SHORT,unorm16x2:f.UNSIGNED_SHORT,unorm16x4:f.UNSIGNED_SHORT,snorm16x2:f.SHORT,snorm16x4:f.SHORT,float16x2:f.HALF_FLOAT,float16x4:f.HALF_FLOAT,float32:f.FLOAT,float32x2:f.FLOAT,float32x3:f.FLOAT,float32x4:f.FLOAT,uint32:f.UNSIGNED_INT,uint32x2:f.UNSIGNED_INT,uint32x3:f.UNSIGNED_INT,uint32x4:f.UNSIGNED_INT,sint32:f.INT,sint32x2:f.INT,sint32x3:f.INT,sint32x4:f.INT};function We(t){return H[t]??H.float32}const je={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class Ke{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}}class se{constructor(e){this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new U({renderer:e,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");this.destroyAll(!0);const r=this._renderer.context.extensions.vertexArrayObject;r&&(e.createVertexArray=()=>r.createVertexArrayOES(),e.bindVertexArray=n=>r.bindVertexArrayOES(n),e.deleteVertexArray=n=>r.deleteVertexArrayOES(n));const s=this._renderer.context.extensions.vertexAttribDivisorANGLE;s&&(e.drawArraysInstanced=(n,i,a,o)=>{s.drawArraysInstancedANGLE(n,i,a,o)},e.drawElementsInstanced=(n,i,a,o,c)=>{s.drawElementsInstancedANGLE(n,i,a,o,c)},e.vertexAttribDivisor=(n,i)=>s.vertexAttribDivisorANGLE(n,i)),this._activeGeometry=null,this._activeVao=null}bind(e,r){const s=this.gl;this._activeGeometry=e;const n=this.getVao(e,r);this._activeVao!==n&&(this._activeVao=n,s.bindVertexArray(n)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){const e=this._activeGeometry,r=this._renderer.buffer;for(let s=0;s":8,"vec3":12,"vec4":16,"vec2":8,"vec3":12,"vec4":16,"mat2x2":32,"mat3x3":48,"mat4x4":64};function qe(t){const e=t.map(i=>({data:i,offset:0,size:0})),r=16;let s=0,n=0;for(let i=0;i1&&(s=Math.max(s,r)*a.data.size);const o=s===12?16:s;a.size=s;const c=n%r;c>0&&r-c=0?"dataInt32":"data";return` + v = uv.${t.data.name}; + offset += ${e}; + + arrayOffset = offset; + + t = 0; + + for(var i=0; i < ${t.data.size*r}; i++) + { + for(var j = 0; j < ${s}; j++) + { + ${i}[arrayOffset++] = v[t++]; + } + ${n!==0?`arrayOffset += ${n};`:""} + } + `}function Qe(t){return Oe(t,"uboStd40",Ze,Pe)}class _e extends Me{constructor(){super({createUboElements:qe,generateUboSync:Qe})}}_e.extension={type:[d.WebGLSystem],name:"ubo"};class Je{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new w}init(e,r){this._renderer=e,this._renderTargetSystem=r,e.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new w;const e=this._renderer.gl;this._drawBuffersCache=[];for(let r=1;r<=16;r++)this._drawBuffersCache[r]=Array.from({length:r},(s,n)=>e.COLOR_ATTACHMENT0+n)}copyToTexture(e,r,s,n,i){const a=this._renderTargetSystem,o=this._renderer,c=a.getGpuRenderTarget(e),u=o.gl;return this.finishRenderPass(e),u.bindFramebuffer(u.FRAMEBUFFER,c.resolveTargetFramebuffer),o.texture.bind(r,0),u.copyTexSubImage2D(u.TEXTURE_2D,0,i.x,i.y,s.x,s.y,n.width,n.height),r}startRenderPass(e,r=!0,s,n){const i=this._renderTargetSystem,a=e.colorTexture,o=i.getGpuRenderTarget(e);let c=n.y;e.isRoot&&(c=a.pixelHeight-n.height-n.y),e.colorTextures.forEach(h=>{this._renderer.texture.unbind(h)});const u=this._renderer.gl;u.bindFramebuffer(u.FRAMEBUFFER,o.framebuffer),e.colorTextures.length>1&&this._setDrawBuffers(e,u);const _=this._viewPortCache;(_.x!==n.x||_.y!==c||_.width!==n.width||_.height!==n.height)&&(_.x=n.x,_.y=c,_.width=n.width,_.height=n.height,u.viewport(n.x,c,n.width,n.height)),!o.depthStencilRenderBuffer&&(e.stencil||e.depth)&&this._initStencil(o),this.clear(e,r,s)}finishRenderPass(e){const s=this._renderTargetSystem.getGpuRenderTarget(e);if(!s.msaa)return;const n=this._renderer.gl;n.bindFramebuffer(n.FRAMEBUFFER,s.resolveTargetFramebuffer),n.bindFramebuffer(n.READ_FRAMEBUFFER,s.framebuffer),n.blitFramebuffer(0,0,s.width,s.height,0,0,s.width,s.height,n.COLOR_BUFFER_BIT,n.NEAREST),n.bindFramebuffer(n.FRAMEBUFFER,s.framebuffer)}initGpuRenderTarget(e){const s=this._renderer.gl,n=new Ye;return e.colorTexture instanceof B?(this._renderer.context.ensureCanvasSize(e.colorTexture.resource),n.framebuffer=null,n):(this._initColor(e,n),s.bindFramebuffer(s.FRAMEBUFFER,null),n)}destroyGpuRenderTarget(e){const r=this._renderer.gl;e.framebuffer&&(r.deleteFramebuffer(e.framebuffer),e.framebuffer=null),e.resolveTargetFramebuffer&&(r.deleteFramebuffer(e.resolveTargetFramebuffer),e.resolveTargetFramebuffer=null),e.depthStencilRenderBuffer&&(r.deleteRenderbuffer(e.depthStencilRenderBuffer),e.depthStencilRenderBuffer=null),e.msaaRenderBuffer.forEach(s=>{r.deleteRenderbuffer(s)}),e.msaaRenderBuffer=null}clear(e,r,s){if(!r)return;const n=this._renderTargetSystem;typeof r=="boolean"&&(r=r?A.ALL:A.NONE);const i=this._renderer.gl;if(r&A.COLOR){s??(s=n.defaultClearColor);const a=this._clearColorCache,o=s;(a[0]!==o[0]||a[1]!==o[1]||a[2]!==o[2]||a[3]!==o[3])&&(a[0]=o[0],a[1]=o[1],a[2]=o[2],a[3]=o[3],i.clearColor(o[0],o[1],o[2],o[3]))}i.clear(r)}resizeGpuRenderTarget(e){if(e.isRoot)return;const s=this._renderTargetSystem.getGpuRenderTarget(e);this._resizeColor(e,s),(e.stencil||e.depth)&&this._resizeStencil(s)}_initColor(e,r){const s=this._renderer,n=s.gl,i=n.createFramebuffer();if(r.resolveTargetFramebuffer=i,n.bindFramebuffer(n.FRAMEBUFFER,i),r.width=e.colorTexture.source.pixelWidth,r.height=e.colorTexture.source.pixelHeight,e.colorTextures.forEach((o,c)=>{const u=o.source;u.antialias&&(s.context.supports.msaa?r.msaa=!0:m("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),s.texture.bindSource(u,0);const h=s.texture.getGlSource(u).texture;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+c,3553,h,0)}),r.msaa){const o=n.createFramebuffer();r.framebuffer=o,n.bindFramebuffer(n.FRAMEBUFFER,o),e.colorTextures.forEach((c,u)=>{const _=n.createRenderbuffer();r.msaaRenderBuffer[u]=_})}else r.framebuffer=i;this._resizeColor(e,r)}_resizeColor(e,r){const s=e.colorTexture.source;if(r.width=s.pixelWidth,r.height=s.pixelHeight,e.colorTextures.forEach((n,i)=>{i!==0&&n.source.resize(s.width,s.height,s._resolution)}),r.msaa){const n=this._renderer,i=n.gl,a=r.framebuffer;i.bindFramebuffer(i.FRAMEBUFFER,a),e.colorTextures.forEach((o,c)=>{const u=o.source;n.texture.bindSource(u,0);const h=n.texture.getGlSource(u).internalFormat,l=r.msaaRenderBuffer[c];i.bindRenderbuffer(i.RENDERBUFFER,l),i.renderbufferStorageMultisample(i.RENDERBUFFER,4,h,u.pixelWidth,u.pixelHeight),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+c,i.RENDERBUFFER,l)})}}_initStencil(e){if(e.framebuffer===null)return;const r=this._renderer.gl,s=r.createRenderbuffer();e.depthStencilRenderBuffer=s,r.bindRenderbuffer(r.RENDERBUFFER,s),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,s),this._resizeStencil(e)}_resizeStencil(e){const r=this._renderer.gl;r.bindRenderbuffer(r.RENDERBUFFER,e.depthStencilRenderBuffer),e.msaa?r.renderbufferStorageMultisample(r.RENDERBUFFER,4,r.DEPTH24_STENCIL8,e.width,e.height):r.renderbufferStorage(r.RENDERBUFFER,this._renderer.context.webGLVersion===2?r.DEPTH24_STENCIL8:r.DEPTH_STENCIL,e.width,e.height)}prerender(e){const r=e.colorTexture.resource;this._renderer.context.multiView&&B.test(r)&&this._renderer.context.ensureCanvasSize(r)}postrender(e){if(this._renderer.context.multiView&&B.test(e.colorTexture.resource)){const r=this._renderer.context.canvas,s=e.colorTexture;s.context2D.drawImage(r,0,s.pixelHeight-r.height)}}_setDrawBuffers(e,r){const s=e.colorTextures.length,n=this._drawBuffersCache[s];if(this._renderer.context.webGLVersion===1){const i=this._renderer.context.extensions.drawBuffers;i?i.drawBuffersWEBGL(n):m("[RenderTexture] This WebGL1 context does not support rendering to multiple targets")}else r.drawBuffers(n)}}class fe extends Le{constructor(e){super(e),this.adaptor=new Je,this.adaptor.init(e,this)}}fe.extension={type:[d.WebGLSystem],name:"renderTarget"};function et(t,e){const r=[],s=[` + var g = s.groups; + var sS = r.shader; + var p = s.glProgram; + var ugS = r.uniformGroup; + var resources; + `];let n=!1,i=0;const a=e._getProgramData(t.glProgram);for(const c in t.groups){const u=t.groups[c];r.push(` + resources = g[${c}].resources; + `);for(const _ in u.resources){const h=u.resources[_];if(h instanceof O)if(h.ubo){const l=t._uniformBindMap[c][Number(_)];r.push(` + sS.bindUniformBlock( + resources[${_}], + '${l}', + ${t.glProgram._uniformBlockData[l].index} + ); + `)}else r.push(` + ugS.updateUniformGroup(resources[${_}], p, sD); + `);else if(h instanceof Q){const l=t._uniformBindMap[c][Number(_)];r.push(` + sS.bindUniformBlock( + resources[${_}], + '${l}', + ${t.glProgram._uniformBlockData[l].index} + ); + `)}else if(h instanceof $){const l=t._uniformBindMap[c][_],E=a.uniformData[l];E&&(n||(n=!0,s.push(` + var tS = r.texture; + `)),e._gl.uniform1i(E.location,i),r.push(` + tS.bind(resources[${_}], ${i}); + `),i++)}}}const o=[...s,...r].join(` +`);return new Function("r","s","sD",o)}class tt{constructor(e,r){this.program=e,this.uniformData=r,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}function k(t,e,r){const s=t.createShader(e);return t.shaderSource(s,r),t.compileShader(s),s}function y(t){const e=new Array(t);for(let r=0;ra>o?1:-1);for(let a=0;a`${_}: ${u}`),s=t.getShaderInfoLog(e),n=s.split(` +`),i={},a=n.map(u=>parseFloat(u.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(u=>u&&!i[u]?(i[u]=!0,!0):!1),o=[""];a.forEach(u=>{r[u-1]=`%c${r[u-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const c=r.join(` +`);o[0]=c,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function ot(t,e,r,s){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||X(t,r),t.getShaderParameter(s,t.COMPILE_STATUS)||X(t,s),console.error("PixiJS Error: Could not initialize shader."),t.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}function ct(t,e){const r=k(t,t.VERTEX_SHADER,e.vertex),s=k(t,t.FRAGMENT_SHADER,e.fragment),n=t.createProgram();t.attachShader(n,r),t.attachShader(n,s);const i=e.transformFeedbackVaryings;i&&(typeof t.transformFeedbackVaryings!="function"?m("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(n,i.names,i.bufferMode==="separate"?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||ot(t,n,r,s),e._attributeData=nt(n,t,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertex)),e._uniformData=at(n,t),e._uniformBlockData=it(n,t),t.deleteShader(r),t.deleteShader(s);const a={};for(const c in e._uniformData){const u=e._uniformData[c];a[c]={location:t.getUniformLocation(n,c),value:he(u.type,u.size)}}return new tt(n,a)}const R={textureCount:0,blockIndex:0};class de{constructor(e){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=e}contextChange(e){this._gl=e,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null}bind(e,r){if(this._setProgram(e.glProgram),r)return;R.textureCount=0,R.blockIndex=0;let s=this._shaderSyncFunctions[e.glProgram._key];s||(s=this._shaderSyncFunctions[e.glProgram._key]=this._generateShaderSync(e,this)),this._renderer.buffer.nextBindBase(!!e.glProgram.transformFeedbackVaryings),s(this._renderer,e,R)}updateUniformGroup(e){this._renderer.uniformGroup.updateUniformGroup(e,this._activeProgram,R)}bindUniformBlock(e,r,s=0){const n=this._renderer.buffer,i=this._getProgramData(this._activeProgram),a=e._bufferResource;a||this._renderer.ubo.updateUniformGroup(e);const o=e.buffer,c=n.updateBuffer(o),u=n.freeLocationForBufferBase(c);if(a){const{offset:h,size:l}=e;h===0&&l===o.data.byteLength?n.bindBufferBase(c,u):n.bindBufferRange(c,u,h)}else n.getLastBindBaseLocation(c)!==u&&n.bindBufferBase(c,u);const _=this._activeProgram._uniformBlockData[r].index;i.uniformBlockBindings[s]!==u&&(i.uniformBlockBindings[s]=u,this._renderer.gl.uniformBlockBinding(i.program,_,u))}_setProgram(e){if(this._activeProgram===e)return;this._activeProgram=e;const r=this._getProgramData(e);this._gl.useProgram(r.program)}_getProgramData(e){return this._programDataHash[e._key]||this._createProgramData(e)}_createProgramData(e){const r=e._key;return this._programDataHash[r]=ct(this._gl,e),this._programDataHash[r]}destroy(){for(const e of Object.keys(this._programDataHash))this._programDataHash[e].destroy();this._programDataHash=null,this._shaderSyncFunctions=null,this._activeProgram=null,this._renderer=null,this._gl=null}_generateShaderSync(e,r){return et(e,r)}resetState(){this._activeProgram=null}}de.extension={type:[d.WebGLSystem],name:"shader"};const ut={f32:`if (cv !== v) { + cu.value = v; + gl.uniform1f(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2f(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3f(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4f(location, v[0], v[1], v[2], v[3]); + }`,i32:`if (cv !== v) { + cu.value = v; + gl.uniform1i(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2i(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3i(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,u32:`if (cv !== v) { + cu.value = v; + gl.uniform1ui(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2ui(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3ui(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4ui(location, v[0], v[1], v[2], v[3]); + }`,bool:`if (cv !== v) { + cu.value = v; + gl.uniform1i(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2i(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3i(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,"mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);"},_t={f32:"gl.uniform1fv(location, v);","vec2":"gl.uniform2fv(location, v);","vec3":"gl.uniform3fv(location, v);","vec4":"gl.uniform4fv(location, v);","mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);"};function ft(t,e){const r=[` + var v = null; + var cv = null; + var cu = null; + var t = 0; + var gl = renderer.gl; + var name = null; + `];for(const s in t.uniforms){if(!e[s]){t.uniforms[s]instanceof O?t.uniforms[s].ubo?r.push(` + renderer.shader.bindUniformBlock(uv.${s}, "${s}"); + `):r.push(` + renderer.shader.updateUniformGroup(uv.${s}); + `):t.uniforms[s]instanceof Q&&r.push(` + renderer.shader.bindBufferResource(uv.${s}, "${s}"); + `);continue}const n=t.uniformStructures[s];let i=!1;for(let a=0;a>=1,s++;this.stateId=e.data}for(let r=0;r>1,1),n=Math.max(n>>1,1)}}},be={id:"image",upload(t,e,r,s){const n=e.width,i=e.height,a=t.pixelWidth,o=t.pixelHeight,c=t.resourceWidth,u=t.resourceHeight;c1){const u=Math.min(t.maxAnisotropy,e.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[n](c,s.TEXTURE_MAX_ANISOTROPY_EXT,u)}t.compare&&e[n](c,e.TEXTURE_COMPARE_FUNC,At[t.compare])}function Nt(t){return{r8unorm:t.RED,r8snorm:t.RED,r8uint:t.RED,r8sint:t.RED,r16uint:t.RED,r16sint:t.RED,r16float:t.RED,rg8unorm:t.RG,rg8snorm:t.RG,rg8uint:t.RG,rg8sint:t.RG,r32uint:t.RED,r32sint:t.RED,r32float:t.RED,rg16uint:t.RG,rg16sint:t.RG,rg16float:t.RG,rgba8unorm:t.RGBA,"rgba8unorm-srgb":t.RGBA,rgba8snorm:t.RGBA,rgba8uint:t.RGBA,rgba8sint:t.RGBA,bgra8unorm:t.RGBA,"bgra8unorm-srgb":t.RGBA,rgb9e5ufloat:t.RGB,rgb10a2unorm:t.RGBA,rg11b10ufloat:t.RGB,rg32uint:t.RG,rg32sint:t.RG,rg32float:t.RG,rgba16uint:t.RGBA,rgba16sint:t.RGBA,rgba16float:t.RGBA,rgba32uint:t.RGBA,rgba32sint:t.RGBA,rgba32float:t.RGBA,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT,depth24plus:t.DEPTH_COMPONENT,"depth24plus-stencil8":t.DEPTH_STENCIL,depth32float:t.DEPTH_COMPONENT,"depth32float-stencil8":t.DEPTH_STENCIL}}function yt(t,e){let r={},s=t.RGBA;return t instanceof p.get().getWebGLRenderingContext()?e.srgb&&(r={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":t.SRGB8_ALPHA8,"bgra8unorm-srgb":t.SRGB8_ALPHA8},s=t.RGBA8),{r8unorm:t.R8,r8snorm:t.R8_SNORM,r8uint:t.R8UI,r8sint:t.R8I,r16uint:t.R16UI,r16sint:t.R16I,r16float:t.R16F,rg8unorm:t.RG8,rg8snorm:t.RG8_SNORM,rg8uint:t.RG8UI,rg8sint:t.RG8I,r32uint:t.R32UI,r32sint:t.R32I,r32float:t.R32F,rg16uint:t.RG16UI,rg16sint:t.RG16I,rg16float:t.RG16F,rgba8unorm:t.RGBA,...r,rgba8snorm:t.RGBA8_SNORM,rgba8uint:t.RGBA8UI,rgba8sint:t.RGBA8I,bgra8unorm:s,rgb9e5ufloat:t.RGB9_E5,rgb10a2unorm:t.RGB10_A2,rg11b10ufloat:t.R11F_G11F_B10F,rg32uint:t.RG32UI,rg32sint:t.RG32I,rg32float:t.RG32F,rgba16uint:t.RGBA16UI,rgba16sint:t.RGBA16I,rgba16float:t.RGBA16F,rgba32uint:t.RGBA32UI,rgba32sint:t.RGBA32I,rgba32float:t.RGBA32F,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT16,depth24plus:t.DEPTH_COMPONENT24,"depth24plus-stencil8":t.DEPTH24_STENCIL8,depth32float:t.DEPTH_COMPONENT32F,"depth32float-stencil8":t.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}function Ct(t){return{r8unorm:t.UNSIGNED_BYTE,r8snorm:t.BYTE,r8uint:t.UNSIGNED_BYTE,r8sint:t.BYTE,r16uint:t.UNSIGNED_SHORT,r16sint:t.SHORT,r16float:t.HALF_FLOAT,rg8unorm:t.UNSIGNED_BYTE,rg8snorm:t.BYTE,rg8uint:t.UNSIGNED_BYTE,rg8sint:t.BYTE,r32uint:t.UNSIGNED_INT,r32sint:t.INT,r32float:t.FLOAT,rg16uint:t.UNSIGNED_SHORT,rg16sint:t.SHORT,rg16float:t.HALF_FLOAT,rgba8unorm:t.UNSIGNED_BYTE,"rgba8unorm-srgb":t.UNSIGNED_BYTE,rgba8snorm:t.BYTE,rgba8uint:t.UNSIGNED_BYTE,rgba8sint:t.BYTE,bgra8unorm:t.UNSIGNED_BYTE,"bgra8unorm-srgb":t.UNSIGNED_BYTE,rgb9e5ufloat:t.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:t.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:t.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:t.UNSIGNED_INT,rg32sint:t.INT,rg32float:t.FLOAT,rgba16uint:t.UNSIGNED_SHORT,rgba16sint:t.SHORT,rgba16float:t.HALF_FLOAT,rgba32uint:t.UNSIGNED_INT,rgba32sint:t.INT,rgba32float:t.FLOAT,stencil8:t.UNSIGNED_BYTE,depth16unorm:t.UNSIGNED_SHORT,depth24plus:t.UNSIGNED_INT,"depth24plus-stencil8":t.UNSIGNED_INT_24_8,depth32float:t.FLOAT,"depth32float-stencil8":t.FLOAT_32_UNSIGNED_INT_24_8_REV}}const Dt=4;class pe{constructor(e){this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:be,buffer:Rt,video:Tt,compressed:vt},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=e,this._managedTextures=new U({renderer:e,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"glTexture"})}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=yt(e,this._renderer.context.extensions),this._mapFormatToType=Ct(e),this._mapFormatToFormat=Nt(e)),this._managedTextures.removeAll(!0),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let r=0;r<16;r++)this.bind(b.EMPTY,r)}initSource(e){this.bind(e)}bind(e,r=0){const s=e.source;e?(this.bindSource(s,r),this._useSeparateSamplers&&this._bindSampler(s.style,r)):(this.bindSource(null,r),this._useSeparateSamplers&&this._bindSampler(null,r))}bindSource(e,r=0){const s=this._gl;if(e._gcLastUsed=this._renderer.gc.now,this._boundTextures[r]!==e){this._boundTextures[r]=e,this._activateLocation(r),e||(e=b.EMPTY.source);const n=this.getGlSource(e);s.bindTexture(n.target,n.texture)}}_bindSampler(e,r=0){const s=this._gl;if(!e){this._boundSamplers[r]=null,s.bindSampler(r,null);return}const n=this._getGlSampler(e);this._boundSamplers[r]!==n&&(this._boundSamplers[r]=n,s.bindSampler(r,n))}unbind(e){const r=e.source,s=this._boundTextures,n=this._gl;for(let i=0;i1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",s.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,r)}onSourceUnload(e,r=!1){const s=e._gpuData[this._renderer.uid];s&&(r||(this.unbind(e),this._gl.deleteTexture(s.texture)),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this))}onSourceUpdate(e){const r=this._gl,s=this.getGlSource(e);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=e;const n=e.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==n&&(this._premultiplyAlpha=n,r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n)),this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,s,r,this._renderer.context.webGLVersion):r.texImage2D(r.TEXTURE_2D,0,s.internalFormat,e.pixelWidth,e.pixelHeight,0,s.format,s.type,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,r=!0){r&&this.bindSource(e,0);const s=this.getGlSource(e);this._gl.generateMipmap(s.target)}_initSampler(e){const r=this._gl,s=this._gl.createSampler();return this._glSamplers[e._resourceId]=s,j(e,r,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",s,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this._initSource(e)}generateCanvas(e){const{pixels:r,width:s,height:n}=this.getPixels(e),i=p.get().createCanvas();i.width=s,i.height=n;const a=i.getContext("2d");if(a){const o=a.createImageData(s,n);o.data.set(r),a.putImageData(o,0,0)}return i}getPixels(e){const r=e.source.resolution,s=e.frame,n=Math.max(Math.round(s.width*r),1),i=Math.max(Math.round(s.height*r),1),a=new Uint8Array(Dt*n*i),o=this._renderer,c=o.renderTarget.getRenderTarget(e),u=o.renderTarget.getGpuRenderTarget(c),_=o.gl;return _.bindFramebuffer(_.FRAMEBUFFER,u.resolveTargetFramebuffer),_.readPixels(Math.round(s.x*r),Math.round(s.y*r),n,i,_.RGBA,_.UNSIGNED_BYTE,a),{pixels:new Uint8ClampedArray(a.buffer),width:n,height:i}}destroy(){this._managedTextures.destroy(),this._glSamplers=null,this._boundTextures=null,this._boundSamplers=null,this._mapFormatToInternalFormat=null,this._mapFormatToType=null,this._mapFormatToFormat=null,this._uploads=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(b.EMPTY.source),this._boundSamplers=Object.create(null);const e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}}pe.extension={type:[d.WebGLSystem],name:"texture"};class Se{contextChange(e){const r=new O({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new z,type:"mat3x3"},uRound:{value:0,type:"f32"}}),s=e.limits.maxBatchableTextures,n=Y({name:"graphics",bits:[ye,Ce(s),Z,q]});this.shader=new F({glProgram:n,resources:{localUniforms:r,batchSamplers:De(s)}})}execute(e,r){const s=r.context,n=s.customShader||this.shader,i=e.renderer,a=i.graphicsContext,{batcher:o,instructions:c}=a.getContextRenderData(s);n.groups[0]=i.globalUniforms.bindGroup,i.state.set(e.state),i.shader.bind(n),i.geometry.bind(o.geometry,n.glProgram);const u=c.instructions;for(let _=0;_",value:new z}}}})}execute(e,r){const s=e.renderer;let n=r._shader;if(n){if(!n.glProgram){m("Mesh shader has no glProgram",r.shader);return}}else{n=this._shader;const i=r.texture,a=i.source;n.resources.uTexture=a,n.resources.uSampler=a.style,n.resources.textureUniforms.uniforms.uTextureMatrix=i.textureMatrix.mapCoord}n.groups[100]=s.globalUniforms.bindGroup,n.groups[101]=e.localUniformsBindGroup,s.encoder.draw({geometry:r._geometry,shader:n,state:r.state})}destroy(){this._shader.destroy(!0),this._shader=null}}ge.extension={type:[d.WebGLPipesAdaptor],name:"mesh"};const It=[...He,_e,ze,Xe,oe,ee,pe,fe,se,me,de,ae,St,ce,ie],Gt=[...ke],Ut=[J,ge,Se],Re=[],xe=[],ve=[];v.handleByNamedList(d.WebGLSystem,Re);v.handleByNamedList(d.WebGLPipes,xe);v.handleByNamedList(d.WebGLPipesAdaptor,ve);v.add(...It,...Gt,...Ut);class Nr extends Ie{constructor(){const e={name:"webgl",type:Ge.WEBGL,systems:Re,renderPipes:xe,renderPipeAdaptors:ve};super(e)}}export{Nr as WebGLRenderer}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/WebGPURenderer-aw-zH1pb.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/WebGPURenderer-aw-zH1pb.js new file mode 100644 index 0000000000000000000000000000000000000000..b29fab86f6cb2a6630da867c5e5134760c3a3343 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/WebGPURenderer-aw-zH1pb.js @@ -0,0 +1,41 @@ +import{g as E,S as L,E as f,G as A,u as ue,f as ce,D as P,b as v,B as T,c as de,d as D,h as M,w as C,i as x,j as he,k as pe,l as k,m as w,M as z,n as F,o as le,p as I,q as fe,s as O,t as R,A as me,R as ge,e as B}from"./Index-cYuhm-BK.js";import{l as _e,a as be}from"./colorToUniform-3MxHuUz8.js";import{c as xe,u as ye,U as Ge,B as Pe,G as Be,e as Se,R as Te,t as ve,S as Ce,a as Ue}from"./SharedSystems-D1plL92C.js";import"./i18n-Dnhn5Rxr.js";import"./index-DWyDLubb.js";import"./misc-vsnLZ-Y1.js";import"./utils.svelte-CCyS_0CY.js";import"./clone-BkeCM4Nl.js";import"./ImagePreview-B2ps5aDR.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./snippet-BWgYNF9D.js";import"./BlockLabel-CZd21Hkw.js";import"./DownloadLink-TGTaev7f.js";import"./Empty-BIB2W5at.js";import"./ShareButton-wCSP7LoP.js";import"./Download-Di2PsS6O.js";import"./Image-DrPceByI.js";import"./IconButtonWrapper-D0s9l4wW.js";import"./FullscreenButton-sCrcy_OJ.js";import"./Maximize-QH9NIRWs.js";import"./Image-CeW7PJs4.js";/* empty css *//* empty css */import"./Block-J4oodUWp.js";import"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";import"./Clear-BF6j078A.js";/* empty css */import"./Upload-HitvyI7k.js";import"./actions-CLThs9VH.js";/* empty css */import"./Webcam-DQkeURjU.js";import"./DropdownArrow-BOSZEGSp.js";import"./Square-CcB54dqq.js";import"./Spinner-Dhvehhrf.js";import"./StreamingBar-Cb4g-rUI.js";import"./window-Uydxco8n.js";import"./tinycolor-BQBUvzv5.js";import"./Plus-CDtuRS4x.js";import"./input-DrerMDOL.js";import"./Check-DUAHzS2-.js";import"./event-modifiers-CdEA5IGF.js";import"./ArrowUp-D69HGcoh.js";import"./Trash-D2U3jAj_.js";import"./Undo-C2-jWGVL.js";const y=L.for2d();class W{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),y.blendMode="normal",s.pipeline.getPipeline(t,n,y);const o=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,o,n)}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=E(u.textures,u.count,s.limits.maxBatchableTextures)}y.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),o=s.pipeline.getPipeline(this._geometry,r,y,t.topology);t.bindGroup._touch(s.gc.now,s.tick),i.setPipeline(o),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}}W.extension={type:[f.WebGPUPipesAdaptor],name:"batch"};class H{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],o=this._renderer;for(const l in i){const p=e.resources[l]??e.resources[i[l]];let h;if(p._resourceType==="uniformGroup"){const d=p;o.ubo.updateUniformGroup(d);const _=d.buffer;h={buffer:o.buffer.getGPUBuffer(_),offset:0,size:_.descriptor.size}}else if(p._resourceType==="buffer"){const d=p;h={buffer:o.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(p._resourceType==="bufferResource"){const d=p;h={buffer:o.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(p._resourceType==="textureSampler"){const d=p;h=o.texture.getGpuSampler(d)}else if(p._resourceType==="textureSource"){const d=p;h=o.texture.getGpuSource(d).createView()}n.push({binding:i[l],resource:h})}const u=o.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){this._hash=null,this._renderer=null}}H.extension={type:[f.WebGPUSystem],name:"bindGroup"};class Me{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class V{constructor(e){this._renderer=e,this._managedBuffers=new A({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e}getGPUBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuBuffer||this.createGPUBuffer(e)}updateBuffer(e){const t=this.getGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(e){e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this)}createGPUBuffer(e){const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e._resourceId=ue("resource"),e.data&&(ce(e.data.buffer,t.getMappedRange()),t.unmap()),e._gpuData[this._renderer.uid]=new Me(t),this._managedBuffers.add(e)&&(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this)),t}onBufferChange(e){this._managedBuffers.remove(e),e._updateID=0,this.createGPUBuffer(e)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}}V.extension={type:[f.WebGPUSystem],name:"buffer"};class we{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await P.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this._renderer=null}}U.extension={type:[f.WebGPUSystem],name:"device"};U.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class j{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.gc.now,this._renderer.tick);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(parseInt(s,10),e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,e.gpuProgram)}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){const{geometry:t,shader:r,state:s,topology:i,size:n,start:o,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u??t.instanceCount,o||0):this.renderPassEncoder.draw(n||t.getSize(),u??t.instanceCount,o||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);const t=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const o in r)this._setVertexBuffer(o,r[o]);for(const o in i)this.setBindGroup(o,i[o],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}}j.extension={type:[f.WebGPUSystem],name:"encoder",priority:1};class K{constructor(e){this._renderer=e}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}K.extension={type:[f.WebGPUSystem],name:"limits"};class q{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:v.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}q.extension={type:[f.WebGPUSystem],name:"stencil"};const G={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:4,size:4},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:8,size:6},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:8,size:8},"mat2x2":{align:8,size:16},"mat2x2":{align:4,size:8},"mat3x2":{align:8,size:24},"mat3x2":{align:4,size:12},"mat4x2":{align:8,size:32},"mat4x2":{align:4,size:16},"mat2x3":{align:16,size:32},"mat2x3":{align:8,size:16},"mat3x3":{align:16,size:48},"mat3x3":{align:8,size:24},"mat4x3":{align:16,size:64},"mat4x3":{align:8,size:32},"mat2x4":{align:16,size:32},"mat2x4":{align:8,size:16},"mat3x4":{align:16,size:48},"mat3x4":{align:8,size:24},"mat4x4":{align:16,size:64},"mat4x4":{align:8,size:32}};function Re(a){const e=a.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function Ee(a,e){const{size:t,align:r}=G[a.data.type],s=(r-t)/4,i=a.data.type.indexOf("i32")>=0?"dataInt32":"data";return` + v = uv.${a.data.name}; + ${e!==0?`offset += ${e};`:""} + + arrayOffset = offset; + + t = 0; + + for(var i=0; i < ${a.data.size*(t/4)}; i++) + { + for(var j = 0; j < ${t/4}; j++) + { + ${i}[arrayOffset++] = v[t++]; + } + ${s!==0?`arrayOffset += ${s};`:""} + } + `}function Le(a){return xe(a,"uboWgsl",Ee,ye)}class Y extends Ge{constructor(){super({createUboElements:Re,generateUboSync:Le})}}Y.extension={type:[f.WebGPUSystem],name:"ubo"};const b=128;class ${constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._batchBuffer=new we({minUniformOffsetAlignment:b});const t=256/b;for(let r=0;r{const n={arrayStride:0,stepMode:"vertex",attributes:[]},o=n.attributes;for(const u in t.attributeData){const c=e.attributes[u];(c.divisor??1)!==1&&C(`Attribute ${u} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===i&&(n.arrayStride=c.stride,n.stepMode=c.instance?"instance":"vertex",o.push({shaderLocation:t.attributeData[u].location,offset:c.offset,format:c.format}))}o.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){const e=ke(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment,this._colorTargetCount);this._pipeStateCaches[e]||(this._pipeStateCaches[e]=Object.create(null)),this._pipeCache=this._pipeStateCaches[e]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}}X.extension={type:[f.WebGPUSystem],name:"pipeline"};class ze{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class Fe{init(e,t){this._renderer=e,this._renderTargetSystem=t}copyToTexture(e,t,r,s,i){const n=this._renderer,o=this._getGpuColorTexture(e),u=n.texture.getGpuSource(t.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:o,origin:r},{texture:u,origin:i},s),t}startRenderPass(e,t=!0,r,s){const n=this._renderTargetSystem.getGpuRenderTarget(e),o=this.getDescriptor(e,t,r);n.descriptor=o,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);return t.contexts[0]?t.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,t,r){typeof t=="boolean"&&(t=t?x.ALL:x.NONE);const s=this._renderTargetSystem,i=s.getGpuRenderTarget(e),n=e.colorTextures.map((c,l)=>{const p=i.contexts[l];let h,d;p?h=p.getCurrentTexture().createView():h=this._renderer.texture.getGpuSource(c).createView({mipLevelCount:1}),i.msaaTextures[l]&&(d=h,h=this._renderer.texture.getTextureView(i.msaaTextures[l]));const _=t&x.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:h,resolveTarget:d,clearValue:r,storeOp:"store",loadOp:_}});let o;if((e.stencil||e.depth)&&!e.depthStencilTexture&&(e.ensureDepthStencilTexture(),e.depthStencilTexture.source.sampleCount=i.msaa?4:1),e.depthStencilTexture){const c=t&x.STENCIL?"clear":"load",l=t&x.DEPTH?"clear":"load";o={view:this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:c,depthClearValue:1,depthLoadOp:l,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:o}}clear(e,t=!0,r,s){if(!t)return;const{gpu:i,encoder:n}=this._renderer,o=i.device;if(n.commandEncoder===null){const c=o.createCommandEncoder(),l=this.getDescriptor(e,t,r),p=c.beginRenderPass(l);p.setViewport(s.x,s.y,s.width,s.height,0,1),p.end();const h=c.finish();o.queue.submit([h])}else this.startRenderPass(e,t,r,s)}initGpuRenderTarget(e){e.isRoot=!0;const t=new ze;return t.colorTargetCount=e.colorTextures.length,e.colorTextures.forEach((r,s)=>{if(r instanceof he){const i=r.resource.getContext("webgpu"),n=r.transparent?"premultiplied":"opaque";try{i.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(o){console.error(o)}t.contexts[s]=i}if(t.msaa=r.source.antialias,r.source.antialias){const i=new pe({width:0,height:0,sampleCount:4});t.msaaTextures[s]=i}}),t.msaa&&(t.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),t}destroyGpuRenderTarget(e){e.contexts.forEach(t=>{t.unconfigure()}),e.msaaTextures.forEach(t=>{t.destroy()}),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&t.msaa&&(e.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorTextures.forEach((r,s)=>{t.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution)})}}class Z extends Te{constructor(e){super(e),this.adaptor=new Fe,this.adaptor.init(e,this)}}Z.extension={type:[f.WebGPUSystem],name:"renderTarget"};class J{constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){const t=this._gpu.device,r=e.gpuLayout.map(i=>t.createBindGroupLayout({entries:i})),s={bindGroupLayouts:r};return this._gpuProgramData[e._layoutKey]={bindGroups:r,pipeline:t.createPipelineLayout(s)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}J.extension={type:[f.WebGPUSystem],name:"shader"};const m={};m.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};m.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};m.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};m.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};m.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};m.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};m["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};m["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};m["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};m.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};m.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};m.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}};class Q{constructor(){this.defaultState=new L,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e,t){const r=m[e.blendMode]||m.normal,s=[],i={format:"bgra8unorm",writeMask:0,blend:r};for(let n=0;n>1,1),s=Math.max(s>>1,1)}}},te={type:"image",upload(a,e,t){const r=a.resource;if(!r)return;if(globalThis.HTMLImageElement&&r instanceof HTMLImageElement){const o=P.get().createCanvas(r.width,r.height);o.getContext("2d").drawImage(r,0,0,r.width,r.height),a.resource=o,C("ImageSource: Image element passed, converting to canvas and replacing resource.")}const s=Math.min(e.width,a.resourceWidth||a.pixelWidth),i=Math.min(e.height,a.resourceHeight||a.pixelHeight),n=a.alphaMode==="premultiply-alpha-on-upload";t.device.queue.copyExternalImageToTexture({source:r},{texture:e,premultipliedAlpha:n},{width:s,height:i})}},He={type:"video",upload(a,e,t){te.upload(a,e,t)}};class Ve{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let t=this.pipelines[e];return t||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:` + var pos : array, 3> = array, 3>( + vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0)); + + struct VertexOutput { + @builtin(position) position : vec4, + @location(0) texCoord : vec2, + }; + + @vertex + fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput { + var output : VertexOutput; + output.texCoord = pos[vertexIndex] * vec2(0.5, -0.5) + vec2(0.5); + output.position = vec4(pos[vertexIndex], 0.0, 1.0); + return output; + } + + @group(0) @binding(0) var imgSampler : sampler; + @group(0) @binding(1) var img : texture_2d; + + @fragment + fn fragmentMain(@location(0) texCoord : vec2) -> @location(0) vec4 { + return textureSample(img, imgSampler, texCoord); + } + `})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){const t=this._getMipmapPipeline(e.format);if(e.dimension==="3d"||e.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=e;const s=e.depthOrArrayLayers||1,i=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!i){const u={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};r=this.device.createTexture(u)}const n=this.device.createCommandEncoder({}),o=t.getBindGroupLayout(0);for(let u=0;u1&&this.onUpdateMipmaps(e))}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new Ve(this._gpu.device));const t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceUnload(e){e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this)}onSourceResize(e){e._gcLastUsed=this._renderer.gc.now;const t=e._gpuData[this._renderer.uid],r=t?.gpuTexture;r?(r.width!==e.pixelWidth||r.height!==e.pixelHeight)&&(t.destroy(),this._bindGroupHash[e.uid]=null,e._gpuData[this._renderer.uid]=null,this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuTexture||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]||this._createTextureBindGroup(e)}_createTextureBindGroup(e){const t=e.source;return this._bindGroupHash[e.uid]=new D({0:t,1:t.style,2:new k({uTextureMatrix:{type:"mat3x3",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){const t=e.source;t._gcLastUsed=this._renderer.gc.now;let r=t._gpuData[this._renderer.uid],s=null;return r||(this.initSource(t),r=t._gpuData[this._renderer.uid]),s=r.textureView||r.gpuTexture.createView(),s}generateCanvas(e){const t=this._renderer,r=t.gpu.device.createCommandEncoder(),s=P.get().createCanvas();s.width=e.source.pixelWidth,s.height=e.source.pixelHeight;const i=s.getContext("webgpu");return i.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:P.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:i.getCurrentTexture()},{width:s.width,height:s.height}),t.gpu.device.queue.submit([r.finish()]),s}getPixels(e){const t=this.generateCanvas(e),r=w.getOptimalCanvasAndContext(t.width,t.height),s=r.context;s.drawImage(t,0,0);const{width:i,height:n}=t,o=s.getImageData(0,0,i,n),u=new Uint8ClampedArray(o.data.buffer);return w.returnCanvasAndContext(r),{pixels:u,width:i,height:n}}destroy(){this._managedTextures.destroy();for(const e of Object.keys(this._bindGroupHash)){const t=Number(e);this._bindGroupHash[t]?.destroy()}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null}}re.extension={type:[f.WebGPUSystem],name:"texture"};class se{constructor(){this._maxTextures=0}contextChange(e){const t=new k({uTransformMatrix:{value:new z,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}});this._maxTextures=e.limits.maxBatchableTextures;const r=F({name:"graphics",bits:[le,fe(this._maxTextures),_e,I]});this.shader=new O({gpuProgram:r,resources:{localUniforms:t}})}execute(e,t){const r=t.context,s=r.customShader||this.shader,i=e.renderer,n=i.graphicsContext,{batcher:o,instructions:u}=n.getContextRenderData(r),c=i.encoder;c.setGeometry(o.geometry,s.gpuProgram);const l=i.globalUniforms.bindGroup;c.setBindGroup(0,l,s.gpuProgram);const p=i.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,p,s.gpuProgram);const h=u.instructions;let d=null;for(let _=0;_",value:new z}}}})}execute(e,t){const r=e.renderer;let s=t._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(t.texture);else if(!s.gpuProgram){C("Mesh shader has no gpuProgram",t.shader);return}const i=s.gpuProgram;if(i.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),i.autoAssignLocalUniforms){const n=e.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:t._geometry,shader:s,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}}ie.extension={type:[f.WebGPUPipesAdaptor],name:"mesh"};const je=[...Ce,Y,j,U,K,V,re,Z,J,Q,X,N,q,H],Ke=[...Ue,$],qe=[W,ie,se],ne=[],oe=[],ae=[];B.handleByNamedList(f.WebGPUSystem,ne);B.handleByNamedList(f.WebGPUPipes,oe);B.handleByNamedList(f.WebGPUPipesAdaptor,ae);B.add(...je,...Ke,...qe);class Wt extends me{constructor(){const e={name:"webgpu",type:ge.WEBGPU,systems:ne,renderPipes:oe,renderPipeAdaptors:ae};super(e)}}export{Wt as WebGPURenderer}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Webcam-DQkeURjU.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Webcam-DQkeURjU.js new file mode 100644 index 0000000000000000000000000000000000000000..43bced1aad5b2ad34b25aad1358827e042d49dd9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/Webcam-DQkeURjU.js @@ -0,0 +1 @@ +import{e as Me,f as Pe,p as h,d as Ve,i as A,b as ye,a as xe,k as Fe,L as Ge,u as Xe}from"./i18n-Dnhn5Rxr.js";import{N as Ye,aM as Ze,a as m,f as Ie,R as We,a4 as Se,V as o,Y as n,X as T,Z as $,T as Re,W as x,aa as Je,ae as Ke,t as U,U as w,w as t,a3 as O,x as D,G as F,z as S,au as Qe,S as Q,a6 as ge,A as $e,a0 as G}from"./index-DWyDLubb.js";import{t as et,f as tt}from"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{a as at}from"./actions-CLThs9VH.js";import{D as rt}from"./DropdownArrow-BOSZEGSp.js";import{W as it}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{S as st}from"./Square-CcB54dqq.js";import{S as ot}from"./Spinner-Dhvehhrf.js";import{S as nt}from"./StreamingBar-Cb4g-rUI.js";/* empty css */function lt(l,a,i){var s=Ze(l,a);s&&s.set&&(l[a]=i,Ye(()=>{l[a]=null}))}var ct=Ie('');function vt(l){var a=ct();m(l,a)}var dt=Ie('');function mt(l){var a=dt();m(l,a)}var ut=x('');function _t(l,a){We(a,!1);const i=Se();Me();var s=ut();Pe(s,"",{},{height:"100%"});var M=o(s),b=o(M),j=o(b);it(j),n(b);var u=T(b);u.nodeValue=" Click to Access Webcam",n(M),n(s),$("click",s,()=>i("click")),m(l,s),Re()}function ft(){return navigator.mediaDevices.enumerateDevices()}async function gt(l,a){a.srcObject=l,a.muted=!0,await a.play()}async function De(l,a,i,s){const M={video:s?{deviceId:{exact:s},...i?.video}:i?.video||{width:{ideal:1920},height:{ideal:1440}},audio:l&&(i?.audio??!0)};return navigator.mediaDevices.getUserMedia(M).then(b=>(gt(b,a),b))}function pt(l){return l.filter(i=>i.kind==="videoinput")}var ht=x('
          '),wt=x('
          '),bt=x('
          '),kt=x('
          '),yt=x('
          '),xt=x(''),Dt=x(''),Mt=x(''),It=x(''),Wt=x('
          ',1),St=x('
          ',2);function qt(l,a){We(a,!1);let i=O(),s=O([]),M=O(null),b=h(a,"stream_state",12,"closed"),j,u=h(a,"streaming",12,!1),ee=h(a,"pending",12,!1),te=h(a,"root",12,""),ae=h(a,"stream_every",12,1),B=h(a,"mode",12,"image"),X=h(a,"mirror_webcam",12),Y=h(a,"include_audio",12),Z=h(a,"webcam_constraints",12,null),k=h(a,"i18n",12),re=h(a,"upload",12),q=h(a,"value",12,null),ie=h(a,"time_limit",12,null);const z=Se();Je(()=>{j=document.createElement("canvas"),u()&&B()==="image"&&window.setInterval(()=>{t(i)&&!ee()&&pe()},ae()*1e3)});const Ee=async e=>{const c=e.target.value;await De(Y(),t(i),Z(),c).then(async p=>{H=p,D(M,t(s).find(V=>V.deviceId===c)||null),D(K,!1)})};async function Te(){try{De(Y(),t(i),Z()).then(async e=>{D(N,!0),D(s,await ft()),H=e}).then(()=>pt(t(s))).then(e=>{D(s,e);const r=H.getTracks().map(c=>c.getSettings()?.deviceId)[0];D(M,r?e.find(c=>c.deviceId===r)||t(s)[0]:t(s)[0])}),(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)&&z("error",k()("image.no_webcam_support"))}catch(e){if(e instanceof DOMException&&e.name=="NotAllowedError")z("error",k()("image.allow_webcam_access"));else throw e}}function pe(){if((!u()||u()&&t(I))&&t(i).videoWidth&&t(i).videoHeight){var e=j.getContext("2d");if(j.width=t(i).videoWidth,j.height=t(i).videoHeight,e.drawImage(t(i),0,0,t(i).videoWidth,t(i).videoHeight),X()&&(e.scale(-1,1),e.drawImage(t(i),-t(i).videoWidth,0)),u()&&(!t(I)||b()==="waiting"))return;if(u()){const r=j.toDataURL("image/jpeg");z("stream",r);return}j.toBlob(r=>{z(u()?"stream":"capture",r)},`image/${u()?"jpeg":"png"}`,.8)}}let I=O(!1),se=[],H,P,J;function je(){if(t(I)){J.stop();let e=new Blob(se,{type:P}),r=new FileReader;r.onload=async function(c){if(c.target){let p=new File([e],"sample."+P.substring(6));const V=await Qe([p]);let ve=(await re()(V,te()))?.filter(Boolean)[0];z("capture",ve),z("stop_recording")}},r.readAsDataURL(e)}else if(typeof MediaRecorder<"u"){z("start_recording"),se=[];let e=["video/webm","video/mp4"];for(let r of e)if(MediaRecorder.isTypeSupported(r)){P=r;break}if(P===null){console.error("No supported MediaRecorder mimeType");return}J=new MediaRecorder(H,{mimeType:P}),J.addEventListener("dataavailable",function(r){se.push(r.data)}),J.start(200)}D(I,!t(I))}let N=O(!1);function he({destroy:e}={}){B()==="image"&&u()&&D(I,!t(I)),e||(B()==="image"?pe():je()),!t(I)&&H&&z("close_stream")}let K=O(!1);function oe(e,r){const c=p=>{e&&!e.contains(p.target)&&!p.defaultPrevented&&r(p)};return document.addEventListener("click",c,!0),{destroy(){document.removeEventListener("click",c,!0)}}}function ze(e){e.preventDefault(),e.stopPropagation(),D(K,!1)}Ke(()=>{typeof window>"u"||(he({destroy:!0}),H?.getTracks().forEach(e=>e.stop()))});var Be={click_outside:oe,get stream_state(){return b()},set stream_state(e){b(e),w()},get streaming(){return u()},set streaming(e){u(e),w()},get pending(){return ee()},set pending(e){ee(e),w()},get root(){return te()},set root(e){te(e),w()},get stream_every(){return ae()},set stream_every(e){ae(e),w()},get mode(){return B()},set mode(e){B(e),w()},get mirror_webcam(){return X()},set mirror_webcam(e){X(e),w()},get include_audio(){return Y()},set include_audio(e){Y(e),w()},get webcam_constraints(){return Z()},set webcam_constraints(e){Z(e),w()},get i18n(){return k()},set i18n(e){k(e),w()},get upload(){return re()},set upload(e){re(e),w()},get value(){return q()},set value(e){q(e),w()},get time_limit(){return ie()},set time_limit(e){ie(e),w()}};Me();var ne=St(),we=o(ne);nt(we,{get time_limit(){return ie()}});var le=T(we,2);let be;Ve(le,e=>D(i,e),()=>t(i));var ce=T(le,2);let ke;var Ce=T(ce,2);{var Le=e=>{var r=ht(),c=o(r);_t(c,{$$events:{click:async()=>Te()}}),n(r),et(1,r,()=>tt,()=>({delay:100,duration:200})),m(e,r)},Ae=e=>{var r=Wt(),c=Q(r),p=o(c),V=o(p);{var ve=g=>{var v=ge(),C=Q(v);{var de=_=>{var d=wt(),R=o(d),L=o(R);ot(L),n(R);var y=T(R);n(d),U(f=>G(y,` ${f??""}`),[()=>(F(k()),S(()=>k()("audio.waiting")))]),m(_,d)},me=_=>{var d=ge(),R=Q(d);{var L=f=>{var E=bt(),W=o(E),ue=o(W);st(ue,{}),n(W);var _e=T(W);n(E),U(fe=>G(_e,` ${fe??""}`),[()=>(F(k()),S(()=>k()("audio.stop")))]),m(f,E)},y=f=>{var E=kt(),W=o(E),ue=o(W);mt(ue),n(W);var _e=T(W);n(E),U(fe=>G(_e,` ${fe??""}`),[()=>(F(k()),S(()=>k()("audio.record")))]),m(f,E)};A(R,f=>{u()&&b()==="open"||!u()&&t(I)?f(L):f(y,!1)},!0)}m(_,d)};A(C,_=>{u()&&b()==="waiting"?_(de):_(me,!1)})}m(g,v)},Ue=g=>{var v=yt(),C=o(v);vt(C),n(v),m(g,v)};A(V,g=>{B()==="video"||u()?g(ve):g(Ue,!1)})}n(p);var qe=T(p,2);{var He=g=>{var v=xt(),C=o(v);rt(C),n(v),$("click",v,()=>D(K,!0)),m(g,v)};A(qe,g=>{t(I)||g(He)})}n(c);var Ne=T(c,2);{var Oe=g=>{var v=It(),C=o(v);{var de=_=>{var d=Dt(),R=o(d,!0);n(d),d.value=d.__value="",U(L=>G(R,L),[()=>(F(k()),S(()=>k()("common.no_devices")))]),m(_,d)},me=_=>{var d=ge(),R=Q(d);Fe(R,1,()=>t(s),Xe,(L,y)=>{var f=Mt(),E=o(f,!0);n(f);var W={};U(()=>{Ge(f,(t(M),t(y),S(()=>t(M).deviceId===t(y).deviceId))),G(E,(t(y),S(()=>t(y).label))),W!==(W=(t(y),S(()=>t(y).deviceId)))&&(f.value=(f.__value=(t(y),S(()=>t(y).deviceId)))??"")}),m(L,f)}),m(_,d)};A(C,_=>{t(s),S(()=>t(s).length===0)?_(de):_(me,!1)})}n(v),at(v,(_,d)=>oe?.(_,d),()=>ze),$e(()=>$("change",v,Ee)),m(g,v)};A(Ne,g=>{t(K)&&t(M)&&g(Oe)})}U(()=>xe(p,"aria-label",B()==="image"?"capture photo":"start recording")),$("click",p,()=>he()),m(e,r)};A(Ce,e=>{t(N)?e(Ae,!1):e(Le)})}return n(ne),U(()=>{be=ye(le,1,"svelte-1tktvmr",null,be,{flip:X(),hide:!t(N)||t(N)&&!!q()}),xe(ce,"src",(F(q()),S(()=>q()?.url))),ke=ye(ce,1,"svelte-1tktvmr",null,ke,{hide:!t(N)||t(N)&&!q()})}),m(l,ne),lt(a,"click_outside",oe),Re(Be)}export{mt as C,qt as W,lt as b}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/__vite-browser-external-D7Ct-6yo.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/__vite-browser-external-D7Ct-6yo.js new file mode 100644 index 0000000000000000000000000000000000000000..4dcbe31a919106e2d2831350edcc72dc650d8cf8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/__vite-browser-external-D7Ct-6yo.js @@ -0,0 +1 @@ +const e={},t=Object.freeze(Object.defineProperty({__proto__:null,default:e},Symbol.toStringTag,{value:"Module"}));export{t as _}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/_baseUniq-DT1kfcxk.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/_baseUniq-DT1kfcxk.js new file mode 100644 index 0000000000000000000000000000000000000000..4e3d7c217c888963ac077cd0d84f3c31bb809fc0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/_baseUniq-DT1kfcxk.js @@ -0,0 +1 @@ +import{az as x,aP as ln,an as A,ax as v,am as W,aQ as gn,aR as dn,aS as hn,aT as z,aU as pn,aV as An,aW as m,aA as N,aF as U,aI as R,aX as _n,aD as on,aY as wn,aZ as On,ao as V,a_ as Pn,a$ as S}from"./mermaid.core-7TB2QPZo.js";var vn="[object Symbol]";function b(n){return typeof n=="symbol"||x(n)&&ln(n)==vn}function yn(n,r){for(var e=-1,i=n==null?0:n.length,f=Array(i);++e-1}function M(n){return W(n)?gn(n):dn(n)}var xn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bn=/^\w*$/;function $(n,r){if(A(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||b(n)?!0:bn.test(n)||!xn.test(n)||r!=null&&n in Object(r)}var Mn=500;function $n(n){var r=hn(n,function(i){return e.size===Mn&&e.clear(),i}),e=r.cache;return r}var Cn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Dn=/\\(\\)?/g,Fn=$n(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(Cn,function(e,i,f,t){r.push(f?t.replace(Dn,"$1"):i||e)}),r});function Gn(n){return n==null?"":k(n)}function j(n,r){return A(n)?n:$(n,r)?[n]:Fn(Gn(n))}function I(n){if(typeof n=="string"||b(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function nn(n,r){r=j(r,n);for(var e=0,i=r.length;n!=null&&eu))return!1;var h=t.get(n),g=t.get(r);if(h&&g)return h==r&&g==n;var l=-1,d=!0,o=e&zn?new y:void 0;for(t.set(n,r),t.set(r,n);++l=Br){var h=r?null:Ur(n);if(h)return C(h);s=!1,f=tn,a=new y}else a=r?[]:u;n:for(;++i{t[s]=o,t._internalCount++,t._internalCount===6&&n(t)},l=(o,f)=>{r&&o&&r(o.status+" "+o.statusText,f)};this._loadFile(i,a,void 0,void 0,!0,l)};x.prototype._cascadeLoadFiles=function(i,s,t,n=null){const r=[];r._internalCount=0;for(let a=0;a<6;a++)this._partialLoadFile(t[a],a,r,s,n)};x.prototype._cascadeLoadImgs=function(i,s,t,n,r=null,a){const l=[];l._internalCount=0;for(let o=0;o<6;o++)this._partialLoadImg(n[o],o,l,i,s,t,r,a)};x.prototype._partialLoadImg=function(i,s,t,n,r,a,l=null,o){const f=D();A(i,_=>{t[s]=_,t._internalCount++,n&&n.removePendingData(f),t._internalCount===6&&a&&a(r,t)},(_,c)=>{n&&n.removePendingData(f),l&&l(_,c)},n?n.offlineProvider:null,o),n&&n.addPendingData(f)};x.prototype.createCubeTextureBase=function(i,s,t,n,r=null,a=null,l,o=null,f=!1,L=0,T=0,_=null,c=null,C=null,y=!1,g=null){const e=_||new R(this,7);e.isCube=!0,e.url=i,e.generateMipMaps=!n,e._lodGenerationScale=L,e._lodGenerationOffset=T,e._useSRGBBuffer=!!y&&this._caps.supportSRGBBuffers&&(this.version>1||this.isWebGPU||!!n),e!==_&&(e.label=i.substring(0,60)),this._doNotHandleContextLost||(e._extension=o,e._files=t,e._buffer=g);const m=i;this._transformTextureUrl&&!_&&(i=this._transformTextureUrl(i));const P=o??W(i),G=B(P),p=(u,d)=>{e.dispose(),a?a(u,d):u&&I.Warn(u)},F=(u,d)=>{i===m?u&&p(u.status+" "+u.statusText,d):(I.Warn(`Failed to load ${i}, falling back to the ${m}`),this.createCubeTextureBase(m,s,t,!!n,r,p,l,o,f,L,T,e,c,C,y,g))};if(G)G.then(u=>{const d=h=>{c&&c(e,h),u.loadCubeData(h,e,f,r,(w,v)=>{p(w,v)})};g?d(g):t&&t.length===6?u.supportCascades?this._cascadeLoadFiles(s,h=>d(h.map(w=>new Uint8Array(w))),t,p):p("Textures type does not support cascades."):this._loadFile(i,h=>d(new Uint8Array(h)),void 0,s?s.offlineProvider||null:void 0,!0,F)});else{if(!t||t.length===0)throw new Error("Cannot load cubemap because files were not defined, or the correct loader was not found.");this._cascadeLoadImgs(s,e,(u,d)=>{C&&C(u,d)},t,p)}return this._internalTexturesCache.push(e),e}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/abstractSoundInstance-Cb1S6dEM.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/abstractSoundInstance-Cb1S6dEM.js new file mode 100644 index 0000000000000000000000000000000000000000..bba6a4e8d84e0e91aa3934b312e9239ba6c238ed --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/abstractSoundInstance-Cb1S6dEM.js @@ -0,0 +1 @@ +import{O as i}from"./index-CDrXokXW.js";import{A as r}from"./abstractSoundSource-D3oGzC3p.js";import{A as o}from"./audioEngine-C797_5QL.js";class l extends r{constructor(t,s,e){super(t,s,e,3),this._newestInstance=null,this._privateInstances=new Set,this._state=1,this._instances=this._privateInstances,this.onEndedObservable=new i,this._onInstanceEnded=n=>{this._newestInstance===n&&(this._newestInstance=null),this._privateInstances.delete(n),this._instances.size===0&&(this._state=1,this.onEndedObservable.notifyObservers(this)),n.dispose()}}get activeInstancesCount(){return this._instances.size}get autoplay(){return this._options.autoplay}get currentTime(){const t=this._getNewestInstance();return t?t.currentTime:0}set currentTime(t){this.startOffset=t;const s=this._getNewestInstance();s&&(s.currentTime=t)}get loop(){return this._options.loop}set loop(t){this._options.loop=t}get maxInstances(){return this._options.maxInstances}set maxInstances(t){this._options.maxInstances=t}get startOffset(){return this._options.startOffset}set startOffset(t){this._options.startOffset=t}get state(){return this._state}dispose(){super.dispose(),this.stop(),this._newestInstance=null,this._privateInstances.clear(),this.onEndedObservable.clear()}pause(){const t=this._instances.values();for(let s=t.next();!s.done;s=t.next())s.value.pause();this._state=5}resume(){if(this._state!==5)return;const t=this._instances.values();for(let s=t.next();!s.done;s=t.next())s.value.resume();this._state=3}_beforePlay(t){if(this.state===5&&this._instances.size>0){this.resume();return}t.onEndedObservable.addOnce(this._onInstanceEnded),this._privateInstances.add(t),this._newestInstance=t}_afterPlay(t){this._state=t.state}_getNewestInstance(){if(this._instances.size===0)return null;if(!this._newestInstance){const t=this._instances.values();for(let s=t.next();!s.done;s=t.next())this._newestInstance=s.value}return this._newestInstance}_setState(t){this._state=t}_stopExcessInstances(){if(this.maxInstances<1/0){const t=Array.from(this._instances).filter(e=>e.state===3).length-this.maxInstances,s=this._instances.values();for(let e=0;e{this._outBus=null},this._outBus.onDisposeObservable.add(this._onOutBusDisposed),!this._connect(this._outBus)))throw new Error("Connect failed")}}get spatial(){return this._spatial?this._spatial:this._initSpatialProperty()}dispose(){super.dispose(),this._spatial?.dispose(),this._spatial=null,this._outBus&&this._onOutBusDisposed&&(this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed),this._onOutBusDisposed=null),this._outBus=null}_initSpatialProperty(){return this._spatial=this._createSpatialProperty(this._spatialAutoUpdate,this._spatialMinUpdateTime)}get _isSpatial(){return this._spatial!==null}set _isSpatial(t){t&&!this._spatial?this._initSpatialProperty():!t&&this._spatial&&(this._spatial.dispose(),this._spatial=null)}}export{p as A}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/actions-CLThs9VH.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/actions-CLThs9VH.js new file mode 100644 index 0000000000000000000000000000000000000000..7dc4ddbccd0d4aea5d35b1c1cf99e998eaa3267c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/actions-CLThs9VH.js @@ -0,0 +1 @@ +import{A as d,z as n,B as u,G as c,I as p}from"./index-DWyDLubb.js";function y(s,o,r){d(()=>{var a=n(()=>o(s,r?.())||{});if(r&&a?.update){var t=!1,f={};u(()=>{var e=r();c(e),t&&p(f,e)&&(f=e,a.update(e))}),t=!0}if(a?.destroy)return()=>a.destroy()})}export{y as a}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/animationGroup-CCzMCPMh.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/animationGroup-CCzMCPMh.js new file mode 100644 index 0000000000000000000000000000000000000000..0c4d39c56a722245d9c073543a5c84003eb93ac2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/animationGroup-CCzMCPMh.js @@ -0,0 +1 @@ +import{as as A,M as F,bs as x,bt as E,bu as R,bv as M,bw as N,bx as B,by as k,O as P,c as T,ao as S,V as C,b as D,aq as W,bi as w,aY as K}from"./index-CDrXokXW.js";import{B as Y}from"./bone-z620UXj2.js";import"./index-DWyDLubb.js";class U{get currentFrame(){return this._currentFrame}get weight(){return this._weight}get currentValue(){return this._currentValue}get targetPath(){return this._targetPath}get target(){return this._currentActiveTarget}get isAdditive(){return this._host&&this._host.isAdditive}constructor(t,e,i,n){if(this._events=new Array,this._currentFrame=0,this._originalValue=new Array,this._originalBlendValue=null,this._offsetsCache={},this._highLimitsCache={},this._stopped=!1,this._blendingFactor=0,this._currentValue=null,this._currentActiveTarget=null,this._directTarget=null,this._targetPath="",this._weight=1,this._absoluteFrameOffset=0,this._previousElapsedTime=0,this._yoyoDirection=1,this._previousAbsoluteFrame=0,this._targetIsArray=!1,this._coreRuntimeAnimation=null,this._animation=e,this._target=t,this._scene=i,this._host=n,this._activeTargets=[],e._runtimeAnimations.push(this),this._animationState={key:0,repeatCount:0,loopMode:this._getCorrectLoopMode()},this._animation.dataType===A.ANIMATIONTYPE_MATRIX&&(this._animationState.workValue=F.Zero()),this._keys=this._animation.getKeys(),this._minFrame=this._keys[0].frame,this._maxFrame=this._keys[this._keys.length-1].frame,this._minFrame!==0){const a={frame:0,value:this._keys[0].value};this._keys.splice(0,0,a)}if(this._target instanceof Array){let a=0;for(const o of this._target)this._preparePath(o,a),this._getOriginalValues(a),a++;this._targetIsArray=!0}else this._preparePath(this._target),this._getOriginalValues(),this._targetIsArray=!1,this._directTarget=this._activeTargets[0];const s=e.getEvents();if(s&&s.length>0)for(const a of s)this._events.push(a._clone());this._enableBlending=t&&t.animationPropertiesOverride?t.animationPropertiesOverride.enableBlending:this._animation.enableBlending}_preparePath(t,e=0){const i=this._animation.targetPropertyPath;if(i.length>1){let n=t;for(let s=0;s-1&&this._animation.runtimeAnimations.splice(t,1)}setValue(t,e){if(this._targetIsArray){for(let i=0;ii[i.length-1].frame&&(t=i[i.length-1].frame);const n=this._events;if(n.length)for(let a=0;athis._maxFrame)&&(e=this._minFrame),(ithis._maxFrame)&&(i=this._maxFrame),g=i-e;let _,m=t*(o.framePerSecond*s)/1e3+this._absoluteFrameOffset,b=0,O=!1;const v=n&&this._animationState.loopMode===A.ANIMATIONLOOPMODE_YOYO;if(v){const f=(m-e)/g,p=Math.sin(f*Math.PI);m=Math.abs(p)*g+e;const I=p>=0?1:-1;this._yoyoDirection!==I&&(O=!0),this._yoyoDirection=I}if(this._previousElapsedTime=t,this._previousAbsoluteFrame=m,!n&&i>=e&&(m>=g&&s>0||m<=0&&s<0))l=!1,b=o.evaluate(i);else if(!n&&e>=i&&(m<=g&&s<0||m>=0&&s>0))l=!1,b=o.evaluate(e);else if(this._animationState.loopMode!==A.ANIMATIONLOOPMODE_CYCLE){const f=i.toString()+e.toString();if(!this._offsetsCache[f]){this._animationState.repeatCount=0,this._animationState.loopMode=A.ANIMATIONLOOPMODE_CYCLE;const p=o._interpolate(e,this._animationState),y=o._interpolate(i,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),o.dataType){case A.ANIMATIONTYPE_FLOAT:this._offsetsCache[f]=y-p;break;case A.ANIMATIONTYPE_QUATERNION:this._offsetsCache[f]=y.subtract(p);break;case A.ANIMATIONTYPE_VECTOR3:this._offsetsCache[f]=y.subtract(p);break;case A.ANIMATIONTYPE_VECTOR2:this._offsetsCache[f]=y.subtract(p);break;case A.ANIMATIONTYPE_SIZE:this._offsetsCache[f]=y.subtract(p);break;case A.ANIMATIONTYPE_COLOR3:this._offsetsCache[f]=y.subtract(p);break}this._highLimitsCache[f]=y}b=this._highLimitsCache[f],_=this._offsetsCache[f]}if(_===void 0)switch(o.dataType){case A.ANIMATIONTYPE_FLOAT:_=0;break;case A.ANIMATIONTYPE_QUATERNION:_=B;break;case A.ANIMATIONTYPE_VECTOR3:_=N;break;case A.ANIMATIONTYPE_VECTOR2:_=M;break;case A.ANIMATIONTYPE_SIZE:_=R;break;case A.ANIMATIONTYPE_COLOR3:_=E;break;case A.ANIMATIONTYPE_COLOR4:_=x;break}if(this._host&&this._host.syncRoot){const f=this._host.syncRoot,p=(f.masterFrame-f.fromFrame)/(f.toFrame-f.fromFrame);u=e+g*p}else m>0&&e>i||m<0&&e0&&this.currentFrame>u||s<0&&this.currentFrame0?0:o.getKeys().length-1}this._currentFrame=u,this._animationState.repeatCount=g===0?0:m/g>>0,this._animationState.highLimitValue=b,this._animationState.offsetValue=_}const d=o._interpolate(u,this._animationState);if(this.setValue(d,a),c.length){for(let _=0;_=0&&u>=c[_].frame&&c[_].frame>=e||g<0&&u<=c[_].frame&&c[_].frame<=e){const m=c[_];m.isDone||(m.onlyOnce&&(c.splice(_,1),_--),m.isDone=!0,m.action(u))}}return l||(this._stopped=!0),l}}class L{get syncRoot(){return this._syncRoot}get masterFrame(){return this._runtimeAnimations.length===0?0:this._runtimeAnimations[0].currentFrame}get weight(){return this._weight}set weight(t){if(t===-1){this._weight=-1;return}this._weight=Math.min(Math.max(t,0),1)}get speedRatio(){return this._speedRatio}set speedRatio(t){for(let e=0;e-1&&(this._scene._activeAnimatables.splice(e,1),this._scene._activeAnimatables.push(this))}return this}getAnimations(){return this._runtimeAnimations}appendAnimations(t,e){for(let i=0;i{this.onAnimationLoopObservable.notifyObservers(this),this.onAnimationLoop&&this.onAnimationLoop()},this._runtimeAnimations.push(s)}}getAnimationByTargetProperty(t){const e=this._runtimeAnimations;for(let i=0;i-1){const a=this._runtimeAnimations;for(let o=a.length-1;o>=0;o--){const r=a[o];t&&r.animation.name!=t||e&&!e(r.target)||(r.dispose(),a.splice(o,1))}a.length==0&&(i||this._scene._activeAnimatables.splice(s,1),n||this._raiseOnAnimationEnd())}}else{const s=this._scene._activeAnimatables.indexOf(this);if(s>-1){i||this._scene._activeAnimatables.splice(s,1);const a=this._runtimeAnimations;for(let o=0;o{this.onAnimationEndObservable.add(()=>{t(this)},void 0,void 0,this,!0)})}_animate(t){if(this._paused)return this.animationStarted=!1,this._pausedDelay===null&&(this._pausedDelay=t),!0;if(this._localDelayOffset===null?(this._localDelayOffset=t,this._pausedDelay=null):this._pausedDelay!==null&&(this._localDelayOffset+=t-this._pausedDelay,this._pausedDelay=null),this._manualJumpDelay!==null&&(this._localDelayOffset+=this.speedRatio<0?-this._manualJumpDelay:this._manualJumpDelay,this._manualJumpDelay=null,this._frameToSyncFromJump=null),this._goToFrame=null,!L.ProcessPausedAnimatables&&this._weight===0&&this._previousWeight===0)return!0;this._previousWeight=this._weight;let e=!1;const i=this._runtimeAnimations;let n;for(n=0;n0?r:-r,n),d.scaleAndAddToRef(r,e)}n.normalize()}for(let c=0;c0)n.copyFrom(i);else if(h.animations.length===1){if(S.SlerpToRef(i,e.currentValue,Math.min(1,h.totalWeight),n),h.totalAdditiveWeight===0)return n}else if(h.animations.length>1){let s=1,a,o;if(h.totalWeight<1){const l=1-h.totalWeight;a=[],o=[],a.push(i),o.push(l)}else{if(h.animations.length===2&&(S.SlerpToRef(h.animations[0].currentValue,h.animations[1].currentValue,h.animations[1].weight/h.totalWeight,t),h.totalAdditiveWeight===0))return t;a=[],o=[],s=h.totalWeight}for(let l=0;l=r&&v.frame<=l&&(s?(p=v.value.clone(),_?(f=p.getTranslation(),p.setTranslation(f.scaleInPlace(m))):b&&a?(f=p.getTranslation(),p.setTranslation(f.multiplyInPlace(a))):p=v.value):p=v.value,O.push({frame:v.frame+n,value:p}));return this.animations[0].createRange(i,r+n,l+n),!0}),h&&(h.prototype._animate=function(e){if(!this.animationsEnabled)return;const i=k.Now;if(!this._animationTimeLast){if(this._pendingData.length>0)return;this._animationTimeLast=i}this.deltaTime=e!==void 0?e:this.useConstantAnimationDeltaTime?16:(i-this._animationTimeLast)*this.animationTimeScale,this._animationTimeLast=i;const n=this._activeAnimatables;if(n.length===0)return;this._animationTime+=this.deltaTime;const s=this._animationTime;for(let a=0;ae.playOrder-i.playOrder)},h.prototype.beginWeightedAnimation=function(e,i,n,s=1,a,o=1,r,l,u,c,g=!1){const d=this.beginAnimation(e,i,n,a,o,r,l,!1,u,c,g);return d.weight=s,d},h.prototype.beginAnimation=function(e,i,n,s,a=1,o,r,l=!0,u,c,g=!1){if(a<0){const _=i;i=n,n=_,a=-a}i>n&&(a=-a),l&&this.stopAnimation(e,void 0,u),r||(r=new L(this,e,i,n,s,a,o,void 0,c,g));const d=u?u(e):!0;if(e.animations&&d&&r.appendAnimations(e,e.animations),e.getAnimatables){const _=e.getAnimatables();for(let m=0;m<_.length;m++)this.beginAnimation(_[m],i,n,s,a,o,r,l,u,c)}return r.reset(),r},h.prototype.beginHierarchyAnimation=function(e,i,n,s,a,o=1,r,l,u=!0,c,g,d=!1){const _=e.getDescendants(i),m=[];m.push(this.beginAnimation(e,n,s,a,o,r,l,u,c,void 0,d));for(const b of _)m.push(this.beginAnimation(b,n,s,a,o,r,l,u,c,void 0,d));return m},h.prototype.beginDirectAnimation=function(e,i,n,s,a,o=1,r,l,u=!1){if(o<0){const g=n;n=s,s=g,o=-o}return n>s&&(o=-o),new L(this,e,n,s,a,o,r,i,l,u)},h.prototype.beginDirectHierarchyAnimation=function(e,i,n,s,a,o,r,l,u,c=!1){const g=e.getDescendants(i),d=[];d.push(this.beginDirectAnimation(e,n,s,a,o,r,l,u,c));for(const _ of g)d.push(this.beginDirectAnimation(_,n,s,a,o,r,l,u,c));return d},h.prototype.getAnimatableByTarget=function(e){for(let i=0;i0)){for(let e=0;ea&&(a=r.to);const o=new V(t[0].name+"_merged",t[0]._scene,n);for(const r of t){i&&r.normalize(s,a);for(const l of r.targetedAnimations)o.addTargetedAnimation(l.animation,l.target);e&&r.dispose()}return o}getScene(){return this._scene}constructor(t,e=null,i=-1,n=0){this.name=t,this._targetedAnimations=new Array,this._animatables=new Array,this._from=Number.MAX_VALUE,this._to=-Number.MAX_VALUE,this._speedRatio=1,this._loopAnimation=!1,this._isAdditive=!1,this._weight=-1,this._playOrder=0,this._enableBlending=null,this._blendingSpeed=null,this._numActiveAnimatables=0,this._shouldStart=!0,this._parentContainer=null,this.onAnimationEndObservable=new P,this.onAnimationLoopObservable=new P,this.onAnimationGroupLoopObservable=new P,this.onAnimationGroupEndObservable=new P,this.onAnimationGroupPauseObservable=new P,this.onAnimationGroupPlayObservable=new P,this.metadata=null,this._mask=null,this._animationLoopFlags=[],this._scene=e||W.LastCreatedScene,this._weight=i,this._playOrder=n,this.uniqueId=this._scene.getUniqueId(),this._scene.addAnimationGroup(this)}addTargetedAnimation(t,e){const i=new q(this);i.animation=t,i.target=e;const n=t.getKeys();return this._from>n[0].frame&&(this._from=n[0].frame),this._to-1;e--)this._targetedAnimations[e].animation===t&&this._targetedAnimations.splice(e,1)}normalize(t=null,e=null){t==null&&(t=this._from),e==null&&(e=this._to);for(let i=0;it){const r={frame:t,value:a.value,inTangent:a.inTangent,outTangent:a.outTangent,interpolation:a.interpolation};s.splice(0,0,r)}if(o.frame{this.onAnimationLoopObservable.notifyObservers(e),!this._animationLoopFlags[i]&&(this._animationLoopFlags[i]=!0,this._animationLoopCount++,this._animationLoopCount===this._numActiveAnimatables&&(this.onAnimationGroupLoopObservable.notifyObservers(this),this._animationLoopCount=0,this._animationLoopFlags.length=0))}}start(t=!1,e=1,i,n,s){if(this._isStarted||this._targetedAnimations.length===0)return this;this._loopAnimation=t,this._shouldStart=!1,this._animationLoopCount=0,this._animationLoopFlags.length=0;for(let a=0;a{this.onAnimationEndObservable.notifyObservers(o),this._checkAnimationGroupEnded(r)},this._processLoop(r,o,a),this._animatables.push(r)}return this.syncWithMask(),this._scene.sortActiveAnimatables(),this._speedRatio=e,this._isStarted=!0,this._isPaused=!1,this.onAnimationGroupPlayObservable.notifyObservers(this),this}pause(){if(!this._isStarted)return this;this._isPaused=!0;for(let t=0;t0?this._scene._activeAnimatables[i++]=s:t&&this._checkAnimationGroupEnded(s,t)}return this._scene._activeAnimatables.length=i,this._isStarted=!1,this}setWeightForAllAnimatables(t){for(let e=0;e-1&&this._parentContainer.animationGroups.splice(t,1),this._parentContainer=null}this.onAnimationEndObservable.clear(),this.onAnimationGroupEndObservable.clear(),this.onAnimationGroupPauseObservable.clear(),this.onAnimationGroupPlayObservable.clear(),this.onAnimationLoopObservable.clear(),this.onAnimationGroupLoopObservable.clear()}_checkAnimationGroupEnded(t,e=!1){const i=this._animatables.indexOf(t);i>-1&&this._animatables.splice(i,1),this._animatables.length===this._targetedAnimations.length-this._numActiveAnimatables&&(this._isStarted=!1,e||this.onAnimationGroupEndObservable.notifyObservers(this),this._animatables.length=0)}clone(t,e,i=!1){const n=new V(t||this.name,this._scene,this._weight,this._playOrder);n._from=this.from,n._to=this.to,n._speedRatio=this.speedRatio,n._loopAnimation=this.loopAnimation,n._isAdditive=this.isAdditive,n._enableBlending=this.enableBlending,n._blendingSpeed=this.blendingSpeed,n.metadata=this.metadata,n.mask=this.mask;for(const s of this._targetedAnimations)n.addTargetedAnimation(i?s.animation.clone():s.animation,e?e(s.target):s.target);return n}serialize(){const t={};t.name=this.name,t.from=this.from,t.to=this.to,t.speedRatio=this.speedRatio,t.loopAnimation=this.loopAnimation,t.isAdditive=this.isAdditive,t.weight=this.weight,t.playOrder=this.playOrder,t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed,t.targetedAnimations=[];for(let e=0;em[0].frame&&(l=m[0].frame),u=e&&m<=i||s&&b.frame>=e&&b.frame<=i){const O={frame:b.frame,value:b.value.clone?b.value.clone():b.value,inTangent:b.inTangent,outTangent:b.outTangent,interpolation:b.interpolation,lockedTangent:b.lockedTangent};_===Number.MAX_VALUE&&(_=O.frame),O.frame-=_,d.push(O)}}if(d.length===0){r.splice(l,1),l--;continue}a>d[0].frame&&(a=d[0].frame),or*r+G*G&&(S=w,z=p),{cx:S,cy:z,x01:-n,y01:-d,x11:S*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=gn,E=B(0),q=null,v=yn,A=dn,C=mn,a=null,I=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,F=rn(c-f),t=c>f;if(a||(a=n=I()),sg))a.moveTo(0,0);else if(F>tn-g)a.moveTo(s*H(f),s*j(f)),a.arc(0,0,s,f,c,!t),u>g&&(a.moveTo(u*H(c),u*j(c)),a.arc(0,0,u,c,f,t));else{var m=f,y=c,R=f,T=c,P=F,O=F,S=C.apply(this,arguments)/2,z=S>g&&(q?+q.apply(this,arguments):L(u*u+s*s)),w=_(rn(s-u)/2,+E.apply(this,arguments)),p=w,x=w,e,r;if(z>g){var G=sn(z/u*j(S)),M=sn(z/s*j(S));(P-=G*2)>g?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(O-=M*2)>g?(M*=t?1:-1,m+=M,y-=M):(O=0,m=y=(f+c)/2)}var J=s*H(m),K=s*j(m),N=u*H(T),Q=u*j(T);if(w>g){var U=s*H(y),V=s*j(y),X=u*H(R),Y=u*j(R),D;if(Fg?x>g?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),xg)||!(P>g)?a.lineTo(N,Q):p>g?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),po?(this.rect.x-=(this.labelWidth-o)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(o+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(s+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>s?(this.rect.y-=(this.labelHeight-s)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(s+this.labelHeight))}}},i.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==h.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},i.prototype.transform=function(t){var o=this.rect.x;o>e.WORLD_BOUNDARY?o=e.WORLD_BOUNDARY:o<-e.WORLD_BOUNDARY&&(o=-e.WORLD_BOUNDARY);var s=this.rect.y;s>e.WORLD_BOUNDARY?s=e.WORLD_BOUNDARY:s<-e.WORLD_BOUNDARY&&(s=-e.WORLD_BOUNDARY);var c=new l(o,s),f=t.inverseTransformPoint(c);this.setLocation(f.x,f.y)},i.prototype.getLeft=function(){return this.rect.x},i.prototype.getRight=function(){return this.rect.x+this.rect.width},i.prototype.getTop=function(){return this.rect.y},i.prototype.getBottom=function(){return this.rect.y+this.rect.height},i.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},M.exports=i}),(function(M,G,N){var d=N(0);function h(){}for(var a in d)h[a]=d[a];h.MAX_ITERATIONS=2500,h.DEFAULT_EDGE_LENGTH=50,h.DEFAULT_SPRING_STRENGTH=.45,h.DEFAULT_REPULSION_STRENGTH=4500,h.DEFAULT_GRAVITY_STRENGTH=.4,h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,h.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,h.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,h.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,h.COOLING_ADAPTATION_FACTOR=.33,h.ADAPTATION_LOWER_NODE_LIMIT=1e3,h.ADAPTATION_UPPER_NODE_LIMIT=5e3,h.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,h.MAX_NODE_DISPLACEMENT=h.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,h.MIN_REPULSION_DIST=h.DEFAULT_EDGE_LENGTH/10,h.CONVERGENCE_CHECK_PERIOD=100,h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,h.MIN_EDGE_LENGTH=1,h.GRID_CALCULATION_CHECK_PERIOD=10,M.exports=h}),(function(M,G,N){function d(h,a){h==null&&a==null?(this.x=0,this.y=0):(this.x=h,this.y=a)}d.prototype.getX=function(){return this.x},d.prototype.getY=function(){return this.y},d.prototype.setX=function(h){this.x=h},d.prototype.setY=function(h){this.y=h},d.prototype.getDifference=function(h){return new DimensionD(this.x-h.x,this.y-h.y)},d.prototype.getCopy=function(){return new d(this.x,this.y)},d.prototype.translate=function(h){return this.x+=h.width,this.y+=h.height,this},M.exports=d}),(function(M,G,N){var d=N(2),h=N(10),a=N(0),e=N(7),r=N(3),l=N(1),i=N(13),u=N(12),t=N(11);function o(c,f,T){d.call(this,T),this.estimatedSize=h.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,f!=null&&f instanceof e?this.graphManager=f:f!=null&&f instanceof Layout&&(this.graphManager=f.graphManager)}o.prototype=Object.create(d.prototype);for(var s in d)o[s]=d[s];o.prototype.getNodes=function(){return this.nodes},o.prototype.getEdges=function(){return this.edges},o.prototype.getGraphManager=function(){return this.graphManager},o.prototype.getParent=function(){return this.parent},o.prototype.getLeft=function(){return this.left},o.prototype.getRight=function(){return this.right},o.prototype.getTop=function(){return this.top},o.prototype.getBottom=function(){return this.bottom},o.prototype.isConnected=function(){return this.isConnected},o.prototype.add=function(c,f,T){if(f==null&&T==null){var g=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(g)>-1)throw"Node already in graph!";return g.owner=this,this.getNodes().push(g),g}else{var v=c;if(!(this.getNodes().indexOf(f)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(f.owner==T.owner&&f.owner==this))throw"Both owners must be this graph!";return f.owner!=T.owner?null:(v.source=f,v.target=T,v.isInterGraph=!1,this.getEdges().push(v),f.edges.push(v),T!=f&&T.edges.push(v),v)}},o.prototype.remove=function(c){var f=c;if(c instanceof r){if(f==null)throw"Node is null!";if(!(f.owner!=null&&f.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=f.edges.slice(),g,v=T.length,L=0;L-1&&b>-1))throw"Source and/or target doesn't know this edge!";g.source.edges.splice(A,1),g.target!=g.source&&g.target.edges.splice(b,1);var F=g.source.owner.getEdges().indexOf(g);if(F==-1)throw"Not in owner's edge list!";g.source.owner.getEdges().splice(F,1)}},o.prototype.updateLeftTop=function(){for(var c=h.MAX_VALUE,f=h.MAX_VALUE,T,g,v,L=this.getNodes(),F=L.length,A=0;AT&&(c=T),f>g&&(f=g)}return c==h.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?v=L[0].getParent().paddingLeft:v=this.margin,this.left=f-v,this.top=c-v,new u(this.left,this.top))},o.prototype.updateBounds=function(c){for(var f=h.MAX_VALUE,T=-h.MAX_VALUE,g=h.MAX_VALUE,v=-h.MAX_VALUE,L,F,A,b,k,U=this.nodes,K=U.length,D=0;DL&&(f=L),TA&&(g=A),vL&&(f=L),TA&&(g=A),v=this.nodes.length){var K=0;T.forEach(function(D){D.owner==c&&K++}),K==this.nodes.length&&(this.isConnected=!0)}},M.exports=o}),(function(M,G,N){var d,h=N(1);function a(e){d=N(6),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),r=this.layout.newNode(null),l=this.add(e,r);return this.setRootGraph(l),this.rootGraph},a.prototype.add=function(e,r,l,i,u){if(l==null&&i==null&&u==null){if(e==null)throw"Graph is null!";if(r==null)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),e.parent!=null)throw"Already has a parent!";if(r.child!=null)throw"Already has a child!";return e.parent=r,r.child=e,e}else{u=l,i=r,l=e;var t=i.getOwner(),o=u.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(o!=null&&o.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==o)return l.isInterGraph=!1,t.add(l,i,u);if(l.isInterGraph=!0,l.source=i,l.target=u,this.edges.indexOf(l)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(l),!(l.source!=null&&l.target!=null))throw"Edge source and/or target is null!";if(!(l.source.edges.indexOf(l)==-1&&l.target.edges.indexOf(l)==-1))throw"Edge already in source and/or target incidency list!";return l.source.edges.push(l),l.target.edges.push(l),l}},a.prototype.remove=function(e){if(e instanceof d){var r=e;if(r.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(r==this.rootGraph||r.parent!=null&&r.parent.graphManager==this))throw"Invalid parent node!";var l=[];l=l.concat(r.getEdges());for(var i,u=l.length,t=0;t=e.getRight()?r[0]+=Math.min(e.getX()-a.getX(),a.getRight()-e.getRight()):e.getX()<=a.getX()&&e.getRight()>=a.getRight()&&(r[0]+=Math.min(a.getX()-e.getX(),e.getRight()-a.getRight())),a.getY()<=e.getY()&&a.getBottom()>=e.getBottom()?r[1]+=Math.min(e.getY()-a.getY(),a.getBottom()-e.getBottom()):e.getY()<=a.getY()&&e.getBottom()>=a.getBottom()&&(r[1]+=Math.min(a.getY()-e.getY(),e.getBottom()-a.getBottom()));var u=Math.abs((e.getCenterY()-a.getCenterY())/(e.getCenterX()-a.getCenterX()));e.getCenterY()===a.getCenterY()&&e.getCenterX()===a.getCenterX()&&(u=1);var t=u*r[0],o=r[1]/u;r[0]t)return r[0]=l,r[1]=s,r[2]=u,r[3]=U,!1;if(iu)return r[0]=o,r[1]=i,r[2]=b,r[3]=t,!1;if(lu?(r[0]=f,r[1]=T,n=!0):(r[0]=c,r[1]=s,n=!0):p===y&&(l>u?(r[0]=o,r[1]=s,n=!0):(r[0]=g,r[1]=T,n=!0)),-E===y?u>l?(r[2]=k,r[3]=U,m=!0):(r[2]=b,r[3]=A,m=!0):E===y&&(u>l?(r[2]=F,r[3]=A,m=!0):(r[2]=K,r[3]=U,m=!0)),n&&m)return!1;if(l>u?i>t?(I=this.getCardinalDirection(p,y,4),w=this.getCardinalDirection(E,y,2)):(I=this.getCardinalDirection(-p,y,3),w=this.getCardinalDirection(-E,y,1)):i>t?(I=this.getCardinalDirection(-p,y,1),w=this.getCardinalDirection(-E,y,3)):(I=this.getCardinalDirection(p,y,2),w=this.getCardinalDirection(E,y,4)),!n)switch(I){case 1:W=s,R=l+-L/y,r[0]=R,r[1]=W;break;case 2:R=g,W=i+v*y,r[0]=R,r[1]=W;break;case 3:W=T,R=l+L/y,r[0]=R,r[1]=W;break;case 4:R=f,W=i+-v*y,r[0]=R,r[1]=W;break}if(!m)switch(w){case 1:q=A,x=u+-it/y,r[2]=x,r[3]=q;break;case 2:x=K,q=t+D*y,r[2]=x,r[3]=q;break;case 3:q=U,x=u+it/y,r[2]=x,r[3]=q;break;case 4:x=k,q=t+-D*y,r[2]=x,r[3]=q;break}}return!1},h.getCardinalDirection=function(a,e,r){return a>e?r:1+r%4},h.getIntersection=function(a,e,r,l){if(l==null)return this.getIntersection2(a,e,r);var i=a.x,u=a.y,t=e.x,o=e.y,s=r.x,c=r.y,f=l.x,T=l.y,g=void 0,v=void 0,L=void 0,F=void 0,A=void 0,b=void 0,k=void 0,U=void 0,K=void 0;return L=o-u,A=i-t,k=t*u-i*o,F=T-c,b=s-f,U=f*c-s*T,K=L*b-F*A,K===0?null:(g=(A*U-b*k)/K,v=(F*k-L*U)/K,new d(g,v))},h.angleOfVector=function(a,e,r,l){var i=void 0;return a!==r?(i=Math.atan((l-e)/(r-a)),r=0){var T=(-s+Math.sqrt(s*s-4*o*c))/(2*o),g=(-s-Math.sqrt(s*s-4*o*c))/(2*o),v=null;return T>=0&&T<=1?[T]:g>=0&&g<=1?[g]:v}else return null},h.HALF_PI=.5*Math.PI,h.ONE_AND_HALF_PI=1.5*Math.PI,h.TWO_PI=2*Math.PI,h.THREE_PI=3*Math.PI,M.exports=h}),(function(M,G,N){function d(){}d.sign=function(h){return h>0?1:h<0?-1:0},d.floor=function(h){return h<0?Math.ceil(h):Math.floor(h)},d.ceil=function(h){return h<0?Math.floor(h):Math.ceil(h)},M.exports=d}),(function(M,G,N){function d(){}d.MAX_VALUE=2147483647,d.MIN_VALUE=-2147483648,M.exports=d}),(function(M,G,N){var d=(function(){function i(u,t){for(var o=0;o"u"?"undefined":d(a);return a==null||e!="object"&&e!="function"},M.exports=h}),(function(M,G,N){function d(s){if(Array.isArray(s)){for(var c=0,f=Array(s.length);c0&&c;){for(L.push(A[0]);L.length>0&&c;){var b=L[0];L.splice(0,1),v.add(b);for(var k=b.getEdges(),g=0;g-1&&A.splice(it,1)}v=new Set,F=new Map}}return s},o.prototype.createDummyNodesForBendpoints=function(s){for(var c=[],f=s.source,T=this.graphManager.calcLowestCommonAncestor(s.source,s.target),g=0;g0){for(var T=this.edgeToDummyNodes.get(f),g=0;g=0&&c.splice(U,1);var K=F.getNeighborsList();K.forEach(function(n){if(f.indexOf(n)<0){var m=T.get(n),p=m-1;p==1&&b.push(n),T.set(n,p)}})}f=f.concat(b),(c.length==1||c.length==2)&&(g=!0,v=c[0])}return v},o.prototype.setGraphManager=function(s){this.graphManager=s},M.exports=o}),(function(M,G,N){function d(){}d.seed=1,d.x=0,d.nextDouble=function(){return d.x=Math.sin(d.seed++)*1e4,d.x-Math.floor(d.x)},M.exports=d}),(function(M,G,N){var d=N(5);function h(a,e){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}h.prototype.getWorldOrgX=function(){return this.lworldOrgX},h.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},h.prototype.getWorldOrgY=function(){return this.lworldOrgY},h.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},h.prototype.getWorldExtX=function(){return this.lworldExtX},h.prototype.setWorldExtX=function(a){this.lworldExtX=a},h.prototype.getWorldExtY=function(){return this.lworldExtY},h.prototype.setWorldExtY=function(a){this.lworldExtY=a},h.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},h.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},h.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},h.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},h.prototype.getDeviceExtX=function(){return this.ldeviceExtX},h.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},h.prototype.getDeviceExtY=function(){return this.ldeviceExtY},h.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},h.prototype.transformX=function(a){var e=0,r=this.lworldExtX;return r!=0&&(e=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/r),e},h.prototype.transformY=function(a){var e=0,r=this.lworldExtY;return r!=0&&(e=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/r),e},h.prototype.inverseTransformX=function(a){var e=0,r=this.ldeviceExtX;return r!=0&&(e=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/r),e},h.prototype.inverseTransformY=function(a){var e=0,r=this.ldeviceExtY;return r!=0&&(e=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/r),e},h.prototype.inverseTransformPoint=function(a){var e=new d(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return e},M.exports=h}),(function(M,G,N){function d(t){if(Array.isArray(t)){for(var o=0,s=Array(t.length);oa.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(t-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},i.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),o,s=0;s0&&arguments[0]!==void 0?arguments[0]:!0,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s,c,f,T,g=this.getAllNodes(),v;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),v=new Set,s=0;sL||v>L)&&(t.gravitationForceX=-this.gravityConstant*f,t.gravitationForceY=-this.gravityConstant*T)):(L=o.getEstimatedSize()*this.compoundGravityRangeFactor,(g>L||v>L)&&(t.gravitationForceX=-this.gravityConstant*f*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},i.prototype.isConverged=function(){var t,o=!1;return this.totalIterations>this.maxIterations/3&&(o=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=g.length||L>=g[0].length)){for(var F=0;Fi}}]),r})();M.exports=e}),(function(M,G,N){function d(){}d.svd=function(h){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=h.length,this.n=h[0].length;var a=Math.min(this.m,this.n);this.s=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var Ct=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)Ct.push(0);return Ct})(this.n),r=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(this.m),l=!0,i=Math.min(this.m-1,this.n),u=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;E--)if(this.s[E]!==0){for(var y=E+1;y=0;V--){if((function(Tt,Ct){return Tt&&Ct})(V0;){var Q=void 0,It=void 0;for(Q=n-2;Q>=-1&&Q!==-1;Q--)if(Math.abs(e[Q])<=ht+_*(Math.abs(this.s[Q])+Math.abs(this.s[Q+1]))){e[Q]=0;break}if(Q===n-2)It=4;else{var Nt=void 0;for(Nt=n-1;Nt>=Q&&Nt!==Q;Nt--){var vt=(Nt!==n?Math.abs(e[Nt]):0)+(Nt!==Q+1?Math.abs(e[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+_*vt){this.s[Nt]=0;break}}Nt===Q?It=3:Nt===n-1?It=1:(It=2,Q=Nt)}switch(Q++,It){case 1:{var rt=e[n-2];e[n-2]=0;for(var gt=n-2;gt>=Q;gt--){var mt=d.hypot(this.s[gt],rt),At=this.s[gt]/mt,Ot=rt/mt;this.s[gt]=mt,gt!==Q&&(rt=-Ot*e[gt-1],e[gt-1]=At*e[gt-1]);for(var Et=0;Et=this.s[Q+1]);){var Lt=this.s[Q];if(this.s[Q]=this.s[Q+1],this.s[Q+1]=Lt,QMath.abs(a)?(e=a/h,e=Math.abs(h)*Math.sqrt(1+e*e)):a!=0?(e=h/a,e=Math.abs(a)*Math.sqrt(1+e*e)):e=0,e},M.exports=d}),(function(M,G,N){var d=(function(){function e(r,l){for(var i=0;i2&&arguments[2]!==void 0?arguments[2]:1,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;h(this,e),this.sequence1=r,this.sequence2=l,this.match_score=i,this.mismatch_penalty=u,this.gap_penalty=t,this.iMax=r.length+1,this.jMax=l.length+1,this.grid=new Array(this.iMax);for(var o=0;o=0;r--){var l=this.listeners[r];l.event===a&&l.callback===e&&this.listeners.splice(r,1)}},h.emit=function(a,e){for(var r=0;r{var G={45:((a,e,r)=>{var l={};l.layoutBase=r(551),l.CoSEConstants=r(806),l.CoSEEdge=r(767),l.CoSEGraph=r(880),l.CoSEGraphManager=r(578),l.CoSELayout=r(765),l.CoSENode=r(991),l.ConstraintHandler=r(902),a.exports=l}),806:((a,e,r)=>{var l=r(551).FDLayoutConstants;function i(){}for(var u in l)i[u]=l[u];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=l.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!0,i.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,i.TREE_REDUCTION_ON_INCREMENTAL=!0,i.PURE_INCREMENTAL=i.DEFAULT_INCREMENTAL,a.exports=i}),767:((a,e,r)=>{var l=r(551).FDLayoutEdge;function i(t,o,s){l.call(this,t,o,s)}i.prototype=Object.create(l.prototype);for(var u in l)i[u]=l[u];a.exports=i}),880:((a,e,r)=>{var l=r(551).LGraph;function i(t,o,s){l.call(this,t,o,s)}i.prototype=Object.create(l.prototype);for(var u in l)i[u]=l[u];a.exports=i}),578:((a,e,r)=>{var l=r(551).LGraphManager;function i(t){l.call(this,t)}i.prototype=Object.create(l.prototype);for(var u in l)i[u]=l[u];a.exports=i}),765:((a,e,r)=>{var l=r(551).FDLayout,i=r(578),u=r(880),t=r(991),o=r(767),s=r(806),c=r(902),f=r(551).FDLayoutConstants,T=r(551).LayoutConstants,g=r(551).Point,v=r(551).PointD,L=r(551).DimensionD,F=r(551).Layout,A=r(551).Integer,b=r(551).IGeometry,k=r(551).LGraph,U=r(551).Transform,K=r(551).LinkedList;function D(){l.call(this),this.toBeTiled={},this.constraints={}}D.prototype=Object.create(l.prototype);for(var it in l)D[it]=l[it];D.prototype.newGraphManager=function(){var n=new i(this);return this.graphManager=n,n},D.prototype.newGraph=function(n){return new u(null,this.graphManager,n)},D.prototype.newNode=function(n){return new t(this.graphManager,n)},D.prototype.newEdge=function(n){return new o(null,null,n)},D.prototype.initParameters=function(){l.prototype.initParameters.call(this,arguments),this.isSubLayout||(s.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=s.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=s.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=f.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=f.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=f.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=f.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},D.prototype.initSpringEmbedder=function(){l.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/f.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},D.prototype.layout=function(){var n=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return n&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},D.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(s.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(I){return m.has(I)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var n=this.getFlatForest();if(n.length>0)this.positionNodesRadially(n);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(E){return m.has(E)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),s.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},D.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%f.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var n=new Set(this.getAllNodes()),m=this.nodesWithGravity.filter(function(y){return n.has(y)});this.graphManager.setAllNodesToApplyGravitation(m),this.graphManager.updateBounds(),this.updateGrid(),s.PURE_INCREMENTAL?this.coolingFactor=f.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=f.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),s.PURE_INCREMENTAL?this.coolingFactor=f.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=f.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,E=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,E),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},D.prototype.getPositionsData=function(){for(var n=this.graphManager.getAllNodes(),m={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(E.fixedNodeWeight=I)}}if(this.constraints.relativePlacementConstraint){var w=new Map,R=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){n.fixedNodesOnHorizontal.add(O),n.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*O.length/3;_--)H=Math.floor(Math.random()*(_+1)),$=O[_],O[_]=O[H],O[H]=$;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=w.has(O.left)?w.get(O.left):O.left,$=w.has(O.right)?w.get(O.right):O.right;n.nodesInRelativeHorizontal.includes(H)||(n.nodesInRelativeHorizontal.push(H),n.nodeToRelativeConstraintMapHorizontal.set(H,[]),n.dummyToNodeForVerticalAlignment.has(H)?n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(H).getCenterX())),n.nodesInRelativeHorizontal.includes($)||(n.nodesInRelativeHorizontal.push($),n.nodeToRelativeConstraintMapHorizontal.set($,[]),n.dummyToNodeForVerticalAlignment.has($)?n.nodeToTempPositionMapHorizontal.set($,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get($)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set($,n.idToNodeMap.get($).getCenterX())),n.nodeToRelativeConstraintMapHorizontal.get(H).push({right:$,gap:O.gap}),n.nodeToRelativeConstraintMapHorizontal.get($).push({left:H,gap:O.gap})}else{var _=R.has(O.top)?R.get(O.top):O.top,ht=R.has(O.bottom)?R.get(O.bottom):O.bottom;n.nodesInRelativeVertical.includes(_)||(n.nodesInRelativeVertical.push(_),n.nodeToRelativeConstraintMapVertical.set(_,[]),n.dummyToNodeForHorizontalAlignment.has(_)?n.nodeToTempPositionMapVertical.set(_,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(_)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(_,n.idToNodeMap.get(_).getCenterY())),n.nodesInRelativeVertical.includes(ht)||(n.nodesInRelativeVertical.push(ht),n.nodeToRelativeConstraintMapVertical.set(ht,[]),n.dummyToNodeForHorizontalAlignment.has(ht)?n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(ht).getCenterY())),n.nodeToRelativeConstraintMapVertical.get(_).push({bottom:ht,gap:O.gap}),n.nodeToRelativeConstraintMapVertical.get(ht).push({top:_,gap:O.gap})}});else{var q=new Map,V=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=w.has(O.left)?w.get(O.left):O.left,$=w.has(O.right)?w.get(O.right):O.right;q.has(H)?q.get(H).push($):q.set(H,[$]),q.has($)?q.get($).push(H):q.set($,[H])}else{var _=R.has(O.top)?R.get(O.top):O.top,ht=R.has(O.bottom)?R.get(O.bottom):O.bottom;V.has(_)?V.get(_).push(ht):V.set(_,[ht]),V.has(ht)?V.get(ht).push(_):V.set(ht,[_])}});var Y=function(H,$){var _=[],ht=[],Q=new K,It=new Set,Nt=0;return H.forEach(function(vt,rt){if(!It.has(rt)){_[Nt]=[],ht[Nt]=!1;var gt=rt;for(Q.push(gt),It.add(gt),_[Nt].push(gt);Q.length!=0;){gt=Q.shift(),$.has(gt)&&(ht[Nt]=!0);var mt=H.get(gt);mt.forEach(function(At){It.has(At)||(Q.push(At),It.add(At),_[Nt].push(At))})}Nt++}}),{components:_,isFixed:ht}},et=Y(q,n.fixedNodesOnHorizontal);this.componentsOnHorizontal=et.components,this.fixedComponentsOnHorizontal=et.isFixed;var z=Y(V,n.fixedNodesOnVertical);this.componentsOnVertical=z.components,this.fixedComponentsOnVertical=z.isFixed}}},D.prototype.updateDisplacements=function(){var n=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(z){var O=n.idToNodeMap.get(z.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var m=this.constraints.alignmentConstraint.vertical,p=0;p1){var R;for(R=0;RE&&(E=Math.floor(w.y)),I=Math.floor(w.x+s.DEFAULT_COMPONENT_SEPERATION)}this.transform(new v(T.WORLD_CENTER_X-w.x/2,T.WORLD_CENTER_Y-w.y/2))},D.radialLayout=function(n,m,p){var E=Math.max(this.maxDiagonalInTree(n),s.DEFAULT_RADIAL_SEPARATION);D.branchRadialLayout(m,null,0,359,0,E);var y=k.calculateBounds(n),I=new U;I.setDeviceOrgX(y.getMinX()),I.setDeviceOrgY(y.getMinY()),I.setWorldOrgX(p.x),I.setWorldOrgY(p.y);for(var w=0;w1;){var $=H[0];H.splice(0,1);var _=V.indexOf($);_>=0&&V.splice(_,1),z--,Y--}m!=null?O=(V.indexOf(H[0])+1)%z:O=0;for(var ht=Math.abs(E-p)/Y,Q=O;et!=Y;Q=++Q%z){var It=V[Q].getOtherEnd(n);if(It!=m){var Nt=(p+et*ht)%360,vt=(Nt+ht)%360;D.branchRadialLayout(It,n,Nt,vt,y+I,I),et++}}},D.maxDiagonalInTree=function(n){for(var m=A.MIN_VALUE,p=0;pm&&(m=y)}return m},D.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},D.prototype.groupZeroDegreeMembers=function(){var n=this,m={};this.memberGroups={},this.idToDummyNode={};for(var p=[],E=this.graphManager.getAllNodes(),y=0;y"u"&&(m[R]=[]),m[R]=m[R].concat(I)}Object.keys(m).forEach(function(W){if(m[W].length>1){var x="DummyCompound_"+W;n.memberGroups[x]=m[W];var q=m[W][0].getParent(),V=new t(n.graphManager);V.id=x,V.paddingLeft=q.paddingLeft||0,V.paddingRight=q.paddingRight||0,V.paddingBottom=q.paddingBottom||0,V.paddingTop=q.paddingTop||0,n.idToDummyNode[x]=V;var Y=n.getGraphManager().add(n.newGraph(),V),et=q.getChild();et.add(V);for(var z=0;zy?(E.rect.x-=(E.labelWidth-y)/2,E.setWidth(E.labelWidth),E.labelMarginLeft=(E.labelWidth-y)/2):E.labelPosHorizontal=="right"&&E.setWidth(y+E.labelWidth)),E.labelHeight&&(E.labelPosVertical=="top"?(E.rect.y-=E.labelHeight,E.setHeight(I+E.labelHeight),E.labelMarginTop=E.labelHeight):E.labelPosVertical=="center"&&E.labelHeight>I?(E.rect.y-=(E.labelHeight-I)/2,E.setHeight(E.labelHeight),E.labelMarginTop=(E.labelHeight-I)/2):E.labelPosVertical=="bottom"&&E.setHeight(I+E.labelHeight))}})},D.prototype.repopulateCompounds=function(){for(var n=this.compoundOrder.length-1;n>=0;n--){var m=this.compoundOrder[n],p=m.id,E=m.paddingLeft,y=m.paddingTop,I=m.labelMarginLeft,w=m.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],m.rect.x,m.rect.y,E,y,I,w)}},D.prototype.repopulateZeroDegreeMembers=function(){var n=this,m=this.tiledZeroDegreePack;Object.keys(m).forEach(function(p){var E=n.idToDummyNode[p],y=E.paddingLeft,I=E.paddingTop,w=E.labelMarginLeft,R=E.labelMarginTop;n.adjustLocations(m[p],E.rect.x,E.rect.y,y,I,w,R)})},D.prototype.getToBeTiled=function(n){var m=n.id;if(this.toBeTiled[m]!=null)return this.toBeTiled[m];var p=n.getChild();if(p==null)return this.toBeTiled[m]=!1,!1;for(var E=p.getNodes(),y=0;y0)return this.toBeTiled[m]=!1,!1;if(I.getChild()==null){this.toBeTiled[I.id]=!1;continue}if(!this.getToBeTiled(I))return this.toBeTiled[m]=!1,!1}return this.toBeTiled[m]=!0,!0},D.prototype.getNodeDegree=function(n){n.id;for(var m=n.getEdges(),p=0,E=0;Eq&&(q=Y.rect.height)}p+=q+n.verticalPadding}},D.prototype.tileCompoundMembers=function(n,m){var p=this;this.tiledMemberPack=[],Object.keys(n).forEach(function(E){var y=m[E];if(p.tiledMemberPack[E]=p.tileNodes(n[E],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[E].width,y.rect.height=p.tiledMemberPack[E].height,y.setCenter(p.tiledMemberPack[E].centerX,p.tiledMemberPack[E].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,s.NODE_DIMENSIONS_INCLUDE_LABELS){var I=y.rect.width,w=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(I+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>I?(y.rect.x-=(y.labelWidth-I)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-I)/2):y.labelPosHorizontal=="right"&&y.setWidth(I+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(w+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>w?(y.rect.y-=(y.labelHeight-w)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-w)/2):y.labelPosVertical=="bottom"&&y.setHeight(w+y.labelHeight))}})},D.prototype.tileNodes=function(n,m){var p=this.tileNodesByFavoringDim(n,m,!0),E=this.tileNodesByFavoringDim(n,m,!1),y=this.getOrgRatio(p),I=this.getOrgRatio(E),w;return IR&&(R=z.getWidth())});var W=I/y,x=w/y,q=Math.pow(p-E,2)+4*(W+E)*(x+p)*y,V=(E-p+Math.sqrt(q))/(2*(W+E)),Y;m?(Y=Math.ceil(V),Y==V&&Y++):Y=Math.floor(V);var et=Y*(W+E)-E;return R>et&&(et=R),et+=E*2,et},D.prototype.tileNodesByFavoringDim=function(n,m,p){var E=s.TILING_PADDING_VERTICAL,y=s.TILING_PADDING_HORIZONTAL,I=s.TILING_COMPARE_BY,w={rows:[],rowWidth:[],rowHeight:[],width:0,height:m,verticalPadding:E,horizontalPadding:y,centerX:0,centerY:0};I&&(w.idealRowWidth=this.calcIdealRowWidth(n,p));var R=function(O){return O.rect.width*O.rect.height},W=function(O,H){return R(H)-R(O)};n.sort(function(z,O){var H=W;return w.idealRowWidth?(H=I,H(z.id,O.id)):H(z,O)});for(var x=0,q=0,V=0;V0&&(w+=n.horizontalPadding),n.rowWidth[p]=w,n.width0&&(R+=n.verticalPadding);var W=0;R>n.rowHeight[p]&&(W=n.rowHeight[p],n.rowHeight[p]=R,W=n.rowHeight[p]-W),n.height+=W,n.rows[p].push(m)},D.prototype.getShortestRowIndex=function(n){for(var m=-1,p=Number.MAX_VALUE,E=0;Ep&&(m=E,p=n.rowWidth[E]);return m},D.prototype.canAddHorizontal=function(n,m,p){if(n.idealRowWidth){var E=n.rows.length-1,y=n.rowWidth[E];return y+m+n.horizontalPadding<=n.idealRowWidth}var I=this.getShortestRowIndex(n);if(I<0)return!0;var w=n.rowWidth[I];if(w+n.horizontalPadding+m<=n.width)return!0;var R=0;n.rowHeight[I]0&&(R=p+n.verticalPadding-n.rowHeight[I]);var W;n.width-w>=m+n.horizontalPadding?W=(n.height+R)/(w+m+n.horizontalPadding):W=(n.height+R)/n.width,R=p+n.verticalPadding;var x;return n.widthI&&m!=p){E.splice(-1,1),n.rows[p].push(y),n.rowWidth[m]=n.rowWidth[m]-I,n.rowWidth[p]=n.rowWidth[p]+I,n.width=n.rowWidth[instance.getLongestRowIndex(n)];for(var w=Number.MIN_VALUE,R=0;Rw&&(w=E[R].height);m>0&&(w+=n.verticalPadding);var W=n.rowHeight[m]+n.rowHeight[p];n.rowHeight[m]=w,n.rowHeight[p]0)for(var et=y;et<=I;et++)Y[0]+=this.grid[et][w-1].length+this.grid[et][w].length-1;if(I0)for(var et=w;et<=R;et++)Y[3]+=this.grid[y-1][et].length+this.grid[y][et].length-1;for(var z=A.MAX_VALUE,O,H,$=0;${var l=r(551).FDLayoutNode,i=r(551).IMath;function u(o,s,c,f){l.call(this,o,s,c,f)}u.prototype=Object.create(l.prototype);for(var t in l)u[t]=l[t];u.prototype.calculateDisplacement=function(){var o=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=o.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=o.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=o.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=o.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>o.coolingFactor*o.maxNodeDisplacement&&(this.displacementX=o.coolingFactor*o.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>o.coolingFactor*o.maxNodeDisplacement&&(this.displacementY=o.coolingFactor*o.maxNodeDisplacement*i.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},u.prototype.propogateDisplacementToChildren=function(o,s){for(var c=this.getChild().getNodes(),f,T=0;T{function l(c){if(Array.isArray(c)){for(var f=0,T=Array(c.length);f0){var Lt=0;ot.forEach(function(st){B=="horizontal"?(tt.set(st,g.has(st)?v[g.get(st)]:Z.get(st)),Lt+=tt.get(st)):(tt.set(st,g.has(st)?L[g.get(st)]:Z.get(st)),Lt+=tt.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){J.has(st)||tt.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){B=="horizontal"?ft+=g.has(st)?v[g.get(st)]:Z.get(st):ft+=g.has(st)?L[g.get(st)]:Z.get(st)}),ft=ft/lt.length,lt.forEach(function(st){tt.set(st,ft)})}});for(var Mt=function(){var ot=ut.shift(),Lt=P.get(ot);Lt.forEach(function(ft){if(tt.get(ft.id)st&&(st=Zt),KtXt&&(Xt=Kt)}}catch(ee){Ct=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(Ct)throw $t}}var fe=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),ne;!(Qt=(ne=Jt.next()).done);Qt=!0){var te=ne.value;tt.set(te,tt.get(te)+fe)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return tt},it=function(P){var B=0,J=0,Z=0,at=0;if(P.forEach(function(j){j.left?v[g.get(j.left)]-v[g.get(j.right)]>=0?B++:J++:L[g.get(j.top)]-L[g.get(j.bottom)]>=0?Z++:at++}),B>J&&Z>at)for(var ct=0;ctJ)for(var nt=0;ntat)for(var tt=0;tt1)f.fixedNodeConstraint.forEach(function(S,P){E[P]=[S.position.x,S.position.y],y[P]=[v[g.get(S.nodeId)],L[g.get(S.nodeId)]]}),I=!0;else if(f.alignmentConstraint)(function(){var S=0;if(f.alignmentConstraint.vertical){for(var P=f.alignmentConstraint.vertical,B=function(tt){var j=new Set;P[tt].forEach(function(pt){j.add(pt)});var ut=new Set([].concat(l(j)).filter(function(pt){return R.has(pt)})),Mt=void 0;ut.size>0?Mt=v[g.get(ut.values().next().value)]:Mt=K(j).x,P[tt].forEach(function(pt){E[S]=[Mt,L[g.get(pt)]],y[S]=[v[g.get(pt)],L[g.get(pt)]],S++})},J=0;J0?Mt=v[g.get(ut.values().next().value)]:Mt=K(j).y,Z[tt].forEach(function(pt){E[S]=[v[g.get(pt)],Mt],y[S]=[v[g.get(pt)],L[g.get(pt)]],S++})},ct=0;ctV&&(V=q[et].length,Y=et);if(V0){var Et={x:0,y:0};f.fixedNodeConstraint.forEach(function(S,P){var B={x:v[g.get(S.nodeId)],y:L[g.get(S.nodeId)]},J=S.position,Z=U(J,B);Et.x+=Z.x,Et.y+=Z.y}),Et.x/=f.fixedNodeConstraint.length,Et.y/=f.fixedNodeConstraint.length,v.forEach(function(S,P){v[P]+=Et.x}),L.forEach(function(S,P){L[P]+=Et.y}),f.fixedNodeConstraint.forEach(function(S){v[g.get(S.nodeId)]=S.position.x,L[g.get(S.nodeId)]=S.position.y})}if(f.alignmentConstraint){if(f.alignmentConstraint.vertical)for(var Dt=f.alignmentConstraint.vertical,Rt=function(P){var B=new Set;Dt[P].forEach(function(at){B.add(at)});var J=new Set([].concat(l(B)).filter(function(at){return R.has(at)})),Z=void 0;J.size>0?Z=v[g.get(J.values().next().value)]:Z=K(B).x,B.forEach(function(at){R.has(at)||(v[g.get(at)]=Z)})},Ht=0;Ht0?Z=L[g.get(J.values().next().value)]:Z=K(B).y,B.forEach(function(at){R.has(at)||(L[g.get(at)]=Z)})},Ft=0;Ft{a.exports=M})},N={};function d(a){var e=N[a];if(e!==void 0)return e.exports;var r=N[a]={exports:{}};return G[a](r,r.exports,d),r.exports}var h=d(45);return h})()})})(he)),he.exports}var vr=se.exports,Oe;function pr(){return Oe||(Oe=1,(function(C,X){(function(G,N){C.exports=N(dr())})(vr,function(M){return(()=>{var G={658:(a=>{a.exports=Object.assign!=null?Object.assign.bind(Object):function(e){for(var r=arguments.length,l=Array(r>1?r-1:0),i=1;i{var l=(function(){function t(o,s){var c=[],f=!0,T=!1,g=void 0;try{for(var v=o[Symbol.iterator](),L;!(f=(L=v.next()).done)&&(c.push(L.value),!(s&&c.length===s));f=!0);}catch(F){T=!0,g=F}finally{try{!f&&v.return&&v.return()}finally{if(T)throw g}}return c}return function(o,s){if(Array.isArray(o))return o;if(Symbol.iterator in Object(o))return t(o,s);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),i=r(140).layoutBase.LinkedList,u={};u.getTopMostNodes=function(t){for(var o={},s=0;s0&&I.merge(x)});for(var w=0;w1){L=g[0],F=L.connectedEdges().length,g.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),k),U},u.relocateComponent=function(t,o,s){if(!s.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY;if(s.quality=="draft"){var v=!0,L=!1,F=void 0;try{for(var A=o.nodeIndexes[Symbol.iterator](),b;!(v=(b=A.next()).done);v=!0){var k=b.value,U=l(k,2),K=U[0],D=U[1],it=s.cy.getElementById(K);if(it){var n=it.boundingBox(),m=o.xCoords[D]-n.w/2,p=o.xCoords[D]+n.w/2,E=o.yCoords[D]-n.h/2,y=o.yCoords[D]+n.h/2;mf&&(f=p),Eg&&(g=y)}}}catch(x){L=!0,F=x}finally{try{!v&&A.return&&A.return()}finally{if(L)throw F}}var I=t.x-(f+c)/2,w=t.y-(g+T)/2;o.xCoords=o.xCoords.map(function(x){return x+I}),o.yCoords=o.yCoords.map(function(x){return x+w})}else{Object.keys(o).forEach(function(x){var q=o[x],V=q.getRect().x,Y=q.getRect().x+q.getRect().width,et=q.getRect().y,z=q.getRect().y+q.getRect().height;Vf&&(f=Y),etg&&(g=z)});var R=t.x-(f+c)/2,W=t.y-(g+T)/2;Object.keys(o).forEach(function(x){var q=o[x];q.setCenter(q.getCenterX()+R,q.getCenterY()+W)})}}},u.calcBoundingBox=function(t,o,s,c){for(var f=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,g=Number.MAX_SAFE_INTEGER,v=Number.MIN_SAFE_INTEGER,L=void 0,F=void 0,A=void 0,b=void 0,k=t.descendants().not(":parent"),U=k.length,K=0;KL&&(f=L),TA&&(g=A),v{var l=r(548),i=r(140).CoSELayout,u=r(140).CoSENode,t=r(140).layoutBase.PointD,o=r(140).layoutBase.DimensionD,s=r(140).layoutBase.LayoutConstants,c=r(140).layoutBase.FDLayoutConstants,f=r(140).CoSEConstants,T=function(v,L){var F=v.cy,A=v.eles,b=A.nodes(),k=A.edges(),U=void 0,K=void 0,D=void 0,it={};v.randomize&&(U=L.nodeIndexes,K=L.xCoords,D=L.yCoords);var n=function(x){return typeof x=="function"},m=function(x,q){return n(x)?x(q):x},p=l.calcParentsWithoutChildren(F,A),E=function W(x,q,V,Y){for(var et=q.length,z=0;z0){var Q=void 0;Q=V.getGraphManager().add(V.newGraph(),$),W(Q,H,V,Y)}}},y=function(x,q,V){for(var Y=0,et=0,z=0;z0?f.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=Y/et:n(v.idealEdgeLength)?f.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:f.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=v.idealEdgeLength,f.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,f.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},I=function(x,q){q.fixedNodeConstraint&&(x.constraints.fixedNodeConstraint=q.fixedNodeConstraint),q.alignmentConstraint&&(x.constraints.alignmentConstraint=q.alignmentConstraint),q.relativePlacementConstraint&&(x.constraints.relativePlacementConstraint=q.relativePlacementConstraint)};v.nestingFactor!=null&&(f.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=v.nestingFactor),v.gravity!=null&&(f.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=v.gravity),v.numIter!=null&&(f.MAX_ITERATIONS=c.MAX_ITERATIONS=v.numIter),v.gravityRange!=null&&(f.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=v.gravityRange),v.gravityCompound!=null&&(f.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=v.gravityCompound),v.gravityRangeCompound!=null&&(f.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=v.gravityRangeCompound),v.initialEnergyOnIncremental!=null&&(f.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=v.initialEnergyOnIncremental),v.tilingCompareBy!=null&&(f.TILING_COMPARE_BY=v.tilingCompareBy),v.quality=="proof"?s.QUALITY=2:s.QUALITY=0,f.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=s.NODE_DIMENSIONS_INCLUDE_LABELS=v.nodeDimensionsIncludeLabels,f.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=s.DEFAULT_INCREMENTAL=!v.randomize,f.ANIMATE=c.ANIMATE=s.ANIMATE=v.animate,f.TILE=v.tile,f.TILING_PADDING_VERTICAL=typeof v.tilingPaddingVertical=="function"?v.tilingPaddingVertical.call():v.tilingPaddingVertical,f.TILING_PADDING_HORIZONTAL=typeof v.tilingPaddingHorizontal=="function"?v.tilingPaddingHorizontal.call():v.tilingPaddingHorizontal,f.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=s.DEFAULT_INCREMENTAL=!0,f.PURE_INCREMENTAL=!v.randomize,s.DEFAULT_UNIFORM_LEAF_NODE_SIZES=v.uniformNodeDimensions,v.step=="transformed"&&(f.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,f.ENFORCE_CONSTRAINTS=!1,f.APPLY_LAYOUT=!1),v.step=="enforced"&&(f.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,f.ENFORCE_CONSTRAINTS=!0,f.APPLY_LAYOUT=!1),v.step=="cose"&&(f.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,f.ENFORCE_CONSTRAINTS=!1,f.APPLY_LAYOUT=!0),v.step=="all"&&(v.randomize?f.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:f.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,f.ENFORCE_CONSTRAINTS=!0,f.APPLY_LAYOUT=!0),v.fixedNodeConstraint||v.alignmentConstraint||v.relativePlacementConstraint?f.TREE_REDUCTION_ON_INCREMENTAL=!1:f.TREE_REDUCTION_ON_INCREMENTAL=!0;var w=new i,R=w.newGraphManager();return E(R.addRoot(),l.getTopMostNodes(b),w,v),y(w,R,k),I(w,v),w.runLayout(),it};a.exports={coseLayout:T}}),212:((a,e,r)=>{var l=(function(){function v(L,F){for(var A=0;A0)if(p){var I=t.getTopMostNodes(A.eles.nodes());if(D=t.connectComponents(b,A.eles,I),D.forEach(function(vt){var rt=vt.boundingBox();it.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2})}),A.randomize&&D.forEach(function(vt){A.eles=vt,U.push(s(A))}),A.quality=="default"||A.quality=="proof"){var w=b.collection();if(A.tile){var R=new Map,W=[],x=[],q=0,V={nodeIndexes:R,xCoords:W,yCoords:x},Y=[];if(D.forEach(function(vt,rt){vt.edges().length==0&&(vt.nodes().forEach(function(gt,mt){w.merge(vt.nodes()[mt]),gt.isParent()||(V.nodeIndexes.set(vt.nodes()[mt].id(),q++),V.xCoords.push(vt.nodes()[0].position().x),V.yCoords.push(vt.nodes()[0].position().y))}),Y.push(rt))}),w.length>1){var et=w.boundingBox();it.push({x:et.x1+et.w/2,y:et.y1+et.h/2}),D.push(w),U.push(V);for(var z=Y.length-1;z>=0;z--)D.splice(Y[z],1),U.splice(Y[z],1),it.splice(Y[z],1)}}D.forEach(function(vt,rt){A.eles=vt,K.push(f(A,U[rt])),t.relocateComponent(it[rt],K[rt],A)})}else D.forEach(function(vt,rt){t.relocateComponent(it[rt],U[rt],A)});var O=new Set;if(D.length>1){var H=[],$=k.filter(function(vt){return vt.css("display")=="none"});D.forEach(function(vt,rt){var gt=void 0;if(A.quality=="draft"&&(gt=U[rt].nodeIndexes),vt.nodes().not($).length>0){var mt={};mt.edges=[],mt.nodes=[];var At=void 0;vt.nodes().not($).forEach(function(Ot){if(A.quality=="draft")if(!Ot.isParent())At=gt.get(Ot.id()),mt.nodes.push({x:U[rt].xCoords[At]-Ot.boundingbox().w/2,y:U[rt].yCoords[At]-Ot.boundingbox().h/2,width:Ot.boundingbox().w,height:Ot.boundingbox().h});else{var Et=t.calcBoundingBox(Ot,U[rt].xCoords,U[rt].yCoords,gt);mt.nodes.push({x:Et.topLeftX,y:Et.topLeftY,width:Et.width,height:Et.height})}else K[rt][Ot.id()]&&mt.nodes.push({x:K[rt][Ot.id()].getLeft(),y:K[rt][Ot.id()].getTop(),width:K[rt][Ot.id()].getWidth(),height:K[rt][Ot.id()].getHeight()})}),vt.edges().forEach(function(Ot){var Et=Ot.source(),Dt=Ot.target();if(Et.css("display")!="none"&&Dt.css("display")!="none")if(A.quality=="draft"){var Rt=gt.get(Et.id()),Ht=gt.get(Dt.id()),Ut=[],Pt=[];if(Et.isParent()){var Ft=t.calcBoundingBox(Et,U[rt].xCoords,U[rt].yCoords,gt);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(U[rt].xCoords[Rt]),Ut.push(U[rt].yCoords[Rt]);if(Dt.isParent()){var Yt=t.calcBoundingBox(Dt,U[rt].xCoords,U[rt].yCoords,gt);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(U[rt].xCoords[Ht]),Pt.push(U[rt].yCoords[Ht]);mt.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else K[rt][Et.id()]&&K[rt][Dt.id()]&&mt.edges.push({startX:K[rt][Et.id()].getCenterX(),startY:K[rt][Et.id()].getCenterY(),endX:K[rt][Dt.id()].getCenterX(),endY:K[rt][Dt.id()].getCenterY()})}),mt.nodes.length>0&&(H.push(mt),O.add(rt))}});var _=m.packComponents(H,A.randomize).shifts;if(A.quality=="draft")U.forEach(function(vt,rt){var gt=vt.xCoords.map(function(At){return At+_[rt].dx}),mt=vt.yCoords.map(function(At){return At+_[rt].dy});vt.xCoords=gt,vt.yCoords=mt});else{var ht=0;O.forEach(function(vt){Object.keys(K[vt]).forEach(function(rt){var gt=K[vt][rt];gt.setCenter(gt.getCenterX()+_[ht].dx,gt.getCenterY()+_[ht].dy)}),ht++})}}}else{var E=A.eles.boundingBox();if(it.push({x:E.x1+E.w/2,y:E.y1+E.h/2}),A.randomize){var y=s(A);U.push(y)}A.quality=="default"||A.quality=="proof"?(K.push(f(A,U[0])),t.relocateComponent(it[0],K[0],A)):t.relocateComponent(it[0],U[0],A)}var Q=function(rt,gt){if(A.quality=="default"||A.quality=="proof"){typeof rt=="number"&&(rt=gt);var mt=void 0,At=void 0,Ot=rt.data("id");return K.forEach(function(Dt){Ot in Dt&&(mt={x:Dt[Ot].getRect().getCenterX(),y:Dt[Ot].getRect().getCenterY()},At=Dt[Ot])}),A.nodeDimensionsIncludeLabels&&(At.labelWidth&&(At.labelPosHorizontal=="left"?mt.x+=At.labelWidth/2:At.labelPosHorizontal=="right"&&(mt.x-=At.labelWidth/2)),At.labelHeight&&(At.labelPosVertical=="top"?mt.y+=At.labelHeight/2:At.labelPosVertical=="bottom"&&(mt.y-=At.labelHeight/2))),mt==null&&(mt={x:rt.position("x"),y:rt.position("y")}),{x:mt.x,y:mt.y}}else{var Et=void 0;return U.forEach(function(Dt){var Rt=Dt.nodeIndexes.get(rt.id());Rt!=null&&(Et={x:Dt.xCoords[Rt],y:Dt.yCoords[Rt]})}),Et==null&&(Et={x:rt.position("x"),y:rt.position("y")}),{x:Et.x,y:Et.y}}};if(A.quality=="default"||A.quality=="proof"||A.randomize){var It=t.calcParentsWithoutChildren(b,k),Nt=k.filter(function(vt){return vt.css("display")=="none"});A.eles=k.not(Nt),k.nodes().not(":parent").not(Nt).layoutPositions(F,A,Q),It.length>0&&It.forEach(function(vt){vt.position(Q(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),v})();a.exports=g}),657:((a,e,r)=>{var l=r(548),i=r(140).layoutBase.Matrix,u=r(140).layoutBase.SVD,t=function(s){var c=s.cy,f=s.eles,T=f.nodes(),g=f.nodes(":parent"),v=new Map,L=new Map,F=new Map,A=[],b=[],k=[],U=[],K=[],D=[],it=[],n=[],m=void 0,p=1e8,E=1e-9,y=s.piTol,I=s.samplingType,w=s.nodeSeparation,R=void 0,W=function(){for(var P=0,B=0,J=!1;B=at;){nt=Z[at++];for(var xt=A[nt],lt=0;ltut&&(ut=K[Lt],Mt=Lt)}return Mt},q=function(P){var B=void 0;if(P){B=Math.floor(Math.random()*m);for(var Z=0;Z=1)break;j=tt}for(var pt=0;pt=1)break;j=tt}for(var lt=0;lt0&&(B.isParent()?A[P].push(F.get(B.id())):A[P].push(B.id()))})});var Nt=function(P){var B=L.get(P),J=void 0;v.get(P).forEach(function(Z){c.getElementById(Z).isParent()?J=F.get(Z):J=Z,A[B].push(J),A[L.get(J)].push(P)})},vt=!0,rt=!1,gt=void 0;try{for(var mt=v.keys()[Symbol.iterator](),At;!(vt=(At=mt.next()).done);vt=!0){var Ot=At.value;Nt(Ot)}}catch(S){rt=!0,gt=S}finally{try{!vt&&mt.return&&mt.return()}finally{if(rt)throw gt}}m=L.size;var Et=void 0;if(m>2){R=m{var l=r(212),i=function(t){t&&t("layout","fcose",l)};typeof cytoscape<"u"&&i(cytoscape),a.exports=i}),140:(a=>{a.exports=M})},N={};function d(a){var e=N[a];if(e!==void 0)return e.exports;var r=N[a]={exports:{}};return G[a](r,r.exports,d),r.exports}var h=d(579);return h})()})})(se)),se.exports}var yr=pr();const Er=lr(yr);var De={L:"left",R:"right",T:"top",B:"bottom"},xe={L:dt(C=>`${C},${C/2} 0,${C} 0,0`,"L"),R:dt(C=>`0,${C/2} ${C},0 ${C},${C}`,"R"),T:dt(C=>`0,0 ${C},0 ${C/2},${C}`,"T"),B:dt(C=>`${C/2},0 ${C},${C} 0,${C}`,"B")},oe={L:dt((C,X)=>C-X+2,"L"),R:dt((C,X)=>C-2,"R"),T:dt((C,X)=>C-X+2,"T"),B:dt((C,X)=>C-2,"B")},mr=dt(function(C){return Wt(C)?C==="L"?"R":"L":C==="T"?"B":"T"},"getOppositeArchitectureDirection"),Ie=dt(function(C){const X=C;return X==="L"||X==="R"||X==="T"||X==="B"},"isArchitectureDirection"),Wt=dt(function(C){const X=C;return X==="L"||X==="R"},"isArchitectureDirectionX"),qt=dt(function(C){const X=C;return X==="T"||X==="B"},"isArchitectureDirectionY"),me=dt(function(C,X){const M=Wt(C)&&qt(X),G=qt(C)&&Wt(X);return M||G},"isArchitectureDirectionXY"),Tr=dt(function(C){const X=C[0],M=C[1],G=Wt(X)&&qt(M),N=qt(X)&&Wt(M);return G||N},"isArchitecturePairXY"),Nr=dt(function(C){return C!=="LL"&&C!=="RR"&&C!=="TT"&&C!=="BB"},"isValidArchitectureDirectionPair"),pe=dt(function(C,X){const M=`${C}${X}`;return Nr(M)?M:void 0},"getArchitectureDirectionPair"),Lr=dt(function([C,X],M){const G=M[0],N=M[1];return Wt(G)?qt(N)?[C+(G==="L"?-1:1),X+(N==="T"?1:-1)]:[C+(G==="L"?-1:1),X]:Wt(N)?[C+(N==="L"?1:-1),X+(G==="T"?1:-1)]:[C,X+(G==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Cr=dt(function(C){return C==="LT"||C==="TL"?[1,1]:C==="BL"||C==="LB"?[1,-1]:C==="BR"||C==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Ar=dt(function(C,X){return me(C,X)?"bend":Wt(C)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Mr=dt(function(C){return C.type==="service"},"isArchitectureService"),wr=dt(function(C){return C.type==="junction"},"isArchitectureJunction"),Fe=dt(C=>C.data(),"edgeData"),ie=dt(C=>C.data(),"nodeData"),Or=er.architecture,be=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.elements={},this.setAccTitle=ke,this.getAccTitle=qe,this.setDiagramTitle=Qe,this.getDiagramTitle=Je,this.getAccDescription=Ke,this.setAccDescription=je,this.clear()}static{dt(this,"ArchitectureDB")}clear(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},_e()}addService({id:C,icon:X,in:M,title:G,iconText:N}){if(this.registeredIds[C]!==void 0)throw new Error(`The service id [${C}] is already in use by another ${this.registeredIds[C]}`);if(M!==void 0){if(C===M)throw new Error(`The service [${C}] cannot be placed within itself`);if(this.registeredIds[M]===void 0)throw new Error(`The service [${C}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[M]==="node")throw new Error(`The service [${C}]'s parent is not a group`)}this.registeredIds[C]="node",this.nodes[C]={id:C,type:"service",icon:X,iconText:N,title:G,edges:[],in:M}}getServices(){return Object.values(this.nodes).filter(Mr)}addJunction({id:C,in:X}){this.registeredIds[C]="node",this.nodes[C]={id:C,type:"junction",edges:[],in:X}}getJunctions(){return Object.values(this.nodes).filter(wr)}getNodes(){return Object.values(this.nodes)}getNode(C){return this.nodes[C]??null}addGroup({id:C,icon:X,in:M,title:G}){if(this.registeredIds?.[C]!==void 0)throw new Error(`The group id [${C}] is already in use by another ${this.registeredIds[C]}`);if(M!==void 0){if(C===M)throw new Error(`The group [${C}] cannot be placed within itself`);if(this.registeredIds?.[M]===void 0)throw new Error(`The group [${C}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds?.[M]==="node")throw new Error(`The group [${C}]'s parent is not a group`)}this.registeredIds[C]="group",this.groups[C]={id:C,icon:X,title:G,in:M}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:C,rhsId:X,lhsDir:M,rhsDir:G,lhsInto:N,rhsInto:d,lhsGroup:h,rhsGroup:a,title:e}){if(!Ie(M))throw new Error(`Invalid direction given for left hand side of edge ${C}--${X}. Expected (L,R,T,B) got ${String(M)}`);if(!Ie(G))throw new Error(`Invalid direction given for right hand side of edge ${C}--${X}. Expected (L,R,T,B) got ${String(G)}`);if(this.nodes[C]===void 0&&this.groups[C]===void 0)throw new Error(`The left-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[X]===void 0&&this.groups[X]===void 0)throw new Error(`The right-hand id [${X}] does not yet exist. Please create the service/group before declaring an edge to it.`);const r=this.nodes[C].in,l=this.nodes[X].in;if(h&&r&&l&&r==l)throw new Error(`The left-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(a&&r&&l&&r==l)throw new Error(`The right-hand id [${X}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const i={lhsId:C,lhsDir:M,lhsInto:N,lhsGroup:h,rhsId:X,rhsDir:G,rhsInto:d,rhsGroup:a,title:e};this.edges.push(i),this.nodes[C]&&this.nodes[X]&&(this.nodes[C].edges.push(this.edges[this.edges.length-1]),this.nodes[X].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}getDataStructures(){if(this.dataStructures===void 0){const C={},X=Object.entries(this.nodes).reduce((a,[e,r])=>(a[e]=r.edges.reduce((l,i)=>{const u=this.getNode(i.lhsId)?.in,t=this.getNode(i.rhsId)?.in;if(u&&t&&u!==t){const o=Ar(i.lhsDir,i.rhsDir);o!=="bend"&&(C[u]??={},C[u][t]=o,C[t]??={},C[t][u]=o)}if(i.lhsId===e){const o=pe(i.lhsDir,i.rhsDir);o&&(l[o]=i.rhsId)}else{const o=pe(i.rhsDir,i.lhsDir);o&&(l[o]=i.lhsId)}return l},{}),a),{}),M=Object.keys(X)[0],G={[M]:1},N=Object.keys(X).reduce((a,e)=>e===M?a:{...a,[e]:1},{}),d=dt(a=>{const e={[a]:[0,0]},r=[a];for(;r.length>0;){const l=r.shift();if(l){G[l]=1,delete N[l];const i=X[l],[u,t]=e[l];Object.entries(i).forEach(([o,s])=>{G[s]||(e[s]=Lr([u,t],o),r.push(s))})}}return e},"BFS"),h=[d(M)];for(;Object.keys(N).length>0;)h.push(d(Object.keys(N)[0]));this.dataStructures={adjList:X,spatialMaps:h,groupAlignments:C}}return this.dataStructures}setElementForId(C,X){this.elements[C]=X}getElementById(C){return this.elements[C]}getConfig(){return tr({...Or,...rr().architecture})}getConfigField(C){return this.getConfig()[C]}},Dr=dt((C,X)=>{sr(C,X),C.groups.map(M=>X.addGroup(M)),C.services.map(M=>X.addService({...M,type:"service"})),C.junctions.map(M=>X.addJunction({...M,type:"junction"})),C.edges.map(M=>X.addEdge(M))},"populateDb"),Pe={parser:{yy:void 0},parse:dt(async C=>{const X=await hr("architecture",C);Re.debug(X);const M=Pe.parser?.yy;if(!(M instanceof be))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Dr(X,M)},"parse")},xr=dt(C=>` + .edge { + stroke-width: ${C.archEdgeWidth}; + stroke: ${C.archEdgeColor}; + fill: none; + } + + .arrow { + fill: ${C.archEdgeArrowColor}; + } + + .node-bkg { + fill: none; + stroke: ${C.archGroupBorderColor}; + stroke-width: ${C.archGroupBorderWidth}; + stroke-dasharray: 8; + } + .node-icon-text { + display: flex; + align-items: center; + } + + .node-icon-text > div { + color: #fff; + margin: 1px; + height: fit-content; + text-align: center; + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + } +`,"getStyles"),Ir=xr,re=dt(C=>`${C}`,"wrapIcon"),ae={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:re('')},server:{body:re('')},disk:{body:re('')},internet:{body:re('')},cloud:{body:re('')},unknown:or,blank:{body:re("")}}},Rr=dt(async function(C,X,M){const G=M.getConfigField("padding"),N=M.getConfigField("iconSize"),d=N/2,h=N/6,a=h/2;await Promise.all(X.edges().map(async e=>{const{source:r,sourceDir:l,sourceArrow:i,sourceGroup:u,target:t,targetDir:o,targetArrow:s,targetGroup:c,label:f}=Fe(e);let{x:T,y:g}=e[0].sourceEndpoint();const{x:v,y:L}=e[0].midpoint();let{x:F,y:A}=e[0].targetEndpoint();const b=G+4;if(u&&(Wt(l)?T+=l==="L"?-b:b:g+=l==="T"?-b:b+18),c&&(Wt(o)?F+=o==="L"?-b:b:A+=o==="T"?-b:b+18),!u&&M.getNode(r)?.type==="junction"&&(Wt(l)?T+=l==="L"?d:-d:g+=l==="T"?d:-d),!c&&M.getNode(t)?.type==="junction"&&(Wt(o)?F+=o==="L"?d:-d:A+=o==="T"?d:-d),e[0]._private.rscratch){const k=C.insert("g");if(k.insert("path").attr("d",`M ${T},${g} L ${v},${L} L${F},${A} `).attr("class","edge").attr("id",ar(r,t,{prefix:"L"})),i){const U=Wt(l)?oe[l](T,h):T-a,K=qt(l)?oe[l](g,h):g-a;k.insert("polygon").attr("points",xe[l](h)).attr("transform",`translate(${U},${K})`).attr("class","arrow")}if(s){const U=Wt(o)?oe[o](F,h):F-a,K=qt(o)?oe[o](A,h):A-a;k.insert("polygon").attr("points",xe[o](h)).attr("transform",`translate(${U},${K})`).attr("class","arrow")}if(f){const U=me(l,o)?"XY":Wt(l)?"X":"Y";let K=0;U==="X"?K=Math.abs(T-F):U==="Y"?K=Math.abs(g-A)/1.5:K=Math.abs(T-F)/2;const D=k.append("g");if(await Ee(D,f,{useHtmlLabels:!1,width:K,classes:"architecture-service-label"},ye()),D.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),U==="X")D.attr("transform","translate("+v+", "+L+")");else if(U==="Y")D.attr("transform","translate("+v+", "+L+") rotate(-90)");else if(U==="XY"){const it=pe(l,o);if(it&&Tr(it)){const n=D.node().getBoundingClientRect(),[m,p]=Cr(it);D.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*m*p*45})`);const E=D.node().getBoundingClientRect();D.attr("transform",` + translate(${v}, ${L-n.height/2}) + translate(${m*E.width/2}, ${p*E.height/2}) + rotate(${-1*m*p*45}, 0, ${n.height/2}) + `)}}}}}))},"drawEdges"),Sr=dt(async function(C,X,M){const N=M.getConfigField("padding")*.75,d=M.getConfigField("fontSize"),a=M.getConfigField("iconSize")/2;await Promise.all(X.nodes().map(async e=>{const r=ie(e);if(r.type==="group"){const{h:l,w:i,x1:u,y1:t}=e.boundingBox(),o=C.append("rect");o.attr("id",`group-${r.id}`).attr("x",u+a).attr("y",t+a).attr("width",i).attr("height",l).attr("class","node-bkg");const s=C.append("g");let c=u,f=t;if(r.icon){const T=s.append("g");T.html(`${await ve(r.icon,{height:N,width:N,fallbackPrefix:ae.prefix})}`),T.attr("transform","translate("+(c+a+1)+", "+(f+a+1)+")"),c+=N,f+=d/2-1-2}if(r.label){const T=s.append("g");await Ee(T,r.label,{useHtmlLabels:!1,width:i,classes:"architecture-service-label"},ye()),T.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),T.attr("transform","translate("+(c+a+4)+", "+(f+a+2)+")")}M.setElementForId(r.id,o)}}))},"drawGroups"),Fr=dt(async function(C,X,M){const G=ye();for(const N of M){const d=X.append("g"),h=C.getConfigField("iconSize");if(N.title){const l=d.append("g");await Ee(l,N.title,{useHtmlLabels:!1,width:h*1.5,classes:"architecture-service-label"},G),l.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),l.attr("transform","translate("+h/2+", "+h+")")}const a=d.append("g");if(N.icon)a.html(`${await ve(N.icon,{height:h,width:h,fallbackPrefix:ae.prefix})}`);else if(N.iconText){a.html(`${await ve("blank",{height:h,width:h,fallbackPrefix:ae.prefix})}`);const u=a.append("g").append("foreignObject").attr("width",h).attr("height",h).append("div").attr("class","node-icon-text").attr("style",`height: ${h}px;`).append("div").html(ir(N.iconText,G)),t=parseInt(window.getComputedStyle(u.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;u.attr("style",`-webkit-line-clamp: ${Math.floor((h-2)/t)};`)}else a.append("path").attr("class","node-bkg").attr("id","node-"+N.id).attr("d",`M0 ${h} v${-h} q0,-5 5,-5 h${h} q5,0 5,5 v${h} H0 Z`);d.attr("id",`service-${N.id}`).attr("class","architecture-service");const{width:e,height:r}=d.node().getBBox();N.width=e,N.height=r,C.setElementForId(N.id,d)}return 0},"drawServices"),br=dt(function(C,X,M){M.forEach(G=>{const N=X.append("g"),d=C.getConfigField("iconSize");N.append("g").append("rect").attr("id","node-"+G.id).attr("fill-opacity","0").attr("width",d).attr("height",d),N.attr("class","architecture-junction");const{width:a,height:e}=N._groups[0][0].getBBox();N.width=a,N.height=e,C.setElementForId(G.id,N)})},"drawJunctions");nr([{name:ae.prefix,icons:ae}]);Se.use(Er);function Ge(C,X,M){C.forEach(G=>{X.add({group:"nodes",data:{type:"service",id:G.id,icon:G.icon,label:G.title,parent:G.in,width:M.getConfigField("iconSize"),height:M.getConfigField("iconSize")},classes:"node-service"})})}dt(Ge,"addServices");function Ue(C,X,M){C.forEach(G=>{X.add({group:"nodes",data:{type:"junction",id:G.id,parent:G.in,width:M.getConfigField("iconSize"),height:M.getConfigField("iconSize")},classes:"node-junction"})})}dt(Ue,"addJunctions");function Ye(C,X){X.nodes().map(M=>{const G=ie(M);if(G.type==="group")return;G.x=M.position().x,G.y=M.position().y,C.getElementById(G.id).attr("transform","translate("+(G.x||0)+","+(G.y||0)+")")})}dt(Ye,"positionNodes");function Xe(C,X){C.forEach(M=>{X.add({group:"nodes",data:{type:"group",id:M.id,icon:M.icon,label:M.title,parent:M.in},classes:"node-group"})})}dt(Xe,"addGroups");function He(C,X){C.forEach(M=>{const{lhsId:G,rhsId:N,lhsInto:d,lhsGroup:h,rhsInto:a,lhsDir:e,rhsDir:r,rhsGroup:l,title:i}=M,u=me(M.lhsDir,M.rhsDir)?"segments":"straight",t={id:`${G}-${N}`,label:i,source:G,sourceDir:e,sourceArrow:d,sourceGroup:h,sourceEndpoint:e==="L"?"0 50%":e==="R"?"100% 50%":e==="T"?"50% 0":"50% 100%",target:N,targetDir:r,targetArrow:a,targetGroup:l,targetEndpoint:r==="L"?"0 50%":r==="R"?"100% 50%":r==="T"?"50% 0":"50% 100%"};X.add({group:"edges",data:t,classes:u})})}dt(He,"addEdges");function We(C,X,M){const G=dt((a,e)=>Object.entries(a).reduce((r,[l,i])=>{let u=0;const t=Object.entries(i);if(t.length===1)return r[l]=t[0][1],r;for(let o=0;o{const e={},r={};return Object.entries(a).forEach(([l,[i,u]])=>{const t=C.getNode(l)?.in??"default";e[u]??={},e[u][t]??=[],e[u][t].push(l),r[i]??={},r[i][t]??=[],r[i][t].push(l)}),{horiz:Object.values(G(e,"horizontal")).filter(l=>l.length>1),vert:Object.values(G(r,"vertical")).filter(l=>l.length>1)}}),[d,h]=N.reduce(([a,e],{horiz:r,vert:l})=>[[...a,...r],[...e,...l]],[[],[]]);return{horizontal:d,vertical:h}}dt(We,"getAlignments");function Ve(C,X){const M=[],G=dt(d=>`${d[0]},${d[1]}`,"posToStr"),N=dt(d=>d.split(",").map(h=>parseInt(h)),"strToPos");return C.forEach(d=>{const h=Object.fromEntries(Object.entries(d).map(([l,i])=>[G(i),l])),a=[G([0,0])],e={},r={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;a.length>0;){const l=a.shift();if(l){e[l]=1;const i=h[l];if(i){const u=N(l);Object.entries(r).forEach(([t,o])=>{const s=G([u[0]+o[0],u[1]+o[1]]),c=h[s];c&&!e[s]&&(a.push(s),M.push({[De[t]]:c,[De[mr(t)]]:i,gap:1.5*X.getConfigField("iconSize")}))})}}}}),M}dt(Ve,"getRelativeConstraints");function ze(C,X,M,G,N,{spatialMaps:d,groupAlignments:h}){return new Promise(a=>{const e=fr("body").append("div").attr("id","cy").attr("style","display:none"),r=Se({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight",label:"data(label)","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${N.getConfigField("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${N.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});e.remove(),Xe(M,r),Ge(C,r,N),Ue(X,r,N),He(G,r);const l=We(N,d,h),i=Ve(d,N),u=r.layout({name:"fcose",quality:"proof",styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(t){const[o,s]=t.connectedNodes(),{parent:c}=ie(o),{parent:f}=ie(s);return c===f?1.5*N.getConfigField("iconSize"):.5*N.getConfigField("iconSize")},edgeElasticity(t){const[o,s]=t.connectedNodes(),{parent:c}=ie(o),{parent:f}=ie(s);return c===f?.45:.001},alignmentConstraint:l,relativePlacementConstraint:i});u.one("layoutstop",()=>{function t(o,s,c,f){let T,g;const{x:v,y:L}=o,{x:F,y:A}=s;g=(f-L+(v-c)*(L-A)/(v-F))/Math.sqrt(1+Math.pow((L-A)/(v-F),2)),T=Math.sqrt(Math.pow(f-L,2)+Math.pow(c-v,2)-Math.pow(g,2));const b=Math.sqrt(Math.pow(F-v,2)+Math.pow(A-L,2));T=T/b;let k=(F-v)*(f-L)-(A-L)*(c-v);switch(!0){case k>=0:k=1;break;case k<0:k=-1;break}let U=(F-v)*(c-v)+(A-L)*(f-L);switch(!0){case U>=0:U=1;break;case U<0:U=-1;break}return g=Math.abs(g)*k,T=T*U,{distances:g,weights:T}}dt(t,"getSegmentWeights"),r.startBatch();for(const o of Object.values(r.edges()))if(o.data?.()){const{x:s,y:c}=o.source().position(),{x:f,y:T}=o.target().position();if(s!==f&&c!==T){const g=o.sourceEndpoint(),v=o.targetEndpoint(),{sourceDir:L}=Fe(o),[F,A]=qt(L)?[g.x,v.y]:[v.x,g.y],{weights:b,distances:k}=t(g,v,F,A);o.style("segment-distances",k),o.style("segment-weights",b)}}r.endBatch(),u.run()}),u.run(),r.ready(t=>{Re.info("Ready",t),a(r)})})}dt(ze,"layoutArchitecture");var Pr=dt(async(C,X,M,G)=>{const N=G.db,d=N.getServices(),h=N.getJunctions(),a=N.getGroups(),e=N.getEdges(),r=N.getDataStructures(),l=Be(X),i=l.append("g");i.attr("class","architecture-edges");const u=l.append("g");u.attr("class","architecture-services");const t=l.append("g");t.attr("class","architecture-groups"),await Fr(N,u,d),br(N,u,h);const o=await ze(d,h,a,e,N,r);await Rr(i,o,N),await Sr(t,o,N),Ye(N,o),Ze(void 0,l,N.getConfigField("padding"),N.getConfigField("useMaxWidth"))},"draw"),Gr={draw:Pr},qr={parser:Pe,get db(){return new be},renderer:Gr,styles:Ir};export{qr as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/assetContainer-D7EiOqw6.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/assetContainer-D7EiOqw6.js new file mode 100644 index 0000000000000000000000000000000000000000..9be93f1e153128dc57664a830c6425bfc297a9fa --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/assetContainer-D7EiOqw6.js @@ -0,0 +1 @@ +import{bg as B,d as b,L as y,J as N,bh as A,M as k,c as O,at as P,l as x,R as V,aq as D,aI as C,b1 as L,bi as w}from"./index-CDrXokXW.js";x._instancedMeshFactory=(u,e)=>{const t=new T(u,e);if(e.instancedBuffers){t.instancedBuffers={};for(const s in e.instancedBuffers)t.instancedBuffers[s]=e.instancedBuffers[s]}return t};class T extends B{constructor(e,t){super(e,t.getScene()),this._indexInSourceMeshInstanceArray=-1,this._distanceToCamera=0,t.addInstance(this),this._sourceMesh=t,this._unIndexed=t._unIndexed,this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scaling.copyFrom(t.scaling),t.rotationQuaternion&&(this.rotationQuaternion=t.rotationQuaternion.clone()),this.animations=t.animations.slice();for(const s of t.getAnimationRanges())s!=null&&this.createAnimationRange(s.name,s.from,s.to);if(this.infiniteDistance=t.infiniteDistance,this.setPivotMatrix(t.getPivotMatrix()),!t.skeleton&&!t.morphTargetManager&&t.hasBoundingInfo){const s=t.getBoundingInfo();this.buildBoundingInfo(s.minimum,s.maximum)}else this.refreshBoundingInfo(!0,!0);this._syncSubMeshes()}getClassName(){return"InstancedMesh"}get lightSources(){return this._sourceMesh._lightSources}_resyncLightSources(){}_resyncLightSource(){}_removeLightSource(){}get receiveShadows(){return this._sourceMesh.receiveShadows}set receiveShadows(e){this._sourceMesh?.receiveShadows!==e&&b.Warn("Setting receiveShadows on an instanced mesh has no effect")}get material(){return this._sourceMesh.material}set material(e){this._sourceMesh?.material!==e&&b.Warn("Setting material on an instanced mesh has no effect")}get visibility(){return this._sourceMesh.visibility}set visibility(e){this._sourceMesh?.visibility!==e&&b.Warn("Setting visibility on an instanced mesh has no effect")}get skeleton(){return this._sourceMesh.skeleton}set skeleton(e){this._sourceMesh?.skeleton!==e&&b.Warn("Setting skeleton on an instanced mesh has no effect")}get renderingGroupId(){return this._sourceMesh.renderingGroupId}set renderingGroupId(e){!this._sourceMesh||e===this._sourceMesh.renderingGroupId||y.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene")}getTotalVertices(){return this._sourceMesh?this._sourceMesh.getTotalVertices():0}getTotalIndices(){return this._sourceMesh.getTotalIndices()}get sourceMesh(){return this._sourceMesh}get geometry(){return this._sourceMesh._geometry}createInstance(e){return this._sourceMesh.createInstance(e)}isReady(e=!1){return this._sourceMesh.isReady(e,!0)}getVerticesData(e,t,s){return this._sourceMesh.getVerticesData(e,t,s)}copyVerticesData(e,t){this._sourceMesh.copyVerticesData(e,t)}getVertexBuffer(e,t){return this._sourceMesh.getVertexBuffer(e,t)}setVerticesData(e,t,s,n){return this.sourceMesh&&this.sourceMesh.setVerticesData(e,t,s,n),this.sourceMesh}updateVerticesData(e,t,s,n){return this.sourceMesh&&this.sourceMesh.updateVerticesData(e,t,s,n),this.sourceMesh}setIndices(e,t=null){return this.sourceMesh&&this.sourceMesh.setIndices(e,t),this.sourceMesh}isVerticesDataPresent(e){return this._sourceMesh.isVerticesDataPresent(e)}getIndices(){return this._sourceMesh.getIndices()}get _positions(){return this._sourceMesh._positions}refreshBoundingInfo(e=!1,t=!1){if(this.hasBoundingInfo&&this.getBoundingInfo().isLocked)return this;let s;typeof e=="object"?s=e:s={applySkeleton:e,applyMorph:t};const n=this._sourceMesh.geometry?this._sourceMesh.geometry.boundingBias:null;return this._refreshBoundingInfo(this._sourceMesh._getData(s,null,N.PositionKind),n),this}_preActivate(){return this._currentLOD&&this._currentLOD._preActivate(),this}_activate(e,t){if(super._activate(e,t),this._sourceMesh.subMeshes||y.Warn("Instances should only be created for meshes with geometry."),this._currentLOD){if(this._currentLOD._getWorldMatrixDeterminant()>=0!=this._getWorldMatrixDeterminant()>=0)return this._internalAbstractMeshDataInfo._actAsRegularMesh=!0,!0;if(this._internalAbstractMeshDataInfo._actAsRegularMesh=!1,this._currentLOD._registerInstanceForRenderId(this,e),t){if(!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!0,!0}else if(!this._currentLOD._internalAbstractMeshDataInfo._isActive)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances=!0,!0}return!1}_postActivate(){this._sourceMesh.edgesShareWithInstances&&this._sourceMesh._edgesRenderer&&this._sourceMesh._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup?(this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer),this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix())):this._edgesRenderer&&this._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup&&this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer)}getWorldMatrix(){if(this._currentLOD&&this._currentLOD!==this._sourceMesh&&this._currentLOD.billboardMode!==A.BILLBOARDMODE_NONE&&this._currentLOD._masterMesh!==this){this._billboardWorldMatrix||(this._billboardWorldMatrix=new k);const e=this._currentLOD._masterMesh;return this._currentLOD._masterMesh=this,O.Vector3[7].copyFrom(this._currentLOD.position),this._currentLOD.position.set(0,0,0),this._billboardWorldMatrix.copyFrom(this._currentLOD.computeWorldMatrix(!0)),this._currentLOD.position.copyFrom(O.Vector3[7]),this._currentLOD._masterMesh=e,this._billboardWorldMatrix}return super.getWorldMatrix()}get isAnInstance(){return!0}getLOD(e){if(!e)return this;const t=this.sourceMesh.getLODLevels();if(!t||t.length===0)this._currentLOD=this.sourceMesh;else{const s=this.getBoundingInfo();this._currentLOD=this.sourceMesh.getLOD(e,s.boundingSphere)}return this._currentLOD}_preActivateForIntermediateRendering(e){return this.sourceMesh._preActivateForIntermediateRendering(e)}_syncSubMeshes(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(let e=0;e{this._wasAddedToScene||this.dispose()}),this._onContextRestoredObserver=e.getEngine().onContextRestoredObservable.add(()=>{for(const t of this.geometries)t._rebuild();for(const t of this.meshes)t._rebuild();for(const t of this.particleSystems)t.rebuild();for(const t of this.textures)t._rebuild()}))}_topologicalSort(e){const t=new Map;for(const c of e)t.set(c.uniqueId,c);const s={dependsOn:new Map,dependedBy:new Map};for(const c of e){const o=c.uniqueId;s.dependsOn.set(o,new Set),s.dependedBy.set(o,new Set)}for(const c of e){const o=c.uniqueId,a=s.dependsOn.get(o);if(c instanceof T){const g=c.sourceMesh;t.has(g.uniqueId)&&(a.add(g.uniqueId),s.dependedBy.get(g.uniqueId).add(o))}const _=s.dependedBy.get(o);for(const g of c.getDescendants()){const I=g.uniqueId;t.has(I)&&(_.add(I),s.dependsOn.get(I).add(o))}}const n=[],r=[];for(const c of e){const o=c.uniqueId;s.dependsOn.get(o).size===0&&(r.push(c),t.delete(o))}const l=r;for(;l.length>0;){const c=l.shift();n.push(c);const o=s.dependedBy.get(c.uniqueId);for(const a of Array.from(o.values())){const _=s.dependsOn.get(a);_.delete(c.uniqueId),_.size===0&&t.get(a)&&(l.push(t.get(a)),t.delete(a))}}return t.size>0&&(y.Error("SceneSerializer._topologicalSort: There were unvisited nodes:"),t.forEach(c=>{y.Error(c.name)})),n}_addNodeAndDescendantsToList(e,t,s,n){if(!(!s||n&&!n(s)||t.has(s.uniqueId))){e.push(s),t.add(s.uniqueId);for(const r of s.getDescendants(!0))this._addNodeAndDescendantsToList(e,t,r,n)}}_isNodeInContainer(e){return e instanceof B&&this.meshes.indexOf(e)!==-1||e instanceof A&&this.transformNodes.indexOf(e)!==-1||e instanceof C&&this.lights.indexOf(e)!==-1||e instanceof L&&this.cameras.indexOf(e)!==-1}_isValidHierarchy(){for(const e of this.meshes)if(e.parent&&!this._isNodeInContainer(e.parent))return y.Warn(`Node ${e.name} has a parent that is not in the container.`),!1;for(const e of this.transformNodes)if(e.parent&&!this._isNodeInContainer(e.parent))return y.Warn(`Node ${e.name} has a parent that is not in the container.`),!1;for(const e of this.lights)if(e.parent&&!this._isNodeInContainer(e.parent))return y.Warn(`Node ${e.name} has a parent that is not in the container.`),!1;for(const e of this.cameras)if(e.parent&&!this._isNodeInContainer(e.parent))return y.Warn(`Node ${e.name} has a parent that is not in the container.`),!1;return!0}instantiateModelsToScene(e,t=!1,s){this._isValidHierarchy()||b.Warn("SceneSerializer.InstantiateModelsToScene: The Asset Container hierarchy is not valid.");const n={},r={},l=new G,c=[],o=[],a={doNotInstantiate:!0,...s},_=(i,h)=>{if(n[i.uniqueId]=h.uniqueId,r[h.uniqueId]=h,e&&(h.name=e(i.name)),h instanceof x){const d=h;if(d.morphTargetManager){const m=i.morphTargetManager;d.morphTargetManager=m.clone();for(let p=0;p{if(_(i,h),i.parent){const d=n[i.parent.uniqueId],m=r[d];m?h.parent=m:h.parent=i.parent}if(h.position&&i.position&&h.position.copyFrom(i.position),h.rotationQuaternion&&i.rotationQuaternion&&h.rotationQuaternion.copyFrom(i.rotationQuaternion),h.rotation&&i.rotation&&h.rotation.copyFrom(i.rotation),h.scaling&&i.scaling&&h.scaling.copyFrom(i.scaling),h.material){const d=h;if(d.material)if(t){const m=i.material;if(o.indexOf(m)===-1){let p=m.clone(e?e(m.name):"Clone of "+m.name);if(o.push(m),n[m.uniqueId]=p.uniqueId,r[p.uniqueId]=p,m.getClassName()==="MultiMaterial"){const v=m;for(const M of v.subMaterials)M&&(p=M.clone(e?e(M.name):"Clone of "+M.name),o.push(M),n[M.uniqueId]=p.uniqueId,r[p.uniqueId]=p);v.subMaterials=v.subMaterials.map(M=>M&&r[n[M.uniqueId]])}}d.getClassName()!=="InstancedMesh"&&(d.material=r[n[m.uniqueId]])}else d.material.getClassName()==="MultiMaterial"?this.scene.multiMaterials.indexOf(d.material)===-1&&this.scene.addMultiMaterial(d.material):this.scene.materials.indexOf(d.material)===-1&&this.scene.addMaterial(d.material)}h.parent===null&&l.rootNodes.push(h)};for(const i of S)if(i.getClassName()==="InstancedMesh"){const h=i,d=h.sourceMesh,m=n[d.uniqueId],v=(typeof m=="number"?r[m]:d).createInstance(h.name);f(h,v)}else{let h=!0;i.getClassName()==="TransformNode"||i.getClassName()==="Node"||i.skeleton||!i.getTotalVertices||i.getTotalVertices()===0?h=!1:a.doNotInstantiate&&(typeof a.doNotInstantiate=="function"?h=!a.doNotInstantiate(i):h=!a.doNotInstantiate);const d=h?i.createInstance(`instance of ${i.name}`):i.clone(`Clone of ${i.name}`,null,!0);if(!d)throw new Error(`Could not clone or instantiate node on Asset Container ${i.name}`);f(i,d)}for(const i of this.skeletons){if(a.predicate&&!a.predicate(i))continue;const h=i.clone(e?e(i.name):"Clone of "+i.name);for(const d of this.meshes)if(d.skeleton===i&&!d.isAnInstance){const m=r[n[d.uniqueId]];if(!m||m.isAnInstance||(m.skeleton=h,c.indexOf(h)!==-1))continue;c.push(h);for(const p of h.bones)p._linkedTransformNode&&(p._linkedTransformNode=r[n[p._linkedTransformNode.uniqueId]])}l.skeletons.push(h)}for(const i of this.animationGroups){if(a.predicate&&!a.predicate(i))continue;const h=i.clone(e?e(i.name):"Clone of "+i.name,d=>r[n[d.uniqueId]]||d);l.animationGroups.push(h)}return l}addAllToScene(){if(!this._wasAddedToScene){this._isValidHierarchy()||b.Warn("SceneSerializer.addAllToScene: The Asset Container hierarchy is not valid."),this._wasAddedToScene=!0,this.addToScene(null),this.environmentTexture&&(this.scene.environmentTexture=this.environmentTexture);for(const e of this.scene._serializableComponents)e.addFromContainer(this);this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null}}addToScene(e=null){const t=[];for(const s of this.cameras)e&&!e(s)||(this.scene.addCamera(s),t.push(s));for(const s of this.lights)e&&!e(s)||(this.scene.addLight(s),t.push(s));for(const s of this.meshes)e&&!e(s)||(this.scene.addMesh(s),t.push(s));for(const s of this.skeletons)e&&!e(s)||this.scene.addSkeleton(s);for(const s of this.animations)e&&!e(s)||this.scene.addAnimation(s);for(const s of this.animationGroups)e&&!e(s)||this.scene.addAnimationGroup(s);for(const s of this.multiMaterials)e&&!e(s)||this.scene.addMultiMaterial(s);for(const s of this.materials)e&&!e(s)||this.scene.addMaterial(s);for(const s of this.morphTargetManagers)e&&!e(s)||this.scene.addMorphTargetManager(s);for(const s of this.geometries)e&&!e(s)||this.scene.addGeometry(s);for(const s of this.transformNodes)e&&!e(s)||(this.scene.addTransformNode(s),t.push(s));for(const s of this.actionManagers)e&&!e(s)||this.scene.addActionManager(s);for(const s of this.textures)e&&!e(s)||this.scene.addTexture(s);for(const s of this.reflectionProbes)e&&!e(s)||this.scene.addReflectionProbe(s);if(t.length){const s=new Set(this.scene.meshes);for(const n of this.scene.lights)s.add(n);for(const n of this.scene.cameras)s.add(n);for(const n of this.scene.transformNodes)s.add(n);for(const n of this.skeletons)for(const r of n.bones)s.add(r);for(const n of t)n.parent&&!s.has(n.parent)&&(n.setParent?n.setParent(null):n.parent=null)}}removeAllFromScene(){this._isValidHierarchy()||b.Warn("SceneSerializer.removeAllFromScene: The Asset Container hierarchy is not valid."),this._wasAddedToScene=!1,this.removeFromScene(null),this.environmentTexture===this.scene.environmentTexture&&(this.scene.environmentTexture=null);for(const e of this.scene._serializableComponents)e.removeFromContainer(this)}removeFromScene(e=null){for(const t of this.cameras)e&&!e(t)||this.scene.removeCamera(t);for(const t of this.lights)e&&!e(t)||this.scene.removeLight(t);for(const t of this.meshes)e&&!e(t)||this.scene.removeMesh(t,!0);for(const t of this.skeletons)e&&!e(t)||this.scene.removeSkeleton(t);for(const t of this.animations)e&&!e(t)||this.scene.removeAnimation(t);for(const t of this.animationGroups)e&&!e(t)||this.scene.removeAnimationGroup(t);for(const t of this.multiMaterials)e&&!e(t)||this.scene.removeMultiMaterial(t);for(const t of this.materials)e&&!e(t)||this.scene.removeMaterial(t);for(const t of this.morphTargetManagers)e&&!e(t)||this.scene.removeMorphTargetManager(t);for(const t of this.geometries)e&&!e(t)||this.scene.removeGeometry(t);for(const t of this.transformNodes)e&&!e(t)||this.scene.removeTransformNode(t);for(const t of this.actionManagers)e&&!e(t)||this.scene.removeActionManager(t);for(const t of this.textures)e&&!e(t)||this.scene.removeTexture(t);for(const t of this.reflectionProbes)e&&!e(t)||this.scene.removeReflectionProbe(t)}dispose(){const e=this.cameras.slice(0);for(const f of e)f.dispose();this.cameras.length=0;const t=this.lights.slice(0);for(const f of t)f.dispose();this.lights.length=0;const s=this.meshes.slice(0);for(const f of s)f.dispose();this.meshes.length=0;const n=this.skeletons.slice(0);for(const f of n)f.dispose();this.skeletons.length=0;const r=this.animationGroups.slice(0);for(const f of r)f.dispose();this.animationGroups.length=0;const l=this.multiMaterials.slice(0);for(const f of l)f.dispose();this.multiMaterials.length=0;const c=this.materials.slice(0);for(const f of c)f.dispose();this.materials.length=0;const o=this.geometries.slice(0);for(const f of o)f.dispose();this.geometries.length=0;const a=this.transformNodes.slice(0);for(const f of a)f.dispose();this.transformNodes.length=0;const _=this.actionManagers.slice(0);for(const f of _)f.dispose();this.actionManagers.length=0;const g=this.textures.slice(0);for(const f of g)f.dispose();this.textures.length=0;const I=this.reflectionProbes.slice(0);for(const f of I)f.dispose();this.reflectionProbes.length=0;const S=this.morphTargetManagers.slice(0);for(const f of S)f.dispose();this.morphTargetManagers.length=0,this.environmentTexture&&(this.environmentTexture.dispose(),this.environmentTexture=null);for(const f of this.scene._serializableComponents)f.removeFromContainer(this,!0);this._onContextRestoredObserver&&(this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null)}_moveAssets(e,t,s){if(!(!e||!t))for(const n of e){let r=!0;if(s){for(const l of s)if(n===l){r=!1;break}}r&&(t.push(n),n._parentContainer=this)}}moveAllFromScene(e){this._wasAddedToScene=!1,e===void 0&&(e=new q);for(const t in this)Object.prototype.hasOwnProperty.call(this,t)&&(this[t]=this[t]||(t==="_environmentTexture"?null:[]),this._moveAssets(this.scene[t],this[t],e[t]));this.environmentTexture=this.scene.environmentTexture,this.removeAllFromScene()}createRootMesh(){const e=new x("assetContainerRootMesh",this.scene);for(const t of this.meshes)t.parent||e.addChild(t);return this.meshes.unshift(e),e}mergeAnimationsTo(e=D.LastCreatedScene,t,s=null){if(!e)return y.Error("No scene available to merge animations to"),[];const n=s||(o=>{let a=null;const _=o.animations.length?o.animations[0].targetProperty:"",g=o.name.split(".").join("").split("_primitive")[0];switch(_){case"position":case"rotationQuaternion":a=e.getTransformNodeByName(o.name)||e.getTransformNodeByName(g);break;case"influence":a=e.getMorphTargetByName(o.name)||e.getMorphTargetByName(g);break;default:a=e.getNodeByName(o.name)||e.getNodeByName(g)}return a}),r=this.getNodes();for(const o of r){const a=n(o);if(a!==null){for(const _ of o.animations){const g=a.animations.filter(I=>I.targetProperty===_.targetProperty);for(const I of g){const S=a.animations.indexOf(I,0);S>-1&&a.animations.splice(S,1)}}a.animations=a.animations.concat(o.animations)}}const l=[],c=this.animationGroups.slice();for(const o of c){l.push(o.clone(o.name,n));for(const a of o.animatables)a.stop()}for(const o of t){const a=n(o.target);a&&(e.beginAnimation(a,o.fromFrame,o.toFrame,o.loopAnimation,o.speedRatio,o.onAnimationEnd?o.onAnimationEnd:void 0,void 0,!0,void 0,o.onAnimationLoop?o.onAnimationLoop:void 0),e.stopAnimation(o.target))}return l}populateRootNodes(){this.rootNodes.length=0;for(const e of this.meshes)!e.parent&&this.rootNodes.indexOf(e)===-1&&this.rootNodes.push(e);for(const e of this.transformNodes)!e.parent&&this.rootNodes.indexOf(e)===-1&&this.rootNodes.push(e);for(const e of this.lights)!e.parent&&this.rootNodes.indexOf(e)===-1&&this.rootNodes.push(e);for(const e of this.cameras)!e.parent&&this.rootNodes.indexOf(e)===-1&&this.rootNodes.push(e)}addAllAssetsToContainer(e){if(!e)return;const t=[],s=new Set;for(t.push(e);t.length>0;){const n=t.pop();if(n instanceof x?(n.geometry&&this.geometries.indexOf(n.geometry)===-1&&this.geometries.push(n.geometry),this.meshes.push(n)):n instanceof T?this.meshes.push(n):n instanceof A?this.transformNodes.push(n):n instanceof C?this.lights.push(n):n instanceof L&&this.cameras.push(n),n instanceof B){if(n.material&&this.materials.indexOf(n.material)===-1){this.materials.push(n.material);for(const r of n.material.getActiveTextures())this.textures.indexOf(r)===-1&&this.textures.push(r)}n.skeleton&&this.skeletons.indexOf(n.skeleton)===-1&&this.skeletons.push(n.skeleton),n.morphTargetManager&&this.morphTargetManagers.indexOf(n.morphTargetManager)===-1&&this.morphTargetManagers.push(n.morphTargetManager)}for(const r of n.getChildren())s.has(r)||t.push(r);s.add(n)}this.populateRootNodes()}_getByTags(e,t,s){if(t===void 0)return e;const n=[];for(const r in e){const l=e[r];w&&w.MatchesQuery(l,t)&&(!s||s(l))&&n.push(l)}return n}getMeshesByTags(e,t){return this._getByTags(this.meshes,e,t)}getCamerasByTags(e,t){return this._getByTags(this.cameras,e,t)}getLightsByTags(e,t){return this._getByTags(this.lights,e,t)}getMaterialsByTags(e,t){return this._getByTags(this.materials,e,t).concat(this._getByTags(this.multiMaterials,e,t))}getTransformNodesByTags(e,t){return this._getByTags(this.transformNodes,e,t)}}export{F as A}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/audioEngine-C797_5QL.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/audioEngine-C797_5QL.js new file mode 100644 index 0000000000000000000000000000000000000000..28d495be566cb056e2769e3b86282bd59193e758 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/audioEngine-C797_5QL.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./webAudioBus-Dmzu4Bvq.js","./abstractAudioBus-CCAQY1jG.js","./webAudioBaseSubGraph-CNNuTFUE.js","./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./spatialWebAudio-CBDS0rWd.js","./webAudioMainBus-COw9bIbJ.js","./webAudioStaticSound-C9f3HBnG.js","./abstractSoundInstance-Cb1S6dEM.js","./abstractSoundSource-D3oGzC3p.js","./webAudioSoundSource-CHASmwKl.js","./webAudioStreamingSound-orB8PSId.js"])))=>i.map(i=>d[i]); +import{af as l}from"./index-DWyDLubb.js";import{O as h,V as o,ao as _,L as v,by as R,M as N,aq as E,A as P}from"./index-CDrXokXW.js";var y;(function(n){n[n.HAS_INPUTS=1]="HAS_INPUTS",n[n.HAS_OUTPUTS=2]="HAS_OUTPUTS",n[n.HAS_INPUTS_AND_OUTPUTS=3]="HAS_INPUTS_AND_OUTPUTS"})(y||(y={}));class T{constructor(t,e){this.onDisposeObservable=new h,this.engine=t,e&1&&(this._upstreamNodes=new Set),e&2&&(this._downstreamNodes=new Set)}dispose(){if(this._downstreamNodes){for(const t of Array.from(this._downstreamNodes))if(!this._disconnect(t))throw new Error("Disconnect failed");this._downstreamNodes.clear()}if(this._upstreamNodes){for(const t of Array.from(this._upstreamNodes))if(!t._disconnect(this))throw new Error("Disconnect failed");this._upstreamNodes.clear()}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()}_connect(t){return!this._downstreamNodes||this._downstreamNodes.has(t)||!t._onConnect(this)?!1:(this._downstreamNodes.add(t),!0)}_disconnect(t){return!this._downstreamNodes||!this._downstreamNodes.delete(t)?!1:t._onDisconnect(this)}_onConnect(t){return!this._upstreamNodes||this._upstreamNodes.has(t)?!1:(this._upstreamNodes.add(t),!0)}_onDisconnect(t){return this._upstreamNodes?.delete(t)??!1}}class K extends T{constructor(t,e,i){super(e,i),this.onNameChangedObservable=new h,this._name=t}get name(){return this._name}set name(t){if(this._name===t)return;const e=this._name;this._name=t,this.onNameChangedObservable.notifyObservers({newName:t,oldName:e,node:this})}dispose(){super.dispose(),this.onNameChangedObservable.clear()}}class C{constructor(t){this._attachmentType=3,this._position=new o,this._rotationQuaternion=new _,this._sceneNode=null,this._useBoundingBox=!1,this.dispose=()=>{this.detach()},this._spatialAudioNode=t}get isAttached(){return this._sceneNode!==null}attach(t,e,i){this._sceneNode!==t&&(this.detach(),t&&(this._attachmentType=i,this._sceneNode=t,this._sceneNode.onDisposeObservable.add(this.dispose),this._useBoundingBox=e))}detach(){this._sceneNode?.onDisposeObservable.removeCallback(this.dispose),this._sceneNode=null}update(){this._attachmentType&1&&(this._useBoundingBox&&this._sceneNode.getBoundingInfo?this._position.copyFrom(this._sceneNode.getBoundingInfo().boundingBox.centerWorld):this._sceneNode?.getWorldMatrix().getTranslationToRef(this._position),this._spatialAudioNode.position.copyFrom(this._position),this._spatialAudioNode._updatePosition()),this._attachmentType&2&&(this._sceneNode?.getWorldMatrix().decompose(void 0,this._rotationQuaternion),this._spatialAudioNode.rotationQuaternion.copyFrom(this._rotationQuaternion),this._spatialAudioNode._updateRotation())}}const tt=new RegExp("\\.(\\w{3,4})($|\\?)"),d=100,A=new Float32Array([0,0]);let m=null,c=null,p=null;function I(){if(!c){c=new Float32Array(d);const n=1/(d-1);let t=n;for(let e=1;e{if(!this._autoUpdate)return;let a=!1;if(0{this._button&&(this._engine.state==="running"?this._hide():this._show())},this._engine=t;const i=e||E.LastCreatedEngine?.getInputElement()?.parentElement||document.body,s=(i?.offsetTop||0)+20;this._style=document.createElement("style"),this._style.appendChild(document.createTextNode(`.babylonUnmute{position:absolute;top:${s}px;margin-left:20px;height:40px;width:60px;background-color:rgba(51,51,51,0.7);background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2239%22%20height%3D%2232%22%20viewBox%3D%220%200%2039%2032%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M9.625%2018.938l-0.031%200.016h-4.953q-0.016%200-0.031-0.016v-12.453q0-0.016%200.031-0.016h4.953q0.031%200%200.031%200.016v12.453zM12.125%207.688l8.719-8.703v27.453l-8.719-8.719-0.016-0.047v-9.938zM23.359%207.875l1.406-1.406%204.219%204.203%204.203-4.203%201.422%201.406-4.219%204.219%204.219%204.203-1.484%201.359-4.141-4.156-4.219%204.219-1.406-1.422%204.219-4.203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E");background-size:80%;background-repeat:no-repeat;background-position:center;background-position-y:4px;border:none;outline:none;transition:transform 0.125s ease-out;cursor:pointer;z-index:9999;}.babylonUnmute:hover{transform:scale(1.05)}`)),document.head.appendChild(this._style),this._button=document.createElement("button"),this._button.className="babylonUnmute",this._button.id="babylonUnmuteButton",this._button.addEventListener("click",()=>{this._engine.unlockAsync()}),i.appendChild(this._button),this._engine.stateChangedObservable.add(this._onStateChanged)}dispose(){this._button?.remove(),this._button=null,this._style?.remove(),this._style=null,this._engine.stateChangedObservable.removeCallback(this._onStateChanged)}get enabled(){return this._enabled}set enabled(t){this._enabled=t,t?this._engine.state!=="running"&&this._show():this._hide()}_show(){!this._button||!this._enabled||(this._button.style.display="block")}_hide(){this._button&&(this._button.style.display="none")}}const H={aac:"audio/aac",ac3:"audio/ac3",flac:"audio/flac",m4a:"audio/mp4",mp3:'audio/mpeg; codecs="mp3"',mp4:"audio/mp4",ogg:'audio/ogg; codecs="vorbis"',wav:"audio/wav",webm:'audio/webm; codecs="vorbis"'};class q extends k{constructor(t={}){super(t),this._audioContextStarted=!1,this._destinationNode=null,this._invalidFormats=new Set,this._isUpdating=!1,this._listener=null,this._listenerAutoUpdate=!0,this._listenerMinUpdateTime=0,this._pauseCalled=!1,this._resumeOnInteraction=!0,this._resumeOnPause=!0,this._resumeOnPauseRetryInterval=1e3,this._resumeOnPauseTimerId=null,this._resumePromise=null,this._silentHtmlAudio=null,this._unmuteUI=null,this._updateObservable=null,this._validFormats=new Set,this._volume=1,this._isUsingOfflineAudioContext=!1,this.isReadyPromise=new Promise(e=>{this._resolveIsReadyPromise=e}),this.stateChangedObservable=new h,this.userGestureObservable=new h,this._initAudioContextAsync=async()=>{this._audioContext.addEventListener("statechange",this._onAudioContextStateChange),this._mainOut=new Y(this),this._mainOut.volume=this._volume,await this.createMainBusAsync("default")},this._onAudioContextStateChange=()=>{this.state==="running"&&(clearInterval(this._resumeOnPauseTimerId),this._audioContextStarted=!0,this._resumePromise=null),(this.state==="suspended"||this.state==="interrupted")&&this._audioContextStarted&&this._resumeOnPause&&!this._pauseCalled&&(clearInterval(this._resumeOnPauseTimerId),this._resumeOnPauseTimerId=setInterval(()=>{this.resumeAsync()},this._resumeOnPauseRetryInterval)),this.stateChangedObservable.notifyObservers(this.state)},this._onUserGestureAsync=async()=>{if(this._resumeOnInteraction&&await this._audioContext.resume(),!this._silentHtmlAudio){this._silentHtmlAudio=document.createElement("audio");const e=this._silentHtmlAudio;e.controls=!1,e.preload="auto",e.loop=!0,e.src="data:audio/wav;base64,UklGRjAAAABXQVZFZm10IBAAAAABAAEAgLsAAAB3AQACABAAZGF0YQwAAAAAAAEA/v8CAP//AQA=",e.play()}this.userGestureObservable.notifyObservers()},this._startUpdating=()=>{if(!this._isUpdating)if(this._isUpdating=!0,this.state==="running")this._update();else{const e=()=>{this.state==="running"&&(this._update(),this.stateChangedObservable.removeCallback(e))};this.stateChangedObservable.add(e)}},this._update=()=>{this._updateObservable?.hasObservers()?(this._updateObservable.notifyObservers(),requestAnimationFrame(this._update)):this._isUpdating=!1},typeof t.listenerAutoUpdate=="boolean"&&(this._listenerAutoUpdate=t.listenerAutoUpdate),typeof t.listenerMinUpdateTime=="number"&&(this._listenerMinUpdateTime=t.listenerMinUpdateTime),this._volume=t.volume??1,t.audioContext?(this._isUsingOfflineAudioContext=t.audioContext instanceof OfflineAudioContext,this._audioContext=t.audioContext):this._audioContext=new AudioContext,t.disableDefaultUI||(this._unmuteUI=new z(this,t.defaultUIParentElement))}async _initAsync(t){this._resumeOnInteraction=typeof t.resumeOnInteraction=="boolean"?t.resumeOnInteraction:!0,this._resumeOnPause=typeof t.resumeOnPause=="boolean"?t.resumeOnPause:!0,this._resumeOnPauseRetryInterval=t.resumeOnPauseRetryInterval??1e3,document.addEventListener("click",this._onUserGestureAsync),await this._initAudioContextAsync(),W(t)&&(this._listener=x(this,this._listenerAutoUpdate,this._listenerMinUpdateTime),this._listener.setOptions(t)),this._resolveIsReadyPromise()}get currentTime(){return this._audioContext.currentTime??0}get _inNode(){return this._audioContext.destination}get mainOut(){return this._mainOut}get listener(){return this._listener??(this._listener=x(this,this._listenerAutoUpdate,this._listenerMinUpdateTime))}get state(){return this._isUsingOfflineAudioContext?"running":this._audioContext.state}get volume(){return this._volume}set volume(t){this._volume!==t&&(this._volume=t,this._mainOut&&(this._mainOut.volume=t))}get _audioDestination(){return this._destinationNode?this._destinationNode:this._destinationNode=this._audioContext.destination}set _audioDestination(t){this._destinationNode=t}get _unmuteUIEnabled(){return this._unmuteUI?this._unmuteUI.enabled:!1}set _unmuteUIEnabled(t){this._unmuteUI&&(this._unmuteUI.enabled=t)}async createBusAsync(t,e={}){const i=await l(()=>import("./webAudioBus-Dmzu4Bvq.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url),s=new i._WebAudioBus(t,this,e);return await s._initAsync(e),s}async createMainBusAsync(t,e={}){const i=await l(()=>import("./webAudioMainBus-COw9bIbJ.js"),__vite__mapDeps([7,1,2,3,4,5]),import.meta.url),s=new i._WebAudioMainBus(t,this);return await s._initAsync(e),s}async createMicrophoneSoundSourceAsync(t,e){let i;try{i=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(s){throw new Error("Unable to access microphone: "+s)}return await this.createSoundSourceAsync(t,new MediaStreamAudioSourceNode(this._audioContext,{mediaStream:i}),{outBusAutoDefault:!1,...e})}async createSoundAsync(t,e,i={}){const s=await l(()=>import("./webAudioStaticSound-C9f3HBnG.js"),__vite__mapDeps([8,9,3,4,5,10,2,6]),import.meta.url),a=new s._WebAudioStaticSound(t,this,i);return await a._initAsync(e,i),a}async createSoundBufferAsync(t,e={}){const i=await l(()=>import("./webAudioStaticSound-C9f3HBnG.js"),__vite__mapDeps([8,9,3,4,5,10,2,6]),import.meta.url),s=new i._WebAudioStaticSoundBuffer(this);return await s._initAsync(t,e),s}async createSoundSourceAsync(t,e,i={}){const s=await l(()=>import("./webAudioSoundSource-CHASmwKl.js"),__vite__mapDeps([11,10,2,3,4,5,6]),import.meta.url),a=new s._WebAudioSoundSource(t,e,this,i);return await a._initAsync(i),a}async createStreamingSoundAsync(t,e,i={}){const s=await l(()=>import("./webAudioStreamingSound-orB8PSId.js"),__vite__mapDeps([12,3,4,5,9,10,2,6]),import.meta.url),a=new s._WebAudioStreamingSound(t,this,i);return await a._initAsync(e,i),a}dispose(){super.dispose(),this._listener?.dispose(),this._listener=null,this._audioContext.state!=="closed"&&!this._isUsingOfflineAudioContext&&this._audioContext.close(),document.removeEventListener("click",this._onUserGestureAsync),this._audioContext.removeEventListener("statechange",this._onAudioContextStateChange),this._silentHtmlAudio?.remove(),this._updateObservable?.clear(),this._updateObservable=null,this._unmuteUI?.dispose(),this._unmuteUI=null,this.stateChangedObservable.clear()}flagInvalidFormat(t){this._invalidFormats.add(t)}isFormatValid(t){if(this._validFormats.has(t))return!0;if(this._invalidFormats.has(t))return!1;const e=H[t];return e===void 0?!1:new Audio().canPlayType(e)===""?(this._invalidFormats.add(t),!1):(this._validFormats.add(t),!0)}async pauseAsync(){await this._audioContext.suspend(),this._pauseCalled=!0}resumeAsync(){return this._pauseCalled=!1,this._resumePromise?this._resumePromise:(this._resumePromise=this._audioContext.resume(),this.stateChangedObservable.notifyObservers(this.state),this._resumePromise)}setVolume(t,e=null){if(this._mainOut)this._mainOut.setVolume(t,e);else throw new Error("Main output not initialized yet.")}_addMainBus(t){super._addMainBus(t)}_removeMainBus(t){super._removeMainBus(t)}_addNode(t){super._addNode(t)}_removeNode(t){super._removeNode(t)}_addSound(t){super._addSound(t)}_removeSound(t){super._removeSound(t)}_addUpdateObserver(t){this._updateObservable||(this._updateObservable=new h),this._updateObservable.add(t),this._startUpdating()}_removeUpdateObserver(t){this._updateObservable&&this._updateObservable.removeCallback(t)}}P.AudioEngineFactory=(n,t,e)=>new $(n,t,e);class ${get masterGain(){return this._masterGain}set masterGain(t){this._masterGain=this._v2.mainOut._inNode=t}get useCustomUnlockedButton(){return this._useCustomUnlockedButton}set useCustomUnlockedButton(t){this._useCustomUnlockedButton=t,this._v2._unmuteUIEnabled=!t}get audioContext(){return this._v2.state==="running"&&this._triggerRunningStateAsync(),this._v2._audioContext}constructor(t=null,e=null,i=null){this._tryToRun=!1,this._useCustomUnlockedButton=!1,this.canUseWebAudio=!0,this.WarnedWebAudioUnsupported=!1,this.isMP3supported=!1,this.isOGGsupported=!1,this.unlocked=!1,this.onAudioUnlockedObservable=new h,this.onAudioLockedObservable=new h;const s=new q({audioContext:e||void 0,defaultUIParentElement:t?.parentElement?t.parentElement:void 0});s._unmuteUIEnabled=!1,this._masterGain=new GainNode(s._audioContext),s._audioDestination=i,s.stateChangedObservable.add(a=>{a==="running"?(this.unlocked=!0,this.onAudioUnlockedObservable.notifyObservers(this)):(this.unlocked=!1,this.onAudioLockedObservable.notifyObservers(this))}),s._initAsync({resumeOnInteraction:!1}).then(()=>{const a=s.defaultMainBus._outNode;a&&(a.disconnect(s.mainOut._inNode),a.connect(this._masterGain)),s.mainOut._inNode=this._masterGain,s.stateChangedObservable.notifyObservers(s.state)}),this.isMP3supported=s.isFormatValid("mp3"),this.isOGGsupported=s.isFormatValid("ogg"),this._v2=s}lock(){this._v2._audioContext.suspend(),this._useCustomUnlockedButton||(this._v2._unmuteUIEnabled=!0)}unlock(){if(this._v2._audioContext?.state==="running"){this.unlocked||(this.unlocked=!0,this.onAudioUnlockedObservable.notifyObservers(this));return}this._triggerRunningStateAsync()}_resumeAudioContextOnStateChange(){this._v2._audioContext?.addEventListener("statechange",()=>{this.unlocked&&this._v2._audioContext?.state!=="running"&&this._resumeAudioContextAsync()},{once:!0,passive:!0,signal:AbortSignal.timeout(3e3)})}_resumeAudioContextAsync(){return this._v2._isUsingOfflineAudioContext?Promise.resolve():(this._v2._audioContext.state==="suspended"&&!this._useCustomUnlockedButton&&(this._v2._unmuteUIEnabled=!0),this._v2._audioContext.resume())}dispose(){this._v2.dispose(),this.onAudioUnlockedObservable.clear(),this.onAudioLockedObservable.clear()}getGlobalVolume(){return this.masterGain.gain.value}setGlobalVolume(t){this.masterGain.gain.value=t}connectToAnalyser(t){this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas(),this._connectedAnalyser=t,this.masterGain.disconnect(),this._connectedAnalyser.connectAudioNodes(this.masterGain,this._v2._audioContext.destination)}async _triggerRunningStateAsync(){if(this._tryToRun){this._v2._audioContext.resume();return}this._tryToRun=!0,await this._resumeAudioContextAsync(),this._tryToRun=!1,this.unlocked=!0,this.onAudioUnlockedObservable.notifyObservers(this)}}export{T as A,et as _,tt as a,u as b,C as c,V as d,K as e}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/auto-render-NRfUkSas.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/auto-render-NRfUkSas.js new file mode 100644 index 0000000000000000000000000000000000000000..4804f6d2e9d0049d540002dc9965e23d5137489f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/auto-render-NRfUkSas.js @@ -0,0 +1 @@ +import g from"./katex-XbL3y5x-.js";var c=function(t,a,e){for(var r=e,n=0,l=t.length;ro(f.left)).join("|")+")");e=t.search(n),e!==-1;){e>0&&(r.push({type:"text",data:t.slice(0,e)}),t=t.slice(e));var l=a.findIndex(f=>t.startsWith(f.left));if(e=c(a[l].right,t,a[l].left.length),e===-1)break;var d=t.slice(0,e+a[l].right.length),i=p.test(d)?d:t.slice(a[l].left.length,e);r.push({type:"math",data:i,rawData:d,display:a[l].display}),t=t.slice(e+a[l].right.length)}return t!==""&&r.push({type:"text",data:t}),r},y=function(t,a){var e=m(t,a.delimiters);if(e.length===1&&e[0].type==="text")return null;for(var r=document.createDocumentFragment(),n=0;nh.indexOf(" "+u+" ")===-1);v&&s(r,a)})()}},E=function(t,a){if(!t)throw new Error("No element provided to render");var e={};for(var r in a)a.hasOwnProperty(r)&&(e[r]=a[r]);e.delimiters=e.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],e.ignoredTags=e.ignoredTags||["script","noscript","style","textarea","pre","code","option"],e.ignoredClasses=e.ignoredClasses||[],e.errorCallback=e.errorCallback||console.error,e.macros=e.macros||{},T(t,e)};export{E as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/background.fragment-DVcvlYwn.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/background.fragment-DVcvlYwn.js new file mode 100644 index 0000000000000000000000000000000000000000..20114f1fce90a3d0dcc8b2f7a014882a6a0bf125 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/background.fragment-DVcvlYwn.js @@ -0,0 +1,204 @@ +import{S as e}from"./index-CDrXokXW.js";import"./backgroundUboDeclaration-hBNOFfW-.js";import"./helperFunctions-CZpZ-EbL.js";import"./shadowsFragmentFunctions-CTsFFgyf.js";import"./imageProcessingFunctions-BbtoaTge.js";import"./lightsFragmentFunctions-DcPOaMby.js";import"./logDepthDeclaration-DkdfQs4e.js";import"./clipPlaneFragment-C7XUrTAZ.js";import"./fogFragment-DmA8Y7To.js";import"./lightFragment-DhtXFpEE.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-BH1tZjjY.js";const o="intersectionFunctions",i=`fn diskIntersectWithBackFaceCulling(ro: vec3f,rd: vec3f,c: vec3f,r: f32)->f32 {var d: f32=rd.y;if(d>0.0) { return 1e6; } +var o: vec3f=ro-c;var t: f32=-o.y/d;var q: vec3f=o+rd*t;return select(1e6,t,(dot(q,q)vec2f {var oc: vec3f=ro-ce;var b: f32=dot(oc,rd);var c: f32=dot(oc,oc)-ra*ra;var h: f32=b*b-c;if(h<0.0) { return vec2f(-1.,-1.); } +h=sqrt(h);return vec2f(-b+h,-b-h);} +fn sphereIntersectFromOrigin(ro: vec3f,rd: vec3f,ra: f32)->vec2f {var b: f32=dot(ro,rd);var c: f32=dot(ro,ro)-ra*ra;var h: f32=b*b-c;if(h<0.0) { return vec2f(-1.,-1.); } +h=sqrt(h);return vec2f(-b+h,-b-h);}`;e.IncludesShadersStoreWGSL[o]||(e.IncludesShadersStoreWGSL[o]=i);const r="backgroundPixelShader",f=`#include +#include +varying vPositionW: vec3f; +#ifdef MAINUV1 +varying vMainUV1: vec2f; +#endif +#ifdef MAINUV2 +varying vMainUV2: vec2f; +#endif +#ifdef NORMAL +varying vNormalW: vec3f; +#endif +#ifdef DIFFUSE +#if DIFFUSEDIRECTUV==1 +#define vDiffuseUV vMainUV1 +#elif DIFFUSEDIRECTUV==2 +#define vDiffuseUV vMainUV2 +#else +varying vDiffuseUV: vec2f; +#endif +var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d; +#endif +#ifdef REFLECTION +#ifdef REFLECTIONMAP_3D +var reflectionSamplerSampler: sampler;var reflectionSampler: texture_cube; +#ifdef TEXTURELODSUPPORT +#else +var reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_cube;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_cube; +#endif +#else +var reflectionSamplerSampler: sampler;var reflectionSampler: texture_2d; +#ifdef TEXTURELODSUPPORT +#else +var reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_2d;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_2d; +#endif +#endif +#ifdef REFLECTIONMAP_SKYBOX +varying vPositionUVW: vec3f; +#else +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vDirectionW: vec3f; +#endif +#endif +#include +#endif +#ifndef FROMLINEARSPACE +#define FROMLINEARSPACE; +#endif +#ifndef SHADOWONLY +#define SHADOWONLY; +#endif +#include +#include[0..maxSimultaneousLights] +#include +#include +#include +#include +#include +#include +#ifdef REFLECTIONFRESNEL +#define FRESNEL_MAXIMUM_ON_ROUGH 0.25 +fn fresnelSchlickEnvironmentGGX(VdotN: f32,reflectance0: vec3f,reflectance90: vec3f,smoothness: f32)->vec3f +{var weight: f32=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));} +#endif +#ifdef PROJECTED_GROUND +#include +fn project(viewDirectionW: vec3f,eyePosition: vec3f)->vec3f {var radius: f32=uniforms.projectedGroundInfos.x;var height: f32=uniforms.projectedGroundInfos.y;var camDir: vec3f=-viewDirectionW;var skySphereDistance: f32=sphereIntersectFromOrigin(eyePosition,camDir,radius).x;var skySpherePositionW: vec3f=eyePosition+camDir*skySphereDistance;var p: vec3f=normalize(skySpherePositionW);var upEyePosition=vec3f(eyePosition.x,eyePosition.y-height,eyePosition.z);var sIntersection: f32=sphereIntersectFromOrigin(upEyePosition,p,radius).x;var h: vec3f= vec3f(0.0,-height,0.0);var dIntersection: f32=diskIntersectWithBackFaceCulling(upEyePosition,p,h,radius);p=(upEyePosition+min(sIntersection,dIntersection)*p);return p;} +#endif +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs { +#define CUSTOM_FRAGMENT_MAIN_BEGIN +#include +var viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-input.vPositionW); +#ifdef NORMAL +var normalW: vec3f=normalize(fragmentInputs.vNormalW); +#else +var normalW: vec3f= vec3f(0.0,1.0,0.0); +#endif +var shadow: f32=1.;var globalShadow: f32=0.;var shadowLightCount: f32=0.;var aggShadow: f32=0.;var numLights: f32=0.; +#include[0..maxSimultaneousLights] +#ifdef SHADOWINUSE +globalShadow/=shadowLightCount; +#else +globalShadow=1.0; +#endif +#ifndef BACKMAT_SHADOWONLY +var reflectionColor: vec4f= vec4f(1.,1.,1.,1.); +#ifdef REFLECTION +#ifdef PROJECTED_GROUND +var reflectionVector: vec3f=project(viewDirectionW,scene.vEyePosition.xyz);reflectionVector= (uniforms.reflectionMatrix*vec4f(reflectionVector,1.)).xyz; +#else +var reflectionVector: vec3f=computeReflectionCoords( vec4f(fragmentInputs.vPositionW,1.0),normalW); +#endif +#ifdef REFLECTIONMAP_OPPOSITEZ +reflectionVector.z*=-1.0; +#endif +#ifdef REFLECTIONMAP_3D +var reflectionCoords: vec3f=reflectionVector; +#else +var reflectionCoords: vec2f=reflectionVector.xy; +#ifdef REFLECTIONMAP_PROJECTION +reflectionCoords/=reflectionVector.z; +#endif +reflectionCoords.y=1.0-reflectionCoords.y; +#endif +#ifdef REFLECTIONBLUR +var reflectionLOD: f32=uniforms.vReflectionInfos.y; +#ifdef TEXTURELODSUPPORT +reflectionLOD=reflectionLOD*log2(uniforms.vReflectionMicrosurfaceInfos.x)*uniforms.vReflectionMicrosurfaceInfos.y+uniforms.vReflectionMicrosurfaceInfos.z;reflectionColor=textureSampleLevel(reflectionSampler,reflectionSamplerSampler,reflectionCoords,reflectionLOD); +#else +var lodReflectionNormalized: f32=saturate(reflectionLOD);var lodReflectionNormalizedDoubled: f32=lodReflectionNormalized*2.0;var reflectionSpecularMid: vec4f=textureSample(reflectionSampler,reflectionSamplerSampler,reflectionCoords);if(lodReflectionNormalizedDoubled<1.0){reflectionColor=mix( +textureSample(reflectionrHighSampler,reflectionrHighSamplerSampler,reflectionCoords), +reflectionSpecularMid, +lodReflectionNormalizedDoubled +);} else {reflectionColor=mix( +reflectionSpecularMid, +textureSample(reflectionLowSampler,reflectionLowSamplerSampler,reflectionCoords), +lodReflectionNormalizedDoubled-1.0 +);} +#endif +#else +var reflectionSample: vec4f=textureSample(reflectionSampler,reflectionSamplerSampler,reflectionCoords);reflectionColor=reflectionSample; +#endif +#ifdef RGBDREFLECTION +reflectionColor=vec4f(fromRGBD(reflectionColor).rgb,reflectionColor.a); +#endif +#ifdef GAMMAREFLECTION +reflectionColor=vec4f(toLinearSpaceVec3(reflectionColor.rgb),reflectionColor.a); +#endif +#ifdef REFLECTIONBGR +reflectionColor=vec4f(reflectionColor.bgr,reflectionColor.a); +#endif +reflectionColor=vec4f(reflectionColor.rgb*uniforms.vReflectionInfos.x,reflectionColor.a); +#endif +var diffuseColor: vec3f= vec3f(1.,1.,1.);var finalAlpha: f32=uniforms.alpha; +#ifdef DIFFUSE +var diffuseMap: vec4f=textureSample(diffuseSampler,diffuseSamplerSampler,input.vDiffuseUV); +#ifdef GAMMADIFFUSE +diffuseMap=vec4f(toLinearSpaceVec3(diffuseMap.rgb),diffuseMap.a); +#endif +diffuseMap=vec4f(diffuseMap.rgb *uniforms.vDiffuseInfos.y,diffuseMap.a); +#ifdef DIFFUSEHASALPHA +finalAlpha*=diffuseMap.a; +#endif +diffuseColor=diffuseMap.rgb; +#endif +#ifdef REFLECTIONFRESNEL +var colorBase: vec3f=diffuseColor; +#else +var colorBase: vec3f=reflectionColor.rgb*diffuseColor; +#endif +colorBase=max(colorBase,vec3f(0.0)); +#ifdef USERGBCOLOR +var finalColor: vec3f=colorBase; +#else +#ifdef USEHIGHLIGHTANDSHADOWCOLORS +var mainColor: vec3f=mix(uniforms.vPrimaryColorShadow.rgb,uniforms.vPrimaryColor.rgb,colorBase); +#else +var mainColor: vec3f=uniforms.vPrimaryColor.rgb; +#endif +var finalColor: vec3f=colorBase*mainColor; +#endif +#ifdef REFLECTIONFRESNEL +var reflectionAmount: vec3f=uniforms.vReflectionControl.xxx;var reflectionReflectance0: vec3f=uniforms.vReflectionControl.yyy;var reflectionReflectance90: vec3f=uniforms.vReflectionControl.zzz;var VdotN: f32=dot(normalize(scene.vEyePosition.xyz),normalW);var planarReflectionFresnel: vec3f=fresnelSchlickEnvironmentGGX(saturate(VdotN),reflectionReflectance0,reflectionReflectance90,1.0);reflectionAmount*=planarReflectionFresnel; +#ifdef REFLECTIONFALLOFF +var reflectionDistanceFalloff: f32=1.0-saturate(length(vPositionW.xyz-uniforms.vBackgroundCenter)*uniforms.vReflectionControl.w);reflectionDistanceFalloff*=reflectionDistanceFalloff;reflectionAmount*=reflectionDistanceFalloff; +#endif +finalColor=mix(finalColor,reflectionColor.rgb,saturateVec3(reflectionAmount)); +#endif +#ifdef OPACITYFRESNEL +var viewAngleToFloor: f32=dot(normalW,normalize(scene.vEyePosition.xyz-uniforms.vBackgroundCenter));const startAngle: f32=0.1;var fadeFactor: f32=saturate(viewAngleToFloor/startAngle);finalAlpha*=fadeFactor*fadeFactor; +#endif +#ifdef SHADOWINUSE +finalColor=mix(finalColor*uniforms.shadowLevel,finalColor,globalShadow); +#endif +var color: vec4f= vec4f(finalColor,finalAlpha); +#else +var color: vec4f= vec4f(uniforms.vPrimaryColor.rgb,(1.0-clamp(globalShadow,0.,1.))*uniforms.alpha); +#endif +#include +#include +#ifdef IMAGEPROCESSINGPOSTPROCESS +#if !defined(SKIPFINALCOLORCLAMP) +color=vec4f(clamp(color.rgb,vec3f(0.),vec3f(30.0)),color.a); +#endif +#else +color=applyImageProcessing(color); +#endif +#ifdef PREMULTIPLYALPHA +color=vec4f(color.rgb *color.a,color.a); +#endif +#ifdef NOISE +color=vec4f(color.rgb+dither(fragmentInputs.vPositionW.xy,0.5),color.a);color=max(color,vec4f(0.0)); +#endif +fragmentOutputs.color=color; +#define CUSTOM_FRAGMENT_MAIN_END +} +`;e.ShadersStoreWGSL[r]||(e.ShadersStoreWGSL[r]=f);const E={name:r,shader:f};export{E as backgroundPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/background.fragment-a1OuescW.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/background.fragment-a1OuescW.js new file mode 100644 index 0000000000000000000000000000000000000000..532083ac774114c8d49301ffeb53e4e11c8d502d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/background.fragment-a1OuescW.js @@ -0,0 +1,237 @@ +import{S as e}from"./index-CDrXokXW.js";import"./backgroundUboDeclaration-CKc0A7bZ.js";import"./helperFunctions-BkWNqKeI.js";import"./shadowsFragmentFunctions-QR4_Qrt1.js";import"./imageProcessingFunctions-dvOnE6xp.js";import"./lightsFragmentFunctions-nqjCe5ZE.js";import"./logDepthDeclaration-DbMKMukk.js";import"./clipPlaneFragment-T8W7CIC5.js";import"./fogFragment-R9KOnWn-.js";import"./lightFragment-BRK1HqYL.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-C4vXUqkq.js";const i="backgroundFragmentDeclaration",f=`uniform vec4 vEyePosition;uniform vec4 vPrimaryColor; +#ifdef USEHIGHLIGHTANDSHADOWCOLORS +uniform vec4 vPrimaryColorShadow; +#endif +uniform float shadowLevel;uniform float alpha; +#ifdef DIFFUSE +uniform vec2 vDiffuseInfos; +#endif +#ifdef REFLECTION +uniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos; +#endif +#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL) +uniform vec3 vBackgroundCenter; +#endif +#ifdef REFLECTIONFRESNEL +uniform vec4 vReflectionControl; +#endif +#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION) +uniform mat4 view; +#endif +#ifdef PROJECTED_GROUND +uniform vec2 projectedGroundInfos; +#endif +`;e.IncludesShadersStore[i]||(e.IncludesShadersStore[i]=f);const r="intersectionFunctions",l=`float diskIntersectWithBackFaceCulling(vec3 ro,vec3 rd,vec3 c,float r) {float d=rd.y;if(d>0.0) { return 1e6; } +vec3 o=ro-c;float t=-o.y/d;vec3 q=o+rd*t;return (dot(q,q) +#include +varying vec3 vPositionW; +#ifdef MAINUV1 +varying vec2 vMainUV1; +#endif +#ifdef MAINUV2 +varying vec2 vMainUV2; +#endif +#ifdef NORMAL +varying vec3 vNormalW; +#endif +#ifdef DIFFUSE +#if DIFFUSEDIRECTUV==1 +#define vDiffuseUV vMainUV1 +#elif DIFFUSEDIRECTUV==2 +#define vDiffuseUV vMainUV2 +#else +varying vec2 vDiffuseUV; +#endif +uniform sampler2D diffuseSampler; +#endif +#ifdef REFLECTION +#ifdef REFLECTIONMAP_3D +#define sampleReflection(s,c) textureCube(s,c) +uniform samplerCube reflectionSampler; +#ifdef TEXTURELODSUPPORT +#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l) +#else +uniform samplerCube reflectionSamplerLow;uniform samplerCube reflectionSamplerHigh; +#endif +#else +#define sampleReflection(s,c) texture2D(s,c) +uniform sampler2D reflectionSampler; +#ifdef TEXTURELODSUPPORT +#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l) +#else +uniform samplerCube reflectionSamplerLow;uniform samplerCube reflectionSamplerHigh; +#endif +#endif +#ifdef REFLECTIONMAP_SKYBOX +varying vec3 vPositionUVW; +#else +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vec3 vDirectionW; +#endif +#endif +#include +#endif +#ifndef FROMLINEARSPACE +#define FROMLINEARSPACE; +#endif +#ifndef SHADOWONLY +#define SHADOWONLY; +#endif +#include +#include<__decl__lightFragment>[0..maxSimultaneousLights] +#include +#include +#include +#ifdef LOGARITHMICDEPTH +#extension GL_EXT_frag_depth : enable +#endif +#include +#include +#include +#ifdef REFLECTIONFRESNEL +#define FRESNEL_MAXIMUM_ON_ROUGH 0.25 +vec3 fresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness) +{float weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));} +#endif +#ifdef PROJECTED_GROUND +#include +vec3 project(vec3 viewDirectionW,vec3 eyePosition) {float radius=projectedGroundInfos.x;float height=projectedGroundInfos.y;vec3 camDir=-viewDirectionW;float skySphereDistance=sphereIntersectFromOrigin(eyePosition,camDir,radius).x;vec3 skySpherePositionW=eyePosition+camDir*skySphereDistance;vec3 p=normalize(skySpherePositionW);eyePosition.y-=height;float sIntersection=sphereIntersectFromOrigin(eyePosition,p,radius).x;vec3 h=vec3(0.0,-height,0.0);float dIntersection=diskIntersectWithBackFaceCulling(eyePosition,p,h,radius);p=(eyePosition+min(sIntersection,dIntersection)*p);return p;} +#endif +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) { +#define CUSTOM_FRAGMENT_MAIN_BEGIN +#include +vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW); +#ifdef NORMAL +vec3 normalW=normalize(vNormalW); +#else +vec3 normalW=vec3(0.0,1.0,0.0); +#endif +float shadow=1.;float globalShadow=0.;float shadowLightCount=0.;float aggShadow=0.;float numLights=0.; +#include[0..maxSimultaneousLights] +#ifdef SHADOWINUSE +globalShadow/=shadowLightCount; +#else +globalShadow=1.0; +#endif +#ifndef BACKMAT_SHADOWONLY +vec4 reflectionColor=vec4(1.,1.,1.,1.); +#ifdef REFLECTION +#ifdef PROJECTED_GROUND +vec3 reflectionVector=project(viewDirectionW,vEyePosition.xyz);reflectionVector=vec3(reflectionMatrix*vec4(reflectionVector,1.)); +#else +vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW); +#endif +#ifdef REFLECTIONMAP_OPPOSITEZ +reflectionVector.z*=-1.0; +#endif +#ifdef REFLECTIONMAP_3D +vec3 reflectionCoords=reflectionVector; +#else +vec2 reflectionCoords=reflectionVector.xy; +#ifdef REFLECTIONMAP_PROJECTION +reflectionCoords/=reflectionVector.z; +#endif +reflectionCoords.y=1.0-reflectionCoords.y; +#endif +#ifdef REFLECTIONBLUR +float reflectionLOD=vReflectionInfos.y; +#ifdef TEXTURELODSUPPORT +reflectionLOD=reflectionLOD*log2(vReflectionMicrosurfaceInfos.x)*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;reflectionColor=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD); +#else +float lodReflectionNormalized=saturate(reflectionLOD);float lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;vec4 reflectionSpecularMid=sampleReflection(reflectionSampler,reflectionCoords);if(lodReflectionNormalizedDoubled<1.0){reflectionColor=mix( +sampleReflection(reflectionSamplerHigh,reflectionCoords), +reflectionSpecularMid, +lodReflectionNormalizedDoubled +);} else {reflectionColor=mix( +reflectionSpecularMid, +sampleReflection(reflectionSamplerLow,reflectionCoords), +lodReflectionNormalizedDoubled-1.0 +);} +#endif +#else +vec4 reflectionSample=sampleReflection(reflectionSampler,reflectionCoords);reflectionColor=reflectionSample; +#endif +#ifdef RGBDREFLECTION +reflectionColor.rgb=fromRGBD(reflectionColor); +#endif +#ifdef GAMMAREFLECTION +reflectionColor.rgb=toLinearSpace(reflectionColor.rgb); +#endif +#ifdef REFLECTIONBGR +reflectionColor.rgb=reflectionColor.bgr; +#endif +reflectionColor.rgb*=vReflectionInfos.x; +#endif +vec3 diffuseColor=vec3(1.,1.,1.);float finalAlpha=alpha; +#ifdef DIFFUSE +vec4 diffuseMap=texture2D(diffuseSampler,vDiffuseUV); +#ifdef GAMMADIFFUSE +diffuseMap.rgb=toLinearSpace(diffuseMap.rgb); +#endif +diffuseMap.rgb*=vDiffuseInfos.y; +#ifdef DIFFUSEHASALPHA +finalAlpha*=diffuseMap.a; +#endif +diffuseColor=diffuseMap.rgb; +#endif +#ifdef REFLECTIONFRESNEL +vec3 colorBase=diffuseColor; +#else +vec3 colorBase=reflectionColor.rgb*diffuseColor; +#endif +colorBase=max(colorBase,0.0); +#ifdef USERGBCOLOR +vec3 finalColor=colorBase; +#else +#ifdef USEHIGHLIGHTANDSHADOWCOLORS +vec3 mainColor=mix(vPrimaryColorShadow.rgb,vPrimaryColor.rgb,colorBase); +#else +vec3 mainColor=vPrimaryColor.rgb; +#endif +vec3 finalColor=colorBase*mainColor; +#endif +#ifdef REFLECTIONFRESNEL +vec3 reflectionAmount=vReflectionControl.xxx;vec3 reflectionReflectance0=vReflectionControl.yyy;vec3 reflectionReflectance90=vReflectionControl.zzz;float VdotN=dot(normalize(vEyePosition.xyz),normalW);vec3 planarReflectionFresnel=fresnelSchlickEnvironmentGGX(saturate(VdotN),reflectionReflectance0,reflectionReflectance90,1.0);reflectionAmount*=planarReflectionFresnel; +#ifdef REFLECTIONFALLOFF +float reflectionDistanceFalloff=1.0-saturate(length(vPositionW.xyz-vBackgroundCenter)*vReflectionControl.w);reflectionDistanceFalloff*=reflectionDistanceFalloff;reflectionAmount*=reflectionDistanceFalloff; +#endif +finalColor=mix(finalColor,reflectionColor.rgb,saturate(reflectionAmount)); +#endif +#ifdef OPACITYFRESNEL +float viewAngleToFloor=dot(normalW,normalize(vEyePosition.xyz-vBackgroundCenter));const float startAngle=0.1;float fadeFactor=saturate(viewAngleToFloor/startAngle);finalAlpha*=fadeFactor*fadeFactor; +#endif +#ifdef SHADOWINUSE +finalColor=mix(finalColor*shadowLevel,finalColor,globalShadow); +#endif +vec4 color=vec4(finalColor,finalAlpha); +#else +vec4 color=vec4(vPrimaryColor.rgb,(1.0-clamp(globalShadow,0.,1.))*alpha); +#endif +#include +#include +#ifdef IMAGEPROCESSINGPOSTPROCESS +#if !defined(SKIPFINALCOLORCLAMP) +color.rgb=clamp(color.rgb,0.,30.0); +#endif +#else +color=applyImageProcessing(color); +#endif +#ifdef PREMULTIPLYALPHA +color.rgb*=color.a; +#endif +#ifdef NOISE +color.rgb+=dither(vPositionW.xy,0.5);color=max(color,0.0); +#endif +gl_FragColor=color; +#define CUSTOM_FRAGMENT_MAIN_END +} +`;e.ShadersStore[o]||(e.ShadersStore[o]=n);const p={name:o,shader:n};export{p as backgroundPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/background.vertex-Ck4dF8t7.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/background.vertex-Ck4dF8t7.js new file mode 100644 index 0000000000000000000000000000000000000000..35dc5f32fab61d5826f175a2ddc746ae8deec90d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/background.vertex-Ck4dF8t7.js @@ -0,0 +1,99 @@ +import{S as i}from"./index-CDrXokXW.js";import"./backgroundUboDeclaration-hBNOFfW-.js";import"./helperFunctions-CZpZ-EbL.js";import"./bonesDeclaration-Bh_c0MF7.js";import"./instancesVertex-CO_CTxxp.js";import"./instancesDeclaration-DZdrWbmN.js";import"./clipPlaneVertex-J3Krgsee.js";import"./logDepthVertex-D_A6gsii.js";import"./shadowsVertex-CygJ_RUp.js";import"./logDepthDeclaration-DkdfQs4e.js";import"./bonesVertex-bl6LLSA1.js";import"./bakedVertexAnimation-DoavwM49.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-BH1tZjjY.js";const e="backgroundVertexShader",t=`#include +#include +attribute position: vec3f; +#ifdef NORMAL +attribute normal: vec3f; +#endif +#include +#include +#include +varying vPositionW: vec3f; +#ifdef NORMAL +varying vNormalW: vec3f; +#endif +#ifdef UV1 +attribute uv: vec2f; +#endif +#ifdef UV2 +attribute uv2: vec2f; +#endif +#ifdef MAINUV1 +varying vMainUV1: vec2f; +#endif +#ifdef MAINUV2 +varying vMainUV2: vec2f; +#endif +#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0 +varying vDiffuseUV: vec2f; +#endif +#include +#include +#include[0..maxSimultaneousLights] +#ifdef REFLECTIONMAP_SKYBOX +varying vPositionUVW: vec3f; +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vDirectionW: vec3f; +#endif +#include +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs { +#define CUSTOM_VERTEX_MAIN_BEGIN +#ifdef REFLECTIONMAP_SKYBOX +vertexOutputs.vPositionUVW=input.position; +#endif +#include +#include +#include +#ifdef MULTIVIEW +if (gl_ViewID_OVR==0u) {vertexOutputs.position=scene.viewProjection*finalWorld* vec4f(input.position,1.0);} else {vertexOutputs.position=scene.viewProjectionR*finalWorld* vec4f(input.position,1.0);} +#else +vertexOutputs.position=scene.viewProjection*finalWorld* vec4f(input.position,1.0); +#endif +var worldPos: vec4f=finalWorld* vec4f(input.position,1.0);vertexOutputs.vPositionW= worldPos.xyz; +#ifdef NORMAL +var normalWorld: mat3x3f=mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz); +#ifdef NONUNIFORMSCALING +normalWorld=transposeMat3(inverseMat3(normalWorld)); +#endif +vertexOutputs.vNormalW=normalize(normalWorld*input.normal); +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +vertexOutputs.vDirectionW=normalize((finalWorld*vec4f(input.position,0.0)).xyz); +#ifdef EQUIRECTANGULAR_RELFECTION_FOV +var screenToWorld: mat3x3f=inverseMat3( mat3x3f(finalWorld*scene.viewProjection));var segment: vec3f=mix(vertexOutputs.vDirectionW,screenToWorld* vec3f(0.0,0.0,1.0),abs(fFovMultiplier-1.0));if (fFovMultiplier<=1.0) {vertexOutputs.vDirectionW=normalize(segment);} else {vertexOutputs.vDirectionW=normalize(vertexOutputs.vDirectionW+(vertexOutputs.vDirectionW-segment));} +#endif +#endif +#ifndef UV1 +var uv: vec2f=vec2f(0.,0.); +#else +var uv=input.uv; +#endif +#ifndef UV2 +var uv2: vec2f=vec2f(0.,0.); +#else +var uv2=input.uv2; +#endif +#ifdef MAINUV1 +vertexOutputs.vMainUV1=uv; +#endif +#ifdef MAINUV2 +vertexOutputs.vMainUV2=uv2; +#endif +#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0 +if (uniforms.vDiffuseInfos.x==0.) +{vertexOutputs.vDiffuseUV= (uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;} +else +{vertexOutputs.vDiffuseUV= (uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;} +#endif +#include +#include +#include[0..maxSimultaneousLights] +#ifdef VERTEXCOLOR +vertexOutputs.vColor=vertexInputs.color; +#endif +#include +#define CUSTOM_VERTEX_MAIN_END +} +`;i.ShadersStoreWGSL[e]||(i.ShadersStoreWGSL[e]=t);const m={name:e,shader:t};export{m as backgroundVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/background.vertex-DsMHrPHo.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/background.vertex-DsMHrPHo.js new file mode 100644 index 0000000000000000000000000000000000000000..e42b6b3a56e333475a707390ee30bb4a7d461c47 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/background.vertex-DsMHrPHo.js @@ -0,0 +1,112 @@ +import{S as e}from"./index-CDrXokXW.js";import"./backgroundUboDeclaration-CKc0A7bZ.js";import"./helperFunctions-BkWNqKeI.js";import"./bakedVertexAnimation-BwUJBnNt.js";import"./instancesDeclaration-BAnfKLCo.js";import"./clipPlaneVertex-Bmw4TNCQ.js";import"./logDepthVertex-DDooPwab.js";import"./shadowsVertex-DbGd-etA.js";import"./logDepthDeclaration-DbMKMukk.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-C4vXUqkq.js";const n="backgroundVertexDeclaration",f=`uniform mat4 view;uniform mat4 viewProjection; +#ifdef MULTIVIEW +uniform mat4 viewProjectionR; +#endif +uniform float shadowLevel; +#ifdef DIFFUSE +uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos; +#endif +#ifdef REFLECTION +uniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos;uniform float fFovMultiplier; +#endif +#ifdef POINTSIZE +uniform float pointSize; +#endif +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=f);const i="backgroundVertexShader",o=`precision highp float; +#include<__decl__backgroundVertex> +#include +attribute vec3 position; +#ifdef NORMAL +attribute vec3 normal; +#endif +#include +#include +#include +varying vec3 vPositionW; +#ifdef NORMAL +varying vec3 vNormalW; +#endif +#ifdef UV1 +attribute vec2 uv; +#endif +#ifdef UV2 +attribute vec2 uv2; +#endif +#ifdef MAINUV1 +varying vec2 vMainUV1; +#endif +#ifdef MAINUV2 +varying vec2 vMainUV2; +#endif +#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0 +varying vec2 vDiffuseUV; +#endif +#include +#include +#include<__decl__lightVxFragment>[0..maxSimultaneousLights] +#ifdef REFLECTIONMAP_SKYBOX +varying vec3 vPositionUVW; +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vec3 vDirectionW; +#endif +#include +#define CUSTOM_VERTEX_DEFINITIONS +void main(void) { +#define CUSTOM_VERTEX_MAIN_BEGIN +#ifdef REFLECTIONMAP_SKYBOX +vPositionUVW=position; +#endif +#include +#include +#include +#ifdef MULTIVIEW +if (gl_ViewID_OVR==0u) {gl_Position=viewProjection*finalWorld*vec4(position,1.0);} else {gl_Position=viewProjectionR*finalWorld*vec4(position,1.0);} +#else +gl_Position=viewProjection*finalWorld*vec4(position,1.0); +#endif +vec4 worldPos=finalWorld*vec4(position,1.0);vPositionW=vec3(worldPos); +#ifdef NORMAL +mat3 normalWorld=mat3(finalWorld); +#ifdef NONUNIFORMSCALING +normalWorld=transposeMat3(inverseMat3(normalWorld)); +#endif +vNormalW=normalize(normalWorld*normal); +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +vDirectionW=normalize(vec3(finalWorld*vec4(position,0.0))); +#ifdef EQUIRECTANGULAR_RELFECTION_FOV +mat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));vec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));if (fFovMultiplier<=1.0) {vDirectionW=normalize(segment);} else {vDirectionW=normalize(vDirectionW+(vDirectionW-segment));} +#endif +#endif +#ifndef UV1 +vec2 uv=vec2(0.,0.); +#endif +#ifndef UV2 +vec2 uv2=vec2(0.,0.); +#endif +#ifdef MAINUV1 +vMainUV1=uv; +#endif +#ifdef MAINUV2 +vMainUV2=uv2; +#endif +#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0 +if (vDiffuseInfos.x==0.) +{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));} +else +{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));} +#endif +#include +#include +#include[0..maxSimultaneousLights] +#ifdef VERTEXCOLOR +vColor=colorUpdated; +#endif +#if defined(POINTSIZE) && !defined(WEBGPU) +gl_PointSize=pointSize; +#endif +#include +#define CUSTOM_VERTEX_MAIN_END +} +`;e.ShadersStore[i]||(e.ShadersStore[i]=o);const I={name:i,shader:o};export{I as backgroundVertexShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/backgroundUboDeclaration-CKc0A7bZ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/backgroundUboDeclaration-CKc0A7bZ.js new file mode 100644 index 0000000000000000000000000000000000000000..452af4176e6f9709d6417a507e96a3745b382f08 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/backgroundUboDeclaration-CKc0A7bZ.js @@ -0,0 +1,4 @@ +import{S as o}from"./index-CDrXokXW.js";import"./sceneUboDeclaration-C4vXUqkq.js";const r="backgroundUboDeclaration",e=`layout(std140,column_major) uniform;uniform Material +{uniform vec4 vPrimaryColor;uniform vec4 vPrimaryColorShadow;uniform vec2 vDiffuseInfos;uniform mat4 diffuseMatrix;uniform float fFovMultiplier;uniform float pointSize;uniform float shadowLevel;uniform float alpha;uniform vec3 vBackgroundCenter;uniform vec4 vReflectionControl;uniform vec2 projectedGroundInfos;uniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos;}; +#include +`;o.IncludesShadersStore[r]||(o.IncludesShadersStore[r]=e); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/backgroundUboDeclaration-hBNOFfW-.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/backgroundUboDeclaration-hBNOFfW-.js new file mode 100644 index 0000000000000000000000000000000000000000..864d2820e07ab59f506738f6c4079be78282d8a1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/backgroundUboDeclaration-hBNOFfW-.js @@ -0,0 +1,3 @@ +import{S as o}from"./index-CDrXokXW.js";import"./sceneUboDeclaration-BH1tZjjY.js";const f="backgroundUboDeclaration",r=`uniform vPrimaryColor: vec4f;uniform vPrimaryColorShadow: vec4f;uniform vDiffuseInfos : vec2f;uniform diffuseMatrix : mat4x4f;uniform fFovMultiplier: f32;uniform pointSize: f32;uniform shadowLevel: f32;uniform alpha: f32;uniform vBackgroundCenter: vec3f;uniform vReflectionControl: vec4f;uniform projectedGroundInfos: vec2f;uniform vReflectionInfos : vec2f;uniform reflectionMatrix : mat4x4f;uniform vReflectionMicrosurfaceInfos : vec3f; +#include +`;o.IncludesShadersStoreWGSL[f]||(o.IncludesShadersStoreWGSL[f]=r); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bakedVertexAnimation-BwUJBnNt.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bakedVertexAnimation-BwUJBnNt.js new file mode 100644 index 0000000000000000000000000000000000000000..680e21f6f5f23c9f87786ac004b2f5bd16f7e312 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bakedVertexAnimation-BwUJBnNt.js @@ -0,0 +1,133 @@ +import{S as e}from"./index-CDrXokXW.js";const i="bonesDeclaration",m=`#if NUM_BONE_INFLUENCERS>0 +attribute vec4 matricesIndices;attribute vec4 matricesWeights; +#if NUM_BONE_INFLUENCERS>4 +attribute vec4 matricesIndicesExtra;attribute vec4 matricesWeightsExtra; +#endif +#ifndef BAKED_VERTEX_ANIMATION_TEXTURE +#ifdef BONETEXTURE +uniform highp sampler2D boneSampler;uniform float boneTextureWidth; +#else +uniform mat4 mBones[BonesPerMesh]; +#endif +#ifdef BONES_VELOCITY_ENABLED +uniform mat4 mPreviousBones[BonesPerMesh]; +#endif +#ifdef BONETEXTURE +#define inline +mat4 readMatrixFromRawSampler(sampler2D smp,float index) +{float offset=index *4.0;float dx=1.0/boneTextureWidth;vec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));vec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));vec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));vec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));return mat4(m0,m1,m2,m3);} +#endif +#endif +#endif +`;e.IncludesShadersStore[i]||(e.IncludesShadersStore[i]=m);const r="bakedVertexAnimationDeclaration",d=`#ifdef BAKED_VERTEX_ANIMATION_TEXTURE +uniform float bakedVertexAnimationTime;uniform vec2 bakedVertexAnimationTextureSizeInverted;uniform vec4 bakedVertexAnimationSettings;uniform sampler2D bakedVertexAnimationTexture; +#ifdef INSTANCES +attribute vec4 bakedVertexAnimationSettingsInstanced; +#endif +#define inline +mat4 readMatrixFromRawSamplerVAT(sampler2D smp,float index,float frame) +{float offset=index*4.0;float frameUV=(frame+0.5)*bakedVertexAnimationTextureSizeInverted.y;float dx=bakedVertexAnimationTextureSizeInverted.x;vec4 m0=texture2D(smp,vec2(dx*(offset+0.5),frameUV));vec4 m1=texture2D(smp,vec2(dx*(offset+1.5),frameUV));vec4 m2=texture2D(smp,vec2(dx*(offset+2.5),frameUV));vec4 m3=texture2D(smp,vec2(dx*(offset+3.5),frameUV));return mat4(m0,m1,m2,m3);} +#endif +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=d);const a="instancesVertex",f=`#ifdef INSTANCES +mat4 finalWorld=mat4(world0,world1,world2,world3); +#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR) +mat4 finalPreviousWorld=mat4(previousWorld0,previousWorld1, +previousWorld2,previousWorld3); +#endif +#ifdef THIN_INSTANCES +finalWorld=world*finalWorld; +#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR) +finalPreviousWorld=previousWorld*finalPreviousWorld; +#endif +#endif +#else +mat4 finalWorld=world; +#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR) +mat4 finalPreviousWorld=previousWorld; +#endif +#endif +`;e.IncludesShadersStore[a]||(e.IncludesShadersStore[a]=f);const t="bonesVertex",s=`#ifndef BAKED_VERTEX_ANIMATION_TEXTURE +#if NUM_BONE_INFLUENCERS>0 +mat4 influence; +#ifdef BONETEXTURE +influence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0]; +#if NUM_BONE_INFLUENCERS>1 +influence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1]; +#endif +#if NUM_BONE_INFLUENCERS>2 +influence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2]; +#endif +#if NUM_BONE_INFLUENCERS>3 +influence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3]; +#endif +#if NUM_BONE_INFLUENCERS>4 +influence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0]; +#endif +#if NUM_BONE_INFLUENCERS>5 +influence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1]; +#endif +#if NUM_BONE_INFLUENCERS>6 +influence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2]; +#endif +#if NUM_BONE_INFLUENCERS>7 +influence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3]; +#endif +#else +influence=mBones[int(matricesIndices[0])]*matricesWeights[0]; +#if NUM_BONE_INFLUENCERS>1 +influence+=mBones[int(matricesIndices[1])]*matricesWeights[1]; +#endif +#if NUM_BONE_INFLUENCERS>2 +influence+=mBones[int(matricesIndices[2])]*matricesWeights[2]; +#endif +#if NUM_BONE_INFLUENCERS>3 +influence+=mBones[int(matricesIndices[3])]*matricesWeights[3]; +#endif +#if NUM_BONE_INFLUENCERS>4 +influence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0]; +#endif +#if NUM_BONE_INFLUENCERS>5 +influence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1]; +#endif +#if NUM_BONE_INFLUENCERS>6 +influence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2]; +#endif +#if NUM_BONE_INFLUENCERS>7 +influence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3]; +#endif +#endif +finalWorld=finalWorld*influence; +#endif +#endif +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=s);const n="bakedVertexAnimation",o=`#ifdef BAKED_VERTEX_ANIMATION_TEXTURE +{ +#ifdef INSTANCES +#define BVASNAME bakedVertexAnimationSettingsInstanced +#else +#define BVASNAME bakedVertexAnimationSettings +#endif +float VATStartFrame=BVASNAME.x;float VATEndFrame=BVASNAME.y;float VATOffsetFrame=BVASNAME.z;float VATSpeed=BVASNAME.w;float totalFrames=VATEndFrame-VATStartFrame+1.0;float time=bakedVertexAnimationTime*VATSpeed/totalFrames;float frameCorrection=time<1.0 ? 0.0 : 1.0;float numOfFrames=totalFrames-frameCorrection;float VATFrameNum=fract(time)*numOfFrames;VATFrameNum=mod(VATFrameNum+VATOffsetFrame,numOfFrames);VATFrameNum=floor(VATFrameNum);VATFrameNum+=VATStartFrame+frameCorrection;mat4 VATInfluence;VATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[0],VATFrameNum)*matricesWeights[0]; +#if NUM_BONE_INFLUENCERS>1 +VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[1],VATFrameNum)*matricesWeights[1]; +#endif +#if NUM_BONE_INFLUENCERS>2 +VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[2],VATFrameNum)*matricesWeights[2]; +#endif +#if NUM_BONE_INFLUENCERS>3 +VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[3],VATFrameNum)*matricesWeights[3]; +#endif +#if NUM_BONE_INFLUENCERS>4 +VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[0],VATFrameNum)*matricesWeightsExtra[0]; +#endif +#if NUM_BONE_INFLUENCERS>5 +VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[1],VATFrameNum)*matricesWeightsExtra[1]; +#endif +#if NUM_BONE_INFLUENCERS>6 +VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[2],VATFrameNum)*matricesWeightsExtra[2]; +#endif +#if NUM_BONE_INFLUENCERS>7 +VATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[3],VATFrameNum)*matricesWeightsExtra[3]; +#endif +finalWorld=finalWorld*VATInfluence;} +#endif +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=o); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bakedVertexAnimation-DoavwM49.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bakedVertexAnimation-DoavwM49.js new file mode 100644 index 0000000000000000000000000000000000000000..c5e028e985ec92aea3bdbda5621234f158b1b26d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bakedVertexAnimation-DoavwM49.js @@ -0,0 +1,32 @@ +import{S as e}from"./index-CDrXokXW.js";const t="bakedVertexAnimation",r=`#ifdef BAKED_VERTEX_ANIMATION_TEXTURE +{ +#ifdef INSTANCES +let VATStartFrame: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.x;let VATEndFrame: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.y;let VATOffsetFrame: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.z;let VATSpeed: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.w; +#else +let VATStartFrame: f32=uniforms.bakedVertexAnimationSettings.x;let VATEndFrame: f32=uniforms.bakedVertexAnimationSettings.y;let VATOffsetFrame: f32=uniforms.bakedVertexAnimationSettings.z;let VATSpeed: f32=uniforms.bakedVertexAnimationSettings.w; +#endif +let totalFrames: f32=VATEndFrame-VATStartFrame+1.0;let time: f32=uniforms.bakedVertexAnimationTime*VATSpeed/totalFrames;let frameCorrection: f32=select(1.0,0.0,time<1.0);let numOfFrames: f32=totalFrames-frameCorrection;var VATFrameNum: f32=fract(time)*numOfFrames;VATFrameNum=(VATFrameNum+VATOffsetFrame) % numOfFrames;VATFrameNum=floor(VATFrameNum);VATFrameNum=VATFrameNum+VATStartFrame+frameCorrection;var VATInfluence : mat4x4;VATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[0],VATFrameNum)*vertexInputs.matricesWeights[0]; +#if NUM_BONE_INFLUENCERS>1 +VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[1],VATFrameNum)*vertexInputs.matricesWeights[1]; +#endif +#if NUM_BONE_INFLUENCERS>2 +VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[2],VATFrameNum)*vertexInputs.matricesWeights[2]; +#endif +#if NUM_BONE_INFLUENCERS>3 +VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[3],VATFrameNum)*vertexInputs.matricesWeights[3]; +#endif +#if NUM_BONE_INFLUENCERS>4 +VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[0],VATFrameNum)*vertexInputs.matricesWeightsExtra[0]; +#endif +#if NUM_BONE_INFLUENCERS>5 +VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[1],VATFrameNum)*vertexInputs.matricesWeightsExtra[1]; +#endif +#if NUM_BONE_INFLUENCERS>6 +VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[2],VATFrameNum)*vertexInputs.matricesWeightsExtra[2]; +#endif +#if NUM_BONE_INFLUENCERS>7 +VATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[3],VATFrameNum)*vertexInputs.matricesWeightsExtra[3]; +#endif +finalWorld=finalWorld*VATInfluence;} +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=r); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/basisTextureLoader-BZgL1qDr.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/basisTextureLoader-BZgL1qDr.js new file mode 100644 index 0000000000000000000000000000000000000000..16a31765e6549e7f36956a6a57f667c51b6ceeee --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/basisTextureLoader-BZgL1qDr.js @@ -0,0 +1 @@ +import{d as h,I as R,T as U}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";function D(){const e={cTFETC1:0,cTFETC2:1,cTFBC1:2,cTFBC3:3,cTFBC7:6,cTFPVRTC1_4_RGB:8,cTFPVRTC1_4_RGBA:9,cTFASTC_4x4:10,cTFRGB565:14};let n=null;onmessage=t=>{if(t.data.action==="init"){if(t.data.url)try{importScripts(t.data.url)}catch(o){postMessage({action:"error",error:o})}n||(n=BASIS({wasmBinary:t.data.wasmBinary})),n!==null&&n.then(o=>{BASIS=o,o.initializeBasis(),postMessage({action:"init"})})}else if(t.data.action==="transcode"){const o=t.data.config,a=t.data.imageData,f=new BASIS.BasisFile(a),r=l(f);let d=t.data.ignoreSupportedFormats?null:s(t.data.config,r),p=!1;d===null&&(p=!0,d=r.hasAlpha?e.cTFBC3:e.cTFBC1);let g=!0;f.startTranscoding()||(g=!1);const T=[];for(let m=0;m>2&3],d[y++]=r[u>>4&3],d[y++]=r[u>>6&3]}}return d}}async function W(e,n,s){return await new Promise((l,i)=>{const c=t=>{t.data.action==="init"?(e.removeEventListener("message",c),l(e)):t.data.action==="error"&&i(t.data.error||"error initializing worker")};e.addEventListener("message",c),e.postMessage({action:"init",url:s?h.GetBabylonScriptURL(s):void 0,wasmBinary:n},[n])})}var C;(function(e){e[e.cTFETC1=0]="cTFETC1",e[e.cTFETC2=1]="cTFETC2",e[e.cTFBC1=2]="cTFBC1",e[e.cTFBC3=3]="cTFBC3",e[e.cTFBC4=4]="cTFBC4",e[e.cTFBC5=5]="cTFBC5",e[e.cTFBC7=6]="cTFBC7",e[e.cTFPVRTC1_4_RGB=8]="cTFPVRTC1_4_RGB",e[e.cTFPVRTC1_4_RGBA=9]="cTFPVRTC1_4_RGBA",e[e.cTFASTC_4x4=10]="cTFASTC_4x4",e[e.cTFATC_RGB=11]="cTFATC_RGB",e[e.cTFATC_RGBA_INTERPOLATED_ALPHA=12]="cTFATC_RGBA_INTERPOLATED_ALPHA",e[e.cTFRGBA32=13]="cTFRGBA32",e[e.cTFRGB565=14]="cTFRGB565",e[e.cTFBGR565=15]="cTFBGR565",e[e.cTFRGBA4444=16]="cTFRGBA4444",e[e.cTFFXT1_RGB=17]="cTFFXT1_RGB",e[e.cTFPVRTC2_4_RGB=18]="cTFPVRTC2_4_RGB",e[e.cTFPVRTC2_4_RGBA=19]="cTFPVRTC2_4_RGBA",e[e.cTFETC2_EAC_R11=20]="cTFETC2_EAC_R11",e[e.cTFETC2_EAC_RG11=21]="cTFETC2_EAC_RG11"})(C||(C={}));const b={JSModuleURL:`${h._DefaultCdnUrl}/basisTranscoder/1/basis_transcoder.js`,WasmModuleURL:`${h._DefaultCdnUrl}/basisTranscoder/1/basis_transcoder.wasm`},V=(e,n)=>{let s;switch(e){case C.cTFETC1:s=36196;break;case C.cTFBC1:s=33776;break;case C.cTFBC4:s=33779;break;case C.cTFASTC_4x4:s=37808;break;case C.cTFETC2:s=37496;break;case C.cTFBC7:s=36492;break}if(s===void 0)throw"The chosen Basis transcoder format is not currently supported";return s};let G=null,L=null,k=0;const H=!1,x=async()=>(G||(G=new Promise((e,n)=>{L?e(L):h.LoadFileAsync(h.GetBabylonScriptURL(b.WasmModuleURL)).then(s=>{if(typeof URL!="function")return n("Basis transcoder requires an environment with a URL constructor");const l=URL.createObjectURL(new Blob([`(${D})()`],{type:"application/javascript"}));L=new Worker(l),W(L,s,b.JSModuleURL).then(e,n)}).catch(n)})),await G),_=async(e,n)=>{const s=e instanceof ArrayBuffer?new Uint8Array(e):e;return await new Promise((l,i)=>{x().then(()=>{const c=k++,t=a=>{a.data.action==="transcode"&&a.data.id===c&&(L.removeEventListener("message",t),a.data.success?l(a.data):i("Transcode is not supported on this device"))};L.addEventListener("message",t);const o=new Uint8Array(s.byteLength);o.set(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)),L.postMessage({action:"transcode",id:c,imageData:o,config:n,ignoreSupportedFormats:H},[o.buffer])},c=>{i(c)})})},E=(e,n)=>{let s=n._gl?.TEXTURE_2D;e.isCube&&(s=n._gl?.TEXTURE_CUBE_MAP),n._bindTextureDirectly(s,e,!0)},P=(e,n)=>{const s=e.getEngine();for(let l=0;l{s._releaseTexture(c),E(e,s)})}else e._invertVScale=!e.invertY,e.width=i.width+3&-4,e.height=i.height+3&-4,e.samplingMode=2,E(e,s),s._uploadDataToTextureDirectly(e,new Uint16Array(i.transcodedPixels.buffer),l,0,4,!0);else{e.width=i.width,e.height=i.height,e.generateMipMaps=n.fileInfo.images[l].levels.length>1;const c=v.GetInternalFormatFromBasisFormat(n.format,s);e.format=c,E(e,s);const t=n.fileInfo.images[l].levels;for(let o=0;o{const f=a.fileInfo.images[0].levels.length>1&&s.generateMipMaps;P(s,a),s.getEngine()._setCubeMapTextureParams(s,f),s.isReady=!0,s.onLoadedObservable.notifyObservers(s),s.onLoadedObservable.clear(),i&&i()}).catch(a=>{h.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),s.isReady=!0,c&&c(a)})}loadData(n,s,l){const i=s.getEngine().getCaps(),c={supportedCompressionFormats:{etc1:!!i.etc1,s3tc:!!i.s3tc,pvrtc:!!i.pvrtc,etc2:!!i.etc2,astc:!!i.astc,bc7:!!i.bptc}};_(n,c).then(t=>{const o=t.fileInfo.images[0].levels[0],a=t.fileInfo.images[0].levels.length>1&&s.generateMipMaps;l(o.width,o.height,a,t.format!==-1,()=>{P(s,t)})}).catch(t=>{h.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),h.Warn(`Failed to transcode Basis file: ${t}`),l(0,0,!1,!1,()=>{},!0)})}}export{N as _BasisTextureLoader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/blockDiagram-VD42YOAC-BIkysrgD.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/blockDiagram-VD42YOAC-BIkysrgD.js new file mode 100644 index 0000000000000000000000000000000000000000..26b2e2c6825177a154f0302118830f00e6ff35ea --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/blockDiagram-VD42YOAC-BIkysrgD.js @@ -0,0 +1,122 @@ +import{g as oe}from"./chunk-FMBD7UC4-DNqeu8Dh.js";import{_ as d,G as rt,d as he,l as L,y as de,A as ge,a2 as ue,c as R,P as pe,a3 as j,a4 as Wt,a5 as fe,u as $,j as xe,a6 as ye,a7 as xt,h as yt,a8 as be}from"./mermaid.core-7TB2QPZo.js";import{c as we}from"./clone-CREevivd.js";import{G as me}from"./graph-BVwx8Qtr.js";import{c as Le}from"./channel-CA-Tyyit.js";import{s as O}from"./select-BigU4G0v.js";import{l as Se,k as ke}from"./step-B-Gbak1k.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./dispatch-kxCwF96_.js";import"./_baseUniq-DT1kfcxk.js";var bt=(function(){var e=d(function(D,y,g,f){for(g=g||{},f=D.length;f--;g[D[f]]=y);return g},"o"),t=[1,15],a=[1,7],i=[1,13],l=[1,14],s=[1,19],r=[1,16],n=[1,17],c=[1,18],u=[8,30],o=[8,10,21,28,29,30,31,39,43,46],x=[1,23],w=[1,24],b=[8,10,15,16,21,28,29,30,31,39,43,46],S=[8,10,15,16,21,27,28,29,30,31,39,43,46],v=[1,49],k={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:d(function(y,g,f,m,E,h,W){var p=h.length-1;switch(E){case 4:m.getLogger().debug("Rule: separator (NL) ");break;case 5:m.getLogger().debug("Rule: separator (Space) ");break;case 6:m.getLogger().debug("Rule: separator (EOF) ");break;case 7:m.getLogger().debug("Rule: hierarchy: ",h[p-1]),m.setHierarchy(h[p-1]);break;case 8:m.getLogger().debug("Stop NL ");break;case 9:m.getLogger().debug("Stop EOF ");break;case 10:m.getLogger().debug("Stop NL2 ");break;case 11:m.getLogger().debug("Stop EOF2 ");break;case 12:m.getLogger().debug("Rule: statement: ",h[p]),typeof h[p].length=="number"?this.$=h[p]:this.$=[h[p]];break;case 13:m.getLogger().debug("Rule: statement #2: ",h[p-1]),this.$=[h[p-1]].concat(h[p]);break;case 14:m.getLogger().debug("Rule: link: ",h[p],y),this.$={edgeTypeStr:h[p],label:""};break;case 15:m.getLogger().debug("Rule: LABEL link: ",h[p-3],h[p-1],h[p]),this.$={edgeTypeStr:h[p],label:h[p-1]};break;case 18:const I=parseInt(h[p]),Z=m.generateId();this.$={id:Z,type:"space",label:"",width:I,children:[]};break;case 23:m.getLogger().debug("Rule: (nodeStatement link node) ",h[p-2],h[p-1],h[p]," typestr: ",h[p-1].edgeTypeStr);const V=m.edgeStrToEdgeData(h[p-1].edgeTypeStr);this.$=[{id:h[p-2].id,label:h[p-2].label,type:h[p-2].type,directions:h[p-2].directions},{id:h[p-2].id+"-"+h[p].id,start:h[p-2].id,end:h[p].id,label:h[p-1].label,type:"edge",directions:h[p].directions,arrowTypeEnd:V,arrowTypeStart:"arrow_open"},{id:h[p].id,label:h[p].label,type:m.typeStr2Type(h[p].typeStr),directions:h[p].directions}];break;case 24:m.getLogger().debug("Rule: nodeStatement (abc88 node size) ",h[p-1],h[p]),this.$={id:h[p-1].id,label:h[p-1].label,type:m.typeStr2Type(h[p-1].typeStr),directions:h[p-1].directions,widthInColumns:parseInt(h[p],10)};break;case 25:m.getLogger().debug("Rule: nodeStatement (node) ",h[p]),this.$={id:h[p].id,label:h[p].label,type:m.typeStr2Type(h[p].typeStr),directions:h[p].directions,widthInColumns:1};break;case 26:m.getLogger().debug("APA123",this?this:"na"),m.getLogger().debug("COLUMNS: ",h[p]),this.$={type:"column-setting",columns:h[p]==="auto"?-1:parseInt(h[p])};break;case 27:m.getLogger().debug("Rule: id-block statement : ",h[p-2],h[p-1]),m.generateId(),this.$={...h[p-2],type:"composite",children:h[p-1]};break;case 28:m.getLogger().debug("Rule: blockStatement : ",h[p-2],h[p-1],h[p]);const at=m.generateId();this.$={id:at,type:"composite",label:"",children:h[p-1]};break;case 29:m.getLogger().debug("Rule: node (NODE_ID separator): ",h[p]),this.$={id:h[p]};break;case 30:m.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",h[p-1],h[p]),this.$={id:h[p-1],label:h[p].label,typeStr:h[p].typeStr,directions:h[p].directions};break;case 31:m.getLogger().debug("Rule: dirList: ",h[p]),this.$=[h[p]];break;case 32:m.getLogger().debug("Rule: dirList: ",h[p-1],h[p]),this.$=[h[p-1]].concat(h[p]);break;case 33:m.getLogger().debug("Rule: nodeShapeNLabel: ",h[p-2],h[p-1],h[p]),this.$={typeStr:h[p-2]+h[p],label:h[p-1]};break;case 34:m.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",h[p-3],h[p-2]," #3:",h[p-1],h[p]),this.$={typeStr:h[p-3]+h[p],label:h[p-2],directions:h[p-1]};break;case 35:case 36:this.$={type:"classDef",id:h[p-1].trim(),css:h[p].trim()};break;case 37:this.$={type:"applyClass",id:h[p-1].trim(),styleClass:h[p].trim()};break;case 38:this.$={type:"applyStyles",id:h[p-1].trim(),stylesStr:h[p].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:l,31:s,39:r,43:n,46:c},{8:[1,20]},e(u,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:i,29:l,31:s,39:r,43:n,46:c}),e(o,[2,16],{14:22,15:x,16:w}),e(o,[2,17]),e(o,[2,18]),e(o,[2,19]),e(o,[2,20]),e(o,[2,21]),e(o,[2,22]),e(b,[2,25],{27:[1,25]}),e(o,[2,26]),{19:26,26:12,31:s},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:l,31:s,39:r,43:n,46:c},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(S,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(u,[2,13]),{26:35,31:s},{31:[2,14]},{17:[1,36]},e(b,[2,24]),{10:t,11:37,13:4,14:22,15:x,16:w,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:i,29:l,31:s,39:r,43:n,46:c},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(S,[2,30]),{18:[1,43]},{18:[1,44]},e(b,[2,23]),{18:[1,45]},{30:[1,46]},e(o,[2,28]),e(o,[2,35]),e(o,[2,36]),e(o,[2,37]),e(o,[2,38]),{36:[1,47]},{33:48,34:v},{15:[1,50]},e(o,[2,27]),e(S,[2,33]),{38:[1,51]},{33:52,34:v,38:[2,31]},{31:[2,15]},e(S,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:d(function(y,g){if(g.recoverable)this.trace(y);else{var f=new Error(y);throw f.hash=g,f}},"parseError"),parse:d(function(y){var g=this,f=[0],m=[],E=[null],h=[],W=this.table,p="",I=0,Z=0,V=2,at=1,ne=h.slice.call(arguments,1),z=Object.create(this.lexer),q={yy:{}};for(var gt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,gt)&&(q.yy[gt]=this.yy[gt]);z.setInput(y,q.yy),q.yy.lexer=z,q.yy.parser=this,typeof z.yylloc>"u"&&(z.yylloc={});var ut=z.yylloc;h.push(ut);var le=z.options&&z.options.ranges;typeof q.yy.parseError=="function"?this.parseError=q.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ce(P){f.length=f.length-2*P,E.length=E.length-P,h.length=h.length-P}d(ce,"popStack");function Nt(){var P;return P=m.pop()||z.lex()||at,typeof P!="number"&&(P instanceof Array&&(m=P,P=m.pop()),P=g.symbols_[P]||P),P}d(Nt,"lex");for(var F,J,H,pt,Q={},st,G,Tt,it;;){if(J=f[f.length-1],this.defaultActions[J]?H=this.defaultActions[J]:((F===null||typeof F>"u")&&(F=Nt()),H=W[J]&&W[J][F]),typeof H>"u"||!H.length||!H[0]){var ft="";it=[];for(st in W[J])this.terminals_[st]&&st>V&&it.push("'"+this.terminals_[st]+"'");z.showPosition?ft="Parse error on line "+(I+1)+`: +`+z.showPosition()+` +Expecting `+it.join(", ")+", got '"+(this.terminals_[F]||F)+"'":ft="Parse error on line "+(I+1)+": Unexpected "+(F==at?"end of input":"'"+(this.terminals_[F]||F)+"'"),this.parseError(ft,{text:z.match,token:this.terminals_[F]||F,line:z.yylineno,loc:ut,expected:it})}if(H[0]instanceof Array&&H.length>1)throw new Error("Parse Error: multiple actions possible at state: "+J+", token: "+F);switch(H[0]){case 1:f.push(F),E.push(z.yytext),h.push(z.yylloc),f.push(H[1]),F=null,Z=z.yyleng,p=z.yytext,I=z.yylineno,ut=z.yylloc;break;case 2:if(G=this.productions_[H[1]][1],Q.$=E[E.length-G],Q._$={first_line:h[h.length-(G||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(G||1)].first_column,last_column:h[h.length-1].last_column},le&&(Q._$.range=[h[h.length-(G||1)].range[0],h[h.length-1].range[1]]),pt=this.performAction.apply(Q,[p,Z,I,q.yy,H[1],E,h].concat(ne)),typeof pt<"u")return pt;G&&(f=f.slice(0,-1*G*2),E=E.slice(0,-1*G),h=h.slice(0,-1*G)),f.push(this.productions_[H[1]][0]),E.push(Q.$),h.push(Q._$),Tt=W[f[f.length-2]][f[f.length-1]],f.push(Tt);break;case 3:return!0}}return!0},"parse")},B=(function(){var D={EOF:1,parseError:d(function(g,f){if(this.yy.parser)this.yy.parser.parseError(g,f);else throw new Error(g)},"parseError"),setInput:d(function(y,g){return this.yy=g||this.yy||{},this._input=y,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var y=this._input[0];this.yytext+=y,this.yyleng++,this.offset++,this.match+=y,this.matched+=y;var g=y.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),y},"input"),unput:d(function(y){var g=y.length,f=y.split(/(?:\r\n?|\n)/g);this._input=y+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var m=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),f.length-1&&(this.yylineno-=f.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:f?(f.length===m.length?this.yylloc.first_column:0)+m[m.length-f.length].length-f[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(y){this.unput(this.match.slice(y))},"less"),pastInput:d(function(){var y=this.matched.substr(0,this.matched.length-this.match.length);return(y.length>20?"...":"")+y.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var y=this.match;return y.length<20&&(y+=this._input.substr(0,20-y.length)),(y.substr(0,20)+(y.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var y=this.pastInput(),g=new Array(y.length+1).join("-");return y+this.upcomingInput()+` +`+g+"^"},"showPosition"),test_match:d(function(y,g){var f,m,E;if(this.options.backtrack_lexer&&(E={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(E.yylloc.range=this.yylloc.range.slice(0))),m=y[0].match(/(?:\r\n?|\n).*/g),m&&(this.yylineno+=m.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:m?m[m.length-1].length-m[m.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+y[0].length},this.yytext+=y[0],this.match+=y[0],this.matches=y,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(y[0].length),this.matched+=y[0],f=this.performAction.call(this,this.yy,this,g,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),f)return f;if(this._backtrack){for(var h in E)this[h]=E[h];return!1}return!1},"test_match"),next:d(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var y,g,f,m;this._more||(this.yytext="",this.match="");for(var E=this._currentRules(),h=0;hg[0].length)){if(g=f,m=h,this.options.backtrack_lexer){if(y=this.test_match(f,E[h]),y!==!1)return y;if(this._backtrack){g=!1;continue}else return!1}else if(!this.options.flex)break}return g?(y=this.test_match(g,E[m]),y!==!1?y:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:d(function(){var g=this.next();return g||this.lex()},"lex"),begin:d(function(g){this.conditionStack.push(g)},"begin"),popState:d(function(){var g=this.conditionStack.length-1;return g>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:d(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:d(function(g){return g=this.conditionStack.length-1-Math.abs(g||0),g>=0?this.conditionStack[g]:"INITIAL"},"topState"),pushState:d(function(g){this.begin(g)},"pushState"),stateStackSize:d(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:d(function(g,f,m,E){switch(m){case 0:return g.getLogger().debug("Found block-beta"),10;case 1:return g.getLogger().debug("Found id-block"),29;case 2:return g.getLogger().debug("Found block"),10;case 3:g.getLogger().debug(".",f.yytext);break;case 4:g.getLogger().debug("_",f.yytext);break;case 5:return 5;case 6:return f.yytext=-1,28;case 7:return f.yytext=f.yytext.replace(/columns\s+/,""),g.getLogger().debug("COLUMNS (LEX)",f.yytext),28;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:g.getLogger().debug("LEX: POPPING STR:",f.yytext),this.popState();break;case 13:return g.getLogger().debug("LEX: STR end:",f.yytext),"STR";case 14:return f.yytext=f.yytext.replace(/space\:/,""),g.getLogger().debug("SPACE NUM (LEX)",f.yytext),21;case 15:return f.yytext="1",g.getLogger().debug("COLUMNS (LEX)",f.yytext),21;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 21:return this.popState(),this.pushState("CLASSDEFID"),40;case 22:return this.popState(),41;case 23:return this.pushState("CLASS"),43;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;case 25:return this.popState(),45;case 26:return this.pushState("STYLE_STMNT"),46;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;case 28:return this.popState(),48;case 29:return this.pushState("acc_title"),"acc_title";case 30:return this.popState(),"acc_title_value";case 31:return this.pushState("acc_descr"),"acc_descr";case 32:return this.popState(),"acc_descr_value";case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),g.getLogger().debug("Lex: (("),"NODE_DEND";case 38:return this.popState(),g.getLogger().debug("Lex: (("),"NODE_DEND";case 39:return this.popState(),g.getLogger().debug("Lex: ))"),"NODE_DEND";case 40:return this.popState(),g.getLogger().debug("Lex: (("),"NODE_DEND";case 41:return this.popState(),g.getLogger().debug("Lex: (("),"NODE_DEND";case 42:return this.popState(),g.getLogger().debug("Lex: (-"),"NODE_DEND";case 43:return this.popState(),g.getLogger().debug("Lex: -)"),"NODE_DEND";case 44:return this.popState(),g.getLogger().debug("Lex: (("),"NODE_DEND";case 45:return this.popState(),g.getLogger().debug("Lex: ]]"),"NODE_DEND";case 46:return this.popState(),g.getLogger().debug("Lex: ("),"NODE_DEND";case 47:return this.popState(),g.getLogger().debug("Lex: ])"),"NODE_DEND";case 48:return this.popState(),g.getLogger().debug("Lex: /]"),"NODE_DEND";case 49:return this.popState(),g.getLogger().debug("Lex: /]"),"NODE_DEND";case 50:return this.popState(),g.getLogger().debug("Lex: )]"),"NODE_DEND";case 51:return this.popState(),g.getLogger().debug("Lex: )"),"NODE_DEND";case 52:return this.popState(),g.getLogger().debug("Lex: ]>"),"NODE_DEND";case 53:return this.popState(),g.getLogger().debug("Lex: ]"),"NODE_DEND";case 54:return g.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;case 55:return g.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;case 56:return g.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;case 57:return g.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 58:return g.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;case 59:return g.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 60:return g.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 61:return g.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 62:return g.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;case 63:return g.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;case 64:return g.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 65:return this.pushState("NODE"),35;case 66:return this.pushState("NODE"),35;case 67:return this.pushState("NODE"),35;case 68:return this.pushState("NODE"),35;case 69:return this.pushState("NODE"),35;case 70:return this.pushState("NODE"),35;case 71:return this.pushState("NODE"),35;case 72:return g.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;case 73:return this.pushState("BLOCK_ARROW"),g.getLogger().debug("LEX ARR START"),37;case 74:return g.getLogger().debug("Lex: NODE_ID",f.yytext),31;case 75:return g.getLogger().debug("Lex: EOF",f.yytext),8;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:g.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:g.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return g.getLogger().debug("LEX: NODE_DESCR:",f.yytext),"NODE_DESCR";case 83:g.getLogger().debug("LEX POPPING"),this.popState();break;case 84:g.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return f.yytext=f.yytext.replace(/^,\s*/,""),g.getLogger().debug("Lex (right): dir:",f.yytext),"DIR";case 86:return f.yytext=f.yytext.replace(/^,\s*/,""),g.getLogger().debug("Lex (left):",f.yytext),"DIR";case 87:return f.yytext=f.yytext.replace(/^,\s*/,""),g.getLogger().debug("Lex (x):",f.yytext),"DIR";case 88:return f.yytext=f.yytext.replace(/^,\s*/,""),g.getLogger().debug("Lex (y):",f.yytext),"DIR";case 89:return f.yytext=f.yytext.replace(/^,\s*/,""),g.getLogger().debug("Lex (up):",f.yytext),"DIR";case 90:return f.yytext=f.yytext.replace(/^,\s*/,""),g.getLogger().debug("Lex (down):",f.yytext),"DIR";case 91:return f.yytext="]>",g.getLogger().debug("Lex (ARROW_DIR end):",f.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 92:return g.getLogger().debug("Lex: LINK","#"+f.yytext+"#"),15;case 93:return g.getLogger().debug("Lex: LINK",f.yytext),15;case 94:return g.getLogger().debug("Lex: LINK",f.yytext),15;case 95:return g.getLogger().debug("Lex: LINK",f.yytext),15;case 96:return g.getLogger().debug("Lex: START_LINK",f.yytext),this.pushState("LLABEL"),16;case 97:return g.getLogger().debug("Lex: START_LINK",f.yytext),this.pushState("LLABEL"),16;case 98:return g.getLogger().debug("Lex: START_LINK",f.yytext),this.pushState("LLABEL"),16;case 99:this.pushState("md_string");break;case 100:return g.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 101:return this.popState(),g.getLogger().debug("Lex: LINK","#"+f.yytext+"#"),15;case 102:return this.popState(),g.getLogger().debug("Lex: LINK",f.yytext),15;case 103:return this.popState(),g.getLogger().debug("Lex: LINK",f.yytext),15;case 104:return g.getLogger().debug("Lex: COLON",f.yytext),f.yytext=f.yytext.slice(1),27}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return D})();k.lexer=B;function _(){this.yy={}}return d(_,"Parser"),_.prototype=k,k.Parser=_,new _})();bt.parser=bt;var ve=bt,X=new Map,kt=[],wt=new Map,Bt="color",Ct="fill",Ee="bgFill",Pt=",",_e=R(),ct=new Map,De=d(e=>xe.sanitizeText(e,_e),"sanitizeText"),Ne=d(function(e,t=""){let a=ct.get(e);a||(a={id:e,styles:[],textStyles:[]},ct.set(e,a)),t?.split(Pt).forEach(i=>{const l=i.replace(/([^;]*);/,"$1").trim();if(RegExp(Bt).exec(i)){const r=l.replace(Ct,Ee).replace(Bt,Ct);a.textStyles.push(r)}a.styles.push(l)})},"addStyleClass"),Te=d(function(e,t=""){const a=X.get(e);t!=null&&(a.styles=t.split(Pt))},"addStyle2Node"),Be=d(function(e,t){e.split(",").forEach(function(a){let i=X.get(a);if(i===void 0){const l=a.trim();i={id:l,type:"na",children:[]},X.set(l,i)}i.classes||(i.classes=[]),i.classes.push(t)})},"setCssClass"),Yt=d((e,t)=>{const a=e.flat(),i=[],s=a.find(r=>r?.type==="column-setting")?.columns??-1;for(const r of a){if(typeof s=="number"&&s>0&&r.type!=="column-setting"&&typeof r.widthInColumns=="number"&&r.widthInColumns>s&&L.warn(`Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${s}`),r.label&&(r.label=De(r.label)),r.type==="classDef"){Ne(r.id,r.css);continue}if(r.type==="applyClass"){Be(r.id,r?.styleClass??"");continue}if(r.type==="applyStyles"){r?.stylesStr&&Te(r.id,r?.stylesStr);continue}if(r.type==="column-setting")t.columns=r.columns??-1;else if(r.type==="edge"){const n=(wt.get(r.id)??0)+1;wt.set(r.id,n),r.id=n+"-"+r.id,kt.push(r)}else{r.label||(r.type==="composite"?r.label="":r.label=r.id);const n=X.get(r.id);if(n===void 0?X.set(r.id,r):(r.type!=="na"&&(n.type=r.type),r.label!==r.id&&(n.label=r.label)),r.children&&Yt(r.children,r),r.type==="space"){const c=r.width??1;for(let u=0;u{L.debug("Clear called"),de(),et={id:"root",type:"composite",children:[],columns:-1},X=new Map([["root",et]]),vt=[],ct=new Map,kt=[],wt=new Map},"clear");function Ht(e){switch(L.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return L.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}d(Ht,"typeStr2Type");function Kt(e){return L.debug("typeStr2Type",e),e==="=="?"thick":"normal"}d(Kt,"edgeTypeStr2Type");function Xt(e){switch(e.replace(/^[\s-]+|[\s-]+$/g,"")){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}d(Xt,"edgeStrToEdgeData");var It=0,Ie=d(()=>(It++,"id-"+Math.random().toString(36).substr(2,12)+"-"+It),"generateId"),Oe=d(e=>{et.children=e,Yt(e,et),vt=et.children},"setHierarchy"),Re=d(e=>{const t=X.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),ze=d(()=>[...X.values()],"getBlocksFlat"),Ae=d(()=>vt||[],"getBlocks"),Me=d(()=>kt,"getEdges"),Fe=d(e=>X.get(e),"getBlock"),We=d(e=>{X.set(e.id,e)},"setBlock"),Pe=d(()=>L,"getLogger"),Ye=d(function(){return ct},"getClasses"),He={getConfig:d(()=>rt().block,"getConfig"),typeStr2Type:Ht,edgeTypeStr2Type:Kt,edgeStrToEdgeData:Xt,getLogger:Pe,getBlocksFlat:ze,getBlocks:Ae,getEdges:Me,setHierarchy:Oe,getBlock:Fe,setBlock:We,getColumns:Re,getClasses:Ye,clear:Ce,generateId:Ie},Ke=He,nt=d((e,t)=>{const a=Le,i=a(e,"r"),l=a(e,"g"),s=a(e,"b");return ge(i,l,s,t)},"fade"),Xe=d(e=>`.label { + font-family: ${e.fontFamily}; + color: ${e.nodeTextColor||e.textColor}; + } + .cluster-label text { + fill: ${e.titleColor}; + } + .cluster-label span,p { + color: ${e.titleColor}; + } + + + + .label text,span,p { + fill: ${e.nodeTextColor||e.textColor}; + color: ${e.nodeTextColor||e.textColor}; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + stroke-width: 1px; + } + .flowchart-label text { + text-anchor: middle; + } + // .flowchart-label .text-outer-tspan { + // text-anchor: middle; + // } + // .flowchart-label .text-inner-tspan { + // text-anchor: start; + // } + + .node .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + .arrowheadPath { + fill: ${e.arrowheadColor}; + } + + .edgePath .path { + stroke: ${e.lineColor}; + stroke-width: 2.0px; + } + + .flowchart-link { + stroke: ${e.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${e.edgeLabelBackground}; + rect { + opacity: 0.5; + background-color: ${e.edgeLabelBackground}; + fill: ${e.edgeLabelBackground}; + } + text-align: center; + } + + /* For html labels only */ + .labelBkg { + background-color: ${nt(e.edgeLabelBackground,.5)}; + // background-color: + } + + .node .cluster { + // fill: ${nt(e.mainBkg,.5)}; + fill: ${nt(e.clusterBkg,.5)}; + stroke: ${nt(e.clusterBorder,.2)}; + box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; + stroke-width: 1px; + } + + .cluster text { + fill: ${e.titleColor}; + } + + .cluster span,p { + color: ${e.titleColor}; + } + /* .cluster div { + color: ${e.titleColor}; + } */ + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${e.fontFamily}; + font-size: 12px; + background: ${e.tertiaryColor}; + border: 1px solid ${e.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .flowchartTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; + } + ${oe()} +`,"getStyles"),Ue=Xe,je=d((e,t,a,i)=>{t.forEach(l=>{rr[l](e,a,i)})},"insertMarkers"),Ve=d((e,t,a)=>{L.trace("Making markers for ",a),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),Ge=d((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),Ze=d((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),qe=d((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),Je=d((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),Qe=d((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),$e=d((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),tr=d((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),er=d((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),rr={extension:Ve,composition:Ge,aggregation:Ze,dependency:qe,lollipop:Je,point:Qe,circle:$e,cross:tr,barb:er},ar=je,C=R()?.block?.padding??8;function Ut(e,t){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(t<0||!Number.isInteger(t))throw new Error("Position must be a non-negative integer."+t);if(e<0)return{px:t,py:0};if(e===1)return{px:0,py:t};const a=t%e,i=Math.floor(t/e);return{px:a,py:i}}d(Ut,"calculateBlockPosition");var sr=d(e=>{let t=0,a=0;for(const i of e.children){const{width:l,height:s,x:r,y:n}=i.size??{width:0,height:0,x:0,y:0};L.debug("getMaxChildSize abc95 child:",i.id,"width:",l,"height:",s,"x:",r,"y:",n,i.type),i.type!=="space"&&(l>t&&(t=l/(e.widthInColumns??1)),s>a&&(a=s))}return{width:t,height:a}},"getMaxChildSize");function ot(e,t,a=0,i=0){L.debug("setBlockSizes abc95 (start)",e.id,e?.size?.x,"block width =",e?.size,"siblingWidth",a),e?.size?.width||(e.size={width:a,height:i,x:0,y:0});let l=0,s=0;if(e.children?.length>0){for(const b of e.children)ot(b,t);const r=sr(e);l=r.width,s=r.height,L.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",l,s);for(const b of e.children)b.size&&(L.debug(`abc95 Setting size of children of ${e.id} id=${b.id} ${l} ${s} ${JSON.stringify(b.size)}`),b.size.width=l*(b.widthInColumns??1)+C*((b.widthInColumns??1)-1),b.size.height=s,b.size.x=0,b.size.y=0,L.debug(`abc95 updating size of ${e.id} children child:${b.id} maxWidth:${l} maxHeight:${s}`));for(const b of e.children)ot(b,t,l,s);const n=e.columns??-1;let c=0;for(const b of e.children)c+=b.widthInColumns??1;let u=e.children.length;n>0&&n0?Math.min(e.children.length,n):e.children.length;if(b>0){const S=(x-b*C-C)/b;L.debug("abc95 (growing to fit) width",e.id,x,e.size?.width,S);for(const v of e.children)v.size&&(v.size.width=S)}}e.size={width:x,height:w,x:0,y:0}}L.debug("setBlockSizes abc94 (done)",e.id,e?.size?.x,e?.size?.width,e?.size?.y,e?.size?.height)}d(ot,"setBlockSizes");function Et(e,t){L.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`);const a=e.columns??-1;if(L.debug("layoutBlocks columns abc95",e.id,"=>",a,e),e.children&&e.children.length>0){const i=e?.children[0]?.size?.width??0,l=e.children.length*i+(e.children.length-1)*C;L.debug("widthOfChildren 88",l,"posX");let s=0;L.debug("abc91 block?.size?.x",e.id,e?.size?.x);let r=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-C,n=0;for(const c of e.children){const u=e;if(!c.size)continue;const{width:o,height:x}=c.size,{px:w,py:b}=Ut(a,s);if(b!=n&&(n=b,r=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-C,L.debug("New row in layout for block",e.id," and child ",c.id,n)),L.debug(`abc89 layout blocks (child) id: ${c.id} Pos: ${s} (px, py) ${w},${b} (${u?.size?.x},${u?.size?.y}) parent: ${u.id} width: ${o}${C}`),u.size){const v=o/2;c.size.x=r+C+v,L.debug(`abc91 layout blocks (calc) px, pyid:${c.id} startingPos=X${r} new startingPosX${c.size.x} ${v} padding=${C} width=${o} halfWidth=${v} => x:${c.size.x} y:${c.size.y} ${c.widthInColumns} (width * (child?.w || 1)) / 2 ${o*(c?.widthInColumns??1)/2}`),r=c.size.x+v,c.size.y=u.size.y-u.size.height/2+b*(x+C)+x/2+C,L.debug(`abc88 layout blocks (calc) px, pyid:${c.id}startingPosX${r}${C}${v}=>x:${c.size.x}y:${c.size.y}${c.widthInColumns}(width * (child?.w || 1)) / 2${o*(c?.widthInColumns??1)/2}`)}c.children&&Et(c);let S=c?.widthInColumns??1;a>0&&(S=Math.min(S,a-s%a)),s+=S,L.debug("abc88 columnsPos",c,s)}}L.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`)}d(Et,"layoutBlocks");function _t(e,{minX:t,minY:a,maxX:i,maxY:l}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){const{x:s,y:r,width:n,height:c}=e.size;s-n/2i&&(i=s+n/2),r+c/2>l&&(l=r+c/2)}if(e.children)for(const s of e.children)({minX:t,minY:a,maxX:i,maxY:l}=_t(s,{minX:t,minY:a,maxX:i,maxY:l}));return{minX:t,minY:a,maxX:i,maxY:l}}d(_t,"findBounds");function jt(e){const t=e.getBlock("root");if(!t)return;ot(t,e,0,0),Et(t),L.debug("getBlocks",JSON.stringify(t,null,2));const{minX:a,minY:i,maxX:l,maxY:s}=_t(t),r=s-i,n=l-a;return{x:a,y:i,width:n,height:r}}d(jt,"layout");function mt(e,t){t&&e.attr("style",t)}d(mt,"applyStyle");function Vt(e,t){const a=O(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),i=a.append("xhtml:div"),l=e.label,s=e.isNode?"nodeLabel":"edgeLabel",r=i.append("span");return r.html(yt(l,t)),mt(r,e.labelStyle),r.attr("class",s),mt(i,e.labelStyle),i.style("display","inline-block"),i.style("white-space","nowrap"),i.attr("xmlns","http://www.w3.org/1999/xhtml"),a.node()}d(Vt,"addHtmlLabel");var ir=d(async(e,t,a,i)=>{let l=e||"";typeof l=="object"&&(l=l[0]);const s=R();if(j(s.flowchart.htmlLabels)){l=l.replace(/\\n|\n/g,"
          "),L.debug("vertexText"+l);const r=await ye(xt(l)),n={isNode:i,label:r,labelStyle:t.replace("fill:","color:")};return Vt(n,s)}else{const r=document.createElementNS("http://www.w3.org/2000/svg","text");r.setAttribute("style",t.replace("color:","fill:"));let n=[];typeof l=="string"?n=l.split(/\\n|\n|/gi):Array.isArray(l)?n=l:n=[];for(const c of n){const u=document.createElementNS("http://www.w3.org/2000/svg","tspan");u.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),u.setAttribute("dy","1em"),u.setAttribute("x","0"),a?u.setAttribute("class","title-row"):u.setAttribute("class","row"),u.textContent=c.trim(),r.appendChild(u)}return r}},"createLabel"),K=ir,nr=d((e,t,a,i,l)=>{t.arrowTypeStart&&Ot(e,"start",t.arrowTypeStart,a,i,l),t.arrowTypeEnd&&Ot(e,"end",t.arrowTypeEnd,a,i,l)},"addEdgeMarkers"),lr={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},Ot=d((e,t,a,i,l,s)=>{const r=lr[a];if(!r){L.warn(`Unknown arrow type: ${a}`);return}const n=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${i}#${l}_${s}-${r}${n})`)},"addEdgeMarker"),Lt={},M={},cr=d(async(e,t)=>{const a=R(),i=j(a.flowchart.htmlLabels),l=t.labelType==="markdown"?Wt(e,t.label,{style:t.labelStyle,useHtmlLabels:i,addSvgBackground:!0},a):await K(t.label,t.labelStyle),s=e.insert("g").attr("class","edgeLabel"),r=s.insert("g").attr("class","label");r.node().appendChild(l);let n=l.getBBox();if(i){const u=l.children[0],o=O(l);n=u.getBoundingClientRect(),o.attr("width",n.width),o.attr("height",n.height)}r.attr("transform","translate("+-n.width/2+", "+-n.height/2+")"),Lt[t.id]=s,t.width=n.width,t.height=n.height;let c;if(t.startLabelLeft){const u=await K(t.startLabelLeft,t.labelStyle),o=e.insert("g").attr("class","edgeTerminals"),x=o.insert("g").attr("class","inner");c=x.node().appendChild(u);const w=u.getBBox();x.attr("transform","translate("+-w.width/2+", "+-w.height/2+")"),M[t.id]||(M[t.id]={}),M[t.id].startLeft=o,tt(c,t.startLabelLeft)}if(t.startLabelRight){const u=await K(t.startLabelRight,t.labelStyle),o=e.insert("g").attr("class","edgeTerminals"),x=o.insert("g").attr("class","inner");c=o.node().appendChild(u),x.node().appendChild(u);const w=u.getBBox();x.attr("transform","translate("+-w.width/2+", "+-w.height/2+")"),M[t.id]||(M[t.id]={}),M[t.id].startRight=o,tt(c,t.startLabelRight)}if(t.endLabelLeft){const u=await K(t.endLabelLeft,t.labelStyle),o=e.insert("g").attr("class","edgeTerminals"),x=o.insert("g").attr("class","inner");c=x.node().appendChild(u);const w=u.getBBox();x.attr("transform","translate("+-w.width/2+", "+-w.height/2+")"),o.node().appendChild(u),M[t.id]||(M[t.id]={}),M[t.id].endLeft=o,tt(c,t.endLabelLeft)}if(t.endLabelRight){const u=await K(t.endLabelRight,t.labelStyle),o=e.insert("g").attr("class","edgeTerminals"),x=o.insert("g").attr("class","inner");c=x.node().appendChild(u);const w=u.getBBox();x.attr("transform","translate("+-w.width/2+", "+-w.height/2+")"),o.node().appendChild(u),M[t.id]||(M[t.id]={}),M[t.id].endRight=o,tt(c,t.endLabelRight)}return l},"insertEdgeLabel");function tt(e,t){R().flowchart.htmlLabels&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}d(tt,"setTerminalWidth");var or=d((e,t)=>{L.debug("Moving label abc88 ",e.id,e.label,Lt[e.id],t);let a=t.updatedPath?t.updatedPath:t.originalPath;const i=R(),{subGraphTitleTotalMargin:l}=fe(i);if(e.label){const s=Lt[e.id];let r=e.x,n=e.y;if(a){const c=$.calcLabelPosition(a);L.debug("Moving label "+e.label+" from (",r,",",n,") to (",c.x,",",c.y,") abc88"),t.updatedPath&&(r=c.x,n=c.y)}s.attr("transform",`translate(${r}, ${n+l/2})`)}if(e.startLabelLeft){const s=M[e.id].startLeft;let r=e.x,n=e.y;if(a){const c=$.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",a);r=c.x,n=c.y}s.attr("transform",`translate(${r}, ${n})`)}if(e.startLabelRight){const s=M[e.id].startRight;let r=e.x,n=e.y;if(a){const c=$.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",a);r=c.x,n=c.y}s.attr("transform",`translate(${r}, ${n})`)}if(e.endLabelLeft){const s=M[e.id].endLeft;let r=e.x,n=e.y;if(a){const c=$.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",a);r=c.x,n=c.y}s.attr("transform",`translate(${r}, ${n})`)}if(e.endLabelRight){const s=M[e.id].endRight;let r=e.x,n=e.y;if(a){const c=$.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",a);r=c.x,n=c.y}s.attr("transform",`translate(${r}, ${n})`)}},"positionEdgeLabel"),hr=d((e,t)=>{const a=e.x,i=e.y,l=Math.abs(t.x-a),s=Math.abs(t.y-i),r=e.width/2,n=e.height/2;return l>=r||s>=n},"outsideNode"),dr=d((e,t,a)=>{L.debug(`intersection calc abc89: + outsidePoint: ${JSON.stringify(t)} + insidePoint : ${JSON.stringify(a)} + node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const i=e.x,l=e.y,s=Math.abs(i-a.x),r=e.width/2;let n=a.xMath.abs(i-t.x)*c){let x=a.y{L.debug("abc88 cutPathAtIntersect",e,t);let a=[],i=e[0],l=!1;return e.forEach(s=>{if(!hr(t,s)&&!l){const r=dr(t,i,s);let n=!1;a.forEach(c=>{n=n||c.x===r.x&&c.y===r.y}),a.some(c=>c.x===r.x&&c.y===r.y)||a.push(r),l=!0}else i=s,l||a.push(s)}),a},"cutPathAtIntersect"),gr=d(function(e,t,a,i,l,s,r){let n=a.points;L.debug("abc88 InsertEdge: edge=",a,"e=",t);let c=!1;const u=s.node(t.v);var o=s.node(t.w);o?.intersect&&u?.intersect&&(n=n.slice(1,a.points.length-1),n.unshift(u.intersect(n[0])),n.push(o.intersect(n[n.length-1]))),a.toCluster&&(L.debug("to cluster abc88",i[a.toCluster]),n=Rt(a.points,i[a.toCluster].node),c=!0),a.fromCluster&&(L.debug("from cluster abc88",i[a.fromCluster]),n=Rt(n.reverse(),i[a.fromCluster].node).reverse(),c=!0);const x=n.filter(y=>!Number.isNaN(y.y));let w=ke;a.curve&&(l==="graph"||l==="flowchart")&&(w=a.curve);const{x:b,y:S}=ue(a),v=Se().x(b).y(S).curve(w);let k;switch(a.thickness){case"normal":k="edge-thickness-normal";break;case"thick":k="edge-thickness-thick";break;case"invisible":k="edge-thickness-thick";break;default:k=""}switch(a.pattern){case"solid":k+=" edge-pattern-solid";break;case"dotted":k+=" edge-pattern-dotted";break;case"dashed":k+=" edge-pattern-dashed";break}const B=e.append("path").attr("d",v(x)).attr("id",a.id).attr("class"," "+k+(a.classes?" "+a.classes:"")).attr("style",a.style);let _="";(R().flowchart.arrowMarkerAbsolute||R().state.arrowMarkerAbsolute)&&(_=pe(!0)),nr(B,a,_,r,l);let D={};return c&&(D.updatedPath=n),D.originalPath=a.points,D},"insertEdge"),ur=d(e=>{const t=new Set;for(const a of e)switch(a){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(a);break}return t},"expandAndDeduplicateDirections"),pr=d((e,t,a)=>{const i=ur(e),l=2,s=t.height+2*a.padding,r=s/l,n=t.width+2*r+a.padding,c=a.padding/2;return i.has("right")&&i.has("left")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:r,y:0},{x:n/2,y:2*c},{x:n-r,y:0},{x:n,y:0},{x:n,y:-s/3},{x:n+2*c,y:-s/2},{x:n,y:-2*s/3},{x:n,y:-s},{x:n-r,y:-s},{x:n/2,y:-s-2*c},{x:r,y:-s},{x:0,y:-s},{x:0,y:-2*s/3},{x:-2*c,y:-s/2},{x:0,y:-s/3}]:i.has("right")&&i.has("left")&&i.has("up")?[{x:r,y:0},{x:n-r,y:0},{x:n,y:-s/2},{x:n-r,y:-s},{x:r,y:-s},{x:0,y:-s/2}]:i.has("right")&&i.has("left")&&i.has("down")?[{x:0,y:0},{x:r,y:-s},{x:n-r,y:-s},{x:n,y:0}]:i.has("right")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:n,y:-r},{x:n,y:-s+r},{x:0,y:-s}]:i.has("left")&&i.has("up")&&i.has("down")?[{x:n,y:0},{x:0,y:-r},{x:0,y:-s+r},{x:n,y:-s}]:i.has("right")&&i.has("left")?[{x:r,y:0},{x:r,y:-c},{x:n-r,y:-c},{x:n-r,y:0},{x:n,y:-s/2},{x:n-r,y:-s},{x:n-r,y:-s+c},{x:r,y:-s+c},{x:r,y:-s},{x:0,y:-s/2}]:i.has("up")&&i.has("down")?[{x:n/2,y:0},{x:0,y:-c},{x:r,y:-c},{x:r,y:-s+c},{x:0,y:-s+c},{x:n/2,y:-s},{x:n,y:-s+c},{x:n-r,y:-s+c},{x:n-r,y:-c},{x:n,y:-c}]:i.has("right")&&i.has("up")?[{x:0,y:0},{x:n,y:-r},{x:0,y:-s}]:i.has("right")&&i.has("down")?[{x:0,y:0},{x:n,y:0},{x:0,y:-s}]:i.has("left")&&i.has("up")?[{x:n,y:0},{x:0,y:-r},{x:n,y:-s}]:i.has("left")&&i.has("down")?[{x:n,y:0},{x:0,y:0},{x:n,y:-s}]:i.has("right")?[{x:r,y:-c},{x:r,y:-c},{x:n-r,y:-c},{x:n-r,y:0},{x:n,y:-s/2},{x:n-r,y:-s},{x:n-r,y:-s+c},{x:r,y:-s+c},{x:r,y:-s+c}]:i.has("left")?[{x:r,y:0},{x:r,y:-c},{x:n-r,y:-c},{x:n-r,y:-s+c},{x:r,y:-s+c},{x:r,y:-s},{x:0,y:-s/2}]:i.has("up")?[{x:r,y:-c},{x:r,y:-s+c},{x:0,y:-s+c},{x:n/2,y:-s},{x:n,y:-s+c},{x:n-r,y:-s+c},{x:n-r,y:-c}]:i.has("down")?[{x:n/2,y:0},{x:0,y:-c},{x:r,y:-c},{x:r,y:-s+c},{x:n-r,y:-s+c},{x:n-r,y:-c},{x:n,y:-c}]:[{x:0,y:0}]},"getArrowPoints");function Gt(e,t){return e.intersect(t)}d(Gt,"intersectNode");var fr=Gt;function Zt(e,t,a,i){var l=e.x,s=e.y,r=l-i.x,n=s-i.y,c=Math.sqrt(t*t*n*n+a*a*r*r),u=Math.abs(t*a*r/c);i.x0}d(St,"sameSign");var yr=Qt,br=$t;function $t(e,t,a){var i=e.x,l=e.y,s=[],r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(S){r=Math.min(r,S.x),n=Math.min(n,S.y)}):(r=Math.min(r,t.x),n=Math.min(n,t.y));for(var c=i-e.width/2-r,u=l-e.height/2-n,o=0;o1&&s.sort(function(S,v){var k=S.x-a.x,B=S.y-a.y,_=Math.sqrt(k*k+B*B),D=v.x-a.x,y=v.y-a.y,g=Math.sqrt(D*D+y*y);return _{var a=e.x,i=e.y,l=t.x-a,s=t.y-i,r=e.width/2,n=e.height/2,c,u;return Math.abs(s)*r>Math.abs(l)*n?(s<0&&(n=-n),c=s===0?0:n*l/s,u=n):(l<0&&(r=-r),c=r,u=l===0?0:r*s/l),{x:a+c,y:i+u}},"intersectRect"),mr=wr,N={node:fr,circle:xr,ellipse:qt,polygon:br,rect:mr},A=d(async(e,t,a,i)=>{const l=R();let s;const r=t.useHtmlLabels||j(l.flowchart.htmlLabels);a?s=a:s="node default";const n=e.insert("g").attr("class",s).attr("id",t.domId||t.id),c=n.insert("g").attr("class","label").attr("style",t.labelStyle);let u;t.labelText===void 0?u="":u=typeof t.labelText=="string"?t.labelText:t.labelText[0];const o=c.node();let x;t.labelType==="markdown"?x=Wt(c,yt(xt(u),l),{useHtmlLabels:r,width:t.width||l.flowchart.wrappingWidth,classes:"markdown-node-label"},l):x=o.appendChild(await K(yt(xt(u),l),t.labelStyle,!1,i));let w=x.getBBox();const b=t.padding/2;if(j(l.flowchart.htmlLabels)){const S=x.children[0],v=O(x),k=S.getElementsByTagName("img");if(k){const B=u.replace(/]*>/g,"").trim()==="";await Promise.all([...k].map(_=>new Promise(D=>{function y(){if(_.style.display="flex",_.style.flexDirection="column",B){const g=l.fontSize?l.fontSize:window.getComputedStyle(document.body).fontSize,m=parseInt(g,10)*5+"px";_.style.minWidth=m,_.style.maxWidth=m}else _.style.width="100%";D(_)}d(y,"setupImage"),setTimeout(()=>{_.complete&&y()}),_.addEventListener("error",y),_.addEventListener("load",y)})))}w=S.getBoundingClientRect(),v.attr("width",w.width),v.attr("height",w.height)}return r?c.attr("transform","translate("+-w.width/2+", "+-w.height/2+")"):c.attr("transform","translate(0, "+-w.height/2+")"),t.centerLabel&&c.attr("transform","translate("+-w.width/2+", "+-w.height/2+")"),c.insert("rect",":first-child"),{shapeSvg:n,bbox:w,halfPadding:b,label:c}},"labelHelper"),T=d((e,t)=>{const a=t.node().getBBox();e.width=a.width,e.height=a.height},"updateNodeBounds");function U(e,t,a,i){return e.insert("polygon",":first-child").attr("points",i.map(function(l){return l.x+","+l.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+a/2+")")}d(U,"insertPolygonShape");var Lr=d(async(e,t)=>{t.useHtmlLabels||R().flowchart.htmlLabels||(t.centerLabel=!0);const{shapeSvg:i,bbox:l,halfPadding:s}=await A(e,t,"node "+t.classes,!0);L.info("Classes = ",t.classes);const r=i.insert("rect",":first-child");return r.attr("rx",t.rx).attr("ry",t.ry).attr("x",-l.width/2-s).attr("y",-l.height/2-s).attr("width",l.width+t.padding).attr("height",l.height+t.padding),T(t,r),t.intersect=function(n){return N.rect(t,n)},i},"note"),Sr=Lr,zt=d(e=>e?" "+e:"","formatClass"),Y=d((e,t)=>`${t||"node default"}${zt(e.classes)} ${zt(e.class)}`,"getClassesFromNode"),At=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await A(e,t,Y(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=l+s,n=[{x:r/2,y:0},{x:r,y:-r/2},{x:r/2,y:-r},{x:0,y:-r/2}];L.info("Question main (Circle)");const c=U(a,r,r,n);return c.attr("style",t.style),T(t,c),t.intersect=function(u){return L.warn("Intersect called"),N.polygon(t,n,u)},a},"question"),kr=d((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=28,l=[{x:0,y:i/2},{x:i/2,y:0},{x:0,y:-i/2},{x:-i/2,y:0}];return a.insert("polygon",":first-child").attr("points",l.map(function(r){return r.x+","+r.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(r){return N.circle(t,14,r)},a},"choice"),vr=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await A(e,t,Y(t,void 0),!0),l=4,s=i.height+t.padding,r=s/l,n=i.width+2*r+t.padding,c=[{x:r,y:0},{x:n-r,y:0},{x:n,y:-s/2},{x:n-r,y:-s},{x:r,y:-s},{x:0,y:-s/2}],u=U(a,n,s,c);return u.attr("style",t.style),T(t,u),t.intersect=function(o){return N.polygon(t,c,o)},a},"hexagon"),Er=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await A(e,t,void 0,!0),l=2,s=i.height+2*t.padding,r=s/l,n=i.width+2*r+t.padding,c=pr(t.directions,i,t),u=U(a,n,s,c);return u.attr("style",t.style),T(t,u),t.intersect=function(o){return N.polygon(t,c,o)},a},"block_arrow"),_r=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await A(e,t,Y(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:-s/2,y:0},{x:l,y:0},{x:l,y:-s},{x:-s/2,y:-s},{x:0,y:-s/2}];return U(a,l,s,r).attr("style",t.style),t.width=l+s,t.height=s,t.intersect=function(c){return N.polygon(t,r,c)},a},"rect_left_inv_arrow"),Dr=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await A(e,t,Y(t),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:-2*s/6,y:0},{x:l-s/6,y:0},{x:l+2*s/6,y:-s},{x:s/6,y:-s}],n=U(a,l,s,r);return n.attr("style",t.style),T(t,n),t.intersect=function(c){return N.polygon(t,r,c)},a},"lean_right"),Nr=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await A(e,t,Y(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:2*s/6,y:0},{x:l+s/6,y:0},{x:l-2*s/6,y:-s},{x:-s/6,y:-s}],n=U(a,l,s,r);return n.attr("style",t.style),T(t,n),t.intersect=function(c){return N.polygon(t,r,c)},a},"lean_left"),Tr=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await A(e,t,Y(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:-2*s/6,y:0},{x:l+2*s/6,y:0},{x:l-s/6,y:-s},{x:s/6,y:-s}],n=U(a,l,s,r);return n.attr("style",t.style),T(t,n),t.intersect=function(c){return N.polygon(t,r,c)},a},"trapezoid"),Br=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await A(e,t,Y(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:s/6,y:0},{x:l-s/6,y:0},{x:l+2*s/6,y:-s},{x:-2*s/6,y:-s}],n=U(a,l,s,r);return n.attr("style",t.style),T(t,n),t.intersect=function(c){return N.polygon(t,r,c)},a},"inv_trapezoid"),Cr=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await A(e,t,Y(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:0,y:0},{x:l+s/2,y:0},{x:l,y:-s/2},{x:l+s/2,y:-s},{x:0,y:-s}],n=U(a,l,s,r);return n.attr("style",t.style),T(t,n),t.intersect=function(c){return N.polygon(t,r,c)},a},"rect_right_inv_arrow"),Ir=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await A(e,t,Y(t,void 0),!0),l=i.width+t.padding,s=l/2,r=s/(2.5+l/50),n=i.height+r+t.padding,c="M 0,"+r+" a "+s+","+r+" 0,0,0 "+l+" 0 a "+s+","+r+" 0,0,0 "+-l+" 0 l 0,"+n+" a "+s+","+r+" 0,0,0 "+l+" 0 l 0,"+-n,u=a.attr("label-offset-y",r).insert("path",":first-child").attr("style",t.style).attr("d",c).attr("transform","translate("+-l/2+","+-(n/2+r)+")");return T(t,u),t.intersect=function(o){const x=N.rect(t,o),w=x.x-t.x;if(s!=0&&(Math.abs(w)t.height/2-r)){let b=r*r*(1-w*w/(s*s));b!=0&&(b=Math.sqrt(b)),b=r-b,o.y-t.y>0&&(b=-b),x.y+=b}return x},a},"cylinder"),Or=d(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:l}=await A(e,t,"node "+t.classes+" "+t.class,!0),s=a.insert("rect",":first-child"),r=t.positioned?t.width:i.width+t.padding,n=t.positioned?t.height:i.height+t.padding,c=t.positioned?-r/2:-i.width/2-l,u=t.positioned?-n/2:-i.height/2-l;if(s.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",c).attr("y",u).attr("width",r).attr("height",n),t.props){const o=new Set(Object.keys(t.props));t.props.borders&&(ht(s,t.props.borders,r,n),o.delete("borders")),o.forEach(x=>{L.warn(`Unknown node property ${x}`)})}return T(t,s),t.intersect=function(o){return N.rect(t,o)},a},"rect"),Rr=d(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:l}=await A(e,t,"node "+t.classes,!0),s=a.insert("rect",":first-child"),r=t.positioned?t.width:i.width+t.padding,n=t.positioned?t.height:i.height+t.padding,c=t.positioned?-r/2:-i.width/2-l,u=t.positioned?-n/2:-i.height/2-l;if(s.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",c).attr("y",u).attr("width",r).attr("height",n),t.props){const o=new Set(Object.keys(t.props));t.props.borders&&(ht(s,t.props.borders,r,n),o.delete("borders")),o.forEach(x=>{L.warn(`Unknown node property ${x}`)})}return T(t,s),t.intersect=function(o){return N.rect(t,o)},a},"composite"),zr=d(async(e,t)=>{const{shapeSvg:a}=await A(e,t,"label",!0);L.trace("Classes = ",t.class);const i=a.insert("rect",":first-child"),l=0,s=0;if(i.attr("width",l).attr("height",s),a.attr("class","label edgeLabel"),t.props){const r=new Set(Object.keys(t.props));t.props.borders&&(ht(i,t.props.borders,l,s),r.delete("borders")),r.forEach(n=>{L.warn(`Unknown node property ${n}`)})}return T(t,i),t.intersect=function(r){return N.rect(t,r)},a},"labelRect");function ht(e,t,a,i){const l=[],s=d(n=>{l.push(n,0)},"addBorder"),r=d(n=>{l.push(0,n)},"skipBorder");t.includes("t")?(L.debug("add top border"),s(a)):r(a),t.includes("r")?(L.debug("add right border"),s(i)):r(i),t.includes("b")?(L.debug("add bottom border"),s(a)):r(a),t.includes("l")?(L.debug("add left border"),s(i)):r(i),e.attr("stroke-dasharray",l.join(" "))}d(ht,"applyNodePropertyBorders");var Ar=d(async(e,t)=>{let a;t.classes?a="node "+t.classes:a="node default";const i=e.insert("g").attr("class",a).attr("id",t.domId||t.id),l=i.insert("rect",":first-child"),s=i.insert("line"),r=i.insert("g").attr("class","label"),n=t.labelText.flat?t.labelText.flat():t.labelText;let c="";typeof n=="object"?c=n[0]:c=n,L.info("Label text abc79",c,n,typeof n=="object");const u=r.node().appendChild(await K(c,t.labelStyle,!0,!0));let o={width:0,height:0};if(j(R().flowchart.htmlLabels)){const v=u.children[0],k=O(u);o=v.getBoundingClientRect(),k.attr("width",o.width),k.attr("height",o.height)}L.info("Text 2",n);const x=n.slice(1,n.length);let w=u.getBBox();const b=r.node().appendChild(await K(x.join?x.join("
          "):x,t.labelStyle,!0,!0));if(j(R().flowchart.htmlLabels)){const v=b.children[0],k=O(b);o=v.getBoundingClientRect(),k.attr("width",o.width),k.attr("height",o.height)}const S=t.padding/2;return O(b).attr("transform","translate( "+(o.width>w.width?0:(w.width-o.width)/2)+", "+(w.height+S+5)+")"),O(u).attr("transform","translate( "+(o.width{const{shapeSvg:a,bbox:i}=await A(e,t,Y(t,void 0),!0),l=i.height+t.padding,s=i.width+l/4+t.padding,r=a.insert("rect",":first-child").attr("style",t.style).attr("rx",l/2).attr("ry",l/2).attr("x",-s/2).attr("y",-l/2).attr("width",s).attr("height",l);return T(t,r),t.intersect=function(n){return N.rect(t,n)},a},"stadium"),Fr=d(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:l}=await A(e,t,Y(t,void 0),!0),s=a.insert("circle",":first-child");return s.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+l).attr("width",i.width+t.padding).attr("height",i.height+t.padding),L.info("Circle main"),T(t,s),t.intersect=function(r){return L.info("Circle intersect",t,i.width/2+l,r),N.circle(t,i.width/2+l,r)},a},"circle"),Wr=d(async(e,t)=>{const{shapeSvg:a,bbox:i,halfPadding:l}=await A(e,t,Y(t,void 0),!0),s=5,r=a.insert("g",":first-child"),n=r.insert("circle"),c=r.insert("circle");return r.attr("class",t.class),n.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+l+s).attr("width",i.width+t.padding+s*2).attr("height",i.height+t.padding+s*2),c.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+l).attr("width",i.width+t.padding).attr("height",i.height+t.padding),L.info("DoubleCircle main"),T(t,n),t.intersect=function(u){return L.info("DoubleCircle intersect",t,i.width/2+l+s,u),N.circle(t,i.width/2+l+s,u)},a},"doublecircle"),Pr=d(async(e,t)=>{const{shapeSvg:a,bbox:i}=await A(e,t,Y(t,void 0),!0),l=i.width+t.padding,s=i.height+t.padding,r=[{x:0,y:0},{x:l,y:0},{x:l,y:-s},{x:0,y:-s},{x:0,y:0},{x:-8,y:0},{x:l+8,y:0},{x:l+8,y:-s},{x:-8,y:-s},{x:-8,y:0}],n=U(a,l,s,r);return n.attr("style",t.style),T(t,n),t.intersect=function(c){return N.polygon(t,r,c)},a},"subroutine"),Yr=d((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=a.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),T(t,i),t.intersect=function(l){return N.circle(t,7,l)},a},"start"),Mt=d((e,t,a)=>{const i=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let l=70,s=10;a==="LR"&&(l=10,s=70);const r=i.append("rect").attr("x",-1*l/2).attr("y",-1*s/2).attr("width",l).attr("height",s).attr("class","fork-join");return T(t,r),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(n){return N.rect(t,n)},i},"forkJoin"),Hr=d((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=a.insert("circle",":first-child"),l=a.insert("circle",":first-child");return l.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),i.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),T(t,l),t.intersect=function(s){return N.circle(t,7,s)},a},"end"),Kr=d(async(e,t)=>{const a=t.padding/2,i=4,l=8;let s;t.classes?s="node "+t.classes:s="node default";const r=e.insert("g").attr("class",s).attr("id",t.domId||t.id),n=r.insert("rect",":first-child"),c=r.insert("line"),u=r.insert("line");let o=0,x=i;const w=r.insert("g").attr("class","label");let b=0;const S=t.classData.annotations?.[0],v=t.classData.annotations[0]?"«"+t.classData.annotations[0]+"»":"",k=w.node().appendChild(await K(v,t.labelStyle,!0,!0));let B=k.getBBox();if(j(R().flowchart.htmlLabels)){const E=k.children[0],h=O(k);B=E.getBoundingClientRect(),h.attr("width",B.width),h.attr("height",B.height)}t.classData.annotations[0]&&(x+=B.height+i,o+=B.width);let _=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(R().flowchart.htmlLabels?_+="<"+t.classData.type+">":_+="<"+t.classData.type+">");const D=w.node().appendChild(await K(_,t.labelStyle,!0,!0));O(D).attr("class","classTitle");let y=D.getBBox();if(j(R().flowchart.htmlLabels)){const E=D.children[0],h=O(D);y=E.getBoundingClientRect(),h.attr("width",y.width),h.attr("height",y.height)}x+=y.height+i,y.width>o&&(o=y.width);const g=[];t.classData.members.forEach(async E=>{const h=E.getDisplayDetails();let W=h.displayText;R().flowchart.htmlLabels&&(W=W.replace(//g,">"));const p=w.node().appendChild(await K(W,h.cssStyle?h.cssStyle:t.labelStyle,!0,!0));let I=p.getBBox();if(j(R().flowchart.htmlLabels)){const Z=p.children[0],V=O(p);I=Z.getBoundingClientRect(),V.attr("width",I.width),V.attr("height",I.height)}I.width>o&&(o=I.width),x+=I.height+i,g.push(p)}),x+=l;const f=[];if(t.classData.methods.forEach(async E=>{const h=E.getDisplayDetails();let W=h.displayText;R().flowchart.htmlLabels&&(W=W.replace(//g,">"));const p=w.node().appendChild(await K(W,h.cssStyle?h.cssStyle:t.labelStyle,!0,!0));let I=p.getBBox();if(j(R().flowchart.htmlLabels)){const Z=p.children[0],V=O(p);I=Z.getBoundingClientRect(),V.attr("width",I.width),V.attr("height",I.height)}I.width>o&&(o=I.width),x+=I.height+i,f.push(p)}),x+=l,S){let E=(o-B.width)/2;O(k).attr("transform","translate( "+(-1*o/2+E)+", "+-1*x/2+")"),b=B.height+i}let m=(o-y.width)/2;return O(D).attr("transform","translate( "+(-1*o/2+m)+", "+(-1*x/2+b)+")"),b+=y.height+i,c.attr("class","divider").attr("x1",-o/2-a).attr("x2",o/2+a).attr("y1",-x/2-a+l+b).attr("y2",-x/2-a+l+b),b+=l,g.forEach(E=>{O(E).attr("transform","translate( "+-o/2+", "+(-1*x/2+b+l/2)+")");const h=E?.getBBox();b+=(h?.height??0)+i}),b+=l,u.attr("class","divider").attr("x1",-o/2-a).attr("x2",o/2+a).attr("y1",-x/2-a+l+b).attr("y2",-x/2-a+l+b),b+=l,f.forEach(E=>{O(E).attr("transform","translate( "+-o/2+", "+(-1*x/2+b)+")");const h=E?.getBBox();b+=(h?.height??0)+i}),n.attr("style",t.style).attr("class","outer title-state").attr("x",-o/2-a).attr("y",-(x/2)-a).attr("width",o+t.padding).attr("height",x+t.padding),T(t,n),t.intersect=function(E){return N.rect(t,E)},r},"class_box"),Ft={rhombus:At,composite:Rr,question:At,rect:Or,labelRect:zr,rectWithTitle:Ar,choice:kr,circle:Fr,doublecircle:Wr,stadium:Mr,hexagon:vr,block_arrow:Er,rect_left_inv_arrow:_r,lean_right:Dr,lean_left:Nr,trapezoid:Tr,inv_trapezoid:Br,rect_right_inv_arrow:Cr,cylinder:Ir,start:Yr,end:Hr,note:Sr,subroutine:Pr,fork:Mt,join:Mt,class_box:Kr},lt={},te=d(async(e,t,a)=>{let i,l;if(t.link){let s;R().securityLevel==="sandbox"?s="_top":t.linkTarget&&(s=t.linkTarget||"_blank"),i=e.insert("svg:a").attr("xlink:href",t.link).attr("target",s),l=await Ft[t.shape](i,t,a)}else l=await Ft[t.shape](e,t,a),i=l;return t.tooltip&&l.attr("title",t.tooltip),t.class&&l.attr("class","node default "+t.class),lt[t.id]=i,t.haveCallback&<[t.id].attr("class",lt[t.id].attr("class")+" clickable"),i},"insertNode"),Xr=d(e=>{const t=lt[e.id];L.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const a=8,i=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+i-e.width/2)+", "+(e.y-e.height/2-a)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),i},"positionNode");function Dt(e,t,a=!1){const i=e;let l="default";(i?.classes?.length||0)>0&&(l=(i?.classes??[]).join(" ")),l=l+" flowchart-label";let s=0,r="",n;switch(i.type){case"round":s=5,r="rect";break;case"composite":s=0,r="composite",n=0;break;case"square":r="rect";break;case"diamond":r="question";break;case"hexagon":r="hexagon";break;case"block_arrow":r="block_arrow";break;case"odd":r="rect_left_inv_arrow";break;case"lean_right":r="lean_right";break;case"lean_left":r="lean_left";break;case"trapezoid":r="trapezoid";break;case"inv_trapezoid":r="inv_trapezoid";break;case"rect_left_inv_arrow":r="rect_left_inv_arrow";break;case"circle":r="circle";break;case"ellipse":r="ellipse";break;case"stadium":r="stadium";break;case"subroutine":r="subroutine";break;case"cylinder":r="cylinder";break;case"group":r="rect";break;case"doublecircle":r="doublecircle";break;default:r="rect"}const c=be(i?.styles??[]),u=i.label,o=i.size??{width:0,height:0,x:0,y:0};return{labelStyle:c.labelStyle,shape:r,labelText:u,rx:s,ry:s,class:l,style:c.style,id:i.id,directions:i.directions,width:o.width,height:o.height,x:o.x,y:o.y,positioned:a,intersect:void 0,type:i.type,padding:n??rt()?.block?.padding??0}}d(Dt,"getNodeFromBlock");async function ee(e,t,a){const i=Dt(t,a,!1);if(i.type==="group")return;const l=rt(),s=await te(e,i,{config:l}),r=s.node().getBBox(),n=a.getBlock(i.id);n.size={width:r.width,height:r.height,x:0,y:0,node:s},a.setBlock(n),s.remove()}d(ee,"calculateBlockSize");async function re(e,t,a){const i=Dt(t,a,!0);if(a.getBlock(i.id).type!=="space"){const s=rt();await te(e,i,{config:s}),t.intersect=i?.intersect,Xr(i)}}d(re,"insertBlockPositioned");async function dt(e,t,a,i){for(const l of t)await i(e,l,a),l.children&&await dt(e,l.children,a,i)}d(dt,"performOperations");async function ae(e,t,a){await dt(e,t,a,ee)}d(ae,"calculateBlockSizes");async function se(e,t,a){await dt(e,t,a,re)}d(se,"insertBlocks");async function ie(e,t,a,i,l){const s=new me({multigraph:!0,compound:!0});s.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const r of a)r.size&&s.setNode(r.id,{width:r.size.width,height:r.size.height,intersect:r.intersect});for(const r of t)if(r.start&&r.end){const n=i.getBlock(r.start),c=i.getBlock(r.end);if(n?.size&&c?.size){const u=n.size,o=c.size,x=[{x:u.x,y:u.y},{x:u.x+(o.x-u.x)/2,y:u.y+(o.y-u.y)/2},{x:o.x,y:o.y}];gr(e,{v:r.start,w:r.end,name:r.id},{...r,arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:x,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"},void 0,"block",s,l),r.label&&(await cr(e,{...r,label:r.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:x,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"}),or({...r,x:x[1].x,y:x[1].y},{originalPath:x}))}}}d(ie,"insertEdges");var Ur=d(function(e,t){return t.db.getClasses()},"getClasses"),jr=d(async function(e,t,a,i){const{securityLevel:l,block:s}=rt(),r=i.db;let n;l==="sandbox"&&(n=O("#i"+t));const c=l==="sandbox"?O(n.nodes()[0].contentDocument.body):O("body"),u=l==="sandbox"?c.select(`[id="${t}"]`):O(`[id="${t}"]`);ar(u,["point","circle","cross"],i.type,t);const x=r.getBlocks(),w=r.getBlocksFlat(),b=r.getEdges(),S=u.insert("g").attr("class","block");await ae(S,x,r);const v=jt(r);if(await se(S,x,r),await ie(S,b,w,r,t),v){const k=v,B=Math.max(1,Math.round(.125*(k.width/k.height))),_=k.height+B+10,D=k.width+10,{useMaxWidth:y}=s;he(u,_,D,!!y),L.debug("Here Bounds",v,k),u.attr("viewBox",`${k.x-5} ${k.y-5} ${k.width+10} ${k.height+10}`)}},"draw"),Vr={draw:jr,getClasses:Ur},ia={parser:ve,db:Ke,renderer:Vr,styles:Ue};export{ia as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bone-z620UXj2.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bone-z620UXj2.js new file mode 100644 index 0000000000000000000000000000000000000000..36ec78e72e4b420bc563c258f563c2444494cdcf --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bone-z620UXj2.js @@ -0,0 +1 @@ +import{an as _,M as l,c as p,ao as u,V as h,ap as f}from"./index-CDrXokXW.js";class r extends _{get _matrix(){return this._compose(),this._localMatrix}set _matrix(t){t.updateFlag===this._localMatrix.updateFlag&&!this._needToCompose||(this._needToCompose=!1,this._localMatrix.copyFrom(t),this._markAsDirtyAndDecompose())}constructor(t,i,e=null,s=null,o=null,n=null,a=null){super(t,i.getScene(),!1),this.name=t,this.children=[],this.animations=[],this._index=null,this._scalingDeterminant=1,this._needToDecompose=!0,this._needToCompose=!1,this._linkedTransformNode=null,this._waitingTransformNodeId=null,this._skeleton=i,this._localMatrix=s?.clone()??l.Identity(),this._restMatrix=o??this._localMatrix.clone(),this._bindMatrix=n??this._localMatrix.clone(),this._index=a,this._absoluteMatrix=new l,this._absoluteBindMatrix=new l,this._absoluteInverseBindMatrix=new l,this._finalMatrix=new l,i.bones.push(this),this.setParent(e,!1),this._updateAbsoluteBindMatrices()}getClassName(){return"Bone"}getSkeleton(){return this._skeleton}get parent(){return this._parentNode}getParent(){return this.parent}getChildren(){return this.children}getIndex(){return this._index===null?this.getSkeleton().bones.indexOf(this):this._index}set parent(t){this.setParent(t)}setParent(t,i=!0){if(this.parent!==t){if(this.parent){const e=this.parent.children.indexOf(this);e!==-1&&this.parent.children.splice(e,1)}this._parentNode=t,this.parent&&this.parent.children.push(this),i&&this._updateAbsoluteBindMatrices(),this.markAsDirty()}}getLocalMatrix(){return this._compose(),this._localMatrix}getBindMatrix(){return this._bindMatrix}getBaseMatrix(){return this.getBindMatrix()}getRestMatrix(){return this._restMatrix}getRestPose(){return this.getRestMatrix()}setRestMatrix(t){this._restMatrix.copyFrom(t)}setRestPose(t){this.setRestMatrix(t)}getBindPose(){return this.getBindMatrix()}setBindMatrix(t){this.updateMatrix(t)}setBindPose(t){this.setBindMatrix(t)}getFinalMatrix(){return this._finalMatrix}getWorldMatrix(){return this.getFinalMatrix()}returnToRest(){if(this._linkedTransformNode){const t=p.Vector3[0],i=p.Quaternion[0],e=p.Vector3[1];this.getRestMatrix().decompose(t,i,e),this._linkedTransformNode.position.copyFrom(e),this._linkedTransformNode.rotationQuaternion=this._linkedTransformNode.rotationQuaternion??u.Identity(),this._linkedTransformNode.rotationQuaternion.copyFrom(i),this._linkedTransformNode.scaling.copyFrom(t)}else this._matrix=this._restMatrix}getAbsoluteInverseBindMatrix(){return this._absoluteInverseBindMatrix}getInvertedAbsoluteTransform(){return this.getAbsoluteInverseBindMatrix()}getAbsoluteMatrix(){return this._skeleton.computeAbsoluteMatrices(),this._absoluteMatrix}getAbsoluteTransform(){return this.getAbsoluteMatrix()}linkTransformNode(t){this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode--,this._linkedTransformNode=t,this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode++}getTransformNode(){return this._linkedTransformNode}get position(){return this._decompose(),this._localPosition}set position(t){this._decompose(),this._localPosition.copyFrom(t),this._markAsDirtyAndCompose()}get rotation(){return this.getRotation()}set rotation(t){this.setRotation(t)}get rotationQuaternion(){return this._decompose(),this._localRotation}set rotationQuaternion(t){this.setRotationQuaternion(t)}get scaling(){return this.getScale()}set scaling(t){this.setScale(t)}get animationPropertiesOverride(){return this._skeleton.animationPropertiesOverride}_decompose(){this._needToDecompose&&(this._needToDecompose=!1,this._localScaling||(this._localScaling=h.Zero(),this._localRotation=u.Zero(),this._localPosition=h.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))}_compose(){if(this._needToCompose){if(!this._localScaling){this._needToCompose=!1;return}this._needToCompose=!1,l.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix)}}updateMatrix(t,i=!0,e=!0){this._bindMatrix.copyFrom(t),i&&this._updateAbsoluteBindMatrices(),e?this._matrix=t:this.markAsDirty()}_updateAbsoluteBindMatrices(t,i=!0){if(t||(t=this._bindMatrix),this.parent?t.multiplyToRef(this.parent._absoluteBindMatrix,this._absoluteBindMatrix):this._absoluteBindMatrix.copyFrom(t),this._absoluteBindMatrix.invertToRef(this._absoluteInverseBindMatrix),i)for(let e=0;e0 +attribute matricesIndices : vec4f;attribute matricesWeights : vec4f; +#if NUM_BONE_INFLUENCERS>4 +attribute matricesIndicesExtra : vec4f;attribute matricesWeightsExtra : vec4f; +#endif +#ifndef BAKED_VERTEX_ANIMATION_TEXTURE +#ifdef BONETEXTURE +var boneSampler : texture_2d;uniform boneTextureWidth : f32; +#else +uniform mBones : array; +#endif +#ifdef BONES_VELOCITY_ENABLED +uniform mPreviousBones : array; +#endif +#ifdef BONETEXTURE +fn readMatrixFromRawSampler(smp : texture_2d,index : f32)->mat4x4f +{let offset=i32(index) *4; +let m0=textureLoad(smp,vec2(offset+0,0),0);let m1=textureLoad(smp,vec2(offset+1,0),0);let m2=textureLoad(smp,vec2(offset+2,0),0);let m3=textureLoad(smp,vec2(offset+3,0),0);return mat4x4f(m0,m1,m2,m3);} +#endif +#endif +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=r); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bonesVertex-bl6LLSA1.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bonesVertex-bl6LLSA1.js new file mode 100644 index 0000000000000000000000000000000000000000..0db1fba179f5988e0e4af02492ec801fcbc1dc3c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bonesVertex-bl6LLSA1.js @@ -0,0 +1,54 @@ +import{S as e}from"./index-CDrXokXW.js";const n="bonesVertex",i=`#ifndef BAKED_VERTEX_ANIMATION_TEXTURE +#if NUM_BONE_INFLUENCERS>0 +var influence : mat4x4; +#ifdef BONETEXTURE +influence=readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[0])*vertexInputs.matricesWeights[0]; +#if NUM_BONE_INFLUENCERS>1 +influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[1])*vertexInputs.matricesWeights[1]; +#endif +#if NUM_BONE_INFLUENCERS>2 +influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[2])*vertexInputs.matricesWeights[2]; +#endif +#if NUM_BONE_INFLUENCERS>3 +influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[3])*vertexInputs.matricesWeights[3]; +#endif +#if NUM_BONE_INFLUENCERS>4 +influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[0])*vertexInputs.matricesWeightsExtra[0]; +#endif +#if NUM_BONE_INFLUENCERS>5 +influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[1])*vertexInputs.matricesWeightsExtra[1]; +#endif +#if NUM_BONE_INFLUENCERS>6 +influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[2])*vertexInputs.matricesWeightsExtra[2]; +#endif +#if NUM_BONE_INFLUENCERS>7 +influence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[3])*vertexInputs.matricesWeightsExtra[3]; +#endif +#else +influence=uniforms.mBones[i32(vertexInputs.matricesIndices[0])]*vertexInputs.matricesWeights[0]; +#if NUM_BONE_INFLUENCERS>1 +influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndices[1])]*vertexInputs.matricesWeights[1]; +#endif +#if NUM_BONE_INFLUENCERS>2 +influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndices[2])]*vertexInputs.matricesWeights[2]; +#endif +#if NUM_BONE_INFLUENCERS>3 +influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndices[3])]*vertexInputs.matricesWeights[3]; +#endif +#if NUM_BONE_INFLUENCERS>4 +influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndicesExtra[0])]*vertexInputs.matricesWeightsExtra[0]; +#endif +#if NUM_BONE_INFLUENCERS>5 +influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndicesExtra[1])]*vertexInputs.matricesWeightsExtra[1]; +#endif +#if NUM_BONE_INFLUENCERS>6 +influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndicesExtra[2])]*vertexInputs.matricesWeightsExtra[2]; +#endif +#if NUM_BONE_INFLUENCERS>7 +influence=influence+uniforms.mBones[i32(vertexInputs.matricesIndicesExtra[3])]*vertexInputs.matricesWeightsExtra[3]; +#endif +#endif +finalWorld=finalWorld*influence; +#endif +#endif +`;e.IncludesShadersStoreWGSL[n]||(e.IncludesShadersStoreWGSL[n]=i); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/browserAll-CO8QIzLb.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/browserAll-CO8QIzLb.js new file mode 100644 index 0000000000000000000000000000000000000000..515f18e1494c9516f8f61ddb7b80b02365f2a62b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/browserAll-CO8QIzLb.js @@ -0,0 +1,14 @@ +import{T as M,U as Z,P as f,r as te,E as y,a as ie,w as g,e as P,C as V}from"./Index-cYuhm-BK.js";import"./webworkerAll-Cko47uxa.js";import"./i18n-Dnhn5Rxr.js";import"./index-DWyDLubb.js";import"./misc-vsnLZ-Y1.js";import"./utils.svelte-CCyS_0CY.js";import"./clone-BkeCM4Nl.js";import"./ImagePreview-B2ps5aDR.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./snippet-BWgYNF9D.js";import"./BlockLabel-CZd21Hkw.js";import"./DownloadLink-TGTaev7f.js";import"./Empty-BIB2W5at.js";import"./ShareButton-wCSP7LoP.js";import"./Download-Di2PsS6O.js";import"./Image-DrPceByI.js";import"./IconButtonWrapper-D0s9l4wW.js";import"./FullscreenButton-sCrcy_OJ.js";import"./Maximize-QH9NIRWs.js";import"./Image-CeW7PJs4.js";/* empty css *//* empty css */import"./Block-J4oodUWp.js";import"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";import"./Clear-BF6j078A.js";/* empty css */import"./Upload-HitvyI7k.js";import"./actions-CLThs9VH.js";/* empty css */import"./Webcam-DQkeURjU.js";import"./DropdownArrow-BOSZEGSp.js";import"./Square-CcB54dqq.js";import"./Spinner-Dhvehhrf.js";import"./StreamingBar-Cb4g-rUI.js";import"./window-Uydxco8n.js";import"./tinycolor-BQBUvzv5.js";import"./Plus-CDtuRS4x.js";import"./input-DrerMDOL.js";import"./Check-DUAHzS2-.js";import"./event-modifiers-CdEA5IGF.js";import"./ArrowUp-D69HGcoh.js";import"./Trash-D2U3jAj_.js";import"./Undo-C2-jWGVL.js";import"./colorToUniform-3MxHuUz8.js";class q{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const t=this._canvas.getBoundingClientRect(),i=this._canvas.width,n=this._canvas.height,s=t.width/i*this._renderer.resolution,o=t.height/n*this._renderer.resolution,r=t.left,l=t.top,d=`translate(${r}px, ${l}px) scale(${s}, ${o})`;d!==this._lastTransform&&(this._domElement.style.transform=d,this._lastTransform=d)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const i=this.canvas.width,n=this.canvas.height,s=t.contentRect.width/i*this._renderer.resolution,o=t.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==s||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=s,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||M.shared.add(this.updateTranslation,this,Z.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&M.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class w{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=w.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new f,this.page=new f,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var I=/iPhone/i,B=/iPod/i,C=/iPad/i,U=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,R=/Android/i,b=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,O=/Silk/i,v=/Windows Phone/i,X=/\bWindows(?:.+)ARM\b/i,Y=/BlackBerry/i,H=/BB10/i,F=/Opera Mini/i,N=/\b(CriOS|Chrome)(?:.+)Mobile/i,$=/Mobile(?:.+)Firefox\b/i,K=function(a){return typeof a<"u"&&a.platform==="MacIntel"&&typeof a.maxTouchPoints=="number"&&a.maxTouchPoints>1&&typeof MSStream>"u"};function ne(a){return function(e){return e.test(a)}}function G(a){var e={userAgent:"",platform:"",maxTouchPoints:0};!a&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof a=="string"?e.userAgent=a:a&&a.userAgent&&(e={userAgent:a.userAgent,platform:a.platform,maxTouchPoints:a.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=ne(t),s={apple:{phone:n(I)&&!n(v),ipod:n(B),tablet:!n(I)&&(n(C)||K(e))&&!n(v),universal:n(U),device:(n(I)||n(B)||n(C)||n(U)||K(e))&&!n(v)},amazon:{phone:n(b),tablet:!n(b)&&n(O),device:n(b)||n(O)},android:{phone:!n(v)&&n(b)||!n(v)&&n(k),tablet:!n(v)&&!n(b)&&!n(k)&&(n(O)||n(R)),device:!n(v)&&(n(b)||n(O)||n(k)||n(R))||n(/\bokhttp\b/i)},windows:{phone:n(v),tablet:n(X),device:n(v)||n(X)},other:{blackberry:n(Y),blackberry10:n(H),opera:n(F),firefox:n($),chrome:n(N),device:n(Y)||n(H)||n(F)||n($)||n(N)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const se=G.default??G,oe=se(globalThis.navigator),re=9,W=100,ae=0,le=0,j=2,z=1,he=-1e3,ce=-1e3,de=2,L=class J{constructor(e,t=oe){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${z}px`,e.style.height=`${z}px`,e.style.position="absolute",e.style.top=`${he}px`,e.style.left=`${ce}px`,e.style.zIndex=de.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${ae}px`,this._div.style.left=`${le}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=j.toString(),this._canvasObserver=new q({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(const e in this._pools)this._pools[e].forEach(i=>{i.parentNode&&i.parentNode.removeChild(i)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i=0;i--){const n=this._children[i];t.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,te(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i title : ${e.title}
          tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let i=this._getPool(e.accessibleType).pop();i?(i.innerHTML="",i.removeAttribute("title"),i.removeAttribute("aria-label"),i.tabIndex=0):(e.accessibleType==="button"?i=document.createElement("button"):(i=document.createElement(e.accessibleType),i.style.cssText=` + color: transparent; + pointer-events: none; + padding: 0; + margin: 0; + border: 0; + outline: 0; + background: transparent; + box-sizing: border-box; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + `,e.accessibleText&&(i.innerText=e.accessibleText)),i.style.width=`${W}px`,i.style.height=`${W}px`,i.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",i.style.position="absolute",i.style.zIndex=j.toString(),i.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?i.setAttribute("aria-live","off"):i.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?i.setAttribute("aria-relevant","additions"):i.setAttribute("aria-relevant","text"),i.addEventListener("click",this._onClick.bind(this)),i.addEventListener("focus",this._onFocus.bind(this)),i.addEventListener("focusout",this._onFocusOut.bind(this))),i.style.pointerEvents=e.accessiblePointerEvents,i.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?i.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(i.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&i.setAttribute("aria-label",e.accessibleHint),e.interactive?i.tabIndex=e.tabIndex:i.tabIndex=0,this.debug&&this._updateDebugHTML(i),e._accessibleActive=!0,e._accessibleDiv=i,i.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv)}_dispatchEvent(e,t){const{container:i}=e.target,n=this._renderer.events.rootBoundary,s=Object.assign(new w(n),{target:i});n.rootTarget=this._renderer.lastObjectRendered,t.forEach(o=>n.dispatchEvent(s,o))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode!==re||!this._activateOnTab||this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._canvasObserver?.destroy(),this._canvasObserver=null,this._div=null,this._pools=null,this._children=null,this._renderer=null,this._hookDiv=null,globalThis.removeEventListener("keydown",this._boundOnKeyDown),this._boundOnKeyDown=null,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._boundOnMouseMove=null}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}_getPool(e){return this._pools[e]||(this._pools[e]=[]),this._pools[e]}};L.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"accessibility"};L.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};let ue=L;const pe={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1};class Q{constructor(e){this._attachedDomElements=[],this._renderer=e,this._renderer.runners.postrender.add(this),this._renderer.runners.init.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}init(){this._canvasObserver=new q({domElement:this._domElement,renderer:this._renderer})}addRenderable(e,t){this._attachedDomElements.includes(e)||this._attachedDomElements.push(e)}updateRenderable(e){}validateRenderable(e){return!0}postrender(){const e=this._attachedDomElements;if(e.length===0){this._domElement.remove();return}this._canvasObserver.ensureAttached();for(let t=0;ti.priority-n.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;const t=this.mappingTable[e.type];if(t)for(let i=0,n=t.length;i=0;n--)if(e.currentTarget=i[n],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const n=Array.isArray(t)?t:[t];for(let s=i.length-1;s>=0;s--)n.forEach(o=>{e.currentTarget=i[s],this.notifyTarget(e,o)})}propagationPath(e){const t=[e];for(let i=0;i=0;_--){const c=h[_],p=this.hitTestMoveRecursive(c,this._isInteractive(t)?t:c.eventMode,i,n,s,o||s(e,i));if(p){if(p.length>0&&!p[p.length-1].parent)continue;const D=e.isInteractive();(p.length>0||D)&&(D&&this._allInteractiveElements.push(e),p.push(e)),this._hitElements.length===0&&(this._hitElements=p),r=!0}}}const l=this._isInteractive(t),d=e.isInteractive();return d&&d&&this._allInteractiveElements.push(e),o||this._hitElements.length>0?null:r?this._hitElements:l&&!s(e,i)&&n(e,i)?d?[e]:[]:null}hitTestRecursive(e,t,i,n,s){if(this._interactivePrune(e)||s(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(m.pauseUpdate=!1),e.interactiveChildren&&e.children){const l=e.children,d=i;for(let h=l.length-1;h>=0;h--){const _=l[h],c=this.hitTestRecursive(_,this._isInteractive(t)?t:_.eventMode,d,n,s);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const p=e.isInteractive();return(c.length>0||p)&&c.push(e),c}}}const o=this._isInteractive(t),r=e.isInteractive();return o&&n(e,i)?r?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,T),!e.hitArea.contains(T.x,T.y)))return!0;if(e.effects&&e.effects.length)for(let i=0;i0&&s!==t.target){const l=e.type==="mousemove"?"mouseout":"pointerout",d=this.createPointerEvent(e,l,s);if(this.dispatchEvent(d,"pointerout"),i&&this.dispatchEvent(d,"mouseout"),!t.composedPath().includes(s)){const h=this.createPointerEvent(e,"pointerleave",s);for(h.eventPhase=h.AT_TARGET;h.target&&!t.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),i&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(d)}if(s!==t.target){const l=e.type==="mousemove"?"mouseover":"pointerover",d=this.clonePointerEvent(t,l);this.dispatchEvent(d,"pointerover"),i&&this.dispatchEvent(d,"mouseover");let h=s?.parent;for(;h&&h!==this.rootTarget.parent&&h!==t.target;)h=h.parent;if(!h||h===this.rootTarget.parent){const c=this.clonePointerEvent(t,"pointerenter");for(c.eventPhase=c.AT_TARGET;c.target&&c.target!==s&&c.target!==this.rootTarget.parent;)c.currentTarget=c.target,this.notifyTarget(c),i&&this.notifyTarget(c,"mouseenter"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(d)}const o=[],r=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(t,"pointermove"),r&&o.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),r&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),r&&o.push("globalmousemove"),this.cursor=t.target?.cursor),o.length>0&&this.all(t,o),this._allInteractiveElements.length=0,this._hitElements.length=0,n.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){if(!(e instanceof u)){g("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),n=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),n&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=i.target?.cursor);const s=this.clonePointerEvent(i,"pointerenter");for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),n&&this.notifyTarget(s,"mouseenter"),s.target=s.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(s)}mapPointerOut(e){if(!(e instanceof u)){g("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const i=e.pointerType==="mouse"||e.pointerType==="pen",n=this.findMountedTarget(t.overTargets),s=this.createPointerEvent(e,"pointerout",n);this.dispatchEvent(s),i&&this.dispatchEvent(s,"mouseout");const o=this.createPointerEvent(e,"pointerleave",n);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;t.overTargets=null,this.freeEvent(s),this.freeEvent(o)}this.cursor=null}mapPointerUp(e){if(!(e instanceof u)){g("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const r=i.button===2;this.dispatchEvent(i,r?"rightup":"mouseup")}const n=this.trackingData(e.pointerId),s=this.findMountedTarget(n.pressTargetsByButton[e.button]);let o=s;if(s&&!i.composedPath().includes(s)){let r=s;for(;r&&!i.composedPath().includes(r);){if(i.currentTarget=r,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}r=r.parent}delete n.pressTargetsByButton[e.button],o=r}if(o){const r=this.clonePointerEvent(i,"click");r.target=o,r.path=null,n.clicksByButton[e.button]||(n.clicksByButton[e.button]={clickCount:0,target:r.target,timeStamp:t});const l=n.clicksByButton[e.button];if(l.target===r.target&&t-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=r.target,l.timeStamp=t,r.detail=l.clickCount,r.pointerType==="mouse"){const d=r.button===2;this.dispatchEvent(r,d?"rightclick":"click")}else r.pointerType==="touch"&&this.dispatchEvent(r,"tap");this.dispatchEvent(r,"pointertap"),this.freeEvent(r)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof u)){g("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),n=this.createPointerEvent(e);if(i){let s=i;for(;s;)n.currentTarget=s,this.notifyTarget(n,"pointerupoutside"),n.pointerType==="touch"?this.notifyTarget(n,"touchendoutside"):(n.pointerType==="mouse"||n.pointerType==="pen")&&this.notifyTarget(n,n.button===2?"rightupoutside":"mouseupoutside"),s=s.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(n)}mapWheel(e){if(!(e instanceof E)){g("EventBoundary cannot map a non-wheel event as a wheel event");return}const t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),t[i]=n,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){const{canvas:t,resolution:i}=this.renderer;this.setTargetElement(t),this.resolution=i,x._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){m.destroy(),this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||(e="default");let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this._currentCursor===e)return;this._currentCursor=e;const i=this.cursorStyles[e];if(i)switch(typeof i){case"string":t&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":t&&Object.assign(this.domElement.style,i);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this._normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,n=t.length;i0&&(t=e.composedPath()[0]);const i=t!==this.domElement?"outside":"",n=this._normalizeToPointerData(e);for(let s=0,o=n.length;s"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=e.type,t.push(s)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=ge),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,t.push(i)}else t.push(e);return t}normalizeWheelEvent(e){const t=this._rootWheelEvent;return this._transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}_bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this._transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=ye[e.type]||e.type),e}_transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};S.extension={name:"events",type:[y.WebGLSystem,y.CanvasSystem,y.WebGPUSystem],priority:-1};S.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let ee=S;const be={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(a){this.eventMode=a?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??ee.defaultEventMode},set eventMode(a){this._internalEventMode=a},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(a,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof t=="object"?t.signal:void 0,s=typeof t=="object"?t.once===!0:!1,o=typeof e=="function"?void 0:e;a=i?`${a}capture`:a;const r=typeof e=="function"?e:e.handleEvent,l=this;n&&n.addEventListener("abort",()=>{l.off(a,r,o)}),s?l.once(a,r,o):l.on(a,r,o)},removeEventListener(a,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof e=="function"?void 0:e;a=i?`${a}capture`:a,e=typeof e=="function"?e:e.handleEvent,this.off(a,e,n)},dispatchEvent(a){if(!(a instanceof w))throw new Error("Container cannot propagate events outside of the Federated Events API");return a.defaultPrevented=!1,a.path=null,a.target=this,a.manager.dispatchEvent(a),!a.defaultPrevented}};P.add(ue);P.mixin(V,pe);P.add(ee);P.mixin(V,be);P.add(Q); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpFragment-BDPY2JKo.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpFragment-BDPY2JKo.js new file mode 100644 index 0000000000000000000000000000000000000000..88d1638434229c6161343485991b97ec75e144a5 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpFragment-BDPY2JKo.js @@ -0,0 +1,123 @@ +import{S as a}from"./index-CDrXokXW.js";import"./samplerFragmentDeclaration-cxB-jdDJ.js";const e="bumpFragmentMainFunctions",f=`#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL) +#if defined(TANGENT) && defined(NORMAL) +varying vTBN0: vec3f;varying vTBN1: vec3f;varying vTBN2: vec3f; +#endif +#ifdef OBJECTSPACE_NORMALMAP +uniform normalMatrix: mat4x4f;fn toNormalMatrix(m: mat4x4f)->mat4x4f +{var a00=m[0][0];var a01=m[0][1];var a02=m[0][2];var a03=m[0][3];var a10=m[1][0];var a11=m[1][1];var a12=m[1][2];var a13=m[1][3];var a20=m[2][0]; +var a21=m[2][1];var a22=m[2][2];var a23=m[2][3];var a30=m[3][0]; +var a31=m[3][1];var a32=m[3][2];var a33=m[3][3];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05=a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;var det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;var mi=mat4x4( +(a11*b11-a12*b10+a13*b09)/det, +(a02*b10-a01*b11-a03*b09)/det, +(a31*b05-a32*b04+a33*b03)/det, +(a22*b04-a21*b05-a23*b03)/det, +(a12*b08-a10*b11-a13*b07)/det, +(a00*b11-a02*b08+a03*b07)/det, +(a32*b02-a30*b05-a33*b01)/det, +(a20*b05-a22*b02+a23*b01)/det, +(a10*b10-a11*b08+a13*b06)/det, +(a01*b08-a00*b10-a03*b06)/det, +(a30*b04-a31*b02+a33*b00)/det, +(a21*b02-a20*b04-a23*b00)/det, +(a11*b07-a10*b09-a12*b06)/det, +(a00*b09-a01*b07+a02*b06)/det, +(a31*b01-a30*b03-a32*b00)/det, +(a20*b03-a21*b01+a22*b00)/det);return mat4x4(mi[0][0],mi[1][0],mi[2][0],mi[3][0], +mi[0][1],mi[1][1],mi[2][1],mi[3][1], +mi[0][2],mi[1][2],mi[2][2],mi[3][2], +mi[0][3],mi[1][3],mi[2][3],mi[3][3]);} +#endif +fn perturbNormalBase(cotangentFrame: mat3x3f,normal: vec3f,scale: f32)->vec3f +{var output=normal; +#ifdef NORMALXYSCALE +output=normalize(output* vec3f(scale,scale,1.0)); +#endif +return normalize(cotangentFrame*output);} +fn perturbNormal(cotangentFrame: mat3x3f,textureSample: vec3f,scale: f32)->vec3f +{return perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);} +fn cotangent_frame(normal: vec3f,p: vec3f,uv: vec2f,tangentSpaceParams: vec2f)->mat3x3f +{var dp1: vec3f=dpdx(p);var dp2: vec3f=dpdy(p);var duv1: vec2f=dpdx(uv);var duv2: vec2f=dpdy(uv);var dp2perp: vec3f=cross(dp2,normal);var dp1perp: vec3f=cross(normal,dp1);var tangent: vec3f=dp2perp*duv1.x+dp1perp*duv2.x;var bitangent: vec3f=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;var det: f32=max(dot(tangent,tangent),dot(bitangent,bitangent));var invmax: f32=select(inverseSqrt(det),0.0,det==0.0);return mat3x3f(tangent*invmax,bitangent*invmax,normal);} +#endif +`;a.IncludesShadersStoreWGSL[e]||(a.IncludesShadersStoreWGSL[e]=f);const r="bumpFragmentFunctions",m=`#if defined(BUMP) +#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump) +#endif +#if defined(DETAIL) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail) +#endif +#if defined(BUMP) && defined(PARALLAX) +const minSamples: f32=4.;const maxSamples: f32=15.;const iMaxSamples: i32=15;fn parallaxOcclusion(vViewDirCoT: vec3f,vNormalCoT: vec3f,texCoord: vec2f,parallaxScale: f32)->vec2f {var parallaxLimit: f32=length(vViewDirCoT.xy)/vViewDirCoT.z;parallaxLimit*=parallaxScale;var vOffsetDir: vec2f=normalize(vViewDirCoT.xy);var vMaxOffset: vec2f=vOffsetDir*parallaxLimit;var numSamples: f32=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));var stepSize: f32=1.0/numSamples;var currRayHeight: f32=1.0;var vCurrOffset: vec2f= vec2f(0,0);var vLastOffset: vec2f= vec2f(0,0);var lastSampledHeight: f32=1.0;var currSampledHeight: f32=1.0;var keepWorking: bool=true;for (var i: i32=0; icurrRayHeight) +{var delta1: f32=currSampledHeight-currRayHeight;var delta2: f32=(currRayHeight+stepSize)-lastSampledHeight;var ratio: f32=delta1/(delta1+delta2);vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;keepWorking=false;} +else +{currRayHeight-=stepSize;vLastOffset=vCurrOffset; +#ifdef PARALLAX_RHS +vCurrOffset-=stepSize*vMaxOffset; +#else +vCurrOffset+=stepSize*vMaxOffset; +#endif +lastSampledHeight=currSampledHeight;}} +return vCurrOffset;} +fn parallaxOffset(viewDir: vec3f,heightScale: f32)->vec2f +{var height: f32=textureSample(bumpSampler,bumpSamplerSampler,fragmentInputs.vBumpUV).w;var texCoordOffset: vec2f=heightScale*viewDir.xy*height; +#ifdef PARALLAX_RHS +return texCoordOffset; +#else +return -texCoordOffset; +#endif +} +#endif +`;a.IncludesShadersStoreWGSL[r]||(a.IncludesShadersStoreWGSL[r]=m);const t="bumpFragment",n=`var uvOffset: vec2f= vec2f(0.0,0.0); +#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL) +#ifdef NORMALXYSCALE +var normalScale: f32=1.0; +#elif defined(BUMP) +var normalScale: f32=uniforms.vBumpInfos.y; +#else +var normalScale: f32=1.0; +#endif +#if defined(TANGENT) && defined(NORMAL) +var TBN: mat3x3f=mat3x3(input.vTBN0,input.vTBN1,input.vTBN2); +#elif defined(BUMP) +var TBNUV: vec2f=select(-fragmentInputs.vBumpUV,fragmentInputs.vBumpUV,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW*normalScale,input.vPositionW,TBNUV,uniforms.vTangentSpaceParams); +#else +var TBNUV: vec2f=select(-fragmentInputs.vDetailUV,fragmentInputs.vDetailUV,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW*normalScale,input.vPositionW,TBNUV, vec2f(1.,1.)); +#endif +#elif defined(ANISOTROPIC) +#if defined(TANGENT) && defined(NORMAL) +var TBN: mat3x3f=mat3x3(input.vTBN0,input.vTBN1,input.vTBN2); +#else +var TBNUV: vec2f=select( -fragmentInputs.vMainUV1,fragmentInputs.vMainUV1,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW,input.vPositionW,TBNUV, vec2f(1.,1.)); +#endif +#endif +#ifdef PARALLAX +var invTBN: mat3x3f=transposeMat3(TBN); +#ifdef PARALLAXOCCLUSION +uvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,fragmentInputs.vBumpUV,uniforms.vBumpInfos.z); +#else +uvOffset=parallaxOffset(invTBN*viewDirectionW,uniforms.vBumpInfos.z); +#endif +#endif +#ifdef DETAIL +var detailColor: vec4f=textureSample(detailSampler,detailSamplerSampler,fragmentInputs.vDetailUV+uvOffset);var detailNormalRG: vec2f=detailColor.wy*2.0-1.0;var detailNormalB: f32=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));var detailNormal: vec3f= vec3f(detailNormalRG,detailNormalB); +#endif +#ifdef BUMP +#ifdef OBJECTSPACE_NORMALMAP +#define CUSTOM_FRAGMENT_BUMP_FRAGMENT +normalW=normalize(textureSample(bumpSampler,bumpSamplerSampler,fragmentInputs.vBumpUV).xyz *2.0-1.0);normalW=normalize(mat3x3f(uniforms.normalMatrix[0].xyz,uniforms.normalMatrix[1].xyz,uniforms.normalMatrix[2].xyz)*normalW); +#elif !defined(DETAIL) +normalW=perturbNormal(TBN,textureSample(bumpSampler,bumpSamplerSampler,fragmentInputs.vBumpUV+uvOffset).xyz,uniforms.vBumpInfos.y); +#else +var bumpNormal: vec3f=textureSample(bumpSampler,bumpSamplerSampler,fragmentInputs.vBumpUV+uvOffset).xyz*2.0-1.0; +#if DETAIL_NORMALBLENDMETHOD==0 +detailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);var blendedNormal: vec3f=normalize( vec3f(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z)); +#elif DETAIL_NORMALBLENDMETHOD==1 +detailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);bumpNormal+= vec3f(0.0,0.0,1.0);detailNormal*= vec3f(-1.0,-1.0,1.0);var blendedNormal: vec3f=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal; +#endif +normalW=perturbNormalBase(TBN,blendedNormal,uniforms.vBumpInfos.y); +#endif +#elif defined(DETAIL) +detailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);normalW=perturbNormalBase(TBN,detailNormal,uniforms.vDetailInfos.z); +#endif +`;a.IncludesShadersStoreWGSL[t]||(a.IncludesShadersStoreWGSL[t]=n); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpFragment-CNMCo4HD.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpFragment-CNMCo4HD.js new file mode 100644 index 0000000000000000000000000000000000000000..5e4515ed24e064511098b60b42254de292d75dd9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpFragment-CNMCo4HD.js @@ -0,0 +1,162 @@ +import{S as e}from"./index-CDrXokXW.js";const a="samplerFragmentDeclaration",l=`#ifdef _DEFINENAME_ +#if _DEFINENAME_DIRECTUV==1 +#define v_VARYINGNAME_UV vMainUV1 +#elif _DEFINENAME_DIRECTUV==2 +#define v_VARYINGNAME_UV vMainUV2 +#elif _DEFINENAME_DIRECTUV==3 +#define v_VARYINGNAME_UV vMainUV3 +#elif _DEFINENAME_DIRECTUV==4 +#define v_VARYINGNAME_UV vMainUV4 +#elif _DEFINENAME_DIRECTUV==5 +#define v_VARYINGNAME_UV vMainUV5 +#elif _DEFINENAME_DIRECTUV==6 +#define v_VARYINGNAME_UV vMainUV6 +#else +varying vec2 v_VARYINGNAME_UV; +#endif +uniform sampler2D _SAMPLERNAME_Sampler; +#endif +`;e.IncludesShadersStore[a]||(e.IncludesShadersStore[a]=l);const t="bumpFragmentMainFunctions",n=`#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL) +#if defined(TANGENT) && defined(NORMAL) +varying mat3 vTBN; +#endif +#ifdef OBJECTSPACE_NORMALMAP +uniform mat4 normalMatrix; +#if defined(WEBGL2) || defined(WEBGPU) +mat4 toNormalMatrix(mat4 wMatrix) +{mat4 ret=inverse(wMatrix);ret=transpose(ret);ret[0][3]=0.;ret[1][3]=0.;ret[2][3]=0.;ret[3]=vec4(0.,0.,0.,1.);return ret;} +#else +mat4 toNormalMatrix(mat4 m) +{float +a00=m[0][0],a01=m[0][1],a02=m[0][2],a03=m[0][3], +a10=m[1][0],a11=m[1][1],a12=m[1][2],a13=m[1][3], +a20=m[2][0],a21=m[2][1],a22=m[2][2],a23=m[2][3], +a30=m[3][0],a31=m[3][1],a32=m[3][2],a33=m[3][3], +b00=a00*a11-a01*a10, +b01=a00*a12-a02*a10, +b02=a00*a13-a03*a10, +b03=a01*a12-a02*a11, +b04=a01*a13-a03*a11, +b05=a02*a13-a03*a12, +b06=a20*a31-a21*a30, +b07=a20*a32-a22*a30, +b08=a20*a33-a23*a30, +b09=a21*a32-a22*a31, +b10=a21*a33-a23*a31, +b11=a22*a33-a23*a32, +det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;mat4 mi=mat4( +a11*b11-a12*b10+a13*b09, +a02*b10-a01*b11-a03*b09, +a31*b05-a32*b04+a33*b03, +a22*b04-a21*b05-a23*b03, +a12*b08-a10*b11-a13*b07, +a00*b11-a02*b08+a03*b07, +a32*b02-a30*b05-a33*b01, +a20*b05-a22*b02+a23*b01, +a10*b10-a11*b08+a13*b06, +a01*b08-a00*b10-a03*b06, +a30*b04-a31*b02+a33*b00, +a21*b02-a20*b04-a23*b00, +a11*b07-a10*b09-a12*b06, +a00*b09-a01*b07+a02*b06, +a31*b01-a30*b03-a32*b00, +a20*b03-a21*b01+a22*b00)/det;return mat4(mi[0][0],mi[1][0],mi[2][0],mi[3][0], +mi[0][1],mi[1][1],mi[2][1],mi[3][1], +mi[0][2],mi[1][2],mi[2][2],mi[3][2], +mi[0][3],mi[1][3],mi[2][3],mi[3][3]);} +#endif +#endif +vec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale) +{ +#ifdef NORMALXYSCALE +normal=normalize(normal*vec3(scale,scale,1.0)); +#endif +return normalize(cotangentFrame*normal);} +vec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale) +{return perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);} +mat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams) +{vec3 dp1=dFdx(p);vec3 dp2=dFdy(p);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;float det=max(dot(tangent,tangent),dot(bitangent,bitangent));float invmax=det==0.0 ? 0.0 : inversesqrt(det);return mat3(tangent*invmax,bitangent*invmax,normal);} +#endif +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=n);const r="bumpFragmentFunctions",m=`#if defined(BUMP) +#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump) +#endif +#if defined(DETAIL) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail) +#endif +#if defined(BUMP) && defined(PARALLAX) +const float minSamples=4.;const float maxSamples=15.;const int iMaxSamples=15;vec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {float parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;parallaxLimit*=parallaxScale;vec2 vOffsetDir=normalize(vViewDirCoT.xy);vec2 vMaxOffset=vOffsetDir*parallaxLimit;float numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));float stepSize=1.0/numSamples;float currRayHeight=1.0;vec2 vCurrOffset=vec2(0,0);vec2 vLastOffset=vec2(0,0);float lastSampledHeight=1.0;float currSampledHeight=1.0;bool keepWorking=true;for (int i=0; icurrRayHeight) +{float delta1=currSampledHeight-currRayHeight;float delta2=(currRayHeight+stepSize)-lastSampledHeight;float ratio=delta1/(delta1+delta2);vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;keepWorking=false;} +else +{currRayHeight-=stepSize;vLastOffset=vCurrOffset; +#ifdef PARALLAX_RHS +vCurrOffset-=stepSize*vMaxOffset; +#else +vCurrOffset+=stepSize*vMaxOffset; +#endif +lastSampledHeight=currSampledHeight;}} +return vCurrOffset;} +vec2 parallaxOffset(vec3 viewDir,float heightScale) +{float height=texture2D(bumpSampler,vBumpUV).w;vec2 texCoordOffset=heightScale*viewDir.xy*height; +#ifdef PARALLAX_RHS +return texCoordOffset; +#else +return -texCoordOffset; +#endif +} +#endif +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=m);const i="bumpFragment",f=`vec2 uvOffset=vec2(0.0,0.0); +#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL) +#ifdef NORMALXYSCALE +float normalScale=1.0; +#elif defined(BUMP) +float normalScale=vBumpInfos.y; +#else +float normalScale=1.0; +#endif +#if defined(TANGENT) && defined(NORMAL) +mat3 TBN=vTBN; +#elif defined(BUMP) +vec2 TBNUV=gl_FrontFacing ? vBumpUV : -vBumpUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vTangentSpaceParams); +#else +vec2 TBNUV=gl_FrontFacing ? vDetailUV : -vDetailUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vec2(1.,1.)); +#endif +#elif defined(ANISOTROPIC) +#if defined(TANGENT) && defined(NORMAL) +mat3 TBN=vTBN; +#else +vec2 TBNUV=gl_FrontFacing ? vMainUV1 : -vMainUV1;mat3 TBN=cotangent_frame(normalW,vPositionW,TBNUV,vec2(1.,1.)); +#endif +#endif +#ifdef PARALLAX +mat3 invTBN=transposeMat3(TBN); +#ifdef PARALLAXOCCLUSION +uvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z); +#else +uvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z); +#endif +#endif +#ifdef DETAIL +vec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);vec2 detailNormalRG=detailColor.wy*2.0-1.0;float detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));vec3 detailNormal=vec3(detailNormalRG,detailNormalB); +#endif +#ifdef BUMP +#ifdef OBJECTSPACE_NORMALMAP +#define CUSTOM_FRAGMENT_BUMP_FRAGMENT +normalW=normalize(texture2D(bumpSampler,vBumpUV).xyz *2.0-1.0);normalW=normalize(mat3(normalMatrix)*normalW); +#elif !defined(DETAIL) +normalW=perturbNormal(TBN,texture2D(bumpSampler,vBumpUV+uvOffset).xyz,vBumpInfos.y); +#else +vec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0; +#if DETAIL_NORMALBLENDMETHOD==0 +detailNormal.xy*=vDetailInfos.z;vec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z)); +#elif DETAIL_NORMALBLENDMETHOD==1 +detailNormal.xy*=vDetailInfos.z;bumpNormal+=vec3(0.0,0.0,1.0);detailNormal*=vec3(-1.0,-1.0,1.0);vec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal; +#endif +normalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y); +#endif +#elif defined(DETAIL) +detailNormal.xy*=vDetailInfos.z;normalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z); +#endif +`;e.IncludesShadersStore[i]||(e.IncludesShadersStore[i]=f); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpVertex-B5e3s1jQ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpVertex-B5e3s1jQ.js new file mode 100644 index 0000000000000000000000000000000000000000..27614e5edc2124619d9d193ddda347402bd4d92e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpVertex-B5e3s1jQ.js @@ -0,0 +1,6 @@ +import{S as e}from"./index-CDrXokXW.js";const n="bumpVertex",t=`#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) +#if defined(TANGENT) && defined(NORMAL) +vec3 tbnNormal=normalize(normalUpdated);vec3 tbnTangent=normalize(tangentUpdated.xyz);vec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;vTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal); +#endif +#endif +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=t); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpVertex-D9JGroSY.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpVertex-D9JGroSY.js new file mode 100644 index 0000000000000000000000000000000000000000..89fb0837f430b391453eddc263a4b7d46c74cb65 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpVertex-D9JGroSY.js @@ -0,0 +1,6 @@ +import{S as e}from"./index-CDrXokXW.js";const t="bumpVertex",n=`#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) +#if defined(TANGENT) && defined(NORMAL) +var tbnNormal: vec3f=normalize(normalUpdated);var tbnTangent: vec3f=normalize(tangentUpdated.xyz);var tbnBitangent: vec3f=cross(tbnNormal,tbnTangent)*tangentUpdated.w;var matTemp= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz)* mat3x3f(tbnTangent,tbnBitangent,tbnNormal);vertexOutputs.vTBN0=matTemp[0];vertexOutputs.vTBN1=matTemp[1];vertexOutputs.vTBN2=matTemp[2]; +#endif +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=n); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpVertexDeclaration-BZI6C33v.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpVertexDeclaration-BZI6C33v.js new file mode 100644 index 0000000000000000000000000000000000000000..512b3cef3f01f421ebb08a74104d2015f073e8ad --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpVertexDeclaration-BZI6C33v.js @@ -0,0 +1,6 @@ +import{S as e}from"./index-CDrXokXW.js";const d="bumpVertexDeclaration",n=`#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) +#if defined(TANGENT) && defined(NORMAL) +varying vTBN0: vec3f;varying vTBN1: vec3f;varying vTBN2: vec3f; +#endif +#endif +`;e.IncludesShadersStoreWGSL[d]||(e.IncludesShadersStoreWGSL[d]=n); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpVertexDeclaration-Bd2S82Ce.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpVertexDeclaration-Bd2S82Ce.js new file mode 100644 index 0000000000000000000000000000000000000000..ee7a444af223098dda184d7f1cc63ad78c286be7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bumpVertexDeclaration-Bd2S82Ce.js @@ -0,0 +1,6 @@ +import{S as e}from"./index-CDrXokXW.js";const d="bumpVertexDeclaration",n=`#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) +#if defined(TANGENT) && defined(NORMAL) +varying mat3 vTBN; +#endif +#endif +`;e.IncludesShadersStore[d]||(e.IncludesShadersStore[d]=n); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bvhFileLoader-DyExPWsV.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bvhFileLoader-DyExPWsV.js new file mode 100644 index 0000000000000000000000000000000000000000..19a36bfd15e5b6105f54784dce60f31d75bfc8c0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/bvhFileLoader-DyExPWsV.js @@ -0,0 +1,3 @@ +import{as as p,V as E,M as h,d as Y,ao as R,bf as g,ax as U}from"./index-CDrXokXW.js";import{A as b}from"./assetContainer-D7EiOqw6.js";import{B as V}from"./bone-z620UXj2.js";import{S as D}from"./skeleton-3aE04lM6.js";import"./index-DWyDLubb.js";import"./rawTexture-DYLCXHMF.js";const O="Xposition",x="Yposition",F="Zposition",k="Xrotation",M="Yrotation",v="Zrotation",j="HIERARCHY",K="MOTION";class X{constructor(t){this.loopMode=p.ANIMATIONLOOPMODE_CYCLE,this.list=[],this.root=_(),this.numFrames=0,this.frameRate=0,this.skeleton=t}}function _(){return{name:"",type:"",offset:new E,channels:[],children:[],frames:[],parent:null}}function Z(){return{frame:0,position:new E,rotation:new R}}function z(n){const t=n.offset.x,o=n.offset.y,i=n.offset.z;return h.Translation(t,o,i)}function Q(n,t){if(n.frames.length===0)return[];const o=[],i=n.channels.some(f=>f===O||f===x||f===F),e=n.channels.some(f=>f===k||f===M||f===v),r=new p(`${n.name}_pos`,"position",t.frameRate,p.ANIMATIONTYPE_VECTOR3,t.loopMode),a=new p(`${n.name}_rot`,"rotationQuaternion",t.frameRate,p.ANIMATIONTYPE_QUATERNION,t.loopMode),s=[],l=[];for(let f=0;f0&&(r.setKeys(s),o.push(r)),l.length>0&&(a.setKeys(l),o.push(a)),o}function P(n,t,o){const i=z(n),e=new V(n.name,o.skeleton,t,i),r=Q(n,o);for(const a of r)a.getKeys()&&a.getKeys().length>0&&e.animations.push(a);for(const a of n.children)P(a,e,o)}function B(n,t,o,i){if(o.type==="ENDSITE")return;const e=Z();e.frame=t,e.position=new E,e.rotation=new R,o.frames.push(e);let r=h.Identity();for(let a=0;a0;){const l=n.shift()?.trim();if(l==="}")return e;l&&e.children.push(L(n,l,e,i))}throw new Error("Unexpected end of file: missing closing brace")}function T(n,t,o,i){const e=n.split(` +`),{loopMode:r}=i;t._blockEntityCollection=!!o;const a=new D("","",t);a._parentContainer=o,t._blockEntityCollection=!1;const s=new X(a);s.loopMode=r;const l=e.shift();if(!l||l.trim().toUpperCase()!==j)throw new Error("HIERARCHY expected");const f=e.shift();if(!f)throw new Error("Unexpected end of file after HIERARCHY");const c=L(e,f.trim(),null,s),m=e.shift();if(!m||m.trim().toUpperCase()!==K)throw new Error("MOTION expected");const y=e.shift();if(!y)throw new Error("Unexpected end of file before frame count");const C=y.trim().split(/[\s]+/);if(C.length<2)throw new Error("Invalid frame count line");const w=parseInt(C[1]);if(isNaN(w))throw new Error("Failed to read number of frames.");s.numFrames=w;const H=e.shift();if(!H)throw new Error("Unexpected end of file before frame time");const A=H.trim().split(/[\s]+/);if(A.length<3)throw new Error("Invalid frame time line");const u=parseFloat(A[2]);if(isNaN(u))throw new Error("Failed to read frame time.");if(u<=0)throw new Error("Failed to read frame time. Invalid value "+u);s.frameRate=1/u;for(let N=0;N{})}loadAssetContainerAsync(t,o){if(typeof o!="string")return Promise.reject("BVH loader expects string data.");if(this.isNotBvhHeader(o))return Promise.reject("BVH loader expects HIERARCHY header.");const i=new b(t);try{const e=T(o,t,i,this._loadingOptions);return i.skeletons.push(e),Promise.resolve(i)}catch(e){return Promise.reject(e)}}}U(new d);export{d as BVHFileLoader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/c4Diagram-YG6GDRKO-DjbbCTFy.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/c4Diagram-YG6GDRKO-DjbbCTFy.js new file mode 100644 index 0000000000000000000000000000000000000000..75c8aacc7194a25d156749f1d80d40a12565223a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/c4Diagram-YG6GDRKO-DjbbCTFy.js @@ -0,0 +1,10 @@ +import{g as Oe,d as Re}from"./chunk-TZMSLE5B-bT_t1BIn.js";import{s as Se,g as De,a as Pe,b as Be,_ as g,c as Dt,l as he,d as Ie,e as Me,f as Tt,h as pe,i as Le,w as Ne,j as Jt,k as ue}from"./mermaid.core-7TB2QPZo.js";import{s as Nt}from"./select-BigU4G0v.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";var jt=(function(){var e=g(function(_t,x,m,v){for(m=m||{},v=_t.length;v--;m[_t[v]]=x);return m},"o"),t=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],r=[1,63],n=[1,64],i=[1,65],u=[1,66],d=[1,67],y=[1,68],p=[1,69],E=[1,29],O=[1,30],S=[1,31],P=[1,32],M=[1,33],U=[1,34],H=[1,35],q=[1,36],G=[1,37],K=[1,38],J=[1,39],Z=[1,40],$=[1,41],tt=[1,42],et=[1,43],at=[1,44],it=[1,45],nt=[1,46],rt=[1,47],st=[1,48],lt=[1,50],ot=[1,51],ct=[1,52],ht=[1,53],ut=[1,54],dt=[1,55],ft=[1,56],pt=[1,57],yt=[1,58],gt=[1,59],bt=[1,60],Ct=[14,42],Xt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],k=[1,82],A=[1,83],C=[1,84],w=[1,85],T=[12,14,42],re=[12,14,33,42],Bt=[12,14,33,42,76,77,79,80],vt=[12,33],Wt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Qt={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:g(function(x,m,v,b,R,h,Rt){var f=h.length-1;switch(R){case 3:b.setDirection("TB");break;case 4:b.setDirection("BT");break;case 5:b.setDirection("RL");break;case 6:b.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:b.setC4Type(h[f-3]);break;case 19:b.setTitle(h[f].substring(6)),this.$=h[f].substring(6);break;case 20:b.setAccDescription(h[f].substring(15)),this.$=h[f].substring(15);break;case 21:this.$=h[f].trim(),b.setTitle(this.$);break;case 22:case 23:this.$=h[f].trim(),b.setAccDescription(this.$);break;case 28:h[f].splice(2,0,"ENTERPRISE"),b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 29:h[f].splice(2,0,"SYSTEM"),b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 30:b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 31:h[f].splice(2,0,"CONTAINER"),b.addContainerBoundary(...h[f]),this.$=h[f];break;case 32:b.addDeploymentNode("node",...h[f]),this.$=h[f];break;case 33:b.addDeploymentNode("nodeL",...h[f]),this.$=h[f];break;case 34:b.addDeploymentNode("nodeR",...h[f]),this.$=h[f];break;case 35:b.popBoundaryParseStack();break;case 39:b.addPersonOrSystem("person",...h[f]),this.$=h[f];break;case 40:b.addPersonOrSystem("external_person",...h[f]),this.$=h[f];break;case 41:b.addPersonOrSystem("system",...h[f]),this.$=h[f];break;case 42:b.addPersonOrSystem("system_db",...h[f]),this.$=h[f];break;case 43:b.addPersonOrSystem("system_queue",...h[f]),this.$=h[f];break;case 44:b.addPersonOrSystem("external_system",...h[f]),this.$=h[f];break;case 45:b.addPersonOrSystem("external_system_db",...h[f]),this.$=h[f];break;case 46:b.addPersonOrSystem("external_system_queue",...h[f]),this.$=h[f];break;case 47:b.addContainer("container",...h[f]),this.$=h[f];break;case 48:b.addContainer("container_db",...h[f]),this.$=h[f];break;case 49:b.addContainer("container_queue",...h[f]),this.$=h[f];break;case 50:b.addContainer("external_container",...h[f]),this.$=h[f];break;case 51:b.addContainer("external_container_db",...h[f]),this.$=h[f];break;case 52:b.addContainer("external_container_queue",...h[f]),this.$=h[f];break;case 53:b.addComponent("component",...h[f]),this.$=h[f];break;case 54:b.addComponent("component_db",...h[f]),this.$=h[f];break;case 55:b.addComponent("component_queue",...h[f]),this.$=h[f];break;case 56:b.addComponent("external_component",...h[f]),this.$=h[f];break;case 57:b.addComponent("external_component_db",...h[f]),this.$=h[f];break;case 58:b.addComponent("external_component_queue",...h[f]),this.$=h[f];break;case 60:b.addRel("rel",...h[f]),this.$=h[f];break;case 61:b.addRel("birel",...h[f]),this.$=h[f];break;case 62:b.addRel("rel_u",...h[f]),this.$=h[f];break;case 63:b.addRel("rel_d",...h[f]),this.$=h[f];break;case 64:b.addRel("rel_l",...h[f]),this.$=h[f];break;case 65:b.addRel("rel_r",...h[f]),this.$=h[f];break;case 66:b.addRel("rel_b",...h[f]),this.$=h[f];break;case 67:h[f].splice(0,1),b.addRel("rel",...h[f]),this.$=h[f];break;case 68:b.updateElStyle("update_el_style",...h[f]),this.$=h[f];break;case 69:b.updateRelStyle("update_rel_style",...h[f]),this.$=h[f];break;case 70:b.updateLayoutConfig("update_layout_config",...h[f]),this.$=h[f];break;case 71:this.$=[h[f]];break;case 72:h[f].unshift(h[f-1]),this.$=h[f];break;case 73:case 75:this.$=h[f].trim();break;case 74:let Et={};Et[h[f-1].trim()]=h[f].trim(),this.$=Et;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:u,39:d,40:y,41:p,43:23,44:E,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:70,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:u,39:d,40:y,41:p,43:23,44:E,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:71,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:u,39:d,40:y,41:p,43:23,44:E,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:72,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:u,39:d,40:y,41:p,43:23,44:E,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:73,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:u,39:d,40:y,41:p,43:23,44:E,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{14:[1,74]},e(Ct,[2,13],{43:23,29:49,30:61,32:62,20:75,34:r,36:n,37:i,38:u,39:d,40:y,41:p,44:E,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt}),e(Ct,[2,14]),e(Xt,[2,16],{12:[1,76]}),e(Ct,[2,36],{12:[1,77]}),e(Ot,[2,19]),e(Ot,[2,20]),{25:[1,78]},{27:[1,79]},e(Ot,[2,23]),{35:80,75:81,76:k,77:A,79:C,80:w},{35:86,75:81,76:k,77:A,79:C,80:w},{35:87,75:81,76:k,77:A,79:C,80:w},{35:88,75:81,76:k,77:A,79:C,80:w},{35:89,75:81,76:k,77:A,79:C,80:w},{35:90,75:81,76:k,77:A,79:C,80:w},{35:91,75:81,76:k,77:A,79:C,80:w},{35:92,75:81,76:k,77:A,79:C,80:w},{35:93,75:81,76:k,77:A,79:C,80:w},{35:94,75:81,76:k,77:A,79:C,80:w},{35:95,75:81,76:k,77:A,79:C,80:w},{35:96,75:81,76:k,77:A,79:C,80:w},{35:97,75:81,76:k,77:A,79:C,80:w},{35:98,75:81,76:k,77:A,79:C,80:w},{35:99,75:81,76:k,77:A,79:C,80:w},{35:100,75:81,76:k,77:A,79:C,80:w},{35:101,75:81,76:k,77:A,79:C,80:w},{35:102,75:81,76:k,77:A,79:C,80:w},{35:103,75:81,76:k,77:A,79:C,80:w},{35:104,75:81,76:k,77:A,79:C,80:w},e(T,[2,59]),{35:105,75:81,76:k,77:A,79:C,80:w},{35:106,75:81,76:k,77:A,79:C,80:w},{35:107,75:81,76:k,77:A,79:C,80:w},{35:108,75:81,76:k,77:A,79:C,80:w},{35:109,75:81,76:k,77:A,79:C,80:w},{35:110,75:81,76:k,77:A,79:C,80:w},{35:111,75:81,76:k,77:A,79:C,80:w},{35:112,75:81,76:k,77:A,79:C,80:w},{35:113,75:81,76:k,77:A,79:C,80:w},{35:114,75:81,76:k,77:A,79:C,80:w},{35:115,75:81,76:k,77:A,79:C,80:w},{20:116,29:49,30:61,32:62,34:r,36:n,37:i,38:u,39:d,40:y,41:p,43:23,44:E,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{12:[1,118],33:[1,117]},{35:119,75:81,76:k,77:A,79:C,80:w},{35:120,75:81,76:k,77:A,79:C,80:w},{35:121,75:81,76:k,77:A,79:C,80:w},{35:122,75:81,76:k,77:A,79:C,80:w},{35:123,75:81,76:k,77:A,79:C,80:w},{35:124,75:81,76:k,77:A,79:C,80:w},{35:125,75:81,76:k,77:A,79:C,80:w},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},e(Ct,[2,15]),e(Xt,[2,17],{21:22,19:130,22:t,23:s,24:o,26:l,28:a}),e(Ct,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:t,23:s,24:o,26:l,28:a,34:r,36:n,37:i,38:u,39:d,40:y,41:p,44:E,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt}),e(Ot,[2,21]),e(Ot,[2,22]),e(T,[2,39]),e(re,[2,71],{75:81,35:132,76:k,77:A,79:C,80:w}),e(Bt,[2,73]),{78:[1,133]},e(Bt,[2,75]),e(Bt,[2,76]),e(T,[2,40]),e(T,[2,41]),e(T,[2,42]),e(T,[2,43]),e(T,[2,44]),e(T,[2,45]),e(T,[2,46]),e(T,[2,47]),e(T,[2,48]),e(T,[2,49]),e(T,[2,50]),e(T,[2,51]),e(T,[2,52]),e(T,[2,53]),e(T,[2,54]),e(T,[2,55]),e(T,[2,56]),e(T,[2,57]),e(T,[2,58]),e(T,[2,60]),e(T,[2,61]),e(T,[2,62]),e(T,[2,63]),e(T,[2,64]),e(T,[2,65]),e(T,[2,66]),e(T,[2,67]),e(T,[2,68]),e(T,[2,69]),e(T,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},e(vt,[2,28]),e(vt,[2,29]),e(vt,[2,30]),e(vt,[2,31]),e(vt,[2,32]),e(vt,[2,33]),e(vt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},e(Xt,[2,18]),e(Ct,[2,38]),e(re,[2,72]),e(Bt,[2,74]),e(T,[2,24]),e(T,[2,35]),e(Wt,[2,25]),e(Wt,[2,26],{12:[1,138]}),e(Wt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:g(function(x,m){if(m.recoverable)this.trace(x);else{var v=new Error(x);throw v.hash=m,v}},"parseError"),parse:g(function(x){var m=this,v=[0],b=[],R=[null],h=[],Rt=this.table,f="",Et=0,se=0,Ae=2,le=1,Ce=h.slice.call(arguments,1),D=Object.create(this.lexer),kt={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(kt.yy[Ht]=this.yy[Ht]);D.setInput(x,kt.yy),kt.yy.lexer=D,kt.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var qt=D.yylloc;h.push(qt);var we=D.options&&D.options.ranges;typeof kt.yy.parseError=="function"?this.parseError=kt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Te(L){v.length=v.length-2*L,R.length=R.length-L,h.length=h.length-L}g(Te,"popStack");function oe(){var L;return L=b.pop()||D.lex()||le,typeof L!="number"&&(L instanceof Array&&(b=L,L=b.pop()),L=m.symbols_[L]||L),L}g(oe,"lex");for(var I,At,N,Gt,wt={},Mt,W,ce,Lt;;){if(At=v[v.length-1],this.defaultActions[At]?N=this.defaultActions[At]:((I===null||typeof I>"u")&&(I=oe()),N=Rt[At]&&Rt[At][I]),typeof N>"u"||!N.length||!N[0]){var Kt="";Lt=[];for(Mt in Rt[At])this.terminals_[Mt]&&Mt>Ae&&Lt.push("'"+this.terminals_[Mt]+"'");D.showPosition?Kt="Parse error on line "+(Et+1)+`: +`+D.showPosition()+` +Expecting `+Lt.join(", ")+", got '"+(this.terminals_[I]||I)+"'":Kt="Parse error on line "+(Et+1)+": Unexpected "+(I==le?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(Kt,{text:D.match,token:this.terminals_[I]||I,line:D.yylineno,loc:qt,expected:Lt})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+At+", token: "+I);switch(N[0]){case 1:v.push(I),R.push(D.yytext),h.push(D.yylloc),v.push(N[1]),I=null,se=D.yyleng,f=D.yytext,Et=D.yylineno,qt=D.yylloc;break;case 2:if(W=this.productions_[N[1]][1],wt.$=R[R.length-W],wt._$={first_line:h[h.length-(W||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(W||1)].first_column,last_column:h[h.length-1].last_column},we&&(wt._$.range=[h[h.length-(W||1)].range[0],h[h.length-1].range[1]]),Gt=this.performAction.apply(wt,[f,se,Et,kt.yy,N[1],R,h].concat(Ce)),typeof Gt<"u")return Gt;W&&(v=v.slice(0,-1*W*2),R=R.slice(0,-1*W),h=h.slice(0,-1*W)),v.push(this.productions_[N[1]][0]),R.push(wt.$),h.push(wt._$),ce=Rt[v[v.length-2]][v[v.length-1]],v.push(ce);break;case 3:return!0}}return!0},"parse")},ke=(function(){var _t={EOF:1,parseError:g(function(m,v){if(this.yy.parser)this.yy.parser.parseError(m,v);else throw new Error(m)},"parseError"),setInput:g(function(x,m){return this.yy=m||this.yy||{},this._input=x,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var x=this._input[0];this.yytext+=x,this.yyleng++,this.offset++,this.match+=x,this.matched+=x;var m=x.match(/(?:\r\n?|\n).*/g);return m?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),x},"input"),unput:g(function(x){var m=x.length,v=x.split(/(?:\r\n?|\n)/g);this._input=x+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-m),this.offset-=m;var b=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),v.length-1&&(this.yylineno-=v.length-1);var R=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:v?(v.length===b.length?this.yylloc.first_column:0)+b[b.length-v.length].length-v[0].length:this.yylloc.first_column-m},this.options.ranges&&(this.yylloc.range=[R[0],R[0]+this.yyleng-m]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(x){this.unput(this.match.slice(x))},"less"),pastInput:g(function(){var x=this.matched.substr(0,this.matched.length-this.match.length);return(x.length>20?"...":"")+x.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var x=this.match;return x.length<20&&(x+=this._input.substr(0,20-x.length)),(x.substr(0,20)+(x.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var x=this.pastInput(),m=new Array(x.length+1).join("-");return x+this.upcomingInput()+` +`+m+"^"},"showPosition"),test_match:g(function(x,m){var v,b,R;if(this.options.backtrack_lexer&&(R={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(R.yylloc.range=this.yylloc.range.slice(0))),b=x[0].match(/(?:\r\n?|\n).*/g),b&&(this.yylineno+=b.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:b?b[b.length-1].length-b[b.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+x[0].length},this.yytext+=x[0],this.match+=x[0],this.matches=x,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(x[0].length),this.matched+=x[0],v=this.performAction.call(this,this.yy,this,m,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),v)return v;if(this._backtrack){for(var h in R)this[h]=R[h];return!1}return!1},"test_match"),next:g(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var x,m,v,b;this._more||(this.yytext="",this.match="");for(var R=this._currentRules(),h=0;hm[0].length)){if(m=v,b=h,this.options.backtrack_lexer){if(x=this.test_match(v,R[h]),x!==!1)return x;if(this._backtrack){m=!1;continue}else return!1}else if(!this.options.flex)break}return m?(x=this.test_match(m,R[b]),x!==!1?x:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:g(function(){var m=this.next();return m||this.lex()},"lex"),begin:g(function(m){this.conditionStack.push(m)},"begin"),popState:g(function(){var m=this.conditionStack.length-1;return m>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:g(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:g(function(m){return m=this.conditionStack.length-1-Math.abs(m||0),m>=0?this.conditionStack[m]:"INITIAL"},"topState"),pushState:g(function(m){this.begin(m)},"pushState"),stateStackSize:g(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:g(function(m,v,b,R){switch(b){case 0:return 6;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 22;case 5:return 23;case 6:return this.begin("acc_title"),24;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),26;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:break;case 14:c;break;case 15:return 12;case 16:break;case 17:return 11;case 18:return 15;case 19:return 16;case 20:return 17;case 21:return 18;case 22:return this.begin("person_ext"),45;case 23:return this.begin("person"),44;case 24:return this.begin("system_ext_queue"),51;case 25:return this.begin("system_ext_db"),50;case 26:return this.begin("system_ext"),49;case 27:return this.begin("system_queue"),48;case 28:return this.begin("system_db"),47;case 29:return this.begin("system"),46;case 30:return this.begin("boundary"),37;case 31:return this.begin("enterprise_boundary"),34;case 32:return this.begin("system_boundary"),36;case 33:return this.begin("container_ext_queue"),57;case 34:return this.begin("container_ext_db"),56;case 35:return this.begin("container_ext"),55;case 36:return this.begin("container_queue"),54;case 37:return this.begin("container_db"),53;case 38:return this.begin("container"),52;case 39:return this.begin("container_boundary"),38;case 40:return this.begin("component_ext_queue"),63;case 41:return this.begin("component_ext_db"),62;case 42:return this.begin("component_ext"),61;case 43:return this.begin("component_queue"),60;case 44:return this.begin("component_db"),59;case 45:return this.begin("component"),58;case 46:return this.begin("node"),39;case 47:return this.begin("node"),39;case 48:return this.begin("node_l"),40;case 49:return this.begin("node_r"),41;case 50:return this.begin("rel"),64;case 51:return this.begin("birel"),65;case 52:return this.begin("rel_u"),66;case 53:return this.begin("rel_u"),66;case 54:return this.begin("rel_d"),67;case 55:return this.begin("rel_d"),67;case 56:return this.begin("rel_l"),68;case 57:return this.begin("rel_l"),68;case 58:return this.begin("rel_r"),69;case 59:return this.begin("rel_r"),69;case 60:return this.begin("rel_b"),70;case 61:return this.begin("rel_index"),71;case 62:return this.begin("update_el_style"),72;case 63:return this.begin("update_rel_style"),73;case 64:return this.begin("update_layout_config"),74;case 65:return"EOF_IN_STRUCT";case 66:return this.begin("attribute"),"ATTRIBUTE_EMPTY";case 67:this.begin("attribute");break;case 68:this.popState(),this.popState();break;case 69:return 80;case 70:break;case 71:return 80;case 72:this.begin("string");break;case 73:this.popState();break;case 74:return"STR";case 75:this.begin("string_kv");break;case 76:return this.begin("string_kv_key"),"STR_KEY";case 77:this.popState(),this.begin("string_kv_value");break;case 78:return"STR_VALUE";case 79:this.popState(),this.popState();break;case 80:return"STR";case 81:return"LBRACE";case 82:return"RBRACE";case 83:return"SPACE";case 84:return"EOL";case 85:return 14}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},string_kv_value:{rules:[78,79],inclusive:!1},string_kv_key:{rules:[77],inclusive:!1},string_kv:{rules:[76],inclusive:!1},string:{rules:[73,74],inclusive:!1},attribute:{rules:[68,69,70,71,72,75,80],inclusive:!1},update_layout_config:{rules:[65,66,67,68],inclusive:!1},update_rel_style:{rules:[65,66,67,68],inclusive:!1},update_el_style:{rules:[65,66,67,68],inclusive:!1},rel_b:{rules:[65,66,67,68],inclusive:!1},rel_r:{rules:[65,66,67,68],inclusive:!1},rel_l:{rules:[65,66,67,68],inclusive:!1},rel_d:{rules:[65,66,67,68],inclusive:!1},rel_u:{rules:[65,66,67,68],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[65,66,67,68],inclusive:!1},node_r:{rules:[65,66,67,68],inclusive:!1},node_l:{rules:[65,66,67,68],inclusive:!1},node:{rules:[65,66,67,68],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[65,66,67,68],inclusive:!1},component_ext_queue:{rules:[],inclusive:!1},component_ext_db:{rules:[65,66,67,68],inclusive:!1},component_ext:{rules:[65,66,67,68],inclusive:!1},component_queue:{rules:[65,66,67,68],inclusive:!1},component_db:{rules:[65,66,67,68],inclusive:!1},component:{rules:[65,66,67,68],inclusive:!1},container_boundary:{rules:[65,66,67,68],inclusive:!1},container_ext_queue:{rules:[65,66,67,68],inclusive:!1},container_ext_db:{rules:[65,66,67,68],inclusive:!1},container_ext:{rules:[65,66,67,68],inclusive:!1},container_queue:{rules:[65,66,67,68],inclusive:!1},container_db:{rules:[65,66,67,68],inclusive:!1},container:{rules:[65,66,67,68],inclusive:!1},birel:{rules:[65,66,67,68],inclusive:!1},system_boundary:{rules:[65,66,67,68],inclusive:!1},enterprise_boundary:{rules:[65,66,67,68],inclusive:!1},boundary:{rules:[65,66,67,68],inclusive:!1},system_ext_queue:{rules:[65,66,67,68],inclusive:!1},system_ext_db:{rules:[65,66,67,68],inclusive:!1},system_ext:{rules:[65,66,67,68],inclusive:!1},system_queue:{rules:[65,66,67,68],inclusive:!1},system_db:{rules:[65,66,67,68],inclusive:!1},system:{rules:[65,66,67,68],inclusive:!1},person_ext:{rules:[65,66,67,68],inclusive:!1},person:{rules:[65,66,67,68],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83,84,85],inclusive:!0}}};return _t})();Qt.lexer=ke;function It(){this.yy={}}return g(It,"Parser"),It.prototype=Qt,Qt.Parser=It,new It})();jt.parser=jt;var Ye=jt,V=[],xt=[""],B="global",F="",X=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],Pt=[],ee="",ae=!1,Ut=4,Ft=2,ye,je=g(function(){return ye},"getC4Type"),Ue=g(function(e){ye=pe(e,Dt())},"setC4Type"),Fe=g(function(e,t,s,o,l,a,r,n,i){if(e==null||t===void 0||t===null||s===void 0||s===null||o===void 0||o===null)return;let u={};const d=Pt.find(y=>y.from===t&&y.to===s);if(d?u=d:Pt.push(u),u.type=e,u.from=t,u.to=s,u.label={text:o},l==null)u.techn={text:""};else if(typeof l=="object"){let[y,p]=Object.entries(l)[0];u[y]={text:p}}else u.techn={text:l};if(a==null)u.descr={text:""};else if(typeof a=="object"){let[y,p]=Object.entries(a)[0];u[y]={text:p}}else u.descr={text:a};if(typeof r=="object"){let[y,p]=Object.entries(r)[0];u[y]=p}else u.sprite=r;if(typeof n=="object"){let[y,p]=Object.entries(n)[0];u[y]=p}else u.tags=n;if(typeof i=="object"){let[y,p]=Object.entries(i)[0];u[y]=p}else u.link=i;u.wrap=mt()},"addRel"),Ve=g(function(e,t,s,o,l,a,r){if(t===null||s===null)return;let n={};const i=V.find(u=>u.alias===t);if(i&&t===i.alias?n=i:(n.alias=t,V.push(n)),s==null?n.label={text:""}:n.label={text:s},o==null)n.descr={text:""};else if(typeof o=="object"){let[u,d]=Object.entries(o)[0];n[u]={text:d}}else n.descr={text:o};if(typeof l=="object"){let[u,d]=Object.entries(l)[0];n[u]=d}else n.sprite=l;if(typeof a=="object"){let[u,d]=Object.entries(a)[0];n[u]=d}else n.tags=a;if(typeof r=="object"){let[u,d]=Object.entries(r)[0];n[u]=d}else n.link=r;n.typeC4Shape={text:e},n.parentBoundary=B,n.wrap=mt()},"addPersonOrSystem"),ze=g(function(e,t,s,o,l,a,r,n){if(t===null||s===null)return;let i={};const u=V.find(d=>d.alias===t);if(u&&t===u.alias?i=u:(i.alias=t,V.push(i)),s==null?i.label={text:""}:i.label={text:s},o==null)i.techn={text:""};else if(typeof o=="object"){let[d,y]=Object.entries(o)[0];i[d]={text:y}}else i.techn={text:o};if(l==null)i.descr={text:""};else if(typeof l=="object"){let[d,y]=Object.entries(l)[0];i[d]={text:y}}else i.descr={text:l};if(typeof a=="object"){let[d,y]=Object.entries(a)[0];i[d]=y}else i.sprite=a;if(typeof r=="object"){let[d,y]=Object.entries(r)[0];i[d]=y}else i.tags=r;if(typeof n=="object"){let[d,y]=Object.entries(n)[0];i[d]=y}else i.link=n;i.wrap=mt(),i.typeC4Shape={text:e},i.parentBoundary=B},"addContainer"),Xe=g(function(e,t,s,o,l,a,r,n){if(t===null||s===null)return;let i={};const u=V.find(d=>d.alias===t);if(u&&t===u.alias?i=u:(i.alias=t,V.push(i)),s==null?i.label={text:""}:i.label={text:s},o==null)i.techn={text:""};else if(typeof o=="object"){let[d,y]=Object.entries(o)[0];i[d]={text:y}}else i.techn={text:o};if(l==null)i.descr={text:""};else if(typeof l=="object"){let[d,y]=Object.entries(l)[0];i[d]={text:y}}else i.descr={text:l};if(typeof a=="object"){let[d,y]=Object.entries(a)[0];i[d]=y}else i.sprite=a;if(typeof r=="object"){let[d,y]=Object.entries(r)[0];i[d]=y}else i.tags=r;if(typeof n=="object"){let[d,y]=Object.entries(n)[0];i[d]=y}else i.link=n;i.wrap=mt(),i.typeC4Shape={text:e},i.parentBoundary=B},"addComponent"),We=g(function(e,t,s,o,l){if(e===null||t===null)return;let a={};const r=X.find(n=>n.alias===e);if(r&&e===r.alias?a=r:(a.alias=e,X.push(a)),t==null?a.label={text:""}:a.label={text:t},s==null)a.type={text:"system"};else if(typeof s=="object"){let[n,i]=Object.entries(s)[0];a[n]={text:i}}else a.type={text:s};if(typeof o=="object"){let[n,i]=Object.entries(o)[0];a[n]=i}else a.tags=o;if(typeof l=="object"){let[n,i]=Object.entries(l)[0];a[n]=i}else a.link=l;a.parentBoundary=B,a.wrap=mt(),F=B,B=e,xt.push(F)},"addPersonOrSystemBoundary"),Qe=g(function(e,t,s,o,l){if(e===null||t===null)return;let a={};const r=X.find(n=>n.alias===e);if(r&&e===r.alias?a=r:(a.alias=e,X.push(a)),t==null?a.label={text:""}:a.label={text:t},s==null)a.type={text:"container"};else if(typeof s=="object"){let[n,i]=Object.entries(s)[0];a[n]={text:i}}else a.type={text:s};if(typeof o=="object"){let[n,i]=Object.entries(o)[0];a[n]=i}else a.tags=o;if(typeof l=="object"){let[n,i]=Object.entries(l)[0];a[n]=i}else a.link=l;a.parentBoundary=B,a.wrap=mt(),F=B,B=e,xt.push(F)},"addContainerBoundary"),He=g(function(e,t,s,o,l,a,r,n){if(t===null||s===null)return;let i={};const u=X.find(d=>d.alias===t);if(u&&t===u.alias?i=u:(i.alias=t,X.push(i)),s==null?i.label={text:""}:i.label={text:s},o==null)i.type={text:"node"};else if(typeof o=="object"){let[d,y]=Object.entries(o)[0];i[d]={text:y}}else i.type={text:o};if(l==null)i.descr={text:""};else if(typeof l=="object"){let[d,y]=Object.entries(l)[0];i[d]={text:y}}else i.descr={text:l};if(typeof r=="object"){let[d,y]=Object.entries(r)[0];i[d]=y}else i.tags=r;if(typeof n=="object"){let[d,y]=Object.entries(n)[0];i[d]=y}else i.link=n;i.nodeType=e,i.parentBoundary=B,i.wrap=mt(),F=B,B=t,xt.push(F)},"addDeploymentNode"),qe=g(function(){B=F,xt.pop(),F=xt.pop(),xt.push(F)},"popBoundaryParseStack"),Ge=g(function(e,t,s,o,l,a,r,n,i,u,d){let y=V.find(p=>p.alias===t);if(!(y===void 0&&(y=X.find(p=>p.alias===t),y===void 0))){if(s!=null)if(typeof s=="object"){let[p,E]=Object.entries(s)[0];y[p]=E}else y.bgColor=s;if(o!=null)if(typeof o=="object"){let[p,E]=Object.entries(o)[0];y[p]=E}else y.fontColor=o;if(l!=null)if(typeof l=="object"){let[p,E]=Object.entries(l)[0];y[p]=E}else y.borderColor=l;if(a!=null)if(typeof a=="object"){let[p,E]=Object.entries(a)[0];y[p]=E}else y.shadowing=a;if(r!=null)if(typeof r=="object"){let[p,E]=Object.entries(r)[0];y[p]=E}else y.shape=r;if(n!=null)if(typeof n=="object"){let[p,E]=Object.entries(n)[0];y[p]=E}else y.sprite=n;if(i!=null)if(typeof i=="object"){let[p,E]=Object.entries(i)[0];y[p]=E}else y.techn=i;if(u!=null)if(typeof u=="object"){let[p,E]=Object.entries(u)[0];y[p]=E}else y.legendText=u;if(d!=null)if(typeof d=="object"){let[p,E]=Object.entries(d)[0];y[p]=E}else y.legendSprite=d}},"updateElStyle"),Ke=g(function(e,t,s,o,l,a,r){const n=Pt.find(i=>i.from===t&&i.to===s);if(n!==void 0){if(o!=null)if(typeof o=="object"){let[i,u]=Object.entries(o)[0];n[i]=u}else n.textColor=o;if(l!=null)if(typeof l=="object"){let[i,u]=Object.entries(l)[0];n[i]=u}else n.lineColor=l;if(a!=null)if(typeof a=="object"){let[i,u]=Object.entries(a)[0];n[i]=parseInt(u)}else n.offsetX=parseInt(a);if(r!=null)if(typeof r=="object"){let[i,u]=Object.entries(r)[0];n[i]=parseInt(u)}else n.offsetY=parseInt(r)}},"updateRelStyle"),Je=g(function(e,t,s){let o=Ut,l=Ft;if(typeof t=="object"){const a=Object.values(t)[0];o=parseInt(a)}else o=parseInt(t);if(typeof s=="object"){const a=Object.values(s)[0];l=parseInt(a)}else l=parseInt(s);o>=1&&(Ut=o),l>=1&&(Ft=l)},"updateLayoutConfig"),Ze=g(function(){return Ut},"getC4ShapeInRow"),$e=g(function(){return Ft},"getC4BoundaryInRow"),t0=g(function(){return B},"getCurrentBoundaryParse"),e0=g(function(){return F},"getParentBoundaryParse"),ge=g(function(e){return e==null?V:V.filter(t=>t.parentBoundary===e)},"getC4ShapeArray"),a0=g(function(e){return V.find(t=>t.alias===e)},"getC4Shape"),i0=g(function(e){return Object.keys(ge(e))},"getC4ShapeKeys"),be=g(function(e){return e==null?X:X.filter(t=>t.parentBoundary===e)},"getBoundaries"),n0=be,r0=g(function(){return Pt},"getRels"),s0=g(function(){return ee},"getTitle"),l0=g(function(e){ae=e},"setWrap"),mt=g(function(){return ae},"autoWrap"),o0=g(function(){V=[],X=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],F="",B="global",xt=[""],Pt=[],xt=[""],ee="",ae=!1,Ut=4,Ft=2},"clear"),c0={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},h0={FILLED:0,OPEN:1},u0={LEFTOF:0,RIGHTOF:1,OVER:2},d0=g(function(e){ee=pe(e,Dt())},"setTitle"),Zt={addPersonOrSystem:Ve,addPersonOrSystemBoundary:We,addContainer:ze,addContainerBoundary:Qe,addComponent:Xe,addDeploymentNode:He,popBoundaryParseStack:qe,addRel:Fe,updateElStyle:Ge,updateRelStyle:Ke,updateLayoutConfig:Je,autoWrap:mt,setWrap:l0,getC4ShapeArray:ge,getC4Shape:a0,getC4ShapeKeys:i0,getBoundaries:be,getBoundarys:n0,getCurrentBoundaryParse:t0,getParentBoundaryParse:e0,getRels:r0,getTitle:s0,getC4Type:je,getC4ShapeInRow:Ze,getC4BoundaryInRow:$e,setAccTitle:Be,getAccTitle:Pe,getAccDescription:De,setAccDescription:Se,getConfig:g(()=>Dt().c4,"getConfig"),clear:o0,LINETYPE:c0,ARROWTYPE:h0,PLACEMENT:u0,setTitle:d0,setC4Type:Ue},ie=g(function(e,t){return Re(e,t)},"drawRect"),_e=g(function(e,t,s,o,l,a){const r=e.append("image");r.attr("width",t),r.attr("height",s),r.attr("x",o),r.attr("y",l);let n=a.startsWith("data:image/png;base64")?a:Le.sanitizeUrl(a);r.attr("xlink:href",n)},"drawImage"),f0=g((e,t,s)=>{const o=e.append("g");let l=0;for(let a of t){let r=a.textColor?a.textColor:"#444444",n=a.lineColor?a.lineColor:"#444444",i=a.offsetX?parseInt(a.offsetX):0,u=a.offsetY?parseInt(a.offsetY):0,d="";if(l===0){let p=o.append("line");p.attr("x1",a.startPoint.x),p.attr("y1",a.startPoint.y),p.attr("x2",a.endPoint.x),p.attr("y2",a.endPoint.y),p.attr("stroke-width","1"),p.attr("stroke",n),p.style("fill","none"),a.type!=="rel_b"&&p.attr("marker-end","url("+d+"#arrowhead)"),(a.type==="birel"||a.type==="rel_b")&&p.attr("marker-start","url("+d+"#arrowend)"),l=-1}else{let p=o.append("path");p.attr("fill","none").attr("stroke-width","1").attr("stroke",n).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",a.startPoint.x).replaceAll("starty",a.startPoint.y).replaceAll("controlx",a.startPoint.x+(a.endPoint.x-a.startPoint.x)/2-(a.endPoint.x-a.startPoint.x)/4).replaceAll("controly",a.startPoint.y+(a.endPoint.y-a.startPoint.y)/2).replaceAll("stopx",a.endPoint.x).replaceAll("stopy",a.endPoint.y)),a.type!=="rel_b"&&p.attr("marker-end","url("+d+"#arrowhead)"),(a.type==="birel"||a.type==="rel_b")&&p.attr("marker-start","url("+d+"#arrowend)")}let y=s.messageFont();Q(s)(a.label.text,o,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+i,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+u,a.label.width,a.label.height,{fill:r},y),a.techn&&a.techn.text!==""&&(y=s.messageFont(),Q(s)("["+a.techn.text+"]",o,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+i,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+s.messageFontSize+5+u,Math.max(a.label.width,a.techn.width),a.techn.height,{fill:r,"font-style":"italic"},y))}},"drawRels"),p0=g(function(e,t,s){const o=e.append("g");let l=t.bgColor?t.bgColor:"none",a=t.borderColor?t.borderColor:"#444444",r=t.fontColor?t.fontColor:"black",n={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};t.nodeType&&(n={"stroke-width":1});let i={x:t.x,y:t.y,fill:l,stroke:a,width:t.width,height:t.height,rx:2.5,ry:2.5,attrs:n};ie(o,i);let u=s.boundaryFont();u.fontWeight="bold",u.fontSize=u.fontSize+2,u.fontColor=r,Q(s)(t.label.text,o,t.x,t.y+t.label.Y,t.width,t.height,{fill:"#444444"},u),t.type&&t.type.text!==""&&(u=s.boundaryFont(),u.fontColor=r,Q(s)(t.type.text,o,t.x,t.y+t.type.Y,t.width,t.height,{fill:"#444444"},u)),t.descr&&t.descr.text!==""&&(u=s.boundaryFont(),u.fontSize=u.fontSize-2,u.fontColor=r,Q(s)(t.descr.text,o,t.x,t.y+t.descr.Y,t.width,t.height,{fill:"#444444"},u))},"drawBoundary"),y0=g(function(e,t,s){let o=t.bgColor?t.bgColor:s[t.typeC4Shape.text+"_bg_color"],l=t.borderColor?t.borderColor:s[t.typeC4Shape.text+"_border_color"],a=t.fontColor?t.fontColor:"#FFFFFF",r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";switch(t.typeC4Shape.text){case"person":r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";break;case"external_person":r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=";break}const n=e.append("g");n.attr("class","person-man");const i=Oe();switch(t.typeC4Shape.text){case"person":case"external_person":case"system":case"external_system":case"container":case"external_container":case"component":case"external_component":i.x=t.x,i.y=t.y,i.fill=o,i.width=t.width,i.height=t.height,i.stroke=l,i.rx=2.5,i.ry=2.5,i.attrs={"stroke-width":.5},ie(n,i);break;case"system_db":case"external_system_db":case"container_db":case"external_container_db":case"component_db":case"external_component_db":n.append("path").attr("fill",o).attr("stroke-width","0.5").attr("stroke",l).attr("d","Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2).replaceAll("height",t.height)),n.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",l).attr("d","Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2));break;case"system_queue":case"external_system_queue":case"container_queue":case"external_container_queue":case"component_queue":case"external_component_queue":n.append("path").attr("fill",o).attr("stroke-width","0.5").attr("stroke",l).attr("d","Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("width",t.width).replaceAll("half",t.height/2)),n.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",l).attr("d","Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx",t.x+t.width).replaceAll("starty",t.y).replaceAll("half",t.height/2));break}let u=A0(s,t.typeC4Shape.text);switch(n.append("text").attr("fill",a).attr("font-family",u.fontFamily).attr("font-size",u.fontSize-2).attr("font-style","italic").attr("lengthAdjust","spacing").attr("textLength",t.typeC4Shape.width).attr("x",t.x+t.width/2-t.typeC4Shape.width/2).attr("y",t.y+t.typeC4Shape.Y).text("<<"+t.typeC4Shape.text+">>"),t.typeC4Shape.text){case"person":case"external_person":_e(n,48,48,t.x+t.width/2-24,t.y+t.image.Y,r);break}let d=s[t.typeC4Shape.text+"Font"]();return d.fontWeight="bold",d.fontSize=d.fontSize+2,d.fontColor=a,Q(s)(t.label.text,n,t.x,t.y+t.label.Y,t.width,t.height,{fill:a},d),d=s[t.typeC4Shape.text+"Font"](),d.fontColor=a,t.techn&&t.techn?.text!==""?Q(s)(t.techn.text,n,t.x,t.y+t.techn.Y,t.width,t.height,{fill:a,"font-style":"italic"},d):t.type&&t.type.text!==""&&Q(s)(t.type.text,n,t.x,t.y+t.type.Y,t.width,t.height,{fill:a,"font-style":"italic"},d),t.descr&&t.descr.text!==""&&(d=s.personFont(),d.fontColor=a,Q(s)(t.descr.text,n,t.x,t.y+t.descr.Y,t.width,t.height,{fill:a},d)),t.height},"drawC4Shape"),g0=g(function(e){e.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),b0=g(function(e){e.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),_0=g(function(e){e.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),x0=g(function(e){e.append("defs").append("marker").attr("id","arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},"insertArrowHead"),m0=g(function(e){e.append("defs").append("marker").attr("id","arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},"insertArrowEnd"),v0=g(function(e){e.append("defs").append("marker").attr("id","filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),E0=g(function(e){e.append("defs").append("marker").attr("id","sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},"insertDynamicNumber"),k0=g(function(e){const s=e.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);s.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),s.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},"insertArrowCrossHead"),A0=g((e,t)=>({fontFamily:e[t+"FontFamily"],fontSize:e[t+"FontSize"],fontWeight:e[t+"FontWeight"]}),"getC4ShapeFont"),Q=(function(){function e(l,a,r,n,i,u,d){const y=a.append("text").attr("x",r+i/2).attr("y",n+u/2+5).style("text-anchor","middle").text(l);o(y,d)}g(e,"byText");function t(l,a,r,n,i,u,d,y){const{fontSize:p,fontFamily:E,fontWeight:O}=y,S=l.split(Jt.lineBreakRegex);for(let P=0;P=this.data.widthLimit||s>=this.data.widthLimit||this.nextData.cnt>xe)&&(t=this.nextData.startx+e.margin+_.nextLinePaddingX,o=this.nextData.stopy+e.margin*2,this.nextData.stopx=s=t+e.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=l=o+e.height,this.nextData.cnt=1),e.x=t,e.y=o,this.updateVal(this.data,"startx",t,Math.min),this.updateVal(this.data,"starty",o,Math.min),this.updateVal(this.data,"stopx",s,Math.max),this.updateVal(this.data,"stopy",l,Math.max),this.updateVal(this.nextData,"startx",t,Math.min),this.updateVal(this.nextData,"starty",o,Math.min),this.updateVal(this.nextData,"stopx",s,Math.max),this.updateVal(this.nextData,"stopy",l,Math.max)}init(e){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},te(e.db.getConfig())}bumpLastMargin(e){this.data.stopx+=e,this.data.stopy+=e}},te=g(function(e){Me(_,e),e.fontFamily&&(_.personFontFamily=_.systemFontFamily=_.messageFontFamily=e.fontFamily),e.fontSize&&(_.personFontSize=_.systemFontSize=_.messageFontSize=e.fontSize),e.fontWeight&&(_.personFontWeight=_.systemFontWeight=_.messageFontWeight=e.fontWeight)},"setConf"),St=g((e,t)=>({fontFamily:e[t+"FontFamily"],fontSize:e[t+"FontSize"],fontWeight:e[t+"FontWeight"]}),"c4ShapeFont"),Yt=g(e=>({fontFamily:e.boundaryFontFamily,fontSize:e.boundaryFontSize,fontWeight:e.boundaryFontWeight}),"boundaryFont"),C0=g(e=>({fontFamily:e.messageFontFamily,fontSize:e.messageFontSize,fontWeight:e.messageFontWeight}),"messageFont");function j(e,t,s,o,l){if(!t[e].width)if(s)t[e].text=Ne(t[e].text,l,o),t[e].textLines=t[e].text.split(Jt.lineBreakRegex).length,t[e].width=l,t[e].height=ue(t[e].text,o);else{let a=t[e].text.split(Jt.lineBreakRegex);t[e].textLines=a.length;let r=0;t[e].height=0,t[e].width=0;for(const n of a)t[e].width=Math.max(Tt(n,o),t[e].width),r=ue(n,o),t[e].height=t[e].height+r}}g(j,"calcC4ShapeTextWH");var ve=g(function(e,t,s){t.x=s.data.startx,t.y=s.data.starty,t.width=s.data.stopx-s.data.startx,t.height=s.data.stopy-s.data.starty,t.label.y=_.c4ShapeMargin-35;let o=t.wrap&&_.wrap,l=Yt(_);l.fontSize=l.fontSize+2,l.fontWeight="bold";let a=Tt(t.label.text,l);j("label",t,o,l,a),z.drawBoundary(e,t,_)},"drawBoundary"),Ee=g(function(e,t,s,o){let l=0;for(const a of o){l=0;const r=s[a];let n=St(_,r.typeC4Shape.text);switch(n.fontSize=n.fontSize-2,r.typeC4Shape.width=Tt("«"+r.typeC4Shape.text+"»",n),r.typeC4Shape.height=n.fontSize+2,r.typeC4Shape.Y=_.c4ShapePadding,l=r.typeC4Shape.Y+r.typeC4Shape.height-4,r.image={width:0,height:0,Y:0},r.typeC4Shape.text){case"person":case"external_person":r.image.width=48,r.image.height=48,r.image.Y=l,l=r.image.Y+r.image.height;break}r.sprite&&(r.image.width=48,r.image.height=48,r.image.Y=l,l=r.image.Y+r.image.height);let i=r.wrap&&_.wrap,u=_.width-_.c4ShapePadding*2,d=St(_,r.typeC4Shape.text);if(d.fontSize=d.fontSize+2,d.fontWeight="bold",j("label",r,i,d,u),r.label.Y=l+8,l=r.label.Y+r.label.height,r.type&&r.type.text!==""){r.type.text="["+r.type.text+"]";let E=St(_,r.typeC4Shape.text);j("type",r,i,E,u),r.type.Y=l+5,l=r.type.Y+r.type.height}else if(r.techn&&r.techn.text!==""){r.techn.text="["+r.techn.text+"]";let E=St(_,r.techn.text);j("techn",r,i,E,u),r.techn.Y=l+5,l=r.techn.Y+r.techn.height}let y=l,p=r.label.width;if(r.descr&&r.descr.text!==""){let E=St(_,r.typeC4Shape.text);j("descr",r,i,E,u),r.descr.Y=l+20,l=r.descr.Y+r.descr.height,p=Math.max(r.label.width,r.descr.width),y=l-r.descr.textLines*5}p=p+_.c4ShapePadding,r.width=Math.max(r.width||_.width,p,_.width),r.height=Math.max(r.height||_.height,y,_.height),r.margin=r.margin||_.c4ShapeMargin,e.insert(r),z.drawC4Shape(t,r,_)}e.bumpLastMargin(_.c4ShapeMargin)},"drawC4ShapeArray"),Y=class{static{g(this,"Point")}constructor(e,t){this.x=e,this.y=t}},de=g(function(e,t){let s=e.x,o=e.y,l=t.x,a=t.y,r=s+e.width/2,n=o+e.height/2,i=Math.abs(s-l),u=Math.abs(o-a),d=u/i,y=e.height/e.width,p=null;return o==a&&sl?p=new Y(s,n):s==l&&oa&&(p=new Y(r,o)),s>l&&o=d?p=new Y(s,n+d*e.width/2):p=new Y(r-i/u*e.height/2,o+e.height):s=d?p=new Y(s+e.width,n+d*e.width/2):p=new Y(r+i/u*e.height/2,o+e.height):sa?y>=d?p=new Y(s+e.width,n-d*e.width/2):p=new Y(r+e.height/2*i/u,o):s>l&&o>a&&(y>=d?p=new Y(s,n-e.width/2*d):p=new Y(r-e.height/2*i/u,o)),p},"getIntersectPoint"),w0=g(function(e,t){let s={x:0,y:0};s.x=t.x+t.width/2,s.y=t.y+t.height/2;let o=de(e,s);s.x=e.x+e.width/2,s.y=e.y+e.height/2;let l=de(t,s);return{startPoint:o,endPoint:l}},"getIntersectPoints"),T0=g(function(e,t,s,o){let l=0;for(let a of t){l=l+1;let r=a.wrap&&_.wrap,n=C0(_);o.db.getC4Type()==="C4Dynamic"&&(a.label.text=l+": "+a.label.text);let u=Tt(a.label.text,n);j("label",a,r,n,u),a.techn&&a.techn.text!==""&&(u=Tt(a.techn.text,n),j("techn",a,r,n,u)),a.descr&&a.descr.text!==""&&(u=Tt(a.descr.text,n),j("descr",a,r,n,u));let d=s(a.from),y=s(a.to),p=w0(d,y);a.startPoint=p.startPoint,a.endPoint=p.endPoint}z.drawRels(e,t,_)},"drawRels");function ne(e,t,s,o,l){let a=new me(l);a.data.widthLimit=s.data.widthLimit/Math.min($t,o.length);for(let[r,n]of o.entries()){let i=0;n.image={width:0,height:0,Y:0},n.sprite&&(n.image.width=48,n.image.height=48,n.image.Y=i,i=n.image.Y+n.image.height);let u=n.wrap&&_.wrap,d=Yt(_);if(d.fontSize=d.fontSize+2,d.fontWeight="bold",j("label",n,u,d,a.data.widthLimit),n.label.Y=i+8,i=n.label.Y+n.label.height,n.type&&n.type.text!==""){n.type.text="["+n.type.text+"]";let O=Yt(_);j("type",n,u,O,a.data.widthLimit),n.type.Y=i+5,i=n.type.Y+n.type.height}if(n.descr&&n.descr.text!==""){let O=Yt(_);O.fontSize=O.fontSize-2,j("descr",n,u,O,a.data.widthLimit),n.descr.Y=i+20,i=n.descr.Y+n.descr.height}if(r==0||r%$t===0){let O=s.data.startx+_.diagramMarginX,S=s.data.stopy+_.diagramMarginY+i;a.setData(O,O,S,S)}else{let O=a.data.stopx!==a.data.startx?a.data.stopx+_.diagramMarginX:a.data.startx,S=a.data.starty;a.setData(O,O,S,S)}a.name=n.alias;let y=l.db.getC4ShapeArray(n.alias),p=l.db.getC4ShapeKeys(n.alias);p.length>0&&Ee(a,e,y,p),t=n.alias;let E=l.db.getBoundaries(t);E.length>0&&ne(e,t,a,E,l),n.alias!=="global"&&ve(e,n,a),s.data.stopy=Math.max(a.data.stopy+_.c4ShapeMargin,s.data.stopy),s.data.stopx=Math.max(a.data.stopx+_.c4ShapeMargin,s.data.stopx),Vt=Math.max(Vt,s.data.stopx),zt=Math.max(zt,s.data.stopy)}}g(ne,"drawInsideBoundary");var O0=g(function(e,t,s,o){_=Dt().c4;const l=Dt().securityLevel;let a;l==="sandbox"&&(a=Nt("#i"+t));const r=l==="sandbox"?Nt(a.nodes()[0].contentDocument.body):Nt("body");let n=o.db;o.db.setWrap(_.wrap),xe=n.getC4ShapeInRow(),$t=n.getC4BoundaryInRow(),he.debug(`C:${JSON.stringify(_,null,2)}`);const i=l==="sandbox"?r.select(`[id="${t}"]`):Nt(`[id="${t}"]`);z.insertComputerIcon(i),z.insertDatabaseIcon(i),z.insertClockIcon(i);let u=new me(o);u.setData(_.diagramMarginX,_.diagramMarginX,_.diagramMarginY,_.diagramMarginY),u.data.widthLimit=screen.availWidth,Vt=_.diagramMarginX,zt=_.diagramMarginY;const d=o.db.getTitle();let y=o.db.getBoundaries("");ne(i,"",u,y,o),z.insertArrowHead(i),z.insertArrowEnd(i),z.insertArrowCrossHead(i),z.insertArrowFilledHead(i),T0(i,o.db.getRels(),o.db.getC4Shape,o),u.data.stopx=Vt,u.data.stopy=zt;const p=u.data;let O=p.stopy-p.starty+2*_.diagramMarginY;const P=p.stopx-p.startx+2*_.diagramMarginX;d&&i.append("text").text(d).attr("x",(p.stopx-p.startx)/2-4*_.diagramMarginX).attr("y",p.starty+_.diagramMarginY),Ie(i,O,P,_.useMaxWidth);const M=d?60:0;i.attr("viewBox",p.startx-_.diagramMarginX+" -"+(_.diagramMarginY+M)+" "+P+" "+(O+M)),he.debug("models:",p)},"draw"),fe={drawPersonOrSystemArray:Ee,drawBoundary:ve,setConf:te,draw:O0},R0=g(e=>`.person { + stroke: ${e.personBorder}; + fill: ${e.personBkg}; + } +`,"getStyles"),S0=R0,Y0={parser:Ye,db:Zt,renderer:fe,styles:S0,init:g(({c4:e,wrap:t})=>{fe.setConf(e),Zt.setWrap(t)},"init")};export{Y0 as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ca-MwjfTPYe.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ca-MwjfTPYe.js new file mode 100644 index 0000000000000000000000000000000000000000..902eac507b9288b0c09c191ea6d6df38e796463a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ca-MwjfTPYe.js @@ -0,0 +1 @@ +const a="Català",e={annotated_image:"Imatge Anotada"},r={allow_recording_access:"Si us plau, permeteu l'accés al micròfon per gravar.",audio:"Àudio",record_from_microphone:"Gravar des del micròfon",stop_recording:"Aturar la gravació",no_device_support:"No s'ha pogut accedir als dispositius multimèdia. Comproveu que esteu executant en un origen segur (https) o localhost (o heu passat un certificat SSL vàlid a ssl_verify), i que heu permès l'accés del navegador al vostre dispositiu.",stop:"Aturar",resume:"Reprendre",record:"Gravar",no_microphone:"No s'ha trobat cap micròfon",pause:"Pausa",play:"Reproduir",waiting:"Esperant",drop_to_upload:"Arrossega un fitxer d'àudio aquí per pujar-lo"},o={connection_can_break:"En dispositius mòbils, la connexió es pot trencar si aquesta pestanya perd el focus o el dispositiu s'adorm, perdent la vostra posició a la cua.",long_requests_queue:"Hi ha una llarga cua de sol·licituds pendents. Dupliqueu aquest Space per saltar-la.",lost_connection:"S'ha perdut la connexió en deixar la pàgina. Tornant a la cua...",waiting_for_inputs:"Esperant la finalització de la pujada dels fitxers, si us plau, torna a provar."},i={checkbox:"Casella de selecció",checkbox_group:"Grup de caselles"},t={code:"Codi"},l={color_picker:"Selector de color"},s={built_with:"construït amb",built_with_gradio:"Construït amb Gradio",clear:"Neteja",download:"Descarregar",edit:"Editar",empty:"Buit",error:"Error",hosted_on:"Allotjat a",loading:"S'està carregant",logo:"logotip",or:"o",remove:"Eliminar",settings:"Configuració",share:"Compartir",submit:"Envia",undo:"Desfer",no_devices:"No s'han trobat dispositius",language:"Idioma",display_theme:"Tema de visualització",pwa:"Aplicació web progressiva"},n={incorrect_format:"Format incorrecte, només s'admeten fitxers CSV i TSV",new_column:"Afegir columna",new_row:"Nova fila",add_row_above:"Afegir fila a dalt",add_row_below:"Afegir fila a baix",add_column_left:"Afegir columna a l'esquerra",add_column_right:"Afegir columna a la dreta",delete_row:"Esborrar fila",delete_column:"Suprimeix la columna",sort_column:"Ordena la columna",sort_ascending:"Ordena ascendent",sort_descending:"Ordena descendent",drop_to_upload:"Arrossega fitxers CSV o TSV aquí per importar dades al dataframe",clear_sort:"Neteja la classificació"},c={dropdown:"Desplegable"},d={build_error:"hi ha un error de compilació",config_error:"hi ha un error de configuració",contact_page_author:"Si us plau, contacteu amb l'autor de la pàgina per informar-lo.",no_app_file:"no hi ha fitxer d'aplicació",runtime_error:"hi ha un error d'execució",space_not_working:`"L'Space no funciona perquè" {0}`,space_paused:"l'space està en pausa",use_via_api:"Utilitzar via API"},u={uploading:"Pujant..."},p={highlighted_text:"Text ressaltat"},_={allow_webcam_access:"Si us plau, permeteu l'accés a la càmera web per gravar.",brush_color:"Color del pinzell",brush_radius:"Radi del pinzell",image:"Imatge",remove_image:"Eliminar imatge",select_brush_color:"Seleccionar color del pinzell",start_drawing:"Començar a dibuixar",use_brush:"Utilitzar pinzell",drop_to_upload:"Arrossega un fitxer d'imatge aquí per pujar-lo"},m={label:"Etiqueta"},g={enable_cookies:"Si esteu visitant un Space de HuggingFace en mode Incògnit, heu d'habilitar les cookies de tercers.",incorrect_credentials:"Credencials incorrectes",username:"nom d'usuari",password:"contrasenya",login:"Iniciar sessió"},f={number:"Número"},h={plot:"Gràfic"},b={radio:"Ràdio"},x={slider:"Control lliscant"},v={click_to_upload:"Feu clic per pujar",drop_audio:"Deixeu anar l'àudio aquí",drop_csv:"Deixeu anar el CSV aquí",drop_file:"Deixeu anar el fitxer aquí",drop_image:"Deixeu anar la imatge aquí",drop_video:"Deixeu anar el vídeo aquí",drop_gallery:"Deixeu anar els mitjans aquí",paste_clipboard:"Enganxar del porta-retalls"},w={drop_to_upload:"Arrossega un fitxer de vídeo aquí per pujar-lo"},q={edit:"Editar",retry:"Tornar a provar",undo:"Desfer",submit:"Enviar",cancel:"Cancel·lar",like:"M'agrada",dislike:"No m'agrada",clear:"Netejar xat"},S={_name:a,"3D_model":{"3d_model":"Model 3D",drop_to_upload:"Arrossega un model 3D (.obj, .glb, .stl, .gltf, .splat o .ply) aquí per pujar-lo."},annotated_image:e,audio:r,blocks:o,checkbox:i,code:t,color_picker:l,common:s,dataframe:n,dropdown:c,errors:d,file:u,highlighted_text:p,image:_,label:m,login:g,number:f,plot:h,radio:b,slider:x,upload_text:v,video:w,chatbot:q};export{a as _name,e as annotated_image,r as audio,o as blocks,q as chatbot,i as checkbox,t as code,l as color_picker,s as common,n as dataframe,S as default,c as dropdown,d as errors,u as file,p as highlighted_text,_ as image,m as label,g as login,f as number,h as plot,b as radio,x as slider,v as upload_text,w as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/channel-CA-Tyyit.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/channel-CA-Tyyit.js new file mode 100644 index 0000000000000000000000000000000000000000..2cbd14d0576de50e6106e528ebeda96b067570c8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/channel-CA-Tyyit.js @@ -0,0 +1 @@ +import{U as a,C as n}from"./mermaid.core-7TB2QPZo.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-4BX2VUAB-Zuu4IE0p.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-4BX2VUAB-Zuu4IE0p.js new file mode 100644 index 0000000000000000000000000000000000000000..fa2f5fd3d83c53e5735e1c29193a01f997826eee --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-4BX2VUAB-Zuu4IE0p.js @@ -0,0 +1 @@ +import{_ as i}from"./mermaid.core-7TB2QPZo.js";function t(c,e){c.accDescr&&e.setAccDescription?.(c.accDescr),c.accTitle&&e.setAccTitle?.(c.accTitle),c.title&&e.setDiagramTitle?.(c.title)}i(t,"populateCommonDb");export{t as p}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-55IACEB6-d9HCWWHk.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-55IACEB6-d9HCWWHk.js new file mode 100644 index 0000000000000000000000000000000000000000..a438e877b51262ffd05912252b56fbdf0085d7ce --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-55IACEB6-d9HCWWHk.js @@ -0,0 +1 @@ +import{_ as s}from"./mermaid.core-7TB2QPZo.js";import{s as o}from"./select-BigU4G0v.js";var d=s((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-B4BG7PRW-D5EXR74z.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-B4BG7PRW-D5EXR74z.js new file mode 100644 index 0000000000000000000000000000000000000000..f029cce32b7fb4b5d72518aa0805689b5a2cbbcb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-B4BG7PRW-D5EXR74z.js @@ -0,0 +1,165 @@ +import{g as Ze}from"./chunk-FMBD7UC4-DNqeu8Dh.js";import{g as $e}from"./chunk-55IACEB6-d9HCWWHk.js";import{s as et}from"./chunk-QN33PNHL-w0eYMV5T.js";import{_ as p,l as ve,c as D,o as tt,r as st,u as Ie,b as it,a as at,s as nt,g as rt,p as ut,q as lt,j as x,y as ot,x as ct,h as ht,R as M}from"./mermaid.core-7TB2QPZo.js";import{s as J}from"./select-BigU4G0v.js";var Oe=(function(){var e=p(function(v,l,o,d){for(o=o||{},d=v.length;d--;o[v[d]]=l);return o},"o"),i=[1,18],r=[1,19],u=[1,20],a=[1,41],c=[1,42],A=[1,26],f=[1,24],k=[1,25],_=[1,32],he=[1,33],de=[1,34],m=[1,45],pe=[1,35],Ae=[1,36],fe=[1,37],ge=[1,38],me=[1,27],Ce=[1,28],be=[1,29],Ee=[1,30],ye=[1,31],C=[1,44],b=[1,46],E=[1,43],y=[1,47],Te=[1,9],h=[1,8,9],Z=[1,58],$=[1,59],ee=[1,60],te=[1,61],se=[1,62],ke=[1,63],De=[1,64],R=[1,8,9,41],we=[1,76],V=[1,8,9,12,13,22,39,41,44,68,69,70,71,72,73,74,79,81],ie=[1,8,9,12,13,18,20,22,39,41,44,50,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ae=[13,60,86,100,102,103],G=[13,60,73,74,86,100,102,103],Ve=[13,60,68,69,70,71,72,86,100,102,103],Fe=[1,100],U=[1,117],z=[1,113],K=[1,109],Y=[1,115],j=[1,110],Q=[1,111],W=[1,112],X=[1,114],q=[1,116],Pe=[22,48,60,61,82,86,87,88,89,90],Be=[1,8,9,39,41,44],ne=[1,8,9,22],Me=[1,145],Re=[1,8,9,61],N=[1,8,9,22,48,60,61,82,86,87,88,89,90],_e={trace:p(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,CLASS:46,emptyBody:47,SPACE:48,ANNOTATION_START:49,ANNOTATION_END:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"CLASS",48:"SPACE",49:"ANNOTATION_START",50:"ANNOTATION_END",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[43,2],[43,3],[47,0],[47,2],[47,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:p(function(l,o,d,n,g,t,H){var s=t.length-1;switch(g){case 8:this.$=t[s-1];break;case 9:case 10:case 13:case 15:this.$=t[s];break;case 11:case 14:this.$=t[s-2]+"."+t[s];break;case 12:case 16:this.$=t[s-1]+t[s];break;case 17:case 18:this.$=t[s-1]+"~"+t[s]+"~";break;case 19:n.addRelation(t[s]);break;case 20:t[s-1].title=n.cleanupLabel(t[s]),n.addRelation(t[s-1]);break;case 31:this.$=t[s].trim(),n.setAccTitle(this.$);break;case 32:case 33:this.$=t[s].trim(),n.setAccDescription(this.$);break;case 34:n.addClassesToNamespace(t[s-3],t[s-1]);break;case 35:n.addClassesToNamespace(t[s-4],t[s-1]);break;case 36:this.$=t[s],n.addNamespace(t[s]);break;case 37:this.$=[t[s]];break;case 38:this.$=[t[s-1]];break;case 39:t[s].unshift(t[s-2]),this.$=t[s];break;case 41:n.setCssClass(t[s-2],t[s]);break;case 42:n.addMembers(t[s-3],t[s-1]);break;case 44:n.setCssClass(t[s-5],t[s-3]),n.addMembers(t[s-5],t[s-1]);break;case 45:this.$=t[s],n.addClass(t[s]);break;case 46:this.$=t[s-1],n.addClass(t[s-1]),n.setClassLabel(t[s-1],t[s]);break;case 50:n.addAnnotation(t[s],t[s-2]);break;case 51:case 64:this.$=[t[s]];break;case 52:t[s].push(t[s-1]),this.$=t[s];break;case 53:break;case 54:n.addMember(t[s-1],n.cleanupLabel(t[s]));break;case 55:break;case 56:break;case 57:this.$={id1:t[s-2],id2:t[s],relation:t[s-1],relationTitle1:"none",relationTitle2:"none"};break;case 58:this.$={id1:t[s-3],id2:t[s],relation:t[s-1],relationTitle1:t[s-2],relationTitle2:"none"};break;case 59:this.$={id1:t[s-3],id2:t[s],relation:t[s-2],relationTitle1:"none",relationTitle2:t[s-1]};break;case 60:this.$={id1:t[s-4],id2:t[s],relation:t[s-2],relationTitle1:t[s-3],relationTitle2:t[s-1]};break;case 61:n.addNote(t[s],t[s-1]);break;case 62:n.addNote(t[s]);break;case 63:this.$=t[s-2],n.defineClass(t[s-1],t[s]);break;case 65:this.$=t[s-2].concat([t[s]]);break;case 66:n.setDirection("TB");break;case 67:n.setDirection("BT");break;case 68:n.setDirection("RL");break;case 69:n.setDirection("LR");break;case 70:this.$={type1:t[s-2],type2:t[s],lineType:t[s-1]};break;case 71:this.$={type1:"none",type2:t[s],lineType:t[s-1]};break;case 72:this.$={type1:t[s-1],type2:"none",lineType:t[s]};break;case 73:this.$={type1:"none",type2:"none",lineType:t[s]};break;case 74:this.$=n.relationType.AGGREGATION;break;case 75:this.$=n.relationType.EXTENSION;break;case 76:this.$=n.relationType.COMPOSITION;break;case 77:this.$=n.relationType.DEPENDENCY;break;case 78:this.$=n.relationType.LOLLIPOP;break;case 79:this.$=n.lineType.LINE;break;case 80:this.$=n.lineType.DOTTED_LINE;break;case 81:case 87:this.$=t[s-2],n.setClickEvent(t[s-1],t[s]);break;case 82:case 88:this.$=t[s-3],n.setClickEvent(t[s-2],t[s-1]),n.setTooltip(t[s-2],t[s]);break;case 83:this.$=t[s-2],n.setLink(t[s-1],t[s]);break;case 84:this.$=t[s-3],n.setLink(t[s-2],t[s-1],t[s]);break;case 85:this.$=t[s-3],n.setLink(t[s-2],t[s-1]),n.setTooltip(t[s-2],t[s]);break;case 86:this.$=t[s-4],n.setLink(t[s-3],t[s-2],t[s]),n.setTooltip(t[s-3],t[s-1]);break;case 89:this.$=t[s-3],n.setClickEvent(t[s-2],t[s-1],t[s]);break;case 90:this.$=t[s-4],n.setClickEvent(t[s-3],t[s-2],t[s-1]),n.setTooltip(t[s-3],t[s]);break;case 91:this.$=t[s-3],n.setLink(t[s-2],t[s]);break;case 92:this.$=t[s-4],n.setLink(t[s-3],t[s-1],t[s]);break;case 93:this.$=t[s-4],n.setLink(t[s-3],t[s-1]),n.setTooltip(t[s-3],t[s]);break;case 94:this.$=t[s-5],n.setLink(t[s-4],t[s-2],t[s]),n.setTooltip(t[s-4],t[s-1]);break;case 95:this.$=t[s-2],n.setCssStyle(t[s-1],t[s]);break;case 96:n.setCssClass(t[s-1],t[s]);break;case 97:this.$=[t[s]];break;case 98:t[s-2].push(t[s]),this.$=t[s-2];break;case 100:this.$=t[s-1]+t[s];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:r,37:u,38:22,42:a,43:23,46:c,49:A,51:f,52:k,54:_,56:he,57:de,60:m,62:pe,63:Ae,64:fe,65:ge,75:me,76:Ce,78:be,82:Ee,83:ye,86:C,100:b,102:E,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},e(Te,[2,5],{8:[1,48]}),{8:[1,49]},e(h,[2,19],{22:[1,50]}),e(h,[2,21]),e(h,[2,22]),e(h,[2,23]),e(h,[2,24]),e(h,[2,25]),e(h,[2,26]),e(h,[2,27]),e(h,[2,28]),e(h,[2,29]),e(h,[2,30]),{34:[1,51]},{36:[1,52]},e(h,[2,33]),e(h,[2,53],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:Z,69:$,70:ee,71:te,72:se,73:ke,74:De}),{39:[1,65]},e(R,[2,40],{39:[1,67],44:[1,66]}),e(h,[2,55]),e(h,[2,56]),{16:68,60:m,86:C,100:b,102:E},{16:39,17:40,19:69,60:m,86:C,100:b,102:E,103:y},{16:39,17:40,19:70,60:m,86:C,100:b,102:E,103:y},{16:39,17:40,19:71,60:m,86:C,100:b,102:E,103:y},{60:[1,72]},{13:[1,73]},{16:39,17:40,19:74,60:m,86:C,100:b,102:E,103:y},{13:we,55:75},{58:77,60:[1,78]},e(h,[2,66]),e(h,[2,67]),e(h,[2,68]),e(h,[2,69]),e(V,[2,13],{16:39,17:40,19:80,18:[1,79],20:[1,81],60:m,86:C,100:b,102:E,103:y}),e(V,[2,15],{20:[1,82]}),{15:83,16:84,17:85,60:m,86:C,100:b,102:E,103:y},{16:39,17:40,19:86,60:m,86:C,100:b,102:E,103:y},e(ie,[2,123]),e(ie,[2,124]),e(ie,[2,125]),e(ie,[2,126]),e([1,8,9,12,13,20,22,39,41,44,68,69,70,71,72,73,74,79,81],[2,127]),e(Te,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:87,33:i,35:r,37:u,42:a,46:c,49:A,51:f,52:k,54:_,56:he,57:de,60:m,62:pe,63:Ae,64:fe,65:ge,75:me,76:Ce,78:be,82:Ee,83:ye,86:C,100:b,102:E,103:y}),{5:88,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:r,37:u,38:22,42:a,43:23,46:c,49:A,51:f,52:k,54:_,56:he,57:de,60:m,62:pe,63:Ae,64:fe,65:ge,75:me,76:Ce,78:be,82:Ee,83:ye,86:C,100:b,102:E,103:y},e(h,[2,20]),e(h,[2,31]),e(h,[2,32]),{13:[1,90],16:39,17:40,19:89,60:m,86:C,100:b,102:E,103:y},{53:91,66:56,67:57,68:Z,69:$,70:ee,71:te,72:se,73:ke,74:De},e(h,[2,54]),{67:92,73:ke,74:De},e(ae,[2,73],{66:93,68:Z,69:$,70:ee,71:te,72:se}),e(G,[2,74]),e(G,[2,75]),e(G,[2,76]),e(G,[2,77]),e(G,[2,78]),e(Ve,[2,79]),e(Ve,[2,80]),{8:[1,95],24:96,40:94,43:23,46:c},{16:97,60:m,86:C,100:b,102:E},{41:[1,99],45:98,51:Fe},{50:[1,101]},{13:[1,102]},{13:[1,103]},{79:[1,104],81:[1,105]},{22:U,48:z,59:106,60:K,82:Y,84:107,85:108,86:j,87:Q,88:W,89:X,90:q},{60:[1,118]},{13:we,55:119},e(h,[2,62]),e(h,[2,128]),{22:U,48:z,59:120,60:K,61:[1,121],82:Y,84:107,85:108,86:j,87:Q,88:W,89:X,90:q},e(Pe,[2,64]),{16:39,17:40,19:122,60:m,86:C,100:b,102:E,103:y},e(V,[2,16]),e(V,[2,17]),e(V,[2,18]),{39:[2,36]},{15:124,16:84,17:85,18:[1,123],39:[2,9],60:m,86:C,100:b,102:E,103:y},{39:[2,10]},e(Be,[2,45],{11:125,12:[1,126]}),e(Te,[2,7]),{9:[1,127]},e(ne,[2,57]),{16:39,17:40,19:128,60:m,86:C,100:b,102:E,103:y},{13:[1,130],16:39,17:40,19:129,60:m,86:C,100:b,102:E,103:y},e(ae,[2,72],{66:131,68:Z,69:$,70:ee,71:te,72:se}),e(ae,[2,71]),{41:[1,132]},{24:96,40:133,43:23,46:c},{8:[1,134],41:[2,37]},e(R,[2,41],{39:[1,135]}),{41:[1,136]},e(R,[2,43]),{41:[2,51],45:137,51:Fe},{16:39,17:40,19:138,60:m,86:C,100:b,102:E,103:y},e(h,[2,81],{13:[1,139]}),e(h,[2,83],{13:[1,141],77:[1,140]}),e(h,[2,87],{13:[1,142],80:[1,143]}),{13:[1,144]},e(h,[2,95],{61:Me}),e(Re,[2,97],{85:146,22:U,48:z,60:K,82:Y,86:j,87:Q,88:W,89:X,90:q}),e(N,[2,99]),e(N,[2,101]),e(N,[2,102]),e(N,[2,103]),e(N,[2,104]),e(N,[2,105]),e(N,[2,106]),e(N,[2,107]),e(N,[2,108]),e(N,[2,109]),e(h,[2,96]),e(h,[2,61]),e(h,[2,63],{61:Me}),{60:[1,147]},e(V,[2,14]),{15:148,16:84,17:85,60:m,86:C,100:b,102:E,103:y},{39:[2,12]},e(Be,[2,46]),{13:[1,149]},{1:[2,4]},e(ne,[2,59]),e(ne,[2,58]),{16:39,17:40,19:150,60:m,86:C,100:b,102:E,103:y},e(ae,[2,70]),e(h,[2,34]),{41:[1,151]},{24:96,40:152,41:[2,38],43:23,46:c},{45:153,51:Fe},e(R,[2,42]),{41:[2,52]},e(h,[2,50]),e(h,[2,82]),e(h,[2,84]),e(h,[2,85],{77:[1,154]}),e(h,[2,88]),e(h,[2,89],{13:[1,155]}),e(h,[2,91],{13:[1,157],77:[1,156]}),{22:U,48:z,60:K,82:Y,84:158,85:108,86:j,87:Q,88:W,89:X,90:q},e(N,[2,100]),e(Pe,[2,65]),{39:[2,11]},{14:[1,159]},e(ne,[2,60]),e(h,[2,35]),{41:[2,39]},{41:[1,160]},e(h,[2,86]),e(h,[2,90]),e(h,[2,92]),e(h,[2,93],{77:[1,161]}),e(Re,[2,98],{85:146,22:U,48:z,60:K,82:Y,86:j,87:Q,88:W,89:X,90:q}),e(Be,[2,8]),e(R,[2,44]),e(h,[2,94])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],83:[2,36],85:[2,10],124:[2,12],127:[2,4],137:[2,52],148:[2,11],152:[2,39]},parseError:p(function(l,o){if(o.recoverable)this.trace(l);else{var d=new Error(l);throw d.hash=o,d}},"parseError"),parse:p(function(l){var o=this,d=[0],n=[],g=[null],t=[],H=this.table,s="",ue=0,Ge=0,Xe=2,Ue=1,qe=t.slice.call(arguments,1),T=Object.create(this.lexer),I={yy:{}};for(var Se in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Se)&&(I.yy[Se]=this.yy[Se]);T.setInput(l,I.yy),I.yy.lexer=T,I.yy.parser=this,typeof T.yylloc>"u"&&(T.yylloc={});var Ne=T.yylloc;t.push(Ne);var He=T.options&&T.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Je(B){d.length=d.length-2*B,g.length=g.length-B,t.length=t.length-B}p(Je,"popStack");function ze(){var B;return B=n.pop()||T.lex()||Ue,typeof B!="number"&&(B instanceof Array&&(n=B,B=n.pop()),B=o.symbols_[B]||B),B}p(ze,"lex");for(var F,O,S,Le,P={},le,L,Ke,oe;;){if(O=d[d.length-1],this.defaultActions[O]?S=this.defaultActions[O]:((F===null||typeof F>"u")&&(F=ze()),S=H[O]&&H[O][F]),typeof S>"u"||!S.length||!S[0]){var xe="";oe=[];for(le in H[O])this.terminals_[le]&&le>Xe&&oe.push("'"+this.terminals_[le]+"'");T.showPosition?xe="Parse error on line "+(ue+1)+`: +`+T.showPosition()+` +Expecting `+oe.join(", ")+", got '"+(this.terminals_[F]||F)+"'":xe="Parse error on line "+(ue+1)+": Unexpected "+(F==Ue?"end of input":"'"+(this.terminals_[F]||F)+"'"),this.parseError(xe,{text:T.match,token:this.terminals_[F]||F,line:T.yylineno,loc:Ne,expected:oe})}if(S[0]instanceof Array&&S.length>1)throw new Error("Parse Error: multiple actions possible at state: "+O+", token: "+F);switch(S[0]){case 1:d.push(F),g.push(T.yytext),t.push(T.yylloc),d.push(S[1]),F=null,Ge=T.yyleng,s=T.yytext,ue=T.yylineno,Ne=T.yylloc;break;case 2:if(L=this.productions_[S[1]][1],P.$=g[g.length-L],P._$={first_line:t[t.length-(L||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(L||1)].first_column,last_column:t[t.length-1].last_column},He&&(P._$.range=[t[t.length-(L||1)].range[0],t[t.length-1].range[1]]),Le=this.performAction.apply(P,[s,Ge,ue,I.yy,S[1],g,t].concat(qe)),typeof Le<"u")return Le;L&&(d=d.slice(0,-1*L*2),g=g.slice(0,-1*L),t=t.slice(0,-1*L)),d.push(this.productions_[S[1]][0]),g.push(P.$),t.push(P._$),Ke=H[d[d.length-2]][d[d.length-1]],d.push(Ke);break;case 3:return!0}}return!0},"parse")},We=(function(){var v={EOF:1,parseError:p(function(o,d){if(this.yy.parser)this.yy.parser.parseError(o,d);else throw new Error(o)},"parseError"),setInput:p(function(l,o){return this.yy=o||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:p(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var o=l.match(/(?:\r\n?|\n).*/g);return o?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:p(function(l){var o=l.length,d=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-o),this.offset-=o;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1&&(this.yylineno-=d.length-1);var g=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===n.length?this.yylloc.first_column:0)+n[n.length-d.length].length-d[0].length:this.yylloc.first_column-o},this.options.ranges&&(this.yylloc.range=[g[0],g[0]+this.yyleng-o]),this.yyleng=this.yytext.length,this},"unput"),more:p(function(){return this._more=!0,this},"more"),reject:p(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:p(function(l){this.unput(this.match.slice(l))},"less"),pastInput:p(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:p(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:p(function(){var l=this.pastInput(),o=new Array(l.length+1).join("-");return l+this.upcomingInput()+` +`+o+"^"},"showPosition"),test_match:p(function(l,o){var d,n,g;if(this.options.backtrack_lexer&&(g={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(g.yylloc.range=this.yylloc.range.slice(0))),n=l[0].match(/(?:\r\n?|\n).*/g),n&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+l[0].length},this.yytext+=l[0],this.match+=l[0],this.matches=l,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(l[0].length),this.matched+=l[0],d=this.performAction.call(this,this.yy,this,o,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),d)return d;if(this._backtrack){for(var t in g)this[t]=g[t];return!1}return!1},"test_match"),next:p(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var l,o,d,n;this._more||(this.yytext="",this.match="");for(var g=this._currentRules(),t=0;to[0].length)){if(o=d,n=t,this.options.backtrack_lexer){if(l=this.test_match(d,g[t]),l!==!1)return l;if(this._backtrack){o=!1;continue}else return!1}else if(!this.options.flex)break}return o?(l=this.test_match(o,g[n]),l!==!1?l:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:p(function(){var o=this.next();return o||this.lex()},"lex"),begin:p(function(o){this.conditionStack.push(o)},"begin"),popState:p(function(){var o=this.conditionStack.length-1;return o>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:p(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:p(function(o){return o=this.conditionStack.length-1-Math.abs(o||0),o>=0?this.conditionStack[o]:"INITIAL"},"topState"),pushState:p(function(o){this.begin(o)},"pushState"),stateStackSize:p(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:p(function(o,d,n,g){switch(n){case 0:return 62;case 1:return 63;case 2:return 64;case 3:return 65;case 4:break;case 5:break;case 6:return this.begin("acc_title"),33;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),35;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 8;case 14:break;case 15:return 7;case 16:return 7;case 17:return"EDGE_STATE";case 18:this.begin("callback_name");break;case 19:this.popState();break;case 20:this.popState(),this.begin("callback_args");break;case 21:return 79;case 22:this.popState();break;case 23:return 80;case 24:this.popState();break;case 25:return"STR";case 26:this.begin("string");break;case 27:return 82;case 28:return 57;case 29:return this.begin("namespace"),42;case 30:return this.popState(),8;case 31:break;case 32:return this.begin("namespace-body"),39;case 33:return this.popState(),41;case 34:return"EOF_IN_STRUCT";case 35:return 8;case 36:break;case 37:return"EDGE_STATE";case 38:return this.begin("class"),46;case 39:return this.popState(),8;case 40:break;case 41:return this.popState(),this.popState(),41;case 42:return this.begin("class-body"),39;case 43:return this.popState(),41;case 44:return"EOF_IN_STRUCT";case 45:return"EDGE_STATE";case 46:return"OPEN_IN_STRUCT";case 47:break;case 48:return"MEMBER";case 49:return 83;case 50:return 75;case 51:return 76;case 52:return 78;case 53:return 54;case 54:return 56;case 55:return 49;case 56:return 50;case 57:return 81;case 58:this.popState();break;case 59:return"GENERICTYPE";case 60:this.begin("generic");break;case 61:this.popState();break;case 62:return"BQUOTE_STR";case 63:this.begin("bqstring");break;case 64:return 77;case 65:return 77;case 66:return 77;case 67:return 77;case 68:return 69;case 69:return 69;case 70:return 71;case 71:return 71;case 72:return 70;case 73:return 68;case 74:return 72;case 75:return 73;case 76:return 74;case 77:return 22;case 78:return 44;case 79:return 100;case 80:return 18;case 81:return"PLUS";case 82:return 87;case 83:return 61;case 84:return 89;case 85:return 89;case 86:return 90;case 87:return"EQUALS";case 88:return"EQUALS";case 89:return 60;case 90:return 12;case 91:return 14;case 92:return"PUNCTUATION";case 93:return 86;case 94:return 102;case 95:return 48;case 96:return 48;case 97:return 9}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:\[\*\])/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:["])/,/^(?:[^"]*)/,/^(?:["])/,/^(?:style\b)/,/^(?:classDef\b)/,/^(?:namespace\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:\[\*\])/,/^(?:class\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[}])/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\[\*\])/,/^(?:[{])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:note for\b)/,/^(?:note\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:href\b)/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:~)/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:[`])/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:\s*\(\))/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?::)/,/^(?:,)/,/^(?:#)/,/^(?:#)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:\[)/,/^(?:\])/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:\s)/,/^(?:$)/],conditions:{"namespace-body":{rules:[26,33,34,35,36,37,38,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},namespace:{rules:[26,29,30,31,32,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},"class-body":{rules:[26,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},class:{rules:[26,39,40,41,42,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_descr_multiline:{rules:[11,12,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_descr:{rules:[9,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_title:{rules:[7,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},callback_args:{rules:[22,23,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},callback_name:{rules:[19,20,21,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},href:{rules:[26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},struct:{rules:[26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},generic:{rules:[26,49,50,51,52,53,54,55,56,57,58,59,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},bqstring:{rules:[26,49,50,51,52,53,54,55,56,57,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},string:{rules:[24,25,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,26,27,28,29,38,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97],inclusive:!0}}};return v})();_e.lexer=We;function re(){this.yy={}}return p(re,"Parser"),re.prototype=_e,_e.Parser=re,new re})();Oe.parser=Oe;var yt=Oe,Ye=["#","+","~","-",""],je=class{static{p(this,"ClassMember")}constructor(e,i){this.memberType=i,this.visibility="",this.classifier="",this.text="";const r=ht(e,D());this.parseMember(r)}getDisplayDetails(){let e=this.visibility+M(this.id);this.memberType==="method"&&(e+=`(${M(this.parameters.trim())})`,this.returnType&&(e+=" : "+M(this.returnType))),e=e.trim();const i=this.parseClassifier();return{displayText:e,cssStyle:i}}parseMember(e){let i="";if(this.memberType==="method"){const a=/([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/.exec(e);if(a){const c=a[1]?a[1].trim():"";if(Ye.includes(c)&&(this.visibility=c),this.id=a[2],this.parameters=a[3]?a[3].trim():"",i=a[4]?a[4].trim():"",this.returnType=a[5]?a[5].trim():"",i===""){const A=this.returnType.substring(this.returnType.length-1);/[$*]/.exec(A)&&(i=A,this.returnType=this.returnType.substring(0,this.returnType.length-1))}}}else{const u=e.length,a=e.substring(0,1),c=e.substring(u-1);Ye.includes(a)&&(this.visibility=a),/[$*]/.exec(c)&&(i=c),this.id=e.substring(this.visibility===""?0:1,i===""?u:u-1)}this.classifier=i,this.id=this.id.startsWith(" ")?" "+this.id.trim():this.id.trim();const r=`${this.visibility?"\\"+this.visibility:""}${M(this.id)}${this.memberType==="method"?`(${M(this.parameters)})${this.returnType?" : "+M(this.returnType):""}`:""}`;this.text=r.replaceAll("<","<").replaceAll(">",">"),this.text.startsWith("\\<")&&(this.text=this.text.replace("\\<","~"))}parseClassifier(){switch(this.classifier){case"*":return"font-style:italic;";case"$":return"text-decoration:underline;";default:return""}}},ce="classId-",Qe=0,w=p(e=>x.sanitizeText(e,D()),"sanitizeText"),Tt=class{constructor(){this.relations=[],this.classes=new Map,this.styleClasses=new Map,this.notes=[],this.interfaces=[],this.namespaces=new Map,this.namespaceCounter=0,this.functions=[],this.lineType={LINE:0,DOTTED_LINE:1},this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},this.setupToolTips=p(e=>{let i=J(".mermaidTooltip");(i._groups||i)[0][0]===null&&(i=J("body").append("div").attr("class","mermaidTooltip").style("opacity",0)),J(e).select("svg").selectAll("g.node").on("mouseover",a=>{const c=J(a.currentTarget);if(c.attr("title")===null)return;const f=this.getBoundingClientRect();i.transition().duration(200).style("opacity",".9"),i.text(c.attr("title")).style("left",window.scrollX+f.left+(f.right-f.left)/2+"px").style("top",window.scrollY+f.top-14+document.body.scrollTop+"px"),i.html(i.html().replace(/<br\/>/g,"
          ")),c.classed("hover",!0)}).on("mouseout",a=>{i.transition().duration(500).style("opacity",0),J(a.currentTarget).classed("hover",!1)})},"setupToolTips"),this.direction="TB",this.setAccTitle=it,this.getAccTitle=at,this.setAccDescription=nt,this.getAccDescription=rt,this.setDiagramTitle=ut,this.getDiagramTitle=lt,this.getConfig=p(()=>D().class,"getConfig"),this.functions.push(this.setupToolTips.bind(this)),this.clear(),this.addRelation=this.addRelation.bind(this),this.addClassesToNamespace=this.addClassesToNamespace.bind(this),this.addNamespace=this.addNamespace.bind(this),this.setCssClass=this.setCssClass.bind(this),this.addMembers=this.addMembers.bind(this),this.addClass=this.addClass.bind(this),this.setClassLabel=this.setClassLabel.bind(this),this.addAnnotation=this.addAnnotation.bind(this),this.addMember=this.addMember.bind(this),this.cleanupLabel=this.cleanupLabel.bind(this),this.addNote=this.addNote.bind(this),this.defineClass=this.defineClass.bind(this),this.setDirection=this.setDirection.bind(this),this.setLink=this.setLink.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.clear=this.clear.bind(this),this.setTooltip=this.setTooltip.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setCssStyle=this.setCssStyle.bind(this)}static{p(this,"ClassDB")}splitClassNameAndType(e){const i=x.sanitizeText(e,D());let r="",u=i;if(i.indexOf("~")>0){const a=i.split("~");u=w(a[0]),r=w(a[1])}return{className:u,type:r}}setClassLabel(e,i){const r=x.sanitizeText(e,D());i&&(i=w(i));const{className:u}=this.splitClassNameAndType(r);this.classes.get(u).label=i,this.classes.get(u).text=`${i}${this.classes.get(u).type?`<${this.classes.get(u).type}>`:""}`}addClass(e){const i=x.sanitizeText(e,D()),{className:r,type:u}=this.splitClassNameAndType(i);if(this.classes.has(r))return;const a=x.sanitizeText(r,D());this.classes.set(a,{id:a,type:u,label:a,text:`${a}${u?`<${u}>`:""}`,shape:"classBox",cssClasses:"default",methods:[],members:[],annotations:[],styles:[],domId:ce+a+"-"+Qe}),Qe++}addInterface(e,i){const r={id:`interface${this.interfaces.length}`,label:e,classId:i};this.interfaces.push(r)}lookUpDomId(e){const i=x.sanitizeText(e,D());if(this.classes.has(i))return this.classes.get(i).domId;throw new Error("Class not found: "+i)}clear(){this.relations=[],this.classes=new Map,this.notes=[],this.interfaces=[],this.functions=[],this.functions.push(this.setupToolTips.bind(this)),this.namespaces=new Map,this.namespaceCounter=0,this.direction="TB",ot()}getClass(e){return this.classes.get(e)}getClasses(){return this.classes}getRelations(){return this.relations}getNotes(){return this.notes}addRelation(e){ve.debug("Adding relation: "+JSON.stringify(e));const i=[this.relationType.LOLLIPOP,this.relationType.AGGREGATION,this.relationType.COMPOSITION,this.relationType.DEPENDENCY,this.relationType.EXTENSION];e.relation.type1===this.relationType.LOLLIPOP&&!i.includes(e.relation.type2)?(this.addClass(e.id2),this.addInterface(e.id1,e.id2),e.id1=`interface${this.interfaces.length-1}`):e.relation.type2===this.relationType.LOLLIPOP&&!i.includes(e.relation.type1)?(this.addClass(e.id1),this.addInterface(e.id2,e.id1),e.id2=`interface${this.interfaces.length-1}`):(this.addClass(e.id1),this.addClass(e.id2)),e.id1=this.splitClassNameAndType(e.id1).className,e.id2=this.splitClassNameAndType(e.id2).className,e.relationTitle1=x.sanitizeText(e.relationTitle1.trim(),D()),e.relationTitle2=x.sanitizeText(e.relationTitle2.trim(),D()),this.relations.push(e)}addAnnotation(e,i){const r=this.splitClassNameAndType(e).className;this.classes.get(r).annotations.push(i)}addMember(e,i){this.addClass(e);const r=this.splitClassNameAndType(e).className,u=this.classes.get(r);if(typeof i=="string"){const a=i.trim();a.startsWith("<<")&&a.endsWith(">>")?u.annotations.push(w(a.substring(2,a.length-2))):a.indexOf(")")>0?u.methods.push(new je(a,"method")):a&&u.members.push(new je(a,"attribute"))}}addMembers(e,i){Array.isArray(i)&&(i.reverse(),i.forEach(r=>this.addMember(e,r)))}addNote(e,i){const r={id:`note${this.notes.length}`,class:i,text:e};this.notes.push(r)}cleanupLabel(e){return e.startsWith(":")&&(e=e.substring(1)),w(e.trim())}setCssClass(e,i){e.split(",").forEach(r=>{let u=r;/\d/.exec(r[0])&&(u=ce+u);const a=this.classes.get(u);a&&(a.cssClasses+=" "+i)})}defineClass(e,i){for(const r of e){let u=this.styleClasses.get(r);u===void 0&&(u={id:r,styles:[],textStyles:[]},this.styleClasses.set(r,u)),i&&i.forEach(a=>{if(/color/.exec(a)){const c=a.replace("fill","bgFill");u.textStyles.push(c)}u.styles.push(a)}),this.classes.forEach(a=>{a.cssClasses.includes(r)&&a.styles.push(...i.flatMap(c=>c.split(",")))})}}setTooltip(e,i){e.split(",").forEach(r=>{i!==void 0&&(this.classes.get(r).tooltip=w(i))})}getTooltip(e,i){return i&&this.namespaces.has(i)?this.namespaces.get(i).classes.get(e).tooltip:this.classes.get(e).tooltip}setLink(e,i,r){const u=D();e.split(",").forEach(a=>{let c=a;/\d/.exec(a[0])&&(c=ce+c);const A=this.classes.get(c);A&&(A.link=Ie.formatUrl(i,u),u.securityLevel==="sandbox"?A.linkTarget="_top":typeof r=="string"?A.linkTarget=w(r):A.linkTarget="_blank")}),this.setCssClass(e,"clickable")}setClickEvent(e,i,r){e.split(",").forEach(u=>{this.setClickFunc(u,i,r),this.classes.get(u).haveCallback=!0}),this.setCssClass(e,"clickable")}setClickFunc(e,i,r){const u=x.sanitizeText(e,D());if(D().securityLevel!=="loose"||i===void 0)return;const c=u;if(this.classes.has(c)){const A=this.lookUpDomId(c);let f=[];if(typeof r=="string"){f=r.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let k=0;k{const k=document.querySelector(`[id="${A}"]`);k!==null&&k.addEventListener("click",()=>{Ie.runFunc(i,...f)},!1)})}}bindFunctions(e){this.functions.forEach(i=>{i(e)})}getDirection(){return this.direction}setDirection(e){this.direction=e}addNamespace(e){this.namespaces.has(e)||(this.namespaces.set(e,{id:e,classes:new Map,children:{},domId:ce+e+"-"+this.namespaceCounter}),this.namespaceCounter++)}getNamespace(e){return this.namespaces.get(e)}getNamespaces(){return this.namespaces}addClassesToNamespace(e,i){if(this.namespaces.has(e))for(const r of i){const{className:u}=this.splitClassNameAndType(r);this.classes.get(u).parent=e,this.namespaces.get(e).classes.set(u,this.classes.get(u))}}setCssStyle(e,i){const r=this.classes.get(e);if(!(!i||!r))for(const u of i)u.includes(",")?r.styles.push(...u.split(",")):r.styles.push(u)}getArrowMarker(e){let i;switch(e){case 0:i="aggregation";break;case 1:i="extension";break;case 2:i="composition";break;case 3:i="dependency";break;case 4:i="lollipop";break;default:i="none"}return i}getData(){const e=[],i=[],r=D();for(const a of this.namespaces.keys()){const c=this.namespaces.get(a);if(c){const A={id:c.id,label:c.id,isGroup:!0,padding:r.class.padding??16,shape:"rect",cssStyles:["fill: none","stroke: black"],look:r.look};e.push(A)}}for(const a of this.classes.keys()){const c=this.classes.get(a);if(c){const A=c;A.parentId=c.parent,A.look=r.look,e.push(A)}}let u=0;for(const a of this.notes){u++;const c={id:a.id,label:a.text,isGroup:!1,shape:"note",padding:r.class.padding??6,cssStyles:["text-align: left","white-space: nowrap",`fill: ${r.themeVariables.noteBkgColor}`,`stroke: ${r.themeVariables.noteBorderColor}`],look:r.look};e.push(c);const A=this.classes.get(a.class)?.id??"";if(A){const f={id:`edgeNote${u}`,start:a.id,end:A,type:"normal",thickness:"normal",classes:"relation",arrowTypeStart:"none",arrowTypeEnd:"none",arrowheadStyle:"",labelStyle:[""],style:["fill: none"],pattern:"dotted",look:r.look};i.push(f)}}for(const a of this.interfaces){const c={id:a.id,label:a.label,isGroup:!1,shape:"rect",cssStyles:["opacity: 0;"],look:r.look};e.push(c)}u=0;for(const a of this.relations){u++;const c={id:ct(a.id1,a.id2,{prefix:"id",counter:u}),start:a.id1,end:a.id2,type:"normal",label:a.title,labelpos:"c",thickness:"normal",classes:"relation",arrowTypeStart:this.getArrowMarker(a.relation.type1),arrowTypeEnd:this.getArrowMarker(a.relation.type2),startLabelRight:a.relationTitle1==="none"?"":a.relationTitle1,endLabelLeft:a.relationTitle2==="none"?"":a.relationTitle2,arrowheadStyle:"",labelStyle:["display: inline-block"],style:a.style||"",pattern:a.relation.lineType==1?"dashed":"solid",look:r.look};i.push(c)}return{nodes:e,edges:i,other:{},config:r,direction:this.getDirection()}}},dt=p(e=>`g.classGroup text { + fill: ${e.nodeBorder||e.classText}; + stroke: none; + font-family: ${e.fontFamily}; + font-size: 10px; + + .title { + font-weight: bolder; + } + +} + +.nodeLabel, .edgeLabel { + color: ${e.classText}; +} +.edgeLabel .label rect { + fill: ${e.mainBkg}; +} +.label text { + fill: ${e.classText}; +} + +.labelBkg { + background: ${e.mainBkg}; +} +.edgeLabel .label span { + background: ${e.mainBkg}; +} + +.classTitle { + font-weight: bolder; +} +.node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + stroke-width: 1px; + } + + +.divider { + stroke: ${e.nodeBorder}; + stroke-width: 1; +} + +g.clickable { + cursor: pointer; +} + +g.classGroup rect { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; +} + +g.classGroup line { + stroke: ${e.nodeBorder}; + stroke-width: 1; +} + +.classLabel .box { + stroke: none; + stroke-width: 0; + fill: ${e.mainBkg}; + opacity: 0.5; +} + +.classLabel .label { + fill: ${e.nodeBorder}; + font-size: 10px; +} + +.relation { + stroke: ${e.lineColor}; + stroke-width: 1; + fill: none; +} + +.dashed-line{ + stroke-dasharray: 3; +} + +.dotted-line{ + stroke-dasharray: 1 2; +} + +#compositionStart, .composition { + fill: ${e.lineColor} !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +#compositionEnd, .composition { + fill: ${e.lineColor} !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +#dependencyStart, .dependency { + fill: ${e.lineColor} !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +#dependencyStart, .dependency { + fill: ${e.lineColor} !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +#extensionStart, .extension { + fill: transparent !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +#extensionEnd, .extension { + fill: transparent !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +#aggregationStart, .aggregation { + fill: transparent !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +#aggregationEnd, .aggregation { + fill: transparent !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +#lollipopStart, .lollipop { + fill: ${e.mainBkg} !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +#lollipopEnd, .lollipop { + fill: ${e.mainBkg} !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +.edgeTerminals { + font-size: 11px; + line-height: initial; +} + +.classTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; +} + ${Ze()} +`,"getStyles"),kt=dt,pt=p((e,i="TB")=>{if(!e.doc)return i;let r=i;for(const u of e.doc)u.stmt==="dir"&&(r=u.value);return r},"getDir"),At=p(function(e,i){return i.db.getClasses()},"getClasses"),ft=p(async function(e,i,r,u){ve.info("REF0:"),ve.info("Drawing class diagram (v3)",i);const{securityLevel:a,state:c,layout:A}=D(),f=u.db.getData(),k=$e(i,a);f.type=u.type,f.layoutAlgorithm=tt(A),f.nodeSpacing=c?.nodeSpacing||50,f.rankSpacing=c?.rankSpacing||50,f.markers=["aggregation","extension","composition","dependency","lollipop"],f.diagramId=i,await st(f,k);const _=8;Ie.insertTitle(k,"classDiagramTitleText",c?.titleTopMargin??25,u.db.getDiagramTitle()),et(k,_,"classDiagram",c?.useMaxWidth??!0)},"draw"),Dt={getClasses:At,draw:ft,getDir:pt};export{Tt as C,yt as a,Dt as c,kt as s}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-DI55MBZ5-vHqaMaYD.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-DI55MBZ5-vHqaMaYD.js new file mode 100644 index 0000000000000000000000000000000000000000..c24a10d8ea4db4a3a83704576adb96a2523703fe --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-DI55MBZ5-vHqaMaYD.js @@ -0,0 +1,220 @@ +import{g as Zt}from"./chunk-55IACEB6-d9HCWWHk.js";import{s as te}from"./chunk-QN33PNHL-w0eYMV5T.js";import{_ as d,l as _,c as w,r as ee,u as se,a as ie,b as re,g as ae,s as ne,p as oe,q as le,S as ce,j as U,y as he}from"./mermaid.core-7TB2QPZo.js";var kt=(function(){var t=d(function(Y,a,c,r){for(c=c||{},r=Y.length;r--;c[Y[r]]=a);return c},"o"),e=[1,2],o=[1,3],s=[1,4],h=[2,4],u=[1,9],S=[1,11],g=[1,16],n=[1,17],T=[1,18],b=[1,19],C=[1,33],A=[1,20],k=[1,21],f=[1,22],D=[1,23],R=[1,24],L=[1,26],$=[1,27],I=[1,28],P=[1,29],et=[1,30],st=[1,31],it=[1,32],rt=[1,35],at=[1,36],nt=[1,37],ot=[1,38],j=[1,34],p=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],lt=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],At=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],yt={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:d(function(a,c,r,y,E,i,X){var l=i.length-1;switch(E){case 3:return y.setRootDoc(i[l]),i[l];case 4:this.$=[];break;case 5:i[l]!="nl"&&(i[l-1].push(i[l]),this.$=i[l-1]);break;case 6:case 7:this.$=i[l];break;case 8:this.$="nl";break;case 12:this.$=i[l];break;case 13:const J=i[l-1];J.description=y.trimColon(i[l]),this.$=J;break;case 14:this.$={stmt:"relation",state1:i[l-2],state2:i[l]};break;case 15:const gt=y.trimColon(i[l]);this.$={stmt:"relation",state1:i[l-3],state2:i[l-1],description:gt};break;case 19:this.$={stmt:"state",id:i[l-3],type:"default",description:"",doc:i[l-1]};break;case 20:var B=i[l],H=i[l-2].trim();if(i[l].match(":")){var ht=i[l].split(":");B=ht[0],H=[H,ht[1]]}this.$={stmt:"state",id:B,type:"default",description:H};break;case 21:this.$={stmt:"state",id:i[l-3],type:"default",description:i[l-5],doc:i[l-1]};break;case 22:this.$={stmt:"state",id:i[l],type:"fork"};break;case 23:this.$={stmt:"state",id:i[l],type:"join"};break;case 24:this.$={stmt:"state",id:i[l],type:"choice"};break;case 25:this.$={stmt:"state",id:y.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:i[l-1].trim(),note:{position:i[l-2].trim(),text:i[l].trim()}};break;case 29:this.$=i[l].trim(),y.setAccTitle(this.$);break;case 30:case 31:this.$=i[l].trim(),y.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:i[l-3],url:i[l-2],tooltip:i[l-1]};break;case 33:this.$={stmt:"click",id:i[l-3],url:i[l-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:i[l-1].trim(),classes:i[l].trim()};break;case 36:this.$={stmt:"style",id:i[l-1].trim(),styleClass:i[l].trim()};break;case 37:this.$={stmt:"applyClass",id:i[l-1].trim(),styleClass:i[l].trim()};break;case 38:y.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:y.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:y.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:y.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:i[l].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:i[l-2].trim(),classes:[i[l].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:i[l-2].trim(),classes:[i[l].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:o,6:s},{1:[3]},{3:5,4:e,5:o,6:s},{3:6,4:e,5:o,6:s},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],h,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:u,5:S,8:8,9:10,10:12,11:13,12:14,13:15,16:g,17:n,19:T,22:b,24:C,25:A,26:k,27:f,28:D,29:R,32:25,33:L,35:$,37:I,38:P,41:et,45:st,48:it,51:rt,52:at,53:nt,54:ot,57:j},t(p,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:g,17:n,19:T,22:b,24:C,25:A,26:k,27:f,28:D,29:R,32:25,33:L,35:$,37:I,38:P,41:et,45:st,48:it,51:rt,52:at,53:nt,54:ot,57:j},t(p,[2,7]),t(p,[2,8]),t(p,[2,9]),t(p,[2,10]),t(p,[2,11]),t(p,[2,12],{14:[1,40],15:[1,41]}),t(p,[2,16]),{18:[1,42]},t(p,[2,18],{20:[1,43]}),{23:[1,44]},t(p,[2,22]),t(p,[2,23]),t(p,[2,24]),t(p,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(p,[2,28]),{34:[1,49]},{36:[1,50]},t(p,[2,31]),{13:51,24:C,57:j},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(lt,[2,44],{58:[1,56]}),t(lt,[2,45],{58:[1,57]}),t(p,[2,38]),t(p,[2,39]),t(p,[2,40]),t(p,[2,41]),t(p,[2,6]),t(p,[2,13]),{13:58,24:C,57:j},t(p,[2,17]),t(At,h,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(p,[2,29]),t(p,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(p,[2,14],{14:[1,71]}),{4:u,5:S,8:8,9:10,10:12,11:13,12:14,13:15,16:g,17:n,19:T,21:[1,72],22:b,24:C,25:A,26:k,27:f,28:D,29:R,32:25,33:L,35:$,37:I,38:P,41:et,45:st,48:it,51:rt,52:at,53:nt,54:ot,57:j},t(p,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(p,[2,34]),t(p,[2,35]),t(p,[2,36]),t(p,[2,37]),t(lt,[2,46]),t(lt,[2,47]),t(p,[2,15]),t(p,[2,19]),t(At,h,{7:78}),t(p,[2,26]),t(p,[2,27]),{5:[1,79]},{5:[1,80]},{4:u,5:S,8:8,9:10,10:12,11:13,12:14,13:15,16:g,17:n,19:T,21:[1,81],22:b,24:C,25:A,26:k,27:f,28:D,29:R,32:25,33:L,35:$,37:I,38:P,41:et,45:st,48:it,51:rt,52:at,53:nt,54:ot,57:j},t(p,[2,32]),t(p,[2,33]),t(p,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:d(function(a,c){if(c.recoverable)this.trace(a);else{var r=new Error(a);throw r.hash=c,r}},"parseError"),parse:d(function(a){var c=this,r=[0],y=[],E=[null],i=[],X=this.table,l="",B=0,H=0,ht=2,J=1,gt=i.slice.call(arguments,1),m=Object.create(this.lexer),V={yy:{}};for(var Tt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Tt)&&(V.yy[Tt]=this.yy[Tt]);m.setInput(a,V.yy),V.yy.lexer=m,V.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Et=m.yylloc;i.push(Et);var qt=m.options&&m.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Qt(O){r.length=r.length-2*O,E.length=E.length-O,i.length=i.length-O}d(Qt,"popStack");function xt(){var O;return O=y.pop()||m.lex()||J,typeof O!="number"&&(O instanceof Array&&(y=O,O=y.pop()),O=c.symbols_[O]||O),O}d(xt,"lex");for(var x,M,N,_t,W={},ut,F,Lt,dt;;){if(M=r[r.length-1],this.defaultActions[M]?N=this.defaultActions[M]:((x===null||typeof x>"u")&&(x=xt()),N=X[M]&&X[M][x]),typeof N>"u"||!N.length||!N[0]){var mt="";dt=[];for(ut in X[M])this.terminals_[ut]&&ut>ht&&dt.push("'"+this.terminals_[ut]+"'");m.showPosition?mt="Parse error on line "+(B+1)+`: +`+m.showPosition()+` +Expecting `+dt.join(", ")+", got '"+(this.terminals_[x]||x)+"'":mt="Parse error on line "+(B+1)+": Unexpected "+(x==J?"end of input":"'"+(this.terminals_[x]||x)+"'"),this.parseError(mt,{text:m.match,token:this.terminals_[x]||x,line:m.yylineno,loc:Et,expected:dt})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+M+", token: "+x);switch(N[0]){case 1:r.push(x),E.push(m.yytext),i.push(m.yylloc),r.push(N[1]),x=null,H=m.yyleng,l=m.yytext,B=m.yylineno,Et=m.yylloc;break;case 2:if(F=this.productions_[N[1]][1],W.$=E[E.length-F],W._$={first_line:i[i.length-(F||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(F||1)].first_column,last_column:i[i.length-1].last_column},qt&&(W._$.range=[i[i.length-(F||1)].range[0],i[i.length-1].range[1]]),_t=this.performAction.apply(W,[l,H,B,V.yy,N[1],E,i].concat(gt)),typeof _t<"u")return _t;F&&(r=r.slice(0,-1*F*2),E=E.slice(0,-1*F),i=i.slice(0,-1*F)),r.push(this.productions_[N[1]][0]),E.push(W.$),i.push(W._$),Lt=X[r[r.length-2]][r[r.length-1]],r.push(Lt);break;case 3:return!0}}return!0},"parse")},Jt=(function(){var Y={EOF:1,parseError:d(function(c,r){if(this.yy.parser)this.yy.parser.parseError(c,r);else throw new Error(c)},"parseError"),setInput:d(function(a,c){return this.yy=c||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var c=a.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:d(function(a){var c=a.length,r=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===y.length?this.yylloc.first_column:0)+y[y.length-r.length].length-r[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(a){this.unput(this.match.slice(a))},"less"),pastInput:d(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var a=this.pastInput(),c=new Array(a.length+1).join("-");return a+this.upcomingInput()+` +`+c+"^"},"showPosition"),test_match:d(function(a,c){var r,y,E;if(this.options.backtrack_lexer&&(E={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(E.yylloc.range=this.yylloc.range.slice(0))),y=a[0].match(/(?:\r\n?|\n).*/g),y&&(this.yylineno+=y.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:y?y[y.length-1].length-y[y.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(a[0].length),this.matched+=a[0],r=this.performAction.call(this,this.yy,this,c,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var i in E)this[i]=E[i];return!1}return!1},"test_match"),next:d(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,c,r,y;this._more||(this.yytext="",this.match="");for(var E=this._currentRules(),i=0;ic[0].length)){if(c=r,y=i,this.options.backtrack_lexer){if(a=this.test_match(r,E[i]),a!==!1)return a;if(this._backtrack){c=!1;continue}else return!1}else if(!this.options.flex)break}return c?(a=this.test_match(c,E[y]),a!==!1?a:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:d(function(){var c=this.next();return c||this.lex()},"lex"),begin:d(function(c){this.conditionStack.push(c)},"begin"),popState:d(function(){var c=this.conditionStack.length-1;return c>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:d(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:d(function(c){return c=this.conditionStack.length-1-Math.abs(c||0),c>=0?this.conditionStack[c]:"INITIAL"},"topState"),pushState:d(function(c){this.begin(c)},"pushState"),stateStackSize:d(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:d(function(c,r,y,E){switch(y){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:return 51;case 5:return 52;case 6:return 53;case 7:return 54;case 8:break;case 9:break;case 10:return 5;case 11:break;case 12:break;case 13:break;case 14:break;case 15:return this.pushState("SCALE"),17;case 16:return 18;case 17:this.popState();break;case 18:return this.begin("acc_title"),33;case 19:return this.popState(),"acc_title_value";case 20:return this.begin("acc_descr"),35;case 21:return this.popState(),"acc_descr_value";case 22:this.begin("acc_descr_multiline");break;case 23:this.popState();break;case 24:return"acc_descr_multiline_value";case 25:return this.pushState("CLASSDEF"),41;case 26:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 27:return this.popState(),this.pushState("CLASSDEFID"),42;case 28:return this.popState(),43;case 29:return this.pushState("CLASS"),48;case 30:return this.popState(),this.pushState("CLASS_STYLE"),49;case 31:return this.popState(),50;case 32:return this.pushState("STYLE"),45;case 33:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;case 34:return this.popState(),47;case 35:return this.pushState("SCALE"),17;case 36:return 18;case 37:this.popState();break;case 38:this.pushState("STATE");break;case 39:return this.popState(),r.yytext=r.yytext.slice(0,-8).trim(),25;case 40:return this.popState(),r.yytext=r.yytext.slice(0,-8).trim(),26;case 41:return this.popState(),r.yytext=r.yytext.slice(0,-10).trim(),27;case 42:return this.popState(),r.yytext=r.yytext.slice(0,-8).trim(),25;case 43:return this.popState(),r.yytext=r.yytext.slice(0,-8).trim(),26;case 44:return this.popState(),r.yytext=r.yytext.slice(0,-10).trim(),27;case 45:return 51;case 46:return 52;case 47:return 53;case 48:return 54;case 49:this.pushState("STATE_STRING");break;case 50:return this.pushState("STATE_ID"),"AS";case 51:return this.popState(),"ID";case 52:this.popState();break;case 53:return"STATE_DESCR";case 54:return 19;case 55:this.popState();break;case 56:return this.popState(),this.pushState("struct"),20;case 57:break;case 58:return this.popState(),21;case 59:break;case 60:return this.begin("NOTE"),29;case 61:return this.popState(),this.pushState("NOTE_ID"),59;case 62:return this.popState(),this.pushState("NOTE_ID"),60;case 63:this.popState(),this.pushState("FLOATING_NOTE");break;case 64:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";case 65:break;case 66:return"NOTE_TEXT";case 67:return this.popState(),"ID";case 68:return this.popState(),this.pushState("NOTE_TEXT"),24;case 69:return this.popState(),r.yytext=r.yytext.substr(2).trim(),31;case 70:return this.popState(),r.yytext=r.yytext.slice(0,-8).trim(),31;case 71:return 6;case 72:return 6;case 73:return 16;case 74:return 57;case 75:return 24;case 76:return r.yytext=r.yytext.trim(),14;case 77:return 15;case 78:return 28;case 79:return 58;case 80:return 5;case 81:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[12,13],inclusive:!1},struct:{rules:[12,13,25,29,32,38,45,46,47,48,57,58,59,60,74,75,76,77,78],inclusive:!1},FLOATING_NOTE_ID:{rules:[67],inclusive:!1},FLOATING_NOTE:{rules:[64,65,66],inclusive:!1},NOTE_TEXT:{rules:[69,70],inclusive:!1},NOTE_ID:{rules:[68],inclusive:!1},NOTE:{rules:[61,62,63],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[34],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[33],inclusive:!1},CLASS_STYLE:{rules:[31],inclusive:!1},CLASS:{rules:[30],inclusive:!1},CLASSDEFID:{rules:[28],inclusive:!1},CLASSDEF:{rules:[26,27],inclusive:!1},acc_descr_multiline:{rules:[23,24],inclusive:!1},acc_descr:{rules:[21],inclusive:!1},acc_title:{rules:[19],inclusive:!1},SCALE:{rules:[16,17,36,37],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[51],inclusive:!1},STATE_STRING:{rules:[52,53],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[12,13,39,40,41,42,43,44,49,50,54,55,56],inclusive:!1},ID:{rules:[12,13],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,13,14,15,18,20,22,25,29,32,35,38,56,60,71,72,73,74,75,76,77,79,80,81],inclusive:!0}}};return Y})();yt.lexer=Jt;function ct(){this.yy={}}return d(ct,"Parser"),ct.prototype=yt,yt.Parser=ct,new ct})();kt.parser=kt;var Ge=kt,ue="TB",Ft="TB",It="dir",K="state",z="root",vt="relation",de="classDef",fe="style",pe="applyClass",Z="default",Yt="divider",Gt="fill:none",Bt="fill: #333",Vt="c",Mt="text",Ut="normal",bt="rect",Dt="rectWithTitle",Se="stateStart",ye="stateEnd",Ot="divider",Rt="roundedWithTitle",ge="note",Te="noteGroup",tt="statediagram",Ee="state",_e=`${tt}-${Ee}`,jt="transition",me="note",be="note-edge",De=`${jt} ${be}`,ke=`${tt}-${me}`,ve="cluster",Ce=`${tt}-${ve}`,Ae="cluster-alt",xe=`${tt}-${Ae}`,Ht="parent",Wt="note",Le="state",Ct="----",Ie=`${Ct}${Wt}`,Nt=`${Ct}${Ht}`,zt=d((t,e=Ft)=>{if(!t.doc)return e;let o=e;for(const s of t.doc)s.stmt==="dir"&&(o=s.value);return o},"getDir"),Oe=d(function(t,e){return e.db.getClasses()},"getClasses"),Re=d(async function(t,e,o,s){_.info("REF0:"),_.info("Drawing state diagram (v2)",e);const{securityLevel:h,state:u,layout:S}=w();s.db.extract(s.db.getRootDocV2());const g=s.db.getData(),n=Zt(e,h);g.type=s.type,g.layoutAlgorithm=S,g.nodeSpacing=u?.nodeSpacing||50,g.rankSpacing=u?.rankSpacing||50,g.markers=["barb"],g.diagramId=e,await ee(g,n);const T=8;try{(typeof s.db.getLinks=="function"?s.db.getLinks():new Map).forEach((C,A)=>{const k=typeof A=="string"?A:typeof A?.id=="string"?A.id:"";if(!k){_.warn("⚠️ Invalid or missing stateId from key:",JSON.stringify(A));return}const f=n.node()?.querySelectorAll("g");let D;if(f?.forEach(I=>{I.textContent?.trim()===k&&(D=I)}),!D){_.warn("⚠️ Could not find node matching text:",k);return}const R=D.parentNode;if(!R){_.warn("⚠️ Node has no parent, cannot wrap:",k);return}const L=document.createElementNS("http://www.w3.org/2000/svg","a"),$=C.url.replace(/^"+|"+$/g,"");if(L.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",$),L.setAttribute("target","_blank"),C.tooltip){const I=C.tooltip.replace(/^"+|"+$/g,"");L.setAttribute("title",I)}R.replaceChild(L,D),L.appendChild(D),_.info("🔗 Wrapped node in tag for:",k,C.url)})}catch(b){_.error("❌ Error injecting clickable links:",b)}se.insertTitle(n,"statediagramTitleText",u?.titleTopMargin??25,s.db.getDiagramTitle()),te(n,T,tt,u?.useMaxWidth??!0)},"draw"),Be={getClasses:Oe,draw:Re,getDir:zt},pt=new Map,G=0;function St(t="",e=0,o="",s=Ct){const h=o!==null&&o.length>0?`${s}${o}`:"";return`${Le}-${t}${h}-${e}`}d(St,"stateDomId");var Ne=d((t,e,o,s,h,u,S,g)=>{_.trace("items",e),e.forEach(n=>{switch(n.stmt){case K:Q(t,n,o,s,h,u,S,g);break;case Z:Q(t,n,o,s,h,u,S,g);break;case vt:{Q(t,n.state1,o,s,h,u,S,g),Q(t,n.state2,o,s,h,u,S,g);const T={id:"edge"+G,start:n.state1.id,end:n.state2.id,arrowhead:"normal",arrowTypeEnd:"arrow_barb",style:Gt,labelStyle:"",label:U.sanitizeText(n.description??"",w()),arrowheadStyle:Bt,labelpos:Vt,labelType:Mt,thickness:Ut,classes:jt,look:S};h.push(T),G++}break}})},"setupDoc"),wt=d((t,e=Ft)=>{let o=e;if(t.doc)for(const s of t.doc)s.stmt==="dir"&&(o=s.value);return o},"getDir");function q(t,e,o){if(!e.id||e.id===""||e.id==="")return;e.cssClasses&&(Array.isArray(e.cssCompiledStyles)||(e.cssCompiledStyles=[]),e.cssClasses.split(" ").forEach(h=>{const u=o.get(h);u&&(e.cssCompiledStyles=[...e.cssCompiledStyles??[],...u.styles])}));const s=t.find(h=>h.id===e.id);s?Object.assign(s,e):t.push(e)}d(q,"insertOrUpdateNode");function Kt(t){return t?.classes?.join(" ")??""}d(Kt,"getClassesFromDbInfo");function Xt(t){return t?.styles??[]}d(Xt,"getStylesFromDbInfo");var Q=d((t,e,o,s,h,u,S,g)=>{const n=e.id,T=o.get(n),b=Kt(T),C=Xt(T),A=w();if(_.info("dataFetcher parsedItem",e,T,C),n!=="root"){let k=bt;e.start===!0?k=Se:e.start===!1&&(k=ye),e.type!==Z&&(k=e.type),pt.get(n)||pt.set(n,{id:n,shape:k,description:U.sanitizeText(n,A),cssClasses:`${b} ${_e}`,cssStyles:C});const f=pt.get(n);e.description&&(Array.isArray(f.description)?(f.shape=Dt,f.description.push(e.description)):f.description?.length&&f.description.length>0?(f.shape=Dt,f.description===n?f.description=[e.description]:f.description=[f.description,e.description]):(f.shape=bt,f.description=e.description),f.description=U.sanitizeTextOrArray(f.description,A)),f.description?.length===1&&f.shape===Dt&&(f.type==="group"?f.shape=Rt:f.shape=bt),!f.type&&e.doc&&(_.info("Setting cluster for XCX",n,wt(e)),f.type="group",f.isGroup=!0,f.dir=wt(e),f.shape=e.type===Yt?Ot:Rt,f.cssClasses=`${f.cssClasses} ${Ce} ${u?xe:""}`);const D={labelStyle:"",shape:f.shape,label:f.description,cssClasses:f.cssClasses,cssCompiledStyles:[],cssStyles:f.cssStyles,id:n,dir:f.dir,domId:St(n,G),type:f.type,isGroup:f.type==="group",padding:8,rx:10,ry:10,look:S};if(D.shape===Ot&&(D.label=""),t&&t.id!=="root"&&(_.trace("Setting node ",n," to be child of its parent ",t.id),D.parentId=t.id),D.centerLabel=!0,e.note){const R={labelStyle:"",shape:ge,label:e.note.text,cssClasses:ke,cssStyles:[],cssCompiledStyles:[],id:n+Ie+"-"+G,domId:St(n,G,Wt),type:f.type,isGroup:f.type==="group",padding:A.flowchart?.padding,look:S,position:e.note.position},L=n+Nt,$={labelStyle:"",shape:Te,label:e.note.text,cssClasses:f.cssClasses,cssStyles:[],id:n+Nt,domId:St(n,G,Ht),type:"group",isGroup:!0,padding:16,look:S,position:e.note.position};G++,$.id=L,R.parentId=L,q(s,$,g),q(s,R,g),q(s,D,g);let I=n,P=R.id;e.note.position==="left of"&&(I=R.id,P=n),h.push({id:I+"-"+P,start:I,end:P,arrowhead:"none",arrowTypeEnd:"",style:Gt,labelStyle:"",classes:De,arrowheadStyle:Bt,labelpos:Vt,labelType:Mt,thickness:Ut,look:S})}else q(s,D,g)}e.doc&&(_.trace("Adding nodes children "),Ne(e,e.doc,o,s,h,!u,S,g))},"dataFetcher"),we=d(()=>{pt.clear(),G=0},"reset"),v={START_NODE:"[*]",START_TYPE:"start",END_NODE:"[*]",END_TYPE:"end",COLOR_KEYWORD:"color",FILL_KEYWORD:"fill",BG_FILL:"bgFill",STYLECLASS_SEP:","},$t=d(()=>new Map,"newClassesList"),Pt=d(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),ft=d(t=>JSON.parse(JSON.stringify(t)),"clone"),Ve=class{constructor(t){this.version=t,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=$t(),this.documents={root:Pt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.getAccTitle=ie,this.setAccTitle=re,this.getAccDescription=ae,this.setAccDescription=ne,this.setDiagramTitle=oe,this.getDiagramTitle=le,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this)}static{d(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(t){this.clear(!0);for(const s of Array.isArray(t)?t:t.doc)switch(s.stmt){case K:this.addState(s.id.trim(),s.type,s.doc,s.description,s.note);break;case vt:this.addRelation(s.state1,s.state2,s.description);break;case de:this.addStyleClass(s.id.trim(),s.classes);break;case fe:this.handleStyleDef(s);break;case pe:this.setCssClass(s.id.trim(),s.styleClass);break;case"click":this.addLink(s.id,s.url,s.tooltip);break}const e=this.getStates(),o=w();we(),Q(void 0,this.getRootDocV2(),e,this.nodes,this.edges,!0,o.look,this.classes);for(const s of this.nodes)if(Array.isArray(s.label)){if(s.description=s.label.slice(1),s.isGroup&&s.description.length>0)throw new Error(`Group nodes can only have label. Remove the additional description for node [${s.id}]`);s.label=s.label[0]}}handleStyleDef(t){const e=t.id.trim().split(","),o=t.styleClass.split(",");for(const s of e){let h=this.getState(s);if(!h){const u=s.trim();this.addState(u),h=this.getState(u)}h&&(h.styles=o.map(u=>u.replace(/;/g,"")?.trim()))}}setRootDoc(t){_.info("Setting root doc",t),this.rootDoc=t,this.version===1?this.extract(t):this.extract(this.getRootDocV2())}docTranslator(t,e,o){if(e.stmt===vt){this.docTranslator(t,e.state1,!0),this.docTranslator(t,e.state2,!1);return}if(e.stmt===K&&(e.id===v.START_NODE?(e.id=t.id+(o?"_start":"_end"),e.start=o):e.id=e.id.trim()),e.stmt!==z&&e.stmt!==K||!e.doc)return;const s=[];let h=[];for(const u of e.doc)if(u.type===Yt){const S=ft(u);S.doc=ft(h),s.push(S),h=[]}else h.push(u);if(s.length>0&&h.length>0){const u={stmt:K,id:ce(),type:"divider",doc:ft(h)};s.push(ft(u)),e.doc=s}e.doc.forEach(u=>this.docTranslator(e,u,!0))}getRootDocV2(){return this.docTranslator({id:z,stmt:z},{id:z,stmt:z,doc:this.rootDoc},!0),{id:z,doc:this.rootDoc}}addState(t,e=Z,o=void 0,s=void 0,h=void 0,u=void 0,S=void 0,g=void 0){const n=t?.trim();if(!this.currentDocument.states.has(n))_.info("Adding state ",n,s),this.currentDocument.states.set(n,{stmt:K,id:n,descriptions:[],type:e,doc:o,note:h,classes:[],styles:[],textStyles:[]});else{const T=this.currentDocument.states.get(n);if(!T)throw new Error(`State not found: ${n}`);T.doc||(T.doc=o),T.type||(T.type=e)}if(s&&(_.info("Setting state description",n,s),(Array.isArray(s)?s:[s]).forEach(b=>this.addDescription(n,b.trim()))),h){const T=this.currentDocument.states.get(n);if(!T)throw new Error(`State not found: ${n}`);T.note=h,T.note.text=U.sanitizeText(T.note.text,w())}u&&(_.info("Setting state classes",n,u),(Array.isArray(u)?u:[u]).forEach(b=>this.setCssClass(n,b.trim()))),S&&(_.info("Setting state styles",n,S),(Array.isArray(S)?S:[S]).forEach(b=>this.setStyle(n,b.trim()))),g&&(_.info("Setting state styles",n,S),(Array.isArray(g)?g:[g]).forEach(b=>this.setTextStyle(n,b.trim())))}clear(t){this.nodes=[],this.edges=[],this.documents={root:Pt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=$t(),t||(this.links=new Map,he())}getState(t){return this.currentDocument.states.get(t)}getStates(){return this.currentDocument.states}logDocuments(){_.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(t,e,o){this.links.set(t,{url:e,tooltip:o}),_.warn("Adding link",t,e,o)}getLinks(){return this.links}startIdIfNeeded(t=""){return t===v.START_NODE?(this.startEndCount++,`${v.START_TYPE}${this.startEndCount}`):t}startTypeIfNeeded(t="",e=Z){return t===v.START_NODE?v.START_TYPE:e}endIdIfNeeded(t=""){return t===v.END_NODE?(this.startEndCount++,`${v.END_TYPE}${this.startEndCount}`):t}endTypeIfNeeded(t="",e=Z){return t===v.END_NODE?v.END_TYPE:e}addRelationObjs(t,e,o=""){const s=this.startIdIfNeeded(t.id.trim()),h=this.startTypeIfNeeded(t.id.trim(),t.type),u=this.startIdIfNeeded(e.id.trim()),S=this.startTypeIfNeeded(e.id.trim(),e.type);this.addState(s,h,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.addState(u,S,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.currentDocument.relations.push({id1:s,id2:u,relationTitle:U.sanitizeText(o,w())})}addRelation(t,e,o){if(typeof t=="object"&&typeof e=="object")this.addRelationObjs(t,e,o);else if(typeof t=="string"&&typeof e=="string"){const s=this.startIdIfNeeded(t.trim()),h=this.startTypeIfNeeded(t),u=this.endIdIfNeeded(e.trim()),S=this.endTypeIfNeeded(e);this.addState(s,h),this.addState(u,S),this.currentDocument.relations.push({id1:s,id2:u,relationTitle:o?U.sanitizeText(o,w()):void 0})}}addDescription(t,e){const o=this.currentDocument.states.get(t),s=e.startsWith(":")?e.replace(":","").trim():e;o?.descriptions?.push(U.sanitizeText(s,w()))}cleanupLabel(t){return t.startsWith(":")?t.slice(2).trim():t.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(t,e=""){this.classes.has(t)||this.classes.set(t,{id:t,styles:[],textStyles:[]});const o=this.classes.get(t);e&&o&&e.split(v.STYLECLASS_SEP).forEach(s=>{const h=s.replace(/([^;]*);/,"$1").trim();if(RegExp(v.COLOR_KEYWORD).exec(s)){const S=h.replace(v.FILL_KEYWORD,v.BG_FILL).replace(v.COLOR_KEYWORD,v.FILL_KEYWORD);o.textStyles.push(S)}o.styles.push(h)})}getClasses(){return this.classes}setCssClass(t,e){t.split(",").forEach(o=>{let s=this.getState(o);if(!s){const h=o.trim();this.addState(h),s=this.getState(h)}s?.classes?.push(e)})}setStyle(t,e){this.getState(t)?.styles?.push(e)}setTextStyle(t,e){this.getState(t)?.textStyles?.push(e)}getDirectionStatement(){return this.rootDoc.find(t=>t.stmt===It)}getDirection(){return this.getDirectionStatement()?.value??ue}setDirection(t){const e=this.getDirectionStatement();e?e.value=t:this.rootDoc.unshift({stmt:It,value:t})}trimColon(t){return t.startsWith(":")?t.slice(1).trim():t.trim()}getData(){const t=w();return{nodes:this.nodes,edges:this.edges,other:{},config:t,direction:zt(this.getRootDocV2())}}getConfig(){return w().state}},$e=d(t=>` +defs #statediagram-barbEnd { + fill: ${t.transitionColor}; + stroke: ${t.transitionColor}; + } +g.stateGroup text { + fill: ${t.nodeBorder}; + stroke: none; + font-size: 10px; +} +g.stateGroup text { + fill: ${t.textColor}; + stroke: none; + font-size: 10px; + +} +g.stateGroup .state-title { + font-weight: bolder; + fill: ${t.stateLabelColor}; +} + +g.stateGroup rect { + fill: ${t.mainBkg}; + stroke: ${t.nodeBorder}; +} + +g.stateGroup line { + stroke: ${t.lineColor}; + stroke-width: 1; +} + +.transition { + stroke: ${t.transitionColor}; + stroke-width: 1; + fill: none; +} + +.stateGroup .composit { + fill: ${t.background}; + border-bottom: 1px +} + +.stateGroup .alt-composit { + fill: #e0e0e0; + border-bottom: 1px +} + +.state-note { + stroke: ${t.noteBorderColor}; + fill: ${t.noteBkgColor}; + + text { + fill: ${t.noteTextColor}; + stroke: none; + font-size: 10px; + } +} + +.stateLabel .box { + stroke: none; + stroke-width: 0; + fill: ${t.mainBkg}; + opacity: 0.5; +} + +.edgeLabel .label rect { + fill: ${t.labelBackgroundColor}; + opacity: 0.5; +} +.edgeLabel { + background-color: ${t.edgeLabelBackground}; + p { + background-color: ${t.edgeLabelBackground}; + } + rect { + opacity: 0.5; + background-color: ${t.edgeLabelBackground}; + fill: ${t.edgeLabelBackground}; + } + text-align: center; +} +.edgeLabel .label text { + fill: ${t.transitionLabelColor||t.tertiaryTextColor}; +} +.label div .edgeLabel { + color: ${t.transitionLabelColor||t.tertiaryTextColor}; +} + +.stateLabel text { + fill: ${t.stateLabelColor}; + font-size: 10px; + font-weight: bold; +} + +.node circle.state-start { + fill: ${t.specialStateColor}; + stroke: ${t.specialStateColor}; +} + +.node .fork-join { + fill: ${t.specialStateColor}; + stroke: ${t.specialStateColor}; +} + +.node circle.state-end { + fill: ${t.innerEndBackground}; + stroke: ${t.background}; + stroke-width: 1.5 +} +.end-state-inner { + fill: ${t.compositeBackground||t.background}; + // stroke: ${t.background}; + stroke-width: 1.5 +} + +.node rect { + fill: ${t.stateBkg||t.mainBkg}; + stroke: ${t.stateBorder||t.nodeBorder}; + stroke-width: 1px; +} +.node polygon { + fill: ${t.mainBkg}; + stroke: ${t.stateBorder||t.nodeBorder};; + stroke-width: 1px; +} +#statediagram-barbEnd { + fill: ${t.lineColor}; +} + +.statediagram-cluster rect { + fill: ${t.compositeTitleBackground}; + stroke: ${t.stateBorder||t.nodeBorder}; + stroke-width: 1px; +} + +.cluster-label, .nodeLabel { + color: ${t.stateLabelColor}; + // line-height: 1; +} + +.statediagram-cluster rect.outer { + rx: 5px; + ry: 5px; +} +.statediagram-state .divider { + stroke: ${t.stateBorder||t.nodeBorder}; +} + +.statediagram-state .title-state { + rx: 5px; + ry: 5px; +} +.statediagram-cluster.statediagram-cluster .inner { + fill: ${t.compositeBackground||t.background}; +} +.statediagram-cluster.statediagram-cluster-alt .inner { + fill: ${t.altBackground?t.altBackground:"#efefef"}; +} + +.statediagram-cluster .inner { + rx:0; + ry:0; +} + +.statediagram-state rect.basic { + rx: 5px; + ry: 5px; +} +.statediagram-state rect.divider { + stroke-dasharray: 10,10; + fill: ${t.altBackground?t.altBackground:"#efefef"}; +} + +.note-edge { + stroke-dasharray: 5; +} + +.statediagram-note rect { + fill: ${t.noteBkgColor}; + stroke: ${t.noteBorderColor}; + stroke-width: 1px; + rx: 0; + ry: 0; +} +.statediagram-note rect { + fill: ${t.noteBkgColor}; + stroke: ${t.noteBorderColor}; + stroke-width: 1px; + rx: 0; + ry: 0; +} + +.statediagram-note text { + fill: ${t.noteTextColor}; +} + +.statediagram-note .nodeLabel { + color: ${t.noteTextColor}; +} +.statediagram .edgeLabel { + color: red; // ${t.noteTextColor}; +} + +#dependencyStart, #dependencyEnd { + fill: ${t.lineColor}; + stroke: ${t.lineColor}; + stroke-width: 1; +} + +.statediagramTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${t.textColor}; +} +`,"getStyles"),Me=$e;export{Ve as S,Ge as a,Be as b,Me as s}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-FMBD7UC4-DNqeu8Dh.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-FMBD7UC4-DNqeu8Dh.js new file mode 100644 index 0000000000000000000000000000000000000000..4e54219437258dcb99ee9efae2a5437d1f77dc0b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-FMBD7UC4-DNqeu8Dh.js @@ -0,0 +1,15 @@ +import{_ as e}from"./mermaid.core-7TB2QPZo.js";var l=e(()=>` + /* Font Awesome icon styling - consolidated */ + .label-icon { + display: inline-block; + height: 1em; + overflow: visible; + vertical-align: -0.125em; + } + + .node .label-icon path { + fill: currentColor; + stroke: revert; + stroke-width: revert; + } +`,"getIconStyles");export{l as g}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-QN33PNHL-w0eYMV5T.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-QN33PNHL-w0eYMV5T.js new file mode 100644 index 0000000000000000000000000000000000000000..a1a70caa05bc368179a95e912a13e27090dceecc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-QN33PNHL-w0eYMV5T.js @@ -0,0 +1 @@ +import{_ as a,d as w,l as x}from"./mermaid.core-7TB2QPZo.js";var B=a((e,t,i,r)=>{e.attr("class",i);const{width:o,height:h,x:n,y:c}=u(e,t);w(e,h,o,r);const s=d(n,c,o,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{const i=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),d=a((e,t,i,r,o)=>`${e-o} ${t-o} ${i} ${r}`,"createViewBox");export{B as s}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-QZHKN3VN-DkLSlLbb.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-QZHKN3VN-DkLSlLbb.js new file mode 100644 index 0000000000000000000000000000000000000000..c066ac1de1615059c1fbc624adb59ffdf047e928 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-QZHKN3VN-DkLSlLbb.js @@ -0,0 +1 @@ +import{_ as i}from"./mermaid.core-7TB2QPZo.js";var r=class{constructor(t){this.init=t,this.records=this.init()}static{i(this,"ImperativeState")}reset(){this.records=this.init()}};export{r as I}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-TZMSLE5B-bT_t1BIn.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-TZMSLE5B-bT_t1BIn.js new file mode 100644 index 0000000000000000000000000000000000000000..77403d6cfb20527b7ab4f22fa95c32dd95cc8e69 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/chunk-TZMSLE5B-bT_t1BIn.js @@ -0,0 +1 @@ +import{_ as n,m as o,i as l}from"./mermaid.core-7TB2QPZo.js";var x=n((s,t)=>{const e=s.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const r in t.attrs)e.attr(r,t.attrs[r]);return t.class&&e.attr("class",t.class),e},"drawRect"),d=n((s,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(s,e).lower()},"drawBackgroundRect"),g=n((s,t)=>{const e=t.text.replace(o," "),r=s.append("text");r.attr("x",t.x),r.attr("y",t.y),r.attr("class","legend"),r.style("text-anchor",t.anchor),t.class&&r.attr("class",t.class);const a=r.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),r},"drawText"),m=n((s,t,e,r)=>{const a=s.append("image");a.attr("x",t),a.attr("y",e);const i=l.sanitizeUrl(r);a.attr("xlink:href",i)},"drawImage"),h=n((s,t,e,r)=>{const a=s.append("use");a.attr("x",t),a.attr("y",e);const i=l.sanitizeUrl(r);a.attr("xlink:href",`#${i}`)},"drawEmbeddedImage"),y=n(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),p=n(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj");export{d as a,p as b,h as c,x as d,m as e,g as f,y as g}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ckb-DEn8SQcv.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ckb-DEn8SQcv.js new file mode 100644 index 0000000000000000000000000000000000000000..cdbb28ab3da3ab37654400b5ebfc75a20ab82668 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ckb-DEn8SQcv.js @@ -0,0 +1 @@ +const o="کوردی",e={annotated_image:"وێنەی نیشانە کراو"},t={allow_recording_access:"تکایە ڕێگە بدە بە دەستگەیشتن بە مایکرۆفۆن بۆ تۆمارکردن",audio:"دەنگ",record_from_microphone:"تۆمارکردن لە مایکرۆفۆنەوە",stop_recording:"تۆمارکردن بوەستێنە",no_device_support:"ناتوانرێت دەستبگات بە ئامێرەکانی میدیا. دڵنیابە لەوەی کە لەسەر سەرچاوەیەکی پارێزراو (https) یان localhost کاردەکەیت (یان بڕوانامەیەکی SSL دروستت داوە)، و ڕێگەت داوە بە وێبگەڕەکە دەستی بگات بە ئامێرەکەت.",stop:"وەستان",resume:"بەردەوامبوون",record:"تۆمارکردن",no_microphone:"هیچ مایکرۆفۆنێک نەدۆزرایەوە",pause:"وەستاندنی کاتی",play:"لێدان",waiting:"چاوەڕوانی",drop_to_upload:"فایلی دەنگی لێرە دابنێ بۆ بارکردن"},r={connection_can_break:"لە مۆبایلدا، پەیوەندییەکە دەکرێت بپچڕێت ئەگەر ئەم تابە چالاک نەبێت یان ئامێرەکە بچێتە دۆخی پشوو، ئەمەش شوێنی خۆت لە ڕیزدا لەدەست دەدات.",long_requests_queue:"ڕیزێکی درێژی داواکاری هەیە. ئەم سپەیسە دووباد بکە بۆی چاوەڕوان نەبیت.",lost_connection:"پەیوەندی پچڕا بەهۆی جێهێشتنی پەیج. گەڕانەوە بۆ ڕیز...",waiting_for_inputs:"بەخێربێی بۆ فایل(ەکان) دەستپێکردن، هەڵبژارە دووبارە هەوڵ بدە."},c={checkbox:"بۆکسی هەڵبژاردن",checkbox_group:"گروپی بۆکسی هەڵبژاردن"},_={code:"کۆد"},n={color_picker:"هەڵبژاردنی ڕەنگ"},a={built_with:"دروستکراوە لەگەڵ...",built_with_gradio:"Gradio دروستکراوە بە",clear:"خاوێنکردنەوە",download:"دابەزاندن",edit:"بژارکردن",empty:"بەتاڵ",error:"هەڵە",hosted_on:"میوانداری کراوە لە",loading:"بارکردن",logo:"لۆگۆ",or:"یان",remove:"لابردن",settings:"ڕێکخستنەکان",share:"هاوبەشکردن",submit:"پێشکەشکردن",undo:"پووچکردنەوە",no_devices:"هیچ ئامێرێک نەدۆزرایەوە",language:"زمان",display_theme:"ڕووکاری نیشاندان",pwa:"بەرنامەی وێبی پێشکەوتوو"},d={incorrect_format:"فۆرماتێکی هەڵە، تەنها فایلەکانی CSV و TSV پشتگیری دەکرێن",new_column:"زیادکردنی ستوون",new_row:"ڕیزی نوێ",add_row_above:"زیادکردنی ڕیز لە سەرەوە",add_row_below:"زیادکردنی ڕیز لە خوارەوە",add_column_left:"زیادکردنی ستوون لە چەپەوە",add_column_right:"زیادکردنی ستوون لە ڕاستەوە",delete_row:"ڕووی ڕاکردن",delete_column:"کۆلۆنی ڕاکردن",sort_column:"کۆلۆنی ڕێکەوە کردن",sort_ascending:"بەرچاوەی ڕوونی",sort_descending:"سەرچاوەکە بەپاشی بەرگرێڕەوە بەڕێوە بکە",drop_to_upload:"فایلەکانی CSV یان TSV لەگەڵ ئەمە بکەوە تا داتا بەرچوون بێت لەوەی دەیتە فرەیمەکەدا",clear_sort:"ڕاژکردنی ڕوونکردن"},s={dropdown:"لیستی داکەوتوو"},l={build_error:"هەڵەیەک هەیە لە دروستکردندا",config_error:"هەڵەیەک هەیە لە ڕێکخستندا",contact_page_author:"تکایە پەیوەندی بکە بە نووسەری لاپەڕەکە بۆ ئاگادارکردنەوە.",no_app_file:"فایلی بەرنامە نییە",runtime_error:"هەڵەیەک هەیە لە کاتی جێبەجێکردندا",space_not_working:'"سپەیسەکە کار ناکات چونکە" {0}',space_paused:"سپەیسەکە وەستێنراوە",use_via_api:"بەکارهێنان لە ڕێگەی API"},i={uploading:"بارکردن..."},p={highlighted_text:"دەقی دیاریکراو"},u={allow_webcam_access:"تکایە ڕێگە بدە بە بەکارهێنانی کامێرای وێب بۆ تۆمارکردن.",brush_color:"ڕەنگی فڵچە",brush_radius:"تیژڕەوی فڵچە",image:"وێنە",remove_image:"لابردنی وێنە",select_brush_color:"ڕەنگی فڵچە هەڵبژێرە",start_drawing:"دەست بکە بە وێنەکێشان",use_brush:"فڵچە بەکاربهێنە",drop_to_upload:"فایل وێنەیەک هەروەها لەمەکە دەڕوونە بۆ بارکردنەوە"},g={label:"لەیبڵ"},m={enable_cookies:"ئەگەر تۆ سەردانی HuggingFace Space دەکەیت لە دۆخی نادیاردا، پێویستە کووکی لایەنی سێیەم چالاک بکەیت.",incorrect_credentials:"زانیاری چوونەژوورەوە هەڵەیە",username:"ناوی بەکارهێنەر",password:"وشەی نهێنی",login:"چوونە ژوورەوە"},b={number:"ژمارە"},h={plot:"هێڵکاری"},w={radio:"ڕادیۆ"},k={slider:"سلایدەر"},f={click_to_upload:"کلیک بکە بۆ بارکردن",drop_audio:"دەنگ لێرە دابنێ",drop_csv:"لێرەدا CSV دابنێ",drop_file:"فایل لێرە دابنێ",drop_image:"وێنە لێرەدا دابنێ",drop_video:"ڤیدیۆ لێرە دابنێ",drop_gallery:"میدیا لێرە دابنێ",paste_clipboard:"لکاندن لە کلیپبۆردەوە"},v={drop_to_upload:"فایل ویدیۆییەکەت هەنە بکەرەوە بۆ بارکردنەوە"},S={edit:"دەستکاری",retry:"هەوڵدانەوە",undo:"گەڕانەوە",submit:"ناردن",cancel:"هەڵوەشاندنەوە",like:"پەسەند",dislike:"ناپەسەند",clear:"پاککردنەوەی گفتوگۆ"},x={_name:o,"3D_model":{"3d_model":"مۆدێلی سێ ڕەهەندی",drop_to_upload:"فایل مۆدێلی ٣دی (.obj، .glb، .stl، .gltf، .splat یان .ply) لەمە هێرە بکە لەبەر بارکردنی."},annotated_image:e,audio:t,blocks:r,checkbox:c,code:_,color_picker:n,common:a,dataframe:d,dropdown:s,errors:l,file:i,highlighted_text:p,image:u,label:g,login:m,number:b,plot:h,radio:w,slider:k,upload_text:f,video:v,chatbot:S};export{o as _name,e as annotated_image,t as audio,r as blocks,S as chatbot,c as checkbox,_ as code,n as color_picker,a as common,d as dataframe,x as default,s as dropdown,l as errors,i as file,p as highlighted_text,u as image,g as label,m as login,b as number,h as plot,w as radio,k as slider,f as upload_text,v as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/classDiagram-2ON5EDUG-ByHtPLEH.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/classDiagram-2ON5EDUG-ByHtPLEH.js new file mode 100644 index 0000000000000000000000000000000000000000..405e0b89a18ea8c1e06cc377f905651e8f13fa83 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/classDiagram-2ON5EDUG-ByHtPLEH.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-B4BG7PRW-D5EXR74z.js";import{_ as i}from"./mermaid.core-7TB2QPZo.js";import"./chunk-FMBD7UC4-DNqeu8Dh.js";import"./chunk-55IACEB6-d9HCWWHk.js";import"./select-BigU4G0v.js";import"./chunk-QN33PNHL-w0eYMV5T.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/classDiagram-v2-WZHVMYZB-ByHtPLEH.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/classDiagram-v2-WZHVMYZB-ByHtPLEH.js new file mode 100644 index 0000000000000000000000000000000000000000..405e0b89a18ea8c1e06cc377f905651e8f13fa83 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/classDiagram-v2-WZHVMYZB-ByHtPLEH.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-B4BG7PRW-D5EXR74z.js";import{_ as i}from"./mermaid.core-7TB2QPZo.js";import"./chunk-FMBD7UC4-DNqeu8Dh.js";import"./chunk-55IACEB6-d9HCWWHk.js";import"./select-BigU4G0v.js";import"./chunk-QN33PNHL-w0eYMV5T.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clear-CEoTtSVi.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clear-CEoTtSVi.js new file mode 100644 index 0000000000000000000000000000000000000000..8687ea3ac58505f652b3c4010f582e3b7e26439f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clear-CEoTtSVi.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as t,f as o}from"./index-DWyDLubb.js";var i=o('');function n(r){var e=i();t(r,e)}export{n as C}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clike-B9uivgTg.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clike-B9uivgTg.js new file mode 100644 index 0000000000000000000000000000000000000000..18846a747c97075e1a167882db1fb0d54b1ce7da --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clike-B9uivgTg.js @@ -0,0 +1 @@ +function O(e,n,t,l,s,d){this.indented=e,this.column=n,this.type=t,this.info=l,this.align=s,this.prev=d}function D(e,n,t,l){var s=e.indented;return e.context&&e.context.type=="statement"&&t!="statement"&&(s=e.context.indented),e.context=new O(s,n,t,l,null,e.context)}function x(e){var n=e.context.type;return(n==")"||n=="]"||n=="}")&&(e.indented=e.context.indented),e.context=e.context.prev}function V(e,n,t){if(n.prevToken=="variable"||n.prevToken=="type"||/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,t))||n.typeAtEndOfLine&&e.column()==e.indentation())return!0}function P(e){for(;;){if(!e||e.type=="top")return!0;if(e.type=="}"&&e.prev.info!="namespace")return!1;e=e.prev}}function h(e){var n=e.statementIndentUnit,t=e.dontAlignCalls,l=e.keywords||{},s=e.types||{},d=e.builtin||{},b=e.blockKeywords||{},_=e.defKeywords||{},w=e.atoms||{},y=e.hooks||{},te=e.multiLineStrings,re=e.indentStatements!==!1,ie=e.indentSwitch!==!1,F=e.namespaceSeparator,oe=e.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,ae=e.numberStart||/[\d\.]/,le=e.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,j=e.isOperatorChar||/[+\-*&%=<>!?|\/]/,B=e.isIdentifierChar||/[\w\$_\xa1-\uffff]/,U=e.isReservedIdentifier||!1,p,E;function K(i,a){var c=i.next();if(y[c]){var o=y[c](i,a);if(o!==!1)return o}if(c=='"'||c=="'")return a.tokenize=ce(c),a.tokenize(i,a);if(ae.test(c)){if(i.backUp(1),i.match(le))return"number";i.next()}if(oe.test(c))return p=c,null;if(c=="/"){if(i.eat("*"))return a.tokenize=A,A(i,a);if(i.eat("/"))return i.skipToEnd(),"comment"}if(j.test(c)){for(;!i.match(/^\/[\/*]/,!1)&&i.eat(j););return"operator"}if(i.eatWhile(B),F)for(;i.match(F);)i.eatWhile(B);var u=i.current();return m(l,u)?(m(b,u)&&(p="newstatement"),m(_,u)&&(E=!0),"keyword"):m(s,u)?"type":m(d,u)||U&&U(u)?(m(b,u)&&(p="newstatement"),"builtin"):m(w,u)?"atom":"variable"}function ce(i){return function(a,c){for(var o=!1,u,v=!1;(u=a.next())!=null;){if(u==i&&!o){v=!0;break}o=!o&&u=="\\"}return(v||!(o||te))&&(c.tokenize=null),"string"}}function A(i,a){for(var c=!1,o;o=i.next();){if(o=="/"&&c){a.tokenize=null;break}c=o=="*"}return"comment"}function $(i,a){e.typeFirstDefinitions&&i.eol()&&P(a.context)&&(a.typeAtEndOfLine=V(i,a,i.pos))}return{name:e.name,startState:function(i){return{tokenize:null,context:new O(-i,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(i,a){var c=a.context;if(i.sol()&&(c.align==null&&(c.align=!1),a.indented=i.indentation(),a.startOfLine=!0),i.eatSpace())return $(i,a),null;p=E=null;var o=(a.tokenize||K)(i,a);if(o=="comment"||o=="meta")return o;if(c.align==null&&(c.align=!0),p==";"||p==":"||p==","&&i.match(/^\s*(?:\/\/.*)?$/,!1))for(;a.context.type=="statement";)x(a);else if(p=="{")D(a,i.column(),"}");else if(p=="[")D(a,i.column(),"]");else if(p=="(")D(a,i.column(),")");else if(p=="}"){for(;c.type=="statement";)c=x(a);for(c.type=="}"&&(c=x(a));c.type=="statement";)c=x(a)}else p==c.type?x(a):re&&((c.type=="}"||c.type=="top")&&p!=";"||c.type=="statement"&&p=="newstatement")&&D(a,i.column(),"statement",i.current());if(o=="variable"&&(a.prevToken=="def"||e.typeFirstDefinitions&&V(i,a,i.start)&&P(a.context)&&i.match(/^\s*\(/,!1))&&(o="def"),y.token){var u=y.token(i,a,o);u!==void 0&&(o=u)}return o=="def"&&e.styleDefs===!1&&(o="variable"),a.startOfLine=!1,a.prevToken=E?"def":o||p,$(i,a),o},indent:function(i,a,c){if(i.tokenize!=K&&i.tokenize!=null||i.typeAtEndOfLine&&P(i.context))return null;var o=i.context,u=a&&a.charAt(0),v=u==o.type;if(o.type=="statement"&&u=="}"&&(o=o.prev),e.dontIndentStatements)for(;o.type=="statement"&&e.dontIndentStatements.test(o.info);)o=o.prev;if(y.indent){var q=y.indent(i,o,a,c.unit);if(typeof q=="number")return q}var se=o.prev&&o.prev.info=="switch";if(e.allmanIndentation&&/[{(]/.test(u)){for(;o.type!="top"&&o.type!="}";)o=o.prev;return o.indented}return o.type=="statement"?o.indented+(u=="{"?0:n||c.unit):o.align&&(!t||o.type!=")")?o.column+(v?0:1):o.type==")"&&!v?o.indented+(n||c.unit):o.indented+(v?0:c.unit)+(!v&&se&&!/^(?:case|default)\b/.test(a)?c.unit:0)},languageData:{indentOnInput:ie?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}},autocomplete:Object.keys(l).concat(Object.keys(s)).concat(Object.keys(d)).concat(Object.keys(w)),...e.languageData}}}function r(e){for(var n={},t=e.split(" "),l=0;l!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,n){return e.match('""')?(n.tokenize=J,n.tokenize(e,n)):!1},"'":function(e){return e.match(/^(\\[^'\s]+|[^\\'])'/)?"character":(e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},"=":function(e,n){var t=n.context;return t.type=="}"&&t.align&&e.eat(">")?(n.context=new O(t.indented,t.column,t.type,t.info,null,t.prev),"operator"):!1},"/":function(e,n){return e.eat("*")?(n.tokenize=S(1),n.tokenize(e,n)):!1}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}});function de(e){return function(n,t){for(var l=!1,s,d=!1;!n.eol();){if(!e&&!l&&n.match('"')){d=!0;break}if(e&&n.match('"""')){d=!0;break}s=n.next(),!l&&s=="$"&&n.match("{")&&n.skipTo("}"),l=!l&&s=="\\"&&!e}return(d||!e)&&(t.tokenize=null),"string"}}const _e=h({name:"kotlin",keywords:r("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam"),types:r("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(ul?|l|f)?/i,blockKeywords:r("catch class do else finally for if where try while enum"),defKeywords:r("class val var object interface fun"),atoms:r("true false null this"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},"*":function(e,n){return n.prevToken=="."?"variable":"operator"},'"':function(e,n){return n.tokenize=de(e.match('""')),n.tokenize(e,n)},"/":function(e,n){return e.eat("*")?(n.tokenize=S(1),n.tokenize(e,n)):!1},indent:function(e,n,t,l){var s=t&&t.charAt(0);if((e.prevToken=="}"||e.prevToken==")")&&t=="")return e.indented;if(e.prevToken=="operator"&&t!="}"&&e.context.type!="}"||e.prevToken=="variable"&&s=="."||(e.prevToken=="}"||e.prevToken==")")&&s==".")return l*2+n.indented;if(n.align&&n.type=="}")return n.indented+(e.context.type==(t||"").charAt(0)?0:l)}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}}),xe=h({name:"shader",keywords:r("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:r("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:r("for while do if else struct"),builtin:r("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:r("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":g}}),Se=h({name:"nesc",keywords:r(T+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:I,blockKeywords:r(N),atoms:r("null true false"),hooks:{"#":g}}),Te=h({name:"objectivec",keywords:r(T+" "+Q),types:X,builtin:r(Z),blockKeywords:r(N+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:r(z+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:r("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:C,hooks:{"#":g,"*":M}}),Ie=h({name:"objectivecpp",keywords:r(T+" "+Q+" "+H),types:X,builtin:r(Z),blockKeywords:r(N+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:r(z+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:r("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:C,hooks:{"#":g,"*":M,u:k,U:k,L:k,R:k,0:f,1:f,2:f,3:f,4:f,5:f,6:f,7:f,8:f,9:f,token:function(e,n,t){if(t=="variable"&&e.peek()=="("&&(n.prevToken==";"||n.prevToken==null||n.prevToken=="}")&&Y(e.current()))return"def"}},namespaceSeparator:"::"}),Ne=h({name:"squirrel",keywords:r("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:I,blockKeywords:r("case catch class else for foreach if switch try while"),defKeywords:r("function local class"),typeFirstDefinitions:!0,atoms:r("true false null"),hooks:{"#":g}});var L=null;function ee(e){return function(n,t){for(var l=!1,s,d=!1;!n.eol();){if(!l&&n.match('"')&&(e=="single"||n.match('""'))){d=!0;break}if(!l&&n.match("``")){L=ee(e),d=!0;break}s=n.next(),l=e=="single"&&!l&&s=="\\"}return d&&(t.tokenize=null),"string"}}const De=h({name:"ceylon",keywords:r("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var n=e.charAt(0);return n===n.toUpperCase()&&n!==n.toLowerCase()},blockKeywords:r("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:r("class dynamic function interface module object package value"),builtin:r("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:r("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,n){return n.tokenize=ee(e.match('""')?"triple":"single"),n.tokenize(e,n)},"`":function(e,n){return!L||!e.match("`")?!1:(n.tokenize=L,L=null,n.tokenize(e,n))},"'":function(e){return e.match(/^(\\[^'\s]+|[^\\'])'/)?"string.special":(e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},token:function(e,n,t){if((t=="variable"||t=="type")&&n.prevToken==".")return"variableName.special"}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}});function pe(e){(e.interpolationStack||(e.interpolationStack=[])).push(e.tokenize)}function ne(e){return(e.interpolationStack||(e.interpolationStack=[])).pop()}function he(e){return e.interpolationStack?e.interpolationStack.length:0}function R(e,n,t,l){var s=!1;if(n.eat(e))if(n.eat(e))s=!0;else return"string";function d(b,_){for(var w=!1;!b.eol();){if(!l&&!w&&b.peek()=="$")return pe(_),_.tokenize=ye,"string";var y=b.next();if(y==e&&!w&&(!s||b.match(e+e))){_.tokenize=null;break}w=!l&&!w&&y=="\\"}return"string"}return t.tokenize=d,d(n,t)}function ye(e,n){return e.eat("$"),e.eat("{")?n.tokenize=null:n.tokenize=me,null}function me(e,n){return e.eatWhile(/[\w_]/),n.tokenize=ne(n),"variable"}const Le=h({name:"dart",keywords:r("this super static final const abstract class extends external factory implements mixin get native set typedef with enum throw rethrow assert break case continue default in return new deferred async await covariant try catch finally do else for if switch while import library export part of show hide is as extension on yield late required sealed base interface when inline"),blockKeywords:r("try catch finally do else for if switch while"),builtin:r("void bool num int double dynamic var String Null Never"),atoms:r("true false null"),number:/^(?:0x[a-f\d_]+|(?:[\d_]+\.?[\d_]*|\.[\d_]+)(?:e[-+]?[\d_]+)?)/i,hooks:{"@":function(e){return e.eatWhile(/[\w\$_\.]/),"meta"},"'":function(e,n){return R("'",e,n,!1)},'"':function(e,n){return R('"',e,n,!1)},r:function(e,n){var t=e.peek();return t=="'"||t=='"'?R(e.next(),e,n,!0):!1},"}":function(e,n){return he(n)>0?(n.tokenize=ne(n),null):!1},"/":function(e,n){return e.eat("*")?(n.tokenize=S(1),n.tokenize(e,n)):!1},token:function(e,n,t){if(t=="variable"){var l=RegExp("^[_$]*[A-Z][a-zA-Z0-9_$]*$","g");if(l.test(e.current()))return"type"}}}});export{ke as c,De as ceylon,h as clike,ge as cpp,we as csharp,Le as dart,be as java,_e as kotlin,Se as nesC,Te as objectiveC,Ie as objectiveCpp,ve as scala,xe as shader,Ne as squirrel}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clipPlaneFragment-C7XUrTAZ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clipPlaneFragment-C7XUrTAZ.js new file mode 100644 index 0000000000000000000000000000000000000000..e2469b13c0649e8617dadb9d8411c1aa646da1ae --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clipPlaneFragment-C7XUrTAZ.js @@ -0,0 +1,46 @@ +import{S as e}from"./index-CDrXokXW.js";const i="clipPlaneFragmentDeclaration",n=`#ifdef CLIPPLANE +varying fClipDistance: f32; +#endif +#ifdef CLIPPLANE2 +varying fClipDistance2: f32; +#endif +#ifdef CLIPPLANE3 +varying fClipDistance3: f32; +#endif +#ifdef CLIPPLANE4 +varying fClipDistance4: f32; +#endif +#ifdef CLIPPLANE5 +varying fClipDistance5: f32; +#endif +#ifdef CLIPPLANE6 +varying fClipDistance6: f32; +#endif +`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=n);const f="clipPlaneFragment",d=`#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) +if (false) {} +#endif +#ifdef CLIPPLANE +else if (fragmentInputs.fClipDistance>0.0) +{discard;} +#endif +#ifdef CLIPPLANE2 +else if (fragmentInputs.fClipDistance2>0.0) +{discard;} +#endif +#ifdef CLIPPLANE3 +else if (fragmentInputs.fClipDistance3>0.0) +{discard;} +#endif +#ifdef CLIPPLANE4 +else if (fragmentInputs.fClipDistance4>0.0) +{discard;} +#endif +#ifdef CLIPPLANE5 +else if (fragmentInputs.fClipDistance5>0.0) +{discard;} +#endif +#ifdef CLIPPLANE6 +else if (fragmentInputs.fClipDistance6>0.0) +{discard;} +#endif +`;e.IncludesShadersStoreWGSL[f]||(e.IncludesShadersStoreWGSL[f]=d); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clipPlaneFragment-T8W7CIC5.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clipPlaneFragment-T8W7CIC5.js new file mode 100644 index 0000000000000000000000000000000000000000..f784b8152bf0888d6280038e246234a6e50e447f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clipPlaneFragment-T8W7CIC5.js @@ -0,0 +1,46 @@ +import{S as e}from"./index-CDrXokXW.js";const i="clipPlaneFragmentDeclaration",d=`#ifdef CLIPPLANE +varying float fClipDistance; +#endif +#ifdef CLIPPLANE2 +varying float fClipDistance2; +#endif +#ifdef CLIPPLANE3 +varying float fClipDistance3; +#endif +#ifdef CLIPPLANE4 +varying float fClipDistance4; +#endif +#ifdef CLIPPLANE5 +varying float fClipDistance5; +#endif +#ifdef CLIPPLANE6 +varying float fClipDistance6; +#endif +`;e.IncludesShadersStore[i]||(e.IncludesShadersStore[i]=d);const f="clipPlaneFragment",n=`#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) +if (false) {} +#endif +#ifdef CLIPPLANE +else if (fClipDistance>0.0) +{discard;} +#endif +#ifdef CLIPPLANE2 +else if (fClipDistance2>0.0) +{discard;} +#endif +#ifdef CLIPPLANE3 +else if (fClipDistance3>0.0) +{discard;} +#endif +#ifdef CLIPPLANE4 +else if (fClipDistance4>0.0) +{discard;} +#endif +#ifdef CLIPPLANE5 +else if (fClipDistance5>0.0) +{discard;} +#endif +#ifdef CLIPPLANE6 +else if (fClipDistance6>0.0) +{discard;} +#endif +`;e.IncludesShadersStore[f]||(e.IncludesShadersStore[f]=n); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clipPlaneVertex-Bmw4TNCQ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clipPlaneVertex-Bmw4TNCQ.js new file mode 100644 index 0000000000000000000000000000000000000000..cf097cd61ba793ab843c25aae11067e76d4e47f7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clipPlaneVertex-Bmw4TNCQ.js @@ -0,0 +1,37 @@ +import{S as e}from"./index-CDrXokXW.js";const i="clipPlaneVertexDeclaration",n=`#ifdef CLIPPLANE +uniform vec4 vClipPlane;varying float fClipDistance; +#endif +#ifdef CLIPPLANE2 +uniform vec4 vClipPlane2;varying float fClipDistance2; +#endif +#ifdef CLIPPLANE3 +uniform vec4 vClipPlane3;varying float fClipDistance3; +#endif +#ifdef CLIPPLANE4 +uniform vec4 vClipPlane4;varying float fClipDistance4; +#endif +#ifdef CLIPPLANE5 +uniform vec4 vClipPlane5;varying float fClipDistance5; +#endif +#ifdef CLIPPLANE6 +uniform vec4 vClipPlane6;varying float fClipDistance6; +#endif +`;e.IncludesShadersStore[i]||(e.IncludesShadersStore[i]=n);const f="clipPlaneVertex",l=`#ifdef CLIPPLANE +fClipDistance=dot(worldPos,vClipPlane); +#endif +#ifdef CLIPPLANE2 +fClipDistance2=dot(worldPos,vClipPlane2); +#endif +#ifdef CLIPPLANE3 +fClipDistance3=dot(worldPos,vClipPlane3); +#endif +#ifdef CLIPPLANE4 +fClipDistance4=dot(worldPos,vClipPlane4); +#endif +#ifdef CLIPPLANE5 +fClipDistance5=dot(worldPos,vClipPlane5); +#endif +#ifdef CLIPPLANE6 +fClipDistance6=dot(worldPos,vClipPlane6); +#endif +`;e.IncludesShadersStore[f]||(e.IncludesShadersStore[f]=l); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clipPlaneVertex-J3Krgsee.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clipPlaneVertex-J3Krgsee.js new file mode 100644 index 0000000000000000000000000000000000000000..254e73491a35a7e7557c6c12668f100ef9cac8ef --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clipPlaneVertex-J3Krgsee.js @@ -0,0 +1,37 @@ +import{S as e}from"./index-CDrXokXW.js";const i="clipPlaneVertexDeclaration",n=`#ifdef CLIPPLANE +uniform vClipPlane: vec4;varying fClipDistance: f32; +#endif +#ifdef CLIPPLANE2 +uniform vClipPlane2: vec4;varying fClipDistance2: f32; +#endif +#ifdef CLIPPLANE3 +uniform vClipPlane3: vec4;varying fClipDistance3: f32; +#endif +#ifdef CLIPPLANE4 +uniform vClipPlane4: vec4;varying fClipDistance4: f32; +#endif +#ifdef CLIPPLANE5 +uniform vClipPlane5: vec4;varying fClipDistance5: f32; +#endif +#ifdef CLIPPLANE6 +uniform vClipPlane6: vec4;varying fClipDistance6: f32; +#endif +`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=n);const f="clipPlaneVertex",l=`#ifdef CLIPPLANE +vertexOutputs.fClipDistance=dot(worldPos,uniforms.vClipPlane); +#endif +#ifdef CLIPPLANE2 +vertexOutputs.fClipDistance2=dot(worldPos,uniforms.vClipPlane2); +#endif +#ifdef CLIPPLANE3 +vertexOutputs.fClipDistance3=dot(worldPos,uniforms.vClipPlane3); +#endif +#ifdef CLIPPLANE4 +vertexOutputs.fClipDistance4=dot(worldPos,uniforms.vClipPlane4); +#endif +#ifdef CLIPPLANE5 +vertexOutputs.fClipDistance5=dot(worldPos,uniforms.vClipPlane5); +#endif +#ifdef CLIPPLANE6 +vertexOutputs.fClipDistance6=dot(worldPos,uniforms.vClipPlane6); +#endif +`;e.IncludesShadersStoreWGSL[f]||(e.IncludesShadersStoreWGSL[f]=l); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clone-BkeCM4Nl.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clone-BkeCM4Nl.js new file mode 100644 index 0000000000000000000000000000000000000000..b20b3764094ca14cece2f3b58c436532abce0a41 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/clone-BkeCM4Nl.js @@ -0,0 +1,7 @@ +import{D as l,$,ag as w,ah as b}from"./index-DWyDLubb.js";var _="font-weight: bold",m="font-weight: normal";function u(t){l?console.warn(`%c[svelte] state_snapshot_uncloneable +%c${t?`The following properties cannot be cloned with \`$state.snapshot\` — the return value contains the originals: + +${t}`:"Value cannot be cloned with `$state.snapshot` — the original value was returned"} +https://svelte.dev/e/state_snapshot_uncloneable`,_,m):console.warn("https://svelte.dev/e/state_snapshot_uncloneable")}const p=[];function M(t,s=!1,r=!1){if(l&&!s){const n=[],f=c(t,new Map,"",n,null,r);if(n.length===1&&n[0]==="")u();else if(n.length>0){const i=n.length>10?n.slice(0,7):n.slice(0,10),a=n.length-i.length;let e=i.map(o=>`- ${o}`).join(` +`);a>0&&(e+=` +- ...and ${a} more`),u(e)}return f}return c(t,new Map,"",p,null,r)}function c(t,s,r,n,f=null,i=!1){if(typeof t=="object"&&t!==null){var a=s.get(t);if(a!==void 0)return a;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if($(t)){var e=Array(t.length);s.set(t,e),f!==null&&s.set(f,e);for(var o=0;oo[r%o.length];export{t as g}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/colorToUniform-3MxHuUz8.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/colorToUniform-3MxHuUz8.js new file mode 100644 index 0000000000000000000000000000000000000000..b96b5b7eac79807acbb8f0ebc1732cd944866434 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/colorToUniform-3MxHuUz8.js @@ -0,0 +1,31 @@ +const l={name:"local-uniform-bit",vertex:{header:` + + struct LocalUniforms { + uTransformMatrix:mat3x3, + uColor:vec4, + uRound:f32, + } + + @group(1) @binding(0) var localUniforms : LocalUniforms; + `,main:` + vColor *= localUniforms.uColor; + modelMatrix *= localUniforms.uTransformMatrix; + `,end:` + if(localUniforms.uRound == 1) + { + vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); + } + `}},e={...l,vertex:{...l.vertex,header:l.vertex.header.replace("group(1)","group(2)")}},n={name:"local-uniform-bit",vertex:{header:` + + uniform mat3 uTransformMatrix; + uniform vec4 uColor; + uniform float uRound; + `,main:` + vColor *= uColor; + modelMatrix = uTransformMatrix; + `,end:` + if(uRound == 1.) + { + gl_Position.xy = roundPixels(gl_Position.xy, uResolution); + } + `}};class a{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}destroy(){this.reset()}}function s(o,r,t){const i=(o>>24&255)/255;r[t++]=(o&255)/255*i,r[t++]=(o>>8&255)/255*i,r[t++]=(o>>16&255)/255*i,r[t++]=i}export{a as B,l as a,n as b,s as c,e as l}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/colors-Cc3OSVma.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/colors-Cc3OSVma.js new file mode 100644 index 0000000000000000000000000000000000000000..74622a9afd516df4f5365e3e3b8745170fed9d51 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/colors-Cc3OSVma.js @@ -0,0 +1 @@ +function c(n){for(var o=n.length/6|0,l=new Array(o),r=0;r;uniform layerNum: i32;varying vUV: vec2f;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {let coord=vec3f(vec2f(input.vUV.x,input.vUV.y)*vec2f(textureDimensions(textureSampler,0).xy),f32(uniforms.layerNum));let color=textureLoad(textureSampler,vec3i(coord),0).rgb;fragmentOutputs.color= vec4f(color,1);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=t);const u={name:e,shader:t};export{u as copyTexture3DLayerToTexturePixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/cose-bilkent-S5V4N54A-D75Zovpi.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/cose-bilkent-S5V4N54A-D75Zovpi.js new file mode 100644 index 0000000000000000000000000000000000000000..7a542a38ad175f2652ce8e7a096cb946aa690689 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/cose-bilkent-S5V4N54A-D75Zovpi.js @@ -0,0 +1 @@ +import{_ as V,l as $}from"./mermaid.core-7TB2QPZo.js";import{c as tt}from"./cytoscape.esm-5J0xJHOV.js";import{G as lt}from"./i18n-Dnhn5Rxr.js";import{s as gt}from"./select-BigU4G0v.js";import"./index-DWyDLubb.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";var k={exports:{}},Z={exports:{}},Q={exports:{}},ut=Q.exports,j;function ft(){return j||(j=1,(function(G,b){(function(I,L){G.exports=L()})(ut,function(){return(function(N){var I={};function L(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,L),e.l=!0,e.exports}return L.m=N,L.c=I,L.i=function(o){return o},L.d=function(o,e,t){L.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},L.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return L.d(e,"a",e),e},L.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},L.p="",L(L.s=26)})([(function(N,I,L){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,L){var o=L(2),e=L(8),t=L(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,L){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,L){var o=L(2),e=L(10),t=L(13),i=L(0),l=L(16),g=L(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,L){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,L){var o=L(2),e=L(10),t=L(0),i=L(6),l=L(3),g=L(1),n=L(13),d=L(12),r=L(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var T=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(T.source=v,T.target=D,T.isInterGraph=!1,this.getEdges().push(T),v.edges.push(T),D!=v&&D.edges.push(T),T)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,T=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,T,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?T=y[0].getParent().paddingLeft:T=this.margin,this.left=v-T,this.top=p-T,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,T=-e.MAX_VALUE,y,O,s,f,c,E=this.nodes,A=E.length,m=0;my&&(v=y),Ds&&(u=s),Ty&&(v=y),Ds&&(u=s),T=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,L){var o,e=L(1);function t(i){o=L(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=E,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=E,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=E,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+T*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-T*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=E,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,T=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,E=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,E=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*E-f*c)/A,T=(O*c-y*E)/A,new o(u,T))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,L){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,L){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,L){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),T.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}T=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(E,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,T=p[0])}return T},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,L){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,L){var o=L(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,L){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),T;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),T=new Set,a=0;ay||T>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||T>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,L){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(E){return f.has(E)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,E=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,E),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RE&&(E=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var E=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,E);var A=u.calculateBounds(s),m=new T;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(E-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var q=(c+F*W)%360,ht=(q+W)%360;y.branchRadialLayout(K,s,q,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],E=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,E=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,E,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var E=s.idToDummyNode[c],A=E.paddingLeft,m=E.paddingTop;s.adjustLocations(f[c],E.rect.x,E.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var E=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,E=0;EM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(E){var A=f[E];c.tiledMemberPack[E]=c.tileNodes(s[E],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[E].width,A.rect.height=c.tiledMemberPack[E].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,E=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:E};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,E=0;Ec&&(f=E,c=s.rowWidth[E]);return f},y.prototype.canAddHorizontal=function(s,f,c){var E=this.getShortestRowIndex(s);if(E<0)return!0;var A=s.rowWidth[E];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[E]0&&(m=c+s.verticalPadding-s.rowHeight[E]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){E.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=E[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=T.getGraphManager().add(T.newGraph(),c),this.processChildrenList(R,f,T)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(k)),k.exports}var yt=vt();const Et=lt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(L=>{["id","label","height","width","padding","x","y"].includes(L)||(I[L]=N[L])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(L=>{["id","start","end"].includes(L)||(I[L]=N[L])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=gt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const L={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(L).run(),I.ready(o=>{$.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),L={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(L[o]=N[o])}),L})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,L={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(L[o]=N[o])}),L})}V(ot,"extractPositionedEdges");async function st(G,b){$.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),L=ot(N);return $.debug(`Layout completed: ${I.length} nodes, ${L.length} edges`),{nodes:I,edges:L}}catch(N){throw $.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:L,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const T={...u};n[u.id]=T,g[u.id]=T,await N(r,u)}else{const T={...u};g[u.id]=T;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();T.width=O.width,T.height=O.height,T.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const T=g[u.id];return{...u,width:T.width,height:T.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const T=g[u.id];T?.domId&&(T.domId.attr("transform",`translate(${u.x}, ${u.y})`),T.x=u.x,T.y=u.y,t.debug(`Positioned node ${T.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const T=G.edges.find(y=>y.id===u.id);T&&(T.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await L(a,u);const T=g[u.start??""],y=g[u.end??""];if(T&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,T,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:T.x||0,y:T.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,T,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),Ct=Lt;export{Ct as render}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/cubeTexture-BcGycaMd.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/cubeTexture-BcGycaMd.js new file mode 100644 index 0000000000000000000000000000000000000000..7ddc170eaadc640be07c67498881cba5db90198c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/cubeTexture-BcGycaMd.js @@ -0,0 +1 @@ +import{B as z,M as g,O as C,V as p,T as M,c as S,d as P,e as R,G as D,_ as o,s as _,f as v,g as A,R as E}from"./index-CDrXokXW.js";import"./abstractEngine.cubeTexture-BasnejWx.js";import"./index-DWyDLubb.js";const L=.8;class a extends z{set boundingBoxSize(t){if(this._boundingBoxSize&&this._boundingBoxSize.equals(t))return;this._boundingBoxSize=t;const i=this.getScene();i&&i.markAllMaterialsAsDirty(1)}get boundingBoxSize(){return this._boundingBoxSize}set rotationY(t){this._rotationY=t,this.setReflectionTextureMatrix(g.RotationY(this._rotationY))}get rotationY(){return this._rotationY}get noMipmap(){return this._noMipmap}get forcedExtension(){return this._forcedExtension}static CreateFromImages(t,i,e){let r="";for(const s of t)r+=s;return new a(r,i,null,e,t)}static CreateFromPrefilteredData(t,i,e=null,r=!0){const s=i.useDelayedTextureLoading;i.useDelayedTextureLoading=!1;const l=new a(t,i,null,!1,null,null,null,void 0,!0,e,r);return i.useDelayedTextureLoading=s,l}constructor(t,i,e=null,r=!1,s=null,l=null,n=null,u=5,c=!1,h=null,f=!1,m=L,x=0,b,d){super(i),this.onLoadObservable=new C,this.boundingBoxPosition=p.Zero(),this._rotationY=0,this._files=null,this._forcedExtension=null,this._extensions=null,this._textureMatrixRefraction=new g,this._buffer=null,this.name=t,this.url=t,this._noMipmap=r,this.hasAlpha=!1,this.isCube=!0,this._textureMatrix=g.Identity(),this.coordinatesMode=M.CUBIC_MODE;let y=null,B=null;e!==null&&!Array.isArray(e)?(y=e.extensions??null,this._noMipmap=e.noMipmap??!1,s=e.files??null,B=e.buffer??null,this._format=e.format??5,c=e.prefiltered??!1,h=e.forcedExtension??null,this._createPolynomials=e.createPolynomials??!1,this._lodScale=e.lodScale??L,this._lodOffset=e.lodOffset??0,this._loaderOptions=e.loaderOptions,this._useSRGBBuffer=e.useSRGBBuffer,l=e.onLoad??null,n=e.onError??null):(this._noMipmap=r,this._format=u,this._createPolynomials=f,y=e,this._loaderOptions=b,this._useSRGBBuffer=d,this._lodScale=m,this._lodOffset=x),!(!t&&!s)&&this.updateURL(t,h,l,c,n,y,this.getScene()?.useDelayedTextureLoading,s,B)}getClassName(){return"CubeTexture"}updateURL(t,i=null,e=null,r=!1,s=null,l=null,n=!1,u=null,c=null){(!this.name||this.name.startsWith("data:"))&&(this.name=t),this.url=t,i&&(this._forcedExtension=i);const h=t.lastIndexOf("."),f=i||(h>-1?t.substring(h).toLowerCase():""),m=f.indexOf(".dds")===0,x=f.indexOf(".env")===0,b=f.indexOf(".basis")===0;if(x?(this.gammaSpace=!1,this._prefiltered=!1,this.anisotropicFilteringLevel=1):(this._prefiltered=r,r&&(this.gammaSpace=!1,this.anisotropicFilteringLevel=1)),u)this._files=u;else if(!b&&!x&&!m&&!l&&(l=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),this._files=this._files||[],this._files.length=0,l){for(let d=0;ds.getActiveTextures().indexOf(this)!==-1),this._textureMatrix=t,!this.getScene()?.useRightHandedSystem))return;const i=S.Vector3[0],e=S.Quaternion[0],r=S.Vector3[1];this._textureMatrix.decompose(i,e,r),e.z*=-1,e.w*=-1,g.ComposeToRef(i,e,r,this._textureMatrixRefraction)}getRefractionTextureMatrix(){return this.getScene()?.useRightHandedSystem?this._textureMatrixRefraction:this._textureMatrix}_loadTexture(t=null,i=null){const e=this.getScene(),r=this._texture;this._texture=this._getFromCache(this.url,this._noMipmap,void 0,void 0,this._useSRGBBuffer,this.isCube);const s=()=>{this.onLoadObservable.notifyObservers(this),r&&(r.dispose(),this.getScene()?.markAllMaterialsAsDirty(1)),t&&t()},l=(n,u)=>{this._loadingError=!0,this._errorObject={message:n,exception:u},i&&i(n,u),M.OnTextureLoadErrorObservable.notifyObservers(this)};this._texture?this._texture.isReady?P.SetImmediate(()=>s()):this._texture.onLoadedObservable.add(()=>s()):(this._prefiltered?this._texture=this._getEngine().createPrefilteredCubeTexture(this.url,e,this._lodScale,this._lodOffset,t,l,this._format,this._forcedExtension,this._createPolynomials):this._texture=this._getEngine().createCubeTexture(this.url,e,this._files,this._noMipmap,t,l,this._format,this._forcedExtension,!1,this._lodScale,this._lodOffset,null,this._loaderOptions,!!this._useSRGBBuffer,this._buffer),this._texture?.onLoadedObservable.add(()=>this.onLoadObservable.notifyObservers(this)))}static Parse(t,i,e){const r=R.Parse(()=>{let s=!1;return t.prefiltered&&(s=t.prefiltered),new a(e+(t.url??t.name),i,t.extensions,!1,t.files||null,null,null,void 0,s,t.forcedExtension)},t,i);if(t.boundingBoxPosition&&(r.boundingBoxPosition=p.FromArray(t.boundingBoxPosition)),t.boundingBoxSize&&(r.boundingBoxSize=p.FromArray(t.boundingBoxSize)),t.animations)for(let s=0;s{const e=new a(this.url,this.getScene()||this._getEngine(),this._extensions,this._noMipmap,this._files);return t=e.uniqueId,e},this);return i.uniqueId=t,i}}o([_()],a.prototype,"url",void 0);o([v()],a.prototype,"boundingBoxPosition",void 0);o([v()],a.prototype,"boundingBoxSize",null);o([_("rotationY")],a.prototype,"rotationY",null);o([_("files")],a.prototype,"_files",void 0);o([_("forcedExtension")],a.prototype,"_forcedExtension",void 0);o([_("extensions")],a.prototype,"_extensions",void 0);o([A("textureMatrix")],a.prototype,"_textureMatrix",void 0);o([A("textureMatrixRefraction")],a.prototype,"_textureMatrixRefraction",void 0);M._CubeTextureParser=a.Parse;E("BABYLON.CubeTexture",a);export{a as CubeTexture}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/cytoscape.esm-5J0xJHOV.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/cytoscape.esm-5J0xJHOV.js new file mode 100644 index 0000000000000000000000000000000000000000..969925daaec19e31522435d3651e38593fafa631 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/cytoscape.esm-5J0xJHOV.js @@ -0,0 +1,321 @@ +function Bs(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,a=Array(e);t=r.length?{done:!0}:{done:!1,value:r[a++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,o=!1;return{s:function(){t=t.call(r)},n:function(){var l=t.next();return s=l.done,l},e:function(l){o=!0,i=l},f:function(){try{s||t.return==null||t.return()}finally{if(o)throw i}}}}function Jl(r,e,t){return(e=jl(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ac(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function nc(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var a,n,i,s,o=[],l=!0,u=!1;try{if(i=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(a=i.call(t)).done)&&(o.push(a.value),o.length!==e);l=!0);}catch(v){u=!0,n=v}finally{try{if(!l&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(u)throw n}}return o}}function ic(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sc(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Je(r,e){return ec(r)||nc(r,e)||Xs(r,e)||ic()}function mn(r){return rc(r)||ac(r)||Xs(r)||sc()}function oc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var a=t.call(r,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function jl(r){var e=oc(r,"string");return typeof e=="symbol"?e:e+""}function ar(r){"@babel/helpers - typeof";return ar=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ar(r)}function Xs(r,e){if(r){if(typeof r=="string")return Bs(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Bs(r,e):void 0}}var rr=typeof window>"u"?null:window,To=rr?rr.navigator:null;rr&&rr.document;var uc=ar(""),ev=ar({}),lc=ar(function(){}),vc=typeof HTMLElement>"u"?"undefined":ar(HTMLElement),La=function(e){return e&&e.instanceString&&Ue(e.instanceString)?e.instanceString():null},ge=function(e){return e!=null&&ar(e)==uc},Ue=function(e){return e!=null&&ar(e)===lc},_e=function(e){return!Dr(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Le=function(e){return e!=null&&ar(e)===ev&&!_e(e)&&e.constructor===Object},fc=function(e){return e!=null&&ar(e)===ev},ae=function(e){return e!=null&&ar(e)===ar(1)&&!isNaN(e)},cc=function(e){return ae(e)&&Math.floor(e)===e},bn=function(e){if(vc!=="undefined")return e!=null&&e instanceof HTMLElement},Dr=function(e){return Ia(e)||rv(e)},Ia=function(e){return La(e)==="collection"&&e._private.single},rv=function(e){return La(e)==="collection"&&!e._private.single},Ys=function(e){return La(e)==="core"},tv=function(e){return La(e)==="stylesheet"},dc=function(e){return La(e)==="event"},ut=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},hc=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},gc=function(e){return Le(e)&&ae(e.x1)&&ae(e.x2)&&ae(e.y1)&&ae(e.y2)},pc=function(e){return fc(e)&&Ue(e.then)},yc=function(){return To&&To.userAgent.match(/msie|trident|edge/i)},Qt=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;st?1:0},Tc=function(e,t){return-1*nv(e,t)},be=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t1&&(g-=1),g<1/6?d+(y-d)*6*g:g<1/2?y:g<2/3?d+(y-d)*(2/3-g)*6:d}var f=new RegExp("^"+wc+"$").exec(e);if(f){if(a=parseInt(f[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(f[2]),n<0||n>100||(n=n/100,i=parseFloat(f[3]),i<0||i>100)||(i=i/100,s=f[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=l=u=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,h=2*i-c;o=Math.round(255*v(h,c,a+1/3)),l=Math.round(255*v(h,c,a)),u=Math.round(255*v(h,c,a-1/3))}t=[o,l,u,s]}return t},Dc=function(e){var t,a=new RegExp("^"+mc+"$").exec(e);if(a){t=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if(s[s.length-1]==="%"&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;t.push(Math.floor(s))}var o=n[1]||n[2]||n[3],l=n[1]&&n[2]&&n[3];if(o&&!l)return;var u=a[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;t.push(u)}}return t},Bc=function(e){return Pc[e.toLowerCase()]},iv=function(e){return(_e(e)?e:null)||Bc(e)||Sc(e)||Dc(e)||kc(e)},Pc={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},sv=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i=l||R<0||m&&L>=c}function T(){var A=e();if(x(A))return k(A);d=setTimeout(T,C(A))}function k(A){return d=void 0,b&&v?w(A):(v=f=void 0,h)}function D(){d!==void 0&&clearTimeout(d),g=0,v=y=f=d=void 0}function B(){return d===void 0?h:k(e())}function P(){var A=e(),R=x(A);if(v=arguments,f=this,y=A,R){if(d===void 0)return E(y);if(m)return clearTimeout(d),d=setTimeout(T,l),w(y)}return d===void 0&&(d=setTimeout(T,l)),h}return P.cancel=D,P.flush=B,P}return fi=s,fi}var Vc=Fc(),Fa=Oa(Vc),ci=rr?rr.performance:null,lv=ci&&ci.now?function(){return ci.now()}:function(){return Date.now()},qc=(function(){if(rr){if(rr.requestAnimationFrame)return function(r){rr.requestAnimationFrame(r)};if(rr.mozRequestAnimationFrame)return function(r){rr.mozRequestAnimationFrame(r)};if(rr.webkitRequestAnimationFrame)return function(r){rr.webkitRequestAnimationFrame(r)};if(rr.msRequestAnimationFrame)return function(r){rr.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(lv())},1e3/60)}})(),wn=function(e){return qc(e)},Yr=lv,Tt=9261,vv=65599,Ht=5381,fv=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Tt,a=t,n;n=e.next(),!n.done;)a=a*vv+n.value|0;return a},Ca=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Tt;return t*vv+e|0},Ta=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ht;return(t<<5)+t+e|0},_c=function(e,t){return e*2097152+t},et=function(e){return e[0]*2097152+e[1]},Xa=function(e,t){return[Ca(e[0],t[0]),Ta(e[1],t[1])]},qo=function(e,t){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n=0;n--)e[n]===t&&e.splice(n,1)},eo=function(e){e.splice(0,e.length)},Qc=function(e,t){for(var a=0;a"u"?"undefined":ar(Set))!==jc?Set:ed,In=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!Ys(e)){$e("An element must have a core reference and parameters set");return}var n=t.group;if(n==null&&(t.data&&t.data.source!=null&&t.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){$e("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?n==="edges":!!t.pannable,active:!1,classes:new ra,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var s=t.renderedPosition,o=e.pan(),l=e.zoom();i.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];_e(t.classes)?u=t.classes:ge(t.classes)&&(u=t.classes.split(/\s+/));for(var v=0,f=u.length;vm?1:0},v=function(p,m,b,w,E){var C;if(b==null&&(b=0),E==null&&(E=a),b<0)throw new Error("lo must be non-negative");for(w==null&&(w=p.length);bD;0<=D?k++:k--)T.push(k);return T}).apply(this).reverse(),x=[],w=0,E=C.length;wB;0<=B?++T:--T)P.push(s(p,b));return P},y=function(p,m,b,w){var E,C,x;for(w==null&&(w=a),E=p[b];b>m;){if(x=b-1>>1,C=p[x],w(E,C)<0){p[b]=C,b=x;continue}break}return p[b]=E},g=function(p,m,b){var w,E,C,x,T;for(b==null&&(b=a),E=p.length,T=m,C=p[m],w=2*m+1;w0;){var C=m.pop(),x=g(C),T=C.id();if(c[T]=x,x!==1/0)for(var k=C.neighborhood().intersect(d),D=0;D0)for(O.unshift(M);f[G];){var N=f[G];O.unshift(N.edge),O.unshift(N.node),V=N.node,G=V.id()}return o.spawn(O)}}}},od={kruskal:function(e){e=e||function(b){return 1};for(var t=this.byGroup(),a=t.nodes,n=t.edges,i=a.length,s=new Array(i),o=a,l=function(w){for(var E=0;E0;){if(E(),x++,w===v){for(var T=[],k=i,D=v,B=p[D];T.unshift(k),B!=null&&T.unshift(B),k=g[D],k!=null;)D=k.id(),B=p[D];return{found:!0,distance:f[w],path:this.spawn(T),steps:x}}h[w]=!0;for(var P=b._private.edges,A=0;AB&&(d[D]=B,m[D]=k,b[D]=E),!i){var P=k*v+T;!i&&d[P]>B&&(d[P]=B,m[P]=T,b[P]=E)}}}for(var A=0;A1&&arguments[1]!==void 0?arguments[1]:s,ie=b(we),de=[],he=ie;;){if(he==null)return t.spawn();var Ee=m(he),pe=Ee.edge,Se=Ee.pred;if(de.unshift(he[0]),he.same(ye)&&de.length>0)break;pe!=null&&de.unshift(pe),he=Se}return l.spawn(de)},C=0;C=0;v--){var f=u[v],c=f[1],h=f[2];(t[c]===o&&t[h]===l||t[c]===l&&t[h]===o)&&u.splice(v,1)}for(var d=0;dn;){var i=Math.floor(Math.random()*t.length);t=gd(i,e,t),a--}return t},pd={kargerStein:function(){var e=this,t=this.byGroup(),a=t.nodes,n=t.edges;n.unmergeBy(function(O){return O.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/hd);if(i<2){$e("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],v=0;v1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=t;i1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=t;i1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,s=t;s1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(t,a):(a0&&e.splice(0,t));for(var o=0,l=e.length-1;l>=0;l--){var u=e[l];s?isFinite(u)||(e[l]=-1/0,o++):e.splice(l,1)}i&&e.sort(function(c,h){return c-h});var v=e.length,f=Math.floor(v/2);return v%2!==0?e[f+1+o]:(e[f-1+o]+e[f+o])/2},Ed=function(e){return Math.PI*e/180},Ya=function(e,t){return Math.atan2(t,e)-Math.PI/2},ro=Math.log2||function(r){return Math.log(r)/Math.log(2)},to=function(e){return e>0?1:e<0?-1:0},Bt=function(e,t){return Math.sqrt(Et(e,t))},Et=function(e,t){var a=t.x-e.x,n=t.y-e.y;return a*a+n*n},Cd=function(e){for(var t=e.length,a=0,n=0;n=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Sd=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},kd=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Dd=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},mv=function(e,t,a){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},un=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},ln=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,s;if(t.length===1)a=n=i=s=t[0];else if(t.length===2)a=i=t[0],s=n=t[1];else if(t.length===4){var o=Je(t,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Uo=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},ao=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2t.y2||t.y1>e.y2)},nt=function(e,t,a){return e.x1<=t&&t<=e.x2&&e.y1<=a&&a<=e.y2},Ko=function(e,t){return nt(e,t.x,t.y)},bv=function(e,t){return nt(e,t.x1,t.y1)&&nt(e,t.x2,t.y2)},Bd=(gi=Math.hypot)!==null&&gi!==void 0?gi:function(r,e){return Math.sqrt(r*r+e*e)};function Pd(r,e){if(r.length<3)throw new Error("Need at least 3 vertices");var t=function(T,k){return{x:T.x+k.x,y:T.y+k.y}},a=function(T,k){return{x:T.x-k.x,y:T.y-k.y}},n=function(T,k){return{x:T.x*k,y:T.y*k}},i=function(T,k){return T.x*k.y-T.y*k.x},s=function(T){var k=Bd(T.x,T.y);return k===0?{x:0,y:0}:{x:T.x/k,y:T.y/k}},o=function(T){for(var k=0,D=0;D7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?vt(i,s):l,v=i/2,f=s/2;u=Math.min(u,v,f);var c=u!==v,h=u!==f,d;if(c){var y=a-v+u-o,g=n-f-o,p=a+v-u+o,m=g;if(d=it(e,t,a,n,y,g,p,m,!1),d.length>0)return d}if(h){var b=a+v+o,w=n-f+u-o,E=b,C=n+f-u+o;if(d=it(e,t,a,n,b,w,E,C,!1),d.length>0)return d}if(c){var x=a-v+u-o,T=n+f+o,k=a+v-u+o,D=T;if(d=it(e,t,a,n,x,T,k,D,!1),d.length>0)return d}if(h){var B=a-v-o,P=n-f+u-o,A=B,R=n+f-u+o;if(d=it(e,t,a,n,B,P,A,R,!1),d.length>0)return d}var L;{var I=a-v+u,M=n-f+u;if(L=ya(e,t,a,n,I,M,u+o),L.length>0&&L[0]<=I&&L[1]<=M)return[L[0],L[1]]}{var O=a+v-u,V=n-f+u;if(L=ya(e,t,a,n,O,V,u+o),L.length>0&&L[0]>=O&&L[1]<=V)return[L[0],L[1]]}{var G=a+v-u,N=n+f-u;if(L=ya(e,t,a,n,G,N,u+o),L.length>0&&L[0]>=G&&L[1]>=N)return[L[0],L[1]]}{var F=a-v+u,U=n+f-u;if(L=ya(e,t,a,n,F,U,u+o),L.length>0&&L[0]<=F&&L[1]>=U)return[L[0],L[1]]}return[]},Rd=function(e,t,a,n,i,s,o){var l=o,u=Math.min(a,i),v=Math.max(a,i),f=Math.min(n,s),c=Math.max(n,s);return u-l<=e&&e<=v+l&&f-l<=t&&t<=c+l},Md=function(e,t,a,n,i,s,o,l,u){var v={x1:Math.min(a,o,i)-u,x2:Math.max(a,o,i)+u,y1:Math.min(n,l,s)-u,y2:Math.max(n,l,s)+u};return!(ev.x2||tv.y2)},Ld=function(e,t,a,n){a-=n;var i=t*t-4*e*a;if(i<0)return[];var s=Math.sqrt(i),o=2*e,l=(-t+s)/o,u=(-t-s)/o;return[l,u]},Id=function(e,t,a,n,i){var s=1e-5;e===0&&(e=s),t/=e,a/=e,n/=e;var o,l,u,v,f,c,h,d;if(l=(3*a-t*t)/9,u=-(27*n)+t*(9*a-2*(t*t)),u/=54,o=l*l*l+u*u,i[1]=0,h=t/3,o>0){f=u+Math.sqrt(o),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),c=u-Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+f+c,h+=(f+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+f)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,o===0){d=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}l=-l,v=l*l*l,v=Math.acos(u/Math.sqrt(v)),d=2*Math.sqrt(l),i[0]=-h+d*Math.cos(v/3),i[2]=-h+d*Math.cos((v+2*Math.PI)/3),i[4]=-h+d*Math.cos((v+4*Math.PI)/3)},Od=function(e,t,a,n,i,s,o,l){var u=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*l+4*s*s-4*s*l+l*l,v=9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*l-6*s*s+3*s*l,f=3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*l-n*t+2*s*s+2*s*t-l*t,c=1*a*i-a*a+a*e-i*e+n*s-n*n+n*t-s*t,h=[];Id(u,v,f,c,h);for(var d=1e-7,y=[],g=0;g<6;g+=2)Math.abs(h[g+1])=0&&h[g]<=1&&y.push(h[g]);y.push(1),y.push(0);for(var p=-1,m,b,w,E=0;E=0?wu?(e-i)*(e-i)+(t-s)*(t-s):v-c},Sr=function(e,t,a){for(var n,i,s,o,l,u=0,v=0;v=e&&e>=s||n<=e&&e<=s)l=(e-n)/(s-n)*(o-i)+i,l>t&&u++;else continue;return u%2!==0},Zr=function(e,t,a,n,i,s,o,l,u){var v=new Array(a.length),f;l[0]!=null?(f=Math.atan(l[1]/l[0]),l[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=l;for(var c=Math.cos(-f),h=Math.sin(-f),d=0;d0){var g=Cn(v,-u);y=En(g)}else y=v;return Sr(e,t,y)},zd=function(e,t,a,n,i,s,o,l){for(var u=new Array(a.length*2),v=0;v=0&&g<=1&&m.push(g),p>=0&&p<=1&&m.push(p),m.length===0)return[];var b=m[0]*l[0]+e,w=m[0]*l[1]+t;if(m.length>1){if(m[0]==m[1])return[b,w];var E=m[1]*l[0]+e,C=m[1]*l[1]+t;return[b,w,E,C]}else return[b,w]},pi=function(e,t,a){return t<=e&&e<=a||a<=e&&e<=t?e:e<=t&&t<=a||a<=t&&t<=e?t:a},it=function(e,t,a,n,i,s,o,l,u){var v=e-i,f=a-e,c=o-i,h=t-s,d=n-t,y=l-s,g=c*h-y*v,p=f*h-d*v,m=y*f-c*d;if(m!==0){var b=g/m,w=p/m,E=.001,C=0-E,x=1+E;return C<=b&&b<=x&&C<=w&&w<=x?[e+b*f,t+b*d]:u?[e+b*f,t+b*d]:[]}else return g===0||p===0?pi(e,a,o)===o?[o,l]:pi(e,a,i)===i?[i,s]:pi(i,o,a)===a?[a,n]:[]:[]},Vd=function(e,t,a,n,i){var s=[],o=n/2,l=i/2,u=t,v=a;s.push({x:u+o*e[0],y:v+l*e[1]});for(var f=1;f0){var y=Cn(f,-l);h=En(y)}else h=f}else h=a;for(var g,p,m,b,w=0;w2){for(var d=[v[0],v[1]],y=Math.pow(d[0]-e,2)+Math.pow(d[1]-t,2),g=1;gv&&(v=w)},get:function(b){return u[b]}},c=0;c0?L=R.edgesTo(A)[0]:L=A.edgesTo(R)[0];var I=n(L);A=A.id(),x[A]>x[B]+I&&(x[A]=x[B]+I,T.nodes.indexOf(A)<0?T.push(A):T.updateItem(A),C[A]=0,E[A]=[]),x[A]==x[B]+I&&(C[A]=C[A]+C[B],E[A].push(B))}else for(var M=0;M0;){for(var N=w.pop(),F=0;F0&&o.push(a[l]);o.length!==0&&i.push(n.collection(o))}return i},eh=function(e,t){for(var a=0;a5&&arguments[5]!==void 0?arguments[5]:ah,o=n,l,u,v=0;v=2?va(e,t,a,0,Jo,nh):va(e,t,a,0,Qo)},squaredEuclidean:function(e,t,a){return va(e,t,a,0,Jo)},manhattan:function(e,t,a){return va(e,t,a,0,Qo)},max:function(e,t,a){return va(e,t,a,-1/0,ih)}};Jt["squared-euclidean"]=Jt.squaredEuclidean;Jt.squaredeuclidean=Jt.squaredEuclidean;function Nn(r,e,t,a,n,i){var s;return Ue(r)?s=r:s=Jt[r]||Jt.euclidean,e===0&&Ue(r)?s(n,i):s(e,t,a,n,i)}var sh=cr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),io=function(e){return sh(e)},Tn=function(e,t,a,n,i){var s=i!=="kMedoids",o=s?function(f){return a[f]}:function(f){return n[f](a)},l=function(c){return n[c](t)},u=a,v=t;return Nn(e,n.length,o,l,u,v)},mi=function(e,t,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(t),l=null,u=0;ua)return!1}return!0},lh=function(e,t,a){for(var n=0;no&&(o=t[u][v],l=v);i[l].push(e[u])}for(var f=0;f=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=t[s],y=t[n[s]],g;i.mode==="dendrogram"?g={left:d,right:y,key:d.key}:g={value:d.value.concat(y.value),key:d.key},e[d.index]=g,e.splice(y.index,1),t[d.key]=g;for(var p=0;pa[y.key][m.key]&&(l=a[y.key][m.key])):i.linkage==="max"?(l=a[d.key][m.key],a[d.key][m.key]0&&n.push(i);return n},nu=function(e,t,a){for(var n=[],i=0;io&&(s=u,o=t[i*e+u])}s>0&&n.push(s)}for(var v=0;vu&&(l=v,u=f)}a[i]=s[l]}return n=nu(e,t,a),n},iu=function(e){for(var t=this.cy(),a=this.nodes(),n=xh(e),i={},s=0;s=B?(P=B,B=R,A=L):R>P&&(P=R);for(var I=0;I0?1:0;x[k%n.minIterations*o+F]=U,N+=U}if(N>0&&(k>=n.minIterations-1||k==n.maxIterations-1)){for(var Q=0,K=0;K1||C>1)&&(o=!0),f[b]=[],m.outgoers().forEach(function(T){T.isEdge()&&f[b].push(T.id())})}else c[b]=[void 0,m.target().id()]}):s.forEach(function(m){var b=m.id();if(m.isNode()){var w=m.degree(!0);w%2&&(l?u?o=!0:u=b:l=b),f[b]=[],m.connectedEdges().forEach(function(E){return f[b].push(E.id())})}else c[b]=[m.source().id(),m.target().id()]});var h={found:!1,trail:void 0};if(o)return h;if(u&&l)if(i){if(v&&u!=v)return h;v=u}else{if(v&&u!=v&&l!=v)return h;v||(v=u)}else v||(v=s[0].id());var d=function(b){for(var w=b,E=[b],C,x,T;f[w].length;)C=f[w].shift(),x=c[C][0],T=c[C][1],w!=T?(f[T]=f[T].filter(function(k){return k!=C}),w=T):!i&&w!=x&&(f[x]=f[x].filter(function(k){return k!=C}),w=x),E.unshift(C),E.unshift(w);return E},y=[],g=[];for(g=d(v);g.length!=1;)f[g[0]].length==0?(y.unshift(s.getElementById(g.shift())),y.unshift(s.getElementById(g.shift()))):g=d(g.shift()).concat(g);y.unshift(s.getElementById(g.shift()));for(var p in f)if(f[p].length)return h;return h.found=!0,h.trail=this.spawn(y,!0),h}},Qa=function(){var e=this,t={},a=0,n=0,i=[],s=[],o={},l=function(c,h){for(var d=s.length-1,y=[],g=e.spawn();s[d].x!=c||s[d].y!=h;)y.push(s.pop().edge),d--;y.push(s.pop().edge),y.forEach(function(p){var m=p.connectedNodes().intersection(e);g.merge(p),m.forEach(function(b){var w=b.id(),E=b.connectedEdges().intersection(e);g.merge(b),t[w].cutVertex?g.merge(E.filter(function(C){return C.isLoop()})):g.merge(E)})}),i.push(g)},u=function(c,h,d){c===d&&(n+=1),t[h]={id:a,low:a++,cutVertex:!1};var y=e.getElementById(h).connectedEdges().intersection(e);if(y.size()===0)i.push(e.spawn(e.getElementById(h)));else{var g,p,m,b;y.forEach(function(w){g=w.source().id(),p=w.target().id(),m=g===h?p:g,m!==d&&(b=w.id(),o[b]||(o[b]=!0,s.push({x:h,y:m,edge:w})),m in t?t[h].low=Math.min(t[h].low,t[m].id):(u(c,m,h),t[h].low=Math.min(t[h].low,t[m].low),t[h].id<=t[m].low&&(t[h].cutVertex=!0,l(h,m))))})}};e.forEach(function(f){if(f.isNode()){var c=f.id();c in t||(n=0,u(c,c),t[c].cutVertex=n>1)}});var v=Object.keys(t).filter(function(f){return t[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(v),components:i}},Ph={hopcroftTarjanBiconnected:Qa,htbc:Qa,htb:Qa,hopcroftTarjanBiconnectedComponents:Qa},Ja=function(){var e=this,t={},a=0,n=[],i=[],s=e.spawn(e),o=function(u){i.push(u),t[u]={index:a,low:a++,explored:!1};var v=e.getElementById(u).connectedEdges().intersection(e);if(v.forEach(function(y){var g=y.target().id();g!==u&&(g in t||o(g),t[g].explored||(t[u].low=Math.min(t[u].low,t[g].low)))}),t[u].index===t[u].low){for(var f=e.spawn();;){var c=i.pop();if(f.merge(e.getElementById(c)),t[c].low=t[u].index,t[c].explored=!0,c===u)break}var h=f.edgesWith(f),d=f.merge(h);n.push(d),s=s.difference(d)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in t||o(u)}}),{cut:s,components:n}},Ah={tarjanStronglyConnected:Ja,tsc:Ja,tscc:Ja,tarjanStronglyConnectedComponents:Ja},Dv={};[Sa,sd,od,ld,fd,dd,pd,Hd,Xt,Yt,Rs,th,gh,bh,kh,Bh,Ph,Ah].forEach(function(r){be(Dv,r)});var Bv=0,Pv=1,Av=2,Nr=function(e){if(!(this instanceof Nr))return new Nr(e);this.id="Thenable/1.0.7",this.state=Bv,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Nr.prototype={fulfill:function(e){return su(this,Pv,"fulfillValue",e)},reject:function(e){return su(this,Av,"rejectReason",e)},then:function(e,t){var a=this,n=new Nr;return a.onFulfilled.push(uu(e,n,"fulfill")),a.onRejected.push(uu(t,n,"reject")),Rv(a),n.proxy}};var su=function(e,t,a,n){return e.state===Bv&&(e.state=t,e[a]=n,Rv(e)),e},Rv=function(e){e.state===Pv?ou(e,"onFulfilled",e.fulfillValue):e.state===Av&&ou(e,"onRejected",e.rejectReason)},ou=function(e,t,a){if(e[t].length!==0){var n=e[t];e[t]=[];var i=function(){for(var o=0;o0}},clearQueue:function(){return function(){var t=this,a=t.length!==void 0,n=a?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var s=0;s-1}return qi=e,qi}var _i,Ru;function Yh(){if(Ru)return _i;Ru=1;var r=Vn();function e(t,a){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,a])):n[i][1]=a,this}return _i=e,_i}var Gi,Mu;function Zh(){if(Mu)return Gi;Mu=1;var r=$h(),e=Uh(),t=Kh(),a=Xh(),n=Yh();function i(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o-1&&a%1==0&&a0&&this.spawn(n).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){_e(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=t===void 0,i=[],s=0,o=a.length;s0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var a=this;if(t==null)t=250;else if(t===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},t),a}};vn.className=vn.classNames=vn.classes;var Me={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:tr,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Me.variable="(?:[\\w-.]|(?:\\\\"+Me.metaChar+"))+";Me.className="(?:[\\w-]|(?:\\\\"+Me.metaChar+"))+";Me.value=Me.string+"|"+Me.number;Me.id=Me.variable;(function(){var r,e,t;for(r=Me.comparatorOp.split("|"),t=0;t=0)&&e!=="="&&(Me.comparatorOp+="|\\!"+e)})();var qe=function(){return{checks:[]}},se={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Os=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(r,e){return Tc(r.selector,e.selector)}),Dg=(function(){for(var r={},e,t=0;t0&&v.edgeCount>0)return Ve("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(v.edgeCount>1)return Ve("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;v.edgeCount===1&&Ve("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},Lg=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(v){return v??""},t=function(v){return ge(v)?'"'+v+'"':e(v)},a=function(v){return" "+v+" "},n=function(v,f){var c=v.type,h=v.value;switch(c){case se.GROUP:{var d=e(h);return d.substring(0,d.length-1)}case se.DATA_COMPARE:{var y=v.field,g=v.operator;return"["+y+a(e(g))+t(h)+"]"}case se.DATA_BOOL:{var p=v.operator,m=v.field;return"["+e(p)+m+"]"}case se.DATA_EXIST:{var b=v.field;return"["+b+"]"}case se.META_COMPARE:{var w=v.operator,E=v.field;return"[["+E+a(e(w))+t(h)+"]]"}case se.STATE:return h;case se.ID:return"#"+h;case se.CLASS:return"."+h;case se.PARENT:case se.CHILD:return i(v.parent,f)+a(">")+i(v.child,f);case se.ANCESTOR:case se.DESCENDANT:return i(v.ancestor,f)+" "+i(v.descendant,f);case se.COMPOUND_SPLIT:{var C=i(v.left,f),x=i(v.subject,f),T=i(v.right,f);return C+(C.length>0?" ":"")+x+T}case se.TRUE:return""}},i=function(v,f){return v.checks.reduce(function(c,h,d){return c+(f===v&&d===0?"$":"")+n(h,f)},"")},s="",o=0;o1&&o=0&&(t=t.replace("!",""),f=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),v=!0),(i||o||v)&&(l=!i&&!s?"":""+e,u=""+a),v&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),t){case"*=":n=l.indexOf(u)>=0;break;case"$=":n=l.indexOf(u,l.length-u.length)>=0;break;case"^=":n=l.indexOf(u)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e0;){var v=n.shift();e(v),i.add(v.id()),o&&a(n,i,v)}return r}function Vv(r,e,t){if(t.isParent())for(var a=t._private.children,n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return lo(this,r,e,Vv)};function qv(r,e,t){if(t.isChild()){var a=t._private.parent;e.has(a.id())||r.push(a)}}jt.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return lo(this,r,e,qv)};function _g(r,e,t){qv(r,e,t),Vv(r,e,t)}jt.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return lo(this,r,e,_g)};jt.ancestors=jt.parents;var Ba,_v;Ba=_v={data:Fe.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Fe.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Fe.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fe.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Fe.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Fe.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};Ba.attr=Ba.data;Ba.removeAttr=Ba.removeData;var Gg=_v,_n={};function ps(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var a=0,n=t[0],i=n._private.edges,s=0;se}),minIndegree:Nt("indegree",function(r,e){return re}),minOutdegree:Nt("outdegree",function(r,e){return re})});be(_n,{totalDegree:function(e){for(var t=0,a=this.nodes(),n=0;n0,c=f;f&&(v=v[0]);var h=c?v.position():{x:0,y:0};t!==void 0?u.position(e,t+h[e]):i!==void 0&&u.position({x:i.x+h.x,y:i.y+h.y})}else{var d=a.position(),y=o?a.parent():null,g=y&&y.length>0,p=g;g&&(y=y[0]);var m=p?y.position():{x:0,y:0};return i={x:d.x-m.x,y:d.y-m.y},e===void 0?i:i[e]}else if(!s)return;return this}};Or.modelPosition=Or.point=Or.position;Or.modelPositions=Or.points=Or.positions;Or.renderedPoint=Or.renderedPosition;Or.relativePoint=Or.relativePosition;var Hg=Gv,Zt,pt;Zt=pt={};pt.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),a=t.zoom(),n=t.pan(),i=e.x1*a+n.x,s=e.x2*a+n.x,o=e.y1*a+n.y,l=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:l,w:s-i,h:l-o}};pt.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(t){if(t.isParent()){var a=t._private;a.compoundBoundsClean=!1,a.bbCache=null,r||t.emitAndNotify("bounds")}}),this)};pt.updateCompoundBounds=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(s){if(!s.isParent())return;var o=s._private,l=s.children(),u=s.pstyle("compound-sizing-wrt-labels").value==="include",v={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},f=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),c=o.position;(f.w===0||f.h===0)&&(f={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},f.x1=c.x-f.w/2,f.x2=c.x+f.w/2,f.y1=c.y-f.h/2,f.y2=c.y+f.h/2);function h(k,D,B){var P=0,A=0,R=D+B;return k>0&&R>0&&(P=D/R*k,A=B/R*k),{biasDiff:P,biasComplementDiff:A}}function d(k,D,B,P){if(B.units==="%")switch(P){case"width":return k>0?B.pfValue*k:0;case"height":return D>0?B.pfValue*D:0;case"average":return k>0&&D>0?B.pfValue*(k+D)/2:0;case"min":return k>0&&D>0?k>D?B.pfValue*D:B.pfValue*k:0;case"max":return k>0&&D>0?k>D?B.pfValue*k:B.pfValue*D:0;default:return 0}else return B.units==="px"?B.pfValue:0}var y=v.width.left.value;v.width.left.units==="px"&&v.width.val>0&&(y=y*100/v.width.val);var g=v.width.right.value;v.width.right.units==="px"&&v.width.val>0&&(g=g*100/v.width.val);var p=v.height.top.value;v.height.top.units==="px"&&v.height.val>0&&(p=p*100/v.height.val);var m=v.height.bottom.value;v.height.bottom.units==="px"&&v.height.val>0&&(m=m*100/v.height.val);var b=h(v.width.val-f.w,y,g),w=b.biasDiff,E=b.biasComplementDiff,C=h(v.height.val-f.h,p,m),x=C.biasDiff,T=C.biasComplementDiff;o.autoPadding=d(f.w,f.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(f.w,v.width.val),c.x=(-w+f.x1+f.x2+E)/2,o.autoHeight=Math.max(f.h,v.height.val),c.y=(-x+f.y1+f.y2+T)/2}for(var a=0;ae.x2?n:e.x2,e.y1=ae.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},tt=function(e,t){return t==null?e:Ir(e,t.x1,t.y1,t.x2,t.y2)},fa=function(e,t,a){return Tr(e,t,a)},ja=function(e,t,a){if(!t.cy().headless()){var n=t._private,i=n.rstyle,s=i.arrowWidth/2,o=t.pstyle(a+"-arrow-shape").value,l,u;if(o!=="none"){a==="source"?(l=i.srcX,u=i.srcY):a==="target"?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var v=n.arrowBounds=n.arrowBounds||{},f=v[a]=v[a]||{};f.x1=l-s,f.y1=u-s,f.x2=l+s,f.y2=u+s,f.w=f.x2-f.x1,f.h=f.y2-f.y1,un(f,1),Ir(e,f.x1,f.y1,f.x2,f.y2)}}},ys=function(e,t,a){if(!t.cy().headless()){var n;a?n=a+"-":n="";var i=t._private,s=i.rstyle,o=t.pstyle(n+"label").strValue;if(o){var l=t.pstyle("text-halign"),u=t.pstyle("text-valign"),v=fa(s,"labelWidth",a),f=fa(s,"labelHeight",a),c=fa(s,"labelX",a),h=fa(s,"labelY",a),d=t.pstyle(n+"text-margin-x").pfValue,y=t.pstyle(n+"text-margin-y").pfValue,g=t.isEdge(),p=t.pstyle(n+"text-rotation"),m=t.pstyle("text-outline-width").pfValue,b=t.pstyle("text-border-width").pfValue,w=b/2,E=t.pstyle("text-background-padding").pfValue,C=2,x=f,T=v,k=T/2,D=x/2,B,P,A,R;if(g)B=c-k,P=c+k,A=h-D,R=h+D;else{switch(l.value){case"left":B=c-T,P=c;break;case"center":B=c-k,P=c+k;break;case"right":B=c,P=c+T;break}switch(u.value){case"top":A=h-x,R=h;break;case"center":A=h-D,R=h+D;break;case"bottom":A=h,R=h+x;break}}var L=d-Math.max(m,w)-E-C,I=d+Math.max(m,w)+E+C,M=y-Math.max(m,w)-E-C,O=y+Math.max(m,w)+E+C;B+=L,P+=I,A+=M,R+=O;var V=a||"main",G=i.labelBounds,N=G[V]=G[V]||{};N.x1=B,N.y1=A,N.x2=P,N.y2=R,N.w=P-B,N.h=R-A,N.leftPad=L,N.rightPad=I,N.topPad=M,N.botPad=O;var F=g&&p.strValue==="autorotate",U=p.pfValue!=null&&p.pfValue!==0;if(F||U){var Q=F?fa(i.rstyle,"labelAngle",a):p.pfValue,K=Math.cos(Q),j=Math.sin(Q),re=(B+P)/2,ne=(A+R)/2;if(!g){switch(l.value){case"left":re=P;break;case"right":re=B;break}switch(u.value){case"top":ne=R;break;case"bottom":ne=A;break}}var J=function(Ce,we){return Ce=Ce-re,we=we-ne,{x:Ce*K-we*j+re,y:Ce*j+we*K+ne}},z=J(B,A),q=J(B,R),H=J(P,A),Y=J(P,R);B=Math.min(z.x,q.x,H.x,Y.x),P=Math.max(z.x,q.x,H.x,Y.x),A=Math.min(z.y,q.y,H.y,Y.y),R=Math.max(z.y,q.y,H.y,Y.y)}var te=V+"Rot",ce=G[te]=G[te]||{};ce.x1=B,ce.y1=A,ce.x2=P,ce.y2=R,ce.w=P-B,ce.h=R-A,Ir(e,B,A,P,R),Ir(i.labelBounds.all,B,A,P,R)}return e}},ol=function(e,t){if(!t.cy().headless()){var a=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value,i=t.pstyle("outline-offset").value,s=n+i;Wv(e,t,a,s,"outside",s/2)}},Wv=function(e,t,a,n,i,s){if(!(a===0||n<=0||i==="inside")){var o=t.cy(),l=t.pstyle("shape").value,u=o.renderer().nodeShapes[l],v=t.position(),f=v.x,c=v.y,h=t.width(),d=t.height();if(u.hasMiterBounds){i==="center"&&(n/=2);var y=u.miterBounds(f,c,h,d,n);tt(e,y)}else s!=null&&s>0&&ln(e,[s,s,s,s])}},Wg=function(e,t){if(!t.cy().headless()){var a=t.pstyle("border-opacity").value,n=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value;Wv(e,t,a,n,i)}},$g=function(e,t){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=wr(),o=e._private,l=e.isNode(),u=e.isEdge(),v,f,c,h,d,y,g=o.rstyle,p=l&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function(Ae){return Ae.pstyle("display").value!=="none"},b=!n||m(e)&&(!u||m(e.source())&&m(e.target()));if(b){var w=0,E=0;n&&t.includeOverlays&&(w=e.pstyle("overlay-opacity").value,w!==0&&(E=e.pstyle("overlay-padding").value));var C=0,x=0;n&&t.includeUnderlays&&(C=e.pstyle("underlay-opacity").value,C!==0&&(x=e.pstyle("underlay-padding").value));var T=Math.max(E,x),k=0,D=0;if(n&&(k=e.pstyle("width").pfValue,D=k/2),l&&t.includeNodes){var B=e.position();d=B.x,y=B.y;var P=e.outerWidth(),A=P/2,R=e.outerHeight(),L=R/2;v=d-A,f=d+A,c=y-L,h=y+L,Ir(s,v,c,f,h),n&&ol(s,e),n&&t.includeOutlines&&!i&&ol(s,e),n&&Wg(s,e)}else if(u&&t.includeEdges)if(n&&!i){var I=e.pstyle("curve-style").strValue;if(v=Math.min(g.srcX,g.midX,g.tgtX),f=Math.max(g.srcX,g.midX,g.tgtX),c=Math.min(g.srcY,g.midY,g.tgtY),h=Math.max(g.srcY,g.midY,g.tgtY),v-=D,f+=D,c-=D,h+=D,Ir(s,v,c,f,h),I==="haystack"){var M=g.haystackPts;if(M&&M.length===2){if(v=M[0].x,c=M[0].y,f=M[1].x,h=M[1].y,v>f){var O=v;v=f,f=O}if(c>h){var V=c;c=h,h=V}Ir(s,v-D,c-D,f+D,h+D)}}else if(I==="bezier"||I==="unbundled-bezier"||at(I,"segments")||at(I,"taxi")){var G;switch(I){case"bezier":case"unbundled-bezier":G=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":G=g.linePts;break}if(G!=null)for(var N=0;Nf){var re=v;v=f,f=re}if(c>h){var ne=c;c=h,h=ne}v-=D,f+=D,c-=D,h+=D,Ir(s,v,c,f,h)}if(n&&t.includeEdges&&u&&(ja(s,e,"mid-source"),ja(s,e,"mid-target"),ja(s,e,"source"),ja(s,e,"target")),n){var J=e.pstyle("ghost").value==="yes";if(J){var z=e.pstyle("ghost-offset-x").pfValue,q=e.pstyle("ghost-offset-y").pfValue;Ir(s,s.x1+z,s.y1+q,s.x2+z,s.y2+q)}}var H=o.bodyBounds=o.bodyBounds||{};Uo(H,s),ln(H,p),un(H,1),n&&(v=s.x1,f=s.x2,c=s.y1,h=s.y2,Ir(s,v-T,c-T,f+T,h+T));var Y=o.overlayBounds=o.overlayBounds||{};Uo(Y,s),ln(Y,p),un(Y,1);var te=o.labelBounds=o.labelBounds||{};te.all!=null?kd(te.all):te.all=wr(),n&&t.includeLabels&&(t.includeMainLabels&&ys(s,e,null),u&&(t.includeSourceLabels&&ys(s,e,"source"),t.includeTargetLabels&&ys(s,e,"target")))}return s.x1=Ar(s.x1),s.y1=Ar(s.y1),s.x2=Ar(s.x2),s.y2=Ar(s.y2),s.w=Ar(s.x2-s.x1),s.h=Ar(s.y2-s.y1),s.w>0&&s.h>0&&b&&(ln(s,p),un(s,1)),s},$v=function(e){var t=0,a=function(s){return(s?1:0)<0&&arguments[0]!==void 0?arguments[0]:sp,e=arguments.length>1?arguments[1]:void 0,t=0;t=0;o--)s(o);return this};dt.removeAllListeners=function(){return this.removeListener("*")};dt.emit=dt.trigger=function(r,e,t){var a=this.listeners,n=a.length;return this.emitting++,_e(e)||(e=[e]),op(this,function(i,s){t!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:t}],n=a.length);for(var o=function(){var v=a[l];if(v.type===s.type&&(!v.namespace||v.namespace===s.namespace||v.namespace===ip)&&i.eventMatches(i.context,v,s)){var f=[s];e!=null&&Qc(f,e),i.beforeEmit(i.context,v,s),v.conf&&v.conf.one&&(i.listeners=i.listeners.filter(function(d){return d!==v}));var c=i.callbackContext(i.context,v,s),h=v.callback.apply(c,f);i.afterEmit(i.context,v,s),h===!1&&(s.stopPropagation(),s.preventDefault())}},l=0;l1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,a=e._private.data.id,n=t.map,i=n.get(a);if(!i)return this;var s=i.index;return this.unmergeAt(s),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&ge(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=0;n=0;t--){var a=this[t];e(a)&&this.unmergeAt(t)}return this},map:function(e,t){for(var a=[],n=this,i=0;ia&&(a=l,n=o)}return{value:a,ele:n}},min:function(e,t){for(var a=1/0,n,i=this,s=0;s=0&&i"u"?"undefined":ar(Symbol))!=e&&ar(Symbol.iterator)!=e;t&&(Sn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,s=this.length;return Jl({next:function(){return i1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,n.style().apply(a));var i=a._private.style[e];return i??(t?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var a=t.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=this[0];if(a)return t.style().getRenderedStyle(a,e)},style:function(e,t){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Le(e)){var s=e;i.applyBypass(this,s,n),this.emitAndNotify("style")}else if(ge(e))if(t===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,t,n),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?i.getRawStyle(l):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=!1,n=t.style(),i=this;if(e===void 0)for(var s=0;s0&&e.push(v[0]),e.push(o[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});gr.neighbourhood=gr.neighborhood;gr.closedNeighbourhood=gr.closedNeighborhood;gr.openNeighbourhood=gr.openNeighborhood;be(gr,{source:Rr(function(e){var t=this[0],a;return t&&(a=t._private.source||t.cy().collection()),a&&e?a.filter(e):a},"source"),target:Rr(function(e){var t=this[0],a;return t&&(a=t._private.target||t.cy().collection()),a&&e?a.filter(e):a},"target"),sources:ml({attr:"source"}),targets:ml({attr:"target"})});function ml(r){return function(t){for(var a=[],n=0;n0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});gr.componentsOf=gr.components;var fr=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){$e("A collection must have a reference to the core");return}var i=new Xr,s=!1;if(!t)t=[];else if(t.length>0&&Le(t[0])&&!Ia(t[0])){s=!0;for(var o=[],l=new ra,u=0,v=t.length;u0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=t.cy(),n=a._private,i=[],s=[],o,l=0,u=t.length;l0){for(var V=o.length===t.length?t:new fr(a,o),G=0;G0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=[],n={},i=t._private.cy;function s(R){for(var L=R._private.edges,I=0;I0&&(r?B.emitAndNotify("remove"):e&&B.emit("remove"));for(var P=0;P0?P=R:B=R;while(Math.abs(A)>s&&++L=i?m(D,L):I===0?L:w(D,B,B+u)}var C=!1;function x(){C=!0,(r!==e||t!==a)&&b()}var T=function(B){return C||x(),r===e&&t===a?B:B===0?0:B===1?1:g(E(B),e,a)};T.getControlPoints=function(){return[{x:r,y:e},{x:t,y:a}]};var k="generateBezier("+[r,e,t,a]+")";return T.toString=function(){return k},T}var mp=(function(){function r(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var s={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:s.v,dv:r(s)}}function t(a,n){var i={dx:a.v,dv:r(a)},s=e(a,n*.5,i),o=e(a,n*.5,s),l=e(a,n,o),u=1/6*(i.dx+2*(s.dx+o.dx)+l.dx),v=1/6*(i.dv+2*(s.dv+o.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+v*n,a}return function a(n,i,s){var o={x:-1,v:0,tension:null,friction:null},l=[0],u=0,v=1/1e4,f=16/1e3,c,h,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,c=s!==null,c?(u=a(n,i),h=u/s*f):h=f;d=t(d||o,h),l.push(1+d.x),u+=16,Math.abs(d.x)>v&&Math.abs(d.v)>v;);return c?function(y){return l[y*(l.length-1)|0]}:u}})(),Ge=function(e,t,a,n){var i=yp(e,t,a,n);return function(s,o,l){return s+(o-s)*i(l)}},cn={linear:function(e,t,a){return e+(t-e)*a},ease:Ge(.25,.1,.25,1),"ease-in":Ge(.42,0,1,1),"ease-out":Ge(0,0,.58,1),"ease-in-out":Ge(.42,0,.58,1),"ease-in-sine":Ge(.47,0,.745,.715),"ease-out-sine":Ge(.39,.575,.565,1),"ease-in-out-sine":Ge(.445,.05,.55,.95),"ease-in-quad":Ge(.55,.085,.68,.53),"ease-out-quad":Ge(.25,.46,.45,.94),"ease-in-out-quad":Ge(.455,.03,.515,.955),"ease-in-cubic":Ge(.55,.055,.675,.19),"ease-out-cubic":Ge(.215,.61,.355,1),"ease-in-out-cubic":Ge(.645,.045,.355,1),"ease-in-quart":Ge(.895,.03,.685,.22),"ease-out-quart":Ge(.165,.84,.44,1),"ease-in-out-quart":Ge(.77,0,.175,1),"ease-in-quint":Ge(.755,.05,.855,.06),"ease-out-quint":Ge(.23,1,.32,1),"ease-in-out-quint":Ge(.86,0,.07,1),"ease-in-expo":Ge(.95,.05,.795,.035),"ease-out-expo":Ge(.19,1,.22,1),"ease-in-out-expo":Ge(1,0,0,1),"ease-in-circ":Ge(.6,.04,.98,.335),"ease-out-circ":Ge(.075,.82,.165,1),"ease-in-out-circ":Ge(.785,.135,.15,.86),spring:function(e,t,a){if(a===0)return cn.linear;var n=mp(e,t,a);return function(i,s,o){return i+(s-i)*n(o)}},"cubic-bezier":Ge};function xl(r,e,t,a,n){if(a===1||e===t)return t;var i=n(e,t,a);return r==null||((r.roundValue||r.color)&&(i=Math.round(i)),r.min!==void 0&&(i=Math.max(i,r.min)),r.max!==void 0&&(i=Math.min(i,r.max))),i}function El(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}function zt(r,e,t,a,n){var i=n!=null?n.type:null;t<0?t=0:t>1&&(t=1);var s=El(r,n),o=El(e,n);if(ae(s)&&ae(o))return xl(i,s,o,t,a);if(_e(s)&&_e(o)){for(var l=[],u=0;u0?(h==="spring"&&d.push(s.duration),s.easingImpl=cn[h].apply(null,d)):s.easingImpl=cn[h]}var y=s.easingImpl,g;if(s.duration===0?g=1:g=(t-l)/s.duration,s.applying&&(g=s.progress),g<0?g=0:g>1&&(g=1),s.delay==null){var p=s.startPosition,m=s.position;if(m&&n&&!r.locked()){var b={};da(p.x,m.x)&&(b.x=zt(p.x,m.x,g,y)),da(p.y,m.y)&&(b.y=zt(p.y,m.y,g,y)),r.position(b)}var w=s.startPan,E=s.pan,C=i.pan,x=E!=null&&a;x&&(da(w.x,E.x)&&(C.x=zt(w.x,E.x,g,y)),da(w.y,E.y)&&(C.y=zt(w.y,E.y,g,y)),r.emit("pan"));var T=s.startZoom,k=s.zoom,D=k!=null&&a;D&&(da(T,k)&&(i.zoom=ka(i.minZoom,zt(T,k,g,y),i.maxZoom)),r.emit("zoom")),(x||D)&&r.emit("viewport");var B=s.style;if(B&&B.length>0&&n){for(var P=0;P=0;x--){var T=C[x];T()}C.splice(0,C.length)},m=h.length-1;m>=0;m--){var b=h[m],w=b._private;if(w.stopped){h.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,p(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||wp(v,b,r),bp(v,b,r,f),w.applying&&(w.applying=!1),p(w.frames),w.step!=null&&w.step(r),b.completed()&&(h.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,p(w.completes)),y=!0)}return!f&&h.length===0&&d.length===0&&a.push(v),y}for(var i=!1,s=0;s0?e.notify("draw",t):e.notify("draw")),t.unmerge(a),e.emit("step")}var xp={animate:Fe.animate(),animation:Fe.animation(),animated:Fe.animated(),clearQueue:Fe.clearQueue(),delay:Fe.delay(),delayAnimation:Fe.delayAnimation(),stop:Fe.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&wn(function(i){Cl(i,e),t()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,s){Cl(s,e)},a.beforeRenderPriorities.animations):t()}},Ep={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&Ia(a.target)&&n.matches(a.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,a){return t.qualifier!=null?a.target:e}},tn=function(e){return ge(e)?new ft(e):e},tf={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Gn(Ep,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,a){return this.emitter().on(e,tn(t),a),this},removeListener:function(e,t,a){return this.emitter().removeListener(e,tn(t),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,a){return this.emitter().one(e,tn(t),a),this},once:function(e,t,a){return this.emitter().one(e,tn(t),a),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Fe.eventAliasesOn(tf);var zs={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};zs.jpeg=zs.jpg;var dn={layout:function(e){var t=this;if(e==null){$e("Layout options must be specified to make a layout");return}if(e.name==null){$e("A `name` must be specified to make a layout");return}var a=e.name,n=t.extension("layout",a);if(n==null){$e("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;ge(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var s=new n(be({},e,{cy:t,eles:i}));return s}};dn.createLayout=dn.makeLayout=dn.layout;var Cp={notify:function(e,t){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();t!=null&&n.merge(t);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?t.notify(a):t.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Fs.invalidateDimensions=Fs.resize;var hn={collection:function(e,t){return ge(e)?this.$(e):Dr(e)?e.collection():_e(e)?(t||(t={}),new fr(this,e,t.unique,t.removed)):new fr(this)},nodes:function(e){var t=this.$(function(a){return a.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(a){return a.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};hn.elements=hn.filter=hn.$;var ur={},wa="t",Sp="f";ur.apply=function(r){for(var e=this,t=e._private,a=t.cy,n=a.collection(),i=0;i0;if(c||f&&h){var d=void 0;c&&h||c?d=u.properties:h&&(d=u.mappedProperties);for(var y=0;y1&&(w=1),o.color){var C=a.valueMin[0],x=a.valueMax[0],T=a.valueMin[1],k=a.valueMax[1],D=a.valueMin[2],B=a.valueMax[2],P=a.valueMin[3]==null?1:a.valueMin[3],A=a.valueMax[3]==null?1:a.valueMax[3],R=[Math.round(C+(x-C)*w),Math.round(T+(k-T)*w),Math.round(D+(B-D)*w),Math.round(P+(A-P)*w)];i={bypass:a.bypass,name:a.name,value:R,strValue:"rgb("+R[0]+", "+R[1]+", "+R[2]+")"}}else if(o.number){var L=a.valueMin+(a.valueMax-a.valueMin)*w;i=this.parse(a.name,L,a.bypass,c)}else return!1;if(!i)return y(),!1;i.mapping=a,a=i;break}case s.data:{for(var I=a.field.split("."),M=f.data,O=0;O0&&i>0){for(var o={},l=!1,u=0;u0?r.delayAnimation(s).play().promise().then(b):b()}).then(function(){return r.animation({style:o,duration:i,easing:r.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){t.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1)};ur.checkTrigger=function(r,e,t,a,n,i){var s=this.properties[e],o=n(s);r.removed()||o!=null&&o(t,a,r)&&i(s)};ur.checkZOrderTrigger=function(r,e,t,a){var n=this;this.checkTrigger(r,e,t,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",r)})};ur.checkBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBounds},function(n){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache()})};ur.checkConnectedEdgesBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBoundsOfConnectedEdges},function(n){r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ur.checkParallelEdgesBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBoundsOfParallelEdges},function(n){r.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ur.checkTriggers=function(r,e,t,a){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,a),this.checkBoundsTrigger(r,e,t,a),this.checkConnectedEdgesBoundsTrigger(r,e,t,a),this.checkParallelEdgesBoundsTrigger(r,e,t,a)};var _a={};_a.applyBypass=function(r,e,t,a){var n=this,i=[],s=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var o=0;on.length?a=a.substr(n.length):a=""}function l(){i.length>s.length?i=i.substr(s.length):i=""}for(;;){var u=a.match(/^\s*$/);if(u)break;var v=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!v){Ve("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=v[0];var f=v[1];if(f!=="core"){var c=new ft(f);if(c.invalid){Ve("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),o();continue}}var h=v[2],d=!1;i=h;for(var y=[];;){var g=i.match(/^\s*$/);if(g)break;var p=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){Ve("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}s=p[0];var m=p[1],b=p[2],w=e.properties[m];if(!w){Ve("Skipping property: Invalid property name in: "+s),l();continue}var E=t.parse(m,b);if(!E){Ve("Skipping property: Invalid property definition in: "+s),l();continue}y.push({name:m,val:b}),l()}if(d){o();break}t.selector(f);for(var C=0;C=7&&e[0]==="d"&&(v=new RegExp(o.data.regex).exec(e))){if(t)return!1;var c=o.data;return{name:r,value:v,strValue:""+e,mapped:c,field:v[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(o.mapData.regex).exec(e))){if(t||u.multiple)return!1;var h=o.mapData;if(!(u.color||u.number))return!1;var d=this.parse(r,f[4]);if(!d||d.mapped)return!1;var y=this.parse(r,f[5]);if(!y||y.mapped)return!1;if(d.pfValue===y.pfValue||d.strValue===y.strValue)return Ve("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+d.strValue+"`"),this.parse(r,d.strValue);if(u.color){var g=d.value,p=y.value,m=g[0]===p[0]&&g[1]===p[1]&&g[2]===p[2]&&(g[3]===p[3]||(g[3]==null||g[3]===1)&&(p[3]==null||p[3]===1));if(m)return!1}return{name:r,value:f,strValue:""+e,mapped:h,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:d.value,valueMax:y.value,bypass:t}}}if(u.multiple&&a!=="multiple"){var b;if(l?b=e.split(/\s+/):_e(e)?b=e:b=[e],u.evenMultiple&&b.length%2!==0)return null;for(var w=[],E=[],C=[],x="",T=!1,k=0;k0?" ":"")+D.strValue}return u.validate&&!u.validate(w,E)?null:u.singleEnum&&T?w.length===1&&ge(w[0])?{name:r,value:w[0],strValue:w[0],bypass:t}:null:{name:r,value:w,pfValue:C,strValue:x,bypass:t,units:E}}var B=function(){for(var J=0;Ju.max||u.strictMax&&e===u.max))return null;var I={name:r,value:e,strValue:""+e+(P||""),units:P,bypass:t};return u.unitless||P!=="px"&&P!=="em"?I.pfValue=e:I.pfValue=P==="px"||!P?e:this.getEmSizeInPixels()*e,(P==="ms"||P==="s")&&(I.pfValue=P==="ms"?e:1e3*e),(P==="deg"||P==="rad")&&(I.pfValue=P==="rad"?e:Ed(e)),P==="%"&&(I.pfValue=e/100),I}else if(u.propList){var M=[],O=""+e;if(O!=="none"){for(var V=O.split(/\s*,\s*|\s+/),G=0;G0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){l=Math.min((s-2*t)/a.w,(o-2*t)/a.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l=a.minZoom&&(a.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,a=t.pan,n=t.zoom,i,s,o=!1;if(t.zoomingEnabled||(o=!0),ae(e)?s=e:Le(e)&&(s=e.level,e.position!=null?i=On(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(o=!0)),s=s>t.maxZoom?t.maxZoom:s,s=st.maxZoom||!t.zoomingEnabled?s=!0:(t.zoom=l,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;ae(u.x)&&(t.pan.x=u.x,o=!1),ae(u.y)&&(t.pan.y=u.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(ge(e)){var a=e;e=this.mutableElements().filter(a)}else Dr(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),s=this.height();t=t===void 0?this._private.zoom:t;var o={x:(i-t*(n.x1+n.x2))/2,y:(s-t*(n.y1+n.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,a=this;return e.sizeCache=e.sizeCache||(t?(function(){var n=a.window().getComputedStyle(t),i=function(o){return parseFloat(n.getPropertyValue(o))};return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/t,x2:(a.x2-e.x)/t,y1:(a.y1-e.y)/t,y2:(a.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};At.centre=At.center;At.autolockNodes=At.autolock;At.autoungrabifyNodes=At.autoungrabify;var Aa={data:Fe.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Fe.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Fe.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fe.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Aa.attr=Aa.data;Aa.removeAttr=Aa.removeData;var Ra=function(e){var t=this;e=be({},e);var a=e.container;a&&!bn(a)&&bn(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=t;var s=rr!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=be({name:s?"grid":"null"},o.layout),o.renderer=be({name:s?"canvas":"null"},o.renderer);var l=function(d,y,g){return y!==void 0?y:g!==void 0?g:d},u=this._private={container:a,ready:!1,options:o,elements:new fr(this),listeners:[],aniEles:new fr(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:ae(o.zoom)?o.zoom:1,pan:{x:Le(o.pan)&&ae(o.pan.x)?o.pan.x:0,y:Le(o.pan)&&ae(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var v=function(d,y){var g=d.some(pc);if(g)return ta.all(d).then(y);y(d)};u.styleEnabled&&t.setStyle([]);var f=be({},o,o.renderer);t.initRenderer(f);var c=function(d,y,g){t.notifications(!1);var p=t.mutableElements();p.length>0&&p.remove(),d!=null&&(Le(d)||_e(d))&&t.add(d),t.one("layoutready",function(b){t.notifications(!0),t.emit(b),t.one("load",y),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",g),t.emit("done")});var m=be({},t._private.options.layout);m.eles=t.elements(),t.layout(m).run()};v([o.style,o.elements],function(h){var d=h[0],y=h[1];u.styleEnabled&&t.style().append(d),c(y,function(){t.startAnimationLoop(),u.ready=!0,Ue(o.ready)&&t.on("ready",o.ready);for(var g=0;g0,o=!!r.boundingBox,l=wr(o?r.boundingBox:structuredClone(e.extent())),u;if(Dr(r.roots))u=r.roots;else if(_e(r.roots)){for(var v=[],f=0;f0;){var R=A(),L=k(R,B);if(L)R.outgoers().filter(function(ye){return ye.isNode()&&t.has(ye)}).forEach(P);else if(L===null){Ve("Detected double maximal shift for node `"+R.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var I=0;if(r.avoidOverlap)for(var M=0;M0&&p[0].length<=3?pe/2:0),Re=2*Math.PI/p[he].length*Ee;return he===0&&p[0].length===1&&(Se=1),{x:H.x+Se*Math.cos(Re),y:H.y+Se*Math.sin(Re)}}else{var Oe=p[he].length,Ne=Math.max(Oe===1?0:o?(l.w-r.padding*2-Y.w)/((r.grid?ce:Oe)-1):(l.w-r.padding*2-Y.w)/((r.grid?ce:Oe)+1),I),ze={x:H.x+(Ee+1-(Oe+1)/2)*Ne,y:H.y+(he+1-(K+1)/2)*te};return ze}},Ce={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(Ce).indexOf(r.direction)===-1&&$e("Invalid direction '".concat(r.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Ce).join(", ")));var we=function(ie){return $c(Ae(ie),l,Ce[r.direction])};return t.nodes().layoutPositions(this,r,we),this};var Ap={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function nf(r){this.options=be({},Ap,r)}nf.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var s=wr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,u=l/Math.max(1,i.length-1),v,f=0,c=0;c1&&e.avoidOverlap){f*=1.75;var p=Math.cos(u)-Math.cos(0),m=Math.sin(u)-Math.sin(0),b=Math.sqrt(f*f/(p*p+m*m));v=Math.max(b,v)}var w=function(C,x){var T=e.startAngle+x*u*(n?1:-1),k=v*Math.cos(T),D=v*Math.sin(T),B={x:o.x+k,y:o.y+D};return B};return a.nodes().layoutPositions(this,e,w),this};var Rp={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function sf(r){this.options=be({},Rp,r)}sf.prototype.run=function(){for(var r=this.options,e=r,t=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=r.cy,n=e.eles,i=n.nodes().not(":parent"),s=wr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,v=0;v0){var E=Math.abs(m[0].value-w.value);E>=g&&(m=[],p.push(m))}m.push(w)}var C=u+e.minNodeSpacing;if(!e.avoidOverlap){var x=p.length>0&&p[0].length>1,T=Math.min(s.w,s.h)/2-C,k=T/(p.length+x?1:0);C=Math.min(C,k)}for(var D=0,B=0;B1&&e.avoidOverlap){var L=Math.cos(R)-Math.cos(0),I=Math.sin(R)-Math.sin(0),M=Math.sqrt(C*C/(L*L+I*I));D=Math.max(M,D)}P.r=D,D+=C}if(e.equidistant){for(var O=0,V=0,G=0;G=r.numIter||(Fp(a,r),a.temperature=a.temperature*r.coolingFactor,a.temperature=r.animationThreshold&&i(),wn(v)}};v()}else{for(;u;)u=s(l),l++;kl(a,r),o()}return this};Kn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Kn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Lp=function(e,t,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s=wr(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},l=a.eles.components(),u={},v=0;v0){o.graphSet.push(T);for(var v=0;vn.count?0:n.graph},of=function(e,t,a,n){var i=n.graphSet[a];if(-10)var f=n.nodeOverlap*v,c=Math.sqrt(o*o+l*l),h=f*o/c,d=f*l/c;else var y=Dn(e,o,l),g=Dn(t,-1*o,-1*l),p=g.x-y.x,m=g.y-y.y,b=p*p+m*m,c=Math.sqrt(b),f=(e.nodeRepulsion+t.nodeRepulsion)/b,h=f*p/c,d=f*m/c;e.isLocked||(e.offsetX-=h,e.offsetY-=d),t.isLocked||(t.offsetX+=h,t.offsetY+=d)}},_p=function(e,t,a,n){if(a>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(n>0)var s=e.maxY-t.minY;else var s=t.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},Dn=function(e,t,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,l=a/t,u=s/o,v={};return t===0&&0a?(v.x=n,v.y=i+s/2,v):0t&&-1*u<=l&&l<=u?(v.x=n-o/2,v.y=i-o*a/2/t,v):0=u)?(v.x=n+s*t/2/a,v.y=i+s/2,v):(0>a&&(l<=-1*u||l>=u)&&(v.x=n-s*t/2/a,v.y=i-s/2),v)},Gp=function(e,t){for(var a=0;aa){var g=t.gravity*h/y,p=t.gravity*d/y;c.offsetX+=g,c.offsetY+=p}}}}},Wp=function(e,t){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var s=a[n++],o=e.idToIndex[s],l=e.layoutNodes[o],u=l.children;if(0a)var i={x:a*e/n,y:a*t/n};else var i={x:e,y:t};return i},lf=function(e,t){var a=e.parentId;if(a!=null){var n=t.layoutNodes[t.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeftn.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTopp&&(d+=g+t.componentSpacing,h=0,y=0,g=0)}}},Kp={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function vf(r){this.options=be({},Kp,r)}vf.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=wr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(U){return{x:i.x1,y:i.y1}});else{var s=n.size(),o=Math.sqrt(s*i.h/i.w),l=Math.round(o),u=Math.round(i.w/i.h*o),v=function(Q){if(Q==null)return Math.min(l,u);var K=Math.min(l,u);K==l?l=Q:u=Q},f=function(Q){if(Q==null)return Math.max(l,u);var K=Math.max(l,u);K==l?l=Q:u=Q},c=e.rows,h=e.cols!=null?e.cols:e.columns;if(c!=null&&h!=null)l=c,u=h;else if(c!=null&&h==null)l=c,u=Math.ceil(s/l);else if(c==null&&h!=null)u=h,l=Math.ceil(s/u);else if(u*l>s){var d=v(),y=f();(d-1)*y>=s?v(d-1):(y-1)*d>=s&&f(y-1)}else for(;u*l=s?f(p+1):v(g+1)}var m=i.w/u,b=i.h/l;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var w=0;w=u&&(L=0,R++)},M={},O=0;O(L=Nd(r,e,I[M],I[M+1],I[M+2],I[M+3])))return g(x,L),!0}else if(k.edgeType==="bezier"||k.edgeType==="multibezier"||k.edgeType==="self"||k.edgeType==="compound"){for(var I=k.allpts,M=0;M+5(L=Od(r,e,I[M],I[M+1],I[M+2],I[M+3],I[M+4],I[M+5])))return g(x,L),!0}for(var O=O||T.source,V=V||T.target,G=n.getArrowWidth(D,B),N=[{name:"source",x:k.arrowStartX,y:k.arrowStartY,angle:k.srcArrowAngle},{name:"target",x:k.arrowEndX,y:k.arrowEndY,angle:k.tgtArrowAngle},{name:"mid-source",x:k.midX,y:k.midY,angle:k.midsrcArrowAngle},{name:"mid-target",x:k.midX,y:k.midY,angle:k.midtgtArrowAngle}],M=0;M0&&(p(O),p(V))}function b(x,T,k){return Tr(x,T,k)}function w(x,T){var k=x._private,D=c,B;T?B=T+"-":B="",x.boundingBox();var P=k.labelBounds[T||"main"],A=x.pstyle(B+"label").value,R=x.pstyle("text-events").strValue==="yes";if(!(!R||!A)){var L=b(k.rscratch,"labelX",T),I=b(k.rscratch,"labelY",T),M=b(k.rscratch,"labelAngle",T),O=x.pstyle(B+"text-margin-x").pfValue,V=x.pstyle(B+"text-margin-y").pfValue,G=P.x1-D-O,N=P.x2+D-O,F=P.y1-D-V,U=P.y2+D-V;if(M){var Q=Math.cos(M),K=Math.sin(M),j=function(Y,te){return Y=Y-L,te=te-I,{x:Y*Q-te*K+L,y:Y*K+te*Q+I}},re=j(G,F),ne=j(G,U),J=j(N,F),z=j(N,U),q=[re.x+O,re.y+V,J.x+O,J.y+V,z.x+O,z.y+V,ne.x+O,ne.y+V];if(Sr(r,e,q))return g(x),!0}else if(nt(P,r,e))return g(x),!0}}for(var E=s.length-1;E>=0;E--){var C=s[E];C.isNode()?p(C)||w(C):m(C)||w(C)||w(C,"source")||w(C,"target")}return o};Mt.getAllInBox=function(r,e,t,a){var n=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),s=2/i,o=[],l=Math.min(r,t),u=Math.max(r,t),v=Math.min(e,a),f=Math.max(e,a);r=l,t=u,e=v,a=f;var c=wr({x1:r,y1:e,x2:t,y2:a}),h=[{x:c.x1,y:c.y1},{x:c.x2,y:c.y1},{x:c.x2,y:c.y2},{x:c.x1,y:c.y2}],d=[[h[0],h[1]],[h[1],h[2]],[h[2],h[3]],[h[3],h[0]]];function y(Y,te,ce){return Tr(Y,te,ce)}function g(Y,te){var ce=Y._private,Ae=s,Ce="";Y.boundingBox();var we=ce.labelBounds.main;if(!we)return null;var ye=y(ce.rscratch,"labelX",te),ie=y(ce.rscratch,"labelY",te),de=y(ce.rscratch,"labelAngle",te),he=Y.pstyle(Ce+"text-margin-x").pfValue,Ee=Y.pstyle(Ce+"text-margin-y").pfValue,pe=we.x1-Ae-he,Se=we.x2+Ae-he,Re=we.y1-Ae-Ee,Oe=we.y2+Ae-Ee;if(de){var Ne=Math.cos(de),ze=Math.sin(de),xe=function(X,S){return X=X-ye,S=S-ie,{x:X*Ne-S*ze+ye,y:X*ze+S*Ne+ie}};return[xe(pe,Re),xe(Se,Re),xe(Se,Oe),xe(pe,Oe)]}else return[{x:pe,y:Re},{x:Se,y:Re},{x:Se,y:Oe},{x:pe,y:Oe}]}function p(Y,te,ce,Ae){function Ce(we,ye,ie){return(ie.y-we.y)*(ye.x-we.x)>(ye.y-we.y)*(ie.x-we.x)}return Ce(Y,ce,Ae)!==Ce(te,ce,Ae)&&Ce(Y,te,ce)!==Ce(Y,te,Ae)}for(var m=0;m0?-(Math.PI-e.ang):Math.PI+e.ang},jp=function(e,t,a,n,i){if(e!==Rl?Ml(t,e,Vr):Jp(Pr,Vr),Ml(t,a,Pr),Pl=Vr.nx*Pr.ny-Vr.ny*Pr.nx,Al=Vr.nx*Pr.nx-Vr.ny*-Pr.ny,Ur=Math.asin(Math.max(-1,Math.min(1,Pl))),Math.abs(Ur)<1e-6){Vs=t.x,qs=t.y,Ct=Vt=0;return}St=1,gn=!1,Al<0?Ur<0?Ur=Math.PI+Ur:(Ur=Math.PI-Ur,St=-1,gn=!0):Ur>0&&(St=-1,gn=!0),t.radius!==void 0?Vt=t.radius:Vt=n,wt=Ur/2,an=Math.min(Vr.len/2,Pr.len/2),i?(zr=Math.abs(Math.cos(wt)*Vt/Math.sin(wt)),zr>an?(zr=an,Ct=Math.abs(zr*Math.sin(wt)/Math.cos(wt))):Ct=Vt):(zr=Math.min(an,Vt),Ct=Math.abs(zr*Math.sin(wt)/Math.cos(wt))),_s=t.x+Pr.nx*zr,Gs=t.y+Pr.ny*zr,Vs=_s-Pr.ny*Ct*St,qs=Gs+Pr.nx*Ct*St,hf=t.x+Vr.nx*zr,gf=t.y+Vr.ny*zr,Rl=t};function pf(r,e){e.radius===0?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function po(r,e,t,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(jp(r,e,t,a,n),{cx:Vs,cy:qs,radius:Ct,startX:hf,startY:gf,stopX:_s,stopY:Gs,startAngle:Vr.ang+Math.PI/2*St,endAngle:Pr.ang-Math.PI/2*St,counterClockwise:gn})}var Ma=.01,ey=Math.sqrt(2*Ma),yr={};yr.findMidptPtsEtc=function(r,e){var t=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,s=r.pstyle("source-endpoint"),o=r.pstyle("target-endpoint"),l=s.units!=null&&o.units!=null,u=function(E,C,x,T){var k=T-C,D=x-E,B=Math.sqrt(D*D+k*k);return{x:-k/B,y:D/B}},v=r.pstyle("edge-distances").value;switch(v){case"node-position":i=t;break;case"intersection":i=a;break;case"endpoints":{if(l){var f=this.manualEndptToPx(r.source()[0],s),c=Je(f,2),h=c[0],d=c[1],y=this.manualEndptToPx(r.target()[0],o),g=Je(y,2),p=g[0],m=g[1],b={x1:h,y1:d,x2:p,y2:m};n=u(h,d,p,m),i=b}else Ve("Edge ".concat(r.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};yr.findHaystackPoints=function(r){for(var e=0;e0?Math.max(S-_,0):Math.min(S+_,0)},A=P(D,T),R=P(B,k),L=!1;m===u?p=Math.abs(A)>Math.abs(R)?n:a:m===l||m===o?(p=a,L=!0):(m===i||m===s)&&(p=n,L=!0);var I=p===a,M=I?R:A,O=I?B:D,V=to(O),G=!1;!(L&&(w||C))&&(m===o&&O<0||m===l&&O>0||m===i&&O>0||m===s&&O<0)&&(V*=-1,M=V*Math.abs(M),G=!0);var N;if(w){var F=E<0?1+E:E;N=F*M}else{var U=E<0?M:0;N=U+E*V}var Q=function(S){return Math.abs(S)=Math.abs(M)},K=Q(N),j=Q(Math.abs(M)-Math.abs(N)),re=K||j;if(re&&!G)if(I){var ne=Math.abs(O)<=c/2,J=Math.abs(D)<=h/2;if(ne){var z=(v.x1+v.x2)/2,q=v.y1,H=v.y2;t.segpts=[z,q,z,H]}else if(J){var Y=(v.y1+v.y2)/2,te=v.x1,ce=v.x2;t.segpts=[te,Y,ce,Y]}else t.segpts=[v.x1,v.y2]}else{var Ae=Math.abs(O)<=f/2,Ce=Math.abs(B)<=d/2;if(Ae){var we=(v.y1+v.y2)/2,ye=v.x1,ie=v.x2;t.segpts=[ye,we,ie,we]}else if(Ce){var de=(v.x1+v.x2)/2,he=v.y1,Ee=v.y2;t.segpts=[de,he,de,Ee]}else t.segpts=[v.x2,v.y1]}else if(I){var pe=v.y1+N+(g?c/2*V:0),Se=v.x1,Re=v.x2;t.segpts=[Se,pe,Re,pe]}else{var Oe=v.x1+N+(g?f/2*V:0),Ne=v.y1,ze=v.y2;t.segpts=[Oe,Ne,Oe,ze]}if(t.isRound){var xe=r.pstyle("taxi-radius").value,ue=r.pstyle("radius-type").value[0]==="arc-radius";t.radii=new Array(t.segpts.length/2).fill(xe),t.isArcRadius=new Array(t.segpts.length/2).fill(ue)}};yr.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if(t.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,l=e.tgtH,u=e.srcShape,v=e.tgtShape,f=e.srcCornerRadius,c=e.tgtCornerRadius,h=e.srcRs,d=e.tgtRs,y=!ae(t.startX)||!ae(t.startY),g=!ae(t.arrowStartX)||!ae(t.arrowStartY),p=!ae(t.endX)||!ae(t.endY),m=!ae(t.arrowEndX)||!ae(t.arrowEndY),b=3,w=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,E=b*w,C=Bt({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),x=CO.poolIndex()){var V=M;M=O,O=V}var G=A.srcPos=M.position(),N=A.tgtPos=O.position(),F=A.srcW=M.outerWidth(),U=A.srcH=M.outerHeight(),Q=A.tgtW=O.outerWidth(),K=A.tgtH=O.outerHeight(),j=A.srcShape=t.nodeShapes[e.getNodeShape(M)],re=A.tgtShape=t.nodeShapes[e.getNodeShape(O)],ne=A.srcCornerRadius=M.pstyle("corner-radius").value==="auto"?"auto":M.pstyle("corner-radius").pfValue,J=A.tgtCornerRadius=O.pstyle("corner-radius").value==="auto"?"auto":O.pstyle("corner-radius").pfValue,z=A.tgtRs=O._private.rscratch,q=A.srcRs=M._private.rscratch;A.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var H=0;H=ey||(Re=Math.sqrt(Math.max(Se*Se,Ma)+Math.max(pe*pe,Ma)));var Oe=A.vector={x:Se,y:pe},Ne=A.vectorNorm={x:Oe.x/Re,y:Oe.y/Re},ze={x:-Ne.y,y:Ne.x};A.nodesOverlap=!ae(Re)||re.checkPoint(we[0],we[1],0,Q,K,N.x,N.y,J,z)||j.checkPoint(ie[0],ie[1],0,F,U,G.x,G.y,ne,q),A.vectorNormInverse=ze,R={nodesOverlap:A.nodesOverlap,dirCounts:A.dirCounts,calculatedIntersection:!0,hasBezier:A.hasBezier,hasUnbundled:A.hasUnbundled,eles:A.eles,srcPos:N,srcRs:z,tgtPos:G,tgtRs:q,srcW:Q,srcH:K,tgtW:F,tgtH:U,srcIntn:de,tgtIntn:ye,srcShape:re,tgtShape:j,posPts:{x1:Ee.x2,y1:Ee.y2,x2:Ee.x1,y2:Ee.y1},intersectionPts:{x1:he.x2,y1:he.y2,x2:he.x1,y2:he.y1},vector:{x:-Oe.x,y:-Oe.y},vectorNorm:{x:-Ne.x,y:-Ne.y},vectorNormInverse:{x:-ze.x,y:-ze.y}}}var xe=Ce?R:A;te.nodesOverlap=xe.nodesOverlap,te.srcIntn=xe.srcIntn,te.tgtIntn=xe.tgtIntn,te.isRound=ce.startsWith("round"),n&&(M.isParent()||M.isChild()||O.isParent()||O.isChild())&&(M.parents().anySame(O)||O.parents().anySame(M)||M.same(O)&&M.isParent())?e.findCompoundLoopPoints(Y,xe,H,Ae):M===O?e.findLoopPoints(Y,xe,H,Ae):ce.endsWith("segments")?e.findSegmentsPoints(Y,xe):ce.endsWith("taxi")?e.findTaxiPoints(Y,xe):ce==="straight"||!Ae&&A.eles.length%2===1&&H===Math.floor(A.eles.length/2)?e.findStraightEdgePoints(Y):e.findBezierPoints(Y,xe,H,Ae,Ce),e.findEndpoints(Y),e.tryToCorrectInvalidPoints(Y,xe),e.checkForInvalidEdgeWarning(Y),e.storeAllpts(Y),e.storeEdgeProjections(Y),e.calculateArrowAngles(Y),e.recalculateEdgeLabelProjections(Y),e.calculateLabelAngles(Y)}},x=0;x0){var we=u,ye=Et(we,Wt(s)),ie=Et(we,Wt(Ce)),de=ye;if(ie2){var he=Et(we,{x:Ce[2],y:Ce[3]});he0){var W=v,$=Et(W,Wt(s)),Z=Et(W,Wt(_)),oe=$;if(Z<$&&(s=[_[0],_[1]],oe=Z),_.length>2){var ee=Et(W,{x:_[2],y:_[3]});ee=d||x){g={cp:w,segment:C};break}}if(g)break}var T=g.cp,k=g.segment,D=(d-p)/k.length,B=k.t1-k.t0,P=h?k.t0+B*D:k.t1-B*D;P=ka(0,P,1),e=Kt(T.p0,T.p1,T.p2,P),c=ty(T.p0,T.p1,T.p2,P);break}case"straight":case"segments":case"haystack":{for(var A=0,R,L,I,M,O=a.allpts.length,V=0;V+3=d));V+=2);var G=d-L,N=G/R;N=ka(0,N,1),e=Td(I,M,N),c=bf(I,M);break}}s("labelX",f,e.x),s("labelY",f,e.y),s("labelAutoAngle",f,c)}};u("source"),u("target"),this.applyLabelDimensions(r)}};Gr.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};Gr.applyPrefixedLabelDimensions=function(r,e){var t=r._private,a=this.getLabelText(r,e),n=Dt(a,r._private.labelDimsKey);if(Tr(t.rscratch,"prefixedLabelDimsKey",e)!==n){Kr(t.rscratch,"prefixedLabelDimsKey",e,n);var i=this.calculateLabelDimensions(r,a),s=r.pstyle("line-height").pfValue,o=r.pstyle("text-wrap").strValue,l=Tr(t.rscratch,"labelWrapCachedLines",e)||[],u=o!=="wrap"?1:Math.max(l.length,1),v=i.height/u,f=v*s,c=i.width,h=i.height+(u-1)*(s-1)*v;Kr(t.rstyle,"labelWidth",e,c),Kr(t.rscratch,"labelWidth",e,c),Kr(t.rstyle,"labelHeight",e,h),Kr(t.rscratch,"labelHeight",e,h),Kr(t.rscratch,"labelLineHeight",e,f)}};Gr.getLabelText=function(r,e){var t=r._private,a=e?e+"-":"",n=r.pstyle(a+"label").strValue,i=r.pstyle("text-transform").value,s=function(U,Q){return Q?(Kr(t.rscratch,U,e,Q),Q):Tr(t.rscratch,U,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var o=r.pstyle("text-wrap").value;if(o==="wrap"){var l=s("labelKey");if(l!=null&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var u="​",v=n.split(` +`),f=r.pstyle("text-max-width").pfValue,c=r.pstyle("text-overflow-wrap").value,h=c==="anywhere",d=[],y=/[\s\u200b]+|$/g,g=0;gf){var E=p.matchAll(y),C="",x=0,T=kr(E),k;try{for(T.s();!(k=T.n()).done;){var D=k.value,B=D[0],P=p.substring(x,D.index);x=D.index+B.length;var A=C.length===0?P:C+P+B,R=this.calculateLabelDimensions(r,A),L=R.width;L<=f?C+=P+B:(C&&d.push(C),C=P+B)}}catch(F){T.e(F)}finally{T.f()}C.match(/^[\s\u200b]+$/)||d.push(C)}else d.push(p)}s("labelWrapCachedLines",d),n=s("labelWrapCachedText",d.join(` +`)),s("labelWrapKey",l)}else if(o==="ellipsis"){var I=r.pstyle("text-max-width").pfValue,M="",O="…",V=!1;if(this.calculateLabelDimensions(r,n).widthI)break;M+=n[G],G===n.length-1&&(V=!0)}return V||(M+=O),M}return n};Gr.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if(e==="auto")if(r.isNode())switch(t){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Gr.calculateLabelDimensions=function(r,e){var t=this,a=t.cy.window(),n=a.document,i=0,s=r.pstyle("font-style").strValue,o=r.pstyle("font-size").pfValue,l=r.pstyle("font-family").strValue,u=r.pstyle("font-weight").strValue,v=this.labelCalcCanvas,f=this.labelCalcCanvasContext;if(!v){v=this.labelCalcCanvas=n.createElement("canvas"),f=this.labelCalcCanvasContext=v.getContext("2d");var c=v.style;c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none"}f.font="".concat(s," ").concat(u," ").concat(o,"px ").concat(l);for(var h=0,d=0,y=e.split(` +`),g=0;g1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var l=0;l=r.desktopTapThreshold2}var lr=i(S);je&&(r.hoverData.tapholdCancelled=!0);var jr=function(){var Br=r.hoverData.dragDelta=r.hoverData.dragDelta||[];Br.length===0?(Br.push(Pe[0]),Br.push(Pe[1])):(Br[0]+=Pe[0],Br[1]+=Pe[1])};W=!0,n(De,["mousemove","vmousemove","tapdrag"],S,{x:ee[0],y:ee[1]});var Ze=function(Br){return{originalEvent:S,type:Br,position:{x:ee[0],y:ee[1]}}},Wr=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||$.emit(Ze("boxstart")),me[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(r.hoverData.which===3){if(je){var $r=Ze("cxtdrag");fe?fe.emit($r):$.emit($r),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||De!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit(Ze("cxtdragout")),r.hoverData.cxtOver=De,De&&De.emit(Ze("cxtdragover")))}}else if(r.hoverData.dragging){if(W=!0,$.panningEnabled()&&$.userPanningEnabled()){var It;if(r.hoverData.justStartedPan){var $a=r.hoverData.mdownPos;It={x:(ee[0]-$a[0])*Z,y:(ee[1]-$a[1])*Z},r.hoverData.justStartedPan=!1}else It={x:Pe[0]*Z,y:Pe[1]*Z};$.panBy(It),$.emit(Ze("dragpan")),r.hoverData.dragged=!0}ee=r.projectIntoViewport(S.clientX,S.clientY)}else if(me[4]==1&&(fe==null||fe.pannable())){if(je){if(!r.hoverData.dragging&&$.boxSelectionEnabled()&&(lr||!$.panningEnabled()||!$.userPanningEnabled()))Wr();else if(!r.hoverData.selecting&&$.panningEnabled()&&$.userPanningEnabled()){var bt=s(fe,r.hoverData.downs);bt&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,me[4]=0,r.data.bgActivePosistion=Wt(ve),r.redrawHint("select",!0),r.redraw())}fe&&fe.pannable()&&fe.active()&&fe.unactivate()}}else{if(fe&&fe.pannable()&&fe.active()&&fe.unactivate(),(!fe||!fe.grabbed())&&De!=Te&&(Te&&n(Te,["mouseout","tapdragout"],S,{x:ee[0],y:ee[1]}),De&&n(De,["mouseover","tapdragover"],S,{x:ee[0],y:ee[1]}),r.hoverData.last=De),fe)if(je){if($.boxSelectionEnabled()&&lr)fe&&fe.grabbed()&&(p(Be),fe.emit(Ze("freeon")),Be.emit(Ze("free")),r.dragData.didDrag&&(fe.emit(Ze("dragfreeon")),Be.emit(Ze("dragfree")))),Wr();else if(fe&&fe.grabbed()&&r.nodeIsDraggable(fe)){var Er=!r.dragData.didDrag;Er&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||y(Be,{inDragLayer:!0});var hr={x:0,y:0};if(ae(Pe[0])&&ae(Pe[1])&&(hr.x+=Pe[0],hr.y+=Pe[1],Er)){var Cr=r.hoverData.dragDelta;Cr&&ae(Cr[0])&&ae(Cr[1])&&(hr.x+=Cr[0],hr.y+=Cr[1])}r.hoverData.draggingEles=!0,Be.silentShift(hr).emit(Ze("position")).emit(Ze("drag")),r.redrawHint("drag",!0),r.redraw()}}else jr();W=!0}if(me[2]=ee[0],me[3]=ee[1],W)return S.stopPropagation&&S.stopPropagation(),S.preventDefault&&S.preventDefault(),!1}},!1);var P,A,R;r.registerBinding(e,"mouseup",function(S){if(!(r.hoverData.which===1&&S.which!==1&&r.hoverData.capture)){var _=r.hoverData.capture;if(_){r.hoverData.capture=!1;var W=r.cy,$=r.projectIntoViewport(S.clientX,S.clientY),Z=r.selection,oe=r.findNearestElement($[0],$[1],!0,!1),ee=r.dragData.possibleDragElements,ve=r.hoverData.down,le=i(S);r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,ve&&ve.unactivate();var me=function(Ke){return{originalEvent:S,type:Ke,position:{x:$[0],y:$[1]}}};if(r.hoverData.which===3){var De=me("cxttapend");if(ve?ve.emit(De):W.emit(De),!r.hoverData.cxtDragged){var Te=me("cxttap");ve?ve.emit(Te):W.emit(Te)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(n(oe,["mouseup","tapend","vmouseup"],S,{x:$[0],y:$[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(n(ve,["click","tap","vclick"],S,{x:$[0],y:$[1]}),A=!1,S.timeStamp-R<=W.multiClickDebounceTime()?(P&&clearTimeout(P),A=!0,R=null,n(ve,["dblclick","dbltap","vdblclick"],S,{x:$[0],y:$[1]})):(P=setTimeout(function(){A||n(ve,["oneclick","onetap","voneclick"],S,{x:$[0],y:$[1]})},W.multiClickDebounceTime()),R=S.timeStamp)),ve==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!i(S)&&(W.$(t).unselect(["tapunselect"]),ee.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=ee=W.collection()),oe==ve&&!r.dragData.didDrag&&!r.hoverData.selecting&&oe!=null&&oe._private.selectable&&(r.hoverData.dragging||(W.selectionType()==="additive"||le?oe.selected()?oe.unselect(["tapunselect"]):oe.select(["tapselect"]):le||(W.$(t).unmerge(oe).unselect(["tapunselect"]),oe.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var fe=W.collection(r.getAllInBox(Z[0],Z[1],Z[2],Z[3]));r.redrawHint("select",!0),fe.length>0&&r.redrawHint("eles",!0),W.emit(me("boxend"));var Pe=function(Ke){return Ke.selectable()&&!Ke.selected()};W.selectionType()==="additive"||le||W.$(t).unmerge(fe).unselect(),fe.emit(me("box")).stdFilter(Pe).select().emit(me("boxselect")),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!Z[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var Be=ve&&ve.grabbed();p(ee),Be&&(ve.emit(me("freeon")),ee.emit(me("free")),r.dragData.didDrag&&(ve.emit(me("dragfreeon")),ee.emit(me("dragfree"))))}}Z[4]=0,r.hoverData.down=null,r.hoverData.cxtStarted=!1,r.hoverData.draggingEles=!1,r.hoverData.selecting=!1,r.hoverData.isOverThresholdDrag=!1,r.dragData.didDrag=!1,r.hoverData.dragged=!1,r.hoverData.dragDelta=[],r.hoverData.mdownPos=null,r.hoverData.mdownGPos=null,r.hoverData.which=null}}},!1);var L=[],I=4,M,O=1e5,V=function(S,_){for(var W=0;W=I){var $=L;if(M=V($,5),!M){var Z=Math.abs($[0]);M=G($)&&Z>5}if(M)for(var oe=0;oe<$.length;oe++)O=Math.min(Math.abs($[oe]),O)}else L.push(W),_=!0;else M&&(O=Math.min(Math.abs(W),O));if(!r.scrollingPage){var ee=r.cy,ve=ee.zoom(),le=ee.pan(),me=r.projectIntoViewport(S.clientX,S.clientY),De=[me[0]*ve+le.x,me[1]*ve+le.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||k()){S.preventDefault();return}if(ee.panningEnabled()&&ee.userPanningEnabled()&&ee.zoomingEnabled()&&ee.userZoomingEnabled()){S.preventDefault(),r.data.wheelZooming=!0,clearTimeout(r.data.wheelTimeout),r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=!1,r.redrawHint("eles",!0),r.redraw()},150);var Te;_&&Math.abs(W)>5&&(W=to(W)*5),Te=W/-250,M&&(Te/=O,Te*=3),Te=Te*r.wheelSensitivity;var fe=S.deltaMode===1;fe&&(Te*=33);var Pe=ee.zoom()*Math.pow(10,Te);S.type==="gesturechange"&&(Pe=r.gestureStartZoom*S.scale),ee.zoom({level:Pe,renderedPosition:{x:De[0],y:De[1]}}),ee.emit({type:S.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:S,position:{x:me[0],y:me[1]}})}}}};r.registerBinding(r.container,"wheel",N,!0),r.registerBinding(e,"scroll",function(S){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(S){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||S.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(X){r.hasTouchStarted||N(X)},!0),r.registerBinding(r.container,"mouseout",function(S){var _=r.projectIntoViewport(S.clientX,S.clientY);r.cy.emit({originalEvent:S,type:"mouseout",position:{x:_[0],y:_[1]}})},!1),r.registerBinding(r.container,"mouseover",function(S){var _=r.projectIntoViewport(S.clientX,S.clientY);r.cy.emit({originalEvent:S,type:"mouseover",position:{x:_[0],y:_[1]}})},!1);var F,U,Q,K,j,re,ne,J,z,q,H,Y,te,ce=function(S,_,W,$){return Math.sqrt((W-S)*(W-S)+($-_)*($-_))},Ae=function(S,_,W,$){return(W-S)*(W-S)+($-_)*($-_)},Ce;r.registerBinding(r.container,"touchstart",Ce=function(S){if(r.hasTouchStarted=!0,!!D(S)){b(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var _=r.cy,W=r.touchData.now,$=r.touchData.earlier;if(S.touches[0]){var Z=r.projectIntoViewport(S.touches[0].clientX,S.touches[0].clientY);W[0]=Z[0],W[1]=Z[1]}if(S.touches[1]){var Z=r.projectIntoViewport(S.touches[1].clientX,S.touches[1].clientY);W[2]=Z[0],W[3]=Z[1]}if(S.touches[2]){var Z=r.projectIntoViewport(S.touches[2].clientX,S.touches[2].clientY);W[4]=Z[0],W[5]=Z[1]}var oe=function(lr){return{originalEvent:S,type:lr,position:{x:W[0],y:W[1]}}};if(S.touches[1]){r.touchData.singleTouchMoved=!0,p(r.dragData.touchDragEles);var ee=r.findContainerClientCoords();z=ee[0],q=ee[1],H=ee[2],Y=ee[3],F=S.touches[0].clientX-z,U=S.touches[0].clientY-q,Q=S.touches[1].clientX-z,K=S.touches[1].clientY-q,te=0<=F&&F<=H&&0<=Q&&Q<=H&&0<=U&&U<=Y&&0<=K&&K<=Y;var ve=_.pan(),le=_.zoom();j=ce(F,U,Q,K),re=Ae(F,U,Q,K),ne=[(F+Q)/2,(U+K)/2],J=[(ne[0]-ve.x)/le,(ne[1]-ve.y)/le];var me=200,De=me*me;if(re=1){for(var mr=r.touchData.startPosition=[null,null,null,null,null,null],Ye=0;Ye=r.touchTapThreshold2}if(_&&r.touchData.cxt){S.preventDefault();var Ye=S.touches[0].clientX-z,ir=S.touches[0].clientY-q,er=S.touches[1].clientX-z,lr=S.touches[1].clientY-q,jr=Ae(Ye,ir,er,lr),Ze=jr/re,Wr=150,$r=Wr*Wr,It=1.5,$a=It*It;if(Ze>=$a||jr>=$r){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var bt=le("cxttapend");r.touchData.start?(r.touchData.start.unactivate().emit(bt),r.touchData.start=null):$.emit(bt)}}if(_&&r.touchData.cxt){var bt=le("cxtdrag");r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(bt):$.emit(bt),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var Er=r.findNearestElement(Z[0],Z[1],!0,!0);(!r.touchData.cxtOver||Er!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit(le("cxtdragout")),r.touchData.cxtOver=Er,Er&&Er.emit(le("cxtdragover")))}else if(_&&S.touches[2]&&$.boxSelectionEnabled())S.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||$.emit(le("boxstart")),r.touchData.selecting=!0,r.touchData.didSelect=!0,W[4]=1,!W||W.length===0||W[0]===void 0?(W[0]=(Z[0]+Z[2]+Z[4])/3,W[1]=(Z[1]+Z[3]+Z[5])/3,W[2]=(Z[0]+Z[2]+Z[4])/3+1,W[3]=(Z[1]+Z[3]+Z[5])/3+1):(W[2]=(Z[0]+Z[2]+Z[4])/3,W[3]=(Z[1]+Z[3]+Z[5])/3),r.redrawHint("select",!0),r.redraw();else if(_&&S.touches[1]&&!r.touchData.didSelect&&$.zoomingEnabled()&&$.panningEnabled()&&$.userZoomingEnabled()&&$.userPanningEnabled()){S.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var hr=r.dragData.touchDragEles;if(hr){r.redrawHint("drag",!0);for(var Cr=0;Cr0&&!r.hoverData.draggingEles&&!r.swipePanning&&r.data.bgActivePosistion!=null&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},!1);var ye;r.registerBinding(e,"touchcancel",ye=function(S){var _=r.touchData.start;r.touchData.capture=!1,_&&_.unactivate()});var ie,de,he,Ee;if(r.registerBinding(e,"touchend",ie=function(S){var _=r.touchData.start,W=r.touchData.capture;if(W)S.touches.length===0&&(r.touchData.capture=!1),S.preventDefault();else return;var $=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var Z=r.cy,oe=Z.zoom(),ee=r.touchData.now,ve=r.touchData.earlier;if(S.touches[0]){var le=r.projectIntoViewport(S.touches[0].clientX,S.touches[0].clientY);ee[0]=le[0],ee[1]=le[1]}if(S.touches[1]){var le=r.projectIntoViewport(S.touches[1].clientX,S.touches[1].clientY);ee[2]=le[0],ee[3]=le[1]}if(S.touches[2]){var le=r.projectIntoViewport(S.touches[2].clientX,S.touches[2].clientY);ee[4]=le[0],ee[5]=le[1]}var me=function($r){return{originalEvent:S,type:$r,position:{x:ee[0],y:ee[1]}}};_&&_.unactivate();var De;if(r.touchData.cxt){if(De=me("cxttapend"),_?_.emit(De):Z.emit(De),!r.touchData.cxtDragged){var Te=me("cxttap");_?_.emit(Te):Z.emit(Te)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!S.touches[2]&&Z.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var fe=Z.collection(r.getAllInBox($[0],$[1],$[2],$[3]));$[0]=void 0,$[1]=void 0,$[2]=void 0,$[3]=void 0,$[4]=0,r.redrawHint("select",!0),Z.emit(me("boxend"));var Pe=function($r){return $r.selectable()&&!$r.selected()};fe.emit(me("box")).stdFilter(Pe).select().emit(me("boxselect")),fe.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(_?.unactivate(),S.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!S.touches[1]){if(!S.touches[0]){if(!S.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Be=r.dragData.touchDragEles;if(_!=null){var je=_._private.grabbed;p(Be),r.redrawHint("drag",!0),r.redrawHint("eles",!0),je&&(_.emit(me("freeon")),Be.emit(me("free")),r.dragData.didDrag&&(_.emit(me("dragfreeon")),Be.emit(me("dragfree")))),n(_,["touchend","tapend","vmouseup","tapdragout"],S,{x:ee[0],y:ee[1]}),_.unactivate(),r.touchData.start=null}else{var Ke=r.findNearestElement(ee[0],ee[1],!0,!0);n(Ke,["touchend","tapend","vmouseup","tapdragout"],S,{x:ee[0],y:ee[1]})}var mr=r.touchData.startPosition[0]-ee[0],Ye=mr*mr,ir=r.touchData.startPosition[1]-ee[1],er=ir*ir,lr=Ye+er,jr=lr*oe*oe;r.touchData.singleTouchMoved||(_||Z.$(":selected").unselect(["tapunselect"]),n(_,["tap","vclick"],S,{x:ee[0],y:ee[1]}),de=!1,S.timeStamp-Ee<=Z.multiClickDebounceTime()?(he&&clearTimeout(he),de=!0,Ee=null,n(_,["dbltap","vdblclick"],S,{x:ee[0],y:ee[1]})):(he=setTimeout(function(){de||n(_,["onetap","voneclick"],S,{x:ee[0],y:ee[1]})},Z.multiClickDebounceTime()),Ee=S.timeStamp)),_!=null&&!r.dragData.didDrag&&_._private.selectable&&jr"u"){var pe=[],Se=function(S){return{clientX:S.clientX,clientY:S.clientY,force:1,identifier:S.pointerId,pageX:S.pageX,pageY:S.pageY,radiusX:S.width/2,radiusY:S.height/2,screenX:S.screenX,screenY:S.screenY,target:S.target}},Re=function(S){return{event:S,touch:Se(S)}},Oe=function(S){pe.push(Re(S))},Ne=function(S){for(var _=0;_0)return F[0]}return null},d=Object.keys(c),y=0;y0?h:wv(i,s,e,t,a,n,o,l)},checkPoint:function(e,t,a,n,i,s,o,l){l=l==="auto"?vt(n,i):l;var u=2*l;if(Zr(e,t,this.points,s,o,n,i-u,[0,-1],a)||Zr(e,t,this.points,s,o,n-u,i,[0,-1],a))return!0;var v=n/2+2*a,f=i/2+2*a,c=[s-v,o-f,s-v,o,s+v,o,s+v,o-f];return!!(Sr(e,t,c)||kt(e,t,u,u,s+n/2-l,o+i/2-l,a)||kt(e,t,u,u,s-n/2+l,o+i/2-l,a))}}};Qr.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",br(3,0)),this.generateRoundPolygon("round-triangle",br(3,0)),this.generatePolygon("rectangle",br(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t)}this.generatePolygon("pentagon",br(5,0)),this.generateRoundPolygon("round-pentagon",br(5,0)),this.generatePolygon("hexagon",br(6,0)),this.generateRoundPolygon("round-hexagon",br(6,0)),this.generatePolygon("heptagon",br(7,0)),this.generateRoundPolygon("round-heptagon",br(7,0)),this.generatePolygon("octagon",br(8,0)),this.generateRoundPolygon("round-octagon",br(8,0));var a=new Array(20);{var n=Ps(5,0),i=Ps(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o=e.deqFastCost*w)break}else if(u){if(m>=e.deqCost*h||m>=e.deqAvgCost*c)break}else if(b>=e.deqNoDrawCost*ws)break;var E=e.deq(a,g,y);if(E.length>0)for(var C=0;C0&&(e.onDeqd(a,d),!u&&e.shouldRedraw(a,d,g,y)&&i())},o=e.priority||js;n.beforeRender(s,o(a))}}}},ny=(function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:xn;ht(this,r),this.idsByKey=new Xr,this.keyForId=new Xr,this.cachesByLvl=new Xr,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return gt(r,[{key:"getIdsFor",value:function(t){t==null&&$e("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(t);return n||(n=new ra,a.set(t,n)),n}},{key:"addIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).add(a)}},{key:"deleteIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).delete(a)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);return n!==i}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var a=this.cachesByLvl,n=this.lvls,i=a.get(t);return i||(i=new Xr,a.set(t,i),n.push(t)),i}},{key:"getCache",value:function(t,a){return this.getCachesAt(a).get(t)}},{key:"get",value:function(t,a){var n=this.getKey(t),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,a){var n=this.keyForId.get(t.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(t,a){return this.getCachesAt(a).has(t)}},{key:"has",value:function(t,a){var n=this.getKey(t);return this.hasCache(n,a)}},{key:"setCache",value:function(t,a,n){n.key=t,this.getCachesAt(a).set(t,n)}},{key:"set",value:function(t,a,n){var i=this.getKey(t);this.setCache(i,a,n),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,a){this.getCachesAt(a).delete(t)}},{key:"delete",value:function(t,a){var n=this.getKey(t);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(t){var a=this;this.lvls.forEach(function(n){return a.deleteCache(t,n)})}},{key:"invalidate",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}])})(),Nl=25,nn=50,pn=-4,Hs=3,Sf=7.99,iy=8,sy=1024,oy=1024,uy=1024,ly=.2,vy=.8,fy=10,cy=.15,dy=.1,hy=.9,gy=.9,py=100,yy=1,Ut={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},my=cr({getKey:null,doesEleInvalidateKey:xn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:dv,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ba=function(e,t){var a=this;a.renderer=e,a.onDequeues=[];var n=my(t);be(a,n),a.lookup=new ny(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},nr=ba.prototype;nr.reasons=Ut;nr.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};nr.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=t[r]=t[r]||[];return a};nr.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new Va(function(t,a){return a.reqs-t.reqs});return e};nr.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};nr.getElement=function(r,e,t,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(a==null&&(a=Math.ceil(ro(o*t))),a=Sf||a>Hs)return null;var u=Math.pow(2,a),v=e.h*u,f=e.w*u,c=s.eleTextBiggerThanMin(r,u);if(!this.isVisible(r,c))return null;var h=l.get(r,a);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var d;if(v<=Nl?d=Nl:v<=nn?d=nn:d=Math.ceil(v/nn)*nn,v>uy||f>oy)return null;var y=i.getTextureQueue(d),g=y[y.length-2],p=function(){return i.recycleTexture(d,f)||i.addTexture(d,f)};g||(g=y[y.length-1]),g||(g=p()),g.width-g.usedWidtha;B--)k=i.getElement(r,e,t,B,Ut.downscale);D()}else return i.queueElement(r,C.level-1),C;else{var P;if(!b&&!w&&!E)for(var A=a-1;A>=pn;A--){var R=l.get(r,A);if(R){P=R;break}}if(m(P))return i.queueElement(r,a),P;g.context.translate(g.usedWidth,0),g.context.scale(u,u),this.drawElement(g.context,r,e,c,!1),g.context.scale(1/u,1/u),g.context.translate(-g.usedWidth,0)}return h={x:g.usedWidth,texture:g,level:a,scale:u,width:f,height:v,scaledLabelShown:c},g.usedWidth+=Math.ceil(f+iy),g.eleCaches.push(h),l.set(r,a,h),i.checkTextureFullness(g),h};nr.invalidateElements=function(r){for(var e=0;e=ly*r.width&&this.retireTexture(r)};nr.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>vy&&r.fullnessChecks>=fy?lt(t,r):r.fullnessChecks++};nr.retireTexture=function(r){var e=this,t=r.height,a=e.getTextureQueue(t),n=this.lookup;lt(a,r),r.retired=!0;for(var i=r.eleCaches,s=0;s=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,eo(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),lt(n,s),a.push(s),s}};nr.queueElement=function(r,e){var t=this,a=t.getElementQueue(),n=t.getElementKeyToQueue(),i=this.getKey(r),s=n[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(r),s.reqs++,a.updateItem(s);else{var o={eles:r.spawn().merge(r),level:e,reqs:1,key:i};a.push(o),n[i]=o}};nr.dequeue=function(r){for(var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,s=0;s0;s++){var o=t.pop(),l=o.key,u=o.eles[0],v=i.hasCache(u,o.level);if(a[l]=null,v)continue;n.push(o);var f=e.getBoundingBox(u);e.getElement(u,f,r,o.level,Ut.dequeue)}return n};nr.removeFromQueue=function(r){var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(r),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=Js,t.updateItem(i),t.pop(),a[n]=null):i.eles.unmerge(r))};nr.onDequeue=function(r){this.onDequeues.push(r)};nr.offDequeue=function(r){lt(this.onDequeues,r)};nr.setupDequeueing=Tf.setupDequeueing({deqRedrawThreshold:py,deqCost:cy,deqAvgCost:dy,deqNoDrawCost:hy,deqFastCost:gy,deq:function(e,t,a){return e.dequeue(t,a)},onDeqd:function(e,t){for(var a=0;a=wy||t>Pn)return null}a.validateLayersElesOrdering(t,r);var l=a.layersByLevel,u=Math.pow(2,t),v=l[t]=l[t]||[],f,c=a.levelIsComplete(t,r),h,d=function(){var D=function(L){if(a.validateLayersElesOrdering(L,r),a.levelIsComplete(L,r))return h=l[L],!0},B=function(L){if(!h)for(var I=t+L;xa<=I&&I<=Pn&&!D(I);I+=L);};B(1),B(-1);for(var P=v.length-1;P>=0;P--){var A=v[P];A.invalid&<(v,A)}};if(!c)d();else return v;var y=function(){if(!f){f=wr();for(var D=0;DFl||A>Fl)return null;var R=P*A;if(R>By)return null;var L=a.makeLayer(f,t);if(B!=null){var I=v.indexOf(B)+1;v.splice(I,0,L)}else(D.insert===void 0||D.insert)&&v.unshift(L);return L};if(a.skipping&&!o)return null;for(var p=null,m=r.length/by,b=!o,w=0;w=m||!bv(p.bb,E.boundingBox()))&&(p=g({insert:!0,after:p}),!p))return null;h||b?a.queueLayer(p,E):a.drawEleInLayer(p,E,t,e),p.eles.push(E),x[t]=p}return h||(b?null:v)};dr.getEleLevelForLayerLevel=function(r,e){return r};dr.drawEleInLayer=function(r,e,t,a){var n=this,i=this.renderer,s=r.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(t=n.getEleLevelForLayerLevel(t,a),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,t,Py),i.setImgSmoothing(s,!0))};dr.levelIsComplete=function(r,e){var t=this,a=t.layersByLevel[r];if(!a||a.length===0)return!1;for(var n=0,i=0;i0||s.invalid)return!1;n+=s.eles.length}return n===e.length};dr.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var a=0;a0){e=!0;break}}return e};dr.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=Yr(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,function(a,n,i){e.invalidateLayer(a)}))};dr.invalidateLayer=function(r){if(this.lastInvalidationTime=Yr(),!r.invalid){var e=r.level,t=r.eles,a=this.layersByLevel[e];lt(a,r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.replacement.invalid=!0);for(var n=0;n3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(i&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var l;t&&(l=t,r.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,v=i?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,y=e.pstyle("line-outline-width").value,g=e.pstyle("line-outline-color").value,p=u*v,m=u*v,b=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;f==="straight-triangle"?(s.eleStrokeStyle(r,e,L),s.drawEdgeTrianglePath(e,r,o.allpts)):(r.lineWidth=h,r.lineCap=d,s.eleStrokeStyle(r,e,L),s.drawEdgePath(e,r,o.allpts,c),r.lineCap="butt")},w=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;if(r.lineWidth=h+y,r.lineCap=d,y>0)s.colorStrokeStyle(r,g[0],g[1],g[2],L);else{r.lineCap="butt";return}f==="straight-triangle"?s.drawEdgeTrianglePath(e,r,o.allpts):(s.drawEdgePath(e,r,o.allpts,c),r.lineCap="butt")},E=function(){n&&s.drawEdgeOverlay(r,e)},C=function(){n&&s.drawEdgeUnderlay(r,e)},x=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;s.drawArrowheads(r,e,L)},T=function(){s.drawElementText(r,e,null,a)};r.lineJoin="round";var k=e.pstyle("ghost").value==="yes";if(k){var D=e.pstyle("ghost-offset-x").pfValue,B=e.pstyle("ghost-offset-y").pfValue,P=e.pstyle("ghost-opacity").value,A=p*P;r.translate(D,B),b(A),x(A),r.translate(-D,-B)}else w();C(),b(),x(),E(),T(),t&&r.translate(l.x1,l.y1)}};var Bf=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,s=i.usePaths(),o=a._private.rscratch,l=a.pstyle("".concat(e,"-padding")).pfValue,u=2*l,v=a.pstyle("".concat(e,"-color")).value;t.lineWidth=u,o.edgeType==="self"&&!s?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,v[0],v[1],v[2],n),i.drawEdgePath(a,t,o.allpts,"solid")}}}};Jr.drawEdgeOverlay=Bf("overlay");Jr.drawEdgeUnderlay=Bf("underlay");Jr.drawEdgePath=function(r,e,t,a){var n=r._private.rscratch,i=e,s,o=!1,l=this.usePaths(),u=r.pstyle("line-dash-pattern").pfValue,v=r.pstyle("line-dash-offset").pfValue;if(l){var f=t.join("$"),c=n.pathCacheKey&&n.pathCacheKey===f;c?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=f,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=v;break;case"solid":i.setLineDash([]);break}if(!o&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+35&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(e);r.textAlign=l,r.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,v=e.pstyle("label"),f=e.pstyle("source-label"),c=e.pstyle("target-label");if(u||(!v||!v.value)&&(!f||!f.value)&&(!c||!c.value))return;r.textAlign="center",r.textBaseline="bottom"}var h=!t,d;t&&(d=t,r.translate(-d.x1,-d.y1)),n==null?(s.drawText(r,e,null,h,i),e.isEdge()&&(s.drawText(r,e,"source",h,i),s.drawText(r,e,"target",h,i))):s.drawText(r,e,n,h,i),t&&r.translate(d.x1,d.y1)};Lt.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*o,u=e.pstyle("color").value,v=e.pstyle("text-outline-color").value;r.font=a+" "+s+" "+n+" "+i,r.lineJoin="round",this.colorFillStyle(r,u[0],u[1],u[2],o),this.colorStrokeStyle(r,v[0],v[1],v[2],l)};function qy(r,e,t,a,n){var i=Math.min(a,n),s=i/2,o=e+a/2,l=t+n/2;r.beginPath(),r.arc(o,l,s,0,Math.PI*2),r.closePath()}function Gl(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=Math.min(i,a/2,n/2);r.beginPath(),r.moveTo(e+s,t),r.lineTo(e+a-s,t),r.quadraticCurveTo(e+a,t,e+a,t+s),r.lineTo(e+a,t+n-s),r.quadraticCurveTo(e+a,t+n,e+a-s,t+n),r.lineTo(e+s,t+n),r.quadraticCurveTo(e,t+n,e,t+n-s),r.lineTo(e,t+s),r.quadraticCurveTo(e,t,e+s,t),r.closePath()}Lt.getTextAngle=function(r,e){var t,a=r._private,n=a.rscratch,i=e?e+"-":"",s=r.pstyle(i+"text-rotation");if(s.strValue==="autorotate"){var o=Tr(n,"labelAngle",e);t=r.isEdge()?o:0}else s.strValue==="none"?t=0:t=s.pfValue;return t};Lt.drawText=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){t==="main"&&(t=null);var l=Tr(s,"labelX",t),u=Tr(s,"labelY",t),v,f,c=this.getLabelText(e,t);if(c!=null&&c!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(r,e,n);var h=t?t+"-":"",d=Tr(s,"labelWidth",t),y=Tr(s,"labelHeight",t),g=e.pstyle(h+"text-margin-x").pfValue,p=e.pstyle(h+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,w=e.pstyle("text-valign").value;m&&(b="center",w="center"),l+=g,u+=p;var E;switch(a?E=this.getTextAngle(e,t):E=0,E!==0&&(v=l,f=u,r.translate(v,f),r.rotate(E),l=0,u=0),w){case"top":break;case"center":u+=y/2;break;case"bottom":u+=y;break}var C=e.pstyle("text-background-opacity").value,x=e.pstyle("text-border-opacity").value,T=e.pstyle("text-border-width").pfValue,k=e.pstyle("text-background-padding").pfValue,D=e.pstyle("text-background-shape").strValue,B=D==="round-rectangle"||D==="roundrectangle",P=D==="circle",A=2;if(C>0||T>0&&x>0){var R=r.fillStyle,L=r.strokeStyle,I=r.lineWidth,M=e.pstyle("text-background-color").value,O=e.pstyle("text-border-color").value,V=e.pstyle("text-border-style").value,G=C>0,N=T>0&&x>0,F=l-k;switch(b){case"left":F-=d;break;case"center":F-=d/2;break}var U=u-y-k,Q=d+2*k,K=y+2*k;if(G&&(r.fillStyle="rgba(".concat(M[0],",").concat(M[1],",").concat(M[2],",").concat(C*o,")")),N&&(r.strokeStyle="rgba(".concat(O[0],",").concat(O[1],",").concat(O[2],",").concat(x*o,")"),r.lineWidth=T,r.setLineDash))switch(V){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=T/4,r.setLineDash([]);break;default:r.setLineDash([]);break}if(B?(r.beginPath(),Gl(r,F,U,Q,K,A)):P?(r.beginPath(),qy(r,F,U,Q,K)):(r.beginPath(),r.rect(F,U,Q,K)),G&&r.fill(),N&&r.stroke(),N&&V==="double"){var j=T/2;r.beginPath(),B?Gl(r,F+j,U+j,Q-2*j,K-2*j,A):r.rect(F+j,U+j,Q-2*j,K-2*j),r.stroke()}r.fillStyle=R,r.strokeStyle=L,r.lineWidth=I,r.setLineDash&&r.setLineDash([])}var re=2*e.pstyle("text-outline-width").pfValue;if(re>0&&(r.lineWidth=re),e.pstyle("text-wrap").value==="wrap"){var ne=Tr(s,"labelWrapCachedLines",t),J=Tr(s,"labelLineHeight",t),z=d/2,q=this.getLabelJustification(e);switch(q==="auto"||(b==="left"?q==="left"?l+=-d:q==="center"&&(l+=-z):b==="center"?q==="left"?l+=-z:q==="right"&&(l+=z):b==="right"&&(q==="center"?l+=z:q==="right"&&(l+=d))),w){case"top":u-=(ne.length-1)*J;break;case"center":case"bottom":u-=(ne.length-1)*J;break}for(var H=0;H0&&r.strokeText(ne[H],l,u),r.fillText(ne[H],l,u),u+=J}else re>0&&r.strokeText(c,l,u),r.fillText(c,l,u);E!==0&&(r.rotate(-E),r.translate(-v,-f))}}};var yt={};yt.drawNode=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,l,u=e._private,v=u.rscratch,f=e.position();if(!(!ae(f.x)||!ae(f.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,h=s.usePaths(),d,y=!1,g=e.padding();o=e.width()+2*g,l=e.height()+2*g;var p;t&&(p=t,r.translate(-p.x1,-p.y1));for(var m=e.pstyle("background-image"),b=m.value,w=new Array(b.length),E=new Array(b.length),C=0,x=0;x0&&arguments[0]!==void 0?arguments[0]:A;s.eleFillStyle(r,e,ue)},J=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:N;s.colorStrokeStyle(r,R[0],R[1],R[2],ue)},z=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:K;s.colorStrokeStyle(r,U[0],U[1],U[2],ue)},q=function(ue,X,S,_){var W=s.nodePathCache=s.nodePathCache||[],$=cv(S==="polygon"?S+","+_.join(","):S,""+X,""+ue,""+re),Z=W[$],oe,ee=!1;return Z!=null?(oe=Z,ee=!0,v.pathCache=oe):(oe=new Path2D,W[$]=v.pathCache=oe),{path:oe,cacheHit:ee}},H=e.pstyle("shape").strValue,Y=e.pstyle("shape-polygon-points").pfValue;if(h){r.translate(f.x,f.y);var te=q(o,l,H,Y);d=te.path,y=te.cacheHit}var ce=function(){if(!y){var ue=f;h&&(ue={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(d||r,ue.x,ue.y,o,l,re,v)}h?r.fill(d):r.fill()},Ae=function(){for(var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,S=u.backgrounding,_=0,W=0;W0&&arguments[0]!==void 0?arguments[0]:!1,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;s.hasPie(e)&&(s.drawPie(r,e,X),ue&&(h||s.nodeShapes[s.getNodeShape(e)].draw(r,f.x,f.y,o,l,re,v)))},we=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;s.hasStripe(e)&&(r.save(),h?r.clip(v.pathCache):(s.nodeShapes[s.getNodeShape(e)].draw(r,f.x,f.y,o,l,re,v),r.clip()),s.drawStripe(r,e,X),r.restore(),ue&&(h||s.nodeShapes[s.getNodeShape(e)].draw(r,f.x,f.y,o,l,re,v)))},ye=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,X=(B>0?B:-B)*ue,S=B>0?0:255;B!==0&&(s.colorFillStyle(r,S,S,S,X),h?r.fill(d):r.fill())},ie=function(){if(P>0){if(r.lineWidth=P,r.lineCap=M,r.lineJoin=I,r.setLineDash)switch(L){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(V),r.lineDashOffset=G;break;case"solid":case"double":r.setLineDash([]);break}if(O!=="center"){if(r.save(),r.lineWidth*=2,O==="inside")h?r.clip(d):r.clip();else{var ue=new Path2D;ue.rect(-o/2-P,-l/2-P,o+2*P,l+2*P),ue.addPath(d),r.clip(ue,"evenodd")}h?r.stroke(d):r.stroke(),r.restore()}else h?r.stroke(d):r.stroke();if(L==="double"){r.lineWidth=P/3;var X=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(d):r.stroke(),r.globalCompositeOperation=X}r.setLineDash&&r.setLineDash([])}},de=function(){if(F>0){if(r.lineWidth=F,r.lineCap="butt",r.setLineDash)switch(Q){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}var ue=f;h&&(ue={x:0,y:0});var X=s.getNodeShape(e),S=P;O==="inside"&&(S=0),O==="outside"&&(S*=2);var _=(o+S+(F+j))/o,W=(l+S+(F+j))/l,$=o*_,Z=l*W,oe=s.nodeShapes[X].points,ee;if(h){var ve=q($,Z,X,oe);ee=ve.path}if(X==="ellipse")s.drawEllipsePath(ee||r,ue.x,ue.y,$,Z);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(X)){var le=0,me=0,De=0;X==="round-diamond"?le=(S+j+F)*1.4:X==="round-heptagon"?(le=(S+j+F)*1.075,De=-(S/2+j+F)/35):X==="round-hexagon"?le=(S+j+F)*1.12:X==="round-pentagon"?(le=(S+j+F)*1.13,De=-(S/2+j+F)/15):X==="round-tag"?(le=(S+j+F)*1.12,me=(S/2+F+j)*.07):X==="round-triangle"&&(le=(S+j+F)*(Math.PI/2),De=-(S+j/2+F)/Math.PI),le!==0&&(_=(o+le)/o,$=o*_,["round-hexagon","round-tag"].includes(X)||(W=(l+le)/l,Z=l*W)),re=re==="auto"?Ev($,Z):re;for(var Te=$/2,fe=Z/2,Pe=re+(S+F+j)/2,Be=new Array(oe.length/2),je=new Array(oe.length/2),Ke=0;Ke0){if(n=n||a.position(),i==null||s==null){var h=a.padding();i=a.width()+2*h,s=a.height()+2*h}o.colorFillStyle(t,v[0],v[1],v[2],u),o.nodeShapes[f].draw(t,n.x,n.y,i+l*2,s+l*2,c),t.fill()}}}};yt.drawNodeOverlay=Pf("overlay");yt.drawNodeUnderlay=Pf("underlay");yt.hasPie=function(r){return r=r[0],r._private.hasPie};yt.hasStripe=function(r){return r=r[0],r._private.hasStripe};yt.drawPie=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),s=e.pstyle("pie-hole"),o=e.pstyle("pie-start-angle").pfValue,l=a.x,u=a.y,v=e.width(),f=e.height(),c=Math.min(v,f)/2,h,d=0,y=this.usePaths();if(y&&(l=0,u=0),i.units==="%"?c=c*i.pfValue:i.pfValue!==void 0&&(c=i.pfValue/2),s.units==="%"?h=c*s.pfValue:s.pfValue!==void 0&&(h=s.pfValue/2),!(h>=c))for(var g=1;g<=n.pieBackgroundN;g++){var p=e.pstyle("pie-"+g+"-background-size").value,m=e.pstyle("pie-"+g+"-background-color").value,b=e.pstyle("pie-"+g+"-background-opacity").value*t,w=p/100;w+d>1&&(w=1-d);var E=1.5*Math.PI+2*Math.PI*d;E+=o;var C=2*Math.PI*w,x=E+C;p===0||d>=1||d+w>1||(h===0?(r.beginPath(),r.moveTo(l,u),r.arc(l,u,c,E,x),r.closePath()):(r.beginPath(),r.arc(l,u,c,E,x),r.arc(l,u,h,x,E,!0),r.closePath()),this.colorFillStyle(r,m[0],m[1],m[2],b),r.fill(),d+=w)}};yt.drawStripe=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=a.x,s=a.y,o=e.width(),l=e.height(),u=0,v=this.usePaths();r.save();var f=e.pstyle("stripe-direction").value,c=e.pstyle("stripe-size");switch(f){case"vertical":break;case"righward":r.rotate(-Math.PI/2);break}var h=o,d=l;c.units==="%"?(h=h*c.pfValue,d=d*c.pfValue):c.pfValue!==void 0&&(h=c.pfValue,d=c.pfValue),v&&(i=0,s=0),s-=h/2,i-=d/2;for(var y=1;y<=n.stripeBackgroundN;y++){var g=e.pstyle("stripe-"+y+"-background-size").value,p=e.pstyle("stripe-"+y+"-background-color").value,m=e.pstyle("stripe-"+y+"-background-opacity").value*t,b=g/100;b+u>1&&(b=1-u),!(g===0||u>=1||u+b>1)&&(r.beginPath(),r.rect(i,s+d*u,h,d*b),r.closePath(),this.colorFillStyle(r,p[0],p[1],p[2],m),r.fill(),u+=b)}r.restore()};var xr={},_y=100;xr.getPixelRatio=function(){var r=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),t=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/t};xr.paintCache=function(r){for(var e=this.paintCaches=this.paintCaches||[],t=!0,a,n=0;ne.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!f&&(v[e.NODE]=!0,v[e.SELECT_BOX]=!0);var m=t.style(),b=t.zoom(),w=s!==void 0?s:b,E=t.pan(),C={x:E.x,y:E.y},x={zoom:b,pan:{x:E.x,y:E.y}},T=e.prevViewport,k=T===void 0||x.zoom!==T.zoom||x.pan.x!==T.pan.x||x.pan.y!==T.pan.y;!k&&!(y&&!d)&&(e.motionBlurPxRatio=1),o&&(C=o),w*=l,C.x*=l,C.y*=l;var D=e.getCachedZSortedEles();function B(J,z,q,H,Y){var te=J.globalCompositeOperation;J.globalCompositeOperation="destination-out",e.colorFillStyle(J,255,255,255,e.motionBlurTransparency),J.fillRect(z,q,H,Y),J.globalCompositeOperation=te}function P(J,z){var q,H,Y,te;!e.clearingMotionBlur&&(J===u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||J===u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(q={x:E.x*h,y:E.y*h},H=b*h,Y=e.canvasWidth*h,te=e.canvasHeight*h):(q=C,H=w,Y=e.canvasWidth,te=e.canvasHeight),J.setTransform(1,0,0,1,0,0),z==="motionBlur"?B(J,0,0,Y,te):!a&&(z===void 0||z)&&J.clearRect(0,0,Y,te),n||(J.translate(q.x,q.y),J.scale(H,H)),o&&J.translate(o.x,o.y),s&&J.scale(s,s)}if(f||(e.textureDrawLastFrame=!1),f){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=t.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var A=e.data.bufferContexts[e.TEXTURE_BUFFER];A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:A,drawOnlyNodeLayer:!0,forcedPxRatio:l*e.textureMult});var x=e.textureCache.viewport={zoom:t.zoom(),pan:t.pan(),width:e.canvasWidth,height:e.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}v[e.DRAG]=!1,v[e.NODE]=!1;var R=u.contexts[e.NODE],L=e.textureCache.texture,x=e.textureCache.viewport;R.setTransform(1,0,0,1,0,0),c?B(R,0,0,x.width,x.height):R.clearRect(0,0,x.width,x.height);var I=m.core("outside-texture-bg-color").value,M=m.core("outside-texture-bg-opacity").value;e.colorFillStyle(R,I[0],I[1],I[2],M),R.fillRect(0,0,x.width,x.height);var b=t.zoom();P(R,!1),R.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/l,x.height/x.zoom/l),R.drawImage(L,x.mpan.x,x.mpan.y,x.width/x.zoom/l,x.height/x.zoom/l)}else e.textureOnViewport&&!a&&(e.textureCache=null);var O=t.extent(),V=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),G=e.hideEdgesOnViewport&&V,N=[];if(N[e.NODE]=!v[e.NODE]&&c&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,N[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),N[e.DRAG]=!v[e.DRAG]&&c&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,N[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),v[e.NODE]||n||i||N[e.NODE]){var F=c&&!N[e.NODE]&&h!==1,R=a||(F?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:u.contexts[e.NODE]),U=c&&!F?"motionBlur":void 0;P(R,U),G?e.drawCachedNodes(R,D.nondrag,l,O):e.drawLayeredElements(R,D.nondrag,l,O),e.debug&&e.drawDebugPoints(R,D.nondrag),!n&&!c&&(v[e.NODE]=!1)}if(!i&&(v[e.DRAG]||n||N[e.DRAG])){var F=c&&!N[e.DRAG]&&h!==1,R=a||(F?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:u.contexts[e.DRAG]);P(R,c&&!F?"motionBlur":void 0),G?e.drawCachedNodes(R,D.drag,l,O):e.drawCachedElements(R,D.drag,l,O),e.debug&&e.drawDebugPoints(R,D.drag),!n&&!c&&(v[e.DRAG]=!1)}if(this.drawSelectionRectangle(r,P),c&&h!==1){var Q=u.contexts[e.NODE],K=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],j=u.contexts[e.DRAG],re=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],ne=function(z,q,H){z.setTransform(1,0,0,1,0,0),H||!p?z.clearRect(0,0,e.canvasWidth,e.canvasHeight):B(z,0,0,e.canvasWidth,e.canvasHeight);var Y=h;z.drawImage(q,0,0,e.canvasWidth*Y,e.canvasHeight*Y,0,0,e.canvasWidth,e.canvasHeight)};(v[e.NODE]||N[e.NODE])&&(ne(Q,K,N[e.NODE]),v[e.NODE]=!1),(v[e.DRAG]||N[e.DRAG])&&(ne(j,re,N[e.DRAG]),v[e.DRAG]=!1)}e.prevViewport=x,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),c&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!f,e.mbFrames=0,v[e.NODE]=!0,v[e.DRAG]=!0,e.redraw()},_y)),a||t.emit("render")};var ha;xr.drawSelectionRectangle=function(r,e){var t=this,a=t.cy,n=t.data,i=a.style(),s=r.drawOnlyNodeLayer,o=r.drawAllLayers,l=n.canvasNeedsRedraw,u=r.forcedContext;if(t.showFps||!s&&l[t.SELECT_BOX]&&!o){var v=u||n.contexts[t.SELECT_BOX];if(e(v),t.selection[4]==1&&(t.hoverData.selecting||t.touchData.selecting)){var f=t.cy.zoom(),c=i.core("selection-box-border-width").value/f;v.lineWidth=c,v.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",v.fillRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]),c>0&&(v.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",v.strokeRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]))}if(n.bgActivePosistion&&!t.hoverData.selecting){var f=t.cy.zoom(),h=n.bgActivePosistion;v.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",v.beginPath(),v.arc(h.x,h.y,i.core("active-bg-size").pfValue/f,0,2*Math.PI),v.fill()}var d=t.lastRedrawTime;if(t.showFps&&d){d=Math.round(d);var y=Math.round(1e3/d),g="1 frame = "+d+" ms = "+y+" fps";if(v.setTransform(1,0,0,1,0,0),v.fillStyle="rgba(255, 0, 0, 0.75)",v.strokeStyle="rgba(255, 0, 0, 0.75)",v.font="30px Arial",!ha){var p=v.measureText(g);ha=p.actualBoundingBoxAscent}v.fillText(g,0,ha);var m=60;v.strokeRect(0,ha+10,250,20),v.fillRect(0,ha+10,250*Math.min(y/m,1),20)}o||(l[t.SELECT_BOX]=!1)}};function Hl(r,e,t){var a=r.createShader(e);if(r.shaderSource(a,t),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS))throw new Error(r.getShaderInfoLog(a));return a}function Gy(r,e,t){var a=Hl(r,r.VERTEX_SHADER,e),n=Hl(r,r.FRAGMENT_SHADER,t),i=r.createProgram();if(r.attachShader(i,a),r.attachShader(i,n),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function Hy(r,e,t){t===void 0&&(t=e);var a=r.makeOffscreenCanvas(e,t),n=a.context=a.getContext("2d");return a.clear=function(){return n.clearRect(0,0,a.width,a.height)},a.clear(),a}function bo(r){var e=r.pixelRatio,t=r.cy.zoom(),a=r.cy.pan();return{zoom:t*e,pan:{x:a.x*e,y:a.y*e}}}function Wy(r){var e=r.pixelRatio,t=r.cy.zoom();return t*e}function $y(r,e,t,a,n){var i=a*t+e.x,s=n*t+e.y;return s=Math.round(r.canvasHeight-s),[i,s]}function Uy(r){return r.pstyle("background-fill").value!=="solid"||r.pstyle("background-image").strValue!=="none"?!1:r.pstyle("border-width").value===0||r.pstyle("border-opacity").value===0?!0:r.pstyle("border-style").value==="solid"}function Ky(r,e){if(r.length!==e.length)return!1;for(var t=0;t>0&255)/255,t[1]=(r>>8&255)/255,t[2]=(r>>16&255)/255,t[3]=(r>>24&255)/255,t}function Xy(r){return r[0]+(r[1]<<8)+(r[2]<<16)+(r[3]<<24)}function Yy(r,e){var t=r.createTexture();return t.buffer=function(a){r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,a),r.generateMipmap(r.TEXTURE_2D),r.bindTexture(r.TEXTURE_2D,null)},t.deleteTexture=function(){r.deleteTexture(t)},t}function Af(r,e){switch(e){case"float":return[1,r.FLOAT,4];case"vec2":return[2,r.FLOAT,4];case"vec3":return[3,r.FLOAT,4];case"vec4":return[4,r.FLOAT,4];case"int":return[1,r.INT,4];case"ivec2":return[2,r.INT,4]}}function Rf(r,e,t){switch(e){case r.FLOAT:return new Float32Array(t);case r.INT:return new Int32Array(t)}}function Zy(r,e,t,a,n,i){switch(e){case r.FLOAT:return new Float32Array(t.buffer,i*a,n);case r.INT:return new Int32Array(t.buffer,i*a,n)}}function Qy(r,e,t,a){var n=Af(r,e),i=Je(n,2),s=i[0],o=i[1],l=Rf(r,o,a),u=r.createBuffer();return r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,l,r.STATIC_DRAW),o===r.FLOAT?r.vertexAttribPointer(t,s,o,!1,0,0):o===r.INT&&r.vertexAttribIPointer(t,s,o,0,0),r.enableVertexAttribArray(t),r.bindBuffer(r.ARRAY_BUFFER,null),u}function Fr(r,e,t,a){var n=Af(r,t),i=Je(n,3),s=i[0],o=i[1],l=i[2],u=Rf(r,o,e*s),v=s*l,f=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,f),r.bufferData(r.ARRAY_BUFFER,e*v,r.DYNAMIC_DRAW),r.enableVertexAttribArray(a),o===r.FLOAT?r.vertexAttribPointer(a,s,o,!1,v,0):o===r.INT&&r.vertexAttribIPointer(a,s,o,v,0),r.vertexAttribDivisor(a,1),r.bindBuffer(r.ARRAY_BUFFER,null);for(var c=new Array(e),h=0;hs&&(o=s/a,l=a*o,u=n*o),{scale:o,texW:l,texH:u}}},{key:"draw",value:function(t,a,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,o=this.texRows,l=this.texHeight,u=this.getScale(a),v=u.scale,f=u.texW,c=u.texH,h=function(b,w){if(n&&w){var E=w.context,C=b.x,x=b.row,T=C,k=l*x;E.save(),E.translate(T,k),E.scale(v,v),n(E,a),E.restore()}},d=[null,null],y=function(){h(i.freePointer,i.canvas),d[0]={x:i.freePointer.x,y:i.freePointer.row*l,w:f,h:c},d[1]={x:i.freePointer.x+f,y:i.freePointer.row*l,w:0,h:c},i.freePointer.x+=f,i.freePointer.x==s&&(i.freePointer.x=0,i.freePointer.row++)},g=function(){var b=i.scratch,w=i.canvas;b.clear(),h({x:0,row:0},b);var E=s-i.freePointer.x,C=f-E,x=l;{var T=i.freePointer.x,k=i.freePointer.row*l,D=E;w.context.drawImage(b,0,0,D,x,T,k,D,x),d[0]={x:T,y:k,w:D,h:c}}{var B=E,P=(i.freePointer.row+1)*l,A=C;w&&w.context.drawImage(b,B,0,A,x,0,P,A,x),d[1]={x:0,y:P,w:A,h:c}}i.freePointer.x=C,i.freePointer.row++},p=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+f<=s)y();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(p(),y()):this.enableWrapping?g():(p(),y())}return this.keyToLocation.set(t,d),this.needsBuffer=!0,d}},{key:"getOffsets",value:function(t){return this.keyToLocation.get(t)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(t){if(this.locked)return!1;var a=this.texSize,n=this.texRows,i=this.getScale(t),s=i.texW;return this.freePointer.x+s>a?this.freePointer.row1&&arguments[1]!==void 0?arguments[1]:{},i=n.forceRedraw,s=i===void 0?!1:i,o=n.filterEle,l=o===void 0?function(){return!0}:o,u=n.filterType,v=u===void 0?function(){return!0}:u,f=!1,c=!1,h=kr(t),d;try{for(h.s();!(d=h.n()).done;){var y=d.value;if(l(y)){var g=kr(this.renderTypes.values()),p;try{var m=function(){var w=p.value,E=w.type;if(v(E)){var C=a.collections.get(w.collection),x=w.getKey(y),T=Array.isArray(x)?x:[x];if(s)T.forEach(function(P){return C.markKeyForGC(P)}),c=!0;else{var k=w.getID?w.getID(y):y.id(),D=a._key(E,k),B=a.typeAndIdToKey.get(D);B!==void 0&&!Ky(T,B)&&(f=!0,a.typeAndIdToKey.delete(D),B.forEach(function(P){return C.markKeyForGC(P)}))}}};for(g.s();!(p=g.n()).done;)m()}catch(b){g.e(b)}finally{g.f()}}}}catch(b){h.e(b)}finally{h.f()}return c&&(this.gc(),f=!1),f}},{key:"gc",value:function(){var t=kr(this.collections.values()),a;try{for(t.s();!(a=t.n()).done;){var n=a.value;n.gc()}}catch(i){t.e(i)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(t,a,n,i){var s=this.renderTypes.get(a),o=this.collections.get(s.collection),l=!1,u=o.draw(i,n,function(c){s.drawClipped?(c.save(),c.beginPath(),c.rect(0,0,n.w,n.h),c.clip(),s.drawElement(c,t,n,!0,!0),c.restore()):s.drawElement(c,t,n,!0,!0),l=!0});if(l){var v=s.getID?s.getID(t):t.id(),f=this._key(a,v);this.typeAndIdToKey.has(f)?this.typeAndIdToKey.get(f).push(i):this.typeAndIdToKey.set(f,[i])}return u}},{key:"getAtlasInfo",value:function(t,a){var n=this,i=this.renderTypes.get(a),s=i.getKey(t),o=Array.isArray(s)?s:[s];return o.map(function(l){var u=i.getBoundingBox(t,l),v=n.getOrCreateAtlas(t,a,u,l),f=v.getOffsets(l),c=Je(f,2),h=c[0],d=c[1];return{atlas:v,tex:h,tex1:h,tex2:d,bb:u}})}},{key:"getDebugInfo",value:function(){var t=[],a=kr(this.collections),n;try{for(a.s();!(n=a.n()).done;){var i=Je(n.value,2),s=i[0],o=i[1],l=o.getCounts(),u=l.keyCount,v=l.atlasCount;t.push({type:s,keyCount:u,atlasCount:v})}}catch(f){a.e(f)}finally{a.f()}return t}}])})(),sm=(function(){function r(e){ht(this,r),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return gt(r,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(t,a){return a})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(t){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(t):!0}},{key:"getAtlasIndexForBatch",value:function(t){var a=this.batchAtlases.indexOf(t);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(t),a=this.batchAtlases.length-1}return a}}])})(),om=` + float circleSD(vec2 p, float r) { + return distance(vec2(0), p) - r; // signed distance + } +`,um=` + float rectangleSD(vec2 p, vec2 b) { + vec2 d = abs(p)-b; + return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0); + } +`,lm=` + float roundRectangleSD(vec2 p, vec2 b, vec4 cr) { + cr.xy = (p.x > 0.0) ? cr.xy : cr.zw; + cr.x = (p.y > 0.0) ? cr.x : cr.y; + vec2 q = abs(p) - b + cr.x; + return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x; + } +`,vm=` + float ellipseSD(vec2 p, vec2 ab) { + p = abs( p ); // symmetry + + // find root with Newton solver + vec2 q = ab*(p-ab); + float w = (q.x1.0) ? d : -d; + } +`,Ea={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},An={IGNORE:1,USE_BB:2},Cs=0,Kl=1,Xl=2,Ts=3,_t=4,sn=5,ga=6,pa=7,fm=(function(){function r(e,t,a){ht(this,r),this.r=e,this.gl=t,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=Hy,this.atlasManager=new im(e,a),this.batchManager=new sm(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Ea.SCREEN),this.pickingProgram=this._createShaderProgram(Ea.PICKING),this.vao=this._createVAO()}return gt(r,[{key:"addAtlasCollection",value:function(t,a){this.atlasManager.addAtlasCollection(t,a)}},{key:"addTextureAtlasRenderType",value:function(t,a){this.atlasManager.addRenderType(t,a)}},{key:"addSimpleShapeRenderType",value:function(t,a){this.simpleShapeOptions.set(t,a)}},{key:"invalidate",value:function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.type,i=this.atlasManager;return n?i.invalidate(t,{filterType:function(o){return o===n},forceRedraw:!0}):i.invalidate(t)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(t){var a=this.gl,n=`#version 300 es + precision highp float; + + uniform mat3 uPanZoomMatrix; + uniform int uAtlasSize; + + // instanced + in vec2 aPosition; // a vertex from the unit square + + in mat3 aTransform; // used to transform verticies, eg into a bounding box + in int aVertType; // the type of thing we are rendering + + // the z-index that is output when using picking mode + in vec4 aIndex; + + // For textures + in int aAtlasId; // which shader unit/atlas to use + in vec4 aTex; // x/y/w/h of texture in atlas + + // for edges + in vec4 aPointAPointB; + in vec4 aPointCPointD; + in vec2 aLineWidth; // also used for node border width + + // simple shapes + in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left] + in vec4 aColor; // also used for edges + in vec4 aBorderColor; // aLineWidth is used for border width + + // output values passed to the fragment shader + out vec2 vTexCoord; + out vec4 vColor; + out vec2 vPosition; + // flat values are not interpolated + flat out int vAtlasId; + flat out int vVertType; + flat out vec2 vTopRight; + flat out vec2 vBotLeft; + flat out vec4 vCornerRadius; + flat out vec4 vBorderColor; + flat out vec2 vBorderWidth; + flat out vec4 vIndex; + + void main(void) { + int vid = gl_VertexID; + vec2 position = aPosition; // TODO make this a vec3, simplifies some code below + + if(aVertType == `.concat(Cs,`) { + float texX = aTex.x; // texture coordinates + float texY = aTex.y; + float texW = aTex.z; + float texH = aTex.w; + + if(vid == 1 || vid == 2 || vid == 4) { + texX += texW; + } + if(vid == 2 || vid == 4 || vid == 5) { + texY += texH; + } + + float d = float(uAtlasSize); + vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1 + + gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); + } + else if(aVertType == `).concat(_t," || aVertType == ").concat(pa,` + || aVertType == `).concat(sn," || aVertType == ").concat(ga,`) { // simple shapes + + // the bounding box is needed by the fragment shader + vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat + vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat + vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated + + // calculations are done in the fragment shader, just pass these along + vColor = aColor; + vCornerRadius = aCornerRadius; + vBorderColor = aBorderColor; + vBorderWidth = aLineWidth; + + gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); + } + else if(aVertType == `).concat(Kl,`) { + vec2 source = aPointAPointB.xy; + vec2 target = aPointAPointB.zw; + + // adjust the geometry so that the line is centered on the edge + position.y = position.y - 0.5; + + // stretch the unit square into a long skinny rectangle + vec2 xBasis = target - source; + vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x)); + vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y; + + gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0); + vColor = aColor; + } + else if(aVertType == `).concat(Xl,`) { + vec2 pointA = aPointAPointB.xy; + vec2 pointB = aPointAPointB.zw; + vec2 pointC = aPointCPointD.xy; + vec2 pointD = aPointCPointD.zw; + + // adjust the geometry so that the line is centered on the edge + position.y = position.y - 0.5; + + vec2 p0, p1, p2, pos; + if(position.x == 0.0) { // The left side of the unit square + p0 = pointA; + p1 = pointB; + p2 = pointC; + pos = position; + } else { // The right side of the unit square, use same approach but flip the geometry upside down + p0 = pointD; + p1 = pointC; + p2 = pointB; + pos = vec2(0.0, -position.y); + } + + vec2 p01 = p1 - p0; + vec2 p12 = p2 - p1; + vec2 p21 = p1 - p2; + + // Find the normal vector. + vec2 tangent = normalize(normalize(p12) + normalize(p01)); + vec2 normal = vec2(-tangent.y, tangent.x); + + // Find the vector perpendicular to p0 -> p1. + vec2 p01Norm = normalize(vec2(-p01.y, p01.x)); + + // Determine the bend direction. + float sigma = sign(dot(p01 + p21, normal)); + float width = aLineWidth[0]; + + if(sign(pos.y) == -sigma) { + // This is an intersecting vertex. Adjust the position so that there's no overlap. + vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm); + gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0); + } else { + // This is a non-intersecting vertex. Treat it like a mitre join. + vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm); + gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0); + } + + vColor = aColor; + } + else if(aVertType == `).concat(Ts,` && vid < 3) { + // massage the first triangle into an edge arrow + if(vid == 0) + position = vec2(-0.15, -0.3); + if(vid == 1) + position = vec2( 0.0, 0.0); + if(vid == 2) + position = vec2( 0.15, -0.3); + + gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); + vColor = aColor; + } + else { + gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space + } + + vAtlasId = aAtlasId; + vVertType = aVertType; + vIndex = aIndex; + } + `),i=this.batchManager.getIndexArray(),s=`#version 300 es + precision highp float; + + // declare texture unit for each texture atlas in the batch + `.concat(i.map(function(u){return"uniform sampler2D uTexture".concat(u,";")}).join(` + `),` + + uniform vec4 uBGColor; + uniform float uZoom; + + in vec2 vTexCoord; + in vec4 vColor; + in vec2 vPosition; // model coordinates + + flat in int vAtlasId; + flat in vec4 vIndex; + flat in int vVertType; + flat in vec2 vTopRight; + flat in vec2 vBotLeft; + flat in vec4 vCornerRadius; + flat in vec4 vBorderColor; + flat in vec2 vBorderWidth; + + out vec4 outColor; + + `).concat(om,` + `).concat(um,` + `).concat(lm,` + `).concat(vm,` + + vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha + return vec4( + top.rgb + (bot.rgb * (1.0 - top.a)), + top.a + (bot.a * (1.0 - top.a)) + ); + } + + vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance + // scale to the zoom level so that borders don't look blurry when zoomed in + // note 1.5 is an aribitrary value chosen because it looks good + return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); + } + + void main(void) { + if(vVertType == `).concat(Cs,`) { + // look up the texel from the texture unit + `).concat(i.map(function(u){return"if(vAtlasId == ".concat(u,") outColor = texture(uTexture").concat(u,", vTexCoord);")}).join(` + else `),` + } + else if(vVertType == `).concat(Ts,`) { + // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out'; + outColor = blend(vColor, uBGColor); + outColor.a = 1.0; // make opaque, masks out line under arrow + } + else if(vVertType == `).concat(_t,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border + outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done + } + else if(vVertType == `).concat(_t," || vVertType == ").concat(pa,` + || vVertType == `).concat(sn," || vVertType == ").concat(ga,`) { // use SDF + + float outerBorder = vBorderWidth[0]; + float innerBorder = vBorderWidth[1]; + float borderPadding = outerBorder * 2.0; + float w = vTopRight.x - vBotLeft.x - borderPadding; + float h = vTopRight.y - vBotLeft.y - borderPadding; + vec2 b = vec2(w/2.0, h/2.0); // half width, half height + vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center + + float d; // signed distance + if(vVertType == `).concat(_t,`) { + d = rectangleSD(p, b); + } else if(vVertType == `).concat(pa,` && w == h) { + d = circleSD(p, b.x); // faster than ellipse + } else if(vVertType == `).concat(pa,`) { + d = ellipseSD(p, b); + } else { + d = roundRectangleSD(p, b, vCornerRadius.wzyx); + } + + // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling + // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box + if(d > 0.0) { + if(d > outerBorder) { + discard; + } else { + outColor = distInterp(vBorderColor, vec4(0), d - outerBorder); + } + } else { + if(d > innerBorder) { + vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor; + vec4 innerBorderColor = blend(vBorderColor, vColor); + outColor = distInterp(innerBorderColor, outerColor, d); + } + else { + vec4 outerColor; + if(innerBorder == 0.0 && outerBorder == 0.0) { + outerColor = vec4(0); + } else if(innerBorder == 0.0) { + outerColor = vBorderColor; + } else { + outerColor = blend(vBorderColor, vColor); + } + outColor = distInterp(vColor, outerColor, d - innerBorder); + } + } + } + else { + outColor = vColor; + } + + `).concat(t.picking?`if(outColor.a == 0.0) discard; + else outColor = vIndex;`:"",` + } + `),o=Gy(a,n,s);o.aPosition=a.getAttribLocation(o,"aPosition"),o.aIndex=a.getAttribLocation(o,"aIndex"),o.aVertType=a.getAttribLocation(o,"aVertType"),o.aTransform=a.getAttribLocation(o,"aTransform"),o.aAtlasId=a.getAttribLocation(o,"aAtlasId"),o.aTex=a.getAttribLocation(o,"aTex"),o.aPointAPointB=a.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=a.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=a.getAttribLocation(o,"aLineWidth"),o.aColor=a.getAttribLocation(o,"aColor"),o.aCornerRadius=a.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=a.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=a.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=a.getUniformLocation(o,"uAtlasSize"),o.uBGColor=a.getUniformLocation(o,"uBGColor"),o.uZoom=a.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var l=0;l1&&arguments[1]!==void 0?arguments[1]:Ea.SCREEN;this.panZoomMatrix=t,this.renderTarget=a,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(t,a){return t.visible()?a&&a.isVisible?a.isVisible(t):!0:!1}},{key:"drawTexture",value:function(t,a,n){var i=this.atlasManager,s=this.batchManager,o=i.getRenderTypeOpts(n);if(this._isVisible(t,o)&&!(t.isEdge()&&!this._isValidEdge(t))){if(this.renderTarget.picking&&o.getTexPickingMode){var l=o.getTexPickingMode(t);if(l===An.IGNORE)return;if(l==An.USE_BB){this.drawPickingRectangle(t,a,n);return}}var u=i.getAtlasInfo(t,n),v=kr(u),f;try{for(v.s();!(f=v.n()).done;){var c=f.value,h=c.atlas,d=c.tex1,y=c.tex2;s.canAddToCurrentBatch(h)||this.endBatch();for(var g=s.getAtlasIndexForBatch(h),p=0,m=[[d,!0],[y,!1]];p=this.maxInstances&&this.endBatch()}}}}catch(B){v.e(B)}finally{v.f()}}}},{key:"setTransformMatrix",value:function(t,a,n,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(n.shapeProps&&n.shapeProps.padding&&(o=t.pstyle(n.shapeProps.padding).pfValue),i){var l=i.bb,u=i.tex1,v=i.tex2,f=u.w/(u.w+v.w);s||(f=1-f);var c=this._getAdjustedBB(l,o,s,f);this._applyTransformMatrix(a,c,n,t)}else{var h=n.getBoundingBox(t),d=this._getAdjustedBB(h,o,!0,1);this._applyTransformMatrix(a,d,n,t)}}},{key:"_applyTransformMatrix",value:function(t,a,n,i){var s,o;$l(t);var l=n.getRotation?n.getRotation(i):0;if(l!==0){var u=n.getRotationPoint(i),v=u.x,f=u.y;yn(t,t,[v,f]),Ul(t,t,l);var c=n.getRotationOffset(i);s=c.x+(a.xOffset||0),o=c.y+(a.yOffset||0)}else s=a.x1,o=a.y1;yn(t,t,[s,o]),Ws(t,t,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(t,a,n,i){var s=t.x1,o=t.y1,l=t.w,u=t.h,v=t.yOffset;a&&(s-=a,o-=a,l+=2*a,u+=2*a);var f=0,c=l*i;return n&&i<1?l=c:!n&&i<1&&(f=l-c,s+=f,l=c),{x1:s,y1:o,w:l,h:u,xOffset:f,yOffset:v}}},{key:"drawPickingRectangle",value:function(t,a,n){var i=this.atlasManager.getRenderTypeOpts(n),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=_t;var o=this.indexBuffer.getView(s);qt(a,o);var l=this.colorBuffer.getView(s);xt([0,0,0],1,l);var u=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(t,u,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(t,a,n){var i=this.simpleShapeOptions.get(n);if(this._isVisible(t,i)){var s=i.shapeProps,o=this._getVertTypeForShape(t,s.shape);if(o===void 0||i.isSimple&&!i.isSimple(t)){this.drawTexture(t,a,n);return}var l=this.instanceCount;if(this.vertTypeBuffer.getView(l)[0]=o,o===sn||o===ga){var u=i.getBoundingBox(t),v=this._getCornerRadius(t,s.radius,u),f=this.cornerRadiusBuffer.getView(l);f[0]=v,f[1]=v,f[2]=v,f[3]=v,o===ga&&(f[0]=0,f[2]=0)}var c=this.indexBuffer.getView(l);qt(a,c);var h=t.pstyle(s.color).value,d=t.pstyle(s.opacity).value,y=this.colorBuffer.getView(l);xt(h,d,y);var g=this.lineWidthBuffer.getView(l);if(g[0]=0,g[1]=0,s.border){var p=t.pstyle("border-width").value;if(p>0){var m=t.pstyle("border-color").value,b=t.pstyle("border-opacity").value,w=this.borderColorBuffer.getView(l);xt(m,b,w);var E=t.pstyle("border-position").value;if(E==="inside")g[0]=0,g[1]=-p;else if(E==="outside")g[0]=p,g[1]=0;else{var C=p/2;g[0]=C,g[1]=-C}}}var x=this.transformBuffer.getMatrixView(l);this.setTransformMatrix(t,x,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(t,a){var n=t.pstyle(a).value;switch(n){case"rectangle":return _t;case"ellipse":return pa;case"roundrectangle":case"round-rectangle":return sn;case"bottom-round-rectangle":return ga;default:return}}},{key:"_getCornerRadius",value:function(t,a,n){var i=n.w,s=n.h;if(t.pstyle(a).value==="auto")return vt(i,s);var o=t.pstyle(a).pfValue,l=i/2,u=s/2;return Math.min(o,u,l)}},{key:"drawEdgeArrow",value:function(t,a,n){if(t.visible()){var i=t._private.rscratch,s,o,l;if(n==="source"?(s=i.arrowStartX,o=i.arrowStartY,l=i.srcArrowAngle):(s=i.arrowEndX,o=i.arrowEndY,l=i.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(o)||o==null||isNaN(l)||l==null)){var u=t.pstyle(n+"-arrow-shape").value;if(u!=="none"){var v=t.pstyle(n+"-arrow-color").value,f=t.pstyle("opacity").value,c=t.pstyle("line-opacity").value,h=f*c,d=t.pstyle("width").pfValue,y=t.pstyle("arrow-scale").value,g=this.r.getArrowWidth(d,y),p=this.instanceCount,m=this.transformBuffer.getMatrixView(p);$l(m),yn(m,m,[s,o]),Ws(m,m,[g,g]),Ul(m,m,l),this.vertTypeBuffer.getView(p)[0]=Ts;var b=this.indexBuffer.getView(p);qt(a,b);var w=this.colorBuffer.getView(p);xt(v,h,w),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(t,a){if(t.visible()){var n=this._getEdgePoints(t);if(n){var i=t.pstyle("opacity").value,s=t.pstyle("line-opacity").value,o=t.pstyle("width").pfValue,l=t.pstyle("line-color").value,u=i*s;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=Kl;var f=this.indexBuffer.getView(v);qt(a,f);var c=this.colorBuffer.getView(v);xt(l,u,c);var h=this.lineWidthBuffer.getView(v);h[0]=o;var d=this.pointAPointBBuffer.getView(v);d[0]=n[0],d[1]=n[1],d[2]=n[2],d[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var y=0;y=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(t){var a=t._private.rscratch;return!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))}},{key:"_getEdgePoints",value:function(t){var a=t._private.rscratch;if(this._isValidEdge(t)){var n=a.allpts;if(n.length==4)return n;var i=this._getNumSegments(t);return this._getCurveSegmentPoints(n,i)}}},{key:"_getNumSegments",value:function(t){var a=15;return Math.min(Math.max(a,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(t,a){if(t.length==4)return t;for(var n=Array((a+1)*2),i=0;i<=a;i++)if(i==0)n[0]=t[0],n[1]=t[1];else if(i==a)n[i*2]=t[t.length-2],n[i*2+1]=t[t.length-1];else{var s=i/a;this._setCurvePoint(t,s,n,i*2)}return n}},{key:"_setCurvePoint",value:function(t,a,n,i){if(t.length<=2)n[i]=t[0],n[i+1]=t[1];else{for(var s=Array(t.length-2),o=0;o0}},o=function(f){var c=f.pstyle("text-events").strValue==="yes";return c?An.USE_BB:An.IGNORE},l=function(f){var c=f.position(),h=c.x,d=c.y,y=f.outerWidth(),g=f.outerHeight();return{w:y,h:g,x1:h-y/2,y1:d-g/2}};t.drawing.addAtlasCollection("node",{texRows:r.webglTexRowsNodes}),t.drawing.addAtlasCollection("label",{texRows:r.webglTexRows}),t.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),t.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:l,isSimple:Uy,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),t.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:l,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),t.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:l,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),t.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:o,getKey:Ss(e.getLabelKey,null),getBoundingBox:ks(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:n(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),t.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:Ss(e.getSourceLabelKey,"source"),getBoundingBox:ks(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:n("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),t.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:Ss(e.getTargetLabelKey,"target"),getBoundingBox:ks(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:n("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var u=Fa(function(){console.log("garbage collect flag set"),t.data.gc=!0},1e4);t.onUpdateEleCalcs(function(v,f){var c=!1;f&&f.length>0&&(c|=t.drawing.invalidate(f)),c&&u()}),dm(t)};function cm(r){var e=r.cy.container(),t=e&&e.style&&e.style.backgroundColor||"white";return iv(t)}function Lf(r,e){var t=r._private.rscratch;return Tr(t,"labelWrapCachedLines",e)||[]}var Ss=function(e,t){return function(a){var n=e(a),i=Lf(a,t);return i.length>1?i.map(function(s,o){return"".concat(n,"_").concat(o)}):n}},ks=function(e,t){return function(a,n){var i=e(a);if(typeof n=="string"){var s=n.indexOf("_");if(s>0){var o=Number(n.substring(s+1)),l=Lf(a,t),u=i.h/l.length,v=u*o,f=i.y1+v;return{x1:i.x1,w:i.w,y1:f,h:u,yOffset:v}}}return i}};function dm(r){{var e=r.render;r.render=function(i){i=i||{};var s=r.cy;r.webgl&&(s.zoom()>Sf?(hm(r),e.call(r,i)):(gm(r),Of(r,i,Ea.SCREEN)))}}{var t=r.matchCanvasSize;r.matchCanvasSize=function(i){t.call(r,i),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0}}r.findNearestElements=function(i,s,o,l){return xm(r,i,s)};{var a=r.invalidateCachedZSortedEles;r.invalidateCachedZSortedEles=function(){a.call(r),r.pickingFrameBuffer.needsDraw=!0}}{var n=r.notify;r.notify=function(i,s){n.call(r,i,s),i==="viewport"||i==="bounds"?r.pickingFrameBuffer.needsDraw=!0:i==="background"&&r.drawing.invalidate(s,{type:"node-body"})}}}function hm(r){var e=r.data.contexts[r.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function gm(r){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,r.canvasWidth,r.canvasHeight),a.restore()};e(r.data.contexts[r.NODE]),e(r.data.contexts[r.DRAG])}function pm(r){var e=r.canvasWidth,t=r.canvasHeight,a=bo(r),n=a.pan,i=a.zoom,s=Es();yn(s,s,[n.x,n.y]),Ws(s,s,[i,i]);var o=Es();rm(o,e,t);var l=Es();return em(l,o,s),l}function If(r,e){var t=r.canvasWidth,a=r.canvasHeight,n=bo(r),i=n.pan,s=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t,a),e.translate(i.x,i.y),e.scale(s,s)}function ym(r,e){r.drawSelectionRectangle(e,function(t){return If(r,t)})}function mm(r){var e=r.data.contexts[r.NODE];e.save(),If(r,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function bm(r){var e=function(n,i,s){for(var o=n.atlasManager.getAtlasCollection(i),l=r.data.contexts[r.NODE],u=o.atlases,v=0;v=0&&w.add(x)}return w}function xm(r,e,t){var a=wm(r,e,t),n=r.getCachedZSortedEles(),i,s,o=kr(a),l;try{for(o.s();!(l=o.n()).done;){var u=l.value,v=n[u];if(!i&&v.isNode()&&(i=v),!s&&v.isEdge()&&(s=v),i&&s)break}}catch(f){o.e(f)}finally{o.f()}return[i,s].filter(Boolean)}function Ds(r,e,t){var a=r.drawing;e+=1,t.isNode()?(a.drawNode(t,e,"node-underlay"),a.drawNode(t,e,"node-body"),a.drawTexture(t,e,"label"),a.drawNode(t,e,"node-overlay")):(a.drawEdgeLine(t,e),a.drawEdgeArrow(t,e,"source"),a.drawEdgeArrow(t,e,"target"),a.drawTexture(t,e,"label"),a.drawTexture(t,e,"edge-source-label"),a.drawTexture(t,e,"edge-target-label"))}function Of(r,e,t){var a;r.webglDebug&&(a=performance.now());var n=r.drawing,i=0;if(t.screen&&r.data.canvasNeedsRedraw[r.SELECT_BOX]&&ym(r,e),r.data.canvasNeedsRedraw[r.NODE]||t.picking){var s=r.data.contexts[r.WEBGL];t.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var o=pm(r),l=r.getCachedZSortedEles();if(i=l.length,n.startFrame(o,t),t.screen){for(var u=0;u0&&s>0){h.clearRect(0,0,i,s),h.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(r.full)h.translate(-a.x1*u,-a.y1*u),h.scale(u,u),this.drawElements(h,d),h.scale(1/u,1/u),h.translate(a.x1*u,a.y1*u);else{var y=e.pan(),g={x:y.x*u,y:y.y*u};u*=e.zoom(),h.translate(g.x,g.y),h.scale(u,u),this.drawElements(h,d),h.scale(1/u,1/u),h.translate(-g.x,-g.y)}r.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=r.bg,h.rect(0,0,i,s),h.fill())}return c};function Em(r,e){for(var t=atob(r),a=new ArrayBuffer(t.length),n=new Uint8Array(a),i=0;i"u"?"undefined":ar(OffscreenCanvas))!=="undefined")t=new OffscreenCanvas(r,e);else{var a=this.cy.window(),n=a.document;t=n.createElement("canvas"),t.width=r,t.height=e}return t};[Df,Hr,Jr,mo,Lt,yt,xr,Mf,mt,Wa,Ff].forEach(function(r){be(ke,r)});var Sm=[{name:"null",impl:df},{name:"base",impl:Cf},{name:"canvas",impl:Cm}],km=[{type:"layout",extensions:Qp},{type:"renderer",extensions:Sm}],qf={},_f={};function Gf(r,e,t){var a=t,n=function(T){Ve("Can not register `"+e+"` for `"+r+"` since `"+T+"` already exists in the prototype and can not be overridden")};if(r==="core"){if(Ra.prototype[e])return n(e);Ra.prototype[e]=t}else if(r==="collection"){if(fr.prototype[e])return n(e);fr.prototype[e]=t}else if(r==="layout"){for(var i=function(T){this.options=T,t.call(this,T),Le(this._private)||(this._private={}),this._private.cy=T.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(t.prototype),o=[],l=0;l{X.clear(),J.clear(),d.clear()},"clear"),D=w((e,t)=>{const n=X.get(t)||[];return i.trace("In isDescendant",t," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),se=w((e,t)=>{const n=X.get(t)||[];return i.info("Descendants of ",t," is ",n),i.info("Edge is ",e),e.v===t||e.w===t?!1:n?n.includes(e.v)||D(e.v,t)||D(e.w,t)||n.includes(e.w):(i.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),G=w((e,t,n,a)=>{i.warn("Copying children of ",e,"root",a,"data",t.node(e),a);const r=t.children(e)||[];e!==a&&r.push(e),i.warn("Copying (nodes) clusterId",e,"nodes",r),r.forEach(o=>{if(t.children(o).length>0)G(o,t,n,a);else{const l=t.node(o);i.info("cp ",o," to ",a," with parent ",e),n.setNode(o,l),a!==t.parent(o)&&(i.warn("Setting parent",o,t.parent(o)),n.setParent(o,t.parent(o))),e!==a&&o!==e?(i.debug("Setting parent",o,e),n.setParent(o,e)):(i.info("In copy ",e,"root",a,"data",t.node(e),a),i.debug("Not Setting parent for node=",o,"cluster!==rootId",e!==a,"node!==clusterId",o!==e));const u=t.edges(o);i.debug("Copying Edges",u),u.forEach(c=>{i.info("Edge",c);const m=t.edge(c.v,c.w,c.name);i.info("Edge data",m,a);try{se(c,a)?(i.info("Copying as ",c.v,c.w,m,c.name),n.setEdge(c.v,c.w,m,c.name),i.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):i.info("Skipping copy of edge ",c.v,"-->",c.w," rootId: ",a," clusterId:",e)}catch(v){i.error(v)}})}i.debug("Removing node",o),t.removeNode(o)})},"copy"),R=w((e,t)=>{const n=t.children(e);let a=[...n];for(const r of n)J.set(r,e),a=[...a,...R(r,t)];return a},"extractDescendants"),ie=w((e,t,n)=>{const a=e.edges().filter(c=>c.v===t||c.w===t),r=e.edges().filter(c=>c.v===n||c.w===n),o=a.map(c=>({v:c.v===t?n:c.v,w:c.w===t?t:c.w})),l=r.map(c=>({v:c.v,w:c.w}));return o.filter(c=>l.some(m=>c.v===m.v&&c.w===m.w))},"findCommonEdges"),C=w((e,t,n)=>{const a=t.children(e);if(i.trace("Searching children of id ",e,a),a.length<1)return e;let r;for(const o of a){const l=C(o,t,n),u=ie(t,n,l);if(l)if(u.length>0)r=l;else return l}return r},"findNonClusterChild"),k=w(e=>!d.has(e)||!d.get(e).externalConnections?e:d.has(e)?d.get(e).id:e,"getAnchorId"),re=w((e,t)=>{if(!e||t>10){i.debug("Opting out, no graph ");return}else i.debug("Opting in, graph ");e.nodes().forEach(function(n){e.children(n).length>0&&(i.warn("Cluster identified",n," Replacement id in edges: ",C(n,e,n)),X.set(n,R(n,e)),d.set(n,{id:C(n,e,n),clusterData:e.node(n)}))}),e.nodes().forEach(function(n){const a=e.children(n),r=e.edges();a.length>0?(i.debug("Cluster identified",n,X),r.forEach(o=>{const l=D(o.v,n),u=D(o.w,n);l^u&&(i.warn("Edge: ",o," leaves cluster ",n),i.warn("Descendants of XXX ",n,": ",X.get(n)),d.get(n).externalConnections=!0)})):i.debug("Not a cluster ",n,X)});for(let n of d.keys()){const a=d.get(n).id,r=e.parent(a);r!==n&&d.has(r)&&!d.get(r).externalConnections&&(d.get(n).id=r)}e.edges().forEach(function(n){const a=e.edge(n);i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let r=n.v,o=n.w;if(i.warn("Fix XXX",d,"ids:",n.v,n.w,"Translating: ",d.get(n.v)," --- ",d.get(n.w)),d.get(n.v)||d.get(n.w)){if(i.warn("Fixing and trying - removing XXX",n.v,n.w,n.name),r=k(n.v),o=k(n.w),e.removeEdge(n.v,n.w,n.name),r!==n.v){const l=e.parent(r);d.get(l).externalConnections=!0,a.fromCluster=n.v}if(o!==n.w){const l=e.parent(o);d.get(l).externalConnections=!0,a.toCluster=n.w}i.warn("Fix Replacing with XXX",r,o,n.name),e.setEdge(r,o,a,n.name)}}),i.warn("Adjusted Graph",h(e)),T(e,0),i.trace(d)},"adjustClustersAndEdges"),T=w((e,t)=>{if(i.warn("extractor - ",t,h(e),e.children("D")),t>10){i.error("Bailing out");return}let n=e.nodes(),a=!1;for(const r of n){const o=e.children(r);a=a||o.length>0}if(!a){i.debug("Done, no node has children",e.nodes());return}i.debug("Nodes = ",n,t);for(const r of n)if(i.debug("Extracting node",r,d,d.has(r)&&!d.get(r).externalConnections,!e.parent(r),e.node(r),e.children("D")," Depth ",t),!d.has(r))i.debug("Not a cluster",r,t);else if(!d.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){i.warn("Cluster without external connections, without a parent and with children",r,t);let l=e.graph().rankdir==="TB"?"LR":"TB";d.get(r)?.clusterData?.dir&&(l=d.get(r).clusterData.dir,i.warn("Fixing dir",d.get(r).clusterData.dir,l));const u=new B({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});i.warn("Old graph before copy",h(e)),G(r,e,u,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:d.get(r).clusterData,label:d.get(r).label,graph:u}),i.warn("New graph after copy node: (",r,")",h(u)),i.debug("Old graph after copy",h(e))}else i.warn("Cluster ** ",r," **not meeting the criteria !externalConnections:",!d.get(r).externalConnections," no parent: ",!e.parent(r)," children ",e.children(r)&&e.children(r).length>0,e.children("D"),t),i.debug(d);n=e.nodes(),i.warn("New list of nodes",n);for(const r of n){const o=e.node(r);i.warn(" Now next level",r,o),o?.clusterNode&&T(o.graph,t+1)}},"extractor"),M=w((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(a=>{const r=e.children(a),o=M(e,r);n=[...n,...o]}),n},"sorter"),oe=w(e=>M(e,e.children()),"sortNodesByHierarchy"),j=w(async(e,t,n,a,r,o)=>{i.warn("Graph in recursive render:XAX",h(t),r);const l=t.graph().rankdir;i.trace("Dir in recursive render - dir:",l);const u=e.insert("g").attr("class","root");t.nodes()?i.info("Recursive render XXX",t.nodes()):i.info("No nodes found for",t),t.edges().length>0&&i.info("Recursive edges",t.edge(t.edges()[0]));const c=u.insert("g").attr("class","clusters"),m=u.insert("g").attr("class","edgePaths"),v=u.insert("g").attr("class","edgeLabels"),p=u.insert("g").attr("class","nodes");await Promise.all(t.nodes().map(async function(f){const s=t.node(f);if(r!==void 0){const g=JSON.parse(JSON.stringify(r.clusterData));i.trace(`Setting data for parent cluster XXX + Node.id = `,f,` + data=`,g.height,` +Parent cluster`,r.height),t.setNode(r.id,g),t.parent(f)||(i.trace("Setting parent",f,r.id),t.setParent(f,r.id,g))}if(i.info("(Insert) Node XXX"+f+": "+JSON.stringify(t.node(f))),s?.clusterNode){i.info("Cluster identified XBX",f,s.width,t.node(f));const{ranksep:g,nodesep:E}=t.graph();s.graph.setGraph({...s.graph.graph(),ranksep:g+25,nodesep:E});const N=await j(p,s.graph,n,a,t.node(f),o),x=N.elem;$(s,x),s.diff=N.diff||0,i.info("New compound node after recursive render XAX",f,"width",s.width,"height",s.height),U(x,s)}else t.children(f).length>0?(i.trace("Cluster - the non recursive path XBX",f,s.id,s,s.width,"Graph:",t),i.trace(C(s.id,t)),d.set(s.id,{id:C(s.id,t),node:s})):(i.trace("Node - the non recursive path XAX",f,p,t.node(f),l),await q(p,t.node(f),{config:o,dir:l}))})),await w(async()=>{const f=t.edges().map(async function(s){const g=t.edge(s.v,s.w,s.name);i.info("Edge "+s.v+" -> "+s.w+": "+JSON.stringify(s)),i.info("Edge "+s.v+" -> "+s.w+": ",s," ",JSON.stringify(t.edge(s))),i.info("Fix",d,"ids:",s.v,s.w,"Translating: ",d.get(s.v),d.get(s.w)),await Z(v,g)});await Promise.all(f)},"processEdges")(),i.info("Graph before layout:",JSON.stringify(h(t))),i.info("############################################# XXX"),i.info("### Layout ### XXX"),i.info("############################################# XXX"),I(t),i.info("Graph after layout:",JSON.stringify(h(t)));let O=0,{subGraphTitleTotalMargin:S}=z(o);return await Promise.all(oe(t).map(async function(f){const s=t.node(f);if(i.info("Position XBX => "+f+": ("+s.x,","+s.y,") width: ",s.width," height: ",s.height),s?.clusterNode)s.y+=S,i.info("A tainted cluster node XBX1",f,s.id,s.width,s.height,s.x,s.y,t.parent(f)),d.get(s.id).node=s,P(s);else if(t.children(f).length>0){i.info("A pure cluster node XBX1",f,s.id,s.x,s.y,s.width,s.height,t.parent(f)),s.height+=S,t.node(s.parentId);const g=s?.padding/2||0,E=s?.labelBBox?.height||0,N=E-g||0;i.debug("OffsetY",N,"labelHeight",E,"halfPadding",g),await K(c,s),d.get(s.id).node=s}else{const g=t.node(s.parentId);s.y+=S/2,i.info("A regular node XBX1 - using the padding",s.id,"parent",s.parentId,s.width,s.height,s.x,s.y,"offsetY",s.offsetY,"parent",g,g?.offsetY,s),P(s)}})),t.edges().forEach(function(f){const s=t.edge(f);i.info("Edge "+f.v+" -> "+f.w+": "+JSON.stringify(s),s),s.points.forEach(x=>x.y+=S/2);const g=t.node(f.v);var E=t.node(f.w);const N=Q(m,s,d,n,g,E,a);W(s,N)}),t.nodes().forEach(function(f){const s=t.node(f);i.info(f,s.type,s.diff),s.isGroup&&(O=s.diff)}),i.warn("Returning from recursive render XAX",u,O),{elem:u,diff:O}},"recursiveRender"),pe=w(async(e,t)=>{const n=new B({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),a=t.select("g");F(a,e.markers,e.type,e.diagramId),Y(),_(),H(),te(),e.nodes.forEach(o=>{n.setNode(o.id,{...o}),o.parentId&&n.setParent(o.id,o.parentId)}),i.debug("Edges:",e.edges),e.edges.forEach(o=>{if(o.start===o.end){const l=o.start,u=l+"---"+l+"---1",c=l+"---"+l+"---2",m=n.node(l);n.setNode(u,{domId:u,id:u,parentId:m.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),n.setParent(u,m.parentId),n.setNode(c,{domId:c,id:c,parentId:m.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),n.setParent(c,m.parentId);const v=structuredClone(o),p=structuredClone(o),y=structuredClone(o);v.label="",v.arrowTypeEnd="none",v.id=l+"-cyclic-special-1",p.arrowTypeStart="none",p.arrowTypeEnd="none",p.id=l+"-cyclic-special-mid",y.label="",m.isGroup&&(v.fromCluster=l,y.toCluster=l),y.id=l+"-cyclic-special-2",y.arrowTypeStart="none",n.setEdge(l,u,v,l+"-cyclic-special-0"),n.setEdge(u,c,p,l+"-cyclic-special-1"),n.setEdge(c,l,y,l+"-cyc>8&255,_>>16&255,_>>24&255)}const S=E("DXT1"),v=E("DXT3"),tt=E("DXT5"),z=E("DX10"),rt=113,et=116,at=2,ft=10,Ft=88,W=31,pt=0,Ct=1,st=2,ot=3,T=4,nt=7,j=20,ct=21,Gt=22,Bt=23,bt=24,mt=25,Rt=26,_t=28,ht=32;class A{static GetDDSInfo(a){const o=new Int32Array(a.buffer,a.byteOffset,W),s=new Int32Array(a.buffer,a.byteOffset,W+4);let n=1;o[st]&Q&&(n=Math.max(1,o[nt]));const u=o[ct],F=u===z?s[ht]:0;let r=0;switch(u){case rt:r=2;break;case et:r=1;break;case z:if(F===ft){r=2;break}if(F===at){r=1;break}}return{width:o[T],height:o[ot],mipmapCount:n,isFourCC:(o[j]&Y)===Y,isRGB:(o[j]&Z)===Z,isLuminance:(o[j]&$)===$,isCube:(o[_t]&V)===V,isCompressed:u===S||u===v||u===tt,dxgiFormat:F,textureType:r}}static _GetHalfFloatAsFloatRGBAArrayBuffer(a,o,s,n,u,F){const r=new Float32Array(n),c=new Uint16Array(u,s);let t=0;for(let e=0;e>8)}static _GetRGBArrayBuffer(a,o,s,n,u,F,r,c){const t=new Uint8Array(n),e=new Uint8Array(u,s);let l=0;for(let f=0;f0?n.sphericalPolynomial=it.ConvertCubeMapToSphericalPolynomial({size:f[T],right:e[0],left:e[1],up:e[2],down:e[3],front:e[4],back:e[5],format:5,type:1,gammaSpace:!1}):n.sphericalPolynomial=void 0}}A.StoreLODInAlphaChannel=!1;export{A as DDSTools}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ddsTextureLoader-HyrebNeu.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ddsTextureLoader-HyrebNeu.js new file mode 100644 index 0000000000000000000000000000000000000000..4dc55957b719a56903febe7a9e626c57dbec2f8b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ddsTextureLoader-HyrebNeu.js @@ -0,0 +1 @@ +import{ay as t}from"./index-CDrXokXW.js";import{DDSTools as n}from"./dds-DwCXTB3r.js";import"./index-DWyDLubb.js";import"./abstractEngine.cubeTexture-BasnejWx.js";class M{constructor(){this.supportCascades=!0}loadCubeData(e,i,m,o){const p=i.getEngine();let a,l=!1,d=1e3;if(Array.isArray(e))for(let s=0;s1)&&i.generateMipMaps,p._unpackFlipY(a.isCompressed),n.UploadDDSLevels(p,i,h,a,l,6,-1,s),!a.isFourCC&&a.mipmapCount===1?p.generateMipMapsForCubemap(i):d=a.mipmapCount-1}else{const s=e;a=n.GetDDSInfo(s),i.width=a.width,i.height=a.height,m&&(a.sphericalPolynomial=new t),l=(a.isRGB||a.isLuminance||a.mipmapCount>1)&&i.generateMipMaps,p._unpackFlipY(a.isCompressed),n.UploadDDSLevels(p,i,s,a,l,6),!a.isFourCC&&a.mipmapCount===1?p.generateMipMapsForCubemap(i,!1):d=a.mipmapCount-1}p._setCubeMapTextureParams(i,l,d),i.isReady=!0,i.onLoadedObservable.notifyObservers(i),i.onLoadedObservable.clear(),o&&o({isDDS:!0,width:i.width,info:a,data:e,texture:i})}loadData(e,i,m){const o=n.GetDDSInfo(e),p=(o.isRGB||o.isLuminance||o.mipmapCount>1)&&i.generateMipMaps&&Math.max(o.width,o.height)>>o.mipmapCount-1===1;m(o.width,o.height,p,o.isFourCC,()=>{n.UploadDDSLevels(i.getEngine(),i,e,o,p,1)})}}export{M as _DDSTextureLoader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/de-BczWVYc-.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/de-BczWVYc-.js new file mode 100644 index 0000000000000000000000000000000000000000..c269b59776cf1d7a9bac7229eb8350c758f6b255 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/de-BczWVYc-.js @@ -0,0 +1 @@ +const e="Deutsch",n={annotated_image:"Annotiertes Bild"},i={allow_recording_access:"Bitte erlauben Sie den Zugriff auf das Mikrofon für die Aufnahme.",audio:"Audio",record_from_microphone:"Vom Mikrofon aufnehmen",stop_recording:"Aufnahme stoppen",no_device_support:"Auf Mediengeräte konnte nicht zugegriffen werden. Stellen Sie sicher, dass Sie sich auf einer sicheren Quelle (https) oder localhost befinden (oder ein gültiges SSL-Zertifikat an ssl_verify übergeben haben) und Sie dem Browser den Zugriff auf Ihr Gerät erlaubt haben.",stop:"Stopp",resume:"Fortsetzen",record:"Aufnehmen",no_microphone:"Kein Mikrofon gefunden",pause:"Pause",play:"Abspielen",waiting:"Warten",drop_to_upload:"Laden Sie eine Audiodatei hier ab, um sie hochzuladen."},r={connection_can_break:"Auf Mobilgeräten kann die Verbindung unterbrochen werden, wenn dieser Tab den Fokus verliert oder das Gerät in den Ruhezustand geht, wodurch Ihre Position in der Warteschlange verloren geht.",long_requests_queue:"Es gibt eine lange Warteschlange ausstehender Anfragen. Duplizieren Sie diesen Space zum Überspringen.",lost_connection:"Verbindung durch Verlassen der Seite verloren. Kehre zur Warteschlange zurück...",waiting_for_inputs:"Warten auf das Hochladen der Datei(en), bitte versuchen Sie es erneut."},o={checkbox:"Kontrollkästchen",checkbox_group:"Kontrollkästchengruppe"},t={code:"Code"},a={color_picker:"Farbwähler"},d={built_with:"erstellt mit",built_with_gradio:"Mit Gradio erstellt",clear:"Löschen",download:"Herunterladen",edit:"Bearbeiten",empty:"Leer",error:"Fehler",hosted_on:"Gehostet auf",loading:"Laden",logo:"Logo",or:"oder",remove:"Entfernen",settings:"Einstellungen",share:"Teilen",submit:"Absenden",undo:"Rückgängig",no_devices:"Keine Geräte gefunden",language:"Sprache",display_theme:"Anzeigedesign",pwa:"Progressive Web App"},l={incorrect_format:"Falsches Format, nur CSV- und TSV-Dateien werden unterstützt",new_column:"Spalte hinzufügen",new_row:"Neue Zeile",add_row_above:"Zeile oben hinzufügen",add_row_below:"Zeile unten hinzufügen",add_column_left:"Spalte links hinzufügen",add_column_right:"Spalte rechts hinzufügen",delete_row:"Zeile löschen",delete_column:"Spalte löschen",sort_column:"Spalte sortieren",sort_ascending:"Aufsteigend sortieren",sort_descending:"Absteigend sortieren",drop_to_upload:"CSV- oder TSV-Dateien hier ablegen, um Daten in den DataFrame zu importieren.",clear_sort:"Sortierung aufheben"},s={dropdown:"Dropdown-Menü"},c={build_error:"Es gibt einen Build-Fehler",config_error:"Es gibt einen Konfigurationsfehler",contact_page_author:"Bitte kontaktieren Sie den Autor der Seite.",no_app_file:"Es gibt keine App-Datei",runtime_error:"Es gibt einen Laufzeitfehler",space_not_working:'"Space funktioniert nicht, weil" {0}',space_paused:"Der Space ist pausiert",use_via_api:"Über API verwenden"},u={uploading:"Hochladen..."},h={highlighted_text:"Hervorgehobener Text"},g={allow_webcam_access:"Bitte erlauben Sie den Zugriff auf die Webcam für die Aufnahme.",brush_color:"Pinselfarbe",brush_radius:"Pinselgröße",image:"Bild",remove_image:"Bild entfernen",select_brush_color:"Pinselfarbe auswählen",start_drawing:"Zeichnen beginnen",use_brush:"Pinsel verwenden",drop_to_upload:"Laden Sie ein Bild hier ab, um es hochzuladen."},_={label:"Beschriftung"},p={enable_cookies:"Wenn Sie einen HuggingFace Space im Inkognito-Modus besuchen, müssen Sie Cookies von Drittanbietern aktivieren.",incorrect_credentials:"Falsche Anmeldedaten",username:"Benutzername",password:"Passwort",login:"Anmelden"},b={number:"Zahl"},f={plot:"Diagramm"},m={radio:"Optionsfeld"},S={slider:"Schieberegler"},w={click_to_upload:"Hochladen",drop_audio:"Audio hier ablegen",drop_csv:"CSV Datei hier ablegen",drop_file:"Datei hier ablegen",drop_image:"Bild hier ablegen",drop_video:"Video hier ablegen",drop_gallery:"Medien hier ablegen",paste_clipboard:"Aus Zwischenablage einfügen"},k={drop_to_upload:"Laden Sie eine Video-Datei hier ab, um sie hochzuladen."},A={edit:"Bearbeiten",retry:"Wiederholen",undo:"Rückgängig",submit:"Senden",cancel:"Abbrechen",like:"Gefällt mir",dislike:"Gefällt mir nicht",clear:"Chat leeren"},z={_name:e,"3D_model":{"3d_model":"3D-Modell",drop_to_upload:"Laden Sie eine 3D-Modell-Datei (.obj, .glb, .stl, .gltf, .splat oder .ply) hier ab, um sie hochzuladen."},annotated_image:n,audio:i,blocks:r,checkbox:o,code:t,color_picker:a,common:d,dataframe:l,dropdown:s,errors:c,file:u,highlighted_text:h,image:g,label:_,login:p,number:b,plot:f,radio:m,slider:S,upload_text:w,video:k,chatbot:A};export{e as _name,n as annotated_image,i as audio,r as blocks,A as chatbot,o as checkbox,t as code,a as color_picker,d as common,l as dataframe,z as default,s as dropdown,c as errors,u as file,h as highlighted_text,g as image,_ as label,p as login,b as number,f as plot,m as radio,S as slider,w as upload_text,k as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/decalFragment-BXuRa219.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/decalFragment-BXuRa219.js new file mode 100644 index 0000000000000000000000000000000000000000..46562d7071072e7055f780a16d5147b26a084b7a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/decalFragment-BXuRa219.js @@ -0,0 +1,10 @@ +import{S as e}from"./index-CDrXokXW.js";const r="decalFragment",o=`#ifdef DECAL +#ifdef GAMMADECAL +decalColor.rgb=toLinearSpace(decalColor.rgb); +#endif +#ifdef DECAL_SMOOTHALPHA +decalColor.a*=decalColor.a; +#endif +surfaceAlbedo.rgb=mix(surfaceAlbedo.rgb,decalColor.rgb,decalColor.a); +#endif +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=o); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/decalFragment-iGkmQ-pm.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/decalFragment-iGkmQ-pm.js new file mode 100644 index 0000000000000000000000000000000000000000..8f7480e6df0312cb2015ca9e0f166f92c3d1195c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/decalFragment-iGkmQ-pm.js @@ -0,0 +1,11 @@ +import{S as e}from"./index-CDrXokXW.js";const a="decalFragment",l=`#ifdef DECAL +var decalTempColor=decalColor.rgb;var decalTempAlpha=decalColor.a; +#ifdef GAMMADECAL +decalTempColor=toLinearSpaceVec3(decalColor.rgb); +#endif +#ifdef DECAL_SMOOTHALPHA +decalTempAlpha=decalColor.a*decalColor.a; +#endif +surfaceAlbedo=mix(surfaceAlbedo.rgb,decalTempColor,decalTempAlpha); +#endif +`;e.IncludesShadersStoreWGSL[a]||(e.IncludesShadersStoreWGSL[a]=l); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/declarationMapper-Lanf6XPr.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/declarationMapper-Lanf6XPr.js new file mode 100644 index 0000000000000000000000000000000000000000..4128ca239c8fa341095cb5511908f7d69d0f452c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/declarationMapper-Lanf6XPr.js @@ -0,0 +1 @@ +import{R as S,ah as I,V,ao as k,M as D,ai as q,b9 as L,C as Q,L as m}from"./index-CDrXokXW.js";class p{constructor(e){this.value=this._toInt(e)}_toInt(e){return e|0}add(e){return new p(this.value+e.value)}subtract(e){return new p(this.value-e.value)}multiply(e){return new p(Math.imul(this.value,e.value))}divide(e){return new p(this.value/e.value)}getClassName(){return p.ClassName}equals(e){return this.value===e.value}static FromValue(e){return new p(e)}toString(){return this.value.toString()}}p.ClassName="FlowGraphInteger";S("FlowGraphInteger",p);class h{constructor(e=[1,0,0,1]){this._m=e}get m(){return this._m}transformVector(e){return this.transformVectorToRef(e,new I)}transformVectorToRef(e,n){return n.x=e.x*this._m[0]+e.y*this._m[1],n.y=e.x*this._m[2]+e.y*this._m[3],n}asArray(){return this.toArray()}toArray(e=[]){for(let n=0;n<4;n++)e[n]=this._m[n];return e}fromArray(e){for(let n=0;n<4;n++)this._m[n]=e[n];return this}multiplyToRef(e,n){const o=e._m,t=this._m,a=n._m;return a[0]=o[0]*t[0]+o[1]*t[2],a[1]=o[0]*t[1]+o[1]*t[3],a[2]=o[2]*t[0]+o[3]*t[2],a[3]=o[2]*t[1]+o[3]*t[3],n}multiply(e){return this.multiplyToRef(e,new h)}divideToRef(e,n){const o=this._m,t=e._m,a=n._m;return a[0]=o[0]/t[0],a[1]=o[1]/t[1],a[2]=o[2]/t[2],a[3]=o[3]/t[3],n}divide(e){return this.divideToRef(e,new h)}addToRef(e,n){const o=this._m,t=e.m,a=n.m;return a[0]=o[0]+t[0],a[1]=o[1]+t[1],a[2]=o[2]+t[2],a[3]=o[3]+t[3],n}add(e){return this.addToRef(e,new h)}subtractToRef(e,n){const o=this._m,t=e.m,a=n.m;return a[0]=o[0]-t[0],a[1]=o[1]-t[1],a[2]=o[2]-t[2],a[3]=o[3]-t[3],n}subtract(e){return this.subtractToRef(e,new h)}transpose(){const e=this._m;return new h([e[0],e[2],e[1],e[3]])}determinant(){const e=this._m;return e[0]*e[3]-e[1]*e[2]}inverse(){const e=this.determinant();if(e===0)throw new Error("Matrix is not invertible");const n=this._m,o=1/e;return new h([n[3]*o,-n[1]*o,-n[2]*o,n[0]*o])}equals(e,n=0){const o=this._m,t=e.m;return n===0?o[0]===t[0]&&o[1]===t[1]&&o[2]===t[2]&&o[3]===t[3]:Math.abs(o[0]-t[0]){if(r.getClassName){if(r.getClassName()==="Vector4")return k.FromArray(r.asArray());if(r.getClassName()==="Vector3")return k.FromEulerVector(r);if(r.getClassName()==="Matrix")return k.FromRotationMatrix(r)}return r};const E=new c("FlowGraphInteger",new p(0),0);function H(r){const e=r;switch(typeof r){case"string":return C;case"number":return d;case"boolean":return P;case"object":if(e.getClassName)switch(e.getClassName()){case"Vector2":return B;case"Vector3":return _;case"Vector4":return A;case"Matrix":return F;case"Color3":return G;case"Color4":return T;case"Quaternion":return y;case"FlowGraphInteger":return E;case"Matrix2D":return M;case"Matrix3D":return R}return b;default:return b}}function K(r){switch(r){case"string":return C;case"number":return d;case"boolean":return P;case"Vector2":return B;case"Vector3":return _;case"Vector4":return A;case"Matrix":return F;case"Color3":return G;case"Color4":return T;case"Quaternion":return y;case"FlowGraphInteger":return E;case"Matrix2D":return M;case"Matrix3D":return R;default:return b}}function J(r){switch(r){case"number":return 0;case"Vector2":return 5;case"Vector3":return 1;case"Matrix":return 3;case"Color3":return 4;case"Color4":return 7;case"Quaternion":return 2;default:return 0}}function U(r){switch(r){case 0:return d;case 5:return B;case 1:return _;case 3:return F;case 4:return G;case 7:return T;case 2:return y;default:return b}}function X(r){const[e,n]=r.split(":");return $({op:e,extension:n})}function $(r,e=!0){const n=r.extension?w[r.extension]?.[r.op]:W[r.op];if(!n&&(m.Warn(`No mapping found for operation ${r.op} and extension ${r.extension||"KHR_interactivity"}`),e)){const o={},t={flows:{}};if(r.inputValueSockets){o.values={};for(const a in r.inputValueSockets)o.values[a]={name:a}}return r.outputValueSockets&&(t.values={},Object.keys(r.outputValueSockets).forEach(a=>{t.values[a]={name:a}})),{blocks:[],inputs:o,outputs:t}}return n}function Y(r,e,n){w[e]||(w[e]={}),w[e][r]=n}const w={BABYLON:{"flow/log":{blocks:["FlowGraphConsoleLogBlock"],inputs:{values:{message:{name:"message"}}}}}},W={"event/onStart":{blocks:["FlowGraphSceneReadyEventBlock"],outputs:{flows:{out:{name:"done"}}}},"event/onTick":{blocks:["FlowGraphSceneTickEventBlock"],inputs:{},outputs:{values:{timeSinceLastTick:{name:"deltaTime",gltfType:"number"}},flows:{out:{name:"done"}}}},"event/send":{blocks:["FlowGraphSendCustomEventBlock"],extraProcessor(r,e,n,o,t){if(e.op!=="event/send"||!r.configuration||Object.keys(r.configuration).length!==1)throw new Error("Receive event should have a single configuration object, the event itself");const l=r.configuration.event.value?.[0];if(typeof l!="number")throw new Error("Event id should be a number");const i=o.arrays.events[l],s=t[0];return s.config||(s.config={}),s.config.eventId=i.eventId,s.config.eventData=i.eventData,t}},"event/receive":{blocks:["FlowGraphReceiveCustomEventBlock"],outputs:{flows:{out:{name:"done"}}},validation(r,e){if(!r.configuration)return m.Error("Receive event should have a configuration object"),{valid:!1,error:"Receive event should have a configuration object"};const n=r.configuration.event;if(!n)return m.Error("Receive event should have a single configuration object, the event itself"),{valid:!1,error:"Receive event should have a single configuration object, the event itself"};const o=n.value?.[0];return typeof o!="number"?(m.Error("Event id should be a number"),{valid:!1,error:"Event id should be a number"}):e.events?.[o]?{valid:!0}:(m.Error(`Event with id ${o} not found`),{valid:!1,error:`Event with id ${o} not found`})},extraProcessor(r,e,n,o,t){if(e.op!=="event/receive"||!r.configuration||Object.keys(r.configuration).length!==1)throw new Error("Receive event should have a single configuration object, the event itself");const l=r.configuration.event.value?.[0];if(typeof l!="number")throw new Error("Event id should be a number");const i=o.arrays.events[l],s=t[0];return s.config||(s.config={}),s.config.eventId=i.eventId,s.config.eventData=i.eventData,t}},"math/E":u("FlowGraphEBlock"),"math/Pi":u("FlowGraphPIBlock"),"math/Inf":u("FlowGraphInfBlock"),"math/NaN":u("FlowGraphNaNBlock"),"math/abs":u("FlowGraphAbsBlock"),"math/sign":u("FlowGraphSignBlock"),"math/trunc":u("FlowGraphTruncBlock"),"math/floor":u("FlowGraphFloorBlock"),"math/ceil":u("FlowGraphCeilBlock"),"math/round":{blocks:["FlowGraphRoundBlock"],configuration:{},inputs:{values:{a:{name:"a"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(r,e,n,o,t){var a;return(a=t[0]).config||(a.config={}),t[0].config.roundHalfAwayFromZero=!0,t}},"math/fract":u("FlowGraphFractBlock"),"math/neg":u("FlowGraphNegationBlock"),"math/add":u("FlowGraphAddBlock",["a","b"],!0),"math/sub":u("FlowGraphSubtractBlock",["a","b"],!0),"math/mul":{blocks:["FlowGraphMultiplyBlock"],extraProcessor(r,e,n,o,t){var a;(a=t[0]).config||(a.config={}),t[0].config.useMatrixPerComponent=!0,t[0].config.preventIntegerFloatArithmetic=!0;let l=-1;return Object.keys(r.values||{}).find(i=>r.values?.[i].type!==void 0?(l=r.values[i].type,!0):!1),l!==-1&&(t[0].config.type=o.arrays.types[l].flowGraphType),t},validation(r){return r.values?N(r):{valid:!0}}},"math/div":u("FlowGraphDivideBlock",["a","b"],!0),"math/rem":u("FlowGraphModuloBlock",["a","b"]),"math/min":u("FlowGraphMinBlock",["a","b"]),"math/max":u("FlowGraphMaxBlock",["a","b"]),"math/clamp":u("FlowGraphClampBlock",["a","b","c"]),"math/saturate":u("FlowGraphSaturateBlock"),"math/mix":u("FlowGraphMathInterpolationBlock",["a","b","c"]),"math/eq":u("FlowGraphEqualityBlock",["a","b"]),"math/lt":u("FlowGraphLessThanBlock",["a","b"]),"math/le":u("FlowGraphLessThanOrEqualBlock",["a","b"]),"math/gt":u("FlowGraphGreaterThanBlock",["a","b"]),"math/ge":u("FlowGraphGreaterThanOrEqualBlock",["a","b"]),"math/isNaN":u("FlowGraphIsNaNBlock"),"math/isInf":u("FlowGraphIsInfBlock"),"math/select":{blocks:["FlowGraphConditionalBlock"],inputs:{values:{condition:{name:"condition"},a:{name:"onTrue"},b:{name:"onFalse"}}},outputs:{values:{value:{name:"output"}}}},"math/random":{blocks:["FlowGraphRandomBlock"],outputs:{values:{value:{name:"value"}}}},"math/sin":u("FlowGraphSinBlock"),"math/cos":u("FlowGraphCosBlock"),"math/tan":u("FlowGraphTanBlock"),"math/asin":u("FlowGraphASinBlock"),"math/acos":u("FlowGraphACosBlock"),"math/atan":u("FlowGraphATanBlock"),"math/atan2":u("FlowGraphATan2Block",["a","b"]),"math/sinh":u("FlowGraphSinhBlock"),"math/cosh":u("FlowGraphCoshBlock"),"math/tanh":u("FlowGraphTanhBlock"),"math/asinh":u("FlowGraphASinhBlock"),"math/acosh":u("FlowGraphACoshBlock"),"math/atanh":u("FlowGraphATanhBlock"),"math/exp":u("FlowGraphExponentialBlock"),"math/log":u("FlowGraphLogBlock"),"math/log2":u("FlowGraphLog2Block"),"math/log10":u("FlowGraphLog10Block"),"math/sqrt":u("FlowGraphSquareRootBlock"),"math/cbrt":u("FlowGraphCubeRootBlock"),"math/pow":u("FlowGraphPowerBlock",["a","b"]),"math/length":u("FlowGraphLengthBlock"),"math/normalize":u("FlowGraphNormalizeBlock"),"math/dot":u("FlowGraphDotBlock",["a","b"]),"math/cross":u("FlowGraphCrossBlock",["a","b"]),"math/rotate2D":{blocks:["FlowGraphRotate2DBlock"],inputs:{values:{a:{name:"a"},angle:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"math/rotate3D":{blocks:["FlowGraphRotate3DBlock"],inputs:{values:{a:{name:"a"},rotation:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"math/transform":{blocks:["FlowGraphTransformVectorBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"math/combine2":{blocks:["FlowGraphCombineVector2Block"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/combine3":{blocks:["FlowGraphCombineVector3Block"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/combine4":{blocks:["FlowGraphCombineVector4Block"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/extract2":{blocks:["FlowGraphExtractVector2Block"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"}}}},"math/extract3":{blocks:["FlowGraphExtractVector3Block"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"}}}},"math/extract4":{blocks:["FlowGraphExtractVector4Block"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"}}}},"math/transpose":u("FlowGraphTransposeBlock"),"math/determinant":u("FlowGraphDeterminantBlock"),"math/inverse":u("FlowGraphInvertMatrixBlock"),"math/matMul":u("FlowGraphMatrixMultiplicationBlock",["a","b"]),"math/matCompose":{blocks:["FlowGraphMatrixCompose"],inputs:{values:{translation:{name:"position",gltfType:"float3"},rotation:{name:"rotationQuaternion",gltfType:"float4"},scale:{name:"scaling",gltfType:"float3"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(r,e,n,o,t,a){const l=t[0].dataInputs.find(i=>i.name==="rotationQuaternion");if(!l)throw new Error("Rotation quaternion input not found");return a._connectionValues[l.uniqueId]&&(a._connectionValues[l.uniqueId].type="Quaternion"),t}},"math/matDecompose":{blocks:["FlowGraphMatrixDecompose"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{translation:{name:"position"},rotation:{name:"rotationQuaternion"},scale:{name:"scaling"}}}},"math/quatConjugate":u("FlowGraphConjugateBlock",["a"]),"math/quatMul":{blocks:["FlowGraphMultiplyBlock"],inputs:{values:{a:{name:"a",gltfType:"vector4"},b:{name:"b",gltfType:"vector4"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(r,e,n,o,t){var a;return(a=t[0]).config||(a.config={}),t[0].config.type="Quaternion",t}},"math/quatAngleBetween":u("FlowGraphAngleBetweenBlock",["a","b"]),"math/quatFromAxisAngle":{blocks:["FlowGraphQuaternionFromAxisAngleBlock"],inputs:{values:{axis:{name:"a",gltfType:"float3"},angle:{name:"b",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/quatToAxisAngle":u("FlowGraphAxisAngleFromQuaternionBlock",["a"]),"math/quatFromDirections":u("FlowGraphQuaternionFromDirectionsBlock",["a","b"]),"math/combine2x2":{blocks:["FlowGraphCombineMatrix2DBlock"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(r,e,n,o,t){var a;return(a=t[0]).config||(a.config={}),t[0].config.inputIsColumnMajor=!0,t}},"math/extract2x2":{blocks:["FlowGraphExtractMatrix2DBlock"],inputs:{values:{a:{name:"input",gltfType:"float2x2"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"}}}},"math/combine3x3":{blocks:["FlowGraphCombineMatrix3DBlock"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"},e:{name:"input_4",gltfType:"number"},f:{name:"input_5",gltfType:"number"},g:{name:"input_6",gltfType:"number"},h:{name:"input_7",gltfType:"number"},i:{name:"input_8",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(r,e,n,o,t){var a;return(a=t[0]).config||(a.config={}),t[0].config.inputIsColumnMajor=!0,t}},"math/extract3x3":{blocks:["FlowGraphExtractMatrix3DBlock"],inputs:{values:{a:{name:"input",gltfType:"float3x3"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"},4:{name:"output_4"},5:{name:"output_5"},6:{name:"output_6"},7:{name:"output_7"},8:{name:"output_8"}}}},"math/combine4x4":{blocks:["FlowGraphCombineMatrixBlock"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"},e:{name:"input_4",gltfType:"number"},f:{name:"input_5",gltfType:"number"},g:{name:"input_6",gltfType:"number"},h:{name:"input_7",gltfType:"number"},i:{name:"input_8",gltfType:"number"},j:{name:"input_9",gltfType:"number"},k:{name:"input_10",gltfType:"number"},l:{name:"input_11",gltfType:"number"},m:{name:"input_12",gltfType:"number"},n:{name:"input_13",gltfType:"number"},o:{name:"input_14",gltfType:"number"},p:{name:"input_15",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(r,e,n,o,t){var a;return(a=t[0]).config||(a.config={}),t[0].config.inputIsColumnMajor=!0,t}},"math/extract4x4":{blocks:["FlowGraphExtractMatrixBlock"],configuration:{},inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"},4:{name:"output_4"},5:{name:"output_5"},6:{name:"output_6"},7:{name:"output_7"},8:{name:"output_8"},9:{name:"output_9"},10:{name:"output_10"},11:{name:"output_11"},12:{name:"output_12"},13:{name:"output_13"},14:{name:"output_14"},15:{name:"output_15"}}}},"math/not":{blocks:["FlowGraphBitwiseNotBlock"],inputs:{values:{a:{name:"a"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(r,e,n,o,t,a){var l;(l=t[0]).config||(l.config={});const i=t[0].dataInputs[0];return t[0].config.valueType=a._connectionValues[i.uniqueId]?.type??"FlowGraphInteger",t}},"math/and":{blocks:["FlowGraphBitwiseAndBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(r,e,n,o,t,a){var l;(l=t[0]).config||(l.config={});const i=t[0].dataInputs[0],s=t[0].dataInputs[1];return t[0].config.valueType=a._connectionValues[i.uniqueId]?.type??a._connectionValues[s.uniqueId]?.type??"FlowGraphInteger",t}},"math/or":{blocks:["FlowGraphBitwiseOrBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(r,e,n,o,t,a){var l;(l=t[0]).config||(l.config={});const i=t[0].dataInputs[0],s=t[0].dataInputs[1];return t[0].config.valueType=a._connectionValues[i.uniqueId]?.type??a._connectionValues[s.uniqueId]?.type??"FlowGraphInteger",t}},"math/xor":{blocks:["FlowGraphBitwiseXorBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(r,e,n,o,t,a){var l;(l=t[0]).config||(l.config={});const i=t[0].dataInputs[0],s=t[0].dataInputs[1];return t[0].config.valueType=a._connectionValues[i.uniqueId]?.type??a._connectionValues[s.uniqueId]?.type??"FlowGraphInteger",t}},"math/asr":u("FlowGraphBitwiseRightShiftBlock",["a","b"]),"math/lsl":u("FlowGraphBitwiseLeftShiftBlock",["a","b"]),"math/clz":u("FlowGraphLeadingZerosBlock"),"math/ctz":u("FlowGraphTrailingZerosBlock"),"math/popcnt":u("FlowGraphOneBitsCounterBlock"),"math/rad":u("FlowGraphDegToRadBlock"),"math/deg":u("FlowGraphRadToDegBlock"),"type/boolToInt":u("FlowGraphBooleanToInt"),"type/boolToFloat":u("FlowGraphBooleanToFloat"),"type/intToBool":u("FlowGraphIntToBoolean"),"type/intToFloat":u("FlowGraphIntToFloat"),"type/floatToInt":u("FlowGraphFloatToInt"),"type/floatToBool":u("FlowGraphFloatToBoolean"),"flow/sequence":{blocks:["FlowGraphSequenceBlock"],extraProcessor(r,e,n,o,t){const a=t[0];return a.config||(a.config={}),a.config.outputSignalCount=Object.keys(r.flows||[]).length,a.signalOutputs.forEach((l,i)=>{l.name="out_"+i}),t}},"flow/branch":{blocks:["FlowGraphBranchBlock"],outputs:{flows:{true:{name:"onTrue"},false:{name:"onFalse"}}}},"flow/switch":{blocks:["FlowGraphSwitchBlock"],configuration:{cases:{name:"cases",isArray:!0,inOptions:!0,defaultValue:[]}},inputs:{values:{selection:{name:"case"},default:{name:"default"}}},validation(r){const e=r.configuration?.cases;if(e&&e.value){if(!e.value.every(t=>typeof t=="number"&&/^-?\d+$/.test(t.toString())))return m.Warn("Switch cases should be integers. Using empty array instead."),e.value=[],{valid:!0};const o=new Set(e.value);e.value=Array.from(o)}return{valid:!0}},extraProcessor(r,e,n,o,t){if(e.op!=="flow/switch"||!r.flows||Object.keys(r.flows).length===0)throw new Error("Switch should have a single configuration object, the cases array");return t[0].signalOutputs.forEach(l=>{l.name!=="default"&&(l.name="out_"+l.name)}),t}},"flow/while":{blocks:["FlowGraphWhileLoopBlock"],outputs:{flows:{loopBody:{name:"executionFlow"}}}},"flow/for":{blocks:["FlowGraphForLoopBlock"],configuration:{initialIndex:{name:"initialIndex",gltfType:"number",inOptions:!0,defaultValue:0}},inputs:{values:{startIndex:{name:"startIndex",gltfType:"number"},endIndex:{name:"endIndex",gltfType:"number"}}},outputs:{values:{index:{name:"index"}},flows:{loopBody:{name:"executionFlow"}}},extraProcessor(r,e,n,o,t){const a=t[0];return a.config||(a.config={}),a.config.incrementIndexWhenLoopDone=!0,t}},"flow/doN":{blocks:["FlowGraphDoNBlock"],configuration:{},inputs:{values:{n:{name:"maxExecutions",gltfType:"number"}}},outputs:{values:{currentCount:{name:"executionCount"}}}},"flow/multiGate":{blocks:["FlowGraphMultiGateBlock"],configuration:{isRandom:{name:"isRandom",gltfType:"boolean",inOptions:!0,defaultValue:!1},isLoop:{name:"isLoop",gltfType:"boolean",inOptions:!0,defaultValue:!1}},extraProcessor(r,e,n,o,t){if(e.op!=="flow/multiGate"||!r.flows||Object.keys(r.flows).length===0)throw new Error("MultiGate should have a single configuration object, the number of output flows");const a=t[0];return a.config||(a.config={}),a.config.outputSignalCount=Object.keys(r.flows).length,a.signalOutputs.forEach((l,i)=>{l.name="out_"+i}),t}},"flow/waitAll":{blocks:["FlowGraphWaitAllBlock"],configuration:{inputFlows:{name:"inputSignalCount",gltfType:"number",inOptions:!0,defaultValue:0}},inputs:{flows:{reset:{name:"reset"},"[segment]":{name:"in_$1"}}},validation(r){return typeof r.configuration?.inputFlows?.value?.[0]!="number"&&(r.configuration=r.configuration||{inputFlows:{value:[0]}},r.configuration.inputFlows.value=[0]),{valid:!0}}},"flow/throttle":{blocks:["FlowGraphThrottleBlock"],outputs:{flows:{err:{name:"error"}}}},"flow/setDelay":{blocks:["FlowGraphSetDelayBlock"],outputs:{flows:{err:{name:"error"}}}},"flow/cancelDelay":{blocks:["FlowGraphCancelDelayBlock"]},"variable/get":{blocks:["FlowGraphGetVariableBlock"],validation(r){return r.configuration?.variable?.value?{valid:!0}:(m.Error("Variable get block should have a variable configuration"),{valid:!1,error:"Variable get block should have a variable configuration"})},configuration:{variable:{name:"variable",gltfType:"number",flowGraphType:"string",inOptions:!0,isVariable:!0,dataTransformer(r,e){return e.getVariableName(r)}}}},"variable/set":{blocks:["FlowGraphSetVariableBlock"],configuration:{variables:{name:"variables",gltfType:"number",flowGraphType:"string",inOptions:!0,isArray:!0,dataTransformer(r,e){return r.map(n=>e.getVariableName(n))}}},extraProcessor(r,e,n,o,t){return t[0].dataInputs.forEach(l=>{l.name=o.getVariableName(+l.name)}),t}},"variable/interpolate":{blocks:["FlowGraphInterpolationBlock","FlowGraphContextBlock","FlowGraphPlayAnimationBlock","FlowGraphBezierCurveEasing","FlowGraphGetVariableBlock"],configuration:{variable:{name:"propertyName",inOptions:!0,isVariable:!0,dataTransformer(r,e){return e.getVariableName(r)}},useSlerp:{name:"animationType",inOptions:!0,defaultValue:!1,dataTransformer(r){return r===!0?"Quaternion":void 0}}},inputs:{values:{value:{name:"value_1"},duration:{name:"duration_1",gltfType:"number"},p1:{name:"controlPoint1",toBlock:"FlowGraphBezierCurveEasing"},p2:{name:"controlPoint2",toBlock:"FlowGraphBezierCurveEasing"}},flows:{in:{name:"in",toBlock:"FlowGraphPlayAnimationBlock"}}},outputs:{flows:{err:{name:"error",toBlock:"FlowGraphPlayAnimationBlock"},out:{name:"out",toBlock:"FlowGraphPlayAnimationBlock"},done:{name:"done",toBlock:"FlowGraphPlayAnimationBlock"}}},interBlockConnectors:[{input:"object",output:"userVariables",inputBlockIndex:2,outputBlockIndex:1,isVariable:!0},{input:"animation",output:"animation",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0},{input:"easingFunction",output:"easingFunction",inputBlockIndex:0,outputBlockIndex:3,isVariable:!0},{input:"value_0",output:"value",inputBlockIndex:0,outputBlockIndex:4,isVariable:!0}],extraProcessor(r,e,n,o,t){var a,l;const i=t[0],s=r.configuration?.variable.value?.[0];if(typeof s!="number")throw m.Error("Variable index is not defined for variable interpolation block"),new Error("Variable index is not defined for variable interpolation block");const v=o.arrays.staticVariables[s];typeof i.config?.animationType?.value>"u"&&(i.config||(i.config={}),(a=i.config).animationType||(a.animationType={}),i.config.animationType.value=J(v.type));const g=t[4];return g.config||(g.config={}),(l=g.config).variable||(l.variable={}),g.config.variable.value=o.getVariableName(s),t}},"pointer/get":{blocks:["FlowGraphGetPropertyBlock","FlowGraphJsonPointerParserBlock"],configuration:{pointer:{name:"jsonPointer",toBlock:"FlowGraphJsonPointerParserBlock"}},inputs:{values:{"[segment]":{name:"$1",toBlock:"FlowGraphJsonPointerParserBlock"}}},interBlockConnectors:[{input:"object",output:"object",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"propertyName",output:"propertyName",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"customGetFunction",output:"getFunction",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0}],extraProcessor(r,e,n,o,t){return t.forEach(a=>{a.className==="FlowGraphJsonPointerParserBlock"&&(a.config||(a.config={}),a.config.outputValue=!0)}),t}},"pointer/set":{blocks:["FlowGraphSetPropertyBlock","FlowGraphJsonPointerParserBlock"],configuration:{pointer:{name:"jsonPointer",toBlock:"FlowGraphJsonPointerParserBlock"}},inputs:{values:{value:{name:"value"},"[segment]":{name:"$1",toBlock:"FlowGraphJsonPointerParserBlock"}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"object",output:"object",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"propertyName",output:"propertyName",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"customSetFunction",output:"setFunction",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0}],extraProcessor(r,e,n,o,t){return t.forEach(a=>{a.className==="FlowGraphJsonPointerParserBlock"&&(a.config||(a.config={}),a.config.outputValue=!0)}),t}},"pointer/interpolate":{blocks:["FlowGraphInterpolationBlock","FlowGraphJsonPointerParserBlock","FlowGraphPlayAnimationBlock","FlowGraphBezierCurveEasing"],configuration:{pointer:{name:"jsonPointer",toBlock:"FlowGraphJsonPointerParserBlock"}},inputs:{values:{value:{name:"value_1"},"[segment]":{name:"$1",toBlock:"FlowGraphJsonPointerParserBlock"},duration:{name:"duration_1",gltfType:"number"},p1:{name:"controlPoint1",toBlock:"FlowGraphBezierCurveEasing"},p2:{name:"controlPoint2",toBlock:"FlowGraphBezierCurveEasing"}},flows:{in:{name:"in",toBlock:"FlowGraphPlayAnimationBlock"}}},outputs:{flows:{err:{name:"error",toBlock:"FlowGraphPlayAnimationBlock"},out:{name:"out",toBlock:"FlowGraphPlayAnimationBlock"},done:{name:"done",toBlock:"FlowGraphPlayAnimationBlock"}}},interBlockConnectors:[{input:"object",output:"object",inputBlockIndex:2,outputBlockIndex:1,isVariable:!0},{input:"propertyName",output:"propertyName",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"customBuildAnimation",output:"generateAnimationsFunction",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"animation",output:"animation",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0},{input:"easingFunction",output:"easingFunction",inputBlockIndex:0,outputBlockIndex:3,isVariable:!0},{input:"value_0",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0}],extraProcessor(r,e,n,o,t){return t.forEach(a=>{a.className==="FlowGraphJsonPointerParserBlock"?(a.config||(a.config={}),a.config.outputValue=!0):a.className==="FlowGraphInterpolationBlock"&&(a.config||(a.config={}),Object.keys(r.values||[]).forEach(l=>{const i=r.values?.[l];if(l==="value"&&i){const s=i.type;s!==void 0&&(a.config.animationType=o.arrays.types[s].flowGraphType)}}))}),t}},"animation/start":{blocks:["FlowGraphPlayAnimationBlock","FlowGraphArrayIndexBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],inputs:{values:{animation:{name:"index",gltfType:"number",toBlock:"FlowGraphArrayIndexBlock"},speed:{name:"speed",gltfType:"number"},startTime:{name:"from",gltfType:"number",dataTransformer:(r,e)=>[r[0]*e._animationTargetFps]},endTime:{name:"to",gltfType:"number",dataTransformer:(r,e)=>[r[0]*e._animationTargetFps]}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"animationGroup",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"animationGroups",inputBlockIndex:1,outputBlockIndex:2,isVariable:!0}],extraProcessor(r,e,n,o,t,a,l){const i=t[t.length-1];return i.config||(i.config={}),i.config.glTF=l,t}},"animation/stop":{blocks:["FlowGraphStopAnimationBlock","FlowGraphArrayIndexBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],inputs:{values:{animation:{name:"index",gltfType:"number",toBlock:"FlowGraphArrayIndexBlock"}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"animationGroup",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"animationGroups",inputBlockIndex:1,outputBlockIndex:2,isVariable:!0}],extraProcessor(r,e,n,o,t,a,l){const i=t[t.length-1];return i.config||(i.config={}),i.config.glTF=l,t}},"animation/stopAt":{blocks:["FlowGraphStopAnimationBlock","FlowGraphArrayIndexBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{},inputs:{values:{animation:{name:"index",gltfType:"number",toBlock:"FlowGraphArrayIndexBlock"},stopTime:{name:"stopAtFrame",gltfType:"number",dataTransformer:(r,e)=>[r[0]*e._animationTargetFps]}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"animationGroup",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"animationGroups",inputBlockIndex:1,outputBlockIndex:2,isVariable:!0}],extraProcessor(r,e,n,o,t,a,l){const i=t[t.length-1];return i.config||(i.config={}),i.config.glTF=l,t}},"math/switch":{blocks:["FlowGraphDataSwitchBlock"],configuration:{cases:{name:"cases",isArray:!0,inOptions:!0,defaultValue:[]}},inputs:{values:{selection:{name:"case"}}},validation(r){const e=r.configuration?.cases;if(e&&e.value){if(!e.value.every(t=>typeof t=="number"&&/^-?\d+$/.test(t.toString())))return m.Warn("Switch cases should be integers. Using empty array instead."),e.value=[],{valid:!0};const o=new Set(e.value);e.value=Array.from(o)}return{valid:!0}},extraProcessor(r,e,n,o,t){const a=t[0];return a.dataInputs.forEach(l=>{l.name!=="default"&&l.name!=="case"&&(l.name="in_"+l.name)}),a.config||(a.config={}),a.config.treatCasesAsIntegers=!0,t}},"debug/log":{blocks:["FlowGraphConsoleLogBlock"],configuration:{message:{name:"messageTemplate",inOptions:!0}}}};function u(r,e=["a"],n){return{blocks:[r],inputs:{values:e.reduce((o,t)=>(o[t]={name:t},o),{})},outputs:{values:{value:{name:"value"}}},extraProcessor(o,t,a,l,i){var s;if(n){(s=i[0]).config||(s.config={}),i[0].config.preventIntegerFloatArithmetic=!0;let v=-1;Object.keys(o.values||{}).find(g=>o.values?.[g].type!==void 0?(v=o.values[g].type,!0):!1),v!==-1&&(i[0].config.type=l.arrays.types[v].flowGraphType)}return i},validation(o){return n?N(o):{valid:!0}}}}function N(r){if(r.values){const e=Object.keys(r.values).map(o=>r.values[o].type).filter(o=>o!==void 0);if(!e.every(o=>o===e[0]))return{valid:!1,error:"All inputs must be of the same type"}}return{valid:!0}}export{p as F,b as R,Y as a,d as b,P as c,U as d,_ as e,y as f,K as g,F as h,E as i,H as j,A as k,B as l,M as m,h as n,R as o,f as p,C as q,$ as r,X as s}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/default.fragment-51gNkSUo.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/default.fragment-51gNkSUo.js new file mode 100644 index 0000000000000000000000000000000000000000..ed9591ec5aa1dee981985d61e8775881075948db --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/default.fragment-51gNkSUo.js @@ -0,0 +1,367 @@ +import{S as r}from"./index-CDrXokXW.js";import"./defaultUboDeclaration-DefpgvMN.js";import"./oitFragment-BcbCWH3V.js";import"./mainUVVaryingDeclaration-gz09aLXv.js";import"./helperFunctions-CZpZ-EbL.js";import"./shadowsFragmentFunctions-CTsFFgyf.js";import"./lightsFragmentFunctions-DcPOaMby.js";import"./samplerFragmentDeclaration-cxB-jdDJ.js";import"./fresnelFunction-cCRUtTOI.js";import"./imageProcessingFunctions-BbtoaTge.js";import"./bumpFragment-BDPY2JKo.js";import"./clipPlaneFragment-C7XUrTAZ.js";import"./logDepthDeclaration-DkdfQs4e.js";import"./fogFragment-DmA8Y7To.js";import"./decalFragment-iGkmQ-pm.js";import"./lightFragment-DhtXFpEE.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./meshUboDeclaration-Bk1ASTX2.js";const e="defaultPixelShader",f=`#include +#include[SCENE_MRT_COUNT] +#include +#define CUSTOM_FRAGMENT_BEGIN +varying vPositionW: vec3f; +#ifdef NORMAL +varying vNormalW: vec3f; +#endif +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +varying vColor: vec4f; +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +varying vViewDepth: f32; +#endif +#include[1..7] +#include +#include[0..maxSimultaneousLights] +#include +#include +#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse) +#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient) +#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity) +#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive) +#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal) +#ifdef REFRACTION +#ifdef REFRACTIONMAP_3D +var refractionCubeSamplerSampler: sampler;var refractionCubeSampler: texture_cube; +#else +var refraction2DSamplerSampler: sampler;var refraction2DSampler: texture_2d; +#endif +#endif +#if defined(SPECULARTERM) +#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular) +#endif +#include +#ifdef REFLECTION +#ifdef REFLECTIONMAP_3D +var reflectionCubeSamplerSampler: sampler;var reflectionCubeSampler: texture_cube; +#else +var reflection2DSamplerSampler: sampler;var reflection2DSampler: texture_2d; +#endif +#ifdef REFLECTIONMAP_SKYBOX +varying vPositionUVW: vec3f; +#else +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vDirectionW: vec3f; +#endif +#endif +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs { +#define CUSTOM_FRAGMENT_MAIN_BEGIN +#include +var viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a; +#ifdef NORMAL +var normalW: vec3f=normalize(fragmentInputs.vNormalW); +#else +var normalW: vec3f=normalize(cross(dpdx(fragmentInputs.vPositionW),dpdy(fragmentInputs.vPositionW)))* scene.vEyePosition.w; +#endif +#include +#ifdef TWOSIDEDLIGHTING +normalW=select(-normalW,normalW,fragmentInputs.frontFacing); +#endif +#ifdef DIFFUSE +baseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV+uvOffset); +#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS) +if (baseColor.a(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_) +#endif +#include +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +baseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a); +#endif +#ifdef DETAIL +baseColor=vec4f(baseColor.rgb*2.0*mix(0.5,detailColor.r,uniforms.vDetailInfos.y),baseColor.a); +#endif +#if defined(DECAL) && defined(DECAL_AFTER_DETAIL) +var decalColor: vec4f=textureSample(decalSampler,decalSamplerSampler,fragmentInputs.vDecalUV+uvOffset); +#include(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_) +#endif +#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE +var baseAmbientColor: vec3f= vec3f(1.,1.,1.); +#ifdef AMBIENT +baseAmbientColor=textureSample(ambientSampler,ambientSamplerSampler,fragmentInputs.vAmbientUV+uvOffset).rgb*uniforms.vAmbientInfos.y; +#endif +#define CUSTOM_FRAGMENT_BEFORE_LIGHTS +var glossiness: f32=uniforms.vSpecularColor.a;var specularColor: vec3f=uniforms.vSpecularColor.rgb; +#ifdef SPECULARTERM +#ifdef SPECULAR +var specularMapColor: vec4f=textureSample(specularSampler,specularSamplerSampler,fragmentInputs.vSpecularUV+uvOffset);specularColor=specularMapColor.rgb; +#ifdef GLOSSINESS +glossiness=glossiness*specularMapColor.a; +#endif +#endif +#endif +var diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo; +#ifdef SPECULARTERM +var specularBase: vec3f= vec3f(0.,0.,0.); +#endif +var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.; +#ifdef LIGHTMAP +var lightmapColor: vec4f=textureSample(lightmapSampler,lightmapSamplerSampler,fragmentInputs.vLightmapUV+uvOffset); +#ifdef RGBDLIGHTMAP +lightmapColor=vec4f(fromRGBD(lightmapColor),lightmapColor.a); +#endif +lightmapColor=vec4f(lightmapColor.rgb*uniforms.vLightmapInfos.y,lightmapColor.a); +#endif +#include[0..maxSimultaneousLights] +aggShadow=aggShadow/numLights;var refractionColor: vec4f= vec4f(0.,0.,0.,1.); +#ifdef REFRACTION +var refractionVector: vec3f=normalize(refract(-viewDirectionW,normalW,uniforms.vRefractionInfos.y)); +#ifdef REFRACTIONMAP_3D +#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC +refractionVector=parallaxCorrectNormal(fragmentInputs.vPositionW,refractionVector,uniforms.vRefractionSize,uniforms.vRefractionPosition); +#endif +refractionVector.y=refractionVector.y*uniforms.vRefractionInfos.w;var refractionLookup: vec4f=textureSample(refractionCubeSampler,refractionCubeSamplerSampler,refractionVector);if (dot(refractionVector,viewDirectionW)<1.0) {refractionColor=refractionLookup;} +#else +var vRefractionUVW: vec3f= (uniforms.refractionMatrix*(scene.view* vec4f(fragmentInputs.vPositionW+refractionVector*uniforms.vRefractionInfos.z,1.0))).xyz;var refractionCoords: vec2f=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;refractionColor=textureSample(refraction2DSampler,refraction2DSamplerSampler,refractionCoords); +#endif +#ifdef RGBDREFRACTION +refractionColor=vec4f(fromRGBD(refractionColor),refractionColor.a); +#endif +#ifdef IS_REFRACTION_LINEAR +refractionColor=vec4f(toGammaSpaceVec3(refractionColor.rgb),refractionColor.a); +#endif +refractionColor=vec4f(refractionColor.rgb*uniforms.vRefractionInfos.x,refractionColor.a); +#endif +var reflectionColor: vec4f= vec4f(0.,0.,0.,1.); +#ifdef REFLECTION +var vReflectionUVW: vec3f=computeReflectionCoords( vec4f(fragmentInputs.vPositionW,1.0),normalW); +#ifdef REFLECTIONMAP_OPPOSITEZ +vReflectionUVW=vec3f(vReflectionUVW.x,vReflectionUVW.y,vReflectionUVW.z*-1.0); +#endif +#ifdef REFLECTIONMAP_3D +#ifdef ROUGHNESS +var bias: f32=uniforms.vReflectionInfos.y; +#ifdef SPECULARTERM +#ifdef SPECULAR +#ifdef GLOSSINESS +bias*=(1.0-specularMapColor.a); +#endif +#endif +#endif +reflectionColor=textureSampleLevel(reflectionCubeSampler,reflectionCubeSamplerSampler,vReflectionUVW,bias); +#else +reflectionColor=textureSample(reflectionCubeSampler,reflectionCubeSamplerSampler,vReflectionUVW); +#endif +#else +var coords: vec2f=vReflectionUVW.xy; +#ifdef REFLECTIONMAP_PROJECTION +coords/=vReflectionUVW.z; +#endif +coords.y=1.0-coords.y;reflectionColor=textureSample(reflection2DSampler,reflection2DSamplerSampler,coords); +#endif +#ifdef RGBDREFLECTION +reflectionColor=vec4f(fromRGBD(reflectionColor),reflectionColor.a); +#endif +#ifdef IS_REFLECTION_LINEAR +reflectionColor=vec4f(toGammaSpaceVec3(reflectionColor.rgb),reflectionColor.a); +#endif +reflectionColor=vec4f(reflectionColor.rgb*uniforms.vReflectionInfos.x,reflectionColor.a); +#ifdef REFLECTIONFRESNEL +var reflectionFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.reflectionRightColor.a,uniforms.reflectionLeftColor.a); +#ifdef REFLECTIONFRESNELFROMSPECULAR +#ifdef SPECULARTERM +reflectionColor=vec4f(reflectionColor.rgb*specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*uniforms.reflectionRightColor.rgb,reflectionColor.a); +#else +reflectionColor=vec4f(reflectionColor.rgb*uniforms.reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*uniforms.reflectionRightColor.rgb,reflectionColor.a); +#endif +#else +reflectionColor=vec4f(reflectionColor.rgb*uniforms.reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*uniforms.reflectionRightColor.rgb,reflectionColor.a); +#endif +#endif +#endif +#ifdef REFRACTIONFRESNEL +var refractionFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.refractionRightColor.a,uniforms.refractionLeftColor.a);refractionColor=vec4f(refractionColor.rgb*uniforms.refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*uniforms.refractionRightColor.rgb,refractionColor.a); +#endif +#ifdef OPACITY +var opacityMap: vec4f=textureSample(opacitySampler,opacitySamplerSampler,fragmentInputs.vOpacityUV+uvOffset); +#ifdef OPACITYRGB +opacityMap=vec4f(opacityMap.rgb* vec3f(0.3,0.59,0.11),opacityMap.a);alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* uniforms.vOpacityInfos.y; +#else +alpha*=opacityMap.a*uniforms.vOpacityInfos.y; +#endif +#endif +#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES) +alpha*=fragmentInputs.vColor.a; +#endif +#ifdef OPACITYFRESNEL +var opacityFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.opacityParts.z,uniforms.opacityParts.w);alpha+=uniforms.opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*uniforms.opacityParts.y; +#endif +#ifdef ALPHATEST +#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS +if (alpha +#include +#ifdef IMAGEPROCESSINGPOSTPROCESS +color=vec4f(toLinearSpaceVec3(color.rgb),color.a); +#else +#ifdef IMAGEPROCESSING +color=vec4f(toLinearSpaceVec3(color.rgb),color.a);color=applyImageProcessing(color); +#endif +#endif +color=vec4f(color.rgb,color.a*mesh.visibility); +#ifdef PREMULTIPLYALPHA +color=vec4f(color.rgb*color.a, color.a); +#endif +#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR +#ifdef PREPASS +#if SCENE_MRT_COUNT>0 +var writeGeometryInfo: f32=select(0.0,1.0,color.a>0.4);var fragData: array,SCENE_MRT_COUNT>; +#ifdef PREPASS_COLOR +fragData[PREPASS_COLOR_INDEX]=color; +#endif +#ifdef PREPASS_POSITION +fragData[PREPASS_POSITION_INDEX]=vec4f(fragmentInputs.vPositionW,writeGeometryInfo); +#endif +#ifdef PREPASS_LOCAL_POSITION +fragData[PREPASS_LOCAL_POSITION_INDEX]=vec4f(fragmentInputs.vPosition,writeGeometryInfo); +#endif +#ifdef PREPASS_VELOCITY +var a: vec2f=(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w)*0.5+0.5;var b: vec2f=(fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w)*0.5+0.5;var velocity: vec2f=abs(a-b);velocity= vec2f(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;fragData[PREPASS_VELOCITY_INDEX]= vec4f(velocity,0.0,writeGeometryInfo); +#elif defined(PREPASS_VELOCITY_LINEAR) +var velocity : vec2f=vec2f(0.5)*((fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w) - +(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w));fragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4f(velocity,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_IRRADIANCE +fragData[PREPASS_IRRADIANCE_INDEX]=vec4f(0.0,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_DEPTH +fragData[PREPASS_DEPTH_INDEX]=vec4f(fragmentInputs.vViewPos.z,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_SCREENSPACE_DEPTH +fragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4f(fragmentInputs.position.z,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_NORMALIZED_VIEW_DEPTH +fragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4f(fragmentInputs.vNormViewDepth,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_NORMAL +#ifdef PREPASS_NORMAL_WORLDSPACE +fragData[PREPASS_NORMAL_INDEX]=vec4f(normalW,writeGeometryInfo); +#else +fragData[PREPASS_NORMAL_INDEX]=vec4f(normalize((scene.view*vec4f(normalW,0.0)).rgb),writeGeometryInfo); +#endif +#endif +#ifdef PREPASS_WORLD_NORMAL +fragData[PREPASS_WORLD_NORMAL_INDEX]=vec4f(normalW*0.5+0.5,writeGeometryInfo); +#endif +#ifdef PREPASS_ALBEDO +fragData[PREPASS_ALBEDO_INDEX]=vec4f(baseColor.rgb,writeGeometryInfo); +#endif +#ifdef PREPASS_ALBEDO_SQRT +fragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4f(sqrt(baseColor.rgb),writeGeometryInfo); +#endif +#ifdef PREPASS_REFLECTIVITY +#if defined(SPECULAR) +fragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(toLinearSpaceVec4(specularMapColor))*writeGeometryInfo; +#else +fragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(toLinearSpaceVec3(specularColor),1.0)*writeGeometryInfo; +#endif +#endif +#if SCENE_MRT_COUNT>0 +fragmentOutputs.fragData0=fragData[0]; +#endif +#if SCENE_MRT_COUNT>1 +fragmentOutputs.fragData1=fragData[1]; +#endif +#if SCENE_MRT_COUNT>2 +fragmentOutputs.fragData2=fragData[2]; +#endif +#if SCENE_MRT_COUNT>3 +fragmentOutputs.fragData3=fragData[3]; +#endif +#if SCENE_MRT_COUNT>4 +fragmentOutputs.fragData4=fragData[4]; +#endif +#if SCENE_MRT_COUNT>5 +fragmentOutputs.fragData5=fragData[5]; +#endif +#if SCENE_MRT_COUNT>6 +fragmentOutputs.fragData6=fragData[6]; +#endif +#if SCENE_MRT_COUNT>7 +fragmentOutputs.fragData7=fragData[7]; +#endif +#endif +#endif +#if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY) +fragmentOutputs.color=color; +#endif +#include +#if ORDER_INDEPENDENT_TRANSPARENCY +if (fragDepth==nearestDepth) {fragmentOutputs.frontColor=vec4f(fragmentOutputs.frontColor.rgb+color.rgb*color.a*alphaMultiplier,1.0-alphaMultiplier*(1.0-color.a));} else {fragmentOutputs.backColor+=color;} +#endif +#define CUSTOM_FRAGMENT_MAIN_END +} +`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=f);const g={name:e,shader:f};export{g as defaultPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/default.fragment-C7QPF0yE.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/default.fragment-C7QPF0yE.js new file mode 100644 index 0000000000000000000000000000000000000000..e40d91639ebeebf32ba2c1244cf44305288ee59e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/default.fragment-C7QPF0yE.js @@ -0,0 +1,422 @@ +import{S as e}from"./index-CDrXokXW.js";import"./oitFragment-_o5mqRWd.js";import"./defaultUboDeclaration-D-7rPLB4.js";import"./mainUVVaryingDeclaration-CYLIf35n.js";import"./helperFunctions-BkWNqKeI.js";import"./shadowsFragmentFunctions-QR4_Qrt1.js";import"./lightsFragmentFunctions-nqjCe5ZE.js";import"./bumpFragment-CNMCo4HD.js";import"./imageProcessingFunctions-dvOnE6xp.js";import"./clipPlaneFragment-T8W7CIC5.js";import"./logDepthDeclaration-DbMKMukk.js";import"./fogFragment-R9KOnWn-.js";import"./decalFragment-BXuRa219.js";import"./lightFragment-BRK1HqYL.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./meshUboDeclaration-C6raEdzf.js";const o="defaultFragmentDeclaration",n=`uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;uniform vec4 vSpecularColor;uniform vec3 vEmissiveColor;uniform vec3 vAmbientColor;uniform float visibility; +#ifdef DIFFUSE +uniform vec2 vDiffuseInfos; +#endif +#ifdef AMBIENT +uniform vec2 vAmbientInfos; +#endif +#ifdef OPACITY +uniform vec2 vOpacityInfos; +#endif +#ifdef EMISSIVE +uniform vec2 vEmissiveInfos; +#endif +#ifdef LIGHTMAP +uniform vec2 vLightmapInfos; +#endif +#ifdef BUMP +uniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams; +#endif +#ifdef ALPHATEST +uniform float alphaCutOff; +#endif +#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION) || defined(PREPASS) +uniform mat4 view; +#endif +#ifdef REFRACTION +uniform vec4 vRefractionInfos; +#ifndef REFRACTIONMAP_3D +uniform mat4 refractionMatrix; +#endif +#ifdef REFRACTIONFRESNEL +uniform vec4 refractionLeftColor;uniform vec4 refractionRightColor; +#endif +#if defined(USE_LOCAL_REFRACTIONMAP_CUBIC) && defined(REFRACTIONMAP_3D) +uniform vec3 vRefractionPosition;uniform vec3 vRefractionSize; +#endif +#endif +#if defined(SPECULAR) && defined(SPECULARTERM) +uniform vec2 vSpecularInfos; +#endif +#ifdef DIFFUSEFRESNEL +uniform vec4 diffuseLeftColor;uniform vec4 diffuseRightColor; +#endif +#ifdef OPACITYFRESNEL +uniform vec4 opacityParts; +#endif +#ifdef EMISSIVEFRESNEL +uniform vec4 emissiveLeftColor;uniform vec4 emissiveRightColor; +#endif +#if defined(REFLECTION) || (defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)) +uniform vec2 vReflectionInfos; +#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX) +uniform mat4 reflectionMatrix; +#endif +#ifndef REFLECTIONMAP_SKYBOX +#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC) +uniform vec3 vReflectionPosition;uniform vec3 vReflectionSize; +#endif +#endif +#ifdef REFLECTIONFRESNEL +uniform vec4 reflectionLeftColor;uniform vec4 reflectionRightColor; +#endif +#endif +#ifdef DETAIL +uniform vec4 vDetailInfos; +#endif +#include +#define ADDITIONAL_FRAGMENT_DECLARATION +`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=n);const r="fresnelFunction",a=`#ifdef FRESNEL +float computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power) +{float fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);} +#endif +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=a);const i="defaultPixelShader",f=`#define CUSTOM_FRAGMENT_EXTENSION +#include<__decl__defaultFragment> +#if defined(BUMP) || !defined(NORMAL) +#extension GL_OES_standard_derivatives : enable +#endif +#include[SCENE_MRT_COUNT] +#include +#define CUSTOM_FRAGMENT_BEGIN +#ifdef LOGARITHMICDEPTH +#extension GL_EXT_frag_depth : enable +#endif +varying vec3 vPositionW; +#ifdef NORMAL +varying vec3 vNormalW; +#endif +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +varying vec4 vColor; +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +varying float vViewDepth; +#endif +#include[1..7] +#include +#include<__decl__lightFragment>[0..maxSimultaneousLights] +#include +#include +#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse) +#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient) +#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity) +#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive) +#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal) +#ifdef REFRACTION +#ifdef REFRACTIONMAP_3D +uniform samplerCube refractionCubeSampler; +#else +uniform sampler2D refraction2DSampler; +#endif +#endif +#if defined(SPECULARTERM) +#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular) +#endif +#include +#ifdef REFLECTION +#ifdef REFLECTIONMAP_3D +uniform samplerCube reflectionCubeSampler; +#else +uniform sampler2D reflection2DSampler; +#endif +#ifdef REFLECTIONMAP_SKYBOX +varying vec3 vPositionUVW; +#else +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vec3 vDirectionW; +#endif +#endif +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) { +#define CUSTOM_FRAGMENT_MAIN_BEGIN +#include +vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a; +#ifdef NORMAL +vec3 normalW=normalize(vNormalW); +#else +vec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w; +#endif +#include +#ifdef TWOSIDEDLIGHTING +normalW=gl_FrontFacing ? normalW : -normalW; +#endif +#ifdef DIFFUSE +baseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset); +#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS) +if (baseColor.a(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_) +#endif +#include +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +baseColor.rgb*=vColor.rgb; +#endif +#ifdef DETAIL +baseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y); +#endif +#if defined(DECAL) && defined(DECAL_AFTER_DETAIL) +vec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset); +#include(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_) +#endif +#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE +vec3 baseAmbientColor=vec3(1.,1.,1.); +#ifdef AMBIENT +baseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y; +#endif +#define CUSTOM_FRAGMENT_BEFORE_LIGHTS +float glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb; +#ifdef SPECULARTERM +#ifdef SPECULAR +vec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);specularColor=specularMapColor.rgb; +#ifdef GLOSSINESS +glossiness=glossiness*specularMapColor.a; +#endif +#endif +#endif +vec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info; +#ifdef SPECULARTERM +vec3 specularBase=vec3(0.,0.,0.); +#endif +float shadow=1.;float aggShadow=0.;float numLights=0.; +#ifdef LIGHTMAP +vec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset); +#ifdef RGBDLIGHTMAP +lightmapColor.rgb=fromRGBD(lightmapColor); +#endif +lightmapColor.rgb*=vLightmapInfos.y; +#endif +#include[0..maxSimultaneousLights] +aggShadow=aggShadow/numLights;vec4 refractionColor=vec4(0.,0.,0.,1.); +#ifdef REFRACTION +vec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y)); +#ifdef REFRACTIONMAP_3D +#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC +refractionVector=parallaxCorrectNormal(vPositionW,refractionVector,vRefractionSize,vRefractionPosition); +#endif +refractionVector.y=refractionVector.y*vRefractionInfos.w;vec4 refractionLookup=textureCube(refractionCubeSampler,refractionVector);if (dot(refractionVector,viewDirectionW)<1.0) {refractionColor=refractionLookup;} +#else +vec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));vec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;refractionColor=texture2D(refraction2DSampler,refractionCoords); +#endif +#ifdef RGBDREFRACTION +refractionColor.rgb=fromRGBD(refractionColor); +#endif +#ifdef IS_REFRACTION_LINEAR +refractionColor.rgb=toGammaSpace(refractionColor.rgb); +#endif +refractionColor.rgb*=vRefractionInfos.x; +#endif +vec4 reflectionColor=vec4(0.,0.,0.,1.); +#ifdef REFLECTION +vec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW); +#ifdef REFLECTIONMAP_OPPOSITEZ +vReflectionUVW.z*=-1.0; +#endif +#ifdef REFLECTIONMAP_3D +#ifdef ROUGHNESS +float bias=vReflectionInfos.y; +#ifdef SPECULARTERM +#ifdef SPECULAR +#ifdef GLOSSINESS +bias*=(1.0-specularMapColor.a); +#endif +#endif +#endif +reflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias); +#else +reflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW); +#endif +#else +vec2 coords=vReflectionUVW.xy; +#ifdef REFLECTIONMAP_PROJECTION +coords/=vReflectionUVW.z; +#endif +coords.y=1.0-coords.y;reflectionColor=texture2D(reflection2DSampler,coords); +#endif +#ifdef RGBDREFLECTION +reflectionColor.rgb=fromRGBD(reflectionColor); +#endif +#ifdef IS_REFLECTION_LINEAR +reflectionColor.rgb=toGammaSpace(reflectionColor.rgb); +#endif +reflectionColor.rgb*=vReflectionInfos.x; +#ifdef REFLECTIONFRESNEL +float reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a); +#ifdef REFLECTIONFRESNELFROMSPECULAR +#ifdef SPECULARTERM +reflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb; +#else +reflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb; +#endif +#else +reflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb; +#endif +#endif +#endif +#ifdef REFRACTIONFRESNEL +float refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);refractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb; +#endif +#ifdef OPACITY +vec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset); +#ifdef OPACITYRGB +opacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y; +#else +alpha*=opacityMap.a*vOpacityInfos.y; +#endif +#endif +#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES) +alpha*=vColor.a; +#endif +#ifdef OPACITYFRESNEL +float opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);alpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y; +#endif +#ifdef ALPHATEST +#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS +if (alpha +#include +#ifdef IMAGEPROCESSINGPOSTPROCESS +color.rgb=toLinearSpace(color.rgb); +#else +#ifdef IMAGEPROCESSING +color.rgb=toLinearSpace(color.rgb);color=applyImageProcessing(color); +#endif +#endif +color.a*=visibility; +#ifdef PREMULTIPLYALPHA +color.rgb*=color.a; +#endif +#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR +#ifdef PREPASS +#if SCENE_MRT_COUNT>0 +float writeGeometryInfo=color.a>0.4 ? 1.0 : 0.0; +#ifdef PREPASS_COLOR +gl_FragData[PREPASS_COLOR_INDEX]=color; +#endif +#ifdef PREPASS_POSITION +gl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo); +#endif +#ifdef PREPASS_LOCAL_POSITION +gl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo); +#endif +#if defined(PREPASS_VELOCITY) +vec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo); +#elif defined(PREPASS_VELOCITY_LINEAR) +vec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_IRRADIANCE +gl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_DEPTH +gl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_SCREENSPACE_DEPTH +gl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_NORMALIZED_VIEW_DEPTH +gl_FragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4(vNormViewDepth,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_NORMAL +#ifdef PREPASS_NORMAL_WORLDSPACE +gl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo); +#else +gl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo); +#endif +#endif +#ifdef PREPASS_WORLD_NORMAL +gl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo); +#endif +#ifdef PREPASS_ALBEDO +gl_FragData[PREPASS_ALBEDO_INDEX]=vec4(baseColor.rgb,writeGeometryInfo); +#endif +#ifdef PREPASS_ALBEDO_SQRT +gl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqrt(baseColor.rgb),writeGeometryInfo); +#endif +#ifdef PREPASS_REFLECTIVITY +#if defined(SPECULAR) +gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularMapColor))*writeGeometryInfo; +#else +gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularColor),1.0)*writeGeometryInfo; +#endif +#endif +#endif +#endif +#if !defined(PREPASS) || defined(WEBGL2) +gl_FragColor=color; +#endif +#include +#if ORDER_INDEPENDENT_TRANSPARENCY +if (fragDepth==nearestDepth) {frontColor.rgb+=color.rgb*color.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-color.a);} else {backColor+=color;} +#endif +#define CUSTOM_FRAGMENT_MAIN_END +} +`;e.ShadersStore[i]||(e.ShadersStore[i]=f);const L={name:i,shader:f};export{L as defaultPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/default.vertex-BP2hbECl.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/default.vertex-BP2hbECl.js new file mode 100644 index 0000000000000000000000000000000000000000..def662894c265c913d961787e15b02a3d78a46f3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/default.vertex-BP2hbECl.js @@ -0,0 +1,193 @@ +import{S as e}from"./index-CDrXokXW.js";import"./vertexColorMixing-DUmDzlXI.js";import"./defaultUboDeclaration-D-7rPLB4.js";import"./helperFunctions-BkWNqKeI.js";import"./bakedVertexAnimation-BwUJBnNt.js";import"./instancesDeclaration-BAnfKLCo.js";import"./mainUVVaryingDeclaration-CYLIf35n.js";import"./bumpVertexDeclaration-Bd2S82Ce.js";import"./clipPlaneVertex-Bmw4TNCQ.js";import"./logDepthVertex-DDooPwab.js";import"./shadowsVertex-DbGd-etA.js";import"./morphTargetsVertex-7Q90Wwr8.js";import"./logDepthDeclaration-DbMKMukk.js";import"./bumpVertex-B5e3s1jQ.js";import"./pointCloudVertex-C-QHJpr_.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./meshUboDeclaration-C6raEdzf.js";const n="defaultVertexDeclaration",d=`uniform mat4 viewProjection; +#ifdef MULTIVIEW +mat4 viewProjectionR; +#endif +uniform mat4 view; +#ifdef DIFFUSE +uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos; +#endif +#ifdef AMBIENT +uniform mat4 ambientMatrix;uniform vec2 vAmbientInfos; +#endif +#ifdef OPACITY +uniform mat4 opacityMatrix;uniform vec2 vOpacityInfos; +#endif +#ifdef EMISSIVE +uniform vec2 vEmissiveInfos;uniform mat4 emissiveMatrix; +#endif +#ifdef LIGHTMAP +uniform vec2 vLightmapInfos;uniform mat4 lightmapMatrix; +#endif +#if defined(SPECULAR) && defined(SPECULARTERM) +uniform vec2 vSpecularInfos;uniform mat4 specularMatrix; +#endif +#ifdef BUMP +uniform vec3 vBumpInfos;uniform mat4 bumpMatrix; +#endif +#ifdef REFLECTION +uniform mat4 reflectionMatrix; +#endif +#ifdef POINTSIZE +uniform float pointSize; +#endif +#ifdef DETAIL +uniform vec4 vDetailInfos;uniform mat4 detailMatrix; +#endif +uniform vec4 cameraInfo; +#include +#define ADDITIONAL_VERTEX_DECLARATION +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=d);const i="defaultVertexShader",t=`#define CUSTOM_VERTEX_EXTENSION +#include<__decl__defaultVertex> +#define CUSTOM_VERTEX_BEGIN +attribute vec3 position; +#ifdef NORMAL +attribute vec3 normal; +#endif +#ifdef TANGENT +attribute vec4 tangent; +#endif +#ifdef UV1 +attribute vec2 uv; +#endif +#include[2..7] +#ifdef VERTEXCOLOR +attribute vec4 color; +#endif +#include +#include +#include +#include +#include +#include[1..7] +#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail) +#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient) +#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity) +#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive) +#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap) +#if defined(SPECULARTERM) +#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular) +#endif +#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal) +varying vec3 vPositionW; +#ifdef NORMAL +varying vec3 vNormalW; +#endif +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +varying vec4 vColor; +#endif +#include +#include +#include +#include<__decl__lightVxFragment>[0..maxSimultaneousLights] +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef REFLECTIONMAP_SKYBOX +varying vec3 vPositionUVW; +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vec3 vDirectionW; +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +varying float vViewDepth; +#endif +#include +#define CUSTOM_VERTEX_DEFINITIONS +void main(void) { +#define CUSTOM_VERTEX_MAIN_BEGIN +vec3 positionUpdated=position; +#ifdef NORMAL +vec3 normalUpdated=normal; +#endif +#ifdef TANGENT +vec4 tangentUpdated=tangent; +#endif +#ifdef UV1 +vec2 uvUpdated=uv; +#endif +#ifdef UV2 +vec2 uv2Updated=uv2; +#endif +#ifdef VERTEXCOLOR +vec4 colorUpdated=color; +#endif +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef REFLECTIONMAP_SKYBOX +vPositionUVW=positionUpdated; +#endif +#define CUSTOM_VERTEX_UPDATE_POSITION +#define CUSTOM_VERTEX_UPDATE_NORMAL +#include +#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED) +vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0); +#endif +#include +#include +vec4 worldPos=finalWorld*vec4(positionUpdated,1.0); +#ifdef NORMAL +mat3 normalWorld=mat3(finalWorld); +#if defined(INSTANCES) && defined(THIN_INSTANCES) +vNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vNormalW=normalize(normalWorld*vNormalW); +#else +#ifdef NONUNIFORMSCALING +normalWorld=transposeMat3(inverseMat3(normalWorld)); +#endif +vNormalW=normalize(normalWorld*normalUpdated); +#endif +#endif +#define CUSTOM_VERTEX_UPDATE_WORLDPOS +#ifdef MULTIVIEW +if (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;} +#else +gl_Position=viewProjection*worldPos; +#endif +vPositionW=vec3(worldPos); +#ifdef PREPASS +#include +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +vDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0))); +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +#ifdef RIGHT_HANDED +vViewDepth=-(view*worldPos).z; +#else +vViewDepth=(view*worldPos).z; +#endif +#endif +#ifndef UV1 +vec2 uvUpdated=vec2(0.,0.); +#endif +#ifndef UV2 +vec2 uv2Updated=vec2(0.,0.); +#endif +#ifdef MAINUV1 +vMainUV1=uvUpdated; +#endif +#ifdef MAINUV2 +vMainUV2=uv2Updated; +#endif +#include[3..7] +#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_MATRIXNAME_,diffuse,_INFONAME_,DiffuseInfos.x) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x) +#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x) +#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x) +#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x) +#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x) +#if defined(SPECULARTERM) +#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_MATRIXNAME_,specular,_INFONAME_,SpecularInfos.x) +#endif +#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x) +#include +#include +#include +#include[0..maxSimultaneousLights] +#include +#include +#include +#define CUSTOM_VERTEX_MAIN_END +} +`;e.ShadersStore[i]||(e.ShadersStore[i]=t);const T={name:i,shader:t};export{T as defaultVertexShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/default.vertex-BXPIbqz9.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/default.vertex-BXPIbqz9.js new file mode 100644 index 0000000000000000000000000000000000000000..1bdd23d329c3141d72eee95ecd378d0a2e8cf792 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/default.vertex-BXPIbqz9.js @@ -0,0 +1,181 @@ +import{S as e}from"./index-CDrXokXW.js";import"./defaultUboDeclaration-DefpgvMN.js";import"./vertexColorMixing-8t5JaWwM.js";import"./helperFunctions-CZpZ-EbL.js";import"./bonesDeclaration-Bh_c0MF7.js";import"./instancesVertex-CO_CTxxp.js";import"./instancesDeclaration-DZdrWbmN.js";import"./mainUVVaryingDeclaration-gz09aLXv.js";import"./bumpVertexDeclaration-BZI6C33v.js";import"./clipPlaneVertex-J3Krgsee.js";import"./logDepthVertex-D_A6gsii.js";import"./shadowsVertex-CygJ_RUp.js";import"./morphTargetsVertexDeclaration-BsT9JpOT.js";import"./logDepthDeclaration-DkdfQs4e.js";import"./morphTargetsVertex-DcRl6X3j.js";import"./bonesVertex-bl6LLSA1.js";import"./bakedVertexAnimation-DoavwM49.js";import"./bumpVertex-D9JGroSY.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./meshUboDeclaration-Bk1ASTX2.js";const t="lightVxFragmentDeclaration",r=`#ifdef LIGHT{X} +uniform vLightData{X}: vec4f;uniform vLightDiffuse{X}: vec4f; +#ifdef SPECULARTERM +uniform vLightSpecular{X}: vec4f; +#else +var vLightSpecular{X}: vec4f= vec4f(0.); +#endif +#ifdef SHADOW{X} +#ifdef SHADOWCSM{X} +uniform lightMatrix{X}: mat4x4f[SHADOWCSMNUM_CASCADES{X}];varying var vPositionFromLight{X}: vec4f[SHADOWCSMNUM_CASCADES{X}];varying var vDepthMetric{X}: f32[SHADOWCSMNUM_CASCADES{X}];varying var vPositionFromCamera{X}: vec4f; +#elif defined(SHADOWCUBE{X}) +#else +varying var vPositionFromLight{X}: vec4f;varying var vDepthMetric{X}: f32;uniform lightMatrix{X}: mat4x4f; +#endif +uniform shadowsInfo{X}: vec4f;uniform depthValues{X}: vec2f; +#endif +#ifdef SPOTLIGHT{X} +uniform vLightDirection{X}: vec4f;uniform vLightFalloff{X}: vec4f; +#elif defined(POINTLIGHT{X}) +uniform vLightFalloff{X}: vec4f; +#elif defined(HEMILIGHT{X}) +uniform vLightGround{X}: vec3f; +#endif +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +uniform vLightWidth{X}: vec4f;uniform vLightHeight{X}: vec4f; +#endif +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=r);const i="defaultVertexShader",n=`#include +#define CUSTOM_VERTEX_BEGIN +attribute position: vec3f; +#ifdef NORMAL +attribute normal: vec3f; +#endif +#ifdef TANGENT +attribute tangent: vec4f; +#endif +#ifdef UV1 +attribute uv: vec2f; +#endif +#include[2..7] +#ifdef VERTEXCOLOR +attribute color: vec4f; +#endif +#include +#include +#include +#include +#include +#include[1..7] +#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail) +#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient) +#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity) +#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive) +#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap) +#if defined(SPECULARTERM) +#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular) +#endif +#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal) +varying vPositionW: vec3f; +#ifdef NORMAL +varying vNormalW: vec3f; +#endif +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +varying vColor: vec4f; +#endif +#include +#include +#include +#include<__decl__lightVxFragment>[0..maxSimultaneousLights] +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef REFLECTIONMAP_SKYBOX +varying vPositionUVW: vec3f; +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vDirectionW: vec3f; +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +varying vViewDepth: f32; +#endif +#include +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs { +#define CUSTOM_VERTEX_MAIN_BEGIN +var positionUpdated: vec3f=vertexInputs.position; +#ifdef NORMAL +var normalUpdated: vec3f=vertexInputs.normal; +#endif +#ifdef TANGENT +var tangentUpdated: vec4f=vertexInputs.tangent; +#endif +#ifdef UV1 +var uvUpdated: vec2f=vertexInputs.uv; +#endif +#ifdef UV2 +var uv2Updated: vec2f=vertexInputs.uv2; +#endif +#ifdef VERTEXCOLOR +var colorUpdated: vec4f=vertexInputs.color; +#endif +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef REFLECTIONMAP_SKYBOX +vertexOutputs.vPositionUVW=positionUpdated; +#endif +#define CUSTOM_VERTEX_UPDATE_POSITION +#define CUSTOM_VERTEX_UPDATE_NORMAL +#include +#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED) +vertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*vec4f(positionUpdated,1.0); +#endif +#include +#include +var worldPos: vec4f=finalWorld*vec4f(positionUpdated,1.0); +#ifdef NORMAL +var normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz); +#if defined(INSTANCES) && defined(THIN_INSTANCES) +vertexOutputs.vNormalW=normalUpdated/ vec3f(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vertexOutputs.vNormalW=normalize(normalWorld*vertexOutputs.vNormalW); +#else +#ifdef NONUNIFORMSCALING +normalWorld=transposeMat3(inverseMat3(normalWorld)); +#endif +vertexOutputs.vNormalW=normalize(normalWorld*normalUpdated); +#endif +#endif +#define CUSTOM_VERTEX_UPDATE_WORLDPOS +#ifdef MULTIVIEW +if (gl_ViewID_OVR==0u) {vertexOutputs.position=scene.viewProjection*worldPos;} else {vertexOutputs.position=scene.viewProjectionR*worldPos;} +#else +vertexOutputs.position=scene.viewProjection*worldPos; +#endif +vertexOutputs.vPositionW= worldPos.xyz; +#ifdef PREPASS +#include +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +vertexOutputs.vDirectionW=normalize((finalWorld* vec4f(positionUpdated,0.0)).xyz); +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +#ifdef RIGHT_HANDED +vertexOutputs.vViewDepth=-(scene.view*worldPos).z; +#else +vertexOutputs.vViewDepth=(scene.view*worldPos).z; +#endif +#endif +#ifndef UV1 +var uvUpdated: vec2f=vec2f(0.,0.); +#endif +#ifdef MAINUV1 +vertexOutputs.vMainUV1=uvUpdated; +#endif +#ifndef UV2 +var uv2Updated: vec2f=vec2f(0.,0.); +#endif +#ifdef MAINUV2 +vertexOutputs.vMainUV2=uv2Updated; +#endif +#include[3..7] +#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_MATRIXNAME_,diffuse,_INFONAME_,DiffuseInfos.x) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x) +#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x) +#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x) +#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x) +#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x) +#if defined(SPECULARTERM) +#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_MATRIXNAME_,specular,_INFONAME_,SpecularInfos.x) +#endif +#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x) +#include +#include +#include +#include[0..maxSimultaneousLights] +#include +#include +#define CUSTOM_VERTEX_MAIN_END +} +`;e.ShadersStoreWGSL[i]||(e.ShadersStoreWGSL[i]=n);const S={name:i,shader:n};export{S as defaultVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/defaultEnvironment-5jBs1zfd-DPUnnTO0.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/defaultEnvironment-5jBs1zfd-DPUnnTO0.js new file mode 100644 index 0000000000000000000000000000000000000000..4b3d70e37ca41603d02b2b58c904b22f1077dac2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/defaultEnvironment-5jBs1zfd-DPUnnTO0.js @@ -0,0 +1 @@ +const A="data:application/octet-stream;base64,hhaHlvbWljZ7InZlcnNpb24iOjIsIndpZHRoIjo2NCwiaW1hZ2VUeXBlIjoiaW1hZ2UvcG5nIiwiaXJyYWRpYW5jZSI6eyJ4IjpbMC4xMTIyOTI0OTg2OTk3MzQyOCwwLjA4OTU2OTQzNDAzNTY5OTE4LDAuMTM0MTU5NjUwODY3OTE5OTVdLCJ5IjpbMC40MjUyMDE3MTIxODY3ODkxLDAuNDAzODI2MzIyMjEzNzkwMDYsMC40MjU2Njk1MzAwNTA0MTg2M10sInoiOlstMC4wNzczNjU5NDM2OTgyOTM5NCwtMC4wNDE1MDU3NTUzOTI0MjIzMSwtMC4xMTc4NDI2ODM2OTc0MTA5NF0sInh4IjpbMS4wMTEzMDEzMTAyMzUyMDc1LDAuOTQ3ODM3MDg2Mjk1MTM5NSwxLjA0NzQyMTE3MTA1MTAzNzVdLCJ5eSI6WzEuMTUwNDYyOTExNjAxODgxNCwxLjA3OTY3OTc5NDI1MDU1MjcsMS4xODUxNTg0MTA4NjM1MTcxXSwienoiOlsxLjAxNzU1NDQzNDk5ODk1NjUsMC45NDc1NjI2NDgzNTQ1NTQ3LDEuMDU5MDg0MTM5OTEyMTA0M10sInl6IjpbMC4wMDY0ODAzNDE3MTk3NDgzMjYsMC4wMTc2MzAzNTkzNjE2NTc3MjYsLTAuMDA4MTkwNjkxMTk0NjE0NjU2XSwiengiOlstMC4wNTA3ODMxNjkzMjkxMDk4MiwtMC4wNDAzMDk2MjY0MDc0MzQ2NCwtMC4wNjA0NTIxNjM3ODQ5NzA0OF0sInh5IjpbMC4wMzg0NDQ5ODQ3MDc0MDUxNiwwLjAzMDY4MTg0OTIzMDI3NjE1NiwwLjA0NTQyMDI1NTczMTQzNTQ1XSwiaXJyYWRpYW5jZVRleHR1cmUiOnsic2l6ZSI6MzIsImZhY2VzIjpbeyJsZW5ndGgiOjE0ODksInBvc2l0aW9uIjo1MjgzOX0seyJsZW5ndGgiOjExNzksInBvc2l0aW9uIjo1NDMyOH0seyJsZW5ndGgiOjEzOTEsInBvc2l0aW9uIjo1NTUwN30seyJsZW5ndGgiOjk5NSwicG9zaXRpb24iOjU2ODk4fSx7Imxlbmd0aCI6MTEzOCwicG9zaXRpb24iOjU3ODkzfSx7Imxlbmd0aCI6MTQ2MCwicG9zaXRpb24iOjU5MDMxfV19fSwic3BlY3VsYXIiOnsibWlwbWFwcyI6W3sibGVuZ3RoIjo2MDU0LCJwb3NpdGlvbiI6MH0seyJsZW5ndGgiOjYwMjEsInBvc2l0aW9uIjo2MDU0fSx7Imxlbmd0aCI6NDYyNywicG9zaXRpb24iOjEyMDc1fSx7Imxlbmd0aCI6NTM3MiwicG9zaXRpb24iOjE2NzAyfSx7Imxlbmd0aCI6NTIyNSwicG9zaXRpb24iOjIyMDc0fSx7Imxlbmd0aCI6NjEzNiwicG9zaXRpb24iOjI3Mjk5fSx7Imxlbmd0aCI6MjE2OCwicG9zaXRpb24iOjMzNDM1fSx7Imxlbmd0aCI6MjEyOCwicG9zaXRpb24iOjM1NjAzfSx7Imxlbmd0aCI6MjM1NiwicG9zaXRpb24iOjM3NzMxfSx7Imxlbmd0aCI6MTI4OSwicG9zaXRpb24iOjQwMDg3fSx7Imxlbmd0aCI6MTQ1MCwicG9zaXRpb24iOjQxMzc2fSx7Imxlbmd0aCI6MjAzNiwicG9zaXRpb24iOjQyODI2fSx7Imxlbmd0aCI6NzgxLCJwb3NpdGlvbiI6NDQ4NjJ9LHsibGVuZ3RoIjo3ODcsInBvc2l0aW9uIjo0NTY0M30seyJsZW5ndGgiOjgzNywicG9zaXRpb24iOjQ2NDMwfSx7Imxlbmd0aCI6NTI1LCJwb3NpdGlvbiI6NDcyNjd9LHsibGVuZ3RoIjo1OTcsInBvc2l0aW9uIjo0Nzc5Mn0seyJsZW5ndGgiOjgwMCwicG9zaXRpb24iOjQ4Mzg5fSx7Imxlbmd0aCI6Mjg5LCJwb3NpdGlvbiI6NDkxODl9LHsibGVuZ3RoIjozMTEsInBvc2l0aW9uIjo0OTQ3OH0seyJsZW5ndGgiOjI4MSwicG9zaXRpb24iOjQ5Nzg5fSx7Imxlbmd0aCI6MjQ2LCJwb3NpdGlvbiI6NTAwNzB9LHsibGVuZ3RoIjoyNjgsInBvc2l0aW9uIjo1MDMxNn0seyJsZW5ndGgiOjMwMCwicG9zaXRpb24iOjUwNTg0fSx7Imxlbmd0aCI6MTQ5LCJwb3NpdGlvbiI6NTA4ODR9LHsibGVuZ3RoIjoxNDksInBvc2l0aW9uIjo1MTAzM30seyJsZW5ndGgiOjE0MywicG9zaXRpb24iOjUxMTgyfSx7Imxlbmd0aCI6MTQzLCJwb3NpdGlvbiI6NTEzMjV9LHsibGVuZ3RoIjoxNDIsInBvc2l0aW9uIjo1MTQ2OH0seyJsZW5ndGgiOjE0OSwicG9zaXRpb24iOjUxNjEwfSx7Imxlbmd0aCI6OTcsInBvc2l0aW9uIjo1MTc1OX0seyJsZW5ndGgiOjk3LCJwb3NpdGlvbiI6NTE4NTZ9LHsibGVuZ3RoIjo5NywicG9zaXRpb24iOjUxOTUzfSx7Imxlbmd0aCI6OTcsInBvc2l0aW9uIjo1MjA1MH0seyJsZW5ndGgiOjk3LCJwb3NpdGlvbiI6NTIxNDd9LHsibGVuZ3RoIjo5NywicG9zaXRpb24iOjUyMjQ0fSx7Imxlbmd0aCI6ODMsInBvc2l0aW9uIjo1MjM0MX0seyJsZW5ndGgiOjgzLCJwb3NpdGlvbiI6NTI0MjR9LHsibGVuZ3RoIjo4MywicG9zaXRpb24iOjUyNTA3fSx7Imxlbmd0aCI6ODMsInBvc2l0aW9uIjo1MjU5MH0seyJsZW5ndGgiOjgzLCJwb3NpdGlvbiI6NTI2NzN9LHsibGVuZ3RoIjo4MywicG9zaXRpb24iOjUyNzU2fV0sImxvZEdlbmVyYXRpb25TY2FsZSI6MC44fX0AiVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAF2BJREFUeF6lW2uwleV1Xt+39z4HzgEVRKXmYloUUQTkokkbTYrViJYCIhdx6iT6o206vaT94STTNp1mOp1IJvmT1j9pkpkm1rZTDYlJVASOpmnTVoVURVOsBXQOOlwETbics/f+vs6znvW833tMYA7pdnDv8+3v8q7bs5611ruL1145UJetlrVbLSvK0sqiMCsKK8vSWmVpZoXhhb+LOI5j/h3OxRlF0fcPteGCysy6VlvfCqvr2vq4I06rzazX7U73a3B9zfvWdWV1jfvgc+3PqavK3/1SvNXG73BT/KnzcGF8l06MC+oKZ/oC/X7+VxzC9RWeMbr3jRoParXa1q/61m61rbbaWmXL5Stbba6+KDIFmJ/v4ocSXHFW9EJj3Xgv69pwTDJU3W53mEJDGAjCNVLJLasq6A2a062pRb2ogEboXCiXLxRTVVQkboRjOA9rdKGL0no9LrHYu+fVGg/GovDqdDp+Ubvdtio03u60XXNSQquF87HYyvAZx/EZD8Dx8AJ4RWm1e4T+dUIhlRXxXW3QeN8FKQxmwkLcyHE9ZO7VzfGiqK2seT2eAY3I89q4BuoJp4Gm3fN8/XHTfj8cFsf2vfyaf4+F4wSEA54IwaoaQpVWlIV7hp8X4dLvU3gpAedB0612y90N96vNqgLCY8F8vhYcvm3jErSuPGSgjB4eb7XBRHwoDEjDQ2j4QwuBgfub+bm4BtfiOVQlPhQQoS7pAbWlkIBFKtyosuLlF/fWZcmYx507YXkIDMFT7Bdl+owbwkNyfJDrSWHuCeG6EcsI9LIoCkSmrIfL4DjyUq6f0eEQ4cIxGiCcvEOxLEXyMggKwRQv7v4QFnrKwwNL4bnFS8+97Oe323TrFAZZ3AMPfKUtgCTBMP8HPDj29pv27M5n7IYP3+T4AU9Q2OTgpHDRPT0Ow8ge9zRgXVVVEWHZr+va3YlGpV7pFAg9RYtZ1UfcU3o/WlXWR8wHGnv8u1v0k2KK53e+5CAIBbibB9LTagCO0oWh4PQuLExABqX95MTb1u12bdfOXXbD8httoDOQFOSLqaA8YgXvQCH0N4/xO+COK64EcieRZVPr9fq+lmTx8DK3KNNDREB4Q12FkniLJv5r/1zs/Pf/qiGggM0BsNMOBDVrdzoT0J9eUlMJQNN+zw6/+YbNmjHbnnxqxG668WYbHBjMFAD/Jpakl3sQ0mCkvEBqxw2ltbCwBFPGkRV5nM4O5blggXLIZvQOur4L6hhVGbBLKdDD9j//dWfdapV+AbQOq8CCcHe+CmaGSCMOlp42WzbeHXfrYx3nTZthj2191FatXGO4n8AUrgrPgqviOF2Wi/Z8nyyop0XERyDjfGCUpzWl8bAyBKSQEUSuPCocl+O7JGzwCigA4I7w8Cz3Lzv+rQagKRVKOBAj+Lz+dmKEEHEsaFm/37Ox8ZPWaQ/Y2PiYTR0Ysgf/6UG7+6P32MAAQ0CCCmBz3FBoQOk5kUnhEUILSB3cIvY9n4enKBRkbdwLFpeH8DyQntoFr9wDiA3uTdseG6lhIcX04OBg4gQQVLF//MRxO378uA1NHXLv6Fc9V8jw1GE79vYxe3X/q3bs6Fv267euNNwDHkKIJ2i6MtziwSd4IDGz9F1mZa6d4SZLSzDPqbB+hvKwLm7pwlbMuBWUodgHLa0CAPt9/1x8Z8tj7mywGg502h1iAMAuUL9s4UaVjR44YGPjp+wXZl9s490x5zKnTp1yL3h4yz/b0sXX2PUfvN6mDg25EiR0A3GkuxAWVkokql8RfIsy4jWD8khfHgpB0/s9Whje40KHgMnq7vpQHq2M43ieQkafHRse+scttS8ETAKhADwoCleE4pcAiRBoWbfbsxd2P2/j42O2ZPEyGxoa8gd97/tP2UBnis2bO88uvPAix40pU6YQO6KmcOIBBWTxj4WSRBGwPE26JZ3zhIWZ3oTycGvlcY/nCAcJmCvChcW9a7Nur+sewWORBb7+1QfrgcEBf3i7TcTHwxAWEBhKcYUAGCP9AZQOHz5so6+P2mVz5tr5M8+3J7+3w65etNROnDyOgsdmzphl06dNt6FhKIhor9xPLkAhlFWUBgWKsCye3ev2EtUWTLJ4ggBUmgT3MImQQHZyPKh6fh6+A27huXiHEtwDvnT/l2tUZngYhIblIDi0ACB06+M9QFBA5ud3OvbG6wfsrbffsoMHD9p1H/yQ84GjR9+0ffv32uzZs21o6rBddulcrj3in0Iyk7BYCRYXisIzPN+DCwTPoaXJKXAjFjtmvV4v2B/zfg8x7whf+XdMe/G56rt3wRMgPAqi4otfuL+GZRH3cEXFPRYHZdDq+ExajuMAP6Q0Mr62nThxwrZ862FbcNVCm3X+BTZr1gU2PDRsAwNIn6LZSIOR510ZUADCjTVEAjknTaUhzgVo0h6YnmKawOaFZhISSnGFeL6HsAA6Co/rYBxcg/SNv10Bm//q86kYgsXl5rCwFkyvaNNLIiRcaXEOPj+782m79poPhDCsFXCdp9OIefeeqO+JBQ1lZfyTJ+A4K1F+D0H4HQXL3R6fuy4Qkd+VAFcP0MNnekLPFYDPOAYM82f9+Z98pp5g+XZTDaryUwgICIEHSm1Syq4f7rRlS69hqYZwgaKscC8QoWXFScLlhMirx3ZYm9iTFy94BkCXwAglIDRodbcgjkUGkJUhnNwbSoSVEQZQEj53oQA/RoUU9/7xp7wEoaXYqUHsERAhTGQAZIiMGMEjcJ4wY/eLL9jVi5ZEziZ7U9PEmaSnOVJg4YiDoyhr3Ns7NyQLHtOpkouOTp7OIADxoIlruToVBCHHaXlXDIV2ZTgI9qz4/Y9/InWEyPIaWgyLwZpQChYNAWAxx4JIix4SZWn/u/cVu+LyK6Mxwh4CUin7CrUNiE4DBwLAFP+eJh2xAXxswym+HeEBZCEow4BKgiWF7inOe3RzKgVW7/k7FDc+DsGVAaCUvhW/dc/Ha9xMpCRVgS40vaGp8bNyOPqHjuRm9troa/ZL75vj5/O6poeoc8Qn9DyvD8DywhOYKJj7XRlBmLBQ3A/Wk+AiNzxWOR3HC7FN6/at2x3z+7jVe7oWIBltB/CSuzZ9tJZbUvtIL3nNz24R0TxrkISAdOfSDrw+au9+13sm5HoJjEBFKDGLNMjP6o/NTzE3/xzdG7n/hBzuQIcUFpas6MqwLl5QBDxDLi9vYqXcAKx6hcX6tXd4/8y7tPGKBmeq1mRBFS7yFmUMPOTwkUN20YUXuXsrTIjs9CBvYAgHvOPcSlZWVegMTq4ONuhgyTQGJcq1iQN9F5LCUgn+z5seqhPYHRKANpYnxngxdNuqdR4CLFyiN+U8m3HJrBUNuShK2DFu2tUQ9CfHf2znTD83kSbcD/hAoXgPhkU0QiLHkaY2bSwt3jMA8jRa6SEkzpXwuC/AzAuewA5VeF79hZs3945OcmrkRat/7ap1ngVykBGBEAHRvdSU8ONRmip/I/amDJL7exmdtdRccGCDevzhDd4U8eqNhYospL+drwPQgvrqeHQ7uYxoeuCzrC+DshvMPpt4R5PSkd0KeoCvOdKRtAwmBgBhbU3OzfvRldXY0DF2fdC6m9jGcrcPbPHCBw+NoYtbP4AP3uf8PVV2GmQ0nZ+GMUbrLARU/08CCzuUvUTpPd1HFlOhV6xbs6F2YWCJd3RLUNSkvAsBA7EduVMnhi7tORX9w6C7LHQIprKIYwiKLq811BMkIkPZuCebHdGsSI0P5no1N3RvYYI4Bmkwan4qVm0771BF2GoC5kaHMW5fs752y6WamQvBy7kzXDNIhciPCAx6iSpGsGgSnwjuwIim9I2aXziQhQOJT9PFhYIlBPt5TR9fTBHCARvU+tLUp/EgZjMIjxfrF/YzdbxVtq24ffV6T4N+wz4qKxAIahIxh1Bg/c1BiDSLd7cYFuvlZt8GBgZTK1oZAgJg1uDxGSmOXCNK5BiueAdHuvOOMENAhnEvwj1CcD4brTk2R5oKEfQZBKnvbFbvLOKaWid5KEIANxUIIQz8ppg7BaHAOwkO3dl7gyGAABKeAEHZ3W7OdfobnRtXnjNNEh624ZquDRupFFrA5x3fCA9PW5G+5BnM8/QSGAKhiLXgPBhERqInsAT3Qg7eirVtWHsHMSBQW2wrPTQ0jAWxMcIOscCP15U2NnbKBgen+OIxYxgf76aGKhfI8pegx//nCuD34AZMiy5syeIHn7FgGUYC4i4qjvDOsCDfF/6oevXULQyKKtbXBSKkTo0LHR5Al6Q7yc3UE5CFRWOxkFOnTtqUKVO58FBQYnoBhszXnDo7zrhHwZWjOZI1OnEO2B0UjvrdQy6aG+oIy0s5nwDVZdtL3SVnn74Ydp5Say8A0Sn4xtvvTEOnvNJiyci4pAI4PssxgJhAF8QiO6gQEdNRszN0oskSTNOPhSeo2wvPYBwzZfqIHA1SNwhTMTEqUnLUCvJEcIWiRL+SjQ4oBAWQshKKMqxLPUkP5wiHYtP633QmKDf1oiGaC15Xq3eG6WRUgHIvJ1DRqsJ1GKggBqEYuKIzQVR+EevcgBHcJKzOZ/NcuL9nAFc8ewBaFwA69Q0xOu7C5QvrjndTSlX4ep0fIaW07A0dKEF7H6KYK+5cf1ctwiNkx4KwMC84si6M6n8Bi0CJ3Zo+C55IWWJgPhJLrs6agMRIu0NIdEStOQBh/68BvVBIDDNYKgMfuo4NXhOgceLFWstOnDjubX5hB9bk0yml6sLcWP7cOzfcVcv1FeuO/oG8AhkIr0Uz9XGGIOsiXvOJEEdh3PEhKxJpGZYaliolNmjO54iBqjWG+3tVqhIEtQCKJHlvlO2wvleGEDpqEQ8BeKF3vttNjwPL2bT+rhqLdItDcEddTlPgcuD4cG+Oz5opDxaGG8vloW0KrL09tGB+zGu9aI5oQqPyGIpW6CjVMe1ObIHjecIDFkqwfJnCBd4GQBZpU0cLSlUP01P2wAD7HBvWbnL8Yc+cxAYaJKWMIYIzQ8ayOkGwEBb87Ucfebko7Atmdsv+fftX/e7v/F5WL/B+DAsKIjamnKxjIjPI5UyPDIWGikfoZKHJ+oF9QQ06PHyjswwB1bECngiQHWxRo4B3IAuw4UAy0TQXIyVG84F8mv82f/4+u+qq+X9ZluX30YMINJ5tZm9EtfneqqouKYry3hUfuWXYt3oEAdIOBg+DbKeZgFhs0/sAANSoP1j1sfQVbwHqo/dA0CMRYrrkNMi91lkuQ8fLfYwBvd3PLUDFhrV31tK0CIaDTHAAYgCzxMhT2/cZrf1i7PdRJsK7FJAfw+dpN9+44hGFQ8KRwAf2GmIkBsLTRhg1WQlemKa7WUixUYKmKPEEHEG1AcKWgEx+oYwApTdEjh2uYsNtm+qm0cCbeNMxOjN4+OPbH9tWFHa/mR19p3TZ36dTAPT3wEduWnGxusGOhT4q4z4CVXFy/bw34OvwcGs7Frnb9zgbEKdUtuIhKo+MlPsSMKN0ntLppA1cGgAX69ZsdB6Al/pq6pziwVu+/Q0bHBxYrjr651FAr9drfeIP/mjbnv/eE+mOtUKeCpVZYBWNuSGo+glYG9YAt2f9rxKegK1xOJSiMPY9DzHXjLkce5a+aYPMsFi7ar1jAF5+YRQnzuYKs8e3PbrRzA6eQXB9dXoP4Bnzb/q1m/9abTdYgNMcPrsZm2keFAgfmUDEKEYGiQipdlDvD2A4NjbmcQ6P4XQKhQ8AEdVj5Xue5I3FujV31KqgoBlnU767qm/bRrY+YGZ/Ownhz4QB+eVb5vzipef6vsPI0QAp9u+aGb4jN4hOv0e3DaHwGcec6gIAsas1shUsi2Pavjc8PGzDw9PSwMdZbDBTESMnQmtW3u4eAOEVi/SGrj2x4/FbzezkWSjgTUTSGc5vXTrnsm1ei8ckSM1Lldr5tdzSFnv6Ikx1niN4tPHEG0SStH9gyuCgnXfuDCdoXmkixbZK5y+sGAsrVt16m0+GsNOD5SgmKGO248ltj1lh901SeJyGGThS4v4zXXP53HkjwhzhgDpMKrl1vUiVOIIKJl2vIUr6W52l2DCh4gebOKZNm8YBb2zzVTnuIHjy5MnU1zty9Iidf8FM++53v3Pjz0h1p5Pt/ddf96uffe8l77EHHvja8jMooH353HlPKN5FvCRADIViSKpd45wVEOCziU6M1RvlMCuoQaPzFTJQNsJi+vRzvHHD8ri0YuWK1V4LoK9/6PBBD4OXX9nz22a2Z7LW33zf5pEf/OA/7BtbHnrYzL54huvmXHnFfGJKbJbIrS6A810eXiDxTqwouaFK5+fdoVw5ORVXUaV2mcJmxnkz7JxzzuWw5sPXLa8PHT6USMQnP3Wv3XPPPWey4k/Jt3Xr1pGjR4/Zxo0b1pjZW6dTQFVVyxdctfDT2rToIaBdoeG2YUe3JCdUbJ8l66ffAFAx/I4bzpRRpBDS6WYzpr5XaMyYMdOKyy+bV0PbetiP9ry0IqO3k3WCJned6YraPrlgwaKb6aocjXs32BepH0tMvEG+w1szB80p6O6hnGz/MO6XeooTNmPG5iqfR8RobN7cK9QQ9KLixR/tPhvkn6yC/LxvbvnmyJ/96af9MzvEFF4V4wTerx87hA94ulRTNNsm23SDm11kPqdwCs3KJPcMtuz0o4vaiisuvzLtRcGFu1964Wkzu/esJJvkyb/8/l8ZOQHApQaaq1JDhO3wCa8gQu4h8V1KgZEKaXFyiRwP8uwgj8vDyZdx5bz5HI1FXr7wogtt+45tN6S7TVK4yZy2eNGSkdz6GlxyeKLlsw/RjEtjvhcLcqFiiiyv0Llqoef4wb5DOHnGK7TeYsH8hZzNZjH0/O7n7jazfZMRarLnVJV9aNmSpX/h7TO3HL1AIOUhEb/n0T2dMMWIXBPHfPOUFEGlNCsRsVPdrxlkU2Q1kOUKeKfLbf7cZ23FihVnlQnOoAg8bfXSxcv+EA9iLUBkd6/TmCTtEWzAMMVuco9m9JoUEakxPT+srX2FCXBjB6pANyl+wVWLPI9waBAjKyvsh8/tugXt/sla+DTnwZf/ZumSZVdM2A/0M04mnWX1p8afFplye7iBNksy3rknWFvMNCHO2aIyiZqiaPu5AfDfQiggNkHkwLRz1zNfLcvy7/4fCuiMjh7Yunrl6rT7xIUE6kdXOKfECkM1SRPtTSkzgDNZeOJvaJRK9XMY/YgLf+Pl3pT2NOjnc2bF4kVLiJ+RGxUdS5Yutq985cs/LxiWo6MHtq/+DfAiTmUYz802HNUBCYxiYKpNDtxk0fz4gSjuwNH8Xkj7FpQWRZxikJoodjxExMgVEhmkuHrh4rQVm9tiIs6KwnbuemaDmR06Sy9oHzp06IlbV6xMACfBG6FDlLRHIMhQdHfp2twxrrRGWiBGyKyRBjPa4BEKYa7PaofwgPyYewSeDw8QKUmcMtDg2V3P/L2ZfStK3B8rE8UPIX9KL71er9y/f//2jes3+Xdqo3taSvuDCHJUiprvvJWGphSUbE2h0Twskl6wwOa6hhqrIoppW6a4XIm8sli8aGmdc5K0X9XMZs6cae9698X2/HMv2LUfuNbr6rvv/pgdOXLE1zNnzhy75JL3jdd19bmyLMde+Z9XPrNxA4X37SkxJndh8xAIzOFQJVw7s6gzuZgoK3Wln9Z4IDdKEJjJUyhWlvf1y5Fo7es8sdBi6eJlKQ2q2ZAaDC6JfqkQMz1VaBN+9haIGjGe9hnGNhRNkx3fYyNlnv/Tc+N52i7b9PqyvUkRuyp9tTxOmTmJSoAYP4+JeGgIUQxeRx569mOugKYb02xYzmnlxNgNt230kjZOkE020yNtSqBcBDV/j+ksM14wgawgaur/+NVX3hWa8JsDBUbkx9jnlI5mnCD/eaoywiP/8Mys8AAKnrel1FgQ+LgSYgOzbqZ2lmJdOfydoJf/jXM4MOUy0x6iIEYqj/VjJ26ViY1PWbdjAsIT3YIT5CVw85O6Zldb82OLR7709PD/AV0YyoiOxdZoAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAFz9JREFUeF6tW3uwVfV5/fY+59wHai5cUEdrUdQA8lDeURQVkKeotRlSmRqbaTOZSdtpm44zNrEPJjP5I+nDWGMzaXV0EoNRJIkTsYljvbaKMcYoUpAWJGmtkdhWBAmX+zjn7LrW963f3gcfFztehrn3nrPP3r/vtb71rd/vZi8882JRq+WWZZmZZYZvWZabWcHvfNnM8tyvyfIMVxk+UxSFv8efzXL/ML/jularZbVazW+Au8fr7Vab98NXUbSt2Wza1u8/ZMuWLrMJff3W1d1teGy73eZn8H663gprt/Fcf7auwVr0H6/hPxbVjjXqNb8G7/v12fand+Eyy/NaOMGsXq/xBvV6nQ9ptVtWr9X5PhaC9/I8szyMc+eVDuNiC6MT9IXX+MAsSwuFlXDW0NCwPTbwT/aRCxfaGadPtgzXhhG8HjcrzNpFOzmShrThjBavh1Mtk3PcMXCcnll1AJ1D5xeW7fjx7gJRchMqkaaxyAj8LzMB18oJnjk5F6gI1bCYwiOH/7VanR5HduG7roNztLjBI4M28PiALbpwgU2cMMly3BORo7Pa/BmvYeGMfdyfwWm1UiYoI/CM0dFRWtRstrgOfBbXMlv5M7KgZRlKgNGGEyItGd2IWA2ZEZHE+zW+F2mNjI8Q04nhDJUUbMDDaGjuzkCyeOkU7hwr7MDrB+zpH/3IFi/+iHV1d1lv9zhrtpD2uCfugVRus5zoBEQwjKLRrZa1IiuxIhiK/3QcS7HNLGYWtf11lAauyX7y1I7CI+ORxQdkFiNY99JgXcd/WI2fWRaVSOp9LwmuMRmhUsDDYYicgGvfeOOg/eCRR2zdurU2NDxo4/v6iTOIlqdyyxqNuo2OjHI9Kgc5A+5EuruDWo4RGRzjzsd7viRkgjunCePx75l/eY5oQnDL3AGe8l57jcABr9c8rkM0aw56AW54AiJ/bO1XAVT38NR3sIXz4YDvbX3Ifu2aq21oZNAm9E1MpUd0DW86frRttNm0Rq1GI5jWuQOl39ed5hngtY7s8Ew0ZpZjR2TmE48+TQxwlPfIwlPwPl8TLgT6V7sBHKJsUNQRKa25LCVggqO+G+POJJBFCWz74TZbsuRivtbb02u9PeMc/Igd7jB1HRnIZ2ZmzdGmGxpGs/SiKwALFMzq51rNJssge+wfnyiE6GpjSA10AuGAnKHUdVzwCKo82P4CKxwPfOHoJEhhZAfvx26RMQpYPBZ4+PBh27btSZs3b6719Y23dtGycT0nWL1RZ0bhM2p3QnDYPhqG8708s9GRkQSs/l7B6OMeyBCWRaVFsgwe3fo4A4aIsLcD0cMwLF4Rd/R0g9QOhf6O9oiw44SwJGFGlBg+nzDDMhttjnJhh9/8pT34ve/Y0eEj9rH11xGQkQGo4Z7eHpabOAXAsJWQHR0gI8Dh3t7fPdX9NYAf0t9BVBmgboELs4e/80jhBAXpDtDL6QClqRtT1j5+RgbwfXYNb4HiEXAUiygAky0TCJ7XUrvEeyPDIzY8PMQ63rN3j/342Wds7pw51je+jwb3fWi8OwEcpF633t7e1MKQUXiuGxR13moGf3BH4BoCHiIOMGQqFXyeHIDukW3Z9GAB45HysArehwUiQVg4jWKUcY0IT0ZkVlS9i4QjlQVRo3igHAAnv37gQHSV3Hbv2WXnTDnXdu7aaf39E+y86dPt4Jtv2P5X91t//0R7+b9ettdee80uuXiJ9ff3M/peFCQErGMYqOiKLBEPosyQZTBW3UIASGzZdPdmJ0JRw+r76NFqfWB8nuLe2ur1Bn8WzVXnUP+Xs0Sb1YLg2L1799jLr7xsJ598sp104kk2adJEGxkZtX0/fYn3mzVzlh0Z/KVtf2G7NeoNmzZ1up086RRP5UB1tEMEDPgBxyOTAiVTfyeTRMRBiIIzOFt0sEyAePff31N2ARQBCYsDIFyG6Ot3ZYBID64Rbe7q6gp27lRa7I2OqlJrIr/ZoUMH7Wf/8bPoGIW9uv9VOhnOO+fsc+3000+zRqPBhTYaXal1IZrIztHRERootB8ZHnYeUBQsL2ENez4AMKgvOgZW4BnStuxrt93pGBAprlQW+Ck79D6dwTp3sCMhYvl43SsrOrKgigdgbBmAC63RURlGIOKIzrw581N0YUQVuMgpgB+IfHwPyxL7w3NR5yUXwMzg2YDyERgyG1DOt3zptgLGwNupzdVq0Qa95lkOAsLgCOD8aoPuJC8JRFeTIsoJOIEFqbRITbkQZ4StAC+UBp513vQZie8rVZEmTnW9E4nNOQ444ivKanPOEgt2GjkcOJBAELiBmeILG79YAPgYOUQwUWJHfqQbgTEYDI3F63E9bu4OioyIAUoGk/rmOQ3AvcTPUfdqs3jtpX17+d60adMTuKGbDI8M+0g8Chpc9xYI5jfaTLQXhjCdYwgSKxRnqDqlIzMAgn9y481FV6MrRVmG4TvAT9Mb21/8nthg9H9kAoz0LHFGmUgU6HWQINUhDFVfh+MAqntfQgaYTTlrSvosIkuEZ+8v2xzoLJxDIlOZ9NTeUubEjCAyRcYYjNJZo1n2yd/+VNHd1W093b0cbrAYGEqDKgCImyhLUvRjMhSNTt0kpkLWrMqAA4ljjRwRacX7vvzKfzKNzz7r7EB8Z4yc2GIiZGSDHpPlYRaIuvZJz1Ee2aL2KNRPvT+EEIki2XW/saHAkrq7eqyrq5vf0X6A6jSAQ4+i74tXNog3SEcolSVnlpqVxSnE6eEUN8zvh4W/uv/nNG7yGZMdIKX5oM+HuCFjjo26xBGOvPEFx3DS4OcFhA644gek0Os/+rGCQBRUuF7vMmREF7739NCQYzuC9ADxew1QAkJF2MsHEFtOm+rleM/B0TvJL17bT6ecftrpyTGSwljDrHMfnlJtBwtMv4d4wqEpFCQZrNbnUYFjHEGza6/5aJCq8A5FhNx6enqtnteZFQSrDD3f54AqzS3JEMZQILvrg/iOhQkLqp/zGY9YlybQ//nf/2bsTjnlVB+AQvWh4hOSG+d8dgTPHr4Xw5IyyiPu84DKRAHxzCm5Ax2wbu3VvBRoLnqpVAK6AxfQIrsa3TRGziiHHo6FHdqAUpvRj67gLcylsuqXq1CFHTjwOhcO1ud02zlANJ/g8+4YkR9lBbtECKckR8EtvORcEXLBr7xnkGnL1qy6spDEhCjLu0pVeBKgB3CEI+AQl7aqk18MUiFZuUbgBotbyLklCHoaaHA69OYhBnp834QOwyNhk6ZY7SRVsdSnQS8Rz6ByXvBcUPK7xMZugOl0xbKVhQsNFYEvQkRpOgRNESInNw0aqG5QZYVe8ZUvOIpA54uj40LkkFiKVjgy6rN8T3cPr5PjpBy5HlAKHQI43E/YkL4L6LCMyE7J4xJVkPGcYFcsX0VESLKR1h6yTtVzDmZSioI0UVF2BUmGiTtE003epwIjR7P+PYvg5GYTKq5Zd3dPRWQJ6Vqtk+CFDuEagAMd8CAUY+KG/+wO8wGOIB5rRwClXXCIW71iTUFSEO2Ic3arTYT2ektlGJoBHuqRTN2B6q07oOz1pTDqYOcKkaQwV948G/AzSU/RZgdyYUVkykWNcv53KUt9PIIcwqeviQpUEDesC8OUOEq5v+FzS7Z65doCHJnEQaADfa3ZdDEhxlASmhiDlUYeTKfLLqiGMELbYnwOz6sdqgzwOxYpMMJ0h/uNgwhS2UCBI5qtUecCrSZnB3yvEh9OrUGDXQ/06GO9yMxGrUEMcwrvSjaezTXJAXA5xQaCg+vumLe9p3q/gqESNsgM63Xy8TzzWaLEgjL1fBbAmOodQHJbyohQkh0D2jZu3AlRhI4ZoK9wABkeJTR3RsrYEEWEBXIEfgdYY13sZHSG/yxpnYFbvWItQZD/wnBEXw9QX8UNmUohh7HGVFfk+9o/cM+6dObcQLM5OUNESy1KEtrQ8BAjf+IJJ6Y2h2g7gcHg0yZQtto+26NMcT/PCmj8LAY6GoIJMgBsFmCHdSODfbDzyVZzTbZ29TruDFUFRKUlHkJxEepu8IEqscHnJI74/OC7S2ptToxizzEIC8tEW1++ZmYGSgDfgQG4B40PIRMjrYAyMULqe83kZGFC6RA33OcbzwR3hJeGY1hm2ZqVaym6c2eFHN29zchLcSGjq9GjYn6l9q/aF2UOUTUSOfEA7uhq38EHK0Tfaxlzuu8Ag3k6eXFZG2XImZ6tEiUZmx7B8xV9zvmBY8MjI7xvT09PRNxbd3XYUxZka1etoyKkNqTdE/WuKjBibCZ4YbyNMZepGPI5DMRD1De8Lv19ko/QFMtOUbZCpDe+sCkiYZNgx5E2QBCtMrLFA+TzAUuCEniLkyA3QyLSJHCp/h3Ima2BD3SAjCTohH4mFdUFjJwAiQwQFUbqihHi8+wQseMjHoASSHpCZYfZ25/nv0Zppnm7beN6x4k+eGYA+FgOMf5yI9SnPmWrsgeGEytGRrhOoD+eBW4BPFIZIwBwDJ+9ZuWVYCcEFbackJ1VFpScYnStNxrW09UdiO5Aoq7A+g9ugNdhPJiiMzZvgmVvL4cgOQPKj4gQW1TohS5utFgGmgFGRoaDG5ROUAYgI4aGjjI4yFgiPUorfkYpi80yBOvWXF2kbSM+LNqPhot4DQtCfbJ3Yz6o+40omVcOV1RH5dIJkeqgwEGHPf4ORL7JCQxAtHpjXO1Mbam7AkbhFLKBKR+0HeiPDMDvKk2yP/yPqdZLIFo3MqBaAklhiVbj9eybIcgA3JjaHhA+xuM0EgcZwvvCBpQSjU1nD8oN12orlFwNsOITA9BIr6M01a4ZbRI1l7XIRUCEgBGF2dDQEO/hM0vJX9I0G4Ku84CVa9M06O1QG5G++Ug6zJ0djMIOIFgUOoRUI3ED0UyeF6Kk7fqAU9uQw0INdjD1Evn6N+/aneX2N2b2CzM7c+Cxf/7KXXfcndQcH43jYEMwU9/0LMgNqm0VThk6OuSZSd4BHlKO8dQnSY/h6MyyVVesTsNgan+xnyZs0OTFNtJoWKNWJw6QXASiykBfrJ/McNT3MwfOBmPKaxf25dv+2k497ZQ/MLOdMa0i9/Ghwfg+tWjbF67fcMNEZYo2OR0LPPLHiiMSRFkqwV8YjAJnHTyAouHUKlatWMMSIKnJa37QQFpabCr6ZBXIGWMko8ddmwadAtHBR8w4TRbnDDTOOgDWbNP9X/+zPM+fjF5Z/VZ1QOfbbVvSbLU+f8NvfoLrw7O0qSLhRGtUFyB5Q6mak7jqusQB+Bk4gBJzszxXQ+oaW8oaipA2IBbeurR9FjtCor6RdmKIWCg1vzh2c/+We3+S5XbjOxhPClDJgLdd0mw2s833PfDYtx94MB2YwJo9O1zwAAdwVunM0blKKNxx5im1a02LK5evLnSmD3fRh+EUH0O9DTqANNKY6fzAS6AT4DD2epcove4z+pYH77sCt/v/OCA+M2P9tdfdrvUIvHXsReDJIa5yzsHnDe2A++YuSoQguGLZKh+G4jCR1y2M9j11UU2Nu35SzDmAi5+loZLPZaBPZH7dA9/91qY8z//hXYwfMwP0uSef2DZwy1/dmkQPrV2lQKY4MuLUntOrrxVf2pliOXMszi27fMnSgm2rcN6tG5H96bhZTImsdzC+dNLLuwNH5dANERUei2k1ST6wwEUXLrTP3nzT0vcw/rgdYGbTf/3q9V/FczT6aq24CV4fHh5m2ak7qFspIMpMfr9i6UoyDu6xR/jZZ6N/wwAwL4iWopjwnk59wFD9ziwBEAZAgjgdPTpoe/ft+aSZ7fuAHGCbN28e+OxNn0sRRbTxLO0jAszH9423E088KU2oDoShAknaRxtcdvkVRTo25nIq29ho09MIB5iODB4p9wOC1GhGqEpd+hnf3ZlmDz+81aZOmzpW9HH1uADBI2M4Cm//ytRzp90jZUoEKYmt1DYKiisT+yda30njfXROh7d834K/X37pslCF41SnmR09epSnNAYHj3SIi1J01JerhjLdwBiD9CBDpk2balsf3nqtmR08DqOmxTXIFB8D3+PrLQz+/PSp05fICZogtVFSdcb4D02w/gn9hl0vbNcTtyCeooMsvWx54UdNXIRAxJHu3D6imlMqql4h3nMSs2OwXb3na5LFs8xmzZphW769ZZm2+d7DnjMuWbzkG08+9cQLb/n/JlTkWA4AOV0wf+Gjb7552DeOgj4nvTIEGGZqCDD9EyYa/nd3d9M2qliXXnJZgX4KJ7xx8ADrXIamc4PxBP2uxXUYzNLwU6bU+6mnZ/Zv//7i2BnQtssuuujijb86+Qy7f/N9v2dmLx6HA3DJVedNn/HHrlv6I0V9maUakGIfQllyyqRTbcL4flef5s9dUBw8dDDpAMeKFXJGh56vU+Qp2qH5hkqsaCCrdu3e+Tkz++EYBk38+PU3PLB48UX26d/99Eoz802CMb727ds3cNW6q1P0hUH+gm/qqBT0nuOF73YhG7IzJ5+V9gZFaDSBpS3uOPsvJ1DkiP2C5KC0eRF/OBF5v+vFf930Fmi9V/+XmZCDYbin4NhftYULFj16dPBoue1V2RpTbFyLKLNDOoPWn005cwq5JDdHY4qjSFHZwtIpr5TyfF9Kf7npke5TScU//4s/tfXr1x9PFxjb5M4rps6eef7XPNiR/7JU+36xGYNrqtmQPoMqnXLW2YV2hiVfSd9/W3TDndL21Qp1HWuxihcBTDt2vvCBO6Ddbn9izvlzf4vETX+QEUNbwE/aJPVrtL/h6aAEzs45+9x0TI4pH1+dKO8veqvzlEotUNeH4JEk8QAhXLd9x/MfuAMGBh4f+MwffiadIK9mAes9lC0GJ0DQE7OsXQLlh8+dWuhPYtQy3m6c9vDKnV9eE6qvqCUe5VzAv9QRtu94fsXx9Pb3UQNdF8ye8wMFSZoA27P+gENGR1l0kKYQejkOT/3wNJ4TFFKQ7MSenTJCDqluisQBDMeCxPy4f51Ohcjj23c8/3Eze+V9GDjWpefPmzP/1mRUXI1STuVQacX0QQx8scfOTzBYcIALmU4YOkogSJBqXAquDBYjLDHAIaACBUzAZ5975uY8z58ay6r38f6GeXPmf0oZWMrskeIJ9r1etXdQXh9lAQecN20Gc/ad6p+1pOMzEdlI7g72JYf49/LpctBFiy+yr9x+2++Y2U/fh5Hveumdd9w58He3f7WsZ7HRjp5XOkMapjIh8QVk78zzZnEWSB0g/nagep5HtSZnlE4o//TNXxNE+sN1wlzCxbPPPfv0Wz7aeJxU990c0L1g3sLv400gu3ewOPXVsa1e4pVK0SlQ4s2OUzNnzCIIkkIGsOGNjj+ICkAT369mgdehDkA6wnrknRJrdmD6vbX9/aW//KItv2L59Wb28/eZDajPyWZ24/y5C2Y6bHmGOuqXB7BkqCJ+7HOqgJjNnnk+V00WGE6QIzp3eYUPnZ71tNe5OwFi+TudFguVc2ZfMMvuvuuunZYZVOEKp3xHl+DIyOo777jzj5D2qveEP/F8DWFVhahKjXW9qHDiTHBANf39AeV0p5TxMqCrOs5ceQfx42eSwqtEQ2XhCxAau6FXXXOlbdy4EWT+8DGmw9tnFIX97YbrNvTt3ftS4h5V4E3ZFsGrjukytBrU6kZv4jMXzJ6TIlA6ovzrkE7QcydUDziqBGSoe708W+QbJOXBxXIoccz48q232JJLl/y+me3GC+12e1Ge5zcunL9oEhecNlJjJQG0+jNcsU+le9qYFfN7p6SKkmE455w/10tAFDZOdfiNYsZXn48NzirSe/27U5IT4qdqOvLwour1mDNA2Eb75rfusXs33WtbH3o4HaiqrqvElrIEsUYBoTRCtboqmdOYfOw9KIjMvWAeqbA/zI+6C8RUv86uYkc3sT2dKyy3vOSC2A5muVQBx4NRntN9O2BCPocErz/O0ufl5LJbVY2R849tw36NMieeXqHCuP7/AMWVEhy/7HuGAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAEc1JREFUeF7FW0vobXUV/p3HFTUjsIRAJe01qCC9T23QpIIgMKKBOIicpzjLgqIiaGCTwKAG0SxISEivpvhIg4QmDQwSC5xZkfT3eu/9P85rnxPf+ta31vrte23WvX+49+yzH2fv9frWt9b67cnpk2d2u92uTSaThs/ZbGaf+N4a/nGbx1uz3Tji36dT38G9PGjH8zu2d9tdm8S59Zo8n7+vYzt/jql98ub80K3wm3g+/MV+2+b+rR3n33a7je0drrGf3LYJFFCf2sSOh9B2KoLCTU3AqpBUChQ2jZ+kAvEdt4Ei7X9/bJ7GB9a9dnZ860bAg0+h7FC6BM7H1vUQzJ7UhKMCU9j+Oghvz3/qxGlTbbWkvAEPzpvLI/iQl/MGWcEELApMj3APkiDhX0VXxXNkRXmVnknC5lUQNBUJhfFcWrxaHkql5k0tbTtsqYCxxSWkQgA3nU5hdQgPl+RN5IvcdiXRVGHxallTtCu0hos/flEswzF9lg/8bt/DA/waWV/eJWXi8BaKMc+gq0QIpJumlVNA33KhqxdQwLR6de903QyX9K6KKVRYYIAe0MOm95G09ljwFFjWh1H6kCA2bOOXwwMu5wWyXn+M8TwGyXxWj3O7s0e+A6Jd42AWiBYh1dnY4bcXvXoFjc04l+A6Wx5g1uZpcQ6OyQsAkukBUwJXgmC68Rgf0q0ZBp2C8B1o76Egoes5ihJ6i4OjgmYyMQvp/BDalNkrqXfxsWdkFqhKQvgyO3iWOX3yLtnJgLAHsARHKLo/TkvjmewaDwO5sSBCmYKKYLwoRRKxmd7wX6RfF1bXwGIKnR4K0vrhER7bAr/IBu4p+C2mT957cuYUFKAYdy+IWGfKkoCytpTBowHdHUcI9Ha3itQojtFFQyb4TPNIhVtPmUyN4QHFG7r8rtTnfAWWpsWpQMY+7W3XwWjgAR3q05jh2tUjpsjnhQjpmKlhRHyY82lVyyCuCIE79pkFZAnP9W4aIiujIzzDYjaSmDIFQS0zFgnO2PL1u7GDrSsmPSDBq/KAyvykqHGYJOtLcMzrKLzLYoJReFnXlV0t7AYwV01iGAgQHCHSOgmPzq8xPgxQTg0Vxr48pwsBWQWfcvf/mR1keTznVGmNub5KLfc3BSYoM7REw4XWfoLcvQJY4EjFDs/ttLA7jgko9+cn/kCEYHk8K0hQ8IDLWTbdvfeMsJdTWoJfWhlASdeeRDaoGDKdzoKIBH5E3q8QJ1TXPpnbs4F/7UjOdohYx1WyPqnxNhQgADRsMAxQjHpKk6ahKVotUT4VkABoadKzQdJmXlvJkHAhQNe9AcpWNuhzfSUSPeVVUNn5rsAa5wZ4gQWqDZgCCYgD+YxAUC4fBYsXPBATIQFEnk1nUZSEm7PE6VJhZIeiUEQhr3HFuRtzv4Or0p/wwNybwMcI8SrOih4WTAJNw4Di+rI6jm82g4fkzryCkefKUDWoCk9W4rP2WDCmvIYZbdd+//yzJ9t2e661hlp63bbblT3vbPaetttt7Pt0eo394DActesn87YwQnDMCcDQrt0u22J6rF2La6fXtMPt2ouPebt2N7S2Xbf93a7dcOy9bWG/uX7o4W//47XX/ibttMGsWoSD8MOQdYWzQANAKTsVQD3TGop7lr22/xJg5Dk4/4WXzt7WLqwuXhrB/989Z196ee/RR3/Wpbwu3Tna5z6mRwFkECExsABDj3m5ZocDArdSQr/47NMfacvlO/9fcS/99S9+9b69Pv1lCRz1gGFBpj5hDDFip35A6zpBCof8TCCUN0hZUNLzv3vy9rZaXbjSCnjq5T/s/fTRnwdDBA9gocOyV9+pADZAJDh5gCkATNCx3TbI/60Z4i0scgHl95IWHfyuVgj84teP7T3++BNuYbTdSHUNAH0bgkroSoBGHaE+xkMJ7u49T6Aigj5PWnvhmaeuSgjc/8BDe2/9+z/e+spUZxY3IkSPqNtShhEj8ICT6AhFuiKhUfNSXaAEwUmbORgapXVFPP/M2Y+25RJZ4Ir+fener+3B0iaM+ICnxiFiX8CXAKimiKV+9gTHKY/ozjTHFGrKiLZYNjfhCc8/c/bjbbncu6LSt9agAKa9rAPM9UWMttsGRSAm7HMUHkaLTx4/FQow5mZx7zhAnhtWN7efslGaFWS7agq4576v70EwVZTW5oDrixSBAwQvcHB0BVloIAucPI6maNpOlo9S16s30eXpbGYnZ8o0BXysLZdvX2kPuOe++/eyFhBV9p6fxb/TZOcDVgyVUnk7DPIA5+2O/hQedfwsBBWNxSdJEYsdnPnci098uF1Ynb/SCnj1jTf2vvudH456/0l08IzGDj0EMjwYMtZwUQjkREjtbwrH2Pe02KF/guBzTz9xW1tdeSbYbrj+r1++594PRmz7IESon1ngUjJEnLAQAAb0oBbuLuHN2lSMPIHZgF7w3Au/vSoe8Mqrf9n78SM/6TrDCgnQ3UyBmQmU/joMwEUiPzgB3mAsyStBdXEIkkyVkSInk/bc009clTT4y8d+s/fU2WdjBNZNgQoBYtpj/As0ERo2rzx+x4kdYp2NjCxZKSCUMbcYAvgFX5hOu8zwyU99ot16y83tzTf/2V5//e/mKTfd9P729tvv2LaV0bttp7Tbb/9Qu+WWm2Ma9Morf4oeooYrMWAi6saQlBMulsLDgBjP76z0NPzw+SAwwMtgnK96YDNsmAUM8Lz0TZQnFwirB/gxA1SAVOkc9UHhC6oi6TnZWBG9zrZYNlytQcIEb5/WVPGBJ1OQd3V9X+32RuFT0V6pD1ZXdwgeAhA8cecpS4MStic7lf9zm57BPoHCpvIHKQznmfAWXjO2oL12EJ+gLK4UNVVKKsF50UxFA0SDT8v35P3m2lEDeMtbPUC3tnqB+C10giIdIgSSBygV0ur6Ax6EUD4cNYUJBItnCB+MLPk/Amf+Ztd+i2lUP5BRczZmC+7+ppAobTn3qwMQCwecY9YlB8A+jsioLFWBCgVTgCF7obsERTE+uiYUEV1jDwGxRilMwEgQdSXtHFS9FSYFMFz6jpOGZEnCYl7WzQg0c7Q6QAMPb3GJ6AjlLd/D9b34ucQDToEJOv2lZZ381ALJ22MCRpbK4gvu2jXuYXFvqHbMshRQ2XpL66sEJxiz3RYdRB+QqPkaAhaPULmraZC8BYgf4OiTomiRox8gaisLh9urielubJ5gCtIqkb4m6NzePIgWlkdEX2FG7woleM0RHuWoH81Vnx9oWhQzA58IQRmgtRJKyqnND0t7lh2oDIWIdYWhcSM2YnpufXoDvQI3VViwWErGGP1C7J8RJHUdCyd5DGEvy2xt+/7oGvde0bXANXPxQQjnh83yuwk4DL7N75vNxoyAlCcFICzkFT4eT0uK7UUcRs5XDZAkqDZKFNOwIhWV5XPWEWOlqerMkFFW4KxARVdigXJ4NDp9JFatri5QWLtYfRjQUFaXyAYjd3E46m5X87UECYAU4vv4qnqBMoVcHqEij1JzdT6dMx26V8jrIgRHvIPxnjMDDkqNINhvGOo7uGX8w+prc3GGBdjfEJ5B4Qe71sphKCDIit9MYy2mr4z3xABmjUp81EMQT1D6y/5iIVU1DEqaJAYxHIOP+FhEKTDys6N/9vtoVQgm95ag+sR+CW7pEaO0M6fujvUBHQ64Vyjfj60tATUbDJKkosmZn0JCOEBvcm5RskmvOOKGFEyhWbBpGGR+4J3eYevxPdDaUgLcXdvAAmUHbLMW2FIBoqOV7ycget1fLNXHvrzEY9/qClWOfcwzu9RjVAbxQiU3t01JsfxGoJi8sDJBojozQVWACSoljJRhoYGGiCmgDkVLylMaszBwoVQGy13NxeXS/uC1ZIbASqsRFiBVPoEyd/f1iEyjqUBYPVJoGcXHKg/n+3RnxjbQHt9l5fV6ZUqRMnScAGlLZHoFQFDFtwGZs/FMXSqG3Lqe+pTe1C80b/JKUABpyvC6AJ+pGO4Pz3FFZEbivWT/Ot2R9c3Vh40pAMICCNfxuXZP2Ng+ZQKTUyEQWaDwdub0HH2HErpwKIUU9o8Ez+KIAkaKhHKMXsMb6PLhAao2R6EQQOioJTeucU7B16YA7F+sFm2zXrfNwP3ylgBxgSDTH+09Tn/B64Mg9QAlgAsm6CGRzJBTphDSwQ/HZ9N5KsYtT28gJgg39MBWInuZHG7vVqXgsPKqLZfLtlqv2nK1dG9YdRMiKNOqy7tOf8YwQHN7A6kyEsuuUJazkTa9ItTyOQFXjWNZ1QTxDFBjHfvl/rhOodErL3sJlrs994P9mdu7AharZRs2m7ZcLdpiuWjL5aKtNqsGHLCsUVrmzCLCAFVq7np1cXSf/nxy5JQ5KHABMbr8jEheLG3bpgS4/rzNUA+4wOYJHg5SgCnFwbJPh6C97AIR0DZmaShhsThqq/WyHS2O2mKJ7VUX78Eey+sBkzNgguL1o2xQaemY9uYQlYLaAMXL4Pls3pEk0WIT0pUSAocHEBQh+HyO6x0YgUOjZomIDqwNIfEPVt4/3G/L5VE7ODpo69UqhiIiT7V3IOaYPMDX9YsFkh6XosTTne3vSE42UCuqB+B5XSBrAlihhLHF4Q3H5sei76AwYvXpz+FjbwhCq69NcMT5xf0L7eLBBdvOeWG/XkC0WQoJKiykViMkCiG5+iVLZcTUcqosK9fqr8a6hLbUOHZ3WN7CwjHAU2TPCRizzPFEdAh7eHRgwu8fXCjdH4ooK2u7KsCEh3xcKMliyDgADkQ/z5fC14ZmbZXHCrLsFyoNCjwjvifOC+bzSHsgQfP5McsCUABCB9vwBMMev6/SHywv4RHn+wcX2/mL5wzwOBzx1ePeJY7vGoV7ASUDkwlisbS3xGpFJzZnKVBFksKihkMwx6zzGefZB6joLpCE8PIExHyi/8wUQTyh67P5SeFXq1U7OITg59vR4sA8QUtIY3GEZwotmqoVo7whPCCXyeV0SHXAOP8HLjjCS5NZ3Gh63NcAzPeJ6pEa3fKXgJ+TKb2dwsbGuh0ujtrBwcW2f3jRUL72Bjqg05xg9IZIns+OkHm9ESFfYyqBYJ26trcC4uUKoX5ZTba7sqOcLFD0OKwvNujKIAnLdpko7dHi0OIcCI/U17FCb2KPUV5kR/MFdYTpEaSTEzRFOfriTYMilvYYSZJ3hEp/P/f78SA73hYzT2FbDTFO4XlMXWaFB3iDEF9uitwOtIerHx4dttVqadxAguDTirLLEJzq6rEeyNkfQtSmQpBFL00x5xcFODuMirAsh2UlWF+kyulxN0csNb3Gb8zvIEUJhlks8f5yeYAbhAejU0PUrOpVYNBjH5HJ4nq+uh5IIAkj534fjKik5QsdqYR3w4BLvCTG5v0oLThFlLX0InpBjxdqgSvHg85ScLzeNjBDjf70Mqa9/uZg2c8K8oVQZQTOHdkdtmcYL5HRTMi0WBUSCyQ9K5RjSZezhYZnDWLkaF7L3brCXBikMhUAZ+0te0h/2WK0VjgE0ksZnqkq3a1hYANTayfpjVRf3i8F0Kp6I0wvTGbfr7obw4JvhJrHjOZ+rBH6LrJCxhRjfQa+3CjLo1y1Ot4BToOMMERYjnEf5KYgvoamGqrU9Me5oq8m89Ru+zAa44uQ6WKa/6s07lzeH1zdWlkoCyNqFsVOjr58tuAW0H5rVvo4G2AHxSC+47dsRbgvZnIgjlfh3AOF/LKwQriyPmx/68EftM/e/flH2qT96Py0Lef/apOvPHDmcHLnp7E+QGknLZ49+RyURtksbu4xGcPPUlUKtOj2+eKkgZDe3rS1O1zDYxb1XoTQPdKY36d6EWIZ3tL/cQBalfDNb3yvfe7UFz5w/lw7vOV9bfjzUbx50269sd04OX7HSXMiXpSdV3vwmEfkGn/S5ciYuX7AXdSs5x2bcNU8PZa0h+XKG6NkZ+ZvXTqWB1ZqiyciRuTrdtgGvX34ge+b0PsH7ejcdW1zVISuCrvuujaZ3HnHCesxkuDwcJ8J6n5/0yuqs3yfPgiSFDGpL1mUl5RioOGz4CIwV5HwlRrkew0+oMjI+fFqXB+2T//qjw+2SXtyWLdzbw1t+W5CjzPJfwE115LvDkogEAAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAABAAAAAQAgGAAAAqmlx3gAAAAFzUkdCAK7OHOkAABS2SURBVHhebVvbjiRHEc2s7pn1A34C8Rv+bl6Q+A8kG7DXrGfv3pvX6ztI4JmqROeWGT2m5fV0V1dXZdxOnIjI6p//9dHYTlvb+tZab/zbe+c/vLZNn/UX5+m7vm2tjdbmb3EyzvO5uFiuwevguhuObQ0/7P6+fm69D960tR1X47vRjtbaqY1223rb+Lm3PkYbvbfTwF1Hu2ud5+A//A6/4Yr874QPx5HDej/G0frDT29GBIaQVAR+tUGYpQwsdCmC4lEYnMe7lvOlC30PhUAqKtAy5X74O8Zop+00uHacgDXq/xQe+pRc7a6NBkHucAYOQDp811vDBai83tt5QCFQ2lLmA14OQvO0TgXAxv3hp1+N00nnasEbFyslYNESJgLwmL1AxyRcDJb3vHjxGN9AyppeIs/gonrH6vAzKUMvHIN1ccrZlsX7bfS2y0XoFVII9NnaicehrN4O6HcuDofH0Y5j3ah/+dnjcZpCxU3lynJhCH/iD0+nsxcfq1sZPGeTNa3MqUR7Ar7jNe1l+IwVS4gOd8ZrH0fb+0Yr7hQ73oCF6LPMrjCBsAoRHfb1qBQoCd6Ba+EXsiq1clDNO7zgq78/pTq4wG2jAAkDqhfKme4Nga32YECUF2+xNyh8ZG3hgcImFwjmtNHh5nlBGOrGsb/CAUcSAtJbUYcDJqGA7+VDFJpYQQ+iisYYR4dr4Eb9y89uGAKwMteBs096j2MMzRIWcfHTSdaPS9NTciwYYKCLm0/FEixtELv6cGwzBBD7VslYgCYjCyngHfgLS0/fkE/ZzPIVa53hk9ChcuAFVMBX/3hKXUFYhIKuJyXQYHlvoeLi0ztwBoAQqwmACjiEFSUb4B4IAy1MyjPiB8y4tj7awRgftCDie8H3woeIjltDIVdY7wRDW9/hkWyAa20QXIDYWr/5/PnYNqGHssBKcxO56RVKexUQk/aI5lYQJDrBm0oalbwLU/QVcQv/sBKg6V07LKhcPJmAAjIs7C0WCvGdvAlXFWYIBoTKzrb+HbIJXvAGWp9p8MnDF/aAhf5OTTP3xxOgKIYIQ2MJlZQ3vWJZd4Ji5QQXuR/eKCXcThF1LIkRguKFsOXfYtUokbcuv6cdyBjyUjo9Ma3yV8aAx1+8oAeE8EgIu2pNVzMlrjTInOO4rx5U0H3xBF4LnuFojJDyAlgPcd+PNtMbzoRSQHaiBEWNLC1Gtf7FzXFc3ykV5tx6XKGALAAF0L2ZyqQIva853jndiB/rR2nxGIG8foe7KhTkKXFhAaKEtEsineFfrHjrjBnWAsvdGTGA5iRH9oiCldMDcNkr55ETbsd7gylKeWfddyAdtP7s0atRgYnQakXEqlHQoq9RVI3tRaOp8skhVuxHcV4IXJlxTua28n2iHV4hC8JbW7sF4wt4UAKFhVOVCJGvuXBg0eF4AKwBr1IYP3/0ij8Lgk/Ob4q7ISXaXMoMQvaLeCceKO8n5UmR4BAAz5CeFZKmtNP9ZZzFAA1wUBAWDmXQ6j5PqxfICfxl5bOVEtYYr4pXzM9jjDOx68XN6xGBmP+D1uT3S6jEdRieOIL9NtTZ1DfKSVZWVgwIk6eL3x/tjhGDtCfhGOsl7SX9qQiKMvB3xVCsPvm4CyJF/2hnJikVUAgNv8QM+8ub11aecv8lhV25nMepHCLEVFQUNo7RtvOJ1q41QPJS36gA/rOVcH/FvoQzNgsMyQdC3QrQmSeoshIYBuTwhnkq3m1OwHN98NpYZMAcnQoQ00upmuJmxbdoq1yasZ00h6A0aNL9WTPg7yJhTH+6fYAO71HZRXAHI+N5NytXfLoyismc21kOW3EpCannwgQpNMHUCsGyyAEMiDAYl/b14zejujO8IHVBrdrC6iYTDNHpqB8AtZbDx5EBeC+xSWcvlbKzqpP1AYCXXqCFw23lFfJpVvPbKnwQNqOD48fZDZLxACsZgKefKntEKQTC/vLxG1WDTnthd8rZCgEpRGA7+YKZY85P6mRqKQ0VF0CwLAgI8row9Wh3xO3A8aWHiNKK4qZWoz0QLqjlnBESAkR9p8vryS4NUfaOACEV4NDc+tdP3jINSgEqaFKpBckJau4YkfwY9BIWcXhS6tL9kZsx3FS7mwRRESgdxPkRDkL6BIPec41Ha8cm90UZD8EJoHZtHvexgGTuVIkPhDu3o+2472jMFsLm18/eDdXyq2tTOzaJbcWkCBbDoHSBqtVX+bu8x7lKeR9CO9YVARdsLoowV6EiKuMTeKktxiXBOQmsivkJgFY3P9MpVdeJIAkLjmOMU3/z7BveLDkb3gBVx9VR6Yn7y2kCmGmAzKZJqfu5MvcLXAMw9Znv40KKXzOEhuaHYc3ZrYZG7e9N/uIwiEKsS14Fi4VXsF84iyL5BfiBkiLDYGz97Yv3PK82RKQy9/yYRNm3c/0/zA+UNmX9SoLiW+pHbX2La2Pxd5PKsgEmhpfqraMjJMAKyovqrDRJpMc5Gzo9dn8ZWdV7SXPhBfgKPcHgBRQDHFD4vH3+niGAxZ6Rx5Nj3OFNGptdYxF+nqfUaUVNH1GnWODW09IKr086xAVQ4kbYuDqzxCRDobZC7yiCgGcmmUKJpGbiqdQmYeRLcHnzRjdHpGSFAPM7rXmUpobzfgiQ3ZoGYVZIOLjbe9H+Sijy5iI5SnfquNjSVI9qgJS6THcrMUzihAwiC6Y1LsBUH0DCpHkST2BDWu49G6q5AnqJV+wMv3v5rWyVNra7O0T6kuv1vbBC1H6Fzez6WAmz06tskxhOkxOiYNGxPtGbTdCYXwqZ8W7h2Cab9cL6NjFNhfj7tM/jBatXABxQf5a9eGKAyM1qXCYLLPor6rWIkSxcewg1S7iwEolRnEIT+AwlwBOqO+OnUAK7vA6NNRiRUsCqarv8wuNtYalEHmKQ443THUb6uwbOWFFY3UYPWAWOrAvr11q/zgdEfNLxVbFdFaF+gOc1EhhWwU1R07MbXdy4ekjqgaScKAa/ibcY6ygqKUe846L5oRYb1CrLi4rifUIGIEVaLA8gbVV+p5XdRaAnWBnMDK4F1vBjxrpCAzGVCdCa7gjt5dK3qu5VTzmfVyJUwQPkicqwFzG9uX2GaCSaBwwLyMUDkkGEFYofpMEAJpGaCqicvw42ZplcsgPVnnlh7fSgNRZ2smZ8RHtHMxCe8c/6OzGuH6EDDCvVbHCfADEEZlNEmDHz/vQExXg8Rd+j2bqRBKWdfj6OIbR7/+q7gR75+XS+mOzMNJfGhvnArAwLCIYUpanCu0sJEYg1ABmg0BsrlNCgwqkv9RkFTjAj9DY5PE2R0OF8ZquszAOVpxUmGY1B6cADtN3ZF+B89f2rD6wGSWjSCjtWOGS1HHpkBmDaTG9wpqjEyTKm15dFuhFPxP+V1FWRDUWcPMaaLu5r5E+tEyIcpAOuXIUFub2eYgsLjlJCirIWkKjOkH374ptxPqtRMtHfff7ZISqzPw1B9CI7zHS4KMIMMD2/JCxYAp4gsWExoUFZv5ogM7YFZjgXCsAi6Um/AUAdQG6Hl6FOEPgpEK4yYnfqY2jtx94J5sAAEiG3v4QHa7BBcXtvV2dcJ2TKvNNTnwl8HKOZxZorlBQXJMcJAEORTud/A5ywW3VDCp5YsdYHsUFG59EKlJCCCkNREi2mQtFfdoRhX2AAQfDPf/rL+OSTT9rHv/u4ndzSwspqYyQtctwVjDHaFU1OQ1S2c+Y4juPYWAfIXhUL0rBUgaTuUEX/THzi9sEBhE44RX4QoHSGZYmt7otoDbxmdmNSMWpvhRbWv/jbw/GH3//R+wJEfzU/X0pgNbg8f26ciJJWr9At8Hl5LpitaxSZYXsGxwBb8v1m2xMrCoGCIMAGu5aNb1o9SZbKYhEhvaicWRGq4jsngsSqRutvXnzjwYiaHoz75HT387RpwrsPXAEGM/JXijva+YwOlaQl7G7sPGUhGGrwvqO1/4B6ZMhhBhghQ5/HSOPEsO2wMdtyYs0mCTc/rTx1hsQXCFkNV+v92PedSqJ4P3/418DGB7m/Dp7OHKUDcJLK4I74jIv+1xrG32xaWNYU05N/ud/Hkre32w0cQN2g0F4RI+/vMW4hxkAxQTfVZVVRglQXAJStFxusdQOOYwJ8dP6eNBrpD2SI4sHBkfDYMocCENdrFIb3ZIDs3phpRQFB4l9Ljz6YoCaHVAIAm1Wg6e8tlrWhF9g6FoRrRBAOPsz58UMIEULDOA6o530hO2t2sJSiEDApYtdI2QAauLZcV8wcVMDMAqs97kkwAEq+rI1H0DQWHu3H8rXljXOVrrq8aMhrjDrtbotiPTGSt4xttL6PNs4wPZUwBsBncviJA0J0eJNCxrXa3FUi8pPcj6trl1hrHzmLK0OgNygFnNTaZm7XdjiyDZHF22Cau7qc5NptJbjYHATHD3/1XwifNjg6PXgPr9rb1vaGNLRBztY27FvCrVvbD83vQ2W1KFEapBmTR4GicXmdS20nGrgwuD3AVeRJRRHCGAfgWdf9l+/+zV/UiRCALG3w1tXRNdXMXj3E+U5xggJubFhoXDI1f+gDS2Hs/FBaBA8EumLbFjOV0dvHhS+p2yM5czrWf/Sxl9TE6NtG3zBen5RYPUC+xmjXxPE1HmNo9e/f/TSurq9mFUhkTIvc/rJt3FMga4a4wL3dkWVYrDSE8zjXt1f86tSE43gx9rFFZ+7wSdNE0SyE3iYGqJTBTxChRxsHIApdXW2VS2cYFt4RR4f7B7xD1DrYC8hAU2E12oP+04dfRgqcEJlsmqJPr30CcDuNtBZ4BRcClrF8xYawuxkOZTKUbk7l+rzDAadEKEjgxHPcPUCLEGFVSJK/2mXwTFq/y+URYiBJ6iH29tGkxz9++/PgYNOZIAKn9k9TlEGkZigiKm2tpEkKPkNF85HF5BQE6vpo5h8cuRRIK+a8CPHBabsHIs7/tHJhjqhpydvoEer4ne0dAU8Yju1weoBCIFlm6z+8/2k2RCS86G12jKYlnkml22RxvXRxUvmFL0pACZQ2WJoXNjC/XSnM53sSlBZQ7Q6F4WWUbgMTidYLitZscc7vrUwoAcLH/ckX+vfvflRDxK1sdYdHO2evwNwQuSY9GXwiLrt2cK3G5+oCw1My4kohpP2+ywPkNBp5CaxkKWSNZINKcgSWKouSWaIYICk3+wBotTFSDZS6m2ztHOVQ9UH/7t0Pg80QzYrmHoFsn03Pj+rOFjp3kOeaQ34ElMGBkAUsVilQIJr2uMbcFsbewlA2b0YFl0Ko/tVSPAw5Rjs4klTlx8zhaTERZLT2wEbCOj6KB3Au2doVFcDY9tZ3FtZsgbnKMx/I1ri6H7icoywRAqzcC/RPiOQbgePaD1R8VzZI27tMcNMqS6rULpIlcFhnWuC5BnaGwLJYF1mge5MAxTjcdf/w5ntyooy3tCF67QBnVeiN0OEKWPXkDQ4RytU7dnjlNUdeJjZih97vb6+Amya9QlB0eGD5ZI45JipxkL02OYctGWeo2ZZ0WpZHKWxEhwXWVAKpMBSQIQdui3AQJmhSlJE5MgUIUn2lmZpBiaiZNj8bF5ImExZpVlCHM4SEIcvNlyexwxNAs3fEeqJhIcMSkFhknk6Qm61w0WE9YKFMc0IvtL9//WE+MJGWuLa4eCuc58rp9OA4QgT9NDZDQajTJPFO7N63OysBF0r3NliQqU1QT7wb50kkYUV2dDpT2DNwXjyLbXIrEZ1f/FaNl9QG8jhey/VADLCNNk7sg6IpmlSXbfHUYnlYQiGiMflShG49R2WoIIt7uHVO4V2NgS1GCUH4gObFrm8LwP3B7uJwCQ4DG9jJr/YAV2yLOI127YKMxZEKIC0CBiSBePtS+wPynEDS4SRAeY6oNETUJ6lb5e1XefojYzYRJ1w/uzup9LJHcLlz4j6FloCOj74osvSc0AybJWymyTVd4jTNAdQIQYW3D2yQpPS60HHsrb9+/pZESOQnbu/t8uZpsT5iJl2jGLumxv+/UyT7JFWJ9A6qPvdU4TI1U8C9tYtD4qDoordAGUb12c6zxKv4kVLWbg4a2o8eeB/DfpigrpbYuzUZ8vgre4DmgxIxQaa/UJiTNUmR54NKixJUGLK24d8HTwrOvM0eaGI5YCkQWkqgk7qc5vZZb7SQRfVKVmBsxxg80U+LsbnIO42274Km/ubFO16Cd8QjM3NDpLyzbqBSzKMU816Ce9S5ClnLazYg+TyRa5ps45gzBg6CsqUvFq0ENx0CpjR1folu4xjY5tjbscM71YtUSkZXLQ9IeTgZbUEpUdLXT1/PjlBADW7OcVlJe3Pfn4lRiJOMqMx9HyQDmKov1JCrW+5oC3NfnAsheJ7vIU/SJFr3EIYdx961YQvH8fhbHoPTtFqWtv4sqEJ/6XR6xcsnr8pjc35azMTnojV+bwNliqZggLwlC7D3ZDudQ4MuV1IFlgOlYTEJl+pFy7nzLAykV4ku4dW+hzsr9KIQjQt2eAXPVUjEE/VZD0/25zcv/cCEN0Z6/hfBkB2iLT1MlWeE6uI1WQLAzL0CZhxcWELMIJtZeXRxYc0Z+m7J0WhasLKP2u/3MQVK0HwTY/qEgUOCOICgUYsJilHq36SAuD4L5rlb5NKK90vlADUbqtZ+Bqi5niybTdaYR8k95QkO+SR7P8+XzRcB0uXeM4ssBZRmZQAYwqWmPOwZGfTAQAlLPjQFhT3557PfYkA2RRS3ZozfC4MIqhrW5bIDW4KL0sXvGds+TwNUKXmGt628vsv3C9hwPinsBe3SdfU88GUG8CBwJop9d1PLXtGfPnpODJDGtSc48/64PFE1O8VLCJBjmjZHWD4gnU5pHq6wr99XRqymMk1glpfCxrPHNA1mKzipVmdfgJtBMJRJzwgv5azP3j568/DJ9AA2Qoz8c9NDeU6oVoMphLLoACDrBKLNeuACHxUmlxupowCN0dJyM5dQ6M/KJooBe8vaUoRd5vqV8mAMhN19zBAVxvG99ZuHj/m8gATJhiehLDZOxtU4+yu5fIKhF0nleP9wOAXBqDyOM8PEiggY6hmEhG7SaviivsvG64sRvcOBw1SnuOCOrs2dqvO7KCopEbf8H4qrafC+RB9gAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAFCNJREFUeF5tW0urJVcV3nUet2NA/RMS8046Mf4FB5qQxO7Y6c5DM5AMJANBByI4EB2I4EAyEHGgDiQTdaAiKhlIQJEoIUgc6O9I97nnUfK99l51Olc75946VXVqrfWtb31r7X2m/37wv7m11k6nuW026zZNU5vn1lbrVVtNU+P/Vqs2TU3HVyv+m+e5rddrvk4Nx9dtbnNbr9btNJ94n/zgHrhf/VlNq8YLGz5v5s1xzTSt2ul0bPhA3QHvn/habtlOeGpcx5eZ95pPc5tWE19xMq7j77Tv1PAb7onz8e+Ez/zgvf/M6w0MaW29lmEycm1DYYyNbjB2kmMmGCUH4Hw9Kv6Tx4bj4kA8Hf4/NxrO04qD6NAT790N8jk0Dsf15HIITSl/83jMawyAPIIzZztEQcYxGB7nTe//89+zDIcDhAA8m6LcGpyDe+McvAIN+KlIwBvr9cbo0cPpPvqn6+QMPZei7cDp/BUslAvw0FNTMBhRRxqOV+AVQTqfiIHBRgKijcj7moqg+XQyEnTd4Xhs03vvvj/zo6fJRiQ6w4AVHh4Rp/GKEhzSDfQxoCYG4Fy8j4ejs6aVDRMyEqE8OO8dVPjhCVE7MffBK9xEeC+Syo6xM3ItTjryGiNjbm1/OBDFjMe7f/vXDAMTVcEdxo6cjjGCLSAfpCg6QgNSoxhBp4o7GHtGL5HXq36MErzrexEZfl+RVOoF/ogkAW8HE2G+P2BO5/Bea/JJzmPeH3Ht3I5HpHZr09/f+cccQlOkZLwQoSjigwP5OD2ISF7nHnlwOi0GwsEm1h42fDgctoC58hbXIoKdHI2YEG7SQLhXynTIh9zaxFRIeuS8/f7Q1ry/nDT99e13Znh3s90I4s57sb8Ij3yAvHdExRWD1VE9UiGIpOR+Xgsn4IF69SiEaVvskJE+cSIj6erDaJ9OgnYh0yCjv8aJrbUj8n2aGHlWFaAHKPjLH9+eN5sNHxqvMQz3xd+K/uCDVIRBliMd4rSQ3kir8AYgKQfgQXDfsPwgP6eGDnRuZ04H9p3g4C8YpDLXUyJlz+fB+PpzOBx6uZ3+9Ps/z4gwHgpeATzwmsij1PWyx9RQzcfTiEjE7uGBkdP6SEY7US/lL1pCuauSRuibxII6FHzVeXvExnX9YBedVwJcE8P5GtQ493E+nfa73/5hhtGAlwyFMwDBFUtgCAzRQqkTCUonCH2VK+ScHB9VwnRXS6NLaSJ3RuhieuZ2ioPQEkMlzPT+ogSejkRXfnA+UiX1v6cO0gIO+PVbv5nXmw0jhZwIF0DRIcob1/doAzgK75FloRatDFPjwROKnlQhXWTUqP6L/KIF9L5STM4At1jw+HzpFqUA3unEZgdRGM2tAdr4bLyGFOO0cABqP5yBv3nPX/3iLQqhzWYryFoOJy2SEkQJSNCCphvu8kcxZSlTpbIEj8peFGNXjhZJKY9w3hEyuKhASWNHlMpOdElVZ/FD5Ud0KF1wDzr0eBLbn4ScXA0H4T1ywc9/9ssZ0U+t34DhWcIAbRxXL4D3RZKjJPZSZ+5Qz+CS599jrESgK0ohsUQ/Oj5GxXGmh64FKGNdx6MRQoIhRCFCDtnv951bYDBgj4rSU+knb/5UVcAcAIzibxrviIcjkA5h9iAED4EyGK0AhChFTuwVutxBalhOnyOipsM5Fwy4651EGb8TLagA7iMCfTzDYb/3uSI7GI7Puby87NcwLX78ozdnPHC6tTgDSGBVMDrC6PgbDmElYA8gTYDrE028L13gKm5EhRsGsS65gKTWVV+6PKVQRFHq92B963tCX0YS7rjmNLfDUXDH3/gdRqcCMAV+8P0fzjBmi5rv2p90iGNCbOCH/B5S7GWS5DikcDijyuhI6XR3tTNk3jL5pSBTHVIiQ5CCrzgFBgntcIJyvzrgCDJsjWhAQPYHoGI4aX+5b9N3v/M9coCkrw0EKa6dFmb65D6dAgRwXiD9kMjnmIRTqQTOg1QFsZw6ykhjwFhKUyengendn4UOWTyVwLKXET0e1d35WpQ7/I0o4yfpAQeBF3gcJfZb3/x2J8FuEAlPGiBVIQTIsshmSQ+7RfWwgeQIljm9n1JaS2Te731Ab5JWFEyZvCQVuiMyxGAEpf9jHJkfzO5zcFxMf1Tv3xpzn2kAVBgtRNXX3/gGy2BITR2ciBDCiLB3FSD8ee66iSPKDMFTn0qUans9O0A5Q5SJoFCjKgNJELxBBzj31e7xGGu/1Vzqd4yORgD8a26T+JzvdIaVX0UDe4Gvvf4GOYAqcDV14aNqgIfVA1ejMy2K0wj5yGE7k6TprjJw10zAkxzLbRd91XTDPOdEzIT5OSpzY4NzjgdEWCRYoR6eiBPiiDivkyQc/9XXXmc3GBavxsXwYajbZed/EBBDpRI16yM3ZJ7InFd/oRQoI7TUPc8A0/RkbIVXPDAnOCS1oeK61j8cmNeqEEfyx/EINaguECSpLlCzAlYLpAE445WbX3EzlFGX5GvITcYrLRaOsDLsfURPk9E+i1RdCo0w8UG6y6heQT0DDBKf1R91PP8eLF8bHZEbqgZ6AP3L+0SCHRg+yECE1QIp8OL1W0Rcz/My7dExMXrnCJybZskVQIQXLSBHDsd4MOrOMXO92sePYajyXVNdOYHEBokL+esoEvaWucntwLpGPOmBVNH1xTkundP1527Mg7XdCqc9tmPyfkVBFUYZlLATdG/AEseWWf1DZoK9FDoletNiAdSh74pAweMIRxtgppfjJD8bpmkwYK8UEAf4d/cE0AKiIafAjWu3OBSN6mNNx4TIwqga3adEHnKmXQYiunQ21HsZzEwgA84ulZfTY9Z2RltGJKIxKPpejJ5xtwwE1KUinfMmRTiEaXE6tv3+ktfhXE6SqwM48vZwsnd5FkZygORvdH7t6rpUBvFZJFX+qF3gmDmUMujxuPoBaYiDIatFDfX8aWAE8RHBdI9BgdAhLmDzczy03f6yHRB5LwewX+MiyqpNQMC5ElTZUiOz3W7p3QxJKID68NSRL50iEcThich0zBPGaB33w300mdXITamAmYCjqVroqIXBTYTmBkL8gNIodScEHCh5cfxyv+uRx/GoSK5eubJMN194mVUgRIgHBphgeCRuWuPksgy0UAoRluFIVYHqMkGQtTPMKFw1UMOQMeVP89OHGGha3P1VTUD9T+a30a4CMnzPXiEoGA7WOgUQwMDHAZG2PQUsbJLnPNn5yzrvakFjS5O04IUV5gcyMlUkBqf8p2usDpDgwQQ3k1yoPB2TxhfB9ahDBxz2/Hd5uRMC2BtA9ooH4GTI4YvtFS/DWYu8dOPLVNbJ9S5+XPfZJHFKpFIXFGhinBWlIpetB5Y8oHIqnvFQtSwQ9AUhktuAvjo7sLzKYchRym8vIrPxl/vLdrnbtcMRkRfpMerT1PaYAWShJouxGcW9evO1OQMFjrv6eNwDUhvNkZlXhHsHaETUjjCOGRFXjocP+CAuizAgK0pqZYWLKnRS+qL6VAWk+0F4gP/tO7cZ6Z2jDwRklVEpILks6GMsv2FqEMUvXn+JHJCujoyP+R5yxNAOrLfbC9BSXwLDdRyhGS1ZR1BzlRH6UJHilNHy6m+6pE9tIZQY4QL/7hQQ3qTWFvDe7e6wxO12OxIeKgGQEA6JSMrIDM9L9ec5JT8ZHJC2tUpdsnjZDxCOwAQZD73ggKoIy+9jiW2sJ3AZ/GyhNdDOg8WATHWo4lzD1QBp9L27vENHAO5wAuHv/r92g5ke0fliJEvvlR1QhhopXzGQIzCPx+piCbnBJXGMyER22y1mBl5m4729yuQWN9xBRywWQbVsfx5BnJdpjyB9bPuDjKYTTIBLo5VP6gRFgrg3qxxH7F6ev/HFW3PWAlL2UAJr9BMxlDJ2e14MGdJXmyXWXh2mo+g4jdLVapedJdlQ4VciAALHY3WVLI+5vfDJ8sf6fyLTk/T2l+32nQ/pgNEApVtU3kdRbtbbzgN8/qwz3rz+8pzyFhLscz9PfsYcMOuHYzQOwzoPZN3AzZPSBp0lvJ5hyFhUDQL6woe7RMLYw5AefXeDKXMwDBwABKTsqXRaKs+oFIj8GMdj00W9L4vESzdeVe1xecpgJLK2R7/Xfas8wlflbVQBj9KcayJPlU5VgbIVpwuB/JLx4Ch3AsLY5oKIU/Ts921nlYdjQMCQyFKNrBpOuSz59VacpOvB660vvULERY6i3GkUplzRdHeMxxerwyyDmv0JPR6nnc0GO+lly42h7qLnlVqVqdoEZW0wS1kgPBiMyCOvUfbwD+jCun/6CUrtacVjkvIi7Uqu0STTi9dfnpOjXPg0fLNS3OcEnvBgTIYhhTS+4J1zovgQb43Lx1JaUMINFSX3+yygL4RLCOF4hpzhh+Q+EAAHoPSBCLVAos1PsCWLoev1ttf9qEGVVPUMJOMb116ao84W+VLm/Iwymxs1LekTzuUtRZSjT8hvNoxoJsk4xkh4E0UWNfm3nZKSlRKIZyIqWmO5w4Nf2gHR+2MIgpwfJS7CapRXVYXoCtyvOwAnpSXWPE87wrJCRELzemEiTYNK3Q/UVSI1NU5l6ejI6rGYT+qMrbAGKHU0nhkfJXGf60EB7i16wv4qjX2U5j1D1fBso4F01vqg5gjTtWdvsB2moR7RYZWIkfOOEa3pqX/O4kVgn+FnjI2OyJSYju0DUSm+tNNaA1D0kd9ysnoF1v0y+MiwIwujZHs4JQMSUrrwLdE0tsrhXjiPDj1hTiBdwKUxOACG02hrfdxke3HBfAqMBhfICREzWQ4DzNNTcG9h9hR5g1Rvrb3PKKMwcAVXaLxAQgdx/0D2/nk/gNcLKJM9Ae5tc8ZiHqamiQoXwHBG3hNjGS/0TM8/fX1GTuPkMD5zF6u+ZwpQ1WIsladRWbTQ2XQZsWMRJMO0HSajNTotTYrX9bkLBQNLLf9kGZFRE0LHJkktfU9ke+oFj8BhGBGVvsLrB1xkcTpxQwX6DSBAI2kZRhTUXt85PnJYJREPjgYKUdfWGUlYtdNSiyynSa2y96/ygqCk4WlSsC6OkhQ9wqLx7gmy9ohI4ndtfAJR4m85YyjBMVFCB6kxm4eizz/zQh+Lx8hIWcFY5FhLXVhdBo9tMPAqmyXlh9LAOmKz2rTjjMXLMQ+Ec0SAZTts2UOAazPUTDqSxV0ZcP8siiYlBe0YrHKXtQF8ToajCBRL43NPX++7xOAxNj/eJZoPvbi48MxuGJQPlJx1i2s1yY2IQJUNJNt7kcQzirEjLQOK+MVISTmMv9DGagl9bJYekKeve14z8tw2k7I3tshwo+R61bg0juA8+4VrXhfwii/1sm4YsUMl5ZHYNGtCNByQaY+WvOS0sfWd1cHTGHg9YiWaIvVfZXhseGZlAKw9pMlCiJ7MGx89J8y21wH7I5GZzrFDnoNQ7StApeCiz+c/90wfiuIG91y5RxKYpfDYrlxc8UNrdRd5Tygd9g3I0JRIHAD4cREV4zJvjcU9MUih8poxZb7gypLk7OjWPvHxT2rJe4/Z3qHd+7F72+3d7a7ZL7bbdmd3h4FAnoO4MeOjA5H7l9oLdGd3u0tyMD863Q8//LDvO8A14SAG6r5PfXrGA2U5KjmqjVLK5USQwwz2+Zq1ZavLSHlNeLqw4awx3Z8p/a5Z4OCE8+0xQoWnhN4TkMujIrNuIMXoNjpb6oxErS+qqqR0agg1t+n++x7o8+jAMK9dpdWNz37eEFf2CqW5SGoIzmOT4zg+VoRSRqNCqQ2cMoF6tsMkrQJn6ZPlRkk5cBgZrcGU8Zb5pFla4OnB+x9aOCDGJ/J5kDB2NXDIZx7NUi8vSXeZcxLJqL/ct3+eGMA8IGFU/z7/Pc7tZNl3lo5vg9RvhqSE5lOyGWN64P6HRIKZTXtcnDK20PILghvQrU4Zv+v93DbsTcMM52r8OVoyOwySarlMqmS90GBYwJtzhIzS3Xf06JcdKdPDDz6iRblFY5JN0JGo0QOKdNbwFMUy2XUUo/hGRVCZPDeqT4T7nuD63SDdu0pioUpqUGDJ3uG70bLs/bP6JIWZZ6FTH37okTnlKx4K0aVEpX1dwnZ8i2tEskZdDxVdX8lwlLzccbzGSB0RcYorxCn9uMk5JTDRluEjnXp7HSj5DkmP6dGHH+PpfKj+VbWzv/3pvXw443NdhfLSGcuvyIz+fCBH0I8SzJb5gDKVoxhetEKF9HBAXKQUKPrKnaK/LGGnTo8/erX7lY9lxtc4TaXO7ZrLYRqa0esPhq4pUaOb8ljJrX4PUJ+RyC25YTihRnkgRL+pWpQyV6pQbY3VEutLVHzuxx692r81hhuNAYWVWbq3s+HGeKzCAZ7ACvqeu/u6UZKW5LhMglpJxj0S6XFuOsJyxLk90mV0jQlQym7XArDt6mNP9BQIFIdSKvt9TecDron2WN/vuZ2Rlx+qAziTmmR3LyRyYmp+re93s0TkcvREttMPBFWN0Jdbs+X+TCdMVx9/kkPRRPRcDIXR86y1LOrhBtmlVlcHiifORZE+Le1zdVDnI5PWyM9xzTkiUg713QIto48KMfqLrAl07sCZTzz+JHVAmH4hTOpGpnNJXBARA87JMLU9u0GtrfPSnTCu87gku0WLuDpvm4cTUu9HM1UVYMqoqkEtq0bQZ5546i4p/FFVYUS6a+He248tLpUE/WVJ7/0ZUDZncJ+/xtjDI3mUSooDQUuyFeRjLJy4IDsjrxpetUFPdzigwn60smlrLWK4ZnCu/vT9nkp4SYtx6iC25eXjW6cyot5nDEgS6aEdSlIMYWBH1DRJ9mtDFD4j2+iyJZfheurJz34kCVZYf1Sdzw7wGpVzDRAkpdYPxrCbCgmWzqmv8IQnhvGB8XKKdHd5BDL83WI6yV+6UDtocaUZ4/8BBOJxy9ElMcMAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAQAAAAEAIBgAAAKppcd4AAAABc1JHQgCuzhzpAAAXsklEQVR4Xq1ba4yc5XU+38zsfdeXXdtrbAKOY7fYoQIFKkEi4rsNgpCE8KdNI0KhhEJUCpQmqdIipUklpFb9UalRwJeUS4GGpJGqUiVplFspqcKPSgai1sW2fLfxbXftmb3MzFc95znP+73rqD9QPcSZ2W++y3vuz3nOO8W5I9NlURSG//C/Wq1m+BsvHvcP+P9uWZrVCuuWZiWO4pj5IT+m03GsjuNm1on3Gm8UF5Wl/9np4lQe63RxKl9lWZr/h/du1x9cnY/jfpZ1Oh1/KK7Fe7fT4SL9Wt6z2+1a2cXfXV90p912cfR9cfZwy28noaEA/1fUuDI8vAZZ0gurLqGuUARXh7NL6/olvF2N+vLn+vcQyBdadv0ohORi+Q8vCSUl4PlSFM+j0iCYCxfX8p6lK0DHcK7Owfc43u1AEWU6Xpw/OlPqoRAaJ0EBuTdg0TouIVyFRSELUxJ6BHTQcMFDMRJOKvRFJb3QWm6hsGyuDBnBBQ7huN7MW1xJnUoBcW43vArXSmnuFaEEvw8UgBPa7bbVG3UXo1ar+wPcjPCE8NN5oZFWYF0rXHC4vUJDsvolFMgdxD8jsOi2sHjX37tdeEe4PywVi06hkFkzWV2CxXfuQe1O8ixZH4K69bN7YGH1et2Ks4eaUrxBY3B3D+b4597gyy+sgEMjqHHMrUaX1vHwighjRAm+h1dRcFozFCJhEZ8RBgoHWUte4S4LITwi6dbQFtaL+IaAuFaeBWW6wPg+lEkPYj7AOiA8Phcn35ksIQAO4JtOp50ElDJwc0+OUgLuEcrIFZOyhCcx5k6GT7g4VZMSV2jqV9wfAiDDwFVdGcnCEoy5wC3r+aBy/ySklTY3Nxf5g0rCv0a9EWvCsbYVR//7rFcBCIgvoTFlVQnt7zV6hWe4+JyqRyTRKq7pJW4pKAOX5S7ODOjf415VMmMecCv7hyovUAlVEpRbz7Xn/Fn8G0rBNfSSPAQgE5M7knClkGL/3uNlo9HwuK/VGPNYlBJRvVZ3U+I7WVslM/9biTK/Vg+TS0elDRdmOKRYx+I9pqMaeIbv0gtcgVkSTBanF/j9owTmbt+O0FCewRqR6/DCu4f8vv88UrrgUECd5Y+lsO6L43c8LuGkLFeA+3lVRnEMC3eFREzAMxw0wLXjqHsLFOBxSSFltaSwiHkoRkkMnoSFS3HtTjvlB8W5K6UszRUgTIFcEVVBSnAF7P2P/yl7Gg1mRE98VAA+IyQ86UExcUw4YV5SzITNKwW9iDHPWHb/TklP5ShyYxLMsUIXHkHrIlYZ6/QQKapyc7q7K8oFbbtyZ+dmA0wxd+B+UA4VGKH+xk/fLJUYoIRGo4flzxMjcoJZo1Gz3t5eV47yxaVVwitFIEdHbnEPLAqhoNIl4WRxZekEiDLPUOanW1MRuG6ehY2Whhcly5ZdT4AzMzOp5Ep57SiTuDfOL177wRslBJXAcn8oo+5Wp/UHBwe8RCIneD5QVYCgdZRFOjzOTWApMriHRZQ6fdaCcJlQnJ+TgRglRCU8IUEIrFinRVniFNsQ7MLFCx62wgVMjCW9wktnm+v83nd/XMLqEBaKcMEjHFzYUERvX58NDQ4aEqYSHs5zhUVNhWLyl6ytTC8vgfY9sSl5ZcgwQdc4JgzhQnrZYwanS3cd21cgB1bt2PmJs9Zstqyvt38+Duh2DVVDIdBuz1nxj3//alQBJj5BypGRBS5oT6PHNYkFLB4dtaGhQVeQJ8WIfSgPlQLvBCulu72/AvDg+ka97u6aIz4/PyyI43Jjd/MAOx7fbrGqRGLxuPnc3Kw/RrgA9//Rz75va1etixBm/OP8i82L1tvbx3PbHZb75555uYTgjH+EQs3OnD1tgwNDNtA/YI0GrExLDw+N2KpV73fhYFXBZOEE/Y3wSJUgkk0dYRKJMMcEOTyt8gDKWptlMSytzM9+gO6OOGcD1LWZ2Vk3yH/te9v2H9xnK8avsoH+IWu1mtZsNm3qwqQtWzruIawu0XPA3/zVNzwJSgH+Xu9JiBCfoZiZ2Rk/Z+2atX4jxbtifl4HSZOkLjLwU5Q9lCbGPRasOq74TnXdQQ1rtsonkR+syRqOa6AEeRHc+zv/9HIA95qNDC2wvr5+Fxrv6gYF+WehtK8++VQJ14SVe3p6U/xDKVgAksbw4LC39Shbo6OjdsMNNwakZNLDtXgxBIj/Pf7LqADiAYD8PGyI7RkeAXU7RGpz7dnI3F1DjXf8ELyAJ7ySFcE9wl277SEEq7719l57/RevucH6+vp8jQBB+Lu3p9crHGTA+pQwiyce/aJDYY91VwISIkMCSdE7No/fhk1OTVhPo9fuvP0TNjI8EsJHs+RlD6iROcCVgVxQr7uVkSD5zvOhXOECPERxKTiNv6EAmBfCubsGknPvCe7AQyja25deecFa003r7enz69pd5Ak2criHOlEmWpAVNSvuv/eBEouCsJ4DUPbqNettoO6z3EEhuBhKwrEPXX+jrV/3wQo4RcLz6pHKIB9AFFixNqoSLgyU4LDWY8Y9RtxEBWPV0RG84Dy3elQDVYdDRw7ZD3/8fV+T4lxtrlptb/sDHapnKD51192hgLovtOoLau4yXgq9dw60GPD3M799rw0PDQdCRBjQn93NPL6RxGFtEh74nrUfodHxZykBJjdX2xuorer76QGpHfYusfSSJmrrxZefT/kA4SXYzoYsIHe0xhX4MivuuP0OcoIet8L08/kA5Ag8HK4FBa1aucbWr19v1/3G9QkZOoMUYQDBoDiBE3xGGfIePCMm6A1Mlu05fu8JLro5d9uwurwD7q7v3aLttrWmW/bt7/6DhwIbH3IFiWQJLtA5Qc8rNfc+D4mtW7eVquNe3nJCNKPCBGJgwZHhBfbRD2+0Wz68gZggEakqj2yEBI3V+OSACILLDXNwg9hP7W30+i5YxDCVwhiGMMhPBw8esNde/zdrtVqpSYKHeRJ1edA/VDygh5GHglmxccNG56JcCVp0AByBGSlFJW/J2DLr6+2zRz//BKsG20GGgYeIUo8HQFqEvguGLJU5Z21N/XsFahz3twl7cVPB19QoleZhsPfNvbZ//347fuJYauM9fBJzRNwgVOmKFzTftHETWeEgMODu+YtuK2acVNLSJeN28uRxe+rP/9pvpOSoBkmlLlWDKIPiGGAZ8gxsbObBXXWQVthsezZVAWZK5hkyPbQgFPAv33vVPx84eCCSabDPImRCIDJMYpWohGLzpi2leHKnxYK7YxPELo50mZKa2fiy5Xbq3ZP2pcf/1IaHRxIrTnQo3hB8Ai3nxyIuaYmKBtc5juhEggTaY3sbDHKUQ11LMMTQeO75Z23pkmV26PDBsLTaXyZAJWAxSiw6rDqhALothCbOr8gMwlsRiaTMFi1cbBMT5+3hzz1io4tHoxwGrxjaVNssToCsSbBA4vCDEnNcIJbHSRjAVQqo+FdeqJolAaE5271nty1bNm4nThxPISAgRgWKhyHK8KbKFV5asWXzVi+Dcl9ZXJyeeDRakgoaHBi0qQtT9nu/+/u2ZHRJ8hDdh1WAQEh5hZ+ICVyIyA1ifoUaNTSBmwOPqGRVcS96O4jRdsd27t7phpiYnAicQJZYJIpa8MrLuBrnLbZt2eYKUNauOjsyRI7mghQVsBnoH7Rm66Ldd8/nbOnYEoKlCJM87p0TjEQkNlgTGpVA3NsJDX8Ozxfd5S1v9AM5ZJYydN7u3bts0eJRm5w4H9VCswgqXUnXUWX0E1JssW3r9lJ8H05AnVeGdJY4LCV4jBsMDAza9HTL7vn0fXbF8uUOkmhBkicV2ot4D+vPy65xTL09LaJsXVUCkiQx24v85KxOYoBL+7tnv+mgbHJqMnJGRbYqv1HgQJPBP3pkb9+2gwqIISPKmxKVJzVMiaJKqN9Hmwy66Z5P3+sJEXhfVEgeOlUJZPgzHoIO12AjmxngHGR1PV8ZW2WLg03WdxwjlujYnm/usQUjC7zlVcVy3iGeqlBMSogZoYf9jm23BhKMUVFyWyMpGjxfqgS1mvX39VuzedHu/+yDrgAHL9FDVDhAswE2QJza8lXRYZHwwi016VFDlLO3EDiFT0gJMgQKeO7552wIHjA5ES022uiK2hczpQTqgCzmB8WO7VQAXl6bmbW8TIgaY7PEyRFe8ADAz/vuecC5AdJk0QV6KeXwhCVLcajJcMUHyNIpHsEIoWMMb0wJMKoGEiPxCiEyc0fXPWBocMh5QLzUfbJtJrUvL3BEmHWQxfatO5wSS2XLB/4xHb6kPwCrg5ui9k9NTtoD9z1ky8eXh844P3BlZsBJ7bHj7uABHaFhOBF4XKVSNX4uZvg5P6j+X26svAAlQAFLlyy1U++eSmM2Cs4qQiheJUNeGxVKIYAFQRF4IaZzlpfKYSODm46Njdnp06ftwfse9hCQAuk8zOR6OMtR5v6a0yeOn4rh7I4MkBKfyI+KBNUMkJyeQuKZnc/Y+LJxV0Blca6F7TUdG2EEIyqcvDLduv02VomYD7L3J4uiNpbC8Cb4jIcdO37MHnnoMYfFupbnBeujzRAhqMhS1n1Od9EBJoYopj2cAlVzQHoFur4YknTBAHExnjBLs2d2Pe2hCAVImVqrSBgSqhyGeE6K0lvs2HZb6YuO4agaGgnDvQJUoWr88uVX2ImTJ+wPHnzMPcBJiAabIp/1a0YQtBiskiMz8vixfSXt9qhG2SI9wdkBDFFQsbu0qISHQDt37bQrll9hR48djUlUoFci3vDG4CKEM7SVBQqAW4ieEr8HakwvLIjDE05XV1292vYf3G9/+NDjtmL5ypgWq5ushiM+ag9KzPtwUV/B8cuFpQy5q+q8cwABkUWIpH1AMfvD2nYBCY4usdOnT5FwiRyTY5J8bA7Ir50ixdYt28kIhQfgC47EGJvImur5cWN0fgsXLnTY+ejDf2xXrnyf1Qrwh4KtvJ49N4XWbC+1s5EHUMZ8FhCjrWq6M0e2OPhI9v9slpQnkChFp3396a/buIfAyZSnqqob7TiUHxVAW5pc4Tu23xY5CgmO8S/w4wAn4LCaJVSIRYsW2eTkpP3RI1+yK1dclQYigtHam+OgBdOXKGtkcOaC+8uYn1AUOULmgKSUGJpgsX4vMMeeOxiS7bm2Pb3zG9GhIgeQlBEVRi9mKy2lVp4NRmjzNm/10pgrLlYoKMHhhqoSY4uX2LmJs/blJ75iK694nw9PmB84dJCrK1H5VLYN9oZ12/v8GGww4WFKo9keeD6So84KR+6R9UmNc9zOMRdDALno5KkTaUaAtfq+pzra8phIo/uLfWvuUch9Wzdv9xyAF05k9uc7Hpb/rdo5NrrEzp0/a09+4Wu2csWVzhViMdxhwl0fnsCc55dAVIAPMjy22wnIiObyUujKIO1VTXCY+EiTEwBpMAIhd+3Z5es4dvyoZ3f3ZHWbQYU5sQPo3GYVUHgWmzZsKZXw1BL75KQAKxy4IPYOEgfUvQU+e+6MPfnFv7CrrrzaZwmOToMZxhSJI62OZ3E0Trg3hizt9mwCQFTIrMe6h0ZkaAEk94zY2yPcr8Tpx2PUjTIIBRw/fixBd6fnY8+Ae0HsJ+L0HbPLUAIUgEPK8sQAEIhekGdUIb2lY8vs1OmT9pU/ecpWr1pDBIhRXXu2B4rTuLvdmXOLY9oDT9AGLChC7ltZkjSXXHMWSgz3F1MscgPeMD09nUAX+IAd27fZD/71h/NaeA1T8vG8gzXNKfBpy6at7tkVs1sBnooKq3gBfAsFwAP+7Atf9RzgFSCSDSw9PdNKCRWWmpmdtpmZaU54ssoA4d2dS+YIEhg4f4azfXhiZCwoLeEJjLk9lDgkeeHF5+3mm26y13/+8zR9opBd9068ALpI/tb9WlWcYvNGKEAbE0sfImLRuFAoihYOyrtWs0ULFtuZc2fskYceR1T537hhs4WxVK+7NfrzC80LHrsQCOUzsbuO+gIIxR5e7SIR/udckCMzekW1RlLcur60F196yVauXGlHjx4JElWbrdifUHG0vc8GY0znIb/xo2CFq0GIGh6v+T2YFwrgEOYiByxasMia003bvGGLDQ8PuaJQl9El+gxQm6DTlpmuJ8X+/v4UUsIE8DKNwxC32K+EVhve4MmqzX2LUCo2PPiUWtvifJLUtZ/87Cees6ampqjkjJqPOHIFipzFPRHeXk43bthcUvtVGKgrY3Kjc7OcsMlZu/oau/7aD9ndd/7WL8yKqdJsqiy7Z2pFrV2W3ZGisItmtSsxLLKa3Wxm+y9cnLwO/owHg05rzTQNcc7cgFzBSTSGm1NTkzYyMuIehcVKWfiMvUpoxT3b1+ueCw4cfMcOHz5sZ8+dS9ZOvT862/AgykAFKZyKDbdsTHtYOQ3OtsOGFeQN+X47IjwkzAosCTXiIZgiQ6C8Oal6cu7w9FFYNEQYzcNL/Fjm/uwuaQR4CjkKXMuSizXMd3Oy22nCFLPBnN+svKSw4paPbPB9gjA0XKKvv8+1K2XoQi1+YGCAg4nACN4IhRuTqupYf98AZ3BF4Rb2OWGGz9Wmwq1lKYSHmGeEAOb7UIhHbswVkChVmvN5IvcoseGSEnFfjfiRlDXhdq7BgV9s/bvqqqudE3QBnbrXMASx/6ubnqTd1CnFh1xRnlyynWEKqQpWVw0LPU7MUQDXyDUsg9qBXz1RDA+ZMXagZH+IX2RQlVF9X53LmYAr9/2rVnM0Fq6vdz1uHsmZ8Xr5eZxmsekQ+aHxt+5zqRK0OAgv2K02WPdWD8+Vcvqcx6/PGWS8zBChRp8CexXJtu8p9pNyPrB6jZfBfBqUW0rokN3hfI+g4qrt8P59+iUIS5hejGUmoNzielbuUeol+C6Kkl4iK1IANkSqVJd+TmuOm6T1iX7HatasXuN9by4crAcIy7jld1QQSQltfPj3V99+6OK0vTwybOX0eZttLUh4xj52x/ppxXeix7QpUhaJvfsQRpbRpKgyiASsdpUrbLTXpxq6xO8XMgInTYUyDcs7XZlrPrDWc0BO3KPOahcXrvvbp561G9fduHS6bdPtlnVnxqzbbFq31crIvuwBCxdaDQqQldJkNxoUJURdok5T0FXuKYsqAcszsFi3evwuQSHsxlG8JNejl+SerLG5H7/m19b5DyZu3XSnffmxrz1mRe2VWt2mWmdstjNu5cmTxp70PbyggI9/7NppPZQ7Orhxyr0iPAm31Lgt5YSYgl/6OAkxXxkRlspNMb8UXhHcrXSRe3Go6ppfX1f+9J/fXvvujB36vyz6HmT3U10Bd147jVJa7QyL35hlIzApQLvCJVyisyM3qf8XeesJFWUuWvZq57oqQkV7J+/wH2xEkk5bDUor1l2zvvzRy28NH5kzFt3L8IIC7vrkde4BxN6xmTr9DhEj6kiQ2Q+l8uRLd86qilNasb0tQtSFix6FygumM2OwpdxLk63uX6xf98HyW6+82Xe5rI9FjY1Z/eN3Xt+q1zg09YeLGc4YYi6fGSLKR1gpUrxmBKpAWRJNZTvDKjhG2ptzjRzb6DRPthqbAfd8/v7Hy88++Je9l8Hw6RZQwF2fuLGlpIVQSAxMlvFxgeKVrS9BmKzln4PCSsdYZzOuklUqhUmGR0CC5uGUEFPwDA78zh0oV71zxkCoX7YXFHD3Xb/ZqjZFVZlNcwPfGxi7N6rkSLAjip7YofqRpZe9mFmmXaax6hhBxlyg+oGGhrtSrFeggIa+qlNvlcOHWkb65TK9xset8alP3tQU+tOkthqXwYjav8Opk7uu6jdLQupEuSxhFW2AIm1PL4rPwrwJbBGziKVWWUW7LkhX7NtX9k1M+C8//98vWB5z1oGmXX3779z8S8Sij7gdxrIEQgkS9lKraGg6v5/PklsIRrZIGyL5LnQputzzQfwqNfSZZxveCaH0xhtlNQJ6jyq4YcCKg4NWG23Y4FzTlt3xmY/8EkKx/InSJolSNTUUyNvksEQcYSrM4LPGcgkdBtGpZbqHRTznWV7llPcTeg2BU9UJv3qvCkCJGxqyeqNpK771nT37Xvj27sSvVX05LULIOR+FaVF8vPB9henpzoH0MoPkzZULGL9HSNOeyBeeW7JEmj/HKwBa/2jN8d3/AiYe4y8CE9W+AAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAACDJJREFUWEdtV1tvXFcV/vaec85c7bE9M77Ud5umaZyQGEj6EPHOA/yBqqWhKKLiVoQoggekCvEAD0CBF/KAMChVlapSQknUFoKI6rZKHMXEl9okTkR8IYnvdm3PjGfm7I3W2nvPjEVPsrXnnDmZb61vfetbO2Lx/kMdiUQgIxFEZASRiISUEUhJu4QUEsLtQigAGhpCa0itNfiq39xn2rWmv+D37E6fFT1X9J2CuP/veQ6A16cEIITgIFyAdM+YDGDwXRB8WxeAAbZBKAusFYMrpaCUhpiduKsjHgXg2SBqDDCYEKA/vufB83xmhe7B62AA9YERuMues7YZ087gIQUQQvxrbFITuGdZoEwd/QTkaA6CKKJBlIMUVBbLhHmnjgVLg6G4RncVmDMPEYYKYRhCfHjtuvY8yp4yJHACEGYBXC+64rE4YrF4lQXigdgx9Lvd1LuavaXZ0G2WAw7DCiqVCsR7l69yAG6ZAGwpuYSKM0wmUkgmEvCDgLVSz4ILoF5sTLkDtZRTxrQImFa5UoZ4642LBwKIeB5kVWi1bIiBRCKJWCzGwXJ38HsuWpu9MqxVwS3VDE7AYQXlMgVQRqlcgvjD70cOBMDlIAAWGxAqxUoOghjisRiXwfdJjLZUNoCa6Iy6Dd0m47ASMnClbLIul2mVUCqVIH75i9e4DbkErAOz2BukrLY5CZAWiZEZoACJBdd5Gkbp1Vpbupnych14CSUKoER7CeInP3615gPOD3j3EGEQEqREEAScOS36zphUrR1dq5kWOwjuKKesTfZlwwRp4OVvf1+z0Uhh26/OBS3NBOT5fpUlNiV2yIPqp9ozONFv6+3EZoRXZvG50rAPnP3aN7RrJ7Yc14LStaLZTUnqLdo8d+ZH3VJrNVt7ZsICqrD6PevF/kPxwnMv6lrv1vtrzemYaKt644507wKwhlN1OsUMOC1QUMaQSMymaZy98288/+wL1rKNernv/99o6y2/9kN2MnECVPtP260xuR8w5abZIo2fPP/sGR5VB1kA19d4oTOlg+8YGt0zkyUPGS6FScTsdiBxUkZnrpxs62eee7FuiJEc6CVbc/Z9Mw/ox0PycO7pkMXGNWenrAEy5ZYN+uymIWdCWrIBuOEnvn7mrHb1JFpoKPmBj2iUej7gaOki9e7v76NYLKJY3GcTcYqu1rnO8x0b7hxg8E325DfcSREJ8dLZb2oG9jxEowHiiQQaGlJIp9NoampCMpnkDPP5PLa2trCxsYGNjU3sfLKDYrGAUqnMbeXazwXjpqGZZUZVRD+Bm/OH2cV3v/U9TZnGE3Gkm9Jobc2hu7sb/f196OntLQB6UkAQDQMrq6stszOzmJmZweLiIjY3t1DIUxAlLg2ViOpuaDfnAaMiY2YUAJ0ryOrN4ceD+OEPfqRTqSQymQx6+3px7LPHKIBJrdU1AA+klLu2KQKlkBUCX7o5NvbM9es3sLCwgK2tbRQLBZRLpt+rwnOta73FUU+gvmdMjRn46as/05lMC/oH+nHq1Ek0t2QuSInrAFYAFOlIUNeVgVKqSwj5ypXLV9rGx8fx6NEj7HyyW9UEtbu5BDw2LnvU8zwEnrPzoDpzxGu/+o3u7unG8PAJ9PX3/00IvAPgIYACDUMLTlOJfpr2FIBn7t27//KVy5cxN3ePNVEsFHngMO1Et6BjHAH5CPyAhxgNs1g0buYKs+BDjPzxz/rpp5/CyVOn1oTGOUjMAtgBULapUP19e09BRAH0VsqVX4+MjGBycgqrK6vY28ujUglZb2Q2DpgA47EEn6gSiZTZ4wlEozEWpHj7L3/VJ09+Ae3t7W9B4J8Ali31LvsYgABA3jJCwfRorX87MvInTNyewMryCgdAQqTTEdEe+JRtDIl4EqlkAxpSjWhMpdHY0Mj38XiCWRGjox/o06dP72utfiel/BjAFoBSXe0JnMRMz+iKQuHQzu7Ozy+8+Samp6axtrqGfL6ASjlkt/MiPtOdiKcYLN3YhJamDDItOWRbcsg0Z/kZBSHGb43rE8MnFoQWr0PiLoBtAPs2AKOm2kXlSAL4/IMH86+QBu7emcP6+gYbVFhR1O1cXzo5pRINSDc0MXBbrgOd7V3o7uyjIIjlKWgsi1u3xvXw8PCmEDgPYBrARl0J3IGbgiABUv2zWuPLYzdufOX990cx/2Ae29vb2C+WuAW5/pEASaI+1ciZt+Xa0dPZh8G+Q8hl2j6GUNeg5R0NrIqPPvxID39umJR5QUp5E8BjW+8KQigYJyZwKkWTUup4oVD4zrvvvIupqWk8fryMvR1qwzJ3QESaPif6OfvmLDo7ejDY9xkcfvLoHrR6Q2h5AxL/0SHWxdW/X9VHjhxBR0fHTWj8AxLzdV3gutoDkFYKQ1LgpdHRUX9iYhILC4vY2txEgVswZPejAEiAJL6mxmZkW1o5+8NPDqGzo/umVuoihLyNMpYQYFtcunRJDw4O4ujQ0VBDX9Ra3yEhSilJdKYTFBKQOASNr46NjfkzM7NsxWtr69jb3UNpv8T/4SD/J6eL0gk6muAActk29Hb1Y+jwcWSbc1cE8HYITFcUHmuJXXH+/Ou6q6sTAwMD6O7qpv6fhMAalDUiCcr+iWKx+EXq+bm5OTz870Osr6+zA5L4KHszhKgEpgUTsSQaG9JozZr6Hz18nMR4CRoXKxrTEljxSsiLc+fO6Ww2h7bWVuRaczwFySzIq+miozM53dLSEpYWl7CyvMxDaHd3l6k3g8icB8kDaN77fhTxaBwNqTQyzTl0P9GLoaeOoa218z0hcAEKtyshlr0o8v8DvCdEAfmL8b0AAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAIAAAACAIBgAAAHN6evQAAAABc1JHQgCuzhzpAAAICklEQVRYR21XW2xcVxVd5z7m5bflR/xIUoJCUid1jNQSR44DDXJDa7sJbVqE1AqqfpRKCIGEEB8IEH/8IIGExAd88MEXAgofQJJ+GBelsVoU3KiRH23sGCexYzt2PWN7HnfOQWufc8fjNDO+utczc89ee+211z5XffDeTeN5Hj59KCh+rjwoT8FT/F+Bb/7xpY1GFEUwRiORSCAIAihlvzTGyKG1htEaZa3lmke5XIbWZZTLGuo/Vz8QAL5fBaL6WsApKBWfXXQC0BrFUhHlciQAwjAUwAKAbwfgUYEJgod6d+x9Y4P7FoTvwfd8OT+SFZchQzCDQiGPUlQSADx4D1mqBmAztpnLwewjB2Ds0r+N5zO4D1+YsNcWCAH5VUDIhC0BsytHEXbyOygUC0gmkp8qQ5z5nuACIkLEcxRB/f2tKyYOynNQDUCuq9hhdsKAkZqWSiVsb2+jUMwjKQwkRQdch78TkLoM7TK3QXcBUD/qj3/4i/H9wAYObPbxIgxu2bDsCL0e04fQXiwWkc/viA5iDYRBgCAIBYBlwFIdB4/KkYCw5wjqd7/5vWHAgCAc+kCA2ExiULYctiuIgAuWSkUUCoUKAIIQwJ7HGlnlx8Ed5TH1lRL84ue/NERM5H4FiAMQ7C1JLEpLrxVVsVRCqVhEIunaMBaga72K8AgkinaFGFkdqB/98CeG7RMGoVDH7MmGzdyxEJfCaWC3160PUAthIpTspf+1EY8Q9ZfpAU79cRe4M0ukvv2t74gGpHYhAdhyPCq4aICGFJuNtCIzKwl4lontV63+XR1Um5C9Jlj1jVdeM6yrNSMrQMuAy56eEAvQBY8BUAtciFTyPhoWBcrsHzahGJR8boxoRAB87eLXjVy4xQWImJLzg4cBVKzYtqO1XC1GJgCcDQsIijC2YxeQAOOXxHzh/EXDBSwq+9VeB7QtaK3YuhwELE8uIIz9zvW+9X7rfrK2tkBlbZktzuR4z4XRF4zQI4jFQCXILggCiK3Zl6H0cEmIiQvb+lu1S587CyagmGVr+c53aFjnR75qATi0BMpMxILVrjVTF7EhVTun9Lxjg9myI+gPNCoBEkUVUTIxGzz2nGAvALLAMtDtdnVgf1xtVtK2iRCJMBSx2mmpJBjnQj6flyFFpySguP+JlOtWr6WeH75gGNjObdaJgvScKfHH1qRCen2YQDKVRCadRk1tjRyZTAaJRCiTcWdnB7lsFtlcFrnclp0TDojsG7SR+gsDrtPU6PB5KUFsHmRAOoFBeTDbMIFUKol0OoP6+jq0tLago7MD3V1d6OruQlNTkwRbXFyU497de1hZWcH6+jpyuRzyO5YNgqR6Zep6bmiNPPf8XgCuC4iQwenvqVRKMm1obEBXVxd6e5/AwOkBlupPymAKwCaAlAaOKGD4xo0bDZOTk7g9fxurq2sVECyHFaPzHc+HGn52tEqErlVIUxBYypNJZGoyaGhoQGdnB/o+34ezXz47Ywx+63m4CyC/29lIAmg1Bl+anpq+cPXqu7g9P4+1tQfY2tpCsUAWyqAW7BbPg3ru3Ihh67BXRYQxA0EgMz6VTqO+vh5tba04+vhRjIwMo7au9qee590EsC2isbvE+EwQncaYN8b/9c7x69ev487iXWxsbEgp7B7SdRo94StDz5rqDaMVoRLxJZMJ1NTUoKm5GY89dhCDZwbR39//V6XwZwAPoigqBUHA4JzRRE8QPoA6AE+urKx+/8rly5iemsHy/fvYym1JVzBP3iQMDJ09Zyq7Fl2WGlGEQRhI7evq6tDW1oaeYz24+OKLFOCPAXwIYMcFDQCEAIoAIgcmQRZg8M3x8fGT1yYm8L+FBWysf4JCoSgdp+Cc9ekzZ41sDhicX4gJeSK+tKOfiu/rO4FXX3mV0L8HYA5AwWWcAlADIBtFUcExQlCNAAY+/vjWm29fuYKZ2Vmsrqxie2tbygBjHVUNnBq0GqA6K/X3pe8zmbSIr6OzE30nTuCll1+mk/3A8/CRY4CUM3vWnWIsOT0QQAM0nlq6v/TdS5cuY2pqCsvLy8huZp0YbbKq/wunZBryJQ7oRjIZIID6+gZ0dOzDsePHMDo6yp7/GYAbALZcCaScVRqgHgiqGRpfXFhceG1sbAwzM7MWwCeb2MnnEZVo0Qbq5FP9El2oj/cEYVBVgjq0tbfj6JEjGHpmCAcOHPgVgAnX+6y53B9FEfeWqlwue77vsyz7AJy/+eHNc9cmruHWrTms3F9BNrspjlksluyDCQEIFXz8ok87Buj11EBtbS1aW1tw6NAhnB48jd7e3r8ppf4JYMXRzsaOpzyzJ/0ZrfVnlPJen5i49tnJ/05iYWFB/CCXy1YAyLacJYgfu6wF22HBQZNMpaQNm5ub0N3djRN9fXhmaKisjf6153l0wAdOjNZdbHDqoVFr/USxUHxz/J1xqT/teX1jQ1qRw0qsmQBOnRwwnGbxjK9sy8LAumCG/l+PtvY2YYHd0Nvbu6a1fsuBWHUtyOzTWmuqf7+nvKdnP5o9zuzn5+dlNmxubsrMyOcLMrKpA+mCysOnexyLxy+32vSC2toaNDY1YV97Ow4ePIjDnzuMnp4eMvUPClJrveF5XhIarfBwCAZP3rl7p2V6ehpzc3NYWlrCxvqGzASpf2F3TKvBgTN7S+D2ggTBYUQW0hmrhaamRrS0tKCjowP79+8XRlrbWu/B4DYUamBweG1tLUW1Ly0vSWAKj1Mxm7W1J/2lIjctdp/wfzsfBqUF0WzbAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAACO5JREFUWEd1V2mPHFcVPe9VVVd1d/U2i2fJrHaIgxOTyA5yHMcYExMRgVgUzG4hIpZ8IgSUCEtAPsR8RCT5AwQFCQSK/IVFRIkRIBEhL5lxHOOZsSfYHs+MZ+uZ6emluqreQ/e+6m7bQMvlru7pqnvuuefee0ocffKoFkJASAFLWrAsCcuidxu2Te8WpJTtg3+bHLjjpemz1tBaQykNpRWUUtBKQWkNaPB9nJSDdDqDUqkI8aUvflkLYf5AwWzbhkOH4/C57diwLbsN5FYAdB3A/0HT3ekfBWcACiqOEcUx4jjmc/qbkBKpVAq+76Onpwfi2FePMQMEgDKmwPQD13X5oHMDxrAhhGwzYAB0XpxkknUcK0RRhDAM0QxDRGGIWCm+lu5ZKBQwMDAA8dQ3nmLmiH7HsTloOp1GJkNHhqnyPBcpx4Fl26YUFJnKwAR0UBjqDe1RGCFoBmg0GqjX62g0AgZDr5TrolgsYnhkGOLp7zzN7EnLUJNJe/D9HIrFAkrFIgrFInI5H57nMROWJAboSOgnLAkJlAkFj6OYg1erVWxsbGJ9fQOVyibq9QazQHFKXSWMjY5BfO+7z2i6SFoW3KQ2XV0l9PX1YXh4CMPDw+jb1kuZ3wSwBQ1KIzZhKSSHV5CJCJSwILQLiN5KpVKYm7uB63PXsbi4hI3NDWbBcVIolUoYGxuDOP7D45q+JFqJ6ny+gP7+PuzYsR179+yhsvwGQryHOC7DkiE0FBQ0JKfdSr71nYDi7y1YIgctxgH1mUtT08MzM5extLTELFApqQSjBODEiyc01Ynax/Vcpp2yfvCBD2FkZOR1QP0WSlwDUGeFmbSN8G9nv6VGAkW96sZS9VpaHqk1Gt8/c/oMrl2fw9bWFncCiXBkZATilZdf1pXNCrcLlYDoHx8fw8P79iGTzbwoIf8EO74JqCZqWiGTxKm1gXTaIAOBGguTAFDvlgDshxQ/PnP23MCVK1dYEyRWP5fD0NAQxKu/eFWvrq6iGQQsMgKwfft2HHz0EdLF84j1m4iiZSgVIqs1q4Be/h1TaCv57PsCqArUBA2VAizxYWjx/OS75++bnp7BWnmd5wJ1GulMnDx5Ui8uLKC6VeVOoBIwgIMHoIX4gYz1W3CiFSAm8WlUtEbujuCtjxWgAiCXy0nUagkA7IWQz01OvvvA1NQ0VlfX0AybcGwHhWIB4tSpU/rqv69iY2MdWmnkC3lsHx/DowcOQDr2c5IYcKJlBlDR6r+DExoKm7zolErgSxtNYgAPQcvj5yYmdk1dmsbK6irPBurjdNqDOHvmrJ6ensbKyjLCMIKfzWB0dASP7N+PTM7/kYz1HxFFS4jjED7R7wOVSkuIt1ORywnqVBZhTRIDRVjiYUCcePvtfw5Oz8xgZWWVBxO1PnWDmLo0pS9cuICFhQU0GnV4rofBwQE8tHcPhoeGXoHGr+HEC6ipJjJaowqN7P8pQRVAllqTR6WNplWCLY8EQfNnf/vr3zE7+z7WymXUanUe06zVy5cv6/OT5zE3N4datcoLqLu7Czt33oP9+/b9C0L/FEpcgtbUhnG7Dd07QATtz9QBEinhIpZDGvrrM9OXP//OxCTmb8xzF9QbdWabulpMvDOhL168iPn5eR6d1MS+n+VFcd+uXdi9e/es0ur3kGJBQjfMFLxtFtyKhC6XgEgphS4pxP4bN+Y/OjF5HteuXsPaWpnnQCMIeFfEKoZ4489v6NnZWSwvL6NWq/Huplmdz+fR29uDuwYH0d/fz7vB89LMEC2k/+ULaBsqFaMZNLFZ2cLS0jKX9ubNJZTL6yZ4vcF7gkpA7Shee+1XemF+HuVymf9IqGgz0ljOZLLMhp/Nct8SMNt22LQQyy0gnYEIqGQNB0HAtSZWt6o11Gs1Vn8QNBGGTYQtAC/9/CW9srKCrcoW6CLa41IKzjTlpJByjTdgX2AbXyDlLS6JN6NhhOczs0BeIDZeIGii2Wxy4GYzMN4gCg0AEuILP3lBszBqNb6ALqaMaO0ah+SwTyBAxqbZzBBtT/oNg2mzYYCwMVGaVy9RTWaEAnLmdE4g4gTAs888q6u1msk+itjLkdXoeESL+9UmMGzNjD1jMPxOQOwEkGGHrqdBwSDiyDgjAkKZMxjDArfit775bR0kboUNJPk2XmainWUrKAFoM5Gc21biHak8CUBihEdBIkoSmwERcjnCKGEiCiG+9pVj7AfoRxTcLFnB/sC44STLJGM2qhaVhQI7rBPHJt+YHCTSRCNUSrpnB0CrBLcAOPrkFzS7Vs7e6Nm0WMeKsxaS7FgTrAsTPJVy4aY8uCkSqgc3AUKsMROJTeOax8ak0hGEAYtSfPbTn2NL1s6+Rb8kFkhs0jwvcOZk2Sl4qh3cS3k8Hzw3zQY27abhuh6zYmaGESlRa0QZ8hxgoxrUIT75xKc4dsvgGAYki5AA8IMKl8HUn25MLZlyyLZ7SHtpZNJZZDM+smmf3zMEhMFk+DfUxgSc+CUtUODK1iYf4hOPP5EAuJ1+sk2E3AAwwZmBJHu6MWXdCp7388jniyjmS3wU8kU+/EyOtsR1CCxrTbYOEgJdAD5QXl9Ni48/9niyWln77RFr/L80nZBooCU6k72LtJehAMjnCigWutDbvQ3bevrQ1zuAfK5ILvoCtHofwCKkXKddSpoUgCu06tUCO8Vjh490APDDhpkBreHSop9K0BIfCc5108ims8j5eQ5OgYcGRzE+soOAndbAOakxq4FFrVEWQEUBDUsiol2tFDLCQp84fOhjrP2O+k0HtLrATMSkBNwBZjRTfbOZLNPc292H4cFR7Lx7F0rF7n8Irf6iIaeVxk2tsS4lqhbQiAWaKkJMz680PlSMrDh08LBuPWJx+7W7oFMCM/EIhGk9Iz5Df1exC4P9Q7h7/F7ce8/9iwB+qWOchsA8gA0ZoRZpBJ6DSHmIVcQPzZpybERwxEcOHNLmOa9T/9aqbQ8hdlcdAOSa0l4WJLye7m0YuWsM93/wQQxsG/wDIH4XCbznxFgLU6gHdTSzHuKI9lxgHltUCC0dCMuF/A/LHk+Q0NwfkAAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAgAAAAIAgGAAAAc3p69AAAAAFzUkdCAK7OHOkAAATDSURBVFhHjVdtbxNNDLT3Ln3+/x9DCFRVlNI2NG1DKQ98p7dGM7Z39y4RItH18qLU4/F47NXLd9dWSpGpTFKmuJdJplKk4DPeh0uLKN7jrira7ipiUgV//cqHmomKSDEz8atKrX7Xq/efDYFawGkd3D93MAhWikZwAMnXKubBHQCeAwARIQhVmTJwBZBqop8+fCEDDiIybiCCBQb2K0HwHgxEYPzPyuAaAJwLxdNEVEUmAxO1kgn8QK8/3hmznDx4A3GuBAEkqQcAEc3MHcCZEhCESGEZeLeC7Ang5nIfGhhBbOo/1N1ZcOpFkZgsZABPVkIqouFFPIiSl0kRlUnABAFU0durr0MJgupgA0GaADfiw3fmwZcQX8veQoTqtcfDGegAIEiKUu8/HQJAF1sXXtY8vqPiXXya1JszgMwb/SHCICEZ6AAABCyAgf3nx96Gm3ZbCy9aD8FBv2fuwU0WBf2uATwcAnA6CtSeLFCICUBM9eHmecNAZ8JLoF39kX0Iz2sfIMbsowQImPT3ErgYXQdmqofb4xrAWPcwnGw/iq9AxLKw/giurfdXHYDaUwMOAkGzEyZqIVpSH+++nTJwVnzN9VL5C6hv5uNspPZZAL7xFmxtOHYCS/J0/3K+BFvzoekgJ03aXf1KDaz7PxUQJcj6M/jQCWBBn/cJYOP7g+k0B4TSeuuts0frry045ehzYGQhNEAGjl+//7UEzXJhQN7Wi3rbnfT/OIQGI+r199rTDdOWNwByEPWJhy4YJp7bbm8/lmAYQOMQYgfEJByNyLvAAghKMOUcSAdMP2juF/V382ntF7bLkROtty0CBZjjOOqfbUg31MPds+3mnczzLAlkbb+D73vmWfsE4wBMjDMgJ0C34NYFYUDNB6iBx/ujXewAYEcAI4g2dIR9/4bg6r2PFnzb0J+Up/l0ExqmYfQ/jUhEZn15fB0Y6CyoKjJl0LBdBITwfovwegsfYK7wKKlSKu5QPPiBFfsegNpReFH/WUR2BgA/jr8M9M+RPRhQLfg5gncA/T0++52MNPOhwk3V8GNUg8tCAxGiIwAVIQARudD/j79sCgBYSnI1WwFwupORN8n3sOSQHXwqMtfqr8dHegHUnwAuAMIBQP0RPDWginZdBWXtGytrG2aw6mbjeW/2QlAy1H8nFgy8Pv8kAGS+7YIYu1kGZJ4gshXpAbmADNMvXTCbAhpATaCDGbWPEvyn359+mK/k3YTGNbzN/hTjdgrGFrwBkQCyDG0pTfVThGazvhxerZ0Hpr75bLfg1Q7QvSBX8Bh8J+t4AzAspmw/sFCXRfT44MMoDyajCbUFNBbRYGM0oO0O4C3Z94BxIaEGvBus1FplWaro094Xkn8D4JbMsezj/mQM+ybWFpG+EQ8nIwTPSw+3T1GC06NYO/kMJ6ABQADJjh86j4Jw/VGh/oeLQx7PGoD9zUMbRs5ETMI8//HeM++TEYEzwU3Xx1sGzkGxCu5nAoDQu+s4mIyTMJeRzPwcA+E8tLqWvL9g9tGA/UCK7EFEdSaiDHpzdbti4PQk3A+gSf+6DF3oIw+r7AEpStHOhQSAs+Gln44z8GkJAgAXk7iYtdt9r3x4XWYeLLBPSX/MbKs8FXORrFX+AKjG5aOnFa7PAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAABWRJREFUWEd9Vz1vHVUQnbv7Ph3b2I6j4CD710DsYGTFUhQFE2McgYQoEA0FEhUFoqRAVDSIhgYaCoREA6IBGtLAX/H72L3onJm5O/tscHy171kv75yZOXNmbvr7+T+5qmqpqkrquhJ/XaUkqcL7Svg6VZIqPJPwX0oifG0/eI+f7I/M1znna6fNrbRtlrZtJf3153MSqGsnoc9yDBjvCR4P4PlbaDg+kPHbAwdwBjAJtNI2raTff/sjE7yupe4R8egRechEJGIEyCL+ABzJCNEj4uzABt60jaRffv6VBOp6wCzo6UqhrxH9DSQKAaA7CY1cM4Bo7QnQcJqmEZz04w8/5QFAB0qAr3sZCbqgBrQUVao0/V57zwBL7+nXWue2leYGcBL47tvvM8AH9UAGA8sEn3ZYlo4EhAhw1wIV0AV/HTwbeINnw7ovm6U0y0aWy6Wkr7/6JhMYJP6LCLrESqFd0RdkCZ4d4ClXletBulumPIKTwBeff5l7wIFIPeiXZLUzvCVD9lV4rvTGwQHcaNTNkpHzLJaSPv3kMyUQDwQJcNNFLIeTiO1Y2t9FZ5EzakQPMETvwOGZPvrwYy2BaUBBVQ/QBYj0CKAU9AYrg4Vf2s7BITxTOgncQIIifP+9D6wNjQQ7IoJDoF1ndGUwN7T2o/JD6hn5Stobpr/TAX3gnct3jQCsuO8HsT09Cz0d0I7VfrXnO4fT1CuJUneqX8uBv7fIwOX52xltRgBzQpqSpV4F2hFDN+BznAs2E9zxXPXoeQARnICIfCGLhT7x3j+bLp4+yx1wv+7qDSZIJ2UkowgjAYIz9Vr3BYFx5jJfLEiA0eugkHTxxrOggY6AC9BJxI7QiemuyO8pPh/7HcDz+UzPYk4iHr1Prf8nAGu29lS39KnpExMCSGSAiHTCac8jUoDOZlcyI4m5gjcN9eKzI715dskMMGLrALahzQc8Y2sWMdqY9i+C34MASgAgRAvwq9kVM4BSAFxTrzOExwkUEbonBALuC2Vi2niGF/gS4l3gqkfETgD1RwtiMAG9DDR4yfnrb6kGSgcE41npgM6QohHpJIptiPQj7bPZTGbzK4oR2dF1KZVlB99HAtrbOvWuEwl7Aj5nm1PZkFaMSEuwkMUcqteDrGAZYdtimnL90wGYnj65yLBWkjAC3XakH4wr26oR+T7gVkwdUIhoOW1FTENkiL5luyd0NRqNJJ09PtcMBBIEDFkpi2pZzXxBxTzotiH1AxMjvMDmPxzSt1UEiTkzGo9kbTqV9OTRWe7WrbCM+g7gxG4E9y3Zv35l/eIS2uqIlkzvgMMi8unaVDY3NyQ9On2ck2hEvmisbsWsd1jP1YTUA7yddBfpVnBuwJYRqjQJszoYDWU6ncjGxobcvr0j6eT4If9v3Pf52sZtuROsruS2hzmReClway5/ww4J8GEt4/FY1tdvyfbOtuzt7Uk6uv+q3SDIwsh6ZPq3PjkNp7eMxguKLmXecbrAmupHo6FMphPZRPS7u3JwsC/p/suHNEbdpe2SUbZdXTj7t6HwGV/FV64F8YrgBKD6IdOP2m/KnTsgcCDp8JWjrN4c/JlRA9iXT1+/Q2YMPHZBtxuGDJjxoJ1BYDKZUHzIwP7+vqSjwwd2k+hSG8FdcP0d0Ffxm0LXTFpCy92BAhwOZTIey631ddnZ2ZF7L92TdPzguJtNvHBolO50q0+vfdFAvJgYqtXUpp7qCN/rLbi2tiYvbG3Ji3fvSjp57aTrggDuzugGFdu0XEivXUxvuBGbIIsWkIXJmG24u7sr6fThafbVqvR/sWTMhs6coia6q3ksg/uAX0ztahZJ1DCioSALW9vb8i9gvLcUKCDqKwAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAgAAAAIAgGAAAAc3p69AAAAAFzUkdCAK7OHOkAAAeuSURBVFhHbVdLbFxJFT31vv1xtx13bE8+/mXDhg1sRyDECrEC8Us0I7IYAcpICPERIFiMZgUbJJDYsUBiBQt2iN0sQOIb4Qx2xhmc8SQhbbvtbvfrbr/+vG+he6uqX7ex41K9tKW+p84959x64vzlSFrCgmUJiOlOzwL0DwJSAhKgR/qFkJCQ0qwcucwhc8l7npuVTZ+znJ4zZFmGjP7Ou/q7OHs2kMKyoECoRcUVIK4H3vQPFedfBkDF9U5fPAWgvpyLZGrn4lk6fVYgcoijg3NpWfa0uAHBO7FA1WcR0OkvM2BOzQCokN6nhVXx1IDgXS1xuHcsHduGZduwLRs27TYxoUBxK3gpCrgXmn6mfo52feqZwimdmoqnevH/NaA0g9j7xwfScRzwsmm3+dm2aZmWEJD5NnAL5mifL64KZ7pwgiRNkCQJUlozgMRf39mRruNyUdd14boefM/jZwWkYGJWB1MNaPrnhEaFdRFVOEYURYjiCEmcIKXPmJEE4o+/f0eqYi4814Xn+yiXyqiUK/B8T4GwbAgSJZuA2jDjACO2qcrVqYl2OnGcxJhMJhiOhhiPRwyAQHFLshTiN7/6LTMwPb3vo1pZwGJ9EdVqFZ6nQBg9GCUQA7Oqn1W66TedfBJNcBFeoNcLMBwOESeJcgO3J4P42U9+Ien0RD2B8D0fC9UFNBrX0VhuMBP0OYmUXDHbBvY8iVD72iidqKUVxzGf/LzbQbvTxjAMNQCyp3bBD777YxahYUEBqGFlZRU3b9zC0uISfN+famFOB5cAFMJTgqPT9wd9tFonaHfOFANxrO2oQIivv/FAktCUA4gBD9XqAtZW1rC5uY3VlVWUy5VLbSiSkH3PQjTWUnaj3o/HY3S752geN9EhBkZDJUJqQarSULx+76scRAzCceC5BKCKleur2N66g1s3b3NLrtLBbPQqDdAXK3EZ+tvtMzSbTXS6HYxGI/7chBAH0Ve+eI8ZIBCUAQSgUqmyBrY3t3H71gZqtZrSgQ4mZYUihgsGChaoUDgMcXraQvOoiW63ixG5gHKAXaJnwZe/cJcBqEUMuChXKmhca2BzYwvrt68GUMyCYvgwC6nKgDiOEIYhWqctHB0doRt0uSUEwLiAInvKABWnSHY9j5V/7doyNtcJwDpqtToDIwZ0FHAEGyuqoaN6SgCSTDtAA6AWBL1gBoCZjBnEvS+9Jjl2KYKJAc9j0S0TAM1AfaYFRRAVo5cLXxYhMTAM0Wq1WANXAeBx/Prd+7oFZEVHM1DGMrVgcxsb3II6a0CNZzUNSfXFjFe0F0MnQUQaIAZaJ6yBIJhnwIxrcf+1N3gakgU5jj0XlXIVy8sNbG1sYWN9UwNwGIC6A+Rz4zXNjLWUBSlqKffnAHS7GE8mWgPmspJBfO3+AxVEZh54Pmug0WhgixhY30J9oQbbcfguNOt36rUaLGo3zzwDNIATckHz5ZQB44Dpjeib3/jO3Cwo+WVUyAXEAAPYRG2hxlFMxem0PN2SCHES8YmSNObPzMilZwagNWBcQENJuaC4rokffvstSenneyWOXAWAWmBcsEHzYaRvg5UonmA8GWESjUHPVIiAUPIVIGLWAGX/6dkpjk+Or9QAtVL89K2fS6Kc+k7qp0lIybe0dA03XrlJIXQmBPpSwLMEluMkql0MBxiNwykQBSLmxW1gBtQg6px32AlGhPR3dWVTWhK//uXv5GJ9CYu1JdBery2iXqujVCr3hMAhBE4hkEKgagnczmX2kXb3DL1BF+FwwCCICb5s6DYoEAn7nuzXbrcxGPRZhKQBuqgSABK0+PMfduTa9VewtnIjl8AugOcS+akFKwAwkMAEyGFZqMGy7gD4ZPu8tX3U+i86QXsKYjyhlFM6UIJMGRRNQJqIZhLSrKDoNlc6ERzKAAJ/Enn+OBdWU0oEQiC0JMZ5hlhayCh8LIESgA0h8Jl+2Lv7+P138fL4Obq9cwxHFyAAVDBNqQ1qIJmpSNcxHsMkQH2FM+8VIniavZ0La9/KcQKJvu1ikseIMwdpniKTGXJUADuFYwErEPiEsPD23//1l6X/fPAeWmfHGIR9jMZDnv/EAjmFbzzmBqyHz+XiFGoieCo/lWY4oVMnFuLyGGleVS87WYzcXECcEmwAi0Li4xD43t7+o1d39x8xC71+gHAUYjIZKTdQCzLqdfEGZHpevFGpUBfBE7k1BC7KDpJkhCxPILM1yDRVrwD04zgQ/gC2EKi5JXxUSrx5cPjkczu7/8SL5jNuQzi84EunyQbDglF7UZi+li40GsDgiWxMckRRH1l6QxWdLW4AlAewbRd1DeDB0w/f//zO7kO8aH6IbqABsCMiDiZOPD0v6L3RTE8ur6orBs6fynpURRpFyC8XNsWJgdIQjuVgyZL4GCx868nB40/v7u/gRfM5AhZiiNFkiDgiAHo2UBu0369mABBn78mFqM43qf+jnQGcQPiLsH3ASxysCguvWgI/erT38M7+wR6OW00E/S4DoEygUCIA5oaspqa2Hb1N6XcKRYCEaP1bVpPl4vR0WrwEbA/CKcOyPVjjFG7VxwIybEmRfzaO4+8/fPdvOHx2gNNOC/1Bj11AViQNcA5oB7AQ+fVdgzAAGAzwPxy4tYF6RUHTAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAsdJREFUOE9FU0trE1EU/s6588iria2JD5Rq6oNKFQOu/AWu3bnyX4igooK4E9GF4M6NFqTia1GxKhU3vpBCpYpW26atWmzURpvaZGbOkXsTdeDM4d653+N8w6XJN9Ma+D48W8aH53nwjAcmhn1U7avdVRQi4ipJBEmcgMZejGvgB47A9zwY48PvkDEToLYAUXUEf4FxHMMWjY480SAIHMiYtnoQhAiDEMYYEMipi1XvqEZxjCiKEEUt0NDgzf8EHfuWIBWm3DgEbhNYcJIgjmK0ohaiVst1unTxsjrLFuxG8GBHsiTWDRH9s+5sRxFaTj1qj3Dm1FllY2CYwWzAzJ1RDIjZZaD6N7TYubA5iIoLmY4dPaEWREyd5C3ABiZIbOL2cCd1u28DdSJs4Hk+6OTx0+oHPsKwbdt+tPYajYar1d9Nt7YkNg8L9D17NnBB0/lzF3RNdwGlUgnFYhGZTBqNxgrm5+dRnZlFbbHm1pIomAxCP0QqlUY6lXGdhq7f0HJfGXv27IYf+I9V9QsR9TQaKwdGH41iYuINvtW+I4kEYZBGNp1DPldALtuFbDYHGns1pnsrlV8KGQQwycy/RSRkcGVqevrwwweP8GnuMyQGujIFFHvWYX1pI4o9JeS7CqClH3UtFPI3ReUZM9cAJAB8EdnaXG2euH3rLqrTc2D1UOregHLvduzc1o9MOjcOYIpEtK4qg8z8FkAdgP0/IQQ7lxvLR+4N38fnuQWEJoPeTX2oDOyz4CGIPFXmBVLRRVG5w+D3YEegIlIgov3VmdmDz5++xI9aHdlUHjvKu9C/Y/cEErlCzOOaoGYJ7H0bhso7MP8UEQNgCxMfevH8pf9xcgory03ksz3o7xtA76byiAquETCBGN+pvrSk+XxhBtAPCiwTqAuqlWp1du3HD1P4urCIVjNBPtPtHGzesGVEgauI8VoItT9jkISSQyYojQAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAQAAAAEAgGAAAAH/P/YQAAAAFzUkdCAK7OHOkAAALNSURBVDhPTZJNb1NHFIafmfsVx9c4QQRbsMNSArhYsEhhhRQpbBs2lCTQiKqtkFigLir1B8ACiV/AhgVIrFix6IYFBCEokULFxyqY5Log4SYmxopDkvsxU80Y087VkWYW88x5n3PF4pMX2nVdTDmug+OYkgghAI3WGiElUghzIssy0jS1lSQJYv7+E+0ZgOfiuR6u14MYgNaKTGV2L6VEA1mWkia9y3ESI+7d/UN7nsd/1evEvJgpRZomFmCgtoM0+3o5iWPEzRu3LMD/H8TEkVKgtAGkXzvon83r/RLXrly3DvoduCaGddFrWSmF1WH2Jn+WkaSJjWF8iN9+/V2b16R0rEjjwzHlOLaL/uoLzIzALLNgrTTi4s+XtJHVz2lEer7fi+T7thOzjLw4jonjxO61BmG+H+d+0oaGwE4hGBggzOcpFosUh4rkcjk7jW63S6fTYWNjg+3tHRvHIubOXbAA6UgGggF2FXdRKpWoVA4wdnCMcrlMHO/QiBq8qdd5/+497Xab7a1tlIlwfmZOm3wmfxiGlMslqt9UOXVqksF8eFtCQ6ECIcTx5bfLJ589WyBaifj0qUO8EyNmp89rY9n3A4Z3D1GpVJiYmGDs4OgdKeVjYBOQKEoIphcWFo4+f/4XHz402exuIqa/n9XmL8sN5ti7d4Rqtcrp01PkBvNXpeQNEH+ZRIji2+bqP788mp9nZXmFdruDOHtmRpu5h2GeUrlMrXaE76am8Dz3KlAHdr4A8kBta2vr8sMHD1laWqLV+tgD+IFHoVCw8g4fPsTk5KSReUNK+RLoWt1QRKljm58/X3j69E/q9Tpray3EzNlzOgh8CoWQPSMj1v74+Dijo6OLaB4gWbVjhj1SiBOra2snX796RaPxNx9bLcQPs3PaDwIbYXj3MPv37zOXqdVqDA0VF5XWSxLMn1YGTkRRlI+iiGazyfr6Ov8CTw1UAW+/2pQAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAABc1JHQgCuzhzpAAAC/0lEQVQ4T02TzWtcZRTGf+e933PnK5mvpKmTIra0pYWii7pw4UJX4kJwIQiKiCiif4D6F7iQLlxJddGV2OJG3EoFC2ILIYqhGtxYapPYDLmTmcy9M3fue+ROSvGFszzPeZ7feY98efWqBr5PtVqlXq9Tq1WpRBGe7+M4DgKoKvN5wXQ2JU0zZnmO67q0223k2xs3NIoiWq0WJ1ZX6PV6eJ6zg5oEo1MQxeIiGoOsJckwOEgSrCqdTgf58eZNjSsV+v0n6Hbbv6HcsiL3DToB5hw/AxJaa7si5pIgLxyORtQbjUzubm1pFIWs9/v/WrVfGeE2avZRnQH2kYAg4iGyZEUvivKyiDyLmIcy2N9XxwiNev0WVq8Bm3g2IdO8jP9YIBSX3NQw5jzoK4h5CaQQtXY+zTIn8L0fQK9R6Ca+HTKxpX2lspAQUnFwnBoO58B5LZ/PXy2BlgK76WTSi4Lgd4x+QcHPePaA1OZE/3NA6cCpY3gazLs7O3uXk+FwITDe292Na9UqlUr4Neh3qLmPlhugeAxRJECkB7yYTrL37v7xJ0kyRPYf7uu9e3+j1nJybY1up7OF6AYqAwtTc8zBsSI1o5xNJ9Pnt7f/Yndvj/H4CLlz+47uPHhAlmVEYUiz2VxUHFcJ/ADX9TCYxUeaHKUMh4ckySGj0Yg0TZHr31zXwWDANJtixBAEAVEYEYYRUVh5VDGhH+EYD7XKbJYvmo8mY+TKZ1d0NBqT5zmC4LkeQRASRzG1aoOlRovOco92q8dSYxnX8Y8UzDyfRcnwAPn4o0+0nG4Li4jB9/zF1LK5s9xlbXWdp06doVFb2lRlA7U7KiZXtbHBnJIP3v9Qi/kxbMe4BH5IXKmx3GyxttLn3OkLnFxd/0Ut34thG2VghZmxlHCW5e233tEylzEGz/EX2evVJt12jyf7p7n8zHMlxE8t/CQF/+SGsecwlylSOETyxutvqmAWp+t7IZUopllfYqV7gvNnLnLh7KVfgc+1YEMNg5mSVYrjG8nmuP8BY4tRwf7Dt4AAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAABc1JHQgCuzhzpAAABx0lEQVQ4T3WT224TQRBEq+e2/v//QkIokkExMXEINvADiXdmClXPeOMXVhrtU5+q6os9fPrKnAtyysg5+z+ljBgjYkgIIcBMzwASXa93tNZQa4XtPx/ohXfFKSWkqOLogGDBa6GPDG0CBLHHh6MDpDrUR3H0F6VOEFWlAIyEaLH1hirA0/50B0jT/iiOIUpzZUeDQSB9kUBi78EBz4+v3JQ3B7KelLtO9cZRLkyEIZFMHuHl+3kAcvIIsp6iABLCymG/TXUjEABkENkBr8fLBNzn9+xNgOmgC0A5ACKIBKBsgFKKT0GNlLpcALiyY4W5+pgAELyJcjAAZr9+XLgsC267oCnAbEXHOwyr7G/5ZV89IDINpfee7HL644BSFuTks1fmNwJvcgHA7Uu9E8Hg9uVg13tf7PLyl0sRYNtAZVfxOzgAXk/PH6geAAXErvVW7Hz6TVf3TdQeaHxBLq6g90DbexvhaCKQCezW6xX283im1D92YSyR1tinMCKMLZxTYGesrWJdV9jz4WXcwlwi38AJGIck0fHRD0lPhzSP6bB/+g8g+CHBzMNTe6AsJFq7v8Yv3+YtjPwfDsYV3hwogwM6sV1jrfgHQR8XLdOjX2oAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAABc1JHQgCuzhzpAAACD0lEQVQ4T32TzW4TQRCEq+dnd21iGyQrJs4l+ICfDRQSHCJBDijKFRHEC3BAPAAXxJUD4sQF8Tbs/DSqGa9jLlgaWdrd+bqqult+/fyt3js45+Gcg7MOxhpYYyHGQERQfgqoZuSsSDkhpYQYI+T7tx/a+Abe+3IIsdaWY+QOoAByJiAjxYQQI2IMkC+fv2rTNGgaAipogJg9BaqKnDLitnIIATzy8cMnbQuggee/b+BoiVb2AEU6L6dYLoY+oA895N2b98qqRQUVFCV+l4XAlADSTnqtHEJfIPL66lopecjgHxvGACKo8mto9E4A/dOOXJxdqrUEDJBtoM6XIEsDVO+ks3oMSCmW5/Ls6XNly3xRUS0MXSGAbWTyrE7Pff+nwHjZWgM5fXKu1hhUFdX/fwGhZ0NhnUPXtVUBqxDC5B0hZaiqBb5jNUqm9KwJzlmMxmNMpxPI+elGixdQRR2g3USWNtYuZNUyicYIulGH+w9mOFwsIJuzC00pl7D4cbVjYQyPgeEob8eZLFo8mBxgsTjEyaMTyIvNpTKgqkLKpQrg5e0oF4aUHWnbFrPZFMvjY6zXjyGvXl5pirEoGC7vAHuTyJXiclHBZDrBcrnEer2G3FzfKL0N3jmRNYOqYpBPhTx81nYd5vM5VqsV5PbtrbKfbdNiNOrQdR24G9wH5sDKwybSKveBdsbje3h4dIS/0BwF5rvPEXsAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAABc1JHQgCuzhzpAAAC2klEQVQ4TzWTPY8bVRiFnzt3bI/H9mySJd5ElKlAVKnpyA/gH4BIqvwFJCSEQEJEdNCloqCjQnTQ0CC0iqIk2oSsNyK7689dz5fH8z1z0b1mq5nmPe9zznmvmE18ZdsdbFsipcQSFkKAApRqadqGpmmo64q6rqnqkrIsKauSqioRk2fnqtvt0ul06dg20pYIrXAloIeb2gjoobIsyIucoigoygJx+OcL5fQc+o5Dz3HodrpYckfRtjuCq+GiyMnyjCxLSbOMPM8Qv/3yu3L7LoPBkNFohP7vdDqGQlvQ23fYBWmWkiQJ8SYyXy0mHv/4k3JdF2/ksX9jn2vXruM4DtKyaFE0dW3Q8yJju03wA5/1+pJ4E5PnOeLbr75XfaeP5+1xMD5gPD5gOBiYLJRShsD4zjOiOGK1WrK8WBLH/wt8+fk3qtdz8DzPCNy+dZvRyDOt7CxUJiztO4xC5vM5y+WC6Irg6y++MwTav96uBYbDIZYUJkBdlcbX/oPAZzafslgsdgRFjvjh0WM1GAzY8/YY3xwbkb7bp20b8jIjy1OyfEuSbIz/6WzKYqkFIlOl+PXnP5QO7sb1fW6+M8bp9xZC0AiLd4N4TRj7xJuQOInx/bUR0BZ0iEZgfpRqC68QHCnFTAhSYbWeJa0Pqrb4cDo/5dJfEcYBfrA22y8uVmySjblIEUzUo1bxypKshGKLQinYs2zuCsmD12+Obp3N/sUPLwmiwFAEoU+aplRVhQhP1EctrKyGbWNRCYFoa1wpeU9Y6uE/b47uvTx+zvJyThgFJNuNuQfdjK5YhMfqTiFJnIyqdWnFBlF16csud6Tis8np60+fPPub6eKMMPLZZolJX5+3bkksJmrck5RtbYJXdg9ZF7haQCg+eXt+cv/w6V+czU8JozXb9Gp7Ze5EnL9U+26XWr8+/ZKzEtsVeK3kfYG6f/L2+OOnLw6ZLc4INEGaUFa5wW9Vy39iq/2dscTx/AAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAIAAAACAgGAAAAxA++iwAAAAFzUkdCAK7OHOkAAADbSURBVChTJY89SwNBFADn3d5mNzk0GMQIhwj2Fnb+ZcHPlGkEI9iogYCFEg5OtLTSO3K6u0+i1RQzzcji/kmd9zjrMCYHBI1KjIkQInI9vVHnHD3ryHOLkKHpP1hTzk4u1VqLyQwiGSRBFYwYrO0hF6dX2u/7P9k0Lc1ni8GyUQzZGo6Q+cNcy7JkUBS8vb5TLWssnnK8T7m7p7JqV+q8uwU+UuS4eq7Hm24bnw8mSWUhmtILqo+QdSly2H3Fo9iYWQica2IpGsIMkXr9pzE7+GnZ+W64Cx1TVapfIzBnroQuH4IAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAACAAAAAgIBgAAAMQPvosAAAABc1JHQgCuzhzpAAAA8UlEQVQoUzXKMUvDUBSA0e/6+hJp1QxNIpa6BCqI1rGp4M/wLzkUleIgFEEUxNVBBwcXNwVHTQUHcchWtBDMkJT2ioLzOfJw/6TWsVhbwRgDAqozJpMJRVkiN1e3aq3FcexfEIHZfygK5HRwrr/gug6O62LMHNPplLIsKIoSOez11VQMnucRhgHVWpU8zxl/jfnOc6S3t68LizVaay06cQfPW/ocjUb1l+eENE2R/sGRhssB3e2YKIruUN4RNtI03RkOX5HB8Yk2VxvE3Rjfr1+j+oFIA2U3SRLk4uxSG80V2lubBIH/iOobMA+0syxb/wEPTl9qbsqDDQAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAIAAAACAgGAAAAxA++iwAAAAFzUkdCAK7OHOkAAADTSURBVChTLcpPK0RhGMbh3/OYIcOYOZTY6ExIFFufVCk7FsraSvEBlD9TpsmkxOw0pMzqnPd9biXX+jLl9CHpSWiE9Om4Ai26sYY3uqZIl2T1sRiCvgBBoxOm0vHSlNMJRJ+wAdL3XzBbwrQDMweWczp19IzskYjJfygC33f80JTzEGkS0h34u4sqRFuVlyFt2/htrMhB0SlozbZfcuY2VbxGHbXhy3Z9dSPCWOmustXb+4mKowjuTUwFLTs/u9D83AIb6z02y90H1RxHMDBnmkTzF491eKo7RQUOAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAAXNSR0IArs4c6QAAALBJREFUKFM9z9tOwzAQhOHZ2I7tdd7/qZAQAgUErVQO7xAfOyhp1ftP/87K69M7NSpCUPjZwxoLQNB7R6kF8vFyoqoiBsV8ByRuoBTIeb1QNT2AMYYkpbeOXDLk8vnLpAtijHuBICqJaYzhcs6Q79Mfl7Rg32Gta8AB7BjDb9u2F36Y0q2wj4TIAGlqbTjA13q+fxHg3IxpmnC9Eq01HCfenlcGHzB7D2ftA/Q+UGvFPzQGZbxxblmcAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAAXNSR0IArs4c6QAAAMZJREFUKFM9jzFKBEEQRV9VV09rO7guKwPqoQUVDQxkQTTcZDFVMRFvsWDgCYQZZ7qkRzD4FHwer/jy/vbhKSVqzCIqQnFnGieGnwHZbp7+gRgjqkopzjiOf8Dd7dotGLGJxGpQxauhlPnKxfmVe3GCBswM1QACZoG9/YRcX9740A/UNoQwx6LRtgesjlfIw/2j930PDlYBM1JqOFouOT07QV6fX7z+amKcl1SDhkDOma7rkM/dztu2ZbE4nIAv8BE0AxmR718PGEf6tU599wAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAIAAAACAgGAAAAxA++iwAAAAFzUkdCAK7OHOkAAADmSURBVChTJcqxTsJQGIDR779tQ6HF18DE6ODo5svoC7j6Zq6NcSAGEyOQ0lANCCJtb0uLUOg10eFsR6LXuXFbLRzHAYHDoeZnt6Wsyj8yeByajufhui5KCft6T1kW6FyTFxoJHvrG93x838eyFNtdRaZTvtcrsixFBkFoTrpd2p02x6YmzROWX5/MF7P/kE3NAIiUcBSbs1W6OA2jER+zmFQnSBKaW4ElgkI1F7aj7p+eAzV9D8k3GlmH5kqEQjU4jaJn2dy9vPUvJ/GITZUjycScN4raOtBWNj0RczOOh9dRPKaoNL9asXv2BwYdwgAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAEAAAABAgGAAAAqfGefgAAAAFzUkdCAK7OHOkAAABPSURBVBhXAUQAu/8B0MvU/wUFBQAFAgYACQcMAAHLyM3/BAIGAA4JEQAWExv9Ae/s7/8NChD8+fQA1P33ANQB//z+vP77AeX79gDr+vYA60MkHz9bkZBIAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAAXNSR0IArs4c6QAAAE9JREFUGFcBRAC7/wHIw8z/BgYFAAECAQD5+fkAAbu2vv8KDAkABwcGAPf3+AABx8PK/xkbFgAUFBQA8PDwAAHt6PD/EhQO5gAA/tkAAQERhQMaEwQwPTwAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAABAAAAAQIBgAAAKnxnn4AAAABc1JHQgCuzhzpAAAASUlEQVQYVwXBoRGAQAwEwEtweBRV0wAtfAlfAzPMIJAoNO5zybFrSe6QHgB088UUscH9QmqUptUU1Yp2JPEWMRs/3THQFThTiB8LdCic8D9v3gAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAEAAAABAgGAAAAqfGefgAAAAFzUkdCAK7OHOkAAABJSURBVBhXBcFRCoAgEAXAt6wbFWV6/zv5IwYh1CXWr8xthkq6bN88RCaMb4BqeSweEewEqgqq523BBzA7tNZAORVb5hXMjLd3/J4gGoiF/LhiAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAAXNSR0IArs4c6QAAAEhJREFUGFcFwbkNgDAQRcG3YvE6Mf1XgoRISBAdcDRAC1ji+MzYPC3yxnFvwcCGflS9KhFBKQU71l36RIpE5IzpvTfECfYA3Q8YDxcfbYRVSAAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAEAAAABAgGAAAAqfGefgAAAAFzUkdCAK7OHOkAAABPSURBVBhXAUQAu/8B6d7y//8A/QDz9PEA8PLvAAHz5P/iAQIADOns5hHk6eEAAfHf/ZAAAgIHAQQAXdvg1QsB8eP/bAH//ggBBQI9/wH5Ti4hItmGpWftAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAAXNSR0IArs4c6QAAABtJREFUGFdjvHjmyn8VOe3XjH++/t/x+xvDYwBjRQtHH6KlsgAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAACAAAAAggGAAAAcrYNJAAAAAFzUkdCAK7OHOkAAAAbSURBVBhXY7x45vL//wz/GRj/fP//iZn13w8AaWkLUokwHaMAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAAgAAAAIIBgAAAHK2DSQAAAABc1JHQgCuzhzpAAAAG0lEQVQYV2P8/+fPun+/GJ8w/v78v//fH4YPAHnTDOvI5WBVAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAAXNSR0IArs4c6QAAABtJREFUGFdjvHn53n82FjYGxmsXbv5nYWFlAABOEQcnSF6KnwAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAACAAAAAggGAAAAcrYNJAAAAAFzUkdCAK7OHOkAAAAbSURBVBhXYzx64Ph/NnZ2Bsb/v/9eY2BkYAUATMUHNZsudrQAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAAgAAAAIIBgAAAHK2DSQAAAABc1JHQgCuzhzpAAAAG0lEQVQYV2P88uz/g9cfnsszfnn+dzkzK5MEAHOdCj6wMvHQAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P7m/1EACWgDqKg+vB0AAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAAQAAAAEIBgAAAB8VxIkAAAABc1JHQgCuzhzpAAAADUlEQVQYV2O4c/PufwAIuQOSmzFxBgAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAABAAAAAQgGAAAAHxXEiQAAAAFzUkdCAK7OHOkAAAANSURBVBhXY/j95W8HAAlPA3XvQ+ThAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdjuHXl/n8ACKYDja9TRVYAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAAQAAAAEIBgAAAB8VxIkAAAABc1JHQgCuzhzpAAAADUlEQVQYV2P48eX7fwAJrgPjRM1GkAAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAABAAAAAQgGAAAAHxXEiQAAAAFzUkdCAK7OHOkAAAANSURBVBhXY/j85P91AAlSA66YTxG1AAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAABYtJREFUWEdlV01vG1cMJLnS//8tPfTSU0891LVTfzQumqIBGhRBgaBFUCCxtLtkMUPy7UqWI2u9kj3D4Qz5oo93z6EqovgmKrwW3sB33qt/eX31GJ9VFVMTVZPJTMwmPie+mpj2K97Lz/HzD3dvg9AEbLAdARJr6EsC/Tt8xR8soGnagyfwVAQGsJlIyKoPt78EAfhHCqzVyDd2dReBUmkQIDAq34Cn6VAKlBokOFXlGhGyiMiq9z89DQINdk3kQoE9eMteFaLyyQ5i9TrkB7FSSERXKfCAAj/fPEYqfyl7C5+ilAqtxq7flLd6japBoIlcEwiRGVWTQMgqKq5vbh7ogdem27ejSFSboFBWlCbjE+DTQQ4ksSnBz6k5wavyIrGGgMCPD1Rg1Lm/LsdvCSmnU3IbUhO0wS9UmKAdgOYImRXVpwJ4BalV39zcxz5ee8/viQ2nVy8vqz6y8iaSrSD4EiFnERoO14sWsIQ4SGwteJXwvpHp2EetJSboAeBHORxKBXrgQHAROaNySQXoeoCWAsEW3N8+IhJXj74xrDiGR4NT8sNBjgRPBdoHJraEyEkKHL0PqBDCvieJcBUNfbjLGOLBiws2OZy6+s55gx27+lKCEdQBDunbeCCwMnapAEikAk/3byORQSCKxbX826DJ3qfkXX0a8AhwgLxAegk5t/MLuOWH+UACqKHPj79m4VX9Jn7vhqvIFRj73h6wAyYcJH6JkFNVjt4v4bKIwvmxRqgrKtdwCUW1ob89v9sKH/LnUhJB5XqxWAbwdEwl0nBnR+U7cEfsGLdYRJSyU/KUHr7jl/7x7n3g1iZDD6VaMCN2W9ZBoqYefvErq87nPDKfWYfpkPvRdxcJI2JC6p/vP+SP43EVO26xnHZdfcbMELEXcTkNx4NAxMx57wWerqfhqu9lthp+Hz983KHXeYB7Hb2vVYpsV75NJ1T24i4vGnKKiJOEwu3MenhUz9VdxC3CQzQFBxPQ2Jf76e9P48Y+cj3rt3l/QN++ttHCabZzeJwDQweDxpH3NFtHDXmvSXsZd+iCFnz+5/N2HmDm+2Axlk24J7CHnLLqihmq9sp6DhlI72H87hRddAt3TSE0JLUO0S//fYmLUbvtbVQEMBoM4GW0HK/d71Bkf/GIVUIpuQhyljmnA/bzDVnI1YseqS6nOfgTzmmiXtUhw2fIDALhXCg5XEJmRMwIWuMV1ddyyXCl7IGmFQFgpeY4BXDNZcdjdvxxGAt5xcZCdQACIKrmNaXGUvFA1PDZzekQG1vO3UMMQoeEEY/4sKNYHj1z+fMJd4LAv0lAMa8p7SCQKpzFM98g6R6zFbhXzx09X4BS4GKXycZbBDbKznnEQ5YZCPzF9Wgyi5MEpXaPs4hCakrOfHOl6hrui4jBZjnf2WtPGOFp93X1Xbkjk+y2ioPA4r/XUWkJ5BmVZs9nCZJg1YhaAW8nGvdcr47KAZvSj7y19E64lH7rvwWMEbM/df/p7AZPIik7eg6RU/LVTFZffKX0BKf8OevqMXrvlqf3Ak93YiWYhTgJ3KLKnuOlwCwesxiqh+y+SFhWHrJ6+CphGHTZ9wTO6A3X1x0azqpyV4wATBjnXkoP/FDntTRgkekzHI9SgZ5n9ei9u8MzBU6di8Te+ZUBN2XVQ4UEhinJLGb/nglwnlo7CTxAsjVcKk2AVa8BA6J67DVGr8zHy50HoMmFAtjLcIOBvoajBWf/jiY0kAjkPIHNUHESsK6eWed6Tcdt8udhNxWANjsz8BS2DSDIv/lA4+TfErxPLwA1X8St9jn7z5PsmHaO8jv3PXKTAJZAH2XYHJoP1s9BBAOCAH2QKYhvcsCU5JSb1Y//ROBMl+DOZUMDkwOSdElgv2o5GQhcrUAi0ALMBEsC/wMt6mbTUGIgcQAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAgAAAAIAgGAAAAc3p69AAAAAFzUkdCAK7OHOkAAARVSURBVFhHjVddbxQxDIxz////8MQTD/0Q116vhYoKVQgQIFHRFgnUqpcgjz2Os+1JVFol3d2LxzNjJyub44suUkopUkT00qkUu7UY7bX9f72Xjqe9dExs7LiPic11ime9yOnROQBocAu4D4SDZPgMJAK/EHxPYA2uSOTkaNsZdIAgIPDiWTuwvfkza8sO2QKPZ42pzQcTCuDwrJPqAICYzohnimfpj/860/4kBX0heA4cEqwPz3rWO4MwX9AfHoOEJDCmu2ebPeDaww/BxPABJFgfKAP6hgXLmTPryH4KrsgidJgP7E8mzIakBMmE64PNWIVmRAFYVXgxmP2X2ScMdD8BvARk3PO3yYApZzenrIORbMbw5BABWVsFmBL/ORaXILuW5jIvjMD0yVSF7kvWfDYpQWRAoz+McpWTw21vvXnZDDWsCEYjGlKYKY2uZV9iI4qimCbDrIMtALD6bNGdpsXZHR1BFCPBzXhGqWQ6klknljSH06OLrsGVBYBg2+RSuQw96GROGjWb1H+TsAVjEy4FsDl+ZwBaAuGdLJhmm3ZPxH6R94pn+8dsXAMzpAsvbd9edgu+A4jBQguwYUgvTZboGEfZsnUve8jSxGRHLtYfYMLWdpAhS+HtInqCLlord00ba63T87GbLrto3ku8vygrl5uPYGDXdsgeTExe6CBOPDADjlEXTiD0PXbVqZmNvSTvK3J1/qkj+wUDKE2rCysKKZZtlVKlYm5s+Oj3l/LMvSSDcF9ev//aqf/I3r2wAEDKNbABsIugbMyMsLMOOeZ+Uop8vvphHui70lMltJKaEzYrZUCKeOarCYCDoUmzL1J7jxNWqkX5dn2DMtT6DyDYzbQxUQaTAFfKPoOYmFhUi2X98llOfn65T52QVaDKW2csAKEr6LmFzncJVkMGyKFmDBl8N42Omfp27vh33//y2FAK27EGx91kRDKgC4IFKau6Mh8okDDjoiwNfgo52gvy+nPzxCNEuJ7b82Chx8Yj1ZuOSzF5QWCWnV+kb+z1Q3tUNpR5uO2PPJEXKdUeaMDMgCVhTYYl6Ya0oE9+MbhSZ/Q9z55mCAC/HEB8GiDWqlQFpM1OrwCJgxw2Cw2mQXRUAIvg3kief0hYgvwCebjrX7n96rvstIkVlH8C4HTYUbMI3LozQNLsfw0OZqyNhgtG4CRBu+JmU/myCWHnEY4mfQV6fe7fPolq1m0rpTn9+mKLk7vVAaKI+gtWfrjtW9HFkDoCG2rNWYdxWAaAruUYByGujSBKSQO/tVL7pfuH/k1fVRPe9WMR/S020q7Z0WwuDYxvIigL+IwwHR2kGoLHwzAeukvcN9XJq3cWAHi8728UvHcq16zbgpBCsBHi91riuib/Vw/GKSNqLDt/PwMsw8f7/trN4l/JhaNJ7X7wbP3bhSxoeFCJnkIIi8wBgrIFE9EHfrdX2nPBZo3gkMLiqzpuR98ODMwzEP59NdXdXgYI5B8W0ukvit6GagAAAABJRU5ErkJggolQTkcNChoKAAAADUlIRFIAAAAgAAAAIAgGAAAAc3p69AAAAAFzUkdCAK7OHOkAAAUpSURBVFhHdVcJkhtHDCPp//9lfaRyOv5TErvinR4yBYB9SN5slVbSjCSCIAiyPcf44mZpZllm93yN930t3azKCu/LzQ3P+Hf+4WZY3ywz9+AH8Ul82PueXu5rXmN8MbP7/wBMIPhOWmZ44NsEkGYVz0hwHWgIyAVCf/O1ngXQAeDPZwBldbs5GdDvZYYFgj48TgCZE8yOebKyAYSnpYVtAJ8tDNfuWYJnAJ1UIvdnMAKBoAXif+ADbKg0CEhIzBz1FgM5PiM4WVhADgbcMitZomYBv9lg+ItkBSAmI7sEonECSNxo6gVGJfjjEJ+A6O4C1Azc0SXZpQEQP8siBoDwOfBiYLJBugQAwQiiGWgQdxIMs7/DgqBwTUCkEcZC/Sf7qz/WFWfmTX1rgcGtDgAz6PNzmo0QKwg+BKYFWiiPynB2g7KX2FZgQVXg+fCIxcAMXGbDO1gHRtAhIK4SVZcJwZFH0iR27gzerUf7OGhP2ArfA/NDCRgYwQACj2DGTgALRNmdAKDMDxGKA4ZblD+IDioFMI8OnplLhCt4B7rCfGTWFbEBWNlA9gAAHbTWugvCEgWRBXXLNd0ILAtlcIAwMrFLMMxilOXlFsOyrjS7Ipj5RQbKRjaAo1PQ5SyBnHwGF/0QX0RA2up9BAYUMpBuKQC/I7hZXnquy5JBrwy7UIbU+xGsfaxWFQPku9jtXXjVGJZ1ik41Z+bvAGoxkL9V2eXOLC+rYnALE5BoAAVNxJ2Wo40LfnowcJignGi6nxPIYqIZaCa8rvy1aVbgCQAMoAwWI8EO6Ef2mWzFc0gtBhAWzfoukCnNYtWdbBz0QwsOEV75CwKX2au/GXxrwFI+8CYASPNJgEnbRa0nAxMAgUWWAPxsZq/K3sUCHikGpA2J8Kj/IwNoSkt2/DYg1LsBsAMkPOkC9YC1pnt+z58c9TYHzVdWvlILDD7FeQDA4ArYc6TdnHXdAYcPSGxzB3DzFiABdAc0IAD45OFXZr6aRetgZg4AEGFeURLgnAnUQNvwnoIow+kBzQAB2VI/mnPqwfN7fZwa2PRDdDt72nADQOZt0RjT3QUMfLbB7oIlPniAmIADqitYgvpAAIuB9oPSswZQDqvuf+4OKSsOmFCvHMuI2oyOEqxu8EcXBAue/9Z7Alh1R0eIgaLqc1jEbfdqvy3AYv2188xh1PN5rlx78rUTHjZ8AKhX+L47gy7l11I+ggenYGbeNFf6HryRfgscXYYewmsctxvWj66oLvhWL7vdQm7Y048AaDyB7Qgs3PAPgWj6xQKD5ywD+1FmRAbWGjZngrwBc8LHt3pR3+dlgUE0Xc9IfTX12o7mGMZAe9yUsw4haib3/ve0DfVI7nnhPr4CQMGEaLmwXpmOMseqVpXDLZCP6g8BaremBgLZ4yqk8DCSeynhYNI2/LgRmfv1NV8cs39SnzbC2fub+rK7ss1He+PyAESUDzD644kp52b0tBWxLL2UXn/Xe0w+KX46nvbArKl8LaRF4yEQBNIY1ikJjnDuBO0Ji/65K2lCdnCuZATQK9gGgJEbt3nXHdmjhTMbRJQqomWE++DSwFum1BsyAj9tyH79Ux961RqFnaAn3swe1jtXsD64JJiAA+k4NLugl5LuiL0gzk3xPBmJGRxYAeBjBx3qe5wR5HzVZwIOnuJpCAXvRQRXSHwfTKjI1sAbLBytiW2c65qb+/e/6pO2X+x8bblYvQLCQ9s1/TqAtPjmFDwPq9l6aFOiOfZ86LZU3vtwip/7DzD202ASUpssAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA51JREFUWEd9VwF26jAMS7r7X+xvgxUGHeMuzX+2ZUdOw3hjhdLGsiTbaV3fb63gVUu1T1X+5HMtVT5XOS56XOpSlsXfb/j+1s/JdfI73SNr2Rq+pp6xOJePewCw2A4Cn+RGWoBBCKgjGAluYB20B58CuX4KAARF+vptwoKcTJkhUwERYACqB18OCTgQobdeT1uz8B1E0DPIYJKMb6fbMtbsRwnk3Hivf/8+/agElrVDwTE0cx+4dgDhOiaZuldey+AS1VJvZwFAHHhQxaMOJPQdiLORDAzZktmUFWdtwsTt/GiWOGXPC01M2B3dhWMnh5EPknUAAqqINPevhzKQJEBQy16yJsrYAyRbaaU0+xdHsxYxmABhzfv6m0yo2f2h7WhCl0COrUn0Jn/6WQFRZfnaKaFt/TUGIIMz0S9m1x+ZGAFoYHoHI8RyWntbn+GBCO6A0Ey6icbmkst3DN72XTkwZoIMdFgktl2eIUGw4DoPmi0LuRn+8NJV6hFMgex72Uc2iK6olJ/L0/oA1fyx4QzNRoCoT7iDQvcUdC9tbwZEtYArRHSXXAGMbReLW98n2qPD8WCxtIRl9b9mj6AKZk+esMvInAbAK5em36xkBgDG2gRAa2XfsxnDH8yEMD9lgMcmRrA6d7FxnEcrAQDVEuwAAOxYmfYSHQCwF/LQ4cAybGy4cBV4xhMvTIJ7ZQQA7obW/frA0caBCsgMOGBvPKbvoRwVAH5zn8AHdbtIJ8TuxOfBIAF3vwQgzIta5zKE2bL21qb9nPInAIzIIwgvtQygV4VXDzvb9OVsc+beslWC0krd1odWQYCIAQIZqCQPm5G0k0KzA7WWaQ8eswLn3Yj1LgCIAQaS5zqZklo1zwJrCKgKnozejuOIgSUM3L9+goHMwmRnzGyEZHkeoB11XC7JCxD1JgDwSntDMhi36eQLyHVgIZ2AFN6w0p6hlfp93vqekJ4LEhs8rh3YMIx6S8jzwTVBp7Z2HSYtAsCfC8YbDXLeXuGMD5JhD5GYnCw3A1Gvp/xgMqezw0iblxEId0ar6lcejclYL5/90SyuTs9KtEYMLd/rzcY48fAnCNuk1PXj+xguarkvNmbjk7Bv3XtbjinJgAcuLGgr9evj2veOOBnjeiRQ7hr3jun5gZ8l+EEnlRn1ilLq+f1CAICLOXkph7dv7CGwf4i9BVVJGppDUvX8b/XNDHY0dAU1EZATzuLZETKkBxoCaMUzff0HoSooXRgUZWAAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAIAAAACAIBgAAAHN6evQAAAABc1JHQgCuzhzpAAAELElEQVRYR41XaWsUQRCtav//j/KDxmg28SCgoIKIIh4ooohmp1te3d2zHpBJz7E779Wrqle9fHn+cAwiIvunF3ojzuOePyMixh8Ts5zIKode4M/Ocy3fjlM+3Luq+AU4CYxklV9UBgEaBATZCOAcXG09SeACBAzApahrgI+hIknwBl5JuALL+m8CZ5eGZwAAkiPTMCmA+xrYHH2zFPwPAfu+vOPB2cHeb6CFgFAyMifTsIA1XLdm9WBaeY04a71tSoLA3YOIKxEHeKqgasjDLEp/RyXQmBo7eFXDiRiyZi9Y8P27Fyp2jVzOO43uRBRcFYlCiC5AkTVJQSMWIklAClK6RXKm4F6cmYIKZOd9UN+R8DqZ21BBHfwPJAq44isZvriHGrAIR6fuURcCMxEtTqtCyTcibsh9axp9WWt7pjeYIiBxOL8yAip7BxmA9y5pwaqkMiVpBip1gIYSLVKiz0pKLB3uDXz14GEhANlBIEEBLmRckWJK7oQKoKBQItIRHbFv0XDSx5dPFgIGZlGLAkaqFmr4QCk4AQ8y2hFRnJM7lqK8fnRtHZjFJ9IXyddirJaaOa7gFrHXgtvziW7gp9fPpALVBqznd34wt+NpAkXmxRNc7rp6H/DzZy+iucVwSr9PBqVmIdjFjaO3dSrOBhSTsfR+JS+3X718lcO2DJz44IlJGEZaXW0av+l63u+leTUE7+S3r9+MMOe0abtVTNPMI0w0Bko11t0LShyGuCjMH969FwLhTmXSeaX789VGK/GMcNm9GOB+uqr58ZdPn0fkz0fsZJu+0zEv/8vmwqV1Cj5BY7zr2JvmDn//+k0I7I+yzbLnRNStBvVNNltEeK1MrGLxUcA2RdNDFgK/fvxMAjbJDGizFaD1XGfz3AwCakdbznEdxxjE2e5getzwMgA4SF0XEqNLcDmU/dTA2cGb6ePAtyqJfMYNBL4v4BvR2Ii4RI5rwnTqRG0Q9aFBgUknGK4mYKAZGxFWfEAInTiM6CAGgY8zAQcf2xhjY8l7A5lOTZC7NYoUtlmBKtB7KuDAmFIzEf2s1QoIvMkUjI0GIu/Ii4I3Ad8QvYEvKYjc60jUWtColVAjVwjntg+xbZEo8FIkH4gcYH2j1lzyWgOqQhagm0wUINqaq+TMyJffY8lWFqv+qhg329OIuETraXEllujL7yffG0nUEv1CxBXRXkcI9pNGOnnc3Dx2mT3nIb9Wm6jAGrkrEKOp1sAKXKMX1/PosYNBPWMv1bftwFLduzaMex49VqQAIcFhYxbZiye5J6nNnIyEFm+TfuZxPJ4vxhN5/0P0MrSNxNwFO1CASJuyK+Cd4ysI3Fmdr6YAz7BLRJPXAvSfKb65yn1yiVYqHnKHbWrUOcWY+/F4W3tdjz245h8kVH5xgakI8cI1MolYcp3g1jY+yGX9DWJsXoAJtq1HAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAABW5JREFUWEd1VzGLJWUQ7O5v3rs/L4ggCAaCgYGBgYGBgWAgCIKBYCBcYrC7t08xuX27iU63VHX3zDe7e3M3fPPmbl/XV1Vd/a0+XjxCRCRC+Aefpmd8xu3hEuHi7nzm6qusteI53+W/h/v2ffxOlJBccwkJFdHHS/yrKhYhKhK6gTmAQPEEsRfJguuKFUBW8bUAFYAEjW/MTTSMRJEXADyJiAkAqBje8TPAPAPhji9KECx4KLwSTL4HC6uEN3MFAhD4t5hAsesl3oMJFm4QIVZgAMhQNKWY6Z9AoDCL//dBEDsLe3G808f7+Id7pwQCCQyS1GcAGcmIjCOAonsu/CqI9E5vYJchedDru7gv2gmAflBRDTGCQXGASFaWiLD0Qkmw7R4s7AyAjTZqe4clS9b0fYhe7+Omdz8Dwa7JRO6eDPBWWURiaQNCc9KP4nzutf2wbl1BU3an1QoG/mxDbgB2Q7YpNxmUAOSEmwW7aBlwZwEMTKYEYy0Fizu7Qx9u/S2JB/1txn09mLFYAIAEoXL2eceH3e9MoCO6M7AmC+kLvd7FHzQDDcgnlaALoH+15DMZsjhYOIvEqdvvhQxzq9Yz/cCcQDUXfbiL37NuMlChlW2Z2qNDTE0GTAlDamwynEXlTUQscwsCSNN/yIsXIADgNn6bgymTQlWUQTkFEzsCIOAHyqAKBiRBuI/0xNwJU1jh/RzbFWgA8GuGM6hPJo5dESqh7YWpE3YfqMgbAPFYrbtiZ+BDbGRa6vub+CVDWVQ8vQBArtj+xEDOC7LQDIjJSSK9oCpvwMQ8GzIL9nbsrpm7Awz8XBENwTUxZIcghDxEzdKEACDBLGAe6MGMBAFTnl8WqnZ9Zkr8PwD4aZ4Nr5mQQDoVdwYAArtvIOcQORv8wKB6befZmvMY14eb+BENoYr0DRGHASnHbETsHBE9SoIhEimF6olM5H2GLJAjIsYGIo5gZnBg4IeZAQ6kGkzdgjUHciBlG1bx7IYQWQxs4A45qbEzTs0ECzKM5q4oEz7cxvcwHzuhEhG6byGEUDLNYZSFR2gMDUXxmg2yhMpiaUq0J8GUJ07rPLwYyX16yi74bj8nJf0K+mFITkCGQgLogVR5oDmqF4YTmEhjLgog+R7GZGRHuG0MTIAgwbcNgLXThRlC3Ql5PugWHBJholpsyLCdCQJSY3EwQG80CM6OTkOcqpADD3fxTUpQWdBPNGG1YkawqaMtw8x04FygAKE4qMgw63ENc2rLkEBqcB1kqVTU62183VGM4WCKOgWHUlQSmhgOKWhHgpEwSEOHCCUwpxQxVHQRsJBxfWJggYmMbRoUzzCpXu/Wr3LmHK4MIzQiQbiamrnnlORhpYDwGbsndhkJIj3BwwtOUSKnrUsyNTFD6A29vlu/fAWACA8MqFMHVq4MaBN3VbM8KR1OTfCGDDG0qiaAyO7wkmLzQ3rjjEPpFxEeubHp4vE5QcwHFT6rgwBzABJYos4LadZBJiSGKVuVMiAr2pRlzJTi8X79PBlwjvtXLuz8JRsF4nBowczQMHMdbjFUlW1ZLcnIBhPWyUkAl/hM8BsHGX0OwgXeY3kOKtozZYEULQtYaDmaBWWrQgJIkiAiFjHd2pNMPF3iU0pA9nJ9cUHZRFGecHixDyvpDexg84NnaNGQxqDi9MQdsoAFJibmxtNf8QlSOScuGMD1HERLUAxA9UpLTi8QUJLkD7uZ2nCAoCGREdWedaxX05MDxNPf8bHgoFr0Y18OSaYLNjvKgAh41h0lQygBDYQWigsi2JCWdpgdNcYXfbqsH2EDzQLWZiF5SOXpdUcM1Vpe4AGGjqi2dIcQsARor/h2HK4SALpDFDKwTf8HJrT5DNu0ZrwAAAAASUVORK5CYII=";export{A as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/defaultLocale-CzDG__Ur.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/defaultLocale-CzDG__Ur.js new file mode 100644 index 0000000000000000000000000000000000000000..8bd198bc67d1cb1eb531a0f84fadefbf58de6364 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/defaultLocale-CzDG__Ur.js @@ -0,0 +1 @@ +function J(n){return Math.abs(n=Math.round(n))>=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function j(n,t){if(!isFinite(n)||n===0)return null;var e=(n=t?n.toExponential(t-1):n.toExponential()).indexOf("e"),i=n.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+n.slice(e+1)]}function K(n){return n=j(Math.abs(n)),n?n[1]:NaN}function Q(n,t){return function(e,i){for(var o=e.length,a=[],c=0,h=n[0],M=0;o>0&&h>0&&(M+h+1>i&&(h=Math.max(1,i-M)),a.push(e.substring(o-=h,o+h)),!((M+=h+1)>i));)h=n[c=(c+1)%n.length];return a.reverse().join(t)}}function V(n){return function(t){return t.replace(/[0-9]/g,function(e){return n[+e]})}}var W=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $(n){if(!(t=W.exec(n)))throw new Error("invalid format: "+n);var t;return new L({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}$.prototype=L.prototype;function L(n){this.fill=n.fill===void 0?" ":n.fill+"",this.align=n.align===void 0?">":n.align+"",this.sign=n.sign===void 0?"-":n.sign+"",this.symbol=n.symbol===void 0?"":n.symbol+"",this.zero=!!n.zero,this.width=n.width===void 0?void 0:+n.width,this.comma=!!n.comma,this.precision=n.precision===void 0?void 0:+n.precision,this.trim=!!n.trim,this.type=n.type===void 0?"":n.type+""}L.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function _(n){n:for(var t=n.length,e=1,i=-1,o;e0&&(i=0);break}return i>0?n.slice(0,i)+n.slice(o+1):n}var N;function v(n,t){var e=j(n,t);if(!e)return N=void 0,n.toPrecision(t);var i=e[0],o=e[1],a=o-(N=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,c=i.length;return a===c?i:a>c?i+new Array(a-c+1).join("0"):a>0?i.slice(0,a)+"."+i.slice(a):"0."+new Array(1-a).join("0")+j(n,Math.max(0,t+a-1))[0]}function X(n,t){var e=j(n,t);if(!e)return n+"";var i=e[0],o=e[1];return o<0?"0."+new Array(-o).join("0")+i:i.length>o+1?i.slice(0,o+1)+"."+i.slice(o+1):i+new Array(o-i.length+2).join("0")}const O={"%":(n,t)=>(n*100).toFixed(t),b:n=>Math.round(n).toString(2),c:n=>n+"",d:J,e:(n,t)=>n.toExponential(t),f:(n,t)=>n.toFixed(t),g:(n,t)=>n.toPrecision(t),o:n=>Math.round(n).toString(8),p:(n,t)=>X(n*100,t),r:X,s:v,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function R(n){return n}var U=Array.prototype.map,Y=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nn(n){var t=n.grouping===void 0||n.thousands===void 0?R:Q(U.call(n.grouping,Number),n.thousands+""),e=n.currency===void 0?"":n.currency[0]+"",i=n.currency===void 0?"":n.currency[1]+"",o=n.decimal===void 0?".":n.decimal+"",a=n.numerals===void 0?R:V(U.call(n.numerals,String)),c=n.percent===void 0?"%":n.percent+"",h=n.minus===void 0?"−":n.minus+"",M=n.nan===void 0?"NaN":n.nan+"";function T(f,g){f=$(f);var b=f.fill,p=f.align,m=f.sign,w=f.symbol,S=f.zero,E=f.width,F=f.comma,y=f.precision,C=f.trim,d=f.type;d==="n"?(F=!0,d="g"):O[d]||(y===void 0&&(y=12),C=!0,d="g"),(S||b==="0"&&p==="=")&&(S=!0,b="0",p="=");var q=(g&&g.prefix!==void 0?g.prefix:"")+(w==="$"?e:w==="#"&&/[boxX]/.test(d)?"0"+d.toLowerCase():""),B=(w==="$"?i:/[%p]/.test(d)?c:"")+(g&&g.suffix!==void 0?g.suffix:""),D=O[d],H=/[defgprs%]/.test(d);y=y===void 0?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y));function G(r){var l=q,u=B,x,I,k;if(d==="c")u=D(r)+u,r="";else{r=+r;var P=r<0||1/r<0;if(r=isNaN(r)?M:D(Math.abs(r),y),C&&(r=_(r)),P&&+r==0&&m!=="+"&&(P=!1),l=(P?m==="("?m:h:m==="-"||m==="("?"":m)+l,u=(d==="s"&&!isNaN(r)&&N!==void 0?Y[8+N/3]:"")+u+(P&&m==="("?")":""),H){for(x=-1,I=r.length;++xk||k>57){u=(k===46?o+r.slice(x+1):r.slice(x))+u,r=r.slice(0,x);break}}}F&&!S&&(r=t(r,1/0));var z=l.length+r.length+u.length,s=z>1)+l+r+u+s.slice(z);break;default:r=s+l+r+u;break}return a(r)}return G.toString=function(){return f+""},G}function Z(f,g){var b=Math.max(-8,Math.min(8,Math.floor(K(g)/3)))*3,p=Math.pow(10,-b),m=T((f=$(f),f.type="f",f),{suffix:Y[8+b/3]});return function(w){return m(p*w)}}return{format:T,formatPrefix:Z}}var A,tn,rn;en({thousands:",",grouping:[3],currency:["$",""]});function en(n){return A=nn(n),tn=A.format,rn=A.formatPrefix,A}export{$ as a,rn as b,nn as c,K as e,tn as f}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/defaultUboDeclaration-D-7rPLB4.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/defaultUboDeclaration-D-7rPLB4.js new file mode 100644 index 0000000000000000000000000000000000000000..39ccadb0314e019e901f5bc8e2eb1ecd8ec9801e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/defaultUboDeclaration-D-7rPLB4.js @@ -0,0 +1,7 @@ +import{S as e}from"./index-CDrXokXW.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./meshUboDeclaration-C6raEdzf.js";const o="defaultUboDeclaration",i=`layout(std140,column_major) uniform;uniform Material +{vec4 diffuseLeftColor;vec4 diffuseRightColor;vec4 opacityParts;vec4 reflectionLeftColor;vec4 reflectionRightColor;vec4 refractionLeftColor;vec4 refractionRightColor;vec4 emissiveLeftColor;vec4 emissiveRightColor;vec2 vDiffuseInfos;vec2 vAmbientInfos;vec2 vOpacityInfos;vec2 vEmissiveInfos;vec2 vLightmapInfos;vec2 vSpecularInfos;vec3 vBumpInfos;mat4 diffuseMatrix;mat4 ambientMatrix;mat4 opacityMatrix;mat4 emissiveMatrix;mat4 lightmapMatrix;mat4 specularMatrix;mat4 bumpMatrix;vec2 vTangentSpaceParams;float pointSize;float alphaCutOff;mat4 refractionMatrix;vec4 vRefractionInfos;vec3 vRefractionPosition;vec3 vRefractionSize;vec4 vSpecularColor;vec3 vEmissiveColor;vec4 vDiffuseColor;vec3 vAmbientColor;vec4 cameraInfo;vec2 vReflectionInfos;mat4 reflectionMatrix;vec3 vReflectionPosition;vec3 vReflectionSize; +#define ADDITIONAL_UBO_DECLARATION +}; +#include +#include +`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=i); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/defaultUboDeclaration-DefpgvMN.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/defaultUboDeclaration-DefpgvMN.js new file mode 100644 index 0000000000000000000000000000000000000000..eec24cdaa995e40bc4b4dedfdd6d32b17bbcdfbc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/defaultUboDeclaration-DefpgvMN.js @@ -0,0 +1,5 @@ +import{S as f}from"./index-CDrXokXW.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./meshUboDeclaration-Bk1ASTX2.js";const o="defaultUboDeclaration",i=`uniform diffuseLeftColor: vec4f;uniform diffuseRightColor: vec4f;uniform opacityParts: vec4f;uniform reflectionLeftColor: vec4f;uniform reflectionRightColor: vec4f;uniform refractionLeftColor: vec4f;uniform refractionRightColor: vec4f;uniform emissiveLeftColor: vec4f;uniform emissiveRightColor: vec4f;uniform vDiffuseInfos: vec2f;uniform vAmbientInfos: vec2f;uniform vOpacityInfos: vec2f;uniform vEmissiveInfos: vec2f;uniform vLightmapInfos: vec2f;uniform vSpecularInfos: vec2f;uniform vBumpInfos: vec3f;uniform diffuseMatrix: mat4x4f;uniform ambientMatrix: mat4x4f;uniform opacityMatrix: mat4x4f;uniform emissiveMatrix: mat4x4f;uniform lightmapMatrix: mat4x4f;uniform specularMatrix: mat4x4f;uniform bumpMatrix: mat4x4f;uniform vTangentSpaceParams: vec2f;uniform pointSize: f32;uniform alphaCutOff: f32;uniform refractionMatrix: mat4x4f;uniform vRefractionInfos: vec4f;uniform vRefractionPosition: vec3f;uniform vRefractionSize: vec3f;uniform vSpecularColor: vec4f;uniform vEmissiveColor: vec3f;uniform vDiffuseColor: vec4f;uniform vAmbientColor: vec3f;uniform cameraInfo: vec4f;uniform vReflectionInfos: vec2f;uniform reflectionMatrix: mat4x4f;uniform vReflectionPosition: vec3f;uniform vReflectionSize: vec3f; +#define ADDITIONAL_UBO_DECLARATION +#include +#include +`;f.IncludesShadersStoreWGSL[o]||(f.IncludesShadersStoreWGSL[o]=i); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/depth.fragment-B8acPKuR.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/depth.fragment-B8acPKuR.js new file mode 100644 index 0000000000000000000000000000000000000000..8e9fcade13df0194f69552b4828409076dba56fd --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/depth.fragment-B8acPKuR.js @@ -0,0 +1,40 @@ +import{S as i}from"./index-CDrXokXW.js";import"./clipPlaneFragment-C7XUrTAZ.js";import"./packingFunctions-BOaWr_dk.js";import"./index-DWyDLubb.js";const e="depthPixelShader",t=`#ifdef ALPHATEST +varying vUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d; +#endif +#include +varying vDepthMetric: f32; +#ifdef PACKED +#include +#endif +#ifdef STORE_CAMERASPACE_Z +varying vViewPos: vec4f; +#endif +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs { +#include +#ifdef ALPHATEST +if (textureSample(diffuseSampler,diffuseSamplerSampler,input.vUV).a<0.4) {discard;} +#endif +#ifdef STORE_CAMERASPACE_Z +#ifdef PACKED +fragmentOutputs.color=pack(input.vViewPos.z); +#else +fragmentOutputs.color= vec4f(input.vViewPos.z,0.0,0.0,1.0); +#endif +#else +#ifdef NONLINEARDEPTH +#ifdef PACKED +fragmentOutputs.color=pack(input.position.z); +#else +fragmentOutputs.color= vec4f(input.position.z,0.0,0.0,0.0); +#endif +#else +#ifdef PACKED +fragmentOutputs.color=pack(input.vDepthMetric); +#else +fragmentOutputs.color= vec4f(input.vDepthMetric,0.0,0.0,1.0); +#endif +#endif +#endif +}`;i.ShadersStoreWGSL[e]||(i.ShadersStoreWGSL[e]=t);const p={name:e,shader:t};export{p as depthPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/depth.vertex-CtuzpX69.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/depth.vertex-CtuzpX69.js new file mode 100644 index 0000000000000000000000000000000000000000..31db290e5f6b4f1ec0c9ad889daf924f54021128 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/depth.vertex-CtuzpX69.js @@ -0,0 +1,57 @@ +import{S as t}from"./index-CDrXokXW.js";import"./bonesDeclaration-Bh_c0MF7.js";import"./instancesVertex-CO_CTxxp.js";import"./morphTargetsVertexDeclaration-BsT9JpOT.js";import"./clipPlaneVertex-J3Krgsee.js";import"./instancesDeclaration-DZdrWbmN.js";import"./morphTargetsVertex-DcRl6X3j.js";import"./bonesVertex-bl6LLSA1.js";import"./bakedVertexAnimation-DoavwM49.js";import"./index-DWyDLubb.js";const e="depthVertexShader",i=`attribute position: vec3f; +#include +#include +#include +#include[0..maxSimultaneousMorphTargets] +#include +#include +uniform viewProjection: mat4x4f;uniform depthValues: vec2f; +#if defined(ALPHATEST) || defined(NEED_UV) +varying vUV: vec2f;uniform diffuseMatrix: mat4x4f; +#ifdef UV1 +attribute uv: vec2f; +#endif +#ifdef UV2 +attribute uv2: vec2f; +#endif +#endif +#ifdef STORE_CAMERASPACE_Z +uniform view: mat4x4f;varying vViewPos: vec4f; +#endif +varying vDepthMetric: f32; +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position; +#ifdef UV1 +var uvUpdated: vec2f=input.uv; +#endif +#ifdef UV2 +var uv2Updated: vec2f=input.uv2; +#endif +#include +#include[0..maxSimultaneousMorphTargets] +#include +#include +#include +var worldPos: vec4f=finalWorld* vec4f(positionUpdated,1.0); +#include +vertexOutputs.position=uniforms.viewProjection*worldPos; +#ifdef STORE_CAMERASPACE_Z +vertexOutputs.vViewPos=uniforms.view*worldPos; +#else +#ifdef USE_REVERSE_DEPTHBUFFER +vertexOutputs.vDepthMetric=((-vertexOutputs.position.z+uniforms.depthValues.x)/(uniforms.depthValues.y)); +#else +vertexOutputs.vDepthMetric=((vertexOutputs.position.z+uniforms.depthValues.x)/(uniforms.depthValues.y)); +#endif +#endif +#if defined(ALPHATEST) || defined(BASIC_RENDER) +#ifdef UV1 +vertexOutputs.vUV= (uniforms.diffuseMatrix* vec4f(uvUpdated,1.0,0.0)).xy; +#endif +#ifdef UV2 +vertexOutputs.vUV= (uniforms.diffuseMatrix* vec4f(uv2Updated,1.0,0.0)).xy; +#endif +#endif +} +`;t.ShadersStoreWGSL[e]||(t.ShadersStoreWGSL[e]=i);const c={name:e,shader:i};export{c as depthVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/depthBoxBlur.fragment-D3tCU99k.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/depthBoxBlur.fragment-D3tCU99k.js new file mode 100644 index 0000000000000000000000000000000000000000..ef9e5bcd5a63efa4b8ea85c100657b2d64bcd7ef --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/depthBoxBlur.fragment-D3tCU99k.js @@ -0,0 +1,5 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="depthBoxBlurPixelShader",t=`varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform screenSize: vec2f; +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var colorDepth: vec4f=vec4f(0.0);for (var x: i32=-OFFSET; x<=OFFSET; x++) {for (var y: i32=-OFFSET; y<=OFFSET; y++) {colorDepth+=textureSample(textureSampler,textureSamplerSampler,input.vUV+ vec2f(f32(x),f32(y))/uniforms.screenSize);}} +fragmentOutputs.color=(colorDepth/ f32((OFFSET*2+1)*(OFFSET*2+1)));}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=t);const o={name:e,shader:t};export{o as depthBoxBlurPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/depthBoxBlur.fragment-DyrvnXqO.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/depthBoxBlur.fragment-DyrvnXqO.js new file mode 100644 index 0000000000000000000000000000000000000000..63b9fb0bc05a4e3dca1e6482f1aa819e576b6624 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/depthBoxBlur.fragment-DyrvnXqO.js @@ -0,0 +1,6 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="depthBoxBlurPixelShader",o=`varying vec2 vUV;uniform sampler2D textureSampler;uniform vec2 screenSize; +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) +{vec4 colorDepth=vec4(0.0);for (int x=-OFFSET; x<=OFFSET; x++) +for (int y=-OFFSET; y<=OFFSET; y++) +colorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);gl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));}`;r.ShadersStore[e]||(r.ShadersStore[e]=o);const i={name:e,shader:o};export{i as depthBoxBlurPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/diagram-PSM6KHXK-CdCLy2g4.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/diagram-PSM6KHXK-CdCLy2g4.js new file mode 100644 index 0000000000000000000000000000000000000000..c5a3788cfa02bc08784296934fbec5fcfaa83980 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/diagram-PSM6KHXK-CdCLy2g4.js @@ -0,0 +1,24 @@ +import{_ as h,E as j,G as q,I as re,d as ne,l as B,a9 as L,b as oe,a as ie,p as ce,q as pe,g as de,s as he,F as me,aa as ue,y as fe}from"./mermaid.core-7TB2QPZo.js";import{s as ye}from"./chunk-QN33PNHL-w0eYMV5T.js";import{p as ge}from"./chunk-4BX2VUAB-Zuu4IE0p.js";import{p as Se}from"./treemap-KMMF4GRG-B4w9v4mX.js";import{f as P}from"./defaultLocale-CzDG__Ur.js";import{o as R}from"./ordinal-BeghXfj9.js";import{h as xe,t as be}from"./index-BU4IRnz1.js";import{s as W}from"./select-BigU4G0v.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";import"./min-ljrXhbfm.js";import"./_baseUniq-DT1kfcxk.js";import"./init-Dmth1JHB.js";var U=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=oe,this.getAccTitle=ie,this.setDiagramTitle=ce,this.getDiagramTitle=pe,this.getAccDescription=de,this.setAccDescription=he}static{h(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){const s=me,a=q();return j({...s.treemap,...a.treemap??{}})}addNode(s,a){this.nodes.push(s),this.levels.set(s,a),a===0&&(this.outerNodes.push(s),this.root??=s)}getRoot(){return{name:"",children:this.outerNodes}}addClass(s,a){const o=this.classes.get(s)??{id:s,styles:[],textStyles:[]},i=a.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");i&&i.forEach(p=>{ue(p)&&(o?.textStyles?o.textStyles.push(p):o.textStyles=[p]),o?.styles?o.styles.push(p):o.styles=[p]}),this.classes.set(s,o)}getClasses(){return this.classes}getStylesForClass(s){return this.classes.get(s)?.styles??[]}clear(){fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function J(s){if(!s.length)return[];const a=[],o=[];return s.forEach(i=>{const p={name:i.name,children:i.type==="Leaf"?void 0:[]};for(p.classSelector=i?.classSelector,i?.cssCompiledStyles&&(p.cssCompiledStyles=[i.cssCompiledStyles]),i.type==="Leaf"&&i.value!==void 0&&(p.value=i.value);o.length>0&&o[o.length-1].level>=i.level;)o.pop();if(o.length===0)a.push(p);else{const n=o[o.length-1].node;n.children?n.children.push(p):n.children=[p]}i.type!=="Leaf"&&o.push({node:p,level:i.level})}),a}h(J,"buildHierarchy");var ve=h((s,a)=>{ge(s,a);const o=[];for(const n of s.TreemapRows??[])n.$type==="ClassDefStatement"&&a.addClass(n.className??"",n.styleText??"");for(const n of s.TreemapRows??[]){const d=n.item;if(!d)continue;const u=n.indent?parseInt(n.indent):0,M=Ce(d),l=d.classSelector?a.getStylesForClass(d.classSelector):[],F=l.length>0?l.join(";"):void 0,b={level:u,name:M,type:d.$type,value:d.value,classSelector:d.classSelector,cssCompiledStyles:F};o.push(b)}const i=J(o),p=h((n,d)=>{for(const u of n)a.addNode(u,d),u.children&&u.children.length>0&&p(u.children,d+1)},"addNodesRecursively");p(i,0)},"populate"),Ce=h(s=>s.name?String(s.name):"","getItemName"),K={parser:{yy:void 0},parse:h(async s=>{try{const o=await Se("treemap",s);B.debug("Treemap AST:",o);const i=K.parser?.yy;if(!(i instanceof U))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");ve(o,i)}catch(a){throw B.error("Error parsing treemap:",a),a}},"parse")},we=10,$=10,D=25,Te=h((s,a,o,i)=>{const p=i.db,n=p.getConfig(),d=n.padding??we,u=p.getDiagramTitle(),M=p.getRoot(),{themeVariables:l}=q();if(!M)return;const F=u?30:0,b=re(a),I=n.nodeWidth?n.nodeWidth*$:960,G=n.nodeHeight?n.nodeHeight*$:500,_=I,O=G+F;b.attr("viewBox",`0 0 ${_} ${O}`),ne(b,O,_,n.useMaxWidth);let v;try{const e=n.valueFormat||",";if(e==="$0,0")v=h(t=>"$"+P(",")(t),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const t=/\.\d+/.exec(e),r=t?t[0]:"";v=h(m=>"$"+P(","+r)(m),"valueFormat")}else if(e.startsWith("$")){const t=e.substring(1);v=h(r=>"$"+P(t||"")(r),"valueFormat")}else v=P(e)}catch(e){B.error("Error creating format function:",e),v=P(",")}const z=R().range(["transparent",l.cScale0,l.cScale1,l.cScale2,l.cScale3,l.cScale4,l.cScale5,l.cScale6,l.cScale7,l.cScale8,l.cScale9,l.cScale10,l.cScale11]),Q=R().range(["transparent",l.cScalePeer0,l.cScalePeer1,l.cScalePeer2,l.cScalePeer3,l.cScalePeer4,l.cScalePeer5,l.cScalePeer6,l.cScalePeer7,l.cScalePeer8,l.cScalePeer9,l.cScalePeer10,l.cScalePeer11]),V=R().range([l.cScaleLabel0,l.cScaleLabel1,l.cScaleLabel2,l.cScaleLabel3,l.cScaleLabel4,l.cScaleLabel5,l.cScaleLabel6,l.cScaleLabel7,l.cScaleLabel8,l.cScaleLabel9,l.cScaleLabel10,l.cScaleLabel11]);u&&b.append("text").attr("x",_/2).attr("y",F/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(u);const X=b.append("g").attr("transform",`translate(0, ${F})`).attr("class","treemapContainer"),Z=xe(M).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),Y=be().size([I,G]).paddingTop(e=>e.children&&e.children.length>0?D+$:0).paddingInner(d).paddingLeft(e=>e.children&&e.children.length>0?$:0).paddingRight(e=>e.children&&e.children.length>0?$:0).paddingBottom(e=>e.children&&e.children.length>0?$:0).round(!0)(Z),ee=Y.descendants().filter(e=>e.children&&e.children.length>0),N=X.selectAll(".treemapSection").data(ee).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);N.append("rect").attr("width",e=>e.x1-e.x0).attr("height",D).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),N.append("clipPath").attr("id",(e,t)=>`clip-section-${a}-${t}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",D),N.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,t)=>`treemapSection section${t}`).attr("fill",e=>z(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>Q(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const t=L({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+";"+t.borderStyles.join(";")}),N.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",D/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("style",e=>{if(e.depth===0)return"display: none;";const t="dominant-baseline: middle; font-size: 12px; fill:"+V(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",r=L({cssCompiledStyles:e.data.cssCompiledStyles});return t+r.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const t=W(this),r=e.data.name;t.text(r);const m=e.x1-e.x0,y=6;let g;n.showValues!==!1&&e.value?g=m-10-30-10-y:g=m-y-6;const S=Math.max(15,g),c=t.node();if(c.getComputedTextLength()>S){let f=r;for(;f.length>0;){if(f=r.substring(0,f.length-1),f.length===0){t.text("..."),c.getComputedTextLength()>S&&t.text("");break}if(t.text(f+"..."),c.getComputedTextLength()<=S)break}}}),n.showValues!==!1&&N.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",D/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?v(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const t="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+V(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",r=L({cssCompiledStyles:e.data.cssCompiledStyles});return t+r.labelStyles.replace("color:","fill:")});const te=Y.leaves(),E=X.selectAll(".treemapLeafGroup").data(te).enter().append("g").attr("class",(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);E.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?z(e.parent.data.name):z(e.data.name)).attr("style",e=>L({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?z(e.parent.data.name):z(e.data.name)).attr("stroke-width",3),E.append("clipPath").attr("id",(e,t)=>`clip-${a}-${t}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),E.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const t="text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+V(e.data.name)+";",r=L({cssCompiledStyles:e.data.cssCompiledStyles});return t+r.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,t)=>`url(#clip-${a}-${t})`).text(e=>e.data.name).each(function(e){const t=W(this),r=e.x1-e.x0,m=e.y1-e.y0,y=t.node(),g=4,T=r-2*g,S=m-2*g;if(T<10||S<10){t.style("display","none");return}let c=parseInt(t.style("font-size"),10);const C=8,x=28,f=.6,w=6,A=2;for(;y.getComputedTextLength()>T&&c>C;)c--,t.style("font-size",`${c}px`);let k=Math.max(w,Math.min(x,Math.round(c*f))),H=c+A+k;for(;H>S&&c>C&&(c--,k=Math.max(w,Math.min(x,Math.round(c*f))),!(kT||c(t.x1-t.x0)/2).attr("y",function(t){return(t.y1-t.y0)/2}).attr("style",t=>{const r="text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+V(t.data.name)+";",m=L({cssCompiledStyles:t.data.cssCompiledStyles});return r+m.labelStyles.replace("color:","fill:")}).attr("clip-path",(t,r)=>`url(#clip-${a}-${r})`).text(t=>t.value?v(t.value):"").each(function(t){const r=W(this),m=this.parentNode;if(!m){r.style("display","none");return}const y=W(m).select(".treemapLabel");if(y.empty()||y.style("display")==="none"){r.style("display","none");return}const g=parseFloat(y.style("font-size")),T=28,S=.6,c=6,C=2,x=Math.max(c,Math.min(T,Math.round(g*S)));r.style("font-size",`${x}px`);const w=(t.y1-t.y0)/2+g/2+C;r.attr("y",w);const A=t.x1-t.x0,le=t.y1-t.y0-4,se=A-8;r.node().getComputedTextLength()>se||w+x>le||x{const a=j(Fe,s);return` + .treemapNode.section { + stroke: ${a.sectionStrokeColor}; + stroke-width: ${a.sectionStrokeWidth}; + fill: ${a.sectionFillColor}; + } + .treemapNode.leaf { + stroke: ${a.leafStrokeColor}; + stroke-width: ${a.leafStrokeWidth}; + fill: ${a.leafFillColor}; + } + .treemapLabel { + fill: ${a.labelColor}; + font-size: ${a.labelFontSize}; + } + .treemapValue { + fill: ${a.valueColor}; + font-size: ${a.valueFontSize}; + } + .treemapTitle { + fill: ${a.titleColor}; + font-size: ${a.titleFontSize}; + } + `},"getStyles"),Ne=ze,je={parser:K,get db(){return new U},renderer:$e,styles:Ne};export{je as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/diagram-QEK2KX5R-D6_C2dWJ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/diagram-QEK2KX5R-D6_C2dWJ.js new file mode 100644 index 0000000000000000000000000000000000000000..941e4e17471c5d6907652f888d8fb2ca652bd2cc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/diagram-QEK2KX5R-D6_C2dWJ.js @@ -0,0 +1,43 @@ +import{s as k,g as I,q as R,p as E,a as F,b as _,_ as l,I as D,y as G,E as f,F as P,G as C,l as z,L as V}from"./mermaid.core-7TB2QPZo.js";import{p as W}from"./chunk-4BX2VUAB-Zuu4IE0p.js";import{p as B}from"./treemap-KMMF4GRG-B4w9v4mX.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";import"./select-BigU4G0v.js";import"./min-ljrXhbfm.js";import"./_baseUniq-DT1kfcxk.js";var h={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},w={axes:[],curves:[],options:h},m=structuredClone(w),H=P.radar,j=l(()=>f({...H,...C().radar}),"getConfig"),b=l(()=>m.axes,"getAxes"),q=l(()=>m.curves,"getCurves"),N=l(()=>m.options,"getOptions"),U=l(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),X=l(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:Y(t.entries)}))},"setCurves"),Y=l(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=b();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>s.axis?.$refText===e.name);if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),Z=l(a=>{const t=a.reduce((e,r)=>(e[r.name]=r,e),{});m.options={showLegend:t.showLegend?.value??h.showLegend,ticks:t.ticks?.value??h.ticks,max:t.max?.value??h.max,min:t.min?.value??h.min,graticule:t.graticule?.value??h.graticule}},"setOptions"),J=l(()=>{G(),m=structuredClone(w)},"clear"),$={getAxes:b,getCurves:q,getOptions:N,setAxes:U,setCurves:X,setOptions:Z,getConfig:j,clear:J,setAccTitle:_,getAccTitle:F,setDiagramTitle:E,getDiagramTitle:R,getAccDescription:I,setAccDescription:k},K=l(a=>{W(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),Q={parse:l(async a=>{const t=await B("radar",a);z.debug(t),K(t)},"parse")},tt=l((a,t,e,r)=>{const s=r.db,o=s.getAxes(),i=s.getCurves(),n=s.getOptions(),c=s.getConfig(),d=s.getDiagramTitle(),u=D(t),p=et(u,c),g=n.max??Math.max(...i.map(y=>Math.max(...y.entries))),x=n.min,v=Math.min(c.width,c.height)/2;at(p,o,v,n.ticks,n.graticule),rt(p,o,v,c),M(p,o,i,x,g,n.graticule,c),T(p,i,n.showLegend,c),p.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-c.height/2-c.marginTop)},"draw"),et=l((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return a.attr("viewbox",`0 0 ${e} ${r}`).attr("width",e).attr("height",r),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),at=l((a,t,e,r,s)=>{if(s==="circle")for(let o=0;o{const p=2*u*Math.PI/o-Math.PI/2,g=n*Math.cos(p),x=n*Math.sin(p);return`${g},${x}`}).join(" ");a.append("polygon").attr("points",c).attr("class","radarGraticule")}}},"drawGraticule"),rt=l((a,t,e,r)=>{const s=t.length;for(let o=0;o{if(d.entries.length!==n)return;const p=d.entries.map((g,x)=>{const v=2*Math.PI*x/n-Math.PI/2,y=A(g,r,s,c),O=y*Math.cos(v),S=y*Math.sin(v);return{x:O,y:S}});o==="circle"?a.append("path").attr("d",L(p,i.curveTension)).attr("class",`radarCurve-${u}`):o==="polygon"&&a.append("polygon").attr("points",p.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${u}`)})}l(M,"drawCurves");function A(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}l(A,"relativeRadius");function L(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${o+c*i})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${c}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(n.label)})}l(T,"drawLegend");var st={draw:tt},nt=l((a,t)=>{let e="";for(let r=0;r{const t=V(),e=C(),r=f(t,e.themeVariables),s=f(r.radar,a);return{themeVariables:r,radarOptions:s}},"buildRadarStyleOptions"),it=l(({radar:a}={})=>{const{themeVariables:t,radarOptions:e}=ot(a);return` + .radarTitle { + font-size: ${t.fontSize}; + color: ${t.titleColor}; + dominant-baseline: hanging; + text-anchor: middle; + } + .radarAxisLine { + stroke: ${e.axisColor}; + stroke-width: ${e.axisStrokeWidth}; + } + .radarAxisLabel { + dominant-baseline: middle; + text-anchor: middle; + font-size: ${e.axisLabelFontSize}px; + color: ${e.axisColor}; + } + .radarGraticule { + fill: ${e.graticuleColor}; + fill-opacity: ${e.graticuleOpacity}; + stroke: ${e.graticuleColor}; + stroke-width: ${e.graticuleStrokeWidth}; + } + .radarLegendText { + text-anchor: start; + font-size: ${e.legendFontSize}px; + dominant-baseline: hanging; + } + ${nt(t,e)} + `},"styles"),$t={parser:Q,db:$,renderer:st,styles:it};export{$t as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/diagram-S2PKOQOG-CEnWRsMT.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/diagram-S2PKOQOG-CEnWRsMT.js new file mode 100644 index 0000000000000000000000000000000000000000..b166dcf8b2797706b57c54ceb275ca29595d9b35 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/diagram-S2PKOQOG-CEnWRsMT.js @@ -0,0 +1,24 @@ +import{_ as b,E as m,I as $,d as B,l as u,b as C,a as S,p as D,q as T,g as E,s as F,F as P,G as z,y as A}from"./mermaid.core-7TB2QPZo.js";import{p as W}from"./chunk-4BX2VUAB-Zuu4IE0p.js";import{p as _}from"./treemap-KMMF4GRG-B4w9v4mX.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";import"./select-BigU4G0v.js";import"./min-ljrXhbfm.js";import"./_baseUniq-DT1kfcxk.js";var N=P.packet,w=class{constructor(){this.packet=[],this.setAccTitle=C,this.getAccTitle=S,this.setDiagramTitle=D,this.getDiagramTitle=T,this.getAccDescription=E,this.setAccDescription=F}static{b(this,"PacketDB")}getConfig(){const t=m({...N,...z().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){A(),this.packet=[]}},I=1e4,L=b((t,e)=>{W(t,e);let r=-1,o=[],n=1;const{bitsPerRow:l}=e.getConfig();for(let{start:a,end:i,bits:d,label:c}of t.blocks){if(a!==void 0&&i!==void 0&&i{if(t.start===void 0)throw new Error("start should have been set during first phase");if(t.end===void 0)throw new Error("end should have been set during first phase");if(t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=e*r)return[t,void 0];const o=e*r-1,n=e*r;return[{start:t.start,end:o,label:t.label,bits:o-t.start},{start:n,end:t.end,label:t.label,bits:t.end-n}]},"getNextFittingBlock"),v={parser:{yy:void 0},parse:b(async t=>{const e=await _("packet",t),r=v.parser?.yy;if(!(r instanceof w))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");u.debug(e),L(e,r)},"parse")},Y=b((t,e,r,o)=>{const n=o.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=$(e);f.attr("viewbox",`0 0 ${k} ${g}`),B(f,g,k,l.useMaxWidth);for(const[x,y]of p.entries())G(f,y,x,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),G=b((t,e,r,{rowHeight:o,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=t.append("g"),p=r*(o+l)+l;for(const s of e){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",o).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+o/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),O={draw:Y},j={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},q=b(({packet:t}={})=>{const e=m(j,t);return` + .packetByte { + font-size: ${e.byteFontSize}; + } + .packetByte.start { + fill: ${e.startByteColor}; + } + .packetByte.end { + fill: ${e.endByteColor}; + } + .packetLabel { + fill: ${e.labelColor}; + font-size: ${e.labelFontSize}; + } + .packetTitle { + fill: ${e.titleColor}; + font-size: ${e.titleFontSize}; + } + .packetBlock { + stroke: ${e.blockStrokeColor}; + stroke-width: ${e.blockStrokeWidth}; + fill: ${e.blockFillColor}; + } + `},"styles"),et={parser:v,get db(){return new w},renderer:O,styles:q};export{et as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/discBuilder-DHjTJ34Z.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/discBuilder-DHjTJ34Z.js new file mode 100644 index 0000000000000000000000000000000000000000..6e0bddc7620248bb902ca827f3545ddc2591a265 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/discBuilder-DHjTJ34Z.js @@ -0,0 +1 @@ +import{l as h,m as c}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";function x(e){const t=[],a=[],n=[],s=[],o=e.radius||.5,u=e.tessellation||64,l=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,p=e.sideOrientation===0?0:e.sideOrientation||c.DEFAULTSIDE;t.push(0,0,0),s.push(.5,.5);const D=Math.PI*2*l,v=l===1?D/u:D/(u-1);let d=0;for(let r=0;rO(e,{radius:t,tessellation:a,sideOrientation:o,updatable:s},n);export{O as CreateDisc,x as CreateDiscVertexData,U as DiscBuilder}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/dispatch-kxCwF96_.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/dispatch-kxCwF96_.js new file mode 100644 index 0000000000000000000000000000000000000000..e9c56d6143ced97d32b5cb3fc5deb9746d830677 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/dispatch-kxCwF96_.js @@ -0,0 +1 @@ +var a={value:()=>{}};function l(){for(var n=0,t=arguments.length,r={},e;n=0&&(e=r.slice(o+1),r=r.slice(0,o)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:e}})}f.prototype=l.prototype={constructor:f,on:function(n,t){var r=this._,e=h(n+"",r),o,u=-1,i=e.length;if(arguments.length<2){for(;++u0)for(var r=new Array(o),e=0,o,u;e2&&o.token&&typeof o.token!="string"){e.pending=[];for(var g=2;g-1)return null;var s=e.indent.length-1,l=n[e.state];n:for(;;){for(var o=0;o9999?"+"+f(r,6):f(r,4)}function S(r){var t=r.getUTCHours(),e=r.getUTCMinutes(),a=r.getUTCSeconds(),c=r.getUTCMilliseconds();return isNaN(r)?"Invalid Date":L(r.getUTCFullYear())+"-"+f(r.getUTCMonth()+1,2)+"-"+f(r.getUTCDate(),2)+(c?"T"+f(t,2)+":"+f(e,2)+":"+f(a,2)+"."+f(c,3)+"Z":a?"T"+f(t,2)+":"+f(e,2)+":"+f(a,2)+"Z":e||t?"T"+f(t,2)+":"+f(e,2)+"Z":"")}function Z(r){var t=new RegExp('["'+r+` +\r]`),e=r.charCodeAt(0);function a(n,o){var s,i,u=c(n,function(h,l){if(s)return s(h,l-1);i=h,s=o?B(h,o):I(h)});return u.columns=i||[],u}function c(n,o){var s=[],i=n.length,u=0,h=0,l,v=i<=0,C=!1;n.charCodeAt(i-1)===m&&--i,n.charCodeAt(i-1)===R&&--i;function w(){if(v)return A;if(C)return C=!1,D;var j,d=u,p;if(n.charCodeAt(d)===E){for(;u++=i?v=!0:(p=n.charCodeAt(u++))===m?C=!0:p===R&&(C=!0,n.charCodeAt(u)===m&&++u),n.slice(d+1,j-1).replace(/""/g,'"')}for(;ui.map(i=>d[i]); +import{af as y}from"./index-DWyDLubb.js";import{aB as A,d,L as v,aC as b,aq as g,aD as T,aE as C,_ as I,aF as x}from"./index-CDrXokXW.js";let c=null;async function S(){const n=g.LastCreatedEngine?.createCanvas(100,100)??new OffscreenCanvas(100,100);n instanceof OffscreenCanvas&&v.Warn("DumpData: OffscreenCanvas will be used for dumping data. This may result in lossy alpha values.");const{ThinEngine:i}=await y(async()=>{const{ThinEngine:t}=await import("./index-CDrXokXW.js").then(a=>a.cv);return{ThinEngine:t}},__vite__mapDeps([0,1,2]),import.meta.url);if(!i.IsSupported)throw new Error("DumpData: No WebGL context available. Cannot dump data.");const r={preserveDrawingBuffer:!0,depth:!1,stencil:!1,alpha:!0,premultipliedAlpha:!1,antialias:!1,failIfMajorPerformanceCaveat:!1},e=new i(n,!1,r);g.Instances.pop(),g.OnEnginesDisposedObservable.add(t=>{e&&t!==e&&!e.isDisposed&&g.Instances.length===0&&_()}),e.getCaps().parallelShaderCompile=void 0;const o=new T(e),{passPixelShader:s}=await y(async()=>{const{passPixelShader:t}=await import("./pass.fragment-DOtTp0aB.js");return{passPixelShader:t}},__vite__mapDeps([3,0,1,2]),import.meta.url),p=new C({engine:e,name:s.name,fragmentShader:s.shader,samplerNames:["textureSampler"]});return{canvas:n,dumpEngine:{engine:e,renderer:o,wrapper:p}}}async function P(){return c||(c=S()),await c}class E{static async EncodeImageAsync(i,r,e,o,s,p){const t=await P(),a=t.dumpEngine;a.engine.setSize(r,e,!0);const f=a.engine.createRawTexture(i,r,e,5,!1,!s,1);return a.renderer.setViewport(),a.renderer.applyEffectWrapper(a.wrapper),a.wrapper.effect._bindTexture("textureSampler",f),a.renderer.draw(),f.dispose(),await new Promise((l,u)=>{d.ToBlob(t.canvas,m=>{m?l(m):u(new Error("EncodeImageAsync: Failed to convert canvas to blob."))},o,p)})}}I([x],E,"EncodeImageAsync",null);const R=E.EncodeImageAsync;async function h(n,i,r,e,o="image/png",s,p){const t=await r.readPixels(0,0,n,i),a=new Uint8Array(t.buffer);D(n,i,a,e,o,s,!0,void 0,p)}async function w(n,i,r,e="image/png",o,s=!1,p=!1,t){if(r instanceof Float32Array){const l=new Uint8Array(r.length);let u=r.length;for(;u--;){const m=r[u];l[u]=Math.round(A(m)*255)}r=l}const a=await E.EncodeImageAsync(r,n,i,e,s,t);o!==void 0&&d.DownloadBlob(a,o),a.type!==e&&v.Warn(`DumpData: The requested mimeType '${e}' is not supported. The result has mimeType '${a.type}' instead.`);const f=await a.arrayBuffer();return p?f:`data:${e};base64,${b(f)}`}function D(n,i,r,e,o="image/png",s,p=!1,t=!1,a){s===void 0&&!e&&(s=""),w(n,i,r,o,s,p,t,a).then(f=>{e&&e(f)})}function _(){c&&(c?.then(n=>{n.canvas instanceof HTMLCanvasElement&&n.canvas.remove(),n.dumpEngine&&(n.dumpEngine.engine.dispose(),n.dumpEngine.renderer.dispose(),n.dumpEngine.wrapper.dispose())}),c=null)}const F={DumpData:D,DumpDataAsync:w,DumpFramebuffer:h,Dispose:_},O=()=>{d.DumpData=D,d.DumpDataAsync=w,d.DumpFramebuffer=h};O();export{_ as Dispose,D as DumpData,w as DumpDataAsync,h as DumpFramebuffer,F as DumpTools,R as EncodeImageAsync}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/embed-C0bvMD9o.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/embed-C0bvMD9o.js new file mode 100644 index 0000000000000000000000000000000000000000..da2ff3af1c24771179e64f709acf141f58c7794d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/embed-C0bvMD9o.js @@ -0,0 +1,187 @@ +import{f as WD,m as GD,d as HD,q as fb,a as VD,b as pw,c as XD,$ as YD,p as KD,i as JD,l as QD,e as ZD,s as eR,g as tR,u as nR,h as gw,j as iR,k as rR,n as sR,o as oR,r as aR,t as uR,v as lR,w as cR,x as fR,y as dR,z as hR,A as pR,B as gR,C as mR,D as yR,E as bR,F as xR,G as vR,H as ER,I as wR,J as SR,K as kR,L as mw,S as $R,M as yw,N as AR,O as CR,P as FR,Q as OR,R as DR,T as RR,U as _R,V as TR,W as NR,X as MR,Y as LR,Z as PR,_ as IR,a0 as zR,a1 as BR,a2 as UR,a3 as jR,a4 as bw,a5 as qR,a6 as WR,a7 as GR,a8 as HR,a9 as VR,aa as XR,ab as YR,ac as KR,ad as JR,ae as QR,af as db,ag as ZR,ah as e_,ai as t_,aj as n_,ak as i_,al as r_,am as s_,an as o_,ao as a_,ap as u_,aq as l_,ar as c_,as as f_,at as wd}from"./mollweide-XXUPULVr.js";import{b as gg,t as Ua,p as d_,d as h_,e as p_,f as xw,l as g_,g as m_,h as Wl,i as y_,j as b_,k as x_}from"./linear-8mDBZVC7.js";import{p as vw,s as Ew,o as v_,n as E_,l as vl,d as ww,c as hb,q as w_,u as S_,r as k_,v as El,w as Sw,x as pb,y as $_,z as A_,b as C_,A as F_,B as O_,C as D_,a as Ra,m as R_,t as __,D as T_,E as N_}from"./time-BMaLdJ6b.js";import{c as M_,a as gb,f as L_,b as P_}from"./defaultLocale-CzDG__Ur.js";import{d as I_}from"./dsv-DB8NKgIY.js";import{r as ys}from"./range-OtVwhkKS.js";import{o as kw,i as z_}from"./ordinal-BeghXfj9.js";import{D as B_,E as U_,F as j_,G as q_,H as W_,I as G_,J as H_,K as V_,L as X_,M as Y_,N as K_,O as J_,P as Q_,Q as Z_,S as eT,T as tT,U as nT,k as iT,V as mg,l as rT,W as Gl,X as sT}from"./step-B-Gbak1k.js";import{d as oT}from"./arc-Bt_eNeYl.js";import{h as aT,t as uT,a as lT,b as cT,c as fT}from"./index-BU4IRnz1.js";import"./dispatch-kxCwF96_.js";import"./init-Dmth1JHB.js";import"./colors-Cc3OSVma.js";function Mt(e,t,n){return e.fields=t||[],e.fname=n,e}function Me(e){return e==null?null:e.fname}function pt(e){return e==null?null:e.fields}function $w(e){return e.length===1?dT(e[0]):hT(e)}const dT=e=>function(t){return t[e]},hT=e=>{const t=e.length;return function(n){for(let i=0;io?l():o=a+1:u==="["?(a>o&&l(),r=o=a+1):u==="]"&&(r||A("Access path missing open bracket: "+e),r>0&&l(),r=0,o=a+1)}return r&&A("Access path missing closing bracket: "+e),i&&A("Access path missing closing quote: "+e),a>o&&(a++,l()),t}function rn(e,t,n){const i=si(e);return e=i.length===1?i[0]:e,Mt((n&&n.get||$w)(i),[e],t||e)}const lu=rn("id"),bt=Mt(e=>e,[],"identity"),Yi=Mt(()=>0,[],"zero"),Ro=Mt(()=>1,[],"one"),sn=Mt(()=>!0,[],"true"),ji=Mt(()=>!1,[],"false"),yg=new Set([...Object.getOwnPropertyNames(Object.prototype).filter(e=>typeof Object.prototype[e]=="function"),"__proto__"]);function pT(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}const Aw=0,bg=1,xg=2,Cw=3,Fw=4;function Lc(e,t,n=pT){let i=e||Aw;return{level(r){return arguments.length?(i=+r,this):i},error(){return i>=bg&&n(t||"error","ERROR",arguments),this},warn(){return i>=xg&&n(t||"warn","WARN",arguments),this},info(){return i>=Cw&&n(t||"log","INFO",arguments),this},debug(){return i>=Fw&&n(t||"log","DEBUG",arguments),this}}}var F=Array.isArray;function U(e){return e===Object(e)}const mb=e=>e!=="__proto__";function _o(...e){return e.reduce((t,n)=>{for(const i in n)if(i==="signals")t.signals=gT(t.signals,n.signals);else{const r=i==="legend"?{layout:1}:i==="style"?!0:null;To(t,i,n[i],r)}return t},{})}function To(e,t,n,i){if(!mb(t))return;let r,s;if(U(n)&&!F(n)){s=U(e[t])?e[t]:e[t]={};for(r in n)i&&(i===!0||i[r])?To(s,r,n[r]):mb(r)&&(s[r]=n[r])}else e[t]=n}function gT(e,t){if(e==null)return t;const n={},i=[];function r(s){n[s.name]||(n[s.name]=1,i.push(s))}return t.forEach(r),e.forEach(r),i}function ue(e){return e[e.length-1]}function dt(e){return e==null||e===""?null:+e}const Ow=e=>t=>e*Math.exp(t),Dw=e=>t=>Math.log(e*t),Rw=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),_w=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,Hl=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function Pc(e,t,n,i){const r=n(e[0]),s=n(ue(e)),o=(s-r)*t;return[i(r-o),i(s-o)]}function Tw(e,t){return Pc(e,t,dt,bt)}function Nw(e,t){var n=Math.sign(e[0]);return Pc(e,t,Dw(n),Ow(n))}function Mw(e,t,n){return Pc(e,t,Hl(n),Hl(1/n))}function Lw(e,t,n){return Pc(e,t,Rw(n),_w(n))}function Ic(e,t,n,i,r){const s=i(e[0]),o=i(ue(e)),a=t!=null?i(t):(s+o)/2;return[r(a+(s-a)*n),r(a+(o-a)*n)]}function vg(e,t,n){return Ic(e,t,n,dt,bt)}function Eg(e,t,n){const i=Math.sign(e[0]);return Ic(e,t,n,Dw(i),Ow(i))}function Vl(e,t,n,i){return Ic(e,t,n,Hl(i),Hl(1/i))}function wg(e,t,n,i){return Ic(e,t,n,Rw(i),_w(i))}function Pw(e){return 1+~~(new Date(e).getMonth()/3)}function Iw(e){return 1+~~(new Date(e).getUTCMonth()/3)}function q(e){return e!=null?F(e)?e:[e]:[]}function zw(e,t,n){let i=e[0],r=e[1],s;return r=n-t?[t,n]:[i=Math.min(Math.max(i,t),n-s),i+s]}function ie(e){return typeof e=="function"}const mT="descending";function Sg(e,t,n){n=n||{},t=q(t)||[];const i=[],r=[],s={},o=n.comparator||yT;return q(e).forEach((a,u)=>{a!=null&&(i.push(t[u]===mT?-1:1),r.push(a=ie(a)?a:rn(a,null,n)),(pt(a)||[]).forEach(l=>s[l]=1))}),r.length===0?null:Mt(o(r,i),Object.keys(s))}const No=(e,t)=>(et||t==null)&&e!=null?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t===t?-1:t!==t&&e===e?1:0),yT=(e,t)=>e.length===1?bT(e[0],t[0]):xT(e,t,e.length),bT=(e,t)=>function(n,i){return No(e(n),e(i))*t},xT=(e,t,n)=>(t.push(0),function(i,r){let s,o=0,a=-1;for(;o===0&&++ae}function kg(e,t){let n;return i=>{n&&clearTimeout(n),n=setTimeout(()=>(t(i),n=null),e)}}function re(e){for(let t,n,i=1,r=arguments.length;io&&(o=r))}else{for(r=t(e[n]);no&&(o=r))}return[s,o]}function Bw(e,t){const n=e.length;let i=-1,r,s,o,a,u;if(t==null){for(;++i=s){r=o=s;break}if(i===n)return[-1,-1];for(a=u=i;++is&&(r=s,a=i),o=s){r=o=s;break}if(i===n)return[-1,-1];for(a=u=i;++is&&(r=s,a=i),o{r.set(s,e[s])}),r}function Uw(e,t,n,i,r,s){if(!n&&n!==0)return s;const o=+n;let a=e[0],u=ue(e),l;us&&(o=r,r=s,s=o),n=n===void 0||n,i=i===void 0||i,(n?r<=e:ra.replace(/\\(.)/g,"$1")):q(e));const i=e&&e.length,r=n&&n.get||$w,s=a=>r(t?[a]:si(a));let o;if(!i)o=function(){return""};else if(i===1){const a=s(e[0]);o=function(u){return""+a(u)}}else{const a=e.map(s);o=function(u){let l=""+a[0](u),c=0;for(;++c{t={},n={},i=0},s=(o,a)=>(++i>e&&(n=t,t={},i=1),t[o]=a);return r(),{clear:r,has:o=>G(t,o)||G(n,o),get:o=>G(t,o)?t[o]:G(n,o)?s(o,n[o]):void 0,set:(o,a)=>G(t,o)?t[o]=a:s(o,a)}}function Gw(e,t,n,i){const r=t.length,s=n.length;if(!s)return t;if(!r)return n;const o=i||new t.constructor(r+s);let a=0,u=0,l=0;for(;a0?n[u++]:t[a++];for(;a=0;)n+=e;return n}function Hw(e,t,n,i){const r=n||" ",s=e+"",o=t-s.length;return o<=0?s:i==="left"?ya(r,o)+s:i==="center"?ya(r,~~(o/2))+s+ya(r,Math.ceil(o/2)):s+ya(r,o)}function cu(e){return e&&ue(e)-e[0]||0}function L(e){return F(e)?`[${e.map(t=>t===null?"null":L(t))}]`:U(e)||j(e)?JSON.stringify(e).replaceAll("\u2028","\\u2028").replaceAll("\u2029","\\u2029"):e}function Cg(e){return e==null||e===""?null:!e||e==="false"||e==="0"?!1:!!e}const ET=e=>de(e)||rr(e)?e:Date.parse(e);function Fg(e,t){return t=t||ET,e==null||e===""?null:t(e)}function Og(e){return e==null||e===""?null:e+""}function $n(e){const t={},n=e.length;for(let i=0;i(e[t]=1+n,e),{});function Rg(e){const t=q(e).slice(),n={};return t.length||A("Missing time unit."),t.forEach(r=>{G(Sd,r)?n[r]=1:A(`Invalid time unit: ${r}.`)}),(n[We]||n[ft]?1:0)+(n[Dt]||n[gt]||n[Rt]?1:0)+(n[ei]?1:0)>1&&A(`Incompatible time units: ${e}`),t.sort((r,s)=>Sd[r]-Sd[s]),t}const wT={[st]:"%Y ",[Dt]:"Q%q ",[gt]:"%b ",[Rt]:"%d ",[We]:"W%U ",[ft]:"%a ",[ei]:"%j ",[Ht]:"%H:00",[Vt]:"00:%M",[on]:":%S",[An]:".%L",[`${st}-${gt}`]:"%Y-%m ",[`${st}-${gt}-${Rt}`]:"%Y-%m-%d ",[`${Ht}-${Vt}`]:"%H:%M"};function Xw(e,t){const n=re({},wT,t),i=Rg(e),r=i.length;let s="",o=0,a,u;for(o=0;oo;--a)if(u=i.slice(o,a).join("-"),n[u]!=null){s+=n[u],o=a;break}return s.trim()}const Ur=new Date;function _g(e){return Ur.setFullYear(e),Ur.setMonth(0),Ur.setDate(1),Ur.setHours(0,0,0,0),Ur}function Yw(e){return Jw(new Date(e))}function Kw(e){return Ih(new Date(e))}function Jw(e){return vl.count(_g(e.getFullYear())-1,e)}function Ih(e){return ww.count(_g(e.getFullYear())-1,e)}function zh(e){return _g(e).getDay()}function ST(e,t,n,i,r,s,o){if(0<=e&&e<100){const a=new Date(-1,t,n,i,r,s,o);return a.setFullYear(e),a}return new Date(e,t,n,i,r,s,o)}function Qw(e){return eS(new Date(e))}function Zw(e){return Bh(new Date(e))}function eS(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return El.count(t-1,e)}function Bh(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Sw.count(t-1,e)}function Uh(e){return Ur.setTime(Date.UTC(e,0,1)),Ur.getUTCDay()}function kT(e,t,n,i,r,s,o){if(0<=e&&e<100){const a=new Date(Date.UTC(-1,t,n,i,r,s,o));return a.setUTCFullYear(n.y),a}return new Date(Date.UTC(e,t,n,i,r,s,o))}function tS(e,t,n,i,r){const s=t||1,o=ue(e),a=(y,b,v)=>(v=v||y,$T(n[v],i[v],y===o&&s,b)),u=new Date,l=$n(e),c=l[st]?a(st):xt(2012),f=l[gt]?a(gt):l[Dt]?a(Dt):Yi,d=l[We]&&l[ft]?a(ft,1,We+ft):l[We]?a(We,1):l[ft]?a(ft,1):l[Rt]?a(Rt,1):l[ei]?a(ei,1):Ro,p=l[Ht]?a(Ht):Yi,h=l[Vt]?a(Vt):Yi,g=l[on]?a(on):Yi,m=l[An]?a(An):Yi;return function(y){u.setTime(+y);const b=c(u);return r(b,f(u),d(u,b),p(u),h(u),g(u),m(u))}}function $T(e,t,n,i){const r=n<=1?e:i?(s,o)=>i+n*Math.floor((e(s,o)-i)/n):(s,o)=>n*Math.floor(e(s,o)/n);return t?(s,o)=>t(r(s,o),o):r}function io(e,t,n){return t+e*7-(n+6)%7}const AT={[st]:e=>e.getFullYear(),[Dt]:e=>Math.floor(e.getMonth()/3),[gt]:e=>e.getMonth(),[Rt]:e=>e.getDate(),[Ht]:e=>e.getHours(),[Vt]:e=>e.getMinutes(),[on]:e=>e.getSeconds(),[An]:e=>e.getMilliseconds(),[ei]:e=>Jw(e),[We]:e=>Ih(e),[We+ft]:(e,t)=>io(Ih(e),e.getDay(),zh(t)),[ft]:(e,t)=>io(1,e.getDay(),zh(t))},CT={[Dt]:e=>3*e,[We]:(e,t)=>io(e,0,zh(t))};function nS(e,t){return tS(e,t||1,AT,CT,ST)}const FT={[st]:e=>e.getUTCFullYear(),[Dt]:e=>Math.floor(e.getUTCMonth()/3),[gt]:e=>e.getUTCMonth(),[Rt]:e=>e.getUTCDate(),[Ht]:e=>e.getUTCHours(),[Vt]:e=>e.getUTCMinutes(),[on]:e=>e.getUTCSeconds(),[An]:e=>e.getUTCMilliseconds(),[ei]:e=>eS(e),[We]:e=>Bh(e),[ft]:(e,t)=>io(1,e.getUTCDay(),Uh(t)),[We+ft]:(e,t)=>io(Bh(e),e.getUTCDay(),Uh(t))},OT={[Dt]:e=>3*e,[We]:(e,t)=>io(e,0,Uh(t))};function iS(e,t){return tS(e,t||1,FT,OT,kT)}const DT={[st]:w_,[Dt]:hb.every(3),[gt]:hb,[We]:ww,[Rt]:vl,[ft]:vl,[ei]:vl,[Ht]:E_,[Vt]:v_,[on]:Ew,[An]:vw},RT={[st]:$_,[Dt]:pb.every(3),[gt]:pb,[We]:Sw,[Rt]:El,[ft]:El,[ei]:El,[Ht]:k_,[Vt]:S_,[on]:Ew,[An]:vw};function Lo(e){return DT[e]}function Po(e){return RT[e]}function rS(e,t,n){return e?e.offset(t,n):void 0}function sS(e,t,n){return rS(Lo(e),t,n)}function oS(e,t,n){return rS(Po(e),t,n)}function aS(e,t,n,i){return e?e.range(t,n,i):void 0}function uS(e,t,n,i){return aS(Lo(e),t,n,i)}function lS(e,t,n,i){return aS(Po(e),t,n,i)}const ba=1e3,xa=ba*60,va=xa*60,zc=va*24,_T=zc*7,yb=zc*30,jh=zc*365,cS=[st,gt,Rt,Ht,Vt,on,An],Ea=cS.slice(0,-1),wa=Ea.slice(0,-1),Sa=wa.slice(0,-1),TT=Sa.slice(0,-1),NT=[st,We],bb=[st,gt],fS=[st],Zo=[[Ea,1,ba],[Ea,5,5*ba],[Ea,15,15*ba],[Ea,30,30*ba],[wa,1,xa],[wa,5,5*xa],[wa,15,15*xa],[wa,30,30*xa],[Sa,1,va],[Sa,3,3*va],[Sa,6,6*va],[Sa,12,12*va],[TT,1,zc],[NT,1,_T],[bb,1,yb],[bb,3,3*yb],[fS,1,jh]];function dS(e){const t=e.extent,n=e.maxbins||40,i=Math.abs(cu(t))/n;let r=gg(a=>a[2]).right(Zo,i),s,o;return r===Zo.length?(s=fS,o=Ua(t[0]/jh,t[1]/jh,n)):r?(r=Zo[i/Zo[r-1][2]t[n]||(t[n]=e(n))}function MT(e,t){return n=>{const i=e(n),r=i.indexOf(t);if(r<0)return i;let s=LT(i,r);const o=sr;)if(i[s]!=="0"){++s;break}return i.slice(0,s)+o}}function LT(e,t){let n=e.lastIndexOf("e"),i;if(n>0)return n;for(n=e.length;--n>t;)if(i=e.charCodeAt(n),i>=48&&i<=57)return n+1}function hS(e){const t=ka(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(i){const r=gb(i||",");if(r.precision==null){switch(r.precision=12,r.type){case"%":r.precision-=2;break;case"e":r.precision-=1;break}return MT(t(r),t(".1f")(1)[1])}else return t(r)},formatSpan(i,r,s,o){o=gb(o??",f");const a=Ua(i,r,s),u=Math.max(Math.abs(i),Math.abs(r));let l;if(o.precision==null)switch(o.type){case"s":return isNaN(l=p_(a,u))||(o.precision=l),n(o,u);case"":case"e":case"g":case"p":case"r":{isNaN(l=h_(a,u))||(o.precision=l-(o.type==="e"));break}case"f":case"%":{isNaN(l=d_(a))||(o.precision=l-(o.type==="%")*2);break}}return t(o)}}}let qh;pS();function pS(){return qh=hS({format:L_,formatPrefix:P_})}function gS(e){return hS(M_(e))}function Xl(e){return arguments.length?qh=gS(e):qh}function xb(e,t,n){n=n||{},U(n)||A(`Invalid time multi-format specifier: ${n}`);const i=t(on),r=t(Vt),s=t(Ht),o=t(Rt),a=t(We),u=t(gt),l=t(Dt),c=t(st),f=e(n[An]||".%L"),d=e(n[on]||":%S"),p=e(n[Vt]||"%I:%M"),h=e(n[Ht]||"%I %p"),g=e(n[Rt]||n[ft]||"%a %d"),m=e(n[We]||"%b %d"),y=e(n[gt]||"%B"),b=e(n[Dt]||"%B"),v=e(n[st]||"%Y");return w=>(i(w)j(i)?t(i):xb(t,Lo,i),utcFormat:i=>j(i)?n(i):xb(n,Po,i),timeParse:ka(e.parse),utcParse:ka(e.utcParse)}}let Wh;yS();function yS(){return Wh=mS({format:C_,parse:D_,utcFormat:F_,utcParse:O_})}function bS(e){return mS(A_(e))}function ja(e){return arguments.length?Wh=bS(e):Wh}const Gh=(e,t)=>re({},e,t);function xS(e,t){const n=e?gS(e):Xl(),i=t?bS(t):ja();return Gh(n,i)}function Tg(e,t){const n=arguments.length;return n&&n!==2&&A("defaultLocale expects either zero or two arguments."),n?Gh(Xl(e),ja(t)):Gh(Xl(),ja())}function PT(){return pS(),yS(),Tg()}const IT=/^(data:|([A-Za-z]+:)?\/\/)/,zT=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,BT=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,vb="file://";function UT(e){return t=>({options:t||{},sanitize:qT,load:jT,fileAccess:!1,file:WT(),http:HT})}async function jT(e,t){const n=await this.sanitize(e,t),i=n.href;return n.localFile?this.file(i):this.http(i,t?.http)}async function qT(e,t){t=re({},this.options,t);const n=this.fileAccess,i={href:null};let r,s,o;const a=zT.test(e.replace(BT,""));(e==null||typeof e!="string"||!a)&&A("Sanitize failure, invalid URI: "+L(e));const u=IT.test(e);return(o=t.baseURL)&&!u&&(!e.startsWith("/")&&!o.endsWith("/")&&(e="/"+e),e=o+e),s=(r=e.startsWith(vb))||t.mode==="file"||t.mode!=="http"&&!u&&n,r?e=e.slice(vb.length):e.startsWith("//")&&(t.defaultProtocol==="file"?(e=e.slice(2),s=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(i,"localFile",{value:!!s}),i.href=e,t.target&&(i.target=t.target+""),t.rel&&(i.rel=t.rel+""),t.context==="image"&&t.crossOrigin&&(i.crossOrigin=t.crossOrigin+""),i}function WT(e){return GT}async function GT(){A("No file system access.")}async function HT(e,t){const n=re({},this.options.http,t),i=t&&t.response,r=await fetch(e,n);return r.ok?ie(r[i])?r[i]():r.text():A(r.status+""+r.statusText)}const VT=e=>e!=null&&e===e,XT=e=>e==="true"||e==="false"||e===!0||e===!1,YT=e=>!Number.isNaN(Date.parse(e)),vS=e=>!Number.isNaN(+e)&&!(e instanceof Date),KT=e=>vS(e)&&Number.isInteger(+e),Hh={boolean:Cg,integer:dt,number:dt,date:Fg,string:Og,unknown:bt},Ku=[XT,KT,vS,YT],JT=["boolean","integer","number","date"];function ES(e,t){if(!e||!e.length)return"unknown";const n=e.length,i=Ku.length,r=Ku.map((s,o)=>o+1);for(let s=0,o=0,a,u;ss===0?o:s,0)-1]}function wS(e,t){return t.reduce((n,i)=>(n[i]=ES(e,i),n),{})}function Eb(e){const t=function(n,i){const r={delimiter:e};return Ng(n,i?re(i,r):r)};return t.responseType="text",t}function Ng(e,t){return t.header&&(e=t.header.map(L).join(t.delimiter)+` +`+e),I_(t.delimiter).parse(e+"")}Ng.responseType="text";function QT(e){return typeof Buffer=="function"&&ie(Buffer.isBuffer)?Buffer.isBuffer(e):!1}function Mg(e,t){const n=t&&t.property?rn(t.property):bt;return U(e)&&!QT(e)?ZT(n(e),t):n(JSON.parse(e))}Mg.responseType="json";function ZT(e,t){return!F(e)&&jw(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}const eN={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function SS(e,t){let n,i,r,s;return e=Mg(e,t),t&&t.feature?(n=WD,r=t.feature):t&&t.mesh?(n=GD,r=t.mesh,s=eN[t.filter]):A("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[r])?n(e,i,s):A("Invalid TopoJSON object: "+r),i&&i.features||[i]}SS.responseType="json";const wl={dsv:Ng,csv:Eb(","),tsv:Eb(" "),json:Mg,topojson:SS};function Lg(e,t){return arguments.length>1?(wl[e]=t,this):G(wl,e)?wl[e]:null}function kS(e){const t=Lg(e);return t&&t.responseType||"text"}function $S(e,t,n,i){t=t||{};const r=Lg(t.type||"json");return r||A("Unknown data format type: "+t.type),e=r(e,t),t.parse&&tN(e,t.parse,n,i),G(e,"columns")&&delete e.columns,e}function tN(e,t,n,i){if(!e.length)return;const r=ja();n=n||r.timeParse,i=i||r.utcParse;let s=e.columns||Object.keys(e[0]),o,a,u,l,c,f;t==="auto"&&(t=wS(e,s)),s=Object.keys(t);const d=s.map(p=>{const h=t[p];let g,m;if(h&&(h.startsWith("date:")||h.startsWith("utc:")))return g=h.split(/:(.+)?/,2),m=g[1],(m[0]==="'"&&m[m.length-1]==="'"||m[0]==='"'&&m[m.length-1]==='"')&&(m=m.slice(1,-1)),(g[0]==="utc"?i:n)(m);if(!Hh[h])throw Error("Illegal format pattern: "+p+":"+h);return Hh[h]});for(u=0,c=e.length,f=s.length;u{const s=t(r);return i[s]||(i[s]=1,n.push(r)),n},n.remove=r=>{const s=t(r);if(i[s]){i[s]=0;const o=n.indexOf(r);o>=0&&n.splice(o,1)}return n},n}async function Sl(e,t){try{await t(e)}catch(n){e.error(n)}}const AS=Symbol("vega_id");let nN=1;function jc(e){return!!(e&&Q(e))}function Q(e){return e[AS]}function CS(e,t){return e[AS]=t,e}function ge(e){const t=e===Object(e)?e:{data:e};return Q(t)?t:CS(t,nN++)}function Pg(e){return qc(e,ge({}))}function qc(e,t){for(const n in e)t[n]=e[n];return t}function FS(e,t){return CS(t,Q(e))}function xs(e,t){return e?t?(n,i)=>e(n,i)||Q(t(n))-Q(t(i)):(n,i)=>e(n,i)||Q(n)-Q(i):null}function OS(e){return e&&e.constructor===vs}function vs(){const e=[],t=[],n=[],i=[],r=[];let s=null,o=!1;return{constructor:vs,insert(a){const u=q(a),l=u.length;for(let c=0;c{h(b)&&(l[Q(b)]=-1)});for(f=0,d=e.length;f0&&(y(g,h,p.value),a.modifies(h));for(f=0,d=r.length;f{h(b)&&l[Q(b)]>0&&y(b,p.field,p.value)}),a.modifies(p.field);if(o)a.mod=t.length||i.length?u.filter(b=>l[Q(b)]>0):u.slice();else for(m in c)a.mod.push(c[m]);return(s||s==null&&(t.length||i.length))&&a.clean(!0),a}}}const kl="_:mod:_";function Wc(){Object.defineProperty(this,kl,{writable:!0,value:{}})}Wc.prototype={set(e,t,n,i){const r=this,s=r[e],o=r[kl];return t!=null&&t>=0?(s[t]!==n||i)&&(s[t]=n,o[t+":"+e]=-1,o[e]=-1):(s!==n||i)&&(r[e]=n,o[e]=F(n)?1+n.length:-1),r},modified(e,t){const n=this[kl];if(arguments.length){if(F(e)){for(let i=0;i=0?t+1{p instanceof we?(p!==this&&(t&&p.targets().add(this),s.push(p)),r.push({op:p,name:f,index:d})):i.set(f,d,p)};for(o in e)if(a=e[o],o===rN)q(a).forEach(f=>{f instanceof we?f!==this&&(f.targets().add(this),s.push(f)):A("Pulse parameters must be operator instances.")}),this.source=a;else if(F(a))for(i.set(o,-1,Array(u=a.length)),l=0;l{const n=Date.now();return n-t>e?(t=n,1):0})},debounce(e){const t=qi();return this.targets().add(qi(null,null,kg(e,n=>{const i=n.dataflow;t.receive(n),i&&i.run&&i.run()}))),t},between(e,t){let n=!1;return e.targets().add(qi(null,null,()=>n=!0)),t.targets().add(qi(null,null,()=>n=!1)),this.filter(()=>n)},detach(){this._filter=sn,this._targets=null}};function fN(e,t,n,i){const r=this,s=qi(n,i),o=function(l){l.dataflow=r;try{s.receive(l)}catch(c){r.error(c)}finally{r.run()}};let a;typeof e=="string"&&typeof document<"u"?a=document.querySelectorAll(e):a=q(e);const u=a.length;for(let l=0;lt=i);return n.requests=0,n.done=()=>{--n.requests===0&&(e._pending=null,t(e))},e._pending=n}const yN={skip:!0};function bN(e,t,n,i,r){return(e instanceof we?vN:xN)(this,e,t,n,i,r),this}function xN(e,t,n,i,r,s){const o=re({},s,yN);let a,u;ie(n)||(n=xt(n)),i===void 0?a=l=>e.touch(n(l)):ie(i)?(u=new we(null,i,r,!1),a=l=>{u.evaluate(l);const c=n(l),f=u.value;OS(f)?e.pulse(c,f,s):e.update(c,f,o)}):a=l=>e.update(n(l),i,o),t.apply(a)}function vN(e,t,n,i,r,s){if(i===void 0)t.targets().add(n);else{const o=s||{},a=new we(null,EN(n,i),r,!1);a.modified(o.force),a.rank=t.rank,t.targets().add(a),n&&(a.skip(!0),a.value=n.value,a.targets().add(n),e.connect(n,[a]))}}function EN(e,t){return t=ie(t)?t:xt(t),e?function(n,i){const r=t(n,i);return e.skip()||(e.skip(r!==this.value).value=r),r}:t}function wN(e){e.rank=++this._rank}function SN(e){const t=[e];let n,i,r;for(;t.length;)if(this.rank(n=t.pop()),i=n._targets)for(r=i.length;--r>=0;)t.push(n=i[r]),n===e&&A("Cycle detected in dataflow graph.")}const Yl={},Wn=1,Hi=2,xi=4,kN=Wn|Hi,Sb=Wn|xi,Ns=Wn|Hi|xi,kb=8,ea=16,$b=32,Ab=64;function sr(e,t,n){this.dataflow=e,this.stamp=t??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function kd(e,t){const n=[];return Gi(e,t,i=>n.push(i)),n}function Cb(e,t){const n={};return e.visit(t,i=>{n[Q(i)]=1}),i=>n[Q(i)]?null:i}function Ju(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}sr.prototype={StopPropagation:Yl,ADD:Wn,REM:Hi,MOD:xi,ADD_REM:kN,ADD_MOD:Sb,ALL:Ns,REFLOW:kb,SOURCE:ea,NO_SOURCE:$b,NO_FIELDS:Ab,fork(e){return new sr(this.dataflow).init(this,e)},clone(){const e=this.fork(Ns);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(Ns|ea)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new sr(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){const n=this;return n.stamp=e.stamp,n.encode=e.encode,e.fields&&!(t&Ab)&&(n.fields=e.fields),t&Wn?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),t&Hi?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),t&xi?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),t&$b?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||Ns;return t&Wn&&this.add.length||t&Hi&&this.rem.length||t&xi&&this.mod.length},reflow(e){if(e)return this.fork(Ns).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(xi,Cb(this,Wn))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return F(e)?e.forEach(n=>t[n]=!0):t[e]=!0,this},modified(e,t){const n=this.fields;return(t||this.mod.length)&&n?arguments.length?F(e)?e.some(i=>n[i]):n[e]:!!n:!1},filter(e,t){const n=this;return e&Wn&&(n.addF=Ju(n.addF,t)),e&Hi&&(n.remF=Ju(n.remF,t)),e&xi&&(n.modF=Ju(n.modF,t)),e&ea&&(n.srcF=Ju(n.srcF,t)),n},materialize(e){e=e||Ns;const t=this;return e&Wn&&t.addF&&(t.add=kd(t.add,t.addF),t.addF=null),e&Hi&&t.remF&&(t.rem=kd(t.rem,t.remF),t.remF=null),e&xi&&t.modF&&(t.mod=kd(t.mod,t.modF),t.modF=null),e&ea&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,i=t;if(e&ea)return Gi(n.source,n.srcF,i),n;e&Wn&&Gi(n.add,n.addF,i),e&Hi&&Gi(n.rem,n.remF,i),e&xi&&Gi(n.mod,n.modF,i);const r=n.source;if(e&kb&&r){const s=n.add.length+n.mod.length;s===r.length||(s?Gi(r,Cb(n,Sb),i):Gi(r,n.srcF,i))}return n}};function Ig(e,t,n,i){const r=this;let s=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=i||null,this.pulses=n;for(const o of n)if(o.stamp===t){if(o.fields){const a=r.fields||(r.fields={});for(const u in o.fields)a[u]=1}o.changed(r.ADD)&&(s|=r.ADD),o.changed(r.REM)&&(s|=r.REM),o.changed(r.MOD)&&(s|=r.MOD)}this.changes=s}z(Ig,sr,{fork(e){const t=new sr(this.dataflow).init(this,e&this.NO_FIELDS);return e!==void 0&&(e&t.ADD&&this.visit(t.ADD,n=>t.add.push(n)),e&t.REM&&this.visit(t.REM,n=>t.rem.push(n)),e&t.MOD&&this.visit(t.MOD,n=>t.mod.push(n))),t},changed(e){return this.changes&e},modified(e){const t=this,n=t.fields;return n&&t.changes&t.MOD?F(e)?e.some(i=>n[i]):n[e]:0},filter(){A("MultiPulse does not support filtering.")},materialize(){A("MultiPulse does not support materialization.")},visit(e,t){const n=this,i=n.pulses,r=i.length;let s=0;if(e&n.SOURCE)for(;si._enqueue(c,!0)),i._touched=Uc(lu);let o=0,a,u,l;try{for(;i._heap.size()>0;){if(a=i._heap.pop(),a.rank!==a.qrank){i._enqueue(a,!0);continue}u=a.run(i._getPulse(a,e)),u.then?u=await u:u.async&&(r.push(u.async),u=Yl),u!==Yl&&a._targets&&a._targets.forEach(c=>i._enqueue(c)),++o}}catch(c){i._heap.clear(),l=c}if(i._input={},i._pulse=null,i.debug(`Pulse ${s}: ${o} operators`),l&&(i._postrun=[],i.error(l)),i._postrun.length){const c=i._postrun.sort((f,d)=>d.priority-f.priority);i._postrun=[];for(let f=0;fi.runAsync(null,()=>{c.forEach(f=>{try{f(i)}catch(d){i.error(d)}})})),i}async function AN(e,t,n){for(;this._running;)await this._running;const i=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(i,i),this._running}function CN(e,t,n){return this._pulse?DS(this):(this.evaluate(e,t,n),this)}function FN(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(i){this.error(i)}}function DS(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}function ON(e,t){const n=e.stampr.pulse),t):this._input[e.id]||RN(this._pulse,n&&n.pulse)}function RN(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==Yl&&(e.source=t.source),e)}const zg={skip:!1,force:!1};function _N(e,t){const n=t||zg;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this}function TN(e,t,n){const i=n||zg;return(e.set(t)||i.force)&&this.touch(e,i),this}function NN(e,t,n){this.touch(e,n||zg);const i=new sr(this,this._clock+(this._pulse?0:1)),r=e.pulse&&e.pulse.source||[];return i.target=e,this._input[e.id]=t.pulse(i,r),this}function MN(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),RS(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let i;return t.length?(i=t[0],t[0]=n,LN(t,0,e)):i=n,i}}}function RS(e,t,n,i){let r,s;const o=e[n];for(;n>t;){if(s=n-1>>1,r=e[s],i(o,r)<0){e[n]=r,n=s;continue}break}return e[n]=o}function LN(e,t,n){const i=t,r=e.length,s=e[t];let o=(t<<1)+1,a;for(;o=0&&(o=a),e[t]=e[o],t=o,o=(t<<1)+1;return e[t]=s,RS(e,i,t,n)}function Ks(){this.logger(Lc()),this.logLevel(bg),this._clock=0,this._rank=0,this._locale=Tg();try{this._loader=Bc()}catch{}this._touched=Uc(lu),this._input={},this._pulse=null,this._heap=MN((e,t)=>e.qrank-t.qrank),this._postrun=[]}function ta(e){return function(){return this._log[e].apply(this,arguments)}}Ks.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:ta("error"),warn:ta("warn"),info:ta("info"),debug:ta("debug"),logLevel:ta("level"),cleanThreshold:1e4,add:uN,connect:lN,rank:wN,rerank:SN,pulse:NN,touch:_N,update:TN,changeset:vs,ingest:hN,parse:dN,preload:gN,request:pN,events:fN,on:bN,evaluate:$N,run:CN,runAsync:AN,runAfter:FN,_enqueue:ON,_getPulse:DN};function $(e,t){we.call(this,e,null,t)}z($,we,{run(e){if(e.stampthis.pulse=n):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});const ro={};function _S(e){const t=TS(e);return t&&t.Definition||null}function TS(e){return e=e&&e.toLowerCase(),G(ro,e)?ro[e]:null}function*NS(e,t){if(t==null)for(let n of e)n!=null&&n!==""&&(n=+n)>=n&&(yield n);else{let n=-1;for(let i of e)i=t(i,++n,e),i!=null&&i!==""&&(i=+i)>=i&&(yield i)}}function Bg(e,t,n){const i=Float64Array.from(NS(e,n));return i.sort(xw),t.map(r=>VD(i,r))}function Ug(e,t){return Bg(e,[.25,.5,.75],t)}function jg(e,t){const n=e.length,i=HD(e,t),r=Ug(e,t),s=(r[2]-r[0])/1.34;return 1.06*(Math.min(i,s)||i||Math.abs(r[0])||1)*Math.pow(n,-.2)}function MS(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let s=e.extent[0],o=e.extent[1],a,u,l,c,f,d;const p=e.span||o-s||Math.abs(s)||1;if(e.step)a=e.step;else if(e.steps){for(c=p/t,f=0,d=e.steps.length;ft;)a*=n;for(f=0,d=r.length;f=l&&p/c<=t&&(a=c)}c=Math.log(a);const h=c>=0?0:~~(-c/i)+1,g=Math.pow(n,-h-1);return(e.nice||e.nice===void 0)&&(c=Math.floor(s/a+g)*a,s=sd);const r=e.length,s=new Float64Array(r);let o=0,a=1,u=i(e[0]),l=u,c=u+t,f;for(;a=c){for(l=(u+l)/2;o>1);or;)e[o--]=e[i]}i=r,r=s}return e}function zN(e){return function(){return e=(1103515245*e+12345)%2147483647,e/2147483647}}function BN(e,t){t==null&&(t=e,e=0);let n,i,r;const s={min(o){return arguments.length?(n=o||0,r=i-n,s):n},max(o){return arguments.length?(i=o||0,r=i-n,s):i},sample(){return n+Math.floor(r*an())},pdf(o){return o===Math.floor(o)&&o>=n&&o=i?1:(a-n+1)/r},icdf(o){return o>=0&&o<=1?n-1+Math.floor(o*r):NaN}};return s.min(e).max(t)}const IS=Math.sqrt(2*Math.PI),UN=Math.SQRT2;let na=NaN;function Hc(e,t){e=e||0,t=t??1;let n=0,i=0,r,s;if(na===na)n=na,na=NaN;else{do n=an()*2-1,i=an()*2-1,r=n*n+i*i;while(r===0||r>1);s=Math.sqrt(-2*Math.log(r)/r),n*=s,na=i*s}return e+n*t}function qg(e,t,n){n=n??1;const i=(e-(t||0))/n;return Math.exp(-.5*i*i)/(n*IS)}function Vc(e,t,n){t=t||0,n=n??1;const i=(e-t)/n,r=Math.abs(i);let s;if(r>37)s=0;else{const o=Math.exp(-r*r/2);let a;r<7.07106781186547?(a=.0352624965998911*r+.700383064443688,a=a*r+6.37396220353165,a=a*r+33.912866078383,a=a*r+112.079291497871,a=a*r+221.213596169931,a=a*r+220.206867912376,s=o*a,a=.0883883476483184*r+1.75566716318264,a=a*r+16.064177579207,a=a*r+86.7807322029461,a=a*r+296.564248779674,a=a*r+637.333633378831,a=a*r+793.826512519948,a=a*r+440.413735824752,s=s/a):(a=r+.65,a=r+4/a,a=r+3/a,a=r+2/a,a=r+1/a,s=o/a/2.506628274631)}return i>0?1-s:s}function Xc(e,t,n){return e<0||e>1?NaN:(t||0)+(n??1)*UN*jN(2*e-1)}function jN(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=10512122733215323e-25+n*t,n=-4112633980346984e-24+n*t,n=-29070369957882005e-24+n*t,n=42347877827932404e-23+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=22137376921775787e-25,n=9075656193888539e-23+n*t,n=-27517406297064545e-23+n*t,n=18239629214389228e-24+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=15076572693500548e-25+n*t,n=-3789465440126737e-24+n*t,n=761570120807834e-23+n*t,n=-1496002662714924e-23+n*t,n=2914795345090108e-23+n*t,n=-6771199775845234e-23+n*t,n=22900482228026655e-23+n*t,n=-99298272942317e-20+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}function Wg(e,t){let n,i;const r={mean(s){return arguments.length?(n=s||0,r):n},stdev(s){return arguments.length?(i=s??1,r):i},sample:()=>Hc(n,i),pdf:s=>qg(s,n,i),cdf:s=>Vc(s,n,i),icdf:s=>Xc(s,n,i)};return r.mean(e).stdev(t)}function Gg(e,t){const n=Wg();let i=0;const r={data(s){return arguments.length?(e=s,i=s?s.length:0,r.bandwidth(t)):e},bandwidth(s){return arguments.length?(t=s,!t&&e&&(t=jg(e)),r):t},sample(){return e[~~(an()*i)]+t*n.sample()},pdf(s){let o=0,a=0;for(;aHg(n,i),pdf:s=>Vg(s,n,i),cdf:s=>Xg(s,n,i),icdf:s=>Yg(s,n,i)};return r.mean(e).stdev(t)}function BS(e,t){let n=0,i;function r(o){const a=[];let u=0,l;for(l=0;l=t&&e<=n?1/(n-t):0}function Qg(e,t,n){return n==null&&(n=t??1,t=0),en?1:(e-t)/(n-t)}function Zg(e,t,n){return n==null&&(n=t??1,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function US(e,t){let n,i;const r={min(s){return arguments.length?(n=s||0,r):n},max(s){return arguments.length?(i=s??1,r):i},sample:()=>Kg(n,i),pdf:s=>Jg(s,n,i),cdf:s=>Qg(s,n,i),icdf:s=>Zg(s,n,i)};return t==null&&(t=e??1,e=0),r.min(e).max(t)}function em(e,t,n){let i=0,r=0;for(const s of e){const o=n(s);t(s)==null||o==null||isNaN(o)||(i+=(o-i)/++r)}return{coef:[i],predict:()=>i,rSquared:0}}function fu(e,t,n,i){const r=i-e*e,s=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-s*e,s]}function Yc(e,t,n,i){e=e.filter(p=>{let h=t(p),g=n(p);return h!=null&&(h=+h)>=h&&g!=null&&(g=+g)>=g}),i&&e.sort((p,h)=>t(p)-t(h));const r=e.length,s=new Float64Array(r),o=new Float64Array(r);let a=0,u=0,l=0,c,f,d;for(d of e)s[a]=c=+t(d),o[a]=f=+n(d),++a,u+=(c-u)/a,l+=(f-l)/a;for(a=0;a=s&&o!=null&&(o=+o)>=o&&i(s,o,++r)}function Io(e,t,n,i,r){let s=0,o=0;return du(e,t,n,(a,u)=>{const l=u-r(a),c=u-i;s+=l*l,o+=c*c}),1-s/o}function tm(e,t,n){let i=0,r=0,s=0,o=0,a=0;du(e,t,n,(c,f)=>{++a,i+=(c-i)/a,r+=(f-r)/a,s+=(c*f-s)/a,o+=(c*c-o)/a});const u=fu(i,r,s,o),l=c=>u[0]+u[1]*c;return{coef:u,predict:l,rSquared:Io(e,t,n,r,l)}}function jS(e,t,n){let i=0,r=0,s=0,o=0,a=0;du(e,t,n,(c,f)=>{++a,c=Math.log(c),i+=(c-i)/a,r+=(f-r)/a,s+=(c*f-s)/a,o+=(c*c-o)/a});const u=fu(i,r,s,o),l=c=>u[0]+u[1]*Math.log(c);return{coef:u,predict:l,rSquared:Io(e,t,n,r,l)}}function qS(e,t,n){const[i,r,s,o]=Yc(e,t,n);let a=0,u=0,l=0,c=0,f=0,d,p,h;du(e,t,n,(b,v)=>{d=i[f++],p=Math.log(v),h=d*v,a+=(v*p-a)/f,u+=(h-u)/f,l+=(h*p-l)/f,c+=(d*h-c)/f});const[g,m]=fu(u/o,a/o,l/o,c/o),y=b=>Math.exp(g+m*(b-s));return{coef:[Math.exp(g-m*s),m],predict:y,rSquared:Io(e,t,n,o,y)}}function WS(e,t,n){let i=0,r=0,s=0,o=0,a=0,u=0;du(e,t,n,(f,d)=>{const p=Math.log(f),h=Math.log(d);++u,i+=(p-i)/u,r+=(h-r)/u,s+=(p*h-s)/u,o+=(p*p-o)/u,a+=(d-a)/u});const l=fu(i,r,s,o),c=f=>l[0]*Math.pow(f,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Io(e,t,n,a,c)}}function nm(e,t,n){const[i,r,s,o]=Yc(e,t,n),a=i.length;let u=0,l=0,c=0,f=0,d=0,p,h,g,m;for(p=0;p(x=x-s,v*x*x+w*x+E+o);return{coef:[E-w*s+v*s*s+o,w-2*v*s,v],predict:S,rSquared:Io(e,t,n,o,S)}}function GS(e,t,n,i){if(i===0)return em(e,t,n);if(i===1)return tm(e,t,n);if(i===2)return nm(e,t,n);const[r,s,o,a]=Yc(e,t,n),u=r.length,l=[],c=[],f=i+1;let d,p,h,g,m;for(d=0;d{v-=o;let w=a+y[0]+y[1]*v+y[2]*v*v;for(d=3;d=0;--s)for(a=t[s],u=1,r[s]+=a,o=1;o<=s;++o)u*=(s+1-o)/o,r[s-o]+=a*Math.pow(n,o)*u;return r[0]+=i,r}function WN(e){const t=e.length-1,n=[];let i,r,s,o,a;for(i=0;iMath.abs(e[i][o])&&(o=r);for(s=i;s=i;s--)e[s][r]-=e[s][i]*e[i][r]/e[i][i]}for(r=t-1;r>=0;--r){for(a=0,s=r+1;sr[v]-y?b:v;let E=0,S=0,x=0,k=0,D=0;const P=1/Math.abs(r[w]-y||1);for(let ce=b;ce<=v;++ce){const T=r[ce],O=s[ce],I=GN(Math.abs(y-T)*P)*d[ce],W=T*I;E+=I,S+=W,x+=O*I,k+=O*W,D+=T*W}const[K,ee]=fu(S/E,x/E,k/E,D/E);c[m]=K+ee*y,f[m]=Math.abs(s[m]-c[m]),HN(r,m+1,h)}if(p===Fb)break;const g=pw(f);if(Math.abs(g)=1?Ob:(b=1-y*y)*b}return VN(r,c,o,a)}function GN(e){return(e=1-e*e*e)*e*e}function HN(e,t,n){const i=e[t];let r=n[0],s=n[1]+1;if(!(s>=e.length))for(;t>r&&e[s]-i<=i-e[r];)n[0]=++r,n[1]=s,++s}function VN(e,t,n,i){const r=e.length,s=[];let o=0,a=0,u=[],l;for(;o[g,e(g)],s=t[0],o=t[1],a=o-s,u=a/i,l=[r(s)],c=[];if(n===i){for(let g=1;g0;)c.push(r(s+g/n*a))}let f=l[0],d=c[c.length-1];const p=1/a,h=YN(f[1],c);for(;d;){const g=r((f[0]+d[0])/2);g[0]-f[0]>=u&&KN(f,g,d,p,h)>XN?c.push(g):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l}function YN(e,t){let n=e,i=e;const r=t.length;for(let s=0;si&&(i=o)}return 1/(i-n)}function KN(e,t,n,i,r){const s=Math.atan2(r*(n[1]-e[1]),i*(n[0]-e[0])),o=Math.atan2(r*(t[1]-e[1]),i*(t[0]-e[0]));return Math.abs(s-o)}function JN(e){return t=>{const n=e.length;let i=1,r=String(e[0](t));for(;i{},QN={init:$d,add:$d,rem:$d,idx:0},qa={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.valid?e.sum:void 0,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||e.max===void 0)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:["exponential"],idx:1}},hu=Object.keys(qa).filter(e=>e!=="__count__");function ZN(e,t){return(n,i)=>re({name:e,aggregate_param:i,out:n||e},QN,t)}[...hu,"__count__"].forEach(e=>{qa[e]=ZN(e,qa[e])});function XS(e,t,n){return qa[e](n,t)}function YS(e,t){return e.idx-t.idx}function eM(e){const t={};e.forEach(i=>t[i.name]=i);const n=i=>{i.req&&i.req.forEach(r=>{t[r]||n(t[r]=qa[r]())})};return e.forEach(n),Object.values(t).sort(YS)}function tM(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.aggregate_param==null?e.init(this):e.init(this,e.aggregate_param))}function nM(e,t){if(e==null||e===""){++this.missing;return}e===e&&(++this.valid,this._ops.forEach(n=>n.add(this,e,t)))}function iM(e,t){if(e==null||e===""){--this.missing;return}e===e&&(--this.valid,this._ops.forEach(n=>n.rem(this,e,t)))}function rM(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function KS(e,t){const n=t||bt,i=eM(e),r=e.slice().sort(YS);function s(o){this._ops=i,this._out=r,this.cell=o,this.init()}return s.prototype.init=tM,s.prototype.add=nM,s.prototype.rem=iM,s.prototype.set=rM,s.prototype.get=n,s.fields=e.map(o=>o.out),s}function im(e){this._key=e?rn(e):Q,this.reset()}const at=im.prototype;at.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null};at.add=function(e){this._add.push(e)};at.rem=function(e){this._rem.push(e)};at.values=function(){if(this._get=null,this._rem.length===0)return this._add;const e=this._add,t=this._rem,n=this._key,i=e.length,r=t.length,s=Array(i-r),o={};let a,u,l;for(a=0;a=0;)s=e(t[i])+"",G(n,s)||(n[s]=1,++r);return r};at.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=Bw(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext};at.argmin=function(e){return this.extent(e)[0]||{}};at.argmax=function(e){return this.extent(e)[1]||{}};at.min=function(e){const t=this.extent(e)[0];return t!=null?e(t):void 0};at.max=function(e){const t=this.extent(e)[1];return t!=null?e(t):void 0};at.quartile=function(e){return(this._get!==e||!this._q)&&(this._q=Ug(this.values(),e),this._get=e),this._q};at.q1=function(e){return this.quartile(e)[0]};at.q2=function(e){return this.quartile(e)[1]};at.q3=function(e){return this.quartile(e)[2]};at.ci=function(e){return(this._get!==e||!this._ci)&&(this._ci=LS(this.values(),1e3,.05,e),this._get=e),this._ci};at.ci0=function(e){return this.ci(e)[0]};at.ci1=function(e){return this.ci(e)[1]};function lr(e){$.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}lr.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:hu},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};z(lr,$,{transform(e,t){const n=this,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.modified();return n.stamp=i.stamp,n.value&&(r||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=r?n.init(e):Object.create(null),t.visit(t.SOURCE,s=>n.add(s))):(n.value=n.value||n.init(e),t.visit(t.REM,s=>n.rem(s)),t.visit(t.ADD,s=>n.add(s))),i.modifies(n._outputs),n._drop=e.drop!==!1,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&i.clean(!0).runAfter(()=>this.clean()),n.changes(i)},cross(){const e=this,t=e.value,n=e._dnames,i=n.map(()=>({})),r=n.length;function s(a){let u,l,c,f;for(u in a)for(c=a[u].tuple,l=0;l{const v=Me(b);return r(b),n.push(v),v}),this.cellkey=e.key?e.key:Vh(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const s=e.fields||[null],o=e.ops||["count"],a=e.aggregate_params||[null],u=e.as||[],l=s.length,c={};let f,d,p,h,g,m,y;for(l!==o.length&&A("Unmatched number of fields and aggregate ops."),y=0;yKS(b,b.field)),Object.create(null)},cellkey:Vh(),cell(e,t){let n=this.value[e];return n?n.num===0&&this._drop&&n.stamp{const f=i(c);c[a]=f,c[u]=f==null?null:r+s*(1+(f-r)/s)}:c=>c[a]=i(c)),t.modifies(n?o:a)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=MS(e),i=n.step;let r=n.start,s=r+Math.ceil((n.stop-r)/i)*i,o,a;(o=e.anchor)!=null&&(a=o-(r+i*Math.floor((o-r)/i)),r+=a,s+=a);const u=function(l){let c=dt(t(l));return c==null?null:cs?1/0:(c=Math.max(r,Math.min(c,s-i)),r+i*Math.floor(sM+(c-r)/i))};return u.start=r,u.stop=n.stop,u.step=i,this.value=Mt(u,pt(t),e.name||"bin_"+Me(t))}});function JS(e,t,n){const i=e;let r=t||[],s=n||[],o={},a=0;return{add:u=>s.push(u),remove:u=>o[i(u)]=++a,size:()=>r.length,data:(u,l)=>(a&&(r=r.filter(c=>!o[i(c)]),o={},a=0),l&&u&&r.sort(u),s.length&&(r=u?Gw(u,r,s.sort(u)):r.concat(s),s=[]),r)}}function sm(e){$.call(this,[],e)}sm.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]};z(sm,$,{transform(e,t){const n=t.fork(t.ALL),i=JS(Q,this.value,n.materialize(n.ADD).add),r=e.sort,s=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return n.visit(n.REM,i.remove),this.modified(s),this.value=n.source=i.data(xs(r),s),t.source&&t.source.root&&(this.value.root=t.source.root),n}});function QS(e){we.call(this,null,oM,e)}z(QS,we);function oM(e){return this.value&&!e.modified()?this.value:Sg(e.fields,e.orders)}function om(e){$.call(this,null,e)}om.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};function aM(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase();break}return e.match(n)}z(om,$,{transform(e,t){const n=f=>d=>{for(var p=aM(a(d),e.case,s)||[],h,g=0,m=p.length;gr[f]=1+(r[f]||0)),c=n(f=>r[f]-=1);return i?t.visit(t.SOURCE,l):(t.visit(t.ADD,l),t.visit(t.REM,c)),this._finish(t,u)},_parameterCheck(e,t){let n=!1;return(e.modified("stopwords")||!this._stop)&&(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),(e.modified("pattern")||!this._match)&&(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){const n=this._counts,i=this._tuples||(this._tuples={}),r=t[0],s=t[1],o=e.fork(e.NO_SOURCE|e.NO_FIELDS);let a,u,l;for(a in n)u=i[a],l=n[a]||0,!u&&l?(i[a]=u=ge({}),u[r]=a,u[s]=l,o.add.push(u)):l===0?(u&&o.rem.push(u),n[a]=null,i[a]=null):u[s]!==l&&(u[s]=l,o.mod.push(u));return o.modifies(t)}});function am(e){$.call(this,null,e)}am.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]};z(am,$,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.as||["a","b"],r=i[0],s=i[1],o=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let a=this.value;return o?(a&&(n.rem=a),a=t.materialize(t.SOURCE).source,n.add=this.value=uM(a,r,s,e.filter||sn)):n.mod=a,n.source=this.value,n.modifies(i)}});function uM(e,t,n,i){for(var r=[],s={},o=e.length,a=0,u,l;aZS(s,t))):typeof i[r]===Rb&&i[r](e[r]);return i}function um(e){$.call(this,null,e)}const e2=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],fM={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:e2},{name:"weights",type:"number",array:!0}]};um.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:e2.concat(fM)},{name:"as",type:"string",array:!0,default:["value","density"]}]};z(um,$,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=ZS(e.distribution,dM(t)),r=e.steps||e.minsteps||25,s=e.steps||e.maxsteps||200;let o=e.method||"pdf";o!=="pdf"&&o!=="cdf"&&A("Invalid density method: "+o),!e.extent&&!i.data&&A("Missing density extent parameter."),o=i[o];const a=e.as||["value","density"],u=e.extent||Zn(i.data()),l=Kc(o,u,r,s).map(c=>{const f={};return f[a[0]]=c[0],f[a[1]]=c[1],ge(f)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function dM(e){return()=>e.materialize(e.SOURCE).source}function t2(e,t){return e?e.map((n,i)=>t[i]||Me(n)):null}function lm(e,t,n){const i=[],r=f=>f(u);let s,o,a,u,l,c;if(t==null)i.push(e.map(n));else for(s={},o=0,a=e.length;ocu(Zn(e,t))/30;z(cm,$,{transform(e,t){if(this.value&&!(e.modified()||t.changed()))return t;const n=t.materialize(t.SOURCE).source,i=lm(t.source,e.groupby,bt),r=e.smooth||!1,s=e.field,o=e.step||hM(n,s),a=xs((h,g)=>s(h)-s(g)),u=e.as||n2,l=i.length;let c=1/0,f=-1/0,d=0,p;for(;df&&(f=g),h[++p][u]=g}return this.value={start:c,stop:f,step:o},t.reflow(!0).modifies(u)}});function i2(e){we.call(this,null,pM,e),this.modified(!0)}z(i2,we);function pM(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:Mt(n=>t(n,e),pt(t),Me(t))}function fm(e){$.call(this,[void 0,void 0],e)}fm.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]};z(fm,$,{transform(e,t){const n=this.value,i=e.field,r=t.changed()||t.modified(i.fields)||e.modified("field");let s=n[0],o=n[1];if((r||s==null)&&(s=1/0,o=-1/0),t.visit(r?t.SOURCE:t.ADD,a=>{const u=dt(i(a));u!=null&&(uo&&(o=u))}),!Number.isFinite(s)||!Number.isFinite(o)){let a=Me(i);a&&(a=` for field "${a}"`),t.dataflow.warn(`Infinite extent${a}: [${s}, ${o}]`),s=o=void 0}this.value=[s,o]}});function dm(e,t){we.call(this,e),this.parent=t,this.count=0}z(dm,we,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}});function Jc(e){$.call(this,{},e),this._keys=Mo();const t=this._targets=[];t.active=0,t.forEach=n=>{for(let i=0,r=t.active;ii&&i.count>0);this.initTargets(n)}},initTargets(e){const t=this._targets,n=t.length,i=e?e.length:0;let r=0;for(;rthis.subflow(u,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,u=>{const l=Q(u),c=s.get(l);c!==void 0&&(s.delete(l),a(c).rem(u))}),t.visit(t.ADD,u=>{const l=i(u);s.set(Q(u),l),a(l).add(u)}),o||t.modified(i.fields)?t.visit(t.MOD,u=>{const l=Q(u),c=s.get(l),f=i(u);c===f?a(f).mod(u):(s.set(l,f),a(c).rem(u),a(f).add(u))}):t.changed(t.MOD)&&t.visit(t.MOD,u=>{a(s.get(Q(u))).mod(u)}),o&&t.visit(t.REFLOW,u=>{const l=Q(u),c=s.get(l),f=i(u);c!==f&&(s.set(l,f),a(c).rem(u),a(f).add(u))}),t.clean()?n.runAfter(()=>{this.clean(),s.clean()}):s.empty>n.cleanThreshold&&n.runAfter(s.clean),t}});function r2(e){we.call(this,null,gM,e)}z(r2,we);function gM(e){return this.value&&!e.modified()?this.value:F(e.name)?q(e.name).map(t=>rn(t)):rn(e.name,e.as)}function hm(e){$.call(this,Mo(),e)}hm.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]};z(hm,$,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),s=r.add,o=r.rem,a=r.mod,u=e.expr;let l=!0;t.visit(t.REM,f=>{const d=Q(f);i.has(d)?i.delete(d):o.push(f)}),t.visit(t.ADD,f=>{u(f,e)?s.push(f):i.set(Q(f),1)});function c(f){const d=Q(f),p=u(f,e),h=i.get(d);p&&h?(i.delete(d),s.push(f)):!p&&!h?(i.set(d,1),o.push(f)):l&&p&&!h&&a.push(f)}return t.visit(t.MOD,c),e.modified()&&(l=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}});function pm(e){$.call(this,[],e)}pm.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]};z(pm,$,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=t2(i,e.as||[]),s=e.index||null,o=r.length;return n.rem=this.value,t.visit(t.SOURCE,a=>{const u=i.map(h=>h(a)),l=u.reduce((h,g)=>Math.max(h,g.length),0);let c=0,f,d,p;for(;c{for(let c=0,f;co[i]=n(o,e))}});function s2(e){$.call(this,[],e)}z(s2,$,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r=this.value,s=e.size-r.length,o,a,u;if(s>0){for(o=[];--s>=0;)o.push(u=ge(i(e))),r.push(u);n.add=n.add.length?n.materialize(n.ADD).add.concat(o):o}else a=r.slice(0,-s),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(a):a,r=r.slice(-s);return n.source=this.value=r,n}});const Qu={value:"value",median:pw,mean:XD,min:R_,max:Ra},mM=[];function ym(e){$.call(this,[],e)}ym.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]};function yM(e){var t=e.method||Qu.value,n;if(Qu[t]==null)A("Unrecognized imputation method: "+t);else return t===Qu.value?(n=e.value!==void 0?e.value:0,()=>n):Qu[t]}function bM(e){const t=e.field;return n=>n?t(n):NaN}z(ym,$,{transform(e,t){var n=t.fork(t.ALL),i=yM(e),r=bM(e),s=Me(e.field),o=Me(e.key),a=(e.groupby||[]).map(Me),u=xM(t.source,e.groupby,e.key,e.keyvals),l=[],c=this.value,f=u.domain.length,d,p,h,g,m,y,b,v,w,E;for(m=0,v=u.length;my(m),s=[],o=i?i.slice():[],a={},u={},l,c,f,d,p,h,g,m;for(o.forEach((y,b)=>a[y]=b+1),d=0,g=e.length;dn.add(s))):(r=n.value=n.value||this.init(e),t.visit(t.REM,s=>n.rem(s)),t.visit(t.ADD,s=>n.add(s))),n.changes(),t.visit(t.SOURCE,s=>{re(s,r[n.cellkey(s)].tuple)}),t.reflow(i).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let n,i;for(n=0,i=this._alen;n{const h=Gg(p,o)[a],g=e.counts?p.length:1,m=c||Zn(p);Kc(h,m,f,d).forEach(y=>{const b={};for(let v=0;v(this._pending=q(r.data),s=>s.touch(this)))}:n.request(e.url,e.format).then(i=>Ad(this,t,q(i.data)))}});function EM(e){return e.modified("async")&&!(e.modified("values")||e.modified("url")||e.modified("format"))}function Ad(e,t,n){n.forEach(ge);const i=t.fork(t.NO_FIELDS&t.NO_SOURCE);return i.rem=e.value,e.value=i.source=i.add=n,e._pending=null,i.rem.length&&i.clean(!0),i}function vm(e){$.call(this,{},e)}vm.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]};z(vm,$,{transform(e,t){const n=e.fields,i=e.index,r=e.values,s=e.default==null?null:e.default,o=e.modified(),a=n.length;let u=o?t.SOURCE:t.ADD,l=t,c=e.as,f,d,p;return r?(d=r.length,a>1&&!c&&A('Multi-field lookup requires explicit "as" parameter.'),c&&c.length!==a*d&&A('The "as" parameter has too few output field names.'),c=c||r.map(Me),f=function(h){for(var g=0,m=0,y,b;gt.modified(h.fields)),u|=p?t.MOD:0),t.visit(u,f),l.modifies(c)}});function u2(e){we.call(this,null,wM,e)}z(u2,we);function wM(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let i=1/0,r=-1/0,s,o;for(s=0;sr&&(r=o[1]);return[i,r]}function l2(e){we.call(this,null,SM,e)}z(l2,we);function SM(e){return this.value&&!e.modified()?this.value:e.values.reduce((t,n)=>t.concat(n),[])}function c2(e){$.call(this,null,e)}z(c2,$,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function Em(e){lr.call(this,e)}Em.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:hu,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]};z(Em,lr,{_transform:lr.prototype.transform,transform(e,t){return this._transform(kM(e,t),t)}});function kM(e,t){const n=e.field,i=e.value,r=(e.op==="count"?"__count__":e.op)||"sum",s=pt(n).concat(pt(i)),o=AM(n,e.limit||0,t);return t.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:o.map(()=>r),fields:o.map(a=>$M(a,n,i,s)),as:o.map(a=>a+""),modified:e.modified.bind(e)}}function $M(e,t,n,i){return Mt(r=>t(r)===e?n(r):NaN,i,e+"")}function AM(e,t,n){const i={},r=[];return n.visit(n.SOURCE,s=>{const o=e(s);i[o]||(i[o]=1,r.push(o))}),r.sort(No),t?r.slice(0,t):r}function f2(e){Jc.call(this,e)}z(f2,Jc,{transform(e,t){const n=e.subflow,i=e.field,r=s=>this.subflow(Q(s),n,t,s);return(e.modified("field")||i&&t.modified(pt(i)))&&A("PreFacet does not support field modification."),this.initTargets(),i?(t.visit(t.MOD,s=>{const o=r(s);i(s).forEach(a=>o.mod(a))}),t.visit(t.ADD,s=>{const o=r(s);i(s).forEach(a=>o.add(ge(a)))}),t.visit(t.REM,s=>{const o=r(s);i(s).forEach(a=>o.rem(a))})):(t.visit(t.MOD,s=>r(s).mod(s)),t.visit(t.ADD,s=>r(s).add(s)),t.visit(t.REM,s=>r(s).rem(s))),t.clean()&&t.runAfter(()=>this.clean()),t}});function wm(e){$.call(this,null,e)}wm.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]};z(wm,$,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=t2(e.fields,e.as||[]),s=i?(a,u)=>CM(a,u,i,r):qc;let o;return this.value?o=this.value:(t=t.addAll(),o=this.value={}),t.visit(t.REM,a=>{const u=Q(a);n.rem.push(o[u]),o[u]=null}),t.visit(t.ADD,a=>{const u=s(a,ge({}));o[Q(a)]=u,n.add.push(u)}),t.visit(t.MOD,a=>{n.mod.push(s(a,o[Q(a)]))}),n}});function CM(e,t,n,i){for(let r=0,s=n.length;r{const d=Bg(f,l);for(let p=0;p{const s=Q(r);n.rem.push(i[s]),i[s]=null}),t.visit(t.ADD,r=>{const s=Pg(r);i[Q(r)]=s,n.add.push(s)}),t.visit(t.MOD,r=>{const s=i[Q(r)];for(const o in r)s[o]=r[o],n.modifies(o);n.mod.push(s)})),n}});function km(e){$.call(this,[],e),this.count=0}km.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]};z(km,$,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,s=this.value.reduce((c,f)=>(c[Q(f)]=1,c),{});let o=this.value,a=this.count,u=0;function l(c){let f,d;o.length=u&&(f=o[d],s[Q(f)]&&n.rem.push(f),o[d]=c)),++a}if(t.rem.length&&(t.visit(t.REM,c=>{const f=Q(c);s[f]&&(s[f]=-1,n.rem.push(c)),--a}),o=o.filter(c=>s[Q(c)]!==-1)),(t.rem.length||i)&&o.length{s[Q(c)]||l(c)}),u=-1),i&&o.length>r){const c=o.length-r;for(let f=0;f{s[Q(c)]&&n.mod.push(c)}),t.add.length&&t.visit(t.ADD,l),(t.add.length||u<0)&&(n.add=o.filter(c=>!s[Q(c)])),this.count=a,this.value=n.source=o,n}});function $m(e){$.call(this,null,e)}$m.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]};z($m,$,{transform(e,t){if(this.value&&!e.modified())return;const n=t.materialize().fork(t.MOD),i=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=ys(e.start,e.stop,e.step||1).map(r=>{const s={};return s[i]=r,ge(s)}),n.add=t.add.concat(this.value),n}});function p2(e){$.call(this,null,e),this.modified(!0)}z(p2,$,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});function Am(e){$.call(this,null,e)}const g2=["unit0","unit1"];Am.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:Dg,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:g2}]};z(Am,$,{transform(e,t){const n=e.field,i=e.interval!==!1,r=e.timezone==="utc",s=this._floor(e,t),o=(r?Po:Lo)(s.unit).offset,a=e.as||g2,u=a[0],l=a[1],c=s.step;let f=s.start||1/0,d=s.stop||-1/0,p=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(pt(n)))&&(t=t.reflow(!0),p=t.SOURCE,f=1/0,d=-1/0),t.visit(p,h=>{const g=n(h);let m,y;g==null?(h[u]=null,i&&(h[l]=null)):(h[u]=m=y=s(g),i&&(h[l]=y=o(m,c)),md&&(d=y))}),s.start=f,s.stop=d,t.modifies(i?a:u)},_floor(e,t){const n=e.timezone==="utc",{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:dS({extent:e.extent||Zn(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),s=Rg(i),o=this.value||{},a=(n?iS:nS)(s,r);return a.unit=ue(s),a.units=s,a.step=r,a.start=o.start,a.stop=o.stop,this.value=a}});function m2(e){$.call(this,Mo(),e)}z(m2,$,{transform(e,t){const n=t.dataflow,i=e.field,r=this.value,s=a=>r.set(i(a),a);let o=!0;return e.modified("field")||t.modified(i.fields)?(r.clear(),t.visit(t.SOURCE,s)):t.changed()?(t.visit(t.REM,a=>r.delete(i(a))),t.visit(t.ADD,s)):o=!1,this.modified(o),r.empty>n.cleanThreshold&&n.runAfter(r.clean),t.fork()}});function y2(e){$.call(this,null,e)}z(y2,$,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(xs(e.sort)):t.source).map(e.field))}});function OM(e,t,n,i){const r=Wa[e](t,n);return{init:r.init||Yi,update:function(s,o){o[i]=r.next(s)}}}const Wa={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?++e:e}}},percent_rank:function(){const e=Wa.rank(),t=e.next;return{init:e.init,next:n=>(t(n)-1)/(n.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const n=t.data,i=t.compare;let r=t.index;if(e0||A("ntile num must be greater than zero.");const n=Wa.cume_dist(),i=n.next;return{init:n.init,next:r=>Math.ceil(t*i(r))}},lag:function(e,t){return t=+t||1,{next:n=>{const i=n.index-t;return i>=0?e(n.data[i]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{const i=n.index+t,r=n.data;return ie(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return t=+t,t>0||A("nth_value nth must be greater than zero."),{next:n=>{const i=n.i0+(t-1);return it=null,next:n=>{const i=e(n.data[n.index]);return i!=null?t=i:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:i=>{const r=i.data;return i.index<=n?t:(n=DM(e,r,i.index))<0?(n=r.length,t=null):t=e(r[n])}}}};function DM(e,t,n){for(let i=t.length;nu[g]=1)}p(e.sort),t.forEach((h,g)=>{const m=n[g],y=i[g],b=r[g]||null,v=Me(m),w=VS(h,v,s[g]);if(p(m),o.push(w),G(Wa,h))a.push(OM(h,m,y,w));else{if(m==null&&h!=="count"&&A("Null aggregate field specified."),h==="count"){c.push(w);return}d=!1;let E=l[v];E||(E=l[v]=[],E.field=m,f.push(E)),E.push(XS(h,b,w))}}),(c.length||f.length)&&(this.cell=_M(f,c,d)),this.inputs=Object.keys(u)}const x2=b2.prototype;x2.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()};x2.update=function(e,t){const n=this.cell,i=this.windows,r=e.data,s=i&&i.length;let o;if(n){for(o=e.p0;oKS(u,u.field));const i={num:0,agg:null,store:!1,count:t};if(!n)for(var r=e.length,s=i.agg=Array(r),o=0;othis.group(r(a));let o=this.state;(!o||n)&&(o=this.state=new b2(e)),n||t.modified(o.inputs)?(this.value={},t.visit(t.SOURCE,a=>s(a).add(a))):(t.visit(t.REM,a=>s(a).remove(a)),t.visit(t.ADD,a=>s(a).add(a)));for(let a=0,u=this._mlen;a0&&!r(s[n],s[n-1])&&(e.i0=t.left(s,s[n])),itypeof Image<"u"?Image:null;function Fm(e,t,n){const i=e-t+n*2;return e?i>0?i:1:0}const IM="identity",so="linear",Fi="log",pu="pow",gu="sqrt",Qc="symlog",Zr="time",es="utc",Yn="sequential",zo="diverging",oo="quantile",Zc="quantize",ef="threshold",Om="ordinal",Xh="point",v2="band",Dm="bin-ordinal",Ve="continuous",mu="discrete",yu="discretizing",cn="interpolating",Rm="temporal";function zM(e){return function(t){let n=t[0],i=t[1],r;return i=i&&n[u]<=r&&(s<0&&(s=u),o=u);if(!(s<0))return i=e.invertExtent(n[s]),r=e.invertExtent(n[o]),[i[0]===void 0?i[1]:i[0],r[1]===void 0?r[0]:r[1]]}}function _m(){const e=kw().unknown(void 0),t=e.domain,n=e.range;let i=[0,1],r,s,o=!1,a=0,u=0,l=.5;delete e.unknown;function c(){const f=t().length,d=i[1]g+r*y);return n(d?m.reverse():m)}return e.domain=function(f){return arguments.length?(t(f),c()):t()},e.range=function(f){return arguments.length?(i=[+f[0],+f[1]],c()):i.slice()},e.rangeRound=function(f){return i=[+f[0],+f[1]],o=!0,c()},e.bandwidth=function(){return s},e.step=function(){return r},e.round=function(f){return arguments.length?(o=!!f,c()):o},e.padding=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),a=u,c()):a},e.paddingInner=function(f){return arguments.length?(a=Math.max(0,Math.min(1,f)),c()):a},e.paddingOuter=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),c()):u},e.align=function(f){return arguments.length?(l=Math.max(0,Math.min(1,f)),c()):l},e.invertRange=function(f){if(f[0]==null||f[1]==null)return;const d=i[1]i[1-d])))return y=Math.max(0,Wl(p,g)-1),b=g===m?y:Wl(p,m)-1,g-p[y]>s+1e-10&&++y,d&&(v=y,y=h-b,b=h-v),y>b?void 0:t().slice(y,b+1)},e.invert=function(f){const d=e.invertRange([f,f]);return d&&d[0]},e.copy=function(){return _m().domain(t()).range(i).round(o).paddingInner(a).paddingOuter(u).align(l)},c()}function E2(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return E2(t())},e}function UM(){return E2(_m().paddingInner(1))}var jM=Array.prototype.map;function qM(e){return jM.call(e,dt)}const WM=Array.prototype.slice;function w2(){let e=[],t=[];function n(i){return i==null||i!==i?void 0:t[(Wl(e,i)-1)%t.length]}return n.domain=function(i){return arguments.length?(e=qM(i),n):e.slice()},n.range=function(i){return arguments.length?(t=WM.call(i),n):t.slice()},n.tickFormat=function(i,r){return m_(e[0],ue(e),i??10,r)},n.copy=function(){return w2().domain(n.domain()).range(n.range())},n}const Kl=new Map,S2=Symbol("vega_scale");function k2(e){return e[S2]=!0,e}function _b(e){return e&&e[S2]===!0}function GM(e,t,n){const i=function(){const s=t();return s.invertRange||(s.invertRange=s.invert?zM(s):s.invertExtent?BM(s):void 0),s.type=e,k2(s)};return i.metadata=$n(q(n)),i}function he(e,t,n){return arguments.length>1?(Kl.set(e,GM(e,t,n)),this):$2(e)?Kl.get(e):void 0}he(IM,JD);he(so,g_,Ve);he(Fi,QD,[Ve,Fi]);he(pu,ZD,Ve);he(gu,eR,Ve);he(Qc,tR,Ve);he(Zr,__,[Ve,Rm]);he(es,nR,[Ve,Rm]);he(Yn,gw,[Ve,cn]);he(`${Yn}-${so}`,gw,[Ve,cn]);he(`${Yn}-${Fi}`,iR,[Ve,cn,Fi]);he(`${Yn}-${pu}`,rR,[Ve,cn]);he(`${Yn}-${gu}`,sR,[Ve,cn]);he(`${Yn}-${Qc}`,oR,[Ve,cn]);he(`${zo}-${so}`,aR,[Ve,cn]);he(`${zo}-${Fi}`,uR,[Ve,cn,Fi]);he(`${zo}-${pu}`,lR,[Ve,cn]);he(`${zo}-${gu}`,cR,[Ve,cn]);he(`${zo}-${Qc}`,fR,[Ve,cn]);he(oo,dR,[yu,oo]);he(Zc,hR,yu);he(ef,pR,yu);he(Dm,w2,[mu,yu]);he(Om,kw,mu);he(v2,_m,mu);he(Xh,UM,mu);function $2(e){return Kl.has(e)}function Es(e,t){const n=Kl.get(e);return n&&n.metadata[t]}function Tm(e){return Es(e,Ve)}function ao(e){return Es(e,mu)}function Yh(e){return Es(e,yu)}function A2(e){return Es(e,Fi)}function HM(e){return Es(e,Rm)}function C2(e){return Es(e,cn)}function F2(e){return Es(e,oo)}const VM=["clamp","base","constant","exponent"];function O2(e,t){const n=t[0],i=ue(t)-n;return function(r){return e(n+r*i)}}function tf(e,t,n){return KD(Nm(t||"rgb",n),e)}function D2(e,t){const n=new Array(t),i=t+1;for(let r=0;re[a]?o[a](e[a]()):0),o)}function Nm(e,t){const n=YD[XM(e)];return t!=null&&n&&n.gamma?n.gamma(t):n}function XM(e){return"interpolate"+e.toLowerCase().split("-").map(t=>t[0].toUpperCase()+t.slice(1)).join("")}const YM={blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},KM={accent:kR,category10:SR,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:wR,observable10:ER,paired:vR,pastel1:xR,pastel2:bR,set1:yR,set2:mR,set3:gR,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"};function _2(e){if(F(e))return e;const t=e.length/6|0,n=new Array(t);for(let i=0;itf(_2(e)));function Mm(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(Tb[e]=t,this):Tb[e]}const $l="symbol",JM="discrete",QM="gradient",ZM=e=>F(e)?e.map(t=>String(t)):String(e),eL=(e,t)=>e[1]-t[1],tL=(e,t)=>t[1]-e[1];function Lm(e,t,n){let i;return de(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),n!=null&&(t=Math.min(t,Math.floor(cu(e.domain())/n||1)+1))),U(t)&&(i=t.step,t=t.interval),j(t)&&(t=e.type===Zr?Lo(t):e.type==es?Po(t):A("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function N2(e,t,n){let i=e.range(),r=i[0],s=ue(i),o=eL;if(r>s&&(i=s,s=r,r=i,o=tL),r=Math.floor(r),s=Math.ceil(s),t=t.map(a=>[a,e(a)]).filter(a=>r<=a[1]&&a[1]<=s).sort(o).map(a=>a[0]),n>0&&t.length>1){const a=[t[0],ue(t)];for(;t.length>n&&t.length>=3;)t=t.filter((u,l)=>!(l%2));t.length<3&&(t=a)}return t}function Pm(e,t){return e.bins?N2(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function M2(e,t,n,i,r,s){const o=t.type;let a=ZM;if(o===Zr||r===Zr)a=e.timeFormat(i);else if(o===es||r===es)a=e.utcFormat(i);else if(A2(o)){const u=e.formatFloat(i);if(s||t.bins)a=u;else{const l=L2(t,n,!1);a=c=>l(c)?u(c):""}}else if(t.tickFormat){const u=t.domain();a=e.formatSpan(u[0],u[u.length-1],n,i)}else i&&(a=e.format(i));return a}function L2(e,t,n){const i=Pm(e,t),r=e.base(),s=Math.log(r),o=Math.max(1,r*t/i.length),a=u=>{let l=u/Math.pow(r,Math.round(Math.log(u)/s));return l*r1?i[1]-i[0]:i[0],o;for(o=1;oKh[e.type]||e.bins;function z2(e,t,n,i,r,s,o){const a=P2[t.type]&&s!==Zr&&s!==es?nL(e,t,r):M2(e,t,n,r,s,o);return i===$l&&sL(t)?oL(a):i===JM?aL(a):uL(a)}const oL=e=>(t,n,i)=>{const r=Nb(i[n+1],Nb(i.max,1/0)),s=Mb(t,e),o=Mb(r,e);return s&&o?s+" – "+o:o?"< "+o:"≥ "+s},Nb=(e,t)=>e??t,aL=e=>(t,n)=>n?e(t):null,uL=e=>t=>e(t),Mb=(e,t)=>Number.isFinite(e)?t(e):null;function lL(e){const t=e.domain(),n=t.length-1;let i=+t[0],r=+ue(t),s=r-i;if(e.type===ef){const o=n?s/n:.1;i-=o,r+=o,s=r-i}return o=>(o-i)/s}function cL(e,t,n,i){const r=i||t.type;return j(n)&&HM(r)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),!n&&r===Zr?e.timeFormat("%A, %d %B %Y, %X"):!n&&r===es?e.utcFormat("%A, %d %B %Y, %X UTC"):z2(e,t,5,null,n,i,!0)}function B2(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=cL(e,t,n.format,n.formatType);if(Yh(t.type)){const s=I2(t).slice(1).map(r),o=s.length;return`${o} boundar${o===1?"y":"ies"}: ${s.join(", ")}`}else if(ao(t.type)){const s=t.domain(),o=s.length,a=o>i?s.slice(0,i-2).map(r).join(", ")+", ending with "+s.slice(-1).map(r):s.map(r).join(", ");return`${o} value${o===1?"":"s"}: ${a}`}else{const s=t.domain();return`values from ${r(s[0])} to ${r(ue(s))}`}}let U2=0;function fL(){U2=0}const Jl="p_";function Im(e){return e&&e.gradient}function j2(e,t,n){const i=e.gradient;let r=e.id,s=i==="radial"?Jl:"";return r||(r=e.id="gradient_"+U2++,i==="radial"?(e.x1=Un(e.x1,.5),e.y1=Un(e.y1,.5),e.r1=Un(e.r1,0),e.x2=Un(e.x2,.5),e.y2=Un(e.y2,.5),e.r2=Un(e.r2,.5),s=Jl):(e.x1=Un(e.x1,0),e.y1=Un(e.y1,0),e.x2=Un(e.x2,1),e.y2=Un(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+s+r+")"}function Un(e,t){return e??t}function q2(e,t){var n=[],i;return i={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:n,stop:function(r,s){return n.push({offset:r,color:s}),i}}}const Lb={basis:{curve:iT},"basis-closed":{curve:nT},"basis-open":{curve:tT},bundle:{curve:eT,tension:"beta",value:.85},cardinal:{curve:Z_,tension:"tension",value:0},"cardinal-open":{curve:Q_,tension:"tension",value:0},"cardinal-closed":{curve:J_,tension:"tension",value:0},"catmull-rom":{curve:K_,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Y_,tension:"alpha",value:.5},"catmull-rom-open":{curve:X_,tension:"alpha",value:.5},linear:{curve:V_},"linear-closed":{curve:H_},monotone:{horizontal:G_,vertical:W_},natural:{curve:q_},step:{curve:j_},"step-after":{curve:U_},"step-before":{curve:B_}};function zm(e,t,n){var i=G(Lb,e)&&Lb[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&n!=null&&(r=r[i.tension](n))),r}const dL={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},hL=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,pL=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,gL=/^((\s+,?\s*)|(,\s*))/,mL=/^[01]/;function uo(e){const t=[];return(e.match(hL)||[]).forEach(i=>{let r=i[0];const s=r.toLowerCase(),o=dL[s],a=yL(s,o,i.slice(1).trim()),u=a.length;if(u1&&(g=Math.sqrt(g),n*=g,i*=g);const m=d/n,y=f/n,b=-f/i,v=d/i,w=m*a+y*u,E=b*a+v*u,S=m*e+y*t,x=b*e+v*t;let D=1/((S-w)*(S-w)+(x-E)*(x-E))-.25;D<0&&(D=0);let P=Math.sqrt(D);s==r&&(P=-P);const K=.5*(w+S)-P*(x-E),ee=.5*(E+x)+P*(S-w),ce=Math.atan2(E-ee,w-K);let O=Math.atan2(x-ee,S-K)-ce;O<0&&s===1?O+=Vn:O>0&&s===0&&(O-=Vn);const I=Math.ceil(Math.abs(O/(jr+.001))),W=[];for(let V=0;V+e}function Zu(e,t,n){return Math.max(t,Math.min(e,n))}function H2(){var e=SL,t=kL,n=$L,i=AL,r=gi(0),s=r,o=r,a=r,u=null;function l(c,f,d){var p,h=f??+e.call(this,c),g=d??+t.call(this,c),m=+n.call(this,c),y=+i.call(this,c),b=Math.min(m,y)/2,v=Zu(+r.call(this,c),0,b),w=Zu(+s.call(this,c),0,b),E=Zu(+o.call(this,c),0,b),S=Zu(+a.call(this,c),0,b);if(u||(u=p=mg()),v<=0&&w<=0&&E<=0&&S<=0)u.rect(h,g,m,y);else{var x=h+m,k=g+y;u.moveTo(h+v,g),u.lineTo(x-w,g),u.bezierCurveTo(x-Ui*w,g,x,g+Ui*w,x,g+w),u.lineTo(x,k-S),u.bezierCurveTo(x,k-Ui*S,x-Ui*S,k,x-S,k),u.lineTo(h+E,k),u.bezierCurveTo(h+Ui*E,k,h,k-Ui*E,h,k-E),u.lineTo(h,g+v),u.bezierCurveTo(h,g+Ui*v,h+Ui*v,g,h+v,g),u.closePath()}if(p)return u=null,p+""||null}return l.x=function(c){return arguments.length?(e=gi(c),l):e},l.y=function(c){return arguments.length?(t=gi(c),l):t},l.width=function(c){return arguments.length?(n=gi(c),l):n},l.height=function(c){return arguments.length?(i=gi(c),l):i},l.cornerRadius=function(c,f,d,p){return arguments.length?(r=gi(c),s=f!=null?gi(f):r,a=d!=null?gi(d):r,o=p!=null?gi(p):s,l):r},l.context=function(c){return arguments.length?(u=c??null,l):u},l}function V2(){var e,t,n,i,r=null,s,o,a,u;function l(f,d,p){const h=p/2;if(s){var g=a-d,m=f-o;if(g||m){var y=Math.hypot(g,m),b=(g/=y)*u,v=(m/=y)*u,w=Math.atan2(m,g);r.moveTo(o-b,a-v),r.lineTo(f-g*h,d-m*h),r.arc(f,d,h,w-Math.PI,w),r.lineTo(o+b,a+v),r.arc(o,a,u,w,w+Math.PI)}else r.arc(f,d,h,0,Vn);r.closePath()}else s=1;o=f,a=d,u=h}function c(f){var d,p=f.length,h,g=!1,m;for(r==null&&(r=m=mg()),d=0;d<=p;++d)!(de.x||0,vu=e=>e.y||0,CL=e=>e.width||0,FL=e=>e.height||0,OL=e=>(e.x||0)+(e.width||0),DL=e=>(e.y||0)+(e.height||0),RL=e=>e.startAngle||0,_L=e=>e.endAngle||0,TL=e=>e.padAngle||0,NL=e=>e.innerRadius||0,ML=e=>e.outerRadius||0,LL=e=>e.cornerRadius||0,PL=e=>bu(e.cornerRadiusTopLeft,e.cornerRadius)||0,IL=e=>bu(e.cornerRadiusTopRight,e.cornerRadius)||0,zL=e=>bu(e.cornerRadiusBottomRight,e.cornerRadius)||0,BL=e=>bu(e.cornerRadiusBottomLeft,e.cornerRadius)||0,UL=e=>bu(e.size,64),jL=e=>e.size||1,nf=e=>e.defined!==!1,qL=e=>G2(e.shape||"circle"),WL=oT().startAngle(RL).endAngle(_L).padAngle(TL).innerRadius(NL).outerRadius(ML).cornerRadius(LL),GL=mw().x(xu).y1(vu).y0(DL).defined(nf),HL=mw().y(vu).x1(xu).x0(OL).defined(nf),VL=rT().x(xu).y(vu).defined(nf),XL=H2().x(xu).y(vu).width(CL).height(FL).cornerRadius(PL,IL,zL,BL),YL=$R().type(qL).size(UL),KL=V2().x(xu).y(vu).defined(nf).size(jL);function Bm(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function JL(e,t){return WL.context(e)(t)}function QL(e,t){const n=t[0],i=n.interpolate||"linear";return(n.orient==="horizontal"?HL:GL).curve(zm(i,n.orient,n.tension)).context(e)(t)}function ZL(e,t){const n=t[0],i=n.interpolate||"linear";return VL.curve(zm(i,n.orient,n.tension)).context(e)(t)}function Bo(e,t,n,i){return XL.context(e)(t,n,i)}function e5(e,t){return(t.mark.shape||t.shape).context(e)(t)}function t5(e,t){return YL.context(e)(t)}function n5(e,t){return KL.context(e)(t)}var X2=1;function i5(){X2=1}function Um(e,t,n){var i=t.clip,r=e._defs,s=t.clip_id||(t.clip_id="clip"+X2++),o=r.clipping[s]||(r.clipping[s]={id:s});return ie(i)?o.path=i(null):Bm(n)?o.path=Bo(null,n,0,0):(o.width=n.width||0,o.height=n.height||0),"url(#"+s+")"}function Ue(e){this.clear(),e&&this.union(e)}Ue.prototype={clone(){return new Ue(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,i){return nthis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const i=this.rotatedPoints(e,t,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},rotatedPoints(e,t,n){var{x1:i,y1:r,x2:s,y2:o}=this,a=Math.cos(e),u=Math.sin(e),l=t-t*a+n*u,c=n-t*u-n*a;return[a*i-u*r+l,u*i+a*r+c,a*i-u*o+l,u*i+a*o+c,a*s-u*r+l,u*s+a*r+c,a*s-u*o+l,u*s+a*o+c]},union(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2e.x2||this.y2e.y2)},contains(e,t){return!(ethis.x2||tthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}};function rf(e){this.mark=e,this.bounds=this.bounds||new Ue}function sf(e){rf.call(this,e),this.items=this.items||[]}z(sf,rf);class Y2{constructor(t){this._pending=0,this._loader=t||Bc()}pending(){return this._pending}sanitizeURL(t){const n=this;return Bb(n),n._loader.sanitize(t,{context:"href"}).then(i=>(ia(n),i)).catch(()=>(ia(n),null))}loadImage(t){const n=this,i=PM();return Bb(n),n._loader.sanitize(t,{context:"image"}).then(r=>{const s=r.href;if(!s||!i)throw{url:s};const o=new i,a=G(r,"crossOrigin")?r.crossOrigin:"anonymous";return a!=null&&(o.crossOrigin=a),o.onload=()=>ia(n),o.onerror=()=>ia(n),o.src=s,o}).catch(r=>(ia(n),{complete:!1,width:0,height:0,src:r&&r.url||""}))}ready(){const t=this;return new Promise(n=>{function i(r){t.pending()?setTimeout(()=>{i(!0)},10):n(r)}i(!1)})}}function Bb(e){e._pending+=1}function ia(e){e._pending-=1}function _i(e,t,n){if(t.stroke&&t.opacity!==0&&t.strokeOpacity!==0){const i=t.strokeWidth!=null?+t.strokeWidth:1;e.expand(i+(n?r5(t,i):0))}return e}function r5(e,t){return e.strokeJoin&&e.strokeJoin!=="miter"?0:t}const s5=Vn-1e-8;let of,Al,Cl,Gr,Jh,Fl,Qh,Zh;const Ki=(e,t)=>of.add(e,t),Ol=(e,t)=>Ki(Al=e,Cl=t),Ub=e=>Ki(e,of.y1),jb=e=>Ki(of.x1,e),qr=(e,t)=>Jh*e+Qh*t,Wr=(e,t)=>Fl*e+Zh*t,Dd=(e,t)=>Ki(qr(e,t),Wr(e,t)),Rd=(e,t)=>Ol(qr(e,t),Wr(e,t));function Eu(e,t){return of=e,t?(Gr=t*cr,Jh=Zh=Math.cos(Gr),Fl=Math.sin(Gr),Qh=-Fl):(Jh=Zh=1,Gr=Fl=Qh=0),o5}const o5={beginPath(){},closePath(){},moveTo:Rd,lineTo:Rd,rect(e,t,n,i){Gr?(Dd(e+n,t),Dd(e+n,t+i),Dd(e,t+i),Rd(e,t)):(Ki(e+n,t+i),Ol(e,t))},quadraticCurveTo(e,t,n,i){const r=qr(e,t),s=Wr(e,t),o=qr(n,i),a=Wr(n,i);qb(Al,r,o,Ub),qb(Cl,s,a,jb),Ol(o,a)},bezierCurveTo(e,t,n,i,r,s){const o=qr(e,t),a=Wr(e,t),u=qr(n,i),l=Wr(n,i),c=qr(r,s),f=Wr(r,s);Wb(Al,o,u,c,Ub),Wb(Cl,a,l,f,jb),Ol(c,f)},arc(e,t,n,i,r,s){if(i+=Gr,r+=Gr,Al=n*Math.cos(r)+e,Cl=n*Math.sin(r)+t,Math.abs(r-i)>s5)Ki(e-n,t-n),Ki(e+n,t+n);else{const o=l=>Ki(n*Math.cos(l)+e,n*Math.sin(l)+t);let a,u;if(o(i),o(r),r!==i)if(i=i%Vn,i<0&&(i+=Vn),r=r%Vn,r<0&&(r+=Vn),rr;++u,a-=jr)o(a);else for(a=i-i%jr+jr,u=0;u<4&&abL?(c=o*o+a*s,c>=0&&(c=Math.sqrt(c),u=(-o+c)/s,l=(-o-c)/s)):u=.5*a/o,0d)return!1;g>f&&(f=g)}else if(p>0){if(g0?(e.globalAlpha=n,e.fillStyle=Q2(e,t,t.fill),!0):!1}var u5=[];function co(e,t,n){var i=(i=t.strokeWidth)!=null?i:1;return i<=0?!1:(n*=t.strokeOpacity==null?1:t.strokeOpacity,n>0?(e.globalAlpha=n,e.strokeStyle=Q2(e,t,t.stroke),e.lineWidth=i,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||u5),e.lineDashOffset=t.strokeDashOffset||0),!0):!1)}function l5(e,t){return e.zindex-t.zindex||e.index-t.index}function Wm(e){if(!e.zdirty)return e.zitems;var t=e.items,n=[],i,r,s;for(r=0,s=t.length;r=0;)if(i=t(n[r]))return i;if(n===s){for(n=e.items,r=n.length;--r>=0;)if(!n[r].zindex&&(i=t(n[r])))return i}return null}function Gm(e){return function(t,n,i){Cn(n,r=>{(!i||i.intersects(r.bounds))&&Z2(e,t,r,r)})}}function c5(e){return function(t,n,i){n.items.length&&(!i||i.intersects(n.bounds))&&Z2(e,t,n.items[0],n.items)}}function Z2(e,t,n,i){var r=n.opacity==null?1:n.opacity;r!==0&&(e(t,i)||(lo(t,n),n.fill&&Ql(t,n,r)&&t.fill(),n.stroke&&co(t,n,r)&&t.stroke()))}function af(e){return e=e||sn,function(t,n,i,r,s,o){return i*=t.pixelRatio,r*=t.pixelRatio,Zl(n,a=>{const u=a.bounds;if(!(u&&!u.contains(s,o)||!u)&&e(t,a,i,r,s,o))return a})}}function wu(e,t){return function(n,i,r,s){var o=Array.isArray(i)?i[0]:i,a=t??o.fill,u=o.stroke&&n.isPointInStroke,l,c;return u&&(l=o.strokeWidth,c=o.strokeCap,n.lineWidth=l??1,n.lineCap=c??"butt"),e(n,i)?!1:a&&n.isPointInPath(r,s)||u&&n.isPointInStroke(r,s)}}function Hm(e){return af(wu(e))}function Hr(e,t){return"translate("+e+","+t+")"}function Vm(e){return"rotate("+e+")"}function f5(e,t){return"scale("+e+","+t+")"}function ek(e){return Hr(e.x||0,e.y||0)}function d5(e){return Hr(e.x||0,e.y||0)+(e.angle?" "+Vm(e.angle):"")}function h5(e){return Hr(e.x||0,e.y||0)+(e.angle?" "+Vm(e.angle):"")+(e.scaleX||e.scaleY?" "+f5(e.scaleX||1,e.scaleY||1):"")}function Xm(e,t,n){function i(o,a){o("transform",d5(a)),o("d",t(null,a))}function r(o,a){return t(Eu(o,a.angle),a),_i(o,a).translate(a.x||0,a.y||0)}function s(o,a){var u=a.x||0,l=a.y||0,c=a.angle||0;o.translate(u,l),c&&o.rotate(c*=cr),o.beginPath(),t(o,a),c&&o.rotate(-c),o.translate(-u,-l)}return{type:e,tag:"path",nested:!1,attr:i,bound:r,draw:Gm(s),pick:Hm(s),isect:n||jm(s)}}var p5=Xm("arc",JL);function g5(e,t){for(var n=e[0].orient==="horizontal"?t[1]:t[0],i=e[0].orient==="horizontal"?"y":"x",r=e.length,s=1/0,o,a;--r>=0;)e[r].defined!==!1&&(a=Math.abs(e[r][i]-n),a=0;)if(e[i].defined!==!1&&(r=e[i].x-t[0],s=e[i].y-t[1],o=r*r+s*s,o=0;)if(e[n].defined!==!1&&(i=e[n].x-t[0],r=e[n].y-t[1],s=i*i+r*r,i=e[n].size||1,s.5&&t<1.5?.5-Math.abs(t-1):0}function v5(e,t){e("transform",ek(t))}function ik(e,t){const n=nk(t);e("d",Bo(null,t,n,n))}function E5(e,t){e("class","background"),e("aria-hidden",!0),ik(e,t)}function w5(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?ik(e,t):e("d","")}function S5(e,t,n){const i=t.clip?Um(n,t,t):null;e("clip-path",i)}function k5(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let r=0;r{const s=r.x||0,o=r.y||0,a=r.strokeForeground,u=r.opacity==null?1:r.opacity;(r.stroke||r.fill)&&u&&(Ha(e,r,s,o),lo(e,r),r.fill&&Ql(e,r,u)&&e.fill(),r.stroke&&!a&&co(e,r,u)&&e.stroke()),e.save(),e.translate(s,o),r.clip&&tk(e,r),n&&n.translate(-s,-o),Cn(r,l=>{(l.marktype==="group"||i==null||i.includes(l.marktype))&&this.draw(e,l,n,i)}),n&&n.translate(s,o),e.restore(),a&&r.stroke&&u&&(Ha(e,r,s,o),lo(e,r),co(e,r,u)&&e.stroke())})}function O5(e,t,n,i,r,s){if(t.bounds&&!t.bounds.contains(r,s)||!t.items)return null;const o=n*e.pixelRatio,a=i*e.pixelRatio;return Zl(t,u=>{let l,c,f;const d=u.bounds;if(d&&!d.contains(r,s))return;c=u.x||0,f=u.y||0;const p=c+(u.width||0),h=f+(u.height||0),g=u.clip;if(g&&(rp||sh))return;if(e.save(),e.translate(c,f),c=r-c,f=s-f,g&&Bm(u)&&!C5(e,u,o,a))return e.restore(),null;const m=u.strokeForeground,y=t.interactive!==!1;return y&&m&&u.stroke&&A5(e,u,o,a)?(e.restore(),u):(l=Zl(u,b=>D5(b,c,f)?this.pick(b,n,i,c,f):null),!l&&y&&(u.fill||!m&&u.stroke)&&$5(e,u,o,a)&&(l=u),e.restore(),l||null)})}function D5(e,t,n){return(e.interactive!==!1||e.marktype==="group")&&e.bounds&&e.bounds.contains(t,n)}var R5={type:"group",tag:"g",nested:!1,attr:v5,bound:k5,draw:F5,pick:O5,isect:K2,content:S5,background:E5,foreground:w5},Va={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function Km(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then(i=>{e.image=i,e.image.url=e.url})),n}function Jm(e,t){return e.width!=null?e.width:!t||!t.width?0:e.aspect!==!1&&e.height?e.height*t.width/t.height:t.width}function Qm(e,t){return e.height!=null?e.height:!t||!t.height?0:e.aspect!==!1&&e.width?e.width*t.height/t.width:t.height}function uf(e,t){return e==="center"?t/2:e==="right"?t:0}function lf(e,t){return e==="middle"?t/2:e==="bottom"?t:0}function _5(e,t,n){const i=Km(t,n),r=Jm(t,i),s=Qm(t,i),o=(t.x||0)-uf(t.align,r),a=(t.y||0)-lf(t.baseline,s),u=!i.src&&i.toDataURL?i.toDataURL():i.src||"";e("href",u,Va["xmlns:xlink"],"xlink:href"),e("transform",Hr(o,a)),e("width",r),e("height",s),e("preserveAspectRatio",t.aspect===!1?"none":"xMidYMid")}function T5(e,t){const n=t.image,i=Jm(t,n),r=Qm(t,n),s=(t.x||0)-uf(t.align,i),o=(t.y||0)-lf(t.baseline,r);return e.set(s,o,s+i,o+r)}function N5(e,t,n){Cn(t,i=>{if(n&&!n.intersects(i.bounds))return;const r=Km(i,this);let s=Jm(i,r),o=Qm(i,r);if(s===0||o===0)return;let a=(i.x||0)-uf(i.align,s),u=(i.y||0)-lf(i.baseline,o),l,c,f,d;i.aspect!==!1&&(c=r.width/r.height,f=i.width/i.height,c===c&&f===f&&c!==f&&(f{if(!(n&&!n.intersects(i.bounds))){var r=i.opacity==null?1:i.opacity;r&&rk(e,i,r)&&(lo(e,i),e.stroke())}})}function H5(e,t,n,i){return e.isPointInStroke?rk(e,t,1)&&e.isPointInStroke(n,i):!1}var V5={type:"rule",tag:"line",nested:!1,attr:q5,bound:W5,draw:G5,pick:af(H5),isect:J2},X5=Xm("shape",e5),Y5=Xm("symbol",t5,qm);const Xb=Ww();var jt={height:oi,measureWidth:Zm,estimateWidth:ec,width:ec,canvas:sk};sk(!0);function sk(e){jt.width=e&&ar?Zm:ec}function ec(e,t){return ok(dr(e,t),oi(e))}function ok(e,t){return~~(.8*e.length*t)}function Zm(e,t){return oi(e)<=0||!(t=dr(e,t))?0:ak(t,cf(e))}function ak(e,t){const n=`(${t}) ${e}`;let i=Xb.get(n);return i===void 0&&(ar.font=t,i=ar.measureText(e).width,Xb.set(n,i)),i}function oi(e){return e.fontSize!=null?+e.fontSize||0:11}function fr(e){return e.lineHeight!=null?e.lineHeight:oi(e)+2}function K5(e){return F(e)?e.length>1?e:e[0]:e}function Su(e){return K5(e.lineBreak&&e.text&&!F(e.text)?e.text.split(e.lineBreak):e.text)}function e0(e){const t=Su(e);return(F(t)?t.length-1:0)*fr(e)}function dr(e,t){const n=t==null?"":(t+"").trim();return e.limit>0&&n.length?Q5(e,n):n}function J5(e){if(jt.width===Zm){const t=cf(e);return n=>ak(n,t)}else if(jt.width===ec){const t=oi(e);return n=>ok(n,t)}else return t=>jt.width(e,t)}function Q5(e,t){var n=+e.limit,i=J5(e);if(i(t)>>1,i(t.slice(u))>n?o=u+1:a=u;return r+t.slice(o)}else{for(;o>>1),i(t.slice(0,u))Math.max(d,jt.width(t,p)),0)):f=jt.width(t,c),r==="center"?u-=f/2:r==="right"&&(u-=f),e.set(u+=o,l+=a,u+f,l+i),t.angle&&!n)e.rotate(t.angle*cr,o,a);else if(n===2)return e.rotatedPoints(t.angle*cr,o,a);return e}function t3(e,t,n){Cn(t,i=>{var r=i.opacity==null?1:i.opacity,s,o,a,u,l,c,f;if(!(n&&!n.intersects(i.bounds)||r===0||i.fontSize<=0||i.text==null||i.text.length===0)){if(e.font=cf(i),e.textAlign=i.align||"left",s=ff(i),o=s.x1,a=s.y1,i.angle&&(e.save(),e.translate(o,a),e.rotate(i.angle*cr),o=a=0),o+=i.dx||0,a+=(i.dy||0)+t0(i),c=Su(i),lo(e,i),F(c))for(l=fr(i),u=0;ut;)e.removeChild(n[--i]);return e}function hk(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function df(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function a3(e,t,n,i){var r=e&&e.mark,s,o;if(r&&(s=Xt[r.marktype]).tip){for(o=df(t,n),o[0]-=i[0],o[1]-=i[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=s.tip(r.items,o)}return e}let r0=class{constructor(t,n){this._active=null,this._handlers={},this._loader=t||Bc(),this._tooltip=n||u3}initialize(t,n,i){return this._el=t,this._obj=i||null,this.origin(n)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()}scene(t){return arguments.length?(this._scene=t,this):this._scene}on(){}off(){}_handlerIndex(t,n,i){for(let r=t?t.length:0;--r>=0;)if(t[r].type===n&&(!i||t[r].handler===i))return r;return-1}handlers(t){const n=this._handlers,i=[];if(t)i.push(...n[this.eventName(t)]);else for(const r in n)i.push(...n[r]);return i}eventName(t){const n=t.indexOf(".");return n<0?t:t.slice(0,n)}handleHref(t,n,i){this._loader.sanitize(i,{context:"href"}).then(r=>{const s=new MouseEvent(t.type,t),o=Ji(null,"a");for(const a in r)o.setAttribute(a,r[a]);o.dispatchEvent(s)}).catch(()=>{})}handleTooltip(t,n,i){if(n&&n.tooltip!=null){n=a3(n,t,this.canvas(),this._origin);const r=i&&n&&n.tooltip||null;this._tooltip.call(this._obj,this,t,n,r)}}getItemBoundingClientRect(t){const n=this.canvas();if(!n)return;const i=n.getBoundingClientRect(),r=this._origin,s=t.bounds,o=s.width(),a=s.height();let u=s.x1+r[0]+i.left,l=s.y1+r[1]+i.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,l+=t.y||0;return{x:u,y:l,width:o,height:a,left:u,top:l,right:u+o,bottom:l+a}}};function u3(e,t,n,i){e.element().setAttribute("title",i||"")}class $u{constructor(t){this._el=null,this._bgcolor=null,this._loader=new Y2(t)}initialize(t,n,i,r,s){return this._el=t,this.resize(n,i,r,s)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(t){return arguments.length===0?this._bgcolor:(this._bgcolor=t,this)}resize(t,n,i,r){return this._width=t,this._height=n,this._origin=i||[0,0],this._scale=r||1,this}dirty(){}render(t,n){const i=this;return i._call=function(){i._render(t,n)},i._call(),i._call=null,i}_render(){}renderAsync(t,n){const i=this.render(t,n);return this._ready?this._ready.then(()=>i):Promise.resolve(i)}_load(t,n){var i=this,r=i._loader[t](n);if(!i._ready){const s=i._call;i._ready=i._loader.ready().then(o=>{o&&s(),i._ready=null})}return r}sanitizeURL(t){return this._load("sanitizeURL",t)}loadImage(t){return this._load("loadImage",t)}}const l3="keydown",c3="keypress",f3="keyup",pk="dragenter",Rl="dragleave",gk="dragover",np="pointerdown",d3="pointerup",tc="pointermove",_l="pointerout",mk="pointerover",ip="mousedown",h3="mouseup",yk="mousemove",nc="mouseout",bk="mouseover",ic="click",p3="dblclick",g3="wheel",xk="mousewheel",rc="touchstart",sc="touchmove",oc="touchend",m3=[l3,c3,f3,pk,Rl,gk,np,d3,tc,_l,mk,ip,h3,yk,nc,bk,ic,p3,g3,xk,rc,sc,oc],rp=tc,Ta=nc,sp=ic;class Au extends r0{constructor(t,n){super(t,n),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=m3,this.pointermove=Qb([tc,yk],[mk,bk],[_l,nc]),this.dragover=Qb([gk],[pk],[Rl]),this.pointerout=Zb([_l,nc]),this.dragleave=Zb([Rl])}initialize(t,n,i){return this._canvas=t&&i0(t,"canvas"),[ic,ip,np,tc,_l,Rl].forEach(r=>Jb(this,r)),super.initialize(t,n,i)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(t){this.fire(xk,t)}pointerdown(t){this._down=this._active,this.fire(np,t)}mousedown(t){this._down=this._active,this.fire(ip,t)}click(t){this._down===this._active&&(this.fire(ic,t),this._down=null)}touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(rc,t,!0)}touchmove(t){this.fire(sc,t,!0)}touchend(t){this.fire(oc,t,!0),this._touch=null}fire(t,n,i){const r=i?this._touch:this._active,s=this._handlers[t];if(n.vegaType=t,t===sp&&r&&r.href?this.handleHref(n,r,r.href):(t===rp||t===Ta)&&this.handleTooltip(n,r,t!==Ta),s)for(let o=0,a=s.length;o=0&&r.splice(s,1),this}pickEvent(t){const n=df(t,this._canvas),i=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-i[0],n[1]-i[1])}pick(t,n,i,r,s){const o=this.context();return Xt[t.marktype].pick.call(this,o,t,n,i,r,s)}}const y3=e=>e===rc||e===sc||e===oc?[rc,sc,oc]:[e];function Jb(e,t){y3(t).forEach(n=>b3(e,n))}function b3(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?i=>e[t](i):i=>e.fire(t,i)))}function $a(e,t,n){t.forEach(i=>e.fire(i,n))}function Qb(e,t,n){return function(i){const r=this._active,s=this.pickEvent(i);s===r?$a(this,e,i):((!r||!r.exit)&&$a(this,n,i),this._active=s,$a(this,t,i),$a(this,e,i))}}function Zb(e){return function(t){$a(this,e,t),this._active=null}}function x3(){return typeof window<"u"&&window.devicePixelRatio||1}function v3(e,t,n,i,r,s){const o=typeof HTMLElement<"u"&&e instanceof HTMLElement&&e.parentNode!=null,a=e.getContext("2d"),u=o?x3():r;e.width=t*u,e.height=n*u;for(const l in s)a[l]=s[l];return o&&u!==1&&(e.style.width=t+"px",e.style.height=n+"px"),a.pixelRatio=u,a.setTransform(u,0,0,u,u*i[0],u*i[1]),e}class ac extends $u{constructor(t){super(t),this._options={},this._redraw=!1,this._dirty=new Ue,this._tempb=new Ue}initialize(t,n,i,r,s,o){return this._options=o||{},this._canvas=this._options.externalContext?null:or(1,1,this._options.type),t&&this._canvas&&(Qt(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(t,n,i,r,s)}resize(t,n,i,r){if(super.resize(t,n,i,r),this._canvas)v3(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const s=this._options.externalContext;s||A("CanvasRenderer is missing a valid canvas or context"),s.scale(this._scale,this._scale),s.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(t){const n=this._tempb.clear().union(t.bounds);let i=t.mark.group;for(;i;)n.translate(i.x||0,i.y||0),i=i.mark.group;this._dirty.union(n)}_render(t,n){const i=this.context(),r=this._origin,s=this._width,o=this._height,a=this._dirty,u=E3(r,s,o);i.save();const l=this._redraw||a.empty()?(this._redraw=!1,u.expand(1)):w3(i,u.intersect(a),r);return this.clear(-r[0],-r[1],s,o),this.draw(i,t,l,n),i.restore(),a.clear(),this}draw(t,n,i,r){if(n.marktype!=="group"&&r!=null&&!r.includes(n.marktype))return;const s=Xt[n.marktype];n.clip&&x5(t,n),s.draw.call(this,t,n,i,r),n.clip&&t.restore()}clear(t,n,i,r){const s=this._options,o=this.context();s.type!=="pdf"&&!s.externalContext&&o.clearRect(t,n,i,r),this._bgcolor!=null&&(o.fillStyle=this._bgcolor,o.fillRect(t,n,i,r))}}const E3=(e,t,n)=>new Ue().set(0,0,t,n).translate(-e[0],-e[1]);function w3(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-(n[0]%1),-(n[1]%1)),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}class vk extends r0{constructor(t,n){super(t,n);const i=this;i._hrefHandler=_d(i,(r,s)=>{s&&s.href&&i.handleHref(r,s,s.href)}),i._tooltipHandler=_d(i,(r,s)=>{i.handleTooltip(r,s,r.type!==Ta)})}initialize(t,n,i){let r=this._svg;return r&&(r.removeEventListener(sp,this._hrefHandler),r.removeEventListener(rp,this._tooltipHandler),r.removeEventListener(Ta,this._tooltipHandler)),this._svg=r=t&&i0(t,"svg"),r&&(r.addEventListener(sp,this._hrefHandler),r.addEventListener(rp,this._tooltipHandler),r.addEventListener(Ta,this._tooltipHandler)),super.initialize(t,n,i)}canvas(){return this._svg}on(t,n){const i=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[i],t,n)<0){const o={type:t,handler:n,listener:_d(this,n)};(r[i]||(r[i]=[])).push(o),this._svg&&this._svg.addEventListener(i,o.listener)}return this}off(t,n){const i=this.eventName(t),r=this._handlers[i],s=this._handlerIndex(r,t,n);return s>=0&&(this._svg&&this._svg.removeEventListener(i,r[s].listener),r.splice(s,1)),this}}const _d=(e,t)=>n=>{let i=n.target.__data__;i=Array.isArray(i)?i[0]:i,n.vegaType=n.type,t.call(e._obj,n,i)},Ek="aria-hidden",s0="aria-label",o0="role",a0="aria-roledescription",wk="graphics-object",u0="graphics-symbol",Sk=(e,t,n)=>({[o0]:e,[a0]:t,[s0]:n||void 0}),S3=$n(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),ex={axis:{desc:"axis",caption:A3},legend:{desc:"legend",caption:C3},"title-text":{desc:"title",caption:e=>`Title text '${nx(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${nx(e)}'`}},tx={ariaRole:o0,ariaRoleDescription:a0,description:s0};function kk(e,t){const n=t.aria===!1;if(e(Ek,n||void 0),n||t.description==null)for(const i in tx)e(tx[i],void 0);else{const i=t.mark.marktype;e(s0,t.description),e(o0,t.ariaRole||(i==="group"?wk:u0)),e(a0,t.ariaRoleDescription||`${i} mark`)}}function $k(e){return e.aria===!1?{[Ek]:!0}:S3[e.role]?null:ex[e.role]?$3(e,ex[e.role]):k3(e)}function k3(e){const t=e.marktype,n=t==="group"||t==="text"||e.items.some(i=>i.description!=null&&i.aria!==!1);return Sk(n?wk:u0,`${t} mark container`,e.description)}function $3(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return Sk(t.role||u0,t.desc,n.description||i(n))}catch{return null}}function nx(e){return q(e.text).join(" ")}function A3(e){const t=e.datum,n=e.orient,i=t.title?Ak(e):null,r=e.context,s=r.scales[t.scale].value,o=r.dataflow.locale(),a=s.type;return`${n==="left"||n==="right"?"Y":"X"}-axis`+(i?` titled '${i}'`:"")+` for a ${ao(a)?"discrete":a} scale with ${B2(o,s,e)}`}function C3(e){const t=e.datum,n=t.title?Ak(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,s=Object.keys(r),o=e.context,a=o.scales[r[s[0]]].value,u=o.dataflow.locale();return O3(i)+(n?` titled '${n}'`:"")+` for ${F3(s)} with ${B2(u,a,e)}`}function Ak(e){try{return q(ue(e.items).items[0].text).join(" ")}catch{return null}}function F3(e){return e=e.map(t=>t+(t==="fill"||t==="stroke"?" color":"")),e.length<2?e[0]:e.slice(0,-1).join(", ")+" and "+ue(e)}function O3(e){return e.length?e[0].toUpperCase()+e.slice(1):e}const Ck=e=>(e+"").replace(/&/g,"&").replace(//g,">"),D3=e=>Ck(e).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ");function l0(){let e="",t="",n="";const i=[],r=()=>t=n="",s=u=>{t&&(e+=`${t}>${n}`,r()),i.push(u)},o=(u,l)=>(l!=null&&(t+=` ${u}="${D3(l)}"`),a),a={open(u,...l){s(u),t="<"+u;for(const c of l)for(const f in c)o(f,c[f]);return a},close(){const u=i.pop();return t?e+=t+(n?`>${n}`:"/>"):e+=``,r(),a},attr:o,text:u=>(n+=Ck(u),a),toString:()=>e};return a}const Fk=e=>Ok(l0(),e)+"";function Ok(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let r=0;r{c.dirty=n})),!r.zdirty){if(i.exit){o.nested&&r.items.length?(l=r.items[0],l._svg&&this._update(o,l._svg,l)):i._svg&&(l=i._svg.parentNode,l&&l.removeChild(i._svg)),i._svg=null;continue}i=o.nested?r.items[0]:i,i._update!==n&&(!i._svg||!i._svg.ownerSVGElement?(this._dirtyAll=!1,rx(i,n)):this._update(o,i._svg,i),i._update=n)}return!this._dirtyAll}mark(t,n,i,r){if(!this.isDirty(n))return n._svg;const s=this._svg,o=n.marktype,a=Xt[o],u=n.interactive===!1?"none":null,l=a.tag==="g",c=sx(n,t,i,"g",s);if(o!=="group"&&r!=null&&!r.includes(o))return Qt(c,0),n._svg;c.setAttribute("class",hk(n));const f=$k(n);for(const g in f)Et(c,g,f[g]);l||Et(c,"pointer-events",u),Et(c,"clip-path",n.clip?Um(this,n,n.group):null);let d=null,p=0;const h=g=>{const m=this.isDirty(g),y=sx(g,c,d,a.tag,s);m&&(this._update(a,y,g),l&&T3(this,y,g,r)),d=y,++p};return a.nested?n.items.length&&h(n.items[0]):Cn(n,h),Qt(c,p),c}_update(t,n,i){Ei=n,ct=n.__values__,kk(Na,i),t.attr(Na,i,this);const r=M3[t.type];r&&r.call(this,t,n,i),Ei&&this.style(Ei,i)}style(t,n){if(n!=null){for(const i in uc){let r=i==="font"?ku(n):n[i];if(r===ct[i])continue;const s=uc[i];r==null?t.removeAttribute(s):(Im(r)&&(r=j2(r,this._defs.gradient,Rk())),t.setAttribute(s,r+"")),ct[i]=r}for(const i in lc)Tl(t,lc[i],n[i])}}defs(){const t=this._svg,n=this._defs;let i=n.el,r=0;for(const s in n.gradient)i||(n.el=i=qe(t,ra+1,"defs",je)),r=R3(i,n.gradient[s],r);for(const s in n.clipping)i||(n.el=i=qe(t,ra+1,"defs",je)),r=_3(i,n.clipping[s],r);i&&(r===0?(t.removeChild(i),n.el=null):Qt(i,r))}_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}}function rx(e,t){for(;e&&e.dirty!==t;e=e.mark.group)if(e.dirty=t,e.mark&&e.mark.dirty!==t)e.mark.dirty=t;else return}function R3(e,t,n){let i,r,s;if(t.gradient==="radial"){let o=qe(e,n++,"pattern",je);Qi(o,{id:Jl+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),o=qe(o,0,"rect",je),Qi(o,{width:1,height:1,fill:`url(${Rk()}#${t.id})`}),e=qe(e,n++,"radialGradient",je),Qi(e,{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else e=qe(e,n++,"linearGradient",je),Qi(e,{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(i=0,r=t.stops.length;i{r=e.mark(t,o,r,i),++s}),Qt(t,1+s)}function sx(e,t,n,i,r){let s=e._svg,o;if(!s&&(o=t.ownerDocument,s=Ji(o,i,je),e._svg=s,e.mark&&(s.__data__=e,s.__values__={fill:"default"},i==="g"))){const a=Ji(o,"path",je);s.appendChild(a),a.__data__=e;const u=Ji(o,"g",je);s.appendChild(u),u.__data__=e;const l=Ji(o,"path",je);s.appendChild(l),l.__data__=e,l.__values__={fill:"default"}}return(s.ownerSVGElement!==r||N3(s,n))&&t.insertBefore(s,n?n.nextSibling:t.firstChild),s}function N3(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}let Ei=null,ct=null;const M3={group(e,t,n){const i=Ei=t.childNodes[2];ct=i.__values__,e.foreground(Na,n,this),ct=t.__values__,Ei=t.childNodes[1],e.content(Na,n,this);const r=Ei=t.childNodes[0];e.background(Na,n,this);const s=n.mark.interactive===!1?"none":null;if(s!==ct.events&&(Et(i,"pointer-events",s),Et(r,"pointer-events",s),ct.events=s),n.strokeForeground&&n.stroke){const o=n.fill;Et(i,"display",null),this.style(r,n),Et(r,"stroke",null),o&&(n.fill=null),ct=i.__values__,this.style(i,n),o&&(n.fill=o),Ei=null}else Et(i,"display","none")},image(e,t,n){n.smooth===!1?(Tl(t,"image-rendering","optimizeSpeed"),Tl(t,"image-rendering","pixelated")):Tl(t,"image-rendering",null)},text(e,t,n){const i=Su(n);let r,s,o,a;F(i)?(s=i.map(u=>dr(n,u)),r=s.join(` +`),r!==ct.text&&(Qt(t,0),o=t.ownerDocument,a=fr(n),s.forEach((u,l)=>{const c=Ji(o,"tspan",je);c.__data__=n,c.textContent=u,l&&(c.setAttribute("x",0),c.setAttribute("dy",a)),t.appendChild(c)}),ct.text=r)):(s=dr(n,i),s!==ct.text&&(t.textContent=s,ct.text=s)),Et(t,"font-family",ku(n)),Et(t,"font-size",oi(n)+"px"),Et(t,"font-style",n.fontStyle),Et(t,"font-variant",n.fontVariant),Et(t,"font-weight",n.fontWeight)}};function Na(e,t,n){t!==ct[e]&&(n?L3(Ei,e,t,n):Et(Ei,e,t),ct[e]=t)}function Tl(e,t,n){n!==ct[t]&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n+""),ct[t]=n)}function Qi(e,t){for(const n in t)Et(e,n,t[n])}function Et(e,t,n){n!=null?e.setAttribute(t,n):e.removeAttribute(t)}function L3(e,t,n,i){n!=null?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}function Rk(){let e;return typeof window>"u"?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}class _k extends $u{constructor(t){super(t),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(t){const n=l0();n.open("svg",re({},Va,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const i=this._bgcolor;return i&&i!=="transparent"&&i!=="none"&&n.open("rect",{width:this._width,height:this._height,fill:i}).close(),n.open("g",Dk,{transform:"translate("+this._origin+")"}),this.mark(n,t),n.close(),this.defs(n),this._text=n.close()+"",this}mark(t,n){const i=Xt[n.marktype],r=i.tag,s=[kk,i.attr];t.open("g",{class:hk(n),"clip-path":n.clip?Um(this,n,n.group):null},$k(n),{"pointer-events":r!=="g"&&n.interactive===!1?"none":null});const o=a=>{const u=this.href(a);if(u&&t.open("a",u),t.open(r,this.attr(n,a,s,r!=="g"?r:null)),r==="text"){const l=Su(a);if(F(l)){const c={x:0,dy:fr(a)};for(let f=0;fthis.mark(t,d)),t.close(),l&&f?(c&&(a.fill=null),a.stroke=f,t.open("path",this.attr(n,a,i.foreground,"bgrect")).close(),c&&(a.fill=c)):t.open("path",this.attr(n,a,i.foreground,"bgfore")).close()}t.close(),u&&t.close()};return i.nested?n.items&&n.items.length&&o(n.items[0]):Cn(n,o),t.close()}href(t){const n=t.href;let i;if(n){if(i=this._hrefs&&this._hrefs[n])return i;this.sanitizeURL(n).then(r=>{r["xlink:href"]=r.href,r.href=null,(this._hrefs||(this._hrefs={}))[n]=r})}return null}attr(t,n,i,r){const s={},o=(a,u,l,c)=>{s[c||a]=u};return Array.isArray(i)?i.forEach(a=>a(o,n,this)):i(o,n,this),r&&P3(s,n,t,r,this._defs),s}defs(t){const n=this._defs.gradient,i=this._defs.clipping;if(Object.keys(n).length+Object.keys(i).length!==0){t.open("defs");for(const s in n){const o=n[s],a=o.stops;o.gradient==="radial"?(t.open("pattern",{id:Jl+s,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+s+")"}).close(),t.close(),t.open("radialGradient",{id:s,fx:o.x1,fy:o.y1,fr:o.r1,cx:o.x2,cy:o.y2,r:o.r2})):t.open("linearGradient",{id:s,x1:o.x1,x2:o.x2,y1:o.y1,y2:o.y2});for(let u=0;u!mn.svgMarkTypes.includes(s));this._svgRenderer.render(t,mn.svgMarkTypes),this._canvasRenderer.render(t,r)}resize(t,n,i,r){return super.resize(t,n,i,r),this._svgRenderer.resize(t,n,i,r),this._canvasRenderer.resize(t,n,i,r),this}background(t){return mn.svgOnTop?this._canvasRenderer.background(t):this._svgRenderer.background(t),this}}class Tk extends Au{constructor(t,n){super(t,n)}initialize(t,n,i){const r=qe(qe(t,0,"div"),mn.svgOnTop?0:1,"div");return super.initialize(r,n,i)}}const Nk="canvas",Mk="hybrid",Lk="png",Pk="svg",Ik="none",Zi={Canvas:Nk,PNG:Lk,SVG:Pk,Hybrid:Mk,None:Ik},ts={};ts[Nk]=ts[Lk]={renderer:ac,headless:ac,handler:Au};ts[Pk]={renderer:c0,headless:_k,handler:vk};ts[Mk]={renderer:op,headless:op,handler:Tk};ts[Ik]={};function hf(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(ts[e]=t,this):ts[e]}function zk(e,t,n){const i=[],r=new Ue().union(t),s=e.marktype;return s?Bk(e,r,n,i):s==="group"?Uk(e,r,n,i):A("Intersect scene must be mark node or group item.")}function Bk(e,t,n,i){if(z3(e,t,n)){const r=e.items,s=e.marktype,o=r.length;let a=0;if(s==="group")for(;a=0;s--)if(n[s]!=i[s])return!1;for(s=n.length-1;s>=0;s--)if(r=n[s],!f0(e[r],t[r],r))return!1;return typeof e==typeof t}function j3(){i5(),fL()}const fo="top",xn="left",vn="right",hr="bottom",q3="top-left",W3="top-right",G3="bottom-left",H3="bottom-right",d0="start",ap="middle",wt="end",V3="x",X3="y",pf="group",h0="axis",p0="title",Y3="frame",K3="scope",g0="legend",Gk="row-header",Hk="row-footer",Vk="row-title",Xk="column-header",Yk="column-footer",Kk="column-title",J3="padding",Q3="symbol",Jk="fit",Qk="fit-x",Zk="fit-y",Z3="pad",m0="none",el="all",up="each",y0="flush",er="column",tr="row";function e$(e){$.call(this,null,e)}z(e$,$,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,s=Xt[r],o=s.bound;let a=i.bounds,u;if(s.nested)i.items.length&&n.dirty(i.items[0]),a=tl(i,o),i.items.forEach(l=>{l.bounds.clear().union(a)});else if(r===pf||e.modified())switch(t.visit(t.MOD,l=>n.dirty(l)),a.clear(),i.items.forEach(l=>a.union(tl(l,o))),i.role){case h0:case g0:case p0:t.reflow()}else u=t.changed(t.REM),t.visit(t.ADD,l=>{a.union(tl(l,o))}),t.visit(t.MOD,l=>{u=u||a.alignsWith(l.bounds),n.dirty(l),a.union(tl(l,o))}),u&&(a.clear(),i.items.forEach(l=>a.union(l.bounds)));return qk(i),t.modifies("bounds")}});function tl(e,t,n){return t(e.bounds.clear(),e,n)}const ox=":vega_identifier:";function b0(e){$.call(this,0,e)}b0.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]};z(b0,$,{transform(e,t){const n=eP(t.dataflow),i=e.as;let r=n.value;return t.visit(t.ADD,s=>s[i]=s[i]||++r),n.set(this.value=r),t}});function eP(e){return e._signals[ox]||(e._signals[ox]=e.add(0))}function t$(e){$.call(this,null,e)}z(t$,$,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,tP(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);const i=n.marktype===pf?sf:rf;return t.visit(t.ADD,r=>i.call(r,n)),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});function tP(e){const t=e.groups,n=e.parent;return t&&t.size===1?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}function n$(e){$.call(this,null,e)}const ax={parity:e=>e.filter((t,n)=>n%2?t.opacity=0:1),greedy:(e,t)=>{let n;return e.filter((i,r)=>!r||!i$(n.bounds,i.bounds,t)?(n=i,1):i.opacity=0)}},i$=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),ux=(e,t)=>{for(var n=1,i=e.length,r=e[0].bounds,s;n{const t=e.bounds;return t.width()>1&&t.height()>1},iP=(e,t,n)=>{var i=e.range(),r=new Ue;return t===fo||t===hr?r.set(i[0],-1/0,i[1],1/0):r.set(-1/0,i[0],1/0,i[1]),r.expand(n||1),s=>r.encloses(s.bounds)},lx=e=>(e.forEach(t=>t.opacity=1),e),cx=(e,t)=>e.reflow(t.modified()).modifies("opacity");z(n$,$,{transform(e,t){const n=ax[e.method]||ax.parity,i=e.separation||0;let r=t.materialize(t.SOURCE).source,s,o;if(!r||!r.length)return;if(!e.method)return e.modified("method")&&(lx(r),t=cx(t,e)),t;if(r=r.filter(nP),!r.length)return;if(e.sort&&(r=r.slice().sort(e.sort)),s=lx(r),t=cx(t,e),s.length>=3&&ux(s,i)){do s=n(s,i);while(s.length>=3&&ux(s,i));s.length<3&&!ue(r).opacity&&(s.length>1&&(ue(s).opacity=0),ue(r).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(o=iP(e.boundScale,e.boundOrient,+e.boundTolerance),r.forEach(u=>{o(u)||(u.opacity=0)}));const a=s[0].mark.bounds.clear();return r.forEach(u=>{u.opacity&&a.union(u.bounds)}),t}});function r$(e){$.call(this,null,e)}z(r$,$,{transform(e,t){const n=t.dataflow;if(t.visit(t.ALL,i=>n.dirty(i)),t.fields&&t.fields.zindex){const i=t.source&&t.source[0];i&&(i.mark.zdirty=!0)}}});const lt=new Ue;function Vs(e,t,n){return e[t]===n?0:(e[t]=n,1)}function rP(e){var t=e.items[0].orient;return t===xn||t===vn}function sP(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}function oP(e,t,n,i){var r=t.items[0],s=r.datum,o=r.translate!=null?r.translate:.5,a=r.orient,u=sP(s),l=r.range,c=r.offset,f=r.position,d=r.minExtent,p=r.maxExtent,h=s.title&&r.items[u[2]].items[0],g=r.titlePadding,m=r.bounds,y=h&&e0(h),b=0,v=0,w,E;switch(lt.clear().union(m),m.clear(),(w=u[0])>-1&&m.union(r.items[w].bounds),(w=u[1])>-1&&m.union(r.items[w].bounds),a){case fo:b=f||0,v=-c,E=Math.max(d,Math.min(p,-m.y1)),m.add(0,-E).add(l,0),h&&nl(e,h,E,g,y,0,-1,m);break;case xn:b=-c,v=f||0,E=Math.max(d,Math.min(p,-m.x1)),m.add(-E,0).add(0,l),h&&nl(e,h,E,g,y,1,-1,m);break;case vn:b=n+c,v=f||0,E=Math.max(d,Math.min(p,m.x2)),m.add(0,0).add(E,l),h&&nl(e,h,E,g,y,1,1,m);break;case hr:b=f||0,v=i+c,E=Math.max(d,Math.min(p,m.y2)),m.add(0,0).add(l,E),h&&nl(e,h,E,g,0,0,1,m);break;default:b=r.x,v=r.y}return _i(m.translate(b,v),r),Vs(r,"x",b+o)|Vs(r,"y",v+o)&&(r.bounds=lt,e.dirty(r),r.bounds=m,e.dirty(r)),r.mark.bounds.clear().union(m)}function nl(e,t,n,i,r,s,o,a){const u=t.bounds;if(t.auto){const l=o*(n+r+i);let c=0,f=0;e.dirty(t),s?c=(t.x||0)-(t.x=l):f=(t.y||0)-(t.y=l),t.mark.bounds.clear().union(u.translate(-c,-f)),e.dirty(t)}a.union(u)}const fx=(e,t)=>Math.floor(Math.min(e,t)),dx=(e,t)=>Math.ceil(Math.max(e,t));function aP(e){var t=e.items,n=t.length,i=0,r,s;const o={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;i1)for(x=0;x0&&(v[x]+=T/2);if(a&&Fe(n.center,tr)&&c!==1)for(x=0;x0&&(w[x]+=O/2);for(x=0;xr&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),g+=s,b=0,w=t.length;b=0&&(x=n[v])==null;v-=d);a?(k=p==null?x.x:Math.round(x.bounds.x1+p*x.bounds.width()),D=g):(k=g,D=p==null?x.y:Math.round(x.bounds.y1+p*x.bounds.height())),E.union(S.bounds.translate(k-(S.x||0),D-(S.y||0))),S.x=k,S.y=D,e.dirty(S),m=o(m,E[l])}return m}function px(e,t,n,i,r,s){if(t){e.dirty(t);var o=n,a=n;i?o=Math.round(r.x1+s*r.width()):a=Math.round(r.y1+s*r.height()),t.bounds.translate(o-(t.x||0),a-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=o,t.y=a,e.dirty(t)}}function hP(e,t){const n=e[t]||{};return(i,r)=>n[i]!=null?n[i]:e[i]!=null?e[i]:r}function pP(e,t){let n=-1/0;return e.forEach(i=>{i.offset!=null&&(n=Math.max(n,i.offset))}),n>-1/0?n:t}function gP(e,t,n,i,r,s,o){const a=hP(n,t),u=pP(e,a("offset",0)),l=a("anchor",d0),c=l===wt?1:l===ap?.5:0,f={align:up,bounds:a("bounds",y0),columns:a("direction")==="vertical"?1:e.length,padding:a("margin",8),center:a("center"),nodirty:!0};switch(t){case xn:f.anchor={x:Math.floor(i.x1)-u,column:wt,y:c*(o||i.height()+2*i.y1),row:l};break;case vn:f.anchor={x:Math.ceil(i.x2)+u,y:c*(o||i.height()+2*i.y1),row:l};break;case fo:f.anchor={y:Math.floor(r.y1)-u,row:wt,x:c*(s||r.width()+2*r.x1),column:l};break;case hr:f.anchor={y:Math.ceil(r.y2)+u,x:c*(s||r.width()+2*r.x1),column:l};break;case q3:f.anchor={x:u,y:u};break;case W3:f.anchor={x:s-u,y:u,column:wt};break;case G3:f.anchor={x:u,y:o-u,row:wt};break;case H3:f.anchor={x:s-u,y:o-u,column:wt,row:wt};break}return f}function mP(e,t){var n=t.items[0],i=n.datum,r=n.orient,s=n.bounds,o=n.x,a=n.y,u,l;return n._bounds?n._bounds.clear().union(s):n._bounds=s.clone(),s.clear(),bP(e,n,n.items[0].items[0]),s=yP(n,s),u=2*n.padding,l=2*n.padding,s.empty()||(u=Math.ceil(s.width()+u),l=Math.ceil(s.height()+l)),i.type===Q3&&xP(n.items[0].items[0].items[0].items),r!==m0&&(n.x=o=0,n.y=a=0),n.width=u,n.height=l,_i(s.set(o,a,o+u,a+l),n),n.mark.bounds.clear().union(s),n}function yP(e,t){return e.items.forEach(n=>t.union(n.bounds)),t.x1=e.padding,t.y1=e.padding,t}function bP(e,t,n){var i=t.padding,r=i-n.x,s=i-n.y;if(!t.datum.title)(r||s)&&sa(e,n,r,s);else{var o=t.items[1].items[0],a=o.anchor,u=t.titlePadding||0,l=i-o.x,c=i-o.y;switch(o.orient){case xn:r+=Math.ceil(o.bounds.width())+u;break;case vn:case hr:break;default:s+=o.bounds.height()+u}switch((r||s)&&sa(e,n,r,s),o.orient){case xn:c+=Ls(t,n,o,a,1,1);break;case vn:l+=Ls(t,n,o,wt,0,0)+u,c+=Ls(t,n,o,a,1,1);break;case hr:l+=Ls(t,n,o,a,0,0),c+=Ls(t,n,o,wt,-1,0,1)+u;break;default:l+=Ls(t,n,o,a,0,0)}(l||c)&&sa(e,o,l,c),(l=Math.round(o.bounds.x1-i))<0&&(sa(e,n,-l,0),sa(e,o,-l,0))}}function Ls(e,t,n,i,r,s,o){const a=e.datum.type!=="symbol",u=n.datum.vgrad,l=a&&(s||!u)&&!o?t.items[0]:t,c=l.bounds[r?"y2":"x2"]-e.padding,f=u&&s?c:0,d=u&&s?0:c,p=r<=0?0:e0(n);return Math.round(i===d0?f:i===wt?d-p:.5*(c-p))}function sa(e,t,n,i){t.x+=n,t.y+=i,t.bounds.translate(n,i),t.mark.bounds.translate(n,i),e.dirty(t)}function xP(e){const t=e.reduce((n,i)=>(n[i.column]=Math.max(i.bounds.x2-i.x,n[i.column]||0),n),{});e.forEach(n=>{n.width=t[n.column],n.height=n.bounds.y2-n.y})}function vP(e,t,n,i,r){var s=t.items[0],o=s.frame,a=s.orient,u=s.anchor,l=s.offset,c=s.padding,f=s.items[0].items[0],d=s.items[1]&&s.items[1].items[0],p=a===xn||a===vn?i:n,h=0,g=0,m=0,y=0,b=0,v;if(o!==pf?a===xn?(h=r.y2,p=r.y1):a===vn?(h=r.y1,p=r.y2):(h=r.x1,p=r.x2):a===xn&&(h=i,p=0),v=u===d0?h:u===wt?p:(h+p)/2,d&&d.text){switch(a){case fo:case hr:b=f.bounds.height()+c;break;case xn:y=f.bounds.width()+c;break;case vn:y=-f.bounds.width()-c;break}lt.clear().union(d.bounds),lt.translate(y-(d.x||0),b-(d.y||0)),Vs(d,"x",y)|Vs(d,"y",b)&&(e.dirty(d),d.bounds.clear().union(lt),d.mark.bounds.clear().union(lt),e.dirty(d)),lt.clear().union(d.bounds)}else lt.clear();switch(lt.union(f.bounds),a){case fo:g=v,m=r.y1-lt.height()-l;break;case xn:g=r.x1-lt.width()-l,m=v;break;case vn:g=r.x2+lt.width()+l,m=v;break;case hr:g=v,m=r.y2+l;break;default:g=s.x,m=s.y}return Vs(s,"x",g)|Vs(s,"y",m)&&(lt.translate(g,m),e.dirty(s),s.bounds.clear().union(lt),t.bounds.clear().union(lt),e.dirty(s)),s.bounds}function o$(e){$.call(this,null,e)}z(o$,$,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach(i=>{e.layout&&cP(n,i,e.layout),wP(n,i,e)}),EP(e.mark.group)?t.reflow():t}});function EP(e){return e&&e.mark.role!=="legend-entry"}function wP(e,t,n){var i=t.items,r=Math.max(0,t.width||0),s=Math.max(0,t.height||0),o=new Ue().set(0,0,r,s),a=o.clone(),u=o.clone(),l=[],c,f,d,p,h,g;for(h=0,g=i.length;h{d=y.orient||vn,d!==m0&&(m[d]||(m[d]=[])).push(y)});for(const y in m){const b=m[y];s$(e,b,gP(b,y,n.legends,a,u,r,s))}l.forEach(y=>{const b=y.bounds;if(b.equals(y._bounds)||(y.bounds=y._bounds,e.dirty(y),y.bounds=b,e.dirty(y)),n.autosize&&(n.autosize.type===Jk||n.autosize.type===Qk||n.autosize.type===Zk))switch(y.orient){case xn:case vn:o.add(b.x1,0).add(b.x2,0);break;case fo:case hr:o.add(0,b.y1).add(0,b.y2)}else o.union(b)})}o.union(a).union(u),c&&o.union(vP(e,c,r,s,o)),t.clip&&o.set(0,0,t.width||0,t.height||0),SP(e,t,o,n)}function SP(e,t,n,i){const r=i.autosize||{},s=r.type;if(e._autosize<1||!s)return;let o=e._width,a=e._height,u=Math.max(0,t.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,t.height||0),f=Math.max(0,Math.ceil(-n.y1));const d=Math.max(0,Math.ceil(n.x2-u)),p=Math.max(0,Math.ceil(n.y2-c));if(r.contains===J3){const h=e.padding();o-=h.left+h.right,a-=h.top+h.bottom}s===m0?(l=0,f=0,u=o,c=a):s===Jk?(u=Math.max(0,o-l-d),c=Math.max(0,a-f-p)):s===Qk?(u=Math.max(0,o-l-d),a=c+f+p):s===Zk?(o=u+l+d,c=Math.max(0,a-f-p)):s===Z3&&(o=u+l+d,a=c+f+p),e._resizeView(o,a,u,c,[l,f],r.resize)}const kP=Object.freeze(Object.defineProperty({__proto__:null,bound:e$,identifier:b0,mark:t$,overlap:n$,render:r$,viewlayout:o$},Symbol.toStringTag,{value:"Module"}));function a$(e){$.call(this,null,e)}z(a$,$,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,s=e.scale,o=e.count==null?e.values?e.values.length:10:e.count,a=Lm(s,o,e.minstep),u=e.format||M2(n,s,a,e.formatSpecifier,e.formatType,!!e.values),l=e.values?N2(s,e.values,a):Pm(s,a);return r&&(i.rem=r),r=l.map((c,f)=>ge({index:f/(l.length-1||1),value:c,label:u(c)})),e.extra&&r.length&&r.push(ge({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}});function u$(e){$.call(this,null,e)}function $P(){return ge({})}function AP(e){const t=Mo().test(n=>n.exit);return t.lookup=n=>t.get(e(n)),t}z(u$,$,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||$P,s=e.key||Q,o=this.value;return F(i.encode)&&(i.encode=null),o&&(e.modified("key")||t.modified(s))&&A("DataJoin does not support modified key function or fields."),o||(t=t.addAll(),this.value=o=AP(s)),t.visit(t.ADD,a=>{const u=s(a);let l=o.get(u);l?l.exit?(o.empty--,i.add.push(l)):i.mod.push(l):(l=r(a),o.set(u,l),i.add.push(l)),l.datum=a,l.exit=!1}),t.visit(t.MOD,a=>{const u=s(a),l=o.get(u);l&&(l.datum=a,i.mod.push(l))}),t.visit(t.REM,a=>{const u=s(a),l=o.get(u);a===l.datum&&!l.exit&&(i.rem.push(l),l.exit=!0,++o.empty)}),t.changed(t.ADD_MOD)&&i.modifies("datum"),(t.clean()||e.clean&&o.empty>n.cleanThreshold)&&n.runAfter(o.clean),i}});function l$(e){$.call(this,null,e)}z(l$,$,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,s=t.encode;if(F(s))if(n.changed()||s.every(f=>r[f]))s=s[0],n.encode=null;else return t.StopPropagation;var o=s==="enter",a=r.update||ji,u=r.enter||ji,l=r.exit||ji,c=(s&&!o?r[s]:a)||ji;if(t.changed(t.ADD)&&(t.visit(t.ADD,f=>{u(f,e),a(f,e)}),n.modifies(u.output),n.modifies(a.output),c!==ji&&c!==a&&(t.visit(t.ADD,f=>{c(f,e)}),n.modifies(c.output))),t.changed(t.REM)&&l!==ji&&(t.visit(t.REM,f=>{l(f,e)}),n.modifies(l.output)),o||c!==ji){const f=t.MOD|(e.modified()?t.REFLOW:0);o?(t.visit(f,d=>{const p=u(d,e)||i;(c(d,e)||p)&&n.mod.push(d)}),n.mod.length&&n.modifies(u.output)):t.visit(f,d=>{(c(d,e)||i)&&n.mod.push(d)}),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation}});function c$(e){$.call(this,[],e)}z(c$,$,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,s=e.type||$l,o=e.scale,a=+e.limit,u=Lm(o,e.count==null?5:e.count,e.minstep),l=!!e.values||s===$l,c=e.format||z2(n,o,u,s,e.formatSpecifier,e.formatType,l),f=e.values||I2(o,u),d,p,h,g,m;return r&&(i.rem=r),s===$l?(a&&f.length>a?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),r=f.slice(0,a-1),m=!0):r=f,ie(h=e.size)?(!e.values&&o(r[0])===0&&(r=r.slice(1)),g=r.reduce((y,b)=>Math.max(y,h(b,e)),0)):h=xt(g=h||8),r=r.map((y,b)=>ge({index:b,label:c(y,b,r),value:y,offset:g,size:h(y,e)})),m&&(m=f[r.length],r.push(ge({index:r.length,label:`…${f.length-r.length} entries`,value:m,offset:g,size:h(m,e)})))):s===QM?(d=o.domain(),p=R2(o,d[0],ue(d)),f.length<3&&!e.values&&d[0]!==ue(d)&&(f=[d[0],ue(d)]),r=f.map((y,b)=>ge({index:b,label:c(y,b,f),value:y,perc:p(y)}))):(h=f.length-1,p=lL(o),r=f.map((y,b)=>ge({index:b,label:c(y,b,f),value:y,perc:b?p(y):0,perc2:b===h?1:p(f[b+1])}))),i.source=r,i.add=r,this.value=r,i}});const CP=e=>e.source.x,FP=e=>e.source.y,OP=e=>e.target.x,DP=e=>e.target.y;function x0(e){$.call(this,{},e)}x0.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]};z(x0,$,{transform(e,t){var n=e.sourceX||CP,i=e.sourceY||FP,r=e.targetX||OP,s=e.targetY||DP,o=e.as||"path",a=e.orient||"vertical",u=e.shape||"line",l=gx.get(u+"-"+a)||gx.get(u);return l||A("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,c=>{c[o]=l(n(c),i(c),r(c),s(c))}),t.reflow(e.modified()).modifies(o)}});const f$=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,RP=(e,t,n,i)=>f$(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),d$=(e,t,n,i)=>{var r=n-e,s=i-t,o=Math.hypot(r,s)/2,a=180*Math.atan2(s,r)/Math.PI;return"M"+e+","+t+"A"+o+","+o+" "+a+" 0 1 "+n+","+i},_P=(e,t,n,i)=>d$(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),h$=(e,t,n,i)=>{const r=n-e,s=i-t,o=.2*(r+s),a=.2*(s-r);return"M"+e+","+t+"C"+(e+o)+","+(t+a)+" "+(n+a)+","+(i-o)+" "+n+","+i},TP=(e,t,n,i)=>h$(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),NP=(e,t,n,i)=>"M"+e+","+t+"V"+i+"H"+n,MP=(e,t,n,i)=>"M"+e+","+t+"H"+n+"V"+i,LP=(e,t,n,i)=>{const r=Math.cos(e),s=Math.sin(e),o=Math.cos(n),a=Math.sin(n),u=Math.abs(n-e)>Math.PI?n<=e:n>e;return"M"+t*r+","+t*s+"A"+t+","+t+" 0 0,"+(u?1:0)+" "+t*o+","+t*a+"L"+i*o+","+i*a},PP=(e,t,n,i)=>{const r=(e+n)/2;return"M"+e+","+t+"C"+r+","+t+" "+r+","+i+" "+n+","+i},IP=(e,t,n,i)=>{const r=(t+i)/2;return"M"+e+","+t+"C"+e+","+r+" "+n+","+r+" "+n+","+i},zP=(e,t,n,i)=>{const r=Math.cos(e),s=Math.sin(e),o=Math.cos(n),a=Math.sin(n),u=(t+i)/2;return"M"+t*r+","+t*s+"C"+u*r+","+u*s+" "+u*o+","+u*a+" "+i*o+","+i*a},gx=Mo({line:f$,"line-radial":RP,arc:d$,"arc-radial":_P,curve:h$,"curve-radial":TP,"orthogonal-horizontal":NP,"orthogonal-vertical":MP,"orthogonal-radial":LP,"diagonal-horizontal":PP,"diagonal-vertical":IP,"diagonal-radial":zP});function v0(e){$.call(this,null,e)}v0.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]};z(v0,$,{transform(e,t){var n=e.as||["startAngle","endAngle"],i=n[0],r=n[1],s=e.field||Ro,o=e.startAngle||0,a=e.endAngle!=null?e.endAngle:2*Math.PI,u=t.source,l=u.map(s),c=l.length,f=o,d=(a-o)/yw(l),p=ys(c),h,g,m;for(e.sort&&p.sort((y,b)=>l[y]-l[b]),h=0;h-1)return i;var r=t.domain,s=e.type,o=t.zero||t.zero===void 0&&UP(e),a,u;if(!r)return 0;if((o||t.domainMin!=null||t.domainMax!=null||t.domainMid!=null)&&(a=(r=r.slice()).length-1||1,o&&(r[0]>0&&(r[0]=0),r[a]<0&&(r[a]=0)),t.domainMin!=null&&(r[0]=t.domainMin),t.domainMax!=null&&(r[a]=t.domainMax),t.domainMid!=null)){u=t.domainMid;const l=u>r[a]?a+1:ur+(s<0?-1:s>0?1:0),0));i!==t.length&&n.warn("Log scale domain includes zero: "+L(t))}return t}function XP(e,t,n){let i=t.bins;if(i&&!F(i)){const r=e.domain(),s=r[0],o=ue(r),a=i.step;let u=i.start==null?s:i.start,l=i.stop==null?o:i.stop;a||A("Scale bins parameter missing step property."),uo&&(l=a*Math.floor(o/a)),i=ys(u,l+a/2,a)}return i?e.bins=i:e.bins&&delete e.bins,e.type===Dm&&(i?!t.domain&&!t.domainRaw&&(e.domain(i),n=i.length):e.bins=e.domain()),n}function YP(e,t,n){var i=e.type,r=t.round||!1,s=t.range;if(t.rangeStep!=null)s=KP(i,t,n);else if(t.scheme&&(s=JP(i,t,n),ie(s))){if(e.interpolator)return e.interpolator(s);A(`Scale type ${i} does not support interpolating color schemes.`)}if(s&&C2(i))return e.interpolator(tf(lp(s,t.reverse),t.interpolate,t.interpolateGamma));s&&t.interpolate&&e.interpolate?e.interpolate(Nm(t.interpolate,t.interpolateGamma)):ie(e.round)?e.round(r):ie(e.rangeRound)&&e.interpolate(r?y_:b_),s&&e.range(lp(s,t.reverse))}function KP(e,t,n){e!==v2&&e!==Xh&&A("Only band and point scales support rangeStep.");var i=(t.paddingOuter!=null?t.paddingOuter:t.padding)||0,r=e===Xh?1:(t.paddingInner!=null?t.paddingInner:t.padding)||0;return[0,t.rangeStep*Fm(n,r,i)]}function JP(e,t,n){var i=t.schemeExtent,r,s;return F(t.scheme)?s=tf(t.scheme,t.interpolate,t.interpolateGamma):(r=t.scheme.toLowerCase(),s=Mm(r),s||A(`Unrecognized scheme name: ${t.scheme}`)),n=e===ef?n+1:e===Dm?n-1:e===oo||e===Zc?+t.schemeCount||BP:n,C2(e)?mx(s,i,t.reverse):ie(s)?D2(mx(s,i),n):e===Om?s:s.slice(0,n)}function mx(e,t,n){return ie(e)&&(t||n)?O2(e,lp(t||[0,1],n)):e}function lp(e,t){return t?e.slice().reverse():e}function y$(e){$.call(this,null,e)}z(y$,$,{transform(e,t){const n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(xs(e.sort)),this.modified(n),t}});const yx="zero",b$="center",x$="normalize",v$=["y0","y1"];function E0(e){$.call(this,null,e)}E0.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:yx,values:[yx,b$,x$]},{name:"as",type:"string",array:!0,length:2,default:v$}]};z(E0,$,{transform(e,t){var n=e.as||v$,i=n[0],r=n[1],s=xs(e.sort),o=e.field||Ro,a=e.offset===b$?QP:e.offset===x$?ZP:eI,u,l,c,f;for(u=tI(t.source,e.groupby,s,o),l=0,c=u.length,f=u.max;lg(c),o,a,u,l,c,f,d,p,h;if(t==null)r.push(e.slice());else for(o={},a=0,u=e.length;ah&&(h=p),n&&d.sort(n)}return r.max=h,r}const nI=Object.freeze(Object.defineProperty({__proto__:null,axisticks:a$,datajoin:u$,encode:l$,legendentries:c$,linkpath:x0,pie:v0,scale:g$,sortitems:y$,stack:E0},Symbol.toStringTag,{value:"Module"})),iI=bw(),cp=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function rI(e,t){return function n(){const i=t();return i.type=e,i.path=bw().projection(i),i.copy=i.copy||function(){const r=n();return cp.forEach(s=>{i[s]&&r[s](i[s]())}),r.path.pointRadius(i.path.pointRadius()),r},k2(i)}}function w0(e,t){if(!e||typeof e!="string")throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(cc[e]=rI(e,t),this):cc[e]||null}function E$(e){return e&&e.path||iI}const cc={albers:jR,albersusa:UR,azimuthalequalarea:BR,azimuthalequidistant:zR,conicconformal:IR,conicequalarea:PR,conicequidistant:LR,equalEarth:MR,equirectangular:NR,gnomonic:TR,identity:_R,mercator:RR,mollweide:DR,naturalEarth1:OR,orthographic:FR,stereographic:CR,transversemercator:AR};for(const e in cc)w0(e,cc[e]);function sI(){}const mi=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function w$(){var e=1,t=1,n=a;function i(u,l){return l.map(c=>r(u,c))}function r(u,l){var c=[],f=[];return s(u,l,d=>{n(d,u,l),oI(d)>0?c.push([d]):f.push(d)}),f.forEach(d=>{for(var p=0,h=c.length,g;p=l,mi[m<<1].forEach(v);++p=l,mi[g|m<<1].forEach(v);for(mi[m<<0].forEach(v);++h=l,y=u[h*e]>=l,mi[m<<1|y<<2].forEach(v);++p=l,b=y,y=u[h*e+p+1]>=l,mi[g|m<<1|y<<2|b<<3].forEach(v);mi[m|y<<3].forEach(v)}for(p=-1,y=u[h*e]>=l,mi[y<<2].forEach(v);++p=l,mi[y<<2|b<<3].forEach(v);mi[y<<3].forEach(v);function v(w){var E=[w[0][0]+p,w[0][1]+h],S=[w[1][0]+p,w[1][1]+h],x=o(E),k=o(S),D,P;(D=d[x])?(P=f[k])?(delete d[D.end],delete f[P.start],D===P?(D.ring.push(S),c(D.ring)):f[D.start]=d[P.end]={start:D.start,end:P.end,ring:D.ring.concat(P.ring)}):(delete d[D.end],D.ring.push(S),d[D.end=k]=D):(D=f[k])?(P=d[x])?(delete f[D.start],delete d[P.end],D===P?(D.ring.push(S),c(D.ring)):f[P.start]=d[D.end]={start:P.start,end:D.end,ring:P.ring.concat(D.ring)}):(delete f[D.start],D.ring.unshift(E),f[D.start=x]=D):f[x]=d[k]={start:x,end:k,ring:[E,S]}}}function o(u){return u[0]*2+u[1]*(e+1)*4}function a(u,l,c){u.forEach(f=>{var d=f[0],p=f[1],h=d|0,g=p|0,m,y=l[g*e+h];d>0&&d0&&p=0&&c>=0||A("invalid size"),e=l,t=c,i},i.smooth=function(u){return arguments.length?(n=u?a:sI,i):n===a},i}function oI(e){for(var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++ti!=p>i&&n<(d-l)*(i-c)/(p-c)+l&&(r=-r)}return r}function lI(e,t,n){var i;return cI(e,t,n)&&fI(e[i=+(e[0]===t[0])],n[i],t[i])}function cI(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function fI(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function S$(e,t,n){return function(i){var r=Zn(i),s=n?Math.min(r[0],0):r[0],o=r[1],a=o-s,u=t?Ua(s,o,e):a/(e+1);return ys(s+u,o,u)}}function S0(e){$.call(this,null,e)}S0.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]};z(S0,$,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,r=e.field||bt,s=w$().smooth(e.smooth!==!1),o=e.thresholds||dI(i,r,e),a=e.as===null?null:e.as||"contour",u=[];return i.forEach(l=>{const c=r(l),f=s.size([c.width,c.height])(c.values,F(o)?o:o(c.values));hI(f,c,l,e),f.forEach(d=>{u.push(qc(l,ge(a!=null?{[a]:d}:d)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}});function dI(e,t,n){const i=S$(n.levels||10,n.nice,n.zero!==!1);return n.resolve!=="shared"?i:i(e.map(r=>Ra(t(r).values)))}function hI(e,t,n,i){let r=i.scale||t.scale,s=i.translate||t.translate;if(ie(r)&&(r=r(n,i)),ie(s)&&(s=s(n,i)),(r===1||r==null)&&!s)return;const o=(de(r)?r:r[0])||1,a=(de(r)?r:r[1])||1,u=s&&s[0]||0,l=s&&s[1]||0;e.forEach(k$(t,o,a,u,l))}function k$(e,t,n,i,r){const s=e.x1||0,o=e.y1||0,a=t*n<0;function u(f){f.forEach(l)}function l(f){a&&f.reverse(),f.forEach(c)}function c(f){f[0]=(f[0]-s)*t+i,f[1]=(f[1]-o)*n+r}return function(f){return f.coordinates.forEach(u),f}}function bx(e,t,n){const i=e>=0?e:jg(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function Nd(e){return ie(e)?e:xt(+e)}function $$(){var e=u=>u[0],t=u=>u[1],n=Ro,i=[-1,-1],r=960,s=500,o=2;function a(u,l){const c=bx(i[0],u,e)>>o,f=bx(i[1],u,t)>>o,d=c?c+2:0,p=f?f+2:0,h=2*d+(r>>o),g=2*p+(s>>o),m=new Float32Array(h*g),y=new Float32Array(h*g);let b=m;u.forEach(w=>{const E=d+(+e(w)>>o),S=p+(+t(w)>>o);E>=0&&E=0&&S0&&f>0?(Ps(h,g,m,y,c),Is(h,g,y,m,f),Ps(h,g,m,y,c),Is(h,g,y,m,f),Ps(h,g,m,y,c),Is(h,g,y,m,f)):c>0?(Ps(h,g,m,y,c),Ps(h,g,y,m,c),Ps(h,g,m,y,c),b=y):f>0&&(Is(h,g,m,y,f),Is(h,g,y,m,f),Is(h,g,m,y,f),b=y);const v=l?Math.pow(2,-2*o):1/yw(b);for(let w=0,E=h*g;w>o),y2:p+(s>>o)}}return a.x=function(u){return arguments.length?(e=Nd(u),a):e},a.y=function(u){return arguments.length?(t=Nd(u),a):t},a.weight=function(u){return arguments.length?(n=Nd(u),a):n},a.size=function(u){if(!arguments.length)return[r,s];var l=+u[0],c=+u[1];return l>=0&&c>=0||A("invalid size"),r=l,s=c,a},a.cellSize=function(u){return arguments.length?((u=+u)>=1||A("invalid cell size"),o=Math.floor(Math.log(u)/Math.LN2),a):1<=r&&(a>=s&&(u-=n[a-s+o*e]),i[a-r+o*e]=u/Math.min(a+1,e-1+s-a,s))}function Is(e,t,n,i,r){const s=(r<<1)+1;for(let o=0;o=r&&(a>=s&&(u-=n[o+(a-s)*e]),i[o+(a-r)*e]=u/Math.min(a+1,t-1+s-a,s))}function k0(e){$.call(this,null,e)}k0.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const pI=["x","y","weight","size","cellSize","bandwidth"];function A$(e,t){return pI.forEach(n=>t[n]!=null?e[n](t[n]):0),e}z(k0,$,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,r=gI(i,e.groupby),s=(e.groupby||[]).map(Me),o=A$($$(),e),a=e.as||"grid",u=[];function l(c,f){for(let d=0;dge(l({[a]:o(c,e.counts)},c.dims))),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}});function gI(e,t){var n=[],i=c=>c(a),r,s,o,a,u,l;if(t==null)n.push(e);else for(r={},s=0,o=e.length;sn.push(a(c))),s&&o&&(t.visit(u,c=>{var f=s(c),d=o(c);f!=null&&d!=null&&(f=+f)===f&&(d=+d)===d&&i.push([f,d])}),n=n.concat({type:fp,geometry:{type:mI,coordinates:i}})),this.value={type:A0,features:n}}});function F0(e){$.call(this,null,e)}F0.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]};z(F0,$,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||bt,s=e.as||"path",o=n.SOURCE;!i||e.modified()?(this.value=i=E$(e.projection),n.materialize().reflow()):o=r===bt||t.modified(r.fields)?n.ADD_MOD:n.ADD;const a=yI(i,e.pointRadius);return n.visit(o,u=>u[s]=i(r(u))),i.pointRadius(a),n.modifies(s)}});function yI(e,t){const n=e.pointRadius();return e.context(null),t!=null&&e.pointRadius(t),n}function O0(e){$.call(this,null,e)}O0.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]};z(O0,$,{transform(e,t){var n=e.projection,i=e.fields[0],r=e.fields[1],s=e.as||["x","y"],o=s[0],a=s[1],u;function l(c){const f=n([i(c),r(c)]);f?(c[o]=f[0],c[a]=f[1]):(c[o]=void 0,c[a]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(u=t.modified(i.fields)||t.modified(r.fields),t.visit(u?t.ADD_MOD:t.ADD,l)),t.modifies(s)}});function D0(e){$.call(this,null,e)}D0.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]};z(D0,$,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.as||"shape",s=n.ADD;return(!i||e.modified())&&(this.value=i=bI(E$(e.projection),e.field||rn("datum"),e.pointRadius),n.materialize().reflow(),s=n.SOURCE),n.visit(s,o=>o[r]=i),n.modifies(r)}});function bI(e,t,n){const i=n==null?r=>e(t(r)):r=>{var s=e.pointRadius(),o=e.pointRadius(n)(t(r));return e.pointRadius(s),o};return i.context=r=>(e.context(r),i),i}function R0(e){$.call(this,[],e),this.generator=qR()}R0.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]};z(R0,$,{transform(e,t){var n=this.value,i=this.generator,r;if(!n.length||e.modified())for(const s in e)ie(i[s])&&i[s](e[s]);return r=i(),n.length?t.mod.push(FS(n[0],r)):t.add.push(ge(r)),n[0]=r,t}});function _0(e){$.call(this,null,e)}_0.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]};z(_0,$,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,i=e.resolve==="shared",r=e.field||bt,s=vI(e.opacity,e),o=xI(e.color,e),a=e.as||"image",u={$x:0,$y:0,$value:0,$max:i?Ra(n.map(l=>Ra(r(l).values))):0};return n.forEach(l=>{const c=r(l),f=re({},l,u);i||(f.$max=Ra(c.values||[])),l[a]=EI(c,f,o.dep?o:xt(o(f)),s.dep?s:xt(s(f)))}),t.reflow(!0).modifies(a)}});function xI(e,t){let n;return ie(e)?(n=i=>Gl(e(i,t)),n.dep=C$(e)):n=xt(Gl(e||"#888")),n}function vI(e,t){let n;return ie(e)?(n=i=>e(i,t),n.dep=C$(e)):e?n=xt(e):(n=i=>i.$value/i.$max||0,n.dep=!0),n}function C$(e){if(!ie(e))return!1;const t=$n(pt(e));return t.$x||t.$y||t.$value||t.$max}function EI(e,t,n,i){const r=e.width,s=e.height,o=e.x1||0,a=e.y1||0,u=e.x2||r,l=e.y2||s,c=e.values,f=c?m=>c[m]:Yi,d=or(u-o,l-a),p=d.getContext("2d"),h=p.getImageData(0,0,u-o,l-a),g=h.data;for(let m=a,y=0;m{e[i]!=null&&xx(n,i,e[i])})):cp.forEach(i=>{e.modified(i)&&xx(n,i,e[i])}),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&wI(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function wI(e,t){const n=kI(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}function SI(e){const t=w0((e||"mercator").toLowerCase());return t||A("Unrecognized projection type: "+e),t()}function xx(e,t,n){ie(e[t])&&e[t](n)}function kI(e){return e=q(e),e.length===1?e[0]:{type:A0,features:e.reduce((t,n)=>t.concat($I(n)),[])}}function $I(e){return e.type===A0?e.features:q(e).filter(t=>t!=null).map(t=>t.type===fp?t:{type:fp,geometry:t})}const AI=Object.freeze(Object.defineProperty({__proto__:null,contour:$0,geojson:C0,geopath:F0,geopoint:O0,geoshape:D0,graticule:R0,heatmap:_0,isocontour:S0,kde2d:k0,projection:F$},Symbol.toStringTag,{value:"Module"})),vx={center:KR,collide:YR,nbody:XR,link:VR,x:HR,y:GR},Aa="forces",dp=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],CI=["static","iterations"],O$=["x","y","vx","vy"];function T0(e){$.call(this,null,e)}T0.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:O$}]};z(T0,$,{transform(e,t){var n=this.value,i=t.changed(t.ADD_REM),r=e.modified(dp),s=e.iterations||300;if(n?(i&&(t.modifies("index"),n.nodes(t.source)),(r||t.changed(t.MOD))&&D$(n,e,0,t)):(this.value=n=OI(t.source,e),n.on("tick",FI(t.dataflow,this)),e.static||(i=!0,n.tick()),t.modifies("index")),r||i||e.modified(CI)||t.changed()&&e.restart){if(n.alpha(Math.max(n.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(n.alphaMin(),1/s)),e.static)for(n.stop();--s>=0;)n.tick();else if(n.stopped()&&n.restart(),!i)return t.StopPropagation}return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let a=this._argops,u=0,l=a.length,c;ue.touch(t).run()}function OI(e,t){const n=WR(e),i=n.stop,r=n.restart;let s=!1;return n.stopped=()=>s,n.restart=()=>(s=!1,r()),n.stop=()=>(s=!0,i()),D$(n,t,!0).on("end",()=>s=!0)}function D$(e,t,n,i){var r=q(t.forces),s,o,a,u;for(s=0,o=dp.length;st(i,n):t)}const TI=Object.freeze(Object.defineProperty({__proto__:null,force:T0},Symbol.toStringTag,{value:"Module"}));function hp(e,t,n){const i={};return e.each(r=>{const s=r.data;n(s)&&(i[t(s)]=r)}),e.lookup=i,e}function N0(e){$.call(this,null,e)}N0.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const NI=e=>e.values;z(N0,$,{transform(e,t){t.source||A("Nest transform requires an upstream data source.");var n=e.generate,i=e.modified(),r=t.clone(),s=this.value;return(!s||i||t.changed())&&(s&&s.each(o=>{o.children&&jc(o.data)&&r.rem.push(o.data)}),this.value=s=aT({values:q(e.keys).reduce((o,a)=>(o.key(a),o),MI()).entries(r.source)},NI),n&&s.each(o=>{o.children&&(o=ge(o.data),r.add.push(o),r.source.push(o))}),hp(s,Q,Q)),r.source.root=s,r}});function MI(){const e=[],t={entries:r=>i(n(r,0),0),key:r=>(e.push(r),t)};function n(r,s){if(s>=e.length)return r;const o=r.length,a=e[s++],u={},l={};let c=-1,f,d,p;for(;++ce.length)return r;const o=[];for(const a in r)o.push({key:a,values:i(r[a],s)});return o}return t}function Ti(e){$.call(this,null,e)}const LI=(e,t)=>e.parent===t.parent?1:2;z(Ti,$,{transform(e,t){(!t.source||!t.source.root)&&A(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),i=this.fields,r=t.source.root,s=e.as||i;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(xs(e.sort,o=>o.data)),PI(n,this.params,e),n.separation&&n.separation(e.separation!==!1?LI:Ro);try{this.value=n(r)}catch(o){A(o)}return r.each(o=>II(o,i,s)),t.reflow(e.modified()).modifies(s).modifies("leaf")}});function PI(e,t,n){for(let i,r=0,s=t.length;rs[Q(o)]=1),i.each(o=>{const a=o.data,u=o.parent&&o.parent.data;u&&s[Q(a)]&&s[Q(u)]&&r.add.push(ge({source:u,target:a}))}),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,o=>s[Q(o)]=1),n.forEach(o=>{(s[Q(o.source)]||s[Q(o.target)])&&r.mod.push(o)})),r}});const wx={binary:i_,dice:fT,slice:cT,slicedice:n_,squarify:lT,resquarify:t_},yp=["x0","y0","x1","y1","depth","children"];function B0(e){Ti.call(this,e)}B0.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:yp.length,default:yp}]};z(B0,Ti,{layout(){const e=uT();return e.ratio=t=>{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{G(wx,t)?e.tile(wx[t]):A("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:yp});const zI=Object.freeze(Object.defineProperty({__proto__:null,nest:N0,pack:M0,partition:L0,stratify:P0,tree:I0,treelinks:z0,treemap:B0},Symbol.toStringTag,{value:"Module"})),Md=4278190080;function BI(e,t){const n=e.bitmap();return(t||[]).forEach(i=>n.set(e(i.boundary[0]),e(i.boundary[3]))),[n,void 0]}function UI(e,t,n,i,r){const s=e.width,o=e.height,a=i||r,u=or(s,o).getContext("2d"),l=or(s,o).getContext("2d"),c=a&&or(s,o).getContext("2d");n.forEach(k=>Nl(u,k,!1)),Nl(l,t,!1),a&&Nl(c,t,!0);const f=Ld(u,s,o),d=Ld(l,s,o),p=a&&Ld(c,s,o),h=e.bitmap(),g=a&&e.bitmap();let m,y,b,v,w,E,S,x;for(y=0;y{r.items.forEach(s=>Nl(e,s.items,n))}):Xt[i].draw(e,{items:n?t.map(jI):t})}function jI(e){const t=qc(e,{});return t.stroke&&t.strokeOpacity!==0||t.fill&&t.fillOpacity!==0?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const yi=5,vt=31,Xa=32,Vi=new Uint32Array(Xa+1),bn=new Uint32Array(Xa+1);bn[0]=0;Vi[0]=~bn[0];for(let e=1;e<=Xa;++e)bn[e]=bn[e-1]<<1|1,Vi[e]=~bn[e];function qI(e,t){const n=new Uint32Array(~~((e*t+Xa)/Xa));function i(s,o){n[s]|=o}function r(s,o){n[s]&=o}return{array:n,get:(s,o)=>{const a=o*e+s;return n[a>>>yi]&1<<(a&vt)},set:(s,o)=>{const a=o*e+s;i(a>>>yi,1<<(a&vt))},clear:(s,o)=>{const a=o*e+s;r(a>>>yi,~(1<<(a&vt)))},getRange:(s,o,a,u)=>{let l=u,c,f,d,p;for(;l>=o;--l)if(c=l*e+s,f=l*e+a,d=c>>>yi,p=f>>>yi,d===p){if(n[d]&Vi[c&vt]&bn[(f&vt)+1])return!0}else{if(n[d]&Vi[c&vt]||n[p]&bn[(f&vt)+1])return!0;for(let h=d+1;h{let l,c,f,d,p;for(;o<=u;++o)if(l=o*e+s,c=o*e+a,f=l>>>yi,d=c>>>yi,f===d)i(f,Vi[l&vt]&bn[(c&vt)+1]);else for(i(f,Vi[l&vt]),i(d,bn[(c&vt)+1]),p=f+1;p{let l,c,f,d,p;for(;o<=u;++o)if(l=o*e+s,c=o*e+a,f=l>>>yi,d=c>>>yi,f===d)r(f,bn[l&vt]|Vi[(c&vt)+1]);else for(r(f,bn[l&vt]),r(d,Vi[(c&vt)+1]),p=f+1;ps<0||o<0||u>=t||a>=e}}function WI(e,t,n){const i=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+i)/i),s=~~((t+2*n+i)/i),o=a=>~~((a+n)/i);return o.invert=a=>a*i-n,o.bitmap=()=>qI(r,s),o.ratio=i,o.padding=n,o.width=e,o.height=t,o}function GI(e,t,n,i){const r=e.width,s=e.height;return function(o){const a=o.datum.datum.items[i].items,u=a.length,l=o.datum.fontSize,c=jt.width(o.datum,o.datum.text);let f=0,d,p,h,g,m,y,b;for(let v=0;v=f&&(f=b,o.x=m,o.y=y);return m=c/2,y=l/2,d=o.x-m,p=o.x+m,h=o.y-y,g=o.y+y,o.align="center",d<0&&p<=r?o.align="left":0<=d&&rr||t-(o=i/2)<0||t+o>s}function nr(e,t,n,i,r,s,o,a){const u=r*s/(i*2),l=e(t-u),c=e(t+u),f=e(n-(s=s/2)),d=e(n+s);return o.outOfBounds(l,f,c,d)||o.getRange(l,f,c,d)||a&&a.getRange(l,f,c,d)}function HI(e,t,n,i){const r=e.width,s=e.height,o=t[0],a=t[1];function u(l,c,f,d,p){const h=e.invert(l),g=e.invert(c);let m=f,y=s,b;if(!fc(h,g,d,p,r,s)&&!nr(e,h,g,p,d,m,o,a)&&!nr(e,h,g,p,d,p,o,null)){for(;y-m>=1;)b=(m+y)/2,nr(e,h,g,p,d,b,o,a)?y=b:m=b;if(m>f)return[h,g,m,!0]}}return function(l){const c=l.datum.datum.items[i].items,f=c.length,d=l.datum.fontSize,p=jt.width(l.datum,l.datum.text);let h=n?d:0,g=!1,m=!1,y=0,b,v,w,E,S,x,k,D,P,K,ee,ce,T,O,I,W,V;for(let H=0;Hv&&(V=b,b=v,v=V),w>E&&(V=w,w=E,E=V),P=e(b),ee=e(v),K=~~((P+ee)/2),ce=e(w),O=e(E),T=~~((ce+O)/2),k=K;k>=P;--k)for(D=T;D>=ce;--D)W=u(k,D,h,p,d),W&&([l.x,l.y,h,g]=W);for(k=K;k<=ee;++k)for(D=T;D<=O;++D)W=u(k,D,h,p,d),W&&([l.x,l.y,h,g]=W);!g&&!n&&(I=Math.abs(v-b+E-w),S=(b+v)/2,x=(w+E)/2,I>=y&&!fc(S,x,p,d,r,s)&&!nr(e,S,x,d,p,d,o,null)&&(y=I,l.x=S,l.y=x,m=!0))}return g||m?(S=p/2,x=d/2,o.setRange(e(l.x-S),e(l.y-x),e(l.x+S),e(l.y+x)),l.align="center",l.baseline="middle",!0):!1}}const VI=[-1,-1,1,1],XI=[-1,1,-1,1];function YI(e,t,n,i){const r=e.width,s=e.height,o=t[0],a=t[1],u=e.bitmap();return function(l){const c=l.datum.datum.items[i].items,f=c.length,d=l.datum.fontSize,p=jt.width(l.datum,l.datum.text),h=[];let g=n?d:0,m=!1,y=!1,b=0,v,w,E,S,x,k,D,P,K,ee,ce,T;for(let O=0;O=1;)ce=(K+ee)/2,nr(e,x,k,d,p,ce,o,a)?ee=ce:K=ce;K>g&&(l.x=x,l.y=k,g=K,m=!0)}}!m&&!n&&(T=Math.abs(w-v+S-E),x=(v+w)/2,k=(E+S)/2,T>=b&&!fc(x,k,p,d,r,s)&&!nr(e,x,k,d,p,d,o,null)&&(b=T,l.x=x,l.y=k,y=!0))}return m||y?(x=p/2,k=d/2,o.setRange(e(l.x-x),e(l.y-k),e(l.x+x),e(l.y+k)),l.align="center",l.baseline="middle",!0):!1}}const KI=["right","center","left"],JI=["bottom","middle","top"];function QI(e,t,n,i){const r=e.width,s=e.height,o=t[0],a=t[1],u=i.length;return function(l){const c=l.boundary,f=l.datum.fontSize;if(c[2]<0||c[5]<0||c[0]>r||c[3]>s)return!1;let d=l.textWidth??0,p,h,g,m,y,b,v,w,E,S,x,k,D,P,K;for(let ee=0;ee>>2&3)-1,g=p===0&&h===0||i[ee]<0,m=p&&h?Math.SQRT1_2:1,y=i[ee]<0?-1:1,b=c[1+p]+i[ee]*p*m,x=c[4+h]+y*f*h/2+i[ee]*h*m,w=x-f/2,E=x+f/2,k=e(b),P=e(w),K=e(E),!d)if(Sx(k,k,P,K,o,a,b,b,w,E,c,g))d=jt.width(l.datum,l.datum.text);else continue;if(S=b+y*d*p/2,b=S-d/2,v=S+d/2,k=e(b),D=e(v),Sx(k,D,P,K,o,a,b,v,w,E,c,g))return l.x=p?p*y<0?v:b:S,l.y=h?h*y<0?E:w:x,l.align=KI[p*y+1],l.baseline=JI[h*y+1],o.setRange(k,P,D,K),!0}return!1}}function Sx(e,t,n,i,r,s,o,a,u,l,c,f){return!(r.outOfBounds(e,n,t,i)||(f&&s||r).getRange(e,n,t,i))}const Pd=0,Id=4,zd=8,Bd=0,Ud=1,jd=2,ZI={"top-left":Pd+Bd,top:Pd+Ud,"top-right":Pd+jd,left:Id+Bd,middle:Id+Ud,right:Id+jd,"bottom-left":zd+Bd,bottom:zd+Ud,"bottom-right":zd+jd},ez={naive:GI,"reduced-search":HI,floodfill:YI};function tz(e,t,n,i,r,s,o,a,u,l,c){if(!e.length)return e;const f=Math.max(i.length,r.length),d=nz(i,f),p=iz(r,f),h=rz(e[0].datum),g=h==="group"&&e[0].datum.items[u].marktype,m=g==="area",y=sz(h,g,a,u),b=l===null||l===1/0,v=m&&c==="naive";let w=-1,E=-1;const S=e.map(P=>{const K=b?jt.width(P,P.text):void 0;return w=Math.max(w,K),E=Math.max(E,P.fontSize),{datum:P,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(P),textWidth:K}});l=l===null||l===1/0?Math.max(w,E)+Math.max(...i):l;const x=WI(t[0],t[1],l);let k;if(!v){n&&S.sort((ee,ce)=>n(ee.datum,ce.datum));let P=!1;for(let ee=0;eeee.datum);k=s.length||K?UI(x,K||[],s,P,m):BI(x,o&&S)}const D=m?ez[c](x,k,o,u):QI(x,k,p,d);return S.forEach(P=>P.opacity=+D(P)),S}function nz(e,t){const n=new Float64Array(t),i=e.length;for(let r=0;r[s.x,s.x,s.x,s.y,s.y,s.y];return e?e==="line"||e==="area"?s=>r(s.datum):t==="line"?s=>{const o=s.datum.items[i].items;return r(o.length?o[n==="start"?0:o.length-1]:{x:NaN,y:NaN})}:s=>{const o=s.datum.bounds;return[o.x1,(o.x1+o.x2)/2,o.x2,o.y1,(o.y1+o.y2)/2,o.y2]}:r}const bp=["x","y","opacity","align","baseline"],R$=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function U0(e){$.call(this,null,e)}U0.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:R$},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:bp.length,default:bp}]};z(U0,$,{transform(e,t){function n(s){const o=e[s];return ie(o)&&t.modified(o.fields)}const i=e.modified();if(!(i||t.changed(t.ADD_REM)||n("sort")))return;(!e.size||e.size.length!==2)&&A("Size parameter should be specified as a [width, height] array.");const r=e.as||bp;return tz(t.materialize(t.SOURCE).source||[],e.size,e.sort,q(e.offset==null?1:e.offset),q(e.anchor||R$),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||"end",e.markIndex||0,e.padding===void 0?0:e.padding,e.method||"naive").forEach(s=>{const o=s.datum;o[r[0]]=s.x,o[r[1]]=s.y,o[r[2]]=s.opacity,o[r[3]]=s.align,o[r[4]]=s.baseline}),t.reflow(i).modifies(r)}});const oz=Object.freeze(Object.defineProperty({__proto__:null,label:U0},Symbol.toStringTag,{value:"Module"}));function _$(e,t){var n=[],i=function(c){return c(a)},r,s,o,a,u,l;if(t==null)n.push(e);else for(r={},s=0,o=e.length;s{HS(l,e.x,e.y,e.bandwidth||.3).forEach(c=>{const f={};for(let d=0;de==="poly"?t:e==="quad"?2:1;function q0(e){$.call(this,null,e)}q0.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(xp)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]};z(q0,$,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=t.materialize(t.SOURCE).source,r=_$(i,e.groupby),s=(e.groupby||[]).map(Me),o=e.method||"linear",a=e.order==null?3:e.order,u=az(o,a),l=e.as||[Me(e.x),Me(e.y)],c=xp[o],f=[];let d=e.extent;G(xp,o)||A("Invalid regression method: "+o),d!=null&&o==="log"&&d[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),r.forEach(p=>{if(p.length<=u){t.dataflow.warn("Skipping regression with more parameters than data points.");return}const g=c(p,e.x,e.y,a);if(e.params){f.push(ge({keys:p.dims,coef:g.coef,rSquared:g.rSquared}));return}const m=d||Zn(p,e.x),y=b=>{const v={};for(let w=0;wy([b,g.predict(b)])):Kc(g.predict,m,25,200).forEach(y)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n}});const uz=Object.freeze(Object.defineProperty({__proto__:null,loess:j0,regression:q0},Symbol.toStringTag,{value:"Module"}));function W0(e){$.call(this,null,e)}W0.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const lz=[-1e5,-1e5,1e5,1e5];z(W0,$,{transform(e,t){const n=e.as||"path",i=t.source;if(!i||!i.length)return t;let r=e.size;r=r?[0,0,r[0],r[1]]:(r=e.extent)?[r[0][0],r[0][1],r[1][0],r[1][1]]:lz;const s=this.value=r_.from(i,e.x,e.y).voronoi(r);for(let o=0,a=i.length;o>5)*e[1]),m=null,y=l.length,b=-1,v=[],w=l.map(S=>({text:t(S),font:n(S),style:r(S),weight:s(S),rotate:o(S),size:~~(i(S)+1e-14),padding:a(S),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:S})).sort((S,x)=>x.size-S.size);++b>1,E.y=e[1]*(c()+.5)>>1,pz(h,E,w,b),E.hasText&&p(g,E,m)&&(v.push(E),m?mz(m,E):m=[{x:E.x+E.x0,y:E.y+E.y0},{x:E.x+E.x1,y:E.y+E.y1}],E.x-=e[0]>>1,E.y-=e[1]>>1)}return v};function d(h){h.width=h.height=1;var g=Math.sqrt(h.getContext("2d").getImageData(0,0,1,1).data.length>>2);h.width=(Ca<<5)/g,h.height=Ml/g;var m=h.getContext("2d");return m.fillStyle=m.strokeStyle="red",m.textAlign="center",{context:m,ratio:g}}function p(h,g,m){for(var y=g.x,b=g.y,v=Math.hypot(e[0],e[1]),w=u(e),E=c()<.5?1:-1,S=-E,x,k,D;(x=w(S+=E))&&(k=~~x[0],D=~~x[1],!(Math.min(Math.abs(k),Math.abs(D))>=v));)if(g.x=y+k,g.y=b+D,!(g.x+g.x0<0||g.y+g.y0<0||g.x+g.x1>e[0]||g.y+g.y1>e[1])&&(!m||!gz(g,h,e[0]))&&(!m||yz(g,m))){for(var P=g.sprite,K=g.width>>5,ee=e[0]>>5,ce=g.x-(K<<4),T=ce&127,O=32-T,I=g.y1-g.y0,W=(g.y+g.y0)*ee+(ce>>5),V,H=0;H>>T:0);W+=ee}return g.sprite=null,!0}return!1}return f.words=function(h){return arguments.length?(l=h,f):l},f.size=function(h){return arguments.length?(e=[+h[0],+h[1]],f):e},f.font=function(h){return arguments.length?(n=Dr(h),f):n},f.fontStyle=function(h){return arguments.length?(r=Dr(h),f):r},f.fontWeight=function(h){return arguments.length?(s=Dr(h),f):s},f.rotate=function(h){return arguments.length?(o=Dr(h),f):o},f.text=function(h){return arguments.length?(t=Dr(h),f):t},f.spiral=function(h){return arguments.length?(u=vz[h]||h,f):u},f.fontSize=function(h){return arguments.length?(i=Dr(h),f):i},f.padding=function(h){return arguments.length?(a=Dr(h),f):a},f.random=function(h){return arguments.length?(c=h,f):c},f}function pz(e,t,n,i){if(!t.sprite){var r=e.context,s=e.ratio;r.clearRect(0,0,(Ca<<5)/s,Ml/s);var o=0,a=0,u=0,l=n.length,c,f,d,p,h;for(--i;++i>5<<5,d=~~Math.max(Math.abs(b+v),Math.abs(b-v))}else c=c+31>>5<<5;if(d>u&&(u=d),o+c>=Ca<<5&&(o=0,a+=u,u=0),a+d>=Ml)break;r.translate((o+(c>>1))/s,(a+(d>>1))/s),t.rotate&&r.rotate(t.rotate*qd),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=c,t.height=d,t.xoff=o,t.yoff=a,t.x1=c>>1,t.y1=d>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,o+=c}for(var E=r.getImageData(0,0,(Ca<<5)/s,Ml/s).data,S=[];--i>=0;)if(t=n[i],!!t.hasText){for(c=t.width,f=c>>5,d=t.y1-t.y0,p=0;p>5),P=E[(a+h)*(Ca<<5)+(o+p)<<2]?1<<31-p%32:0;S[D]|=P,x|=P}x?k=h:(t.y0++,d--,h--,a++)}t.y1=t.y0+k,t.sprite=S.slice(0,(t.y1-t.y0)*f)}}}function gz(e,t,n){n>>=5;for(var i=e.sprite,r=e.width>>5,s=e.x-(r<<4),o=s&127,a=32-o,u=e.y1-e.y0,l=(e.y+e.y0)*n+(s>>5),c,f=0;f>>o:0))&t[l+d])return!0;l+=n}return!1}function mz(e,t){var n=e[0],i=e[1];t.x+t.x0i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function yz(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0t[0].y&&e.y+e.y0g(h(m))}r.forEach(h=>{h[o[0]]=NaN,h[o[1]]=NaN,h[o[3]]=0});const l=s.words(r).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(a).random(an).layout(),c=s.size(),f=c[0]>>1,d=c[1]>>1,p=l.length;for(let h=0,g,m;hnew Uint8Array(e),kz=e=>new Uint16Array(e),Ma=e=>new Uint32Array(e);function $z(){let e=8,t=[],n=Ma(0),i=rl(0,e),r=rl(0,e);return{data:()=>t,seen:()=>n=Az(n,t.length),add(s){for(let o=0,a=t.length,u=s.length,l;ot.length,curr:()=>i,prev:()=>r,reset:s=>r[s]=i[s],all:()=>e<257?255:e<65537?65535:4294967295,set(s,o){i[s]|=o},clear(s,o){i[s]&=~o},resize(s,o){const a=i.length;(s>a||o>e)&&(e=Math.max(o,e),i=rl(s,e,i),r=rl(s,e))}}}function Az(e,t,n){return e.length>=t?e:(n=n||new e.constructor(t),n.set(e),n)}function rl(e,t,n){const i=(t<257?Sz:t<65537?kz:Ma)(e);return n&&i.set(n),i}function kx(e,t,n){const i=1<0)for(m=0;me,size:()=>n}}function Cz(e,t){return e.sort.call(t,(n,i)=>{const r=e[n],s=e[i];return rs?1:0}),s_(e,t)}function Fz(e,t,n,i,r,s,o,a,u){let l=0,c=0,f;for(f=0;lt.modified(i.fields));return n?this.reinit(e,t):this.eval(e,t)}else return this.init(e,t)},init(e,t){const n=e.fields,i=e.query,r=this._indices={},s=this._dims=[],o=i.length;let a=0,u,l;for(;a{const s=r.remove(t,n);for(const o in i)i[o].reindex(s)})},update(e,t,n){const i=this._dims,r=e.query,s=t.stamp,o=i.length;let a=0,u,l;for(n.filters=0,l=0;lp)for(m=p,y=Math.min(f,h);mh)for(m=Math.max(f,h),y=d;mf)for(h=f,g=Math.min(l,d);hd)for(h=Math.max(l,d),g=c;ha[c]&n?null:o[c];return s.filter(s.MOD,l),r&r-1?(s.filter(s.ADD,c=>{const f=a[c]&n;return!f&&f^u[c]&n?o[c]:null}),s.filter(s.REM,c=>{const f=a[c]&n;return f&&!(f^(f^u[c]&n))?o[c]:null})):(s.filter(s.ADD,l),s.filter(s.REM,c=>(a[c]&n)===r?o[c]:null)),s.filter(s.SOURCE,c=>l(c._index))}});const Oz=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:H0,resolvefilter:V0},Symbol.toStringTag,{value:"Module"})),Dz="RawCode",ns="Literal",Rz="Property",_z="Identifier",Tz="ArrayExpression",Nz="BinaryExpression",M$="CallExpression",Mz="ConditionalExpression",Lz="LogicalExpression",Pz="MemberExpression",Iz="ObjectExpression",zz="UnaryExpression";function _n(e){this.type=e}_n.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=Bz(this),n=0,i=t.length;n";ai[is]="Identifier";ai[vr]="Keyword";ai[mf]="Null";ai[ws]="Numeric";ai[Ct]="Punctuator";ai[Fu]="String";ai[Uz]="RegularExpression";var jz="ArrayExpression",qz="BinaryExpression",Wz="CallExpression",Gz="ConditionalExpression",L$="Identifier",Hz="Literal",Vz="LogicalExpression",Xz="MemberExpression",Yz="ObjectExpression",Kz="Property",Jz="UnaryExpression",Ye="Unexpected token %0",Qz="Unexpected number",Zz="Unexpected string",e6="Unexpected identifier",t6="Unexpected reserved word",n6="Unexpected end of input",vp="Invalid regular expression",Wd="Invalid regular expression: missing /",P$="Octal literals are not allowed in strict mode.",i6="Duplicate data property in object literal not allowed in strict mode",rt="ILLEGAL",Ya="Disabled.",r6=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),s6=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function yf(e,t){if(!e)throw new Error("ASSERT: "+t)}function vi(e){return e>=48&&e<=57}function X0(e){return"0123456789abcdefABCDEF".includes(e)}function La(e){return"01234567".includes(e)}function o6(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function Ka(e){return e===10||e===13||e===8232||e===8233}function Ou(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&r6.test(String.fromCharCode(e))}function dc(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&s6.test(String.fromCharCode(e))}const a6={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function I$(){for(;C1114111||e!=="}")&&fe({},Ye,rt),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,i=(t-65536&1023)+56320,String.fromCharCode(n,i))}function z$(){var e,t;for(e=X.charCodeAt(C++),t=String.fromCharCode(e),e===92&&(X.charCodeAt(C)!==117&&fe({},Ye,rt),++C,e=Ep("u"),(!e||e==="\\"||!Ou(e.charCodeAt(0)))&&fe({},Ye,rt),t=e);C>>=")return C+=4,{type:Ct,value:o,start:e,end:C};if(s=o.substr(0,3),s===">>>"||s==="<<="||s===">>=")return C+=3,{type:Ct,value:s,start:e,end:C};if(r=s.substr(0,2),i===r[1]&&"+-<>&|".includes(i)||r==="=>")return C+=2,{type:Ct,value:r,start:e,end:C};if(r==="//"&&fe({},Ye,rt),"<>=!+-*%&|^/".includes(i))return++C,{type:Ct,value:i,start:e,end:C};fe({},Ye,rt)}function f6(e){let t="";for(;C{if(parseInt(r,16)<=1114111)return"x";fe({},vp)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch{fe({},vp)}try{return new RegExp(e,t)}catch{return null}}function g6(){var e,t,n,i,r;for(e=X[C],yf(e==="/","Regular expression literal must start with a slash"),t=X[C++],n=!1,i=!1;C=0&&fe({},vp,n),{value:n,literal:t}}function y6(){var e,t,n,i;return be=null,I$(),e=C,t=g6(),n=m6(),i=p6(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:C}}function b6(e){return e.type===is||e.type===vr||e.type===gf||e.type===mf}function B$(){if(I$(),C>=mt)return{type:Cu,start:C,end:C};const e=X.charCodeAt(C);return Ou(e)?c6():e===40||e===41||e===59?Gd():e===39||e===34?h6():e===46?vi(X.charCodeAt(C+1))?Ax():Gd():vi(e)?Ax():Gd()}function Ft(){const e=be;return C=e.end,be=B$(),C=e.end,e}function U$(){const e=C;be=B$(),C=e}function x6(e){const t=new _n(jz);return t.elements=e,t}function Cx(e,t,n){const i=new _n(e==="||"||e==="&&"?Vz:qz);return i.operator=e,i.left=t,i.right=n,i}function v6(e,t){const n=new _n(Wz);return n.callee=e,n.arguments=t,n}function E6(e,t,n){const i=new _n(Gz);return i.test=e,i.consequent=t,i.alternate=n,i}function Y0(e){const t=new _n(L$);return t.name=e,t}function Fa(e){const t=new _n(Hz);return t.value=e.value,t.raw=X.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function Fx(e,t,n){const i=new _n(Xz);return i.computed=e==="[",i.object=t,i.property=n,i.computed||(n.member=!0),i}function w6(e){const t=new _n(Yz);return t.properties=e,t}function Ox(e,t,n){const i=new _n(Kz);return i.key=t,i.value=n,i.kind=e,i}function S6(e,t){const n=new _n(Jz);return n.operator=e,n.argument=t,n.prefix=!0,n}function fe(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,(s,o)=>(yf(o":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11;break}return t}function M6(){var e,t,n,i,r,s,o,a,u,l;if(e=be,u=Ll(),i=be,r=_x(i),r===0)return u;for(i.prec=r,Ft(),t=[e,be],o=Ll(),s=[u,i,o];(r=_x(be))>0;){for(;s.length>2&&r<=s[s.length-2].prec;)o=s.pop(),a=s.pop().value,u=s.pop(),t.pop(),n=Cx(a,u,o),s.push(n);i=Ft(),i.prec=r,s.push(i),t.push(be),n=Ll(),s.push(n)}for(l=s.length-1,n=s[l],t.pop();l>1;)t.pop(),n=Cx(s[l-1].value,s[l-2],n),l-=2;return n}function rs(){var e,t,n;return e=M6(),Ae("?")&&(Ft(),t=rs(),yt(":"),n=rs(),e=E6(e,t,n)),e}function K0(){const e=rs();if(Ae(","))throw new Error(Ya);return e}function J0(e){X=e,C=0,mt=X.length,be=null,U$();const t=K0();if(be.type!==Cu)throw new Error("Unexpect token after expression.");return t}var j$={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function q$(e){function t(o,a,u,l){let c=e(a[0]);return u&&(c=u+"("+c+")",u.lastIndexOf("new ",0)===0&&(c="("+c+")")),c+"."+o+(l<0?"":l===0?"()":"("+a.slice(1).map(e).join(",")+")")}function n(o,a,u){return l=>t(o,l,a,u)}const i="new Date",r="String",s="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(o){o.length<3&&A("Missing arguments to clamp function."),o.length>3&&A("Too many arguments to clamp function.");const a=o.map(e);return"Math.max("+a[1]+", Math.min("+a[2]+","+a[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:i,date:n("getDate",i,0),day:n("getDay",i,0),year:n("getFullYear",i,0),month:n("getMonth",i,0),hours:n("getHours",i,0),minutes:n("getMinutes",i,0),seconds:n("getSeconds",i,0),milliseconds:n("getMilliseconds",i,0),time:n("getTime",i,0),timezoneoffset:n("getTimezoneOffset",i,0),utcdate:n("getUTCDate",i,0),utcday:n("getUTCDay",i,0),utcyear:n("getUTCFullYear",i,0),utcmonth:n("getUTCMonth",i,0),utchours:n("getUTCHours",i,0),utcminutes:n("getUTCMinutes",i,0),utcseconds:n("getUTCSeconds",i,0),utcmilliseconds:n("getUTCMilliseconds",i,0),length:n("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",r,0),lower:n("toLowerCase",r,0),substring:n("substring",r),split:n("split",r),trim:n("trim",r,0),btoa:"btoa",atob:"atob",regexp:s,test:n("test",s),if:function(o){o.length<3&&A("Missing arguments to if function."),o.length>3&&A("Too many arguments to if function.");const a=o.map(e);return"("+a[0]+"?"+a[1]+":"+a[2]+")"}}}function L6(e){const t=e&&e.length-1;return t&&(e[0]==='"'&&e[t]==='"'||e[0]==="'"&&e[t]==="'")?e.slice(1,-1):e}function W$(e){e=e||{};const t=e.allowed?$n(e.allowed):{},n=e.forbidden?$n(e.forbidden):{},i=e.constants||j$,r=(e.functions||q$)(f),s=e.globalvar,o=e.fieldvar,a=ie(s)?s:h=>`${s}["${h}"]`;[...Object.getOwnPropertyNames(Object.prototype).filter(h=>typeof Object.prototype[h]=="function")];let u={},l={},c=0;function f(h){if(j(h))return h;const g=d[h.type];return g==null&&A("Unsupported type: "+h.type),g(h)}const d={Literal:h=>h.raw,Identifier:h=>{const g=h.name;return c>0?g:G(n,g)?A("Illegal identifier: "+g):G(i,g)?i[g]:G(t,g)?g:(u[g]=1,a(g))},MemberExpression:h=>{const g=!h.computed,m=f(h.object);g&&(c+=1);const y=f(h.property);return m===o&&(l[L6(y)]=1),g&&(c-=1),m+(g?"."+y:"["+y+"]")},CallExpression:h=>{h.callee.type!=="Identifier"&&A("Illegal callee type: "+h.callee.type);const g=h.callee.name,m=h.arguments,y=G(r,g)&&r[g];return y||A("Unrecognized function: "+g),ie(y)?y(m):y+"("+m.map(f).join(",")+")"},ArrayExpression:h=>"["+h.elements.map(f).join(",")+"]",BinaryExpression:h=>"("+f(h.left)+" "+h.operator+" "+f(h.right)+")",UnaryExpression:h=>"("+h.operator+f(h.argument)+")",ConditionalExpression:h=>"("+f(h.test)+"?"+f(h.consequent)+":"+f(h.alternate)+")",LogicalExpression:h=>"("+f(h.left)+h.operator+f(h.right)+")",ObjectExpression:h=>{for(const g of h.properties){const m=g.key.name;yg.has(m)&&A("Illegal property: "+m)}return"{"+h.properties.map(f).join(",")+"}"},Property:h=>{c+=1;const g=f(h.key);return c-=1,g+":"+f(h.value)}};function p(h){const g={code:f(h),globals:Object.keys(u),fields:Object.keys(l)};return u={},l={},g}return p.functions=r,p.constants=i,p}const Tx=Symbol("vega_selection_getter");function G$(e){return(!e.getter||!e.getter[Tx])&&(e.getter=rn(e.field),e.getter[Tx]=!0),e.getter}const Q0="intersect",Nx="union",P6="vlMulti",I6="vlPoint",Mx="or",z6="and",Hn="_vgsid_",Ja=rn(Hn),B6="E",U6="R",j6="R-E",q6="R-LE",W6="R-RE",G6="E-LT",H6="E-LTE",V6="E-GT",X6="E-GTE",Y6="E-VALID",K6="E-ONE",hc="index:unit";function Lx(e,t){for(var n=t.fields,i=t.values,r=n.length,s=0,o,a;s=i[s])return!1}else if(a.type===H6){if(o>i[s])return!1}else if(a.type===V6){if(o<=i[s])return!1}else if(a.type===X6){if(ore(t.fields?{values:t.fields.map(i=>G$(i)(n.datum))}:{[Hn]:Ja(n.datum)},t))}function n8(e,t,n,i){for(var r=this.context.data[e],s=r?r.values.value:[],o={},a={},u={},l,c,f,d,p,h,g,m,y,b,v=s.length,w=0,E,S;w(x[c[D].field]=k,x),{})))}else p=Hn,h=Ja(l),g=o[p]||(o[p]={}),m=g[d]||(g[d]=[]),m.push(h),n&&(m=a[d]||(a[d]=[]),m.push({[Hn]:h}));if(t=t||Nx,o[Hn]?o[Hn]=Vd[`${Hn}_${t}`](...Object.values(o[Hn])):Object.keys(o).forEach(x=>{o[x]=Object.keys(o[x]).map(k=>o[x][k]).reduce((k,D)=>k===void 0?D:Vd[`${u[x]}_${t}`](k,D))}),s=Object.keys(a),n&&s.length){const x=i?I6:P6;o[x]=t===Nx?{[Mx]:s.reduce((k,D)=>(k.push(...a[D]),k),[])}:{[z6]:s.map(k=>({[Mx]:a[k]}))}}return o}var Vd={[`${Hn}_union`]:a_,[`${Hn}_intersect`]:o_,E_union:function(e,t){if(!e.length)return t;for(var n=0,i=t.length;nt.includes(n)):t},R_union:function(e,t){var n=dt(t[0]),i=dt(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]i&&(n=t[1],i=t[0]),e.length?ii&&(e[1]=i),e):[n,i]}};const i8=":",r8="@";function Z0(e,t,n,i){t[0].type!==ns&&A("First argument to selection functions must be a string literal.");const r=t[0].value,s=t.length>=2&&ue(t).value,o="unit",a=r8+o,u=i8+r;s===Q0&&!G(i,a)&&(i[a]=n.getData(r).indataRef(n,o)),G(i,u)||(i[u]=n.getData(r).tuplesRef())}function V$(e){const t=this.context.data[e];return t?t.values.value:[]}function s8(e,t,n){const i=this.context.data[e]["index:"+t],r=i?i.value.get(n):void 0;return r&&r.count}function o8(e,t){const n=this.context.dataflow,i=this.context.data[e],r=i.input;return n.pulse(r,n.changeset().remove(sn).insert(t)),1}function a8(e,t,n){if(e){const i=this.context.dataflow,r=e.mark.source;i.pulse(r,i.changeset().encode(e,t))}return n!==void 0?n:e}const Du=e=>function(t,n){const i=this.context.dataflow.locale();return t===null?"null":i[e](n)(t)},u8=Du("format"),X$=Du("timeFormat"),l8=Du("utcFormat"),c8=Du("timeParse"),f8=Du("utcParse"),sl=new Date(2e3,0,1);function xf(e,t,n){return!Number.isInteger(e)||!Number.isInteger(t)?"":(sl.setYear(2e3),sl.setMonth(e),sl.setDate(t),X$.call(this,sl,n))}function d8(e){return xf.call(this,e,1,"%B")}function h8(e){return xf.call(this,e,1,"%b")}function p8(e){return xf.call(this,0,2+e,"%A")}function g8(e){return xf.call(this,0,2+e,"%a")}const m8=":",y8="@",wp="%",Y$="$";function ey(e,t,n,i){t[0].type!==ns&&A("First argument to data functions must be a string literal.");const r=t[0].value,s=m8+r;if(!G(s,i))try{i[s]=n.getData(r).tuplesRef()}catch{}}function b8(e,t,n,i){t[0].type!==ns&&A("First argument to indata must be a string literal."),t[1].type!==ns&&A("Second argument to indata must be a string literal.");const r=t[0].value,s=t[1].value,o=y8+s;G(o,i)||(i[o]=n.getData(r).indataRef(n,s))}function kt(e,t,n,i){if(t[0].type===ns)Px(n,i,t[0].value);else for(e in n.scales)Px(n,i,e)}function Px(e,t,n){const i=wp+n;if(!G(t,i))try{t[i]=e.scaleRef(n)}catch{}}function ui(e,t){if(j(e)){const n=t.scales[e];return n&&_b(n.value)?n.value:void 0}else if(ie(e))return _b(e)?e:void 0}function x8(e,t,n){t.__bandwidth=r=>r&&r.bandwidth?r.bandwidth():0,n._bandwidth=kt,n._range=kt,n._scale=kt;const i=r=>"_["+(r.type===ns?L(wp+r.value):L(wp)+"+"+e(r))+"]";return{_bandwidth:r=>`this.__bandwidth(${i(r[0])})`,_range:r=>`${i(r[0])}.range()`,_scale:r=>`${i(r[0])}(${e(r[1])})`}}function ty(e,t){return function(n,i,r){if(n){const s=ui(n,(r||this).context);return s&&s.path[e](i)}else return t(i)}}const v8=ty("area",u_),E8=ty("bounds",l_),w8=ty("centroid",c_);function S8(e,t){const n=ui(e,(t||this).context);return n&&n.scale()}function k8(e){const t=this.context.group;let n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n}function ny(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(i){e.warn(i)}return n[n.length-1]}function $8(){return ny(this.context.dataflow,"warn",arguments)}function A8(){return ny(this.context.dataflow,"info",arguments)}function C8(){return ny(this.context.dataflow,"debug",arguments)}function Xd(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Sp(e){const t=Gl(e),n=Xd(t.r),i=Xd(t.g),r=Xd(t.b);return .2126*n+.7152*i+.0722*r}function F8(e,t){const n=Sp(e),i=Sp(t),r=Math.max(n,i),s=Math.min(n,i);return(r+.05)/(s+.05)}function O8(){const e=[].slice.call(arguments);return e.unshift({}),re(...e)}function K$(e,t){return e===t||e!==e&&t!==t?!0:F(e)?F(t)&&e.length===t.length?D8(e,t):!1:U(e)&&U(t)?J$(e,t):!1}function D8(e,t){for(let n=0,i=e.length;nJ$(e,t)}function R8(e,t,n,i,r,s){const o=this.context.dataflow,a=this.context.data[e],u=a.input,l=o.stamp();let c=a.changes,f,d;if(o._trigger===!1||!(u.value.length||t||i))return 0;if((!c||c.stamp{a.modified=!0,o.pulse(u,c).run()},!0,1)),n&&(f=n===!0?sn:F(n)||jc(n)?n:Ix(n),c.remove(f)),t&&c.insert(t),i&&(f=Ix(i),u.value.some(f)?c.remove(f):c.insert(i)),r){if(ie(r))throw Error("modify parameter must be a data tuple, not a function");for(d in s)c.modify(r,d,s[d])}return 1}function _8(e){const t=e.touches,n=t[0].clientX-t[1].clientX,i=t[0].clientY-t[1].clientY;return Math.hypot(n,i)}function T8(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)}const zx={};function N8(e,t){const n=zx[t]||(zx[t]=rn(t));return F(e)?e.map(n):n(e)}function vf(e){return F(e)||ArrayBuffer.isView(e)?e:null}function iy(e){return vf(e)||(j(e)?e:null)}function M8(e,...t){return vf(e).join(...t)}function L8(e,...t){return iy(e).indexOf(...t)}function P8(e,...t){return iy(e).lastIndexOf(...t)}function I8(e,...t){return iy(e).slice(...t)}function z8(e,t,n){return ie(n)&&A("Function argument passed to replace."),!j(t)&&!$g(t)&&A("Please pass a string or RegExp argument to replace."),String(e).replace(t,n)}function B8(e){return vf(e).slice().reverse()}function U8(e){return vf(e).slice().sort(No)}function j8(e,t,n){return Fm(e||0,t||0,n||0)}function q8(e,t){const n=ui(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}function W8(e,t){const n=ui(e,(t||this).context);return n?n.copy():void 0}function G8(e,t){const n=ui(e,(t||this).context);return n?n.domain():[]}function H8(e,t,n){const i=ui(e,(n||this).context);return i?F(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0}function V8(e,t){const n=ui(e,(t||this).context);return n&&n.range?n.range():[]}function X8(e,t,n){const i=ui(e,(n||this).context);return i?i(t):void 0}function Y8(e,t,n,i,r){e=ui(e,(r||this).context);const s=q2(t,n);let o=e.domain(),a=o[0],u=ue(o),l=bt;return u-a?l=R2(e,a,u):e=(e.interpolator?he("sequential")().interpolator(e.interpolator()):he("linear")().interpolate(e.interpolate()).range(e.range())).domain([a=0,u=1]),e.ticks&&(o=e.ticks(+i||15),a!==o[0]&&o.unshift(a),u!==ue(o)&&o.push(u)),o.forEach(c=>s.stop(l(c),e(c))),s}function K8(e,t,n){const i=ui(e,(n||this).context);return function(r){return i?i.path.context(r)(t):""}}function J8(e){let t=null;return function(n){return n?Ga(n,t=t||uo(e)):e}}const Q$=e=>e.data;function Z$(e,t){const n=V$.call(t,e);return n.root&&n.root.lookup||{}}function Q8(e,t,n){const i=Z$(e,this),r=i[t],s=i[n];return r&&s?r.path(s).map(Q$):void 0}function Z8(e,t){const n=Z$(e,this)[t];return n?n.ancestors().map(Q$):void 0}const eA=()=>typeof window<"u"&&window||null;function e4(){const e=eA();return e?e.screen:{}}function t4(){const e=eA();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]}function n4(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]}function tA(e,t,n){if(!e)return[];const[i,r]=e,s=new Ue().set(i[0],i[1],r[0],r[1]),o=n||this.context.dataflow.scenegraph().root;return zk(o,s,i4(t))}function i4(e){let t=null;if(e){const n=q(e.marktype),i=q(e.markname);t=r=>(!n.length||n.some(s=>r.marktype===s))&&(!i.length||i.some(s=>r.name===s))}return t}function r4(e,t,n,i=5){e=q(e);const r=e[e.length-1];return r===void 0||Math.hypot(r[0]-t,r[1]-n)>i?[...e,[t,n]]:e}function s4(e){return q(e).reduce((t,[n,i],r)=>t+=r==0?`M ${n},${i} `:r===e.length-1?" Z":`L ${n},${i} `,"")}function o4(e,t,n){const{x:i,y:r,mark:s}=n,o=new Ue().set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[u,l]of t)uo.x2&&(o.x2=u),lo.y2&&(o.y2=l);return o.translate(i,r),tA([[o.x1,o.y1],[o.x2,o.y2]],e,s).filter(u=>a4(u.x,u.y,t))}function a4(e,t,n){let i=0;for(let r=0,s=n.length-1;rt!=a>t&&e<(o-u)*(t-l)/(a-l)+u&&i++}return i&1}const Qa={random(){return an()},cumulativeNormal:Vc,cumulativeLogNormal:Xg,cumulativeUniform:Qg,densityNormal:qg,densityLogNormal:Vg,densityUniform:Jg,quantileNormal:Xc,quantileLogNormal:Yg,quantileUniform:Zg,sampleNormal:Hc,sampleLogNormal:Hg,sampleUniform:Kg,isArray:F,isBoolean:bs,isDate:rr,isDefined(e){return e!==void 0},isNumber:de,isObject:U,isRegExp:$g,isString:j,isTuple:jc,isValid(e){return e!=null&&e===e},toBoolean:Cg,toDate(e){return Fg(e)},toNumber:dt,toString:Og,indexof:L8,join:M8,lastindexof:P8,replace:z8,reverse:B8,sort:U8,slice:I8,flush:Uw,lerp:qw,merge:O8,pad:Hw,peek:ue,pluck:N8,span:cu,inrange:Gs,truncate:Vw,rgb:Gl,lab:N_,hcl:T_,hsl:sT,luminance:Sp,contrast:F8,sequence:ys,format:u8,utcFormat:l8,utcParse:f8,utcOffset:oS,utcSequence:lS,timeFormat:X$,timeParse:c8,timeOffset:sS,timeSequence:uS,timeUnitSpecifier:Xw,monthFormat:d8,monthAbbrevFormat:h8,dayFormat:p8,dayAbbrevFormat:g8,quarter:Pw,utcquarter:Iw,week:Kw,utcweek:Zw,dayofyear:Yw,utcdayofyear:Qw,warn:$8,info:A8,debug:C8,extent(e){return Zn(e)},inScope:k8,intersect:tA,clampRange:zw,pinchDistance:_8,pinchAngle:T8,screen:e4,containerSize:n4,windowSize:t4,bandspace:j8,setdata:o8,pathShape:J8,panLinear:Tw,panLog:Nw,panPow:Mw,panSymlog:Lw,zoomLinear:vg,zoomLog:Eg,zoomPow:Vl,zoomSymlog:wg,encode:a8,modify:R8,lassoAppend:r4,lassoPath:s4,intersectLasso:o4},u4=["view","item","group","xy","x","y"],l4="event.vega.",nA="this.",ry={},iA={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${L(Y$+e)}]`,functions:c4,constants:j$,visitors:ry},kp=W$(iA);function c4(e){const t=q$(e);u4.forEach(n=>t[n]=l4+n);for(const n in Qa)t[n]=nA+n;return re(t,x8(e,Qa,ry)),t}function ze(e,t,n){return arguments.length===1?Qa[e]:(Qa[e]=t,n&&(ry[e]=n),kp&&(kp.functions[e]=nA+e),this)}ze("bandwidth",q8,kt);ze("copy",W8,kt);ze("domain",G8,kt);ze("range",V8,kt);ze("invert",H8,kt);ze("scale",X8,kt);ze("gradient",Y8,kt);ze("geoArea",v8,kt);ze("geoBounds",E8,kt);ze("geoCentroid",w8,kt);ze("geoShape",K8,kt);ze("geoScale",S8,kt);ze("indata",s8,b8);ze("data",V$,ey);ze("treePath",Q8,ey);ze("treeAncestors",Z8,ey);ze("vlSelectionTest",J6,Z0);ze("vlSelectionIdTest",e8,Z0);ze("vlSelectionResolve",n8,Z0);ze("vlSelectionTuples",t8);function ti(e,t){const n={};let i;try{e=j(e)?e:L(e)+"",i=J0(e)}catch{A("Expression parse error: "+e)}i.visit(s=>{if(s.type!==M$)return;const o=s.callee.name,a=iA.visitors[o];a&&a(o,s.arguments,t,n)});const r=kp(i);return r.globals.forEach(s=>{const o=Y$+s;!G(n,o)&&t.getSignal(s)&&(n[o]=t.signalRef(s))}),{$expr:re({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}function f4(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach(i=>t.parseOperator(i)),n.forEach(i=>t.parseOperatorParameters(i)),(e.streams||[]).forEach(i=>t.parseStream(i)),(e.updates||[]).forEach(i=>t.parseUpdate(i)),t.resolve()}const d4=$n(["rule"]),Bx=$n(["group","image","rect"]);function h4(e,t){let n="";return d4[t]||(e.x2&&(e.x?(Bx[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(Bx[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}function sy(e){return(e+"").toLowerCase()}function p4(e){return sy(e)==="operator"}function g4(e){return sy(e)==="collect"}function oa(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}function m4(e,t,n,i){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n} + : (u > v || v == null) && u != null ? ${i} + : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n} + : v !== v && u === u ? ${i} : `}var y4={operator:(e,t)=>oa(e,["_"],t.code),parameter:(e,t)=>oa(e,["datum","_"],t.code),event:(e,t)=>oa(e,["event"],t.code),handler:(e,t)=>{const n=`var datum=event.item&&event.item.datum;return ${t.code};`;return oa(e,["_","event"],n)},encode:(e,t)=>{const{marktype:n,channels:i}=t;let r="var o=item,datum=o.datum,m=0,$;";for(const s in i){const o="o["+L(s)+"]";r+=`$=${i[s].code};if(${o}!==$)${o}=$,m=1;`}return r+=h4(i,n),r+="return m;",oa(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(L).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n;const i=(s,o)=>{const a=t[o];let u,l;return s.path?(u=`a${s.path}`,l=`b${s.path}`):((n=n||{})["f"+o]=s,u=`this.f${o}(a)`,l=`this.f${o}(b)`),m4(u,l,-a,a)},r=Function("a","b","var u, v; return "+e.map(i).join("")+"0;");return n?r.bind(n):r}}};function b4(e){const t=this;p4(e.type)||!e.type?t.operator(e,e.update?t.operatorExpression(e.update):null):t.transform(e,e.type)}function x4(e){const t=this;if(e.params){const n=t.get(e.id);n||A("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}}function v4(e,t){t=t||{};const n=this;for(const i in e){const r=e[i];t[i]=F(r)?r.map(s=>Ux(s,n,t)):Ux(r,n,t)}return t}function Ux(e,t,n){if(!e||!U(e))return e;for(let i=0,r=jx.length,s;ir&&r.$tupleid?Q:r);return t.fn[n]||(t.fn[n]=Sg(i,e.$order,t.expr.codegen))}function A4(e,t){const n=e.$encode,i={};for(const r in n){const s=n[r];i[r]=Mt(t.encodeExpression(s.$expr),s.$fields),i[r].output=s.$output}return i}function C4(e,t){return t}function F4(e,t){const n=e.$subflow;return function(i,r,s){const o=t.fork().parse(n),a=o.get(n.operators[0].id),u=o.signals.parent;return u&&u.set(s),a.detachSubflow=()=>t.detach(o),a}}function O4(){return Q}function D4(e){var t=this,n=e.filter!=null?t.eventExpression(e.filter):void 0,i=e.stream!=null?t.get(e.stream):void 0,r;e.source?i=t.events(e.source,e.type,n):e.merge&&(r=e.merge.map(s=>t.get(s)),i=r[0].merge.apply(r[0],r.slice(1))),e.between&&(r=e.between.map(s=>t.get(s)),i=i.between(r[0],r[1])),e.filter&&(i=i.filter(n)),e.throttle!=null&&(i=i.throttle(+e.throttle)),e.debounce!=null&&(i=i.debounce(+e.debounce)),i==null&&A("Invalid stream definition: "+JSON.stringify(e)),e.consume&&i.consume(!0),t.stream(e,i)}function R4(e){var t=this,n=U(n=e.source)?n.$ref:n,i=t.get(n),r=null,s=e.update,o=void 0;i||A("Source not defined: "+e.source),r=e.target&&e.target.$expr?t.eventExpression(e.target.$expr):t.get(e.target),s&&s.$expr&&(s.$params&&(o=t.parseParameters(s.$params)),s=t.handlerExpression(s.$expr)),t.update(e,i,r,s,o)}const _4={skip:!0};function T4(e){var t=this,n={};if(e.signals){var i=n.signals={};Object.keys(t.signals).forEach(s=>{const o=t.signals[s];e.signals(s,o)&&(i[s]=o.value)})}if(e.data){var r=n.data={};Object.keys(t.data).forEach(s=>{const o=t.data[s];e.data(s,o)&&(r[s]=o.input.value)})}return t.subcontext&&e.recurse!==!1&&(n.subcontext=t.subcontext.map(s=>s.getState(e))),n}function N4(e){var t=this,n=t.dataflow,i=e.data,r=e.signals;Object.keys(r||{}).forEach(s=>{n.update(t.signals[s],r[s],_4)}),Object.keys(i||{}).forEach(s=>{n.pulse(t.data[s].input,n.changeset().remove(sn).insert(i[s]))}),(e.subcontext||[]).forEach((s,o)=>{const a=t.subcontext[o];a&&a.setState(s)})}function rA(e,t,n,i){return new sA(e,t,n,i)}function sA(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||y4,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function qx(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}sA.prototype=qx.prototype={fork(){const e=new qx(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter(n=>n!==e);const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,i=n.dataflow,r=e.value;if(n.set(e.id,t),g4(e.type)&&r&&(r.$ingest?i.ingest(t,r.$ingest,r.$format):r.$request?i.preload(t,r.$request,r.$format):i.pulse(t,i.changeset().insert(r))),e.root&&(n.root=t),e.parent){let s=n.get(e.parent.$ref);s?(i.connect(s,[t]),t.targets().add(s)):(n.unresolved=n.unresolved||[]).push(()=>{s=n.get(e.parent.$ref),i.connect(s,[t]),t.targets().add(s)})}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const s in e.data){const o=n.data[s]||(n.data[s]={});e.data[s].forEach(a=>o[a]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[sy(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,i,r){this.dataflow.on(t,n,i,r,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:f4,parseOperator:b4,parseOperatorParameters:x4,parseParameters:v4,parseStream:D4,parseUpdate:R4,getState:T4,setState:N4};function M4(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),oA(t,e.description()))}function oA(e,t){e&&(t==null?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}function L4(e){e.add(null,t=>(e._background=t.bg,e._resize=1,t.bg),{bg:e._signals.background})}const Yd="default";function P4(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:Yd,item:null}));e.on(e.events("view","pointermove"),t,(n,i)=>{const r=t.value,s=r?j(r)?r:r.user:Yd,o=i.item&&i.item.cursor||null;return r&&s===r.user&&o==r.item?r:{user:s,item:o}}),e.add(null,function(n){let i=n.cursor,r=this.value;return j(i)||(r=i.item,i=i.user),$p(e,i&&i!==Yd?i:r||i),r},{cursor:t})}function $p(e,t){const n=e.globalCursor()?typeof document<"u"&&document.body:e.container();if(n)return t==null?n.style.removeProperty("cursor"):n.style.cursor=t}function pc(e,t){var n=e._runtime.data;return G(n,t)||A("Unrecognized data set: "+t),n[t]}function I4(e,t){return arguments.length<2?pc(this,e).values.value:Ef.call(this,e,vs().remove(sn).insert(t))}function Ef(e,t){OS(t)||A("Second argument to changes must be a changeset.");const n=pc(this,e);return n.modified=!0,this.pulse(n.input,t)}function z4(e,t){return Ef.call(this,e,vs().insert(t))}function B4(e,t){return Ef.call(this,e,vs().remove(t))}function aA(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function uA(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function wf(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function U4(e){var t=wf(e),n=aA(e),i=uA(e);e._renderer.background(e.background()),e._renderer.resize(n,i,t),e._handler.origin(t),e._resizeListeners.forEach(r=>{try{r(n,i)}catch(s){e.error(s)}})}function j4(e,t,n){var i=e._renderer,r=i&&i.canvas(),s,o,a;return r&&(a=wf(e),o=t.changedTouches?t.changedTouches[0]:t,s=df(o,r),s[0]-=a[0],s[1]-=a[1]),t.dataflow=e,t.item=n,t.vega=q4(e,n,s),t}function q4(e,t,n){const i=t?t.mark.marktype==="group"?t:t.mark.group:null;function r(o){var a=i,u;if(o){for(u=t;u;u=u.mark.group)if(u.mark.name===o){a=u;break}}return a&&a.mark&&a.mark.interactive?a:{}}function s(o){if(!o)return n;j(o)&&(o=r(o));const a=n.slice();for(;o;)a[0]-=o.x||0,a[1]-=o.y||0,o=o.mark&&o.mark.group;return a}return{view:xt(e),item:xt(t||{}),group:r,xy:s,x:o=>s(o)[0],y:o=>s(o)[1]}}const Wx="view",W4="timer",G4="window",H4={trap:!1};function V4(e){const t=re({defaults:{}},e),n=(i,r)=>{r.forEach(s=>{F(i[s])&&(i[s]=$n(i[s]))})};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}function lA(e,t,n,i){e._eventListeners.push({type:n,sources:q(t),handler:i})}function X4(e,t){var n=e._eventConfig.defaults,i=n.prevent,r=n.allow;return i===!1||r===!0?!1:i===!0||r===!1?!0:i?i[t]:r?!r[t]:e.preventDefault()}function ol(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return i===!1||U(i)&&!i[n]?(e.warn(`Blocked ${t} ${n} event listener.`),!1):!0}function Y4(e,t,n){var i=this,r=new Gc(n),s=function(l,c){i.runAsync(null,()=>{e===Wx&&X4(i,t)&&l.preventDefault(),r.receive(j4(i,l,c))})},o;if(e===W4)ol(i,"timer",t)&&i.timer(s,t);else if(e===Wx)ol(i,"view",t)&&i.addEventListener(t,s,H4);else if(e===G4?ol(i,"window",t)&&typeof window<"u"&&(o=[window]):typeof document<"u"&&ol(i,"selector",t)&&(o=Array.from(document.querySelectorAll(e))),!o)i.warn("Can not resolve event source: "+e);else{for(var a=0,u=o.length;a=0;)t[r].stop();for(r=i.length;--r>=0;)for(o=i[r],s=o.sources.length;--s>=0;)o.sources[s].removeEventListener(o.type,o.handler);for(e&&e.call(this,this._handler,null,null,null),r=n.length;--r>=0;)u=n[r].type,a=n[r].handler,this._handler.off(u,a);return this}function qt(e,t,n){const i=document.createElement(e);for(const r in t)i.setAttribute(r,t[r]);return n!=null&&(i.textContent=n),i}const Q4="vega-bind",Z4="vega-bind-name",e9="vega-bind-radio";function t9(e,t,n){if(!t)return;const i=n.param;let r=n.state;return r||(r=n.state={elements:null,active:!1,set:null,update:o=>{o!=e.signal(i.signal)&&e.runAsync(null,()=>{r.source=!0,e.signal(i.signal,o)})}},i.debounce&&(r.update=kg(i.debounce,r.update))),(i.input==null&&i.element?n9:r9)(r,t,i,e),r.active||(e.on(e._signals[i.signal],null,()=>{r.source?r.source=!1:r.set(e.signal(i.signal))}),r.active=!0),r}function n9(e,t,n,i){const r=n.event||"input",s=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,s),lA(i,t,r,s),e.set=o=>{t.value=o,t.dispatchEvent(i9(r))}}function i9(e){return typeof Event<"u"?new Event(e):{type:e}}function r9(e,t,n,i){const r=i.signal(n.signal),s=qt("div",{class:Q4}),o=n.input==="radio"?s:s.appendChild(qt("label"));o.appendChild(qt("span",{class:Z4},n.name||n.signal)),t.appendChild(s);let a=s9;switch(n.input){case"checkbox":a=o9;break;case"select":a=a9;break;case"radio":a=u9;break;case"range":a=l9;break}a(e,o,n,r)}function s9(e,t,n,i){const r=qt("input");for(const s in n)s!=="signal"&&s!=="element"&&r.setAttribute(s==="input"?"type":s,n[s]);r.setAttribute("name",n.signal),r.value=i,t.appendChild(r),r.addEventListener("input",()=>e.update(r.value)),e.elements=[r],e.set=s=>r.value=s}function o9(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const s=qt("input",r);t.appendChild(s),s.addEventListener("change",()=>e.update(s.checked)),e.elements=[s],e.set=o=>s.checked=!!o||null}function a9(e,t,n,i){const r=qt("select",{name:n.signal}),s=n.labels||[];n.options.forEach((o,a)=>{const u={value:o};gc(o,i)&&(u.selected=!0),r.appendChild(qt("option",u,(s[a]||o)+""))}),t.appendChild(r),r.addEventListener("change",()=>{e.update(n.options[r.selectedIndex])}),e.elements=[r],e.set=o=>{for(let a=0,u=n.options.length;a{const u={type:"radio",name:n.signal,value:o};gc(o,i)&&(u.checked=!0);const l=qt("input",u);l.addEventListener("change",()=>e.update(o));const c=qt("label",{},(s[a]||o)+"");return c.prepend(l),r.appendChild(c),l}),e.set=o=>{const a=e.elements,u=a.length;for(let l=0;l{u.textContent=a.value,e.update(+a.value)};a.addEventListener("input",l),a.addEventListener("change",l),e.elements=[a],e.set=c=>{a.value=c,u.textContent=c}}function gc(e,t){return e===t||e+""==t+""}function cA(e,t,n,i,r,s){return t=t||new i(e.loader()),t.initialize(n,aA(e),uA(e),wf(e),r,s).background(e.background())}function oy(e,t){return t?function(){try{t.apply(this,arguments)}catch(n){e.error(n)}}:null}function c9(e,t,n,i){const r=new i(e.loader(),oy(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,wf(e),e);return t&&t.handlers().forEach(s=>{r.on(s.type,s.handler)}),r}function f9(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,s=hf(i);e=n._el=e?Kd(n,e,!0):null,M4(n),s||n.error("Unrecognized renderer type: "+i);const o=s.handler||Au,a=e?s.renderer:s.headless;return n._renderer=a?cA(n,n._renderer,e,a):null,n._handler=c9(n,n._handler,e,o),n._redraw=!0,e&&r!=="none"&&(t=t?n._elBind=Kd(n,t,!0):e.appendChild(qt("form",{class:"vega-bindings"})),n._bind.forEach(u=>{u.param.element&&r!=="container"&&(u.element=Kd(n,u.param.element,!!u.param.input))}),n._bind.forEach(u=>{t9(n,u.element||t,u)})),n}function Kd(e,t,n){if(typeof t=="string")if(typeof document<"u"){if(t=document.querySelector(t),!t)return e.error("Signal bind element not found: "+t),null}else return e.error("DOM document instance not found."),null;if(t&&n)try{t.textContent=""}catch(i){t=null,e.error(i)}return t}const aa=e=>+e||0,d9=e=>({top:e,bottom:e,left:e,right:e});function Xx(e){return U(e)?{top:aa(e.top),bottom:aa(e.bottom),left:aa(e.left),right:aa(e.right)}:d9(aa(e))}async function ay(e,t,n,i){const r=hf(t),s=r&&r.headless;return s||A("Unrecognized renderer type: "+t),await e.runAsync(),cA(e,null,null,s,n,i).renderAsync(e._scenegraph.root)}async function h9(e,t){e!==Zi.Canvas&&e!==Zi.SVG&&e!==Zi.PNG&&A("Unrecognized image type: "+e);const n=await ay(this,e,t);return e===Zi.SVG?p9(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")}function p9(e,t){const n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}async function g9(e,t){return(await ay(this,Zi.Canvas,e,t)).canvas()}async function m9(e){return(await ay(this,Zi.SVG,e)).svg()}function y9(e,t,n){return rA(e,ro,Qa,n).parse(t)}function b9(e){var t=this._runtime.scales;return G(t,e)||A("Unrecognized scale or projection: "+e),t[e].value}var fA="width",dA="height",uy="padding",Yx={skip:!0};function hA(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===uy?i.left+i.right:0)}function pA(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===uy?i.top+i.bottom:0)}function x9(e){var t=e._signals,n=t[fA],i=t[dA],r=t[uy];function s(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,a=>{e._width=a.size,e._viewWidth=hA(e,a.size),s()},{size:n}),e._resizeHeight=e.add(null,a=>{e._height=a.size,e._viewHeight=pA(e,a.size),s()},{size:i});const o=e.add(null,s,{pad:r});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=i.rank+1,o.rank=r.rank+1}function v9(e,t,n,i,r,s){this.runAfter(o=>{let a=0;o._autosize=0,o.width()!==n&&(a=1,o.signal(fA,n,Yx),o._resizeWidth.skip(!0)),o.height()!==i&&(a=1,o.signal(dA,i,Yx),o._resizeHeight.skip(!0)),o._viewWidth!==e&&(o._resize=1,o._viewWidth=e),o._viewHeight!==t&&(o._resize=1,o._viewHeight=t),(o._origin[0]!==r[0]||o._origin[1]!==r[1])&&(o._resize=1,o._origin=r),a&&o.run("enter"),s&&o.runAfter(u=>u.resize())},!1,1)}function E9(e){return this._runtime.getState(e||{data:w9,signals:S9,recurse:!0})}function w9(e,t){return t.modified&&F(t.input.value)&&!e.startsWith("_:vega:_")}function S9(e,t){return!(e==="parent"||t instanceof ro.proxy)}function k9(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},t=>{t._trigger=!0}),this}function $9(e,t){function n(i){e({timestamp:Date.now(),elapsed:i})}this._timers.push(f_(n,t))}function A9(e,t,n,i){const r=e.element();r&&r.setAttribute("title",C9(i))}function C9(e){return e==null?"":F(e)?gA(e):U(e)&&!rr(e)?F9(e):e+""}function F9(e){return Object.keys(e).map(t=>{const n=e[t];return t+": "+(F(n)?gA(n):mA(n))}).join(` +`)}function gA(e){return"["+e.map(mA).join(", ")+"]"}function mA(e){return F(e)?"[…]":U(e)&&!rr(e)?"{…}":e}function O9(){if(this.renderer()==="canvas"&&this._renderer._canvas){let e=null;const t=()=>{e?.();const n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener("change",t),e=()=>{n.removeEventListener("change",t)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};t()}}function yA(e,t){const n=this;if(t=t||{},Ks.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),t.logLevel!=null&&n.logLevel(t.logLevel),t.locale||e.locale){const s=re({},e.locale,t.locale);n.locale(xS(s.number,s.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||Zi.Canvas,n._scenegraph=new dk;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||A9,n._redraw=!0,n._handler=new Au().scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=V4(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const r=y9(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map(s=>({state:null,param:re({},s)})),r.root&&r.root.set(i),i.source=r.data.root.input,n.pulse(r.data.root.input,n.changeset().insert(i.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=hA(n,n._width),n._viewHeight=pA(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,x9(n),L4(n),P4(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function al(e,t){return G(e._signals,t)?e._signals[t]:A("Unrecognized signal name: "+L(t))}function bA(e,t){const n=(e._targets||[]).filter(i=>i._update&&i._update.handler===t);return n.length?n[0]:null}function Kx(e,t,n,i){let r=bA(n,i);return r||(r=oy(e,()=>i(t,n.value)),r.handler=i,e.on(n,null,r)),e}function Jx(e,t,n){const i=bA(t,n);return i&&t._targets.remove(i),e}z(yA,Ks,{async evaluate(e,t,n){if(await Ks.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,U4(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(i){this.error(i)}return n&&Sl(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=e!=null?e+"":null;return t!==this._desc&&oA(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){const i=al(this,e);return arguments.length===1?i.value:this.update(i,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",Xx(e)):Xx(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(hf(e)||A("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(Ks.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(al(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:v9,addEventListener(e,t,n){let i=t;return n&&n.trap===!1||(i=oy(this,t),i.raw=t),this._handler.on(e,i),this},removeEventListener(e,t){for(var n=this._handler.handlers(e),i=n.length,r,s;--i>=0;)if(s=n[i].type,r=n[i].handler,e===s&&(t===r||t===r.raw)){this._handler.off(s,r);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.includes(e)||t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return Kx(this,e,al(this,e),t)},removeSignalListener(e,t){return Jx(this,al(this,e),t)},addDataListener(e,t){return Kx(this,e,pc(this,e).values,t)},removeDataListener(e,t){return Jx(this,pc(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=$p(this,null);this._globalCursor=!!e,t&&$p(this,t)}return this}else return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:$9,events:Y4,finalize:J4,hover:K4,data:I4,change:Ef,insert:z4,remove:B4,scale:b9,initialize:f9,toImageURL:h9,toCanvas:g9,toSVG:m9,getState:E9,setState:k9,_watchPixelRatio:O9});const D9="view",mc="[",yc="]",xA="{",vA="}",R9=":",EA=",",_9="@",T9=">",N9=/[[\]{}]/,M9={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let wA,SA;function Er(e,t,n){return wA=t||D9,SA=n||M9,kA(e.trim()).map(Ap)}function L9(e){return SA[e]}function Pa(e,t,n,i,r){const s=e.length;let o=0,a;for(;t' after between selector: "+e;i=i.map(Ap);const r=Ap(e.slice(1).trim());return r.between?{between:i,stream:r}:(r.between=i,r)}function I9(e){const t={source:wA},n=[];let i=[0,0],r=0,s=0,o=e.length,a=0,u,l;if(e[o-1]===vA){if(a=e.lastIndexOf(xA),a>=0){try{i=z9(e.substring(a+1,o-1))}catch{throw"Invalid throttle specification: "+e}e=e.slice(0,a).trim(),o=e.length}else throw"Unmatched right brace: "+e;a=0}if(!o)throw e;if(e[0]===_9&&(r=++a),u=Pa(e,a,R9),u1?(t.type=n[1],r?t.markname=n[0].slice(1):L9(n[0])?t.marktype=n[0]:t.source=n[0]):t.type=n[0],t.type.slice(-1)==="!"&&(t.consume=!0,t.type=t.type.slice(0,-1)),l!=null&&(t.filter=l),i[0]&&(t.throttle=i[0]),i[1]&&(t.debounce=i[1]),t}function z9(e){const t=e.split(EA);if(!e.length||t.length>2)throw e;return t.map(n=>{const i=+n;if(i!==i)throw e;return i})}function B9(e){return U(e)?e:{type:e||"pad"}}const ua=e=>+e||0,U9=e=>({top:e,bottom:e,left:e,right:e});function j9(e){return U(e)?e.signal?e:{top:ua(e.top),bottom:ua(e.bottom),left:ua(e.left),right:ua(e.right)}:U9(ua(e))}const Ke=e=>U(e)&&!F(e)?re({},e):{value:e};function Qx(e,t,n,i){return n!=null?(U(n)&&!F(n)||F(n)&&n.length&&U(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1):0}function ot(e,t,n){for(const i in t)Qx(e,i,t[i]);for(const i in n)Qx(e,i,n[i],"update")}function Uo(e,t,n){for(const i in t)n&&G(n,i)||(e[i]=re(e[i]||{},t[i]));return e}function qs(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const ly="mark",cy="frame",fy="scope",q9="axis",W9="axis-domain",G9="axis-grid",H9="axis-label",V9="axis-tick",X9="axis-title",Y9="legend",K9="legend-band",J9="legend-entry",Q9="legend-gradient",$A="legend-label",Z9="legend-symbol",e7="legend-title",t7="title",n7="title-text",i7="title-subtitle";function r7(e,t,n,i,r){const s={},o={};let a,u,l,c;u="lineBreak",t==="text"&&r[u]!=null&&!qs(u,e)&&Jd(s,u,r[u]),(n=="legend"||String(n).startsWith("axis"))&&(n=null),c=n===cy?r.group:n===ly?re({},r.mark,r[t]):null;for(u in c)l=qs(u,e)||(u==="fill"||u==="stroke")&&(qs("fill",e)||qs("stroke",e)),l||Jd(s,u,c[u]);q(i).forEach(f=>{const d=r.style&&r.style[f];for(const p in d)qs(p,e)||Jd(s,p,d[p])}),e=re({},e);for(u in s)c=s[u],c.signal?(a=a||{})[u]=c:o[u]=c;return e.enter=re(o,e.enter),a&&(e.update=re(a,e.update)),e}function Jd(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const AA=e=>j(e)?L(e):e.signal?`(${e.signal})`:CA(e);function Sf(e){if(e.gradient!=null)return o7(e);let t=e.signal?`(${e.signal})`:e.color?s7(e.color):e.field!=null?CA(e.field):e.value!==void 0?L(e.value):void 0;return e.scale!=null&&(t=a7(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${Pl(e.exponent)})`),e.mult!=null&&(t+=`*${Pl(e.mult)}`),e.offset!=null&&(t+=`+${Pl(e.offset)}`),e.round&&(t=`round(${t})`),t}const ul=(e,t,n,i)=>`(${e}(${[t,n,i].map(Sf).join(",")})+'')`;function s7(e){return e.c?ul("hcl",e.h,e.c,e.l):e.h||e.s?ul("hsl",e.h,e.s,e.l):e.l||e.a?ul("lab",e.l,e.a,e.b):e.r||e.g||e.b?ul("rgb",e.r,e.g,e.b):null}function o7(e){const t=[e.start,e.stop,e.count].map(n=>n==null?null:L(n));for(;t.length&&ue(t)==null;)t.pop();return t.unshift(AA(e.gradient)),`gradient(${t.join(",")})`}function Pl(e){return U(e)?"("+Sf(e)+")":e}function CA(e){return FA(U(e)?e:{datum:e})}function FA(e){let t,n,i;if(e.signal)t="datum",i=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(i=e.parent,t+=".datum"):i=e.group}else e.datum?(t="datum",i=e.datum):A("Invalid field reference: "+L(e));return e.signal||(i=j(i)?si(i).map(L).join("]["):FA(i)),t+"["+i+"]"}function a7(e,t){const n=AA(e.scale);return e.range!=null?t=`lerp(_range(${n}), ${+e.range})`:(t!==void 0&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(+e.band==1?"":"*"+Pl(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),t==null&&(t="0")),t}function u7(e){let t="";return e.forEach(n=>{const i=Sf(n);t+=n.test?`(${n.test})?${i}:`:i}),ue(t)===":"&&(t+="null"),t}function OA(e,t,n,i,r,s){const o={};s=s||{},s.encoders={$encode:o},e=r7(e,t,n,i,r.config);for(const a in e)o[a]=l7(e[a],t,s,r);return s}function l7(e,t,n,i){const r={},s={};for(const o in e)e[o]!=null&&(r[o]=f7(c7(e[o]),i,n,s));return{$expr:{marktype:t,channels:r},$fields:Object.keys(s),$output:Object.keys(e)}}function c7(e){return F(e)?u7(e):Sf(e)}function f7(e,t,n,i){const r=ti(e,t);return r.$fields.forEach(s=>i[s]=1),re(n,r.$params),r.$expr}const d7="outer",h7=["value","update","init","react","bind"];function Zx(e,t){A(e+' for "outer" push: '+L(t))}function DA(e,t){const n=e.name;if(e.push===d7)t.signals[n]||Zx("No prior signal definition",n),h7.forEach(i=>{e[i]!==void 0&&Zx("Invalid property ",i)});else{const i=t.addSignal(n,e.value);e.react===!1&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function Cp(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function kf(e,t,n,i){return new Cp(e,t,n,i)}function bc(e,t){return kf("operator",e,t)}function J(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Za(e,t){return t?{$field:e,$name:t}:{$field:e}}const Fp=Za("key");function ev(e,t){return{$compare:e,$order:t}}function p7(e,t){const n={$key:e};return t&&(n.$flat=!0),n}const g7="ascending",m7="descending";function y7(e){return U(e)?(e.order===m7?"-":"+")+$f(e.op,e.field):""}function $f(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const dy="scope",Op="view";function He(e){return e&&e.signal}function b7(e){return e&&e.expr}function Il(e){if(He(e))return!0;if(U(e)){for(const t in e)if(Il(e[t]))return!0}return!1}function yn(e,t){return e??t}function Vr(e){return e&&e.signal||e}const tv="timer";function eu(e,t){return(e.merge?v7:e.stream?E7:e.type?w7:A("Invalid stream specification: "+L(e)))(e,t)}function x7(e){return e===dy?Op:e||Op}function v7(e,t){const n=e.merge.map(r=>eu(r,t)),i=hy({merge:n},e,t);return t.addStream(i).id}function E7(e,t){const n=eu(e.stream,t),i=hy({stream:n},e,t);return t.addStream(i).id}function w7(e,t){let n;e.type===tv?(n=t.event(tv,e.throttle),e={between:e.between,filter:e.filter}):n=t.event(x7(e.source),e.type);const i=hy({stream:n},e,t);return Object.keys(i).length===1?n:t.addStream(i).id}function hy(e,t,n){let i=t.between;return i&&(i.length!==2&&A('Stream "between" parameter must have 2 entries: '+L(t)),e.between=[eu(i[0],n),eu(i[1],n)]),i=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&i.push(S7(t.marktype,t.markname,t.markrole)),t.source===dy&&i.push("inScope(event.item)"),i.length&&(e.filter=ti("("+i.join(")&&(")+")",n).$expr),(i=t.throttle)!=null&&(e.throttle=+i),(i=t.debounce)!=null&&(e.debounce=+i),t.consume&&(e.consume=!0),e}function S7(e,t,n){const i="event.item";return i+(e&&e!=="*"?"&&"+i+".mark.marktype==='"+e+"'":"")+(n?"&&"+i+".mark.role==='"+n+"'":"")+(t?"&&"+i+".mark.name==='"+t+"'":"")}const k7={code:"_.$value",ast:{type:"Identifier",value:"value"}};function $7(e,t,n){const i=e.encode,r={target:n};let s=e.events,o=e.update,a=[];s||A("Signal update missing events specification."),j(s)&&(s=Er(s,t.isSubscope()?dy:Op)),s=q(s).filter(u=>u.signal||u.scale?(a.push(u),0):1),a.length>1&&(a=[C7(a)]),s.length&&a.push(s.length>1?{merge:s}:s[0]),i!=null&&(o&&A("Signal encode and update are mutually exclusive."),o="encode(item(),"+L(i)+")"),r.update=j(o)?ti(o,t):o.expr!=null?ti(o.expr,t):o.value!=null?o.value:o.signal!=null?{$expr:k7,$params:{$value:t.signalRef(o.signal)}}:A("Invalid signal update specification."),e.force&&(r.options={force:!0}),a.forEach(u=>t.addUpdate(re(A7(u,t),r)))}function A7(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):eu(e,t)}}function C7(e){return{signal:"["+e.map(t=>t.scale?'scale("'+t.scale+'")':t.signal)+"]"}}function F7(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?A("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=ti(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach(r=>$7(r,t,n.id))}const Ee=e=>(t,n,i)=>kf(e,n,t||void 0,i),RA=Ee("aggregate"),O7=Ee("axisticks"),_A=Ee("bound"),Tn=Ee("collect"),nv=Ee("compare"),D7=Ee("datajoin"),TA=Ee("encode"),R7=Ee("expression"),_7=Ee("facet"),T7=Ee("field"),N7=Ee("key"),M7=Ee("legendentries"),L7=Ee("load"),P7=Ee("mark"),I7=Ee("multiextent"),z7=Ee("multivalues"),B7=Ee("overlap"),U7=Ee("params"),NA=Ee("prefacet"),j7=Ee("projection"),q7=Ee("proxy"),W7=Ee("relay"),MA=Ee("render"),G7=Ee("scale"),Ss=Ee("sieve"),H7=Ee("sortitems"),LA=Ee("viewlayout"),V7=Ee("values");let X7=0;const PA={min:"min",max:"max",count:"sum"};function Y7(e,t){const n=e.type||"linear";$2(n)||A("Unrecognized scale type: "+L(n)),t.addScale(e.name,{type:n,domain:void 0})}function K7(e,t){const n=t.getScale(e.name).params;let i;n.domain=IA(e.domain,e,t),e.range!=null&&(n.range=BA(e,t,n)),e.interpolate!=null&&oB(e.interpolate,n),e.nice!=null&&(n.nice=sB(e.nice,t)),e.bins!=null&&(n.bins=rB(e.bins,t));for(i in e)G(n,i)||i==="name"||(n[i]=Zt(e[i],t))}function Zt(e,t){return U(e)?e.signal?t.signalRef(e.signal):A("Unsupported object: "+L(e)):e}function zl(e,t){return e.signal?t.signalRef(e.signal):e.map(n=>Zt(n,t))}function Af(e){A("Can not find data set: "+L(e))}function IA(e,t,n){if(!e){(t.domainMin!=null||t.domainMax!=null)&&A("No scale domain defined for domainMin/domainMax to override.");return}return e.signal?n.signalRef(e.signal):(F(e)?J7:e.fields?Z7:Q7)(e,t,n)}function J7(e,t,n){return e.map(i=>Zt(i,n))}function Q7(e,t,n){const i=n.getData(e.data);return i||Af(e.data),ao(t.type)?i.valuesRef(n,e.field,zA(e.sort,!1)):F2(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function Z7(e,t,n){const i=e.data,r=e.fields.reduce((s,o)=>(o=j(o)?{data:i,field:o}:F(o)||o.signal?eB(o,n):o,s.push(o),s),[]);return(ao(t.type)?tB:F2(t.type)?nB:iB)(e,n,r)}function eB(e,t){const n="_:vega:_"+X7++,i=Tn({});if(F(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+L(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,Ss({})]),{data:n,field:"data"}}function tB(e,t,n){const i=zA(e.sort,!0);let r,s;const o=n.map(l=>{const c=t.getData(l.data);return c||Af(l.data),c.countsRef(t,l.field,i)}),a={groupby:Fp,pulse:o};i&&(r=i.op||"count",s=i.field?$f(r,i.field):"count",a.ops=[PA[r]],a.fields=[t.fieldRef(s)],a.as=[s]),r=t.add(RA(a));const u=t.add(Tn({pulse:J(r)}));return s=t.add(V7({field:Fp,sort:t.sortRef(i),pulse:J(u)})),J(s)}function zA(e,t){return e&&(!e.field&&!e.op?U(e)?e.field="key":e={field:"key"}:!e.field&&e.op!=="count"?A("No field provided for sort aggregate op: "+e.op):t&&e.field&&e.op&&!PA[e.op]&&A("Multiple domain scales can not be sorted using "+e.op)),e}function nB(e,t,n){const i=n.map(r=>{const s=t.getData(r.data);return s||Af(r.data),s.domainRef(t,r.field)});return J(t.add(z7({values:i})))}function iB(e,t,n){const i=n.map(r=>{const s=t.getData(r.data);return s||Af(r.data),s.extentRef(t,r.field)});return J(t.add(I7({extents:i})))}function rB(e,t){return e.signal||F(e)?zl(e,t):t.objectProperty(e)}function sB(e,t){return e.signal?t.signalRef(e.signal):U(e)?{interval:Zt(e.interval),step:Zt(e.step)}:Zt(e)}function oB(e,t){t.interpolate=Zt(e.type||e),e.gamma!=null&&(t.interpolateGamma=Zt(e.gamma))}function BA(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(j(r)){if(i&&G(i,r))return e=re({},e,{range:i[r]}),BA(e,t,n);r==="width"?r=[0,{signal:"width"}]:r==="height"?r=ao(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:A("Unrecognized scale range value: "+L(r))}else if(r.scheme){n.scheme=F(r.scheme)?zl(r.scheme,t):Zt(r.scheme,t),r.extent&&(n.schemeExtent=zl(r.extent,t)),r.count&&(n.schemeCount=Zt(r.count,t));return}else if(r.step){n.rangeStep=Zt(r.step,t);return}else{if(ao(e.type)&&!F(r))return IA(r,e,t);F(r)||A("Unsupported range type: "+L(r))}return r.map(s=>(F(s)?zl:Zt)(s,t))}function aB(e,t){const n=t.config.projection||{},i={};for(const r in e)r!=="name"&&(i[r]=Dp(e[r],r,t));for(const r in n)i[r]==null&&(i[r]=Dp(n[r],r,t));t.addProjection(e.name,i)}function Dp(e,t,n){return F(e)?e.map(i=>Dp(i,t,n)):U(e)?e.signal?n.signalRef(e.signal):t==="fit"?e:A("Unsupported parameter object: "+L(e)):e}const Nn="top",jo="left",qo="right",pr="bottom",UA="center",uB="vertical",lB="start",cB="middle",fB="end",Rp="index",py="label",dB="offset",ho="perc",hB="perc2",tn="value",Ru="guide-label",gy="guide-title",pB="group-title",gB="group-subtitle",iv="symbol",Bl="gradient",_p="discrete",Tp="size",mB="shape",yB="fill",bB="stroke",xB="strokeWidth",vB="strokeDash",EB="opacity",my=[Tp,mB,yB,bB,xB,vB,EB],_u={name:1,style:1,interactive:1},le={value:0},nn={value:1},Cf="group",jA="rect",yy="rule",wB="symbol",ks="text";function tu(e){return e.type=Cf,e.interactive=e.interactive||!1,e}function Lt(e,t){const n=(i,r)=>yn(e[i],yn(t[i],r));return n.isVertical=i=>uB===yn(e.direction,t.direction||(i?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>yn(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>yn(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>yn(e.columns,yn(t.columns,+n.isVertical(!0))),n}function qA(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function SB(e,t,n){const i=t.config.style[n];return i&&i[e]}function Ff(e,t,n){return`item.anchor === '${lB}' ? ${e} : item.anchor === '${fB}' ? ${t} : ${n}`}const by=Ff(L(jo),L(qo),L(UA));function kB(e){const t=e("tickBand");let n=e("tickOffset"),i,r;return t?t.signal?(i={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},r={signal:`(${t.signal}) === 'extent'`},U(n)||(n={signal:`(${t.signal}) === 'extent' ? 0 : ${n}`})):t==="extent"?(i=1,r=!0,n=0):(i=.5,r=!1):(i=e("bandPosition"),r=e("tickExtra")),{extra:r,band:i,offset:n}}function WA(e,t){return t?e?U(e)?Object.assign({},e,{offset:WA(e.offset,t)}):{value:e,offset:t}:t:e}function Yt(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=Uo(e.encode,t,_u)):e.interactive=!1,e}function $B(e,t,n,i){const r=Lt(e,n),s=r.isVertical(),o=r.gradientThickness(),a=r.gradientLength();let u,l,c,f,d;s?(l=[0,1],c=[0,0],f=o,d=a):(l=[0,0],c=[1,0],f=a,d=o);const p={enter:u={opacity:le,x:le,y:le,width:Ke(f),height:Ke(d)},update:re({},u,{opacity:nn,fill:{gradient:t,start:l,stop:c}}),exit:{opacity:le}};return ot(p,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),Yt({type:jA,role:Q9,encode:p},i)}function AB(e,t,n,i,r){const s=Lt(e,n),o=s.isVertical(),a=s.gradientThickness(),u=s.gradientLength();let l,c,f,d,p="";o?(l="y",f="y2",c="x",d="width",p="1-"):(l="x",f="x2",c="y",d="height");const h={opacity:le,fill:{scale:t,field:tn}};h[l]={signal:p+"datum."+ho,mult:u},h[c]=le,h[f]={signal:p+"datum."+hB,mult:u},h[d]=Ke(a);const g={enter:h,update:re({},h,{opacity:nn}),exit:{opacity:le}};return ot(g,{stroke:s("gradientStrokeColor"),strokeWidth:s("gradientStrokeWidth")},{opacity:s("gradientOpacity")}),Yt({type:jA,role:K9,key:tn,from:r,encode:g},i)}const CB=`datum.${ho}<=0?"${jo}":datum.${ho}>=1?"${qo}":"${UA}"`,FB=`datum.${ho}<=0?"${pr}":datum.${ho}>=1?"${Nn}":"${cB}"`;function rv(e,t,n,i){const r=Lt(e,t),s=r.isVertical(),o=Ke(r.gradientThickness()),a=r.gradientLength();let u=r("labelOverlap"),l,c,f,d,p="";const h={enter:l={opacity:le},update:c={opacity:nn,text:{field:py}},exit:{opacity:le}};return ot(h,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:yn(e.labelLimit,t.gradientLabelLimit)}),s?(l.align={value:"left"},l.baseline=c.baseline={signal:FB},f="y",d="x",p="1-"):(l.align=c.align={signal:CB},l.baseline={value:"top"},f="x",d="y"),l[f]=c[f]={signal:p+"datum."+ho,mult:a},l[d]=c[d]=o,o.offset=yn(e.labelOffset,t.gradientLabelOffset)||0,u=u?{separation:r("labelSeparation"),method:u,order:"datum."+Rp}:void 0,Yt({type:ks,role:$A,style:Ru,key:tn,from:i,encode:h,overlap:u},n)}function OB(e,t,n,i,r){const s=Lt(e,t),o=n.entries,a=!!(o&&o.interactive),u=o?o.name:void 0,l=s("clipHeight"),c=s("symbolOffset"),f={data:"value"},d=`(${r}) ? datum.${dB} : datum.${Tp}`,p=l?Ke(l):{field:Tp},h=`datum.${Rp}`,g=`max(1, ${r})`;let m,y,b,v,w;p.mult=.5,m={enter:y={opacity:le,x:{signal:d,mult:.5,offset:c},y:p},update:b={opacity:nn,x:y.x,y:y.y},exit:{opacity:le}};let E=null,S=null;e.fill||(E=t.symbolBaseFillColor,S=t.symbolBaseStrokeColor),ot(m,{fill:s("symbolFillColor",E),shape:s("symbolType"),size:s("symbolSize"),stroke:s("symbolStrokeColor",S),strokeDash:s("symbolDash"),strokeDashOffset:s("symbolDashOffset"),strokeWidth:s("symbolStrokeWidth")},{opacity:s("symbolOpacity")}),my.forEach(P=>{e[P]&&(b[P]=y[P]={scale:e[P],field:tn})});const x=Yt({type:wB,role:Z9,key:tn,from:f,clip:l?!0:void 0,encode:m},n.symbols),k=Ke(c);k.offset=s("labelOffset"),m={enter:y={opacity:le,x:{signal:d,offset:k},y:p},update:b={opacity:nn,text:{field:py},x:y.x,y:y.y},exit:{opacity:le}},ot(m,{align:s("labelAlign"),baseline:s("labelBaseline"),fill:s("labelColor"),fillOpacity:s("labelOpacity"),font:s("labelFont"),fontSize:s("labelFontSize"),fontStyle:s("labelFontStyle"),fontWeight:s("labelFontWeight"),limit:s("labelLimit")});const D=Yt({type:ks,role:$A,style:Ru,key:tn,from:f,encode:m},n.labels);return m={enter:{noBound:{value:!l},width:le,height:l?Ke(l):le,opacity:le},exit:{opacity:le},update:b={opacity:nn,row:{signal:null},column:{signal:null}}},s.isVertical(!0)?(v=`ceil(item.mark.items.length / ${g})`,b.row.signal=`${h}%${v}`,b.column.signal=`floor(${h} / ${v})`,w={field:["row",h]}):(b.row.signal=`floor(${h} / ${g})`,b.column.signal=`${h} % ${g}`,w={field:h}),b.column.signal=`(${r})?${b.column.signal}:${h}`,i={facet:{data:i,name:"value",groupby:Rp}},tu({role:fy,from:i,encode:Uo(m,o,_u),marks:[x,D],name:u,interactive:a,sort:w})}function DB(e,t){const n=Lt(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}const xy='item.orient === "left"',vy='item.orient === "right"',Of=`(${xy} || ${vy})`,RB=`datum.vgrad && ${Of}`,_B=Ff('"top"','"bottom"','"middle"'),TB=Ff('"right"','"left"','"center"'),NB=`datum.vgrad && ${vy} ? (${TB}) : (${Of} && !(datum.vgrad && ${xy})) ? "left" : ${by}`,MB=`item._anchor || (${Of} ? "middle" : "start")`,LB=`${RB} ? (${xy} ? -90 : 90) : 0`,PB=`${Of} ? (datum.vgrad ? (${vy} ? "bottom" : "top") : ${_B}) : "top"`;function IB(e,t,n,i){const r=Lt(e,t),s={enter:{opacity:le},update:{opacity:nn,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:le}};return ot(s,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:MB},angle:{signal:LB},align:{signal:NB},baseline:{signal:PB},text:e.title,fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),baseline:r("titleBaseline")}),Yt({type:ks,role:e7,style:gy,from:i,encode:s},n)}function zB(e,t){let n;return U(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+sv(e.path)+")":e.sphere&&(n="geoShape("+sv(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function sv(e){return U(e)&&e.signal?e.signal:L(e)}function GA(e){const t=e.role||"";return t.startsWith("axis")||t.startsWith("legend")||t.startsWith("title")?t:e.type===Cf?fy:t||ly}function BB(e){return{marktype:e.type,name:e.name||void 0,role:e.role||GA(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function UB(e,t){return e&&e.signal?t.signalRef(e.signal):e!==!1}function Ey(e,t){const n=_S(e.type);n||A("Unrecognized transform type: "+L(e.type));const i=kf(n.type.toLowerCase(),null,HA(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function HA(e,t,n){const i={},r=e.params.length;for(let s=0;sov(e,s,n)):ov(e,r,n)}function ov(e,t,n){const i=e.type;if(He(t))return uv(i)?A("Expression references can not be signals."):Qd(i)?n.fieldRef(t):lv(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||Qd(i);return r&&GB(t)?n.exprRef(t.expr,t.as):r&&HB(t)?Za(t.field,t.as):uv(i)?ti(t,n):VB(i)?J(n.getData(t).values):Qd(i)?Za(t):lv(i)?n.compareRef(t):t}}function qB(e,t,n){return j(t.from)||A('Lookup "from" parameter must be a string literal.'),n.getData(t.from).lookupRef(n,t.key)}function WB(e,t,n){const i=t[e.name];return e.array?(F(i)||A("Expected an array of sub-parameters. Instead: "+L(i)),i.map(r=>av(e,r,n))):av(e,i,n)}function av(e,t,n){const i=e.params.length;let r;for(let o=0;oe&&e.expr,HB=e=>e&&e.field,VB=e=>e==="data",uv=e=>e==="expr",Qd=e=>e==="field",lv=e=>e==="compare";function XB(e,t,n){let i,r,s,o,a;return e?(i=e.facet)&&(t||A("Only group marks can be faceted."),i.field!=null?o=a=Ul(i,n):(e.data?a=J(n.getData(e.data).aggregate):(s=Ey(re({type:"aggregate",groupby:q(i.groupby)},i.aggregate),n),s.params.key=n.keyRef(i.groupby),s.params.pulse=Ul(i,n),o=a=J(n.add(s))),r=n.keyRef(i.groupby,!0))):o=J(n.add(Tn(null,[{}]))),o||(o=Ul(e,n)),{key:r,pulse:o,parent:a}}function Ul(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:J(t.getData(e.data).output)}function ss(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}ss.fromEntries=function(e,t){const n=t.length,i=t[n-1],r=t[n-2];let s=t[0],o=null,a=1;for(s&&s.type==="load"&&(s=t[1]),e.add(t[0]);af??"null").join(",")+"),0)",c=ti(l,t);u.update=c.$expr,u.params=c.$params}function Df(e,t){const n=GA(e),i=e.type===Cf,r=e.from&&e.from.facet,s=e.overlap;let o=e.layout||n===fy||n===cy,a,u,l,c,f,d,p;const h=n===ly||o||r,g=XB(e.from,i,t);u=t.add(D7({key:g.key||(e.key?Za(e.key):void 0),pulse:g.pulse,clean:!i}));const m=J(u);u=l=t.add(Tn({pulse:m})),u=t.add(P7({markdef:BB(e),interactive:UB(e.interactive,t),clip:zB(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:J(u)}));const y=J(u);u=c=t.add(TA(OA(e.encode,e.type,n,e.style,t,{mod:!1,pulse:y}))),u.params.parent=t.encode(),e.transform&&e.transform.forEach(S=>{const x=Ey(S,t),k=x.metadata;(k.generates||k.changes)&&A("Mark transforms should not generate new data."),k.nomod||(c.params.mod=!0),x.params.pulse=J(u),t.add(u=x)}),e.sort&&(u=t.add(H7({sort:t.compareRef(e.sort),pulse:J(u)})));const b=J(u);(r||o)&&(o=t.add(LA({layout:t.objectProperty(e.layout),legends:t.legends,mark:y,pulse:b})),d=J(o));const v=t.add(_A({mark:y,pulse:d||b}));p=J(v),i&&(h&&(a=t.operators,a.pop(),o&&a.pop()),t.pushState(b,d||p,m),r?YB(e,t,g):h?KB(e,t,g):t.parse(e),t.popState(),h&&(o&&a.push(o),a.push(v))),s&&(p=JB(s,p,t));const w=t.add(MA({pulse:p})),E=t.add(Ss({pulse:J(w)},void 0,t.parent()));e.name!=null&&(f=e.name,t.addData(f,new ss(t,l,w,E)),e.on&&e.on.forEach(S=>{(S.insert||S.remove||S.toggle)&&A("Marks only support modify triggers."),XA(S,t,f)}))}function JB(e,t,n){const i=e.method,r=e.bound,s=e.separation,o={separation:He(s)?n.signalRef(s.signal):s,method:He(i)?n.signalRef(i.signal):i,pulse:t};if(e.order&&(o.sort=n.compareRef({field:e.order})),r){const a=r.tolerance;o.boundTolerance=He(a)?n.signalRef(a.signal):+a,o.boundScale=n.scaleRef(r.scale),o.boundOrient=r.orient}return J(n.add(B7(o)))}function QB(e,t){const n=t.config.legend,i=e.encode||{},r=Lt(e,n),s=i.legend||{},o=s.name||void 0,a=s.interactive,u=s.style,l={};let c=0,f,d,p;my.forEach(v=>e[v]?(l[v]=e[v],c=c||e[v]):0),c||A("Missing valid scale for legend.");const h=ZB(e,t.scaleType(c)),g={title:e.title!=null,scales:l,type:h,vgrad:h!=="symbol"&&r.isVertical()},m=J(t.add(Tn(null,[g]))),y={enter:{x:{value:0},y:{value:0}}},b=J(t.add(M7(d={type:h,scale:t.scaleRef(c),count:t.objectProperty(r("tickCount")),limit:t.property(r("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return h===Bl?(p=[$B(e,c,n,i.gradient),rv(e,n,i.labels,b)],d.count=d.count||t.signalRef(`max(2,2*floor((${Vr(r.gradientLength())})/100))`)):h===_p?p=[AB(e,c,n,i.gradient,b),rv(e,n,i.labels,b)]:(f=DB(e,n),p=[OB(e,n,i,b,Vr(f.columns))],d.size=nU(e,t,p[0].marks)),p=[tu({role:J9,from:m,encode:y,marks:p,layout:f,interactive:a})],g.title&&p.push(IB(e,n,i.title,m)),Df(tu({role:Y9,from:m,encode:Uo(tU(r,e,n),s,_u),marks:p,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:o,interactive:a,style:u}),t)}function ZB(e,t){let n=e.type||iv;return!e.type&&eU(e)===1&&(e.fill||e.stroke)&&(n=Tm(t)?Bl:Yh(t)?_p:iv),n!==Bl?n:Yh(t)?_p:Bl}function eU(e){return my.reduce((t,n)=>t+(e[n]?1:0),0)}function tU(e,t,n){const i={enter:{},update:{}};return ot(i,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),i}function nU(e,t,n){const i=Vr(fv("size",e,n)),r=Vr(fv("strokeWidth",e,n)),s=Vr(iU(n[1].encode,t,Ru));return ti(`max(ceil(sqrt(${i})+${r}),${s})`,t)}function fv(e,t,n){return t[e]?`scale("${t[e]}",datum)`:qA(e,n[0].encode)}function iU(e,t,n){return qA("fontSize",e)||SB("fontSize",t,n)}const rU=`item.orient==="${jo}"?-90:item.orient==="${qo}"?90:0`;function sU(e,t){e=j(e)?{text:e}:e;const n=Lt(e,t.config.title),i=e.encode||{},r=i.group||{},s=r.name||void 0,o=r.interactive,a=r.style,u=[],l={},c=J(t.add(Tn(null,[l])));return u.push(uU(e,n,oU(e),c)),e.subtitle&&u.push(lU(e,n,i.subtitle,c)),Df(tu({role:t7,from:c,encode:aU(n,r),marks:u,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:s,interactive:o,style:a}),t)}function oU(e){const t=e.encode;return t&&t.title||re({name:e.name,interactive:e.interactive,style:e.style},t)}function aU(e,t){const n={enter:{},update:{}};return ot(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:by},angle:{signal:rU},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),Uo(n,t,_u)}function uU(e,t,n,i){const r={value:0},s=e.text,o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return ot(o,{text:s,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),Yt({type:ks,role:n7,style:pB,from:i,encode:o},n)}function lU(e,t,n,i){const r={value:0},s=e.subtitle,o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return ot(o,{text:s,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),Yt({type:ks,role:i7,style:gB,from:i,encode:o},n)}function cU(e,t){const n=[];e.transform&&e.transform.forEach(i=>{n.push(Ey(i,t))}),e.on&&e.on.forEach(i=>{XA(i,t,e.name)}),t.addDataPipeline(e.name,fU(e,t,n))}function fU(e,t,n){const i=[];let r=null,s=!1,o=!1,a,u,l,c,f;for(e.values?He(e.values)||Il(e.format)?(i.push(dv(t,e)),i.push(r=Rr())):i.push(r=Rr({$ingest:e.values,$format:e.format})):e.url?Il(e.url)||Il(e.format)?(i.push(dv(t,e)),i.push(r=Rr())):i.push(r=Rr({$request:e.url,$format:e.format})):e.source&&(r=a=q(e.source).map(d=>J(t.getData(d).output)),i.push(null)),u=0,l=n.length;ue===pr||e===Nn,Rf=(e,t,n)=>He(e)?gU(e.signal,t,n):e===jo||e===Nn?t:n,Je=(e,t,n)=>He(e)?hU(e.signal,t,n):YA(e)?t:n,Sn=(e,t,n)=>He(e)?pU(e.signal,t,n):YA(e)?n:t,KA=(e,t,n)=>He(e)?mU(e.signal,t,n):e===Nn?{value:t}:{value:n},dU=(e,t,n)=>He(e)?yU(e.signal,t,n):e===qo?{value:t}:{value:n},hU=(e,t,n)=>JA(`${e} === '${Nn}' || ${e} === '${pr}'`,t,n),pU=(e,t,n)=>JA(`${e} !== '${Nn}' && ${e} !== '${pr}'`,t,n),gU=(e,t,n)=>wy(`${e} === '${jo}' || ${e} === '${Nn}'`,t,n),mU=(e,t,n)=>wy(`${e} === '${Nn}'`,t,n),yU=(e,t,n)=>wy(`${e} === '${qo}'`,t,n),JA=(e,t,n)=>(t=t!=null?Ke(t):t,n=n!=null?Ke(n):n,hv(t)&&hv(n)?(t=t?t.signal||L(t.value):null,n=n?n.signal||L(n.value):null,{signal:`${e} ? (${t}) : (${n})`}):[re({test:e},t)].concat(n||[])),hv=e=>e==null||Object.keys(e).length===1,wy=(e,t,n)=>({signal:`${e} ? (${Xs(t)}) : (${Xs(n)})`}),bU=(e,t,n,i,r)=>({signal:(i!=null?`${e} === '${jo}' ? (${Xs(i)}) : `:"")+(n!=null?`${e} === '${pr}' ? (${Xs(n)}) : `:"")+(r!=null?`${e} === '${qo}' ? (${Xs(r)}) : `:"")+(t!=null?`${e} === '${Nn}' ? (${Xs(t)}) : `:"")+"(null)"}),Xs=e=>He(e)?e.signal:e==null?null:L(e),xU=(e,t)=>t===0?0:He(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},Js=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function zs(e,t,n,i){let r;if(t&&G(t,e))return t[e];if(G(n,e))return n[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return i[gy][r]}else if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return i[Ru][r]}return null}function pv(e){const t={};for(const n of e)if(n)for(const i in n)t[i]=1;return Object.keys(t)}function vU(e,t){var n=t.config,i=n.style,r=n.axis,s=t.scaleType(e.scale)==="band"&&n.axisBand,o=e.orient,a,u,l;if(He(o)){const f=pv([n.axisX,n.axisY]),d=pv([n.axisTop,n.axisBottom,n.axisLeft,n.axisRight]);a={};for(l of f)a[l]=Je(o,zs(l,n.axisX,r,i),zs(l,n.axisY,r,i));u={};for(l of d)u[l]=bU(o.signal,zs(l,n.axisTop,r,i),zs(l,n.axisBottom,r,i),zs(l,n.axisLeft,r,i),zs(l,n.axisRight,r,i))}else a=o===Nn||o===pr?n.axisX:n.axisY,u=n["axis"+o[0].toUpperCase()+o.slice(1)];return a||u||s?re({},r,a,u,s):r}function EU(e,t,n,i){const r=Lt(e,t),s=e.orient;let o,a;const u={enter:o={opacity:le},update:a={opacity:nn},exit:{opacity:le}};ot(u,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const l=gv(e,0),c=gv(e,1);return o.x=a.x=Je(s,l,le),o.x2=a.x2=Je(s,c),o.y=a.y=Sn(s,l,le),o.y2=a.y2=Sn(s,c),Yt({type:yy,role:W9,from:i,encode:u},n)}function gv(e,t){return{scale:e.scale,range:t}}function wU(e,t,n,i,r){const s=Lt(e,t),o=e.orient,a=e.gridScale,u=Rf(o,1,-1),l=SU(e.offset,u);let c,f,d;const p={enter:c={opacity:le},update:d={opacity:nn},exit:f={opacity:le}};ot(p,{stroke:s("gridColor"),strokeCap:s("gridCap"),strokeDash:s("gridDash"),strokeDashOffset:s("gridDashOffset"),strokeOpacity:s("gridOpacity"),strokeWidth:s("gridWidth")});const h={scale:e.scale,field:tn,band:r.band,extra:r.extra,offset:r.offset,round:s("tickRound")},g=Je(o,{signal:"height"},{signal:"width"}),m=a?{scale:a,range:0,mult:u,offset:l}:{value:0,offset:l},y=a?{scale:a,range:1,mult:u,offset:l}:re(g,{mult:u,offset:l});return c.x=d.x=Je(o,h,m),c.y=d.y=Sn(o,h,m),c.x2=d.x2=Sn(o,y),c.y2=d.y2=Je(o,y),f.x=Je(o,h),f.y=Sn(o,h),Yt({type:yy,role:G9,key:tn,from:i,encode:p},n)}function SU(e,t){if(t!==1)if(!U(e))e=He(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);else{let n=e=re({},e);for(;n.mult!=null;)if(U(n.mult))n=n.mult=re({},n.mult);else return n.mult=He(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n.mult=t}return e}function kU(e,t,n,i,r,s){const o=Lt(e,t),a=e.orient,u=Rf(a,-1,1);let l,c,f;const d={enter:l={opacity:le},update:f={opacity:nn},exit:c={opacity:le}};ot(d,{stroke:o("tickColor"),strokeCap:o("tickCap"),strokeDash:o("tickDash"),strokeDashOffset:o("tickDashOffset"),strokeOpacity:o("tickOpacity"),strokeWidth:o("tickWidth")});const p=Ke(r);p.mult=u;const h={scale:e.scale,field:tn,band:s.band,extra:s.extra,offset:s.offset,round:o("tickRound")};return f.y=l.y=Je(a,le,h),f.y2=l.y2=Je(a,p),c.x=Je(a,h),f.x=l.x=Sn(a,le,h),f.x2=l.x2=Sn(a,p),c.y=Sn(a,h),Yt({type:yy,role:V9,key:tn,from:i,encode:d},n)}function Zd(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function $U(e,t,n,i,r,s){const o=Lt(e,t),a=e.orient,u=e.scale,l=Rf(a,-1,1),c=Vr(o("labelFlush")),f=Vr(o("labelFlushOffset")),d=o("labelAlign"),p=o("labelBaseline");let h=c===0||!!c,g;const m=Ke(r);m.mult=l,m.offset=Ke(o("labelPadding")||0),m.offset.mult=l;const y={scale:u,field:tn,band:.5,offset:WA(s.offset,o("labelOffset"))},b=Je(a,h?Zd(u,c,'"left"','"right"','"center"'):{value:"center"},dU(a,"left","right")),v=Je(a,KA(a,"bottom","top"),h?Zd(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),w=Zd(u,c,`-(${f})`,f,0);h=h&&f;const E={opacity:le,x:Je(a,y,m),y:Sn(a,y,m)},S={enter:E,update:g={opacity:nn,text:{field:py},x:E.x,y:E.y,align:b,baseline:v},exit:{opacity:le,x:E.x,y:E.y}};ot(S,{dx:!d&&h?Je(a,w):null,dy:!p&&h?Sn(a,w):null}),ot(S,{angle:o("labelAngle"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontWeight:o("labelFontWeight"),fontStyle:o("labelFontStyle"),limit:o("labelLimit"),lineHeight:o("labelLineHeight")},{align:d,baseline:p});const x=o("labelBound");let k=o("labelOverlap");return k=k||x?{separation:o("labelSeparation"),method:k,order:"datum.index",bound:x?{scale:u,orient:a,tolerance:x}:null}:void 0,g.align!==b&&(g.align=Js(g.align,b)),g.baseline!==v&&(g.baseline=Js(g.baseline,v)),Yt({type:ks,role:H9,style:Ru,key:tn,from:i,encode:S,overlap:k},n)}function AU(e,t,n,i){const r=Lt(e,t),s=e.orient,o=Rf(s,-1,1);let a,u;const l={enter:a={opacity:le,anchor:Ke(r("titleAnchor",null)),align:{signal:by}},update:u=re({},a,{opacity:nn,text:Ke(e.title)}),exit:{opacity:le}},c={signal:`lerp(range("${e.scale}"), ${Ff(0,1,.5)})`};return u.x=Je(s,c),u.y=Sn(s,c),a.angle=Je(s,le,xU(o,90)),a.baseline=Je(s,KA(s,pr,Nn),{value:pr}),u.angle=a.angle,u.baseline=a.baseline,ot(l,{fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),angle:r("titleAngle"),baseline:r("titleBaseline")}),CU(r,s,l,n),l.update.align=Js(l.update.align,a.align),l.update.angle=Js(l.update.angle,a.angle),l.update.baseline=Js(l.update.baseline,a.baseline),Yt({type:ks,role:X9,style:gy,from:i,encode:l},n)}function CU(e,t,n,i){const r=(a,u)=>a!=null?(n.update[u]=Js(Ke(a),n.update[u]),!1):!qs(u,i),s=r(e("titleX"),"x"),o=r(e("titleY"),"y");n.enter.auto=o===s?Ke(o):Je(t,Ke(o),Ke(s))}function FU(e,t){const n=vU(e,t),i=e.encode||{},r=i.axis||{},s=r.name||void 0,o=r.interactive,a=r.style,u=Lt(e,n),l=kB(u),c={scale:e.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:e.title!=null},f=J(t.add(Tn({},[c]))),d=J(t.add(O7({scale:t.scaleRef(e.scale),extra:t.property(l.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),p=[];let h;return c.grid&&p.push(wU(e,n,i.grid,d,l)),c.ticks&&(h=u("tickSize"),p.push(kU(e,n,i.ticks,d,h,l))),c.labels&&(h=c.ticks?h:0,p.push($U(e,n,i.labels,d,h,l))),c.domain&&p.push(EU(e,n,i.domain,f)),c.title&&p.push(AU(e,n,i.title,f)),Df(tu({role:q9,from:f,encode:Uo(OU(u,e),r,_u),marks:p,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:s,interactive:o,style:a}),t)}function OU(e,t){const n={enter:{},update:{}};return ot(n,{orient:e("orient"),offset:e("offset")||0,position:yn(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function QA(e,t,n){const i=q(e.signals),r=q(e.scales);return n||i.forEach(s=>DA(s,t)),q(e.projections).forEach(s=>aB(s,t)),r.forEach(s=>Y7(s,t)),q(e.data).forEach(s=>cU(s,t)),r.forEach(s=>K7(s,t)),(n||i).forEach(s=>F7(s,t)),q(e.axes).forEach(s=>FU(s,t)),q(e.marks).forEach(s=>Df(s,t)),q(e.legends).forEach(s=>QB(s,t)),e.title&&sU(e.title,t),t.parseLambdas(),t}const DU=e=>Uo({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function RU(e,t){const n=t.config,i=J(t.root=t.add(bc())),r=_U(e,n);r.forEach(l=>DA(l,t)),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;const s=t.add(Tn()),o=t.add(TA(OA(DU(e.encode),Cf,cy,e.style,t,{pulse:J(s)}))),a=t.add(LA({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:J(o)}));t.operators.pop(),t.pushState(J(o),J(a),null),QA(e,t,r),t.operators.push(a);let u=t.add(_A({mark:i,pulse:J(a)}));return u=t.add(MA({pulse:J(u)})),u=t.add(Ss({pulse:J(u)})),t.addData("root",new ss(t,s,s,u)),t}function ca(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function _U(e,t){const n=o=>yn(e[o],t[o]),i=[ca("background",n("background")),ca("autosize",B9(n("autosize"))),ca("padding",j9(n("padding"))),ca("width",n("width")||0),ca("height",n("height")||0)],r=i.reduce((o,a)=>(o[a.name]=a,o),{}),s={};return q(e.signals).forEach(o=>{G(r,o.name)?o=re(r[o.name],o):i.push(o),s[o.name]=o}),q(t.signals).forEach(o=>{!G(s,o.name)&&!G(r,o.name)&&i.push(o)}),i}function ZA(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function mv(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}ZA.prototype=mv.prototype={parse(e){return QA(e,this)},fork(){return new mv(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach(t=>{t.$ref=e.id}),e.refs=null),e},proxy(e){const t=e instanceof Cp?J(e):e;return this.add(q7({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;this.root&&(this.root.root=!0);for(e in this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(i,r,s){let o,a;i&&(o=i.data||(i.data={}),a=o[r]||(o[r]=[]),a.push(s))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const i in t.index)n(t.index[i],e,"index:"+i)}return this},pushState(e,t,n){this._encode.push(J(this.add(Ss({pulse:e})))),this._parent.push(t),this._lookup.push(n?J(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return ue(this._parent)},encode(){return ue(this._encode)},lookup(){return ue(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(j(e))return Za(e,t);e.signal||A("Unsupported field reference: "+L(e));const n=e.signal;let i=this.field[n];if(!i){const r={name:this.signalRef(n)};t&&(r.as=t),this.field[n]=i=J(this.add(T7(r)))}return i},compareRef(e){let t=!1;const n=s=>He(s)?(t=!0,this.signalRef(s.signal)):b7(s)?(t=!0,this.exprRef(s.expr)):s,i=q(e.field).map(n),r=q(e.order).map(n);return t?J(this.add(nv({fields:i,orders:r}))):ev(i,r)},keyRef(e,t){let n=!1;const i=s=>He(s)?(n=!0,J(r[s.signal])):s,r=this.signals;return e=q(e).map(i),n?J(this.add(N7({fields:e,flat:t}))):p7(e,t)},sortRef(e){if(!e)return e;const t=$f(e.op,e.field),n=e.order||g7;return n.signal?J(this.add(nv({fields:t,orders:this.signalRef(n.signal)}))):ev(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},hasOwnSignal(e){return G(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&A("Duplicate signal name: "+L(e));const n=t instanceof Cp?t:this.add(bc(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||A("Unrecognized signal name: "+L(e)),this.signals[e]},signalRef(e){return this.signals[e]?J(this.signals[e]):(G(this.lambdas,e)||(this.lambdas[e]=this.add(bc(null))),J(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;t0?",":"")+(U(r)?r.signal||Sy(r):L(r))}return n+"]"}function NU(e){let t="{",n=0,i,r;for(i in e)r=e[i],t+=(++n>1?",":"")+L(i)+":"+(U(r)?r.signal||Sy(r):L(r));return t+"}"}function MU(){const e="sans-serif",i="#4c78a8",r="#000",s="#888",o="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:i},area:{fill:i},image:null,line:{stroke:i,strokeWidth:2},path:{stroke:i},rect:{fill:i},rule:{stroke:r},shape:{stroke:i},symbol:{fill:i,size:64},text:{fill:r,font:e,fontSize:11},trail:{fill:i,size:2},style:{"guide-label":{fill:r,font:e,fontSize:10},"guide-title":{fill:r,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:r,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:r,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:o},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:s,grid:!1,gridWidth:1,gridColor:o,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:s,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:o,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:s,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}function LU(e,t,n){return U(e)||A("Input Vega specification must be an object."),t=_o(MU(),t,e.config),RU(e,new ZA(t,n)).toRuntime()}var PU="6.2.0";re(ro,LM,kP,nI,AI,TI,oz,zI,uz,dz,wz,Oz);const IU=PU,zU=Object.freeze(Object.defineProperty({__proto__:null,Bounds:Ue,CanvasHandler:Au,CanvasRenderer:ac,DATE:Rt,DAY:ft,DAYOFYEAR:ei,Dataflow:Ks,Debug:Fw,DisallowedObjectProperties:yg,Error:bg,EventStream:Gc,Gradient:q2,GroupItem:sf,HOURS:Ht,Handler:r0,HybridHandler:Tk,HybridRenderer:op,Info:Cw,Item:rf,MILLISECONDS:An,MINUTES:Vt,MONTH:gt,Marks:Xt,MultiPulse:Ig,None:Aw,Operator:we,Parameters:Wc,Pulse:sr,QUARTER:Dt,RenderType:Zi,Renderer:$u,ResourceLoader:Y2,SECONDS:on,SVGHandler:vk,SVGRenderer:c0,SVGStringRenderer:_k,Scenegraph:dk,TIME_UNITS:Dg,Transform:$,View:yA,WEEK:We,Warn:xg,YEAR:st,accessor:Mt,accessorFields:pt,accessorName:Me,array:q,ascending:No,bandwidthNRD:jg,bin:MS,bootstrapCI:LS,boundClip:qk,boundContext:Eu,boundItem:tp,boundMark:uk,boundStroke:_i,changeset:vs,clampRange:zw,codegenExpression:W$,compare:Sg,constant:xt,cumulativeLogNormal:Xg,cumulativeNormal:Vc,cumulativeUniform:Qg,dayofyear:Yw,debounce:kg,defaultLocale:Tg,definition:_S,densityLogNormal:Vg,densityNormal:qg,densityUniform:Jg,domChild:qe,domClear:Qt,domCreate:Ji,domFind:i0,dotbin:PS,error:A,expressionFunction:ze,extend:re,extent:Zn,extentIndex:Bw,falsy:ji,fastmap:Mo,field:rn,flush:Uw,font:cf,fontFamily:ku,fontSize:oi,format:wl,formatLocale:Xl,formats:Lg,hasOwnProperty:G,id:lu,identity:bt,inferType:ES,inferTypes:wS,ingest:ge,inherits:z,inrange:Gs,interpolate:Nm,interpolateColors:tf,interpolateRange:O2,intersect:zk,intersectBoxLine:Hs,intersectPath:jm,intersectPoint:qm,intersectRule:J2,isArray:F,isBoolean:bs,isDate:rr,isFunction:ie,isIterable:jw,isNumber:de,isObject:U,isRegExp:$g,isString:j,isTuple:jc,key:Ag,lerp:qw,lineHeight:fr,loader:Bc,locale:xS,logger:Lc,lruCache:Ww,markup:l0,merge:Gw,mergeConfig:_o,multiLineOffset:e0,one:Ro,pad:Hw,panLinear:Tw,panLog:Nw,panPow:Mw,panSymlog:Lw,parse:LU,parseExpression:J0,parseSelector:Er,path:mg,pathCurves:zm,pathEqual:Wk,pathParse:uo,pathRectangle:H2,pathRender:Ga,pathSymbols:G2,pathTrail:V2,peek:ue,point:df,projection:w0,quantileLogNormal:Yg,quantileNormal:Xc,quantileUniform:Zg,quantiles:Bg,quantizeInterpolator:D2,quarter:Pw,quartiles:Ug,get random(){return an},randomInteger:BN,randomKDE:Gg,randomLCG:zN,randomLogNormal:zS,randomMixture:BS,randomNormal:Wg,randomUniform:US,read:$S,regressionConstant:em,regressionExp:qS,regressionLinear:tm,regressionLoess:HS,regressionLog:jS,regressionPoly:GS,regressionPow:WS,regressionQuad:nm,renderModule:hf,repeat:ya,resetDefaultLocale:PT,resetSVGDefIds:j3,responseType:kS,runtimeContext:rA,sampleCurve:Kc,sampleLogNormal:Hg,sampleNormal:Hc,sampleUniform:Kg,scale:he,sceneEqual:f0,sceneFromJSON:ck,scenePickVisit:Zl,sceneToJSON:lk,sceneVisit:Cn,sceneZOrder:Wm,scheme:Mm,serializeXML:Fk,setHybridRendererOptions:I3,setRandom:PN,span:cu,splitAccessPath:si,stringValue:L,textMetrics:jt,timeBin:dS,timeFloor:nS,timeFormatLocale:ja,timeInterval:Lo,timeOffset:sS,timeSequence:uS,timeUnitSpecifier:Xw,timeUnits:Rg,toBoolean:Cg,toDate:Fg,toNumber:dt,toSet:$n,toString:Og,transform:TS,transforms:ro,truncate:Vw,truthy:sn,tupleid:Q,typeParsers:Hh,utcFloor:iS,utcInterval:Po,utcOffset:oS,utcSequence:lS,utcdayofyear:Qw,utcquarter:Iw,utcweek:Zw,version:IU,visitArray:Gi,week:Kw,writeConfig:To,zero:Yi,zoomLinear:vg,zoomLog:Eg,zoomPow:Vl,zoomSymlog:wg},Symbol.toStringTag,{value:"Module"}));function BU(e,t,n){let i;t.x2&&(t.x?(n&&e.x>e.x2&&(i=e.x,e.x=e.x2,e.x2=i),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(i=e.y,e.y=e.y2,e.y2=i),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}var UU={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},jU={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},qU={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const WU=Array.prototype.slice,_r=(e,t,n)=>{const i=n?n(t[0]):t[0];return i[e].apply(i,WU.call(t,1))},GU=(e,t=0,n=1,i=0,r=0,s=0,o=0)=>j(e)?new Date(e):new Date(e,t,n,i,r,s,o);var HU={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:GU,date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return _r("join",arguments)},indexof:function(){return _r("indexOf",arguments)},lastindexof:function(){return _r("lastIndexOf",arguments)},slice:function(){return _r("slice",arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(No),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return _r("substring",arguments,String)},split:function(){return _r("split",arguments,String)},replace:function(){return _r("replace",arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const VU=["view","item","group","xy","x","y"],Np=new Set([Function,eval,setTimeout,setInterval]);typeof setImmediate=="function"&&Np.add(setImmediate);const XU={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:n==="datum"?e.datum:n==="event"?e.event:n==="item"?e.item:UU[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,i=e(t.object);n&&(e.memberDepth+=1);const r=e(t.property);if(n&&(e.memberDepth-=1),Np.has(i[r])){console.error(`Prevented interpretation of member "${r}" which could lead to insecure code execution`);return}return i[r]},CallExpression:(e,t)=>{const n=t.arguments;let i=t.callee.name;return i.startsWith("_")&&(i=i.slice(1)),i==="if"?e(n[0])?e(n[1]):e(n[2]):(e.fn[i]||HU[i]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>jU[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>qU[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>t.operator==="&&"?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((n,i)=>{e.memberDepth+=1;const r=e(i.key);e.memberDepth-=1;const s=e(i.value);return yg.has(r)?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):Np.has(s)?console.error(`Prevented interpretation of method "${r}" which could lead to insecure code execution`):n[r]=s,n},{})};function fa(e,t,n,i,r,s){const o=a=>XU[a.type](o,a);return o.memberDepth=0,o.fn=Object.create(t),o.params=n,o.datum=i,o.event=r,o.item=s,VU.forEach(a=>o.fn[a]=(...u)=>r.vega[a](...u)),o(e)}var YU={operator(e,t){const n=t.ast,i=e.functions;return r=>fa(n,i,r)},parameter(e,t){const n=t.ast,i=e.functions;return(r,s)=>fa(n,i,s,r)},event(e,t){const n=t.ast,i=e.functions;return r=>fa(n,i,void 0,void 0,r)},handler(e,t){const n=t.ast,i=e.functions;return(r,s)=>{const o=s.item&&s.item.datum;return fa(n,i,r,o,s)}},encode(e,t){const{marktype:n,channels:i}=t,r=e.functions,s=n==="group"||n==="image"||n==="rect";return(o,a)=>{const u=o.datum;let l=0,c;for(const f in i)c=fa(i[f].ast,r,a,u,void 0,o),o[f]!==c&&(o[f]=c,l=1);return n!=="rule"&&BU(o,i,s),l}}},KU="6.4.2",JU={version:KU};function ky(e){return _(e,"or")}function $y(e){return _(e,"and")}function Ay(e){return _(e,"not")}function jl(e,t){if(Ay(e))jl(e.not,t);else if($y(e))for(const n of e.and)jl(n,t);else if(ky(e))for(const n of e.or)jl(n,t);else t(e)}function Qs(e,t){return Ay(e)?{not:Qs(e.not,t)}:$y(e)?{and:e.and.map(n=>Qs(n,t))}:ky(e)?{or:e.or.map(n=>Qs(n,t))}:t(e)}const te=structuredClone;function eC(e){throw new Error(e)}function po(e,t){const n={};for(const i of t)G(e,i)&&(n[i]=e[i]);return n}function Wt(e,t){const n={...e};for(const i of t)delete n[i];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>xe(e)).join(",")})`};function se(e){if(de(e))return e;const t=j(e)?e:xe(e);if(t.length<250)return t;let n=0;for(let i=0;ia===0?o:`[${o}]`),s=r.map((o,a)=>r.slice(0,a+1).join(""));for(const o of s)t.add(o)}return t}function Oy(e,t){return e===void 0||t===void 0?!0:Fy(Lp(e),Lp(t))}function Se(e){return R(e).length===0}const R=Object.keys,Be=Object.values,gr=Object.entries;function mo(e){return e===!0||e===!1}function xc(e){return j(e)||de(e)||mo(e)}function De(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function Ia(e,t){return Ay(e)?`!(${Ia(e.not,t)})`:$y(e)?`(${e.and.map(n=>Ia(n,t)).join(") && (")})`:ky(e)?`(${e.or.map(n=>Ia(n,t)).join(") || (")})`:t(e)}function vc(e,t){if(t.length===0)return!0;const n=t.shift();return n in e&&vc(e[n],t)&&delete e[n],Se(e)}function Tu(e){return e.charAt(0).toUpperCase()+e.substr(1)}function Dy(e,t="datum"){const n=si(e),i=[];for(let r=1;r<=n.length;r++){const s=`[${n.slice(0,r).map(L).join("][")}]`;i.push(`${t}${s}`)}return i.join(" && ")}function iC(e,t="datum"){return`${t}[${L(si(e).join("."))}]`}function ye(e){return`datum['${e.replaceAll("'","\\'")}']`}function rC(e){return e.replaceAll("\\'","'").replaceAll("\\.",".")}function ej(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function un(e){return`${si(e).map(ej).join("\\.")}`}function os(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function Wo(e){return`${si(e).join(".")}`}function yo(e){return e?si(e).length:0}function Pe(...e){return e.find(t=>t!==void 0)}let sC=42;function oC(e){const t=++sC;return e?String(e)+t:t}function tj(){sC=42}function aC(e){return uC(e)?e:`__${e}`}function uC(e){return e.startsWith("__")}function nu(e){if(e!==void 0)return(e%360+360)%360}function _f(e){return de(e)?!0:!isNaN(e)&&!isNaN(parseFloat(e))}const yv=Object.getPrototypeOf(structuredClone({}));function Bt(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor.name!==t.constructor.name)return!1;let n,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(i=n;i--!==0;)if(!Bt(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const s of e.entries())if(!t.has(s[0]))return!1;for(const s of e.entries())if(!Bt(s[1],t.get(s[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e.entries())if(!t.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(i=n;i--!==0;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==yv.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==yv.toString)return e.toString()===t.toString();const r=Object.keys(e);if(n=r.length,n!==Object.keys(t).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(i=n;i--!==0;){const s=r[i];if(!Bt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function xe(e){const t=[];return(function n(i){if(i?.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i===void 0)return;if(typeof i=="number")return isFinite(i)?`${i}`:"null";if(typeof i!="object")return JSON.stringify(i);let r,s;if(Array.isArray(i)){for(s="[",r=0;rBf(e[t])?De(`_${t}_${gr(e[t])}`):De(`_${t}_${e[t]}`)).join("")}`}function $e(e){return e===!0||Cs(e)&&!e.binned}function et(e){return e==="binned"||Cs(e)&&e.binned===!0}function Cs(e){return U(e)}function Bf(e){return _(e,"param")}function bv(e){switch(e){case Si:case ki:case Li:case _t:case ci:case fi:case Ar:case Pi:case kr:case $r:case Tt:return 6;case Cr:return 4;default:return 10}}function Pu(e){return _(e,"expr")}function tt(e,{level:t}={level:0}){const n=R(e||{}),i={};for(const r of n)i[r]=t===0?It(e[r]):tt(e[r],{level:t-1});return i}function wC(e){const{anchor:t,frame:n,offset:i,orient:r,angle:s,limit:o,color:a,subtitleColor:u,subtitleFont:l,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:p,subtitlePadding:h,...g}=e,m={...g,...a?{fill:a}:{}},y={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{},...s!==void 0?{angle:s}:{},...o!==void 0?{limit:o}:{}},b={...u?{subtitleColor:u}:{},...l?{subtitleFont:l}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...p?{subtitleLineHeight:p}:{},...h?{subtitlePadding:h}:{}},v=po(e,["align","baseline","dx","dy","limit"]);return{titleMarkConfig:m,subtitleMarkConfig:v,nonMarkTitleProperties:y,subtitle:b}}function Xi(e){return j(e)||F(e)&&j(e[0])}function Y(e){return _(e,"signal")}function Fs(e){return _(e,"step")}function SC(e){return F(e)?!1:_(e,"fields")&&!_(e,"data")}function Aj(e){return F(e)?!1:_(e,"fields")&&_(e,"data")}function wi(e){return F(e)?!1:_(e,"field")&&_(e,"data")}const Cj={aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1},Fj=R(Cj),Oj={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},Pp=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"],Dj=" – ";function kC(e){const t=F(e.condition)?e.condition.map(xv):xv(e.condition);return{...It(e),condition:t}}function It(e){if(Pu(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function xv(e){if(Pu(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function Ce(e){if(Pu(e)){const{expr:t,...n}=e;return{signal:t,...n}}return Y(e)?e:e!==void 0?{value:e}:void 0}function Rj(e){return Y(e)?e.signal:L(e)}function vv(e){return Y(e)?e.signal:L(e.value)}function En(e){return Y(e)?e.signal:e==null?null:L(e)}function _j(e,t,n){for(const i of n){const r=ni(i,t.markDef,t.config);r!==void 0&&(e[i]=Ce(r))}return e}function $C(e){return[].concat(e.type,e.style??[])}function me(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:s}=i;return r&&_(t,r)?t[r]:t[e]!==void 0?t[e]:s&&(!r||r===e)?void 0:ni(e,t,n,i)}function ni(e,t,n,{vgChannel:i}={}){const r=Ip(e,t,n.style);return Pe(i?r:void 0,r,i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function Ip(e,t,n){return AC(e,$C(t),n)}function AC(e,t,n){t=q(t);let i;for(const r of t){const s=n[r];_(s,e)&&(i=s[e])}return i}function CC(e,t){return q(e).reduce((n,i)=>(n.field.push(B(i,t)),n.order.push(i.sort??"ascending"),n),{field:[],order:[]})}function FC(e,t){const n=[...e];return t.forEach(i=>{for(const r of n)if(Bt(r,i))return;n.push(i)}),n}function OC(e,t){return Bt(e,t)||!t?e:e?[...q(e),...q(t)].join(", "):t}function DC(e,t){const n=e.value,i=t.value;if(n==null||i===null)return{explicit:e.explicit,value:null};if((Xi(n)||Y(n))&&(Xi(i)||Y(i)))return{explicit:e.explicit,value:OC(n,i)};if(Xi(n)||Y(n))return{explicit:e.explicit,value:n};if(Xi(i)||Y(i))return{explicit:e.explicit,value:i};if(!Xi(n)&&!Y(n)&&!Xi(i)&&!Y(i))return{explicit:e.explicit,value:FC(n,i)};throw new Error("It should never reach here")}function By(e){return`Invalid specification ${xe(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const Tj='Autosize "fit" only works for single views and layered views.';function Ev(e){return`${e=="width"?"Width":"Height"} "container" only works for single views and layered views.`}function wv(e){const t=e=="width"?"Width":"Height",n=e=="width"?"x":"y";return`${t} "container" only works well with autosize "fit" or "fit-${n}".`}function Sv(e){return e?`Dropping "fit-${e}" because spec has discrete ${Nt(e)}.`:'Dropping "fit" because spec has discrete size.'}function Uy(e){return`Unknown field for ${e}. Cannot calculate view size.`}function kv(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function Nj(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function Mj(e){return`The "nearest" transform is not supported for ${e} marks.`}function RC(e){return`Selection not supported for ${e} yet.`}function Lj(e){return`Cannot find a selection named "${e}".`}const Pj="Scale bindings are currently only supported for scales with unbinned, continuous domains.",Ij="Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc",zj="Legend bindings are only supported for selections over an individual field or encoding channel.";function Bj(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}function Uj(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}const jj="The same selection must be used to override scale domains in a layered view.",qj='Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.';function Wj(e){return`Unknown repeated value "${e}".`}function $v(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const Gj="Multiple timer selections in one unit spec are not supported. Ignoring all but the first.",jy="Animation involving facet, layer, or concat is currently unsupported.";function Hj(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${L(e)}.`}function Vj(e,t,n,i){return`${e.length?"Multiple ":"No "}matching ${L(t)} encoding found for selection ${L(n.param)}. Using "field": ${L(i)}.`}const Xj="Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).";function Yj(e){return`Unrecognized parse "${e}".`}function Av(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}const Kj="Attempt to add the same child twice.";function Jj(e){return`Ignoring an invalid transform: ${xe(e)}.`}const Qj='If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.';function Cv(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function Zj(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${xe(t)} is overridden by a child projection ${xe(n)}.`}const eq="Arc marks uses theta channel rather than angle, replacing angle with theta.";function tq(e){return`${e}Offset dropped because ${e} is continuous`}function nq(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${xe(n)}}.`}function _C(e){return`Invalid field type "${e}".`}function iq(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function rq(e){return`Invalid aggregation operator "${e}".`}function TC(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function sq(e){return`Position range does not support relative band size for ${e}.`}function zp(e,t){return`Dropping ${xe(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}const oq="Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.";function Uf(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function aq(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function uq(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function lq(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function cq(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`}function nh(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t==="ordinal"?"order":"magnitude"}.`}function fq(e){return`The ${e} for range marks cannot be an expression`}function dq(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`}function hq(e,t){return`Specified orient "${e}" overridden with "${t}".`}function pq(e){return`Cannot use the scale property "${e}" with non-color channel.`}function gq(e){return`Cannot use the relative band size with ${e} scale.`}function mq(e){return`Using unaggregated domain with raw field has no effect (${xe(e)}).`}function yq(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function bq(e){return`Unaggregated domain is currently unsupported for log scale (${xe(e)}).`}function xq(e){return`Cannot apply size to non-oriented mark "${e}".`}function vq(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function Eq(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function NC(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function MC(e){return`The step for "${e}" is dropped because the ${e==="width"?"x":"y"} is continuous.`}function wq(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${xe(n)} and ${xe(i)}). Using ${xe(n)}.`}function Sq(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${xe(n)} and ${xe(i)}). Using the union of the two domains.`}function kq(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function $q(e){return`Dropping sort property ${xe(e)} as unioned domains only support boolean or op "count", "min", and "max".`}const Fv="Domains that should be unioned has conflicting sort properties. Sort will be set to true.",Aq="Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.",Cq="Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.",Fq="Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.";function Oq(e,t){return`Unioning discrete legend values from ${e} and ${t}.`}function Dq(e){return`Cannot stack "${e}" if there is already "${e}2".`}function Rq(e){return`Stack is applied to a non-linear scale (${e}).`}function _q(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function Ec(e,t){return`Invalid ${e}: ${xe(t)}.`}function Tq(e){return`Dropping day from datetime ${xe(e)} as day cannot be combined with other units.`}function Nq(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}function Mq(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function Lq(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function Ov(e){return`1D error band does not support ${e}.`}function LC(e){return`Channel ${e} is required for "binned" bin.`}function Pq(e){return`Channel ${e} should not be used with "binned" bin.`}function Iq(e){return`Domain for ${e} is required for threshold scale.`}const PC=Lc(xg);let us=PC;function zq(e){return us=e,us}function Bq(){return us=PC,us}function qy(...e){us.error(...e)}function N(...e){us.warn(...e)}function Uq(...e){us.debug(...e)}function Os(e){if(e&&U(e)){for(const t of Gy)if(_(e,t))return!0}return!1}const IC=["january","february","march","april","may","june","july","august","september","october","november","december"],jq=IC.map(e=>e.substr(0,3)),zC=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],qq=zC.map(e=>e.substr(0,3));function Wq(e){if(_f(e)&&(e=+e),de(e))return e>4&&N(Ec("quarter",e)),e-1;throw new Error(Ec("quarter",e))}function Gq(e){if(_f(e)&&(e=+e),de(e))return e-1;{const t=e.toLowerCase(),n=IC.indexOf(t);if(n!==-1)return n;const i=t.substr(0,3),r=jq.indexOf(i);if(r!==-1)return r;throw new Error(Ec("month",e))}}function Hq(e){if(_f(e)&&(e=+e),de(e))return e%7;{const t=e.toLowerCase(),n=zC.indexOf(t);if(n!==-1)return n;const i=t.substr(0,3),r=qq.indexOf(i);if(r!==-1)return r;throw new Error(Ec("day",e))}}function Wy(e,t){const n=[];if(t&&e.day!==void 0&&R(e).length>1&&(N(Tq(e)),e=te(e),delete e.day),e.year!==void 0?n.push(e.year):n.push(2012),e.month!==void 0){const i=t?Gq(e.month):e.month;n.push(i)}else if(e.quarter!==void 0){const i=t?Wq(e.quarter):e.quarter;n.push(de(i)?i*3:`${i}*3`)}else n.push(0);if(e.date!==void 0)n.push(e.date);else if(e.day!==void 0){const i=t?Hq(e.day):e.day;n.push(de(i)?i+1:`${i}+1`)}else n.push(1);for(const i of["hours","minutes","seconds","milliseconds"]){const r=e[i];n.push(typeof r>"u"?0:r)}return n}function ls(e){const n=Wy(e,!0).join(", ");return e.utc?`utc(${n})`:`datetime(${n})`}function Vq(e){const n=Wy(e,!1).join(", ");return e.utc?`utc(${n})`:`datetime(${n})`}function Xq(e){const t=Wy(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}const BC={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Gy=R(BC);function Yq(e){return G(BC,e)}function Ds(e){return U(e)?e.binned:UC(e)}function UC(e){return e?.startsWith("binned")}function Hy(e){return e.startsWith("utc")}function Kq(e){return e.substring(3)}const Jq={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function jf(e){return Gy.filter(t=>qC(e,t))}function jC(e){const t=jf(e);return t[t.length-1]}function qC(e,t){const n=e.indexOf(t);return!(n<0||n>0&&t==="seconds"&&e.charAt(n-1)==="i"||e.length>n+3&&t==="day"&&e.charAt(n+3)==="o"||n>0&&t==="year"&&e.charAt(n-1)==="f")}function Qq(e,t,{end:n}={end:!1}){const i=Dy(t),r=Hy(e)?"utc":"";function s(u){return u==="quarter"?`(${r}quarter(${i})-1)`:`${r}${u}(${i})`}let o;const a={};for(const u of Gy)qC(e,u)&&(a[u]=s(u),o=u);return n&&(a[o]+="+1"),Vq(a)}function WC(e){if(!e)return;const t=jf(e);return`timeUnitSpecifier(${xe(t)}, ${xe(Jq)})`}function Zq(e,t,n){if(!e)return;const i=WC(e);return`${n||Hy(e)?"utc":"time"}Format(${t}, ${i})`}function Qe(e){if(!e)return;let t;return j(e)?UC(e)?t={unit:e.substring(6),binned:!0}:t={unit:e}:U(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),Hy(t.unit)&&(t.utc=!0,t.unit=Kq(t.unit)),t}function eW(e){const{utc:t,...n}=Qe(e);return n.unit?(t?"utc":"")+R(n).map(i=>De(`${i==="unit"?"":`_${i}_`}${n[i]}`)).join(""):`${t?"utc":""}timeunit${R(n).map(i=>De(`_${i}_${n[i]}`)).join("")}`}function GC(e,t=n=>n){const n=Qe(e),i=jC(n.unit);if(i&&i!=="day"){const r={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:s,part:o}=HC(i,n.step),a={...r,[o]:+r[o]+s};return`${t(ls(a))} - ${t(ls(r))}`}}const tW={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function nW(e){return G(tW,e)}function HC(e,t=1){if(nW(e))return{part:e,step:t};switch(e){case"day":case"dayofyear":return{part:"date",step:t};case"quarter":return{part:"month",step:t*3};case"week":return{part:"date",step:t*7}}}function iW(e){return _(e,"param")}function Vy(e){return!!e?.field&&e.equal!==void 0}function Xy(e){return!!e?.field&&e.lt!==void 0}function Yy(e){return!!e?.field&&e.lte!==void 0}function Ky(e){return!!e?.field&&e.gt!==void 0}function Jy(e){return!!e?.field&&e.gte!==void 0}function Qy(e){if(e?.field){if(F(e.range)&&e.range.length===2)return!0;if(Y(e.range))return!0}return!1}function Zy(e){return!!e?.field&&(F(e.oneOf)||F(e.in))}function rW(e){return!!e?.field&&e.valid!==void 0}function VC(e){return Zy(e)||Vy(e)||Qy(e)||Xy(e)||Ky(e)||Yy(e)||Jy(e)}function jn(e,t){return Qf(e,{timeUnit:t,wrapTime:!0})}function sW(e,t){return e.map(n=>jn(n,t))}function XC(e,t=!0){const{field:n}=e,i=Qe(e.timeUnit),{unit:r,binned:s}=i||{},o=B(e,{expr:"datum"}),a=r?`time(${s?o:Qq(r,n)})`:o;if(Vy(e))return`${a}===${jn(e.equal,r)}`;if(Xy(e)){const u=e.lt;return`${a}<${jn(u,r)}`}else if(Ky(e)){const u=e.gt;return`${a}>${jn(u,r)}`}else if(Yy(e)){const u=e.lte;return`${a}<=${jn(u,r)}`}else if(Jy(e)){const u=e.gte;return`${a}>=${jn(u,r)}`}else{if(Zy(e))return`indexof([${sW(e.oneOf,r).join(",")}], ${a}) !== -1`;if(rW(e))return qf(a,e.valid);if(Qy(e)){const{range:u}=tt(e),l=Y(u)?{signal:`${u.signal}[0]`}:u[0],c=Y(u)?{signal:`${u.signal}[1]`}:u[1];if(l!==null&&c!==null&&t)return`inrange(${a}, [${jn(l,r)}, ${jn(c,r)}])`;const f=[];return l!==null&&f.push(`${a} >= ${jn(l,r)}`),c!==null&&f.push(`${a} <= ${jn(c,r)}`),f.length>0?f.join(" && "):"true"}}throw new Error(`Invalid field predicate: ${xe(e)}`)}function qf(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function oW(e){return VC(e)&&e.timeUnit?{...e,timeUnit:Qe(e.timeUnit)}:e}const Iu={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function aW(e){return e==="quantitative"||e==="temporal"}function e1(e){return e==="ordinal"||e==="nominal"}const cs=Iu.quantitative,t1=Iu.ordinal,xo=Iu.temporal,n1=Iu.nominal,Ho=Iu.geojson;function uW(e){if(e)switch(e=e.toLowerCase(),e){case"q":case cs:return"quantitative";case"t":case xo:return"temporal";case"o":case t1:return"ordinal";case"n":case n1:return"nominal";case Ho:return"geojson"}}const nt={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",TIME:"time",UTC:"utc",POINT:"point",BAND:"band"},Bp={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function lW(e,t){const n=Bp[e],i=Bp[t];return n===i||n==="ordinal-position"&&i==="time"||i==="ordinal-position"&&n==="time"}const cW={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function Dv(e){return cW[e]}const YC=new Set(["linear","log","pow","sqrt","symlog"]),KC=new Set([...YC,"time","utc"]);function JC(e){return YC.has(e)}const QC=new Set(["quantile","quantize","threshold"]),fW=new Set([...KC,...QC,"sequential","identity"]),dW=new Set(["ordinal","bin-ordinal","point","band"]);function Le(e){return dW.has(e)}function Fn(e){return fW.has(e)}function Xn(e){return KC.has(e)}function vo(e){return QC.has(e)}const hW={pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5};function pW(e){return!j(e)&&_(e,"name")}function ZC(e){return _(e,"param")}function gW(e){return _(e,"unionWith")}function mW(e){return U(e)&&"field"in e}const yW={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},{type:oZ,domain:aZ,range:uZ,rangeMax:lZ,rangeMin:cZ,scheme:fZ,...bW}=yW,xW=R(bW);function Up(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return Xn(e)||e==="band"||e==="point";case"padding":case"rangeMin":case"rangeMax":return Xn(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return e==="band";case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return Xn(e);case"nice":return Xn(e)||e==="quantize"||e==="threshold";case"exponent":return e==="pow";case"base":return e==="log";case"constant":return e==="symlog";case"zero":return Fn(e)&&!ae(["log","time","utc","threshold","quantile"],e)}}function eF(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return Zs(e)?void 0:pq(t);case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}function vW(e,t){return ae([t1,n1],t)?e===void 0||Le(e):t===xo?ae([nt.TIME,nt.UTC,void 0],e):t===cs?JC(e)||vo(e)||e===void 0:!0}function EW(e,t,n=!1){if(!hi(e))return!1;switch(e){case Re:case Ze:case wr:case Go:case fn:case Ln:return Xn(t)||t==="band"?!0:t==="point"?!n:!1;case Sr:return ae(["linear","band"],t);case Li:case Ar:case Pi:case kr:case $r:case $s:return Xn(t)||vo(t)||ae(["band","point","ordinal"],t);case _t:case ci:case fi:return t!=="band";case Cr:case Tt:return t==="ordinal"||vo(t)}}function wW(e){return U(e)&&"value"in e}const At={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},tF=At.arc,Wf=At.area,Gf=At.bar,SW=At.image,Hf=At.line,Vf=At.point,kW=At.rect,wc=At.rule,nF=At.text,i1=At.tick,$W=At.trail,r1=At.circle,s1=At.square,iF=At.geoshape;function Or(e){return["line","area","trail"].includes(e)}function iu(e){return["rect","bar","image","arc","tick"].includes(e)}const AW=new Set(R(At));function ii(e){return _(e,"type")}const CW=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit"],FW=["fill","fillOpacity"],OW=[...CW,...FW],DW={color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1},Rv=R(DW),ih=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],RW={area:["line","point"],bar:ih,rect:ih,line:["point"],tick:["bandSize","thickness",...ih]},_W={color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},TW={mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1},rF=R(TW);function fs(e){return _(e,"band")}const NW={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},MW=5,o1={binSpacing:0,continuousBandSize:MW,minBandSize:.25,timeUnitBandPosition:.5},LW={...o1,binSpacing:1},PW={...o1,thickness:1};function IW(e){return ii(e)?e.type:e}function sF(e,{isPath:t}){return e===void 0||e==="break-paths-show-path-domains"?t?"break-paths-show-domains":"filter":e===null?"show":e}function a1({markDef:e,config:t,scaleChannel:n,scaleType:i,isCountAggregate:r}){if(!i||!Fn(i)||r)return"always-valid";const s=sF(me("invalid",e,t),{isPath:Or(e.type)});return t.scale?.invalid?.[n]!==void 0?"show":s}function zW(e){return e==="break-paths-filter-domains"||e==="break-paths-show-domains"}function oF({scaleName:e,scale:t,mode:n}){const i=`domain('${e}')`;if(!t||!e)return;const r=`${i}[0]`,s=`peek(${i})`,o=t.domainHasZero();return o==="definitely"?{scale:e,value:0}:o==="maybe"?{signal:`scale('${e}', inrange(0, ${i}) ? 0 : ${n==="zeroOrMin"?r:s})`}:{signal:`scale('${e}', ${n==="zeroOrMin"?r:s})`}}function aF({scaleChannel:e,channelDef:t,scale:n,scaleName:i,markDef:r,config:s}){const o=n?.get("type"),a=Dn(t),u=zf(a?.aggregate),l=a1({scaleChannel:e,markDef:r,config:s,scaleType:o,isCountAggregate:u});if(a&&l==="show"){const c=s.scale.invalid?.[e]??"zero-or-min";return{test:qf(B(a,{expr:"datum"}),!1),...BW(c,n,i)}}}function BW(e,t,n){if(wW(e)){const{value:i}=e;return Y(i)?{signal:i.signal}:{value:i}}return oF({scale:t,scaleName:n,mode:"zeroOrMin"})}function u1(e){const{channel:t,channelDef:n,markDef:i,scale:r,scaleName:s,config:o}=e,a=As(t),u=l1(e),l=aF({scaleChannel:a,channelDef:n,scale:r,scaleName:s,markDef:i,config:o});return l!==void 0?[l,u]:u}function UW(e){const{datum:t}=e;return Os(t)?ls(t):`${xe(t)}`}function Xr(e,t,n,i){const r={};if(t&&(r.scale=t),pi(e)){const{datum:s}=e;Os(s)?r.signal=ls(s):Y(s)?r.signal=s.signal:Pu(s)?r.signal=s.expr:r.value=s}else r.field=B(e,n);if(i){const{offset:s,band:o}=i;s&&(r.offset=s),o&&(r.band=o)}return r}function Sc({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,endSuffix:s="end",bandPosition:o=.5}){const a=!Y(o)&&0{switch(t.fieldTitle){case"plain":return e.field;case"functional":return tG(e);default:return eG(e,t)}};let vF=xF;function EF(e){vF=e}function nG(){EF(xF)}function eo(e,t,{allowDisabling:n,includeDefault:i=!0}){const r=h1(e)?.title;if(!M(e))return r??e.title;const s=e,o=i?p1(s,t):void 0;return n?Pe(r,s.title,o):r??s.title??o}function h1(e){if(wo(e)&&e.axis)return e.axis;if(yF(e)&&e.legend)return e.legend;if(f1(e)&&e.header)return e.header}function p1(e,t){return vF(e,t)}function So(e){if(bF(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}else{const t=h1(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function iG(e,t){switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(d1(e)&&F(e.sort))return"ordinal";const{aggregate:n,bin:i,timeUnit:r}=e;if(r)return"temporal";if(i||n&&!Fr(n)&&!Oi(n))return"quantitative";if(Rs(e)&&e.scale?.type)switch(Bp[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}function Dn(e){if(M(e))return e;if(Kf(e))return e.condition}function Ge(e){if(ne(e))return e;if(ju(e))return e.condition}function wF(e,t,n,i={}){if(xc(e)){const r=j(e)?"string":de(e)?"number":"boolean";return N(nq(t,r,e)),{value:e}}return ne(e)?Ac(e,t,n,i):ju(e)?{...e,condition:Ac(e.condition,t,n,i)}:e}function Ac(e,t,n,i){if(bF(e)){const{format:r,formatType:s,...o}=e;if(ds(s)&&!n.customFormatTypes)return N(Cv(t)),Ac(o,t,n,i)}else{const r=wo(e)?"axis":yF(e)?"legend":f1(e)?"header":null;if(r&&e[r]){const{format:s,formatType:o,...a}=e[r];if(ds(o)&&!n.customFormatTypes)return N(Cv(t)),Ac({...e,[r]:a},t,n,i)}}return M(e)?g1(e,t,i):rG(e)}function rG(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=de(n)?"quantitative":j(n)?"nominal":Os(n)?"temporal":void 0,{...e,type:t}}function g1(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:s,field:o}=e,a={...e};if(!n&&i&&!zy(i)&&!Fr(i)&&!Oi(i)&&(N(rq(i)),delete a.aggregate),r&&(a.timeUnit=Qe(r)),o&&(a.field=`${o}`),$e(s)&&(a.bin=Jf(s,t)),et(s)&&!Ie(t)&&N(Pq(t)),$t(a)){const{type:u}=a,l=uW(u);u!==l&&(a.type=l),u!=="quantitative"&&zf(i)&&(N(iq(u,i)),a.type="quantitative")}else if(!gC(t)){const u=iG(a,t);a.type=u}if($t(a)){const{compatible:u,warning:l}=sG(a,t)||{};u===!1&&N(l)}if(d1(a)&&j(a.sort)){const{sort:u}=a;if(Tv(u))return{...a,sort:{encoding:u}};const l=u.substring(1);if(u.charAt(0)==="-"&&Tv(l))return{...a,sort:{encoding:l,order:"descending"}}}if(f1(a)){const{header:u}=a;if(u){const{orient:l,...c}=u;if(l)return{...a,header:{...c,labelOrient:u.labelOrient||l,titleOrient:u.titleOrient||l}}}}return a}function Jf(e,t){return bs(e)?{maxbins:bv(t)}:e==="binned"?{binned:!0}:!e.maxbins&&!e.step?{...e,maxbins:bv(t)}:e}const Bs={compatible:!0};function sG(e,t){const n=e.type;if(n==="geojson"&&t!=="shape")return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case Si:case ki:case Tf:return $c(e)?Bs:{compatible:!1,warning:uq(t)};case Re:case Ze:case wr:case Go:case _t:case ci:case fi:case Nu:case Mu:case Nf:case as:case Mf:case Lf:case $s:case fn:case Ln:case Pf:return Bs;case In:case ln:case Pn:case zn:return n!==cs?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:Bs;case Pi:case kr:case $r:case Ar:case Li:case Mi:case Ni:case Mn:case li:case Sr:return n==="nominal"&&!e.sort?{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`}:Bs;case Tt:case Cr:return!$c(e)&&!QW(e)?{compatible:!1,warning:lq(t)}:Bs;case bo:return e.type==="nominal"&&!("sort"in e)?{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}:Bs}}function ko(e){const{formatType:t}=So(e);return t==="time"||!t&&oG(e)}function oG(e){return e&&(e.type==="temporal"||M(e)&&!!e.timeUnit)}function Qf(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){const s=t&&Qe(t)?.unit;let o=s||n==="temporal",a;return Pu(e)?a=e.expr:Y(e)?a=e.signal:Os(e)?(o=!0,a=ls(e)):(j(e)||de(e))&&o&&(a=`datetime(${xe(e)})`,Yq(s)&&(de(e)&&e<1e4||j(e)&&isNaN(Date.parse(e)))&&(a=ls({[s]:e}))),a?i&&o?`time(${a})`:a:r?void 0:xe(e)}function SF(e,t){const{type:n}=e;return t.map(i=>{const r=M(e)&&!Ds(e.timeUnit)?e.timeUnit:void 0,s=Qf(i,{timeUnit:r,type:n,undefinedIfExprNotRequired:!0});return s!==void 0?{signal:s}:i})}function qu(e,t){return $e(e.bin)?hi(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const Lv={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function Wu(e){return e?.condition}const kF=["domain","grid","labels","ticks","title"],aG={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},$F={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},uG={...$F,style:1,labelExpr:1,encoding:1};function Pv(e){return G(uG,e)}const lG={axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1},AF=R(lG);function zi(e){return _(e,"mark")}class Zf{name;run;constructor(t,n){this.name=t,this.run=n}hasMatchingType(t){return zi(t)?IW(t.mark)===this.name:!1}}function Yr(e,t){const n=e?.[t];return n?F(n)?go(n,i=>!!i.field):M(n)||Kf(n):!1}function CF(e,t){const n=e?.[t];return n?F(n)?go(n,i=>!!i.field):M(n)||pi(n)||ju(n):!1}function FF(e,t){if(Ie(t)){const n=e[t];if((M(n)||pi(n))&&(e1(n.type)||M(n)&&n.timeUnit)){const i=Ny(t);return CF(e,i)}}return!1}function OF(e){return go(rj,t=>{if(Yr(e,t)){const n=e[t];if(F(n))return go(n,i=>!!i.aggregate);{const i=Dn(n);return i&&!!i.aggregate}}return!1})}function DF(e,t){const n=[],i=[],r=[],s=[],o={};return m1(e,(a,u)=>{if(M(a)){const{field:l,aggregate:c,bin:f,timeUnit:d,...p}=a;if(c||d||f){const g=h1(a)?.title;let m=B(a,{forAs:!0});const y={...g?[]:{title:eo(a,t,{allowDisabling:!0})},...p,field:m};if(c){let b;if(Fr(c)?(b="argmax",m=B({op:"argmax",field:c.argmax},{forAs:!0}),y.field=`${m}.${l}`):Oi(c)?(b="argmin",m=B({op:"argmin",field:c.argmin},{forAs:!0}),y.field=`${m}.${l}`):c!=="boxplot"&&c!=="errorbar"&&c!=="errorband"&&(b=c),b){const v={op:b,as:m};l&&(v.field=l),s.push(v)}}else if(n.push(m),$t(a)&&$e(f)){if(i.push({bin:f,field:l,as:m}),n.push(B(a,{binSuffix:"end"})),qu(a,u)&&n.push(B(a,{binSuffix:"range"})),Ie(u)){const b={field:`${m}_end`};o[`${u}2`]=b}y.bin="binned",gC(u)||(y.type=cs)}else if(d&&!Ds(d)){r.push({timeUnit:d,field:l,as:m});const b=$t(a)&&a.type!==xo&&"time";b&&(u===Nu||u===as?y.formatType=b:gj(u)?y.legend={formatType:b,...y.legend}:Ie(u)&&(y.axis={formatType:b,...y.axis}))}o[u]=y}else n.push(l),o[u]=e[u]}else o[u]=e[u]}),{bins:i,timeUnits:r,aggregate:s,groupby:n,encoding:o}}function cG(e,t,n){const i=yj(t,n);if(i){if(i==="binned"){const r=e[t===Mn?Re:Ze];return!!(M(r)&&M(e[t])&&et(r.bin))}}else return!1;return!0}function fG(e,t,n,i){const r={};for(const s of R(e))pC(s)||N(aq(s));for(let s of cj){if(!e[s])continue;const o=e[s];if(Lu(s)){const a=lj(s),u=r[a];if(M(u)&&aW(u.type)&&M(o)&&!u.timeUnit){N(tq(a));continue}}if(s==="angle"&&t==="arc"&&!e.theta&&(N(eq),s=fn),!cG(e,s,t)){N(Uf(s,t));continue}if(s===Li&&t==="line"&&Dn(e[s])?.aggregate){N(oq);continue}if(s===_t&&(n?"fill"in e:"stroke"in e)){N(TC("encoding",{fill:"fill"in e,stroke:"stroke"in e}));continue}if(s===Mu||s===bo&&!F(o)&&!On(o)||s===as&&F(o)){if(o){if(s===bo){const a=e[s];if(mF(a)){r[s]=a;continue}}r[s]=q(o).reduce((a,u)=>(M(u)?a.push(g1(u,s)):N(zp(u,s)),a),[])}}else{if(s===as&&o===null)r[s]=null;else if(!M(o)&&!pi(o)&&!On(o)&&!Uu(o)&&!Y(o)){N(zp(o,s));continue}r[s]=wF(o,s,i)}}return r}function ed(e,t){const n={};for(const i of R(e)){const r=wF(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function dG(e){const t=[];for(const n of R(e))if(Yr(e,n)){const i=e[n],r=q(i);for(const s of r)M(s)?t.push(s):Kf(s)&&t.push(s.condition)}return t}function m1(e,t,n){if(e)for(const i of R(e)){const r=e[i];if(F(r))for(const s of r)t.call(n,s,i);else t.call(n,r,i)}}function hG(e,t,n,i){return e?R(e).reduce((r,s)=>{const o=e[s];return F(o)?o.reduce((a,u)=>t.call(i,a,u,s),r):t.call(i,r,o,s)},n):n}function RF(e,t){return R(t).reduce((n,i)=>{switch(i){case Re:case Ze:case Mf:case Pf:case Lf:case Mn:case li:case wr:case Go:case fn:case Mi:case Ln:case Ni:case Sr:case Pn:case In:case zn:case ln:case Nu:case Tt:case $s:case as:return n;case bo:if(e==="line"||e==="trail")return n;case Mu:case Nf:{const r=t[i];if(F(r)||M(r))for(const s of q(r))s.aggregate||n.push(B(s,{}));return n}case Li:if(e==="trail")return n;case _t:case ci:case fi:case Pi:case kr:case $r:case Cr:case Ar:{const r=Dn(t[i]);return r&&!r.aggregate&&n.push(B(r,{})),n}}},[])}function pG(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let i,r;if(F(t)){for(const s of t)s.aggregate?(i||(i=[]),i.push(s)):(r||(r=[]),r.push(s));i&&(n.tooltip=i)}else t.aggregate?n.tooltip=t:r=t;return F(r)&&r.length===1&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}function qp(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};const r=e.map(({fieldPrefix:o,titlePrefix:a})=>{const u=i?` of ${y1(t)}`:"";return{field:o+t.field,type:t.type,title:Y(a)?{signal:`${a}"${escape(u)}"`}:a+u}}),s=dG(n).map(KW);return{tooltip:[...r,...zt(s,se)]}}function y1(e){const{title:t,field:n}=e;return Pe(t,n)}function b1(e,t,n,i,r){const{scale:s,axis:o}=n;return({partName:a,mark:u,positionPrefix:l,endPositionPrefix:c=void 0,extraEncoding:f={}})=>{const d=y1(n);return _F(e,a,r,{mark:u,encoding:{[t]:{field:`${l}_${n.field}`,type:n.type,...d!==void 0?{title:d}:{},...s!==void 0?{scale:s}:{},...o!==void 0?{axis:o}:{}},...j(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...i,...f}})}}function _F(e,t,n,i){const{clip:r,color:s,opacity:o}=e,a=e.type;return e[t]||e[t]===void 0&&n[t]?[{...i,mark:{...n[t],...r?{clip:r}:{},...s?{color:s}:{},...o?{opacity:o}:{},...ii(i.mark)?i.mark:{type:i.mark},style:`${a}-${String(t)}`,...bs(e[t])?{}:e[t]}}]:[]}function TF(e,t,n){const{encoding:i}=e,r=t==="vertical"?"y":"x",s=i[r],o=i[`${r}2`],a=i[`${r}Error`],u=i[`${r}Error2`];return{continuousAxisChannelDef:ll(s,n),continuousAxisChannelDef2:ll(o,n),continuousAxisChannelDefError:ll(a,n),continuousAxisChannelDefError2:ll(u,n),continuousAxis:r}}function ll(e,t){if(e?.aggregate){const{aggregate:n,...i}=e;return n!==t&&N(Lq(n,t)),i}else return e}function NF(e,t){const{mark:n,encoding:i}=e,{x:r,y:s}=i;if(ii(n)&&n.orient)return n.orient;if(ir(r)){if(ir(s)){const o=M(r)&&r.aggregate,a=M(s)&&s.aggregate;if(!o&&a===t)return"vertical";if(!a&&o===t)return"horizontal";if(o===t&&a===t)throw new Error("Both x and y cannot have aggregate");return ko(s)&&!ko(r)?"horizontal":"vertical"}return"horizontal"}else{if(ir(s))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}}const Cc="boxplot",gG=["box","median","outliers","rule","ticks"],mG=new Zf(Cc,LF);function MF(e){return de(e)?"tukey":e}function LF(e,{config:t}){e={...e,encoding:ed(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:s,...o}=e,a=ii(n)?n:{type:n};r&&N(RC("boxplot"));const u=a.extent??t.boxplot.extent,l=me("size",a,t),c=a.invalid,f=MF(u),{bins:d,timeUnits:p,transform:h,continuousAxisChannelDef:g,continuousAxis:m,groupby:y,aggregate:b,encodingWithoutContinuousAxis:v,ticksOrient:w,boxOrient:E,customTooltipWithoutAggregatedField:S}=yG(e,u,t),x=Wo(g.field),{color:k,size:D,...P}=v,K=qD=>b1(a,m,g,qD,t.boxplot),ee=K(P),ce=K(v),T=(U(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||"#4c78a8",O=K({...P,...D?{size:D}:{},color:{condition:{test:`${ye(`lower_box_${g.field}`)} >= ${ye(`upper_box_${g.field}`)}`,...k||{value:T}}}}),I=qp([{fieldPrefix:f==="min-max"?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:f==="min-max"?"lower_whisker_":"min_",titlePrefix:"Min"}],g,v),W={type:"tick",color:"black",opacity:1,orient:w,invalid:c,aria:!1},V=f==="min-max"?I:qp([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],g,v),H=[...ee({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:V}),...ee({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:V}),...ee({partName:"ticks",mark:W,positionPrefix:"lower_whisker",extraEncoding:V}),...ee({partName:"ticks",mark:W,positionPrefix:"upper_whisker",extraEncoding:V})],Z=[...f!=="tukey"?H:[],...ce({partName:"box",mark:{type:"bar",...l?{size:l}:{},orient:E,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:I}),...O({partName:"median",mark:{type:"tick",invalid:c,...U(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...l?{size:l}:{},orient:w,aria:!1},positionPrefix:"mid_box",extraEncoding:I})];if(f==="min-max")return{...o,transform:(o.transform??[]).concat(h),layer:Z};const pe=ye(`lower_box_${g.field}`),oe=ye(`upper_box_${g.field}`),ke=`(${oe} - ${pe})`,ut=`${pe} - ${u} * ${ke}`,_e=`${oe} + ${u} * ${ke}`,Bn=ye(g.field),UD={joinaggregate:PF(g.field),groupby:y},sb={transform:[{filter:`(${ut} <= ${Bn}) && (${Bn} <= ${_e})`},{aggregate:[{op:"min",field:g.field,as:`lower_whisker_${x}`},{op:"max",field:g.field,as:`upper_whisker_${x}`},{op:"min",field:`lower_box_${g.field}`,as:`lower_box_${x}`},{op:"max",field:`upper_box_${g.field}`,as:`upper_box_${x}`},...b],groupby:y}],layer:H},{tooltip:mQ,...jD}=P,{scale:ob,axis:ab}=g,ub=y1(g),lb=_F(a,"outliers",t.boxplot,{transform:[{filter:`(${Bn} < ${ut}) || (${Bn} > ${_e})`}],mark:"point",encoding:{[m]:{field:g.field,type:g.type,...ub!==void 0?{title:ub}:{},...ob!==void 0?{scale:ob}:{},...ab!==void 0?{axis:ab}:{}},...jD,...k?{color:k}:{},...S?{tooltip:S}:{}}})[0];let Xu;const cb=[...d,...p,UD];return lb?Xu={transform:cb,layer:[lb,sb]}:(Xu=sb,Xu.transform.unshift(...cb)),{...o,layer:[Xu,{transform:h,layer:Z}]}}function PF(e){const t=Wo(e);return[{op:"q1",field:e,as:`lower_box_${t}`},{op:"q3",field:e,as:`upper_box_${t}`}]}function yG(e,t,n){const i=NF(e,Cc),{continuousAxisChannelDef:r,continuousAxis:s}=TF(e,i,Cc),o=r.field,a=Wo(o),u=MF(t),l=[...PF(o),{op:"median",field:o,as:`mid_box_${a}`},{op:"min",field:o,as:(u==="min-max"?"lower_whisker_":"min_")+a},{op:"max",field:o,as:(u==="min-max"?"upper_whisker_":"max_")+a}],c=u==="min-max"||u==="tukey"?[]:[{calculate:`${ye(`upper_box_${a}`)} - ${ye(`lower_box_${a}`)}`,as:`iqr_${a}`},{calculate:`min(${ye(`upper_box_${a}`)} + ${ye(`iqr_${a}`)} * ${t}, ${ye(`max_${a}`)})`,as:`upper_whisker_${a}`},{calculate:`max(${ye(`lower_box_${a}`)} - ${ye(`iqr_${a}`)} * ${t}, ${ye(`min_${a}`)})`,as:`lower_whisker_${a}`}],{[s]:f,...d}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:h}=pG(d),{bins:g,timeUnits:m,aggregate:y,groupby:b,encoding:v}=DF(h,n),w=i==="vertical"?"horizontal":"vertical",E=i,S=[...g,...m,{aggregate:[...y,...l],groupby:b},...c];return{bins:g,timeUnits:m,transform:S,groupby:b,aggregate:y,continuousAxisChannelDef:r,continuousAxis:s,encodingWithoutContinuousAxis:v,ticksOrient:w,boxOrient:E,customTooltipWithoutAggregatedField:p}}const x1="errorbar",bG=["ticks","rule"],xG=new Zf(x1,IF);function IF(e,{config:t}){e={...e,encoding:ed(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:s,ticksOrient:o,markDef:a,outerSpec:u,tooltipEncoding:l}=zF(e,x1,t);delete s.size;const c=b1(a,r,i,s,t.errorbar),f=a.thickness,d=a.size,p={type:"tick",orient:o,aria:!1,...f!==void 0?{thickness:f}:{},...d!==void 0?{size:d}:{}},h=[...c({partName:"ticks",mark:p,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:p,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...f!==void 0?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return{...u,transform:n,...h.length>1?{layer:h}:{...h[0]}}}function vG(e,t){const{encoding:n}=e;if(EG(n))return{orient:NF(e,t),inputType:"raw"};const i=wG(n),r=SG(n),s=n.x,o=n.y;if(i){if(r)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const a=n.x2,u=n.y2;if(ne(a)&&ne(u))throw new Error(`${t} cannot have both x2 and y2`);if(ne(a)){if(ir(s))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}else if(ne(u)){if(ir(o))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}else{const a=n.xError,u=n.xError2,l=n.yError,c=n.yError2;if(ne(u)&&!ne(a))throw new Error(`${t} cannot have xError2 without xError`);if(ne(c)&&!ne(l))throw new Error(`${t} cannot have yError2 without yError`);if(ne(a)&&ne(l))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(ne(a)){if(ir(s))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}else if(ne(l)){if(ir(o))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function EG(e){return(ne(e.x)||ne(e.y))&&!ne(e.x2)&&!ne(e.y2)&&!ne(e.xError)&&!ne(e.xError2)&&!ne(e.yError)&&!ne(e.yError2)}function wG(e){return ne(e.x2)||ne(e.y2)}function SG(e){return ne(e.xError)||ne(e.xError2)||ne(e.yError)||ne(e.yError2)}function zF(e,t,n){const{mark:i,encoding:r,params:s,projection:o,...a}=e,u=ii(i)?i:{type:i};s&&N(RC(t));const{orient:l,inputType:c}=vG(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:p,continuousAxisChannelDefError2:h,continuousAxis:g}=TF(e,l,t),{errorBarSpecificAggregate:m,postAggregateCalculates:y,tooltipSummary:b,tooltipTitleWithFieldName:v}=kG(u,f,d,p,h,c,t,n),{[g]:w,[g==="x"?"x2":"y2"]:E,[g==="x"?"xError":"yError"]:S,[g==="x"?"xError2":"yError2"]:x,...k}=r,{bins:D,timeUnits:P,aggregate:K,groupby:ee,encoding:ce}=DF(k,n),T=[...K,...m],O=c!=="raw"?[]:ee,I=qp(b,f,ce,v);return{transform:[...a.transform??[],...D,...P,...T.length===0?[]:[{aggregate:T,groupby:O}],...y],groupby:O,continuousAxisChannelDef:f,continuousAxis:g,encodingWithoutContinuousAxis:ce,ticksOrient:l==="vertical"?"horizontal":"vertical",markDef:u,outerSpec:a,tooltipEncoding:I}}function kG(e,t,n,i,r,s,o,a){let u=[],l=[];const c=t.field;let f,d=!1;if(s==="raw"){const p=e.center?e.center:e.extent?e.extent==="iqr"?"median":"mean":a.errorbar.center,h=e.extent?e.extent:p==="mean"?"stderr":"iqr";if(p==="median"!=(h==="iqr")&&N(Mq(p,h,o)),h==="stderr"||h==="stdev")u=[{op:h,field:c,as:`extent_${c}`},{op:p,field:c,as:`center_${c}`}],l=[{calculate:`${ye(`center_${c}`)} + ${ye(`extent_${c}`)}`,as:`upper_${c}`},{calculate:`${ye(`center_${c}`)} - ${ye(`extent_${c}`)}`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:Tu(p)},{fieldPrefix:"upper_",titlePrefix:Iv(p,h,"+")},{fieldPrefix:"lower_",titlePrefix:Iv(p,h,"-")}],d=!0;else{let g,m,y;h==="ci"?(g="mean",m="ci0",y="ci1"):(g="median",m="q1",y="q3"),u=[{op:m,field:c,as:`lower_${c}`},{op:y,field:c,as:`upper_${c}`},{op:g,field:c,as:`center_${c}`}],f=[{fieldPrefix:"upper_",titlePrefix:eo({field:c,aggregate:y,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:eo({field:c,aggregate:m,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:eo({field:c,aggregate:g,type:"quantitative"},a,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&N(Nq(e.center,e.extent)),s==="aggregated-upper-lower"?(f=[],l=[{calculate:ye(n.field),as:`upper_${c}`},{calculate:ye(c),as:`lower_${c}`}]):s==="aggregated-error"&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`${ye(c)} + ${ye(i.field)}`,as:`upper_${c}`}],r?l.push({calculate:`${ye(c)} + ${ye(r.field)}`,as:`lower_${c}`}):l.push({calculate:`${ye(c)} - ${ye(i.field)}`,as:`lower_${c}`}));for(const p of l)f.push({fieldPrefix:p.as.substring(0,6),titlePrefix:os(os(p.calculate,"datum['",""),"']","")})}return{postAggregateCalculates:l,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}function Iv(e,t,n){return`${Tu(e)} ${n} ${t}`}const v1="errorband",$G=["band","borders"],AG=new Zf(v1,BF);function BF(e,{config:t}){e={...e,encoding:ed(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:s,markDef:o,outerSpec:a,tooltipEncoding:u}=zF(e,v1,t),l=o,c=b1(l,r,i,s,t.errorband),f=e.encoding.x!==void 0&&e.encoding.y!==void 0;let d={type:f?"area":"rect"},p={type:f?"line":"rule"};const h={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return f?(d={...d,...h,ariaRoleDescription:"errorband"},p={...p,...h,aria:!1}):l.interpolate?N(Ov("interpolate")):l.tension&&N(Ov("tension")),{...a,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:p,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:p,positionPrefix:"upper",extraEncoding:u})]}}const UF={};function E1(e,t,n){const i=new Zf(e,t);UF[e]={normalizer:i,parts:n}}function CG(){return R(UF)}E1(Cc,LF,gG);E1(x1,IF,bG);E1(v1,BF,$G);const FG=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],jF={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},qF={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},OG=R(jF),DG=R(qF),RG={header:1,headerRow:1,headerColumn:1,headerFacet:1},WF=R(RG),GF=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],_G={gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},TG={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},Rn="_vgsid_",NG={point:{on:"click",fields:[Rn],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function w1(e){return e==="legend"||!!e?.legend}function rh(e){return w1(e)&&U(e)}function S1(e){return!!e?.select}function HF(e){const t=[];for(const n of e||[]){if(S1(n))continue;const{expr:i,bind:r,...s}=n;if(r&&i){const o={...s,bind:r,init:i};t.push(o)}else{const o={...s,...i?{update:i}:{},...r?{bind:r}:{}};t.push(o)}}return t}function MG(e){return td(e)||$1(e)||k1(e)}function k1(e){return _(e,"concat")}function td(e){return _(e,"vconcat")}function $1(e){return _(e,"hconcat")}function VF({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function ri(e){return _(e,"step")}function zv(e){return _(e,"view")||_(e,"width")||_(e,"height")}const Bv=20,LG={align:1,bounds:1,center:1,columns:1,spacing:1},PG=R(LG);function IG(e,t,n){const i=n[t],r={},{spacing:s,columns:o}=i;s!==void 0&&(r.spacing=s),o!==void 0&&(Yf(e)&&!Bu(e.facet)||k1(e))&&(r.columns=o),td(e)&&(r.columns=1);for(const a of PG)if(e[a]!==void 0)if(a==="spacing"){const u=e[a];r[a]=de(u)?u:{row:u.row??s,column:u.column??s}}else r[a]=e[a];return r}function Wp(e,t){return e[t]??e[t==="width"?"continuousWidth":"continuousHeight"]}function Gp(e,t){const n=Fc(e,t);return ri(n)?n.step:XF}function Fc(e,t){const n=e[t]??e[t==="width"?"discreteWidth":"discreteHeight"];return Pe(n,{step:e.step})}const XF=20,zG={continuousWidth:300,continuousHeight:300,step:XF},BG={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:zG,mark:_W,arc:{},area:{},bar:LW,circle:{},geoshape:{},image:{},line:{},point:{},rect:o1,rule:{color:"black"},square:{},text:{color:"black"},tick:PW,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:hW,projection:{},legend:_G,header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:NG,style:{},title:{},facet:{spacing:Bv},concat:{spacing:Bv},normalizedNumberFormat:".0%"},bi=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],Uv={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},jv={blue:bi[0],orange:bi[1],red:bi[2],teal:bi[3],green:bi[4],yellow:bi[5],purple:bi[6],pink:bi[7],brown:bi[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function UG(e={}){return{signals:[{name:"color",value:U(e)?{...jv,...e}:jv}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}function jG(e){return{signals:[{name:"fontSize",value:U(e)?{...Uv,...e}:Uv}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}function qG(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}function YF(e){const t=R(e||{}),n={};for(const i of t){const r=e[i];n[i]=Wu(r)?kC(r):It(r)}return n}function WG(e){const t=R(e),n={};for(const i of t)n[i]=YF(e[i]);return n}const GG=[...rF,...AF,...WF,"background","padding","legend","lineBreak","scale","style","title","view"];function KF(e={}){const{color:t,font:n,fontSize:i,selection:r,...s}=e,o=_o({},te(BG),n?qG(n):{},t?UG(t):{},i?jG(i):{},s||{});r&&To(o,"selection",r,!0);const a=Wt(o,GG);for(const u of["background","lineBreak","padding"])o[u]&&(a[u]=It(o[u]));for(const u of rF)o[u]&&(a[u]=tt(o[u]));for(const u of AF)o[u]&&(a[u]=YF(o[u]));for(const u of WF)o[u]&&(a[u]=tt(o[u]));if(o.legend&&(a.legend=tt(o.legend)),o.scale){const{invalid:u,...l}=o.scale,c=tt(u,{level:1});a.scale={...tt(l),...R(c).length>0?{invalid:c}:{}}}return o.style&&(a.style=WG(o.style)),o.title&&(a.title=tt(o.title)),o.view&&(a.view=tt(o.view)),a}const HG=new Set(["view",...AW]),VG=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],XG={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...RW};function YG(e){e=te(e);for(const t of VG)delete e[t];if(e.axis)for(const t in e.axis)Wu(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of FG)delete e.legend[t];if(e.mark){for(const t of Rv)delete e.mark[t];e.mark.tooltip&&U(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(HF(e.params)),delete e.params);for(const t of HG){for(const i of Rv)delete e[t][i];const n=XG[t];if(n)for(const i of n)delete e[t][i];JG(e,t)}for(const t of CG())delete e[t];KG(e);for(const t in e)U(e[t])&&Se(e[t])&&delete e[t];return Se(e)?void 0:e}function KG(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=wC(e.title);Se(t)||(e.style["group-title"]={...e.style["group-title"],...t}),Se(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n}),Se(i)?delete e.title:e.title=i}function JG(e,t,n,i){const r=e[t];t==="view"&&(n="cell");const s={...r,...e.style[n??t]};Se(s)||(e.style[n??t]=s),delete e[t]}function nd(e){return _(e,"layer")}function QG(e){return _(e,"repeat")}function ZG(e){return!F(e.repeat)&&_(e.repeat,"layer")}class A1{map(t,n){return Yf(t)?this.mapFacet(t,n):QG(t)?this.mapRepeat(t,n):$1(t)?this.mapHConcat(t,n):td(t)?this.mapVConcat(t,n):k1(t)?this.mapConcat(t,n):this.mapLayerOrUnit(t,n)}mapLayerOrUnit(t,n){if(nd(t))return this.mapLayer(t,n);if(zi(t))return this.mapUnit(t,n);throw new Error(By(t))}mapLayer(t,n){return{...t,layer:t.layer.map(i=>this.mapLayerOrUnit(i,n))}}mapHConcat(t,n){return{...t,hconcat:t.hconcat.map(i=>this.map(i,n))}}mapVConcat(t,n){return{...t,vconcat:t.vconcat.map(i=>this.map(i,n))}}mapConcat(t,n){const{concat:i,...r}=t;return{...r,concat:i.map(s=>this.map(s,n))}}mapFacet(t,n){return{...t,spec:this.map(t.spec,n)}}mapRepeat(t,n){return{...t,spec:this.map(t.spec,n)}}}const eH={zero:1,center:1,normalize:1};function tH(e){return G(eH,e)}const nH=new Set([tF,Gf,Wf,wc,Vf,r1,s1,Hf,nF,i1]),iH=new Set([Gf,Wf,tF]);function Us(e){return M(e)&&Eo(e)==="quantitative"&&!e.bin}function qv(e,t,{orient:n,type:i}){const r=t==="x"?"y":"radius",s=t==="x"&&["bar","area"].includes(i),o=e[t],a=e[r];if(M(o)&&M(a))if(Us(o)&&Us(a)){if(o.stack)return t;if(a.stack)return r;const u=M(o)&&!!o.aggregate,l=M(a)&&!!a.aggregate;if(u!==l)return u?t:r;if(s){if(n==="vertical")return r;if(n==="horizontal")return t}}else{if(Us(o))return t;if(Us(a))return r}else{if(Us(o))return s&&n==="vertical"?void 0:t;if(Us(a))return s&&n==="horizontal"?void 0:r}}function rH(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}function JF(e,t){const n=ii(e)?e:{type:e},i=n.type;if(!nH.has(i))return null;const r=qv(t,"x",n)||qv(t,"theta",n);if(!r)return null;const s=t[r],o=M(s)?B(s,{}):void 0,a=rH(r),u=[],l=new Set;if(t[a]){const g=t[a],m=M(g)?B(g,{}):void 0;m&&m!==o&&(u.push(a),l.add(m))}const c=a==="x"?"xOffset":"yOffset",f=t[c],d=M(f)?B(f,{}):void 0;d&&d!==o&&(u.push(c),l.add(d));const p=fj.reduce((g,m)=>{if(m!=="tooltip"&&Yr(t,m)){const y=t[m];for(const b of q(y)){const v=Dn(b);if(v.aggregate)continue;const w=B(v,{});(!w||!l.has(w))&&g.push({channel:m,fieldDef:v})}}return g},[]);let h;return s.stack!==void 0?bs(s.stack)?h=s.stack?"zero":null:h=s.stack:iH.has(i)&&(h="zero"),!h||!tH(h)||OF(t)&&p.length===0?null:(s?.scale?.type&&s?.scale?.type!==nt.LINEAR&&s?.stack&&N(Rq(s.scale.type)),ne(t[di(r)])?(s.stack!==void 0&&N(Dq(r)),null):(M(s)&&s.aggregate&&!kj.has(s.aggregate)&&N(_q(s.aggregate)),{groupbyChannels:u,groupbyFields:l,fieldChannel:r,impute:s.impute===null?!1:Or(i),stackBy:p,offset:h}))}function QF(e,t,n){const i=tt(e),r=me("orient",i,n);if(i.orient=uH(i.type,t,r),r!==void 0&&r!==i.orient&&N(hq(i.orient,r)),i.type==="bar"&&i.orient){const u=me("cornerRadiusEnd",i,n);if(u!==void 0){const l=i.orient==="horizontal"&&t.x2||i.orient==="vertical"&&t.y2?["cornerRadius"]:NW[i.orient];for(const c of l)i[c]=u;i.cornerRadiusEnd!==void 0&&delete i.cornerRadiusEnd}}const s=me("opacity",i,n),o=me("fillOpacity",i,n);return s===void 0&&o===void 0&&(i.opacity=oH(i.type,t)),me("cursor",i,n)===void 0&&(i.cursor=sH(i,t,n)),i}function sH(e,t,n){return t.href||e.href||me("href",e,n)?"pointer":e.cursor}const ZF=.7;function oH(e,t){if(ae([Vf,i1,r1,s1],e)&&!OF(t))return ZF}function aH(e,t,{graticule:n}){if(n)return!1;const i=ni("filled",e,t),r=e.type;return Pe(i,r!==Vf&&r!==Hf&&r!==wc)}function uH(e,t,n){switch(e){case Vf:case r1:case s1:case kW:case SW:return}const{x:i,y:r,x2:s,y2:o}=t;switch(e){case nF:case Gf:if(M(i)&&(et(i.bin)||M(r)&&r.aggregate&&!i.aggregate))return"vertical";if(M(r)&&(et(r.bin)||M(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(o||s){if(n)return n;if(!s)return(M(i)&&i.type===cs&&!$e(i.bin)||kc(i))&&M(r)&&et(r.bin)?"horizontal":"vertical";if(!o)return(M(r)&&r.type===cs&&!$e(r.bin)||kc(r))&&M(i)&&et(i.bin)?"vertical":"horizontal"}case wc:if(s&&!(M(i)&&et(i.bin))&&o&&!(M(r)&&et(r.bin)))return;case Wf:if(o)return M(r)&&et(r.bin)?"horizontal":"vertical";if(s)return M(i)&&et(i.bin)?"vertical":"horizontal";if(e===wc){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case Hf:case i1:{const a=Mv(i),u=Mv(r);if(n)return n;if(a&&!u)return e!=="tick"?"horizontal":"vertical";if(!a&&u)return e!=="tick"?"vertical":"horizontal";if(a&&u)return"vertical";{const l=$t(i)&&i.type===xo,c=$t(r)&&r.type===xo;if(l&&!c)return"vertical";if(!l&&c)return"horizontal"}return}}return"vertical"}function lH(e){const{point:t,line:n,...i}=e;return R(i).length>1?i:i.type}function cH(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:Wt(e[t],["point","line"])});return e}function sh(e,t={},n){return e.point==="transparent"?{opacity:0}:e.point?U(e.point)?e.point:{}:e.point!==void 0?null:t.point||n.shape?U(t.point)?t.point:{}:void 0}function Wv(e,t={}){return e.line?e.line===!0?{}:e.line:e.line!==void 0?null:t.line?t.line===!0?{}:t.line:void 0}class fH{name="path-overlay";hasMatchingType(t,n){if(zi(t)){const{mark:i,encoding:r}=t,s=ii(i)?i:{type:i};switch(s.type){case"line":case"rule":case"trail":return!!sh(s,n[s.type],r);case"area":return!!sh(s,n[s.type],r)||!!Wv(s,n[s.type])}}return!1}run(t,n,i){const{config:r}=n,{params:s,projection:o,mark:a,name:u,encoding:l,...c}=t,f=ed(l,r),d=ii(a)?a:{type:a},p=sh(d,r[d.type],f),h=d.type==="area"&&Wv(d,r[d.type]),g=[{name:u,...s?{params:s}:{},mark:lH({...d.type==="area"&&me("opacity",d,r)==null&&me("fillOpacity",d,r)==null?{opacity:ZF}:{},...d}),encoding:Wt(f,["shape"])}],m=JF(QF(d,f,r),f);let y=f;if(m){const{fieldChannel:b,offset:v}=m;y={...f,[b]:{...f[b],...v?{stack:v}:{}}}}return y=Wt(y,["y2","x2"]),h&&g.push({...o?{projection:o}:{},mark:{type:"line",...po(d,["clip","interpolate","tension","tooltip"]),...h},encoding:y}),p&&g.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...po(d,["clip","tooltip"]),...p},encoding:y}),i({...c,layer:g},{...n,config:cH(r)})}}function dH(e,t){return t?Bu(e)?tO(e,t):eO(e,t):e}function oh(e,t){return t?tO(e,t):e}function Hp(e,t,n){const i=t[e];if(XW(i)){if(i.repeat in n)return{...t,[e]:n[i.repeat]};N(Wj(i.repeat));return}return t}function eO(e,t){if(e=Hp("field",e,t),e!==void 0){if(e===null)return null;if(d1(e)&&$i(e.sort)){const n=Hp("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function Gv(e,t){if(M(e))return eO(e,t);{const n=Hp("datum",e,t);return n!==e&&!n.type&&(n.type="nominal"),n}}function Hv(e,t){if(ne(e)){const n=Gv(e,t);if(n)return n;if(Uu(e))return{condition:e.condition}}else{if(ju(e)){const n=Gv(e.condition,t);if(n)return{...e,condition:n};{const{condition:i,...r}=e;return r}}return e}}function tO(e,t){const n={};for(const i in e)if(_(e,i)){const r=e[i];if(F(r))n[i]=r.map(s=>Hv(s,t)).filter(s=>s);else{const s=Hv(r,t);s!==void 0&&(n[i]=s)}}return n}class hH{name="RuleForRangedLine";hasMatchingType(t){if(zi(t)){const{encoding:n,mark:i}=t;if(i==="line"||ii(i)&&i.type==="line")for(const r of uj){const s=As(r),o=n[s];if(n[r]&&(M(o)&&!et(o.bin)||pi(o)))return!0}}return!1}run(t,n,i){const{encoding:r,mark:s}=t;return N(dq(!!r.x2,!!r.y2)),i({...t,mark:U(s)?{...s,type:"rule"}:"rule"},n)}}class pH extends A1{nonFacetUnitNormalizers=[mG,xG,AG,new fH,new hH];map(t,n){if(zi(t)){const i=Yr(t.encoding,Si),r=Yr(t.encoding,ki),s=Yr(t.encoding,Tf);if(i||r||s)return this.mapFacetedUnit(t,n)}return super.map(t,n)}mapUnit(t,n){const{parentEncoding:i,parentProjection:r}=n,s=oh(t.encoding,n.repeater),o={...t,...t.name?{name:[n.repeaterPrefix,t.name].filter(u=>u).join("_")}:{},...s?{encoding:s}:{}};if(i||r)return this.mapUnitWithParentEncodingOrProjection(o,n);const a=this.mapLayerOrUnit.bind(this);for(const u of this.nonFacetUnitNormalizers)if(u.hasMatchingType(o,n.config))return u.run(o,n,a);return o}mapRepeat(t,n){return ZG(t)?this.mapLayerRepeat(t,n):this.mapNonLayerRepeat(t,n)}mapLayerRepeat(t,n){const{repeat:i,spec:r,...s}=t,{row:o,column:a,layer:u}=i,{repeater:l={},repeaterPrefix:c=""}=n;return o||a?this.mapRepeat({...t,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:u},spec:r}},n):{...s,layer:u.map(f=>{const d={...l,layer:f},p=`${(r.name?`${r.name}_`:"")+c}child__layer_${De(f)}`,h=this.mapLayerOrUnit(r,{...n,repeater:d,repeaterPrefix:p});return h.name=p,h})}}mapNonLayerRepeat(t,n){const{repeat:i,spec:r,data:s,...o}=t;!F(i)&&t.columns&&(t=Wt(t,["columns"]),N($v("repeat")));const a=[],{repeater:u={},repeaterPrefix:l=""}=n,c=!F(i)&&i.row||[u?u.row:null],f=!F(i)&&i.column||[u?u.column:null],d=F(i)&&i||[u?u.repeat:null];for(const h of d)for(const g of c)for(const m of f){const y={repeat:h,row:g,column:m,layer:u.layer},b=`${(r.name?`${r.name}_`:"")+l}child__${F(i)?`${De(h)}`:(i.row?`row_${De(g)}`:"")+(i.column?`column_${De(m)}`:"")}`,v=this.map(r,{...n,repeater:y,repeaterPrefix:b});v.name=b,a.push(Wt(v,["data"]))}const p=F(i)?t.columns:i.column?i.column.length:1;return{data:r.data??s,align:"all",...o,columns:p,concat:a}}mapFacet(t,n){const{facet:i}=t;return Bu(i)&&t.columns&&(t=Wt(t,["columns"]),N($v("facet"))),super.mapFacet(t,n)}mapUnitWithParentEncodingOrProjection(t,n){const{encoding:i,projection:r}=t,{parentEncoding:s,parentProjection:o,config:a}=n,u=Xv({parentProjection:o,projection:r}),l=Vv({parentEncoding:s,encoding:oh(i,n.repeater)});return this.mapUnit({...t,...u?{projection:u}:{},...l?{encoding:l}:{}},{config:a})}mapFacetedUnit(t,n){const{row:i,column:r,facet:s,...o}=t.encoding,{mark:a,width:u,projection:l,height:c,view:f,params:d,encoding:p,...h}=t,{facetMapping:g,layout:m}=this.getFacetMappingAndLayout({row:i,column:r,facet:s},n),y=oh(o,n.repeater);return this.mapFacet({...h,...m,facet:g,spec:{...u?{width:u}:{},...c?{height:c}:{},...f?{view:f}:{},...l?{projection:l}:{},mark:a,encoding:y,...d?{params:d}:{}}},n)}getFacetMappingAndLayout(t,n){const{row:i,column:r,facet:s}=t;if(i||r){s&&N(cq([...i?[Si]:[],...r?[ki]:[]]));const o={},a={};for(const u of[Si,ki]){const l=t[u];if(l){const{align:c,center:f,spacing:d,columns:p,...h}=l;o[u]=h;for(const g of["align","center","spacing"])l[g]!==void 0&&(a[g]??={},a[g][u]=l[g])}}return{facetMapping:o,layout:a}}else{const{align:o,center:a,spacing:u,columns:l,...c}=s;return{facetMapping:dH(c,n.repeater),layout:{...o?{align:o}:{},...a?{center:a}:{},...u?{spacing:u}:{},...l?{columns:l}:{}}}}}mapLayer(t,{parentEncoding:n,parentProjection:i,...r}){const{encoding:s,projection:o,...a}=t,u={...r,parentEncoding:Vv({parentEncoding:n,encoding:s,layer:!0}),parentProjection:Xv({parentProjection:i,projection:o})};return super.mapLayer({...a,...t.name?{name:[u.repeaterPrefix,t.name].filter(l=>l).join("_")}:{}},u)}}function Vv({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...R(e),...R(t)]);for(const s of r){const o=t[s],a=e[s];if(ne(o)){const u={...a,...o};i[s]=u}else ju(o)?i[s]={...o,condition:{...a,...o.condition}}:o||o===null?i[s]=o:(n||On(a)||Y(a)||ne(a)||F(a))&&(i[s]=a)}}else i=t;return!i||Se(i)?void 0:i}function Xv(e){const{parentProjection:t,projection:n}=e;return t&&n&&N(Zj({parentProjection:t,projection:n})),n??t}function C1(e){return _(e,"filter")}function gH(e){return _(e,"stop")}function nO(e){return _(e,"lookup")}function mH(e){return _(e,"data")}function yH(e){return _(e,"param")}function bH(e){return _(e,"pivot")}function xH(e){return _(e,"density")}function vH(e){return _(e,"quantile")}function EH(e){return _(e,"regression")}function wH(e){return _(e,"loess")}function SH(e){return _(e,"sample")}function kH(e){return _(e,"window")}function $H(e){return _(e,"joinaggregate")}function AH(e){return _(e,"flatten")}function CH(e){return _(e,"calculate")}function iO(e){return _(e,"bin")}function FH(e){return _(e,"impute")}function OH(e){return _(e,"timeUnit")}function DH(e){return _(e,"aggregate")}function RH(e){return _(e,"stack")}function _H(e){return _(e,"fold")}function TH(e){return _(e,"extent")&&!_(e,"density")&&!_(e,"regression")}function NH(e){return e.map(t=>C1(t)?{filter:Qs(t.filter,oW)}:t)}class MH extends A1{map(t,n){return n.emptySelections??={},n.selectionPredicates??={},t=Yv(t,n),super.map(t,n)}mapLayerOrUnit(t,n){if(t=Yv(t,n),t.encoding){const i={};for(const[r,s]of gr(t.encoding))i[r]=rO(s,n);t={...t,encoding:i}}return super.mapLayerOrUnit(t,n)}mapUnit(t,n){const{selection:i,...r}=t;return i?{...r,params:gr(i).map(([s,o])=>{const{init:a,bind:u,empty:l,...c}=o;c.type==="single"?(c.type="point",c.toggle=!1):c.type==="multi"&&(c.type="point"),n.emptySelections[s]=l!=="none";for(const f of Be(n.selectionPredicates[s]??{}))f.empty=l!=="none";return{name:s,value:a,select:c,bind:u}})}:t}}function Yv(e,t){const{transform:n,...i}=e;if(n){const r=n.map(s=>{if(C1(s))return{filter:Vp(s,t)};if(iO(s)&&Cs(s.bin))return{...s,bin:sO(s.bin)};if(nO(s)){const{selection:o,...a}=s.from;return o?{...s,from:{param:o,...a}}:s}return s});return{...i,transform:r}}return e}function rO(e,t){const n=te(e);if(M(n)&&Cs(n.bin)&&(n.bin=sO(n.bin)),Rs(n)&&n.scale?.domain?.selection){const{selection:i,...r}=n.scale.domain;n.scale.domain={...r,...i?{param:i}:{}}}if(Uu(n))if(F(n.condition))n.condition=n.condition.map(i=>{const{selection:r,param:s,test:o,...a}=i;return s?i:{...a,test:Vp(i,t)}});else{const{selection:i,param:r,test:s,...o}=rO(n.condition,t);n.condition=r?n.condition:{...o,test:Vp(n.condition,t)}}return n}function sO(e){const t=e.extent;if(t?.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function Vp(e,t){const n=i=>Qs(i,r=>{const s=t.emptySelections[r]??!0,o={param:r,empty:s};return t.selectionPredicates[r]??=[],t.selectionPredicates[r].push(o),o});return e.selection?n(e.selection):Qs(e.test||e.filter,i=>i.selection?n(i.selection):i)}class Xp extends A1{map(t,n){const i=n.selections??[];if(t.params&&!zi(t)){const r=[];for(const s of t.params)S1(s)?i.push(s):r.push(s);t.params=r}return n.selections=i,super.map(t,n)}mapUnit(t,n){const i=n.selections;if(!i||!i.length)return t;const r=(n.path??[]).concat(t.name),s=[];for(const o of i)if(!o.views||!o.views.length)s.push(o);else for(const a of o.views)(j(a)&&(a===t.name||r.includes(a))||F(a)&&a.map(u=>r.indexOf(u)).every((u,l,c)=>u!==-1&&(l===0||u>c[l-1])))&&s.push(o);return s.length&&(t.params=s),t}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=Xp.prototype[e];Xp.prototype[e]=function(n,i){return t.call(this,n,LH(n,i))}}function LH(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function oO(e,t){t===void 0&&(t=KF(e.config));const n=BH(e,t),{width:i,height:r}=e,s=UH(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...s?{autosize:s}:{}}}const PH=new pH,IH=new MH,zH=new Xp;function BH(e,t={}){const n={config:t};return zH.map(PH.map(IH.map(e,n),n),n)}function Kv(e){return j(e)?{type:e}:e??{}}function UH(e,t,n){let{width:i,height:r}=t;const s=zi(e)||nd(e),o={};s?i=="container"&&r=="container"?(o.type="fit",o.contains="padding"):i=="container"?(o.type="fit-x",o.contains="padding"):r=="container"&&(o.type="fit-y",o.contains="padding"):(i=="container"&&(N(Ev("width")),i=void 0),r=="container"&&(N(Ev("height")),r=void 0));const a={type:"pad",...o,...n?Kv(n.autosize):{},...Kv(e.autosize)};if(a.type==="fit"&&!s&&(N(Tj),a.type="pad"),i=="container"&&!(a.type=="fit"||a.type=="fit-x")&&N(wv("width")),r=="container"&&!(a.type=="fit"||a.type=="fit-y")&&N(wv("height")),!Bt(a,{type:"pad"}))return a}function jH(e){return["fit","fit-x","fit-y"].includes(e)}function qH(e){return e?`fit-${If(e)}`:"fit"}const WH=["background","padding"];function Jv(e,t){const n={};for(const i of WH)e&&e[i]!==void 0&&(n[i]=It(e[i]));return t&&(n.params=e.params),n}class Bi{explicit;implicit;constructor(t={},n={}){this.explicit=t,this.implicit=n}clone(){return new Bi(te(this.explicit),te(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(t){return Pe(this.explicit[t],this.implicit[t])}getWithExplicit(t){return this.explicit[t]!==void 0?{explicit:!0,value:this.explicit[t]}:this.implicit[t]!==void 0?{explicit:!1,value:this.implicit[t]}:{explicit:!1,value:void 0}}setWithExplicit(t,{value:n,explicit:i}){n!==void 0&&this.set(t,n,i)}set(t,n,i){return delete this[i?"implicit":"explicit"][t],this[i?"explicit":"implicit"][t]=n,this}copyKeyFromSplit(t,{explicit:n,implicit:i}){n[t]!==void 0?this.set(t,n[t],!0):i[t]!==void 0&&this.set(t,i[t],!1)}copyKeyFromObject(t,n){n[t]!==void 0&&this.set(t,n[t],!0)}copyAll(t){for(const n of R(t.combine())){const i=t.getWithExplicit(n);this.setWithExplicit(n,i)}}}function Gn(e){return{explicit:!0,value:e}}function Pt(e){return{explicit:!1,value:e}}function aO(e){return(t,n,i,r)=>{const s=e(t.value,n.value);return s>0?t:s<0?n:id(t,n,i,r)}}function id(e,t,n,i){return e.explicit&&t.explicit&&N(wq(n,i,e.value,t.value)),e}function br(e,t,n,i,r=id){return e===void 0||e.value===void 0?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:Bt(e.value,t.value)?e:r(e,t,n,i)}class GH extends Bi{explicit;implicit;parseNothing;constructor(t={},n={},i=!1){super(t,n),this.explicit=t,this.implicit=n,this.parseNothing=i}clone(){const t=super.clone();return t.parseNothing=this.parseNothing,t}}function $o(e){return _(e,"url")}function ru(e){return _(e,"values")}function uO(e){return _(e,"name")&&!$o(e)&&!ru(e)&&!ur(e)}function ur(e){return e&&(lO(e)||cO(e)||F1(e))}function lO(e){return _(e,"sequence")}function cO(e){return _(e,"sphere")}function F1(e){return _(e,"graticule")}var Te;(function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup",e[e.PreFilterInvalid=5]="PreFilterInvalid",e[e.PostFilterInvalid=6]="PostFilterInvalid"})(Te||(Te={}));function fO({invalid:e,isPath:t}){switch(sF(e,{isPath:t})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}function HH(e){const{marks:t,scales:n}=fO(e);return t===n?Te.Main:n==="include-invalid-values"?Te.PreFilterInvalid:Te.PostFilterInvalid}class ve{debugName;_children=[];_parent=null;_hash;constructor(t,n){this.debugName=n,t&&(this.parent=t)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(t){this._parent=t,t&&t.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(t,n){if(this._children.includes(t)){N(Kj);return}n!==void 0?this._children.splice(n,0,t):this._children.push(t)}removeChild(t){const n=this._children.indexOf(t);return this._children.splice(n,1),n}remove(){let t=this._parent.removeChild(this);for(const n of this._children)n._parent=this._parent,this._parent.addChild(n,t++)}insertAsParentOf(t){const n=t.parent;n.removeChild(this),this.parent=n,t.parent=this}swapWithParent(){const t=this._parent,n=t.parent;for(const r of this._children)r.parent=t;this._children=[],t.removeChild(this);const i=t.parent.removeChild(t);this._parent=n,n.addChild(this,i),t.parent=this}}class Ot extends ve{type;refCounts;_source;_name;clone(){const t=new this.constructor;return t.debugName=`clone_${this.debugName}`,t._source=this._source,t._name=`clone_${this._name}`,t.type=this.type,t.refCounts=this.refCounts,t.refCounts[t._name]=0,t}constructor(t,n,i,r){super(t,n),this.type=i,this.refCounts=r,this._source=this._name=n,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${oC()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(t){this._source=t}}function ah(e){return e.as!==void 0}function Qv(e){return`${e}_end`}class Kn extends ve{timeUnits;clone(){return new Kn(null,te(this.timeUnits))}constructor(t,n){super(t),this.timeUnits=n}static makeFromEncoding(t,n){const i=n.reduceFieldDef((r,s,o)=>{const{field:a,timeUnit:u}=s;if(u){let l;if(Ds(u)){if(Oe(n)){const{mark:c,markDef:f,config:d}=n,p=yr({fieldDef:s,markDef:f,config:d});(iu(c)||p)&&(l={timeUnit:Qe(u),field:a})}}else l={as:B(s,{forAs:!0}),field:a,timeUnit:u};if(Oe(n)){const{mark:c,markDef:f,config:d}=n,p=yr({fieldDef:s,markDef:f,config:d});iu(c)&&Ie(o)&&p!==.5&&(l.rectBandPosition=p)}l&&(r[se(l)]=l)}return r},{});return Se(i)?null:new Kn(t,i)}static makeFromTransform(t,n){const{timeUnit:i,...r}={...n},s=Qe(i),o={...r,timeUnit:s};return new Kn(t,{[se(o)]:o})}merge(t){this.timeUnits={...this.timeUnits};for(const n in t.timeUnits)this.timeUnits[n]||(this.timeUnits[n]=t.timeUnits[n]);for(const n of t.children)t.removeChild(n),n.parent=this;t.remove()}removeFormulas(t){const n={};for(const[i,r]of gr(this.timeUnits)){const s=ah(r)?r.as:`${r.field}_end`;t.has(s)||(n[i]=r)}this.timeUnits=n}producedFields(){return new Set(Be(this.timeUnits).map(t=>ah(t)?t.as:Qv(t.field)))}dependentFields(){return new Set(Be(this.timeUnits).map(t=>t.field))}hash(){return`TimeUnit ${se(this.timeUnits)}`}assemble(){const t=[];for(const n of Be(this.timeUnits)){const{rectBandPosition:i}=n,r=Qe(n.timeUnit);if(ah(n)){const{field:s,as:o}=n,{unit:a,utc:u,...l}=r,c=[o,`${o}_end`];t.push({field:un(s),type:"timeunit",...a?{units:jf(a)}:{},...u?{timezone:"utc"}:{},...l,as:c}),t.push(...Zv(c,i,r))}else if(n){const{field:s}=n,o=rC(s),a=dO({timeUnit:r,field:o}),u=Qv(o);t.push({type:"formula",expr:a,as:u}),t.push(...Zv([o,u],i,r))}}return t}}const rd="offsetted_rect_start",sd="offsetted_rect_end";function dO({timeUnit:e,field:t,reverse:n}){const{unit:i,utc:r}=e,s=jC(i),{part:o,step:a}=HC(s,e.step);return`${r?"utcOffset":"timeOffset"}('${o}', ${ye(t)}, ${n?-a:a})`}function Zv([e,t],n,i){if(n!==void 0&&n!==.5){const r=ye(e),s=ye(t);return[{type:"formula",expr:eE([dO({timeUnit:i,field:e,reverse:!0}),r],n+.5),as:`${e}_${rd}`},{type:"formula",expr:eE([r,s],n+.5),as:`${e}_${sd}`}]}return[]}function eE([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const Gu="_tuple_fields";class VH{hasChannel;hasField;hasSelectionId;timeUnit;items;constructor(...t){this.items=t,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const XH={defined:()=>!0,parse:(e,t,n)=>{const i=t.name,r=t.project??=new VH,s={},o={},a=new Set,u=(h,g)=>{const m=g==="visual"?h.channel:h.field;let y=De(`${i}_${m}`);for(let b=1;a.has(y);b++)y=De(`${i}_${m}_${b}`);return a.add(y),{[g]:y}},l=t.type,c=e.config.selection[l],f=n.value!==void 0?q(n.value):null;let{fields:d,encodings:p}=U(n.select)?n.select:{};if(!d&&!p&&f){for(const h of f)if(U(h))for(const g of R(h))aj(g)?(p||(p=[])).push(g):l==="interval"?(N(qj),p=c.encodings):(d??=[]).push(g)}!d&&!p&&(p=c.encodings,"fields"in c&&(d=c.fields));for(const h of p??[]){const g=e.fieldDef(h);if(g){let m=g.field;if(g.aggregate){N(Nj(h,g.aggregate));continue}else if(!m){N(kv(h));continue}if(g.timeUnit&&!Ds(g.timeUnit)){m=e.vgField(h);const y={timeUnit:g.timeUnit,as:m,field:g.field};o[se(y)]=y}if(!s[m]){const y=l==="interval"&&hi(h)&&Fn(e.getScaleComponent(h).get("type"))?"R":g.bin?"R-RE":"E",b={field:m,channel:h,type:y,index:r.items.length};b.signals={...u(b,"data"),...u(b,"visual")},r.items.push(s[m]=b),r.hasField[m]=s[m],r.hasSelectionId=r.hasSelectionId||m===Rn,dC(h)?(b.geoChannel=h,b.channel=fC(h),r.hasChannel[b.channel]=s[m]):r.hasChannel[h]=s[m]}}else N(kv(h))}for(const h of d??[]){if(r.hasField[h])continue;const g={type:"E",field:h,index:r.items.length};g.signals={...u(g,"data")},r.items.push(g),r.hasField[h]=g,r.hasSelectionId=r.hasSelectionId||h===Rn}f&&(t.init=f.map(h=>r.items.map(g=>U(h)?h[g.geoChannel||g.channel]!==void 0?h[g.geoChannel||g.channel]:h[g.field]:h))),Se(o)||(r.timeUnit=new Kn(null,o))},signals:(e,t,n)=>{const i=t.name+Gu;return n.filter(s=>s.name===i).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(mO)})}},hO="_curr",ql="anim_value",Ws="anim_clock",Yp="eased_anim_clock",pO="min_extent",gO="max_range_extent",uh="last_tick_at",lh="is_playing",YH=1/60*1e3,KH=(e,t)=>[{name:Yp,update:Ws},{name:`${e}_domain`,init:`domain('${t}')`},{name:pO,init:`extent(${e}_domain)[0]`},{name:gO,init:`extent(range('${t}'))[1]`},{name:ql,update:`invert('${t}', ${Yp})`}],JH={defined:e=>e.type==="point",topLevelSignals:(e,t,n)=>(Jn(t)&&(n=n.concat([{name:Ws,init:"0",on:[{events:{type:"timer",throttle:YH},update:`${lh} ? (${Ws} + (now() - ${uh}) > ${gO} ? 0 : ${Ws} + (now() - ${uh})) : ${Ws}`}]},{name:uh,init:"now()",on:[{events:[{signal:Ws},{signal:lh}],update:"now()"}]},{name:lh,init:"true"}])),n),signals:(e,t,n)=>{const i=t.name,r=i+Gu,s=t.project,o="(item().isVoronoi ? datum.datum : datum)",a=Be(e.component.selection??{}).reduce((c,f)=>f.type==="interval"?c.concat(f.name+to):c,[]).map(c=>`indexof(item().mark.name, '${c}') < 0`).join(" && "),u=`datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${a?` && ${a}`:""}`;let l=`unit: ${Kr(e)}, `;if(t.project.hasSelectionId)l+=`${Rn}: ${o}[${L(Rn)}]`;else if(Jn(t))l+=`fields: ${r}, values: [${ql} ? ${ql} : ${pO}]`;else{const c=s.items.map(f=>e.fieldDef(f.channel)?.bin?`[${o}[${L(e.vgField(f.channel,{}))}], ${o}[${L(e.vgField(f.channel,{binSuffix:"end"}))}]]`:`${o}[${L(f.field)}]`).join(", ");l+=`fields: ${r}, values: [${c}]`}if(Jn(t))return n.concat(KH(t.name,e.scaleName(Sr)),[{name:i+Ri,on:[{events:[{signal:Yp},{signal:ql}],update:`{${l}}`,force:!0}]}]);{const c=t.events;return n.concat([{name:i+Ri,on:c?[{events:c,update:`${u} ? {${l}} : null`,force:!0}]:[]}])}}};function mO(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=un(r.field),r}function hs(e,t=!0,n=bt){if(F(e)){const i=e.map(r=>hs(r,t,n));return t?`[${i.join(", ")}]`:i}else if(Os(e))return n(t?ls(e):Xq(e));return t?n(xe(e)):e}function QH(e,t){for(const n of Be(e.component.selection??{})){const i=n.name;let r=`${i}${Ri}, ${n.resolve==="global"?"true":`{unit: ${Kr(e)}}`}`;for(const s of od)s.defined(n)&&(s.signals&&(t=s.signals(e,n,t)),s.modifyExpr&&(r=s.modifyExpr(e,n,r)));t.push({name:i+$V,on:[{events:{signal:n.name+Ri},update:`modify(${L(n.name+ps)}, ${r})`}]})}return O1(t)}function ZH(e,t){if(e.component.selection&&R(e.component.selection).length){const n=L(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:Er("pointermove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return O1(t)}function eV(e,t){let n=!1;for(const i of Be(e.component.selection??{})){const r=i.name,s=L(r+ps);if(t.filter(a=>a.name===r).length===0){const a=i.resolve==="global"?"union":i.resolve,u=i.type==="point"?", true, true)":")";t.push({name:i.name,update:`${NO}(${s}, ${L(a)}${u}`})}n=!0;for(const a of od)a.defined(i)&&a.topLevelSignals&&(t=a.topLevelSignals(e,i,t))}return n&&t.filter(r=>r.name==="unit").length===0&&t.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),O1(t)}function tV(e,t){const n=[],i=[],r=Kr(e,{escape:!1});for(const s of Be(e.component.selection??{})){const o={name:s.name+ps};if(s.project.hasSelectionId&&(o.transform=[{type:"collect",sort:{field:Rn}}]),s.init){const u=s.project.items.map(mO);o.values=s.project.hasSelectionId?s.init.map(l=>({unit:r,[Rn]:hs(l,!1)[0]})):s.init.map(l=>({unit:r,fields:u,values:hs(l,!1)}))}if([...n,...t].filter(u=>u.name===s.name+ps).length||n.push(o),Jn(s)&&t.length){const u=e.lookupDataSource(e.getDataName(Te.Main)),l=t.find(f=>f.name===u),c=l.transform.find(f=>f.type==="filter"&&f.expr.includes("vlSelectionTest"));if(c){l.transform=l.transform.filter(d=>d!==c);const f={name:l.name+hO,source:l.name,transform:[c]};i.push(f)}}}return n.concat(t,i)}function yO(e,t){for(const n of Be(e.component.selection??{}))for(const i of od)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function nV(e,t){for(const n of e.children)Oe(n)&&(t=yO(n,t));return t}function iV(e,t,n,i){const r=zO(e,t.param,t);return{signal:Fn(n.get("type"))&&F(i)&&i[0]>i[1]?`isValid(${r}) && reverse(${r})`:r}}function O1(e){return e.map(t=>(t.on&&!t.on.length&&delete t.on,t))}const Ai={defined:e=>e.type==="interval"&&e.resolve==="global"&&e.bind&&e.bind==="scales",parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!hi(r))continue;const s=e.getScaleComponent(r),o=s?s.get("type"):void 0;if(o=="sequential"&&N(Ij),!s||!Fn(o)){N(Pj);continue}s.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter(o=>n.filter(a=>a.name===o.signals.data).length===0);if(!e.parent||Jp(e)||i.length===0)return n;const r=n.find(o=>o.name===t.name);let s=r.update;if(s.includes(NO))r.update=`{${i.map(o=>`${L(un(o.field))}: ${o.signals.data}`).join(", ")}}`;else{for(const o of i){const a=`${L(un(o.field))}: ${o.signals.data}`;s.includes(a)||(s=`${s.substring(0,s.length-1)}, ${a}}`)}r.update=s}return n.concat(i.map(o=>({name:o.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!Jp(e))for(const i of t.scales){const r=n.find(s=>s.name===i.signals.data);r.push="outer",delete r.value,delete r.update}return n}};function Kp(e,t){return`domain(${L(e.scaleName(t))})`}function Jp(e){return e.parent&&Jo(e.parent)&&(!e.parent.parent||Jp(e.parent.parent))}const to="_brush",bO="_scale_trigger",da="geo_interval_init_tick",xO="_init",rV="_center",sV={defined:e=>e.type==="interval",parse:(e,t,n)=>{if(e.hasProjection){const i={...U(n.select)?n.select:{}};i.fields=[Rn],i.encodings||(i.encodings=n.value?R(n.value):[In,Pn]),n.select={type:"interval",...i}}if(t.translate&&!Ai.defined(t)){const i=`!event.item || event.item.mark.name !== ${L(t.name+to)}`;for(const r of t.events){if(!r.between){N(`${r} is not an ordered event stream for interval selections.`);continue}const s=q(r.between[0].filter??=[]);s.includes(i)||s.push(i)}}},signals:(e,t,n)=>{const i=t.name,r=i+Ri,s=Be(t.project.hasChannel).filter(a=>a.channel===Re||a.channel===Ze),o=t.init?t.init[0]:null;if(n.push(...s.reduce((a,u)=>a.concat(oV(e,t,u,o?.[u.index])),[])),e.hasProjection){const a=L(e.projectionName()),u=e.projectionName()+rV,{x:l,y:c}=t.project.hasChannel,f=l?.signals.visual,d=c?.signals.visual,p=l?o?.[l.index]:`${u}[0]`,h=c?o?.[c.index]:`${u}[1]`,g=E=>e.getSizeSignalRef(E).signal,m=`[[${f?`${f}[0]`:"0"}, ${d?`${d}[0]`:"0"}],[${f?`${f}[1]`:g("width")}, ${d?`${d}[1]`:g("height")}]]`;o&&(n.unshift({name:i+xO,init:`[scale(${a}, [${l?p[0]:p}, ${c?h[0]:h}]), scale(${a}, [${l?p[1]:p}, ${c?h[1]:h}])]`}),(!l||!c)&&(n.find(S=>S.name===u)||n.unshift({name:u,update:`invert(${a}, [${g("width")}/2, ${g("height")}/2])`})));const y=`intersect(${m}, {markname: ${L(e.getName("marks"))}}, unit.mark)`,b=`{unit: ${Kr(e)}}`,v=`vlSelectionTuples(${y}, ${b})`,w=s.map(E=>E.signals.visual);return n.concat({name:r,on:[{events:[...w.length?[{signal:w.join(" || ")}]:[],...o?[{signal:da}]:[]],update:v}]})}else{if(!Ai.defined(t)){const l=i+bO,c=s.map(f=>{const d=f.channel,{data:p,visual:h}=f.signals,g=L(e.scaleName(d)),m=e.getScaleComponent(d).get("type"),y=Fn(m)?"+":"";return`(!isArray(${p}) || (${y}invert(${g}, ${h})[0] === ${y}${p}[0] && ${y}invert(${g}, ${h})[1] === ${y}${p}[1]))`});c.length&&n.push({name:l,value:{},on:[{events:s.map(f=>({scale:e.scaleName(f.channel)})),update:`${c.join(" && ")} ? ${l} : {}`}]})}const a=s.map(l=>l.signals.data),u=`unit: ${Kr(e)}, fields: ${i+Gu}, values`;return n.concat({name:r,...o?{init:`{${u}: ${hs(o)}}`}:{},...a.length?{on:[{events:[{signal:a.join(" || ")}],update:`${a.join(" && ")} ? {${u}: [${a}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>(Oe(e)&&e.hasProjection&&t.init&&(n.filter(r=>r.name===da).length||n.unshift({name:da,value:null,on:[{events:"timer{1}",update:`${da} === null ? {} : ${da}`}]})),n),marks:(e,t,n)=>{const i=t.name,{x:r,y:s}=t.project.hasChannel,o=r?.signals.visual,a=s?.signals.visual,u=`data(${L(t.name+ps)})`;if(Ai.defined(t)||!r&&!s)return n;const l={x:r!==void 0?{signal:`${o}[0]`}:{value:0},y:s!==void 0?{signal:`${a}[0]`}:{value:0},x2:r!==void 0?{signal:`${o}[1]`}:{field:{group:"width"}},y2:s!==void 0?{signal:`${a}[1]`}:{field:{group:"height"}}};if(t.resolve==="global")for(const m of R(l))l[m]=[{test:`${u}.length && ${u}[0].unit === ${Kr(e)}`,...l[m]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...p}=t.mark,h=R(p).reduce((m,y)=>(m[y]=[{test:[r!==void 0&&`${o}[0] !== ${o}[1]`,s!==void 0&&`${a}[0] !== ${a}[1]`].filter(b=>b).join(" && "),value:p[y]},{value:null}],m),{}),g=d??(t.translate?"move":null);return[{name:`${i+to}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:l}},...n,{name:i+to,type:"rect",clip:!0,encode:{enter:{...g?{cursor:{value:g}}:{},fill:{value:"transparent"}},update:{...l,...h}}}]}};function oV(e,t,n,i){const r=!e.hasProjection,s=n.channel,o=n.signals.visual,a=L(r?e.scaleName(s):e.projectionName()),u=d=>`scale(${a}, ${d})`,l=e.getSizeSignalRef(s===Re?"width":"height").signal,c=`${s}(unit)`,f=t.events.reduce((d,p)=>[...d,{events:p.between[0],update:`[${c}, ${c}]`},{events:p,update:`[${o}[0], clamp(${c}, 0, ${l})]`}],[]);if(r){const d=n.signals.data,p=Ai.defined(t),h=e.getScaleComponent(s),g=h?h.get("type"):void 0,m=i?{init:hs(i,!0,u)}:{value:[]};return f.push({events:{signal:t.name+bO},update:Fn(g)?`[${u(`${d}[0]`)}, ${u(`${d}[1]`)}]`:"[0, 0]"}),p?[{name:d,on:[]}]:[{name:o,...m,on:f},{name:d,...i?{init:hs(i)}:{},on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${a}, ${o})`}]}]}else{const d=s===Re?0:1,p=t.name+xO,h=i?{init:`[${p}[0][${d}], ${p}[1][${d}]]`}:{value:[]};return[{name:o,...h,on:f}]}}function Vo({model:e,channelDef:t,vgChannel:n,invalidValueRef:i,mainRefFn:r}){const s=Uu(t)&&t.condition;let o=[];s&&(o=q(s).map(l=>{const c=r(l);if(VW(l)){const{param:f,empty:d}=l;return{test:IO(e,{param:f,empty:d}),...c}}else return{test:Rc(e,l.test),...c}})),i!==void 0&&o.push(i);const a=r(t);return a!==void 0&&o.push(a),o.length>1||o.length===1&&o[0].test?{[n]:o}:o.length===1?{[n]:o[0]}:{}}function D1(e,t="text"){const n=e.encoding[t];return Vo({model:e,channelDef:n,vgChannel:t,mainRefFn:i=>R1(i,e.config),invalidValueRef:void 0})}function R1(e,t,n="datum"){if(e){if(On(e))return Ce(e.value);if(ne(e)){const{format:i,formatType:r}=So(e);return c1({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function vO(e,t={}){const{encoding:n,markDef:i,config:r,stack:s}=e,o=n.tooltip;if(F(o))return{tooltip:tE({tooltip:o},s,r,t)};{const a=t.reactiveGeom?"datum.datum":"datum";return Vo({model:e,channelDef:o,vgChannel:"tooltip",mainRefFn:l=>{const c=wO(l,r,a);if(c)return c;if(l===null)return;let f=me("tooltip",i,r);if(f===!0&&(f={content:"encoding"}),j(f))return{value:f};if(U(f))return Y(f)?f:f.content==="encoding"?tE(n,s,r,t):{signal:a}},invalidValueRef:void 0})}}function EO(e,t,n,{reactiveGeom:i}={}){const r={...n,...n.tooltipFormat},s=new Set,o=i?"datum.datum":"datum",a=[];function u(c,f){const d=As(f),p=$t(c)?c:{...c,type:e[d].type},h=p.title||p1(p,r),g=q(h).join(", ").replaceAll(/"/g,'\\"');let m;if(Ie(f)){const y=f==="x"?"x2":"y2",b=Dn(e[y]);if(et(p.bin)&&b){const v=B(p,{expr:o}),w=B(b,{expr:o}),{format:E,formatType:S}=So(p);m=zu(v,w,E,S,r),s.add(y)}}if((Ie(f)||f===fn||f===Ln)&&t&&t.fieldChannel===f&&t.offset==="normalize"){const{format:y,formatType:b}=So(p);m=c1({fieldOrDatumDef:p,format:y,formatType:b,expr:o,config:r,normalizeStack:!0}).signal}m??=wO(p,r,o).signal,a.push({channel:f,key:g,value:m})}m1(e,(c,f)=>{M(c)?u(c,f):Kf(c)&&u(c.condition,f)});const l={};for(const{channel:c,key:f,value:d}of a)!s.has(c)&&!l[f]&&(l[f]=d);return l}function tE(e,t,n,{reactiveGeom:i}={}){const r=EO(e,t,n,{reactiveGeom:i}),s=gr(r).map(([o,a])=>`"${o}": ${a}`);return s.length>0?{signal:`{${s.join(", ")}}`}:void 0}function wO(e,t,n="datum"){if(M(e)&&e1(e.type)&&!So(e).format&&!So(e).formatType){const i=`${n}["${e.field}"]`;return{signal:`isValid(${i}) ? isArray(${i}) ? join(${i}, '\\n') : ${i} : ""+${i}`}}return R1(e,t,n)}function aV(e){const{markDef:t,config:n}=e,i=me("aria",t,n);return i===!1?{}:{...i?{aria:i}:{},...uV(e),...lV(e)}}function uV(e){const{mark:t,markDef:n,config:i}=e;if(i.aria===!1)return{};const r=me("ariaRoleDescription",n,i);return r!=null?{ariaRoleDescription:{value:r}}:G(Oj,t)?{}:{ariaRoleDescription:{value:t}}}function lV(e){const{encoding:t,markDef:n,config:i,stack:r}=e,s=t.description;if(s)return Vo({model:e,channelDef:s,vgChannel:"description",mainRefFn:u=>R1(u,e.config),invalidValueRef:void 0});const o=me("description",n,i);if(o!=null)return{description:Ce(o)};if(i.aria===!1)return{};const a=EO(t,r,i);if(!Se(a))return{description:{signal:gr(a).filter(([u])=>!u.startsWith("_")).map(([u,l])=>[u,l.replaceAll("\\n"," ")]).map(([u,l],c)=>`"${c>0?"; ":""}${u}: " + (${l})`).join(" + ")}}}function it(e,t,n={}){const{markDef:i,encoding:r,config:s}=t,{vgChannel:o}=n;let{defaultRef:a,defaultValue:u}=n;const l=r[e];a===void 0&&(u??=me(e,i,s,{vgChannel:o,ignoreVgConfig:!Uu(l)}),u!==void 0&&(a=Ce(u)));const c={markDef:i,config:s,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},f=aF({...c,scaleChannel:e,channelDef:l});return Vo({model:t,channelDef:l,vgChannel:o??e,invalidValueRef:f,mainRefFn:p=>l1({...c,channel:e,channelDef:p,stack:null,defaultRef:a})})}function SO(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:s}=n,o=t.filled??me("filled",n,r),a=ae(["bar","point","circle","square","geoshape"],s)?"transparent":void 0,u=me(o===!0?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[o===!0&&"color"]??a,l=me(o===!1?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[o===!1&&"color"],c=o?"fill":"stroke",f={...u?{fill:Ce(u)}:{},...l?{stroke:Ce(l)}:{}};return n.color&&(o?n.fill:n.stroke)&&N(TC("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...it("color",e,{vgChannel:c,defaultValue:o?u:l}),...it("fill",e,{defaultValue:i.fill?u:void 0}),...it("stroke",e,{defaultValue:i.stroke?l:void 0})}}function cV(e){const{encoding:t,mark:n}=e,i=t.order;return!Or(n)&&On(i)?Vo({model:e,channelDef:i,vgChannel:"zindex",mainRefFn:r=>Ce(r.value),invalidValueRef:void 0}):{}}function Ao({channel:e,markDef:t,encoding:n={},model:i,bandPosition:r}){const s=`${e}Offset`,o=t[s],a=n[s];if((s==="xOffset"||s==="yOffset")&&a)return{offsetType:"encoding",offset:l1({channel:s,channelDef:a,markDef:t,config:i?.config,scaleName:i.scaleName(s),scale:i.getScaleComponent(s),stack:null,defaultRef:Ce(o),bandPosition:r})};const u=t[s];return u?{offsetType:"visual",offset:u}:{}}function St(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:s,config:o,stack:a}=t,u=r[e],l=r[di(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:p}=Ao({channel:e,markDef:s,encoding:r,model:t,bandPosition:.5}),h=_1({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),g=!u&&Ie(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:fV({channel:e,channelDef:u,channel2Def:l,markDef:s,config:o,scaleName:c,scale:f,stack:a,offset:d,defaultRef:h,bandPosition:p==="encoding"?0:void 0});return g?{[i||e]:g}:void 0}function fV(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:s,markDef:o}=e;if(ne(n)&&r&&t===r.fieldChannel){if(M(n)){let a=n.bandPosition;if(a===void 0&&o.type==="text"&&(t==="radius"||t==="theta")&&(a=.5),a!==void 0)return Sc({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:a,offset:s})}return Xr(n,i,{suffix:"end"},{offset:s})}return u1(e)}function _1({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:s,config:o}=e;return()=>{const a=As(n),u=mr(n),l=me(n,s,o,{vgChannel:u});if(l!==void 0)return za(n,l);switch(t){case"zeroOrMin":return nE({scaleName:i,scale:r,mode:"zeroOrMin",mainChannel:a,config:o});case"zeroOrMax":return nE({scaleName:i,scale:r,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:a,config:o});case"mid":return{...e[Nt(n)],mult:.5}}}}function nE({mainChannel:e,config:t,...n}){const i=oF(n),{mode:r}=n;if(i)return i;switch(e){case"radius":{if(r==="zeroOrMin")return{value:0};const{widthSignal:s,heightSignal:o}=r.zeroOrMax;return{signal:`min(${s},${o})/2`}}case"theta":return r==="zeroOrMin"?{value:0}:{signal:"2*PI"};case"x":return r==="zeroOrMin"?{value:0}:{field:{group:"width"}};case"y":return r==="zeroOrMin"?{field:{group:"height"}}:{value:0}}}const dV={left:"x",center:"xc",right:"x2"},hV={top:"y",middle:"yc",bottom:"y2"};function kO(e,t,n,i="middle"){if(e==="radius"||e==="theta")return mr(e);const r=e==="x"?"align":"baseline",s=me(r,t,n);let o;return Y(s)?(N(fq(r)),o=void 0):o=s,e==="x"?dV[o||(i==="top"?"left":"center")]:hV[o||i]}function Oc(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?$O(e,t,{defaultPos:n,defaultPos2:i}):St(e,t,{defaultPos:n})}function $O(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:s}=t,o=di(e),a=Nt(e),u=pV(t,i,o),l=u[a]?kO(e,r,s):mr(e);return{...St(e,t,{defaultPos:n,vgChannel:l}),...u}}function pV(e,t,n){const{encoding:i,mark:r,markDef:s,stack:o,config:a}=e,u=As(n),l=Nt(n),c=mr(n),f=i[u],d=e.scaleName(u),p=e.getScaleComponent(u),{offset:h}=n in i||n in s?Ao({channel:n,markDef:s,encoding:i,model:e}):Ao({channel:u,markDef:s,encoding:i,model:e});if(!f&&(n==="x2"||n==="y2")&&(i.latitude||i.longitude)){const m=Nt(n),y=e.markDef[m];return y!=null?{[m]:{value:y}}:{[c]:{field:e.getName(n)}}}const g=gV({channel:n,channelDef:f,channel2Def:i[n],markDef:s,config:a,scaleName:d,scale:p,stack:o,offset:h,defaultRef:void 0});return g!==void 0?{[c]:g}:cl(n,s)||cl(n,{[n]:Ip(n,s,a.style),[l]:Ip(l,s,a.style)})||cl(n,a[r])||cl(n,a.mark)||{[c]:_1({model:e,defaultPos:t,channel:n,scaleName:d,scale:p})()}}function gV({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:s,scale:o,stack:a,offset:u,defaultRef:l}){return ne(t)&&a&&e.charAt(0)===a.fieldChannel.charAt(0)?Xr(t,s,{suffix:"start"},{offset:u}):u1({channel:e,channelDef:n,scaleName:s,scale:o,stack:a,markDef:i,config:r,offset:u,defaultRef:l})}function cl(e,t){const n=Nt(e),i=mr(e);if(t[i]!==void 0)return{[i]:za(e,t[i])};if(t[e]!==void 0)return{[i]:za(e,t[e])};if(t[n]){const r=t[n];if(fs(r))N(sq(n));else return{[n]:za(e,r)}}}function Di(e,t){const{config:n,encoding:i,markDef:r}=e,s=r.type,o=di(t),a=Nt(t),u=i[t],l=i[o],c=e.getScaleComponent(t),f=c?c.get("type"):void 0,d=r.orient,p=i[a]??i.size??me("size",r,n,{vgChannel:a}),h=mC(t),g=s==="bar"&&(t==="x"?d==="vertical":d==="horizontal")||s==="tick"&&(t==="y"?d==="vertical":d==="horizontal");return M(u)&&($e(u.bin)||et(u.bin)||u.timeUnit&&!l)&&!(p&&!fs(p))&&!i[h]&&!Le(f)?bV({fieldDef:u,fieldDef2:l,channel:t,model:e}):(ne(u)&&Le(f)||g)&&!l?yV(u,t,e):$O(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function mV(e,t,n,i,r,s,o){if(fs(r))if(n){const u=n.get("type");if(u==="band"){let l=`bandwidth('${t}')`;r.band!==1&&(l=`${r.band} * ${l}`);const c=ni("minBandSize",{type:o},i);return{signal:c?`max(${En(c)}, ${l})`:l}}else r.band!==1&&(N(gq(u)),r=void 0)}else return{mult:r.band,field:{group:e}};else{if(Y(r))return r;if(r)return{value:r}}if(n){const u=n.get("range");if(Fs(u)&&de(u.step))return{value:u.step-2}}if(!s){const{bandPaddingInner:u,barBandPaddingInner:l,rectBandPaddingInner:c,tickBandPaddingInner:f}=i.scale,d=Pe(u,o==="tick"?f:o==="bar"?l:c);if(Y(d))return{signal:`(1 - (${d.signal})) * ${e}`};if(de(d))return{signal:`${1-d} * ${e}`}}return{value:Gp(i.view,e)-2}}function yV(e,t,n){const{markDef:i,encoding:r,config:s,stack:o}=n,a=i.orient,u=n.scaleName(t),l=n.getScaleComponent(t),c=Nt(t),f=di(t),d=mC(t),p=n.scaleName(d),h=n.getScaleComponent(Ny(t)),g=i.type==="tick"||a==="horizontal"&&t==="y"||a==="vertical"&&t==="x";let m;(r.size||i.size)&&(g?m=it("size",n,{vgChannel:c,defaultRef:Ce(i.size)}):N(xq(i.type)));const y=!!m,b=pF({channel:t,fieldDef:e,markDef:i,config:s,scaleType:(l||h)?.get("type"),useVlSizeChannel:g});m=m||{[c]:mV(c,p||u,h||l,s,b,!!e,i.type)};const v=(l||h)?.get("type")==="band"&&fs(b)&&!y?"top":"middle",w=kO(t,i,s,v),E=w==="xc"||w==="yc",{offset:S,offsetType:x}=Ao({channel:t,markDef:i,encoding:r,model:n,bandPosition:E?.5:0}),k=u1({channel:t,channelDef:e,markDef:i,config:s,scaleName:u,scale:l,stack:o,offset:S,defaultRef:_1({model:n,defaultPos:"mid",channel:t,scaleName:u,scale:l}),bandPosition:E?x==="encoding"?0:.5:Y(b)?{signal:`(1-${b})/2`}:fs(b)?(1-b.band)/2:0});if(c)return{[w]:k,...m};{const D=mr(f),P=m[c],K=S?{...P,offset:S}:P;return{[w]:k,[D]:F(k)?[k[0],{...k[1],offset:K}]:{...k,offset:K}}}}function iE(e,t,n,i,r,s,o){if(cC(e))return 0;const a=e==="x"||e==="y2",u=a?-t/2:t/2;if(Y(n)||Y(r)||Y(i)||s){const l=En(n),c=En(r),f=En(i),d=En(s),h=s?`(${o} < ${d} ? ${a?"":"-"}0.5 * (${d} - (${o})) : ${u})`:u,g=f?`${f} + `:"",m=l?`(${l} ? -1 : 1) * `:"",y=c?`(${c} + ${h})`:h;return{signal:g+m+y}}else return r=r||0,i+(n?-r-u:+r+u)}function bV({fieldDef:e,fieldDef2:t,channel:n,model:i}){const{config:r,markDef:s,encoding:o}=i,a=i.getScaleComponent(n),u=i.scaleName(n),l=a?a.get("type"):void 0,c=a.get("reverse"),f=pF({channel:n,fieldDef:e,markDef:s,config:r,scaleType:l}),p=i.component.axes[n]?.[0]?.get("translate")??.5,h=Ie(n)?me("binSpacing",s,r)??0:0,g=di(n),m=mr(n),y=mr(g),b=ni("minBandSize",s,r),{offset:v}=Ao({channel:n,markDef:s,encoding:o,model:i,bandPosition:0}),{offset:w}=Ao({channel:g,markDef:s,encoding:o,model:i,bandPosition:0}),E=jW({fieldDef:e,scaleName:u}),S=iE(n,h,c,p,v,b,E),x=iE(g,h,c,p,w??v,b,E),k=Y(f)?{signal:`(1-${f.signal})/2`}:fs(f)?(1-f.band)/2:.5,D=yr({fieldDef:e,fieldDef2:t,markDef:s,config:r});if($e(e.bin)||e.timeUnit){const P=e.timeUnit&&D!==.5;return{[y]:rE({fieldDef:e,scaleName:u,bandPosition:k,offset:x,useRectOffsetField:P}),[m]:rE({fieldDef:e,scaleName:u,bandPosition:Y(k)?{signal:`1-${k.signal}`}:1-k,offset:S,useRectOffsetField:P})}}else if(et(e.bin)){const P=Xr(e,u,{},{offset:x});if(M(t))return{[y]:P,[m]:Xr(t,u,{},{offset:S})};if(Cs(e.bin)&&e.bin.step)return{[y]:P,[m]:{signal:`scale("${u}", ${B(e,{expr:"datum"})} + ${e.bin.step})`,offset:S}}}N(LC(g))}function rE({fieldDef:e,scaleName:t,bandPosition:n,offset:i,useRectOffsetField:r}){return Sc({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i,...r?{startSuffix:rd,endSuffix:sd}:{}})}const xV=new Set(["aria","width","height"]);function dn(e,t){const{fill:n=void 0,stroke:i=void 0}=t.color==="include"?SO(e):{};return{...vV(e.markDef,t),...sE("fill",n),...sE("stroke",i),...it("opacity",e),...it("fillOpacity",e),...it("strokeOpacity",e),...it("strokeWidth",e),...it("strokeDash",e),...cV(e),...vO(e),...D1(e,"href"),...aV(e)}}function sE(e,t){return t?{[e]:t}:{}}function vV(e,t){return Fj.reduce((n,i)=>(!xV.has(i)&&_(e,i)&&t[i]!=="ignore"&&(n[i]=Ce(e[i])),n),{})}function T1(e){const{config:t,markDef:n}=e,i=new Set;if(e.forEachFieldDef((r,s)=>{let o;if(!hi(s)||!(o=e.getScaleType(s)))return;const a=zf(r.aggregate),u=a1({scaleChannel:s,markDef:n,config:t,scaleType:o,isCountAggregate:a});if(zW(u)){const l=e.vgField(s,{expr:"datum",binSuffix:e.stack?.impute?"mid":void 0});l&&i.add(l)}}),i.size>0)return{defined:{signal:[...i].map(s=>qf(s,!0)).join(" && ")}}}function oE(e,t){if(t!==void 0)return{[e]:Ce(t)}}const ch="voronoi",AO={defined:e=>e.type==="point"&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(ch)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,s=e.mark;if(Or(s))return N(Mj(s)),n;const o={name:e.getName(ch),type:"path",interactive:!0,aria:!1,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...vO(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let a=0,u=!1;return n.forEach((l,c)=>{const f=l.name??"";f===e.component.mark[0].name?a=c:f.includes(ch)&&(u=!0)}),u||n.splice(a+1,0,o),n}},CO={defined:e=>e.type==="point"&&e.resolve==="global"&&e.bind&&e.bind!=="scales"&&!w1(e.bind),parse:(e,t,n)=>MO(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,s=t.bind,o=t.init?.[0],a=AO.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach((u,l)=>{const c=De(`${i}_${u.field}`);n.filter(d=>d.name===c).length||n.unshift({name:c,...o?{init:hs(o[l])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${a}[${L(u.field)}] : null`}]:[],bind:s[u.field]??s[u.channel]??s})}),n},signals:(e,t,n)=>{const i=t.name,r=t.project,s=n.find(l=>l.name===i+Ri),o=i+Gu,a=r.items.map(l=>De(`${i}_${l.field}`)),u=a.map(l=>`${l} !== null`).join(" && ");return a.length&&(s.update=`${u} ? {fields: ${o}, values: [${a.join(", ")}]} : null`),delete s.value,delete s.on,n}},Dc="_toggle",FO={defined:e=>e.type==="point"&&!Jn(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+Dc,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Ri,i=t.name+Dc;return`${i} ? null : ${n}, ${t.resolve==="global"?`${i} ? null : true, `:`${i} ? null : {unit: ${Kr(e)}}, `}${i} ? ${n} : null`}},EV={defined:e=>e.clear!==void 0&&e.clear!==!1&&!Jn(e),parse:(e,t)=>{t.clear&&(t.clear=j(t.clear)?Er(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(CO.defined(t))for(const i of t.project.items){const r=n.findIndex(s=>s.name===De(`${t.name}_${i.field}`));r!==-1&&n[r].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(r,s){r!==-1&&n[r].on&&n[r].on.push({events:t.clear,update:s})}if(t.type==="interval")for(const r of t.project.items){const s=n.findIndex(o=>o.name===r.signals.visual);if(i(s,"[0, 0]"),s===-1){const o=n.findIndex(a=>a.name===r.signals.data);i(o,"null")}}else{let r=n.findIndex(s=>s.name===t.name+Ri);i(r,"null"),FO.defined(t)&&(r=n.findIndex(s=>s.name===t.name+Dc),i(r,"false"))}return n}},OO={defined:e=>{const t=e.resolve==="global"&&e.bind&&w1(e.bind),n=e.project.items.length===1&&e.project.items[0].field!==Rn;return t&&!n&&N(zj),t&&n},parse:(e,t,n)=>{const i=te(n);if(i.select=j(i.select)?{type:i.select,toggle:t.toggle}:{...i.select,toggle:t.toggle},MO(t,i),U(n.select)&&(n.select.on||n.select.clear)){const o='event.item && indexof(event.item.mark.role, "legend") < 0';for(const a of t.events)a.filter=q(a.filter??[]),a.filter.includes(o)||a.filter.push(o)}const r=rh(t.bind)?t.bind.legend:"click",s=j(r)?Er(r,"view"):q(r);t.bind={legend:{merge:s}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=rh(t.bind)&&t.bind.legend,s=o=>a=>{const u=te(a);return u.markname=o,u};for(const o of t.project.items){if(!o.hasLegend)continue;const a=`${De(o.field)}_legend`,u=`${i}_${a}`;if(n.filter(c=>c.name===u).length===0){const c=r.merge.map(s(`${a}_symbols`)).concat(r.merge.map(s(`${a}_labels`))).concat(r.merge.map(s(`${a}_entries`)));n.unshift({name:u,...t.init?{}:{value:null},on:[{events:c,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,s=n.find(d=>d.name===i+Ri),o=i+Gu,a=r.items.filter(d=>d.hasLegend).map(d=>De(`${i}_${De(d.field)}_legend`)),l=`${a.map(d=>`${d} !== null`).join(" && ")} ? {fields: ${o}, values: [${a.join(", ")}]} : null`;t.events&&a.length>0?s.on.push({events:a.map(d=>({signal:d})),update:l}):a.length>0&&(s.update=l,delete s.value,delete s.on);const c=n.find(d=>d.name===i+Dc),f=rh(t.bind)&&t.bind.legend;return c&&(t.events?c.on.push({...c.on[0],events:f}):c.on[0].events=f),n}};function wV(e,t,n){const i=e.fieldDef(t)?.field;for(const r of Be(e.component.selection??{})){const s=r.project.hasField[i]??r.project.hasChannel[t];if(s&&OO.defined(r)){const o=n.get("selections")??[];o.push(r.name),n.set("selections",o,!1),s.hasLegend=!0}}}const DO="_translate_anchor",RO="_translate_delta",SV={defined:e=>e.type==="interval"&&e.translate,signals:(e,t,n)=>{const i=t.name,r=Ai.defined(t),s=i+DO,{x:o,y:a}=t.project.hasChannel;let u=Er(t.translate,"scope");return r||(u=u.map(l=>(l.between[0].markname=i+to,l))),n.push({name:s,value:{},on:[{events:u.map(l=>l.between[0]),update:`{x: x(unit), y: y(unit)${o!==void 0?`, extent_x: ${r?Kp(e,Re):`slice(${o.signals.visual})`}`:""}${a!==void 0?`, extent_y: ${r?Kp(e,Ze):`slice(${a.signals.visual})`}`:""}}`}]},{name:i+RO,value:{},on:[{events:u,update:`{x: ${s}.x - x(unit), y: ${s}.y - y(unit)}`}]}),o!==void 0&&aE(e,t,o,"width",n),a!==void 0&&aE(e,t,a,"height",n),n}};function aE(e,t,n,i,r){const s=t.name,o=s+DO,a=s+RO,u=n.channel,l=Ai.defined(t),c=r.find(E=>E.name===n.signals[l?"data":"visual"]),f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(u),p=d?.get("type"),h=d?.get("reverse"),g=l?u===Re?h?"":"-":h?"-":"":"",m=`${o}.extent_${u}`,y=`${g}${a}.${u} / ${l?`${f}`:`span(${m})`}`,b=!l||!d?"panLinear":p==="log"?"panLog":p==="symlog"?"panSymlog":p==="pow"?"panPow":"panLinear",v=l?p==="pow"?`, ${d.get("exponent")??1}`:p==="symlog"?`, ${d.get("constant")??1}`:"":"",w=`${b}(${m}, ${y}${v})`;c.on.push({events:{signal:a},update:l?w:`clampRange(${w}, 0, ${f})`})}const _O="_zoom_anchor",TO="_zoom_delta",kV={defined:e=>e.type==="interval"&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=Ai.defined(t),s=i+TO,{x:o,y:a}=t.project.hasChannel,u=L(e.scaleName(Re)),l=L(e.scaleName(Ze));let c=Er(t.zoom,"scope");return r||(c=c.map(f=>(f.markname=i+to,f))),n.push({name:i+_O,on:[{events:c,update:r?`{${[u?`x: invert(${u}, x(unit))`:"",l?`y: invert(${l}, y(unit))`:""].filter(f=>f).join(", ")}}`:"{x: x(unit), y: y(unit)}"}]},{name:s,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),o!==void 0&&uE(e,t,o,"width",n),a!==void 0&&uE(e,t,a,"height",n),n}};function uE(e,t,n,i,r){const s=t.name,o=n.channel,a=Ai.defined(t),u=r.find(b=>b.name===n.signals[a?"data":"visual"]),l=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(o),f=c?.get("type"),d=a?Kp(e,o):u.name,p=s+TO,h=`${s}${_O}.${o}`,g=!a||!c?"zoomLinear":f==="log"?"zoomLog":f==="symlog"?"zoomSymlog":f==="pow"?"zoomPow":"zoomLinear",m=a?f==="pow"?`, ${c.get("exponent")??1}`:f==="symlog"?`, ${c.get("constant")??1}`:"":"",y=`${g}(${d}, ${h}, ${p}${m})`;u.on.push({events:{signal:p},update:a?y:`clampRange(${y}, 0, ${l})`})}const ps="_store",Ri="_tuple",$V="_modify",NO="vlSelectionResolve",od=[JH,sV,XH,FO,CO,Ai,OO,EV,SV,kV,AO];function AV(e){let t=e.parent;for(;t&&!Gt(t);)t=t.parent;return t}function Kr(e,{escape:t}={escape:!0}){let n=t?L(e.name):e.name;const i=AV(e);if(i){const{facet:r}=i;for(const s of en)r[s]&&(n+=` + '__facet_${s}_' + (facet[${L(i.vgField(s))}])`)}return n}function N1(e){return Be(e.component.selection??{}).reduce((t,n)=>t||n.project.hasSelectionId,!1)}function MO(e,t){(j(t.select)||!t.select.on)&&delete e.events,(j(t.select)||!t.select.clear)&&delete e.clear,(j(t.select)||!t.select.toggle)&&delete e.toggle}function Jn(e){return e.events?.find(t=>"type"in t&&t.type==="timer")}function Qp(e){const t=[];return e.type==="Identifier"?[e.name]:e.type==="Literal"?[e.value]:(e.type==="MemberExpression"&&(t.push(...Qp(e.object)),t.push(...Qp(e.property))),t)}function LO(e){return e.object.type==="MemberExpression"?LO(e.object):e.object.name==="datum"}function PO(e){const t=J0(e),n=new Set;return t.visit(i=>{i.type==="MemberExpression"&&LO(i)&&n.add(Qp(i).slice(1).join("."))}),n}class Xo extends ve{model;filter;expr;_dependentFields;clone(){return new Xo(null,this.model,te(this.filter))}constructor(t,n,i){super(t),this.model=n,this.filter=i,this.expr=Rc(this.model,this.filter,this),this._dependentFields=PO(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function CV(e,t){const n={},i=e.config.selection;if(!t||!t.length)return n;let r=0;for(const s of t){const o=De(s.name),a=s.select,u=j(a)?a:a.type,l=U(a)?te(a):{type:u},c=i[u];for(const p in c)p==="fields"||p==="encodings"||(p==="mark"&&(l.mark={...c.mark,...l.mark}),(l[p]===void 0||l[p]===!0)&&(l[p]=te(c[p]??l[p])));const f=n[o]={...l,name:o,type:u,init:s.value,bind:s.bind,events:j(l.on)?Er(l.on,"scope"):q(te(l.on))};if(Jn(f)&&(r++,r>1)){delete n[o];continue}const d=te(s);for(const p of od)p.defined(f)&&p.parse&&p.parse(e,f,d)}return r>1&&N(Gj),n}function IO(e,t,n,i="datum"){const r=j(t)?t:t.param,s=De(r),o=L(s+ps);let a;try{a=e.getSelectionComponent(s,r)}catch{return`!!${s}`}if(a.project.timeUnit){const d=n??e.component.data.raw,p=a.project.timeUnit.clone();d.parent?p.insertAsParentOf(d):d.parent=p}const u=a.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest(",l=a.resolve==="global"?")":`, ${L(a.resolve)})`,c=`${u}${o}, ${i}${l}`,f=`length(data(${o}))`;return t.empty===!1?`${f} && ${c}`:`!${f} || ${c}`}function zO(e,t,n){const i=De(t),r=n.encoding;let s=n.field,o;try{o=e.getSelectionComponent(i,t)}catch{return i}if(!r&&!s)s=o.project.items[0].field,o.project.items.length>1&&N(Hj(s));else if(r&&!s){const a=o.project.items.filter(u=>u.channel===r);!a.length||a.length>1?(s=o.project.items[0].field,N(Vj(a,r,n,s))):s=a[0].field}return`${o.name}[${L(un(s))}]`}function FV(e,t){for(const[n,i]of gr(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new Ot(new Xo(t,e,{param:n}),r,Te.Lookup,e.component.data.outputNodeRefCounts)}}function Rc(e,t,n){return Ia(t,i=>j(i)?i:iW(i)?IO(e,i,n):XC(i))}function OV(e,t){if(e)return F(e)&&!Xi(e)?e.map(n=>p1(n,t)).join(", "):e}function fh(e,t,n,i){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=i}function Oa(e,t,n,i={header:!1}){const{disable:r,orient:s,scale:o,labelExpr:a,title:u,zindex:l,...c}=e.combine();if(!r){for(const f in c){const d=f,p=aG[d],h=c[d];if(p&&p!==t&&p!=="both")delete c[d];else if(Wu(h)){const{condition:g,...m}=h,y=q(g),b=Lv[d];if(b){const{vgProp:v,part:w}=b,E=[...y.map(S=>{const{test:x,...k}=S;return{test:Rc(null,x),...k}}),m];fh(c,w,v,E),delete c[d]}else if(b===null){const v={signal:y.map(w=>{const{test:E,...S}=w;return`${Rc(null,E)} ? ${vv(S)} : `}).join("")+vv(m)};c[d]=v}}else if(Y(h)){const g=Lv[d];if(g){const{vgProp:m,part:y}=g;fh(c,y,m,h),delete c[d]}}ae(["labelAlign","labelBaseline"],d)&&c[d]===null&&delete c[d]}if(t==="grid"){if(!c.grid)return;if(c.encode){const{grid:f}=c.encode;c.encode={...f?{grid:f}:{}},Se(c.encode)&&delete c.encode}return{scale:o,orient:s,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:Pe(l,0)}}else{if(!i.header&&e.mainExtracted)return;if(a!==void 0){let d=a;c.encode?.labels?.update&&Y(c.encode.labels.update.text)&&(d=os(a,"datum.label",c.encode.labels.update.text.signal)),fh(c,"labels","text",{signal:d})}if(c.labelAlign===null&&delete c.labelAlign,c.encode){for(const d of kF)e.hasAxisPart(d)||delete c.encode[d];Se(c.encode)&&delete c.encode}const f=OV(u,n);return{scale:o,orient:s,grid:!1,...f?{title:f}:{},...c,...n.aria===!1?{aria:!1}:{},zindex:Pe(l,0)}}}}function BO(e){const{axes:t}=e.component,n=[];for(const i of Ii)if(t[i]){for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const s=i==="x"?"height":"width",o=e.getSizeSignalRef(s).signal;s!==o&&n.push({name:s,update:o})}}return n}function DV(e,t){const{x:n=[],y:i=[]}=e;return[...n.map(r=>Oa(r,"grid",t)),...i.map(r=>Oa(r,"grid",t)),...n.map(r=>Oa(r,"main",t)),...i.map(r=>Oa(r,"main",t))].filter(r=>r)}function lE(e,t,n,i){return Object.assign.apply(null,[{},...e.map(r=>{if(r==="axisOrient"){const s=n==="x"?"bottom":"left",o=t[n==="x"?"axisBottom":"axisLeft"]||{},a=t[n==="x"?"axisTop":"axisRight"]||{},u=new Set([...R(o),...R(a)]),l={};for(const c of u.values())l[c]={signal:`${i.signal} === "${s}" ? ${En(o[c])} : ${En(a[c])}`};return l}return t[r]})])}function RV(e,t,n,i){const r=t==="band"?["axisDiscrete","axisBand"]:t==="point"?["axisDiscrete","axisPoint"]:JC(t)?["axisQuantitative"]:t==="time"||t==="utc"?["axisTemporal"]:[],s=e==="x"?"axisX":"axisY",o=Y(n)?"axisOrient":`axis${Tu(n)}`,a=[...r,...r.map(l=>s+l.substr(4))],u=["axis",o,s];return{vlOnlyAxisConfig:lE(a,i,e,n),vgAxisConfig:lE(u,i,e,n),axisConfigStyle:_V([...u,...a],i)}}function _V(e,t){const n=[{}];for(const i of e){let r=t[i]?.style;if(r){r=q(r);for(const s of r)n.push(t.style[s])}}return Object.assign.apply(null,n)}function Zp(e,t,n,i={}){const r=AC(e,n,t);if(r!==void 0)return{configFrom:"style",configValue:r};for(const s of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(i[s]?.[e]!==void 0)return{configFrom:s,configValue:i[s][e]};return{}}const cE={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??TV(n,e),gridScale:({model:e,channel:t})=>NV(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||jO(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||UO(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??LV(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??PV(t.type,n,M(t)&&!!t.timeUnit,M(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{const s=e==="x"?"width":e==="y"?"height":void 0,o=s?t.getSizeSignalRef(s):void 0;return n.tickCount??zV({fieldOrDatumDef:i,scaleType:r,size:o,values:n.values})},tickMinStep:({axis:e,format:t,fieldOrDatumDef:n})=>e.tickMinStep??BV({format:t,fieldOrDatumDef:n}),title:({axis:e,model:t,channel:n})=>{if(e.title!==void 0)return e.title;const i=qO(t,n);if(i!==void 0)return i;const r=t.typedFieldDef(n),s=n==="x"?"x2":"y2",o=t.fieldDef(s);return FC(r?[Nv(r)]:[],M(o)?[Nv(o)]:[])},values:({axis:e,fieldOrDatumDef:t})=>UV(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??jV(n,t)};function TV(e,t){return!Le(e)&&M(t)&&!$e(t?.bin)&&!et(t?.bin)}function NV(e,t){const n=t==="x"?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}function MV(e,t,n,i,r){const s=t?.labelAngle;if(s!==void 0)return Y(s)?s:nu(s);{const{configValue:o}=Zp("labelAngle",i,t?.style,r);return o!==void 0?nu(o):n===Re&&ae([n1,t1],e.type)&&!(M(e)&&e.timeUnit)?270:void 0}}function eg(e){return`(((${e.signal} % 360) + 360) % 360)`}function UO(e,t,n,i){if(e!==void 0)if(n==="x"){if(Y(e)){const r=eg(e),s=Y(t)?`(${t.signal} === "top")`:t==="top";return{signal:`(45 < ${r} && ${r} < 135) || (225 < ${r} && ${r} < 315) ? "middle" :(${r} <= 45 || 315 <= ${r}) === ${s} ? "bottom" : "top"`}}if(45{if(Rs(i)&&hF(i.sort)){const{field:s,timeUnit:o}=i,a=i.sort,u=a.map((l,c)=>`${XC({field:s,timeUnit:o,equal:l})} ? ${c} : `).join("")+a.length;t=new Co(t,{calculate:u,as:Fo(i,r,{forAs:!0})})}}),t}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${se(this.transform)}`}}function Fo(e,t,n){return B(e,{prefix:t,suffix:"sort_index",...n})}function ad(e,t){return ae(["top","bottom"],t)?"column":ae(["left","right"],t)||e==="row"?"row":"column"}function Oo(e,t,n,i){const r=i==="row"?n.headerRow:i==="column"?n.headerColumn:n.headerFacet;return Pe((t||{})[e],r[e],n.header[e])}function ud(e,t,n,i){const r={};for(const s of e){const o=Oo(s,t||{},n,i);o!==void 0&&(r[s]=o)}return r}const M1=["row","column"],L1=["header","footer"];function qV(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:s,titleAngle:o,titleOrient:a}=ud(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),u=ad(t,a),l=nu(o);return{name:`${t}-title`,type:"group",role:`${u}-title`,title:{text:n,...t==="row"?{orient:"left"}:{},style:"guide-title",...GO(l,u),...WO(u,l,s),...HO(i,r,t,OG,jF)}}}function WO(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=jO(t,e==="row"?"left":"top",e==="row"?"y":"x");return i?{align:i}:{}}function GO(e,t){const n=UO(e,t==="row"?"left":"top",t==="row"?"y":"x",!0);return n?{baseline:n}:{}}function WV(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of L1)if(n[r])for(const s of n[r]){const o=HV(e,t,r,n,s);o!=null&&i.push(o)}return i}function GV(e,t){const{sort:n}=e;return $i(n)?{field:B(n,{expr:"datum"}),order:n.order??"ascending"}:F(n)?{field:Fo(e,t,{expr:"datum"}),order:"ascending"}:{field:B(e,{expr:"datum"}),order:n??"ascending"}}function tg(e,t,n){const{format:i,formatType:r,labelAngle:s,labelAnchor:o,labelOrient:a,labelExpr:u}=ud(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),l=c1({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=ad(t,a);return{text:{signal:u?os(os(u,"datum.label",l),"datum.value",B(e,{expr:"parent"})):l},...t==="row"?{orient:"left"}:{},style:"guide-label",frame:"group",...GO(s,c),...WO(c,s,o),...HO(n,e,t,DG,qF)}}function HV(e,t,n,i,r){if(r){let s=null;const{facetFieldDef:o}=i,a=e.config?e.config:void 0;if(o&&r.labels){const{labelOrient:f}=ud(["labelOrient"],o.header,a,t);(t==="row"&&!ae(["top","bottom"],f)||t==="column"&&!ae(["left","right"],f))&&(s=tg(o,t,a))}const u=Gt(e)&&!Bu(e.facet),l=r.axes,c=l?.length>0;if(s||c){const f=t==="row"?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:GV(o,t)}:{},...c&&u?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...s?{title:s}:{},...r.sizeSignal?{encode:{update:{[f]:r.sizeSignal}}}:{},...c?{axes:l}:{}}}}return null}const VV={column:{start:0,end:1},row:{start:1,end:0}};function XV(e,t){return VV[t][e]}function YV(e,t){const n={};for(const i of en){const r=e[i];if(r?.facetFieldDef){const{titleAnchor:s,titleOrient:o}=ud(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=ad(i,o),u=XV(s,a);u!==void 0&&(n[a]=u)}}return Se(n)?void 0:n}function HO(e,t,n,i,r){const s={};for(const o of i){if(!r[o])continue;const a=Oo(o,t?.header,e,n);a!==void 0&&(s[r[o]]=a)}return s}function P1(e){return[...fl(e,"width"),...fl(e,"height"),...fl(e,"childWidth"),...fl(e,"childHeight")]}function fl(e,t){const n=t==="width"?"x":"y",i=e.component.layoutSize.get(t);if(i==null||i==="merged")return[];const r=e.getSizeSignalRef(t).signal;if(i==="step"){const s=e.getScaleComponent(n);if(s){const o=s.get("type"),a=s.get("range");if(Le(o)&&Fs(a)){const u=e.scaleName(n);return Gt(e.parent)&&e.parent.component.resolve.scale[n]==="independent"?[fE(u,a)]:[fE(u,a),{name:r,update:VO(u,s,`domain('${u}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}else if(i=="container"){const s=r.endsWith("width"),o=s?"containerSize()[0]":"containerSize()[1]",a=Wp(e.config.view,s?"width":"height"),u=`isFinite(${o}) ? ${o} : ${a}`;return[{name:r,init:u,on:[{update:u,events:"window:resize"}]}]}else return[{name:r,value:i}]}function fE(e,t){const n=`${e}_step`;return Y(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function VO(e,t,n){const i=t.get("type"),r=t.get("padding"),s=Pe(t.get("paddingOuter"),r);let o=t.get("paddingInner");return o=i==="band"?o!==void 0?o:r:1,`bandspace(${n}, ${En(o)}, ${En(s)}) * ${e}_step`}function XO(e){return e==="childWidth"?"width":e==="childHeight"?"height":e}function YO(e,t){return R(e).reduce((n,i)=>({...n,...Vo({model:t,channelDef:e[i],vgChannel:i,mainRefFn:r=>Ce(r.value),invalidValueRef:void 0})}),{})}function KO(e,t){if(Gt(t))return e==="theta"?"independent":"shared";if(Jo(t))return"shared";if(W1(t))return Ie(e)||e==="theta"||e==="radius"?"independent":"shared";throw new Error("invalid model type for resolve")}function I1(e,t){const n=e.scale[t],i=Ie(t)?"axis":"legend";return n==="independent"?(e[i][t]==="shared"&&N(kq(t)),"independent"):e[i][t]||"shared"}const KV={...TG,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},JO=R(KV);class JV extends Bi{}const dE={symbols:QV,gradient:ZV,labels:eX,entries:tX};function QV(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:s}){if(s!=="symbol")return;const{markDef:o,encoding:a,config:u,mark:l}=n,c=o.filled&&l!=="trail";let f={..._j({},n,OW),...SO(n,{filled:c})};const d=r.get("symbolOpacity")??u.legend.symbolOpacity,p=r.get("symbolFillColor")??u.legend.symbolFillColor,h=r.get("symbolStrokeColor")??u.legend.symbolStrokeColor,g=d===void 0?QO(a.opacity)??o.opacity:void 0;if(f.fill){if(i==="fill"||c&&i===_t)delete f.fill;else if(_(f.fill,"field"))p?delete f.fill:(f.fill=Ce(u.legend.symbolBaseFillColor??"black"),f.fillOpacity=Ce(g??1));else if(F(f.fill)){const m=ng(a.fill??a.color)??o.fill??(c&&o.color);m&&(f.fill=Ce(m))}}if(f.stroke){if(i==="stroke"||!c&&i===_t)delete f.stroke;else if(_(f.stroke,"field")||h)delete f.stroke;else if(F(f.stroke)){const m=Pe(ng(a.stroke||a.color),o.stroke,c?o.color:void 0);m&&(f.stroke={value:m})}}if(i!==Pi){const m=M(t)&&eD(n,r,t);m?f.opacity=[{test:m,...Ce(g??1)},Ce(u.legend.unselectedOpacity)]:g&&(f.opacity=Ce(g))}return f={...f,...e},Se(f)?void 0:f}function ZV(e,{model:t,legendType:n,legendCmpt:i}){if(n!=="gradient")return;const{config:r,markDef:s,encoding:o}=t;let a={};const l=(i.get("gradientOpacity")??r.legend.gradientOpacity)===void 0?QO(o.opacity)||s.opacity:void 0;return l&&(a.opacity=Ce(l)),a={...a,...e},Se(a)?void 0:a}function eX(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const s=n.legend(i)||{},o=n.config,a=M(t)?eD(n,r,t):void 0,u=a?[{test:a,value:1},{value:o.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=s;let f;ds(c)?f=wn({fieldOrDatumDef:t,field:"datum.value",format:l,formatType:c,config:o}):l===void 0&&c===void 0&&o.customFormatTypes&&(t.type==="quantitative"&&o.numberFormatType?f=wn({fieldOrDatumDef:t,field:"datum.value",format:o.numberFormat,formatType:o.numberFormatType,config:o}):t.type==="temporal"&&o.timeFormatType&&M(t)&&t.timeUnit===void 0&&(f=wn({fieldOrDatumDef:t,field:"datum.value",format:o.timeFormat,formatType:o.timeFormatType,config:o})));const d={...u?{opacity:u}:{},...f?{text:f}:{},...e};return Se(d)?void 0:d}function tX(e,{legendCmpt:t}){return t.get("selections")?.length?{...e,fill:{value:"transparent"}}:e}function QO(e){return ZO(e,(t,n)=>Math.max(t,n.value))}function ng(e){return ZO(e,(t,n)=>Pe(t,n.value))}function ZO(e,t){if(YW(e))return q(e.condition).reduce(t,e.value);if(On(e))return e.value}function eD(e,t,n){const i=t.get("selections");if(!i?.length)return;const r=L(n.field);return i.map(s=>`(!length(data(${L(De(s)+ps)})) || (${s}[${r}] && indexof(${s}[${r}], datum.value) >= 0))`).join(" || ")}const hE={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return cF(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return fF(i,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??uX(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??lX(n),symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>e.symbolType??iX(t.type,n,i.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>eo(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(Zs(n)&&Xn(t)){if(e==="gradient")return}else if(e==="symbol")return;return e},values:({fieldOrDatumDef:e,legend:t})=>nX(t,e)};function nX(e,t){const n=e.values;if(F(n))return SF(t,n);if(Y(n))return n}function iX(e,t,n,i){if(t!=="shape"){const r=ng(n)??i;if(r)return r}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}function rX(e){const{legend:t}=e;return Pe(t.type,sX(e))}function sX({channel:e,timeUnit:t,scaleType:n}){if(Zs(e)){if(ae(["quarter","month","day"],t))return"symbol";if(Xn(n))return"gradient"}return"symbol"}function oX({legendConfig:e,legendType:t,orient:n,legend:i}){return i.direction??e[t?"gradientDirection":"symbolDirection"]??aX(n,t)}function aX(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return t==="gradient"?"horizontal":void 0}}function uX({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:s,gradientHorizontalMinLength:o,gradientVerticalMaxLength:a,gradientVerticalMinLength:u}=e;if(Xn(r))return n==="horizontal"?i==="top"||i==="bottom"?pE(t,"width",o,s):o:pE(t,"height",u,a)}function pE(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function lX(e){if(ae(["quantile","threshold","log","symlog"],e))return"greedy"}function tD(e){const t=Oe(e)?cX(e):pX(e);return e.component.legends=t,t}function cX(e){const{encoding:t}=e,n={};for(const i of[_t,...GF]){const r=Ge(t[i]);!r||!e.getScaleComponent(i)||i===Tt&&M(r)&&r.type===Ho||(n[i]=hX(e,i))}return n}function fX(e,t){const n=e.scaleName(t);if(e.mark==="trail"){if(t==="color")return{stroke:n};if(t==="size")return{strokeWidth:n}}return t==="color"?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}function dX(e,t,n,i){switch(t){case"disable":return n!==void 0;case"values":return!!n?.values;case"title":if(t==="title"&&e===i?.title)return!0}return e===(n||{})[t]}function hX(e,t){let n=e.legend(t);const{markDef:i,encoding:r,config:s}=e,o=s.legend,a=new JV({},fX(e,t));wV(e,t,a);const u=n!==void 0?!n:o.disable;if(a.set("disable",u,n!==void 0),u)return a;n=n||{};const l=e.getScaleComponent(t).get("type"),c=Ge(r[t]),f=M(c)?Qe(c.timeUnit)?.unit:void 0,d=n.orient||s.legend.orient||"right",p=rX({legend:n,channel:t,timeUnit:f,scaleType:l}),h=oX({legend:n,legendType:p,orient:d,legendConfig:o}),g={legend:n,channel:t,model:e,markDef:i,encoding:r,fieldOrDatumDef:c,legendConfig:o,config:s,scaleType:l,orient:d,legendType:p,direction:h};for(const w of JO){if(p==="gradient"&&w.startsWith("symbol")||p==="symbol"&&w.startsWith("gradient"))continue;const E=w in hE?hE[w](g):n[w];if(E!==void 0){const S=dX(E,w,n,e.fieldDef(t));(S||s.legend[w]===void 0)&&a.set(w,E,S)}}const m=n?.encoding??{},y=a.get("selections"),b={},v={fieldOrDatumDef:c,model:e,channel:t,legendCmpt:a,legendType:p};for(const w of["labels","legend","title","symbols","gradient","entries"]){const E=YO(m[w]??{},e),S=w in dE?dE[w](E,v):E;S!==void 0&&!Se(S)&&(b[w]={...y?.length&&M(c)?{name:`${De(c.field)}_legend_${w}`}:{},...y?.length?{interactive:!0}:{},update:y?.length?{...S,cursor:{value:"pointer"}}:S})}return Se(b)||a.set("encode",b,!!n?.encoding),a}function pX(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){tD(i);for(const r of R(i.component.legends))n.legend[r]=I1(e.component.resolve,r),n.legend[r]==="shared"&&(t[r]=nD(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of R(t))for(const r of e.children)r.component.legends[i]&&n.legend[i]==="shared"&&delete r.component.legends[i];return t}function nD(e,t){if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let r=!1;for(const s of JO){const o=br(e.getWithExplicit(s),t.getWithExplicit(s),s,"legend",(a,u)=>{switch(s){case"symbolType":return gX(a,u);case"title":return DC(a,u);case"type":return r=!0,Pt("symbol")}return id(a,u,s,"legend")});e.setWithExplicit(s,o)}return r&&(e.implicit?.encode?.gradient&&vc(e.implicit,["encode","gradient"]),e.explicit?.encode?.gradient&&vc(e.explicit,["encode","gradient"])),e}function gX(e,t){return t.value==="circle"?t:e}function mX(e,t,n,i){if(qu(t,n)){const r=Oe(e)?e.axis(n)??e.legend(n)??{}:{},s=B(t,{expr:"datum"}),o=B(t,{expr:"datum",binSuffix:"end"});return{formulaAs:B(t,{binSuffix:"range",forAs:!0}),formula:zu(s,o,r.format,r.formatType,i)}}return{}}function iD(e,t){return`${EC(e)}_${t}`}function yX(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}function z1(e,t,n){const i=Jf(n,void 0)??{},r=iD(i,t);return e.getName(`${r}_bins`)}function bX(e){return"as"in e}function gE(e,t,n){let i,r;bX(e)?i=j(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:i=[B(e,{forAs:!0}),B(e,{binSuffix:"end",forAs:!0})];const s={...Jf(t,void 0)},o=iD(s,e.field),{signal:a,extentSignal:u}=yX(n,o);if(Bf(s.extent)){const c=s.extent;r=zO(n,c.param,c),delete s.extent}const l={bin:s,field:e.field,as:[i],...a?{signal:a}:{},...u?{extentSignal:u}:{},...r?{span:r}:{}};return{key:o,binComponent:l}}class Qn extends ve{bins;clone(){return new Qn(null,te(this.bins))}constructor(t,n){super(t),this.bins=n}static makeFromEncoding(t,n){const i=n.reduceFieldDef((r,s,o)=>{if($t(s)&&$e(s.bin)){const{key:a,binComponent:u}=gE(s,s.bin,n);r[a]={...u,...r[a],...mX(n,s,o,n.config)}}return r},{});return Se(i)?null:new Qn(t,i)}static makeFromTransform(t,n,i){const{key:r,binComponent:s}=gE(n,n.bin,i);return new Qn(t,{[r]:s})}merge(t,n){for(const i of R(t.bins))i in this.bins?(n(t.bins[i].signal,this.bins[i].signal),this.bins[i].as=zt([...this.bins[i].as,...t.bins[i].as],se)):this.bins[i]=t.bins[i];for(const i of t.children)t.removeChild(i),i.parent=this;t.remove()}producedFields(){return new Set(Be(this.bins).map(t=>t.as).flat(2))}dependentFields(){return new Set(Be(this.bins).map(t=>t.field))}hash(){return`Bin ${se(this.bins)}`}assemble(){return Be(this.bins).flatMap(t=>{const n=[],[i,...r]=t.as,{extent:s,...o}=t.bin,a={type:"bin",field:un(t.field),as:i,signal:t.signal,...Bf(s)?{extent:null}:{extent:s},...t.span?{span:{signal:`span(${t.span})`}}:{},...o};!s&&t.extentSignal&&(n.push({type:"extent",field:un(t.field),signal:t.extentSignal}),a.extent={signal:t.extentSignal}),n.push(a);for(const u of r)for(let l=0;l<2;l++)n.push({type:"formula",expr:B({field:i[l]},{expr:"datum"}),as:u[l]});return t.formula&&n.push({type:"formula",expr:t.formula,as:t.formulaAs}),n})}}function xX(e,t,n,i){const r=Oe(i)?i.encoding[di(t)]:void 0;if($t(n)&&Oe(i)&&gF(n,r,i.markDef,i.config)){e.add(B(n,{})),e.add(B(n,{suffix:"end"}));const{mark:s,markDef:o,config:a}=i,u=yr({fieldDef:n,markDef:o,config:a});iu(s)&&u!==.5&&Ie(t)&&(e.add(B(n,{suffix:rd})),e.add(B(n,{suffix:sd}))),n.bin&&qu(n,t)&&e.add(B(n,{binSuffix:"range"}))}else if(dC(t)){const s=fC(t);e.add(i.getName(s))}else e.add(B(n));return Rs(n)&&mW(n.scale?.range)&&e.add(n.scale.range.field),e}function vX(e,t){for(const n of R(t)){const i=t[n];for(const r of R(i))n in e?e[n][r]=new Set([...e[n][r]??[],...i[r]]):e[n]={[r]:i[r]}}}class kn extends ve{dimensions;measures;clone(){return new kn(null,new Set(this.dimensions),te(this.measures))}constructor(t,n,i){super(t),this.dimensions=n,this.measures=i}get groupBy(){return this.dimensions}static makeFromEncoding(t,n){let i=!1;n.forEachFieldDef(o=>{o.aggregate&&(i=!0)});const r={},s=new Set;return!i||(n.forEachFieldDef((o,a)=>{const{aggregate:u,field:l}=o;if(u)if(u==="count")r["*"]??={},r["*"].count=new Set([B(o,{forAs:!0})]);else{if(Oi(u)||Fr(u)){const c=Oi(u)?"argmin":"argmax",f=u[c];r[f]??={},r[f][c]=new Set([B({op:c,field:f},{forAs:!0})])}else r[l]??={},r[l][u]=new Set([B(o,{forAs:!0})]);hi(a)&&n.scaleDomain(a)==="unaggregated"&&(r[l]??={},r[l].min=new Set([B({field:l,aggregate:"min"},{forAs:!0})]),r[l].max=new Set([B({field:l,aggregate:"max"},{forAs:!0})]))}else xX(s,a,o,n)}),s.size+R(r).length===0)?null:new kn(t,s,r)}static makeFromTransform(t,n){const i=new Set,r={};for(const s of n.aggregate){const{op:o,field:a,as:u}=s;o&&(o==="count"?(r["*"]??={},r["*"].count=new Set([u||B(s,{forAs:!0})])):(r[a]??={},r[a][o]??=new Set,r[a][o].add(u||B(s,{forAs:!0}))))}for(const s of n.groupby??[])i.add(s);return i.size+R(r).length===0?null:new kn(t,i,r)}merge(t){return nC(this.dimensions,t.dimensions)?(vX(this.measures,t.measures),!0):(Uq("different dimensions, cannot merge"),!1)}addDimensions(t){t.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...R(this.measures)])}producedFields(){const t=new Set;for(const n of R(this.measures))for(const i of R(this.measures[n])){const r=this.measures[n][i];r.size===0?t.add(`${i}_${n}`):r.forEach(t.add,t)}return t}hash(){return`Aggregate ${se({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const t=[],n=[],i=[];for(const s of R(this.measures))for(const o of R(this.measures[s]))for(const a of this.measures[s][o])i.push(a),t.push(o),n.push(s==="*"?null:un(s));return{type:"aggregate",groupby:[...this.dimensions].map(un),ops:t,fields:n,as:i}}}class Yo extends ve{model;name;data;column;row;facet;childModel;constructor(t,n,i,r){super(t),this.model=n,this.name=i,this.data=r;for(const s of en){const o=n.facet[s];if(o){const{bin:a,sort:u}=o;this[s]={name:n.getName(`${s}_domain`),fields:[B(o),...$e(a)?[B(o,{binSuffix:"end"})]:[]],...$i(u)?{sortField:u}:F(u)?{sortIndexField:Fo(o,s)}:{}}}}this.childModel=n.child}hash(){let t="Facet";for(const n of en)this[n]&&(t+=` ${n.charAt(0)}:${se(this[n])}`);return t}get fields(){const t=[];for(const n of en)this[n]?.fields&&t.push(...this[n].fields);return t}dependentFields(){const t=new Set(this.fields);for(const n of en)this[n]&&(this[n].sortField&&t.add(this[n].sortField.field),this[n].sortIndexField&&t.add(this[n].sortIndexField));return t}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const t={};for(const n of Ii){const i=this.childModel.component.scales[n];if(i&&!i.merged){const r=i.get("type"),s=i.get("range");if(Le(r)&&Fs(s)){const o=ms(this.childModel,n),a=q1(o);a?t[n]=a:N(Uy(n))}}}return t}assembleRowColumnHeaderData(t,n,i){const r={row:"y",column:"x",facet:void 0}[t],s=[],o=[],a=[];r&&i&&i[r]&&(n?(s.push(`distinct_${i[r]}`),o.push("max")):(s.push(i[r]),o.push("distinct")),a.push(`distinct_${i[r]}`));const{sortField:u,sortIndexField:l}=this[t];if(u){const{op:c=Xf,field:f}=u;s.push(f),o.push(c),a.push(B(u,{forAs:!0}))}else l&&(s.push(l),o.push("max"),a.push(l));return{name:this[t].name,source:n??this.data,transform:[{type:"aggregate",groupby:this[t].fields,...s.length?{fields:s,ops:o,as:a}:{}}]}}assembleFacetHeaderData(t){const{columns:n}=this.model.layout,{layoutHeaders:i}=this.model.component,r=[],s={};for(const u of M1){for(const l of L1){const c=i[u]?.[l]??[];for(const f of c)if(f.axes?.length>0){s[u]=!0;break}}if(s[u]){const l=`length(data("${this.facet.name}"))`,c=u==="row"?n?{signal:`ceil(${l} / ${n})`}:1:n?{signal:`min(${l}, ${n})`}:{signal:l};r.push({name:`${this.facet.name}_${u}`,transform:[{type:"sequence",start:0,stop:c}]})}}const{row:o,column:a}=s;return(o||a)&&r.unshift(this.assembleRowColumnHeaderData("facet",null,t)),r}assemble(){const t=[];let n=null;const i=this.getChildIndependentFieldsWithStep(),{column:r,row:s,facet:o}=this;if(r&&s&&(i.x||i.y)){n=`cross_${this.column.name}_${this.row.name}`;const a=[].concat(i.x??[],i.y??[]),u=a.map(()=>"distinct");t.push({name:n,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:a,ops:u}]})}for(const a of[ki,Si])this[a]&&t.push(this.assembleRowColumnHeaderData(a,n,i));if(o){const a=this.assembleFacetHeaderData(i);a&&t.push(...a)}return t}}function mE(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function EX(e,t){const n=Dy(e);if(t==="number")return`toNumber(${n})`;if(t==="boolean")return`toBoolean(${n})`;if(t==="string")return`toString(${n})`;if(t==="date")return`toDate(${n})`;if(t==="flatten")return n;if(t.startsWith("date:")){const i=mE(t.slice(5,t.length));return`timeParse(${n},'${i}')`}else if(t.startsWith("utc:")){const i=mE(t.slice(4,t.length));return`utcParse(${n},'${i}')`}else return N(Yj(t)),null}function wX(e){const t={};return jl(e.filter,n=>{if(VC(n)){let i=null;Vy(n)?i=It(n.equal):Yy(n)?i=It(n.lte):Xy(n)?i=It(n.lt):Ky(n)?i=It(n.gt):Jy(n)?i=It(n.gte):Qy(n)?i=n.range[0]:Zy(n)&&(i=(n.oneOf??n.in)[0]),i&&(Os(i)?t[n.field]="date":de(i)?t[n.field]="number":j(i)&&(t[n.field]="string")),n.timeUnit&&(t[n.field]="date")}}),t}function SX(e){const t={};function n(i){ko(i)?t[i.field]="date":i.type==="quantitative"&&Sj(i.aggregate)?t[i.field]="number":yo(i.field)>1?i.field in t||(t[i.field]="flatten"):Rs(i)&&$i(i.sort)&&yo(i.sort.field)>1&&(i.sort.field in t||(t[i.sort.field]="flatten"))}if((Oe(e)||Gt(e))&&e.forEachFieldDef((i,r)=>{if($t(i))n(i);else{const s=As(r),o=e.fieldDef(s);n({...i,type:o.type})}}),Oe(e)){const{mark:i,markDef:r,encoding:s}=e;if(Or(i)&&!e.encoding.order){const o=r.orient==="horizontal"?"y":"x",a=s[o];M(a)&&a.type==="quantitative"&&!(a.field in t)&&(t[a.field]="number")}}return t}function kX(e){const t={};if(Oe(e)&&e.component.selection)for(const n of R(e.component.selection)){const i=e.component.selection[n];for(const r of i.project.items)!r.channel&&yo(r.field)>1&&(t[r.field]="flatten")}return t}class ht extends ve{_parse;clone(){return new ht(null,te(this._parse))}constructor(t,n){super(t),this._parse=n}hash(){return`Parse ${se(this._parse)}`}static makeExplicit(t,n,i){let r={};const s=n.data;return!ur(s)&&s?.format?.parse&&(r=s.format.parse),this.makeWithAncestors(t,r,{},i)}static makeWithAncestors(t,n,i,r){for(const a of R(i)){const u=r.getWithExplicit(a);u.value!==void 0&&(u.explicit||u.value===i[a]||u.value==="derived"||i[a]==="flatten"?delete i[a]:N(Av(a,i[a],u.value)))}for(const a of R(n)){const u=r.get(a);u!==void 0&&(u===n[a]?delete n[a]:N(Av(a,n[a],u)))}const s=new Bi(n,i);r.copyAll(s);const o={};for(const a of R(s.combine())){const u=s.get(a);u!==null&&(o[a]=u)}return R(o).length===0||r.parseNothing?null:new ht(t,o)}get parse(){return this._parse}merge(t){this._parse={...this._parse,...t.parse},t.remove()}assembleFormatParse(){const t={};for(const n of R(this._parse)){const i=this._parse[n];yo(n)===1&&(t[n]=i)}return t}producedFields(){return new Set(R(this._parse))}dependentFields(){return new Set(R(this._parse))}assembleTransforms(t=!1){return R(this._parse).filter(n=>t?yo(n)>1:!0).map(n=>{const i=EX(n,this._parse[n]);return i?{type:"formula",expr:i,as:Wo(n)}:null}).filter(n=>n!==null)}}class xr extends ve{clone(){return new xr(null)}constructor(t){super(t)}dependentFields(){return new Set}producedFields(){return new Set([Rn])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:Rn}}}class Hu extends ve{params;clone(){return new Hu(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${se(this.params)}`}assemble(){return{type:"graticule",...this.params===!0?{}:this.params}}}class Vu extends ve{params;clone(){return new Vu(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${se(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class gs extends ve{_data;_name;_generator;constructor(t){super(null),t??={name:"source"};let n;if(ur(t)||(n=t.format?{...Wt(t.format,["parse"])}:{}),ru(t))this._data={values:t.values};else if($o(t)){if(this._data={url:t.url},!n.type){let i=/(?:\.([^.]+))?$/.exec(t.url)[1];ae(["json","csv","tsv","dsv","topojson"],i)||(i="json"),n.type=i}}else cO(t)?this._data={values:[{type:"Sphere"}]}:(uO(t)||ur(t))&&(this._data={});this._generator=ur(t),t.name&&(this._name=t.name),n&&!Se(n)&&(this._data.format=n)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(t){this._name=t}set parent(t){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}function B1(e){return e instanceof gs||e instanceof Hu||e instanceof Vu}class U1{#e;constructor(){this.#e=!1}setModified(){this.#e=!0}get modifiedFlag(){return this.#e}}class _s extends U1{getNodeDepths(t,n,i){i.set(t,n);for(const r of t.children)this.getNodeDepths(r,n+1,i);return i}optimize(t){const i=[...this.getNodeDepths(t,0,new Map).entries()].sort((r,s)=>s[1]-r[1]);for(const r of i)this.run(r[0]);return this.modifiedFlag}}class j1 extends U1{optimize(t){this.run(t);for(const n of t.children)this.optimize(n);return this.modifiedFlag}}class $X extends j1{mergeNodes(t,n){const i=n.shift();for(const r of n)t.removeChild(r),r.parent=i,r.remove()}run(t){const n=t.children.map(r=>r.hash()),i={};for(let r=0;r1&&(this.setModified(),this.mergeNodes(t,i[r]))}}class AX extends j1{requiresSelectionId;constructor(t){super(),this.requiresSelectionId=t&&N1(t)}run(t){t instanceof xr&&(this.requiresSelectionId&&(B1(t.parent)||t.parent instanceof kn||t.parent instanceof ht)||(this.setModified(),t.remove()))}}class CX extends U1{optimize(t){return this.run(t,new Set),this.modifiedFlag}run(t,n){let i=new Set;t instanceof Kn&&(i=t.producedFields(),Fy(i,n)&&(this.setModified(),t.removeFormulas(n),t.producedFields.length===0&&t.remove()));for(const r of t.children)this.run(r,new Set([...n,...i]))}}class FX extends j1{constructor(){super()}run(t){t instanceof Ot&&!t.isRequired()&&(this.setModified(),t.remove())}}class OX extends _s{run(t){if(!B1(t)&&!(t.numChildren()>1)){for(const n of t.children)if(n instanceof ht)if(t instanceof ht)this.setModified(),t.merge(n);else{if(Oy(t.producedFields(),n.dependentFields()))continue;this.setModified(),n.swapWithParent()}}}}class DX extends _s{run(t){const n=[...t.children],i=t.children.filter(r=>r instanceof ht);if(t.numChildren()>1&&i.length>=1){const r={},s=new Set;for(const o of i){const a=o.parse;for(const u of R(a))u in r?r[u]!==a[u]&&s.add(u):r[u]=a[u]}for(const o of s)delete r[o];if(!Se(r)){this.setModified();const o=new ht(t,r);for(const a of n){if(a instanceof ht)for(const u of R(r))delete a.parse[u];t.removeChild(a),a.parent=o,a instanceof ht&&R(a.parse).length===0&&a.remove()}}}}}class RX extends _s{run(t){t instanceof Ot||t.numChildren()>0||t instanceof Yo||t instanceof gs||(this.setModified(),t.remove())}}class _X extends _s{run(t){const n=t.children.filter(r=>r instanceof Kn),i=n.pop();for(const r of n)this.setModified(),i.merge(r)}}class TX extends _s{run(t){const n=t.children.filter(r=>r instanceof kn),i={};for(const r of n){const s=se(r.groupBy);s in i||(i[s]=[]),i[s].push(r)}for(const r of R(i)){const s=i[r];if(s.length>1){const o=s.pop();for(const a of s)o.merge(a)&&(t.removeChild(a),a.parent=o,a.remove(),this.setModified())}}}}class NX extends _s{model;constructor(t){super(),this.model=t}run(t){const n=!(B1(t)||t instanceof Xo||t instanceof ht||t instanceof xr),i=[],r=[];for(const s of t.children)s instanceof Qn&&(n&&!Oy(t.producedFields(),s.dependentFields())?i.push(s):r.push(s));if(i.length>0){const s=i.pop();for(const o of i)s.merge(o,this.model.renameSignal.bind(this.model));this.setModified(),t instanceof Qn?t.merge(s,this.model.renameSignal.bind(this.model)):s.swapWithParent()}if(r.length>1){const s=r.pop();for(const o of r)s.merge(o,this.model.renameSignal.bind(this.model));this.setModified()}}}class MX extends _s{run(t){const n=[...t.children];if(!go(n,o=>o instanceof Ot)||t.numChildren()<=1)return;const r=[];let s;for(const o of n)if(o instanceof Ot){let a=o;for(;a.numChildren()===1;){const[u]=a.children;if(u instanceof Ot)a=u;else break}r.push(...a.children),s?(t.removeChild(o),o.parent=s.parent,s.parent.removeChild(s),s.parent=a,this.setModified()):s=a}else r.push(o);if(r.length){this.setModified();for(const o of r)o.parent.removeChild(o),o.parent=s}}}class Ts extends ve{transform;clone(){return new Ts(null,te(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=zt(this.transform.groupby.concat(t),n=>n)}dependentFields(){const t=new Set;return this.transform.groupby&&this.transform.groupby.forEach(t.add,t),this.transform.joinaggregate.map(n=>n.field).filter(n=>n!==void 0).forEach(t.add,t),t}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(t){return t.as??B(t)}hash(){return`JoinAggregateTransform ${se(this.transform)}`}assemble(){const t=[],n=[],i=[];for(const s of this.transform.joinaggregate)n.push(s.op),i.push(this.getDefaultName(s)),t.push(s.field===void 0?null:s.field);const r=this.transform.groupby;return{type:"joinaggregate",as:i,ops:n,fields:t,...r!==void 0?{groupby:r}:{}}}}class Do extends ve{filter;clone(){return new Do(null,{...this.filter})}constructor(t,n){super(t),this.filter=n}static make(t,n,i){const{config:r,markDef:s}=n,{marks:o,scales:a}=i;if(o==="include-invalid-values"&&a==="include-invalid-values")return null;const u=n.reduceFieldDef((l,c,f)=>{const d=hi(f)&&n.getScaleComponent(f);if(d){const p=d.get("type"),{aggregate:h}=c,g=a1({scaleChannel:f,markDef:s,config:r,scaleType:p,isCountAggregate:zf(h)});g!=="show"&&g!=="always-valid"&&(l[c.field]=c)}return l},{});return R(u).length?new Do(t,u):null}dependentFields(){return new Set(R(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${se(this.filter)}`}assemble(){const t=R(this.filter).reduce((n,i)=>{const r=this.filter[i],s=B(r,{expr:"datum"});return r!==null&&(r.type==="temporal"?n.push(`(isDate(${s}) || (${ig(s)}))`):r.type==="quantitative"&&n.push(ig(s))),n},[]);return t.length>0?{type:"filter",expr:t.join(" && ")}:null}}function ig(e){return`isValid(${e}) && isFinite(+${e})`}function LX(e){return e.stack.stackBy.reduce((t,n)=>{const i=n.fieldDef,r=B(i);return r&&t.push(r),t},[])}function PX(e){return F(e)&&e.every(t=>j(t))&&e.length>1}class Ci extends ve{_stack;clone(){return new Ci(null,te(this._stack))}constructor(t,n){super(t),this._stack=n}static makeFromTransform(t,n){const{stack:i,groupby:r,as:s,offset:o="zero"}=n,a=[],u=[];if(n.sort!==void 0)for(const f of n.sort)a.push(f.field),u.push(Pe(f.order,"ascending"));const l={field:a,order:u};let c;return PX(s)?c=s:j(s)?c=[s,`${s}_end`]:c=[`${n.stack}_start`,`${n.stack}_end`],new Ci(t,{dimensionFieldDefs:[],stackField:i,groupby:r,offset:o,sort:l,facetby:[],as:c})}static makeFromEncoding(t,n){const i=n.stack,{encoding:r}=n;if(!i)return null;const{groupbyChannels:s,fieldChannel:o,offset:a,impute:u}=i,l=s.map(p=>{const h=r[p];return Dn(h)}).filter(p=>!!p),c=LX(n),f=n.encoding.order;let d;if(F(f)||M(f))d=CC(f);else{const p=mF(f)?f.sort:o==="y"?"descending":"ascending";d=c.reduce((h,g)=>(h.field.includes(g)||(h.field.push(g),h.order.push(p)),h),{field:[],order:[]})}return new Ci(t,{dimensionFieldDefs:l,stackField:n.vgField(o),facetby:[],stackby:c,sort:d,offset:a,impute:u,as:[n.vgField(o,{suffix:"start",forAs:!0}),n.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(t){this._stack.facetby.push(...t)}dependentFields(){const t=new Set;return t.add(this._stack.stackField),this.getGroupbyFields().forEach(t.add,t),this._stack.facetby.forEach(t.add,t),this._stack.sort.field.forEach(t.add,t),t}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${se(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:t,impute:n,groupby:i}=this._stack;return t.length>0?t.map(r=>r.bin?n?[B(r,{binSuffix:"mid"})]:[B(r,{}),B(r,{binSuffix:"end"})]:[B(r)]).flat():i??[]}assemble(){const t=[],{facetby:n,dimensionFieldDefs:i,stackField:r,stackby:s,sort:o,offset:a,impute:u,as:l}=this._stack;if(u)for(const c of i){const{bandPosition:f=.5,bin:d}=c;if(d){const p=B(c,{expr:"datum"}),h=B(c,{expr:"datum",binSuffix:"end"});t.push({type:"formula",expr:`${ig(p)} ? ${f}*${p}+${1-f}*${h} : ${p}`,as:B(c,{binSuffix:"mid",forAs:!0})})}t.push({type:"impute",field:r,groupby:[...s,...n],key:B(c,{binSuffix:"mid"}),method:"value",value:0})}return t.push({type:"stack",groupby:[...this.getGroupbyFields(),...n],field:r,sort:o,as:l,offset:a}),t}}class Ko extends ve{transform;clone(){return new Ko(null,te(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=zt(this.transform.groupby.concat(t),n=>n)}dependentFields(){const t=new Set;return(this.transform.groupby??[]).forEach(t.add,t),(this.transform.sort??[]).forEach(n=>t.add(n.field)),this.transform.window.map(n=>n.field).filter(n=>n!==void 0).forEach(t.add,t),t}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(t){return t.as??B(t)}hash(){return`WindowTransform ${se(this.transform)}`}assemble(){const t=[],n=[],i=[],r=[];for(const f of this.transform.window)n.push(f.op),i.push(this.getDefaultName(f)),r.push(f.param===void 0?null:f.param),t.push(f.field===void 0?null:f.field);const s=this.transform.frame,o=this.transform.groupby;if(s&&s[0]===null&&s[1]===null&&n.every(f=>zy(f)))return{type:"joinaggregate",as:i,ops:n,fields:t,...o!==void 0?{groupby:o}:{}};const a=[],u=[];if(this.transform.sort!==void 0)for(const f of this.transform.sort)a.push(f.field),u.push(f.order??"ascending");const l={field:a,order:u},c=this.transform.ignorePeers;return{type:"window",params:r,as:i,ops:n,fields:t,sort:l,...c!==void 0?{ignorePeers:c}:{},...o!==void 0?{groupby:o}:{},...s!==void 0?{frame:s}:{}}}}function IX(e){function t(n){if(!(n instanceof Yo)){const i=n.clone();if(i instanceof Ot){const r=sg+i.getSource();i.setSource(r),e.model.component.data.outputNodes[r]=i}else(i instanceof kn||i instanceof Ci||i instanceof Ko||i instanceof Ts)&&i.addDimensions(e.fields);for(const r of n.children.flatMap(t))r.parent=i;return[i]}return n.children.flatMap(t)}return t}function rg(e){if(e instanceof Yo)if(e.numChildren()===1&&!(e.children[0]instanceof Ot)){const t=e.children[0];(t instanceof kn||t instanceof Ci||t instanceof Ko||t instanceof Ts)&&t.addDimensions(e.fields),t.swapWithParent(),rg(e)}else{const t=e.model.component.data.main;rD(t);const n=IX(e),i=e.children.map(n).flat();for(const r of i)r.parent=t}else e.children.map(rg)}function rD(e){if(e instanceof Ot&&e.type===Te.Main&&e.numChildren()===1){const t=e.children[0];t instanceof Yo||(t.swapWithParent(),rD(e))}}const sg="scale_",dl=5;function og(e){for(const t of e){for(const n of t.children)if(n.parent!==t)return!1;if(!og(t.children))return!1}return!0}function hn(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function yE(e,t,n){let i=e.sources,r=!1;return r=hn(new FX,i)||r,r=hn(new AX(t),i)||r,i=i.filter(s=>s.numChildren()>0),r=hn(new RX,i)||r,i=i.filter(s=>s.numChildren()>0),n||(r=hn(new OX,i)||r,r=hn(new NX(t),i)||r,r=hn(new CX,i)||r,r=hn(new DX,i)||r,r=hn(new TX,i)||r,r=hn(new _X,i)||r,r=hn(new $X,i)||r,r=hn(new MX,i)||r),e.sources=i,r}function zX(e,t){og(e.sources);let n=0,i=0;for(let r=0;rt(n))}}function sD(e){Oe(e)?BX(e):UX(e)}function BX(e){const t=e.component.scales;for(const n of R(t)){const i=qX(e,n);if(t[n].setWithExplicit("domains",i),GX(e,n),e.component.data.isFaceted){let s=e;for(;!Gt(s)&&s.parent;)s=s.parent;if(s.component.resolve.scale[n]==="shared")for(const a of i.value)wi(a)&&(a.data=sg+a.data.replace(sg,""))}}}function UX(e){for(const n of e.children)sD(n);const t=e.component.scales;for(const n of R(t)){let i,r=null;for(const s of e.children){const o=s.component.scales[n];if(o){i===void 0?i=o.getWithExplicit("domains"):i=br(i,o.getWithExplicit("domains"),"domains","scale",ag);const a=o.get("selectionExtent");r&&a&&r.param!==a.param&&N(jj),r=a}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}function jX(e,t,n,i){if(e==="unaggregated"){const{valid:r,reason:s}=bE(t,n);if(!r){N(s);return}}else if(e===void 0&&i.useUnaggregatedDomain){const{valid:r}=bE(t,n);if(r)return"unaggregated"}return e}function qX(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=jX(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:r}),t==="x"&&Ge(i.x2)?Ge(i.x)?br(Wi(n,r,e,"x"),Wi(n,r,e,"x2"),"domain","scale",ag):Wi(n,r,e,"x2"):t==="y"&&Ge(i.y2)?Ge(i.y)?br(Wi(n,r,e,"y"),Wi(n,r,e,"y2"),"domain","scale",ag):Wi(n,r,e,"y2"):Wi(n,r,e,t)}function WX(e,t,n){return e.map(i=>({signal:`{data: ${Qf(i,{timeUnit:n,type:t})}}`}))}function dh(e,t,n){const i=Qe(n)?.unit;return t==="temporal"||i?WX(e,t,i):[e]}function Wi(e,t,n,i){const{encoding:r,markDef:s,mark:o,config:a,stack:u}=n,l=Ge(r[i]),{type:c}=l,f=l.timeUnit,d=HH({invalid:ni("invalid",s,a),isPath:Or(o)});if(gW(t)){const g=Wi(e,void 0,n,i),m=dh(t.unionWith,c,f);return Gn([...m,...g.value])}else{if(Y(t))return Gn([t]);if(t&&t!=="unaggregated"&&!ZC(t))return Gn(dh(t,c,f))}if(u&&i===u.fieldChannel){if(u.offset==="normalize")return Pt([[0,1]]);const g=n.requestDataName(d);return Pt([{data:g,field:n.vgField(i,{suffix:"start"})},{data:g,field:n.vgField(i,{suffix:"end"})}])}const p=hi(i)&&M(l)?HX(n,i,e):void 0;if(pi(l)){const g=dh([l.datum],c,f);return Pt(g)}const h=l;if(t==="unaggregated"){const{field:g}=l;return Pt([{data:n.requestDataName(d),field:B({field:g,aggregate:"min"})},{data:n.requestDataName(d),field:B({field:g,aggregate:"max"})}])}else if($e(h.bin)){if(Le(e))return Pt(e==="bin-ordinal"?[]:[{data:mo(p)?n.requestDataName(d):n.requestDataName(Te.Raw),field:n.vgField(i,qu(h,i)?{binSuffix:"range"}:{}),sort:p===!0||!U(p)?{field:n.vgField(i,{}),op:"min"}:p}]);{const{bin:g}=h;if($e(g)){const m=z1(n,h.field,g);return Pt([new Xe(()=>{const y=n.getSignalName(m);return`[${y}.start, ${y}.stop]`})])}else return Pt([{data:n.requestDataName(d),field:n.vgField(i,{})}])}}else if(h.timeUnit&&ae(["time","utc"],e)){const g=r[di(i)];if(gF(h,g,s,a)){const m=n.requestDataName(d),y=yr({fieldDef:h,fieldDef2:g,markDef:s,config:a}),b=iu(o)&&y!==.5&&Ie(i);return Pt([{data:m,field:n.vgField(i,b?{suffix:rd}:{})},{data:m,field:n.vgField(i,{suffix:b?sd:"end"})}])}}return Pt(p?[{data:mo(p)?n.requestDataName(d):n.requestDataName(Te.Raw),field:n.vgField(i),sort:p}]:[{data:n.requestDataName(d),field:n.vgField(i)}])}function hh(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":Xf),...i?{field:un(i)}:{},...r?{order:r}:{}}}function GX(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t)?.bin,s=ZC(i)?i:void 0,o=Cs(r)&&Bf(r.extent)?r.extent:void 0;(s||o)&&n.set("selectionExtent",s??o,!0)}function HX(e,t,n){if(!Le(n))return;const i=e.fieldDef(t),r=i.sort;if(hF(r))return{op:"min",field:Fo(i,t),order:"ascending"};const{stack:s}=e,o=s?new Set([...s.groupbyFields,...s.stackBy.map(a=>a.fieldDef.field)]):void 0;if($i(r)){const a=s&&!o.has(r.field);return hh(r,a)}else if(HW(r)){const{encoding:a,order:u}=r,l=e.fieldDef(a),{aggregate:c,field:f}=l,d=s&&!o.has(f);if(Oi(c)||Fr(c))return hh({field:B(l),order:u},d);if(zy(c)||!c)return hh({op:c,field:f,order:u},d)}else{if(r==="descending")return{op:"min",field:e.vgField(t),order:"descending"};if(ae(["ascending",void 0],r))return!0}}function bE(e,t){const{aggregate:n,type:i}=e;return n?j(n)&&!$j.has(n)?{valid:!1,reason:yq(n)}:i==="quantitative"&&t==="log"?{valid:!1,reason:bq(e)}:{valid:!0}:{valid:!1,reason:mq(e)}}function ag(e,t,n,i){return e.explicit&&t.explicit&&N(Sq(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function VX(e){const t=zt(e.map(o=>{if(wi(o)){const{sort:a,...u}=o;return u}return o}),se),n=zt(e.map(o=>{if(wi(o)){const a=o.sort;return a!==void 0&&!mo(a)&&("op"in a&&a.op==="count"&&delete a.field,a.order==="ascending"&&delete a.order),a}}).filter(o=>o!==void 0),se);if(t.length===0)return;if(t.length===1){const o=e[0];if(wi(o)&&n.length>0){let a=n[0];if(n.length>1){N(Fv);const u=n.filter(l=>U(l)&&"op"in l&&l.op!=="min");n.every(l=>U(l)&&"op"in l)&&u.length===1?a=u[0]:a=!0}else if(U(a)&&"field"in a){const u=a.field;o.field===u&&(a=a.order?{order:a.order}:!0)}return{...o,sort:a}}return o}const i=zt(n.map(o=>mo(o)||!("op"in o)||j(o.op)&&G(Ej,o.op)?o:(N($q(o)),!0)),se);let r;i.length===1?r=i[0]:i.length>1&&(N(Fv),r=!0);const s=zt(e.map(o=>wi(o)?o.data:null),o=>o);return s.length===1&&s[0]!==null?{data:s[0],fields:t.map(a=>a.field),...r?{sort:r}:{}}:{fields:t,...r?{sort:r}:{}}}function q1(e){if(wi(e)&&j(e.field))return e.field;if(SC(e)){let t;for(const n of e.fields)if(wi(n)&&j(n.field)){if(!t)t=n.field;else if(t!==n.field)return N(Aq),t}return N(Cq),t}else if(Aj(e)){N(Fq);const t=e.fields[0];return j(t)?t:void 0}}function ms(e,t){const i=e.component.scales[t].get("domains").map(r=>(wi(r)&&(r.data=e.lookupDataSource(r.data)),r));return VX(i)}function XX(e,t,n,i){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=i}function oD(e,t){if(Oe(e)){const i=e.fieldDef(t);if(i?.field)return i.field}const n=(e.children??[]).map(i=>oD(i,t)).filter(i=>!!i);if(n.length>0){const i=zt(n,se);return i.length===1?i[0]:void 0}}function YX(e,t,n){if(t===n)return!0;const i=e.getScaleType(t),r=e.getScaleType(n);if(!i||!r)return!1;const s=Le(i),o=Le(r);return s===o}function KX(e,t){return e?`field:${e}`:`channel:${String(t)}`}function JX(e){if(F(e)){const t=e.filter(xc);return t.length>0?t:null}if(SC(e)){const t=[];if(t.push(...e.fields.flatMap(n=>F(n)?n.filter(xc):[])),t.length>0)return zt(t,se)}return null}function ug(e,t){try{const n=ms(e,t);return JX(n)}catch{return null}}function QX(e,t,n){const i=ug(e,t),r=ug(e,n);return i&&r?zt([...i,...r],se):null}function xE(e,t,n){t&&t.length>0&&(e.getWithExplicit("values")?.explicit||(n&&N(n),e.set("values",t,!1)))}function ZX(e,t,n){const i=e.getScaleComponent(t),r=e.getScaleComponent(n);if(!i||!r)return!1;const s=i.getWithExplicit("domains"),o=r.getWithExplicit("domains");if(!(s?.explicit&&o?.explicit))return!1;const a=ms(e,t),u=ms(e,n);return se(a)===se(u)}function aD(e){const t=e.component.legends,n={};for(const r of R(t)){const s=oD(e,r),o=KX(s,r);if(!n[o]){n[o]=[{channel:r,cmpt:t[r].clone()}];continue}let a=!1;for(const u of n[o]){if(!YX(e,u.channel,r))continue;if(nD(u.cmpt,t[r])){const c=e.getScaleType(u.channel),f=e.getScaleType(r);c&&f&&Le(c)&&Le(f)&&(ZX(e,u.channel,r)?xE(u.cmpt,ug(e,u.channel)):xE(u.cmpt,QX(e,u.channel,r),Oq(u.channel,r))),a=!0;break}}a||n[o].push({channel:r,cmpt:t[r].clone()})}return Be(n).flat().map(r=>eY(r.cmpt,e.config)).filter(r=>r!==void 0)}function eY(e,t){const{disable:n,labelExpr:i,selections:r,...s}=e.combine();if(!n){if(t.aria===!1&&s.aria==null&&(s.aria=!1),s.encode?.symbols){const o=s.encode.symbols.update;o.fill&&o.fill.value!=="transparent"&&!o.stroke&&!s.stroke&&(o.stroke={value:"transparent"});for(const a of GF)s[a]&&delete o[a]}if(s.title||delete s.title,i!==void 0){let o=i;s.encode?.labels?.update&&Y(s.encode.labels.update.text)&&(o=os(i,"datum.label",s.encode.labels.update.text.signal)),XX(s,"labels","text",{signal:o})}return s}}function tY(e){return Jo(e)||W1(e)?nY(e):uD(e)}function nY(e){return e.children.reduce((t,n)=>t.concat(n.assembleProjections()),uD(e))}function uD(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map(o=>o.signal).join(", ")}]`},s=t.data.reduce((o,a)=>{const u=Y(a)?a.signal:`data('${e.lookupDataSource(a)}')`;return ae(o,u)||o.push(u),o},[]);if(s.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:s.length>1?`[${s.join(", ")}]`:s[0]},...n}]}else return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const iY=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class lD extends Bi{specifiedProjection;size;data;merged=!1;constructor(t,n,i,r){super({...n},{name:t}),this.specifiedProjection=n,this.size=i,this.data=r}get isFit(){return!!this.data}}function cD(e){e.component.projection=Oe(e)?rY(e):aY(e)}function rY(e){if(e.hasProjection){const t=tt(e.specifiedProjection),n=!(t&&(t.scale!=null||t.translate!=null)),i=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=n?sY(e):void 0,s=new lD(e.projectionName(!0),{...tt(e.config.projection),...t},i,r);return s.get("type")||s.set("type","equalEarth",!1),s}}function sY(e){const t=[],{encoding:n}=e;for(const i of[[In,Pn],[ln,zn]])(Ge(n[i[0]])||Ge(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(Tt)&&e.typedFieldDef(Tt).type===Ho&&t.push({signal:e.getName(`geojson_${t.length}`)}),t.length===0&&t.push(e.requestDataName(Te.Main)),t}function oY(e,t){const n=Cy(iY,r=>!!(!G(e.explicit,r)&&!G(t.explicit,r)||G(e.explicit,r)&&G(t.explicit,r)&&Bt(e.get(r),t.get(r))));if(Bt(e.size,t.size)){if(n)return e;if(Bt(e.explicit,{}))return t;if(Bt(t.explicit,{}))return e}return null}function aY(e){if(e.children.length===0)return;let t;for(const i of e.children)cD(i);const n=Cy(e.children,i=>{const r=i.component.projection;if(r)if(t){const s=oY(t,r);return s&&(t=s),!!s}else return t=r,!0;else return!0});if(t&&n){const i=e.projectionName(!0),r=new lD(i,t.specifiedProjection,t.size,te(t.data));for(const s of e.children){const o=s.component.projection;o&&(o.isFit&&r.data.push(...s.component.projection.data),s.renameProjection(o.get("name"),i),o.merged=!0)}return r}}function fD(e){return Jo(e)||W1(e)?e.children.reduce((t,n)=>t.concat(fD(n)),vE(e)):vE(e)}function vE(e){return R(e.component.scales).reduce((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:s,type:o,selectionExtent:a,domains:u,range:l,reverse:c,...f}=r,d=uY(r.range,s,n,e),p=ms(e,n),h=a?iV(e,a,i,p):null;return t.push({name:s,type:o,...p?{domain:p}:{},...h?{domainRaw:h}:{},range:d,...c!==void 0?{reverse:c}:{},...f}),t},[])}function uY(e,t,n,i){if(Ie(n)){if(Fs(e))return{step:{signal:`${t}_step`}}}else if(U(e)&&wi(e))return{...e,data:i.lookupDataSource(e.data)};return e}class dD extends Bi{merged=!1;constructor(t,n){super({},{name:t}),this.setWithExplicit("type",n)}domainHasZero(){const t=this.get("type");if(ae([nt.LOG,nt.TIME,nt.UTC],t))return"definitely-not";const n=this.get("zero");if(n===!0||n===void 0&&ae([nt.LINEAR,nt.SQRT,nt.POW],t))return"definitely";const i=this.get("domains");if(i.length>0){let r=!1,s=!1,o=!1;for(const a of i){if(F(a)){const u=a[0],l=a[a.length-1];if(de(u)&&de(l))if(u<=0&&l>=0){r=!0;continue}else{s=!0;continue}}o=!0}if(r)return"definitely";if(s&&!o)return"definitely-not"}return"maybe"}}const lY=["range","scheme"];function cY(e){const t=e.component.scales;for(const n of Iy){const i=t[n];if(!i)continue;const r=fY(n,e);i.setWithExplicit("range",r)}}function EE(e,t){const n=e.fieldDef(t);if(n?.bin){const{bin:i,field:r}=n,s=Nt(t),o=e.getName(s);if(U(i)&&i.binned&&i.step!==void 0)return new Xe(()=>{const a=e.scaleName(t),u=`(domain("${a}")[1] - domain("${a}")[0]) / ${i.step}`;return`${e.getSignalName(o)} / (${u})`});if($e(i)){const a=z1(e,r,i);return new Xe(()=>{const u=e.getSignalName(a),l=`(${u}.stop - ${u}.start) / ${u}.step`;return`${e.getSignalName(o)} / (${l})`})}}}function fY(e,t){const n=t.specifiedScales[e],{size:i}=t,s=t.getScaleComponent(e).get("type");for(const f of lY)if(n[f]!==void 0){const d=Up(s,f),p=eF(e,f);if(!d)N(NC(s,f,e));else if(p)N(p);else switch(f){case"range":{const h=n.range;if(F(h)){if(Ie(e))return Gn(h.map(g=>{if(g==="width"||g==="height"){const m=t.getName(g),y=t.getSignalName.bind(t);return Xe.fromName(y,m)}return g}))}else if(U(h))return Gn({data:t.requestDataName(Te.Main),field:h.field,sort:{op:"min",field:t.vgField(e)}});return Gn(h)}case"scheme":return Gn(dY(n[f]))}}const o=e===Re||e==="xOffset"?"width":"height",a=i[o];if(ri(a)){if(Ie(e))if(Le(s)){const f=pD(a,t,e);if(f)return Gn({step:f})}else N(MC(o));else if(Lu(e)){const f=e===wr?"x":"y";if(t.getScaleComponent(f).get("type")==="band"){const h=gD(a,s);if(h)return Gn(h)}}}const{rangeMin:u,rangeMax:l}=n,c=hY(e,t);return(u!==void 0||l!==void 0)&&Up(s,"rangeMin")&&F(c)&&c.length===2?Gn([u??c[0],l??c[1]]):Pt(c)}function dY(e){return pW(e)?{scheme:e.name,...Wt(e,["name"])}:{scheme:e}}function hD(e,t,n,{center:i}={}){const r=Nt(e),s=t.getName(r),o=t.getSignalName.bind(t);return e===Ze&&Fn(n)?i?[Xe.fromName(a=>`${o(a)}/2`,s),Xe.fromName(a=>`-${o(a)}/2`,s)]:[Xe.fromName(o,s),0]:i?[Xe.fromName(a=>`-${o(a)}/2`,s),Xe.fromName(a=>`${o(a)}/2`,s)]:[0,Xe.fromName(o,s)]}function hY(e,t){const{size:n,config:i,mark:r,encoding:s}=t,{type:o}=Ge(s[e]),u=t.getScaleComponent(e).get("type"),{domain:l,domainMid:c}=t.specifiedScales[e];switch(e){case Re:case Ze:{if(ae(["point","band"],u)){const f=mD(e,n,i.view);if(ri(f))return{step:pD(f,t,e)}}return hD(e,t,u)}case wr:case Go:return pY(e,t,u);case Li:{const f=yY(r,i),d=bY(r,n,t,i);return vo(u)?mY(f,d,gY(u,i,l,e)):[f,d]}case fn:return[0,Math.PI*2];case $s:return[0,360];case Ln:return[0,new Xe(()=>{const f=t.getSignalName(Gt(t.parent)?"child_width":"width"),d=t.getSignalName(Gt(t.parent)?"child_height":"height");return`min(${f},${d})/2`})];case Sr:return{step:1e3/i.scale.framesPerSecond};case Ar:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case Cr:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case Tt:return"symbol";case _t:case ci:case fi:return u==="ordinal"?o==="nominal"?"category":"ordinal":c!==void 0?"diverging":r==="rect"||r==="geoshape"?"heatmap":"ramp";case Pi:case kr:case $r:return[i.scale.minOpacity,i.scale.maxOpacity]}}function pD(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),s=Ny(n),o=i[s];if(VF({step:e,offsetIsDiscrete:ne(o)&&e1(o.type)})==="offset"&&CF(i,s)){const u=t.getScaleComponent(s);let c=`domain('${t.scaleName(s)}').length`;if(u.get("type")==="band"){const d=u.get("paddingInner")??u.get("padding")??0,p=u.get("paddingOuter")??u.get("padding")??0;c=`bandspace(${c}, ${d}, ${p})`}const f=r.get("paddingInner")??r.get("padding");return{signal:`${e.step} * ${c} / (1-${Rj(f)})`}}else return e.step}function gD(e,t){if(VF({step:e,offsetIsDiscrete:Le(t)})==="offset")return{step:e.step}}function pY(e,t,n){const i=e===wr?"x":"y",r=t.getScaleComponent(i);if(!r)return hD(i,t,n,{center:!0});const s=r.get("type"),o=t.scaleName(i),{markDef:a,config:u}=t;if(s==="band"){const l=mD(i,t.size,t.config.view);if(ri(l)){const c=gD(l,n);if(c)return c}return[0,{signal:`bandwidth('${o}')`}]}else{const l=t.encoding[i];if(M(l)&&l.timeUnit){const c=GC(l.timeUnit,h=>`scale('${o}', ${h})`),f=t.config.scale.bandWithNestedOffsetPaddingInner,d=yr({fieldDef:l,markDef:a,config:u})-.5,p=d!==0?` + ${d}`:"";if(f){const h=Y(f)?`${f.signal}/2${p}`:`${f/2+d}`,g=Y(f)?`(1 - ${f.signal}/2)${p}`:`${1-f/2+d}`;return[{signal:`${h} * (${c})`},{signal:`${g} * (${c})`}]}return[0,{signal:c}]}return eC(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}function mD(e,t,n){const i=e===Re?"width":"height",r=t[i];return r!==void 0?r:Fc(n,i)}function gY(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return n!==void 0&&F(n)?n.length+1:(N(Iq(i)),3)}}function mY(e,t,n){const i=()=>{const r=En(t),s=En(e),o=`(${r} - ${s}) / (${n} - 1)`;return`sequence(${s}, ${r} + ${o}, ${o})`};return Y(t)?new Xe(i):{signal:i()}}function yY(e,t){switch(e){case"bar":case"tick":return t.scale.minBandSize;case"line":case"trail":case"rule":return t.scale.minStrokeWidth;case"text":return t.scale.minFontSize;case"point":case"square":case"circle":return t.scale.minSize}throw new Error(Uf("size",e))}const wE=.95;function bY(e,t,n,i){const r={x:EE(n,"x"),y:EE(n,"y")};switch(e){case"bar":case"tick":{if(i.scale.maxBandSize!==void 0)return i.scale.maxBandSize;const s=SE(t,r,i.view);return de(s)?s-1:new Xe(()=>`${s.signal} - 1`)}case"line":case"trail":case"rule":return i.scale.maxStrokeWidth;case"text":return i.scale.maxFontSize;case"point":case"square":case"circle":{if(i.scale.maxSize)return i.scale.maxSize;const s=SE(t,r,i.view);return de(s)?Math.pow(wE*s,2):new Xe(()=>`pow(${wE} * ${s.signal}, 2)`)}}throw new Error(Uf("size",e))}function SE(e,t,n){const i=ri(e.width)?e.width.step:Gp(n,"width"),r=ri(e.height)?e.height.step:Gp(n,"height");return t.x||t.y?new Xe(()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`):Math.min(i,r)}function yD(e,t){Oe(e)?xY(e,t):xD(e,t)}function xY(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:s,specifiedScales:o}=e;for(const a of R(n)){const u=o[a],l=n[a],c=e.getScaleComponent(a),f=Ge(r[a]),d=u[t],p=c.get("type"),h=c.get("padding"),g=c.get("paddingInner"),m=Up(p,t),y=eF(a,t);if(d!==void 0&&(m?y&&N(y):N(NC(p,t,a))),m&&y===void 0)if(d!==void 0){const b=f.timeUnit,v=f.type;switch(t){case"domainMax":case"domainMin":Os(u[t])||v==="temporal"||b?l.set(t,{signal:Qf(u[t],{type:v,timeUnit:b})},!0):l.set(t,u[t],!0);break;default:l.copyKeyFromObject(t,u)}}else{const b=_(kE,t)?kE[t]({model:e,channel:a,fieldOrDatumDef:f,scaleType:p,scalePadding:h,scalePaddingInner:g,domain:u.domain,domainMin:u.domainMin,domainMax:u.domainMax,markDef:s,config:i,hasNestedOffsetScale:FF(r,a),hasSecondaryRangeChannel:!!r[di(a)]}):i.scale[t];b!==void 0&&l.set(t,b,!1)}}}const kE={bins:({model:e,fieldOrDatumDef:t})=>M(t)?vY(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>EY(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:i,domainMax:r,fieldOrDatumDef:s})=>wY(e,t,n,i,r,s),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>SY(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:i,config:r,hasNestedOffsetScale:s})=>kY(e,t,n.type,i,r.scale,s),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:i,config:r,hasNestedOffsetScale:s})=>$Y(e,t,n,i,r.scale,s),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>{const r=M(e)?e.sort:void 0;return AY(t,r,n,i.scale)},zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:i,scaleType:r,config:s,hasSecondaryRangeChannel:o})=>CY(e,t,n,i,r,s.scale,o)};function bD(e){Oe(e)?cY(e):xD(e,"range")}function xD(e,t){const n=e.component.scales;for(const i of e.children)t==="range"?bD(i):yD(i,t);for(const i of R(n)){let r;for(const s of e.children){const o=s.component.scales[i];if(o){const a=o.getWithExplicit(t);r=br(r,a,t,"scale",aO((u,l)=>t==="range"&&u.step&&l.step?u.step-l.step:0))}}n[i].setWithExplicit(t,r)}}function vY(e,t){const n=t.bin;if($e(n)){const i=z1(e,t.field,n);return new Xe(()=>e.getSignalName(i))}else if(et(n)&&Cs(n)&&n.step!==void 0)return{step:n.step}}function EY(e,t){if(ae([_t,ci,fi],e)&&t!=="nominal")return"hcl"}function wY(e,t,n,i,r,s){if(!(Dn(s)?.bin||F(n)||r!=null||i!=null||ae([nt.TIME,nt.UTC],e)))return Ie(t)?!0:void 0}function SY(e,t,n,i,r,s){if(Ie(e)){if(Xn(t)){if(n.continuousPadding!==void 0)return n.continuousPadding;const{type:o,orient:a}=r;if(o==="bar"&&!(M(i)&&(i.bin||i.timeUnit))&&(a==="vertical"&&e==="x"||a==="horizontal"&&e==="y"))return s.continuousBandSize}if(t===nt.POINT)return n.pointPadding}}function kY(e,t,n,i,r,s=!1){if(e===void 0){if(Ie(t)){const{bandPaddingInner:o,barBandPaddingInner:a,rectBandPaddingInner:u,tickBandPaddingInner:l,bandWithNestedOffsetPaddingInner:c}=r;return s?c:Pe(o,n==="bar"?a:n==="tick"?l:u)}else if(Lu(t)&&i===nt.BAND)return r.offsetBandPaddingInner}}function $Y(e,t,n,i,r,s=!1){if(e===void 0){if(Ie(t)){const{bandPaddingOuter:o,bandWithNestedOffsetPaddingOuter:a}=r;if(s)return a;if(n===nt.BAND)return Pe(o,Y(i)?{signal:`${i.signal}/2`}:i/2)}else if(Lu(t)){if(n===nt.POINT)return .5;if(n===nt.BAND)return r.offsetBandPaddingOuter}}}function AY(e,t,n,i){if(n==="x"&&i.xReverse!==void 0)return Fn(e)&&t==="descending"?Y(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse;if(Fn(e)&&t==="descending")return!0}function CY(e,t,n,i,r,s,o){if(!!n&&n!=="unaggregated"&&Fn(r)){if(F(n)){const u=n[0],l=n[n.length-1];if(de(u)&&u<=0&&de(l)&&l>=0)return!0}return!1}if(e==="size"&&t.type==="quantitative"&&!vo(r))return!0;if(!(M(t)&&t.bin)&&ae([...Ii,...dj],e)){const{orient:u,type:l}=i;return ae(["bar","area","line","trail"],l)&&(u==="horizontal"&&e==="y"||u==="vertical"&&e==="x")?!1:ae(["bar","area"],l)&&!o?!0:s?.zero}return!1}function FY(e,t,n,i,r=!1){const s=OY(t,n,i,r),{type:o}=e;return hi(t)?o!==void 0?EW(t,o)?M(n)&&!vW(o,n.type)?(N(Eq(o,s)),s):o:(N(vq(t,o,s)),s):s:null}function OY(e,t,n,i){switch(t.type){case"nominal":case"ordinal":{if(Zs(e)||th(e)==="discrete")return e==="shape"&&t.type==="ordinal"&&N(nh(e,"ordinal")),"ordinal";if(eh(e))return"band";if(Ie(e)||Lu(e)){if(ae(["rect","bar","image","rule","tick"],n.type)||i)return"band"}else if(n.type==="arc"&&e in Py)return"band";const r=n[Nt(e)];return fs(r)||wo(t)&&t.axis?.tickBand?"band":"point"}case"temporal":return Zs(e)?"time":th(e)==="discrete"?(N(nh(e,"temporal")),"ordinal"):M(t)&&t.timeUnit&&Qe(t.timeUnit).utc?"utc":eh(e)?"band":"time";case"quantitative":return Zs(e)?M(t)&&$e(t.bin)?"bin-ordinal":"linear":th(e)==="discrete"?(N(nh(e,"quantitative")),"ordinal"):eh(e)?"band":"linear";case"geojson":return}throw new Error(_C(t.type))}function DY(e,{ignoreRange:t}={}){vD(e),sD(e);for(const n of xW)yD(e,n);t||bD(e)}function vD(e){Oe(e)?e.component.scales=RY(e):e.component.scales=TY(e)}function RY(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const s of Iy){const o=Ge(t[s]);if(o&&n===iF&&s===Tt&&o.type===Ho)continue;let a=o&&o.scale;if(o&&a!==null&&a!==!1){a??={};const u=FF(t,s),l=FY(a,s,o,i,u);r[s]=new dD(e.scaleName(`${s}`,!0),{value:l,explicit:a.type===l})}}return r}const _Y=aO((e,t)=>Dv(e)-Dv(t));function TY(e){const t=e.component.scales={},n={},i=e.component.resolve;for(const r of e.children){vD(r);for(const s of R(r.component.scales))if(i.scale[s]??=KO(s,e),i.scale[s]==="shared"){const o=n[s],a=r.component.scales[s].getWithExplicit("type");o?lW(o.value,a.value)?n[s]=br(o,a,"type","scale",_Y):(i.scale[s]="independent",delete n[s]):n[s]=a}}for(const r of R(n)){const s=e.scaleName(r,!0),o=n[r];t[r]=new dD(s,o);for(const a of e.children){const u=a.component.scales[r];u&&(a.renameScale(u.get("name"),s),u.merged=!0)}}return t}class ph{nameMap;constructor(){this.nameMap={}}rename(t,n){this.nameMap[t]=n}has(t){return this.nameMap[t]!==void 0}get(t){for(;this.nameMap[t]&&t!==this.nameMap[t];)t=this.nameMap[t];return t}}function Oe(e){return e?.type==="unit"}function Gt(e){return e?.type==="facet"}function W1(e){return e?.type==="concat"}function Jo(e){return e?.type==="layer"}class G1{type;parent;config;name;size;title;description;data;transforms;layout;scaleNameMap;projectionNameMap;signalNameMap;component;view;constructor(t,n,i,r,s,o,a){this.type=n,this.parent=i,this.config=s,this.parent=i,this.config=s,this.view=tt(a),this.name=t.name??r,this.title=Xi(t.title)?{text:t.title}:t.title?tt(t.title):void 0,this.scaleNameMap=i?i.scaleNameMap:new ph,this.projectionNameMap=i?i.projectionNameMap:new ph,this.signalNameMap=i?i.signalNameMap:new ph,this.data=t.data,this.description=t.description,this.transforms=NH(t.transform??[]),this.layout=n==="layer"||n==="unit"?{}:IG(t,n,s),this.component={data:{sources:i?i.component.data.sources:[],outputNodes:i?i.component.data.outputNodes:{},outputNodeRefCounts:i?i.component.data.outputNodeRefCounts:{},isFaceted:Yf(t)||i?.component.data.isFaceted&&t.data===void 0},layoutSize:new Bi,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?te(o):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){DY(this)}parseProjection(){cD(this)}renameTopLevelLayoutSizeSignal(){this.getName("width")!=="width"&&this.renameSignal(this.getName("width"),"width"),this.getName("height")!=="height"&&this.renameSignal(this.getName("height"),"height")}parseLegends(){tD(this)}assembleEncodeFromView(t){const{style:n,...i}=t,r={};for(const s of R(i)){const o=i[s];o!==void 0&&(r[s]=Ce(o))}return r}assembleGroupEncodeEntry(t){let n={};return this.view&&(n=this.assembleEncodeFromView(this.view)),!t&&(this.description&&(n.description=Ce(this.description)),this.type==="unit"||this.type==="layer")?{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...n}:Se(n)?void 0:n}assembleLayout(){if(!this.layout)return;const{spacing:t,...n}=this.layout,{component:i,config:r}=this,s=YV(i.layoutHeaders,r);return{padding:t,...this.assembleDefaultLayout(),...n,...s?{titleBand:s}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:t}=this.component;let n=[];for(const i of en)t[i].title&&n.push(qV(this,i));for(const i of M1)n=n.concat(WV(this,i));return n}assembleAxes(){return DV(this.component.axes,this.config)}assembleLegends(){return aD(this)}assembleProjections(){return tY(this)}assembleTitle(){const{encoding:t,...n}=this.title??{},i={...wC(this.config.title).nonMarkTitleProperties,...n,...t?{encode:{update:t}}:{}};if(i.text)return ae(["unit","layer"],this.type)?ae(["middle",void 0],i.anchor)&&(i.frame??="group"):i.anchor??="start",Se(i)?void 0:i}assembleGroup(t=[]){const n={};t=t.concat(this.assembleSignals()),t.length>0&&(n.signals=t);const i=this.assembleLayout();i&&(n.layout=i),n.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const r=!this.parent||Gt(this.parent)?fD(this):[];r.length>0&&(n.scales=r);const s=this.assembleAxes();s.length>0&&(n.axes=s);const o=this.assembleLegends();return o.length>0&&(n.legends=o),n}getName(t){return De((this.name?`${this.name}_`:"")+t)}getDataName(t){return this.getName(Te[t].toLowerCase())}requestDataName(t){const n=this.getDataName(t),i=this.component.data.outputNodeRefCounts;return i[n]=(i[n]||0)+1,n}getSizeSignalRef(t){if(Gt(this.parent)){const n=XO(t),i=If(n),r=this.component.scales[i];if(r&&!r.merged){const s=r.get("type"),o=r.get("range");if(Le(s)&&Fs(o)){const a=r.get("name"),u=ms(this,i),l=q1(u);if(l){const c=B({aggregate:"distinct",field:l},{expr:"datum"});return{signal:VO(a,r,c)}}else return N(Uy(i)),null}}}return{signal:this.signalNameMap.get(this.getName(t))}}lookupDataSource(t){const n=this.component.data.outputNodes[t];return n?n.getSource():t}getSignalName(t){return this.signalNameMap.get(t)}renameSignal(t,n){this.signalNameMap.rename(t,n)}renameScale(t,n){this.scaleNameMap.rename(t,n)}renameProjection(t,n){this.projectionNameMap.rename(t,n)}scaleName(t,n){if(n)return this.getName(t);if(pC(t)&&hi(t)&&this.component.scales[t]||this.scaleNameMap.has(this.getName(t)))return this.scaleNameMap.get(this.getName(t))}projectionName(t){if(t)return this.getName("projection");if(this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection")))return this.projectionNameMap.get(this.getName("projection"))}getScaleComponent(t){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const n=this.component.scales[t];return n&&!n.merged?n:this.parent?this.parent.getScaleComponent(t):void 0}getScaleType(t){const n=this.getScaleComponent(t);return n?n.get("type"):void 0}getSelectionComponent(t,n){let i=this.component.selection[t];if(!i&&this.parent&&(i=this.parent.getSelectionComponent(t,n)),!i)throw new Error(Lj(n));return i}hasAxisOrientSignalRef(){return this.component.axes.x?.some(t=>t.hasOrientSignalRef())||this.component.axes.y?.some(t=>t.hasOrientSignalRef())}}class ED extends G1{vgField(t,n={}){const i=this.fieldDef(t);if(i)return B(i,n)}reduceFieldDef(t,n){return hG(this.getMapping(),(i,r,s)=>{const o=Dn(r);return o?t(i,o,s):i},n)}forEachFieldDef(t,n){m1(this.getMapping(),(i,r)=>{const s=Dn(i);s&&t(s,r)},n)}}class ld extends ve{transform;clone(){return new ld(null,te(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=te(n);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??"value",i[1]??"density"];const r=this.transform.resolve??"shared";this.transform.resolve=r}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${se(this.transform)}`}assemble(){const{density:t,...n}=this.transform,i={type:"kde",field:t,...n};return i.resolve=this.transform.resolve,i}}class cd extends ve{transform;clone(){return new cd(null,te(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=te(n)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${se(this.transform)}`}assemble(){const{extent:t,param:n}=this.transform;return{type:"extent",field:t,signal:n}}}class fd extends ve{transform;clone(){return new fd(this.parent,te(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=te(n);const{flatten:i,as:r=[]}=this.transform;this.transform.as=i.map((s,o)=>r[o]??s)}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${se(this.transform)}`}assemble(){const{flatten:t,as:n}=this.transform;return{type:"flatten",fields:t,as:n}}}class dd extends ve{transform;clone(){return new dd(null,te(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=te(n);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??"key",i[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${se(this.transform)}`}assemble(){const{fold:t,as:n}=this.transform;return{type:"fold",fields:t,as:n}}}class no extends ve{fields;geojson;signal;clone(){return new no(null,te(this.fields),this.geojson,this.signal)}static parseAll(t,n){if(n.component.projection&&!n.component.projection.isFit)return t;let i=0;for(const r of[[In,Pn],[ln,zn]]){const s=r.map(o=>{const a=Ge(n.encoding[o]);return M(a)?a.field:pi(a)?{expr:`${a.datum}`}:On(a)?{expr:`${a.value}`}:void 0});(s[0]||s[1])&&(t=new no(t,s,null,n.getName(`geojson_${i++}`)))}if(n.channelHasField(Tt)){const r=n.typedFieldDef(Tt);r.type===Ho&&(t=new no(t,null,r.field,n.getName(`geojson_${i++}`)))}return t}constructor(t,n,i,r){super(t),this.fields=n,this.geojson=i,this.signal=r}dependentFields(){const t=(this.fields??[]).filter(j);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${se(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class su extends ve{projection;fields;as;clone(){return new su(null,this.projection,te(this.fields),te(this.as))}constructor(t,n,i,r){super(t),this.projection=n,this.fields=i,this.as=r}static parseAll(t,n){if(!n.projectionName())return t;for(const i of[[In,Pn],[ln,zn]]){const r=i.map(o=>{const a=Ge(n.encoding[o]);return M(a)?a.field:pi(a)?{expr:`${a.datum}`}:On(a)?{expr:`${a.value}`}:void 0}),s=i[0]===ln?"2":"";(r[0]||r[1])&&(t=new su(t,n.projectionName(),r,[n.getName(`x${s}`),n.getName(`y${s}`)]))}return t}dependentFields(){return new Set(this.fields.filter(j))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${se(this.fields)} ${se(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Jr extends ve{transform;clone(){return new Jr(null,te(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(t){const{start:n=0,stop:i,step:r}=t;return{signal:`sequence(${[n,i,...r?[r]:[]].join(",")})`}}static makeFromTransform(t,n){return new Jr(t,n)}static makeFromEncoding(t,n){const i=n.encoding,r=i.x,s=i.y;if(M(r)&&M(s)){const o=r.impute?r:s.impute?s:void 0;if(o===void 0)return;const a=r.impute?s:s.impute?r:void 0,{method:u,value:l,frame:c,keyvals:f}=o.impute,d=RF(n.mark,i);return new Jr(t,{impute:o.field,key:a.field,...u?{method:u}:{},...l!==void 0?{value:l}:{},...c?{frame:c}:{},...f!==void 0?{keyvals:f}:{},...d.length?{groupby:d}:{}})}return null}hash(){return`Impute ${se(this.transform)}`}assemble(){const{impute:t,key:n,keyvals:i,method:r,groupby:s,value:o,frame:a=[null,null]}=this.transform,u={type:"impute",field:t,key:n,...i?{keyvals:gH(i)?this.processSequence(i):i}:{},method:"value",...s?{groupby:s}:{},value:!r||r==="value"?o:null};if(r&&r!=="value"){const l={type:"window",as:[`imputed_${t}_value`],ops:[r],fields:[t],frame:a,ignorePeers:!1,...s?{groupby:s}:{}},c={type:"formula",expr:`datum.${t} === null ? datum.imputed_${t}_value : datum.${t}`,as:t};return[u,l,c]}else return[u]}}class hd extends ve{transform;clone(){return new hd(null,te(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=te(n);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??n.on,i[1]??n.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${se(this.transform)}`}assemble(){const{loess:t,on:n,...i}=this.transform;return{type:"loess",x:n,y:t,...i}}}class ou extends ve{transform;secondary;clone(){return new ou(null,te(this.transform),this.secondary)}constructor(t,n,i){super(t),this.transform=n,this.secondary=i}static make(t,n,i,r){const s=n.component.data.sources,{from:o}=i;let a=null;if(mH(o)){let u=kD(o.data,s);u||(u=new gs(o.data),s.push(u));const l=n.getName(`lookup_${r}`);a=new Ot(u,l,Te.Lookup,n.component.data.outputNodeRefCounts),n.component.data.outputNodes[l]=a}else if(yH(o)){const u=o.param;i={as:u,...i};let l;try{l=n.getSelectionComponent(De(u),u)}catch{throw new Error(Bj(u))}if(a=l.materialized,!a)throw new Error(Uj(u))}return new ou(t,i,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?q(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${se({transform:this.transform,secondary:this.secondary})}`}assemble(){let t;if(this.transform.from.fields)t={values:this.transform.from.fields,...this.transform.as?{as:q(this.transform.as)}:{}};else{let n=this.transform.as;j(n)||(N(Qj),n="_lookup"),t={as:[n]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...t,...this.transform.default?{default:this.transform.default}:{}}}}class pd extends ve{transform;clone(){return new pd(null,te(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=te(n);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??"prob",i[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${se(this.transform)}`}assemble(){const{quantile:t,...n}=this.transform;return{type:"quantile",field:t,...n}}}class gd extends ve{transform;clone(){return new gd(null,te(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=te(n);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??n.on,i[1]??n.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${se(this.transform)}`}assemble(){const{regression:t,on:n,...i}=this.transform;return{type:"regression",x:n,y:t,...i}}}class md extends ve{transform;clone(){return new md(null,te(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=zt((this.transform.groupby??[]).concat(t),n=>n)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${se(this.transform)}`}assemble(){const{pivot:t,value:n,groupby:i,limit:r,op:s}=this.transform;return{type:"pivot",field:t,value:n,...r!==void 0?{limit:r}:{},...s!==void 0?{op:s}:{},...i!==void 0?{groupby:i}:{}}}}class yd extends ve{transform;clone(){return new yd(null,te(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${se(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function wD(e){let t=0;function n(i,r){if(i instanceof gs&&!i.isGenerator&&!$o(i.data)&&(e.push(r),r={name:null,source:r.name,transform:[]}),i instanceof ht&&(i.parent instanceof gs&&!r.source?(r.format={...r.format,parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof Yo){r.name||(r.name=`data_${t++}`),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,e.push(...i.assemble());return}switch((i instanceof Hu||i instanceof Vu||i instanceof Do||i instanceof Xo||i instanceof Co||i instanceof su||i instanceof kn||i instanceof ou||i instanceof Ko||i instanceof Ts||i instanceof dd||i instanceof fd||i instanceof ld||i instanceof hd||i instanceof pd||i instanceof gd||i instanceof xr||i instanceof yd||i instanceof md||i instanceof cd)&&r.transform.push(i.assemble()),(i instanceof Qn||i instanceof Kn||i instanceof Jr||i instanceof Ci||i instanceof no)&&r.transform.push(...i.assemble()),i instanceof Ot&&(r.source&&r.transform.length===0?i.setSource(r.source):i.parent instanceof Ot?i.setSource(r.name):(r.name||(r.name=`data_${t++}`),i.setSource(r.name),i.numChildren()===1&&(e.push(r),r={name:null,source:r.name,transform:[]}))),i.numChildren()){case 0:i instanceof Ot&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name=`data_${t++}`);let s=r.name;!r.source||r.transform.length>0?e.push(r):s=r.source;for(const o of i.children)n(o,{name:null,source:s,transform:[]});break}}}return n}function NY(e){const t=[],n=wD(t);for(const i of e.children)n(i,{source:e.name,name:null,transform:[]});return t}function MY(e,t){const n=[],i=wD(n);let r=0;for(const o of e.sources){o.hasName()||(o.dataName=`source_${r++}`);const a=o.assemble();i(o,a)}for(const o of n)o.transform.length===0&&delete o.transform;let s=0;for(const[o,a]of n.entries())(a.transform??[]).length===0&&!a.source&&n.splice(s++,0,n.splice(o,1)[0]);for(const o of n)for(const a of o.transform??[])a.type==="lookup"&&(a.from=e.outputNodes[a.from].getSource());for(const o of n)o.name in t&&(o.values=t[o.name]);return n}function LY(e){return e==="top"||e==="left"||Y(e)?"header":"footer"}function PY(e){for(const t of en)IY(e,t);$E(e,"x"),$E(e,"y")}function IY(e,t){const{facet:n,config:i,child:r,component:s}=e;if(e.channelHasField(t)){const o=n[t],a=Oo("title",null,i,t);let u=eo(o,i,{allowDisabling:!0,includeDefault:a===void 0||!!a});r.component.layoutHeaders[t].title&&(u=F(u)?u.join(", "):u,u+=` / ${r.component.layoutHeaders[t].title}`,r.component.layoutHeaders[t].title=null);const l=Oo("labelOrient",o.header,i,t),c=o.header!==null?Pe(o.header?.labels,i.header.labels,!0):!1,f=ae(["bottom","right"],l)?"footer":"header";s.layoutHeaders[t]={title:o.header!==null?u:null,facetFieldDef:o,[f]:t==="facet"?[]:[SD(e,t,c)]}}}function SD(e,t,n){const i=t==="row"?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function $E(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:i,resolve:r}=e.component;if(r.axis[t]=I1(r,t),r.axis[t]==="shared"){const s=t==="x"?"column":"row",o=i[s];for(const a of n.component.axes[t]){const u=LY(a.get("orient"));o[u]??=[SD(e,s,!1)];const l=Oa(a,"main",e.config,{header:!0});l&&o[u][0].axes.push(l),a.mainExtracted=!0}}}}function zY(e){H1(e),_c(e,"width"),_c(e,"height")}function BY(e){H1(e);const t=e.layout.columns===1?"width":"childWidth",n=e.layout.columns===void 0?"height":"childHeight";_c(e,t),_c(e,n)}function H1(e){for(const t of e.children)t.parseLayoutSize()}function _c(e,t){const n=XO(t),i=If(n),r=e.component.resolve,s=e.component.layoutSize;let o;for(const a of e.children){const u=a.component.layoutSize.getWithExplicit(n),l=r.scale[i]??KO(i,e);if(l==="independent"&&u.value==="step"){o=void 0;break}if(o){if(l==="independent"&&o.value!==u.value){o=void 0;break}o=br(o,u,n,"")}else o=u}if(o){for(const a of e.children)e.renameSignal(a.getName(n),e.getName(t)),a.component.layoutSize.set(n,"merged",!1);s.setWithExplicit(t,o)}else s.setWithExplicit(t,{explicit:!1,value:void 0})}function UY(e){const{size:t,component:n}=e;for(const i of Ii){const r=Nt(i);if(t[r]!=null&&t[r]!=null){const s=t[r];n.layoutSize.set(r,ri(s)?"step":s,!0)}else{const s=jY(e,r);n.layoutSize.set(r,s,!1)}}}function jY(e,t){const n=t==="width"?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const s=r.get("type"),o=r.get("range");if(Le(s)){const a=Fc(i.view,t);return Fs(o)||ri(a)?"step":a}else return Wp(i.view,t)}else{if(e.hasProjection||e.mark==="arc")return Wp(i.view,t);{const s=Fc(i.view,t);return ri(s)?s.step:s}}}function lg(e,t,n){return B(t,{suffix:`by_${B(e)}`,...n})}class Ba extends ED{facet;child;children;constructor(t,n,i,r){super(t,"facet",n,i,r,t.resolve),this.child=J1(t.spec,this,this.getName("child"),void 0,r),this.children=[this.child],this.facet=this.initFacet(t.facet)}initFacet(t){if(!Bu(t))return{facet:this.initFacetFieldDef(t,"facet")};const n=R(t),i={};for(const r of n){if(![Si,ki].includes(r)){N(Uf(r,"facet"));break}const s=t[r];if(s.field===void 0){N(zp(s,r));break}i[r]=this.initFacetFieldDef(s,r)}return i}initFacetFieldDef(t,n){const i=g1(t,n);return i.header?i.header=tt(i.header):i.header===null&&(i.header=null),i}channelHasField(t){return _(this.facet,t)}fieldDef(t){return this.facet[t]}parseData(){this.component.data=bd(this),this.child.parseData()}parseLayoutSize(){H1(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Be(this.component.selection).some(t=>Jn(t))&&qy(jy)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),PY(this)}assembleSelectionTopLevelSignals(t){return this.child.assembleSelectionTopLevelSignals(t)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(t){return this.child.assembleSelectionData(t)}getHeaderLayoutMixins(){const t={};for(const n of en)for(const i of L1){const r=this.component.layoutHeaders[n],s=r[i],{facetFieldDef:o}=r;if(o){const a=Oo("titleOrient",o.header,this.config,n);if(["right","bottom"].includes(a)){const u=ad(n,a);t.titleAnchor??={},t.titleAnchor[u]="end"}}if(s?.[0]){const a=n==="row"?"height":"width",u=i==="header"?"headerBand":"footerBand";n!=="facet"&&!this.child.component.layoutSize.get(a)&&(t[u]??={},t[u][n]=.5),r.title&&(t.offset??={},t.offset[n==="row"?"rowTitle":"columnTitle"]=10)}}return t}assembleDefaultLayout(){const{column:t,row:n}=this.facet,i=t?this.columnDistinctSignal():n?1:void 0;let r="all";return(!n&&this.component.resolve.scale.x==="independent"||!t&&this.component.resolve.scale.y==="independent")&&(r="none"),{...this.getHeaderLayoutMixins(),...i?{columns:i}:{},bounds:"full",align:r}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof Ba))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(t){return this.parent&&this.parent instanceof Ba?{...this.channelHasField("column")?{encode:{update:{columns:{field:B(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(t)}:super.assembleGroup(t)}getCardinalityAggregateForChild(){const t=[],n=[],i=[];if(this.child instanceof Ba){if(this.child.channelHasField("column")){const r=B(this.child.facet.column);t.push(r),n.push("distinct"),i.push(`distinct_${r}`)}}else for(const r of Ii){const s=this.child.component.scales[r];if(s&&!s.merged){const o=s.get("type"),a=s.get("range");if(Le(o)&&Fs(a)){const u=ms(this.child,r),l=q1(u);l?(t.push(l),n.push("distinct"),i.push(`distinct_${l}`)):N(Uy(r))}}}return{fields:t,ops:n,as:i}}assembleFacet(){const{name:t,data:n}=this.component.data.facetRoot,{row:i,column:r}=this.facet,{fields:s,ops:o,as:a}=this.getCardinalityAggregateForChild(),u=[];for(const c of en){const f=this.facet[c];if(f){u.push(B(f));const{bin:d,sort:p}=f;if($e(d)&&u.push(B(f,{binSuffix:"end"})),$i(p)){const{field:h,op:g=Xf}=p,m=lg(f,p);i&&r?(s.push(m),o.push("max"),a.push(m)):(s.push(h),o.push(g),a.push(m))}else if(F(p)){const h=Fo(f,c);s.push(h),o.push("max"),a.push(h)}}}const l=!!i&&!!r;return{name:t,data:n,groupby:u,...l||s.length>0?{aggregate:{...l?{cross:l}:{},...s.length?{fields:s,ops:o,as:a}:{}}}:{}}}facetSortFields(t){const{facet:n}=this,i=n[t];return i?$i(i.sort)?[lg(i,i.sort,{expr:"datum"})]:F(i.sort)?[Fo(i,t,{expr:"datum"})]:[B(i,{expr:"datum"})]:[]}facetSortOrder(t){const{facet:n}=this,i=n[t];if(i){const{sort:r}=i;return[($i(r)?r.order:!F(r)&&r)||"ascending"]}return[]}assembleLabelTitle(){const{facet:t,config:n}=this;if(t.facet)return tg(t.facet,"facet",n);const i={row:["top","bottom"],column:["left","right"]};for(const r of M1)if(t[r]){const s=Oo("labelOrient",t[r]?.header,n,r);if(i[r].includes(s))return tg(t[r],r,n)}}assembleMarks(){const{child:t}=this,n=this.component.data.facetRoot,i=NY(n),r=t.assembleGroupEncodeEntry(!1),s=this.assembleLabelTitle()||t.assembleTitle(),o=t.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...s?{title:s}:{},...o?{style:o}:{},from:{facet:this.assembleFacet()},sort:{field:en.map(u=>this.facetSortFields(u)).flat(),order:en.map(u=>this.facetSortOrder(u)).flat()},...i.length>0?{data:i}:{},...r?{encode:{update:r}}:{},...t.assembleGroup(ZH(this,[]))}]}getMapping(){return this.facet}}function qY(e,t){const{row:n,column:i}=t;if(n&&i){let r=null;for(const s of[n,i])if($i(s.sort)){const{field:o,op:a=Xf}=s.sort;e=r=new Ts(e,{joinaggregate:[{op:a,field:o,as:lg(s,s.sort,{forAs:!0})}],groupby:[B(s)]})}return r}return null}function kD(e,t){for(const n of t){const i=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;const r=e.format?.mesh,s=i.format?.feature;if(r&&s)continue;const o=e.format?.feature;if((o||s)&&o!==s)continue;const a=i.format?.mesh;if(!((r||a)&&r!==a)){if(ru(e)&&ru(i)){if(Bt(e.values,i.values))return n}else if($o(e)&&$o(i)){if(e.url===i.url)return n}else if(uO(e)&&e.name===n.dataName)return n}}return null}function WY(e,t){if(e.data||!e.parent){if(e.data===null){const i=new gs({values:[]});return t.push(i),i}const n=kD(e.data,t);if(n)return ur(e.data)||(n.data.format=tC({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const i=new gs(e.data);return t.push(i),i}}else return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function GY(e,t,n){let i=0;for(const r of t.transforms){let s,o;if(CH(r))o=e=new Co(e,r),s="derived";else if(C1(r)){const a=wX(r);o=e=ht.makeWithAncestors(e,{},a,n)??e,e=new Xo(e,t,r.filter)}else if(iO(r))o=e=Qn.makeFromTransform(e,r,t),s="number";else if(OH(r))s="date",n.getWithExplicit(r.field).value===void 0&&(e=new ht(e,{[r.field]:s}),n.set(r.field,s,!1)),o=e=Kn.makeFromTransform(e,r);else if(DH(r))o=e=kn.makeFromTransform(e,r),s="number",N1(t)&&(e=new xr(e));else if(nO(r))o=e=ou.make(e,t,r,i++),s="derived";else if(kH(r))o=e=new Ko(e,r),s="number";else if($H(r))o=e=new Ts(e,r),s="number";else if(RH(r))o=e=Ci.makeFromTransform(e,r),s="derived";else if(_H(r))o=e=new dd(e,r),s="derived";else if(TH(r))o=e=new cd(e,r),s="derived";else if(AH(r))o=e=new fd(e,r),s="derived";else if(bH(r))o=e=new md(e,r),s="derived";else if(SH(r))e=new yd(e,r);else if(FH(r))o=e=Jr.makeFromTransform(e,r),s="derived";else if(xH(r))o=e=new ld(e,r),s="derived";else if(vH(r))o=e=new pd(e,r),s="derived";else if(EH(r))o=e=new gd(e,r),s="derived";else if(wH(r))o=e=new hd(e,r),s="derived";else{N(Jj(r));continue}if(o&&s!==void 0)for(const a of o.producedFields()??[])n.set(a,s,!1)}return e}function bd(e){let t=WY(e,e.component.data.sources);const{outputNodes:n,outputNodeRefCounts:i}=e.component.data,r=e.data,o=!(r&&(ur(r)||$o(r)||ru(r)))&&e.parent?e.parent.component.data.ancestorParse.clone():new GH;ur(r)?(lO(r)?t=new Vu(t,r.sequence):F1(r)&&(t=new Hu(t,r.graticule)),o.parseNothing=!0):r?.format?.parse===null&&(o.parseNothing=!0),t=ht.makeExplicit(t,e,o)??t,t=new xr(t);const a=e.parent&&Jo(e.parent);(Oe(e)||Gt(e))&&a&&(t=Qn.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=GY(t,e,o));const u=kX(e),l=SX(e);t=ht.makeWithAncestors(t,{},{...u,...l},o)??t,Oe(e)&&(t=no.parseAll(t,e),t=su.parseAll(t,e)),(Oe(e)||Gt(e))&&(a||(t=Qn.makeFromEncoding(t,e)??t),t=Kn.makeFromEncoding(t,e)??t,t=Co.parseAllForSortIndex(t,e));const c=t=hl(Te.Raw,e,t);if(Oe(e)){const m=kn.makeFromEncoding(t,e);m&&(t=m,N1(e)&&(t=new xr(t))),t=Jr.makeFromEncoding(t,e)??t,t=Ci.makeFromEncoding(t,e)??t}let f,d;if(Oe(e)){const{markDef:m,mark:y,config:b}=e,v=me("invalid",m,b),{marks:w,scales:E}=d=fO({invalid:v,isPath:Or(y)});w!==E&&E==="include-invalid-values"&&(f=t=hl(Te.PreFilterInvalid,e,t)),w==="exclude-invalid-values"&&(t=Do.make(t,e,d)??t)}const p=t=hl(Te.Main,e,t);let h;if(Oe(e)&&d){const{marks:m,scales:y}=d;m==="include-invalid-values"&&y==="exclude-invalid-values"&&(t=Do.make(t,e,d)??t,h=t=hl(Te.PostFilterInvalid,e,t))}Oe(e)&&FV(e,p);let g=null;if(Gt(e)){const m=e.getName("facet");t=qY(t,e.facet)??t,g=new Yo(t,e,m,p.getSource()),n[m]=g}return{...e.component.data,outputNodes:n,outputNodeRefCounts:i,raw:c,main:p,facetRoot:g,ancestorParse:o,preFilterInvalid:f,postFilterInvalid:h}}function hl(e,t,n){const{outputNodes:i,outputNodeRefCounts:r}=t.component.data,s=t.getDataName(e),o=new Ot(n,s,e,r);return i[s]=o,o}class HY extends G1{children;constructor(t,n,i,r){super(t,"concat",n,i,r,t.resolve),(t.resolve?.axis?.x==="shared"||t.resolve?.axis?.y==="shared")&&N(Xj),this.children=this.getChildren(t).map((s,o)=>J1(s,this,this.getName(`concat_${o}`),void 0,r))}parseData(){this.component.data=bd(this);for(const t of this.children)t.parseData()}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of R(t.component.selection))this.component.selection[n]=t.component.selection[n]}Be(this.component.selection).some(t=>Jn(t))&&qy(jy)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){for(const t of this.children)t.parseAxesAndHeaders()}getChildren(t){return td(t)?t.vconcat:$1(t)?t.hconcat:t.concat}parseLayoutSize(){BY(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(t){return this.children.reduce((n,i)=>i.assembleSelectionTopLevelSignals(n),t)}assembleSignals(){return this.children.forEach(t=>t.assembleSignals()),[]}assembleLayoutSignals(){const t=P1(this);for(const n of this.children)t.push(...n.assembleLayoutSignals());return t}assembleSelectionData(t){return this.children.reduce((n,i)=>i.assembleSelectionData(n),t)}assembleMarks(){return this.children.map(t=>{const n=t.assembleTitle(),i=t.assembleGroupStyle(),r=t.assembleGroupEncodeEntry(!1);return{type:"group",name:t.getName("group"),...n?{title:n}:{},...i?{style:i}:{},...r?{encode:{update:r}}:{},...t.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){const t=this.layout.columns;return{...t!=null?{columns:t}:{},bounds:"full",align:"each"}}}function VY(e){return e===!1||e===null}const XY={disable:1,gridScale:1,scale:1,...$F,labelExpr:1,encode:1},$D=R(XY);class V1 extends Bi{explicit;implicit;mainExtracted;constructor(t={},n={},i=!1){super(),this.explicit=t,this.implicit=n,this.mainExtracted=i}clone(){return new V1(te(this.explicit),te(this.implicit),this.mainExtracted)}hasAxisPart(t){return t==="axis"?!0:t==="grid"||t==="title"?!!this.get(t):!VY(this.get(t))}hasOrientSignalRef(){return Y(this.explicit.orient)}}function YY(e,t,n){const{encoding:i,config:r}=e,s=Ge(i[t])??Ge(i[di(t)]),o=e.axis(t)||{},{format:a,formatType:u}=o;if(ds(u))return{text:wn({fieldOrDatumDef:s,field:"datum.value",format:a,formatType:u,config:r}),...n};if(a===void 0&&u===void 0&&r.customFormatTypes){if(Eo(s)==="quantitative"){if(wo(s)&&s.stack==="normalize"&&r.normalizedNumberFormatType)return{text:wn({fieldOrDatumDef:s,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:wn({fieldOrDatumDef:s,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if(Eo(s)==="temporal"&&r.timeFormatType&&M(s)&&!s.timeUnit)return{text:wn({fieldOrDatumDef:s,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}function KY(e){return Ii.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[iK(n,e)]),t),{})}const JY={bottom:"top",top:"bottom",left:"right",right:"left"};function QY(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const r of e.children){r.parseAxesAndHeaders();for(const s of R(r.component.axes))n.axis[s]=I1(e.component.resolve,s),n.axis[s]==="shared"&&(t[s]=ZY(t[s],r.component.axes[s]),t[s]||(n.axis[s]="independent",delete t[s]))}for(const r of Ii){for(const s of e.children)if(s.component.axes[r]){if(n.axis[r]==="independent"){t[r]=(t[r]??[]).concat(s.component.axes[r]);for(const o of s.component.axes[r]){const{value:a,explicit:u}=o.getWithExplicit("orient");if(!Y(a)){if(i[a]>0&&!u){const l=JY[a];i[a]>i[l]&&o.set("orient",l,!1)}i[a]++}}}delete s.component.axes[r]}if(n.axis[r]==="independent"&&t[r]&&t[r].length>1)for(const[s,o]of(t[r]||[]).entries())s>0&&o.get("grid")&&!o.explicit.grid&&(o.implicit.grid=!1)}}function ZY(e,t){if(e){if(e.length!==t.length)return;const n=e.length;for(let i=0;in.clone());return e}function eK(e,t){for(const n of $D){const i=br(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",(r,s)=>{switch(n){case"title":return DC(r,s);case"gridScale":return{explicit:r.explicit,value:Pe(r.value,s.value)}}return id(r,s,n,"axis")});e.setWithExplicit(n,i)}return e}function tK(e,t,n,i,r){if(t==="disable")return n!==void 0;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(Y(n.labelAngle)?n.labelAngle:nu(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===qO(i,r))return!0}return e===n[t]}const nK=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function iK(e,t){let n=t.axis(e);const i=new V1,r=Ge(t.encoding[e]),{mark:s,config:o}=t,a=n?.orient||o[e==="x"?"axisX":"axisY"]?.orient||o.axis?.orient||IV(e),u=t.getScaleComponent(e).get("type"),l=RV(e,u,a,t.config),c=n!==void 0?!n:Zp("disable",o.style,n?.style,l).configValue;if(i.set("disable",c,n!==void 0),c)return i;n=n||{};const f=MV(r,n,e,o.style,l),d=fF(n.formatType,r,u),p=cF(r,r.type,n.format,n.formatType,o,!0),h={fieldOrDatumDef:r,axis:n,channel:e,model:t,scaleType:u,orient:a,labelAngle:f,format:p,formatType:d,mark:s,config:o};for(const y of $D){const b=y in cE?cE[y](h):Pv(y)?n[y]:void 0,v=b!==void 0,w=tK(b,y,n,t,e);if(v&&w)i.set(y,b,w);else{const{configValue:E=void 0,configFrom:S=void 0}=Pv(y)&&y!=="values"?Zp(y,o.style,n.style,l):{},x=E!==void 0;v&&!x?i.set(y,b,w):(S!=="vgAxisConfig"||nK.has(y)&&x||Wu(E)||Y(E))&&i.set(y,E,!1)}}const g=n.encoding??{},m=kF.reduce((y,b)=>{if(!i.hasAxisPart(b))return y;const v=YO(g[b]??{},t),w=b==="labels"?YY(t,e,v):v;return w!==void 0&&!Se(w)&&(y[b]={update:w}),y},{});return Se(m)||i.set("encode",m,!!n.encoding||n.labelAngle!==void 0),i}function rK({encoding:e,size:t}){for(const n of Ii){const i=Nt(n);ri(t[i])&&ir(e[n])&&(delete t[i],N(MC(i)))}return t}const sK={vgMark:"arc",encodeEntry:e=>({...dn(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...St("x",e,{defaultPos:"mid"}),...St("y",e,{defaultPos:"mid"}),...Di(e,"radius"),...Di(e,"theta")})},oK={vgMark:"area",encodeEntry:e=>({...dn(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...Oc("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="horizontal"}),...Oc("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="vertical"}),...T1(e)})},aK={vgMark:"rect",encodeEntry:e=>({...dn(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Di(e,"x"),...Di(e,"y")})},uK={vgMark:"shape",encodeEntry:e=>({...dn(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&M(n)&&n.type===Ho?{field:B(n,{expr:"datum"})}:{}}]}},lK={vgMark:"image",encodeEntry:e=>({...dn(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...Di(e,"x"),...Di(e,"y"),...D1(e,"url")})},cK={vgMark:"line",encodeEntry:e=>({...dn(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...St("x",e,{defaultPos:"mid"}),...St("y",e,{defaultPos:"mid"}),...it("size",e,{vgChannel:"strokeWidth"}),...T1(e)})},fK={vgMark:"trail",encodeEntry:e=>({...dn(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...St("x",e,{defaultPos:"mid"}),...St("y",e,{defaultPos:"mid"}),...it("size",e),...T1(e)})};function X1(e,t){const{config:n}=e;return{...dn(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...St("x",e,{defaultPos:"mid"}),...St("y",e,{defaultPos:"mid"}),...it("size",e),...it("angle",e),...dK(e,n,t)}}function dK(e,t,n){return n?{shape:{value:n}}:it("shape",e)}const hK={vgMark:"symbol",encodeEntry:e=>X1(e)},pK={vgMark:"symbol",encodeEntry:e=>X1(e,"circle")},gK={vgMark:"symbol",encodeEntry:e=>X1(e,"square")},mK={vgMark:"rect",encodeEntry:e=>({...dn(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Di(e,"x"),...Di(e,"y")})},yK={vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return!e.encoding.x&&!e.encoding.y&&!e.encoding.latitude&&!e.encoding.longitude?{}:{...dn(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Oc("x",e,{defaultPos:n==="horizontal"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:n!=="vertical"}),...Oc("y",e,{defaultPos:n==="vertical"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:n!=="horizontal"}),...it("size",e,{vgChannel:"strokeWidth"})}}},bK={vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...dn(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...St("x",e,{defaultPos:"mid"}),...St("y",e,{defaultPos:"mid"}),...D1(e),...it("size",e,{vgChannel:"fontSize"}),...it("angle",e),...oE("align",xK(e.markDef,n,t)),...oE("baseline",vK(e.markDef,n,t)),...St("radius",e,{defaultPos:null}),...St("theta",e,{defaultPos:null})}}};function xK(e,t,n){if(me("align",e,n)===void 0)return"center"}function vK(e,t,n){if(me("baseline",e,n)===void 0)return"middle"}const EK={vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r=i==="horizontal"?"x":"y",s=i==="horizontal"?"y":"x",o=i==="horizontal"?"height":"width";return{...dn(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Di(e,r),...St(s,e,{defaultPos:"mid",vgChannel:s==="y"?"yc":"xc"}),[o]:Ce(me("thickness",n,t))}}},pl={arc:sK,area:oK,bar:aK,circle:pK,geoshape:uK,image:lK,line:cK,point:hK,rect:mK,rule:yK,square:gK,text:bK,tick:EK,trail:fK};function wK(e){if(ae([Hf,Wf,$W],e.mark)){const t=RF(e.mark,e.encoding);if(t.length>0)return SK(e,t)}else if(e.mark===Gf){const t=Pp.some(n=>me(n,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&t)return kK(e)}return Y1(e)}const AE="faceted_path_";function SK(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:AE+e.requestDataName(Te.Main),data:e.requestDataName(Te.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:Y1(e,{fromPrefix:AE})}]}const CE="stack_group_";function kK(e){const[t]=Y1(e,{fromPrefix:CE}),n=e.scaleName(e.stack.fieldChannel),i=(l={})=>e.vgField(e.stack.fieldChannel,l),r=(l,c)=>{const f=[i({prefix:"min",suffix:"start",expr:c}),i({prefix:"max",suffix:"start",expr:c}),i({prefix:"min",suffix:"end",expr:c}),i({prefix:"max",suffix:"end",expr:c})];return`${l}(${f.map(d=>`scale('${n}',${d})`).join(",")})`};let s,o;e.stack.fieldChannel==="x"?(s={...po(t.encode.update,["y","yc","y2","height",...Pp]),x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}},o={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...Wt(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(s={...po(t.encode.update,["x","xc","x2","width"]),y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}},o={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...Wt(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const l of Pp){const c=ni(l,e.markDef,e.config);t.encode.update[l]?(s[l]=t.encode.update[l],delete t.encode.update[l]):c&&(s[l]=Ce(c)),c&&(t.encode.update[l]={value:0})}const a=[];if(e.stack.groupbyChannels?.length>0)for(const l of e.stack.groupbyChannels){const c=e.fieldDef(l),f=B(c);f&&a.push(f),(c?.bin||c?.timeUnit)&&a.push(B(c,{binSuffix:"end"}))}return s=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((l,c)=>{if(t.encode.update[c])return{...l,[c]:t.encode.update[c]};{const f=ni(c,e.markDef,e.config);return f!==void 0?{...l,[c]:Ce(f)}:l}},s),s.stroke&&(s.strokeForeground={value:!0},s.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(Te.Main),name:CE+e.requestDataName(Te.Main),groupby:a,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:s},marks:[{type:"group",encode:{update:o},marks:[t]}]}]}function $K(e){const{encoding:t,stack:n,mark:i,markDef:r,config:s}=e,o=t.order;if(!(!F(o)&&On(o)&&Mp(o.value)||!o&&Mp(me("order",r,s)))){if((F(o)||M(o))&&!n)return CC(o,{expr:"datum"});if(Or(i)){const a=r.orient==="horizontal"?"y":"x",u=t[a];if(M(u))return{field:a}}}}function Y1(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:s}=e,o=Pe(i.clip,AK(e),CK(e)),a=$C(i),u=r.key,l=$K(e),c=FK(e);c&&Object.values(e.component.selection).some(p=>p.type==="point"&&!p.bind&&p.on!=="pointerover")&&(e.markDef.cursor??="pointer");const f=me("aria",i,s),d=pl[n].postEncodingTransform?pl[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:pl[n].vgMark,...o?{clip:o}:{},...a?{style:a}:{},...u?{key:u.field}:{},...l?{sort:l}:{},...c||{},...f===!1?{aria:f}:{},from:{data:t.fromPrefix+e.requestDataName(Te.Main)},encode:{update:pl[n].encodeEntry(e)},...d?{transform:d}:{}}]}function AK(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return t?.get("selectionExtent")||n?.get("selectionExtent")?!0:void 0}function CK(e){const t=e.component.projection;return t&&!t.isFit?!0:void 0}function FK(e){if(!e.component.selection)return null;const t=R(e.component.selection).length;let n=t,i=e.parent;for(;i&&n===0;)n=R(i.component.selection).length,i=i.parent;return n?{interactive:t>0||e.mark==="geoshape"||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}class AD extends ED{markDef;encoding;specifiedScales={};stack;specifiedAxes={};specifiedLegends={};specifiedProjection={};selection=[];children=[];constructor(t,n,i,r={},s){super(t,"unit",n,i,s,void 0,zv(t)?t.view:void 0);const o=ii(t.mark)?{...t.mark}:{type:t.mark},a=o.type;o.filled===void 0&&(o.filled=aH(o,s,{graticule:t.data&&F1(t.data)}));const u=this.encoding=fG(t.encoding||{},a,o.filled,s);this.markDef=QF(o,u,s),this.size=rK({encoding:u,size:zv(t)?{...r,...t.width!==void 0?{width:t.width}:{},...t.height!==void 0?{height:t.height}:{}}:r}),this.stack=JF(this.markDef,u),this.specifiedScales=this.initScales(a,u),this.specifiedAxes=this.initAxes(u),this.specifiedLegends=this.initLegends(u),this.specifiedProjection=t.projection,this.selection=(t.params??[]).filter(l=>S1(l)),this.alignStackOrderWithColorDomain()}get hasProjection(){const{encoding:t}=this,n=this.mark===iF,i=t&&ij.some(r=>ne(t[r]));return n||i}scaleDomain(t){const n=this.specifiedScales[t];return n?n.domain:void 0}axis(t){return this.specifiedAxes[t]}legend(t){return this.specifiedLegends[t]}initScales(t,n){return Iy.reduce((i,r)=>{const s=Ge(n[r]);return s&&(i[r]=this.initScale(s.scale??{})),i},{})}initScale(t){const{domain:n,range:i}=t,r=tt(t);return F(n)&&(r.domain=n.map(It)),F(i)&&(r.range=i.map(It)),r}initAxes(t){return Ii.reduce((n,i)=>{const r=t[i];if(ne(r)||i===Re&&ne(t.x2)||i===Ze&&ne(t.y2)){const s=ne(r)?r.axis:void 0;n[i]=s&&this.initAxis({...s})}return n},{})}initAxis(t){const n=R(t),i={};for(const r of n){const s=t[r];i[r]=Wu(s)?kC(s):It(s)}return i}initLegends(t){return pj.reduce((n,i)=>{const r=Ge(t[i]);if(r&&mj(i)){const s=r.legend;n[i]=s&&tt(s)}return n},{})}alignStackOrderWithColorDomain(){const{color:t,fill:n,order:i,xOffset:r,yOffset:s}=this.encoding,o=n||t,a=M(o)?o:void 0,u=a?.field,l=a?.scale,c=a?.type,f=l?.domain,d=r||s,p=M(d)?d:void 0,h=`_${u}_sort_index`;if(!i&&Array.isArray(f)&&typeof u=="string"&&c==="nominal")if(p&&!p.sort)p.sort=f;else{if(!this.stack)return;const g=`indexof(${L(f)}, datum['${u}'])`,m=this.markDef?.orient==="horizontal"?"ascending":"descending";this.transforms.push({calculate:g,as:h}),this.encoding.order={field:h,type:"quantitative",sort:m}}}parseData(){this.component.data=bd(this)}parseLayoutSize(){UY(this)}parseSelections(){this.component.selection=CV(this,this.selection)}parseMarkGroup(){this.component.mark=wK(this)}parseAxesAndHeaders(){this.component.axes=KY(this)}assembleSelectionTopLevelSignals(t){return eV(this,t)}assembleSignals(){return[...BO(this),...QH(this,[])]}assembleSelectionData(t){return tV(this,t)}assembleLayout(){return null}assembleLayoutSignals(){return P1(this)}correctDataNames=t=>(t.from?.data&&(t.from.data=this.lookupDataSource(t.from.data),"time"in this.encoding&&(t.from.data=t.from.data+hO)),t.from?.facet?.data&&(t.from.facet.data=this.lookupDataSource(t.from.facet.data)),t);assembleMarks(){let t=this.component.mark??[];return(!this.parent||!Jo(this.parent))&&(t=yO(this,t)),t.map(this.correctDataNames)}assembleGroupStyle(){const{style:t}=this.view||{};return t!==void 0?t:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(t){return Yr(this.encoding,t)}fieldDef(t){const n=this.encoding[t];return Dn(n)}typedFieldDef(t){const n=this.fieldDef(t);return $t(n)?n:null}}class K1 extends G1{children;constructor(t,n,i,r,s){super(t,"layer",n,i,s,t.resolve,t.view);const o={...r,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}};this.children=t.layer.map((a,u)=>{if(nd(a))return new K1(a,this,this.getName(`layer_${u}`),o,s);if(zi(a))return new AD(a,this,this.getName(`layer_${u}`),o,s);throw new Error(By(a))})}parseData(){this.component.data=bd(this);for(const t of this.children)t.parseData()}parseLayoutSize(){zY(this)}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of R(t.component.selection))this.component.selection[n]=t.component.selection[n]}Be(this.component.selection).some(t=>Jn(t))&&qy(jy)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){QY(this)}assembleSelectionTopLevelSignals(t){return this.children.reduce((n,i)=>i.assembleSelectionTopLevelSignals(n),t)}assembleSignals(){return this.children.reduce((t,n)=>t.concat(n.assembleSignals()),BO(this))}assembleLayoutSignals(){return this.children.reduce((t,n)=>t.concat(n.assembleLayoutSignals()),P1(this))}assembleSelectionData(t){return this.children.reduce((n,i)=>i.assembleSelectionData(n),t)}assembleGroupStyle(){const t=new Set;for(const i of this.children)for(const r of q(i.assembleGroupStyle()))t.add(r);const n=Array.from(t);return n.length>1?n:n.length===1?n[0]:void 0}assembleTitle(){let t=super.assembleTitle();if(t)return t;for(const n of this.children)if(t=n.assembleTitle(),t)return t}assembleLayout(){return null}assembleMarks(){return nV(this,this.children.flatMap(t=>t.assembleMarks()))}assembleLegends(){return this.children.reduce((t,n)=>t.concat(n.assembleLegends()),aD(this))}}function J1(e,t,n,i,r){if(Yf(e))return new Ba(e,t,n,r);if(nd(e))return new K1(e,t,n,i,r);if(zi(e))return new AD(e,t,n,i,r);if(MG(e))return new HY(e,t,n,r);throw new Error(By(e))}function OK(e,t={}){t.logger&&zq(t.logger),t.fieldTitle&&EF(t.fieldTitle);try{const n=KF(_o(t.config,e.config)),i=oO(e,n),r=J1(i,null,"",void 0,n);return r.parse(),zX(r.component.data,r),{spec:RK(r,DK(e,i.autosize,n,r),e.datasets,e.usermeta),normalized:i}}finally{t.logger&&Bq(),t.fieldTitle&&nG()}}function DK(e,t,n,i){const r=i.component.layoutSize.get("width"),s=i.component.layoutSize.get("height");if(t===void 0?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):j(t)&&(t={type:t}),r&&s&&jH(t.type)){if(r==="step"&&s==="step")N(Sv()),t.type="pad";else if(r==="step"||s==="step"){const o=r==="step"?"width":"height";N(Sv(If(o)));const a=o==="width"?"height":"width";t.type=qH(a)}}return{...R(t).length===1&&t.type?t.type==="pad"?{}:{autosize:t.type}:{autosize:t},...Jv(n,!1),...Jv(e,!0)}}function RK(e,t,n={},i){const r=e.config?YG(e.config):void 0,s=MY(e.component.data,n),o=e.assembleSelectionData(s),a=e.assembleProjections(),u=e.assembleTitle(),l=e.assembleGroupStyle(),c=e.assembleGroupEncodeEntry(!0);let f=e.assembleLayoutSignals();f=f.filter(h=>(h.name==="width"||h.name==="height")&&h.value!==void 0?(t[h.name]=+h.value,!1):!0);const{params:d,...p}=t;return{$schema:"https://vega.github.io/schema/vega/v6.json",...e.description?{description:e.description}:{},...p,...u?{title:u}:{},...l?{style:l}:{},...c?{encode:{update:c}}:{},data:o,...a.length>0?{projections:a}:{},...e.assembleGroup([...f,...e.assembleSelectionTopLevelSignals([]),...HF(d)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}const _K=JU.version,TK=Object.freeze(Object.defineProperty({__proto__:null,accessPathDepth:yo,accessPathWithDatum:Dy,accessWithDatumToUnescapedPath:ye,compile:OK,contains:ae,deepEqual:Bt,deleteNestedProperty:vc,duplicate:te,entries:gr,every:Cy,fieldIntersection:Oy,flatAccessWithDatum:iC,getFirstDefined:Pe,hasIntersection:Fy,hasProperty:_,hash:se,internalField:aC,isBoolean:mo,isEmpty:Se,isEqual:ZU,isInternalField:uC,isNullOrFalse:Mp,isNumeric:_f,isPrimitive:xc,keys:R,logicalExpr:Ia,mergeDeep:tC,never:eC,normalize:oO,normalizeAngle:nu,omit:Wt,pick:po,prefixGenerator:Lp,removePathFromField:Wo,replaceAll:os,replacePathInField:un,resetIdCounter:tj,setEqual:nC,some:go,stringify:xe,titleCase:Tu,unescapeSingleQuoteAndPathDot:rC,unique:zt,uniqueId:oC,vals:Be,varName:De,version:_K},Symbol.toStringTag,{value:"Module"}));function CD(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var NK="3.0.0",MK={version:NK};const js="#fff",FE="#888",LK={background:"#333",view:{stroke:FE},title:{color:js,subtitleColor:js},style:{"guide-label":{fill:js},"guide-title":{fill:js}},axis:{domainColor:js,gridColor:FE,tickColor:js}},Tr="#4572a7",PK={background:"#fff",arc:{fill:Tr},area:{fill:Tr},line:{stroke:Tr,strokeWidth:2},path:{stroke:Tr},rect:{fill:Tr},shape:{stroke:Tr},symbol:{fill:Tr,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},Nr="#30a2da",gh="#cbcbcb",IK="#999",zK="#333",OE="#f0f0f0",DE="#333",BK={arc:{fill:Nr},area:{fill:Nr},axis:{domainColor:gh,grid:!0,gridColor:gh,gridWidth:1,labelColor:IK,labelFontSize:10,titleColor:zK,tickColor:gh,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:OE,group:{fill:OE},legend:{labelColor:DE,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:DE,titleFontSize:14,titlePadding:10},line:{stroke:Nr,strokeWidth:2},path:{stroke:Nr,strokeWidth:.5},rect:{fill:Nr},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:Nr},bar:{binSpacing:2,fill:Nr,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},Mr="#000",UK={group:{fill:"#e5e5e5"},arc:{fill:Mr},area:{fill:Mr},line:{stroke:Mr},path:{stroke:Mr},rect:{fill:Mr},shape:{stroke:Mr},symbol:{fill:Mr,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},jK=22,qK="normal",RE="Benton Gothic, sans-serif",_E=11.5,WK="normal",Lr="#82c6df",mh="Benton Gothic Bold, sans-serif",TE="normal",NE=13,ha={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"]},GK={background:"#ffffff",title:{anchor:"start",color:"#000000",font:mh,fontSize:jK,fontWeight:qK},arc:{fill:Lr},area:{fill:Lr},line:{stroke:Lr,strokeWidth:2},path:{stroke:Lr},rect:{fill:Lr},shape:{stroke:Lr},symbol:{fill:Lr,size:30},axis:{labelFont:RE,labelFontSize:_E,labelFontWeight:WK,titleFont:mh,titleFontSize:NE,titleFontWeight:TE},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:RE,labelFontSize:_E,symbolType:"square",titleFont:mh,titleFontSize:NE,titleFontWeight:TE},range:{category:ha["category-6"],diverging:ha["fireandice-6"],heatmap:ha["fire-7"],ordinal:ha["fire-7"],ramp:ha["fire-7"]}},Pr="#ab5787",gl="#979797",HK={background:"#f9f9f9",arc:{fill:Pr},area:{fill:Pr},line:{stroke:Pr},path:{stroke:Pr},rect:{fill:Pr},shape:{stroke:Pr},symbol:{fill:Pr,size:30},axis:{domainColor:gl,domainWidth:.5,gridWidth:.2,labelColor:gl,tickColor:gl,tickWidth:.2,titleColor:gl},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},Ir="#3e5c69",VK={background:"#fff",arc:{fill:Ir},area:{fill:Ir},line:{stroke:Ir},path:{stroke:Ir},rect:{fill:Ir},shape:{stroke:Ir},symbol:{fill:Ir},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},Jt="#1696d2",ME="#000000",XK="#FFFFFF",ml="Lato",yh="Lato",YK="Lato",KK="#DEDDDD",JK=18,pa={"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},QK={background:XK,title:{anchor:"start",fontSize:JK,font:ml},axisX:{domain:!0,domainColor:ME,domainWidth:1,grid:!1,labelFontSize:12,labelFont:yh,labelAngle:0,tickColor:ME,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:ml},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:KK,gridWidth:1,labelFontSize:12,labelFont:yh,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:ml,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:yh,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:ml,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:pa["six-groups-cat-1"],diverging:pa["diverging-colors"],heatmap:pa["diverging-colors"],ordinal:pa["six-groups-seq"],ramp:pa["shades-blue"]},area:{fill:Jt},rect:{fill:Jt},line:{color:Jt,stroke:Jt,strokeWidth:5},trail:{color:Jt,stroke:Jt,strokeWidth:0,size:1},path:{stroke:Jt,strokeWidth:.5},point:{filled:!0},text:{font:YK,color:Jt,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:Jt,stroke:null}},arc:{fill:Jt},shape:{stroke:Jt},symbol:{fill:Jt,size:30}},zr="#3366CC",LE="#ccc",yl="Arial, sans-serif",ZK={arc:{fill:zr},area:{fill:zr},path:{stroke:zr},rect:{fill:zr},shape:{stroke:zr},symbol:{stroke:zr},circle:{fill:zr},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:yl,fontSize:12},"guide-title":{font:yl,fontSize:12},"group-title":{font:yl,fontSize:12}},title:{font:yl,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:LE,tickColor:LE,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},Q1=e=>e*(1/3+1),PE=Q1(9),IE=Q1(10),zE=Q1(12),ga="Segoe UI",BE="wf_standard-font, helvetica, arial, sans-serif",UE="#252423",ma="#605E5C",jE="transparent",eJ="#C8C6C4",gn="#118DFF",tJ="#12239E",nJ="#E66C37",iJ="#6B007B",rJ="#E044A7",sJ="#744EC2",oJ="#D9B300",aJ="#D64550",FD=gn,OD="#DEEFFF",qE=[OD,FD],uJ=[OD,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",FD],lJ={view:{stroke:jE},background:jE,font:ga,header:{titleFont:BE,titleFontSize:zE,titleColor:UE,labelFont:ga,labelFontSize:IE,labelColor:ma},axis:{ticks:!1,grid:!1,domain:!1,labelColor:ma,labelFontSize:PE,titleFont:BE,titleColor:UE,titleFontSize:zE,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:eJ,gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:gn},line:{stroke:gn,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:ga,fontSize:PE,fill:ma},arc:{fill:gn},area:{fill:gn,line:!0,opacity:.6},path:{stroke:gn},rect:{fill:gn},point:{fill:gn,filled:!0,size:75},shape:{stroke:gn},symbol:{fill:gn,strokeWidth:1.5,size:50},legend:{titleFont:ga,titleFontWeight:"bold",titleColor:ma,labelFont:ga,labelFontSize:IE,labelColor:ma,symbolType:"circle",symbolSize:75},range:{category:[gn,tJ,nJ,iJ,rJ,sJ,oJ,aJ],diverging:qE,heatmap:qE,ordinal:uJ}},bh='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',cJ='IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',xh=400,bl={textPrimary:{g90:"#f4f4f4",g100:"#f4f4f4",white:"#161616",g10:"#161616"},textSecondary:{g90:"#c6c6c6",g100:"#c6c6c6",white:"#525252",g10:"#525252"},layerAccent01:{white:"#e0e0e0",g10:"#e0e0e0",g90:"#525252",g100:"#393939"},gridBg:{white:"#ffffff",g10:"#ffffff",g90:"#161616",g100:"#161616"}},fJ=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],dJ=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function xd({theme:e,background:t}){const n=["white","g10"].includes(e)?"light":"dark",i=bl.gridBg[e],r=bl.textPrimary[e],s=bl.textSecondary[e],o=n==="dark"?fJ:dJ,a=n==="dark"?"#d4bbff":"#6929c4";return{background:t,arc:{fill:a},area:{fill:a},path:{stroke:a},rect:{fill:a},shape:{stroke:a},symbol:{stroke:a},circle:{fill:a},view:{fill:i,stroke:i},group:{fill:i},title:{color:r,anchor:"start",dy:-15,fontSize:16,font:bh,fontWeight:600},axis:{labelColor:s,labelFontSize:12,labelFont:cJ,labelFontWeight:xh,titleColor:r,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:bl.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:bh,fill:s,fontWeight:xh},"guide-title":{font:bh,fill:s,fontWeight:xh}},range:{category:o,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const hJ=xd({theme:"white",background:"#ffffff"}),pJ=xd({theme:"g10",background:"#f4f4f4"}),gJ=xd({theme:"g90",background:"#262626"}),mJ=xd({theme:"g100",background:"#161616"}),yJ=MK.version,bJ=Object.freeze(Object.defineProperty({__proto__:null,carbong10:pJ,carbong100:mJ,carbong90:gJ,carbonwhite:hJ,dark:LK,excel:PK,fivethirtyeight:BK,ggplot2:UK,googlecharts:ZK,latimes:GK,powerbi:lJ,quartz:HK,urbaninstitute:QK,version:yJ,vox:VK},Symbol.toStringTag,{value:"Module"}));function xJ(e,t,n,i){if(F(e))return`[${e.map(r=>t(j(r)?r:WE(r,n))).join(", ")}]`;if(U(e)){let r="";const{title:s,image:o,...a}=e;s&&(r+=`

          ${t(s)}

          `),o&&(r+=``);const u=Object.keys(a);if(u.length>0){r+="";for(const l of u){let c=a[l];c!==void 0&&(U(c)&&(c=WE(c,n)),r+=``)}r+="
          ${t(l)}${t(c)}
          "}return r||"{}"}return t(e)}function vJ(e){const t=[];return function(n,i){if(typeof i!="object"||i===null)return i;const r=t.indexOf(this)+1;return t.length=r,t.length>e?"[Object]":t.indexOf(i)>=0?"[Circular]":(t.push(i),i)}}function WE(e,t){return JSON.stringify(e,vJ(t))}var EJ=`#vg-tooltip-element { + visibility: hidden; + padding: 8px; + position: fixed; + z-index: 1000; + font-family: sans-serif; + font-size: 11px; + border-radius: 3px; + box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); + /* The default theme is the light theme. */ + background-color: rgba(255, 255, 255, 0.95); + border: 1px solid #d9d9d9; + color: black; +} +#vg-tooltip-element.visible { + visibility: visible; +} +#vg-tooltip-element h2 { + margin-top: 0; + margin-bottom: 10px; + font-size: 13px; +} +#vg-tooltip-element table { + border-spacing: 0; +} +#vg-tooltip-element table tr { + border: none; +} +#vg-tooltip-element table tr td { + overflow: hidden; + text-overflow: ellipsis; + padding-top: 2px; + padding-bottom: 2px; +} +#vg-tooltip-element table tr td.key { + color: #808080; + max-width: 150px; + text-align: right; + padding-right: 4px; +} +#vg-tooltip-element table tr td.value { + display: block; + max-width: 300px; + max-height: 7em; + text-align: left; +} +#vg-tooltip-element.dark-theme { + background-color: rgba(32, 32, 32, 0.9); + border: 1px solid #f5f5f5; + color: white; +} +#vg-tooltip-element.dark-theme td.key { + color: #bfbfbf; +} +`;const DD="vg-tooltip-element",wJ={offsetX:10,offsetY:10,id:DD,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:SJ,maxDepth:2,formatTooltip:xJ,baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function SJ(e){return String(e).replace(/&/g,"&").replace(/=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function CJ(e,t,n){return e.clientX>=t.x&&e.clientX<=t.x+n.width&&e.clientY>=t.y&&e.clientY<=t.y+n.height}class FJ{call;options;el;constructor(t){this.options={...wJ,...t};const n=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const i=document.createElement("style");i.setAttribute("id",this.options.styleId),i.innerHTML=kJ(n);const r=document.head;r.childNodes.length>0?r.insertBefore(i,r.childNodes[0]):r.appendChild(i)}}tooltipHandler(t,n,i,r){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),(document.fullscreenElement??document.body).appendChild(this.el)),r==null||r===""){this.el.classList.remove("visible",`${this.options.theme}-theme`);return}this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:s,y:o}=this.options.anchor==="mark"?$J(t,n,i,this.el.getBoundingClientRect(),this.options):RD(n,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${o}px`,this.el.style.left=`${s}px`}}var vh={};var OJ=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)r.hasOwnProperty(s)&&(i[s]=r[s])},e(t,n)};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}})(),DJ=Object.prototype.hasOwnProperty;function cg(e,t){return DJ.call(e,t)}function fg(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n=48&&i<=57){t++;continue}return!1}return!0}function Br(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function ND(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function hg(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;t0&&u[c-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&d===void 0&&(l[p]===void 0?d=u.slice(0,c).join("/"):c==f-1&&(d=t.path),d!==void 0&&h(t,0,e,d)),c++,Array.isArray(l)){if(p==="-")p=l.length;else{if(n&&!dg(p))throw new Ne("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,t,e);dg(p)&&(p=~~p)}if(c>=f){if(n&&t.op==="add"&&p>l.length)throw new Ne("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,t,e);var o=_J[t.op].call(t,l,p,e);if(o.test===!1)throw new Ne("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return o}}else if(c>=f){var o=Ys[t.op].call(t,l,p,e);if(o.test===!1)throw new Ne("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return o}if(l=l[p],n&&c0)throw new Ne('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Ne("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Ne("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&hg(e.value))throw new Ne("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n){if(e.op=="add"){var r=e.path.split("/").length,s=i.split("/").length;if(r!==s+1&&r!==s)throw new Ne("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==i)throw new Ne("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if(e.op==="move"||e.op==="copy"){var o={op:"_get",path:e.from,value:void 0},a=LD([o],n);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ne("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}}else throw new Ne("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n)}function LD(e,t,n){try{if(!Array.isArray(e))throw new Ne("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)vd(Ut(t),Ut(e),n||!0);else{n=n||Nc;for(var i=0;i0&&(e.patches=[],e.callback&&e.callback(i)),i}function eb(e,t,n,i,r){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=fg(t),o=fg(e),a=!1,u=o.length-1;u>=0;u--){var l=o[u],c=e[l];if(cg(t,l)&&!(t[l]===void 0&&c!==void 0&&Array.isArray(t)===!1)){var f=t[l];typeof c=="object"&&c!=null&&typeof f=="object"&&f!=null&&Array.isArray(c)===Array.isArray(f)?eb(c,f,n,i+"/"+Br(l),r):c!==f&&(r&&n.push({op:"test",path:i+"/"+Br(l),value:Ut(c)}),n.push({op:"replace",path:i+"/"+Br(l),value:Ut(f)}))}else Array.isArray(e)===Array.isArray(t)?(r&&n.push({op:"test",path:i+"/"+Br(l),value:Ut(c)}),n.push({op:"remove",path:i+"/"+Br(l)}),a=!0):(r&&n.push({op:"test",path:i,value:e}),n.push({op:"replace",path:i,value:t}))}if(!(!a&&s.length==o.length))for(var u=0;u=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(n,i)}return this}}return Eh=e,Eh}var wh,VE;function tb(){if(VE)return wh;VE=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return wh=i=>i?typeof i!="object"?e:i:t,wh}var xl={exports:{}},Sh,XE;function nb(){if(XE)return Sh;XE=1;const e="2.0.0",t=256,n=Number.MAX_SAFE_INTEGER||9007199254740991,i=16,r=t-6;return Sh={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:i,MAX_SAFE_BUILD_LENGTH:r,MAX_SAFE_INTEGER:n,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Sh}var kh,YE;function Ed(){return YE||(YE=1,kh=typeof process=="object"&&vh&&vh.NODE_DEBUG&&/\bsemver\b/i.test(vh.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),kh}var KE;function ib(){return KE||(KE=1,(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:r}=nb(),s=Ed();t=e.exports={};const o=t.re=[],a=t.safeRe=[],u=t.src=[],l=t.safeSrc=[],c=t.t={};let f=0;const d="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",r],[d,i]],h=m=>{for(const[y,b]of p)m=m.split(`${y}*`).join(`${y}{0,${b}}`).split(`${y}+`).join(`${y}{1,${b}}`);return m},g=(m,y,b)=>{const v=h(y),w=f++;s(m,w,y),c[m]=w,u[w]=y,l[w]=v,o[w]=new RegExp(y,b?"g":void 0),a[w]=new RegExp(v,b?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*"),g("NUMERICIDENTIFIERLOOSE","\\d+"),g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),g("MAINVERSION",`(${u[c.NUMERICIDENTIFIER]})\\.(${u[c.NUMERICIDENTIFIER]})\\.(${u[c.NUMERICIDENTIFIER]})`),g("MAINVERSIONLOOSE",`(${u[c.NUMERICIDENTIFIERLOOSE]})\\.(${u[c.NUMERICIDENTIFIERLOOSE]})\\.(${u[c.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASEIDENTIFIER",`(?:${u[c.NONNUMERICIDENTIFIER]}|${u[c.NUMERICIDENTIFIER]})`),g("PRERELEASEIDENTIFIERLOOSE",`(?:${u[c.NONNUMERICIDENTIFIER]}|${u[c.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASE",`(?:-(${u[c.PRERELEASEIDENTIFIER]}(?:\\.${u[c.PRERELEASEIDENTIFIER]})*))`),g("PRERELEASELOOSE",`(?:-?(${u[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[c.PRERELEASEIDENTIFIERLOOSE]})*))`),g("BUILDIDENTIFIER",`${d}+`),g("BUILD",`(?:\\+(${u[c.BUILDIDENTIFIER]}(?:\\.${u[c.BUILDIDENTIFIER]})*))`),g("FULLPLAIN",`v?${u[c.MAINVERSION]}${u[c.PRERELEASE]}?${u[c.BUILD]}?`),g("FULL",`^${u[c.FULLPLAIN]}$`),g("LOOSEPLAIN",`[v=\\s]*${u[c.MAINVERSIONLOOSE]}${u[c.PRERELEASELOOSE]}?${u[c.BUILD]}?`),g("LOOSE",`^${u[c.LOOSEPLAIN]}$`),g("GTLT","((?:<|>)?=?)"),g("XRANGEIDENTIFIERLOOSE",`${u[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),g("XRANGEIDENTIFIER",`${u[c.NUMERICIDENTIFIER]}|x|X|\\*`),g("XRANGEPLAIN",`[v=\\s]*(${u[c.XRANGEIDENTIFIER]})(?:\\.(${u[c.XRANGEIDENTIFIER]})(?:\\.(${u[c.XRANGEIDENTIFIER]})(?:${u[c.PRERELEASE]})?${u[c.BUILD]}?)?)?`),g("XRANGEPLAINLOOSE",`[v=\\s]*(${u[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[c.XRANGEIDENTIFIERLOOSE]})(?:${u[c.PRERELEASELOOSE]})?${u[c.BUILD]}?)?)?`),g("XRANGE",`^${u[c.GTLT]}\\s*${u[c.XRANGEPLAIN]}$`),g("XRANGELOOSE",`^${u[c.GTLT]}\\s*${u[c.XRANGEPLAINLOOSE]}$`),g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),g("COERCE",`${u[c.COERCEPLAIN]}(?:$|[^\\d])`),g("COERCEFULL",u[c.COERCEPLAIN]+`(?:${u[c.PRERELEASE]})?(?:${u[c.BUILD]})?(?:$|[^\\d])`),g("COERCERTL",u[c.COERCE],!0),g("COERCERTLFULL",u[c.COERCEFULL],!0),g("LONETILDE","(?:~>?)"),g("TILDETRIM",`(\\s*)${u[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",g("TILDE",`^${u[c.LONETILDE]}${u[c.XRANGEPLAIN]}$`),g("TILDELOOSE",`^${u[c.LONETILDE]}${u[c.XRANGEPLAINLOOSE]}$`),g("LONECARET","(?:\\^)"),g("CARETTRIM",`(\\s*)${u[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",g("CARET",`^${u[c.LONECARET]}${u[c.XRANGEPLAIN]}$`),g("CARETLOOSE",`^${u[c.LONECARET]}${u[c.XRANGEPLAINLOOSE]}$`),g("COMPARATORLOOSE",`^${u[c.GTLT]}\\s*(${u[c.LOOSEPLAIN]})$|^$`),g("COMPARATOR",`^${u[c.GTLT]}\\s*(${u[c.FULLPLAIN]})$|^$`),g("COMPARATORTRIM",`(\\s*)${u[c.GTLT]}\\s*(${u[c.LOOSEPLAIN]}|${u[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",g("HYPHENRANGE",`^\\s*(${u[c.XRANGEPLAIN]})\\s+-\\s+(${u[c.XRANGEPLAIN]})\\s*$`),g("HYPHENRANGELOOSE",`^\\s*(${u[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[c.XRANGEPLAINLOOSE]})\\s*$`),g("STAR","(<|>)?=?\\s*\\*"),g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(xl,xl.exports)),xl.exports}var $h,JE;function HJ(){if(JE)return $h;JE=1;const e=/^[0-9]+$/,t=(i,r)=>{const s=e.test(i),o=e.test(r);return s&&o&&(i=+i,r=+r),i===r?0:s&&!o?-1:o&&!s?1:it(r,i)},$h}var Ah,QE;function rb(){if(QE)return Ah;QE=1;const e=Ed(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=nb(),{safeRe:i,t:r}=ib(),s=tb(),{compareIdentifiers:o}=HJ();class a{constructor(l,c){if(c=s(c),l instanceof a){if(l.loose===!!c.loose&&l.includePrerelease===!!c.includePrerelease)return l;l=l.version}else if(typeof l!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof l}".`);if(l.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",l,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;const f=l.trim().match(c.loose?i[r.LOOSE]:i[r.FULL]);if(!f)throw new TypeError(`Invalid Version: ${l}`);if(this.raw=l,this.major=+f[1],this.minor=+f[2],this.patch=+f[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");f[4]?this.prerelease=f[4].split(".").map(d=>{if(/^[0-9]+$/.test(d)){const p=+d;if(p>=0&&p=0;)typeof this.prerelease[p]=="number"&&(this.prerelease[p]++,p=-2);if(p===-1){if(c===this.prerelease.join(".")&&f===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(d)}}if(c){let p=[c,d];f===!1&&(p=[c]),o(this.prerelease[0],c)===0?isNaN(this.prerelease[1])&&(this.prerelease=p):this.prerelease=p}break}default:throw new Error(`invalid increment argument: ${l}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Ah=a,Ah}var Ch,ZE;function Qo(){if(ZE)return Ch;ZE=1;const e=rb();return Ch=(n,i,r)=>new e(n,r).compare(new e(i,r)),Ch}var Fh,ew;function VJ(){if(ew)return Fh;ew=1;const e=Qo();return Fh=(n,i,r)=>e(n,i,r)===0,Fh}var Oh,tw;function XJ(){if(tw)return Oh;tw=1;const e=Qo();return Oh=(n,i,r)=>e(n,i,r)!==0,Oh}var Dh,nw;function YJ(){if(nw)return Dh;nw=1;const e=Qo();return Dh=(n,i,r)=>e(n,i,r)>0,Dh}var Rh,iw;function KJ(){if(iw)return Rh;iw=1;const e=Qo();return Rh=(n,i,r)=>e(n,i,r)>=0,Rh}var _h,rw;function JJ(){if(rw)return _h;rw=1;const e=Qo();return _h=(n,i,r)=>e(n,i,r)<0,_h}var Th,sw;function QJ(){if(sw)return Th;sw=1;const e=Qo();return Th=(n,i,r)=>e(n,i,r)<=0,Th}var Nh,ow;function ZJ(){if(ow)return Nh;ow=1;const e=VJ(),t=XJ(),n=YJ(),i=KJ(),r=JJ(),s=QJ();return Nh=(a,u,l,c)=>{switch(u){case"===":return typeof a=="object"&&(a=a.version),typeof l=="object"&&(l=l.version),a===l;case"!==":return typeof a=="object"&&(a=a.version),typeof l=="object"&&(l=l.version),a!==l;case"":case"=":case"==":return e(a,l,c);case"!=":return t(a,l,c);case">":return n(a,l,c);case">=":return i(a,l,c);case"<":return r(a,l,c);case"<=":return s(a,l,c);default:throw new TypeError(`Invalid operator: ${u}`)}},Nh}var Mh,aw;function eQ(){if(aw)return Mh;aw=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(c,f){if(f=n(f),c instanceof t){if(c.loose===!!f.loose)return c;c=c.value}c=c.trim().split(/\s+/).join(" "),o("comparator",c,f),this.options=f,this.loose=!!f.loose,this.parse(c),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(c){const f=this.options.loose?i[r.COMPARATORLOOSE]:i[r.COMPARATOR],d=c.match(f);if(!d)throw new TypeError(`Invalid comparator: ${c}`);this.operator=d[1]!==void 0?d[1]:"",this.operator==="="&&(this.operator=""),d[2]?this.semver=new a(d[2],this.options.loose):this.semver=e}toString(){return this.value}test(c){if(o("Comparator.test",c,this.options.loose),this.semver===e||c===e)return!0;if(typeof c=="string")try{c=new a(c,this.options)}catch{return!1}return s(c,this.operator,this.semver,this.options)}intersects(c,f){if(!(c instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new u(c.value,f).test(this.value):c.operator===""?c.value===""?!0:new u(this.value,f).test(c.semver):(f=n(f),f.includePrerelease&&(this.value==="<0.0.0-0"||c.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||c.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&c.operator.startsWith(">")||this.operator.startsWith("<")&&c.operator.startsWith("<")||this.semver.version===c.semver.version&&this.operator.includes("=")&&c.operator.includes("=")||s(this.semver,"<",c.semver,f)&&this.operator.startsWith(">")&&c.operator.startsWith("<")||s(this.semver,">",c.semver,f)&&this.operator.startsWith("<")&&c.operator.startsWith(">")))}}Mh=t;const n=tb(),{safeRe:i,t:r}=ib(),s=ZJ(),o=Ed(),a=rb(),u=PD();return Mh}var Lh,uw;function PD(){if(uw)return Lh;uw=1;const e=/\s+/g;class t{constructor(O,I){if(I=r(I),O instanceof t)return O.loose===!!I.loose&&O.includePrerelease===!!I.includePrerelease?O:new t(O.raw,I);if(O instanceof s)return this.raw=O.value,this.set=[[O]],this.formatted=void 0,this;if(this.options=I,this.loose=!!I.loose,this.includePrerelease=!!I.includePrerelease,this.raw=O.trim().replace(e," "),this.set=this.raw.split("||").map(W=>this.parseRange(W.trim())).filter(W=>W.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const W=this.set[0];if(this.set=this.set.filter(V=>!g(V[0])),this.set.length===0)this.set=[W];else if(this.set.length>1){for(const V of this.set)if(V.length===1&&m(V[0])){this.set=[V];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let O=0;O0&&(this.formatted+="||");const I=this.set[O];for(let W=0;W0&&(this.formatted+=" "),this.formatted+=I[W].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(O){const W=((this.options.includePrerelease&&p)|(this.options.loose&&h))+":"+O,V=i.get(W);if(V)return V;const H=this.options.loose,Z=H?u[l.HYPHENRANGELOOSE]:u[l.HYPHENRANGE];O=O.replace(Z,ee(this.options.includePrerelease)),o("hyphen replace",O),O=O.replace(u[l.COMPARATORTRIM],c),o("comparator trim",O),O=O.replace(u[l.TILDETRIM],f),o("tilde trim",O),O=O.replace(u[l.CARETTRIM],d),o("caret trim",O);let pe=O.split(" ").map(_e=>b(_e,this.options)).join(" ").split(/\s+/).map(_e=>K(_e,this.options));H&&(pe=pe.filter(_e=>(o("loose invalid filter",_e,this.options),!!_e.match(u[l.COMPARATORLOOSE])))),o("range list",pe);const oe=new Map,ke=pe.map(_e=>new s(_e,this.options));for(const _e of ke){if(g(_e))return[_e];oe.set(_e.value,_e)}oe.size>1&&oe.has("")&&oe.delete("");const ut=[...oe.values()];return i.set(W,ut),ut}intersects(O,I){if(!(O instanceof t))throw new TypeError("a Range is required");return this.set.some(W=>y(W,I)&&O.set.some(V=>y(V,I)&&W.every(H=>V.every(Z=>H.intersects(Z,I)))))}test(O){if(!O)return!1;if(typeof O=="string")try{O=new a(O,this.options)}catch{return!1}for(let I=0;IT.value==="<0.0.0-0",m=T=>T.value==="",y=(T,O)=>{let I=!0;const W=T.slice();let V=W.pop();for(;I&&W.length;)I=W.every(H=>V.intersects(H,O)),V=W.pop();return I},b=(T,O)=>(o("comp",T,O),T=S(T,O),o("caret",T),T=w(T,O),o("tildes",T),T=k(T,O),o("xrange",T),T=P(T,O),o("stars",T),T),v=T=>!T||T.toLowerCase()==="x"||T==="*",w=(T,O)=>T.trim().split(/\s+/).map(I=>E(I,O)).join(" "),E=(T,O)=>{const I=O.loose?u[l.TILDELOOSE]:u[l.TILDE];return T.replace(I,(W,V,H,Z,pe)=>{o("tilde",T,W,V,H,Z,pe);let oe;return v(V)?oe="":v(H)?oe=`>=${V}.0.0 <${+V+1}.0.0-0`:v(Z)?oe=`>=${V}.${H}.0 <${V}.${+H+1}.0-0`:pe?(o("replaceTilde pr",pe),oe=`>=${V}.${H}.${Z}-${pe} <${V}.${+H+1}.0-0`):oe=`>=${V}.${H}.${Z} <${V}.${+H+1}.0-0`,o("tilde return",oe),oe})},S=(T,O)=>T.trim().split(/\s+/).map(I=>x(I,O)).join(" "),x=(T,O)=>{o("caret",T,O);const I=O.loose?u[l.CARETLOOSE]:u[l.CARET],W=O.includePrerelease?"-0":"";return T.replace(I,(V,H,Z,pe,oe)=>{o("caret",T,V,H,Z,pe,oe);let ke;return v(H)?ke="":v(Z)?ke=`>=${H}.0.0${W} <${+H+1}.0.0-0`:v(pe)?H==="0"?ke=`>=${H}.${Z}.0${W} <${H}.${+Z+1}.0-0`:ke=`>=${H}.${Z}.0${W} <${+H+1}.0.0-0`:oe?(o("replaceCaret pr",oe),H==="0"?Z==="0"?ke=`>=${H}.${Z}.${pe}-${oe} <${H}.${Z}.${+pe+1}-0`:ke=`>=${H}.${Z}.${pe}-${oe} <${H}.${+Z+1}.0-0`:ke=`>=${H}.${Z}.${pe}-${oe} <${+H+1}.0.0-0`):(o("no pr"),H==="0"?Z==="0"?ke=`>=${H}.${Z}.${pe}${W} <${H}.${Z}.${+pe+1}-0`:ke=`>=${H}.${Z}.${pe}${W} <${H}.${+Z+1}.0-0`:ke=`>=${H}.${Z}.${pe} <${+H+1}.0.0-0`),o("caret return",ke),ke})},k=(T,O)=>(o("replaceXRanges",T,O),T.split(/\s+/).map(I=>D(I,O)).join(" ")),D=(T,O)=>{T=T.trim();const I=O.loose?u[l.XRANGELOOSE]:u[l.XRANGE];return T.replace(I,(W,V,H,Z,pe,oe)=>{o("xRange",T,W,V,H,Z,pe,oe);const ke=v(H),ut=ke||v(Z),_e=ut||v(pe),Bn=_e;return V==="="&&Bn&&(V=""),oe=O.includePrerelease?"-0":"",ke?V===">"||V==="<"?W="<0.0.0-0":W="*":V&&Bn?(ut&&(Z=0),pe=0,V===">"?(V=">=",ut?(H=+H+1,Z=0,pe=0):(Z=+Z+1,pe=0)):V==="<="&&(V="<",ut?H=+H+1:Z=+Z+1),V==="<"&&(oe="-0"),W=`${V+H}.${Z}.${pe}${oe}`):ut?W=`>=${H}.0.0${oe} <${+H+1}.0.0-0`:_e&&(W=`>=${H}.${Z}.0${oe} <${H}.${+Z+1}.0-0`),o("xRange return",W),W})},P=(T,O)=>(o("replaceStars",T,O),T.trim().replace(u[l.STAR],"")),K=(T,O)=>(o("replaceGTE0",T,O),T.trim().replace(u[O.includePrerelease?l.GTE0PRE:l.GTE0],"")),ee=T=>(O,I,W,V,H,Z,pe,oe,ke,ut,_e,Bn)=>(v(W)?I="":v(V)?I=`>=${W}.0.0${T?"-0":""}`:v(H)?I=`>=${W}.${V}.0${T?"-0":""}`:Z?I=`>=${I}`:I=`>=${I}${T?"-0":""}`,v(ke)?oe="":v(ut)?oe=`<${+ke+1}.0.0-0`:v(_e)?oe=`<${ke}.${+ut+1}.0-0`:Bn?oe=`<=${ke}.${ut}.${_e}-${Bn}`:T?oe=`<${ke}.${ut}.${+_e+1}-0`:oe=`<=${oe}`,`${I} ${oe}`.trim()),ce=(T,O,I)=>{for(let W=0;W0){const V=T[W].semver;if(V.major===O.major&&V.minor===O.minor&&V.patch===O.patch)return!0}return!1}return!0};return Lh}var Ph,lw;function tQ(){if(lw)return Ph;lw=1;const e=PD();return Ph=(n,i,r)=>{try{i=new e(i,r)}catch{return!1}return i.test(n)},Ph}var nQ=tQ(),ID=WJ(nQ);function iQ(e,t,n){const i=e.open(t),r=250,{origin:s}=new URL(t);let o=40;function a(l){l.source===i&&(o=0,e.removeEventListener("message",a,!1))}e.addEventListener("message",a,!1);function u(){o<=0||(i.postMessage(n,s),setTimeout(u,r),o-=1)}setTimeout(u,r)}var rQ=`.vega-embed { + position: relative; + display: inline-block; + box-sizing: border-box; +} +.vega-embed.has-actions { + padding-right: 38px; +} +.vega-embed details:not([open]) > :not(summary) { + display: none !important; +} +.vega-embed summary { + list-style: none; + position: absolute; + top: 0; + right: 0; + padding: 6px; + z-index: 1000; + background: white; + box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1); + color: #1b1e23; + border: 1px solid #aaa; + border-radius: 999px; + opacity: 0.2; + transition: opacity 0.4s ease-in; + cursor: pointer; + line-height: 0px; +} +.vega-embed summary::-webkit-details-marker { + display: none; +} +.vega-embed summary:active { + box-shadow: #aaa 0px 0px 0px 1px inset; +} +.vega-embed summary svg { + width: 14px; + height: 14px; +} +.vega-embed details[open] summary { + opacity: 0.7; +} +.vega-embed:hover summary, .vega-embed:focus-within summary { + opacity: 1 !important; + transition: opacity 0.2s ease; +} +.vega-embed .vega-actions { + position: absolute; + z-index: 1001; + top: 35px; + right: -9px; + display: flex; + flex-direction: column; + padding-bottom: 8px; + padding-top: 8px; + border-radius: 4px; + box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2); + border: 1px solid #d9d9d9; + background: white; + animation-duration: 0.15s; + animation-name: scale-in; + animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5); + text-align: left; +} +.vega-embed .vega-actions a { + padding: 8px 16px; + font-family: sans-serif; + font-size: 14px; + font-weight: 600; + white-space: nowrap; + color: #434a56; + text-decoration: none; +} +.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus { + background-color: #f7f7f9; + color: black; +} +.vega-embed .vega-actions::before, .vega-embed .vega-actions::after { + content: ""; + display: inline-block; + position: absolute; +} +.vega-embed .vega-actions::before { + left: auto; + right: 14px; + top: -16px; + border: 8px solid rgba(0, 0, 0, 0); + border-bottom-color: #d9d9d9; +} +.vega-embed .vega-actions::after { + left: auto; + right: 15px; + top: -14px; + border: 7px solid rgba(0, 0, 0, 0); + border-bottom-color: #fff; +} +.vega-embed .chart-wrapper.fit-x { + width: 100%; +} +.vega-embed .chart-wrapper.fit-y { + height: 100%; +} + +.vega-embed-wrapper { + max-width: 100%; + overflow: auto; + padding-right: 14px; +} + +@keyframes scale-in { + from { + opacity: 0; + transform: scale(0.6); + } + to { + opacity: 1; + transform: scale(1); + } +} +`;function zD(e,...t){for(const n of t)sQ(e,n);return e}function sQ(e,t){for(const n of Object.keys(t))To(e,n,t[n],!0)}const qn=zU;let uu=TK;const cw=typeof window<"u"?window:void 0;uu===void 0&&cw?.vl?.compile&&(uu=cw.vl);const oQ={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},aQ={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},Da={vega:"Vega","vega-lite":"Vega-Lite"},Mc={vega:qn.version,"vega-lite":uu?uu.version:"not available"},uQ={vega:e=>e,"vega-lite":(e,t,n)=>uu.compile(e,{config:n,logger:t}).spec},lQ=` + + + + +`,cQ="chart-wrapper";function fQ(e){return typeof e=="function"}function fw(e,t,n,i){const r=`${t}
          `,s=`
          ${n}`,o=window.open("");o.document.write(r+e+s),o.document.title=`${Da[i]} JSON Source`}function dQ(e,t,n){if(e.$schema){const i=CD(e.$schema);n&&n!==i.library&&t.warn(`The given visualization spec is written in ${Da[i.library]}, but mode argument sets ${Da[n]??n}.`);const r=i.library;return ID(Mc[r],`^${i.version.slice(1)}`)||t.warn(`The input spec uses ${Da[r]} ${i.version}, but the current version of ${Da[r]} is v${Mc[r]}.`),r}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":n??"vega"}function BD(e){return!!(e&&"load"in e)}function dw(e){return BD(e)?e:qn.loader(e)}function hQ(e){const t=e.usermeta?.embedOptions??{};return j(t.defaultStyle)&&(t.defaultStyle=!1),t}async function dZ(e,t,n={}){let i,r;j(t)?(r=dw(n.loader),i=JSON.parse(await r.load(t))):i=t;const s=hQ(i),o=s.loader;(!r||o)&&(r=dw(n.loader??o));const a=await hw(s,r),u=await hw(n,r),l={...zD(u,a),config:_o(u.config??{},a.config??{})};return await gQ(e,i,l,r)}async function hw(e,t){const n=j(e.config)?JSON.parse(await t.load(e.config)):e.config??{},i=j(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...i?{patch:i}:{},...n?{config:n}:{}}}function pQ(e){const t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}async function gQ(e,t,n={},i){const r=n.theme?_o(bJ[n.theme],n.config??{}):n.config,s=bs(n.actions)?n.actions:zD({},oQ,n.actions??{}),o={...aQ,...n.i18n},a=n.renderer??"svg",u=n.logger??Lc(qn.Warn);n.logLevel!==void 0&&u.level(n.logLevel);const l=n.downloadFileName??"visualization",c=typeof e=="string"?document.querySelector(e):e;if(!c)throw new Error(`${e} does not exist`);if(n.defaultStyle!==!1){const E="vega-embed-style",{root:S,rootContainer:x}=pQ(c);if(!S.getElementById(E)){const k=document.createElement("style");k.id=E,k.innerHTML=n.defaultStyle===void 0||n.defaultStyle===!0?rQ.toString():n.defaultStyle,x.appendChild(k)}}const f=dQ(t,u,n.mode);let d=uQ[f](t,u,r);if(f==="vega-lite"&&d.$schema){const E=CD(d.$schema);ID(Mc.vega,`^${E.version.slice(1)}`)||u.warn(`The compiled spec uses Vega ${E.version}, but current version is v${Mc.vega}.`)}c.classList.add("vega-embed"),s&&c.classList.add("has-actions"),c.innerHTML="";let p=c;if(s){const E=document.createElement("div");E.classList.add(cQ),c.appendChild(E),p=E}const h=n.patch;if(h&&(d=h instanceof Function?h(d):vd(d,h,!0,!1).newDocument),n.formatLocale&&qn.formatLocale(n.formatLocale),n.timeFormatLocale&&qn.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(const E in n.expressionFunctions){const S=n.expressionFunctions[E];"fn"in S?qn.expressionFunction(E,S.fn,S.visitor):S instanceof Function&&qn.expressionFunction(E,S)}const{ast:g}=n,m=qn.parse(d,f==="vega-lite"?{}:r,{ast:g}),y=new(n.viewClass||qn.View)(m,{loader:i,logger:u,renderer:a,...g?{expr:qn.expressionInterpreter??n.expr??YU}:{}});if(y.addSignalListener("autosize",(E,S)=>{const{type:x}=S;x=="fit-x"?(p.classList.add("fit-x"),p.classList.remove("fit-y")):x=="fit-y"?(p.classList.remove("fit-x"),p.classList.add("fit-y")):x=="fit"?p.classList.add("fit-x","fit-y"):p.classList.remove("fit-x","fit-y")}),n.tooltip!==!1){const{loader:E,tooltip:S}=n,x=E&&!BD(E)?E?.baseURL:void 0,k=fQ(S)?S:new FJ({baseURL:x,...S===!0?{}:S}).call;y.tooltip(k)}let{hover:b}=n;if(b===void 0&&(b=f==="vega"),b){const{hoverSet:E,updateSet:S}=typeof b=="boolean"?{}:b;y.hover(E,S)}n&&(n.width!=null&&y.width(n.width),n.height!=null&&y.height(n.height),n.padding!=null&&y.padding(n.padding)),await y.initialize(p,n.bind).runAsync();let v;if(s!==!1){let E=c;if(n.defaultStyle!==!1||n.forceActionsMenu){const x=document.createElement("details");x.title=o.CLICK_TO_VIEW_ACTIONS,c.append(x),E=x;const k=document.createElement("summary");k.innerHTML=lQ,x.append(k),v=D=>{x.contains(D.target)||x.removeAttribute("open")},document.addEventListener("click",v)}const S=document.createElement("div");if(E.append(S),S.classList.add("vega-actions"),s===!0||s.export!==!1){for(const x of["svg","png"])if(s===!0||s.export===!0||s.export[x]){const k=o[`${x.toUpperCase()}_ACTION`],D=document.createElement("a"),P=U(n.scaleFactor)?n.scaleFactor[x]:n.scaleFactor;D.text=k,D.href="#",D.target="_blank",D.download=`${l}.${x}`,D.addEventListener("mousedown",async function(K){K.preventDefault();const ee=await y.toImageURL(x,P);this.href=ee}),S.append(D)}}if(s===!0||s.source!==!1){const x=document.createElement("a");x.text=o.SOURCE_ACTION,x.href="#",x.addEventListener("click",function(k){fw(wd(t),n.sourceHeader??"",n.sourceFooter??"",f),k.preventDefault()}),S.append(x)}if(f==="vega-lite"&&(s===!0||s.compiled!==!1)){const x=document.createElement("a");x.text=o.COMPILED_ACTION,x.href="#",x.addEventListener("click",function(k){fw(wd(d),n.sourceHeader??"",n.sourceFooter??"","vega"),k.preventDefault()}),S.append(x)}if(s===!0||s.editor!==!1){const x=n.editorUrl??"https://vega.github.io/editor/",k=document.createElement("a");k.text=o.EDITOR_ACTION,k.href="#",k.addEventListener("click",function(D){iQ(window,x,{config:r,mode:h?"vega":f,renderer:a,spec:wd(h?d:t)}),D.preventDefault()}),S.append(k)}}function w(){v&&document.removeEventListener("click",v),y.finalize()}return{view:y,spec:t,vgSpec:d,finalize:w,embedOptions:n}}export{oQ as DEFAULT_ACTIONS,dZ as default,dQ as guessMode,qn as vega,uu as vegaLite}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/engine.multiRender-DvoXejHB.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/engine.multiRender-DvoXejHB.js new file mode 100644 index 0000000000000000000000000000000000000000..60f5726eaa8026a0c76fa8b6fb6d447c20be8076 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/engine.multiRender-DvoXejHB.js @@ -0,0 +1 @@ +import{L as V,I as X}from"./index-CDrXokXW.js";import{WebGPUEngine as f}from"./webgpuEngine-C4n6cvIQ.js";import"./index-DWyDLubb.js";import"./instancesVertex-CO_CTxxp.js";import"./bakedVertexAnimation-DoavwM49.js";import"./instancesDeclaration-DZdrWbmN.js";import"./helperFunctions-CZpZ-EbL.js";import"./fresnelFunction-cCRUtTOI.js";import"./meshUboDeclaration-Bk1ASTX2.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./decalFragment-iGkmQ-pm.js";import"./audioEngine-C797_5QL.js";f.prototype.unBindMultiColorAttachmentFramebuffer=function(t,e=!1,n){n&&n(),this._endCurrentRenderPass(),t.disableAutomaticMSAAResolve||this.resolveMultiFramebuffer(t,!1),e||this.generateMipMapsMultiFramebuffer(t),this._currentRenderTarget=null,this._mrtAttachments=[],this._cacheRenderPipeline.setMRT([]),this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments)};f.prototype.createMultipleRenderTarget=function(t,e,n){let a=!1,l=!0,i=!1,m=!1,c=15,g=1,o=1;const U=0,v=3,H=!1,k=5,N=3553;let x=[],T=[],M=[],_=[],y=[],R=[],b=[],S=[],F=[],A=[],d=!1;const u=this._createHardwareRenderTargetWrapper(!0,!1,t);e!==void 0&&(a=e.generateMipMaps??!1,l=e.generateDepthBuffer??!0,i=e.generateStencilBuffer??!1,m=e.generateDepthTexture??!1,g=e.textureCount??1,c=e.depthTextureFormat??15,x=e.types||x,T=e.samplingModes||T,M=e.useSRGBBuffers||M,_=e.formats||_,y=e.targetTypes||y,R=e.faceIndex||R,b=e.layerIndex||b,S=e.layerCounts||S,F=e.labels||F,A=e.creationFlags||A,o=e.samples??o,d=e.dontCreateTextures??!1);const D=t.width??t,G=t.height??t,B=[],I=[],P=[];u.label=e?.label??"MultiRenderTargetWrapper",u._generateDepthBuffer=l,u._generateStencilBuffer=i,u._attachments=I,u._defaultAttachments=P;let h=null;(l||i||m)&&!d&&(m||(l&&i?c=13:l?c=14:c=19),h=u.createDepthStencilTexture(0,!1,i,1,c,u.label+"-DepthStencil"));const w=e!==void 0&&typeof e=="object"&&e.createMipMaps&&!a;for(let s=0;s;uniform shadowOpacity : f32;uniform renderTargetSize: vec2;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {let uvBasedOpacity=1.0-pow(clamp(length(input.vUV*vec2(2.0)-vec2(1.0)),0.0,1.0),2.0);let screenUv=fragmentInputs.position.xy/uniforms.renderTargetSize;let shadowValue=textureSampleLevel(shadowTexture,shadowTextureSampler,screenUv,0.0).rrr;let totalOpacity=uniforms.shadowOpacity*uvBasedOpacity;let finalShadowValue=mix(vec3(1.0),shadowValue,totalOpacity);let invertedShadowValue=vec3(1.0)-shadowValue;fragmentOutputs.color=vec4f(finalShadowValue,invertedShadowValue.r*totalOpacity);}`;a.ShadersStoreWGSL[e]||(a.ShadersStoreWGSL[e]=t);const n={name:e,shader:t};export{n as envShadowGroundPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/envShadowGround.fragment-L1sPCORS-CJ6Fvma3.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/envShadowGround.fragment-L1sPCORS-CJ6Fvma3.js new file mode 100644 index 0000000000000000000000000000000000000000..870d7aea5e01ef3eeac6ad71248b56244483c356 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/envShadowGround.fragment-L1sPCORS-CJ6Fvma3.js @@ -0,0 +1 @@ +import{S as a}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="envShadowGroundPixelShader",r="precision highp float;uniform sampler2D shadowTexture;uniform vec2 renderTargetSize;uniform float shadowOpacity;varying vec2 vUV;void main(void) {float uvBasedOpacity=clamp(length(vUV*vec2(2.0)-vec2(1.0)),0.0,1.0);uvBasedOpacity=uvBasedOpacity*uvBasedOpacity;uvBasedOpacity=1.0-uvBasedOpacity;vec2 screenUv=gl_FragCoord.xy/renderTargetSize;vec3 shadowValue=texture2D(shadowTexture,screenUv).rrr;float totalOpacity=shadowOpacity*uvBasedOpacity;vec3 invertedShadowValue=vec3(1.0)-shadowValue;gl_FragColor.rgb=shadowValue;gl_FragColor.a=invertedShadowValue.r*totalOpacity;}";a.ShadersStore[e]||(a.ShadersStore[e]=r);const d={name:e,shader:r};export{d as envShadowGroundPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/envShadowGround.vertex-6NXvyWvr-C08bpIyH.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/envShadowGround.vertex-6NXvyWvr-C08bpIyH.js new file mode 100644 index 0000000000000000000000000000000000000000..31af538c6cea1b1e516ead4c3468245e0dc9b5ae --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/envShadowGround.vertex-6NXvyWvr-C08bpIyH.js @@ -0,0 +1 @@ +import{S as e}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const o="envShadowGroundVertexShader",r="precision highp float;attribute vec3 position;attribute vec2 uv;uniform mat4 worldViewProjection;varying vec2 vUV;void main(void) {gl_Position=worldViewProjection*vec4(position,1.0);vUV=uv;}";e.ShadersStore[o]||(e.ShadersStore[o]=r);const n={name:o,shader:r};export{n as envShadowGroundVertexShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/envShadowGround.vertex-oRlsSdho-CnFcyQnS.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/envShadowGround.vertex-oRlsSdho-CnFcyQnS.js new file mode 100644 index 0000000000000000000000000000000000000000..3c320b6ec7b688494654f0327d9af4bb204db540 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/envShadowGround.vertex-oRlsSdho-CnFcyQnS.js @@ -0,0 +1,2 @@ +import{S as e}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const t="envShadowGroundVertexShader",r=`attribute position: vec3f;attribute uv: vec2f;uniform viewProjection: mat4x4f;uniform worldViewProjection: mat4x4f;varying vUV: vec2f;@vertex +fn main(input : VertexInputs)->FragmentInputs {vertexOutputs.position=uniforms.worldViewProjection*vec4f(input.position,1.0);vertexOutputs.vUV=input.uv;}`;e.ShadersStoreWGSL[t]||(e.ShadersStoreWGSL[t]=r);const i={name:t,shader:r};export{i as envShadowGroundVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/envTextureLoader-Dy75k5v5.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/envTextureLoader-Dy75k5v5.js new file mode 100644 index 0000000000000000000000000000000000000000..25cef95f64249ceaccf855c4a4075ff23b6b8c25 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/envTextureLoader-Dy75k5v5.js @@ -0,0 +1 @@ +import{G as l,U as t,a as r}from"./environmentTextureTools-BFR5JSi6.js";import"./index-DWyDLubb.js";import"./index-CDrXokXW.js";import"./dumpTools-C3pGK_mZ.js";class m{constructor(){this.supportCascades=!1}loadCubeData(o,a,p,s,n){if(Array.isArray(o))return;const e=l(o);if(e){a.width=e.width,a.height=e.width;try{t(a,e),r(a,o,e).then(()=>{a.isReady=!0,a.onLoadedObservable.notifyObservers(a),a.onLoadedObservable.clear(),s&&s()},i=>{n?.("Can not upload environment levels",i)})}catch(i){n?.("Can not upload environment file",i)}}else n&&n("Can not parse the environment file",null)}loadData(){throw".env not supported in 2d."}}export{m as _ENVTextureLoader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/environmentTextureTools-BFR5JSi6.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/environmentTextureTools-BFR5JSi6.js new file mode 100644 index 0000000000000000000000000000000000000000..16d3ce3553f44561728fd095ab6aae7554767916 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/environmentTextureTools-BFR5JSi6.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./rgbdDecode.fragment-DhHWySqi.js","./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./helperFunctions-CZpZ-EbL.js","./rgbdDecode.fragment-CAQSGKQb.js","./helperFunctions-BkWNqKeI.js"])))=>i.map(i=>d[i]); +import{af as F}from"./index-DWyDLubb.js";import{L as P,ay as z,V as d,I as C,B as O,d as G,az as V,aA as k}from"./index-CDrXokXW.js";import"./dumpTools-C3pGK_mZ.js";const v="image/png",E=2,S=[134,22,135,150,246,214,150,54];function J(e){const n=new DataView(e.buffer,e.byteOffset,e.byteLength);let r=0;for(let o=0;oE)throw new Error(`Unsupported babylon environment map version "${e.version}". Latest supported version is "${E}".`);return e.version===2||(e={...e,version:2,imageType:v}),e}function H(e,n){n=R(n);const r=n.specular;let t=Math.log2(n.width);if(t=Math.round(t)+1,r.mipmaps.length!==6*t)throw new Error(`Unsupported specular mipmaps number "${r.mipmaps.length}"`);const i=new Array(t);for(let a=0;a{if(r){const g=n.createTexture(null,!0,!0,null,1,null,s=>{I(s)},e);t?.onEffectCreatedObservable.addOnce(s=>{s.executeWhenCompiled(()=>{t.externalTextureSamplerBinding=!0,t.onApply=c=>{c._bindTexture("textureSampler",g),c.setFloat2("scale",1,n._features.needsInvertingBitmap&&e instanceof ImageBitmap?-1:1)},n.scenes.length&&(n.scenes[0].postProcessManager.directRender([t],m,!0,a,o),n.restoreDefaultFramebuffer(),g.dispose(),URL.revokeObjectURL(i),y())})})}else{if(n._uploadImageToTexture(w,e,a,o),l){const g=p[o];g&&n._uploadImageToTexture(g._texture,e,a,0)}y()}})}async function D(e,n,r=v){const t=e.getEngine();e.format=5,e.type=0,e.generateMipMaps=!0,e._cachedAnisotropicFilteringLevel=null,t.updateTextureSamplingMode(3,e),await B(e,n,!0,r),e.isReady=!0}async function $(e,n,r,t=v,i=null){const a=e.getEngine(),o=new C(a,5),l=new O(a,o);e._irradianceTexture=l,l._dominantDirection=i,o.isCube=!0,o.format=5,o.type=0,o.generateMipMaps=!0,o._cachedAnisotropicFilteringLevel=null,o.generateMipMaps=!0,o.width=r,o.height=r,a.updateTextureSamplingMode(3,o),await B(o,[n],!1,t),a.generateMipMapsForCubemap(o),o.isReady=!0}async function B(e,n,r,t=v){if(!G.IsExponentOfTwo(e.width))throw new Error("Texture size must be a power of two");const i=V(e.width)+1,a=e.getEngine();let o=!1,l=!1,p=null,m=null,w=null;const y=a.getCaps();y.textureLOD?a._features.supportRenderAndCopyToLodForFloatTextures?y.textureHalfFloatRender&&y.textureHalfFloatLinearFiltering?(o=!0,e.type=2):y.textureFloatRender&&y.textureFloatLinearFiltering&&(o=!0,e.type=1):o=!1:(o=!1,l=r);let I=0;if(o)a.isWebGPU?(I=1,await F(()=>import("./rgbdDecode.fragment-DhHWySqi.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url)):await F(()=>import("./rgbdDecode.fragment-CAQSGKQb.js"),__vite__mapDeps([5,1,2,3,6]),import.meta.url),p=new k("rgbdDecode","rgbdDecode",null,null,1,null,3,a,!1,void 0,e.type,void 0,null,!1,void 0,I),e._isRGBD=!1,e.invertY=!1,m=a.createRenderTargetCubeTexture(e.width,{generateDepthBuffer:!1,generateMipMaps:!0,generateStencilBuffer:!1,samplingMode:3,type:e.type,format:5});else if(e._isRGBD=!0,e.invertY=!0,l){w={};const c=e._lodGenerationScale,_=e._lodGenerationOffset;for(let u=0;u<3;u++){const b=1-u/2,f=_,L=(i-1)*c+_,M=f+(L-f)*b,A=Math.round(Math.min(Math.max(M,0),L)),x=new C(a,2);x.isCube=!0,x.invertY=!0,x.generateMipMaps=!1,a.updateTextureSamplingMode(2,x);const T=new O(null);switch(T._isCube=!0,T._texture=x,w[A]=T,u){case 0:e._lodTextureLow=T;break;case 1:e._lodTextureMid=T;break;case 2:e._lodTextureHigh=T;break}}}const g=[];for(let s=0;sawait U(f,a,o,p,h,c,s,l,w,m,e));else{const f=new Image;f.src=h,b=new Promise((L,M)=>{f.onload=()=>{U(f,a,o,p,h,c,s,l,w,m,e).then(()=>L()).catch(A=>{M(A)})},f.onerror=A=>{M(A)}})}g.push(b)}if(await Promise.all(g),n.lengthe);return e.onRebuildCallback=l=>({proxy:o,isReady:!0,isAsync:!0}),e._source=13,e._bufferViewArrayArray=n,e._lodGenerationScale=t,e._lodGenerationOffset=i,e._sphericalPolynomial=r,D(e,n).then(()=>(e.isReady=!0,e))}export{J as G,K as U,Q as _,q as a}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/erDiagram-Q2GNP2WA-BA7V4EyD.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/erDiagram-Q2GNP2WA-BA7V4EyD.js new file mode 100644 index 0000000000000000000000000000000000000000..a093ee3a22d957f199ebcb0e4390414c1b2d6237 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/erDiagram-Q2GNP2WA-BA7V4EyD.js @@ -0,0 +1,60 @@ +import{g as vt}from"./chunk-55IACEB6-d9HCWWHk.js";import{s as Dt}from"./chunk-QN33PNHL-w0eYMV5T.js";import{_ as l,b as wt,a as Vt,s as Lt,g as Mt,p as Bt,q as Ft,c as $,l as D,y as Yt,x as Pt,A as zt,B as Gt,o as Kt,r as Zt,u as Ut}from"./mermaid.core-7TB2QPZo.js";import{c as jt}from"./channel-CA-Tyyit.js";import{s as Wt}from"./select-BigU4G0v.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";var ut=(function(){var e=l(function(N,n,a,c){for(a=a||{},c=N.length;c--;a[N[c]]=n);return a},"o"),i=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,50],d=[1,10],o=[1,11],h=[1,12],p=[1,13],R=[1,20],g=[1,21],m=[1,22],w=[1,23],K=[1,24],k=[1,19],tt=[1,25],Z=[1,26],S=[1,18],V=[1,33],et=[1,34],st=[1,35],it=[1,36],rt=[1,37],dt=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,50,63,64,65,66,67],T=[1,42],O=[1,43],L=[1,52],M=[40,50,68,69],B=[1,63],F=[1,61],A=[1,58],Y=[1,62],P=[1,64],U=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,63,64,65,66,67],pt=[63,64,65,66,67],ft=[1,81],yt=[1,80],_t=[1,78],gt=[1,79],bt=[6,10,42,47],C=[6,10,13,41,42,47,48,49],j=[1,89],W=[1,88],Q=[1,87],z=[19,56],mt=[1,98],Et=[1,97],nt=[19,56,58,60],at={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,attribute:51,attributeType:52,attributeName:53,attributeKeyTypeList:54,attributeComment:55,ATTRIBUTE_WORD:56,attributeKeyType:57,",":58,ATTRIBUTE_KEY:59,COMMENT:60,cardinality:61,relType:62,ZERO_OR_ONE:63,ZERO_OR_MORE:64,ONE_OR_MORE:65,ONLY_ONE:66,MD_PARENT:67,NON_IDENTIFYING:68,IDENTIFYING:69,WORD:70,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:"COLON",15:"STYLE_SEPARATOR",17:"BLOCK_START",19:"BLOCK_STOP",20:"SQS",21:"SQE",22:"title",23:"title_value",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"direction_tb",34:"direction_bt",35:"direction_rl",36:"direction_lr",37:"CLASSDEF",40:"UNICODE_TEXT",41:"STYLE_TEXT",42:"COMMA",43:"CLASS",44:"STYLE",47:"SEMI",48:"NUM",49:"BRKT",50:"ENTITY_NAME",56:"ATTRIBUTE_WORD",58:",",59:"ATTRIBUTE_KEY",60:"COMMENT",63:"ZERO_OR_ONE",64:"ZERO_OR_MORE",65:"ONE_OR_MORE",66:"ONLY_ONE",67:"MD_PARENT",68:"NON_IDENTIFYING",69:"IDENTIFYING",70:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[18,1],[18,2],[51,2],[51,3],[51,3],[51,4],[52,1],[53,1],[54,1],[54,3],[57,1],[55,1],[12,3],[61,1],[61,1],[61,1],[61,1],[61,1],[62,1],[62,1],[14,1],[14,1],[14,1]],performAction:l(function(n,a,c,r,u,t,G){var s=t.length-1;switch(u){case 1:break;case 2:this.$=[];break;case 3:t[s-1].push(t[s]),this.$=t[s-1];break;case 4:case 5:this.$=t[s];break;case 6:case 7:this.$=[];break;case 8:r.addEntity(t[s-4]),r.addEntity(t[s-2]),r.addRelationship(t[s-4],t[s],t[s-2],t[s-3]);break;case 9:r.addEntity(t[s-8]),r.addEntity(t[s-4]),r.addRelationship(t[s-8],t[s],t[s-4],t[s-5]),r.setClass([t[s-8]],t[s-6]),r.setClass([t[s-4]],t[s-2]);break;case 10:r.addEntity(t[s-6]),r.addEntity(t[s-2]),r.addRelationship(t[s-6],t[s],t[s-2],t[s-3]),r.setClass([t[s-6]],t[s-4]);break;case 11:r.addEntity(t[s-6]),r.addEntity(t[s-4]),r.addRelationship(t[s-6],t[s],t[s-4],t[s-5]),r.setClass([t[s-4]],t[s-2]);break;case 12:r.addEntity(t[s-3]),r.addAttributes(t[s-3],t[s-1]);break;case 13:r.addEntity(t[s-5]),r.addAttributes(t[s-5],t[s-1]),r.setClass([t[s-5]],t[s-3]);break;case 14:r.addEntity(t[s-2]);break;case 15:r.addEntity(t[s-4]),r.setClass([t[s-4]],t[s-2]);break;case 16:r.addEntity(t[s]);break;case 17:r.addEntity(t[s-2]),r.setClass([t[s-2]],t[s]);break;case 18:r.addEntity(t[s-6],t[s-4]),r.addAttributes(t[s-6],t[s-1]);break;case 19:r.addEntity(t[s-8],t[s-6]),r.addAttributes(t[s-8],t[s-1]),r.setClass([t[s-8]],t[s-3]);break;case 20:r.addEntity(t[s-5],t[s-3]);break;case 21:r.addEntity(t[s-7],t[s-5]),r.setClass([t[s-7]],t[s-2]);break;case 22:r.addEntity(t[s-3],t[s-1]);break;case 23:r.addEntity(t[s-5],t[s-3]),r.setClass([t[s-5]],t[s]);break;case 24:case 25:this.$=t[s].trim(),r.setAccTitle(this.$);break;case 26:case 27:this.$=t[s].trim(),r.setAccDescription(this.$);break;case 32:r.setDirection("TB");break;case 33:r.setDirection("BT");break;case 34:r.setDirection("RL");break;case 35:r.setDirection("LR");break;case 36:this.$=t[s-3],r.addClass(t[s-2],t[s-1]);break;case 37:case 38:case 56:case 64:this.$=[t[s]];break;case 39:case 40:this.$=t[s-2].concat([t[s]]);break;case 41:this.$=t[s-2],r.setClass(t[s-1],t[s]);break;case 42:this.$=t[s-3],r.addCssStyles(t[s-2],t[s-1]);break;case 43:this.$=[t[s]];break;case 44:t[s-2].push(t[s]),this.$=t[s-2];break;case 46:this.$=t[s-1]+t[s];break;case 54:case 76:case 77:this.$=t[s].replace(/"/g,"");break;case 55:case 78:this.$=t[s];break;case 57:t[s].push(t[s-1]),this.$=t[s];break;case 58:this.$={type:t[s-1],name:t[s]};break;case 59:this.$={type:t[s-2],name:t[s-1],keys:t[s]};break;case 60:this.$={type:t[s-2],name:t[s-1],comment:t[s]};break;case 61:this.$={type:t[s-3],name:t[s-2],keys:t[s-1],comment:t[s]};break;case 62:case 63:case 66:this.$=t[s];break;case 65:t[s-2].push(t[s]),this.$=t[s-2];break;case 67:this.$=t[s].replace(/"/g,"");break;case 68:this.$={cardA:t[s],relType:t[s-1],cardB:t[s-2]};break;case 69:this.$=r.Cardinality.ZERO_OR_ONE;break;case 70:this.$=r.Cardinality.ZERO_OR_MORE;break;case 71:this.$=r.Cardinality.ONE_OR_MORE;break;case 72:this.$=r.Cardinality.ONLY_ONE;break;case 73:this.$=r.Cardinality.MD_PARENT;break;case 74:this.$=r.Identification.NON_IDENTIFYING;break;case 75:this.$=r.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(i,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:d,24:o,26:h,28:p,29:14,30:15,31:16,32:17,33:R,34:g,35:m,36:w,37:K,40:k,43:tt,44:Z,50:S},e(i,[2,7],{1:[2,1]}),e(i,[2,3]),{9:27,11:9,22:d,24:o,26:h,28:p,29:14,30:15,31:16,32:17,33:R,34:g,35:m,36:w,37:K,40:k,43:tt,44:Z,50:S},e(i,[2,5]),e(i,[2,6]),e(i,[2,16],{12:28,61:32,15:[1,29],17:[1,30],20:[1,31],63:V,64:et,65:st,66:it,67:rt}),{23:[1,38]},{25:[1,39]},{27:[1,40]},e(i,[2,27]),e(i,[2,28]),e(i,[2,29]),e(i,[2,30]),e(i,[2,31]),e(dt,[2,54]),e(dt,[2,55]),e(i,[2,32]),e(i,[2,33]),e(i,[2,34]),e(i,[2,35]),{16:41,40:T,41:O},{16:44,40:T,41:O},{16:45,40:T,41:O},e(i,[2,4]),{11:46,40:k,50:S},{16:47,40:T,41:O},{18:48,19:[1,49],51:50,52:51,56:L},{11:53,40:k,50:S},{62:54,68:[1,55],69:[1,56]},e(M,[2,69]),e(M,[2,70]),e(M,[2,71]),e(M,[2,72]),e(M,[2,73]),e(i,[2,24]),e(i,[2,25]),e(i,[2,26]),{13:B,38:57,41:F,42:A,45:59,46:60,48:Y,49:P},e(U,[2,37]),e(U,[2,38]),{16:65,40:T,41:O,42:A},{13:B,38:66,41:F,42:A,45:59,46:60,48:Y,49:P},{13:[1,67],15:[1,68]},e(i,[2,17],{61:32,12:69,17:[1,70],42:A,63:V,64:et,65:st,66:it,67:rt}),{19:[1,71]},e(i,[2,14]),{18:72,19:[2,56],51:50,52:51,56:L},{53:73,56:[1,74]},{56:[2,62]},{21:[1,75]},{61:76,63:V,64:et,65:st,66:it,67:rt},e(pt,[2,74]),e(pt,[2,75]),{6:ft,10:yt,39:77,42:_t,47:gt},{40:[1,82],41:[1,83]},e(bt,[2,43],{46:84,13:B,41:F,48:Y,49:P}),e(C,[2,45]),e(C,[2,50]),e(C,[2,51]),e(C,[2,52]),e(C,[2,53]),e(i,[2,41],{42:A}),{6:ft,10:yt,39:85,42:_t,47:gt},{14:86,40:j,50:W,70:Q},{16:90,40:T,41:O},{11:91,40:k,50:S},{18:92,19:[1,93],51:50,52:51,56:L},e(i,[2,12]),{19:[2,57]},e(z,[2,58],{54:94,55:95,57:96,59:mt,60:Et}),e([19,56,59,60],[2,63]),e(i,[2,22],{15:[1,100],17:[1,99]}),e([40,50],[2,68]),e(i,[2,36]),{13:B,41:F,45:101,46:60,48:Y,49:P},e(i,[2,47]),e(i,[2,48]),e(i,[2,49]),e(U,[2,39]),e(U,[2,40]),e(C,[2,46]),e(i,[2,42]),e(i,[2,8]),e(i,[2,76]),e(i,[2,77]),e(i,[2,78]),{13:[1,102],42:A},{13:[1,104],15:[1,103]},{19:[1,105]},e(i,[2,15]),e(z,[2,59],{55:106,58:[1,107],60:Et}),e(z,[2,60]),e(nt,[2,64]),e(z,[2,67]),e(nt,[2,66]),{18:108,19:[1,109],51:50,52:51,56:L},{16:110,40:T,41:O},e(bt,[2,44],{46:84,13:B,41:F,48:Y,49:P}),{14:111,40:j,50:W,70:Q},{16:112,40:T,41:O},{14:113,40:j,50:W,70:Q},e(i,[2,13]),e(z,[2,61]),{57:114,59:mt},{19:[1,115]},e(i,[2,20]),e(i,[2,23],{17:[1,116],42:A}),e(i,[2,11]),{13:[1,117],42:A},e(i,[2,10]),e(nt,[2,65]),e(i,[2,18]),{18:118,19:[1,119],51:50,52:51,56:L},{14:120,40:j,50:W,70:Q},{19:[1,121]},e(i,[2,21]),e(i,[2,9]),e(i,[2,19])],defaultActions:{52:[2,62],72:[2,57]},parseError:l(function(n,a){if(a.recoverable)this.trace(n);else{var c=new Error(n);throw c.hash=a,c}},"parseError"),parse:l(function(n){var a=this,c=[0],r=[],u=[null],t=[],G=this.table,s="",q=0,kt=0,Rt=2,St=1,xt=t.slice.call(arguments,1),f=Object.create(this.lexer),x={yy:{}};for(var ct in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ct)&&(x.yy[ct]=this.yy[ct]);f.setInput(n,x.yy),x.yy.lexer=f,x.yy.parser=this,typeof f.yylloc>"u"&&(f.yylloc={});var ot=f.yylloc;t.push(ot);var It=f.options&&f.options.ranges;typeof x.yy.parseError=="function"?this.parseError=x.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ct(_){c.length=c.length-2*_,u.length=u.length-_,t.length=t.length-_}l(Ct,"popStack");function Tt(){var _;return _=r.pop()||f.lex()||St,typeof _!="number"&&(_ instanceof Array&&(r=_,_=r.pop()),_=a.symbols_[_]||_),_}l(Tt,"lex");for(var y,I,b,lt,v={},H,E,Ot,J;;){if(I=c[c.length-1],this.defaultActions[I]?b=this.defaultActions[I]:((y===null||typeof y>"u")&&(y=Tt()),b=G[I]&&G[I][y]),typeof b>"u"||!b.length||!b[0]){var ht="";J=[];for(H in G[I])this.terminals_[H]&&H>Rt&&J.push("'"+this.terminals_[H]+"'");f.showPosition?ht="Parse error on line "+(q+1)+`: +`+f.showPosition()+` +Expecting `+J.join(", ")+", got '"+(this.terminals_[y]||y)+"'":ht="Parse error on line "+(q+1)+": Unexpected "+(y==St?"end of input":"'"+(this.terminals_[y]||y)+"'"),this.parseError(ht,{text:f.match,token:this.terminals_[y]||y,line:f.yylineno,loc:ot,expected:J})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+I+", token: "+y);switch(b[0]){case 1:c.push(y),u.push(f.yytext),t.push(f.yylloc),c.push(b[1]),y=null,kt=f.yyleng,s=f.yytext,q=f.yylineno,ot=f.yylloc;break;case 2:if(E=this.productions_[b[1]][1],v.$=u[u.length-E],v._$={first_line:t[t.length-(E||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(E||1)].first_column,last_column:t[t.length-1].last_column},It&&(v._$.range=[t[t.length-(E||1)].range[0],t[t.length-1].range[1]]),lt=this.performAction.apply(v,[s,kt,q,x.yy,b[1],u,t].concat(xt)),typeof lt<"u")return lt;E&&(c=c.slice(0,-1*E*2),u=u.slice(0,-1*E),t=t.slice(0,-1*E)),c.push(this.productions_[b[1]][0]),u.push(v.$),t.push(v._$),Ot=G[c[c.length-2]][c[c.length-1]],c.push(Ot);break;case 3:return!0}}return!0},"parse")},Nt=(function(){var N={EOF:1,parseError:l(function(a,c){if(this.yy.parser)this.yy.parser.parseError(a,c);else throw new Error(a)},"parseError"),setInput:l(function(n,a){return this.yy=a||this.yy||{},this._input=n,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var n=this._input[0];this.yytext+=n,this.yyleng++,this.offset++,this.match+=n,this.matched+=n;var a=n.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),n},"input"),unput:l(function(n){var a=n.length,c=n.split(/(?:\r\n?|\n)/g);this._input=n+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===r.length?this.yylloc.first_column:0)+r[r.length-c.length].length-c[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(n){this.unput(this.match.slice(n))},"less"),pastInput:l(function(){var n=this.matched.substr(0,this.matched.length-this.match.length);return(n.length>20?"...":"")+n.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var n=this.match;return n.length<20&&(n+=this._input.substr(0,20-n.length)),(n.substr(0,20)+(n.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var n=this.pastInput(),a=new Array(n.length+1).join("-");return n+this.upcomingInput()+` +`+a+"^"},"showPosition"),test_match:l(function(n,a){var c,r,u;if(this.options.backtrack_lexer&&(u={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(u.yylloc.range=this.yylloc.range.slice(0))),r=n[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+n[0].length},this.yytext+=n[0],this.match+=n[0],this.matches=n,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(n[0].length),this.matched+=n[0],c=this.performAction.call(this,this.yy,this,a,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var t in u)this[t]=u[t];return!1}return!1},"test_match"),next:l(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var n,a,c,r;this._more||(this.yytext="",this.match="");for(var u=this._currentRules(),t=0;ta[0].length)){if(a=c,r=t,this.options.backtrack_lexer){if(n=this.test_match(c,u[t]),n!==!1)return n;if(this._backtrack){a=!1;continue}else return!1}else if(!this.options.flex)break}return a?(n=this.test_match(a,u[r]),n!==!1?n:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:l(function(){var a=this.next();return a||this.lex()},"lex"),begin:l(function(a){this.conditionStack.push(a)},"begin"),popState:l(function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:l(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:l(function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},"topState"),pushState:l(function(a){this.begin(a)},"pushState"),stateStackSize:l(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:l(function(a,c,r,u){switch(r){case 0:return this.begin("acc_title"),24;case 1:return this.popState(),"acc_title_value";case 2:return this.begin("acc_descr"),26;case 3:return this.popState(),"acc_descr_value";case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return 33;case 8:return 34;case 9:return 35;case 10:return 36;case 11:return 10;case 12:break;case 13:return 8;case 14:return 50;case 15:return 70;case 16:return 4;case 17:return this.begin("block"),17;case 18:return 49;case 19:return 49;case 20:return 42;case 21:return 15;case 22:return 13;case 23:break;case 24:return 59;case 25:return 56;case 26:return 56;case 27:return 60;case 28:break;case 29:return this.popState(),19;case 30:return c.yytext[0];case 31:return 20;case 32:return 21;case 33:return this.begin("style"),44;case 34:return this.popState(),10;case 35:break;case 36:return 13;case 37:return 42;case 38:return 49;case 39:return this.begin("style"),37;case 40:return 43;case 41:return 63;case 42:return 65;case 43:return 65;case 44:return 65;case 45:return 63;case 46:return 63;case 47:return 64;case 48:return 64;case 49:return 64;case 50:return 64;case 51:return 64;case 52:return 65;case 53:return 64;case 54:return 65;case 55:return 66;case 56:return 66;case 57:return 66;case 58:return 66;case 59:return 63;case 60:return 64;case 61:return 65;case 62:return 67;case 63:return 68;case 64:return 69;case 65:return 69;case 66:return 68;case 67:return 68;case 68:return 68;case 69:return 41;case 70:return 47;case 71:return 40;case 72:return 48;case 73:return c.yytext[0];case 74:return 6}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"%\r\n\v\b\\]+")/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:#)/i,/^(?:#)/i,/^(?:,)/i,/^(?::::)/i,/^(?::)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i,/^(?:([^\s]*)[~].*[~]([^\s]*))/i,/^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\u00C0-\uFFFF\*]*))/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:style\b)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?::)/i,/^(?:,)/i,/^(?:#)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:one or zero\b)/i,/^(?:one or more\b)/i,/^(?:one or many\b)/i,/^(?:1\+)/i,/^(?:\|o\b)/i,/^(?:zero or one\b)/i,/^(?:zero or more\b)/i,/^(?:zero or many\b)/i,/^(?:0\+)/i,/^(?:\}o\b)/i,/^(?:many\(0\))/i,/^(?:many\(1\))/i,/^(?:many\b)/i,/^(?:\}\|)/i,/^(?:one\b)/i,/^(?:only one\b)/i,/^(?:1\b)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:\s*u\b)/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:to\b)/i,/^(?:optionally to\b)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:([^\x00-\x7F]|\w|-|\*)+)/i,/^(?:;)/i,/^(?:([^\x00-\x7F]|\w|-|\*)+)/i,/^(?:[0-9])/i,/^(?:.)/i,/^(?:$)/i],conditions:{style:{rules:[34,35,36,37,38,69,70],inclusive:!1},acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},block:{rules:[23,24,25,26,27,28,29,30],inclusive:!1},INITIAL:{rules:[0,2,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,31,32,33,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,71,72,73,74],inclusive:!0}}};return N})();at.lexer=Nt;function X(){this.yy={}}return l(X,"Parser"),X.prototype=at,at.Parser=X,new X})();ut.parser=ut;var Qt=ut,Xt=class{constructor(){this.entities=new Map,this.relationships=[],this.classes=new Map,this.direction="TB",this.Cardinality={ZERO_OR_ONE:"ZERO_OR_ONE",ZERO_OR_MORE:"ZERO_OR_MORE",ONE_OR_MORE:"ONE_OR_MORE",ONLY_ONE:"ONLY_ONE",MD_PARENT:"MD_PARENT"},this.Identification={NON_IDENTIFYING:"NON_IDENTIFYING",IDENTIFYING:"IDENTIFYING"},this.setAccTitle=wt,this.getAccTitle=Vt,this.setAccDescription=Lt,this.getAccDescription=Mt,this.setDiagramTitle=Bt,this.getDiagramTitle=Ft,this.getConfig=l(()=>$().er,"getConfig"),this.clear(),this.addEntity=this.addEntity.bind(this),this.addAttributes=this.addAttributes.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setDirection=this.setDirection.bind(this),this.addCssStyles=this.addCssStyles.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}static{l(this,"ErDB")}addEntity(e,i=""){return this.entities.has(e)?!this.entities.get(e)?.alias&&i&&(this.entities.get(e).alias=i,D.info(`Add alias '${i}' to entity '${e}'`)):(this.entities.set(e,{id:`entity-${e}-${this.entities.size}`,label:e,attributes:[],alias:i,shape:"erBox",look:$().look??"default",cssClasses:"default",cssStyles:[]}),D.info("Added new entity :",e)),this.entities.get(e)}getEntity(e){return this.entities.get(e)}getEntities(){return this.entities}getClasses(){return this.classes}addAttributes(e,i){const d=this.addEntity(e);let o;for(o=i.length-1;o>=0;o--)i[o].keys||(i[o].keys=[]),i[o].comment||(i[o].comment=""),d.attributes.push(i[o]),D.debug("Added attribute ",i[o].name)}addRelationship(e,i,d,o){const h=this.entities.get(e),p=this.entities.get(d);if(!h||!p)return;const R={entityA:h.id,roleA:i,entityB:p.id,relSpec:o};this.relationships.push(R),D.debug("Added new relationship :",R)}getRelationships(){return this.relationships}getDirection(){return this.direction}setDirection(e){this.direction=e}getCompiledStyles(e){let i=[];for(const d of e){const o=this.classes.get(d);o?.styles&&(i=[...i,...o.styles??[]].map(h=>h.trim())),o?.textStyles&&(i=[...i,...o.textStyles??[]].map(h=>h.trim()))}return i}addCssStyles(e,i){for(const d of e){const o=this.entities.get(d);if(!i||!o)return;for(const h of i)o.cssStyles.push(h)}}addClass(e,i){e.forEach(d=>{let o=this.classes.get(d);o===void 0&&(o={id:d,styles:[],textStyles:[]},this.classes.set(d,o)),i&&i.forEach(function(h){if(/color/.exec(h)){const p=h.replace("fill","bgFill");o.textStyles.push(p)}o.styles.push(h)})})}setClass(e,i){for(const d of e){const o=this.entities.get(d);if(o)for(const h of i)o.cssClasses+=" "+h}}clear(){this.entities=new Map,this.classes=new Map,this.relationships=[],Yt()}getData(){const e=[],i=[],d=$();for(const h of this.entities.keys()){const p=this.entities.get(h);p&&(p.cssCompiledStyles=this.getCompiledStyles(p.cssClasses.split(" ")),e.push(p))}let o=0;for(const h of this.relationships){const p={id:Pt(h.entityA,h.entityB,{prefix:"id",counter:o++}),type:"normal",curve:"basis",start:h.entityA,end:h.entityB,label:h.roleA,labelpos:"c",thickness:"normal",classes:"relationshipLine",arrowTypeStart:h.relSpec.cardB.toLowerCase(),arrowTypeEnd:h.relSpec.cardA.toLowerCase(),pattern:h.relSpec.relType=="IDENTIFYING"?"solid":"dashed",look:d.look};i.push(p)}return{nodes:e,edges:i,other:{},config:d,direction:"TB"}}},At={};Gt(At,{draw:()=>qt});var qt=l(async function(e,i,d,o){D.info("REF0:"),D.info("Drawing er diagram (unified)",i);const{securityLevel:h,er:p,layout:R}=$(),g=o.db.getData(),m=vt(i,h);g.type=o.type,g.layoutAlgorithm=Kt(R),g.config.flowchart.nodeSpacing=p?.nodeSpacing||140,g.config.flowchart.rankSpacing=p?.rankSpacing||80,g.direction=o.db.getDirection(),g.markers=["only_one","zero_or_one","one_or_more","zero_or_more"],g.diagramId=i,await Zt(g,m),g.layoutAlgorithm==="elk"&&m.select(".edges").lower();const w=m.selectAll('[id*="-background"]');Array.from(w).length>0&&w.each(function(){const k=Wt(this),Z=k.attr("id").replace("-background",""),S=m.select(`#${CSS.escape(Z)}`);if(!S.empty()){const V=S.attr("transform");k.attr("transform",V)}});const K=8;Ut.insertTitle(m,"erDiagramTitleText",p?.titleTopMargin??25,o.db.getDiagramTitle()),Dt(m,K,"erDiagram",p?.useMaxWidth??!0)},"draw"),Ht=l((e,i)=>{const d=jt,o=d(e,"r"),h=d(e,"g"),p=d(e,"b");return zt(o,h,p,i)},"fade"),Jt=l(e=>` + .entityBox { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + } + + .relationshipLabelBox { + fill: ${e.tertiaryColor}; + opacity: 0.7; + background-color: ${e.tertiaryColor}; + rect { + opacity: 0.5; + } + } + + .labelBkg { + background-color: ${Ht(e.tertiaryColor,.5)}; + } + + .edgeLabel .label { + fill: ${e.nodeBorder}; + font-size: 14px; + } + + .label { + font-family: ${e.fontFamily}; + color: ${e.nodeTextColor||e.textColor}; + } + + .edge-pattern-dashed { + stroke-dasharray: 8,8; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon + { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + stroke-width: 1px; + } + + .relationshipLine { + stroke: ${e.lineColor}; + stroke-width: 1; + fill: none; + } + + .marker { + fill: none !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; + } +`,"getStyles"),$t=Jt,le={parser:Qt,get db(){return new Xt},renderer:At,styles:$t};export{le as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/es-5B0rLSyK.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/es-5B0rLSyK.js new file mode 100644 index 0000000000000000000000000000000000000000..e95708b772aa0e6f2708d34858aba55df517d151 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/es-5B0rLSyK.js @@ -0,0 +1 @@ +const a="Español",o={annotated_image:"Imagen Anotada"},e={allow_recording_access:"Por favor, permita el acceso al micrófono para grabar.",audio:"Audio",record_from_microphone:"Grabar desde el micrófono",stop_recording:"Detener grabación",no_device_support:"No se pudo acceder a los dispositivos multimedia. Compruebe que está ejecutando en un origen seguro (https) o localhost (o que ha pasado un certificado SSL válido a ssl_verify), y que ha permitido el acceso del navegador a su dispositivo.",stop:"Detener",resume:"Reanudar",record:"Grabar",no_microphone:"No se encontró micrófono",pause:"Pausar",play:"Reproducir",waiting:"Esperando",drop_to_upload:"Arrastra un archivo de audio aquí para subirlo"},r={connection_can_break:"En dispositivos móviles, la conexión puede interrumpirse si esta pestaña pierde el foco o el dispositivo entra en reposo, perdiendo su posición en la cola.",long_requests_queue:"Hay una larga cola de solicitudes pendientes. Duplique este Space para saltarse la cola.",lost_connection:"Se perdió la conexión al abandonar la página. Volviendo a la cola...",waiting_for_inputs:"Esperando a que se complete(n) la(s) carga(s) de archivo(s), por favor inténtelo de nuevo."},i={checkbox:"Casilla de verificación",checkbox_group:"Grupo de casillas"},n={code:"Código"},c={color_picker:"Selector de color"},l={built_with:"construido con",built_with_gradio:"Construido con Gradio",clear:"Limpiar",download:"Descargar",edit:"Editar",empty:"Vacío",error:"Error",flag:"Marcar",hosted_on:"Alojado en",loading:"Cargando",logo:"logo",or:"o",remove:"Eliminar",settings:"Configuración",share:"Compartir",submit:"Enviar",undo:"Deshacer",no_devices:"No se encontraron dispositivos",language:"Idioma",display_theme:"Tema de visualización",pwa:"Aplicación web progresiva"},s={incorrect_format:"Formato incorrecto, solo se admiten archivos CSV y TSV",new_column:"Agregar columna",new_row:"Nueva fila",add_row_above:"Agregar fila arriba",add_row_below:"Agregar fila abajo",add_column_left:"Agregar columna a la izquierda",add_column_right:"Agregar columna a la derecha",delete_row:"Eliminar fila",delete_column:"Eliminar columna",sort_column:"Ordenar columna",sort_ascending:"Ordenar ascendente",sort_descending:"Ordenar descendente",drop_to_upload:"Arrastra y suelta los archivos CSV o TSV aquí para importar datos al dataframe",clear_sort:"Limpiar ordenamiento"},d={dropdown:"Menú desplegable"},t={build_error:"hay un error de compilación",config_error:"hay un error de configuración",contact_page_author:"Por favor, contacte al autor de la página para informarle.",no_app_file:"no hay archivo de aplicación",runtime_error:"hay un error de ejecución",space_not_working:'"El Space no funciona porque" {0}',space_paused:"el space está pausado",use_via_api:"Usar vía API",use_via_api_or_mcp:"Usar vía API o MCP"},u={uploading:"Subiendo..."},p={highlighted_text:"Texto resaltado"},_={allow_webcam_access:"Por favor, permita el acceso a la cámara web para grabar.",brush_color:"Color del pincel",brush_radius:"Radio del pincel",image:"Imagen",remove_image:"Eliminar imagen",select_brush_color:"Seleccionar color del pincel",start_drawing:"Empezar a dibujar",use_brush:"Usar pincel",drop_to_upload:"Arrastra un archivo de imagen aquí para subirlo"},g={label:"Etiqueta"},m={enable_cookies:"Si está visitando un Space de HuggingFace en modo Incógnito, debe habilitar las cookies de terceros.",incorrect_credentials:"Credenciales incorrectas",username:"usuario",password:"contraseña",login:"Iniciar sesión"},b={number:"Número"},h={plot:"Gráfico"},v={radio:"Radio"},f={slider:"Deslizador"},q={click_to_upload:"Haga clic para cargar",drop_audio:"Coloque el audio aquí",drop_csv:"Coloque el CSV aquí",drop_file:"Coloque el archivo aquí",drop_image:"Coloque la imagen aquí",drop_video:"Coloque el video aquí",drop_gallery:"Coloque las imágenes aquí",paste_clipboard:"Pegar desde el portapapeles"},w={drop_to_upload:"Arrastra un archivo de video aquí para subirlo"},C={edit:"Editar",retry:"Reintentar",undo:"Deshacer",submit:"Enviar",cancel:"Cancelar",like:"Me gusta",dislike:"No me gusta",clear:"Limpiar chat"},y={_name:a,"3D_model":{"3d_model":"Modelo 3D",drop_to_upload:"Arrastra y suelta un archivo de modelo 3D (.obj, .glb, .stl, .gltf, .splat o .ply) aquí para cargarlo."},annotated_image:o,audio:e,blocks:r,checkbox:i,code:n,color_picker:c,common:l,dataframe:s,dropdown:d,errors:t,file:u,highlighted_text:p,image:_,label:g,login:m,number:b,plot:h,radio:v,slider:f,upload_text:q,video:w,chatbot:C};export{a as _name,o as annotated_image,e as audio,r as blocks,C as chatbot,i as checkbox,n as code,c as color_picker,l as common,s as dataframe,y as default,d as dropdown,t as errors,u as file,p as highlighted_text,_ as image,g as label,m as login,b as number,h as plot,v as radio,f as slider,q as upload_text,w as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/eu-FEV4b8Yc.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/eu-FEV4b8Yc.js new file mode 100644 index 0000000000000000000000000000000000000000..b7c43eac2bed7ce1a3ff3abd52f8fb3e7e41cad9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/eu-FEV4b8Yc.js @@ -0,0 +1 @@ +const a="Euskara",e={annotated_image:"Irudi Erantsia"},o={allow_recording_access:"Mesedez, baimendu mikrofonoaren sarbidea grabatzeko.",audio:"Audioa",record_from_microphone:"Mikrofonotik grabatu",stop_recording:"Grabaketa gelditu",no_device_support:"Ezin izan da multimedia gailuetara sartu. Ziurtatu jatorri seguru batean (https) edo localhost-en exekutatzen ari zarela (edo SSL ziurtagiri baliozkoa eman diozula ssl_verify-ri), eta nabigatzaileari zure gailura sarbidea eman diozula.",stop:"Gelditu",resume:"Jarraitu",record:"Grabatu",no_microphone:"Ez da mikrofonorik aurkitu",pause:"Pausatu",play:"Erreproduzitu",waiting:"Itxaroten",drop_to_upload:"Arrastatu audio fitxategia hemen igotzeko"},t={connection_can_break:"Mugikorretan, konexioa eten daiteke fitxa honek fokua galtzen badu edo gailua lokartu egiten bada, ilaran duzun posizioa galduz.",long_requests_queue:"Eskaera ilara luzea dago zain. Space hau bikoiztu saltatzeko.",lost_connection:"Konexioa galdu da orria uzteagatik. Ilarara itzultzen...",waiting_for_inputs:"Itxaron fitxategiak igo arte, saiatu berriro mesedez"},i={checkbox:"Kontrol-laukia",checkbox_group:"Kontrol-laukien taldea"},r={code:"Kodea"},n={color_picker:"Kolore hautatzailea"},u={built_with:"honekin eraikia",built_with_gradio:"Gradio-rekin eraikia",clear:"Garbitu",download:"Deskargatu",edit:"Editatu",empty:"Hutsik",error:"Errorea",hosted_on:"Ostatatuta",loading:"Kargatzen",logo:"logoa",or:"edo",remove:"Kendu",settings:"Ezarpenak",share:"Partekatu",submit:"Bidali",undo:"Desegin",no_devices:"Ez da gailurik aurkitu",language:"Hizkuntza",display_theme:"Bistaratze gaia",pwa:"Web Aplikazio Aurreratua"},d={incorrect_format:"Formatu okerra, CSV eta TSV fitxategiak soilik onartzen dira",new_column:"Zutabea gehitu",new_row:"Errenkada berria",add_row_above:"Errenkada gehitu gainean",add_row_below:"Errenkada gehitu azpian",add_column_left:"Zutabea gehitu ezkerrean",add_column_right:"Zutabea gehitu eskuinean",delete_row:"Ezabatu errenkila",delete_column:"Ezabatu zutabea",sort_column:"Ordenatu zutabea",sort_ascending:"Behetik gorako ordena",sort_descending:"Goitik beherako ordena",drop_to_upload:"Arrastatu CSV edo TSV fitxategiak hemen datuak dataframe-an inportatzeko",clear_sort:"Garbitu ordena"},l={dropdown:"Goitibeherako menua"},s={build_error:"eraikitze errore bat dago",config_error:"konfigurazio errore bat dago",contact_page_author:"Mesedez, jarri harremanetan orriaren egilearekin jakinarazteko.",no_app_file:"ez dago aplikazio fitxategirik",runtime_error:"exekuzio errore bat dago",space_not_working:'"Space-a ez dabil honako arrazoi honengatik:" {0}',space_paused:"space-a pausatuta dago",use_via_api:"API bidez erabili"},k={uploading:"Igotzen..."},g={highlighted_text:"Nabarmendutako testua"},c={allow_webcam_access:"Mesedez, baimendu web-kameraren sarbidea grabatzeko.",brush_color:"Pintzelaren kolorea",brush_radius:"Pintzelaren tamaina",image:"Irudia",remove_image:"Irudia kendu",select_brush_color:"Aukeratu pintzelaren kolorea",start_drawing:"Hasi marrazten",use_brush:"Pintzela erabili",drop_to_upload:"Arrastatu irudi fitxategia hemen igotzeko"},_={label:"Etiketa"},z={enable_cookies:"HuggingFace Space bat Inkognito moduan bisitatzen ari bazara, hirugarrenen cookieak gaitu behar dituzu.",incorrect_credentials:"Kredentzial okerrak",username:"erabiltzaile izena",password:"pasahitza",login:"Saioa hasi"},b={number:"Zenbakia"},p={plot:"Grafikoa"},m={radio:"Aukera botoia"},h={slider:"Graduatzailea"},f={click_to_upload:"Klikatu igotzeko",drop_audio:"Utzi audioa hemen",drop_csv:"Utzi CSV-a hemen",drop_file:"Utzi fitxategia hemen",drop_image:"Utzi irudia hemen",drop_video:"Utzi bideoa hemen",drop_gallery:"Utzi multimedia hemen",paste_clipboard:"Itsatsi arbeleko edukia"},x={drop_to_upload:"Arrastatu bideo fitxategia hemen igotzeko"},w={edit:"Editatu",retry:"Saiatu berriro",undo:"Desegin",submit:"Bidali",cancel:"Utzi",like:"Gustuko dut",dislike:"Ez dut gustuko",clear:"Garbitu txata"},E={_name:a,"3D_model":{"3d_model":"3D Modeloa",drop_to_upload:"Arrastatu 3D modelo bat (.obj, .glb, .stl, .gltf, .splat edo .ply) igotzeko."},annotated_image:e,audio:o,blocks:t,checkbox:i,code:r,color_picker:n,common:u,dataframe:d,dropdown:l,errors:s,file:k,highlighted_text:g,image:c,label:_,login:z,number:b,plot:p,radio:m,slider:h,upload_text:f,video:x,chatbot:w};export{a as _name,e as annotated_image,o as audio,t as blocks,w as chatbot,i as checkbox,r as code,n as color_picker,u as common,d as dataframe,E as default,l as dropdown,s as errors,k as file,g as highlighted_text,c as image,_ as label,z as login,b as number,p as plot,m as radio,h as slider,f as upload_text,x as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/event-modifiers-CdEA5IGF.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/event-modifiers-CdEA5IGF.js new file mode 100644 index 0000000000000000000000000000000000000000..ba323f89f73149b3862d9e2c33eec2358aa95d8c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/event-modifiers-CdEA5IGF.js @@ -0,0 +1 @@ +function r(n){return function(...t){var e=t[0];return e.stopPropagation(),n?.apply(this,t)}}function p(n){return function(...t){var e=t[0];return e.preventDefault(),n?.apply(this,t)}}export{p,r as s}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/exrTextureLoader-BpOmAN3q.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/exrTextureLoader-BpOmAN3q.js new file mode 100644 index 0000000000000000000000000000000000000000..363aba2426ac2ae08ce84a6a68ccfcf4f87086b2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/exrTextureLoader-BpOmAN3q.js @@ -0,0 +1 @@ +import{aB as vn,L as B,d as Y}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const an=4,K=4,sn=1,N=2,bn=8,H=65536,d=H>>3,gn=16,T=14,D=(1<>-i-14,l[a|256]=1024>>-i-14|32768,r[a]=-i-1,r[a|256]=-i-1):i<=15?(l[a]=i+15<<10,l[a|256]=i+15<<10|32768,r[a]=13,r[a|256]=13):i<128?(l[a]=31744,l[a|256]=64512,r[a]=24,r[a|256]=24):(l[a]=31744,l[a|256]=64512,r[a]=13,r[a|256]=13)}const c=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let a=1;a<1024;++a){let i=a<<13,u=0;for(;(i&8388608)===0;)i<<=1,u-=8388608;i&=-8388609,u+=947912704,c[a]=i|u}for(let a=1024;a<2048;++a)c[a]=939524096+(a-1024<<13);for(let a=1;a<31;++a)s[a]=a<<23;s[31]=1199570944,s[32]=2147483648;for(let a=33;a<63;++a)s[a]=2147483648+(a-32<<23);s[63]=3347054592;for(let a=1;a<64;++a)a!==32&&(o[a]=1024);return{floatView:t,uint32View:e,baseTable:l,shiftTable:r,mantissaTable:c,exponentTable:s,offsetTable:o}}function J(n,t){const e=new Uint8Array(n);let l=0;for(;e[t.value+l]!=0;)l+=1;const r=new TextDecoder().decode(e.slice(t.value,t.value+l));return t.value=t.value+l+1,r}function U(n,t){const e=n.getInt32(t.value,!0);return t.value+=an,e}function m(n,t){const e=n.getUint32(t.value,!0);return t.value+=an,e}function W(n,t){const e=n.getUint8(t.value);return t.value+=sn,e}function Z(n,t){const e=n.getUint16(t.value,!0);return t.value+=N,e}function on(n,t){const e=n[t.value];return t.value+=sn,e}function On(n,t){let e;return"getBigInt64"in DataView.prototype?e=Number(n.getBigInt64(t.value,!0)):e=n.getUint32(t.value+4,!0)+Number(n.getUint32(t.value,!0)<<32),t.value+=bn,e}function b(n,t){const e=n.getFloat32(t.value,!0);return t.value+=K,e}function Pn(n,t){return Un(Z(n,t))}function Un(n){const t=(n&31744)>>10,e=n&1023;return(n>>15?-1:1)*(t?t===31?e?NaN:1/0:Math.pow(2,t-15)*(1+e/1024):6103515625e-14*(e/1024))}function Rn(n){if(Math.abs(n)>65504)throw new Error("Value out of range.Consider using float instead of half-float.");n=vn(n,-65504,65504),z.floatView[0]=n;const t=z.uint32View[0],e=t>>23&511;return z.baseTable[e]+((t&8388607)>>z.shiftTable[e])}function mn(n,t){return Rn(b(n,t))}function Tn(n,t,e){const l=new TextDecoder().decode(new Uint8Array(n).slice(t.value,t.value+e));return t.value=t.value+e,l}function Cn(n,t){const e=U(n,t),l=m(n,t);return[e,l]}function _n(n,t){const e=m(n,t),l=m(n,t);return[e,l]}function Nn(n,t){const e=b(n,t),l=b(n,t);return[e,l]}function Mn(n,t){const e=b(n,t),l=b(n,t),r=b(n,t);return[e,l,r]}function Fn(n,t,e){const l=t.value,r=[];for(;t.valuec||(t[r++]=n[e++],r>c));)t[r++]=n[l++]}const Hn=20000630;function pn(n,t){if(n.getUint32(0,!0)!=Hn)throw new Error("Incorrect OpenEXR format");const e=n.getUint8(4),l=n.getUint8(5),r={singleTile:!!(l&2),longName:!!(l&4),deepFormat:!!(l&8),multiPart:!!(l&16)};t.value=8;const c={};let s=!0;for(;s;){const o=J(n.buffer,t);if(!o)s=!1;else{const a=J(n.buffer,t),i=m(n,t),u=Bn(n,t,a,i);u===void 0?B.Warn(`Unknown header attribute type ${a}'.`):c[o]=u}}if((l&-5)!=0)throw new Error("Unsupported file format");return{version:e,spec:r,...c}}const fn=16,Zn=1<>3]&1<<(r&7))&&(t[e++]=r);const l=e-1;for(;e>e&(1<>l;if(i=new Uint8Array([i])[0],o.value+i>a)return null;const u=s[o.value-1];for(;i-- >0;)s[o.value++]=u}else if(o.value0;--e){const l=t+F[e]>>1;F[e]=t,t=l}for(let e=0;e0&&(n[e]=l|F[l]++<<6)}}function Xn(n,t,e,l,r,c){const s=t;let o=0,a=0;for(;l<=r;l++){if(s.value-t.value>e)return;let i=en(6,o,a,n,s);const u=i.l;if(o=i.c,a=i.lc,c[l]=u,u==cn){if(s.value-t.value>e)throw new Error("Error in HufUnpackEncTable");i=en(8,o,a,n,s);let p=i.l+In;if(o=i.c,a=i.lc,l+p>r+1)throw new Error("Error in HufUnpackEncTable");for(;p--;)c[l++]=0;l--}else if(u>=q){let p=u-q+2;if(l+p>r+1)throw new Error("Error in HufUnpackEncTable");for(;p--;)c[l++]=0;l--}}Yn(c)}function wn(n){return n&63}function yn(n){return n>>6}function Kn(n,t,e,l){for(;t<=e;t++){const r=yn(n[t]),c=wn(n[t]);if(r>>c)throw new Error("Invalid table entry");if(c>T){const s=l[r>>c-T];if(s.len)throw new Error("Invalid table entry");if(s.lit++,s.p){const o=s.p;s.p=new Array(s.lit);for(let a=0;a0;o--){const a=l[(r<=T;){const w=i>>u-T&nn,y=t[w];if(y.len){u-=y.len;const f=X(y.lit,c,i,u,e,l,o,a,p);f&&(i=f.c,u=f.lc)}else{if(!y.p)throw new Error("hufDecode issues");let f;for(f=0;f=v&&yn(n[y.p[f]])==(i>>u-v&(1<>=I,u-=I;u>0;){const h=t[i<=D||i<0||i>=D)throw new Error("Wrong HUF_ENCSIZE");const p=new Array(D),x=new Array(j);Gn(x);const I=l-(e.value-o);if(Xn(n,e,I,a,i,p),u>8*(l-(e.value-o)))throw new Error("Wrong hufUncompress");Kn(p,a,i,x),qn(p,x,n,e,u,i,c,r,s)}function V(n){return n&65535}function rn(n){const t=V(n);return t>32767?t-65536:t}function C(n,t){const e=rn(n),r=rn(t),c=e+(r&1)+(r>>1),s=c,o=c-r;return{a:s,b:o}}function _(n,t){const e=V(n),l=V(t),r=e-(l>>1)&tn;return{a:l+r-Zn&tn,b:r}}function Jn(n,t,e,l,r,c,s){const o=s<16384,a=e>r?r:e;let i=1,u,p;for(;i<=a;)i<<=1;for(i>>=1,u=i,i>>=1;i>=1;){p=0;const x=p+c*(r-u),I=c*i,h=c*u,w=l*i,y=l*u;let f,v,O,k;for(;p<=x;p+=h){let S=p;const G=p+l*(e-u);for(;S<=G;S+=y){const A=S+w,g=S+I,L=g+w;if(o){let E=C(n[S+t],n[g+t]);f=E.a,O=E.b,E=C(n[A+t],n[L+t]),v=E.a,k=E.b,E=C(f,v),n[S+t]=E.a,n[A+t]=E.b,E=C(O,k),n[g+t]=E.a,n[L+t]=E.b}else{let E=_(n[S+t],n[g+t]);f=E.a,O=E.b,E=_(n[A+t],n[L+t]),v=E.a,k=E.b,E=_(f,v),n[S+t]=E.a,n[A+t]=E.b,E=_(O,k),n[g+t]=E.a,n[L+t]=E.b}}if(e&i){const A=S+I;let g;o?g=C(n[S+t],n[A+t]):g=_(n[S+t],n[A+t]),f=g.a,n[A+t]=g.b,n[S+t]=f}}if(r&i){let S=p;const G=p+l*(e-u);for(;S<=G;S+=y){const A=S+w;let g;o?g=C(n[S+t],n[A+t]):g=_(n[S+t],n[A+t]),f=g.a,n[A+t]=g.b,n[S+t]=f}}u=i,i>>=1}return p}function Qn(n,t,e){for(let l=0;l0;){const c=r.getInt8(l++);if(c<0){const s=-c;t-=s+1;for(let o=0;o=d)throw new Error("Wrong PIZ_COMPRESSION BITMAP_SIZE");if(o<=a)for(let h=0;h0,bytesPerLine:0,outLineWidth:0,lines:0,scanlineBlockSize:0,inputSize:null,type:0,uncompress:null,getter:()=>0,format:5,outputChannels:0,decodeChannels:{},blockCount:null,byteArray:null,linearSpace:!1,textureType:0};switch(n.compression){case R.NO_COMPRESSION:r.lines=1,r.uncompress=En;break;case R.RLE_COMPRESSION:r.lines=1,r.uncompress=jn;break;case R.ZIPS_COMPRESSION:r.lines=1,r.uncompress=ln,await Y.LoadScriptAsync(M.FFLATEUrl);break;case R.ZIP_COMPRESSION:r.lines=16,r.uncompress=ln,await Y.LoadScriptAsync(M.FFLATEUrl);break;case R.PIZ_COMPRESSION:r.lines=32,r.uncompress=nt;break;case R.PXR24_COMPRESSION:r.lines=16,r.uncompress=dn,await Y.LoadScriptAsync(M.FFLATEUrl);break;default:throw new Error(R[n.compression]+" is unsupported")}r.scanlineBlockSize=r.lines;const c={};for(const i of n.channels)switch(i.name){case"R":case"G":case"B":case"A":c[i.name]=!0,r.type=i.pixelType;break;case"Y":c[i.name]=!0,r.type=i.pixelType;break}let s=!1;if(c.R&&c.G&&c.B&&c.A)r.outputChannels=4,r.decodeChannels={R:0,G:1,B:2,A:3};else if(c.R&&c.G&&c.B)s=!0,r.outputChannels=4,r.decodeChannels={R:0,G:1,B:2,A:3};else if(c.R&&c.G)r.outputChannels=2,r.decodeChannels={R:0,G:1};else if(c.R)r.outputChannels=1,r.decodeChannels={R:0};else if(c.Y)r.outputChannels=1,r.decodeChannels={Y:0};else throw new Error("EXRLoader.parse: file contains unsupported data channels.");if(r.type===1)switch(l){case P.Float:r.getter=Pn,r.inputSize=N;break;case P.HalfFloat:r.getter=Z,r.inputSize=N;break}else if(r.type===2)switch(l){case P.Float:r.getter=b,r.inputSize=K;break;case P.HalfFloat:r.getter=mn,r.inputSize=K}else throw new Error("Unsupported pixelType "+r.type+" for "+n.compression);r.blockCount=r.height/r.scanlineBlockSize;for(let i=0;ii:r.scanOrder=i=>r.height-1-i,r.outputChannels==4?(r.format=5,r.linearSpace=!0):(r.format=6,r.linearSpace=!1),r}function xn(n,t,e,l){const r={value:0};for(let c=0;cn.height?n.height-s:n.scanlineBlockSize;const a=n.size=n.height)continue;const x=i*n.bytesPerLine,I=(n.height-1-p)*n.outLineWidth;for(let h=0;h{xn(o,s,r,c);const a=s.dataWindow.xMax-s.dataWindow.xMin+1,i=s.dataWindow.yMax-s.dataWindow.yMin+1;l(a,i,e.generateMipMaps,!1,()=>{const u=e.getEngine();e.format=s.format,e.type=o.textureType,e.invertY=!1,e._gammaSpace=!s.linearSpace,o.byteArray&&u._uploadDataToTextureDirectly(e,o.byteArray,0,0,void 0,!0)})}).catch(o=>{B.Error("Failed to load EXR texture: ",o)})}}async function lt(n){const t=new DataView(n),e={value:0},l=pn(t,e);try{const r=await Sn(l,t,e,P.Float);return xn(r,l,t,e),r.byteArray?{width:l.dataWindow.xMax-l.dataWindow.xMin+1,height:l.dataWindow.yMax-l.dataWindow.yMin+1,data:new Float32Array(r.byteArray)}:(B.Error("Failed to decode EXR data: No byte array available."),{width:0,height:0,data:null})}catch(r){B.Error("Failed to load EXR data: ",r)}return{width:0,height:0,data:null}}export{lt as ReadExrDataAsync,rt as _ExrTextureLoader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fa-xqCN2YBh.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fa-xqCN2YBh.js new file mode 100644 index 0000000000000000000000000000000000000000..d1ddb2faf6e86e817c49abc881d0c241e7df27ce --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fa-xqCN2YBh.js @@ -0,0 +1 @@ +const o="فارسی",e={annotated_image:"تصویر حاشیه‌نویسی شده"},r={allow_recording_access:"لطفاً برای ضبط صدا، دسترسی به میکروفون را مجاز کنید.",audio:"صدا",record_from_microphone:"ضبط از میکروفون",stop_recording:"توقف ضبط",no_device_support:"دسترسی به دستگاه‌های رسانه‌ای امکان‌پذیر نیست. اطمینان حاصل کنید که در یک منبع امن (https) یا localhost اجرا می‌شود (یا یک گواهی SSL معتبر به ssl_verify داده‌اید)، و به مرورگر اجازه دسترسی به دستگاه خود را داده‌اید.",stop:"توقف",resume:"ادامه",record:"ضبط",no_microphone:"میکروفونی یافت نشد",pause:"مکث",play:"پخش",waiting:"در حال انتظار",drop_to_upload:"فایل صوتی خود را اینجا رها کنید تا بارگذاری شود"},t={connection_can_break:"در موبایل، اگر این تب از حالت فعال خارج شود یا دستگاه به خواب برود، اتصال می‌تواند قطع شود و موقعیت شما در صف از دست می‌رود.",long_requests_queue:"صف طولانی از درخواست‌های در انتظار وجود دارد. برای رد کردن صف، این Space را تکثیر کنید.",lost_connection:"اتصال به دلیل ترک صفحه قطع شد. در حال بازگشت به صف...",waiting_for_inputs:"در انتظار به پایان رسیدن بارگذاری فایل‌ها، لطفاً مجدداً امتحان کنید."},c={checkbox:"چک‌باکس",checkbox_group:"گروه چک‌باکس"},_={code:"کد"},a={color_picker:"انتخابگر رنگ"},n={built_with:"ساخته شده با",built_with_gradio:"ساخته شده با Gradio",clear:"پاک کردن",download:"دانلود",edit:"ویرایش",empty:"خالی",error:"خطا",hosted_on:"میزبانی شده در",loading:"در حال بارگذاری",logo:"لوگو",or:"یا",remove:"حذف",settings:"تنظیمات",share:"اشتراک‌گذاری",submit:"ارسال",undo:"واگرد",no_devices:"هیچ دستگاهی یافت نشد",language:"زبان",display_theme:"تم نمایش",pwa:"وب‌اپلیکیشن پیشرونده"},s={incorrect_format:"فرمت نادرست، فقط فایل‌های CSV و TSV پشتیبانی می‌شوند",new_column:"افزودن ستون",new_row:"سطر جدید",add_row_above:"افزودن سطر در بالا",add_row_below:"افزودن سطر در پایین",add_column_left:"افزودن ستون در چپ",add_column_right:"افزودن ستون در راست",delete_row:"حذف سطر",delete_column:"حذف ستون",sort_column:"ستون را مرتب کنید",sort_ascending:"مرتب‌سازی صعودی",sort_descending:"مرتب‌سازی نزولی",drop_to_upload:"فایل‌های CSV یا TSV را اینجا رها کنید تا داده‌ها را به دیتافریم وارد کنید",clear_sort:"مرتب‌سازی را پاک کنید"},d={dropdown:"منوی کشویی"},l={build_error:"خطای ساخت وجود دارد",config_error:"خطای پیکربندی وجود دارد",contact_page_author:"لطفاً با نویسنده صفحه تماس بگیرید تا به او اطلاع دهید.",no_app_file:"فایل برنامه وجود ندارد",runtime_error:"خطای زمان اجرا وجود دارد",space_not_working:'"Space کار نمی‌کند زیرا" {0}',space_paused:"Space متوقف شده است",use_via_api:"استفاده از طریق API"},i={uploading:"در حال آپلود..."},p={highlighted_text:"متن برجسته شده"},u={allow_webcam_access:"لطفاً برای ضبط، دسترسی به وب‌کم را مجاز کنید.",brush_color:"رنگ قلم",brush_radius:"اندازه قلم",image:"تصویر",remove_image:"حذف تصویر",select_brush_color:"انتخاب رنگ قلم",start_drawing:"شروع طراحی",use_brush:"استفاده از قلم",drop_to_upload:"فایل تصویر را اینجا رها کنید تا آپلود شود"},g={label:"برچسب"},m={enable_cookies:"اگر در حالت ناشناس از HuggingFace Space بازدید می‌کنید، باید کوکی‌های شخص ثالث را فعال کنید.",incorrect_credentials:"اطلاعات ورود نادرست",username:"نام کاربری",password:"رمز عبور",login:"ورود"},b={number:"عدد"},h={plot:"نمودار"},w={radio:"دکمه رادیویی"},f={slider:"اسلایدر"},k={click_to_upload:"برای آپلود کلیک کنید",drop_audio:"فایل صوتی را اینجا رها کنید",drop_csv:"CSV را اینجا رها کنید",drop_file:"فایل را اینجا رها کنید",drop_image:"تصویر را اینجا رها کنید",drop_video:"ویدیو را اینجا رها کنید",drop_gallery:"رسانه را اینجا رها کنید",paste_clipboard:"چسباندن از کلیپ‌بورد"},S={drop_to_upload:"فایل ویدیو را اینجا رها کنید تا آپلود شود"},v={edit:"ویرایش",retry:"تلاش مجدد",undo:"بازگشت",submit:"ارسال",cancel:"لغو",like:"پسندیدم",dislike:"نپسندیدم",clear:"پاک کردن گفتگو"},x={_name:o,"3D_model":{"3d_model":"مدل سه‌بعدی",drop_to_upload:"فایل مدل سه‌بعدی (.obj، .glb، .stl، .gltf، .splat یا .ply) را اینجا رها کنید تا بارگذاری شود."},annotated_image:e,audio:r,blocks:t,checkbox:c,code:_,color_picker:a,common:n,dataframe:s,dropdown:d,errors:l,file:i,highlighted_text:p,image:u,label:g,login:m,number:b,plot:h,radio:w,slider:f,upload_text:k,video:S,chatbot:v};export{o as _name,e as annotated_image,r as audio,t as blocks,v as chatbot,c as checkbox,_ as code,a as color_picker,n as common,s as dataframe,x as default,d as dropdown,l as errors,i as file,p as highlighted_text,u as image,g as label,m as login,b as number,h as plot,w as radio,f as slider,k as upload_text,S as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fi-CzBLDS5V.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fi-CzBLDS5V.js new file mode 100644 index 0000000000000000000000000000000000000000..4ddf5190bab84ed03dc7083ed38806fae87dd65b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fi-CzBLDS5V.js @@ -0,0 +1 @@ +const t="Suomi",a={annotated_image:"Merkitty kuva"},e={allow_recording_access:"Anna lupa mikrofonin käyttöön nauhoitusta varten.",audio:"Ääni",record_from_microphone:"Nauhoita mikrofonista",stop_recording:"Lopeta nauhoitus",no_device_support:"Medialaitteisiin ei saada yhteyttä. Varmista, että käytät suojattua lähdettä (https) tai localhostia (tai olet antanut kelvollisen SSL-varmenteen ssl_verify:lle), ja olet antanut selaimelle luvan käyttää laitettasi.",stop:"Pysäytä",resume:"Jatka",record:"Nauhoita",no_microphone:"Mikrofonia ei löydy",pause:"Tauko",play:"Toista",waiting:"Odotetaan",drop_to_upload:"Lataa kuvatiedosto tähän pudottamalla se"},o={connection_can_break:"Mobiililaitteilla yhteys voi katketa, jos tämä välilehti menettää fokuksen tai laite menee lepotilaan, jolloin paikkasi jonossa menetetään.",long_requests_queue:"Jonossa on paljon odottavia pyyntöjä. Monista tämä Space ohittaaksesi jonon.",lost_connection:"Yhteys katkesi sivulta poistumisen vuoksi. Palataan jonoon...",waiting_for_inputs:"Odotetaan tiedostojen lataamisen päättymistä, yritä uudelleen."},i={checkbox:"Valintaruutu",checkbox_group:"Valintaruuturyhmä"},n={code:"Koodi"},s={color_picker:"Värivalitsin"},l={built_with:"Tehty käyttäen",built_with_gradio:"Tehty Gradiolla",clear:"Tyhjennä",download:"Lataa",edit:"Muokkaa",empty:"Tyhjä",error:"Virhe",hosted_on:"Isännöity palvelimella",loading:"Ladataan",logo:"logo",or:"tai",remove:"Poista",settings:"Asetukset",share:"Jaa",submit:"Lähetä",undo:"Kumoa",no_devices:"Laitteita ei löytynyt",language:"Kieli",display_theme:"Näyttöteema",pwa:"Progressiivinen verkkosovellus"},r={incorrect_format:"Väärä muoto, vain CSV- ja TSV-tiedostot ovat tuettuja",new_column:"Lisää sarake",new_row:"Uusi rivi",add_row_above:"Lisää rivi yläpuolelle",add_row_below:"Lisää rivi alapuolelle",add_column_left:"Lisää sarake vasemmalle",add_column_right:"Lisää sarake oikealle",delete_row:"Poista rivi",delete_column:"Poista sarake",sort_column:"Lajittele sarake",sort_ascending:"Lajittele nousevaan järjestykseen",sort_descending:"Lajittele laskevaan järjestykseen",drop_to_upload:"Lataa CSV- tai TSV-tiedostoja tähän tuodaaksesi datan dataframeen.",clear_sort:"Tyhjennä järjestys"},u={dropdown:"Pudotusvalikko"},d={build_error:"rakennusvirhe",config_error:"määritysvirhe",contact_page_author:"Ota yhteyttä sivun tekijään ilmoittaaksesi.",no_app_file:"sovellustiedostoa ei ole",runtime_error:"ajonaikainen virhe",space_not_working:'"Space ei toimi koska" {0}',space_paused:"Space on keskeytetty",use_via_api:"Käytä API:n kautta"},c={uploading:"Ladataan..."},_={highlighted_text:"Korostettu teksti"},k={allow_webcam_access:"Anna lupa web-kameran käyttöön nauhoitusta varten.",brush_color:"Siveltimen väri",brush_radius:"Siveltimen koko",image:"Kuva",remove_image:"Poista kuva",select_brush_color:"Valitse siveltimen väri",start_drawing:"Aloita piirtäminen",use_brush:"Käytä sivellintä",drop_to_upload:"Lataa kuva tiedosto tähän pudottamalla se"},p={label:"Tunniste"},m={enable_cookies:"Jos vierailet HuggingFace Spacessa Incognito-tilassa, sinun täytyy sallia kolmannen osapuolen evästeet.",incorrect_credentials:"Virheelliset kirjautumistiedot",username:"käyttäjätunnus",password:"salasana",login:"Kirjaudu sisään"},h={number:"Numero"},v={plot:"Kaavio"},y={radio:"Valintanappi"},g={slider:"Liukusäädin"},j={click_to_upload:"Napsauta ladataksesi",drop_audio:"Pudota äänitiedosto tähän",drop_csv:"Pudota CSV-tiedosto tähän",drop_file:"Pudota tiedosto tähän",drop_image:"Pudota kuva tähän",drop_video:"Pudota video tähän",drop_gallery:"Pudota media tähän",paste_clipboard:"Liitä leikepöydältä"},b={drop_to_upload:"Lataa videotiedosto pudottamalla se tähän."},L={edit:"Muokkaa",retry:"Yritä uudelleen",undo:"Kumoa",submit:"Lähetä",cancel:"Peruuta",like:"Tykkää",dislike:"En tykkää",clear:"Tyhjennä keskustelu"},w={_name:t,"3D_model":{"3d_model":"3D-malli",drop_to_upload:"Lataa 3D-malli (.obj, .glb, .stl, .gltf, .splat tai .ply) tähän pudottamalla tiedosto."},annotated_image:a,audio:e,blocks:o,checkbox:i,code:n,color_picker:s,common:l,dataframe:r,dropdown:u,errors:d,file:c,highlighted_text:_,image:k,label:p,login:m,number:h,plot:v,radio:y,slider:g,upload_text:j,video:b,chatbot:L};export{t as _name,a as annotated_image,e as audio,o as blocks,L as chatbot,i as checkbox,n as code,s as color_picker,l as common,r as dataframe,w as default,u as dropdown,d as errors,c as file,_ as highlighted_text,k as image,p as label,m as login,h as number,v as plot,y as radio,g as slider,j as upload_text,b as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowDiagram-NV44I4VS-D9HAgoN0.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowDiagram-NV44I4VS-D9HAgoN0.js new file mode 100644 index 0000000000000000000000000000000000000000..52a86a6b67c26d1c91b382409328886e83689024 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowDiagram-NV44I4VS-D9HAgoN0.js @@ -0,0 +1,162 @@ +import{g as Yt}from"./chunk-FMBD7UC4-DNqeu8Dh.js";import{_ as A,n as Pt,l as $,c as g1,o as qt,r as Ht,u as st,b as Xt,s as Qt,p as Jt,a as Zt,g as $t,q as te,j as ee,t as se,J as ie,v as re,x as et,y as ae,z as ne,A as ue}from"./mermaid.core-7TB2QPZo.js";import{g as oe}from"./chunk-55IACEB6-d9HCWWHk.js";import{s as le}from"./chunk-QN33PNHL-w0eYMV5T.js";import{c as ce}from"./channel-CA-Tyyit.js";import{s as E1}from"./select-BigU4G0v.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";var he="flowchart-",de=class{constructor(){this.vertexCounter=0,this.config=g1(),this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=Xt,this.setAccDescription=Qt,this.setDiagramTitle=Jt,this.getAccTitle=Zt,this.getAccDescription=$t,this.getDiagramTitle=te,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}static{A(this,"FlowDB")}sanitizeText(t){return ee.sanitizeText(t,this.config)}lookUpDomId(t){for(const i of this.vertices.values())if(i.id===t)return i.domId;return t}addVertex(t,i,r,a,o,d,l={},b){if(!t||t.trim().length===0)return;let u;if(b!==void 0){let D;b.includes(` +`)?D=b+` +`:D=`{ +`+b+` +}`,u=se(D,{schema:ie})}const p=this.edges.find(D=>D.id===t);if(p){const D=u;D?.animate!==void 0&&(p.animate=D.animate),D?.animation!==void 0&&(p.animation=D.animation),D?.curve!==void 0&&(p.interpolate=D.curve);return}let S,g=this.vertices.get(t);if(g===void 0&&(g={id:t,labelType:"text",domId:he+t+"-"+this.vertexCounter,styles:[],classes:[]},this.vertices.set(t,g)),this.vertexCounter++,i!==void 0?(this.config=g1(),S=this.sanitizeText(i.text.trim()),g.labelType=i.type,S.startsWith('"')&&S.endsWith('"')&&(S=S.substring(1,S.length-1)),g.text=S):g.text===void 0&&(g.text=t),r!==void 0&&(g.type=r),a?.forEach(D=>{g.styles.push(D)}),o?.forEach(D=>{g.classes.push(D)}),d!==void 0&&(g.dir=d),g.props===void 0?g.props=l:l!==void 0&&Object.assign(g.props,l),u!==void 0){if(u.shape){if(u.shape!==u.shape.toLowerCase()||u.shape.includes("_"))throw new Error(`No such shape: ${u.shape}. Shape names should be lowercase.`);if(!re(u.shape))throw new Error(`No such shape: ${u.shape}.`);g.type=u?.shape}u?.label&&(g.text=u?.label),u?.icon&&(g.icon=u?.icon,!u.label?.trim()&&g.text===t&&(g.text="")),u?.form&&(g.form=u?.form),u?.pos&&(g.pos=u?.pos),u?.img&&(g.img=u?.img,!u.label?.trim()&&g.text===t&&(g.text="")),u?.constraint&&(g.constraint=u.constraint),u.w&&(g.assetWidth=Number(u.w)),u.h&&(g.assetHeight=Number(u.h))}}addSingleLink(t,i,r,a){const l={start:t,end:i,type:void 0,text:"",labelType:"text",classes:[],isUserDefinedId:!1,interpolate:this.edges.defaultInterpolate};$.info("abc78 Got edge...",l);const b=r.text;if(b!==void 0&&(l.text=this.sanitizeText(b.text.trim()),l.text.startsWith('"')&&l.text.endsWith('"')&&(l.text=l.text.substring(1,l.text.length-1)),l.labelType=b.type),r!==void 0&&(l.type=r.type,l.stroke=r.stroke,l.length=r.length>10?10:r.length),a&&!this.edges.some(u=>u.id===a))l.id=a,l.isUserDefinedId=!0;else{const u=this.edges.filter(p=>p.start===l.start&&p.end===l.end);u.length===0?l.id=et(l.start,l.end,{counter:0,prefix:"L"}):l.id=et(l.start,l.end,{counter:u.length+1,prefix:"L"})}if(this.edges.length<(this.config.maxEdges??500))$.info("Pushing edge..."),this.edges.push(l);else throw new Error(`Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${this.config.maxEdges}. + +Initialize mermaid with maxEdges set to a higher number to allow more edges. +You cannot set this config via configuration inside the diagram as it is a secure config. +You have to call mermaid.initialize.`)}isLinkData(t){return t!==null&&typeof t=="object"&&"id"in t&&typeof t.id=="string"}addLink(t,i,r){const a=this.isLinkData(r)?r.id.replace("@",""):void 0;$.info("addLink",t,i,a);for(const o of t)for(const d of i){const l=o===t[t.length-1],b=d===i[0];l&&b?this.addSingleLink(o,d,r,a):this.addSingleLink(o,d,r,void 0)}}updateLinkInterpolate(t,i){t.forEach(r=>{r==="default"?this.edges.defaultInterpolate=i:this.edges[r].interpolate=i})}updateLink(t,i){t.forEach(r=>{if(typeof r=="number"&&r>=this.edges.length)throw new Error(`The index ${r} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`);r==="default"?this.edges.defaultStyle=i:(this.edges[r].style=i,(this.edges[r]?.style?.length??0)>0&&!this.edges[r]?.style?.some(a=>a?.startsWith("fill"))&&this.edges[r]?.style?.push("fill:none"))})}addClass(t,i){const r=i.join().replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");t.split(",").forEach(a=>{let o=this.classes.get(a);o===void 0&&(o={id:a,styles:[],textStyles:[]},this.classes.set(a,o)),r?.forEach(d=>{if(/color/.exec(d)){const l=d.replace("fill","bgFill");o.textStyles.push(l)}o.styles.push(d)})})}setDirection(t){this.direction=t.trim(),/.*/.exec(this.direction)&&(this.direction="LR"),/.*v/.exec(this.direction)&&(this.direction="TB"),this.direction==="TD"&&(this.direction="TB")}setClass(t,i){for(const r of t.split(",")){const a=this.vertices.get(r);a&&a.classes.push(i);const o=this.edges.find(l=>l.id===r);o&&o.classes.push(i);const d=this.subGraphLookup.get(r);d&&d.classes.push(i)}}setTooltip(t,i){if(i!==void 0){i=this.sanitizeText(i);for(const r of t.split(","))this.tooltips.set(this.version==="gen-1"?this.lookUpDomId(r):r,i)}}setClickFun(t,i,r){const a=this.lookUpDomId(t);if(g1().securityLevel!=="loose"||i===void 0)return;let o=[];if(typeof r=="string"){o=r.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let l=0;l{const l=document.querySelector(`[id="${a}"]`);l!==null&&l.addEventListener("click",()=>{st.runFunc(i,...o)},!1)}))}setLink(t,i,r){t.split(",").forEach(a=>{const o=this.vertices.get(a);o!==void 0&&(o.link=st.formatUrl(i,this.config),o.linkTarget=r)}),this.setClass(t,"clickable")}getTooltip(t){return this.tooltips.get(t)}setClickEvent(t,i,r){t.split(",").forEach(a=>{this.setClickFun(a,i,r)}),this.setClass(t,"clickable")}bindFunctions(t){this.funs.forEach(i=>{i(t)})}getDirection(){return this.direction?.trim()}getVertices(){return this.vertices}getEdges(){return this.edges}getClasses(){return this.classes}setupToolTips(t){let i=E1(".mermaidTooltip");(i._groups||i)[0][0]===null&&(i=E1("body").append("div").attr("class","mermaidTooltip").style("opacity",0)),E1(t).select("svg").selectAll("g.node").on("mouseover",o=>{const d=E1(o.currentTarget);if(d.attr("title")===null)return;const b=o.currentTarget?.getBoundingClientRect();i.transition().duration(200).style("opacity",".9"),i.text(d.attr("title")).style("left",window.scrollX+b.left+(b.right-b.left)/2+"px").style("top",window.scrollY+b.bottom+"px"),i.html(i.html().replace(/<br\/>/g,"
          ")),d.classed("hover",!0)}).on("mouseout",o=>{i.transition().duration(500).style("opacity",0),E1(o.currentTarget).classed("hover",!1)})}clear(t="gen-2"){this.vertices=new Map,this.classes=new Map,this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.subGraphs=[],this.subGraphLookup=new Map,this.subCount=0,this.tooltips=new Map,this.firstGraphFlag=!0,this.version=t,this.config=g1(),ae()}setGen(t){this.version=t||"gen-2"}defaultStyle(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}addSubGraph(t,i,r){let a=t.text.trim(),o=r.text;t===r&&/\s/.exec(r.text)&&(a=void 0);const l=A(g=>{const D={boolean:{},number:{},string:{}},K=[];let x;return{nodeList:g.filter(function(U){const J=typeof U;return U.stmt&&U.stmt==="dir"?(x=U.value,!1):U.trim()===""?!1:J in D?D[J].hasOwnProperty(U)?!1:D[J][U]=!0:K.includes(U)?!1:K.push(U)}),dir:x}},"uniq")(i.flat()),b=l.nodeList;let u=l.dir;const p=g1().flowchart??{};if(u=u??(p.inheritDir?this.getDirection()??g1().direction??void 0:void 0),this.version==="gen-1")for(let g=0;g2e3)return{result:!1,count:0};if(this.posCrossRef[this.secCount]=i,this.subGraphs[i].id===t)return{result:!0,count:0};let a=0,o=1;for(;a=0){const l=this.indexNodes2(t,d);if(l.result)return{result:!0,count:o+l.count};o=o+l.count}a=a+1}return{result:!1,count:o}}getDepthFirstPos(t){return this.posCrossRef[t]}indexNodes(){this.secCount=-1,this.subGraphs.length>0&&this.indexNodes2("none",this.subGraphs.length-1)}getSubGraphs(){return this.subGraphs}firstGraph(){return this.firstGraphFlag?(this.firstGraphFlag=!1,!0):!1}destructStartLink(t){let i=t.trim(),r="arrow_open";switch(i[0]){case"<":r="arrow_point",i=i.slice(1);break;case"x":r="arrow_cross",i=i.slice(1);break;case"o":r="arrow_circle",i=i.slice(1);break}let a="normal";return i.includes("=")&&(a="thick"),i.includes(".")&&(a="dotted"),{type:r,stroke:a}}countChar(t,i){const r=i.length;let a=0;for(let o=0;o":a="arrow_point",i.startsWith("<")&&(a="double_"+a,r=r.slice(1));break;case"o":a="arrow_circle",i.startsWith("o")&&(a="double_"+a,r=r.slice(1));break}let o="normal",d=r.length-1;r.startsWith("=")&&(o="thick"),r.startsWith("~")&&(o="invisible");const l=this.countChar(".",r);return l&&(o="dotted",d=l),{type:a,stroke:o,length:d}}destructLink(t,i){const r=this.destructEndLink(t);let a;if(i){if(a=this.destructStartLink(i),a.stroke!==r.stroke)return{type:"INVALID",stroke:"INVALID"};if(a.type==="arrow_open")a.type=r.type;else{if(a.type!==r.type)return{type:"INVALID",stroke:"INVALID"};a.type="double_"+a.type}return a.type==="double_arrow"&&(a.type="double_arrow_point"),a.length=r.length,a}return r}exists(t,i){for(const r of t)if(r.nodes.includes(i))return!0;return!1}makeUniq(t,i){const r=[];return t.nodes.forEach((a,o)=>{this.exists(i,a)||r.push(t.nodes[o])}),{nodes:r}}getTypeFromVertex(t){if(t.img)return"imageSquare";if(t.icon)return t.form==="circle"?"iconCircle":t.form==="square"?"iconSquare":t.form==="rounded"?"iconRounded":"icon";switch(t.type){case"square":case void 0:return"squareRect";case"round":return"roundedRect";case"ellipse":return"ellipse";default:return t.type}}findNode(t,i){return t.find(r=>r.id===i)}destructEdgeType(t){let i="none",r="arrow_point";switch(t){case"arrow_point":case"arrow_circle":case"arrow_cross":r=t;break;case"double_arrow_point":case"double_arrow_circle":case"double_arrow_cross":i=t.replace("double_",""),r=i;break}return{arrowTypeStart:i,arrowTypeEnd:r}}addNodeFromVertex(t,i,r,a,o,d){const l=r.get(t.id),b=a.get(t.id)??!1,u=this.findNode(i,t.id);if(u)u.cssStyles=t.styles,u.cssCompiledStyles=this.getCompiledStyles(t.classes),u.cssClasses=t.classes.join(" ");else{const p={id:t.id,label:t.text,labelStyle:"",parentId:l,padding:o.flowchart?.padding||8,cssStyles:t.styles,cssCompiledStyles:this.getCompiledStyles(["default","node",...t.classes]),cssClasses:"default "+t.classes.join(" "),dir:t.dir,domId:t.domId,look:d,link:t.link,linkTarget:t.linkTarget,tooltip:this.getTooltip(t.id),icon:t.icon,pos:t.pos,img:t.img,assetWidth:t.assetWidth,assetHeight:t.assetHeight,constraint:t.constraint};b?i.push({...p,isGroup:!0,shape:"rect"}):i.push({...p,isGroup:!1,shape:this.getTypeFromVertex(t)})}}getCompiledStyles(t){let i=[];for(const r of t){const a=this.classes.get(r);a?.styles&&(i=[...i,...a.styles??[]].map(o=>o.trim())),a?.textStyles&&(i=[...i,...a.textStyles??[]].map(o=>o.trim()))}return i}getData(){const t=g1(),i=[],r=[],a=this.getSubGraphs(),o=new Map,d=new Map;for(let u=a.length-1;u>=0;u--){const p=a[u];p.nodes.length>0&&d.set(p.id,!0);for(const S of p.nodes)o.set(S,p.id)}for(let u=a.length-1;u>=0;u--){const p=a[u];i.push({id:p.id,label:p.title,labelStyle:"",parentId:o.get(p.id),padding:8,cssCompiledStyles:this.getCompiledStyles(p.classes),cssClasses:p.classes.join(" "),shape:"rect",dir:p.dir,isGroup:!0,look:t.look})}this.getVertices().forEach(u=>{this.addNodeFromVertex(u,i,o,d,t,t.look||"classic")});const b=this.getEdges();return b.forEach((u,p)=>{const{arrowTypeStart:S,arrowTypeEnd:g}=this.destructEdgeType(u.type),D=[...b.defaultStyle??[]];u.style&&D.push(...u.style);const K={id:et(u.start,u.end,{counter:p,prefix:"L"},u.id),isUserDefinedId:u.isUserDefinedId,start:u.start,end:u.end,type:u.type??"normal",label:u.text,labelpos:"c",thickness:u.stroke,minlen:u.length,classes:u?.stroke==="invisible"?"":"edge-thickness-normal edge-pattern-solid flowchart-link",arrowTypeStart:u?.stroke==="invisible"||u?.type==="arrow_open"?"none":S,arrowTypeEnd:u?.stroke==="invisible"||u?.type==="arrow_open"?"none":g,arrowheadStyle:"fill: #333",cssCompiledStyles:this.getCompiledStyles(u.classes),labelStyle:D,style:D,pattern:u.stroke,look:t.look,animate:u.animate,animation:u.animation,curve:u.interpolate||this.edges.defaultInterpolate||t.flowchart?.curve};r.push(K)}),{nodes:i,edges:r,other:{},config:t}}defaultConfig(){return ne.flowchart}},pe=A(function(t,i){return i.db.getClasses()},"getClasses"),fe=A(async function(t,i,r,a){$.info("REF0:"),$.info("Drawing state diagram (v2)",i);const{securityLevel:o,flowchart:d,layout:l}=g1();let b;o==="sandbox"&&(b=E1("#i"+i));const u=o==="sandbox"?b.nodes()[0].contentDocument:document;$.debug("Before getData: ");const p=a.db.getData();$.debug("Data: ",p);const S=oe(i,o),g=a.db.getDirection();p.type=a.type,p.layoutAlgorithm=qt(l),p.layoutAlgorithm==="dagre"&&l==="elk"&&$.warn("flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback."),p.direction=g,p.nodeSpacing=d?.nodeSpacing||50,p.rankSpacing=d?.rankSpacing||50,p.markers=["point","circle","cross"],p.diagramId=i,$.debug("REF1:",p),await Ht(p,S);const D=p.config.flowchart?.diagramPadding??8;st.insertTitle(S,"flowchartTitleText",d?.titleTopMargin||0,a.db.getDiagramTitle()),le(S,D,"flowchart",d?.useMaxWidth||!1);for(const K of p.nodes){const x=E1(`#${i} [id="${K.id}"]`);if(!x||!K.link)continue;const F=u.createElementNS("http://www.w3.org/2000/svg","a");F.setAttributeNS("http://www.w3.org/2000/svg","class",K.cssClasses),F.setAttributeNS("http://www.w3.org/2000/svg","rel","noopener"),o==="sandbox"?F.setAttributeNS("http://www.w3.org/2000/svg","target","_top"):K.linkTarget&&F.setAttributeNS("http://www.w3.org/2000/svg","target",K.linkTarget);const U=x.insert(function(){return F},":first-child"),J=x.select(".label-container");J&&U.append(function(){return J.node()});const b1=x.select(".label");b1&&U.append(function(){return b1.node()})}},"draw"),ge={getClasses:pe,draw:fe},it=(function(){var t=A(function(f1,c,h,f){for(h=h||{},f=f1.length;f--;h[f1[f]]=c);return h},"o"),i=[1,4],r=[1,3],a=[1,5],o=[1,8,9,10,11,27,34,36,38,44,60,84,85,86,87,88,89,102,105,106,109,111,114,115,116,121,122,123,124],d=[2,2],l=[1,13],b=[1,14],u=[1,15],p=[1,16],S=[1,23],g=[1,25],D=[1,26],K=[1,27],x=[1,49],F=[1,48],U=[1,29],J=[1,30],b1=[1,31],P1=[1,32],O1=[1,33],L=[1,44],V=[1,46],w=[1,42],I=[1,47],R=[1,43],N=[1,50],G=[1,45],P=[1,51],O=[1,52],M1=[1,34],U1=[1,35],W1=[1,36],z1=[1,37],d1=[1,57],T=[1,8,9,10,11,27,32,34,36,38,44,60,84,85,86,87,88,89,102,105,106,109,111,114,115,116,121,122,123,124],t1=[1,61],e1=[1,60],s1=[1,62],C1=[8,9,11,75,77,78],rt=[1,78],D1=[1,91],S1=[1,96],x1=[1,95],T1=[1,92],y1=[1,88],F1=[1,94],_1=[1,90],B1=[1,97],v1=[1,93],L1=[1,98],V1=[1,89],A1=[8,9,10,11,40,75,77,78],W=[8,9,10,11,40,46,75,77,78],q=[8,9,10,11,29,40,44,46,48,50,52,54,56,58,60,63,65,67,68,70,75,77,78,89,102,105,106,109,111,114,115,116],at=[8,9,11,44,60,75,77,78,89,102,105,106,109,111,114,115,116],w1=[44,60,89,102,105,106,109,111,114,115,116],nt=[1,121],ut=[1,122],j1=[1,124],K1=[1,123],ot=[44,60,62,74,89,102,105,106,109,111,114,115,116],lt=[1,133],ct=[1,147],ht=[1,148],dt=[1,149],pt=[1,150],ft=[1,135],gt=[1,137],bt=[1,141],At=[1,142],kt=[1,143],mt=[1,144],Et=[1,145],Ct=[1,146],Dt=[1,151],St=[1,152],xt=[1,131],Tt=[1,132],yt=[1,139],Ft=[1,134],_t=[1,138],Bt=[1,136],X1=[8,9,10,11,27,32,34,36,38,44,60,84,85,86,87,88,89,102,105,106,109,111,114,115,116,121,122,123,124],vt=[1,154],Lt=[1,156],B=[8,9,11],H=[8,9,10,11,14,44,60,89,105,106,109,111,114,115,116],k=[1,176],z=[1,172],j=[1,173],m=[1,177],E=[1,174],C=[1,175],I1=[77,116,119],y=[8,9,10,11,12,14,27,29,32,44,60,75,84,85,86,87,88,89,90,105,109,111,114,115,116],Vt=[10,106],p1=[31,49,51,53,55,57,62,64,66,67,69,71,116,117,118],i1=[1,247],r1=[1,245],a1=[1,249],n1=[1,243],u1=[1,244],o1=[1,246],l1=[1,248],c1=[1,250],R1=[1,268],wt=[8,9,11,106],Z=[8,9,10,11,60,84,105,106,109,110,111,112],Q1={trace:A(function(){},"trace"),yy:{},symbols_:{error:2,start:3,graphConfig:4,document:5,line:6,statement:7,SEMI:8,NEWLINE:9,SPACE:10,EOF:11,GRAPH:12,NODIR:13,DIR:14,FirstStmtSeparator:15,ending:16,endToken:17,spaceList:18,spaceListNewline:19,vertexStatement:20,separator:21,styleStatement:22,linkStyleStatement:23,classDefStatement:24,classStatement:25,clickStatement:26,subgraph:27,textNoTags:28,SQS:29,text:30,SQE:31,end:32,direction:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,shapeData:39,SHAPE_DATA:40,link:41,node:42,styledVertex:43,AMP:44,vertex:45,STYLE_SEPARATOR:46,idString:47,DOUBLECIRCLESTART:48,DOUBLECIRCLEEND:49,PS:50,PE:51,"(-":52,"-)":53,STADIUMSTART:54,STADIUMEND:55,SUBROUTINESTART:56,SUBROUTINEEND:57,VERTEX_WITH_PROPS_START:58,"NODE_STRING[field]":59,COLON:60,"NODE_STRING[value]":61,PIPE:62,CYLINDERSTART:63,CYLINDEREND:64,DIAMOND_START:65,DIAMOND_STOP:66,TAGEND:67,TRAPSTART:68,TRAPEND:69,INVTRAPSTART:70,INVTRAPEND:71,linkStatement:72,arrowText:73,TESTSTR:74,START_LINK:75,edgeText:76,LINK:77,LINK_ID:78,edgeTextToken:79,STR:80,MD_STR:81,textToken:82,keywords:83,STYLE:84,LINKSTYLE:85,CLASSDEF:86,CLASS:87,CLICK:88,DOWN:89,UP:90,textNoTagsToken:91,stylesOpt:92,"idString[vertex]":93,"idString[class]":94,CALLBACKNAME:95,CALLBACKARGS:96,HREF:97,LINK_TARGET:98,"STR[link]":99,"STR[tooltip]":100,alphaNum:101,DEFAULT:102,numList:103,INTERPOLATE:104,NUM:105,COMMA:106,style:107,styleComponent:108,NODE_STRING:109,UNIT:110,BRKT:111,PCT:112,idStringToken:113,MINUS:114,MULT:115,UNICODE_TEXT:116,TEXT:117,TAGSTART:118,EDGE_TEXT:119,alphaNumToken:120,direction_tb:121,direction_bt:122,direction_rl:123,direction_lr:124,$accept:0,$end:1},terminals_:{2:"error",8:"SEMI",9:"NEWLINE",10:"SPACE",11:"EOF",12:"GRAPH",13:"NODIR",14:"DIR",27:"subgraph",29:"SQS",31:"SQE",32:"end",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",40:"SHAPE_DATA",44:"AMP",46:"STYLE_SEPARATOR",48:"DOUBLECIRCLESTART",49:"DOUBLECIRCLEEND",50:"PS",51:"PE",52:"(-",53:"-)",54:"STADIUMSTART",55:"STADIUMEND",56:"SUBROUTINESTART",57:"SUBROUTINEEND",58:"VERTEX_WITH_PROPS_START",59:"NODE_STRING[field]",60:"COLON",61:"NODE_STRING[value]",62:"PIPE",63:"CYLINDERSTART",64:"CYLINDEREND",65:"DIAMOND_START",66:"DIAMOND_STOP",67:"TAGEND",68:"TRAPSTART",69:"TRAPEND",70:"INVTRAPSTART",71:"INVTRAPEND",74:"TESTSTR",75:"START_LINK",77:"LINK",78:"LINK_ID",80:"STR",81:"MD_STR",84:"STYLE",85:"LINKSTYLE",86:"CLASSDEF",87:"CLASS",88:"CLICK",89:"DOWN",90:"UP",93:"idString[vertex]",94:"idString[class]",95:"CALLBACKNAME",96:"CALLBACKARGS",97:"HREF",98:"LINK_TARGET",99:"STR[link]",100:"STR[tooltip]",102:"DEFAULT",104:"INTERPOLATE",105:"NUM",106:"COMMA",109:"NODE_STRING",110:"UNIT",111:"BRKT",112:"PCT",114:"MINUS",115:"MULT",116:"UNICODE_TEXT",117:"TEXT",118:"TAGSTART",119:"EDGE_TEXT",121:"direction_tb",122:"direction_bt",123:"direction_rl",124:"direction_lr"},productions_:[0,[3,2],[5,0],[5,2],[6,1],[6,1],[6,1],[6,1],[6,1],[4,2],[4,2],[4,2],[4,3],[16,2],[16,1],[17,1],[17,1],[17,1],[15,1],[15,1],[15,2],[19,2],[19,2],[19,1],[19,1],[18,2],[18,1],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,9],[7,6],[7,4],[7,1],[7,2],[7,2],[7,1],[21,1],[21,1],[21,1],[39,2],[39,1],[20,4],[20,3],[20,4],[20,2],[20,2],[20,1],[42,1],[42,6],[42,5],[43,1],[43,3],[45,4],[45,4],[45,6],[45,4],[45,4],[45,4],[45,8],[45,4],[45,4],[45,4],[45,6],[45,4],[45,4],[45,4],[45,4],[45,4],[45,1],[41,2],[41,3],[41,3],[41,1],[41,3],[41,4],[76,1],[76,2],[76,1],[76,1],[72,1],[72,2],[73,3],[30,1],[30,2],[30,1],[30,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[28,1],[28,2],[28,1],[28,1],[24,5],[25,5],[26,2],[26,4],[26,3],[26,5],[26,3],[26,5],[26,5],[26,7],[26,2],[26,4],[26,2],[26,4],[26,4],[26,6],[22,5],[23,5],[23,5],[23,9],[23,9],[23,7],[23,7],[103,1],[103,3],[92,1],[92,3],[107,1],[107,2],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[82,1],[82,1],[82,1],[82,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[79,1],[79,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[47,1],[47,2],[101,1],[101,2],[33,1],[33,1],[33,1],[33,1]],performAction:A(function(c,h,f,n,_,e,G1){var s=e.length-1;switch(_){case 2:this.$=[];break;case 3:(!Array.isArray(e[s])||e[s].length>0)&&e[s-1].push(e[s]),this.$=e[s-1];break;case 4:case 183:this.$=e[s];break;case 11:n.setDirection("TB"),this.$="TB";break;case 12:n.setDirection(e[s-1]),this.$=e[s-1];break;case 27:this.$=e[s-1].nodes;break;case 28:case 29:case 30:case 31:case 32:this.$=[];break;case 33:this.$=n.addSubGraph(e[s-6],e[s-1],e[s-4]);break;case 34:this.$=n.addSubGraph(e[s-3],e[s-1],e[s-3]);break;case 35:this.$=n.addSubGraph(void 0,e[s-1],void 0);break;case 37:this.$=e[s].trim(),n.setAccTitle(this.$);break;case 38:case 39:this.$=e[s].trim(),n.setAccDescription(this.$);break;case 43:this.$=e[s-1]+e[s];break;case 44:this.$=e[s];break;case 45:n.addVertex(e[s-1][e[s-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,e[s]),n.addLink(e[s-3].stmt,e[s-1],e[s-2]),this.$={stmt:e[s-1],nodes:e[s-1].concat(e[s-3].nodes)};break;case 46:n.addLink(e[s-2].stmt,e[s],e[s-1]),this.$={stmt:e[s],nodes:e[s].concat(e[s-2].nodes)};break;case 47:n.addLink(e[s-3].stmt,e[s-1],e[s-2]),this.$={stmt:e[s-1],nodes:e[s-1].concat(e[s-3].nodes)};break;case 48:this.$={stmt:e[s-1],nodes:e[s-1]};break;case 49:n.addVertex(e[s-1][e[s-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,e[s]),this.$={stmt:e[s-1],nodes:e[s-1],shapeData:e[s]};break;case 50:this.$={stmt:e[s],nodes:e[s]};break;case 51:this.$=[e[s]];break;case 52:n.addVertex(e[s-5][e[s-5].length-1],void 0,void 0,void 0,void 0,void 0,void 0,e[s-4]),this.$=e[s-5].concat(e[s]);break;case 53:this.$=e[s-4].concat(e[s]);break;case 54:this.$=e[s];break;case 55:this.$=e[s-2],n.setClass(e[s-2],e[s]);break;case 56:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"square");break;case 57:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"doublecircle");break;case 58:this.$=e[s-5],n.addVertex(e[s-5],e[s-2],"circle");break;case 59:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"ellipse");break;case 60:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"stadium");break;case 61:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"subroutine");break;case 62:this.$=e[s-7],n.addVertex(e[s-7],e[s-1],"rect",void 0,void 0,void 0,Object.fromEntries([[e[s-5],e[s-3]]]));break;case 63:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"cylinder");break;case 64:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"round");break;case 65:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"diamond");break;case 66:this.$=e[s-5],n.addVertex(e[s-5],e[s-2],"hexagon");break;case 67:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"odd");break;case 68:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"trapezoid");break;case 69:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"inv_trapezoid");break;case 70:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"lean_right");break;case 71:this.$=e[s-3],n.addVertex(e[s-3],e[s-1],"lean_left");break;case 72:this.$=e[s],n.addVertex(e[s]);break;case 73:e[s-1].text=e[s],this.$=e[s-1];break;case 74:case 75:e[s-2].text=e[s-1],this.$=e[s-2];break;case 76:this.$=e[s];break;case 77:var v=n.destructLink(e[s],e[s-2]);this.$={type:v.type,stroke:v.stroke,length:v.length,text:e[s-1]};break;case 78:var v=n.destructLink(e[s],e[s-2]);this.$={type:v.type,stroke:v.stroke,length:v.length,text:e[s-1],id:e[s-3]};break;case 79:this.$={text:e[s],type:"text"};break;case 80:this.$={text:e[s-1].text+""+e[s],type:e[s-1].type};break;case 81:this.$={text:e[s],type:"string"};break;case 82:this.$={text:e[s],type:"markdown"};break;case 83:var v=n.destructLink(e[s]);this.$={type:v.type,stroke:v.stroke,length:v.length};break;case 84:var v=n.destructLink(e[s]);this.$={type:v.type,stroke:v.stroke,length:v.length,id:e[s-1]};break;case 85:this.$=e[s-1];break;case 86:this.$={text:e[s],type:"text"};break;case 87:this.$={text:e[s-1].text+""+e[s],type:e[s-1].type};break;case 88:this.$={text:e[s],type:"string"};break;case 89:case 104:this.$={text:e[s],type:"markdown"};break;case 101:this.$={text:e[s],type:"text"};break;case 102:this.$={text:e[s-1].text+""+e[s],type:e[s-1].type};break;case 103:this.$={text:e[s],type:"text"};break;case 105:this.$=e[s-4],n.addClass(e[s-2],e[s]);break;case 106:this.$=e[s-4],n.setClass(e[s-2],e[s]);break;case 107:case 115:this.$=e[s-1],n.setClickEvent(e[s-1],e[s]);break;case 108:case 116:this.$=e[s-3],n.setClickEvent(e[s-3],e[s-2]),n.setTooltip(e[s-3],e[s]);break;case 109:this.$=e[s-2],n.setClickEvent(e[s-2],e[s-1],e[s]);break;case 110:this.$=e[s-4],n.setClickEvent(e[s-4],e[s-3],e[s-2]),n.setTooltip(e[s-4],e[s]);break;case 111:this.$=e[s-2],n.setLink(e[s-2],e[s]);break;case 112:this.$=e[s-4],n.setLink(e[s-4],e[s-2]),n.setTooltip(e[s-4],e[s]);break;case 113:this.$=e[s-4],n.setLink(e[s-4],e[s-2],e[s]);break;case 114:this.$=e[s-6],n.setLink(e[s-6],e[s-4],e[s]),n.setTooltip(e[s-6],e[s-2]);break;case 117:this.$=e[s-1],n.setLink(e[s-1],e[s]);break;case 118:this.$=e[s-3],n.setLink(e[s-3],e[s-2]),n.setTooltip(e[s-3],e[s]);break;case 119:this.$=e[s-3],n.setLink(e[s-3],e[s-2],e[s]);break;case 120:this.$=e[s-5],n.setLink(e[s-5],e[s-4],e[s]),n.setTooltip(e[s-5],e[s-2]);break;case 121:this.$=e[s-4],n.addVertex(e[s-2],void 0,void 0,e[s]);break;case 122:this.$=e[s-4],n.updateLink([e[s-2]],e[s]);break;case 123:this.$=e[s-4],n.updateLink(e[s-2],e[s]);break;case 124:this.$=e[s-8],n.updateLinkInterpolate([e[s-6]],e[s-2]),n.updateLink([e[s-6]],e[s]);break;case 125:this.$=e[s-8],n.updateLinkInterpolate(e[s-6],e[s-2]),n.updateLink(e[s-6],e[s]);break;case 126:this.$=e[s-6],n.updateLinkInterpolate([e[s-4]],e[s]);break;case 127:this.$=e[s-6],n.updateLinkInterpolate(e[s-4],e[s]);break;case 128:case 130:this.$=[e[s]];break;case 129:case 131:e[s-2].push(e[s]),this.$=e[s-2];break;case 133:this.$=e[s-1]+e[s];break;case 181:this.$=e[s];break;case 182:this.$=e[s-1]+""+e[s];break;case 184:this.$=e[s-1]+""+e[s];break;case 185:this.$={stmt:"dir",value:"TB"};break;case 186:this.$={stmt:"dir",value:"BT"};break;case 187:this.$={stmt:"dir",value:"RL"};break;case 188:this.$={stmt:"dir",value:"LR"};break}},"anonymous"),table:[{3:1,4:2,9:i,10:r,12:a},{1:[3]},t(o,d,{5:6}),{4:7,9:i,10:r,12:a},{4:8,9:i,10:r,12:a},{13:[1,9],14:[1,10]},{1:[2,1],6:11,7:12,8:l,9:b,10:u,11:p,20:17,22:18,23:19,24:20,25:21,26:22,27:S,33:24,34:g,36:D,38:K,42:28,43:38,44:x,45:39,47:40,60:F,84:U,85:J,86:b1,87:P1,88:O1,89:L,102:V,105:w,106:I,109:R,111:N,113:41,114:G,115:P,116:O,121:M1,122:U1,123:W1,124:z1},t(o,[2,9]),t(o,[2,10]),t(o,[2,11]),{8:[1,54],9:[1,55],10:d1,15:53,18:56},t(T,[2,3]),t(T,[2,4]),t(T,[2,5]),t(T,[2,6]),t(T,[2,7]),t(T,[2,8]),{8:t1,9:e1,11:s1,21:58,41:59,72:63,75:[1,64],77:[1,66],78:[1,65]},{8:t1,9:e1,11:s1,21:67},{8:t1,9:e1,11:s1,21:68},{8:t1,9:e1,11:s1,21:69},{8:t1,9:e1,11:s1,21:70},{8:t1,9:e1,11:s1,21:71},{8:t1,9:e1,10:[1,72],11:s1,21:73},t(T,[2,36]),{35:[1,74]},{37:[1,75]},t(T,[2,39]),t(C1,[2,50],{18:76,39:77,10:d1,40:rt}),{10:[1,79]},{10:[1,80]},{10:[1,81]},{10:[1,82]},{14:D1,44:S1,60:x1,80:[1,86],89:T1,95:[1,83],97:[1,84],101:85,105:y1,106:F1,109:_1,111:B1,114:v1,115:L1,116:V1,120:87},t(T,[2,185]),t(T,[2,186]),t(T,[2,187]),t(T,[2,188]),t(A1,[2,51]),t(A1,[2,54],{46:[1,99]}),t(W,[2,72],{113:112,29:[1,100],44:x,48:[1,101],50:[1,102],52:[1,103],54:[1,104],56:[1,105],58:[1,106],60:F,63:[1,107],65:[1,108],67:[1,109],68:[1,110],70:[1,111],89:L,102:V,105:w,106:I,109:R,111:N,114:G,115:P,116:O}),t(q,[2,181]),t(q,[2,142]),t(q,[2,143]),t(q,[2,144]),t(q,[2,145]),t(q,[2,146]),t(q,[2,147]),t(q,[2,148]),t(q,[2,149]),t(q,[2,150]),t(q,[2,151]),t(q,[2,152]),t(o,[2,12]),t(o,[2,18]),t(o,[2,19]),{9:[1,113]},t(at,[2,26],{18:114,10:d1}),t(T,[2,27]),{42:115,43:38,44:x,45:39,47:40,60:F,89:L,102:V,105:w,106:I,109:R,111:N,113:41,114:G,115:P,116:O},t(T,[2,40]),t(T,[2,41]),t(T,[2,42]),t(w1,[2,76],{73:116,62:[1,118],74:[1,117]}),{76:119,79:120,80:nt,81:ut,116:j1,119:K1},{75:[1,125],77:[1,126]},t(ot,[2,83]),t(T,[2,28]),t(T,[2,29]),t(T,[2,30]),t(T,[2,31]),t(T,[2,32]),{10:lt,12:ct,14:ht,27:dt,28:127,32:pt,44:ft,60:gt,75:bt,80:[1,129],81:[1,130],83:140,84:At,85:kt,86:mt,87:Et,88:Ct,89:Dt,90:St,91:128,105:xt,109:Tt,111:yt,114:Ft,115:_t,116:Bt},t(X1,d,{5:153}),t(T,[2,37]),t(T,[2,38]),t(C1,[2,48],{44:vt}),t(C1,[2,49],{18:155,10:d1,40:Lt}),t(A1,[2,44]),{44:x,47:157,60:F,89:L,102:V,105:w,106:I,109:R,111:N,113:41,114:G,115:P,116:O},{102:[1,158],103:159,105:[1,160]},{44:x,47:161,60:F,89:L,102:V,105:w,106:I,109:R,111:N,113:41,114:G,115:P,116:O},{44:x,47:162,60:F,89:L,102:V,105:w,106:I,109:R,111:N,113:41,114:G,115:P,116:O},t(B,[2,107],{10:[1,163],96:[1,164]}),{80:[1,165]},t(B,[2,115],{120:167,10:[1,166],14:D1,44:S1,60:x1,89:T1,105:y1,106:F1,109:_1,111:B1,114:v1,115:L1,116:V1}),t(B,[2,117],{10:[1,168]}),t(H,[2,183]),t(H,[2,170]),t(H,[2,171]),t(H,[2,172]),t(H,[2,173]),t(H,[2,174]),t(H,[2,175]),t(H,[2,176]),t(H,[2,177]),t(H,[2,178]),t(H,[2,179]),t(H,[2,180]),{44:x,47:169,60:F,89:L,102:V,105:w,106:I,109:R,111:N,113:41,114:G,115:P,116:O},{30:170,67:k,80:z,81:j,82:171,116:m,117:E,118:C},{30:178,67:k,80:z,81:j,82:171,116:m,117:E,118:C},{30:180,50:[1,179],67:k,80:z,81:j,82:171,116:m,117:E,118:C},{30:181,67:k,80:z,81:j,82:171,116:m,117:E,118:C},{30:182,67:k,80:z,81:j,82:171,116:m,117:E,118:C},{30:183,67:k,80:z,81:j,82:171,116:m,117:E,118:C},{109:[1,184]},{30:185,67:k,80:z,81:j,82:171,116:m,117:E,118:C},{30:186,65:[1,187],67:k,80:z,81:j,82:171,116:m,117:E,118:C},{30:188,67:k,80:z,81:j,82:171,116:m,117:E,118:C},{30:189,67:k,80:z,81:j,82:171,116:m,117:E,118:C},{30:190,67:k,80:z,81:j,82:171,116:m,117:E,118:C},t(q,[2,182]),t(o,[2,20]),t(at,[2,25]),t(C1,[2,46],{39:191,18:192,10:d1,40:rt}),t(w1,[2,73],{10:[1,193]}),{10:[1,194]},{30:195,67:k,80:z,81:j,82:171,116:m,117:E,118:C},{77:[1,196],79:197,116:j1,119:K1},t(I1,[2,79]),t(I1,[2,81]),t(I1,[2,82]),t(I1,[2,168]),t(I1,[2,169]),{76:198,79:120,80:nt,81:ut,116:j1,119:K1},t(ot,[2,84]),{8:t1,9:e1,10:lt,11:s1,12:ct,14:ht,21:200,27:dt,29:[1,199],32:pt,44:ft,60:gt,75:bt,83:140,84:At,85:kt,86:mt,87:Et,88:Ct,89:Dt,90:St,91:201,105:xt,109:Tt,111:yt,114:Ft,115:_t,116:Bt},t(y,[2,101]),t(y,[2,103]),t(y,[2,104]),t(y,[2,157]),t(y,[2,158]),t(y,[2,159]),t(y,[2,160]),t(y,[2,161]),t(y,[2,162]),t(y,[2,163]),t(y,[2,164]),t(y,[2,165]),t(y,[2,166]),t(y,[2,167]),t(y,[2,90]),t(y,[2,91]),t(y,[2,92]),t(y,[2,93]),t(y,[2,94]),t(y,[2,95]),t(y,[2,96]),t(y,[2,97]),t(y,[2,98]),t(y,[2,99]),t(y,[2,100]),{6:11,7:12,8:l,9:b,10:u,11:p,20:17,22:18,23:19,24:20,25:21,26:22,27:S,32:[1,202],33:24,34:g,36:D,38:K,42:28,43:38,44:x,45:39,47:40,60:F,84:U,85:J,86:b1,87:P1,88:O1,89:L,102:V,105:w,106:I,109:R,111:N,113:41,114:G,115:P,116:O,121:M1,122:U1,123:W1,124:z1},{10:d1,18:203},{44:[1,204]},t(A1,[2,43]),{10:[1,205],44:x,60:F,89:L,102:V,105:w,106:I,109:R,111:N,113:112,114:G,115:P,116:O},{10:[1,206]},{10:[1,207],106:[1,208]},t(Vt,[2,128]),{10:[1,209],44:x,60:F,89:L,102:V,105:w,106:I,109:R,111:N,113:112,114:G,115:P,116:O},{10:[1,210],44:x,60:F,89:L,102:V,105:w,106:I,109:R,111:N,113:112,114:G,115:P,116:O},{80:[1,211]},t(B,[2,109],{10:[1,212]}),t(B,[2,111],{10:[1,213]}),{80:[1,214]},t(H,[2,184]),{80:[1,215],98:[1,216]},t(A1,[2,55],{113:112,44:x,60:F,89:L,102:V,105:w,106:I,109:R,111:N,114:G,115:P,116:O}),{31:[1,217],67:k,82:218,116:m,117:E,118:C},t(p1,[2,86]),t(p1,[2,88]),t(p1,[2,89]),t(p1,[2,153]),t(p1,[2,154]),t(p1,[2,155]),t(p1,[2,156]),{49:[1,219],67:k,82:218,116:m,117:E,118:C},{30:220,67:k,80:z,81:j,82:171,116:m,117:E,118:C},{51:[1,221],67:k,82:218,116:m,117:E,118:C},{53:[1,222],67:k,82:218,116:m,117:E,118:C},{55:[1,223],67:k,82:218,116:m,117:E,118:C},{57:[1,224],67:k,82:218,116:m,117:E,118:C},{60:[1,225]},{64:[1,226],67:k,82:218,116:m,117:E,118:C},{66:[1,227],67:k,82:218,116:m,117:E,118:C},{30:228,67:k,80:z,81:j,82:171,116:m,117:E,118:C},{31:[1,229],67:k,82:218,116:m,117:E,118:C},{67:k,69:[1,230],71:[1,231],82:218,116:m,117:E,118:C},{67:k,69:[1,233],71:[1,232],82:218,116:m,117:E,118:C},t(C1,[2,45],{18:155,10:d1,40:Lt}),t(C1,[2,47],{44:vt}),t(w1,[2,75]),t(w1,[2,74]),{62:[1,234],67:k,82:218,116:m,117:E,118:C},t(w1,[2,77]),t(I1,[2,80]),{77:[1,235],79:197,116:j1,119:K1},{30:236,67:k,80:z,81:j,82:171,116:m,117:E,118:C},t(X1,d,{5:237}),t(y,[2,102]),t(T,[2,35]),{43:238,44:x,45:39,47:40,60:F,89:L,102:V,105:w,106:I,109:R,111:N,113:41,114:G,115:P,116:O},{10:d1,18:239},{10:i1,60:r1,84:a1,92:240,105:n1,107:241,108:242,109:u1,110:o1,111:l1,112:c1},{10:i1,60:r1,84:a1,92:251,104:[1,252],105:n1,107:241,108:242,109:u1,110:o1,111:l1,112:c1},{10:i1,60:r1,84:a1,92:253,104:[1,254],105:n1,107:241,108:242,109:u1,110:o1,111:l1,112:c1},{105:[1,255]},{10:i1,60:r1,84:a1,92:256,105:n1,107:241,108:242,109:u1,110:o1,111:l1,112:c1},{44:x,47:257,60:F,89:L,102:V,105:w,106:I,109:R,111:N,113:41,114:G,115:P,116:O},t(B,[2,108]),{80:[1,258]},{80:[1,259],98:[1,260]},t(B,[2,116]),t(B,[2,118],{10:[1,261]}),t(B,[2,119]),t(W,[2,56]),t(p1,[2,87]),t(W,[2,57]),{51:[1,262],67:k,82:218,116:m,117:E,118:C},t(W,[2,64]),t(W,[2,59]),t(W,[2,60]),t(W,[2,61]),{109:[1,263]},t(W,[2,63]),t(W,[2,65]),{66:[1,264],67:k,82:218,116:m,117:E,118:C},t(W,[2,67]),t(W,[2,68]),t(W,[2,70]),t(W,[2,69]),t(W,[2,71]),t([10,44,60,89,102,105,106,109,111,114,115,116],[2,85]),t(w1,[2,78]),{31:[1,265],67:k,82:218,116:m,117:E,118:C},{6:11,7:12,8:l,9:b,10:u,11:p,20:17,22:18,23:19,24:20,25:21,26:22,27:S,32:[1,266],33:24,34:g,36:D,38:K,42:28,43:38,44:x,45:39,47:40,60:F,84:U,85:J,86:b1,87:P1,88:O1,89:L,102:V,105:w,106:I,109:R,111:N,113:41,114:G,115:P,116:O,121:M1,122:U1,123:W1,124:z1},t(A1,[2,53]),{43:267,44:x,45:39,47:40,60:F,89:L,102:V,105:w,106:I,109:R,111:N,113:41,114:G,115:P,116:O},t(B,[2,121],{106:R1}),t(wt,[2,130],{108:269,10:i1,60:r1,84:a1,105:n1,109:u1,110:o1,111:l1,112:c1}),t(Z,[2,132]),t(Z,[2,134]),t(Z,[2,135]),t(Z,[2,136]),t(Z,[2,137]),t(Z,[2,138]),t(Z,[2,139]),t(Z,[2,140]),t(Z,[2,141]),t(B,[2,122],{106:R1}),{10:[1,270]},t(B,[2,123],{106:R1}),{10:[1,271]},t(Vt,[2,129]),t(B,[2,105],{106:R1}),t(B,[2,106],{113:112,44:x,60:F,89:L,102:V,105:w,106:I,109:R,111:N,114:G,115:P,116:O}),t(B,[2,110]),t(B,[2,112],{10:[1,272]}),t(B,[2,113]),{98:[1,273]},{51:[1,274]},{62:[1,275]},{66:[1,276]},{8:t1,9:e1,11:s1,21:277},t(T,[2,34]),t(A1,[2,52]),{10:i1,60:r1,84:a1,105:n1,107:278,108:242,109:u1,110:o1,111:l1,112:c1},t(Z,[2,133]),{14:D1,44:S1,60:x1,89:T1,101:279,105:y1,106:F1,109:_1,111:B1,114:v1,115:L1,116:V1,120:87},{14:D1,44:S1,60:x1,89:T1,101:280,105:y1,106:F1,109:_1,111:B1,114:v1,115:L1,116:V1,120:87},{98:[1,281]},t(B,[2,120]),t(W,[2,58]),{30:282,67:k,80:z,81:j,82:171,116:m,117:E,118:C},t(W,[2,66]),t(X1,d,{5:283}),t(wt,[2,131],{108:269,10:i1,60:r1,84:a1,105:n1,109:u1,110:o1,111:l1,112:c1}),t(B,[2,126],{120:167,10:[1,284],14:D1,44:S1,60:x1,89:T1,105:y1,106:F1,109:_1,111:B1,114:v1,115:L1,116:V1}),t(B,[2,127],{120:167,10:[1,285],14:D1,44:S1,60:x1,89:T1,105:y1,106:F1,109:_1,111:B1,114:v1,115:L1,116:V1}),t(B,[2,114]),{31:[1,286],67:k,82:218,116:m,117:E,118:C},{6:11,7:12,8:l,9:b,10:u,11:p,20:17,22:18,23:19,24:20,25:21,26:22,27:S,32:[1,287],33:24,34:g,36:D,38:K,42:28,43:38,44:x,45:39,47:40,60:F,84:U,85:J,86:b1,87:P1,88:O1,89:L,102:V,105:w,106:I,109:R,111:N,113:41,114:G,115:P,116:O,121:M1,122:U1,123:W1,124:z1},{10:i1,60:r1,84:a1,92:288,105:n1,107:241,108:242,109:u1,110:o1,111:l1,112:c1},{10:i1,60:r1,84:a1,92:289,105:n1,107:241,108:242,109:u1,110:o1,111:l1,112:c1},t(W,[2,62]),t(T,[2,33]),t(B,[2,124],{106:R1}),t(B,[2,125],{106:R1})],defaultActions:{},parseError:A(function(c,h){if(h.recoverable)this.trace(c);else{var f=new Error(c);throw f.hash=h,f}},"parseError"),parse:A(function(c){var h=this,f=[0],n=[],_=[null],e=[],G1=this.table,s="",v=0,It=0,Wt=2,Rt=1,zt=e.slice.call(arguments,1),M=Object.create(this.lexer),k1={yy:{}};for(var J1 in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J1)&&(k1.yy[J1]=this.yy[J1]);M.setInput(c,k1.yy),k1.yy.lexer=M,k1.yy.parser=this,typeof M.yylloc>"u"&&(M.yylloc={});var Z1=M.yylloc;e.push(Z1);var jt=M.options&&M.options.ranges;typeof k1.yy.parseError=="function"?this.parseError=k1.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Kt(X){f.length=f.length-2*X,_.length=_.length-X,e.length=e.length-X}A(Kt,"popStack");function Nt(){var X;return X=n.pop()||M.lex()||Rt,typeof X!="number"&&(X instanceof Array&&(n=X,X=n.pop()),X=h.symbols_[X]||X),X}A(Nt,"lex");for(var Y,m1,Q,$1,N1={},q1,h1,Gt,H1;;){if(m1=f[f.length-1],this.defaultActions[m1]?Q=this.defaultActions[m1]:((Y===null||typeof Y>"u")&&(Y=Nt()),Q=G1[m1]&&G1[m1][Y]),typeof Q>"u"||!Q.length||!Q[0]){var tt="";H1=[];for(q1 in G1[m1])this.terminals_[q1]&&q1>Wt&&H1.push("'"+this.terminals_[q1]+"'");M.showPosition?tt="Parse error on line "+(v+1)+`: +`+M.showPosition()+` +Expecting `+H1.join(", ")+", got '"+(this.terminals_[Y]||Y)+"'":tt="Parse error on line "+(v+1)+": Unexpected "+(Y==Rt?"end of input":"'"+(this.terminals_[Y]||Y)+"'"),this.parseError(tt,{text:M.match,token:this.terminals_[Y]||Y,line:M.yylineno,loc:Z1,expected:H1})}if(Q[0]instanceof Array&&Q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m1+", token: "+Y);switch(Q[0]){case 1:f.push(Y),_.push(M.yytext),e.push(M.yylloc),f.push(Q[1]),Y=null,It=M.yyleng,s=M.yytext,v=M.yylineno,Z1=M.yylloc;break;case 2:if(h1=this.productions_[Q[1]][1],N1.$=_[_.length-h1],N1._$={first_line:e[e.length-(h1||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(h1||1)].first_column,last_column:e[e.length-1].last_column},jt&&(N1._$.range=[e[e.length-(h1||1)].range[0],e[e.length-1].range[1]]),$1=this.performAction.apply(N1,[s,It,v,k1.yy,Q[1],_,e].concat(zt)),typeof $1<"u")return $1;h1&&(f=f.slice(0,-1*h1*2),_=_.slice(0,-1*h1),e=e.slice(0,-1*h1)),f.push(this.productions_[Q[1]][0]),_.push(N1.$),e.push(N1._$),Gt=G1[f[f.length-2]][f[f.length-1]],f.push(Gt);break;case 3:return!0}}return!0},"parse")},Ut=(function(){var f1={EOF:1,parseError:A(function(h,f){if(this.yy.parser)this.yy.parser.parseError(h,f);else throw new Error(h)},"parseError"),setInput:A(function(c,h){return this.yy=h||this.yy||{},this._input=c,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:A(function(){var c=this._input[0];this.yytext+=c,this.yyleng++,this.offset++,this.match+=c,this.matched+=c;var h=c.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),c},"input"),unput:A(function(c){var h=c.length,f=c.split(/(?:\r\n?|\n)/g);this._input=c+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),f.length-1&&(this.yylineno-=f.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:f?(f.length===n.length?this.yylloc.first_column:0)+n[n.length-f.length].length-f[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:A(function(){return this._more=!0,this},"more"),reject:A(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:A(function(c){this.unput(this.match.slice(c))},"less"),pastInput:A(function(){var c=this.matched.substr(0,this.matched.length-this.match.length);return(c.length>20?"...":"")+c.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:A(function(){var c=this.match;return c.length<20&&(c+=this._input.substr(0,20-c.length)),(c.substr(0,20)+(c.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:A(function(){var c=this.pastInput(),h=new Array(c.length+1).join("-");return c+this.upcomingInput()+` +`+h+"^"},"showPosition"),test_match:A(function(c,h){var f,n,_;if(this.options.backtrack_lexer&&(_={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(_.yylloc.range=this.yylloc.range.slice(0))),n=c[0].match(/(?:\r\n?|\n).*/g),n&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+c[0].length},this.yytext+=c[0],this.match+=c[0],this.matches=c,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(c[0].length),this.matched+=c[0],f=this.performAction.call(this,this.yy,this,h,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),f)return f;if(this._backtrack){for(var e in _)this[e]=_[e];return!1}return!1},"test_match"),next:A(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var c,h,f,n;this._more||(this.yytext="",this.match="");for(var _=this._currentRules(),e=0;e<_.length;e++)if(f=this._input.match(this.rules[_[e]]),f&&(!h||f[0].length>h[0].length)){if(h=f,n=e,this.options.backtrack_lexer){if(c=this.test_match(f,_[e]),c!==!1)return c;if(this._backtrack){h=!1;continue}else return!1}else if(!this.options.flex)break}return h?(c=this.test_match(h,_[n]),c!==!1?c:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:A(function(){var h=this.next();return h||this.lex()},"lex"),begin:A(function(h){this.conditionStack.push(h)},"begin"),popState:A(function(){var h=this.conditionStack.length-1;return h>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:A(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:A(function(h){return h=this.conditionStack.length-1-Math.abs(h||0),h>=0?this.conditionStack[h]:"INITIAL"},"topState"),pushState:A(function(h){this.begin(h)},"pushState"),stateStackSize:A(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:A(function(h,f,n,_){switch(n){case 0:return this.begin("acc_title"),34;case 1:return this.popState(),"acc_title_value";case 2:return this.begin("acc_descr"),36;case 3:return this.popState(),"acc_descr_value";case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return this.pushState("shapeData"),f.yytext="",40;case 8:return this.pushState("shapeDataStr"),40;case 9:return this.popState(),40;case 10:const e=/\n\s*/g;return f.yytext=f.yytext.replace(e,"
          "),40;case 11:return 40;case 12:this.popState();break;case 13:this.begin("callbackname");break;case 14:this.popState();break;case 15:this.popState(),this.begin("callbackargs");break;case 16:return 95;case 17:this.popState();break;case 18:return 96;case 19:return"MD_STR";case 20:this.popState();break;case 21:this.begin("md_string");break;case 22:return"STR";case 23:this.popState();break;case 24:this.pushState("string");break;case 25:return 84;case 26:return 102;case 27:return 85;case 28:return 104;case 29:return 86;case 30:return 87;case 31:return 97;case 32:this.begin("click");break;case 33:this.popState();break;case 34:return 88;case 35:return h.lex.firstGraph()&&this.begin("dir"),12;case 36:return h.lex.firstGraph()&&this.begin("dir"),12;case 37:return h.lex.firstGraph()&&this.begin("dir"),12;case 38:return 27;case 39:return 32;case 40:return 98;case 41:return 98;case 42:return 98;case 43:return 98;case 44:return this.popState(),13;case 45:return this.popState(),14;case 46:return this.popState(),14;case 47:return this.popState(),14;case 48:return this.popState(),14;case 49:return this.popState(),14;case 50:return this.popState(),14;case 51:return this.popState(),14;case 52:return this.popState(),14;case 53:return this.popState(),14;case 54:return this.popState(),14;case 55:return 121;case 56:return 122;case 57:return 123;case 58:return 124;case 59:return 78;case 60:return 105;case 61:return 111;case 62:return 46;case 63:return 60;case 64:return 44;case 65:return 8;case 66:return 106;case 67:return 115;case 68:return this.popState(),77;case 69:return this.pushState("edgeText"),75;case 70:return 119;case 71:return this.popState(),77;case 72:return this.pushState("thickEdgeText"),75;case 73:return 119;case 74:return this.popState(),77;case 75:return this.pushState("dottedEdgeText"),75;case 76:return 119;case 77:return 77;case 78:return this.popState(),53;case 79:return"TEXT";case 80:return this.pushState("ellipseText"),52;case 81:return this.popState(),55;case 82:return this.pushState("text"),54;case 83:return this.popState(),57;case 84:return this.pushState("text"),56;case 85:return 58;case 86:return this.pushState("text"),67;case 87:return this.popState(),64;case 88:return this.pushState("text"),63;case 89:return this.popState(),49;case 90:return this.pushState("text"),48;case 91:return this.popState(),69;case 92:return this.popState(),71;case 93:return 117;case 94:return this.pushState("trapText"),68;case 95:return this.pushState("trapText"),70;case 96:return 118;case 97:return 67;case 98:return 90;case 99:return"SEP";case 100:return 89;case 101:return 115;case 102:return 111;case 103:return 44;case 104:return 109;case 105:return 114;case 106:return 116;case 107:return this.popState(),62;case 108:return this.pushState("text"),62;case 109:return this.popState(),51;case 110:return this.pushState("text"),50;case 111:return this.popState(),31;case 112:return this.pushState("text"),29;case 113:return this.popState(),66;case 114:return this.pushState("text"),65;case 115:return"TEXT";case 116:return"QUOTE";case 117:return 9;case 118:return 10;case 119:return 11}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:@\{)/,/^(?:["])/,/^(?:["])/,/^(?:[^\"]+)/,/^(?:[^}^"]+)/,/^(?:\})/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["][`])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:["])/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:href[\s])/,/^(?:click[\s]+)/,/^(?:[\s\n])/,/^(?:[^\s\n]*)/,/^(?:flowchart-elk\b)/,/^(?:graph\b)/,/^(?:flowchart\b)/,/^(?:subgraph\b)/,/^(?:end\b\s*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:(\r?\n)*\s*\n)/,/^(?:\s*LR\b)/,/^(?:\s*RL\b)/,/^(?:\s*TB\b)/,/^(?:\s*BT\b)/,/^(?:\s*TD\b)/,/^(?:\s*BR\b)/,/^(?:\s*<)/,/^(?:\s*>)/,/^(?:\s*\^)/,/^(?:\s*v\b)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:[^\s\"]+@(?=[^\{\"]))/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:[^-]|-(?!-)+)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:[^=]|=(?!))/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:[^\.]|\.(?!))/,/^(?:\s*~~[\~]+\s*)/,/^(?:[-/\)][\)])/,/^(?:[^\(\)\[\]\{\}]|!\)+)/,/^(?:\(-)/,/^(?:\]\))/,/^(?:\(\[)/,/^(?:\]\])/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:>)/,/^(?:\)\])/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\(\(\()/,/^(?:[\\(?=\])][\]])/,/^(?:\/(?=\])\])/,/^(?:\/(?!\])|\\(?!\])|[^\\\[\]\(\)\{\}\/]+)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:<)/,/^(?:>)/,/^(?:\^)/,/^(?:\\\|)/,/^(?:v\b)/,/^(?:\*)/,/^(?:#)/,/^(?:&)/,/^(?:([A-Za-z0-9!"\#$%&'*+\.`?\\_\/]|-(?=[^\>\-\.])|(?!))+)/,/^(?:-)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\|)/,/^(?:\|)/,/^(?:\))/,/^(?:\()/,/^(?:\])/,/^(?:\[)/,/^(?:(\}))/,/^(?:\{)/,/^(?:[^\[\]\(\)\{\}\|\"]+)/,/^(?:")/,/^(?:(\r?\n)+)/,/^(?:\s)/,/^(?:$)/],conditions:{shapeDataEndBracket:{rules:[21,24,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},shapeDataStr:{rules:[9,10,21,24,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},shapeData:{rules:[8,11,12,21,24,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},callbackargs:{rules:[17,18,21,24,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},callbackname:{rules:[14,15,16,21,24,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},href:{rules:[21,24,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},click:{rules:[21,24,33,34,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},dottedEdgeText:{rules:[21,24,74,76,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},thickEdgeText:{rules:[21,24,71,73,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},edgeText:{rules:[21,24,68,70,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},trapText:{rules:[21,24,77,80,82,84,88,90,91,92,93,94,95,108,110,112,114],inclusive:!1},ellipseText:{rules:[21,24,77,78,79,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},text:{rules:[21,24,77,80,81,82,83,84,87,88,89,90,94,95,107,108,109,110,111,112,113,114,115],inclusive:!1},vertex:{rules:[21,24,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},dir:{rules:[21,24,44,45,46,47,48,49,50,51,52,53,54,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},acc_descr_multiline:{rules:[5,6,21,24,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},acc_descr:{rules:[3,21,24,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},acc_title:{rules:[1,21,24,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},md_string:{rules:[19,20,21,24,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},string:{rules:[21,22,23,24,77,80,82,84,88,90,94,95,108,110,112,114],inclusive:!1},INITIAL:{rules:[0,2,4,7,13,21,24,25,26,27,28,29,30,31,32,35,36,37,38,39,40,41,42,43,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,71,72,74,75,77,80,82,84,85,86,88,90,94,95,96,97,98,99,100,101,102,103,104,105,106,108,110,112,114,116,117,118,119],inclusive:!0}}};return f1})();Q1.lexer=Ut;function Y1(){this.yy={}}return A(Y1,"Parser"),Y1.prototype=Q1,Q1.Parser=Y1,new Y1})();it.parser=it;var Ot=it,Mt=Object.assign({},Ot);Mt.parse=t=>{const i=t.replace(/}\s*\n/g,`} +`);return Ot.parse(i)};var be=Mt,Ae=A((t,i)=>{const r=ce,a=r(t,"r"),o=r(t,"g"),d=r(t,"b");return ue(a,o,d,i)},"fade"),ke=A(t=>`.label { + font-family: ${t.fontFamily}; + color: ${t.nodeTextColor||t.textColor}; + } + .cluster-label text { + fill: ${t.titleColor}; + } + .cluster-label span { + color: ${t.titleColor}; + } + .cluster-label span p { + background-color: transparent; + } + + .label text,span { + fill: ${t.nodeTextColor||t.textColor}; + color: ${t.nodeTextColor||t.textColor}; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${t.mainBkg}; + stroke: ${t.nodeBorder}; + stroke-width: 1px; + } + .rough-node .label text , .node .label text, .image-shape .label, .icon-shape .label { + text-anchor: middle; + } + // .flowchart-label .text-outer-tspan { + // text-anchor: middle; + // } + // .flowchart-label .text-inner-tspan { + // text-anchor: start; + // } + + .node .katex path { + fill: #000; + stroke: #000; + stroke-width: 1px; + } + + .rough-node .label,.node .label, .image-shape .label, .icon-shape .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + + .root .anchor path { + fill: ${t.lineColor} !important; + stroke-width: 0; + stroke: ${t.lineColor}; + } + + .arrowheadPath { + fill: ${t.arrowheadColor}; + } + + .edgePath .path { + stroke: ${t.lineColor}; + stroke-width: 2.0px; + } + + .flowchart-link { + stroke: ${t.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${t.edgeLabelBackground}; + p { + background-color: ${t.edgeLabelBackground}; + } + rect { + opacity: 0.5; + background-color: ${t.edgeLabelBackground}; + fill: ${t.edgeLabelBackground}; + } + text-align: center; + } + + /* For html labels only */ + .labelBkg { + background-color: ${Ae(t.edgeLabelBackground,.5)}; + // background-color: + } + + .cluster rect { + fill: ${t.clusterBkg}; + stroke: ${t.clusterBorder}; + stroke-width: 1px; + } + + .cluster text { + fill: ${t.titleColor}; + } + + .cluster span { + color: ${t.titleColor}; + } + /* .cluster div { + color: ${t.titleColor}; + } */ + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${t.fontFamily}; + font-size: 12px; + background: ${t.tertiaryColor}; + border: 1px solid ${t.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .flowchartTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${t.textColor}; + } + + rect.text { + fill: none; + stroke-width: 0; + } + + .icon-shape, .image-shape { + background-color: ${t.edgeLabelBackground}; + p { + background-color: ${t.edgeLabelBackground}; + padding: 2px; + } + rect { + opacity: 0.5; + background-color: ${t.edgeLabelBackground}; + fill: ${t.edgeLabelBackground}; + } + text-align: center; + } + ${Yt()} +`,"getStyles"),me=ke,ve={parser:be,get db(){return new de},renderer:ge,styles:me,init:A(t=>{t.flowchart||(t.flowchart={}),t.layout&&Pt({layout:t.layout}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Pt({flowchart:{arrowMarkerAbsolute:t.arrowMarkerAbsolute}})},"init")};export{ve as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphArrayIndexBlock-DCHGYI8d.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphArrayIndexBlock-DCHGYI8d.js new file mode 100644 index 0000000000000000000000000000000000000000..b96e330b65a1d9b3f69f2a5128132c0b4132d4b1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphArrayIndexBlock-DCHGYI8d.js @@ -0,0 +1 @@ +import{F as s,g as i}from"./KHR_interactivity-BtMudStn.js";import{R as t,F as l}from"./declarationMapper-Lanf6XPr.js";import{R as u}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class o extends s{constructor(e){super(e),this.config=e,this.array=this.registerDataInput("array",t),this.index=this.registerDataInput("index",t,new l(-1)),this.value=this.registerDataOutput("value",t)}_updateOutputs(e){const r=this.array.getValue(e),a=i(this.index.getValue(e));r&&a>=0&&a=o&&(this.out._activateSignal(t),t._setExecutionVariable(this,"debounceCount",0))}getClassName(){return"FlowGraphDebounceBlock"}}s("FlowGraphDebounceBlock",n);export{n as FlowGraphDebounceBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphDoNBlock-CP3xgcll.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphDoNBlock-CP3xgcll.js new file mode 100644 index 0000000000000000000000000000000000000000..2df4e55e856e215c7e68bd7b8d083f2a30e425f1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphDoNBlock-CP3xgcll.js @@ -0,0 +1 @@ +import{F as e,i}from"./declarationMapper-Lanf6XPr.js";import{b as a}from"./KHR_interactivity-BtMudStn.js";import{R as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class u extends a{constructor(t={}){super(t),this.config=t,this.config.startIndex=t.startIndex??new e(0),this.reset=this._registerSignalInput("reset"),this.maxExecutions=this.registerDataInput("maxExecutions",i),this.executionCount=this.registerDataOutput("executionCount",i,new e(0))}_execute(t,o){if(o===this.reset)this.executionCount.setValue(this.config.startIndex,t);else{const s=this.executionCount.getValue(t);s.values.MaxLoopIterations*a));i+=a);this.config?.incrementIndexWhenLoopDone&&this.index.setValue(new r(t(this.index.getValue(e))+a),e),this.completed._activateSignal(e)}getClassName(){return"FlowGraphForLoopBlock"}}s.MaxLoopIterations=1e3;d("FlowGraphForLoopBlock",s);export{s as FlowGraphForLoopBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphFunctionReferenceBlock-Bd_srACE.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphFunctionReferenceBlock-Bd_srACE.js new file mode 100644 index 0000000000000000000000000000000000000000..2ab7d28aa8f9ffd0db1fcfb6b0f050fe933b8d4c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphFunctionReferenceBlock-Bd_srACE.js @@ -0,0 +1 @@ +import{F as u}from"./KHR_interactivity-BtMudStn.js";import{q as r,R as o}from"./declarationMapper-Lanf6XPr.js";import{R as a}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class c extends u{constructor(t){super(t),this.functionName=this.registerDataInput("functionName",r),this.object=this.registerDataInput("object",o),this.context=this.registerDataInput("context",o,null),this.output=this.registerDataOutput("output",o)}_updateOutputs(t){const i=this.functionName.getValue(t),s=this.object.getValue(t),n=this.context.getValue(t);if(s&&i){const e=s[i];e&&typeof e=="function"&&this.output.setValue(e.bind(n),t)}}getClassName(){return"FlowGraphFunctionReference"}}a("FlowGraphFunctionReference",c);export{c as FlowGraphFunctionReferenceBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphGLTFDataProvider-BJdJcFO4.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphGLTFDataProvider-BJdJcFO4.js new file mode 100644 index 0000000000000000000000000000000000000000..d7aa0071d5f8e20bcc633e1caa323693319b71b1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphGLTFDataProvider-BJdJcFO4.js @@ -0,0 +1 @@ +import{F as n}from"./KHR_interactivity-BtMudStn.js";import{R as a}from"./declarationMapper-Lanf6XPr.js";import"./index-DWyDLubb.js";import"./index-CDrXokXW.js";import"./objectModelMapping-CGWnurZP.js";class c extends n{constructor(r){super();const t=r.glTF,s=t.animations?.map(o=>o._babylonAnimationGroup)||[];this.animationGroups=this.registerDataOutput("animationGroups",a,s);const i=t.nodes?.map(o=>o._babylonTransformNode)||[];this.nodes=this.registerDataOutput("nodes",a,i)}getClassName(){return"FlowGraphGLTFDataProvider"}}export{c as FlowGraphGLTFDataProvider}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphGetAssetBlock-DKMD3fRB.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphGetAssetBlock-DKMD3fRB.js new file mode 100644 index 0000000000000000000000000000000000000000..4dac332cad1415d082205f27ea462c7cb1a17f35 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphGetAssetBlock-DKMD3fRB.js @@ -0,0 +1 @@ +import{F as p,g as s,G as o}from"./KHR_interactivity-BtMudStn.js";import{R as e,F as l}from"./declarationMapper-Lanf6XPr.js";import{R as u}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class h extends p{constructor(t){super(t),this.config=t,this.type=this.registerDataInput("type",e,t.type),this.value=this.registerDataOutput("value",e),this.index=this.registerDataInput("index",e,new l(s(t.index??-1)))}_updateOutputs(t){const a=this.type.getValue(t),r=this.index.getValue(t),i=o(t.assetsContext,a,s(r),this.config.useIndexAsUniqueId);this.value.setValue(i,t)}getClassName(){return"FlowGraphGetAssetBlock"}}u("FlowGraphGetAssetBlock",h);export{h as FlowGraphGetAssetBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphGetPropertyBlock-DRLha8FE.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphGetPropertyBlock-DRLha8FE.js new file mode 100644 index 0000000000000000000000000000000000000000..e2cd7aac7da1f9109ceb8e30d714e1c062e5616e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphGetPropertyBlock-DRLha8FE.js @@ -0,0 +1 @@ +import{R as s}from"./declarationMapper-Lanf6XPr.js";import{R as a}from"./index-CDrXokXW.js";import{F as i}from"./flowGraphCachedOperationBlock-CAD6CbqU.js";import"./index-DWyDLubb.js";import"./KHR_interactivity-BtMudStn.js";import"./objectModelMapping-CGWnurZP.js";class u extends i{constructor(t){super(s,t),this.config=t,this.object=this.registerDataInput("object",s,t.object),this.propertyName=this.registerDataInput("propertyName",s,t.propertyName),this.customGetFunction=this.registerDataInput("customGetFunction",s)}_doOperation(t){const o=this.customGetFunction.getValue(t);let r;if(o)r=o(this.object.getValue(t),this.propertyName.getValue(t),t);else{const e=this.object.getValue(t),p=this.propertyName.getValue(t);r=e&&p?this._getPropertyValue(e,p):void 0}return r}_getPropertyValue(t,o){const r=o.split(".");let e=t;for(const p of r)if(e=e[p],e===void 0)return;return e}getClassName(){return"FlowGraphGetPropertyBlock"}}a("FlowGraphGetPropertyBlock",u);export{u as FlowGraphGetPropertyBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphGetVariableBlock-DRAnW3yF.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphGetVariableBlock-DRAnW3yF.js new file mode 100644 index 0000000000000000000000000000000000000000..fdee97811e730e56c2b9bd33431dd8ccdb9e45d2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphGetVariableBlock-DRAnW3yF.js @@ -0,0 +1 @@ +import{F as r}from"./KHR_interactivity-BtMudStn.js";import{R as i}from"./declarationMapper-Lanf6XPr.js";import{R as l}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class s extends r{constructor(a){super(a),this.config=a,this.value=this.registerDataOutput("value",i,a.initialValue)}_updateOutputs(a){const e=this.config.variable;a.hasVariable(e)&&this.value.setValue(a.getVariable(e),a)}serialize(a){super.serialize(a),a.config.variable=this.config.variable}getClassName(){return"FlowGraphGetVariableBlock"}}l("FlowGraphGetVariableBlock",s);export{s as FlowGraphGetVariableBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphIndexOfBlock-CrObGRpk.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphIndexOfBlock-CrObGRpk.js new file mode 100644 index 0000000000000000000000000000000000000000..c9cf6a8e9142f4c4f587fa711d0cd0ed662a994f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphIndexOfBlock-CrObGRpk.js @@ -0,0 +1 @@ +import{F as i}from"./KHR_interactivity-BtMudStn.js";import{R as r,i as o,F as a}from"./declarationMapper-Lanf6XPr.js";import{R as p}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class h extends i{constructor(e){super(e),this.config=e,this.object=this.registerDataInput("object",r),this.array=this.registerDataInput("array",r),this.index=this.registerDataOutput("index",o,new a(-1))}_updateOutputs(e){const s=this.object.getValue(e),t=this.array.getValue(e);t&&this.index.setValue(new a(t.indexOf(s)),e)}serialize(e){super.serialize(e)}getClassName(){return"FlowGraphIndexOfBlock"}}p("FlowGraphIndexOfBlock",h);export{h as FlowGraphIndexOfBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphInterpolationBlock-DTRpEzHP.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphInterpolationBlock-DTRpEzHP.js new file mode 100644 index 0000000000000000000000000000000000000000..cb38b99542910965aacd9b5f611e21f5d3c16171 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphInterpolationBlock-DTRpEzHP.js @@ -0,0 +1 @@ +import{F as c}from"./KHR_interactivity-BtMudStn.js";import{g as d,d as g,b as h,R as p}from"./declarationMapper-Lanf6XPr.js";import{as as y,R as F}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class f extends c{constructor(t={}){super(t),this.keyFrames=[];const e=typeof t?.animationType=="string"?d(t.animationType):g(t?.animationType??0),i=t?.keyFramesCount??1,n=this.registerDataInput("duration_0",h,0),a=this.registerDataInput("value_0",e);this.keyFrames.push({duration:n,value:a});for(let s=1;s{const o=y.CreateAnimation(m,n.animationType,60,i);return o.setKeys(a),o})}getClassName(){return"FlowGraphInterpolationBlock"}}F("FlowGraphInterpolationBlock",f);export{f as FlowGraphInterpolationBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphJsonPointerParserBlock-BDL8JHpS.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphJsonPointerParserBlock-BDL8JHpS.js new file mode 100644 index 0000000000000000000000000000000000000000..42d1f0780fa881d490e1fb67e565e916b608249a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphJsonPointerParserBlock-BDL8JHpS.js @@ -0,0 +1 @@ +import{i as A,F,R as c}from"./declarationMapper-Lanf6XPr.js";import{C as w,b9 as y,V as j,ai as I,R as _}from"./index-CDrXokXW.js";import{F as N}from"./flowGraphCachedOperationBlock-CAD6CbqU.js";import"./index-DWyDLubb.js";import"./KHR_interactivity-BtMudStn.js";import"./objectModelMapping-CGWnurZP.js";const g=new RegExp(/\/\{(\w+)\}(?=\/|$)/g);class V{constructor(r,s){this.path=r,this.ownerBlock=s,this.templatedInputs=[];let n=g.exec(r);const o=new Set;for(;n;){const[,e]=n;if(o.has(e))throw new Error("Duplicate template variable detected.");o.add(e),this.templatedInputs.push(s.registerDataInput(e,A,new F(0))),n=g.exec(r)}}getAccessor(r,s){let n=this.path;for(const o of this.templatedInputs){const e=o.getValue(s).value;if(typeof e!="number"||e<0)throw new Error("Invalid value for templated input.");n=n.replace(`{${o.name}}`,e.toString())}return r.convert(n)}}class D extends N{constructor(r){super(c,r),this.config=r,this.object=this.registerDataOutput("object",c),this.propertyName=this.registerDataOutput("propertyName",c),this.setterFunction=this.registerDataOutput("setFunction",c,this._setPropertyValue.bind(this)),this.getterFunction=this.registerDataOutput("getFunction",c,this._getPropertyValue.bind(this)),this.generateAnimationsFunction=this.registerDataOutput("generateAnimationsFunction",c,this._getInterpolationAnimationPropertyInfo.bind(this)),this.templateComponent=new V(r.jsonPointer,this)}_doOperation(r){const s=this.templateComponent.getAccessor(this.config.pathConverter,r),n=s.info.get(s.object),o=s.info.getTarget?.(s.object),e=s.info.getPropertyName?.[0](s.object);if(o)this.object.setValue(o,r),e&&this.propertyName.setValue(e,r);else throw new Error("Object is undefined");return n}_setPropertyValue(r,s,n,o){const e=this.templateComponent.getAccessor(this.config.pathConverter,o),a=e.info.type;a.startsWith("Color")&&(n=C(n,a)),e.info.set?.(n,e.object)}_getPropertyValue(r,s,n){const o=this.templateComponent.getAccessor(this.config.pathConverter,n),e=o.info.type,a=o.info.get(o.object);return e.startsWith("Color")?G(a):a}_getInterpolationAnimationPropertyInfo(r,s,n){const o=this.templateComponent.getAccessor(this.config.pathConverter,n);return(e,a,b,h)=>{const m=[],l=o.info.type;return l.startsWith("Color")&&(e=e.map(p=>({frame:p.frame,value:C(p.value,l)}))),o.info.interpolation?.forEach((p,f)=>{const d=o.info.getPropertyName?.[f](o.object)||"Animation-interpolation-"+f;let u=e;b!==p.type&&(u=e.map(i=>({frame:i.frame,value:p.getValue(void 0,i.value.asArray?i.value.asArray():[i.value],0,1)})));const P=p.buildAnimations(o.object,d,60,u);for(const i of P)h&&i.babylonAnimation.setEasingFunction(h),m.push(i.babylonAnimation)}),m}}getClassName(){return"FlowGraphJsonPointerParserBlock"}}function C(t,r){return t.getClassName().startsWith("Color")?t:r==="Color3"?new w(t.x,t.y,t.z):r==="Color4"?new y(t.x,t.y,t.z,t.w):t}function G(t){if(t instanceof w)return new j(t.r,t.g,t.b);if(t instanceof y)return new I(t.r,t.g,t.b,t.a);throw new Error("Invalid color type")}_("FlowGraphJsonPointerParserBlock",D);export{D as FlowGraphJsonPointerParserBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphMathBlocks-B5QWBKgA.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphMathBlocks-B5QWBKgA.js new file mode 100644 index 0000000000000000000000000000000000000000..6a8c6a232ae3369905e4bfe180abe86bdc352aff --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphMathBlocks-B5QWBKgA.js @@ -0,0 +1 @@ +import{ai as B,M as d,ao as N,V as v,ah as S,R as s}from"./index-CDrXokXW.js";import{i as G,F as y,g as i,R as l,b as a,c as k,n as x,p as _}from"./declarationMapper-Lanf6XPr.js";import{F as w}from"./flowGraphBinaryOperationBlock-C6Dwxvh5.js";import{F as R}from"./flowGraphCachedOperationBlock-CAD6CbqU.js";import{F as c}from"./flowGraphUnaryOperationBlock-wNBDBj1u.js";import{i as I,g as m,h as F,j as f,k as M,l as g}from"./KHR_interactivity-BtMudStn.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class T extends R{constructor(r,o,t,n){super(r,n),this._operation=o,this._className=t}_doOperation(r){return this._operation(r)}getClassName(){return this._className}}class D extends R{constructor(r,o,t,n,p,u,O){super(n,O),this._operation=p,this._className=u,this.a=this.registerDataInput("a",r),this.b=this.registerDataInput("b",o),this.c=this.registerDataInput("c",t)}_doOperation(r){return this._operation(this.a.getValue(r),this.b.getValue(r),this.c.getValue(r))}getClassName(){return this._className}}class L extends w{constructor(r){super(i(r?.type),i(r?.type),i(r?.type),(o,t)=>this._polymorphicAdd(o,t),"FlowGraphAddBlock",r)}_polymorphicAdd(r,o){const t=F(r),n=F(o);if(f(t,n)||M(t,n)||g(t,n))return r.add(o);if(t==="Quaternion"||n==="Vector4")return new B(r.x,r.y,r.z,r.w).addInPlace(o);if(t==="Vector4"||n==="Quaternion")return r.add(o);if(this.config?.preventIntegerFloatArithmetic&&typeof r!=typeof o)throw new Error("Cannot add different types of numbers.");return m(r)+m(o)}}s("FlowGraphAddBlock",L);class V extends w{constructor(r){super(i(r?.type),i(r?.type),i(r?.type),(o,t)=>this._polymorphicSubtract(o,t),"FlowGraphSubtractBlock",r)}_polymorphicSubtract(r,o){const t=F(r),n=F(o);if(f(t,n)||g(t,n)||M(t,n))return r.subtract(o);if(t==="Quaternion"||n==="Vector4")return new B(r.x,r.y,r.z,r.w).subtractInPlace(o);if(t==="Vector4"||n==="Quaternion")return r.subtract(o);if(this.config?.preventIntegerFloatArithmetic&&typeof r!=typeof o)throw new Error("Cannot add different types of numbers.");return m(r)-m(o)}}s("FlowGraphSubtractBlock",V);class z extends w{constructor(r){super(i(r?.type),i(r?.type),i(r?.type),(o,t)=>this._polymorphicMultiply(o,t),"FlowGraphMultiplyBlock",r)}_polymorphicMultiply(r,o){const t=F(r),n=F(o);if(f(t,n)||g(t,n))return r.multiply(o);if(t==="Quaternion"||n==="Vector4")return new B(r.x,r.y,r.z,r.w).multiplyInPlace(o);if(t==="Vector4"||n==="Quaternion")return r.multiply(o);if(M(t,n))if(this.config?.useMatrixPerComponent){const p=r.m;for(let u=0;uthis._polymorphicDivide(o,t),"FlowGraphDivideBlock",r)}_polymorphicDivide(r,o){const t=F(r),n=F(o);if(f(t,n)||g(t,n))return r.divide(o);if(t==="Quaternion"||n==="Quaternion"){const p=r.clone();return p.x/=o.x,p.y/=o.y,p.z/=o.z,p.w/=o.w,p}else{if(t==="Quaternion"||n==="Vector4")return new B(r.x,r.y,r.z,r.w).divideInPlace(o);if(t==="Vector4"||n==="Quaternion")return r.divide(o);if(M(t,n))if(this.config?.useMatrixPerComponent){const p=r.m;for(let u=0;uthis._random(o),"FlowGraphRandomBlock",r),this.min=this.registerDataInput("min",a,r?.min??0),this.max=this.registerDataInput("max",a,r?.max??1),r?.seed&&(this._seed=r.seed)}_isSeed(r=this._seed){return r!==void 0}_getRandomValue(){if(this._isSeed(this._seed)){const r=Math.sin(this._seed++)*1e4;return r-Math.floor(r)}return Math.random()}_random(r){const o=this.min.getValue(r),t=this.max.getValue(r);return this._getRandomValue()*(t-o)+o}}s("FlowGraphRandomBlock",P);class Q extends T{constructor(r){super(a,()=>Math.E,"FlowGraphEBlock",r)}}s("FlowGraphEBlock",Q);class $ extends T{constructor(r){super(a,()=>Math.PI,"FlowGraphPIBlock",r)}}s("FlowGraphPIBlock",$);class j extends T{constructor(r){super(a,()=>Number.POSITIVE_INFINITY,"FlowGraphInfBlock",r)}}s("FlowGraphInfBlock",j);class Z extends T{constructor(r){super(a,()=>Number.NaN,"FlowGraphNaNBlock",r)}}s("FlowGraphNaNBlock",Z);function h(e,r){switch(F(e)){case"FlowGraphInteger":return e=e,new y(r(e.value));case"Vector2":return e=e,new S(r(e.x),r(e.y));case"Vector3":return e=e,new v(r(e.x),r(e.y),r(e.z));case"Vector4":return e=e,new B(r(e.x),r(e.y),r(e.z),r(e.w));case"Quaternion":return e=e,new N(r(e.x),r(e.y),r(e.z),r(e.w));case"Matrix":return e=e,d.FromArray(e.m.map(r));case"Matrix2D":return e=e,new x(e.m.map(r));case"Matrix3D":return e=e,new _(e.m.map(r));default:return e=e,r(e)}}class X extends c{constructor(r){super(a,a,o=>this._polymorphicAbs(o),"FlowGraphAbsBlock",r)}_polymorphicAbs(r){return h(r,Math.abs)}}s("FlowGraphAbsBlock",X);class W extends c{constructor(r){super(a,a,o=>this._polymorphicSign(o),"FlowGraphSignBlock",r)}_polymorphicSign(r){return h(r,Math.sign)}}s("FlowGraphSignBlock",W);class U extends c{constructor(r){super(a,a,o=>this._polymorphicTrunc(o),"FlowGraphTruncBlock",r)}_polymorphicTrunc(r){return h(r,Math.trunc)}}s("FlowGraphTruncBlock",U);class H extends c{constructor(r){super(a,a,o=>this._polymorphicFloor(o),"FlowGraphFloorBlock",r)}_polymorphicFloor(r){return h(r,Math.floor)}}s("FlowGraphFloorBlock",H);class Y extends c{constructor(r){super(l,l,o=>this._polymorphicCeiling(o),"FlowGraphCeilBlock",r)}_polymorphicCeiling(r){return h(r,Math.ceil)}}s("FlowGraphCeilBlock",Y);class J extends c{constructor(r){super(l,l,o=>this._polymorphicRound(o),"FlowGraphRoundBlock",r)}_polymorphicRound(r){return h(r,o=>o<0&&this.config?.roundHalfAwayFromZero?-Math.round(-o):Math.round(o))}}s("FlowGraphRoundBlock",J);class K extends c{constructor(r){super(l,l,o=>this._polymorphicFraction(o),"FlowGraphFractBlock",r)}_polymorphicFraction(r){return h(r,o=>o-Math.floor(o))}}s("FlowGraphFractBlock",K);class b extends c{constructor(r){super(l,l,o=>this._polymorphicNeg(o),"FlowGraphNegationBlock",r)}_polymorphicNeg(r){return h(r,o=>-o)}}s("FlowGraphNegationBlock",b);function C(e,r,o){switch(F(e)){case"FlowGraphInteger":return e=e,r=r,new y(o(e.value,r.value));case"Vector2":return e=e,r=r,new S(o(e.x,r.x),o(e.y,r.y));case"Vector3":return e=e,r=r,new v(o(e.x,r.x),o(e.y,r.y),o(e.z,r.z));case"Vector4":return e=e,r=r,new B(o(e.x,r.x),o(e.y,r.y),o(e.z,r.z),o(e.w,r.w));case"Quaternion":return e=e,r=r,new N(o(e.x,r.x),o(e.y,r.y),o(e.z,r.z),o(e.w,r.w));case"Matrix":return e=e,d.FromArray(e.m.map((n,p)=>o(n,r.m[p])));case"Matrix2D":return e=e,new x(e.m.map((n,p)=>o(n,r.m[p])));case"Matrix3D":return e=e,new _(e.m.map((n,p)=>o(n,r.m[p])));default:return o(m(e),m(r))}}class rr extends w{constructor(r){super(l,l,l,(o,t)=>this._polymorphicRemainder(o,t),"FlowGraphModuloBlock",r)}_polymorphicRemainder(r,o){return C(r,o,(t,n)=>t%n)}}s("FlowGraphModuloBlock",rr);class or extends w{constructor(r){super(l,l,l,(o,t)=>this._polymorphicMin(o,t),"FlowGraphMinBlock",r)}_polymorphicMin(r,o){return C(r,o,Math.min)}}s("FlowGraphMinBlock",or);class er extends w{constructor(r){super(l,l,l,(o,t)=>this._polymorphicMax(o,t),"FlowGraphMaxBlock",r)}_polymorphicMax(r,o){return C(r,o,Math.max)}}s("FlowGraphMaxBlock",er);function tr(e,r,o){return Math.min(Math.max(e,Math.min(r,o)),Math.max(r,o))}function E(e,r,o,t){switch(F(e)){case"FlowGraphInteger":return e=e,r=r,o=o,new y(t(e.value,r.value,o.value));case"Vector2":return e=e,r=r,o=o,new S(t(e.x,r.x,o.x),t(e.y,r.y,o.y));case"Vector3":return e=e,r=r,o=o,new v(t(e.x,r.x,o.x),t(e.y,r.y,o.y),t(e.z,r.z,o.z));case"Vector4":return e=e,r=r,o=o,new B(t(e.x,r.x,o.x),t(e.y,r.y,o.y),t(e.z,r.z,o.z),t(e.w,r.w,o.w));case"Quaternion":return e=e,r=r,o=o,new N(t(e.x,r.x,o.x),t(e.y,r.y,o.y),t(e.z,r.z,o.z),t(e.w,r.w,o.w));case"Matrix":return d.FromArray(e.m.map((p,u)=>t(p,r.m[u],o.m[u])));case"Matrix2D":return new x(e.m.map((p,u)=>t(p,r.m[u],o.m[u])));case"Matrix3D":return new _(e.m.map((p,u)=>t(p,r.m[u],o.m[u])));default:return t(m(e),m(r),m(o))}}class lr extends D{constructor(r){super(l,l,l,l,(o,t,n)=>this._polymorphicClamp(o,t,n),"FlowGraphClampBlock",r)}_polymorphicClamp(r,o,t){return E(r,o,t,tr)}}s("FlowGraphClampBlock",lr);function sr(e){return Math.min(Math.max(e,0),1)}class nr extends c{constructor(r){super(l,l,o=>this._polymorphicSaturate(o),"FlowGraphSaturateBlock",r)}_polymorphicSaturate(r){return h(r,sr)}}s("FlowGraphSaturateBlock",nr);function ar(e,r,o){return(1-o)*e+o*r}class cr extends D{constructor(r){super(l,l,l,l,(o,t,n)=>this._polymorphicInterpolate(o,t,n),"FlowGraphMathInterpolationBlock",r)}_polymorphicInterpolate(r,o,t){return E(r,o,t,ar)}}s("FlowGraphMathInterpolationBlock",cr);class pr extends w{constructor(r){super(l,l,k,(o,t)=>this._polymorphicEq(o,t),"FlowGraphEqualityBlock",r)}_polymorphicEq(r,o){const t=F(r),n=F(o);return typeof r!=typeof o?!1:f(t,n)||M(t,n)||g(t,n)?r.equals(o):r===o}}s("FlowGraphEqualityBlock",pr);function A(e,r,o){if(I(e)&&I(r))return o(m(e),m(r));throw new Error(`Cannot compare ${e} and ${r}`)}class hr extends w{constructor(r){super(l,l,k,(o,t)=>this._polymorphicLessThan(o,t),"FlowGraphLessThanBlock",r)}_polymorphicLessThan(r,o){return A(r,o,(t,n)=>tthis._polymorphicLessThanOrEqual(o,t),"FlowGraphLessThanOrEqualBlock",r)}_polymorphicLessThanOrEqual(r,o){return A(r,o,(t,n)=>t<=n)}}s("FlowGraphLessThanOrEqualBlock",ir);class ur extends w{constructor(r){super(l,l,k,(o,t)=>this._polymorphicGreaterThan(o,t),"FlowGraphGreaterThanBlock",r)}_polymorphicGreaterThan(r,o){return A(r,o,(t,n)=>t>n)}}s("FlowGraphGreaterThanBlock",ur);class wr extends w{constructor(r){super(l,l,k,(o,t)=>this._polymorphicGreaterThanOrEqual(o,t),"FlowGraphGreaterThanOrEqualBlock",r)}_polymorphicGreaterThanOrEqual(r,o){return A(r,o,(t,n)=>t>=n)}}s("FlowGraphGreaterThanOrEqualBlock",wr);class mr extends c{constructor(r){super(l,k,o=>this._polymorphicIsNan(o),"FlowGraphIsNaNBlock",r)}_polymorphicIsNan(r){if(I(r,!0))return isNaN(m(r));throw new Error(`Cannot get NaN of ${r}`)}}s("FlowGraphIsNaNBlock",mr);class Fr extends c{constructor(r){super(l,k,o=>this._polymorphicIsInf(o),"FlowGraphIsInfBlock",r)}_polymorphicIsInf(r){if(I(r))return!isFinite(m(r));throw new Error(`Cannot get isInf of ${r}`)}}s("FlowGraphIsInfBlock",Fr);class Gr extends c{constructor(r){super(l,l,o=>this._polymorphicDegToRad(o),"FlowGraphDegToRadBlock",r)}_degToRad(r){return r*Math.PI/180}_polymorphicDegToRad(r){return h(r,this._degToRad)}}s("FlowGraphDegToRadBlock",Gr);class yr extends c{constructor(r){super(l,l,o=>this._polymorphicRadToDeg(o),"FlowGraphRadToDegBlock",r)}_radToDeg(r){return r*180/Math.PI}_polymorphicRadToDeg(r){return h(r,this._radToDeg)}}s("FlowGraphRadToDegBlock",yr);class br extends c{constructor(r){super(a,a,o=>this._polymorphicSin(o),"FlowGraphSinBlock",r)}_polymorphicSin(r){return h(r,Math.sin)}}class ro extends c{constructor(r){super(a,a,o=>this._polymorphicCos(o),"FlowGraphCosBlock",r)}_polymorphicCos(r){return h(r,Math.cos)}}class oo extends c{constructor(r){super(a,a,o=>this._polymorphicTan(o),"FlowGraphTanBlock",r)}_polymorphicTan(r){return h(r,Math.tan)}}class Br extends c{constructor(r){super(a,a,o=>this._polymorphicAsin(o),"FlowGraphASinBlock",r)}_polymorphicAsin(r){return h(r,Math.asin)}}s("FlowGraphASinBlock",Br);class kr extends c{constructor(r){super(a,a,o=>this._polymorphicAcos(o),"FlowGraphACosBlock",r)}_polymorphicAcos(r){return h(r,Math.acos)}}s("FlowGraphACosBlock",kr);class dr extends c{constructor(r){super(a,a,o=>this._polymorphicAtan(o),"FlowGraphATanBlock",r)}_polymorphicAtan(r){return h(r,Math.atan)}}s("FlowGraphATanBlock",dr);class xr extends w{constructor(r){super(l,l,l,(o,t)=>this._polymorphicAtan2(o,t),"FlowGraphATan2Block",r)}_polymorphicAtan2(r,o){return C(r,o,Math.atan2)}}s("FlowGraphATan2Block",xr);class _r extends c{constructor(r){super(l,l,o=>this._polymorphicSinh(o),"FlowGraphSinhBlock",r)}_polymorphicSinh(r){return h(r,Math.sinh)}}s("FlowGraphSinhBlock",_r);class fr extends c{constructor(r){super(l,l,o=>this._polymorphicCosh(o),"FlowGraphCoshBlock",r)}_polymorphicCosh(r){return h(r,Math.cosh)}}s("FlowGraphCoshBlock",fr);class Mr extends c{constructor(r){super(l,l,o=>this._polymorphicTanh(o),"FlowGraphTanhBlock",r)}_polymorphicTanh(r){return h(r,Math.tanh)}}s("FlowGraphTanhBlock",Mr);class gr extends c{constructor(r){super(l,a,o=>this._polymorphicAsinh(o),"FlowGraphASinhBlock",r)}_polymorphicAsinh(r){return h(r,Math.asinh)}}s("FlowGraphASinhBlock",gr);class Tr extends c{constructor(r){super(l,a,o=>this._polymorphicAcosh(o),"FlowGraphACoshBlock",r)}_polymorphicAcosh(r){return h(r,Math.acosh)}}s("FlowGraphACoshBlock",Tr);class Cr extends c{constructor(r){super(l,a,o=>this._polymorphicAtanh(o),"FlowGraphATanhBlock",r)}_polymorphicAtanh(r){return h(r,Math.atanh)}}s("FlowGraphATanhBlock",Cr);class Ir extends c{constructor(r){super(l,a,o=>this._polymorphicExp(o),"FlowGraphExponentialBlock",r)}_polymorphicExp(r){return h(r,Math.exp)}}s("FlowGraphExponentialBlock",Ir);class Ar extends c{constructor(r){super(l,a,o=>this._polymorphicLog(o),"FlowGraphLogBlock",r)}_polymorphicLog(r){return h(r,Math.log)}}s("FlowGraphLogBlock",Ar);class Nr extends c{constructor(r){super(l,a,o=>this._polymorphicLog2(o),"FlowGraphLog2Block",r)}_polymorphicLog2(r){return h(r,Math.log2)}}s("FlowGraphLog2Block",Nr);class vr extends c{constructor(r){super(l,a,o=>this._polymorphicLog10(o),"FlowGraphLog10Block",r)}_polymorphicLog10(r){return h(r,Math.log10)}}s("FlowGraphLog10Block",vr);class Sr extends c{constructor(r){super(l,a,o=>this._polymorphicSqrt(o),"FlowGraphSquareRootBlock",r)}_polymorphicSqrt(r){return h(r,Math.sqrt)}}s("FlowGraphSquareRootBlock",Sr);class Rr extends c{constructor(r){super(l,a,o=>this._polymorphicCubeRoot(o),"FlowGraphCubeRootBlock",r)}_polymorphicCubeRoot(r){return h(r,Math.cbrt)}}s("FlowGraphCubeRootBlock",Rr);class Dr extends w{constructor(r){super(l,a,a,(o,t)=>this._polymorphicPow(o,t),"FlowGraphPowerBlock",r)}_polymorphicPow(r,o){return C(r,o,Math.pow)}}s("FlowGraphPowerBlock",Dr);class Er extends c{constructor(r){super(i(r?.valueType||"FlowGraphInteger"),i(r?.valueType||"FlowGraphInteger"),o=>typeof o=="boolean"?!o:typeof o=="number"?~o:new y(~o.value),"FlowGraphBitwiseNotBlock",r)}}s("FlowGraphBitwiseNotBlock",Er);class Or extends w{constructor(r){super(i(r?.valueType||"FlowGraphInteger"),i(r?.valueType||"FlowGraphInteger"),i(r?.valueType||"FlowGraphInteger"),(o,t)=>{if(typeof o=="boolean"&&typeof t=="boolean")return o&&t;if(typeof o=="number"&&typeof t=="number")return o&t;if(typeof o=="object"&&typeof t=="object")return new y(o.value&t.value);throw new Error(`Cannot perform bitwise AND on ${o} and ${t}`)},"FlowGraphBitwiseAndBlock",r)}}s("FlowGraphBitwiseAndBlock",Or);class Lr extends w{constructor(r){super(i(r?.valueType||"FlowGraphInteger"),i(r?.valueType||"FlowGraphInteger"),i(r?.valueType||"FlowGraphInteger"),(o,t)=>{if(typeof o=="boolean"&&typeof t=="boolean")return o||t;if(typeof o=="number"&&typeof t=="number")return o|t;if(typeof o=="object"&&typeof t=="object")return new y(o.value|t.value);throw new Error(`Cannot perform bitwise OR on ${o} and ${t}`)},"FlowGraphBitwiseOrBlock",r)}}s("FlowGraphBitwiseOrBlock",Lr);class Vr extends w{constructor(r){super(i(r?.valueType||"FlowGraphInteger"),i(r?.valueType||"FlowGraphInteger"),i(r?.valueType||"FlowGraphInteger"),(o,t)=>{if(typeof o=="boolean"&&typeof t=="boolean")return o!==t;if(typeof o=="number"&&typeof t=="number")return o^t;if(typeof o=="object"&&typeof t=="object")return new y(o.value^t.value);throw new Error(`Cannot perform bitwise XOR on ${o} and ${t}`)},"FlowGraphBitwiseXorBlock",r)}}s("FlowGraphBitwiseXorBlock",Vr);class zr extends w{constructor(r){super(G,G,G,(o,t)=>new y(o.value<new y(o.value>>t.value),"FlowGraphBitwiseRightShiftBlock",r)}}s("FlowGraphBitwiseRightShiftBlock",qr);class Pr extends c{constructor(r){super(G,G,o=>new y(Math.clz32(o.value)),"FlowGraphLeadingZerosBlock",r)}}s("FlowGraphLeadingZerosBlock",Pr);class Qr extends c{constructor(r){super(G,G,o=>new y(o.value?31-Math.clz32(o.value&-o.value):32),"FlowGraphTrailingZerosBlock",r)}}s("FlowGraphTrailingZerosBlock",Qr);function $r(e){let r=0;for(;e;)r+=e&1,e>>=1;return r}class jr extends c{constructor(r){super(G,G,o=>new y($r(o.value)),"FlowGraphOneBitsCounterBlock",r)}}s("FlowGraphOneBitsCounterBlock",jr);export{X as FlowGraphAbsBlock,kr as FlowGraphAcosBlock,Tr as FlowGraphAcoshBlock,L as FlowGraphAddBlock,Br as FlowGraphAsinBlock,gr as FlowGraphAsinhBlock,xr as FlowGraphAtan2Block,dr as FlowGraphAtanBlock,Cr as FlowGraphAtanhBlock,Or as FlowGraphBitwiseAndBlock,zr as FlowGraphBitwiseLeftShiftBlock,Er as FlowGraphBitwiseNotBlock,Lr as FlowGraphBitwiseOrBlock,qr as FlowGraphBitwiseRightShiftBlock,Vr as FlowGraphBitwiseXorBlock,Y as FlowGraphCeilBlock,lr as FlowGraphClampBlock,ro as FlowGraphCosBlock,fr as FlowGraphCoshBlock,Rr as FlowGraphCubeRootBlock,Gr as FlowGraphDegToRadBlock,q as FlowGraphDivideBlock,Q as FlowGraphEBlock,pr as FlowGraphEqualityBlock,Ir as FlowGraphExpBlock,H as FlowGraphFloorBlock,K as FlowGraphFractionBlock,ur as FlowGraphGreaterThanBlock,wr as FlowGraphGreaterThanOrEqualBlock,j as FlowGraphInfBlock,Fr as FlowGraphIsInfinityBlock,mr as FlowGraphIsNanBlock,Pr as FlowGraphLeadingZerosBlock,hr as FlowGraphLessThanBlock,ir as FlowGraphLessThanOrEqualBlock,vr as FlowGraphLog10Block,Nr as FlowGraphLog2Block,Ar as FlowGraphLogBlock,cr as FlowGraphMathInterpolationBlock,er as FlowGraphMaxBlock,or as FlowGraphMinBlock,rr as FlowGraphModuloBlock,z as FlowGraphMultiplyBlock,Z as FlowGraphNaNBlock,b as FlowGraphNegationBlock,jr as FlowGraphOneBitsCounterBlock,$ as FlowGraphPiBlock,Dr as FlowGraphPowerBlock,yr as FlowGraphRadToDegBlock,P as FlowGraphRandomBlock,J as FlowGraphRoundBlock,nr as FlowGraphSaturateBlock,W as FlowGraphSignBlock,br as FlowGraphSinBlock,_r as FlowGraphSinhBlock,Sr as FlowGraphSquareRootBlock,V as FlowGraphSubtractBlock,oo as FlowGraphTanBlock,Mr as FlowGraphTanhBlock,Qr as FlowGraphTrailingZerosBlock,U as FlowGraphTruncBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphMathCombineExtractBlocks-CsnqKtJp.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphMathCombineExtractBlocks-CsnqKtJp.js new file mode 100644 index 0000000000000000000000000000000000000000..f4965ee07fe5e9bc5c9ca4f9e8fca68dec2f6099 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphMathCombineExtractBlocks-CsnqKtJp.js @@ -0,0 +1 @@ +import{F}from"./flowGraphCachedOperationBlock-CAD6CbqU.js";import{h as l,k as n,e as h,l as g,b as o,m as V,n as c,o as _,p as D}from"./declarationMapper-Lanf6XPr.js";import{F as G}from"./KHR_interactivity-BtMudStn.js";import{M as I,ai as m,V as w,ah as d,R as i}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class s extends F{constructor(t,a,e){super(a,e);for(let p=0;pi.transpose?i.transpose():d.Transpose(i),"FlowGraphTransposeBlock",t)}}r("FlowGraphTransposeBlock",b);class E extends V{constructor(t){super(e(t?.matrixType||"Matrix"),k,i=>i.determinant(),"FlowGraphDeterminantBlock",t)}}r("FlowGraphDeterminantBlock",E);class _ extends V{constructor(t){super(e(t?.matrixType||"Matrix"),e(t?.matrixType||"Matrix"),i=>i.inverse?i.inverse():d.Invert(i),"FlowGraphInvertMatrixBlock",t)}}r("FlowGraphInvertMatrixBlock",_);class v extends D{constructor(t){super(e(t?.matrixType||"Matrix"),e(t?.matrixType||"Matrix"),e(t?.matrixType||"Matrix"),(i,a)=>a.multiply(i),"FlowGraphMatrixMultiplicationBlock",t)}}r("FlowGraphMatrixMultiplicationBlock",v);class R extends M{constructor(t){super(t),this.input=this.registerDataInput("input",w),this.position=this.registerDataOutput("position",u),this.rotationQuaternion=this.registerDataOutput("rotationQuaternion",g),this.scaling=this.registerDataOutput("scaling",u),this.isValid=this.registerDataOutput("isValid",T,!1)}_updateOutputs(t){const i=t._getExecutionVariable(this,"executionId",-1),a=t._getExecutionVariable(this,"cachedPosition",null),s=t._getExecutionVariable(this,"cachedRotation",null),p=t._getExecutionVariable(this,"cachedScaling",null);if(i===t.executionId&&a&&s&&p)this.position.setValue(a,t),this.rotationQuaternion.setValue(s,t),this.scaling.setValue(p,t);else{const l=this.input.getValue(t),h=a||new n,c=s||new x,m=p||new n,F=Math.round(l.m[3]*1e4)/1e4,G=Math.round(l.m[7]*1e4)/1e4,y=Math.round(l.m[11]*1e4)/1e4,B=Math.round(l.m[15]*1e4)/1e4;if(F!==0||G!==0||y!==0||B!==1){this.isValid.setValue(!1,t),this.position.setValue(n.Zero(),t),this.rotationQuaternion.setValue(x.Identity(),t),this.scaling.setValue(n.One(),t);return}const I=l.decompose(m,c,h);this.isValid.setValue(I,t),this.position.setValue(h,t),this.rotationQuaternion.setValue(c,t),this.scaling.setValue(m,t),t._setExecutionVariable(this,"cachedPosition",h),t._setExecutionVariable(this,"cachedRotation",c),t._setExecutionVariable(this,"cachedScaling",m),t._setExecutionVariable(this,"executionId",t.executionId)}}getClassName(){return"FlowGraphMatrixDecompose"}}r("FlowGraphMatrixDecompose",R);class O extends M{constructor(t){super(t),this.position=this.registerDataInput("position",u),this.rotationQuaternion=this.registerDataInput("rotationQuaternion",g),this.scaling=this.registerDataInput("scaling",u),this.value=this.registerDataOutput("value",w)}_updateOutputs(t){const i=t._getExecutionVariable(this,"executionId",-1),a=t._getExecutionVariable(this,"cachedMatrix",null);if(i===t.executionId&&a)this.value.setValue(a,t);else{const s=d.Compose(this.scaling.getValue(t),this.rotationQuaternion.getValue(t),this.position.getValue(t));this.value.setValue(s,t),t._setExecutionVariable(this,"cachedMatrix",s),t._setExecutionVariable(this,"executionId",t.executionId)}}getClassName(){return"FlowGraphMatrixCompose"}}r("FlowGraphMatrixCompose",O);export{E as FlowGraphDeterminantBlock,_ as FlowGraphInvertMatrixBlock,O as FlowGraphMatrixComposeBlock,R as FlowGraphMatrixDecomposeBlock,v as FlowGraphMatrixMultiplicationBlock,b as FlowGraphTransposeBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphMeshPickEventBlock-336WsC8m.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphMeshPickEventBlock-336WsC8m.js new file mode 100644 index 0000000000000000000000000000000000000000..7858820e32d154fa2509d65cae1fb98e4634279b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphMeshPickEventBlock-336WsC8m.js @@ -0,0 +1 @@ +import{c as p,_ as a}from"./KHR_interactivity-BtMudStn.js";import{aQ as h,R as n}from"./index-CDrXokXW.js";import{R as s,e as r,b as o}from"./declarationMapper-Lanf6XPr.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class u extends p{constructor(e){super(e),this.config=e,this.type="MeshPick",this.asset=this.registerDataInput("asset",s,e?.targetMesh),this.pickedPoint=this.registerDataOutput("pickedPoint",r),this.pickOrigin=this.registerDataOutput("pickOrigin",r),this.pointerId=this.registerDataOutput("pointerId",o),this.pickedMesh=this.registerDataOutput("pickedMesh",s),this.pointerType=this.registerDataInput("pointerType",s,h.POINTERPICK)}_getReferencedMesh(e){return this.asset.getValue(e)}_executeEvent(e,t){if(this.pointerType.getValue(e)!==t.type)return!0;const i=this._getReferencedMesh(e);return i&&t.pickInfo?.pickedMesh&&(t.pickInfo?.pickedMesh===i||a(t.pickInfo?.pickedMesh,i))?(this.pointerId.setValue(t.event.pointerId,e),this.pickOrigin.setValue(t.pickInfo.ray?.origin,e),this.pickedPoint.setValue(t.pickInfo.pickedPoint,e),this.pickedMesh.setValue(t.pickInfo.pickedMesh,e),this._execute(e),!this.config?.stopPropagation):(this.pointerId.resetToDefaultValue(e),this.pickOrigin.resetToDefaultValue(e),this.pickedPoint.resetToDefaultValue(e),this.pickedMesh.resetToDefaultValue(e),!0)}_preparePendingTasks(e){}_cancelPendingTasks(e){}getClassName(){return"FlowGraphMeshPickEventBlock"}}n("FlowGraphMeshPickEventBlock",u);export{u as FlowGraphMeshPickEventBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphMultiGateBlock-4iS0VrNF.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphMultiGateBlock-4iS0VrNF.js new file mode 100644 index 0000000000000000000000000000000000000000..e7fc7c839a30a18869f3f8f086a98b06cdae2093 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphMultiGateBlock-4iS0VrNF.js @@ -0,0 +1 @@ +import{R as a}from"./index-CDrXokXW.js";import{e as l}from"./KHR_interactivity-BtMudStn.js";import{i as u,F as n}from"./declarationMapper-Lanf6XPr.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class o extends l{constructor(t){super(t),this.config=t,this.outputSignals=[],this.reset=this._registerSignalInput("reset"),this.lastIndex=this.registerDataOutput("lastIndex",u,new n(-1)),this.setNumberOfOutputSignals(t?.outputSignalCount)}_getNextIndex(t){if(t.includes(!1)||this.config.isLoop&&t.fill(!1),this.config.isRandom){const e=t.map((s,i)=>s?-1:i).filter(s=>s!==-1);return e.length?e[Math.floor(Math.random()*e.length)]:-1}else return t.indexOf(!1)}setNumberOfOutputSignals(t=1){for(;this.outputSignals.length>t;){const e=this.outputSignals.pop();e&&(e.disconnectFromAll(),this._unregisterSignalOutput(e.name))}for(;this.outputSignals.length!1)),e===this.reset){t._deleteExecutionVariable(this,"indexesUsed"),this.lastIndex.setValue(new n(-1),t);return}const s=t._getExecutionVariable(this,"indexesUsed",[]),i=this._getNextIndex(s);i>-1&&(this.lastIndex.setValue(new n(i),t),s[i]=!0,t._setExecutionVariable(this,"indexesUsed",s),this.outputSignals[i]._activateSignal(t))}getClassName(){return"FlowGraphMultiGateBlock"}serialize(t){super.serialize(t),t.config.outputSignalCount=this.config.outputSignalCount,t.config.isRandom=this.config.isRandom,t.config.loop=this.config.isLoop,t.config.startIndex=this.config.startIndex}}a("FlowGraphMultiGateBlock",o);export{o as FlowGraphMultiGateBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphPauseAnimationBlock-BCBVeYeV.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphPauseAnimationBlock-BCBVeYeV.js new file mode 100644 index 0000000000000000000000000000000000000000..b5cb948ff59dfe71dc519209f3ae49e564f0af4b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphPauseAnimationBlock-BCBVeYeV.js @@ -0,0 +1 @@ +import{b as o}from"./KHR_interactivity-BtMudStn.js";import{R as t}from"./declarationMapper-Lanf6XPr.js";import{R as i}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class e extends o{constructor(a){super(a),this.animationToPause=this.registerDataInput("animationToPause",t)}_execute(a){this.animationToPause.getValue(a).pause(),this.out._activateSignal(a)}getClassName(){return"FlowGraphPauseAnimationBlock"}}i("FlowGraphPauseAnimationBlock",e);export{e as FlowGraphPauseAnimationBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphPlayAnimationBlock-CEIRjwmT.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphPlayAnimationBlock-CEIRjwmT.js new file mode 100644 index 0000000000000000000000000000000000000000..6812e796fc49bff951135084d00d0a7ea41b5880 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphPlayAnimationBlock-CEIRjwmT.js @@ -0,0 +1 @@ +import{a as f}from"./KHR_interactivity-BtMudStn.js";import{b as u,c as _,R as l}from"./declarationMapper-Lanf6XPr.js";import{R as b}from"./index-CDrXokXW.js";import{AnimationGroup as y}from"./animationGroup-CCzMCPMh.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";import"./bone-z620UXj2.js";class V extends f{constructor(i){super(i,["animationLoop","animationEnd","animationGroupLoop"]),this.config=i,this.speed=this.registerDataInput("speed",u),this.loop=this.registerDataInput("loop",_),this.from=this.registerDataInput("from",u,0),this.to=this.registerDataInput("to",u),this.currentFrame=this.registerDataOutput("currentFrame",u),this.currentTime=this.registerDataOutput("currentTime",u),this.currentAnimationGroup=this.registerDataOutput("currentAnimationGroup",l),this.animationGroup=this.registerDataInput("animationGroup",l,i?.animationGroup),this.animation=this.registerDataInput("animation",l),this.object=this.registerDataInput("object",l)}_preparePendingTasks(i){const t=this.animationGroup.getValue(i),r=this.animation.getValue(i);if(!t&&!r)return this._reportError(i,"No animation or animation group provided");{const a=this.currentAnimationGroup.getValue(i);a&&a!==t&&a.dispose();let n=t;if(r&&!n){const o=this.object.getValue(i);if(!o)return this._reportError(i,"No target object provided");const h=Array.isArray(r)?r:[r],G=h[0].name;n=new y("flowGraphAnimationGroup-"+G+"-"+o.name,i.configuration.scene);let g=!1;const A=i._getGlobalContextVariable("interpolationAnimations",[]);for(const c of h)n.addTargetedAnimation(c,o),A.indexOf(c.uniqueId)!==-1&&(g=!0);g&&this._checkInterpolationDuplications(i,h,o)}const s=this.speed.getValue(i)||1,e=this.from.getValue(i)??0,p=this.to.getValue(i)||n.to,d=!isFinite(p)||this.loop.getValue(i);this.currentAnimationGroup.setValue(n,i);const m=i._getGlobalContextVariable("currentlyRunningAnimationGroups",[]);m.indexOf(n.uniqueId)!==-1&&n.stop();try{n.start(d,s,e,p),n.onAnimationGroupEndObservable.add(()=>this._onAnimationGroupEnd(i)),n.onAnimationEndObservable.add(()=>this._eventsSignalOutputs.animationEnd._activateSignal(i)),n.onAnimationLoopObservable.add(()=>this._eventsSignalOutputs.animationLoop._activateSignal(i)),n.onAnimationGroupLoopObservable.add(()=>this._eventsSignalOutputs.animationGroupLoop._activateSignal(i)),m.push(n.uniqueId),i._setGlobalContextVariable("currentlyRunningAnimationGroups",m)}catch(o){this._reportError(i,o)}}}_reportError(i,t){super._reportError(i,t),this.currentFrame.setValue(-1,i),this.currentTime.setValue(-1,i)}_executeOnTick(i){const t=this.currentAnimationGroup.getValue(i);t&&(this.currentFrame.setValue(t.getCurrentFrame(),i),this.currentTime.setValue(t.animatables[0]?.elapsedTime??0,i))}_execute(i){this._startPendingTasks(i)}_onAnimationGroupEnd(i){this._removeFromCurrentlyRunning(i,this.currentAnimationGroup.getValue(i)),this._resetAfterCanceled(i),this.done._activateSignal(i)}_checkInterpolationDuplications(i,t,r){const a=i._getGlobalContextVariable("currentlyRunningAnimationGroups",[]);for(const n of a){const s=i.assetsContext.animationGroups.find(e=>e.uniqueId===n);if(s)for(const e of s.targetedAnimations)for(const p of t)e.animation.targetProperty===p.targetProperty&&e.target===r&&this._stopAnimationGroup(i,s)}}_stopAnimationGroup(i,t){t.stop(!0),t.dispose(),this._removeFromCurrentlyRunning(i,t)}_removeFromCurrentlyRunning(i,t){const r=i._getGlobalContextVariable("currentlyRunningAnimationGroups",[]),a=r.indexOf(t.uniqueId);a!==-1&&(r.splice(a,1),i._setGlobalContextVariable("currentlyRunningAnimationGroups",r))}_cancelPendingTasks(i){const t=this.currentAnimationGroup.getValue(i);t&&this._stopAnimationGroup(i,t)}getClassName(){return"FlowGraphPlayAnimationBlock"}}b("FlowGraphPlayAnimationBlock",V);export{V as FlowGraphPlayAnimationBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphPointerOutEventBlock-p8RUrh0M.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphPointerOutEventBlock-p8RUrh0M.js new file mode 100644 index 0000000000000000000000000000000000000000..87dc533866d99b3a2ffa7f995781ef57ecbb69be --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphPointerOutEventBlock-p8RUrh0M.js @@ -0,0 +1 @@ +import{c as n,_ as r}from"./KHR_interactivity-BtMudStn.js";import{b as h,R as i}from"./declarationMapper-Lanf6XPr.js";import{R as o}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class u extends n{constructor(t){super(t),this.type="PointerOut",this.pointerId=this.registerDataOutput("pointerId",h),this.targetMesh=this.registerDataInput("targetMesh",i,t?.targetMesh),this.meshOutOfPointer=this.registerDataOutput("meshOutOfPointer",i)}_executeEvent(t,e){const s=this.targetMesh.getValue(t);return this.meshOutOfPointer.setValue(e.mesh,t),this.pointerId.setValue(e.pointerId,t),!(e.over&&r(e.mesh,s))&&(e.mesh===s||r(e.mesh,s))?(this._execute(t),!this.config?.stopPropagation):!0}_preparePendingTasks(t){}_cancelPendingTasks(t){}getClassName(){return"FlowGraphPointerOutEventBlock"}}o("FlowGraphPointerOutEventBlock",u);export{u as FlowGraphPointerOutEventBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphPointerOverEventBlock-CvKef7MZ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphPointerOverEventBlock-CvKef7MZ.js new file mode 100644 index 0000000000000000000000000000000000000000..2b2c18561c737a982b88326f06c54f86f4100df9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphPointerOverEventBlock-CvKef7MZ.js @@ -0,0 +1 @@ +import{c as o,_ as s}from"./KHR_interactivity-BtMudStn.js";import{b as h,R as i}from"./declarationMapper-Lanf6XPr.js";import{R as a}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class p extends o{constructor(e){super(e),this.type="PointerOver",this.pointerId=this.registerDataOutput("pointerId",h),this.targetMesh=this.registerDataInput("targetMesh",i,e?.targetMesh),this.meshUnderPointer=this.registerDataOutput("meshUnderPointer",i)}_executeEvent(e,t){const r=this.targetMesh.getValue(e);this.meshUnderPointer.setValue(t.mesh,e);const n=t.out&&s(t.out,r);return this.pointerId.setValue(t.pointerId,e),!n&&(t.mesh===r||s(t.mesh,r))?(this._execute(e),!this.config?.stopPropagation):!0}_preparePendingTasks(e){}_cancelPendingTasks(e){}getClassName(){return"FlowGraphPointerOverEventBlock"}}a("FlowGraphPointerOverEventBlock",p);export{p as FlowGraphPointerOverEventBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphReceiveCustomEventBlock-CHr_E_rI.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphReceiveCustomEventBlock-CHr_E_rI.js new file mode 100644 index 0000000000000000000000000000000000000000..10b2f92cd439f2e7c5a195892d1100ad41b500d6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphReceiveCustomEventBlock-CHr_E_rI.js @@ -0,0 +1 @@ +import{c as a,d as n}from"./KHR_interactivity-BtMudStn.js";import{d as v,R as c}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./declarationMapper-Lanf6XPr.js";import"./objectModelMapping-CGWnurZP.js";class l extends a{constructor(e){super(e),this.config=e,this.initPriority=1;for(const t in this.config.eventData)this.registerDataOutput(t,this.config.eventData[t].type)}_preparePendingTasks(e){const t=e.configuration.coordinator.getCustomEventObservable(this.config.eventId);if(t&&t.hasObservers()&&t.observers.length>n.MaxEventsPerType){this._reportError(e,`FlowGraphReceiveCustomEventBlock: Too many observers for event ${this.config.eventId}. Max is ${n.MaxEventsPerType}.`);return}const r=t.add(s=>{const i=Object.keys(s);for(const o of i)this.getDataOutput(o)?.setValue(s[o],e);this._execute(e)});e._setExecutionVariable(this,"_eventObserver",r)}_cancelPendingTasks(e){const t=e.configuration.coordinator.getCustomEventObservable(this.config.eventId);if(t){const r=e._getExecutionVariable(this,"_eventObserver",null);t.remove(r)}else v.Warn(`FlowGraphReceiveCustomEventBlock: Missing observable for event ${this.config.eventId}`)}_executeEvent(e,t){return!0}getClassName(){return"FlowGraphReceiveCustomEventBlock"}}c("FlowGraphReceiveCustomEventBlock",l);export{l as FlowGraphReceiveCustomEventBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSceneReadyEventBlock-8yWc5f3q.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSceneReadyEventBlock-8yWc5f3q.js new file mode 100644 index 0000000000000000000000000000000000000000..6c51748817a1028f780f49156042be51c9a54a53 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSceneReadyEventBlock-8yWc5f3q.js @@ -0,0 +1 @@ +import{c as t}from"./KHR_interactivity-BtMudStn.js";import{R as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./declarationMapper-Lanf6XPr.js";import"./objectModelMapping-CGWnurZP.js";class n extends t{constructor(){super(...arguments),this.initPriority=-1,this.type="SceneReady"}_executeEvent(e,a){return this._execute(e),!0}_preparePendingTasks(e){}_cancelPendingTasks(e){}getClassName(){return"FlowGraphSceneReadyEventBlock"}}r("FlowGraphSceneReadyEventBlock",n);export{n as FlowGraphSceneReadyEventBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSceneTickEventBlock-wqnxDI01.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSceneTickEventBlock-wqnxDI01.js new file mode 100644 index 0000000000000000000000000000000000000000..a537798817d8bc9b809ebf9d9362aa4083f1cc76 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSceneTickEventBlock-wqnxDI01.js @@ -0,0 +1 @@ +import{c as i}from"./KHR_interactivity-BtMudStn.js";import{R as s}from"./index-CDrXokXW.js";import{b as r}from"./declarationMapper-Lanf6XPr.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class a extends i{constructor(){super(),this.type="SceneBeforeRender",this.timeSinceStart=this.registerDataOutput("timeSinceStart",r),this.deltaTime=this.registerDataOutput("deltaTime",r)}_preparePendingTasks(e){}_executeEvent(e,t){return this.timeSinceStart.setValue(t.timeSinceStart,e),this.deltaTime.setValue(t.deltaTime,e),this._execute(e),!0}_cancelPendingTasks(e){}getClassName(){return"FlowGraphSceneTickEventBlock"}}s("FlowGraphSceneTickEventBlock",a);export{a as FlowGraphSceneTickEventBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSendCustomEventBlock-COnjPh-a.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSendCustomEventBlock-COnjPh-a.js new file mode 100644 index 0000000000000000000000000000000000000000..604dcdec877213eda151724149dcfc9d1476329e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSendCustomEventBlock-COnjPh-a.js @@ -0,0 +1 @@ +import{b as i}from"./KHR_interactivity-BtMudStn.js";import{R as n}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./declarationMapper-Lanf6XPr.js";import"./objectModelMapping-CGWnurZP.js";class s extends i{constructor(t){super(t),this.config=t;for(const e in this.config.eventData)this.registerDataInput(e,this.config.eventData[e].type,this.config.eventData[e].value)}_execute(t){const e=this.config.eventId,o={};for(const a of this.dataInputs)o[a.name]=a.getValue(t);t.configuration.coordinator.notifyCustomEvent(e,o),this.out._activateSignal(t)}getClassName(){return"FlowGraphReceiveCustomEventBlock"}}n("FlowGraphReceiveCustomEventBlock",s);export{s as FlowGraphSendCustomEventBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSequenceBlock-C1cNgLhX.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSequenceBlock-C1cNgLhX.js new file mode 100644 index 0000000000000000000000000000000000000000..26de2ac6ef3584ea93d13b892c8a00a4d05f4d3d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSequenceBlock-C1cNgLhX.js @@ -0,0 +1 @@ +import{R as i}from"./index-CDrXokXW.js";import{e as s}from"./KHR_interactivity-BtMudStn.js";import"./index-DWyDLubb.js";import"./declarationMapper-Lanf6XPr.js";import"./objectModelMapping-CGWnurZP.js";class n extends s{constructor(e){super(e),this.config=e,this.executionSignals=[],this.setNumberOfOutputSignals(this.config.outputSignalCount)}_execute(e){for(let t=0;te;){const t=this.executionSignals.pop();t&&(t.disconnectFromAll(),this._unregisterSignalOutput(t.name))}for(;this.executionSignals.length{const i=Date.now();this._timer=i-this._startTime;const s={startTime:this._startTime,currentTime:i,deltaTime:this._timer,completeRate:this._timer/this._timeToEnd,payload:t},a=this._breakOnNextTick||this._breakCondition(s);a||this._timer>=this._timeToEnd?this._stop(s,a):this.onEachCountObservable.notifyObservers(s)},this._setState(0),this._contextObservable=e.contextObservable,this._observableParameters=e.observableParameters??{},this._breakCondition=e.breakCondition??(()=>!1),this._timeToEnd=e.timeout,e.onEnded&&this.onTimerEndedObservable.add(e.onEnded),e.onTick&&this.onEachCountObservable.add(e.onTick),e.onAborted&&this.onTimerAbortedObservable.add(e.onAborted)}set breakCondition(e){this._breakCondition=e}clearObservables(){this.onEachCountObservable.clear(),this.onTimerAbortedObservable.clear(),this.onTimerEndedObservable.clear(),this.onStateChangedObservable.clear()}start(e=this._timeToEnd){if(this._state===1)throw new Error("Timer already started. Please stop it before starting again");this._timeToEnd=e,this._startTime=Date.now(),this._timer=0,this._observer=this._contextObservable.add(this._tick,this._observableParameters.mask,this._observableParameters.insertFirst,this._observableParameters.scope),this._setState(1)}stop(){this._state===1&&(this._breakOnNextTick=!0)}dispose(){this._observer&&this._contextObservable.remove(this._observer),this.clearObservables()}_setState(e){this._state=e,this.onStateChangedObservable.notifyObservers(this._state)}_stop(e,t=!1){this._contextObservable.remove(this._observer),this._setState(2),t?this.onTimerAbortedObservable.notifyObservers(e):this.onTimerEndedObservable.notifyObservers(e)}}class l extends m{constructor(e){super(e),this.cancel=this._registerSignalInput("cancel"),this.duration=this.registerDataInput("duration",u),this.lastDelayIndex=this.registerDataOutput("lastDelayIndex",v,new h(-1))}_preparePendingTasks(e){const t=this.duration.getValue(e);if(t<0||isNaN(t)||!isFinite(t))return this._reportError(e,"Invalid duration in SetDelay block");if(e._getGlobalContextVariable("activeDelays",0)>=l.MaxParallelDelayCount)return this._reportError(e,"Max parallel delays reached");const s=e._getGlobalContextVariable("lastDelayIndex",-1),a=e._getExecutionVariable(this,"pendingDelays",[]),c=e.configuration.scene,o=new T({timeout:t*1e3,contextObservable:c.onBeforeRenderObservable,onEnded:()=>this._onEnded(o,e)});o.start();const b=s+1;this.lastDelayIndex.setValue(new h(b),e),e._setGlobalContextVariable("lastDelayIndex",b),a[b]=o,e._setExecutionVariable(this,"pendingDelays",a),this._updateGlobalTimers(e)}_cancelPendingTasks(e){const t=e._getExecutionVariable(this,"pendingDelays",[]);for(const i of t)i?.dispose();e._deleteExecutionVariable(this,"pendingDelays"),this.lastDelayIndex.setValue(new h(-1),e),this._updateGlobalTimers(e)}_execute(e,t){if(t===this.cancel){this._cancelPendingTasks(e);return}else this._preparePendingTasks(e),this.out._activateSignal(e)}getClassName(){return"FlowGraphSetDelayBlock"}_onEnded(e,t){const i=t._getExecutionVariable(this,"pendingDelays",[]),s=i.indexOf(e);s!==-1?i.splice(s,1):d.Warn("FlowGraphTimerBlock: Timer ended but was not found in the running timers list"),t._removePendingBlock(this),this.done._activateSignal(t),this._updateGlobalTimers(t)}_updateGlobalTimers(e){const t=e._getExecutionVariable(this,"pendingDelays",[]),i=e._getGlobalContextVariable("pendingDelays",[]);for(let s=0;sn.uniqueId===i);if(r){for(const n of r.targetedAnimations)if(n.target===s&&n.animation.targetProperty===o){r.stop(!0),r.dispose();const p=e.indexOf(i);p!==-1&&(e.splice(p,1),t._setGlobalContextVariable("currentlyRunningAnimationGroups",e))}}}}_setPropertyValue(t,s,o){const e=s.split(".");let i=t;for(let r=0;rr.uniqueId==s);if(l){for(const r of l.targetedAnimations)if(r.target===a&&r.animation.targetProperty===i){l.stop();const o=e.indexOf(s);o>-1&&e.splice(o,1),a._setGlobalContextVariable("currentlyRunningAnimationGroups",e);break}}}const b=this.getDataInput(t||i)?.getValue(a);a.setVariable(i,b)}getClassName(){return"FlowGraphSetVariableBlock"}serialize(a){super.serialize(a),a.config.variable=this.config?.variable}}u("FlowGraphSetVariableBlock",f);export{f as FlowGraphSetVariableBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphStopAnimationBlock-DzdM2S-i.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphStopAnimationBlock-DzdM2S-i.js new file mode 100644 index 0000000000000000000000000000000000000000..7b2c99b3cf74c173d7a867b52b600f35c5db3250 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphStopAnimationBlock-DzdM2S-i.js @@ -0,0 +1 @@ +import{R as a,b as e}from"./declarationMapper-Lanf6XPr.js";import{L as s,R as r}from"./index-CDrXokXW.js";import{a as p}from"./KHR_interactivity-BtMudStn.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class l extends p{constructor(i){super(i),this.animationGroup=this.registerDataInput("animationGroup",a),this.stopAtFrame=this.registerDataInput("stopAtFrame",e,-1)}_preparePendingTasks(i){const o=this.animationGroup.getValue(i),t=this.stopAtFrame.getValue(i)??-1,n=i._getGlobalContextVariable("pendingStopAnimations",[]);n.push({uniqueId:o.uniqueId,stopAtFrame:t}),i._setGlobalContextVariable("pendingStopAnimations",n)}_cancelPendingTasks(i){const o=this.animationGroup.getValue(i),t=i._getGlobalContextVariable("pendingStopAnimations",[]);for(let n=0;n0?this._startPendingTasks(i):this._stopAnimation(o,i),this.out._activateSignal(i)}_executeOnTick(i){const o=this.animationGroup.getValue(i),t=i._getGlobalContextVariable("pendingStopAnimations",[]);for(let n=0;n=t[n].stopAtFrame){this._stopAnimation(o,i),t.splice(n,1),i._setGlobalContextVariable("pendingStopAnimations",t),this.done._activateSignal(i),i._removePendingBlock(this);break}}getClassName(){return"FlowGraphStopAnimationBlock"}_stopAnimation(i,o){const t=o._getGlobalContextVariable("currentlyRunningAnimationGroups",[]),n=t.indexOf(i.uniqueId);n!==-1&&(i.stop(),t.splice(n,1),o._setGlobalContextVariable("currentlyRunningAnimationGroups",t))}}r("FlowGraphStopAnimationBlock",l);export{l as FlowGraphStopAnimationBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSwitchBlock-BfoWGleb.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSwitchBlock-BfoWGleb.js new file mode 100644 index 0000000000000000000000000000000000000000..4389f241156b30e6995c29700c48738aa41c729e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphSwitchBlock-BfoWGleb.js @@ -0,0 +1 @@ +import{e as a,i as o,g as u}from"./KHR_interactivity-BtMudStn.js";import{R as c}from"./declarationMapper-Lanf6XPr.js";import{R as l}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class r extends a{constructor(t){super(t),this.config=t,this.default=this._registerSignalOutput("default"),this._caseToOutputFlow=new Map,this.case=this.registerDataInput("case",c);const e=this.config.cases||[];for(const s of e)this._caseToOutputFlow.set(s,this._registerSignalOutput(`out_${s}`))}_execute(t,e){const s=this.case.getValue(t);let i;o(s)?i=this._getOutputFlowForCase(u(s)):i=this._getOutputFlowForCase(s),i?i._activateSignal(t):this.default._activateSignal(t)}addCase(t){this.config.cases.includes(t)||(this.config.cases.push(t),this._caseToOutputFlow.set(t,this._registerSignalOutput(`out_${t}`)))}removeCase(t){if(!this.config.cases.includes(t))return;const e=this.config.cases.indexOf(t);this.config.cases.splice(e,1),this._caseToOutputFlow.delete(t)}_getOutputFlowForCase(t){return this._caseToOutputFlow.get(t)}getClassName(){return"FlowGraphSwitchBlock"}serialize(t){super.serialize(t),t.cases=this.config.cases}}l("FlowGraphSwitchBlock",r);export{r as FlowGraphSwitchBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphThrottleBlock-CbQ41JKj.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphThrottleBlock-CbQ41JKj.js new file mode 100644 index 0000000000000000000000000000000000000000..80749d34abd0ef1ca7e527be52a0a20aa373ed29 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphThrottleBlock-CbQ41JKj.js @@ -0,0 +1 @@ +import{b as l}from"./declarationMapper-Lanf6XPr.js";import{b as u}from"./KHR_interactivity-BtMudStn.js";import{R as o}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class h extends u{constructor(i){super(i),this.reset=this._registerSignalInput("reset"),this.duration=this.registerDataInput("duration",l),this.lastRemainingTime=this.registerDataOutput("lastRemainingTime",l,NaN)}_execute(i,n){if(n===this.reset){this.lastRemainingTime.setValue(NaN,i),i._setExecutionVariable(this,"lastRemainingTime",NaN),i._setExecutionVariable(this,"timestamp",0);return}const e=this.duration.getValue(i);if(e<=0||isNaN(e)||!isFinite(e))return this._reportError(i,"Invalid duration in Throttle block");const m=i._getExecutionVariable(this,"lastRemainingTime",NaN),t=Date.now();if(isNaN(m))return this.lastRemainingTime.setValue(0,i),i._setExecutionVariable(this,"lastRemainingTime",0),i._setExecutionVariable(this,"timestamp",t),this.out._activateSignal(i);{const a=t-i._getExecutionVariable(this,"timestamp",0),s=e*1e3;if(s<=a)return this.lastRemainingTime.setValue(0,i),i._setExecutionVariable(this,"lastRemainingTime",0),i._setExecutionVariable(this,"timestamp",t),this.out._activateSignal(i);{const r=s-a;this.lastRemainingTime.setValue(r/1e3,i),i._setExecutionVariable(this,"lastRemainingTime",r)}}}getClassName(){return"FlowGraphThrottleBlock"}}o("FlowGraphThrottleBlock",h);export{h as FlowGraphThrottleBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphTransformCoordinatesSystemBlock-BtSaynCM.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphTransformCoordinatesSystemBlock-BtSaynCM.js new file mode 100644 index 0000000000000000000000000000000000000000..f5f95d501351a35e6ae596dfe303f5645001d14b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphTransformCoordinatesSystemBlock-BtSaynCM.js @@ -0,0 +1 @@ +import{F as c}from"./KHR_interactivity-BtMudStn.js";import{R as e,e as r}from"./declarationMapper-Lanf6XPr.js";import{c as i,V as d,R as h}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class y extends c{constructor(t){super(t),this.sourceSystem=this.registerDataInput("sourceSystem",e),this.destinationSystem=this.registerDataInput("destinationSystem",e),this.inputCoordinates=this.registerDataInput("inputCoordinates",r),this.outputCoordinates=this.registerDataOutput("outputCoordinates",r)}_updateOutputs(t){const a=this.sourceSystem.getValue(t),n=this.destinationSystem.getValue(t),u=this.inputCoordinates.getValue(t),p=a.getWorldMatrix(),m=n.getWorldMatrix(),s=i.Matrix[0].copyFrom(m);s.invert();const o=i.Matrix[1];s.multiplyToRef(p,o);const l=this.outputCoordinates.getValue(t);d.TransformCoordinatesToRef(u,o,l)}getClassName(){return"FlowGraphTransformCoordinatesSystemBlock"}}h("FlowGraphTransformCoordinatesSystemBlock",y);export{y as FlowGraphTransformCoordinatesSystemBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphTypeToTypeBlocks-Bka59VEo.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphTypeToTypeBlocks-Bka59VEo.js new file mode 100644 index 0000000000000000000000000000000000000000..353c05c30d1b1b624507464c854e140d9819af20 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphTypeToTypeBlocks-Bka59VEo.js @@ -0,0 +1 @@ +import{F as a}from"./flowGraphUnaryOperationBlock-wNBDBj1u.js";import{b as n,i as s,F as e,c as F}from"./declarationMapper-Lanf6XPr.js";import{R as l}from"./index-CDrXokXW.js";import"./flowGraphCachedOperationBlock-CAD6CbqU.js";import"./KHR_interactivity-BtMudStn.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class p extends a{constructor(r){super(F,n,o=>+o,"FlowGraphBooleanToFloat",r)}}l("FlowGraphBooleanToFloat",p);class u extends a{constructor(r){super(F,s,o=>e.FromValue(+o),"FlowGraphBooleanToInt",r)}}l("FlowGraphBooleanToInt",u);class c extends a{constructor(r){super(n,F,o=>!!o,"FlowGraphFloatToBoolean",r)}}l("FlowGraphFloatToBoolean",c);class h extends a{constructor(r){super(s,F,o=>!!o.value,"FlowGraphIntToBoolean",r)}}l("FlowGraphIntToBoolean",h);class w extends a{constructor(r){super(s,n,o=>o.value,"FlowGraphIntToFloat",r)}}l("FlowGraphIntToFloat",w);class G extends a{constructor(r){super(n,s,o=>{switch(r?.roundingMode){case"floor":return e.FromValue(Math.floor(o));case"ceil":return e.FromValue(Math.ceil(o));case"round":return e.FromValue(Math.round(o));default:return e.FromValue(o)}},"FlowGraphFloatToInt",r)}}l("FlowGraphFloatToInt",G);export{p as FlowGraphBooleanToFloat,u as FlowGraphBooleanToInt,c as FlowGraphFloatToBoolean,G as FlowGraphFloatToInt,h as FlowGraphIntToBoolean,w as FlowGraphIntToFloat}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphUnaryOperationBlock-wNBDBj1u.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphUnaryOperationBlock-wNBDBj1u.js new file mode 100644 index 0000000000000000000000000000000000000000..1662d182a347513e0bbfdc46382a5d79be2ab650 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphUnaryOperationBlock-wNBDBj1u.js @@ -0,0 +1 @@ +import{F as o}from"./flowGraphCachedOperationBlock-CAD6CbqU.js";class p extends o{constructor(a,t,s,e,r){super(t,r),this._operation=s,this._className=e,this.a=this.registerDataInput("a",a)}_doOperation(a){return this._operation(this.a.getValue(a))}getClassName(){return this._className}}export{p as F}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphVectorMathBlocks-DIRRvNKz.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphVectorMathBlocks-DIRRvNKz.js new file mode 100644 index 0000000000000000000000000000000000000000..9509b46cfa755f12ce9facb04c7a6e26574a6062 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphVectorMathBlocks-DIRRvNKz.js @@ -0,0 +1 @@ +import{F as f,h as u}from"./KHR_interactivity-BtMudStn.js";import{e as a,f as c,b as i,c as y,h as A,g as m,l as d,R as h}from"./declarationMapper-Lanf6XPr.js";import{ao as w,aB as k,V as F,ai as C,R as s}from"./index-CDrXokXW.js";import{F as n}from"./flowGraphBinaryOperationBlock-C6Dwxvh5.js";import{F as B}from"./flowGraphUnaryOperationBlock-wNBDBj1u.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";import"./flowGraphCachedOperationBlock-CAD6CbqU.js";function D(e,o){return e.x*o.x+e.y*o.y+e.z*o.z}function T(e,o){return e.x*o.x+e.y*o.y+e.z*o.z+e.w*o.w}function R(e,o){return Math.acos(k(T(e,o),-1,1))*2}function N(e,o){const r=new w;return Q(e,o,r),r}function Q(e,o,r){const t=F.Cross(e,o),l=Math.acos(k(D(e,o),-1,1));return w.RotationAxisToRef(t,l,r),r}const G="cachedOperationAxis",V="cachedOperationAngle",x="cachedExecutionId";class z extends B{constructor(o){super(h,i,r=>this._polymorphicLength(r),"FlowGraphLengthBlock",o)}_polymorphicLength(o){switch(u(o)){case"Vector2":case"Vector3":case"Vector4":case"Quaternion":return o.length();default:throw new Error(`Cannot compute length of value ${o}`)}}}s("FlowGraphLengthBlock",z);class _ extends B{constructor(o){super(h,h,r=>this._polymorphicNormalize(r),"FlowGraphNormalizeBlock",o)}_polymorphicNormalize(o){const r=u(o);let t;switch(r){case"Vector2":case"Vector3":case"Vector4":case"Quaternion":return t=o.normalizeToNew(),this.config?.nanOnZeroLength&&o.length()===0&&t.setAll(NaN),t;default:throw new Error(`Cannot normalize value ${o}`)}}}s("FlowGraphNormalizeBlock",_);class E extends n{constructor(o){super(h,h,i,(r,t)=>this._polymorphicDot(r,t),"FlowGraphDotBlock",o)}_polymorphicDot(o,r){switch(u(o)){case"Vector2":case"Vector3":case"Vector4":case"Quaternion":return o.dot(r);default:throw new Error(`Cannot get dot product of ${o} and ${r}`)}}}s("FlowGraphDotBlock",E);class O extends n{constructor(o){super(a,a,a,(r,t)=>F.Cross(r,t),"FlowGraphCrossBlock",o)}}s("FlowGraphCrossBlock",O);class I extends n{constructor(o){super(d,i,d,(r,t)=>r.rotate(t),"FlowGraphRotate2DBlock",o)}}s("FlowGraphRotate2DBlock",I);class L extends n{constructor(o){super(a,c,a,(r,t)=>r.applyRotationQuaternion(t),"FlowGraphRotate3DBlock",o)}}s("FlowGraphRotate3DBlock",L);function M(e,o){switch(u(e)){case"Vector2":return o.transformVector(e);case"Vector3":return o.transformVector(e);case"Vector4":return e=e,new C(e.x*o.m[0]+e.y*o.m[1]+e.z*o.m[2]+e.w*o.m[3],e.x*o.m[4]+e.y*o.m[5]+e.z*o.m[6]+e.w*o.m[7],e.x*o.m[8]+e.y*o.m[9]+e.z*o.m[10]+e.w*o.m[11],e.x*o.m[12]+e.y*o.m[13]+e.z*o.m[14]+e.w*o.m[15]);default:throw new Error(`Cannot transform value ${e}`)}}class v extends n{constructor(o){const r=o?.vectorType||"Vector3",t=r==="Vector2"?"Matrix2D":r==="Vector3"?"Matrix3D":"Matrix";super(m(r),m(t),m(r),M,"FlowGraphTransformVectorBlock",o)}}s("FlowGraphTransformVectorBlock",v);class $ extends n{constructor(o){super(a,A,a,(r,t)=>F.TransformCoordinates(r,t),"FlowGraphTransformCoordinatesBlock",o)}}s("FlowGraphTransformCoordinatesBlock",$);class j extends B{constructor(o){super(c,c,r=>r.conjugate(),"FlowGraphConjugateBlock",o)}}s("FlowGraphConjugateBlock",j);class U extends n{constructor(o){super(c,c,i,(r,t)=>R(r,t),"FlowGraphAngleBetweenBlock",o)}}s("FlowGraphAngleBetweenBlock",U);class Z extends n{constructor(o){super(a,i,c,(r,t)=>w.RotationAxis(r,t),"FlowGraphQuaternionFromAxisAngleBlock",o)}}s("FlowGraphQuaternionFromAxisAngleBlock",Z);class q extends f{constructor(o){super(o),this.a=this.registerDataInput("a",c),this.axis=this.registerDataOutput("axis",a),this.angle=this.registerDataOutput("angle",i),this.isValid=this.registerDataOutput("isValid",y)}_updateOutputs(o){const r=o._getExecutionVariable(this,x,-1),t=o._getExecutionVariable(this,G,null),l=o._getExecutionVariable(this,V,null);if(t!=null&&l!==void 0&&l!==null&&r===o.executionId)this.axis.setValue(t,o),this.angle.setValue(l,o);else try{const{axis:p,angle:g}=this.a.getValue(o).toAxisAngle();o._setExecutionVariable(this,G,p),o._setExecutionVariable(this,V,g),o._setExecutionVariable(this,x,o.executionId),this.axis.setValue(p,o),this.angle.setValue(g,o),this.isValid.setValue(!0,o)}catch{this.isValid.setValue(!1,o)}}getClassName(){return"FlowGraphAxisAngleFromQuaternionBlock"}}s("FlowGraphAxisAngleFromQuaternionBlock",q);class b extends n{constructor(o){super(a,a,c,(r,t)=>N(r,t),"FlowGraphQuaternionFromDirectionsBlock",o)}}export{U as FlowGraphAngleBetweenBlock,q as FlowGraphAxisAngleFromQuaternionBlock,j as FlowGraphConjugateBlock,O as FlowGraphCrossBlock,E as FlowGraphDotBlock,z as FlowGraphLengthBlock,_ as FlowGraphNormalizeBlock,Z as FlowGraphQuaternionFromAxisAngleBlock,b as FlowGraphQuaternionFromDirectionsBlock,I as FlowGraphRotate2DBlock,L as FlowGraphRotate3DBlock,v as FlowGraphTransformBlock,$ as FlowGraphTransformCoordinatesBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphWaitAllBlock-CK10vDaH.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphWaitAllBlock-CK10vDaH.js new file mode 100644 index 0000000000000000000000000000000000000000..3b08c3b4c7d0ae91c1d10d462fa20fb33b8d67e4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/flowGraphWaitAllBlock-CK10vDaH.js @@ -0,0 +1 @@ +import{b as a}from"./KHR_interactivity-BtMudStn.js";import{R as o}from"./index-CDrXokXW.js";import{i as r,F as n}from"./declarationMapper-Lanf6XPr.js";import"./index-DWyDLubb.js";import"./objectModelMapping-CGWnurZP.js";class l extends a{constructor(i){super(i),this.config=i,this.inFlows=[],this._cachedActivationState=[],this.reset=this._registerSignalInput("reset"),this.completed=this._registerSignalOutput("completed"),this.remainingInputs=this.registerDataOutput("remainingInputs",r,new n(this.config.inputSignalCount||0));for(let e=0;e=0&&(s[t]=!0)}if(this.remainingInputs.setValue(new n(s.filter(t=>!t).length),i),i._setExecutionVariable(this,"activationState",s.slice()),s.includes(!1))e!==this.reset&&this.out._activateSignal(i);else{this.completed._activateSignal(i);for(let t=0;t=t.MaxLoopCount){l.Warn("FlowGraphWhileLoopBlock: Max loop count reached. Breaking.");break}o=this.condition.getValue(i)}this.completed._activateSignal(i)}getClassName(){return"FlowGraphWhileLoopBlock"}}t.MaxLoopCount=1e3;n("FlowGraphWhileLoopBlock",t);export{t as FlowGraphWhileLoopBlock}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fogFragment-DmA8Y7To.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fogFragment-DmA8Y7To.js new file mode 100644 index 0000000000000000000000000000000000000000..c9d7883242cd462e88f0037675fe1225b3f5b4c9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fogFragment-DmA8Y7To.js @@ -0,0 +1,25 @@ +import{S as o}from"./index-CDrXokXW.js";const f="fogFragmentDeclaration",r=`#ifdef FOG +#define FOGMODE_NONE 0. +#define FOGMODE_EXP 1. +#define FOGMODE_EXP2 2. +#define FOGMODE_LINEAR 3. +const E=2.71828;uniform vFogInfos: vec4f;uniform vFogColor: vec3f;varying vFogDistance: vec3f;fn CalcFogFactor()->f32 +{var fogCoeff: f32=1.0;var fogStart: f32=uniforms.vFogInfos.y;var fogEnd: f32=uniforms.vFogInfos.z;var fogDensity: f32=uniforms.vFogInfos.w;var fogDistance: f32=length(fragmentInputs.vFogDistance);if (FOGMODE_LINEAR==uniforms.vFogInfos.x) +{fogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);} +else if (FOGMODE_EXP==uniforms.vFogInfos.x) +{fogCoeff=1.0/pow(E,fogDistance*fogDensity);} +else if (FOGMODE_EXP2==uniforms.vFogInfos.x) +{fogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);} +return clamp(fogCoeff,0.0,1.0);} +#endif +`;o.IncludesShadersStoreWGSL[f]||(o.IncludesShadersStoreWGSL[f]=r);const e="logDepthFragment",s=`#ifdef LOGARITHMICDEPTH +fragmentOutputs.fragDepth=log2(fragmentInputs.vFragmentDepth)*uniforms.logarithmicDepthConstant*0.5; +#endif +`;o.IncludesShadersStoreWGSL[e]||(o.IncludesShadersStoreWGSL[e]=s);const n="fogFragment",t=`#ifdef FOG +var fog: f32=CalcFogFactor(); +#ifdef PBR +fog=toLinearSpace(fog); +#endif +color= vec4f(mix(uniforms.vFogColor,color.rgb,fog),color.a); +#endif +`;o.IncludesShadersStoreWGSL[n]||(o.IncludesShadersStoreWGSL[n]=t); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fogFragment-R9KOnWn-.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fogFragment-R9KOnWn-.js new file mode 100644 index 0000000000000000000000000000000000000000..bac0ade44a3513810ef15756692c24e0e18f4b75 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fogFragment-R9KOnWn-.js @@ -0,0 +1,26 @@ +import{S as o}from"./index-CDrXokXW.js";const e="fogFragmentDeclaration",t=`#ifdef FOG +#define FOGMODE_NONE 0. +#define FOGMODE_EXP 1. +#define FOGMODE_EXP2 2. +#define FOGMODE_LINEAR 3. +#define E 2.71828 +uniform vec4 vFogInfos;uniform vec3 vFogColor;varying vec3 vFogDistance;float CalcFogFactor() +{float fogCoeff=1.0;float fogStart=vFogInfos.y;float fogEnd=vFogInfos.z;float fogDensity=vFogInfos.w;float fogDistance=length(vFogDistance);if (FOGMODE_LINEAR==vFogInfos.x) +{fogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);} +else if (FOGMODE_EXP==vFogInfos.x) +{fogCoeff=1.0/pow(E,fogDistance*fogDensity);} +else if (FOGMODE_EXP2==vFogInfos.x) +{fogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);} +return clamp(fogCoeff,0.0,1.0);} +#endif +`;o.IncludesShadersStore[e]||(o.IncludesShadersStore[e]=t);const f="logDepthFragment",g=`#ifdef LOGARITHMICDEPTH +gl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5; +#endif +`;o.IncludesShadersStore[f]||(o.IncludesShadersStore[f]=g);const n="fogFragment",a=`#ifdef FOG +float fog=CalcFogFactor(); +#ifdef PBR +fog=toLinearSpace(fog); +#endif +color.rgb=mix(vFogColor,color.rgb,fog); +#endif +`;o.IncludesShadersStore[n]||(o.IncludesShadersStore[n]=a); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fr-D-jLF3ix.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fr-D-jLF3ix.js new file mode 100644 index 0000000000000000000000000000000000000000..1a8b2017926a6ce1f50f8f9b7dd672a3baa6679b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fr-D-jLF3ix.js @@ -0,0 +1 @@ +const e="Français",r={annotated_image:"Image annotée"},o={allow_recording_access:"Veuillez autoriser l'accès au microphone pour l'enregistrement.",audio:"Audio",record_from_microphone:"Enregistrer depuis le microphone",stop_recording:"Arrêter l'enregistrement",no_device_support:"Impossible d'accéder aux périphériques multimédias. Assurez-vous que vous êtes sur une source sécurisée (https) ou localhost (ou avez passé un certificat SSL valide à ssl_verify), et que vous avez autorisé l'accès du navigateur à votre appareil.",stop:"Arrêter",resume:"Reprendre",record:"Enregistrer",no_microphone:"Aucun microphone trouvé",pause:"Pause",play:"Lecture",waiting:"En attente",drop_to_upload:"Déposez un fichier audio ici pour le télécharger"},i={connection_can_break:"Sur mobile, la connexion peut être interrompue si cet onglet perd le focus ou si l'appareil se met en veille, perdant votre position dans la file d'attente.",long_requests_queue:"Il y a une longue file d'attente de requêtes en attente. Dupliquez ce Space pour la contourner.",lost_connection:"Connexion perdue en quittant la page. Retour à la file d'attente...",waiting_for_inputs:"En attente de la fin du téléchargement des fichier(s), veuillez réessayer."},n={checkbox:"Case à cocher",checkbox_group:"Groupe de cases à cocher"},a={code:"Code"},t={color_picker:"Sélecteur de couleur"},c={built_with:"créé avec",built_with_gradio:"Créé avec Gradio",clear:"Effacer",download:"Télécharger",edit:"Modifier",empty:"Vide",flag:"Marquer",error:"Erreur",hosted_on:"Hébergé sur",loading:"Chargement",logo:"logo",or:"ou",remove:"Supprimer",settings:"Paramètres",share:"Partager",submit:"Envoyer",undo:"Annuler",no_devices:"Aucun périphérique trouvé",language:"Langue",display_theme:"Thème d'affichage",pwa:"Application web progressive",run:"Exécuter"},s={incorrect_format:"Format incorrect, seuls les fichiers CSV et TSV sont pris en charge",new_column:"Ajouter une colonne",new_row:"Nouvelle ligne",add_row_above:"Ajouter une ligne au-dessus",add_row_below:"Ajouter une ligne en dessous",add_column_left:"Ajouter une colonne à gauche",add_column_right:"Ajouter une colonne à droite",delete_row:"Supprimer la ligne",delete_column:"Supprimer la colonne",sort_column:"Trier la colonne",sort_ascending:"Trier par ordre croissant",sort_descending:"Trier par ordre décroissant",drop_to_upload:"Déposez ici les fichiers CSV ou TSV pour importer les données dans le dataframe.",clear_sort:"Effacer le tri"},u={dropdown:"Menu déroulant"},l={build_error:"il y a une erreur de construction",config_error:"il y a une erreur de configuration",contact_page_author:"Veuillez contacter l'auteur de la page pour l'informer.",no_app_file:"il n'y a pas de fichier d'application",runtime_error:"il y a une erreur d'exécution",space_not_working:'"Le Space ne fonctionne pas car" {0}',space_paused:"le Space est en pause",use_via_api:"Utiliser via API",use_via_api_or_mcp:"Utiliser via API ou MCP"},d={uploading:"Téléchargement..."},p={highlighted_text:"Texte surligné"},_={allow_webcam_access:"Veuillez autoriser l'accès à la webcam pour l'enregistrement.",brush_color:"Couleur du pinceau",brush_radius:"Taille du pinceau",image:"Image",remove_image:"Supprimer l'image",select_brush_color:"Sélectionner la couleur du pinceau",start_drawing:"Commencer à dessiner",use_brush:"Utiliser le pinceau",drop_to_upload:"Déposez un fichier image ici pour télécharger"},g={label:"Étiquette"},m={enable_cookies:"Si vous visitez un Space HuggingFace en mode Incognito, vous devez activer les cookies tiers.",incorrect_credentials:"Identifiants incorrects",username:"nom d'utilisateur",password:"mot de passe",login:"Connexion"},h={number:"Nombre"},f={plot:"Graphique"},v={radio:"Bouton radio"},b={slider:"Curseur"},w={click_to_upload:"Cliquez pour télécharger un fichier",drop_audio:"Déposez l'audio ici",drop_csv:"Déposez le fichier CSV ici",drop_file:"Déposez le fichier ici",drop_image:"Déposez l'image ici",drop_video:"Déposez la vidéo ici",drop_gallery:"Déposez les médias ici",paste_clipboard:"Coller depuis le presse-papiers"},z={drop_to_upload:"Déposez un fichier vidéo ici pour le télécharger"},S={edit:"Modifier",retry:"Réessayer",undo:"Annuler",submit:"Envoyer",cancel:"Annuler",like:"J'aime",dislike:"Je n'aime pas",clear:"Effacer la conversation"},A={_name:e,"3D_model":{"3d_model":"Modèle 3D",drop_to_upload:"Déposez un fichier image ici pour le télécharger"},annotated_image:r,audio:o,blocks:i,checkbox:n,code:a,color_picker:t,common:c,dataframe:s,dropdown:u,errors:l,file:d,highlighted_text:p,image:_,label:g,login:m,number:h,plot:f,radio:v,slider:b,upload_text:w,video:z,chatbot:S};export{e as _name,r as annotated_image,o as audio,i as blocks,S as chatbot,n as checkbox,a as code,t as color_picker,c as common,s as dataframe,A as default,u as dropdown,l as errors,d as file,p as highlighted_text,_ as image,g as label,m as login,h as number,f as plot,v as radio,b as slider,w as upload_text,z as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fresnelFunction-cCRUtTOI.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fresnelFunction-cCRUtTOI.js new file mode 100644 index 0000000000000000000000000000000000000000..17282cb58504488459532a501473891d91b7d185 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/fresnelFunction-cCRUtTOI.js @@ -0,0 +1,5 @@ +import{S as e}from"./index-CDrXokXW.js";const r="fresnelFunction",o=`#ifdef FRESNEL +fn computeFresnelTerm(viewDirection: vec3f,worldNormal: vec3f,bias: f32,power: f32)->f32 +{let fresnelTerm: f32=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);} +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=o); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/frontmatter-YCXABXxZ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/frontmatter-YCXABXxZ.js new file mode 100644 index 0000000000000000000000000000000000000000..5284e94e669e12e54de3015e55cbaf4c50ec161e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/frontmatter-YCXABXxZ.js @@ -0,0 +1 @@ +import{p as s,s as m,f as l,c as i,S as p,t as o}from"./Code-BLWhl1y6.js";import{yaml as f}from"./yaml-DsCXHVTH.js";import"./i18n-Dnhn5Rxr.js";import"./index-DWyDLubb.js";const n=/^---\s*$/m,M={defineNodes:[{name:"Frontmatter",block:!0},"FrontmatterMark"],props:[m({Frontmatter:[o.documentMeta,o.monospace],FrontmatterMark:o.processingInstruction}),l.add({Frontmatter:i,FrontmatterMark:()=>null})],wrap:s(t=>{const{parser:e}=p.define(f);return t.type.name==="Frontmatter"?{parser:e,overlay:[{from:t.from+4,to:t.to-4}]}:null}),parseBlock:[{name:"Frontmatter",before:"HorizontalRule",parse:(t,e)=>{let r;const a=new Array;if(t.lineStart===0&&n.test(e.text)){for(a.push(t.elt("FrontmatterMark",0,4));t.nextLine();)if(n.test(e.text)){r=t.lineStart+4;break}return r!==void 0&&(a.push(t.elt("FrontmatterMark",r-4,r)),t.addElement(t.elt("Frontmatter",0,r,a))),!0}return!1}}]};export{M as frontmatter}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ganttDiagram-JELNMOA3-j8t2SK-P.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ganttDiagram-JELNMOA3-j8t2SK-P.js new file mode 100644 index 0000000000000000000000000000000000000000..f29dcc3c34dcd097525672bd10627875c270dea2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ganttDiagram-JELNMOA3-j8t2SK-P.js @@ -0,0 +1,267 @@ +import{g as ve,s as xe,q as Te,p as be,a as we,b as _e,_ as c,c as lt,d as De,as as j,l as nt,j as Se,i as Me,y as Ce,u as Ee}from"./mermaid.core-7TB2QPZo.js";import{G as Et}from"./i18n-Dnhn5Rxr.js";import{t as Ie,m as Ae,a as Fe,i as $e,b as Ut,c as Zt,d as Ye,e as Le,f as We,g as Oe,h as Pe,j as Ve,k as ze,l as Qt,n as Kt,o as Jt,s as te,p as ee}from"./time-BMaLdJ6b.js";import{l as Ne}from"./linear-8mDBZVC7.js";import{s as pt}from"./select-BigU4G0v.js";import"./index-DWyDLubb.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";import"./init-Dmth1JHB.js";import"./defaultLocale-CzDG__Ur.js";function Re(t){return t}var xt=1,At=2,$t=3,vt=4,re=1e-6;function He(t){return"translate("+t+",0)"}function Be(t){return"translate(0,"+t+")"}function qe(t){return i=>+t(i)}function Ge(t,i){return i=Math.max(0,t.bandwidth()-i*2)/2,t.round()&&(i=Math.round(i)),n=>+t(n)+i}function je(){return!this.__axis}function ue(t,i){var n=[],s=null,a=null,m=6,h=6,b=3,E=typeof window<"u"&&window.devicePixelRatio>1?0:.5,F=t===xt||t===vt?-1:1,T=t===vt||t===At?"x":"y",L=t===xt||t===$t?He:Be;function M(D){var N=s??(i.ticks?i.ticks.apply(i,n):i.domain()),I=a??(i.tickFormat?i.tickFormat.apply(i,n):Re),S=Math.max(m,0)+b,C=i.range(),O=+C[0]+E,Y=+C[C.length-1]+E,R=(i.bandwidth?Ge:qe)(i.copy(),E),H=D.selection?D.selection():D,A=H.selectAll(".domain").data([null]),p=H.selectAll(".tick").data(N,i).order(),d=p.exit(),u=p.enter().append("g").attr("class","tick"),x=p.select("line"),v=p.select("text");A=A.merge(A.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),p=p.merge(u),x=x.merge(u.append("line").attr("stroke","currentColor").attr(T+"2",F*m)),v=v.merge(u.append("text").attr("fill","currentColor").attr(T,F*S).attr("dy",t===xt?"0em":t===$t?"0.71em":"0.32em")),D!==H&&(A=A.transition(D),p=p.transition(D),x=x.transition(D),v=v.transition(D),d=d.transition(D).attr("opacity",re).attr("transform",function(k){return isFinite(k=R(k))?L(k+E):this.getAttribute("transform")}),u.attr("opacity",re).attr("transform",function(k){var f=this.parentNode.__axis;return L((f&&isFinite(f=f(k))?f:R(k))+E)})),d.remove(),A.attr("d",t===vt||t===At?h?"M"+F*h+","+O+"H"+E+"V"+Y+"H"+F*h:"M"+E+","+O+"V"+Y:h?"M"+O+","+F*h+"V"+E+"H"+Y+"V"+F*h:"M"+O+","+E+"H"+Y),p.attr("opacity",1).attr("transform",function(k){return L(R(k)+E)}),x.attr(T+"2",F*m),v.attr(T,F*S).text(I),H.filter(je).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===At?"start":t===vt?"end":"middle"),H.each(function(){this.__axis=R})}return M.scale=function(D){return arguments.length?(i=D,M):i},M.ticks=function(){return n=Array.from(arguments),M},M.tickArguments=function(D){return arguments.length?(n=D==null?[]:Array.from(D),M):n.slice()},M.tickValues=function(D){return arguments.length?(s=D==null?null:Array.from(D),M):s&&s.slice()},M.tickFormat=function(D){return arguments.length?(a=D,M):a},M.tickSize=function(D){return arguments.length?(m=h=+D,M):m},M.tickSizeInner=function(D){return arguments.length?(m=+D,M):m},M.tickSizeOuter=function(D){return arguments.length?(h=+D,M):h},M.tickPadding=function(D){return arguments.length?(b=+D,M):b},M.offset=function(D){return arguments.length?(E=+D,M):E},M}function Xe(t){return ue(xt,t)}function Ue(t){return ue($t,t)}var Tt={exports:{}},Ze=Tt.exports,ie;function Qe(){return ie||(ie=1,(function(t,i){(function(n,s){t.exports=s()})(Ze,(function(){var n="day";return function(s,a,m){var h=function(F){return F.add(4-F.isoWeekday(),n)},b=a.prototype;b.isoWeekYear=function(){return h(this).year()},b.isoWeek=function(F){if(!this.$utils().u(F))return this.add(7*(F-this.isoWeek()),n);var T,L,M,D,N=h(this),I=(T=this.isoWeekYear(),L=this.$u,M=(L?m.utc:m)().year(T).startOf("year"),D=4-M.isoWeekday(),M.isoWeekday()>4&&(D+=7),M.add(D,n));return N.diff(I,"week")+1},b.isoWeekday=function(F){return this.$utils().u(F)?this.day()||7:this.day(this.day()%7?F:F-7)};var E=b.startOf;b.startOf=function(F,T){var L=this.$utils(),M=!!L.u(T)||T;return L.p(F)==="isoweek"?M?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):E.bind(this)(F,T)}}}))})(Tt)),Tt.exports}var Ke=Qe();const Je=Et(Ke);var bt={exports:{}},tr=bt.exports,se;function er(){return se||(se=1,(function(t,i){(function(n,s){t.exports=s()})(tr,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},s=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,a=/\d/,m=/\d\d/,h=/\d\d?/,b=/\d*[^-_:/,()\s\d]+/,E={},F=function(S){return(S=+S)+(S>68?1900:2e3)},T=function(S){return function(C){this[S]=+C}},L=[/[+-]\d\d:?(\d\d)?|Z/,function(S){(this.zone||(this.zone={})).offset=(function(C){if(!C||C==="Z")return 0;var O=C.match(/([+-]|\d\d)/g),Y=60*O[1]+(+O[2]||0);return Y===0?0:O[0]==="+"?-Y:Y})(S)}],M=function(S){var C=E[S];return C&&(C.indexOf?C:C.s.concat(C.f))},D=function(S,C){var O,Y=E.meridiem;if(Y){for(var R=1;R<=24;R+=1)if(S.indexOf(Y(R,0,C))>-1){O=R>12;break}}else O=S===(C?"pm":"PM");return O},N={A:[b,function(S){this.afternoon=D(S,!1)}],a:[b,function(S){this.afternoon=D(S,!0)}],Q:[a,function(S){this.month=3*(S-1)+1}],S:[a,function(S){this.milliseconds=100*+S}],SS:[m,function(S){this.milliseconds=10*+S}],SSS:[/\d{3}/,function(S){this.milliseconds=+S}],s:[h,T("seconds")],ss:[h,T("seconds")],m:[h,T("minutes")],mm:[h,T("minutes")],H:[h,T("hours")],h:[h,T("hours")],HH:[h,T("hours")],hh:[h,T("hours")],D:[h,T("day")],DD:[m,T("day")],Do:[b,function(S){var C=E.ordinal,O=S.match(/\d+/);if(this.day=O[0],C)for(var Y=1;Y<=31;Y+=1)C(Y).replace(/\[|\]/g,"")===S&&(this.day=Y)}],w:[h,T("week")],ww:[m,T("week")],M:[h,T("month")],MM:[m,T("month")],MMM:[b,function(S){var C=M("months"),O=(M("monthsShort")||C.map((function(Y){return Y.slice(0,3)}))).indexOf(S)+1;if(O<1)throw new Error;this.month=O%12||O}],MMMM:[b,function(S){var C=M("months").indexOf(S)+1;if(C<1)throw new Error;this.month=C%12||C}],Y:[/[+-]?\d+/,T("year")],YY:[m,function(S){this.year=F(S)}],YYYY:[/\d{4}/,T("year")],Z:L,ZZ:L};function I(S){var C,O;C=S,O=E&&E.formats;for(var Y=(S=C.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(x,v,k){var f=k&&k.toUpperCase();return v||O[k]||n[k]||O[f].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(o,l,y){return l||y.slice(1)}))}))).match(s),R=Y.length,H=0;H-1)return new Date((w==="X"?1e3:1)*g);var e=I(w)(g),_=e.year,V=e.month,P=e.day,W=e.hours,G=e.minutes,$=e.seconds,Q=e.milliseconds,rt=e.zone,ot=e.week,ft=new Date,ht=P||(_||V?1:ft.getDate()),ct=_||ft.getFullYear(),B=0;_&&!V||(B=V>0?V-1:ft.getMonth());var Z,X=W||0,st=G||0,K=$||0,it=Q||0;return rt?new Date(Date.UTC(ct,B,ht,X,st,K,it+60*rt.offset*1e3)):r?new Date(Date.UTC(ct,B,ht,X,st,K,it)):(Z=new Date(ct,B,ht,X,st,K,it),ot&&(Z=z(Z).week(ot).toDate()),Z)}catch{return new Date("")}})(A,u,p,O),this.init(),f&&f!==!0&&(this.$L=this.locale(f).$L),k&&A!=this.format(u)&&(this.$d=new Date("")),E={}}else if(u instanceof Array)for(var o=u.length,l=1;l<=o;l+=1){d[1]=u[l-1];var y=O.apply(this,d);if(y.isValid()){this.$d=y.$d,this.$L=y.$L,this.init();break}l===o&&(this.$d=new Date(""))}else R.call(this,H)}}}))})(bt)),bt.exports}var rr=er();const ir=Et(rr);var wt={exports:{}},sr=wt.exports,ne;function nr(){return ne||(ne=1,(function(t,i){(function(n,s){t.exports=s()})(sr,(function(){return function(n,s){var a=s.prototype,m=a.format;a.format=function(h){var b=this,E=this.$locale();if(!this.isValid())return m.bind(this)(h);var F=this.$utils(),T=(h||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(L){switch(L){case"Q":return Math.ceil((b.$M+1)/3);case"Do":return E.ordinal(b.$D);case"gggg":return b.weekYear();case"GGGG":return b.isoWeekYear();case"wo":return E.ordinal(b.week(),"W");case"w":case"ww":return F.s(b.week(),L==="w"?1:2,"0");case"W":case"WW":return F.s(b.isoWeek(),L==="W"?1:2,"0");case"k":case"kk":return F.s(String(b.$H===0?24:b.$H),L==="k"?1:2,"0");case"X":return Math.floor(b.$d.getTime()/1e3);case"x":return b.$d.getTime();case"z":return"["+b.offsetName()+"]";case"zzz":return"["+b.offsetName("long")+"]";default:return L}}));return m.bind(this)(T)}}}))})(wt)),wt.exports}var ar=nr();const or=Et(ar);var _t={exports:{}},cr=_t.exports,ae;function lr(){return ae||(ae=1,(function(t,i){(function(n,s){t.exports=s()})(cr,(function(){var n,s,a=1e3,m=6e4,h=36e5,b=864e5,E=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,F=31536e6,T=2628e6,L=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,M={years:F,months:T,days:b,hours:h,minutes:m,seconds:a,milliseconds:1,weeks:6048e5},D=function(A){return A instanceof R},N=function(A,p,d){return new R(A,d,p.$l)},I=function(A){return s.p(A)+"s"},S=function(A){return A<0},C=function(A){return S(A)?Math.ceil(A):Math.floor(A)},O=function(A){return Math.abs(A)},Y=function(A,p){return A?S(A)?{negative:!0,format:""+O(A)+p}:{negative:!1,format:""+A+p}:{negative:!1,format:""}},R=(function(){function A(d,u,x){var v=this;if(this.$d={},this.$l=x,d===void 0&&(this.$ms=0,this.parseFromMilliseconds()),u)return N(d*M[I(u)],this);if(typeof d=="number")return this.$ms=d,this.parseFromMilliseconds(),this;if(typeof d=="object")return Object.keys(d).forEach((function(o){v.$d[I(o)]=d[o]})),this.calMilliseconds(),this;if(typeof d=="string"){var k=d.match(L);if(k){var f=k.slice(2).map((function(o){return o!=null?Number(o):0}));return this.$d.years=f[0],this.$d.months=f[1],this.$d.weeks=f[2],this.$d.days=f[3],this.$d.hours=f[4],this.$d.minutes=f[5],this.$d.seconds=f[6],this.calMilliseconds(),this}}return this}var p=A.prototype;return p.calMilliseconds=function(){var d=this;this.$ms=Object.keys(this.$d).reduce((function(u,x){return u+(d.$d[x]||0)*M[x]}),0)},p.parseFromMilliseconds=function(){var d=this.$ms;this.$d.years=C(d/F),d%=F,this.$d.months=C(d/T),d%=T,this.$d.days=C(d/b),d%=b,this.$d.hours=C(d/h),d%=h,this.$d.minutes=C(d/m),d%=m,this.$d.seconds=C(d/a),d%=a,this.$d.milliseconds=d},p.toISOString=function(){var d=Y(this.$d.years,"Y"),u=Y(this.$d.months,"M"),x=+this.$d.days||0;this.$d.weeks&&(x+=7*this.$d.weeks);var v=Y(x,"D"),k=Y(this.$d.hours,"H"),f=Y(this.$d.minutes,"M"),o=this.$d.seconds||0;this.$d.milliseconds&&(o+=this.$d.milliseconds/1e3,o=Math.round(1e3*o)/1e3);var l=Y(o,"S"),y=d.negative||u.negative||v.negative||k.negative||f.negative||l.negative,g=k.format||f.format||l.format?"T":"",w=(y?"-":"")+"P"+d.format+u.format+v.format+g+k.format+f.format+l.format;return w==="P"||w==="-P"?"P0D":w},p.toJSON=function(){return this.toISOString()},p.format=function(d){var u=d||"YYYY-MM-DDTHH:mm:ss",x={Y:this.$d.years,YY:s.s(this.$d.years,2,"0"),YYYY:s.s(this.$d.years,4,"0"),M:this.$d.months,MM:s.s(this.$d.months,2,"0"),D:this.$d.days,DD:s.s(this.$d.days,2,"0"),H:this.$d.hours,HH:s.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:s.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:s.s(this.$d.seconds,2,"0"),SSS:s.s(this.$d.milliseconds,3,"0")};return u.replace(E,(function(v,k){return k||String(x[v])}))},p.as=function(d){return this.$ms/M[I(d)]},p.get=function(d){var u=this.$ms,x=I(d);return x==="milliseconds"?u%=1e3:u=x==="weeks"?C(u/M[x]):this.$d[x],u||0},p.add=function(d,u,x){var v;return v=u?d*M[I(u)]:D(d)?d.$ms:N(d,this).$ms,N(this.$ms+v*(x?-1:1),this)},p.subtract=function(d,u){return this.add(d,u,!0)},p.locale=function(d){var u=this.clone();return u.$l=d,u},p.clone=function(){return N(this.$ms,this)},p.humanize=function(d){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!d)},p.valueOf=function(){return this.asMilliseconds()},p.milliseconds=function(){return this.get("milliseconds")},p.asMilliseconds=function(){return this.as("milliseconds")},p.seconds=function(){return this.get("seconds")},p.asSeconds=function(){return this.as("seconds")},p.minutes=function(){return this.get("minutes")},p.asMinutes=function(){return this.as("minutes")},p.hours=function(){return this.get("hours")},p.asHours=function(){return this.as("hours")},p.days=function(){return this.get("days")},p.asDays=function(){return this.as("days")},p.weeks=function(){return this.get("weeks")},p.asWeeks=function(){return this.as("weeks")},p.months=function(){return this.get("months")},p.asMonths=function(){return this.as("months")},p.years=function(){return this.get("years")},p.asYears=function(){return this.as("years")},A})(),H=function(A,p,d){return A.add(p.years()*d,"y").add(p.months()*d,"M").add(p.days()*d,"d").add(p.hours()*d,"h").add(p.minutes()*d,"m").add(p.seconds()*d,"s").add(p.milliseconds()*d,"ms")};return function(A,p,d){n=d,s=d().$utils(),d.duration=function(v,k){var f=d.locale();return N(v,{$l:f},k)},d.isDuration=D;var u=p.prototype.add,x=p.prototype.subtract;p.prototype.add=function(v,k){return D(v)?H(this,v,1):u.bind(this)(v,k)},p.prototype.subtract=function(v,k){return D(v)?H(this,v,-1):x.bind(this)(v,k)}}}))})(_t)),_t.exports}var ur=lr();const dr=Et(ur);var Yt=(function(){var t=c(function(f,o,l,y){for(l=l||{},y=f.length;y--;l[f[y]]=o);return l},"o"),i=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],n=[1,26],s=[1,27],a=[1,28],m=[1,29],h=[1,30],b=[1,31],E=[1,32],F=[1,33],T=[1,34],L=[1,9],M=[1,10],D=[1,11],N=[1,12],I=[1,13],S=[1,14],C=[1,15],O=[1,16],Y=[1,19],R=[1,20],H=[1,21],A=[1,22],p=[1,23],d=[1,25],u=[1,35],x={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:c(function(o,l,y,g,w,r,z){var e=r.length-1;switch(w){case 1:return r[e-1];case 2:this.$=[];break;case 3:r[e-1].push(r[e]),this.$=r[e-1];break;case 4:case 5:this.$=r[e];break;case 6:case 7:this.$=[];break;case 8:g.setWeekday("monday");break;case 9:g.setWeekday("tuesday");break;case 10:g.setWeekday("wednesday");break;case 11:g.setWeekday("thursday");break;case 12:g.setWeekday("friday");break;case 13:g.setWeekday("saturday");break;case 14:g.setWeekday("sunday");break;case 15:g.setWeekend("friday");break;case 16:g.setWeekend("saturday");break;case 17:g.setDateFormat(r[e].substr(11)),this.$=r[e].substr(11);break;case 18:g.enableInclusiveEndDates(),this.$=r[e].substr(18);break;case 19:g.TopAxis(),this.$=r[e].substr(8);break;case 20:g.setAxisFormat(r[e].substr(11)),this.$=r[e].substr(11);break;case 21:g.setTickInterval(r[e].substr(13)),this.$=r[e].substr(13);break;case 22:g.setExcludes(r[e].substr(9)),this.$=r[e].substr(9);break;case 23:g.setIncludes(r[e].substr(9)),this.$=r[e].substr(9);break;case 24:g.setTodayMarker(r[e].substr(12)),this.$=r[e].substr(12);break;case 27:g.setDiagramTitle(r[e].substr(6)),this.$=r[e].substr(6);break;case 28:this.$=r[e].trim(),g.setAccTitle(this.$);break;case 29:case 30:this.$=r[e].trim(),g.setAccDescription(this.$);break;case 31:g.addSection(r[e].substr(8)),this.$=r[e].substr(8);break;case 33:g.addTask(r[e-1],r[e]),this.$="task";break;case 34:this.$=r[e-1],g.setClickEvent(r[e-1],r[e],null);break;case 35:this.$=r[e-2],g.setClickEvent(r[e-2],r[e-1],r[e]);break;case 36:this.$=r[e-2],g.setClickEvent(r[e-2],r[e-1],null),g.setLink(r[e-2],r[e]);break;case 37:this.$=r[e-3],g.setClickEvent(r[e-3],r[e-2],r[e-1]),g.setLink(r[e-3],r[e]);break;case 38:this.$=r[e-2],g.setClickEvent(r[e-2],r[e],null),g.setLink(r[e-2],r[e-1]);break;case 39:this.$=r[e-3],g.setClickEvent(r[e-3],r[e-1],r[e]),g.setLink(r[e-3],r[e-2]);break;case 40:this.$=r[e-1],g.setLink(r[e-1],r[e]);break;case 41:case 47:this.$=r[e-1]+" "+r[e];break;case 42:case 43:case 45:this.$=r[e-2]+" "+r[e-1]+" "+r[e];break;case 44:case 46:this.$=r[e-3]+" "+r[e-2]+" "+r[e-1]+" "+r[e];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(i,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:n,13:s,14:a,15:m,16:h,17:b,18:E,19:18,20:F,21:T,22:L,23:M,24:D,25:N,26:I,27:S,28:C,29:O,30:Y,31:R,33:H,35:A,36:p,37:24,38:d,40:u},t(i,[2,7],{1:[2,1]}),t(i,[2,3]),{9:36,11:17,12:n,13:s,14:a,15:m,16:h,17:b,18:E,19:18,20:F,21:T,22:L,23:M,24:D,25:N,26:I,27:S,28:C,29:O,30:Y,31:R,33:H,35:A,36:p,37:24,38:d,40:u},t(i,[2,5]),t(i,[2,6]),t(i,[2,17]),t(i,[2,18]),t(i,[2,19]),t(i,[2,20]),t(i,[2,21]),t(i,[2,22]),t(i,[2,23]),t(i,[2,24]),t(i,[2,25]),t(i,[2,26]),t(i,[2,27]),{32:[1,37]},{34:[1,38]},t(i,[2,30]),t(i,[2,31]),t(i,[2,32]),{39:[1,39]},t(i,[2,8]),t(i,[2,9]),t(i,[2,10]),t(i,[2,11]),t(i,[2,12]),t(i,[2,13]),t(i,[2,14]),t(i,[2,15]),t(i,[2,16]),{41:[1,40],43:[1,41]},t(i,[2,4]),t(i,[2,28]),t(i,[2,29]),t(i,[2,33]),t(i,[2,34],{42:[1,42],43:[1,43]}),t(i,[2,40],{41:[1,44]}),t(i,[2,35],{43:[1,45]}),t(i,[2,36]),t(i,[2,38],{42:[1,46]}),t(i,[2,37]),t(i,[2,39])],defaultActions:{},parseError:c(function(o,l){if(l.recoverable)this.trace(o);else{var y=new Error(o);throw y.hash=l,y}},"parseError"),parse:c(function(o){var l=this,y=[0],g=[],w=[null],r=[],z=this.table,e="",_=0,V=0,P=2,W=1,G=r.slice.call(arguments,1),$=Object.create(this.lexer),Q={yy:{}};for(var rt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,rt)&&(Q.yy[rt]=this.yy[rt]);$.setInput(o,Q.yy),Q.yy.lexer=$,Q.yy.parser=this,typeof $.yylloc>"u"&&($.yylloc={});var ot=$.yylloc;r.push(ot);var ft=$.options&&$.options.ranges;typeof Q.yy.parseError=="function"?this.parseError=Q.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ht(U){y.length=y.length-2*U,w.length=w.length-U,r.length=r.length-U}c(ht,"popStack");function ct(){var U;return U=g.pop()||$.lex()||W,typeof U!="number"&&(U instanceof Array&&(g=U,U=g.pop()),U=l.symbols_[U]||U),U}c(ct,"lex");for(var B,Z,X,st,K={},it,J,Xt,gt;;){if(Z=y[y.length-1],this.defaultActions[Z]?X=this.defaultActions[Z]:((B===null||typeof B>"u")&&(B=ct()),X=z[Z]&&z[Z][B]),typeof X>"u"||!X.length||!X[0]){var It="";gt=[];for(it in z[Z])this.terminals_[it]&&it>P&>.push("'"+this.terminals_[it]+"'");$.showPosition?It="Parse error on line "+(_+1)+`: +`+$.showPosition()+` +Expecting `+gt.join(", ")+", got '"+(this.terminals_[B]||B)+"'":It="Parse error on line "+(_+1)+": Unexpected "+(B==W?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(It,{text:$.match,token:this.terminals_[B]||B,line:$.yylineno,loc:ot,expected:gt})}if(X[0]instanceof Array&&X.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Z+", token: "+B);switch(X[0]){case 1:y.push(B),w.push($.yytext),r.push($.yylloc),y.push(X[1]),B=null,V=$.yyleng,e=$.yytext,_=$.yylineno,ot=$.yylloc;break;case 2:if(J=this.productions_[X[1]][1],K.$=w[w.length-J],K._$={first_line:r[r.length-(J||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(J||1)].first_column,last_column:r[r.length-1].last_column},ft&&(K._$.range=[r[r.length-(J||1)].range[0],r[r.length-1].range[1]]),st=this.performAction.apply(K,[e,V,_,Q.yy,X[1],w,r].concat(G)),typeof st<"u")return st;J&&(y=y.slice(0,-1*J*2),w=w.slice(0,-1*J),r=r.slice(0,-1*J)),y.push(this.productions_[X[1]][0]),w.push(K.$),r.push(K._$),Xt=z[y[y.length-2]][y[y.length-1]],y.push(Xt);break;case 3:return!0}}return!0},"parse")},v=(function(){var f={EOF:1,parseError:c(function(l,y){if(this.yy.parser)this.yy.parser.parseError(l,y);else throw new Error(l)},"parseError"),setInput:c(function(o,l){return this.yy=l||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var l=o.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:c(function(o){var l=o.length,y=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),y.length-1&&(this.yylineno-=y.length-1);var w=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:y?(y.length===g.length?this.yylloc.first_column:0)+g[g.length-y.length].length-y[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[w[0],w[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(o){this.unput(this.match.slice(o))},"less"),pastInput:c(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var o=this.pastInput(),l=new Array(o.length+1).join("-");return o+this.upcomingInput()+` +`+l+"^"},"showPosition"),test_match:c(function(o,l){var y,g,w;if(this.options.backtrack_lexer&&(w={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(w.yylloc.range=this.yylloc.range.slice(0))),g=o[0].match(/(?:\r\n?|\n).*/g),g&&(this.yylineno+=g.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:g?g[g.length-1].length-g[g.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+o[0].length},this.yytext+=o[0],this.match+=o[0],this.matches=o,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(o[0].length),this.matched+=o[0],y=this.performAction.call(this,this.yy,this,l,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),y)return y;if(this._backtrack){for(var r in w)this[r]=w[r];return!1}return!1},"test_match"),next:c(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var o,l,y,g;this._more||(this.yytext="",this.match="");for(var w=this._currentRules(),r=0;rl[0].length)){if(l=y,g=r,this.options.backtrack_lexer){if(o=this.test_match(y,w[r]),o!==!1)return o;if(this._backtrack){l=!1;continue}else return!1}else if(!this.options.flex)break}return l?(o=this.test_match(l,w[g]),o!==!1?o:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:c(function(){var l=this.next();return l||this.lex()},"lex"),begin:c(function(l){this.conditionStack.push(l)},"begin"),popState:c(function(){var l=this.conditionStack.length-1;return l>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:c(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:c(function(l){return l=this.conditionStack.length-1-Math.abs(l||0),l>=0?this.conditionStack[l]:"INITIAL"},"topState"),pushState:c(function(l){this.begin(l)},"pushState"),stateStackSize:c(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:c(function(l,y,g,w){switch(g){case 0:return this.begin("open_directive"),"open_directive";case 1:return this.begin("acc_title"),31;case 2:return this.popState(),"acc_title_value";case 3:return this.begin("acc_descr"),33;case 4:return this.popState(),"acc_descr_value";case 5:this.begin("acc_descr_multiline");break;case 6:this.popState();break;case 7:return"acc_descr_multiline_value";case 8:break;case 9:break;case 10:break;case 11:return 10;case 12:break;case 13:break;case 14:this.begin("href");break;case 15:this.popState();break;case 16:return 43;case 17:this.begin("callbackname");break;case 18:this.popState();break;case 19:this.popState(),this.begin("callbackargs");break;case 20:return 41;case 21:this.popState();break;case 22:return 42;case 23:this.begin("click");break;case 24:this.popState();break;case 25:return 40;case 26:return 4;case 27:return 22;case 28:return 23;case 29:return 24;case 30:return 25;case 31:return 26;case 32:return 28;case 33:return 27;case 34:return 29;case 35:return 12;case 36:return 13;case 37:return 14;case 38:return 15;case 39:return 16;case 40:return 17;case 41:return 18;case 42:return 20;case 43:return 21;case 44:return"date";case 45:return 30;case 46:return"accDescription";case 47:return 36;case 48:return 38;case 49:return 39;case 50:return":";case 51:return 6;case 52:return"INVALID"}},"anonymous"),rules:[/^(?:%%\{)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%(?!\{)*[^\n]*)/i,/^(?:[^\}]%%*[^\n]*)/i,/^(?:%%*[^\n]*[\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:%[^\n]*)/i,/^(?:href[\s]+["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:call[\s]+)/i,/^(?:\([\s]*\))/i,/^(?:\()/i,/^(?:[^(]*)/i,/^(?:\))/i,/^(?:[^)]*)/i,/^(?:click[\s]+)/i,/^(?:[\s\n])/i,/^(?:[^\s\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:inclusiveEndDates\b)/i,/^(?:topAxis\b)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:tickInterval\s[^#\n;]+)/i,/^(?:includes\s[^#\n;]+)/i,/^(?:excludes\s[^#\n;]+)/i,/^(?:todayMarker\s[^\n;]+)/i,/^(?:weekday\s+monday\b)/i,/^(?:weekday\s+tuesday\b)/i,/^(?:weekday\s+wednesday\b)/i,/^(?:weekday\s+thursday\b)/i,/^(?:weekday\s+friday\b)/i,/^(?:weekday\s+saturday\b)/i,/^(?:weekday\s+sunday\b)/i,/^(?:weekend\s+friday\b)/i,/^(?:weekend\s+saturday\b)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accDescription\s[^#\n;]+)/i,/^(?:section\s[^\n]+)/i,/^(?:[^:\n]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[6,7],inclusive:!1},acc_descr:{rules:[4],inclusive:!1},acc_title:{rules:[2],inclusive:!1},callbackargs:{rules:[21,22],inclusive:!1},callbackname:{rules:[18,19,20],inclusive:!1},href:{rules:[15,16],inclusive:!1},click:{rules:[24,25],inclusive:!1},INITIAL:{rules:[0,1,3,5,8,9,10,11,12,13,14,17,23,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],inclusive:!0}}};return f})();x.lexer=v;function k(){this.yy={}}return c(k,"Parser"),k.prototype=x,x.Parser=k,new k})();Yt.parser=Yt;var fr=Yt;j.extend(Je);j.extend(ir);j.extend(or);var oe={friday:5,saturday:6},tt="",Pt="",Vt=void 0,zt="",mt=[],kt=[],Nt=new Map,Rt=[],Mt=[],dt="",Ht="",de=["active","done","crit","milestone","vert"],Bt=[],yt=!1,qt=!1,Gt="sunday",Ct="saturday",Lt=0,hr=c(function(){Rt=[],Mt=[],dt="",Bt=[],Dt=0,Ot=void 0,St=void 0,q=[],tt="",Pt="",Ht="",Vt=void 0,zt="",mt=[],kt=[],yt=!1,qt=!1,Lt=0,Nt=new Map,Ce(),Gt="sunday",Ct="saturday"},"clear"),mr=c(function(t){Pt=t},"setAxisFormat"),kr=c(function(){return Pt},"getAxisFormat"),yr=c(function(t){Vt=t},"setTickInterval"),gr=c(function(){return Vt},"getTickInterval"),pr=c(function(t){zt=t},"setTodayMarker"),vr=c(function(){return zt},"getTodayMarker"),xr=c(function(t){tt=t},"setDateFormat"),Tr=c(function(){yt=!0},"enableInclusiveEndDates"),br=c(function(){return yt},"endDatesAreInclusive"),wr=c(function(){qt=!0},"enableTopAxis"),_r=c(function(){return qt},"topAxisEnabled"),Dr=c(function(t){Ht=t},"setDisplayMode"),Sr=c(function(){return Ht},"getDisplayMode"),Mr=c(function(){return tt},"getDateFormat"),Cr=c(function(t){mt=t.toLowerCase().split(/[\s,]+/)},"setIncludes"),Er=c(function(){return mt},"getIncludes"),Ir=c(function(t){kt=t.toLowerCase().split(/[\s,]+/)},"setExcludes"),Ar=c(function(){return kt},"getExcludes"),Fr=c(function(){return Nt},"getLinks"),$r=c(function(t){dt=t,Rt.push(t)},"addSection"),Yr=c(function(){return Rt},"getSections"),Lr=c(function(){let t=ce();const i=10;let n=0;for(;!t&&n{const E=b.trim();return E==="x"||E==="X"},"isTimestampFormat")(i)&&/^\d+$/.test(n))return new Date(Number(n));const m=/^after\s+(?[\d\w- ]+)/.exec(n);if(m!==null){let b=null;for(const F of m.groups.ids.split(" ")){let T=at(F);T!==void 0&&(!b||T.endTime>b.endTime)&&(b=T)}if(b)return b.endTime;const E=new Date;return E.setHours(0,0,0,0),E}let h=j(n,i.trim(),!0);if(h.isValid())return h.toDate();{nt.debug("Invalid date:"+n),nt.debug("With date format:"+i.trim());const b=new Date(n);if(b===void 0||isNaN(b.getTime())||b.getFullYear()<-1e4||b.getFullYear()>1e4)throw new Error("Invalid date:"+n);return b}},"getStartDate"),me=c(function(t){const i=/^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(t.trim());return i!==null?[Number.parseFloat(i[1]),i[2]]:[NaN,"ms"]},"parseDuration"),ke=c(function(t,i,n,s=!1){n=n.trim();const m=/^until\s+(?[\d\w- ]+)/.exec(n);if(m!==null){let T=null;for(const M of m.groups.ids.split(" ")){let D=at(M);D!==void 0&&(!T||D.startTime{window.open(n,"_self")}),Nt.set(s,n))}),ge(t,"clickable")},"setLink"),ge=c(function(t,i){t.split(",").forEach(function(n){let s=at(n);s!==void 0&&s.classes.push(i)})},"setClass"),qr=c(function(t,i,n){if(lt().securityLevel!=="loose"||i===void 0)return;let s=[];if(typeof n=="string"){s=n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let m=0;m{Ee.runFunc(i,...s)})},"setClickFun"),pe=c(function(t,i){Bt.push(function(){const n=document.querySelector(`[id="${t}"]`);n!==null&&n.addEventListener("click",function(){i()})},function(){const n=document.querySelector(`[id="${t}-text"]`);n!==null&&n.addEventListener("click",function(){i()})})},"pushFun"),Gr=c(function(t,i,n){t.split(",").forEach(function(s){qr(s,i,n)}),ge(t,"clickable")},"setClickEvent"),jr=c(function(t){Bt.forEach(function(i){i(t)})},"bindFunctions"),Xr={getConfig:c(()=>lt().gantt,"getConfig"),clear:hr,setDateFormat:xr,getDateFormat:Mr,enableInclusiveEndDates:Tr,endDatesAreInclusive:br,enableTopAxis:wr,topAxisEnabled:_r,setAxisFormat:mr,getAxisFormat:kr,setTickInterval:yr,getTickInterval:gr,setTodayMarker:pr,getTodayMarker:vr,setAccTitle:_e,getAccTitle:we,setDiagramTitle:be,getDiagramTitle:Te,setDisplayMode:Dr,getDisplayMode:Sr,setAccDescription:xe,getAccDescription:ve,addSection:$r,getSections:Yr,getTasks:Lr,addTask:Rr,findTaskById:at,addTaskOrg:Hr,setIncludes:Cr,getIncludes:Er,setExcludes:Ir,getExcludes:Ar,setClickEvent:Gr,setLink:Br,getLinks:Fr,bindFunctions:jr,parseDuration:me,isInvalidDate:fe,setWeekday:Wr,getWeekday:Or,setWeekend:Pr};function jt(t,i,n){let s=!0;for(;s;)s=!1,n.forEach(function(a){const m="^\\s*"+a+"\\s*$",h=new RegExp(m);t[0].match(h)&&(i[a]=!0,t.shift(1),s=!0)})}c(jt,"getTaskTags");j.extend(dr);var Ur=c(function(){nt.debug("Something is calling, setConf, remove the call")},"setConf"),le={monday:ze,tuesday:Ve,wednesday:Pe,thursday:Oe,friday:We,saturday:Le,sunday:Ye},Zr=c((t,i)=>{let n=[...t].map(()=>-1/0),s=[...t].sort((m,h)=>m.startTime-h.startTime||m.order-h.order),a=0;for(const m of s)for(let h=0;h=n[h]){n[h]=m.endTime,m.order=h+i,h>a&&(a=h);break}return a},"getMaxIntersections"),et,Ft=1e4,Qr=c(function(t,i,n,s){const a=lt().gantt,m=lt().securityLevel;let h;m==="sandbox"&&(h=pt("#i"+i));const b=m==="sandbox"?pt(h.nodes()[0].contentDocument.body):pt("body"),E=m==="sandbox"?h.nodes()[0].contentDocument:document,F=E.getElementById(i);et=F.parentElement.offsetWidth,et===void 0&&(et=1200),a.useWidth!==void 0&&(et=a.useWidth);const T=s.db.getTasks();let L=[];for(const u of T)L.push(u.type);L=d(L);const M={};let D=2*a.topPadding;if(s.db.getDisplayMode()==="compact"||a.displayMode==="compact"){const u={};for(const v of T)u[v.section]===void 0?u[v.section]=[v]:u[v.section].push(v);let x=0;for(const v of Object.keys(u)){const k=Zr(u[v],x)+1;x+=k,D+=k*(a.barHeight+a.barGap),M[v]=k}}else{D+=T.length*(a.barHeight+a.barGap);for(const u of L)M[u]=T.filter(x=>x.type===u).length}F.setAttribute("viewBox","0 0 "+et+" "+D);const N=b.select(`[id="${i}"]`),I=Ie().domain([Ae(T,function(u){return u.startTime}),Fe(T,function(u){return u.endTime})]).rangeRound([0,et-a.leftPadding-a.rightPadding]);function S(u,x){const v=u.startTime,k=x.startTime;let f=0;return v>k?f=1:ve.vert===_.vert?0:e.vert?1:-1);const g=[...new Set(u.map(e=>e.order))].map(e=>u.find(_=>_.order===e));N.append("g").selectAll("rect").data(g).enter().append("rect").attr("x",0).attr("y",function(e,_){return _=e.order,_*x+v-2}).attr("width",function(){return l-a.rightPadding/2}).attr("height",x).attr("class",function(e){for(const[_,V]of L.entries())if(e.type===V)return"section section"+_%a.numberSectionStyles;return"section section0"}).enter();const w=N.append("g").selectAll("rect").data(u).enter(),r=s.db.getLinks();if(w.append("rect").attr("id",function(e){return e.id}).attr("rx",3).attr("ry",3).attr("x",function(e){return e.milestone?I(e.startTime)+k+.5*(I(e.endTime)-I(e.startTime))-.5*f:I(e.startTime)+k}).attr("y",function(e,_){return _=e.order,e.vert?a.gridLineStartPadding:_*x+v}).attr("width",function(e){return e.milestone?f:e.vert?.08*f:I(e.renderEndTime||e.endTime)-I(e.startTime)}).attr("height",function(e){return e.vert?T.length*(a.barHeight+a.barGap)+a.barHeight*2:f}).attr("transform-origin",function(e,_){return _=e.order,(I(e.startTime)+k+.5*(I(e.endTime)-I(e.startTime))).toString()+"px "+(_*x+v+.5*f).toString()+"px"}).attr("class",function(e){const _="task";let V="";e.classes.length>0&&(V=e.classes.join(" "));let P=0;for(const[G,$]of L.entries())e.type===$&&(P=G%a.numberSectionStyles);let W="";return e.active?e.crit?W+=" activeCrit":W=" active":e.done?e.crit?W=" doneCrit":W=" done":e.crit&&(W+=" crit"),W.length===0&&(W=" task"),e.milestone&&(W=" milestone "+W),e.vert&&(W=" vert "+W),W+=P,W+=" "+V,_+W}),w.append("text").attr("id",function(e){return e.id+"-text"}).text(function(e){return e.task}).attr("font-size",a.fontSize).attr("x",function(e){let _=I(e.startTime),V=I(e.renderEndTime||e.endTime);if(e.milestone&&(_+=.5*(I(e.endTime)-I(e.startTime))-.5*f,V=_+f),e.vert)return I(e.startTime)+k;const P=this.getBBox().width;return P>V-_?V+P+1.5*a.leftPadding>l?_+k-5:V+k+5:(V-_)/2+_+k}).attr("y",function(e,_){return e.vert?a.gridLineStartPadding+T.length*(a.barHeight+a.barGap)+60:(_=e.order,_*x+a.barHeight/2+(a.fontSize/2-2)+v)}).attr("text-height",f).attr("class",function(e){const _=I(e.startTime);let V=I(e.endTime);e.milestone&&(V=_+f);const P=this.getBBox().width;let W="";e.classes.length>0&&(W=e.classes.join(" "));let G=0;for(const[Q,rt]of L.entries())e.type===rt&&(G=Q%a.numberSectionStyles);let $="";return e.active&&(e.crit?$="activeCritText"+G:$="activeText"+G),e.done?e.crit?$=$+" doneCritText"+G:$=$+" doneText"+G:e.crit&&($=$+" critText"+G),e.milestone&&($+=" milestoneText"),e.vert&&($+=" vertText"),P>V-_?V+P+1.5*a.leftPadding>l?W+" taskTextOutsideLeft taskTextOutside"+G+" "+$:W+" taskTextOutsideRight taskTextOutside"+G+" "+$+" width-"+P:W+" taskText taskText"+G+" "+$+" width-"+P}),lt().securityLevel==="sandbox"){let e;e=pt("#i"+i);const _=e.nodes()[0].contentDocument;w.filter(function(V){return r.has(V.id)}).each(function(V){var P=_.querySelector("#"+V.id),W=_.querySelector("#"+V.id+"-text");const G=P.parentNode;var $=_.createElement("a");$.setAttribute("xlink:href",r.get(V.id)),$.setAttribute("target","_top"),G.appendChild($),$.appendChild(P),$.appendChild(W)})}}c(O,"drawRects");function Y(u,x,v,k,f,o,l,y){if(l.length===0&&y.length===0)return;let g,w;for(const{startTime:P,endTime:W}of o)(g===void 0||Pw)&&(w=W);if(!g||!w)return;if(j(w).diff(j(g),"year")>5){nt.warn("The difference between the min and max time is more than 5 years. This will cause performance issues. Skipping drawing exclude days.");return}const r=s.db.getDateFormat(),z=[];let e=null,_=j(g);for(;_.valueOf()<=w;)s.db.isInvalidDate(_,r,l,y)?e?e.end=_:e={start:_,end:_}:e&&(z.push(e),e=null),_=_.add(1,"d");N.append("g").selectAll("rect").data(z).enter().append("rect").attr("id",P=>"exclude-"+P.start.format("YYYY-MM-DD")).attr("x",P=>I(P.start.startOf("day"))+v).attr("y",a.gridLineStartPadding).attr("width",P=>I(P.end.endOf("day"))-I(P.start.startOf("day"))).attr("height",f-x-a.gridLineStartPadding).attr("transform-origin",function(P,W){return(I(P.start)+v+.5*(I(P.end)-I(P.start))).toString()+"px "+(W*u+.5*f).toString()+"px"}).attr("class","exclude-range")}c(Y,"drawExcludeDays");function R(u,x,v,k){if(v<=0||u>x)return 1/0;const f=x-u,o=j.duration({[k??"day"]:v}).asMilliseconds();return o<=0?1/0:Math.ceil(f/o)}c(R,"getEstimatedTickCount");function H(u,x,v,k){const f=s.db.getDateFormat(),o=s.db.getAxisFormat();let l;o?l=o:f==="D"?l="%d":l=a.axisFormat??"%Y-%m-%d";let y=Ue(I).tickSize(-k+x+a.gridLineStartPadding).tickFormat(Ut(l));const w=/^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/.exec(s.db.getTickInterval()||a.tickInterval);if(w!==null){const r=parseInt(w[1],10);if(isNaN(r)||r<=0)nt.warn(`Invalid tick interval value: "${w[1]}". Skipping custom tick interval.`);else{const z=w[2],e=s.db.getWeekday()||a.weekday,_=I.domain(),V=_[0],P=_[1],W=R(V,P,r,z);if(W>Ft)nt.warn(`The tick interval "${r}${z}" would generate ${W} ticks, which exceeds the maximum allowed (${Ft}). This may indicate an invalid date or time range. Skipping custom tick interval.`);else switch(z){case"millisecond":y.ticks(ee.every(r));break;case"second":y.ticks(te.every(r));break;case"minute":y.ticks(Jt.every(r));break;case"hour":y.ticks(Kt.every(r));break;case"day":y.ticks(Qt.every(r));break;case"week":y.ticks(le[e].every(r));break;case"month":y.ticks(Zt.every(r));break}}}if(N.append("g").attr("class","grid").attr("transform","translate("+u+", "+(k-50)+")").call(y).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10).attr("dy","1em"),s.db.topAxisEnabled()||a.topAxis){let r=Xe(I).tickSize(-k+x+a.gridLineStartPadding).tickFormat(Ut(l));if(w!==null){const z=parseInt(w[1],10);if(isNaN(z)||z<=0)nt.warn(`Invalid tick interval value: "${w[1]}". Skipping custom tick interval.`);else{const e=w[2],_=s.db.getWeekday()||a.weekday,V=I.domain(),P=V[0],W=V[1];if(R(P,W,z,e)<=Ft)switch(e){case"millisecond":r.ticks(ee.every(z));break;case"second":r.ticks(te.every(z));break;case"minute":r.ticks(Jt.every(z));break;case"hour":r.ticks(Kt.every(z));break;case"day":r.ticks(Qt.every(z));break;case"week":r.ticks(le[_].every(z));break;case"month":r.ticks(Zt.every(z));break}}}N.append("g").attr("class","grid").attr("transform","translate("+u+", "+x+")").call(r).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10)}}c(H,"makeGrid");function A(u,x){let v=0;const k=Object.keys(M).map(f=>[f,M[f]]);N.append("g").selectAll("text").data(k).enter().append(function(f){const o=f[0].split(Se.lineBreakRegex),l=-(o.length-1)/2,y=E.createElementNS("http://www.w3.org/2000/svg","text");y.setAttribute("dy",l+"em");for(const[g,w]of o.entries()){const r=E.createElementNS("http://www.w3.org/2000/svg","tspan");r.setAttribute("alignment-baseline","central"),r.setAttribute("x","10"),g>0&&r.setAttribute("dy","1em"),r.textContent=w,y.appendChild(r)}return y}).attr("x",10).attr("y",function(f,o){if(o>0)for(let l=0;l` + .mermaid-main-font { + font-family: ${t.fontFamily}; + } + + .exclude-range { + fill: ${t.excludeBkgColor}; + } + + .section { + stroke: none; + opacity: 0.2; + } + + .section0 { + fill: ${t.sectionBkgColor}; + } + + .section2 { + fill: ${t.sectionBkgColor2}; + } + + .section1, + .section3 { + fill: ${t.altSectionBkgColor}; + opacity: 0.2; + } + + .sectionTitle0 { + fill: ${t.titleColor}; + } + + .sectionTitle1 { + fill: ${t.titleColor}; + } + + .sectionTitle2 { + fill: ${t.titleColor}; + } + + .sectionTitle3 { + fill: ${t.titleColor}; + } + + .sectionTitle { + text-anchor: start; + font-family: ${t.fontFamily}; + } + + + /* Grid and axis */ + + .grid .tick { + stroke: ${t.gridColor}; + opacity: 0.8; + shape-rendering: crispEdges; + } + + .grid .tick text { + font-family: ${t.fontFamily}; + fill: ${t.textColor}; + } + + .grid path { + stroke-width: 0; + } + + + /* Today line */ + + .today { + fill: none; + stroke: ${t.todayLineColor}; + stroke-width: 2px; + } + + + /* Task styling */ + + /* Default task */ + + .task { + stroke-width: 2; + } + + .taskText { + text-anchor: middle; + font-family: ${t.fontFamily}; + } + + .taskTextOutsideRight { + fill: ${t.taskTextDarkColor}; + text-anchor: start; + font-family: ${t.fontFamily}; + } + + .taskTextOutsideLeft { + fill: ${t.taskTextDarkColor}; + text-anchor: end; + } + + + /* Special case clickable */ + + .task.clickable { + cursor: pointer; + } + + .taskText.clickable { + cursor: pointer; + fill: ${t.taskTextClickableColor} !important; + font-weight: bold; + } + + .taskTextOutsideLeft.clickable { + cursor: pointer; + fill: ${t.taskTextClickableColor} !important; + font-weight: bold; + } + + .taskTextOutsideRight.clickable { + cursor: pointer; + fill: ${t.taskTextClickableColor} !important; + font-weight: bold; + } + + + /* Specific task settings for the sections*/ + + .taskText0, + .taskText1, + .taskText2, + .taskText3 { + fill: ${t.taskTextColor}; + } + + .task0, + .task1, + .task2, + .task3 { + fill: ${t.taskBkgColor}; + stroke: ${t.taskBorderColor}; + } + + .taskTextOutside0, + .taskTextOutside2 + { + fill: ${t.taskTextOutsideColor}; + } + + .taskTextOutside1, + .taskTextOutside3 { + fill: ${t.taskTextOutsideColor}; + } + + + /* Active task */ + + .active0, + .active1, + .active2, + .active3 { + fill: ${t.activeTaskBkgColor}; + stroke: ${t.activeTaskBorderColor}; + } + + .activeText0, + .activeText1, + .activeText2, + .activeText3 { + fill: ${t.taskTextDarkColor} !important; + } + + + /* Completed task */ + + .done0, + .done1, + .done2, + .done3 { + stroke: ${t.doneTaskBorderColor}; + fill: ${t.doneTaskBkgColor}; + stroke-width: 2; + } + + .doneText0, + .doneText1, + .doneText2, + .doneText3 { + fill: ${t.taskTextDarkColor} !important; + } + + + /* Tasks on the critical line */ + + .crit0, + .crit1, + .crit2, + .crit3 { + stroke: ${t.critBorderColor}; + fill: ${t.critBkgColor}; + stroke-width: 2; + } + + .activeCrit0, + .activeCrit1, + .activeCrit2, + .activeCrit3 { + stroke: ${t.critBorderColor}; + fill: ${t.activeTaskBkgColor}; + stroke-width: 2; + } + + .doneCrit0, + .doneCrit1, + .doneCrit2, + .doneCrit3 { + stroke: ${t.critBorderColor}; + fill: ${t.doneTaskBkgColor}; + stroke-width: 2; + cursor: pointer; + shape-rendering: crispEdges; + } + + .milestone { + transform: rotate(45deg) scale(0.8,0.8); + } + + .milestoneText { + font-style: italic; + } + .doneCritText0, + .doneCritText1, + .doneCritText2, + .doneCritText3 { + fill: ${t.taskTextDarkColor} !important; + } + + .vert { + stroke: ${t.vertLineColor}; + } + + .vertText { + font-size: 15px; + text-anchor: middle; + fill: ${t.vertLineColor} !important; + } + + .activeCritText0, + .activeCritText1, + .activeCritText2, + .activeCritText3 { + fill: ${t.taskTextDarkColor} !important; + } + + .titleText { + text-anchor: middle; + font-size: 18px; + fill: ${t.titleColor||t.textColor}; + font-family: ${t.fontFamily}; + } +`,"getStyles"),ti=Jr,di={parser:fr,db:Xr,renderer:Kr,styles:ti};export{di as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/geometry.fragment-Bfe87DXl.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/geometry.fragment-Bfe87DXl.js new file mode 100644 index 0000000000000000000000000000000000000000..d4b86e557c06d9b113c94e5f7dc210656f8c909f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/geometry.fragment-Bfe87DXl.js @@ -0,0 +1,171 @@ +import{S as i}from"./index-CDrXokXW.js";import"./clipPlaneFragment-C7XUrTAZ.js";import"./bumpFragment-BDPY2JKo.js";import"./helperFunctions-CZpZ-EbL.js";import"./index-DWyDLubb.js";import"./samplerFragmentDeclaration-cxB-jdDJ.js";const e="geometryPixelShader",f=`#ifdef BUMP +varying vWorldView0: vec4f;varying vWorldView1: vec4f;varying vWorldView2: vec4f;varying vWorldView3: vec4f;varying vNormalW: vec3f; +#else +varying vNormalV: vec3f; +#endif +varying vViewPos: vec4f; +#if defined(POSITION) || defined(BUMP) +varying vPositionW: vec3f; +#endif +#if defined(VELOCITY) || defined(VELOCITY_LINEAR) +varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f; +#endif +#ifdef NEED_UV +varying vUV: vec2f; +#endif +#ifdef BUMP +uniform vBumpInfos: vec3f;uniform vTangentSpaceParams: vec2f; +#endif +#if defined(REFLECTIVITY) +#if defined(ORMTEXTURE) || defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE) +var reflectivitySamplerSampler: sampler;var reflectivitySampler: texture_2d;varying vReflectivityUV: vec2f; +#else +#ifdef METALLIC_TEXTURE +var metallicSamplerSampler: sampler;var metallicSampler: texture_2d;varying vMetallicUV: vec2f; +#endif +#ifdef ROUGHNESS_TEXTURE +var roughnessSamplerSampler: sampler;var roughnessSampler: texture_2d;varying vRoughnessUV: vec2f; +#endif +#endif +#ifdef ALBEDOTEXTURE +varying vAlbedoUV: vec2f;var albedoSamplerSampler: sampler;var albedoSampler: texture_2d; +#endif +#ifdef REFLECTIVITYCOLOR +uniform reflectivityColor: vec3f; +#endif +#ifdef ALBEDOCOLOR +uniform albedoColor: vec3f; +#endif +#ifdef METALLIC +uniform metallic: f32; +#endif +#if defined(ROUGHNESS) || defined(GLOSSINESS) +uniform glossiness: f32; +#endif +#endif +#if defined(ALPHATEST) && defined(NEED_UV) +var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d; +#endif +#include +#include +#include +#include +@fragment +fn main(input: FragmentInputs)->FragmentOutputs { +#include +#ifdef ALPHATEST +if (textureSample(diffuseSampler,diffuseSamplerSampler,input.vUV).a<0.4) {discard;} +#endif +var normalOutput: vec3f; +#ifdef BUMP +var normalW: vec3f=normalize(input.vNormalW); +#include +#ifdef NORMAL_WORLDSPACE +normalOutput=normalW; +#else +normalOutput=normalize( (mat4x4f(input.vWorldView0,input.vWorldView1,input.vWorldView2,input.vWorldView3)* vec4f(normalW,0.0)).xyz); +#endif +#elif defined(HAS_NORMAL_ATTRIBUTE) +normalOutput=normalize(input.vNormalV); +#elif defined(POSITION) +normalOutput=normalize(-cross(dpdx(input.vPositionW),dpdy(input.vPositionW))); +#endif +#ifdef ENCODE_NORMAL +normalOutput=normalOutput*0.5+0.5; +#endif +var fragData: array,SCENE_MRT_COUNT>; +#ifdef DEPTH +fragData[DEPTH_INDEX]=vec4f(input.vViewPos.z/input.vViewPos.w,0.0,0.0,1.0); +#endif +#ifdef NORMAL +fragData[NORMAL_INDEX]=vec4f(normalOutput,1.0); +#endif +#ifdef SCREENSPACE_DEPTH +fragData[SCREENSPACE_DEPTH_INDEX]=vec4f(fragmentInputs.position.z,0.0,0.0,1.0); +#endif +#ifdef POSITION +fragData[POSITION_INDEX]= vec4f(input.vPositionW,1.0); +#endif +#ifdef VELOCITY +var a: vec2f=(input.vCurrentPosition.xy/input.vCurrentPosition.w)*0.5+0.5;var b: vec2f=(input.vPreviousPosition.xy/input.vPreviousPosition.w)*0.5+0.5;var velocity: vec2f=abs(a-b);velocity= vec2f(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;fragData[VELOCITY_INDEX]= vec4f(velocity,0.0,1.0); +#endif +#ifdef VELOCITY_LINEAR +var velocity : vec2f=vec2f(0.5)*((input.vPreviousPosition.xy / +input.vPreviousPosition.w) - +(input.vCurrentPosition.xy / +input.vCurrentPosition.w));fragData[VELOCITY_LINEAR_INDEX]=vec4f(velocity,0.0,1.0); +#endif +#ifdef REFLECTIVITY +var reflectivity: vec4f= vec4f(0.0,0.0,0.0,1.0); +#ifdef METALLICWORKFLOW +var metal: f32=1.0;var roughness: f32=1.0; +#ifdef ORMTEXTURE +metal*=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vReflectivityUV).b;roughness*=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vReflectivityUV).g; +#else +#ifdef METALLIC_TEXTURE +metal*=textureSample(metallicSampler,metallicSamplerSampler,input.vMetallicUV).r; +#endif +#ifdef ROUGHNESS_TEXTURE +roughness*=textureSample(roughnessSampler,roughnessSamplerSampler,input.vRoughnessUV).r; +#endif +#endif +#ifdef METALLIC +metal*=uniforms.metallic; +#endif +#ifdef ROUGHNESS +roughness*=(1.0-uniforms.glossiness); +#endif +reflectivity=vec4f(reflectivity.rgb,reflectivity.a-roughness);var color: vec3f= vec3f(1.0); +#ifdef ALBEDOTEXTURE +color=textureSample(albedoSampler,albedoSamplerSampler,input.vAlbedoUV).rgb; +#ifdef GAMMAALBEDO +color=toLinearSpaceVec4(color); +#endif +#endif +#ifdef ALBEDOCOLOR +color*=uniforms.albedoColor.xyz; +#endif +reflectivity=vec4f(mix( vec3f(0.04),color,metal),reflectivity.a); +#else +#if defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE) +reflectivity=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vReflectivityUV); +#ifdef GAMMAREFLECTIVITYTEXTURE +reflectivity=vec4f(toLinearSpaceVec3(reflectivity.rgb),reflectivity.a); +#endif +#else +#ifdef REFLECTIVITYCOLOR +reflectivity=vec4f(toLinearSpaceVec3(uniforms.reflectivityColor.xyz),1.0); +#endif +#endif +#ifdef GLOSSINESSS +reflectivity=vec4f(reflectivity.rgb,reflectivity.a*glossiness); +#endif +#endif +fragData[REFLECTIVITY_INDEX]=reflectivity; +#endif +#if SCENE_MRT_COUNT>0 +fragmentOutputs.fragData0=fragData[0]; +#endif +#if SCENE_MRT_COUNT>1 +fragmentOutputs.fragData1=fragData[1]; +#endif +#if SCENE_MRT_COUNT>2 +fragmentOutputs.fragData2=fragData[2]; +#endif +#if SCENE_MRT_COUNT>3 +fragmentOutputs.fragData3=fragData[3]; +#endif +#if SCENE_MRT_COUNT>4 +fragmentOutputs.fragData4=fragData[4]; +#endif +#if SCENE_MRT_COUNT>5 +fragmentOutputs.fragData5=fragData[5]; +#endif +#if SCENE_MRT_COUNT>6 +fragmentOutputs.fragData6=fragData[6]; +#endif +#if SCENE_MRT_COUNT>7 +fragmentOutputs.fragData7=fragData[7]; +#endif +} +`;i.ShadersStoreWGSL[e]||(i.ShadersStoreWGSL[e]=f);const d={name:e,shader:f};export{d as geometryPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/geometry.vertex-Da8ahDit.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/geometry.vertex-Da8ahDit.js new file mode 100644 index 0000000000000000000000000000000000000000..067bf6cf896bf04b3bff8fdb62febe182f23486b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/geometry.vertex-Da8ahDit.js @@ -0,0 +1,169 @@ +import{S as i}from"./index-CDrXokXW.js";import"./bonesDeclaration-Bh_c0MF7.js";import"./instancesVertex-CO_CTxxp.js";import"./morphTargetsVertexDeclaration-BsT9JpOT.js";import"./instancesDeclaration-DZdrWbmN.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./clipPlaneVertex-J3Krgsee.js";import"./morphTargetsVertex-DcRl6X3j.js";import"./bonesVertex-bl6LLSA1.js";import"./bakedVertexAnimation-DoavwM49.js";import"./bumpVertex-D9JGroSY.js";import"./index-DWyDLubb.js";const e="geometryVertexShader",t=`#include +#include +#include +#include[0..maxSimultaneousMorphTargets] +#include +#include +#include +attribute position: vec3f; +#ifdef HAS_NORMAL_ATTRIBUTE +attribute normal: vec3f; +#endif +#ifdef NEED_UV +varying vUV: vec2f; +#ifdef ALPHATEST +uniform diffuseMatrix: mat4x4f; +#endif +#ifdef BUMP +uniform bumpMatrix: mat4x4f;varying vBumpUV: vec2f; +#endif +#ifdef REFLECTIVITY +uniform reflectivityMatrix: mat4x4f;uniform albedoMatrix: mat4x4f;varying vReflectivityUV: vec2f;varying vAlbedoUV: vec2f; +#endif +#ifdef METALLIC_TEXTURE +varying vMetallicUV: vec2f;uniform metallicMatrix: mat4x4f; +#endif +#ifdef ROUGHNESS_TEXTURE +varying vRoughnessUV: vec2f;uniform roughnessMatrix: mat4x4f; +#endif +#ifdef UV1 +attribute uv: vec2f; +#endif +#ifdef UV2 +attribute uv2: vec2f; +#endif +#endif +#ifdef BUMP +varying vWorldView0: vec4f;varying vWorldView1: vec4f;varying vWorldView2: vec4f;varying vWorldView3: vec4f; +#endif +#ifdef BUMP +varying vNormalW: vec3f; +#else +varying vNormalV: vec3f; +#endif +varying vViewPos: vec4f; +#if defined(POSITION) || defined(BUMP) +varying vPositionW: vec3f; +#endif +#if defined(VELOCITY) || defined(VELOCITY_LINEAR) +uniform previousViewProjection: mat4x4f;varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f; +#endif +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position; +#ifdef HAS_NORMAL_ATTRIBUTE +var normalUpdated: vec3f=input.normal; +#else +var normalUpdated: vec3f=vec3f(0.0,0.0,0.0); +#endif +#ifdef UV1 +var uvUpdated: vec2f=input.uv; +#endif +#ifdef UV2 +var uv2Updated: vec2f=input.uv2; +#endif +#include +#include[0..maxSimultaneousMorphTargets] +#include +#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED) +vCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,1.0);vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld* vec4f(positionUpdated,1.0); +#endif +#include +#include +var worldPos: vec4f= vec4f(finalWorld* vec4f(positionUpdated,1.0)); +#ifdef BUMP +let vWorldView=scene.view*finalWorld;vertexOutputs.vWorldView0=vWorldView[0];vertexOutputs.vWorldView1=vWorldView[1];vertexOutputs.vWorldView2=vWorldView[2];vertexOutputs.vWorldView3=vWorldView[3];let normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);vertexOutputs.vNormalW=normalize(normalWorld*normalUpdated); +#else +#ifdef NORMAL_WORLDSPACE +vertexOutputs.vNormalV=normalize((finalWorld* vec4f(normalUpdated,0.0)).xyz); +#else +vertexOutputs.vNormalV=normalize(((scene.view*finalWorld)* vec4f(normalUpdated,0.0)).xyz); +#endif +#endif +vertexOutputs.vViewPos=scene.view*worldPos; +#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED) +vertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld* vec4f(positionUpdated,1.0); +#if NUM_BONE_INFLUENCERS>0 +var previousInfluence: mat4x4f;previousInfluence=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[0])]*vertexInputs.matricesWeights[0]; +#if NUM_BONE_INFLUENCERS>1 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[1])]*vertexInputs.matricesWeights[1]; +#endif +#if NUM_BONE_INFLUENCERS>2 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[2])]*vertexInputs.matricesWeights[2]; +#endif +#if NUM_BONE_INFLUENCERS>3 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[3])]*vertexInputs.matricesWeights[3]; +#endif +#if NUM_BONE_INFLUENCERS>4 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[0])]*vertexInputs.matricesWeightsExtra[0]; +#endif +#if NUM_BONE_INFLUENCERS>5 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[1])]*vertexInputs.matricesWeightsExtra[1]; +#endif +#if NUM_BONE_INFLUENCERS>6 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[2])]*vertexInputs.matricesWeightsExtra[2]; +#endif +#if NUM_BONE_INFLUENCERS>7 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[3])]*vertexInputs.matricesWeightsExtra[3]; +#endif +vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*previousInfluence* vec4f(positionUpdated,1.0); +#else +vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld* vec4f(positionUpdated,1.0); +#endif +#endif +#if defined(POSITION) || defined(BUMP) +vertexOutputs.vPositionW=worldPos.xyz/worldPos.w; +#endif +vertexOutputs.position=scene.viewProjection*finalWorld* vec4f(positionUpdated,1.0); +#include +#ifdef NEED_UV +#ifdef UV1 +#if defined(ALPHATEST) && defined(ALPHATEST_UV1) +vertexOutputs.vUV=(uniforms.diffuseMatrix* vec4f(uvUpdated,1.0,0.0)).xy; +#else +vertexOutputs.vUV=uvUpdated; +#endif +#ifdef BUMP_UV1 +vertexOutputs.vBumpUV=(uniforms.bumpMatrix* vec4f(uvUpdated,1.0,0.0)).xy; +#endif +#ifdef REFLECTIVITY_UV1 +vertexOutputs.vReflectivityUV=(uniforms.reflectivityMatrix* vec4f(uvUpdated,1.0,0.0)).xy; +#else +#ifdef METALLIC_UV1 +vertexOutputs.vMetallicUV=(uniforms.metallicMatrix* vec4f(uvUpdated,1.0,0.0)).xy; +#endif +#ifdef ROUGHNESS_UV1 +vertexOutputs.vRoughnessUV=(uniforms.roughnessMatrix* vec4f(uvUpdated,1.0,0.0)).xy; +#endif +#endif +#ifdef ALBEDO_UV1 +vertexOutputs.vAlbedoUV=(uniforms.albedoMatrix* vec4f(uvUpdated,1.0,0.0)).xy; +#endif +#endif +#ifdef UV2 +#if defined(ALPHATEST) && defined(ALPHATEST_UV2) +vertexOutputs.vUV=(uniforms.diffuseMatrix* vec4f(uv2Updated,1.0,0.0)).xy; +#else +vertexOutputs.vUV=uv2Updated; +#endif +#ifdef BUMP_UV2 +vertexOutputs.vBumpUV=(uniforms.bumpMatrix* vec4f(uv2Updated,1.0,0.0)).xy; +#endif +#ifdef REFLECTIVITY_UV2 +vertexOutputs.vReflectivityUV=(uniforms.reflectivityMatrix* vec4f(uv2Updated,1.0,0.0)).xy; +#else +#ifdef METALLIC_UV2 +vertexOutputs.vMetallicUV=(uniforms.metallicMatrix* vec4f(uv2Updated,1.0,0.0)).xy; +#endif +#ifdef ROUGHNESS_UV2 +vertexOutputs.vRoughnessUV=(uniforms.roughnessMatrix* vec4f(uv2Updated,1.0,0.0)).xy; +#endif +#endif +#ifdef ALBEDO_UV2 +vertexOutputs.vAlbedoUV=(uniforms.albedoMatrix* vec4f(uv2Updated,1.0,0.0)).xy; +#endif +#endif +#endif +#include +} +`;i.ShadersStoreWGSL[e]||(i.ShadersStoreWGSL[e]=t);const m={name:e,shader:t};export{m as geometryVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/geometryBufferRenderer-GNaIIBSt.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/geometryBufferRenderer-GNaIIBSt.js new file mode 100644 index 0000000000000000000000000000000000000000..a7df8becb6cdb39e349a00608944f7b9fb924a86 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/geometryBufferRenderer-GNaIIBSt.js @@ -0,0 +1,325 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./geometry.vertex-Da8ahDit.js","./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./bonesDeclaration-Bh_c0MF7.js","./instancesVertex-CO_CTxxp.js","./morphTargetsVertexDeclaration-BsT9JpOT.js","./instancesDeclaration-DZdrWbmN.js","./sceneUboDeclaration-BH1tZjjY.js","./clipPlaneVertex-J3Krgsee.js","./morphTargetsVertex-DcRl6X3j.js","./bonesVertex-bl6LLSA1.js","./bakedVertexAnimation-DoavwM49.js","./bumpVertex-D9JGroSY.js","./geometry.fragment-Bfe87DXl.js","./clipPlaneFragment-C7XUrTAZ.js","./bumpFragment-BDPY2JKo.js","./samplerFragmentDeclaration-cxB-jdDJ.js","./helperFunctions-CZpZ-EbL.js"])))=>i.map(i=>d[i]); +import{af as O}from"./index-DWyDLubb.js";import{S as E,b9 as D,J as p,a7 as F,b3 as z,b2 as G,b4 as j,bz as $,T as W,M as K,b5 as q,a2 as J,a5 as Q,o as N,Y as Z,be as ee}from"./index-CDrXokXW.js";import"./clipPlaneFragment-T8W7CIC5.js";import"./bumpFragment-CNMCo4HD.js";import"./helperFunctions-BkWNqKeI.js";import"./bakedVertexAnimation-BwUJBnNt.js";import"./morphTargetsVertex-7Q90Wwr8.js";import"./instancesDeclaration-BAnfKLCo.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./clipPlaneVertex-Bmw4TNCQ.js";import"./bumpVertex-B5e3s1jQ.js";const B="mrtFragmentDeclaration",te=`#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) +layout(location=0) out vec4 glFragData[{X}]; +#endif +`;E.IncludesShadersStore[B]||(E.IncludesShadersStore[B]=te);const A="geometryPixelShader",w=`#extension GL_EXT_draw_buffers : require +#if defined(BUMP) || !defined(NORMAL) +#extension GL_OES_standard_derivatives : enable +#endif +precision highp float; +#ifdef BUMP +varying mat4 vWorldView;varying vec3 vNormalW; +#else +varying vec3 vNormalV; +#endif +varying vec4 vViewPos; +#if defined(POSITION) || defined(BUMP) +varying vec3 vPositionW; +#endif +#if defined(VELOCITY) || defined(VELOCITY_LINEAR) +varying vec4 vCurrentPosition;varying vec4 vPreviousPosition; +#endif +#ifdef NEED_UV +varying vec2 vUV; +#endif +#ifdef BUMP +uniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams; +#endif +#if defined(REFLECTIVITY) +#if defined(ORMTEXTURE) || defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE) +uniform sampler2D reflectivitySampler;varying vec2 vReflectivityUV; +#else +#ifdef METALLIC_TEXTURE +uniform sampler2D metallicSampler;varying vec2 vMetallicUV; +#endif +#ifdef ROUGHNESS_TEXTURE +uniform sampler2D roughnessSampler;varying vec2 vRoughnessUV; +#endif +#endif +#ifdef ALBEDOTEXTURE +varying vec2 vAlbedoUV;uniform sampler2D albedoSampler; +#endif +#ifdef REFLECTIVITYCOLOR +uniform vec3 reflectivityColor; +#endif +#ifdef ALBEDOCOLOR +uniform vec3 albedoColor; +#endif +#ifdef METALLIC +uniform float metallic; +#endif +#if defined(ROUGHNESS) || defined(GLOSSINESS) +uniform float glossiness; +#endif +#endif +#if defined(ALPHATEST) && defined(NEED_UV) +uniform sampler2D diffuseSampler; +#endif +#include +#include[SCENE_MRT_COUNT] +#include +#include +#include +void main() { +#include +#ifdef ALPHATEST +if (texture2D(diffuseSampler,vUV).a<0.4) +discard; +#endif +vec3 normalOutput; +#ifdef BUMP +vec3 normalW=normalize(vNormalW); +#include +#ifdef NORMAL_WORLDSPACE +normalOutput=normalW; +#else +normalOutput=normalize(vec3(vWorldView*vec4(normalW,0.0))); +#endif +#elif defined(HAS_NORMAL_ATTRIBUTE) +normalOutput=normalize(vNormalV); +#elif defined(POSITION) +normalOutput=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW))); +#endif +#ifdef ENCODE_NORMAL +normalOutput=normalOutput*0.5+0.5; +#endif +#ifdef DEPTH +gl_FragData[DEPTH_INDEX]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0); +#endif +#ifdef NORMAL +gl_FragData[NORMAL_INDEX]=vec4(normalOutput,1.0); +#endif +#ifdef SCREENSPACE_DEPTH +gl_FragData[SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,1.0); +#endif +#ifdef POSITION +gl_FragData[POSITION_INDEX]=vec4(vPositionW,1.0); +#endif +#ifdef VELOCITY +vec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0); +#endif +#ifdef VELOCITY_LINEAR +vec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w) - +(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,1.0); +#endif +#ifdef REFLECTIVITY +vec4 reflectivity=vec4(0.0,0.0,0.0,1.0); +#ifdef METALLICWORKFLOW +float metal=1.0;float roughness=1.0; +#ifdef ORMTEXTURE +metal*=texture2D(reflectivitySampler,vReflectivityUV).b;roughness*=texture2D(reflectivitySampler,vReflectivityUV).g; +#else +#ifdef METALLIC_TEXTURE +metal*=texture2D(metallicSampler,vMetallicUV).r; +#endif +#ifdef ROUGHNESS_TEXTURE +roughness*=texture2D(roughnessSampler,vRoughnessUV).r; +#endif +#endif +#ifdef METALLIC +metal*=metallic; +#endif +#ifdef ROUGHNESS +roughness*=(1.0-glossiness); +#endif +reflectivity.a-=roughness;vec3 color=vec3(1.0); +#ifdef ALBEDOTEXTURE +color=texture2D(albedoSampler,vAlbedoUV).rgb; +#ifdef GAMMAALBEDO +color=toLinearSpace(color); +#endif +#endif +#ifdef ALBEDOCOLOR +color*=albedoColor.xyz; +#endif +reflectivity.rgb=mix(vec3(0.04),color,metal); +#else +#if defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE) +reflectivity=texture2D(reflectivitySampler,vReflectivityUV); +#ifdef GAMMAREFLECTIVITYTEXTURE +reflectivity.rgb=toLinearSpace(reflectivity.rgb); +#endif +#else +#ifdef REFLECTIVITYCOLOR +reflectivity.rgb=toLinearSpace(reflectivityColor.xyz);reflectivity.a=1.0; +#endif +#endif +#ifdef GLOSSINESSS +reflectivity.a*=glossiness; +#endif +#endif +gl_FragData[REFLECTIVITY_INDEX]=reflectivity; +#endif +} +`;E.ShadersStore[A]||(E.ShadersStore[A]=w);const ie={name:A,shader:w},se=Object.freeze(Object.defineProperty({__proto__:null,geometryPixelShader:ie},Symbol.toStringTag,{value:"Module"})),Y="geometryVertexDeclaration",re="uniform mat4 viewProjection;uniform mat4 view;";E.IncludesShadersStore[Y]||(E.IncludesShadersStore[Y]=re);const X="geometryUboDeclaration",ne=`#include +`;E.IncludesShadersStore[X]||(E.IncludesShadersStore[X]=ne);const y="geometryVertexShader",H=`precision highp float; +#include +#include +#include +#include[0..maxSimultaneousMorphTargets] +#include +#include<__decl__geometryVertex> +#include +attribute vec3 position; +#ifdef HAS_NORMAL_ATTRIBUTE +attribute vec3 normal; +#endif +#ifdef NEED_UV +varying vec2 vUV; +#ifdef ALPHATEST +uniform mat4 diffuseMatrix; +#endif +#ifdef BUMP +uniform mat4 bumpMatrix;varying vec2 vBumpUV; +#endif +#ifdef REFLECTIVITY +uniform mat4 reflectivityMatrix;uniform mat4 albedoMatrix;varying vec2 vReflectivityUV;varying vec2 vAlbedoUV; +#endif +#ifdef METALLIC_TEXTURE +varying vec2 vMetallicUV;uniform mat4 metallicMatrix; +#endif +#ifdef ROUGHNESS_TEXTURE +varying vec2 vRoughnessUV;uniform mat4 roughnessMatrix; +#endif +#ifdef UV1 +attribute vec2 uv; +#endif +#ifdef UV2 +attribute vec2 uv2; +#endif +#endif +#ifdef BUMP +varying mat4 vWorldView; +#endif +#ifdef BUMP +varying vec3 vNormalW; +#else +varying vec3 vNormalV; +#endif +varying vec4 vViewPos; +#if defined(POSITION) || defined(BUMP) +varying vec3 vPositionW; +#endif +#if defined(VELOCITY) || defined(VELOCITY_LINEAR) +uniform mat4 previousViewProjection;varying vec4 vCurrentPosition;varying vec4 vPreviousPosition; +#endif +#define CUSTOM_VERTEX_DEFINITIONS +void main(void) +{vec3 positionUpdated=position; +#ifdef HAS_NORMAL_ATTRIBUTE +vec3 normalUpdated=normal; +#else +vec3 normalUpdated=vec3(0.0,0.0,0.0); +#endif +#ifdef UV1 +vec2 uvUpdated=uv; +#endif +#ifdef UV2 +vec2 uv2Updated=uv2; +#endif +#include +#include[0..maxSimultaneousMorphTargets] +#include +#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED) +vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0); +#endif +#include +#include +vec4 worldPos=vec4(finalWorld*vec4(positionUpdated,1.0)); +#ifdef BUMP +vWorldView=view*finalWorld;mat3 normalWorld=mat3(finalWorld);vNormalW=normalize(normalWorld*normalUpdated); +#else +#ifdef NORMAL_WORLDSPACE +vNormalV=normalize(vec3(finalWorld*vec4(normalUpdated,0.0))); +#else +vNormalV=normalize(vec3((view*finalWorld)*vec4(normalUpdated,0.0))); +#endif +#endif +vViewPos=view*worldPos; +#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED) +vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0); +#if NUM_BONE_INFLUENCERS>0 +mat4 previousInfluence;previousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0]; +#if NUM_BONE_INFLUENCERS>1 +previousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1]; +#endif +#if NUM_BONE_INFLUENCERS>2 +previousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2]; +#endif +#if NUM_BONE_INFLUENCERS>3 +previousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3]; +#endif +#if NUM_BONE_INFLUENCERS>4 +previousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0]; +#endif +#if NUM_BONE_INFLUENCERS>5 +previousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1]; +#endif +#if NUM_BONE_INFLUENCERS>6 +previousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2]; +#endif +#if NUM_BONE_INFLUENCERS>7 +previousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3]; +#endif +vPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0); +#else +vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0); +#endif +#endif +#if defined(POSITION) || defined(BUMP) +vPositionW=worldPos.xyz/worldPos.w; +#endif +gl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0); +#include +#ifdef NEED_UV +#ifdef UV1 +#if defined(ALPHATEST) && defined(ALPHATEST_UV1) +vUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0)); +#else +vUV=uvUpdated; +#endif +#ifdef BUMP_UV1 +vBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0)); +#endif +#ifdef REFLECTIVITY_UV1 +vReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0)); +#else +#ifdef METALLIC_UV1 +vMetallicUV=vec2(metallicMatrix*vec4(uvUpdated,1.0,0.0)); +#endif +#ifdef ROUGHNESS_UV1 +vRoughnessUV=vec2(roughnessMatrix*vec4(uvUpdated,1.0,0.0)); +#endif +#endif +#ifdef ALBEDO_UV1 +vAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0)); +#endif +#endif +#ifdef UV2 +#if defined(ALPHATEST) && defined(ALPHATEST_UV2) +vUV=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0)); +#else +vUV=uv2Updated; +#endif +#ifdef BUMP_UV2 +vBumpUV=vec2(bumpMatrix*vec4(uv2Updated,1.0,0.0)); +#endif +#ifdef REFLECTIVITY_UV2 +vReflectivityUV=vec2(reflectivityMatrix*vec4(uv2Updated,1.0,0.0)); +#else +#ifdef METALLIC_UV2 +vMetallicUV=vec2(metallicMatrix*vec4(uv2Updated,1.0,0.0)); +#endif +#ifdef ROUGHNESS_UV2 +vRoughnessUV=vec2(roughnessMatrix*vec4(uv2Updated,1.0,0.0)); +#endif +#endif +#ifdef ALBEDO_UV2 +vAlbedoUV=vec2(albedoMatrix*vec4(uv2Updated,1.0,0.0)); +#endif +#endif +#endif +#include +} +`;E.ShadersStore[y]||(E.ShadersStore[y]=H);const ae={name:y,shader:H},le=Object.freeze(Object.defineProperty({__proto__:null,geometryVertexShader:ae},Symbol.toStringTag,{value:"Module"})),k=["world","mBones","viewProjection","diffuseMatrix","view","previousWorld","previousViewProjection","mPreviousBones","bumpMatrix","reflectivityMatrix","albedoMatrix","reflectivityColor","albedoColor","metallic","glossiness","vTangentSpaceParams","vBumpInfos","morphTargetInfluences","morphTargetCount","morphTargetTextureInfo","morphTargetTextureIndices","boneTextureWidth"];Z(k);class l{get normalsAreUnsigned(){return this._normalsAreUnsigned}_linkPrePassRenderer(t){this._linkedWithPrePass=!0,this._prePassRenderer=t,this._multiRenderTarget&&(this._multiRenderTarget.onClearObservable.clear(),this._multiRenderTarget.onClearObservable.add(()=>{}))}_unlinkPrePassRenderer(){this._linkedWithPrePass=!1,this._createRenderTargets()}_resetLayout(){this._enableDepth=!0,this._enableNormal=!0,this._enablePosition=!1,this._enableReflectivity=!1,this._enableVelocity=!1,this._enableVelocityLinear=!1,this._enableScreenspaceDepth=!1,this._attachmentsFromPrePass=[]}_forceTextureType(t,u){t===l.POSITION_TEXTURE_TYPE?(this._positionIndex=u,this._enablePosition=!0):t===l.VELOCITY_TEXTURE_TYPE?(this._velocityIndex=u,this._enableVelocity=!0):t===l.VELOCITY_LINEAR_TEXTURE_TYPE?(this._velocityLinearIndex=u,this._enableVelocityLinear=!0):t===l.REFLECTIVITY_TEXTURE_TYPE?(this._reflectivityIndex=u,this._enableReflectivity=!0):t===l.DEPTH_TEXTURE_TYPE?(this._depthIndex=u,this._enableDepth=!0):t===l.NORMAL_TEXTURE_TYPE?(this._normalIndex=u,this._enableNormal=!0):t===l.SCREENSPACE_DEPTH_TEXTURE_TYPE&&(this._screenspaceDepthIndex=u,this._enableScreenspaceDepth=!0)}_setAttachments(t){this._attachmentsFromPrePass=t}_linkInternalTexture(t){this._multiRenderTarget.setInternalTexture(t,0,!1)}get renderList(){return this._multiRenderTarget.renderList}set renderList(t){this._multiRenderTarget.renderList=t}get isSupported(){return this._multiRenderTarget.isSupported}getTextureIndex(t){switch(t){case l.POSITION_TEXTURE_TYPE:return this._positionIndex;case l.VELOCITY_TEXTURE_TYPE:return this._velocityIndex;case l.VELOCITY_LINEAR_TEXTURE_TYPE:return this._velocityLinearIndex;case l.REFLECTIVITY_TEXTURE_TYPE:return this._reflectivityIndex;case l.DEPTH_TEXTURE_TYPE:return this._depthIndex;case l.NORMAL_TEXTURE_TYPE:return this._normalIndex;case l.SCREENSPACE_DEPTH_TEXTURE_TYPE:return this._screenspaceDepthIndex;default:return-1}}get enableDepth(){return this._enableDepth}set enableDepth(t){this._enableDepth=t,this._linkedWithPrePass||(this.dispose(),this._createRenderTargets())}get enableNormal(){return this._enableNormal}set enableNormal(t){this._enableNormal=t,this._linkedWithPrePass||(this.dispose(),this._createRenderTargets())}get enablePosition(){return this._enablePosition}set enablePosition(t){this._enablePosition=t,this._linkedWithPrePass||(this.dispose(),this._createRenderTargets())}get enableVelocity(){return this._enableVelocity}set enableVelocity(t){this._enableVelocity=t,t||(this._previousTransformationMatrices={}),this._linkedWithPrePass||(this.dispose(),this._createRenderTargets()),this._scene.needsPreviousWorldMatrices=t}get enableVelocityLinear(){return this._enableVelocityLinear}set enableVelocityLinear(t){this._enableVelocityLinear=t,this._linkedWithPrePass||(this.dispose(),this._createRenderTargets())}get enableReflectivity(){return this._enableReflectivity}set enableReflectivity(t){this._enableReflectivity=t,this._linkedWithPrePass||(this.dispose(),this._createRenderTargets())}get enableScreenspaceDepth(){return this._enableScreenspaceDepth}set enableScreenspaceDepth(t){this._enableScreenspaceDepth=t,this._linkedWithPrePass||(this.dispose(),this._createRenderTargets())}get scene(){return this._scene}get ratio(){return typeof this._ratioOrDimensions=="object"?1:this._ratioOrDimensions}get shaderLanguage(){return this._shaderLanguage}constructor(t,u=1,i=15,e){this._previousTransformationMatrices={},this._previousBonesTransformationMatrices={},this.excludedSkinnedMeshesFromVelocity=[],this.renderTransparentMeshes=!0,this.generateNormalsInWorldSpace=!1,this._normalsAreUnsigned=!1,this._resizeObserver=null,this._enableDepth=!0,this._enableNormal=!0,this._enablePosition=!1,this._enableVelocity=!1,this._enableVelocityLinear=!1,this._enableReflectivity=!1,this._enableScreenspaceDepth=!1,this._clearColor=new D(0,0,0,0),this._clearDepthColor=new D(0,0,0,1),this._positionIndex=-1,this._velocityIndex=-1,this._velocityLinearIndex=-1,this._reflectivityIndex=-1,this._depthIndex=-1,this._normalIndex=-1,this._screenspaceDepthIndex=-1,this._linkedWithPrePass=!1,this.useSpecificClearForDepthTexture=!1,this._shaderLanguage=0,this._shadersLoaded=!1,this._scene=t,this._ratioOrDimensions=u,this._useUbo=t.getEngine().supportsUniformBuffers,this._depthFormat=i,this._textureTypesAndFormats=e||{},this._initShaderSourceAsync(),l._SceneComponentInitialization(this._scene),this._createRenderTargets()}async _initShaderSourceAsync(){this._scene.getEngine().isWebGPU&&!l.ForceGLSL?(this._shaderLanguage=1,await Promise.all([O(()=>import("./geometry.vertex-Da8ahDit.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url),O(()=>import("./geometry.fragment-Bfe87DXl.js"),__vite__mapDeps([14,1,2,3,15,16,17,18]),import.meta.url)])):await Promise.all([O(()=>Promise.resolve().then(()=>le),void 0,import.meta.url),O(()=>Promise.resolve().then(()=>se),void 0,import.meta.url)]),this._shadersLoaded=!0}isReady(t,u){if(!this._shadersLoaded)return!1;const i=t.getMaterial();if(i&&i.disableDepthWrite)return!1;const e=[],h=[p.PositionKind],c=t.getMesh();c.isVerticesDataPresent(p.NormalKind)&&(e.push("#define HAS_NORMAL_ATTRIBUTE"),h.push(p.NormalKind));let g=!1,R=!1;const S=!1;if(i){let n=!1;if(i.needAlphaTestingForMesh(c)&&i.getAlphaTestTexture()&&(e.push("#define ALPHATEST"),e.push(`#define ALPHATEST_UV${i.getAlphaTestTexture().coordinatesIndex+1}`),n=!0),(i.bumpTexture||i.normalTexture||i.geometryNormalTexture)&&F.BumpTextureEnabled){const a=i.bumpTexture||i.normalTexture||i.geometryNormalTexture;e.push("#define BUMP"),e.push(`#define BUMP_UV${a.coordinatesIndex+1}`),n=!0}if(this._enableReflectivity){let a=!1;if(i.getClassName()==="PBRMetallicRoughnessMaterial")i.metallicRoughnessTexture&&(e.push("#define ORMTEXTURE"),e.push(`#define REFLECTIVITY_UV${i.metallicRoughnessTexture.coordinatesIndex+1}`),e.push("#define METALLICWORKFLOW"),n=!0,a=!0),i.metallic!=null&&(e.push("#define METALLIC"),e.push("#define METALLICWORKFLOW"),a=!0),i.roughness!=null&&(e.push("#define ROUGHNESS"),e.push("#define METALLICWORKFLOW"),a=!0),a&&(i.baseTexture&&(e.push("#define ALBEDOTEXTURE"),e.push(`#define ALBEDO_UV${i.baseTexture.coordinatesIndex+1}`),i.baseTexture.gammaSpace&&e.push("#define GAMMAALBEDO"),n=!0),i.baseColor&&e.push("#define ALBEDOCOLOR"));else if(i.getClassName()==="PBRSpecularGlossinessMaterial")i.specularGlossinessTexture?(e.push("#define SPECULARGLOSSINESSTEXTURE"),e.push(`#define REFLECTIVITY_UV${i.specularGlossinessTexture.coordinatesIndex+1}`),n=!0,i.specularGlossinessTexture.gammaSpace&&e.push("#define GAMMAREFLECTIVITYTEXTURE")):i.specularColor&&e.push("#define REFLECTIVITYCOLOR"),i.glossiness!=null&&e.push("#define GLOSSINESS");else if(i.getClassName()==="PBRMaterial")i.metallicTexture&&(e.push("#define ORMTEXTURE"),e.push(`#define REFLECTIVITY_UV${i.metallicTexture.coordinatesIndex+1}`),e.push("#define METALLICWORKFLOW"),n=!0,a=!0),i.metallic!=null&&(e.push("#define METALLIC"),e.push("#define METALLICWORKFLOW"),a=!0),i.roughness!=null&&(e.push("#define ROUGHNESS"),e.push("#define METALLICWORKFLOW"),a=!0),a?(i.albedoTexture&&(e.push("#define ALBEDOTEXTURE"),e.push(`#define ALBEDO_UV${i.albedoTexture.coordinatesIndex+1}`),i.albedoTexture.gammaSpace&&e.push("#define GAMMAALBEDO"),n=!0),i.albedoColor&&e.push("#define ALBEDOCOLOR")):(i.reflectivityTexture?(e.push("#define SPECULARGLOSSINESSTEXTURE"),e.push(`#define REFLECTIVITY_UV${i.reflectivityTexture.coordinatesIndex+1}`),i.reflectivityTexture.gammaSpace&&e.push("#define GAMMAREFLECTIVITYTEXTURE"),n=!0):i.reflectivityColor&&e.push("#define REFLECTIVITYCOLOR"),i.microSurface!=null&&e.push("#define GLOSSINESS"));else if(i.getClassName()==="StandardMaterial")i.specularTexture&&(e.push("#define REFLECTIVITYTEXTURE"),e.push(`#define REFLECTIVITY_UV${i.specularTexture.coordinatesIndex+1}`),i.specularTexture.gammaSpace&&e.push("#define GAMMAREFLECTIVITYTEXTURE"),n=!0),i.specularColor&&e.push("#define REFLECTIVITYCOLOR");else if(i.getClassName()==="OpenPBRMaterial"){const d=i;e.push("#define METALLICWORKFLOW"),a=!0,e.push("#define METALLIC"),e.push("#define ROUGHNESS"),d._useRoughnessFromMetallicTextureGreen&&d.baseMetalnessTexture?(e.push("#define ORMTEXTURE"),e.push(`#define REFLECTIVITY_UV${d.baseMetalnessTexture.coordinatesIndex+1}`),n=!0):d.baseMetalnessTexture?(e.push("#define METALLIC_TEXTURE"),e.push(`#define METALLIC_UV${d.baseMetalnessTexture.coordinatesIndex+1}`),n=!0):d.specularRoughnessTexture&&(e.push("#define ROUGHNESS_TEXTURE"),e.push(`#define ROUGHNESS_UV${d.specularRoughnessTexture.coordinatesIndex+1}`),n=!0),d.baseColorTexture&&(e.push("#define ALBEDOTEXTURE"),e.push(`#define ALBEDO_UV${d.baseColorTexture.coordinatesIndex+1}`),d.baseColorTexture.gammaSpace&&e.push("#define GAMMAALBEDO"),n=!0),d.baseColor&&e.push("#define ALBEDOCOLOR")}}n&&(e.push("#define NEED_UV"),c.isVerticesDataPresent(p.UVKind)&&(h.push(p.UVKind),e.push("#define UV1"),g=!0),c.isVerticesDataPresent(p.UV2Kind)&&(h.push(p.UV2Kind),e.push("#define UV2"),R=!0))}this._enableDepth&&(e.push("#define DEPTH"),e.push("#define DEPTH_INDEX "+this._depthIndex)),this._enableNormal&&(e.push("#define NORMAL"),e.push("#define NORMAL_INDEX "+this._normalIndex)),this._enablePosition&&(e.push("#define POSITION"),e.push("#define POSITION_INDEX "+this._positionIndex)),this._enableVelocity&&(e.push("#define VELOCITY"),e.push("#define VELOCITY_INDEX "+this._velocityIndex),this.excludedSkinnedMeshesFromVelocity.indexOf(c)===-1&&e.push("#define BONES_VELOCITY_ENABLED")),this._enableVelocityLinear&&(e.push("#define VELOCITY_LINEAR"),e.push("#define VELOCITY_LINEAR_INDEX "+this._velocityLinearIndex),this.excludedSkinnedMeshesFromVelocity.indexOf(c)===-1&&e.push("#define BONES_VELOCITY_ENABLED")),this._enableReflectivity&&(e.push("#define REFLECTIVITY"),e.push("#define REFLECTIVITY_INDEX "+this._reflectivityIndex)),this._enableScreenspaceDepth&&this._screenspaceDepthIndex!==-1&&(e.push("#define SCREENSPACE_DEPTH_INDEX "+this._screenspaceDepthIndex),e.push("#define SCREENSPACE_DEPTH")),this.generateNormalsInWorldSpace&&e.push("#define NORMAL_WORLDSPACE"),this._normalsAreUnsigned&&e.push("#define ENCODE_NORMAL"),c.useBones&&c.computeBonesUsingShaders&&c.skeleton?(h.push(p.MatricesIndicesKind),h.push(p.MatricesWeightsKind),c.numBoneInfluencers>4&&(h.push(p.MatricesIndicesExtraKind),h.push(p.MatricesWeightsExtraKind)),e.push("#define NUM_BONE_INFLUENCERS "+c.numBoneInfluencers),e.push("#define BONETEXTURE "+c.skeleton.isUsingTextureForMatrices),e.push("#define BonesPerMesh "+(c.skeleton.bones.length+1))):(e.push("#define NUM_BONE_INFLUENCERS 0"),e.push("#define BONETEXTURE false"),e.push("#define BonesPerMesh 0"));const U=c.morphTargetManager?z(c.morphTargetManager,e,h,c,!0,!0,!1,g,R,S):0;u&&(e.push("#define INSTANCES"),G(h,this._enableVelocity||this._enableVelocityLinear),t.getRenderingMesh().hasThinInstances&&e.push("#define THIN_INSTANCES")),this._linkedWithPrePass?e.push("#define SCENE_MRT_COUNT "+this._attachmentsFromPrePass.length):e.push("#define SCENE_MRT_COUNT "+this._multiRenderTarget.textures.length),j(i,this._scene,e);const L=this._scene.getEngine(),M=t._getDrawWrapper(void 0,!0),C=M.defines,_=e.join(` +`);return C!==_&&M.setEffect(L.createEffect("geometry",{attributes:h,uniformsNames:k,samplers:["diffuseSampler","bumpSampler","reflectivitySampler","albedoSampler","morphTargets","boneSampler"],defines:_,onCompiled:null,fallbacks:null,onError:null,uniformBuffersNames:["Scene"],indexParameters:{buffersCount:this._multiRenderTarget.textures.length-1,maxSimultaneousMorphTargets:U},shaderLanguage:this.shaderLanguage},L),_),M.effect.isReady()}getGBuffer(){return this._multiRenderTarget}get samples(){return this._multiRenderTarget.samples}set samples(t){this._multiRenderTarget.samples=t}dispose(){this._resizeObserver&&(this._scene.getEngine().onResizeObservable.remove(this._resizeObserver),this._resizeObserver=null),this.getGBuffer().dispose()}_assignRenderTargetIndices(){const t=[],u=[];let i=0;return this._enableDepth&&(this._depthIndex=i,i++,t.push("gBuffer_Depth"),u.push(this._textureTypesAndFormats[l.DEPTH_TEXTURE_TYPE])),this._enableNormal&&(this._normalIndex=i,i++,t.push("gBuffer_Normal"),u.push(this._textureTypesAndFormats[l.NORMAL_TEXTURE_TYPE])),this._enablePosition&&(this._positionIndex=i,i++,t.push("gBuffer_Position"),u.push(this._textureTypesAndFormats[l.POSITION_TEXTURE_TYPE])),this._enableVelocity&&(this._velocityIndex=i,i++,t.push("gBuffer_Velocity"),u.push(this._textureTypesAndFormats[l.VELOCITY_TEXTURE_TYPE])),this._enableVelocityLinear&&(this._velocityLinearIndex=i,i++,t.push("gBuffer_VelocityLinear"),u.push(this._textureTypesAndFormats[l.VELOCITY_LINEAR_TEXTURE_TYPE])),this._enableReflectivity&&(this._reflectivityIndex=i,i++,t.push("gBuffer_Reflectivity"),u.push(this._textureTypesAndFormats[l.REFLECTIVITY_TEXTURE_TYPE])),this._enableScreenspaceDepth&&(this._screenspaceDepthIndex=i,i++,t.push("gBuffer_ScreenspaceDepth"),u.push(this._textureTypesAndFormats[l.SCREENSPACE_DEPTH_TEXTURE_TYPE])),[i,t,u]}_createRenderTargets(){const t=this._scene.getEngine(),[u,i,e]=this._assignRenderTargetIndices();let h=0;t._caps.textureFloat&&t._caps.textureFloatLinearFiltering?h=1:t._caps.textureHalfFloat&&t._caps.textureHalfFloatLinearFiltering&&(h=2);const c=this._ratioOrDimensions.width!==void 0?this._ratioOrDimensions:{width:t.getRenderWidth()*this._ratioOrDimensions,height:t.getRenderHeight()*this._ratioOrDimensions},v=[],g=[];for(const n of e)n?(v.push(n.textureType),g.push(n.textureFormat)):(v.push(h),g.push(5));if(this._normalsAreUnsigned=v[l.NORMAL_TEXTURE_TYPE]===11||v[l.NORMAL_TEXTURE_TYPE]===13,this._multiRenderTarget=new $("gBuffer",c,u,this._scene,{generateMipMaps:!1,generateDepthTexture:!0,types:v,formats:g,depthTextureFormat:this._depthFormat},i.concat("gBuffer_DepthBuffer")),!this.isSupported)return;this._multiRenderTarget.wrapU=W.CLAMP_ADDRESSMODE,this._multiRenderTarget.wrapV=W.CLAMP_ADDRESSMODE,this._multiRenderTarget.refreshRate=1,this._multiRenderTarget.renderParticles=!1,this._multiRenderTarget.renderList=null;const R=[!0],S=[!1],U=[!0];for(let n=1;n{n.bindAttachments(this.useSpecificClearForDepthTexture?M:L),n.clear(this._clearColor,!0,!0,!0),this.useSpecificClearForDepthTexture&&(n.bindAttachments(C),n.clear(this._clearDepthColor,!0,!0,!0)),n.bindAttachments(L)}),this._resizeObserver=t.onResizeObservable.add(()=>{if(this._multiRenderTarget){const n=this._ratioOrDimensions.width!==void 0?this._ratioOrDimensions:{width:t.getRenderWidth()*this._ratioOrDimensions,height:t.getRenderHeight()*this._ratioOrDimensions};this._multiRenderTarget.resize(n)}});const _=n=>{const a=n.getRenderingMesh(),d=n.getEffectiveMesh(),T=this._scene,f=T.getEngine(),s=n.getMaterial();if(!s)return;if(d._internalAbstractMeshDataInfo._isActiveIntermediate=!1,(this._enableVelocity||this._enableVelocityLinear)&&!this._previousTransformationMatrices[d.uniqueId]&&(this._previousTransformationMatrices[d.uniqueId]={world:K.Identity(),viewProjection:T.getTransformMatrix()},a.skeleton)){const m=a.skeleton.getTransformMatrices(a);this._previousBonesTransformationMatrices[a.uniqueId]=this._copyBonesTransformationMatrices(m,new Float32Array(m.length))}const x=a._getInstancesRenderList(n._id,!!n.getReplacementMesh());if(x.mustReturn)return;const I=f.getCaps().instancedArrays&&(x.visibleInstances[n._id]!==null||a.hasThinInstances),b=d.getWorldMatrix();if(this.isReady(n,I)){const m=n._getDrawWrapper();if(!m)return;const r=m.effect;f.enableEffect(m),I||a._bind(n,r,s.fillMode),this._useUbo?(q(r,this._scene.getSceneUniformBuffer()),this._scene.finalizeSceneUbo()):(r.setMatrix("viewProjection",T.getTransformMatrix()),r.setMatrix("view",T.getViewMatrix()));let P;if(!a._instanceDataStorage.isFrozen&&(s.backFaceCulling||s.sideOrientation!==null)){const o=d._getWorldMatrixDeterminant();P=s._getEffectiveOrientation(a),o<0&&(P=P===N.ClockWiseSideOrientation?N.CounterClockWiseSideOrientation:N.ClockWiseSideOrientation)}else P=a._effectiveSideOrientation;if(s._preBind(m,P),s.needAlphaTestingForMesh(d)){const o=s.getAlphaTestTexture();o&&(r.setTexture("diffuseSampler",o),r.setMatrix("diffuseMatrix",o.getTextureMatrix()))}if((s.bumpTexture||s.normalTexture||s.geometryNormalTexture)&&T.getEngine().getCaps().standardDerivatives&&F.BumpTextureEnabled){const o=s.bumpTexture||s.normalTexture||s.geometryNormalTexture;r.setFloat3("vBumpInfos",o.coordinatesIndex,1/o.level,s.parallaxScaleBias),r.setMatrix("bumpMatrix",o.getTextureMatrix()),r.setTexture("bumpSampler",o),r.setFloat2("vTangentSpaceParams",s.invertNormalMapX?-1:1,s.invertNormalMapY?-1:1)}if(this._enableReflectivity){if(s.getClassName()==="PBRMetallicRoughnessMaterial")s.metallicRoughnessTexture!==null&&(r.setTexture("reflectivitySampler",s.metallicRoughnessTexture),r.setMatrix("reflectivityMatrix",s.metallicRoughnessTexture.getTextureMatrix())),s.metallic!==null&&r.setFloat("metallic",s.metallic),s.roughness!==null&&r.setFloat("glossiness",1-s.roughness),s.baseTexture!==null&&(r.setTexture("albedoSampler",s.baseTexture),r.setMatrix("albedoMatrix",s.baseTexture.getTextureMatrix())),s.baseColor!==null&&r.setColor3("albedoColor",s.baseColor);else if(s.getClassName()==="PBRSpecularGlossinessMaterial")s.specularGlossinessTexture!==null?(r.setTexture("reflectivitySampler",s.specularGlossinessTexture),r.setMatrix("reflectivityMatrix",s.specularGlossinessTexture.getTextureMatrix())):s.specularColor!==null&&r.setColor3("reflectivityColor",s.specularColor),s.glossiness!==null&&r.setFloat("glossiness",s.glossiness);else if(s.getClassName()==="PBRMaterial")s.metallicTexture!==null&&(r.setTexture("reflectivitySampler",s.metallicTexture),r.setMatrix("reflectivityMatrix",s.metallicTexture.getTextureMatrix())),s.metallic!==null&&r.setFloat("metallic",s.metallic),s.roughness!==null&&r.setFloat("glossiness",1-s.roughness),s.roughness!==null||s.metallic!==null||s.metallicTexture!==null?(s.albedoTexture!==null&&(r.setTexture("albedoSampler",s.albedoTexture),r.setMatrix("albedoMatrix",s.albedoTexture.getTextureMatrix())),s.albedoColor!==null&&r.setColor3("albedoColor",s.albedoColor)):(s.reflectivityTexture!==null?(r.setTexture("reflectivitySampler",s.reflectivityTexture),r.setMatrix("reflectivityMatrix",s.reflectivityTexture.getTextureMatrix())):s.reflectivityColor!==null&&r.setColor3("reflectivityColor",s.reflectivityColor),s.microSurface!==null&&r.setFloat("glossiness",s.microSurface));else if(s.getClassName()==="StandardMaterial")s.specularTexture!==null&&(r.setTexture("reflectivitySampler",s.specularTexture),r.setMatrix("reflectivityMatrix",s.specularTexture.getTextureMatrix())),s.specularColor!==null&&r.setColor3("reflectivityColor",s.specularColor);else if(s.getClassName()==="OpenPBRMaterial"){const o=s;o._useRoughnessFromMetallicTextureGreen&&o.baseMetalnessTexture?(r.setTexture("reflectivitySampler",o.baseMetalnessTexture),r.setMatrix("reflectivityMatrix",o.baseMetalnessTexture.getTextureMatrix())):o.baseMetalnessTexture?(r.setTexture("metallicSampler",o.baseMetalnessTexture),r.setMatrix("metallicMatrix",o.baseMetalnessTexture.getTextureMatrix())):o.specularRoughnessTexture&&(r.setTexture("roughnessSampler",o.specularRoughnessTexture),r.setMatrix("roughnessMatrix",o.specularRoughnessTexture.getTextureMatrix())),r.setFloat("metallic",o.baseMetalness),r.setFloat("glossiness",1-o.specularRoughness),o.baseColorTexture!==null&&(r.setTexture("albedoSampler",o.baseColorTexture),r.setMatrix("albedoMatrix",o.baseColorTexture.getTextureMatrix())),o.baseColor!==null&&r.setColor3("albedoColor",o.baseColor)}}if(J(r,s,this._scene),a.useBones&&a.computeBonesUsingShaders&&a.skeleton){const o=a.skeleton;if(o.isUsingTextureForMatrices&&r.getUniformIndex("boneTextureWidth")>-1){const V=o.getTransformMatrixTexture(a);r.setTexture("boneSampler",V),r.setFloat("boneTextureWidth",4*(o.bones.length+1))}else r.setMatrices("mBones",a.skeleton.getTransformMatrices(a));(this._enableVelocity||this._enableVelocityLinear)&&r.setMatrices("mPreviousBones",this._previousBonesTransformationMatrices[a.uniqueId])}Q(a,r),a.morphTargetManager&&a.morphTargetManager.isUsingTextureForTargets&&a.morphTargetManager._bind(r),(this._enableVelocity||this._enableVelocityLinear)&&(r.setMatrix("previousWorld",this._previousTransformationMatrices[d.uniqueId].world),r.setMatrix("previousViewProjection",this._previousTransformationMatrices[d.uniqueId].viewProjection)),I&&a.hasThinInstances&&r.setMatrix("world",b),a._processRendering(d,n,r,s.fillMode,x,I,(o,V)=>{o||r.setMatrix("world",V)})}(this._enableVelocity||this._enableVelocityLinear)&&(this._previousTransformationMatrices[d.uniqueId].world=b.clone(),this._previousTransformationMatrices[d.uniqueId].viewProjection=this._scene.getTransformMatrix().clone(),a.skeleton&&this._copyBonesTransformationMatrices(a.skeleton.getTransformMatrices(a),this._previousBonesTransformationMatrices[d.uniqueId]))};this._multiRenderTarget.customIsReadyFunction=(n,a,d)=>{if((d||a===0)&&n.subMeshes)for(let T=0;T{let f;if(this._linkedWithPrePass){if(!this._prePassRenderer.enabled)return;this._scene.getEngine().bindAttachments(this._attachmentsFromPrePass)}if(T.length){for(t.setColorWrite(!1),f=0;f{throw ee("GeometryBufferRendererSceneComponent")};export{l as G}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/geometryBufferRendererSceneComponent-BF80mcVG.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/geometryBufferRendererSceneComponent-BF80mcVG.js new file mode 100644 index 0000000000000000000000000000000000000000..ee006cfd07d7d0eeb832b6bab463b1aaf16a395c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/geometryBufferRendererSceneComponent-BF80mcVG.js @@ -0,0 +1 @@ +import{a as t,b as n}from"./index-CDrXokXW.js";import{G as o}from"./geometryBufferRenderer-GNaIIBSt.js";import"./index-DWyDLubb.js";import"./clipPlaneFragment-T8W7CIC5.js";import"./bumpFragment-CNMCo4HD.js";import"./helperFunctions-BkWNqKeI.js";import"./bakedVertexAnimation-BwUJBnNt.js";import"./morphTargetsVertex-7Q90Wwr8.js";import"./instancesDeclaration-BAnfKLCo.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./clipPlaneVertex-Bmw4TNCQ.js";import"./bumpVertex-B5e3s1jQ.js";Object.defineProperty(n.prototype,"geometryBufferRenderer",{get:function(){return this._geometryBufferRenderer},set:function(e){e&&e.isSupported&&(this._geometryBufferRenderer=e)},enumerable:!0,configurable:!0});n.prototype.enableGeometryBufferRenderer=function(e=1,r=15,i){return this._geometryBufferRenderer?this._geometryBufferRenderer:(this._geometryBufferRenderer=new o(this,e,r,i),this._geometryBufferRenderer.isSupported||(this._geometryBufferRenderer=null),this._geometryBufferRenderer)};n.prototype.disableGeometryBufferRenderer=function(){this._geometryBufferRenderer&&(this._geometryBufferRenderer.dispose(),this._geometryBufferRenderer=null)};class f{constructor(r){this.name=t.NAME_GEOMETRYBUFFERRENDERER,this.scene=r}register(){this.scene._gatherRenderTargetsStage.registerStep(t.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER,this,this._gatherRenderTargets)}rebuild(){}dispose(){}_gatherRenderTargets(r){this.scene._geometryBufferRenderer&&r.push(this.scene._geometryBufferRenderer.getGBuffer())}}o._SceneComponentInitialization=e=>{let r=e._getComponent(t.NAME_GEOMETRYBUFFERRENDERER);r||(r=new f(e),e._addComponent(r))};export{f as GeometryBufferRendererSceneComponent}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/gitGraphDiagram-NY62KEGX-BgYjZPZA.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/gitGraphDiagram-NY62KEGX-BgYjZPZA.js new file mode 100644 index 0000000000000000000000000000000000000000..a11c6d937e2ea6cbbf1963d75f762f1a0d3cd9b8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/gitGraphDiagram-NY62KEGX-BgYjZPZA.js @@ -0,0 +1,65 @@ +import{p as Y}from"./chunk-4BX2VUAB-Zuu4IE0p.js";import{I as K}from"./chunk-QZHKN3VN-DkLSlLbb.js";import{q as U,p as V,s as X,g as J,a as Q,b as Z,_ as l,l as m,u as rr,D as er,y as tr,j as C,E as ar,F as sr,G as nr,c as or,H as cr}from"./mermaid.core-7TB2QPZo.js";import{p as ir}from"./treemap-KMMF4GRG-B4w9v4mX.js";import{s as dr}from"./select-BigU4G0v.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";import"./min-ljrXhbfm.js";import"./_baseUniq-DT1kfcxk.js";var x={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},hr=sr.gitGraph,I=l(()=>ar({...hr,...nr().gitGraph}),"getConfig"),c=new K(()=>{const t=I(),r=t.mainBranchName,s=t.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:s}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function A(){return cr({length:7})}l(A,"getID");function F(t,r){const s=Object.create(null);return t.reduce((n,e)=>{const a=r(e);return s[a]||(s[a]=!0,n.push(e)),n},[])}l(F,"uniqBy");var lr=l(function(t){c.records.direction=t},"setDirection"),$r=l(function(t){m.debug("options str",t),t=t?.trim(),t=t||"{}";try{c.records.options=JSON.parse(t)}catch(r){m.error("error while parsing gitGraph options",r.message)}},"setOptions"),fr=l(function(){return c.records.options},"getOptions"),gr=l(function(t){let r=t.msg,s=t.id;const n=t.type;let e=t.tags;m.info("commit",r,s,n,e),m.debug("Entering commit:",r,s,n,e);const a=I();s=C.sanitizeText(s,a),r=C.sanitizeText(r,a),e=e?.map(o=>C.sanitizeText(o,a));const d={id:s||c.records.seq+"-"+A(),message:r,seq:c.records.seq++,type:n??x.NORMAL,tags:e??[],parents:c.records.head==null?[]:[c.records.head.id],branch:c.records.currBranch};c.records.head=d,m.info("main branch",a.mainBranchName),c.records.commits.has(d.id)&&m.warn(`Commit ID ${d.id} already exists`),c.records.commits.set(d.id,d),c.records.branches.set(c.records.currBranch,d.id),m.debug("in pushCommit "+d.id)},"commit"),yr=l(function(t){let r=t.name;const s=t.order;if(r=C.sanitizeText(r,I()),c.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);c.records.branches.set(r,c.records.head!=null?c.records.head.id:null),c.records.branchConfig.set(r,{name:r,order:s}),z(r),m.debug("in createBranch")},"branch"),ur=l(t=>{let r=t.branch,s=t.id;const n=t.type,e=t.tags,a=I();r=C.sanitizeText(r,a),s&&(s=C.sanitizeText(s,a));const d=c.records.branches.get(c.records.currBranch),o=c.records.branches.get(r),f=d?c.records.commits.get(d):void 0,h=o?c.records.commits.get(o):void 0;if(f&&h&&f.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(c.records.currBranch===r){const i=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw i.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},i}if(f===void 0||!f){const i=new Error(`Incorrect usage of "merge". Current branch (${c.records.currBranch})has no commits`);throw i.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},i}if(!c.records.branches.has(r)){const i=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw i.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},i}if(h===void 0||!h){const i=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw i.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},i}if(f===h){const i=new Error('Incorrect usage of "merge". Both branches have same head');throw i.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},i}if(s&&c.records.commits.has(s)){const i=new Error('Incorrect usage of "merge". Commit with id:'+s+" already exists, use different custom id");throw i.hash={text:`merge ${r} ${s} ${n} ${e?.join(" ")}`,token:`merge ${r} ${s} ${n} ${e?.join(" ")}`,expected:[`merge ${r} ${s}_UNIQUE ${n} ${e?.join(" ")}`]},i}const $=o||"",g={id:s||`${c.records.seq}-${A()}`,message:`merged branch ${r} into ${c.records.currBranch}`,seq:c.records.seq++,parents:c.records.head==null?[]:[c.records.head.id,$],branch:c.records.currBranch,type:x.MERGE,customType:n,customId:!!s,tags:e??[]};c.records.head=g,c.records.commits.set(g.id,g),c.records.branches.set(c.records.currBranch,g.id),m.debug(c.records.branches),m.debug("in mergeBranch")},"merge"),pr=l(function(t){let r=t.id,s=t.targetId,n=t.tags,e=t.parent;m.debug("Entering cherryPick:",r,s,n);const a=I();if(r=C.sanitizeText(r,a),s=C.sanitizeText(s,a),n=n?.map(f=>C.sanitizeText(f,a)),e=C.sanitizeText(e,a),!r||!c.records.commits.has(r)){const f=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw f.hash={text:`cherryPick ${r} ${s}`,token:`cherryPick ${r} ${s}`,expected:["cherry-pick abc"]},f}const d=c.records.commits.get(r);if(d===void 0||!d)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(e&&!(Array.isArray(d.parents)&&d.parents.includes(e)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const o=d.branch;if(d.type===x.MERGE&&!e)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!s||!c.records.commits.has(s)){if(o===c.records.currBranch){const g=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw g.hash={text:`cherryPick ${r} ${s}`,token:`cherryPick ${r} ${s}`,expected:["cherry-pick abc"]},g}const f=c.records.branches.get(c.records.currBranch);if(f===void 0||!f){const g=new Error(`Incorrect usage of "cherry-pick". Current branch (${c.records.currBranch})has no commits`);throw g.hash={text:`cherryPick ${r} ${s}`,token:`cherryPick ${r} ${s}`,expected:["cherry-pick abc"]},g}const h=c.records.commits.get(f);if(h===void 0||!h){const g=new Error(`Incorrect usage of "cherry-pick". Current branch (${c.records.currBranch})has no commits`);throw g.hash={text:`cherryPick ${r} ${s}`,token:`cherryPick ${r} ${s}`,expected:["cherry-pick abc"]},g}const $={id:c.records.seq+"-"+A(),message:`cherry-picked ${d?.message} into ${c.records.currBranch}`,seq:c.records.seq++,parents:c.records.head==null?[]:[c.records.head.id,d.id],branch:c.records.currBranch,type:x.CHERRY_PICK,tags:n?n.filter(Boolean):[`cherry-pick:${d.id}${d.type===x.MERGE?`|parent:${e}`:""}`]};c.records.head=$,c.records.commits.set($.id,$),c.records.branches.set(c.records.currBranch,$.id),m.debug(c.records.branches),m.debug("in cherryPick")}},"cherryPick"),z=l(function(t){if(t=C.sanitizeText(t,I()),c.records.branches.has(t)){c.records.currBranch=t;const r=c.records.branches.get(c.records.currBranch);r===void 0||!r?c.records.head=null:c.records.head=c.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`);throw r.hash={text:`checkout ${t}`,token:`checkout ${t}`,expected:[`branch ${t}`]},r}},"checkout");function _(t,r,s){const n=t.indexOf(r);n===-1?t.push(s):t.splice(n,1,s)}l(_,"upsert");function P(t){const r=t.reduce((e,a)=>e.seq>a.seq?e:a,t[0]);let s="";t.forEach(function(e){e===r?s+=" *":s+=" |"});const n=[s,r.id,r.seq];for(const e in c.records.branches)c.records.branches.get(e)===r.id&&n.push(e);if(m.debug(n.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const e=c.records.commits.get(r.parents[0]);_(t,r,e),r.parents[1]&&t.push(c.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const e=c.records.commits.get(r.parents[0]);_(t,r,e)}}t=F(t,e=>e.id),P(t)}l(P,"prettyPrintCommitHistory");var xr=l(function(){m.debug(c.records.commits);const t=N()[0];P([t])},"prettyPrint"),mr=l(function(){c.reset(),tr()},"clear"),br=l(function(){return[...c.records.branchConfig.values()].map((r,s)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${s}`)}).sort((r,s)=>(r.order??0)-(s.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),wr=l(function(){return c.records.branches},"getBranches"),vr=l(function(){return c.records.commits},"getCommits"),N=l(function(){const t=[...c.records.commits.values()];return t.forEach(function(r){m.debug(r.id)}),t.sort((r,s)=>r.seq-s.seq),t},"getCommitsArray"),Cr=l(function(){return c.records.currBranch},"getCurrentBranch"),Er=l(function(){return c.records.direction},"getDirection"),Tr=l(function(){return c.records.head},"getHead"),S={commitType:x,getConfig:I,setDirection:lr,setOptions:$r,getOptions:fr,commit:gr,branch:yr,merge:ur,cherryPick:pr,checkout:z,prettyPrint:xr,clear:mr,getBranchesAsObjArray:br,getBranches:wr,getCommits:vr,getCommitsArray:N,getCurrentBranch:Cr,getDirection:Er,getHead:Tr,setAccTitle:Z,getAccTitle:Q,getAccDescription:J,setAccDescription:X,setDiagramTitle:V,getDiagramTitle:U},Br=l((t,r)=>{Y(t,r),t.dir&&r.setDirection(t.dir);for(const s of t.statements)Lr(s,r)},"populate"),Lr=l((t,r)=>{const n={Commit:l(e=>r.commit(kr(e)),"Commit"),Branch:l(e=>r.branch(Mr(e)),"Branch"),Merge:l(e=>r.merge(Ir(e)),"Merge"),Checkout:l(e=>r.checkout(Rr(e)),"Checkout"),CherryPicking:l(e=>r.cherryPick(Gr(e)),"CherryPicking")}[t.$type];n?n(t):m.error(`Unknown statement type: ${t.$type}`)},"parseStatement"),kr=l(t=>({id:t.id,msg:t.message??"",type:t.type!==void 0?x[t.type]:x.NORMAL,tags:t.tags??void 0}),"parseCommit"),Mr=l(t=>({name:t.name,order:t.order??0}),"parseBranch"),Ir=l(t=>({branch:t.branch,id:t.id??"",type:t.type!==void 0?x[t.type]:void 0,tags:t.tags??void 0}),"parseMerge"),Rr=l(t=>t.branch,"parseCheckout"),Gr=l(t=>({id:t.id,targetId:"",tags:t.tags?.length===0?void 0:t.tags,parent:t.parent}),"parseCherryPicking"),Or={parse:l(async t=>{const r=await ir("gitGraph",t);m.debug(r),Br(r,S)},"parse")},qr=or(),v=qr?.gitGraph,L=10,k=40,E=4,T=2,M=8,b=new Map,w=new Map,O=30,R=new Map,q=[],B=0,u="LR",Ar=l(()=>{b.clear(),w.clear(),R.clear(),B=0,q=[],u="LR"},"clear"),W=l(t=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof t=="string"?t.split(/\\n|\n|/gi):t).forEach(n=>{const e=document.createElementNS("http://www.w3.org/2000/svg","tspan");e.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),e.setAttribute("dy","1em"),e.setAttribute("x","0"),e.setAttribute("class","row"),e.textContent=n.trim(),r.appendChild(e)}),r},"drawText"),j=l(t=>{let r,s,n;return u==="BT"?(s=l((e,a)=>e<=a,"comparisonFunc"),n=1/0):(s=l((e,a)=>e>=a,"comparisonFunc"),n=0),t.forEach(e=>{const a=u==="TB"||u=="BT"?w.get(e)?.y:w.get(e)?.x;a!==void 0&&s(a,n)&&(r=e,n=a)}),r},"findClosestParent"),Hr=l(t=>{let r="",s=1/0;return t.forEach(n=>{const e=w.get(n).y;e<=s&&(r=n,s=e)}),r||void 0},"findClosestParentBT"),_r=l((t,r,s)=>{let n=s,e=s;const a=[];t.forEach(d=>{const o=r.get(d);if(!o)throw new Error(`Commit not found for key ${d}`);o.parents.length?(n=Dr(o),e=Math.max(n,e)):a.push(o),Fr(o,n)}),n=e,a.forEach(d=>{zr(d,n,s)}),t.forEach(d=>{const o=r.get(d);if(o?.parents.length){const f=Hr(o.parents);n=w.get(f).y-k,n<=e&&(e=n);const h=b.get(o.branch).pos,$=n-L;w.set(o.id,{x:h,y:$})}})},"setParallelBTPos"),Pr=l(t=>{const r=j(t.parents.filter(n=>n!==null));if(!r)throw new Error(`Closest parent not found for commit ${t.id}`);const s=w.get(r)?.y;if(s===void 0)throw new Error(`Closest parent position not found for commit ${t.id}`);return s},"findClosestParentPos"),Dr=l(t=>Pr(t)+k,"calculateCommitPosition"),Fr=l((t,r)=>{const s=b.get(t.branch);if(!s)throw new Error(`Branch not found for commit ${t.id}`);const n=s.pos,e=r+L;return w.set(t.id,{x:n,y:e}),{x:n,y:e}},"setCommitPosition"),zr=l((t,r,s)=>{const n=b.get(t.branch);if(!n)throw new Error(`Branch not found for commit ${t.id}`);const e=r+s,a=n.pos;w.set(t.id,{x:a,y:e})},"setRootPosition"),Nr=l((t,r,s,n,e,a)=>{if(a===x.HIGHLIGHT)t.append("rect").attr("x",s.x-10).attr("y",s.y-10).attr("width",20).attr("height",20).attr("class",`commit ${r.id} commit-highlight${e%M} ${n}-outer`),t.append("rect").attr("x",s.x-6).attr("y",s.y-6).attr("width",12).attr("height",12).attr("class",`commit ${r.id} commit${e%M} ${n}-inner`);else if(a===x.CHERRY_PICK)t.append("circle").attr("cx",s.x).attr("cy",s.y).attr("r",10).attr("class",`commit ${r.id} ${n}`),t.append("circle").attr("cx",s.x-3).attr("cy",s.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${r.id} ${n}`),t.append("circle").attr("cx",s.x+3).attr("cy",s.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${r.id} ${n}`),t.append("line").attr("x1",s.x+3).attr("y1",s.y+1).attr("x2",s.x).attr("y2",s.y-5).attr("stroke","#fff").attr("class",`commit ${r.id} ${n}`),t.append("line").attr("x1",s.x-3).attr("y1",s.y+1).attr("x2",s.x).attr("y2",s.y-5).attr("stroke","#fff").attr("class",`commit ${r.id} ${n}`);else{const d=t.append("circle");if(d.attr("cx",s.x),d.attr("cy",s.y),d.attr("r",r.type===x.MERGE?9:10),d.attr("class",`commit ${r.id} commit${e%M}`),a===x.MERGE){const o=t.append("circle");o.attr("cx",s.x),o.attr("cy",s.y),o.attr("r",6),o.attr("class",`commit ${n} ${r.id} commit${e%M}`)}a===x.REVERSE&&t.append("path").attr("d",`M ${s.x-5},${s.y-5}L${s.x+5},${s.y+5}M${s.x-5},${s.y+5}L${s.x+5},${s.y-5}`).attr("class",`commit ${n} ${r.id} commit${e%M}`)}},"drawCommitBullet"),Sr=l((t,r,s,n)=>{if(r.type!==x.CHERRY_PICK&&(r.customId&&r.type===x.MERGE||r.type!==x.MERGE)&&v?.showCommitLabel){const e=t.append("g"),a=e.insert("rect").attr("class","commit-label-bkg"),d=e.append("text").attr("x",n).attr("y",s.y+25).attr("class","commit-label").text(r.id),o=d.node()?.getBBox();if(o&&(a.attr("x",s.posWithOffset-o.width/2-T).attr("y",s.y+13.5).attr("width",o.width+2*T).attr("height",o.height+2*T),u==="TB"||u==="BT"?(a.attr("x",s.x-(o.width+4*E+5)).attr("y",s.y-12),d.attr("x",s.x-(o.width+4*E)).attr("y",s.y+o.height-12)):d.attr("x",s.posWithOffset-o.width/2),v.rotateCommitLabel))if(u==="TB"||u==="BT")d.attr("transform","rotate(-45, "+s.x+", "+s.y+")"),a.attr("transform","rotate(-45, "+s.x+", "+s.y+")");else{const f=-7.5-(o.width+10)/25*9.5,h=10+o.width/25*8.5;e.attr("transform","translate("+f+", "+h+") rotate(-45, "+n+", "+s.y+")")}}},"drawCommitLabel"),Wr=l((t,r,s,n)=>{if(r.tags.length>0){let e=0,a=0,d=0;const o=[];for(const f of r.tags.reverse()){const h=t.insert("polygon"),$=t.append("circle"),g=t.append("text").attr("y",s.y-16-e).attr("class","tag-label").text(f),i=g.node()?.getBBox();if(!i)throw new Error("Tag bbox not found");a=Math.max(a,i.width),d=Math.max(d,i.height),g.attr("x",s.posWithOffset-i.width/2),o.push({tag:g,hole:$,rect:h,yOffset:e}),e+=20}for(const{tag:f,hole:h,rect:$,yOffset:g}of o){const i=d/2,y=s.y-19.2-g;if($.attr("class","tag-label-bkg").attr("points",` + ${n-a/2-E/2},${y+T} + ${n-a/2-E/2},${y-T} + ${s.posWithOffset-a/2-E},${y-i-T} + ${s.posWithOffset+a/2+E},${y-i-T} + ${s.posWithOffset+a/2+E},${y+i+T} + ${s.posWithOffset-a/2-E},${y+i+T}`),h.attr("cy",y).attr("cx",n-a/2+E/2).attr("r",1.5).attr("class","tag-hole"),u==="TB"||u==="BT"){const p=n+g;$.attr("class","tag-label-bkg").attr("points",` + ${s.x},${p+2} + ${s.x},${p-2} + ${s.x+L},${p-i-2} + ${s.x+L+a+4},${p-i-2} + ${s.x+L+a+4},${p+i+2} + ${s.x+L},${p+i+2}`).attr("transform","translate(12,12) rotate(45, "+s.x+","+n+")"),h.attr("cx",s.x+E/2).attr("cy",p).attr("transform","translate(12,12) rotate(45, "+s.x+","+n+")"),f.attr("x",s.x+5).attr("y",p+3).attr("transform","translate(14,14) rotate(45, "+s.x+","+n+")")}}}},"drawCommitTags"),jr=l(t=>{switch(t.customType??t.type){case x.NORMAL:return"commit-normal";case x.REVERSE:return"commit-reverse";case x.HIGHLIGHT:return"commit-highlight";case x.MERGE:return"commit-merge";case x.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),Yr=l((t,r,s,n)=>{const e={x:0,y:0};if(t.parents.length>0){const a=j(t.parents);if(a){const d=n.get(a)??e;return r==="TB"?d.y+k:r==="BT"?(n.get(t.id)??e).y-k:d.x+k}}else return r==="TB"?O:r==="BT"?(n.get(t.id)??e).y-k:0;return 0},"calculatePosition"),Kr=l((t,r,s)=>{const n=u==="BT"&&s?r:r+L,e=u==="TB"||u==="BT"?n:b.get(t.branch)?.pos,a=u==="TB"||u==="BT"?b.get(t.branch)?.pos:n;if(a===void 0||e===void 0)throw new Error(`Position were undefined for commit ${t.id}`);return{x:a,y:e,posWithOffset:n}},"getCommitPosition"),D=l((t,r,s)=>{if(!v)throw new Error("GitGraph config not found");const n=t.append("g").attr("class","commit-bullets"),e=t.append("g").attr("class","commit-labels");let a=u==="TB"||u==="BT"?O:0;const d=[...r.keys()],o=v?.parallelCommits??!1,f=l(($,g)=>{const i=r.get($)?.seq,y=r.get(g)?.seq;return i!==void 0&&y!==void 0?i-y:0},"sortKeys");let h=d.sort(f);u==="BT"&&(o&&_r(h,r,a),h=h.reverse()),h.forEach($=>{const g=r.get($);if(!g)throw new Error(`Commit not found for key ${$}`);o&&(a=Yr(g,u,a,w));const i=Kr(g,a,o);if(s){const y=jr(g),p=g.customType??g.type,H=b.get(g.branch)?.index??0;Nr(n,g,i,y,H,p),Sr(e,g,i,a),Wr(e,g,i,a)}u==="TB"||u==="BT"?w.set(g.id,{x:i.x,y:i.posWithOffset}):w.set(g.id,{x:i.posWithOffset,y:i.y}),a=u==="BT"&&o?a+k:a+k+L,a>B&&(B=a)})},"drawCommits"),Ur=l((t,r,s,n,e)=>{const d=(u==="TB"||u==="BT"?s.xh.branch===d,"isOnBranchToGetCurve"),f=l(h=>h.seq>t.seq&&h.seqf(h)&&o(h))},"shouldRerouteArrow"),G=l((t,r,s=0)=>{const n=t+Math.abs(t-r)/2;if(s>5)return n;if(q.every(d=>Math.abs(d-n)>=10))return q.push(n),n;const a=Math.abs(t-r);return G(t,r-a/5,s+1)},"findLane"),Vr=l((t,r,s,n)=>{const e=w.get(r.id),a=w.get(s.id);if(e===void 0||a===void 0)throw new Error(`Commit positions not found for commits ${r.id} and ${s.id}`);const d=Ur(r,s,e,a,n);let o="",f="",h=0,$=0,g=b.get(s.branch)?.index;s.type===x.MERGE&&r.id!==s.parents[0]&&(g=b.get(r.branch)?.index);let i;if(d){o="A 10 10, 0, 0, 0,",f="A 10 10, 0, 0, 1,",h=10,$=10;const y=e.ya.x&&(o="A 20 20, 0, 0, 0,",f="A 20 20, 0, 0, 1,",h=20,$=20,s.type===x.MERGE&&r.id!==s.parents[0]?i=`M ${e.x} ${e.y} L ${e.x} ${a.y-h} ${f} ${e.x-$} ${a.y} L ${a.x} ${a.y}`:i=`M ${e.x} ${e.y} L ${a.x+h} ${e.y} ${o} ${a.x} ${e.y+$} L ${a.x} ${a.y}`),e.x===a.x&&(i=`M ${e.x} ${e.y} L ${a.x} ${a.y}`)):u==="BT"?(e.xa.x&&(o="A 20 20, 0, 0, 0,",f="A 20 20, 0, 0, 1,",h=20,$=20,s.type===x.MERGE&&r.id!==s.parents[0]?i=`M ${e.x} ${e.y} L ${e.x} ${a.y+h} ${o} ${e.x-$} ${a.y} L ${a.x} ${a.y}`:i=`M ${e.x} ${e.y} L ${a.x-h} ${e.y} ${o} ${a.x} ${e.y-$} L ${a.x} ${a.y}`),e.x===a.x&&(i=`M ${e.x} ${e.y} L ${a.x} ${a.y}`)):(e.ya.y&&(s.type===x.MERGE&&r.id!==s.parents[0]?i=`M ${e.x} ${e.y} L ${a.x-h} ${e.y} ${o} ${a.x} ${e.y-$} L ${a.x} ${a.y}`:i=`M ${e.x} ${e.y} L ${e.x} ${a.y+h} ${f} ${e.x+$} ${a.y} L ${a.x} ${a.y}`),e.y===a.y&&(i=`M ${e.x} ${e.y} L ${a.x} ${a.y}`));if(i===void 0)throw new Error("Line definition not found");t.append("path").attr("d",i).attr("class","arrow arrow"+g%M)},"drawArrow"),Xr=l((t,r)=>{const s=t.append("g").attr("class","commit-arrows");[...r.keys()].forEach(n=>{const e=r.get(n);e.parents&&e.parents.length>0&&e.parents.forEach(a=>{Vr(s,r.get(a),e,r)})})},"drawArrows"),Jr=l((t,r)=>{const s=t.append("g");r.forEach((n,e)=>{const a=e%M,d=b.get(n.name)?.pos;if(d===void 0)throw new Error(`Position not found for branch ${n.name}`);const o=s.append("line");o.attr("x1",0),o.attr("y1",d),o.attr("x2",B),o.attr("y2",d),o.attr("class","branch branch"+a),u==="TB"?(o.attr("y1",O),o.attr("x1",d),o.attr("y2",B),o.attr("x2",d)):u==="BT"&&(o.attr("y1",B),o.attr("x1",d),o.attr("y2",O),o.attr("x2",d)),q.push(d);const f=n.name,h=W(f),$=s.insert("rect"),i=s.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+a);i.node().appendChild(h);const y=h.getBBox();$.attr("class","branchLabelBkg label"+a).attr("rx",4).attr("ry",4).attr("x",-y.width-4-(v?.rotateCommitLabel===!0?30:0)).attr("y",-y.height/2+8).attr("width",y.width+18).attr("height",y.height+4),i.attr("transform","translate("+(-y.width-14-(v?.rotateCommitLabel===!0?30:0))+", "+(d-y.height/2-1)+")"),u==="TB"?($.attr("x",d-y.width/2-10).attr("y",0),i.attr("transform","translate("+(d-y.width/2-5)+", 0)")):u==="BT"?($.attr("x",d-y.width/2-10).attr("y",B),i.attr("transform","translate("+(d-y.width/2-5)+", "+B+")")):$.attr("transform","translate(-19, "+(d-y.height/2)+")")})},"drawBranches"),Qr=l(function(t,r,s,n,e){return b.set(t,{pos:r,index:s}),r+=50+(e?40:0)+(u==="TB"||u==="BT"?n.width/2:0),r},"setBranchPosition"),Zr=l(function(t,r,s,n){if(Ar(),m.debug("in gitgraph renderer",t+` +`,"id:",r,s),!v)throw new Error("GitGraph config not found");const e=v.rotateCommitLabel??!1,a=n.db;R=a.getCommits();const d=a.getBranchesAsObjArray();u=a.getDirection();const o=dr(`[id="${r}"]`);let f=0;d.forEach((h,$)=>{const g=W(h.name),i=o.append("g"),y=i.insert("g").attr("class","branchLabel"),p=y.insert("g").attr("class","label branch-label");p.node()?.appendChild(g);const H=g.getBBox();f=Qr(h.name,f,$,H,e),p.remove(),y.remove(),i.remove()}),D(o,R,!1),v.showBranches&&Jr(o,d),Xr(o,R),D(o,R,!0),rr.insertTitle(o,"gitTitleText",v.titleTopMargin??0,a.getDiagramTitle()),er(void 0,o,v.diagramPadding,v.useMaxWidth)},"draw"),re={draw:Zr},ee=l(t=>` + .commit-id, + .commit-msg, + .branch-label { + fill: lightgrey; + color: lightgrey; + font-family: 'trebuchet ms', verdana, arial, sans-serif; + font-family: var(--mermaid-font-family); + } + ${[0,1,2,3,4,5,6,7].map(r=>` + .branch-label${r} { fill: ${t["gitBranchLabel"+r]}; } + .commit${r} { stroke: ${t["git"+r]}; fill: ${t["git"+r]}; } + .commit-highlight${r} { stroke: ${t["gitInv"+r]}; fill: ${t["gitInv"+r]}; } + .label${r} { fill: ${t["git"+r]}; } + .arrow${r} { stroke: ${t["git"+r]}; } + `).join(` +`)} + + .branch { + stroke-width: 1; + stroke: ${t.lineColor}; + stroke-dasharray: 2; + } + .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};} + .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; } + .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};} + .tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; } + .tag-hole { fill: ${t.textColor}; } + + .commit-merge { + stroke: ${t.primaryColor}; + fill: ${t.primaryColor}; + } + .commit-reverse { + stroke: ${t.primaryColor}; + fill: ${t.primaryColor}; + stroke-width: 3; + } + .commit-highlight-outer { + } + .commit-highlight-inner { + stroke: ${t.primaryColor}; + fill: ${t.primaryColor}; + } + + .arrow { stroke-width: 8; stroke-linecap: round; fill: none} + .gitTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${t.textColor}; + } +`,"getStyles"),te=ee,ge={parser:Or,db:S,renderer:re,styles:te};export{ge as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/glTFLoader-Bp7IfGPK.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/glTFLoader-Bp7IfGPK.js new file mode 100644 index 0000000000000000000000000000000000000000..3aaa196fb071d692648748c8627764444ba090f6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/glTFLoader-Bp7IfGPK.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./animationGroup-CCzMCPMh.js","./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./bone-z620UXj2.js","./glTFLoaderAnimation-Dy3q9t_h.js","./objectModelMapping-CGWnurZP.js","./openpbrMaterial-527Jzq5y.js","./pbrMaterialLoadingAdapter-BV-CpLvi.js"])))=>i.map(i=>d[i]); +import{af as G}from"./index-DWyDLubb.js";import{d as S,bG as ye,V as v,_ as g,s as b,bH as j,O as x,aQ as E,bI as ge,M as B,bJ as be,bK as ve,A as Ae,ah as Ce,f as ue,R as we,aq as de,e as re,G as Me,J as m,T as w,n as xe,L as T,bL as Te,bM as K,bN as H,bO as ce,bP as Oe,bQ as Pe,ax as Ee,aH as Se,aG as ke,o as $,bR as Re,l as oe,bg as Ie,bh as ae,bS as Le,bp as De,ao as q,b1 as Ne,bT as _e,au as $e,C as z,aM as Ve,bU as Ue,bV as Be,bW as Fe,bX as Ge,c as le,av as We}from"./index-CDrXokXW.js";import{B as Xe}from"./bone-z620UXj2.js";import{S as Ye}from"./skeleton-3aE04lM6.js";import{A as Ze}from"./assetContainer-D7EiOqw6.js";import{b as J}from"./objectModelMapping-CGWnurZP.js";import"./rawTexture-DYLCXHMF.js";class I{constructor(){this.keysUp=[38],this.keysUpward=[33],this.keysDown=[40],this.keysDownward=[34],this.keysLeft=[37],this.keysRight=[39],this.rotationSpeed=.5,this.keysRotateLeft=[],this.keysRotateRight=[],this.keysRotateUp=[],this.keysRotateDown=[],this._keys=new Array}attachControl(e){e=S.BackCompatCameraNoPreventDefault(arguments),!this._onCanvasBlurObserver&&(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add(()=>{this._keys.length=0}),this._onKeyboardObserver=this._scene.onKeyboardObservable.add(t=>{const s=t.event;if(!s.metaKey){if(t.type===ye.KEYDOWN)(this.keysUp.indexOf(s.keyCode)!==-1||this.keysDown.indexOf(s.keyCode)!==-1||this.keysLeft.indexOf(s.keyCode)!==-1||this.keysRight.indexOf(s.keyCode)!==-1||this.keysUpward.indexOf(s.keyCode)!==-1||this.keysDownward.indexOf(s.keyCode)!==-1||this.keysRotateLeft.indexOf(s.keyCode)!==-1||this.keysRotateRight.indexOf(s.keyCode)!==-1||this.keysRotateUp.indexOf(s.keyCode)!==-1||this.keysRotateDown.indexOf(s.keyCode)!==-1)&&(this._keys.indexOf(s.keyCode)===-1&&this._keys.push(s.keyCode),e||s.preventDefault());else if(this.keysUp.indexOf(s.keyCode)!==-1||this.keysDown.indexOf(s.keyCode)!==-1||this.keysLeft.indexOf(s.keyCode)!==-1||this.keysRight.indexOf(s.keyCode)!==-1||this.keysUpward.indexOf(s.keyCode)!==-1||this.keysDownward.indexOf(s.keyCode)!==-1||this.keysRotateLeft.indexOf(s.keyCode)!==-1||this.keysRotateRight.indexOf(s.keyCode)!==-1||this.keysRotateUp.indexOf(s.keyCode)!==-1||this.keysRotateDown.indexOf(s.keyCode)!==-1){const n=this._keys.indexOf(s.keyCode);n>=0&&this._keys.splice(n,1),e||s.preventDefault()}}}))}detachControl(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0}checkInputs(){if(this._onKeyboardObserver){const e=this.camera;for(let t=0;t{const i=n.event,r=i.pointerType==="touch";if(!this.touchEnabled&&r||n.type!==E.POINTERMOVE&&this.buttons.indexOf(i.button)===-1)return;const o=i.target;if(n.type===E.POINTERDOWN){if(r&&this._activePointerId!==-1||!r&&this._currentActiveButton!==-1)return;this._activePointerId=i.pointerId;try{o?.setPointerCapture(i.pointerId)}catch{}this._currentActiveButton===-1&&(this._currentActiveButton=i.button),this._previousPosition={x:i.clientX,y:i.clientY},e||(i.preventDefault(),s&&s.focus()),t.isPointerLock&&this._onMouseMove&&this._onMouseMove(n.event)}else if(n.type===E.POINTERUP){if(r&&this._activePointerId!==i.pointerId||!r&&this._currentActiveButton!==i.button)return;try{o?.releasePointerCapture(i.pointerId)}catch{}this._currentActiveButton=-1,this._previousPosition=null,e||i.preventDefault(),this._activePointerId=-1}else if(n.type===E.POINTERMOVE&&(this._activePointerId===i.pointerId||!r)){if(t.isPointerLock&&this._onMouseMove)this._onMouseMove(n.event);else if(this._previousPosition){const a=this.camera._calculateHandednessMultiplier(),l=(i.clientX-this._previousPosition.x)*a,h=(i.clientY-this._previousPosition.y)*a;this._allowCameraRotation&&(this.camera.cameraRotation.y+=l/this.angularSensibility,this.camera.cameraRotation.x+=h/this.angularSensibility),this.onPointerMovedObservable.notifyObservers({offsetX:l,offsetY:h}),this._previousPosition={x:i.clientX,y:i.clientY},e||i.preventDefault()}}}),this._onMouseMove=n=>{if(!t.isPointerLock)return;const i=this.camera._calculateHandednessMultiplier();this.camera.cameraRotation.y+=n.movementX*i/this.angularSensibility,this.camera.cameraRotation.x+=n.movementY*i/this.angularSensibility,this._previousPosition=null,e||n.preventDefault()},this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver(this._pointerInput,E.POINTERDOWN|E.POINTERUP|E.POINTERMOVE),s&&(this._contextMenuBind=n=>this.onContextMenu(n),s.addEventListener("contextmenu",this._contextMenuBind,!1))}onContextMenu(e){e.preventDefault()}detachControl(){if(this._observer){if(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this._contextMenuBind){const t=this.camera.getEngine().getInputElement();t&&t.removeEventListener("contextmenu",this._contextMenuBind)}this.onPointerMovedObservable&&this.onPointerMovedObservable.clear(),this._observer=null,this._onMouseMove=null,this._previousPosition=null}this._activePointerId=-1,this._currentActiveButton=-1}getClassName(){return"FreeCameraMouseInput"}getSimpleName(){return"mouse"}}g([b()],ee.prototype,"buttons",void 0);g([b()],ee.prototype,"angularSensibility",void 0);j.FreeCameraMouseInput=ee;class te{constructor(){this.wheelPrecisionX=3,this.wheelPrecisionY=3,this.wheelPrecisionZ=3,this.onChangedObservable=new x,this._wheelDeltaX=0,this._wheelDeltaY=0,this._wheelDeltaZ=0,this._ffMultiplier=12,this._normalize=120}attachControl(e){e=S.BackCompatCameraNoPreventDefault(arguments),this._wheel=t=>{if(t.type!==E.POINTERWHEEL)return;const s=t.event,n=s.deltaMode===ge.DOM_DELTA_LINE?this._ffMultiplier:1;this._wheelDeltaX+=this.wheelPrecisionX*n*s.deltaX/this._normalize,this._wheelDeltaY-=this.wheelPrecisionY*n*s.deltaY/this._normalize,this._wheelDeltaZ+=this.wheelPrecisionZ*n*s.deltaZ/this._normalize,s.preventDefault&&(e||s.preventDefault())},this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver(this._wheel,E.POINTERWHEEL)}detachControl(){this._observer&&(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this._observer=null,this._wheel=null),this.onChangedObservable&&this.onChangedObservable.clear()}checkInputs(){this.onChangedObservable.notifyObservers({wheelDeltaX:this._wheelDeltaX,wheelDeltaY:this._wheelDeltaY,wheelDeltaZ:this._wheelDeltaZ}),this._wheelDeltaX=0,this._wheelDeltaY=0,this._wheelDeltaZ=0}getClassName(){return"BaseCameraMouseWheelInput"}getSimpleName(){return"mousewheel"}}g([b()],te.prototype,"wheelPrecisionX",void 0);g([b()],te.prototype,"wheelPrecisionY",void 0);g([b()],te.prototype,"wheelPrecisionZ",void 0);var y;(function(c){c[c.MoveRelative=0]="MoveRelative",c[c.RotateRelative=1]="RotateRelative",c[c.MoveScene=2]="MoveScene"})(y||(y={}));class D extends te{constructor(){super(...arguments),this._moveRelative=v.Zero(),this._rotateRelative=v.Zero(),this._moveScene=v.Zero(),this._wheelXAction=y.MoveRelative,this._wheelXActionCoordinate=0,this._wheelYAction=y.MoveRelative,this._wheelYActionCoordinate=2,this._wheelZAction=null,this._wheelZActionCoordinate=null}getClassName(){return"FreeCameraMouseWheelInput"}set wheelXMoveRelative(e){e===null&&this._wheelXAction!==y.MoveRelative||(this._wheelXAction=y.MoveRelative,this._wheelXActionCoordinate=e)}get wheelXMoveRelative(){return this._wheelXAction!==y.MoveRelative?null:this._wheelXActionCoordinate}set wheelYMoveRelative(e){e===null&&this._wheelYAction!==y.MoveRelative||(this._wheelYAction=y.MoveRelative,this._wheelYActionCoordinate=e)}get wheelYMoveRelative(){return this._wheelYAction!==y.MoveRelative?null:this._wheelYActionCoordinate}set wheelZMoveRelative(e){e===null&&this._wheelZAction!==y.MoveRelative||(this._wheelZAction=y.MoveRelative,this._wheelZActionCoordinate=e)}get wheelZMoveRelative(){return this._wheelZAction!==y.MoveRelative?null:this._wheelZActionCoordinate}set wheelXRotateRelative(e){e===null&&this._wheelXAction!==y.RotateRelative||(this._wheelXAction=y.RotateRelative,this._wheelXActionCoordinate=e)}get wheelXRotateRelative(){return this._wheelXAction!==y.RotateRelative?null:this._wheelXActionCoordinate}set wheelYRotateRelative(e){e===null&&this._wheelYAction!==y.RotateRelative||(this._wheelYAction=y.RotateRelative,this._wheelYActionCoordinate=e)}get wheelYRotateRelative(){return this._wheelYAction!==y.RotateRelative?null:this._wheelYActionCoordinate}set wheelZRotateRelative(e){e===null&&this._wheelZAction!==y.RotateRelative||(this._wheelZAction=y.RotateRelative,this._wheelZActionCoordinate=e)}get wheelZRotateRelative(){return this._wheelZAction!==y.RotateRelative?null:this._wheelZActionCoordinate}set wheelXMoveScene(e){e===null&&this._wheelXAction!==y.MoveScene||(this._wheelXAction=y.MoveScene,this._wheelXActionCoordinate=e)}get wheelXMoveScene(){return this._wheelXAction!==y.MoveScene?null:this._wheelXActionCoordinate}set wheelYMoveScene(e){e===null&&this._wheelYAction!==y.MoveScene||(this._wheelYAction=y.MoveScene,this._wheelYActionCoordinate=e)}get wheelYMoveScene(){return this._wheelYAction!==y.MoveScene?null:this._wheelYActionCoordinate}set wheelZMoveScene(e){e===null&&this._wheelZAction!==y.MoveScene||(this._wheelZAction=y.MoveScene,this._wheelZActionCoordinate=e)}get wheelZMoveScene(){return this._wheelZAction!==y.MoveScene?null:this._wheelZActionCoordinate}checkInputs(){if(this._wheelDeltaX===0&&this._wheelDeltaY===0&&this._wheelDeltaZ==0)return;this._moveRelative.setAll(0),this._rotateRelative.setAll(0),this._moveScene.setAll(0),this._updateCamera(),this.camera.getScene().useRightHandedSystem&&(this._moveRelative.z*=-1);const e=B.Zero();this.camera.getViewMatrix().invertToRef(e);const t=v.Zero();v.TransformNormalToRef(this._moveRelative,e,t),this.camera.cameraRotation.x+=this._rotateRelative.x/200,this.camera.cameraRotation.y+=this._rotateRelative.y/200,this.camera.cameraDirection.addInPlace(t),this.camera.cameraDirection.addInPlace(this._moveScene),super.checkInputs()}_updateCamera(){this._updateCameraProperty(this._wheelDeltaX,this._wheelXAction,this._wheelXActionCoordinate),this._updateCameraProperty(this._wheelDeltaY,this._wheelYAction,this._wheelYActionCoordinate),this._updateCameraProperty(this._wheelDeltaZ,this._wheelZAction,this._wheelZActionCoordinate)}_updateCameraProperty(e,t,s){if(e===0||t===null||s===null)return;let n=null;switch(t){case y.MoveRelative:n=this._moveRelative;break;case y.RotateRelative:n=this._rotateRelative;break;case y.MoveScene:n=this._moveScene;break}switch(s){case 0:n.set(e,0,0);break;case 1:n.set(0,e,0);break;case 2:n.set(0,0,e);break}}}g([b()],D.prototype,"wheelXMoveRelative",null);g([b()],D.prototype,"wheelYMoveRelative",null);g([b()],D.prototype,"wheelZMoveRelative",null);g([b()],D.prototype,"wheelXRotateRelative",null);g([b()],D.prototype,"wheelYRotateRelative",null);g([b()],D.prototype,"wheelZRotateRelative",null);g([b()],D.prototype,"wheelXMoveScene",null);g([b()],D.prototype,"wheelYMoveScene",null);g([b()],D.prototype,"wheelZMoveScene",null);j.FreeCameraMouseWheelInput=D;class se{constructor(e=!1){this.allowMouse=e,this.touchAngularSensibility=2e5,this.touchMoveSensibility=250,this.singleFingerRotate=!1,this._offsetX=null,this._offsetY=null,this._pointerPressed=new Array,this._isSafari=S.IsSafari()}attachControl(e){e=S.BackCompatCameraNoPreventDefault(arguments);let t=null;if(this._pointerInput===void 0&&(this._onLostFocus=()=>{this._offsetX=null,this._offsetY=null},this._pointerInput=s=>{const n=s.event,i=n.pointerType==="mouse"||this._isSafari&&typeof n.pointerType>"u";if(!(!this.allowMouse&&i)){if(s.type===E.POINTERDOWN){if(e||n.preventDefault(),this._pointerPressed.push(n.pointerId),this._pointerPressed.length!==1)return;t={x:n.clientX,y:n.clientY}}else if(s.type===E.POINTERUP){e||n.preventDefault();const r=this._pointerPressed.indexOf(n.pointerId);if(r===-1||(this._pointerPressed.splice(r,1),r!=0))return;t=null,this._offsetX=null,this._offsetY=null}else if(s.type===E.POINTERMOVE){if(e||n.preventDefault(),!t||this._pointerPressed.indexOf(n.pointerId)!=0)return;this._offsetX=n.clientX-t.x,this._offsetY=-(n.clientY-t.y)}}}),this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver(this._pointerInput,E.POINTERDOWN|E.POINTERUP|E.POINTERMOVE),this._onLostFocus){const n=this.camera.getEngine().getInputElement();n&&n.addEventListener("blur",this._onLostFocus)}}detachControl(){if(this._pointerInput){if(this._observer&&(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this._observer=null),this._onLostFocus){const t=this.camera.getEngine().getInputElement();t&&t.removeEventListener("blur",this._onLostFocus),this._onLostFocus=null}this._pointerPressed.length=0,this._offsetX=null,this._offsetY=null}}checkInputs(){if(this._offsetX===null||this._offsetY===null||this._offsetX===0&&this._offsetY===0)return;const e=this.camera,t=e._calculateHandednessMultiplier();if(e.cameraRotation.y=this._offsetX*t/this.touchAngularSensibility,this.singleFingerRotate&&this._pointerPressed.length===1||!this.singleFingerRotate&&this._pointerPressed.length>1)e.cameraRotation.x=-(this._offsetY*t)/this.touchAngularSensibility;else{const n=e._computeLocalCameraSpeed(),i=new v(0,0,this.touchMoveSensibility!==0?n*this._offsetY/this.touchMoveSensibility:0);B.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,e._cameraRotationMatrix),e.cameraDirection.addInPlace(v.TransformCoordinates(i,e._cameraRotationMatrix))}}getClassName(){return"FreeCameraTouchInput"}getSimpleName(){return"touch"}}g([b()],se.prototype,"touchAngularSensibility",void 0);g([b()],se.prototype,"touchMoveSensibility",void 0);j.FreeCameraTouchInput=se;class Ke extends be{constructor(e){super(e),this._mouseInput=null,this._mouseWheelInput=null}addKeyboard(){return this.add(new I),this}addMouse(e=!0){return this._mouseInput||(this._mouseInput=new ee(e),this.add(this._mouseInput)),this}removeMouse(){return this._mouseInput&&this.remove(this._mouseInput),this}addMouseWheel(){return this._mouseWheelInput||(this._mouseWheelInput=new D,this.add(this._mouseWheelInput)),this}removeMouseWheel(){return this._mouseWheelInput&&this.remove(this._mouseWheelInput),this}addTouch(){return this.add(new se),this}clear(){super.clear(),this._mouseInput=null}}class X extends ve{get angularSensibility(){const e=this.inputs.attached.mouse;return e?e.angularSensibility:0}set angularSensibility(e){const t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)}get keysUp(){const e=this.inputs.attached.keyboard;return e?e.keysUp:[]}set keysUp(e){const t=this.inputs.attached.keyboard;t&&(t.keysUp=e)}get keysUpward(){const e=this.inputs.attached.keyboard;return e?e.keysUpward:[]}set keysUpward(e){const t=this.inputs.attached.keyboard;t&&(t.keysUpward=e)}get keysDown(){const e=this.inputs.attached.keyboard;return e?e.keysDown:[]}set keysDown(e){const t=this.inputs.attached.keyboard;t&&(t.keysDown=e)}get keysDownward(){const e=this.inputs.attached.keyboard;return e?e.keysDownward:[]}set keysDownward(e){const t=this.inputs.attached.keyboard;t&&(t.keysDownward=e)}get keysLeft(){const e=this.inputs.attached.keyboard;return e?e.keysLeft:[]}set keysLeft(e){const t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)}get keysRight(){const e=this.inputs.attached.keyboard;return e?e.keysRight:[]}set keysRight(e){const t=this.inputs.attached.keyboard;t&&(t.keysRight=e)}get keysRotateLeft(){const e=this.inputs.attached.keyboard;return e?e.keysRotateLeft:[]}set keysRotateLeft(e){const t=this.inputs.attached.keyboard;t&&(t.keysRotateLeft=e)}get keysRotateRight(){const e=this.inputs.attached.keyboard;return e?e.keysRotateRight:[]}set keysRotateRight(e){const t=this.inputs.attached.keyboard;t&&(t.keysRotateRight=e)}get keysRotateUp(){const e=this.inputs.attached.keyboard;return e?e.keysRotateUp:[]}set keysRotateUp(e){const t=this.inputs.attached.keyboard;t&&(t.keysRotateUp=e)}get keysRotateDown(){const e=this.inputs.attached.keyboard;return e?e.keysRotateDown:[]}set keysRotateDown(e){const t=this.inputs.attached.keyboard;t&&(t.keysRotateDown=e)}constructor(e,t,s,n=!0){super(e,t,s,n),this.ellipsoid=new v(.5,1,.5),this.ellipsoidOffset=new v(0,0,0),this.checkCollisions=!1,this.applyGravity=!1,this._needMoveForGravity=!1,this._oldPosition=v.Zero(),this._diffPosition=v.Zero(),this._newPosition=v.Zero(),this._collisionMask=-1,this._onCollisionPositionChange=(i,r,o=null)=>{this._newPosition.copyFrom(r),this._newPosition.subtractToRef(this._oldPosition,this._diffPosition),this._diffPosition.length()>Ae.CollisionsEpsilon&&(this.position.addToRef(this._diffPosition,this._deferredPositionUpdate),this._deferOnly?this._deferredUpdated=!0:this.position.copyFrom(this._deferredPositionUpdate),this.onCollide&&o&&this.onCollide(o))},this.inputs=new Ke(this),this.inputs.addKeyboard().addMouse()}attachControl(e,t){t=S.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t)}detachControl(){this.inputs.detachElement(),this.cameraDirection=new v(0,0,0),this.cameraRotation=new Ce(0,0)}get collisionMask(){return this._collisionMask}set collisionMask(e){this._collisionMask=isNaN(e)?-1:e}_collideWithWorld(e){let t;this.parent?t=v.TransformCoordinates(this.position,this.parent.getWorldMatrix()):t=this.position,t.subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);const s=this.getScene().collisionCoordinator;this._collider||(this._collider=s.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;let n=e;this.applyGravity&&(n=e.add(this.getScene().gravity)),s.getNewPosition(this._oldPosition,n,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)}_checkInputs(){this._localDirection||(this._localDirection=v.Zero(),this._transformedDirection=v.Zero()),this.inputs.checkInputs(),super._checkInputs()}set needMoveForGravity(e){this._needMoveForGravity=e}get needMoveForGravity(){return this._needMoveForGravity}_decideIfNeedsToMove(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0}_updatePosition(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):super._updatePosition()}dispose(){this.inputs.clear(),super.dispose()}getClassName(){return"FreeCamera"}}g([ue()],X.prototype,"ellipsoid",void 0);g([ue()],X.prototype,"ellipsoidOffset",void 0);g([b()],X.prototype,"checkCollisions",void 0);g([b()],X.prototype,"applyGravity",void 0);we("BABYLON.FreeCamera",X);class F{get influence(){return this._influence}set influence(e){if(this._influence===e)return;const t=this._influence;this._influence=e,this.onInfluenceChanged.hasObservers()&&this.onInfluenceChanged.notifyObservers(t===0||e===0)}get animationPropertiesOverride(){return!this._animationPropertiesOverride&&this._scene?this._scene.animationPropertiesOverride:this._animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}constructor(e,t=0,s=null){this.name=e,this.animations=[],this._positions=null,this._normals=null,this._tangents=null,this._uvs=null,this._uv2s=null,this._colors=null,this._uniqueId=0,this.onInfluenceChanged=new x,this._onDataLayoutChanged=new x,this._animationPropertiesOverride=null,this.id=e,this._scene=s||de.LastCreatedScene,this.influence=t,this._scene&&(this._uniqueId=this._scene.getUniqueId())}get uniqueId(){return this._uniqueId}get hasPositions(){return!!this._positions}get hasNormals(){return!!this._normals}get hasTangents(){return!!this._tangents}get hasUVs(){return!!this._uvs}get hasUV2s(){return!!this._uv2s}get hasColors(){return!!this._colors}get vertexCount(){return this._positions?this._positions.length/3:this._normals?this._normals.length/3:this._tangents?this._tangents.length/3:this._uvs?this._uvs.length/2:this._uv2s?this._uv2s.length/2:this._colors?this._colors.length/4:0}setPositions(e){const t=this.hasPositions;this._positions=e,t!==this.hasPositions&&this._onDataLayoutChanged.notifyObservers(void 0)}getPositions(){return this._positions}setNormals(e){const t=this.hasNormals;this._normals=e,t!==this.hasNormals&&this._onDataLayoutChanged.notifyObservers(void 0)}getNormals(){return this._normals}setTangents(e){const t=this.hasTangents;this._tangents=e,t!==this.hasTangents&&this._onDataLayoutChanged.notifyObservers(void 0)}getTangents(){return this._tangents}setUVs(e){const t=this.hasUVs;this._uvs=e,t!==this.hasUVs&&this._onDataLayoutChanged.notifyObservers(void 0)}getUVs(){return this._uvs}setUV2s(e){const t=this.hasUV2s;this._uv2s=e,t!==this.hasUV2s&&this._onDataLayoutChanged.notifyObservers(void 0)}getUV2s(){return this._uv2s}setColors(e){const t=this.hasColors;this._colors=e,t!==this.hasColors&&this._onDataLayoutChanged.notifyObservers(void 0)}getColors(){return this._colors}clone(){const e=re.Clone(()=>new F(this.name,this.influence,this._scene),this);return e._positions=this._positions,e._normals=this._normals,e._tangents=this._tangents,e._uvs=this._uvs,e._uv2s=this._uv2s,e._colors=this._colors,e}serialize(){const e={};return e.name=this.name,e.influence=this.influence,e.positions=Array.prototype.slice.call(this.getPositions()),this.id!=null&&(e.id=this.id),this.hasNormals&&(e.normals=Array.prototype.slice.call(this.getNormals())),this.hasTangents&&(e.tangents=Array.prototype.slice.call(this.getTangents())),this.hasUVs&&(e.uvs=Array.prototype.slice.call(this.getUVs())),this.hasUV2s&&(e.uv2s=Array.prototype.slice.call(this.getUV2s())),this.hasColors&&(e.colors=Array.prototype.slice.call(this.getColors())),re.AppendSerializedAnimations(this,e),e}getClassName(){return"MorphTarget"}static Parse(e,t){const s=new F(e.name,e.influence);if(s.setPositions(e.positions),e.id!=null&&(s.id=e.id),e.normals&&s.setNormals(e.normals),e.tangents&&s.setTangents(e.tangents),e.uvs&&s.setUVs(e.uvs),e.uv2s&&s.setUV2s(e.uv2s),e.colors&&s.setColors(e.colors),e.animations){for(let n=0;n0}constructor(e=null){if(this._targets=new Array,this._targetInfluenceChangedObservers=new Array,this._targetDataLayoutChangedObservers=new Array,this._activeTargets=new xe(16),this._supportsPositions=!1,this._supportsNormals=!1,this._supportsTangents=!1,this._supportsUVs=!1,this._supportsUV2s=!1,this._supportsColors=!1,this._vertexCount=0,this._uniqueId=0,this._tempInfluences=new Array,this._canUseTextureForTargets=!1,this._blockCounter=0,this._mustSynchronize=!0,this._forceUpdateWhenUnfrozen=!1,this._textureVertexStride=0,this._textureWidth=0,this._textureHeight=1,this._parentContainer=null,this.optimizeInfluencers=!0,this.enablePositionMorphing=!0,this.enableNormalMorphing=!0,this.enableTangentMorphing=!0,this.enableUVMorphing=!0,this.enableUV2Morphing=!0,this.enableColorMorphing=!0,this._numMaxInfluencers=0,this._useTextureToStoreTargets=!0,this.metadata=null,this._influencesAreDirty=!1,this._needUpdateInfluences=!1,e||(e=de.LastCreatedScene),this._scene=e,this._scene){this._scene.addMorphTargetManager(this),this._uniqueId=this._scene.getUniqueId();const t=this._scene.getEngine().getCaps();this._canUseTextureForTargets=t.canUseGLVertexID&&t.textureFloat&&t.maxVertexTextureImageUnits>0&&t.texture2DArrayMaxLayerCount>1}}get numMaxInfluencers(){return L.ConstantTargetCountForTextureMode>0&&this.isUsingTextureForTargets?L.ConstantTargetCountForTextureMode:this._numMaxInfluencers}set numMaxInfluencers(e){this._numMaxInfluencers!==e&&(this._numMaxInfluencers=e,this._mustSynchronize=!0,this._syncActiveTargets())}get uniqueId(){return this._uniqueId}get vertexCount(){return this._vertexCount}get supportsPositions(){return this._supportsPositions&&this.enablePositionMorphing}get supportsNormals(){return this._supportsNormals&&this.enableNormalMorphing}get supportsTangents(){return this._supportsTangents&&this.enableTangentMorphing}get supportsUVs(){return this._supportsUVs&&this.enableUVMorphing}get supportsUV2s(){return this._supportsUV2s&&this.enableUV2Morphing}get supportsColors(){return this._supportsColors&&this.enableColorMorphing}get hasPositions(){return this._supportsPositions}get hasNormals(){return this._supportsNormals}get hasTangents(){return this._supportsTangents}get hasUVs(){return this._supportsUVs}get hasUV2s(){return this._supportsUV2s}get hasColors(){return this._supportsColors}get numTargets(){return this._targets.length}get numInfluencers(){return this._influencesAreDirty&&this._syncActiveTargets(),this._activeTargets.length}get influences(){return this._influencesAreDirty&&this._syncActiveTargets(),this._influences}get useTextureToStoreTargets(){return this._useTextureToStoreTargets}set useTextureToStoreTargets(e){this._useTextureToStoreTargets!==e&&(this._useTextureToStoreTargets=e,this._mustSynchronize=!0,this._syncActiveTargets())}get isUsingTextureForTargets(){return L.EnableTextureStorage&&this.useTextureToStoreTargets&&this._canUseTextureForTargets&&!this._scene?.getEngine().getCaps().disableMorphTargetTexture}getActiveTarget(e){return this._influencesAreDirty&&this._syncActiveTargets(),this._activeTargets.data[e]}getTarget(e){return this._targets[e]}getTargetByName(e){for(const t of this._targets)if(t.name===e)return t;return null}addTarget(e){this._targets.push(e),this._targetInfluenceChangedObservers.push(e.onInfluenceChanged.add(t=>{this.areUpdatesFrozen&&t&&(this._forceUpdateWhenUnfrozen=!0),this._influencesAreDirty=!0,this._needUpdateInfluences=this._needUpdateInfluences||t})),this._targetDataLayoutChangedObservers.push(e._onDataLayoutChanged.add(()=>{this._mustSynchronize=!0,this._syncActiveTargets()})),this._mustSynchronize=!0,this._syncActiveTargets()}removeTarget(e){const t=this._targets.indexOf(e);t>=0&&(this._targets.splice(t,1),e.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(t,1)[0]),e._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(t,1)[0]),this._mustSynchronize=!0,this._syncActiveTargets()),this._scene&&this._scene.stopAnimation(e)}_bind(e){this._influencesAreDirty&&this._syncActiveTargets(),e.setFloat3("morphTargetTextureInfo",this._textureVertexStride,this._textureWidth,this._textureHeight),e.setFloatArray("morphTargetTextureIndices",this._morphTargetTextureIndices),e.setTexture("morphTargets",this._targetStoreTexture),e.setFloat("morphTargetCount",this.numInfluencers)}clone(){const e=new L(this._scene);e.areUpdatesFrozen=!0;for(const t of this._targets)e.addTarget(t.clone());return e.areUpdatesFrozen=!1,e.enablePositionMorphing=this.enablePositionMorphing,e.enableNormalMorphing=this.enableNormalMorphing,e.enableTangentMorphing=this.enableTangentMorphing,e.enableUVMorphing=this.enableUVMorphing,e.enableUV2Morphing=this.enableUV2Morphing,e.enableColorMorphing=this.enableColorMorphing,e.metadata=this.metadata,e}serialize(){const e={};e.id=this.uniqueId,e.targets=[];for(const t of this._targets)e.targets.push(t.serialize());return this.metadata&&(e.metadata=this.metadata),e}_syncActiveTargets(e=!1){if(this.areUpdatesFrozen)return;e=e||this._needUpdateInfluences,this._needUpdateInfluences=!1,this._influencesAreDirty=!1;const t=!!this._targetStoreTexture,s=this.isUsingTextureForTargets;(this._mustSynchronize||t!==s)&&(this._mustSynchronize=!1,this.synchronize());let n=0;this._activeTargets.reset(),(!this._morphTargetTextureIndices||this._morphTargetTextureIndices.length!==this._targets.length)&&(this._morphTargetTextureIndices=new Float32Array(this._targets.length));let i=-1;for(const r of this._targets)if(i++,!(r.influence===0&&this.optimizeInfluencers)){if(this._activeTargets.length>=L.MaxActiveMorphTargetsInVertexAttributeMode&&!this.isUsingTextureForTargets)break;this._activeTargets.push(r),this._morphTargetTextureIndices[n]=i,this._tempInfluences[n++]=r.influence}this._morphTargetTextureIndices.length!==n&&(this._morphTargetTextureIndices=this._morphTargetTextureIndices.slice(0,n)),(!this._influences||this._influences.length!==n)&&(this._influences=new Float32Array(n));for(let r=0;re.getCaps().texture2DArrayMaxLayerCount&&(this.useTextureToStoreTargets=!1);for(const t of this._targets){this._supportsPositions=this._supportsPositions&&t.hasPositions,this._supportsNormals=this._supportsNormals&&t.hasNormals,this._supportsTangents=this._supportsTangents&&t.hasTangents,this._supportsUVs=this._supportsUVs&&t.hasUVs,this._supportsUV2s=this._supportsUV2s&&t.hasUV2s,this._supportsColors=this._supportsColors&&t.hasColors;const s=t.vertexCount;if(this._vertexCount===0)this._vertexCount=s;else if(this._vertexCount!==s){T.Error(`Incompatible target. Targets must all have the same vertices count. Current vertex count: ${this._vertexCount}, vertex count for target "${t.name}": ${s}`);return}}if(this.isUsingTextureForTargets){this._textureVertexStride=0,this._supportsPositions&&this._textureVertexStride++,this._supportsNormals&&this._textureVertexStride++,this._supportsTangents&&this._textureVertexStride++,this._supportsUVs&&this._textureVertexStride++,this._supportsUV2s&&this._textureVertexStride++,this._supportsColors&&this._textureVertexStride++,this._textureWidth=this._vertexCount*this._textureVertexStride||1,this._textureHeight=1;const t=e.getCaps().maxTextureSize;this._textureWidth>t&&(this._textureHeight=Math.ceil(this._textureWidth/t),this._textureWidth=t);const s=this._targets.length,n=new Float32Array(s*this._textureWidth*this._textureHeight*4);let i=0;for(let r=0;r-1&&this._parentContainer.morphTargetManagers.splice(e,1),this._parentContainer=null}for(const e of this._targets)this._scene.stopAnimation(e)}}static Parse(e,t){const s=new L(t);for(const n of e.targets)s.addTarget(F.Parse(n,t));return e.metadata&&(s.metadata=e.metadata),s}}L.EnableTextureStorage=!0;L.MaxActiveMorphTargetsInVertexAttributeMode=8;L.ConstantTargetCountForTextureMode=0;class Q{constructor(e){this.byteOffset=0,this.buffer=e}async loadAsync(e){const t=await this.buffer.readAsync(this.byteOffset,e);this._dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),this._dataByteOffset=0}readUint32(){const e=this._dataView.getUint32(this._dataByteOffset,!0);return this._dataByteOffset+=4,this.byteOffset+=4,e}readUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._dataByteOffset,e);return this._dataByteOffset+=e,this.byteOffset+=e,t}readString(e){return Te(this.readUint8Array(e))}skipBytes(e){this._dataByteOffset+=e,this.byteOffset+=e}}function ne(c,e,t,s){const n={externalResourceFunction:s};return t&&(n.uri=e==="file:"?t:e+t),ArrayBuffer.isView(c)?GLTFValidator.validateBytes(c,n):GLTFValidator.validateString(c,n)}function He(){const c=[];onmessage=e=>{const t=e.data;switch(t.id){case"init":{importScripts(t.url);break}case"validate":{ne(t.data,t.rootUrl,t.fileName,s=>new Promise((n,i)=>{const r=c.length;c.push({resolve:n,reject:i}),postMessage({id:"getExternalResource",index:r,uri:s})})).then(s=>{postMessage({id:"validate.resolve",value:s})},s=>{postMessage({id:"validate.reject",reason:s})});break}case"getExternalResource.resolve":{c[t.index].resolve(t.value);break}case"getExternalResource.reject":{c[t.index].reject(t.reason);break}}}}class fe{static ValidateAsync(e,t,s,n){return typeof Worker=="function"?new Promise((i,r)=>{const o=`${ne}(${He})()`,a=URL.createObjectURL(new Blob([o],{type:"application/javascript"})),l=new Worker(a),h=d=>{l.removeEventListener("error",h),l.removeEventListener("message",u),r(d)},u=d=>{const p=d.data;switch(p.id){case"getExternalResource":{n(p.uri).then(_=>{l.postMessage({id:"getExternalResource.resolve",index:p.index,value:_},[_.buffer])},_=>{l.postMessage({id:"getExternalResource.reject",index:p.index,reason:_})});break}case"validate.resolve":{l.removeEventListener("error",h),l.removeEventListener("message",u),i(p.value),l.terminate();break}case"validate.reject":l.removeEventListener("error",h),l.removeEventListener("message",u),r(p.reason),l.terminate()}};if(l.addEventListener("error",h),l.addEventListener("message",u),l.postMessage({id:"init",url:S.GetBabylonScriptURL(this.Configuration.url)}),ArrayBuffer.isView(e)){const d=e.slice();l.postMessage({id:"validate",data:d,rootUrl:t,fileName:s},[d.buffer])}else l.postMessage({id:"validate",data:e,rootUrl:t,fileName:s})}):(this._LoadScriptPromise||(this._LoadScriptPromise=S.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then(()=>ne(e,t,s,n)))}}fe.Configuration={url:`${S._DefaultCdnUrl}/gltf_validator.js`};function he(c,e,t){try{return Promise.resolve(new Uint8Array(c,e,t))}catch(s){return Promise.reject(s)}}function qe(c,e,t){try{if(e<0||e>=c.byteLength)throw new RangeError("Offset is out of range.");if(e+t>c.byteLength)throw new RangeError("Length is out of range.");return Promise.resolve(new Uint8Array(c.buffer,c.byteOffset+e,t))}catch(s){return Promise.reject(s)}}var Y;(function(c){c[c.AUTO=0]="AUTO",c[c.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED"})(Y||(Y={}));var W;(function(c){c[c.NONE=0]="NONE",c[c.FIRST=1]="FIRST",c[c.ALL=2]="ALL"})(W||(W={}));var k;(function(c){c[c.LOADING=0]="LOADING",c[c.READY=1]="READY",c[c.COMPLETE=2]="COMPLETE"})(k||(k={}));class pe{constructor(){this.alwaysComputeBoundingBox=!1,this.alwaysComputeSkeletonRootNode=!1,this.animationStartMode=W.FIRST,this.compileMaterials=!1,this.compileShadowGenerators=!1,this.coordinateSystemMode=Y.AUTO,this.createInstances=!0,this.loadAllMaterials=!1,this.loadMorphTargets=!0,this.loadNodeAnimations=!0,this.loadOnlyMaterials=!1,this.loadSkins=!0,this.skipMaterials=!1,this.targetFps=60,this.transparencyAsCoverage=!1,this.useClipPlane=!1,this.useGltfTextureNames=!1,this.useRangeRequests=!1,this.useSRGBBuffers=!0,this.validate=!1,this.useOpenPBR=!1,this.dontUseTransmissionHelper=!1}}const ze=new pe;class Je extends pe{constructor(){super(...arguments),this.extensionOptions={},this.preprocessUrlAsync=e=>Promise.resolve(e)}copyFrom(e){e&&(this.alwaysComputeBoundingBox=e.alwaysComputeBoundingBox??this.alwaysComputeBoundingBox,this.alwaysComputeSkeletonRootNode=e.alwaysComputeSkeletonRootNode??this.alwaysComputeSkeletonRootNode,this.animationStartMode=e.animationStartMode??this.animationStartMode,this.capturePerformanceCounters=e.capturePerformanceCounters??this.capturePerformanceCounters,this.compileMaterials=e.compileMaterials??this.compileMaterials,this.compileShadowGenerators=e.compileShadowGenerators??this.compileShadowGenerators,this.coordinateSystemMode=e.coordinateSystemMode??this.coordinateSystemMode,this.createInstances=e.createInstances??this.createInstances,this.customRootNode=e.customRootNode,this.extensionOptions=e.extensionOptions??this.extensionOptions,this.loadAllMaterials=e.loadAllMaterials??this.loadAllMaterials,this.loadMorphTargets=e.loadMorphTargets??this.loadMorphTargets,this.loadNodeAnimations=e.loadNodeAnimations??this.loadNodeAnimations,this.loadOnlyMaterials=e.loadOnlyMaterials??this.loadOnlyMaterials,this.loadSkins=e.loadSkins??this.loadSkins,this.loggingEnabled=e.loggingEnabled??this.loggingEnabled,this.onCameraLoaded=e.onCameraLoaded,this.onMaterialLoaded=e.onMaterialLoaded,this.onMeshLoaded=e.onMeshLoaded,this.onParsed=e.onParsed,this.onSkinLoaded=e.onSkinLoaded,this.onTextureLoaded=e.onTextureLoaded,this.onValidated=e.onValidated,this.preprocessUrlAsync=e.preprocessUrlAsync??this.preprocessUrlAsync,this.skipMaterials=e.skipMaterials??this.skipMaterials,this.targetFps=e.targetFps??this.targetFps,this.transparencyAsCoverage=e.transparencyAsCoverage??this.transparencyAsCoverage,this.useClipPlane=e.useClipPlane??this.useClipPlane,this.useGltfTextureNames=e.useGltfTextureNames??this.useGltfTextureNames,this.useOpenPBR=e.useOpenPBR??this.useOpenPBR,this.useRangeRequests=e.useRangeRequests??this.useRangeRequests,this.useSRGBBuffers=e.useSRGBBuffers??this.useSRGBBuffers,this.validate=e.validate??this.validate,this.dontUseTransmissionHelper=e.dontUseTransmissionHelper??this.dontUseTransmissionHelper)}}class R extends Je{constructor(e){super(),this.onParsedObservable=new x,this.onMeshLoadedObservable=new x,this.onSkinLoadedObservable=new x,this.onTextureLoadedObservable=new x,this.onMaterialLoadedObservable=new x,this.onCameraLoadedObservable=new x,this.onCompleteObservable=new x,this.onErrorObservable=new x,this.onDisposeObservable=new x,this.onExtensionLoadedObservable=new x,this.onValidatedObservable=new x,this._loader=null,this._state=null,this._requests=new Array,this.name=K.name,this.extensions=K.extensions,this.onLoaderStateChangedObservable=new x,this._logIndentLevel=0,this._loggingEnabled=!1,this._log=this._logDisabled,this._capturePerformanceCounters=!1,this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled,this.copyFrom(Object.assign({...ze},e))}set onParsed(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),e&&(this._onParsedObserver=this.onParsedObservable.add(e))}set onMeshLoaded(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),e&&(this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e))}set onSkinLoaded(e){this._onSkinLoadedObserver&&this.onSkinLoadedObservable.remove(this._onSkinLoadedObserver),e&&(this._onSkinLoadedObserver=this.onSkinLoadedObservable.add(t=>e(t.node,t.skinnedNode)))}set onTextureLoaded(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),e&&(this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e))}set onMaterialLoaded(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),e&&(this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e))}set onCameraLoaded(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),e&&(this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e))}set onComplete(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)}set onError(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}set onExtensionLoaded(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)}get loggingEnabled(){return this._loggingEnabled}set loggingEnabled(e){this._loggingEnabled!==e&&(this._loggingEnabled=e,this._loggingEnabled?this._log=this._logEnabled:this._log=this._logDisabled)}get capturePerformanceCounters(){return this._capturePerformanceCounters}set capturePerformanceCounters(e){this._capturePerformanceCounters!==e&&(this._capturePerformanceCounters=e,this._capturePerformanceCounters?(this._startPerformanceCounter=this._startPerformanceCounterEnabled,this._endPerformanceCounter=this._endPerformanceCounterEnabled):(this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled))}set onValidated(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)}dispose(){this._loader&&(this._loader.dispose(),this._loader=null);for(const e of this._requests)e.abort();this._requests.length=0,delete this._progressCallback,this.preprocessUrlAsync=e=>Promise.resolve(e),this.onMeshLoadedObservable.clear(),this.onSkinLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(void 0),this.onDisposeObservable.clear()}loadFile(e,t,s,n,i,r,o,a){if(ArrayBuffer.isView(t))return this._loadBinary(e,t,s,n,o,a),null;this._progressCallback=i;const l=t.name||S.GetFilename(t);if(r){if(this.useRangeRequests){this.validate&&T.Warn("glTF validation is not supported when range requests are enabled");const h={abort:()=>{},onCompleteObservable:new x},u={readAsync:(d,p)=>new Promise((_,O)=>{this._loadFile(e,t,M=>{_(new Uint8Array(M))},!0,M=>{O(M)},M=>{M.setRequestHeader("Range",`bytes=${d}-${d+p-1}`)})}),byteLength:0};return this._unpackBinaryAsync(new Q(u)).then(d=>{h.onCompleteObservable.notifyObservers(h),n(d)},o?d=>o(void 0,d):void 0),h}return this._loadFile(e,t,h=>{this._validate(e,new Uint8Array(h,0,h.byteLength),s,l),this._unpackBinaryAsync(new Q({readAsync:(u,d)=>he(h,u,d),byteLength:h.byteLength})).then(u=>{n(u)},o?u=>o(void 0,u):void 0)},!0,o)}else return this._loadFile(e,t,h=>{try{this._validate(e,h,s,l),n({json:this._parseJson(h)})}catch{o&&o()}},!1,o)}_loadBinary(e,t,s,n,i,r){this._validate(e,new Uint8Array(t.buffer,t.byteOffset,t.byteLength),s,r),this._unpackBinaryAsync(new Q({readAsync:(o,a)=>qe(t,o,a),byteLength:t.byteLength})).then(o=>{n(o)},i?o=>i(void 0,o):void 0)}importMeshAsync(e,t,s,n,i,r){return Promise.resolve().then(()=>(this.onParsedObservable.notifyObservers(s),this.onParsedObservable.clear(),this._log(`Loading ${r||""}`),this._loader=this._getLoader(s),this._loader.importMeshAsync(e,t,null,s,n,i,r)))}loadAsync(e,t,s,n,i){return Promise.resolve().then(()=>(this.onParsedObservable.notifyObservers(t),this.onParsedObservable.clear(),this._log(`Loading ${i||""}`),this._loader=this._getLoader(t),this._loader.loadAsync(e,t,s,n,i)))}loadAssetContainerAsync(e,t,s,n,i){return Promise.resolve().then(()=>{this.onParsedObservable.notifyObservers(t),this.onParsedObservable.clear(),this._log(`Loading ${i||""}`),this._loader=this._getLoader(t);const r=new Ze(e),o=[];this.onMaterialLoadedObservable.add(u=>{o.push(u)});const a=[];this.onTextureLoadedObservable.add(u=>{a.push(u)});const l=[];this.onCameraLoadedObservable.add(u=>{l.push(u)});const h=[];return this.onMeshLoadedObservable.add(u=>{u.morphTargetManager&&h.push(u.morphTargetManager)}),this._loader.importMeshAsync(null,e,r,t,s,n,i).then(u=>(Array.prototype.push.apply(r.geometries,u.geometries),Array.prototype.push.apply(r.meshes,u.meshes),Array.prototype.push.apply(r.particleSystems,u.particleSystems),Array.prototype.push.apply(r.skeletons,u.skeletons),Array.prototype.push.apply(r.animationGroups,u.animationGroups),Array.prototype.push.apply(r.materials,o),Array.prototype.push.apply(r.textures,a),Array.prototype.push.apply(r.lights,u.lights),Array.prototype.push.apply(r.transformNodes,u.transformNodes),Array.prototype.push.apply(r.cameras,l),Array.prototype.push.apply(r.morphTargetManagers,h),r))})}canDirectLoad(e){return K.canDirectLoad(e)}directLoad(e,t){if(t.startsWith("base64,"+H)||t.startsWith(";base64,"+H)||t.startsWith("application/octet-stream;base64,"+H)||t.startsWith("model/gltf-binary;base64,"+H)){const s=ce(t);return this._validate(e,new Uint8Array(s,0,s.byteLength)),this._unpackBinaryAsync(new Q({readAsync:(n,i)=>he(s,n,i),byteLength:s.byteLength}))}return this._validate(e,t),Promise.resolve({json:this._parseJson(t)})}createPlugin(e){return new R(e[K.name])}get loaderState(){return this._state}whenCompleteAsync(){return new Promise((e,t)=>{this.onCompleteObservable.addOnce(()=>{e()}),this.onErrorObservable.addOnce(s=>{t(s)})})}_setState(e){this._state!==e&&(this._state=e,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(k[this._state]))}_loadFile(e,t,s,n,i,r){const o=e._loadFile(t,s,a=>{this._onProgress(a,o)},!0,n,i,r);return o.onCompleteObservable.add(()=>{o._lengthComputable=!0,o._total=o._loaded}),this._requests.push(o),o}_onProgress(e,t){if(!this._progressCallback)return;t._lengthComputable=e.lengthComputable,t._loaded=e.loaded,t._total=e.total;let s=!0,n=0,i=0;for(const r of this._requests){if(r._lengthComputable===void 0||r._loaded===void 0||r._total===void 0)return;s=s&&r._lengthComputable,n+=r._loaded,i+=r._total}this._progressCallback({lengthComputable:s,loaded:n,total:s?i:0})}_validate(e,t,s="",n=""){this.validate&&(this._startPerformanceCounter("Validate JSON"),fe.ValidateAsync(t,s,n,i=>this.preprocessUrlAsync(s+i).then(r=>e._loadFileAsync(r,void 0,!0,!0).then(o=>new Uint8Array(o,0,o.byteLength)))).then(i=>{this._endPerformanceCounter("Validate JSON"),this.onValidatedObservable.notifyObservers(i),this.onValidatedObservable.clear()},i=>{this._endPerformanceCounter("Validate JSON"),S.Warn(`Failed to validate: ${i.message}`),this.onValidatedObservable.clear()}))}_getLoader(e){const t=e.json.asset||{};this._log(`Asset version: ${t.version}`),t.minVersion&&this._log(`Asset minimum version: ${t.minVersion}`),t.generator&&this._log(`Asset generator: ${t.generator}`);const s=R._parseVersion(t.version);if(!s)throw new Error("Invalid version: "+t.version);if(t.minVersion!==void 0){const r=R._parseVersion(t.minVersion);if(!r)throw new Error("Invalid minimum version: "+t.minVersion);if(R._compareVersion(r,{major:2,minor:0})>0)throw new Error("Incompatible minimum version: "+t.minVersion)}const i={1:R._CreateGLTF1Loader,2:R._CreateGLTF2Loader}[s.major];if(!i)throw new Error("Unsupported version: "+t.version);return i(this)}_parseJson(e){this._startPerformanceCounter("Parse JSON"),this._log(`JSON length: ${e.length}`);const t=JSON.parse(e);return this._endPerformanceCounter("Parse JSON"),t}_unpackBinaryAsync(e){return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then(()=>{const t={Magic:1179937895},s=e.readUint32();if(s!==t.Magic)throw new Oe("Unexpected magic: "+s,Pe.GLTFLoaderUnexpectedMagicError);const n=e.readUint32();this.loggingEnabled&&this._log(`Binary version: ${n}`);const i=e.readUint32();!this.useRangeRequests&&i!==e.buffer.byteLength&&T.Warn(`Length in header does not match actual data length: ${i} != ${e.buffer.byteLength}`);let r;switch(n){case 1:{r=this._unpackBinaryV1Async(e,i);break}case 2:{r=this._unpackBinaryV2Async(e,i);break}default:throw new Error("Unsupported version: "+n)}return this._endPerformanceCounter("Unpack Binary"),r})}_unpackBinaryV1Async(e,t){const s={JSON:0},n=e.readUint32(),i=e.readUint32();if(i!==s.JSON)throw new Error(`Unexpected content format: ${i}`);const r=t-e.byteOffset,o={json:this._parseJson(e.readString(n)),bin:null};if(r!==0){const a=e.byteOffset;o.bin={readAsync:(l,h)=>e.buffer.readAsync(a+l,h),byteLength:r}}return Promise.resolve(o)}_unpackBinaryV2Async(e,t){const s={JSON:1313821514,BIN:5130562},n=e.readUint32();if(e.readUint32()!==s.JSON)throw new Error("First chunk format is not JSON");return e.byteOffset+n===t?e.loadAsync(n).then(()=>({json:this._parseJson(e.readString(n)),bin:null})):e.loadAsync(n+8).then(()=>{const r={json:this._parseJson(e.readString(n)),bin:null},o=()=>{const a=e.readUint32();switch(e.readUint32()){case s.JSON:throw new Error("Unexpected JSON chunk");case s.BIN:{const h=e.byteOffset;r.bin={readAsync:(u,d)=>e.buffer.readAsync(h+u,d),byteLength:a},e.skipBytes(a);break}default:{e.skipBytes(a);break}}return e.byteOffset!==t?e.loadAsync(8).then(o):Promise.resolve(r)};return o()})}static _parseVersion(e){if(e==="1.0"||e==="1.0.1")return{major:1,minor:0};const t=(e+"").match(/^(\d+)\.(\d+)/);return t?{major:parseInt(t[1]),minor:parseInt(t[2])}:null}static _compareVersion(e,t){return e.major>t.major?1:e.majort.minor?1:e.minorG(()=>import("./animationGroup-CCzMCPMh.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),je=new _e(()=>G(()=>import("./glTFLoaderAnimation-Dy3q9t_h.js"),__vite__mapDeps([5,1,2,3,6]),import.meta.url));class f{static Get(e,t,s){if(!t||s==null||!t[s])throw new Error(`${e}: Failed to find index (${s})`);return t[s]}static TryGet(e,t){return!e||t==null||!e[t]?null:e[t]}static Assign(e){if(e)for(let t=0;te.dispose&&e.dispose()),this._extensions.length=0,this._gltf=null,this._bin=null,this._babylonScene=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions.length=0,this._parent.dispose())}async importMeshAsync(e,t,s,n,i,r,o=""){return await Promise.resolve().then(async()=>{this._babylonScene=t,this._assetContainer=s,this._loadData(n);let a=null;if(e){const l={};if(this._gltf.nodes)for(const u of this._gltf.nodes)u.name&&(l[u.name]=u.index);a=(e instanceof Array?e:[e]).map(u=>{const d=l[u];if(d===void 0)throw new Error(`Failed to find node '${u}'`);return d})}return await this._loadAsync(i,o,a,()=>({meshes:this._getMeshes(),particleSystems:[],skeletons:this._getSkeletons(),animationGroups:this._getAnimationGroups(),lights:this._babylonLights,transformNodes:this._getTransformNodes(),geometries:this._getGeometries(),spriteManagers:[]}))})}async loadAsync(e,t,s,n,i=""){return this._babylonScene=e,this._loadData(t),await this._loadAsync(s,i,null,()=>{})}async _loadAsync(e,t,s,n){return await Promise.resolve().then(async()=>{this._rootUrl=e,this._uniqueRootUrl=!e.startsWith("file:")&&t?e:`${e}${Date.now()}/`,this._fileName=t,this._allMaterialsDirtyRequired=!1,await this._loadExtensionsAsync(),!this.parent.skipMaterials&&this._pbrMaterialImpl==null&&(this.parent.useOpenPBR||this.isExtensionUsed("KHR_materials_openpbr")?this._pbrMaterialImpl={materialClass:(await G(async()=>{const{OpenPBRMaterial:h}=await import("./openpbrMaterial-527Jzq5y.js");return{OpenPBRMaterial:h}},__vite__mapDeps([7,2,3,1]),import.meta.url)).OpenPBRMaterial,adapterClass:(await G(async()=>{const{OpenPBRMaterialLoadingAdapter:h}=await import("./openpbrMaterialLoadingAdapter-DUmKUa7I.js");return{OpenPBRMaterialLoadingAdapter:h}},[],import.meta.url)).OpenPBRMaterialLoadingAdapter}:this._pbrMaterialImpl={materialClass:(await G(async()=>{const{PBRMaterial:h}=await import("./index-CDrXokXW.js").then(u=>u.cw);return{PBRMaterial:h}},__vite__mapDeps([1,2,3]),import.meta.url)).PBRMaterial,adapterClass:(await G(async()=>{const{PBRMaterialLoadingAdapter:h}=await import("./pbrMaterialLoadingAdapter-BV-CpLvi.js");return{PBRMaterialLoadingAdapter:h}},__vite__mapDeps([8,1,2,3]),import.meta.url)).PBRMaterialLoadingAdapter});const i=`${k[k.LOADING]} => ${k[k.READY]}`,r=`${k[k.LOADING]} => ${k[k.COMPLETE]}`;this._parent._startPerformanceCounter(i),this._parent._startPerformanceCounter(r),this._parent._setState(k.LOADING),this._extensionsOnLoading();const o=new Array,a=this._babylonScene.blockMaterialDirtyMechanism;if(this._babylonScene.blockMaterialDirtyMechanism=!0,!this.parent.loadOnlyMaterials){if(s)o.push(this.loadSceneAsync("/nodes",{nodes:s,index:-1}));else if(this._gltf.scene!=null||this._gltf.scenes&&this._gltf.scenes[0]){const h=f.Get("/scene",this._gltf.scenes,this._gltf.scene||0);o.push(this.loadSceneAsync(`/scenes/${h.index}`,h))}}if(!this.parent.skipMaterials&&this.parent.loadAllMaterials&&this._gltf.materials)for(let h=0;h{}))}return this._allMaterialsDirtyRequired?this._babylonScene.blockMaterialDirtyMechanism=a:this._babylonScene._forceBlockMaterialDirtyMechanism(a),this._parent.compileMaterials&&o.push(this._compileMaterialsAsync()),this._parent.compileShadowGenerators&&o.push(this._compileShadowGeneratorsAsync()),await Promise.all(o).then(()=>{this._rootBabylonMesh&&this._rootBabylonMesh!==this._parent.customRootNode&&this._rootBabylonMesh.setEnabled(!0);for(const h of this._babylonScene.materials){const u=h;u.maxSimultaneousLights!==void 0&&(u.maxSimultaneousLights=Math.max(u.maxSimultaneousLights,this._babylonScene.lights.length))}return this._extensionsOnReady(),this._parent._setState(k.READY),this._skipStartAnimationStep||this._startAnimations(),n()}).then(h=>(this._parent._endPerformanceCounter(i),S.SetImmediate(()=>{this._disposed||Promise.all(this._completePromises).then(()=>{this._parent._endPerformanceCounter(r),this._parent._setState(k.COMPLETE),this._parent.onCompleteObservable.notifyObservers(void 0),this._parent.onCompleteObservable.clear(),this.dispose()},u=>{this._parent.onErrorObservable.notifyObservers(u),this._parent.onErrorObservable.clear(),this.dispose()})}),h))}).catch(i=>{throw this._disposed||(this._parent.onErrorObservable.notifyObservers(i),this._parent.onErrorObservable.clear(),this.dispose()),i})}_loadData(e){if(this._gltf=e.json,this._setupData(),e.bin){const t=this._gltf.buffers;if(t&&t[0]&&!t[0].uri){const s=t[0];(s.byteLengthe.bin.byteLength)&&T.Warn(`Binary buffer length (${s.byteLength}) from JSON does not match chunk length (${e.bin.byteLength})`),this._bin=e.bin}else T.Warn("Unexpected BIN chunk")}}_setupData(){if(f.Assign(this._gltf.accessors),f.Assign(this._gltf.animations),f.Assign(this._gltf.buffers),f.Assign(this._gltf.bufferViews),f.Assign(this._gltf.cameras),f.Assign(this._gltf.images),f.Assign(this._gltf.materials),f.Assign(this._gltf.meshes),f.Assign(this._gltf.nodes),f.Assign(this._gltf.samplers),f.Assign(this._gltf.scenes),f.Assign(this._gltf.skins),f.Assign(this._gltf.textures),this._gltf.nodes){const e={};for(const s of this._gltf.nodes)if(s.children)for(const n of s.children)e[n]=s.index;const t=this._createRootNode();for(const s of this._gltf.nodes){const n=e[s.index];s.parent=n===void 0?t:this._gltf.nodes[n]}}}async _loadExtensionsAsync(){const e=[];if(Re.forEach((t,s)=>{this.parent.extensionOptions[s]?.enabled===!1?t.isGLTFExtension&&this.isExtensionUsed(s)&&T.Warn(`Extension ${s} is used but has been explicitly disabled.`):(!t.isGLTFExtension||this.isExtensionUsed(s))&&e.push((async()=>{const n=await t.factory(this);return n.name!==s&&T.Warn(`The name of the glTF loader extension instance does not match the registered name: ${n.name} !== ${s}`),this._parent.onExtensionLoadedObservable.notifyObservers(n),n})())}),this._extensions.push(...await Promise.all(e)),this._extensions.sort((t,s)=>(t.order||Number.MAX_VALUE)-(s.order||Number.MAX_VALUE)),this._parent.onExtensionLoadedObservable.clear(),this._gltf.extensionsRequired){for(const t of this._gltf.extensionsRequired)if(!this._extensions.some(n=>n.name===t&&n.enabled))throw this.parent.extensionOptions[t]?.enabled===!1?new Error(`Required extension ${t} is disabled`):new Error(`Required extension ${t} is not available`)}}_createRootNode(){if(this._parent.customRootNode!==void 0)return this._rootBabylonMesh=this._parent.customRootNode,{_babylonTransformNode:this._rootBabylonMesh===null?void 0:this._rootBabylonMesh,index:-1};this._babylonScene._blockEntityCollection=!!this._assetContainer;const e=new oe("__root__",this._babylonScene);this._rootBabylonMesh=e,this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);const t={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case Y.AUTO:{this._babylonScene.useRightHandedSystem||(t.rotation=[0,1,0,0],t.scale=[1,1,-1],A._LoadTransform(t,this._rootBabylonMesh));break}case Y.FORCE_RIGHT_HANDED:{this._babylonScene.useRightHandedSystem=!0;break}default:throw new Error(`Invalid coordinate system mode (${this._parent.coordinateSystemMode})`)}return this._parent.onMeshLoadedObservable.notifyObservers(e),t}loadSceneAsync(e,t){const s=this._extensionsLoadSceneAsync(e,t);if(s)return s;const n=new Array;if(this.logOpen(`${e} ${t.name||""}`),t.nodes)for(const i of t.nodes){const r=f.Get(`${e}/nodes/${i}`,this._gltf.nodes,i);n.push(this.loadNodeAsync(`/nodes/${r.index}`,r,o=>{o.parent=this._rootBabylonMesh}))}for(const i of this._postSceneLoadActions)i();return n.push(this._loadAnimationsAsync()),this.logClose(),Promise.all(n).then(()=>{})}_forEachPrimitive(e,t){if(e._primitiveBabylonMeshes)for(const s of e._primitiveBabylonMeshes)t(s)}_getGeometries(){const e=[],t=this._gltf.nodes;if(t)for(const s of t)this._forEachPrimitive(s,n=>{const i=n.geometry;i&&e.indexOf(i)===-1&&e.push(i)});return e}_getMeshes(){const e=[];this._rootBabylonMesh instanceof Ie&&e.push(this._rootBabylonMesh);const t=this._gltf.nodes;if(t)for(const s of t)this._forEachPrimitive(s,n=>{e.push(n)});return e}_getTransformNodes(){const e=[],t=this._gltf.nodes;if(t)for(const s of t)s._babylonTransformNode&&s._babylonTransformNode.getClassName()==="TransformNode"&&e.push(s._babylonTransformNode),s._babylonTransformNodeForSkin&&e.push(s._babylonTransformNodeForSkin);return e}_getSkeletons(){const e=[],t=this._gltf.skins;if(t)for(const s of t)s._data&&e.push(s._data.babylonSkeleton);return e}_getAnimationGroups(){const e=[],t=this._gltf.animations;if(t)for(const s of t)s._babylonAnimationGroup&&e.push(s._babylonAnimationGroup);return e}_startAnimations(){switch(this._parent.animationStartMode){case W.NONE:break;case W.FIRST:{const e=this._getAnimationGroups();e.length!==0&&e[0].start(!0);break}case W.ALL:{const e=this._getAnimationGroups();for(const t of e)t.start(!0);break}default:{T.Error(`Invalid animation start mode (${this._parent.animationStartMode})`);return}}}loadNodeAsync(e,t,s=()=>{}){const n=this._extensionsLoadNodeAsync(e,t,s);if(n)return n;if(t._babylonTransformNode)throw new Error(`${e}: Invalid recursive node hierarchy`);const i=new Array;this.logOpen(`${e} ${t.name||""}`);const r=l=>{if(A.AddPointerMetadata(l,e),A._LoadTransform(t,l),t.camera!=null){const h=f.Get(`${e}/camera`,this._gltf.cameras,t.camera);i.push(this.loadCameraAsync(`/cameras/${h.index}`,h,u=>{u.parent=l,this._babylonScene.useRightHandedSystem||(l.scaling.x=-1)}))}if(t.children)for(const h of t.children){const u=f.Get(`${e}/children/${h}`,this._gltf.nodes,h);i.push(this.loadNodeAsync(`/nodes/${u.index}`,u,d=>{d.parent=l}))}s(l)},o=t.mesh!=null,a=this._parent.loadSkins&&t.skin!=null;if(!o||a){const l=t.name||`node${t.index}`;this._babylonScene._blockEntityCollection=!!this._assetContainer;const h=new ae(l,this._babylonScene);h._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t.mesh==null?t._babylonTransformNode=h:t._babylonTransformNodeForSkin=h,r(h)}if(o)if(a){const l=f.Get(`${e}/mesh`,this._gltf.meshes,t.mesh);i.push(this._loadMeshAsync(`/meshes/${l.index}`,t,l,h=>{const u=t._babylonTransformNodeForSkin;h.metadata=Le(u.metadata,h.metadata||{});const d=f.Get(`${e}/skin`,this._gltf.skins,t.skin);i.push(this._loadSkinAsync(`/skins/${d.index}`,t,d,p=>{this._forEachPrimitive(t,_=>{_.skeleton=p}),this._postSceneLoadActions.push(()=>{if(d.skeleton!=null){const _=f.Get(`/skins/${d.index}/skeleton`,this._gltf.nodes,d.skeleton).parent;t.index===_.index?h.parent=u.parent:h.parent=_._babylonTransformNode}else h.parent=this._rootBabylonMesh;this._parent.onSkinLoadedObservable.notifyObservers({node:u,skinnedNode:h})})}))}))}else{const l=f.Get(`${e}/mesh`,this._gltf.meshes,t.mesh);i.push(this._loadMeshAsync(`/meshes/${l.index}`,t,l,r))}return this.logClose(),Promise.all(i).then(()=>(this._forEachPrimitive(t,l=>{const h=l;!h.isAnInstance&&h.geometry&&h.geometry.useBoundingInfoFromGeometry?l._updateBoundingInfo():l.refreshBoundingInfo(!0,!0)}),t._babylonTransformNode))}_loadMeshAsync(e,t,s,n){const i=s.primitives;if(!i||!i.length)throw new Error(`${e}: Primitives are missing`);i[0].index==null&&f.Assign(i);const r=new Array;this.logOpen(`${e} ${s.name||""}`);const o=t.name||`node${t.index}`;if(i.length===1){const a=s.primitives[0];r.push(this._loadMeshPrimitiveAsync(`${e}/primitives/${a.index}`,o,t,s,a,l=>{t._babylonTransformNode=l,t._primitiveBabylonMeshes=[l]}))}else{this._babylonScene._blockEntityCollection=!!this._assetContainer,t._babylonTransformNode=new ae(o,this._babylonScene),t._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._primitiveBabylonMeshes=[];for(const a of i)r.push(this._loadMeshPrimitiveAsync(`${e}/primitives/${a.index}`,`${o}_primitive${a.index}`,t,s,a,l=>{l.parent=t._babylonTransformNode,t._primitiveBabylonMeshes.push(l)}))}return n(t._babylonTransformNode),this.logClose(),Promise.all(r).then(()=>t._babylonTransformNode)}_loadMeshPrimitiveAsync(e,t,s,n,i,r){const o=this._extensionsLoadMeshPrimitiveAsync(e,t,s,n,i,r);if(o)return o;this.logOpen(`${e}`);const a=this._disableInstancedMesh===0&&this._parent.createInstances&&s.skin==null&&!n.primitives[0].targets;let l,h;if(a&&i._instanceData)this._babylonScene._blockEntityCollection=!!this._assetContainer,l=i._instanceData.babylonSourceMesh.createInstance(t),l._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,h=i._instanceData.promise;else{const u=new Array;this._babylonScene._blockEntityCollection=!!this._assetContainer;const d=new oe(t,this._babylonScene);if(d._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,d.sideOrientation=this._babylonScene.useRightHandedSystem?$.CounterClockWiseSideOrientation:$.ClockWiseSideOrientation,this._createMorphTargets(e,s,n,i,d),u.push(this._loadVertexDataAsync(e,i,d).then(async p=>await this._loadMorphTargetsAsync(e,i,d,p).then(()=>{this._disposed||(this._babylonScene._blockEntityCollection=!!this._assetContainer,p.applyToMesh(d),p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1)}))),!this.parent.skipMaterials){const p=A._GetDrawMode(e,i.mode);if(i.material==null){let _=this._defaultBabylonMaterialData[p];_||(_=this._createDefaultMaterial("__GLTFLoader._default",p),this._parent.onMaterialLoadedObservable.notifyObservers(_),this._defaultBabylonMaterialData[p]=_),d.material=_}else{const _=f.Get(`${e}/material`,this._gltf.materials,i.material);u.push(this._loadMaterialAsync(`/materials/${_.index}`,_,d,p,O=>{d.material=O}))}}h=Promise.all(u),a&&(i._instanceData={babylonSourceMesh:d,promise:h}),l=d}return A.AddPointerMetadata(l,e),this._parent.onMeshLoadedObservable.notifyObservers(l),r(l),this.logClose(),h.then(()=>l)}_loadVertexDataAsync(e,t,s){const n=this._extensionsLoadVertexDataAsync(e,t,s);if(n)return n;const i=t.attributes;if(!i)throw new Error(`${e}: Attributes are missing`);const r=new Array,o=new De(s.name,this._babylonScene);if(t.indices==null)s.isUnIndexed=!0;else{const l=f.Get(`${e}/indices`,this._gltf.accessors,t.indices);r.push(this._loadIndicesAccessorAsync(`/accessors/${l.index}`,l).then(h=>{o.setIndices(h)}))}const a=(l,h,u)=>{if(i[l]==null)return;s._delayInfo=s._delayInfo||[],s._delayInfo.indexOf(h)===-1&&s._delayInfo.push(h);const d=f.Get(`${e}/attributes/${l}`,this._gltf.accessors,i[l]);r.push(this._loadVertexAccessorAsync(`/accessors/${d.index}`,d,h).then(p=>{if(p.getKind()===m.PositionKind&&!this.parent.alwaysComputeBoundingBox&&!s.skeleton){const _=et(d);_&&(o._boundingInfo=_,o.useBoundingInfoFromGeometry=!0)}o.setVerticesBuffer(p,d.count)})),h==m.MatricesIndicesExtraKind&&(s.numBoneInfluencers=8),u&&u(d)};return a("POSITION",m.PositionKind),a("NORMAL",m.NormalKind),a("TANGENT",m.TangentKind),a("TEXCOORD_0",m.UVKind),a("TEXCOORD_1",m.UV2Kind),a("TEXCOORD_2",m.UV3Kind),a("TEXCOORD_3",m.UV4Kind),a("TEXCOORD_4",m.UV5Kind),a("TEXCOORD_5",m.UV6Kind),a("JOINTS_0",m.MatricesIndicesKind),a("WEIGHTS_0",m.MatricesWeightsKind),a("JOINTS_1",m.MatricesIndicesExtraKind),a("WEIGHTS_1",m.MatricesWeightsExtraKind),a("COLOR_0",m.ColorKind,l=>{l.type==="VEC4"&&(s.hasVertexAlpha=!0)}),Promise.all(r).then(()=>o)}_createMorphTargets(e,t,s,n,i){if(!n.targets||!this._parent.loadMorphTargets)return;if(t._numMorphTargets==null)t._numMorphTargets=n.targets.length;else if(n.targets.length!==t._numMorphTargets)throw new Error(`${e}: Primitives do not have the same number of targets`);const r=s.extras?s.extras.targetNames:null;this._babylonScene._blockEntityCollection=!!this._assetContainer,i.morphTargetManager=new L(this._babylonScene),i.morphTargetManager._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,i.morphTargetManager.areUpdatesFrozen=!0;for(let o=0;o{r.areUpdatesFrozen=!1})}async _loadMorphTargetVertexDataAsync(e,t,s,n){const i=new Array,r=(o,a,l)=>{if(s[o]==null)return;const h=t.getVertexBuffer(a);if(!h)return;const u=f.Get(`${e}/${o}`,this._gltf.accessors,s[o]);i.push(this._loadFloatAccessorAsync(`/accessors/${u.index}`,u).then(d=>{l(h,d)}))};return r("POSITION",m.PositionKind,(o,a)=>{const l=new Float32Array(a.length);o.forEach(a.length,(h,u)=>{l[u]=a[u]+h}),n.setPositions(l)}),r("NORMAL",m.NormalKind,(o,a)=>{const l=new Float32Array(a.length);o.forEach(l.length,(h,u)=>{l[u]=a[u]+h}),n.setNormals(l)}),r("TANGENT",m.TangentKind,(o,a)=>{const l=new Float32Array(a.length/3*4);let h=0;o.forEach(a.length/3*4,(u,d)=>{(d+1)%4!==0&&(l[h]=a[h]+u,h++)}),n.setTangents(l)}),r("TEXCOORD_0",m.UVKind,(o,a)=>{const l=new Float32Array(a.length);o.forEach(a.length,(h,u)=>{l[u]=a[u]+h}),n.setUVs(l)}),r("TEXCOORD_1",m.UV2Kind,(o,a)=>{const l=new Float32Array(a.length);o.forEach(a.length,(h,u)=>{l[u]=a[u]+h}),n.setUV2s(l)}),r("COLOR_0",m.ColorKind,(o,a)=>{let l=null;const h=o.getSize();if(h===3){l=new Float32Array(a.length/3*4),o.forEach(a.length,(u,d)=>{const p=Math.floor(d/3),_=d%3;l[4*p+_]=a[3*p+_]+u});for(let u=0;u{l[d]=a[d]+u});else throw new Error(`${e}: Invalid number of components (${h}) for COLOR_0 attribute`);n.setColors(l)}),await Promise.all(i).then(()=>{})}static _LoadTransform(e,t){if(e.skin!=null)return;let s=v.Zero(),n=q.Identity(),i=v.One();e.matrix?B.FromArray(e.matrix).decompose(i,n,s):(e.translation&&(s=v.FromArray(e.translation)),e.rotation&&(n=q.FromArray(e.rotation)),e.scale&&(i=v.FromArray(e.scale))),t.position=s,t.rotationQuaternion=n,t.scaling=i}_loadSkinAsync(e,t,s,n){if(!this._parent.loadSkins)return Promise.resolve();const i=this._extensionsLoadSkinAsync(e,t,s);if(i)return i;if(s._data)return n(s._data.babylonSkeleton),s._data.promise;const r=`skeleton${s.index}`;this._babylonScene._blockEntityCollection=!!this._assetContainer;const o=new Ye(s.name||r,r,this._babylonScene);o._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,s,o);const a=this._loadSkinInverseBindMatricesDataAsync(e,s).then(l=>{this._updateBoneMatrices(o,l)});return s._data={babylonSkeleton:o,promise:a},n(o),a}_loadBones(e,t,s){if(t.skeleton==null||this._parent.alwaysComputeSkeletonRootNode){const i=this._findSkeletonRootNode(`${e}/joints`,t.joints);if(i)if(t.skeleton===void 0)t.skeleton=i.index;else{const r=(a,l)=>{for(;l.parent;l=l.parent)if(l.parent===a)return!0;return!1},o=f.Get(`${e}/skeleton`,this._gltf.nodes,t.skeleton);o!==i&&!r(o,i)&&(T.Warn(`${e}/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root`),t.skeleton=i.index)}else T.Warn(`${e}: Failed to find common root`)}const n={};for(const i of t.joints){const r=f.Get(`${e}/joints/${i}`,this._gltf.nodes,i);this._loadBone(r,t,s,n)}}_findSkeletonRootNode(e,t){if(t.length===0)return null;const s={};for(const i of t){const r=[];let o=f.Get(`${e}/${i}`,this._gltf.nodes,i);for(;o.index!==-1;)r.unshift(o),o=o.parent;s[i]=r}let n=null;for(let i=0;;++i){let r=s[t[0]];if(i>=r.length)return n;const o=r[i];for(let a=1;a=r.length||o!==r[i])return n;n=o}}_loadBone(e,t,s,n){e._isJoint=!0;let i=n[e.index];if(i)return i;let r=null;e.index!==t.skeleton&&(e.parent&&e.parent.index!==-1?r=this._loadBone(e.parent,t,s,n):t.skeleton!==void 0&&T.Warn(`/skins/${t.index}/skeleton: Skeleton node is not a common root`));const o=t.joints.indexOf(e.index);return i=new Xe(e.name||`joint${e.index}`,s,r,this._getNodeMatrix(e),null,null,o),n[e.index]=i,this._postSceneLoadActions.push(()=>{i.linkTransformNode(e._babylonTransformNode)}),i}_loadSkinInverseBindMatricesDataAsync(e,t){if(t.inverseBindMatrices==null)return Promise.resolve(null);const s=f.Get(`${e}/inverseBindMatrices`,this._gltf.accessors,t.inverseBindMatrices);return this._loadFloatAccessorAsync(`/accessors/${s.index}`,s)}_updateBoneMatrices(e,t){for(const s of e.bones){const n=B.Identity(),i=s._index;t&&i!==-1&&(B.FromArrayToRef(t,i*16,n),n.invertToRef(n));const r=s.getParent();r&&n.multiplyToRef(r.getAbsoluteInverseBindMatrix(),n),s.updateMatrix(n,!1,!1),s._updateAbsoluteBindMatrices(void 0,!1)}}_getNodeMatrix(e){return e.matrix?B.FromArray(e.matrix):B.Compose(e.scale?v.FromArray(e.scale):v.One(),e.rotation?q.FromArray(e.rotation):q.Identity(),e.translation?v.FromArray(e.translation):v.Zero())}loadCameraAsync(e,t,s=()=>{}){const n=this._extensionsLoadCameraAsync(e,t,s);if(n)return n;const i=new Array;this.logOpen(`${e} ${t.name||""}`),this._babylonScene._blockEntityCollection=!!this._assetContainer;const r=new X(t.name||`camera${t.index}`,v.Zero(),this._babylonScene,!1);switch(r._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._babylonCamera=r,r.setTarget(new v(0,0,-1)),t.type){case"perspective":{const o=t.perspective;if(!o)throw new Error(`${e}: Camera perspective properties are missing`);r.fov=o.yfov,r.minZ=o.znear,r.maxZ=o.zfar||0;break}case"orthographic":{if(!t.orthographic)throw new Error(`${e}: Camera orthographic properties are missing`);r.mode=Ne.ORTHOGRAPHIC_CAMERA,r.orthoLeft=-t.orthographic.xmag,r.orthoRight=t.orthographic.xmag,r.orthoBottom=-t.orthographic.ymag,r.orthoTop=t.orthographic.ymag,r.minZ=t.orthographic.znear,r.maxZ=t.orthographic.zfar;break}default:throw new Error(`${e}: Invalid camera type (${t.type})`)}return A.AddPointerMetadata(r,e),this._parent.onCameraLoadedObservable.notifyObservers(r),s(r),this.logClose(),Promise.all(i).then(()=>r)}_loadAnimationsAsync(){this._parent._startPerformanceCounter("Load animations");const e=this._gltf.animations;if(!e)return Promise.resolve();const t=new Array;for(let s=0;s{i.targetedAnimations.length===0&&i.dispose()}))}return Promise.all(t).then(()=>{this._parent._endPerformanceCounter("Load animations")})}loadAnimationAsync(e,t){this._parent._startPerformanceCounter("Load animation");const s=this._extensionsLoadAnimationAsync(e,t);return s||Qe.value.then(({AnimationGroup:n})=>{this._babylonScene._blockEntityCollection=!!this._assetContainer;const i=new n(t.name||`animation${t.index}`,this._babylonScene);i._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._babylonAnimationGroup=i;const r=new Array;f.Assign(t.channels),f.Assign(t.samplers);for(const o of t.channels)r.push(this._loadAnimationChannelAsync(`${e}/channels/${o.index}`,e,t,o,(a,l)=>{a.animations=a.animations||[],a.animations.push(l),i.addTargetedAnimation(l,a)}));return this._parent._endPerformanceCounter("Load animation"),Promise.all(r).then(()=>(i.normalize(0),i))})}_loadAnimationChannelAsync(e,t,s,n,i){const r=this._extensionsLoadAnimationChannelAsync(e,t,s,n,i);if(r)return r;if(n.target.node==null)return Promise.resolve();const o=f.Get(`${e}/target/node`,this._gltf.nodes,n.target.node),a=n.target.path,l=a==="weights";return l&&!o._numMorphTargets||!l&&!o._babylonTransformNode||!this._parent.loadNodeAnimations&&!l&&!o._isJoint?Promise.resolve():je.value.then(()=>{let h;switch(a){case"translation":{h=J("/nodes/{}/translation")?.interpolation;break}case"rotation":{h=J("/nodes/{}/rotation")?.interpolation;break}case"scale":{h=J("/nodes/{}/scale")?.interpolation;break}case"weights":{h=J("/nodes/{}/weights")?.interpolation;break}default:throw new Error(`${e}/target/path: Invalid value (${n.target.path})`)}if(!h)throw new Error(`${e}/target/path: Could not find interpolation properties for target path (${n.target.path})`);const u={object:o,info:h};return this._loadAnimationChannelFromTargetInfoAsync(e,t,s,n,u,i)})}_loadAnimationChannelFromTargetInfoAsync(e,t,s,n,i,r){const o=this.parent.targetFps,a=1/o,l=f.Get(`${e}/sampler`,s.samplers,n.sampler);return this._loadAnimationSamplerAsync(`${t}/samplers/${n.sampler}`,l).then(h=>{let u=0;const d=i.object,p=i.info;for(const _ of p){const O=_.getStride(d),M=h.input,V=h.output,N=new Array(M.length);let P=0;switch(h.interpolation){case"STEP":{for(let C=0;C0){const C=`${s.name||`animation${s.index}`}_channel${n.index}_${u}`,U=_.buildAnimations(d,C,o,N);for(const Z of U)u++,r(Z.babylonAnimatable,Z.babylonAnimation)}}})}_loadAnimationSamplerAsync(e,t){if(t._data)return t._data;const s=t.interpolation||"LINEAR";switch(s){case"STEP":case"LINEAR":case"CUBICSPLINE":break;default:throw new Error(`${e}/interpolation: Invalid value (${t.interpolation})`)}const n=f.Get(`${e}/input`,this._gltf.accessors,t.input),i=f.Get(`${e}/output`,this._gltf.accessors,t.output);return t._data=Promise.all([this._loadFloatAccessorAsync(`/accessors/${n.index}`,n),this._loadFloatAccessorAsync(`/accessors/${i.index}`,i)]).then(([r,o])=>({input:r,interpolation:s,output:o})),t._data}loadBufferAsync(e,t,s,n){const i=this._extensionsLoadBufferAsync(e,t,s,n);if(i)return i;if(!t._data)if(t.uri)t._data=this.loadUriAsync(`${e}/uri`,t,t.uri);else{if(!this._bin)throw new Error(`${e}: Uri is missing or the binary glTF is missing its binary chunk`);t._data=this._bin.readAsync(0,t.byteLength)}return t._data.then(r=>{try{return new Uint8Array(r.buffer,r.byteOffset+s,n)}catch(o){throw new Error(`${e}: ${o.message}`)}})}loadBufferViewAsync(e,t){const s=this._extensionsLoadBufferViewAsync(e,t);if(s)return s;if(t._data)return t._data;const n=f.Get(`${e}/buffer`,this._gltf.buffers,t.buffer);return t._data=this.loadBufferAsync(`/buffers/${n.index}`,n,t.byteOffset||0,t.byteLength),t._data}_loadAccessorAsync(e,t,s){if(t._data)return t._data;const n=A._GetNumComponents(e,t.type),i=n*m.GetTypeByteLength(t.componentType),r=n*t.count;if(t.bufferView==null)t._data=Promise.resolve(new s(r));else{const o=f.Get(`${e}/bufferView`,this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync(`/bufferViews/${o.index}`,o).then(a=>{if(t.componentType===5126&&!t.normalized&&(!o.byteStride||o.byteStride===i))return A._GetTypedArray(e,t.componentType,a,t.byteOffset,r);{const l=new s(r);return m.ForEach(a,t.byteOffset||0,o.byteStride||i,n,t.componentType,l.length,t.normalized||!1,(h,u)=>{l[u]=h}),l}})}if(t.sparse){const o=t.sparse;t._data=t._data.then(a=>{const l=a,h=f.Get(`${e}/sparse/indices/bufferView`,this._gltf.bufferViews,o.indices.bufferView),u=f.Get(`${e}/sparse/values/bufferView`,this._gltf.bufferViews,o.values.bufferView);return Promise.all([this.loadBufferViewAsync(`/bufferViews/${h.index}`,h),this.loadBufferViewAsync(`/bufferViews/${u.index}`,u)]).then(([d,p])=>{const _=A._GetTypedArray(`${e}/sparse/indices`,o.indices.componentType,d,o.indices.byteOffset,o.count),O=n*o.count;let M;if(t.componentType===5126&&!t.normalized)M=A._GetTypedArray(`${e}/sparse/values`,t.componentType,p,o.values.byteOffset,O);else{const N=A._GetTypedArray(`${e}/sparse/values`,t.componentType,p,o.values.byteOffset,O);M=new s(O),m.ForEach(N,0,i,n,t.componentType,M.length,t.normalized||!1,(P,C)=>{M[C]=P})}let V=0;for(let N=0;N<_.length;N++){let P=_[N]*n;for(let C=0;CA._GetTypedArray(e,t.componentType,n,t.byteOffset,t.count))}return t._data}_loadVertexBufferViewAsync(e){if(e._babylonBuffer)return e._babylonBuffer;const t=this._babylonScene.getEngine();return e._babylonBuffer=this.loadBufferViewAsync(`/bufferViews/${e.index}`,e).then(s=>new $e(t,s,!1)),e._babylonBuffer}_loadVertexAccessorAsync(e,t,s){if(t._babylonVertexBuffer?.[s])return t._babylonVertexBuffer[s];t._babylonVertexBuffer||(t._babylonVertexBuffer={});const n=this._babylonScene.getEngine();if(t.sparse||t.bufferView==null)t._babylonVertexBuffer[s]=this._loadFloatAccessorAsync(e,t).then(i=>new m(n,i,s,!1));else{const i=f.Get(`${e}/bufferView`,this._gltf.bufferViews,t.bufferView);t._babylonVertexBuffer[s]=this._loadVertexBufferViewAsync(i).then(r=>{const o=A._GetNumComponents(e,t.type);return new m(n,r,s,!1,void 0,i.byteStride,void 0,t.byteOffset,o,t.componentType,t.normalized,!0,void 0,!0)})}return t._babylonVertexBuffer[s]}_loadMaterialMetallicRoughnessPropertiesAsync(e,t,s){const n=new Array,i=this._getOrCreateMaterialAdapter(s);return t&&(t.baseColorFactor?(i.baseColor=z.FromArray(t.baseColorFactor),i.geometryOpacity=t.baseColorFactor[3]):i.baseColor=z.White(),i.baseMetalness=t.metallicFactor==null?1:t.metallicFactor,i.specularRoughness=t.roughnessFactor==null?1:t.roughnessFactor,t.baseColorTexture&&n.push(this.loadTextureInfoAsync(`${e}/baseColorTexture`,t.baseColorTexture,r=>{r.name=`${s.name} (Base Color)`,i.baseColorTexture=r})),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture.nonColorData=!0,n.push(this.loadTextureInfoAsync(`${e}/metallicRoughnessTexture`,t.metallicRoughnessTexture,r=>{r.name=`${s.name} (Metallic Roughness)`,i.baseMetalnessTexture=r,i.specularRoughnessTexture=r})),i.useRoughnessFromMetallicTextureGreen=!0,i.useMetallicFromMetallicTextureBlue=!0)),Promise.all(n).then(()=>{})}_loadMaterialAsync(e,t,s,n,i=()=>{}){const r=this._extensionsLoadMaterialAsync(e,t,s,n,i);if(r)return r;t._data=t._data||{};let o=t._data[n];if(!o){this.logOpen(`${e} ${t.name||""}`);const a=this.createMaterial(e,t,n);o={babylonMaterial:a,babylonMeshes:[],promise:this.loadMaterialPropertiesAsync(e,t,a)},t._data[n]=o,A.AddPointerMetadata(a,e),this._parent.onMaterialLoadedObservable.notifyObservers(a),this.logClose()}return s&&(o.babylonMeshes.push(s),s.onDisposeObservable.addOnce(()=>{const a=o.babylonMeshes.indexOf(s);a!==-1&&o.babylonMeshes.splice(a,1)})),i(o.babylonMaterial),o.promise.then(()=>o.babylonMaterial)}_createDefaultMaterial(e,t){if(!this._pbrMaterialImpl)throw new Error("PBR Material class not loaded");this._babylonScene._blockEntityCollection=!!this._assetContainer;const s=new this._pbrMaterialImpl.materialClass(e,this._babylonScene);s._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,s.fillMode=t,s.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_OPAQUE;const n=this._getOrCreateMaterialAdapter(s);return n.transparencyAsAlphaCoverage=this._parent.transparencyAsCoverage,n.baseMetalness=1,n.specularRoughness=1,s}createMaterial(e,t,s){const n=this._extensionsCreateMaterial(e,t,s);if(n)return n;const i=t.name||`material${t.index}`;return this._createDefaultMaterial(i,s)}loadMaterialPropertiesAsync(e,t,s){const n=this._extensionsLoadMaterialPropertiesAsync(e,t,s);if(n)return n;const i=new Array;return i.push(this.loadMaterialBasePropertiesAsync(e,t,s)),t.pbrMetallicRoughness&&i.push(this._loadMaterialMetallicRoughnessPropertiesAsync(`${e}/pbrMetallicRoughness`,t.pbrMetallicRoughness,s)),this.loadMaterialAlphaProperties(e,t,s),Promise.all(i).then(()=>{})}loadMaterialBasePropertiesAsync(e,t,s){const n=new Array,i=this._getOrCreateMaterialAdapter(s);i.emissionColor=t.emissiveFactor?z.FromArray(t.emissiveFactor):new z(0,0,0),t.doubleSided&&(i.backFaceCulling=!1,i.twoSidedLighting=!0),t.normalTexture&&(t.normalTexture.nonColorData=!0,n.push(this.loadTextureInfoAsync(`${e}/normalTexture`,t.normalTexture,l=>{l.name=`${s.name} (Normal)`,i.geometryNormalTexture=l,t.normalTexture?.scale!=null&&(l.level=t.normalTexture.scale)})),i.setNormalMapInversions(!this._babylonScene.useRightHandedSystem,this._babylonScene.useRightHandedSystem));let r,o=1,a;return t.occlusionTexture&&(t.occlusionTexture.nonColorData=!0,n.push(this.loadTextureInfoAsync(`${e}/occlusionTexture`,t.occlusionTexture,l=>{l.name=`${s.name} (Occlusion)`,r=l})),t.occlusionTexture.strength!=null&&(o=t.occlusionTexture.strength)),t.emissiveTexture&&n.push(this.loadTextureInfoAsync(`${e}/emissiveTexture`,t.emissiveTexture,l=>{l.name=`${s.name} (Emissive)`,a=l})),Promise.all(n).then(()=>{r&&(i.ambientOcclusionTexture=r,i.ambientOcclusionTextureStrength=o),a&&(i.emissionColorTexture=a)})}loadMaterialAlphaProperties(e,t,s){if(!this._pbrMaterialImpl)throw new Error(`${e}: Material type not supported`);const n=this._getOrCreateMaterialAdapter(s),i=n.baseColorTexture;switch(t.alphaMode||"OPAQUE"){case"OPAQUE":{s.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_OPAQUE,s.alpha=1;break}case"MASK":{s.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_ALPHATEST,n.alphaCutOff=t.alphaCutoff==null?.5:t.alphaCutoff,i&&(i.hasAlpha=!0);break}case"BLEND":{s.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_ALPHABLEND,i&&(i.hasAlpha=!0,n.useAlphaFromBaseColorTexture=!0);break}default:throw new Error(`${e}/alphaMode: Invalid value (${t.alphaMode})`)}}loadTextureInfoAsync(e,t,s=()=>{}){const n=this._extensionsLoadTextureInfoAsync(e,t,s);if(n)return n;if(this.logOpen(`${e}`),t.texCoord>=6)throw new Error(`${e}/texCoord: Invalid value (${t.texCoord})`);const i=f.Get(`${e}/index`,this._gltf.textures,t.index);i._textureInfo=t;const r=this._loadTextureAsync(`/textures/${t.index}`,i,o=>{o.coordinatesIndex=t.texCoord||0,A.AddPointerMetadata(o,e),this._parent.onTextureLoadedObservable.notifyObservers(o),s(o)});return this.logClose(),r}_loadTextureAsync(e,t,s=()=>{}){const n=this._extensionsLoadTextureAsync(e,t,s);if(n)return n;this.logOpen(`${e} ${t.name||""}`);const i=t.sampler==null?A.DefaultSampler:f.Get(`${e}/sampler`,this._gltf.samplers,t.sampler),r=f.Get(`${e}/source`,this._gltf.images,t.source),o=this._createTextureAsync(e,i,r,s,void 0,!t._textureInfo.nonColorData);return this.logClose(),o}_createTextureAsync(e,t,s,n=()=>{},i,r){const o=this._loadSampler(`/samplers/${t.index}`,t),a=new Array,l=new Ve;this._babylonScene._blockEntityCollection=!!this._assetContainer;const h={noMipmap:o.noMipMaps,invertY:!1,samplingMode:o.samplingMode,onLoad:()=>{this._disposed||l.resolve()},onError:(d,p)=>{this._disposed||l.reject(new Error(`${e}: ${p&&p.message?p.message:d||"Failed to load texture"}`))},mimeType:s.mimeType??Ue(s.uri??""),loaderOptions:i,useSRGBBuffer:!!r&&this._parent.useSRGBBuffers},u=new w(null,this._babylonScene,h);return u._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,a.push(l.promise),a.push(this.loadImageAsync(`/images/${s.index}`,s).then(d=>{const p=s.uri||`${this._fileName}#image${s.index}`,_=`data:${this._uniqueRootUrl}${p}`;u.updateURL(_,d);const O=u.getInternalTexture();O&&(O.label=s.name)})),u.wrapU=o.wrapU,u.wrapV=o.wrapV,n(u),this._parent.useGltfTextureNames&&(u.name=s.name||s.uri||`image${s.index}`),Promise.all(a).then(()=>u)}_loadSampler(e,t){return t._data||(t._data={noMipMaps:t.minFilter===9728||t.minFilter===9729,samplingMode:A._GetTextureSamplingMode(e,t),wrapU:A._GetTextureWrapMode(`${e}/wrapS`,t.wrapS),wrapV:A._GetTextureWrapMode(`${e}/wrapT`,t.wrapT)}),t._data}loadImageAsync(e,t){if(!t._data){if(this.logOpen(`${e} ${t.name||""}`),t.uri)t._data=this.loadUriAsync(`${e}/uri`,t,t.uri);else{const s=f.Get(`${e}/bufferView`,this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync(`/bufferViews/${s.index}`,s)}this.logClose()}return t._data}loadUriAsync(e,t,s){const n=this._extensionsLoadUriAsync(e,t,s);if(n)return n;if(!A._ValidateUri(s))throw new Error(`${e}: '${s}' is invalid`);if(Be(s)){const i=new Uint8Array(ce(s));return this.log(`${e}: Decoded ${s.substring(0,64)}... (${i.length} bytes)`),Promise.resolve(i)}return this.log(`${e}: Loading ${s}`),this._parent.preprocessUrlAsync(this._rootUrl+s).then(i=>new Promise((r,o)=>{this._parent._loadFile(this._babylonScene,i,a=>{this._disposed||(this.log(`${e}: Loaded ${s} (${a.byteLength} bytes)`),r(new Uint8Array(a)))},!0,a=>{o(new Fe(`${e}: Failed to load '${s}'${a?": "+a.status+" "+a.statusText:""}`,a))})}))}static AddPointerMetadata(e,t){e.metadata=e.metadata||{};const s=e._internalMetadata=e._internalMetadata||{},n=s.gltf=s.gltf||{};(n.pointers=n.pointers||[]).push(t)}static _GetTextureWrapMode(e,t){switch(t=t??10497,t){case 33071:return w.CLAMP_ADDRESSMODE;case 33648:return w.MIRROR_ADDRESSMODE;case 10497:return w.WRAP_ADDRESSMODE;default:return T.Warn(`${e}: Invalid value (${t})`),w.WRAP_ADDRESSMODE}}static _GetTextureSamplingMode(e,t){const s=t.magFilter==null?9729:t.magFilter,n=t.minFilter==null?9987:t.minFilter;if(s===9729)switch(n){case 9728:return w.LINEAR_NEAREST;case 9729:return w.LINEAR_LINEAR;case 9984:return w.LINEAR_NEAREST_MIPNEAREST;case 9985:return w.LINEAR_LINEAR_MIPNEAREST;case 9986:return w.LINEAR_NEAREST_MIPLINEAR;case 9987:return w.LINEAR_LINEAR_MIPLINEAR;default:return T.Warn(`${e}/minFilter: Invalid value (${n})`),w.LINEAR_LINEAR_MIPLINEAR}else switch(s!==9728&&T.Warn(`${e}/magFilter: Invalid value (${s})`),n){case 9728:return w.NEAREST_NEAREST;case 9729:return w.NEAREST_LINEAR;case 9984:return w.NEAREST_NEAREST_MIPNEAREST;case 9985:return w.NEAREST_LINEAR_MIPNEAREST;case 9986:return w.NEAREST_NEAREST_MIPLINEAR;case 9987:return w.NEAREST_LINEAR_MIPLINEAR;default:return T.Warn(`${e}/minFilter: Invalid value (${n})`),w.NEAREST_NEAREST_MIPNEAREST}}static _GetTypedArrayConstructor(e,t){try{return Ge(t)}catch(s){throw new Error(`${e}: ${s.message}`)}}static _GetTypedArray(e,t,s,n,i){const r=s.buffer;n=s.byteOffset+(n||0);const o=A._GetTypedArrayConstructor(`${e}/componentType`,t),a=m.GetTypeByteLength(t);return n%a!==0?(T.Warn(`${e}: Copying buffer as byte offset (${n}) is not a multiple of component type byte length (${a})`),new o(r.slice(n,n+i*a),0)):new o(r,n,i)}static _GetNumComponents(e,t){switch(t){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":return 4;case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}throw new Error(`${e}: Invalid type (${t})`)}static _ValidateUri(e){return S.IsBase64(e)||e.indexOf("..")===-1}static _GetDrawMode(e,t){switch(t==null&&(t=4),t){case 0:return $.PointListDrawMode;case 1:return $.LineListDrawMode;case 2:return $.LineLoopDrawMode;case 3:return $.LineStripDrawMode;case 4:return $.TriangleFillMode;case 5:return $.TriangleStripDrawMode;case 6:return $.TriangleFanDrawMode}throw new Error(`${e}: Invalid mesh primitive mode (${t})`)}_compileMaterialsAsync(){this._parent._startPerformanceCounter("Compile materials");const e=new Array;if(this._gltf.materials){for(const t of this._gltf.materials)if(t._data)for(const s in t._data){const n=t._data[s];for(const i of n.babylonMeshes){i.computeWorldMatrix(!0);const r=n.babylonMaterial;e.push(r.forceCompilationAsync(i)),e.push(r.forceCompilationAsync(i,{useInstances:!0})),this._parent.useClipPlane&&(e.push(r.forceCompilationAsync(i,{clipPlane:!0})),e.push(r.forceCompilationAsync(i,{clipPlane:!0,useInstances:!0})))}}}return Promise.all(e).then(()=>{this._parent._endPerformanceCounter("Compile materials")})}_compileShadowGeneratorsAsync(){this._parent._startPerformanceCounter("Compile shadow generators");const e=new Array,t=this._babylonScene.lights;for(const s of t){const n=s.getShadowGenerator();n&&e.push(n.forceCompilationAsync())}return Promise.all(e).then(()=>{this._parent._endPerformanceCounter("Compile shadow generators")})}_forEachExtensions(e){for(const t of this._extensions)t.enabled&&e(t)}_applyExtensions(e,t,s){for(const n of this._extensions)if(n.enabled){const i=`${n.name}.${t}`,r=e;r._activeLoaderExtensionFunctions=r._activeLoaderExtensionFunctions||{};const o=r._activeLoaderExtensionFunctions;if(!o[i]){o[i]=!0;try{const a=s(n);if(a)return a}finally{delete o[i]}}}return null}_extensionsOnLoading(){this._forEachExtensions(e=>e.onLoading&&e.onLoading())}_extensionsOnReady(){this._forEachExtensions(e=>e.onReady&&e.onReady())}_extensionsLoadSceneAsync(e,t){return this._applyExtensions(t,"loadScene",s=>s.loadSceneAsync&&s.loadSceneAsync(e,t))}_extensionsLoadNodeAsync(e,t,s){return this._applyExtensions(t,"loadNode",n=>n.loadNodeAsync&&n.loadNodeAsync(e,t,s))}_extensionsLoadCameraAsync(e,t,s){return this._applyExtensions(t,"loadCamera",n=>n.loadCameraAsync&&n.loadCameraAsync(e,t,s))}_extensionsLoadVertexDataAsync(e,t,s){return this._applyExtensions(t,"loadVertexData",n=>n._loadVertexDataAsync&&n._loadVertexDataAsync(e,t,s))}_extensionsLoadMeshPrimitiveAsync(e,t,s,n,i,r){return this._applyExtensions(i,"loadMeshPrimitive",o=>o._loadMeshPrimitiveAsync&&o._loadMeshPrimitiveAsync(e,t,s,n,i,r))}_extensionsLoadMaterialAsync(e,t,s,n,i){return this._applyExtensions(t,"loadMaterial",r=>r._loadMaterialAsync&&r._loadMaterialAsync(e,t,s,n,i))}_extensionsCreateMaterial(e,t,s){return this._applyExtensions(t,"createMaterial",n=>n.createMaterial&&n.createMaterial(e,t,s))}_extensionsLoadMaterialPropertiesAsync(e,t,s){return this._applyExtensions(t,"loadMaterialProperties",n=>n.loadMaterialPropertiesAsync&&n.loadMaterialPropertiesAsync(e,t,s))}_extensionsLoadTextureInfoAsync(e,t,s){return this._applyExtensions(t,"loadTextureInfo",n=>n.loadTextureInfoAsync&&n.loadTextureInfoAsync(e,t,s))}_extensionsLoadTextureAsync(e,t,s){return this._applyExtensions(t,"loadTexture",n=>n._loadTextureAsync&&n._loadTextureAsync(e,t,s))}_extensionsLoadAnimationAsync(e,t){return this._applyExtensions(t,"loadAnimation",s=>s.loadAnimationAsync&&s.loadAnimationAsync(e,t))}_extensionsLoadAnimationChannelAsync(e,t,s,n,i){return this._applyExtensions(s,"loadAnimationChannel",r=>r._loadAnimationChannelAsync&&r._loadAnimationChannelAsync(e,t,s,n,i))}_extensionsLoadSkinAsync(e,t,s){return this._applyExtensions(s,"loadSkin",n=>n._loadSkinAsync&&n._loadSkinAsync(e,t,s))}_extensionsLoadUriAsync(e,t,s){return this._applyExtensions(t,"loadUri",n=>n._loadUriAsync&&n._loadUriAsync(e,t,s))}_extensionsLoadBufferViewAsync(e,t){return this._applyExtensions(t,"loadBufferView",s=>s.loadBufferViewAsync&&s.loadBufferViewAsync(e,t))}_extensionsLoadBufferAsync(e,t,s,n){return this._applyExtensions(t,"loadBuffer",i=>i.loadBufferAsync&&i.loadBufferAsync(e,t,s,n))}static LoadExtensionAsync(e,t,s,n){if(!t.extensions)return null;const r=t.extensions[s];return r?n(`${e}/extensions/${s}`,r):null}static LoadExtraAsync(e,t,s,n){if(!t.extras)return null;const r=t.extras[s];return r?n(`${e}/extras/${s}`,r):null}isExtensionUsed(e){return!!this._gltf.extensionsUsed&&this._gltf.extensionsUsed.indexOf(e)!==-1}logOpen(e){this._parent._logOpen(e)}logClose(){this._parent._logClose()}log(e){this._parent._log(e)}startPerformanceCounter(e){this._parent._startPerformanceCounter(e)}endPerformanceCounter(e){this._parent._endPerformanceCounter(e)}}A.DefaultSampler={index:-1};R._CreateGLTF2Loader=c=>new A(c);export{f as ArrayItem,R as GLTFFileLoader,A as GLTFLoader,et as LoadBoundingInfoFromPositionAccessor}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/glTFLoaderAnimation-Dy3q9t_h.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/glTFLoaderAnimation-Dy3q9t_h.js new file mode 100644 index 0000000000000000000000000000000000000000..446e4ecd42b5ecadeebcce42b48db730c8d93d7c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/glTFLoaderAnimation-Dy3q9t_h.js @@ -0,0 +1 @@ +import{as as l,ao as c,V as h}from"./index-CDrXokXW.js";import{S as m}from"./objectModelMapping-CGWnurZP.js";import"./index-DWyDLubb.js";function g(r,n,t,e){return h.FromArray(n,t).scaleInPlace(e)}function f(r,n,t,e){return c.FromArray(n,t).scaleInPlace(e)}function y(r,n,t,e){const o=new Array(r._numMorphTargets);for(let i=0;i({frame:a.frame,inTangent:a.inTangent?a.inTangent[s]:void 0,value:a.value[s],outTangent:a.outTangent?a.outTangent[s]:void 0,interpolation:a.interpolation})),!0),n._primitiveBabylonMeshes){for(const a of n._primitiveBabylonMeshes)if(a.morphTargetManager){const A=a.morphTargetManager.getTarget(s),T=b.clone();A.animations.push(T),i.push({babylonAnimatable:A,babylonAnimation:T})}}}return i}}m("/nodes/{}/translation",[new u(l.ANIMATIONTYPE_VECTOR3,"position",g,()=>3)]);m("/nodes/{}/rotation",[new u(l.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",f,()=>4)]);m("/nodes/{}/scale",[new u(l.ANIMATIONTYPE_VECTOR3,"scaling",g,()=>3)]);m("/nodes/{}/weights",[new d(l.ANIMATIONTYPE_FLOAT,"influence",y,r=>r._numMorphTargets)]);export{p as AnimationPropertyInfo,u as TransformNodeAnimationPropertyInfo,d as WeightAnimationPropertyInfo,f as getQuaternion,g as getVector3,y as getWeights}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/glowBlurPostProcess.fragment-9rC-Cuk0.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/glowBlurPostProcess.fragment-9rC-Cuk0.js new file mode 100644 index 0000000000000000000000000000000000000000..0cbc6b1e490558fc616419c080783a8efb0b43bb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/glowBlurPostProcess.fragment-9rC-Cuk0.js @@ -0,0 +1,7 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="glowBlurPostProcessPixelShader",t=`varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform screenSize: vec2f;uniform direction: vec2f;uniform blurWidth: f32;fn getLuminance(color: vec3f)->f32 +{return dot(color, vec3f(0.2126,0.7152,0.0722));} +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var weights: array;weights[0]=0.05;weights[1]=0.1;weights[2]=0.2;weights[3]=0.3;weights[4]=0.2;weights[5]=0.1;weights[6]=0.05;var texelSize: vec2f= vec2f(1.0/uniforms.screenSize.x,1.0/uniforms.screenSize.y);var texelStep: vec2f=texelSize*uniforms.direction*uniforms.blurWidth;var start: vec2f=input.vUV-3.0*texelStep;var baseColor: vec4f= vec4f(0.,0.,0.,0.);var texelOffset: vec2f= vec2f(0.,0.);for (var i: i32=0; i<7; i++) +{var texel: vec4f=textureSample(textureSampler,textureSamplerSampler,start+texelOffset);baseColor=vec4f(baseColor.rgb,baseColor.a+texel.a*weights[i]);var luminance: f32=getLuminance(baseColor.rgb);var luminanceTexel: f32=getLuminance(texel.rgb);var choice: f32=step(luminanceTexel,luminance);baseColor=vec4f(choice*baseColor.rgb+(1.0-choice)*texel.rgb,baseColor.a);texelOffset+=texelStep;} +fragmentOutputs.color=baseColor;}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=t);const i={name:e,shader:t};export{i as glowBlurPostProcessPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/glowBlurPostProcess.fragment-z431ChCJ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/glowBlurPostProcess.fragment-z431ChCJ.js new file mode 100644 index 0000000000000000000000000000000000000000..d83b3886738149a3178b404b65b871be778140c8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/glowBlurPostProcess.fragment-z431ChCJ.js @@ -0,0 +1,7 @@ +import{S as t}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="glowBlurPostProcessPixelShader",r=`varying vec2 vUV;uniform sampler2D textureSampler;uniform vec2 screenSize;uniform vec2 direction;uniform float blurWidth;float getLuminance(vec3 color) +{return dot(color,vec3(0.2126,0.7152,0.0722));} +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) +{float weights[7];weights[0]=0.05;weights[1]=0.1;weights[2]=0.2;weights[3]=0.3;weights[4]=0.2;weights[5]=0.1;weights[6]=0.05;vec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);vec2 texelStep=texelSize*direction*blurWidth;vec2 start=vUV-3.0*texelStep;vec4 baseColor=vec4(0.,0.,0.,0.);vec2 texelOffset=vec2(0.,0.);for (int i=0; i<7; i++) +{vec4 texel=texture2D(textureSampler,start+texelOffset);baseColor.a+=texel.a*weights[i];float luminance=getLuminance(baseColor.rgb);float luminanceTexel=getLuminance(texel.rgb);float choice=step(luminanceTexel,luminance);baseColor.rgb=choice*baseColor.rgb+(1.0-choice)*texel.rgb;texelOffset+=texelStep;} +gl_FragColor=baseColor;}`;t.ShadersStore[e]||(t.ShadersStore[e]=r);const l={name:e,shader:r};export{l as glowBlurPostProcessPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/graph-BVwx8Qtr.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/graph-BVwx8Qtr.js new file mode 100644 index 0000000000000000000000000000000000000000..ff4cd670c66261dbd8d5be84cad6a82539858753 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/graph-BVwx8Qtr.js @@ -0,0 +1 @@ +import{at as T,au as C,av as Z,aw as R,ax as v,ay as k,az as K,aA as L,aB as V,aC as j,aD as ee,aE as te,aF as re,aG as se,aH as ne,aI as ie,an as ae,aJ as oe,aK as ue,aL as he,aM as y,aN as S,aO as $}from"./mermaid.core-7TB2QPZo.js";import{k as d,g as H,s as de,e as ce,f as fe,h as ge,j as le,d as _e,l as be,b as pe,m,n as g,r as ye}from"./_baseUniq-DT1kfcxk.js";function me(t,e){return t&&T(e,d(e),t)}function je(t,e){return t&&T(e,C(e),t)}function Te(t,e){return T(t,H(t),e)}var Oe=Object.getOwnPropertySymbols,Y=Oe?function(t){for(var e=[];t;)ce(e,H(t)),t=Z(t);return e}:de;function Ae(t,e){return T(t,Y(t),e)}function Ee(t){return fe(t,C,Y)}var Ce=Object.prototype,Le=Ce.hasOwnProperty;function we(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Le.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function Ne(t,e){var r=e?R(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Fe=/\w*$/;function Pe(t){var e=new t.constructor(t.source,Fe.exec(t));return e.lastIndex=t.lastIndex,e}var I=v?v.prototype:void 0,D=I?I.valueOf:void 0;function ve(t){return D?Object(D.call(t)):{}}var Se="[object Boolean]",$e="[object Date]",Ie="[object Map]",De="[object Number]",Me="[object RegExp]",Ge="[object Set]",xe="[object String]",Ue="[object Symbol]",Be="[object ArrayBuffer]",Re="[object DataView]",Ke="[object Float32Array]",Ve="[object Float64Array]",He="[object Int8Array]",Ye="[object Int16Array]",qe="[object Int32Array]",Je="[object Uint8Array]",We="[object Uint8ClampedArray]",ze="[object Uint16Array]",Qe="[object Uint32Array]";function Xe(t,e,r){var s=t.constructor;switch(e){case Be:return R(t);case Se:case $e:return new s(+t);case Re:return Ne(t,r);case Ke:case Ve:case He:case Ye:case qe:case Je:case We:case ze:case Qe:return k(t,r);case Ie:return new s;case De:case xe:return new s(t);case Me:return Pe(t);case Ge:return new s;case Ue:return ve(t)}}var Ze="[object Map]";function ke(t){return K(t)&&L(t)==Ze}var M=j&&j.isMap,et=M?V(M):ke,tt="[object Set]";function rt(t){return K(t)&&L(t)==tt}var G=j&&j.isSet,st=G?V(G):rt,nt=1,it=2,at=4,q="[object Arguments]",ot="[object Array]",ut="[object Boolean]",ht="[object Date]",dt="[object Error]",J="[object Function]",ct="[object GeneratorFunction]",ft="[object Map]",gt="[object Number]",W="[object Object]",lt="[object RegExp]",_t="[object Set]",bt="[object String]",pt="[object Symbol]",yt="[object WeakMap]",mt="[object ArrayBuffer]",jt="[object DataView]",Tt="[object Float32Array]",Ot="[object Float64Array]",At="[object Int8Array]",Et="[object Int16Array]",Ct="[object Int32Array]",Lt="[object Uint8Array]",wt="[object Uint8ClampedArray]",Nt="[object Uint16Array]",Ft="[object Uint32Array]",o={};o[q]=o[ot]=o[mt]=o[jt]=o[ut]=o[ht]=o[Tt]=o[Ot]=o[At]=o[Et]=o[Ct]=o[ft]=o[gt]=o[W]=o[lt]=o[_t]=o[bt]=o[pt]=o[Lt]=o[wt]=o[Nt]=o[Ft]=!0;o[dt]=o[J]=o[yt]=!1;function O(t,e,r,s,n,a){var i,u=e&nt,h=e&it,Q=e&at;if(i!==void 0)return i;if(!ee(t))return t;var w=ae(t);if(w){if(i=we(t),!u)return te(t,i)}else{var _=L(t),N=_==J||_==ct;if(re(t))return se(t,u);if(_==W||_==q||N&&!n){if(i=h||N?{}:ne(t),!u)return h?Ae(t,je(i,t)):Te(t,me(i,t))}else{if(!o[_])return n?t:{};i=Xe(t,_,u)}}a||(a=new ie);var F=a.get(t);if(F)return F;a.set(t,i),st(t)?t.forEach(function(c){i.add(O(c,e,r,c,t,a))}):et(t)&&t.forEach(function(c,f){i.set(f,O(c,e,r,f,t,a))});var X=Q?h?Ee:le:h?C:d,P=w?void 0:X(t);return ge(P||t,function(c,f){P&&(f=c,c=t[f]),oe(i,f,O(c,e,r,f,t,a))}),i}function Pt(t,e){return _e(e,function(r){return t[r]})}function A(t){return t==null?[]:Pt(t,d(t))}function b(t){return t===void 0}var vt=ue(function(t){return be(pe(t,1,he,!0))}),St="\0",l="\0",x="";class z{constructor(e={}){this._isDirected=Object.prototype.hasOwnProperty.call(e,"directed")?e.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,"multigraph")?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,"compound")?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=y(void 0),this._defaultEdgeLabelFn=y(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[l]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return S(e)||(e=y(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return d(this._nodes)}sources(){var e=this;return m(this.nodes(),function(r){return $(e._in[r])})}sinks(){var e=this;return m(this.nodes(),function(r){return $(e._out[r])})}setNodes(e,r){var s=arguments,n=this;return g(e,function(a){s.length>1?n.setNode(a,r):n.setNode(a)}),this}setNode(e,r){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=r),this):(this._nodes[e]=arguments.length>1?r:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=l,this._children[e]={},this._children[l][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var r=s=>this.removeEdge(this._edgeObjs[s]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],g(this.children(e),s=>{this.setParent(s)}),delete this._children[e]),g(d(this._in[e]),r),delete this._in[e],delete this._preds[e],g(d(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(b(r))r=l;else{r+="";for(var s=r;!b(s);s=this.parent(s))if(s===e)throw new Error("Setting "+r+" as parent of "+e+" would create a cycle");this.setNode(r)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=r,this._children[r][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var r=this._parent[e];if(r!==l)return r}}children(e){if(b(e)&&(e=l),this._isCompound){var r=this._children[e];if(r)return d(r)}else{if(e===l)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var r=this._preds[e];if(r)return d(r)}successors(e){var r=this._sucs[e];if(r)return d(r)}neighbors(e){var r=this.predecessors(e);if(r)return vt(r,this.successors(e))}isLeaf(e){var r;return this.isDirected()?r=this.successors(e):r=this.neighbors(e),r.length===0}filterNodes(e){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var s=this;g(this._nodes,function(i,u){e(u)&&r.setNode(u,i)}),g(this._edgeObjs,function(i){r.hasNode(i.v)&&r.hasNode(i.w)&&r.setEdge(i,s.edge(i))});var n={};function a(i){var u=s.parent(i);return u===void 0||r.hasNode(u)?(n[i]=u,u):u in n?n[u]:a(u)}return this._isCompound&&g(r.nodes(),function(i){r.setParent(i,a(i))}),r}setDefaultEdgeLabel(e){return S(e)||(e=y(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return A(this._edgeObjs)}setPath(e,r){var s=this,n=arguments;return ye(e,function(a,i){return n.length>1?s.setEdge(a,i,r):s.setEdge(a,i),i}),this}setEdge(){var e,r,s,n,a=!1,i=arguments[0];typeof i=="object"&&i!==null&&"v"in i?(e=i.v,r=i.w,s=i.name,arguments.length===2&&(n=arguments[1],a=!0)):(e=i,r=arguments[1],s=arguments[3],arguments.length>2&&(n=arguments[2],a=!0)),e=""+e,r=""+r,b(s)||(s=""+s);var u=p(this._isDirected,e,r,s);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,u))return a&&(this._edgeLabels[u]=n),this;if(!b(s)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(r),this._edgeLabels[u]=a?n:this._defaultEdgeLabelFn(e,r,s);var h=$t(this._isDirected,e,r,s);return e=h.v,r=h.w,Object.freeze(h),this._edgeObjs[u]=h,U(this._preds[r],e),U(this._sucs[e],r),this._in[r][u]=h,this._out[e][u]=h,this._edgeCount++,this}edge(e,r,s){var n=arguments.length===1?E(this._isDirected,arguments[0]):p(this._isDirected,e,r,s);return this._edgeLabels[n]}hasEdge(e,r,s){var n=arguments.length===1?E(this._isDirected,arguments[0]):p(this._isDirected,e,r,s);return Object.prototype.hasOwnProperty.call(this._edgeLabels,n)}removeEdge(e,r,s){var n=arguments.length===1?E(this._isDirected,arguments[0]):p(this._isDirected,e,r,s),a=this._edgeObjs[n];return a&&(e=a.v,r=a.w,delete this._edgeLabels[n],delete this._edgeObjs[n],B(this._preds[r],e),B(this._sucs[e],r),delete this._in[r][n],delete this._out[e][n],this._edgeCount--),this}inEdges(e,r){var s=this._in[e];if(s){var n=A(s);return r?m(n,function(a){return a.v===r}):n}}outEdges(e,r){var s=this._out[e];if(s){var n=A(s);return r?m(n,function(a){return a.w===r}):n}}nodeEdges(e,r){var s=this.inEdges(e,r);if(s)return s.concat(this.outEdges(e,r))}}z.prototype._nodeCount=0;z.prototype._edgeCount=0;function U(t,e){t[e]?t[e]++:t[e]=1}function B(t,e){--t[e]||delete t[e]}function p(t,e,r,s){var n=""+e,a=""+r;if(!t&&n>a){var i=n;n=a,a=i}return n+x+a+x+(b(s)?St:s)}function $t(t,e,r,s){var n=""+e,a=""+r;if(!t&&n>a){var i=n;n=a,a=i}var u={v:n,w:a};return s&&(u.name=s),u}function E(t,e){return p(t,e.v,e.w,e.name)}export{z as G,O as b,b as i,A as v}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/harmonicsFunctions-DjLTZRig.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/harmonicsFunctions-DjLTZRig.js new file mode 100644 index 0000000000000000000000000000000000000000..58e8615cb8a3c52435c1313183b9e92d630c03a0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/harmonicsFunctions-DjLTZRig.js @@ -0,0 +1,16 @@ +import{S as r}from"./index-CDrXokXW.js";const a="harmonicsFunctions",e=`#ifdef USESPHERICALFROMREFLECTIONMAP +#ifdef SPHERICAL_HARMONICS +fn computeEnvironmentIrradiance(normal: vec3f)->vec3f {return uniforms.vSphericalL00 ++ uniforms.vSphericalL1_1*(normal.y) ++ uniforms.vSphericalL10*(normal.z) ++ uniforms.vSphericalL11*(normal.x) ++ uniforms.vSphericalL2_2*(normal.y*normal.x) ++ uniforms.vSphericalL2_1*(normal.y*normal.z) ++ uniforms.vSphericalL20*((3.0*normal.z*normal.z)-1.0) ++ uniforms.vSphericalL21*(normal.z*normal.x) ++ uniforms.vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));} +#else +fn computeEnvironmentIrradiance(normal: vec3f)->vec3f {var Nx: f32=normal.x;var Ny: f32=normal.y;var Nz: f32=normal.z;var C1: vec3f=uniforms.vSphericalZZ.rgb;var Cx: vec3f=uniforms.vSphericalX.rgb;var Cy: vec3f=uniforms.vSphericalY.rgb;var Cz: vec3f=uniforms.vSphericalZ.rgb;var Cxx_zz: vec3f=uniforms.vSphericalXX_ZZ.rgb;var Cyy_zz: vec3f=uniforms.vSphericalYY_ZZ.rgb;var Cxy: vec3f=uniforms.vSphericalXY.rgb;var Cyz: vec3f=uniforms.vSphericalYZ.rgb;var Czx: vec3f=uniforms.vSphericalZX.rgb;var a1: vec3f=Cyy_zz*Ny+Cy;var a2: vec3f=Cyz*Nz+a1;var b1: vec3f=Czx*Nz+Cx;var b2: vec3f=Cxy*Ny+b1;var b3: vec3f=Cxx_zz*Nx+b2;var t1: vec3f=Cz *Nz+C1;var t2: vec3f=a2 *Ny+t1;var t3: vec3f=b3 *Nx+t2;return t3;} +#endif +#endif +`;r.IncludesShadersStoreWGSL[a]||(r.IncludesShadersStoreWGSL[a]=e); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/harmonicsFunctions-O6-VFzXR.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/harmonicsFunctions-O6-VFzXR.js new file mode 100644 index 0000000000000000000000000000000000000000..0f82a90fe298f6ee5d1d70682f922f701e00468a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/harmonicsFunctions-O6-VFzXR.js @@ -0,0 +1,16 @@ +import{S as r}from"./index-CDrXokXW.js";const e="harmonicsFunctions",a=`#ifdef USESPHERICALFROMREFLECTIONMAP +#ifdef SPHERICAL_HARMONICS +vec3 computeEnvironmentIrradiance(vec3 normal) {return vSphericalL00 ++ vSphericalL1_1*(normal.y) ++ vSphericalL10*(normal.z) ++ vSphericalL11*(normal.x) ++ vSphericalL2_2*(normal.y*normal.x) ++ vSphericalL2_1*(normal.y*normal.z) ++ vSphericalL20*((3.0*normal.z*normal.z)-1.0) ++ vSphericalL21*(normal.z*normal.x) ++ vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));} +#else +vec3 computeEnvironmentIrradiance(vec3 normal) {float Nx=normal.x;float Ny=normal.y;float Nz=normal.z;vec3 C1=vSphericalZZ.rgb;vec3 Cx=vSphericalX.rgb;vec3 Cy=vSphericalY.rgb;vec3 Cz=vSphericalZ.rgb;vec3 Cxx_zz=vSphericalXX_ZZ.rgb;vec3 Cyy_zz=vSphericalYY_ZZ.rgb;vec3 Cxy=vSphericalXY.rgb;vec3 Cyz=vSphericalYZ.rgb;vec3 Czx=vSphericalZX.rgb;vec3 a1=Cyy_zz*Ny+Cy;vec3 a2=Cyz*Nz+a1;vec3 b1=Czx*Nz+Cx;vec3 b2=Cxy*Ny+b1;vec3 b3=Cxx_zz*Nx+b2;vec3 t1=Cz *Nz+C1;vec3 t2=a2 *Ny+t1;vec3 t3=b3 *Nx+t2;return t3;} +#endif +#endif +`;r.IncludesShadersStore[e]||(r.IncludesShadersStore[e]=a); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdr-mXhboeO4.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdr-mXhboeO4.js new file mode 100644 index 0000000000000000000000000000000000000000..1e3f71f62e4c324bb7a71b7b91d1008d01636397 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdr-mXhboeO4.js @@ -0,0 +1,2 @@ +import{V as h}from"./index-CDrXokXW.js";class b{static ConvertPanoramaToCubemap(e,a,t,n,o=!1,s=!0){if(!e)throw"ConvertPanoramaToCubemap: input cannot be null";let l=0;if(e.length!=a*t*3){if(e.length!=a*t*4)throw"ConvertPanoramaToCubemap: input size is wrong";l=4}else l=3;const w=this.CreateCubemapTexture(n,this.FACE_FRONT,e,a,t,o,s,l),f=this.CreateCubemapTexture(n,this.FACE_BACK,e,a,t,o,s,l),C=this.CreateCubemapTexture(n,this.FACE_LEFT,e,a,t,o,s,l),u=this.CreateCubemapTexture(n,this.FACE_RIGHT,e,a,t,o,s,l),c=this.CreateCubemapTexture(n,this.FACE_UP,e,a,t,o,s,l),i=this.CreateCubemapTexture(n,this.FACE_DOWN,e,a,t,o,s,l);return{front:w,back:f,left:C,right:u,up:c,down:i,size:n,type:1,format:4,gammaSpace:!1}}static CreateCubemapTexture(e,a,t,n,o,s,l,w){const f=new ArrayBuffer(e*e*4*3),C=new Float32Array(f),u=s?Math.max(1,Math.round(n/4/e)):1,c=1/u,i=c*c,d=a[1].subtract(a[0]).scale(c/e),R=a[3].subtract(a[2]).scale(c/e),m=1/e;let F=0;for(let M=0;MMath.PI;)l-=2*Math.PI;let f=l/Math.PI;const C=w/Math.PI;f=f*.5+.5;let u=Math.round(f*t);u<0?u=0:u>=t&&(u=t-1);let c=Math.round(C*n);c<0?c=0:c>=n&&(c=n-1);const i=s?n-c-1:c,d=a[i*t*o+u*o+0],R=a[i*t*o+u*o+1],m=a[i*t*o+u*o+2];return{r:d,g:R,b:m}}}b.FACE_LEFT=[new h(-1,-1,-1),new h(1,-1,-1),new h(-1,1,-1),new h(1,1,-1)];b.FACE_RIGHT=[new h(1,-1,1),new h(-1,-1,1),new h(1,1,1),new h(-1,1,1)];b.FACE_FRONT=[new h(1,-1,-1),new h(1,-1,1),new h(1,1,-1),new h(1,1,1)];b.FACE_BACK=[new h(-1,-1,1),new h(-1,-1,-1),new h(-1,1,1),new h(-1,1,-1)];b.FACE_DOWN=[new h(1,1,-1),new h(1,1,1),new h(-1,1,-1),new h(-1,1,1)];b.FACE_UP=[new h(-1,-1,-1),new h(-1,-1,1),new h(1,-1,-1),new h(1,-1,1)];function D(r,e){return e>1023?r*Math.pow(2,1023)*Math.pow(2,e-1023):e<-1074?r*Math.pow(2,-1074)*Math.pow(2,e+1074):r*Math.pow(2,e)}function L(r,e,a,t,n,o){n>0?(n=D(1,n-136),r[o+0]=e*n,r[o+1]=a*n,r[o+2]=t*n):(r[o+0]=0,r[o+1]=0,r[o+2]=0)}function A(r,e){let a="",t="";for(let n=e;n32767)throw"HDR Bad header format, unsupported size";return s+=t.length+1,{height:e,width:a,dataPosition:s}}function j(r,e,a=!1){const t=new Uint8Array(r),n=G(t),o=O(t,n);return b.ConvertPanoramaToCubemap(o,n.width,n.height,e,a)}function O(r,e){return N(r,e)}function N(r,e){let a=e.height;const t=e.width;let n,o,s,l,w,f=e.dataPosition,C=0,u=0,c=0;const i=new ArrayBuffer(t*4),d=new Uint8Array(i),R=new ArrayBuffer(e.width*e.height*4*3),m=new Float32Array(R);for(;a>0;){if(n=r[f++],o=r[f++],s=r[f++],l=r[f++],n!=2||o!=2||s&128||e.width<8||e.width>32767)return U(r,e);if((s<<8|l)!=t)throw"HDR Bad header format, wrong scan line width";for(C=0,c=0;c<4;c++)for(u=(c+1)*t;C128){if(w=n-128,w==0||w>u-C)throw"HDR Bad Format, bad scanline data (run)";for(;w-- >0;)d[C++]=o}else{if(w=n,w==0||w>u-C)throw"HDR Bad Format, bad scanline data (non-run)";if(d[C++]=o,--w>0)for(let F=0;F0;){for(w=0;wi.map(i=>d[i]); +import{az as M,V as i,aE as R,aD as F,B as I,M as b,O as P,T as L,d as A,ay as E,aP as v,br as x,aO as y,R as D}from"./index-CDrXokXW.js";import{af as u}from"./index-DWyDLubb.js";import{I as W}from"./iblCdfGenerator-BLPdciVw.js";import{G as z}from"./hdr-mXhboeO4.js";import"./rawTexture-DYLCXHMF.js";class G{constructor(e,t={}){this._lodGenerationOffset=0,this._lodGenerationScale=.8,this.quality=4096,this.hdrScale=1,this._engine=e,this.hdrScale=t.hdrScale||this.hdrScale,this.quality=t.quality||this.quality}_createRenderTarget(e){let t=0;this._engine.getCaps().textureHalfFloatRender?t=2:this._engine.getCaps().textureFloatRender&&(t=1);const r=this._engine.createRenderTargetCubeTexture(e,{format:5,type:t,createMipMaps:!0,generateMipMaps:!1,generateDepthBuffer:!1,generateStencilBuffer:!1,samplingMode:1,label:"HDR_Radiance_Filtering_Target"});return this._engine.updateTextureWrappingMode(r.texture,0,0,0),this._engine.updateTextureSamplingMode(3,r.texture,!0),r}_prefilterInternal(e){const t=e.getSize().width,r=M(t)+1,a=this._effectWrapper.effect,h=this._createRenderTarget(t);this._effectRenderer.saveStates(),this._effectRenderer.setViewport();const d=e.getInternalTexture();d&&this._engine.updateTextureSamplingMode(3,d,!0),this._effectRenderer.applyEffectWrapper(this._effectWrapper);const f=[[new i(0,0,-1),new i(0,-1,0),new i(1,0,0)],[new i(0,0,1),new i(0,-1,0),new i(-1,0,0)],[new i(1,0,0),new i(0,0,1),new i(0,1,0)],[new i(1,0,0),new i(0,0,-1),new i(0,-1,0)],[new i(1,0,0),new i(0,-1,0),new i(0,0,1)],[new i(-1,0,0),new i(0,-1,0),new i(0,0,-1)]];a.setFloat("hdrScale",this.hdrScale),a.setFloat2("vFilteringInfo",e.getSize().width,r),a.setTexture("inputTexture",e);for(let c=0;c<6;c++){a.setVector3("up",f[c][0]),a.setVector3("right",f[c][1]),a.setVector3("front",f[c][2]);for(let s=0;s{a?await Promise.all([u(()=>import("./hdrFiltering.vertex-DL245Icy.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),u(()=>import("./hdrFiltering.fragment-DtaP2HM6.js"),__vite__mapDeps([4,1,2,3,5,6,7]),import.meta.url)]):await Promise.all([u(()=>import("./hdrFiltering.vertex-B3AES5as.js"),__vite__mapDeps([8,1,2,3]),import.meta.url),u(()=>import("./hdrFiltering.fragment-OKtxhlkY.js"),__vite__mapDeps([9,1,2,3,10,11,12]),import.meta.url)])}})}isReady(e){return e.isReady()&&this._effectWrapper.effect.isReady()}async prefilter(e){if(!this._engine._features.allowTexturePrefiltering)throw new Error("HDR prefiltering is not available in WebGL 1., you can use real time filtering instead.");this._effectRenderer=new F(this._engine),this._effectWrapper=this._createEffect(e),await this._effectWrapper.effect.whenCompiledAsync(),this._prefilterInternal(e),this._effectRenderer.dispose(),this._effectWrapper.dispose()}}class O{constructor(e,t={}){this.quality=4096,this.hdrScale=1,this.useCdf=!1,this._engine=e,this.hdrScale=t.hdrScale||this.hdrScale,this.quality=t.quality||this.quality,this.useCdf=t.useCdf||this.useCdf}_createRenderTarget(e){let t=0;this._engine.getCaps().textureHalfFloatRender?t=2:this._engine.getCaps().textureFloatRender&&(t=1);const r=this._engine.createRenderTargetCubeTexture(e,{format:5,type:t,createMipMaps:!1,generateMipMaps:!1,generateDepthBuffer:!1,generateStencilBuffer:!1,samplingMode:2,label:"HDR_Irradiance_Filtering_Target"});return this._engine.updateTextureWrappingMode(r.texture,0,0,0),r}_prefilterInternal(e){const t=e.getSize().width,r=M(t),a=this._effectWrapper.effect,h=Math.max(32,1<>3)),d=this._createRenderTarget(h);this._effectRenderer.saveStates(),this._effectRenderer.setViewport(),this._effectRenderer.applyEffectWrapper(this._effectWrapper);const f=[[new i(0,0,-1),new i(0,-1,0),new i(1,0,0)],[new i(0,0,1),new i(0,-1,0),new i(-1,0,0)],[new i(1,0,0),new i(0,0,1),new i(0,1,0)],[new i(1,0,0),new i(0,0,-1),new i(0,-1,0)],[new i(1,0,0),new i(0,-1,0),new i(0,0,1)],[new i(-1,0,0),new i(0,-1,0),new i(0,0,-1)]];a.setFloat("hdrScale",this.hdrScale),a.setFloat2("vFilteringInfo",e.getSize().width,r),a.setTexture("inputTexture",e),this._cdfGenerator&&a.setTexture("icdfTexture",this._cdfGenerator.getIcdfTexture());for(let o=0;o<6;o++)a.setVector3("up",f[o][0]),a.setVector3("right",f[o][1]),a.setVector3("front",f[o][2]),this._engine.bindFramebuffer(d,o,void 0,void 0,!0),this._effectRenderer.applyEffectWrapper(this._effectWrapper),this._effectRenderer.draw();this._effectRenderer.restoreStates(),this._engine.restoreDefaultFramebuffer(),a.setTexture("inputTexture",null),a.setTexture("icdfTexture",null);const l=new I(e.getScene(),d.texture);return l.name=e.name+"_irradiance",l.displayName=e.name+"_irradiance",l.gammaSpace=!1,l}_createEffect(e,t){const r=[];e.gammaSpace&&r.push("#define GAMMA_INPUT"),r.push("#define NUM_SAMPLES "+this.quality+"u");const a=this._engine.isWebGPU,h=["inputTexture"];return this._cdfGenerator&&(h.push("icdfTexture"),r.push("#define IBL_CDF_FILTERING")),new R({engine:this._engine,name:"HDRIrradianceFiltering",vertexShader:"hdrIrradianceFiltering",fragmentShader:"hdrIrradianceFiltering",samplerNames:h,uniformNames:["vSampleDirections","vWeights","up","right","front","vFilteringInfo","hdrScale"],useShaderStore:!0,defines:r,onCompiled:t,shaderLanguage:a?1:0,extraInitializationsAsync:async()=>{a?await Promise.all([u(()=>import("./hdrIrradianceFiltering.vertex-BdW9s4Cf.js"),__vite__mapDeps([13,1,2,3]),import.meta.url),u(()=>import("./hdrIrradianceFiltering.fragment-BouJGbEm.js"),__vite__mapDeps([14,1,2,3,5,6,7]),import.meta.url)]):await Promise.all([u(()=>import("./hdrIrradianceFiltering.vertex-CT4kZIfm.js"),__vite__mapDeps([15,1,2,3]),import.meta.url),u(()=>import("./hdrIrradianceFiltering.fragment-Kt5IUBnY.js"),__vite__mapDeps([16,1,2,3,10,11,12]),import.meta.url)])}})}isReady(e){return e.isReady()&&this._effectWrapper.effect.isReady()}async prefilter(e){if(!this._engine._features.allowTexturePrefiltering)throw new Error("HDR prefiltering is not available in WebGL 1., you can use real time filtering instead.");this.useCdf&&(this._cdfGenerator=new W(this._engine),this._cdfGenerator.iblSource=e,await this._cdfGenerator.renderWhenReady()),this._effectRenderer=new F(this._engine),this._effectWrapper=this._createEffect(e),await this._effectWrapper.effect.whenCompiledAsync();const t=this._prefilterInternal(e);return this.useCdf&&await this._cdfGenerator.findDominantDirection().then(r=>{t._dominantDirection=r}),this._effectRenderer.dispose(),this._effectWrapper.dispose(),this._cdfGenerator?.dispose(),t}}class p extends I{set isBlocking(e){this._isBlocking=e}get isBlocking(){return this._isBlocking}set rotationY(e){this._rotationY=e,this.setReflectionTextureMatrix(b.RotationY(this._rotationY))}get rotationY(){return this._rotationY}set boundingBoxSize(e){if(this._boundingBoxSize&&this._boundingBoxSize.equals(e))return;this._boundingBoxSize=e;const t=this.getScene();t&&t.markAllMaterialsAsDirty(1)}get boundingBoxSize(){return this._boundingBoxSize}constructor(e,t,r,a=!1,h=!0,d=!1,f=!1,l=null,o=null,c=!1,s=!1,n=!1){super(t),this._generateHarmonics=!0,this._onError=null,this._isBlocking=!0,this._rotationY=0,this.boundingBoxPosition=i.Zero(),this.onLoadObservable=new P,e&&(this._coordinatesMode=L.CUBIC_MODE,this.name=e,this.url=e,this.hasAlpha=!1,this.isCube=!0,this._textureMatrix=b.Identity(),this._prefilterOnLoad=f,this._prefilterIrradianceOnLoad=s,this._prefilterUsingCdf=n,this._onLoad=()=>{this.onLoadObservable.notifyObservers(this),l&&l()},this._onError=o,this.gammaSpace=d,this._noMipmap=a,this._size=r,this._supersample=c||n,this._generateHarmonics=h,this._texture=this._getFromCache(e,this._noMipmap,void 0,void 0,void 0,this.isCube),this._texture?this._texture.isReady?A.SetImmediate(()=>this._onLoad()):this._texture.onLoadedObservable.add(this._onLoad):this.getScene()?.useDelayedTextureLoading?this.delayLoadState=4:this._loadTexture())}getClassName(){return"EnvCubeTexture"}_loadTexture(){const e=this._getEngine(),t=e.getCaps();let r=0;t.textureFloat&&t.textureFloatLinearFiltering?r=1:t.textureHalfFloat&&t.textureHalfFloatLinearFiltering&&(r=2);const a=async h=>{this.lodGenerationOffset=0,this.lodGenerationScale=.8;const d=await this._getCubeMapTextureDataAsync(h,this._size,this._supersample);if(this._generateHarmonics){const c=v.ConvertCubeMapToSphericalPolynomial(d);this.sphericalPolynomial=c}const f=[];let l=null,o=null;for(let c=0;c<6;c++){r===2?o=new Uint16Array(this._size*this._size*3):r===0&&(l=new Uint8Array(this._size*this._size*3));const s=d[p._FacesMapping[c]];if(this.gammaSpace||o||l){for(let n=0;n255){const S=255/T;g*=S,m*=S,w*=S}l[n*3+0]=g,l[n*3+1]=m,l[n*3+2]=w}}o?f.push(o):l?f.push(l):f.push(s)}return f};if(e._features.allowTexturePrefiltering&&(this._prefilterOnLoad||this._prefilterIrradianceOnLoad)){const h=this._onLoad,d=new G(e);this._onLoad=()=>{let f=Promise.resolve(null),l=Promise.resolve();this._prefilterIrradianceOnLoad&&(f=new O(e,{useCdf:this._prefilterUsingCdf}).prefilter(this)),this._prefilterOnLoad&&(l=d.prefilter(this)),Promise.all([f,l]).then(o=>{const c=o[0];if(this._prefilterIrradianceOnLoad&&c){this.irradianceTexture=c;const s=this.getScene();s&&s.markAllMaterialsAsDirty(1)}h&&h()})}}this._texture=e.createRawCubeTextureFromUrl(this.url,this.getScene(),this._size,4,r,this._noMipmap,a,null,this._onLoad,this._onError),!this._generateHarmonics&&!this._texture._sphericalPolynomial&&(this._texture._sphericalPolynomial=new E)}delayLoad(){this.delayLoadState===4&&(this.delayLoadState=1,this._texture=this._getFromCache(this.url,this._noMipmap),this._texture||this._loadTexture())}getReflectionTextureMatrix(){return this._textureMatrix}setReflectionTextureMatrix(e){this._textureMatrix=e,e.updateFlag!==this._textureMatrix.updateFlag&&e.isIdentity()!==this._textureMatrix.isIdentity()&&this.getScene()?.markAllMaterialsAsDirty(1,t=>t.getActiveTextures().indexOf(this)!==-1)}dispose(){this.onLoadObservable.clear(),super.dispose()}serialize(){if(!this.name)return null;const e={};return e.name=this.name,e.hasAlpha=this.hasAlpha,e.isCube=!0,e.level=this.level,e.size=this._size,e.coordinatesMode=this.coordinatesMode,e.useInGammaSpace=this.gammaSpace,e.generateHarmonics=this._generateHarmonics,e.noMipmap=this._noMipmap,e.isBlocking=this._isBlocking,e.rotationY=this._rotationY,e}clone(){const e=this._instantiateClone();return e.level=this.level,e.wrapU=this.wrapU,e.wrapV=this.wrapV,e.coordinatesIndex=this.coordinatesIndex,e.coordinatesMode=this.coordinatesMode,e}static _Parse(e,t){t.name=e.name,t.hasAlpha=e.hasAlpha,t.level=e.level,t.coordinatesMode=e.coordinatesMode,t.isBlocking=e.isBlocking,e.boundingBoxPosition&&(t.boundingBoxPosition=i.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(t.boundingBoxSize=i.FromArray(e.boundingBoxSize)),e.rotationY&&(t.rotationY=e.rotationY)}}p._FacesMapping=["right","left","up","down","front","back"];class _ extends p{constructor(e,t,r,a=!1,h=!0,d=!1,f=!1,l=null,o=null,c=!1,s=!1,n=!1){super(e,t,r,a,h,d,f,l,o,c,s,n)}getClassName(){return"HDRCubeTexture"}async _getCubeMapTextureDataAsync(e,t,r){return z(e,t,r)}_instantiateClone(){return new _(this.url,this.getScene()||this._getEngine(),this._size,this._noMipmap,this._generateHarmonics,this.gammaSpace)}serialize(){const e=super.serialize();return e?(e.customType="BABYLON.HDRCubeTexture",e):null}static Parse(e,t,r){if(!e.name||e.isRenderTarget)return null;const a=new _(r+e.name,t,e.size,e.noMipmap,e.generateHarmonics,e.useInGammaSpace);return this._Parse(e,a),a}}D("BABYLON.HDRCubeTexture",_);export{_ as HDRCubeTexture}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFiltering.fragment-DtaP2HM6.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFiltering.fragment-DtaP2HM6.js new file mode 100644 index 0000000000000000000000000000000000000000..556a273dcdc56206cb04cff01a0943c14a9cee07 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFiltering.fragment-DtaP2HM6.js @@ -0,0 +1,6 @@ +import{S as e}from"./index-CDrXokXW.js";import"./helperFunctions-CZpZ-EbL.js";import"./hdrFilteringFunctions-DD5EqJpN.js";import"./pbrBRDFFunctions-baMKuu65.js";import"./index-DWyDLubb.js";const r="hdrFilteringPixelShader",i=`#include +#include +#include +#include +uniform alphaG: f32;var inputTextureSampler: sampler;var inputTexture: texture_cube;uniform vFilteringInfo: vec2f;uniform hdrScale: f32;varying direction: vec3f;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var color: vec3f=radiance(uniforms.alphaG,inputTexture,inputTextureSampler,input.direction,uniforms.vFilteringInfo);fragmentOutputs.color= vec4f(color*uniforms.hdrScale,1.0);}`;e.ShadersStoreWGSL[r]||(e.ShadersStoreWGSL[r]=i);const c={name:r,shader:i};export{c as hdrFilteringPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFiltering.fragment-OKtxhlkY.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFiltering.fragment-OKtxhlkY.js new file mode 100644 index 0000000000000000000000000000000000000000..41b0c3547c555043dd5199c74678065e8d0dc92b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFiltering.fragment-OKtxhlkY.js @@ -0,0 +1,5 @@ +import{S as i}from"./index-CDrXokXW.js";import"./helperFunctions-BkWNqKeI.js";import"./hdrFilteringFunctions-DFleLIbL.js";import"./pbrBRDFFunctions-BEHyjaG2.js";import"./index-DWyDLubb.js";const r="hdrFilteringPixelShader",e=`#include +#include +#include +#include +uniform float alphaG;uniform samplerCube inputTexture;uniform vec2 vFilteringInfo;uniform float hdrScale;varying vec3 direction;void main() {vec3 color=radiance(alphaG,inputTexture,direction,vFilteringInfo);gl_FragColor=vec4(color*hdrScale,1.0);}`;i.ShadersStore[r]||(i.ShadersStore[r]=e);const c={name:r,shader:e};export{c as hdrFilteringPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFiltering.vertex-B3AES5as.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFiltering.vertex-B3AES5as.js new file mode 100644 index 0000000000000000000000000000000000000000..d34c3d10e2bd27c7cae0c7943a772b928d124301 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFiltering.vertex-B3AES5as.js @@ -0,0 +1,7 @@ +import{S as i}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="hdrFilteringVertexShader",r=`attribute vec2 position;varying vec3 direction;uniform vec3 up;uniform vec3 right;uniform vec3 front; +#define CUSTOM_VERTEX_DEFINITIONS +void main(void) { +#define CUSTOM_VERTEX_MAIN_BEGIN +mat3 view=mat3(up,right,front);direction=view*vec3(position,1.0);gl_Position=vec4(position,0.0,1.0); +#define CUSTOM_VERTEX_MAIN_END +}`;i.ShadersStore[e]||(i.ShadersStore[e]=r);const n={name:e,shader:r};export{n as hdrFilteringVertexShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFiltering.vertex-DL245Icy.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFiltering.vertex-DL245Icy.js new file mode 100644 index 0000000000000000000000000000000000000000..2458c46757ef6d8d578663361b275c46e068cd99 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFiltering.vertex-DL245Icy.js @@ -0,0 +1,8 @@ +import{S as t}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="hdrFilteringVertexShader",r=`attribute position: vec2f;varying direction: vec3f;uniform up: vec3f;uniform right: vec3f;uniform front: vec3f; +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs { +#define CUSTOM_VERTEX_MAIN_BEGIN +var view: mat3x3f= mat3x3f(uniforms.up,uniforms.right,uniforms.front);vertexOutputs.direction=view*vec3f(input.position,1.0);vertexOutputs.position= vec4f(input.position,0.0,1.0); +#define CUSTOM_VERTEX_MAIN_END +}`;t.ShadersStoreWGSL[e]||(t.ShadersStoreWGSL[e]=r);const o={name:e,shader:r};export{o as hdrFilteringVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFilteringFunctions-DD5EqJpN.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFilteringFunctions-DD5EqJpN.js new file mode 100644 index 0000000000000000000000000000000000000000..f66cf1d6950de9e380e464d5b62f1efa0b433e09 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFilteringFunctions-DD5EqJpN.js @@ -0,0 +1,127 @@ +import{S as e}from"./index-CDrXokXW.js";const a="importanceSampling",t=`fn hemisphereCosSample(u: vec2f)->vec3f {var phi: f32=2.*PI*u.x;var cosTheta2: f32=1.-u.y;var cosTheta: f32=sqrt(cosTheta2);var sinTheta: f32=sqrt(1.-cosTheta2);return vec3f(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);} +fn hemisphereImportanceSampleDggx(u: vec2f,a: f32)->vec3f {var phi: f32=2.*PI*u.x;var cosTheta2: f32=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));var cosTheta: f32=sqrt(cosTheta2);var sinTheta: f32=sqrt(1.-cosTheta2);return vec3f(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);} +fn hemisphereImportanceSampleDggxAnisotropic(Xi: vec2f,alphaTangent: f32,alphaBitangent: f32)->vec3f +{let alphaT: f32=max(alphaTangent,0.0001);let alphaB: f32=max(alphaBitangent,0.0001);var phi: f32=atan(alphaB/alphaT*tan(2.0f*PI*Xi.x));if (Xi.x>0.5) {phi+=PI; } +let cosPhi: f32=cos(phi);let sinPhi: f32=sin(phi);let alpha2: f32=(cosPhi*cosPhi)/(alphaTangent*alphaTangent) + +(sinPhi*sinPhi)/(alphaB*alphaB);let tanTheta2: f32=Xi.y/(1.0f-Xi.y)/alpha2;let cosTheta: f32=1.0f/sqrt(1.0f+tanTheta2);let sinTheta: f32=sqrt(max(0.0f,1.0f-cosTheta*cosTheta));return vec3f(sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);} +fn hemisphereImportanceSampleDCharlie(u: vec2f,a: f32)->vec3f { +var phi: f32=2.*PI*u.x;var sinTheta: f32=pow(u.y,a/(2.*a+1.));var cosTheta: f32=sqrt(1.-sinTheta*sinTheta);return vec3f(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}`;e.IncludesShadersStoreWGSL[a]||(e.IncludesShadersStoreWGSL[a]=t);const f="hdrFilteringFunctions",i=`#ifdef NUM_SAMPLES +#if NUM_SAMPLES>0 +fn radicalInverse_VdC(value: u32)->f32 +{var bits=(value<<16u) | (value>>16u);bits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);bits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);bits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);bits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);return f32(bits)*2.3283064365386963e-10; } +fn hammersley(i: u32,N: u32)->vec2f +{return vec2f( f32(i)/ f32(N),radicalInverse_VdC(i));} +fn log4(x: f32)->f32 {return log2(x)/2.;} +fn uv_to_normal(uv: vec2f)->vec3f {var N: vec3f;var uvRange: vec2f=uv;var theta: f32=uvRange.x*2.0*PI;var phi: f32=uvRange.y*PI;N.x=cos(theta)*sin(phi);N.z=sin(theta)*sin(phi);N.y=cos(phi);return N;} +const NUM_SAMPLES_FLOAT: f32= f32(NUM_SAMPLES);const NUM_SAMPLES_FLOAT_INVERSED: f32=1./NUM_SAMPLES_FLOAT;const K: f32=4.;fn irradiance( +#ifdef CUSTOM_IRRADIANCE_FILTERING_INPUT +CUSTOM_IRRADIANCE_FILTERING_INPUT +#else +inputTexture: texture_cube,inputSampler: sampler, +#endif +inputN: vec3f, +filteringInfo: vec2f, +diffuseRoughness: f32, +surfaceAlbedo: vec3f, +inputV: vec3f +#ifdef IBL_CDF_FILTERING +,icdfSampler: texture_2d,icdfSamplerSampler: sampler +#endif +)->vec3f +{var n: vec3f=normalize(inputN);var result: vec3f= vec3f(0.0); +#ifndef IBL_CDF_FILTERING +var tangent: vec3f=select(vec3f(1.,0.,0.),vec3f(0.,0.,1.),abs(n.z)<0.999);tangent=normalize(cross(tangent,n));var bitangent: vec3f=cross(n,tangent);var tbn: mat3x3f= mat3x3f(tangent,bitangent,n);var tbnInverse: mat3x3f=transpose(tbn); +#endif +var maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var omegaP: f32=(4.*PI)/(6.*dim0*dim0);var clampedAlbedo: vec3f=clamp(surfaceAlbedo,vec3f(0.1),vec3f(1.0));for(var i: u32=0u; i0.) { +#ifdef IBL_CDF_FILTERING +var pdf: f32=textureSampleLevel(icdfSampler,icdfSamplerSampler,T,0.0).z;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,Ls,0.0).rgb; +#else +var pdf_inversed: f32=PI/NoL;var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp(l,0.0,maxLevel); +#ifdef CUSTOM_IRRADIANCE_FILTERING_FUNCTION +CUSTOM_IRRADIANCE_FILTERING_FUNCTION +#else +var c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*Ls,mipLevel).rgb; +#endif +#endif +#ifdef GAMMA_INPUT +c=toLinearSpaceVec3(c); +#endif +var diffuseRoughnessTerm: vec3f=vec3f(1.0); +#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON +diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI; +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY +diffuseRoughnessTerm=vec3f(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI); +#endif +#ifdef IBL_CDF_FILTERING +var light: vec3f=vec3f(0.0);if (pdf>1e-6) {light=vec3f(1.0)/vec3f(pdf)*c;} +result+=NoL*diffuseRoughnessTerm*light; +#else +result+=c*diffuseRoughnessTerm; +#endif +}} +result=result*NUM_SAMPLES_FLOAT_INVERSED; +#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON +result=result/clampedAlbedo; +#endif +return result;} +fn radiance(alphaG: f32,inputTexture: texture_cube,inputSampler: sampler,inputN: vec3f,filteringInfo: vec2f)->vec3f +{var n: vec3f=normalize(inputN);var c: vec3f=textureSample(inputTexture,inputSampler,n).rgb; +if (alphaG==0.) { +#ifdef GAMMA_INPUT +c=toLinearSpace(c); +#endif +return c;} else {var result: vec3f= vec3f(0.);var tangent: vec3f=select(vec3f(1.,0.,0.),vec3f(0.,0.,1.),abs(n.z)<0.999);tangent=normalize(cross(tangent,n));var bitangent: vec3f=cross(n,tangent);var tbn: mat3x3f= mat3x3f(tangent,bitangent,n);var maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var omegaP: f32=(4.*PI)/(6.*dim0*dim0);var weight: f32=0.;for(var i: u32=0u; i0.) {var pdf_inversed: f32=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp( f32(l),0.0,maxLevel);weight+=NoL;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,tbn*L,mipLevel).rgb; +#ifdef GAMMA_INPUT +c=toLinearSpace(c); +#endif +result+=c*NoL;}} +result=result/weight;return result;}} +#ifdef ANISOTROPIC +fn radianceAnisotropic( +alphaTangent: f32, +alphaBitangent: f32, +inputTexture: texture_cube, +inputSampler: sampler, +inputView: vec3f, +inputTangent: vec3f, +inputBitangent: vec3f, +inputNormal: vec3f, +filteringInfo: vec2f, +noiseInput: vec2f +)->vec3f {var V: vec3f=inputView;var N: vec3f=inputNormal;var T: vec3f=inputTangent;var B: vec3f=inputBitangent;var R: vec3f=reflect(-V,N);var c: vec3f=textureSample(inputTexture,inputSampler,R).rgb;if (alphaTangent==0.f && alphaBitangent==0.f) { +#if GAMMA_INPUT +c=toLinearSpace(c); +#endif +return c;} +var result: vec3f=vec3f(0.f);var maxLevel: f32=filteringInfo.y;var dim0: f32=filteringInfo.x;var effectiveDim: f32=dim0*sqrt(alphaTangent*alphaBitangent);var omegaP: f32=(4.f*PI)/(6.f*effectiveDim*effectiveDim);let noiseScale: f32=clamp(log2(f32(NUM_SAMPLES))/12.0f,0.0f,1.0f);var weight: f32=0.f;for(var i: u32=0u; i0.f) {var pdf_inversed: f32=4./normalDistributionFunction_BurleyGGX_Anisotropic( +H_tangent.z,H_tangent.x,H_tangent.y,vec2(alphaTangent,alphaBitangent) +);var omegaS: f32=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;var l: f32=log4(omegaS)-log4(omegaP)+log4(K);var mipLevel: f32=clamp(l,0.0f,maxLevel);weight+=NoL;var c: vec3f=textureSampleLevel(inputTexture,inputSampler,L,mipLevel).rgb; +#if GAMMA_INPUT +c=toLinearSpace(c); +#endif +result+=c*NoL;}} +result=result/weight;return result;} +#endif +#endif +#endif +`;e.IncludesShadersStoreWGSL[f]||(e.IncludesShadersStoreWGSL[f]=i); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFilteringFunctions-DFleLIbL.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFilteringFunctions-DFleLIbL.js new file mode 100644 index 0000000000000000000000000000000000000000..b477fcd9f9533c18fc562de906259a6a12683370 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrFilteringFunctions-DFleLIbL.js @@ -0,0 +1,155 @@ +import{S as e}from"./index-CDrXokXW.js";const t="importanceSampling",a=`vec3 hemisphereCosSample(vec2 u) {float phi=2.*PI*u.x;float cosTheta2=1.-u.y;float cosTheta=sqrt(cosTheta2);float sinTheta=sqrt(1.-cosTheta2);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);} +vec3 hemisphereImportanceSampleDggx(vec2 u,float a) {float phi=2.*PI*u.x;float cosTheta2=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));float cosTheta=sqrt(cosTheta2);float sinTheta=sqrt(1.-cosTheta2);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);} +vec3 hemisphereImportanceSampleDggxAnisotropic(vec2 Xi,float alphaTangent,float alphaBitangent) +{alphaTangent=max(alphaTangent,0.0001);alphaBitangent=max(alphaBitangent,0.0001);float phi=atan(alphaBitangent/alphaTangent*tan(2.0*3.14159265*Xi.x));if (Xi.x>0.5) phi+=3.14159265; +float cosPhi=cos(phi);float sinPhi=sin(phi);float alpha2=(cosPhi*cosPhi)/(alphaTangent*alphaTangent) + +(sinPhi*sinPhi)/(alphaBitangent*alphaBitangent);float tanTheta2=Xi.y/(1.0-Xi.y)/alpha2;float cosTheta=1.0/sqrt(1.0+tanTheta2);float sinTheta=sqrt(max(0.0,1.0-cosTheta*cosTheta));return vec3(sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);} +vec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) { +float phi=2.*PI*u.x;float sinTheta=pow(u.y,a/(2.*a+1.));float cosTheta=sqrt(1.-sinTheta*sinTheta);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=a);const i="hdrFilteringFunctions",n=`#if NUM_SAMPLES +#if NUM_SAMPLES>0 +#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) +float radicalInverse_VdC(uint bits) +{bits=(bits<<16u) | (bits>>16u);bits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);bits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);bits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);bits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);return float(bits)*2.3283064365386963e-10; } +vec2 hammersley(uint i,uint N) +{return vec2(float(i)/float(N),radicalInverse_VdC(i));} +#else +float vanDerCorpus(int n,int base) +{float invBase=1.0/float(base);float denom =1.0;float result =0.0;for(int i=0; i<32; ++i) +{if(n>0) +{denom =mod(float(n),2.0);result+=denom*invBase;invBase=invBase/2.0;n =int(float(n)/2.0);}} +return result;} +vec2 hammersley(int i,int N) +{return vec2(float(i)/float(N),vanDerCorpus(i,2));} +#endif +float log4(float x) {return log2(x)/2.;} +vec3 uv_to_normal(vec2 uv) {vec3 N;vec2 uvRange=uv;float theta=uvRange.x*2.*PI;float phi=uvRange.y*PI;float sinPhi=sin(phi);N.x=cos(theta)*sinPhi;N.z=sin(theta)*sinPhi;N.y=cos(phi);return N;} +const float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);const float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;const float K=4.; +#define inline +vec3 irradiance( +#ifdef CUSTOM_IRRADIANCE_FILTERING_INPUT +CUSTOM_IRRADIANCE_FILTERING_INPUT +#else +samplerCube inputTexture, +#endif +vec3 inputN,vec2 filteringInfo, +float diffuseRoughness, +vec3 surfaceAlbedo, +vec3 inputV +#if IBL_CDF_FILTERING +,sampler2D icdfSampler +#endif +) +{vec3 n=normalize(inputN);vec3 result=vec3(0.); +#ifndef IBL_CDF_FILTERING +vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);mat3 tbnInverse=mat3(tangent.x,bitangent.x,n.x,tangent.y,bitangent.y,n.y,tangent.z,bitangent.z,n.z); +#endif +float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);vec3 clampedAlbedo=clamp(surfaceAlbedo,vec3(0.1),vec3(1.0)); +#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) +for(uint i=0u; i0.) { +#if IBL_CDF_FILTERING +float pdf=texture2D(icdfSampler,T).z;vec3 c=textureCubeLodEXT(inputTexture,Ls,0.).rgb; +#else +float pdf_inversed=PI/NoL;float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(l,0.,maxLevel); +#ifdef CUSTOM_IRRADIANCE_FILTERING_FUNCTION +CUSTOM_IRRADIANCE_FILTERING_FUNCTION +#else +vec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb; +#endif +#endif +#if GAMMA_INPUT +c=toLinearSpace(c); +#endif +vec3 diffuseRoughnessTerm=vec3(1.0); +#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON +diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI; +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY +diffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI); +#endif +#if IBL_CDF_FILTERING +vec3 light=pdf<1e-6 ? vec3(0.0) : vec3(1.0)/vec3(pdf)*c;result+=NoL*diffuseRoughnessTerm*light; +#else +result+=c*diffuseRoughnessTerm; +#endif +}} +result=result*NUM_SAMPLES_FLOAT_INVERSED; +#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON +result=result/clampedAlbedo; +#endif +return result;} +#define inline +vec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo) +{vec3 n=normalize(inputN);vec3 c=textureCube(inputTexture,n).rgb; +if (alphaG==0.) { +#if GAMMA_INPUT +c=toLinearSpace(c); +#endif +return c;} else {vec3 result=vec3(0.);vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);float weight=0.; +#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) +for(uint i=0u; i0.) {float pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(float(l),0.0,maxLevel);weight+=NoL;vec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb; +#if GAMMA_INPUT +c=toLinearSpace(c); +#endif +result+=c*NoL;}} +result=result/weight;return result;}} +#ifdef ANISOTROPIC +#define inline +vec3 radianceAnisotropic( +float alphaTangent, +float alphaBitangent, +samplerCube inputTexture, +vec3 inputView, +vec3 inputTangent, +vec3 inputBitangent, +vec3 inputNormal, +vec2 filteringInfo, +vec2 noiseInput +) +{vec3 V=inputView;vec3 N=inputNormal;vec3 T=inputTangent;vec3 B=inputBitangent;vec3 R=reflect(-V,N);if (alphaTangent==0. && alphaBitangent==0.) {vec3 c=textureCube(inputTexture,R).rgb; +#if GAMMA_INPUT +c=toLinearSpace(c); +#endif +return c;} +vec3 result=vec3(0.);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float effectiveDim=dim0*sqrt(alphaTangent*alphaBitangent);float omegaP=(4.*PI)/(6.*effectiveDim*effectiveDim);const float noiseScale=clamp(log2(float(NUM_SAMPLES))/12.0f,0.0f,1.0f);float weight=0.; +#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) +for(uint i=0u; i0.) {float pdf_inversed=4./normalDistributionFunction_BurleyGGX_Anisotropic( +H_tangent.z,H_tangent.x,H_tangent.y,vec2(alphaTangent,alphaBitangent) +);float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(float(l),0.0,maxLevel);weight+=NoL;vec3 c=textureCubeLodEXT(inputTexture,L,mipLevel).rgb; +#if GAMMA_INPUT +c=toLinearSpace(c); +#endif +result+=c*NoL;}} +result=result/weight;return result;} +#endif +#endif +#endif +`;e.IncludesShadersStore[i]||(e.IncludesShadersStore[i]=n); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrIrradianceFiltering.fragment-BouJGbEm.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrIrradianceFiltering.fragment-BouJGbEm.js new file mode 100644 index 0000000000000000000000000000000000000000..6d3a0c5c790cce22de0310a6494d923f4585af50 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrIrradianceFiltering.fragment-BouJGbEm.js @@ -0,0 +1,14 @@ +import{S as r}from"./index-CDrXokXW.js";import"./helperFunctions-CZpZ-EbL.js";import"./hdrFilteringFunctions-DD5EqJpN.js";import"./pbrBRDFFunctions-baMKuu65.js";import"./index-DWyDLubb.js";const e="hdrIrradianceFilteringPixelShader",i=`#include +#include +#include +#include +var inputTextureSampler: sampler;var inputTexture: texture_cube; +#ifdef IBL_CDF_FILTERING +var icdfTextureSampler: sampler;var icdfTexture: texture_2d; +#endif +uniform vFilteringInfo: vec2f;uniform hdrScale: f32;varying direction: vec3f;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var color: vec3f=irradiance(inputTexture,inputTextureSampler,input.direction,uniforms.vFilteringInfo,0.0,vec3f(1.0),input.direction +#ifdef IBL_CDF_FILTERING +,icdfTexture,icdfTextureSampler +#endif +);fragmentOutputs.color= vec4f(color*uniforms.hdrScale,1.0);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=i);const o={name:e,shader:i};export{o as hdrIrradianceFilteringPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrIrradianceFiltering.fragment-Kt5IUBnY.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrIrradianceFiltering.fragment-Kt5IUBnY.js new file mode 100644 index 0000000000000000000000000000000000000000..124196a252b69684d0ad13ac8bc6b1ab6c8adcd1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrIrradianceFiltering.fragment-Kt5IUBnY.js @@ -0,0 +1,13 @@ +import{S as r}from"./index-CDrXokXW.js";import"./helperFunctions-BkWNqKeI.js";import"./hdrFilteringFunctions-DFleLIbL.js";import"./pbrBRDFFunctions-BEHyjaG2.js";import"./index-DWyDLubb.js";const e="hdrIrradianceFilteringPixelShader",i=`#include +#include +#include +#include +uniform samplerCube inputTexture; +#ifdef IBL_CDF_FILTERING +uniform sampler2D icdfTexture; +#endif +uniform vec2 vFilteringInfo;uniform float hdrScale;varying vec3 direction;void main() {vec3 color=irradiance(inputTexture,direction,vFilteringInfo,0.0,vec3(1.0),direction +#ifdef IBL_CDF_FILTERING +,icdfTexture +#endif +);gl_FragColor=vec4(color*hdrScale,1.0);}`;r.ShadersStore[e]||(r.ShadersStore[e]=i);const a={name:e,shader:i};export{a as hdrIrradianceFilteringPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrIrradianceFiltering.vertex-BdW9s4Cf.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrIrradianceFiltering.vertex-BdW9s4Cf.js new file mode 100644 index 0000000000000000000000000000000000000000..9ec115ab58686266964254bb3722f2639f123ac6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrIrradianceFiltering.vertex-BdW9s4Cf.js @@ -0,0 +1,8 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="hdrIrradianceFilteringVertexShader",t=`attribute position: vec2f;varying direction: vec3f;uniform up: vec3f;uniform right: vec3f;uniform front: vec3f; +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs { +#define CUSTOM_VERTEX_MAIN_BEGIN +var view: mat3x3f= mat3x3f(uniforms.up,uniforms.right,uniforms.front);vertexOutputs.direction=view*vec3f(input.position,1.0);vertexOutputs.position= vec4f(input.position,0.0,1.0); +#define CUSTOM_VERTEX_MAIN_END +}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=t);const o={name:e,shader:t};export{o as hdrIrradianceFilteringVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrIrradianceFiltering.vertex-CT4kZIfm.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrIrradianceFiltering.vertex-CT4kZIfm.js new file mode 100644 index 0000000000000000000000000000000000000000..bb787c87b52eab4715074b2e464b200f64b05f96 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrIrradianceFiltering.vertex-CT4kZIfm.js @@ -0,0 +1,7 @@ +import{S as i}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="hdrIrradianceFilteringVertexShader",r=`attribute vec2 position;varying vec3 direction;uniform vec3 up;uniform vec3 right;uniform vec3 front; +#define CUSTOM_VERTEX_DEFINITIONS +void main(void) { +#define CUSTOM_VERTEX_MAIN_BEGIN +mat3 view=mat3(up,right,front);direction=view*vec3(position,1.0);gl_Position=vec4(position,0.0,1.0); +#define CUSTOM_VERTEX_MAIN_END +}`;i.ShadersStore[e]||(i.ShadersStore[e]=r);const n={name:e,shader:r};export{n as hdrIrradianceFilteringVertexShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrTextureLoader-BTuqRXGJ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrTextureLoader-BTuqRXGJ.js new file mode 100644 index 0000000000000000000000000000000000000000..aebab63c0695b92a64067d1c7f1bfa55e0eef46c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hdrTextureLoader-BTuqRXGJ.js @@ -0,0 +1 @@ +import{R as l,a as c}from"./hdr-mXhboeO4.js";import"./index-CDrXokXW.js";import"./index-DWyDLubb.js";class R{constructor(){this.supportCascades=!1}loadCubeData(){throw".hdr not supported in Cube."}loadData(s,e,p){const i=new Uint8Array(s.buffer,s.byteOffset,s.byteLength),t=l(i),r=c(i,t),n=t.width*t.height,o=new Float32Array(n*4);for(let a=0;a{const a=e.getEngine();e.type=1,e.format=5,e._gammaSpace=!1,a._uploadDataToTextureDirectly(e,o)})}}export{R as _HDRTextureLoader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/he-D0pPJnuh.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/he-D0pPJnuh.js new file mode 100644 index 0000000000000000000000000000000000000000..208ef491ee1d3cf1758aec416945b0b2a296c107 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/he-D0pPJnuh.js @@ -0,0 +1 @@ +const o="עברית",e={annotated_image:"תמונה מוערת"},r={allow_recording_access:"אנא אפשר/י גישה למיקרופון להקלטה.",audio:"שמע",record_from_microphone:"הקלט ממיקרופון",stop_recording:"עצור הקלטה",no_device_support:"לא ניתן לגשת להתקני מדיה. וודא שאתה מריץ ממקור מאובטח (https) או localhost (או שהעברת אישור SSL תקף ל-ssl_verify), ושאישרת לדפדפן גישה למכשיר שלך.",stop:"עצור",resume:"המשך",record:"הקלט",no_microphone:"לא נמצא מיקרופון",pause:"השהה",play:"נגן",waiting:"ממתין",drop_to_upload:"הטילו קובץ אודיו כאן כדי להעלות"},t={connection_can_break:"בנייד, החיבור עלול להתנתק אם כרטיסייה זו מאבדת מיקוד או המכשיר נכנס למצב שינה, מה שיגרום לאיבוד מקומך בתור.",long_requests_queue:"יש תור ארוך של בקשות ממתינות. שכפל Space זה כדי לדלג על התור.",lost_connection:"החיבור אבד בגלל עזיבת העמוד. חוזר לתור...",waiting_for_inputs:"מחכים לסיום העלאה של הקבצים, אנא נסה שוב."},c={checkbox:"תיבת סימון",checkbox_group:"קבוצת תיבות סימון"},a={code:"קוד"},_={color_picker:"בוחר צבעים"},n={built_with:"נבנה עם",built_with_gradio:"נבנה עם Gradio",clear:"נקה",download:"הורד",edit:"ערוך",empty:"ריק",error:"שגיאה",hosted_on:"מאוחסן ב",loading:"טוען",logo:"לוגו",or:"או",remove:"הסר",settings:"הגדרות",share:"שתף",submit:"שלח",undo:"בטל",no_devices:"לא נמצאו התקנים",language:"שפה",display_theme:"ערכת נושא",pwa:"יישום ווב מתקדם"},d={incorrect_format:"פורמט שגוי, רק קבצי CSV ו-TSV נתמכים",new_column:"הוסף עמודה",new_row:"שורה חדשה",add_row_above:"הוסף שורה מעל",add_row_below:"הוסף שורה מתחת",add_column_left:"הוסף עמודה משמאל",add_column_right:"הוסף עמודה מימין",delete_row:"מחק שורה",delete_column:"מחק עמודה",sort_column:"מיין עמודה",sort_ascending:"מיין בסדר עולה",sort_descending:"מיין בסדר יורד",drop_to_upload:"הטילו קבצי CSV או TSV כאן כדי לייבא נתונים לתוך dataframe",clear_sort:"נקה סדר"},s={dropdown:"תפריט נפתח"},i={build_error:"יש שגיאת בנייה",config_error:"יש שגיאת תצורה",contact_page_author:"אנא צור קשר עם מחבר העמוד כדי ליידע אותו.",no_app_file:"אין קובץ יישום",runtime_error:"יש שגיאת זמן ריצה",space_not_working:'"ה-Space לא עובד כי" {0}',space_paused:"ה-Space מושהה",use_via_api:"השתמש דרך API"},l={uploading:"מעלה..."},p={highlighted_text:"טקסט מודגש"},u={allow_webcam_access:"אנא אפשר גישה למצלמת האינטרנט להקלטה.",brush_color:"צבע מברשת",brush_radius:"גודל מברשת",image:"תמונה",remove_image:"הסר תמונה",select_brush_color:"בחר צבע מברשת",start_drawing:"התחל לצייר",use_brush:"השתמש במברשת",drop_to_upload:"הטילו קובץ תמונה כאן כדי להעלות"},g={label:"תווית"},m={enable_cookies:"אם אתה מבקר ב-Space של HuggingFace במצב גלישה בסתר, עליך לאפשר קובצי cookie של צד שלישי.",incorrect_credentials:"פרטי התחברות שגויים",username:"שם משתמש",password:"סיסמה",login:"התחבר"},b={number:"מספר"},h={plot:"תרשים"},w={radio:"כפתור רדיו"},f={slider:"מחוון"},k={click_to_upload:"לחץ להעלאה",drop_audio:"שחרר קובץ שמע כאן",drop_csv:"שחרר קובץ CSV כאן",drop_file:"שחרר קובץ כאן",drop_image:"שחרר תמונה כאן",drop_video:"שחרר וידאו כאן",drop_gallery:"שחרר מדיה כאן",paste_clipboard:"הדבק מהלוח"},S={drop_to_upload:"הטילו קובץ וידאו כאן כדי להעלות"},v={edit:"עריכה",retry:"נסה שוב",undo:"בטל",submit:"שלח",cancel:"ביטול",like:"אהבתי",dislike:"לא אהבתי",clear:"נקה שיחה"},x={_name:o,"3D_model":{"3d_model":"מודל תלת מימד",drop_to_upload:"הטילו קובץ מודל 3D (.obj, .glb, .stl, .gltf, .splat או .ply) כאן כדי להעלות"},annotated_image:e,audio:r,blocks:t,checkbox:c,code:a,color_picker:_,common:n,dataframe:d,dropdown:s,errors:i,file:l,highlighted_text:p,image:u,label:g,login:m,number:b,plot:h,radio:w,slider:f,upload_text:k,video:S,chatbot:v};export{o as _name,e as annotated_image,r as audio,t as blocks,v as chatbot,c as checkbox,a as code,_ as color_picker,n as common,d as dataframe,x as default,s as dropdown,i as errors,l as file,p as highlighted_text,u as image,g as label,m as login,b as number,h as plot,w as radio,f as slider,k as upload_text,S as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/helperFunctions-BkWNqKeI.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/helperFunctions-BkWNqKeI.js new file mode 100644 index 0000000000000000000000000000000000000000..512d14601775d8ab2ac749c5e46eebfd65758319 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/helperFunctions-BkWNqKeI.js @@ -0,0 +1,108 @@ +import{S as e}from"./index-CDrXokXW.js";const o="helperFunctions",a=`const float PI=3.1415926535897932384626433832795;const float TWO_PI=6.283185307179586;const float HALF_PI=1.5707963267948966;const float RECIPROCAL_PI=0.3183098861837907;const float RECIPROCAL_PI2=0.15915494309189535;const float RECIPROCAL_PI4=0.07957747154594767;const float HALF_MIN=5.96046448e-08; +const float LinearEncodePowerApprox=2.2;const float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;const vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);const float Epsilon=0.0000001; +#define saturate(x) clamp(x,0.0,1.0) +#define absEps(x) abs(x)+Epsilon +#define maxEps(x) max(x,Epsilon) +#define saturateEps(x) clamp(x,Epsilon,1.0) +mat3 transposeMat3(mat3 inMatrix) {vec3 i0=inMatrix[0];vec3 i1=inMatrix[1];vec3 i2=inMatrix[2];mat3 outMatrix=mat3( +vec3(i0.x,i1.x,i2.x), +vec3(i0.y,i1.y,i2.y), +vec3(i0.z,i1.z,i2.z) +);return outMatrix;} +mat3 inverseMat3(mat3 inMatrix) {float a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];float a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];float a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];float b01=a22*a11-a12*a21;float b11=-a22*a10+a12*a20;float b21=a21*a10-a11*a20;float det=a00*b01+a01*b11+a02*b21;return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11), +b11,(a22*a00-a02*a20),(-a12*a00+a02*a10), +b21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;} +#if USE_EXACT_SRGB_CONVERSIONS +vec3 toLinearSpaceExact(vec3 color) +{vec3 nearZeroSection=0.0773993808*color;vec3 remainingSection=pow(0.947867299*(color+vec3(0.055)),vec3(2.4)); +#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) +return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.04045))); +#else +return +vec3( +color.r<=0.04045 ? nearZeroSection.r : remainingSection.r, +color.g<=0.04045 ? nearZeroSection.g : remainingSection.g, +color.b<=0.04045 ? nearZeroSection.b : remainingSection.b); +#endif +} +vec3 toGammaSpaceExact(vec3 color) +{vec3 nearZeroSection=12.92*color;vec3 remainingSection=1.055*pow(color,vec3(0.41666))-vec3(0.055); +#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) +return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.0031308))); +#else +return +vec3( +color.r<=0.0031308 ? nearZeroSection.r : remainingSection.r, +color.g<=0.0031308 ? nearZeroSection.g : remainingSection.g, +color.b<=0.0031308 ? nearZeroSection.b : remainingSection.b); +#endif +} +#endif +float toLinearSpace(float color) +{ +#if USE_EXACT_SRGB_CONVERSIONS +float nearZeroSection=0.0773993808*color;float remainingSection=pow(0.947867299*(color+0.055),2.4);return color<=0.04045 ? nearZeroSection : remainingSection; +#else +return pow(color,LinearEncodePowerApprox); +#endif +} +vec3 toLinearSpace(vec3 color) +{ +#if USE_EXACT_SRGB_CONVERSIONS +return toLinearSpaceExact(color); +#else +return pow(color,vec3(LinearEncodePowerApprox)); +#endif +} +vec4 toLinearSpace(vec4 color) +{ +#if USE_EXACT_SRGB_CONVERSIONS +return vec4(toLinearSpaceExact(color.rgb),color.a); +#else +return vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a); +#endif +} +float toGammaSpace(float color) +{ +#if USE_EXACT_SRGB_CONVERSIONS +float nearZeroSection=12.92*color;float remainingSection=1.055*pow(color,0.41666)-0.055;return color<=0.0031308 ? nearZeroSection : remainingSection; +#else +return pow(color,GammaEncodePowerApprox); +#endif +} +vec3 toGammaSpace(vec3 color) +{ +#if USE_EXACT_SRGB_CONVERSIONS +return toGammaSpaceExact(color); +#else +return pow(color,vec3(GammaEncodePowerApprox)); +#endif +} +vec4 toGammaSpace(vec4 color) +{ +#if USE_EXACT_SRGB_CONVERSIONS +return vec4(toGammaSpaceExact(color.rgb),color.a); +#else +return vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a); +#endif +} +float square(float value) +{return value*value;} +vec3 square(vec3 value) +{return value*value;} +float pow5(float value) {float sq=value*value;return sq*sq*value;} +float getLuminance(vec3 color) +{return saturate(dot(color,LuminanceEncodeApprox));} +float getRand(vec2 seed) {return fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);} +float dither(vec2 seed,float varianceAmount) {float rand=getRand(seed);float normVariance=varianceAmount/255.0;float dither=mix(-normVariance,normVariance,rand);return dither;} +const float rgbdMaxRange=255.;vec4 toRGBD(vec3 color) {float maxRGB=maxEps(max(color.r,max(color.g,color.b)));float D =max(rgbdMaxRange/maxRGB,1.);D =saturate(floor(D)/255.);vec3 rgb=color.rgb*D;rgb=toGammaSpace(rgb);return vec4(saturate(rgb),D);} +vec3 fromRGBD(vec4 rgbd) {rgbd.rgb=toLinearSpace(rgbd.rgb);return rgbd.rgb/rgbd.a;} +vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {vec3 invOrigVec=vec3(1.)/origVec;vec3 halfSize=cubeSize*0.5;vec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;vec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;vec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);float distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);vec3 intersectPositionWS=vertexPos+origVec*distance;return intersectPositionWS-cubePos;} +vec3 equirectangularToCubemapDirection(vec2 uv) {float longitude=uv.x*TWO_PI-PI;float latitude=HALF_PI-uv.y*PI;vec3 direction;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;} +float sqrtClamped(float value) {return sqrt(max(value,0.));} +float avg(vec3 value) {return dot(value,vec3(0.333333333));} +#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) +uint extractBits(uint value,int offset,int width) {return (value>>offset) & ((1u<>23)-0x7f;} +#endif +`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=a); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/helperFunctions-CZpZ-EbL.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/helperFunctions-CZpZ-EbL.js new file mode 100644 index 0000000000000000000000000000000000000000..d24c00ed750cc1b5c21200120147c23b9951b448 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/helperFunctions-CZpZ-EbL.js @@ -0,0 +1,76 @@ +import{S as e}from"./index-CDrXokXW.js";const r="helperFunctions",a=`const PI: f32=3.1415926535897932384626433832795;const TWO_PI: f32=6.283185307179586;const HALF_PI: f32=1.5707963267948966;const RECIPROCAL_PI: f32=0.3183098861837907;const RECIPROCAL_PI2: f32=0.15915494309189535;const RECIPROCAL_PI4: f32=0.07957747154594767;const HALF_MIN: f32=5.96046448e-08; +const LinearEncodePowerApprox: f32=2.2;const GammaEncodePowerApprox: f32=1.0/LinearEncodePowerApprox;const LuminanceEncodeApprox: vec3f=vec3f(0.2126,0.7152,0.0722);const Epsilon:f32=0.0000001;fn square(x: f32)->f32 {return x*x;} +fn saturate(x: f32)->f32 {return clamp(x,0.0,1.0);} +fn saturateVec3(x: vec3f)->vec3f {return clamp(x,vec3f(),vec3f(1.0));} +fn saturateEps(x: f32)->f32 {return clamp(x,Epsilon,1.0);} +fn maxEps(x: f32)->f32 {return max(x,Epsilon);} +fn maxEpsVec3(x: vec3f)->vec3f {return max(x,vec3f(Epsilon));} +fn absEps(x: f32)->f32 {return abs(x)+Epsilon;} +fn transposeMat3(inMatrix: mat3x3f)->mat3x3f {let i0: vec3f=inMatrix[0];let i1: vec3f=inMatrix[1];let i2: vec3f=inMatrix[2];let outMatrix:mat3x3f=mat3x3f( +vec3(i0.x,i1.x,i2.x), +vec3(i0.y,i1.y,i2.y), +vec3(i0.z,i1.z,i2.z) +);return outMatrix;} +fn inverseMat3(inMatrix: mat3x3f)->mat3x3f {let a00: f32=inMatrix[0][0];let a01: f32=inMatrix[0][1];let a02: f32=inMatrix[0][2];let a10: f32=inMatrix[1][0];let a11: f32=inMatrix[1][1];let a12: f32=inMatrix[1][2];let a20: f32=inMatrix[2][0];let a21: f32=inMatrix[2][1];let a22: f32=inMatrix[2][2];let b01: f32=a22*a11-a12*a21;let b11: f32=-a22*a10+a12*a20;let b21: f32=a21*a10-a11*a20;let det: f32=a00*b01+a01*b11+a02*b21;return mat3x3f(b01/det,(-a22*a01+a02*a21)/det,(a12*a01-a02*a11)/det, +b11/det,(a22*a00-a02*a20)/det,(-a12*a00+a02*a10)/det, +b21/det,(-a21*a00+a01*a20)/det,(a11*a00-a01*a10)/det);} +#if USE_EXACT_SRGB_CONVERSIONS +fn toLinearSpaceExact(color: vec3f)->vec3f +{let nearZeroSection: vec3f=0.0773993808*color;let remainingSection: vec3f=pow(0.947867299*(color+vec3f(0.055)),vec3f(2.4));return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3f(0.04045)));} +fn toGammaSpaceExact(color: vec3f)->vec3f +{let nearZeroSection: vec3f=12.92*color;let remainingSection: vec3f=1.055*pow(color,vec3f(0.41666))-vec3f(0.055);return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3f(0.0031308)));} +#endif +fn toLinearSpace(color: f32)->f32 +{ +#if USE_EXACT_SRGB_CONVERSIONS +var nearZeroSection=0.0773993808*color;var remainingSection=pow(0.947867299*(color+0.055),2.4);return select(remainingSection,nearZeroSection,color<=0.04045); +#else +return pow(color,LinearEncodePowerApprox); +#endif +} +fn toLinearSpaceVec3(color: vec3f)->vec3f +{ +#if USE_EXACT_SRGB_CONVERSIONS +return toLinearSpaceExact(color); +#else +return pow(color,vec3f(LinearEncodePowerApprox)); +#endif +} +fn toLinearSpaceVec4(color: vec4)->vec4 +{ +#if USE_EXACT_SRGB_CONVERSIONS +return vec4f(toLinearSpaceExact(color.rgb),color.a); +#else +return vec4f(pow(color.rgb,vec3f(LinearEncodePowerApprox)),color.a); +#endif +} +fn toGammaSpace(color: vec4)->vec4 +{ +#if USE_EXACT_SRGB_CONVERSIONS +return vec4(toGammaSpaceExact(color.rgb),color.a); +#else +return vec4(pow(color.rgb,vec3f(GammaEncodePowerApprox)),color.a); +#endif +} +fn toGammaSpaceVec3(color: vec3f)->vec3f +{ +#if USE_EXACT_SRGB_CONVERSIONS +return toGammaSpaceExact(color); +#else +return pow(color,vec3f(GammaEncodePowerApprox)); +#endif +} +fn squareVec3(value: vec3f)->vec3f +{return value*value;} +fn pow5(value: f32)->f32 {let sq: f32=value*value;return sq*sq*value;} +fn getLuminance(color: vec3f)->f32 +{return saturate(dot(color,LuminanceEncodeApprox));} +fn getRand(seed: vec2)->f32 {return fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);} +fn dither(seed: vec2,varianceAmount: f32)->f32 {let rand: f32=getRand(seed);let normVariance: f32=varianceAmount/255.0;let dither: f32=mix(-normVariance,normVariance,rand);return dither;} +const rgbdMaxRange: f32=255.0;fn toRGBD(color: vec3f)->vec4 {let maxRGB: f32=max(max(color.r,max(color.g,color.b)),Epsilon);var D: f32 =max(rgbdMaxRange/maxRGB,1.);D =clamp(floor(D)/255.0,0.,1.);var rgb: vec3f =color.rgb*D;rgb=toGammaSpaceVec3(rgb);return vec4(saturateVec3(rgb),D);} +fn fromRGBD(rgbd: vec4)->vec3f {let rgb=toLinearSpaceVec3(rgbd.rgb);return rgb/rgbd.a;} +fn parallaxCorrectNormal(vertexPos: vec3f,origVec: vec3f,cubeSize: vec3f,cubePos: vec3f)->vec3f {let invOrigVec: vec3f=vec3f(1.)/origVec;let halfSize: vec3f=cubeSize*0.5;let intersecAtMaxPlane: vec3f=(cubePos+halfSize-vertexPos)*invOrigVec;let intersecAtMinPlane: vec3f=(cubePos-halfSize-vertexPos)*invOrigVec;let largestIntersec: vec3f=max(intersecAtMaxPlane,intersecAtMinPlane);let distance: f32=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);let intersectPositionWS: vec3f=vertexPos+origVec*distance;return intersectPositionWS-cubePos;} +fn equirectangularToCubemapDirection(uv : vec2f)->vec3f {var longitude : f32=uv.x*TWO_PI-PI;var latitude : f32=HALF_PI-uv.y*PI;var direction : vec3f;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;} +fn sqrtClamped(value: f32)->f32 {return sqrt(max(value,0.));} +fn avg(value: vec3f)->f32 {return dot(value,vec3f(0.333333333));} +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=a); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hf-logo-8sK58_pS.svg b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hf-logo-8sK58_pS.svg new file mode 100644 index 0000000000000000000000000000000000000000..ab959d165fa5b05a953c9d1c5acc6640f9f536b8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hf-logo-8sK58_pS.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hi-ui5-o8Zq.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hi-ui5-o8Zq.js new file mode 100644 index 0000000000000000000000000000000000000000..37da24f9353c17dd5591f67ccf12afd6c8e6d674 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/hi-ui5-o8Zq.js @@ -0,0 +1 @@ +const o="हिंदी",e={annotated_image:"एनोटेट की गई छवि"},r={allow_recording_access:"कृपया रिकॉर्डिंग के लिए माइक्रोफ़ोन एक्सेस की अनुमति दें।",audio:"ऑडियो",record_from_microphone:"माइक्रोफ़ोन से रिकॉर्ड करें",stop_recording:"रिकॉर्डिंग रोकें",no_device_support:"मीडिया डिवाइस तक पहुंच नहीं हो सकी। सुनिश्चित करें कि आप एक सुरक्षित स्रोत (https) या localhost पर चल रहे हैं (या ssl_verify को एक वैध SSL प्रमाणपत्र दिया है), और आपने अपने ब्राउज़र को अपने डिवाइस तक पहुंच की अनुमति दी है।",stop:"रोकें",resume:"जारी रखें",record:"रिकॉर्ड",no_microphone:"कोई माइक्रोफ़ोन नहीं मिला",pause:"रोकें",play:"चलाएं",waiting:"प्रतीक्षा कर रहा है",drop_to_upload:"यहाँ एक ऑडियो फाइल डालें अपलोड करने के लिए"},t={connection_can_break:"मोबाइल पर, यदि यह टैब फोकस खो देता है या डिवाइस स्लीप मोड में चला जाता है, तो कनेक्शन टूट सकता है, जिससे कतार में आपका स्थान खो जाएगा।",long_requests_queue:"लंबित अनुरोधों की एक लंबी कतार है। इसे छोड़ने के लिए इस Space को डुप्लिकेट करें।",lost_connection:"पेज छोड़ने के कारण कनेक्शन टूट गया। कतार में वापस जा रहा है...",waiting_for_inputs:"फाइलें अपलोड होने का इंतजार कर रहे हैं, कृपया पुन: प्रयास करें।"},c={checkbox:"चेकबॉक्स",checkbox_group:"चेकबॉक्स समूह"},_={code:"कोड"},a={color_picker:"रंग चयनकर्ता"},n={built_with:"के साथ बनाया गया",built_with_gradio:"Gradio के साथ बनाया गया",clear:"साफ़ करें",download:"डाउनलोड",edit:"संपादित करें",empty:"खाली",error:"त्रुटि",hosted_on:"पर होस्ट किया गया",loading:"लोड हो रहा है",logo:"लोगो",or:"या",remove:"हटाएं",settings:"सेटिंग्स",share:"साझा करें",submit:"सबमिट करें",undo:"पूर्ववत करें",no_devices:"कोई डिवाइस नहीं मिला",language:"भाषा",display_theme:"प्रदर्शन थीम",pwa:"प्रोग्रेसिव वेब ऐप"},s={incorrect_format:"गलत प्रारूप, केवल CSV और TSV फ़ाइलें समर्थित हैं",new_column:"कॉलम जोड़ें",new_row:"नई पंक्ति",add_row_above:"ऊपर पंक्ति जोड़ें",add_row_below:"नीचे पंक्ति जोड़ें",add_column_left:"बाएं कॉलम जोड़ें",add_column_right:"दाएं कॉलम जोड़ें",delete_row:"पंक्ति हटाएं",delete_column:"कॉलम हटाएं",sort_column:"कॉलम को क्रमबद्ध करें",sort_ascending:"आरोही क्रम में क्रमबद्ध करें",sort_descending:"अवरोही क्रम में क्रमबद्ध करें",drop_to_upload:"यहाँ CSV या TSV फाइलें ड्रॉप करें ताकि डेटा डेटाफ़्रेम में आयात किया जा सके",clear_sort:"क्रमबद्धता हटाएं"},d={dropdown:"ड्रॉपडाउन"},i={build_error:"एक बिल्ड त्रुटि है",config_error:"एक कॉन्फ़िगरेशन त्रुटि है",contact_page_author:"कृपया पेज के लेखक को सूचित करने के लिए संपर्क करें।",no_app_file:"कोई ऐप फ़ाइल नहीं है",runtime_error:"एक रनटाइम त्रुटि है",space_not_working:'"Space काम नहीं कर रहा है क्योंकि" {0}',space_paused:"Space रोका गया है",use_via_api:"API के माध्यम से उपयोग करें"},l={uploading:"अपलोड हो रहा है..."},p={highlighted_text:"हाइलाइट किया गया टेक्स्ट"},u={allow_webcam_access:"कृपया रिकॉर्डिंग के लिए वेबकैम एक्सेस की अनुमति दें।",brush_color:"ब्रश का रंग",brush_radius:"ब्रश का आकार",image:"छवि",remove_image:"छवि हटाएं",select_brush_color:"ब्रश का रंग चुनें",start_drawing:"चित्रकारी शुरू करें",use_brush:"ब्रश का उपयोग करें",drop_to_upload:"यहाँ एक छवि फाइल डालें अपलोड करने के लिए"},g={label:"लेबल"},m={enable_cookies:"यदि आप इनकॉग्निटो मोड में HuggingFace Space का दौरा कर रहे हैं, तो आपको थर्ड-पार्टी कुकीज़ को सक्षम करना होगा।",incorrect_credentials:"गलत क्रेडेंशियल्स",username:"उपयोगकर्ता नाम",password:"पासवर्ड",login:"लॉग इन करें"},b={number:"संख्या"},h={plot:"प्लॉट"},w={radio:"रेडियो बटन"},f={slider:"स्लाइडर"},k={click_to_upload:"अपलोड करने के लिए क्लिक करें",drop_audio:"ऑडियो यहाँ छोड़ें",drop_csv:"CSV फाइल यहाँ छोड़ें",drop_file:"फ़ाइल यहाँ छोड़ें",drop_image:"छवि यहाँ छोड़ें",drop_video:"वीडियो यहाँ छोड़ें",drop_gallery:"मीडिया यहाँ छोड़ें",paste_clipboard:"क्लिपबोर्ड से पेस्ट करें"},S={drop_to_upload:"यहाँ एक वीडियो फाइल डालें अपलोड करने के लिए"},v={edit:"संपादित करें",retry:"पुनः प्रयास करें",undo:"वापस लें",submit:"भेजें",cancel:"रद्द करें",like:"पसंद",dislike:"नापसंद",clear:"चैट साफ़ करें"},x={_name:o,"3D_model":{"3d_model":"3D मॉडल",drop_to_upload:"यहाँ 3D मॉडल (.obj, .glb, .stl, .gltf, .splat, या .ply) फ़ाइल ड्रॉप करें अपलोड करने के लिए"},annotated_image:e,audio:r,blocks:t,checkbox:c,code:_,color_picker:a,common:n,dataframe:s,dropdown:d,errors:i,file:l,highlighted_text:p,image:u,label:g,login:m,number:b,plot:h,radio:w,slider:f,upload_text:k,video:S,chatbot:v};export{o as _name,e as annotated_image,r as audio,t as blocks,v as chatbot,c as checkbox,_ as code,a as color_picker,n as common,s as dataframe,x as default,d as dropdown,i as errors,l as file,p as highlighted_text,u as image,g as label,m as login,b as number,h as plot,w as radio,f as slider,k as upload_text,S as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/html-Ih_5QVTo.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/html-Ih_5QVTo.js new file mode 100644 index 0000000000000000000000000000000000000000..7b4e184911e4d7ce1cc4b66aeca2b485164b09b7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/html-Ih_5QVTo.js @@ -0,0 +1 @@ +import{t as E,b as $,r as N,c as b,d as h,g as l,h as m,e as u,i as v,C as D,j as O,k as R,H as w,D as C,s as M,l as T,m as g,F as y,n as k,o as A}from"./index-DWyDLubb.js";function F(_,o,i){if(!o||o===T(String(i??"")))return;let a;const t=_.__svelte_meta?.loc;t?a=`near ${t.file}:${t.line}:${t.column}`:g?.[y]&&(a=`in ${g[y]}`),k(A(a))}function I(_,o,i=!1,a=!1,t=!1){var d=_,n="";E(()=>{var f=$;if(n===(n=o()??"")){m&&u();return}if(f.nodes!==null&&(N(f.nodes.start,f.nodes.end),f.nodes=null),n!==""){if(m){for(var p=v.data,e=u(),c=e;e!==null&&(e.nodeType!==D||e.data!=="");)c=e,e=O(e);if(e===null)throw R(),w;C&&!t&&F(e.parentNode,p,n),h(v,c),d=M(e);return}var r=n+"";i?r=`${r}`:a&&(r=`${r}`);var s=b(r);if((i||a)&&(s=l(s)),h(l(s),s.lastChild),i||a)for(;l(s);)d.before(l(s));else d.before(s)}})}export{I as h}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/i18n-9kYrHpuJ.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/i18n-9kYrHpuJ.css new file mode 100644 index 0000000000000000000000000000000000000000..d0f31f63b9e3b8bc914f189100f5c7a9196bf758 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/i18n-9kYrHpuJ.css @@ -0,0 +1 @@ +.nav-holder.svelte-99kmwu{padding:var(--size-2) 0;border-bottom:solid 1px var(--border-color-primary)}nav.svelte-99kmwu{display:flex;flex-wrap:wrap;gap:var(--size-2);justify-content:flex-end;margin:0 auto;padding:0 var(--size-8)}nav.svelte-99kmwu a:where(.svelte-99kmwu){padding:var(--size-1) var(--size-2);border-radius:var(--block-radius);border-width:var(--block-border-width);border-color:transparent;color:var(--body-text-color-subdued)}nav.svelte-99kmwu a.active:where(.svelte-99kmwu){color:var(--body-text-color);border-color:var(--block-border-color);background-color:var(--block-background-fill)}.gradio-container-6-13-0{display:flex;position:relative;flex-direction:column;padding:0;min-height:1px;overflow:hidden;color:var(--button-secondary-text-color)}.embed-container.svelte-99kmwu{margin:var(--size-4) 0px;border:1px solid var(--button-secondary-border-color);border-radius:var(--embed-radius)}.with-info.svelte-99kmwu{padding-bottom:var(--size-7)}.embed-container.svelte-99kmwu>.main:where(.svelte-99kmwu){padding:var(--size-4)}.main.svelte-99kmwu{display:flex;flex-grow:1;flex-direction:column}.app.svelte-99kmwu{position:relative;margin:auto;padding:var(--size-4) var(--size-8);width:100%;height:100%}@media(min-width:640px){.fillable.svelte-99kmwu:not(.fill_width){max-width:640px}}@media(min-width:768px){.fillable.svelte-99kmwu:not(.fill_width){max-width:768px}}@media(min-width:1024px){.fillable.svelte-99kmwu:not(.fill_width){max-width:1024px}}@media(min-width:1280px){.fillable.svelte-99kmwu:not(.fill_width){max-width:1280px}}@media(min-width:1536px){.fillable.svelte-99kmwu:not(.fill_width){max-width:1536px}}@media(min-width:1920px){.fillable.svelte-99kmwu:not(.fill_width){max-width:1920px}}.info.svelte-99kmwu{display:flex;position:absolute;bottom:0;justify-content:flex-start;border-top:1px solid var(--button-secondary-border-color);padding:var(--size-1) var(--size-5);width:100%;color:var(--body-text-color-subdued);font-size:var(--text-md);white-space:nowrap}.info.svelte-99kmwu>span:where(.svelte-99kmwu){word-wrap:break-word;-break:keep-all;display:block;word-break:keep-all}.info.svelte-99kmwu>span:where(.svelte-99kmwu):nth-child(1){margin-right:4px;min-width:0px;max-width:max-content;overflow:hidden;color:var(--body-text-color);text-overflow:ellipsis;white-space:nowrap}.info.svelte-99kmwu>span:where(.svelte-99kmwu):nth-child(2){margin-right:3px}.info.svelte-99kmwu>span:where(.svelte-99kmwu):nth-child(2),.info.svelte-99kmwu>span:where(.svelte-99kmwu):nth-child(3){width:max-content}.info.svelte-99kmwu>span:where(.svelte-99kmwu):nth-child(3){align-self:flex-end;justify-self:flex-end;margin-left:auto;text-align:right}.info.svelte-99kmwu>span:where(.svelte-99kmwu):nth-child(1){flex-shrink:9}.hidden-title.svelte-99kmwu{position:absolute;left:var(--size-5);opacity:0;background:var(--button-secondary-background-fill);padding-right:4px}.info.svelte-99kmwu a:where(.svelte-99kmwu){color:var(--body-text-color)}.title.svelte-99kmwu{font-size:var(--text-sm);font-family:var(--font-mono)}.hf.svelte-99kmwu{margin-left:5px}.space-logo.svelte-99kmwu img:where(.svelte-99kmwu){display:inline-block;margin-bottom:4px;height:12px}.main.svelte-99kmwu a:where(.svelte-99kmwu):hover{text-decoration:underline} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/i18n-Dnhn5Rxr.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/i18n-Dnhn5Rxr.js new file mode 100644 index 0000000000000000000000000000000000000000..ad04a47c98f4e6224adc69b9f47e059fa1e4b686 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/i18n-Dnhn5Rxr.js @@ -0,0 +1,8 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Index-CFLsnuCC.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./Block-J4oodUWp.js","./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js","./snippet-BWgYNF9D.js","./ScrollFade-DV-0xzhB.css","./utils.svelte-CCyS_0CY.js","./clone-BkeCM4Nl.js","./index-CglBvmLb.js","./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js","./html-Ih_5QVTo.js","./index-B_pwUImq.js","./StreamingBar-CMuqaV2j.css","./Clear-BF6j078A.js","./Index.svelte_svelte_type_style_lang-BKODC18H.js","./Index-BDcHJDzf.css","./Index-DHz84ApK.css","./Index-BQpIYZRd.js","./BlockLabel-CZd21Hkw.js","./Empty-BIB2W5at.js","./Image-DrPceByI.js","./IconButtonWrapper-D0s9l4wW.js","./FullscreenButton-sCrcy_OJ.js","./Maximize-QH9NIRWs.js","./Index-DIMxqS5W.css","./StaticAudio-CdnK_Wm8.js","./DownloadLink-TGTaev7f.js","./ShareButton-wCSP7LoP.js","./Download-Di2PsS6O.js","./Music-BQN2qTdy.js","./MinimalAudioPlayer-Cb9FZeXv.js","./MinimalAudioPlayer-COky8gQS.css","./VolumeLevels-jRkFzCUK.js","./Play-BxqeM8KI.js","./Undo-C2-jWGVL.js","./StaticAudio-aRR9yp0X.css","./Example-D2mjvy71.js","./Example-PnzFsODt.css","./index-lMYqzEbX.js","./Upload-HitvyI7k.js","./actions-CLThs9VH.js","./Upload-C2I0h_eD.css","./ModifyUpload-CIJNunwR.js","./Edit-D-unDhOb.js","./StreamingBar-Cb4g-rUI.js","./record.esm-EHLfhwCm.js","./Spinner-Dhvehhrf.js","./UploadText-oRnvaG4b.js","./index-DEPmb5JS.css","./Index-BcflHCFb.js","./Index-C0OCjl9T.js","./__vite-browser-external-D7Ct-6yo.js","./Index-vigNnD5c.js","./Button-D-_s2ksk.js","./Image-CeW7PJs4.js","./misc-vsnLZ-Y1.js","./Image-Da_XA0w6.css","./Button-BZ4d-rtD.css","./ImagePreview-CCVfwC4m.css","./Index-Cva5NaVy.js","./input-DrerMDOL.js","./Check-DUAHzS2-.js","./Copy-ChCbTvli.js","./File-BHHIF0P7.js","./MarkdownCode-B8HQ3LiU.js","./prism-python-B4lzO_Nz.js","./MarkdownCode-7h5zEbas.css","./event-modifiers-CdEA5IGF.js","./Trash-D2U3jAj_.js","./Index-B80bIer5.css","./Example-DBPhM3Hl.js","./Example-Cpi22WGa.css","./Index-yEtVDF00.js","./Info-Dzjhnd64.js","./Checkbox-HhbcVSTv.js","./universal-CFOISHmx.js","./Checkbox-BbySKLMz.css","./Example-CbzIfTHK.js","./Example-QWdMqwA5.css","./Index-E6_HM5Fx.js","./BlockTitle-BMm9LakX.js","./index-tFQomdd2.js","./Index-BV5kouZe.css","./Example-C7q4tFc2.js","./Example-BK-tWmkG.css","./Index-DND_tLDq.js","./Code-BLWhl1y6.js","./Code-wZDUWKrz.css","./Code-Bg0YpSHl.js","./Example-B0koE8za.js","./Example-bHSd0VUC.css","./Index-BceQtuka.js","./tinycolor-BQBUvzv5.js","./Index-Ci-0XPiC.css","./Index-cd2fBqg2.js","./index-DkrWwIux.js","./Example-DD1VGTCq.js","./Example-jts6u4zx.css","./Index-CmTVIgCq.js","./size-CtOeLwIl.js","./DropdownArrow-BOSZEGSp.js","./dsv-DB8NKgIY.js","./Index-wgdu9Zy3.css","./Index-CUqdOFP7.js","./key-Xd_8JrI4.js","./Textbox-BuFR2fNz.js","./Send-B_rl9Hxa.js","./Square-CcB54dqq.js","./Textbox-B5AH0EoL.css","./Example-BC6WbF6q.js","./Example-Cvv6PwrD.css","./Index-DpH7sR6h.css","./Example-B_mfRiuX.js","./Index-BtbmsJIn.js","./Index-EYuwUe6R.css","./Example-BXmvnBf1.js","./Example-BUUMH8K0.css","./Index-oaxkLqhJ.js","./Plus-CDtuRS4x.js","./Dropdown-Beu8JVME.js","./window-Uydxco8n.js","./Dropdown--Uz_kS2s.css","./Index-BL27_CUo.css","./Example-BeU1J4ps.css","./Index-CzkKCnV2.js","./Index-3FqI08xq.css","./Index-Csvz6q0R.js","./Index-C3kmU5RB.css","./Example-CCcLQRgY.js","./Index-CEZhPgHw.js","./Example-m_TAV22D.js","./Example-CbN4r5yx.css","./Index-DRTA1kwo.js","./FileUpload-yTZ4bq_L.js","./FileUpload-DiuLlPU9.css","./Example-PAQ-gmig.js","./Example--V2chS2k.css","./Index-BBNOoCmW.js","./Index-CEhk7M0s.css","./Index-D5ut_MhQ.js","./BaseForm-B7Gu_hvH.js","./BaseForm-DJxyhkeW.css","./Gallery-BwMbO7WY.js","./Video-B_oD6cFy.js","./Video-emdvV6JL.css","./Gallery-D2TV53eD.css","./Example-B9bhmUl8.js","./Example-CA1DPrcM.css","./Index-CwPG6Lki.js","./Webcam-DQkeURjU.js","./ImageUploader-Dpdel1G9.css","./Index-DKIzZVIo.css","./Example-CZSJmqDf.css","./Index-Bfu-ph5m.js","./Index-BPmhhU8b.css","./Index-CvdjtBs2.js","./color-DNxsOKs1.js","./Index-Dg9ut_M4.css","./HTML-Bg_bA9M4.js","./HTML-CCquOCqP.css","./Example-CY2poEFg.js","./Example-BG5zdIqX.css","./Index-DCKyQnHX.js","./Index-5RnUXY9l.css","./ImagePreview-B2ps5aDR.js","./Example-7veL-tTh.js","./Index-C6mSODH4.js","./Example-obCq-B6m.js","./Example-C7vkYQeg.css","./Index-cYuhm-BK.js","./ArrowUp-D69HGcoh.js","./Index-BiPluRv8.css","./Example-DVQdodPf.js","./Example-CD_WZEqN.css","./Index-JJcQ8Ljz.js","./select-BigU4G0v.js","./dispatch-kxCwF96_.js","./Index-CKDSEi0w.css","./Example-lh5jo09q.js","./JSON-CNFUDzUL.js","./JSON-BjG2a1Vu.css","./Example-BlpJt4zj.css","./Index-CIs-xuv1.js","./Index-B4MNmBST.js","./LineChart-pr5WctpY.js","./Index--e-Yppt2.css","./Example-Csc6CXXA.js","./Example-CgIc4GLa.css","./Index-BVh8ZMox.js","./Index.svelte_svelte_type_style_lang-D9os8tfr.js","./Index-cY7HT1Ac.css","./ScrollFade-CIgHp1zY.js","./Model3D-HY69ejZB.js","./Model3D-CvGLqGnb.css","./Example-BvF-auBS.js","./Example-RXDI_Ar6.css","./Index-CtxMS3EK.js","./Index-CvyxbOJU.css","./Example-iNtc2BQ6.js","./Example-BIrWl-Kd.css","./Index-CvTz6tyr.js","./Index-bJ8TG0Hn.css","./Example-DnNUXGcx.js","./Index-BRBLpKMP.js","./Index-fPjHowzi.css","./Index-idnwMe3R.js","./Example-BLPBtkTF.js","./Example-BGbaSO1h.js","./Example-guFL0Sj1.css","./Index-CaF916uK.js","./Index-CTDY4JGM.css","./Example-BwHfD0oa.js","./Example-Do5iR6B9.css","./Index-nh82mmWC.js","./Index-Dd60luDZ.css","./Plot-DfljBR3n.js","./Index-BBjxpuJ4.js","./Example-Bt86cDLM.js","./Example-DWDv4qx4.css","./Index-C6F3e_Rs.js","./Index-pc9XuoeO.css","./Index-Cok7jpx4.js","./Index-BijVyRsD.css","./Index-Ci5Z17ae.js","./Index-DMaj38-p.css","./Example-BnU-j0j8.js","./Example-DSMNiXnn.css","./Index-Brqch1XL.js","./Index-CwinLc1f.css","./Index-4nvCzCrB.js","./index-BRj5epc3.js","./state.svelte-CXxGByZZ.js","./Index-DszFtJDg.js","./Walkthrough.svelte_svelte_type_style_lang-Bw7iC7Yg.js","./Walkthrough-CA8p9s2e.css","./Index-Ds3FAhOq.css","./Index-BrAqfQnF.js","./Index-qHbt41US.js","./Index-Br6Ie3Ai.js","./Index-7ZuVU2_6.js","./Index-Xhg3Ucw_.css","./Index-C-RstoJU.js","./Index-DP8ihX8q.css","./VideoPreview-DskP-c1w.js","./VideoPreview-CgLypBdz.css","./Example-DqXqJiLY.js","./Example-4NTZ2aku.css","./index-Dl5sO2oW.js","./index-uLojFN0n.css","./Example-BkTaSs73.js","./Example-D2nbjfVb.css","./Index-Dfc9uZ1M.js","./Index-BZR-ZeTY.css"])))=>i.map(i=>d[i]); +import{L as le,b3 as Mt,b4 as te,b5 as Vt,ao as Ie,b6 as ne,b7 as Zn,b8 as wr,h as D,i as Te,p as Hr,E as qn,e as Ut,b9 as Dr,aI as Br,aJ as yt,s as ke,ar as re,w as R,aB as er,ba as Nr,ad as Cr,$ as Mr,bb as Gt,D as _e,bc as Yn,bd as Qn,a3 as Le,aF as xt,be as Jn,bf as q,bg as ut,O as Ft,bh as Kn,bi as ei,j as ti,g as ri,C as ni,bj as ii,bk as Vr,A as Je,bl as oi,Q as ai,N as Ur,J as si,P as ui,bm as li,aP as fi,bn as ci,bo as hi,ag as _i,bp as pi,bq as mi,aj as di,al as vi,br as bi,aG as gi,bs as Ei,bt as yi,bu as xi,bv as Ti,B as Ai,z as W,bw as jt,bx as Pi,ai as Oi,y as tr,by as Tt,bz as Ii,G as $e,bA as Gr,b1 as K,I as Li,x as Se,bB as Si,aM as At,bC as Ri,bD as Fr,v as wi,b as kt,bE as Hi,bF as Di,bG as Bi,bH as Ni,bI as Ci,b0 as be,bJ as jr,aN as rr,bK as nr,bL as Mi,bM as Vi,bN as Ui,bO as Gi,bP as Fi,R as ji,a1 as lt,a2 as ki,t as Ve,a as Ue,T as $i,W as Ke,U as F,X as ge,V as $,a0 as Ge,a5 as zi,at as Xi,Y as j,a8 as ir,af as c}from"./index-DWyDLubb.js";class Wi{anchor;#t=new Map;#r=new Map;#e=new Map;#n=new Set;#i=!0;constructor(t,r=!0){this.anchor=t,this.#i=r}#o=()=>{var t=le;if(this.#t.has(t)){var r=this.#t.get(t),n=this.#r.get(r);if(n)Mt(n),this.#n.delete(r);else{var i=this.#e.get(r);i&&(this.#r.set(r,i.effect),this.#e.delete(r),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[o,a]of this.#t){if(this.#t.delete(o),o===t)break;const s=this.#e.get(a);s&&(te(s.effect),this.#e.delete(a))}for(const[o,a]of this.#r){if(o===r||this.#n.has(o))continue;const s=()=>{if(Array.from(this.#t.values()).includes(o)){var u=document.createDocumentFragment();Zn(a,u),u.append(Ie()),this.#e.set(o,{effect:a,fragment:u})}else te(a);this.#n.delete(o),this.#r.delete(o)};this.#i||!n?(this.#n.add(o),Vt(a,s,!1)):s()}}};#a=t=>{this.#t.delete(t);const r=Array.from(this.#t.values());for(const[n,i]of this.#e)r.includes(n)||(te(i.effect),this.#e.delete(n))};ensure(t,r){var n=le,i=wr();if(r&&!this.#r.has(t)&&!this.#e.has(t))if(i){var o=document.createDocumentFragment(),a=Ie();o.append(a),this.#e.set(t,{effect:ne(()=>r(a)),fragment:o})}else this.#r.set(t,ne(()=>r(this.anchor)));if(this.#t.set(n,t),i){for(const[s,l]of this.#r)s===t?n.skipped_effects.delete(l):n.skipped_effects.add(l);for(const[s,l]of this.#e)s===t?n.skipped_effects.delete(l.effect):n.skipped_effects.add(l.effect);n.oncommit(this.#o),n.ondiscard(this.#a)}else D&&(this.anchor=Te),this.#o()}}function or(e,t,r=!1){D&&Ut();var n=new Wi(e),i=r?qn:0;function o(a,s){if(D){const u=Dr(e)===Br;if(a===u){var l=yt();ke(l),n.anchor=l,re(!1),n.ensure(a,s),re(!0);return}}n.ensure(a,s)}Hr(()=>{var a=!1;t((s,l=!0)=>{a=!0,o(l,s)}),a||o(!1,null)},i)}function Zi(e,t){return t}function qi(e,t,r){for(var n=[],i=t.length,o,a=t.length,s=0;s{if(o){if(o.pending.delete(p),o.done.add(p),o.pending.size===0){var h=e.outrogroups;Pt(Gt(o.done)),h.delete(o),h.size===0&&(e.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=n.length===0&&r!==null;if(l){var u=r,f=u.parentNode;ei(f),f.append(u),e.items.clear()}Pt(t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Pt(e,t=!0){for(var r=0;r{var _=r();return Mr(_)?_:_==null?[]:Gt(_)}),h,v=!0;function g(){m.fallback=f,Qi(m,h,a,t,n),f!==null&&(h.length===0?(f.f&q)===0?Mt(f):(f.f^=q,Ae(f,null,a)):Vt(f,()=>{f=null}))}var x=Hr(()=>{h=R(p);var _=h.length;let b=!1;if(D){var d=Dr(a)===Br;d!==(_===0)&&(a=yt(),ke(a),re(!1),b=!0)}for(var y=new Set,A=le,E=wr(),P=0;P<_;P+=1){D&&Te.nodeType===ni&&Te.data===ii&&(a=Te,b=!0,re(!1));var H=h[P],C=n(H,P),O=v?null:s.get(C);O?(O.v&&er(O.v,H),O.i&&er(O.i,P),E&&A.skipped_effects.delete(O.e)):(O=Ji(s,v?a:ar??=Ie(),H,C,P,i,t,r),v||(O.e.f|=q),s.set(C,O)),y.add(C)}if(_===0&&o&&!f&&(v?f=ne(()=>o(a)):(f=ne(()=>o(ar??=Ie())),f.f|=q)),D&&_>0&&ke(yt()),!v)if(E){for(const[oe,ae]of s)y.has(oe)||A.skipped_effects.add(ae.e);A.oncommit(g),A.ondiscard(()=>{})}else g();b&&re(!0),R(p)}),m={effect:x,items:s,outrogroups:null,fallback:f};v=!1,D&&(a=Te)}function Qi(e,t,r,n,i){var o=(n&Kn)!==0,a=t.length,s=e.items,l=e.effect.first,u,f=null,p,h=[],v=[],g,x,m,_;if(o)for(_=0;_0){var C=(n&Nr)!==0&&a===0?r:null;if(o){for(_=0;_{if(p!==void 0)for(m of p)m.nodes?.a?.apply()})}function Ji(e,t,r,n,i,o,a,s){var l=(a&Yn)!==0?(a&Qn)===0?Le(r,!1,!1):xt(r):null,u=(a&Jn)!==0?xt(i):null;return _e&&l&&(l.trace=()=>{s()[u?.v??i]}),{v:l,i:u,e:ne(()=>(o(t,l??r,u??i,s),()=>{e.delete(n)}))}}function Ae(e,t,r){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end,o=t&&(t.f&q)===0?t.nodes.start:r;n!==null;){var a=ti(n);if(o.before(n),n===i)return;n=a}}function Y(e,t,r){t===null?e.effect.first=r:t.next=r,r===null?e.effect.last=t:r.prev=t}function Ki(e,t,r,n,i){D&&Ut();var o=t.$$slots?.[r],a=!1;o===!0&&(o=t[r==="default"?"children":r],a=!0),o===void 0||o(e,a?()=>n:n)}function eo(e,t){var r=void 0,n;Vr(()=>{r!==(r=t())&&(n&&(te(n),n=null),r&&(n=ne(()=>{Je(()=>r(e))})))})}function kr(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t=0;){var s=a+o;(a===0||sr.includes(n[a-1]))&&(s===n.length||sr.includes(n[s]))?n=(a===0?"":n.substring(0,a))+n.substring(s+1):a=s}}return n===""?null:n}function ur(e,t=!1){var r=t?" !important;":";",n="";for(var i in e){var o=e[i];o!=null&&o!==""&&(n+=" "+i+": "+o+r)}return n}function ft(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function io(e,t){if(t){var r="",n,i;if(Array.isArray(t)?(n=t[0],i=t[1]):n=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,a=0,s=!1,l=[];n&&l.push(...Object.keys(n).map(ft)),i&&l.push(...Object.keys(i).map(ft));var u=0,f=-1;const x=e.length;for(var p=0;p{We(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Ur(()=>{t.disconnect()})}function gs(e,t,r=t){var n=new WeakSet,i=!0;si(e,"change",o=>{var a=o?"[selected]":":checked",s;if(e.multiple)s=[].map.call(e.querySelectorAll(a),Re);else{var l=e.querySelector(a)??e.querySelector("option:not([disabled])");s=l&&Re(l)}r(s),le!==null&&n.add(le)}),Je(()=>{var o=t();if(e===document.activeElement){var a=ui??le;if(n.has(a))return}if(We(e,o,i),i&&o===void 0){var s=e.querySelector(":checked");s!==null&&(o=Re(s),r(o))}e.__value=o,i=!1}),zr(e)}function Re(e){return"__value"in e?e.__value:e.value}const Ee=Symbol("class"),ye=Symbol("style"),Xr=Symbol("is custom element"),Wr=Symbol("is html");function oo(e){if(D){var t=!1,r=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var n=e.value;Z(e,"value",null),e.value=n}if(e.hasAttribute("checked")){var i=e.checked;Z(e,"checked",null),e.checked=i}}};e.__on_r=r,Ft(r),xi()}}function Es(e,t){var r=et(e);r.value===(r.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!=="PROGRESS")||(e.value=t??"")}function ys(e,t){var r=et(e);r.checked!==(r.checked=t??void 0)&&(e.checked=t)}function ao(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function Z(e,t,r,n){var i=et(e);if(D&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")){n||uo(e,t,r??"");return}i[t]!==(i[t]=r)&&(t==="loading"&&(e[li]=r),r==null?e.removeAttribute(t):typeof r!="string"&&Zr(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function so(e,t,r,n,i=!1,o=!1){if(D&&i&&e.tagName==="INPUT"){var a=e,s=a.type==="checkbox"?"defaultChecked":"defaultValue";s in r||oo(a)}var l=et(e),u=l[Xr],f=!l[Wr];let p=D&&u;p&&re(!1);var h=t||{},v=e.tagName==="OPTION";for(var g in t)g in r||(r[g]=null);r.class?r.class=ro(r.class):(n||r[Ee])&&(r.class=null),r[ye]&&(r.style??=null);var x=Zr(e);for(const E in r){let P=r[E];if(v&&E==="value"&&P==null){e.value=e.__value="",h[E]=P;continue}if(E==="class"){var m=e.namespaceURI==="http://www.w3.org/1999/xhtml";Pe(e,m,P,n,t?.[Ee],r[Ee]),h[E]=P,h[Ee]=r[Ee];continue}if(E==="style"){$r(e,P,t?.[ye],r[ye]),h[E]=P,h[ye]=r[ye];continue}var _=h[E];if(!(P===_&&!(P===void 0&&e.hasAttribute(E)))){h[E]=P;var b=E[0]+E[1];if(b!=="$$")if(b==="on"){const H={},C="$$"+E;let O=E.slice(2);var d=Ei(O);if(pi(O)&&(O=O.slice(0,-7),H.capture=!0),!d&&_){if(P!=null)continue;e.removeEventListener(O,h[C],H),h[C]=null}if(P!=null)if(d)e[`__${O}`]=P,di([O]);else{let oe=function(ae){h[E].call(this,ae)};h[C]=mi(O,e,oe,H)}else d&&(e[`__${O}`]=void 0)}else if(E==="style")Z(e,E,P);else if(E==="autofocus")vi(e,!!P);else if(!u&&(E==="__value"||E==="value"&&P!=null))e.value=e.__value=P;else if(E==="selected"&&v)ao(e,P);else{var y=E;f||(y=bi(y));var A=y==="defaultValue"||y==="defaultChecked";if(P==null&&!u&&!A)if(l[E]=null,y==="value"||y==="checked"){let H=e;const C=t===void 0;if(y==="value"){let O=H.defaultValue;H.removeAttribute(y),H.defaultValue=O,H.value=H.__value=C?O:null}else{let O=H.defaultChecked;H.removeAttribute(y),H.defaultChecked=O,H.checked=C?O:!1}}else e.removeAttribute(E);else A||x.includes(y)&&(u||typeof P!="string")?(e[y]=P,y in l&&(l[y]=gi)):typeof P!="function"&&Z(e,y,P,o)}}}return p&&re(!0),h}function xs(e,t,r=[],n=[],i=[],o,a=!1,s=!1){fi(i,r,n,l=>{var u=void 0,f={},p=e.nodeName==="SELECT",h=!1;if(Vr(()=>{var g=t(...l.map(R)),x=so(e,u,g,o,a,s);h&&p&&"value"in g&&We(e,g.value);for(let _ of Object.getOwnPropertySymbols(f))g[_]||te(f[_]);for(let _ of Object.getOwnPropertySymbols(g)){var m=g[_];_.description===ci&&(!u||m!==u[_])&&(f[_]&&te(f[_]),f[_]=ne(()=>eo(e,()=>m))),x[_]=m}u=x}),p){var v=e;Je(()=>{We(v,u.value,!0),zr(v)})}h=!0})}function et(e){return e.__attributes??={[Xr]:e.nodeName.includes("-"),[Wr]:e.namespaceURI===hi}}var lr=new Map;function Zr(e){var t=e.getAttribute("is")||e.nodeName,r=lr.get(t);if(r)return r;lr.set(t,r=[]);for(var n,i=e,o=Element.prototype;o!==i;){n=yi(i);for(var a in n)n[a].set&&r.push(a);i=_i(i)}return r}function uo(e,t,r){_e&&(t==="srcset"&&lo(e,r)||Ot(e.getAttribute(t)??"",r)||Ti(t,e.outerHTML.replace(e.innerHTML,e.innerHTML&&"..."),String(r)))}function Ot(e,t){return e===t?!0:new URL(e,document.baseURI).href===new URL(t,document.baseURI).href}function fr(e){return e.split(",").map(t=>t.trim().split(" ").filter(Boolean))}function lo(e,t){var r=fr(e.srcset),n=fr(t);return n.length===r.length&&n.every(([i,o],a)=>o===r[a][1]&&(Ot(r[a][0],i)||Ot(i,r[a][0])))}function cr(e,t){return e===t||e?.[jt]===t}function fo(e={},t,r,n){return Je(()=>{var i,o;return Ai(()=>{i=o,o=n?.()||[],W(()=>{e!==r(...o)&&(t(e,...o),i&&cr(r(...i),e)&&t(null,...i))})}),()=>{Ft(()=>{o&&cr(r(...o),e)&&t(null,...o)})}}),e}function co(e=!1){const t=Pi,r=t.l.u;if(!r)return;let n=()=>$e(t.s);if(e){let i=0,o={};const a=Gr(()=>{let s=!1;const l=t.s;for(const u in l)l[u]!==o[u]&&(o[u]=l[u],s=!0);return s&&i++,i});n=()=>R(a)}r.b.length&&Oi(()=>{hr(t,n),Tt(r.b)}),tr(()=>{const i=W(()=>r.m.map(Ii));return()=>{for(const o of i)typeof o=="function"&&o()}}),r.a.length&&tr(()=>{hr(t,n),Tt(r.a)})}function hr(e,t){if(e.l.s)for(const r of e.l.s)R(r);t()}function $t(e,t,r){if(e==null)return t(void 0),r&&r(void 0),K;const n=W(()=>e.subscribe(t,r));return n.unsubscribe?()=>n.unsubscribe():n}const se=[];function ho(e,t){return{subscribe:Be(e,t).subscribe}}function Be(e,t=K){let r=null;const n=new Set;function i(s){if(Li(e,s)&&(e=s,r)){const l=!se.length;for(const u of n)u[1](),se.push(u,e);if(l){for(let u=0;u{n.delete(u),n.size===0&&r&&(r(),r=null)}}return{set:i,update:o,subscribe:a}}function pe(e,t,r){const n=!Array.isArray(e),i=n?[e]:e;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const o=t.length<2;return ho(r,(a,s)=>{let l=!1;const u=[];let f=0,p=K;const h=()=>{if(f)return;p();const g=t(n?u[0]:u,a,s);o?a(g):p=typeof g=="function"?g:K},v=i.map((g,x)=>$t(g,m=>{u[x]=m,f&=~(1<{f|=1<t=r)(),t}let Fe=!1,It=Symbol();function _r(e,t,r){const n=r[t]??={store:null,source:Le(void 0),unsubscribe:K};if(_e&&(n.source.label=t),n.store!==e&&!(It in r))if(n.unsubscribe(),n.store=e??null,e==null)n.source.v=void 0,n.unsubscribe=K;else{var i=!0;n.unsubscribe=$t(e,o=>{i?n.source.v=o:Se(n.source,o)}),i=!1}return e&&It in r?_o(e):R(n.source)}function Ts(e,t){return e.set(t),t}function po(){const e={};function t(){Ur(()=>{for(var r in e)e[r].unsubscribe();Si(e,It,{enumerable:!1,value:!0})})}return[e,t]}function mo(e){var t=Fe;try{return Fe=!1,[e(),Fe]}finally{Fe=t}}function As(e,t=1){const r=e();return e(r+t),r}const vo={get(e,t){if(!e.exclude.includes(t))return e.props[t]},set(e,t){return _e&&Mi(`${e.name}.${String(t)}`),!1},getOwnPropertyDescriptor(e,t){if(!e.exclude.includes(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},has(e,t){return e.exclude.includes(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.includes(t))}};function Ps(e,t,r){return new Proxy(_e?{props:e,exclude:t,name:r,other:{},to_proxy:[]}:{props:e,exclude:t},vo)}const bo={get(e,t){if(!e.exclude.includes(t))return R(e.version),t in e.special?e.special[t]():e.props[t]},set(e,t,r){if(!(t in e.special)){var n=kt;try{nr(e.parent_effect),e.special[t]=G({get[t](){return e.props[t]}},t,Fr)}finally{nr(n)}}return e.special[t](r),rr(e.version),!0},getOwnPropertyDescriptor(e,t){if(!e.exclude.includes(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},deleteProperty(e,t){return e.exclude.includes(t)||(e.exclude.push(t),rr(e.version)),!0},has(e,t){return e.exclude.includes(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.includes(t))}};function Os(e,t){return new Proxy({props:e,exclude:t,special:{},version:xt(0),parent_effect:kt},bo)}const go={get(e,t){let r=e.props.length;for(;r--;){let n=e.props[r];if(be(n)&&(n=n()),typeof n=="object"&&n!==null&&t in n)return n[t]}},set(e,t,r){let n=e.props.length;for(;n--;){let i=e.props[n];be(i)&&(i=i());const o=At(i,t);if(o&&o.set)return o.set(r),!0}return!1},getOwnPropertyDescriptor(e,t){let r=e.props.length;for(;r--;){let n=e.props[r];if(be(n)&&(n=n()),typeof n=="object"&&n!==null&&t in n){const i=At(n,t);return i&&!i.configurable&&(i.configurable=!0),i}}},has(e,t){if(t===jt||t===jr)return!1;for(let r of e.props)if(be(r)&&(r=r()),r!=null&&t in r)return!0;return!1},ownKeys(e){const t=[];for(let r of e.props)if(be(r)&&(r=r()),!!r){for(const n in r)t.includes(n)||t.push(n);for(const n of Object.getOwnPropertySymbols(r))t.includes(n)||t.push(n)}return t}};function Is(...e){return new Proxy({props:e},go)}function G(e,t,r,n){var i=!Vi||(r&Ui)!==0,o=(r&Di)!==0,a=(r&Ni)!==0,s=n,l=!0,u=()=>(l&&(l=!1,s=a?W(n):n),s),f;if(o){var p=jt in e||jr in e;f=At(e,t)?.set??(p&&t in e?d=>e[t]=d:void 0)}var h,v=!1;o?[h,v]=mo(()=>e[t]):h=e[t],h===void 0&&n!==void 0&&(h=u(),f&&(i&&Ri(t),f(h)));var g;if(i?g=()=>{var d=e[t];return d===void 0?u():(l=!0,d)}:g=()=>{var d=e[t];return d!==void 0&&(s=void 0),d===void 0?s:d},i&&(r&Fr)===0)return g;if(f){var x=e.$$legacy;return(function(d,y){return arguments.length>0?((!i||!y||x||v)&&f(y?g():d),d):g()})}var m=!1,_=((r&Bi)!==0?Gr:Cr)(()=>(m=!1,g()));_e&&(_.label=t),o&&R(_);var b=kt;return(function(d,y){if(arguments.length>0){const A=y?R(_):i&&o?wi(d):d;return Se(_,A),m=!0,s!==void 0&&(s=A),d}return Ci&&m||(b.f&Hi)!==0?_.v:R(_)})}Gi();Fi();const Eo="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='10'%20height='10'%20fill='none'%3e%3cpath%20fill='%23FF3270'%20d='M1.93%206.03v2.04h2.04V6.03H1.93Z'/%3e%3cpath%20fill='%23861FFF'%20d='M6.03%206.03v2.04h2.04V6.03H6.03Z'/%3e%3cpath%20fill='%23097EFF'%20d='M1.93%201.93v2.04h2.04V1.93H1.93Z'/%3e%3cpath%20fill='%23000'%20fill-rule='evenodd'%20d='M.5%201.4c0-.5.4-.9.9-.9h3.1a.9.9%200%200%201%20.87.67A2.44%202.44%200%200%201%209.5%202.95c0%20.65-.25%201.24-.67%201.68.39.1.67.46.67.88v3.08c0%20.5-.4.91-.9.91H1.4a.9.9%200%200%201-.9-.9V1.4Zm1.43.53v2.04h2.04V1.93H1.93Zm0%206.14V6.03h2.04v2.04H1.93Zm4.1%200V6.03h2.04v2.04H6.03Zm0-5.12a1.02%201.02%200%201%201%202.04%200%201.02%201.02%200%200%201-2.04%200Z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23FFD702'%20d='M7.05%201.93a1.02%201.02%200%201%200%200%202.04%201.02%201.02%200%200%200%200-2.04Z'/%3e%3c/svg%3e";var Ls=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ss(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function n(){var i=!1;try{i=this instanceof n}catch{}return i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var ht,pr;function xo(){if(pr)return ht;pr=1;var e=function(b){return t(b)&&!r(b)};function t(_){return!!_&&typeof _=="object"}function r(_){var b=Object.prototype.toString.call(_);return b==="[object RegExp]"||b==="[object Date]"||o(_)}var n=typeof Symbol=="function"&&Symbol.for,i=n?Symbol.for("react.element"):60103;function o(_){return _.$$typeof===i}function a(_){return Array.isArray(_)?[]:{}}function s(_,b){return b.clone!==!1&&b.isMergeableObject(_)?x(a(_),_,b):_}function l(_,b,d){return _.concat(b).map(function(y){return s(y,d)})}function u(_,b){if(!b.customMerge)return x;var d=b.customMerge(_);return typeof d=="function"?d:x}function f(_){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(_).filter(function(b){return Object.propertyIsEnumerable.call(_,b)}):[]}function p(_){return Object.keys(_).concat(f(_))}function h(_,b){try{return b in _}catch{return!1}}function v(_,b){return h(_,b)&&!(Object.hasOwnProperty.call(_,b)&&Object.propertyIsEnumerable.call(_,b))}function g(_,b,d){var y={};return d.isMergeableObject(_)&&p(_).forEach(function(A){y[A]=s(_[A],d)}),p(b).forEach(function(A){v(_,A)||(h(_,A)&&d.isMergeableObject(b[A])?y[A]=u(A,d)(_[A],b[A],d):y[A]=s(b[A],d))}),y}function x(_,b,d){d=d||{},d.arrayMerge=d.arrayMerge||l,d.isMergeableObject=d.isMergeableObject||e,d.cloneUnlessOtherwiseSpecified=s;var y=Array.isArray(b),A=Array.isArray(_),E=y===A;return E?y?d.arrayMerge(_,b,d):g(_,b,d):s(b,d)}x.all=function(b,d){if(!Array.isArray(b))throw new Error("first argument should be an array");return b.reduce(function(y,A){return x(y,A,d)},{})};var m=x;return ht=m,ht}var To=xo();const Ao=yo(To);var Lt=function(e,t){return Lt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Lt(e,t)};function tt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Lt(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var S=function(){return S=Object.assign||function(t){for(var r,n=1,i=arguments.length;n"u"&&(o=e.call(this,n),t.set(i,o)),o}function qr(e,t,r){var n=Array.prototype.slice.call(arguments,3),i=r(n),o=t.get(i);return typeof o>"u"&&(o=e.apply(this,n),t.set(i,o)),o}function Yr(e,t,r,n,i){return r.bind(t,e,n,i)}function Lo(e,t){var r=e.length===1?Io:qr;return Yr(e,this,r,t.cache.create(),t.serializer)}function So(e,t){return Yr(e,this,qr,t.cache.create(),t.serializer)}var Ro=function(){return JSON.stringify(arguments)},wo=(function(){function e(){this.cache=Object.create(null)}return e.prototype.get=function(t){return this.cache[t]},e.prototype.set=function(t,r){this.cache[t]=r},e})(),Ho={create:function(){return new wo}},mt={variadic:So},I;(function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]="EXPECT_ARGUMENT_CLOSING_BRACE",e[e.EMPTY_ARGUMENT=2]="EMPTY_ARGUMENT",e[e.MALFORMED_ARGUMENT=3]="MALFORMED_ARGUMENT",e[e.EXPECT_ARGUMENT_TYPE=4]="EXPECT_ARGUMENT_TYPE",e[e.INVALID_ARGUMENT_TYPE=5]="INVALID_ARGUMENT_TYPE",e[e.EXPECT_ARGUMENT_STYLE=6]="EXPECT_ARGUMENT_STYLE",e[e.INVALID_NUMBER_SKELETON=7]="INVALID_NUMBER_SKELETON",e[e.INVALID_DATE_TIME_SKELETON=8]="INVALID_DATE_TIME_SKELETON",e[e.EXPECT_NUMBER_SKELETON=9]="EXPECT_NUMBER_SKELETON",e[e.EXPECT_DATE_TIME_SKELETON=10]="EXPECT_DATE_TIME_SKELETON",e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]="UNCLOSED_QUOTE_IN_ARGUMENT_STYLE",e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]="EXPECT_SELECT_ARGUMENT_OPTIONS",e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]="EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]="INVALID_PLURAL_ARGUMENT_OFFSET_VALUE",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]="EXPECT_SELECT_ARGUMENT_SELECTOR",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]="EXPECT_PLURAL_ARGUMENT_SELECTOR",e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]="EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT",e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]="EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT",e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]="INVALID_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]="DUPLICATE_PLURAL_ARGUMENT_SELECTOR",e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]="DUPLICATE_SELECT_ARGUMENT_SELECTOR",e[e.MISSING_OTHER_CLAUSE=22]="MISSING_OTHER_CLAUSE",e[e.INVALID_TAG=23]="INVALID_TAG",e[e.INVALID_TAG_NAME=25]="INVALID_TAG_NAME",e[e.UNMATCHED_CLOSING_TAG=26]="UNMATCHED_CLOSING_TAG",e[e.UNCLOSED_TAG=27]="UNCLOSED_TAG"})(I||(I={}));var w;(function(e){e[e.literal=0]="literal",e[e.argument=1]="argument",e[e.number=2]="number",e[e.date=3]="date",e[e.time=4]="time",e[e.select=5]="select",e[e.plural=6]="plural",e[e.pound=7]="pound",e[e.tag=8]="tag"})(w||(w={}));var fe;(function(e){e[e.number=0]="number",e[e.dateTime=1]="dateTime"})(fe||(fe={}));function mr(e){return e.type===w.literal}function Do(e){return e.type===w.argument}function Qr(e){return e.type===w.number}function Jr(e){return e.type===w.date}function Kr(e){return e.type===w.time}function en(e){return e.type===w.select}function tn(e){return e.type===w.plural}function Bo(e){return e.type===w.pound}function rn(e){return e.type===w.tag}function nn(e){return!!(e&&typeof e=="object"&&e.type===fe.number)}function St(e){return!!(e&&typeof e=="object"&&e.type===fe.dateTime)}var on=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,No=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function Co(e){var t={};return e.replace(No,function(r){var n=r.length;switch(r[0]){case"G":t.era=n===4?"long":n===5?"narrow":"short";break;case"y":t.year=n===2?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":t.month=["numeric","2-digit","short","long","narrow"][n-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":t.day=["numeric","2-digit"][n-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":t.weekday=n===4?"long":n===5?"narrow":"short";break;case"e":if(n<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][n-4];break;case"c":if(n<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=["short","long","narrow","short"][n-4];break;case"a":t.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":t.hourCycle="h12",t.hour=["numeric","2-digit"][n-1];break;case"H":t.hourCycle="h23",t.hour=["numeric","2-digit"][n-1];break;case"K":t.hourCycle="h11",t.hour=["numeric","2-digit"][n-1];break;case"k":t.hourCycle="h24",t.hour=["numeric","2-digit"][n-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":t.minute=["numeric","2-digit"][n-1];break;case"s":t.second=["numeric","2-digit"][n-1];break;case"S":case"A":throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");case"z":t.timeZoneName=n<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""}),t}var Mo=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;function Vo(e){if(e.length===0)throw new Error("Number skeleton cannot be empty");for(var t=e.split(Mo).filter(function(h){return h.length>0}),r=[],n=0,i=t;n1)throw new RangeError("integer-width stems only accept a single optional option");i.options[0].replace(Go,function(l,u,f,p,h,v){if(u)t.minimumIntegerDigits=f.length;else{if(p&&h)throw new Error("We currently do not support maximum integer digits");if(v)throw new Error("We currently do not support exact integer digits")}return""});continue}if(sn.test(i.stem)){t.minimumIntegerDigits=i.stem.length;continue}if(dr.test(i.stem)){if(i.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");i.stem.replace(dr,function(l,u,f,p,h,v){return f==="*"?t.minimumFractionDigits=u.length:p&&p[0]==="#"?t.maximumFractionDigits=p.length:h&&v?(t.minimumFractionDigits=h.length,t.maximumFractionDigits=h.length+v.length):(t.minimumFractionDigits=u.length,t.maximumFractionDigits=u.length),""});var o=i.options[0];o==="w"?t=S(S({},t),{trailingZeroDisplay:"stripIfInteger"}):o&&(t=S(S({},t),vr(o)));continue}if(an.test(i.stem)){t=S(S({},t),vr(i.stem));continue}var a=un(i.stem);a&&(t=S(S({},t),a));var s=Fo(i.stem);s&&(t=S(S({},t),s))}return t}var je={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function ko(e,t){for(var r="",n=0;n>1),l="a",u=$o(t);for((u=="H"||u=="k")&&(s=0);s-- >0;)r+=l;for(;a-- >0;)r=u+r}else i==="J"?r+="H":r+=i}return r}function $o(e){var t=e.hourCycle;if(t===void 0&&e.hourCycles&&e.hourCycles.length&&(t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var r=e.language,n;r!=="root"&&(n=e.maximize().region);var i=je[n||""]||je[r||""]||je["".concat(r,"-001")]||je["001"];return i[0]}var dt,zo=new RegExp("^".concat(on.source,"*")),Xo=new RegExp("".concat(on.source,"*$"));function L(e,t){return{start:e,end:t}}var Wo=!!String.prototype.startsWith&&"_a".startsWith("a",1),Zo=!!String.fromCodePoint,qo=!!Object.fromEntries,Yo=!!String.prototype.codePointAt,Qo=!!String.prototype.trimStart,Jo=!!String.prototype.trimEnd,Ko=!!Number.isSafeInteger,ea=Ko?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},Rt=!0;try{var ta=fn("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");Rt=((dt=ta.exec("a"))===null||dt===void 0?void 0:dt[0])==="a"}catch{Rt=!1}var gr=Wo?function(t,r,n){return t.startsWith(r,n)}:function(t,r,n){return t.slice(n,n+r.length)===r},wt=Zo?String.fromCodePoint:function(){for(var t=[],r=0;ro;){if(a=t[o++],a>1114111)throw RangeError(a+" is not a valid code point");n+=a<65536?String.fromCharCode(a):String.fromCharCode(((a-=65536)>>10)+55296,a%1024+56320)}return n},Er=qo?Object.fromEntries:function(t){for(var r={},n=0,i=t;n=n)){var i=t.charCodeAt(r),o;return i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?i:(i-55296<<10)+(o-56320)+65536}},ra=Qo?function(t){return t.trimStart()}:function(t){return t.replace(zo,"")},na=Jo?function(t){return t.trimEnd()}:function(t){return t.replace(Xo,"")};function fn(e,t){return new RegExp(e,t)}var Ht;if(Rt){var yr=fn("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");Ht=function(t,r){var n;yr.lastIndex=r;var i=yr.exec(t);return(n=i[1])!==null&&n!==void 0?n:""}}else Ht=function(t,r){for(var n=[];;){var i=ln(t,r);if(i===void 0||cn(i)||sa(i))break;n.push(i),r+=i>=65536?2:1}return wt.apply(void 0,n)};var ia=(function(){function e(t,r){r===void 0&&(r={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!r.ignoreTag,this.locale=r.locale,this.requiresOtherClause=!!r.requiresOtherClause,this.shouldParseSkeletons=!!r.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,r,n){for(var i=[];!this.isEOF();){var o=this.char();if(o===123){var a=this.parseArgument(t,n);if(a.err)return a;i.push(a.val)}else{if(o===125&&t>0)break;if(o===35&&(r==="plural"||r==="selectordinal")){var s=this.clonePosition();this.bump(),i.push({type:w.pound,location:L(s,this.clonePosition())})}else if(o===60&&!this.ignoreTag&&this.peek()===47){if(n)break;return this.error(I.UNMATCHED_CLOSING_TAG,L(this.clonePosition(),this.clonePosition()))}else if(o===60&&!this.ignoreTag&&Dt(this.peek()||0)){var a=this.parseTag(t,r);if(a.err)return a;i.push(a.val)}else{var a=this.parseLiteral(t,r);if(a.err)return a;i.push(a.val)}}}return{val:i,err:null}},e.prototype.parseTag=function(t,r){var n=this.clonePosition();this.bump();var i=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:w.literal,value:"<".concat(i,"/>"),location:L(n,this.clonePosition())},err:null};if(this.bumpIf(">")){var o=this.parseMessage(t+1,r,!0);if(o.err)return o;var a=o.val,s=this.clonePosition();if(this.bumpIf("")?{val:{type:w.tag,value:i,children:a,location:L(n,this.clonePosition())},err:null}:this.error(I.INVALID_TAG,L(s,this.clonePosition())))}else return this.error(I.UNCLOSED_TAG,L(n,this.clonePosition()))}else return this.error(I.INVALID_TAG,L(n,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&aa(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,r){for(var n=this.clonePosition(),i="";;){var o=this.tryParseQuote(r);if(o){i+=o;continue}var a=this.tryParseUnquoted(t,r);if(a){i+=a;continue}var s=this.tryParseLeftAngleBracket();if(s){i+=s;continue}break}var l=L(n,this.clonePosition());return{val:{type:w.literal,value:i,location:l},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!oa(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var r=[this.char()];for(this.bump();!this.isEOF();){var n=this.char();if(n===39)if(this.peek()===39)r.push(39),this.bump();else{this.bump();break}else r.push(n);this.bump()}return wt.apply(void 0,r)},e.prototype.tryParseUnquoted=function(t,r){if(this.isEOF())return null;var n=this.char();return n===60||n===123||n===35&&(r==="plural"||r==="selectordinal")||n===125&&t>0?null:(this.bump(),wt(n))},e.prototype.parseArgument=function(t,r){var n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(I.EXPECT_ARGUMENT_CLOSING_BRACE,L(n,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(I.EMPTY_ARGUMENT,L(n,this.clonePosition()));var i=this.parseIdentifierIfPossible().value;if(!i)return this.error(I.MALFORMED_ARGUMENT,L(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(I.EXPECT_ARGUMENT_CLOSING_BRACE,L(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:w.argument,value:i,location:L(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(I.EXPECT_ARGUMENT_CLOSING_BRACE,L(n,this.clonePosition())):this.parseArgumentOptions(t,r,i,n);default:return this.error(I.MALFORMED_ARGUMENT,L(n,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),r=this.offset(),n=Ht(this.message,r),i=r+n.length;this.bumpTo(i);var o=this.clonePosition(),a=L(t,o);return{value:n,location:a}},e.prototype.parseArgumentOptions=function(t,r,n,i){var o,a=this.clonePosition(),s=this.parseIdentifierIfPossible().value,l=this.clonePosition();switch(s){case"":return this.error(I.EXPECT_ARGUMENT_TYPE,L(a,l));case"number":case"date":case"time":{this.bumpSpace();var u=null;if(this.bumpIf(",")){this.bumpSpace();var f=this.clonePosition(),p=this.parseSimpleArgStyleIfPossible();if(p.err)return p;var h=na(p.val);if(h.length===0)return this.error(I.EXPECT_ARGUMENT_STYLE,L(this.clonePosition(),this.clonePosition()));var v=L(f,this.clonePosition());u={style:h,styleLocation:v}}var g=this.tryParseArgumentClose(i);if(g.err)return g;var x=L(i,this.clonePosition());if(u&&gr(u?.style,"::",0)){var m=ra(u.style.slice(2));if(s==="number"){var p=this.parseNumberSkeletonFromString(m,u.styleLocation);return p.err?p:{val:{type:w.number,value:n,location:x,style:p.val},err:null}}else{if(m.length===0)return this.error(I.EXPECT_DATE_TIME_SKELETON,x);var _=m;this.locale&&(_=ko(m,this.locale));var h={type:fe.dateTime,pattern:_,location:u.styleLocation,parsedOptions:this.shouldParseSkeletons?Co(_):{}},b=s==="date"?w.date:w.time;return{val:{type:b,value:n,location:x,style:h},err:null}}}return{val:{type:s==="number"?w.number:s==="date"?w.date:w.time,value:n,location:x,style:(o=u?.style)!==null&&o!==void 0?o:null},err:null}}case"plural":case"selectordinal":case"select":{var d=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(I.EXPECT_SELECT_ARGUMENT_OPTIONS,L(d,S({},d)));this.bumpSpace();var y=this.parseIdentifierIfPossible(),A=0;if(s!=="select"&&y.value==="offset"){if(!this.bumpIf(":"))return this.error(I.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,L(this.clonePosition(),this.clonePosition()));this.bumpSpace();var p=this.tryParseDecimalInteger(I.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,I.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(p.err)return p;this.bumpSpace(),y=this.parseIdentifierIfPossible(),A=p.val}var E=this.tryParsePluralOrSelectOptions(t,s,r,y);if(E.err)return E;var g=this.tryParseArgumentClose(i);if(g.err)return g;var P=L(i,this.clonePosition());return s==="select"?{val:{type:w.select,value:n,options:Er(E.val),location:P},err:null}:{val:{type:w.plural,value:n,options:Er(E.val),offset:A,pluralType:s==="plural"?"cardinal":"ordinal",location:P},err:null}}default:return this.error(I.INVALID_ARGUMENT_TYPE,L(a,l))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(I.EXPECT_ARGUMENT_CLOSING_BRACE,L(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,r=this.clonePosition();!this.isEOF();){var n=this.char();switch(n){case 39:{this.bump();var i=this.clonePosition();if(!this.bumpUntil("'"))return this.error(I.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,L(i,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(r.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(r.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,r){var n=[];try{n=Vo(t)}catch{return this.error(I.INVALID_NUMBER_SKELETON,r)}return{val:{type:fe.number,tokens:n,location:r,parsedOptions:this.shouldParseSkeletons?jo(n):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,r,n,i){for(var o,a=!1,s=[],l=new Set,u=i.value,f=i.location;;){if(u.length===0){var p=this.clonePosition();if(r!=="select"&&this.bumpIf("=")){var h=this.tryParseDecimalInteger(I.EXPECT_PLURAL_ARGUMENT_SELECTOR,I.INVALID_PLURAL_ARGUMENT_SELECTOR);if(h.err)return h;f=L(p,this.clonePosition()),u=this.message.slice(p.offset,this.offset())}else break}if(l.has(u))return this.error(r==="select"?I.DUPLICATE_SELECT_ARGUMENT_SELECTOR:I.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,f);u==="other"&&(a=!0),this.bumpSpace();var v=this.clonePosition();if(!this.bumpIf("{"))return this.error(r==="select"?I.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:I.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,L(this.clonePosition(),this.clonePosition()));var g=this.parseMessage(t+1,r,n);if(g.err)return g;var x=this.tryParseArgumentClose(v);if(x.err)return x;s.push([u,{value:g.val,location:L(v,this.clonePosition())}]),l.add(u),this.bumpSpace(),o=this.parseIdentifierIfPossible(),u=o.value,f=o.location}return s.length===0?this.error(r==="select"?I.EXPECT_SELECT_ARGUMENT_SELECTOR:I.EXPECT_PLURAL_ARGUMENT_SELECTOR,L(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!a?this.error(I.MISSING_OTHER_CLAUSE,L(this.clonePosition(),this.clonePosition())):{val:s,err:null}},e.prototype.tryParseDecimalInteger=function(t,r){var n=1,i=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(n=-1);for(var o=!1,a=0;!this.isEOF();){var s=this.char();if(s>=48&&s<=57)o=!0,a=a*10+(s-48),this.bump();else break}var l=L(i,this.clonePosition());return o?(a*=n,ea(a)?{val:a,err:null}:this.error(r,l)):this.error(t,l)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var r=ln(this.message,t);if(r===void 0)throw Error("Offset ".concat(t," is at invalid UTF-16 code unit boundary"));return r},e.prototype.error=function(t,r){return{val:null,err:{kind:t,message:this.message,location:r}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(gr(this.message,t,this.offset())){for(var r=0;r=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset ".concat(t," must be greater than or equal to the current offset ").concat(this.offset()));for(t=Math.min(t,this.message.length);;){var r=this.offset();if(r===t)break;if(r>t)throw Error("targetOffset ".concat(t," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&cn(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),r=this.offset(),n=this.message.charCodeAt(r+(t>=65536?2:1));return n??null},e})();function Dt(e){return e>=97&&e<=122||e>=65&&e<=90}function oa(e){return Dt(e)||e===47}function aa(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function cn(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function sa(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function Bt(e){e.forEach(function(t){if(delete t.location,en(t)||tn(t))for(var r in t.options)delete t.options[r].location,Bt(t.options[r].value);else Qr(t)&&nn(t.style)||(Jr(t)||Kr(t))&&St(t.style)?delete t.style.location:rn(t)&&Bt(t.children)})}function ua(e,t){t===void 0&&(t={}),t=S({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var r=new ia(e,t).parse();if(r.err){var n=SyntaxError(I[r.err.kind]);throw n.location=r.err.location,n.originalMessage=r.err.message,n}return t?.captureLocation||Bt(r.val),r.val}var ce;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(ce||(ce={}));var rt=(function(e){tt(t,e);function t(r,n,i){var o=e.call(this,r)||this;return o.code=n,o.originalMessage=i,o}return t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t})(Error),xr=(function(e){tt(t,e);function t(r,n,i,o){return e.call(this,'Invalid values for "'.concat(r,'": "').concat(n,'". Options are "').concat(Object.keys(i).join('", "'),'"'),ce.INVALID_VALUE,o)||this}return t})(rt),la=(function(e){tt(t,e);function t(r,n,i){return e.call(this,'Value for "'.concat(r,'" must be of type ').concat(n),ce.INVALID_VALUE,i)||this}return t})(rt),fa=(function(e){tt(t,e);function t(r,n){return e.call(this,'The intl string context variable "'.concat(r,'" was not provided to the string "').concat(n,'"'),ce.MISSING_VALUE,n)||this}return t})(rt),V;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(V||(V={}));function ca(e){return e.length<2?e:e.reduce(function(t,r){var n=t[t.length-1];return!n||n.type!==V.literal||r.type!==V.literal?t.push(r):n.value+=r.value,t},[])}function ha(e){return typeof e=="function"}function ze(e,t,r,n,i,o,a){if(e.length===1&&mr(e[0]))return[{type:V.literal,value:e[0].value}];for(var s=[],l=0,u=e;l"u")){var r=Intl.NumberFormat.supportedLocalesOf(t);return r.length>0?new Intl.Locale(r[0]):new Intl.Locale(typeof t=="string"?t:t[0])}},e.__parse=ua,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e})();function da(e,t){if(t==null)return;if(t in e)return e[t];const r=t.split(".");let n=e;for(let i=0;i0){const o=r.slice(i,r.length).join(".");if(o in n){n=n[o];break}}n=n[r[i]]}else n=void 0;return n}const J={},va=(e,t,r)=>r&&(t in J||(J[t]={}),e in J[t]||(J[t][e]=r),r),_n=(e,t)=>{if(t==null)return;if(t in J&&e in J[t])return J[t][e];const r=Ne(t);for(let n=0;n(r[e]=Ao.all([r[e]||{},...t]),r))}pe([me],([e])=>Object.keys(e));me.subscribe(e=>zt=e);const we={};function ya(e){we[e]=new Set}function xa(e,t){we[e].delete(t),we[e].size===0&&delete we[e]}function He(e){return we[e]}function Ta(e){return Ne(e).map(t=>{const r=He(t);return[t,r?[...r]:[]]}).filter(([,t])=>t.length>0)}function Ze(e){return e==null?!1:Ne(e).some(t=>{var r;return(r=He(t))==null?void 0:r.size})}function Aa(e,t){return Promise.all(t.map(n=>(xa(e,n),n().then(i=>i.default||i)))).then(n=>Xe(e,...n))}const xe={};function pn(e){if(!Ze(e))return e in xe?xe[e]:Promise.resolve();const t=Ta(e);return xe[e]=Promise.all(t.map(([r,n])=>Aa(r,n))).then(()=>{if(Ze(e))return pn(e);delete xe[e]}),xe[e]}function Pa(e,t){He(e)||ya(e);const r=He(e);He(e).has(t)||(Xt(e)||me.update(n=>(n[e]={},n)),r.add(t))}var Tr=Object.getOwnPropertySymbols,Oa=Object.prototype.hasOwnProperty,Ia=Object.prototype.propertyIsEnumerable,La=(e,t)=>{var r={};for(var n in e)Oa.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Tr)for(var n of Tr(e))t.indexOf(n)<0&&Ia.call(e,n)&&(r[n]=e[n]);return r};const Sa={number:{scientific:{notation:"scientific"},engineering:{notation:"engineering"},compactLong:{notation:"compact",compactDisplay:"long"},compactShort:{notation:"compact",compactDisplay:"short"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}};function Ra({locale:e,id:t}){console.warn(`[svelte-i18n] The message "${t}" was not found in "${Ne(e).join('", "')}".${Ze(ee())?` + +Note: there are at least one loader still registered to this locale that wasn't executed.`:""}`)}const wa={fallbackLocale:null,loadingDelay:200,formats:Sa,warnOnMissingMessages:!0,handleMissingMessage:void 0,ignoreTag:!0},Oe=wa;function he(){return Oe}function Ha(e){const t=e,{formats:r}=t,n=La(t,["formats"]);let i=e.fallbackLocale;if(e.initialLocale)try{hn.resolveLocale(e.initialLocale)&&(i=e.initialLocale)}catch{console.warn(`[svelte-i18n] The initial locale "${e.initialLocale}" is not a valid locale.`)}return n.warnOnMissingMessages&&(delete n.warnOnMissingMessages,n.handleMissingMessage==null?n.handleMissingMessage=Ra:console.warn('[svelte-i18n] The "warnOnMissingMessages" option is deprecated. Please use the "handleMissingMessage" option instead.')),Object.assign(Oe,n,{initialLocale:i}),r&&("number"in r&&Object.assign(Oe.formats.number,r.number),"date"in r&&Object.assign(Oe.formats.date,r.date),"time"in r&&Object.assign(Oe.formats.time,r.time)),ie.set(i)}const bt=Be(!1);var Da=Object.defineProperty,Ba=Object.defineProperties,Na=Object.getOwnPropertyDescriptors,Ar=Object.getOwnPropertySymbols,Ca=Object.prototype.hasOwnProperty,Ma=Object.prototype.propertyIsEnumerable,Pr=(e,t,r)=>t in e?Da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Va=(e,t)=>{for(var r in t||(t={}))Ca.call(t,r)&&Pr(e,r,t[r]);if(Ar)for(var r of Ar(t))Ma.call(t,r)&&Pr(e,r,t[r]);return e},Ua=(e,t)=>Ba(e,Na(t));let Nt;const qe=Be(null);function Or(e){return e.split("-").map((t,r,n)=>n.slice(0,r+1).join("-")).reverse()}function Ne(e,t=he().fallbackLocale){const r=Or(e);return t?[...new Set([...r,...Or(t)])]:r}function ee(){return Nt??void 0}qe.subscribe(e=>{Nt=e??void 0,typeof window<"u"&&e!=null&&document.documentElement.setAttribute("lang",e)});const Ga=e=>{if(e&&Ea(e)&&Ze(e)){const{loadingDelay:t}=he();let r;return typeof window<"u"&&ee()!=null&&t?r=window.setTimeout(()=>bt.set(!0),t):bt.set(!0),pn(e).then(()=>{qe.set(e)}).finally(()=>{clearTimeout(r),bt.set(!1)})}return qe.set(e)},ie=Ua(Va({},qe),{set:Ga}),Fa=()=>typeof window>"u"?null:window.navigator.language||window.navigator.languages[0],nt=e=>{const t=Object.create(null);return n=>{const i=JSON.stringify(n);return i in t?t[i]:t[i]=e(n)}};var ja=Object.defineProperty,Ye=Object.getOwnPropertySymbols,mn=Object.prototype.hasOwnProperty,dn=Object.prototype.propertyIsEnumerable,Ir=(e,t,r)=>t in e?ja(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Wt=(e,t)=>{for(var r in t||(t={}))mn.call(t,r)&&Ir(e,r,t[r]);if(Ye)for(var r of Ye(t))dn.call(t,r)&&Ir(e,r,t[r]);return e},de=(e,t)=>{var r={};for(var n in e)mn.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ye)for(var n of Ye(e))t.indexOf(n)<0&&dn.call(e,n)&&(r[n]=e[n]);return r};const De=(e,t)=>{const{formats:r}=he();if(e in r&&t in r[e])return r[e][t];throw new Error(`[svelte-i18n] Unknown "${t}" ${e} format.`)},ka=nt(e=>{var t=e,{locale:r,format:n}=t,i=de(t,["locale","format"]);if(r==null)throw new Error('[svelte-i18n] A "locale" must be set to format numbers');return n&&(i=De("number",n)),new Intl.NumberFormat(r,i)}),$a=nt(e=>{var t=e,{locale:r,format:n}=t,i=de(t,["locale","format"]);if(r==null)throw new Error('[svelte-i18n] A "locale" must be set to format dates');return n?i=De("date",n):Object.keys(i).length===0&&(i=De("date","short")),new Intl.DateTimeFormat(r,i)}),za=nt(e=>{var t=e,{locale:r,format:n}=t,i=de(t,["locale","format"]);if(r==null)throw new Error('[svelte-i18n] A "locale" must be set to format time values');return n?i=De("time",n):Object.keys(i).length===0&&(i=De("time","short")),new Intl.DateTimeFormat(r,i)}),Xa=(e={})=>{var t=e,{locale:r=ee()}=t,n=de(t,["locale"]);return ka(Wt({locale:r},n))},Wa=(e={})=>{var t=e,{locale:r=ee()}=t,n=de(t,["locale"]);return $a(Wt({locale:r},n))},Za=(e={})=>{var t=e,{locale:r=ee()}=t,n=de(t,["locale"]);return za(Wt({locale:r},n))},qa=nt((e,t=ee())=>new hn(e,t,he().formats,{ignoreTag:he().ignoreTag})),Ya=(e,t={})=>{var r,n,i,o;let a=t;typeof e=="object"&&(a=e,e=a.id);const{values:s,locale:l=ee(),default:u}=a;if(l==null)throw new Error("[svelte-i18n] Cannot format a message without first setting the initial locale.");let f=_n(e,l);if(!f)f=(o=(i=(n=(r=he()).handleMissingMessage)==null?void 0:n.call(r,{locale:l,id:e,defaultValue:u}))!=null?i:u)!=null?o:e;else if(typeof f!="string")return console.warn(`[svelte-i18n] Message with id "${e}" must be of type "string", found: "${typeof f}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`),f;if(!s)return f;let p=f;try{p=qa(f,l).format(s)}catch(h){h instanceof Error&&console.warn(`[svelte-i18n] Message "${e}" has syntax error:`,h.message)}return p},Qa=(e,t)=>Za(t).format(e),Ja=(e,t)=>Wa(t).format(e),Ka=(e,t)=>Xa(t).format(e),es=(e,t=ee())=>_n(e,t),ts=pe([ie,me],()=>Ya);pe([ie],()=>Qa);pe([ie],()=>Ja);pe([ie],()=>Ka);pe([ie,me],()=>es);const Lr=Be(null);var rs=Ke('
          '),ns=Ke(''),is=Ke(''),os=Ke('
          ');function Rs(e,t){ji(t,!1);const r=()=>_r(Lr,"$navbar_config",i),n=()=>_r(ts,"$_",i),[i,o]=po(),a=Le(),s=Le();let l=G(t,"wrapper",12),u=G(t,"version",12),f=G(t,"initial_height",12),p=G(t,"fill_width",12),h=G(t,"is_embed",12),v=G(t,"space",12),g=G(t,"display",12),x=G(t,"info",12),m=G(t,"loaded",12),_=G(t,"pages",28,()=>[]),b=G(t,"current_page",12,""),d=G(t,"root",12),y=G(t,"components",28,()=>[]),A=y().find(T=>T.type==="navbar"),E=Le(A?{visible:A.props.visible,main_page_name:A.props.main_page_name,value:A.props.value}:null);R(E)&&Lr.set(R(E));function P(T){let B=T.split("?")[0].split("#")[0];return B=B.replace(/^\/+|\/+$/g,""),B}function H(T,B){return T.startsWith("http://")||T.startsWith("https://")?!1:P(T)===P(B)}lt(()=>r(),()=>{r()&&Se(E,{visible:r().visible??!0,main_page_name:r().main_page_name??"Home",value:r().value??null})}),lt(()=>($e(_()),R(E)),()=>{Se(a,_().length>1&&(R(E)===null||R(E).visible!==!1))}),lt(()=>($e(_()),R(E)),()=>{Se(s,(()=>{let T=_().filter(([N,U,k],z)=>z===0&&N===""?R(E)?.main_page_name!==!1:k!==!1),B=R(E)&&R(E).main_page_name!==!1&&R(E).main_page_name!=="Home"?T.map(([N,U,k],z)=>z===0&&N===""&&U==="Home"?[N,R(E).main_page_name]:[N,U]):T.map(([N,U])=>[N,U]);if(R(E)?.value&&R(E).value.length>0){const N=new Set(B.map(([k])=>k)),U=R(E).value.map(([k,z])=>[z,k]).filter(([k])=>!N.has(k));return[...B,...U]}return B})())}),ki();var C={get wrapper(){return l()},set wrapper(T){l(T),F()},get version(){return u()},set version(T){u(T),F()},get initial_height(){return f()},set initial_height(T){f(T),F()},get fill_width(){return p()},set fill_width(T){p(T),F()},get is_embed(){return h()},set is_embed(T){h(T),F()},get space(){return v()},set space(T){v(T),F()},get display(){return g()},set display(T){g(T),F()},get info(){return x()},set info(T){x(T),F()},get loaded(){return m()},set loaded(T){m(T),F()},get pages(){return _()},set pages(T){_(T),F()},get current_page(){return b()},set current_page(T){b(T),F()},get root(){return d()},set root(T){d(T),F()},get components(){return y()},set components(T){y(T),F()}};co();var O=os();let oe,ae;var Yt=$(O);{var jn=T=>{var B=ns(),N=$(B);let U;Yi(N,5,()=>R(s),Zi,(k,z)=>{var Ce=zi(()=>Xi(R(z),2));let M=()=>R(Ce)[0],Me=()=>R(Ce)[1];var X=rs();let ve;var ot=$(X,!0);j(X),Ve((at,st,Xn,Wn)=>{Z(X,"href",at),Z(X,"target",st),Z(X,"rel",Xn),ve=Pe(X,1,"svelte-99kmwu",null,ve,Wn),Ge(ot,Me())},[()=>(M(),$e(d()),W(()=>M().startsWith("http://")||M().startsWith("https://")?M():`${d()}/${M()}`)),()=>(M(),W(()=>M().startsWith("http://")||M().startsWith("https://")?"_blank":"_self")),()=>(M(),W(()=>M().startsWith("http://")||M().startsWith("https://")?"noopener noreferrer":"")),()=>({active:H(M(),b())})]),Ue(k,X)}),j(N),j(B),Ve(()=>U=Pe(N,1,"fillable svelte-99kmwu",null,U,{fill_width:p()})),Ue(T,B)};or(Yt,T=>{R(a)&&T(jn)})}var it=ge(Yt,2);let Qt;var Jt=$(it);Ki(Jt,t,"default",{});var Kt=ge(Jt,2),kn=$(Kt);{var $n=T=>{var B=is(),N=$(B),U=$(N),k=$(U,!0);j(U),j(N);var z=ge(N,2),Ce=$(z);ir(2),j(z);var M=ge(z,2),Me=$(M),X=ge(Me),ve=$(X),ot=$(ve);j(ve),ir(),j(X),j(M),j(B),Ve((at,st)=>{Z(U,"href",`https://huggingface.co/spaces/${v()??""}`),Ge(k,v()),Ge(Ce,`${at??""} `),Ge(Me,`${st??""} `),Z(ot,"src",Eo)},[()=>(n(),W(()=>n()("common.built_with"))),()=>(n(),W(()=>n()("common.hosted_on")))]),Ue(T,B)};or(kn,T=>{g()&&v()&&x()&&T($n)})}j(Kt),j(it),j(O),fo(O,T=>l(T),()=>l()),Ve(()=>{oe=Pe(O,1,`gradio-container gradio-container-${u()??""}`,"svelte-99kmwu",oe,{fill_width:p(),"embed-container":g(),"with-info":x()}),ae=$r(O,"",ae,{"min-height":m()?"initial":f(),"flex-grow":g()?"auto":"1"}),Qt=Pe(it,1,"main fillable svelte-99kmwu",null,Qt,{fill_width:p(),app:!g()&&!h()})}),Ue(e,O);var zn=$i(C);return o(),zn}let vn=!1;typeof window<"u"&&"attachShadow"in Element.prototype&&"adoptedStyleSheets"in Document.prototype&&(vn="adoptedStyleSheets"in document.createElement("div").attachShadow({mode:"open"}));function ws(e,t){const r=new URL(import.meta.url).origin;var n=e;if(window.location.origin!==r&&(n=new URL(e,r).href),document.querySelector(`link[href='${n}']`))return Promise.resolve();const o=document.createElement("link");return o.rel="stylesheet",o.href=n,new Promise((a,s)=>{o.addEventListener("load",()=>a()),o.addEventListener("error",()=>{console.error(`Unable to preload CSS for ${n}`),a()}),t.appendChild(o)})}function Hs(e,t,r){if(!vn)return e;r||(r=document.createElement("style")),r.remove();const n=new CSSStyleSheet;n.replaceSync(e);let i="";e=e.replace(/@import\s+url\((.*?)\);\s*/g,(l,u)=>(i+=`@import url(${u}); +`,""));const o=n.cssRules;let a="",s=`.gradio-container.gradio-container-${t} .contain `;for(let l=0;l`${f?".dark":""} ${s} ${v.trim()} `).join(",");a+=u.cssText,a+=u.cssText.replace(p,h)}}else if(u instanceof CSSMediaRule){let p=`@media ${u.media.mediaText} {`;for(let h=0;h`${g?".dark":""} ${s} ${_.trim()} `).join(",");p+=v.cssText.replace(x,m)}}p+="}",a+=p}else if(u instanceof CSSKeyframesRule){a+=`@keyframes ${u.name} {`;for(let p=0;pc(()=>import("./Index-CFLsnuCC.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url)},annotatedimage:{component:()=>c(()=>import("./Index-BQpIYZRd.js"),__vite__mapDeps([18,1,2,3,4,5,6,19,20,21,7,8,22,23,24,9,10,11,12,13,14,25]),import.meta.url)},audio:{base:()=>c(()=>import("./StaticAudio-CdnK_Wm8.js").then(e=>e.a),__vite__mapDeps([26,1,2,7,8,4,5,6,19,27,20,28,29,30,22,31,32,33,34,35,36]),import.meta.url),example:()=>c(()=>import("./Example-D2mjvy71.js"),__vite__mapDeps([37,1,2,38]),import.meta.url),component:()=>c(()=>import("./index-lMYqzEbX.js"),__vite__mapDeps([39,1,2,7,8,9,10,11,4,5,6,12,13,14,26,19,27,20,28,29,30,22,31,32,33,34,35,36,40,41,42,43,44,45,46,47,3,48,37,38,49]),import.meta.url)},box:{component:()=>c(()=>import("./Index-BcflHCFb.js"),__vite__mapDeps([50,1,2,3,4,5,6]),import.meta.url)},browserstate:{component:()=>c(()=>import("./Index-C0OCjl9T.js"),__vite__mapDeps([51,1,2,52,7,8]),import.meta.url)},button:{component:()=>c(()=>import("./Index-vigNnD5c.js"),__vite__mapDeps([53,1,2,7,8,54,5,55,56,57,4,6,58,59]),import.meta.url)},chatbot:{component:()=>c(()=>import("./Index-Cva5NaVy.js"),__vite__mapDeps([60,1,2,41,7,8,61,55,56,57,4,5,6,62,63,14,29,44,35,27,28,22,64,65,11,66,12,67,10,13,68,69,30,3,19,9,70,59]),import.meta.url)},checkbox:{example:()=>c(()=>import("./Example-DBPhM3Hl.js"),__vite__mapDeps([71,1,2,72]),import.meta.url),component:()=>c(()=>import("./Index-yEtVDF00.js"),__vite__mapDeps([73,1,2,7,8,3,4,5,6,74,11,22,9,10,12,13,14,75,61,76,77]),import.meta.url)},checkboxgroup:{example:()=>c(()=>import("./Example-CbzIfTHK.js"),__vite__mapDeps([78,1,2,79]),import.meta.url),component:()=>c(()=>import("./Index-E6_HM5Fx.js"),__vite__mapDeps([80,1,2,8,7,3,4,5,6,81,74,11,22,9,10,12,13,14,82,83]),import.meta.url)},code:{example:()=>c(()=>import("./Example-C7q4tFc2.js"),__vite__mapDeps([84,1,2,85]),import.meta.url),component:()=>c(()=>import("./Index-DND_tLDq.js"),__vite__mapDeps([86,1,2,7,8,9,10,11,4,5,6,12,13,14,87,88,62,63,29,27,22,3,19,20,89,84,85]),import.meta.url)},colorpicker:{example:()=>c(()=>import("./Example-B0koE8za.js"),__vite__mapDeps([90,1,2,91]),import.meta.url),component:()=>c(()=>import("./Index-BceQtuka.js"),__vite__mapDeps([92,1,2,7,8,41,61,93,4,5,6,81,74,11,3,9,10,12,13,14,90,91,94]),import.meta.url)},column:{component:()=>c(()=>import("./Index-cd2fBqg2.js"),__vite__mapDeps([95,1,2,7,8,15,9,10,11,4,5,6,12,13,14,16]),import.meta.url)},core:{component:()=>c(()=>import("./index-DkrWwIux.js"),__vite__mapDeps([96,1,2,82,7,8]),import.meta.url)},dataframe:{example:()=>c(()=>import("./Example-DD1VGTCq.js"),__vite__mapDeps([97,1,2,98]),import.meta.url),component:()=>c(()=>import("./Index-CmTVIgCq.js"),__vite__mapDeps([99,1,2,11,41,100,40,5,42,4,6,65,66,12,67,61,10,13,75,8,76,77,62,101,63,23,24,102,9,14,3,7,97,98,103]),import.meta.url)},dataset:{component:()=>c(()=>import("./Index-CUqdOFP7.js"),__vite__mapDeps([104,1,2,3,4,5,6,7,8,105,106,41,61,81,74,11,62,63,107,108,22,109,10,12,13,110,100,111,112]),import.meta.url)},datetime:{example:()=>c(()=>import("./Example-B_mfRiuX.js"),__vite__mapDeps([113,1,2]),import.meta.url),component:()=>c(()=>import("./Index-BtbmsJIn.js"),__vite__mapDeps([114,1,2,61,3,4,5,6,81,74,11,7,8,22,113,115]),import.meta.url)},dialogue:{example:()=>c(()=>import("./Example-BXmvnBf1.js"),__vite__mapDeps([116,1,2,117]),import.meta.url),component:()=>c(()=>import("./Index-oaxkLqhJ.js"),__vite__mapDeps([118,1,2,7,8,10,11,4,5,6,12,13,61,81,74,62,63,119,107,69,22,120,121,101,122,3,9,14,116,117,123,124]),import.meta.url)},downloadbutton:{component:()=>c(()=>import("./Index-CzkKCnV2.js"),__vite__mapDeps([125,1,2,7,8,5,54,55,56,57,4,6,58,59,126]),import.meta.url)},draggable:{component:()=>c(()=>import("./Index-Csvz6q0R.js"),__vite__mapDeps([127,1,2,7,8,9,10,11,4,5,6,12,13,14,128]),import.meta.url)},dropdown:{example:()=>c(()=>import("./Example-CCcLQRgY.js"),__vite__mapDeps([129,1,2,124]),import.meta.url),component:()=>c(()=>import("./Index-CEZhPgHw.js"),__vite__mapDeps([130,1,2,7,8,61,68,4,5,6,81,74,11,101,22,120,10,12,13,121,122,3,9,14,129,124]),import.meta.url)},file:{example:()=>c(()=>import("./Example-m_TAV22D.js"),__vite__mapDeps([131,1,2,132]),import.meta.url),component:()=>c(()=>import("./Index-DRTA1kwo.js"),__vite__mapDeps([133,1,2,8,7,4,5,6,19,20,64,22,134,40,41,42,14,11,27,135,3,48,9,10,12,13,131,132]),import.meta.url)},fileexplorer:{example:()=>c(()=>import("./Example-PAQ-gmig.js"),__vite__mapDeps([136,1,2,137]),import.meta.url),component:()=>c(()=>import("./Index-BBNOoCmW.js"),__vite__mapDeps([138,1,2,105,7,8,4,5,6,64,3,19,22,61,9,10,11,12,13,14,139]),import.meta.url)},form:{component:()=>c(()=>import("./Index-D5ut_MhQ.js"),__vite__mapDeps([140,1,2,7,8,141,142]),import.meta.url)},gallery:{base:()=>c(()=>import("./Gallery-BwMbO7WY.js").then(e=>e.a),__vite__mapDeps([143,1,2,121,68,4,5,6,19,20,28,7,8,14,29,21,34,22,23,24,40,41,42,43,27,44,35,55,56,57,144,76,145,82,146,59]),import.meta.url),example:()=>c(()=>import("./Example-B9bhmUl8.js"),__vite__mapDeps([147,1,2,148]),import.meta.url),component:()=>c(()=>import("./Index-CwPG6Lki.js"),__vite__mapDeps([149,1,2,56,3,4,5,6,7,8,48,143,121,68,19,20,28,14,29,21,34,22,23,24,40,41,42,43,27,44,35,55,57,144,76,145,82,146,59,9,10,11,12,13,134,64,135,150,101,108,47,45,151,147,148,152,132,153]),import.meta.url)},group:{component:()=>c(()=>import("./Index-Bfu-ph5m.js"),__vite__mapDeps([154,1,2,7,8,155]),import.meta.url)},highlightedtext:{component:()=>c(()=>import("./Index-CvdjtBs2.js"),__vite__mapDeps([156,1,2,157,14,4,5,6,3,19,20,7,8,22,9,10,11,12,13,158]),import.meta.url)},html:{base:()=>c(()=>import("./HTML-Bg_bA9M4.js"),__vite__mapDeps([159,1,2,8,5,160]),import.meta.url),example:()=>c(()=>import("./Example-CY2poEFg.js"),__vite__mapDeps([161,1,2,11,162]),import.meta.url),component:()=>c(()=>import("./Index-DCKyQnHX.js"),__vite__mapDeps([163,1,2,7,8,159,5,160,9,10,11,4,6,12,13,14,3,19,89,22,161,162,164]),import.meta.url)},image:{base:()=>c(()=>import("./ImagePreview-B2ps5aDR.js").then(e=>e.a),__vite__mapDeps([165,1,2,56,7,8,4,5,6,19,27,20,28,29,21,22,23,24,55,57,59]),import.meta.url),example:()=>c(()=>import("./Example-7veL-tTh.js"),__vite__mapDeps([166,1,2,55,56,57,153]),import.meta.url),component:()=>c(()=>import("./Index-C6mSODH4.js"),__vite__mapDeps([167,1,2,7,8,165,56,4,5,6,19,27,20,28,29,21,22,23,24,55,57,59,14,150,10,11,12,13,41,101,108,47,45,151,40,42,3,48,9,166,153]),import.meta.url)},imageeditor:{example:()=>c(()=>import("./Example-obCq-B6m.js"),__vite__mapDeps([168,1,2,4,5,6,55,56,57,10,11,12,13,40,41,42,169,59,151,153]),import.meta.url),component:()=>c(()=>import("./Index-cYuhm-BK.js").then(e=>e.au),__vite__mapDeps([170,1,2,56,7,8,165,4,5,6,19,27,20,28,29,21,22,23,24,55,57,59,3,9,10,11,12,13,14,40,41,42,150,101,108,47,45,151,121,93,119,61,62,68,171,69,35,172,153]),import.meta.url)},imageslider:{example:()=>c(()=>import("./Example-DVQdodPf.js"),__vite__mapDeps([173,1,2,174]),import.meta.url),component:()=>c(()=>import("./Index-JJcQ8Ljz.js"),__vite__mapDeps([175,1,2,7,8,100,56,176,177,4,5,6,19,27,20,14,29,21,35,22,23,24,10,11,12,13,9,40,41,42,3,48,178]),import.meta.url)},json:{example:()=>c(()=>import("./Example-lh5jo09q.js"),__vite__mapDeps([179,1,2,180,62,63,4,5,6,20,22,181,182]),import.meta.url),component:()=>c(()=>import("./Index-CIs-xuv1.js"),__vite__mapDeps([183,1,2,100,7,8,180,62,63,4,5,6,20,22,181,3,19,9,10,11,12,13,14]),import.meta.url)},label:{component:()=>c(()=>import("./Index-B4MNmBST.js"),__vite__mapDeps([184,1,2,7,8,4,5,6,185,3,19,20,22,9,10,11,12,13,14,186]),import.meta.url)},markdown:{example:()=>c(()=>import("./Example-Csc6CXXA.js"),__vite__mapDeps([187,1,2,65,11,66,12,67,188]),import.meta.url),component:()=>c(()=>import("./Index-BVh8ZMox.js"),__vite__mapDeps([189,1,2,7,8,190,41,62,63,4,5,6,22,65,11,66,12,67,191,9,10,13,14,3,192,187,188]),import.meta.url)},model3d:{base:()=>c(()=>import("./Model3D-HY69ejZB.js"),__vite__mapDeps([193,1,2,4,5,6,19,29,64,35,22,82,194]),import.meta.url),example:()=>c(()=>import("./Example-BvF-auBS.js"),__vite__mapDeps([195,1,2,196]),import.meta.url),component:()=>c(()=>import("./Index-CtxMS3EK.js"),__vite__mapDeps([197,1,2,7,8,193,4,5,6,19,29,64,35,22,82,194,40,41,42,43,27,14,44,3,20,48,9,10,11,12,13,195,196,198]),import.meta.url)},multimodaltextbox:{example:()=>c(()=>import("./Example-iNtc2BQ6.js"),__vite__mapDeps([199,1,2,100,55,56,57,4,5,6,144,41,76,145,200,59]),import.meta.url),component:()=>c(()=>import("./Index-CvTz6tyr.js"),__vite__mapDeps([201,1,2,7,8,41,61,4,5,6,81,74,11,171,62,14,64,30,108,192,40,42,55,56,57,31,32,46,3,9,10,12,13,199,100,144,76,145,200,59,202]),import.meta.url)},nativeplot:{example:()=>c(()=>import("./Example-DnNUXGcx.js"),__vite__mapDeps([203,1,2]),import.meta.url),component:()=>c(()=>import("./Index-BRBLpKMP.js"),__vite__mapDeps([204,1,2,7,8,3,4,5,6,81,74,11,20,29,185,22,23,24,9,10,12,13,14,205]),import.meta.url)},navbar:{base:()=>c(()=>import("./Index-idnwMe3R.js"),__vite__mapDeps([206,1,2,7,8]),import.meta.url),example:()=>c(()=>import("./Example-BLPBtkTF.js"),__vite__mapDeps([207,1,2]),import.meta.url),component:()=>c(()=>import("./Index-idnwMe3R.js"),__vite__mapDeps([206,1,2,7,8]),import.meta.url)},number:{example:()=>c(()=>import("./Example-BGbaSO1h.js"),__vite__mapDeps([208,1,2,209]),import.meta.url),component:()=>c(()=>import("./Index-CaF916uK.js"),__vite__mapDeps([210,1,2,61,7,8,3,4,5,6,81,74,11,22,9,10,12,13,14,211]),import.meta.url)},paramviewer:{example:()=>c(()=>import("./Example-BwHfD0oa.js"),__vite__mapDeps([212,1,2,213]),import.meta.url),component:()=>c(()=>import("./Index-nh82mmWC.js"),__vite__mapDeps([214,1,2,7,8,11,66,215]),import.meta.url)},plot:{base:()=>c(()=>import("./Plot-DfljBR3n.js").then(e=>e.b),__vite__mapDeps([216,1,2,105,4,5,6,56,20]),import.meta.url),component:()=>c(()=>import("./Index-BBjxpuJ4.js"),__vite__mapDeps([217,1,2,7,8,216,105,4,5,6,56,20,3,19,22,23,24,9,10,11,12,13,14]),import.meta.url)},radio:{example:()=>c(()=>import("./Example-Bt86cDLM.js"),__vite__mapDeps([218,1,2,219]),import.meta.url),component:()=>c(()=>import("./Index-C6F3e_Rs.js"),__vite__mapDeps([220,1,2,7,8,3,4,5,6,81,74,11,22,9,10,12,13,14,61,218,219,221]),import.meta.url)},row:{component:()=>c(()=>import("./Index-Cok7jpx4.js"),__vite__mapDeps([222,1,2,9,10,11,4,5,6,12,13,14,7,8,223]),import.meta.url)},sidebar:{component:()=>c(()=>import("./Index-Ci5Z17ae.js"),__vite__mapDeps([224,1,2,7,8,9,10,11,4,5,6,12,13,14,15,16,225]),import.meta.url)},slider:{example:()=>c(()=>import("./Example-BnU-j0j8.js"),__vite__mapDeps([226,1,2,227]),import.meta.url),component:()=>c(()=>import("./Index-Brqch1XL.js"),__vite__mapDeps([228,1,2,61,7,8,3,4,5,6,81,74,11,9,10,12,13,14,229]),import.meta.url)},state:{component:()=>c(()=>import("./Index-4nvCzCrB.js"),__vite__mapDeps([230,1,2,7,8]),import.meta.url)},statustracker:{component:()=>c(()=>import("./index-BRj5epc3.js"),__vite__mapDeps([231,9,1,2,10,11,4,5,6,12,13,14,232,45]),import.meta.url)},tabitem:{component:()=>c(()=>import("./Index-DszFtJDg.js"),__vite__mapDeps([233,1,2,7,8,234,68,235,15,9,10,11,4,5,6,12,13,14,16,236]),import.meta.url)},tabs:{component:()=>c(()=>import("./Index-BrAqfQnF.js"),__vite__mapDeps([237,1,2,7,8,234,68,235]),import.meta.url)},textbox:{example:()=>c(()=>import("./Example-BC6WbF6q.js"),__vite__mapDeps([110,1,2,100,111]),import.meta.url),component:()=>c(()=>import("./Index-qHbt41US.js"),__vite__mapDeps([238,1,2,8,106,41,61,4,5,6,81,74,11,62,63,107,108,22,109,9,10,12,13,14,3,7,110,100,111]),import.meta.url)},timer:{component:()=>c(()=>import("./Index-Br6Ie3Ai.js"),__vite__mapDeps([239,1,2,7,8]),import.meta.url)},uploadbutton:{component:()=>c(()=>import("./Index-7ZuVU2_6.js"),__vite__mapDeps([240,1,2,7,8,5,54,55,56,57,4,6,58,59,241]),import.meta.url)},vibeeditor:{component:()=>c(()=>import("./Index-C-RstoJU.js"),__vite__mapDeps([242,1,2,61,10,11,4,5,6,12,13,87,88,190,41,7,8,62,63,22,65,66,67,191,243,85,188]),import.meta.url)},video:{base:()=>c(()=>import("./VideoPreview-DskP-c1w.js").then(e=>e.a),__vite__mapDeps([244,1,2,105,4,5,6,19,27,20,28,7,8,29,22,24,33,34,35,144,41,76,145,40,42,43,14,44,245]),import.meta.url),example:()=>c(()=>import("./Example-DqXqJiLY.js"),__vite__mapDeps([246,1,2,144,5,41,76,145,247]),import.meta.url),component:()=>c(()=>import("./index-Dl5sO2oW.js"),__vite__mapDeps([248,1,2,105,5,40,41,42,4,6,19,150,10,11,12,13,101,108,47,45,151,144,76,145,244,27,20,28,7,8,29,22,24,33,34,35,43,14,44,245,246,247,3,48,9,249,57,59,153]),import.meta.url)},walkthrough:{component:()=>c(()=>import("./Index-BrAqfQnF.js"),__vite__mapDeps([237,1,2,7,8,234,68,235]),import.meta.url)},walkthroughstep:{component:()=>c(()=>import("./Index-DszFtJDg.js"),__vite__mapDeps([233,1,2,7,8,234,68,235,15,9,10,11,4,5,6,12,13,14,16,236]),import.meta.url)}},Q={},ue={},Qe=typeof window<"u";function ss({api_url:e,name:t,id:r,variant:n}){const i=Qe&&window.__GRADIO__CC__,o={...as,...i||{}};let a=r||t;if(Q[`${a}-${n}`])return{component:Q[`${a}-${n}`],name:t,runtime:ue[`${a}-${n}`]};try{if(!o?.[a]?.[n]&&!o?.[t]?.[n])throw new Error;return Q[`${a}-${n}`]=(o?.[a]?.[n]||o?.[t]?.[n])(),ue[`${a}-${n}`]=Qe&&window.__GRADIO__CC__RUNTIMES__?.[r]||!1,{name:t,component:Q[`${a}-${n}`],runtime:ue[`${a}-${n}`]}}catch{if(!a)throw new Error(`Component not found: ${t}`);try{const l=ls(e,a,n),[u,f]=l;return Q[`${a}-${n}`]=u,ue[`${a}-${n}`]=f,{name:t,component:Q[`${a}-${n}`],runtime:ue[`${a}-${n}`]}}catch(l){if(n==="example")return Q[`${a}-${n}`]=c(()=>import("./Example-BkTaSs73.js"),__vite__mapDeps([250,1,2,251]),import.meta.url),{name:t,component:Q[`${a}-${n}`],runtime:ue[`${a}-${n}`]};throw console.error(`failed to load: ${t}`),console.error(l),l}}}function us(e){return Qe?new Promise((t,r)=>{const n=document.createElement("link");n.rel="stylesheet",n.href=e,document.head.appendChild(n),n.onload=()=>t(),n.onerror=()=>r()}):Promise.resolve()}function ls(e,t,r){const n=Qe?"client":"server";if(n==="server")return[c(()=>import("./Index-Dfc9uZ1M.js"),__vite__mapDeps([252,1,2,7,8,3,4,5,6,9,10,11,12,13,14,253]),import.meta.url),Promise.resolve(!1)];const i=`${e}/custom_component/${t}/${n}/${r}/index.js`;return[Promise.all([us(`${e}/custom_component/${t}/${n}/${r}/style.css`),import(i)]).then(([o,a])=>a),c(()=>import(`${e}/custom_component/${t}/${n}/${r}/svelte_runtime_entry.js`),[],import.meta.url)]}function Ds(e,t,r,n="component"){return e==="api"&&(e="state"),ss({api_url:r,name:e,id:t,variant:n})}function Bs(e){const t=new Set,r=new Set;for(const n of e)n.inputs.forEach(i=>t.add(i)),n.outputs.forEach(i=>r.add(i));return[t,r]}function Ns(e,t,r,n){const[i,o]=n;return t===!1?!1:t===!0?!0:!!(i.has(e)||!o.has(e)&&fs(r))}function fs(e){return Array.isArray(e)&&e.length===0||e===""||e===0||!e}const Cs=Object.getPrototypeOf(async function(){}).constructor,Ms=["red","green","blue","yellow","purple","teal","orange","cyan","lime","pink"],cs=[{color:"red",primary:600,secondary:100},{color:"green",primary:600,secondary:100},{color:"blue",primary:600,secondary:100},{color:"yellow",primary:500,secondary:100},{color:"purple",primary:600,secondary:100},{color:"teal",primary:600,secondary:100},{color:"orange",primary:600,secondary:100},{color:"cyan",primary:600,secondary:100},{color:"lime",primary:500,secondary:100},{color:"pink",primary:600,secondary:100}],Sr={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}},Vs=cs.reduce((e,{color:t,primary:r,secondary:n})=>({...e,[t]:{primary:Sr[t][r],secondary:Sr[t][n]}}),{}),Rr={ar:"جاري التحميل",ca:"S'està carregant",ckb:"بارکردن",de:"Laden",en:"Loading",es:"Cargando",eu:"Kargatzen",fa:"در حال بارگذاری",fi:"Ladataan",fr:"Chargement",he:"טוען",hi:"लोड हो रहा है",ja:"読み込み中",ko:"로딩 중",lt:"Kraunama",nb:"Laster",nl:"Laden",pl:"Ładowanie","pt-BR":"Carregando",pt:"A carregar",ro:"Se încarcă",ru:"Загрузка",sv:"Laddar",ta:"ஏற்றுகிறது",th:"กำลังโหลด",tr:"Yükleniyor",uk:"Завантаження",ur:"لوڈ ہو رہا ہے",uz:"Yuklanmoqda","zh-CN":"加载中","zh-TW":"載入中"},bn="English",gn={annotated_image:"Annotated Image"},En={allow_recording_access:"Please allow access to the microphone for recording.",audio:"Audio",drop_to_upload:"Drop an audio file here to upload",record_from_microphone:"Record from microphone",stop_recording:"Stop recording",no_device_support:"Media devices could not be accessed. Check that you are running on a secure origin (https) or localhost (or you have passed a valid SSL certificate to ssl_verify), and you have allowed browser access to your device.",stop:"Stop",resume:"Resume",record:"Record",no_microphone:"No microphone found",pause:"Pause",play:"Play",waiting:"Waiting"},yn={connection_can_break:"On mobile, the connection can break if this tab is unfocused or the device sleeps, losing your position in queue.",long_requests_queue:"There is a long queue of requests pending. Duplicate this Space to skip.",lost_connection:"Lost connection due to leaving page. Rejoining queue...",waiting_for_inputs:"Waiting for file(s) to finish uploading, please retry."},xn={edit:"Edit",retry:"Retry",undo:"Undo",submit:"Submit",cancel:"Cancel",like:"Like",dislike:"Dislike",clear:"Clear",copy_message:"Copy message",copied_message:"Copied message"},Tn={new_chat:"New chat",message_placeholder:"Type a message...",additional_inputs:"Additional inputs",chatbot:"Chatbot",conversation:"Conversation"},An={checkbox:"Checkbox",checkbox_group:"Checkbox Group"},Pn={code:"Code"},On={color_picker:"Color Picker"},In={built_with:"built with",built_with_gradio:"Built with Gradio",clear:"Clear",download:"Download",edit:"Edit",empty:"Empty",error:"Error",hosted_on:"Hosted on",loading:"Loading",logo:"logo",or:"or",remove:"Remove",settings:"Settings",share:"Share",submit:"Submit",undo:"Undo",no_devices:"No devices found",language:"Language",display_theme:"Display Theme",pwa:"Progressive Web App",record:"Record",stop_recording:"Stop Recording",screen_studio:"Screen Studio",share_gradio_tab:"[Sharing] Gradio Tab",run:"Run"},Ln={incorrect_format:"Incorrect format, only CSV and TSV files are supported",new_column:"Add column",new_row:"New row",add_row_above:"Add row above",add_row_below:"Add row below",delete_row:"Delete row",delete_column:"Delete column",add_column_left:"Add column to the left",add_column_right:"Add column to the right",sort_column:"Sort column",sort_ascending:"Sort ascending",sort_descending:"Sort descending",drop_to_upload:"Drop CSV or TSV files here to import data into dataframe",clear_sort:"Clear sort",filter:"Filter",clear_filter:"Clear filters"},Sn={dropdown:"Dropdown"},Rn={build_error:"there is a build error",config_error:"there is a config error",contact_page_author:"Please contact the author of the page to let them know.",no_app_file:"there is no app file",runtime_error:"there is a runtime error",space_not_working:`"Space isn't working because" {0}`,space_paused:"the space is paused",use_via_api:"Use via API",use_via_api_or_mcp:"Use via API or MCP"},wn={uploading:"Uploading..."},Hn={highlighted_text:"Highlighted Text"},Dn={allow_webcam_access:"Please allow access to the webcam for recording.",brush_color:"Brush color",brush_radius:"Brush radius",image:"Image",remove_image:"Remove Image",select_brush_color:"Select brush color",start_drawing:"Start drawing",use_brush:"Use brush",drop_to_upload:"Drop an image file here to upload"},Bn={label:"Label"},Nn={enable_cookies:"If you are visiting a HuggingFace Space in Incognito mode, you must enable third party cookies.",incorrect_credentials:"Incorrect Credentials",username:"username",password:"password",login:"Login"},Cn={number:"Number"},Mn={plot:"Plot"},Vn={radio:"Radio"},Un={slider:"Slider"},Gn={click_to_upload:"Click to Upload",drop_audio:"Drop Audio Here",drop_csv:"Drop CSV Here",drop_file:"Drop File Here",drop_image:"Drop Image Here",drop_video:"Drop Video Here",drop_gallery:"Drop Media Here",paste_clipboard:"Paste from Clipboard"},Fn={drop_to_upload:"Drop a video file here to upload"},Zt={_name:bn,"3D_model":{"3d_model":"3D Model",drop_to_upload:"Drop a 3D model (.obj, .glb, .stl, .gltf, .splat, or .ply) file here to upload"},annotated_image:gn,audio:En,blocks:yn,chatbot:xn,chat_interface:Tn,checkbox:An,code:Pn,color_picker:On,common:In,dataframe:Ln,dropdown:Sn,errors:Rn,file:wn,highlighted_text:Hn,image:Dn,label:Bn,login:Nn,number:Cn,plot:Mn,radio:Vn,slider:Un,upload_text:Gn,video:Fn},hs=Object.freeze(Object.defineProperty({__proto__:null,_name:bn,annotated_image:gn,audio:En,blocks:yn,chat_interface:Tn,chatbot:xn,checkbox:An,code:Pn,color_picker:On,common:In,dataframe:Ln,default:Zt,dropdown:Sn,errors:Rn,file:wn,highlighted_text:Hn,image:Dn,label:Bn,login:Nn,number:Cn,plot:Mn,radio:Vn,slider:Un,upload_text:Gn,video:Fn},Symbol.toStringTag,{value:"Module"})),_s={ar:"العربية",ca:"Català",ckb:"کوردی",de:"Deutsch",en:"English",es:"Español",eu:"Euskara",fa:"فارسی",fi:"Suomi",fr:"Français",he:"עברית",hi:"हिंदी",ja:"日本語",ko:"한국어",lt:"Lietuvių",nb:"Norsk bokmål",nl:"Nederlands",pl:"Polski","pt-BR":"Português do Brasil",pt:"Português",ro:"Română",ru:"Русский",sv:"Svenska",ta:"தமிழ்",th:"ภาษาไทย",tr:"Türkçe",uk:"Українська",ur:"اردو",uz:"O'zbek","zh-CN":"简体中文","zh-TW":"繁體中文"},ps=Object.assign({"./lang/ar.json":()=>c(()=>import("./ar-DI02TNDn.js"),[],import.meta.url),"./lang/ca.json":()=>c(()=>import("./ca-MwjfTPYe.js"),[],import.meta.url),"./lang/ckb.json":()=>c(()=>import("./ckb-DEn8SQcv.js"),[],import.meta.url),"./lang/de.json":()=>c(()=>import("./de-BczWVYc-.js"),[],import.meta.url),"./lang/en.json":()=>c(()=>Promise.resolve().then(()=>hs),void 0,import.meta.url),"./lang/es.json":()=>c(()=>import("./es-5B0rLSyK.js"),[],import.meta.url),"./lang/eu.json":()=>c(()=>import("./eu-FEV4b8Yc.js"),[],import.meta.url),"./lang/fa.json":()=>c(()=>import("./fa-xqCN2YBh.js"),[],import.meta.url),"./lang/fi.json":()=>c(()=>import("./fi-CzBLDS5V.js"),[],import.meta.url),"./lang/fr.json":()=>c(()=>import("./fr-D-jLF3ix.js"),[],import.meta.url),"./lang/he.json":()=>c(()=>import("./he-D0pPJnuh.js"),[],import.meta.url),"./lang/hi.json":()=>c(()=>import("./hi-ui5-o8Zq.js"),[],import.meta.url),"./lang/id.json":()=>c(()=>import("./id-ClfVqkNd.js"),[],import.meta.url),"./lang/ja.json":()=>c(()=>import("./ja-us1feo4m.js"),[],import.meta.url),"./lang/ko.json":()=>c(()=>import("./ko-olQgpapS.js"),[],import.meta.url),"./lang/lt.json":()=>c(()=>import("./lt-C3SHU62J.js"),[],import.meta.url),"./lang/nb.json":()=>c(()=>import("./nb-FznSaSMV.js"),[],import.meta.url),"./lang/nl.json":()=>c(()=>import("./nl-B4KNpP3D.js"),[],import.meta.url),"./lang/pl.json":()=>c(()=>import("./pl-DgzvenUF.js"),[],import.meta.url),"./lang/pt-BR.json":()=>c(()=>import("./pt-BR-BumPWABt.js"),[],import.meta.url),"./lang/pt.json":()=>c(()=>import("./pt-CMxRi3jz.js"),[],import.meta.url),"./lang/ro.json":()=>c(()=>import("./ro-BwkPWvaL.js"),[],import.meta.url),"./lang/ru.json":()=>c(()=>import("./ru-Cyxgs-16.js"),[],import.meta.url),"./lang/sv.json":()=>c(()=>import("./sv-DRLxo-M4.js"),[],import.meta.url),"./lang/ta.json":()=>c(()=>import("./ta-ChNEShjw.js"),[],import.meta.url),"./lang/th.json":()=>c(()=>import("./th-CTbdxu88.js"),[],import.meta.url),"./lang/tr.json":()=>c(()=>import("./tr-yUbHBZLl.js"),[],import.meta.url),"./lang/uk.json":()=>c(()=>import("./uk-CaUFw2Pq.js"),[],import.meta.url),"./lang/ur.json":()=>c(()=>import("./ur-Z4lbsgev.js"),[],import.meta.url),"./lang/uz.json":()=>c(()=>import("./uz-CDq7fxDa.js"),[],import.meta.url),"./lang/zh-CN.json":()=>c(()=>import("./zh-CN-D4oMFiss.js"),[],import.meta.url),"./lang/zh-TW.json":()=>c(()=>import("./zh-TW-R6BiSpm2.js"),[],import.meta.url)});function Us(e){return e&&typeof e=="object"&&e.__type__==="translation_metadata"&&typeof e.key=="string"}function ms(){return{...Object.fromEntries(Object.entries(ps).map(([t,r])=>[t.split("/").pop().split(".")[0],{type:"lazy",data:r}])),en:{type:"static",data:Zt}}}const qt=ms(),Ct=Object.keys(qt),Gs=Object.entries(qt).map(([e])=>[_s[e]||e,e]);let gt=!1,Et;function ds(e){const t=e.split(",").map(r=>r.includes(";")?r.split(";").slice(0,2):[r,1]);t.sort((r,n)=>parseFloat(n[1])-parseFloat(r[1]));for(const[r,n]of t)if(Ct.includes(r))return r;return null}async function Fs(e,t){if(gt&&!(gt&&e!==Et))return;const n=e??Et??{};e!==void 0&&(Et=e),vs({processed_langs:qt,custom_translations:n});let i=null;const o=Fa();if(t?i=ds(t):i=o&&Ct.includes(o)?o:null,!i){const a=o?.split("-")[0];i=a&&Ct.includes(a)?a:"en"}await Ha({fallbackLocale:"en",initialLocale:i}),gt=!0}function js(e){ie.set(e)}function ks(e,t,r="en"){return e&&t.includes(e)?e:r}function vs(e){if(e){try{for(const t in e.custom_translations)Xe(t,e.custom_translations[t]);for(const t in e.processed_langs)t==="en"&&e.processed_langs[t].type==="static"?Xe(t,Zt):e.processed_langs[t].type==="lazy"&&Pa(t,e.processed_langs[t].data)}catch(t){console.error("Error loading translations:",t)}for(const t in Rr)Xe(t,{common:{loading:Rr[t]}})}}export{ie as $,Hs as A,Wi as B,Ee as C,ws as D,Rs as E,Es as F,yo as G,Gs as H,js as I,Ls as J,As as K,ao as L,Vs as M,gs as N,pe as O,Cs as P,Ss as Q,Bs as R,ye as S,Ds as T,Ns as U,ks as V,Us as W,vs as X,ms as Y,Z as a,Pe as b,xs as c,fo as d,co as e,$r as f,Is as g,ro as h,or as i,_o as j,Yi as k,Os as l,po as m,Lr as n,Ms as o,G as p,_r as q,Ps as r,Ki as s,oo as t,Zi as u,ys as v,Be as w,Ts as x,Fs as y,ts as z}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfDebug.fragment-BJfD4pWZ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfDebug.fragment-BJfD4pWZ.js new file mode 100644 index 0000000000000000000000000000000000000000..c20b73aaf6c7ebecc5ea3816d00a626c587eca36 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfDebug.fragment-BJfD4pWZ.js @@ -0,0 +1,34 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblCdfDebugPixelShader",f=`#define PI 3.1415927 +varying vUV: vec2f;var cdfySampler: sampler;var cdfy: texture_2d;var cdfxSampler: sampler;var cdfx: texture_2d;var icdfSampler: sampler;var icdf: texture_2d; +#ifdef IBL_USE_CUBE_MAP +var iblSourceSampler: sampler;var iblSource: texture_cube; +#else +var iblSourceSampler: sampler;var iblSource: texture_2d; +#endif +var textureSamplerSampler: sampler;var textureSampler: texture_2d; +#define cdfyVSize (0.8/3.0) +#define cdfxVSize 0.1 +#define cdfyHSize 0.5 +uniform sizeParams: vec4f; +#ifdef IBL_USE_CUBE_MAP +fn equirectangularToCubemapDirection(uv: vec2f)->vec3f {var longitude: f32=uv.x*2.0*PI-PI;var latitude: f32=PI*0.5-uv.y*PI;var direction: vec3f;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;} +#endif +@fragment +fn main(input: FragmentInputs)->FragmentOutputs { +var colour: vec3f= vec3f(0.0);var uv: vec2f = +vec2f((uniforms.sizeParams.x+input.vUV.x)*uniforms.sizeParams.z,(uniforms.sizeParams.y+input.vUV.y)*uniforms.sizeParams.w);var backgroundColour: vec3f=textureSample(textureSampler,textureSamplerSampler,input.vUV).rgb;var cdfxWidth: u32=textureDimensions(cdfx,0).x;var cdfyHeight: u32=textureDimensions(cdfy,0).y;const iblStart: f32=1.0-cdfyVSize;const pdfStart: f32=1.0-2.0*cdfyVSize;const cdfyStart: f32=1.0-3.0*cdfyVSize;const cdfxStart: f32=1.0-3.0*cdfyVSize-cdfxVSize;const icdfxStart: f32=1.0-3.0*cdfyVSize-2.0*cdfxVSize; +#ifdef IBL_USE_CUBE_MAP +var direction: vec3f=equirectangularToCubemapDirection( +(uv- vec2f(0.0,iblStart))* vec2f(1.0,1.0/cdfyVSize));var iblColour: vec3f=textureSampleLevel(iblSource,iblSourceSampler,direction,0.0).rgb; +#else +var iblColour: vec3f=textureSample(iblSource,iblSourceSampler,(uv- vec2f(0.0,iblStart)) * +vec2f(1.0,1.0/cdfyVSize)) +.rgb; +#endif +var pdfColour: vec3f = +textureSample(icdf,icdfSampler,(uv- vec2f(0.0,pdfStart))* vec2f(1.0,1.0/cdfyVSize)).zzz;var cdfyColour: f32 = +textureSample(cdfy,cdfySampler,(uv- vec2f(0.0,cdfyStart))* vec2f(2.0,1.0/cdfyVSize)).r;var icdfyColour: f32 = +textureSample(icdf,icdfSampler,(uv- vec2f(0.5,cdfyStart))* vec2f(2.0,1.0/cdfyVSize)).g;var cdfxColour: f32 = +textureSample(cdfx,cdfxSampler,(uv- vec2f(0.0,cdfxStart))* vec2f(1.0,1.0/cdfxVSize)).r;var icdfxColour: f32=textureSample(icdf,icdfSampler,(uv- vec2f(0.0,icdfxStart)) * +vec2f(1.0,1.0/cdfxVSize)).r;if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {colour=backgroundColour;} else if (uv.y>iblStart) {colour+=iblColour;} else if (uv.y>pdfStart) {colour+=pdfColour;} else if (uv.y>cdfyStart && uv.x<0.5) {colour.r+=cdfyColour/f32(cdfyHeight);} else if (uv.y>cdfyStart && uv.x>0.5) {colour.r+=icdfyColour;} else if (uv.y>cdfxStart) {colour.r+=cdfxColour/f32(cdfxWidth);} else if (uv.y>icdfxStart) {colour.r+=icdfxColour;} +fragmentOutputs.color =vec4(mix(colour,backgroundColour,0.5),1.0);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=f);const i={name:e,shader:f};export{i as iblCdfDebugPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfDebug.fragment-Cx2dAOJ2.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfDebug.fragment-Cx2dAOJ2.js new file mode 100644 index 0000000000000000000000000000000000000000..21b2a416e00d49daec88278e8338df0a6c3b5e8a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfDebug.fragment-Cx2dAOJ2.js @@ -0,0 +1,42 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblCdfDebugPixelShader",i=`precision highp samplerCube; +#define PI 3.1415927 +varying vec2 vUV;uniform sampler2D cdfy;uniform sampler2D cdfx;uniform sampler2D icdf;uniform sampler2D pdf; +#ifdef IBL_USE_CUBE_MAP +uniform samplerCube iblSource; +#else +uniform sampler2D iblSource; +#endif +uniform sampler2D textureSampler; +#define cdfyVSize (0.8/3.0) +#define cdfxVSize 0.1 +#define cdfyHSize 0.5 +uniform vec4 sizeParams; +#define offsetX sizeParams.x +#define offsetY sizeParams.y +#define widthScale sizeParams.z +#define heightScale sizeParams.w +#ifdef IBL_USE_CUBE_MAP +vec3 equirectangularToCubemapDirection(vec2 uv) {float longitude=uv.x*2.0*PI-PI;float latitude=PI*0.5-uv.y*PI;vec3 direction;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;} +#endif +void main(void) {vec3 colour=vec3(0.0);vec2 uv = +vec2((offsetX+vUV.x)*widthScale,(offsetY+vUV.y)*heightScale);vec3 backgroundColour=texture2D(textureSampler,vUV).rgb;int cdfxWidth=textureSize(cdfx,0).x;int cdfyHeight=textureSize(cdfy,0).y;const float iblStart=1.0-cdfyVSize;const float pdfStart=1.0-2.0*cdfyVSize;const float cdfyStart=1.0-3.0*cdfyVSize;const float cdfxStart=1.0-3.0*cdfyVSize-cdfxVSize;const float icdfxStart=1.0-3.0*cdfyVSize-2.0*cdfxVSize; +#ifdef IBL_USE_CUBE_MAP +vec3 direction=equirectangularToCubemapDirection( +(uv-vec2(0.0,iblStart))*vec2(1.0,1.0/cdfyVSize));vec3 iblColour=textureCubeLodEXT(iblSource,direction,0.0).rgb; +#else +vec3 iblColour=texture2D(iblSource,(uv-vec2(0.0,iblStart)) * +vec2(1.0,1.0/cdfyVSize)) +.rgb; +#endif +vec3 pdfColour=texture(icdf,(uv-vec2(0.0,pdfStart)) * +vec2(1.0,1.0/cdfyVSize)).zzz;float cdfyColour = +texture2D(cdfy,(uv-vec2(0.0,cdfyStart))*vec2(2.0,1.0/cdfyVSize)) +.r;float icdfyColour = +texture2D(icdf,(uv-vec2(0.5,cdfyStart))*vec2(2.0,1.0/cdfyVSize)) +.g;float cdfxColour = +texture2D(cdfx,(uv-vec2(0.0,cdfxStart))*vec2(1.0,1.0/cdfxVSize)) +.r;float icdfxColour=texture2D(icdf,(uv-vec2(0.0,icdfxStart)) * +vec2(1.0,1.0/cdfxVSize)) +.r;if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {colour=backgroundColour;} else if (uv.y>iblStart) {colour+=iblColour;} else if (uv.y>pdfStart) {colour+=pdfColour;} else if (uv.y>cdfyStart && uv.x<0.5) {colour.r+=cdfyColour/float(cdfyHeight);} else if (uv.y>cdfyStart && uv.x>0.5) {colour.r+=icdfyColour;} else if (uv.y>cdfxStart) {colour.r+=cdfxColour/float(cdfxWidth);} else if (uv.y>icdfxStart) {colour.r+=icdfxColour;} +gl_FragColor=vec4(colour,1.0);glFragColor.rgb=mix(gl_FragColor.rgb,backgroundColour,0.5);} +`;r.ShadersStore[e]||(r.ShadersStore[e]=i);const c={name:e,shader:i};export{c as iblCdfDebugPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfGenerator-BLPdciVw.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfGenerator-BLPdciVw.js new file mode 100644 index 0000000000000000000000000000000000000000..0cde6e123839939016f45534df90fdefb3927e1a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfGenerator-BLPdciVw.js @@ -0,0 +1,9 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./procedural.vertex-C_VYs-T2.js","./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./procedural.vertex-BeyWwzKr.js","./iblCdfx.fragment-Cm4a90__.js","./iblCdfy.fragment-DLfJSGAm.js","./iblScaledLuminance.fragment-CiVFEdcc.js","./helperFunctions-CZpZ-EbL.js","./iblCdfx.fragment-gW8ygofD.js","./iblCdfy.fragment-BySG9oAG.js","./helperFunctions-BkWNqKeI.js","./iblScaledLuminance.fragment-fmUpCvMl.js","./iblIcdf.fragment-D1zIdHMH.js","./iblDominantDirection.fragment-Du8XVDrQ.js","./hdrFilteringFunctions-DD5EqJpN.js","./pbrBRDFFunctions-baMKuu65.js","./iblIcdf.fragment-BbE0RQcG.js","./iblDominantDirection.fragment-CKhU8M25.js","./hdrFilteringFunctions-DFleLIbL.js","./pbrBRDFFunctions-BEHyjaG2.js","./iblCdfDebug.fragment-BJfD4pWZ.js","./iblCdfDebug.fragment-Cx2dAOJ2.js"])))=>i.map(i=>d[i]); +import{af as a}from"./index-DWyDLubb.js";import{a as p,d as T,T as m,O as g,aq as b,bb as D,J as o,aL as x,o as E,_ as d,s as c,R as S,ai as I,L as C,bn as v,aA as W,bo as L,V as A,be as O}from"./index-CDrXokXW.js";import{R}from"./rawTexture-DYLCXHMF.js";class B{constructor(e){this.name=p.NAME_PROCEDURALTEXTURE,this.scene=e}register(){this.scene._beforeClearStage.registerStep(p.STEP_BEFORECLEAR_PROCEDURALTEXTURE,this,this._beforeClear)}rebuild(){}dispose(){}_beforeClear(){if(this.scene.proceduralTexturesEnabled){T.StartPerformanceCounter("Procedural textures",this.scene.proceduralTextures.length>0);for(let e=0;e0)}}}class h extends m{get shaderLanguage(){return this._shaderLanguage}constructor(e,t,s,r,i=null,n=!0,u=!1,P=0){super(null,r,!n),this.isEnabled=!0,this.autoClear=!0,this.onGeneratedObservable=new g,this.onBeforeGenerationObservable=new g,this.nodeMaterialSource=null,this.defines="",this._textures={},this._currentRefreshId=-1,this._frameId=-1,this._refreshRate=1,this._vertexBuffers={},this._uniforms=new Array,this._samplers=new Array,this._floats={},this._ints={},this._floatsArrays={},this._colors3={},this._colors4={},this._vectors2={},this._vectors3={},this._vectors4={},this._matrices={},this._fallbackTextureUsed=!1,this._cachedDefines=null,this._contentUpdateId=-1,this._rtWrapper=null,i!==null&&!(i instanceof m)?(this._options=i,this._fallbackTexture=i.fallbackTexture??null):(this._options={},this._fallbackTexture=i),this._shaderLanguage=this._options.shaderLanguage??0,r=this.getScene()||b.LastCreatedScene;let l=r._getComponent(p.NAME_PROCEDURALTEXTURE);l||(l=new B(r),r._addComponent(l)),r.proceduralTextures.push(this),this._fullEngine=r.getEngine(),this.name=e,this.isRenderTarget=!0,this._size=t,this._textureType=P,this._generateMipMaps=n,this._drawWrapper=new D(this._fullEngine),this.setFragment(s);const y=this._createRtWrapper(u,t,n,P);this._texture=y.texture;const _=[];_.push(1,1),_.push(-1,1),_.push(-1,-1),_.push(1,-1),this._vertexBuffers[o.PositionKind]=new o(this._fullEngine,_,o.PositionKind,!1,!1,2),this._createIndexBuffer()}_createRtWrapper(e,t,s,r){return e?(this._rtWrapper=this._fullEngine.createRenderTargetCubeTexture(t,{generateMipMaps:s,generateDepthBuffer:!1,generateStencilBuffer:!1,type:r,...this._options}),this.setFloat("face",0)):(this._rtWrapper=this._fullEngine.createRenderTargetTexture(t,{generateMipMaps:s,generateDepthBuffer:!1,generateStencilBuffer:!1,type:r,...this._options}),this._rtWrapper.is3D&&(this.setFloat("layer",0),this.setInt("layerNum",0))),this._rtWrapper}getEffect(){return this._drawWrapper.effect}_setEffect(e){this._drawWrapper.effect=e}getContent(){return this._contentData&&this._frameId===this._contentUpdateId?this._contentData:(this._contentData?this._contentData.then(e=>{this._contentData=this.readPixels(0,0,e),this._contentUpdateId=this._frameId}):(this._contentData=this.readPixels(0,0),this._contentUpdateId=this._frameId),this._contentData)}_createIndexBuffer(){const e=this._fullEngine,t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)}_rebuild(){const e=this._vertexBuffers[o.PositionKind];e&&e._rebuild(),this._createIndexBuffer(),this.refreshRate===x.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=x.REFRESHRATE_RENDER_ONCE)}reset(){this._drawWrapper.effect?.dispose(),this._drawWrapper.effect=null,this._cachedDefines=null}_getDefines(){return this.defines}executeWhenReady(e){if(this.isReady()){e(this);return}const t=this.getEffect();t&&t.executeWhenCompiled(()=>{e(this)})}isReady(){const e=this._fullEngine;if(this.nodeMaterialSource)return this._drawWrapper.effect.isReady();if(!this._fragment)return!1;if(this._fallbackTextureUsed)return!0;if(!this._texture)return!1;const t=this._getDefines();if(this._drawWrapper.effect&&t===this._cachedDefines&&this._drawWrapper.effect.isReady())return!0;const s={vertex:"procedural",fragmentElement:this._fragment.fragmentElement,fragmentSource:this._fragment.fragmentSource,fragment:typeof this._fragment=="string"?this._fragment:void 0};return this._cachedDefines!==t&&(this._cachedDefines=t,this._drawWrapper.effect=e.createEffect(s,[o.PositionKind],this._uniforms,this._samplers,t,void 0,void 0,()=>{this._rtWrapper?.dispose(),this._rtWrapper=this._texture=null,this._fallbackTexture&&(this._texture=this._fallbackTexture._texture,this._texture&&this._texture.incrementReferences()),this._fallbackTextureUsed=!0},void 0,this._shaderLanguage,async()=>{this._options.extraInitializationsAsync?this.shaderLanguage===1?await Promise.all([a(()=>import("./procedural.vertex-C_VYs-T2.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),this._options.extraInitializationsAsync()]):await Promise.all([a(()=>import("./procedural.vertex-BeyWwzKr.js"),__vite__mapDeps([4,1,2,3]),import.meta.url),this._options.extraInitializationsAsync()]):this.shaderLanguage===1?await a(()=>import("./procedural.vertex-C_VYs-T2.js"),__vite__mapDeps([0,1,2,3]),import.meta.url):await a(()=>import("./procedural.vertex-BeyWwzKr.js"),__vite__mapDeps([4,1,2,3]),import.meta.url)})),this._drawWrapper.effect.isReady()}resetRefreshCounter(){this._currentRefreshId=-1}setFragment(e){this._fragment=e}get refreshRate(){return this._refreshRate}set refreshRate(e){this._refreshRate=e,this.resetRefreshCounter()}_shouldRender(){return!this.isEnabled||!this.isReady()||!this._texture?(this._texture&&(this._texture.isReady=!1),!1):this._fallbackTextureUsed?!1:this._currentRefreshId===-1?(this._currentRefreshId=1,this._frameId++,!0):this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,this._frameId++,!0):(this._currentRefreshId++,!1)}getRenderSize(){return this._size}resize(e,t){if(this._fallbackTextureUsed||!this._rtWrapper||!this._texture)return;const s=this._texture.isCube;this._rtWrapper.dispose();const r=this._createRtWrapper(s,e,t,this._textureType);this._texture=r.texture,this._size=e,this._generateMipMaps=t}_checkUniform(e){this._uniforms.indexOf(e)===-1&&this._uniforms.push(e)}setTexture(e,t){return this._samplers.indexOf(e)===-1&&this._samplers.push(e),this._textures[e]=t,this}setFloat(e,t){return this._checkUniform(e),this._floats[e]=t,this}setInt(e,t){return this._checkUniform(e),this._ints[e]=t,this}setFloats(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this}setColor3(e,t){return this._checkUniform(e),this._colors3[e]=t,this}setColor4(e,t){return this._checkUniform(e),this._colors4[e]=t,this}setVector2(e,t){return this._checkUniform(e),this._vectors2[e]=t,this}setVector3(e,t){return this._checkUniform(e),this._vectors3[e]=t,this}setVector4(e,t){return this._checkUniform(e),this._vectors4[e]=t,this}setMatrix(e,t){return this._checkUniform(e),this._matrices[e]=t,this}render(e){const t=this.getScene();if(!t)return;const s=this._fullEngine;if(s.enableEffect(this._drawWrapper),this.onBeforeGenerationObservable.notifyObservers(this),s.setState(!1),!this.nodeMaterialSource){for(const i in this._textures)this._drawWrapper.effect.setTexture(i,this._textures[i]);for(const i in this._ints)this._drawWrapper.effect.setInt(i,this._ints[i]);for(const i in this._floats)this._drawWrapper.effect.setFloat(i,this._floats[i]);for(const i in this._floatsArrays)this._drawWrapper.effect.setArray(i,this._floatsArrays[i]);for(const i in this._colors3)this._drawWrapper.effect.setColor3(i,this._colors3[i]);for(const i in this._colors4){const n=this._colors4[i];this._drawWrapper.effect.setFloat4(i,n.r,n.g,n.b,n.a)}for(const i in this._vectors2)this._drawWrapper.effect.setVector2(i,this._vectors2[i]);for(const i in this._vectors3)this._drawWrapper.effect.setVector3(i,this._vectors3[i]);for(const i in this._vectors4)this._drawWrapper.effect.setVector4(i,this._vectors4[i]);for(const i in this._matrices)this._drawWrapper.effect.setMatrix(i,this._matrices[i])}if(!this._texture||!this._rtWrapper)return;s._enableGPUDebugMarkers&&(s.restoreDefaultFramebuffer(),s._debugPushGroup?.(`procedural texture generation for ${this.name}`));const r=s.currentViewport;if(this.isCube)for(let i=0;i<6;i++)s.bindFramebuffer(this._rtWrapper,i,void 0,void 0,!0),s.bindBuffers(this._vertexBuffers,this._indexBuffer,this._drawWrapper.effect),this._drawWrapper.effect.setFloat("face",i),this.autoClear&&s.clear(t.clearColor,!0,!1,!1),s.drawElementsType(E.TriangleFillMode,0,6),s.unBindFramebuffer(this._rtWrapper,!0);else{let i=1;this._rtWrapper.is3D?i=this._rtWrapper.depth:this._rtWrapper.is2DArray&&(i=this._rtWrapper.layers);for(let n=0;n=0&&e.proceduralTextures.splice(t,1);const s=this._vertexBuffers[o.PositionKind];s&&(s.dispose(),this._vertexBuffers[o.PositionKind]=null),this._indexBuffer&&this._fullEngine._releaseBuffer(this._indexBuffer)&&(this._indexBuffer=null),this.onGeneratedObservable.clear(),this.onBeforeGenerationObservable.clear(),super.dispose()}}d([c()],h.prototype,"isEnabled",void 0);d([c()],h.prototype,"autoClear",void 0);d([c()],h.prototype,"_generateMipMaps",void 0);d([c()],h.prototype,"_size",void 0);d([c()],h.prototype,"refreshRate",null);S("BABYLON.ProceduralTexture",h);class f{get isSupported(){const e=b.LastCreatedEngine;return e?e.getCaps().texelFetch:!1}get iblSource(){return this._iblSource}set iblSource(e){this._iblSource!==e&&(this._disposeTextures(),this._iblSource=e,e&&(e.isCube?e.isReadyOrNotBlocking()?this._recreateAssetsFromNewIbl():e.onLoadObservable.addOnce(this._recreateAssetsFromNewIbl.bind(this,e)):e.isReadyOrNotBlocking()?this._recreateAssetsFromNewIbl():e.onLoadObservable.addOnce(this._recreateAssetsFromNewIbl.bind(this,e))))}_recreateAssetsFromNewIbl(){this._debugPass&&this._debugPass.dispose(),this._createTextures(),this._debugPass&&this._createDebugPass()}getIcdfTexture(){return this._icdfPT?this._icdfPT:this._dummyTexture}setDebugDisplayParams(e,t,s,r){this._debugSizeParams.set(e,t,s,r)}get debugPassName(){return this._debugPassName}getDebugPassPP(){return this._debugPass||this._createDebugPass(),this._debugPass}constructor(e){if(this._cachedDominantDirection=null,this.debugEnabled=!1,this._debugSizeParams=new I(0,0,1,1),this._debugPassName="CDF Debug",this.onGeneratedObservable=new g,e?f._IsScene(e)?this._scene=e:this._engine=e:this._scene=b.LastCreatedScene,this._scene&&(this._engine=this._scene.getEngine()),!this.isSupported){C.Warn("CDF renderer is not supported by the current engine.");return}const t=new Uint16Array([0,0,0,255]);this._dummyTexture=new R(t,1,1,v.TEXTUREFORMAT_RGBA,e,!1,!1,void 0,2),this._scene&&f._SceneComponentInitialization(this._scene)}_createTextures(){const e=this._iblSource?{width:this._iblSource.getSize().width,height:this._iblSource.getSize().height}:{width:1,height:1};this._iblSource||(this._iblSource=R.CreateRTexture(new Uint8Array([255]),1,1,this._engine,!1,!1,1,0),this._iblSource.name="Placeholder IBL Source"),this._iblSource.isCube&&(e.width*=4,e.height*=2,e.width=1<{t?await Promise.all([a(()=>import("./iblCdfx.fragment-Cm4a90__.js"),__vite__mapDeps([5,1,2,3]),import.meta.url),a(()=>import("./iblCdfy.fragment-DLfJSGAm.js"),__vite__mapDeps([6,1,2,3]),import.meta.url),a(()=>import("./iblScaledLuminance.fragment-CiVFEdcc.js"),__vite__mapDeps([7,1,2,3,8]),import.meta.url)]):await Promise.all([a(()=>import("./iblCdfx.fragment-gW8ygofD.js"),__vite__mapDeps([9,1,2,3]),import.meta.url),a(()=>import("./iblCdfy.fragment-BySG9oAG.js"),__vite__mapDeps([10,1,2,3,11]),import.meta.url),a(()=>import("./iblScaledLuminance.fragment-fmUpCvMl.js"),__vite__mapDeps([12,1,2,3,11]),import.meta.url)])}},r={generateDepthBuffer:!1,generateMipMaps:!1,format:5,type:2,samplingMode:1,shaderLanguage:t?1:0,gammaSpace:!1,extraInitializationsAsync:async()=>{t?await Promise.all([a(()=>import("./iblIcdf.fragment-D1zIdHMH.js"),__vite__mapDeps([13,1,2,3,8]),import.meta.url),a(()=>import("./iblDominantDirection.fragment-Du8XVDrQ.js"),__vite__mapDeps([14,1,2,3,8,15,16]),import.meta.url)]):await Promise.all([a(()=>import("./iblIcdf.fragment-BbE0RQcG.js"),__vite__mapDeps([17,1,2,3,11]),import.meta.url),a(()=>import("./iblDominantDirection.fragment-CKhU8M25.js"),__vite__mapDeps([18,1,2,3,11,19,20]),import.meta.url)])}};this._cdfyPT=new h("cdfyTexture",{width:e.width,height:e.height+1},"iblCdfy",this._scene,s,!1,!1),this._cdfyPT.autoClear=!1,this._cdfyPT.setTexture("iblSource",this._iblSource),this._cdfyPT.setInt("iblHeight",e.height),this._cdfyPT.wrapV=0,this._cdfyPT.refreshRate=0,this._iblSource.isCube&&(this._cdfyPT.defines=`#define IBL_USE_CUBE_MAP +`),this._cdfxPT=new h("cdfxTexture",{width:e.width+1,height:1},"iblCdfx",this._scene,s,!1,!1),this._cdfxPT.autoClear=!1,this._cdfxPT.setTexture("cdfy",this._cdfyPT),this._cdfxPT.refreshRate=0,this._cdfxPT.wrapU=0,this._scaledLuminancePT=new h("iblScaledLuminance",{width:e.width,height:e.height},"iblScaledLuminance",this._scene,{...s,samplingMode:3,generateMipMaps:!0},!0,!1),this._scaledLuminancePT.autoClear=!1,this._scaledLuminancePT.setTexture("iblSource",this._iblSource),this._scaledLuminancePT.setInt("iblHeight",e.height),this._scaledLuminancePT.setInt("iblWidth",e.width),this._scaledLuminancePT.refreshRate=0,this._iblSource.isCube&&(this._scaledLuminancePT.defines=`#define IBL_USE_CUBE_MAP +`),this._icdfPT=new h("icdfTexture",{width:e.width,height:e.height},"iblIcdf",this._scene,r,!1,!1),this._icdfPT.autoClear=!1,this._icdfPT.setTexture("cdfy",this._cdfyPT),this._icdfPT.setTexture("cdfx",this._cdfxPT),this._icdfPT.setTexture("iblSource",this._iblSource),this._icdfPT.setTexture("scaledLuminanceSampler",this._scaledLuminancePT),this._icdfPT.refreshRate=0,this._icdfPT.wrapV=0,this._icdfPT.wrapU=0,this._iblSource.isCube&&(this._icdfPT.defines=`#define IBL_USE_CUBE_MAP +`),this._icdfPT.onGeneratedObservable.addOnce(()=>{this.onGeneratedObservable.notifyObservers()}),this._dominantDirectionPT=new h("iblDominantDirection",{width:1,height:1},"iblDominantDirection",this._scene,r,!1,!1),this._dominantDirectionPT.autoClear=!1,this._dominantDirectionPT.setTexture("icdfSampler",this._icdfPT),this._dominantDirectionPT.refreshRate=0,this._dominantDirectionPT.defines=`#define NUM_SAMPLES 32u +`}_disposeTextures(){this._cdfyPT?.dispose(),this._cdfxPT?.dispose(),this._icdfPT?.dispose(),this._scaledLuminancePT?.dispose(),this._dominantDirectionPT?.dispose()}_createDebugPass(){this._debugPass&&this._debugPass.dispose();const e=this._engine.isWebGPU,t={width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight(),samplingMode:m.BILINEAR_SAMPLINGMODE,engine:this._engine,textureType:0,uniforms:["sizeParams"],samplers:["cdfy","icdf","cdfx","iblSource"],defines:this._iblSource?.isCube?`#define IBL_USE_CUBE_MAP +`:"",shaderLanguage:e?1:0,extraInitializations:(r,i)=>{r?i.push(a(()=>import("./iblCdfDebug.fragment-BJfD4pWZ.js"),__vite__mapDeps([21,1,2,3]),import.meta.url)):i.push(a(()=>import("./iblCdfDebug.fragment-Cx2dAOJ2.js"),__vite__mapDeps([22,1,2,3]),import.meta.url))}};this._debugPass=new W(this._debugPassName,"iblCdfDebug",t);const s=this._debugPass.getEffect();s&&(s.defines=this._iblSource?.isCube?`#define IBL_USE_CUBE_MAP +`:""),this._iblSource?.isCube&&this._debugPass.updateEffect(`#define IBL_USE_CUBE_MAP +`),this._debugPass.onApplyObservable.add(r=>{r.setTexture("cdfy",this._cdfyPT),r.setTexture("icdf",this._icdfPT),r.setTexture("cdfx",this._cdfxPT),r.setTexture("iblSource",this._iblSource),r.setFloat4("sizeParams",this._debugSizeParams.x,this._debugSizeParams.y,this._debugSizeParams.z,this._debugSizeParams.w)})}isReady(){return this._iblSource&&this._iblSource.name!=="Placeholder IBL Source"&&this._iblSource.isReady()&&this._cdfyPT&&this._cdfyPT.isReady()&&this._icdfPT&&this._icdfPT.isReady()&&this._cdfxPT&&this._cdfxPT.isReady()&&this._scaledLuminancePT&&this._scaledLuminancePT.isReady()}renderWhenReady(){return this._cachedDominantDirection=null,new Promise((t,s)=>{L(()=>!!this._icdfPT,()=>t(void 0),()=>s(new Error("Waiting for _icdfPT creation failed")))}).then(()=>{this._icdfPT.onGeneratedObservable.addOnce(()=>{this.onGeneratedObservable.notifyObservers()});const t=[],s=[this._cdfyPT,this._cdfxPT,this._scaledLuminancePT,this._icdfPT];for(const r of s)t.push(new Promise(i=>{r.isReady()?i():r.getEffect().executeWhenCompiled(()=>{i()})}));return Promise.all(t).then(()=>{for(const r of s)r.render()})})}findDominantDirection(){return this._cachedDominantDirection?Promise.resolve(this._cachedDominantDirection):new Promise(e=>{this._dominantDirectionPT.onGeneratedObservable.addOnce(()=>{const t=new Float32Array(4);this._dominantDirectionPT.readPixels(0,0,t,!0).then(()=>{const s=new A(t[0],t[1],t[2]);this._cachedDominantDirection=s,e(s)})}),this.isReady()?this._dominantDirectionPT.isReady()?this._dominantDirectionPT.render():this._dominantDirectionPT.getEffect().executeWhenCompiled(()=>{this._dominantDirectionPT.render()}):this.onGeneratedObservable.addOnce(()=>{this._dominantDirectionPT.isReady()?this._dominantDirectionPT.render():this._dominantDirectionPT.getEffect().executeWhenCompiled(()=>{this._dominantDirectionPT.render()})})})}dispose(){this._disposeTextures(),this._dummyTexture.dispose(),this._debugPass&&this._debugPass.dispose(),this.onGeneratedObservable.clear()}static _IsScene(e){return e.getClassName()==="Scene"}}f._SceneComponentInitialization=w=>{throw O("IblCdfGeneratorSceneComponentSceneComponent")};const V=Object.freeze(Object.defineProperty({__proto__:null,IblCdfGenerator:f},Symbol.toStringTag,{value:"Module"}));export{f as I,h as P,V as i}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfGeneratorSceneComponent-Buukicac.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfGeneratorSceneComponent-Buukicac.js new file mode 100644 index 0000000000000000000000000000000000000000..0dd2896b3600d5dcef31e4e8e107c808370be7eb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfGeneratorSceneComponent-Buukicac.js @@ -0,0 +1 @@ +import{a as n,b as r}from"./index-CDrXokXW.js";import{I as i}from"./iblCdfGenerator-BLPdciVw.js";import"./index-DWyDLubb.js";import"./rawTexture-DYLCXHMF.js";Object.defineProperty(r.prototype,"iblCdfGenerator",{get:function(){return this._iblCdfGenerator},set:function(e){e&&(this._iblCdfGenerator=e)},enumerable:!0,configurable:!0});r.prototype.enableIblCdfGenerator=function(){return this._iblCdfGenerator?this._iblCdfGenerator:(this._iblCdfGenerator=new i(this),this._iblCdfGenerator.isSupported?(this.environmentTexture&&(this._iblCdfGenerator.iblSource=this.environmentTexture),this._iblCdfGenerator):(this._iblCdfGenerator=null,null))};r.prototype.disableIblCdfGenerator=function(){this._iblCdfGenerator&&(this._iblCdfGenerator.dispose(),this._iblCdfGenerator=null)};class o{constructor(t){this.name=n.NAME_IBLCDFGENERATOR,this._newIblObserver=null,this.scene=t}register(){this._updateIblSource(),this._newIblObserver=this.scene.onEnvironmentTextureChangedObservable.add(this._updateIblSource.bind(this))}rebuild(){}dispose(){this.scene.onEnvironmentTextureChangedObservable.remove(this._newIblObserver)}_updateIblSource(){this.scene.iblCdfGenerator&&this.scene.environmentTexture&&(this.scene.iblCdfGenerator.iblSource=this.scene.environmentTexture)}}i._SceneComponentInitialization=e=>{let t=e._getComponent(n.NAME_IBLCDFGENERATOR);t||(t=new o(e),e._addComponent(t))};export{o as IblCdfGeneratorSceneComponent}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfx.fragment-Cm4a90__.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfx.fragment-Cm4a90__.js new file mode 100644 index 0000000000000000000000000000000000000000..c89ae4fadeff5e8dcb8ddd1baa8e2859cfefd0e2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfx.fragment-Cm4a90__.js @@ -0,0 +1,4 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblCdfxPixelShader",t=`#define PI 3.1415927 +varying vUV: vec2f;var cdfy: texture_2d;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var cdfyRes=textureDimensions(cdfy,0);var currentPixel=vec2u(fragmentInputs.position.xy);var cdfx: f32=0.0;for (var x: u32=1; x<=currentPixel.x; x++) {cdfx+=textureLoad(cdfy, vec2u(x-1,cdfyRes.y-1),0).x;} +fragmentOutputs.color= vec4f( vec3f(cdfx),1.0);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=t);const n={name:e,shader:t};export{n as iblCdfxPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfx.fragment-gW8ygofD.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfx.fragment-gW8ygofD.js new file mode 100644 index 0000000000000000000000000000000000000000..f331fce41253021678a93a4b0e9087e39945da68 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfx.fragment-gW8ygofD.js @@ -0,0 +1,4 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblCdfxPixelShader",i=`precision highp sampler2D; +#define PI 3.1415927 +varying vec2 vUV;uniform sampler2D cdfy;void main(void) {ivec2 cdfyRes=textureSize(cdfy,0);ivec2 currentPixel=ivec2(gl_FragCoord.xy);float cdfx=0.0;for (int x=1; x<=currentPixel.x; x++) {cdfx+=texelFetch(cdfy,ivec2(x-1,cdfyRes.y-1),0).x;} +gl_FragColor=vec4(vec3(cdfx),1.0);}`;r.ShadersStore[e]||(r.ShadersStore[e]=i);const o={name:e,shader:i};export{o as iblCdfxPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfy.fragment-BySG9oAG.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfy.fragment-BySG9oAG.js new file mode 100644 index 0000000000000000000000000000000000000000..36f41d3c9de172e6983f2a3aaceaa13ff809e590 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfy.fragment-BySG9oAG.js @@ -0,0 +1,24 @@ +import{S as o}from"./index-CDrXokXW.js";import"./helperFunctions-BkWNqKeI.js";import"./index-DWyDLubb.js";const e="iblCdfyPixelShader",i=`precision highp sampler2D;precision highp samplerCube; +#include +#define PI 3.1415927 +varying vec2 vUV; +#ifdef IBL_USE_CUBE_MAP +uniform samplerCube iblSource; +#else +uniform sampler2D iblSource; +#endif +uniform int iblHeight; +#ifdef IBL_USE_CUBE_MAP +float fetchCube(vec2 uv) {vec3 direction=equirectangularToCubemapDirection(uv);return sin(PI*uv.y)*dot(textureCubeLodEXT(iblSource,direction,0.0).rgb,LuminanceEncodeApprox);} +#else +float fetchPanoramic(ivec2 Coords,float envmapHeight) {return sin(PI*(float(Coords.y)+0.5)/envmapHeight) * +dot(texelFetch(iblSource,Coords,0).rgb,LuminanceEncodeApprox);} +#endif +void main(void) {ivec2 coords=ivec2(gl_FragCoord.x,gl_FragCoord.y);float cdfy=0.0;for (int y=1; y<=coords.y; y++) { +#ifdef IBL_USE_CUBE_MAP +vec2 uv=vec2(vUV.x,(float(y-1)+0.5)/float(iblHeight));cdfy+=fetchCube(uv); +#else +cdfy+=fetchPanoramic(ivec2(coords.x,y-1),float(iblHeight)); +#endif +} +gl_FragColor=vec4(cdfy,0.0,0.0,1.0);}`;o.ShadersStore[e]||(o.ShadersStore[e]=i);const n={name:e,shader:i};export{n as iblCdfyPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfy.fragment-DLfJSGAm.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfy.fragment-DLfJSGAm.js new file mode 100644 index 0000000000000000000000000000000000000000..cbc98b320536b4cddbe38589f1c48047f047eff2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCdfy.fragment-DLfJSGAm.js @@ -0,0 +1,26 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblCdfyPixelShader",i=`varying vUV : vec2f; +#include +#ifdef IBL_USE_CUBE_MAP +var iblSourceSampler: sampler;var iblSource: texture_cube; +#else +var iblSourceSampler: sampler;var iblSource: texture_2d; +#endif +uniform iblHeight: i32; +#ifdef IBL_USE_CUBE_MAP +fn fetchCube(uv: vec2f)->f32 {var direction: vec3f=equirectangularToCubemapDirection(uv);return sin(PI*uv.y) * +dot(textureSampleLevel(iblSource,iblSourceSampler,direction,0.0) +.rgb, +LuminanceEncodeApprox);} +#else +fn fetchPanoramic(Coords: vec2i,envmapHeight: f32)->f32 {return sin(PI*(f32(Coords.y)+0.5)/envmapHeight) * +dot(textureLoad(iblSource,Coords,0).rgb,LuminanceEncodeApprox);} +#endif +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var coords: vec2i= vec2i(fragmentInputs.position.xy);var cdfy: f32=0.0;for (var y: i32=1; y<=coords.y; y++) { +#ifdef IBL_USE_CUBE_MAP +var uv: vec2f= vec2f(input.vUV.x,( f32(y-1)+0.5)/ f32(uniforms.iblHeight));cdfy+=fetchCube(uv); +#else +cdfy+=fetchPanoramic( vec2i(coords.x,y-1), f32(uniforms.iblHeight)); +#endif +} +fragmentOutputs.color= vec4f(cdfy,0.0,0.0,1.0);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=i);const f={name:e,shader:i};export{f as iblCdfyPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCombineVoxelGrids.fragment-DiVmxDjn.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCombineVoxelGrids.fragment-DiVmxDjn.js new file mode 100644 index 0000000000000000000000000000000000000000..04eb54cf56ca73674a88b6cfbf1400ba1a884458 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCombineVoxelGrids.fragment-DiVmxDjn.js @@ -0,0 +1 @@ +import{S as o}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblCombineVoxelGridsPixelShader",r="precision highp float;precision highp sampler3D;varying vec2 vUV;uniform sampler3D voxelXaxisSampler;uniform sampler3D voxelYaxisSampler;uniform sampler3D voxelZaxisSampler;uniform float layer;void main(void) {vec3 coordZ=vec3(vUV.x,vUV.y,layer);float voxelZ=texture(voxelZaxisSampler,coordZ).r;vec3 coordX=vec3(1.0-layer,vUV.y,vUV.x);float voxelX=texture(voxelXaxisSampler,coordX).r;vec3 coordY=vec3(layer,vUV.x,vUV.y);float voxelY=texture(voxelYaxisSampler,coordY).r;float voxel=(voxelX>0.0 || voxelY>0.0 || voxelZ>0.0) ? 1.0 : 0.0;glFragColor=vec4(vec3(voxel),1.0);}";o.ShadersStore[e]||(o.ShadersStore[e]=r);const v={name:e,shader:r};export{v as iblCombineVoxelGridsPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCombineVoxelGrids.fragment-cuD4UWMh.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCombineVoxelGrids.fragment-cuD4UWMh.js new file mode 100644 index 0000000000000000000000000000000000000000..d8b95be9f6f222e5279ec386ceeafb7e49807cca --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblCombineVoxelGrids.fragment-cuD4UWMh.js @@ -0,0 +1,2 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblCombineVoxelGridsPixelShader",a=`varying vUV: vec2f;var voxelXaxisSamplerSampler: sampler;var voxelXaxisSampler: texture_3d;var voxelYaxisSamplerSampler: sampler;var voxelYaxisSampler: texture_3d;var voxelZaxisSamplerSampler: sampler;var voxelZaxisSampler: texture_3d;uniform layer: f32;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var coordZ: vec3f= vec3f(fragmentInputs.vUV.x,fragmentInputs.vUV.y,uniforms.layer);var voxelZ: f32=textureSample(voxelZaxisSampler,voxelZaxisSamplerSampler,coordZ).r;var coordX: vec3f= vec3f(1.0-uniforms.layer,fragmentInputs.vUV.y,fragmentInputs.vUV.x);var voxelX: f32=textureSample(voxelXaxisSampler,voxelXaxisSamplerSampler,coordX).r;var coordY: vec3f= vec3f(uniforms.layer,fragmentInputs.vUV.x,fragmentInputs.vUV.y);var voxelY: f32=textureSample(voxelYaxisSampler,voxelYaxisSamplerSampler,coordY).r;var voxel=select(0.0,1.0,(voxelX>0.0 || voxelY>0.0 || voxelZ>0.0));fragmentOutputs.color= vec4f( vec3f(voxel),1.0);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=a);const v={name:e,shader:a};export{v as iblCombineVoxelGridsPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblDominantDirection.fragment-CKhU8M25.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblDominantDirection.fragment-CKhU8M25.js new file mode 100644 index 0000000000000000000000000000000000000000..f6dfcc89a5dbaaa42dcd7c74332c5373021b5e71 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblDominantDirection.fragment-CKhU8M25.js @@ -0,0 +1,8 @@ +import{S as e}from"./index-CDrXokXW.js";import"./helperFunctions-BkWNqKeI.js";import"./hdrFilteringFunctions-DFleLIbL.js";import"./pbrBRDFFunctions-BEHyjaG2.js";import"./index-DWyDLubb.js";const i="iblDominantDirectionPixelShader",r=`precision highp sampler2D;precision highp samplerCube; +#include +#include +#include +#include +varying vec2 vUV;uniform sampler2D icdfSampler;void main(void) {vec3 lightDir=vec3(0.0,0.0,0.0);for(uint i=0u; i +#include +#include +#include +var icdfSamplerSampler: sampler;var icdfSampler: texture_2d;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var lightDir: vec3f=vec3f(0.0,0.0,0.0);for(var i: u32=0u; i;uniform layerNum: i32;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var Coords=vec3i(2)*vec3i(vec2i(fragmentInputs.position.xy),uniforms.layerNum);var tex = +(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(0,0,0),0).x>0.0f)) +<< 0u) | +(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(1,0,0),0).x>0.0f)) +<< 1u) | +(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(0,1,0),0).x>0.0f)) +<< 2u) | +(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(1,1,0),0).x>0.0f)) +<< 3u) | +(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(0,0,1),0).x>0.0f)) +<< 4u) | +(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(1,0,1),0).x>0.0f)) +<< 5u) | +(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(0,1,1),0).x>0.0f)) +<< 6u) | +(u32(select(0u,1u,textureLoad(srcMip,Coords+vec3i(1,1,1),0).x>0.0f)) +<< 7u);fragmentOutputs.color=vec4f( f32(tex)/255.0f,0.0f,0.0f,1.0);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=t);const s={name:e,shader:t};export{s as iblGenerateVoxelMipPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblGenerateVoxelMip.fragment-DNulI4J8.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblGenerateVoxelMip.fragment-DNulI4J8.js new file mode 100644 index 0000000000000000000000000000000000000000..ee95f71abb3c63f4212c37838388b23f87d5faed --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblGenerateVoxelMip.fragment-DNulI4J8.js @@ -0,0 +1,17 @@ +import{S as i}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblGenerateVoxelMipPixelShader",r=`precision highp float;precision highp sampler3D;varying vec2 vUV;uniform sampler3D srcMip;uniform int layerNum;void main(void) {ivec3 Coords=ivec3(2)*ivec3(gl_FragCoord.x,gl_FragCoord.y,layerNum);uint tex = +uint(texelFetch(srcMip,Coords+ivec3(0,0,0),0).x>0.0f ? 1u : 0u) +<< 0u | +uint(texelFetch(srcMip,Coords+ivec3(1,0,0),0).x>0.0f ? 1u : 0u) +<< 1u | +uint(texelFetch(srcMip,Coords+ivec3(0,1,0),0).x>0.0f ? 1u : 0u) +<< 2u | +uint(texelFetch(srcMip,Coords+ivec3(1,1,0),0).x>0.0f ? 1u : 0u) +<< 3u | +uint(texelFetch(srcMip,Coords+ivec3(0,0,1),0).x>0.0f ? 1u : 0u) +<< 4u | +uint(texelFetch(srcMip,Coords+ivec3(1,0,1),0).x>0.0f ? 1u : 0u) +<< 5u | +uint(texelFetch(srcMip,Coords+ivec3(0,1,1),0).x>0.0f ? 1u : 0u) +<< 6u | +uint(texelFetch(srcMip,Coords+ivec3(1,1,1),0).x>0.0f ? 1u : 0u) +<< 7u;glFragColor.rgb=vec3(float(tex)/255.0f,0.0f,0.0f);glFragColor.a=1.0;}`;i.ShadersStore[e]||(i.ShadersStore[e]=r);const u={name:e,shader:r};export{u as iblGenerateVoxelMipPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblIcdf.fragment-BbE0RQcG.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblIcdf.fragment-BbE0RQcG.js new file mode 100644 index 0000000000000000000000000000000000000000..cb5d7781f49171924382beb6468ca9bfe1ffae7f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblIcdf.fragment-BbE0RQcG.js @@ -0,0 +1,34 @@ +import{S as t}from"./index-CDrXokXW.js";import"./helperFunctions-BkWNqKeI.js";import"./index-DWyDLubb.js";const e="iblIcdfPixelShader",i=`precision highp sampler2D; +#include +varying vec2 vUV; +#ifdef IBL_USE_CUBE_MAP +uniform samplerCube iblSource; +#else +uniform sampler2D iblSource; +#endif +uniform sampler2D scaledLuminanceSampler;uniform int iblWidth;uniform int iblHeight;uniform sampler2D cdfx;uniform sampler2D cdfy;float fetchLuminance(vec2 coords) { +#ifdef IBL_USE_CUBE_MAP +vec3 direction=equirectangularToCubemapDirection(coords);vec3 color=textureCubeLodEXT(iblSource,direction,0.0).rgb; +#else +vec3 color=textureLod(iblSource,coords,0.0).rgb; +#endif +return dot(color,LuminanceEncodeApprox);} +float fetchCDFx(int x) { return texelFetch(cdfx,ivec2(x,0),0).x; } +float bisectx(int size,float targetValue) {int a=0,b=size-1;while (b-a>1) {int c=a+b>>1;if (fetchCDFx(c)1) {int c=a+b>>1;if (fetchCDFy(c,invocationId) +varying vUV: vec2f; +#ifdef IBL_USE_CUBE_MAP +var iblSourceSampler: sampler;var iblSource: texture_cube; +#else +var iblSourceSampler: sampler;var iblSource: texture_2d; +#endif +var scaledLuminanceSamplerSampler : sampler;var scaledLuminanceSampler : texture_2d;var cdfx: texture_2d;var cdfy: texture_2d;fn fetchLuminance(coords: vec2f)->f32 { +#ifdef IBL_USE_CUBE_MAP +var direction: vec3f=equirectangularToCubemapDirection(coords);var color: vec3f=textureSampleLevel(iblSource,iblSourceSampler,direction,0.0).rgb; +#else +var color: vec3f=textureSampleLevel(iblSource,iblSourceSampler,coords,0.0).rgb; +#endif +return dot(color,LuminanceEncodeApprox);} +fn fetchCDFx(x: u32)->f32 {return textureLoad(cdfx, vec2u(x,0),0).x;} +fn bisectx(size: u32,targetValue: f32)->f32 +{var a: u32=0;var b=size-1;while (b-a>1) {var c: u32=(a+b)>>1;if (fetchCDFx(c)f32 {return textureLoad(cdfy, vec2u(invocationId,y),0).x;} +fn bisecty(size: u32,targetValue: f32,invocationId: u32)->f32 +{var a: u32=0;var b=size-1;while (b-a>1) {var c=(a+b)>>1;if (fetchCDFy(c,invocationId)FragmentOutputs {var cdfxSize: vec2u=textureDimensions(cdfx,0);var cdfWidth: u32=cdfxSize.x;var icdfWidth: u32=cdfWidth-1;var currentPixel: vec2u= vec2u(fragmentInputs.position.xy);var outputColor: vec3f=vec3f(1.0);if (currentPixel.x==0) +{outputColor.x= 0.0;} +else if (currentPixel.x==icdfWidth-1) {outputColor.x= 1.0;} else {var targetValue: f32=fetchCDFx(cdfWidth-1)*input.vUV.x;outputColor.x= bisectx(cdfWidth,targetValue);} +var cdfySize: vec2u=textureDimensions(cdfy,0);var cdfHeight: u32=cdfySize.y;if (currentPixel.y==0) {outputColor.y= 0.0;} +else if (currentPixel.y==cdfHeight-2) {outputColor.y= 1.0;} else {var targetValue: f32=fetchCDFy(cdfHeight-1,currentPixel.x)*input.vUV.y;outputColor.y= max(bisecty(cdfHeight,targetValue,currentPixel.x),0.0);} +var size : vec2f=vec2f(textureDimensions(scaledLuminanceSampler,0));var highestMip: f32=floor(log2(size.x));var normalization : f32=textureSampleLevel(scaledLuminanceSampler, +scaledLuminanceSamplerSampler, +input.vUV,highestMip) +.r;var pixelLuminance: f32=fetchLuminance(input.vUV);outputColor.z=pixelLuminance/(2.0*PI*normalization);fragmentOutputs.color=vec4( outputColor,1.0);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=t);const u={name:e,shader:t};export{u as iblIcdfPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblScaledLuminance.fragment-CiVFEdcc.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblScaledLuminance.fragment-CiVFEdcc.js new file mode 100644 index 0000000000000000000000000000000000000000..4f94d96a6b17a4c11c66422145bcc76d771c6af1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblScaledLuminance.fragment-CiVFEdcc.js @@ -0,0 +1,15 @@ +import{S as r}from"./index-CDrXokXW.js";import"./helperFunctions-CZpZ-EbL.js";import"./index-DWyDLubb.js";const e="iblScaledLuminancePixelShader",i=`#include +#ifdef IBL_USE_CUBE_MAP +var iblSourceSampler: sampler;var iblSource: texture_cube; +#else +var iblSourceSampler: sampler;var iblSource: texture_2d; +#endif +uniform iblHeight: i32;uniform iblWidth: i32;fn fetchLuminance(coords: vec2f)->f32 { +#ifdef IBL_USE_CUBE_MAP +var direction: vec3f=equirectangularToCubemapDirection(coords);var color: vec3f=textureSampleLevel(iblSource,iblSourceSampler,direction,0.0).rgb; +#else +var color: vec3f=textureSampleLevel(iblSource,iblSourceSampler,coords,0.0).rgb; +#endif +return dot(color,LuminanceEncodeApprox);} +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var deform: f32=sin(input.vUV.y*PI);var luminance: f32=fetchLuminance(input.vUV);fragmentOutputs.color=vec4f(vec3f(deform*luminance),1.0);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=i);const a={name:e,shader:i};export{a as iblScaledLuminancePixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblScaledLuminance.fragment-fmUpCvMl.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblScaledLuminance.fragment-fmUpCvMl.js new file mode 100644 index 0000000000000000000000000000000000000000..7ff7c1ad1ca969a80d8557750b887cfd04798b21 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblScaledLuminance.fragment-fmUpCvMl.js @@ -0,0 +1,16 @@ +import{S as i}from"./index-CDrXokXW.js";import"./helperFunctions-BkWNqKeI.js";import"./index-DWyDLubb.js";const e="iblScaledLuminancePixelShader",o=`precision highp sampler2D;precision highp samplerCube; +#include +varying vec2 vUV; +#ifdef IBL_USE_CUBE_MAP +uniform samplerCube iblSource; +#else +uniform sampler2D iblSource; +#endif +uniform int iblWidth;uniform int iblHeight;float fetchLuminance(vec2 coords) { +#ifdef IBL_USE_CUBE_MAP +vec3 direction=equirectangularToCubemapDirection(coords);vec3 color=textureCubeLodEXT(iblSource,direction,0.0).rgb; +#else +vec3 color=textureLod(iblSource,coords,0.0).rgb; +#endif +return dot(color,LuminanceEncodeApprox);} +void main(void) {float deform=sin(vUV.y*PI);float luminance=fetchLuminance(vUV);gl_FragColor=vec4(vec3(deform*luminance),1.0);}`;i.ShadersStore[e]||(i.ShadersStore[e]=o);const l={name:e,shader:o};export{l as iblScaledLuminancePixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowAccumulation.fragment-0-oO9-J6.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowAccumulation.fragment-0-oO9-J6.js new file mode 100644 index 0000000000000000000000000000000000000000..d22cad23e5b25a9977d8cbd7e2cf5ba807ee5bf0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowAccumulation.fragment-0-oO9-J6.js @@ -0,0 +1,13 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblShadowAccumulationPixelShader",a=`varying vUV: vec2f;uniform accumulationParameters: vec4f; +#define remanence uniforms.accumulationParameters.x +#define resetb uniforms.accumulationParameters.y +#define sceneSize uniforms.accumulationParameters.z +var motionSampler: texture_2d;var positionSampler: texture_2d;var spatialBlurSampler : texture_2d;var oldAccumulationSamplerSampler: sampler;var oldAccumulationSampler: texture_2d;var prevPositionSamplerSampler: sampler;var prevPositionSampler: texture_2d;fn max2(v: vec2f,w: vec2f)->vec2f { +return vec2f(max(v.x,w.x),max(v.y,w.y)); } +fn lessThan(x: vec2f,y: vec2f)->vec2 {return xFragmentOutputs {var reset: bool= bool(resetb);var gbufferRes : vec2f=vec2f(textureDimensions(positionSampler,0));var gbufferPixelCoord: vec2i= vec2i(input.vUV*gbufferRes);var shadowRes : vec2f=vec2f(textureDimensions(spatialBlurSampler,0));var shadowPixelCoord: vec2i= vec2i(input.vUV*shadowRes);var LP: vec4f=textureLoad(positionSampler,gbufferPixelCoord,0);if (0.0==LP.w) {fragmentOutputs.color=vec4f(1.0,0.0,0.0,1.0);return fragmentOutputs;} +var velocityColor: vec2f=textureLoad(motionSampler,gbufferPixelCoord,0).xy;var prevCoord: vec2f=input.vUV+velocityColor;var PrevLP: vec3f=textureSampleLevel(prevPositionSampler,prevPositionSamplerSampler,prevCoord,0.0).xyz;var PrevShadows: vec4f=textureSampleLevel(oldAccumulationSampler,oldAccumulationSamplerSampler,prevCoord,0.0);var newShadows : vec3f=textureLoad(spatialBlurSampler,shadowPixelCoord,0).xyz;PrevShadows.a=select(1.0,max(PrevShadows.a/(1.0+PrevShadows.a),1.0-remanence),!reset && all(lessThan(abs(prevCoord- vec2f(0.5)), vec2f(0.5))) && +distance(LP.xyz,PrevLP)<5e-2*sceneSize);PrevShadows=max( vec4f(0.0),PrevShadows);fragmentOutputs.color= vec4f(mix(PrevShadows.x,newShadows.x,PrevShadows.a), +mix(PrevShadows.y,newShadows.y,PrevShadows.a), +mix(PrevShadows.z,newShadows.z,PrevShadows.a),PrevShadows.a);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=a);const v={name:e,shader:a};export{v as iblShadowAccumulationPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowAccumulation.fragment-BbtPAL11.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowAccumulation.fragment-BbtPAL11.js new file mode 100644 index 0000000000000000000000000000000000000000..f169c45b2ed7a95dea129f8c0bbaf70126b394b6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowAccumulation.fragment-BbtPAL11.js @@ -0,0 +1,17 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblShadowAccumulationPixelShader",o=`#ifdef GL_ES +precision mediump float; +#endif +varying vec2 vUV;uniform vec4 accumulationParameters; +#define remanence accumulationParameters.x +#define resetb accumulationParameters.y +#define sceneSize accumulationParameters.z +uniform sampler2D motionSampler;uniform sampler2D positionSampler;uniform sampler2D spatialBlurSampler;uniform sampler2D oldAccumulationSampler;uniform sampler2D prevPositionSampler;vec2 max2(vec2 v,vec2 w) { return vec2(max(v.x,w.x),max(v.y,w.y)); } +void main(void) {bool reset=bool(resetb);vec2 gbufferRes=vec2(textureSize(motionSampler,0));ivec2 gbufferPixelCoord=ivec2(vUV*gbufferRes);vec2 shadowRes=vec2(textureSize(spatialBlurSampler,0));ivec2 shadowPixelCoord=ivec2(vUV*shadowRes);vec4 LP=texelFetch(positionSampler,gbufferPixelCoord,0);if (0.0==LP.w) {gl_FragColor=vec4(1.0,0.0,0.0,1.0);return;} +vec2 velocityColor=texelFetch(motionSampler,gbufferPixelCoord,0).xy;vec2 prevCoord=vUV+velocityColor;vec3 PrevLP=texture(prevPositionSampler,prevCoord).xyz;vec4 PrevShadows=texture(oldAccumulationSampler,prevCoord);vec3 newShadows=texelFetch(spatialBlurSampler,shadowPixelCoord,0).xyz;PrevShadows.a = +!reset && all(lessThan(abs(prevCoord-vec2(0.5)),vec2(0.5))) && +distance(LP.xyz,PrevLP)<5e-2*sceneSize +? max(PrevShadows.a/(1.0+PrevShadows.a),1.0-remanence) +: 1.0;PrevShadows=max(vec4(0.0),PrevShadows);gl_FragColor = +vec4(mix(PrevShadows.x,newShadows.x,PrevShadows.a), +mix(PrevShadows.y,newShadows.y,PrevShadows.a), +mix(PrevShadows.z,newShadows.z,PrevShadows.a),PrevShadows.a);}`;r.ShadersStore[e]||(r.ShadersStore[e]=o);const l={name:e,shader:o};export{l as iblShadowAccumulationPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowDebug.fragment-BeBsfe0Y.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowDebug.fragment-BeBsfe0Y.js new file mode 100644 index 0000000000000000000000000000000000000000..d368cac137eca6e41dfb57655f4b285158eb16b9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowDebug.fragment-BeBsfe0Y.js @@ -0,0 +1,10 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblShadowDebugPixelShader",a=`#ifdef GL_ES +precision mediump float; +#endif +varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D debugSampler;uniform vec4 sizeParams; +#define offsetX sizeParams.x +#define offsetY sizeParams.y +#define widthScale sizeParams.z +#define heightScale sizeParams.w +void main(void) {vec2 uv = +vec2((offsetX+vUV.x)*widthScale,(offsetY+vUV.y)*heightScale);vec4 background=texture2D(textureSampler,vUV);vec4 debugColour=texture2D(debugSampler,vUV);if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {gl_FragColor.rgba=background;} else {gl_FragColor.rgb=mix(debugColour.rgb,background.rgb,0.0);gl_FragColor.a=1.0;}}`;r.ShadersStore[e]||(r.ShadersStore[e]=a);const d={name:e,shader:a};export{d as iblShadowDebugPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowDebug.fragment-BxACT9ho.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowDebug.fragment-BxACT9ho.js new file mode 100644 index 0000000000000000000000000000000000000000..a510c2733e809905ab2799687b03e2b4b9f27ec5 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowDebug.fragment-BxACT9ho.js @@ -0,0 +1,8 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblShadowDebugPixelShader",a=`varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;var debugSamplerSampler: sampler;var debugSampler: texture_2d;uniform sizeParams: vec4f; +#define offsetX uniforms.sizeParams.x +#define offsetY uniforms.sizeParams.y +#define widthScale uniforms.sizeParams.z +#define heightScale uniforms.sizeParams.w +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var uv: vec2f = +vec2f((offsetX+fragmentInputs.vUV.x)*widthScale,(offsetY+fragmentInputs.vUV.y)*heightScale);var background: vec4f=textureSample(textureSampler,textureSamplerSampler,fragmentInputs.vUV);var debugColour: vec4f=textureSample(debugSampler,debugSamplerSampler,fragmentInputs.vUV);if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {fragmentOutputs.color=background;} else {fragmentOutputs.color=vec4f(mix(debugColour.rgb,background.rgb,0.0),1.0);}}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=a);const m={name:e,shader:a};export{m as iblShadowDebugPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowGBufferDebug.fragment-CvaejVzX.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowGBufferDebug.fragment-CvaejVzX.js new file mode 100644 index 0000000000000000000000000000000000000000..61fb8b7fb43b7ad90ffd60e6606adfd6aae8a6b0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowGBufferDebug.fragment-CvaejVzX.js @@ -0,0 +1,9 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblShadowGBufferDebugPixelShader",a=`varying vUV : vec2f;var textureSamplerSampler : sampler;var textureSampler : texture_2d;var depthSamplerSampler : sampler;var depthSampler : texture_2d;var normalSamplerSampler : sampler;var normalSampler : texture_2d;var positionSamplerSampler : sampler;var positionSampler : texture_2d;var velocitySamplerSampler : sampler;var velocitySampler : texture_2d;uniform sizeParams : vec4f; +#define offsetX uniforms.sizeParams.x +#define offsetY uniforms.sizeParams.y +#define widthScale uniforms.sizeParams.z +#define heightScale uniforms.sizeParams.w +@fragment fn main(input : FragmentInputs)->FragmentOutputs {var uv : vec2f= +vec2f((offsetX+input.vUV.x)*widthScale,(offsetY+input.vUV.y)*heightScale);var backgroundColour: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV).rgba;var depth : vec4f=textureSample(depthSampler,depthSamplerSampler,input.vUV);var worldNormal: vec4f=textureSample(normalSampler,normalSamplerSampler,input.vUV);var worldPosition : vec4f=textureSample(positionSampler,positionSamplerSampler,input.vUV);var velocityLinear : vec4f=textureSample(velocitySampler,velocitySamplerSampler,input.vUV);if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {fragmentOutputs.color=backgroundColour;} else {if (uv.x<=0.25) {fragmentOutputs.color=vec4f(depth.rgb,1.0);} else if (uv.x<=0.5) {velocityLinear = +vec4f(velocityLinear.r*0.5+0.5,velocityLinear.g*0.5+0.5, +velocityLinear.b,velocityLinear.a);fragmentOutputs.color=vec4f(velocityLinear.rgb,1.0);} else if (uv.x<=0.75) {fragmentOutputs.color=vec4f(worldPosition.rgb,1.0);} else {fragmentOutputs.color=vec4f(worldNormal.rgb,1.0);}}}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=a);const o={name:e,shader:a};export{o as iblShadowGBufferDebugPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowGBufferDebug.fragment-DtTs5wjg.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowGBufferDebug.fragment-DtTs5wjg.js new file mode 100644 index 0000000000000000000000000000000000000000..8c9edd144f7a25cff728d6aef83fed957641110e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowGBufferDebug.fragment-DtTs5wjg.js @@ -0,0 +1,10 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblShadowGBufferDebugPixelShader",o=`#ifdef GL_ES +precision mediump float; +#endif +varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D depthSampler;uniform sampler2D normalSampler;uniform sampler2D positionSampler;uniform sampler2D velocitySampler;uniform vec4 sizeParams;uniform float maxDepth; +#define offsetX sizeParams.x +#define offsetY sizeParams.y +#define widthScale sizeParams.z +#define heightScale sizeParams.w +void main(void) {vec2 uv = +vec2((offsetX+vUV.x)*widthScale,(offsetY+vUV.y)*heightScale);vec4 backgroundColour=texture2D(textureSampler,vUV).rgba;vec4 depth=texture2D(depthSampler,vUV);vec4 worldNormal=texture2D(normalSampler,vUV);vec4 worldPosition=texture2D(positionSampler,vUV);vec4 velocityLinear=texture2D(velocitySampler,vUV);if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {gl_FragColor.rgba=backgroundColour;} else {gl_FragColor.a=1.0;if (uv.x<=0.25) {gl_FragColor.rgb=depth.rgb;gl_FragColor.a=1.0;} else if (uv.x<=0.5) {velocityLinear.rg=velocityLinear.rg*0.5+0.5;gl_FragColor.rgb=velocityLinear.rgb;} else if (uv.x<=0.75) {gl_FragColor.rgb=worldPosition.rgb;} else {gl_FragColor.rgb=worldNormal.rgb;}}}`;r.ShadersStore[e]||(r.ShadersStore[e]=o);const i={name:e,shader:o};export{i as iblShadowGBufferDebugPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowSpatialBlur.fragment-BnhcTAGS.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowSpatialBlur.fragment-BnhcTAGS.js new file mode 100644 index 0000000000000000000000000000000000000000..869c04721ff738e32ebbbee3c9d1ced29447e38e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowSpatialBlur.fragment-BnhcTAGS.js @@ -0,0 +1,13 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblShadowSpatialBlurPixelShader",o=`precision highp sampler2D; +#define PI 3.1415927 +varying vec2 vUV;uniform sampler2D depthSampler;uniform sampler2D worldNormalSampler;uniform sampler2D voxelTracingSampler;uniform vec4 blurParameters; +#define stridef blurParameters.x +#define worldScale blurParameters.y +const float weights[5]=float[5](0.0625,0.25,0.375,0.25,0.0625);const int nbWeights=5;vec2 max2(vec2 v,vec2 w) {return vec2(max(v.x,w.x),max(v.y,w.y));} +void main(void) +{vec2 gbufferRes=vec2(textureSize(depthSampler,0));ivec2 gbufferPixelCoord=ivec2(vUV*gbufferRes);vec2 shadowRes=vec2(textureSize(voxelTracingSampler,0));ivec2 shadowPixelCoord=ivec2(vUV*shadowRes);vec3 N=texelFetch(worldNormalSampler,gbufferPixelCoord,0).xyz;if (length(N)<0.01) {glFragColor=vec4(1.0,1.0,0.0,1.0);return;} +float depth=-texelFetch(depthSampler,gbufferPixelCoord,0).x;vec4 X=vec4(0.0);for(int y=0; y>1),y-(nbWeights>>1));ivec2 shadowCoords=shadowPixelCoord+int(stridef)*ivec2(x-(nbWeights>>1),y-(nbWeights>>1));vec4 T=texelFetch(voxelTracingSampler,shadowCoords,0);float ddepth=-texelFetch(depthSampler,gBufferCoords,0).x-depth;vec3 dN=texelFetch(worldNormalSampler,gBufferCoords,0).xyz-N;float w=weights[x]*weights[y] * +exp2(max(-1000.0/(worldScale*worldScale),-0.5) * +(ddepth*ddepth) - +1e1*dot(dN,dN));X+=vec4(w*T.x,w*T.y,w*T.z,w);}} +gl_FragColor=vec4(X.x/X.w,X.y/X.w,X.z/X.w,1.0);}`;r.ShadersStore[e]||(r.ShadersStore[e]=o);const i={name:e,shader:o};export{i as iblShadowSpatialBlurPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowSpatialBlur.fragment-Dsgsi0ka.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowSpatialBlur.fragment-Dsgsi0ka.js new file mode 100644 index 0000000000000000000000000000000000000000..226a14ac6be46d5fc14100741ca8ac8e453a9ccb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowSpatialBlur.fragment-Dsgsi0ka.js @@ -0,0 +1,12 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblShadowSpatialBlurPixelShader",a=`#define PI 3.1415927 +varying vUV: vec2f;var depthSampler: texture_2d;var worldNormalSampler: texture_2d;var voxelTracingSampler : texture_2d;uniform blurParameters: vec4f; +#define stridef uniforms.blurParameters.x +#define worldScale uniforms.blurParameters.y +const weights=array(0.0625,0.25,0.375,0.25,0.0625);const nbWeights: i32=5;fn max2(v: vec2f,w: vec2f)->vec2f {return vec2f(max(v.x,w.x),max(v.y,w.y));} +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var gbufferRes=vec2f(textureDimensions(depthSampler,0));var gbufferPixelCoord= vec2i(fragmentInputs.vUV*gbufferRes);var shadowRes=vec2f(textureDimensions(voxelTracingSampler,0));var shadowPixelCoord= vec2i(fragmentInputs.vUV*shadowRes);var N: vec3f=textureLoad(worldNormalSampler,gbufferPixelCoord,0).xyz;if (length(N)<0.01) {fragmentOutputs.color=vec4f(1.0,1.0,0.0,1.0);return fragmentOutputs;} +var depth: f32=-textureLoad(depthSampler,gbufferPixelCoord,0).x;var X: vec4f= vec4f(0.0);for(var y: i32=0; y>1),y-(nbWeights>>1));var shadowCoords: vec2i=shadowPixelCoord+i32(stridef)*vec2i(x-(nbWeights>>1),y-(nbWeights>>1));var T : vec3f=textureLoad(voxelTracingSampler,shadowCoords,0).xyz;var ddepth: f32=-textureLoad(depthSampler,gBufferCoords,0).x-depth;var dN: vec3f=textureLoad(worldNormalSampler,gBufferCoords,0).xyz-N;var w: f32=weights[x]*weights[y] * +exp2(max(-1000.0/(worldScale*worldScale),-0.5) * +(ddepth*ddepth) - +1e1*dot(dN,dN));X+= vec4f(w*T.x,w*T.y,w*T.z,w);}} +fragmentOutputs.color= vec4f(X.x/X.w,X.y/X.w,X.z/X.w,1.0);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=a);const f={name:e,shader:a};export{f as iblShadowSpatialBlurPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowVoxelTracing.fragment-DWhaeZt1.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowVoxelTracing.fragment-DWhaeZt1.js new file mode 100644 index 0000000000000000000000000000000000000000..eac7e6623baf648d8080f28e3f4b9736680d053f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowVoxelTracing.fragment-DWhaeZt1.js @@ -0,0 +1,185 @@ +import{S as a}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblShadowVoxelTracingPixelShader",r=`#define PI 3.1415927 +varying vUV: vec2f; +#define DISABLE_UNIFORMITY_ANALYSIS +var depthSampler: texture_2d;var worldNormalSampler : texture_2d;var blueNoiseSampler: texture_2d;var icdfSamplerSampler: sampler;var icdfSampler: texture_2d;var voxelGridSamplerSampler: sampler;var voxelGridSampler: texture_3d; +#ifdef COLOR_SHADOWS +var iblSamplerSampler: sampler;var iblSampler: texture_cube; +#endif +uniform shadowParameters: vec4f; +#define SHADOWdirs uniforms.shadowParameters.x +#define SHADOWframe uniforms.shadowParameters.y +#define SHADOWenvRot uniforms.shadowParameters.w +uniform voxelBiasParameters : vec4f; +#define highestMipLevel uniforms.voxelBiasParameters.z +uniform sssParameters: vec4f; +#define SSSsamples uniforms.sssParameters.x +#define SSSstride uniforms.sssParameters.y +#define SSSmaxDistance uniforms.sssParameters.z +#define SSSthickness uniforms.sssParameters.w +uniform shadowOpacity: vec4f;uniform projMtx: mat4x4f;uniform viewMtx: mat4x4f;uniform invProjMtx: mat4x4f;uniform invViewMtx: mat4x4f;uniform wsNormalizationMtx: mat4x4f;uniform invVPMtx: mat4x4f; +#define PI 3.1415927 +#define GOLD 0.618034 +struct AABB3f {m_min: vec3f, +m_max: vec3f,};struct Ray {orig: vec3f, +dir: vec3f, +dir_rcp: vec3f, +t_min: f32, +t_max: f32,};fn make_ray(origin: vec3f,direction: vec3f,tmin: f32, +tmax: f32)->Ray {var ray: Ray;ray.orig=origin;ray.dir=direction;ray.dir_rcp=1.0f/direction;ray.t_min=tmin;ray.t_max=tmax;return ray;} +fn ray_box_intersection(aabb: AABB3f,ray: Ray , +distance_near: ptr,distance_far: ptr)->bool{var tbot: vec3f=ray.dir_rcp*(aabb.m_min-ray.orig);var ttop: vec3f=ray.dir_rcp*(aabb.m_max-ray.orig);var tmin: vec3f=min(ttop,tbot);var tmax: vec3f=max(ttop,tbot);*distance_near=max(ray.t_min,max(tmin.x,max(tmin.y,tmin.z)));*distance_far=min(ray.t_max,min(tmax.x,min(tmax.y,tmax.z)));return *distance_near<=*distance_far;} +#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +struct VoxelMarchDiagnosticInfo {heat: f32, +voxel_intersect_coords: vec3i,}; +#endif +fn hash(i: u32)->u32 {var temp=i ^ (i>>16u);temp*=0x7FEB352Du;temp ^= temp>>15u;temp*=0x846CA68Bu;temp ^= temp>>16u;return temp;} +fn uintBitsToFloat(x: u32)->f32 {return bitcast(x);} +fn uint2float(i: u32)->f32 {return uintBitsToFloat(0x3F800000u | (i>>9u))-1.0;} +fn uv_to_normal(uv: vec2f)->vec3f {var N: vec3f;var uvRange: vec2f=uv;var theta: f32=uvRange.x*2.0*PI;var phi: f32=uvRange.y*PI;N.x=cos(theta)*sin(phi);N.z=sin(theta)*sin(phi);N.y=cos(phi);return N;} +fn plasticSequence(rstate: u32)->vec2f {return vec2f(uint2float(rstate*3242174889u), +uint2float(rstate*2447445414u));} +fn goldenSequence(rstate: u32)->f32 {return uint2float(rstate*2654435769u);} +fn distanceSquared(a: vec2f,b: vec2f)->f32 {var diff: vec2f=a-b;return dot(diff,diff);} +fn genTB(N: vec3f,T: ptr,B: ptr) {var s: f32=select(1.0,-1.0,N.z<0.0);var a: f32=-1.0/(s+N.z);var b: f32=N.x*N.y*a;*T= vec3f(1.0+s*N.x*N.x*a,s*b,-s*N.x);*B= vec3f(b,s+N.y*N.y*a,-N.y);} +fn lessThan(x: vec3f,y: vec3f)->vec3 {return x)->bool { +#else +fn anyHitVoxels(ray_vs: Ray)->bool { +#endif +var stack=array(); +var invD: vec3f=ray_vs.dir_rcp;var D: vec3f=ray_vs.dir;var O: vec3f=ray_vs.orig;var negD=vec3i(lessThan(D, vec3f(0,0,0)));var voxel0: i32=negD.x | (negD.y<<1) | (negD.z<<2);var t0: vec3f=-O*invD;var t1=(vec3f(1.0)-O)*invD;var maxLod: i32= i32(highestMipLevel);var stackLevel: i32=0; +#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +var steps: u32=0u; +#endif +stack[stackLevel]=maxLod<<24;stackLevel++;while (stackLevel>0) {stackLevel=stackLevel-1;var elem: i32=stack[stackLevel];var Coords: vec4i = +vec4i(elem & 0xFF,(elem>>8) & 0xFF,(elem>>16) & 0xFF,elem>>24);if (Coords.w==0) { +#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +*voxel_march_diagnostic_info.heat= f32(steps)/24.0; +#endif +return true;} +#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +++steps; +#endif +var invRes: f32=exp2(f32(Coords.w-maxLod));var bbmin: vec3f=invRes*vec3f(Coords.xyz+negD);var bbmax: vec3f=invRes*vec3f(Coords.xyz-negD+vec3i(1));var mint: vec3f=mix(t0,t1,bbmin);var maxt: vec3f=mix(t0,t1,bbmax);var midt: vec3f=0.5*(mint+maxt);mint.x=max(0.0,mint.x);midt.x=max(0.0,midt.x);var nodeMask: u32= u32( +round(textureLoad(voxelGridSampler,Coords.xyz,Coords.w).x*255.0));Coords.w--;var voxelBit: u32=u32(voxel0);Coords=vec4i((Coords.xyz<f32 {return (near*far)/(far-depth*(far-near));} +fn screenSpaceShadow(csOrigin: vec3f,csDirection: vec3f,csZBufferSize: vec2f, +nearPlaneZ: f32,farPlaneZ: f32,noise: f32)->f32 { +#ifdef RIGHT_HANDED +var csZDir : f32=-1.0; +#else +var csZDir : f32=1.0; +#endif +var ssSamples: f32=SSSsamples;var ssMaxDist: f32=SSSmaxDistance;var ssStride: f32=SSSstride;var ssThickness: f32=SSSthickness;var rayLength: f32 = +select(ssMaxDist,(nearPlaneZ-csOrigin.z)/csDirection.z, +csZDir*(csOrigin.z+ssMaxDist*csDirection.z)0.0 && stepCount)->f32 { +#else +fn voxelShadow(wsOrigin: vec3f,wsDirection: vec3f,wsNormal: vec3f, +DitherNoise: vec2f)->f32 { +#endif +var vxResolution: f32=f32(textureDimensions(voxelGridSampler,0).x);var T: vec3f;var B: vec3f;genTB(wsDirection,&T,&B);var DitherXY: vec2f=sqrt(DitherNoise.x)* vec2f(cos(2.0*PI*DitherNoise.y), +sin(2.0*PI*DitherNoise.y));var Dithering : vec3f=(uniforms.voxelBiasParameters.x*wsNormal + +uniforms.voxelBiasParameters.y*wsDirection + +DitherXY.x*T+DitherXY.y*B) / +vxResolution;var O: vec3f=0.5*wsOrigin+0.5+Dithering;var ray_vs=make_ray(O,wsDirection,0.0,10.0);var voxel_aabb: AABB3f;voxel_aabb.m_min=vec3f(0);voxel_aabb.m_max=vec3f(1);var near: f32=0;var far: f32=0;if (!ray_box_intersection(voxel_aabb,ray_vs,&near,&far)) {return 0.0;} +ray_vs.t_min=max(ray_vs.t_min,near);ray_vs.t_max=min(ray_vs.t_max,far); +#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +return select(0.0f,1.0f,anyHitVoxels(ray_vs,voxel_march_diagnostic_info)); +#else +return select(0.0f,1.0f,anyHitVoxels(ray_vs)); +#endif +} +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var nbDirs=u32(SHADOWdirs);var frameId=u32(SHADOWframe);var envRot: f32=SHADOWenvRot;var Resolution: vec2f= vec2f(textureDimensions(depthSampler,0));var currentPixel=vec2i(fragmentInputs.vUV*Resolution);var GlobalIndex = +(frameId*u32(Resolution.y)+u32(currentPixel.y))*u32(Resolution.x) + +u32(currentPixel.x);var N : vec3f=textureLoad(worldNormalSampler,currentPixel,0).xyz;if (length(N)<0.01) {fragmentOutputs.color=vec4f(1.0,1.0,0.0,1.0);return fragmentOutputs;} +var normalizedRotation: f32=envRot/(2.0*PI);var depth : f32=textureLoad(depthSampler,currentPixel,0).x; +#ifndef IS_NDC_HALF_ZRANGE +depth=depth*2.0-1.0; +#endif +var temp : vec2f=(vec2f(currentPixel)+vec2f(0.5))*2.0/Resolution - +vec2f(1.0);var VP : vec4f=uniforms.invProjMtx*vec4f(temp.x,-temp.y,depth,1.0);VP/=VP.w;N=normalize(N);var noise : vec3f=textureLoad(blueNoiseSampler,currentPixel & vec2i(0xFF),0).xyz;noise.z=fract(noise.z+goldenSequence(frameId*nbDirs)); +#ifdef VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +var heat: f32=0.0f; +#endif +var shadowAccum: f32=0.001;var specShadowAccum: f32=0.001;var sampleWeight : f32=0.001; +#ifdef COLOR_SHADOWS +var totalLight: vec3f=vec3f(0.001);var shadowedLight: vec3f=vec3f(0.0); +#endif +for (var i: u32=0; i0.0) {var VP2: vec4f=VP;VP2.y*=-1.0;var unormWP : vec4f=uniforms.invViewMtx*VP2;var WP: vec3f=(uniforms.wsNormalizationMtx*unormWP).xyz;var vxNoise: vec2f=vec2f(uint2float(hash(dirId*2)),uint2float(hash(dirId*2+1))); +#ifdef VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +VoxelMarchDiagnosticInfo voxel_march_diagnostic_info;opacity=max(opacity, +uniforms.shadowOpacity.x*voxelShadow(WP,L.xyz,N,vxNoise, +voxel_march_diagnostic_info));heat+=voxel_march_diagnostic_info.heat; +#else +opacity = +max(opacity,uniforms.shadowOpacity.x*voxelShadow(WP,L.xyz,N,vxNoise)); +#endif +var VL : vec3f=(uniforms.viewMtx*L).xyz; +#ifdef RIGHT_HANDED +var nearPlaneZ: f32=-2.0*uniforms.projMtx[3][2]/(uniforms.projMtx[2][2]-1.0); +var farPlaneZ: f32=-uniforms.projMtx[3][2]/(uniforms.projMtx[2][2]+1.0); +#else +var nearPlaneZ: f32=-2.0*uniforms.projMtx[3][2]/(uniforms.projMtx[2][2]+1.0); +var farPlaneZ: f32=-uniforms.projMtx[3][2]/(uniforms.projMtx[2][2]-1.0); +#endif +var ssShadow: f32=uniforms.shadowOpacity.y * +screenSpaceShadow(VP2.xyz,VL,Resolution,nearPlaneZ,farPlaneZ, +abs(2.0*noise.z-1.0));opacity=max(opacity,ssShadow); +#ifdef COLOR_SHADOWS +var light: vec3f=select(vec3f(0.0),vec3f(cosNL)/vec3f(pdf)*ibl,pdf>1e-6);shadowedLight+=light*opacity;totalLight+=light; +#else +var rcos: f32=1.0-cosNL;shadowAccum+=(1.0-opacity*(1.0-pow(rcos,8.0)));sampleWeight+=1.0;var VR : vec3f=abs((uniforms.viewMtx*vec4f(reflect(-L.xyz,N),0.0)).xyz);specShadowAccum+=max(1.0-(opacity*pow(VR.z,8.0)),0.0); +#endif +} +noise.z=fract(noise.z+GOLD);} +#ifdef COLOR_SHADOWS +var shadow: vec3f=(totalLight-shadowedLight)/totalLight;var maxShadow: f32=max(max(shadow.x,max(shadow.y,shadow.z)),1.0);fragmentOutputs.color=vec4f(shadow/maxShadow,1.0); +#else +#ifdef VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +fragmentOutputs.color = +vec4f(shadowAccum/sampleWeight,specShadowAccum/sampleWeight,heat/sampleWeight,1.0); +#else +fragmentOutputs.color=vec4f(shadowAccum/sampleWeight,specShadowAccum/sampleWeight,0.0,1.0); +#endif +#endif +}`;a.ShadersStoreWGSL[e]||(a.ShadersStoreWGSL[e]=r);const s={name:e,shader:r};export{s as iblShadowVoxelTracingPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowVoxelTracing.fragment-kIm7y2Wl.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowVoxelTracing.fragment-kIm7y2Wl.js new file mode 100644 index 0000000000000000000000000000000000000000..00b255bd2e98e4e6fe8c80327a5a816ba71c29ad --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowVoxelTracing.fragment-kIm7y2Wl.js @@ -0,0 +1,179 @@ +import{S as t}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblShadowVoxelTracingPixelShader",i=`precision highp sampler2D;precision highp sampler3D; +#define PI 3.1415927 +varying vec2 vUV; +#define DISABLE_UNIFORMITY_ANALYSIS +uniform sampler2D depthSampler;uniform sampler2D worldNormalSampler;uniform sampler2D blueNoiseSampler;uniform sampler2D icdfSampler;uniform sampler3D voxelGridSampler; +#ifdef COLOR_SHADOWS +uniform samplerCube iblSampler; +#endif +uniform vec4 shadowParameters; +#define SHADOWdirs shadowParameters.x +#define SHADOWframe shadowParameters.y +#define SHADOWenvRot shadowParameters.w +uniform vec4 voxelBiasParameters; +#define highestMipLevel voxelBiasParameters.z +uniform vec4 sssParameters; +#define SSSsamples sssParameters.x +#define SSSstride sssParameters.y +#define SSSmaxDistance sssParameters.z +#define SSSthickness sssParameters.w +uniform vec4 shadowOpacity;uniform mat4 projMtx;uniform mat4 viewMtx;uniform mat4 invProjMtx;uniform mat4 invViewMtx;uniform mat4 wsNormalizationMtx;uniform mat4 invVPMtx; +#define PI 3.1415927 +#define GOLD 0.618034 +struct AABB3f {vec3 m_min;vec3 m_max;};struct Ray {vec3 orig;vec3 dir;vec3 dir_rcp;float t_min;float t_max;};Ray make_ray(const vec3 origin,const vec3 direction,const float tmin, +const float tmax) {Ray ray;ray.orig=origin;ray.dir=direction;ray.dir_rcp=1.0f/direction;ray.t_min=tmin;ray.t_max=tmax;return ray;} +bool ray_box_intersection(const in AABB3f aabb,const in Ray ray, +out float distance_near,out float distance_far) {vec3 tbot=ray.dir_rcp*(aabb.m_min-ray.orig);vec3 ttop=ray.dir_rcp*(aabb.m_max-ray.orig);vec3 tmin=min(ttop,tbot);vec3 tmax=max(ttop,tbot);distance_near=max(ray.t_min,max(tmin.x,max(tmin.y,tmin.z)));distance_far=min(ray.t_max,min(tmax.x,min(tmax.y,tmax.z)));return distance_near<=distance_far;} +#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +struct VoxelMarchDiagnosticInfo {float heat;ivec3 voxel_intersect_coords;}; +#endif +uint hash(uint i) {i ^= i>>16u;i*=0x7FEB352Du;i ^= i>>15u;i*=0x846CA68Bu;i ^= i>>16u;return i;} +float uint2float(uint i) {return uintBitsToFloat(0x3F800000u | (i>>9u))-1.0;} +vec3 uv_to_normal(vec2 uv) {vec3 N;vec2 uvRange=uv;float theta=uvRange.x*2.0*PI;float phi=uvRange.y*PI;N.x=cos(theta)*sin(phi);N.z=sin(theta)*sin(phi);N.y=cos(phi);return N;} +vec2 plasticSequence(const uint rstate) {return vec2(uint2float(rstate*3242174889u), +uint2float(rstate*2447445414u));} +float goldenSequence(const uint rstate) {return uint2float(rstate*2654435769u);} +float distanceSquared(vec2 a,vec2 b) {vec2 diff=a-b;return dot(diff,diff);} +void genTB(const vec3 N,out vec3 T,out vec3 B) {float s=N.z<0.0 ? -1.0 : 1.0;float a=-1.0/(s+N.z);float b=N.x*N.y*a;T=vec3(1.0+s*N.x*N.x*a,s*b,-s*N.x);B=vec3(b,s+N.y*N.y*a,-N.y);} +int stack[24]; +#define PUSH(i) stack[stackLevel++]=i; +#define POP() stack[--stackLevel] +#ifdef VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +bool anyHitVoxels(const Ray ray_vs, +out VoxelMarchDiagnosticInfo voxel_march_diagnostic_info) { +#else +bool anyHitVoxels(const Ray ray_vs) { +#endif +vec3 invD=ray_vs.dir_rcp;vec3 D=ray_vs.dir;vec3 O=ray_vs.orig;ivec3 negD=ivec3(lessThan(D,vec3(0,0,0)));int voxel0=negD.x | negD.y<<1 | negD.z<<2;vec3 t0=-O*invD,t1=(vec3(1.0)-O)*invD;int maxLod=int(highestMipLevel);int stackLevel=0; +#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +uint steps=0u; +#endif +PUSH(maxLod<<24);while (stackLevel>0) {int elem=POP();ivec4 Coords = +ivec4(elem & 0xFF,elem>>8 & 0xFF,elem>>16 & 0xFF,elem>>24);if (Coords.w==0) { +#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +voxel_march_diagnostic_info.heat=float(steps)/24.0; +#endif +return true;} +#if VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +++steps; +#endif +float invRes=exp2(float(Coords.w-maxLod));vec3 bbmin=invRes*vec3(Coords.xyz+negD);vec3 bbmax=invRes*vec3(Coords.xyz-negD+ivec3(1));vec3 mint=mix(t0,t1,bbmin);vec3 maxt=mix(t0,t1,bbmax);vec3 midt=0.5*(mint+maxt);mint.x=max(0.0,mint.x);midt.x=max(0.0,midt.x);int nodeMask=int( +round(texelFetch(voxelGridSampler,Coords.xyz,Coords.w).x*255.0));Coords.w--;int voxelBit=voxel0;Coords.xyz=(Coords.xyz<<1)+negD;int packedCoords = +Coords.x | Coords.y<<8 | Coords.z<<16 | Coords.w<<24;if (max(mint.x,max(mint.y,mint.z))0.0 && stepCount0.0) {vec4 VP2=VP;VP2.y*=-1.0;vec4 unormWP=invViewMtx*VP2;vec3 WP=(wsNormalizationMtx*unormWP).xyz;vec2 vxNoise=vec2(uint2float(hash(dirId*2u)),uint2float(hash(dirId*2u+1u))); +#ifdef VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +VoxelMarchDiagnosticInfo voxel_march_diagnostic_info;opacity=max(opacity,shadowOpacity.x*voxelShadow(WP,L.xyz,N,vxNoise,voxel_march_diagnostic_info));heat+=voxel_march_diagnostic_info.heat; +#else +opacity = +max(opacity,shadowOpacity.x*voxelShadow(WP,L.xyz,N,vxNoise)); +#endif +vec3 VL=(viewMtx*L).xyz; +#ifdef RIGHT_HANDED +float nearPlaneZ=-projMtx[3][2]/(projMtx[2][2]-1.0); +float farPlaneZ=-projMtx[3][2]/(projMtx[2][2]+1.0); +#else +float nearPlaneZ=-projMtx[3][2]/(projMtx[2][2]+1.0); +float farPlaneZ=-projMtx[3][2]/(projMtx[2][2]-1.0); +#endif +float ssShadow=shadowOpacity.y * +screenSpaceShadow(VP2.xyz,VL,Resolution,nearPlaneZ,farPlaneZ, +abs(2.0*noise.z-1.0));opacity=max(opacity,ssShadow); +#ifdef COLOR_SHADOWS +vec3 light=pdf<1e-6 ? vec3(0.0) : vec3(cosNL)/vec3(pdf)*ibl;shadowedLight+=light*opacity;totalLight+=light; +#else +float rcos=(1.0-cosNL);shadowAccum+=(1.0-opacity*(1.0-pow(rcos,8.0)));sampleWeight+=1.0;vec3 VR=-(viewMtx*vec4(reflect(-L.xyz,N),0.0)).xyz;specShadowAccum+=max(1.0-(opacity*pow(VR.z,8.0)),0.0); +#endif +} +noise.z=fract(noise.z+GOLD);} +#ifdef COLOR_SHADOWS +vec3 shadow=(totalLight-shadowedLight)/totalLight;float maxShadow=max(max(shadow.x,max(shadow.y,shadow.z)),1.0);glFragColor=vec4(shadow/maxShadow,1.0); +#else +#ifdef VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION +gl_FragColor=vec4(shadowAccum/float(sampleWeight), +specShadowAccum/float(sampleWeight),heat/float(sampleWeight),1.0); +#else +gl_FragColor=vec4(shadowAccum/float(sampleWeight),specShadowAccum/float(sampleWeight),0.0,1.0); +#endif +#endif +}`;t.ShadersStore[e]||(t.ShadersStore[e]=i);const r={name:e,shader:i};export{r as iblShadowVoxelTracingPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowsRenderPipeline-CSk08uxh.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowsRenderPipeline-CSk08uxh.js new file mode 100644 index 0000000000000000000000000000000000000000..f2687568811d345c61d081bfe1e79951a5b94f48 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblShadowsRenderPipeline-CSk08uxh.js @@ -0,0 +1,136 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./iblVoxelGrid3dDebug.fragment-CCz_tkfs.js","./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./iblVoxelGrid3dDebug.fragment-BoAA6lER.js","./copyTexture3DLayerToTexture.fragment-DxeV79_A.js","./copyTexture3DLayerToTexture.fragment-BfY84z9v.js","./iblCombineVoxelGrids.fragment-cuD4UWMh.js","./iblCombineVoxelGrids.fragment-DiVmxDjn.js","./iblGenerateVoxelMip.fragment-CR7D6yLc.js","./iblGenerateVoxelMip.fragment-DNulI4J8.js","./iblVoxelGrid.fragment-Bq4jiRxe.js","./iblVoxelGrid.vertex-BFI2c6vV.js","./morphTargetsVertexDeclaration-BsT9JpOT.js","./bonesVertex-bl6LLSA1.js","./bakedVertexAnimation-DoavwM49.js","./iblVoxelGrid.fragment-BQ18phoi.js","./iblVoxelGrid.vertex-DIsF2hrc.js","./bakedVertexAnimation-BwUJBnNt.js","./instancesDeclaration-BAnfKLCo.js","./morphTargetsVertex-7Q90Wwr8.js","./iblVoxelSlabDebug.fragment-Bi2hd5wl.js","./iblVoxelSlabDebug.vertex-QoyC3MA9.js","./iblVoxelSlabDebug.fragment-_B5tZCzK.js","./iblVoxelSlabDebug.vertex-BbpTawJd.js","./iblShadowDebug.fragment-BxACT9ho.js","./iblShadowDebug.fragment-BeBsfe0Y.js","./iblShadowVoxelTracing.fragment-DWhaeZt1.js","./iblShadowVoxelTracing.fragment-kIm7y2Wl.js","./iblShadowSpatialBlur.fragment-Dsgsi0ka.js","./iblShadowSpatialBlur.fragment-BnhcTAGS.js","./iblShadowAccumulation.fragment-0-oO9-J6.js","./iblShadowAccumulation.fragment-BbtPAL11.js","./pass.fragment-CTt6kMR9.js","./pass.fragment-DOtTp0aB.js","./iblShadowGBufferDebug.fragment-CvaejVzX.js","./iblShadowGBufferDebug.fragment-DtTs5wjg.js"])))=>i.map(i=>d[i]); +import{af as o}from"./index-DWyDLubb.js";import{aL as p,aA as w,b9 as B,O as R,M as b,ai as f,L as _,aD as L,aE as N,T as x,bz as F,bn as D,V as g,bC as U,bD as y,ac as H,_ as V,s as C,ae as X,R as Y,aq as k,ao as I,d as Z}from"./index-CDrXokXW.js";import{ShaderMaterial as A}from"./shaderMaterial-yE1litoM.js";import{P}from"./iblCdfGenerator-BLPdciVw.js";import{G as d}from"./geometryBufferRenderer-GNaIIBSt.js";import{P as j,a as q}from"./postProcessRenderEffect-Bq4hKPLg.js";import{R as Q}from"./rawTexture-DYLCXHMF.js";import{OpenPBRMaterial as M}from"./openpbrMaterial-527Jzq5y.js";import{S as J}from"./standardMaterial-C4-ZPPCc.js";import"./geometryBufferRendererSceneComponent-BF80mcVG.js";import"./iblCdfGeneratorSceneComponent-Buukicac.js";import"./clipPlaneFragment-T8W7CIC5.js";import"./bumpFragment-CNMCo4HD.js";import"./helperFunctions-BkWNqKeI.js";import"./bakedVertexAnimation-BwUJBnNt.js";import"./morphTargetsVertex-7Q90Wwr8.js";import"./instancesDeclaration-BAnfKLCo.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./clipPlaneVertex-Bmw4TNCQ.js";import"./bumpVertex-B5e3s1jQ.js";class K{getVoxelGrid(){return this._engine.isWebGPU?this._voxelGrid:this._triPlanarVoxelization?this._combinedVoxelGridPT:this._voxelGridZaxis}getDebugPassPP(){return this._voxelDebugPass||this._createDebugPass(),this._voxelDebugPass}get triPlanarVoxelization(){return this._triPlanarVoxelization}set triPlanarVoxelization(e){if(this._engine.isWebGPU){this._triPlanarVoxelization=!0;return}this._triPlanarVoxelization!==e&&(this._triPlanarVoxelization=e,this._disposeVoxelTextures(),this._createTextures())}setWorldScaleMatrix(e){this._invWorldScaleMatrix=e}isVoxelizationInProgress(){return this._voxelizationInProgress}get voxelResolutionExp(){return this._voxelResolutionExp}set voxelResolutionExp(e){this._voxelResolutionExp===e&&this._voxelGridZaxis||(this._voxelResolutionExp=Math.round(Math.min(Math.max(e,3),9)),this._voxelResolution=Math.pow(2,this._voxelResolutionExp),this._disposeVoxelTextures(),this._createTextures())}set voxelDebugAxis(e){this._voxelDebugAxis=e}get voxelDebugAxis(){return this._voxelDebugAxis}setDebugDisplayParams(e,t,s,i){this._debugSizeParams.set(e,t,s,i)}setDebugMipNumber(e){this._debugMipNumber=e}get debugPassName(){return this._debugPassName}get voxelDebugEnabled(){return this._voxelDebugEnabled}set voxelDebugEnabled(e){this._voxelDebugEnabled!==e&&(this._voxelDebugEnabled=e,e&&(this._voxelSlabDebugRT=new p("voxelSlabDebug",{width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight()},this._scene,{generateDepthBuffer:!0,generateMipMaps:!1,type:0,format:5,samplingMode:1}),this._voxelSlabDebugRT.noPrePassRenderer=!0),this._voxelSlabDebugRT&&this._removeVoxelRTs([this._voxelSlabDebugRT]),this._voxelDebugEnabled?(this._addRTsForRender([this._voxelSlabDebugRT],this._includedMeshes,this._voxelDebugAxis,1,!0),this._setDebugBindingsBound=this._setDebugBindings.bind(this),this._scene.onBeforeRenderObservable.add(this._setDebugBindingsBound)):this._scene.onBeforeRenderObservable.removeCallback(this._setDebugBindingsBound))}_createDebugPass(){const e=this._engine.isWebGPU;if(!this._voxelDebugPass){const t={width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight(),textureFormat:5,textureType:0,samplingMode:1,uniforms:["sizeParams","mipNumber"],samplers:["voxelTexture","voxelSlabTexture"],engine:this._engine,reusable:!1,shaderLanguage:e?1:0,extraInitializations:(s,i)=>{s?i.push(o(()=>import("./iblVoxelGrid3dDebug.fragment-CCz_tkfs.js"),__vite__mapDeps([0,1,2,3]),import.meta.url)):i.push(o(()=>import("./iblVoxelGrid3dDebug.fragment-BoAA6lER.js"),__vite__mapDeps([4,1,2,3]),import.meta.url))}};this._voxelDebugPass=new w(this.debugPassName,"iblVoxelGrid3dDebug",t),this._voxelDebugPass.onApplyObservable.add(s=>{this._voxelDebugAxis===0?s.setTexture("voxelTexture",this._voxelGridXaxis):this._voxelDebugAxis===1?s.setTexture("voxelTexture",this._voxelGridYaxis):this._voxelDebugAxis===2?s.setTexture("voxelTexture",this._voxelGridZaxis):s.setTexture("voxelTexture",this.getVoxelGrid()),s.setTexture("voxelSlabTexture",this._voxelSlabDebugRT),s.setVector4("sizeParams",this._debugSizeParams),s.setFloat("mipNumber",this._debugMipNumber)})}}constructor(e,t,s=6,i=!0){this._voxelMrtsXaxis=[],this._voxelMrtsYaxis=[],this._voxelMrtsZaxis=[],this._voxelClearColor=new B(0,0,0,1),this.onVoxelizationCompleteObservable=new R,this._renderTargets=[],this._triPlanarVoxelization=!0,this._voxelizationInProgress=!1,this._invWorldScaleMatrix=b.Identity(),this._voxelResolution=64,this._voxelResolutionExp=6,this._mipArray=[],this._voxelDebugEnabled=!1,this._voxelDebugAxis=-1,this._debugSizeParams=new f(0,0,0,0),this._includedMeshes=[],this._debugMipNumber=0,this._debugPassName="Voxelization Debug Pass",this._scene=e,this._engine=e.getEngine(),this._triPlanarVoxelization=this._engine.isWebGPU||i,this._engine.getCaps().drawBuffersExtension||_.Error("Can't do voxel rendering without the draw buffers extension.");const n=this._engine.isWebGPU;this._maxDrawBuffers=this._engine.getCaps().maxDrawBuffers||0,this._copyMipEffectRenderer=new L(this._engine),this._copyMipEffectWrapper=new N({engine:this._engine,fragmentShader:"copyTexture3DLayerToTexture",useShaderStore:!0,uniformNames:["layerNum"],samplerNames:["textureSampler"],shaderLanguage:n?1:0,extraInitializationsAsync:async()=>{n?await o(()=>import("./copyTexture3DLayerToTexture.fragment-DxeV79_A.js"),__vite__mapDeps([5,1,2,3]),import.meta.url):await o(()=>import("./copyTexture3DLayerToTexture.fragment-BfY84z9v.js"),__vite__mapDeps([6,1,2,3]),import.meta.url)}}),this.voxelResolutionExp=s}_generateMipMaps(){const e=Math.ceil(Math.log2(this._voxelResolution));for(let t=1;t{e?await o(()=>import("./iblCombineVoxelGrids.fragment-cuD4UWMh.js"),__vite__mapDeps([7,1,2,3]),import.meta.url):await o(()=>import("./iblCombineVoxelGrids.fragment-DiVmxDjn.js"),__vite__mapDeps([8,1,2,3]),import.meta.url)}};this._engine.isWebGPU?(this._voxelGrid=new p("voxelGrid",t,this._scene,{...n,format:5,creationFlags:1}),this._voxelGridRT=new p("voxelGridRT",{width:Math.min(t.width*2,2048),height:Math.min(t.height*2,2048)},this._scene,s)):this._triPlanarVoxelization?(this._voxelGridXaxis=new p("voxelGridXaxis",t,this._scene,s),this._voxelGridYaxis=new p("voxelGridYaxis",t,this._scene,s),this._voxelGridZaxis=new p("voxelGridZaxis",t,this._scene,s),this._voxelMrtsXaxis=this._createVoxelMRTs("x_axis_",this._voxelGridXaxis,i),this._voxelMrtsYaxis=this._createVoxelMRTs("y_axis_",this._voxelGridYaxis,i),this._voxelMrtsZaxis=this._createVoxelMRTs("z_axis_",this._voxelGridZaxis,i),this._combinedVoxelGridPT=new P("combinedVoxelGrid",t,"iblCombineVoxelGrids",this._scene,n,!1),this._scene.proceduralTextures.splice(this._scene.proceduralTextures.indexOf(this._combinedVoxelGridPT),1),this._combinedVoxelGridPT.setFloat("layer",0),this._combinedVoxelGridPT.setTexture("voxelXaxisSampler",this._voxelGridXaxis),this._combinedVoxelGridPT.setTexture("voxelYaxisSampler",this._voxelGridYaxis),this._combinedVoxelGridPT.setTexture("voxelZaxisSampler",this._voxelGridZaxis),this._combinedVoxelGridPT.autoClear=!1,this._combinedVoxelGridPT.wrapU=x.CLAMP_ADDRESSMODE,this._combinedVoxelGridPT.wrapV=x.CLAMP_ADDRESSMODE):(this._voxelGridZaxis=new p("voxelGridZaxis",t,this._scene,n),this._voxelMrtsZaxis=this._createVoxelMRTs("z_axis_",this._voxelGridZaxis,i));const a={generateDepthBuffer:!1,generateMipMaps:!1,type:0,format:6,samplingMode:1,shaderLanguage:e?1:0,extraInitializationsAsync:async()=>{e?await o(()=>import("./iblGenerateVoxelMip.fragment-CR7D6yLc.js"),__vite__mapDeps([9,1,2,3]),import.meta.url):await o(()=>import("./iblGenerateVoxelMip.fragment-DNulI4J8.js"),__vite__mapDeps([10,1,2,3]),import.meta.url)}};this._mipArray=new Array(Math.ceil(Math.log2(this._voxelResolution)));for(let r=1;r<=this._mipArray.length;r++){const l=this._voxelResolution>>r,h={width:l,height:l,depth:l};this._mipArray[r-1]=new P("voxelMip"+r,h,"iblGenerateVoxelMip",this._scene,a,!1),this._scene.proceduralTextures.splice(this._scene.proceduralTextures.indexOf(this._mipArray[r-1]),1);const u=this._mipArray[r-1];u.autoClear=!1,u.wrapU=x.CLAMP_ADDRESSMODE,u.wrapV=x.CLAMP_ADDRESSMODE,u.setTexture("srcMip",r>1?this._mipArray[r-2]:this.getVoxelGrid()),u.setInt("layerNum",0)}this._createVoxelMaterials()}_createVoxelMRTs(e,t,s){t.wrapU=x.CLAMP_ADDRESSMODE,t.wrapV=x.CLAMP_ADDRESSMODE,t.noPrePassRenderer=!0;const i=[],n=new Array(this._maxDrawBuffers).fill(32879);for(let a=0;aa*this._maxDrawBuffers+m);let l=new Array(this._maxDrawBuffers).fill("");l=l.map((u,m)=>"voxel_grid_"+e+(a*this._maxDrawBuffers+m));const h=new F("mrt_"+e+a,{width:this._voxelResolution,height:this._voxelResolution,depth:this._voxelResolution},this._maxDrawBuffers,this._scene,{types:new Array(this._maxDrawBuffers).fill(0),samplingModes:new Array(this._maxDrawBuffers).fill(3),generateMipMaps:!1,targetTypes:n,formats:new Array(this._maxDrawBuffers).fill(6),faceIndex:new Array(this._maxDrawBuffers).fill(0),layerIndex:r,layerCounts:new Array(this._maxDrawBuffers).fill(this._voxelResolution),generateDepthBuffer:!1,generateStencilBuffer:!1},l);h.clearColor=new B(0,0,0,1),h.noPrePassRenderer=!0;for(let u=0;u{e?await Promise.all([o(()=>import("./iblVoxelGrid.fragment-Bq4jiRxe.js"),__vite__mapDeps([11,1,2,3]),import.meta.url),o(()=>import("./iblVoxelGrid.vertex-BFI2c6vV.js"),__vite__mapDeps([12,1,2,3,13,14,15]),import.meta.url)]):await Promise.all([o(()=>import("./iblVoxelGrid.fragment-BQ18phoi.js"),__vite__mapDeps([16,1,2,3]),import.meta.url),o(()=>import("./iblVoxelGrid.vertex-DIsF2hrc.js"),__vite__mapDeps([17,1,2,3,18,19,20]),import.meta.url)])}}),this._voxelMaterial.cullBackFaces=!1,this._voxelMaterial.backFaceCulling=!1,this._voxelMaterial.depthFunction=D.ALWAYS,this._voxelSlabDebugMaterial=new A("voxelSlabDebug",this._scene,"iblVoxelSlabDebug",{uniforms:["world","viewMatrix","cameraViewMatrix","projection","invWorldScale","nearPlane","farPlane","stepSize"],defines:["MAX_DRAW_BUFFERS "+this._maxDrawBuffers],shaderLanguage:e?1:0,extraInitializationsAsync:async()=>{e?await Promise.all([o(()=>import("./iblVoxelSlabDebug.fragment-Bi2hd5wl.js"),__vite__mapDeps([21,1,2,3]),import.meta.url),o(()=>import("./iblVoxelSlabDebug.vertex-QoyC3MA9.js"),__vite__mapDeps([22,1,2,3]),import.meta.url)]):await Promise.all([o(()=>import("./iblVoxelSlabDebug.fragment-_B5tZCzK.js"),__vite__mapDeps([23,1,2,3]),import.meta.url),o(()=>import("./iblVoxelSlabDebug.vertex-BbpTawJd.js"),__vite__mapDeps([24,1,2,3]),import.meta.url)])}})}_setDebugBindings(){this._voxelSlabDebugMaterial.setMatrix("projection",this._scene.activeCamera.getProjectionMatrix()),this._voxelSlabDebugMaterial.setMatrix("cameraViewMatrix",this._scene.activeCamera.getViewMatrix())}isReady(){let e=this.getVoxelGrid().isReady();for(let t=0;ts===e[0]);if(t>=0)this._renderTargets.splice(t,e.length);else{const s=this._scene.customRenderTargets.findIndex(i=>i===e[0]);s>=0&&this._scene.customRenderTargets.splice(s,e.length)}}updateVoxelGrid(e){this._voxelizationInProgress||(this._stopVoxelization(),this._includedMeshes=e,this._voxelizationInProgress=!0,this._engine.isWebGPU?(this._voxelGridRT.renderList=e,this._addRTsForRender([this._voxelGridRT],e,0)):this._triPlanarVoxelization?(this._addRTsForRender(this._voxelMrtsXaxis,e,0),this._addRTsForRender(this._voxelMrtsYaxis,e,1),this._addRTsForRender(this._voxelMrtsZaxis,e,2)):this._addRTsForRender(this._voxelMrtsZaxis,e,2),this._voxelDebugEnabled&&this._addRTsForRender([this._voxelSlabDebugRT],e,this._voxelDebugAxis,1,!0),this._renderVoxelGridBound=this._renderVoxelGrid.bind(this),this._scene.onAfterRenderObservable.add(this._renderVoxelGridBound))}_renderVoxelGrid(){if(this._voxelizationInProgress){let e=this.getVoxelGrid().isReady();for(let t=0;t{this._copyMipMaps(),this._scene.onAfterRenderObservable.removeCallback(this._renderVoxelGridBound),this._voxelizationInProgress=!1,this.onVoxelizationCompleteObservable.notifyObservers()})}}}_addRTsForRender(e,t,s,i=0,n=!1){const a=1/this._computeNumberOfSlabs();let r;i===0?r=this._voxelMaterial:r=this._voxelSlabDebugMaterial;for(let l=0;l{r.setMatrix("viewMatrix",b.LookAtLH(z,E,O)),r.setMatrix("invWorldScale",this._invWorldScaleMatrix),r.setFloat("nearPlane",u),r.setFloat("farPlane",m),r.setFloat("stepSize",G),this._engine.isWebGPU&&(this._voxelMaterial.useVertexPulling=!0,this._voxelMaterial.setTexture("voxel_storage",this.getVoxelGrid()))}),t.length===0)return;for(const v of t)if(v){v.subMeshes&&v.subMeshes.length>0&&(h.renderList?.push(v),h.setMaterialForRendering(v,r));const W=v.getChildMeshes();for(const S of W)S.subMeshes&&S.subMeshes.length>0&&(h.renderList?.push(S),h.setMaterialForRendering(S,r))}}if(n)for(const l of e)this._scene.customRenderTargets.indexOf(l)===-1&&this._scene.customRenderTargets.push(l);else this._renderTargets=this._renderTargets.concat(e)}resize(){this._voxelSlabDebugRT?.resize({width:this._scene.getEngine().getRenderWidth(),height:this._scene.getEngine().getRenderHeight()})}dispose(){this._disposeVoxelTextures(),this._voxelSlabDebugRT&&(this._removeVoxelRTs([this._voxelSlabDebugRT]),this._voxelSlabDebugRT.dispose()),this._voxelDebugPass&&this._voxelDebugPass.dispose()}}class ${get voxelShadowOpacity(){return this._voxelShadowOpacity}set voxelShadowOpacity(e){this._voxelShadowOpacity=e}get ssShadowOpacity(){return this._ssShadowOpacity}set ssShadowOpacity(e){this._ssShadowOpacity=e}get sssSamples(){return this._sssSamples}set sssSamples(e){this._sssSamples=e}get sssStride(){return this._sssStride}set sssStride(e){this._sssStride=e}get sssMaxDist(){return this._sssMaxDist}set sssMaxDist(e){this._sssMaxDist=e}get sssThickness(){return this._sssThickness}set sssThickness(e){this._sssThickness=e}get voxelNormalBias(){return this._voxelNormalBias}set voxelNormalBias(e){this._voxelNormalBias=e}get voxelDirectionBias(){return this._voxelDirectionBias}set voxelDirectionBias(e){this._voxelDirectionBias=e}get sampleDirections(){return this._sampleDirections}set sampleDirections(e){this._sampleDirections=e}get envRotation(){return this._envRotation}set envRotation(e){this._envRotation=e}getOutputTexture(){return this._outputTexture}getDebugPassPP(){return this._debugPassPP||this._createDebugPass(),this._debugPassPP}get debugPassName(){return this._debugPassName}setWorldScaleMatrix(e){this._invWorldScaleMatrix=e}set coloredShadows(e){this._coloredShadows=e}get coloredShadows(){return this._coloredShadows}setDebugDisplayParams(e,t,s,i){this._debugSizeParams.set(e,t,s,i)}_createDebugPass(){const e=this._engine.isWebGPU;if(!this._debugPassPP){const t={width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight(),uniforms:["sizeParams"],samplers:["debugSampler"],engine:this._engine,reusable:!0,shaderLanguage:e?1:0,extraInitializations:(s,i)=>{s?i.push(o(()=>import("./iblShadowDebug.fragment-BxACT9ho.js"),__vite__mapDeps([25,1,2,3]),import.meta.url)):i.push(o(()=>import("./iblShadowDebug.fragment-BeBsfe0Y.js"),__vite__mapDeps([26,1,2,3]),import.meta.url))}};this._debugPassPP=new w(this.debugPassName,"iblShadowDebug",t),this._debugPassPP.autoClear=!1,this._debugPassPP.onApplyObservable.add(s=>{s.setTexture("debugSampler",this._outputTexture),s.setVector4("sizeParams",this._debugSizeParams)})}}constructor(e,t){this._voxelShadowOpacity=1,this._sssSamples=16,this._sssStride=8,this._sssMaxDist=.05,this._sssThickness=.5,this._ssShadowOpacity=1,this._cameraInvView=b.Identity(),this._cameraInvProj=b.Identity(),this._invWorldScaleMatrix=b.Identity(),this._frameId=0,this._sampleDirections=4,this._shadowParameters=new f(0,0,0,0),this._sssParameters=new f(0,0,0,0),this._opacityParameters=new f(0,0,0,0),this._voxelBiasParameters=new f(0,0,0,0),this._voxelNormalBias=1.4,this._voxelDirectionBias=1.75,this.enabled=!0,this.debugEnabled=!1,this._debugPassName="Voxel Tracing Debug Pass",this._envRotation=0,this._coloredShadows=!1,this._debugVoxelMarchEnabled=!1,this._debugSizeParams=new f(0,0,0,0),this._renderWhenGBufferReady=null,this._scene=e,this._engine=e.getEngine(),this._renderPipeline=t,this._createTextures()}_createTextures(){const e=this._createDefines(),t=this._engine.isWebGPU,s={type:0,format:5,samplingMode:1,generateDepthBuffer:!1,shaderLanguage:t?1:0,extraInitializationsAsync:async()=>{t?await Promise.all([o(()=>import("./iblShadowVoxelTracing.fragment-DWhaeZt1.js"),__vite__mapDeps([27,1,2,3]),import.meta.url)]):await Promise.all([o(()=>import("./iblShadowVoxelTracing.fragment-kIm7y2Wl.js"),__vite__mapDeps([28,1,2,3]),import.meta.url)])}};this._outputTexture=new P("voxelTracingPass",{width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight()},"iblShadowVoxelTracing",this._scene,s),this._outputTexture.refreshRate=-1,this._outputTexture.autoClear=!1,this._outputTexture.defines=e,this._setBindings(this._scene.activeCamera),this._renderWhenGBufferReady=this._render.bind(this),this._renderPipeline.onVoxelizationCompleteObservable.addOnce(()=>{this._scene.geometryBufferRenderer.getGBuffer().onAfterRenderObservable.add(this._renderWhenGBufferReady)})}_createDefines(){let e="";return this._scene.useRightHandedSystem&&(e+=`#define RIGHT_HANDED +`),this._debugVoxelMarchEnabled&&(e+=`#define VOXEL_MARCH_DIAGNOSTIC_INFO_OPTION 1u +`),this._coloredShadows&&(e+=`#define COLOR_SHADOWS 1u +`),e}_setBindings(e){this._outputTexture.defines=this._createDefines(),this._outputTexture.setMatrix("viewMtx",e.getViewMatrix()),this._outputTexture.setMatrix("projMtx",e.getProjectionMatrix()),e.getProjectionMatrix().invertToRef(this._cameraInvProj),e.getViewMatrix().invertToRef(this._cameraInvView),this._outputTexture.setMatrix("invProjMtx",this._cameraInvProj),this._outputTexture.setMatrix("invViewMtx",this._cameraInvView),this._outputTexture.setMatrix("wsNormalizationMtx",this._invWorldScaleMatrix),this._frameId++;let t=0;this._scene.environmentTexture&&(t=this._scene.environmentTexture.rotationY??0),t=this._scene.useRightHandedSystem?-(t+.5*Math.PI):t-.5*Math.PI,t=t%(2*Math.PI),this._shadowParameters.set(this._sampleDirections,this._frameId,1,t),this._outputTexture.setVector4("shadowParameters",this._shadowParameters);const s=this._renderPipeline._getVoxelGridTexture(),i=Math.floor(Math.log2(s.getSize().width));this._voxelBiasParameters.set(this._voxelNormalBias,this._voxelDirectionBias,i,0),this._outputTexture.setVector4("voxelBiasParameters",this._voxelBiasParameters),this._sssParameters.set(this._sssSamples,this._sssStride,this._sssMaxDist,this._sssThickness),this._outputTexture.setVector4("sssParameters",this._sssParameters),this._opacityParameters.set(this._voxelShadowOpacity,this._ssShadowOpacity,0,0),this._outputTexture.setVector4("shadowOpacity",this._opacityParameters),this._outputTexture.setTexture("voxelGridSampler",s),this._outputTexture.setTexture("blueNoiseSampler",this._renderPipeline._getNoiseTexture());const n=this._scene.iblCdfGenerator;if(!n)return _.Warn("IBLShadowsVoxelTracingPass: Can't bind for render because iblCdfGenerator is not enabled."),!1;this._outputTexture.setTexture("icdfSampler",n.getIcdfTexture()),this._coloredShadows&&this._scene.environmentTexture&&this._outputTexture.setTexture("iblSampler",this._scene.environmentTexture);const a=this._scene.geometryBufferRenderer;if(!a)return _.Warn("IBLShadowsVoxelTracingPass: Can't bind for render because GeometryBufferRenderer is not enabled."),!1;const r=a.getTextureIndex(d.SCREENSPACE_DEPTH_TEXTURE_TYPE);this._outputTexture.setTexture("depthSampler",a.getGBuffer().textures[r]);const l=a.getTextureIndex(d.NORMAL_TEXTURE_TYPE);return this._outputTexture.setTexture("worldNormalSampler",a.getGBuffer().textures[l]),!0}_render(){this.enabled&&this._outputTexture.isReady()&&this._outputTexture.getEffect()?.isReady()&&this._setBindings(this._scene.activeCamera)&&this._outputTexture.render()}resize(e=1){const t={width:Math.max(1,Math.floor(this._engine.getRenderWidth()*e)),height:Math.max(1,Math.floor(this._engine.getRenderHeight()*e))};this._outputTexture.getSize().width===t.width&&this._outputTexture.getSize().height===t.height||this._outputTexture.resize(t,!1)}isReady(){return this._outputTexture.isReady()&&!(this._debugPassPP&&!this._debugPassPP.isReady())&&this._scene.iblCdfGenerator&&this._scene.iblCdfGenerator.getIcdfTexture().isReady()&&this._renderPipeline._getVoxelGridTexture().isReady()}dispose(){this._scene.geometryBufferRenderer&&this._renderWhenGBufferReady&&this._scene.geometryBufferRenderer.getGBuffer().onAfterRenderObservable.removeCallback(this._renderWhenGBufferReady),this._outputTexture.dispose(),this._debugPassPP&&this._debugPassPP.dispose()}}class ee{getOutputTexture(){return this._outputTexture}getDebugPassPP(){return this._debugPassPP||this._createDebugPass(),this._debugPassPP}get debugPassName(){return this._debugPassName}setWorldScale(e){this._worldScale=e}setDebugDisplayParams(e,t,s,i){this._debugSizeParams.set(e,t,s,i)}_createDebugPass(){if(!this._debugPassPP){const e=this._engine.isWebGPU,t={width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight(),textureFormat:5,textureType:0,samplingMode:1,uniforms:["sizeParams"],samplers:["debugSampler"],engine:this._engine,reusable:!1,shaderLanguage:e?1:0,extraInitializations:(s,i)=>{s?i.push(o(()=>import("./iblShadowDebug.fragment-BxACT9ho.js"),__vite__mapDeps([25,1,2,3]),import.meta.url)):i.push(o(()=>import("./iblShadowDebug.fragment-BeBsfe0Y.js"),__vite__mapDeps([26,1,2,3]),import.meta.url))}};this._debugPassPP=new w(this.debugPassName,"iblShadowDebug",t),this._debugPassPP.autoClear=!1,this._debugPassPP.onApplyObservable.add(s=>{s.setTexture("debugSampler",this._outputTexture),s.setVector4("sizeParams",this._debugSizeParams)})}}constructor(e,t){this._worldScale=1,this._blurParameters=new f(0,0,0,0),this.enabled=!0,this._debugPassName="Spatial Blur Debug Pass",this.debugEnabled=!1,this._debugSizeParams=new f(0,0,0,0),this._renderWhenGBufferReady=null,this._scene=e,this._engine=e.getEngine(),this._renderPipeline=t,this._createTextures()}_createTextures(){const e=this._engine.isWebGPU,t={type:0,format:5,samplingMode:1,generateDepthBuffer:!1,generateMipMaps:!1,shaderLanguage:e?1:0,extraInitializationsAsync:async()=>{e?await Promise.all([o(()=>import("./iblShadowSpatialBlur.fragment-Dsgsi0ka.js"),__vite__mapDeps([29,1,2,3]),import.meta.url)]):await Promise.all([o(()=>import("./iblShadowSpatialBlur.fragment-BnhcTAGS.js"),__vite__mapDeps([30,1,2,3]),import.meta.url)])}};this._outputTexture=new P("spatialBlurPass",{width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight()},"iblShadowSpatialBlur",this._scene,t,!1,!1,0),this._outputTexture.refreshRate=-1,this._outputTexture.autoClear=!1,this._setBindings(),this._renderWhenGBufferReady=this._render.bind(this),this._renderPipeline.onVoxelizationCompleteObservable.addOnce(()=>{this._scene.geometryBufferRenderer.getGBuffer().onAfterRenderObservable.add(this._renderWhenGBufferReady)})}_setBindings(){this._outputTexture.setTexture("voxelTracingSampler",this._renderPipeline._getVoxelTracingTexture()),this._blurParameters.set(1,this._worldScale,0,0),this._outputTexture.setVector4("blurParameters",this._blurParameters);const t=this._scene.geometryBufferRenderer;if(!t)return!1;const s=t.getTextureIndex(d.SCREENSPACE_DEPTH_TEXTURE_TYPE);this._outputTexture.setTexture("depthSampler",t.getGBuffer().textures[s]);const i=t.getTextureIndex(d.NORMAL_TEXTURE_TYPE);return this._outputTexture.setTexture("worldNormalSampler",t.getGBuffer().textures[i]),!0}_render(){this.enabled&&this._outputTexture.isReady()&&this._outputTexture.getEffect()?.isReady()&&this._setBindings()&&this._outputTexture.render()}resize(e=1){const t={width:Math.max(1,Math.floor(this._engine.getRenderWidth()*e)),height:Math.max(1,Math.floor(this._engine.getRenderHeight()*e))};this._outputTexture.getSize().width===t.width&&this._outputTexture.getSize().height===t.height||this._outputTexture.resize(t,!1)}isReady(){return this._outputTexture.isReady()&&!(this._debugPassPP&&!this._debugPassPP.isReady())}dispose(){this._scene.geometryBufferRenderer&&this._renderWhenGBufferReady&&this._scene.geometryBufferRenderer.getGBuffer().onAfterRenderObservable.removeCallback(this._renderWhenGBufferReady),this._outputTexture.dispose(),this._debugPassPP&&this._debugPassPP.dispose()}}class te{getOutputTexture(){return this._outputTexture}getDebugPassPP(){return this._debugPassPP||this._createDebugPass(),this._debugPassPP}get debugPassName(){return this._debugPassName}get remanence(){return this._remanence}set remanence(e){this._remanence=e}get reset(){return this._reset}set reset(e){this._reset=e}set isMoving(e){this._isMoving=e}setDebugDisplayParams(e,t,s,i){this._debugSizeParams.set(e,t,s,i)}_createDebugPass(){if(!this._debugPassPP){const e=this._engine.isWebGPU,t={width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight(),textureFormat:5,textureType:0,samplingMode:1,uniforms:["sizeParams"],samplers:["debugSampler"],engine:this._engine,reusable:!1,shaderLanguage:e?1:0,extraInitializations:(s,i)=>{s?i.push(o(()=>import("./iblShadowDebug.fragment-BxACT9ho.js"),__vite__mapDeps([25,1,2,3]),import.meta.url)):i.push(o(()=>import("./iblShadowDebug.fragment-BeBsfe0Y.js"),__vite__mapDeps([26,1,2,3]),import.meta.url))}};this._debugPassPP=new w(this.debugPassName,"iblShadowDebug",t),this._debugPassPP.autoClear=!1,this._debugPassPP.onApplyObservable.add(s=>{s.setTexture("debugSampler",this._outputTexture),s.setVector4("sizeParams",this._debugSizeParams)})}}constructor(e,t){this._accumulationParams=new f(0,0,0,0),this.debugEnabled=!1,this.enabled=!0,this.onReadyObservable=new R,this._debugPassName="Shadow Accumulation Debug Pass",this._remanence=.9,this._reset=!0,this._isMoving=!1,this._debugSizeParams=new f(0,0,0,0),this._renderWhenGBufferReady=null,this._scene=e,this._engine=e.getEngine(),this._renderPipeline=t,this._createTextures()}_createTextures(){const e=this._engine.isWebGPU,t={type:2,format:5,samplingMode:1,generateDepthBuffer:!1,generateMipMaps:!1,shaderLanguage:e?1:0,extraInitializationsAsync:async()=>{e?await Promise.all([o(()=>import("./iblShadowAccumulation.fragment-0-oO9-J6.js"),__vite__mapDeps([31,1,2,3]),import.meta.url)]):await Promise.all([o(()=>import("./iblShadowAccumulation.fragment-BbtPAL11.js"),__vite__mapDeps([32,1,2,3]),import.meta.url)])}};this._outputTexture=new P("shadowAccumulationPass",{width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight()},"iblShadowAccumulation",this._scene,t),this._outputTexture.refreshRate=1,this._outputTexture.autoClear=!1,this._outputTexture.onGeneratedObservable.addOnce(()=>{this.onReadyObservable.notifyObservers()}),this._setOutputTextureBindings(),this._renderWhenGBufferReady=this._render.bind(this),this._renderPipeline.onVoxelizationCompleteObservable.addOnce(()=>{this._scene.geometryBufferRenderer.getGBuffer().onAfterRenderObservable.add(this._renderWhenGBufferReady)});const s={type:2,format:5,samplingMode:1,generateDepthBuffer:!1,generateMipMaps:!1,shaderLanguage:e?1:0,extraInitializationsAsync:async()=>{e?await Promise.all([o(()=>import("./pass.fragment-CTt6kMR9.js"),__vite__mapDeps([33,1,2,3]),import.meta.url)]):await Promise.all([o(()=>import("./pass.fragment-DOtTp0aB.js"),__vite__mapDeps([34,1,2,3]),import.meta.url)])}};this._oldAccumulationCopy=new P("oldAccumulationRT",{width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight()},"pass",this._scene,s,!1),this._oldAccumulationCopy.autoClear=!1,this._oldAccumulationCopy.refreshRate=1,this._oldAccumulationCopy.onBeforeGenerationObservable.add(this._setAccumulationCopyBindings.bind(this)),this._setAccumulationCopyBindings();const i={type:2,format:5,samplingMode:1,generateDepthBuffer:!1,generateMipMaps:!1,shaderLanguage:e?1:0,extraInitializationsAsync:async()=>{e?await Promise.all([o(()=>import("./pass.fragment-CTt6kMR9.js"),__vite__mapDeps([33,1,2,3]),import.meta.url)]):await Promise.all([o(()=>import("./pass.fragment-DOtTp0aB.js"),__vite__mapDeps([34,1,2,3]),import.meta.url)])}};this._oldPositionCopy=new P("oldLocalPositionRT",{width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight()},"pass",this._scene,i,!1),this._updatePositionCopy(),this._oldPositionCopy.autoClear=!1,this._oldPositionCopy.refreshRate=1,this._oldPositionCopy.onBeforeGenerationObservable.add(this._updatePositionCopy.bind(this))}_setOutputTextureBindings(){const e=this._isMoving?this.remanence:.99;this._accumulationParams.set(e,this.reset?1:0,this._renderPipeline.voxelGridSize,0),this._outputTexture.setTexture("spatialBlurSampler",this._renderPipeline._getSpatialBlurTexture()),this._outputTexture.setVector4("accumulationParameters",this._accumulationParams),this._outputTexture.setTexture("oldAccumulationSampler",this._oldAccumulationCopy?this._oldAccumulationCopy:this._renderPipeline._dummyTexture2d),this._outputTexture.setTexture("prevPositionSampler",this._oldPositionCopy?this._oldPositionCopy:this._renderPipeline._dummyTexture2d);const t=this._scene.geometryBufferRenderer;if(!t)return!1;const s=t.getTextureIndex(d.VELOCITY_LINEAR_TEXTURE_TYPE);this._outputTexture.setTexture("motionSampler",t.getGBuffer().textures[s]);const i=t.getTextureIndex(d.POSITION_TEXTURE_TYPE);return this._outputTexture.setTexture("positionSampler",t.getGBuffer().textures[i]),this.reset=!1,this._isMoving=!1,!0}_updatePositionCopy(){const e=this._scene.geometryBufferRenderer,t=e.getTextureIndex(d.POSITION_TEXTURE_TYPE);this._oldPositionCopy.setTexture("textureSampler",e.getGBuffer().textures[t])}_setAccumulationCopyBindings(){this._oldAccumulationCopy.setTexture("textureSampler",this._outputTexture)}_render(){this.enabled&&this._outputTexture.isReady()&&this._outputTexture.getEffect()?.isReady()&&this._setOutputTextureBindings()&&this._outputTexture.render()}resize(e=1){const t={width:Math.max(1,Math.floor(this._engine.getRenderWidth()*e)),height:Math.max(1,Math.floor(this._engine.getRenderHeight()*e))};this._outputTexture.getSize().width===t.width&&this._outputTexture.getSize().height===t.height||(this._outputTexture.resize(t,!1),this._oldAccumulationCopy.resize(t,!1),this._oldPositionCopy.resize({width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight()},!1),this.reset=!0)}_disposeTextures(){this._oldAccumulationCopy.dispose(),this._oldPositionCopy.dispose(),this._outputTexture.dispose()}isReady(){return this._oldAccumulationCopy&&this._oldAccumulationCopy.isReady()&&this._oldPositionCopy&&this._oldPositionCopy.isReady()&&this._outputTexture.isReady()&&!(this._debugPassPP&&!this._debugPassPP.isReady())}dispose(){this._scene.geometryBufferRenderer&&this._renderWhenGBufferReady&&this._scene.geometryBufferRenderer.getGBuffer().onAfterRenderObservable.removeCallback(this._renderWhenGBufferReady),this._disposeTextures(),this._debugPassPP&&this._debugPassPP.dispose(),this.onReadyObservable.clear()}}class se extends x{get width(){return this._texture?this._texture.width:0}get height(){return this._texture?this._texture.height:0}get depth(){return this._texture?this._texture.depth:0}constructor(e,t,s,i,n,a,r=!0,l=!1,h=x.TRILINEAR_SAMPLINGMODE,u=0,m){super(null,a,!r,l),this.format=n,this._texture=a.getEngine().createRawTexture3D(e,t,s,i,n,r,l,h,null,u,m),this.is3D=!0}update(e){this._texture&&this._getEngine().updateRawTexture3D(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type)}}class ie extends H{constructor(){super(...arguments),this.RENDER_WITH_IBL_SHADOWS=!1,this.COLORED_IBL_SHADOWS=!1}}class c extends U{get isColored(){return this._isColored}set isColored(e){this._isColored!==e&&(this._isColored=e,this._markAllSubMeshesAsTexturesDirty())}_markAllSubMeshesAsTexturesDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}isCompatible(){return!0}constructor(e){super(e,c.Name,310,new ie),this.shadowOpacity=1,this._isEnabled=!1,this._isColored=!1,this.isEnabled=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1]}prepareDefines(e){e.RENDER_WITH_IBL_SHADOWS=this._isEnabled,e.COLORED_IBL_SHADOWS=this.isColored}getClassName(){return"IBLShadowsPluginMaterial"}getUniforms(){return{ubo:[{name:"renderTargetSize",size:2,type:"vec2"},{name:"shadowOpacity",size:1,type:"float"}],fragment:`#ifdef RENDER_WITH_IBL_SHADOWS + uniform vec2 renderTargetSize; + uniform float shadowOpacity; + #endif`}}getSamplers(e){e.push("iblShadowsTexture")}bindForSubMesh(e){this._isEnabled&&(e.bindTexture("iblShadowsTexture",this.iblShadowsTexture),e.updateFloat2("renderTargetSize",this._material.getScene().getEngine().getRenderWidth(),this._material.getScene().getEngine().getRenderHeight()),e.updateFloat("shadowOpacity",this.shadowOpacity))}getCustomCode(e,t){let s;return t===1?(s={CUSTOM_FRAGMENT_DEFINITIONS:` + #ifdef RENDER_WITH_IBL_SHADOWS + var iblShadowsTextureSampler: sampler; + var iblShadowsTexture: texture_2d; + + #ifdef COLORED_IBL_SHADOWS + fn computeIndirectShadow() -> vec3f { + var uv = fragmentInputs.position.xy / uniforms.renderTargetSize; + var shadowValue: vec3f = textureSample(iblShadowsTexture, iblShadowsTextureSampler, uv).rgb; + return mix(shadowValue, vec3f(1.0), 1.0 - uniforms.shadowOpacity); + } + #else + fn computeIndirectShadow() -> vec2f { + var uv = fragmentInputs.position.xy / uniforms.renderTargetSize; + var shadowValue: vec2f = textureSample(iblShadowsTexture, iblShadowsTextureSampler, uv).rg; + return mix(shadowValue, vec2f(1.0), 1.0 - uniforms.shadowOpacity); + } + #endif + #endif + `},this._material instanceof y?s.CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION=` + #ifdef RENDER_WITH_IBL_SHADOWS + #ifndef UNLIT + #ifdef REFLECTION + #ifdef COLORED_IBL_SHADOWS + var shadowValue: vec3f = computeIndirectShadow(); + finalIrradiance *= shadowValue; + finalRadianceScaled *= mix(vec3f(1.0), shadowValue, roughness); + #else + var shadowValue: vec2f = computeIndirectShadow(); + finalIrradiance *= vec3f(shadowValue.x); + finalRadianceScaled *= vec3f(mix(pow(shadowValue.y, 4.0), shadowValue.x, roughness)); + #endif + #endif + #else + finalDiffuse *= computeIndirectShadow().x; + #endif + #endif + `:this._material instanceof M?s.CUSTOM_FRAGMENT_BEFORE_IBLLAYERCOMPOSITION=` + #ifdef RENDER_WITH_IBL_SHADOWS + #ifndef UNLIT + #ifdef REFLECTION + #ifdef COLORED_IBL_SHADOWS + var shadowValue: vec3f = computeIndirectShadow(); + slab_diffuse_ibl *= shadowValue; + slab_glossy_ibl *= mix(vec3f(1.0), shadowValue, specularAlphaG); + #else + var shadowValue: vec2f = computeIndirectShadow(); + slab_diffuse_ibl *= vec3f(shadowValue.x); + slab_glossy_ibl *= vec3f(mix(pow(shadowValue.y, 4.0), shadowValue.x, specularAlphaG)); + #endif + #endif + #else + slab_diffuse_ibl *= computeIndirectShadow().x; + #endif + #endif + `:s.CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR=` + #ifdef RENDER_WITH_IBL_SHADOWS + #ifdef COLORED_IBL_SHADOWS + var shadowValue: vec3f = computeIndirectShadow(); + color *= toGammaSpace(vec4f(shadowValue, 1.0f)); + #else + var shadowValue: vec2f = computeIndirectShadow(); + color *= toGammaSpace(vec4f(shadowValue.x, shadowValue.x, shadowValue.x, 1.0f)); + #endif + #endif + `):(s={CUSTOM_FRAGMENT_DEFINITIONS:` + #ifdef RENDER_WITH_IBL_SHADOWS + uniform sampler2D iblShadowsTexture; + #ifdef COLORED_IBL_SHADOWS + vec3 computeIndirectShadow() { + vec2 uv = gl_FragCoord.xy / renderTargetSize; + vec3 shadowValue = texture2D(iblShadowsTexture, uv).rgb; + return mix(shadowValue.rgb, vec3(1.0), 1.0 - shadowOpacity); + } + #else + vec2 computeIndirectShadow() { + vec2 uv = gl_FragCoord.xy / renderTargetSize; + vec2 shadowValue = texture2D(iblShadowsTexture, uv).rg; + return mix(shadowValue.rg, vec2(1.0), 1.0 - shadowOpacity); + } + #endif + #endif + `},this._material instanceof y?s.CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION=` + #ifdef RENDER_WITH_IBL_SHADOWS + #ifndef UNLIT + #ifdef REFLECTION + #ifdef COLORED_IBL_SHADOWS + vec3 shadowValue = computeIndirectShadow(); + finalIrradiance.rgb *= shadowValue.rgb; + finalRadianceScaled *= mix(vec3(1.0), shadowValue.rgb, roughness); + #else + vec2 shadowValue = computeIndirectShadow(); + finalIrradiance *= shadowValue.x; + finalRadianceScaled *= mix(pow(shadowValue.y, 4.0), shadowValue.x, roughness); + #endif + #endif + #else + finalDiffuse *= computeIndirectShadow().x; + #endif + #endif + `:this._material instanceof M?s.CUSTOM_FRAGMENT_BEFORE_IBLLAYERCOMPOSITION=` + #ifdef RENDER_WITH_IBL_SHADOWS + #ifndef UNLIT + #ifdef REFLECTION + #ifdef COLORED_IBL_SHADOWS + vec3 shadowValue = computeIndirectShadow(); + slab_diffuse_ibl.rgb *= shadowValue.rgb; + slab_glossy_ibl *= mix(vec3(1.0), shadowValue.rgb, specularAlphaG); + #else + vec2 shadowValue = computeIndirectShadow(); + slab_diffuse_ibl *= shadowValue.x; + slab_glossy_ibl *= mix(pow(shadowValue.y, 4.0), shadowValue.x, specularAlphaG); + #endif + #endif + #else + slab_diffuse_ibl *= computeIndirectShadow().x; + #endif + #endif + `:s.CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR=` + #ifdef RENDER_WITH_IBL_SHADOWS + #ifdef COLORED_IBL_SHADOWS + vec3 shadowValue = computeIndirectShadow(); + color.rgb *= toGammaSpace(shadowValue.rgb); + #else + vec2 shadowValue = computeIndirectShadow(); + color.rgb *= toGammaSpace(shadowValue.x); + #endif + #endif + `),e==="vertex"?null:s}}c.Name="IBLShadowsPluginMaterial";V([C()],c.prototype,"shadowOpacity",void 0);V([C(),X("_markAllSubMeshesAsTexturesDirty")],c.prototype,"isEnabled",void 0);Y("BABYLON.IBLShadowsPluginMaterial",c);class we extends j{resetAccumulation(){this._accumulationPass.reset=!0}get shadowOpacity(){return this._shadowOpacity}set shadowOpacity(e){this._shadowOpacity=e,this._setPluginParameters()}get coloredShadows(){return this._coloredShadows}set coloredShadows(e){this._coloredShadows=e,this._voxelTracingPass.coloredShadows=e,this._setPluginParameters()}get shadowRenderSizeFactor(){return this._renderSizeFactor}set shadowRenderSizeFactor(e){this._renderSizeFactor=Math.max(Math.min(e,1),0),this._voxelTracingPass.resize(e),this._spatialBlurPass.resize(e),this._accumulationPass.resize(e),this._setPluginParameters()}get voxelShadowOpacity(){return this._voxelTracingPass?.voxelShadowOpacity}set voxelShadowOpacity(e){this._voxelTracingPass&&(this._voxelTracingPass.voxelShadowOpacity=e)}get ssShadowOpacity(){return this._voxelTracingPass?.ssShadowOpacity}set ssShadowOpacity(e){this._voxelTracingPass&&(this._voxelTracingPass.ssShadowOpacity=e)}get ssShadowSampleCount(){return this._voxelTracingPass?.sssSamples}set ssShadowSampleCount(e){this._voxelTracingPass&&(this._voxelTracingPass.sssSamples=e)}get ssShadowStride(){return this._voxelTracingPass?.sssStride}set ssShadowStride(e){this._voxelTracingPass&&(this._voxelTracingPass.sssStride=e)}get ssShadowDistanceScale(){return this._sssMaxDistScale}set ssShadowDistanceScale(e){this._sssMaxDistScale=e,this._updateSsShadowParams()}get ssShadowThicknessScale(){return this._sssThicknessScale}set ssShadowThicknessScale(e){this._sssThicknessScale=e,this._updateSsShadowParams()}_getVoxelGridTexture(){const e=this._voxelRenderer?.getVoxelGrid();return e&&e.isReady()?e:this._dummyTexture3d}_getNoiseTexture(){const e=this._noiseTexture;return e&&e.isReady()?e:this._dummyTexture2d}_getVoxelTracingTexture(){const e=this._voxelTracingPass?.getOutputTexture();return e&&e.isReady()?e:this._dummyTexture2d}_getSpatialBlurTexture(){const e=this._spatialBlurPass.getOutputTexture();return e&&e.isReady()?e:this._dummyTexture2d}_getAccumulatedTexture(){const e=this._accumulationPass?.getOutputTexture();return e&&e.isReady()?e:this._dummyTexture2d}get gbufferDebugEnabled(){return this._gbufferDebugEnabled}set gbufferDebugEnabled(e){if(e&&!this.allowDebugPasses){_.Warn("Can't enable G-Buffer debug view without setting allowDebugPasses to true.");return}this._gbufferDebugEnabled=e,e?this._enableEffect(this._getGBufferDebugPass().name,this.cameras):this._disableEffect(this._getGBufferDebugPass().name,this.cameras)}get cdfDebugEnabled(){return this.scene.iblCdfGenerator?this.scene.iblCdfGenerator.debugEnabled:!1}set cdfDebugEnabled(e){if(this.scene.iblCdfGenerator){if(e&&!this.allowDebugPasses){_.Warn("Can't enable importance sampling debug view without setting allowDebugPasses to true.");return}e!==this.scene.iblCdfGenerator.debugEnabled&&(this.scene.iblCdfGenerator.debugEnabled=e,e?this._enableEffect(this.scene.iblCdfGenerator.debugPassName,this.cameras):this._disableEffect(this.scene.iblCdfGenerator.debugPassName,this.cameras))}}get voxelDebugEnabled(){return this._voxelRenderer?.voxelDebugEnabled}set voxelDebugEnabled(e){if(this._voxelRenderer){if(e&&!this.allowDebugPasses){_.Warn("Can't enable voxel debug view without setting allowDebugPasses to true.");return}this._voxelRenderer.voxelDebugEnabled=e,e?this._enableEffect(this._voxelRenderer.debugPassName,this.cameras):this._disableEffect(this._voxelRenderer.debugPassName,this.cameras)}}get voxelDebugAxis(){return this._voxelRenderer?.voxelDebugAxis}set voxelDebugAxis(e){this._voxelRenderer&&(this._voxelRenderer.voxelDebugAxis=e)}set voxelDebugDisplayMip(e){this._voxelRenderer&&this._voxelRenderer.setDebugMipNumber(e)}get voxelTracingDebugEnabled(){return this._voxelTracingPass?.debugEnabled}set voxelTracingDebugEnabled(e){if(this._voxelTracingPass){if(e&&!this.allowDebugPasses){_.Warn("Can't enable voxel tracing debug view without setting allowDebugPasses to true.");return}e!==this._voxelTracingPass.debugEnabled&&(this._voxelTracingPass.debugEnabled=e,e?this._enableEffect(this._voxelTracingPass.debugPassName,this.cameras):this._disableEffect(this._voxelTracingPass.debugPassName,this.cameras))}}get spatialBlurPassDebugEnabled(){return this._spatialBlurPass.debugEnabled}set spatialBlurPassDebugEnabled(e){if(this._spatialBlurPass){if(e&&!this.allowDebugPasses){_.Warn("Can't enable spatial blur debug view without setting allowDebugPasses to true.");return}e!==this._spatialBlurPass.debugEnabled&&(this._spatialBlurPass.debugEnabled=e,e?this._enableEffect(this._spatialBlurPass.debugPassName,this.cameras):this._disableEffect(this._spatialBlurPass.debugPassName,this.cameras))}}get accumulationPassDebugEnabled(){return this._accumulationPass?.debugEnabled}set accumulationPassDebugEnabled(e){if(this._accumulationPass){if(e&&!this.allowDebugPasses){_.Warn("Can't enable accumulation pass debug view without setting allowDebugPasses to true.");return}e!==this._accumulationPass.debugEnabled&&(this._accumulationPass.debugEnabled=e,e?this._enableEffect(this._accumulationPass.debugPassName,this.cameras):this._disableEffect(this._accumulationPass.debugPassName,this.cameras))}}addShadowCastingMesh(e){if(Array.isArray(e))for(const t of e)t&&this._shadowCastingMeshes.indexOf(t)===-1&&this._shadowCastingMeshes.push(t);else e&&this._shadowCastingMeshes.indexOf(e)===-1&&this._shadowCastingMeshes.push(e)}removeShadowCastingMesh(e){if(Array.isArray(e))for(const t of e){const s=this._shadowCastingMeshes.indexOf(t);s!==-1&&this._shadowCastingMeshes.splice(s,1)}else{const t=this._shadowCastingMeshes.indexOf(e);t!==-1&&this._shadowCastingMeshes.splice(t,1)}}clearShadowCastingMeshes(){this._shadowCastingMeshes.length=0}get resolutionExp(){return this._voxelRenderer.voxelResolutionExp}set resolutionExp(e){if(e!==this._voxelRenderer.voxelResolutionExp){if(this._voxelRenderer.isVoxelizationInProgress()){_.Warn("Can't change the resolution of the voxel grid while voxelization is in progress.");return}this._voxelRenderer.voxelResolutionExp=Math.max(1,Math.min(e,8)),this._accumulationPass.reset=!0}}get sampleDirections(){return this._voxelTracingPass?.sampleDirections}set sampleDirections(e){this._voxelTracingPass&&(this._voxelTracingPass.sampleDirections=e)}get shadowRemanence(){return this._accumulationPass?.remanence}set shadowRemanence(e){this._accumulationPass&&(this._accumulationPass.remanence=e)}get envRotation(){return this._voxelTracingPass?.envRotation}set envRotation(e){this._voxelTracingPass&&(this._voxelTracingPass.envRotation=e,this._accumulationPass.reset=!0)}get allowDebugPasses(){return this._allowDebugPasses}set allowDebugPasses(e){this._allowDebugPasses!==e&&(this._allowDebugPasses=e,e&&this.scene.iblCdfGenerator?this.scene.iblCdfGenerator.isReady()?this._createDebugPasses():this.scene.iblCdfGenerator.onGeneratedObservable.addOnce(()=>{this._createDebugPasses()}):this._disposeDebugPasses())}static get IsSupported(){const e=k.LastCreatedEngine;return e?e._features.supportIBLShadows:!1}toggleShadow(e){this._enabled=e,this._voxelTracingPass.enabled=e,this._spatialBlurPass.enabled=e,this._accumulationPass.enabled=e;for(const t of this._materialsWithRenderPlugin)if(t.pluginManager){const s=t.pluginManager.getPlugin(c.Name);s.isEnabled=e}this._setPluginParameters()}updateVoxelization(){if(this._shadowCastingMeshes.length===0){_.Warn("IBL Shadows: updateVoxelization called with no shadow-casting meshes to voxelize.");return}this._voxelRenderer.updateVoxelGrid(this._shadowCastingMeshes),this._voxelRenderer.onVoxelizationCompleteObservable.addOnce(()=>{this.onVoxelizationCompleteObservable.notifyObservers()}),this._updateSsShadowParams()}updateSceneBounds(){const e={min:new g(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),max:new g(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)};for(const r of this._shadowCastingMeshes){const l=r.getHierarchyBoundingVectors(!0);e.min=g.Minimize(e.min,l.min),e.max=g.Maximize(e.max,l.max)}const t=e.max.subtract(e.min);if(this.voxelGridSize=Math.max(t.x,t.y,t.z),this._shadowCastingMeshes.length===0||!isFinite(this.voxelGridSize)||this.voxelGridSize===0){_.Warn("IBL Shadows: Scene size is invalid. Can't update bounds."),this.voxelGridSize=1;return}const s=this.voxelGridSize/2,i=e.max.add(e.min).multiplyByFloats(-.5,-.5,-.5),n=b.Compose(new g(1/s,1/s,1/s),new I,new g(0,0,0));b.Compose(new g(1,1,1),new I,i).multiplyToRef(n,n),this._voxelTracingPass.setWorldScaleMatrix(n),this._voxelRenderer.setWorldScaleMatrix(n),this._spatialBlurPass.setWorldScale(s*2),this._updateSsShadowParams()}constructor(e,t,s={},i){super(t.getEngine(),e),this._allowDebugPasses=!1,this._debugPasses=[],this._shadowCastingMeshes=[],this._shadowOpacity=.8,this._enabled=!0,this._coloredShadows=!1,this._materialsWithRenderPlugin=[],this.onShadowTextureReadyObservable=new R,this.onNewIblReadyObservable=new R,this.onVoxelizationCompleteObservable=new R,this.voxelGridSize=1,this._renderSizeFactor=1,this._gbufferDebugEnabled=!1,this._gBufferDebugSizeParams=new f(0,0,0,0),this.scene=t,this._cameras=i||[t.activeCamera];const n=new Uint8Array([0,0,0,255]);this._dummyTexture2d=new Q(n,1,1,D.TEXTUREFORMAT_RGBA,t,!1),this._dummyTexture3d=new se(n,1,1,1,D.TEXTUREFORMAT_RGBA,t,!1);const a={};a[d.SCREENSPACE_DEPTH_TEXTURE_TYPE]={textureFormat:6,textureType:1},a[d.VELOCITY_LINEAR_TEXTURE_TYPE]={textureFormat:7,textureType:2},a[d.POSITION_TEXTURE_TYPE]={textureFormat:5,textureType:2},a[d.NORMAL_TEXTURE_TYPE]={textureFormat:5,textureType:2};const r=t.enableGeometryBufferRenderer(void 0,14,a);if(!r){_.Error("Geometry buffer renderer is required for IBL shadows to work.");return}this._geometryBufferRenderer=r,this._geometryBufferRenderer.enableScreenspaceDepth=!0,this._geometryBufferRenderer.enableVelocityLinear=!0,this._geometryBufferRenderer.enablePosition=!0,this._geometryBufferRenderer.enableNormal=!0,this._geometryBufferRenderer.generateNormalsInWorldSpace=!0,this.scene.enableIblCdfGenerator(),this.shadowOpacity=s.shadowOpacity||.8,this._voxelRenderer=new K(this.scene,this,s?s.resolutionExp:6,s.triPlanarVoxelization!==void 0?s.triPlanarVoxelization:!0),this._voxelTracingPass=new $(this.scene,this),this._spatialBlurPass=new ee(this.scene,this),this._accumulationPass=new te(this.scene,this),this._accumulationPass.onReadyObservable.addOnce(()=>{this.onShadowTextureReadyObservable.notifyObservers()}),this.sampleDirections=s.sampleDirections||2,this.voxelShadowOpacity=s.voxelShadowOpacity??1,this.envRotation=s.envRotation??0,this.shadowRenderSizeFactor=s.shadowRenderSizeFactor||1,this.ssShadowOpacity=s.ssShadowsEnabled===void 0||s.ssShadowsEnabled?1:0,this.ssShadowDistanceScale=s.ssShadowDistanceScale||1.25,this.ssShadowSampleCount=s.ssShadowSampleCount||16,this.ssShadowStride=s.ssShadowStride||8,this.ssShadowThicknessScale=s.ssShadowThicknessScale||1,this.shadowRemanence=s.shadowRemanence??.75,this._noiseTexture=new x(Z.GetAssetUrl("https://assets.babylonjs.com/core/blue_noise/blue_noise_rgb.png"),this.scene,!1,!0,1),t.postProcessRenderPipelineManager.addPipeline(this),this.scene.onActiveCameraChanged.add(this._listenForCameraChanges.bind(this)),this.scene.onBeforeRenderObservable.add(this._updateBeforeRender.bind(this)),this._listenForCameraChanges(),this.scene.getEngine().onResizeObservable.add(this._handleResize.bind(this)),this.scene.iblCdfGenerator&&this.scene.iblCdfGenerator.onGeneratedObservable.add(()=>{this._setPluginParameters(),this.onNewIblReadyObservable.notifyObservers()})}_handleResize(){this._voxelRenderer.resize(),this._voxelTracingPass.resize(this.shadowRenderSizeFactor),this._spatialBlurPass.resize(this.shadowRenderSizeFactor),this._accumulationPass.resize(this.shadowRenderSizeFactor),this._setPluginParameters()}_getGBufferDebugPass(){if(this._gbufferDebugPass)return this._gbufferDebugPass;const e=this.engine.isWebGPU,t=["depthSampler","normalSampler","positionSampler","velocitySampler"],s={width:this.scene.getEngine().getRenderWidth(),height:this.scene.getEngine().getRenderHeight(),samplingMode:1,engine:this.scene.getEngine(),textureType:0,textureFormat:5,uniforms:["sizeParams"],samplers:t,reusable:!1,shaderLanguage:e?1:0,extraInitializations:(i,n)=>{i?n.push(o(()=>import("./iblShadowGBufferDebug.fragment-CvaejVzX.js"),__vite__mapDeps([35,1,2,3]),import.meta.url)):n.push(o(()=>import("./iblShadowGBufferDebug.fragment-DtTs5wjg.js"),__vite__mapDeps([36,1,2,3]),import.meta.url))}};return this._gbufferDebugPass=new w("iblShadowGBufferDebug","iblShadowGBufferDebug",s),this.engine.isWebGPU&&(this._gbufferDebugPass.samples=this.engine.currentSampleCount??1),this._gbufferDebugPass.autoClear=!1,this._gbufferDebugPass.onApplyObservable.add(i=>{const n=this._geometryBufferRenderer.getTextureIndex(d.SCREENSPACE_DEPTH_TEXTURE_TYPE);i.setTexture("depthSampler",this._geometryBufferRenderer.getGBuffer().textures[n]);const a=this._geometryBufferRenderer.getTextureIndex(d.NORMAL_TEXTURE_TYPE);i.setTexture("normalSampler",this._geometryBufferRenderer.getGBuffer().textures[a]);const r=this._geometryBufferRenderer.getTextureIndex(d.POSITION_TEXTURE_TYPE);i.setTexture("positionSampler",this._geometryBufferRenderer.getGBuffer().textures[r]);const l=this._geometryBufferRenderer.getTextureIndex(d.VELOCITY_LINEAR_TEXTURE_TYPE);i.setTexture("velocitySampler",this._geometryBufferRenderer.getGBuffer().textures[l]),i.setVector4("sizeParams",this._gBufferDebugSizeParams),this.scene.activeCamera&&i.setFloat("maxDepth",this.scene.activeCamera.maxZ)}),this._gbufferDebugPass}_createDebugPasses(){this.scene.iblCdfGenerator?this._debugPasses=[{pass:this.scene.iblCdfGenerator.getDebugPassPP(),enabled:this.cdfDebugEnabled}]:this._debugPasses=[],this._debugPasses.push({pass:this._voxelRenderer.getDebugPassPP(),enabled:this.voxelDebugEnabled},{pass:this._voxelTracingPass.getDebugPassPP(),enabled:this.voxelTracingDebugEnabled},{pass:this._spatialBlurPass.getDebugPassPP(),enabled:this.spatialBlurPassDebugEnabled},{pass:this._accumulationPass.getDebugPassPP(),enabled:this.accumulationPassDebugEnabled},{pass:this._getGBufferDebugPass(),enabled:this.gbufferDebugEnabled});for(let t=0;tthis._debugPasses[t].pass,!0));const e=this.cameras.slice();this.scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this.name,this.cameras),this.scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this.name,e);for(let t=0;t{this._accumulationPass.isMoving=!0})}isReady(){return this._noiseTexture.isReady()&&this._voxelRenderer.isReady()&&this.scene.iblCdfGenerator&&this.scene.iblCdfGenerator.isReady()&&(!this._voxelTracingPass||this._voxelTracingPass.isReady())&&(!this._spatialBlurPass||this._spatialBlurPass.isReady())&&(!this._accumulationPass||this._accumulationPass.isReady())}getClassName(){return"IBLShadowsRenderPipeline"}dispose(){const e=this._materialsWithRenderPlugin.splice(0);for(const t of e)this.removeShadowReceivingMaterial(t);this._disposeEffectPasses(),this._noiseTexture.dispose(),this._voxelRenderer.dispose(),this._voxelTracingPass.dispose(),this._spatialBlurPass.dispose(),this._accumulationPass.dispose(),this._dummyTexture2d.dispose(),this._dummyTexture3d.dispose(),this.onNewIblReadyObservable.clear(),this.onShadowTextureReadyObservable.clear(),this.onVoxelizationCompleteObservable.clear(),super.dispose()}}export{we as IblShadowsRenderPipeline}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid.fragment-BQ18phoi.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid.fragment-BQ18phoi.js new file mode 100644 index 0000000000000000000000000000000000000000..5fd5ca6a6d9a7feb053ab2d8661cfb013e9317cf --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid.fragment-BQ18phoi.js @@ -0,0 +1,6 @@ +import{S as a}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblVoxelGridPixelShader",o=`precision highp float;layout(location=0) out highp float glFragData[MAX_DRAW_BUFFERS];varying vec3 vNormalizedPosition;uniform float nearPlane;uniform float farPlane;uniform float stepSize;void main(void) {vec3 normPos=vNormalizedPosition.xyz;if (normPos.zfarPlane) {discard;} +glFragData[0]=normPos.z=nearPlane+stepSize && normPos.z=nearPlane+2.0*stepSize && normPos.z=nearPlane+3.0*stepSize && normPos.z4 +glFragData[4]=normPos.z>=nearPlane+4.0*stepSize && normPos.z=nearPlane+5.0*stepSize && normPos.z=nearPlane+6.0*stepSize && normPos.z=nearPlane+7.0*stepSize && normPos.z;varying vNormalizedPosition: vec3f;flat varying f_swizzle: i32;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var size: vec3f=vec3f(textureDimensions(voxel_storage));var normPos: vec3f=input.vNormalizedPosition.xyz;var outputColor: vec4f=vec4f(0.0,0.0,0.0,1.0);switch (input.f_swizzle) {case 0: {normPos=normPos.zxy; +outputColor=vec4f(1.0,1.0,0.0,1.0);break;} +case 1: {normPos=normPos.yzx;outputColor=vec4f(1.0,1.0,1.0,1.0);break;} +default: {normPos=normPos.xyz;outputColor=vec4f(1.0,1.0,0.0,1.0);break;}} +textureStore(voxel_storage,vec3(i32(normPos.x*size.x),i32(normPos.y*size.y),i32(normPos.z*size.z)),outputColor);fragmentOutputs.color=vec4(vec3(normPos),1.);}`;e.ShadersStoreWGSL[o]||(e.ShadersStoreWGSL[o]=r);const i={name:o,shader:r};export{i as iblVoxelGridPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid.vertex-BFI2c6vV.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid.vertex-BFI2c6vV.js new file mode 100644 index 0000000000000000000000000000000000000000..d3ee14dc443b79386f598238aea15c302c9dc1ff --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid.vertex-BFI2c6vV.js @@ -0,0 +1,106 @@ +import{S as t}from"./index-CDrXokXW.js";import"./morphTargetsVertexDeclaration-BsT9JpOT.js";import"./bonesVertex-bl6LLSA1.js";import"./bakedVertexAnimation-DoavwM49.js";import"./index-DWyDLubb.js";const e="iblVoxelGridVertexShader",r=`#include +#include (attribute matricesIndices : vec4f;,,attribute matricesWeights : vec4f;,,attribute matricesIndicesExtra : vec4f;,,attribute matricesWeightsExtra : vec4f;,) +#include +#include +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef VERTEX_PULLING_USE_INDEX_BUFFER +var indices : array; +#endif +var position : array; +#if NUM_BONE_INFLUENCERS>0 +var matricesIndices : array;var matricesWeights : array;uniform vp_matricesIndices_info: vec3f;uniform vp_matricesWeights_info: vec3f; +#if NUM_BONE_INFLUENCERS>4 +var matricesIndicesExtra : array;var matricesWeightsExtra : array;uniform vp_matricesIndicesExtra_info: vec3f;uniform vp_matricesWeightsExtra_info: vec3f; +#endif +#endif +uniform world : mat4x4f;uniform invWorldScale: mat4x4f;varying vNormalizedPosition : vec3f;flat varying f_swizzle: i32;uniform vp_position_info: vec3f; +fn convertToFloat(word: u32,byteInWord: u32,dataType: u32)->f32 {switch (dataType) {case 5120u: { +let shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(i32(value<<24u)>>24u)/127.0; } +case 5121u: { +let shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(value)/255.0;} +case 5122u: { +let shift=(byteInWord & 0xFFFFFFFEu)*8u; +let value=(word>>shift) & 0xFFFFu;return f32(i32(value<<16u)>>16u);} +case 5123u: { +let shift=(byteInWord & 0xFFFFFFFEu)*8u; +let value=(word>>shift) & 0xFFFFu;return f32(value);} +case 5126u: { +return bitcast(word);} +default: {return 0.0;}}} +fn readPositionValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast(position[wordOffset]);return convertToFloat(word,byteInWord,dataType);} +fn readVertexPosition(info: vec3f,vertexIndex: u32)->vec3f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec3f( +readPositionValue(offset,dataType), +readPositionValue(offset+componentSize,dataType), +readPositionValue(offset+componentSize*2u,dataType) +);} +#if NUM_BONE_INFLUENCERS>0 +fn readMatrixIndexValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=matricesIndices[wordOffset];return convertToFloat(word,byteInWord,dataType);} +fn readMatrixIndices(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f( +readMatrixIndexValue(offset,dataType), +readMatrixIndexValue(offset+componentSize,dataType), +readMatrixIndexValue(offset+componentSize*2u,dataType), +readMatrixIndexValue(offset+componentSize*3u,dataType) +);} +fn readMatrixWeightValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast(matricesWeights[wordOffset]);return convertToFloat(word,byteInWord,dataType);} +fn readMatrixWeights(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f( +readMatrixWeightValue(offset,dataType), +readMatrixWeightValue(offset+componentSize,dataType), +readMatrixWeightValue(offset+componentSize*2u,dataType), +readMatrixWeightValue(offset+componentSize*3u,dataType) +);} +#if NUM_BONE_INFLUENCERS>4 +fn readMatrixIndexExtraValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast(matricesIndicesExtra[wordOffset]);return convertToFloat(word,byteInWord,dataType);} +fn readMatrixIndicesExtra(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f( +readMatrixIndexExtraValue(offset,dataType), +readMatrixIndexExtraValue(offset+componentSize,dataType), +readMatrixIndexExtraValue(offset+componentSize*2u,dataType), +readMatrixIndexExtraValue(offset+componentSize*3u,dataType) +);} +fn readMatrixWeightExtraValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast(matricesWeightsExtra[wordOffset]);return convertToFloat(word,byteInWord,dataType);} +fn readMatrixIndicesExtra(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f( +readMatrixWeightExtraValue(offset,dataType), +readMatrixWeightExtraValue(offset+componentSize,dataType), +readMatrixWeightExtraValue(offset+componentSize*2u,dataType), +readMatrixWeightExtraValue(offset+componentSize*3u,dataType) +);} +#endif +#endif +fn readVertexIndex(index : u32)->u32 { +#ifndef VERTEX_PULLING_USE_INDEX_BUFFER +return index; +#else +#ifdef VERTEX_PULLING_INDEX_BUFFER_32BITS +return indices[index]; +#else +let u32_index=index/2u;let bit_offset=(index & 1u)*16u;return (indices[u32_index]>>bit_offset) & 0xFFFFu; +#endif +#endif +} +fn calculateTriangleNormal(v0 +: vec3,v1 +: vec3,v2 +: vec3) +->vec3 {let edge1=v1-v0;let edge2=v2-v0;let triangleNormal=cross(edge1,edge2);let normalizedTriangleNormal=normalize(triangleNormal);return normalizedTriangleNormal;} +@vertex +fn main(input : VertexInputs)->FragmentInputs { +#include +var triPositions: array;var thisTriIndex : u32=input.vertexIndex; +for (var i: u32=0u; i<3u; i=i+1u) {var provokingVertNum : u32=input.vertexIndex/3*3;let vertIdx=readVertexIndex(provokingVertNum+i);if (provokingVertNum+i==input.vertexIndex) {thisTriIndex=i;} +var positionUpdated=readVertexPosition(uniforms.vp_position_info,vertIdx); +#include +let inputPosition: vec3f=positionUpdated; +#include (vertexInputs.position\\),inputPosition),vertexInputs.vertexIndex,vertIdx)[0..maxSimultaneousMorphTargets] +#if NUM_BONE_INFLUENCERS>0 +let matrixIndex=readMatrixIndices(uniforms.vp_matricesIndices_info,vertIdx);let matrixWeight=readMatrixWeights(uniforms.vp_matricesWeights_info,vertIdx); +#if NUM_BONE_INFLUENCERS>4 +let matrixIndexExtra=readMatrixIndicesExtra(uniforms.vp_matricesIndicesExtra_info,vertIdx);let matrixWeightExtra=readMatrixWeightsExtra(uniforms.vp_matricesWeightsExtra_info,vertIdx); +#endif +#endif +#include(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight,vertexInputs.matricesIndicesExtra,matrixIndexExtra,vertexInputs.matricesWeightsExtra,matrixWeightExtra) +#include(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight,vertexInputs.matricesIndicesExtra,matrixIndexExtra,vertexInputs.matricesWeightsExtra,matrixWeightExtra) +triPositions[i]=(finalWorld*vec4(positionUpdated,1.0)).xyz;} +var N : vec3=calculateTriangleNormal(triPositions[0],triPositions[1],triPositions[2]);let worldPos=triPositions[thisTriIndex];vertexOutputs.position=uniforms.invWorldScale*vec4(worldPos,1.0);N=abs(N);if (N.x>N.y && N.x>N.z) {vertexOutputs.f_swizzle=0;vertexOutputs.position=vec4f(vertexOutputs.position.yzx,1.0);} else if (N.y>N.z) {vertexOutputs.f_swizzle=1;vertexOutputs.position=vec4f(vertexOutputs.position.zxy,1.0);} else {vertexOutputs.f_swizzle=2;vertexOutputs.position=vec4f(vertexOutputs.position.xyz,1.0);} +vertexOutputs.vNormalizedPosition=vertexOutputs.position.xyz*0.5+0.5;vertexOutputs.position.z = +vertexOutputs.vNormalizedPosition.z; } +`;t.ShadersStoreWGSL[e]||(t.ShadersStoreWGSL[e]=r);const f={name:e,shader:r};export{f as iblVoxelGridVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid.vertex-DIsF2hrc.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid.vertex-DIsF2hrc.js new file mode 100644 index 0000000000000000000000000000000000000000..0f82594d7037a77aef38b14d672f8ec21e6a2d3a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid.vertex-DIsF2hrc.js @@ -0,0 +1,17 @@ +import{S as i}from"./index-CDrXokXW.js";import"./bakedVertexAnimation-BwUJBnNt.js";import"./instancesDeclaration-BAnfKLCo.js";import"./morphTargetsVertex-7Q90Wwr8.js";import"./index-DWyDLubb.js";const e="iblVoxelGridVertexShader",o=`attribute vec3 position;varying vec3 vNormalizedPosition; +#include +#include +#include +#include +#include[0..maxSimultaneousMorphTargets] +uniform mat4 invWorldScale;uniform mat4 viewMatrix;void main(void) {vec3 positionUpdated=position; +#include +#include[0..maxSimultaneousMorphTargets] +#include +#include +#include +vec4 worldPos=finalWorld*vec4(positionUpdated,1.0);gl_Position=viewMatrix*invWorldScale*worldPos;vNormalizedPosition.xyz=gl_Position.xyz*0.5+0.5; +#ifdef IS_NDC_HALF_ZRANGE +gl_Position.z=gl_Position.z*0.5+0.5; +#endif +}`;i.ShadersStore[e]||(i.ShadersStore[e]=o);const d={name:e,shader:o};export{d as iblVoxelGridVertexShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid3dDebug.fragment-BoAA6lER.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid3dDebug.fragment-BoAA6lER.js new file mode 100644 index 0000000000000000000000000000000000000000..3387d25a4f5df99003c1bdd89236a6de1e02a53e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid3dDebug.fragment-BoAA6lER.js @@ -0,0 +1,14 @@ +import{S as o}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblVoxelGrid3dDebugPixelShader",r=`precision highp sampler3D;varying vec2 vUV;uniform sampler3D voxelTexture;uniform sampler2D voxelSlabTexture;uniform sampler2D textureSampler;uniform vec4 sizeParams; +#define offsetX sizeParams.x +#define offsetY sizeParams.y +#define widthScale sizeParams.z +#define heightScale sizeParams.w +uniform float mipNumber;void main(void) {vec2 uv = +vec2((offsetX+vUV.x)*widthScale,(offsetY+vUV.y)*heightScale);vec4 background=texture2D(textureSampler,vUV);vec4 voxelSlab=texture2D(voxelSlabTexture,vUV);ivec3 size=textureSize(voxelTexture,int(mipNumber));float dimension=ceil(sqrt(float(size.z)));vec2 samplePos=fract(uv.xy*vec2(dimension));int sampleIndex=int(floor(uv.x*float(dimension)) + +floor(uv.y*float(dimension))*dimension);float mip_separator=0.0;if (samplePos.x<0.01 || samplePos.y<0.01) {mip_separator=1.0;} +bool outBounds=sampleIndex>size.z-1 ? true : false;sampleIndex=clamp(sampleIndex,0,size.z-1);ivec2 samplePosInt=ivec2(samplePos.xy*vec2(size.xy));vec3 voxel=texelFetch(voxelTexture, +ivec3(samplePosInt.x,samplePosInt.y,sampleIndex), +int(mipNumber)) +.rgb;if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {gl_FragColor.rgba=background;} else {if (outBounds) {voxel=vec3(0.15,0.0,0.0);} else {if (voxel.r>0.001) {voxel.g=1.0;} +voxel.r+=mip_separator;} +glFragColor.rgb=mix(background.rgb,voxelSlab.rgb,voxelSlab.a)+voxel;glFragColor.a=1.0;}}`;o.ShadersStore[e]||(o.ShadersStore[e]=r);const l={name:e,shader:r};export{l as iblVoxelGrid3dDebugPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid3dDebug.fragment-CCz_tkfs.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid3dDebug.fragment-CCz_tkfs.js new file mode 100644 index 0000000000000000000000000000000000000000..3416e668d0fc879f8db3466d52cac0bec2d7bad3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelGrid3dDebug.fragment-CCz_tkfs.js @@ -0,0 +1,13 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="iblVoxelGrid3dDebugPixelShader",a=`varying vUV: vec2f;var voxelTextureSampler: sampler;var voxelTexture: texture_3d;var voxelSlabTextureSampler: sampler;var voxelSlabTexture: texture_2d;var textureSamplerSampler: sampler;var textureSampler: texture_2d;uniform sizeParams: vec4f; +#define offsetX uniforms.sizeParams.x +#define offsetY uniforms.sizeParams.y +#define widthScale uniforms.sizeParams.z +#define heightScale uniforms.sizeParams.w +uniform mipNumber: f32;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var uv: vec2f = +vec2f((offsetX+input.vUV.x)*widthScale,(offsetY+input.vUV.y)*heightScale);var background: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);var voxelSlab: vec4f=textureSample(voxelSlabTexture,voxelSlabTextureSampler,input.vUV);var size: vec3u=textureDimensions(voxelTexture, i32(uniforms.mipNumber));var dimension: f32=ceil(sqrt( f32(size.z)));var samplePos: vec2f=fract(uv.xy* vec2f(dimension));var sampleIndex: u32= u32(floor(uv.x* f32(dimension)) + +floor(uv.y* f32(dimension))*dimension);var mip_separator: f32=0.0;if (samplePos.x<0.01 || samplePos.y<0.01) {mip_separator=1.0;} +var outBounds: bool=select(false,true,sampleIndex>size.z-1);sampleIndex=clamp(sampleIndex,0,size.z-1);var samplePosInt: vec2i= vec2i(samplePos.xy* vec2f(size.xy));var voxel: vec3f=textureLoad(voxelTexture, +vec3i(i32(samplePosInt.x),i32(samplePosInt.y),i32(sampleIndex)), +i32(uniforms.mipNumber)).rgb;if (uv.x<0.0 || uv.x>1.0 || uv.y<0.0 || uv.y>1.0) {fragmentOutputs.color=background;} else {if (outBounds) {voxel= vec3f(0.15,0.0,0.0);} else {voxel.r+=mip_separator;} +fragmentOutputs.color=vec4f(mix(background.rgb,voxelSlab.rgb,voxelSlab.a)+voxel,1.0);}}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=a);const i={name:e,shader:a};export{i as iblVoxelGrid3dDebugPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelSlabDebug.fragment-Bi2hd5wl.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelSlabDebug.fragment-Bi2hd5wl.js new file mode 100644 index 0000000000000000000000000000000000000000..4f1cb85ebdf1f64411cbe598fa8410faeb06407f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelSlabDebug.fragment-Bi2hd5wl.js @@ -0,0 +1,4 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const o="iblVoxelSlabDebugPixelShader",n=`varying vNormalizedPosition: vec3f;uniform nearPlane: f32;uniform farPlane: f32;uniform stepSize: f32;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var normPos: vec3f=input.vNormalizedPosition.xyz;var chunkSize: f32=uniforms.stepSize* f32(MAX_DRAW_BUFFERS);var numChunks: f32=1.0/chunkSize;var positionInChunk: f32=fract(normPos.z/chunkSize);var slab: f32=floor(positionInChunk* f32(MAX_DRAW_BUFFERS)) / +f32(MAX_DRAW_BUFFERS);if (normPos.x<0.0 || normPos.y<0.0 || normPos.z<0.0 || +normPos.x>1.0 || normPos.y>1.0 || normPos.z>1.0) {fragmentOutputs.color= vec4f(0.0,0.0,0.0,0.0);} else {fragmentOutputs.color= vec4f(slab,0.0,0.0,0.75);}}`;r.ShadersStoreWGSL[o]||(r.ShadersStoreWGSL[o]=n);const i={name:o,shader:n};export{i as iblVoxelSlabDebugPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelSlabDebug.fragment-_B5tZCzK.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelSlabDebug.fragment-_B5tZCzK.js new file mode 100644 index 0000000000000000000000000000000000000000..10ecbd76410e0a4dd1dd0a30288fdc43c1082d79 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelSlabDebug.fragment-_B5tZCzK.js @@ -0,0 +1,3 @@ +import{S as e}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const o="iblVoxelSlabDebugPixelShader",r=`precision highp float;varying vec3 vNormalizedPosition;uniform float nearPlane;uniform float farPlane;uniform float stepSize;void main(void) {vec3 normPos=vNormalizedPosition.xyz;float chunkSize=stepSize*float(MAX_DRAW_BUFFERS);float numChunks=1.0/chunkSize;float positionInChunk=fract(normPos.z/chunkSize);float slab=floor(positionInChunk*float(MAX_DRAW_BUFFERS)) / +float(MAX_DRAW_BUFFERS);if (normPos.x<0.0 || normPos.y<0.0 || normPos.z<0.0 || +normPos.x>1.0 || normPos.y>1.0 || normPos.z>1.0) {gl_FragColor=vec4(0.0,0.0,0.0,0.0);} else {gl_FragColor=vec4(slab,0.0,0.0,0.75);}}`;e.ShadersStore[o]||(e.ShadersStore[o]=r);const i={name:o,shader:r};export{i as iblVoxelSlabDebugPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelSlabDebug.vertex-BbpTawJd.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelSlabDebug.vertex-BbpTawJd.js new file mode 100644 index 0000000000000000000000000000000000000000..bfba711da37d64305f2e6550a3b54885fcccb213 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelSlabDebug.vertex-BbpTawJd.js @@ -0,0 +1 @@ +import{S as i}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const o="iblVoxelSlabDebugVertexShader",r="attribute vec3 position;varying vec3 vNormalizedPosition;uniform mat4 world;uniform mat4 invWorldScale;uniform mat4 cameraViewMatrix;uniform mat4 projection;uniform mat4 viewMatrix;void main(void) {vec4 worldPosition=(world*vec4(position,1.));gl_Position=projection*cameraViewMatrix*worldPosition;vNormalizedPosition=(viewMatrix*invWorldScale*worldPosition).rgb;vNormalizedPosition.xyz=vNormalizedPosition.xyz*vec3(0.5)+vec3(0.5);}";i.ShadersStore[o]||(i.ShadersStore[o]=r);const a={name:o,shader:r};export{a as iblVoxelSlabDebugVertexShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelSlabDebug.vertex-QoyC3MA9.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelSlabDebug.vertex-QoyC3MA9.js new file mode 100644 index 0000000000000000000000000000000000000000..c7e992f804c4300d7aaafd186180522d9dab6dc2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iblVoxelSlabDebug.vertex-QoyC3MA9.js @@ -0,0 +1,2 @@ +import{S as i}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const o="iblVoxelSlabDebugVertexShader",r=`attribute position: vec3f;varying vNormalizedPosition: vec3f;uniform world: mat4x4f;uniform invWorldScale: mat4x4f;uniform cameraViewMatrix: mat4x4f;uniform projection: mat4x4f;uniform viewMatrix: mat4x4f;@vertex +fn main(input : VertexInputs)->FragmentInputs {var worldPosition: vec4f=(uniforms.world* vec4f(input.position,1.));vertexOutputs.position=uniforms.projection*uniforms.cameraViewMatrix*worldPosition;vertexOutputs.vNormalizedPosition=(uniforms.viewMatrix*uniforms.invWorldScale*worldPosition).rgb;vertexOutputs.vNormalizedPosition=vertexOutputs.vNormalizedPosition* vec3f(0.5)+ vec3f(0.5);}`;i.ShadersStoreWGSL[o]||(i.ShadersStoreWGSL[o]=r);const n={name:o,shader:r};export{n as iblVoxelSlabDebugVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/id-ClfVqkNd.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/id-ClfVqkNd.js new file mode 100644 index 0000000000000000000000000000000000000000..cca1ca9246cb723044e36c434efd79a94e4fcee8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/id-ClfVqkNd.js @@ -0,0 +1 @@ +const a="Bahasa Indonesia",n={annotated_image:"Gambar Beranotasi"},e={allow_recording_access:"Mohon izinkan akses ke mikrofon untuk merekam.",audio:"Audio",record_from_microphone:"Rekam dari mikrofon",stop_recording:"Hentikan rekaman",no_device_support:"Perangkat media tidak dapat diakses. Pastikan Anda menjalankan dari sumber yang aman (https) atau localhost (atau Anda telah meneruskan sertifikat SSL yang valid ke ssl_verify), dan Anda telah mengizinkan akses browser ke perangkat Anda.",stop:"Berhenti",resume:"Lanjutkan",record:"Rekam",no_microphone:"Tidak ada mikrofon yang ditemukan",pause:"Jeda",play:"Putar",waiting:"Menunggu",drop_to_upload:"Letakkan file audio di sini untuk mengunggah"},i={connection_can_break:"Di perangkat seluler, koneksi dapat terputus jika tab ini tidak dalam fokus atau perangkat dalam mode tidur, sehingga Anda kehilangan posisi dalam antrian.",long_requests_queue:"Ada antrian panjang dari permintaan yang tertunda. Gandakan Ruang ini untuk melompati antrian.",lost_connection:"Koneksi terputus karena meninggalkan halaman. Bergabung kembali ke antrian...",waiting_for_inputs:"Menunggu file selesai diunggah, mohon coba lagi."},o={checkbox:"Kotak centang",checkbox_group:"Grup kotak centang"},r={code:"Kode"},t={color_picker:"Pemilih Warna"},d={built_with:"dibuat dengan",built_with_gradio:"Dibuat dengan Gradio",clear:"Bersihkan",download:"Unduh",edit:"Edit",empty:"Kosong",error:"Error",hosted_on:"Di-hosting di",loading:"Memuat",logo:"logo",or:"atau",remove:"Hapus",settings:"Pengaturan",share:"Bagikan",submit:"Kirim",undo:"Urungkan",no_devices:"Tidak ada perangkat yang ditemukan",language:"Bahasa",display_theme:"Tema Tampilan",pwa:"Aplikasi Web Progresif"},u={incorrect_format:"Format salah, hanya file CSV dan TSV yang didukung",new_column:"Tambah kolom",new_row:"Baris baru",add_row_above:"Tambah baris di atas",add_row_below:"Tambah baris di bawah",add_column_left:"Tambah kolom ke kiri",add_column_right:"Tambah kolom ke kanan",delete_row:"Hapus baris",delete_column:"Hapus kolom",sort_column:"Urutkan kolom",sort_ascending:"Urutkan menaik",sort_descending:"Urutkan menurun",drop_to_upload:"Letakkan file CSV atau TSV di sini untuk mengimpor data ke dataframe",clear_sort:"Bersihkan pengurutan"},s={dropdown:"Dropdown"},k={build_error:"ada error saat membangun",config_error:"ada error konfigurasi",contact_page_author:"Mohon hubungi penulis halaman untuk memberitahu mereka.",no_app_file:"tidak ada file aplikasi",runtime_error:"ada error runtime",space_not_working:'"Ruang tidak berfungsi karena" {0}',space_paused:"ruang sedang dijeda",use_via_api:"Gunakan melalui API"},l={uploading:"Mengunggah..."},g={highlighted_text:"Teks yang Disorot"},m={allow_webcam_access:"Mohon izinkan akses ke webcam untuk merekam.",brush_color:"Warna kuas",brush_radius:"Radius kuas",image:"Gambar",remove_image:"Hapus Gambar",select_brush_color:"Pilih warna kuas",start_drawing:"Mulai menggambar",use_brush:"Gunakan kuas",drop_to_upload:"Letakkan file gambar di sini untuk mengunggah"},c={label:"Label"},_={enable_cookies:"Jika Anda mengunjungi Ruang HuggingFace dalam mode Penyamaran, Anda harus mengaktifkan cookie pihak ketiga.",incorrect_credentials:"Kredensial salah",username:"nama pengguna",password:"kata sandi",login:"Masuk"},p={number:"Nomor"},h={plot:"Plot"},b={radio:"Tombol Radio"},f={slider:"Penggeser"},w={click_to_upload:"Klik untuk Mengunggah",drop_audio:"Letakkan Audio di Sini",drop_csv:"Letakkan CSV di Sini",drop_file:"Letakkan File di Sini",drop_image:"Letakkan Gambar di Sini",drop_video:"Letakkan Video di Sini",drop_gallery:"Letakkan Media di Sini",paste_clipboard:"Tempel dari Papan Klip"},y={drop_to_upload:"Letakkan file video di sini untuk mengunggah"},S={edit:"Edit",retry:"Coba lagi",undo:"Urungkan",submit:"Kirim",cancel:"Batal",like:"Suka",dislike:"Tidak Suka",clear:"Bersihkan obrolan"},T={_name:a,"3D_model":{"3d_model":"Model 3D",drop_to_upload:"Letakkan file model 3D (.obj, .glb, .stl, .gltf, .splat, atau .ply) di sini untuk mengunggah"},annotated_image:n,audio:e,blocks:i,checkbox:o,code:r,color_picker:t,common:d,dataframe:u,dropdown:s,errors:k,file:l,highlighted_text:g,image:m,label:c,login:_,number:p,plot:h,radio:b,slider:f,upload_text:w,video:y,chatbot:S};export{a as _name,n as annotated_image,e as audio,i as blocks,S as chatbot,o as checkbox,r as code,t as color_picker,d as common,u as dataframe,T as default,s as dropdown,k as errors,l as file,g as highlighted_text,m as image,c as label,_ as login,p as number,h as plot,b as radio,f as slider,w as upload_text,y as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iesTextureLoader-CjaJLPsO.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iesTextureLoader-CjaJLPsO.js new file mode 100644 index 0000000000000000000000000000000000000000..5ea3d01a2d807c73e34dfa22d3591acc899ef2e3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/iesTextureLoader-CjaJLPsO.js @@ -0,0 +1,2 @@ +import{bm as p}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";function O(t){return t.split(" ").filter(s=>s!=="").map(s=>parseFloat(s))}function x(t,s,o){for(;o.length!==s;){const n=O(t.lines[t.index++]);o.push(...n)}}function V(t,s,o){let n=0,e=0,i=0,u=0,f=0,h=0;for(let r=0;r0&&!n.lines[n.index].includes("TILT=");)n.index++;n.lines[n.index].includes("INCLUDE"),n.index++;const i=O(n.lines[n.index++]);e.numberOfLights=i[0],e.lumensPerLamp=i[1],e.candelaMultiplier=i[2],e.numberOfVerticalAngles=i[3],e.numberOfHorizontalAngles=i[4],e.photometricType=i[5],e.unitsType=i[6],e.width=i[7],e.length=i[8],e.height=i[9];const u=O(n.lines[n.index++]);e.ballastFactor=u[0],e.fileGenerationType=u[1],e.inputWatts=u[2];for(let l=0;l0)for(let l=0;l=d)&&(a%=d*2,a>d&&(a=d*2-a)),g[b+a*h]=V(e,b,a)}return{width:c/2,height:1,data:g}}class v{constructor(){this.supportCascades=!1}loadCubeData(){throw".ies not supported in Cube."}loadData(s,o,n){const e=new Uint8Array(s.buffer,s.byteOffset,s.byteLength),i=z(e);n(i.width,i.height,!!o.useMipMaps,!1,()=>{const u=o.getEngine();o.type=1,o.format=6,o._gammaSpace=!1,u._uploadDataToTextureDirectly(o,i.data)})}}export{v as _IESTextureLoader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/imageProcessing.fragment-B8CxpJrd.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/imageProcessing.fragment-B8CxpJrd.js new file mode 100644 index 0000000000000000000000000000000000000000..6f448a8995f7764412b343ff494962eccd2e1e0a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/imageProcessing.fragment-B8CxpJrd.js @@ -0,0 +1,18 @@ +import{S as r}from"./index-CDrXokXW.js";import"./imageProcessingFunctions-dvOnE6xp.js";import"./helperFunctions-BkWNqKeI.js";import"./index-DWyDLubb.js";const e="imageProcessingPixelShader",i=`varying vec2 vUV;uniform sampler2D textureSampler; +#include +#include +#include +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) +{vec4 result=texture2D(textureSampler,vUV);result.rgb=max(result.rgb,vec3(0.)); +#ifdef IMAGEPROCESSING +#ifndef FROMLINEARSPACE +result.rgb=toLinearSpace(result.rgb); +#endif +result=applyImageProcessing(result); +#else +#ifdef FROMLINEARSPACE +result=applyImageProcessing(result); +#endif +#endif +gl_FragColor=result;}`;r.ShadersStore[e]||(r.ShadersStore[e]=i);const o={name:e,shader:i};export{o as imageProcessingPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/imageProcessing.fragment-BiH-FQNj.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/imageProcessing.fragment-BiH-FQNj.js new file mode 100644 index 0000000000000000000000000000000000000000..12a7fb06f8bc362ffea1754fa80f380bb7e7ed89 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/imageProcessing.fragment-BiH-FQNj.js @@ -0,0 +1,18 @@ +import{S as r}from"./index-CDrXokXW.js";import"./imageProcessingFunctions-BbtoaTge.js";import"./helperFunctions-CZpZ-EbL.js";import"./index-DWyDLubb.js";const e="imageProcessingPixelShader",t=`varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d; +#include +#include +#include +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var result: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);result=vec4f(max(result.rgb,vec3f(0.)),result.a); +#ifdef IMAGEPROCESSING +#ifndef FROMLINEARSPACE +result=vec4f(toLinearSpaceVec3(result.rgb),result.a); +#endif +result=applyImageProcessing(result); +#else +#ifdef FROMLINEARSPACE +result=applyImageProcessing(result); +#endif +#endif +fragmentOutputs.color=result;}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=t);const l={name:e,shader:t};export{l as imageProcessingPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/imageProcessingFunctions-BbtoaTge.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/imageProcessingFunctions-BbtoaTge.js new file mode 100644 index 0000000000000000000000000000000000000000..36a98f99ef1f9bc298f22560f936551eadadea5f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/imageProcessingFunctions-BbtoaTge.js @@ -0,0 +1,89 @@ +import{S as e}from"./index-CDrXokXW.js";const r="imageProcessingDeclaration",o=`#ifdef EXPOSURE +uniform exposureLinear: f32; +#endif +#ifdef CONTRAST +uniform contrast: f32; +#endif +#if defined(VIGNETTE) || defined(DITHER) +uniform vInverseScreenSize: vec2f; +#endif +#ifdef VIGNETTE +uniform vignetteSettings1: vec4f;uniform vignetteSettings2: vec4f; +#endif +#ifdef COLORCURVES +uniform vCameraColorCurveNegative: vec4f;uniform vCameraColorCurveNeutral: vec4f;uniform vCameraColorCurvePositive: vec4f; +#endif +#ifdef COLORGRADING +#ifdef COLORGRADING3D +var txColorTransformSampler: sampler;var txColorTransform: texture_3d; +#else +var txColorTransformSampler: sampler;var txColorTransform: texture_2d; +#endif +uniform colorTransformSettings: vec4f; +#endif +#ifdef DITHER +uniform ditherIntensity: f32; +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=o);const t="imageProcessingFunctions",f=`#if TONEMAPPING==3 +const PBRNeutralStartCompression: f32=0.8-0.04;const PBRNeutralDesaturation: f32=0.15;fn PBRNeutralToneMapping( color: vec3f )->vec3f {var x: f32=min(color.r,min(color.g,color.b));var offset: f32=select(0.04,x-6.25*x*x,x<0.08);var result=color;result-=offset;var peak: f32=max(result.r,max(result.g,result.b));if (peakvec3f +{var a: vec3f=v*(v+0.0245786)-0.000090537;var b: vec3f=v*(0.983729*v+0.4329510)+0.238081;return a/b;} +fn ACESFitted(color: vec3f)->vec3f +{var output=ACESInputMat*color;output=RRTAndODTFit(output);output=ACESOutputMat*output;output=saturateVec3(output);return output;} +#endif +#define CUSTOM_IMAGEPROCESSINGFUNCTIONS_DEFINITIONS +fn applyImageProcessing(result: vec4f)->vec4f { +#define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATSTART +var rgb=result.rgb;; +#ifdef EXPOSURE +rgb*=uniforms.exposureLinear; +#endif +#ifdef VIGNETTE +var viewportXY: vec2f=fragmentInputs.position.xy*uniforms.vInverseScreenSize;viewportXY=viewportXY*2.0-1.0;var vignetteXY1: vec3f= vec3f(viewportXY*uniforms.vignetteSettings1.xy+uniforms.vignetteSettings1.zw,1.0);var vignetteTerm: f32=dot(vignetteXY1,vignetteXY1);var vignette: f32=pow(vignetteTerm,uniforms.vignetteSettings2.w);var vignetteColor: vec3f=uniforms.vignetteSettings2.rgb; +#ifdef VIGNETTEBLENDMODEMULTIPLY +var vignetteColorMultiplier: vec3f=mix(vignetteColor, vec3f(1,1,1),vignette);rgb*=vignetteColorMultiplier; +#endif +#ifdef VIGNETTEBLENDMODEOPAQUE +rgb=mix(vignetteColor,rgb,vignette); +#endif +#endif +#if TONEMAPPING==3 +rgb=PBRNeutralToneMapping(rgb); +#elif TONEMAPPING==2 +rgb=ACESFitted(rgb); +#elif TONEMAPPING==1 +const tonemappingCalibration: f32=1.590579;rgb=1.0-exp2(-tonemappingCalibration*rgb); +#endif +rgb=toGammaSpaceVec3(rgb);rgb=saturateVec3(rgb); +#ifdef CONTRAST +var resultHighContrast: vec3f=rgb*rgb*(3.0-2.0*rgb);if (uniforms.contrast<1.0) {rgb=mix( vec3f(0.5,0.5,0.5),rgb,uniforms.contrast);} else {rgb=mix(rgb,resultHighContrast,uniforms.contrast-1.0);} +rgb=max(rgb,vec3f(0.)); +#endif +#ifdef COLORGRADING +var colorTransformInput: vec3f=rgb*uniforms.colorTransformSettings.xxx+uniforms.colorTransformSettings.yyy; +#ifdef COLORGRADING3D +var colorTransformOutput: vec3f=textureSample(txColorTransform,txColorTransformSampler,colorTransformInput).rgb; +#else +var colorTransformOutput: vec3f=textureSample(txColorTransform,txColorTransformSampler,colorTransformInput,uniforms.colorTransformSettings.yz).rgb; +#endif +rgb=mix(rgb,colorTransformOutput,uniforms.colorTransformSettings.www); +#endif +#ifdef COLORCURVES +var luma: f32=getLuminance(rgb);var curveMix: vec2f=clamp( vec2f(luma*3.0-1.5,luma*-3.0+1.5), vec2f(0.0), vec2f(1.0));var colorCurve: vec4f=uniforms.vCameraColorCurveNeutral+curveMix.x*uniforms.vCameraColorCurvePositive-curveMix.y*uniforms.vCameraColorCurveNegative;rgb*=colorCurve.rgb;rgb=mix( vec3f(luma),rgb,colorCurve.a); +#endif +#ifdef DITHER +var rand: f32=getRand(fragmentInputs.position.xy*uniforms.vInverseScreenSize);var dither: f32=mix(-uniforms.ditherIntensity,uniforms.ditherIntensity,rand);rgb=saturateVec3(rgb+ vec3f(dither)); +#endif +#define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATEND +return vec4f(rgb,result.a);}`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=f); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/imageProcessingFunctions-dvOnE6xp.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/imageProcessingFunctions-dvOnE6xp.js new file mode 100644 index 0000000000000000000000000000000000000000..6b2c2c8dab3f86a589da1203b14c0b1f04ce8c6b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/imageProcessingFunctions-dvOnE6xp.js @@ -0,0 +1,115 @@ +import{S as e}from"./index-CDrXokXW.js";const r="imageProcessingDeclaration",o=`#ifdef EXPOSURE +uniform float exposureLinear; +#endif +#ifdef CONTRAST +uniform float contrast; +#endif +#if defined(VIGNETTE) || defined(DITHER) +uniform vec2 vInverseScreenSize; +#endif +#ifdef VIGNETTE +uniform vec4 vignetteSettings1;uniform vec4 vignetteSettings2; +#endif +#ifdef COLORCURVES +uniform vec4 vCameraColorCurveNegative;uniform vec4 vCameraColorCurveNeutral;uniform vec4 vCameraColorCurvePositive; +#endif +#ifdef COLORGRADING +#ifdef COLORGRADING3D +uniform highp sampler3D txColorTransform; +#else +uniform sampler2D txColorTransform; +#endif +uniform vec4 colorTransformSettings; +#endif +#ifdef DITHER +uniform float ditherIntensity; +#endif +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=o);const t="imageProcessingFunctions",i=`#if defined(COLORGRADING) && !defined(COLORGRADING3D) +/** +* Polyfill for SAMPLE_TEXTURE_3D,which is unsupported in WebGL. +* sampler3dSetting.x=textureOffset (0.5/textureSize). +* sampler3dSetting.y=textureSize. +*/ +#define inline +vec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting) +{float sliceSize=2.0*sampler3dSetting.x; +#ifdef SAMPLER3DGREENDEPTH +float sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y; +#else +float sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y; +#endif +float sliceInteger=floor(sliceContinuous);float sliceFraction=sliceContinuous-sliceInteger; +#ifdef SAMPLER3DGREENDEPTH +vec2 sliceUV=color.rb; +#else +vec2 sliceUV=color.rg; +#endif +sliceUV.x*=sliceSize;sliceUV.x+=sliceInteger*sliceSize;sliceUV=saturate(sliceUV);vec4 slice0Color=texture2D(colorTransform,sliceUV);sliceUV.x+=sliceSize;sliceUV=saturate(sliceUV);vec4 slice1Color=texture2D(colorTransform,sliceUV);vec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction); +#ifdef SAMPLER3DBGRMAP +color.rgb=result.rgb; +#else +color.rgb=result.bgr; +#endif +return color;} +#endif +#if TONEMAPPING==3 +const float PBRNeutralStartCompression=0.8-0.04;const float PBRNeutralDesaturation=0.15;vec3 PBRNeutralToneMapping( vec3 color ) {float x=min(color.r,min(color.g,color.b));float offset=x<0.08 ? x-6.25*x*x : 0.04;color-=offset;float peak=max(color.r,max(color.g,color.b));if (peakt=>{try{JSON.parse(t.state.doc.toString())}catch(O){if(!(O instanceof SyntaxError))throw O;const e=l(O,t.state.doc);return[{from:e,message:O.message,severity:"error",to:e}]}return[]};function l(t,O){let e;return(e=t.message.match(/at position (\d+)/))?Math.min(+e[1],O.length):(e=t.message.match(/at line (\d+) column (\d+)/))?Math.min(O.line(+e[1]).from+ +e[2]-1,O.length):0}const m=P.define({name:"json",parser:p.configure({props:[Q.add({Object:a({except:/^\s*\}/}),Array:a({except:/^\s*\]/})}),i.add({"Object Array":c})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function h(){return new o(m)}export{h as json,m as jsonLanguage,f as jsonParseLinter}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-B2xAlaja.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-B2xAlaja.js new file mode 100644 index 0000000000000000000000000000000000000000..35beb6144d2917c7340b3247a344caecf3702ff7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-B2xAlaja.js @@ -0,0 +1 @@ +import{L as w,E as p,a as Y}from"./index-DUwqQ_4P.js";import{s as x,t as r,L as q,e as j,g as G,H as R,f as T,c as E,d as _,j as C,I as U}from"./Code-BLWhl1y6.js";import"./i18n-Dnhn5Rxr.js";import"./index-DWyDLubb.js";const V=122,g=1,Z=123,W=124,b=2,N=125,I=3,F=4,X=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],D=58,B=40,k=95,K=91,c=45,L=46,A=35,J=37,H=38,M=92,ee=10,Oe=42;function d(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function S(e){return e>=48&&e<=57}function h(e){return S(e)||e>=97&&e<=102||e>=65&&e<=70}const z=(e,t,i)=>(O,a)=>{for(let o=!1,l=0,Q=0;;Q++){let{next:s}=O;if(d(s)||s==c||s==k||o&&S(s))!o&&(s!=c||Q>0)&&(o=!0),l===Q&&s==c&&l++,O.advance();else if(s==M&&O.peek(1)!=ee){if(O.advance(),h(O.next)){do O.advance();while(h(O.next));O.next==32&&O.advance()}else O.next>-1&&O.advance();o=!0}else{o&&O.acceptToken(l==2&&a.canShift(b)?t:s==B?i:e);break}}},ae=new p(z(Z,b,W)),te=new p(z(N,I,F)),re=new p(e=>{if(X.includes(e.peek(-1))){let{next:t}=e;(d(t)||t==k||t==A||t==L||t==Oe||t==K||t==D&&d(e.peek(1))||t==c||t==H)&&e.acceptToken(V)}}),oe=new p(e=>{if(!X.includes(e.peek(-1))){let{next:t}=e;if(t==J&&(e.advance(),e.acceptToken(g)),d(t)){do e.advance();while(d(e.next)||S(e.next));e.acceptToken(g)}}}),le=x({"AtKeyword import charset namespace keyframes media supports":r.definitionKeyword,"from to selector":r.keyword,NamespaceName:r.namespace,KeyframeName:r.labelName,KeyframeRangeName:r.operatorKeyword,TagName:r.tagName,ClassName:r.className,PseudoClassName:r.constant(r.className),IdName:r.labelName,"FeatureName PropertyName":r.propertyName,AttributeName:r.attributeName,NumberLiteral:r.number,KeywordQuery:r.keyword,UnaryQueryOp:r.operatorKeyword,"CallTag ValueName":r.atom,VariableName:r.variableName,Callee:r.operatorKeyword,Unit:r.unit,"UniversalSelector NestingSelector":r.definitionOperator,"MatchOp CompareOp":r.compareOperator,"ChildOp SiblingOp, LogicOp":r.logicOperator,BinOp:r.arithmeticOperator,Important:r.modifier,Comment:r.blockComment,ColorLiteral:r.color,"ParenthesizedContent StringLiteral":r.string,":":r.punctuation,"PseudoOp #":r.derefOperator,"; ,":r.separator,"( )":r.paren,"[ ]":r.squareBracket,"{ }":r.brace}),ie={__proto__:null,lang:38,"nth-child":38,"nth-last-child":38,"nth-of-type":38,"nth-last-of-type":38,dir:38,"host-context":38,if:84,url:124,"url-prefix":124,domain:124,regexp:124},Qe={__proto__:null,or:98,and:98,not:106,only:106,layer:170},se={__proto__:null,selector:112,layer:166},ne={__proto__:null,"@import":162,"@media":174,"@charset":178,"@namespace":182,"@keyframes":188,"@supports":200,"@scope":204},de={__proto__:null,to:207},ce=w.deserialize({version:14,states:"EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#DuO%_QdO'#DxOOQP'#FV'#FVO&eQhO'#EhOOQS'#FU'#FUOOQS'#Ek'#EkQYQdOOO&lQdO'#EOO&PQhO'#EUO&lQdO'#EWO'aQdO'#EYO'lQdO'#E]O'tQhO'#EcO(VQdO'#EeO(bQaO'#CfO)VQ`O'#D{O)[Q`O'#F`O)gQdO'#F`QOQ`OOP)qO&jO'#CaPOOO)C@t)C@tOOQP'#Cj'#CjOOQP,59S,59SO#}QdO,59SO)|QdO,59VO%TQdO,5:[O%YQdO,5:^O%_QdO,5:aO%_QdO,5:cO%_QdO,5:dO%_QdO'#ErO*XQ`O,58}O*aQdO'#DzOOQS,58},58}OOQP'#Cn'#CnOOQO'#Dn'#DnOOQP,59V,59VO*hQ`O,59VO*mQ`O,59VOOQP'#Dq'#DqOOQP,5:[,5:[OOQO'#Ds'#DsO*rQpO,5:^O+]QaO,5:aO+sQaO,5:dOOQW'#DZ'#DZO,ZQhO'#DdO,xQhO'#FaO'tQhO'#DbO-WQ`O'#DhOOQW'#F['#F[O-]Q`O,5;SO-eQ`O'#DeOOQS-E8i-E8iOOQ['#Cs'#CsO-jQdO'#CtO.QQdO'#CzO.hQdO'#C}O/OQ!pO'#DPO1RQ!jO,5:jOOQO'#DU'#DUO*mQ`O'#DTO1cQ!nO'#FXO3`Q`O'#DVO3eQ`O'#DkOOQ['#FX'#FXO-`Q`O,5:pO3jQ!bO,5:rOOQS'#E['#E[O3rQ`O,5:tO3wQdO,5:tOOQO'#E_'#E_O4PQ`O,5:wO4UQhO,5:}O%_QdO'#DgOOQS,5;P,5;PO-eQ`O,5;PO4^QdO,5;PO4fQdO,5:gO4vQdO'#EtO5TQ`O,5;zO5TQ`O,5;zPOOO'#Ej'#EjP5`O&jO,58{POOO,58{,58{OOQP1G.n1G.nOOQP1G.q1G.qO*hQ`O1G.qO*mQ`O1G.qOOQP1G/v1G/vO5kQpO1G/xO5sQaO1G/{O6ZQaO1G/}O6qQaO1G0OO7XQaO,5;^OOQO-E8p-E8pOOQS1G.i1G.iO7cQ`O,5:fO7hQdO'#DoO7oQdO'#CrOOQP1G/x1G/xO&lQdO1G/xO7vQ!jO'#DZO8UQ!bO,59vO8^QhO,5:OOOQO'#F]'#F]O8XQ!bO,59zO'tQhO,59xO8fQhO'#EvO8sQ`O,5;{O9OQhO,59|O9uQhO'#DiOOQW,5:S,5:SOOQS1G0n1G0nOOQW,5:P,5:PO9|Q!fO'#FYOOQS'#FY'#FYOOQS'#Em'#EmO;^QdO,59`OOQ[,59`,59`O;tQdO,59fOOQ[,59f,59fO<[QdO,59iOOQ[,59i,59iOOQ[,59k,59kO&lQdO,59mOPQ!fO1G0ROOQO1G0R1G0ROOQO,5;`,5;`O>gQdO,5;`OOQO-E8r-E8rO>tQ`O1G1fPOOO-E8h-E8hPOOO1G.g1G.gOOQP7+$]7+$]OOQP7+%d7+%dO&lQdO7+%dOOQS1G0Q1G0QO?PQaO'#F_O?ZQ`O,5:ZO?`Q!fO'#ElO@^QdO'#FWO@hQ`O,59^O@mQ!bO7+%dO&lQdO1G/bO@uQhO1G/fOOQW1G/j1G/jOOQW1G/d1G/dOAWQhO,5;bOOQO-E8t-E8tOAfQhO'#DZOAtQhO'#F^OBPQ`O'#F^OBUQ`O,5:TOOQS-E8k-E8kOOQ[1G.z1G.zOOQ[1G/Q1G/QOOQ[1G/T1G/TOOQ[1G/X1G/XOBZQdO,5:lOOQS7+%p7+%pOB`Q`O7+%pOBeQhO'#DYOBmQ`O,59sO'tQhO,59sOOQ[1G/q1G/qOBuQ`O1G/qOOQS7+%z7+%zOBzQbO'#DPOOQO'#Eb'#EbOCYQ`O'#EaOOQO'#Ea'#EaOCeQ`O'#EwOCmQdO,5:zOOQS,5:z,5:zOOQ[1G/m1G/mOOQS7+&V7+&VO-`Q`O7+&VOCxQ!fO'#EsO&lQdO'#EsOEPQdO7+%mOOQO7+%m7+%mOOQO1G0z1G0zOEdQ!bO<jAN>jOIUQaO,5;]OOQO-E8o-E8oOI`QdO,5;[OOQO-E8n-E8nOOQW<WO&lQdO1G0uOK]Q`O7+'OOOQO,5;a,5;aOOQO-E8s-E8sOOQW<t}!O?V!O!P?t!P!Q@]!Q![AU![!]BP!]!^B{!^!_C^!_!`DY!`!aDm!a!b$q!b!cEn!c!}$q!}#OG{#O#P$q#P#QH^#Q#R6W#R#o$q#o#pHo#p#q6W#q#rIQ#r#sIc#s#y$q#y#z%i#z$f$q$f$g%i$g#BY$q#BY#BZ%i#BZ$IS$q$IS$I_%i$I_$I|$q$I|$JO%i$JO$JT$q$JT$JU%i$JU$KV$q$KV$KW%i$KW&FU$q&FU&FV%i&FV;'S$q;'S;=`Iz<%lO$q`$tSOy%Qz;'S%Q;'S;=`%c<%lO%Q`%VS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q`%fP;=`<%l%Q~%nh#s~OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Q~'ah#s~!a`OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Qj)OUOy%Qz#]%Q#]#^)b#^;'S%Q;'S;=`%c<%lO%Qj)gU!a`Oy%Qz#a%Q#a#b)y#b;'S%Q;'S;=`%c<%lO%Qj*OU!a`Oy%Qz#d%Q#d#e*b#e;'S%Q;'S;=`%c<%lO%Qj*gU!a`Oy%Qz#c%Q#c#d*y#d;'S%Q;'S;=`%c<%lO%Qj+OU!a`Oy%Qz#f%Q#f#g+b#g;'S%Q;'S;=`%c<%lO%Qj+gU!a`Oy%Qz#h%Q#h#i+y#i;'S%Q;'S;=`%c<%lO%Qj,OU!a`Oy%Qz#T%Q#T#U,b#U;'S%Q;'S;=`%c<%lO%Qj,gU!a`Oy%Qz#b%Q#b#c,y#c;'S%Q;'S;=`%c<%lO%Qj-OU!a`Oy%Qz#h%Q#h#i-b#i;'S%Q;'S;=`%c<%lO%Qj-iS!qY!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q~-xWOY-uZr-urs.bs#O-u#O#P.g#P;'S-u;'S;=`/c<%lO-u~.gOt~~.jRO;'S-u;'S;=`.s;=`O-u~.vXOY-uZr-urs.bs#O-u#O#P.g#P;'S-u;'S;=`/c;=`<%l-u<%lO-u~/fP;=`<%l-uj/nYjYOy%Qz!Q%Q!Q![0^![!c%Q!c!i0^!i#T%Q#T#Z0^#Z;'S%Q;'S;=`%c<%lO%Qj0cY!a`Oy%Qz!Q%Q!Q![1R![!c%Q!c!i1R!i#T%Q#T#Z1R#Z;'S%Q;'S;=`%c<%lO%Qj1WY!a`Oy%Qz!Q%Q!Q![1v![!c%Q!c!i1v!i#T%Q#T#Z1v#Z;'S%Q;'S;=`%c<%lO%Qj1}YrY!a`Oy%Qz!Q%Q!Q![2m![!c%Q!c!i2m!i#T%Q#T#Z2m#Z;'S%Q;'S;=`%c<%lO%Qj2tYrY!a`Oy%Qz!Q%Q!Q![3d![!c%Q!c!i3d!i#T%Q#T#Z3d#Z;'S%Q;'S;=`%c<%lO%Qj3iY!a`Oy%Qz!Q%Q!Q![4X![!c%Q!c!i4X!i#T%Q#T#Z4X#Z;'S%Q;'S;=`%c<%lO%Qj4`YrY!a`Oy%Qz!Q%Q!Q![5O![!c%Q!c!i5O!i#T%Q#T#Z5O#Z;'S%Q;'S;=`%c<%lO%Qj5TY!a`Oy%Qz!Q%Q!Q![5s![!c%Q!c!i5s!i#T%Q#T#Z5s#Z;'S%Q;'S;=`%c<%lO%Qj5zSrY!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Qd6ZUOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Qd6tS!hS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Qb7VSZQOy%Qz;'S%Q;'S;=`%c<%lO%Q~7fWOY7cZw7cwx.bx#O7c#O#P8O#P;'S7c;'S;=`8z<%lO7c~8RRO;'S7c;'S;=`8[;=`O7c~8_XOY7cZw7cwx.bx#O7c#O#P8O#P;'S7c;'S;=`8z;=`<%l7c<%lO7c~8}P;=`<%l7cj9VSeYOy%Qz;'S%Q;'S;=`%c<%lO%Q~9hOd~n9oUWQvWOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Qj:YWvW!mQOy%Qz!O%Q!O!P:r!P!Q%Q!Q![=w![;'S%Q;'S;=`%c<%lO%Qj:wU!a`Oy%Qz!Q%Q!Q![;Z![;'S%Q;'S;=`%c<%lO%Qj;bY!a`#}YOy%Qz!Q%Q!Q![;Z![!g%Q!g!hO[!a`#}YOy%Qz!O%Q!O!P;Z!P!Q%Q!Q![=w![!g%Q!g!hyS!^YOy%Qz;'S%Q;'S;=`%c<%lO%Qj?[WvWOy%Qz!O%Q!O!P:r!P!Q%Q!Q![=w![;'S%Q;'S;=`%c<%lO%Qj?yU]YOy%Qz!Q%Q!Q![;Z![;'S%Q;'S;=`%c<%lO%Q~@bTvWOy%Qz{@q{;'S%Q;'S;=`%c<%lO%Q~@xS!a`#t~Oy%Qz;'S%Q;'S;=`%c<%lO%QjAZ[#}YOy%Qz!O%Q!O!P;Z!P!Q%Q!Q![=w![!g%Q!g!hie[e]||-1},{term:125,get:e=>Qe[e]||-1},{term:4,get:e=>se[e]||-1},{term:25,get:e=>ne[e]||-1},{term:123,get:e=>de[e]||-1}],tokenPrec:1963});let m=null;function u(){if(!m&&typeof document=="object"&&document.body){let{style:e}=document.body,t=[],i=new Set;for(let O in e)O!="cssText"&&O!="cssFloat"&&typeof e[O]=="string"&&(/[A-Z]/.test(O)&&(O=O.replace(/[A-Z]/g,a=>"-"+a.toLowerCase())),i.has(O)||(t.push(O),i.add(O)));m=t.sort().map(O=>({type:"property",label:O,apply:O+": "}))}return m||[]}const f=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(e=>({type:"class",label:e})),y=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(e=>({type:"keyword",label:e})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(e=>({type:"constant",label:e}))),pe=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(e=>({type:"type",label:e})),me=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(e=>({type:"keyword",label:e})),n=/^(\w[\w-]*|-\w[\w-]*|)$/,ue=/^-(-[\w-]*)?$/;function Se(e,t){var i;if((e.name=="("||e.type.isError)&&(e=e.parent||e),e.name!="ArgList")return!1;let O=(i=e.parent)===null||i===void 0?void 0:i.firstChild;return O?.name!="Callee"?!1:t.sliceString(O.from,O.to)=="var"}const $=new C,ge=["Declaration"];function he(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function v(e,t,i){if(t.to-t.from>4096){let O=$.get(t);if(O)return O;let a=[],o=new Set,l=t.cursor(U.IncludeAnonymous);if(l.firstChild())do for(let Q of v(e,l.node,i))o.has(Q.label)||(o.add(Q.label),a.push(Q));while(l.nextSibling());return $.set(t,a),a}else{let O=[],a=new Set;return t.cursor().iterate(o=>{var l;if(i(o)&&o.matchContext(ge)&&((l=o.node.nextSibling)===null||l===void 0?void 0:l.name)==":"){let Q=e.sliceString(o.from,o.to);a.has(Q)||(a.add(Q),O.push({label:Q,type:"variable"}))}}),O}}const fe=e=>t=>{let{state:i,pos:O}=t,a=_(i).resolveInner(O,-1),o=a.type.isError&&a.from==a.to-1&&i.doc.sliceString(a.from,a.to)=="-";if(a.name=="PropertyName"||(o||a.name=="TagName")&&/^(Block|Styles)$/.test(a.resolve(a.to).name))return{from:a.from,options:u(),validFor:n};if(a.name=="ValueName")return{from:a.from,options:y,validFor:n};if(a.name=="PseudoClassName")return{from:a.from,options:f,validFor:n};if(e(a)||(t.explicit||o)&&Se(a,i.doc))return{from:e(a)||o?a.from:O,options:v(i.doc,he(a),e),validFor:ue};if(a.name=="TagName"){for(let{parent:s}=a;s;s=s.parent)if(s.name=="Block")return{from:a.from,options:u(),validFor:n};return{from:a.from,options:pe,validFor:n}}if(a.name=="AtKeyword")return{from:a.from,options:me,validFor:n};if(!t.explicit)return null;let l=a.resolve(O),Q=l.childBefore(O);return Q&&Q.name==":"&&l.name=="PseudoClassSelector"?{from:O,options:f,validFor:n}:Q&&Q.name==":"&&l.name=="Declaration"||l.name=="ArgList"?{from:O,options:y,validFor:n}:l.name=="Block"||l.name=="Styles"?{from:O,options:u(),validFor:n}:null},ye=fe(e=>e.name=="VariableName"),P=j.define({name:"css",parser:ce.configure({props:[G.add({Declaration:R()}),T.add({"Block KeyframeList":E})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function ke(){return new q(P,P.data.of({autocomplete:ye}))}export{ke as css,ye as cssCompletionSource,P as cssLanguage,fe as defineCSSCompletionSource}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-BRj5epc3.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-BRj5epc3.js new file mode 100644 index 0000000000000000000000000000000000000000..3c0cee50b581552ff60fbb2672d60a2f54fe32b8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-BRj5epc3.js @@ -0,0 +1 @@ +import{L as f,S as L,S as d}from"./index-CglBvmLb.js";import{L as x,T}from"./state.svelte-CXxGByZZ.js";import{S as n}from"./StreamingBar-Cb4g-rUI.js";import"./i18n-Dnhn5Rxr.js";import"./index-DWyDLubb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./html-Ih_5QVTo.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import"./snippet-BWgYNF9D.js";import"./index-B_pwUImq.js";import"./Clear-BF6j078A.js";export{f as Loader,x as LoadingStatus,L as StatusTracker,n as StreamingBar,T as Toast,d as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-BU4IRnz1.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-BU4IRnz1.js new file mode 100644 index 0000000000000000000000000000000000000000..8add9002ab99778fb9713232f701345fe32fab57 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-BU4IRnz1.js @@ -0,0 +1 @@ +function x(n){var e=0,i=n.children,r=i&&i.length;if(!r)e=1;else for(;--r>=0;)e+=i[r].value;n.value=e}function I(){return this.eachAfter(x)}function S(n,e){let i=-1;for(const r of this)n.call(e,r,++i,this);return this}function T(n,e){for(var i=this,r=[i],a,o,u=-1;i=r.pop();)if(n.call(e,i,++u,this),a=i.children)for(o=a.length-1;o>=0;--o)r.push(a[o]);return this}function V(n,e){for(var i=this,r=[i],a=[],o,u,c,s=-1;i=r.pop();)if(a.push(i),o=i.children)for(u=0,c=o.length;u=0;)i+=r[a].value;e.value=i})}function b(n){return this.eachBefore(function(e){e.children&&e.children.sort(n)})}function D(n){for(var e=this,i=O(e,n),r=[e];e!==i;)e=e.parent,r.push(e);for(var a=r.length;n!==i;)r.splice(a,0,n),n=n.parent;return r}function O(n,e){if(n===e)return n;var i=n.ancestors(),r=e.ancestors(),a=null;for(n=i.pop(),e=r.pop();n===e;)a=n,n=i.pop(),e=r.pop();return a}function j(){for(var n=this,e=[n];n=n.parent;)e.push(n);return e}function z(){return Array.from(this)}function E(){var n=[];return this.eachBefore(function(e){e.children||n.push(e)}),n}function H(){var n=this,e=[];return n.each(function(i){i!==n&&e.push({source:i.parent,target:i})}),e}function*Z(){var n=this,e,i=[n],r,a,o;do for(e=i.reverse(),i=[];n=e.pop();)if(yield n,r=n.children)for(a=0,o=r.length;a=0;--c)a.push(o=u[c]=new A(u[c])),o.parent=r,o.depth=r.depth+1;return i.eachBefore(P)}function F(){return R(this).eachBefore(K)}function G(n){return n.children}function J(n){return Array.isArray(n)?n[1]:null}function K(n){n.data.value!==void 0&&(n.value=n.data.value),n.data=n.data.data}function P(n){var e=0;do n.height=e;while((n=n.parent)&&n.height<++e)}function A(n){this.data=n,this.depth=this.height=0,this.parent=null}A.prototype=R.prototype={constructor:A,count:I,each:S,eachAfter:V,eachBefore:T,find:C,sum:L,sort:b,path:D,ancestors:j,descendants:z,leaves:E,links:H,copy:F,[Symbol.iterator]:Z};function nn(n){return n==null?null:q(n)}function q(n){if(typeof n!="function")throw new Error;return n}function _(){return 0}function B(n){return function(){return n}}function Q(n){n.x0=Math.round(n.x0),n.y0=Math.round(n.y0),n.x1=Math.round(n.x1),n.y1=Math.round(n.y1)}function U(n,e,i,r,a){for(var o=n.children,u,c=-1,s=o.length,v=n.value&&(r-e)/n.value;++cw&&(w=v),y=f*f*N,M=Math.max(w/y,y/g),M>k){f-=v;break}k=M}u.push(s={value:f,dice:d1?r:1)},i})(X);function en(){var n=$,e=!1,i=1,r=1,a=[0],o=_,u=_,c=_,s=_,v=_;function h(t){return t.x0=t.y0=0,t.x1=i,t.y1=r,t.eachBefore(m),a=[0],e&&t.eachBefore(Q),t}function m(t){var d=a[t.depth],p=t.x0+d,l=t.y0+d,f=t.x1-d,g=t.y1-d;fJSON.parse(JSON.stringify(e)),j=e=>e.nodeType===1,R=e=>ce.has(e.tagName),D=e=>"action"in e,q=e=>e.tagName==="IFRAME",V=e=>"formAction"in e,B=e=>"protocol"in e,f=(()=>{const e=/^(?:\w+script|data):/i;return t=>e.test(t)})(),$=(()=>{const e=/(?:script|data):/i;return t=>e.test(t)})(),J=e=>{const t={};for(let r=0,o=e.length;r{let r=e.firstChild;for(;r;){const o=r.nextSibling;j(r)&&(t(r,e),r.parentNode&&x(r,t)),r=o}},K=(e,t)=>{const r=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT);let o;for(;o=r.nextNode();){const n=o.parentNode;n&&t(o,n)}},X=(e,t)=>!!globalThis.document&&!!globalThis.document.createNodeIterator?K(e,t):x(e,t),L=["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","bgsound","big","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","keygen","label","layer","legend","li","link","listing","main","map","mark","marquee","menu","meta","meter","nav","nobr","ol","optgroup","option","output","p","picture","popup","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","section","select","selectmenu","small","source","span","strike","strong","style","sub","summary","sup","table","tbody","td","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"],Y=["basefont","command","data","iframe","image","plaintext","portal","slot","textarea","title","xmp"],Q=new Set([...L,...Y]),_=["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"],Z=["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"],ee=new Set([..._,...Z]),N=["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"],te=["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"],re=new Set([...N,...te]),oe=["abbr","accept","accept-charset","accesskey","action","align","alink","allow","allowfullscreen","alt","anchor","archive","as","async","autocapitalize","autocomplete","autocorrect","autofocus","autopictureinpicture","autoplay","axis","background","behavior","bgcolor","border","bordercolor","capture","cellpadding","cellspacing","challenge","char","charoff","charset","checked","cite","class","classid","clear","code","codebase","codetype","color","cols","colspan","compact","content","contenteditable","controls","controlslist","conversiondestination","coords","crossorigin","csp","data","datetime","declare","decoding","default","defer","dir","direction","dirname","disabled","disablepictureinpicture","disableremoteplayback","disallowdocumentaccess","download","draggable","elementtiming","enctype","end","enterkeyhint","event","exportparts","face","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","frame","frameborder","headers","height","hidden","high","href","hreflang","hreftranslate","hspace","http-equiv","id","imagesizes","imagesrcset","importance","impressiondata","impressionexpiry","incremental","inert","inputmode","integrity","invisible","ismap","keytype","kind","label","lang","language","latencyhint","leftmargin","link","list","loading","longdesc","loop","low","lowsrc","manifest","marginheight","marginwidth","max","maxlength","mayscript","media","method","min","minlength","multiple","muted","name","nohref","nomodule","nonce","noresize","noshade","novalidate","nowrap","object","open","optimum","part","pattern","ping","placeholder","playsinline","policy","poster","preload","pseudo","readonly","referrerpolicy","rel","reportingorigin","required","resources","rev","reversed","role","rows","rowspan","rules","sandbox","scheme","scope","scopes","scrollamount","scrolldelay","scrolling","select","selected","shadowroot","shadowrootdelegatesfocus","shape","size","sizes","slot","span","spellcheck","src","srclang","srcset","standby","start","step","style","summary","tabindex","target","text","title","topmargin","translate","truespeed","trusttoken","type","usemap","valign","value","valuetype","version","virtualkeyboardpolicy","vlink","vspace","webkitdirectory","width","wrap"],ae=["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"],ne=["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"],s={HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",MATH:"http://www.w3.org/1998/Math/MathML"},se={[s.HTML]:Q,[s.SVG]:ee,[s.MATH]:re},ie={[s.HTML]:"html",[s.SVG]:"svg",[s.MATH]:"math"},le={[s.HTML]:"",[s.SVG]:"svg:",[s.MATH]:"math:"},ce=new Set(["A","AREA","BUTTON","FORM","IFRAME","INPUT"]),O={allowComments:!0,allowCustomElements:!1,allowUnknownMarkup:!1,allowElements:[...L,..._.map(e=>`svg:${e}`),...N.map(e=>`math:${e}`)],allowAttributes:J([Object.fromEntries(oe.map(e=>[e,["*"]])),Object.fromEntries(ae.map(e=>[e,["svg:*"]])),Object.fromEntries(ne.map(e=>[e,["math:*"]]))])};var b=function(e,t,r,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r},c=function(e,t,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(e):o?o.value:t.get(e)},l,h,g;class me{constructor(t={}){l.set(this,void 0),h.set(this,void 0),g.set(this,void 0),this.getConfiguration=()=>E(c(this,l,"f")),this.sanitize=p=>{const d=c(this,h,"f"),z=c(this,g,"f");return X(p,(a,v)=>{const u=a.namespaceURI||s.HTML,P=v.namespaceURI||s.HTML,U=se[u],G=ie[u],A=le[u],w=a.tagName.toLowerCase(),k=`${A}${w}`,W=`${A}*`;if(!U.has(w)||!d.has(k)||u!==P&&w!==G)v.removeChild(a);else{const T=a.getAttributeNames(),M=T.length;if(M){for(let m=0;m{throw new Error('"sanitizeFor" is not implemented yet')};const{allowComments:r,allowCustomElements:o,allowUnknownMarkup:n,blockElements:i,dropElements:C,dropAttributes:F}=t;if(r===!1)throw new Error('A false "allowComments" is not supported yet');if(o)throw new Error('A true "allowCustomElements" is not supported yet');if(n)throw new Error('A true "allowUnknownMarkup" is not supported yet');if(i)throw new Error('"blockElements" is not supported yet, use "allowElements" instead');if(C)throw new Error('"dropElements" is not supported yet, use "allowElements" instead');if(F)throw new Error('"dropAttributes" is not supported yet, use "allowAttributes" instead');b(this,l,E(O),"f");const{allowElements:H,allowAttributes:I}=t;H&&(c(this,l,"f").allowElements=t.allowElements),I&&(c(this,l,"f").allowAttributes=t.allowAttributes),b(this,h,new Set(c(this,l,"f").allowElements),"f"),b(this,g,Object.fromEntries(Object.entries(c(this,l,"f").allowAttributes||{}).map(([p,d])=>[p,new Set(d)])),"f")}}l=new WeakMap,h=new WeakMap,g=new WeakMap;me.getDefaultConfiguration=()=>E(O);export{me as A}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-CDrXokXW.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-CDrXokXW.js new file mode 100644 index 0000000000000000000000000000000000000000..e5e3735b86f152282eef57e3b8153c2c8971cbcb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-CDrXokXW.js @@ -0,0 +1,467 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./background.vertex-Ck4dF8t7.js","./backgroundUboDeclaration-hBNOFfW-.js","./sceneUboDeclaration-BH1tZjjY.js","./helperFunctions-CZpZ-EbL.js","./bonesDeclaration-Bh_c0MF7.js","./instancesVertex-CO_CTxxp.js","./instancesDeclaration-DZdrWbmN.js","./clipPlaneVertex-J3Krgsee.js","./logDepthVertex-D_A6gsii.js","./shadowsVertex-CygJ_RUp.js","./logDepthDeclaration-DkdfQs4e.js","./bonesVertex-bl6LLSA1.js","./bakedVertexAnimation-DoavwM49.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./background.fragment-DVcvlYwn.js","./shadowsFragmentFunctions-CTsFFgyf.js","./imageProcessingFunctions-BbtoaTge.js","./lightsFragmentFunctions-DcPOaMby.js","./clipPlaneFragment-C7XUrTAZ.js","./fogFragment-DmA8Y7To.js","./lightFragment-DhtXFpEE.js","./background.vertex-DsMHrPHo.js","./backgroundUboDeclaration-CKc0A7bZ.js","./sceneUboDeclaration-C4vXUqkq.js","./helperFunctions-BkWNqKeI.js","./bakedVertexAnimation-BwUJBnNt.js","./instancesDeclaration-BAnfKLCo.js","./clipPlaneVertex-Bmw4TNCQ.js","./logDepthVertex-DDooPwab.js","./shadowsVertex-DbGd-etA.js","./logDepthDeclaration-DbMKMukk.js","./background.fragment-a1OuescW.js","./shadowsFragmentFunctions-QR4_Qrt1.js","./imageProcessingFunctions-dvOnE6xp.js","./lightsFragmentFunctions-nqjCe5ZE.js","./lightFragment-BRK1HqYL.js","./clipPlaneFragment-T8W7CIC5.js","./fogFragment-R9KOnWn-.js","./postprocess.vertex-Be8DwgEx.js","./dumpTools-C3pGK_mZ.js","./dds-DwCXTB3r.js","./abstractEngine.cubeTexture-BasnejWx.js","./iesTextureLoader-CjaJLPsO.js","./ddsTextureLoader-HyrebNeu.js","./basisTextureLoader-BZgL1qDr.js","./envTextureLoader-Dy75k5v5.js","./environmentTextureTools-BFR5JSi6.js","./hdrTextureLoader-BTuqRXGJ.js","./hdr-mXhboeO4.js","./ktxTextureLoader-DMjs-eqh.js","./workerPool-CfMXSLnf.js","./tgaTextureLoader-BmfDIWUh.js","./exrTextureLoader-BpOmAN3q.js","./pass.fragment-CTt6kMR9.js","./pass.fragment-DOtTp0aB.js","./passCube.fragment-CZ0sbEYV.js","./passCube.fragment-plsc4uSf.js","./rgbdDecode.fragment-DhHWySqi.js","./rgbdDecode.fragment-CAQSGKQb.js","./rgbdEncode.fragment-Dp82zIf3.js","./rgbdEncode.fragment-PqVu9J5Q.js","./pbr.vertex-DRZMMP8Z.js","./pbrUboDeclaration-Bwg_eWAt.js","./meshUboDeclaration-Bk1ASTX2.js","./vertexColorMixing-8t5JaWwM.js","./mainUVVaryingDeclaration-gz09aLXv.js","./pbrBRDFFunctions-baMKuu65.js","./harmonicsFunctions-DjLTZRig.js","./bumpVertexDeclaration-BZI6C33v.js","./morphTargetsVertexDeclaration-BsT9JpOT.js","./morphTargetsVertex-DcRl6X3j.js","./bumpVertex-D9JGroSY.js","./pbr.fragment-D0TIhE0g.js","./oitFragment-BcbCWH3V.js","./pbrDebug-FlFed75Q.js","./samplerFragmentDeclaration-cxB-jdDJ.js","./hdrFilteringFunctions-DD5EqJpN.js","./bumpFragment-BDPY2JKo.js","./decalFragment-iGkmQ-pm.js","./pbr.vertex-DLH7HICr.js","./vertexColorMixing-DUmDzlXI.js","./pbrUboDeclaration-BaPvJwLw.js","./meshUboDeclaration-C6raEdzf.js","./mainUVVaryingDeclaration-CYLIf35n.js","./pbrBRDFFunctions-BEHyjaG2.js","./harmonicsFunctions-O6-VFzXR.js","./bumpVertexDeclaration-Bd2S82Ce.js","./morphTargetsVertex-7Q90Wwr8.js","./bumpVertex-B5e3s1jQ.js","./pbr.fragment-SkdUmqQC.js","./oitFragment-_o5mqRWd.js","./pbrDebug-ChQlKLz5.js","./bumpFragment-CNMCo4HD.js","./hdrFilteringFunctions-DFleLIbL.js","./decalFragment-BXuRa219.js","./oitBackBlend.fragment-2SkQ74Uj.js","./oitBackBlend.fragment-MvwpfZ6x.js","./oitFinalSimpleBlend.fragment-C05G8A8O.js","./oitFinalSimpleBlend.fragment-Do9a99j5.js","./kernelBlur.fragment-DQBu662A.js","./kernelBlurVaryingDeclaration-BQ29TGU2.js","./packingFunctions-BOaWr_dk.js","./kernelBlur.vertex-pWey8ouW.js","./kernelBlur.fragment-Ur-RzLkw.js","./kernelBlurVaryingDeclaration-CscI0tkK.js","./packingFunctions-BPfzqklr.js","./kernelBlur.vertex-DPmcm8PU.js","./glowBlurPostProcess.fragment-9rC-Cuk0.js","./glowBlurPostProcess.fragment-z431ChCJ.js","./EXT_lights_image_based-BkkYWPdh.js","./cubeTexture-BcGycaMd.js","./glTFLoader-Bp7IfGPK.js","./bone-z620UXj2.js","./skeleton-3aE04lM6.js","./rawTexture-DYLCXHMF.js","./assetContainer-D7EiOqw6.js","./objectModelMapping-CGWnurZP.js","./EXT_mesh_gpu_instancing-Dk4bl8lI.js","./thinInstanceMesh-BDN_yrTe.js","./EXT_meshopt_compression-C80C3Ae6.js","./EXT_texture_avif-D-6Hx_6U.js","./EXT_texture_webp-ARKFdfJg.js","./ExtrasAsMetadata-Bw6ELUiM.js","./KHR_animation_pointer-_r4j3nDo.js","./glTFLoaderAnimation-Dy3q9t_h.js","./KHR_draco_mesh_compression-CsW9PsVH.js","./KHR_interactivity-BtMudStn.js","./declarationMapper-Lanf6XPr.js","./KHR_lights_punctual-BAbq2qYj.js","./EXT_lights_area-CaG6NvhR.js","./EXT_lights_ies-uJl7poYh.js","./KHR_materials_anisotropy-Dittpx8X.js","./KHR_materials_clearcoat-DS70653e.js","./KHR_materials_diffuse_roughness-BbnIWM_S.js","./KHR_materials_diffuse_transmission-DS01W3tb.js","./KHR_materials_dispersion-DpxfNQCn.js","./KHR_materials_emissive_strength-BqChGRqL.js","./KHR_materials_ior-BE6_deSQ.js","./KHR_materials_iridescence-ezzlpHRh.js","./KHR_materials_pbrSpecularGlossiness-Cf_AZprx.js","./KHR_materials_sheen-BCArul3M.js","./KHR_materials_specular-Dr1ARbmK.js","./KHR_materials_transmission-4IzmwuFj.js","./KHR_materials_unlit-DM_zxK5v.js","./KHR_materials_variants-BwQ4yKQI.js","./KHR_materials_volume-BJpG2B3c.js","./KHR_mesh_quantization-CvyzOSoH.js","./KHR_texture_basisu-iW9bNKGX.js","./KHR_texture_transform-DDUX66hd.js","./KHR_xmp_json_ld-DX3w5iqB.js","./MSFT_audio_emitter-C84vLoK2.js","./spatialWebAudio-CBDS0rWd.js","./webAudioBaseSubGraph-CNNuTFUE.js","./audioEngine-C797_5QL.js","./webAudioSoundSource-CHASmwKl.js","./abstractSoundSource-D3oGzC3p.js","./webAudioStaticSound-C9f3HBnG.js","./abstractSoundInstance-Cb1S6dEM.js","./webAudioStreamingSound-orB8PSId.js","./MSFT_lod-CdNjehaf.js","./MSFT_minecraftMesh-B8XzSlpi.js","./MSFT_sRGBFactors-DIaDjzzZ.js","./KHR_node_visibility-D952nLJv.js","./KHR_node_hoverability-bcsnWtSP.js","./KHR_node_selectability-C9CKUBKq.js","./bvhFileLoader-DyExPWsV.js","./objFileLoader-B25jxNQb.js","./standardMaterial-C4-ZPPCc.js","./splatFileLoader-DWVxOgqv.js","./shaderMaterial-yE1litoM.js","./ray-DFqjcUAE.js","./stlFileLoader-TUWjk2So.js","./ssao2RenderingPipeline-f26SouVj.js","./postProcessRenderEffect-Bq4hKPLg.js","./geometryBufferRenderer-GNaIIBSt.js","./postProcessRenderPipelineManagerSceneComponent-SOlAp6R6.js","./prePassRendererSceneComponent-DTI6ZAyl.js","./geometryBufferRendererSceneComponent-BF80mcVG.js","./engine.multiRender-DvoXejHB.js","./webgpuEngine-C4n6cvIQ.js","./fresnelFunction-cCRUtTOI.js","./hdrCubeTexture-CWo-FOyr.js","./iblCdfGenerator-BLPdciVw.js","./discBuilder-DHjTJ34Z.js","./iblShadowsRenderPipeline-CSk08uxh.js","./openpbrMaterial-527Jzq5y.js","./iblCdfGeneratorSceneComponent-Buukicac.js","./envShadowGround.vertex-oRlsSdho-CnFcyQnS.js","./envShadowGround.fragment-CB8lNguw-DdRKeRcB.js","./envShadowGround.vertex-6NXvyWvr-C08bpIyH.js","./envShadowGround.fragment-L1sPCORS-CJ6Fvma3.js","./shadowGenerator-D_kEUQNK.js","./shadowGeneratorSceneComponent-Cw9Z1Dfz.js","./pointCloudVertex-C-QHJpr_.js"])))=>i.map(i=>d[i]); +import{af as G}from"./index-DWyDLubb.js";function T(a,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(a,e,t,i);else for(var o=a.length-1;o>=0;o--)(n=a[o])&&(r=(s<3?n(r):s>3?n(e,t,r):n(e,t))||r);return s>3&&r&&Object.defineProperty(e,t,r),r}const cr={},br={};function _l(a){const e=a.getClassName();return br[e]||(br[e]={}),br[e]}function fn(a){const e=a.getClassName();if(cr[e])return cr[e];cr[e]={};const t=cr[e];let i=a,s=e;for(;s;){const r=br[s];for(const h in r)t[h]=r[h];let n,o=!1;do{if(n=Object.getPrototypeOf(i),!n.getClassName){o=!0;break}if(n.getClassName()!==s)break;i=n}while(n);if(o)break;s=n.getClassName(),i=n}return t}function Yt(a,e){return(t,i)=>{const s=_l(t);s[i]||(s[i]={type:a,sourceName:e})}}function gl(a,e=null){return(t,i)=>{const s=e||"_"+i;Object.defineProperty(t,i,{get:function(){return this[s]},set:function(r){typeof this[s]?.equals=="function"&&this[s].equals(r)||this[s]!==r&&(this[s]=r,t[a].apply(this))},enumerable:!0,configurable:!0})}}function B(a,e=null){return gl(a,e)}function R(a){return Yt(0,a)}function Oe(a){return Yt(1,a)}function At(a){return Yt(2,a)}function l_(a){return Yt(3,a)}function co(a){return Yt(4,a)}function qt(a){return Yt(5,a)}function uo(a){return Yt(6,a)}function pl(a){return Yt(7,a)}function fo(a){return Yt(8,a)}function ml(a){return Yt(9,a)}function Tl(a){return Yt(10,a)}function c_(a){return Yt(12,a)}function yi(a,e,t,i){const s=t.value;t.value=(...r)=>{let n=s;if(typeof _native<"u"&&_native[e]){const o=_native[e];i?n=(...h)=>i(...h)?o(...h):s(...h):n=o}return a[e]=n,n(...r)}}yi.filter=function(a){return(e,t,i)=>yi(e,t,i,a)};function u_(a,e=null){return(t,i)=>{const s=i;Object.defineProperty(t,e||"",{get:function(){return this[s].value},set:function(n){typeof this[s]?.value?.equals=="function"&&this[s].value.equals(n)||this[s].value!==n&&(this[s].value=n,t[a].apply(this))},enumerable:!0,configurable:!0})}}const bl=typeof WeakRef<"u";class El{constructor(e,t=!1,i,s){this.initialize(e,t,i,s)}initialize(e,t=!1,i,s){return this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=s,this}}class Al{constructor(e,t,i=null){this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1,this._remove=null}remove(e=!1){this._remove&&this._remove(e)}}class O{static FromPromise(e,t){const i=new O;return e.then(s=>{i.notifyObservers(s)}).catch(s=>{if(t)t.notifyObservers(s);else throw s}),i}get observers(){return this._observers}constructor(e,t=!1){this.notifyIfTriggered=t,this._observers=new Array,this._numObserversMarkedAsDeleted=0,this._hasNotified=!1,this._eventState=new El(0),e&&(this._onObserverAdded=e)}add(e,t=-1,i=!1,s=null,r=!1){if(!e)return null;const n=new Al(e,t,s);n.unregisterOnNextCall=r,i?this._observers.unshift(n):this._observers.push(n),this._onObserverAdded&&this._onObserverAdded(n),this._hasNotified&&this.notifyIfTriggered&&this._lastNotifiedValue!==void 0&&this.notifyObserver(n,this._lastNotifiedValue);const o=bl?new WeakRef(this):{deref:()=>this};return n._remove=(h=!1)=>{const l=o.deref();l&&(h?l.remove(n):l._remove(n))},n}addOnce(e){return this.add(e,void 0,void 0,void 0,!0)}remove(e){return e?(e._remove=null,this._observers.indexOf(e)!==-1?(this._deferUnregister(e),!0):!1):!1}removeCallback(e,t){for(let i=0;i{this._remove(e)},0))}_remove(e,t=!0){if(!e)return!1;const i=this._observers.indexOf(e);return i!==-1?(t&&this._numObserversMarkedAsDeleted--,this._observers.splice(i,1),!0):!1}makeObserverTopPriority(e){this._remove(e,!1),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e,!1),this._observers.push(e)}notifyObservers(e,t=-1,i,s,r){if(this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=e),!this._observers.length)return!0;const n=this._eventState;n.mask=t,n.target=i,n.currentTarget=s,n.skipNextObservers=!1,n.lastReturnValue=e,n.userInfo=r;for(const o of this._observers)if(!o._willBeUnregistered&&(o.mask&t&&(o.unregisterOnNextCall&&this._deferUnregister(o),o.scope?n.lastReturnValue=o.callback.apply(o.scope,[e,n]):n.lastReturnValue=o.callback(e,n)),n.skipNextObservers))return!1;return!0}notifyObserver(e,t,i=-1){if(this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=t),e._willBeUnregistered)return;const s=this._eventState;s.mask=i,s.skipNextObservers=!1,e.unregisterOnNextCall&&this._deferUnregister(e),e.callback(t,s)}hasObservers(){return this._observers.length-this._numObserversMarkedAsDeleted>0}clear(){for(;this._observers.length;){const e=this._observers.pop();e&&(e._remove=null)}this._onObserverAdded=null,this._numObserversMarkedAsDeleted=0,this.cleanLastNotifiedState()}cleanLastNotifiedState(){this._hasNotified=!1,this._lastNotifiedValue=void 0}clone(){const e=new O;return e._observers=this._observers.slice(0),e}hasSpecificMask(e=-1){for(const t of this._observers)if(t.mask&e||t.mask===e)return!0;return!1}}const Rl=1/2.2,Er=2.2,Me=.001;function Ai(a,e){const t=[];for(let i=0;i{const r=s.previous;if(!r)return;const n=s.next;n?(r.next=n,n.previous=r):(r.next=void 0,a[e]=r),s.next=void 0,s.previous=void 0}}const xl=["push","splice","pop","shift","unshift"];function _o(a,e){const t=xl.map(i=>yl(a,i,e));return()=>{for(const i of t)i?.()}}const go={};function nt(a,e){go[a]=e}function Oi(a){return go[a]}class st{static SetMatrixPrecision(e){if(st.MatrixTrackPrecisionChange=!1,e&&!st.MatrixUse64Bits&&st.MatrixTrackedMatrices)for(let t=0;tt+i}function Ve(a,e){return a===e?a:Math.random()*(e-a)+a}function Ii(a,e,t){return a+(e-a)*t}function Cl(a,e,t){let i=Ur(e-a,360);return i>180&&(i-=360),a+i*be(t)}function Il(a,e,t){let i=0;return a!=e?i=be((t-a)/(e-a)):i=0,i}function po(a,e,t,i,s){const r=s*s,n=s*r,o=2*n-3*r+1,h=-2*n+3*r,l=n-2*r+s,c=n-r;return a*o+t*h+e*l+i*c}function Pl(a,e,t,i,s){const r=s*s;return(r-s)*6*a+(3*r-4*s+1)*e+(-r+s)*6*t+(3*r-2*s)*i}function be(a,e=0,t=1){return Math.min(t,Math.max(e,a))}function mo(a){return a-=Math.PI*2*Math.floor((a+Math.PI)/(Math.PI*2)),a}function ei(a){const e=a.toString(16);return a<=15?("0"+e).toUpperCase():e.toUpperCase()}function vl(a){if(Math.log2)return Math.floor(Math.log2(a));if(a<0)return NaN;if(a===0)return-1/0;let e=0;if(a<1){for(;a<1;)e++,a=a*2;e=-e}else if(a>1)for(;a>1;)e++,a=Math.floor(a/2);return e}function Ur(a,e){return a-Math.floor(a/e)*e}function Dl(a,e,t){return(a-e)/(t-e)}function Ol(a,e,t){return a*(t-e)+e}function To(a,e){let t=Ur(e-a,360);return t>180&&(t-=360),t}function Fl(a,e){const t=Ur(a,e*2);return e-Math.abs(t-e)}function wl(a,e,t){let i=be(t);return i=-2*i*i*i+3*i*i,e*i+a*(1-i)}function bo(a,e,t){let i=0;return Math.abs(e-a)<=t?i=e:i=a+Math.sign(e-a)*t,i}function Ll(a,e,t){const i=To(a,e);let s=0;return-tparseInt(a.toString().replace(/\W/g,""));class Q{constructor(e=0,t=0){this.x=e,this.y=t}toString(){return`{X: ${this.x} Y: ${this.y}}`}getClassName(){return"Vector2"}getHashCode(){const e=St(this.x),t=St(this.y);let i=e;return i=i*397^t,i}toArray(e,t=0){return e[t]=this.x,e[t+1]=this.y,this}fromArray(e,t=0){return Q.FromArrayToRef(e,t,this),this}asArray(){return[this.x,this.y]}copyFrom(e){return this.x=e.x,this.y=e.y,this}copyFromFloats(e,t){return this.x=e,this.y=t,this}set(e,t){return this.copyFromFloats(e,t)}setAll(e){return this.copyFromFloats(e,e)}add(e){return new Q(this.x+e.x,this.y+e.y)}addToRef(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}addInPlaceFromFloats(e,t){return this.x+=e,this.y+=t,this}addVector3(e){return new Q(this.x+e.x,this.y+e.y)}subtract(e){return new Q(this.x-e.x,this.y-e.y)}subtractToRef(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this}multiplyInPlace(e){return this.x*=e.x,this.y*=e.y,this}multiply(e){return new Q(this.x*e.x,this.y*e.y)}multiplyToRef(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t}multiplyByFloats(e,t){return new Q(this.x*e,this.y*t)}divide(e){return new Q(this.x/e.x,this.y/e.y)}divideToRef(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t}divideInPlace(e){return this.x=this.x/e.x,this.y=this.y/e.y,this}minimizeInPlace(e){return this.minimizeInPlaceFromFloats(e.x,e.y)}maximizeInPlace(e){return this.maximizeInPlaceFromFloats(e.x,e.y)}minimizeInPlaceFromFloats(e,t){return this.x=Math.min(e,this.x),this.y=Math.min(t,this.y),this}maximizeInPlaceFromFloats(e,t){return this.x=Math.max(e,this.x),this.y=Math.max(t,this.y),this}subtractFromFloats(e,t){return new Q(this.x-e,this.y-t)}subtractFromFloatsToRef(e,t,i){return i.x=this.x-e,i.y=this.y-t,i}negate(){return new Q(-this.x,-this.y)}negateInPlace(){return this.x*=-1,this.y*=-1,this}negateToRef(e){return e.x=-this.x,e.y=-this.y,e}scaleInPlace(e){return this.x*=e,this.y*=e,this}scale(e){return new Q(this.x*e,this.y*e)}scaleToRef(e,t){return t.x=this.x*e,t.y=this.y*e,t}scaleAndAddToRef(e,t){return t.x+=this.x*e,t.y+=this.y*e,t}equals(e){return e&&this.x===e.x&&this.y===e.y}equalsWithEpsilon(e,t=Me){return e&&Pe(this.x,e.x,t)&&Pe(this.y,e.y,t)}equalsToFloats(e,t){return this.x===e&&this.y===t}floor(){return new Q(Math.floor(this.x),Math.floor(this.y))}floorToRef(e){return e.x=Math.floor(this.x),e.y=Math.floor(this.y),e}fract(){return new Q(this.x-Math.floor(this.x),this.y-Math.floor(this.y))}fractToRef(e){return e.x=this.x-Math.floor(this.x),e.y=this.y-Math.floor(this.y),e}rotate(e){return this.rotateToRef(e,new Q)}rotateToRef(e,t){const i=Math.cos(e),s=Math.sin(e);return t.x=i*this.x-s*this.y,t.y=s*this.x+i*this.y,t}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return e===0||e===1?this:this.scaleInPlace(1/e)}normalizeToNew(){const e=new Q;return this.normalizeToRef(e),e}normalizeToRef(e){const t=this.length();return t===0&&(e.x=this.x,e.y=this.y),this.scaleToRef(1/t,e)}clone(){return new Q(this.x,this.y)}dot(e){return this.x*e.x+this.y*e.y}static Zero(){return new Q(0,0)}static One(){return new Q(1,1)}static Random(e=0,t=1){return new Q(Ve(e,t),Ve(e,t))}static RandomToRef(e=0,t=1,i){return i.copyFromFloats(Ve(e,t),Ve(e,t))}static get ZeroReadOnly(){return Q._ZeroReadOnly}static FromArray(e,t=0){return new Q(e[t],e[t+1])}static FromArrayToRef(e,t,i){return i.x=e[t],i.y=e[t+1],i}static FromFloatsToRef(e,t,i){return i.copyFromFloats(e,t),i}static CatmullRom(e,t,i,s,r){const n=r*r,o=r*n,h=.5*(2*t.x+(-e.x+i.x)*r+(2*e.x-5*t.x+4*i.x-s.x)*n+(-e.x+3*t.x-3*i.x+s.x)*o),l=.5*(2*t.y+(-e.y+i.y)*r+(2*e.y-5*t.y+4*i.y-s.y)*n+(-e.y+3*t.y-3*i.y+s.y)*o);return new Q(h,l)}static ClampToRef(e,t,i,s){return s.x=be(e.x,t.x,i.x),s.y=be(e.y,t.y,i.y),s}static Clamp(e,t,i){const s=be(e.x,t.x,i.x),r=be(e.y,t.y,i.y);return new Q(s,r)}static Hermite(e,t,i,s,r){const n=r*r,o=r*n,h=2*o-3*n+1,l=-2*o+3*n,c=o-2*n+r,u=o-n,f=e.x*h+i.x*l+t.x*c+s.x*u,d=e.y*h+i.y*l+t.y*c+s.y*u;return new Q(f,d)}static Hermite1stDerivative(e,t,i,s,r){return this.Hermite1stDerivativeToRef(e,t,i,s,r,new Q)}static Hermite1stDerivativeToRef(e,t,i,s,r,n){const o=r*r;return n.x=(o-r)*6*e.x+(3*o-4*r+1)*t.x+(-o+r)*6*i.x+(3*o-2*r)*s.x,n.y=(o-r)*6*e.y+(3*o-4*r+1)*t.y+(-o+r)*6*i.y+(3*o-2*r)*s.y,n}static Lerp(e,t,i){return Q.LerpToRef(e,t,i,new Q)}static LerpToRef(e,t,i,s){return s.x=e.x+(t.x-e.x)*i,s.y=e.y+(t.y-e.y)*i,s}static Dot(e,t){return e.x*t.x+e.y*t.y}static Normalize(e){return Q.NormalizeToRef(e,new Q)}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}static Minimize(e,t){const i=e.xt.x?e.x:t.x,s=e.y>t.y?e.y:t.y;return new Q(i,s)}static Transform(e,t){return Q.TransformToRef(e,t,new Q)}static TransformToRef(e,t,i){const s=t.m,r=e.x*s[0]+e.y*s[4]+s[12],n=e.x*s[1]+e.y*s[5]+s[13];return i.x=r,i.y=n,i}static PointInTriangle(e,t,i,s){const r=.5*(-i.y*s.x+t.y*(-i.x+s.x)+t.x*(i.y-s.y)+i.x*s.y),n=r<0?-1:1,o=(t.y*s.x-t.x*s.y+(s.y-t.y)*e.x+(t.x-s.x)*e.y)*n,h=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*n;return o>0&&h>0&&o+h<2*r*n}static Distance(e,t){return Math.sqrt(Q.DistanceSquared(e,t))}static DistanceSquared(e,t){const i=e.x-t.x,s=e.y-t.y;return i*i+s*s}static Center(e,t){return Q.CenterToRef(e,t,new Q)}static CenterToRef(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2)}static DistanceOfPointFromSegment(e,t,i){const s=Q.DistanceSquared(t,i);if(s===0)return Q.Distance(e,t);const r=i.subtract(t),n=Math.max(0,Math.min(1,Q.Dot(e.subtract(t),r)/s)),o=t.add(r.multiplyByFloats(n,n));return Q.Distance(e,o)}}Q._V8PerformanceHack=new Q(.5,.5);Q._ZeroReadOnly=Q.Zero();Object.defineProperties(Q.prototype,{dimension:{value:[2]},rank:{value:1}});class _{get x(){return this._x}set x(e){this._x=e,this._isDirty=!0}get y(){return this._y}set y(e){this._y=e,this._isDirty=!0}get z(){return this._z}set z(e){this._z=e,this._isDirty=!0}constructor(e=0,t=0,i=0){this._isDirty=!0,this._x=e,this._y=t,this._z=i}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z}}`}getClassName(){return"Vector3"}getHashCode(){const e=St(this._x),t=St(this._y),i=St(this._z);let s=e;return s=s*397^t,s=s*397^i,s}asArray(){return[this._x,this._y,this._z]}toArray(e,t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,this}fromArray(e,t=0){return _.FromArrayToRef(e,t,this),this}toQuaternion(){return W.RotationYawPitchRoll(this._y,this._x,this._z)}addInPlace(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._isDirty=!0,this}addInPlaceFromFloats(e,t,i){return this._x+=e,this._y+=t,this._z+=i,this._isDirty=!0,this}add(e){return new _(this._x+e._x,this._y+e._y,this._z+e._z)}addToRef(e,t){return t._x=this._x+e._x,t._y=this._y+e._y,t._z=this._z+e._z,t._isDirty=!0,t}subtractInPlace(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._isDirty=!0,this}subtract(e){return new _(this._x-e._x,this._y-e._y,this._z-e._z)}subtractToRef(e,t){return this.subtractFromFloatsToRef(e._x,e._y,e._z,t)}subtractFromFloats(e,t,i){return new _(this._x-e,this._y-t,this._z-i)}subtractFromFloatsToRef(e,t,i,s){return s._x=this._x-e,s._y=this._y-t,s._z=this._z-i,s._isDirty=!0,s}negate(){return new _(-this._x,-this._y,-this._z)}negateInPlace(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this}negateToRef(e){return e._x=this._x*-1,e._y=this._y*-1,e._z=this._z*-1,e._isDirty=!0,e}scaleInPlace(e){return this._x*=e,this._y*=e,this._z*=e,this._isDirty=!0,this}scale(e){return new _(this._x*e,this._y*e,this._z*e)}scaleToRef(e,t){return t._x=this._x*e,t._y=this._y*e,t._z=this._z*e,t._isDirty=!0,t}getNormalToRef(e){const t=this.length();let i=Math.acos(this._y/t);const s=Math.atan2(this._z,this._x);i>Math.PI/2?i-=Math.PI/2:i+=Math.PI/2;const r=t*Math.sin(i)*Math.cos(s),n=t*Math.cos(i),o=t*Math.sin(i)*Math.sin(s);return e.set(r,n,o),e}applyRotationQuaternionToRef(e,t){const i=this._x,s=this._y,r=this._z,n=e._x,o=e._y,h=e._z,l=e._w,c=2*(o*r-h*s),u=2*(h*i-n*r),f=2*(n*s-o*i);return t._x=i+l*c+o*f-h*u,t._y=s+l*u+h*c-n*f,t._z=r+l*f+n*u-o*c,t._isDirty=!0,t}applyRotationQuaternionInPlace(e){return this.applyRotationQuaternionToRef(e,this)}applyRotationQuaternion(e){return this.applyRotationQuaternionToRef(e,new _)}scaleAndAddToRef(e,t){return t._x+=this._x*e,t._y+=this._y*e,t._z+=this._z*e,t._isDirty=!0,t}projectOnPlane(e,t){return this.projectOnPlaneToRef(e,t,new _)}projectOnPlaneToRef(e,t,i){const s=e.normal,r=e.d,n=X.Vector3[0];this.subtractToRef(t,n),n.normalize();const o=_.Dot(n,s);if(Math.abs(o)<1e-10)i.setAll(1/0);else{const h=-(_.Dot(t,s)+r)/o,l=n.scaleInPlace(h);t.addToRef(l,i)}return i}equals(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z}equalsWithEpsilon(e,t=Me){return e&&Pe(this._x,e._x,t)&&Pe(this._y,e._y,t)&&Pe(this._z,e._z,t)}equalsToFloats(e,t,i){return this._x===e&&this._y===t&&this._z===i}multiplyInPlace(e){return this._x*=e._x,this._y*=e._y,this._z*=e._z,this._isDirty=!0,this}multiply(e){return this.multiplyByFloats(e._x,e._y,e._z)}multiplyToRef(e,t){return t._x=this._x*e._x,t._y=this._y*e._y,t._z=this._z*e._z,t._isDirty=!0,t}multiplyByFloats(e,t,i){return new _(this._x*e,this._y*t,this._z*i)}divide(e){return new _(this._x/e._x,this._y/e._y,this._z/e._z)}divideToRef(e,t){return t._x=this._x/e._x,t._y=this._y/e._y,t._z=this._z/e._z,t._isDirty=!0,t}divideInPlace(e){return this._x=this._x/e._x,this._y=this._y/e._y,this._z=this._z/e._z,this._isDirty=!0,this}minimizeInPlace(e){return this.minimizeInPlaceFromFloats(e._x,e._y,e._z)}maximizeInPlace(e){return this.maximizeInPlaceFromFloats(e._x,e._y,e._z)}minimizeInPlaceFromFloats(e,t,i){return ethis._x&&(this.x=e),t>this._y&&(this.y=t),i>this._z&&(this.z=i),this}isNonUniformWithinEpsilon(e){const t=Math.abs(this._x),i=Math.abs(this._y);if(!Pe(t,i,e))return!0;const s=Math.abs(this._z);return!Pe(t,s,e)||!Pe(i,s,e)}get isNonUniform(){const e=Math.abs(this._x),t=Math.abs(this._y);if(e!==t)return!0;const i=Math.abs(this._z);return e!==i}floorToRef(e){return e._x=Math.floor(this._x),e._y=Math.floor(this._y),e._z=Math.floor(this._z),e._isDirty=!0,e}floor(){return new _(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))}fractToRef(e){return e._x=this._x-Math.floor(this._x),e._y=this._y-Math.floor(this._y),e._z=this._z-Math.floor(this._z),e._isDirty=!0,e}fract(){return new _(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z}get hasAZeroComponent(){return this._x*this._y*this._z===0}normalize(){return this.normalizeFromLength(this.length())}reorderInPlace(e){if(e=e.toLowerCase(),e==="xyz")return this;const t=X.Vector3[0].copyFrom(this);return this.x=t[e[0]],this.y=t[e[1]],this.z=t[e[2]],this}rotateByQuaternionToRef(e,t){return e.toRotationMatrix(X.Matrix[0]),_.TransformCoordinatesToRef(this,X.Matrix[0],t),t}rotateByQuaternionAroundPointToRef(e,t,i){return this.subtractToRef(t,X.Vector3[0]),X.Vector3[0].rotateByQuaternionToRef(e,X.Vector3[0]),t.addToRef(X.Vector3[0],i),i}cross(e){return _.CrossToRef(this,e,new _)}normalizeFromLength(e){return e===0||e===1?this:this.scaleInPlace(1/e)}normalizeToNew(){return this.normalizeToRef(new _)}normalizeToRef(e){const t=this.length();return t===0||t===1?(e._x=this._x,e._y=this._y,e._z=this._z,e._isDirty=!0,e):this.scaleToRef(1/t,e)}clone(){return new _(this._x,this._y,this._z)}copyFrom(e){return this.copyFromFloats(e._x,e._y,e._z)}copyFromFloats(e,t,i){return this._x=e,this._y=t,this._z=i,this._isDirty=!0,this}set(e,t,i){return this.copyFromFloats(e,t,i)}setAll(e){return this._x=this._y=this._z=e,this._isDirty=!0,this}static GetClipFactor(e,t,i,s){const r=_.Dot(e,i),n=_.Dot(t,i);return(r-s)/(r-n)}static GetAngleBetweenVectors(e,t,i){const s=e.normalizeToRef(X.Vector3[1]),r=t.normalizeToRef(X.Vector3[2]);let n=_.Dot(s,r);n=be(n,-1,1);const o=Math.acos(n),h=X.Vector3[3];return _.CrossToRef(s,r,h),_.Dot(h,i)>0?isNaN(o)?0:o:isNaN(o)?-Math.PI:-Math.acos(n)}static GetAngleBetweenVectorsOnPlane(e,t,i){X.Vector3[0].copyFrom(e);const s=X.Vector3[0];X.Vector3[1].copyFrom(t);const r=X.Vector3[1];X.Vector3[2].copyFrom(i);const n=X.Vector3[2],o=X.Vector3[3],h=X.Vector3[4];s.normalize(),r.normalize(),n.normalize(),_.CrossToRef(n,s,o),_.CrossToRef(o,n,h);const l=Math.atan2(_.Dot(r,o),_.Dot(r,h));return mo(l)}static PitchYawRollToMoveBetweenPointsToRef(e,t,i){const s=v.Vector3[0];return t.subtractToRef(e,s),i._y=Math.atan2(s.x,s.z)||0,i._x=Math.atan2(Math.sqrt(s.x**2+s.z**2),s.y)||0,i._z=0,i._isDirty=!0,i}static PitchYawRollToMoveBetweenPoints(e,t){const i=_.Zero();return _.PitchYawRollToMoveBetweenPointsToRef(e,t,i)}static SlerpToRef(e,t,i,s){i=be(i,0,1);const r=X.Vector3[0],n=X.Vector3[1];r.copyFrom(e);const o=r.length();r.normalizeFromLength(o),n.copyFrom(t);const h=n.length();n.normalizeFromLength(h);const l=_.Dot(r,n);let c,u;if(l<1-Me){const f=Math.acos(l),d=1/Math.sin(f);c=Math.sin((1-i)*f)*d,u=Math.sin(i*f)*d}else c=1-i,u=i;return r.scaleInPlace(c),n.scaleInPlace(u),s.copyFrom(r).addInPlace(n),s.scaleInPlace(Ii(o,h,i)),s}static SmoothToRef(e,t,i,s,r){return _.SlerpToRef(e,t,s===0?1:i/s,r),r}static FromArray(e,t=0){return new _(e[t],e[t+1],e[t+2])}static FromFloatArray(e,t){return _.FromArray(e,t)}static FromArrayToRef(e,t,i){return i._x=e[t],i._y=e[t+1],i._z=e[t+2],i._isDirty=!0,i}static FromFloatArrayToRef(e,t,i){return _.FromArrayToRef(e,t,i)}static FromFloatsToRef(e,t,i,s){return s.copyFromFloats(e,t,i),s}static Zero(){return new _(0,0,0)}static One(){return new _(1,1,1)}static Up(){return new _(0,1,0)}static get UpReadOnly(){return _._UpReadOnly}static get DownReadOnly(){return _._DownReadOnly}static get RightReadOnly(){return _._RightReadOnly}static get LeftReadOnly(){return _._LeftReadOnly}static get LeftHandedForwardReadOnly(){return _._LeftHandedForwardReadOnly}static get RightHandedForwardReadOnly(){return _._RightHandedForwardReadOnly}static get LeftHandedBackwardReadOnly(){return _._LeftHandedBackwardReadOnly}static get RightHandedBackwardReadOnly(){return _._RightHandedBackwardReadOnly}static get ZeroReadOnly(){return _._ZeroReadOnly}static get OneReadOnly(){return _._OneReadOnly}static Down(){return new _(0,-1,0)}static Forward(e=!1){return new _(0,0,e?-1:1)}static Backward(e=!1){return new _(0,0,e?1:-1)}static Right(){return new _(1,0,0)}static Left(){return new _(-1,0,0)}static Random(e=0,t=1){return new _(Ve(e,t),Ve(e,t),Ve(e,t))}static RandomToRef(e=0,t=1,i){return i.copyFromFloats(Ve(e,t),Ve(e,t),Ve(e,t))}static TransformCoordinates(e,t){const i=_.Zero();return _.TransformCoordinatesToRef(e,t,i),i}static TransformCoordinatesToRef(e,t,i){return _.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformCoordinatesFromFloatsToRef(e,t,i,s,r){const n=s.m,o=e*n[0]+t*n[4]+i*n[8]+n[12],h=e*n[1]+t*n[5]+i*n[9]+n[13],l=e*n[2]+t*n[6]+i*n[10]+n[14],c=1/(e*n[3]+t*n[7]+i*n[11]+n[15]);return r._x=o*c,r._y=h*c,r._z=l*c,r._isDirty=!0,r}static TransformNormal(e,t){const i=_.Zero();return _.TransformNormalToRef(e,t,i),i}static TransformNormalToRef(e,t,i){return this.TransformNormalFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformNormalFromFloatsToRef(e,t,i,s,r){const n=s.m;return r._x=e*n[0]+t*n[4]+i*n[8],r._y=e*n[1]+t*n[5]+i*n[9],r._z=e*n[2]+t*n[6]+i*n[10],r._isDirty=!0,r}static CatmullRom(e,t,i,s,r){const n=r*r,o=r*n,h=.5*(2*t._x+(-e._x+i._x)*r+(2*e._x-5*t._x+4*i._x-s._x)*n+(-e._x+3*t._x-3*i._x+s._x)*o),l=.5*(2*t._y+(-e._y+i._y)*r+(2*e._y-5*t._y+4*i._y-s._y)*n+(-e._y+3*t._y-3*i._y+s._y)*o),c=.5*(2*t._z+(-e._z+i._z)*r+(2*e._z-5*t._z+4*i._z-s._z)*n+(-e._z+3*t._z-3*i._z+s._z)*o);return new _(h,l,c)}static Clamp(e,t,i){const s=new _;return _.ClampToRef(e,t,i,s),s}static ClampToRef(e,t,i,s){let r=e._x;r=r>i._x?i._x:r,r=ri._y?i._y:n,n=ni._z?i._z:o,o=o0&&D<0?(pe.copyFrom(n),ce=t,oe=i):D>0&&Re<0?(pe.copyFrom(h),ce=i,oe=s):(pe.copyFrom(o).scaleInPlace(-1),ce=s,oe=t);const Ye=X.Vector3[9],Qe=X.Vector3[4];if(ce.subtractToRef(E,x),oe.subtractToRef(E,Ye),_.CrossToRef(x,Ye,Qe),!(_.Dot(Qe,l)<0))return r.copyFrom(E),Math.abs(p*m);const de=X.Vector3[5];_.CrossToRef(pe,Qe,de),de.normalize();const Fe=X.Vector3[9];Fe.copyFrom(ce).subtractInPlace(E);const we=Fe.length();if(wethis._x&&(this.x=e.x),e.y>this._y&&(this.y=e.y),e.z>this._z&&(this.z=e.z),e.w>this._w&&(this.w=e.w),this}minimizeInPlaceFromFloats(e,t,i,s){return this.x=Math.min(e,this._x),this.y=Math.min(t,this._y),this.z=Math.min(i,this._z),this.w=Math.min(s,this._w),this}maximizeInPlaceFromFloats(e,t,i,s){return this.x=Math.max(e,this._x),this.y=Math.max(t,this._y),this.z=Math.max(i,this._z),this.w=Math.max(s,this._w),this}floorToRef(e){return e.x=Math.floor(this._x),e.y=Math.floor(this._y),e.z=Math.floor(this._z),e.w=Math.floor(this._w),e}floor(){return new ge(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z),Math.floor(this._w))}fractToRef(e){return e.x=this._x-Math.floor(this._x),e.y=this._y-Math.floor(this._y),e.z=this._z-Math.floor(this._z),e.w=this._w-Math.floor(this._w),e}fract(){return new ge(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z),this._w-Math.floor(this._w))}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return e===0||e===1?this:this.scaleInPlace(1/e)}normalizeToNew(){return this.normalizeToRef(new ge)}normalizeToRef(e){const t=this.length();return t===0||t===1?(e.x=this._x,e.y=this._y,e.z=this._z,e.w=this._w,e):this.scaleToRef(1/t,e)}toVector3(){return new _(this._x,this._y,this._z)}clone(){return new ge(this._x,this._y,this._z,this._w)}copyFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}copyFromFloats(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}set(e,t,i,s){return this.copyFromFloats(e,t,i,s)}setAll(e){return this.x=this.y=this.z=this.w=e,this}dot(e){return this._x*e.x+this._y*e.y+this._z*e.z+this._w*e.w}static FromArray(e,t){return t||(t=0),new ge(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t,i){return i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3],i}static FromFloatArrayToRef(e,t,i){return ge.FromArrayToRef(e,t,i),i}static FromFloatsToRef(e,t,i,s,r){return r.x=e,r.y=t,r.z=i,r.w=s,r}static Zero(){return new ge(0,0,0,0)}static One(){return new ge(1,1,1,1)}static Random(e=0,t=1){return new ge(Ve(e,t),Ve(e,t),Ve(e,t),Ve(e,t))}static RandomToRef(e=0,t=1,i){return i.x=Ve(e,t),i.y=Ve(e,t),i.z=Ve(e,t),i.w=Ve(e,t),i}static Clamp(e,t,i){return ge.ClampToRef(e,t,i,new ge)}static ClampToRef(e,t,i,s){return s.x=be(e.x,t.x,i.x),s.y=be(e.y,t.y,i.y),s.z=be(e.z,t.z,i.z),s.w=be(e.w,t.w,i.w),s}static CheckExtends(e,t,i){t.minimizeInPlace(e),i.maximizeInPlace(e)}static get ZeroReadOnly(){return ge._ZeroReadOnly}static Normalize(e){return ge.NormalizeToRef(e,new ge)}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}static Minimize(e,t){const i=new ge;return i.copyFrom(e),i.minimizeInPlace(t),i}static Maximize(e,t){const i=new ge;return i.copyFrom(e),i.maximizeInPlace(t),i}static Distance(e,t){return Math.sqrt(ge.DistanceSquared(e,t))}static DistanceSquared(e,t){const i=e.x-t.x,s=e.y-t.y,r=e.z-t.z,n=e.w-t.w;return i*i+s*s+r*r+n*n}static Center(e,t){return ge.CenterToRef(e,t,new ge)}static CenterToRef(e,t,i){return i.x=(e.x+t.x)/2,i.y=(e.y+t.y)/2,i.z=(e.z+t.z)/2,i.w=(e.w+t.w)/2,i}static TransformCoordinates(e,t){return ge.TransformCoordinatesToRef(e,t,new ge)}static TransformCoordinatesToRef(e,t,i){return ge.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i),i}static TransformCoordinatesFromFloatsToRef(e,t,i,s,r){const n=s.m,o=e*n[0]+t*n[4]+i*n[8]+n[12],h=e*n[1]+t*n[5]+i*n[9]+n[13],l=e*n[2]+t*n[6]+i*n[10]+n[14],c=e*n[3]+t*n[7]+i*n[11]+n[15];return r.x=o,r.y=h,r.z=l,r.w=c,r}static TransformNormal(e,t){return ge.TransformNormalToRef(e,t,new ge)}static TransformNormalToRef(e,t,i){const s=t.m,r=e.x*s[0]+e.y*s[4]+e.z*s[8],n=e.x*s[1]+e.y*s[5]+e.z*s[9],o=e.x*s[2]+e.y*s[6]+e.z*s[10];return i.x=r,i.y=n,i.z=o,i.w=e.w,i}static TransformNormalFromFloatsToRef(e,t,i,s,r,n){const o=r.m;return n.x=e*o[0]+t*o[4]+i*o[8],n.y=e*o[1]+t*o[5]+i*o[9],n.z=e*o[2]+t*o[6]+i*o[10],n.w=s,n}static FromVector3(e,t=0){return new ge(e._x,e._y,e._z,t)}static Dot(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w}}ge._V8PerformanceHack=new ge(.5,.5,.5,.5);ge._ZeroReadOnly=ge.Zero();Object.defineProperties(ge.prototype,{dimension:{value:[4]},rank:{value:1}});class W{get x(){return this._x}set x(e){this._x=e,this._isDirty=!0}get y(){return this._y}set y(e){this._y=e,this._isDirty=!0}get z(){return this._z}set z(e){this._z=e,this._isDirty=!0}get w(){return this._w}set w(e){this._w=e,this._isDirty=!0}constructor(e=0,t=0,i=0,s=1){this._isDirty=!0,this._x=e,this._y=t,this._z=i,this._w=s}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z} W: ${this._w}}`}getClassName(){return"Quaternion"}getHashCode(){const e=St(this._x),t=St(this._y),i=St(this._z),s=St(this._w);let r=e;return r=r*397^t,r=r*397^i,r=r*397^s,r}asArray(){return[this._x,this._y,this._z,this._w]}toArray(e,t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,this}fromArray(e,t=0){return W.FromArrayToRef(e,t,this)}equals(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z&&this._w===e._w}equalsWithEpsilon(e,t=Me){return e&&Pe(this._x,e._x,t)&&Pe(this._y,e._y,t)&&Pe(this._z,e._z,t)&&Pe(this._w,e._w,t)}isApprox(e,t=Me){return e&&(Pe(this._x,e._x,t)&&Pe(this._y,e._y,t)&&Pe(this._z,e._z,t)&&Pe(this._w,e._w,t)||Pe(this._x,-e._x,t)&&Pe(this._y,-e._y,t)&&Pe(this._z,-e._z,t)&&Pe(this._w,-e._w,t))}clone(){return new W(this._x,this._y,this._z,this._w)}copyFrom(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._w=e._w,this._isDirty=!0,this}copyFromFloats(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._isDirty=!0,this}set(e,t,i,s){return this.copyFromFloats(e,t,i,s)}setAll(e){return this.copyFromFloats(e,e,e,e)}add(e){return new W(this._x+e._x,this._y+e._y,this._z+e._z,this._w+e._w)}addInPlace(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._w+=e._w,this._isDirty=!0,this}addToRef(e,t){return t._x=this._x+e._x,t._y=this._y+e._y,t._z=this._z+e._z,t._w=this._w+e._w,t._isDirty=!0,t}addInPlaceFromFloats(e,t,i,s){return this._x+=e,this._y+=t,this._z+=i,this._w+=s,this._isDirty=!0,this}subtractToRef(e,t){return t._x=this._x-e._x,t._y=this._y-e._y,t._z=this._z-e._z,t._w=this._w-e._w,t._isDirty=!0,t}subtractFromFloats(e,t,i,s){return this.subtractFromFloatsToRef(e,t,i,s,new W)}subtractFromFloatsToRef(e,t,i,s,r){return r._x=this._x-e,r._y=this._y-t,r._z=this._z-i,r._w=this._w-s,r._isDirty=!0,r}subtract(e){return new W(this._x-e._x,this._y-e._y,this._z-e._z,this._w-e._w)}subtractInPlace(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._w-=e._w,this._isDirty=!0,this}scale(e){return new W(this._x*e,this._y*e,this._z*e,this._w*e)}scaleToRef(e,t){return t._x=this._x*e,t._y=this._y*e,t._z=this._z*e,t._w=this._w*e,t._isDirty=!0,t}scaleInPlace(e){return this._x*=e,this._y*=e,this._z*=e,this._w*=e,this._isDirty=!0,this}scaleAndAddToRef(e,t){return t._x+=this._x*e,t._y+=this._y*e,t._z+=this._z*e,t._w+=this._w*e,t._isDirty=!0,t}multiply(e){const t=new W(0,0,0,1);return this.multiplyToRef(e,t),t}multiplyToRef(e,t){const i=this._x*e._w+this._y*e._z-this._z*e._y+this._w*e._x,s=-this._x*e._z+this._y*e._w+this._z*e._x+this._w*e._y,r=this._x*e._y-this._y*e._x+this._z*e._w+this._w*e._z,n=-this._x*e._x-this._y*e._y-this._z*e._z+this._w*e._w;return t.copyFromFloats(i,s,r,n),t}multiplyInPlace(e){return this.multiplyToRef(e,this)}multiplyByFloats(e,t,i,s){return this._x*=e,this._y*=t,this._z*=i,this._w*=s,this._isDirty=!0,this}divide(e){throw new ReferenceError("Can not divide a quaternion")}divideToRef(e,t){throw new ReferenceError("Can not divide a quaternion")}divideInPlace(e){throw new ReferenceError("Can not divide a quaternion")}minimizeInPlace(){throw new ReferenceError("Can not minimize a quaternion")}minimizeInPlaceFromFloats(){throw new ReferenceError("Can not minimize a quaternion")}maximizeInPlace(){throw new ReferenceError("Can not maximize a quaternion")}maximizeInPlaceFromFloats(){throw new ReferenceError("Can not maximize a quaternion")}negate(){return this.negateToRef(new W)}negateInPlace(){return this._x=-this._x,this._y=-this._y,this._z=-this._z,this._w=-this._w,this._isDirty=!0,this}negateToRef(e){return e._x=-this._x,e._y=-this._y,e._z=-this._z,e._w=-this._w,e._isDirty=!0,e}equalsToFloats(e,t,i,s){return this._x===e&&this._y===t&&this._z===i&&this._w===s}floorToRef(e){throw new ReferenceError("Can not floor a quaternion")}floor(){throw new ReferenceError("Can not floor a quaternion")}fractToRef(e){throw new ReferenceError("Can not fract a quaternion")}fract(){throw new ReferenceError("Can not fract a quaternion")}conjugateToRef(e){return e.copyFromFloats(-this._x,-this._y,-this._z,this._w),e}conjugateInPlace(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this}conjugate(){return new W(-this._x,-this._y,-this._z,this._w)}invert(){const e=this.conjugate(),t=this.lengthSquared();return t==0||t==1||e.scaleInPlace(1/t),e}invertInPlace(){this.conjugateInPlace();const e=this.lengthSquared();return e==0||e==1?this:(this.scaleInPlace(1/e),this)}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this.lengthSquared())}normalize(){return this.normalizeFromLength(this.length())}normalizeFromLength(e){return e===0||e===1?this:this.scaleInPlace(1/e)}normalizeToNew(){const e=new W(0,0,0,1);return this.normalizeToRef(e),e}normalizeToRef(e){const t=this.length();return t===0||t===1?e.copyFromFloats(this._x,this._y,this._z,this._w):this.scaleToRef(1/t,e)}toEulerAngles(){const e=_.Zero();return this.toEulerAnglesToRef(e),e}toEulerAnglesToRef(e){const t=this._z,i=this._x,s=this._y,r=this._w,n=s*t-i*r,o=.4999999;if(n<-o)e._y=2*Math.atan2(s,r),e._x=Math.PI/2,e._z=0,e._isDirty=!0;else if(n>o)e._y=2*Math.atan2(s,r),e._x=-Math.PI/2,e._z=0,e._isDirty=!0;else{const h=r*r,l=t*t,c=i*i,u=s*s;e._z=Math.atan2(2*(i*s+t*r),-l-c+u+h),e._x=Math.asin(-2*n),e._y=Math.atan2(2*(t*i+s*r),l-c-u+h),e._isDirty=!0}return e}toAlphaBetaGammaToRef(e){const t=this._z,i=this._x,s=this._y,r=this._w,n=Math.sqrt(i*i+s*s),o=Math.sqrt(t*t+r*r),h=2*Math.atan2(n,o),l=2*Math.atan2(t,r),c=2*Math.atan2(s,i),u=(l+c)/2,f=(l-c)/2;return e.set(f,h,u),e}toRotationMatrix(e){return P.FromQuaternionToRef(this,e),e}fromRotationMatrix(e){return W.FromRotationMatrixToRef(e,this),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}toAxisAngle(){const e=_.Zero(),t=this.toAxisAngleToRef(e);return{axis:e,angle:t}}toAxisAngleToRef(e){let t=0;const i=Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z),s=this._w;return i>0?(t=2*Math.atan2(i,s),e.set(this._x/i,this._y/i,this._z/i)):(t=0,e.set(1,0,0)),t}static FromRotationMatrix(e){const t=new W;return W.FromRotationMatrixToRef(e,t),t}static FromRotationMatrixToRef(e,t){const i=e.m,s=i[0],r=i[4],n=i[8],o=i[1],h=i[5],l=i[9],c=i[2],u=i[6],f=i[10],d=s+h+f;let g;return d>0?(g=.5/Math.sqrt(d+1),t._w=.25/g,t._x=(u-l)*g,t._y=(n-c)*g,t._z=(o-r)*g,t._isDirty=!0):s>h&&s>f?(g=2*Math.sqrt(1+s-h-f),t._w=(u-l)/g,t._x=.25*g,t._y=(r+o)/g,t._z=(n+c)/g,t._isDirty=!0):h>f?(g=2*Math.sqrt(1+h-s-f),t._w=(n-c)/g,t._x=(r+o)/g,t._y=.25*g,t._z=(l+u)/g,t._isDirty=!0):(g=2*Math.sqrt(1+f-s-h),t._w=(o-r)/g,t._x=(n+c)/g,t._y=(l+u)/g,t._z=.25*g,t._isDirty=!0),t}static Dot(e,t){return e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w}static AreClose(e,t,i=.1){const s=W.Dot(e,t);return 1-s*s<=i}static SmoothToRef(e,t,i,s,r){let n=s===0?1:i/s;return n=be(n,0,1),W.SlerpToRef(e,t,n,r),r}static Zero(){return new W(0,0,0,0)}static Inverse(e){return new W(-e._x,-e._y,-e._z,e._w)}static InverseToRef(e,t){return t.set(-e._x,-e._y,-e._z,e._w),t}static Identity(){return new W(0,0,0,1)}static IsIdentity(e){return e&&e._x===0&&e._y===0&&e._z===0&&e._w===1}static RotationAxis(e,t){return W.RotationAxisToRef(e,t,new W)}static RotationAxisToRef(e,t,i){i._w=Math.cos(t/2);const s=Math.sin(t/2)/e.length();return i._x=e._x*s,i._y=e._y*s,i._z=e._z*s,i._isDirty=!0,i}static FromArray(e,t){return t||(t=0),new W(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t,i){return i._x=e[t],i._y=e[t+1],i._z=e[t+2],i._w=e[t+3],i._isDirty=!0,i}static FromFloatsToRef(e,t,i,s,r){return r.copyFromFloats(e,t,i,s),r}static FromEulerAngles(e,t,i){const s=new W;return W.RotationYawPitchRollToRef(t,e,i,s),s}static FromEulerAnglesToRef(e,t,i,s){return W.RotationYawPitchRollToRef(t,e,i,s),s}static FromEulerVector(e){const t=new W;return W.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t}static FromEulerVectorToRef(e,t){return W.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t}static FromUnitVectorsToRef(e,t,i,s=Me){const r=_.Dot(e,t)+1;return rMath.abs(e.z)?i.set(-e.y,e.x,0,0):i.set(0,-e.z,e.y,0):(_.CrossToRef(e,t,v.Vector3[0]),i.set(v.Vector3[0].x,v.Vector3[0].y,v.Vector3[0].z,r)),i.normalize()}static RotationYawPitchRoll(e,t,i){const s=new W;return W.RotationYawPitchRollToRef(e,t,i,s),s}static RotationYawPitchRollToRef(e,t,i,s){const r=i*.5,n=t*.5,o=e*.5,h=Math.sin(r),l=Math.cos(r),c=Math.sin(n),u=Math.cos(n),f=Math.sin(o),d=Math.cos(o);return s._x=d*c*l+f*u*h,s._y=f*u*l-d*c*h,s._z=d*u*h-f*c*l,s._w=d*u*l+f*c*h,s._isDirty=!0,s}static RotationAlphaBetaGamma(e,t,i){const s=new W;return W.RotationAlphaBetaGammaToRef(e,t,i,s),s}static RotationAlphaBetaGammaToRef(e,t,i,s){const r=(i+e)*.5,n=(i-e)*.5,o=t*.5;return s._x=Math.cos(n)*Math.sin(o),s._y=Math.sin(n)*Math.sin(o),s._z=Math.sin(r)*Math.cos(o),s._w=Math.cos(r)*Math.cos(o),s._isDirty=!0,s}static RotationQuaternionFromAxis(e,t,i){const s=new W(0,0,0,0);return W.RotationQuaternionFromAxisToRef(e,t,i,s),s}static RotationQuaternionFromAxisToRef(e,t,i,s){const r=X.Matrix[0];return e=e.normalizeToRef(X.Vector3[0]),t=t.normalizeToRef(X.Vector3[1]),i=i.normalizeToRef(X.Vector3[2]),P.FromXYZAxesToRef(e,t,i,r),W.FromRotationMatrixToRef(r,s),s}static FromLookDirectionLH(e,t){const i=new W;return W.FromLookDirectionLHToRef(e,t,i),i}static FromLookDirectionLHToRef(e,t,i){const s=X.Matrix[0];return P.LookDirectionLHToRef(e,t,s),W.FromRotationMatrixToRef(s,i),i}static FromLookDirectionRH(e,t){const i=new W;return W.FromLookDirectionRHToRef(e,t,i),i}static FromLookDirectionRHToRef(e,t,i){const s=X.Matrix[0];return P.LookDirectionRHToRef(e,t,s),W.FromRotationMatrixToRef(s,i)}static Slerp(e,t,i){const s=W.Identity();return W.SlerpToRef(e,t,i,s),s}static SlerpToRef(e,t,i,s){let r,n,o=e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w,h=!1;if(o<0&&(h=!0,o=-o),o>.999999)n=1-i,r=h?-i:i;else{const l=Math.acos(o),c=1/Math.sin(l);n=Math.sin((1-i)*l)*c,r=h?-Math.sin(i*l)*c:Math.sin(i*l)*c}return s._x=n*e._x+r*t._x,s._y=n*e._y+r*t._y,s._z=n*e._z+r*t._z,s._w=n*e._w+r*t._w,s._isDirty=!0,s}static Hermite(e,t,i,s,r){const n=r*r,o=r*n,h=2*o-3*n+1,l=-2*o+3*n,c=o-2*n+r,u=o-n,f=e._x*h+i._x*l+t._x*c+s._x*u,d=e._y*h+i._y*l+t._y*c+s._y*u,g=e._z*h+i._z*l+t._z*c+s._z*u,p=e._w*h+i._w*l+t._w*c+s._w*u;return new W(f,d,g,p)}static Hermite1stDerivative(e,t,i,s,r){const n=new W;return this.Hermite1stDerivativeToRef(e,t,i,s,r,n),n}static Hermite1stDerivativeToRef(e,t,i,s,r,n){const o=r*r;return n._x=(o-r)*6*e._x+(3*o-4*r+1)*t._x+(-o+r)*6*i._x+(3*o-2*r)*s._x,n._y=(o-r)*6*e._y+(3*o-4*r+1)*t._y+(-o+r)*6*i._y+(3*o-2*r)*s._y,n._z=(o-r)*6*e._z+(3*o-4*r+1)*t._z+(-o+r)*6*i._z+(3*o-2*r)*s._z,n._w=(o-r)*6*e._w+(3*o-4*r+1)*t._w+(-o+r)*6*i._w+(3*o-2*r)*s._w,n._isDirty=!0,n}static Normalize(e){const t=W.Zero();return W.NormalizeToRef(e,t),t}static NormalizeToRef(e,t){return e.normalizeToRef(t),t}static Clamp(e,t,i){const s=new W;return W.ClampToRef(e,t,i,s),s}static ClampToRef(e,t,i,s){return s.copyFromFloats(be(e.x,t.x,i.x),be(e.y,t.y,i.y),be(e.z,t.z,i.z),be(e.w,t.w,i.w))}static Random(e=0,t=1){return new W(Ve(e,t),Ve(e,t),Ve(e,t),Ve(e,t))}static RandomToRef(e=0,t=1,i){return i.copyFromFloats(Ve(e,t),Ve(e,t),Ve(e,t),Ve(e,t))}static Minimize(){throw new ReferenceError("Quaternion.Minimize does not make sense")}static Maximize(){throw new ReferenceError("Quaternion.Maximize does not make sense")}static Distance(e,t){return Math.sqrt(W.DistanceSquared(e,t))}static DistanceSquared(e,t){const i=e.x-t.x,s=e.y-t.y,r=e.z-t.z,n=e.w-t.w;return i*i+s*s+r*r+n*n}static Center(e,t){return W.CenterToRef(e,t,W.Zero())}static CenterToRef(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2,(e.w+t.w)/2)}}W._V8PerformanceHack=new W(.5,.5,.5,.5);Object.defineProperties(W.prototype,{dimension:{value:[4]},rank:{value:1}});class P{static get Use64Bits(){return st.MatrixUse64Bits}get m(){return this._m}markAsUpdated(){this.updateFlag=Cn._UpdateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0}_updateIdentityStatus(e,t=!1,i=!1,s=!0){this._isIdentity=e,this._isIdentity3x2=e||i,this._isIdentityDirty=this._isIdentity?!1:t,this._isIdentity3x2Dirty=this._isIdentity3x2?!1:s}constructor(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,st.MatrixTrackPrecisionChange&&st.MatrixTrackedMatrices.push(this),this._m=new st.MatrixCurrentType(16),this.markAsUpdated()}isIdentity(){if(this._isIdentityDirty){this._isIdentityDirty=!1;const e=this._m;this._isIdentity=e[0]===1&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===1&&e[6]===0&&e[7]===0&&e[8]===0&&e[9]===0&&e[10]===1&&e[11]===0&&e[12]===0&&e[13]===0&&e[14]===0&&e[15]===1}return this._isIdentity}isIdentityAs3x2(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,this._m[0]!==1||this._m[5]!==1||this._m[15]!==1?this._isIdentity3x2=!1:this._m[1]!==0||this._m[2]!==0||this._m[3]!==0||this._m[4]!==0||this._m[6]!==0||this._m[7]!==0||this._m[8]!==0||this._m[9]!==0||this._m[10]!==0||this._m[11]!==0||this._m[12]!==0||this._m[13]!==0||this._m[14]!==0?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2}determinant(){if(this._isIdentity===!0)return 1;const e=this._m,t=e[0],i=e[1],s=e[2],r=e[3],n=e[4],o=e[5],h=e[6],l=e[7],c=e[8],u=e[9],f=e[10],d=e[11],g=e[12],p=e[13],m=e[14],A=e[15],E=f*A-m*d,I=u*A-p*d,M=u*m-p*f,C=c*A-g*d,x=c*m-f*g,S=c*p-g*u,L=+(o*E-h*I+l*M),N=-(n*E-h*C+l*x),D=+(n*I-o*C+l*S),Re=-(n*M-o*x+h*S);return t*L+i*N+s*D+r*Re}toString(){return`{${this.m[0]}, ${this.m[1]}, ${this.m[2]}, ${this.m[3]} +${this.m[4]}, ${this.m[5]}, ${this.m[6]}, ${this.m[7]} +${this.m[8]}, ${this.m[9]}, ${this.m[10]}, ${this.m[11]} +${this.m[12]}, ${this.m[13]}, ${this.m[14]}, ${this.m[15]}}`}toArray(e=null,t=0){if(!e)return this._m;const i=this._m;for(let s=0;s<16;s++)e[t+s]=i[s];return this}asArray(){return this._m}fromArray(e,t=0){return P.FromArrayToRef(e,t,this)}copyFromFloats(...e){return P.FromArrayToRef(e,0,this)}set(...e){const t=this._m;for(let i=0;i<16;i++)t[i]=e[i];return this.markAsUpdated(),this}setAll(e){const t=this._m;for(let i=0;i<16;i++)t[i]=e;return this.markAsUpdated(),this}invert(){return this.invertToRef(this),this}reset(){return P.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this}add(e){const t=new P;return this.addToRef(e,t),t}addToRef(e,t){const i=this._m,s=t._m,r=e.m;for(let n=0;n<16;n++)s[n]=i[n]+r[n];return t.markAsUpdated(),t}addToSelf(e){const t=this._m,i=e.m;return t[0]+=i[0],t[1]+=i[1],t[2]+=i[2],t[3]+=i[3],t[4]+=i[4],t[5]+=i[5],t[6]+=i[6],t[7]+=i[7],t[8]+=i[8],t[9]+=i[9],t[10]+=i[10],t[11]+=i[11],t[12]+=i[12],t[13]+=i[13],t[14]+=i[14],t[15]+=i[15],this.markAsUpdated(),this}addInPlace(e){const t=this._m,i=e.m;for(let s=0;s<16;s++)t[s]+=i[s];return this.markAsUpdated(),this}addInPlaceFromFloats(...e){const t=this._m;for(let i=0;i<16;i++)t[i]+=e[i];return this.markAsUpdated(),this}subtract(e){const t=this._m,i=e.m;for(let s=0;s<16;s++)t[s]-=i[s];return this.markAsUpdated(),this}subtractToRef(e,t){const i=this._m,s=e.m,r=t._m;for(let n=0;n<16;n++)r[n]=i[n]-s[n];return t.markAsUpdated(),t}subtractInPlace(e){const t=this._m,i=e.m;for(let s=0;s<16;s++)t[s]-=i[s];return this.markAsUpdated(),this}subtractFromFloats(...e){return this.subtractFromFloatsToRef(...e,new P)}subtractFromFloatsToRef(...e){const t=e.pop(),i=this._m,s=t._m,r=e;for(let n=0;n<16;n++)s[n]=i[n]-r[n];return t.markAsUpdated(),t}invertToRef(e){return this._isIdentity===!0?(P.IdentityToRef(e),e):(yo(this,e.asArray())?e.markAsUpdated():e.copyFrom(this),e)}addAtIndex(e,t){return this._m[e]+=t,this.markAsUpdated(),this}multiplyAtIndex(e,t){return this._m[e]*=t,this.markAsUpdated(),this}setTranslationFromFloats(e,t,i){return this._m[12]=e,this._m[13]=t,this._m[14]=i,this.markAsUpdated(),this}addTranslationFromFloats(e,t,i){return this._m[12]+=e,this._m[13]+=t,this._m[14]+=i,this.markAsUpdated(),this}setTranslation(e){return this.setTranslationFromFloats(e._x,e._y,e._z)}getTranslation(){return new _(this._m[12],this._m[13],this._m[14])}getTranslationToRef(e){return e.x=this._m[12],e.y=this._m[13],e.z=this._m[14],e}removeRotationAndScaling(){const e=this.m;return P.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e[12],e[13],e[14],e[15],this),this._updateIdentityStatus(e[12]===0&&e[13]===0&&e[14]===0&&e[15]===1),this}copyFrom(e){e.copyToArray(this._m);const t=e;return this.updateFlag=t.updateFlag,this._updateIdentityStatus(t._isIdentity,t._isIdentityDirty,t._isIdentity3x2,t._isIdentity3x2Dirty),this}copyToArray(e,t=0){return Ul(this,e,t),this}multiply(e){const t=new P;return this.multiplyToRef(e,t),t}multiplyInPlace(e){const t=this._m,i=e.m;for(let s=0;s<16;s++)t[s]*=i[s];return this.markAsUpdated(),this}multiplyByFloats(...e){const t=this._m;for(let i=0;i<16;i++)t[i]*=e[i];return this.markAsUpdated(),this}multiplyByFloatsToRef(...e){const t=e.pop(),i=this._m,s=t._m,r=e;for(let n=0;n<16;n++)s[n]=i[n]*r[n];return t.markAsUpdated(),t}multiplyToRef(e,t){return this._isIdentity?(t.copyFrom(e),t):e._isIdentity?(t.copyFrom(this),t):(this.multiplyToArray(e,t._m,0),t.markAsUpdated(),t)}multiplyToArray(e,t,i){return Ro(this,e,t,i),this}divide(e){return this.divideToRef(e,new P)}divideToRef(e,t){const i=this._m,s=e.m,r=t._m;for(let n=0;n<16;n++)r[n]=i[n]/s[n];return t.markAsUpdated(),t}divideInPlace(e){const t=this._m,i=e.m;for(let s=0;s<16;s++)t[s]/=i[s];return this.markAsUpdated(),this}minimizeInPlace(e){const t=this._m,i=e.m;for(let s=0;s<16;s++)t[s]=Math.min(t[s],i[s]);return this.markAsUpdated(),this}minimizeInPlaceFromFloats(...e){const t=this._m;for(let i=0;i<16;i++)t[i]=Math.min(t[i],e[i]);return this.markAsUpdated(),this}maximizeInPlace(e){const t=this._m,i=e.m;for(let s=0;s<16;s++)t[s]=Math.min(t[s],i[s]);return this.markAsUpdated(),this}maximizeInPlaceFromFloats(...e){const t=this._m;for(let i=0;i<16;i++)t[i]=Math.min(t[i],e[i]);return this.markAsUpdated(),this}negate(){return this.negateToRef(new P)}negateInPlace(){const e=this._m;for(let t=0;t<16;t++)e[t]=-e[t];return this.markAsUpdated(),this}negateToRef(e){const t=this._m,i=e._m;for(let s=0;s<16;s++)i[s]=-t[s];return e.markAsUpdated(),e}equals(e){const t=e;if(!t)return!1;if((this._isIdentity||t._isIdentity)&&!this._isIdentityDirty&&!t._isIdentityDirty)return this._isIdentity&&t._isIdentity;const i=this.m,s=t.m;return i[0]===s[0]&&i[1]===s[1]&&i[2]===s[2]&&i[3]===s[3]&&i[4]===s[4]&&i[5]===s[5]&&i[6]===s[6]&&i[7]===s[7]&&i[8]===s[8]&&i[9]===s[9]&&i[10]===s[10]&&i[11]===s[11]&&i[12]===s[12]&&i[13]===s[13]&&i[14]===s[14]&&i[15]===s[15]}equalsWithEpsilon(e,t=0){const i=this._m,s=e.m;for(let r=0;r<16;r++)if(!Pe(i[r],s[r],t))return!1;return!0}equalsToFloats(...e){const t=this._m;for(let i=0;i<16;i++)if(t[i]!=e[i])return!1;return!0}floor(){return this.floorToRef(new P)}floorToRef(e){const t=this._m,i=e._m;for(let s=0;s<16;s++)i[s]=Math.floor(t[s]);return e.markAsUpdated(),e}fract(){return this.fractToRef(new P)}fractToRef(e){const t=this._m,i=e._m;for(let s=0;s<16;s++)i[s]=t[s]-Math.floor(t[s]);return e.markAsUpdated(),e}clone(){const e=new P;return e.copyFrom(this),e}getClassName(){return"Matrix"}getHashCode(){let e=St(this._m[0]);for(let t=1;t<16;t++)e=e*397^St(this._m[t]);return e}decomposeToTransformNode(e){return e.rotationQuaternion=e.rotationQuaternion||new W,this.decompose(e.scaling,e.rotationQuaternion,e.position)}decompose(e,t,i,s,r=!0){if(this._isIdentity)return i&&i.setAll(0),e&&e.setAll(1),t&&t.copyFromFloats(0,0,0,1),!0;const n=this._m;if(i&&i.copyFromFloats(n[12],n[13],n[14]),e=e||X.Vector3[0],e.x=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]),e.y=Math.sqrt(n[4]*n[4]+n[5]*n[5]+n[6]*n[6]),e.z=Math.sqrt(n[8]*n[8]+n[9]*n[9]+n[10]*n[10]),s){const o=(r?s.absoluteScaling.x:s.scaling.x)<0?-1:1,h=(r?s.absoluteScaling.y:s.scaling.y)<0?-1:1,l=(r?s.absoluteScaling.z:s.scaling.z)<0?-1:1;e.x*=o,e.y*=h,e.z*=l}else this.determinant()<=0&&(e.y*=-1);if(e._x===0||e._y===0||e._z===0)return t&&t.copyFromFloats(0,0,0,1),!1;if(t){const o=1/e._x,h=1/e._y,l=1/e._z;P.FromValuesToRef(n[0]*o,n[1]*o,n[2]*o,0,n[4]*h,n[5]*h,n[6]*h,0,n[8]*l,n[9]*l,n[10]*l,0,0,0,0,1,X.Matrix[0]),W.FromRotationMatrixToRef(X.Matrix[0],t)}return!0}getRow(e){if(e<0||e>3)return null;const t=e*4;return new ge(this._m[t+0],this._m[t+1],this._m[t+2],this._m[t+3])}getRowToRef(e,t){if(e>=0&&e<=3){const i=e*4;t.x=this._m[i+0],t.y=this._m[i+1],t.z=this._m[i+2],t.w=this._m[i+3]}return t}setRow(e,t){return this.setRowFromFloats(e,t.x,t.y,t.z,t.w)}transpose(){const e=new P;return P.TransposeToRef(this,e),e}transposeToRef(e){return P.TransposeToRef(this,e),e}setRowFromFloats(e,t,i,s,r){if(e<0||e>3)return this;const n=e*4;return this._m[n+0]=t,this._m[n+1]=i,this._m[n+2]=s,this._m[n+3]=r,this.markAsUpdated(),this}scale(e){const t=new P;return this.scaleToRef(e,t),t}scaleToRef(e,t){for(let i=0;i<16;i++)t._m[i]=this._m[i]*e;return t.markAsUpdated(),t}scaleAndAddToRef(e,t){for(let i=0;i<16;i++)t._m[i]+=this._m[i]*e;return t.markAsUpdated(),t}scaleInPlace(e){const t=this._m;for(let i=0;i<16;i++)t[i]*=e;return this.markAsUpdated(),this}toNormalMatrix(e){const t=X.Matrix[0];this.invertToRef(t),t.transposeToRef(e);const i=e._m;return P.FromValuesToRef(i[0],i[1],i[2],0,i[4],i[5],i[6],0,i[8],i[9],i[10],0,0,0,0,1,e),e}getRotationMatrix(){const e=new P;return this.getRotationMatrixToRef(e),e}getRotationMatrixToRef(e){const t=X.Vector3[0];if(!this.decompose(t))return P.IdentityToRef(e),e;const i=this._m,s=1/t._x,r=1/t._y,n=1/t._z;return P.FromValuesToRef(i[0]*s,i[1]*s,i[2]*s,0,i[4]*r,i[5]*r,i[6]*r,0,i[8]*n,i[9]*n,i[10]*n,0,0,0,0,1,e),e}toggleModelMatrixHandInPlace(){const e=this._m;return e[2]*=-1,e[6]*=-1,e[8]*=-1,e[9]*=-1,e[14]*=-1,this.markAsUpdated(),this}toggleProjectionMatrixHandInPlace(){const e=this._m;return e[8]*=-1,e[9]*=-1,e[10]*=-1,e[11]*=-1,this.markAsUpdated(),this}static FromArray(e,t=0){const i=new P;return P.FromArrayToRef(e,t,i),i}static FromArrayToRef(e,t,i){for(let s=0;s<16;s++)i._m[s]=e[s+t];return i.markAsUpdated(),i}static FromFloat32ArrayToRefScaled(e,t,i,s){return s._m[0]=e[0+t]*i,s._m[1]=e[1+t]*i,s._m[2]=e[2+t]*i,s._m[3]=e[3+t]*i,s._m[4]=e[4+t]*i,s._m[5]=e[5+t]*i,s._m[6]=e[6+t]*i,s._m[7]=e[7+t]*i,s._m[8]=e[8+t]*i,s._m[9]=e[9+t]*i,s._m[10]=e[10+t]*i,s._m[11]=e[11+t]*i,s._m[12]=e[12+t]*i,s._m[13]=e[13+t]*i,s._m[14]=e[14+t]*i,s._m[15]=e[15+t]*i,s.markAsUpdated(),s}static get IdentityReadOnly(){return P._IdentityReadOnly}static FromValuesToRef(e,t,i,s,r,n,o,h,l,c,u,f,d,g,p,m,A){const E=A._m;E[0]=e,E[1]=t,E[2]=i,E[3]=s,E[4]=r,E[5]=n,E[6]=o,E[7]=h,E[8]=l,E[9]=c,E[10]=u,E[11]=f,E[12]=d,E[13]=g,E[14]=p,E[15]=m,A.markAsUpdated()}static FromValues(e,t,i,s,r,n,o,h,l,c,u,f,d,g,p,m){const A=new P,E=A._m;return E[0]=e,E[1]=t,E[2]=i,E[3]=s,E[4]=r,E[5]=n,E[6]=o,E[7]=h,E[8]=l,E[9]=c,E[10]=u,E[11]=f,E[12]=d,E[13]=g,E[14]=p,E[15]=m,A.markAsUpdated(),A}static Compose(e,t,i){const s=new P;return P.ComposeToRef(e,t,i,s),s}static ComposeToRef(e,t,i,s){const r=s._m,n=t._x,o=t._y,h=t._z,l=t._w,c=n+n,u=o+o,f=h+h,d=n*c,g=n*u,p=n*f,m=o*u,A=o*f,E=h*f,I=l*c,M=l*u,C=l*f,x=e._x,S=e._y,L=e._z;return r[0]=(1-(m+E))*x,r[1]=(g+C)*x,r[2]=(p-M)*x,r[3]=0,r[4]=(g-C)*S,r[5]=(1-(d+E))*S,r[6]=(A+I)*S,r[7]=0,r[8]=(p+M)*L,r[9]=(A-I)*L,r[10]=(1-(d+m))*L,r[11]=0,r[12]=i._x,r[13]=i._y,r[14]=i._z,r[15]=1,s.markAsUpdated(),s}static Identity(){const e=P.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return e._updateIdentityStatus(!0),e}static IdentityToRef(e){return P.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,e),e._updateIdentityStatus(!0),e}static Zero(){const e=P.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return e._updateIdentityStatus(!1),e}static RotationX(e){const t=new P;return P.RotationXToRef(e,t),t}static Invert(e){const t=new P;return e.invertToRef(t),t}static RotationXToRef(e,t){const i=Math.sin(e),s=Math.cos(e);return P.FromValuesToRef(1,0,0,0,0,s,i,0,0,-i,s,0,0,0,0,1,t),t._updateIdentityStatus(s===1&&i===0),t}static RotationY(e){const t=new P;return P.RotationYToRef(e,t),t}static RotationYToRef(e,t){const i=Math.sin(e),s=Math.cos(e);return P.FromValuesToRef(s,0,-i,0,0,1,0,0,i,0,s,0,0,0,0,1,t),t._updateIdentityStatus(s===1&&i===0),t}static RotationZ(e){const t=new P;return P.RotationZToRef(e,t),t}static RotationZToRef(e,t){const i=Math.sin(e),s=Math.cos(e);return P.FromValuesToRef(s,i,0,0,-i,s,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(s===1&&i===0),t}static RotationAxis(e,t){const i=new P;return P.RotationAxisToRef(e,t,i),i}static RotationAxisToRef(e,t,i){const s=Math.sin(-t),r=Math.cos(-t),n=1-r;e=e.normalizeToRef(X.Vector3[0]);const o=i._m;return o[0]=e._x*e._x*n+r,o[1]=e._x*e._y*n-e._z*s,o[2]=e._x*e._z*n+e._y*s,o[3]=0,o[4]=e._y*e._x*n+e._z*s,o[5]=e._y*e._y*n+r,o[6]=e._y*e._z*n-e._x*s,o[7]=0,o[8]=e._z*e._x*n-e._y*s,o[9]=e._z*e._y*n+e._x*s,o[10]=e._z*e._z*n+r,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,i.markAsUpdated(),i}static RotationAlignToRef(e,t,i,s=!1){const r=_.Dot(t,e),n=i._m;if(r<-1+Me)n[0]=-1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=s?1:-1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=s?-1:1,n[11]=0;else{const o=_.Cross(t,e),h=1/(1+r);n[0]=o._x*o._x*h+r,n[1]=o._y*o._x*h-o._z,n[2]=o._z*o._x*h+o._y,n[3]=0,n[4]=o._x*o._y*h+o._z,n[5]=o._y*o._y*h+r,n[6]=o._z*o._y*h-o._x,n[7]=0,n[8]=o._x*o._z*h-o._y,n[9]=o._y*o._z*h+o._x,n[10]=o._z*o._z*h+r,n[11]=0}return n[12]=0,n[13]=0,n[14]=0,n[15]=1,i.markAsUpdated(),i}static RotationYawPitchRoll(e,t,i){const s=new P;return P.RotationYawPitchRollToRef(e,t,i,s),s}static RotationYawPitchRollToRef(e,t,i,s){return W.RotationYawPitchRollToRef(e,t,i,X.Quaternion[0]),X.Quaternion[0].toRotationMatrix(s),s}static Scaling(e,t,i){const s=new P;return P.ScalingToRef(e,t,i,s),s}static ScalingToRef(e,t,i,s){return P.FromValuesToRef(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1,s),s._updateIdentityStatus(e===1&&t===1&&i===1),s}static Translation(e,t,i){const s=new P;return P.TranslationToRef(e,t,i,s),s}static TranslationToRef(e,t,i,s){return P.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e,t,i,1,s),s._updateIdentityStatus(e===0&&t===0&&i===0),s}static Lerp(e,t,i){const s=new P;return P.LerpToRef(e,t,i,s),s}static LerpToRef(e,t,i,s){const r=s._m,n=e.m,o=t.m;for(let h=0;h<16;h++)r[h]=n[h]*(1-i)+o[h]*i;return s.markAsUpdated(),s}static DecomposeLerp(e,t,i){const s=new P;return P.DecomposeLerpToRef(e,t,i,s),s}static DecomposeLerpToRef(e,t,i,s){const r=X.Vector3[0],n=X.Quaternion[0],o=X.Vector3[1];e.decompose(r,n,o);const h=X.Vector3[2],l=X.Quaternion[1],c=X.Vector3[3];t.decompose(h,l,c);const u=X.Vector3[4];_.LerpToRef(r,h,i,u);const f=X.Quaternion[2];W.SlerpToRef(n,l,i,f);const d=X.Vector3[5];return _.LerpToRef(o,c,i,d),P.ComposeToRef(u,f,d,s),s}static LookAtLH(e,t,i){const s=new P;return P.LookAtLHToRef(e,t,i,s),s}static LookAtLHToRef(e,t,i,s){const r=X.Vector3[0],n=X.Vector3[1],o=X.Vector3[2];t.subtractToRef(e,o),o.normalize(),_.CrossToRef(i,o,r);const h=r.lengthSquared();h===0?r.x=1:r.normalizeFromLength(Math.sqrt(h)),_.CrossToRef(o,r,n),n.normalize();const l=-_.Dot(r,e),c=-_.Dot(n,e),u=-_.Dot(o,e);return P.FromValuesToRef(r._x,n._x,o._x,0,r._y,n._y,o._y,0,r._z,n._z,o._z,0,l,c,u,1,s),s}static LookAtRH(e,t,i){const s=new P;return P.LookAtRHToRef(e,t,i,s),s}static LookAtRHToRef(e,t,i,s){const r=X.Vector3[0],n=X.Vector3[1],o=X.Vector3[2];e.subtractToRef(t,o),o.normalize(),_.CrossToRef(i,o,r);const h=r.lengthSquared();h===0?r.x=1:r.normalizeFromLength(Math.sqrt(h)),_.CrossToRef(o,r,n),n.normalize();const l=-_.Dot(r,e),c=-_.Dot(n,e),u=-_.Dot(o,e);return P.FromValuesToRef(r._x,n._x,o._x,0,r._y,n._y,o._y,0,r._z,n._z,o._z,0,l,c,u,1,s),s}static LookDirectionLH(e,t){const i=new P;return P.LookDirectionLHToRef(e,t,i),i}static LookDirectionLHToRef(e,t,i){const s=X.Vector3[0];s.copyFrom(e),s.scaleInPlace(-1);const r=X.Vector3[1];return _.CrossToRef(t,s,r),P.FromValuesToRef(r._x,r._y,r._z,0,t._x,t._y,t._z,0,s._x,s._y,s._z,0,0,0,0,1,i),i}static LookDirectionRH(e,t){const i=new P;return P.LookDirectionRHToRef(e,t,i),i}static LookDirectionRHToRef(e,t,i){const s=X.Vector3[2];return _.CrossToRef(t,e,s),P.FromValuesToRef(s._x,s._y,s._z,0,t._x,t._y,t._z,0,e._x,e._y,e._z,0,0,0,0,1,i),i}static OrthoLH(e,t,i,s,r){const n=new P;return P.OrthoLHToRef(e,t,i,s,n,r),n}static OrthoLHToRef(e,t,i,s,r,n){const o=i,h=s,l=2/e,c=2/t,u=2/(h-o),f=-(h+o)/(h-o);return P.FromValuesToRef(l,0,0,0,0,c,0,0,0,0,u,0,0,0,f,1,r),n&&r.multiplyToRef(Wi,r),r._updateIdentityStatus(l===1&&c===1&&u===1&&f===0),r}static OrthoOffCenterLH(e,t,i,s,r,n,o){const h=new P;return P.OrthoOffCenterLHToRef(e,t,i,s,r,n,h,o),h}static OrthoOffCenterLHToRef(e,t,i,s,r,n,o,h){const l=r,c=n,u=2/(t-e),f=2/(s-i),d=2/(c-l),g=-(c+l)/(c-l),p=(e+t)/(e-t),m=(s+i)/(i-s);return P.FromValuesToRef(u,0,0,0,0,f,0,0,0,0,d,0,p,m,g,1,o),h&&o.multiplyToRef(Wi,o),o.markAsUpdated(),o}static ObliqueOffCenterLHToRef(e,t,i,s,r,n,o,h,l,c,u){const f=-o*Math.cos(h),d=-o*Math.sin(h);return P.TranslationToRef(0,0,-l,X.Matrix[1]),P.FromValuesToRef(1,0,0,0,0,1,0,0,f,d,1,0,0,0,0,1,X.Matrix[0]),X.Matrix[1].multiplyToRef(X.Matrix[0],X.Matrix[0]),P.TranslationToRef(0,0,l,X.Matrix[1]),X.Matrix[0].multiplyToRef(X.Matrix[1],X.Matrix[0]),P.OrthoOffCenterLHToRef(e,t,i,s,r,n,c,u),X.Matrix[0].multiplyToRef(c,c),c}static OrthoOffCenterRH(e,t,i,s,r,n,o){const h=new P;return P.OrthoOffCenterRHToRef(e,t,i,s,r,n,h,o),h}static OrthoOffCenterRHToRef(e,t,i,s,r,n,o,h){return P.OrthoOffCenterLHToRef(e,t,i,s,r,n,o,h),o._m[10]*=-1,o}static ObliqueOffCenterRHToRef(e,t,i,s,r,n,o,h,l,c,u){const f=o*Math.cos(h),d=o*Math.sin(h);return P.TranslationToRef(0,0,l,X.Matrix[1]),P.FromValuesToRef(1,0,0,0,0,1,0,0,f,d,1,0,0,0,0,1,X.Matrix[0]),X.Matrix[1].multiplyToRef(X.Matrix[0],X.Matrix[0]),P.TranslationToRef(0,0,-l,X.Matrix[1]),X.Matrix[0].multiplyToRef(X.Matrix[1],X.Matrix[0]),P.OrthoOffCenterRHToRef(e,t,i,s,r,n,c,u),X.Matrix[0].multiplyToRef(c,c),c}static PerspectiveLH(e,t,i,s,r,n=0){const o=new P,h=i,l=s,c=2*h/e,u=2*h/t,f=(l+h)/(l-h),d=-2*l*h/(l-h),g=Math.tan(n);return P.FromValuesToRef(c,0,0,0,0,u,0,g,0,0,f,1,0,0,d,0,o),r&&o.multiplyToRef(Wi,o),o._updateIdentityStatus(!1),o}static PerspectiveFovLH(e,t,i,s,r,n=0,o=!1){const h=new P;return P.PerspectiveFovLHToRef(e,t,i,s,h,!0,r,n,o),h}static PerspectiveFovLHToRef(e,t,i,s,r,n=!0,o,h=0,l=!1){const c=i,u=s,f=1/Math.tan(e*.5),d=n?f/t:f,g=n?f:f*t,p=l&&c===0?-1:u!==0?(u+c)/(u-c):1,m=l&&c===0?2*u:u!==0?-2*u*c/(u-c):-2*c,A=Math.tan(h);return P.FromValuesToRef(d,0,0,0,0,g,0,A,0,0,p,1,0,0,m,0,r),o&&r.multiplyToRef(Wi,r),r._updateIdentityStatus(!1),r}static PerspectiveFovReverseLHToRef(e,t,i,s,r,n=!0,o,h=0){const l=1/Math.tan(e*.5),c=n?l/t:l,u=n?l:l*t,f=Math.tan(h);return P.FromValuesToRef(c,0,0,0,0,u,0,f,0,0,-i,1,0,0,1,0,r),o&&r.multiplyToRef(Wi,r),r._updateIdentityStatus(!1),r}static PerspectiveFovRH(e,t,i,s,r,n=0,o=!1){const h=new P;return P.PerspectiveFovRHToRef(e,t,i,s,h,!0,r,n,o),h}static PerspectiveFovRHToRef(e,t,i,s,r,n=!0,o,h=0,l=!1){const c=i,u=s,f=1/Math.tan(e*.5),d=n?f/t:f,g=n?f:f*t,p=l&&c===0?1:u!==0?-(u+c)/(u-c):-1,m=l&&c===0?2*u:u!==0?-2*u*c/(u-c):-2*c,A=Math.tan(h);return P.FromValuesToRef(d,0,0,0,0,g,0,A,0,0,p,-1,0,0,m,0,r),o&&r.multiplyToRef(Wi,r),r._updateIdentityStatus(!1),r}static PerspectiveFovReverseRHToRef(e,t,i,s,r,n=!0,o,h=0){const l=1/Math.tan(e*.5),c=n?l/t:l,u=n?l:l*t,f=Math.tan(h);return P.FromValuesToRef(c,0,0,0,0,u,0,f,0,0,-i,-1,0,0,-1,0,r),o&&r.multiplyToRef(Wi,r),r._updateIdentityStatus(!1),r}static GetFinalMatrix(e,t,i,s,r,n){const o=e.width,h=e.height,l=e.x,c=e.y,u=P.FromValues(o/2,0,0,0,0,-h/2,0,0,0,0,n-r,0,l+o/2,h/2+c,r,1),f=new P;return t.multiplyToRef(i,f),f.multiplyToRef(s,f),f.multiplyToRef(u,f)}static GetAsMatrix2x2(e){const t=e.m,i=[t[0],t[1],t[4],t[5]];return st.MatrixUse64Bits?i:new Float32Array(i)}static GetAsMatrix3x3(e){const t=e.m,i=[t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]];return st.MatrixUse64Bits?i:new Float32Array(i)}static Transpose(e){const t=new P;return P.TransposeToRef(e,t),t}static TransposeToRef(e,t){const i=e.m,s=i[0],r=i[4],n=i[8],o=i[12],h=i[1],l=i[5],c=i[9],u=i[13],f=i[2],d=i[6],g=i[10],p=i[14],m=i[3],A=i[7],E=i[11],I=i[15],M=t._m;return M[0]=s,M[1]=r,M[2]=n,M[3]=o,M[4]=h,M[5]=l,M[6]=c,M[7]=u,M[8]=f,M[9]=d,M[10]=g,M[11]=p,M[12]=m,M[13]=A,M[14]=E,M[15]=I,t.markAsUpdated(),t._updateIdentityStatus(e._isIdentity,e._isIdentityDirty),t}static Reflection(e){const t=new P;return P.ReflectionToRef(e,t),t}static ReflectionToRef(e,t){e.normalize();const i=e.normal.x,s=e.normal.y,r=e.normal.z,n=-2*i,o=-2*s,h=-2*r;return P.FromValuesToRef(n*i+1,o*i,h*i,0,n*s,o*s+1,h*s,0,n*r,o*r,h*r+1,0,n*e.d,o*e.d,h*e.d,1,t),t}static FromXYZAxesToRef(e,t,i,s){return P.FromValuesToRef(e._x,e._y,e._z,0,t._x,t._y,t._z,0,i._x,i._y,i._z,0,0,0,0,1,s),s}static FromQuaternionToRef(e,t){const i=e._x*e._x,s=e._y*e._y,r=e._z*e._z,n=e._x*e._y,o=e._z*e._w,h=e._z*e._x,l=e._y*e._w,c=e._y*e._z,u=e._x*e._w;return t._m[0]=1-2*(s+r),t._m[1]=2*(n+o),t._m[2]=2*(h-l),t._m[3]=0,t._m[4]=2*(n-o),t._m[5]=1-2*(r+i),t._m[6]=2*(c+u),t._m[7]=0,t._m[8]=2*(h+l),t._m[9]=2*(c-u),t._m[10]=1-2*(s+i),t._m[11]=0,t._m[12]=0,t._m[13]=0,t._m[14]=0,t._m[15]=1,t.markAsUpdated(),t}}P._IdentityReadOnly=P.Identity();Object.defineProperties(P.prototype,{dimension:{value:[4,4]},rank:{value:2}});class X{}X.Vector3=xi(11,_.Zero);X.Matrix=xi(2,P.Identity);X.Quaternion=xi(3,W.Zero);class v{}v.Vector2=xi(3,Q.Zero);v.Vector3=xi(13,_.Zero);v.Vector4=xi(3,ge.Zero);v.Quaternion=xi(3,W.Zero);v.Matrix=xi(8,P.Identity);nt("BABYLON.Vector2",Q);nt("BABYLON.Vector3",_);nt("BABYLON.Vector4",ge);nt("BABYLON.Matrix",P);const Wi=P.FromValues(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1),ea={};function ie(a,e=!1){if(!(e&&ea[a]))return ea[a]=!0,`${a} needs to be imported before as it contains a side-effect required by your code.`}class ji{static Eval(e,t){return e.match(/\([^()]*\)/g)?e=e.replace(/\([^()]*\)/g,i=>(i=i.slice(1,i.length-1),ji._HandleParenthesisContent(i,t))):e=ji._HandleParenthesisContent(e,t),e==="true"?!0:e==="false"?!1:ji.Eval(e,t)}static _HandleParenthesisContent(e,t){t=t||(r=>r==="true");let i;const s=e.split("||");for(const r in s)if(Object.prototype.hasOwnProperty.call(s,r)){let n=ji._SimplifyNegation(s[r].trim());const o=n.split("&&");if(o.length>1)for(let h=0;h(t=t.replace(/[\s]/g,()=>""),t.length%2?"!":"")),e=e.trim(),e==="!true"?e="false":e==="!false"&&(e="true"),e}}class Ae{static EnableFor(e){e._tags=e._tags||{},e.hasTags=()=>Ae.HasTags(e),e.addTags=t=>Ae.AddTagsTo(e,t),e.removeTags=t=>Ae.RemoveTagsFrom(e,t),e.matchesTagsQuery=t=>Ae.MatchesQuery(e,t)}static DisableFor(e){delete e._tags,delete e.hasTags,delete e.addTags,delete e.removeTags,delete e.matchesTagsQuery}static HasTags(e){if(!e._tags)return!1;const t=e._tags;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i))return!0;return!1}static GetTags(e,t=!0){if(!e._tags)return null;if(t){const i=[];for(const s in e._tags)Object.prototype.hasOwnProperty.call(e._tags,s)&&e._tags[s]===!0&&i.push(s);return i.join(" ")}else return e._tags}static AddTagsTo(e,t){if(!t||typeof t!="string")return;const i=t.split(" ");for(const s of i)Ae._AddTagTo(e,s)}static _AddTagTo(e,t){t=t.trim(),!(t===""||t==="true"||t==="false")&&(t.match(/[\s]/)||t.match(/^([!]|([|]|[&]){2})/)||(Ae.EnableFor(e),e._tags[t]=!0))}static RemoveTagsFrom(e,t){if(!Ae.HasTags(e))return;const i=t.split(" ");for(const s in i)Ae._RemoveTagFrom(e,i[s])}static _RemoveTagFrom(e,t){delete e._tags[t]}static MatchesQuery(e,t){return t===void 0?!0:t===""?Ae.HasTags(e):ji.Eval(t,i=>Ae.HasTags(e)&&e._tags[i])}}function ls(a){return Math.pow(a,Er)}function cs(a){return a<=.04045?.0773993808*a:Math.pow(.947867299*(a+.055),2.4)}function us(a){return Math.pow(a,Rl)}function ds(a){return a<=.0031308?12.92*a:1.055*Math.pow(a,.41666)-.055}class q{constructor(e=0,t=0,i=0){this.r=e,this.g=t,this.b=i}toString(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"}getClassName(){return"Color3"}getHashCode(){let e=this.r*255|0;return e=e*397^(this.g*255|0),e=e*397^(this.b*255|0),e}toArray(e,t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,this}fromArray(e,t=0){return q.FromArrayToRef(e,t,this),this}toColor4(e=1){return new fe(this.r,this.g,this.b,e)}asArray(){return[this.r,this.g,this.b]}toLuminance(){return this.r*.3+this.g*.59+this.b*.11}multiply(e){return new q(this.r*e.r,this.g*e.g,this.b*e.b)}multiplyToRef(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t}multiplyInPlace(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyByFloats(e,t,i){return new q(this.r*e,this.g*t,this.b*i)}divide(e){throw new ReferenceError("Can not divide a color")}divideToRef(e,t){throw new ReferenceError("Can not divide a color")}divideInPlace(e){throw new ReferenceError("Can not divide a color")}minimizeInPlace(e){return this.minimizeInPlaceFromFloats(e.r,e.g,e.b)}maximizeInPlace(e){return this.maximizeInPlaceFromFloats(e.r,e.g,e.b)}minimizeInPlaceFromFloats(e,t,i){return this.r=Math.min(e,this.r),this.g=Math.min(t,this.g),this.b=Math.min(i,this.b),this}maximizeInPlaceFromFloats(e,t,i){return this.r=Math.max(e,this.r),this.g=Math.max(t,this.g),this.b=Math.max(i,this.b),this}floorToRef(e){throw new ReferenceError("Can not floor a color")}floor(){throw new ReferenceError("Can not floor a color")}fractToRef(e){throw new ReferenceError("Can not fract a color")}fract(){throw new ReferenceError("Can not fract a color")}equals(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b}equalsFloats(e,t,i){return this.equalsToFloats(e,t,i)}equalsToFloats(e,t,i){return this.r===e&&this.g===t&&this.b===i}equalsWithEpsilon(e,t=Me){return Pe(this.r,e.r,t)&&Pe(this.g,e.g,t)&&Pe(this.b,e.b,t)}negate(){throw new ReferenceError("Can not negate a color")}negateInPlace(){throw new ReferenceError("Can not negate a color")}negateToRef(e){throw new ReferenceError("Can not negate a color")}scale(e){return new q(this.r*e,this.g*e,this.b*e)}scaleInPlace(e){return this.r*=e,this.g*=e,this.b*=e,this}scaleToRef(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t}scaleAndAddToRef(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t}clampToRef(e=0,t=1,i){return i.r=be(this.r,e,t),i.g=be(this.g,e,t),i.b=be(this.b,e,t),i}add(e){return new q(this.r+e.r,this.g+e.g,this.b+e.b)}addInPlace(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addInPlaceFromFloats(e,t,i){return this.r+=e,this.g+=t,this.b+=i,this}addToRef(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,t}subtract(e){return new q(this.r-e.r,this.g-e.g,this.b-e.b)}subtractToRef(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t}subtractInPlace(e){return this.r-=e.r,this.g-=e.g,this.b-=e.b,this}subtractFromFloats(e,t,i){return new q(this.r-e,this.g-t,this.b-i)}subtractFromFloatsToRef(e,t,i,s){return s.r=this.r-e,s.g=this.g-t,s.b=this.b-i,s}clone(){return new q(this.r,this.g,this.b)}copyFrom(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyFromFloats(e,t,i){return this.r=e,this.g=t,this.b=i,this}set(e,t,i){return this.copyFromFloats(e,t,i)}setAll(e){return this.r=this.g=this.b=e,this}toHexString(){const e=Math.round(this.r*255),t=Math.round(this.g*255),i=Math.round(this.b*255);return"#"+ei(e)+ei(t)+ei(i)}fromHexString(e){return e.substring(0,1)!=="#"||e.length!==7?this:(this.r=parseInt(e.substring(1,3),16)/255,this.g=parseInt(e.substring(3,5),16)/255,this.b=parseInt(e.substring(5,7),16)/255,this)}toHSV(){return this.toHSVToRef(new q)}toHSVToRef(e){const t=this.r,i=this.g,s=this.b,r=Math.max(t,i,s),n=Math.min(t,i,s);let o=0,h=0;const l=r,c=r-n;return r!==0&&(h=c/r),r!=n&&(r==t?(o=(i-s)/c,i=0&&n<=1?(h=r,l=o):n>=1&&n<=2?(h=o,l=r):n>=2&&n<=3?(l=r,c=o):n>=3&&n<=4?(l=o,c=r):n>=4&&n<=5?(h=o,c=r):n>=5&&n<=6&&(h=r,c=o);const u=i-r;return s.r=h+u,s.g=l+u,s.b=c+u,s}static FromHSV(e,t,i){const s=new q(0,0,0);return q.HSVtoRGBToRef(e,t,i,s),s}static FromHexString(e){return new q(0,0,0).fromHexString(e)}static FromArray(e,t=0){return new q(e[t],e[t+1],e[t+2])}static FromArrayToRef(e,t=0,i){i.r=e[t],i.g=e[t+1],i.b=e[t+2]}static FromInts(e,t,i){return new q(e/255,t/255,i/255)}static Lerp(e,t,i){const s=new q(0,0,0);return q.LerpToRef(e,t,i,s),s}static LerpToRef(e,t,i,s){s.r=e.r+(t.r-e.r)*i,s.g=e.g+(t.g-e.g)*i,s.b=e.b+(t.b-e.b)*i}static Hermite(e,t,i,s,r){const n=r*r,o=r*n,h=2*o-3*n+1,l=-2*o+3*n,c=o-2*n+r,u=o-n,f=e.r*h+i.r*l+t.r*c+s.r*u,d=e.g*h+i.g*l+t.g*c+s.g*u,g=e.b*h+i.b*l+t.b*c+s.b*u;return new q(f,d,g)}static Hermite1stDerivative(e,t,i,s,r){const n=q.Black();return this.Hermite1stDerivativeToRef(e,t,i,s,r,n),n}static Hermite1stDerivativeToRef(e,t,i,s,r,n){const o=r*r;n.r=(o-r)*6*e.r+(3*o-4*r+1)*t.r+(-o+r)*6*i.r+(3*o-2*r)*s.r,n.g=(o-r)*6*e.g+(3*o-4*r+1)*t.g+(-o+r)*6*i.g+(3*o-2*r)*s.g,n.b=(o-r)*6*e.b+(3*o-4*r+1)*t.b+(-o+r)*6*i.b+(3*o-2*r)*s.b}static Red(){return new q(1,0,0)}static Green(){return new q(0,1,0)}static Blue(){return new q(0,0,1)}static Black(){return new q(0,0,0)}static get BlackReadOnly(){return q._BlackReadOnly}static White(){return new q(1,1,1)}static Purple(){return new q(.5,0,.5)}static Magenta(){return new q(1,0,1)}static Yellow(){return new q(1,1,0)}static Gray(){return new q(.5,.5,.5)}static Teal(){return new q(0,1,1)}static Random(){return new q(Math.random(),Math.random(),Math.random())}}q._V8PerformanceHack=new q(.5,.5,.5);q._BlackReadOnly=q.Black();Object.defineProperties(q.prototype,{dimension:{value:[3]},rank:{value:1}});class fe{constructor(e=0,t=0,i=0,s=1){this.r=e,this.g=t,this.b=i,this.a=s}asArray(){return[this.r,this.g,this.b,this.a]}toArray(e,t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,this}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this.a=e[t+3],this}equals(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}add(e){return new fe(this.r+e.r,this.g+e.g,this.b+e.b,this.a+e.a)}addToRef(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,t.a=this.a+e.a,t}addInPlace(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this}addInPlaceFromFloats(e,t,i,s){return this.r+=e,this.g+=t,this.b+=i,this.a+=s,this}subtract(e){return new fe(this.r-e.r,this.g-e.g,this.b-e.b,this.a-e.a)}subtractToRef(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t.a=this.a-e.a,t}subtractInPlace(e){return this.r-=e.r,this.g-=e.g,this.b-=e.b,this.a-=e.a,this}subtractFromFloats(e,t,i,s){return new fe(this.r-e,this.g-t,this.b-i,this.a-s)}subtractFromFloatsToRef(e,t,i,s,r){return r.r=this.r-e,r.g=this.g-t,r.b=this.b-i,r.a=this.a-s,r}scale(e){return new fe(this.r*e,this.g*e,this.b*e,this.a*e)}scaleInPlace(e){return this.r*=e,this.g*=e,this.b*=e,this.a*=e,this}scaleToRef(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t.a=this.a*e,t}scaleAndAddToRef(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t.a+=this.a*e,t}clampToRef(e=0,t=1,i){return i.r=be(this.r,e,t),i.g=be(this.g,e,t),i.b=be(this.b,e,t),i.a=be(this.a,e,t),i}multiply(e){return new fe(this.r*e.r,this.g*e.g,this.b*e.b,this.a*e.a)}multiplyToRef(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t.a=this.a*e.a,t}multiplyInPlace(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this.a*=e.a,this}multiplyByFloats(e,t,i,s){return new fe(this.r*e,this.g*t,this.b*i,this.a*s)}divide(e){throw new ReferenceError("Can not divide a color")}divideToRef(e,t){throw new ReferenceError("Can not divide a color")}divideInPlace(e){throw new ReferenceError("Can not divide a color")}minimizeInPlace(e){return this.r=Math.min(this.r,e.r),this.g=Math.min(this.g,e.g),this.b=Math.min(this.b,e.b),this.a=Math.min(this.a,e.a),this}maximizeInPlace(e){return this.r=Math.max(this.r,e.r),this.g=Math.max(this.g,e.g),this.b=Math.max(this.b,e.b),this.a=Math.max(this.a,e.a),this}minimizeInPlaceFromFloats(e,t,i,s){return this.r=Math.min(e,this.r),this.g=Math.min(t,this.g),this.b=Math.min(i,this.b),this.a=Math.min(s,this.a),this}maximizeInPlaceFromFloats(e,t,i,s){return this.r=Math.max(e,this.r),this.g=Math.max(t,this.g),this.b=Math.max(i,this.b),this.a=Math.max(s,this.a),this}floorToRef(e){throw new ReferenceError("Can not floor a color")}floor(){throw new ReferenceError("Can not floor a color")}fractToRef(e){throw new ReferenceError("Can not fract a color")}fract(){throw new ReferenceError("Can not fract a color")}negate(){throw new ReferenceError("Can not negate a color")}negateInPlace(){throw new ReferenceError("Can not negate a color")}negateToRef(e){throw new ReferenceError("Can not negate a color")}equalsWithEpsilon(e,t=Me){return Pe(this.r,e.r,t)&&Pe(this.g,e.g,t)&&Pe(this.b,e.b,t)&&Pe(this.a,e.a,t)}equalsToFloats(e,t,i,s){return this.r===e&&this.g===t&&this.b===i&&this.a===s}toString(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"}getClassName(){return"Color4"}getHashCode(){let e=this.r*255|0;return e=e*397^(this.g*255|0),e=e*397^(this.b*255|0),e=e*397^(this.a*255|0),e}clone(){return new fe().copyFrom(this)}copyFrom(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}copyFromFloats(e,t,i,s){return this.r=e,this.g=t,this.b=i,this.a=s,this}set(e,t,i,s){return this.copyFromFloats(e,t,i,s)}setAll(e){return this.r=this.g=this.b=this.a=e,this}toHexString(e=!1){const t=Math.round(this.r*255),i=Math.round(this.g*255),s=Math.round(this.b*255);if(e)return"#"+ei(t)+ei(i)+ei(s);const r=Math.round(this.a*255);return"#"+ei(t)+ei(i)+ei(s)+ei(r)}fromHexString(e){return e.substring(0,1)!=="#"||e.length!==9&&e.length!==7?this:(this.r=parseInt(e.substring(1,3),16)/255,this.g=parseInt(e.substring(3,5),16)/255,this.b=parseInt(e.substring(5,7),16)/255,e.length===9&&(this.a=parseInt(e.substring(7,9),16)/255),this)}toLinearSpace(e=!1){const t=new fe;return this.toLinearSpaceToRef(t,e),t}toLinearSpaceToRef(e,t=!1){return t?(e.r=cs(this.r),e.g=cs(this.g),e.b=cs(this.b)):(e.r=ls(this.r),e.g=ls(this.g),e.b=ls(this.b)),e.a=this.a,this}toGammaSpace(e=!1){const t=new fe;return this.toGammaSpaceToRef(t,e),t}toGammaSpaceToRef(e,t=!1){return t?(e.r=ds(this.r),e.g=ds(this.g),e.b=ds(this.b)):(e.r=us(this.r),e.g=us(this.g),e.b=us(this.b)),e.a=this.a,this}static FromHexString(e){return e.substring(0,1)!=="#"||e.length!==9&&e.length!==7?new fe(0,0,0,0):new fe(0,0,0,1).fromHexString(e)}static Lerp(e,t,i){return fe.LerpToRef(e,t,i,new fe)}static LerpToRef(e,t,i,s){return s.r=e.r+(t.r-e.r)*i,s.g=e.g+(t.g-e.g)*i,s.b=e.b+(t.b-e.b)*i,s.a=e.a+(t.a-e.a)*i,s}static Hermite(e,t,i,s,r){const n=r*r,o=r*n,h=2*o-3*n+1,l=-2*o+3*n,c=o-2*n+r,u=o-n,f=e.r*h+i.r*l+t.r*c+s.r*u,d=e.g*h+i.g*l+t.g*c+s.g*u,g=e.b*h+i.b*l+t.b*c+s.b*u,p=e.a*h+i.a*l+t.a*c+s.a*u;return new fe(f,d,g,p)}static Hermite1stDerivative(e,t,i,s,r){const n=new fe;return this.Hermite1stDerivativeToRef(e,t,i,s,r,n),n}static Hermite1stDerivativeToRef(e,t,i,s,r,n){const o=r*r;n.r=(o-r)*6*e.r+(3*o-4*r+1)*t.r+(-o+r)*6*i.r+(3*o-2*r)*s.r,n.g=(o-r)*6*e.g+(3*o-4*r+1)*t.g+(-o+r)*6*i.g+(3*o-2*r)*s.g,n.b=(o-r)*6*e.b+(3*o-4*r+1)*t.b+(-o+r)*6*i.b+(3*o-2*r)*s.b,n.a=(o-r)*6*e.a+(3*o-4*r+1)*t.a+(-o+r)*6*i.a+(3*o-2*r)*s.a}static FromColor3(e,t=1){return new fe(e.r,e.g,e.b,t)}static FromArray(e,t=0){return new fe(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t=0,i){i.r=e[t],i.g=e[t+1],i.b=e[t+2],i.a=e[t+3]}static FromInts(e,t,i,s){return new fe(e/255,t/255,i/255,s/255)}static CheckColors4(e,t){if(e.length===t*3){const i=[];for(let s=0;snew fe(0,0,0,0));nt("BABYLON.Color3",q);nt("BABYLON.Color4",fe);const ta=function(a,e,t,i={}){const s=a();Ae&&Ae.HasTags(e)&&Ae.AddTagsTo(s,Ae.GetTags(e,!0));const r=fn(s),n={};for(const o in r){const h=r[o],l=e[o],c=h.type;if(l!=null&&(o!=="uniqueId"||le.AllowLoadingUniqueId))switch(c){case 0:case 6:case 9:case 11:s[o]=l;break;case 1:i.cloneTexturesOnlyOnce&&n[l.uniqueId]?s[o]=n[l.uniqueId]:(s[o]=t||l.isRenderTarget?l:l.clone(),n[l.uniqueId]=s[o]);break;case 2:case 3:case 4:case 5:case 7:case 8:case 10:case 12:s[o]=t?l:l.clone();break}}return s};class le{static AppendSerializedAnimations(e,t){if(e.animations){t.animations=[];for(let i=0;i{throw ie("ImageProcessingConfiguration")};le._FresnelParametersParser=a=>{throw ie("FresnelParameters")};le._ColorCurvesParser=a=>{throw ie("ColorCurves")};le._TextureParser=(a,e,t)=>{throw ie("Texture")};class kl{constructor(){this._doNotSerialize=!1,this._isDisposed=!1,this._sceneRootNodesIndex=-1,this._isEnabled=!0,this._isParentEnabled=!0,this._isReady=!0,this._onEnabledStateChangedObservable=new O,this._onClonedObservable=new O,this._inheritVisibility=!1,this._isVisible=!0}}class qe{static AddNodeConstructor(e,t){this._NodeConstructors[e]=t}static Construct(e,t,i,s){const r=this._NodeConstructors[e];return r?r(t,i,s):null}set accessibilityTag(e){this._accessibilityTag=e,this.onAccessibilityTagChangedObservable.notifyObservers(e)}get accessibilityTag(){return this._accessibilityTag}get doNotSerialize(){return this._nodeDataStorage._doNotSerialize?!0:this._parentNode?this._parentNode.doNotSerialize:!1}set doNotSerialize(e){this._nodeDataStorage._doNotSerialize=e}isDisposed(){return this._nodeDataStorage._isDisposed}set parent(e){if(this._parentNode===e)return;const t=this._parentNode;if(this._parentNode&&this._parentNode._children!==void 0&&this._parentNode._children!==null){const i=this._parentNode._children.indexOf(this);i!==-1&&this._parentNode._children.splice(i,1),!e&&!this._nodeDataStorage._isDisposed&&this._addToSceneRootNodes()}this._parentNode=e,this._isDirty=!0,this._parentNode&&((this._parentNode._children===void 0||this._parentNode._children===null)&&(this._parentNode._children=new Array),this._parentNode._children.push(this),t||this._removeFromSceneRootNodes()),this._syncParentEnabledState()}get parent(){return this._parentNode}get inheritVisibility(){return this._nodeDataStorage._inheritVisibility}set inheritVisibility(e){this._nodeDataStorage._inheritVisibility=e}get isVisible(){return this.inheritVisibility&&this._parentNode&&!this._parentNode.isVisible?!1:this._nodeDataStorage._isVisible}set isVisible(e){this._nodeDataStorage._isVisible=e}_serializeAsParent(e){e.parentId=this.uniqueId}_addToSceneRootNodes(){this._nodeDataStorage._sceneRootNodesIndex===-1&&(this._nodeDataStorage._sceneRootNodesIndex=this._scene.rootNodes.length,this._scene.rootNodes.push(this))}_removeFromSceneRootNodes(){if(this._nodeDataStorage._sceneRootNodesIndex!==-1){const e=this._scene.rootNodes,t=e.length-1;e[this._nodeDataStorage._sceneRootNodesIndex]=e[t],e[this._nodeDataStorage._sceneRootNodesIndex]._nodeDataStorage._sceneRootNodesIndex=this._nodeDataStorage._sceneRootNodesIndex,this._scene.rootNodes.pop(),this._nodeDataStorage._sceneRootNodesIndex=-1}}get animationPropertiesOverride(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}getClassName(){return"Node"}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get onEnabledStateChangedObservable(){return this._nodeDataStorage._onEnabledStateChangedObservable}get onClonedObservable(){return this._nodeDataStorage._onClonedObservable}constructor(e,t=null,i=!0){this._isDirty=!1,this._nodeDataStorage=new kl,this.state="",this.metadata=null,this.reservedDataStore=null,this._accessibilityTag=null,this.onAccessibilityTagChangedObservable=new O,this._parentContainer=null,this.animations=[],this._ranges={},this.onReady=null,this._currentRenderId=-1,this._parentUpdateId=-1,this._childUpdateId=-1,this._waitingParentId=null,this._waitingParentInstanceIndex=null,this._waitingParsedUniqueId=null,this._cache={},this._parentNode=null,this._children=null,this._worldMatrix=P.Identity(),this._worldMatrixDeterminant=0,this._worldMatrixDeterminantIsDirty=!0,this._animationPropertiesOverride=null,this._isNode=!0,this.onDisposeObservable=new O,this._onDisposeObserver=null,this._behaviors=new Array,this.name=e,this.id=e,this._scene=t||Te.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache(),i&&this._addToSceneRootNodes()}getScene(){return this._scene}getEngine(){return this._scene.getEngine()}addBehavior(e,t=!1){return this._behaviors.indexOf(e)!==-1?this:(e.init(),this._scene.isLoading&&!t?this._scene.onDataLoadedObservable.addOnce(()=>{this._behaviors.includes(e)&&e.attach(this)}):e.attach(this),this._behaviors.push(e),this)}removeBehavior(e){const t=this._behaviors.indexOf(e);return t===-1?this:(this._behaviors[t].detach(),this._behaviors.splice(t,1),this)}get behaviors(){return this._behaviors}getBehaviorByName(e){for(const t of this._behaviors)if(t.name===e)return t;return null}getWorldMatrix(){return this._currentRenderId!==this._scene.getRenderId()&&this.computeWorldMatrix(),this._worldMatrix}_getWorldMatrixDeterminant(){return this._worldMatrixDeterminantIsDirty&&(this._worldMatrixDeterminantIsDirty=!1,this._worldMatrixDeterminant=this._worldMatrix.determinant()),this._worldMatrixDeterminant}get worldMatrixFromCache(){return this._worldMatrix}_initCache(){this._cache={}}updateCache(e){!e&&this.isSynchronized()||this._updateCache()}_getActionManagerForTrigger(e,t=!0){return this.parent?this.parent._getActionManagerForTrigger(e,!1):null}_updateCache(e){}_isSynchronized(){return!0}_markSyncedWithParent(){this._parentNode&&(this._parentUpdateId=this._parentNode._childUpdateId)}isSynchronizedWithParent(){return this._parentNode?this._parentNode._isDirty||this._parentUpdateId!==this._parentNode._childUpdateId?!1:this._parentNode.isSynchronized():!0}isSynchronized(){return this._parentNode&&!this.isSynchronizedWithParent()?!1:this._isSynchronized()}isReady(e=!1){return this._nodeDataStorage._isReady}markAsDirty(e){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this}isEnabled(e=!0){return e===!1?this._nodeDataStorage._isEnabled:this._nodeDataStorage._isEnabled?this._nodeDataStorage._isParentEnabled:!1}_syncParentEnabledState(){if(this._nodeDataStorage._isParentEnabled=this._parentNode?this._parentNode.isEnabled():!0,this._children)for(const e of this._children)e._syncParentEnabledState()}setEnabled(e){this._nodeDataStorage._isEnabled!==e&&(this._nodeDataStorage._isEnabled=e,this._syncParentEnabledState(),this._nodeDataStorage._onEnabledStateChangedObservable.notifyObservers(e))}isDescendantOf(e){return this.parent?this.parent===e?!0:this.parent.isDescendantOf(e):!1}_getDescendants(e,t=!1,i){if(this._children)for(let s=0;s(!t||t(s))&&s.cullingStrategy!==void 0),i}getChildren(e,t=!0){return this.getDescendants(t,e)}_setReady(e){if(e!==this._nodeDataStorage._isReady){if(!e){this._nodeDataStorage._isReady=!1;return}this.onReady&&this.onReady(this),this._nodeDataStorage._isReady=!0}}getAnimationByName(e){for(let t=0;tnew qe(e,this.getScene()),this);if(t&&(s.parent=t),!i){const r=this.getDescendants(!0);for(let n=0;n{throw ie("AnimationRange")};qe._NodeConstructors={};T([R()],qe.prototype,"name",void 0);T([R()],qe.prototype,"id",void 0);T([R()],qe.prototype,"uniqueId",void 0);T([R()],qe.prototype,"state",void 0);T([R()],qe.prototype,"metadata",void 0);function _t(){return typeof window<"u"}function hs(){return typeof navigator<"u"}function Fs(){return typeof document<"u"}function xo(a){let e="",t=a.firstChild;for(;t;)t.nodeType===3&&(e+=t.textContent),t=t.nextSibling;return e}class w{static _CheckLimit(e,t){let i=w._LogLimitOutputs[e];return i?i.current++:(i={limit:t,current:1},w._LogLimitOutputs[e]=i),i.current<=i.limit}static _GenerateLimitMessage(e,t=1){const i=w._LogLimitOutputs[e];if(!i||!w.MessageLimitReached)return;const s=this._Levels[t];i.current===i.limit&&w[s.name](w.MessageLimitReached.replace(/%LIMIT%/g,""+i.limit).replace(/%TYPE%/g,s.name??""))}static _AddLogEntry(e){w._LogCache=e+w._LogCache,w.OnNewCacheEntry&&w.OnNewCacheEntry(e)}static _FormatMessage(e){const t=s=>s<10?"0"+s:""+s,i=new Date;return"["+t(i.getHours())+":"+t(i.getMinutes())+":"+t(i.getSeconds())+"]: "+e}static _LogDisabled(e,t){}static _LogEnabled(e=1,t,i){const s=Array.isArray(t)?t[0]:t;if(i!==void 0&&!w._CheckLimit(s,i))return;const r=w._FormatMessage(s),n=this._Levels[e],o=Array.isArray(t)?t.slice(1):[];n.logFunc&&n.logFunc("BJS - "+r,...o);const h=`
          ${r}

          `;w._AddLogEntry(h),w._GenerateLimitMessage(s,e)}static get LogCache(){return w._LogCache}static ClearLogCache(){w._LogCache="",w._LogLimitOutputs={},w.errorsCount=0}static set LogLevels(e){w.Log=w._LogDisabled,w.Warn=w._LogDisabled,w.Error=w._LogDisabled;const t=[w.MessageLogLevel,w.WarningLogLevel,w.ErrorLogLevel];for(const i of t)if((e&i)===i){const s=this._Levels[i];w[s.name]=w._LogEnabled.bind(w,i)}}}w.NoneLogLevel=0;w.MessageLogLevel=1;w.WarningLogLevel=2;w.ErrorLogLevel=4;w.AllLogLevel=7;w.MessageLimitReached="Too many %TYPE%s (%LIMIT%), no more %TYPE%s will be reported for this message.";w._LogCache="";w._LogLimitOutputs={};w._Levels=[{},{color:"white",logFunc:console.log,name:"Log"},{color:"orange",logFunc:console.warn,name:"Warn"},{},{color:"red",logFunc:console.error,name:"Error"}];w.errorsCount=0;w.Log=w._LogEnabled.bind(w,w.MessageLogLevel);w.Warn=w._LogEnabled.bind(w,w.WarningLogLevel);w.Error=w._LogEnabled.bind(w,w.ErrorLogLevel);const ia=(a,e,t)=>!a||a.getClassName&&a.getClassName()==="Mesh"?null:a.getClassName&&(a.getClassName()==="SubMesh"||a.getClassName()==="PhysicsBody")?a.clone(e):a.clone?a.clone():Array.isArray(a)?a.slice():t&&typeof a=="object"?{...a}:null;function Gl(a){const e=[];do{const t=Object.getOwnPropertyNames(a);for(const i of t)e.indexOf(i)===-1&&e.push(i)}while(a=Object.getPrototypeOf(a));return e}class So{static DeepCopy(e,t,i,s,r=!1){const n=Gl(e);for(const o of n){if(o[0]==="_"&&(!s||s.indexOf(o)===-1)||o.endsWith("Observable")||i&&i.indexOf(o)!==-1)continue;const h=e[o],l=typeof h;if(l!=="function")try{if(l==="object")if(h instanceof Uint8Array)t[o]=Uint8Array.from(h);else if(h instanceof Array){if(t[o]=[],h.length>0)if(typeof h[0]=="object")for(let c=0;c0||gt.CustomRequestModifiers.length>0}get requestURL(){return this._requestURL}_injectCustomRequestHeaders(){if(!this._shouldSkipRequestModifications(this._requestURL))for(const e in gt.CustomRequestHeaders){const t=gt.CustomRequestHeaders[e];t&&this._xhr.setRequestHeader(e,t)}}_shouldSkipRequestModifications(e){return gt.SkipRequestModificationForBabylonCDN&&(e.includes("preview.babylonjs.com")||e.includes("cdn.babylonjs.com"))}get onprogress(){return this._xhr.onprogress}set onprogress(e){this._xhr.onprogress=e}get readyState(){return this._xhr.readyState}get status(){return this._xhr.status}get statusText(){return this._xhr.statusText}get response(){return this._xhr.response}get responseURL(){return this._xhr.responseURL}get responseText(){return this._xhr.responseText}get responseType(){return this._xhr.responseType}set responseType(e){this._xhr.responseType=e}get timeout(){return this._xhr.timeout}set timeout(e){this._xhr.timeout=e}addEventListener(e,t,i){this._xhr.addEventListener(e,t,i)}removeEventListener(e,t,i){this._xhr.removeEventListener(e,t,i)}abort(){this._xhr.abort()}send(e){gt.CustomRequestHeaders&&this._injectCustomRequestHeaders(),this._xhr.send(e)}open(e,t){for(const i of gt.CustomRequestModifiers){if(this._shouldSkipRequestModifications(t))return;t=i(this._xhr,t)||t}t=t.replace("file:http:","http:"),t=t.replace("file:https:","https:"),this._requestURL=t,this._xhr.open(e,t,!0)}setRequestHeader(e,t){this._xhr.setRequestHeader(e,t)}getResponseHeader(e){return this._xhr.getResponseHeader(e)}}gt.CustomRequestHeaders={};gt.CustomRequestModifiers=new Array;gt.SkipRequestModificationForBabylonCDN=!0;class ws{}ws.FilesToLoad={};class Vl{static ExponentialBackoff(e=3,t=500){return(i,s,r)=>s.status!==0||r>=e||i.indexOf("file:")!==-1?-1:Math.pow(2,r)*t}}class Fi extends Error{}Fi._setPrototypeOf=Object.setPrototypeOf||((a,e)=>(a.__proto__=e,a));const xs={MeshInvalidPositionsError:0,GLTFLoaderUnexpectedMagicError:2e3,SceneLoaderError:3e3,LoadFileError:4e3,RequestFileError:4001,ReadFileError:4002};class Li extends Fi{constructor(e,t,i){super(e),this.errorCode=t,this.innerError=i,this.name="RuntimeError",Fi._setPrototypeOf(this,Li.prototype)}}class Ot extends Fi{constructor(e="Operation aborted"){super(e),this.name="AbortError",Fi._setPrototypeOf(this,Ot.prototype)}}const f_=a=>{if(typeof TextDecoder<"u")return new TextDecoder().decode(a);let e="";for(let t=0;t{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let t="",i,s,r,n,o,h,l,c=0;const u=ArrayBuffer.isView(a)?new Uint8Array(a.buffer,a.byteOffset,a.byteLength):new Uint8Array(a);for(;c>2,o=(i&3)<<4|s>>4,h=(s&15)<<2|r>>6,l=r&63,isNaN(s)?h=l=64:isNaN(r)&&(l=64),t+=e.charAt(n)+e.charAt(o)+e.charAt(h)+e.charAt(l);return t},Co=a=>atob(a),zl=a=>{const e=Co(a),t=e.length,i=new Uint8Array(new ArrayBuffer(t));for(let s=0;s1&&this._lines.push(i);else{const r=t.split(";");for(let n=0;n{c=c.trim(),c!==""&&(i.push(c),c="")},n=u=>{sGe._Stack[s],h=()=>s===-1?"!!INVALID EXPRESSION!!":Ge._Stack[s--];let l=0,c="";for(;l1){for(r();s!==-1&&Ge._OperatorPriority[o()]>=Ge._OperatorPriority[f];)i.push(h());n(f),l++}else c+=u;l++}for(r();s!==-1;)o()==="("?h():i.push(h());return Ge._InfixToPostfixCache.size>=Ge.InfixToPostfixCacheLimitSize&&Ge.ClearCache(),Ge._InfixToPostfixCache.set(e,{result:i,accessTime:Date.now()}),i}static ClearCache(){const e=Array.from(Ge._InfixToPostfixCache.entries()).sort((t,i)=>t[1].accessTime-i[1].accessTime);for(let t=0;t":t=i>s;break;case"<":t=i=":t=i>=s;break;case"==":t=i===s;break;case"!=":t=i!==s;break}return t}}const Mr={};function Io(a,e,t=""){return t+(e?e+` +`:"")+a}function Po(a,e,t,i,s,r,n){const o=n||Mr.loadFile;if(o)return o(a,e,t,i,s,r);throw ie("FileTools")}function vo(a,e,t,i){if(a){e?a.IS_NDC_HALF_ZRANGE="":delete a.IS_NDC_HALF_ZRANGE,t?a.USE_REVERSE_DEPTHBUFFER="":delete a.USE_REVERSE_DEPTHBUFFER,i?a.USE_EXACT_SRGB_CONVERSIONS="":delete a.USE_EXACT_SRGB_CONVERSIONS;return}else{let s="";return e&&(s+="#define IS_NDC_HALF_ZRANGE"),t&&(s&&(s+=` +`),s+="#define USE_REVERSE_DEPTHBUFFER"),i&&(s&&(s+=` +`),s+="#define USE_EXACT_SRGB_CONVERSIONS"),s}}function Zl(a,e,t=!1,i){switch(a){case 3:{const r=e instanceof ArrayBuffer?new Int8Array(e):new Int8Array(e);return i&&r.set(new Int8Array(i)),r}case 0:{const r=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e);return i&&r.set(new Uint8Array(i)),r}case 4:{const r=e instanceof ArrayBuffer?new Int16Array(e):new Int16Array(t?e/2:e);return i&&r.set(new Int16Array(i)),r}case 5:case 8:case 9:case 10:case 2:{const r=e instanceof ArrayBuffer?new Uint16Array(e):new Uint16Array(t?e/2:e);return i&&r.set(new Uint16Array(i)),r}case 6:{const r=e instanceof ArrayBuffer?new Int32Array(e):new Int32Array(t?e/4:e);return i&&r.set(new Int32Array(i)),r}case 7:case 11:case 12:case 13:case 14:case 15:{const r=e instanceof ArrayBuffer?new Uint32Array(e):new Uint32Array(t?e/4:e);return i&&r.set(new Uint32Array(i)),r}case 1:{const r=e instanceof ArrayBuffer?new Float32Array(e):new Float32Array(t?e/4:e);return i&&r.set(new Float32Array(i)),r}}const s=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e);return i&&s.set(new Uint8Array(i)),s}const $l=/defined\s*?\((.+?)\)/g,jr=/defined\s*?\[(.+?)\]/g,Jl=/#include\s?<(.+)>(\((.*)\))*(\[(.*)\])*/g,ec=/__decl__/,sa=/light\{X\}.(\w*)/g,ra=/\{X\}/g,ur=[],tc=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;function ic(a){a.processor&&a.processor.initializeShaders&&a.processor.initializeShaders(a.processingContext)}function na(a,e,t,i){e.processor?.preProcessShaderCode&&(a=e.processor.preProcessShaderCode(a,e.isFragment)),Cr(a,e,s=>{e.processCodeAfterIncludes&&(s=e.processCodeAfterIncludes(e.isFragment?"fragment":"vertex",s,e.defines));const r=hc(s,e,i);t(r,s)})}function sc(a,e,t){return!t.processor||!t.processor.finalizeShaders?{vertexCode:a,fragmentCode:e}:t.processor.finalizeShaders(a,e,t.processingContext)}function rc(a,e){if(e.processor?.noPrecision)return a;const t=e.shouldUseHighPrecisionShader;return a.indexOf("precision highp float")===-1?t?a=`precision highp float; +`+a:a=`precision mediump float; +`+a:t||(a=a.replace("precision highp float","precision mediump float")),a}function Qr(a){const t=/defined\((.+)\)/.exec(a);if(t&&t.length)return new Sr(t[1].trim(),a[0]==="!");const i=["==","!=",">=","<=","<",">"];let s="",r=0;for(s of i)if(r=a.indexOf(s),r>-1)break;if(r===-1)return new Sr(a);const n=a.substring(0,r).trim(),o=a.substring(r+s.length).trim();return new Ql(n,s,o)}function nc(a){a=a.replace($l,"defined[$1]");const e=Ge.infixToPostfix(a),t=[];for(const s of e)if(s!=="||"&&s!=="&&")t.push(s);else if(t.length>=2){let r=t[t.length-1],n=t[t.length-2];t.length-=2;const o=s=="&&"?new jl:new ql;typeof r=="string"&&(r=r.replace(jr,"defined($1)")),typeof n=="string"&&(n=n.replace(jr,"defined($1)")),o.leftOperand=typeof n=="string"?Qr(n):n,o.rightOperand=typeof r=="string"?Qr(r):r,t.push(o)}let i=t[t.length-1];return typeof i=="string"&&(i=i.replace(jr,"defined($1)")),typeof i=="string"?Qr(i):i}function Ar(a,e){const t=new Yl,i=a.substring(0,e);let s=a.substring(e);return s=s.substring(0,(s.indexOf("//")+1||s.length+1)-1).trim(),i==="#ifdef"?t.testExpression=new Sr(s):i==="#ifndef"?t.testExpression=new Sr(s,!0):t.testExpression=nc(s),t}function Zr(a,e,t,i){let s=a.currentLine;for(;_n(a,t);){s=a.currentLine;const r=s.substring(0,5).toLowerCase();if(r==="#else"){const n=new er;e.children.push(n),_n(a,n);return}else if(r==="#elif"){const n=Ar(s,5);e.children.push(n),t=n}}}function _n(a,e,t){for(;a.canRead;){a.lineIndex++;const i=a.currentLine;if(i.indexOf("#")>=0){const r=tc.exec(i);if(r&&r.length){switch(r[0]){case"#ifdef":{const o=new qr;e.children.push(o);const h=Ar(i,6);o.children.push(h),Zr(a,o,h);break}case"#else":case"#elif":return!0;case"#endif":return!1;case"#ifndef":{const o=new qr;e.children.push(o);const h=Ar(i,7);o.children.push(h),Zr(a,o,h);break}case"#if":{const o=new qr,h=Ar(i,3);e.children.push(o),o.children.push(h),Zr(a,o,h);break}}continue}}const s=new er;if(s.line=i,e.children.push(s),i[0]==="#"&&i[1]==="d"){const r=i.replace(";","").split(" ");s.additionalDefineKey=r[1],r.length===3&&(s.additionalDefineValue=r[2])}}return!1}function ac(a,e,t,i){const s=new er,r=new Kl;return r.lineIndex=-1,r.lines=a.split(` +`),_n(r,s),s.process(e,t,i)}function oc(a,e){const t=a.defines,i={};for(const s of t){const n=s.replace("#define","").replace(";","").trim().split(" ");i[n[0]]=n.length>1?n[1]:""}return a.processor?.shaderLanguage===0&&(i.GL_ES="true"),i.__VERSION__=a.version,i[a.platformName]="true",vo(i,e?.isNDCHalfZRange,e?.useReverseDepthBuffer,e?.useExactSrgbConversions),i}function hc(a,e,t){let i=rc(a,e);if(!e.processor||e.processor.shaderLanguage===0&&i.indexOf("#version 3")!==-1&&(i=i.replace("#version 300 es",""),!e.processor.parseGLES3))return i;const s=e.defines,r=oc(e,t);e.processor.preProcessor&&(i=e.processor.preProcessor(i,s,r,e.isFragment,e.processingContext));const n={};return i=ac(i,r,e,n),e.processor.postProcessor&&(i=e.processor.postProcessor(i,s,e.isFragment,e.processingContext,t?{drawBuffersExtensionDisabled:!t.getCaps().drawBuffersExtension}:{},r,n)),t?._features.needShaderCodeInlining&&(i=t.inlineShaderCode(i)),i}function Cr(a,e,t){ur.length=0;let i;for(;(i=Jl.exec(a))!==null;)ur.push(i);let s=String(a),r=[a],n=!1;for(const o of ur){let h=o[1];if(h.indexOf("__decl__")!==-1&&(h=h.replace(ec,""),e.supportsUniformBuffers&&(h=h.replace("Vertex","Ubo").replace("Fragment","Ubo")),h=h+"Declaration"),e.includesShadersStore[h]){let l=e.includesShadersStore[h];if(o[2]){const u=o[3].split(",");for(let f=0;fE+"{X}")),l+=p.replace(ra,m.toString())+` +`}else e.supportsUniformBuffers||(l=l.replace(sa,(f,d)=>d+"{X}")),l=l.replace(ra,u)}const c=[];for(const u of r){const f=u.split(o[0]);for(let d=0;d=0||l.indexOf("#include <")>=0}else{const l=e.shadersRepository+"ShadersInclude/"+h+".fx";Do.loadFile(l,c=>{e.includesShadersStore[h]=c,Cr(r.join(""),e,t)});return}}ur.length=0,s=r.join(""),n?Cr(s.toString(),e,t):t(s)}const Do={loadFile:(a,e,t,i,s,r)=>{throw ie("FileTools")}};let dr=[];class ks{static SetImmediate(e){dr.length===0&&setTimeout(()=>{const t=dr;dr=[];for(const i of t)i()},1),dr.push(e)}}function aa(a,e,t){try{if(a())return e(),!0}catch(i){return t?.(i),!0}return!1}const tr=(a,e,t,i=16,s=3e4,r=!0,n)=>{if(r&&aa(a,e,t))return null;const o=setInterval(()=>{aa(a,e,t)?clearInterval(o):(s-=i,s<0&&(clearInterval(o),t?.(new Error("Operation timed out after maximum retries. "+(n||"")),!0)))},i);return()=>clearInterval(o)};class We{static GetShadersRepository(e=0){return e===0?We.ShadersRepository:We.ShadersRepositoryWGSL}static GetShadersStore(e=0){return e===0?We.ShadersStore:We.ShadersStoreWGSL}static GetIncludesShadersStore(e=0){return e===0?We.IncludesShadersStore:We.IncludesShadersStoreWGSL}}We.ShadersRepository="src/Shaders/";We.ShadersStore={};We.IncludesShadersStore={};We.ShadersRepositoryWGSL="src/ShadersWGSL/";We.ShadersStoreWGSL={};We.IncludesShadersStoreWGSL={};class lc{constructor(){this._valueCache={},this.vertexCompilationError=null,this.fragmentCompilationError=null,this.programLinkError=null,this.programValidationError=null,this._isDisposed=!1}get isAsync(){return this.isParallelCompiled}get isReady(){return this.program?this.isParallelCompiled?this.engine._isRenderingStateCompiled(this):!0:!1}_handlesSpectorRebuildCallback(e){e&&this.program&&e(this.program)}setEngine(e){this.engine=e}_fillEffectInformation(e,t,i,s,r,n,o,h){const l=this.engine;if(l.supportsUniformBuffers)for(const f in t)e.bindUniformBlock(f,t[f]);this.engine.getUniforms(this,i).forEach((f,d)=>{s[i[d]]=f}),this._uniforms=s;let u;for(u=0;u{n[f]=d});for(const f of l.getAttributes(this,o))h.push(f)}dispose(){this._uniforms={},this._isDisposed=!0}_cacheMatrix(e,t){const i=this._valueCache[e],s=t.updateFlag;return i!==void 0&&i===s?!1:(this._valueCache[e]=s,!0)}_cacheFloat2(e,t,i){let s=this._valueCache[e];if(!s||s.length!==2)return s=[t,i],this._valueCache[e]=s,!0;let r=!1;return s[0]!==t&&(s[0]=t,r=!0),s[1]!==i&&(s[1]=i,r=!0),r}_cacheFloat3(e,t,i,s){let r=this._valueCache[e];if(!r||r.length!==3)return r=[t,i,s],this._valueCache[e]=r,!0;let n=!1;return r[0]!==t&&(r[0]=t,n=!0),r[1]!==i&&(r[1]=i,n=!0),r[2]!==s&&(r[2]=s,n=!0),n}_cacheFloat4(e,t,i,s,r){let n=this._valueCache[e];if(!n||n.length!==4)return n=[t,i,s,r],this._valueCache[e]=n,!0;let o=!1;return n[0]!==t&&(n[0]=t,o=!0),n[1]!==i&&(n[1]=i,o=!0),n[2]!==s&&(n[2]=s,o=!0),n[3]!==r&&(n[3]=r,o=!0),o}setInt(e,t){const i=this._valueCache[e];i!==void 0&&i===t||this.engine.setInt(this._uniforms[e],t)&&(this._valueCache[e]=t)}setInt2(e,t,i){this._cacheFloat2(e,t,i)&&(this.engine.setInt2(this._uniforms[e],t,i)||(this._valueCache[e]=null))}setInt3(e,t,i,s){this._cacheFloat3(e,t,i,s)&&(this.engine.setInt3(this._uniforms[e],t,i,s)||(this._valueCache[e]=null))}setInt4(e,t,i,s,r){this._cacheFloat4(e,t,i,s,r)&&(this.engine.setInt4(this._uniforms[e],t,i,s,r)||(this._valueCache[e]=null))}setIntArray(e,t){this._valueCache[e]=null,this.engine.setIntArray(this._uniforms[e],t)}setIntArray2(e,t){this._valueCache[e]=null,this.engine.setIntArray2(this._uniforms[e],t)}setIntArray3(e,t){this._valueCache[e]=null,this.engine.setIntArray3(this._uniforms[e],t)}setIntArray4(e,t){this._valueCache[e]=null,this.engine.setIntArray4(this._uniforms[e],t)}setUInt(e,t){const i=this._valueCache[e];i!==void 0&&i===t||this.engine.setUInt(this._uniforms[e],t)&&(this._valueCache[e]=t)}setUInt2(e,t,i){this._cacheFloat2(e,t,i)&&(this.engine.setUInt2(this._uniforms[e],t,i)||(this._valueCache[e]=null))}setUInt3(e,t,i,s){this._cacheFloat3(e,t,i,s)&&(this.engine.setUInt3(this._uniforms[e],t,i,s)||(this._valueCache[e]=null))}setUInt4(e,t,i,s,r){this._cacheFloat4(e,t,i,s,r)&&(this.engine.setUInt4(this._uniforms[e],t,i,s,r)||(this._valueCache[e]=null))}setUIntArray(e,t){this._valueCache[e]=null,this.engine.setUIntArray(this._uniforms[e],t)}setUIntArray2(e,t){this._valueCache[e]=null,this.engine.setUIntArray2(this._uniforms[e],t)}setUIntArray3(e,t){this._valueCache[e]=null,this.engine.setUIntArray3(this._uniforms[e],t)}setUIntArray4(e,t){this._valueCache[e]=null,this.engine.setUIntArray4(this._uniforms[e],t)}setArray(e,t){this._valueCache[e]=null,this.engine.setArray(this._uniforms[e],t)}setArray2(e,t){this._valueCache[e]=null,this.engine.setArray2(this._uniforms[e],t)}setArray3(e,t){this._valueCache[e]=null,this.engine.setArray3(this._uniforms[e],t)}setArray4(e,t){this._valueCache[e]=null,this.engine.setArray4(this._uniforms[e],t)}setMatrices(e,t){t&&(this._valueCache[e]=null,this.engine.setMatrices(this._uniforms[e],t))}setMatrix(e,t){this._cacheMatrix(e,t)&&(this.engine.setMatrices(this._uniforms[e],t.asArray())||(this._valueCache[e]=null))}setMatrix3x3(e,t){this._valueCache[e]=null,this.engine.setMatrix3x3(this._uniforms[e],t)}setMatrix2x2(e,t){this._valueCache[e]=null,this.engine.setMatrix2x2(this._uniforms[e],t)}setFloat(e,t){const i=this._valueCache[e];i!==void 0&&i===t||this.engine.setFloat(this._uniforms[e],t)&&(this._valueCache[e]=t)}setVector2(e,t){this._cacheFloat2(e,t.x,t.y)&&(this.engine.setFloat2(this._uniforms[e],t.x,t.y)||(this._valueCache[e]=null))}setFloat2(e,t,i){this._cacheFloat2(e,t,i)&&(this.engine.setFloat2(this._uniforms[e],t,i)||(this._valueCache[e]=null))}setVector3(e,t){this._cacheFloat3(e,t.x,t.y,t.z)&&(this.engine.setFloat3(this._uniforms[e],t.x,t.y,t.z)||(this._valueCache[e]=null))}setFloat3(e,t,i,s){this._cacheFloat3(e,t,i,s)&&(this.engine.setFloat3(this._uniforms[e],t,i,s)||(this._valueCache[e]=null))}setVector4(e,t){this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&(this.engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w)||(this._valueCache[e]=null))}setQuaternion(e,t){this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&(this.engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w)||(this._valueCache[e]=null))}setFloat4(e,t,i,s,r){this._cacheFloat4(e,t,i,s,r)&&(this.engine.setFloat4(this._uniforms[e],t,i,s,r)||(this._valueCache[e]=null))}setColor3(e,t){this._cacheFloat3(e,t.r,t.g,t.b)&&(this.engine.setFloat3(this._uniforms[e],t.r,t.g,t.b)||(this._valueCache[e]=null))}setColor4(e,t,i){this._cacheFloat4(e,t.r,t.g,t.b,i)&&(this.engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,i)||(this._valueCache[e]=null))}setDirectColor4(e,t){this._cacheFloat4(e,t.r,t.g,t.b,t.a)&&(this.engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,t.a)||(this._valueCache[e]=null))}_getVertexShaderCode(){return this.vertexShader?this.engine._getShaderSource(this.vertexShader):null}_getFragmentShaderCode(){return this.fragmentShader?this.engine._getShaderSource(this.fragmentShader):null}}const gn=new WeakMap,cc={_webGLVersion:2,cachedPipelines:{}};function Pt(a){let e=gn.get(a);if(!e){if(!a)return cc;e={_webGLVersion:a.TEXTURE_BINDING_3D?2:1,_context:a,parallelShaderCompile:a.getExtension("KHR_parallel_shader_compile")||void 0,cachedPipelines:{}},gn.set(a,e)}return e}function $r(a){gn.delete(a)}function Oo(a,e,t,i,s,r){const n=Pt(i);r||(r=n._createShaderProgramInjection??In);const o=pn(e,"vertex",i,n._contextWasLost),h=pn(t,"fragment",i,n._contextWasLost);return r(a,o,h,i,s,n.validateShaderPrograms)}function Fo(a,e,t,i,s,r=null,n){const o=Pt(s);n||(n=o._createShaderProgramInjection??In);const h=o._webGLVersion>1?`#version 300 es +#define WEBGL2 +`:"",l=oa(e,"vertex",i,h,s,o._contextWasLost),c=oa(t,"fragment",i,h,s,o._contextWasLost);return n(a,l,c,s,r,o.validateShaderPrograms)}function uc(a,e){const t=new lc,i=Pt(a);return i.parallelShaderCompile&&!i.disableParallelShaderCompile&&(t.isParallelCompiled=!0),t.context=i._context,t}function In(a,e,t,i,s=null,r){const n=i.createProgram();if(a.program=n,!n)throw new Error("Unable to create program");return i.attachShader(n,e),i.attachShader(n,t),i.linkProgram(n),a.context=i,a.vertexShader=e,a.fragmentShader=t,a.isParallelCompiled||Pn(a,i,r),n}function dc(a,e,t){const i=a;if(i._isDisposed)return!1;const s=Pt(e);return s&&s.parallelShaderCompile&&s.parallelShaderCompile.COMPLETION_STATUS_KHR&&i.program&&e.getProgramParameter(i.program,s.parallelShaderCompile.COMPLETION_STATUS_KHR)?(Pn(i,e,t),!0):!1}function Pn(a,e,t){const i=a.context,s=a.vertexShader,r=a.fragmentShader,n=a.program;if(!i.getProgramParameter(n,i.LINK_STATUS)){if(!e.getShaderParameter(s,e.COMPILE_STATUS)){const l=e.getShaderInfoLog(s);if(l)throw a.vertexCompilationError=l,new Error("VERTEX SHADER "+l)}if(!e.getShaderParameter(r,e.COMPILE_STATUS)){const l=e.getShaderInfoLog(r);if(l)throw a.fragmentCompilationError=l,new Error("FRAGMENT SHADER "+l)}const h=i.getProgramInfoLog(n);if(h)throw a.programLinkError=h,new Error(h)}if(t&&(i.validateProgram(n),!i.getProgramParameter(n,i.VALIDATE_STATUS))){const l=i.getProgramInfoLog(n);if(l)throw a.programValidationError=l,new Error(l)}i.deleteShader(s),i.deleteShader(r),a.vertexShader=void 0,a.fragmentShader=void 0,a.onCompiled&&(a.onCompiled(),a.onCompiled=void 0)}function fc(a,e,t,i,s,r,n,o,h,l="",c,u,f){const d=Pt(a.context);u||(u=d.createRawShaderProgramInjection??Oo),f||(f=d.createShaderProgramInjection??Fo);const g=a;i?g.program=u(g,e,t,g.context,h):g.program=f(g,e,t,o,g.context,h),g.program.__SPECTOR_rebuildProgram=n,c()}function oa(a,e,t,i,s,r){return pn(Io(a,t,i),e,s,r)}function pn(a,e,t,i){const s=t.createShader(e==="vertex"?t.VERTEX_SHADER:t.FRAGMENT_SHADER);if(!s){let r=t.NO_ERROR,n=t.NO_ERROR;for(;(n=t.getError())!==t.NO_ERROR;)r=n;throw new Error(`Something went wrong while creating a gl ${e} shader object. gl error=${r}, gl isContextLost=${t.isContextLost()}, _contextWasLost=${i}`)}return t.shaderSource(s,a),t.compileShader(s),s}function _c(a,e){e.useProgram(a)}function gc(a,e){const t=a;if(!t.isParallelCompiled){e(a);return}const i=t.onCompiled;t.onCompiled=()=>{i?.(),e(a)}}function pc(a,e){return Pt(e).cachedPipelines[a]}function wo(a){const e=a._name,t=a.context;if(e&&t){const i=Pt(t);i.cachedPipelines[e]?.dispose(),delete i.cachedPipelines[e]}}function mc(a,e,t,i,s,r,n){let o,h;const l=_t()?r?.getHostDocument():null;typeof e=="string"?o=e:e.vertexSource?o="source:"+e.vertexSource:e.vertexElement?o=l?.getElementById(e.vertexElement)||e.vertexElement:o=e.vertex||e,typeof e=="string"?h=e:e.fragmentSource?h="source:"+e.fragmentSource:e.fragmentElement?h=l?.getElementById(e.fragmentElement)||e.fragmentElement:h=e.fragment||e;const c=[void 0,void 0],u=()=>{if(c[0]&&c[1]){a.isFragment=!0;const[f,d]=c;na(d,a,(g,p)=>{n&&(n._fragmentSourceCodeBeforeMigration=p),t&&(g=t("fragment",g));const m=sc(f,g,a);a=null;const A=Tc(m.vertexCode,m.fragmentCode,e,s);i?.(A.vertexSourceCode,A.fragmentSourceCode)},r)}};ha(o,"Vertex","",f=>{ic(a),na(f,a,(d,g)=>{n&&(n._rawVertexSourceCode=f,n._vertexSourceCodeBeforeMigration=g),t&&(d=t("vertex",d)),c[0]=d,u()},r)},s),ha(h,"Fragment","Pixel",f=>{n&&(n._rawFragmentSourceCode=f),c[1]=f,u()},s)}function ha(a,e,t,i,s,r){if(typeof HTMLElement<"u"&&a instanceof HTMLElement){const h=xo(a);i(h);return}if(a.substring(0,7)==="source:"){i(a.substring(7));return}if(a.substring(0,7)==="base64:"){const h=window.atob(a.substring(7));i(h);return}const n=We.GetShadersStore(s);if(n[a+e+"Shader"]){i(n[a+e+"Shader"]);return}if(t&&n[a+t+"Shader"]){i(n[a+t+"Shader"]);return}let o;if(a[0]==="."||a[0]==="/"||a.indexOf("http")>-1?o=a:o=We.GetShadersRepository(s)+a,r=r||Po,!r)throw new Error("loadFileInjection is not defined");r(o+"."+e.toLowerCase()+".fx",i)}function Tc(a,e,t,i){if(t){const s=t.vertexElement||t.vertex||t.spectorName||t,r=t.fragmentElement||t.fragment||t.spectorName||t;return{vertexSourceCode:(i===1?"//":"")+"#define SHADER_NAME vertex:"+s+` +`+a,fragmentSourceCode:(i===1?"//":"")+"#define SHADER_NAME fragment:"+r+` +`+e}}else return{vertexSourceCode:a,fragmentSourceCode:e}}const bc=(a,e,t,i)=>{try{const s=a.context?Pt(a.context):null;s&&(s.disableParallelShaderCompile=a.disableParallelCompilation);const r=a.existingPipelineContext||e(a.shaderProcessingContext);return r._name=a.name,a.name&&s&&(s.cachedPipelines[a.name]=r),t(r,a.vertex,a.fragment,!!a.createAsRaw,"","",a.rebuildRebind,a.defines,a.transformFeedbackVaryings,"",()=>{i(r,()=>{a.onRenderingStateCompiled?.(r)})}),r}catch(s){throw w.Error("Error compiling effect"),s}};class ze{static get ShadersRepository(){return We.ShadersRepository}static set ShadersRepository(e){We.ShadersRepository=e}get isDisposed(){return this._isDisposed}get onBindObservable(){return this._onBindObservable||(this._onBindObservable=new O),this._onBindObservable}get shaderLanguage(){return this._shaderLanguage}constructor(e,t,i,s=null,r,n=null,o=null,h=null,l=null,c,u="",f=0,d){this.defines="",this.onCompiled=null,this.onError=null,this.onBind=null,this.uniqueId=0,this.onCompileObservable=new O,this.onErrorObservable=new O,this._onBindObservable=null,this._isDisposed=!1,this._refCount=1,this._bonesComputationForcedToCPU=!1,this._uniformBuffersNames={},this._multiTarget=!1,this._samplers={},this._isReady=!1,this._compilationError="",this._allFallbacksProcessed=!1,this._uniforms={},this._key="",this._fallbacks=null,this._vertexSourceCodeOverride="",this._fragmentSourceCodeOverride="",this._transformFeedbackVaryings=null,this._disableParallelShaderCompilation=!1,this._pipelineContext=null,this._vertexSourceCode="",this._fragmentSourceCode="",this._vertexSourceCodeBeforeMigration="",this._fragmentSourceCodeBeforeMigration="",this._rawVertexSourceCode="",this._rawFragmentSourceCode="",this._processCodeAfterIncludes=void 0,this._processFinalCode=null,this._onReleaseEffectsObserver=null,this.name=e,this._key=u;const g=this._key.replace(/\r/g,"").replace(/\n/g,"|");let p;if(t.attributes){const m=t;if(this._engine=i,this._attributesNames=m.attributes,this._uniformsNames=m.uniformsNames.concat(m.samplers),this._samplerList=m.samplers.slice(),this.defines=m.defines,this.onError=m.onError,this.onCompiled=m.onCompiled,this._fallbacks=m.fallbacks,this._indexParameters=m.indexParameters,this._transformFeedbackVaryings=m.transformFeedbackVaryings||null,this._multiTarget=!!m.multiTarget,this._shaderLanguage=m.shaderLanguage??0,this._disableParallelShaderCompilation=!!m.disableParallelShaderCompilation,m.uniformBuffersNames){this._uniformBuffersNamesList=m.uniformBuffersNames.slice();for(let A=0;A{this._onReleaseEffectsObserver=null,!this.isDisposed&&this.dispose(!0)})}async _processShaderCodeAsync(e=null,t=!1,i=null,s){s&&await s(),this._processingContext=i||this._engine._getShaderProcessingContext(this._shaderLanguage,!1);const r={defines:this.defines.split(` +`),indexParameters:this._indexParameters,isFragment:!1,shouldUseHighPrecisionShader:this._engine._shouldUseHighPrecisionShader,processor:e??this._engine._getShaderProcessor(this._shaderLanguage),supportsUniformBuffers:this._engine.supportsUniformBuffers,shadersRepository:We.GetShadersRepository(this._shaderLanguage),includesShadersStore:We.GetIncludesShadersStore(this._shaderLanguage),version:(this._engine.version*100).toString(),platformName:this._engine.shaderPlatformName,processingContext:this._processingContext,isNDCHalfZRange:this._engine.isNDCHalfZRange,useReverseDepthBuffer:this._engine.useReverseDepthBuffer,processCodeAfterIncludes:this._processCodeAfterIncludes};mc(r,this.name,this._processFinalCode,(n,o)=>{this._vertexSourceCode=n,this._fragmentSourceCode=o,this._prepareEffect(t)},this._shaderLanguage,this._engine,this)}get key(){return this._key}isReady(){try{return this._isReadyInternal()}catch{return!1}}_isReadyInternal(){return this._engine.isDisposed||this._isReady?!0:this._pipelineContext?this._pipelineContext.isReady:!1}getEngine(){return this._engine}getPipelineContext(){return this._pipelineContext}getAttributesNames(){return this._attributesNames}getAttributeLocation(e){return this._attributes[e]}getAttributeLocationByName(e){return this._attributeLocationByName[e]}getAttributesCount(){return this._attributes.length}getUniformIndex(e){return this._uniformsNames.indexOf(e)}getUniform(e){return this._uniforms[e]}getSamplers(){return this._samplerList}getUniformNames(){return this._uniformsNames}getUniformBuffersNames(){return this._uniformBuffersNamesList}getIndexParameters(){return this._indexParameters}getCompilationError(){return this._compilationError}allFallbacksProcessed(){return this._allFallbacksProcessed}async whenCompiledAsync(){return await new Promise(e=>{this.executeWhenCompiled(e)})}executeWhenCompiled(e){if(this.isReady()){e(this);return}this.onCompileObservable.add(t=>{e(t)}),(!this._pipelineContext||this._pipelineContext.isAsync)&&this._checkIsReady(null)}_checkIsReady(e){tr(()=>this._isReadyInternal()||this._isDisposed,()=>{},t=>{this._processCompilationErrors(t,e)},16,12e4,!0,` - Effect: ${typeof this.name=="string"?this.name:this.key}`)}get vertexSourceCode(){return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._vertexSourceCodeOverride:this._pipelineContext?._getVertexShaderCode()??this._vertexSourceCode}get fragmentSourceCode(){return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._fragmentSourceCodeOverride:this._pipelineContext?._getFragmentShaderCode()??this._fragmentSourceCode}get vertexSourceCodeBeforeMigration(){return this._vertexSourceCodeBeforeMigration}get fragmentSourceCodeBeforeMigration(){return this._fragmentSourceCodeBeforeMigration}get rawVertexSourceCode(){return this._rawVertexSourceCode}get rawFragmentSourceCode(){return this._rawFragmentSourceCode}getPipelineGenerationOptions(){return{platformName:this._engine.shaderPlatformName,shaderLanguage:this._shaderLanguage,shaderNameOrContent:this.name,key:this._key,defines:this.defines.split(` +`),addGlobalDefines:!1,extendedProcessingOptions:{indexParameters:this._indexParameters,isNDCHalfZRange:this._engine.isNDCHalfZRange,useReverseDepthBuffer:this._engine.useReverseDepthBuffer,supportsUniformBuffers:this._engine.supportsUniformBuffers},extendedCreatePipelineOptions:{transformFeedbackVaryings:this._transformFeedbackVaryings,createAsRaw:!!(this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride)}}}_rebuildProgram(e,t,i,s){this._isReady=!1,this._vertexSourceCodeOverride=e,this._fragmentSourceCodeOverride=t,this.onError=(r,n)=>{s&&s(n)},this.onCompiled=()=>{const r=this.getEngine().scenes;if(r)for(let n=0;nthis._rebuildProgram(h,l,c,u),defines:s,transformFeedbackVaryings:this._transformFeedbackVaryings,name:this._key.replace(/\r/g,"").replace(/\n/g,"|"),createAsRaw:i,disableParallelCompilation:this._disableParallelShaderCompilation,shaderProcessingContext:this._processingContext,onRenderingStateCompiled:h=>{t&&!e&&this._engine._deletePipelineContext(t),h&&this._onRenderingStateCompiled(h)}},this._engine.createPipelineContext.bind(this._engine),this._engine._preparePipelineContextAsync.bind(this._engine),this._engine._executeWhenRenderingStateIsCompiled.bind(this._engine)),this._pipelineContext.isAsync&&this._checkIsReady(t)}catch(i){this._processCompilationErrors(i,t)}}_getShaderCodeAndErrorLine(e,t,i){const s=i?/FRAGMENT SHADER ERROR: 0:(\d+?):/:/VERTEX SHADER ERROR: 0:(\d+?):/;let r=null;if(t&&e){const n=t.match(s);if(n&&n.length===2){const o=parseInt(n[1]),h=e.split(` +`,-1);h.length>=o&&(r=`Offending line [${o}] in ${i?"fragment":"vertex"} code: ${h[o-1]}`)}}return[e,r]}_processCompilationErrors(e,t=null){this._compilationError=e.message;const i=this._attributesNames,s=this._fallbacks;if(w.Error("Unable to compile effect:"),w.Error(`Uniforms: ${this._uniformsNames.join(" ")}`),w.Error(`Attributes: ${i.join(" ")}`),w.Error(`Defines: +`+this.defines),ze.LogShaderCodeOnCompilationError){let n=null,o=null,h=null;this._pipelineContext?._getVertexShaderCode()&&([h,n]=this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(),this._compilationError,!1),h&&(w.Error("Vertex code:"),w.Error(h))),this._pipelineContext?._getFragmentShaderCode()&&([h,o]=this._getShaderCodeAndErrorLine(this._pipelineContext?._getFragmentShaderCode(),this._compilationError,!0),h&&(w.Error("Fragment code:"),w.Error(h))),n&&w.Error(n),o&&w.Error(o)}w.Error("Error: "+this._compilationError);const r=()=>{this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this),this._engine.onEffectErrorObservable.notifyObservers({effect:this,errors:this._compilationError})};t&&(this._pipelineContext=t,this._isReady=!0,r()),s?(this._pipelineContext=null,s.hasMoreFallbacks?(this._allFallbacksProcessed=!1,w.Error("Trying next fallback."),this.defines=s.reduce(this.defines,this),this._prepareEffect()):(this._allFallbacksProcessed=!0,r(),this.onErrorObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh())):(this._allFallbacksProcessed=!0,t||r())}get isSupported(){return this._compilationError===""}_bindTexture(e,t){this._engine._bindTexture(this._samplers[e],t,e)}setTexture(e,t){this._engine.setTexture(this._samplers[e],this._uniforms[e],t,e)}setTextureArray(e,t){const i=e+"Ex";if(this._samplerList.indexOf(i+"0")===-1){const s=this._samplerList.indexOf(e);for(let n=1;n0||this._isDisposed||(this._onReleaseEffectsObserver&&(this._engine.onReleaseEffectsObservable.remove(this._onReleaseEffectsObserver),this._onReleaseEffectsObserver=null),this._pipelineContext&&wo(this._pipelineContext),this._engine._releaseEffect(this),this.clearCodeCache(),this._isDisposed=!0)}static RegisterShader(e,t,i,s=0){t&&(We.GetShadersStore(s)[`${e}PixelShader`]=t),i&&(We.GetShadersStore(s)[`${e}VertexShader`]=i)}static ResetCache(){ze._BaseCache={}}}ze.LogShaderCodeOnCompilationError=!0;ze.PersistentMode=!1;ze.AutomaticallyClearCodeCache=!1;ze._UniqueIdSeed=0;ze._BaseCache={};ze.ShadersStore=We.ShadersStore;ze.IncludesShadersStore=We.IncludesShadersStore;class Ec{constructor(e=!0){this._isDepthTestDirty=!1,this._isDepthMaskDirty=!1,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1,e&&this.reset()}get isDirty(){return this._isDepthFuncDirty||this._isDepthTestDirty||this._isDepthMaskDirty||this._isCullFaceDirty||this._isCullDirty||this._isZOffsetDirty||this._isFrontFaceDirty}get zOffset(){return this._zOffset}set zOffset(e){this._zOffset!==e&&(this._zOffset=e,this._isZOffsetDirty=!0)}get zOffsetUnits(){return this._zOffsetUnits}set zOffsetUnits(e){this._zOffsetUnits!==e&&(this._zOffsetUnits=e,this._isZOffsetDirty=!0)}get cullFace(){return this._cullFace}set cullFace(e){this._cullFace!==e&&(this._cullFace=e,this._isCullFaceDirty=!0)}get cull(){return this._cull}set cull(e){this._cull!==e&&(this._cull=e,this._isCullDirty=!0)}get depthFunc(){return this._depthFunc}set depthFunc(e){this._depthFunc!==e&&(this._depthFunc=e,this._isDepthFuncDirty=!0)}get depthMask(){return this._depthMask}set depthMask(e){this._depthMask!==e&&(this._depthMask=e,this._isDepthMaskDirty=!0)}get depthTest(){return this._depthTest}set depthTest(e){this._depthTest!==e&&(this._depthTest=e,this._isDepthTestDirty=!0)}get frontFace(){return this._frontFace}set frontFace(e){this._frontFace!==e&&(this._frontFace=e,this._isFrontFaceDirty=!0)}reset(){this._depthMask=!0,this._depthTest=!0,this._depthFunc=null,this._cullFace=null,this._cull=null,this._zOffset=0,this._zOffsetUnits=0,this._frontFace=null,this._isDepthTestDirty=!0,this._isDepthMaskDirty=!0,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!0,this._isFrontFaceDirty=!1}apply(e){this.isDirty&&(this._isCullDirty&&(this.cull?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this._isCullDirty=!1),this._isCullFaceDirty&&(e.cullFace(this.cullFace),this._isCullFaceDirty=!1),this._isDepthMaskDirty&&(e.depthMask(this.depthMask),this._isDepthMaskDirty=!1),this._isDepthTestDirty&&(this.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this._isDepthTestDirty=!1),this._isDepthFuncDirty&&(e.depthFunc(this.depthFunc),this._isDepthFuncDirty=!1),this._isZOffsetDirty&&(this.zOffset||this.zOffsetUnits?(e.enable(e.POLYGON_OFFSET_FILL),e.polygonOffset(this.zOffset,this.zOffsetUnits)):e.disable(e.POLYGON_OFFSET_FILL),this._isZOffsetDirty=!1),this._isFrontFaceDirty&&(e.frontFace(this.frontFace),this._isFrontFaceDirty=!1))}}class Ac{get isDirty(){return this._isStencilTestDirty||this._isStencilMaskDirty||this._isStencilFuncDirty||this._isStencilOpDirty}get func(){return this._func}set func(e){this._func!==e&&(this._func=e,this._isStencilFuncDirty=!0)}get backFunc(){return this._func}set backFunc(e){this._backFunc!==e&&(this._backFunc=e,this._isStencilFuncDirty=!0)}get funcRef(){return this._funcRef}set funcRef(e){this._funcRef!==e&&(this._funcRef=e,this._isStencilFuncDirty=!0)}get funcMask(){return this._funcMask}set funcMask(e){this._funcMask!==e&&(this._funcMask=e,this._isStencilFuncDirty=!0)}get opStencilFail(){return this._opStencilFail}set opStencilFail(e){this._opStencilFail!==e&&(this._opStencilFail=e,this._isStencilOpDirty=!0)}get opDepthFail(){return this._opDepthFail}set opDepthFail(e){this._opDepthFail!==e&&(this._opDepthFail=e,this._isStencilOpDirty=!0)}get opStencilDepthPass(){return this._opStencilDepthPass}set opStencilDepthPass(e){this._opStencilDepthPass!==e&&(this._opStencilDepthPass=e,this._isStencilOpDirty=!0)}get backOpStencilFail(){return this._backOpStencilFail}set backOpStencilFail(e){this._backOpStencilFail!==e&&(this._backOpStencilFail=e,this._isStencilOpDirty=!0)}get backOpDepthFail(){return this._backOpDepthFail}set backOpDepthFail(e){this._backOpDepthFail!==e&&(this._backOpDepthFail=e,this._isStencilOpDirty=!0)}get backOpStencilDepthPass(){return this._backOpStencilDepthPass}set backOpStencilDepthPass(e){this._backOpStencilDepthPass!==e&&(this._backOpStencilDepthPass=e,this._isStencilOpDirty=!0)}get mask(){return this._mask}set mask(e){this._mask!==e&&(this._mask=e,this._isStencilMaskDirty=!0)}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this._isStencilTestDirty=!0)}constructor(e=!0){this._isStencilTestDirty=!1,this._isStencilMaskDirty=!1,this._isStencilFuncDirty=!1,this._isStencilOpDirty=!1,this.useStencilGlobalOnly=!1,e&&this.reset()}reset(){this.stencilMaterial=void 0,this.stencilGlobal?.reset(),this._isStencilTestDirty=!0,this._isStencilMaskDirty=!0,this._isStencilFuncDirty=!0,this._isStencilOpDirty=!0}apply(e){if(!e)return;const t=!this.useStencilGlobalOnly&&!!this.stencilMaterial?.enabled;this.enabled=t?this.stencilMaterial.enabled:this.stencilGlobal.enabled,this.func=t?this.stencilMaterial.func:this.stencilGlobal.func,this.backFunc=t?this.stencilMaterial.backFunc:this.stencilGlobal.backFunc,this.funcRef=t?this.stencilMaterial.funcRef:this.stencilGlobal.funcRef,this.funcMask=t?this.stencilMaterial.funcMask:this.stencilGlobal.funcMask,this.opStencilFail=t?this.stencilMaterial.opStencilFail:this.stencilGlobal.opStencilFail,this.opDepthFail=t?this.stencilMaterial.opDepthFail:this.stencilGlobal.opDepthFail,this.opStencilDepthPass=t?this.stencilMaterial.opStencilDepthPass:this.stencilGlobal.opStencilDepthPass,this.backOpStencilFail=t?this.stencilMaterial.backOpStencilFail:this.stencilGlobal.backOpStencilFail,this.backOpDepthFail=t?this.stencilMaterial.backOpDepthFail:this.stencilGlobal.backOpDepthFail,this.backOpStencilDepthPass=t?this.stencilMaterial.backOpStencilDepthPass:this.stencilGlobal.backOpStencilDepthPass,this.mask=t?this.stencilMaterial.mask:this.stencilGlobal.mask,this.isDirty&&(this._isStencilTestDirty&&(this.enabled?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this._isStencilTestDirty=!1),this._isStencilMaskDirty&&(e.stencilMask(this.mask),this._isStencilMaskDirty=!1),this._isStencilFuncDirty&&(e.stencilFuncSeparate(e.FRONT,this.func,this.funcRef,this.funcMask),e.stencilFuncSeparate(e.BACK,this.backFunc,this.funcRef,this.funcMask),this._isStencilFuncDirty=!1),this._isStencilOpDirty&&(e.stencilOpSeparate(e.FRONT,this.opStencilFail,this.opDepthFail,this.opStencilDepthPass),e.stencilOpSeparate(e.BACK,this.backOpStencilFail,this.backOpDepthFail,this.backOpStencilDepthPass),this._isStencilOpDirty=!1))}}class Dt{constructor(){this.reset()}reset(){this.enabled=!1,this.mask=255,this.funcRef=1,this.funcMask=255,this.func=Dt.ALWAYS,this.opStencilFail=Dt.KEEP,this.opDepthFail=Dt.KEEP,this.opStencilDepthPass=Dt.REPLACE,this.backFunc=Dt.ALWAYS,this.backOpStencilFail=Dt.KEEP,this.backOpDepthFail=Dt.KEEP,this.backOpStencilDepthPass=Dt.REPLACE}get stencilFunc(){return this.func}set stencilFunc(e){this.func=e}get stencilBackFunc(){return this.backFunc}set stencilBackFunc(e){this.backFunc=e}get stencilFuncRef(){return this.funcRef}set stencilFuncRef(e){this.funcRef=e}get stencilFuncMask(){return this.funcMask}set stencilFuncMask(e){this.funcMask=e}get stencilOpStencilFail(){return this.opStencilFail}set stencilOpStencilFail(e){this.opStencilFail=e}get stencilOpDepthFail(){return this.opDepthFail}set stencilOpDepthFail(e){this.opDepthFail=e}get stencilOpStencilDepthPass(){return this.opStencilDepthPass}set stencilOpStencilDepthPass(e){this.opStencilDepthPass=e}get stencilBackOpStencilFail(){return this.backOpStencilFail}set stencilBackOpStencilFail(e){this.backOpStencilFail=e}get stencilBackOpDepthFail(){return this.backOpDepthFail}set stencilBackOpDepthFail(e){this.backOpDepthFail=e}get stencilBackOpStencilDepthPass(){return this.backOpStencilDepthPass}set stencilBackOpStencilDepthPass(e){this.backOpStencilDepthPass=e}get stencilMask(){return this.mask}set stencilMask(e){this.mask=e}get stencilTest(){return this.enabled}set stencilTest(e){this.enabled=e}}Dt.ALWAYS=519;Dt.KEEP=7680;Dt.REPLACE=7681;class Lo{constructor(e){this._supportBlendParametersPerTarget=e,this._blendFunctionParameters=new Array(32),this._blendEquationParameters=new Array(16),this._blendConstants=new Array(4),this._isBlendConstantsDirty=!1,this._alphaBlend=Array(8).fill(!1),this._numTargetEnabled=0,this._isAlphaBlendDirty=!1,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this.reset()}get isDirty(){return this._isAlphaBlendDirty||this._isBlendFunctionParametersDirty||this._isBlendEquationParametersDirty}get alphaBlend(){return this._numTargetEnabled>0}set alphaBlend(e){this.setAlphaBlend(e)}setAlphaBlend(e,t=0){this._alphaBlend[t]!==e&&(e?this._numTargetEnabled++:this._numTargetEnabled--,this._alphaBlend[t]=e,this._isAlphaBlendDirty=!0)}setAlphaBlendConstants(e,t,i,s){this._blendConstants[0]===e&&this._blendConstants[1]===t&&this._blendConstants[2]===i&&this._blendConstants[3]===s||(this._blendConstants[0]=e,this._blendConstants[1]=t,this._blendConstants[2]=i,this._blendConstants[3]=s,this._isBlendConstantsDirty=!0)}setAlphaBlendFunctionParameters(e,t,i,s,r=0){const n=r*4;this._blendFunctionParameters[n+0]===e&&this._blendFunctionParameters[n+1]===t&&this._blendFunctionParameters[n+2]===i&&this._blendFunctionParameters[n+3]===s||(this._blendFunctionParameters[n+0]=e,this._blendFunctionParameters[n+1]=t,this._blendFunctionParameters[n+2]=i,this._blendFunctionParameters[n+3]=s,this._isBlendFunctionParametersDirty=!0)}setAlphaEquationParameters(e,t,i=0){const s=i*2;this._blendEquationParameters[s+0]===e&&this._blendEquationParameters[s+1]===t||(this._blendEquationParameters[s+0]=e,this._blendEquationParameters[s+1]=t,this._isBlendEquationParametersDirty=!0)}reset(){this._alphaBlend.fill(!1),this._numTargetEnabled=0,this._blendFunctionParameters.fill(null),this._blendEquationParameters.fill(null),this._blendConstants[0]=null,this._blendConstants[1]=null,this._blendConstants[2]=null,this._blendConstants[3]=null,this._isAlphaBlendDirty=!0,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1}apply(e,t=1){if(!this.isDirty)return;if(this._isBlendConstantsDirty&&(e.blendColor(this._blendConstants[0],this._blendConstants[1],this._blendConstants[2],this._blendConstants[3]),this._isBlendConstantsDirty=!1),t===1||!this._supportBlendParametersPerTarget){this._isAlphaBlendDirty&&(this._alphaBlend[0]?e.enable(e.BLEND):e.disable(e.BLEND),this._isAlphaBlendDirty=!1),this._isBlendFunctionParametersDirty&&(e.blendFuncSeparate(this._blendFunctionParameters[0],this._blendFunctionParameters[1],this._blendFunctionParameters[2],this._blendFunctionParameters[3]),this._isBlendFunctionParametersDirty=!1),this._isBlendEquationParametersDirty&&(e.blendEquationSeparate(this._blendEquationParameters[0],this._blendEquationParameters[1]),this._isBlendEquationParametersDirty=!1);return}const i=e;if(this._isAlphaBlendDirty){for(let s=0;s{s._swapAndDie(this,!1),this.isReady=t.isReady};t.isAsync?t.proxy.then(i):i(t.proxy);return}let e;switch(this.source){case 2:break;case 1:e=this._engine.createTexture(this._originalUrl??this.url,!this.generateMipMaps,this.invertY,null,this.samplingMode,t=>{t._swapAndDie(this,!1),this.isReady=!0},null,this._buffer,void 0,this.format,this._extension,void 0,void 0,void 0,this._useSRGBBuffer);return;case 3:e=this._engine.createRawTexture(this._bufferView,this.baseWidth,this.baseHeight,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type,this._creationFlags,this._useSRGBBuffer),e._swapAndDie(this,!1),this.isReady=!0;break;case 10:e=this._engine.createRawTexture3D(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type),e._swapAndDie(this,!1),this.isReady=!0;break;case 11:e=this._engine.createRawTexture2DArray(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type),e._swapAndDie(this,!1),this.isReady=!0;break;case 4:e=this._engine.createDynamicTexture(this.baseWidth,this.baseHeight,this.generateMipMaps,this.samplingMode),e._swapAndDie(this,!1),this._dynamicTextureSource&&this._engine.updateDynamicTexture(this,this._dynamicTextureSource,this.invertY,this._premulAlpha,this.format,!0);break;case 7:e=this._engine.createCubeTexture(this.url,null,this._files,!this.generateMipMaps,()=>{e._swapAndDie(this,!1),this.isReady=!0},null,this.format,this._extension,!1,0,0,null,void 0,this._useSRGBBuffer,ArrayBuffer.isView(this._buffer)?this._buffer:null);return;case 8:e=this._engine.createRawCubeTexture(this._bufferViewArray,this.width,this._originalFormat??this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression),e._swapAndDie(this,!1),this.isReady=!0;break;case 13:return;case 9:e=this._engine.createPrefilteredCubeTexture(this.url,null,this._lodGenerationScale,this._lodGenerationOffset,t=>{t&&t._swapAndDie(this,!1),this.isReady=!0},null,this.format,this._extension),e._sphericalPolynomial=this._sphericalPolynomial;return}}_swapAndDie(e,t=!0){this._hardwareTexture?.setUsage(e._source,this.generateMipMaps,this.is2DArray,this.isCube,this.is3D,this.width,this.height,this.depth),e._hardwareTexture=this._hardwareTexture,t&&(e._isRGBD=this._isRGBD),this._lodTextureHigh&&(e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureHigh=this._lodTextureHigh),this._lodTextureMid&&(e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureMid=this._lodTextureMid),this._lodTextureLow&&(e._lodTextureLow&&e._lodTextureLow.dispose(),e._lodTextureLow=this._lodTextureLow),this._irradianceTexture&&(e._irradianceTexture&&e._irradianceTexture.dispose(),e._irradianceTexture=this._irradianceTexture);const i=this._engine.getLoadedTexturesCache();let s=i.indexOf(this);s!==-1&&i.splice(s,1),s=i.indexOf(e),s===-1&&i.push(e)}dispose(){this._references--,this._references===0&&(this.onLoadedObservable.clear(),this.onErrorObservable.clear(),this._engine._releaseTexture(this),this._hardwareTexture=null,this._dynamicTextureSource=null)}}Et._Counter=0;function Bo(a,e){if(_t()){const{requestAnimationFrame:t}=e||window;if(typeof t=="function")return t(a)}else if(typeof requestAnimationFrame=="function")return requestAnimationFrame(a);return setTimeout(a,16)}class H{get frameId(){return this._frameId}get isWebGPU(){return this._isWebGPU}_getShaderProcessor(e){return this._shaderProcessor}_resetAlphaMode(){this._alphaMode.fill(-1),this._alphaEquation.fill(-1)}get shaderPlatformName(){return this._shaderPlatformName}_clearEmptyResources(){this._emptyTexture=null,this._emptyCubeTexture=null,this._emptyTexture3D=null,this._emptyTexture2DArray=null}get useReverseDepthBuffer(){return this._useReverseDepthBuffer}set useReverseDepthBuffer(e){e!==this._useReverseDepthBuffer&&(this._useReverseDepthBuffer=e,e?this._depthCullingState.depthFunc=518:this._depthCullingState.depthFunc=515)}setColorWrite(e){e!==this._colorWrite&&(this._colorWriteChanged=!0,this._colorWrite=e)}getColorWrite(){return this._colorWrite}get depthCullingState(){return this._depthCullingState}get alphaState(){return this._alphaState}get stencilState(){return this._stencilState}get stencilStateComposer(){return this._stencilStateComposer}_getGlobalDefines(e){if(e){this.isNDCHalfZRange?e.IS_NDC_HALF_ZRANGE="":delete e.IS_NDC_HALF_ZRANGE,this.useReverseDepthBuffer?e.USE_REVERSE_DEPTHBUFFER="":delete e.USE_REVERSE_DEPTHBUFFER,this.useExactSrgbConversions?e.USE_EXACT_SRGB_CONVERSIONS="":delete e.USE_EXACT_SRGB_CONVERSIONS;return}else{let t="";return this.isNDCHalfZRange&&(t+="#define IS_NDC_HALF_ZRANGE"),this.useReverseDepthBuffer&&(t&&(t+=` +`),t+="#define USE_REVERSE_DEPTHBUFFER"),this.useExactSrgbConversions&&(t&&(t+=` +`),t+="#define USE_EXACT_SRGB_CONVERSIONS"),t}}_rebuildInternalTextures(){const e=this._internalTexturesCache.slice();for(const t of e)t._rebuild()}_rebuildRenderTargetWrappers(){const e=this._renderTargetWrapperCache.slice();for(const t of e)t._rebuild()}_rebuildEffects(){for(const e in this._compiledEffects){const t=this._compiledEffects[e];t._pipelineContext=null,t._prepareEffect()}ze.ResetCache()}_rebuildGraphicsResources(){this.wipeCaches(!0),this._rebuildEffects(),this._rebuildComputeEffects?.(),this._rebuildBuffers(),this._rebuildInternalTextures(),this._rebuildTextures(),this._rebuildRenderTargetWrappers(),this.wipeCaches(!0)}_flagContextRestored(){w.Warn(this.name+" context successfully restored."),this.onContextRestoredObservable.notifyObservers(this),this._contextWasLost=!1}_restoreEngineAfterContextLost(e){setTimeout(()=>{this._clearEmptyResources();const t=this._depthCullingState.depthTest,i=this._depthCullingState.depthFunc,s=this._depthCullingState.depthMask,r=this._stencilState.stencilTest;e(),this._rebuildGraphicsResources(),this._depthCullingState.depthTest=t,this._depthCullingState.depthFunc=i,this._depthCullingState.depthMask=s,this._stencilState.stencilTest=r,this._flagContextRestored()},0)}get isDisposed(){return this._isDisposed}get snapshotRendering(){return!1}set snapshotRendering(e){}get snapshotRenderingMode(){return 0}set snapshotRenderingMode(e){}getClassName(){return"AbstractEngine"}get emptyTexture(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,5,!1,!1,1)),this._emptyTexture}get emptyTexture3D(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,5,!1,!1,1)),this._emptyTexture3D}get emptyTexture2DArray(){return this._emptyTexture2DArray||(this._emptyTexture2DArray=this.createRawTexture2DArray(new Uint8Array(4),1,1,1,5,!1,!1,1)),this._emptyTexture2DArray}get emptyCubeTexture(){if(!this._emptyCubeTexture){const e=new Uint8Array(4),t=[e,e,e,e,e,e];this._emptyCubeTexture=this.createRawCubeTexture(t,1,5,0,!1,!1,1)}return this._emptyCubeTexture}get activeRenderLoops(){return this._activeRenderLoops}stopRenderLoop(e){if(!e){this._activeRenderLoops.length=0,this._cancelFrame();return}const t=this._activeRenderLoops.indexOf(e);t>=0&&(this._activeRenderLoops.splice(t,1),this._activeRenderLoops.length==0&&this._cancelFrame())}_cancelFrame(){if(this._frameHandler!==0){const e=this._frameHandler;if(this._frameHandler=0,_t()){const{cancelAnimationFrame:t}=this.getHostWindow()||window;if(typeof t=="function")return t(e)}else if(typeof cancelAnimationFrame=="function")return cancelAnimationFrame(e);return clearTimeout(e)}}beginFrame(){this.onBeginFrameObservable.notifyObservers(this)}endFrame(){this._frameId++,this.onEndFrameObservable.notifyObservers(this)}get maxFPS(){return this._maxFPS}set maxFPS(e){if(this._maxFPS=e,e!==void 0){if(e<=0){this._minFrameTime=Number.MAX_VALUE;return}this._minFrameTime=1e3/e}}_isOverFrameTime(e){if(!e||this._maxFPS===void 0)return!1;const t=e-this._lastFrameTime;return this._lastFrameTime=e,this._renderAccumulator+=t,this._renderAccumulatorthis._minFrameTime&&(this._renderAccumulator=this._minFrameTime),!1)}_processFrame(e){if(this._frameHandler=0,!this._contextWasLost&&!this._isOverFrameTime(e)){let t=!0;(this.isDisposed||!this.renderEvenInBackground&&this._windowIsBackground)&&(t=!1),t&&(this.beginFrame(),!this.skipFrameRender&&!this._renderViews()&&this._renderFrame(),this.endFrame())}}_renderLoop(e){this._processFrame(e),this._activeRenderLoops.length>0&&this._frameHandler===0&&(this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()))}_renderFrame(){for(let e=0;e-1?e.substring(x).toLowerCase():"");S.indexOf("?")>-1&&(S=S.split("?")[0]);const N=H.GetCompatibleTextureLoader(S,g);s&&s.addPendingData(M),M.url=e,M.generateMipMaps=!t,M.samplingMode=r,M.invertY=i,M._useSRGBBuffer=this._getUseSRGBBuffer(!!m,t),this._doNotHandleContextLost||(M._buffer=c);let D=null;n&&!u&&(D=M.onLoadedObservable.add(n)),u||this._internalTexturesCache.push(M);const Re=(pe,ce)=>{s&&s.removePendingData(M),e===C?(D&&M.onLoadedObservable.remove(D),Te.UseFallbackTexture&&e!==Te.FallbackTexture&&this._createTextureBase(Te.FallbackTexture,t,M.invertY,s,r,null,o,h,l,c,M),pe=(pe||"Unknown error")+(Te.UseFallbackTexture?" - Fallback texture was used":""),M.onErrorObservable.notifyObservers({message:pe,exception:ce}),o&&o(pe,ce)):(w.Warn(`Failed to load ${e}, falling back to ${C}`),this._createTextureBase(C,t,M.invertY,s,r,n,o,h,l,c,M,f,d,g,p,m))};if(N){const pe=async ce=>{(await N).loadData(ce,M,(Ye,Qe,ft,de,Fe,we)=>{we?Re("TextureLoader failed to load data"):h(M,S,s,{width:Ye,height:Qe},M.invertY,!ft,de,()=>(Fe(),!1),r)},p)};c?c instanceof ArrayBuffer?pe(new Uint8Array(c)):ArrayBuffer.isView(c)?pe(c):o&&o("Unable to load: only ArrayBuffer or ArrayBufferView is supported",null):this._loadFile(e,ce=>{pe(new Uint8Array(ce))},void 0,s?s.offlineProvider:void 0,!0,(ce,oe)=>{Re("Unable to load "+(ce&&ce.responseURL,oe))})}else{const pe=ce=>{E&&!this._doNotHandleContextLost&&(M._buffer=ce),h(M,S,s,ce,M.invertY,t,!1,l,r)};!A||I?c&&(typeof c.decoding=="string"||c.close)?pe(c):H._FileToolsLoadImage(e||"",pe,Re,s?s.offlineProvider:null,g,M.invertY&&this._features.needsInvertingBitmap?{imageOrientation:"flipY"}:void 0,this):typeof c=="string"||c instanceof ArrayBuffer||ArrayBuffer.isView(c)||c instanceof Blob?H._FileToolsLoadImage(c,pe,Re,s?s.offlineProvider:null,g,M.invertY&&this._features.needsInvertingBitmap?{imageOrientation:"flipY"}:void 0,this):c&&pe(c)}return M}_rebuildBuffers(){for(const e of this._uniformBuffers)e._rebuildAfterContextLost()}get _shouldUseHighPrecisionShader(){return!!(this._caps.highPrecisionShaderSupported&&this._highPrecisionShadersAllowed)}getHostDocument(){return this._renderingCanvas&&this._renderingCanvas.ownerDocument?this._renderingCanvas.ownerDocument:Fs()?document:null}getLoadedTexturesCache(){return this._internalTexturesCache}clearInternalTexturesCache(){this._internalTexturesCache.length=0}getCaps(){return this._caps}resetTextureCache(){for(const e in this._boundTexturesCache)Object.prototype.hasOwnProperty.call(this._boundTexturesCache,e)&&(this._boundTexturesCache[e]=null);this._currentTextureChannel=-1}get name(){return this._name}set name(e){this._name=e}static get NpmPackage(){return"babylonjs@8.46.2"}static get Version(){return"8.46.2"}getRenderingCanvas(){return this._renderingCanvas}getAudioContext(){return this._audioContext}getAudioDestination(){return this._audioDestination}setHardwareScalingLevel(e){this._hardwareScalingLevel=e,this.resize()}getHardwareScalingLevel(){return this._hardwareScalingLevel}get doNotHandleContextLost(){return this._doNotHandleContextLost}set doNotHandleContextLost(e){this._doNotHandleContextLost=e}get isStencilEnable(){return this._isStencilEnable}getCreationOptions(){return this._creationOptions}constructor(e,t,i){this._colorWrite=!0,this._colorWriteChanged=!0,this._depthCullingState=new Ec,this._stencilStateComposer=new Ac,this._stencilState=new Dt,this._alphaState=new Lo(!1),this._alphaMode=Array(8).fill(-1),this._alphaEquation=Array(8).fill(-1),this._activeRequests=[],this._badOS=!1,this._badDesktopOS=!1,this._compatibilityMode=!0,this._internalTexturesCache=new Array,this._currentRenderTarget=null,this._boundTexturesCache={},this._activeChannel=0,this._currentTextureChannel=-1,this._viewportCached={x:0,y:0,z:0,w:0},this._isWebGPU=!1,this._enableGPUDebugMarkers=!1,this.onCanvasBlurObservable=new O,this.onCanvasFocusObservable=new O,this.onNewSceneAddedObservable=new O,this.onResizeObservable=new O,this.onCanvasPointerOutObservable=new O,this.onEffectErrorObservable=new O,this.disablePerformanceMonitorInBackground=!1,this.disableVertexArrayObjects=!1,this._frameId=0,this.hostInformation={isMobile:!1},this.isFullscreen=!1,this.enableOfflineSupport=!1,this.disableManifestCheck=!1,this.disableContextMenu=!0,this.currentRenderPassId=0,this.isPointerLock=!1,this.postProcesses=[],this.canvasTabIndex=1,this._contextWasLost=!1,this._useReverseDepthBuffer=!1,this.isNDCHalfZRange=!1,this.hasOriginBottomLeft=!0,this._renderTargetWrapperCache=new Array,this._compiledEffects={},this._isDisposed=!1,this.scenes=[],this._virtualScenes=new Array,this.onBeforeTextureInitObservable=new O,this.renderEvenInBackground=!0,this.preventCacheWipeBetweenFrames=!1,this._frameHandler=0,this._activeRenderLoops=new Array,this._windowIsBackground=!1,this._boundRenderFunction=n=>this._renderLoop(n),this._lastFrameTime=0,this._renderAccumulator=0,this.skipFrameRender=!1,this.onBeforeShaderCompilationObservable=new O,this.onAfterShaderCompilationObservable=new O,this.onBeginFrameObservable=new O,this.onEndFrameObservable=new O,this._transformTextureUrl=null,this._uniformBuffers=new Array,this._storageBuffers=new Array,this._highPrecisionShadersAllowed=!0,this.onContextLostObservable=new O,this.onContextRestoredObservable=new O,this._name="",this.premultipliedAlpha=!0,this.adaptToDeviceRatio=!1,this._lastDevicePixelRatio=1,this._doNotHandleContextLost=!1,this.cullBackFaces=null,this._renderPassNames=["main"],this._fps=60,this._deltaTime=0,this._deterministicLockstep=!1,this._lockstepMaxSteps=4,this._timeStep=1/60,this.onDisposeObservable=new O,this.onReleaseEffectsObservable=new O,Te.Instances.push(this),this.startTime=vt.Now,this._stencilStateComposer.stencilGlobal=this._stencilState,st.SetMatrixPrecision(!!t.useLargeWorldRendering||!!t.useHighPrecisionMatrix),hs()&&navigator.userAgent&&(this._badOS=/iPad/i.test(navigator.userAgent)||/iPhone/i.test(navigator.userAgent),this._badDesktopOS=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),this.adaptToDeviceRatio=i??!1,t.antialias=e??t.antialias,t.deterministicLockstep=t.deterministicLockstep??!1,t.lockstepMaxSteps=t.lockstepMaxSteps??4,t.timeStep=t.timeStep??1/60,t.stencil=t.stencil??!0,this._audioContext=t.audioEngineOptions?.audioContext??null,this._audioDestination=t.audioEngineOptions?.audioDestination??null,this.premultipliedAlpha=t.premultipliedAlpha??!0,this._doNotHandleContextLost=!!t.doNotHandleContextLost,this._isStencilEnable=!!t.stencil,this.useExactSrgbConversions=t.useExactSrgbConversions??!1;const s=_t()&&window.devicePixelRatio||1,r=t.limitDeviceRatio||s;i=i||t.adaptToDeviceRatio||!1,this._hardwareScalingLevel=i?1/Math.min(r,s):1,this._lastDevicePixelRatio=s,this._creationOptions=t}resize(e=!1){let t,i;if(this.adaptToDeviceRatio){const s=_t()&&window.devicePixelRatio||1,r=this._lastDevicePixelRatio/s;this._lastDevicePixelRatio=s,this._hardwareScalingLevel*=r}if(_t()&&Fs())if(this._renderingCanvas){const s=this._renderingCanvas.getBoundingClientRect?.();t=this._renderingCanvas.clientWidth||s?.width||this._renderingCanvas.width*this._hardwareScalingLevel||100,i=this._renderingCanvas.clientHeight||s?.height||this._renderingCanvas.height*this._hardwareScalingLevel||100}else t=window.innerWidth,i=window.innerHeight;else t=this._renderingCanvas?this._renderingCanvas.width:100,i=this._renderingCanvas?this._renderingCanvas.height:100;this.setSize(t/this._hardwareScalingLevel,i/this._hardwareScalingLevel,e)}setSize(e,t,i=!1){if(!this._renderingCanvas||(e=e|0,t=t|0,!i&&this._renderingCanvas.width===e&&this._renderingCanvas.height===t))return!1;if(this._renderingCanvas.width=e,this._renderingCanvas.height=t,this.scenes){for(let s=0;s{const e=navigator.userAgent;this.hostInformation.isMobile=e.indexOf("Mobile")!==-1||e.indexOf("Mac")!==-1&&Fs()&&"ontouchend"in document},this._checkForMobile(),_t()&&window.addEventListener("resize",this._checkForMobile))}createVideoElement(e){return document.createElement("video")}_reportDrawCall(e=1){this._drawCalls?.addCount(e,!1)}getFps(){return this._fps}getDeltaTime(){return this._deltaTime}isDeterministicLockStep(){return this._deterministicLockstep}getLockstepMaxSteps(){return this._lockstepMaxSteps}getTimeStep(){return this._timeStep*1e3}_createImageBitmapFromSource(e,t){throw new Error("createImageBitmapFromSource is not implemented")}createImageBitmap(e,t){return createImageBitmap(e,t)}resizeImageBitmap(e,t,i){throw new Error("resizeImageBitmap is not implemented")}getFontOffset(e){throw new Error("getFontOffset is not implemented")}static _CreateCanvas(e,t){if(typeof document>"u")return new OffscreenCanvas(e,t);const i=document.createElement("canvas");return i.width=e,i.height=t,i}createCanvas(e,t){return H._CreateCanvas(e,t)}static _FileToolsLoadImage(e,t,i,s,r,n,o){throw ie("FileTools")}_loadFile(e,t,i,s,r,n){const o=Po(e,t,i,s,r,n);return this._activeRequests.push(o),o.onCompleteObservable.add(()=>{const h=this._activeRequests.indexOf(o);h!==-1&&this._activeRequests.splice(h,1)}),o}static _FileToolsLoadFile(e,t,i,s,r,n){if(Mr.loadFile)return Mr.loadFile(e,t,i,s,r,n);throw ie("FileTools")}dispose(){for(this.releaseEffects(),this._isDisposed=!0,this.stopRenderLoop(),this._emptyTexture&&(this._releaseTexture(this._emptyTexture),this._emptyTexture=null),this._emptyCubeTexture&&(this._releaseTexture(this._emptyCubeTexture),this._emptyCubeTexture=null),this._renderingCanvas=null,this.onBeforeTextureInitObservable&&this.onBeforeTextureInitObservable.clear();this.postProcesses.length;)this.postProcesses[0].dispose();for(;this.scenes.length;)this.scenes[0].dispose();for(;this._virtualScenes.length;)this._virtualScenes[0].dispose();this.releaseComputeEffects?.(),ze.ResetCache();for(const t of this._activeRequests)t.abort();this._boundRenderFunction=null,this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onResizeObservable.clear(),this.onCanvasBlurObservable.clear(),this.onCanvasFocusObservable.clear(),this.onCanvasPointerOutObservable.clear(),this.onNewSceneAddedObservable.clear(),this.onEffectErrorObservable.clear(),_t()&&window.removeEventListener("resize",this._checkForMobile);const e=Te.Instances.indexOf(this);e>=0&&Te.Instances.splice(e,1),Te.Instances.length||(Te.OnEnginesDisposedObservable.notifyObservers(this),Te.OnEnginesDisposedObservable.clear()),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear()}static DefaultLoadingScreenFactory(e){throw ie("LoadingScreen")}static MarkAllMaterialsAsDirty(e,t){for(let i=0;i(a=a.replace(/#/gm,"%23"),a),He={DefaultRetryStrategy:Vl.ExponentialBackoff(),BaseUrl:"",CorsBehavior:"anonymous",PreprocessUrl:a=>a,ScriptBaseUrl:"",ScriptPreprocessUrl:a=>a,CleanUrl:yc},Dn=(a,e)=>{if(!(a&&a.indexOf("data:")===0)&&He.CorsBehavior)if(typeof He.CorsBehavior=="string"||He.CorsBehavior instanceof String)e.crossOrigin=He.CorsBehavior;else{const t=He.CorsBehavior(a);t&&(e.crossOrigin=t)}},On=(a,e,t,i,s="",r,n=Te.LastCreatedEngine)=>{if(typeof HTMLImageElement>"u"&&!n?._features.forceBitmapOverHTMLImageElement)return t("LoadImage is only supported in web or BabylonNative environments."),null;let o,h=!1;a instanceof ArrayBuffer||ArrayBuffer.isView(a)?typeof Blob<"u"&&typeof URL<"u"?(o=URL.createObjectURL(new Blob([a],{type:s})),h=!0):o=`data:${s};base64,`+Mo(a):a instanceof Blob?(o=URL.createObjectURL(a),h=!0):(o=He.CleanUrl(a),o=He.PreprocessUrl(o));const l=C=>{if(t){const x=o||a.toString();t(`Error while trying to load image: ${x.indexOf("http")===0||x.length<=128?x:x.slice(0,128)+"..."}`,C)}};if(n?._features.forceBitmapOverHTMLImageElement)return wi(o,C=>{n.createImageBitmap(new Blob([C],{type:s}),{premultiplyAlpha:"none",...r}).then(x=>{e(x),h&&URL.revokeObjectURL(o)}).catch(x=>{t&&t("Error while trying to load image: "+a,x)})},void 0,i||void 0,!0,(C,x)=>{l(x)}),null;const c=new Image;Dn(o,c);const u=[],f=()=>{for(const C of u)C.target.addEventListener(C.name,C.handler)},d=()=>{for(const C of u)C.target.removeEventListener(C.name,C.handler);u.length=0},g=()=>{d(),e(c),h&&c.src&&URL.revokeObjectURL(c.src)},p=C=>{d(),l(C),h&&c.src&&URL.revokeObjectURL(c.src)},m=C=>{if(C.blockedURI!==c.src||C.disposition==="report")return;d();const x=new Error(`CSP violation of policy ${C.effectiveDirective} ${C.blockedURI}. Current policy is ${C.originalPolicy}`);Te.UseFallbackTexture=!1,l(x),h&&c.src&&URL.revokeObjectURL(c.src),c.src=""};u.push({target:c,name:"load",handler:g}),u.push({target:c,name:"error",handler:p}),u.push({target:document,name:"securitypolicyviolation",handler:m}),f();const A=o.substring(0,5)==="blob:",E=o.substring(0,5)==="data:",I=()=>{A||E||!gt.IsCustomRequestAvailable?c.src=o:wi(o,(C,x,S)=>{const L=!s&&S?S:s,N=new Blob([C],{type:L}),D=URL.createObjectURL(N);h=!0,c.src=D},void 0,i||void 0,!0,(C,x)=>{l(x)})},M=()=>{i&&i.loadImage(o,c)};if(!A&&!E&&i&&i.enableTexturesOffline)i.open(M,I);else{if(o.indexOf("file:")!==-1){const C=decodeURIComponent(o.substring(5).toLowerCase());if(ws.FilesToLoad[C]&&typeof URL<"u"){try{let x;try{x=URL.createObjectURL(ws.FilesToLoad[C])}catch{x=URL.createObjectURL(ws.FilesToLoad[C])}c.src=x,h=!0}catch{c.src=""}return c}}I()}return c},Gs=(a,e,t,i,s)=>{const r=new FileReader,n={onCompleteObservable:new O,abort:()=>r.abort()};return r.onloadend=()=>n.onCompleteObservable.notifyObservers(n),s&&(r.onerror=()=>{s(new vn(`Unable to read ${a.name}`,a))}),r.onload=o=>{e(o.target.result)},t&&(r.onprogress=t),i?r.readAsArrayBuffer(a):r.readAsText(a),n},wi=(a,e,t,i,s,r,n)=>{if(a.name)return Gs(a,e,t,s,r?c=>{r(void 0,c)}:void 0);const o=a;if(o.indexOf("file:")!==-1){let c=decodeURIComponent(o.substring(5).toLowerCase());c.indexOf("./")===0&&(c=c.substring(2));const u=ws.FilesToLoad[c];if(u)return Gs(u,e,t,s,r?f=>r(void 0,new Ir(f.message,f.file)):void 0)}const{match:h,type:l}=ko(o);if(h){const c={onCompleteObservable:new O,abort:()=>()=>{}};try{const u=s?Ln(o):Go(o);e(u,void 0,l)}catch(u){r?r(void 0,u):w.Error(u.message||"Failed to parse the Data URL")}return ks.SetImmediate(()=>{c.onCompleteObservable.notifyObservers(c)}),c}return Fn(o,(c,u)=>{e(c,u?.responseURL,u?.getResponseHeader("content-type"))},t,i,s,r?c=>{r(c.request,new Ir(c.message,c.request))}:void 0,n)},Fn=(a,e,t,i,s,r,n)=>{i!==null&&(i??(i=Te.LastCreatedScene?.offlineProvider)),a=He.CleanUrl(a),a=He.PreprocessUrl(a);const o=He.BaseUrl+a;let h=!1;const l={onCompleteObservable:new O,abort:()=>h=!0},c=()=>{let u=new gt,f=null,d;const g=()=>{u&&(t&&u.removeEventListener("progress",t),d&&u.removeEventListener("readystatechange",d),u.removeEventListener("loadend",p))};let p=()=>{g(),l.onCompleteObservable.notifyObservers(l),l.onCompleteObservable.clear(),t=void 0,d=null,p=null,r=void 0,n=void 0,e=void 0};l.abort=()=>{h=!0,p&&p(),u&&u.readyState!==(XMLHttpRequest.DONE||4)&&u.abort(),f!==null&&(clearTimeout(f),f=null),u=null};const m=E=>{const I=E.message||"Unknown error";r&&u?r(new Pr(I,u)):w.Error(I)},A=E=>{if(u){if(u.open("GET",o),n)try{n(u)}catch(I){m(I);return}s&&(u.responseType="arraybuffer"),t&&u.addEventListener("progress",t),p&&u.addEventListener("loadend",p),d=()=>{if(!(h||!u)&&u.readyState===(XMLHttpRequest.DONE||4)){if(d&&u.removeEventListener("readystatechange",d),u.status>=200&&u.status<300||u.status===0&&(!_t()||Uo())){const C=s?u.response:u.responseText;if(C!==null){try{e&&e(C,u)}catch(x){m(x)}return}}const I=He.DefaultRetryStrategy;if(I){const C=I(o,u,E);if(C!==-1){g(),u=new gt,f=setTimeout(()=>A(E+1),C);return}}const M=new Pr("Error status: "+u.status+" "+u.statusText+" - Unable to load "+o,u);r&&r(M)}},u.addEventListener("readystatechange",d),u.send()}};A(0)};if(i&&i.enableSceneOffline&&!a.startsWith("blob:")){const u=d=>{d&&d.status>400?r&&r(d):c()},f=()=>{i&&i.loadFile(He.BaseUrl+a,d=>{!h&&e&&e(d),l.onCompleteObservable.notifyObservers(l)},t?d=>{!h&&t&&t(d)}:void 0,u,s)};i.open(f,u)}else c();return l},__=a=>{const{match:e,type:t}=ko(a);if(e)return t||void 0;const i=a.lastIndexOf(".");switch(a.substring(i+1).toLowerCase()){case"glb":return"model/gltf-binary";case"bin":return"application/octet-stream";case"gltf":return"model/gltf+json";case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"ktx":return"image/ktx";case"ktx2":return"image/ktx2";case"avif":return"image/avif";default:return}},Uo=()=>typeof location<"u"&&location.protocol==="file:",wn=a=>No.test(a),ko=a=>{const e=No.exec(a);return e===null||e.length===0?{match:!1,type:""}:{match:!0,type:e[0].replace("data:","").replace(";base64,","")}};function Ln(a){return zl(a.split(",")[1])}const Go=a=>Co(a.split(",")[1]),xc=()=>{H._FileToolsLoadImage=On,Mr.loadFile=wi,Do.loadFile=wi};xc();let Is;const Sc=(a,e,t,i,s,r,n,o,h,l)=>{Is={DecodeBase64UrlToBinary:a,DecodeBase64UrlToString:e,DefaultRetryStrategy:t.DefaultRetryStrategy,BaseUrl:t.BaseUrl,CorsBehavior:t.CorsBehavior,PreprocessUrl:t.PreprocessUrl,IsBase64DataUrl:i,IsFileURL:s,LoadFile:r,LoadImage:n,ReadFile:o,RequestFile:h,SetCorsBehavior:l},Object.defineProperty(Is,"DefaultRetryStrategy",{get:function(){return t.DefaultRetryStrategy},set:function(c){t.DefaultRetryStrategy=c}}),Object.defineProperty(Is,"BaseUrl",{get:function(){return t.BaseUrl},set:function(c){t.BaseUrl=c}}),Object.defineProperty(Is,"PreprocessUrl",{get:function(){return t.PreprocessUrl},set:function(c){t.PreprocessUrl=c}}),Object.defineProperty(Is,"CorsBehavior",{get:function(){return t.CorsBehavior},set:function(c){t.CorsBehavior=c}})};Sc(Ln,Go,He,wn,Uo,wi,On,Gs,Fn,Dn);class Ls{static Instantiate(e){if(this.RegisteredExternalClasses&&this.RegisteredExternalClasses[e])return this.RegisteredExternalClasses[e];const t=Oi(e);if(t)return t;w.Warn(e+" not found, you may have missed an import.");const i=e.split(".");let s=window||this;for(let r=0,n=i.length;r{const e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)})}function Hs(a){let e=1;do e*=2;while(ea-t?t:e}function Vo(a){return a--,a|=a>>1,a|=a>>2,a|=a>>4,a|=a>>8,a|=a>>16,a++,a}function Nn(a){return a=a|a>>1,a=a|a>>2,a=a|a>>4,a=a|a>>8,a=a|a>>16,a-(a>>1)}function Vs(a,e,t=2){let i;switch(t){case 1:i=Nn(a);break;case 2:i=Ho(a);break;default:i=Vo(a);break}return Math.min(i,e)}var Z;class se{static get BaseUrl(){return He.BaseUrl}static set BaseUrl(e){He.BaseUrl=e}static get CleanUrl(){return He.CleanUrl}static set CleanUrl(e){He.CleanUrl=e}static IsAbsoluteUrl(e){return e.indexOf("//")===0?!0:e.indexOf("://")===-1||e.indexOf(".")===-1||e.indexOf("/")===-1||e.indexOf(":")>e.indexOf("/")?!1:e.indexOf("://"){wi(e,r=>{i(r)},void 0,void 0,t,(r,n)=>{s(n)})})}static GetAssetUrl(e){if(!e)return"";if(Z.AssetBaseUrl&&e.startsWith(Z._DefaultAssetsUrl)){const t=Z.AssetBaseUrl[Z.AssetBaseUrl.length-1]==="/"?Z.AssetBaseUrl.substring(0,Z.AssetBaseUrl.length-1):Z.AssetBaseUrl;return e.replace(Z._DefaultAssetsUrl,t)}return e}static GetBabylonScriptURL(e,t){if(!e)return"";if(Z.ScriptBaseUrl&&e.startsWith(Z._DefaultCdnUrl)){const i=Z.ScriptBaseUrl[Z.ScriptBaseUrl.length-1]==="/"?Z.ScriptBaseUrl.substring(0,Z.ScriptBaseUrl.length-1):Z.ScriptBaseUrl;e=e.replace(Z._DefaultCdnUrl,i)}return e=Z.ScriptPreprocessUrl(e),t&&!Z.IsAbsoluteUrl(e)&&(e=Z.GetAbsoluteUrl(e)),e}static LoadBabylonScript(e,t,i,s){e=Z.GetBabylonScriptURL(e),Z.LoadScript(e,t,i)}static async LoadBabylonScriptAsync(e){return e=Z.GetBabylonScriptURL(e),await Z.LoadScriptAsync(e)}static _LoadScriptNative(e,t,i){_native&&Z.LoadFile(e,s=>{Function(s).apply(null),t&&t()},void 0,void 0,!1,(s,r)=>{i&&i("LoadScript Error",r)})}static _LoadScriptWeb(e,t,i,s,r=!1){if(typeof importScripts=="function"){try{importScripts(e),t&&t()}catch(h){i?.(`Unable to load script '${e}' in worker`,h)}return}else if(!_t()){i?.(`Cannot load script '${e}' outside of a window or a worker`);return}const n=document.getElementsByTagName("head")[0],o=document.createElement("script");r?(o.setAttribute("type","module"),o.innerText=e):(o.setAttribute("type","text/javascript"),o.setAttribute("src",e)),s&&(o.id=s),o.onload=()=>{t&&t()},o.onerror=h=>{i&&i(`Unable to load script '${e}'`,h)},n.appendChild(o)}static async LoadScriptAsync(e,t){return await new Promise((i,s)=>{this.LoadScript(e,()=>{i()},(r,n)=>{s(n||new Error(r))},t)})}static ReadFileAsDataURL(e,t,i){const s=new FileReader,r={onCompleteObservable:new O,abort:()=>s.abort()};return s.onloadend=()=>{r.onCompleteObservable.notifyObservers(r)},s.onload=n=>{t(n.target.result)},s.onprogress=i,s.readAsDataURL(e),r}static ReadFile(e,t,i,s,r){return Gs(e,t,i,s,r)}static FileAsURL(e){const t=new Blob([e]);return window.URL.createObjectURL(t)}static Format(e,t=2){return e.toFixed(t)}static DeepCopy(e,t,i,s){So.DeepCopy(e,t,i,s)}static IsEmpty(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}static RegisterTopRootEvents(e,t){for(let i=0;i{const h=atob(this.toDataURL(n,o).split(",")[1]),l=h.length,c=new Uint8Array(l);for(let u=0;ut(r)):e.toBlob(function(r){t(r)},i,s)}static DownloadBlob(e,t){if("download"in document.createElement("a")){if(!t){const i=new Date;t="screenshot_"+((i.getFullYear()+"-"+(i.getMonth()+1)).slice(2)+"-"+i.getDate()+"_"+i.getHours()+"-"+("0"+i.getMinutes()).slice(-2))+".png"}Z.Download(e,t)}else if(e&&typeof URL<"u"){const i=URL.createObjectURL(e),s=window.open("");if(!s)return;const r=s.document.createElement("img");r.onload=function(){URL.revokeObjectURL(i)},r.src=i,s.document.body.appendChild(r)}}static EncodeScreenshotCanvasData(e,t,i="image/png",s,r){if(typeof s=="string"||!t)this.ToBlob(e,function(n){n&&Z.DownloadBlob(n,s),t&&t("")},i,r);else if(t){if(Z._IsOffScreenCanvas(e)){e.convertToBlob({type:i,quality:r}).then(o=>{const h=new FileReader;h.readAsDataURL(o),h.onloadend=()=>{const l=h.result;t(l)}});return}const n=e.toDataURL(i,r);t(n)}}static Download(e,t){if(typeof URL>"u")return;const i=window.URL.createObjectURL(e),s=document.createElement("a");document.body.appendChild(s),s.style.display="none",s.href=i,s.download=t,s.addEventListener("click",()=>{s.parentElement&&s.parentElement.removeChild(s)}),s.click(),window.URL.revokeObjectURL(i)}static BackCompatCameraNoPreventDefault(e){return typeof e[0]=="boolean"?e[0]:typeof e[1]=="boolean"?e[1]:!1}static CreateScreenshot(e,t,i,s,r="image/png",n=!1,o){throw ie("ScreenshotTools")}static async CreateScreenshotAsync(e,t,i,s="image/png",r){throw ie("ScreenshotTools")}static CreateScreenshotUsingRenderTarget(e,t,i,s,r="image/png",n=1,o=!1,h,l=!1,c=!1,u=!0,f,d){throw ie("ScreenshotTools")}static async CreateScreenshotUsingRenderTargetAsync(e,t,i,s="image/png",r=1,n=!1,o,h=!1,l=!1,c=!0,u,f){throw ie("ScreenshotTools")}static RandomId(){return Bn()}static IsBase64(e){return wn(e)}static DecodeBase64(e){return Ln(e)}static get errorsCount(){return w.errorsCount}static Log(e){w.Log(e)}static Warn(e){w.Warn(e)}static Error(e){w.Error(e)}static get LogCache(){return w.LogCache}static ClearLogCache(){w.ClearLogCache()}static set LogLevels(e){w.LogLevels=e}static set PerformanceLogLevel(e){if((e&Z.PerformanceUserMarkLogLevel)===Z.PerformanceUserMarkLogLevel){_native?.enablePerformanceLogging?(_native.enablePerformanceLogging(1),Z.StartPerformanceCounter=Z._StartMarkNative,Z.EndPerformanceCounter=Z._EndMarkNative):(Z.StartPerformanceCounter=Z._StartUserMark,Z.EndPerformanceCounter=Z._EndUserMark);return}if((e&Z.PerformanceConsoleLogLevel)===Z.PerformanceConsoleLogLevel){_native?.enablePerformanceLogging?(_native.enablePerformanceLogging(2),Z.StartPerformanceCounter=Z._StartMarkNative,Z.EndPerformanceCounter=Z._EndMarkNative):(Z.StartPerformanceCounter=Z._StartPerformanceConsole,Z.EndPerformanceCounter=Z._EndPerformanceConsole);return}Z.StartPerformanceCounter=Z._StartPerformanceCounterDisabled,Z.EndPerformanceCounter=Z._EndPerformanceCounterDisabled,_native?.disablePerformanceLogging?.()}static _StartPerformanceCounterDisabled(e,t){}static _EndPerformanceCounterDisabled(e,t){}static _StartUserMark(e,t=!0){if(!Z._Performance){if(!_t())return;Z._Performance=window.performance}!t||!Z._Performance.mark||Z._Performance.mark(e+"-Begin")}static _EndUserMark(e,t=!0){!t||!Z._Performance.mark||(Z._Performance.mark(e+"-End"),Z._Performance.measure(e,e+"-Begin",e+"-End"))}static _StartPerformanceConsole(e,t=!0){t&&(Z._StartUserMark(e,t),console.time&&console.time(e))}static _EndPerformanceConsole(e,t=!0){t&&(Z._EndUserMark(e,t),console.timeEnd(e))}static _StartMarkNative(e,t=!0){if(t&&_native?.startPerformanceCounter)if(Z._NativePerformanceCounterHandles.has(e))Z.Warn(`Performance counter with name ${e} is already started.`);else{const i=_native.startPerformanceCounter(e);Z._NativePerformanceCounterHandles.set(e,i)}}static _EndMarkNative(e,t=!0){if(t&&_native?.endPerformanceCounter){const i=Z._NativePerformanceCounterHandles.get(e);i?(_native.endPerformanceCounter(i),Z._NativePerformanceCounterHandles.delete(e)):Z.Warn(`Performance counter with name ${e} was not started.`)}}static get Now(){return vt.Now}static GetClassName(e,t=!1){let i=null;return!t&&e.getClassName?i=e.getClassName():(e instanceof Object&&(i=(t?e:Object.getPrototypeOf(e)).constructor.__bjsclassName__),i||(i=typeof e)),i}static First(e,t){for(const i of e)if(t(i))return i;return null}static getFullClassName(e,t=!1){let i=null,s=null;if(!t&&e.getClassName)i=e.getClassName();else{if(e instanceof Object){const r=t?e:Object.getPrototypeOf(e);i=r.constructor.__bjsclassName__,s=r.constructor.__bjsmoduleName__}i||(i=typeof e)}return i?(s!=null?s+".":"")+i:null}static async DelayAsync(e){await new Promise(t=>{setTimeout(()=>{t()},e)})}static IsSafari(){return hs()?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}}Z=se;se.AssetBaseUrl="";se.UseCustomRequestHeaders=!1;se.CustomRequestHeaders=gt.CustomRequestHeaders;se.GetDOMTextContent=xo;se._DefaultCdnUrl="https://cdn.babylonjs.com";se._DefaultAssetsUrl="https://assets.babylonjs.com/core";se.LoadScript=typeof _native>"u"?Z._LoadScriptWeb:Z._LoadScriptNative;se.GetAbsoluteUrl=typeof document=="object"?a=>{const e=document.createElement("a");return e.href=a,e.href}:typeof URL=="function"&&typeof location=="object"?a=>new URL(a,location.origin).href:()=>{throw new Error("Unable to get absolute URL. Override BABYLON.Tools.GetAbsoluteUrl to a custom implementation for the current context.")};se.NoneLogLevel=w.NoneLogLevel;se.MessageLogLevel=w.MessageLogLevel;se.WarningLogLevel=w.WarningLogLevel;se.ErrorLogLevel=w.ErrorLogLevel;se.AllLogLevel=w.AllLogLevel;se.IsWindowObjectExist=_t;se.PerformanceNoneLogLevel=0;se.PerformanceUserMarkLogLevel=1;se.PerformanceConsoleLogLevel=2;se._NativePerformanceCounterHandles=new Map;se.StartPerformanceCounter=Z._StartPerformanceCounterDisabled;se.EndPerformanceCounter=Z._EndPerformanceCounterDisabled;class vr{constructor(e,t,i,s=0){this.iterations=e,this.index=s-1,this._done=!1,this._fn=t,this._successCallback=i}executeNext(){this._done||(this.index+1{r&&r()?o.breakLoop():setTimeout(()=>{for(let h=0;h=e)break;if(i(l),r&&r()){o.breakLoop();break}}o.executeNext()},n)},s)}}se.Mix=mn;se.IsExponentOfTwo=Hs;Te.FallbackTexture="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z";function Tn(a,e,t){try{const i=a.next();i.done?e(i):i.value?i.value.then(()=>{i.value=void 0,e(i)},t):e(i)}catch(i){t(i)}}function Mc(a=25){let e;return(t,i,s)=>{const r=performance.now();e===void 0||r-e>a?(e=r,setTimeout(()=>{Tn(t,i,s)},0)):Tn(t,i,s)}}function zo(a,e,t,i,s){const r=()=>{let n;const o=h=>{h.done?t(h.value):n===void 0?n=!0:r()};do n=void 0,e(a,o,i),n===void 0&&(n=!1);while(n)};r()}function Un(a,e){let t;return zo(a,Tn,i=>t=i,i=>{throw i}),t}async function Cc(a,e,t){return await new Promise((i,s)=>{zo(a,e,i,s)})}function Ic(a,e){return(...t)=>Un(a(...t))}class it{constructor(e){this.length=0,this.data=new Array(e),this._id=it._GlobalId++}push(e){this.data[this.length++]=e,this.length>this.data.length&&(this.data.length*=2)}forEach(e){for(let t=0;tthis.data.length&&(this.data.length=(this.length+e.length)*2);for(let t=0;t=this.length?-1:t}contains(e){return this.indexOf(e)!==-1}}it._GlobalId=0;class Yi extends it{constructor(){super(...arguments),this._duplicateId=0}push(e){super.push(e),e.__smartArrayFlags||(e.__smartArrayFlags={}),e.__smartArrayFlags[this._id]=this._duplicateId}pushNoDuplicate(e){return e.__smartArrayFlags&&e.__smartArrayFlags[this._id]===this._duplicateId?!1:(this.push(e),!0)}reset(){super.reset(),this._duplicateId++}concatWithNoDuplicate(e){if(e.length!==0){this.length+e.length>this.data.length&&(this.data.length=(this.length+e.length)*2);for(let t=0;t-1?(w.Error("You're trying to reuse a post process not defined as reusable."),0):(t==null||t<0?this._postProcesses.push(e):this._postProcesses[t]===null?this._postProcesses[t]=e:this._postProcesses.splice(t,0,e),this._cascadePostProcessesToRigCams(),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._postProcesses.indexOf(e))}detachPostProcess(e){const t=this._postProcesses.indexOf(e);t!==-1&&(this._postProcesses[t]=null),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._cascadePostProcessesToRigCams()}getWorldMatrix(){return this._isSynchronizedViewMatrix()?this._worldMatrix:(this.getViewMatrix(),this._worldMatrix)}_getViewMatrix(){return P.Identity()}getViewMatrix(e){return!e&&this._isSynchronizedViewMatrix()?this._computedViewMatrix:(this._hasMoved=!0,this.updateCache(),this._computedViewMatrix=this._getViewMatrix(),this._currentRenderId=this.getScene().getRenderId(),this._childUpdateId++,this._refreshFrustumPlanes=!0,this._cameraRigParams&&this._cameraRigParams.vrPreViewMatrix&&this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix,this._computedViewMatrix),this.parent&&this.parent.onViewMatrixChangedObservable&&this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent),this.onViewMatrixChangedObservable.notifyObservers(this),this._computedViewMatrix.invertToRef(this._worldMatrix),this._worldMatrix.getTranslationToRef(this._globalPosition),this._computedViewMatrix)}freezeProjectionMatrix(e){this._doNotComputeProjectionMatrix=!0,e!==void 0&&(this._projectionMatrix=e)}unfreezeProjectionMatrix(){this._doNotComputeProjectionMatrix=!1}getProjectionMatrix(e){if(this._doNotComputeProjectionMatrix||!e&&this._isSynchronizedProjectionMatrix())return this._projectionMatrix;const t=this.ignoreCameraMaxZ?0:this.maxZ;this._cache.mode=this.mode,this._cache.minZ=this.minZ,this._cache.maxZ=t,this._refreshFrustumPlanes=!0;const i=this.getEngine(),s=this.getScene(),r=i.useReverseDepthBuffer;if(this.mode===J.PERSPECTIVE_CAMERA){this._cache.fov=this.fov,this._cache.fovMode=this.fovMode,this._cache.aspectRatio=i.getAspectRatio(this),this._cache.projectionPlaneTilt=this.projectionPlaneTilt,this.minZ<=0&&(this.minZ=.1);let n;s.useRightHandedSystem?n=P.PerspectiveFovRHToRef:n=P.PerspectiveFovLHToRef,n(this.fov,i.getAspectRatio(this),r?t:this.minZ,r?this.minZ:t,this._projectionMatrix,this.fovMode===J.FOVMODE_VERTICAL_FIXED,i.isNDCHalfZRange,this.projectionPlaneTilt,r)}else{const n=i.getRenderWidth()/2,o=i.getRenderHeight()/2;s.useRightHandedSystem?this.oblique?P.ObliqueOffCenterRHToRef(this.orthoLeft??-n,this.orthoRight??n,this.orthoBottom??-o,this.orthoTop??o,r?t:this.minZ,r?this.minZ:t,this.oblique.length,this.oblique.angle,this._computeObliqueDistance(this.oblique.offset),this._projectionMatrix,i.isNDCHalfZRange):P.OrthoOffCenterRHToRef(this.orthoLeft??-n,this.orthoRight??n,this.orthoBottom??-o,this.orthoTop??o,r?t:this.minZ,r?this.minZ:t,this._projectionMatrix,i.isNDCHalfZRange):this.oblique?P.ObliqueOffCenterLHToRef(this.orthoLeft??-n,this.orthoRight??n,this.orthoBottom??-o,this.orthoTop??o,r?t:this.minZ,r?this.minZ:t,this.oblique.length,this.oblique.angle,this._computeObliqueDistance(this.oblique.offset),this._projectionMatrix,i.isNDCHalfZRange):P.OrthoOffCenterLHToRef(this.orthoLeft??-n,this.orthoRight??n,this.orthoBottom??-o,this.orthoTop??o,r?t:this.minZ,r?this.minZ:t,this._projectionMatrix,i.isNDCHalfZRange),this._cache.orthoLeft=this.orthoLeft,this._cache.orthoRight=this.orthoRight,this._cache.orthoBottom=this.orthoBottom,this._cache.orthoTop=this.orthoTop,this._cache.obliqueAngle=this.oblique?.angle,this._cache.obliqueLength=this.oblique?.length,this._cache.obliqueOffset=this.oblique?.offset,this._cache.renderWidth=i.getRenderWidth(),this._cache.renderHeight=i.getRenderHeight()}return this.onProjectionMatrixChangedObservable.notifyObservers(this),this._projectionMatrix}getTransformationMatrix(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix}_computeObliqueDistance(e){const t=this,i=this;return(t.radius||(i.target?_.Distance(this.position,i.target):this.position.length()))+e}_updateFrustumPlanes(){this._refreshFrustumPlanes&&(this.getTransformationMatrix(),this._frustumPlanes?Gt.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=Gt.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)}isInFrustum(e,t=!1){if(this._updateFrustumPlanes(),t&&this.rigCameras.length>0){let i=!1;for(const s of this.rigCameras)s._updateFrustumPlanes(),i=i||e.isInFrustum(s._frustumPlanes);return i}else return e.isInFrustum(this._frustumPlanes)}isCompletelyInFrustum(e){return this._updateFrustumPlanes(),e.isCompletelyInFrustum(this._frustumPlanes)}getForwardRay(e=100,t,i){throw ie("Ray")}getForwardRayToRef(e,t=100,i,s){throw ie("Ray")}dispose(e,t=!1){for(this.onViewMatrixChangedObservable.clear(),this.onProjectionMatrixChangedObservable.clear(),this.onAfterCheckInputsObservable.clear(),this.onRestoreStateObservable.clear(),this.inputs&&this.inputs.clear(),this.getScene().stopAnimation(this),this.getScene().removeCamera(this);this._rigCameras.length>0;){const s=this._rigCameras.pop();s&&s.dispose()}if(this._parentContainer){const s=this._parentContainer.cameras.indexOf(this);s>-1&&this._parentContainer.cameras.splice(s,1),this._parentContainer=null}if(this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses.length=0;else if(this.cameraRigMode!==J.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses.length=0;else{let s=this._postProcesses.length;for(;--s>=0;){const r=this._postProcesses[s];r&&r.dispose(this)}}let i=this.customRenderTargets.length;for(;--i>=0;)this.customRenderTargets[i].dispose();this.customRenderTargets.length=0,this._activeMeshes.dispose(),this.getScene().getEngine().releaseRenderPassId(this.renderPassId),super.dispose(e,t)}get isLeftCamera(){return this._isLeftCamera}get isRightCamera(){return this._isRightCamera}get leftCamera(){return this._rigCameras.length<1?null:this._rigCameras[0]}get rightCamera(){return this._rigCameras.length<2?null:this._rigCameras[1]}getLeftTarget(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()}getRightTarget(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()}setCameraRigMode(e,t){if(this.cameraRigMode!==e){for(;this._rigCameras.length>0;){const i=this._rigCameras.pop();i&&i.dispose()}if(this.cameraRigMode=e,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=t.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=se.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==J.RIG_MODE_NONE){const i=this.createRigCamera(this.name+"_L",0);i&&(i._isLeftCamera=!0);const s=this.createRigCamera(this.name+"_R",1);s&&(s._isRightCamera=!0),i&&s&&(this._rigCameras.push(i),this._rigCameras.push(s))}this._setRigMode(t),this._cascadePostProcessesToRigCams(),this.update()}}_setRigMode(e){}_getVRProjectionMatrix(){return P.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov,this._cameraRigParams.vrMetrics.aspectRatio,this.minZ,this.ignoreCameraMaxZ?0:this.maxZ,this._cameraRigParams.vrWorkMatrix,!0,this.getEngine().isNDCHalfZRange),this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix,this._projectionMatrix),this._projectionMatrix}setCameraRigParameter(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,e==="interaxialDistance"&&(this._cameraRigParams.stereoHalfAngle=se.ToRadians(t/.0637))}createRigCamera(e,t){return null}_updateRigCameras(){for(let e=0;eJ._CreateDefaultParsedCamera(t,i))}computeWorldMatrix(){return this.getWorldMatrix()}static Parse(e,t){const i=e.type,s=J.GetConstructorFromName(i,e.name,t,e.interaxial_distance,e.isStereoscopicSideBySide),r=le.Parse(s,e,t);if(e.parentId!==void 0&&(r._waitingParentId=e.parentId),e.parentInstanceIndex!==void 0&&(r._waitingParentInstanceIndex=e.parentInstanceIndex),r.inputs&&(r.inputs.parse(e),r._setupInputs()),e.upVector&&(r.upVector=_.FromArray(e.upVector)),r.setPosition&&(r.position.copyFromFloats(0,0,0),r.setPosition(_.FromArray(e.position))),e.target&&r.setTarget&&r.setTarget(_.FromArray(e.target)),e.cameraRigMode){const n=e.interaxial_distance?{interaxialDistance:e.interaxial_distance}:{};r.setCameraRigMode(e.cameraRigMode,n)}if(e.animations){for(let n=0;n{throw ie("UniversalCamera")};J.PERSPECTIVE_CAMERA=0;J.ORTHOGRAPHIC_CAMERA=1;J.FOVMODE_VERTICAL_FIXED=0;J.FOVMODE_HORIZONTAL_FIXED=1;J.RIG_MODE_NONE=0;J.RIG_MODE_STEREOSCOPIC_ANAGLYPH=10;J.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL=11;J.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED=12;J.RIG_MODE_STEREOSCOPIC_OVERUNDER=13;J.RIG_MODE_STEREOSCOPIC_INTERLACED=14;J.RIG_MODE_VR=20;J.RIG_MODE_CUSTOM=22;J.ForceAttachControlToAlwaysPreventDefault=!1;T([qt("position")],J.prototype,"_position",void 0);T([qt("upVector")],J.prototype,"_upVector",void 0);T([R()],J.prototype,"orthoLeft",null);T([R()],J.prototype,"orthoRight",null);T([R()],J.prototype,"orthoBottom",null);T([R()],J.prototype,"orthoTop",null);T([R()],J.prototype,"fov",void 0);T([R()],J.prototype,"projectionPlaneTilt",void 0);T([R()],J.prototype,"minZ",void 0);T([R()],J.prototype,"maxZ",void 0);T([R()],J.prototype,"inertia",void 0);T([R()],J.prototype,"mode",null);T([R()],J.prototype,"layerMask",void 0);T([R()],J.prototype,"fovMode",void 0);T([R()],J.prototype,"cameraRigMode",void 0);T([R()],J.prototype,"interaxialDistance",void 0);T([R()],J.prototype,"isStereoscopicSideBySide",void 0);T([R()],J.prototype,"ignoreCameraMaxZ",void 0);class ir{get underlyingResource(){return null}constructor(){this.references=0,this.capacity=0,this.is32Bits=!1,this.uniqueId=ir._Counter++}}ir._Counter=0;function Pc(a,e,t,i){switch(e){case 5120:{let s=a.getInt8(t);return i&&(s=Math.max(s/127,-1)),s}case 5121:{let s=a.getUint8(t);return i&&(s=s/255),s}case 5122:{let s=a.getInt16(t,!0);return i&&(s=Math.max(s/32767,-1)),s}case 5123:{let s=a.getUint16(t,!0);return i&&(s=s/65535),s}case 5124:return a.getInt32(t,!0);case 5125:return a.getUint32(t,!0);case 5126:return a.getFloat32(t,!0);default:throw new Error(`Invalid component type ${e}`)}}function vc(a,e,t,i,s){switch(e){case 5120:{i&&(s=Math.round(s*127)),a.setInt8(t,s);break}case 5121:{i&&(s=Math.round(s*255)),a.setUint8(t,s);break}case 5122:{i&&(s=Math.round(s*32767)),a.setInt16(t,s,!0);break}case 5123:{i&&(s=Math.round(s*65535)),a.setUint16(t,s,!0);break}case 5124:{a.setInt32(t,s,!0);break}case 5125:{a.setUint32(t,s,!0);break}case 5126:{a.setFloat32(t,s,!0);break}default:throw new Error(`Invalid component type ${e}`)}}function Ti(a){switch(a){case 5120:case 5121:return 1;case 5122:case 5123:return 2;case 5124:case 5125:case 5126:return 4;default:throw new Error(`Invalid type '${a}'`)}}function Dc(a){switch(a){case 5120:return Int8Array;case 5121:return Uint8Array;case 5122:return Int16Array;case 5123:return Uint16Array;case 5124:return Int32Array;case 5125:return Uint32Array;case 5126:return Float32Array;default:throw new Error(`Invalid component type '${a}'`)}}function es(a,e,t,i,s,r,n,o){const h=new Array(i),l=new Array(i);if(a instanceof Array){let c=e/4;const u=t/4;for(let f=0;f{for(let d=0;da.length)throw new Error("Last accessed index is out of bounds.");if(p{for(let M=0;Mc.byteLength)throw new Error("Last accessed byte is out of bounds.");const d=e*o;if(s{for(let A=0;A{for(let f=0;f0){this._updatable?this._buffer=this._engine.createDynamicVertexBuffer(this._buffer.capacity,this._label):this._buffer=this._engine.createVertexBuffer(this._buffer.capacity,void 0,this._label);return}w.Warn(`Missing data for buffer "${this._label}" ${this._buffer?"(uniqueId: "+this._buffer.uniqueId+")":""}. Buffer reconstruction failed.`),this._buffer=null}}update(e){this.create(e)}updateDirectly(e,t,i,s=!1){this._buffer&&this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e,s?t:t*Float32Array.BYTES_PER_ELEMENT,i?i*this.byteStride:void 0),t===0&&i===void 0?this._data=e:this._data=null)}_increaseReferences(){if(this._buffer){if(!this._isAlreadyOwned){this._isAlreadyOwned=!0;return}this._buffer.references++}}dispose(){this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._isDisposed=!0,this._data=null,this._buffer=null)}}class b{get isDisposed(){return this._isDisposed}get instanceDivisor(){return this._instanceDivisor}set instanceDivisor(e){const t=e!=0;this._instanceDivisor=e,t!==this._instanced&&(this._instanced=t,this._computeHashCode())}get _maxVerticesCount(){const e=this.getData();return e?Array.isArray(e)?e.length/(this.byteStride/4)-this.byteOffset/4:(e.byteLength-this.byteOffset)/this.byteStride:0}constructor(e,t,i,s,r,n,o,h,l,c,u=!1,f=!1,d=1,g=!1){this._isDisposed=!1;let p=!1;if(this.engine=e,typeof s=="object"&&s!==null?(p=s.updatable??!1,r=s.postponeInternalCreation,n=s.stride,o=s.instanced,h=s.offset,l=s.size,c=s.type,u=s.normalized??!1,f=s.useBytes??!1,d=s.divisor??1,g=s.takeBufferOwnership??!1,this._label=s.label):p=!!s,t instanceof Dr?(this._buffer=t,this._ownsBuffer=g):(this._buffer=new Dr(e,t,p,n,r,o,f,d,this._label),this._ownsBuffer=!0),this.uniqueId=b._Counter++,this._kind=i,c===void 0){const A=this.getData();this.type=A?b.GetDataType(A):b.FLOAT}else this.type=c;const m=Ti(this.type);f?(this._size=l||(n?n/m:b.DeduceStride(i)),this.byteStride=n||this._buffer.byteStride||this._size*m,this.byteOffset=h||0):(this._size=l||n||b.DeduceStride(i),this.byteStride=n?n*m:this._buffer.byteStride||this._size*m,this.byteOffset=(h||0)*m),this.normalized=u,this._instanced=o!==void 0?o:!1,this._instanceDivisor=o?d:0,this._alignBuffer(),this._computeHashCode()}_computeHashCode(){this.hashCode=(this.type-5120<<0)+((this.normalized?1:0)<<3)+(this._size<<4)+((this._instanced?1:0)<<6)+(this.byteStride<<12)}_rebuild(){this._buffer?._rebuild()}getKind(){return this._kind}isUpdatable(){return this._buffer.isUpdatable()}getData(){return this._buffer.getData()}getFloatData(e,t){const i=this.getData();return i?ca(i,this._size,this.type,this.byteOffset,this.byteStride,this.normalized,e,t):null}getBuffer(){return this._buffer.getBuffer()}getWrapperBuffer(){return this._buffer}getStrideSize(){return this.byteStride/Ti(this.type)}getOffset(){return this.byteOffset/Ti(this.type)}getSize(e=!1){return e?this._size*Ti(this.type):this._size}getIsInstanced(){return this._instanced}getInstanceDivisor(){return this._instanceDivisor}create(e){this._buffer.create(e),this._alignBuffer()}update(e){this._buffer.update(e),this._alignBuffer()}updateDirectly(e,t,i=!1){this._buffer.updateDirectly(e,t,void 0,i),this._alignBuffer()}dispose(){this._ownsBuffer&&this._buffer.dispose(),this._isDisposed=!0}forEach(e,t){es(this._buffer.getData(),this.byteOffset,this.byteStride,this._size,this.type,e,this.normalized,(i,s)=>{for(let r=0;r{for(let u=0;uc-s||h-uu-r||l-ff-n)}intersectsSphere(e){return bi.IntersectsSphere(this.minimumWorld,this.maximumWorld,e.centerWorld,e.radiusWorld)}intersectsMinMax(e,t){const i=this.minimumWorld,s=this.maximumWorld,r=i.x,n=i.y,o=i.z,h=s.x,l=s.y,c=s.z,u=e.x,f=e.y,d=e.z,g=t.x,p=t.y,m=t.z;return!(hg||lp||cm)}dispose(){this._drawWrapperFront?.dispose(),this._drawWrapperBack?.dispose()}static Intersects(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)}static IntersectsSphere(e,t,i,s){const r=bi._TmpVector3[0];return _.ClampToRef(i,e,t,r),_.DistanceSquared(i,r)<=s*s}static IsCompletelyInFrustum(e,t){for(let i=0;i<6;++i){const s=t[i];for(let r=0;r<8;++r)if(s.dotCoordinate(e[r])<0)return!1}return!0}static IsInFrustum(e,t){for(let i=0;i<6;++i){let s=!0;const r=t[i];for(let n=0;n<8;++n)if(r.dotCoordinate(e[n])>=0){s=!1;break}if(s)return!1}return!0}}bi._TmpVector3=Ai(3,_.Zero);class Zi{constructor(e,t,i){this.center=_.Zero(),this.centerWorld=_.Zero(),this.minimum=_.Zero(),this.maximum=_.Zero(),this.reConstruct(e,t,i)}reConstruct(e,t,i){this.minimum.copyFrom(e),this.maximum.copyFrom(t);const s=_.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=s*.5,this._update(i||P.IdentityReadOnly)}scale(e){const t=this.radius*e,i=Zi._TmpVector3,s=i[0].setAll(t),r=this.center.subtractToRef(s,i[1]),n=this.center.addToRef(s,i[2]);return this.reConstruct(r,n,this._worldMatrix),this}getWorldMatrix(){return this._worldMatrix}_update(e){if(e.isIdentity())this.centerWorld.copyFrom(this.center),this.radiusWorld=this.radius;else{_.TransformCoordinatesToRef(this.center,e,this.centerWorld);const t=Zi._TmpVector3[0];_.TransformNormalFromFloatsToRef(1,1,1,e,t),this.radiusWorld=Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))*this.radius}}isInFrustum(e){const t=this.centerWorld,i=this.radiusWorld;for(let s=0;s<6;s++)if(e[s].dotCoordinate(t)<=-i)return!1;return!0}isCenterInFrustum(e){const t=this.centerWorld;for(let i=0;i<6;i++)if(e[i].dotCoordinate(t)<0)return!1;return!0}intersectsPoint(e){const t=_.DistanceSquared(this.centerWorld,e);return!(this.radiusWorld*this.radiusWorld{const i=_.Dot(e.centerWorld,a),s=Math.abs(_.Dot(e.directions[0],a))*e.extendSize.x,r=Math.abs(_.Dot(e.directions[1],a))*e.extendSize.y,n=Math.abs(_.Dot(e.directions[2],a))*e.extendSize.z,o=s+r+n;t.min=i-o,t.max=i+o},Rt=(a,e,t)=>(da(a,e,Jr),da(a,t,en),!(Jr.min>en.max||en.min>Jr.max));class Lt{constructor(e,t,i){this._isLocked=!1,this.boundingBox=new bi(e,t,i),this.boundingSphere=new Zi(e,t,i)}reConstruct(e,t,i){this.boundingBox.reConstruct(e,t,i),this.boundingSphere.reConstruct(e,t,i)}get minimum(){return this.boundingBox.minimum}get maximum(){return this.boundingBox.maximum}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked=e}update(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))}centerOn(e,t){const i=Lt._TmpVector3[0].copyFrom(e).subtractInPlace(t),s=Lt._TmpVector3[1].copyFrom(e).addInPlace(t);return this.boundingBox.reConstruct(i,s,this.boundingBox.getWorldMatrix()),this.boundingSphere.reConstruct(i,s,this.boundingBox.getWorldMatrix()),this}encapsulate(e){const t=_.Minimize(this.minimum,e),i=_.Maximize(this.maximum,e);return this.reConstruct(t,i,this.boundingBox.getWorldMatrix()),this}encapsulateBoundingInfo(e){const t=v.Matrix[0];this.boundingBox.getWorldMatrix().invertToRef(t);const i=v.Vector3[0];return _.TransformCoordinatesToRef(e.boundingBox.minimumWorld,t,i),this.encapsulate(i),_.TransformCoordinatesToRef(e.boundingBox.maximumWorld,t,i),this.encapsulate(i),this}scale(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this}isInFrustum(e,t=0){return(t===2||t===3)&&this.boundingSphere.isCenterInFrustum(e)?!0:this.boundingSphere.isInFrustum(e)?t===1||t===3?!0:this.boundingBox.isInFrustum(e):!1}get diagonalLength(){const e=this.boundingBox;return e.maximumWorld.subtractToRef(e.minimumWorld,Lt._TmpVector3[0]).length()}isCompletelyInFrustum(e){return this.boundingBox.isCompletelyInFrustum(e)}_checkCollision(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)}intersectsPoint(e){return!(!this.boundingSphere.centerWorld||!this.boundingSphere.intersectsPoint(e)||!this.boundingBox.intersectsPoint(e))}intersects(e,t){if(!Zi.Intersects(this.boundingSphere,e.boundingSphere)||!bi.Intersects(this.boundingBox,e.boundingBox))return!1;if(!t)return!0;const i=this.boundingBox,s=e.boundingBox;return!(!Rt(i.directions[0],i,s)||!Rt(i.directions[1],i,s)||!Rt(i.directions[2],i,s)||!Rt(s.directions[0],i,s)||!Rt(s.directions[1],i,s)||!Rt(s.directions[2],i,s)||!Rt(_.Cross(i.directions[0],s.directions[0]),i,s)||!Rt(_.Cross(i.directions[0],s.directions[1]),i,s)||!Rt(_.Cross(i.directions[0],s.directions[2]),i,s)||!Rt(_.Cross(i.directions[1],s.directions[0]),i,s)||!Rt(_.Cross(i.directions[1],s.directions[1]),i,s)||!Rt(_.Cross(i.directions[1],s.directions[2]),i,s)||!Rt(_.Cross(i.directions[2],s.directions[0]),i,s)||!Rt(_.Cross(i.directions[2],s.directions[1]),i,s)||!Rt(_.Cross(i.directions[2],s.directions[2]),i,s))}}Lt._TmpVector3=Ai(2,_.Zero);class kr{static extractMinAndMaxIndexed(e,t,i,s,r,n){for(let o=i;o!Array.isArray(a)&&!Array.isArray(e))],kr,"extractMinAndMaxIndexed",null);T([yi.filter((...[a])=>!Array.isArray(a))],kr,"extractMinAndMax",null);function wc(a,e,t,i,s=null){const r=new _(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),n=new _(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);return kr.extractMinAndMaxIndexed(a,e,t,i,r,n),s&&(r.x-=r.x*s.x+s.y,r.y-=r.y*s.x+s.y,r.z-=r.z*s.x+s.y,n.x+=n.x*s.x+s.y,n.y+=n.y*s.x+s.y,n.z+=n.z*s.x+s.y),{minimum:r,maximum:n}}function Wo(a,e,t,i=null,s){const r=new _(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),n=new _(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);return s||(s=3),kr.extractMinAndMax(a,e,t,s,r,n),i&&(r.x-=r.x*i.x+i.y,r.y-=r.y*i.x+i.y,r.z-=r.z*i.x+i.y,n.x+=n.x*i.x+i.y,n.y+=n.y*i.x+i.y,n.z+=n.z*i.x+i.y),{minimum:r,maximum:n}}class kn{static GetEffect(e){return e.getPipelineContext===void 0?e.effect:e}constructor(e,t=!0){this._wasPreviouslyReady=!1,this._forceRebindOnNextCall=!0,this._wasPreviouslyUsingInstances=null,this.effect=null,this.defines=null,this.drawContext=e.createDrawContext(),t&&(this.materialContext=e.createMaterialContext())}setEffect(e,t,i=!0){this.effect=e,t!==void 0&&(this.defines=t),i&&this.drawContext?.reset()}dispose(e=!1){if(this.effect){const t=this.effect;e?t.dispose():ks.SetImmediate(()=>{t.getEngine().onEndFrameObservable.addOnce(()=>{t.dispose()})}),this.effect=null}this.drawContext?.dispose()}}class zt{get materialDefines(){return this._mainDrawWrapperOverride?this._mainDrawWrapperOverride.defines:this._getDrawWrapper()?.defines}set materialDefines(e){const t=this._mainDrawWrapperOverride??this._getDrawWrapper(void 0,!0);t.defines=e}_getDrawWrapper(e,t=!1){e=e??this._engine.currentRenderPassId;let i=this._drawWrappers[e];return!i&&t&&(this._drawWrappers[e]=i=new kn(this._mesh.getScene().getEngine())),i}_removeDrawWrapper(e,t=!0,i=!1){t&&this._drawWrappers[e]?.dispose(i),this._drawWrappers[e]=void 0}get effect(){return this._mainDrawWrapperOverride?this._mainDrawWrapperOverride.effect:this._getDrawWrapper()?.effect??null}get _drawWrapper(){return this._mainDrawWrapperOverride??this._getDrawWrapper(void 0,!0)}get _drawWrapperOverride(){return this._mainDrawWrapperOverride}_setMainDrawWrapperOverride(e){this._mainDrawWrapperOverride=e}setEffect(e,t=null,i,s=!0){const r=this._drawWrapper;r.setEffect(e,t,s),i!==void 0&&(r.materialContext=i),e||(r.defines=null,r.materialContext=void 0)}resetDrawCache(e,t=!1){if(this._drawWrappers)if(e!==void 0){this._removeDrawWrapper(e,!0,t);return}else for(const i of this._drawWrappers)i?.dispose(t);this._drawWrappers=[]}static AddToMesh(e,t,i,s,r,n,o,h=!0){return new zt(e,t,i,s,r,n,o,h)}constructor(e,t,i,s,r,n,o,h=!0,l=!0){this.materialIndex=e,this.verticesStart=t,this.verticesCount=i,this.indexStart=s,this.indexCount=r,this._mainDrawWrapperOverride=null,this._linesIndexCount=0,this._linesIndexBuffer=null,this._lastColliderWorldVertices=null,this._lastColliderTransformMatrix=null,this._wasDispatched=!1,this._renderId=0,this._alphaIndex=0,this._distanceToCamera=0,this._currentMaterial=null,this._mesh=n,this._renderingMesh=o||n,l&&n.subMeshes.push(this),this._engine=this._mesh.getScene().getEngine(),this.resetDrawCache(),this._trianglePlanes=[],this._id=n.subMeshes.length-1,h&&(this.refreshBoundingInfo(),n.computeWorldMatrix(!0))}get IsGlobal(){return this.verticesStart===0&&this.verticesCount===this._mesh.getTotalVertices()&&this.indexStart===0&&this.indexCount===this._mesh.getTotalIndices()}getBoundingInfo(){return this.IsGlobal||this._mesh.hasThinInstances?this._mesh.getBoundingInfo():this._boundingInfo}setBoundingInfo(e){return this._boundingInfo=e,this}getMesh(){return this._mesh}getRenderingMesh(){return this._renderingMesh}getReplacementMesh(){return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null}getEffectiveMesh(){const e=this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null;return e||this._renderingMesh}getMaterial(e=!0){const t=this._renderingMesh.getMaterialForRenderPass(this._engine.currentRenderPassId)??this._renderingMesh.material;if(t){if(this._isMultiMaterial(t)){const i=t.getSubMaterial(this.materialIndex);return this._currentMaterial!==i&&(this._currentMaterial=i,this.resetDrawCache()),i}}else return e&&this._mesh.getScene()._hasDefaultMaterial?this._mesh.getScene().defaultMaterial:null;return t}_isMultiMaterial(e){return e.getSubMaterial!==void 0}refreshBoundingInfo(e=null){if(this._lastColliderWorldVertices=null,this.IsGlobal||!this._renderingMesh||!this._renderingMesh.geometry)return this;if(e||(e=this._renderingMesh.getVerticesData(b.PositionKind)),!e)return this._boundingInfo=this._mesh.getBoundingInfo(),this;const t=this._renderingMesh.getIndices();let i;if(this.indexStart===0&&this.indexCount===t.length){const s=this._renderingMesh.getBoundingInfo();i={minimum:s.minimum.clone(),maximum:s.maximum.clone()}}else i=wc(e,t,this.indexStart,this.indexCount,this._renderingMesh.geometry.boundingBias);return this._boundingInfo?this._boundingInfo.reConstruct(i.minimum,i.maximum):this._boundingInfo=new Lt(i.minimum,i.maximum),this}_checkCollision(e){return this.getBoundingInfo()._checkCollision(e)}updateBoundingInfo(e){let t=this.getBoundingInfo();return t||(this.refreshBoundingInfo(),t=this.getBoundingInfo()),t&&t.update(e),this}isInFrustum(e){const t=this.getBoundingInfo();return t?t.isInFrustum(e,this._mesh.cullingStrategy):!1}isCompletelyInFrustum(e){const t=this.getBoundingInfo();return t?t.isCompletelyInFrustum(e):!1}render(e){return this._renderingMesh.render(this,e,this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:void 0),this}_getLinesIndexBuffer(e,t){if(!this._linesIndexBuffer){const i=Math.floor(this.indexCount/3)*6,r=this.verticesStart+this.verticesCount>65535?new Uint32Array(i):new Uint16Array(i);let n=0;if(e.length===0)for(let o=this.indexStart;oh&&(h=f)}return new zt(e,o,h-o+1,t,i,s,r,n)}}class tn{}class ${constructor(){this.uniqueId=0,this.metadata={},this._applyTo=Ic(this._applyToCoroutine.bind(this)),this.uniqueId=$._UniqueIdGenerator,$._UniqueIdGenerator++}set(e,t){switch(e.length||w.Warn(`Setting vertex data kind '${t}' with an empty array`),t){case b.PositionKind:this.positions=e;break;case b.NormalKind:this.normals=e;break;case b.TangentKind:this.tangents=e;break;case b.UVKind:this.uvs=e;break;case b.UV2Kind:this.uvs2=e;break;case b.UV3Kind:this.uvs3=e;break;case b.UV4Kind:this.uvs4=e;break;case b.UV5Kind:this.uvs5=e;break;case b.UV6Kind:this.uvs6=e;break;case b.ColorKind:this.colors=e;break;case b.MatricesIndicesKind:this.matricesIndices=e;break;case b.MatricesWeightsKind:this.matricesWeights=e;break;case b.MatricesIndicesExtraKind:this.matricesIndicesExtra=e;break;case b.MatricesWeightsExtraKind:this.matricesWeightsExtra=e;break}}applyToMesh(e,t){return this._applyTo(e,t,!1),this}applyToGeometry(e,t){return this._applyTo(e,t,!1),this}updateMesh(e){return this._update(e),this}updateGeometry(e){return this._update(e),this}*_applyToCoroutine(e,t=!1,i){if(this.positions&&(e.setVerticesData(b.PositionKind,this.positions,t),i&&(yield)),this.normals&&(e.setVerticesData(b.NormalKind,this.normals,t),i&&(yield)),this.tangents&&(e.setVerticesData(b.TangentKind,this.tangents,t),i&&(yield)),this.uvs&&(e.setVerticesData(b.UVKind,this.uvs,t),i&&(yield)),this.uvs2&&(e.setVerticesData(b.UV2Kind,this.uvs2,t),i&&(yield)),this.uvs3&&(e.setVerticesData(b.UV3Kind,this.uvs3,t),i&&(yield)),this.uvs4&&(e.setVerticesData(b.UV4Kind,this.uvs4,t),i&&(yield)),this.uvs5&&(e.setVerticesData(b.UV5Kind,this.uvs5,t),i&&(yield)),this.uvs6&&(e.setVerticesData(b.UV6Kind,this.uvs6,t),i&&(yield)),this.colors){const s=this.positions&&this.colors.length===this.positions.length?3:4;e.setVerticesData(b.ColorKind,this.colors,t,s),this.hasVertexAlpha&&e.hasVertexAlpha!==void 0&&(e.hasVertexAlpha=!0),i&&(yield)}if(this.matricesIndices&&(e.setVerticesData(b.MatricesIndicesKind,this.matricesIndices,t),i&&(yield)),this.matricesWeights&&(e.setVerticesData(b.MatricesWeightsKind,this.matricesWeights,t),i&&(yield)),this.matricesIndicesExtra&&(e.setVerticesData(b.MatricesIndicesExtraKind,this.matricesIndicesExtra,t),i&&(yield)),this.matricesWeightsExtra&&(e.setVerticesData(b.MatricesWeightsExtraKind,this.matricesWeightsExtra,t),i&&(yield)),this.indices?(e.setIndices(this.indices,null,t),i&&(yield)):e.setIndices([],null),e.subMeshes&&this.materialInfos&&this.materialInfos.length>1){const s=e;s.subMeshes=[];for(const r of this.materialInfos)new zt(r.materialIndex,r.verticesStart,r.verticesCount,r.indexStart,r.indexCount,s)}return this}_update(e,t,i){return this.positions&&e.updateVerticesData(b.PositionKind,this.positions,t,i),this.normals&&e.updateVerticesData(b.NormalKind,this.normals,t,i),this.tangents&&e.updateVerticesData(b.TangentKind,this.tangents,t,i),this.uvs&&e.updateVerticesData(b.UVKind,this.uvs,t,i),this.uvs2&&e.updateVerticesData(b.UV2Kind,this.uvs2,t,i),this.uvs3&&e.updateVerticesData(b.UV3Kind,this.uvs3,t,i),this.uvs4&&e.updateVerticesData(b.UV4Kind,this.uvs4,t,i),this.uvs5&&e.updateVerticesData(b.UV5Kind,this.uvs5,t,i),this.uvs6&&e.updateVerticesData(b.UV6Kind,this.uvs6,t,i),this.colors&&e.updateVerticesData(b.ColorKind,this.colors,t,i),this.matricesIndices&&e.updateVerticesData(b.MatricesIndicesKind,this.matricesIndices,t,i),this.matricesWeights&&e.updateVerticesData(b.MatricesWeightsKind,this.matricesWeights,t,i),this.matricesIndicesExtra&&e.updateVerticesData(b.MatricesIndicesExtraKind,this.matricesIndicesExtra,t,i),this.matricesWeightsExtra&&e.updateVerticesData(b.MatricesWeightsExtraKind,this.matricesWeightsExtra,t,i),this.indices&&e.setIndices(this.indices,null),this}static _TransformVector3Coordinates(e,t,i=0,s=e.length){const r=v.Vector3[0],n=v.Vector3[1];for(let o=i;o({vertexData:o})):[{vertexData:e}];return Un(this._mergeCoroutine(void 0,n,t,!1,i,s,r))}*_mergeCoroutine(e,t,i=!1,s,r,n=!1,o=!1){this._validate();let h=t.map(d=>d.vertexData),l=this;if(o)for(const d of h)d&&(d._validate(),!this.normals&&d.normals&&(this.normals=new Float32Array(this.positions.length)),!this.tangents&&d.tangents&&(this.tangents=new Float32Array(this.positions.length/3*4)),!this.uvs&&d.uvs&&(this.uvs=new Float32Array(this.positions.length/3*2)),!this.uvs2&&d.uvs2&&(this.uvs2=new Float32Array(this.positions.length/3*2)),!this.uvs3&&d.uvs3&&(this.uvs3=new Float32Array(this.positions.length/3*2)),!this.uvs4&&d.uvs4&&(this.uvs4=new Float32Array(this.positions.length/3*2)),!this.uvs5&&d.uvs5&&(this.uvs5=new Float32Array(this.positions.length/3*2)),!this.uvs6&&d.uvs6&&(this.uvs6=new Float32Array(this.positions.length/3*2)),!this.colors&&d.colors&&(this.colors=new Float32Array(this.positions.length/3*4),this.colors.fill(1)),!this.matricesIndices&&d.matricesIndices&&(this.matricesIndices=new Float32Array(this.positions.length/3*4)),!this.matricesWeights&&d.matricesWeights&&(this.matricesWeights=new Float32Array(this.positions.length/3*4)),!this.matricesIndicesExtra&&d.matricesIndicesExtra&&(this.matricesIndicesExtra=new Float32Array(this.positions.length/3*4)),!this.matricesWeightsExtra&&d.matricesWeightsExtra&&(this.matricesWeightsExtra=new Float32Array(this.positions.length/3*4)));for(const d of h)if(d){if(o)this.normals&&!d.normals&&(d.normals=new Float32Array(d.positions.length)),this.tangents&&!d.tangents&&(d.tangents=new Float32Array(d.positions.length/3*4)),this.uvs&&!d.uvs&&(d.uvs=new Float32Array(d.positions.length/3*2)),this.uvs2&&!d.uvs2&&(d.uvs2=new Float32Array(d.positions.length/3*2)),this.uvs3&&!d.uvs3&&(d.uvs3=new Float32Array(d.positions.length/3*2)),this.uvs4&&!d.uvs4&&(d.uvs4=new Float32Array(d.positions.length/3*2)),this.uvs5&&!d.uvs5&&(d.uvs5=new Float32Array(d.positions.length/3*2)),this.uvs6&&!d.uvs6&&(d.uvs6=new Float32Array(d.positions.length/3*2)),this.colors&&!d.colors&&(d.colors=new Float32Array(d.positions.length/3*4),d.colors.fill(1)),this.matricesIndices&&!d.matricesIndices&&(d.matricesIndices=new Float32Array(d.positions.length/3*4)),this.matricesWeights&&!d.matricesWeights&&(d.matricesWeights=new Float32Array(d.positions.length/3*4)),this.matricesIndicesExtra&&!d.matricesIndicesExtra&&(d.matricesIndicesExtra=new Float32Array(d.positions.length/3*4)),this.matricesWeightsExtra&&!d.matricesWeightsExtra&&(d.matricesWeightsExtra=new Float32Array(d.positions.length/3*4));else if(d._validate(),!this.normals!=!d.normals||!this.tangents!=!d.tangents||!this.uvs!=!d.uvs||!this.uvs2!=!d.uvs2||!this.uvs3!=!d.uvs3||!this.uvs4!=!d.uvs4||!this.uvs5!=!d.uvs5||!this.uvs6!=!d.uvs6||!this.colors!=!d.colors||!this.matricesIndices!=!d.matricesIndices||!this.matricesWeights!=!d.matricesWeights||!this.matricesIndicesExtra!=!d.matricesIndicesExtra||!this.matricesWeightsExtra!=!d.matricesWeightsExtra)throw new Error("Cannot merge vertex data that do not have the same set of attributes")}if(n){let d=0,g=0,p=0;const m=[];let A=null;const E=[];for(const M of this.splitBasedOnMaterialID())E.push({vertexData:M,transform:e});for(const M of t)if(M.vertexData)for(const C of M.vertexData.splitBasedOnMaterialID())E.push({vertexData:C,transform:M.transform});E.sort((M,C)=>{const x=M.vertexData.materialInfos?M.vertexData.materialInfos[0].materialIndex:0,S=C.vertexData.materialInfos?C.vertexData.materialInfos[0].materialIndex:0;return x>S?1:x===S?0:-1});for(const M of E){const C=M.vertexData;if(C.materialInfos?d=C.materialInfos[0].materialIndex:d=0,A&&A.materialIndex===d)A.indexCount+=C.indices.length,A.verticesCount+=C.positions.length/3;else{const x=new tn;x.materialIndex=d,x.indexStart=g,x.indexCount=C.indices.length,x.verticesStart=p,x.verticesCount=C.positions.length/3,m.push(x),A=x}g+=C.indices.length,p+=C.positions.length/3}const I=E.splice(0,1)[0];l=I.vertexData,e=I.transform,h=E.map(M=>M.vertexData),t=E,this.materialInfos=m}const c=h.reduce((d,g)=>d+(g.indices?.length??0),l.indices?.length??0);let f=r||h.some(d=>d.indices===l.indices)?l.indices?.slice():l.indices;if(c>0){let d=f?.length??0;if(f||(f=new Array(c)),f.length!==c){if(Array.isArray(f))f.length=c;else{const p=i||f instanceof Uint32Array?new Uint32Array(c):new Uint16Array(c);p.set(f),f=p}e&&e.determinant()<0&&$._FlipFaces(f,0,d)}let g=l.positions?l.positions.length/3:0;for(const{vertexData:p,transform:m}of t)if(p.indices){for(let A=0;A[d.vertexData.positions,d.transform])),s&&(yield),l.normals&&(this.normals=$._MergeElement(b.NormalKind,l.normals,e,t.map(d=>[d.vertexData.normals,d.transform])),s&&(yield)),l.tangents&&(this.tangents=$._MergeElement(b.TangentKind,l.tangents,e,t.map(d=>[d.vertexData.tangents,d.transform])),s&&(yield)),l.uvs&&(this.uvs=$._MergeElement(b.UVKind,l.uvs,e,t.map(d=>[d.vertexData.uvs,d.transform])),s&&(yield)),l.uvs2&&(this.uvs2=$._MergeElement(b.UV2Kind,l.uvs2,e,t.map(d=>[d.vertexData.uvs2,d.transform])),s&&(yield)),l.uvs3&&(this.uvs3=$._MergeElement(b.UV3Kind,l.uvs3,e,t.map(d=>[d.vertexData.uvs3,d.transform])),s&&(yield)),l.uvs4&&(this.uvs4=$._MergeElement(b.UV4Kind,l.uvs4,e,t.map(d=>[d.vertexData.uvs4,d.transform])),s&&(yield)),l.uvs5&&(this.uvs5=$._MergeElement(b.UV5Kind,l.uvs5,e,t.map(d=>[d.vertexData.uvs5,d.transform])),s&&(yield)),l.uvs6&&(this.uvs6=$._MergeElement(b.UV6Kind,l.uvs6,e,t.map(d=>[d.vertexData.uvs6,d.transform])),s&&(yield)),l.colors&&(this.colors=$._MergeElement(b.ColorKind,l.colors,e,t.map(d=>[d.vertexData.colors,d.transform])),(l.hasVertexAlpha!==void 0||t.some(d=>d.vertexData.hasVertexAlpha!==void 0))&&(this.hasVertexAlpha=l.hasVertexAlpha||t.some(d=>d.vertexData.hasVertexAlpha)),s&&(yield)),l.matricesIndices&&(this.matricesIndices=$._MergeElement(b.MatricesIndicesKind,l.matricesIndices,e,t.map(d=>[d.vertexData.matricesIndices,d.transform])),s&&(yield)),l.matricesWeights&&(this.matricesWeights=$._MergeElement(b.MatricesWeightsKind,l.matricesWeights,e,t.map(d=>[d.vertexData.matricesWeights,d.transform])),s&&(yield)),l.matricesIndicesExtra&&(this.matricesIndicesExtra=$._MergeElement(b.MatricesIndicesExtraKind,l.matricesIndicesExtra,e,t.map(d=>[d.vertexData.matricesIndicesExtra,d.transform])),s&&(yield)),l.matricesWeightsExtra&&(this.matricesWeightsExtra=$._MergeElement(b.MatricesWeightsExtraKind,l.matricesWeightsExtra,e,t.map(d=>[d.vertexData.matricesWeightsExtra,d.transform]))),this}static _MergeElement(e,t,i,s){const r=s.filter(h=>h[0]!==null&&h[0]!==void 0);if(!t&&r.length==0)return t;if(!t)return this._MergeElement(e,r[0][0],r[0][1],r.slice(1));const n=r.reduce((h,l)=>h+l[0].length,t.length),o=e===b.PositionKind?$._TransformVector3Coordinates:e===b.NormalKind?$._TransformVector3Normals:e===b.TangentKind?$._TransformVector4Normals:()=>{};if(t instanceof Float32Array){const h=new Float32Array(n);h.set(t),i&&o(h,i,0,t.length);let l=t.length;for(const[c,u]of r)h.set(c,l),u&&o(h,u,l,c.length),l+=c.length;return h}else{const h=new Array(n);for(let c=0;c{const n=b.DeduceStride(s);if(r.length%n!==0)throw new Error("The "+s+"s array count must be a multiple of "+n);return r.length/n},t=e(b.PositionKind,this.positions),i=(s,r)=>{const n=e(s,r);if(n!==t)throw new Error("The "+s+"s element count ("+n+") does not match the positions count ("+t+")")};this.normals&&i(b.NormalKind,this.normals),this.tangents&&i(b.TangentKind,this.tangents),this.uvs&&i(b.UVKind,this.uvs),this.uvs2&&i(b.UV2Kind,this.uvs2),this.uvs3&&i(b.UV3Kind,this.uvs3),this.uvs4&&i(b.UV4Kind,this.uvs4),this.uvs5&&i(b.UV5Kind,this.uvs5),this.uvs6&&i(b.UV6Kind,this.uvs6),this.colors&&i(b.ColorKind,this.colors),this.matricesIndices&&i(b.MatricesIndicesKind,this.matricesIndices),this.matricesWeights&&i(b.MatricesWeightsKind,this.matricesWeights),this.matricesIndicesExtra&&i(b.MatricesIndicesExtraKind,this.matricesIndicesExtra),this.matricesWeightsExtra&&i(b.MatricesWeightsExtraKind,this.matricesWeightsExtra)}clone(){const e=this.serialize();return $.Parse(e)}serialize(){const e={};if(this.positions&&(e.positions=Array.from(this.positions)),this.normals&&(e.normals=Array.from(this.normals)),this.tangents&&(e.tangents=Array.from(this.tangents)),this.uvs&&(e.uvs=Array.from(this.uvs)),this.uvs2&&(e.uvs2=Array.from(this.uvs2)),this.uvs3&&(e.uvs3=Array.from(this.uvs3)),this.uvs4&&(e.uvs4=Array.from(this.uvs4)),this.uvs5&&(e.uvs5=Array.from(this.uvs5)),this.uvs6&&(e.uvs6=Array.from(this.uvs6)),this.colors&&(e.colors=Array.from(this.colors),e.hasVertexAlpha=this.hasVertexAlpha),this.matricesIndices&&(e.matricesIndices=Array.from(this.matricesIndices),e.matricesIndicesExpanded=!0),this.matricesWeights&&(e.matricesWeights=Array.from(this.matricesWeights)),this.matricesIndicesExtra&&(e.matricesIndicesExtra=Array.from(this.matricesIndicesExtra),e.matricesIndicesExtraExpanded=!0),this.matricesWeightsExtra&&(e.matricesWeightsExtra=Array.from(this.matricesWeightsExtra)),e.indices=this.indices?Array.from(this.indices):[],this.materialInfos){e.materialInfos=[];for(const t of this.materialInfos){const i={indexStart:t.indexStart,indexCount:t.indexCount,materialIndex:t.materialIndex,verticesStart:t.verticesStart,verticesCount:t.verticesCount};e.materialInfos.push(i)}}return e}static ExtractFromMesh(e,t,i){return $._ExtractFrom(e,t,i)}static ExtractFromGeometry(e,t,i){return $._ExtractFrom(e,t,i)}static _ExtractFrom(e,t,i){const s=new $;if(e.isVerticesDataPresent(b.PositionKind)&&(s.positions=e.getVerticesData(b.PositionKind,t,i)),e.isVerticesDataPresent(b.NormalKind)&&(s.normals=e.getVerticesData(b.NormalKind,t,i)),e.isVerticesDataPresent(b.TangentKind)&&(s.tangents=e.getVerticesData(b.TangentKind,t,i)),e.isVerticesDataPresent(b.UVKind)&&(s.uvs=e.getVerticesData(b.UVKind,t,i)),e.isVerticesDataPresent(b.UV2Kind)&&(s.uvs2=e.getVerticesData(b.UV2Kind,t,i)),e.isVerticesDataPresent(b.UV3Kind)&&(s.uvs3=e.getVerticesData(b.UV3Kind,t,i)),e.isVerticesDataPresent(b.UV4Kind)&&(s.uvs4=e.getVerticesData(b.UV4Kind,t,i)),e.isVerticesDataPresent(b.UV5Kind)&&(s.uvs5=e.getVerticesData(b.UV5Kind,t,i)),e.isVerticesDataPresent(b.UV6Kind)&&(s.uvs6=e.getVerticesData(b.UV6Kind,t,i)),e.isVerticesDataPresent(b.ColorKind)){const r=e.geometry||e,n=r.getVertexBuffer(b.ColorKind),o=r.getVerticesData(b.ColorKind,t,i);if(n.getSize()===3){const h=new Float32Array(o.length*4/3);for(let l=0,c=0;l!Array.isArray(a))],$,"_TransformVector3Coordinates",null);T([yi.filter((...[a])=>!Array.isArray(a))],$,"_TransformVector3Normals",null);T([yi.filter((...[a])=>!Array.isArray(a))],$,"_TransformVector4Normals",null);T([yi.filter((...[a])=>!Array.isArray(a))],$,"_FlipFaces",null);class xt{static get ForceFullSceneLoadingForIncremental(){return xt._ForceFullSceneLoadingForIncremental}static set ForceFullSceneLoadingForIncremental(e){xt._ForceFullSceneLoadingForIncremental=e}static get ShowLoadingScreen(){return xt._ShowLoadingScreen}static set ShowLoadingScreen(e){xt._ShowLoadingScreen=e}static get loggingLevel(){return xt._LoggingLevel}static set loggingLevel(e){xt._LoggingLevel=e}static get CleanBoneMatrixWeights(){return xt._CleanBoneMatrixWeights}static set CleanBoneMatrixWeights(e){xt._CleanBoneMatrixWeights=e}}xt._ForceFullSceneLoadingForIncremental=!1;xt._ShowLoadingScreen=!0;xt._CleanBoneMatrixWeights=!1;xt._LoggingLevel=0;class Tt{get boundingBias(){return this._boundingBias}set boundingBias(e){this._boundingBias?this._boundingBias.copyFrom(e):this._boundingBias=e.clone(),this._updateBoundingInfo(!0,null)}static CreateGeometryForMesh(e){const t=new Tt(Tt.RandomId(),e.getScene());return t.applyToMesh(e),t}get meshes(){return this._meshes}constructor(e,t,i,s=!1,r=null,n=null){this.delayLoadState=0,this._totalVertices=0,this._isDisposed=!1,this._extend={minimum:new _(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),maximum:new _(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},this._indexBufferIsUpdatable=!1,this._positionsCache=[],this._parentContainer=null,this.useBoundingInfoFromGeometry=!1,this._scene=t||Te.LastCreatedScene,this._scene&&(this.id=e,this.uniqueId=this._scene.getUniqueId(),this._engine=this._scene.getEngine(),this._meshes=[],this._vertexBuffers={},this._indices=[],this._updatable=s,n!==null&&(this._totalVertices=n),i?this.setAllVerticesData(i,s):n===null&&(this._totalVertices=0),this._engine.getCaps().vertexArrayObject&&(this._vertexArrayObjects={}),r&&(this.applyToMesh(r),r.computeWorldMatrix(!0)))}get extend(){return this._extend}getScene(){return this._scene}getEngine(){return this._engine}isReady(){return this.delayLoadState===1||this.delayLoadState===0}get doNotSerialize(){for(let e=0;e{t._rebuild()})}setAllVerticesData(e,t){e.applyToGeometry(this,t),this._notifyUpdate()}setVerticesData(e,t,i=!1,s){i&&Array.isArray(t)&&(t=new Float32Array(t));const r=new b(this._engine,t,e,{updatable:i,postponeInternalCreation:this._meshes.length===0,stride:s,label:"Geometry_"+this.id+"_"+e});this.setVerticesBuffer(r)}removeVerticesData(e){this._vertexBuffers[e]&&(this._vertexBuffers[e].dispose(),delete this._vertexBuffers[e]),this._vertexArrayObjects&&this._disposeVertexArrayObjects()}setVerticesBuffer(e,t=null,i=!0){const s=e.getKind();this._vertexBuffers[s]&&i&&this._vertexBuffers[s].dispose(),e._buffer&&e._ownsBuffer&&e._buffer._increaseReferences(),this._vertexBuffers[s]=e;const r=this._meshes,n=r.length;if(s===b.PositionKind){this._totalVertices=t??e._maxVerticesCount,this._updateExtend(this.useBoundingInfoFromGeometry&&this._boundingInfo?null:e.getFloatData(this._totalVertices)),this._resetPointsArrayCache();const o=this._extend&&this._extend.minimum||new _(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),h=this._extend&&this._extend.maximum||new _(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let l=0;l65535:e.is32Bits=s;for(const r of this._meshes)r._createGlobalSubMesh(!0),r.synchronizeInstances();this._notifyUpdate()}setIndices(e,t=null,i=!1,s=!1){this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer),this._indices=e,this._indexBufferIsUpdatable=i,this._meshes.length!==0&&this._indices&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,i,"Geometry_"+this.id+"_IndexBuffer")),t!=null&&(this._totalVertices=t);for(const r of this._meshes)r._createGlobalSubMesh(!s),r.synchronizeInstances();this._notifyUpdate()}getTotalIndices(){return this.isReady()?this._totalIndices!==void 0?this._totalIndices:this._indices.length:0}getIndices(e,t){if(!this.isReady())return null;const i=this._indices;return!t&&(!e||this._meshes.length===1)?i:i.slice()}getIndexBuffer(){return this.isReady()?this._indexBuffer:null}_releaseVertexArrayObject(e=null){!e||!this._vertexArrayObjects||this._vertexArrayObjects[e.key]&&(this._engine.releaseVertexArrayObject(this._vertexArrayObjects[e.key]),delete this._vertexArrayObjects[e.key])}releaseForMesh(e,t){const i=this._meshes,s=i.indexOf(e);s!==-1&&(i.splice(s,1),this._vertexArrayObjects&&e._invalidateInstanceVertexArrayObject(),e._geometry=null,i.length===0&&t&&this.dispose())}applyToMesh(e){if(e._geometry===this)return;const t=e._geometry;t&&t.releaseForMesh(e),this._vertexArrayObjects&&e._invalidateInstanceVertexArrayObject();const i=this._meshes;e._geometry=this,e._internalAbstractMeshDataInfo._positions=null,this._scene.pushGeometry(this),i.push(e),this.isReady()?this._applyToMesh(e):this._boundingInfo&&e.setBoundingInfo(this._boundingInfo)}_updateExtend(e=null){if(this.useBoundingInfoFromGeometry&&this._boundingInfo)this._extend={minimum:this._boundingInfo.minimum.clone(),maximum:this._boundingInfo.maximum.clone()};else{if(!e&&(e=this.getVerticesData(b.PositionKind),!e))return;this._extend=Wo(e,0,this._totalVertices,this.boundingBias,3)}}_applyToMesh(e){for(const t in this._vertexBuffers){const i=this._vertexBuffers[t];i._buffer.getBuffer()||i.create(),t===b.PositionKind&&(this._extend||this._updateExtend(),e.buildBoundingInfo(this._extend.minimum,this._extend.maximum),e._createGlobalSubMesh(e.isUnIndexed),e._updateBoundingInfo())}!this._indexBuffer&&this._indices&&this._indices.length>0&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,this._updatable,"Geometry_"+this.id+"_IndexBuffer")),e._syncGeometryWithMorphTargetManager(),e.synchronizeInstances()}_notifyUpdate(e){this.onGeometryUpdated&&this.onGeometryUpdated(this,e),this._vertexArrayObjects&&this._disposeVertexArrayObjects();for(const t of this._meshes)t._markSubMeshesAsAttributesDirty()}load(e,t){if(this.delayLoadState!==2){if(this.isReady()){t&&t();return}this.delayLoadState=2,this._queueLoad(e,t)}}_queueLoad(e,t){this.delayLoadingFile&&(e.addPendingData(this),e._loadFile(this.delayLoadingFile,i=>{if(!this._delayLoadingFunction)return;this._delayLoadingFunction(JSON.parse(i),this),this.delayLoadState=1,this._delayInfo=[],e.removePendingData(this);const s=this._meshes,r=s.length;for(let n=0;n0){for(let s=0;s0){for(let s=0;s0){for(let s=0;s-1&&this._parentContainer.geometries.splice(s,1),this._parentContainer=null}this._isDisposed=!0}copy(e){const t=new Tt(e,this._scene),i=this.getIndices(void 0,!0);i&&t.setIndices(i);let s=!1,r;for(r in this._vertexBuffers){const n=this.getVertexBuffer(r),o=n.getData();if(!o)continue;const h=n.isUpdatable(),l=n.getSize(),{type:c,byteOffset:u,byteStride:f,normalized:d}=n;s=s||h;const g=Oc(o,l,c,u,f,this._totalVertices,!0),p=new b(this._engine,g,r,{updatable:h,useBytes:!1,stride:l,size:l,offset:0,type:c,normalized:d,takeBufferOwnership:!0});t.setVerticesBuffer(p,this._totalVertices)}t._updatable=s,t.delayLoadState=this.delayLoadState,t.delayLoadingFile=this.delayLoadingFile,t._delayLoadingFunction=this._delayLoadingFunction;for(r in this._delayInfo)t._delayInfo=t._delayInfo||[],t._delayInfo.push(r);return t._boundingInfo=new Lt(this._extend.minimum,this._extend.maximum),t}serialize(){const e={};return e.id=this.id,e.uniqueId=this.uniqueId,e.updatable=this._updatable,Ae&&Ae.HasTags(this)&&(e.tags=Ae.GetTags(this)),e}_toNumberArray(e){return Array.isArray(e)?e:Array.prototype.slice.call(e)}clearCachedData(){this._totalIndices=this._indices.length,this._indices=[],this._resetPointsArrayCache();for(const e in this._vertexBuffers)Object.prototype.hasOwnProperty.call(this._vertexBuffers,e)&&(this._vertexBuffers[e]._buffer._data=null)}serializeVerticeData(){const e=this.serialize();return this.isVerticesDataPresent(b.PositionKind)&&(e.positions=this._toNumberArray(this.getVerticesData(b.PositionKind)),this.isVertexBufferUpdatable(b.PositionKind)&&(e.positionsUpdatable=!0)),this.isVerticesDataPresent(b.NormalKind)&&(e.normals=this._toNumberArray(this.getVerticesData(b.NormalKind)),this.isVertexBufferUpdatable(b.NormalKind)&&(e.normalsUpdatable=!0)),this.isVerticesDataPresent(b.TangentKind)&&(e.tangents=this._toNumberArray(this.getVerticesData(b.TangentKind)),this.isVertexBufferUpdatable(b.TangentKind)&&(e.tangentsUpdatable=!0)),this.isVerticesDataPresent(b.UVKind)&&(e.uvs=this._toNumberArray(this.getVerticesData(b.UVKind)),this.isVertexBufferUpdatable(b.UVKind)&&(e.uvsUpdatable=!0)),this.isVerticesDataPresent(b.UV2Kind)&&(e.uvs2=this._toNumberArray(this.getVerticesData(b.UV2Kind)),this.isVertexBufferUpdatable(b.UV2Kind)&&(e.uvs2Updatable=!0)),this.isVerticesDataPresent(b.UV3Kind)&&(e.uvs3=this._toNumberArray(this.getVerticesData(b.UV3Kind)),this.isVertexBufferUpdatable(b.UV3Kind)&&(e.uvs3Updatable=!0)),this.isVerticesDataPresent(b.UV4Kind)&&(e.uvs4=this._toNumberArray(this.getVerticesData(b.UV4Kind)),this.isVertexBufferUpdatable(b.UV4Kind)&&(e.uvs4Updatable=!0)),this.isVerticesDataPresent(b.UV5Kind)&&(e.uvs5=this._toNumberArray(this.getVerticesData(b.UV5Kind)),this.isVertexBufferUpdatable(b.UV5Kind)&&(e.uvs5Updatable=!0)),this.isVerticesDataPresent(b.UV6Kind)&&(e.uvs6=this._toNumberArray(this.getVerticesData(b.UV6Kind)),this.isVertexBufferUpdatable(b.UV6Kind)&&(e.uvs6Updatable=!0)),this.isVerticesDataPresent(b.ColorKind)&&(e.colors=this._toNumberArray(this.getVerticesData(b.ColorKind)),this.isVertexBufferUpdatable(b.ColorKind)&&(e.colorsUpdatable=!0)),this.isVerticesDataPresent(b.MatricesIndicesKind)&&(e.matricesIndices=this._toNumberArray(this.getVerticesData(b.MatricesIndicesKind)),e.matricesIndicesExpanded=!0,this.isVertexBufferUpdatable(b.MatricesIndicesKind)&&(e.matricesIndicesUpdatable=!0)),this.isVerticesDataPresent(b.MatricesWeightsKind)&&(e.matricesWeights=this._toNumberArray(this.getVerticesData(b.MatricesWeightsKind)),this.isVertexBufferUpdatable(b.MatricesWeightsKind)&&(e.matricesWeightsUpdatable=!0)),e.indices=this._toNumberArray(this.getIndices()),e}static ExtractFromMesh(e,t){const i=e._geometry;return i?i.copy(t):null}static RandomId(){return se.RandomId()}static _GetGeometryByLoadedUniqueId(e,t){for(let i=0;i0){const o=new Float32Array(e,n.positionsAttrDesc.offset,n.positionsAttrDesc.count);t.setVerticesData(b.PositionKind,o,!1)}if(n.normalsAttrDesc&&n.normalsAttrDesc.count>0){const o=new Float32Array(e,n.normalsAttrDesc.offset,n.normalsAttrDesc.count);t.setVerticesData(b.NormalKind,o,!1)}if(n.tangetsAttrDesc&&n.tangetsAttrDesc.count>0){const o=new Float32Array(e,n.tangetsAttrDesc.offset,n.tangetsAttrDesc.count);t.setVerticesData(b.TangentKind,o,!1)}if(n.uvsAttrDesc&&n.uvsAttrDesc.count>0){const o=new Float32Array(e,n.uvsAttrDesc.offset,n.uvsAttrDesc.count);t.setVerticesData(b.UVKind,o,!1)}if(n.uvs2AttrDesc&&n.uvs2AttrDesc.count>0){const o=new Float32Array(e,n.uvs2AttrDesc.offset,n.uvs2AttrDesc.count);t.setVerticesData(b.UV2Kind,o,!1)}if(n.uvs3AttrDesc&&n.uvs3AttrDesc.count>0){const o=new Float32Array(e,n.uvs3AttrDesc.offset,n.uvs3AttrDesc.count);t.setVerticesData(b.UV3Kind,o,!1)}if(n.uvs4AttrDesc&&n.uvs4AttrDesc.count>0){const o=new Float32Array(e,n.uvs4AttrDesc.offset,n.uvs4AttrDesc.count);t.setVerticesData(b.UV4Kind,o,!1)}if(n.uvs5AttrDesc&&n.uvs5AttrDesc.count>0){const o=new Float32Array(e,n.uvs5AttrDesc.offset,n.uvs5AttrDesc.count);t.setVerticesData(b.UV5Kind,o,!1)}if(n.uvs6AttrDesc&&n.uvs6AttrDesc.count>0){const o=new Float32Array(e,n.uvs6AttrDesc.offset,n.uvs6AttrDesc.count);t.setVerticesData(b.UV6Kind,o,!1)}if(n.colorsAttrDesc&&n.colorsAttrDesc.count>0){const o=new Float32Array(e,n.colorsAttrDesc.offset,n.colorsAttrDesc.count);t.setVerticesData(b.ColorKind,o,!1,n.colorsAttrDesc.stride)}if(n.matricesIndicesAttrDesc&&n.matricesIndicesAttrDesc.count>0){const o=new Int32Array(e,n.matricesIndicesAttrDesc.offset,n.matricesIndicesAttrDesc.count),h=[];for(let l=0;l>8),h.push((c&16711680)>>16),h.push(c>>24&255)}t.setVerticesData(b.MatricesIndicesKind,h,!1)}if(n.matricesIndicesExtraAttrDesc&&n.matricesIndicesExtraAttrDesc.count>0){const o=new Int32Array(e,n.matricesIndicesExtraAttrDesc.offset,n.matricesIndicesExtraAttrDesc.count),h=[];for(let l=0;l>8),h.push((c&16711680)>>16),h.push(c>>24&255)}t.setVerticesData(b.MatricesIndicesExtraKind,h,!1)}if(n.matricesWeightsAttrDesc&&n.matricesWeightsAttrDesc.count>0){const o=new Float32Array(e,n.matricesWeightsAttrDesc.offset,n.matricesWeightsAttrDesc.count);t.setVerticesData(b.MatricesWeightsKind,o,!1)}if(n.indicesAttrDesc&&n.indicesAttrDesc.count>0){const o=new Int32Array(e,n.indicesAttrDesc.offset,n.indicesAttrDesc.count);t.setIndices(o,null)}if(n.subMeshesAttrDesc&&n.subMeshesAttrDesc.count>0){const o=new Int32Array(e,n.subMeshesAttrDesc.offset,n.subMeshesAttrDesc.count*5);t.subMeshes=[];for(let h=0;h>8),n.push((h&16711680)>>16),n.push(h>>24&255)}t.setVerticesData(b.MatricesIndicesKind,n,e.matricesIndices._updatable||e.matricesIndicesUpdatable)}else delete e.matricesIndices._isExpanded,delete e.matricesIndicesExpanded,t.setVerticesData(b.MatricesIndicesKind,e.matricesIndices,e.matricesIndices._updatable||e.matricesIndicesUpdatable);if(e.matricesIndicesExtra)if(e.matricesIndicesExtraExpanded||e.matricesIndicesExtra._isExpanded)delete e.matricesIndices._isExpanded,delete e.matricesIndicesExtraExpanded,t.setVerticesData(b.MatricesIndicesExtraKind,e.matricesIndicesExtra,e.matricesIndicesExtra._updatable||e.matricesIndicesExtraUpdatable);else{const n=[];for(let o=0;o>8),n.push((h&16711680)>>16),n.push(h>>24&255)}t.setVerticesData(b.MatricesIndicesExtraKind,n,e.matricesIndicesExtra._updatable||e.matricesIndicesExtraUpdatable)}e.matricesWeights&&(Tt._CleanMatricesWeights(e,t),t.setVerticesData(b.MatricesWeightsKind,e.matricesWeights,e.matricesWeights._updatable)),e.matricesWeightsExtra&&t.setVerticesData(b.MatricesWeightsExtraKind,e.matricesWeightsExtra,e.matricesWeights._updatable),t.setIndices(e.indices,null)}if(e.subMeshes){t.subMeshes=[];for(let n=0;n-1){const u=t.getScene().getLastSkeletonById(e.skeletonId);if(!u)return;s=u.bones.length}else return;const r=t.getVerticesData(b.MatricesIndicesKind),n=t.getVerticesData(b.MatricesIndicesExtraKind),o=e.matricesWeights,h=e.matricesWeightsExtra,l=e.numBoneInfluencer,c=o.length;for(let u=0;ul-1)&&(d=l-1),f>.001){const g=1/f;for(let p=0;p<4;p++)o[u+p]*=g;if(h)for(let p=0;p<4;p++)h[u+p]*=g}else d>=4?(h[u+d-4]=1-f,n[u+d-4]=s):(o[u+d]=1-f,r[u+d]=s)}t.setVerticesData(b.MatricesIndicesKind,r),e.matricesWeightsExtra&&t.setVerticesData(b.MatricesIndicesExtraKind,n)}static Parse(e,t,i){const s=new Tt(e.id,t,void 0,e.updatable);return s._loadedUniqueId=e.uniqueId,Ae&&Ae.AddTagsTo(s,e.tags),e.delayLoadingFile?(s.delayLoadState=4,s.delayLoadingFile=i+e.delayLoadingFile,s._boundingInfo=new Lt(_.FromArray(e.boundingBoxMinimum),_.FromArray(e.boundingBoxMaximum)),s._delayInfo=[],e.hasUVs&&s._delayInfo.push(b.UVKind),e.hasUVs2&&s._delayInfo.push(b.UV2Kind),e.hasUVs3&&s._delayInfo.push(b.UV3Kind),e.hasUVs4&&s._delayInfo.push(b.UV4Kind),e.hasUVs5&&s._delayInfo.push(b.UV5Kind),e.hasUVs6&&s._delayInfo.push(b.UV6Kind),e.hasColors&&s._delayInfo.push(b.ColorKind),e.hasMatricesIndices&&s._delayInfo.push(b.MatricesIndicesKind),e.hasMatricesWeights&&s._delayInfo.push(b.MatricesWeightsKind),s._delayLoadingFunction=$.ImportVertexData):$.ImportVertexData(e,s),t.pushGeometry(s,!0),s}}class ae extends qe{get billboardMode(){return this._billboardMode}set billboardMode(e){this._billboardMode!==e&&(this._billboardMode=e,this._cache.useBillboardPosition=(this._billboardMode&ae.BILLBOARDMODE_USE_POSITION)!==0)}get infiniteDistance(){return this._infiniteDistance}set infiniteDistance(e){this._infiniteDistance!==e&&(this._infiniteDistance=e)}constructor(e,t=null,i=!0){super(e,t,!1),this._forward=new _(0,0,1),this._up=new _(0,1,0),this._right=new _(1,0,0),this._position=_.Zero(),this._rotation=_.Zero(),this._rotationQuaternion=null,this._scaling=_.One(),this._transformToBoneReferal=null,this._isAbsoluteSynced=!1,this._billboardMode=ae.BILLBOARDMODE_NONE,this.scalingDeterminant=1,this._infiniteDistance=!1,this.ignoreNonUniformScaling=!1,this.reIntegrateRotationIntoRotationQuaternion=!1,this._poseMatrix=null,this._localMatrix=P.Zero(),this._usePivotMatrix=!1,this._absolutePosition=_.Zero(),this._absoluteScaling=_.Zero(),this._absoluteRotationQuaternion=W.Identity(),this._pivotMatrix=P.Identity(),this._postMultiplyPivotMatrix=!1,this._isWorldMatrixFrozen=!1,this._indexInSceneTransformNodesArray=-1,this.onAfterWorldMatrixUpdateObservable=new O,this._nonUniformScaling=!1,i&&this.getScene().addTransformNode(this)}getClassName(){return"TransformNode"}get position(){return this._position}set position(e){this._position=e,this._markAsDirtyInternal()}isUsingPivotMatrix(){return this._usePivotMatrix}isUsingPostMultiplyPivotMatrix(){return this._postMultiplyPivotMatrix}get rotation(){return this._rotation}set rotation(e){this._rotation=e,this._rotationQuaternion=null,this._markAsDirtyInternal()}get scaling(){return this._scaling}set scaling(e){this._scaling=e,this._markAsDirtyInternal()}get rotationQuaternion(){return this._rotationQuaternion}set rotationQuaternion(e){this._rotationQuaternion=e,e&&this._rotation.setAll(0),this._markAsDirtyInternal()}_markAsDirtyInternal(){this._isDirty||(this._isDirty=!0,this.customMarkAsDirty&&this.customMarkAsDirty())}get forward(){return _.TransformNormalFromFloatsToRef(0,0,this.getScene().useRightHandedSystem?-1:1,this.getWorldMatrix(),this._forward),this._forward.normalize()}get up(){return _.TransformNormalFromFloatsToRef(0,1,0,this.getWorldMatrix(),this._up),this._up.normalize()}get right(){return _.TransformNormalFromFloatsToRef(this.getScene().useRightHandedSystem?-1:1,0,0,this.getWorldMatrix(),this._right),this._right.normalize()}updatePoseMatrix(e){return this._poseMatrix?(this._poseMatrix.copyFrom(e),this):(this._poseMatrix=e.clone(),this)}getPoseMatrix(){return this._poseMatrix||(this._poseMatrix=P.Identity()),this._poseMatrix}_isSynchronized(){const e=this._cache;return!(this._billboardMode!==e.billboardMode||this._billboardMode!==ae.BILLBOARDMODE_NONE||e.pivotMatrixUpdated||this._infiniteDistance||this._position._isDirty||this._scaling._isDirty||this._rotationQuaternion&&this._rotationQuaternion._isDirty||this._rotation._isDirty)}_initCache(){super._initCache();const e=this._cache;e.localMatrixUpdated=!1,e.billboardMode=-1,e.infiniteDistance=!1,e.useBillboardPosition=!1}get absolutePosition(){return this.getAbsolutePosition()}get absoluteScaling(){return this._syncAbsoluteScalingAndRotation(),this._absoluteScaling}get absoluteRotationQuaternion(){return this._syncAbsoluteScalingAndRotation(),this._absoluteRotationQuaternion}setPreTransformMatrix(e){return this.setPivotMatrix(e,!1)}setPivotMatrix(e,t=!0){return this._pivotMatrix.copyFrom(e),this._usePivotMatrix=!this._pivotMatrix.isIdentity(),this._cache.pivotMatrixUpdated=!0,this._postMultiplyPivotMatrix=t,this._postMultiplyPivotMatrix&&(this._pivotMatrixInverse?this._pivotMatrix.invertToRef(this._pivotMatrixInverse):this._pivotMatrixInverse=P.Invert(this._pivotMatrix)),this}getPivotMatrix(){return this._pivotMatrix}instantiateHierarchy(e=null,t,i){const s=this.clone("Clone of "+(this.name||this.id),e||this.parent,!0);s&&i&&i(this,s);for(const r of this.getChildTransformNodes(!0))r.instantiateHierarchy(s,t,i);return s}freezeWorldMatrix(e=null,t=!1){return e?t?(this._rotation.setAll(0),this._rotationQuaternion=this._rotationQuaternion||W.Identity(),e.decompose(this._scaling,this._rotationQuaternion,this._position),this.computeWorldMatrix(!0)):(this._worldMatrix=e,this._absolutePosition.copyFromFloats(this._worldMatrix.m[12],this._worldMatrix.m[13],this._worldMatrix.m[14]),this._afterComputeWorldMatrix()):(this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0)),this._isDirty=!1,this._isWorldMatrixFrozen=!0,this}unfreezeWorldMatrix(){return this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0),this}get isWorldMatrixFrozen(){return this._isWorldMatrixFrozen}getAbsolutePosition(){return this.computeWorldMatrix(),this._absolutePosition}setAbsolutePosition(e){if(!e)return this;let t,i,s;if(e.x===void 0){if(arguments.length<3)return this;t=arguments[0],i=arguments[1],s=arguments[2]}else t=e.x,i=e.y,s=e.z;if(this.parent){const r=v.Matrix[0];this.parent.getWorldMatrix().invertToRef(r),_.TransformCoordinatesFromFloatsToRef(t,i,s,r,this.position)}else this.position.x=t,this.position.y=i,this.position.z=s;return this._absolutePosition.copyFrom(e),this}setPositionWithLocalVector(e){return this.computeWorldMatrix(),this.position=_.TransformNormal(e,this._localMatrix),this}getPositionExpressedInLocalSpace(){this.computeWorldMatrix();const e=v.Matrix[0];return this._localMatrix.invertToRef(e),_.TransformNormal(this.position,e)}locallyTranslate(e){return this.computeWorldMatrix(!0),this.position=_.TransformCoordinates(e,this._localMatrix),this}lookAt(e,t=0,i=0,s=0,r=0){const n=ae._LookAtVectorCache,o=r===0?this.position:this.getAbsolutePosition();if(e.subtractToRef(o,n),this.setDirection(n,t,i,s),r===1&&this.parent)if(this.rotationQuaternion){const h=v.Matrix[0];this.rotationQuaternion.toRotationMatrix(h);const l=v.Matrix[1];this.parent.getWorldMatrix().getRotationMatrixToRef(l),l.invert(),h.multiplyToRef(l,h),this.rotationQuaternion.fromRotationMatrix(h)}else{const h=v.Quaternion[0];W.FromEulerVectorToRef(this.rotation,h);const l=v.Matrix[0];h.toRotationMatrix(l);const c=v.Matrix[1];this.parent.getWorldMatrix().getRotationMatrixToRef(c),c.invert(),l.multiplyToRef(c,l),h.fromRotationMatrix(l),h.toEulerAnglesToRef(this.rotation)}return this}getDirection(e){const t=_.Zero();return this.getDirectionToRef(e,t),t}getDirectionToRef(e,t){return _.TransformNormalToRef(e,this.getWorldMatrix(),t),this}setDirection(e,t=0,i=0,s=0){const r=-Math.atan2(e.z,e.x)+Math.PI/2,n=Math.sqrt(e.x*e.x+e.z*e.z),o=-Math.atan2(e.y,n);return this.rotationQuaternion?W.RotationYawPitchRollToRef(r+t,o+i,s,this.rotationQuaternion):(this.rotation.x=o+i,this.rotation.y=r+t,this.rotation.z=s),this}setPivotPoint(e,t=0){this.getScene().getRenderId()==0&&this.computeWorldMatrix(!0);const i=this.getWorldMatrix();if(t==1){const s=v.Matrix[0];i.invertToRef(s),e=_.TransformCoordinates(e,s)}return this.setPivotMatrix(P.Translation(-e.x,-e.y,-e.z),!0)}getPivotPoint(){const e=_.Zero();return this.getPivotPointToRef(e),e}getPivotPointToRef(e){return e.x=-this._pivotMatrix.m[12],e.y=-this._pivotMatrix.m[13],e.z=-this._pivotMatrix.m[14],this}getAbsolutePivotPoint(){const e=_.Zero();return this.getAbsolutePivotPointToRef(e),e}getAbsolutePivotPointToRef(e){return this.getPivotPointToRef(e),_.TransformCoordinatesToRef(e,this.getWorldMatrix(),e),this}markAsDirty(e){if(this._isDirty)return this;if(this._children)for(const t of this._children)t.markAsDirty(e);return super.markAsDirty(e)}setParent(e,t=!1,i=!1){if(!e&&!this.parent)return this;const s=v.Quaternion[0],r=v.Vector3[0],n=v.Vector3[1],o=v.Matrix[1];P.IdentityToRef(o);const h=v.Matrix[0];this.computeWorldMatrix(!0);let l=this.rotationQuaternion;return l||(l=ae._TmpRotation,W.RotationYawPitchRollToRef(this._rotation.y,this._rotation.x,this._rotation.z,l)),P.ComposeToRef(this.scaling,l,this.position,h),this.parent&&h.multiplyToRef(this.parent.computeWorldMatrix(!0),h),e&&(e.computeWorldMatrix(!0).invertToRef(o),h.multiplyToRef(o,h)),h.decompose(n,s,r,t?this:void 0),this.rotationQuaternion?this.rotationQuaternion.copyFrom(s):s.toEulerAnglesToRef(this.rotation),this.scaling.copyFrom(n),this.position.copyFrom(r),this.parent=e,i&&this.setPivotMatrix(P.Identity()),this}addChild(e,t=!1){return e.setParent(this,t),this}removeChild(e,t=!1){return e.parent!==this?this:(e.setParent(null,t),this)}get nonUniformScaling(){return this._nonUniformScaling}_updateNonUniformScalingState(e){return this._nonUniformScaling===e?!1:(this._nonUniformScaling=e,!0)}attachToBone(e,t){return this._currentParentWhenAttachingToBone=this.parent,this._transformToBoneReferal=t,this.parent=e,e.getSkeleton().prepare(!0),e.getFinalMatrix().determinant()<0&&(this.scalingDeterminant*=-1),this}detachFromBone(e=!1){return this.parent?(this.parent.getWorldMatrix().determinant()<0&&(this.scalingDeterminant*=-1),this._transformToBoneReferal=null,e?this.parent=this._currentParentWhenAttachingToBone:this.parent=null,this):(e&&(this.parent=this._currentParentWhenAttachingToBone),this)}rotate(e,t,i){e.normalize(),this.rotationQuaternion||(this.rotationQuaternion=this.rotation.toQuaternion(),this.rotation.setAll(0));let s;if(!i||i===0)s=W.RotationAxisToRef(e,t,ae._RotationAxisCache),this.rotationQuaternion.multiplyToRef(s,this.rotationQuaternion);else{if(this.parent){const r=this.parent.getWorldMatrix(),n=v.Matrix[0];r.invertToRef(n),e=_.TransformNormal(e,n),r.determinant()<0&&(t*=-1)}s=W.RotationAxisToRef(e,t,ae._RotationAxisCache),s.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)}return this}rotateAround(e,t,i){t.normalize(),this.rotationQuaternion||(this.rotationQuaternion=W.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z),this.rotation.setAll(0));const s=v.Vector3[0],r=v.Vector3[1],n=v.Vector3[2],o=v.Quaternion[0],h=v.Matrix[0],l=v.Matrix[1],c=v.Matrix[2],u=v.Matrix[3];return e.subtractToRef(this.position,s),P.TranslationToRef(s.x,s.y,s.z,h),P.TranslationToRef(-s.x,-s.y,-s.z,l),P.RotationAxisToRef(t,i,c),l.multiplyToRef(c,u),u.multiplyToRef(h,u),u.decompose(r,o,n),this.position.addInPlace(n),o.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion),this}translate(e,t,i){const s=e.scale(t);if(!i||i===0){const r=this.getPositionExpressedInLocalSpace().add(s);this.setPositionWithLocalVector(r)}else this.setAbsolutePosition(this.getAbsolutePosition().add(s));return this}addRotation(e,t,i){let s;this.rotationQuaternion?s=this.rotationQuaternion:(s=v.Quaternion[1],W.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,s));const r=v.Quaternion[0];return W.RotationYawPitchRollToRef(t,e,i,r),s.multiplyInPlace(r),this.rotationQuaternion||s.toEulerAnglesToRef(this.rotation),this}_getEffectiveParent(){return this.parent}isWorldMatrixCameraDependent(){return this._infiniteDistance&&!this.parent||this._billboardMode!==ae.BILLBOARDMODE_NONE}computeWorldMatrix(e=!1,t=null){if(this._isWorldMatrixFrozen&&!this._isDirty)return this._worldMatrix;const i=this.getScene().getRenderId();if(!this._isDirty&&!e&&(this._currentRenderId===i||this.isSynchronized()))return this._currentRenderId=i,this._worldMatrix;t=t||this.getScene().activeCamera,this._updateCache();const s=this._cache;s.pivotMatrixUpdated=!1,s.billboardMode=this.billboardMode,s.infiniteDistance=this.infiniteDistance,s.parent=this._parentNode,this._currentRenderId=i,this._childUpdateId+=1,this._isDirty=!1,this._position._isDirty=!1,this._rotation._isDirty=!1,this._scaling._isDirty=!1;const r=this._getEffectiveParent(),n=ae._TmpScaling;let o=this._position;if(this._infiniteDistance&&!this.parent&&t){const l=t.getWorldMatrix(),c=new _(l.m[12],l.m[13],l.m[14]);o=ae._TmpTranslation,o.copyFromFloats(this._position.x+c.x,this._position.y+c.y,this._position.z+c.z)}n.copyFromFloats(this._scaling.x*this.scalingDeterminant,this._scaling.y*this.scalingDeterminant,this._scaling.z*this.scalingDeterminant);let h;if(this._rotationQuaternion?(this._rotationQuaternion._isDirty=!1,h=this._rotationQuaternion,this.reIntegrateRotationIntoRotationQuaternion&&this.rotation.lengthSquared()&&(this._rotationQuaternion.multiplyInPlace(W.RotationYawPitchRoll(this._rotation.y,this._rotation.x,this._rotation.z)),this._rotation.copyFromFloats(0,0,0))):(h=ae._TmpRotation,W.RotationYawPitchRollToRef(this._rotation.y,this._rotation.x,this._rotation.z,h)),this._usePivotMatrix){const l=v.Matrix[1];P.ScalingToRef(n.x,n.y,n.z,l);const c=v.Matrix[0];h.toRotationMatrix(c),this._pivotMatrix.multiplyToRef(l,v.Matrix[4]),v.Matrix[4].multiplyToRef(c,this._localMatrix),this._postMultiplyPivotMatrix&&this._localMatrix.multiplyToRef(this._pivotMatrixInverse,this._localMatrix),this._localMatrix.addTranslationFromFloats(o.x,o.y,o.z)}else P.ComposeToRef(n,h,o,this._localMatrix);if(r&&r.getWorldMatrix){if(e&&r.computeWorldMatrix(e),this.billboardMode){if(this._transformToBoneReferal){const f=this.parent;f.getSkeleton().prepare(),f.getFinalMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),v.Matrix[7])}else v.Matrix[7].copyFrom(r.getWorldMatrix());const l=v.Vector3[5],c=v.Vector3[6],u=v.Quaternion[0];v.Matrix[7].decompose(c,u,l),P.ScalingToRef(c.x,c.y,c.z,v.Matrix[7]),v.Matrix[7].setTranslation(l),ae.BillboardUseParentOrientation&&(this._position.applyRotationQuaternionToRef(u,l),this._localMatrix.setTranslation(l)),this._localMatrix.multiplyToRef(v.Matrix[7],this._worldMatrix)}else if(this._transformToBoneReferal){const l=this.parent;l.getSkeleton().prepare(),this._localMatrix.multiplyToRef(l.getFinalMatrix(),v.Matrix[6]),v.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),this._worldMatrix)}else this._localMatrix.multiplyToRef(r.getWorldMatrix(),this._worldMatrix);this._markSyncedWithParent()}else this._worldMatrix.copyFrom(this._localMatrix);if(t&&this.billboardMode)if(s.useBillboardPosition){const l=v.Vector3[0];this._worldMatrix.getTranslationToRef(l);const c=t.globalPosition;this._worldMatrix.invertToRef(v.Matrix[1]);const u=v.Vector3[1];_.TransformCoordinatesToRef(c,v.Matrix[1],u),u.normalize();const f=-Math.atan2(u.z,u.x)+Math.PI/2,d=Math.sqrt(u.x*u.x+u.z*u.z),g=-Math.atan2(u.y,d);if(W.RotationYawPitchRollToRef(f,g,0,v.Quaternion[0]),(this.billboardMode&ae.BILLBOARDMODE_ALL)!==ae.BILLBOARDMODE_ALL){const p=v.Vector3[1];v.Quaternion[0].toEulerAnglesToRef(p),(this.billboardMode&ae.BILLBOARDMODE_X)!==ae.BILLBOARDMODE_X&&(p.x=0),(this.billboardMode&ae.BILLBOARDMODE_Y)!==ae.BILLBOARDMODE_Y&&(p.y=0),(this.billboardMode&ae.BILLBOARDMODE_Z)!==ae.BILLBOARDMODE_Z&&(p.z=0),P.RotationYawPitchRollToRef(p.y,p.x,p.z,v.Matrix[0])}else P.FromQuaternionToRef(v.Quaternion[0],v.Matrix[0]);this._worldMatrix.setTranslationFromFloats(0,0,0),this._worldMatrix.multiplyToRef(v.Matrix[0],this._worldMatrix),this._worldMatrix.setTranslation(v.Vector3[0])}else{const l=v.Vector3[0];this._worldMatrix.getTranslationToRef(l),v.Matrix[1].copyFrom(t.getViewMatrix());const c=this.getScene().useRightHandedSystem;if(c&&v.Matrix[1].multiplyToRef(ae._TmpRHRestore,v.Matrix[1]),v.Matrix[1].setTranslationFromFloats(0,0,0),v.Matrix[1].invertToRef(v.Matrix[0]),(this.billboardMode&ae.BILLBOARDMODE_ALL)!==ae.BILLBOARDMODE_ALL){v.Matrix[0].decompose(void 0,v.Quaternion[0],void 0);const u=v.Vector3[1];v.Quaternion[0].toEulerAnglesToRef(u),(this.billboardMode&ae.BILLBOARDMODE_X)!==ae.BILLBOARDMODE_X&&(u.x=0),(this.billboardMode&ae.BILLBOARDMODE_Y)!==ae.BILLBOARDMODE_Y&&(u.y=0),(this.billboardMode&ae.BILLBOARDMODE_Z)!==ae.BILLBOARDMODE_Z&&(u.z=0),c&&(u.y+=Math.PI),P.RotationYawPitchRollToRef(u.y,u.x,u.z,v.Matrix[0])}this._worldMatrix.setTranslationFromFloats(0,0,0),this._worldMatrix.multiplyToRef(v.Matrix[0],this._worldMatrix),this._worldMatrix.setTranslation(v.Vector3[0])}return this.ignoreNonUniformScaling?this._updateNonUniformScalingState(!1):this._scaling.isNonUniformWithinEpsilon(1e-6)?this._updateNonUniformScalingState(!0):r&&r._nonUniformScaling?this._updateNonUniformScalingState(r._nonUniformScaling):this._updateNonUniformScalingState(!1),this._afterComputeWorldMatrix(),this._absolutePosition.copyFromFloats(this._worldMatrix.m[12],this._worldMatrix.m[13],this._worldMatrix.m[14]),this._isAbsoluteSynced=!1,this.onAfterWorldMatrixUpdateObservable.notifyObservers(this),this._poseMatrix||(this._poseMatrix=P.Invert(this._worldMatrix)),this._worldMatrixDeterminantIsDirty=!0,this._worldMatrix}resetLocalMatrix(e=!0){if(this.computeWorldMatrix(),e){const t=this.getChildren();for(let i=0;inew ae(e,this.getScene()),this);if(s.name=e,s.id=e,t&&(s.parent=t),!i){const r=this.getDescendants(!0);for(let n=0;nnew ae(e.name,t),e,t,i);if(e.localMatrix?s.setPreTransformMatrix(P.FromArray(e.localMatrix)):e.pivotMatrix&&s.setPivotMatrix(P.FromArray(e.pivotMatrix)),s.setEnabled(e.isEnabled),s._waitingParsedUniqueId=e.uniqueId,e.parentId!==void 0&&(s._waitingParentId=e.parentId),e.parentInstanceIndex!==void 0&&(s._waitingParentInstanceIndex=e.parentInstanceIndex),e.animations){for(let r=0;r(!t||t(s))&&s instanceof ae),i}dispose(e,t=!1){if(this.getScene().stopAnimation(this),this.getScene().removeTransformNode(this),this._parentContainer){const i=this._parentContainer.transformNodes.indexOf(this);i>-1&&this._parentContainer.transformNodes.splice(i,1),this._parentContainer=null}if(this.onAfterWorldMatrixUpdateObservable.clear(),e){const i=this.getChildTransformNodes(!0);for(const s of i)s.parent=null,s.computeWorldMatrix(!0)}super.dispose(e,t)}normalizeToUnitCube(e=!0,t=!1,i){let s=null,r=null;t&&(this.rotationQuaternion?(r=this.rotationQuaternion.clone(),this.rotationQuaternion.copyFromFloats(0,0,0,1)):this.rotation&&(s=this.rotation.clone(),this.rotation.copyFromFloats(0,0,0)));const n=this.getHierarchyBoundingVectors(e,i),o=n.max.subtract(n.min),h=Math.max(o.x,o.y,o.z);if(h===0)return this;const l=1/h;return this.scaling.scaleInPlace(l),t&&(this.rotationQuaternion&&r?this.rotationQuaternion.copyFrom(r):this.rotation&&s&&this.rotation.copyFrom(s)),this}_syncAbsoluteScalingAndRotation(){this._isAbsoluteSynced||(this._worldMatrix.decompose(this._absoluteScaling,this._absoluteRotationQuaternion),this._isAbsoluteSynced=!0)}}ae.BILLBOARDMODE_NONE=0;ae.BILLBOARDMODE_X=1;ae.BILLBOARDMODE_Y=2;ae.BILLBOARDMODE_Z=4;ae.BILLBOARDMODE_ALL=7;ae.BILLBOARDMODE_USE_POSITION=128;ae.BillboardUseParentOrientation=!1;ae._TmpRotation=W.Zero();ae._TmpScaling=_.Zero();ae._TmpTranslation=_.Zero();ae._TmpRHRestore=P.Scaling(1,1,-1);ae._LookAtVectorCache=new _(0,0,0);ae._RotationAxisCache=new W;T([qt("position")],ae.prototype,"_position",void 0);T([qt("rotation")],ae.prototype,"_rotation",void 0);T([Tl("rotationQuaternion")],ae.prototype,"_rotationQuaternion",void 0);T([qt("scaling")],ae.prototype,"_scaling",void 0);T([R("billboardMode")],ae.prototype,"_billboardMode",void 0);T([R()],ae.prototype,"scalingDeterminant",void 0);T([R("infiniteDistance")],ae.prototype,"_infiniteDistance",void 0);T([R()],ae.prototype,"ignoreNonUniformScaling",void 0);T([R()],ae.prototype,"reIntegrateRotationIntoRotationQuaternion",void 0);class ms{constructor(){this.hit=!1,this.distance=0,this.pickedPoint=null,this.pickedMesh=null,this.bu=0,this.bv=0,this.faceId=-1,this.subMeshFaceId=-1,this.subMeshId=0,this.pickedSprite=null,this.thinInstanceIndex=-1,this.ray=null,this.originMesh=null,this.aimTransform=null,this.gripTransform=null}getNormal(e=!1,t=!0){if(!this.pickedMesh||t&&!this.pickedMesh.isVerticesDataPresent(b.NormalKind))return null;let i=this.pickedMesh.getIndices();i?.length===0&&(i=null);let s;const r=v.Vector3[0],n=v.Vector3[1],o=v.Vector3[2];if(t){const l=this.pickedMesh.getVerticesData(b.NormalKind);let c=i?_.FromArrayToRef(l,i[this.faceId*3]*3,r):r.copyFromFloats(l[this.faceId*3*3],l[this.faceId*3*3+1],l[this.faceId*3*3+2]),u=i?_.FromArrayToRef(l,i[this.faceId*3+1]*3,n):n.copyFromFloats(l[(this.faceId*3+1)*3],l[(this.faceId*3+1)*3+1],l[(this.faceId*3+1)*3+2]),f=i?_.FromArrayToRef(l,i[this.faceId*3+2]*3,o):o.copyFromFloats(l[(this.faceId*3+2)*3],l[(this.faceId*3+2)*3+1],l[(this.faceId*3+2)*3+2]);c=c.scale(this.bu),u=u.scale(this.bv),f=f.scale(1-this.bu-this.bv),s=new _(c.x+u.x+f.x,c.y+u.y+f.y,c.z+u.z+f.z)}else{const l=this.pickedMesh.getVerticesData(b.PositionKind),c=i?_.FromArrayToRef(l,i[this.faceId*3]*3,r):r.copyFromFloats(l[this.faceId*3*3],l[this.faceId*3*3+1],l[this.faceId*3*3+2]),u=i?_.FromArrayToRef(l,i[this.faceId*3+1]*3,n):n.copyFromFloats(l[(this.faceId*3+1)*3],l[(this.faceId*3+1)*3+1],l[(this.faceId*3+1)*3+2]),f=i?_.FromArrayToRef(l,i[this.faceId*3+2]*3,o):o.copyFromFloats(l[(this.faceId*3+2)*3],l[(this.faceId*3+2)*3+1],l[(this.faceId*3+2)*3+2]),d=c.subtract(u),g=f.subtract(u);s=_.Cross(d,g)}const h=(l,c)=>{if(this.thinInstanceIndex!==-1){const f=l.thinInstanceGetWorldMatrices()[this.thinInstanceIndex];f&&_.TransformNormalToRef(c,f,c)}let u=l.getWorldMatrix();l.nonUniformScaling&&(v.Matrix[0].copyFrom(u),u=v.Matrix[0],u.setTranslationFromFloats(0,0,0),u.invert(),u.transposeToRef(v.Matrix[1]),u=v.Matrix[1]),_.TransformNormalToRef(c,u,c)};if(e&&h(this.pickedMesh,s),this.ray){const l=v.Vector3[0].copyFrom(s);e||h(this.pickedMesh,l),_.Dot(l,this.ray.direction)>0&&s.negateInPlace()}return s.normalize(),s}getTextureCoordinates(e=b.UVKind){if(!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(e))return null;const t=this.pickedMesh.getIndices();if(!t)return null;const i=this.pickedMesh.getVerticesData(e);if(!i)return null;let s=Q.FromArray(i,t[this.faceId*3]*2),r=Q.FromArray(i,t[this.faceId*3+1]*2),n=Q.FromArray(i,t[this.faceId*3+2]*2);return s=s.scale(this.bu),r=r.scale(this.bv),n=n.scale(1-this.bu-this.bv),new Q(s.x+r.x+n.x,s.y+r.y+n.y)}}class K{constructor(e,t,i=!1,s,r=!1,n){this._uniformNames=[],this._valueCache={},this._engine=e,this._noUBO=!e.supportsUniformBuffers||r,this._dynamic=i,this._name=s??"no-name",this._data=t||[],this._uniformLocations={},this._uniformSizes={},this._uniformArraySizes={},this._uniformLocationPointer=0,this._needSync=!1,this._trackUBOsInFrame=!1,(n===void 0&&this._engine._features.trackUbosInFrame||n===!0)&&(this._buffers=[],this._bufferIndex=-1,this._bufferUpdatedLastFrame=!1,this._createBufferOnWrite=!1,this._currentFrameId=0,this._trackUBOsInFrame=!0),this._noUBO?(this.updateMatrix3x3=this._updateMatrix3x3ForEffect,this.updateMatrix2x2=this._updateMatrix2x2ForEffect,this.updateFloat=this._updateFloatForEffect,this.updateFloat2=this._updateFloat2ForEffect,this.updateFloat3=this._updateFloat3ForEffect,this.updateFloat4=this._updateFloat4ForEffect,this.updateFloatArray=this._updateFloatArrayForEffect,this.updateArray=this._updateArrayForEffect,this.updateIntArray=this._updateIntArrayForEffect,this.updateUIntArray=this._updateUIntArrayForEffect,this.updateMatrix=this._updateMatrixForEffect,this.updateMatrices=this._updateMatricesForEffect,this.updateVector3=this._updateVector3ForEffect,this.updateVector4=this._updateVector4ForEffect,this.updateColor3=this._updateColor3ForEffect,this.updateColor4=this._updateColor4ForEffect,this.updateDirectColor4=this._updateDirectColor4ForEffect,this.updateInt=this._updateIntForEffect,this.updateInt2=this._updateInt2ForEffect,this.updateInt3=this._updateInt3ForEffect,this.updateInt4=this._updateInt4ForEffect,this.updateUInt=this._updateUIntForEffect,this.updateUInt2=this._updateUInt2ForEffect,this.updateUInt3=this._updateUInt3ForEffect,this.updateUInt4=this._updateUInt4ForEffect):(this._engine._uniformBuffers.push(this),this.updateMatrix3x3=this._updateMatrix3x3ForUniform,this.updateMatrix2x2=this._updateMatrix2x2ForUniform,this.updateFloat=this._updateFloatForUniform,this.updateFloat2=this._updateFloat2ForUniform,this.updateFloat3=this._updateFloat3ForUniform,this.updateFloat4=this._updateFloat4ForUniform,this.updateFloatArray=this._updateFloatArrayForUniform,this.updateArray=this._updateArrayForUniform,this.updateIntArray=this._updateIntArrayForUniform,this.updateUIntArray=this._updateUIntArrayForUniform,this.updateMatrix=this._updateMatrixForUniform,this.updateMatrices=this._updateMatricesForUniform,this.updateVector3=this._updateVector3ForUniform,this.updateVector4=this._updateVector4ForUniform,this.updateColor3=this._updateColor3ForUniform,this.updateColor4=this._updateColor4ForUniform,this.updateDirectColor4=this._updateDirectColor4ForUniform,this.updateInt=this._updateIntForUniform,this.updateInt2=this._updateInt2ForUniform,this.updateInt3=this._updateInt3ForUniform,this.updateInt4=this._updateInt4ForUniform,this.updateUInt=this._updateUIntForUniform,this.updateUInt2=this._updateUInt2ForUniform,this.updateUInt3=this._updateUInt3ForUniform,this.updateUInt4=this._updateUInt4ForUniform)}get useUbo(){return!this._noUBO}get isSync(){return!this._needSync}isDynamic(){return this._dynamic}getData(){return this._bufferData}getBuffer(){return this._buffer}getUniformNames(){return this._uniformNames}_fillAlignment(e){let t;if(e<=2?t=e:t=4,this._uniformLocationPointer%t!==0){const i=this._uniformLocationPointer;this._uniformLocationPointer+=t-this._uniformLocationPointer%t;const s=this._uniformLocationPointer-i;for(let r=0;r0&&typeof t=="number"&&(this._uniformArraySizes[e]={strideSize:t,arraySize:i}),this._uniformLocations[e]!==void 0||(this._uniformNames.push(e),this._noUBO))return;let s;if(i>0){if(t instanceof Array)throw"addUniform should not be use with Array in UBO: "+e;if(this._fillAlignment(4),t==16)t=t*i;else{const n=(4-t)*i;t=t*i+n}s=[];for(let r=0;r1&&this._buffers[this._bufferIndex][1])if(this._buffersEqual(this._bufferData,this._buffers[this._bufferIndex][1])){this._needSync=!1,this._createBufferOnWrite=this._trackUBOsInFrame;return}else this._copyBuffer(this._bufferData,this._buffers[this._bufferIndex][1]);this._bufferUpdatedLastFrame=!0,this._engine.updateUniformBuffer(this._buffer,this._bufferData),this._engine._features._collectUbosUpdatedInFrame&&(K._UpdatedUbosInFrame[this._name]||(K._UpdatedUbosInFrame[this._name]=0),K._UpdatedUbosInFrame[this._name]++),this._needSync=!1,this._createBufferOnWrite=this._trackUBOsInFrame}}_createNewBuffer(){this._bufferIndex+10?(this._buffers.length===1?this._needSync=!this._bufferUpdatedLastFrame:this._needSync=this._bufferIndex!==0,this._bufferIndex=0,this._buffer=this._buffers[this._bufferIndex][0]):this._bufferIndex=-1)}updateUniform(e,t,i){this._checkNewFrame();let s=this._uniformLocations[e];if(s===void 0){if(this._buffer){w.Error("Cannot add an uniform after UBO has been created. uniformName="+e);return}this.addUniform(e,i),s=this._uniformLocations[e]}if(this._buffer||this.create(),this._dynamic)for(let r=0;r1&&this._buffers[t][1]&&this._bufferData.set(this._buffers[t][1]),this._valueCache={},this._currentFrameId=this._engine.frameId,!0;return!1}has(e){return this._uniformLocations[e]!==void 0}dispose(){if(this._noUBO)return;const e=this._engine._uniformBuffers,t=e.indexOf(this);if(t!==-1&&(e[t]=e[e.length-1],e.pop()),this._trackUBOsInFrame&&this._buffers)for(let i=0;is.getPositions();break;case b.NormalKind:i=s=>s.getNormals();break;case b.TangentKind:i=s=>s.getTangents();break;case b.UVKind:i=s=>s.getUVs();break;case b.UV2Kind:i=s=>s.getUV2s();break;case b.ColorKind:i=s=>s.getColors();break;default:return}for(let s=0;s0&&(P.FromFloat32ArrayToRefScaled(t,Math.floor(i[f+d]*16),g,l),h.addToSelf(l));if(r&&n)for(d=0;d<4;d++)g=n[f+d],g>0&&(P.FromFloat32ArrayToRefScaled(t,Math.floor(r[f+d]*16),g,l),h.addToSelf(l));c(a[u],a[u+1],a[u+2],h,o),o.toArray(a,u)}}class Uc{constructor(){this.facetNb=0,this.partitioningSubdivisions=10,this.partitioningBBoxRatio=1.01,this.facetDataEnabled=!1,this.facetParameters={},this.bbSize=_.Zero(),this.subDiv={max:1,X:1,Y:1,Z:1},this.facetDepthSort=!1,this.facetDepthSortEnabled=!1}}class kc{constructor(){this._hasVertexAlpha=!1,this._useVertexColors=!0,this._numBoneInfluencers=4,this._applyFog=!0,this._receiveShadows=!1,this._facetData=new Uc,this._visibility=1,this._skeleton=null,this._layerMask=268435455,this._computeBonesUsingShaders=!0,this._isActive=!1,this._onlyForInstances=!1,this._isActiveIntermediate=!1,this._onlyForInstancesIntermediate=!1,this._actAsRegularMesh=!1,this._currentLOD=new Map,this._collisionRetryCount=3,this._morphTargetManager=null,this._renderingGroupId=0,this._bakedVertexAnimationManager=null,this._material=null,this._positions=null,this._pointerOverDisableMeshTesting=!1,this._meshCollisionData=new Lc,this._enableDistantPicking=!1,this._rawBoundingInfo=null,this._sideOrientationHint=!1,this._wasActiveLastFrame=!1}}class Ct extends ae{static get BILLBOARDMODE_NONE(){return ae.BILLBOARDMODE_NONE}static get BILLBOARDMODE_X(){return ae.BILLBOARDMODE_X}static get BILLBOARDMODE_Y(){return ae.BILLBOARDMODE_Y}static get BILLBOARDMODE_Z(){return ae.BILLBOARDMODE_Z}static get BILLBOARDMODE_ALL(){return ae.BILLBOARDMODE_ALL}static get BILLBOARDMODE_USE_POSITION(){return ae.BILLBOARDMODE_USE_POSITION}get facetNb(){return this._internalAbstractMeshDataInfo._facetData.facetNb}get partitioningSubdivisions(){return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions}set partitioningSubdivisions(e){this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions=e}get partitioningBBoxRatio(){return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio}set partitioningBBoxRatio(e){this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio=e}get mustDepthSortFacets(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSort}set mustDepthSortFacets(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSort=e}get facetDepthSortFrom(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom}set facetDepthSortFrom(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom=e}get collisionRetryCount(){return this._internalAbstractMeshDataInfo._collisionRetryCount}set collisionRetryCount(e){this._internalAbstractMeshDataInfo._collisionRetryCount=e}get isFacetDataEnabled(){return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled}get morphTargetManager(){return this._internalAbstractMeshDataInfo._morphTargetManager}set morphTargetManager(e){this._internalAbstractMeshDataInfo._morphTargetManager!==e&&(this._internalAbstractMeshDataInfo._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())}get bakedVertexAnimationManager(){return this._internalAbstractMeshDataInfo._bakedVertexAnimationManager}set bakedVertexAnimationManager(e){this._internalAbstractMeshDataInfo._bakedVertexAnimationManager!==e&&(this._internalAbstractMeshDataInfo._bakedVertexAnimationManager=e,this._markSubMeshesAsAttributesDirty())}_syncGeometryWithMorphTargetManager(){}_updateNonUniformScalingState(e){return super._updateNonUniformScalingState(e)?(this._markSubMeshesAsMiscDirty(),!0):!1}get rawBoundingInfo(){return this._internalAbstractMeshDataInfo._rawBoundingInfo}set rawBoundingInfo(e){this._internalAbstractMeshDataInfo._rawBoundingInfo=e}set onCollide(e){this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver&&this.onCollideObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver),this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver=this.onCollideObservable.add(e)}set onCollisionPositionChange(e){this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver),this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)}get visibility(){return this._internalAbstractMeshDataInfo._visibility}set visibility(e){if(this._internalAbstractMeshDataInfo._visibility===e)return;const t=this._internalAbstractMeshDataInfo._visibility;this._internalAbstractMeshDataInfo._visibility=e,(t===1&&e!==1||t!==1&&e===1)&&this._markSubMeshesAsDirty(i=>{i.markAsMiscDirty(),i.markAsPrePassDirty()})}get pointerOverDisableMeshTesting(){return this._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting}set pointerOverDisableMeshTesting(e){this._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting=e}get renderingGroupId(){return this._internalAbstractMeshDataInfo._renderingGroupId}set renderingGroupId(e){this._internalAbstractMeshDataInfo._renderingGroupId=e}get material(){return this._internalAbstractMeshDataInfo._material}set material(e){this._setMaterial(e)}_setMaterial(e){this._internalAbstractMeshDataInfo._material!==e&&(this._internalAbstractMeshDataInfo._material&&this._internalAbstractMeshDataInfo._material.meshMap&&(this._internalAbstractMeshDataInfo._material.meshMap[this.uniqueId]=void 0),this._internalAbstractMeshDataInfo._material=e,e&&e.meshMap&&(e.meshMap[this.uniqueId]=this),this.onMaterialChangedObservable.hasObservers()&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&(this.resetDrawCache(void 0,e==null),this._unBindEffect()))}getMaterialForRenderPass(e){return this._internalAbstractMeshDataInfo._materialForRenderPass?.[e]}setMaterialForRenderPass(e,t){this.resetDrawCache(e),this._internalAbstractMeshDataInfo._materialForRenderPass||(this._internalAbstractMeshDataInfo._materialForRenderPass=[]);const i=this._internalAbstractMeshDataInfo._materialForRenderPass[e];i?.meshMap?.[this.uniqueId]&&(i.meshMap[this.uniqueId]=void 0),this._internalAbstractMeshDataInfo._materialForRenderPass[e]=t,t&&t.meshMap&&(t.meshMap[this.uniqueId]=this)}get receiveShadows(){return this._internalAbstractMeshDataInfo._receiveShadows}set receiveShadows(e){this._internalAbstractMeshDataInfo._receiveShadows!==e&&(this._internalAbstractMeshDataInfo._receiveShadows=e,this._markSubMeshesAsLightDirty())}get hasVertexAlpha(){return this._internalAbstractMeshDataInfo._hasVertexAlpha}set hasVertexAlpha(e){this._internalAbstractMeshDataInfo._hasVertexAlpha!==e&&(this._internalAbstractMeshDataInfo._hasVertexAlpha=e,this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())}get useVertexColors(){return this._internalAbstractMeshDataInfo._useVertexColors}set useVertexColors(e){this._internalAbstractMeshDataInfo._useVertexColors!==e&&(this._internalAbstractMeshDataInfo._useVertexColors=e,this._markSubMeshesAsAttributesDirty())}get computeBonesUsingShaders(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders}set computeBonesUsingShaders(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())}get numBoneInfluencers(){return this._internalAbstractMeshDataInfo._numBoneInfluencers}set numBoneInfluencers(e){this._internalAbstractMeshDataInfo._numBoneInfluencers!==e&&(this._internalAbstractMeshDataInfo._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())}get applyFog(){return this._internalAbstractMeshDataInfo._applyFog}set applyFog(e){this._internalAbstractMeshDataInfo._applyFog!==e&&(this._internalAbstractMeshDataInfo._applyFog=e,this._markSubMeshesAsMiscDirty())}get enableDistantPicking(){return this._internalAbstractMeshDataInfo._enableDistantPicking}set enableDistantPicking(e){this._internalAbstractMeshDataInfo._enableDistantPicking=e}get layerMask(){return this._internalAbstractMeshDataInfo._layerMask}set layerMask(e){e!==this._internalAbstractMeshDataInfo._layerMask&&(this._internalAbstractMeshDataInfo._layerMask=e,this._resyncLightSources())}get collisionMask(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask}set collisionMask(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask=isNaN(e)?-1:e}get collisionResponse(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse}set collisionResponse(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse=e}get collisionGroup(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup}set collisionGroup(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup=isNaN(e)?-1:e}get surroundingMeshes(){return this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes}set surroundingMeshes(e){this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes=e}get lightSources(){return this._lightSources}set skeleton(e){const t=this._internalAbstractMeshDataInfo._skeleton;t&&t.needInitialSkinMatrix&&t._unregisterMeshWithPoseMatrix(this),e&&e.needInitialSkinMatrix&&e._registerMeshWithPoseMatrix(this),this._internalAbstractMeshDataInfo._skeleton=e,this._internalAbstractMeshDataInfo._skeleton||(this._bonesTransformMatrices=null),this._markSubMeshesAsAttributesDirty()}get skeleton(){return this._internalAbstractMeshDataInfo._skeleton}constructor(e,t=null){switch(super(e,t,!1),this._internalAbstractMeshDataInfo=new kc,this._waitingMaterialId=null,this._waitingMorphTargetManagerId=null,this.cullingStrategy=Ct.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY,this.onCollideObservable=new O,this.onCollisionPositionChangeObservable=new O,this.onMaterialChangedObservable=new O,this.definedFacingForward=!0,this._occlusionQuery=null,this._renderingGroup=null,this.alphaIndex=Number.MAX_VALUE,this.isPickable=!0,this.isNearPickable=!1,this.isNearGrabbable=!1,this.showSubMeshesBoundingBox=!1,this.isBlocker=!1,this.enablePointerMoveEvents=!1,this.outlineColor=q.Red(),this.outlineWidth=.02,this.overlayColor=q.Red(),this.overlayAlpha=.5,this.useOctreeForRenderingSelection=!0,this.useOctreeForPicking=!0,this.useOctreeForCollisions=!0,this.alwaysSelectAsActiveMesh=!1,this.doNotSyncBoundingInfo=!1,this.actionManager=null,this.ellipsoid=new _(.5,1,.5),this.ellipsoidOffset=new _(0,0,0),this.edgesWidth=1,this.edgesColor=new fe(1,0,0,1),this._edgesRenderer=null,this._masterMesh=null,this._boundingInfo=null,this._boundingInfoIsDirty=!0,this._renderId=0,this._intersectionsInProgress=new Array,this._unIndexed=!1,this._lightSources=new Array,this._waitingData={lods:null,actions:null,freezeWorldMatrix:null},this._bonesTransformMatrices=null,this._transformMatrixTexture=null,this.onRebuildObservable=new O,this._onCollisionPositionChange=(i,s,r=null)=>{s.subtractToRef(this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions,this._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions),this._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions.length()>H.CollisionsEpsilon&&this.position.addInPlace(this._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions),r&&this.onCollideObservable.notifyObservers(r),this.onCollisionPositionChangeObservable.notifyObservers(this.position)},t=this.getScene(),t.addMesh(this),this._resyncLightSources(),this._uniformBuffer=new K(this.getScene().getEngine(),void 0,void 0,e,!this.getScene().getEngine().isWebGPU),this._buildUniformLayout(),t.performancePriority){case 2:this.doNotSyncBoundingInfo=!0;case 1:this.alwaysSelectAsActiveMesh=!0,this.isPickable=!1;break}}_buildUniformLayout(){this._uniformBuffer.addUniform("world",16),this._uniformBuffer.addUniform("visibility",1),this._uniformBuffer.create()}transferToEffect(e){const t=this._uniformBuffer;t.updateMatrix("world",e),t.updateFloat("visibility",this._internalAbstractMeshDataInfo._visibility),t.update()}getMeshUniformBuffer(){return this._uniformBuffer}getClassName(){return"AbstractMesh"}toString(e){let t="Name: "+this.name+", isInstance: "+(this.getClassName()==="InstancedMesh"?"YES":"NO");t+=", # of submeshes: "+(this.subMeshes?this.subMeshes.length:0);const i=this._internalAbstractMeshDataInfo._skeleton;return i&&(t+=", skeleton: "+i.name),e&&(t+=", billboard mode: "+["NONE","X","Y",null,"Z",null,null,"ALL"][this.billboardMode],t+=", freeze wrld mat: "+(this._isWorldMatrixFrozen||this._waitingData.freezeWorldMatrix?"YES":"NO")),t}_getEffectiveParent(){return this._masterMesh&&this.billboardMode!==ae.BILLBOARDMODE_NONE?this._masterMesh:super._getEffectiveParent()}_getActionManagerForTrigger(e,t=!0){if(this.actionManager&&(t||this.actionManager.isRecursive))if(e){if(this.actionManager.hasSpecificTrigger(e))return this.actionManager}else return this.actionManager;return this.parent?this.parent._getActionManagerForTrigger(e,!1):null}_rebuild(e=!1){if(this.onRebuildObservable.notifyObservers(this),this._occlusionQuery!==null&&(this._occlusionQuery=null),!!this.subMeshes){for(const t of this.subMeshes)t._rebuild();this.resetDrawCache()}}_resyncLightSources(){this._lightSources.length=0;for(const e of this.getScene().lights)e.isEnabled()&&e.canAffectMesh(this)&&this._lightSources.push(e);this._markSubMeshesAsLightDirty()}_resyncLightSource(e){const t=e.isEnabled()&&e.canAffectMesh(this),i=this._lightSources.indexOf(e);let s=!1;if(i===-1){if(!t)return;this._lightSources.push(e)}else{if(t)return;s=!0,this._lightSources.splice(i,1)}this._markSubMeshesAsLightDirty(s)}_unBindEffect(){for(const e of this.subMeshes)e.setEffect(null)}_removeLightSource(e,t){const i=this._lightSources.indexOf(e);i!==-1&&(this._lightSources.splice(i,1),this._markSubMeshesAsLightDirty(t))}_markSubMeshesAsDirty(e){if(this.subMeshes)for(const t of this.subMeshes)for(let i=0;it.markAsLightDirty(e))}_markSubMeshesAsAttributesDirty(){this._markSubMeshesAsDirty(e=>e.markAsAttributesDirty())}_markSubMeshesAsMiscDirty(){this._markSubMeshesAsDirty(e=>e.markAsMiscDirty())}markAsDirty(e){return this._currentRenderId=Number.MAX_VALUE,super.markAsDirty(e),this._isDirty=!0,this}resetDrawCache(e,t=!1){if(this.subMeshes)for(const i of this.subMeshes)i.resetDrawCache(e,t)}get isBlocked(){return!1}getLOD(e){return this}getTotalVertices(){return 0}getTotalIndices(){return 0}getIndices(){return null}getVerticesData(e){return null}setVerticesData(e,t,i,s){return this}updateVerticesData(e,t,i,s){return this}setIndices(e,t){return this}isVerticesDataPresent(e){return!1}getBoundingInfo(){return this._masterMesh?this._masterMesh.getBoundingInfo():(this._boundingInfoIsDirty&&(this._boundingInfoIsDirty=!1,this._updateBoundingInfo()),this._boundingInfo)}getRawBoundingInfo(){return this.rawBoundingInfo??this.getBoundingInfo()}setBoundingInfo(e){return this._boundingInfo=e,this}get hasBoundingInfo(){return this._boundingInfo!==null}buildBoundingInfo(e,t,i){return this._boundingInfo=new Lt(e,t,i),this._boundingInfo}normalizeToUnitCube(e=!0,t=!1,i){return super.normalizeToUnitCube(e,t,i)}get useBones(){return this.skeleton&&this.getScene().skeletonsEnabled&&this.isVerticesDataPresent(b.MatricesIndicesKind)&&this.isVerticesDataPresent(b.MatricesWeightsKind)}_preActivate(){}_preActivateForIntermediateRendering(e){}_activate(e,t){return this._renderId=e,!0}_postActivate(){}_freeze(){}_unFreeze(){}getWorldMatrix(){return this._masterMesh&&this.billboardMode===ae.BILLBOARDMODE_NONE?this._masterMesh.getWorldMatrix():super.getWorldMatrix()}_getWorldMatrixDeterminant(){return this._masterMesh?this._masterMesh._getWorldMatrixDeterminant():super._getWorldMatrixDeterminant()}get isAnInstance(){return!1}get hasInstances(){return!1}get hasThinInstances(){return!1}movePOV(e,t,i){return this.position.addInPlace(this.calcMovePOV(e,t,i)),this}calcMovePOV(e,t,i){const s=new P;(this.rotationQuaternion?this.rotationQuaternion:W.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z)).toRotationMatrix(s);const n=_.Zero(),o=this.definedFacingForward?-1:1;return _.TransformCoordinatesFromFloatsToRef(e*o,t,i*o,s,n),n}rotatePOV(e,t,i){return this.rotation.addInPlace(this.calcRotatePOV(e,t,i)),this}calcRotatePOV(e,t,i){const s=this.definedFacingForward?1:-1;return new _(e*s,t,i*s)}_refreshBoundingInfo(e,t){if(e){const i=Wo(e,0,this.getTotalVertices(),t);this._boundingInfo?this._boundingInfo.reConstruct(i.minimum,i.maximum):this._boundingInfo=new Lt(i.minimum,i.maximum)}if(this.subMeshes)for(let i=0;i{if(s){const o=s._vertexData||(s._vertexData={});return o[n]||this.copyVerticesData(n,o),o[n]}return this.getVerticesData(n)};if(t||(t=r(i)),!t)return null;if(s?(s._outputData?s._outputData.set(t):s._outputData=new Float32Array(t),t=s._outputData):(e.applyMorph&&this.morphTargetManager||e.applySkeleton&&this.skeleton)&&(t=t.slice()),e.applyMorph&&this.morphTargetManager&&Bc(t,i,this.morphTargetManager),e.applySkeleton&&this.skeleton){const n=r(b.MatricesIndicesKind),o=r(b.MatricesWeightsKind);if(o&&n){const h=this.numBoneInfluencers>4,l=h?r(b.MatricesIndicesExtraKind):null,c=h?r(b.MatricesWeightsExtraKind):null,u=this.skeleton.getTransformMatrices(this);Ct._ApplySkeleton(t,i,u,n,o,l,c)}}if(e.updatePositionsArray!==!1&&i===b.PositionKind){const n=this._internalAbstractMeshDataInfo._positions||[],o=n.length;if(n.length=t.length/3,o1||!s.IsGlobal)&&s.updateBoundingInfo(e)}return this}_afterComputeWorldMatrix(){this.doNotSyncBoundingInfo||(this._boundingInfoIsDirty=!0)}isInFrustum(e){return this.getBoundingInfo().isInFrustum(e,this.cullingStrategy)}isCompletelyInFrustum(e){return this.getBoundingInfo().isCompletelyInFrustum(e)}intersectsMesh(e,t=!1,i){const s=this.getBoundingInfo(),r=e.getBoundingInfo();if(s.intersects(r,t))return!0;if(i){for(const n of this.getChildMeshes())if(n.intersectsMesh(e,t,!0))return!0}return!1}intersectsPoint(e){return this.getBoundingInfo().intersectsPoint(e)}get checkCollisions(){return this._internalAbstractMeshDataInfo._meshCollisionData._checkCollisions}set checkCollisions(e){this._internalAbstractMeshDataInfo._meshCollisionData._checkCollisions=e}get collider(){return this._internalAbstractMeshDataInfo._meshCollisionData._collider}moveWithCollisions(e,t=!0){this.getAbsolutePosition().addToRef(this.ellipsoidOffset,this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions);const s=this.getScene().collisionCoordinator;return this._internalAbstractMeshDataInfo._meshCollisionData._collider||(this._internalAbstractMeshDataInfo._meshCollisionData._collider=s.createCollider()),this._internalAbstractMeshDataInfo._meshCollisionData._collider._radius=this.ellipsoid,s.getNewPosition(this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions,e,this._internalAbstractMeshDataInfo._meshCollisionData._collider,this.collisionRetryCount,this,this._onCollisionPositionChange,this.uniqueId,t),this}_collideForSubMesh(e,t,i){if(this._generatePointsArray(),!this._positions)return this;if(!e._lastColliderWorldVertices||!e._lastColliderTransformMatrix.equals(t)){e._lastColliderTransformMatrix=t.clone(),e._lastColliderWorldVertices=[],e._trianglePlanes=[];const s=e.verticesStart,r=e.verticesStart+e.verticesCount;for(let n=s;n1&&!n._checkCollision(e)||this._collideForSubMesh(n,t,e)}return this}_shouldConvertRHS(){return!1}_checkCollision(e){if(!this.getBoundingInfo()._checkCollision(e))return this;const t=v.Matrix[0],i=v.Matrix[1];return P.ScalingToRef(1/e._radius.x,1/e._radius.y,1/e._radius.z,t),this.worldMatrixFromCache.multiplyToRef(t,i),this._processCollisionsForSubMeshes(e,i),this}_generatePointsArray(){return!1}intersects(e,t,i,s=!1,r,n=!1){const o=new ms,h=this.getClassName(),l=h==="InstancedLinesMesh"||h==="LinesMesh"||h==="GreasedLineMesh"?this.intersectionThreshold:0,c=this.getBoundingInfo();if(!this.subMeshes||!n&&(!e.intersectsSphere(c.boundingSphere,l)||!e.intersectsBox(c.boundingBox,l)))return o;if(s)return o.hit=!n,o.pickedMesh=n?null:this,o.distance=n?0:_.Distance(e.origin,c.boundingSphere.center),o.subMeshId=0,o;if(!this._generatePointsArray())return o;let u=null;const f=this._scene.getIntersectingSubMeshCandidates(this,e),d=f.length;let g=!1;for(let p=0;p1&&!n&&!m.canIntersects(e))continue;const A=m.intersects(e,this._positions,this.getIndices(),t,i);if(A&&(t||!u||A.distanceo!==this&&o.actionManager===this.actionManager)&&this.actionManager.dispose(),this.actionManager=null),this._internalAbstractMeshDataInfo._skeleton=null,this._transformMatrixTexture&&(this._transformMatrixTexture.dispose(),this._transformMatrixTexture=null),i=0;i-1&&this._parentContainer.meshes.splice(o,1),this._parentContainer=null}if(t&&this.material&&(this.material.getClassName()==="MultiMaterial"?this.material.dispose(!1,!0,!0):this.material.dispose(!1,!0)),!e)for(i=0;i65535){o=!0;break}o?e.depthSortedIndices=new Uint32Array(i):e.depthSortedIndices=new Uint16Array(i)}if(e.facetDepthSortFunction=function(o,h){return h.sqDistance-o.sqDistance},!e.facetDepthSortFrom){const o=this.getScene().activeCamera;e.facetDepthSortFrom=o?o.position:_.Zero()}e.depthSortedFacets=[];for(let o=0;oMe?r.maximum.x-r.minimum.x:Me,e.bbSize.y=r.maximum.y-r.minimum.y>Me?r.maximum.y-r.minimum.y:Me,e.bbSize.z=r.maximum.z-r.minimum.z>Me?r.maximum.z-r.minimum.z:Me;let n=e.bbSize.x>e.bbSize.y?e.bbSize.x:e.bbSize.y;if(n=n>e.bbSize.z?n:e.bbSize.z,e.subDiv.max=e.partitioningSubdivisions,e.subDiv.X=Math.floor(e.subDiv.max*e.bbSize.x/n),e.subDiv.Y=Math.floor(e.subDiv.max*e.bbSize.y/n),e.subDiv.Z=Math.floor(e.subDiv.max*e.bbSize.z/n),e.subDiv.X=e.subDiv.X<1?1:e.subDiv.X,e.subDiv.Y=e.subDiv.Y<1?1:e.subDiv.Y,e.subDiv.Z=e.subDiv.Z<1?1:e.subDiv.Z,e.facetParameters.facetNormals=this.getFacetLocalNormals(),e.facetParameters.facetPositions=this.getFacetLocalPositions(),e.facetParameters.facetPartitioning=this.getFacetLocalPartitioning(),e.facetParameters.bInfo=r,e.facetParameters.bbSize=e.bbSize,e.facetParameters.subDiv=e.subDiv,e.facetParameters.ratio=this.partitioningBBoxRatio,e.facetParameters.depthSort=e.facetDepthSort,e.facetDepthSort&&e.facetDepthSortEnabled&&(this.computeWorldMatrix(!0),this._worldMatrix.invertToRef(e.invertedMatrix),_.TransformCoordinatesToRef(e.facetDepthSortFrom,e.invertedMatrix,e.facetDepthSortOrigin),e.facetParameters.distanceTo=e.facetDepthSortOrigin),e.facetParameters.depthSortedFacets=e.depthSortedFacets,s&&$.ComputeNormals(t,i,s,e.facetParameters),e.facetDepthSort&&e.facetDepthSortEnabled){e.depthSortedFacets.sort(e.facetDepthSortFunction);const o=e.depthSortedIndices.length/3|0;for(let h=0;hr.subDiv.max||o<0||o>r.subDiv.max||h<0||h>r.subDiv.max?null:r.facetPartitioning[n+r.subDiv.max*o+r.subDiv.max*r.subDiv.max*h]}getClosestFacetAtCoordinates(e,t,i,s,r=!1,n=!0){const o=this.getWorldMatrix(),h=v.Matrix[5];o.invertToRef(h);const l=v.Vector3[8];_.TransformCoordinatesFromFloatsToRef(e,t,i,h,l);const c=this.getClosestFacetAtLocalCoordinates(l.x,l.y,l.z,s,r,n);return s&&_.TransformCoordinatesFromFloatsToRef(s.x,s.y,s.z,o,s),c}getClosestFacetAtLocalCoordinates(e,t,i,s,r=!1,n=!0){let o=null,h=0,l=0,c=0,u=0,f=0,d=0,g=0,p=0;const m=this.getFacetLocalPositions(),A=this.getFacetLocalNormals(),E=this.getFacetsAtLocalCoordinates(e,t,i);if(!E)return null;let I=Number.MAX_VALUE,M=I,C,x,S;for(let L=0;L=0||r&&!n&&u<=0)&&(u=x.x*S.x+x.y*S.y+x.z*S.z,f=-(x.x*e+x.y*t+x.z*i-u)/(x.x*x.x+x.y*x.y+x.z*x.z),d=e+x.x*f,g=t+x.y*f,p=i+x.z*f,h=d-e,l=g-t,c=p-i,M=h*h+l*l+c*c,M{const{OptimizeIndices:i}=await import("./mesh.vertexData.functions-ayNlGC5K.js");return{OptimizeIndices:i}},[],import.meta.url);return t(e),this.setIndices(e,this.getTotalVertices()),this}alignWithNormal(e,t){t||(t=ts.Y);const i=v.Vector3[0],s=v.Vector3[1];return _.CrossToRef(t,e,s),_.CrossToRef(e,s,i),this.rotationQuaternion?W.RotationQuaternionFromAxisToRef(i,e,s,this.rotationQuaternion):_.RotationFromAxisToRef(i,e,s,this.rotation),this}_checkOcclusionQuery(){return!1}disableEdgesRendering(){throw ie("EdgesRenderer")}enableEdgesRendering(e,t,i){throw ie("EdgesRenderer")}getConnectedParticleSystems(){return this._scene.particleSystems.filter(e=>e.emitter===this)}}Ct.OCCLUSION_TYPE_NONE=0;Ct.OCCLUSION_TYPE_OPTIMISTIC=1;Ct.OCCLUSION_TYPE_STRICT=2;Ct.OCCLUSION_ALGORITHM_TYPE_ACCURATE=0;Ct.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE=1;Ct.CULLINGSTRATEGY_STANDARD=0;Ct.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=1;Ct.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION=2;Ct.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY=3;T([yi.filter((...[a,e,t,i,s])=>!Array.isArray(a)&&!Array.isArray(e)&&!Array.isArray(t)&&!Array.isArray(i)&&!Array.isArray(s))],Ct,"_ApplySkeleton",null);nt("BABYLON.AbstractMesh",Ct);class Bt{constructor(){this.reset()}reset(){this.enabled=!1,this.mask=255,this.funcRef=1,this.funcMask=255,this.func=519,this.opStencilFail=7680,this.opDepthFail=7680,this.opStencilDepthPass=7681,this.backFunc=519,this.backOpStencilFail=7680,this.backOpDepthFail=7680,this.backOpStencilDepthPass=7681}get func(){return this._func}set func(e){this._func=e}get backFunc(){return this._backFunc}set backFunc(e){this._backFunc=e}get funcRef(){return this._funcRef}set funcRef(e){this._funcRef=e}get funcMask(){return this._funcMask}set funcMask(e){this._funcMask=e}get opStencilFail(){return this._opStencilFail}set opStencilFail(e){this._opStencilFail=e}get opDepthFail(){return this._opDepthFail}set opDepthFail(e){this._opDepthFail=e}get opStencilDepthPass(){return this._opStencilDepthPass}set opStencilDepthPass(e){this._opStencilDepthPass=e}get backOpStencilFail(){return this._backOpStencilFail}set backOpStencilFail(e){this._backOpStencilFail=e}get backOpDepthFail(){return this._backOpDepthFail}set backOpDepthFail(e){this._backOpDepthFail=e}get backOpStencilDepthPass(){return this._backOpStencilDepthPass}set backOpStencilDepthPass(e){this._backOpStencilDepthPass=e}get mask(){return this._mask}set mask(e){this._mask=e}get enabled(){return this._enabled}set enabled(e){this._enabled=e}getClassName(){return"MaterialStencilState"}copyTo(e){le.Clone(()=>e,this)}serialize(){return le.Serialize(this)}parse(e,t,i){le.Parse(()=>this,e,t,i)}}T([R()],Bt.prototype,"func",null);T([R()],Bt.prototype,"backFunc",null);T([R()],Bt.prototype,"funcRef",null);T([R()],Bt.prototype,"funcMask",null);T([R()],Bt.prototype,"opStencilFail",null);T([R()],Bt.prototype,"opDepthFail",null);T([R()],Bt.prototype,"opStencilDepthPass",null);T([R()],Bt.prototype,"backOpStencilFail",null);T([R()],Bt.prototype,"backOpDepthFail",null);T([R()],Bt.prototype,"backOpStencilDepthPass",null);T([R()],Bt.prototype,"mask",null);T([R()],Bt.prototype,"enabled",null);class Ee{static CompareLightsPriority(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority}}Ee.FALLOFF_DEFAULT=0;Ee.FALLOFF_PHYSICAL=1;Ee.FALLOFF_GLTF=2;Ee.FALLOFF_STANDARD=3;Ee.LIGHTMAP_DEFAULT=0;Ee.LIGHTMAP_SPECULAR=1;Ee.LIGHTMAP_SHADOWSONLY=2;Ee.INTENSITYMODE_AUTOMATIC=0;Ee.INTENSITYMODE_LUMINOUSPOWER=1;Ee.INTENSITYMODE_LUMINOUSINTENSITY=2;Ee.INTENSITYMODE_ILLUMINANCE=3;Ee.INTENSITYMODE_LUMINANCE=4;Ee.LIGHTTYPEID_POINTLIGHT=0;Ee.LIGHTTYPEID_DIRECTIONALLIGHT=1;Ee.LIGHTTYPEID_SPOTLIGHT=2;Ee.LIGHTTYPEID_HEMISPHERICLIGHT=3;Ee.LIGHTTYPEID_RECT_AREALIGHT=4;Ee.LIGHTTYPEID_CLUSTERED_CONTAINER=5;const Nt=new P,Wt=new P,Xt=new P,Gr={getScene:()=>{},eyeAtCamera:!0};function zs(a,e,t){const i=t.asArray(),s=e.asArray();for(let r=0;r<16;r++)i[r]=s[r];return i[12]-=a.x,i[13]-=a.y,i[14]-=a.z,t.markAsUpdated(),t}function Xo(a,e,t){return xr(e,Wt),zs(a,Wt,Xt),xr(Xt,t),t}function Or(a,e,t){if(!Gr.eyeAtCamera)return Xo(a,e,t);const i=t.asArray(),s=e.asArray();for(let r=0;r<16;r++)i[r]=s[r];return i[12]=0,i[13]=0,i[14]=0,t.markAsUpdated(),t}function bn(a,e,t,i){return gs(Or(a,e,i),t,i),i}function g_(a,e,t,i,s){for(let r=0;rt.hasTexture(this)))}get hasAlpha(){return this._hasAlpha}set getAlphaFromRGB(e){this._getAlphaFromRGB!==e&&(this._getAlphaFromRGB=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,t=>t.hasTexture(this)))}get getAlphaFromRGB(){return this._getAlphaFromRGB}set coordinatesIndex(e){this._coordinatesIndex!==e&&(this._coordinatesIndex=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,t=>t.hasTexture(this)))}get coordinatesIndex(){return this._coordinatesIndex}set coordinatesMode(e){this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,t=>t.hasTexture(this)))}get coordinatesMode(){return this._coordinatesMode}get wrapU(){return this._wrapU}set wrapU(e){this._wrapU=e}get wrapV(){return this._wrapV}set wrapV(e){this._wrapV=e}get isCube(){return this._texture?this._texture.isCube:this._isCube}set isCube(e){this._texture?this._texture.isCube=e:this._isCube=e}get is3D(){return this._texture?this._texture.is3D:!1}set is3D(e){this._texture&&(this._texture.is3D=e)}get is2DArray(){return this._texture?this._texture.is2DArray:!1}set is2DArray(e){this._texture&&(this._texture.is2DArray=e)}get gammaSpace(){if(this._texture)this._texture._gammaSpace===null&&(this._texture._gammaSpace=this._gammaSpace);else return this._gammaSpace;return this._texture._gammaSpace&&!this._texture._useSRGBBuffer}set gammaSpace(e){if(this._texture){if(this._texture._gammaSpace===e)return;this._texture._gammaSpace=e}else{if(this._gammaSpace===e)return;this._gammaSpace=e}this.getScene()?.markAllMaterialsAsDirty(1,t=>t.hasTexture(this))}get isRGBD(){return this._texture!=null&&this._texture._isRGBD}set isRGBD(e){e!==this.isRGBD&&(this._texture&&(this._texture._isRGBD=e),this.getScene()?.markAllMaterialsAsDirty(1,t=>t.hasTexture(this)))}get noMipmap(){return!1}get lodGenerationOffset(){return this._texture?this._texture._lodGenerationOffset:0}set lodGenerationOffset(e){this._texture&&(this._texture._lodGenerationOffset=e)}get lodGenerationScale(){return this._texture?this._texture._lodGenerationScale:0}set lodGenerationScale(e){this._texture&&(this._texture._lodGenerationScale=e)}get linearSpecularLOD(){return this._texture?this._texture._linearSpecularLOD:!1}set linearSpecularLOD(e){this._texture&&(this._texture._linearSpecularLOD=e)}get irradianceTexture(){return this._texture?this._texture._irradianceTexture:null}set irradianceTexture(e){this._texture&&(this._texture._irradianceTexture=e)}get uid(){return this._uid||(this._uid=Bn()),this._uid}toString(){return this.name}getClassName(){return"BaseTexture"}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get isBlocking(){return!0}get loadingError(){return this._loadingError}get errorObject(){return this._errorObject}constructor(e,t=null){super(null),this.metadata=null,this.reservedDataStore=null,this._hasAlpha=!1,this._getAlphaFromRGB=!1,this.level=1,this._coordinatesIndex=0,this.optimizeUVAllocation=!0,this._coordinatesMode=0,this.wrapR=1,this.anisotropicFilteringLevel=De.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,this._isCube=!1,this._gammaSpace=!0,this.invertZ=!1,this.lodLevelInAlpha=!1,this._dominantDirection=null,this.isRenderTarget=!1,this._prefiltered=!1,this._forceSerialize=!1,this.animations=[],this.onDisposeObservable=new O,this._onDisposeObserver=null,this._scene=null,this._uid=null,this._parentContainer=null,this._loadingError=!1,e?De._IsScene(e)?this._scene=e:this._engine=e:this._scene=Te.LastCreatedScene,this._scene&&(this.uniqueId=this._scene.getUniqueId(),this._scene.addTexture(this),this._engine=this._scene.getEngine()),this._texture=t,this._uid=null}getScene(){return this._scene}_getEngine(){return this._engine}getTextureMatrix(){return P.IdentityReadOnly}getReflectionTextureMatrix(){return P.IdentityReadOnly}getRefractionTextureMatrix(){return this.getReflectionTextureMatrix()}isReadyOrNotBlocking(){return!this.isBlocking||this.isReady()||this.loadingError}scale(e){}get canRescale(){return!1}_getFromCache(e,t,i,s,r,n){const o=this._getEngine();if(!o)return null;const h=o._getUseSRGBBuffer(!!r,t),l=o.getLoadedTexturesCache();for(let c=0;c=0&&this._scene.textures.splice(e,1),this._scene.onTextureRemovedObservable.notifyObservers(this),this._scene=null,this._parentContainer){const t=this._parentContainer.textures.indexOf(this);t>-1&&this._parentContainer.textures.splice(t,1),this._parentContainer=null}}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.metadata=null,super.dispose()}serialize(e=!1){if(!this.name&&!e)return null;const t=le.Serialize(this);return le.AppendSerializedAnimations(this,t),t}static WhenAllReady(e,t){let i=e.length;if(i===0){t();return}for(let s=0;s{--i===0&&t()}):--i===0&&t()}}}static _IsScene(e){return e.getClassName()==="Scene"}}De.DEFAULT_ANISOTROPIC_FILTERING_LEVEL=4;T([R()],De.prototype,"uniqueId",void 0);T([R()],De.prototype,"name",void 0);T([R()],De.prototype,"displayName",void 0);T([R()],De.prototype,"metadata",void 0);T([R("hasAlpha")],De.prototype,"_hasAlpha",void 0);T([R("getAlphaFromRGB")],De.prototype,"_getAlphaFromRGB",void 0);T([R()],De.prototype,"level",void 0);T([R("coordinatesIndex")],De.prototype,"_coordinatesIndex",void 0);T([R()],De.prototype,"optimizeUVAllocation",void 0);T([R("coordinatesMode")],De.prototype,"_coordinatesMode",void 0);T([R()],De.prototype,"wrapU",null);T([R()],De.prototype,"wrapV",null);T([R()],De.prototype,"wrapR",void 0);T([R()],De.prototype,"anisotropicFilteringLevel",void 0);T([R()],De.prototype,"isCube",null);T([R()],De.prototype,"is3D",null);T([R()],De.prototype,"is2DArray",null);T([R()],De.prototype,"gammaSpace",null);T([R()],De.prototype,"invertZ",void 0);T([R()],De.prototype,"lodLevelInAlpha",void 0);T([R()],De.prototype,"lodGenerationOffset",null);T([R()],De.prototype,"lodGenerationScale",null);T([R()],De.prototype,"linearSpecularLOD",null);T([Oe()],De.prototype,"irradianceTexture",null);T([R()],De.prototype,"isRenderTarget",void 0);function Qo(a,e,t=!1){const i=e.width,s=e.height;if(a instanceof Float32Array){let l=a.byteLength/a.BYTES_PER_ELEMENT;const c=new Uint8Array(l);for(;--l>=0;){let u=a[l];u<0?u=0:u>1&&(u=1),c[l]=u*255}a=c}const r=document.createElement("canvas");r.width=i,r.height=s;const n=r.getContext("2d");if(!n)return null;const o=n.createImageData(i,s);if(o.data.set(a),n.putImageData(o,0,0),t){const l=document.createElement("canvas");l.width=i,l.height=s;const c=l.getContext("2d");return c?(c.translate(0,s),c.scale(1,-1),c.drawImage(r,0,0),l.toDataURL("image/png")):null}return r.toDataURL("image/png")}function Wc(a,e=0,t=0){const i=a.getInternalTexture();if(!i)return null;const s=a._readPixelsSync(e,t);return s?Qo(s,a.getSize(),i.invertY):null}async function Xc(a,e=0,t=0){const i=a.getInternalTexture();if(!i)return null;const s=await a.readPixels(e,t);return s?Qo(s,a.getSize(),i.invertY):null}class z extends De{static _CreateVideoTexture(e,t,i,s=!1,r=!1,n=z.TRILINEAR_SAMPLINGMODE,o={},h,l=5){throw ie("VideoTexture")}get noMipmap(){return this._noMipmap}get mimeType(){return this._mimeType}set isBlocking(e){this._isBlocking=e}get isBlocking(){return this._isBlocking}get invertY(){return this._invertY}constructor(e,t,i,s,r=z.TRILINEAR_SAMPLINGMODE,n=null,o=null,h=null,l=!1,c,u,f,d,g){super(t),this.url=null,this.uOffset=0,this.vOffset=0,this.uScale=1,this.vScale=1,this.uAng=0,this.vAng=0,this.wAng=0,this.uRotationCenter=.5,this.vRotationCenter=.5,this.wRotationCenter=.5,this.homogeneousRotationInUVTransform=!1,this.inspectableCustomProperties=null,this._noMipmap=!1,this._invertY=!1,this._rowGenerationMatrix=null,this._cachedTextureMatrix=null,this._projectionModeMatrix=null,this._t0=null,this._t1=null,this._t2=null,this._cachedUOffset=-1,this._cachedVOffset=-1,this._cachedUScale=0,this._cachedVScale=0,this._cachedUAng=-1,this._cachedVAng=-1,this._cachedWAng=-1,this._cachedReflectionProjectionMatrixId=-1,this._cachedURotationCenter=-1,this._cachedVRotationCenter=-1,this._cachedWRotationCenter=-1,this._cachedHomogeneousRotationInUVTransform=!1,this._cachedIdentity3x2=!0,this._cachedReflectionTextureMatrix=null,this._cachedReflectionUOffset=-1,this._cachedReflectionVOffset=-1,this._cachedReflectionUScale=0,this._cachedReflectionVScale=0,this._cachedReflectionCoordinatesMode=-1,this._buffer=null,this._deleteBuffer=!1,this._format=null,this._delayedOnLoad=null,this._delayedOnError=null,this.onLoadObservable=new O,this._isBlocking=!0,this.name=e||"",this.url=e;let p,m=!1,A=null,E=!0;typeof i=="object"&&i!==null?(p=i.noMipmap??!1,s=i.invertY??!0,r=i.samplingMode??z.TRILINEAR_SAMPLINGMODE,n=i.onLoad??null,o=i.onError??null,h=i.buffer??null,l=i.deleteBuffer??!1,c=i.format,u=i.mimeType,f=i.loaderOptions,d=i.creationFlags,m=i.useSRGBBuffer??!1,A=i.internalTexture??null,E=i.gammaSpace??E,g=i.forcedExtension??g):p=!!i,this._gammaSpace=E,this._noMipmap=p,this._invertY=s===void 0?!0:s,this._initialSamplingMode=r,this._buffer=h,this._deleteBuffer=l,this._mimeType=u,this._loaderOptions=f,this._creationFlags=d,this._useSRGBBuffer=m,this._forcedExtension=g,c!==void 0&&(this._format=c);const I=this.getScene(),M=this._getEngine();if(!M)return;M.onBeforeTextureInitObservable.notifyObservers(this);const C=()=>{this._texture&&(this._texture._invertVScale&&(this.vScale*=-1,this.vOffset+=1),this._texture._cachedWrapU!==null&&(this.wrapU=this._texture._cachedWrapU,this._texture._cachedWrapU=null),this._texture._cachedWrapV!==null&&(this.wrapV=this._texture._cachedWrapV,this._texture._cachedWrapV=null),this._texture._cachedWrapR!==null&&(this.wrapR=this._texture._cachedWrapR,this._texture._cachedWrapR=null)),this.onLoadObservable.hasObservers()&&this.onLoadObservable.notifyObservers(this),n&&n(),!this.isBlocking&&I&&I.resetCachedMaterial()},x=(S,L)=>{this._loadingError=!0,this._errorObject={message:S,exception:L},o&&o(S,L),z.OnTextureLoadErrorObservable.notifyObservers(this)};if(!this.url&&!A){this._delayedOnLoad=C,this._delayedOnError=x;return}if(this._texture=A??this._getFromCache(this.url,p,r,this._invertY,m,this.isCube),this._texture)if(this._texture.isReady)ks.SetImmediate(()=>C());else{const S=this._texture.onLoadedObservable.add(C);this._texture.onErrorObservable.add(L=>{x(L.message,L.exception),this._texture?.onLoadedObservable.remove(S)})}else if(!I||!I.useDelayedTextureLoading){try{this._texture=M.createTexture(this.url,p,this._invertY,I,r,C,x,this._buffer,void 0,this._format,this._forcedExtension,u,f,d,m)}catch(S){throw x("error loading",S),S}l&&(this._buffer=null)}else this.delayLoadState=4,this._delayedOnLoad=C,this._delayedOnError=x}updateURL(e,t=null,i,s){this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(1,o=>o.hasTexture(this))),(!this.name||this.name.startsWith("data:"))&&(this.name=e),this.url=e,this._buffer=t,this._forcedExtension=s,this.delayLoadState=4;const r=this._delayedOnLoad,n=()=>{r?r():this.onLoadObservable.hasObservers()&&this.onLoadObservable.notifyObservers(this),i&&i()};this._delayedOnLoad=n,this.delayLoad()}delayLoad(){if(this.delayLoadState!==4)return;const e=this.getScene();if(!e)return;let t=this.url;!t&&(this.name.indexOf("://")>0||this.name.startsWith("data:"))&&(t=this.name),this.delayLoadState=1,this._texture=this._getFromCache(t,this._noMipmap,this.samplingMode,this._invertY,this._useSRGBBuffer,this.isCube),this._texture?this._delayedOnLoad&&(this._texture.isReady?ks.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(t,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format,this._forcedExtension,this._mimeType,this._loaderOptions,this._creationFlags,this._useSRGBBuffer),this._deleteBuffer&&(this._buffer=null)),this._delayedOnLoad=null,this._delayedOnError=null}_prepareRowForTextureGeneration(e,t,i,s){e*=this._cachedUScale,t*=this._cachedVScale,e-=this.uRotationCenter*this._cachedUScale,t-=this.vRotationCenter*this._cachedVScale,i-=this.wRotationCenter,_.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,s),s.x+=this.uRotationCenter*this._cachedUScale+this._cachedUOffset,s.y+=this.vRotationCenter*this._cachedVScale+this._cachedVOffset,s.z+=this.wRotationCenter}getTextureMatrix(e=1){if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale*e===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng&&this.uRotationCenter===this._cachedURotationCenter&&this.vRotationCenter===this._cachedVRotationCenter&&this.wRotationCenter===this._cachedWRotationCenter&&this.homogeneousRotationInUVTransform===this._cachedHomogeneousRotationInUVTransform)return this._cachedTextureMatrix;this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale*e,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedURotationCenter=this.uRotationCenter,this._cachedVRotationCenter=this.vRotationCenter,this._cachedWRotationCenter=this.wRotationCenter,this._cachedHomogeneousRotationInUVTransform=this.homogeneousRotationInUVTransform,(!this._cachedTextureMatrix||!this._rowGenerationMatrix)&&(this._cachedTextureMatrix=P.Zero(),this._rowGenerationMatrix=new P,this._t0=_.Zero(),this._t1=_.Zero(),this._t2=_.Zero()),P.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this.homogeneousRotationInUVTransform?(P.TranslationToRef(-this._cachedURotationCenter,-this._cachedVRotationCenter,-this._cachedWRotationCenter,v.Matrix[0]),P.TranslationToRef(this._cachedURotationCenter,this._cachedVRotationCenter,this._cachedWRotationCenter,v.Matrix[1]),P.ScalingToRef(this._cachedUScale,this._cachedVScale,0,v.Matrix[2]),P.TranslationToRef(this._cachedUOffset,this._cachedVOffset,0,v.Matrix[3]),v.Matrix[0].multiplyToRef(this._rowGenerationMatrix,this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(v.Matrix[1],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(v.Matrix[2],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(v.Matrix[3],this._cachedTextureMatrix),this._cachedTextureMatrix.setRowFromFloats(2,this._cachedTextureMatrix.m[12],this._cachedTextureMatrix.m[13],this._cachedTextureMatrix.m[14],1)):(this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),P.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix));const t=this.getScene();if(!t)return this._cachedTextureMatrix;const i=this._cachedIdentity3x2;return this._cachedIdentity3x2=this._cachedTextureMatrix.isIdentityAs3x2(),this.optimizeUVAllocation&&i!==this._cachedIdentity3x2&&t.markAllMaterialsAsDirty(1,s=>s.hasTexture(this)),this._cachedTextureMatrix}getReflectionTextureMatrix(){const e=this.getScene();if(!e)return this._cachedReflectionTextureMatrix;if(this.uOffset===this._cachedReflectionUOffset&&this.vOffset===this._cachedReflectionVOffset&&this.uScale===this._cachedReflectionUScale&&this.vScale===this._cachedReflectionVScale&&this.coordinatesMode===this._cachedReflectionCoordinatesMode)if(this.coordinatesMode===z.PROJECTION_MODE){if(this._cachedReflectionProjectionMatrixId===e.getProjectionMatrix().updateFlag)return this._cachedReflectionTextureMatrix}else return this._cachedReflectionTextureMatrix;this._cachedReflectionTextureMatrix||(this._cachedReflectionTextureMatrix=P.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=P.Zero());const t=this._cachedReflectionCoordinatesMode!==this.coordinatesMode;switch(this._cachedReflectionUOffset=this.uOffset,this._cachedReflectionVOffset=this.vOffset,this._cachedReflectionUScale=this.uScale,this._cachedReflectionVScale=this.vScale,this._cachedReflectionCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case z.PLANAR_MODE:{P.IdentityToRef(this._cachedReflectionTextureMatrix),this._cachedReflectionTextureMatrix[0]=this.uScale,this._cachedReflectionTextureMatrix[5]=this.vScale,this._cachedReflectionTextureMatrix[12]=this.uOffset,this._cachedReflectionTextureMatrix[13]=this.vOffset;break}case z.PROJECTION_MODE:{P.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);const i=e.getProjectionMatrix();this._cachedReflectionProjectionMatrixId=i.updateFlag,i.multiplyToRef(this._projectionModeMatrix,this._cachedReflectionTextureMatrix);break}default:P.IdentityToRef(this._cachedReflectionTextureMatrix);break}return t&&e.markAllMaterialsAsDirty(1,i=>i.hasTexture(this)),this._cachedReflectionTextureMatrix}clone(){const e={noMipmap:this._noMipmap,invertY:this._invertY,samplingMode:this.samplingMode,onLoad:void 0,onError:void 0,buffer:this._texture?this._texture._buffer:void 0,deleteBuffer:this._deleteBuffer,format:this.textureFormat,mimeType:this.mimeType,loaderOptions:this._loaderOptions,creationFlags:this._creationFlags,useSRGBBuffer:this._useSRGBBuffer};return le.Clone(()=>new z(this._texture?this._texture.url:null,this.getScene(),e),this)}serialize(){const e=this.name;z.SerializeBuffers||this.name.startsWith("data:")&&(this.name=""),this.name.startsWith("data:")&&this.url===this.name&&(this.url="");const t=super.serialize(z._SerializeInternalTextureUniqueId);if(!t)return null;if(z.SerializeBuffers||z.ForceSerializeBuffers)if(typeof this._buffer=="string"&&this._buffer.startsWith("data:"))t.base64String=this._buffer,t.name=t.name.replace("data:","");else if(this.url&&this.url.startsWith("data:")&&this._buffer instanceof Uint8Array){const i=this.mimeType||"image/png";t.base64String=`data:${i};base64,${Mo(this._buffer)}`}else(z.ForceSerializeBuffers||this.url&&this.url.startsWith("blob:")||this._forceSerialize)&&(t.base64String=!this._engine||this._engine._features.supportSyncTextureRead?Wc(this):Xc(this));return t.invertY=this._invertY,t.samplingMode=this.samplingMode,t._creationFlags=this._creationFlags,t._useSRGBBuffer=this._useSRGBBuffer,z._SerializeInternalTextureUniqueId&&(t.internalTextureUniqueId=this._texture?.uniqueId),t.internalTextureLabel=this._texture?.label,t.noMipmap=this._noMipmap,this.name=e,t}getClassName(){return"Texture"}dispose(){super.dispose(),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null,this._buffer=null}static Parse(e,t,i){if(e.customType){const l=Ls.Instantiate(e.customType).Parse(e,t,i);return e.samplingMode&&l.updateSamplingMode&&l._samplingMode&&l._samplingMode!==e.samplingMode&&l.updateSamplingMode(e.samplingMode),l}if(e.isCube&&!e.isRenderTarget)return z._CubeTextureParser(e,t,i);const s=e.internalTextureUniqueId!==void 0;if(!e.name&&!e.isRenderTarget&&!s)return null;let r;if(s){const h=t.getEngine().getLoadedTexturesCache();for(const l of h)if(l.uniqueId===e.internalTextureUniqueId){r=l;break}}const n=h=>{if(h&&h._texture&&(h._texture._cachedWrapU=null,h._texture._cachedWrapV=null,h._texture._cachedWrapR=null),e.samplingMode){const l=e.samplingMode;h&&h.samplingMode!==l&&h.updateSamplingMode(l)}if(h&&e.animations)for(let l=0;l{let h=!0;if(e.noMipmap&&(h=!1),e.mirrorPlane){const l=z._CreateMirror(e.name,e.renderTargetSize,t,h);return l._waitingRenderList=e.renderList,l.mirrorPlane=Ht.FromArray(e.mirrorPlane),n(l),l}else if(e.isRenderTarget&&!e.base64String){let l=null;if(e.isCube){if(t.reflectionProbes)for(let c=0;c{n(l)},e._creationFlags??0,e._useSRGBBuffer??!1),l.name=e.name;else{let c;e.name&&(e.name.indexOf("://")>0||e.name.startsWith("data:"))?c=e.name:c=i+e.name,e.url&&(e.url.startsWith("data:")||z.UseSerializedUrlIfAny)&&(c=e.url);const u={noMipmap:!h,invertY:e.invertY,samplingMode:e.samplingMode,onLoad:()=>{n(l)},internalTexture:r};l=new z(c,t,u)}return l}},e,t)}static CreateFromBase64String(e,t,i,s,r,n=z.TRILINEAR_SAMPLINGMODE,o=null,h=null,l=5,c,u){return new z("data:"+t,i,s,r,n,o,h,e,!1,l,void 0,void 0,c,u)}static LoadFromDataString(e,t,i,s=!1,r,n=!0,o=z.TRILINEAR_SAMPLINGMODE,h=null,l=null,c=5,u,f){return e.substring(0,5)!=="data:"&&(e="data:"+e),new z(e,i,r,n,o,h,l,t,s,c,void 0,void 0,u,f)}}z.SerializeBuffers=!0;z.ForceSerializeBuffers=!1;z.OnTextureLoadErrorObservable=new O;z._SerializeInternalTextureUniqueId=!1;z._CubeTextureParser=(a,e,t)=>{throw ie("CubeTexture")};z._CreateMirror=(a,e,t,i)=>{throw ie("MirrorTexture")};z._CreateRenderTargetTexture=(a,e,t,i,s)=>{throw ie("RenderTargetTexture")};z.NEAREST_SAMPLINGMODE=1;z.NEAREST_NEAREST_MIPLINEAR=8;z.BILINEAR_SAMPLINGMODE=2;z.LINEAR_LINEAR_MIPNEAREST=11;z.TRILINEAR_SAMPLINGMODE=3;z.LINEAR_LINEAR_MIPLINEAR=3;z.NEAREST_NEAREST_MIPNEAREST=4;z.NEAREST_LINEAR_MIPNEAREST=5;z.NEAREST_LINEAR_MIPLINEAR=6;z.NEAREST_LINEAR=7;z.NEAREST_NEAREST=1;z.LINEAR_NEAREST_MIPNEAREST=9;z.LINEAR_NEAREST_MIPLINEAR=10;z.LINEAR_LINEAR=2;z.LINEAR_NEAREST=12;z.EXPLICIT_MODE=0;z.SPHERICAL_MODE=1;z.PLANAR_MODE=2;z.CUBIC_MODE=3;z.PROJECTION_MODE=4;z.SKYBOX_MODE=5;z.INVCUBIC_MODE=6;z.EQUIRECTANGULAR_MODE=7;z.FIXED_EQUIRECTANGULAR_MODE=8;z.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9;z.CLAMP_ADDRESSMODE=0;z.WRAP_ADDRESSMODE=1;z.MIRROR_ADDRESSMODE=2;z.UseSerializedUrlIfAny=!1;T([R()],z.prototype,"url",void 0);T([R()],z.prototype,"uOffset",void 0);T([R()],z.prototype,"vOffset",void 0);T([R()],z.prototype,"uScale",void 0);T([R()],z.prototype,"vScale",void 0);T([R()],z.prototype,"uAng",void 0);T([R()],z.prototype,"vAng",void 0);T([R()],z.prototype,"wAng",void 0);T([R()],z.prototype,"uRotationCenter",void 0);T([R()],z.prototype,"vRotationCenter",void 0);T([R()],z.prototype,"wRotationCenter",void 0);T([R()],z.prototype,"homogeneousRotationInUVTransform",void 0);T([R()],z.prototype,"isBlocking",null);nt("BABYLON.Texture",z);le._TextureParser=z.Parse;function Zo(a,e,t){if(!a||a.LOGARITHMICDEPTH||a.indexOf&&a.indexOf("LOGARITHMICDEPTH")>=0){const i=t.activeCamera;i.mode===1&&w.Error("Logarithmic depth is not compatible with orthographic cameras!",20),e.setFloat("logarithmicDepthConstant",2/(Math.log(i.maxZ+1)/Math.LN2))}}const Ta={r:0,g:0,b:0},Xi={NUM_MORPH_INFLUENCERS:0,NORMAL:!1,TANGENT:!1,UV:!1,UV2:!1,COLOR:!1};function $o(a,e,t,i=!1){t&&a.fogEnabled&&(!e||e.applyFog)&&a.fogMode!==0&&(t.setFloat4("vFogInfos",a.fogMode,a.fogStart,a.fogEnd,a.fogDensity),i?(a.fogColor.toLinearSpaceToRef(Ta,a.getEngine().useExactSrgbConversions),t.setColor3("vFogColor",Ta)):t.setColor3("vFogColor",a.fogColor))}function m_(a,e,t,i,s,r,n,o,h,l){const c=a.numMaxInfluencers||a.numInfluencers;return c<=0?0:(e.push("#define MORPHTARGETS"),a.hasPositions&&e.push("#define MORPHTARGETTEXTURE_HASPOSITIONS"),a.hasNormals&&e.push("#define MORPHTARGETTEXTURE_HASNORMALS"),a.hasTangents&&e.push("#define MORPHTARGETTEXTURE_HASTANGENTS"),a.hasUVs&&e.push("#define MORPHTARGETTEXTURE_HASUVS"),a.hasUV2s&&e.push("#define MORPHTARGETTEXTURE_HASUV2S"),a.hasColors&&e.push("#define MORPHTARGETTEXTURE_HASCOLORS"),a.supportsPositions&&s&&e.push("#define MORPHTARGETS_POSITION"),a.supportsNormals&&r&&e.push("#define MORPHTARGETS_NORMAL"),a.supportsTangents&&n&&e.push("#define MORPHTARGETS_TANGENT"),a.supportsUVs&&o&&e.push("#define MORPHTARGETS_UV"),a.supportsUV2s&&h&&e.push("#define MORPHTARGETS_UV2"),a.supportsColors&&l&&e.push("#define MORPHTARGETS_COLOR"),e.push("#define NUM_MORPH_INFLUENCERS "+c),a.isUsingTextureForTargets&&e.push("#define MORPHTARGETS_TEXTURE"),Xi.NUM_MORPH_INFLUENCERS=c,Xi.NORMAL=r,Xi.TANGENT=n,Xi.UV=o,Xi.UV2=h,Xi.COLOR=l,Jo(t,i,Xi,s),c)}function Jo(a,e,t,i=!0){const s=t.NUM_MORPH_INFLUENCERS;if(s>0&&Te.LastCreatedEngine){const r=Te.LastCreatedEngine.getCaps().maxVertexAttribs,n=e.morphTargetManager;if(n?.isUsingTextureForTargets)return;const o=n&&n.supportsPositions&&i,h=n&&n.supportsNormals&&t.NORMAL,l=n&&n.supportsTangents&&t.TANGENT,c=n&&n.supportsUVs&&t.UV1,u=n&&n.supportsUV2s&&t.UV2,f=n&&n.supportsColors&&t.VERTEXCOLOR;for(let d=0;dr&&w.Error("Cannot add more vertex attributes for mesh "+e.name)}}function Kc(a,e=!1){a.push("world0"),a.push("world1"),a.push("world2"),a.push("world3"),e&&(a.push("previousWorld0"),a.push("previousWorld1"),a.push("previousWorld2"),a.push("previousWorld3"))}function eh(a,e){const t=a.morphTargetManager;!a||!t||e.setFloatArray("morphTargetInfluences",t.influences)}function Yc(a,e){e.bindToEffect(a,"Scene")}function th(a,e,t,i,s=null,r=!1,n=!1,o=!1,h=!1,l=!1,c=!1,u=0){if(a.texturesEnabled&&s&&U.ReflectionTextureEnabled){if(t.updateMatrix("reflectionMatrix",s.getReflectionTextureMatrix()),t.updateFloat2("vReflectionInfos",s.level*a.iblIntensity,u),o&&s.boundingBoxSize){const f=s;t.updateVector3("vReflectionPosition",f.boundingBoxPosition),t.updateVector3("vReflectionSize",f.boundingBoxSize)}if(r){const f=s.getSize().width;t.updateFloat2("vReflectionFilteringInfo",f,Math.log2(f))}if(l&&!e.USEIRRADIANCEMAP){const f=s.sphericalPolynomial;if(e.USESPHERICALFROMREFLECTIONMAP&&f)if(e.SPHERICAL_HARMONICS){const d=f.preScaledHarmonics;t.updateVector3("vSphericalL00",d.l00),t.updateVector3("vSphericalL1_1",d.l1_1),t.updateVector3("vSphericalL10",d.l10),t.updateVector3("vSphericalL11",d.l11),t.updateVector3("vSphericalL2_2",d.l2_2),t.updateVector3("vSphericalL2_1",d.l2_1),t.updateVector3("vSphericalL20",d.l20),t.updateVector3("vSphericalL21",d.l21),t.updateVector3("vSphericalL22",d.l22)}else t.updateFloat3("vSphericalX",f.x.x,f.x.y,f.x.z),t.updateFloat3("vSphericalY",f.y.x,f.y.y,f.y.z),t.updateFloat3("vSphericalZ",f.z.x,f.z.y,f.z.z),t.updateFloat3("vSphericalXX_ZZ",f.xx.x-f.zz.x,f.xx.y-f.zz.y,f.xx.z-f.zz.z),t.updateFloat3("vSphericalYY_ZZ",f.yy.x-f.zz.x,f.yy.y-f.zz.y,f.yy.z-f.zz.z),t.updateFloat3("vSphericalZZ",f.zz.x,f.zz.y,f.zz.z),t.updateFloat3("vSphericalXY",f.xy.x,f.xy.y,f.xy.z),t.updateFloat3("vSphericalYZ",f.yz.x,f.yz.y,f.yz.z),t.updateFloat3("vSphericalZX",f.zx.x,f.zx.y,f.zx.z)}else h&&e.USEIRRADIANCEMAP&&e.USE_IRRADIANCE_DOMINANT_DIRECTION&&t.updateVector3("vReflectionDominantDirection",s.irradianceTexture._dominantDirection);n&&t.updateFloat3("vReflectionMicrosurfaceInfos",s.getSize().width,s.lodGenerationScale,s.lodGenerationOffset)}c&&t.updateColor3("vReflectionColor",i)}function ih(a,e,t,i=null,s=!1){if(i&&U.ReflectionTextureEnabled){e.LODBASEDMICROSFURACE?t.setTexture("reflectionSampler",i):(t.setTexture("reflectionSampler",i._lodTextureMid||i),t.setTexture("reflectionSamplerLow",i._lodTextureLow||i),t.setTexture("reflectionSamplerHigh",i._lodTextureHigh||i)),e.USEIRRADIANCEMAP&&t.setTexture("irradianceSampler",i.irradianceTexture);const r=a.iblCdfGenerator;s&&r&&t.setTexture("icdfSampler",r.getIcdfTexture())}}function Ne(a,e,t){e._needUVs=!0,e[t]=!0,a.optimizeUVAllocation&&a.getTextureMatrix().isIdentityAs3x2()?(e[t+"DIRECTUV"]=a.coordinatesIndex+1,e["MAINUV"+(a.coordinatesIndex+1)]=!0):e[t+"DIRECTUV"]=0}function Ue(a,e,t){const i=a.getTextureMatrix();e.updateMatrix(t+"Matrix",i)}function qc(a,e,t){t.BAKED_VERTEX_ANIMATION_TEXTURE&&t.INSTANCES&&a.push("bakedVertexAnimationSettingsInstanced")}function jc(a,e){return e.set(a),e}function sh(a,e,t){if(!(!e||!a)&&(a.computeBonesUsingShaders&&e._bonesComputationForcedToCPU&&(a.computeBonesUsingShaders=!1),a.useBones&&a.computeBonesUsingShaders&&a.skeleton)){const i=a.skeleton;if(i.isUsingTextureForMatrices&&e.getUniformIndex("boneTextureWidth")>-1){const s=i.getTransformMatrixTexture(a);e.setTexture("boneSampler",s),e.setFloat("boneTextureWidth",4*(i.bones.length+1))}else{const s=i.getTransformMatrices(a);s&&(e.setMatrices("mBones",s),t&&a.getScene().prePassRenderer&&a.getScene().prePassRenderer.getIndex(2)&&(t.previousBones[a.uniqueId]||(t.previousBones[a.uniqueId]=s.slice()),e.setMatrices("mPreviousBones",t.previousBones[a.uniqueId]),jc(s,t.previousBones[a.uniqueId])))}}}function Qc(a,e,t,i,s,r=!0){a._bindLight(e,t,i,s,r)}function rh(a,e,t,i,s=4){const r=Math.min(e.lightSources.length,s);for(let n=0;n0&&(i.addCPUSkinningFallback(0,e),a.push("matricesIndices"),a.push("matricesWeights"),t.NUM_BONE_INFLUENCERS>4&&(a.push("matricesIndicesExtra"),a.push("matricesWeightsExtra")))}function ah(a,e){(e.INSTANCES||e.THIN_INSTANCES)&&Kc(a,!!e.PREPASS_VELOCITY),e.INSTANCESCOLOR&&a.push("instanceColor")}function oh(a,e,t=4,i=0){let s=0;for(let r=0;r0&&(s=i+r,e.addFallback(s,"LIGHT"+r)),a.SHADOWS||(a["SHADOW"+r]&&e.addFallback(i,"SHADOW"+r),a["SHADOWPCF"+r]&&e.addFallback(i,"SHADOWPCF"+r),a["SHADOWPCSS"+r]&&e.addFallback(i,"SHADOWPCSS"+r),a["SHADOWPOISSON"+r]&&e.addFallback(i,"SHADOWPOISSON"+r),a["SHADOWESM"+r]&&e.addFallback(i,"SHADOWESM"+r),a["SHADOWCLOSEESM"+r]&&e.addFallback(i,"SHADOWCLOSEESM"+r));return s++}function Zc(a,e){return e.fogEnabled&&a.applyFog&&e.fogMode!==0}function hh(a,e,t,i,s,r,n,o=!1,h=!1,l,c){if(n._areMiscDirty){n.LOGARITHMICDEPTH=t,n.POINTSIZE=i,n.FOG=s&&Zc(a,e),n.NONUNIFORMSCALING=a.nonUniformScaling,n.ALPHATEST=r,n.DECAL_AFTER_DETAIL=o,n.USE_VERTEX_PULLING=h,n.RIGHT_HANDED=e.useRightHandedSystem;const u=l?.geometry?.getIndexBuffer();n.VERTEX_PULLING_USE_INDEX_BUFFER=!!u,n.VERTEX_PULLING_INDEX_BUFFER_32BITS=u?u.is32Bits:!1,n.VERTEXOUTPUT_INVARIANT=!!c}}function lh(a,e,t,i,s=4,r=!1){if(!t._areLightsDirty)return t._needNormals;let n=0;const o={needNormals:t._needNormals,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};if(a.lightsEnabled&&!r){for(const c of e.lightSources)if($c(a,e,c,n,t,i,o),n++,n===s)break}t.SPECULARTERM=o.specularEnabled,t.SHADOWS=o.shadowEnabled;const h=Math.max(s,t.MAXLIGHTCOUNT||0);for(let c=n;c0?(t.NUM_SAMPLES=""+s,n._features.needTypeSuffixInShaderConstants&&(t.NUM_SAMPLES=t.NUM_SAMPLES+"u"),t.REALTIME_FILTERING=!0,a.iblCdfGenerator&&(t.IBL_CDF_FILTERING=!0)):t.REALTIME_FILTERING=!1,t.INVERTCUBICMAP=e.coordinatesMode===z.INVCUBIC_MODE,t.REFLECTIONMAP_3D=e.isCube,t.REFLECTIONMAP_OPPOSITEZ=t.REFLECTIONMAP_3D&&a.useRightHandedSystem?!e.invertZ:e.invertZ,t.REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,e.coordinatesMode){case z.EXPLICIT_MODE:t.REFLECTIONMAP_EXPLICIT=!0;break;case z.PLANAR_MODE:t.REFLECTIONMAP_PLANAR=!0;break;case z.PROJECTION_MODE:t.REFLECTIONMAP_PROJECTION=!0;break;case z.SKYBOX_MODE:t.REFLECTIONMAP_SKYBOX=!0;break;case z.SPHERICAL_MODE:t.REFLECTIONMAP_SPHERICAL=!0;break;case z.EQUIRECTANGULAR_MODE:t.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case z.FIXED_EQUIRECTANGULAR_MODE:t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case z.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case z.CUBIC_MODE:case z.INVCUBIC_MODE:default:t.REFLECTIONMAP_CUBIC=!0,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!!e.boundingBoxSize;break}e.coordinatesMode!==z.SKYBOX_MODE&&(e.irradianceTexture?(t.USEIRRADIANCEMAP=!0,t.USESPHERICALFROMREFLECTIONMAP=!1,t.USESPHERICALINVERTEX=!1,e.irradianceTexture._dominantDirection&&(t.USE_IRRADIANCE_DOMINANT_DIRECTION=!0)):e.isCube&&(t.USESPHERICALFROMREFLECTIONMAP=!0,t.USEIRRADIANCEMAP=!1,t.USE_IRRADIANCE_DOMINANT_DIRECTION=!1,t.USESPHERICALINVERTEX=r))}else t.REFLECTION=!1,t.REFLECTIONMAP_3D=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_CUBIC=!1,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,t.INVERTCUBICMAP=!1,t.USESPHERICALFROMREFLECTIONMAP=!1,t.USEIRRADIANCEMAP=!1,t.USE_IRRADIANCE_DOMINANT_DIRECTION=!1,t.USESPHERICALINVERTEX=!1,t.REFLECTIONMAP_OPPOSITEZ=!1,t.LODINREFLECTIONALPHA=!1,t.GAMMAREFLECTION=!1,t.RGBDREFLECTION=!1,t.LINEARSPECULARREFLECTION=!1;return!0}function $c(a,e,t,i,s,r,n){switch(n.needNormals=!0,s["LIGHT"+i]===void 0&&(n.needRebuild=!0),s["LIGHT"+i]=!0,s["SPOTLIGHT"+i]=!1,s["HEMILIGHT"+i]=!1,s["POINTLIGHT"+i]=!1,s["DIRLIGHT"+i]=!1,s["AREALIGHT"+i]=!1,s["CLUSTLIGHT"+i]=!1,t.prepareLightSpecificDefines(s,i),s["LIGHT_FALLOFF_PHYSICAL"+i]=!1,s["LIGHT_FALLOFF_GLTF"+i]=!1,s["LIGHT_FALLOFF_STANDARD"+i]=!1,t.falloffType){case Ee.FALLOFF_GLTF:s["LIGHT_FALLOFF_GLTF"+i]=!0;break;case Ee.FALLOFF_PHYSICAL:s["LIGHT_FALLOFF_PHYSICAL"+i]=!0;break;case Ee.FALLOFF_STANDARD:s["LIGHT_FALLOFF_STANDARD"+i]=!0;break}if(r&&!t.specular.equalsFloats(0,0,0)&&(n.specularEnabled=!0),s["SHADOW"+i]=!1,s["SHADOWCSM"+i]=!1,s["SHADOWCSMDEBUG"+i]=!1,s["SHADOWCSMNUM_CASCADES"+i]=!1,s["SHADOWCSMUSESHADOWMAXZ"+i]=!1,s["SHADOWCSMNOBLEND"+i]=!1,s["SHADOWCSM_RIGHTHANDED"+i]=!1,s["SHADOWPCF"+i]=!1,s["SHADOWPCSS"+i]=!1,s["SHADOWPOISSON"+i]=!1,s["SHADOWESM"+i]=!1,s["SHADOWCLOSEESM"+i]=!1,s["SHADOWCUBE"+i]=!1,s["SHADOWLOWQUALITY"+i]=!1,s["SHADOWMEDIUMQUALITY"+i]=!1,e&&e.receiveShadows&&a.shadowsEnabled&&t.shadowEnabled){const o=t.getShadowGenerator(a.activeCamera)??t.getShadowGenerator();if(o){const h=o.getShadowMap();h&&h.renderList&&h.renderList.length>0&&(n.shadowEnabled=!0,o.prepareDefines(s,i))}}t.lightmapMode!=Ee.LIGHTMAP_DEFAULT?(n.lightmapMode=!0,s["LIGHTMAPEXCLUDED"+i]=!0,s["LIGHTMAPNOSPECULAR"+i]=t.lightmapMode==Ee.LIGHTMAP_SHADOWSONLY):(s["LIGHTMAPEXCLUDED"+i]=!1,s["LIGHTMAPNOSPECULAR"+i]=!1)}function uh(a,e,t,i,s,r=null,n=!1){let o=ru(a,i);r!==!1&&(o=zc(t,a,i)),i.DEPTHPREPASS!==!e.getColorWrite()&&(i.DEPTHPREPASS=!i.DEPTHPREPASS,o=!0),i.INSTANCES!==s&&(i.INSTANCES=s,o=!0),i.THIN_INSTANCES!==n&&(i.THIN_INSTANCES=n,o=!0),o&&i.markAsUnprocessed()}function Jc(a,e){if(a.useBones&&a.computeBonesUsingShaders&&a.skeleton){e.NUM_BONE_INFLUENCERS=a.numBoneInfluencers;const t=e.BONETEXTURE!==void 0;if(a.skeleton.isUsingTextureForMatrices&&t)e.BONETEXTURE=!0;else{e.BonesPerMesh=a.skeleton.bones.length+1,e.BONETEXTURE=t?!1:void 0;const i=a.getScene().prePassRenderer;if(i&&i.enabled){const s=i.excludedSkinnedMesh.indexOf(a)===-1;e.BONES_VELOCITY_ENABLED=s}}}else e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.BONETEXTURE!==void 0&&(e.BONETEXTURE=!1)}function eu(a,e){const t=a.morphTargetManager;t?(e.MORPHTARGETS_UV=t.supportsUVs&&e.UV1,e.MORPHTARGETS_UV2=t.supportsUV2s&&e.UV2,e.MORPHTARGETS_TANGENT=t.supportsTangents&&e.TANGENT,e.MORPHTARGETS_NORMAL=t.supportsNormals&&e.NORMAL,e.MORPHTARGETS_POSITION=t.supportsPositions,e.MORPHTARGETS_COLOR=t.supportsColors,e.MORPHTARGETTEXTURE_HASUVS=t.hasUVs,e.MORPHTARGETTEXTURE_HASUV2S=t.hasUV2s,e.MORPHTARGETTEXTURE_HASTANGENTS=t.hasTangents,e.MORPHTARGETTEXTURE_HASNORMALS=t.hasNormals,e.MORPHTARGETTEXTURE_HASPOSITIONS=t.hasPositions,e.MORPHTARGETTEXTURE_HASCOLORS=t.hasColors,e.NUM_MORPH_INFLUENCERS=t.numMaxInfluencers||t.numInfluencers,e.MORPHTARGETS=e.NUM_MORPH_INFLUENCERS>0,e.MORPHTARGETS_TEXTURE=t.isUsingTextureForTargets):(e.MORPHTARGETS_UV=!1,e.MORPHTARGETS_UV2=!1,e.MORPHTARGETS_TANGENT=!1,e.MORPHTARGETS_NORMAL=!1,e.MORPHTARGETS_POSITION=!1,e.MORPHTARGETS_COLOR=!1,e.MORPHTARGETTEXTURE_HASUVS=!1,e.MORPHTARGETTEXTURE_HASUV2S=!1,e.MORPHTARGETTEXTURE_HASTANGENTS=!1,e.MORPHTARGETTEXTURE_HASNORMALS=!1,e.MORPHTARGETTEXTURE_HASPOSITIONS=!1,e.MORPHTARGETTEXTURE_HAS_COLORS=!1,e.MORPHTARGETS=!1,e.NUM_MORPH_INFLUENCERS=0)}function tu(a,e){const t=a.bakedVertexAnimationManager;e.BAKED_VERTEX_ANIMATION_TEXTURE=!!(t&&t.isEnabled)}function dh(a,e,t,i,s=!1,r=!0,n=!0){if(!e._areAttributesDirty&&e._needNormals===e._normals&&e._needUVs===e._uvs)return!1;e._normals=e._needNormals,e._uvs=e._needUVs,e.NORMAL=e._needNormals&&a.isVerticesDataPresent("normal"),e._needNormals&&a.isVerticesDataPresent("tangent")&&(e.TANGENT=!0);for(let o=1;o<=6;++o)e["UV"+o]=e._needUVs?a.isVerticesDataPresent(`uv${o===1?"":o}`):!1;if(t){const o=a.useVertexColors&&a.isVerticesDataPresent("color");e.VERTEXCOLOR=o,e.VERTEXALPHA=a.hasVertexAlpha&&o&&r}return a.isVerticesDataPresent("instanceColor")&&(a.hasInstances||a.hasThinInstances)&&(e.INSTANCESCOLOR=!0),i&&Jc(a,e),s&&eu(a,e),n&&tu(a,e),!0}function fh(a,e){if(a.activeCamera){const t=e.MULTIVIEW;e.MULTIVIEW=a.activeCamera.outputRenderTarget!==null&&a.activeCamera.outputRenderTarget.getViewCount()>1,e.MULTIVIEW!=t&&e.markAsUnprocessed()}}function iu(a,e,t){const i=e.ORDER_INDEPENDENT_TRANSPARENCY,s=e.ORDER_INDEPENDENT_TRANSPARENCY_16BITS;e.ORDER_INDEPENDENT_TRANSPARENCY=a.useOrderIndependentTransparency&&t,e.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!a.getEngine().getCaps().textureFloatLinearFiltering,(i!==e.ORDER_INDEPENDENT_TRANSPARENCY||s!==e.ORDER_INDEPENDENT_TRANSPARENCY_16BITS)&&e.markAsUnprocessed()}function su(a,e,t){const i=e.PREPASS;if(!e._arePrePassDirty)return;const s=[{type:1,define:"PREPASS_POSITION",index:"PREPASS_POSITION_INDEX"},{type:9,define:"PREPASS_LOCAL_POSITION",index:"PREPASS_LOCAL_POSITION_INDEX"},{type:2,define:"PREPASS_VELOCITY",index:"PREPASS_VELOCITY_INDEX"},{type:11,define:"PREPASS_VELOCITY_LINEAR",index:"PREPASS_VELOCITY_LINEAR_INDEX"},{type:3,define:"PREPASS_REFLECTIVITY",index:"PREPASS_REFLECTIVITY_INDEX"},{type:0,define:"PREPASS_IRRADIANCE",index:"PREPASS_IRRADIANCE_INDEX"},{type:7,define:"PREPASS_ALBEDO_SQRT",index:"PREPASS_ALBEDO_SQRT_INDEX"},{type:5,define:"PREPASS_DEPTH",index:"PREPASS_DEPTH_INDEX"},{type:10,define:"PREPASS_SCREENSPACE_DEPTH",index:"PREPASS_SCREENSPACE_DEPTH_INDEX"},{type:6,define:"PREPASS_NORMAL",index:"PREPASS_NORMAL_INDEX"},{type:8,define:"PREPASS_WORLD_NORMAL",index:"PREPASS_WORLD_NORMAL_INDEX"}];if(a.prePassRenderer&&a.prePassRenderer.enabled&&t){e.PREPASS=!0,e.SCENE_MRT_COUNT=a.prePassRenderer.mrtCount,e.PREPASS_NORMAL_WORLDSPACE=a.prePassRenderer.generateNormalsInWorldSpace,e.PREPASS_COLOR=!0,e.PREPASS_COLOR_INDEX=0;for(let r=0;r{},this._callbackPluginEventIsReadyForSubMesh=()=>{},this._callbackPluginEventPrepareDefines=()=>{},this._callbackPluginEventPrepareDefinesBeforeAttributes=()=>{},this._callbackPluginEventHardBindForSubMesh=()=>{},this._callbackPluginEventBindForSubMesh=()=>{},this._callbackPluginEventHasRenderTargetTextures=()=>{},this._callbackPluginEventFillRenderTargetTextures=()=>{},this._transparencyMode=null,this.name=e;const r=t||Te.LastCreatedScene;r&&(this._scene=r,this._dirtyCallbacks={},this._forceGLSL=s,this._dirtyCallbacks[1]=this._markAllSubMeshesAsTexturesDirty.bind(this),this._dirtyCallbacks[2]=this._markAllSubMeshesAsLightsDirty.bind(this),this._dirtyCallbacks[4]=this._markAllSubMeshesAsFresnelDirty.bind(this),this._dirtyCallbacks[8]=this._markAllSubMeshesAsAttributesDirty.bind(this),this._dirtyCallbacks[16]=this._markAllSubMeshesAsMiscDirty.bind(this),this._dirtyCallbacks[32]=this._markAllSubMeshesAsPrePassDirty.bind(this),this._dirtyCallbacks[127]=this._markAllSubMeshesAsAllDirty.bind(this),this.id=e||se.RandomId(),this.uniqueId=this._scene.getUniqueId(),this._materialContext=this._scene.getEngine().createMaterialContext(),this._drawWrapper=new kn(this._scene.getEngine(),!1),this._drawWrapper.materialContext=this._materialContext,this._uniformBuffer=new K(this._scene.getEngine(),void 0,void 0,e),this._useUBO=this.getScene().getEngine().supportsUniformBuffers,this._createUniformBuffer(),i||this._scene.addMaterial(this),this._scene.useMaterialMeshMap&&(this.meshMap={}),F.OnEventObservable.notifyObservers(this,1))}_createUniformBuffer(){const e=this.getScene().getEngine();this._uniformBuffer?.dispose(),e.isWebGPU&&!this._forceGLSL?(this._uniformBuffer=new K(e,void 0,void 0,this.name,!0),this._shaderLanguage=1):this._uniformBuffer=new K(this._scene.getEngine(),void 0,void 0,this.name),this._uniformBufferLayoutBuilt=!1}toString(e){return"Name: "+this.name}getClassName(){return"Material"}get _isMaterial(){return!0}get isFrozen(){return this.checkReadyOnlyOnce}freeze(){this.markDirty(),this.checkReadyOnlyOnce=!0}unfreeze(){this.markDirty(),this.checkReadyOnlyOnce=!1}isReady(e,t){return!0}isReadyForSubMesh(e,t,i){const s=t.materialDefines;return s?(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=s,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),this._eventInfo.isReadyForSubMesh):!1}getEffect(){return this._drawWrapper.effect}getScene(){return this._scene}_getEffectiveOrientation(e){return this.sideOrientation!==null?this.sideOrientation:e.sideOrientation}get transparencyMode(){return this._transparencyMode}set transparencyMode(e){this._transparencyMode!==e&&(this._transparencyMode=e,this._markAllSubMeshesAsTexturesAndMiscDirty())}get _hasTransparencyMode(){return this._transparencyMode!=null}get _transparencyModeIsBlend(){return this._transparencyMode===F.MATERIAL_ALPHABLEND||this._transparencyMode===F.MATERIAL_ALPHATESTANDBLEND}get _transparencyModeIsTest(){return this._transparencyMode===F.MATERIAL_ALPHATEST||this._transparencyMode===F.MATERIAL_ALPHATESTANDBLEND}get _disableAlphaBlending(){return this._transparencyMode===F.MATERIAL_OPAQUE||this._transparencyMode===F.MATERIAL_ALPHATEST}needAlphaBlending(){return this._hasTransparencyMode?this._transparencyModeIsBlend:this._disableAlphaBlending?!1:this.alpha<1}needAlphaBlendingForMesh(e){return this._hasTransparencyMode?this._transparencyModeIsBlend:e.visibility<1?!0:this._disableAlphaBlending?!1:e.hasVertexAlpha||this.needAlphaBlending()}needAlphaTesting(){return this._hasTransparencyMode?this._transparencyModeIsTest:!1}needAlphaTestingForMesh(e){return this._hasTransparencyMode?this._transparencyModeIsTest:!this.needAlphaBlendingForMesh(e)&&this.needAlphaTesting()}getAlphaTestTexture(){return null}markDirty(e=!1){const t=this.getScene().meshes;for(const i of t)if(i.subMeshes){for(const s of i.subMeshes)if(s.getMaterial()===this)for(const r of s._drawWrappers)r&&this._materialContext===r.materialContext&&(r._wasPreviouslyReady=!1,r._wasPreviouslyUsingInstances=null,r._forceRebindOnNextCall=e)}e&&this.markAsDirty(F.AllDirtyFlag)}_preBind(e,t=null){const i=this._scene.getEngine(),r=(t??this.sideOrientation)===F.ClockWiseSideOrientation,n=e||this._getDrawWrapper();return mh(n)&&n.materialContext&&(n.materialContext.useVertexPulling=this.useVertexPulling),i.enableEffect(n),i.setState(this.backFaceCulling,this.zOffset,!1,r,this._scene._mirroredCameraPosition?!this.cullBackFaces:this.cullBackFaces,this.stencil,this.zOffsetUnits),r}bind(e,t){}buildUniformLayout(){const e=this._uniformBuffer;this._eventInfo.ubo=e,this._callbackPluginEventGeneric(8,this._eventInfo),e.create(),this._uniformBufferLayoutBuilt=!0}bindForSubMesh(e,t,i){const s=i._drawWrapper;this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo),s._forceRebindOnNextCall=!1}bindOnlyWorldMatrix(e){}bindView(e){this._useUBO?this._needToBindSceneUbo=!0:e.setMatrix("view",this.getScene().getViewMatrix())}bindViewProjection(e){this._useUBO?this._needToBindSceneUbo=!0:(e.setMatrix("viewProjection",this.getScene().getTransformMatrix()),e.setMatrix("projection",this.getScene().getProjectionMatrix()))}bindEyePosition(e,t){this._useUBO?this._needToBindSceneUbo=!0:this._scene.bindEyePosition(e,t)}_afterBind(e,t=null,i){if(this._scene._cachedMaterial=this,this._needToBindSceneUbo&&t&&(this._needToBindSceneUbo=!1,Yc(t,this.getScene().getSceneUniformBuffer()),this._scene.finalizeSceneUbo()),e?this._scene._cachedVisibility=e.visibility:this._scene._cachedVisibility=1,this._onBindObservable&&e&&this._onBindObservable.notifyObservers(e),this.disableDepthWrite){const s=this._scene.getEngine();this._cachedDepthWriteState=s.getDepthWrite(),s.setDepthWrite(!1)}if(this.disableColorWrite){const s=this._scene.getEngine();this._cachedColorWriteState=s.getColorWrite(),s.setColorWrite(!1)}if(this.depthFunction!==0){const s=this._scene.getEngine();this._cachedDepthFunctionState=s.getDepthFunction()||0,s.setDepthFunction(this.depthFunction)}}unbind(){this._scene.getSceneUniformBuffer().unbindEffect(),this._onUnBindObservable&&this._onUnBindObservable.notifyObservers(this),this.depthFunction!==0&&this._scene.getEngine().setDepthFunction(this._cachedDepthFunctionState),this.disableDepthWrite&&this._scene.getEngine().setDepthWrite(this._cachedDepthWriteState),this.disableColorWrite&&this._scene.getEngine().setColorWrite(this._cachedColorWriteState)}getAnimatables(){return this._eventInfo.animatables=[],this._callbackPluginEventGeneric(256,this._eventInfo),this._eventInfo.animatables}getActiveTextures(){return this._eventInfo.activeTextures=[],this._callbackPluginEventGeneric(512,this._eventInfo),this._eventInfo.activeTextures}hasTexture(e){return this._eventInfo.hasTexture=!1,this._eventInfo.texture=e,this._callbackPluginEventGeneric(1024,this._eventInfo),this._eventInfo.hasTexture}clone(e){return null}_clonePlugins(e,t){const i={};if(this._serializePlugins(i),F._ParsePlugins(i,e,this._scene,t),this.pluginManager)for(const s of this.pluginManager._plugins){const r=e.pluginManager.getPlugin(s.name);r&&s.copyTo(r)}}getBindedMeshes(){if(this.meshMap){const e=[];for(const t in this.meshMap){const i=this.meshMap[t];i&&e.push(i)}return e}else return this._scene.meshes.filter(t=>t.material===this)}forceCompilation(e,t,i,s){const r={clipPlane:!1,useInstances:!1,...i},n=this.getScene(),o=this.allowShaderHotSwapping;this.allowShaderHotSwapping=!1;const h=()=>{if(!this._scene||!this._scene.getEngine())return;const l=n.clipPlane;if(r.clipPlane&&(n.clipPlane=new Ht(0,0,0,1)),this._storeEffectOnSubMeshes){let c=!0,u=null;if(e.subMeshes){const f=new zt(0,0,0,0,0,e,void 0,!1,!1);f.materialDefines&&(f.materialDefines._renderId=-1),this.isReadyForSubMesh(e,f,r.useInstances)||(f.effect&&f.effect.getCompilationError()&&f.effect.allFallbacksProcessed()?u=f.effect.getCompilationError():(c=!1,setTimeout(h,16)))}c&&(this.allowShaderHotSwapping=o,u&&s&&s(u),t&&t(this))}else this.isReady()?(this.allowShaderHotSwapping=o,t&&t(this)):setTimeout(h,16);r.clipPlane&&(n.clipPlane=l)};h()}async forceCompilationAsync(e,t){return await new Promise((i,s)=>{this.forceCompilation(e,()=>{i()},t,r=>{s(r)})})}markAsDirty(e){this.getScene().blockMaterialDirtyMechanism||this._blockDirtyMechanism||(F._DirtyCallbackArray.length=0,e&F.ImageProcessingDirtyFlag&&F._DirtyCallbackArray.push(F._ImageProcessingDirtyCallBack),e&F.TextureDirtyFlag&&F._DirtyCallbackArray.push(F._TextureDirtyCallBack),e&F.LightDirtyFlag&&F._DirtyCallbackArray.push(F._LightsDirtyCallBack),e&F.FresnelDirtyFlag&&F._DirtyCallbackArray.push(F._FresnelDirtyCallBack),e&F.AttributesDirtyFlag&&F._DirtyCallbackArray.push(F._AttributeDirtyCallBack),e&F.MiscDirtyFlag&&F._DirtyCallbackArray.push(F._MiscDirtyCallBack),e&F.PrePassDirtyFlag&&F._DirtyCallbackArray.push(F._PrePassDirtyCallBack),F._DirtyCallbackArray.length&&this._markAllSubMeshesAsDirty(F._RunDirtyCallBacks),this.getScene().resetCachedMaterial())}resetDrawCache(){const e=this.getScene().meshes;for(const t of e)if(t.subMeshes)for(const i of t.subMeshes)i.getMaterial()===this&&i.resetDrawCache()}_markAllSubMeshesAsDirty(e){const t=this.getScene();if(t.blockMaterialDirtyMechanism||this._blockDirtyMechanism)return;const i=t.meshes;for(const s of i)if(s.subMeshes){for(const r of s.subMeshes)if((r.getMaterial()||(t._hasDefaultMaterial?t.defaultMaterial:null))===this)for(const o of r._drawWrappers)!o||!o.defines||!o.defines.markAllAsDirty||this._materialContext===o.materialContext&&e(o.defines)}}_markScenePrePassDirty(){if(this.getScene().blockMaterialDirtyMechanism||this._blockDirtyMechanism)return;const e=this.getScene().enablePrePassRenderer();e&&e.markAsDirty()}_markAllSubMeshesAsAllDirty(){this._markAllSubMeshesAsDirty(F._AllDirtyCallBack)}_markAllSubMeshesAsImageProcessingDirty(){this._markAllSubMeshesAsDirty(F._ImageProcessingDirtyCallBack)}_markAllSubMeshesAsTexturesDirty(){this._markAllSubMeshesAsDirty(F._TextureDirtyCallBack)}_markAllSubMeshesAsFresnelDirty(){this._markAllSubMeshesAsDirty(F._FresnelDirtyCallBack)}_markAllSubMeshesAsFresnelAndMiscDirty(){this._markAllSubMeshesAsDirty(F._FresnelAndMiscDirtyCallBack)}_markAllSubMeshesAsLightsDirty(){this._markAllSubMeshesAsDirty(F._LightsDirtyCallBack)}_markAllSubMeshesAsAttributesDirty(){this._markAllSubMeshesAsDirty(F._AttributeDirtyCallBack)}_markAllSubMeshesAsMiscDirty(){this._markAllSubMeshesAsDirty(F._MiscDirtyCallBack)}_markAllSubMeshesAsPrePassDirty(){this._markAllSubMeshesAsDirty(F._PrePassDirtyCallBack)}_markAllSubMeshesAsTexturesAndMiscDirty(){this._markAllSubMeshesAsDirty(F._TextureAndMiscDirtyCallBack)}_checkScenePerformancePriority(){if(this._scene.performancePriority!==0){this.checkReadyOnlyOnce=!0;const e=this._scene.onScenePerformancePriorityChangedObservable.addOnce(()=>{this.checkReadyOnlyOnce=!1});this.onDisposeObservable.add(()=>{this._scene.onScenePerformancePriorityChangedObservable.remove(e)})}}setPrePassRenderer(e){return!1}dispose(e,t,i){const s=this.getScene();if(s.stopAnimation(this),s.freeProcessedMaterials(),s.removeMaterial(this),this._eventInfo.forceDisposeTextures=t,this._callbackPluginEventGeneric(2,this._eventInfo),this._parentContainer){const r=this._parentContainer.materials.indexOf(this);r>-1&&this._parentContainer.materials.splice(r,1),this._parentContainer=null}if(i!==!0)if(this.meshMap)for(const r in this.meshMap){const n=this.meshMap[r];this._disposeMeshResources(n)}else{const r=s.meshes;for(const n of r)this._disposeMeshResources(n)}this._uniformBuffer.dispose(),this._drawWrapper.effect&&(this._storeEffectOnSubMeshes||this._drawWrapper.effect.dispose(),this._drawWrapper.effect=null),this.metadata=null,this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this._onBindObservable&&this._onBindObservable.clear(),this._onUnBindObservable&&this._onUnBindObservable.clear(),this._onEffectCreatedObservable&&this._onEffectCreatedObservable.clear(),this._eventInfo&&(this._eventInfo={})}_disposeMeshResources(e){if(!e)return;const t=e.geometry,i=e._internalAbstractMeshDataInfo._materialForRenderPass;if(this._storeEffectOnSubMeshes){if(e.subMeshes&&i)for(const s of e.subMeshes){const r=s._drawWrappers;for(let n=0;na.markAllAsDirty();F._ImageProcessingDirtyCallBack=a=>a.markAsImageProcessingDirty();F._TextureDirtyCallBack=a=>a.markAsTexturesDirty();F._FresnelDirtyCallBack=a=>a.markAsFresnelDirty();F._MiscDirtyCallBack=a=>a.markAsMiscDirty();F._PrePassDirtyCallBack=a=>a.markAsPrePassDirty();F._LightsDirtyCallBack=a=>a.markAsLightDirty();F._AttributeDirtyCallBack=a=>a.markAsAttributesDirty();F._FresnelAndMiscDirtyCallBack=a=>{F._FresnelDirtyCallBack(a),F._MiscDirtyCallBack(a)};F._TextureAndMiscDirtyCallBack=a=>{F._TextureDirtyCallBack(a),F._MiscDirtyCallBack(a)};F._DirtyCallbackArray=[];F._RunDirtyCallBacks=a=>{for(const e of F._DirtyCallbackArray)e(a)};T([R()],F.prototype,"id",void 0);T([R()],F.prototype,"uniqueId",void 0);T([R()],F.prototype,"name",void 0);T([R()],F.prototype,"metadata",void 0);T([R()],F.prototype,"checkReadyOnEveryCall",void 0);T([R()],F.prototype,"checkReadyOnlyOnce",void 0);T([R()],F.prototype,"state",void 0);T([R("alpha")],F.prototype,"_alpha",void 0);T([R("backFaceCulling")],F.prototype,"_backFaceCulling",void 0);T([R("cullBackFaces")],F.prototype,"_cullBackFaces",void 0);T([R()],F.prototype,"sideOrientation",void 0);T([R()],F.prototype,"_alphaMode",void 0);T([R()],F.prototype,"_needDepthPrePass",void 0);T([R()],F.prototype,"disableDepthWrite",void 0);T([R()],F.prototype,"disableColorWrite",void 0);T([R()],F.prototype,"forceDepthWrite",void 0);T([R()],F.prototype,"depthFunction",void 0);T([R()],F.prototype,"separateCullingPass",void 0);T([R("fogEnabled")],F.prototype,"_fogEnabled",void 0);T([R()],F.prototype,"pointSize",void 0);T([R()],F.prototype,"zOffset",void 0);T([R()],F.prototype,"zOffsetUnits",void 0);T([R()],F.prototype,"pointsCloud",null);T([R()],F.prototype,"fillMode",null);T([R()],F.prototype,"useLogarithmicDepth",null);T([R()],F.prototype,"_isVertexOutputInvariant",void 0);T([R()],F.prototype,"transparencyMode",null);class Ts extends F{get subMaterials(){return this._subMaterials}set subMaterials(e){this._subMaterials=e,this._hookArray(e)}getChildren(){return this.subMaterials}constructor(e,t){super(e,t,!0),this._waitingSubMaterialsUniqueIds=[],this.getScene().addMultiMaterial(this),this.subMaterials=[],this._storeEffectOnSubMeshes=!0}_hookArray(e){const t=e.push;e.push=(...s)=>{const r=t.apply(e,s);return this._markAllSubMeshesAsTexturesDirty(),r};const i=e.splice;e.splice=(s,r)=>{const n=i.apply(e,[s,r]);return this._markAllSubMeshesAsTexturesDirty(),n}}getSubMaterial(e){return e<0||e>=this.subMaterials.length?this.getScene().defaultMaterial:this.subMaterials[e]}getActiveTextures(){return super.getActiveTextures().concat(...this.subMaterials.map(e=>e?e.getActiveTextures():[]))}hasTexture(e){if(super.hasTexture(e))return!0;for(let t=0;t=0&&s.multiMaterials.splice(r,1),super.dispose(e,t)}static ParseMultiMaterial(e,t){const i=new Ts(e.name,t);if(i.id=e.id,i._loadedUniqueId=e.uniqueId,Ae&&Ae.AddTagsTo(i,e.tags),e.materialsUniqueIds)i._waitingSubMaterialsUniqueIds=e.materialsUniqueIds;else for(const s of e.materials)i.subMaterials.push(t.getLastMaterialById(s));return i}}nt("BABYLON.MultiMaterial",Ts);class re{}re.NAME_EFFECTLAYER="EffectLayer";re.NAME_LAYER="Layer";re.NAME_LENSFLARESYSTEM="LensFlareSystem";re.NAME_BOUNDINGBOXRENDERER="BoundingBoxRenderer";re.NAME_PARTICLESYSTEM="ParticleSystem";re.NAME_GAMEPAD="Gamepad";re.NAME_SIMPLIFICATIONQUEUE="SimplificationQueue";re.NAME_GEOMETRYBUFFERRENDERER="GeometryBufferRenderer";re.NAME_PREPASSRENDERER="PrePassRenderer";re.NAME_DEPTHRENDERER="DepthRenderer";re.NAME_DEPTHPEELINGRENDERER="DepthPeelingRenderer";re.NAME_POSTPROCESSRENDERPIPELINEMANAGER="PostProcessRenderPipelineManager";re.NAME_SPRITE="Sprite";re.NAME_SUBSURFACE="SubSurface";re.NAME_OUTLINERENDERER="Outline";re.NAME_PROCEDURALTEXTURE="ProceduralTexture";re.NAME_SHADOWGENERATOR="ShadowGenerator";re.NAME_OCTREE="Octree";re.NAME_PHYSICSENGINE="PhysicsEngine";re.NAME_AUDIO="Audio";re.NAME_FLUIDRENDERER="FluidRenderer";re.NAME_IBLCDFGENERATOR="iblCDFGenerator";re.NAME_CLUSTEREDLIGHTING="ClusteredLighting";re.STEP_ISREADYFORMESH_EFFECTLAYER=0;re.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER=0;re.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER=0;re.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER=0;re.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER=1;re.STEP_BEFORECAMERADRAW_PREPASS=0;re.STEP_BEFORECAMERADRAW_EFFECTLAYER=1;re.STEP_BEFORECAMERADRAW_LAYER=2;re.STEP_BEFORERENDERTARGETDRAW_PREPASS=0;re.STEP_BEFORERENDERTARGETDRAW_LAYER=1;re.STEP_BEFORERENDERINGMESH_PREPASS=0;re.STEP_BEFORERENDERINGMESH_OUTLINE=1;re.STEP_AFTERRENDERINGMESH_PREPASS=0;re.STEP_AFTERRENDERINGMESH_OUTLINE=1;re.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW=0;re.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER=1;re.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE=0;re.STEP_BEFORECLEAR_PROCEDURALTEXTURE=0;re.STEP_BEFORECLEAR_PREPASS=1;re.STEP_BEFORERENDERTARGETCLEAR_PREPASS=0;re.STEP_AFTERRENDERTARGETDRAW_PREPASS=0;re.STEP_AFTERRENDERTARGETDRAW_LAYER=1;re.STEP_AFTERCAMERADRAW_PREPASS=0;re.STEP_AFTERCAMERADRAW_EFFECTLAYER=1;re.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM=2;re.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW=3;re.STEP_AFTERCAMERADRAW_LAYER=4;re.STEP_AFTERCAMERADRAW_FLUIDRENDERER=5;re.STEP_AFTERCAMERAPOSTPROCESS_LAYER=0;re.STEP_AFTERRENDERTARGETPOSTPROCESS_LAYER=0;re.STEP_AFTERRENDER_AUDIO=0;re.STEP_GATHERRENDERTARGETS_DEPTHRENDERER=0;re.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER=1;re.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR=2;re.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER=3;re.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER=0;re.STEP_GATHERACTIVECAMERARENDERTARGETS_FLUIDRENDERER=1;re.STEP_GATHERACTIVECAMERARENDERTARGETS_CLUSTEREDLIGHTING=2;re.STEP_POINTERMOVE_SPRITE=0;re.STEP_POINTERDOWN_SPRITE=0;re.STEP_POINTERUP_SPRITE=0;class Xe extends Array{constructor(e){super(...e)}static Create(){return Object.create(Xe.prototype)}registerStep(e,t,i){let s=0,r=Number.MAX_VALUE;for(;s0}get hasThinInstances(){return(this.forcedInstanceCount||this._thinInstanceDataStorage.instancesCount||0)>0}get forcedInstanceCount(){return this._internalMeshDataInfo._forcedInstanceCount}set forcedInstanceCount(e){this._internalMeshDataInfo._forcedInstanceCount=e}get sideOrientation(){return this._internalMeshDataInfo._sideOrientation}set sideOrientation(e){this._internalMeshDataInfo._sideOrientation=e,this._internalAbstractMeshDataInfo._sideOrientationHint=this._scene.useRightHandedSystem&&e===1||!this._scene.useRightHandedSystem&&e===0}get _effectiveSideOrientation(){return this._internalMeshDataInfo._effectiveSideOrientation}get overrideMaterialSideOrientation(){return this.sideOrientation}set overrideMaterialSideOrientation(e){this.sideOrientation=e,this.material&&(this.material.sideOrientation=null)}get overrideRenderingFillMode(){return this._internalMeshDataInfo._overrideRenderingFillMode}set overrideRenderingFillMode(e){this._internalMeshDataInfo._overrideRenderingFillMode=e}get material(){return this._internalAbstractMeshDataInfo._material}set material(e){e&&(this.material&&this.material.sideOrientation===null||this._internalAbstractMeshDataInfo._sideOrientationHint)&&(e.sideOrientation=null),this._setMaterial(e)}get source(){return this._internalMeshDataInfo._source}get cloneMeshMap(){return this._internalMeshDataInfo.meshMap}get isUnIndexed(){return this._unIndexed}set isUnIndexed(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())}get worldMatrixInstancedBuffer(){const e=this._instanceDataStorage.renderPasses[this._instanceDataStorage.engine.isWebGPU?this._instanceDataStorage.engine.currentRenderPassId:0];return e?e.instancesData:void 0}get previousWorldMatrixInstancedBuffer(){const e=this._instanceDataStorage.renderPasses[this._instanceDataStorage.engine.isWebGPU?this._instanceDataStorage.engine.currentRenderPassId:0];return e?e.instancesPreviousData:void 0}get manualUpdateOfWorldMatrixInstancedBuffer(){return this._instanceDataStorage.manualUpdate}set manualUpdateOfWorldMatrixInstancedBuffer(e){this._instanceDataStorage.manualUpdate=e}get manualUpdateOfPreviousWorldMatrixInstancedBuffer(){return this._instanceDataStorage.previousManualUpdate}set manualUpdateOfPreviousWorldMatrixInstancedBuffer(e){this._instanceDataStorage.previousManualUpdate=e}get forceWorldMatrixInstancedBufferUpdate(){return this._instanceDataStorage.forceMatrixUpdates}set forceWorldMatrixInstancedBufferUpdate(e){this._instanceDataStorage.forceMatrixUpdates=e}_copySource(e,t,i=!0,s=!1){const r=this.getScene();if(e._geometry&&e._geometry.applyToMesh(this),So.DeepCopy(e,this,["name","material","skeleton","instances","parent","uniqueId","source","metadata","morphTargetManager","hasInstances","worldMatrixInstancedBuffer","previousWorldMatrixInstancedBuffer","hasLODLevels","geometry","isBlocked","areNormalsFrozen","facetNb","isFacetDataEnabled","lightSources","useBones","isAnInstance","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances","cloneMeshMap","hasBoundingInfo","physicsBody","physicsImpostor"],["_poseMatrix"]),this._internalMeshDataInfo._source=e,r.useClonedMeshMap&&(e._internalMeshDataInfo.meshMap||(e._internalMeshDataInfo.meshMap={}),e._internalMeshDataInfo.meshMap[this.uniqueId]=this),this._originalBuilderSideOrientation=e._originalBuilderSideOrientation,this._creationDataStorage=e._creationDataStorage,e._ranges){const n=e._ranges;for(const o in n)Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&this.createAnimationRange(o,n[o].from,n[o].to)}if(e.metadata&&e.metadata.clone?this.metadata=e.metadata.clone():this.metadata=e.metadata,this._internalMetadata=e._internalMetadata,Ae&&Ae.HasTags(e)&&Ae.AddTagsTo(this,Ae.GetTags(e,!0)),this.setEnabled(e.isEnabled(!1)),this.parent=e.parent,this.setPivotMatrix(e.getPivotMatrix(),this._postMultiplyPivotMatrix),this.id=this.name+"."+e.id,this.material=e.material,!t){const n=e.getDescendants(!0);for(let o=0;o{l&&u&&(this._uniformBuffer?this.transferToEffect(c):u.bindOnlyWorldMatrix(c))};let o=null,h=!1;if(i&&i._addToSceneRootNodes===void 0){const l=i;o=l.parent??null,s=l.source??null,r=l.doNotCloneChildren??!1,n=l.clonePhysicsImpostor??!0,h=l.cloneThinInstances??!1}else o=i;s&&this._copySource(s,r,n,h),o!==null&&(this.parent=o),this._instanceDataStorage.hardwareInstancedRendering=this.getEngine().getCaps().instancedArrays,this._internalMeshDataInfo._onMeshReadyObserverAdded=l=>{l.unregisterOnNextCall=!0,this.isReady(!0)?this.onMeshReadyObservable.notifyObservers(this):this._internalMeshDataInfo._checkReadinessObserver||(this._internalMeshDataInfo._checkReadinessObserver=this._scene.onBeforeRenderObservable.add(()=>{this.isReady(!0)&&(this._scene.onBeforeRenderObservable.remove(this._internalMeshDataInfo._checkReadinessObserver),this._internalMeshDataInfo._checkReadinessObserver=null,this.onMeshReadyObservable.notifyObservers(this))}))},this.onMeshReadyObservable=new O(this._internalMeshDataInfo._onMeshReadyObserverAdded),s&&s.onClonedObservable.notifyObservers(this)}instantiateHierarchy(e=null,t,i){const s=this.getTotalVertices()===0||t&&t.doNotInstantiate&&(t.doNotInstantiate===!0||t.doNotInstantiate(this))?this.clone("Clone of "+(this.name||this.id),e||this.parent,!0):this.createInstance("instance of "+(this.name||this.id));s.parent=e||this.parent,s.position=this.position.clone(),s.scaling=this.scaling.clone(),this.rotationQuaternion?s.rotationQuaternion=this.rotationQuaternion.clone():s.rotation=this.rotation.clone(),i&&i(this,s);for(const r of this.getChildTransformNodes(!0))r.getClassName()==="InstancedMesh"&&s.getClassName()==="Mesh"&&r.sourceMesh===this?r.instantiateHierarchy(s,{doNotInstantiate:t&&t.doNotInstantiate||!1,newSourcedMesh:s},i):r.instantiateHierarchy(s,t,i);return s}getClassName(){return"Mesh"}get _isMesh(){return!0}toString(e){let t=super.toString(e);if(t+=", n vertices: "+this.getTotalVertices(),t+=", parent: "+(this._waitingParentId?this._waitingParentId:this.parent?this.parent.name:"NONE"),this.animations)for(let i=0;i0}getLODLevels(){return this._internalMeshDataInfo._LODLevels}_sortLODLevels(){const e=this._internalMeshDataInfo._useLODScreenCoverage?-1:1;this._internalMeshDataInfo._LODLevels.sort((t,i)=>t.distanceOrScreenCoveragei.distanceOrScreenCoverage?-e:0)}addLODLevel(e,t){if(t&&t._masterMesh)return w.Warn("You cannot use a mesh as LOD level twice"),this;const i=new au(e,t);return this._internalMeshDataInfo._LODLevels.push(i),t&&(t._masterMesh=this),this._sortLODLevels(),this}getLODLevelAtDistance(e){const t=this._internalMeshDataInfo;for(let i=0;io*n)return this.onLODLevelSelection&&this.onLODLevelSelection(n,this,this),this;for(let h=0;h0||this.hasThinInstances);this.computeWorldMatrix();const n=this.material||s.defaultMaterial;if(n){if(n._storeEffectOnSubMeshes)for(const h of this.subMeshes){const l=h.getMaterial();if(l){if(l._storeEffectOnSubMeshes){if(!l.isReadyForSubMesh(this,h,r))return!1}else if(!l.isReady(this,r))return!1}}else if(!n.isReady(this,r))return!1}const o=i.currentRenderPassId;for(const h of this.lightSources){const l=h.getShadowGenerators();if(!l)continue;const c=l.values();for(let u=c.next();u.done!==!0;u=c.next()){const f=u.value;if(f&&(!f.getShadowMap()?.renderList||f.getShadowMap()?.renderList&&f.getShadowMap()?.renderList?.indexOf(this)!==-1)){const g=f.getShadowMap().renderPassIds??[i.currentRenderPassId];for(let p=0;p0){const i=this.getIndices();if(!i)return null;const s=i.length;let r=!1;if(e)r=!0;else for(const n of this.subMeshes){if(n.indexStart+n.indexCount>s){r=!0;break}if(n.verticesStart+n.verticesCount>t){r=!0;break}}if(!r)return this.subMeshes[0]}return this.releaseSubMeshes(),new zt(0,0,t,0,this.getTotalIndices()||(this.isUnIndexed?t:0),this)}subdivide(e){if(e<1)return;const t=this.getTotalIndices();let i=t/e|0,s=0;for(;i%3!==0;)i++;this.releaseSubMeshes();for(let r=0;r=t);r++)zt.CreateFromIndices(0,s,r===e-1?t-s:i,this,void 0,!1),s+=i;this.refreshBoundingInfo(),this.synchronizeInstances()}setVerticesData(e,t,i=!1,s){if(this._geometry)this._geometry.setVerticesData(e,t,i,s);else{const r=new $;r.set(t,e);const n=this.getScene();new Tt(Tt.RandomId(),n,r,i,this)}return this}removeVerticesData(e){this._geometry&&this._geometry.removeVerticesData(e)}markVerticesDataAsUpdatable(e,t=!0){const i=this.getVertexBuffer(e);!i||i.isUpdatable()===t||this.setVerticesData(e,this.getVerticesData(e),t)}setVerticesBuffer(e,t=!0,i=null){return this._geometry||(this._geometry=Tt.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(e,i,t),this}updateVerticesData(e,t,i,s){return this._geometry?(s?(this.makeGeometryUnique(),this.updateVerticesData(e,t,i,!1)):this._geometry.updateVerticesData(e,t,i),this):this}updateMeshPositions(e,t=!0){const i=this.getVerticesData(b.PositionKind);if(!i)return this;if(e(i),this.updateVerticesData(b.PositionKind,i,!1,!1),t){const s=this.getIndices(),r=this.getVerticesData(b.NormalKind);if(!r)return this;$.ComputeNormals(i,s,r),this.updateVerticesData(b.NormalKind,r,!1,!1)}return this}makeGeometryUnique(){if(!this._geometry)return this;if(this._geometry.meshes.length===1)return this;const e=this._geometry,t=this._geometry.copy(Tt.RandomId());return e.releaseForMesh(this,!0),t.applyToMesh(this),this}setIndexBuffer(e,t,i,s=null){let r=this._geometry;r||(r=new Tt(Tt.RandomId(),this.getScene(),void 0,void 0,this)),r.setIndexBuffer(e,t,i,s)}setIndices(e,t=null,i=!1,s=!1){if(this._geometry)this._geometry.setIndices(e,t,i,s);else{const r=new $;r.indices=e;const n=this.getScene();new Tt(Tt.RandomId(),n,r,i,this,t)}return this}updateIndices(e,t,i=!1){return this._geometry?(this._geometry.updateIndices(e,t,i),this):this}toLeftHanded(){return this._geometry?(this._geometry.toLeftHanded(),this):this}_bind(e,t,i,s=!0){if(!this._geometry)return this;const r=this.getScene().getEngine();let n;if(this._unIndexed)this._getRenderingFillMode(i)===F.WireFrameFillMode?n=e._getLinesIndexBuffer(this.getIndices(),r):n=null;else switch(this._getRenderingFillMode(i)){case F.PointFillMode:n=null;break;case F.WireFrameFillMode:n=e._getLinesIndexBuffer(this.getIndices(),r);break;default:case F.TriangleFillMode:n=this._geometry.getIndexBuffer();break}return this._bindDirect(t,n,s)}_bindDirect(e,t,i=!0){if(!this._geometry)return this;if(this.morphTargetManager&&this.morphTargetManager.isUsingTextureForTargets&&this.morphTargetManager._bind(e),!i||!this._userInstancedBuffersStorage||this.hasThinInstances)this._geometry._bind(e,t);else{if(this._instanceDataStorage.engine.isWebGPU&&this._userInstancedBuffersStorage.renderPasses&&this._userInstancedBuffersStorage.renderPasses[this._instanceDataStorage.engine.currentRenderPassId]){const s=this._userInstancedBuffersStorage.renderPasses[this._instanceDataStorage.engine.currentRenderPassId];for(const r in s)this._userInstancedBuffersStorage.vertexBuffers[r]=s[r]}this._geometry._bind(e,t,this._userInstancedBuffersStorage.vertexBuffers,this._userInstancedBuffersStorage.vertexArrayObjects)}return this}_draw(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._internalMeshDataInfo._onBeforeDrawObservable&&this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);const r=this.getScene().getEngine(),n=r._currentMaterialContext,o=n&&n.useVertexPulling;return this._unIndexed&&t!==F.WireFrameFillMode||t==F.PointFillMode?r.drawArraysType(t,e.verticesStart,e.verticesCount,this.forcedInstanceCount||i):t==F.WireFrameFillMode?r.drawElementsType(t,0,e._linesIndexCount,this.forcedInstanceCount||i):o?r.drawArraysType(t,e.indexStart,e.indexCount,this.forcedInstanceCount||i):r.drawElementsType(t,e.indexStart,e.indexCount,this.forcedInstanceCount||i),this}registerBeforeRender(e){return this.onBeforeRenderObservable.add(e),this}unregisterBeforeRender(e){return this.onBeforeRenderObservable.removeCallback(e),this}registerAfterRender(e){return this.onAfterRenderObservable.add(e),this}unregisterAfterRender(e){return this.onAfterRenderObservable.removeCallback(e),this}_getInstancesRenderList(e,t=!1){const i=this._getInstanceDataStorage();if(this._instanceDataStorage.isFrozen){if(t)return i.batchCacheReplacementModeInFrozenMode.hardwareInstancedRendering[e]=!1,i.batchCacheReplacementModeInFrozenMode.renderSelf[e]=!0,i.batchCacheReplacementModeInFrozenMode;if(i.previousBatch)return i.previousBatch}const s=this.getScene(),r=s._isInIntermediateRendering(),n=r?this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate:this._internalAbstractMeshDataInfo._onlyForInstances,o=i.batchCache;if(o.mustReturn=!1,o.renderSelf[e]=t||!n&&this.isEnabled()&&this.isVisible,o.visibleInstances[e]=null,i.visibleInstances&&!t){const h=i.visibleInstances,l=s.getRenderId(),c=r?h.intermediateDefaultRenderId:h.defaultRenderId;o.visibleInstances[e]=h[l],!o.visibleInstances[e]&&c&&(o.visibleInstances[e]=h[c])}return o.hardwareInstancedRendering[e]=!t&&this._instanceDataStorage.hardwareInstancedRendering&&o.visibleInstances[e]!==null&&o.visibleInstances[e]!==void 0,i.previousBatch=o,o}_updateInstancedBuffers(e,t,i,s,r,n){const o=t.visibleInstances[e._id],h=o?o.length:0,l=t.parent,c=this._instanceDataStorage;let u=l.instancesBuffer,f=l.instancesPreviousBuffer,d=0,g=0;const p=t.renderSelf[e._id],m=this._scene.floatingOriginOffset,A=!u||i!==l.instancesBufferSize||this._scene.needsPreviousWorldMatrices&&!l.instancesPreviousBuffer;if(!this._instanceDataStorage.manualUpdate&&(!c.isFrozen||A)){const E=this.getWorldMatrix();if(p&&(this._scene.needsPreviousWorldMatrices&&(c.masterMeshPreviousWorldMatrix?(c.masterMeshPreviousWorldMatrix.copyToArray(l.instancesPreviousData,d),c.masterMeshPreviousWorldMatrix.copyFrom(E)):(c.masterMeshPreviousWorldMatrix=E.clone(),c.masterMeshPreviousWorldMatrix.copyToArray(l.instancesPreviousData,d))),E.copyToArray(l.instancesData,d),l.instancesData[d+12]-=m.x,l.instancesData[d+13]-=m.y,l.instancesData[d+14]-=m.z,d+=16,g++),o){if(ne.INSTANCEDMESH_SORT_TRANSPARENT&&this._scene.activeCamera&&e.getMaterial()?.needAlphaBlendingForMesh(e.getRenderingMesh())){const I=this._scene.activeCamera.globalPosition;for(let M=0;MM._distanceToCamera>C._distanceToCamera?-1:M._distanceToCamera1&&s.activeCamera===s.activeCameras[0]||r<=1)&&this._checkOcclusionQuery()&&!this._occlusionDataStorage.forceRenderingWhenOccluded)return this;const o=this._getInstancesRenderList(e._id,!!i);if(o.mustReturn)return this;if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;const h=s.getEngine();let l=0,c=null;this.ignoreCameraMaxZ&&s.activeCamera&&!s._isInIntermediateRendering()&&(l=s.activeCamera.maxZ,c=s.activeCamera,s.activeCamera.maxZ=0,s.updateTransformMatrix(!0)),this._internalMeshDataInfo._onBeforeRenderObservable&&this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);const u=e.getRenderingMesh(),f=o.hardwareInstancedRendering[e._id]||u.hasThinInstances||!!this._userInstancedBuffersStorage&&!e.getMesh()._internalAbstractMeshDataInfo._actAsRegularMesh,d=this._instanceDataStorage,g=e.getMaterial();if(!g)return c&&(c.maxZ=l,s.updateTransformMatrix(!0)),this;if(!d.isFrozen||!this._internalMeshDataInfo._effectiveMaterial||this._internalMeshDataInfo._effectiveMaterial!==g){if(g._storeEffectOnSubMeshes){if(!g.isReadyForSubMesh(this,e,f))return c&&(c.maxZ=l,s.updateTransformMatrix(!0)),this}else if(!g.isReady(this,f))return c&&(c.maxZ=l,s.updateTransformMatrix(!0)),this;this._internalMeshDataInfo._effectiveMaterial=g}else if(g._storeEffectOnSubMeshes&&!e._drawWrapper?._wasPreviouslyReady||!g._storeEffectOnSubMeshes&&!g._getDrawWrapper()._wasPreviouslyReady)return c&&(c.maxZ=l,s.updateTransformMatrix(!0)),this;if(t){const S=this._internalMeshDataInfo._effectiveMaterial;if(S.alphaModes.length===1)h.setAlphaMode(S.alphaMode);else for(let L=0;LA&&s++,C!==0&&I++,E+=C,A=C}if(l[I]++,I>n&&(n=I),E===0)r++;else{const M=1/E;let C=0;for(let x=0;xc&&o++}}const u=this.skeleton.bones.length,f=this.getVerticesData(b.MatricesIndicesKind),d=this.getVerticesData(b.MatricesIndicesExtraKind);let g=0;for(let m=0;m=u||E<0)&&g++}const p="Number of Weights = "+i/4+` +Maximum influences = `+n+` +Missing Weights = `+r+` +Not Sorted = `+s+` +Not Normalized = `+o+` +WeightCounts = [`+l+`] +Number of bones = `+u+` +Bad Bone Indices = `+g;return{skinned:!0,valid:r===0&&o===0&&g===0,report:p}}_checkDelayState(){const e=this.getScene();return this._geometry?this._geometry.load(e):this.delayLoadState===4&&(this.delayLoadState=2,this._queueLoad(e)),this}_queueLoad(e){e.addPendingData(this);const t=this.delayLoadingFile.indexOf(".babylonbinarymeshdata")!==-1;return se.LoadFile(this.delayLoadingFile,i=>{i instanceof ArrayBuffer?this._delayLoadingFunction(i,this):this._delayLoadingFunction(JSON.parse(i),this);for(const s of this.instances)s.refreshBoundingInfo(),s._syncSubMeshes();this.delayLoadState=1,e.removePendingData(this)},()=>{},e.offlineProvider,t),this}isInFrustum(e){return this.delayLoadState===2||!super.isInFrustum(e)?!1:(this._checkDelayState(),!0)}setMaterialById(e){const t=this.getScene().materials;let i;for(i=t.length-1;i>-1;i--)if(t[i].id===e)return this.material=t[i],this;const s=this.getScene().multiMaterials;for(i=s.length-1;i>-1;i--)if(s[i].id===e)return this.material=s[i],this;return this}getAnimatables(){const e=[];return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e}bakeTransformIntoVertices(e){if(!this.isVerticesDataPresent(b.PositionKind))return this;const t=this.subMeshes.splice(0);this._resetPointsArrayCache();let i=this.getVerticesData(b.PositionKind);const s=_.Zero();let r;for(r=0;r{const f=u.width,d=u.height,p=this.getEngine().createCanvas(f,d).getContext("2d");p.drawImage(u,0,0);const m=p.getImageData(0,0,f,d).data;this.applyDisplacementMapFromBuffer(m,f,d,t,i,r,n,o),s&&s(this)};return se.LoadImage(e,c,h||(()=>{}),l.offlineProvider),this}applyDisplacementMapFromBuffer(e,t,i,s,r,n,o,h=!1){if(!this.isVerticesDataPresent(b.PositionKind)||!this.isVerticesDataPresent(b.NormalKind)||!this.isVerticesDataPresent(b.UVKind))return w.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing"),this;const l=this.getVerticesData(b.PositionKind,!0,!0),c=this.getVerticesData(b.NormalKind),u=this.getVerticesData(b.UVKind);let f=_.Zero();const d=_.Zero(),g=Q.Zero();n=n||Q.Zero(),o=o||new Q(1,1);for(let p=0;p!this.getVertexBuffer(h)?.getIsInstanced()),i=this.getIndices(!1,!0),s={},r=(h,l)=>{const c=new Float32Array(i.length*l);let u=0;for(let f=0;f{const o=s.length-1-n,h=s[o];for(let l=0;l{for(let o=0;o-1&&(s._waitingMorphTargetManagerId=e.morphTargetManagerId),e.skeletonId!==void 0&&e.skeletonId!==null&&(s.skeleton=t.getLastSkeletonById(e.skeletonId),e.numBoneInfluencers&&(s.numBoneInfluencers=e.numBoneInfluencers)),e.animations){for(let r=0;r4,l=h?this.getVerticesData(b.MatricesIndicesExtraKind):null,c=h?this.getVerticesData(b.MatricesWeightsExtraKind):null,u=e.getTransformMatrices(this),f=_.Zero(),d=new P,g=new P;let p=0,m;for(let A=0;A0&&(P.FromFloat32ArrayToRefScaled(u,Math.floor(n[p+m]*16),E,g),d.addToSelf(g));if(h)for(m=0;m<4;m++)E=c[p+m],E>0&&(P.FromFloat32ArrayToRefScaled(u,Math.floor(l[p+m]*16),E,g),d.addToSelf(g));_.TransformCoordinatesFromFloatsToRef(i._sourcePositions[A],i._sourcePositions[A+1],i._sourcePositions[A+2],d,f),f.toArray(s,A),t&&(_.TransformNormalFromFloatsToRef(i._sourceNormals[A],i._sourceNormals[A+1],i._sourceNormals[A+2],d,f),f.toArray(r,A)),d.reset()}return this.updateVerticesData(b.PositionKind,s),t&&this.updateVerticesData(b.NormalKind,r),this}static MinMax(e){let t=null,i=null;for(const s of e){const n=s.getBoundingInfo().boundingBox;!t||!i?(t=n.minimumWorld.clone(),i=n.maximumWorld.clone()):(t.minimizeInPlace(n.minimumWorld),i.maximizeInPlace(n.maximumWorld))}return!t||!i?{min:_.Zero(),max:_.Zero()}:{min:t,max:i}}static Center(e){const t=e instanceof Array?ne.MinMax(e):e;return _.Center(t.min,t.max)}static MergeMeshes(e,t=!0,i,s,r,n){return Un(ne._MergeMeshesCoroutine(e,t,i,s,r,n,!1))}static async MergeMeshesAsync(e,t=!0,i,s,r,n){return await Cc(ne._MergeMeshesCoroutine(e,t,i,s,r,n,!0),Mc())}static*_MergeMeshesCoroutine(e,t=!0,i,s,r,n,o){if(e=e.filter(Boolean),e.length===0)return null;let h;if(!i){let S=0;for(h=0;h=65536)return w.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),null}n&&(r=!1);const l=new Array,c=new Array,u=new Array,f=e[0].sideOrientation;for(h=0;hMath.max(N,D.start+D.count),0);if(S.material){const N=S.material;if(N instanceof Ts){for(let D=0;D{const L=S.computeWorldMatrix(!0);return{vertexData:$.ExtractFromMesh(S,!1,!1),transform:L}},{vertexData:p,transform:m}=g(d);o&&(yield);const A=new Array(e.length-1);for(let S=1;S{throw ie("GroundMesh")};ne._GoldbergMeshParser=(a,e)=>{throw ie("GoldbergMesh")};ne._LinesMeshParser=(a,e)=>{throw ie("LinesMesh")};ne._GreasedLineMeshParser=(a,e)=>{throw ie("GreasedLineMesh")};ne._GreasedLineRibbonMeshParser=(a,e)=>{throw ie("GreasedLineRibbonMesh")};ne._TrailMeshParser=(a,e)=>{throw ie("TrailMesh")};nt("BABYLON.Mesh",ne);class te{}te.POINTERDOWN=1;te.POINTERUP=2;te.POINTERMOVE=4;te.POINTERWHEEL=8;te.POINTERPICK=16;te.POINTERTAP=32;te.POINTERDOUBLETAP=64;class Th{constructor(e,t){this.type=e,this.event=t}}class uu extends Th{constructor(e,t,i,s){super(e,t),this.ray=null,this.originalPickingInfo=null,this.skipOnPointerObservable=!1,this.localPosition=new Q(i,s)}}class kt extends Th{get pickInfo(){return this._pickInfo||this._generatePickInfo(),this._pickInfo}constructor(e,t,i,s=null){super(e,t),this._pickInfo=i,this._inputManager=s}_generatePickInfo(){this._inputManager&&(this._pickInfo=this._inputManager._pickMove(this.event),this._inputManager._setRayOnPointerInfo(this._pickInfo,this.event),this._inputManager=null)}}class du{constructor(){this._zoomStopsAnimation=!1,this._idleRotationSpeed=.05,this._idleRotationWaitTime=2e3,this._idleRotationSpinupTime=2e3,this.targetAlpha=null,this._attachedCamera=null,this._isPointerDown=!1,this._lastFrameTime=null,this._lastInteractionTime=-1/0,this._cameraRotationSpeed=0,this._lastFrameRadius=0}get name(){return"AutoRotation"}set zoomStopsAnimation(e){this._zoomStopsAnimation=e}get zoomStopsAnimation(){return this._zoomStopsAnimation}set idleRotationSpeed(e){this._idleRotationSpeed=e}get idleRotationSpeed(){return this._idleRotationSpeed}set idleRotationWaitTime(e){this._idleRotationWaitTime=e}get idleRotationWaitTime(){return this._idleRotationWaitTime}set idleRotationSpinupTime(e){this._idleRotationSpinupTime=e}get idleRotationSpinupTime(){return this._idleRotationSpinupTime}get rotationInProgress(){return Math.abs(this._cameraRotationSpeed)>0}get attachedNode(){return this._attachedCamera}init(){}attach(e){this._attachedCamera=e;const t=this._attachedCamera.getScene();this._onPrePointerObservableObserver=t.onPrePointerObservable.add(i=>{if(i.type===te.POINTERDOWN){this._isPointerDown=!0;return}i.type===te.POINTERUP&&(this._isPointerDown=!1)}),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add(()=>{if(this._reachTargetAlpha())return;const i=vt.Now;let s=0;this._lastFrameTime!=null&&(s=i-this._lastFrameTime),this._lastFrameTime=i,this._applyUserInteraction();const r=i-this._lastInteractionTime-this._idleRotationWaitTime,n=Math.max(Math.min(r/this._idleRotationSpinupTime,1),0);this._cameraRotationSpeed=this._idleRotationSpeed*n,this._attachedCamera&&(this._attachedCamera.alpha-=this._cameraRotationSpeed*(s/1e3))})}detach(){if(!this._attachedCamera)return;const e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._attachedCamera=null,this._lastFrameTime=null}resetLastInteractionTime(e){this._lastInteractionTime=e??vt.Now}_reachTargetAlpha(){return this._attachedCamera&&this.targetAlpha?Math.abs(this._attachedCamera.alpha-this.targetAlpha)=.5?(1-this.easeInCore((1-e)*2))*.5+.5:this.easeInCore(e*2)*.5}}bt.EASINGMODE_EASEIN=0;bt.EASINGMODE_EASEOUT=1;bt.EASINGMODE_EASEINOUT=2;class T_ extends bt{easeInCore(e){return e=Math.max(0,Math.min(1,e)),1-Math.sqrt(1-e*e)}}class _u extends bt{constructor(e=1){super(),this.amplitude=e}easeInCore(e){const t=Math.max(0,this.amplitude);return Math.pow(e,3)-e*t*Math.sin(3.141592653589793*e)}}class b_ extends bt{constructor(e=3,t=2){super(),this.bounces=e,this.bounciness=t}easeInCore(e){const t=Math.max(0,this.bounces);let i=this.bounciness;i<=1&&(i=1.001);const s=Math.pow(i,t),r=1-i,n=(1-s)/r+s*.5,o=e*n,h=Math.log(-o*(1-i)+1)/Math.log(i),l=Math.floor(h),c=l+1,u=(1-Math.pow(i,l))/(r*n),f=(1-Math.pow(i,c))/(r*n),d=(u+f)*.5,g=e-d,p=d-u;return-Math.pow(1/i,t-l)/(p*p)*(g-p)*(g+p)}}class E_ extends bt{easeInCore(e){return e*e*e}}class A_ extends bt{constructor(e=3,t=3){super(),this.oscillations=e,this.springiness=t}easeInCore(e){let t;const i=Math.max(0,this.oscillations),s=Math.max(0,this.springiness);return s==0?t=e:t=(Math.exp(s*e)-1)/(Math.exp(s)-1),t*Math.sin((6.283185307179586*i+1.5707963267948966)*e)}}class gu extends bt{constructor(e=2){super(),this.exponent=e}easeInCore(e){return this.exponent<=0?e:(Math.exp(this.exponent*e)-1)/(Math.exp(this.exponent)-1)}}class R_ extends bt{constructor(e=0,t=0,i=1,s=1){super(),this.x1=e,this.y1=t,this.x2=i,this.y2=s}easeInCore(e){return fu.Interpolate(e,this.x1,this.y1,this.x2,this.y2)}}class Hr{constructor(e,t,i){this.name=e,this.from=t,this.to=i}clone(){return new Hr(this.name,this.from,this.to)}}const pu=Object.freeze(new W(0,0,0,0)),mu=Object.freeze(_.Zero()),Tu=Object.freeze(Q.Zero()),bu=Object.freeze(Ft.Zero()),Eu=Object.freeze(q.Black()),Au=Object.freeze(new fe(0,0,0,0)),Zt={key:0,repeatCount:0,loopMode:2};class k{static _PrepareAnimation(e,t,i,s,r,n,o,h){let l;if(!isNaN(parseFloat(r))&&isFinite(r)?l=k.ANIMATIONTYPE_FLOAT:r instanceof W?l=k.ANIMATIONTYPE_QUATERNION:r instanceof _?l=k.ANIMATIONTYPE_VECTOR3:r instanceof Q?l=k.ANIMATIONTYPE_VECTOR2:r instanceof q?l=k.ANIMATIONTYPE_COLOR3:r instanceof fe?l=k.ANIMATIONTYPE_COLOR4:r instanceof Ft&&(l=k.ANIMATIONTYPE_SIZE),l==null)return null;const c=new k(e,t,i,l,o),u=[{frame:0,value:r},{frame:s,value:n}];return c.setKeys(u),h!==void 0&&c.setEasingFunction(h),c}static CreateAnimation(e,t,i,s){const r=new k(e+"Animation",e,i,t,k.ANIMATIONLOOPMODE_CONSTANT);return r.setEasingFunction(s),r}static CreateAndStartAnimation(e,t,i,s,r,n,o,h,l,c,u){const f=k._PrepareAnimation(e,i,s,r,n,o,h,l);return!f||(t.getScene&&(u=t.getScene()),!u)?null:u.beginDirectAnimation(t,[f],0,r,f.loopMode!==k.ANIMATIONLOOPMODE_CONSTANT,1,c)}static CreateAndStartHierarchyAnimation(e,t,i,s,r,n,o,h,l,c,u){const f=k._PrepareAnimation(e,s,r,n,o,h,l,c);return f?t.getScene().beginDirectHierarchyAnimation(t,i,[f],0,n,f.loopMode===1,1,u):null}static CreateMergeAndStartAnimation(e,t,i,s,r,n,o,h,l,c){const u=k._PrepareAnimation(e,i,s,r,n,o,h,l);return u?(t.animations.push(u),t.getScene().beginAnimation(t,0,r,u.loopMode===1,1,c)):null}static MakeAnimationAdditive(e,t,i,s=!1,r){let n;typeof t=="object"?n=t:n={referenceFrame:t??0,range:i,cloneOriginalAnimation:s,clonedAnimationName:r};let o=e;if(n.cloneOriginalAnimation&&(o=e.clone(),o.name=n.clonedAnimationName||o.name),!o._keys.length)return o;const h=n.referenceFrame&&n.referenceFrame>=0?n.referenceFrame:0;let l=0;const c=o._keys[0];let u=o._keys.length-1;const f=o._keys[u],d={referenceValue:c.value,referencePosition:v.Vector3[0],referenceQuaternion:v.Quaternion[0],referenceScaling:v.Vector3[1],keyPosition:v.Vector3[2],keyQuaternion:v.Quaternion[1],keyScaling:v.Vector3[3]};let g=c.frame,p=f.frame;if(n.range){const E=o.getRange(n.range);E&&(g=E.from,p=E.to)}else g=n.fromFrame??g,p=n.toFrame??p;if(g!==c.frame&&(l=o.createKeyForFrame(g)),p!==f.frame&&(u=o.createKeyForFrame(p)),o._keys.length===1){const E=o._getKeyValue(o._keys[0]);d.referenceValue=E.clone?E.clone():E}else if(h<=c.frame){const E=o._getKeyValue(c.value);d.referenceValue=E.clone?E.clone():E}else if(h>=f.frame){const E=o._getKeyValue(f.value);d.referenceValue=E.clone?E.clone():E}else{Zt.key=0;const E=o._interpolate(h,Zt);d.referenceValue=E.clone?E.clone():E}o.dataType===k.ANIMATIONTYPE_QUATERNION?d.referenceValue.normalize().conjugateInPlace():o.dataType===k.ANIMATIONTYPE_MATRIX&&(d.referenceValue.decompose(d.referenceScaling,d.referenceQuaternion,d.referencePosition),d.referenceQuaternion.normalize().conjugateInPlace());let m=Number.MAX_VALUE;const A=n.clipKeys?[]:null;for(let E=l;E<=u;E++){let I=o._keys[E];if((A||n.cloneOriginalAnimation)&&(I={frame:I.frame,value:I.value.clone?I.value.clone():I.value,inTangent:I.inTangent,outTangent:I.outTangent,interpolation:I.interpolation,lockedTangent:I.lockedTangent},A&&(m===Number.MAX_VALUE&&(m=I.frame),I.frame-=m,A.push(I))),!(E&&o.dataType!==k.ANIMATIONTYPE_FLOAT&&I.value===c.value))switch(o.dataType){case k.ANIMATIONTYPE_MATRIX:I.value.decompose(d.keyScaling,d.keyQuaternion,d.keyPosition),d.keyPosition.subtractInPlace(d.referencePosition),d.keyScaling.divideInPlace(d.referenceScaling),d.referenceQuaternion.multiplyToRef(d.keyQuaternion,d.keyQuaternion),P.ComposeToRef(d.keyScaling,d.keyQuaternion,d.keyPosition,I.value);break;case k.ANIMATIONTYPE_QUATERNION:d.referenceValue.multiplyToRef(I.value,I.value);break;case k.ANIMATIONTYPE_VECTOR2:case k.ANIMATIONTYPE_VECTOR3:case k.ANIMATIONTYPE_COLOR3:case k.ANIMATIONTYPE_COLOR4:I.value.subtractToRef(d.referenceValue,I.value);break;case k.ANIMATIONTYPE_SIZE:I.value.width-=d.referenceValue.width,I.value.height-=d.referenceValue.height;break;default:I.value-=d.referenceValue}}return A&&o.setKeys(A,!0),o}static TransitionTo(e,t,i,s,r,n,o,h=null,l=!0,c){if(o<=0)return i[e]=t,h&&h(),null;const u=r*(o/1e3);return n.setKeys(c??[{frame:0,value:i[e].clone?i[e].clone():i[e]},{frame:u,value:t}]),i.animations||(i.animations=[]),i.animations.push(n),s.beginAnimation(i,0,u,!1,1,h??void 0,void 0,l)}get runtimeAnimations(){return this._runtimeAnimations}get hasRunningRuntimeAnimations(){for(const e of this._runtimeAnimations)if(!e.isStopped())return!0;return!1}constructor(e,t,i,s,r,n){this.name=e,this.targetProperty=t,this.framePerSecond=i,this.dataType=s,this.loopMode=r,this.enableBlending=n,this._easingFunction=null,this._runtimeAnimations=new Array,this._events=new Array,this.blendingSpeed=.01,this._ranges={},this._coreAnimation=null,this.targetPropertyPath=t.split("."),this.dataType=s,this.loopMode=r===void 0?k.ANIMATIONLOOPMODE_CYCLE:r,this.uniqueId=k._UniqueIdGenerator++}toString(e){let t="Name: "+this.name+", property: "+this.targetProperty;if(t+=", datatype: "+["Float","Vector3","Quaternion","Matrix","Color3","Vector2"][this.dataType],t+=", nKeys: "+(this._keys?this._keys.length:"none"),t+=", nRanges: "+(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";let i=!0;for(const s in this._ranges)i&&(t+=", ",i=!1),t+=s;t+="}"}return t}addEvent(e){this._events.push(e),this._events.sort((t,i)=>t.frame-i.frame)}removeEvents(e){for(let t=0;t=0;n--)this._keys[n].frame>=s&&this._keys[n].frame<=r&&this._keys.splice(n,1)}this._ranges[e]=null}}getRange(e){return this._ranges[e]}getKeys(){return this._keys}getHighestFrame(){let e=0;for(let t=0,i=this._keys.length;t0)return t.highLimitValue.clone?t.highLimitValue.clone():t.highLimitValue;const s=this._keys;let r;if(this._coreAnimation)r=this._coreAnimation._key;else{const g=s.length;for(r=t.key;r>=0&&e=s[r+1].frame;)++r;if(t.key=r,r<0)return i?void 0:this._getKeyValue(s[0].value);if(r+1>g-1)return i?void 0:this._getKeyValue(s[g-1].value);this._key=r}const n=s[r],o=s[r+1];if(i&&(e===n.frame||e===o.frame))return;const h=this._getKeyValue(n.value),l=this._getKeyValue(o.value);if(n.interpolation===1)return o.frame>e?h:l;const c=n.outTangent!==void 0&&o.inTangent!==void 0,u=o.frame-n.frame;let f=(e-n.frame)/u;const d=n.easingFunction||this.getEasingFunction();switch(d&&(f=d.ease(f)),this.dataType){case k.ANIMATIONTYPE_FLOAT:{const g=c?this.floatInterpolateFunctionWithTangents(h,n.outTangent*u,l,o.inTangent*u,f):this.floatInterpolateFunction(h,l,f);switch(t.loopMode){case k.ANIMATIONLOOPMODE_CYCLE:case k.ANIMATIONLOOPMODE_CONSTANT:case k.ANIMATIONLOOPMODE_YOYO:return g;case k.ANIMATIONLOOPMODE_RELATIVE:case k.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return(t.offsetValue??0)*t.repeatCount+g}break}case k.ANIMATIONTYPE_QUATERNION:{const g=c?this.quaternionInterpolateFunctionWithTangents(h,n.outTangent.scale(u),l,o.inTangent.scale(u),f):this.quaternionInterpolateFunction(h,l,f);switch(t.loopMode){case k.ANIMATIONLOOPMODE_CYCLE:case k.ANIMATIONLOOPMODE_CONSTANT:case k.ANIMATIONLOOPMODE_YOYO:return g;case k.ANIMATIONLOOPMODE_RELATIVE:case k.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return g.addInPlace((t.offsetValue||pu).scale(t.repeatCount))}return g}case k.ANIMATIONTYPE_VECTOR3:{const g=c?this.vector3InterpolateFunctionWithTangents(h,n.outTangent.scale(u),l,o.inTangent.scale(u),f):this.vector3InterpolateFunction(h,l,f);switch(t.loopMode){case k.ANIMATIONLOOPMODE_CYCLE:case k.ANIMATIONLOOPMODE_CONSTANT:case k.ANIMATIONLOOPMODE_YOYO:return g;case k.ANIMATIONLOOPMODE_RELATIVE:case k.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return g.add((t.offsetValue||mu).scale(t.repeatCount))}break}case k.ANIMATIONTYPE_VECTOR2:{const g=c?this.vector2InterpolateFunctionWithTangents(h,n.outTangent.scale(u),l,o.inTangent.scale(u),f):this.vector2InterpolateFunction(h,l,f);switch(t.loopMode){case k.ANIMATIONLOOPMODE_CYCLE:case k.ANIMATIONLOOPMODE_CONSTANT:case k.ANIMATIONLOOPMODE_YOYO:return g;case k.ANIMATIONLOOPMODE_RELATIVE:case k.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return g.add((t.offsetValue||Tu).scale(t.repeatCount))}break}case k.ANIMATIONTYPE_SIZE:{switch(t.loopMode){case k.ANIMATIONLOOPMODE_CYCLE:case k.ANIMATIONLOOPMODE_CONSTANT:case k.ANIMATIONLOOPMODE_YOYO:return this.sizeInterpolateFunction(h,l,f);case k.ANIMATIONLOOPMODE_RELATIVE:case k.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return this.sizeInterpolateFunction(h,l,f).add((t.offsetValue||bu).scale(t.repeatCount))}break}case k.ANIMATIONTYPE_COLOR3:{const g=c?this.color3InterpolateFunctionWithTangents(h,n.outTangent.scale(u),l,o.inTangent.scale(u),f):this.color3InterpolateFunction(h,l,f);switch(t.loopMode){case k.ANIMATIONLOOPMODE_CYCLE:case k.ANIMATIONLOOPMODE_CONSTANT:case k.ANIMATIONLOOPMODE_YOYO:return g;case k.ANIMATIONLOOPMODE_RELATIVE:case k.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return g.add((t.offsetValue||Eu).scale(t.repeatCount))}break}case k.ANIMATIONTYPE_COLOR4:{const g=c?this.color4InterpolateFunctionWithTangents(h,n.outTangent.scale(u),l,o.inTangent.scale(u),f):this.color4InterpolateFunction(h,l,f);switch(t.loopMode){case k.ANIMATIONLOOPMODE_CYCLE:case k.ANIMATIONLOOPMODE_CONSTANT:case k.ANIMATIONLOOPMODE_YOYO:return g;case k.ANIMATIONLOOPMODE_RELATIVE:case k.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return g.add((t.offsetValue||Au).scale(t.repeatCount))}break}case k.ANIMATIONTYPE_MATRIX:{switch(t.loopMode){case k.ANIMATIONLOOPMODE_CYCLE:case k.ANIMATIONLOOPMODE_CONSTANT:case k.ANIMATIONLOOPMODE_YOYO:return k.AllowMatricesInterpolation?this.matrixInterpolateFunction(h,l,f,t.workValue):h;case k.ANIMATIONLOOPMODE_RELATIVE:case k.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT:return h}break}}return 0}matrixInterpolateFunction(e,t,i,s){return k.AllowMatrixDecomposeForInterpolation?s?(P.DecomposeLerpToRef(e,t,i,s),s):P.DecomposeLerp(e,t,i):s?(P.LerpToRef(e,t,i,s),s):P.Lerp(e,t,i)}clone(){const e=new k(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);if(e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed,this._keys&&e.setKeys(this._keys),this._ranges){e._ranges={};for(const t in this._ranges){const i=this._ranges[t];i&&(e._ranges[t]=i.clone())}}return e}setKeys(e,t=!1){this._keys=t?e:e.slice(0)}createKeyForFrame(e){Zt.key=0;const t=this._interpolate(e,Zt,!0);if(!t)return this._keys[Zt.key].frame===e?Zt.key:Zt.key+1;const i={frame:e,value:t.clone?t.clone():t};return this._keys.splice(Zt.key+1,0,i),Zt.key+1}serialize(){const e={};e.name=this.name,e.property=this.targetProperty,e.framePerSecond=this.framePerSecond,e.dataType=this.dataType,e.loopBehavior=this.loopMode,e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed;const t=this.dataType;e.keys=[];const i=this.getKeys();for(let s=0;s=2&&(h=o.values[1]),o.values.length>=3&&(l=o.values[2]),o.values.length>=4&&(c=o.values[3]);break;case k.ANIMATIONTYPE_QUATERNION:if(r=W.FromArray(o.values),o.values.length>=8){const f=W.FromArray(o.values.slice(4,8));f.equals(W.Zero())||(h=f)}if(o.values.length>=12){const f=W.FromArray(o.values.slice(8,12));f.equals(W.Zero())||(l=f)}o.values.length>=13&&(c=o.values[12]);break;case k.ANIMATIONTYPE_MATRIX:r=P.FromArray(o.values),o.values.length>=17&&(c=o.values[16]);break;case k.ANIMATIONTYPE_COLOR3:r=q.FromArray(o.values),o.values[3]&&(h=q.FromArray(o.values[3])),o.values[4]&&(l=q.FromArray(o.values[4])),o.values[5]&&(c=o.values[5]);break;case k.ANIMATIONTYPE_COLOR4:r=fe.FromArray(o.values),o.values[4]&&(h=fe.FromArray(o.values[4])),o.values[5]&&(l=fe.FromArray(o.values[5])),o.values[6]&&(c=fe.FromArray(o.values[6]));break;case k.ANIMATIONTYPE_VECTOR3:default:r=_.FromArray(o.values),o.values[3]&&(h=_.FromArray(o.values[3])),o.values[4]&&(l=_.FromArray(o.values[4])),o.values[5]&&(c=o.values[5]);break}const u={};u.frame=o.frame,u.value=r,h!=null&&(u.inTangent=h),l!=null&&(u.outTangent=l),c!=null&&(u.interpolation=c),s.push(u)}if(t.setKeys(s),e.ranges)for(n=0;n{const r=new gt;r.addEventListener("readystatechange",()=>{if(r.readyState==4)if(r.status==200){let n=JSON.parse(r.responseText);if(n.animations&&(n=n.animations),n.length){const o=[];for(const h of n)o.push(this.Parse(h));i(o)}else{const o=this.Parse(n);e&&(o.name=e),i(o)}}else s("Unable to load the animation")}),r.open("GET",t),r.send()})}static async ParseFromSnippetAsync(e){return await new Promise((t,i)=>{const s=new gt;s.addEventListener("readystatechange",()=>{if(s.readyState==4)if(s.status==200){const r=JSON.parse(JSON.parse(s.responseText).jsonPayload);if(r.animations){const n=JSON.parse(r.animations),o=[];for(const h of n.animations){const l=this.Parse(h);l.snippetId=e,o.push(l)}t(o)}else{const n=JSON.parse(r.animation),o=this.Parse(n);o.snippetId=e,t(o)}}else i("Unable to load the snippet "+e)}),s.open("GET",this.SnippetUrl+"/"+e.replace(/#/g,"/")),s.send()})}}k._UniqueIdGenerator=0;k.AllowMatricesInterpolation=!1;k.AllowMatrixDecomposeForInterpolation=!0;k.SnippetUrl="https://snippet.babylonjs.com";k.ANIMATIONTYPE_FLOAT=0;k.ANIMATIONTYPE_VECTOR3=1;k.ANIMATIONTYPE_QUATERNION=2;k.ANIMATIONTYPE_MATRIX=3;k.ANIMATIONTYPE_COLOR3=4;k.ANIMATIONTYPE_COLOR4=7;k.ANIMATIONTYPE_VECTOR2=5;k.ANIMATIONTYPE_SIZE=6;k.ANIMATIONLOOPMODE_RELATIVE=0;k.ANIMATIONLOOPMODE_CYCLE=1;k.ANIMATIONLOOPMODE_CONSTANT=2;k.ANIMATIONLOOPMODE_YOYO=4;k.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT=5;k.CreateFromSnippetAsync=k.ParseFromSnippetAsync;nt("BABYLON.Animation",k);qe._AnimationRangeFactory=(a,e,t)=>new Hr(a,e,t);class $i{constructor(){this.transitionDuration=450,this.lowerRadiusTransitionRange=2,this.upperRadiusTransitionRange=-2,this._autoTransitionRange=!1,this._attachedCamera=null,this._radiusIsAnimating=!1,this._radiusBounceTransition=null,this._animatables=new Array}get name(){return"Bouncing"}get autoTransitionRange(){return this._autoTransitionRange}set autoTransitionRange(e){if(this._autoTransitionRange===e)return;this._autoTransitionRange=e;const t=this._attachedCamera;t&&(e?this._onMeshTargetChangedObserver=t.onMeshTargetChangedObservable.add(i=>{if(i&&(i.computeWorldMatrix(!0),i.getBoundingInfo)){const s=i.getBoundingInfo().diagonalLength;this.lowerRadiusTransitionRange=s*.05,this.upperRadiusTransitionRange=s*.05}}):this._onMeshTargetChangedObserver&&t.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver))}get attachedNode(){return this._attachedCamera}init(){}attach(e){this._attachedCamera=e,this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add(()=>{this._attachedCamera&&(this._isRadiusAtLimit(this._attachedCamera.lowerRadiusLimit)&&this._applyBoundRadiusAnimation(this.lowerRadiusTransitionRange),this._isRadiusAtLimit(this._attachedCamera.upperRadiusLimit)&&this._applyBoundRadiusAnimation(this.upperRadiusTransitionRange))})}detach(){this._attachedCamera&&(this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null)}_isRadiusAtLimit(e){return this._attachedCamera?this._attachedCamera.radius===e&&!this._radiusIsAnimating:!1}_applyBoundRadiusAnimation(e){if(!this._attachedCamera)return;this._radiusBounceTransition||($i.EasingFunction.setEasingMode($i.EasingMode),this._radiusBounceTransition=k.CreateAnimation("radius",k.ANIMATIONTYPE_FLOAT,60,$i.EasingFunction)),this._cachedWheelPrecision=this._attachedCamera.wheelPrecision,this._attachedCamera.wheelPrecision=1/0,this._attachedCamera.inertialRadiusOffset=0,this.stopAllAnimations(),this._radiusIsAnimating=!0;const t=k.TransitionTo("radius",this._attachedCamera.radius+e,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusBounceTransition,this.transitionDuration,()=>this._clearAnimationLocks());t&&this._animatables.push(t)}_clearAnimationLocks(){this._radiusIsAnimating=!1,this._attachedCamera&&(this._attachedCamera.wheelPrecision=this._cachedWheelPrecision)}stopAllAnimations(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0].onAnimationEnd=null,this._animatables[0].stop(),this._animatables.shift()}}$i.EasingFunction=new _u(.3);$i.EasingMode=bt.EASINGMODE_EASEOUT;class yt{constructor(){this.onTargetFramingAnimationEndObservable=new O,this._mode=yt.FitFrustumSidesMode,this._radiusScale=1,this._positionScale=.5,this._defaultElevation=.3,this._elevationReturnTime=1500,this._elevationReturnWaitTime=1e3,this._zoomStopsAnimation=!1,this._framingTime=1500,this.autoCorrectCameraLimitsAndSensibility=!0,this._attachedCamera=null,this._isPointerDown=!1,this._lastInteractionTime=-1/0,this._animatables=new Array,this._betaIsAnimating=!1}get name(){return"Framing"}set mode(e){this._mode=e}get mode(){return this._mode}set radiusScale(e){this._radiusScale=e}get radiusScale(){return this._radiusScale}set positionScale(e){this._positionScale=e}get positionScale(){return this._positionScale}set defaultElevation(e){this._defaultElevation=e}get defaultElevation(){return this._defaultElevation}set elevationReturnTime(e){this._elevationReturnTime=e}get elevationReturnTime(){return this._elevationReturnTime}set elevationReturnWaitTime(e){this._elevationReturnWaitTime=e}get elevationReturnWaitTime(){return this._elevationReturnWaitTime}set zoomStopsAnimation(e){this._zoomStopsAnimation=e}get zoomStopsAnimation(){return this._zoomStopsAnimation}set framingTime(e){this._framingTime=e}get framingTime(){return this._framingTime}get attachedNode(){return this._attachedCamera}init(){}attach(e){this._attachedCamera=e;const t=this._attachedCamera.getScene();yt.EasingFunction.setEasingMode(yt.EasingMode),this._onPrePointerObservableObserver=t.onPrePointerObservable.add(i=>{if(i.type===te.POINTERDOWN){this._isPointerDown=!0;return}i.type===te.POINTERUP&&(this._isPointerDown=!1)}),this._onMeshTargetChangedObserver=e.onMeshTargetChangedObservable.add(i=>{i&&i.getBoundingInfo&&this.zoomOnMesh(i,void 0,()=>{this.onTargetFramingAnimationEndObservable.notifyObservers()})}),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add(()=>{this._applyUserInteraction(),this._maintainCameraAboveGround()})}detach(){if(!this._attachedCamera)return;const e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null}zoomOnMesh(e,t=!1,i=null){e.computeWorldMatrix(!0);const s=e.getBoundingInfo().boundingBox;this.zoomOnBoundingInfo(s.minimumWorld,s.maximumWorld,t,i)}zoomOnMeshHierarchy(e,t=!1,i=null){e.computeWorldMatrix(!0);const s=e.getHierarchyBoundingVectors(!0);this.zoomOnBoundingInfo(s.min,s.max,t,i)}zoomOnMeshesHierarchy(e,t=!1,i=null){const s=new _(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=new _(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let n=0;n{this.stopAllAnimations(),s&&s(),this._attachedCamera&&this._attachedCamera.useInputToRestoreState&&this._attachedCamera.storeState()}),c&&this._animatables.push(c),!0}_calculateLowerRadiusFromModelBoundingSphere(e,t){const i=this._attachedCamera;if(!i)return 0;let s=i._calculateLowerRadiusFromModelBoundingSphere(e,t,this._radiusScale);return i.lowerRadiusLimit&&this._mode===yt.IgnoreBoundsSizeMode&&(s=si.upperRadiusLimit?i.upperRadiusLimit:s),s}_maintainCameraAboveGround(){if(this._elevationReturnTime<0)return;const e=vt.Now-this._lastInteractionTime,t=Math.PI*.5-this._defaultElevation,i=Math.PI*.5;if(this._attachedCamera&&!this._betaIsAnimating&&this._attachedCamera.beta>i&&e>=this._elevationReturnWaitTime){this._betaIsAnimating=!0,this.stopAllAnimations(),this._betaTransition||(this._betaTransition=k.CreateAnimation("beta",k.ANIMATIONTYPE_FLOAT,60,yt.EasingFunction));const s=k.TransitionTo("beta",t,this._attachedCamera,this._attachedCamera.getScene(),60,this._betaTransition,this._elevationReturnTime,()=>{this._clearAnimationLocks(),this.stopAllAnimations()});s&&this._animatables.push(s)}}_clearAnimationLocks(){this._betaIsAnimating=!1}_applyUserInteraction(){this.isUserIsMoving&&(this._lastInteractionTime=vt.Now,this.stopAllAnimations(),this._clearAnimationLocks())}stopAllAnimations(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0]&&(this._animatables[0].onAnimationEnd=null,this._animatables[0].stop()),this._animatables.shift()}get isUserIsMoving(){return this._attachedCamera?this._attachedCamera.inertialAlphaOffset!==0||this._attachedCamera.inertialBetaOffset!==0||this._attachedCamera.inertialRadiusOffset!==0||this._attachedCamera.inertialPanningX!==0||this._attachedCamera.inertialPanningY!==0||this._isPointerDown:!1}}yt.EasingFunction=new gu;yt.EasingMode=bt.EASINGMODE_EASEINOUT;yt.IgnoreBoundsSizeMode=0;yt.FitFrustumSidesMode=1;qe.AddNodeConstructor("TargetCamera",(a,e)=>()=>new et(a,_.Zero(),e));const fr=P.Zero(),sn=W.Identity();class et extends J{constructor(e,t,i,s=!0){super(e,t,i,s),this.cameraDirection=new _(0,0,0),this.cameraRotation=new Q(0,0),this.updateUpVectorFromRotation=!1,this.speed=2,this.noRotationConstraint=!1,this.invertRotation=!1,this.inverseRotationSpeed=.2,this._panningEpsilon=Me,this._rotationEpsilon=Me,this.lockedTarget=null,this._currentTarget=_.Zero(),this._initialFocalDistance=1,this._viewMatrix=P.Zero(),this._cameraTransformMatrix=P.Zero(),this._cameraRotationMatrix=P.Zero(),this._transformedReferencePoint=_.Zero(),this._deferredPositionUpdate=new _,this._deferredRotationQuaternionUpdate=new W,this._deferredRotationUpdate=new _,this._deferredUpdated=!1,this._deferOnly=!1,this._cachedRotationZ=0,this._cachedQuaternionRotationZ=0,this._referencePoint=_.Forward(this.getScene().useRightHandedSystem),this.rotation=new _(0,this.getScene().useRightHandedSystem?Math.PI:0,0)}getFrontPosition(e){this.getWorldMatrix();const t=v.Vector3[0],i=v.Vector3[1];return i.set(0,0,this._scene.useRightHandedSystem?-1:1),this.getDirectionToRef(i,t),t.scaleInPlace(e),this.globalPosition.add(t)}_getLockedTargetPosition(){if(!this.lockedTarget)return null;if(this.lockedTarget.absolutePosition){const e=this.lockedTarget;e.computeWorldMatrix().getTranslationToRef(e.absolutePosition)}return this.lockedTarget.absolutePosition||this.lockedTarget}storeState(){return this._storedPosition=this.position.clone(),this._storedRotation=this.rotation.clone(),this.rotationQuaternion&&(this._storedRotationQuaternion=this.rotationQuaternion.clone()),super.storeState()}_restoreStateValues(){return super._restoreStateValues()?(this.position=this._storedPosition.clone(),this.rotation=this._storedRotation.clone(),this.rotationQuaternion&&this._storedRotationQuaternion&&(this.rotationQuaternion=this._storedRotationQuaternion.clone()),this.cameraDirection.copyFromFloats(0,0,0),this.cameraRotation.copyFromFloats(0,0),!0):!1}_initCache(){super._initCache(),this._cache.lockedTarget=new _(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotation=new _(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotationQuaternion=new W(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)}_updateCache(e){e||super._updateCache();const t=this._getLockedTargetPosition();t?this._cache.lockedTarget?this._cache.lockedTarget.copyFrom(t):this._cache.lockedTarget=t.clone():this._cache.lockedTarget=null,this._cache.rotation.copyFrom(this.rotation),this.rotationQuaternion&&this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)}_isSynchronizedViewMatrix(){if(!super._isSynchronizedViewMatrix())return!1;const e=this._getLockedTargetPosition();return(this._cache.lockedTarget?this._cache.lockedTarget.equals(e):!e)&&(this.rotationQuaternion?this.rotationQuaternion.equals(this._cache.rotationQuaternion):this._cache.rotation.equals(this.rotation))}_computeLocalCameraSpeed(){const e=this.getEngine();return this.speed*Math.sqrt(e.getDeltaTime()/(e.getFps()*100))}setTarget(e){this.upVector.normalize(),this._initialFocalDistance=e.subtract(this.position).length(),this.position.z===e.z&&(this.position.z+=Me),this._referencePoint.normalize().scaleInPlace(this._initialFocalDistance),this.getScene().useRightHandedSystem?P.LookAtRHToRef(this.position,e,_.UpReadOnly,fr):P.LookAtLHToRef(this.position,e,_.UpReadOnly,fr),fr.invert();const t=this.rotationQuaternion||sn;W.FromRotationMatrixToRef(fr,t),t.toEulerAnglesToRef(this.rotation),this.rotation.z=0}get target(){return this.getTarget()}set target(e){this.setTarget(e)}getTarget(){return this._currentTarget}_decideIfNeedsToMove(){return Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0}_updatePosition(){if(this.parent){this.parent.getWorldMatrix().invertToRef(v.Matrix[0]),_.TransformNormalToRef(this.cameraDirection,v.Matrix[0],v.Vector3[0]),this._deferredPositionUpdate.addInPlace(v.Vector3[0]),this._deferOnly?this._deferredUpdated=!0:this.position.copyFrom(this._deferredPositionUpdate);return}this._deferredPositionUpdate.addInPlace(this.cameraDirection),this._deferOnly?this._deferredUpdated=!0:this.position.copyFrom(this._deferredPositionUpdate)}_checkInputs(){const e=this.invertRotation?-this.inverseRotationSpeed:1,t=this._decideIfNeedsToMove(),i=this.cameraRotation.x||this.cameraRotation.y;this._deferredUpdated=!1,this._deferredRotationUpdate.copyFrom(this.rotation),this._deferredPositionUpdate.copyFrom(this.position),this.rotationQuaternion&&this._deferredRotationQuaternionUpdate.copyFrom(this.rotationQuaternion),t&&this._updatePosition(),i&&(this.rotationQuaternion&&this.rotationQuaternion.toEulerAnglesToRef(this._deferredRotationUpdate),this._deferredRotationUpdate.x+=this.cameraRotation.x*e,this._deferredRotationUpdate.y+=this.cameraRotation.y*e,this.noRotationConstraint||(this._deferredRotationUpdate.x>1.570796&&(this._deferredRotationUpdate.x=1.570796),this._deferredRotationUpdate.x<-1.570796&&(this._deferredRotationUpdate.x=-1.570796)),this._deferOnly?this._deferredUpdated=!0:this.rotation.copyFrom(this._deferredRotationUpdate),this.rotationQuaternion&&this._deferredRotationUpdate.lengthSquared()&&(W.RotationYawPitchRollToRef(this._deferredRotationUpdate.y,this._deferredRotationUpdate.x,this._deferredRotationUpdate.z,this._deferredRotationQuaternionUpdate),this._deferOnly?this._deferredUpdated=!0:this.rotationQuaternion.copyFrom(this._deferredRotationQuaternionUpdate)));const s=this.speed*this._panningEpsilon,r=this.speed*this._rotationEpsilon;t&&(Math.abs(this.cameraDirection.x){}}add(e){const t=e.getSimpleName();if(this.attached[t]){w.Warn("camera input of type "+t+" already exists on camera");return}this.attached[t]=e,e.camera=this.camera,e.checkInputs&&(this.checkInputs=this._addCheckInputs(e.checkInputs.bind(e))),this.attachedToElement&&e.attachControl(this.noPreventDefault)}remove(e){for(const t in this.attached){const i=this.attached[t];if(i===e){i.detachControl(),i.camera=null,delete this.attached[t],this.rebuildInputCheck();return}}}removeByType(e){for(const t in this.attached){const i=this.attached[t];i.getClassName()===e&&(i.detachControl(),i.camera=null,delete this.attached[t],this.rebuildInputCheck())}}_addCheckInputs(e){const t=this.checkInputs;return()=>{t(),e()}}attachInput(e){this.attachedToElement&&e.attachControl(this.noPreventDefault)}attachElement(e=!1){if(!this.attachedToElement){e=J.ForceAttachControlToAlwaysPreventDefault?!1:e,this.attachedToElement=!0,this.noPreventDefault=e;for(const t in this.attached)this.attached[t].attachControl(e)}}detachElement(e=!1){for(const t in this.attached)this.attached[t].detachControl(),e&&(this.attached[t].camera=null);this.attachedToElement=!1}rebuildInputCheck(){this.checkInputs=()=>{};for(const e in this.attached){const t=this.attached[e];t.checkInputs&&(this.checkInputs=this._addCheckInputs(t.checkInputs.bind(t)))}}clear(){this.attachedToElement&&this.detachElement(!0),this.attached={},this.attachedToElement=!1,this.checkInputs=()=>{}}serialize(e){const t={};for(const i in this.attached){const s=this.attached[i],r=le.Serialize(s);t[s.getClassName()]=r}e.inputsmgr=t}parse(e){const t=e.inputsmgr;if(t){this.clear();for(const i in t){const s=Xs[i];if(s){const r=t[i],n=le.Parse(()=>new s,r,null);this.add(n)}}}else for(const i in this.attached){const s=Xs[this.attached[i].getClassName()];if(s){const r=le.Parse(()=>new s,e,null);this.remove(this.attached[i]),this.add(r)}}}}class bh{constructor(){this._currentMousePointerIdDown=-1,this.buttons=[0,1,2]}attachControl(e){e=se.BackCompatCameraNoPreventDefault(arguments);const t=this.camera.getEngine(),i=t.getInputElement();let s=0,r=null;this._pointA=null,this._pointB=null,this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0,this._pointerInput=o=>{const h=o.event,l=h.pointerType==="touch";if(o.type!==te.POINTERMOVE&&this.buttons.indexOf(h.button)===-1)return;const c=h.target;if(this._altKey=h.altKey,this._ctrlKey=h.ctrlKey,this._metaKey=h.metaKey,this._shiftKey=h.shiftKey,this._buttonsPressed=h.buttons,t.isPointerLock){const u=h.movementX,f=h.movementY;this.onTouch(null,u,f),this._pointA=null,this._pointB=null}else{if(o.type!==te.POINTERDOWN&&o.type!==te.POINTERDOUBLETAP&&l&&this._pointA?.pointerId!==h.pointerId&&this._pointB?.pointerId!==h.pointerId)return;if(o.type===te.POINTERDOWN&&(this._currentMousePointerIdDown===-1||l)){try{c?.setPointerCapture(h.pointerId)}catch{}if(this._pointA===null)this._pointA={x:h.clientX,y:h.clientY,pointerId:h.pointerId,type:h.pointerType,button:h.button};else if(this._pointB===null)this._pointB={x:h.clientX,y:h.clientY,pointerId:h.pointerId,type:h.pointerType,button:h.button};else return;this._currentMousePointerIdDown===-1&&!l&&(this._currentMousePointerIdDown=h.pointerId),this.onButtonDown(h),e||(h.preventDefault(),i&&i.focus())}else if(o.type===te.POINTERDOUBLETAP)this.onDoubleTap(h.pointerType);else if(o.type===te.POINTERUP&&(this._currentMousePointerIdDown===h.pointerId||l)){try{c?.releasePointerCapture(h.pointerId)}catch{}l||(this._pointB=null),t._badOS?this._pointA=this._pointB=null:this._pointB&&this._pointA&&this._pointA.pointerId==h.pointerId?(this._pointA=this._pointB,this._pointB=null):this._pointA&&this._pointB&&this._pointB.pointerId==h.pointerId?this._pointB=null:this._pointA=this._pointB=null,(s!==0||r)&&(this.onMultiTouch(this._pointA,this._pointB,s,0,r,null),s=0,r=null),this._currentMousePointerIdDown=-1,this.onButtonUp(h),e||h.preventDefault()}else if(o.type===te.POINTERMOVE){if(e||h.preventDefault(),this._pointA&&this._pointB===null){const u=h.clientX-this._pointA.x,f=h.clientY-this._pointA.y;this._pointA.x=h.clientX,this._pointA.y=h.clientY,this.onTouch(this._pointA,u,f)}else if(this._pointA&&this._pointB){const u=this._pointA.pointerId===h.pointerId?this._pointA:this._pointB;u.x=h.clientX,u.y=h.clientY;const f=this._pointA.x-this._pointB.x,d=this._pointA.y-this._pointB.y,g=f*f+d*d,p={x:(this._pointA.x+this._pointB.x)/2,y:(this._pointA.y+this._pointB.y)/2,pointerId:h.pointerId,type:o.type};this.onMultiTouch(this._pointA,this._pointB,s,g,r,p),r=p,s=g}}}},this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver(this._pointerInput,te.POINTERDOWN|te.POINTERUP|te.POINTERMOVE|te.POINTERDOUBLETAP),this._onLostFocus=()=>{this._pointA=this._pointB=null,s=0,r=null,this.onLostFocus()},this._contextMenuBind=o=>this.onContextMenu(o),i&&i.addEventListener("contextmenu",this._contextMenuBind,!1);const n=this.camera.getScene().getEngine().getHostWindow();n&&se.RegisterTopRootEvents(n,[{name:"blur",handler:this._onLostFocus}])}detachControl(){if(this._onLostFocus){const e=this.camera.getScene().getEngine().getHostWindow();e&&se.UnregisterTopRootEvents(e,[{name:"blur",handler:this._onLostFocus}])}if(this._observer){if(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this._observer=null,this._contextMenuBind){const e=this.camera.getScene().getEngine().getInputElement();e&&e.removeEventListener("contextmenu",this._contextMenuBind)}this._onLostFocus=null}this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0,this._currentMousePointerIdDown=-1}getClassName(){return"BaseCameraPointersInput"}getSimpleName(){return"pointers"}onDoubleTap(e){}onTouch(e,t,i){}onMultiTouch(e,t,i,s,r,n){}onContextMenu(e){e.preventDefault()}onButtonDown(e){}onButtonUp(e){}onLostFocus(){}}T([R()],bh.prototype,"buttons",void 0);class Vr extends bh{constructor(){super(...arguments),this.pinchZoom=!0,this.multiTouchPanning=!0,this.multiTouchPanAndZoom=!0,this._isPinching=!1,this._twoFingerActivityCount=0,this._shouldStartPinchZoom=!1}_computePinchZoom(e,t){}_computeMultiTouchPanning(e,t){}onMultiTouch(e,t,i,s,r,n){i===0&&r===null||s===0&&n===null||(this.multiTouchPanAndZoom?(this._computePinchZoom(i,s),this._computeMultiTouchPanning(r,n)):this.multiTouchPanning&&this.pinchZoom?(this._twoFingerActivityCount++,this._isPinching||this._shouldStartPinchZoom?(this._computePinchZoom(i,s),this._isPinching=!0):this._computeMultiTouchPanning(r,n)):this.multiTouchPanning?this._computeMultiTouchPanning(r,n):this.pinchZoom&&this._computePinchZoom(i,s))}onButtonUp(e){this._twoFingerActivityCount=0,this._isPinching=!1}onLostFocus(){this._twoFingerActivityCount=0,this._isPinching=!1}}T([R()],Vr.prototype,"pinchZoom",void 0);T([R()],Vr.prototype,"multiTouchPanning",void 0);T([R()],Vr.prototype,"multiTouchPanAndZoom",void 0);class jt extends Vr{constructor(){super(...arguments),this.buttons=[0,1,2],this.angularSensibilityX=1e3,this.angularSensibilityY=1e3,this.pinchPrecision=12,this.pinchDeltaPercentage=0,this.useNaturalPinchZoom=!1,this.panningSensibility=1e3,this.pinchInwards=!0,this._isPanClick=!1}getClassName(){return"ArcRotateCameraPointersInput"}_computeMultiTouchPanning(e,t){if(this.panningSensibility!==0&&e&&t){const i=t.x-e.x,s=t.y-e.y;this.camera.inertialPanningX+=-i/this.panningSensibility,this.camera.inertialPanningY+=s/this.panningSensibility}}_computePinchZoom(e,t){const i=this.camera.radius||jt.MinimumRadiusForPinch;this.useNaturalPinchZoom?this.camera.radius=i*Math.sqrt(e)/Math.sqrt(t):this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=(t-e)*.001*i*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(t-e)/(this.pinchPrecision*(this.pinchInwards?1:-1)*(this.angularSensibilityX+this.angularSensibilityY)/2)}onTouch(e,t,i){this.panningSensibility!==0&&(this._ctrlKey&&this.camera._useCtrlForPanning||this._isPanClick)?(this.camera.inertialPanningX+=-t/this.panningSensibility,this.camera.inertialPanningY+=i/this.panningSensibility):(this.camera.inertialAlphaOffset-=t/this.angularSensibilityX,this.camera.inertialBetaOffset-=i/this.angularSensibilityY)}onDoubleTap(){this.camera.useInputToRestoreState&&this.camera.restoreState()}onMultiTouch(e,t,i,s,r,n){this._shouldStartPinchZoom=this._twoFingerActivityCount<20&&Math.abs(Math.sqrt(s)-Math.sqrt(i))>this.camera.pinchToPanMaxDistance,super.onMultiTouch(e,t,i,s,r,n)}onButtonDown(e){this._isPanClick=e.button===this.camera._panningMouseButton,super.onButtonDown(e)}onButtonUp(e){super.onButtonUp(e)}onLostFocus(){this._isPanClick=!1,super.onLostFocus()}}jt.MinimumRadiusForPinch=.001;T([R()],jt.prototype,"buttons",void 0);T([R()],jt.prototype,"angularSensibilityX",void 0);T([R()],jt.prototype,"angularSensibilityY",void 0);T([R()],jt.prototype,"pinchPrecision",void 0);T([R()],jt.prototype,"pinchDeltaPercentage",void 0);T([R()],jt.prototype,"useNaturalPinchZoom",void 0);T([R()],jt.prototype,"panningSensibility",void 0);Xs.ArcRotateCameraPointersInput=jt;class Ks{}Ks.KEYDOWN=1;Ks.KEYUP=2;class An{constructor(e,t){this.type=e,this.event=t}}class Aa extends An{get skipOnPointerObservable(){return this.skipOnKeyboardObservable}set skipOnPointerObservable(e){this.skipOnKeyboardObservable=e}constructor(e,t){super(e,t),this.type=e,this.event=t,this.skipOnKeyboardObservable=!1}}class ti{constructor(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this.keysReset=[220],this.panningSensibility=50,this.zoomingSensibility=25,this.useAltToZoom=!0,this.angularSpeed=.01,this._keys=new Array}attachControl(e){e=se.BackCompatCameraNoPreventDefault(arguments),!this._onCanvasBlurObserver&&(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add(()=>{this._keys.length=0}),this._onKeyboardObserver=this._scene.onKeyboardObservable.add(t=>{const i=t.event;if(!i.metaKey){if(t.type===Ks.KEYDOWN)this._ctrlPressed=i.ctrlKey,this._altPressed=i.altKey,(this.keysUp.indexOf(i.keyCode)!==-1||this.keysDown.indexOf(i.keyCode)!==-1||this.keysLeft.indexOf(i.keyCode)!==-1||this.keysRight.indexOf(i.keyCode)!==-1||this.keysReset.indexOf(i.keyCode)!==-1)&&(this._keys.indexOf(i.keyCode)===-1&&this._keys.push(i.keyCode),i.preventDefault&&(e||i.preventDefault()));else if(this.keysUp.indexOf(i.keyCode)!==-1||this.keysDown.indexOf(i.keyCode)!==-1||this.keysLeft.indexOf(i.keyCode)!==-1||this.keysRight.indexOf(i.keyCode)!==-1||this.keysReset.indexOf(i.keyCode)!==-1){const s=this._keys.indexOf(i.keyCode);s>=0&&this._keys.splice(s,1),i.preventDefault&&(e||i.preventDefault())}}}))}detachControl(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0}checkInputs(){if(this._onKeyboardObserver){const e=this.camera;for(let t=0;t0?i=s/(1+this.wheelDeltaPercentage):i=s*(1+this.wheelDeltaPercentage),i}attachControl(e){e=se.BackCompatCameraNoPreventDefault(arguments),this._wheel=t=>{if(t.type!==te.POINTERWHEEL)return;const i=t.event;let s=0;const r=i.deltaMode===sr.DOM_DELTA_LINE?yu:1,n=-(i.deltaY*r);if(this.customComputeDeltaFromMouseWheel)s=this.customComputeDeltaFromMouseWheel(n,this,i);else if(this.wheelDeltaPercentage){if(s=this._computeDeltaFromMouseWheelLegacyEvent(n,this.camera.radius),s>0){let o=this.camera.radius,h=this.camera.inertialRadiusOffset+s;for(let l=0;l<20&&!(o<=h||Math.abs(h*this.camera.inertia)<.001);l++)o-=h,h*=this.camera.inertia;o=be(o,0,Number.MAX_VALUE),s=this._computeDeltaFromMouseWheelLegacyEvent(n,o)}}else s=n/(this.wheelPrecision*40);s&&(this.zoomToMouseLocation?(this._hitPlane||this._updateHitPlane(),this._zoomToMouse(s)):this.camera.inertialRadiusOffset+=s),i.preventDefault&&(e||i.preventDefault())},this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver(this._wheel,te.POINTERWHEEL),this.zoomToMouseLocation&&this._inertialPanning.setAll(0)}detachControl(){this._observer&&(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this._observer=null,this._wheel=null)}checkInputs(){if(!this.zoomToMouseLocation)return;const e=this.camera;0+e.inertialAlphaOffset+e.inertialBetaOffset+e.inertialRadiusOffset&&(this._updateHitPlane(),e.target.addInPlace(this._inertialPanning),this._inertialPanning.scaleInPlace(e.inertia),this._zeroIfClose(this._inertialPanning))}getClassName(){return"ArcRotateCameraMouseWheelInput"}getSimpleName(){return"mousewheel"}_updateHitPlane(){const e=this.camera,t=e.target.subtract(e.position);this._hitPlane=Ht.FromPositionAndNormal(e.target,t)}_getPosition(){const e=this.camera,t=e.getScene(),i=t.createPickingRay(t.pointerX,t.pointerY,P.Identity(),e,!1);(e.targetScreenOffset.x!==0||e.targetScreenOffset.y!==0)&&(this._viewOffset.set(e.targetScreenOffset.x,e.targetScreenOffset.y,0),e.getViewMatrix().invertToRef(e._cameraTransformMatrix),this._globalOffset=_.TransformNormal(this._viewOffset,e._cameraTransformMatrix),i.origin.addInPlace(this._globalOffset));let s=0;return this._hitPlane&&(s=i.intersectsPlane(this._hitPlane)??0),i.origin.addInPlace(i.direction.scaleInPlace(s))}_zoomToMouse(e){const t=this.camera,i=1-t.inertia;if(t.lowerRadiusLimit){const h=t.lowerRadiusLimit??0;t.radius-(t.inertialRadiusOffset+e)/ih&&(e=(t.radius-h)*i-t.inertialRadiusOffset)}const r=e/i/t.radius,n=this._getPosition(),o=v.Vector3[6];n.subtractToRef(t.target,o),o.scaleInPlace(r),o.scaleInPlace(i),this._inertialPanning.addInPlace(o),t.inertialRadiusOffset+=e}_zeroIfClose(e){Math.abs(e.x)()=>new Ie(a,0,0,1,_.Zero(),e));function Eh(a){let e=Math.PI/2;return a.x===0&&a.z===0||(e=Math.acos(a.x/Math.sqrt(Math.pow(a.x,2)+Math.pow(a.z,2)))),a.z<0&&(e=2*Math.PI-e),e}function Ah(a,e){return Math.acos(a/e)}function mt(a,e){return isNaN(a)?e:a}class Ie extends et{get target(){return this._target}set target(e){this.setTarget(e)}get targetHost(){return this._targetHost}set targetHost(e){e&&this.setTarget(e)}getTarget(){return this.target}get position(){return this._position}set position(e){this.setPosition(e)}set upVector(e){this._upToYMatrix||(this._yToUpMatrix=new P,this._upToYMatrix=new P,this._upVector=_.Zero()),e.normalize(),this._upVector.copyFrom(e),this.setMatUp()}get upVector(){return this._upVector}setMatUp(){P.RotationAlignToRef(_.UpReadOnly,this._upVector,this._yToUpMatrix),P.RotationAlignToRef(this._upVector,_.UpReadOnly,this._upToYMatrix)}get angularSensibilityX(){const e=this.inputs.attached.pointers;return e?e.angularSensibilityX:0}set angularSensibilityX(e){const t=this.inputs.attached.pointers;t&&(t.angularSensibilityX=e)}get angularSensibilityY(){const e=this.inputs.attached.pointers;return e?e.angularSensibilityY:0}set angularSensibilityY(e){const t=this.inputs.attached.pointers;t&&(t.angularSensibilityY=e)}get pinchPrecision(){const e=this.inputs.attached.pointers;return e?e.pinchPrecision:0}set pinchPrecision(e){const t=this.inputs.attached.pointers;t&&(t.pinchPrecision=e)}get pinchDeltaPercentage(){const e=this.inputs.attached.pointers;return e?e.pinchDeltaPercentage:0}set pinchDeltaPercentage(e){const t=this.inputs.attached.pointers;t&&(t.pinchDeltaPercentage=e)}get useNaturalPinchZoom(){const e=this.inputs.attached.pointers;return e?e.useNaturalPinchZoom:!1}set useNaturalPinchZoom(e){const t=this.inputs.attached.pointers;t&&(t.useNaturalPinchZoom=e)}get panningSensibility(){const e=this.inputs.attached.pointers;return e?e.panningSensibility:0}set panningSensibility(e){const t=this.inputs.attached.pointers;t&&(t.panningSensibility=e)}get keysUp(){const e=this.inputs.attached.keyboard;return e?e.keysUp:[]}set keysUp(e){const t=this.inputs.attached.keyboard;t&&(t.keysUp=e)}get keysDown(){const e=this.inputs.attached.keyboard;return e?e.keysDown:[]}set keysDown(e){const t=this.inputs.attached.keyboard;t&&(t.keysDown=e)}get keysLeft(){const e=this.inputs.attached.keyboard;return e?e.keysLeft:[]}set keysLeft(e){const t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)}get keysRight(){const e=this.inputs.attached.keyboard;return e?e.keysRight:[]}set keysRight(e){const t=this.inputs.attached.keyboard;t&&(t.keysRight=e)}get wheelPrecision(){const e=this.inputs.attached.mousewheel;return e?e.wheelPrecision:0}set wheelPrecision(e){const t=this.inputs.attached.mousewheel;t&&(t.wheelPrecision=e)}get zoomToMouseLocation(){const e=this.inputs.attached.mousewheel;return e?e.zoomToMouseLocation:!1}set zoomToMouseLocation(e){const t=this.inputs.attached.mousewheel;t&&(t.zoomToMouseLocation=e)}get wheelDeltaPercentage(){const e=this.inputs.attached.mousewheel;return e?e.wheelDeltaPercentage:0}set wheelDeltaPercentage(e){const t=this.inputs.attached.mousewheel;t&&(t.wheelDeltaPercentage=e)}get isInterpolating(){return this._isInterpolating}get bouncingBehavior(){return this._bouncingBehavior}get useBouncingBehavior(){return this._bouncingBehavior!=null}set useBouncingBehavior(e){e!==this.useBouncingBehavior&&(e?(this._bouncingBehavior=new $i,this.addBehavior(this._bouncingBehavior)):this._bouncingBehavior&&(this.removeBehavior(this._bouncingBehavior),this._bouncingBehavior=null))}get framingBehavior(){return this._framingBehavior}get useFramingBehavior(){return this._framingBehavior!=null}set useFramingBehavior(e){e!==this.useFramingBehavior&&(e?(this._framingBehavior=new yt,this.addBehavior(this._framingBehavior)):this._framingBehavior&&(this.removeBehavior(this._framingBehavior),this._framingBehavior=null))}get autoRotationBehavior(){return this._autoRotationBehavior}get useAutoRotationBehavior(){return this._autoRotationBehavior!=null}set useAutoRotationBehavior(e){e!==this.useAutoRotationBehavior&&(e?(this._autoRotationBehavior=new du,this.addBehavior(this._autoRotationBehavior)):this._autoRotationBehavior&&(this.removeBehavior(this._autoRotationBehavior),this._autoRotationBehavior=null))}constructor(e,t,i,s,r,n,o=!0){super(e,_.Zero(),n,o),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.lowerAlphaLimit=null,this.upperAlphaLimit=null,this.lowerBetaLimit=.01,this.upperBetaLimit=Math.PI-.01,this.lowerRadiusLimit=null,this.upperRadiusLimit=null,this.lowerTargetYLimit=-1/0,this.inertialPanningX=0,this.inertialPanningY=0,this.pinchToPanMaxDistance=20,this.panningDistanceLimit=null,this.panningOriginTarget=_.Zero(),this.panningInertia=.9,this.zoomOnFactor=1,this.targetScreenOffset=Q.Zero(),this.allowUpsideDown=!0,this.useInputToRestoreState=!0,this.restoreStateInterpolationFactor=0,this._currentInterpolationFactor=0,this._viewMatrix=new P,this.panningAxis=new _(1,1,0),this._transformedDirection=new _,this.mapPanning=!1,this._isInterpolating=!1,this.onMeshTargetChangedObservable=new O,this.checkCollisions=!1,this.collisionRadius=new _(.5,.5,.5),this._previousPosition=_.Zero(),this._collisionVelocity=_.Zero(),this._newPosition=_.Zero(),this._computationVector=_.Zero(),this._goalAlpha=NaN,this._goalBeta=NaN,this._goalRadius=NaN,this._goalTarget=new _(NaN,NaN,NaN),this._goalTargetScreenOffset=new Q(NaN,NaN),this._onCollisionPositionChange=(h,l,c=null)=>{c?(this.setPosition(l),this.onCollide&&this.onCollide(c)):this._previousPosition.copyFrom(this._position);const u=Math.cos(this.alpha),f=Math.sin(this.alpha),d=Math.cos(this.beta);let g=Math.sin(this.beta);g===0&&(g=1e-4);const p=this._getTargetPosition();this._computationVector.copyFromFloats(this.radius*u*g,this.radius*d,this.radius*f*g),p.addToRef(this._computationVector,this._newPosition),this._position.copyFrom(this._newPosition);let m=this.upVector;this.allowUpsideDown&&this.beta<0&&(m=m.clone(),m=m.negate()),this._computeViewMatrix(this._position,p,m),this._viewMatrix.addAtIndex(12,this.targetScreenOffset.x),this._viewMatrix.addAtIndex(13,this.targetScreenOffset.y),this._collisionTriggered=!1},this._target=_.Zero(),r&&this.setTarget(r),this.alpha=t,this.beta=i,this.radius=s,this.getViewMatrix(),this.inputs=new xu(this),this.inputs.addKeyboard().addMouseWheel().addPointers()}_initCache(){super._initCache(),this._cache._target=new _(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.alpha=void 0,this._cache.beta=void 0,this._cache.radius=void 0,this._cache.targetScreenOffset=Q.Zero()}_updateCache(e){e||super._updateCache(),this._cache._target.copyFrom(this._getTargetPosition()),this._cache.alpha=this.alpha,this._cache.beta=this.beta,this._cache.radius=this.radius,this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset)}_getTargetPosition(){if(this._targetHost&&this._targetHost.getAbsolutePosition){const t=this._targetHost.getAbsolutePosition();this._targetBoundingCenter?t.addToRef(this._targetBoundingCenter,this._target):this._target.copyFrom(t)}const e=this._getLockedTargetPosition();return e||this._target}storeState(){return this._storedAlpha=this.alpha,this._storedBeta=this.beta,this._storedRadius=this.radius,this._storedTarget=this._getTargetPosition().clone(),this._storedTargetScreenOffset=this.targetScreenOffset.clone(),super.storeState()}_restoreStateValues(){return this.hasStateStored()&&this.restoreStateInterpolationFactor>Me&&this.restoreStateInterpolationFactor<1?(this.interpolateTo(this._storedAlpha,this._storedBeta,this._storedRadius,this._storedTarget,this._storedTargetScreenOffset,this.restoreStateInterpolationFactor),!0):super._restoreStateValues()?(this.setTarget(this._storedTarget.clone()),this.alpha=this._storedAlpha,this.beta=this._storedBeta,this.radius=this._storedRadius,this.targetScreenOffset=this._storedTargetScreenOffset.clone(),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0,!0):!1}stopInterpolation(){this._goalAlpha=NaN,this._goalBeta=NaN,this._goalRadius=NaN,this._goalTarget.set(NaN,NaN,NaN),this._goalTargetScreenOffset.set(NaN,NaN)}interpolateTo(e=this.alpha,t=this.beta,i=this.radius,s=this.target,r=this.targetScreenOffset,n){this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0,n!=null?this._currentInterpolationFactor=n:this.restoreStateInterpolationFactor!==0?this._currentInterpolationFactor=this.restoreStateInterpolationFactor:this._currentInterpolationFactor=.1,this._goalAlpha=mt(e,this._goalAlpha),this._goalBeta=mt(t,this._goalBeta),this._goalRadius=mt(i,this._goalRadius),this._goalTarget.set(mt(s.x,this._goalTarget.x),mt(s.y,this._goalTarget.y),mt(s.z,this._goalTarget.z)),this._goalTargetScreenOffset.set(mt(r.x,this._goalTargetScreenOffset.x),mt(r.y,this._goalTargetScreenOffset.y)),this._goalAlpha=be(this._goalAlpha,this.lowerAlphaLimit??-1/0,this.upperAlphaLimit??1/0),this._goalBeta=be(this._goalBeta,this.lowerBetaLimit??-1/0,this.upperBetaLimit??1/0),this._goalRadius=be(this._goalRadius,this.lowerRadiusLimit??-1/0,this.upperRadiusLimit??1/0),this._goalTarget.y=be(this._goalTarget.y,this.lowerTargetYLimit??-1/0,1/0),this._isInterpolating=!0}_isSynchronizedViewMatrix(){return super._isSynchronizedViewMatrix()?this._cache._target.equals(this._getTargetPosition())&&this._cache.alpha===this.alpha&&this._cache.beta===this.beta&&this._cache.radius===this.radius&&this._cache.targetScreenOffset.equals(this.targetScreenOffset):!1}attachControl(e,t,i=!0,s=2){const r=arguments;t=se.BackCompatCameraNoPreventDefault(r),this._useCtrlForPanning=i,this._panningMouseButton=s,typeof r[0]=="boolean"&&(r.length>1&&(this._useCtrlForPanning=r[1]),r.length>2&&(this._panningMouseButton=r[2])),this.inputs.attachElement(t),this._reset=()=>{this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0}}detachControl(){this.inputs.detachElement(),this._reset&&this._reset()}_checkInputs(){if(this._collisionTriggered)return;this.inputs.checkInputs();let e=!1;if(this.inertialAlphaOffset!==0||this.inertialBetaOffset!==0||this.inertialRadiusOffset!==0){e=!0;const t=this.invertRotation?-1:1,i=this._calculateHandednessMultiplier();let s=this.inertialAlphaOffset*i;this.beta<0&&(s*=-1),this.alpha+=s*t,this.beta+=this.inertialBetaOffset*t,this.radius-=this.inertialRadiusOffset,this.inertialAlphaOffset*=this.inertia,this.inertialBetaOffset*=this.inertia,this.inertialRadiusOffset*=this.inertia,Math.abs(this.inertialAlphaOffset)Math.PI&&(this.beta=this.beta-2*Math.PI):this.betathis.upperBetaLimit&&(this.beta=this.upperBetaLimit),this.lowerAlphaLimit!==null&&this.alphathis.upperAlphaLimit&&(this.alpha=this.upperAlphaLimit),this.lowerRadiusLimit!==null&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit,this.inertialRadiusOffset=0),this.target.y=Math.max(this.target.y,this.lowerTargetYLimit)}rebuildAnglesAndRadius(){this._position.subtractToRef(this._getTargetPosition(),this._computationVector),(this._upVector.x!==0||this._upVector.y!==1||this._upVector.z!==0)&&_.TransformCoordinatesToRef(this._computationVector,this._upToYMatrix,this._computationVector),this.radius=this._computationVector.length(),this.radius===0&&(this.radius=1e-4);const e=this.alpha;this.alpha=Eh(this._computationVector),this.beta=Ah(this._computationVector.y,this.radius);const t=Math.round((e-this.alpha)/(2*Math.PI));this.alpha+=t*2*Math.PI,this._checkLimits()}setPosition(e){this._position.equals(e)||(this._position.copyFrom(e),this.rebuildAnglesAndRadius())}setTarget(e,t=!1,i=!1,s=!1){if(s=this.overrideCloneAlphaBetaRadius??s,e.computeWorldMatrix)t&&e.getBoundingInfo?this._targetBoundingCenter=e.getBoundingInfo().boundingBox.centerWorld.clone():this._targetBoundingCenter=null,e.computeWorldMatrix(),this._targetHost=e,this._target=this._getTargetPosition(),this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);else{const r=e,n=this._getTargetPosition();if(n&&!i&&n.equals(r))return;this._targetHost=null,this._target=r,this._targetBoundingCenter=null,this.onMeshTargetChangedObservable.notifyObservers(null)}s||this.rebuildAnglesAndRadius()}_getViewMatrix(){const e=Math.cos(this.alpha),t=Math.sin(this.alpha),i=Math.cos(this.beta);let s=Math.sin(this.beta);s===0&&(s=1e-4),this.radius===0&&(this.radius=1e-4);const r=this._getTargetPosition();if(this._computationVector.copyFromFloats(this.radius*e*s,this.radius*i,this.radius*t*s),(this._upVector.x!==0||this._upVector.y!==1||this._upVector.z!==0)&&_.TransformCoordinatesToRef(this._computationVector,this._yToUpMatrix,this._computationVector),r.addToRef(this._computationVector,this._newPosition),this.getScene().collisionsEnabled&&this.checkCollisions){const n=this.getScene().collisionCoordinator;this._collider||(this._collider=n.createCollider()),this._collider._radius=this.collisionRadius,this._newPosition.subtractToRef(this._position,this._collisionVelocity),this._collisionTriggered=!0,n.getNewPosition(this._position,this._collisionVelocity,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)}else{this._position.copyFrom(this._newPosition);let n=this.upVector;this.allowUpsideDown&&s<0&&(n=n.negate()),this._computeViewMatrix(this._position,r,n),this._viewMatrix.addAtIndex(12,this.targetScreenOffset.x),this._viewMatrix.addAtIndex(13,this.targetScreenOffset.y)}return this._currentTarget.copyFrom(r),this._viewMatrix}zoomOn(e,t=!1){e=e||this.getScene().meshes;const i=ne.MinMax(e);let s=this._calculateLowerRadiusFromModelBoundingSphere(i.min,i.max);if(s=Math.max(Math.min(s,this.upperRadiusLimit||Number.MAX_VALUE),this.lowerRadiusLimit||0),this.radius=s*this.zoomOnFactor,this.mode===J.ORTHOGRAPHIC_CAMERA){const r=this.getScene().getEngine().getAspectRatio(this),n=s*this.zoomOnFactor/2;this.orthoLeft=-n*r,this.orthoRight=n*r,this.orthoBottom=-n,this.orthoTop=n}this.focusOn({min:i.min,max:i.max,distance:s},t)}focusOn(e,t=!1){let i,s;if(e.min===void 0){const r=e||this.getScene().meshes;i=ne.MinMax(r),s=_.Distance(i.min,i.max)}else{const r=e;i=r,s=r.distance}this._target=ne.Center(i),t||(this.maxZ=s*2)}createRigCamera(e,t){let i=0;switch(this.cameraRigMode){case J.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case J.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case J.RIG_MODE_STEREOSCOPIC_OVERUNDER:case J.RIG_MODE_STEREOSCOPIC_INTERLACED:case J.RIG_MODE_VR:i=this._cameraRigParams.stereoHalfAngle*(t===0?1:-1);break;case J.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:i=this._cameraRigParams.stereoHalfAngle*(t===0?-1:1);break}const s=new Ie(e,this.alpha+i,this.beta,this.radius,this._target,this.getScene());return s._cameraRigParams={},s.isRigCamera=!0,s.rigParent=this,s.upVector=this.upVector,s.mode=this.mode,s.orthoLeft=this.orthoLeft,s.orthoRight=this.orthoRight,s.orthoBottom=this.orthoBottom,s.orthoTop=this.orthoTop,s}_updateRigCameras(){const e=this._rigCameras[0],t=this._rigCameras[1];switch(e.beta=t.beta=this.beta,this.cameraRigMode){case J.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case J.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case J.RIG_MODE_STEREOSCOPIC_OVERUNDER:case J.RIG_MODE_STEREOSCOPIC_INTERLACED:case J.RIG_MODE_VR:e.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle,t.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle;break;case J.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:e.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle,t.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle;break}super._updateRigCameras()}_calculateLowerRadiusFromModelBoundingSphere(e,t,i=1){const s=_.Distance(e,t),n=this.getScene().getEngine().getAspectRatio(this),o=Math.tan(this.fov/2),h=o*n,c=s*.5*i,u=c*Math.sqrt(1+1/(h*h)),f=c*Math.sqrt(1+1/(o*o));return Math.max(u,f)}dispose(){this.inputs.clear(),super.dispose()}getClassName(){return"ArcRotateCamera"}}T([R()],Ie.prototype,"alpha",void 0);T([R()],Ie.prototype,"beta",void 0);T([R()],Ie.prototype,"radius",void 0);T([R()],Ie.prototype,"overrideCloneAlphaBetaRadius",void 0);T([qt("target")],Ie.prototype,"_target",void 0);T([uo("targetHost")],Ie.prototype,"_targetHost",void 0);T([R()],Ie.prototype,"inertialAlphaOffset",void 0);T([R()],Ie.prototype,"inertialBetaOffset",void 0);T([R()],Ie.prototype,"inertialRadiusOffset",void 0);T([R()],Ie.prototype,"lowerAlphaLimit",void 0);T([R()],Ie.prototype,"upperAlphaLimit",void 0);T([R()],Ie.prototype,"lowerBetaLimit",void 0);T([R()],Ie.prototype,"upperBetaLimit",void 0);T([R()],Ie.prototype,"lowerRadiusLimit",void 0);T([R()],Ie.prototype,"upperRadiusLimit",void 0);T([R()],Ie.prototype,"lowerTargetYLimit",void 0);T([R()],Ie.prototype,"inertialPanningX",void 0);T([R()],Ie.prototype,"inertialPanningY",void 0);T([R()],Ie.prototype,"pinchToPanMaxDistance",void 0);T([R()],Ie.prototype,"panningDistanceLimit",void 0);T([qt()],Ie.prototype,"panningOriginTarget",void 0);T([R()],Ie.prototype,"panningInertia",void 0);T([R()],Ie.prototype,"zoomToMouseLocation",null);T([R()],Ie.prototype,"zoomOnFactor",void 0);T([co()],Ie.prototype,"targetScreenOffset",void 0);T([R()],Ie.prototype,"allowUpsideDown",void 0);T([R()],Ie.prototype,"useInputToRestoreState",void 0);T([R()],Ie.prototype,"restoreStateInterpolationFactor",void 0);nt("BABYLON.ArcRotateCamera",Ie);class y{}y.AUTOSAMPLERSUFFIX="Sampler";y.DISABLEUA="#define DISABLE_UNIFORMITY_ANALYSIS";y.ALPHA_DISABLE=0;y.ALPHA_ADD=1;y.ALPHA_COMBINE=2;y.ALPHA_SUBTRACT=3;y.ALPHA_MULTIPLY=4;y.ALPHA_MAXIMIZED=5;y.ALPHA_ONEONE=6;y.ALPHA_PREMULTIPLIED=7;y.ALPHA_PREMULTIPLIED_PORTERDUFF=8;y.ALPHA_INTERPOLATE=9;y.ALPHA_SCREENMODE=10;y.ALPHA_ONEONE_ONEONE=11;y.ALPHA_ALPHATOCOLOR=12;y.ALPHA_REVERSEONEMINUS=13;y.ALPHA_SRC_DSTONEMINUSSRCALPHA=14;y.ALPHA_ONEONE_ONEZERO=15;y.ALPHA_EXCLUSION=16;y.ALPHA_LAYER_ACCUMULATE=17;y.ALPHA_MIN=18;y.ALPHA_MAX=19;y.ALPHA_DUAL_SRC0_ADD_SRC1xDST=20;y.ALPHA_EQUATION_ADD=0;y.ALPHA_EQUATION_SUBSTRACT=1;y.ALPHA_EQUATION_REVERSE_SUBTRACT=2;y.ALPHA_EQUATION_MAX=3;y.ALPHA_EQUATION_MIN=4;y.ALPHA_EQUATION_DARKEN=5;y.DELAYLOADSTATE_NONE=0;y.DELAYLOADSTATE_LOADED=1;y.DELAYLOADSTATE_LOADING=2;y.DELAYLOADSTATE_NOTLOADED=4;y.NEVER=512;y.ALWAYS=519;y.LESS=513;y.EQUAL=514;y.LEQUAL=515;y.GREATER=516;y.GEQUAL=518;y.NOTEQUAL=517;y.KEEP=7680;y.ZERO=0;y.REPLACE=7681;y.INCR=7682;y.DECR=7683;y.INVERT=5386;y.INCR_WRAP=34055;y.DECR_WRAP=34056;y.TEXTURE_CLAMP_ADDRESSMODE=0;y.TEXTURE_WRAP_ADDRESSMODE=1;y.TEXTURE_MIRROR_ADDRESSMODE=2;y.TEXTURE_CREATIONFLAG_STORAGE=1;y.TEXTUREFORMAT_ALPHA=0;y.TEXTUREFORMAT_LUMINANCE=1;y.TEXTUREFORMAT_LUMINANCE_ALPHA=2;y.TEXTUREFORMAT_RGB=4;y.TEXTUREFORMAT_RGBA=5;y.TEXTUREFORMAT_RED=6;y.TEXTUREFORMAT_R=6;y.TEXTUREFORMAT_R16_UNORM=33322;y.TEXTUREFORMAT_RG16_UNORM=33324;y.TEXTUREFORMAT_RGB16_UNORM=32852;y.TEXTUREFORMAT_RGBA16_UNORM=32859;y.TEXTUREFORMAT_R16_SNORM=36760;y.TEXTUREFORMAT_RG16_SNORM=36761;y.TEXTUREFORMAT_RGB16_SNORM=36762;y.TEXTUREFORMAT_RGBA16_SNORM=36763;y.TEXTUREFORMAT_RG=7;y.TEXTUREFORMAT_RED_INTEGER=8;y.TEXTUREFORMAT_R_INTEGER=8;y.TEXTUREFORMAT_RG_INTEGER=9;y.TEXTUREFORMAT_RGB_INTEGER=10;y.TEXTUREFORMAT_RGBA_INTEGER=11;y.TEXTUREFORMAT_BGRA=12;y.TEXTUREFORMAT_DEPTH24_STENCIL8=13;y.TEXTUREFORMAT_DEPTH32_FLOAT=14;y.TEXTUREFORMAT_DEPTH16=15;y.TEXTUREFORMAT_DEPTH24=16;y.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8=17;y.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8=18;y.TEXTUREFORMAT_STENCIL8=19;y.TEXTUREFORMAT_UNDEFINED=4294967295;y.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM=36492;y.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM=36493;y.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT=36495;y.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT=36494;y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5=33779;y.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919;y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3=33778;y.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918;y.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1=33777;y.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1=33776;y.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917;y.TEXTUREFORMAT_COMPRESSED_SRGB_S3TC_DXT1_EXT=35916;y.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4=37808;y.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840;y.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL=36196;y.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2=37492;y.TEXTUREFORMAT_COMPRESSED_SRGB8_ETC2=37493;y.TEXTUREFORMAT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494;y.TEXTUREFORMAT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495;y.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC=37496;y.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497;y.TEXTURETYPE_UNSIGNED_BYTE=0;y.TEXTURETYPE_UNSIGNED_INT=0;y.TEXTURETYPE_FLOAT=1;y.TEXTURETYPE_HALF_FLOAT=2;y.TEXTURETYPE_BYTE=3;y.TEXTURETYPE_SHORT=4;y.TEXTURETYPE_UNSIGNED_SHORT=5;y.TEXTURETYPE_INT=6;y.TEXTURETYPE_UNSIGNED_INTEGER=7;y.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8;y.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9;y.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10;y.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11;y.TEXTURETYPE_UNSIGNED_INT_24_8=12;y.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13;y.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14;y.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15;y.TEXTURETYPE_UNDEFINED=16;y.TEXTURE_2D=3553;y.TEXTURE_2D_ARRAY=35866;y.TEXTURE_CUBE_MAP=34067;y.TEXTURE_CUBE_MAP_ARRAY=3735928559;y.TEXTURE_3D=32879;y.TEXTURE_NEAREST_SAMPLINGMODE=1;y.TEXTURE_NEAREST_NEAREST=1;y.TEXTURE_BILINEAR_SAMPLINGMODE=2;y.TEXTURE_LINEAR_LINEAR=2;y.TEXTURE_TRILINEAR_SAMPLINGMODE=3;y.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3;y.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4;y.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5;y.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6;y.TEXTURE_NEAREST_LINEAR=7;y.TEXTURE_NEAREST_NEAREST_MIPLINEAR=8;y.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9;y.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10;y.TEXTURE_LINEAR_LINEAR_MIPNEAREST=11;y.TEXTURE_LINEAR_NEAREST=12;y.TEXTURE_EXPLICIT_MODE=0;y.TEXTURE_SPHERICAL_MODE=1;y.TEXTURE_PLANAR_MODE=2;y.TEXTURE_CUBIC_MODE=3;y.TEXTURE_PROJECTION_MODE=4;y.TEXTURE_SKYBOX_MODE=5;y.TEXTURE_INVCUBIC_MODE=6;y.TEXTURE_EQUIRECTANGULAR_MODE=7;y.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8;y.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9;y.TEXTURE_FILTERING_QUALITY_OFFLINE=4096;y.TEXTURE_FILTERING_QUALITY_HIGH=64;y.TEXTURE_FILTERING_QUALITY_MEDIUM=16;y.TEXTURE_FILTERING_QUALITY_LOW=8;y.SCALEMODE_FLOOR=1;y.SCALEMODE_NEAREST=2;y.SCALEMODE_CEILING=3;y.MATERIAL_TextureDirtyFlag=1;y.MATERIAL_LightDirtyFlag=2;y.MATERIAL_FresnelDirtyFlag=4;y.MATERIAL_AttributesDirtyFlag=8;y.MATERIAL_MiscDirtyFlag=16;y.MATERIAL_PrePassDirtyFlag=32;y.MATERIAL_ImageProcessingDirtyFlag=64;y.MATERIAL_AllDirtyFlag=127;y.MATERIAL_TriangleFillMode=0;y.MATERIAL_WireFrameFillMode=1;y.MATERIAL_PointFillMode=2;y.MATERIAL_PointListDrawMode=3;y.MATERIAL_LineListDrawMode=4;y.MATERIAL_LineLoopDrawMode=5;y.MATERIAL_LineStripDrawMode=6;y.MATERIAL_TriangleStripDrawMode=7;y.MATERIAL_TriangleFanDrawMode=8;y.MATERIAL_ClockWiseSideOrientation=0;y.MATERIAL_CounterClockWiseSideOrientation=1;y.MATERIAL_DIFFUSE_MODEL_E_OREN_NAYAR=0;y.MATERIAL_DIFFUSE_MODEL_BURLEY=1;y.MATERIAL_DIFFUSE_MODEL_LAMBERT=2;y.MATERIAL_DIFFUSE_MODEL_LEGACY=3;y.MATERIAL_DIELECTRIC_SPECULAR_MODEL_GLTF=0;y.MATERIAL_DIELECTRIC_SPECULAR_MODEL_OPENPBR=1;y.MATERIAL_CONDUCTOR_SPECULAR_MODEL_GLTF=0;y.MATERIAL_CONDUCTOR_SPECULAR_MODEL_OPENPBR=1;y.ACTION_NothingTrigger=0;y.ACTION_OnPickTrigger=1;y.ACTION_OnLeftPickTrigger=2;y.ACTION_OnRightPickTrigger=3;y.ACTION_OnCenterPickTrigger=4;y.ACTION_OnPickDownTrigger=5;y.ACTION_OnDoublePickTrigger=6;y.ACTION_OnPickUpTrigger=7;y.ACTION_OnPickOutTrigger=16;y.ACTION_OnLongPressTrigger=8;y.ACTION_OnPointerOverTrigger=9;y.ACTION_OnPointerOutTrigger=10;y.ACTION_OnEveryFrameTrigger=11;y.ACTION_OnIntersectionEnterTrigger=12;y.ACTION_OnIntersectionExitTrigger=13;y.ACTION_OnKeyDownTrigger=14;y.ACTION_OnKeyUpTrigger=15;y.PARTICLES_BILLBOARDMODE_Y=2;y.PARTICLES_BILLBOARDMODE_ALL=7;y.PARTICLES_BILLBOARDMODE_STRETCHED=8;y.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL=9;y.MESHES_CULLINGSTRATEGY_STANDARD=0;y.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=1;y.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION=2;y.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY=3;y.SCENELOADER_NO_LOGGING=0;y.SCENELOADER_MINIMAL_LOGGING=1;y.SCENELOADER_SUMMARY_LOGGING=2;y.SCENELOADER_DETAILED_LOGGING=3;y.PREPASS_IRRADIANCE_TEXTURE_TYPE=0;y.PREPASS_POSITION_TEXTURE_TYPE=1;y.PREPASS_VELOCITY_TEXTURE_TYPE=2;y.PREPASS_REFLECTIVITY_TEXTURE_TYPE=3;y.PREPASS_COLOR_TEXTURE_TYPE=4;y.PREPASS_DEPTH_TEXTURE_TYPE=5;y.PREPASS_NORMAL_TEXTURE_TYPE=6;y.PREPASS_ALBEDO_SQRT_TEXTURE_TYPE=7;y.PREPASS_WORLD_NORMAL_TEXTURE_TYPE=8;y.PREPASS_LOCAL_POSITION_TEXTURE_TYPE=9;y.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE=10;y.PREPASS_VELOCITY_LINEAR_TEXTURE_TYPE=11;y.PREPASS_ALBEDO_TEXTURE_TYPE=12;y.PREPASS_NORMALIZED_VIEW_DEPTH_TEXTURE_TYPE=13;y.BUFFER_CREATIONFLAG_READ=1;y.BUFFER_CREATIONFLAG_WRITE=2;y.BUFFER_CREATIONFLAG_READWRITE=3;y.BUFFER_CREATIONFLAG_UNIFORM=4;y.BUFFER_CREATIONFLAG_VERTEX=8;y.BUFFER_CREATIONFLAG_INDEX=16;y.BUFFER_CREATIONFLAG_STORAGE=32;y.BUFFER_CREATIONFLAG_INDIRECT=64;y.RENDERPASS_MAIN=0;y.INPUT_ALT_KEY=18;y.INPUT_CTRL_KEY=17;y.INPUT_META_KEY1=91;y.INPUT_META_KEY2=92;y.INPUT_META_KEY3=93;y.INPUT_SHIFT_KEY=16;y.SNAPSHOTRENDERING_STANDARD=0;y.SNAPSHOTRENDERING_FAST=1;y.PERSPECTIVE_CAMERA=0;y.ORTHOGRAPHIC_CAMERA=1;y.FOVMODE_VERTICAL_FIXED=0;y.FOVMODE_HORIZONTAL_FIXED=1;y.RIG_MODE_NONE=0;y.RIG_MODE_STEREOSCOPIC_ANAGLYPH=10;y.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL=11;y.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED=12;y.RIG_MODE_STEREOSCOPIC_OVERUNDER=13;y.RIG_MODE_STEREOSCOPIC_INTERLACED=14;y.RIG_MODE_VR=20;y.RIG_MODE_CUSTOM=22;y.MAX_SUPPORTED_UV_SETS=6;y.GL_ALPHA_EQUATION_ADD=32774;y.GL_ALPHA_EQUATION_MIN=32775;y.GL_ALPHA_EQUATION_MAX=32776;y.GL_ALPHA_EQUATION_SUBTRACT=32778;y.GL_ALPHA_EQUATION_REVERSE_SUBTRACT=32779;y.GL_ALPHA_FUNCTION_SRC=768;y.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR=769;y.GL_ALPHA_FUNCTION_SRC_ALPHA=770;y.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA=771;y.GL_ALPHA_FUNCTION_DST_ALPHA=772;y.GL_ALPHA_FUNCTION_ONE_MINUS_DST_ALPHA=773;y.GL_ALPHA_FUNCTION_DST_COLOR=774;y.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR=775;y.GL_ALPHA_FUNCTION_SRC_ALPHA_SATURATED=776;y.GL_ALPHA_FUNCTION_CONSTANT_COLOR=32769;y.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_COLOR=32770;y.GL_ALPHA_FUNCTION_CONSTANT_ALPHA=32771;y.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_ALPHA=32772;y.GL_ALPHA_FUNCTION_SRC1_COLOR=35065;y.GL_ALPHA_FUNCTION_ONE_MINUS_SRC1_COLOR=35066;y.GL_ALPHA_FUNCTION_SRC1_ALPHA=34185;y.GL_ALPHA_FUNCTION_ONE_MINUS_SRC1_ALPHA=35067;y.SnippetUrl="https://snippet.babylonjs.com";y.FOGMODE_NONE=0;y.FOGMODE_EXP=1;y.FOGMODE_EXP2=2;y.FOGMODE_LINEAR=3;y.BYTE=5120;y.UNSIGNED_BYTE=5121;y.SHORT=5122;y.UNSIGNED_SHORT=5123;y.INT=5124;y.UNSIGNED_INT=5125;y.FLOAT=5126;y.PositionKind="position";y.NormalKind="normal";y.TangentKind="tangent";y.UVKind="uv";y.UV2Kind="uv2";y.UV3Kind="uv3";y.UV4Kind="uv4";y.UV5Kind="uv5";y.UV6Kind="uv6";y.ColorKind="color";y.ColorInstanceKind="instanceColor";y.MatricesIndicesKind="matricesIndices";y.MatricesWeightsKind="matricesWeights";y.MatricesIndicesExtraKind="matricesIndicesExtra";y.MatricesWeightsExtraKind="matricesWeightsExtra";y.ANIMATIONTYPE_FLOAT=0;y.ANIMATIONTYPE_VECTOR3=1;y.ANIMATIONTYPE_QUATERNION=2;y.ANIMATIONTYPE_MATRIX=3;y.ANIMATIONTYPE_COLOR3=4;y.ANIMATIONTYPE_COLOR4=7;y.ANIMATIONTYPE_VECTOR2=5;y.ANIMATIONTYPE_SIZE=6;y.ShadowMinZ=0;y.ShadowMaxZ=1e4;class me extends qe{get range(){return this._range}set range(e){this._range=e,this._inverseSquaredRange=1/(this.range*this.range)}get intensityMode(){return this._intensityMode}set intensityMode(e){this._intensityMode=e,this._computePhotometricScale()}get radius(){return this._radius}set radius(e){this._radius=e,this._computePhotometricScale()}get shadowEnabled(){return this._shadowEnabled}set shadowEnabled(e){this._shadowEnabled!==e&&(this._shadowEnabled=e,this._markMeshesAsLightDirty())}get includedOnlyMeshes(){return this._includedOnlyMeshes}set includedOnlyMeshes(e){this._includedOnlyMeshes=e,this._hookArrayForIncludedOnly(e)}get excludedMeshes(){return this._excludedMeshes}set excludedMeshes(e){this._excludedMeshes=e,this._hookArrayForExcluded(e)}get excludeWithLayerMask(){return this._excludeWithLayerMask}set excludeWithLayerMask(e){this._excludeWithLayerMask=e,this._resyncMeshes()}get includeOnlyWithLayerMask(){return this._includeOnlyWithLayerMask}set includeOnlyWithLayerMask(e){this._includeOnlyWithLayerMask=e,this._resyncMeshes()}get lightmapMode(){return this._lightmapMode}set lightmapMode(e){this._lightmapMode!==e&&(this._lightmapMode=e,this._markMeshesAsLightDirty())}getViewMatrix(e){return null}getProjectionMatrix(e,t){return null}constructor(e,t,i){super(e,t,!1),this.diffuse=new q(1,1,1),this.specular=new q(1,1,1),this.falloffType=me.FALLOFF_DEFAULT,this.intensity=1,this._range=Number.MAX_VALUE,this._inverseSquaredRange=0,this._photometricScale=1,this._intensityMode=me.INTENSITYMODE_AUTOMATIC,this._radius=1e-5,this.renderPriority=0,this._shadowEnabled=!0,this._excludeWithLayerMask=0,this._includeOnlyWithLayerMask=0,this._lightmapMode=0,this._shadowGenerators=null,this._excludedMeshesIds=new Array,this._includedOnlyMeshesIds=new Array,this._currentViewDepth=0,this._isLight=!0,i||this.getScene().addLight(this),this._uniformBuffer=new K(this.getScene().getEngine(),void 0,void 0,e),this._buildUniformLayout(),this.includedOnlyMeshes=[],this.excludedMeshes=[],i||this._resyncMeshes()}transferTexturesToEffect(e,t){return this}_bindLight(e,t,i,s,r=!0){const n=e.toString();let o=!1;if(this._uniformBuffer.bindToEffect(i,"Light"+n),this._renderId!==t.getRenderId()||this._lastUseSpecular!==s||!this._uniformBuffer.useUbo){this._renderId=t.getRenderId(),this._lastUseSpecular=s;const h=this.getScaledIntensity();this.transferToEffect(i,n),this.diffuse.scaleToRef(h,Vt.Color3[0]),this._uniformBuffer.updateColor4("vLightDiffuse",Vt.Color3[0],this.range,n),s&&(this.specular.scaleToRef(h,Vt.Color3[1]),this._uniformBuffer.updateColor4("vLightSpecular",Vt.Color3[1],this.radius,n)),o=!0}if(this.transferTexturesToEffect(i,n),t.shadowsEnabled&&this.shadowEnabled&&r){const h=this.getShadowGenerator(t.activeCamera)??this.getShadowGenerator();h&&(h.bindShadowLight(n,i),o=!0)}o?this._uniformBuffer.update():this._uniformBuffer.bindUniformBuffer()}getClassName(){return"Light"}toString(e){let t="Name: "+this.name;if(t+=", type: "+["Point","Directional","Spot","Hemispheric","Clustered"][this.getTypeID()],this.animations)for(let i=0;i0&&this.includedOnlyMeshes.indexOf(e)===-1||this.excludedMeshes&&this.excludedMeshes.length>0&&this.excludedMeshes.indexOf(e)!==-1||this.includeOnlyWithLayerMask!==0&&(this.includeOnlyWithLayerMask&e.layerMask)===0||this.excludeWithLayerMask!==0&&this.excludeWithLayerMask&e.layerMask):!0}dispose(e,t=!1){if(this._shadowGenerators){const i=this._shadowGenerators.values();for(let s=i.next();s.done!==!0;s=i.next())s.value.dispose();this._shadowGenerators=null}if(this.getScene().stopAnimation(this),this._parentContainer){const i=this._parentContainer.lights.indexOf(this);i>-1&&this._parentContainer.lights.splice(i,1),this._parentContainer=null}for(const i of this.getScene().meshes)i._removeLightSource(this,!0);this._uniformBuffer.dispose(),this.getScene().removeLight(this),super.dispose(e,t)}getTypeID(){return 0}getScaledIntensity(){return this._photometricScale*this.intensity}clone(e,t=null){const i=me.GetConstructorFromName(this.getTypeID(),e,this.getScene());if(!i)return null;const s=le.Clone(i,this);return e&&(s.name=e),t&&(s.parent=t),s.setEnabled(this.isEnabled()),this.onClonedObservable.notifyObservers(s),s}serialize(){const e=le.Serialize(this);if(e.uniqueId=this.uniqueId,e.type=this.getTypeID(),this.parent&&this.parent._serializeAsParent(e),this.excludedMeshes.length>0){e.excludedMeshesIds=[];for(const t of this.excludedMeshes)e.excludedMeshesIds.push(t.id)}if(this.includedOnlyMeshes.length>0){e.includedOnlyMeshesIds=[];for(const t of this.includedOnlyMeshes)e.includedOnlyMeshesIds.push(t.id)}return le.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e.isEnabled=this.isEnabled(),e}static GetConstructorFromName(e,t,i){const s=qe.Construct("Light_Type_"+e,t,i);return s||null}static Parse(e,t){const i=me.GetConstructorFromName(e.type,e.name,t);if(!i)return null;const s=le.Parse(i,e,t);if(e.excludedMeshesIds&&(s._excludedMeshesIds=e.excludedMeshesIds),e.includedOnlyMeshesIds&&(s._includedOnlyMeshesIds=e.includedOnlyMeshesIds),e.parentId!==void 0&&(s._waitingParentId=e.parentId),e.parentInstanceIndex!==void 0&&(s._waitingParentInstanceIndex=e.parentInstanceIndex),e.falloffType!==void 0&&(s.falloffType=e.falloffType),e.lightmapMode!==void 0&&(s.lightmapMode=e.lightmapMode),e.animations){for(let r=0;r{const r=t.apply(e,s);for(const n of s)n._resyncLightSource(this);return r};const i=e.splice;e.splice=(s,r)=>{const n=i.apply(e,[s,r]);for(const o of n)o._resyncLightSource(this);return n};for(const s of e)s._resyncLightSource(this)}_hookArrayForIncludedOnly(e){const t=e.push;e.push=(...s)=>{const r=t.apply(e,s);return this._resyncMeshes(),r};const i=e.splice;e.splice=(s,r)=>{const n=i.apply(e,[s,r]);return this._resyncMeshes(),n},this._resyncMeshes()}_resyncMeshes(){for(const e of this.getScene().meshes)e._resyncLightSource(this)}_markMeshesAsLightDirty(){for(const e of this.getScene().meshes)e.lightSources.indexOf(this)!==-1&&e._markSubMeshesAsLightDirty()}_computePhotometricScale(){this._photometricScale=this._getPhotometricScale(),this.getScene().resetCachedMaterial()}_getPhotometricScale(){let e=0;const t=this.getTypeID();let i=this.intensityMode;switch(i===me.INTENSITYMODE_AUTOMATIC&&(t===me.LIGHTTYPEID_DIRECTIONALLIGHT?i=me.INTENSITYMODE_ILLUMINANCE:i=me.INTENSITYMODE_LUMINOUSINTENSITY),t){case me.LIGHTTYPEID_POINTLIGHT:case me.LIGHTTYPEID_SPOTLIGHT:switch(i){case me.INTENSITYMODE_LUMINOUSPOWER:e=1/(4*Math.PI);break;case me.INTENSITYMODE_LUMINOUSINTENSITY:e=1;break;case me.INTENSITYMODE_LUMINANCE:e=this.radius*this.radius;break}break;case me.LIGHTTYPEID_DIRECTIONALLIGHT:switch(i){case me.INTENSITYMODE_ILLUMINANCE:e=1;break;case me.INTENSITYMODE_LUMINANCE:{let s=this.radius;s=Math.max(s,.001),e=2*Math.PI*(1-Math.cos(s));break}}break;case me.LIGHTTYPEID_HEMISPHERICLIGHT:e=1;break}return e}_reorderLightsInScene(){const e=this.getScene();this._renderPriority!=0&&(e.requireLightSorting=!0),this.getScene().sortLightsByPriority()}_isReady(){return!0}}me.FALLOFF_DEFAULT=Ee.FALLOFF_DEFAULT;me.FALLOFF_PHYSICAL=Ee.FALLOFF_PHYSICAL;me.FALLOFF_GLTF=Ee.FALLOFF_GLTF;me.FALLOFF_STANDARD=Ee.FALLOFF_STANDARD;me.LIGHTMAP_DEFAULT=Ee.LIGHTMAP_DEFAULT;me.LIGHTMAP_SPECULAR=Ee.LIGHTMAP_SPECULAR;me.LIGHTMAP_SHADOWSONLY=Ee.LIGHTMAP_SHADOWSONLY;me.INTENSITYMODE_AUTOMATIC=Ee.INTENSITYMODE_AUTOMATIC;me.INTENSITYMODE_LUMINOUSPOWER=Ee.INTENSITYMODE_LUMINOUSPOWER;me.INTENSITYMODE_LUMINOUSINTENSITY=Ee.INTENSITYMODE_LUMINOUSINTENSITY;me.INTENSITYMODE_ILLUMINANCE=Ee.INTENSITYMODE_ILLUMINANCE;me.INTENSITYMODE_LUMINANCE=Ee.INTENSITYMODE_LUMINANCE;me.LIGHTTYPEID_POINTLIGHT=Ee.LIGHTTYPEID_POINTLIGHT;me.LIGHTTYPEID_DIRECTIONALLIGHT=Ee.LIGHTTYPEID_DIRECTIONALLIGHT;me.LIGHTTYPEID_SPOTLIGHT=Ee.LIGHTTYPEID_SPOTLIGHT;me.LIGHTTYPEID_HEMISPHERICLIGHT=Ee.LIGHTTYPEID_HEMISPHERICLIGHT;me.LIGHTTYPEID_RECT_AREALIGHT=Ee.LIGHTTYPEID_RECT_AREALIGHT;T([At()],me.prototype,"diffuse",void 0);T([At()],me.prototype,"specular",void 0);T([R()],me.prototype,"falloffType",void 0);T([R()],me.prototype,"intensity",void 0);T([R()],me.prototype,"range",null);T([R()],me.prototype,"intensityMode",null);T([R()],me.prototype,"radius",null);T([R()],me.prototype,"_renderPriority",void 0);T([B("_reorderLightsInScene")],me.prototype,"renderPriority",void 0);T([R("shadowEnabled")],me.prototype,"_shadowEnabled",void 0);T([R("excludeWithLayerMask")],me.prototype,"_excludeWithLayerMask",void 0);T([R("includeOnlyWithLayerMask")],me.prototype,"_includeOnlyWithLayerMask",void 0);T([R("lightmapMode")],me.prototype,"_lightmapMode",void 0);class nr extends me{constructor(){super(...arguments),this._needProjectionMatrixCompute=!0,this._viewMatrix=P.Identity(),this._projectionMatrix=P.Identity()}_setPosition(e){this._position=e}get position(){return this._position}set position(e){this._setPosition(e)}_setDirection(e){this._direction=e}get direction(){return this._direction}set direction(e){this._setDirection(e)}get shadowMinZ(){return this._shadowMinZ}set shadowMinZ(e){this._shadowMinZ=e,this.forceProjectionMatrixCompute()}get shadowMaxZ(){return this._shadowMaxZ}set shadowMaxZ(e){this._shadowMaxZ=e,this.forceProjectionMatrixCompute()}computeTransformedInformation(){return this.parent&&this.parent.getWorldMatrix?(this.transformedPosition||(this.transformedPosition=_.Zero()),_.TransformCoordinatesToRef(this.position,this.parent.getWorldMatrix(),this.transformedPosition),this.direction&&(this.transformedDirection||(this.transformedDirection=_.Zero()),_.TransformNormalToRef(this.direction,this.parent.getWorldMatrix(),this.transformedDirection)),!0):!1}getDepthScale(){return 50}getShadowDirection(e){return this.transformedDirection?this.transformedDirection:this.direction}getAbsolutePosition(){return this.transformedPosition?this.transformedPosition:this.position}setDirectionToTarget(e){return this.direction=_.Normalize(e.subtract(this.position)),this.direction}getRotation(){this.direction.normalize();const e=_.Cross(this.direction,ts.Y),t=_.Cross(e,this.direction);return _.RotationFromAxis(e,t,this.direction)}needCube(){return!1}needProjectionMatrixCompute(){return this._needProjectionMatrixCompute}forceProjectionMatrixCompute(){this._needProjectionMatrixCompute=!0}_initCache(){super._initCache(),this._cache.position=_.Zero()}_isSynchronized(){return!!this._cache.position.equals(this.position)}computeWorldMatrix(e){return!e&&this.isSynchronized()?(this._currentRenderId=this.getScene().getRenderId(),this._worldMatrix):(this._updateCache(),this._cache.position.copyFrom(this.position),this._worldMatrix||(this._worldMatrix=P.Identity()),P.TranslationToRef(this.position.x,this.position.y,this.position.z,this._worldMatrix),this.parent&&this.parent.getWorldMatrix&&(this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(),this._worldMatrix),this._markSyncedWithParent()),this._worldMatrixDeterminantIsDirty=!0,this._worldMatrix)}getDepthMinZ(e){return this.shadowMinZ!==void 0?this.shadowMinZ:e?.minZ||0}getDepthMaxZ(e){return this.shadowMaxZ!==void 0?this.shadowMaxZ:e?.maxZ||1e4}setShadowProjectionMatrix(e,t,i){return this.customProjectionMatrixBuilder?this.customProjectionMatrixBuilder(t,i,e):this._setDefaultShadowProjectionMatrix(e,t,i),this}_syncParentEnabledState(){super._syncParentEnabledState(),(!this.parent||!this.parent.getWorldMatrix)&&(this.transformedPosition=null,this.transformedDirection=null)}getViewMatrix(e){const t=v.Vector3[0];let i=this.position;this.computeTransformedInformation()&&(i=this.transformedPosition),_.NormalizeToRef(this.getShadowDirection(e),t),Math.abs(_.Dot(t,_.Up()))===1&&(t.z=1e-13);const s=v.Vector3[1];return i.addToRef(t,s),P.LookAtLHToRef(i,s,_.Up(),this._viewMatrix),this._viewMatrix}getProjectionMatrix(e,t){return this.setShadowProjectionMatrix(this._projectionMatrix,e??this._viewMatrix,t??[]),this._projectionMatrix}}T([qt()],nr.prototype,"position",null);T([qt()],nr.prototype,"direction",null);T([R()],nr.prototype,"shadowMinZ",null);T([R()],nr.prototype,"shadowMaxZ",null);qe.AddNodeConstructor("Light_Type_1",(a,e)=>()=>new ii(a,_.Zero(),e));class ii extends nr{get shadowFrustumSize(){return this._shadowFrustumSize}set shadowFrustumSize(e){this._shadowFrustumSize=e,this.forceProjectionMatrixCompute()}get shadowOrthoScale(){return this._shadowOrthoScale}set shadowOrthoScale(e){this._shadowOrthoScale=e,this.forceProjectionMatrixCompute()}get orthoLeft(){return this._orthoLeft}set orthoLeft(e){this._orthoLeft=e}get orthoRight(){return this._orthoRight}set orthoRight(e){this._orthoRight=e}get orthoTop(){return this._orthoTop}set orthoTop(e){this._orthoTop=e}get orthoBottom(){return this._orthoBottom}set orthoBottom(e){this._orthoBottom=e}constructor(e,t,i,s){super(e,i,s),this._shadowFrustumSize=0,this._shadowOrthoScale=.1,this.autoUpdateExtends=!0,this.autoCalcShadowZBounds=!1,this._orthoLeft=Number.MAX_VALUE,this._orthoRight=Number.MIN_VALUE,this._orthoTop=Number.MIN_VALUE,this._orthoBottom=Number.MAX_VALUE,this.position=t.scale(-1),this.direction=t}getClassName(){return"DirectionalLight"}getTypeID(){return me.LIGHTTYPEID_DIRECTIONALLIGHT}_setDefaultShadowProjectionMatrix(e,t,i){this.shadowFrustumSize>0?this._setDefaultFixedFrustumShadowProjectionMatrix(e):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,i)}_setDefaultFixedFrustumShadowProjectionMatrix(e){const t=this.getScene().activeCamera;P.OrthoLHToRef(this.shadowFrustumSize,this.shadowFrustumSize,this.shadowMinZ!==void 0?this.shadowMinZ:t?t.minZ:0,this.shadowMaxZ!==void 0?this.shadowMaxZ:t?t.maxZ:1e4,e,this.getScene().getEngine().isNDCHalfZRange)}_setDefaultAutoExtendShadowProjectionMatrix(e,t,i){const s=this.getScene().activeCamera;if(this.autoUpdateExtends||this._orthoLeft===Number.MAX_VALUE){const c=_.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=-Number.MAX_VALUE,this._orthoTop=-Number.MAX_VALUE,this._orthoBottom=Number.MAX_VALUE;let u=Number.MAX_VALUE,f=-Number.MAX_VALUE;for(let d=0;dthis._orthoRight&&(this._orthoRight=c.x),c.y>this._orthoTop&&(this._orthoTop=c.y),this.autoCalcShadowZBounds&&(c.zf&&(f=c.z))}this.autoCalcShadowZBounds&&(this._shadowMinZ=u,this._shadowMaxZ=f)}const r=this._orthoRight-this._orthoLeft,n=this._orthoTop-this._orthoBottom,o=this.shadowMinZ!==void 0?this.shadowMinZ:s?.minZ||0,h=this.shadowMaxZ!==void 0?this.shadowMaxZ:s?.maxZ||1e4,l=this.getScene().getEngine().useReverseDepthBuffer;P.OrthoOffCenterLHToRef(this._orthoLeft-r*this.shadowOrthoScale,this._orthoRight+r*this.shadowOrthoScale,this._orthoBottom-n*this.shadowOrthoScale,this._orthoTop+n*this.shadowOrthoScale,l?h:o,l?o:h,e,this.getScene().getEngine().isNDCHalfZRange)}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}transferToEffect(e,t){return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t),this):(this._uniformBuffer.updateFloat4("vLightData",this.direction.x,this.direction.y,this.direction.z,1,t),this)}transferToNodeMaterialEffect(e,t){return this.computeTransformedInformation()?(e.setFloat3(t,this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z),this):(e.setFloat3(t,this.direction.x,this.direction.y,this.direction.z),this)}getDepthMinZ(e){const t=this._scene.getEngine();return!t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:1}getDepthMaxZ(e){const t=this._scene.getEngine();return t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:1}prepareLightSpecificDefines(e,t){e["DIRLIGHT"+t]=!0}}T([R()],ii.prototype,"shadowFrustumSize",null);T([R()],ii.prototype,"shadowOrthoScale",null);T([R()],ii.prototype,"autoUpdateExtends",void 0);T([R()],ii.prototype,"autoCalcShadowZBounds",void 0);T([R("orthoLeft")],ii.prototype,"_orthoLeft",void 0);T([R("orthoRight")],ii.prototype,"_orthoRight",void 0);T([R("orthoTop")],ii.prototype,"_orthoTop",void 0);T([R("orthoBottom")],ii.prototype,"_orthoBottom",void 0);nt("BABYLON.DirectionalLight",ii);qe.AddNodeConstructor("Light_Type_3",(a,e)=>()=>new Ss(a,_.Zero(),e));class Ss extends me{constructor(e,t,i,s){super(e,i,s),this.groundColor=new q(0,0,0),this.direction=t||_.Up()}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightGround",3),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}getClassName(){return"HemisphericLight"}setDirectionToTarget(e){return this.direction=_.Normalize(e.subtract(_.Zero())),this.direction}getShadowGenerator(){return null}transferToEffect(e,t){const i=_.Normalize(this.direction);return this._uniformBuffer.updateFloat4("vLightData",i.x,i.y,i.z,0,t),this._uniformBuffer.updateColor3("vLightGround",this.groundColor.scale(this.intensity),t),this}transferToNodeMaterialEffect(e,t){const i=_.Normalize(this.direction);return e.setFloat3(t,i.x,i.y,i.z),this}computeWorldMatrix(){return this._worldMatrix||(this._worldMatrix=P.Identity()),this._worldMatrix}getTypeID(){return me.LIGHTTYPEID_HEMISPHERICLIGHT}prepareLightSpecificDefines(e,t){e["HEMILIGHT"+t]=!0}}T([At()],Ss.prototype,"groundColor",void 0);T([qt()],Ss.prototype,"direction",void 0);nt("BABYLON.HemisphericLight",Ss);class ya{constructor(){this._count=0,this._data={}}copyFrom(e){this.clear(),e.forEach((t,i)=>this.add(t,i))}get(e){const t=this._data[e];if(t!==void 0)return t}getOrAddWithFactory(e,t){let i=this.get(e);return i!==void 0||(i=t(e),i&&this.add(e,i)),i}getOrAdd(e,t){const i=this.get(e);return i!==void 0?i:(this.add(e,t),t)}contains(e){return this._data[e]!==void 0}add(e,t){return this._data[e]!==void 0?!1:(this._data[e]=t,++this._count,!0)}set(e,t){return this._data[e]===void 0?!1:(this._data[e]=t,!0)}getAndRemove(e){const t=this.get(e);return t!==void 0?(delete this._data[e],--this._count,t):null}remove(e){return this.contains(e)?(delete this._data[e],--this._count,!0):!1}clear(){this._data={},this._count=0}get count(){return this._count}forEach(e){for(const t in this._data){const i=this._data[t];e(t,i)}}first(e){for(const t in this._data){const i=this._data[t],s=e(t,i);if(s)return s}return null}}function Rh(a){a.push("vCameraColorCurveNeutral","vCameraColorCurvePositive","vCameraColorCurveNegative")}class Le{constructor(){this._dirty=!0,this._tempColor=new fe(0,0,0,0),this._globalCurve=new fe(0,0,0,0),this._highlightsCurve=new fe(0,0,0,0),this._midtonesCurve=new fe(0,0,0,0),this._shadowsCurve=new fe(0,0,0,0),this._positiveCurve=new fe(0,0,0,0),this._negativeCurve=new fe(0,0,0,0),this._globalHue=30,this._globalDensity=0,this._globalSaturation=0,this._globalExposure=0,this._highlightsHue=30,this._highlightsDensity=0,this._highlightsSaturation=0,this._highlightsExposure=0,this._midtonesHue=30,this._midtonesDensity=0,this._midtonesSaturation=0,this._midtonesExposure=0,this._shadowsHue=30,this._shadowsDensity=0,this._shadowsSaturation=0,this._shadowsExposure=0}get globalHue(){return this._globalHue}set globalHue(e){this._globalHue=e,this._dirty=!0}get globalDensity(){return this._globalDensity}set globalDensity(e){this._globalDensity=e,this._dirty=!0}get globalSaturation(){return this._globalSaturation}set globalSaturation(e){this._globalSaturation=e,this._dirty=!0}get globalExposure(){return this._globalExposure}set globalExposure(e){this._globalExposure=e,this._dirty=!0}get highlightsHue(){return this._highlightsHue}set highlightsHue(e){this._highlightsHue=e,this._dirty=!0}get highlightsDensity(){return this._highlightsDensity}set highlightsDensity(e){this._highlightsDensity=e,this._dirty=!0}get highlightsSaturation(){return this._highlightsSaturation}set highlightsSaturation(e){this._highlightsSaturation=e,this._dirty=!0}get highlightsExposure(){return this._highlightsExposure}set highlightsExposure(e){this._highlightsExposure=e,this._dirty=!0}get midtonesHue(){return this._midtonesHue}set midtonesHue(e){this._midtonesHue=e,this._dirty=!0}get midtonesDensity(){return this._midtonesDensity}set midtonesDensity(e){this._midtonesDensity=e,this._dirty=!0}get midtonesSaturation(){return this._midtonesSaturation}set midtonesSaturation(e){this._midtonesSaturation=e,this._dirty=!0}get midtonesExposure(){return this._midtonesExposure}set midtonesExposure(e){this._midtonesExposure=e,this._dirty=!0}get shadowsHue(){return this._shadowsHue}set shadowsHue(e){this._shadowsHue=e,this._dirty=!0}get shadowsDensity(){return this._shadowsDensity}set shadowsDensity(e){this._shadowsDensity=e,this._dirty=!0}get shadowsSaturation(){return this._shadowsSaturation}set shadowsSaturation(e){this._shadowsSaturation=e,this._dirty=!0}get shadowsExposure(){return this._shadowsExposure}set shadowsExposure(e){this._shadowsExposure=e,this._dirty=!0}getClassName(){return"ColorCurves"}static Bind(e,t,i="vCameraColorCurvePositive",s="vCameraColorCurveNeutral",r="vCameraColorCurveNegative"){e._dirty&&(e._dirty=!1,e._getColorGradingDataToRef(e._globalHue,e._globalDensity,e._globalSaturation,e._globalExposure,e._globalCurve),e._getColorGradingDataToRef(e._highlightsHue,e._highlightsDensity,e._highlightsSaturation,e._highlightsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._highlightsCurve),e._getColorGradingDataToRef(e._midtonesHue,e._midtonesDensity,e._midtonesSaturation,e._midtonesExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._midtonesCurve),e._getColorGradingDataToRef(e._shadowsHue,e._shadowsDensity,e._shadowsSaturation,e._shadowsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._shadowsCurve),e._highlightsCurve.subtractToRef(e._midtonesCurve,e._positiveCurve),e._midtonesCurve.subtractToRef(e._shadowsCurve,e._negativeCurve)),t&&(t.setFloat4(i,e._positiveCurve.r,e._positiveCurve.g,e._positiveCurve.b,e._positiveCurve.a),t.setFloat4(s,e._midtonesCurve.r,e._midtonesCurve.g,e._midtonesCurve.b,e._midtonesCurve.a),t.setFloat4(r,e._negativeCurve.r,e._negativeCurve.g,e._negativeCurve.b,e._negativeCurve.a))}_getColorGradingDataToRef(e,t,i,s,r){e!=null&&(e=Le._Clamp(e,0,360),t=Le._Clamp(t,-100,100),i=Le._Clamp(i,-100,100),s=Le._Clamp(s,-100,100),t=Le._ApplyColorGradingSliderNonlinear(t),t*=.5,s=Le._ApplyColorGradingSliderNonlinear(s),t<0&&(t*=-1,e=(e+180)%360),Le._FromHSBToRef(e,t,50+.25*s,r),r.scaleToRef(2,r),r.a=1+.01*i)}static _ApplyColorGradingSliderNonlinear(e){e/=100;let t=Math.abs(e);return t=Math.pow(t,2),e<0&&(t*=-1),t*=100,t}static _FromHSBToRef(e,t,i,s){let r=Le._Clamp(e,0,360);const n=Le._Clamp(t/100,0,1),o=Le._Clamp(i/100,0,1);if(n===0)s.r=o,s.g=o,s.b=o;else{r/=60;const h=Math.floor(r),l=r-h,c=o*(1-n),u=o*(1-n*l),f=o*(1-n*(1-l));switch(h){case 0:s.r=o,s.g=f,s.b=c;break;case 1:s.r=u,s.g=o,s.b=c;break;case 2:s.r=c,s.g=o,s.b=f;break;case 3:s.r=c,s.g=u,s.b=o;break;case 4:s.r=f,s.g=c,s.b=o;break;default:s.r=o,s.g=c,s.b=u;break}}s.a=1}static _Clamp(e,t,i){return Math.min(Math.max(e,t),i)}clone(){return le.Clone(()=>new Le,this)}serialize(){return le.Serialize(this)}static Parse(e){return le.Parse(()=>new Le,e,null,null)}}Le.PrepareUniforms=Rh;T([R()],Le.prototype,"_globalHue",void 0);T([R()],Le.prototype,"_globalDensity",void 0);T([R()],Le.prototype,"_globalSaturation",void 0);T([R()],Le.prototype,"_globalExposure",void 0);T([R()],Le.prototype,"_highlightsHue",void 0);T([R()],Le.prototype,"_highlightsDensity",void 0);T([R()],Le.prototype,"_highlightsSaturation",void 0);T([R()],Le.prototype,"_highlightsExposure",void 0);T([R()],Le.prototype,"_midtonesHue",void 0);T([R()],Le.prototype,"_midtonesDensity",void 0);T([R()],Le.prototype,"_midtonesSaturation",void 0);T([R()],Le.prototype,"_midtonesExposure",void 0);le._ColorCurvesParser=Le.Parse;function Su(a,e){e.EXPOSURE&&a.push("exposureLinear"),e.CONTRAST&&a.push("contrast"),e.COLORGRADING&&a.push("colorTransformSettings"),(e.VIGNETTE||e.DITHER)&&a.push("vInverseScreenSize"),e.VIGNETTE&&(a.push("vignetteSettings1"),a.push("vignetteSettings2")),e.COLORCURVES&&Rh(a),e.DITHER&&a.push("ditherIntensity")}function Mu(a,e){e.COLORGRADING&&a.push("txColorTransform")}class ue{constructor(){this.colorCurves=new Le,this._colorCurvesEnabled=!1,this._colorGradingEnabled=!1,this._colorGradingWithGreenDepth=!0,this._colorGradingBGR=!0,this._exposure=1,this._toneMappingEnabled=!1,this._toneMappingType=ue.TONEMAPPING_STANDARD,this._contrast=1,this.vignetteStretch=0,this.vignetteCenterX=0,this.vignetteCenterY=0,this.vignetteWeight=1.5,this.vignetteColor=new fe(0,0,0,0),this.vignetteCameraFov=.5,this._vignetteBlendMode=ue.VIGNETTEMODE_MULTIPLY,this._vignetteEnabled=!1,this._ditheringEnabled=!1,this._ditheringIntensity=1/255,this._skipFinalColorClamp=!1,this._applyByPostProcess=!1,this._isEnabled=!0,this.outputTextureWidth=0,this.outputTextureHeight=0,this.onUpdateParameters=new O}get colorCurvesEnabled(){return this._colorCurvesEnabled}set colorCurvesEnabled(e){this._colorCurvesEnabled!==e&&(this._colorCurvesEnabled=e,this._updateParameters())}get colorGradingTexture(){return this._colorGradingTexture}set colorGradingTexture(e){this._colorGradingTexture!==e&&(this._colorGradingTexture=e,this._updateParameters())}get colorGradingEnabled(){return this._colorGradingEnabled}set colorGradingEnabled(e){this._colorGradingEnabled!==e&&(this._colorGradingEnabled=e,this._updateParameters())}get colorGradingWithGreenDepth(){return this._colorGradingWithGreenDepth}set colorGradingWithGreenDepth(e){this._colorGradingWithGreenDepth!==e&&(this._colorGradingWithGreenDepth=e,this._updateParameters())}get colorGradingBGR(){return this._colorGradingBGR}set colorGradingBGR(e){this._colorGradingBGR!==e&&(this._colorGradingBGR=e,this._updateParameters())}get exposure(){return this._exposure}set exposure(e){this._exposure!==e&&(this._exposure=e,this._updateParameters())}get toneMappingEnabled(){return this._toneMappingEnabled}set toneMappingEnabled(e){this._toneMappingEnabled!==e&&(this._toneMappingEnabled=e,this._updateParameters())}get toneMappingType(){return this._toneMappingType}set toneMappingType(e){this._toneMappingType!==e&&(this._toneMappingType=e,this._updateParameters())}get contrast(){return this._contrast}set contrast(e){this._contrast!==e&&(this._contrast=e,this._updateParameters())}get vignetteCentreY(){return this.vignetteCenterY}set vignetteCentreY(e){this.vignetteCenterY=e}get vignetteCentreX(){return this.vignetteCenterX}set vignetteCentreX(e){this.vignetteCenterX=e}get vignetteBlendMode(){return this._vignetteBlendMode}set vignetteBlendMode(e){this._vignetteBlendMode!==e&&(this._vignetteBlendMode=e,this._updateParameters())}get vignetteEnabled(){return this._vignetteEnabled}set vignetteEnabled(e){this._vignetteEnabled!==e&&(this._vignetteEnabled=e,this._updateParameters())}get ditheringEnabled(){return this._ditheringEnabled}set ditheringEnabled(e){this._ditheringEnabled!==e&&(this._ditheringEnabled=e,this._updateParameters())}get ditheringIntensity(){return this._ditheringIntensity}set ditheringIntensity(e){this._ditheringIntensity!==e&&(this._ditheringIntensity=e,this._updateParameters())}get skipFinalColorClamp(){return this._skipFinalColorClamp}set skipFinalColorClamp(e){this._skipFinalColorClamp!==e&&(this._skipFinalColorClamp=e,this._updateParameters())}get applyByPostProcess(){return this._applyByPostProcess}set applyByPostProcess(e){this._applyByPostProcess!==e&&(this._applyByPostProcess=e,this._updateParameters())}get isEnabled(){return this._isEnabled}set isEnabled(e){this._isEnabled!==e&&(this._isEnabled=e,this._updateParameters())}_updateParameters(){this.onUpdateParameters.notifyObservers(this)}getClassName(){return"ImageProcessingConfiguration"}prepareDefines(e,t=!1){if(t!==this.applyByPostProcess||!this._isEnabled){e.VIGNETTE=!1,e.TONEMAPPING=0,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.DITHER=!1,e.IMAGEPROCESSING=!1,e.SKIPFINALCOLORCLAMP=this.skipFinalColorClamp,e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess&&this._isEnabled;return}if(e.VIGNETTE=this.vignetteEnabled,e.VIGNETTEBLENDMODEMULTIPLY=this.vignetteBlendMode===ue._VIGNETTEMODE_MULTIPLY,e.VIGNETTEBLENDMODEOPAQUE=!e.VIGNETTEBLENDMODEMULTIPLY,!this._toneMappingEnabled)e.TONEMAPPING=0;else switch(this._toneMappingType){case ue.TONEMAPPING_KHR_PBR_NEUTRAL:e.TONEMAPPING=3;break;case ue.TONEMAPPING_ACES:e.TONEMAPPING=2;break;default:e.TONEMAPPING=1;break}e.CONTRAST=this.contrast!==1,e.EXPOSURE=this.exposure!==1,e.COLORCURVES=this.colorCurvesEnabled&&!!this.colorCurves,e.COLORGRADING=this.colorGradingEnabled&&!!this.colorGradingTexture,e.COLORGRADING?e.COLORGRADING3D=this.colorGradingTexture.is3D:e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=this.colorGradingWithGreenDepth,e.SAMPLER3DBGRMAP=this.colorGradingBGR,e.DITHER=this._ditheringEnabled,e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess,e.SKIPFINALCOLORCLAMP=this.skipFinalColorClamp,e.IMAGEPROCESSING=e.VIGNETTE||!!e.TONEMAPPING||e.CONTRAST||e.EXPOSURE||e.COLORCURVES||e.COLORGRADING||e.DITHER}isReady(){return!this.colorGradingEnabled||!this.colorGradingTexture||this.colorGradingTexture.isReady()}bind(e,t){if(this._colorCurvesEnabled&&this.colorCurves&&Le.Bind(this.colorCurves,e),this._vignetteEnabled||this._ditheringEnabled){const i=1/(this.outputTextureWidth||e.getEngine().getRenderWidth()),s=1/(this.outputTextureHeight||e.getEngine().getRenderHeight());if(e.setFloat2("vInverseScreenSize",i,s),this._ditheringEnabled&&e.setFloat("ditherIntensity",.5*this._ditheringIntensity),this._vignetteEnabled){const r=t??s/i;let n=Math.tan(this.vignetteCameraFov*.5),o=n*r;const h=Math.sqrt(o*n);o=mn(o,h,this.vignetteStretch),n=mn(n,h,this.vignetteStretch),e.setFloat4("vignetteSettings1",o,n,-o*this.vignetteCenterX,-n*this.vignetteCenterY);const l=-2*this.vignetteWeight;e.setFloat4("vignetteSettings2",this.vignetteColor.r,this.vignetteColor.g,this.vignetteColor.b,l)}}if(e.setFloat("exposureLinear",this.exposure),e.setFloat("contrast",this.contrast),this.colorGradingTexture){e.setTexture("txColorTransform",this.colorGradingTexture);const i=this.colorGradingTexture.getSize().height;e.setFloat4("colorTransformSettings",(i-1)/i,.5/i,i,this.colorGradingTexture.level)}}clone(){return le.Clone(()=>new ue,this)}serialize(){return le.Serialize(this)}static Parse(e){const t=le.Parse(()=>new ue,e,null,null);return e.vignetteCentreX!==void 0&&(t.vignetteCenterX=e.vignetteCentreX),e.vignetteCentreY!==void 0&&(t.vignetteCenterY=e.vignetteCentreY),t}static get VIGNETTEMODE_MULTIPLY(){return this._VIGNETTEMODE_MULTIPLY}static get VIGNETTEMODE_OPAQUE(){return this._VIGNETTEMODE_OPAQUE}}ue.TONEMAPPING_STANDARD=0;ue.TONEMAPPING_ACES=1;ue.TONEMAPPING_KHR_PBR_NEUTRAL=2;ue.PrepareUniforms=Su;ue.PrepareSamplers=Mu;ue._VIGNETTEMODE_MULTIPLY=0;ue._VIGNETTEMODE_OPAQUE=1;T([pl()],ue.prototype,"colorCurves",void 0);T([R()],ue.prototype,"_colorCurvesEnabled",void 0);T([Oe("colorGradingTexture")],ue.prototype,"_colorGradingTexture",void 0);T([R()],ue.prototype,"_colorGradingEnabled",void 0);T([R()],ue.prototype,"_colorGradingWithGreenDepth",void 0);T([R()],ue.prototype,"_colorGradingBGR",void 0);T([R()],ue.prototype,"_exposure",void 0);T([R()],ue.prototype,"_toneMappingEnabled",void 0);T([R()],ue.prototype,"_toneMappingType",void 0);T([R()],ue.prototype,"_contrast",void 0);T([R()],ue.prototype,"vignetteStretch",void 0);T([R()],ue.prototype,"vignetteCenterX",void 0);T([R()],ue.prototype,"vignetteCenterY",void 0);T([R()],ue.prototype,"vignetteWeight",void 0);T([fo()],ue.prototype,"vignetteColor",void 0);T([R()],ue.prototype,"vignetteCameraFov",void 0);T([R()],ue.prototype,"_vignetteBlendMode",void 0);T([R()],ue.prototype,"_vignetteEnabled",void 0);T([R()],ue.prototype,"_ditheringEnabled",void 0);T([R()],ue.prototype,"_ditheringIntensity",void 0);T([R()],ue.prototype,"_skipFinalColorClamp",void 0);T([R()],ue.prototype,"_applyByPostProcess",void 0);T([R()],ue.prototype,"_isEnabled",void 0);T([R()],ue.prototype,"outputTextureWidth",void 0);T([R()],ue.prototype,"outputTextureHeight",void 0);le._ImageProcessingConfigurationParser=ue.Parse;nt("BABYLON.ImageProcessingConfiguration",ue);class lt{constructor(e,t,i,s,r,n){this.source=e,this.pointerX=t,this.pointerY=i,this.meshUnderPointer=s,this.sourceEvent=r,this.additionalData=n}static CreateNew(e,t,i){const s=e.getScene();return new lt(e,s.pointerX,s.pointerY,s.meshUnderPointer||e,t,i)}static CreateNewFromSprite(e,t,i,s){return new lt(e,t.pointerX,t.pointerY,t.meshUnderPointer,i,s)}static CreateNewFromScene(e,t){return new lt(null,e.pointerX,e.pointerY,e.meshUnderPointer,t)}static CreateNewFromPrimitive(e,t,i,s){return new lt(e,t.x,t.y,null,i,s)}}class Rn{constructor(e){this._vertexBuffers={},this.onBeforeRenderObservable=new O,this._scene=e}_prepareBuffers(){if(this._vertexBuffers[b.PositionKind])return;const e=[];e.push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1),this._vertexBuffers[b.PositionKind]=new b(this._scene.getEngine(),e,b.PositionKind,!1,!1,2),this._buildIndexBuffer()}_buildIndexBuffer(){const e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)}_rebuild(){const e=this._vertexBuffers[b.PositionKind];e&&(e._rebuild(),this._buildIndexBuffer())}_prepareFrame(e=null,t=null){const i=this._scene.activeCamera;return!i||(t=t||i._postProcesses.filter(s=>s!=null),!t||t.length===0||!this._scene.postProcessesEnabled)?!1:(t[0].activate(i,e,t!=null),!0)}directRender(e,t=null,i=!1,s=0,r=0,n=!1,o=e.length){const h=this._scene.getEngine();for(let l=0;lh!=null),s.length===0||!this._scene.postProcessesEnabled))return;const o=this._scene.getEngine();for(let h=0,l=s.length;ht._alphaIndex?1:e._alphaIndext._distanceToCamera?-1:0}static frontToBackSortCompare(e,t){return e._distanceToCamerat._distanceToCamera?1:0}static PainterSortCompare(e,t){const i=e.getMesh(),s=t.getMesh();return i.material&&s.material?i.material.uniqueId-s.material.uniqueId:i.uniqueId-s.uniqueId}prepare(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),this._particleSystems.reset(),this.prepareSprites(),this._edgesRenderers.reset(),this._empty=!0}prepareSprites(){this._spriteManagers.reset()}dispose(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()}dispatch(e,t,i){t===void 0&&(t=e.getMesh()),i===void 0&&(i=e.getMaterial()),i!=null&&(i.needAlphaBlendingForMesh(t)?this._transparentSubMeshes.push(e):i.needAlphaTestingForMesh(t)?(i.needDepthPrePass&&!this.disableDepthPrePass&&this._depthOnlySubMeshes.push(e),this._alphaTestSubMeshes.push(e)):(i.needDepthPrePass&&!this.disableDepthPrePass&&this._depthOnlySubMeshes.push(e),this._opaqueSubMeshes.push(e)),t._renderingGroup=this,t._edgesRenderer&&t.isEnabled()&&t.isVisible&&t._edgesRenderer.isEnabled&&this._edgesRenderers.pushNoDuplicate(t._edgesRenderer),this._empty=!1)}dispatchSprites(e){this._spriteManagers.push(e),this._empty=!1}dispatchParticles(e){this._particleSystems.push(e),this._empty=!1}_renderParticles(e){if(this._particleSystems.length===0)return;const t=this._scene.activeCamera;this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);for(let i=0;i=1&&t<=7)return!0}return!1}static HasSpecificTrigger(e){for(const t in wt.Triggers)if(Object.prototype.hasOwnProperty.call(wt.Triggers,t)&&parseInt(t)===e)return!0;return!1}}wt.Triggers={};var Y;(function(a){a[a.Generic=0]="Generic",a[a.Keyboard=1]="Keyboard",a[a.Mouse=2]="Mouse",a[a.Touch=3]="Touch",a[a.DualShock=4]="DualShock",a[a.Xbox=5]="Xbox",a[a.Switch=6]="Switch",a[a.DualSense=7]="DualSense"})(Y||(Y={}));var ee;(function(a){a[a.Horizontal=0]="Horizontal",a[a.Vertical=1]="Vertical",a[a.LeftClick=2]="LeftClick",a[a.MiddleClick=3]="MiddleClick",a[a.RightClick=4]="RightClick",a[a.BrowserBack=5]="BrowserBack",a[a.BrowserForward=6]="BrowserForward",a[a.MouseWheelX=7]="MouseWheelX",a[a.MouseWheelY=8]="MouseWheelY",a[a.MouseWheelZ=9]="MouseWheelZ",a[a.Move=12]="Move"})(ee||(ee={}));var xa;(function(a){a[a.Horizontal=0]="Horizontal",a[a.Vertical=1]="Vertical",a[a.LeftClick=2]="LeftClick",a[a.MiddleClick=3]="MiddleClick",a[a.RightClick=4]="RightClick",a[a.BrowserBack=5]="BrowserBack",a[a.BrowserForward=6]="BrowserForward",a[a.MouseWheelX=7]="MouseWheelX",a[a.MouseWheelY=8]="MouseWheelY",a[a.MouseWheelZ=9]="MouseWheelZ",a[a.DeltaHorizontal=10]="DeltaHorizontal",a[a.DeltaVertical=11]="DeltaVertical"})(xa||(xa={}));var Sa;(function(a){a[a.Cross=0]="Cross",a[a.Circle=1]="Circle",a[a.Square=2]="Square",a[a.Triangle=3]="Triangle",a[a.L1=4]="L1",a[a.R1=5]="R1",a[a.L2=6]="L2",a[a.R2=7]="R2",a[a.Share=8]="Share",a[a.Options=9]="Options",a[a.L3=10]="L3",a[a.R3=11]="R3",a[a.DPadUp=12]="DPadUp",a[a.DPadDown=13]="DPadDown",a[a.DPadLeft=14]="DPadLeft",a[a.DPadRight=15]="DPadRight",a[a.Home=16]="Home",a[a.TouchPad=17]="TouchPad",a[a.LStickXAxis=18]="LStickXAxis",a[a.LStickYAxis=19]="LStickYAxis",a[a.RStickXAxis=20]="RStickXAxis",a[a.RStickYAxis=21]="RStickYAxis"})(Sa||(Sa={}));var Ma;(function(a){a[a.Cross=0]="Cross",a[a.Circle=1]="Circle",a[a.Square=2]="Square",a[a.Triangle=3]="Triangle",a[a.L1=4]="L1",a[a.R1=5]="R1",a[a.L2=6]="L2",a[a.R2=7]="R2",a[a.Create=8]="Create",a[a.Options=9]="Options",a[a.L3=10]="L3",a[a.R3=11]="R3",a[a.DPadUp=12]="DPadUp",a[a.DPadDown=13]="DPadDown",a[a.DPadLeft=14]="DPadLeft",a[a.DPadRight=15]="DPadRight",a[a.Home=16]="Home",a[a.TouchPad=17]="TouchPad",a[a.LStickXAxis=18]="LStickXAxis",a[a.LStickYAxis=19]="LStickYAxis",a[a.RStickXAxis=20]="RStickXAxis",a[a.RStickYAxis=21]="RStickYAxis"})(Ma||(Ma={}));var Ca;(function(a){a[a.A=0]="A",a[a.B=1]="B",a[a.X=2]="X",a[a.Y=3]="Y",a[a.LB=4]="LB",a[a.RB=5]="RB",a[a.LT=6]="LT",a[a.RT=7]="RT",a[a.Back=8]="Back",a[a.Start=9]="Start",a[a.LS=10]="LS",a[a.RS=11]="RS",a[a.DPadUp=12]="DPadUp",a[a.DPadDown=13]="DPadDown",a[a.DPadLeft=14]="DPadLeft",a[a.DPadRight=15]="DPadRight",a[a.Home=16]="Home",a[a.LStickXAxis=17]="LStickXAxis",a[a.LStickYAxis=18]="LStickYAxis",a[a.RStickXAxis=19]="RStickXAxis",a[a.RStickYAxis=20]="RStickYAxis"})(Ca||(Ca={}));var Ia;(function(a){a[a.B=0]="B",a[a.A=1]="A",a[a.Y=2]="Y",a[a.X=3]="X",a[a.L=4]="L",a[a.R=5]="R",a[a.ZL=6]="ZL",a[a.ZR=7]="ZR",a[a.Minus=8]="Minus",a[a.Plus=9]="Plus",a[a.LS=10]="LS",a[a.RS=11]="RS",a[a.DPadUp=12]="DPadUp",a[a.DPadDown=13]="DPadDown",a[a.DPadLeft=14]="DPadLeft",a[a.DPadRight=15]="DPadRight",a[a.Home=16]="Home",a[a.Capture=17]="Capture",a[a.LStickXAxis=18]="LStickXAxis",a[a.LStickYAxis=19]="LStickYAxis",a[a.RStickXAxis=20]="RStickXAxis",a[a.RStickYAxis=21]="RStickYAxis"})(Ia||(Ia={}));class qi{static CreateDeviceEvent(e,t,i,s,r,n,o){switch(e){case Y.Keyboard:return this._CreateKeyboardEvent(i,s,r,n);case Y.Mouse:if(i===ee.MouseWheelX||i===ee.MouseWheelY||i===ee.MouseWheelZ)return this._CreateWheelEvent(e,t,i,s,r,n);case Y.Touch:return this._CreatePointerEvent(e,t,i,s,r,n,o);default:throw`Unable to generate event for device ${Y[e]}`}}static _CreatePointerEvent(e,t,i,s,r,n,o){const h=this._CreateMouseEvent(e,t,i,s,r,n);e===Y.Mouse?(h.deviceType=Y.Mouse,h.pointerId=1,h.pointerType="mouse"):(h.deviceType=Y.Touch,h.pointerId=o??t,h.pointerType="touch");let l=0;return l+=r.pollInput(e,t,ee.LeftClick),l+=r.pollInput(e,t,ee.RightClick)*2,l+=r.pollInput(e,t,ee.MiddleClick)*4,h.buttons=l,i===ee.Move?h.type="pointermove":i>=ee.LeftClick&&i<=ee.RightClick&&(h.type=s===1?"pointerdown":"pointerup",h.button=i-2),h}static _CreateWheelEvent(e,t,i,s,r,n){const o=this._CreateMouseEvent(e,t,i,s,r,n);switch(o.pointerId=1,o.type="wheel",o.deltaMode=sr.DOM_DELTA_PIXEL,o.deltaX=0,o.deltaY=0,o.deltaZ=0,i){case ee.MouseWheelX:o.deltaX=s;break;case ee.MouseWheelY:o.deltaY=s;break;case ee.MouseWheelZ:o.deltaZ=s;break}return o}static _CreateMouseEvent(e,t,i,s,r,n){const o=this._CreateEvent(n),h=r.pollInput(e,t,ee.Horizontal),l=r.pollInput(e,t,ee.Vertical);return n?(o.movementX=0,o.movementY=0,o.offsetX=o.movementX-n.getBoundingClientRect().x,o.offsetY=o.movementY-n.getBoundingClientRect().y):(o.movementX=r.pollInput(e,t,10),o.movementY=r.pollInput(e,t,11),o.offsetX=0,o.offsetY=0),this._CheckNonCharacterKeys(o,r),o.clientX=h,o.clientY=l,o.x=h,o.y=l,o.deviceType=e,o.deviceSlot=t,o.inputIndex=i,o}static _CreateKeyboardEvent(e,t,i,s){const r=this._CreateEvent(s);return this._CheckNonCharacterKeys(r,i),r.deviceType=Y.Keyboard,r.deviceSlot=0,r.inputIndex=e,r.type=t===1?"keydown":"keyup",r.key=String.fromCharCode(e),r.keyCode=e,r}static _CheckNonCharacterKeys(e,t){const i=t.isDeviceAvailable(Y.Keyboard),s=i&&t.pollInput(Y.Keyboard,0,18)===1,r=i&&t.pollInput(Y.Keyboard,0,17)===1,n=i&&(t.pollInput(Y.Keyboard,0,91)===1||t.pollInput(Y.Keyboard,0,92)===1||t.pollInput(Y.Keyboard,0,93)===1),o=i&&t.pollInput(Y.Keyboard,0,16)===1;e.altKey=s,e.ctrlKey=r,e.metaKey=n,e.shiftKey=o}static _CreateEvent(e){const t={};return t.preventDefault=()=>{},t.target=e,t}}class Iu{constructor(e,t,i){this._nativeInput=_native.DeviceInputSystem?new _native.DeviceInputSystem(e,t,(s,r,n,o)=>{const h=qi.CreateDeviceEvent(s,r,n,o,this);i(s,r,h)}):this._createDummyNativeInput()}pollInput(e,t,i){return this._nativeInput.pollInput(e,t,i)}isDeviceAvailable(e){return e===Y.Mouse||e===Y.Touch}dispose(){this._nativeInput.dispose()}_createDummyNativeInput(){return{pollInput:()=>0,isDeviceAvailable:()=>!1,dispose:()=>{}}}}const Pa=255,va=Object.keys(ee).length/2;class Pu{constructor(e,t,i,s){this._inputs=[],this._keyboardActive=!1,this._pointerActive=!1,this._usingSafari=se.IsSafari(),this._usingMacOs=hs()&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),this._keyboardDownEvent=r=>{},this._keyboardUpEvent=r=>{},this._keyboardBlurEvent=r=>{},this._pointerMoveEvent=r=>{},this._pointerDownEvent=r=>{},this._pointerUpEvent=r=>{},this._pointerCancelEvent=r=>{},this._pointerCancelTouch=r=>{},this._pointerLeaveEvent=r=>{},this._pointerWheelEvent=r=>{},this._pointerBlurEvent=r=>{},this._pointerMacOsChromeOutEvent=r=>{},this._eventsAttached=!1,this._mouseId=-1,this._isUsingFirefox=hs()&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox")!==-1,this._isUsingChromium=hs()&&navigator.userAgent&&navigator.userAgent.indexOf("Chrome")!==-1,this._maxTouchPoints=0,this._pointerInputClearObserver=null,this._gamepadConnectedEvent=r=>{},this._gamepadDisconnectedEvent=r=>{},this._eventPrefix=se.GetPointerPrefix(e),this._engine=e,this._onDeviceConnected=t,this._onDeviceDisconnected=i,this._onInputChanged=s,this._mouseId=this._isUsingFirefox?0:1,this._enableEvents(),this._usingMacOs&&(this._metaKeys=[]),this._engine._onEngineViewChanged||(this._engine._onEngineViewChanged=()=>{this._enableEvents()})}pollInput(e,t,i){const s=this._inputs[e][t];if(!s)throw`Unable to find device ${Y[e]}`;e>=Y.DualShock&&e<=Y.DualSense&&this._updateDevice(e,t,i);const r=s[i];if(r===void 0)throw`Unable to find input ${i} for device ${Y[e]} in slot ${t}`;return i===ee.Move&&se.Warn("Unable to provide information for PointerInput.Move. Try using PointerInput.Horizontal or PointerInput.Vertical for move data."),r}isDeviceAvailable(e){return this._inputs[e]!==void 0}dispose(){this._onDeviceConnected=()=>{},this._onDeviceDisconnected=()=>{},this._onInputChanged=()=>{},delete this._engine._onEngineViewChanged,this._elementToAttachTo&&this._disableEvents()}_enableEvents(){const e=this?._engine.getInputElement();if(e&&(!this._eventsAttached||this._elementToAttachTo!==e)){if(this._disableEvents(),this._inputs){for(const t of this._inputs)if(t)for(const i in t){const s=+i,r=t[s];if(r)for(let n=0;n{this._keyboardActive||(this._keyboardActive=!0,this._registerDevice(Y.Keyboard,0,Pa));const t=this._inputs[Y.Keyboard][0];if(t){t[e.keyCode]=1;const i=e;i.inputIndex=e.keyCode,this._usingMacOs&&e.metaKey&&e.key!=="Meta"&&(this._metaKeys.includes(e.keyCode)||this._metaKeys.push(e.keyCode)),this._onInputChanged(Y.Keyboard,0,i)}},this._keyboardUpEvent=e=>{this._keyboardActive||(this._keyboardActive=!0,this._registerDevice(Y.Keyboard,0,Pa));const t=this._inputs[Y.Keyboard][0];if(t){t[e.keyCode]=0;const i=e;if(i.inputIndex=e.keyCode,this._usingMacOs&&e.key==="Meta"&&this._metaKeys.length>0){for(const s of this._metaKeys){const r=qi.CreateDeviceEvent(Y.Keyboard,0,s,0,this,this._elementToAttachTo);t[s]=0,this._onInputChanged(Y.Keyboard,0,r)}this._metaKeys.splice(0,this._metaKeys.length)}this._onInputChanged(Y.Keyboard,0,i)}},this._keyboardBlurEvent=()=>{if(this._keyboardActive){const e=this._inputs[Y.Keyboard][0];for(let t=0;t{const s=this._getPointerType(i);let r=s===Y.Mouse?0:this._activeTouchIds.indexOf(i.pointerId);if(s===Y.Touch&&r===-1){const o=this._activeTouchIds.indexOf(-1);if(o>=0)r=o,this._activeTouchIds[o]=i.pointerId,this._onDeviceConnected(s,r);else{se.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);return}}this._inputs[s]||(this._inputs[s]={}),this._inputs[s][r]||this._addPointerDevice(s,r,i.clientX,i.clientY);const n=this._inputs[s][r];if(n){const o=i;o.inputIndex=ee.Move,n[ee.Horizontal]=i.clientX,n[ee.Vertical]=i.clientY,s===Y.Touch&&n[ee.LeftClick]===0&&(n[ee.LeftClick]=1),i.pointerId===void 0&&(i.pointerId=this._mouseId),this._onInputChanged(s,r,o),!this._usingSafari&&i.button!==-1&&(o.inputIndex=i.button+2,n[i.button+2]=n[i.button+2]?0:1,this._onInputChanged(s,r,o))}},this._pointerDownEvent=i=>{const s=this._getPointerType(i);let r=s===Y.Mouse?0:i.pointerId;if(s===Y.Touch){let o=this._activeTouchIds.indexOf(i.pointerId);if(o===-1&&(o=this._activeTouchIds.indexOf(-1)),o>=0)r=o,this._activeTouchIds[o]=i.pointerId;else{se.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);return}}this._inputs[s]||(this._inputs[s]={}),this._inputs[s][r]?s===Y.Touch&&this._onDeviceConnected(s,r):this._addPointerDevice(s,r,i.clientX,i.clientY);const n=this._inputs[s][r];if(n){const o=n[ee.Horizontal],h=n[ee.Vertical];if(s===Y.Mouse){if(i.pointerId===void 0&&(i.pointerId=this._mouseId),!document.pointerLockElement)try{this._elementToAttachTo.setPointerCapture(this._mouseId)}catch{}}else if(i.pointerId&&!document.pointerLockElement)try{this._elementToAttachTo.setPointerCapture(i.pointerId)}catch{}n[ee.Horizontal]=i.clientX,n[ee.Vertical]=i.clientY,n[i.button+2]=1;const l=i;l.inputIndex=i.button+2,this._onInputChanged(s,r,l),(o!==i.clientX||h!==i.clientY)&&(l.inputIndex=ee.Move,this._onInputChanged(s,r,l))}},this._pointerUpEvent=i=>{const s=this._getPointerType(i),r=s===Y.Mouse?0:this._activeTouchIds.indexOf(i.pointerId);if(s===Y.Touch){if(r===-1)return;this._activeTouchIds[r]=-1}const n=this._inputs[s]?.[r];let o=i.button,h=n&&n[o+2]!==0;if(!h&&this._isUsingFirefox&&this._usingMacOs&&n&&(o=o===2?0:2,h=n[o+2]!==0),h){const l=n[ee.Horizontal],c=n[ee.Vertical];n[ee.Horizontal]=i.clientX,n[ee.Vertical]=i.clientY,n[o+2]=0;const u=i;i.pointerId===void 0&&(i.pointerId=this._mouseId),(l!==i.clientX||c!==i.clientY)&&(u.inputIndex=ee.Move,this._onInputChanged(s,r,u)),u.inputIndex=o+2,s===Y.Mouse&&this._mouseId>=0&&this._elementToAttachTo.hasPointerCapture?.(this._mouseId)?this._elementToAttachTo.releasePointerCapture(this._mouseId):i.pointerId&&this._elementToAttachTo.hasPointerCapture?.(i.pointerId)&&this._elementToAttachTo.releasePointerCapture(i.pointerId),this._onInputChanged(s,r,u),s===Y.Touch&&this._onDeviceDisconnected(s,r)}},this._pointerCancelTouch=i=>{const s=this._activeTouchIds.indexOf(i);if(s===-1)return;this._elementToAttachTo.hasPointerCapture?.(i)&&this._elementToAttachTo.releasePointerCapture(i),this._inputs[Y.Touch][s][ee.LeftClick]=0;const r=qi.CreateDeviceEvent(Y.Touch,s,ee.LeftClick,0,this,this._elementToAttachTo,i);this._onInputChanged(Y.Touch,s,r),this._activeTouchIds[s]=-1,this._onDeviceDisconnected(Y.Touch,s)},this._pointerCancelEvent=i=>{if(i.pointerType==="mouse"){const s=this._inputs[Y.Mouse][0];this._mouseId>=0&&this._elementToAttachTo.hasPointerCapture?.(this._mouseId)&&this._elementToAttachTo.releasePointerCapture(this._mouseId);for(let r=ee.LeftClick;r<=ee.BrowserForward;r++)if(s[r]===1){s[r]=0;const n=qi.CreateDeviceEvent(Y.Mouse,0,r,0,this,this._elementToAttachTo);this._onInputChanged(Y.Mouse,0,n)}}else this._pointerCancelTouch(i.pointerId)},this._pointerLeaveEvent=i=>{i.pointerType==="pen"&&this._pointerCancelTouch(i.pointerId)},this._wheelEventName="onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll";let e=!1;const t=function(){};try{const i=Object.defineProperty({},"passive",{get:function(){e=!0}});this._elementToAttachTo.addEventListener("test",t,i),this._elementToAttachTo.removeEventListener("test",t,i)}catch{}this._pointerBlurEvent=()=>{if(this.isDeviceAvailable(Y.Mouse)){const i=this._inputs[Y.Mouse][0];this._mouseId>=0&&this._elementToAttachTo.hasPointerCapture?.(this._mouseId)&&this._elementToAttachTo.releasePointerCapture(this._mouseId);for(let s=ee.LeftClick;s<=ee.BrowserForward;s++)if(i[s]===1){i[s]=0;const r=qi.CreateDeviceEvent(Y.Mouse,0,s,0,this,this._elementToAttachTo);this._onInputChanged(Y.Mouse,0,r)}}if(this.isDeviceAvailable(Y.Touch)){const i=this._inputs[Y.Touch];for(let s=0;s{const s=Y.Mouse,r=0;this._inputs[s]||(this._inputs[s]=[]),this._inputs[s][r]||(this._pointerActive=!0,this._registerDevice(s,r,va));const n=this._inputs[s][r];if(n){n[ee.MouseWheelX]=i.deltaX||0,n[ee.MouseWheelY]=i.deltaY||i.wheelDelta||0,n[ee.MouseWheelZ]=i.deltaZ||0;const o=i;i.pointerId===void 0&&(i.pointerId=this._mouseId),n[ee.MouseWheelX]!==0&&(o.inputIndex=ee.MouseWheelX,this._onInputChanged(s,r,o)),n[ee.MouseWheelY]!==0&&(o.inputIndex=ee.MouseWheelY,this._onInputChanged(s,r,o)),n[ee.MouseWheelZ]!==0&&(o.inputIndex=ee.MouseWheelZ,this._onInputChanged(s,r,o))}},this._usingMacOs&&this._isUsingChromium&&(this._pointerMacOsChromeOutEvent=i=>{i.buttons>1&&this._pointerCancelEvent(i)},this._elementToAttachTo.addEventListener("lostpointercapture",this._pointerMacOsChromeOutEvent)),this._elementToAttachTo.addEventListener(this._eventPrefix+"move",this._pointerMoveEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"down",this._pointerDownEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"up",this._pointerUpEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"cancel",this._pointerCancelEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"leave",this._pointerLeaveEvent),this._elementToAttachTo.addEventListener("blur",this._pointerBlurEvent),this._elementToAttachTo.addEventListener(this._wheelEventName,this._pointerWheelEvent,e?{passive:!1}:!1),this._pointerInputClearObserver=this._engine.onEndFrameObservable.add(()=>{if(this.isDeviceAvailable(Y.Mouse)){const i=this._inputs[Y.Mouse][0];i[ee.MouseWheelX]=0,i[ee.MouseWheelY]=0,i[ee.MouseWheelZ]=0}})}_handleGamepadActions(){this._gamepadConnectedEvent=e=>{this._addGamePad(e.gamepad)},this._gamepadDisconnectedEvent=e=>{if(this._gamepads){const t=this._getGamepadDeviceType(e.gamepad.id),i=e.gamepad.index;this._unregisterDevice(t,i),delete this._gamepads[i]}},window.addEventListener("gamepadconnected",this._gamepadConnectedEvent),window.addEventListener("gamepaddisconnected",this._gamepadDisconnectedEvent)}_updateDevice(e,t,i){const s=navigator.getGamepads()[t];if(s&&e===this._gamepads[t]){const r=this._inputs[e][t];i>=s.buttons.length?r[i]=s.axes[i-s.buttons.length].valueOf():r[i]=s.buttons[i].value}}_getGamepadDeviceType(e){return e.indexOf("054c")!==-1?e.indexOf("0ce6")!==-1?Y.DualSense:Y.DualShock:e.indexOf("Xbox One")!==-1||e.search("Xbox 360")!==-1||e.search("xinput")!==-1?Y.Xbox:e.indexOf("057e")!==-1?Y.Switch:Y.Generic}_getPointerType(e){let t=Y.Mouse;return(e.pointerType==="touch"||e.pointerType==="pen"||e.touches)&&(t=Y.Touch),t}}class Da{constructor(e,t,i=0){this.deviceType=t,this.deviceSlot=i,this.onInputChangedObservable=new O,this._deviceInputSystem=e}getInput(e){return this._deviceInputSystem.pollInput(this.deviceType,this.deviceSlot,e)}}class vu{constructor(e){this._registeredManagers=new Array,this._refCount=0,this.registerManager=n=>{for(let o=0;o{const o=this._registeredManagers.indexOf(n);o>-1&&this._registeredManagers.splice(o,1)};const t=Object.keys(Y).length/2;this._devices=new Array(t);const i=(n,o)=>{this._devices[n]||(this._devices[n]=new Array),this._devices[n][o]||(this._devices[n][o]=o);for(const h of this._registeredManagers){const l=new Da(this._deviceInputSystem,n,o);h._addDevice(l)}},s=(n,o)=>{this._devices[n]?.[o]&&delete this._devices[n][o];for(const h of this._registeredManagers)h._removeDevice(n,o)},r=(n,o,h)=>{if(h)for(const l of this._registeredManagers)l._onInputChanged(n,o,h)};typeof _native<"u"?this._deviceInputSystem=new Iu(i,s,r):this._deviceInputSystem=new Pu(e,i,s,r)}dispose(){this._deviceInputSystem.dispose()}}class Du{getDeviceSource(e,t){if(t===void 0){if(this._firstDevice[e]===void 0)return null;t=this._firstDevice[e]}return!this._devices[e]||this._devices[e][t]===void 0?null:this._devices[e][t]}getDeviceSources(e){return this._devices[e]?this._devices[e].filter(t=>!!t):[]}constructor(e){const t=Object.keys(Y).length/2;this._devices=new Array(t),this._firstDevice=new Array(t),this._engine=e,this._engine._deviceSourceManager||(this._engine._deviceSourceManager=new vu(e)),this._engine._deviceSourceManager._refCount++,this.onDeviceConnectedObservable=new O(i=>{for(const s of this._devices)if(s)for(const r of s)r&&this.onDeviceConnectedObservable.notifyObserver(i,r)}),this.onDeviceDisconnectedObservable=new O,this._engine._deviceSourceManager.registerManager(this),this._onDisposeObserver=e.onDisposeObservable.add(()=>{this.dispose()})}dispose(){this.onDeviceConnectedObservable.clear(),this.onDeviceDisconnectedObservable.clear(),this._engine._deviceSourceManager&&(this._engine._deviceSourceManager.unregisterManager(this),--this._engine._deviceSourceManager._refCount<1&&(this._engine._deviceSourceManager.dispose(),delete this._engine._deviceSourceManager)),this._engine.onDisposeObservable.remove(this._onDisposeObserver)}_addDevice(e){this._devices[e.deviceType]||(this._devices[e.deviceType]=[]),this._devices[e.deviceType][e.deviceSlot]||(this._devices[e.deviceType][e.deviceSlot]=e,this._updateFirstDevices(e.deviceType)),this.onDeviceConnectedObservable.notifyObservers(e)}_removeDevice(e,t){const i=this._devices[e]?.[t];this.onDeviceDisconnectedObservable.notifyObservers(i),this._devices[e]?.[t]&&delete this._devices[e][t],this._updateFirstDevices(e)}_onInputChanged(e,t,i){this._devices[e]?.[t]?.onInputChangedObservable.notifyObservers(i)}_updateFirstDevices(e){switch(e){case Y.Keyboard:case Y.Mouse:this._firstDevice[e]=0;break;case Y.Touch:case Y.DualSense:case Y.DualShock:case Y.Xbox:case Y.Switch:case Y.Generic:{delete this._firstDevice[e];const t=this._devices[e];if(t){for(let i=0;i=ee.MouseWheelX&&t.inputIndex<=ee.MouseWheelZ?te.POINTERWHEEL:te.POINTERMOVE;i.onPointerMove&&(e=e||this._pickMove(t),i.onPointerMove(t,e,n));let o;e?(o=new kt(n,t,e),this._setRayOnPointerInfo(e,t)):(o=new kt(n,t,null,this),this._movePointerInfo=o),i.onPointerObservable.hasObservers()&&i.onPointerObservable.notifyObservers(o,n)}_setRayOnPointerInfo(e,t){const i=this._scene;e&&yh._IsPickingAvailable&&(e.ray||(e.ray=i.createPickingRay(t.offsetX,t.offsetY,P.Identity(),i.activeCamera)))}_addCameraPointerObserver(e,t){return this._cameraObserverCount++,this._scene.onPointerObservable.add(e,t)}_removeCameraPointerObserver(e){return this._cameraObserverCount--,this._scene.onPointerObservable.remove(e)}_checkForPicking(){return!!(this._scene.onPointerObservable.observers.length>this._cameraObserverCount||this._scene.onPointerPick)}_checkPrePointerObservable(e,t,i){const s=this._scene,r=new uu(i,t,this._unTranslatedPointerX,this._unTranslatedPointerY);return e&&(r.originalPickingInfo=e,r.ray=e.ray,t.pointerType==="xr-near"&&e.originMesh&&(r.nearInteractionPickingInfo=e)),s.onPrePointerObservable.notifyObservers(r,i),!!r.skipOnPointerObservable}_pickMove(e){const t=this._scene,i=t.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,t.pointerMovePredicate,t.pointerMoveFastCheck,t.cameraToUseForPointers,t.pointerMoveTrianglePredicate);return this._setCursorAndPointerOverMesh(i,e,t),i}_setCursorAndPointerOverMesh(e,t,i){const r=i.getEngine().getInputElement();if(e?.pickedMesh){if(this.setPointerOverMesh(e.pickedMesh,t.pointerId,e,t),!i.doNotHandleCursors&&r&&this._pointerOverMesh){const n=this._pointerOverMesh._getActionManagerForTrigger();n&&n.hasPointerTriggers&&(r.style.cursor=n.hoverCursor||i.hoverCursor)}}else this.setPointerOverMesh(null,t.pointerId,e,t)}simulatePointerMove(e,t){const i=new PointerEvent("pointermove",t);i.inputIndex=ee.Move,!this._checkPrePointerObservable(e,i,te.POINTERMOVE)&&this._processPointerMove(e,i)}simulatePointerDown(e,t){const i=new PointerEvent("pointerdown",t);i.inputIndex=i.button+2,!this._checkPrePointerObservable(e,i,te.POINTERDOWN)&&this._processPointerDown(e,i)}_processPointerDown(e,t){const i=this._scene;if(e?.pickedMesh){this._pickedDownMesh=e.pickedMesh;const n=e.pickedMesh._getActionManagerForTrigger();if(n){if(n.hasPickTriggers)switch(n.processTrigger(5,new lt(e.pickedMesh,i.pointerX,i.pointerY,e.pickedMesh,t,e)),t.button){case 0:n.processTrigger(2,new lt(e.pickedMesh,i.pointerX,i.pointerY,e.pickedMesh,t,e));break;case 1:n.processTrigger(4,new lt(e.pickedMesh,i.pointerX,i.pointerY,e.pickedMesh,t,e));break;case 2:n.processTrigger(3,new lt(e.pickedMesh,i.pointerX,i.pointerY,e.pickedMesh,t,e));break}n.hasSpecificTrigger(8)&&window.setTimeout(()=>{const o=i.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,h=>h.isPickable&&h.isVisible&&h.isReady()&&h.actionManager&&h.actionManager.hasSpecificTrigger(8)&&h===this._pickedDownMesh,!1,i.cameraToUseForPointers);o?.pickedMesh&&n&&this._activePointerIdsCount!==0&&Date.now()-this._startingPointerTime>Ke.LongPressDelay&&!this._isPointerSwiping()&&(this._startingPointerTime=0,n.processTrigger(8,lt.CreateNew(o.pickedMesh,t)))},Ke.LongPressDelay)}}else for(const n of i._pointerDownStage)e=n.action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t,!1);let s;const r=te.POINTERDOWN;e?(i.onPointerDown&&i.onPointerDown(t,e,r),s=new kt(r,t,e),this._setRayOnPointerInfo(e,t)):s=new kt(r,t,null,this),i.onPointerObservable.hasObservers()&&i.onPointerObservable.notifyObservers(s,r)}_isPointerSwiping(){return this._isSwiping}simulatePointerUp(e,t,i){const s=new PointerEvent("pointerup",t);s.inputIndex=ee.Move;const r=new Oa;i?r.doubleClick=!0:r.singleClick=!0,!this._checkPrePointerObservable(e,s,te.POINTERUP)&&this._processPointerUp(e,s,r)}_processPointerUp(e,t,i){const s=this._scene;if(e?.pickedMesh){if(this._pickedUpMesh=e.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(s.onPointerPick&&s.onPointerPick(t,e),i.singleClick&&!i.ignore&&s.onPointerObservable.observers.length>this._cameraObserverCount)){const n=te.POINTERPICK,o=new kt(n,t,e);this._setRayOnPointerInfo(e,t),s.onPointerObservable.notifyObservers(o,n)}const r=e.pickedMesh._getActionManagerForTrigger();if(r&&!i.ignore){r.processTrigger(7,lt.CreateNew(e.pickedMesh,t,e)),!i.hasSwiped&&i.singleClick&&r.processTrigger(1,lt.CreateNew(e.pickedMesh,t,e));const n=e.pickedMesh._getActionManagerForTrigger(6);i.doubleClick&&n&&n.processTrigger(6,lt.CreateNew(e.pickedMesh,t,e))}}else if(!i.ignore)for(const r of s._pointerUpStage)e=r.action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t,i.doubleClick);if(this._pickedDownMesh&&this._pickedDownMesh!==this._pickedUpMesh){const r=this._pickedDownMesh._getActionManagerForTrigger(16);r&&r.processTrigger(16,lt.CreateNew(this._pickedDownMesh,t))}if(!i.ignore){const r=new kt(te.POINTERUP,t,e);if(this._setRayOnPointerInfo(e,t),s.onPointerObservable.notifyObservers(r,te.POINTERUP),s.onPointerUp&&s.onPointerUp(t,e,te.POINTERUP),!i.hasSwiped&&!this._skipPointerTap&&!this._isMultiTouchGesture){let n=0;if(i.singleClick?n=te.POINTERTAP:i.doubleClick&&(n=te.POINTERDOUBLETAP),n){const o=new kt(n,t,e);s.onPointerObservable.hasObservers()&&s.onPointerObservable.hasSpecificMask(n)&&s.onPointerObservable.notifyObservers(o,n)}}}}isPointerCaptured(e=0){return this._pointerCaptures[e]}attachControl(e=!0,t=!0,i=!0,s=null){const r=this._scene,n=r.getEngine();s||(s=n.getInputElement()),this._alreadyAttached&&this.detachControl(),s&&(this._alreadyAttachedTo=s),this._deviceSourceManager=new Du(n),this._initActionManager=o=>{if(!this._meshPickProceed){const h=r.skipPointerUpPicking||r._registeredActions===0&&!this._checkForPicking()&&!r.onPointerUp?null:r.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,r.pointerUpPredicate,r.pointerUpFastCheck,r.cameraToUseForPointers,r.pointerUpTrianglePredicate);this._currentPickResult=h,h&&(o=h.hit&&h.pickedMesh?h.pickedMesh._getActionManagerForTrigger():null),this._meshPickProceed=!0}return o},this._delayedSimpleClick=(o,h,l)=>{if((Date.now()-this._previousStartingPointerTime>Ke.DoubleClickDelay&&!this._doubleClickOccured||o!==this._previousButtonPressed)&&(this._doubleClickOccured=!1,h.singleClick=!0,h.ignore=!1,this._delayedClicks[o])){const c=this._delayedClicks[o].evt,u=te.POINTERTAP,f=new kt(u,c,this._currentPickResult);r.onPointerObservable.hasObservers()&&r.onPointerObservable.hasSpecificMask(u)&&r.onPointerObservable.notifyObservers(f,u),this._delayedClicks[o]=null}},this._initClickEvent=(o,h,l,c)=>{const u=new Oa;this._currentPickResult=null;let f=null,d=o.hasSpecificMask(te.POINTERPICK)||h.hasSpecificMask(te.POINTERPICK)||o.hasSpecificMask(te.POINTERTAP)||h.hasSpecificMask(te.POINTERTAP)||o.hasSpecificMask(te.POINTERDOUBLETAP)||h.hasSpecificMask(te.POINTERDOUBLETAP);!d&&wt&&(f=this._initActionManager(f,u),f&&(d=f.hasPickTriggers));let g=!1;if(d=d&&!this._isMultiTouchGesture,d){const p=l.button;if(u.hasSwiped=this._isPointerSwiping(),!u.hasSwiped){let m=!Ke.ExclusiveDoubleClickMode;if(m||(m=!o.hasSpecificMask(te.POINTERDOUBLETAP)&&!h.hasSpecificMask(te.POINTERDOUBLETAP),m&&!wt.HasSpecificTrigger(6)&&(f=this._initActionManager(f,u),f&&(m=!f.hasSpecificTrigger(6)))),m)(Date.now()-this._previousStartingPointerTime>Ke.DoubleClickDelay||p!==this._previousButtonPressed)&&(u.singleClick=!0,c(u,this._currentPickResult),g=!0);else{const E={evt:l,clickInfo:u,timeoutId:window.setTimeout(this._delayedSimpleClick.bind(this,p,u,c),Ke.DoubleClickDelay)};this._delayedClicks[p]=E}let A=o.hasSpecificMask(te.POINTERDOUBLETAP)||h.hasSpecificMask(te.POINTERDOUBLETAP);!A&&wt.HasSpecificTrigger(6)&&(f=this._initActionManager(f,u),f&&(A=f.hasSpecificTrigger(6))),A&&(p===this._previousButtonPressed&&Date.now()-this._previousStartingPointerTime{if(this._updatePointerPosition(o),!this._isSwiping&&this._swipeButtonPressed!==-1&&(this._isSwiping=Math.abs(this._startingPointerPosition.x-this._pointerX)>Ke.DragMovementThreshold||Math.abs(this._startingPointerPosition.y-this._pointerY)>Ke.DragMovementThreshold),n.isPointerLock&&n._verifyPointerLock(),this._checkPrePointerObservable(null,o,o.inputIndex>=ee.MouseWheelX&&o.inputIndex<=ee.MouseWheelZ?te.POINTERWHEEL:te.POINTERMOVE)||!r.cameraToUseForPointers&&!r.activeCamera)return;if(r.skipPointerMovePicking){this._processPointerMove(new ms,o);return}r.pointerMovePredicate||(r.pointerMovePredicate=l=>l.isPickable&&l.isVisible&&l.isReady()&&l.isEnabled()&&(l.enablePointerMoveEvents||r.constantlyUpdateMeshUnderPointer||l._getActionManagerForTrigger()!==null)&&(!r.cameraToUseForPointers||(r.cameraToUseForPointers.layerMask&l.layerMask)!==0));const h=r._registeredActions>0||r.constantlyUpdateMeshUnderPointer?this._pickMove(o):null;this._processPointerMove(h,o)},this._onPointerDown=o=>{const h=this._activePointerIds.indexOf(-1);if(h===-1?this._activePointerIds.push(o.pointerId):this._activePointerIds[h]=o.pointerId,this._activePointerIdsCount++,this._pickedDownMesh=null,this._meshPickProceed=!1,Ke.ExclusiveDoubleClickMode){for(let c=0;cc.isPickable&&c.isVisible&&c.isReady()&&c.isEnabled()&&(!r.cameraToUseForPointers||(r.cameraToUseForPointers.layerMask&c.layerMask)!==0)),this._pickedDownMesh=null;let l;r.skipPointerDownPicking||r._registeredActions===0&&!this._checkForPicking()&&!r.onPointerDown?l=new ms:l=r.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,r.pointerDownPredicate,r.pointerDownFastCheck,r.cameraToUseForPointers,r.pointerDownTrianglePredicate),this._processPointerDown(l,o)},this._onPointerUp=o=>{const h=this._activePointerIds.indexOf(o.pointerId);h!==-1&&(this._activePointerIds[h]=-1,this._activePointerIdsCount--,this._pickedUpMesh=null,this._meshPickProceed=!1,this._updatePointerPosition(o),r.preventDefaultOnPointerUp&&s&&(o.preventDefault(),s.focus()),this._initClickEvent(r.onPrePointerObservable,r.onPointerObservable,o,(l,c)=>{if(r.onPrePointerObservable.hasObservers()&&(this._skipPointerTap=!1,!l.ignore)){if(this._checkPrePointerObservable(null,o,te.POINTERUP)){this._swipeButtonPressed===o.button&&(this._isSwiping=!1,this._swipeButtonPressed=-1),o.buttons===0&&(this._pointerCaptures[o.pointerId]=!1);return}l.hasSwiped||(l.singleClick&&r.onPrePointerObservable.hasSpecificMask(te.POINTERTAP)&&this._checkPrePointerObservable(null,o,te.POINTERTAP)&&(this._skipPointerTap=!0),l.doubleClick&&r.onPrePointerObservable.hasSpecificMask(te.POINTERDOUBLETAP)&&this._checkPrePointerObservable(null,o,te.POINTERDOUBLETAP)&&(this._skipPointerTap=!0))}if(!this._pointerCaptures[o.pointerId]){this._swipeButtonPressed===o.button&&(this._isSwiping=!1,this._swipeButtonPressed=-1);return}o.buttons===0&&(this._pointerCaptures[o.pointerId]=!1),!(!r.cameraToUseForPointers&&!r.activeCamera)&&(r.pointerUpPredicate||(r.pointerUpPredicate=u=>u.isPickable&&u.isVisible&&u.isReady()&&u.isEnabled()&&(!r.cameraToUseForPointers||(r.cameraToUseForPointers.layerMask&u.layerMask)!==0)),!this._meshPickProceed&&(wt&&wt.HasTriggers||this._checkForPicking()||r.onPointerUp)&&this._initActionManager(null,l),c||(c=this._currentPickResult),this._processPointerUp(c,o,l),this._previousPickResult=this._currentPickResult,this._swipeButtonPressed===o.button&&(this._isSwiping=!1,this._swipeButtonPressed=-1))}))},this._onKeyDown=o=>{const h=Ks.KEYDOWN;if(r.onPreKeyboardObservable.hasObservers()){const l=new Aa(h,o);if(r.onPreKeyboardObservable.notifyObservers(l,h),l.skipOnKeyboardObservable)return}if(r.onKeyboardObservable.hasObservers()){const l=new An(h,o);r.onKeyboardObservable.notifyObservers(l,h)}r.actionManager&&r.actionManager.processTrigger(14,lt.CreateNewFromScene(r,o))},this._onKeyUp=o=>{const h=Ks.KEYUP;if(r.onPreKeyboardObservable.hasObservers()){const l=new Aa(h,o);if(r.onPreKeyboardObservable.notifyObservers(l,h),l.skipOnKeyboardObservable)return}if(r.onKeyboardObservable.hasObservers()){const l=new An(h,o);r.onKeyboardObservable.notifyObservers(l,h)}r.actionManager&&r.actionManager.processTrigger(15,lt.CreateNewFromScene(r,o))},this._deviceSourceManager.onDeviceConnectedObservable.add(o=>{o.deviceType===Y.Mouse?o.onInputChangedObservable.add(h=>{this._originMouseEvent=h,h.inputIndex===ee.LeftClick||h.inputIndex===ee.MiddleClick||h.inputIndex===ee.RightClick||h.inputIndex===ee.BrowserBack||h.inputIndex===ee.BrowserForward?t&&o.getInput(h.inputIndex)===1?this._onPointerDown(h):e&&o.getInput(h.inputIndex)===0&&this._onPointerUp(h):i&&(h.inputIndex===ee.Move?this._onPointerMove(h):(h.inputIndex===ee.MouseWheelX||h.inputIndex===ee.MouseWheelY||h.inputIndex===ee.MouseWheelZ)&&this._onPointerMove(h))}):o.deviceType===Y.Touch?o.onInputChangedObservable.add(h=>{h.inputIndex===ee.LeftClick&&(t&&o.getInput(h.inputIndex)===1?(this._onPointerDown(h),this._activePointerIdsCount>1&&(this._isMultiTouchGesture=!0)):e&&o.getInput(h.inputIndex)===0&&(this._onPointerUp(h),this._activePointerIdsCount===0&&(this._isMultiTouchGesture=!1))),i&&h.inputIndex===ee.Move&&this._onPointerMove(h)}):o.deviceType===Y.Keyboard&&o.onInputChangedObservable.add(h=>{h.type==="keydown"?this._onKeyDown(h):h.type==="keyup"&&this._onKeyUp(h)})}),this._alreadyAttached=!0}detachControl(){this._alreadyAttached&&(this._deviceSourceManager.dispose(),this._deviceSourceManager=null,this._alreadyAttachedTo&&!this._scene.doNotHandleCursors&&(this._alreadyAttachedTo.style.cursor=this._scene.defaultCursor),this._alreadyAttached=!1,this._alreadyAttachedTo=null)}setPointerOverMesh(e,t=0,i,s){if(this._meshUnderPointerId[t]===e&&(!e||!e._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting))return;const r=this._meshUnderPointerId[t];let n;r&&(n=r._getActionManagerForTrigger(10),n&&n.processTrigger(10,new lt(r,this._pointerX,this._pointerY,e,s,{pointerId:t}))),e?(this._meshUnderPointerId[t]=e,this._pointerOverMesh=e,n=e._getActionManagerForTrigger(9),n&&n.processTrigger(9,new lt(e,this._pointerX,this._pointerY,e,s,{pointerId:t,pickResult:i}))):(delete this._meshUnderPointerId[t],this._pointerOverMesh=null),this._scene.onMeshUnderPointerUpdatedObservable.hasObservers()&&this._scene.onMeshUnderPointerUpdatedObservable.notifyObservers({mesh:e,pointerId:t})}getPointerOverMesh(){return this.meshUnderPointer}_invalidateMesh(e){this._pointerOverMesh===e&&(this._pointerOverMesh=null),this._pickedDownMesh===e&&(this._pickedDownMesh=null),this._pickedUpMesh===e&&(this._pickedUpMesh=null);for(const t in this._meshUnderPointerId)this._meshUnderPointerId[t]===e&&delete this._meshUnderPointerId[t]}}Ke.DragMovementThreshold=10;Ke.LongPressDelay=500;Ke.DoubleClickDelay=300;Ke.ExclusiveDoubleClickMode=!1;class oi{get min(){return this._min}get max(){return this._max}get average(){return this._average}get lastSecAverage(){return this._lastSecAverage}get current(){return this._current}get total(){return this._totalAccumulated}get count(){return this._totalValueCount}constructor(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}fetchNewFrame(){this._totalValueCount++,this._current=0,this._lastSecValueCount++}addCount(e,t){oi.Enabled&&(this._current+=e,t&&this._fetchResult())}beginMonitoring(){oi.Enabled&&(this._startMonitoringTime=vt.Now)}endMonitoring(e=!0){if(!oi.Enabled)return;e&&this.fetchNewFrame();const t=vt.Now;this._current=t-this._startMonitoringTime,e&&this._fetchResult()}endFrame(){this._fetchResult()}_fetchResult(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;const e=vt.Now;e-this._lastSecTime>1e3&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)}}oi.Enabled=!0;class xh{static get UniqueId(){const e=this._UniqueIdCounter;return this._UniqueIdCounter++,e}}xh._UniqueIdCounter=1;class Ou{constructor(){this.pointerDownFastCheck=!1,this.pointerUpFastCheck=!1,this.pointerMoveFastCheck=!1,this.skipPointerMovePicking=!1,this.skipPointerDownPicking=!1,this.skipPointerUpPicking=!1}}const Fu=new ge,wu=new ge;var Fa;(function(a){a[a.BackwardCompatible=0]="BackwardCompatible",a[a.Intermediate=1]="Intermediate",a[a.Aggressive=2]="Aggressive"})(Fa||(Fa={}));class tt{static DefaultMaterialFactory(e){throw ie("StandardMaterial")}static CollisionCoordinatorFactory(){throw ie("DefaultCollisionCoordinator")}get clearColor(){return this._clearColor}set clearColor(e){e!==this._clearColor&&(this._clearColor=e,this.onClearColorChangedObservable.notifyObservers(this._clearColor))}get imageProcessingConfiguration(){return this._imageProcessingConfiguration}get performancePriority(){return this._performancePriority}set performancePriority(e){if(e!==this._performancePriority){switch(this._performancePriority=e,e){case 0:this.skipFrustumClipping=!1,this._renderingManager.maintainStateBetweenFrames=!1,this.skipPointerMovePicking=!1,this.autoClear=!0;break;case 1:this.skipFrustumClipping=!1,this._renderingManager.maintainStateBetweenFrames=!1,this.skipPointerMovePicking=!0,this.autoClear=!1;break;case 2:this.skipFrustumClipping=!0,this._renderingManager.maintainStateBetweenFrames=!0,this.skipPointerMovePicking=!0,this.autoClear=!1;break}this.onScenePerformancePriorityChangedObservable.notifyObservers(e)}}set forceWireframe(e){this._forceWireframe!==e&&(this._forceWireframe=e,this.markAllMaterialsAsDirty(16))}get forceWireframe(){return this._forceWireframe}set skipFrustumClipping(e){this._skipFrustumClipping!==e&&(this._skipFrustumClipping=e)}get skipFrustumClipping(){return this._skipFrustumClipping}set forcePointsCloud(e){this._forcePointsCloud!==e&&(this._forcePointsCloud=e,this.markAllMaterialsAsDirty(16))}get forcePointsCloud(){return this._forcePointsCloud}get environmentTexture(){return this._environmentTexture}set environmentTexture(e){this._environmentTexture!==e&&(this._environmentTexture=e,this.onEnvironmentTextureChangedObservable.notifyObservers(e),this.markAllMaterialsAsDirty(1))}getNodes(){let e=[];e=e.concat(this.meshes),e=e.concat(this.lights),e=e.concat(this.cameras),e=e.concat(this.transformNodes);for(const t of this.skeletons)e=e.concat(t.bones);return e}get animationPropertiesOverride(){return this._animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}set beforeRender(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),e&&(this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e))}set afterRender(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),e&&(this._onAfterRenderObserver=this.onAfterRenderObservable.add(e))}set beforeCameraRender(e){this._onBeforeCameraRenderObserver&&this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=this.onBeforeCameraRenderObservable.add(e)}set afterCameraRender(e){this._onAfterCameraRenderObserver&&this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=this.onAfterCameraRenderObservable.add(e)}get pointerDownPredicate(){return this._pointerPickingConfiguration.pointerDownPredicate}set pointerDownPredicate(e){this._pointerPickingConfiguration.pointerDownPredicate=e}get pointerUpPredicate(){return this._pointerPickingConfiguration.pointerUpPredicate}set pointerUpPredicate(e){this._pointerPickingConfiguration.pointerUpPredicate=e}get pointerMovePredicate(){return this._pointerPickingConfiguration.pointerMovePredicate}set pointerMovePredicate(e){this._pointerPickingConfiguration.pointerMovePredicate=e}get pointerDownFastCheck(){return this._pointerPickingConfiguration.pointerDownFastCheck}set pointerDownFastCheck(e){this._pointerPickingConfiguration.pointerDownFastCheck=e}get pointerUpFastCheck(){return this._pointerPickingConfiguration.pointerUpFastCheck}set pointerUpFastCheck(e){this._pointerPickingConfiguration.pointerUpFastCheck=e}get pointerMoveFastCheck(){return this._pointerPickingConfiguration.pointerMoveFastCheck}set pointerMoveFastCheck(e){this._pointerPickingConfiguration.pointerMoveFastCheck=e}get skipPointerMovePicking(){return this._pointerPickingConfiguration.skipPointerMovePicking}set skipPointerMovePicking(e){this._pointerPickingConfiguration.skipPointerMovePicking=e}get skipPointerDownPicking(){return this._pointerPickingConfiguration.skipPointerDownPicking}set skipPointerDownPicking(e){this._pointerPickingConfiguration.skipPointerDownPicking=e}get skipPointerUpPicking(){return this._pointerPickingConfiguration.skipPointerUpPicking}set skipPointerUpPicking(e){this._pointerPickingConfiguration.skipPointerUpPicking=e}get unTranslatedPointer(){return this._inputManager.unTranslatedPointer}static get DragMovementThreshold(){return Ke.DragMovementThreshold}static set DragMovementThreshold(e){Ke.DragMovementThreshold=e}static get LongPressDelay(){return Ke.LongPressDelay}static set LongPressDelay(e){Ke.LongPressDelay=e}static get DoubleClickDelay(){return Ke.DoubleClickDelay}static set DoubleClickDelay(e){Ke.DoubleClickDelay=e}static get ExclusiveDoubleClickMode(){return Ke.ExclusiveDoubleClickMode}static set ExclusiveDoubleClickMode(e){Ke.ExclusiveDoubleClickMode=e}get _eyePosition(){return this._forcedViewPosition??this.activeCamera?.globalPosition??_.ZeroReadOnly}bindEyePosition(e,t="vEyePosition",i=!1){const s=this._eyePosition,r=this.useRightHandedSystem===(this._mirroredCameraPosition!=null),n=this.floatingOriginOffset,o=Fu.set(s.x,s.y,s.z,r?-1:1),h=o.subtractFromFloatsToRef(n.x,n.y,n.z,0,wu);return e&&(i?e.setFloat3(t,h.x,h.y,h.z):e.setVector4(t,h)),o}finalizeSceneUbo(){const e=this.getSceneUniformBuffer(),t=this.bindEyePosition(null),i=this.floatingOriginOffset;return e.updateFloat4("vEyePosition",t.x-i.x,t.y-i.y,t.z-i.z,t.w),e.update(),e}set useRightHandedSystem(e){this._useRightHandedSystem!==e&&(this._useRightHandedSystem=e,this.markAllMaterialsAsDirty(16))}get useRightHandedSystem(){return this._useRightHandedSystem}setStepId(e){this._currentStepId=e}getStepId(){return this._currentStepId}getInternalStep(){return this._currentInternalStep}set fogEnabled(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAllMaterialsAsDirty(16))}get fogEnabled(){return this._fogEnabled}set fogMode(e){this._fogMode!==e&&(this._fogMode=e,this.markAllMaterialsAsDirty(16))}get fogMode(){return this._fogMode}get prePass(){return!!this.prePassRenderer&&this.prePassRenderer.defaultRT.enabled}set shadowsEnabled(e){this._shadowsEnabled!==e&&(this._shadowsEnabled=e,this.markAllMaterialsAsDirty(2))}get shadowsEnabled(){return this._shadowsEnabled}set lightsEnabled(e){this._lightsEnabled!==e&&(this._lightsEnabled=e,this.markAllMaterialsAsDirty(2))}get lightsEnabled(){return this._lightsEnabled}get activeCameras(){return this._activeCameras}set activeCameras(e){this._unObserveActiveCameras&&(this._unObserveActiveCameras(),this._unObserveActiveCameras=null),e&&(this._unObserveActiveCameras=_o(e,()=>{this.onActiveCamerasChanged.notifyObservers(this)})),this._activeCameras=e}get activeCamera(){return this._activeCamera}set activeCamera(e){e!==this._activeCamera&&(this._activeCamera=e,this.onActiveCameraChanged.notifyObservers(this))}get _hasDefaultMaterial(){return tt.DefaultMaterialFactory!==tt._OriginalDefaultMaterialFactory}get defaultMaterial(){return this._defaultMaterial||(this._defaultMaterial=tt.DefaultMaterialFactory(this)),this._defaultMaterial}set defaultMaterial(e){this._defaultMaterial=e}set texturesEnabled(e){this._texturesEnabled!==e&&(this._texturesEnabled=e,this.markAllMaterialsAsDirty(1))}get texturesEnabled(){return this._texturesEnabled}get frameGraph(){return this._frameGraph}set frameGraph(e){if(this._frameGraph){this._frameGraph=e,e||(this.customRenderFunction=this._currentCustomRenderFunction);return}this._frameGraph=e,e&&(this._currentCustomRenderFunction=this.customRenderFunction,this.customRenderFunction=this._renderWithFrameGraph,this.activeCamera=null)}set skeletonsEnabled(e){this._skeletonsEnabled!==e&&(this._skeletonsEnabled=e,this.markAllMaterialsAsDirty(8))}get skeletonsEnabled(){return this._skeletonsEnabled}get collisionCoordinator(){return this._collisionCoordinator||(this._collisionCoordinator=tt.CollisionCoordinatorFactory(),this._collisionCoordinator.init(this)),this._collisionCoordinator}get renderingManager(){return this._renderingManager}get frustumPlanes(){return this._frustumPlanes}_registerTransientComponents(){if(this._transientComponents.length>0){for(const e of this._transientComponents)e.register();this._transientComponents.length=0}}_addComponent(e){this._components.push(e),this._transientComponents.push(e);const t=e;t.addFromContainer&&t.serialize&&this._serializableComponents.push(t)}_getComponent(e){for(const t of this._components)if(t.name===e)return t;return null}get uniqueId(){return this._uniqueId}constructor(e,t){this._inputManager=new Ke(this),this.cameraToUseForPointers=null,this._isScene=!0,this._blockEntityCollection=!1,this.autoClear=!0,this.autoClearDepthAndStencil=!0,this._clearColor=new fe(.2,.2,.3,1),this.onClearColorChangedObservable=new O,this.ambientColor=new q(0,0,0),this.environmentIntensity=1,this.iblIntensity=1,this._performancePriority=0,this.onScenePerformancePriorityChangedObservable=new O,this._forceWireframe=!1,this._skipFrustumClipping=!1,this._forcePointsCloud=!1,this.rootNodes=[],this.cameras=[],this.lights=[],this.meshes=[],this.skeletons=[],this.particleSystems=[],this.animations=[],this.animationGroups=[],this.multiMaterials=[],this.materials=[],this.morphTargetManagers=[],this.geometries=[],this.transformNodes=[],this.actionManagers=[],this.objectRenderers=[],this.textures=[],this._environmentTexture=null,this.postProcesses=[],this.effectLayers=[],this.sounds=null,this.layers=[],this.lensFlareSystems=[],this.proceduralTextures=[],this.animationsEnabled=!0,this._animationPropertiesOverride=null,this.useConstantAnimationDeltaTime=!1,this.constantlyUpdateMeshUnderPointer=!1,this.hoverCursor="pointer",this.defaultCursor="",this.doNotHandleCursors=!1,this.preventDefaultOnPointerDown=!0,this.preventDefaultOnPointerUp=!0,this.metadata=null,this.reservedDataStore=null,this.disableOfflineSupportExceptionRules=[],this.onDisposeObservable=new O,this._onDisposeObserver=null,this.onBeforeRenderObservable=new O,this._onBeforeRenderObserver=null,this.onAfterRenderObservable=new O,this.onAfterRenderCameraObservable=new O,this._onAfterRenderObserver=null,this.onBeforeAnimationsObservable=new O,this.onAfterAnimationsObservable=new O,this.onBeforeDrawPhaseObservable=new O,this.onAfterDrawPhaseObservable=new O,this.onReadyObservable=new O,this.onBeforeCameraRenderObservable=new O,this._onBeforeCameraRenderObserver=null,this.onAfterCameraRenderObservable=new O,this._onAfterCameraRenderObserver=null,this.onBeforeActiveMeshesEvaluationObservable=new O,this.onAfterActiveMeshesEvaluationObservable=new O,this.onBeforeParticlesRenderingObservable=new O,this.onAfterParticlesRenderingObservable=new O,this.onDataLoadedObservable=new O,this.onNewCameraAddedObservable=new O,this.onCameraRemovedObservable=new O,this.onNewLightAddedObservable=new O,this.onLightRemovedObservable=new O,this.onNewGeometryAddedObservable=new O,this.onGeometryRemovedObservable=new O,this.onNewTransformNodeAddedObservable=new O,this.onTransformNodeRemovedObservable=new O,this.onNewMeshAddedObservable=new O,this.onMeshRemovedObservable=new O,this.onNewSkeletonAddedObservable=new O,this.onSkeletonRemovedObservable=new O,this.onNewParticleSystemAddedObservable=new O,this.onParticleSystemRemovedObservable=new O,this.onNewAnimationGroupAddedObservable=new O,this.onAnimationGroupRemovedObservable=new O,this.onNewMaterialAddedObservable=new O,this.onNewMultiMaterialAddedObservable=new O,this.onMaterialRemovedObservable=new O,this.onMultiMaterialRemovedObservable=new O,this.onNewTextureAddedObservable=new O,this.onTextureRemovedObservable=new O,this.onNewFrameGraphAddedObservable=new O,this.onFrameGraphRemovedObservable=new O,this.onNewObjectRendererAddedObservable=new O,this.onObjectRendererRemovedObservable=new O,this.onNewPostProcessAddedObservable=new O,this.onPostProcessRemovedObservable=new O,this.onNewEffectLayerAddedObservable=new O,this.onEffectLayerRemovedObservable=new O,this.onBeforeRenderTargetsRenderObservable=new O,this.onAfterRenderTargetsRenderObservable=new O,this.onBeforeStepObservable=new O,this.onAfterStepObservable=new O,this.onActiveCameraChanged=new O,this.onActiveCamerasChanged=new O,this.onBeforeRenderingGroupObservable=new O,this.onAfterRenderingGroupObservable=new O,this.onMeshImportedObservable=new O,this.onAnimationFileImportedObservable=new O,this.onEnvironmentTextureChangedObservable=new O,this.onMeshUnderPointerUpdatedObservable=new O,this._registeredForLateAnimationBindings=new Yi(256),this._pointerPickingConfiguration=new Ou,this.onPrePointerObservable=new O,this.onPointerObservable=new O,this.onPreKeyboardObservable=new O,this.onKeyboardObservable=new O,this._useRightHandedSystem=!1,this._timeAccumulator=0,this._currentStepId=0,this._currentInternalStep=0,this._fogEnabled=!0,this._fogMode=tt.FOGMODE_NONE,this.fogColor=new q(.2,.2,.3),this.fogDensity=.1,this.fogStart=0,this.fogEnd=1e3,this.needsPreviousWorldMatrices=!1,this._shadowsEnabled=!0,this._lightsEnabled=!0,this._unObserveActiveCameras=null,this._texturesEnabled=!0,this._frameGraph=null,this.frameGraphs=[],this.physicsEnabled=!0,this.particlesEnabled=!0,this.spritesEnabled=!0,this._skeletonsEnabled=!0,this.lensFlaresEnabled=!0,this.collisionsEnabled=!0,this.gravity=new _(0,-9.807,0),this.postProcessesEnabled=!0,this.renderTargetsEnabled=!0,this.dumpNextRenderTargets=!1,this.customRenderTargets=[],this.importedMeshesFiles=[],this.probesEnabled=!0,this._meshesForIntersections=new Yi(256),this.proceduralTexturesEnabled=!0,this._totalVertices=new oi,this._activeIndices=new oi,this._activeParticles=new oi,this._activeBones=new oi,this._animationTime=0,this.animationTimeScale=1,this._renderId=0,this._frameId=0,this._executeWhenReadyTimeoutId=null,this._intermediateRendering=!1,this._defaultFrameBufferCleared=!1,this._viewUpdateFlag=-1,this._projectionUpdateFlag=-1,this._toBeDisposed=new Array(256),this._activeRequests=new Array,this._pendingData=[],this._isDisposed=!1,this.dispatchAllSubMeshesOfActiveMeshes=!1,this._activeMeshes=new it(256),this._processedMaterials=new it(256),this._renderTargets=new Yi(256),this._materialsRenderTargets=new Yi(256),this._activeParticleSystems=new it(256),this._activeSkeletons=new Yi(32),this._softwareSkinnedMeshes=new Yi(32),this._activeAnimatables=new Array,this._transformMatrix=P.Zero(),this.requireLightSorting=!1,this._components=[],this._serializableComponents=[],this._transientComponents=[],this._beforeCameraUpdateStage=Xe.Create(),this._beforeClearStage=Xe.Create(),this._beforeRenderTargetClearStage=Xe.Create(),this._gatherRenderTargetsStage=Xe.Create(),this._gatherActiveCameraRenderTargetsStage=Xe.Create(),this._isReadyForMeshStage=Xe.Create(),this._beforeEvaluateActiveMeshStage=Xe.Create(),this._evaluateSubMeshStage=Xe.Create(),this._preActiveMeshStage=Xe.Create(),this._cameraDrawRenderTargetStage=Xe.Create(),this._beforeCameraDrawStage=Xe.Create(),this._beforeRenderTargetDrawStage=Xe.Create(),this._beforeRenderingGroupDrawStage=Xe.Create(),this._beforeRenderingMeshStage=Xe.Create(),this._afterRenderingMeshStage=Xe.Create(),this._afterRenderingGroupDrawStage=Xe.Create(),this._afterCameraDrawStage=Xe.Create(),this._afterCameraPostProcessStage=Xe.Create(),this._afterRenderTargetDrawStage=Xe.Create(),this._afterRenderTargetPostProcessStage=Xe.Create(),this._afterRenderStage=Xe.Create(),this._pointerMoveStage=Xe.Create(),this._pointerDownStage=Xe.Create(),this._pointerUpStage=Xe.Create(),this._geometriesByUniqueId=null,this._uniqueId=0,this._defaultMeshCandidates={data:[],length:0},this._defaultSubMeshCandidates={data:[],length:0},this.onReadyTimeoutObservable=new O,this.onReadyTimeoutDuration=120*1e3,this._timeoutChecksStartTime=0,this._floatingOriginScene=void 0,this._preventFreeActiveMeshesAndRenderingGroups=!1,this._activeMeshesFrozen=!1,this._activeMeshesFrozenButKeepClipping=!1,this._skipEvaluateActiveMeshesCompletely=!1,this._freezeActiveMeshesCancel=null,this._useCurrentFrameBuffer=!1,this._allowPostProcessClearColor=!0,this.getDeterministicFrameTime=()=>this._engine.getTimeStep(),this._getFloatingOriginScene=()=>this._floatingOriginScene,this._registeredActions=0,this._blockMaterialDirtyMechanism=!1,this._perfCollector=null,this.activeCameras=[],this._uniqueId=this.getUniqueId();const i={useGeometryUniqueIdsMap:!0,useMaterialMeshMap:!0,useClonedMeshMap:!0,virtual:!1,...t};e=this._engine=e||Te.LastCreatedEngine,i.virtual?e._virtualScenes.push(this):(Te._LastCreatedScene=this,e.scenes.push(this)),(e.getCreationOptions().useLargeWorldRendering||t?.useFloatingOrigin)&&(Vc(),this._floatingOriginScene=this),this._uid=null,this._renderingManager=new ct(this),Rn&&(this.postProcessManager=new Rn(this)),_t()&&this.attachControl(),this._createUbo(),ue&&(this._imageProcessingConfiguration=new ue),this.setDefaultCandidateProviders(),i.useGeometryUniqueIdsMap&&(this._geometriesByUniqueId={}),this.useMaterialMeshMap=i.useMaterialMeshMap,this.useClonedMeshMap=i.useClonedMeshMap,(!t||!t.virtual)&&e.onNewSceneAddedObservable.notifyObservers(this)}getClassName(){return"Scene"}_getDefaultMeshCandidates(){return this._defaultMeshCandidates.data=this.meshes,this._defaultMeshCandidates.length=this.meshes.length,this._defaultMeshCandidates}_getDefaultSubMeshCandidates(e){return this._defaultSubMeshCandidates.data=e.subMeshes,this._defaultSubMeshCandidates.length=e.subMeshes.length,this._defaultSubMeshCandidates}setDefaultCandidateProviders(){this.getActiveMeshCandidates=()=>this._getDefaultMeshCandidates(),this.getActiveSubMeshCandidates=e=>this._getDefaultSubMeshCandidates(e),this.getIntersectingSubMeshCandidates=(e,t)=>this._getDefaultSubMeshCandidates(e),this.getCollidingSubMeshCandidates=(e,t)=>this._getDefaultSubMeshCandidates(e)}get meshUnderPointer(){return this._inputManager.meshUnderPointer}get pointerX(){return this._inputManager.pointerX}set pointerX(e){this._inputManager.pointerX=e}get pointerY(){return this._inputManager.pointerY}set pointerY(e){this._inputManager.pointerY=e}getCachedMaterial(){return this._cachedMaterial}getCachedEffect(){return this._cachedEffect}getCachedVisibility(){return this._cachedVisibility}isCachedMaterialInvalid(e,t,i=1){return this._cachedEffect!==t||this._cachedMaterial!==e||this._cachedVisibility!==i}getEngine(){return this._engine}getTotalVertices(){return this._totalVertices.current}get totalVerticesPerfCounter(){return this._totalVertices}getActiveIndices(){return this._activeIndices.current}get totalActiveIndicesPerfCounter(){return this._activeIndices}getActiveParticles(){return this._activeParticles.current}get activeParticlesPerfCounter(){return this._activeParticles}getActiveBones(){return this._activeBones.current}get activeBonesPerfCounter(){return this._activeBones}getActiveMeshes(){return this._activeMeshes}getAnimationRatio(){return this._animationRatio!==void 0?this._animationRatio:1}getRenderId(){return this._renderId}getFrameId(){return this._frameId}incrementRenderId(){this._renderId++}_createUbo(){this.setSceneUniformBuffer(this.createSceneUniformBuffer())}simulatePointerMove(e,t){return this._inputManager.simulatePointerMove(e,t),this}simulatePointerDown(e,t){return this._inputManager.simulatePointerDown(e,t),this}simulatePointerUp(e,t,i){return this._inputManager.simulatePointerUp(e,t,i),this}isPointerCaptured(e=0){return this._inputManager.isPointerCaptured(e)}attachControl(e=!0,t=!0,i=!0){this._inputManager.attachControl(e,t,i)}detachControl(){this._inputManager.detachControl()}isReady(e=!0){if(this._isDisposed)return!1;let t;const i=this.getEngine(),s=i.currentRenderPassId;i.currentRenderPassId=this.activeCamera?.renderPassId??s;let r=!0;for(this._pendingData.length>0&&(r=!1),this.prePassRenderer?.update(),this.useOrderIndependentTransparency&&this.depthPeelingRenderer&&r&&(r=this.depthPeelingRenderer.isReady()),e&&(this._processedMaterials.reset(),this._materialsRenderTargets.reset()),t=0;t0;for(const l of this._isReadyForMeshStage)l.action(n,o)||(r=!1);if(!e)continue;const h=n.material||this.defaultMaterial;if(h)if(h._storeEffectOnSubMeshes)for(const l of n.subMeshes){const c=l.getMaterial();c&&c.hasRenderTargetTextures&&c.getRenderTargetTextures!=null&&this._processedMaterials.indexOf(c)===-1&&(this._processedMaterials.push(c),this._materialsRenderTargets.concatWithNoDuplicate(c.getRenderTargetTextures()))}else h.hasRenderTargetTextures&&h.getRenderTargetTextures!=null&&this._processedMaterials.indexOf(h)===-1&&(this._processedMaterials.push(h),this._materialsRenderTargets.concatWithNoDuplicate(h.getRenderTargetTextures()))}if(e)for(t=0;t0)for(const n of this.activeCameras)n.isReady(!0)||(r=!1);else this.activeCamera&&(this.activeCamera.isReady(!0)||(r=!1));for(const n of this.particleSystems)n.isReady()||(r=!1);if(this.layers)for(const n of this.layers)n.isReady()||(r=!1);if(this.effectLayers)for(const n of this.effectLayers)n.isLayerReady()||(r=!1);return i.areAllEffectsReady()||(r=!1),i.currentRenderPassId=s,r}resetCachedMaterial(){this._cachedMaterial=null,this._cachedEffect=null,this._cachedVisibility=null}registerBeforeRender(e){this.onBeforeRenderObservable.add(e)}unregisterBeforeRender(e){this.onBeforeRenderObservable.removeCallback(e)}registerAfterRender(e){this.onAfterRenderObservable.add(e)}unregisterAfterRender(e){this.onAfterRenderObservable.removeCallback(e)}_executeOnceBeforeRender(e){const t=()=>{e(),setTimeout(()=>{this.unregisterBeforeRender(t)})};this.registerBeforeRender(t)}executeOnceBeforeRender(e,t){t!==void 0?setTimeout(()=>{this._executeOnceBeforeRender(e)},t):this._executeOnceBeforeRender(e)}addPendingData(e){this._pendingData.push(e)}removePendingData(e){const t=this.isLoading,i=this._pendingData.indexOf(e);i!==-1&&this._pendingData.splice(i,1),t&&!this.isLoading&&this.onDataLoadedObservable.notifyObservers(this)}getWaitingItemsCount(){return this._pendingData.length}get isLoading(){return this._pendingData.length>0}executeWhenReady(e,t=!1){this.onReadyObservable.addOnce(e),this._executeWhenReadyTimeoutId===null&&this._checkIsReady(t)}async whenReadyAsync(e=!1){return await new Promise(t=>{this.executeWhenReady(()=>{t()},e)})}_clearReadynessChecksData(){this._timeoutChecksStartTime=0,this.onReadyTimeoutObservable.clear(),this.onReadyObservable.clear(),this._executeWhenReadyTimeoutId=null}_checkIsReady(e=!1){if(this._registerTransientComponents(),this._timeoutChecksStartTime===0)this._timeoutChecksStartTime=vt.Now;else if(this.onReadyTimeoutDuration>0&&vt.Now-this._timeoutChecksStartTime>this.onReadyTimeoutDuration){this.onReadyTimeoutObservable.notifyObservers(this),this._clearReadynessChecksData();return}if(this.isReady(e)){this.onReadyObservable.notifyObservers(this),this._clearReadynessChecksData();return}if(this._isDisposed){this._clearReadynessChecksData();return}this._executeWhenReadyTimeoutId=setTimeout(()=>{this.incrementRenderId(),this._checkIsReady(e)},100)}get animatables(){return this._activeAnimatables}resetLastAnimationTimeFrame(){this._animationTimeLast=vt.Now}getViewMatrix(){return this._viewMatrix}getProjectionMatrix(){return this._projectionMatrix}getTransformMatrix(){return this._transformMatrix}setTransformMatrix(e,t,i,s){!i&&!s&&this._multiviewSceneUbo&&(this._multiviewSceneUbo.dispose(),this._multiviewSceneUbo=null),!(this._viewUpdateFlag===e.updateFlag&&this._projectionUpdateFlag===t.updateFlag)&&(this._viewUpdateFlag=e.updateFlag,this._projectionUpdateFlag=t.updateFlag,this._viewMatrix=e,this._projectionMatrix=t,this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._frustumPlanes?Gt.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=Gt.GetPlanes(this._transformMatrix),this._multiviewSceneUbo&&this._multiviewSceneUbo.useUbo?this._updateMultiviewUbo(i,s):this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.updateMatrix("projection",this._projectionMatrix)))}getSceneUniformBuffer(){return this._multiviewSceneUbo?this._multiviewSceneUbo:this._sceneUbo}createSceneUniformBuffer(e,t){const i=new K(this._engine,void 0,!1,e??"scene",void 0,t);return i.addUniform("viewProjection",16),i.addUniform("view",16),i.addUniform("projection",16),i.addUniform("vEyePosition",4),i}setSceneUniformBuffer(e){this._sceneUbo=e,this._viewUpdateFlag=-1,this._projectionUpdateFlag=-1}get floatingOriginMode(){return this._floatingOriginScene!==void 0}get floatingOriginOffset(){return this.floatingOriginMode?this._eyePosition:_.ZeroReadOnly}getUniqueId(){return xh.UniqueId}addMesh(e,t=!1){if(!this._blockEntityCollection&&(this.meshes.push(e),e._resyncLightSources(),e.parent||e._addToSceneRootNodes(),se.SetImmediate(()=>{this.onNewMeshAddedObservable.notifyObservers(e)}),t)){const i=e.getChildMeshes();for(const s of i)this.addMesh(s)}}removeMesh(e,t=!1){const i=this.meshes.indexOf(e);if(i!==-1&&(this.meshes.splice(i,1),e.parent||e._removeFromSceneRootNodes()),this._inputManager._invalidateMesh(e),this.onMeshRemovedObservable.notifyObservers(e),t){const s=e.getChildMeshes();for(const r of s)this.removeMesh(r)}return i}addTransformNode(e){this._blockEntityCollection||e.getScene()===this&&e._indexInSceneTransformNodesArray!==-1||(e._indexInSceneTransformNodesArray=this.transformNodes.length,this.transformNodes.push(e),e.parent||e._addToSceneRootNodes(),this.onNewTransformNodeAddedObservable.notifyObservers(e))}removeTransformNode(e){const t=e._indexInSceneTransformNodesArray;if(t!==-1){if(t!==this.transformNodes.length-1){const i=this.transformNodes[this.transformNodes.length-1];this.transformNodes[t]=i,i._indexInSceneTransformNodesArray=t}e._indexInSceneTransformNodesArray=-1,this.transformNodes.pop(),e.parent||e._removeFromSceneRootNodes()}return this.onTransformNodeRemovedObservable.notifyObservers(e),t}removeSkeleton(e){const t=this.skeletons.indexOf(e);return t!==-1&&(this.skeletons.splice(t,1),this.onSkeletonRemovedObservable.notifyObservers(e),this._executeActiveContainerCleanup(this._activeSkeletons)),t}removeMorphTargetManager(e){const t=this.morphTargetManagers.indexOf(e);return t!==-1&&this.morphTargetManagers.splice(t,1),t}removeLight(e){const t=this.lights.indexOf(e);if(t!==-1){for(const i of this.meshes)i._removeLightSource(e,!1);this.lights.splice(t,1),this.sortLightsByPriority(),e.parent||e._removeFromSceneRootNodes(),this.onLightRemovedObservable.notifyObservers(e)}return t}removeCamera(e){const t=this.cameras.indexOf(e);if(t!==-1&&(this.cameras.splice(t,1),e.parent||e._removeFromSceneRootNodes()),this.activeCameras){const i=this.activeCameras.indexOf(e);i!==-1&&this.activeCameras.splice(i,1)}return this.activeCamera===e&&(this.cameras.length>0?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t}removeParticleSystem(e){const t=this.particleSystems.indexOf(e);return t!==-1&&(this.particleSystems.splice(t,1),this._executeActiveContainerCleanup(this._activeParticleSystems)),this.onParticleSystemRemovedObservable.notifyObservers(e),t}removeAnimation(e){const t=this.animations.indexOf(e);return t!==-1&&this.animations.splice(t,1),t}stopAnimation(e,t,i){}removeAnimationGroup(e){const t=this.animationGroups.indexOf(e);return t!==-1&&this.animationGroups.splice(t,1),this.onAnimationGroupRemovedObservable.notifyObservers(e),t}removeMultiMaterial(e){const t=this.multiMaterials.indexOf(e);return t!==-1&&this.multiMaterials.splice(t,1),this.onMultiMaterialRemovedObservable.notifyObservers(e),t}removeMaterial(e){const t=e._indexInSceneMaterialArray;if(t!==-1&&t{this.onNewLightAddedObservable.notifyObservers(e)})}}sortLightsByPriority(){this.requireLightSorting&&this.lights.sort(Ee.CompareLightsPriority)}addCamera(e){this._blockEntityCollection||(this.cameras.push(e),se.SetImmediate(()=>{this.onNewCameraAddedObservable.notifyObservers(e)}),e.parent||e._addToSceneRootNodes())}addSkeleton(e){this._blockEntityCollection||(this.skeletons.push(e),se.SetImmediate(()=>{this.onNewSkeletonAddedObservable.notifyObservers(e)}))}addParticleSystem(e){this._blockEntityCollection||(this.particleSystems.push(e),se.SetImmediate(()=>{this.onNewParticleSystemAddedObservable.notifyObservers(e)}))}addAnimation(e){this._blockEntityCollection||this.animations.push(e)}addAnimationGroup(e){this._blockEntityCollection||(this.animationGroups.push(e),se.SetImmediate(()=>{this.onNewAnimationGroupAddedObservable.notifyObservers(e)}))}addMultiMaterial(e){this._blockEntityCollection||(this.multiMaterials.push(e),se.SetImmediate(()=>{this.onNewMultiMaterialAddedObservable.notifyObservers(e)}))}addMaterial(e){this._blockEntityCollection||e.getScene()===this&&e._indexInSceneMaterialArray!==-1||(e._indexInSceneMaterialArray=this.materials.length,this.materials.push(e),se.SetImmediate(()=>{this.onNewMaterialAddedObservable.notifyObservers(e)}))}addMorphTargetManager(e){this._blockEntityCollection||this.morphTargetManagers.push(e)}addGeometry(e){this._blockEntityCollection||(this._geometriesByUniqueId&&(this._geometriesByUniqueId[e.uniqueId]=this.geometries.length),this.geometries.push(e))}addActionManager(e){this.actionManagers.push(e)}addTexture(e){this._blockEntityCollection||(this.textures.push(e),this.onNewTextureAddedObservable.notifyObservers(e))}addFrameGraph(e){this.frameGraphs.push(e),se.SetImmediate(()=>{this.onNewFrameGraphAddedObservable.notifyObservers(e)})}addObjectRenderer(e){this.objectRenderers.push(e),se.SetImmediate(()=>{this.onNewObjectRendererAddedObservable.notifyObservers(e)})}addPostProcess(e){this._blockEntityCollection||(this.postProcesses.push(e),se.SetImmediate(()=>{this.onNewPostProcessAddedObservable.notifyObservers(e)}))}addEffectLayer(e){this._blockEntityCollection||(this.effectLayers.push(e),se.SetImmediate(()=>{this.onNewEffectLayerAddedObservable.notifyObservers(e)}))}switchActiveCamera(e,t=!0){this._engine.getInputElement()&&(this.activeCamera&&this.activeCamera.detachControl(),this.activeCamera=e,t&&e.attachControl())}setActiveCameraById(e){const t=this.getCameraById(e);return t?(this.activeCamera=t,t):null}setActiveCameraByName(e){const t=this.getCameraByName(e);return t?(this.activeCamera=t,t):null}getAnimationGroupByName(e){for(let t=0;ti.uniqueId===e)}getMaterialById(e,t=!1){return this._getMaterial(t,i=>i.id===e)}getMaterialByName(e,t=!1){return this._getMaterial(t,i=>i.name===e)}getLastMaterialById(e,t=!1){for(let i=this.materials.length-1;i>=0;i--)if(this.materials[i].id===e)return this.materials[i];if(t){for(let i=this.multiMaterials.length-1;i>=0;i--)if(this.multiMaterials[i].id===e)return this.multiMaterials[i]}return null}getTextureByUniqueId(e){for(let t=0;t{this.onNewGeometryAddedObservable.notifyObservers(e)}),!0)}removeGeometry(e){let t;if(this._geometriesByUniqueId){if(t=this._geometriesByUniqueId[e.uniqueId],t===void 0)return!1}else if(t=this.geometries.indexOf(e),t<0)return!1;if(t!==this.geometries.length-1){const i=this.geometries[this.geometries.length-1];i&&(this.geometries[t]=i,this._geometriesByUniqueId&&(this._geometriesByUniqueId[i.uniqueId]=t))}return this._geometriesByUniqueId&&(this._geometriesByUniqueId[e.uniqueId]=void 0),this.geometries.pop(),this.onGeometryRemovedObservable.notifyObservers(e),!0}getGeometries(){return this.geometries}getMeshById(e){for(let t=0;t=0;t--)if(this.meshes[t].id===e)return this.meshes[t];return null}getLastTransformNodeById(e){for(let t=this.transformNodes.length-1;t>=0;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];return null}getLastEntryById(e){let t;for(t=this.meshes.length-1;t>=0;t--)if(this.meshes[t].id===e)return this.meshes[t];for(t=this.transformNodes.length-1;t>=0;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];for(t=this.cameras.length-1;t>=0;t--)if(this.cameras[t].id===e)return this.cameras[t];for(t=this.lights.length-1;t>=0;t--)if(this.lights[t].id===e)return this.lights[t];return null}getNodeById(e){const t=this.getMeshById(e);if(t)return t;const i=this.getTransformNodeById(e);if(i)return i;const s=this.getLightById(e);if(s)return s;const r=this.getCameraById(e);if(r)return r;const n=this.getBoneById(e);return n||null}getNodeByName(e){const t=this.getMeshByName(e);if(t)return t;const i=this.getTransformNodeByName(e);if(i)return i;const s=this.getLightByName(e);if(s)return s;const r=this.getCameraByName(e);if(r)return r;const n=this.getBoneByName(e);return n||null}getMeshByName(e){for(let t=0;t=0;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null}getSkeletonByUniqueId(e){for(let t=0;t{let o=!0,h=!0;for(const l of n)o&&(o=l.objectRenderer._isFrozen),h&&(h=l.objectRenderer._freezeActiveMeshesCancel!==null);if(o)return!0;if(!h)throw new Error("Freezing active meshes was cancelled");return!1},()=>{this._freezeActiveMeshesCancel=null,this._activeMeshesFrozen=!0,this._activeMeshesFrozenButKeepClipping=r,this._skipEvaluateActiveMeshesCompletely=e,t?.()},(o,h)=>{if(this._freezeActiveMeshesCancel=null,this.unfreezeActiveMeshes(),h){const l="Scene: Timeout while waiting for meshes to be frozen.";i?i(l):(w.Error(l),o&&w.Error(o))}else{const l="Scene: An unexpected error occurred while trying to freeze active meshes.";i?i(l):(w.Error(l),o&&(w.Error(o),o.stack&&w.Error(o.stack)))}}),this}return this.executeWhenReady(()=>{if(!this.activeCamera){i&&i("No active camera found");return}if(this._frustumPlanes||this.updateTransformMatrix(),this._evaluateActiveMeshes(),this._activeMeshesFrozen=!0,this._activeMeshesFrozenButKeepClipping=r,this._skipEvaluateActiveMeshesCompletely=e,s)for(let n=0;ne.dispose())}_evaluateActiveMeshes(){if(this._engine.snapshotRendering&&this._engine.snapshotRenderingMode===1){this._activeMeshes.length>0&&(this.activeCamera?._activeMeshes.reset(),this._activeMeshes.reset(),this._renderingManager.reset(),this._processedMaterials.reset(),this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset());return}if(this._activeMeshesFrozen&&this._activeMeshes.length){if(!this._skipEvaluateActiveMeshesCompletely){const i=this._activeMeshes.length;for(let s=0;s0&&(s.layerMask&this.activeCamera.layerMask)!==0&&(this._skipFrustumClipping||s.alwaysSelectAsActiveMesh||s.isInFrustum(this._frustumPlanes)))){this._activeMeshes.push(s),this.activeCamera._activeMeshes.push(s),n!==s&&n._activate(this._renderId,!1);for(const o of this._preActiveMeshStage)o.action(s);s._activate(this._renderId,!1)&&(s.isAnInstance?s._internalAbstractMeshDataInfo._actAsRegularMesh&&(n=s):n._internalAbstractMeshDataInfo._onlyForInstances=!1,n._internalAbstractMeshDataInfo._isActive=!0,this._activeMesh(s,n)),s._postActivate()}}if(this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this),this.particlesEnabled){this.onBeforeParticlesRenderingObservable.notifyObservers(this);for(let i=0;i0){const s=this.getActiveSubMeshCandidates(t),r=s.length;i=i||r===1;for(let n=0;n0&&this._renderTargets.concatWithNoDuplicate(e.customRenderTargets),t&&t.customRenderTargets&&t.customRenderTargets.length>0&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets),this.environmentTexture&&this.environmentTexture.isRenderTarget&&this._renderTargets.pushNoDuplicate(this.environmentTexture);for(const o of this._gatherActiveCameraRenderTargetsStage)o.action(this._renderTargets);let r=!1;if(this.renderTargetsEnabled){if(this._intermediateRendering=!0,this._renderTargets.length>0){se.StartPerformanceCounter("Render targets",this._renderTargets.length>0);const o=this.getBoundingBoxRenderer?.();let h;for(let l=0;l0?o.renderList.data.slice():[],h.length=o.renderList.length),c.render(u,this.dumpNextRenderTargets),r=!0}}o&&h&&(o.renderList.data=h,o.renderList.length=h.length),se.EndPerformanceCounter("Render targets",this._renderTargets.length>0),this._renderId++}for(const o of this._cameraDrawRenderTargetStage)r=o.action(this.activeCamera)||r;this._intermediateRendering=!1}this._engine.currentRenderPassId=e.outputRenderTarget?.renderPassId??e.renderPassId??0,r&&!this.prePass&&(this._bindFrameBuffer(this._activeCamera,!1),this.updateTransformMatrix()),this.onAfterRenderTargetsRenderObservable.notifyObservers(this),this.postProcessManager&&!e._multiviewTexture&&!this.prePass&&this.postProcessManager._prepareFrame();for(const o of this._beforeCameraDrawStage)o.action(this.activeCamera);this.onBeforeDrawPhaseObservable.notifyObservers(this);const n=s.snapshotRendering&&s.snapshotRenderingMode===1;n&&this.finalizeSceneUbo(),this._renderingManager.render(null,null,!0,!n),this.onAfterDrawPhaseObservable.notifyObservers(this);for(const o of this._afterCameraDrawStage)o.action(this.activeCamera);if(this.postProcessManager&&!e._multiviewTexture){const o=e.outputRenderTarget?e.outputRenderTarget.renderTarget:void 0;this.postProcessManager._finalizeFrame(e.isIntermediate,o)}for(const o of this._afterCameraPostProcessStage)o.action(this.activeCamera);this._renderTargets.reset(),this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera)}_processSubCameras(e,t=!0){if(e.cameraRigMode===0||e._renderingMultiview){e._renderingMultiview&&!this._multiviewSceneUbo&&this._createMultiviewUbo(),this._renderForCamera(e,void 0,t),this.onAfterRenderCameraObservable.notifyObservers(e);return}if(e._useMultiviewToSingleView)this._renderMultiviewToSingleView(e);else{this.onBeforeCameraRenderObservable.notifyObservers(e);for(let i=0;i-1&&(s.trigger===13&&s._executeCurrent(lt.CreateNew(t,void 0,n)),(!t.actionManager.hasSpecificTrigger(13,l=>{const c=l.mesh?l.mesh:l;return n===c})||s.trigger===13)&&t._intersectionsInProgress.splice(h,1))}}}}_advancePhysicsEngineStep(e){}_animate(e){}animate(){if(this._engine.isDeterministicLockStep()){let e=Math.max(tt.MinDeltaTime,Math.min(this._engine.getDeltaTime(),tt.MaxDeltaTime))+this._timeAccumulator;const t=this._engine.getTimeStep(),i=1e3/t/1e3;let s=0;const r=this._engine.getLockstepMaxSteps();let n=Math.floor(e/t);for(n=Math.min(n,r);e>0&&s0)for(let i=0;i0);for(let s=0;s0),this._renderId++}this._engine.currentRenderPassId=i?.renderPassId??0,this.activeCamera=i,this._activeCamera&&this._activeCamera.cameraRigMode!==22&&!this.prePass&&this._bindFrameBuffer(this._activeCamera,!1),this.onAfterRenderTargetsRenderObservable.notifyObservers(this);for(const s of this._beforeClearStage)s.action();this._clearFrameBuffer(this.activeCamera);for(const s of this._gatherRenderTargetsStage)s.action(this._renderTargets);if(this.activeCameras&&this.activeCameras.length>0)for(let s=0;s0);else{if(!this.activeCamera)throw new Error("No camera defined");this._processSubCameras(this.activeCamera,!!this.activeCamera.outputRenderTarget)}}this._checkIntersections();for(const i of this._afterRenderStage)i.action();if(this.afterRender&&this.afterRender(),this.onAfterRenderObservable.notifyObservers(this),this._toBeDisposed.length){for(let i=0;ir.dispose(!0)),this._disposeList(this.transformNodes,r=>r.dispose(!0));const i=this.cameras;this._disposeList(i),this._disposeList(this.particleSystems),this._disposeList(this.postProcesses),this._disposeList(this.textures),this._disposeList(this.morphTargetManagers),this._disposeList(this.frameGraphs),this._sceneUbo.dispose(),this._multiviewSceneUbo&&this._multiviewSceneUbo.dispose(),this.postProcessManager.dispose(),this._disposeList(this._components);let s=this._engine.scenes.indexOf(this);if(s>-1&&this._engine.scenes.splice(s,1),this._floatingOriginScene=void 0,this._engine.scenes.length===0&&Hc(),Te._LastCreatedScene===this){Te._LastCreatedScene=null;let r=Te.Instances.length-1;for(;r>=0;){const n=Te.Instances[r];if(n.scenes.length>0){Te._LastCreatedScene=n.scenes[this._engine.scenes.length-1];break}r--}}s=this._engine._virtualScenes.indexOf(this),s>-1&&this._engine._virtualScenes.splice(s,1),this._engine.wipeCaches(!0),this.onDisposeObservable.clear(),this.onBeforeRenderObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderTargetsRenderObservable.clear(),this.onAfterRenderTargetsRenderObservable.clear(),this.onAfterStepObservable.clear(),this.onBeforeStepObservable.clear(),this.onBeforeActiveMeshesEvaluationObservable.clear(),this.onAfterActiveMeshesEvaluationObservable.clear(),this.onBeforeParticlesRenderingObservable.clear(),this.onAfterParticlesRenderingObservable.clear(),this.onBeforeDrawPhaseObservable.clear(),this.onAfterDrawPhaseObservable.clear(),this.onBeforeAnimationsObservable.clear(),this.onAfterAnimationsObservable.clear(),this.onDataLoadedObservable.clear(),this.onBeforeRenderingGroupObservable.clear(),this.onAfterRenderingGroupObservable.clear(),this.onMeshImportedObservable.clear(),this.onBeforeCameraRenderObservable.clear(),this.onAfterCameraRenderObservable.clear(),this.onAfterRenderCameraObservable.clear(),this.onReadyObservable.clear(),this.onNewCameraAddedObservable.clear(),this.onCameraRemovedObservable.clear(),this.onNewLightAddedObservable.clear(),this.onLightRemovedObservable.clear(),this.onNewGeometryAddedObservable.clear(),this.onGeometryRemovedObservable.clear(),this.onNewTransformNodeAddedObservable.clear(),this.onTransformNodeRemovedObservable.clear(),this.onNewMeshAddedObservable.clear(),this.onMeshRemovedObservable.clear(),this.onNewSkeletonAddedObservable.clear(),this.onSkeletonRemovedObservable.clear(),this.onNewMaterialAddedObservable.clear(),this.onNewMultiMaterialAddedObservable.clear(),this.onMaterialRemovedObservable.clear(),this.onMultiMaterialRemovedObservable.clear(),this.onNewTextureAddedObservable.clear(),this.onTextureRemovedObservable.clear(),this.onNewFrameGraphAddedObservable.clear(),this.onFrameGraphRemovedObservable.clear(),this.onNewObjectRendererAddedObservable.clear(),this.onObjectRendererRemovedObservable.clear(),this.onPrePointerObservable.clear(),this.onPointerObservable.clear(),this.onPreKeyboardObservable.clear(),this.onKeyboardObservable.clear(),this.onActiveCameraChanged.clear(),this.onScenePerformancePriorityChangedObservable.clear(),this.onClearColorChangedObservable.clear(),this.onEnvironmentTextureChangedObservable.clear(),this.onMeshUnderPointerUpdatedObservable.clear(),this._isDisposed=!0}_disposeList(e,t){const i=e.slice(0);t=t??(s=>s.dispose());for(const s of i)t(s);e.length=0}get isDisposed(){return this._isDisposed}clearCachedVertexData(){for(let e=0;e!0);const s=this.meshes.filter(e);for(const r of s){if(r.computeWorldMatrix(!0),!r.subMeshes||r.subMeshes.length===0||r.infiniteDistance)continue;const n=r.getBoundingInfo(),o=n.boundingBox.minimumWorld,h=n.boundingBox.maximumWorld;_.CheckExtends(o,t,i),_.CheckExtends(h,t,i)}return t.x===Number.MAX_VALUE?{min:_.Zero(),max:_.Zero()}:{min:t,max:i}}createPickingRay(e,t,i,s,r=!1){throw ie("Ray")}createPickingRayToRef(e,t,i,s,r,n=!1,o=!1){throw ie("Ray")}createPickingRayInCameraSpace(e,t,i){throw ie("Ray")}createPickingRayInCameraSpaceToRef(e,t,i,s){throw ie("Ray")}pick(e,t,i,s,r,n){const o=ie("Ray",!0);return o&&w.Warn(o),new ms}pickWithBoundingInfo(e,t,i,s,r){const n=ie("Ray",!0);return n&&w.Warn(n),new ms}pickWithRay(e,t,i,s){throw ie("Ray")}multiPick(e,t,i,s,r){throw ie("Ray")}multiPickWithRay(e,t,i){throw ie("Ray")}setPointerOverMesh(e,t,i){this._inputManager.setPointerOverMesh(e,t,i)}getPointerOverMesh(){return this._inputManager.getPointerOverMesh()}_rebuildGeometries(){for(const e of this.geometries)e._rebuild();for(const e of this.meshes)e._rebuild();this.postProcessManager&&this.postProcessManager._rebuild();for(const e of this._components)e.rebuild();for(const e of this.particleSystems)e.rebuild();if(this.spriteManagers)for(const e of this.spriteManagers)e.rebuild()}_rebuildTextures(){for(const e of this.textures)e._rebuild(!0);this.markAllMaterialsAsDirty(1)}_getByTags(e,t,i){if(t===void 0)return e;const s=[];for(const r in e){const n=e[r];Ae&&Ae.MatchesQuery(n,t)&&(!i||i(n))&&s.push(n)}return s}getMeshesByTags(e,t){return this._getByTags(this.meshes,e,t)}getCamerasByTags(e,t){return this._getByTags(this.cameras,e,t)}getLightsByTags(e,t){return this._getByTags(this.lights,e,t)}getMaterialByTags(e,t){return this._getByTags(this.materials,e,t).concat(this._getByTags(this.multiMaterials,e,t))}getTransformNodesByTags(e,t){return this._getByTags(this.transformNodes,e,t)}setRenderingOrder(e,t=null,i=null,s=null){this._renderingManager.setRenderingOrder(e,t,i,s)}setRenderingAutoClearDepthStencil(e,t,i=!0,s=!0){this._renderingManager.setRenderingAutoClearDepthStencil(e,t,i,s)}getAutoClearDepthStencilSetup(e){return this._renderingManager.getAutoClearDepthStencilSetup(e)}_forceBlockMaterialDirtyMechanism(e){this._blockMaterialDirtyMechanism=e}get blockMaterialDirtyMechanism(){return this._blockMaterialDirtyMechanism}set blockMaterialDirtyMechanism(e){this._blockMaterialDirtyMechanism!==e&&(this._blockMaterialDirtyMechanism=e,e||this.markAllMaterialsAsDirty(127))}markAllMaterialsAsDirty(e,t){if(!this._blockMaterialDirtyMechanism)for(const i of this.materials)t&&!t(i)||i.markAsDirty(e)}_loadFile(e,t,i,s,r,n,o){const h=wi(e,t,i,s?this.offlineProvider:void 0,r,n,o);return this._activeRequests.push(h),h.onCompleteObservable.add(l=>{this._activeRequests.splice(this._activeRequests.indexOf(l),1)}),h}async _loadFileAsync(e,t,i,s,r){return await new Promise((n,o)=>{this._loadFile(e,h=>{n(h)},t,i,s,(h,l)=>{o(l)},r)})}_requestFile(e,t,i,s,r,n,o){const h=Fn(e,t,i,s?this.offlineProvider:void 0,r,n,o);return this._activeRequests.push(h),h.onCompleteObservable.add(l=>{this._activeRequests.splice(this._activeRequests.indexOf(l),1)}),h}async _requestFileAsync(e,t,i,s,r){return await new Promise((n,o)=>{this._requestFile(e,h=>{n(h)},t,i,s,h=>{o(h)},r)})}_readFile(e,t,i,s,r){const n=Gs(e,t,i,s,r);return this._activeRequests.push(n),n.onCompleteObservable.add(o=>{this._activeRequests.splice(this._activeRequests.indexOf(o),1)}),n}async _readFileAsync(e,t,i){return await new Promise((s,r)=>{this._readFile(e,n=>{s(n)},t,i,n=>{r(n)})})}getPerfCollector(){throw ie("performanceViewerSceneExtension")}setActiveCameraByID(e){return this.setActiveCameraById(e)}getMaterialByID(e){return this.getMaterialById(e)}getLastMaterialByID(e){return this.getLastMaterialById(e)}getTextureByUniqueID(e){return this.getTextureByUniqueId(e)}getCameraByID(e){return this.getCameraById(e)}getCameraByUniqueID(e){return this.getCameraByUniqueId(e)}getBoneByID(e){return this.getBoneById(e)}getLightByID(e){return this.getLightById(e)}getLightByUniqueID(e){return this.getLightByUniqueId(e)}getParticleSystemByID(e){return this.getParticleSystemById(e)}getGeometryByID(e){return this.getGeometryById(e)}getMeshByID(e){return this.getMeshById(e)}getMeshByUniqueID(e){return this.getMeshByUniqueId(e)}getLastMeshByID(e){return this.getLastMeshById(e)}getMeshesByID(e){return this.getMeshesById(e)}getTransformNodeByID(e){return this.getTransformNodeById(e)}getTransformNodeByUniqueID(e){return this.getTransformNodeByUniqueId(e)}getTransformNodesByID(e){return this.getTransformNodesById(e)}getNodeByID(e){return this.getNodeById(e)}getLastEntryByID(e){return this.getLastEntryById(e)}getLastSkeletonByID(e){return this.getLastSkeletonById(e)}}tt.FOGMODE_NONE=0;tt.FOGMODE_EXP=1;tt.FOGMODE_EXP2=2;tt.FOGMODE_LINEAR=3;tt.MinDeltaTime=1;tt.MaxDeltaTime=1e3;tt._OriginalDefaultMaterialFactory=tt.DefaultMaterialFactory;nt("BABYLON.Scene",tt);async function Lu(a,e){const t=e.method||"GET";return await new Promise((i,s)=>{const r=new gt;r.addEventListener("readystatechange",()=>{if(r.readyState==4)if(r.status==200){const n={};if(e.responseHeaders)for(const o of e.responseHeaders)n[o]=r.getResponseHeader(o)||"";i({response:r.response,headerValues:n})}else s(`Unable to fetch data from ${a}. Error code: ${r.status}`)}),r.open(t,a),r.send()})}var wa;(function(a){a[a.Clean=0]="Clean",a[a.Stop=1]="Stop",a[a.Sync=2]="Sync",a[a.NoSync=3]="NoSync"})(wa||(wa={}));function Bu(a){return!!a.createPlugin}function Nu(a){return!!a.name}const Uu=new O,Ri={};function Gn(){return Ri[".babylon"]}function ku(a){for(const e in Ri){const t=Ri[e];if(t.mimeType===a)return t}}function La(a,e){const t=Ri[a];return t||(w.Warn("Unable to find a plugin to load "+a+" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes"),e?Gn():void 0)}function Gu(a){for(const e in Ri){const t=Ri[e].plugin;if(t.canDirectLoad&&t.canDirectLoad(a))return Ri[e]}return Gn()}function Hu(a){const e=a.indexOf("?");e!==-1&&(a=a.substring(0,e));const t=a.lastIndexOf(".");return a.substring(t,a.length).toLowerCase()}function Vu(a){return a.substring(0,5)==="data:"?a.substring(5):null}function Sh(a,e,t){let s="Unable to load from "+(a.rawData?"binary data":a.url);return e?s+=`: ${e}`:t&&(s+=`: ${t}`),s}async function Mh(a,e,t,i,s,r,n,o,h){const l=Vu(a.url);if(a.rawData&&!n)throw"When using ArrayBufferView to load data the file extension must be provided.";const c=!l&&!n?Hu(a.url):"";let u=n?La(n,!0):l?Gu(a.url):La(c,!1);if(!u&&c){if(a.url&&!a.url.startsWith("blob:")){const d=await Lu(a.url,{method:"HEAD",responseHeaders:["Content-Type"]}),g=d.headerValues?d.headerValues["Content-Type"]:"";g&&(u=ku(g))}u||(u=Gn())}if(!u)throw new Error(`No plugin or fallback for ${n??a.url}`);if(h?.[u.plugin.name]?.enabled===!1)throw new Error(`The '${u.plugin.name}' plugin is disabled via the loader options passed to the loading operation.`);if(a.rawData&&!u.isBinary)throw"Loading from ArrayBufferView can not be used with plugins that don't support binary loading.";return(d=>{if(Bu(u.plugin)){const p=u.plugin.createPlugin(h??{});return p instanceof Promise?(p.then(d).catch(m=>{s("Error instantiating plugin.",m)}),null):(d(p),p)}else return d(u.plugin),u.plugin})(d=>{if(!d)throw`The loader plugin corresponding to the '${n}' file type has not been found. If using es6, please import the plugin you wish to use before.`;if(Uu.notifyObservers(d),l&&(d.canDirectLoad&&d.canDirectLoad(a.url)||!wn(a.url))){if(d.directLoad){const C=d.directLoad(e,l);C instanceof Promise?C.then(x=>{t(d,x)}).catch(x=>{s("Error in directLoad of _loadData: "+x,x)}):t(d,C)}else t(d,l);return}const g=u.isBinary,p=(C,x)=>{if(e.isDisposed){s("Scene has been disposed");return}t(d,C,x)};let m=null,A=!1;d.onDisposeObservable?.add(()=>{A=!0,m&&(m.abort(),m=null),r()});const E=()=>{if(A)return;const C=(x,S)=>{s(x?.statusText,S)};if(!d.loadFile&&a.rawData)throw"Plugin does not support loading ArrayBufferView.";m=d.loadFile?d.loadFile(e,a.rawData||a.file||a.url,a.rootUrl,p,i,g,C,o):e._loadFile(a.file||a.url,p,i,!0,g,C)},I=e.getEngine();let M=I.enableOfflineSupport;if(M){let C=!1;for(const x of e.disableOfflineSupportExceptionRules)if(x.test(a.url)){C=!0;break}M=!C}M&&H.OfflineProviderFactory?e.offlineProvider=H.OfflineProviderFactory(a.url,E,I.disableManifestCheck):E()})}function Ch(a,e){let t,i,s=null,r=null;if(!e)t=a,i=se.GetFilename(a),a=se.GetFolderPath(a);else if(Nu(e))t=`file:${e.name}`,i=e.name,s=e;else if(ArrayBuffer.isView(e))t="",i=Bn(),r=e;else if(e.startsWith("data:"))t=e,i="";else if(a){const n=e;if(n.substring(0,1)==="/")return se.Error("Wrong sceneFilename parameter"),null;t=a+n,i=n}else t=e,i=se.GetFilename(e),a=se.GetFolderPath(e);return{url:t,rootUrl:a,name:i,file:s,rawData:r}}function Ps(a){if(typeof a.extensions=="string"){const e=a.extensions;Ri[e.toLowerCase()]={plugin:a,isBinary:!1}}else{const e=a.extensions,t=Object.keys(e);for(const i of t)Ri[i.toLowerCase()]={plugin:a,isBinary:e[i].isBinary,mimeType:e[i].mimeType}}}async function y_(a,e,t){const{meshNames:i,rootUrl:s="",onProgress:r,pluginExtension:n,name:o,pluginOptions:h}=t??{};return await Wu(i,s,a,e,r,n,o,h)}async function zu(a,e,t="",i=Te.LastCreatedScene,s=null,r=null,n=null,o=null,h="",l={}){if(!i)return w.Error("No scene available to import mesh to"),null;const c=Ch(e,t);if(!c)return null;const u={};i.addPendingData(u);const f=()=>{i.removePendingData(u)},d=(m,A)=>{const E=Sh(c,m,A);n?n(i,E,new Li(E,xs.SceneLoaderError,A)):w.Error(E),f()},g=r?m=>{try{r(m)}catch(A){d("Error in onProgress callback: "+A,A)}}:void 0,p=(m,A,E,I,M,C,x,S)=>{if(i.importedMeshesFiles.push(c.url),s)try{s(m,A,E,I,M,C,x,S)}catch(L){d("Error in onSuccess callback: "+L,L)}i.removePendingData(u)};return await Mh(c,i,(m,A,E)=>{if(m.rewriteRootURL&&(c.rootUrl=m.rewriteRootURL(c.rootUrl,E)),m.importMesh){const I=m,M=[],C=[],x=[];if(!I.importMesh(a,i,A,c.rootUrl,M,C,x,d))return;i.loadingPluginName=m.name,p(M,C,x,[],[],[],[],[])}else m.importMeshAsync(a,i,A,c.rootUrl,g,c.name).then(M=>{i.loadingPluginName=m.name,p(M.meshes,M.particleSystems,M.skeletons,M.animationGroups,M.transformNodes,M.geometries,M.lights,M.spriteManagers)}).catch(M=>{d(M.message,M)})},g,d,f,o,h,l)}async function Wu(a,e,t,i,s,r,n,o){return await new Promise((h,l)=>{try{zu(a,e,t,i,(c,u,f,d,g,p,m,A)=>{h({meshes:c,particleSystems:u,skeletons:f,animationGroups:d,transformNodes:g,geometries:p,lights:m,spriteManagers:A})},s,(c,u,f)=>{l(f||new Error(u))},r,n,o).catch(l)}catch(c){l(c)}})}async function Xu(a,e="",t=Te.LastCreatedScene,i=null,s=null,r=null,n=null,o="",h={}){if(!t)return w.Error("No scene available to load asset container to"),null;const l=Ch(a,e);if(!l)return null;const c={};t.addPendingData(c);const u=()=>{t.removePendingData(c)},f=(p,m)=>{const A=Sh(l,p,m);r?r(t,A,new Li(A,xs.SceneLoaderError,m)):w.Error(A),u()},d=s?p=>{try{s(p)}catch(m){f("Error in onProgress callback",m)}}:void 0,g=p=>{if(i)try{i(p)}catch(m){f("Error in onSuccess callback",m)}t.removePendingData(c)};return await Mh(l,t,(p,m)=>{if(p.loadAssetContainer){const E=p.loadAssetContainer(t,m,l.rootUrl,f);if(!E)return;E.populateRootNodes(),t.loadingPluginName=p.name,g(E)}else p.loadAssetContainerAsync?p.loadAssetContainerAsync(t,m,l.rootUrl,d,l.name).then(E=>{E.populateRootNodes(),t.loadingPluginName=p.name,g(E)}).catch(E=>{f(E.message,E)}):f("LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.")},d,f,u,n,o,h)}async function Ku(a,e,t){const{rootUrl:i="",onProgress:s,pluginExtension:r,name:n,pluginOptions:o}=t??{};return await Yu(i,a,e,s,r,n,o)}async function Yu(a,e,t,i,s,r,n){return await new Promise((o,h)=>{try{Xu(a,e,t,l=>{o(l)},i,(l,c,u)=>{h(u||new Error(c))},s,r,n).catch(h)}catch(l){h(l)}})}class Si{constructor(e){if(this.VERTEXOUTPUT_INVARIANT=!1,this._keys=[],this._isDirty=!0,this._areLightsDirty=!0,this._areLightsDisposed=!1,this._areAttributesDirty=!0,this._areTexturesDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._arePrePassDirty=!0,this._areImageProcessingDirty=!0,this._normals=!1,this._uvs=!1,this._needNormals=!1,this._needUVs=!1,this._externalProperties=e,e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this._setDefaultValue(t)}get isDirty(){return this._isDirty}markAsProcessed(){this._isDirty=!1,this._areAttributesDirty=!1,this._areTexturesDirty=!1,this._areFresnelDirty=!1,this._areLightsDirty=!1,this._areLightsDisposed=!1,this._areMiscDirty=!1,this._arePrePassDirty=!1,this._areImageProcessingDirty=!1}markAsUnprocessed(){this._isDirty=!0}markAllAsDirty(){this._areTexturesDirty=!0,this._areAttributesDirty=!0,this._areLightsDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._arePrePassDirty=!0,this._areImageProcessingDirty=!0,this._isDirty=!0}markAsImageProcessingDirty(){this._areImageProcessingDirty=!0,this._isDirty=!0}markAsLightDirty(e=!1){this._areLightsDirty=!0,this._areLightsDisposed=this._areLightsDisposed||e,this._isDirty=!0}markAsAttributesDirty(){this._areAttributesDirty=!0,this._isDirty=!0}markAsTexturesDirty(){this._areTexturesDirty=!0,this._isDirty=!0}markAsFresnelDirty(){this._areFresnelDirty=!0,this._isDirty=!0}markAsMiscDirty(){this._areMiscDirty=!0,this._isDirty=!0}markAsPrePassDirty(){this._arePrePassDirty=!0,this._isDirty=!0}rebuild(){this._keys.length=0;for(const e of Object.keys(this))e[0]!=="_"&&this._keys.push(e);if(this._externalProperties)for(const e in this._externalProperties)this._keys.indexOf(e)===-1&&this._keys.push(e)}isEqual(e){if(this._keys.length!==e._keys.length)return!1;for(let t=0;tthis._maxRank&&(this._maxRank=e),this._defines[e]=new Array),this._defines[e].push(t)}addCPUSkinningFallback(e,t){this._mesh=t,ethis._maxRank&&(this._maxRank=e)}get hasMoreFallbacks(){return this._currentRank<=this._maxRank}reduce(e,t){if(this._mesh&&this._mesh.computeBonesUsingShaders&&this._mesh.numBoneInfluencers>0){this._mesh.computeBonesUsingShaders=!1,e=e.replace("#define NUM_BONE_INFLUENCERS "+this._mesh.numBoneInfluencers,"#define NUM_BONE_INFLUENCERS 0"),t._bonesComputationForcedToCPU=!0;const i=this._mesh.getScene();for(let s=0;s0&&(r.computeBonesUsingShaders=!1);continue}if(!(!r.computeBonesUsingShaders||r.numBoneInfluencers===0)){if(r.material.getEffect()===t)r.computeBonesUsingShaders=!1;else if(r.subMeshes){for(const n of r.subMeshes)if(n.effect===t){r.computeBonesUsingShaders=!1;break}}}}}else{const i=this._defines[this._currentRank];if(i)for(let s=0;s{this._markAllSubMeshesAsImageProcessingDirty&&this._markAllSubMeshesAsImageProcessingDirty()})))}get cameraColorCurvesEnabled(){return this.imageProcessingConfiguration.colorCurvesEnabled}set cameraColorCurvesEnabled(e){this.imageProcessingConfiguration.colorCurvesEnabled=e}get cameraColorGradingEnabled(){return this.imageProcessingConfiguration.colorGradingEnabled}set cameraColorGradingEnabled(e){this.imageProcessingConfiguration.colorGradingEnabled=e}get cameraToneMappingEnabled(){return this._imageProcessingConfiguration.toneMappingEnabled}set cameraToneMappingEnabled(e){this._imageProcessingConfiguration.toneMappingEnabled=e}get cameraExposure(){return this._imageProcessingConfiguration.exposure}set cameraExposure(e){this._imageProcessingConfiguration.exposure=e}get cameraContrast(){return this._imageProcessingConfiguration.contrast}set cameraContrast(e){this._imageProcessingConfiguration.contrast=e}get cameraColorGradingTexture(){return this._imageProcessingConfiguration.colorGradingTexture}set cameraColorGradingTexture(e){this._imageProcessingConfiguration.colorGradingTexture=e}get cameraColorCurves(){return this._imageProcessingConfiguration.colorCurves}set cameraColorCurves(e){this._imageProcessingConfiguration.colorCurves=e}}}class qu extends Si{}class ju extends Ph(qu){constructor(){super(),this.DIFFUSE=!1,this.DIFFUSEDIRECTUV=0,this.GAMMADIFFUSE=!1,this.DIFFUSEHASALPHA=!1,this.OPACITYFRESNEL=!1,this.REFLECTIONBLUR=!1,this.REFLECTIONFRESNEL=!1,this.REFLECTIONFALLOFF=!1,this.TEXTURELODSUPPORT=!1,this.PREMULTIPLYALPHA=!1,this.USERGBCOLOR=!1,this.USEHIGHLIGHTANDSHADOWCOLORS=!1,this.BACKMAT_SHADOWONLY=!1,this.NOISE=!1,this.REFLECTIONBGR=!1,this.PROJECTED_GROUND=!1,this.REFLECTION=!1,this.REFLECTIONMAP_3D=!1,this.REFLECTIONMAP_SPHERICAL=!1,this.REFLECTIONMAP_PLANAR=!1,this.REFLECTIONMAP_CUBIC=!1,this.REFLECTIONMAP_PROJECTION=!1,this.REFLECTIONMAP_SKYBOX=!1,this.REFLECTIONMAP_EXPLICIT=!1,this.REFLECTIONMAP_EQUIRECTANGULAR=!1,this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,this.INVERTCUBICMAP=!1,this.REFLECTIONMAP_OPPOSITEZ=!1,this.LODINREFLECTIONALPHA=!1,this.GAMMAREFLECTION=!1,this.RGBDREFLECTION=!1,this.EQUIRECTANGULAR_RELFECTION_FOV=!1,this.MAINUV1=!1,this.MAINUV2=!1,this.UV1=!1,this.UV2=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.SHADOWFLOAT=!1,this.LOGARITHMICDEPTH=!1,this.NONUNIFORMSCALING=!1,this.ALPHATEST=!1,this.rebuild()}}class Qu extends Dh(Ih){}class _e extends Qu{get _perceptualColor(){return this.__perceptualColor}set _perceptualColor(e){this.__perceptualColor=e,this._computePrimaryColorFromPerceptualColor(),this._markAllSubMeshesAsLightsDirty()}get primaryColorShadowLevel(){return this._primaryColorShadowLevel}set primaryColorShadowLevel(e){this._primaryColorShadowLevel=e,this._computePrimaryColors(),this._markAllSubMeshesAsLightsDirty()}get primaryColorHighlightLevel(){return this._primaryColorHighlightLevel}set primaryColorHighlightLevel(e){this._primaryColorHighlightLevel=e,this._computePrimaryColors(),this._markAllSubMeshesAsLightsDirty()}set reflectionStandardFresnelWeight(e){let t=e;t<.5?(t=t*2,this.reflectionReflectance0=_e.StandardReflectance0*t,this.reflectionReflectance90=_e.StandardReflectance90*t):(t=t*2-1,this.reflectionReflectance0=_e.StandardReflectance0+(1-_e.StandardReflectance0)*t,this.reflectionReflectance90=_e.StandardReflectance90+(1-_e.StandardReflectance90)*t)}get fovMultiplier(){return this._fovMultiplier}set fovMultiplier(e){isNaN(e)&&(e=1),this._fovMultiplier=Math.max(0,Math.min(2,e))}constructor(e,t,i=!1){super(e,t,void 0,i),this.primaryColor=q.White(),this._primaryColorShadowLevel=0,this._primaryColorHighlightLevel=0,this.reflectionTexture=null,this.reflectionBlur=0,this.diffuseTexture=null,this._shadowLights=null,this.shadowLights=null,this.shadowLevel=0,this.sceneCenter=_.Zero(),this.opacityFresnel=!0,this.reflectionFresnel=!1,this.reflectionFalloffDistance=0,this.reflectionAmount=1,this.reflectionReflectance0=.05,this.reflectionReflectance90=.5,this.useRGBColor=!0,this.enableNoise=!1,this._fovMultiplier=1,this.useEquirectangularFOV=!1,this._maxSimultaneousLights=4,this.maxSimultaneousLights=4,this._shadowOnly=!1,this.shadowOnly=!1,this.switchToBGR=!1,this._enableGroundProjection=!1,this.enableGroundProjection=!1,this.projectedGroundRadius=1e3,this.projectedGroundHeight=10,this._renderTargets=new it(16),this._reflectionControls=ge.Zero(),this._white=q.White(),this._primaryShadowColor=q.Black(),this._primaryHighlightColor=q.Black(),this._shadersLoaded=!1,this._attachImageProcessingConfiguration(null),this.getRenderTargetTextures=()=>(this._renderTargets.reset(),this._diffuseTexture&&this._diffuseTexture.isRenderTarget&&this._renderTargets.push(this._diffuseTexture),this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._renderTargets.push(this._reflectionTexture),this._renderTargets)}get hasRenderTargetTextures(){return!!(this._diffuseTexture&&this._diffuseTexture.isRenderTarget||this._reflectionTexture&&this._reflectionTexture.isRenderTarget)}needAlphaTesting(){return!0}needAlphaBlending(){return this.alpha<1||this._diffuseTexture!=null&&this._diffuseTexture.hasAlpha||this._shadowOnly}isReadyForSubMesh(e,t,i=!1){const s=t._drawWrapper;if(s.effect&&this.isFrozen&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new ju);const r=this.getScene(),n=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;const o=r.getEngine();if(lh(r,e,n,!1,this._maxSimultaneousLights),n._needNormals=!0,fh(r,n),n._areTexturesDirty){if(n._needUVs=!1,r.texturesEnabled){if(r.getEngine().getCaps().textureLOD&&(n.TEXTURELODSUPPORT=!0),this._diffuseTexture&&U.DiffuseTextureEnabled){if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;Ne(this._diffuseTexture,n,"DIFFUSE"),n.DIFFUSEHASALPHA=this._diffuseTexture.hasAlpha,n.GAMMADIFFUSE=this._diffuseTexture.gammaSpace,n.OPACITYFRESNEL=this._opacityFresnel}else n.DIFFUSE=!1,n.DIFFUSEDIRECTUV=0,n.DIFFUSEHASALPHA=!1,n.GAMMADIFFUSE=!1,n.OPACITYFRESNEL=!1;const h=this._reflectionTexture;if(ch(r,h,n),h&&U.ReflectionTextureEnabled){if(!h.isReadyOrNotBlocking())return!1;n.EQUIRECTANGULAR_RELFECTION_FOV=this.useEquirectangularFOV,n.REFLECTIONBGR=this.switchToBGR,n.REFLECTIONBLUR=this._reflectionBlur>0,this.reflectionFresnel?(n.REFLECTIONFRESNEL=!0,n.REFLECTIONFALLOFF=this.reflectionFalloffDistance>0,this._reflectionControls.x=this.reflectionAmount,this._reflectionControls.y=this.reflectionReflectance0,this._reflectionControls.z=this.reflectionReflectance90,this._reflectionControls.w=1/this.reflectionFalloffDistance):(n.REFLECTIONFRESNEL=!1,n.REFLECTIONFALLOFF=!1)}else n.REFLECTIONFRESNEL=!1,n.REFLECTIONFALLOFF=!1,n.REFLECTIONBLUR=!1}n.PREMULTIPLYALPHA=this.alphaMode===7||this.alphaMode===8,n.USERGBCOLOR=this._useRGBColor,n.NOISE=this._enableNoise}if(n._areLightsDirty&&(n.USEHIGHLIGHTANDSHADOWCOLORS=!this._useRGBColor&&(this._primaryColorShadowLevel!==0||this._primaryColorHighlightLevel!==0),n.BACKMAT_SHADOWONLY=this._shadowOnly),n._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(n)}if(n._areMiscDirty&&(n.REFLECTIONMAP_3D&&this._enableGroundProjection?(n.PROJECTED_GROUND=!0,n.REFLECTIONMAP_SKYBOX=!0):n.PROJECTED_GROUND=!1),hh(e,r,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),n,void 0,void 0,void 0,this._isVertexOutputInvariant),uh(r,o,this,n,i,null,t.getRenderingMesh().hasThinInstances),dh(e,n,!1,!0,!1)&&e&&!r.getEngine().getCaps().standardDerivatives&&!e.isVerticesDataPresent(b.NormalKind)&&(e.createNormals(!0),w.Warn("BackgroundMaterial: Normals have been created for the mesh: "+e.name)),n.isDirty){n.markAsProcessed(),r.resetCachedMaterial();const h=new vh;n.FOG&&h.addFallback(0,"FOG"),n.POINTSIZE&&h.addFallback(1,"POINTSIZE"),n.MULTIVIEW&&h.addFallback(0,"MULTIVIEW"),oh(n,h,this._maxSimultaneousLights);const l=[b.PositionKind];n.NORMAL&&l.push(b.NormalKind),n.UV1&&l.push(b.UVKind),n.UV2&&l.push(b.UV2Kind),nh(l,e,n,h),ah(l,n);const c=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","mBones","vPrimaryColor","vPrimaryColorShadow","fFovMultiplier","shadowLevel","alpha","vBackgroundCenter","vReflectionControl","vDiffuseInfos","diffuseMatrix","projectedGroundInfos","logarithmicDepthConstant"];qo(c);const u=["diffuseSampler"];_h(c,u,!1);const f=["Material","Scene"];ue&&(ue.PrepareUniforms(c,n),ue.PrepareSamplers(u,n)),gh({uniformsNames:c,uniformBuffersNames:f,samplers:u,defines:n,maxSimultaneousLights:this._maxSimultaneousLights});const d=n.toString(),g=r.getEngine().createEffect("background",{attributes:l,uniformsNames:c,uniformBuffersNames:f,samplers:u,defines:d,fallbacks:h,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:async()=>{this.shaderLanguage===1?await Promise.all([G(()=>import("./background.vertex-Ck4dF8t7.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url),G(()=>import("./background.fragment-DVcvlYwn.js"),__vite__mapDeps([15,1,2,3,16,17,18,10,19,20,21,13,14]),import.meta.url)]):await Promise.all([G(()=>import("./background.vertex-DsMHrPHo.js"),__vite__mapDeps([22,23,24,25,26,27,28,29,30,31,13,14]),import.meta.url),G(()=>import("./background.fragment-a1OuescW.js"),__vite__mapDeps([32,23,24,25,33,34,35,36,31,37,38,13,14]),import.meta.url)]),this._shadersLoaded=!0}},o);t.setEffect(g,n,this._materialContext),this.buildUniformLayout()}return!t.effect||!t.effect.isReady()?!1:(n._renderId=r.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=i,this._checkScenePerformancePriority(),!0)}_computePrimaryColorFromPerceptualColor(){this.__perceptualColor&&(this._primaryColor.copyFrom(this.__perceptualColor),this._primaryColor.toLinearSpaceToRef(this._primaryColor,this.getScene().getEngine().useExactSrgbConversions),this._imageProcessingConfiguration&&this._primaryColor.scaleToRef(1/this._imageProcessingConfiguration.exposure,this._primaryColor),this._computePrimaryColors())}_computePrimaryColors(){this._primaryColorShadowLevel===0&&this._primaryColorHighlightLevel===0||(this._primaryColor.scaleToRef(this._primaryColorShadowLevel,this._primaryShadowColor),this._primaryColor.subtractToRef(this._primaryShadowColor,this._primaryShadowColor),this._white.subtractToRef(this._primaryColor,this._primaryHighlightColor),this._primaryHighlightColor.scaleToRef(this._primaryColorHighlightLevel,this._primaryHighlightColor),this._primaryColor.addToRef(this._primaryHighlightColor,this._primaryHighlightColor))}buildUniformLayout(){this._uniformBuffer.addUniform("vPrimaryColor",4),this._uniformBuffer.addUniform("vPrimaryColorShadow",4),this._uniformBuffer.addUniform("vDiffuseInfos",2),this._uniformBuffer.addUniform("diffuseMatrix",16),this._uniformBuffer.addUniform("fFovMultiplier",1),this._uniformBuffer.addUniform("pointSize",1),this._uniformBuffer.addUniform("shadowLevel",1),this._uniformBuffer.addUniform("alpha",1),this._uniformBuffer.addUniform("vBackgroundCenter",3),this._uniformBuffer.addUniform("vReflectionControl",4),this._uniformBuffer.addUniform("projectedGroundInfos",2),ph(this._uniformBuffer,!0,!1,!1),this._uniformBuffer.create()}unbind(){this._diffuseTexture&&this._diffuseTexture.isRenderTarget&&this._uniformBuffer.setTexture("diffuseSampler",null),this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._uniformBuffer.setTexture("reflectionSampler",null),super.unbind()}bindOnlyWorldMatrix(e){this._activeEffect.setMatrix("world",e)}bindForSubMesh(e,t,i){const s=this.getScene(),r=i.materialDefines;if(!r)return;const n=i.effect;if(!n)return;this._activeEffect=n,this.bindOnlyWorldMatrix(e),sh(t,this._activeEffect);const o=this._mustRebind(s,n,i,t.visibility);if(o){this._uniformBuffer.bindToEffect(n,"Material"),this.bindViewProjection(n);const h=this._reflectionTexture;if((!this._uniformBuffer.useUbo||!this.isFrozen||!this._uniformBuffer.isSync||i._drawWrapper._forceRebindOnNextCall)&&(s.texturesEnabled&&(this._diffuseTexture&&U.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),Ue(this._diffuseTexture,this._uniformBuffer,"diffuse")),th(s,r,this._uniformBuffer,q.White(),h,!1,!0,!1,!1,!1,!1,this._reflectionBlur)),this.shadowLevel>0&&this._uniformBuffer.updateFloat("shadowLevel",this.shadowLevel),this._uniformBuffer.updateFloat("alpha",this.alpha),this.pointsCloud&&this._uniformBuffer.updateFloat("pointSize",this.pointSize),r.USEHIGHLIGHTANDSHADOWCOLORS?(this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryHighlightColor,1),this._uniformBuffer.updateColor4("vPrimaryColorShadow",this._primaryShadowColor,1)):this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryColor,1)),this._uniformBuffer.updateFloat("fFovMultiplier",this._fovMultiplier),r.REFLECTIONFRESNEL&&this._uniformBuffer.updateFloat4("vReflectionControl",this._reflectionControls.x,this._reflectionControls.y,this._reflectionControls.z,this._reflectionControls.w),r.REFLECTIONFRESNEL&&r.REFLECTIONFALLOFF||r.OPACITYFRESNEL){const l=v.Vector3[0].copyFrom(this.sceneCenter).subtractInPlace(s.floatingOriginOffset);this._uniformBuffer.updateFloat3("vBackgroundCenter",l.x,l.y,l.z)}s.texturesEnabled&&(this._diffuseTexture&&U.DiffuseTextureEnabled&&this._uniformBuffer.setTexture("diffuseSampler",this._diffuseTexture),h&&U.ReflectionTextureEnabled&&ih(s,r,this._uniformBuffer,h),r.PROJECTED_GROUND&&this._uniformBuffer.updateFloat2("projectedGroundInfos",this.projectedGroundRadius,this.projectedGroundHeight)),jo(this._activeEffect,this,s),s.bindEyePosition(n)}else s.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._uniformBuffer.bindToEffect(n,"Material"),this._needToBindSceneUbo=!0);(o||!this.isFrozen)&&(s.lightsEnabled&&rh(s,t,this._activeEffect,r,this._maxSimultaneousLights),this.bindView(n),$o(s,t,this._activeEffect,!0),this._useLogarithmicDepth&&Zo(r,n,s),this._imageProcessingConfiguration&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._afterBind(t,this._activeEffect,i),this._uniformBuffer.update()}hasTexture(e){return!!(super.hasTexture(e)||this._reflectionTexture===e||this._diffuseTexture===e)}dispose(e=!1,t=!1){t&&(this.diffuseTexture&&this.diffuseTexture.dispose(),this.reflectionTexture&&this.reflectionTexture.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),super.dispose(e)}clone(e){return le.Clone(()=>new _e(e,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.BackgroundMaterial",e}getClassName(){return"BackgroundMaterial"}static Parse(e,t,i){return le.Parse(()=>new _e(e.name,t),e,t,i)}}_e.StandardReflectance0=.05;_e.StandardReflectance90=.5;T([At()],_e.prototype,"_primaryColor",void 0);T([B("_markAllSubMeshesAsLightsDirty")],_e.prototype,"primaryColor",void 0);T([At()],_e.prototype,"__perceptualColor",void 0);T([R()],_e.prototype,"_primaryColorShadowLevel",void 0);T([R()],_e.prototype,"_primaryColorHighlightLevel",void 0);T([B("_markAllSubMeshesAsLightsDirty")],_e.prototype,"primaryColorHighlightLevel",null);T([Oe()],_e.prototype,"_reflectionTexture",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"reflectionTexture",void 0);T([R()],_e.prototype,"_reflectionBlur",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"reflectionBlur",void 0);T([Oe()],_e.prototype,"_diffuseTexture",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"diffuseTexture",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"shadowLights",void 0);T([R()],_e.prototype,"_shadowLevel",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"shadowLevel",void 0);T([qt()],_e.prototype,"_sceneCenter",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"sceneCenter",void 0);T([R()],_e.prototype,"_opacityFresnel",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"opacityFresnel",void 0);T([R()],_e.prototype,"_reflectionFresnel",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"reflectionFresnel",void 0);T([R()],_e.prototype,"_reflectionFalloffDistance",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"reflectionFalloffDistance",void 0);T([R()],_e.prototype,"_reflectionAmount",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"reflectionAmount",void 0);T([R()],_e.prototype,"_reflectionReflectance0",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"reflectionReflectance0",void 0);T([R()],_e.prototype,"_reflectionReflectance90",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"reflectionReflectance90",void 0);T([R()],_e.prototype,"_useRGBColor",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"useRGBColor",void 0);T([R()],_e.prototype,"_enableNoise",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"enableNoise",void 0);T([R()],_e.prototype,"_maxSimultaneousLights",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],_e.prototype,"maxSimultaneousLights",void 0);T([R()],_e.prototype,"_shadowOnly",void 0);T([B("_markAllSubMeshesAsLightsDirty")],_e.prototype,"shadowOnly",void 0);T([R(),B("_markAllSubMeshesAsMiscDirty")],_e.prototype,"enableGroundProjection",void 0);T([R()],_e.prototype,"projectedGroundRadius",void 0);T([R()],_e.prototype,"projectedGroundHeight",void 0);nt("BABYLON.BackgroundMaterial",_e);const yn="postprocessVertexShader",Oh=`attribute vec2 position;uniform vec2 scale;varying vec2 vUV;const vec2 madd=vec2(0.5,0.5); +#define CUSTOM_VERTEX_DEFINITIONS +void main(void) { +#define CUSTOM_VERTEX_MAIN_BEGIN +vUV=(position*madd+madd)*scale;gl_Position=vec4(position,0.0,1.0); +#define CUSTOM_VERTEX_MAIN_END +}`;We.ShadersStore[yn]||(We.ShadersStore[yn]=Oh);const Zu={name:yn,shader:Oh},Fh=Object.freeze(Object.defineProperty({__proto__:null,postprocessVertexShader:Zu},Symbol.toStringTag,{value:"Module"})),rn={positions:[1,1,-1,1,-1,-1,1,-1],indices:[0,1,2,0,2,3]};class $u{constructor(e,t=rn){this._fullscreenViewport=new ps(0,0,1,1);const i=t.positions??rn.positions,s=t.indices??rn.indices;this.engine=e,this._vertexBuffers={[b.PositionKind]:new b(e,i,b.PositionKind,!1,!1,2)},this._indexBuffer=e.createIndexBuffer(s),this._indexBufferLength=s.length,this._onContextRestoredObserver=e.onContextRestoredObservable.add(()=>{this._indexBuffer=e.createIndexBuffer(s);for(const r in this._vertexBuffers)this._vertexBuffers[r]._rebuild()})}setViewport(e=this._fullscreenViewport){this.engine.setViewport(e)}bindBuffers(e){this.engine.bindBuffers(this._vertexBuffers,this._indexBuffer,e)}applyEffectWrapper(e,t=!1,i=!1){this.engine.setState(!0),this.engine.depthCullingState.depthTest=t,this.engine.stencilState.stencilTest=i,this.engine.enableEffect(e.drawWrapper),this.bindBuffers(e.effect),e.onApplyObservable.notifyObservers({})}saveStates(){this._savedStateDepthTest=this.engine.depthCullingState.depthTest,this._savedStateStencilTest=this.engine.stencilState.stencilTest}restoreStates(){this.engine.depthCullingState.depthTest=this._savedStateDepthTest,this.engine.stencilState.stencilTest=this._savedStateStencilTest}draw(){this.engine.drawElementsType(0,0,this._indexBufferLength)}_isRenderTargetTexture(e){return e.renderTarget!==void 0}render(e,t=null){if(!e.effect.isReady())return;this.saveStates(),this.setViewport();const i=t===null?null:this._isRenderTargetTexture(t)?t.renderTarget:t;i&&this.engine.bindFramebuffer(i),this.applyEffectWrapper(e),this.draw(),i&&this.engine.unBindFramebuffer(i),this.restoreStates()}dispose(){const e=this._vertexBuffers[b.PositionKind];e&&(e.dispose(),delete this._vertexBuffers[b.PositionKind]),this._indexBuffer&&this.engine._releaseBuffer(this._indexBuffer),this._onContextRestoredObserver&&(this.engine.onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null)}}class rt{static RegisterShaderCodeProcessing(e,t){if(!t){delete rt._CustomShaderCodeProcessing[e??""];return}rt._CustomShaderCodeProcessing[e??""]=t}static _GetShaderCodeProcessing(e){return rt._CustomShaderCodeProcessing[e]??rt._CustomShaderCodeProcessing[""]}get name(){return this.options.name}set name(e){this.options.name=e}isReady(){return this._drawWrapper.effect?.isReady()??!1}get drawWrapper(){return this._drawWrapper}get effect(){return this._drawWrapper.effect}set effect(e){this._drawWrapper.effect=e}constructor(e){this.alphaMode=0,this.onEffectCreatedObservable=new O(void 0,!0),this.onApplyObservable=new O,this._shadersLoaded=!1,this._webGPUReady=!1,this._importPromises=[],this.options={...e,name:e.name||"effectWrapper",engine:e.engine,uniforms:e.uniforms||e.uniformNames||[],uniformNames:void 0,samplers:e.samplers||e.samplerNames||[],samplerNames:void 0,attributeNames:e.attributeNames||["position"],uniformBuffers:e.uniformBuffers||[],defines:e.defines||"",useShaderStore:e.useShaderStore||!1,vertexUrl:e.vertexUrl||e.vertexShader||"postprocess",vertexShader:void 0,fragmentShader:e.fragmentShader||"pass",indexParameters:e.indexParameters,blockCompilation:e.blockCompilation||!1,shaderLanguage:e.shaderLanguage||0,onCompiled:e.onCompiled||void 0,extraInitializations:e.extraInitializations||void 0,extraInitializationsAsync:e.extraInitializationsAsync||void 0,useAsPostProcess:e.useAsPostProcess??!1,allowEmptySourceTexture:e.allowEmptySourceTexture??!1},this.options.uniformNames=this.options.uniforms,this.options.samplerNames=this.options.samplers,this.options.vertexShader=this.options.vertexUrl,this.options.useAsPostProcess&&(!this.options.allowEmptySourceTexture&&this.options.samplers.indexOf("textureSampler")===-1&&this.options.samplers.push("textureSampler"),this.options.uniforms.indexOf("scale")===-1&&this.options.uniforms.push("scale")),e.vertexUrl||e.vertexShader?this._shaderPath={vertexSource:this.options.vertexShader}:(this.options.useAsPostProcess||(this.options.uniforms.push("scale"),this.onApplyObservable.add(()=>{this.effect.setFloat2("scale",1,1)})),this._shaderPath={vertex:this.options.vertexShader}),this._shaderPath.fragmentSource=this.options.fragmentShader,this._shaderPath.spectorName=this.options.name,this.options.useShaderStore&&(this._shaderPath.fragment=this._shaderPath.fragmentSource,this._shaderPath.vertex||(this._shaderPath.vertex=this._shaderPath.vertexSource),delete this._shaderPath.fragmentSource,delete this._shaderPath.vertexSource),this.onApplyObservable.add(()=>{this.bind()}),this.options.useShaderStore||(this._onContextRestoredObserver=this.options.engine.onContextRestoredObservable.add(()=>{this.effect._pipelineContext=null,this.effect._prepareEffect()})),this._drawWrapper=new kn(this.options.engine),this._webGPUReady=this.options.shaderLanguage===1;const t=Array.isArray(this.options.defines)?this.options.defines.join(` +`):this.options.defines;this._postConstructor(this.options.blockCompilation,t,this.options.extraInitializations)}_gatherImports(e=!1,t){this.options.useAsPostProcess&&(e&&this._webGPUReady?t.push(Promise.all([G(()=>import("./postprocess.vertex-Be8DwgEx.js"),__vite__mapDeps([39,13,14]),import.meta.url)])):t.push(Promise.all([G(()=>Promise.resolve().then(()=>Fh),void 0,import.meta.url)])))}_postConstructor(e,t=null,i,s){this._importPromises.length=0,s&&this._importPromises.push(...s);const r=this.options.engine.isWebGPU&&!rt.ForceGLSL;this._gatherImports(r,this._importPromises),i!==void 0&&i(r,this._importPromises),r&&this._webGPUReady&&(this.options.shaderLanguage=1),e||this.updateEffect(t)}updateEffect(e=null,t=null,i=null,s,r,n,o,h){const l=rt._GetShaderCodeProcessing(this.name);if(l?.defineCustomBindings){const f=t?.slice()??[];f.push(...this.options.uniforms);const d=i?.slice()??[];d.push(...this.options.samplers),e=l.defineCustomBindings(this.name,e,f,d),t=f,i=d}this.options.defines=e||"";const c=this._shadersLoaded||this._importPromises.length===0?void 0:async()=>{await Promise.all(this._importPromises),this._shadersLoaded=!0};let u;this.options.extraInitializationsAsync?u=async()=>{c?.(),await this.options.extraInitializationsAsync()}:u=c,this.options.useShaderStore?this._drawWrapper.effect=this.options.engine.createEffect({vertex:o??this._shaderPath.vertex,fragment:h??this._shaderPath.fragment},{attributes:this.options.attributeNames,uniformsNames:t||this.options.uniforms,uniformBuffersNames:this.options.uniformBuffers,samplers:i||this.options.samplers,defines:e!==null?e:"",fallbacks:null,onCompiled:r??this.options.onCompiled,onError:n??null,indexParameters:s||this.options.indexParameters,processCodeAfterIncludes:l?.processCodeAfterIncludes?(f,d)=>l.processCodeAfterIncludes(this.name,f,d):null,processFinalCode:l?.processFinalCode?(f,d)=>l.processFinalCode(this.name,f,d):null,shaderLanguage:this.options.shaderLanguage,extraInitializationsAsync:u},this.options.engine):this._drawWrapper.effect=new ze(this._shaderPath,this.options.attributeNames,t||this.options.uniforms,i||this.options.samplerNames,this.options.engine,e,void 0,r||this.options.onCompiled,void 0,void 0,void 0,this.options.shaderLanguage,u),this.onEffectCreatedObservable.notifyObservers(this._drawWrapper.effect)}bind(e=!1){this.options.useAsPostProcess&&!e&&(this.options.engine.setAlphaMode(this.alphaMode),this.drawWrapper.effect.setFloat2("scale",1,1)),rt._GetShaderCodeProcessing(this.name)?.bindCustomBindings?.(this.name,this._drawWrapper.effect)}dispose(e=!1){this._onContextRestoredObserver&&(this.effect.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null),this.onEffectCreatedObservable.clear(),this._drawWrapper.dispose(!0)}}rt.ForceGLSL=!1;rt._CustomShaderCodeProcessing={};H.prototype.setTextureFromPostProcess=function(a,e,t){let i=null;e&&(e._forcedOutputTexture?i=e._forcedOutputTexture:e._textures.data[e._currentRenderTextureInd]&&(i=e._textures.data[e._currentRenderTextureInd])),this._bindTexture(a,i?.texture??null,t)};H.prototype.setTextureFromPostProcessOutput=function(a,e,t){this._bindTexture(a,e?._outputTexture?.texture??null,t)};ze.prototype.setTextureFromPostProcess=function(a,e){this._engine.setTextureFromPostProcess(this._samplers[a],e,a)};ze.prototype.setTextureFromPostProcessOutput=function(a,e){this._engine.setTextureFromPostProcessOutput(this._samplers[a],e,a)};class je{static get ForceGLSL(){return rt.ForceGLSL}static set ForceGLSL(e){rt.ForceGLSL=e}static RegisterShaderCodeProcessing(e,t){rt.RegisterShaderCodeProcessing(e,t)}get name(){return this._effectWrapper.name}set name(e){this._effectWrapper.name=e}get alphaMode(){return this._effectWrapper.alphaMode}set alphaMode(e){this._effectWrapper.alphaMode=e}get samples(){return this._samples}set samples(e){this._samples=Math.min(e,this._engine.getCaps().maxMSAASamples),this._textures.forEach(t=>{t.setSamples(this._samples)})}get shaderLanguage(){return this._shaderLanguage}getEffectName(){return this._fragmentUrl}set onActivate(e){this._onActivateObserver&&this.onActivateObservable.remove(this._onActivateObserver),e&&(this._onActivateObserver=this.onActivateObservable.add(e))}set onSizeChanged(e){this._onSizeChangedObserver&&this.onSizeChangedObservable.remove(this._onSizeChangedObserver),this._onSizeChangedObserver=this.onSizeChangedObservable.add(e)}set onApply(e){this._onApplyObserver&&this.onApplyObservable.remove(this._onApplyObserver),this._onApplyObserver=this.onApplyObservable.add(e)}set onBeforeRender(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)}set onAfterRender(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)}get inputTexture(){return this._textures.data[this._currentRenderTextureInd]}set inputTexture(e){this._forcedOutputTexture=e}restoreDefaultInputTexture(){this._forcedOutputTexture&&(this._forcedOutputTexture=null,this.markTextureDirty())}getCamera(){return this._camera}get texelSize(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.texelSize:(this._forcedOutputTexture&&this._texelSize.copyFromFloats(1/this._forcedOutputTexture.width,1/this._forcedOutputTexture.height),this._texelSize)}constructor(e,t,i,s,r,n,o=1,h,l,c=null,u=0,f="postprocess",d,g=!1,p=5,m,A){this._parentContainer=null,this.width=-1,this.height=-1,this.nodeMaterialSource=null,this._outputTexture=null,this.autoClear=!0,this.forceAutoClearInAlphaMode=!1,this.animations=[],this.enablePixelPerfectMode=!1,this.forceFullscreenViewport=!0,this.scaleMode=1,this.alwaysForcePOT=!1,this._samples=1,this.adaptScaleToCurrentViewport=!1,this.doNotSerialize=!1,this._webGPUReady=!1,this._reusable=!1,this._renderId=0,this.externalTextureSamplerBinding=!1,this._textures=new it(2),this._textureCache=[],this._currentRenderTextureInd=0,this._scaleRatio=new Q(1,1),this._texelSize=Q.Zero(),this.onActivateObservable=new O,this.onSizeChangedObservable=new O,this.onApplyObservable=new O,this.onBeforeRenderObservable=new O,this.onAfterRenderObservable=new O,this.onDisposeObservable=new O;let E=1,I=null,M;if(i&&!Array.isArray(i)){const C=i;i=C.uniforms??null,s=C.samplers??null,E=C.size??1,n=C.camera??null,o=C.samplingMode??1,h=C.engine,l=C.reusable,c=Array.isArray(C.defines)?C.defines.join(` +`):C.defines??null,u=C.textureType??0,f=C.vertexUrl??"postprocess",d=C.indexParameters,g=C.blockCompilation??!1,p=C.textureFormat??5,m=C.shaderLanguage??0,I=C.uniformBuffers??null,A=C.extraInitializations,M=C.effectWrapper}else r&&(typeof r=="number"?E=r:E={width:r.width,height:r.height});if(this._useExistingThinPostProcess=!!M,this._effectWrapper=M??new rt({name:e,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:t,engine:h||n?.getScene().getEngine(),uniforms:i,samplers:s,uniformBuffers:I,defines:c,vertexUrl:f,indexParameters:d,blockCompilation:!0,shaderLanguage:m,extraInitializations:void 0}),this.name=e,this.onEffectCreatedObservable=this._effectWrapper.onEffectCreatedObservable,n!=null?(this._camera=n,this._scene=n.getScene(),n.attachPostProcess(this),this._engine=this._scene.getEngine(),this._scene.addPostProcess(this),this.uniqueId=this._scene.getUniqueId()):h&&(this._engine=h,this._engine.postProcesses.push(this)),this._options=E,this.renderTargetSamplingMode=o||1,this._reusable=l||!1,this._textureType=u,this._textureFormat=p,this._shaderLanguage=m||0,this._samplers=s||[],this._samplers.indexOf("textureSampler")===-1&&this._samplers.push("textureSampler"),this._fragmentUrl=t,this._vertexUrl=f,this._parameters=i||[],this._parameters.indexOf("scale")===-1&&this._parameters.push("scale"),this._uniformBuffers=I||[],this._indexParameters=d,!this._useExistingThinPostProcess){this._webGPUReady=this._shaderLanguage===1;const C=[];this._gatherImports(this._engine.isWebGPU&&!je.ForceGLSL,C),this._effectWrapper._webGPUReady=this._webGPUReady,this._effectWrapper._postConstructor(g,c,A,C)}}_gatherImports(e=!1,t){e&&this._webGPUReady?t.push(Promise.all([G(()=>import("./postprocess.vertex-Be8DwgEx.js"),__vite__mapDeps([39,13,14]),import.meta.url)])):t.push(Promise.all([G(()=>Promise.resolve().then(()=>Fh),void 0,import.meta.url)]))}getClassName(){return"PostProcess"}getEngine(){return this._engine}getEffect(){return this._effectWrapper.drawWrapper.effect}shareOutputWith(e){return this._disposeTextures(),this._shareOutputWithPostProcess=e,this}useOwnOutput(){this._textures.length==0&&(this._textures=new it(2)),this._shareOutputWithPostProcess=null}updateEffect(e=null,t=null,i=null,s,r,n,o,h){this._effectWrapper.updateEffect(e,t,i,s,r,n,o,h),this._postProcessDefines=Array.isArray(this._effectWrapper.options.defines)?this._effectWrapper.options.defines.join(` +`):this._effectWrapper.options.defines}isReusable(){return this._reusable}markTextureDirty(){this.width=-1}_createRenderTargetTexture(e,t,i=0){for(let r=0;r=0;t--)if(e-this._textureCache[t].lastUsedRenderId>100){let i=!1;for(let s=0;s0&&this._textures.reset(),this.width=e,this.height=t;let n=null;if(i){for(let l=0;l{g.samples!==this.samples&&this._engine.updateRenderTargetTextureSampleCount(g,this.samples)}),this._flushTextureCache(),this._renderId++}return d||(d=this._getTarget()),this.enablePixelPerfectMode?(this._scaleRatio.copyFromFloats(h/c,l/u),this._engine.bindFramebuffer(d,0,h,l,this.forceFullscreenViewport)):(this._scaleRatio.copyFromFloats(1,1),this._engine.bindFramebuffer(d,0,void 0,void 0,this.forceFullscreenViewport)),this._engine._debugInsertMarker?.(`post process ${this.name} input`),this.onActivateObservable.notifyObservers(s),this.autoClear&&(this.alphaMode===0||this.forceAutoClearInAlphaMode)&&this._engine.clear(this.clearColor?this.clearColor:r.clearColor,r._allowPostProcessClearColor,!0,!0),this._reusable&&(this._currentRenderTextureInd=(this._currentRenderTextureInd+1)%2),d}get isSupported(){return this._effectWrapper.drawWrapper.effect.isSupported}get aspectRatio(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.aspectRatio:this._forcedOutputTexture?this._forcedOutputTexture.width/this._forcedOutputTexture.height:this.width/this.height}isReady(){return this._effectWrapper.isReady()}apply(){if(!this._effectWrapper.isReady())return null;this._engine.enableEffect(this._effectWrapper.drawWrapper),this._engine.setState(!1),this._engine.setDepthBuffer(!1),this._engine.setDepthWrite(!1),this.alphaConstants&&this.getEngine().setAlphaConstants(this.alphaConstants.r,this.alphaConstants.g,this.alphaConstants.b,this.alphaConstants.a),this._engine.setAlphaMode(this.alphaMode);let e;return this._shareOutputWithPostProcess?e=this._shareOutputWithPostProcess.inputTexture:this._forcedOutputTexture?e=this._forcedOutputTexture:e=this.inputTexture,this.externalTextureSamplerBinding||this._effectWrapper.drawWrapper.effect._bindTexture("textureSampler",e?.texture),this._effectWrapper.drawWrapper.effect.setVector2("scale",this._scaleRatio),this.onApplyObservable.notifyObservers(this._effectWrapper.drawWrapper.effect),this._effectWrapper.bind(!0),this._effectWrapper.drawWrapper.effect}_disposeTextures(){if(this._shareOutputWithPostProcess||this._forcedOutputTexture){this._disposeTextureCache();return}this._disposeTextureCache(),this._textures.dispose()}_disposeTextureCache(){for(let e=this._textureCache.length-1;e>=0;e--)this._textureCache[e].texture.dispose();this._textureCache.length=0}setPrePassRenderer(e){return this._prePassEffectConfiguration?(this._prePassEffectConfiguration=e.addEffectConfiguration(this._prePassEffectConfiguration),this._prePassEffectConfiguration.enabled=!0,!0):!1}dispose(e){e=e||this._camera,this._useExistingThinPostProcess||this._effectWrapper.dispose(),this._disposeTextures();let t;if(this._scene&&(t=this._scene.removePostProcess(this)),this._parentContainer){const i=this._parentContainer.postProcesses.indexOf(this);i>-1&&this._parentContainer.postProcesses.splice(i,1),this._parentContainer=null}if(t=this._engine.postProcesses.indexOf(this),t!==-1&&this._engine.postProcesses.splice(t,1),this.onDisposeObservable.notifyObservers(),!!e){if(e.detachPostProcess(this),t=e._postProcesses.indexOf(this),t===0&&e._postProcesses.length>0){const i=this._camera._getFirstPostProcess();i&&i.markTextureDirty()}this.onActivateObservable.clear(),this.onAfterRenderObservable.clear(),this.onApplyObservable.clear(),this.onBeforeRenderObservable.clear(),this.onSizeChangedObservable.clear(),this.onEffectCreatedObservable.clear()}}serialize(){const e=le.Serialize(this),t=this.getCamera()||this._scene&&this._scene.activeCamera;return e.customType="BABYLON."+this.getClassName(),e.cameraId=t?t.id:null,e.reusable=this._reusable,e.textureType=this._textureType,e.fragmentUrl=this._fragmentUrl,e.parameters=this._parameters,e.samplers=this._samplers,e.uniformBuffers=this._uniformBuffers,e.options=this._options,e.defines=this._postProcessDefines,e.textureFormat=this._textureFormat,e.vertexUrl=this._vertexUrl,e.indexParameters=this._indexParameters,e}clone(){const e=this.serialize();e._engine=this._engine,e.cameraId=null;const t=je.Parse(e,this._scene,"");return t?(t.onActivateObservable=this.onActivateObservable.clone(),t.onSizeChangedObservable=this.onSizeChangedObservable.clone(),t.onApplyObservable=this.onApplyObservable.clone(),t.onBeforeRenderObservable=this.onBeforeRenderObservable.clone(),t.onAfterRenderObservable=this.onAfterRenderObservable.clone(),t._prePassEffectConfiguration=this._prePassEffectConfiguration,t):null}static Parse(e,t,i){const s=Oi(e.customType);if(!s||!s._Parse)return null;const r=t?t.getCameraById(e.cameraId):null;return s._Parse(e,r,t,i)}static _Parse(e,t,i,s){return le.Parse(()=>new je(e.name,e.fragmentUrl,e.parameters,e.samplers,e.options,t,e.renderTargetSamplingMode,e._engine,e.reusable,e.defines,e.textureType,e.vertexUrl,e.indexParameters,!1,e.textureFormat),e,i,s)}}T([R()],je.prototype,"uniqueId",void 0);T([R()],je.prototype,"name",null);T([R()],je.prototype,"width",void 0);T([R()],je.prototype,"height",void 0);T([R()],je.prototype,"renderTargetSamplingMode",void 0);T([fo()],je.prototype,"clearColor",void 0);T([R()],je.prototype,"autoClear",void 0);T([R()],je.prototype,"forceAutoClearInAlphaMode",void 0);T([R()],je.prototype,"alphaMode",null);T([R()],je.prototype,"alphaConstants",void 0);T([R()],je.prototype,"enablePixelPerfectMode",void 0);T([R()],je.prototype,"forceFullscreenViewport",void 0);T([R()],je.prototype,"scaleMode",void 0);T([R()],je.prototype,"alwaysForcePOT",void 0);T([R("samples")],je.prototype,"_samples",void 0);T([R()],je.prototype,"adaptScaleToCurrentViewport",void 0);nt("BABYLON.PostProcess",je);class Kt{get renderList(){return this._renderList}set renderList(e){this._renderList!==e&&(this._unObserveRenderList&&(this._unObserveRenderList(),this._unObserveRenderList=null),e&&(this._unObserveRenderList=_o(e,this._renderListHasChanged)),this._renderList=e)}get disableImageProcessing(){return this._disableImageProcessing}set disableImageProcessing(e){e!==this._disableImageProcessing&&(this._disableImageProcessing=e,this._scene.markAllMaterialsAsDirty(64))}get disableDepthPrePass(){return this._disableDepthPrePass}set disableDepthPrePass(e){this._disableDepthPrePass=e,this._renderingManager.disableDepthPrePass=e}get name(){return this._name}set name(e){if(this._name!==e){if(this._name=e,this._sceneUBOs)for(let t=0;tthis._checkReadiness(),()=>{if(this._freezeActiveMeshesCancel=null,e)for(let t=0;t{this._freezeActiveMeshesCancel=null,i?(w.Error("ObjectRenderer: Timeout while waiting for the renderer to be ready."),t&&w.Error(t)):(w.Error("ObjectRenderer: An unexpected error occurred while waiting for the renderer to be ready."),t&&(w.Error(t),t.stack&&w.Error(t.stack)))})}_unfreezeActiveMeshes(){this._freezeActiveMeshesCancel?.(),this._freezeActiveMeshesCancel=null;for(let e=0;e{const n=this._renderList?this._renderList.length:0;if(r===0&&n>0||n===0)for(const o of this._scene.meshes)o._markSubMeshesAsLightDirty()},this.particleSystemList=null,this.getCustomRenderList=null,this.renderMeshes=!0,this.renderDepthOnlyMeshes=!0,this.renderOpaqueMeshes=!0,this.renderAlphaTestMeshes=!0,this.renderTransparentMeshes=!0,this.renderParticles=!0,this.renderSprites=!1,this.forceLayerMaskCheck=!1,this.enableBoundingBoxRendering=!1,this.enableOutlineRendering=!0,this._disableImageProcessing=!1,this.dontSetTransformationMatrix=!1,this._disableDepthPrePass=!1,this.onBeforeRenderObservable=new O,this.onAfterRenderObservable=new O,this.onBeforeRenderingManagerRenderObservable=new O,this.onAfterRenderingManagerRenderObservable=new O,this.onInitRenderingObservable=new O,this.onFinishRenderingObservable=new O,this.onFastPathRenderObservable=new O,this._currentRefreshId=-1,this._refreshRate=1,this._currentApplyByPostProcessSetting=!1,this._activeMeshes=new it(256),this._activeBoundingBoxes=new it(32),this._currentFrameId=-1,this._currentSceneUBOIndex=0,this._isFrozen=!1,this._freezeActiveMeshesCancel=null,this._currentSceneCamera=null,this.name=e,this._scene=t,this._engine=this._scene.getEngine(),this._useUBO=this._engine.supportsUniformBuffers,this._useUBO&&(this._sceneUBOs=[],this._createSceneUBO()),this.renderList=[],this._renderPassIds=[],this.options={numPasses:1,doNotChangeAspectRatio:!0,enableClusteredLights:!1,...i},this._createRenderPassId(),this.renderPassId=this._renderPassIds[0],this._renderingManager=new ct(t),this._renderingManager._useSceneAutoClearSetup=!0,this.options.enableClusteredLights&&this.onInitRenderingObservable.add(()=>{for(const s of this._scene.lights)s.getTypeID()===Ee.LIGHTTYPEID_CLUSTERED_CONTAINER&&s.isSupported&&s._updateBatches(this.activeCamera).render()}),this._scene.addObjectRenderer(this)}_releaseRenderPassId(){for(let e=0;e=this._sceneUBOs.length&&this._createSceneUBO();const e=this._sceneUBOs[this._currentSceneUBOIndex++];return e.unbindEffect(),e}resetRefreshCounter(){this._currentRefreshId=-1}get refreshRate(){return this._refreshRate}set refreshRate(e){this._refreshRate=e,this.resetRefreshCounter()}shouldRender(){return this._currentRefreshId===-1?(this._currentRefreshId=1,!0):this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)}isReadyForRendering(e,t){this.prepareRenderList(),this.initRender(e,t);const i=this._checkReadiness();return this.finishRender(),i}prepareRenderList(){const e=this._scene;if(this._waitingRenderList){if(!this.renderListPredicate){this.renderList=[];for(let t=0;t1&&(e.incrementRenderId(),e.resetCachedMaterial())}const r=this.particleSystemList||e.particleSystems;for(const n of r)n.isReady()||(i=!1);return this._engine.currentRenderPassId=t,i}_prepareRenderingManager(e=0,t=!1){const i=this._scene;let s=null,r=0,n=!1;const o=this.renderList?this.renderList:i.frameGraph?i.meshes:i.getActiveMeshes().data,h=this.renderList?this.renderList.length:i.frameGraph?i.meshes.length:i.getActiveMeshes().length;if(this.getCustomRenderList&&(s=this.getCustomRenderList(e,o,h)),s)r=s.length,n=this.forceLayerMaskCheck;else{if(this._defaultRenderListPrepared&&!t)return o;this._defaultRenderListPrepared=!0,s=o,r=h,n=!this.renderList||this.forceLayerMaskCheck}const l=i.activeCamera,c=this.cameraForLOD??l,u=i.getBoundingBoxRenderer?.();if(i._activeMeshesFrozen&&this._isFrozen){if(this._renderingManager.resetSprites(),this.enableBoundingBoxRendering&&u){u.reset();for(let f=0;f{if(!this._disableEngineStages)for(const S of this._scene._beforeRenderTargetClearStage)S.action(this,this._currentFaceIndex,this._currentLayer);if(this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(x):this.skipInitialClear||x.clear(this.clearColor||this._scene.clearColor,!0,!0,!0),this._doNotChangeAspectRatio||this._scene.updateTransformMatrix(!0),!this._disableEngineStages)for(const S of this._scene._beforeRenderTargetDrawStage)S.action(this,this._currentFaceIndex,this._currentLayer);x._debugPushGroup?.(`Render to ${this.name} (face #${this._currentFaceIndex} layer #${this._currentLayer})`)}),this._onAfterRenderingManagerRenderObserver=this._objectRenderer.onAfterRenderingManagerRenderObservable.add(()=>{if(x._debugPopGroup?.(),!this._disableEngineStages)for(const L of this._scene._afterRenderTargetDrawStage)L.action(this,this._currentFaceIndex,this._currentLayer);const S=this._texture?.generateMipMaps??!1;if(this._texture&&(this._texture.generateMipMaps=!1),this._postProcessManager?this._postProcessManager._finalizeFrame(!1,this._renderTarget??void 0,this._currentFaceIndex,this._postProcesses,this.ignoreCameraViewport):this._currentUseCameraPostProcess&&this._scene.postProcessManager._finalizeFrame(!1,this._renderTarget??void 0,this._currentFaceIndex),!this._disableEngineStages)for(const L of this._scene._afterRenderTargetPostProcessStage)L.action(this,this._currentFaceIndex,this._currentLayer);this._texture&&(this._texture.generateMipMaps=S),this._doNotChangeAspectRatio||this._scene.updateTransformMatrix(!0),this._currentDumpForDebug&&(this._dumpTools?this._dumpTools.DumpFramebuffer(this.getRenderWidth(),this.getRenderHeight(),x):w.Error("dumpTools module is still being loaded. To speed up the process import dump tools directly in your project"))}),this._onFastPathRenderObserver=this._objectRenderer.onFastPathRenderObservable.add(()=>{this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(x):this.skipInitialClear||x.clear(this.clearColor||this._scene.clearColor,!0,!0,!0)}),this._resizeObserver=x.onResizeObservable.add(()=>{}),this._generateMipMaps=!!s,this._doNotChangeAspectRatio=r,!u&&(this._renderTargetOptions={generateMipMaps:s,type:n,format:this._format??void 0,samplingMode:this.samplingMode,generateDepthBuffer:l,generateStencilBuffer:c,samples:g,creationFlags:p,noColorAttachment:m,useSRGBBuffer:A,colorAttachment:E,label:this.name},this.samplingMode===z.NEAREST_SAMPLINGMODE&&(this.wrapU=z.CLAMP_ADDRESSMODE,this.wrapV=z.CLAMP_ADDRESSMODE),d||(o?(this._renderTarget=i.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions),this.coordinatesMode=z.INVCUBIC_MODE,this._textureMatrix=P.Identity()):this._renderTarget=i.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions),this._texture=this._renderTarget.texture,g!==void 0&&(this.samples=g)))}createDepthStencilTexture(e=0,t=!0,i=!1,s=1,r=14,n){this._renderTarget?.createDepthStencilTexture(e,t,i,s,r,n)}_processSizeParameter(e){if(e.ratio){this._sizeRatio=e.ratio;const t=this._getEngine();this._size={width:this._bestReflectionRenderTargetDimension(t.getRenderWidth(),this._sizeRatio),height:this._bestReflectionRenderTargetDimension(t.getRenderHeight(),this._sizeRatio)}}else this._size=e}get samples(){return this._renderTarget?.samples??this._samples}set samples(e){this._renderTarget&&(this._samples=this._renderTarget.setSamples(e))}addPostProcess(e){if(!this._postProcessManager){const t=this.getScene();if(!t)return;this._postProcessManager=new Rn(t),this._postProcesses=new Array}this._postProcesses.push(e),this._postProcesses[0].autoClear=!1}clearPostProcesses(e=!1){if(this._postProcesses){if(e)for(const t of this._postProcesses)t.dispose();this._postProcesses=[]}}removePostProcess(e){if(!this._postProcesses)return;const t=this._postProcesses.indexOf(e);t!==-1&&(this._postProcesses.splice(t,1),this._postProcesses.length>0&&(this._postProcesses[0].autoClear=!1))}resetRefreshCounter(){this._objectRenderer.resetRefreshCounter()}get refreshRate(){return this._objectRenderer.refreshRate}set refreshRate(e){this._objectRenderer.refreshRate=e}_shouldRender(){return this._objectRenderer.shouldRender()}getRenderSize(){return this.getRenderWidth()}getRenderWidth(){return this._size.width?this._size.width:this._size}getRenderHeight(){return this._size.width?this._size.height:this._size}getRenderLayers(){const e=this._size.layers;if(e)return e;const t=this._size.depth;return t||0}disableRescaling(){this._canRescale=!1}get canRescale(){return this._canRescale}scale(e){const t=Math.max(1,this.getRenderSize()*e);this.resize(t)}getReflectionTextureMatrix(){return this.isCube?this._textureMatrix:super.getReflectionTextureMatrix()}resize(e){const t=this.isCube;this._renderTarget?.dispose(),this._renderTarget=null;const i=this.getScene();i&&(this._processSizeParameter(e),t?this._renderTarget=i.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions):this._renderTarget=i.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions),this._texture=this._renderTarget.texture,this._renderTargetOptions.samples!==void 0&&(this.samples=this._renderTargetOptions.samples),this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this))}render(e=!1,t=!1){this._render(e,t)}isReadyForRendering(){this._dumpToolsLoading||(this._dumpToolsLoading=!0,G(()=>import("./dumpTools-C3pGK_mZ.js"),__vite__mapDeps([40,13,14]),import.meta.url).then(t=>this._dumpTools=t)),this._objectRenderer.prepareRenderList(),this.onBeforeBindObservable.notifyObservers(this),this._objectRenderer.initRender(this.getRenderWidth(),this.getRenderHeight());const e=this._objectRenderer._checkReadiness();return this.onAfterUnbindObservable.notifyObservers(this),this._objectRenderer.finishRender(),e}_render(e=!1,t=!1){const i=this.getScene();if(i){if(this.useCameraPostProcesses!==void 0&&(e=this.useCameraPostProcesses),this._objectRenderer.prepareRenderList(),this.onBeforeBindObservable.notifyObservers(this),this._objectRenderer.initRender(this.getRenderWidth(),this.getRenderHeight()),(this.is2DArray||this.is3D)&&!this.isMulti)for(let s=0;s{this.onAfterRenderObservable.notifyObservers(t)})}_prepareFrame(e,t,i,s){this._postProcessManager?this._prePassEnabled||this._postProcessManager._prepareFrame(this._texture,this._postProcesses)||this._bindFrameBuffer(t,i):(!s||!e.postProcessManager._prepareFrame(this._texture))&&this._bindFrameBuffer(t,i)}_renderToTarget(e,t,i,s=0){const r=this.getScene();if(!r)return;const n=r.getEngine();this._currentFaceIndex=e,this._currentLayer=s,this._currentUseCameraPostProcess=t,this._currentDumpForDebug=i,this._prepareFrame(r,e,s,t),this._objectRenderer.render(e+s,!0),this._unbindFrameBuffer(n,e),this._texture&&this.isCube&&e===5&&n.generateMipMapsForCubemap(this._texture,!0)}setRenderingOrder(e,t=null,i=null,s=null){this._objectRenderer.setRenderingOrder(e,t,i,s)}setRenderingAutoClearDepthStencil(e,t){this._objectRenderer.setRenderingAutoClearDepthStencil(e,t)}clone(){const e=this.getSize(),t=new Bi(this.name,e,this.getScene(),this._renderTargetOptions.generateMipMaps,this._doNotChangeAspectRatio,this._renderTargetOptions.type,this.isCube,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer,this._renderTargetOptions.generateStencilBuffer,void 0,this._renderTargetOptions.format,void 0,this._renderTargetOptions.samples);return t.hasAlpha=this.hasAlpha,t.level=this.level,t.coordinatesMode=this.coordinatesMode,this.renderList&&(t.renderList=this.renderList.slice(0)),t}serialize(){if(!this.name)return null;const e=super.serialize();if(e.renderTargetSize=this.getRenderSize(),e.renderList=[],this.renderList)for(let t=0;t=0&&e.customRenderTargets.splice(t,1);for(const i of e.cameras)t=i.customRenderTargets.indexOf(this),t>=0&&i.customRenderTargets.splice(t,1);this._renderTarget?.dispose(),this._renderTarget=null,this._texture=null,super.dispose()}_rebuild(){this._objectRenderer._rebuild(),this._postProcessManager&&this._postProcessManager._rebuild()}freeRenderingGroups(){this._objectRenderer.freeRenderingGroups()}getViewCount(){return 1}}Bi.REFRESHRATE_RENDER_ONCE=Kt.REFRESHRATE_RENDER_ONCE;Bi.REFRESHRATE_RENDER_ONEVERYFRAME=Kt.REFRESHRATE_RENDER_ONEVERYFRAME;Bi.REFRESHRATE_RENDER_ONEVERYTWOFRAMES=Kt.REFRESHRATE_RENDER_ONEVERYTWOFRAMES;z._CreateRenderTargetTexture=(a,e,t,i,s)=>new Bi(a,e,t,i);const Ju=Object.freeze(Object.defineProperty({__proto__:null,RenderTargetTexture:Bi},Symbol.toStringTag,{value:"Module"}));class ed{constructor(){this.shaderLanguage=0}postProcessor(e,t,i,s,r){if(r.drawBuffersExtensionDisabled){const n=/#extension.+GL_EXT_draw_buffers.+(enable|require)/g;e=e.replace(n,"")}return e}}const td=/(flat\s)?\s*varying\s*.*/;class id{constructor(){this.shaderLanguage=0}attributeProcessor(e){return e.replace("attribute","in")}varyingCheck(e,t){return td.test(e)}varyingProcessor(e,t){return e.replace("varying",t?"in":"out")}postProcessor(e,t,i){const s=e.search(/#extension.+GL_EXT_draw_buffers.+require/)!==-1,r=/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;if(e=e.replace(r,""),e=e.replace(/texture2D\s*\(/g,"texture("),i){const n=e.search(/layout *\(location *= *0\) *out/g)!==-1,o=t.indexOf("#define DUAL_SOURCE_BLENDING")!==-1,h=o?`layout(location = 0, index = 0) out vec4 glFragColor; +layout(location = 0, index = 1) out vec4 glFragColor2; +`:`layout(location = 0) out vec4 glFragColor; +`;o&&(e=`#extension GL_EXT_blend_func_extended : require +`+e),e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod("),e=e.replace(/textureCubeLodEXT\s*\(/g,"textureLod("),e=e.replace(/textureCube\s*\(/g,"texture("),e=e.replace(/gl_FragDepthEXT/g,"gl_FragDepth"),e=e.replace(/gl_FragColor/g,"glFragColor"),e=e.replace(/gl_FragData/g,"glFragData"),e=e.replace(/void\s+?main\s*\(/g,(s||n?"":h)+"void main(")}else if(t.indexOf("#define VERTEXOUTPUT_INVARIANT")>=0&&(e=`invariant gl_Position; +`+e),t.indexOf("#define MULTIVIEW")!==-1)return`#extension GL_OVR_multiview2 : require +layout (num_views = 2) in; +`+e;return e}}class Ys extends ir{constructor(e){super(),this._buffer=e}get underlyingResource(){return this._buffer}}class wh{get underlyingResource(){return this._webGLTexture}constructor(e=null,t){if(this._MSAARenderBuffers=null,this._context=t,!e&&(e=t.createTexture(),!e))throw new Error("Unable to create webGL texture");this.set(e)}setUsage(){}set(e){this._webGLTexture=e}reset(){this._webGLTexture=null,this._MSAARenderBuffers=null}addMSAARenderBuffer(e){this._MSAARenderBuffers||(this._MSAARenderBuffers=[]),this._MSAARenderBuffers.push(e)}releaseMSAARenderBuffers(){if(this._MSAARenderBuffers){for(const e of this._MSAARenderBuffers)this._context.deleteRenderbuffer(e);this._MSAARenderBuffers=null}}getMSAARenderBuffer(e=0){return this._MSAARenderBuffers?.[e]??null}release(){this.releaseMSAARenderBuffers(),this._webGLTexture&&this._context.deleteTexture(this._webGLTexture),this.reset()}}function xn(a){return a===13||a===14||a===15||a===16||a===17||a===18||a===19}function sd(a){switch(a){case 13:case 17:case 18:case 14:case 16:return 1;case 15:return 5;case 19:return 0}return 0}function bs(a){return a===13||a===17||a===18||a===19}class rd{}class he extends H{get name(){return this._name}set name(e){this._name=e}get version(){return this._webGLVersion}static get ShadersRepository(){return ze.ShadersRepository}static set ShadersRepository(e){ze.ShadersRepository=e}get supportsUniformBuffers(){return this.webGLVersion>1&&!this.disableUniformBuffers}get needPOTTextures(){return this._webGLVersion<2||this.forcePOTTextures}get _supportsHardwareTextureRescaling(){return!1}set framebufferDimensionsObject(e){this._framebufferDimensionsObject=e}snapshotRenderingReset(){this.snapshotRendering=!1}constructor(e,t,i,s){if(i=i||{},super(t??i.antialias,i,s),this._name="WebGL",this.forcePOTTextures=!1,this.validateShaderPrograms=!1,this.disableUniformBuffers=!1,this._webGLVersion=1,this._vertexAttribArraysEnabled=[],this._uintIndicesCurrentlySet=!1,this._currentBoundBuffer=new Array,this._currentFramebuffer=null,this._dummyFramebuffer=null,this._currentBufferPointers=new Array,this._currentInstanceLocations=new Array,this._currentInstanceBuffers=new Array,this._vaoRecordInProgress=!1,this._mustWipeVertexAttributes=!1,this._nextFreeTextureSlots=new Array,this._maxSimultaneousTextures=0,this._maxMSAASamplesOverride=null,this._unpackFlipYCached=null,this.enableUnpackFlipYCached=!0,this._boundUniforms={},!e)return;let r=null;if(e.getContext){if(r=e,i.preserveDrawingBuffer===void 0&&(i.preserveDrawingBuffer=!1),i.xrCompatible===void 0&&(i.xrCompatible=!1),navigator&&navigator.userAgent){this._setupMobileChecks();const h=navigator.userAgent;for(const l of he.ExceptionList){const c=l.key,u=l.targets;if(new RegExp(c).test(h)){if(l.capture&&l.captureConstraint){const d=l.capture,g=l.captureConstraint,m=new RegExp(d).exec(h);if(m&&m.length>0&&parseInt(m[m.length-1])>=g)continue}for(const d of u)switch(d){case"uniformBuffer":this.disableUniformBuffers=!0;break;case"vao":this.disableVertexArrayObjects=!0;break;case"antialias":i.antialias=!1;break;case"maxMSAASamples":this._maxMSAASamplesOverride=1;break}}}}if(this._doNotHandleContextLost?this._onContextLost=()=>{$r(this._gl)}:(this._onContextLost=h=>{h.preventDefault(),this._contextWasLost=!0,$r(this._gl),w.Warn("WebGL context lost."),this.onContextLostObservable.notifyObservers(this)},this._onContextRestored=()=>{this._restoreEngineAfterContextLost(()=>this._initGLContext())},r.addEventListener("webglcontextrestored",this._onContextRestored,!1),i.powerPreference=i.powerPreference||"high-performance"),r.addEventListener("webglcontextlost",this._onContextLost,!1),this._badDesktopOS&&(i.xrCompatible=!1),!i.disableWebGL2Support)try{this._gl=r.getContext("webgl2",i)||r.getContext("experimental-webgl2",i),this._gl&&(this._webGLVersion=2,this._shaderPlatformName="WEBGL2",this._gl.deleteQuery||(this._webGLVersion=1,this._shaderPlatformName="WEBGL1"))}catch{}if(!this._gl){if(!r)throw new Error("The provided canvas is null or undefined.");try{this._gl=r.getContext("webgl",i)||r.getContext("experimental-webgl",i)}catch{throw new Error("WebGL not supported")}}if(!this._gl)throw new Error("WebGL not supported")}else{this._gl=e,r=this._gl.canvas,this._gl.renderbufferStorageMultisample?(this._webGLVersion=2,this._shaderPlatformName="WEBGL2"):this._shaderPlatformName="WEBGL1";const h=this._gl.getContextAttributes();h&&(i.stencil=h.stencil)}this._sharedInit(r),this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),i.useHighPrecisionFloats!==void 0&&(this._highPrecisionShadersAllowed=i.useHighPrecisionFloats),this.resize(),this._initGLContext(),this._initFeatures();for(let h=0;h1?new id:new ed;const n=`Babylon.js v${he.Version}`;w.Log(n+` - ${this.description}`),this._renderingCanvas&&this._renderingCanvas.setAttribute&&this._renderingCanvas.setAttribute("data-engine",n);const o=Pt(this._gl);o.validateShaderPrograms=this.validateShaderPrograms,o.parallelShaderCompile=this._caps.parallelShaderCompile}_clearEmptyResources(){this._dummyFramebuffer=null,super._clearEmptyResources()}_getShaderProcessingContext(e){return null}areAllEffectsReady(){for(const e in this._compiledEffects)if(!this._compiledEffects[e].isReady())return!1;return!0}_initGLContext(){this._caps={maxTexturesImageUnits:this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),maxCombinedTexturesImageUnits:this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),maxSamples:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_SAMPLES):1,maxCubemapTextureSize:this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderTextureSize:this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),maxVertexAttribs:this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),maxVaryingVectors:this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),maxFragmentUniformVectors:this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),maxVertexUniformVectors:this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),shaderFloatPrecision:0,parallelShaderCompile:this._gl.getExtension("KHR_parallel_shader_compile")||void 0,standardDerivatives:this._webGLVersion>1||this._gl.getExtension("OES_standard_derivatives")!==null,maxAnisotropy:1,astc:this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),bptc:this._gl.getExtension("EXT_texture_compression_bptc")||this._gl.getExtension("WEBKIT_EXT_texture_compression_bptc"),s3tc:this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),s3tc_srgb:this._gl.getExtension("WEBGL_compressed_texture_s3tc_srgb")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc_srgb"),pvrtc:this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),etc2:this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),textureAnisotropicFilterExtension:this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),uintIndices:this._webGLVersion>1||this._gl.getExtension("OES_element_index_uint")!==null,fragmentDepthSupported:this._webGLVersion>1||this._gl.getExtension("EXT_frag_depth")!==null,highPrecisionShaderSupported:!1,timerQuery:this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),supportOcclusionQuery:this._webGLVersion>1,canUseTimestampForTimerQuery:!1,drawBuffersExtension:!1,maxMSAASamples:1,colorBufferFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_float")),blendFloat:this._gl.getExtension("EXT_float_blend")!==null,supportFloatTexturesResolve:!1,rg11b10ufColorRenderable:!1,colorBufferHalfFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_half_float")),textureFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_float")),textureHalfFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_half_float")),textureHalfFloatRender:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloatLinearFiltering:!1,vertexArrayObject:!1,instancedArrays:!1,textureLOD:!!(this._webGLVersion>1||this._gl.getExtension("EXT_shader_texture_lod")),texelFetch:this._webGLVersion!==1,blendMinMax:!1,multiview:this._gl.getExtension("OVR_multiview2"),oculusMultiview:this._gl.getExtension("OCULUS_multiview"),depthTextureExtension:!1,canUseGLInstanceID:this._webGLVersion>1,canUseGLVertexID:this._webGLVersion>1,supportComputeShaders:!1,supportSRGBBuffers:!1,supportTransformFeedbacks:this._webGLVersion>1,textureMaxLevel:this._webGLVersion>1,texture2DArrayMaxLayerCount:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_ARRAY_TEXTURE_LAYERS):128,disableMorphTargetTexture:!1,textureNorm16:!!this._gl.getExtension("EXT_texture_norm16"),blendParametersPerTarget:!1,dualSourceBlending:!1},this._caps.supportFloatTexturesResolve=this._caps.colorBufferFloat,this._caps.rg11b10ufColorRenderable=this._caps.colorBufferFloat,this._glVersion=this._gl.getParameter(this._gl.VERSION);const e=this._gl.getExtension("WEBGL_debug_renderer_info");e!=null&&(this._glRenderer=this._gl.getParameter(e.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(e.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor=this._gl.getParameter(this._gl.VENDOR)||"Unknown vendor"),this._glRenderer||(this._glRenderer=this._gl.getParameter(this._gl.RENDERER)||"Unknown renderer"),this._gl.HALF_FLOAT_OES!==36193&&(this._gl.HALF_FLOAT_OES=36193),this._gl.RGBA16F!==34842&&(this._gl.RGBA16F=34842),this._gl.RGBA32F!==34836&&(this._gl.RGBA32F=34836),this._gl.DEPTH24_STENCIL8!==35056&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.timerQuery&&(this._webGLVersion===1&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=(this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT)??0)>0),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.textureFloatLinearFiltering=!!(this._caps.textureFloat&&this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!!(this._caps.textureFloat&&this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloatLinearFiltering=!!(this._webGLVersion>1||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),this._caps.textureNorm16&&(this._gl.R16_EXT=33322,this._gl.RG16_EXT=33324,this._gl.RGB16_EXT=32852,this._gl.RGBA16_EXT=32859,this._gl.R16_SNORM_EXT=36760,this._gl.RG16_SNORM_EXT=36761,this._gl.RGB16_SNORM_EXT=36762,this._gl.RGBA16_SNORM_EXT=36763);const t=this._gl.getExtension("OES_draw_buffers_indexed");if(this._caps.blendParametersPerTarget=!!t,this._alphaState=new Lo(this._caps.blendParametersPerTarget),t&&(this._gl.blendEquationSeparateIndexed=t.blendEquationSeparateiOES.bind(t),this._gl.blendEquationIndexed=t.blendEquationiOES.bind(t),this._gl.blendFuncSeparateIndexed=t.blendFuncSeparateiOES.bind(t),this._gl.blendFuncIndexed=t.blendFunciOES.bind(t),this._gl.colorMaskIndexed=t.colorMaskiOES.bind(t),this._gl.disableIndexed=t.disableiOES.bind(t),this._gl.enableIndexed=t.enableiOES.bind(t)),this._caps.dualSourceBlending=!!this._gl.getExtension("WEBGL_blend_func_extended"),this._caps.astc&&(this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR),this._caps.bptc&&(this._gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=this._caps.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT),this._caps.s3tc_srgb&&(this._gl.COMPRESSED_SRGB_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT),this._caps.etc2&&(this._gl.COMPRESSED_SRGB8_ETC2=this._caps.etc2.COMPRESSED_SRGB8_ETC2,this._gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=this._caps.etc2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC),this._webGLVersion>1&&this._gl.HALF_FLOAT_OES!==5131&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),this._webGLVersion>1)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=this._maxMSAASamplesOverride!==null?this._maxMSAASamplesOverride:this._gl.getParameter(this._gl.MAX_SAMPLES),this._caps.maxDrawBuffers=this._gl.getParameter(this._gl.MAX_DRAW_BUFFERS);else{const i=this._gl.getExtension("WEBGL_draw_buffers");if(i!==null){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=i.drawBuffersWEBGL.bind(i),this._caps.maxDrawBuffers=this._gl.getParameter(i.MAX_DRAW_BUFFERS_WEBGL),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(let s=0;s<16;s++)this._gl["COLOR_ATTACHMENT"+s+"_WEBGL"]=i["COLOR_ATTACHMENT"+s+"_WEBGL"]}}if(this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{const i=this._gl.getExtension("WEBGL_depth_texture");i!=null&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=i.UNSIGNED_INT_24_8_WEBGL)}if(this.disableVertexArrayObjects)this._caps.vertexArrayObject=!1;else if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{const i=this._gl.getExtension("OES_vertex_array_object");i!=null&&(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=i.createVertexArrayOES.bind(i),this._gl.bindVertexArray=i.bindVertexArrayOES.bind(i),this._gl.deleteVertexArray=i.deleteVertexArrayOES.bind(i))}if(this._webGLVersion>1)this._caps.instancedArrays=!0;else{const i=this._gl.getExtension("ANGLE_instanced_arrays");i!=null?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=i.drawArraysInstancedANGLE.bind(i),this._gl.drawElementsInstanced=i.drawElementsInstancedANGLE.bind(i),this._gl.vertexAttribDivisor=i.vertexAttribDivisorANGLE.bind(i)):this._caps.instancedArrays=!1}if(this._gl.getShaderPrecisionFormat){const i=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),s=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);if(i&&s&&(this._caps.highPrecisionShaderSupported=i.precision!==0&&s.precision!==0,this._caps.shaderFloatPrecision=Math.min(i.precision,s.precision)),!this._shouldUseHighPrecisionShader){const r=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.MEDIUM_FLOAT),n=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.MEDIUM_FLOAT);r&&n&&(this._caps.shaderFloatPrecision=Math.min(r.precision,n.precision))}this._caps.shaderFloatPrecision<10&&(this._caps.shaderFloatPrecision=10)}if(this._webGLVersion>1)this._caps.blendMinMax=!0;else{const i=this._gl.getExtension("EXT_blend_minmax");i!=null&&(this._caps.blendMinMax=!0,this._gl.MAX=i.MAX_EXT,this._gl.MIN=i.MIN_EXT)}if(!this._caps.supportSRGBBuffers){if(this._webGLVersion>1)this._caps.supportSRGBBuffers=!0,this._glSRGBExtensionValues={SRGB:WebGL2RenderingContext.SRGB,SRGB8:WebGL2RenderingContext.SRGB8,SRGB8_ALPHA8:WebGL2RenderingContext.SRGB8_ALPHA8};else{const i=this._gl.getExtension("EXT_sRGB");i!=null&&(this._caps.supportSRGBBuffers=!0,this._glSRGBExtensionValues={SRGB:i.SRGB_EXT,SRGB8:i.SRGB_ALPHA_EXT,SRGB8_ALPHA8:i.SRGB_ALPHA_EXT})}if(this._creationOptions){const i=this._creationOptions.forceSRGBBufferSupportState;i!==void 0&&(this._caps.supportSRGBBuffers=this._caps.supportSRGBBuffers&&i)}}this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=this._gl.LEQUAL,this._depthCullingState.depthMask=!0,this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(let i=0;i"u",supportRenderAndCopyToLodForFloatTextures:this._webGLVersion!==1,supportDepthStencilTexture:this._webGLVersion!==1,supportShadowSamplers:this._webGLVersion!==1,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:this._webGLVersion!==1,trackUbosInFrame:!1,checkUbosContentBeforeUpload:!1,supportCSM:this._webGLVersion!==1,basisNeedsPOT:this._webGLVersion===1,support3DTextures:this._webGLVersion!==1,needTypeSuffixInShaderConstants:this._webGLVersion!==1,supportMSAA:this._webGLVersion!==1,supportSSAO2:this._webGLVersion!==1,supportIBLShadows:this._webGLVersion!==1,supportExtendedTextureFormats:this._webGLVersion!==1,supportSwitchCaseInShader:this._webGLVersion!==1,supportSyncTextureRead:!0,needsInvertingBitmap:!0,useUBOBindingCache:!0,needShaderCodeInlining:!1,needToAlwaysBindUniformBuffers:!1,supportRenderPasses:!1,supportSpriteInstancing:!0,forceVertexBufferStrideAndOffsetMultiple4Bytes:!1,_checkNonFloatVertexBuffersDontRecreatePipelineContext:!1,_collectUbosUpdatedInFrame:!1}}get webGLVersion(){return this._webGLVersion}getClassName(){return"ThinEngine"}_prepareWorkingCanvas(){if(this._workingCanvas)return;this._workingCanvas=this.createCanvas(1,1);const e=this._workingCanvas.getContext("2d");e&&(this._workingContext=e)}getInfo(){return this.getGlInfo()}getGlInfo(){return{vendor:this._glVendor,renderer:this._glRenderer,version:this._glVersion}}extractDriverInfo(){const e=this.getGlInfo();return e&&e.renderer?e.renderer:""}getRenderWidth(e=!1){return!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferWidth:this._gl.drawingBufferWidth}getRenderHeight(e=!1){return!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferHeight:this._gl.drawingBufferHeight}clear(e,t,i,s=!1,r=0){const n=this.stencilStateComposer.useStencilGlobalOnly;this.stencilStateComposer.useStencilGlobalOnly=!0,this.applyStates(),this.stencilStateComposer.useStencilGlobalOnly=n;let o=0;if(t&&e){let h=!0;if(this._currentRenderTarget){const l=this._currentRenderTarget.texture?.format;if(l===8||l===9||l===10||l===11){const c=this._currentRenderTarget.texture?.type;c===7||c===5?(he._TempClearColorUint32[0]=e.r*255,he._TempClearColorUint32[1]=e.g*255,he._TempClearColorUint32[2]=e.b*255,he._TempClearColorUint32[3]=e.a*255,this._gl.clearBufferuiv(this._gl.COLOR,0,he._TempClearColorUint32),h=!1):(he._TempClearColorInt32[0]=e.r*255,he._TempClearColorInt32[1]=e.g*255,he._TempClearColorInt32[2]=e.b*255,he._TempClearColorInt32[3]=e.a*255,this._gl.clearBufferiv(this._gl.COLOR,0,he._TempClearColorInt32),h=!1)}}h&&(this._gl.clearColor(e.r,e.g,e.b,e.a!==void 0?e.a:1),o|=this._gl.COLOR_BUFFER_BIT)}i&&(this.useReverseDepthBuffer?(this._depthCullingState.depthFunc=this._gl.GEQUAL,this._gl.clearDepth(0)):this._gl.clearDepth(1),o|=this._gl.DEPTH_BUFFER_BIT),s&&(this._gl.clearStencil(r),o|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(o)}_viewport(e,t,i,s){(e!==this._viewportCached.x||t!==this._viewportCached.y||i!==this._viewportCached.z||s!==this._viewportCached.w)&&(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=i,this._viewportCached.w=s,this._gl.viewport(e,t,i,s))}endFrame(){super.endFrame(),this._badOS&&this.flushFramebuffer()}get performanceMonitor(){throw new Error("Not Supported by ThinEngine")}bindFramebuffer(e,t=0,i,s,r,n=0,o=0){const h=e;this._currentRenderTarget&&this._resolveAndGenerateMipMapsFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._bindUnboundFramebuffer(h._framebuffer);const l=this._gl;e.isMulti||(e.is2DArray||e.is3D?(l.framebufferTextureLayer(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,e.texture._hardwareTexture?.underlyingResource,n,o),h._currentLOD=n):e.isCube?l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.texture._hardwareTexture?.underlyingResource,n):h._currentLOD!==n&&(l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,e.texture._hardwareTexture?.underlyingResource,n),h._currentLOD=n));const c=e._depthStencilTexture;if(c){e.is3D&&(e.texture.width!==c.width||e.texture.height!==c.height||e.texture.depth!==c.depth)&&w.Warn("Depth/Stencil attachment for 3D target must have same dimensions as color attachment");const u=e._depthStencilTextureWithStencil?l.DEPTH_STENCIL_ATTACHMENT:l.DEPTH_ATTACHMENT;e.is2DArray||e.is3D?l.framebufferTextureLayer(l.FRAMEBUFFER,u,c._hardwareTexture?.underlyingResource,n,o):e.isCube?l.framebufferTexture2D(l.FRAMEBUFFER,u,l.TEXTURE_CUBE_MAP_POSITIVE_X+t,c._hardwareTexture?.underlyingResource,n):l.framebufferTexture2D(l.FRAMEBUFFER,u,l.TEXTURE_2D,c._hardwareTexture?.underlyingResource,n)}h._MSAAFramebuffer&&this._bindUnboundFramebuffer(h._MSAAFramebuffer),this._cachedViewport&&!r?this.setViewport(this._cachedViewport,i,s):(i||(i=e.width,n&&(i=i/Math.pow(2,n))),s||(s=e.height,n&&(s=s/Math.pow(2,n))),this._viewport(0,0,i,s)),this.wipeCaches()}setStateCullFaceType(e,t){const i=this.cullBackFaces??e??!0?this._gl.BACK:this._gl.FRONT;(this._depthCullingState.cullFace!==i||t)&&(this._depthCullingState.cullFace=i)}setState(e,t=0,i,s=!1,r,n,o=0){(this._depthCullingState.cull!==e||i)&&(this._depthCullingState.cull=e),this.setStateCullFaceType(r,i),this.setZOffset(t),this.setZOffsetUnits(o);const h=s?this._gl.CW:this._gl.CCW;(this._depthCullingState.frontFace!==h||i)&&(this._depthCullingState.frontFace=h),this._stencilStateComposer.stencilMaterial=n}_resolveAndGenerateMipMapsFramebuffer(e,t=!1){e.disableAutomaticMSAAResolve||(e.isMulti?this.resolveMultiFramebuffer(e):this.resolveFramebuffer(e)),t||(e.isMulti?this.generateMipMapsMultiFramebuffer(e):this.generateMipMapsFramebuffer(e))}_bindUnboundFramebuffer(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)}_currentFrameBufferIsDefaultFrameBuffer(){return this._currentFramebuffer===null}generateMipmaps(e){const t=this._getTextureTarget(e);this._bindTextureDirectly(t,e,!0),this._gl.generateMipmap(t),this._bindTextureDirectly(t,null)}unBindFramebuffer(e,t,i){const s=e;this._currentRenderTarget=null,this._resolveAndGenerateMipMapsFramebuffer(e,t),i&&(s._MSAAFramebuffer&&this._bindUnboundFramebuffer(s._framebuffer),i()),this._bindUnboundFramebuffer(null)}generateMipMapsFramebuffer(e){!e.isMulti&&e.texture?.generateMipMaps&&!e.isCube&&this.generateMipmaps(e.texture)}resolveFramebuffer(e){const t=e,i=this._gl;if(!t._MSAAFramebuffer||t.isMulti)return;let s=t.resolveMSAAColors?i.COLOR_BUFFER_BIT:0;s|=t._generateDepthBuffer&&t.resolveMSAADepth?i.DEPTH_BUFFER_BIT:0,s|=t._generateStencilBuffer&&t.resolveMSAAStencil?i.STENCIL_BUFFER_BIT:0,i.bindFramebuffer(i.READ_FRAMEBUFFER,t._MSAAFramebuffer),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,t._framebuffer),i.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,s,i.NEAREST)}flushFramebuffer(){this._gl.flush()}restoreDefaultFramebuffer(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this._bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()}_resetVertexBufferBinding(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null}createVertexBuffer(e,t,i){return this._createVertexBuffer(e,this._gl.STATIC_DRAW)}_createVertexBuffer(e,t){const i=this._gl.createBuffer();if(!i)throw new Error("Unable to create vertex buffer");const s=new Ys(i);return this.bindArrayBuffer(s),typeof e!="number"?e instanceof Array?(this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),t),s.capacity=e.length*4):(this._gl.bufferData(this._gl.ARRAY_BUFFER,e,t),s.capacity=e.byteLength):(this._gl.bufferData(this._gl.ARRAY_BUFFER,new Uint8Array(e),t),s.capacity=e),this._resetVertexBufferBinding(),s.references=1,s}createDynamicVertexBuffer(e,t){return this._createVertexBuffer(e,this._gl.DYNAMIC_DRAW)}_resetIndexBufferBinding(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null}createIndexBuffer(e,t,i){const s=this._gl.createBuffer(),r=new Ys(s);if(!s)throw new Error("Unable to create index buffer");this.bindIndexBuffer(r);const n=this._normalizeIndexData(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,n,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),r.references=1,r.is32Bits=n.BYTES_PER_ELEMENT===4,r}_normalizeIndexData(e){if(e.BYTES_PER_ELEMENT===2)return e;if(this._caps.uintIndices){if(e instanceof Uint32Array)return e;for(let i=0;i=65535)return new Uint32Array(e);return new Uint16Array(e)}return new Uint16Array(e)}bindArrayBuffer(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ARRAY_BUFFER)}bindUniformBlock(e,t,i){const s=e.program,r=this._gl.getUniformBlockIndex(s,t);this._gl.uniformBlockBinding(s,r,i)}bindIndexBuffer(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)}_bindBuffer(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)}updateArrayBuffer(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)}_vertexAttribPointer(e,t,i,s,r,n,o){const h=this._currentBufferPointers[t];if(!h)return;let l=!1;h.active?(h.buffer!==e&&(h.buffer=e,l=!0),h.size!==i&&(h.size=i,l=!0),h.type!==s&&(h.type=s,l=!0),h.normalized!==r&&(h.normalized=r,l=!0),h.stride!==n&&(h.stride=n,l=!0),h.offset!==o&&(h.offset=o,l=!0)):(l=!0,h.active=!0,h.index=t,h.size=i,h.type=s,h.normalized=r,h.stride=n,h.offset=o,h.buffer=e),(l||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),s===this._gl.UNSIGNED_INT||s===this._gl.INT?this._gl.vertexAttribIPointer(t,i,s,n,o):this._gl.vertexAttribPointer(t,i,s,r,n,o))}_bindIndexBufferWithCache(e){e!=null&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)}_bindVertexBuffersAttributes(e,t,i){const s=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(let r=0;r=0){const o=s[r];let h=null;if(i&&(h=i[o]),h||(h=e[o]),!h)continue;this._gl.enableVertexAttribArray(n),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[n]=!0);const l=h.getBuffer();l&&(this._vertexAttribPointer(l,n,h.getSize(),h.type,h.normalized,h.byteStride,h.byteOffset),h.getIsInstanced()&&(this._gl.vertexAttribDivisor(n,h.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(n),this._currentInstanceBuffers.push(l))))}}}recordVertexArrayObject(e,t,i,s){const r=this._gl.createVertexArray();if(!r)throw new Error("Unable to create VAO");return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(r),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,i,s),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),r}bindVertexArrayObject(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=t!=null&&t.is32Bits,this._mustWipeVertexAttributes=!0)}bindBuffersDirectly(e,t,i,s,r){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==r){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=r;const n=r.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();let o=0;for(let h=0;h=0&&(this._gl.enableVertexAttribArray(l),this._vertexAttribArraysEnabled[l]=!0,this._vertexAttribPointer(e,l,i[h],this._gl.FLOAT,!1,s,o)),o+=i[h]*4}}this._bindIndexBufferWithCache(t)}_unbindVertexArrayObject(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))}bindBuffers(e,t,i,s){(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==i)&&(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=i,this._bindVertexBuffersAttributes(e,i,s)),this._bindIndexBufferWithCache(t)}unbindInstanceAttributes(){let e;for(let t=0,i=this._currentInstanceLocations.length;t1||this.isWebGPU)),(o===1&&!this._caps.textureFloatLinearFiltering||o===2&&!this._caps.textureHalfFloatLinearFiltering)&&(h=1),o===1&&!this._caps.textureFloat&&(o=0,w.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE"));const m=xn(l),A=bs(l),E=this._gl,I=new Et(this,s),M=e.width||e,C=e.height||e,x=e.depth||0,S=e.layers||0,L=this._getSamplingParameters(h,(r||n)&&!m),N=S!==0?E.TEXTURE_2D_ARRAY:x!==0?E.TEXTURE_3D:p?E.TEXTURE_CUBE_MAP:E.TEXTURE_2D,D=m?this._getInternalFormatFromDepthTextureFormat(l,!0,A):this._getRGBABufferInternalSizedFormat(o,l,c),Re=m?A?E.DEPTH_STENCIL:E.DEPTH_COMPONENT:this._getInternalFormat(l),pe=m?this._getWebGLTextureTypeFromDepthTextureFormat(l):this._getWebGLTextureType(o);if(this._bindTextureDirectly(N,I),S!==0)I.is2DArray=!0,E.texImage3D(N,0,D,M,C,S,0,Re,pe,null);else if(x!==0)I.is3D=!0,E.texImage3D(N,0,D,M,C,x,0,Re,pe,null);else if(p){I.isCube=!0;for(let ce=0;ce<6;ce++)E.texImage2D(E.TEXTURE_CUBE_MAP_POSITIVE_X+ce,0,D,M,C,0,Re,pe,null)}else E.texImage2D(N,0,D,M,C,0,Re,pe,null);if(E.texParameteri(N,E.TEXTURE_MAG_FILTER,L.mag),E.texParameteri(N,E.TEXTURE_MIN_FILTER,L.min),E.texParameteri(N,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(N,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),m&&this.webGLVersion>1&&(g===0?(E.texParameteri(N,E.TEXTURE_COMPARE_FUNC,515),E.texParameteri(N,E.TEXTURE_COMPARE_MODE,E.NONE)):(E.texParameteri(N,E.TEXTURE_COMPARE_FUNC,g),E.texParameteri(N,E.TEXTURE_COMPARE_MODE,E.COMPARE_REF_TO_TEXTURE))),(r||n)&&this._gl.generateMipmap(N),this._bindTextureDirectly(N,null),I._useSRGBBuffer=c,I.baseWidth=M,I.baseHeight=C,I.width=M,I.height=C,I.depth=S||x,I.isReady=!0,I.samples=u,I.generateMipMaps=r,I.samplingMode=h,I.type=o,I.format=l,I.label=f,I.comparisonFunction=g,this._internalTexturesCache.push(I),d){let ce=null;if(xn(I.format)?ce=this._setupFramebufferDepthAttachments(bs(I.format),I.format!==19,I.width,I.height,u,I.format,!0):ce=this._createRenderBuffer(I.width,I.height,u,-1,this._getRGBABufferInternalSizedFormat(I.type,I.format,I._useSRGBBuffer),-1),!ce)throw new Error("Unable to create render buffer");I._autoMSAAManagement=!0;let oe=I._hardwareTexture;oe||(oe=I._hardwareTexture=this._createHardwareTexture()),oe.addMSAARenderBuffer(ce)}return I}_getUseSRGBBuffer(e,t){return e&&this._caps.supportSRGBBuffers&&(this.webGLVersion>1||t)}createTexture(e,t,i,s,r=3,n=null,o=null,h=null,l=null,c=null,u=null,f,d,g,p){return this._createTextureBase(e,t,i,s,r,n,o,(...m)=>this._prepareWebGLTexture(...m,c),(m,A,E,I,M,C)=>{const x=this._gl,S=E.width===m&&E.height===A;M._creationFlags=g??0;const L=this._getTexImageParametersForCreateTexture(M.format,M._useSRGBBuffer);if(S)return x.texImage2D(x.TEXTURE_2D,0,L.internalFormat,L.format,L.type,E),!1;const N=this._caps.maxTextureSize;if(E.width>N||E.height>N||!this._supportsHardwareTextureRescaling)return this._prepareWorkingCanvas(),!this._workingCanvas||!this._workingContext||(this._workingCanvas.width=m,this._workingCanvas.height=A,this._workingContext.drawImage(E,0,0,E.width,E.height,0,0,m,A),x.texImage2D(x.TEXTURE_2D,0,L.internalFormat,L.format,L.type,this._workingCanvas),M.width=m,M.height=A),!1;{const D=new Et(this,2);this._bindTextureDirectly(x.TEXTURE_2D,D,!0),x.texImage2D(x.TEXTURE_2D,0,L.internalFormat,L.format,L.type,E),this._rescaleTexture(D,M,s,L.format,()=>{this._releaseTexture(D),this._bindTextureDirectly(x.TEXTURE_2D,M,!0),C()})}return!0},h,l,c,u,f,d,p)}_getTexImageParametersForCreateTexture(e,t){let i,s;return this.webGLVersion===1?(i=this._getInternalFormat(e,t),s=i):(i=this._getInternalFormat(e,!1),s=this._getRGBABufferInternalSizedFormat(0,e,t)),{internalFormat:s,format:i,type:this._gl.UNSIGNED_BYTE}}_rescaleTexture(e,t,i,s,r){}_unpackFlipY(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,e?1:0),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))}_getUnpackAlignement(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)}_getTextureTarget(e){return e.isCube?this._gl.TEXTURE_CUBE_MAP:e.is3D?this._gl.TEXTURE_3D:e.is2DArray||e.isMultiview?this._gl.TEXTURE_2D_ARRAY:this._gl.TEXTURE_2D}updateTextureSamplingMode(e,t,i=!1){const s=this._getTextureTarget(t),r=this._getSamplingParameters(e,t.useMipMaps||i);this._setTextureParameterInteger(s,this._gl.TEXTURE_MAG_FILTER,r.mag,t),this._setTextureParameterInteger(s,this._gl.TEXTURE_MIN_FILTER,r.min),i&&r.hasMipMaps&&(t.generateMipMaps=!0,this._gl.generateMipmap(s)),this._bindTextureDirectly(s,null),t.samplingMode=e}updateTextureDimensions(e,t,i,s=1){}updateTextureWrappingMode(e,t,i=null,s=null){const r=this._getTextureTarget(e);t!==null&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t),e),e._cachedWrapU=t),i!==null&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(i),e),e._cachedWrapV=i),(e.is2DArray||e.is3D)&&s!==null&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(s),e),e._cachedWrapR=s),this._bindTextureDirectly(r,null)}_uploadCompressedDataToTextureDirectly(e,t,i,s,r,n=0,o=0){const h=this._gl;let l=h.TEXTURE_2D;if(e.isCube&&(l=h.TEXTURE_CUBE_MAP_POSITIVE_X+n),e._useSRGBBuffer)switch(t){case 37492:case 36196:this._caps.etc2?t=h.COMPRESSED_SRGB8_ETC2:e._useSRGBBuffer=!1;break;case 37496:this._caps.etc2?t=h.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:e._useSRGBBuffer=!1;break;case 36492:t=h.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;break;case 37808:t=h.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;break;case 33776:this._caps.s3tc_srgb?t=h.COMPRESSED_SRGB_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case 33777:this._caps.s3tc_srgb?t=h.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case 33779:this._caps.s3tc_srgb?t=h.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:e._useSRGBBuffer=!1;break;default:e._useSRGBBuffer=!1;break}if(e.generateMipMaps){const c=e._hardwareTexture;c.memoryAllocated||(h.texStorage2D(e.isCube?h.TEXTURE_CUBE_MAP:h.TEXTURE_2D,Math.floor(Math.log2(Math.max(i,s)))+1,t,e.width,e.height),c.memoryAllocated=!0),this._gl.compressedTexSubImage2D(l,o,0,0,i,s,t,r)}else this._gl.compressedTexImage2D(l,o,t,i,s,0,r)}_uploadDataToTextureDirectly(e,t,i=0,s=0,r,n=!1){const o=this._gl,h=this._getWebGLTextureType(e.type),l=this._getInternalFormat(e.format),c=r===void 0?this._getRGBABufferInternalSizedFormat(e.type,e.format,e._useSRGBBuffer):this._getInternalFormat(r,e._useSRGBBuffer);this._unpackFlipY(e.invertY);let u=o.TEXTURE_2D;e.isCube&&(u=o.TEXTURE_CUBE_MAP_POSITIVE_X+i);const f=Math.round(Math.log(e.width)*Math.LOG2E),d=Math.round(Math.log(e.height)*Math.LOG2E),g=n?e.width:Math.pow(2,Math.max(f-s,0)),p=n?e.height:Math.pow(2,Math.max(d-s,0));o.texImage2D(u,s,c,g,p,0,l,h,t)}updateTextureData(e,t,i,s,r,n,o=0,h=0,l=!1){const c=this._gl,u=this._getWebGLTextureType(e.type),f=this._getInternalFormat(e.format);this._unpackFlipY(e.invertY);let d=c.TEXTURE_2D,g=c.TEXTURE_2D;e.isCube&&(g=c.TEXTURE_CUBE_MAP_POSITIVE_X+o,d=c.TEXTURE_CUBE_MAP),this._bindTextureDirectly(d,e,!0),c.texSubImage2D(g,h,i,s,r,n,f,u,t),l&&this._gl.generateMipmap(g),this._bindTextureDirectly(d,null)}_uploadArrayBufferViewToTexture(e,t,i=0,s=0){const r=this._gl,n=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(n,e,!0),this._uploadDataToTextureDirectly(e,t,i,s),this._bindTextureDirectly(n,null,!0)}_prepareWebGLTextureContinuation(e,t,i,s,r){const n=this._gl;if(!n)return;const o=this._getSamplingParameters(r,!i);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,o.mag),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,o.min),!i&&!s&&n.generateMipmap(n.TEXTURE_2D),this._bindTextureDirectly(n.TEXTURE_2D,null),t&&t.removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}_prepareWebGLTexture(e,t,i,s,r,n,o,h,l,c){const u=this.getCaps().maxTextureSize,f=Math.min(u,this.needPOTTextures?Vs(s.width,u):s.width),d=Math.min(u,this.needPOTTextures?Vs(s.height,u):s.height),g=this._gl;if(g){if(!e._hardwareTexture){i&&i.removePendingData(e);return}this._bindTextureDirectly(g.TEXTURE_2D,e,!0),this._unpackFlipY(r===void 0?!0:!!r),e.baseWidth=s.width,e.baseHeight=s.height,e.width=f,e.height=d,e.isReady=!0,e.type=e.type!==-1?e.type:0,e.format=e.format!==-1?e.format:c??(t===".jpg"&&!e._useSRGBBuffer?4:5),!h(f,d,s,t,e,()=>{this._prepareWebGLTextureContinuation(e,i,n,o,l)})&&this._prepareWebGLTextureContinuation(e,i,n,o,l)}}_getInternalFormatFromDepthTextureFormat(e,t,i){const s=this._gl;if(!t)return s.STENCIL_INDEX8;let n=i?s.DEPTH_STENCIL:s.DEPTH_COMPONENT;return this.webGLVersion>1?e===15?n=s.DEPTH_COMPONENT16:e===16?n=s.DEPTH_COMPONENT24:e===17||e===13?n=i?s.DEPTH24_STENCIL8:s.DEPTH_COMPONENT24:e===14?n=s.DEPTH_COMPONENT32F:e===18&&(n=i?s.DEPTH32F_STENCIL8:s.DEPTH_COMPONENT32F):n=s.DEPTH_COMPONENT16,n}_getWebGLTextureTypeFromDepthTextureFormat(e){const t=this._gl;let i=t.UNSIGNED_INT;return e===15?i=t.UNSIGNED_SHORT:e===17||e===13?i=t.UNSIGNED_INT_24_8:e===14?i=t.FLOAT:e===18?i=t.FLOAT_32_UNSIGNED_INT_24_8_REV:e===19&&(i=t.UNSIGNED_BYTE),i}_setupFramebufferDepthAttachments(e,t,i,s,r=1,n,o=!1){const h=this._gl;n=n??(e?13:14);const l=this._getInternalFormatFromDepthTextureFormat(n,t,e);return e&&t?this._createRenderBuffer(i,s,r,h.DEPTH_STENCIL,l,o?-1:h.DEPTH_STENCIL_ATTACHMENT):t?this._createRenderBuffer(i,s,r,l,l,o?-1:h.DEPTH_ATTACHMENT):e?this._createRenderBuffer(i,s,r,l,l,o?-1:h.STENCIL_ATTACHMENT):null}_createRenderBuffer(e,t,i,s,r,n,o=!0){const l=this._gl.createRenderbuffer();return this._updateRenderBuffer(l,e,t,i,s,r,n,o)}_updateRenderBuffer(e,t,i,s,r,n,o,h=!0){const l=this._gl;return l.bindRenderbuffer(l.RENDERBUFFER,e),s>1&&l.renderbufferStorageMultisample?l.renderbufferStorageMultisample(l.RENDERBUFFER,s,n,t,i):l.renderbufferStorage(l.RENDERBUFFER,r,t,i),o!==-1&&l.framebufferRenderbuffer(l.FRAMEBUFFER,o,l.RENDERBUFFER,e),h&&l.bindRenderbuffer(l.RENDERBUFFER,null),e}_releaseTexture(e){this._deleteTexture(e._hardwareTexture),this.unbindAllTextures();const t=this._internalTexturesCache.indexOf(e);t!==-1&&this._internalTexturesCache.splice(t,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),e._irradianceTexture&&e._irradianceTexture.dispose()}_deleteTexture(e){e?.release()}_setProgram(e){this._currentProgram!==e&&(_c(e,this._gl),this._currentProgram=e)}bindSamplers(e){const t=e.getPipelineContext();this._setProgram(t.program);const i=e.getSamplers();for(let s=0;s-1;if(i&&n&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||s){if(this._activateCurrentTexture(),t&&t.isMultiview)throw w.Error(["_bindTextureDirectly called with a multiview texture!",e,t]),"_bindTextureDirectly called with a multiview texture!";this._gl.bindTexture(e,t?._hardwareTexture?.underlyingResource??null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)}else i&&(r=!0,this._activateCurrentTexture());return n&&!i&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),r}_bindTexture(e,t,i){if(e===void 0)return;t&&(t._associatedChannel=e),this._activeChannel=e;const s=t?this._getTextureTarget(t):this._gl.TEXTURE_2D;this._bindTextureDirectly(s,t)}unbindAllTextures(){for(let e=0;e1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))}setTexture(e,t,i,s){e!==void 0&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,i))}_bindSamplerUniformToChannel(e,t){const i=this._boundUniforms[e];!i||i._currentState===t||(this._gl.uniform1i(i,t),i._currentState=t)}_getTextureWrapMode(e){switch(e){case 1:return this._gl.REPEAT;case 0:return this._gl.CLAMP_TO_EDGE;case 2:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT}_setTexture(e,t,i=!1,s=!1,r=""){if(!t)return this._boundTexturesCache[e]!=null&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))),!1;if(t.video){this._activeChannel=e;const l=t.getInternalTexture();l&&(l._associatedChannel=e),t.update()}else if(t.delayLoadState===4)return t.delayLoad(),!1;let n;s?n=t.depthStencilTexture:t.isReady()?n=t.getInternalTexture():t.isCube?n=this.emptyCubeTexture:t.is3D?n=this.emptyTexture3D:t.is2DArray?n=this.emptyTexture2DArray:n=this.emptyTexture,!i&&n&&(n._associatedChannel=e);let o=!0;this._boundTexturesCache[e]===n&&(i||this._bindSamplerUniformToChannel(n._associatedChannel,e),o=!1),this._activeChannel=e;const h=this._getTextureTarget(n);if(o&&this._bindTextureDirectly(h,n,i),n&&!n.isMultiview){if(n.isCube&&n._cachedCoordinatesMode!==t.coordinatesMode){n._cachedCoordinatesMode=t.coordinatesMode;const l=t.coordinatesMode!==3&&t.coordinatesMode!==5?1:0;t.wrapU=l,t.wrapV=l}n._cachedWrapU!==t.wrapU&&(n._cachedWrapU=t.wrapU,this._setTextureParameterInteger(h,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),n)),n._cachedWrapV!==t.wrapV&&(n._cachedWrapV=t.wrapV,this._setTextureParameterInteger(h,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),n)),n.is3D&&n._cachedWrapR!==t.wrapR&&(n._cachedWrapR=t.wrapR,this._setTextureParameterInteger(h,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),n)),this._setAnisotropicLevel(h,n,t.anisotropicFilteringLevel)}return!0}setTextureArray(e,t,i,s){if(!(e===void 0||!t)){(!this._textureUnits||this._textureUnits.length!==i.length)&&(this._textureUnits=new Int32Array(i.length));for(let r=0;r=this._caps.maxVertexAttribs||!this._vertexAttribArraysEnabled[e]||this.disableAttributeByIndex(e)}releaseEffects(){this._compiledEffects={},this.onReleaseEffectsObservable.notifyObservers(this)}dispose(){_t()&&this._renderingCanvas&&(this._renderingCanvas.removeEventListener("webglcontextlost",this._onContextLost),this._onContextRestored&&this._renderingCanvas.removeEventListener("webglcontextrestored",this._onContextRestored)),super.dispose(),this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.unbindAllAttributes(),this._boundUniforms={},this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers.length=0,this._currentProgram=null,this._creationOptions.loseContextOnDispose&&this._gl.getExtension("WEBGL_lose_context")?.loseContext(),$r(this._gl)}attachContextLostEvent(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextlost",e,!1)}attachContextRestoredEvent(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextrestored",e,!1)}getError(){return this._gl.getError()}_canRenderToFloatFramebuffer(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(1)}_canRenderToHalfFloatFramebuffer(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(2)}_canRenderToFramebuffer(e){const t=this._gl;for(;t.getError()!==t.NO_ERROR;);let i=!0;const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0);const n=t.checkFramebufferStatus(t.FRAMEBUFFER);if(i=i&&n===t.FRAMEBUFFER_COMPLETE,i=i&&t.getError()===t.NO_ERROR,i&&(t.clear(t.COLOR_BUFFER_BIT),i=i&&t.getError()===t.NO_ERROR),i){t.bindFramebuffer(t.FRAMEBUFFER,null);const o=t.RGBA,h=t.UNSIGNED_BYTE,l=new Uint8Array(4);t.readPixels(0,0,1,1,o,h,l),i=i&&t.getError()===t.NO_ERROR}for(t.deleteTexture(s),t.deleteFramebuffer(r),t.bindFramebuffer(t.FRAMEBUFFER,null);!i&&t.getError()!==t.NO_ERROR;);return i}_getWebGLTextureType(e){if(this._webGLVersion===1){switch(e){case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT_OES;case 0:return this._gl.UNSIGNED_BYTE;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(e){case 3:return this._gl.BYTE;case 0:return this._gl.UNSIGNED_BYTE;case 4:return this._gl.SHORT;case 5:return this._gl.UNSIGNED_SHORT;case 6:return this._gl.INT;case 7:return this._gl.UNSIGNED_INT;case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5;case 11:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case 12:return this._gl.UNSIGNED_INT_24_8;case 13:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case 14:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case 15:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE}_getInternalFormat(e,t=!1){let i=t?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA;switch(e){case 0:i=this._gl.ALPHA;break;case 1:i=this._gl.LUMINANCE;break;case 2:i=this._gl.LUMINANCE_ALPHA;break;case 6:case 33322:case 36760:i=this._gl.RED;break;case 7:case 33324:case 36761:i=this._gl.RG;break;case 4:case 32852:case 36762:i=t?this._glSRGBExtensionValues.SRGB:this._gl.RGB;break;case 5:case 32859:case 36763:i=t?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA;break}if(this._webGLVersion>1)switch(e){case 8:i=this._gl.RED_INTEGER;break;case 9:i=this._gl.RG_INTEGER;break;case 10:i=this._gl.RGB_INTEGER;break;case 11:i=this._gl.RGBA_INTEGER;break}return i}_getRGBABufferInternalSizedFormat(e,t,i=!1){if(this._webGLVersion===1){if(t!==void 0)switch(t){case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;case 4:return i?this._glSRGBExtensionValues.SRGB:this._gl.RGB}return this._gl.RGBA}switch(e){case 3:switch(t){case 6:return this._gl.R8_SNORM;case 7:return this._gl.RG8_SNORM;case 4:return this._gl.RGB8_SNORM;case 8:return this._gl.R8I;case 9:return this._gl.RG8I;case 10:return this._gl.RGB8I;case 11:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case 0:switch(t){case 6:return this._gl.R8;case 7:return this._gl.RG8;case 4:return i?this._glSRGBExtensionValues.SRGB8:this._gl.RGB8;case 5:return i?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA8;case 8:return this._gl.R8UI;case 9:return this._gl.RG8UI;case 10:return this._gl.RGB8UI;case 11:return this._gl.RGBA8UI;case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case 4:switch(t){case 8:return this._gl.R16I;case 36760:return this._gl.R16_SNORM_EXT;case 36761:return this._gl.RG16_SNORM_EXT;case 36762:return this._gl.RGB16_SNORM_EXT;case 36763:return this._gl.RGBA16_SNORM_EXT;case 9:return this._gl.RG16I;case 10:return this._gl.RGB16I;case 11:return this._gl.RGBA16I;default:return this._gl.RGBA16I}case 5:switch(t){case 8:return this._gl.R16UI;case 33322:return this._gl.R16_EXT;case 33324:return this._gl.RG16_EXT;case 32852:return this._gl.RGB16_EXT;case 32859:return this._gl.RGBA16_EXT;case 9:return this._gl.RG16UI;case 10:return this._gl.RGB16UI;case 11:return this._gl.RGBA16UI;default:return this._gl.RGBA16UI}case 6:switch(t){case 8:return this._gl.R32I;case 9:return this._gl.RG32I;case 10:return this._gl.RGB32I;case 11:return this._gl.RGBA32I;default:return this._gl.RGBA32I}case 7:switch(t){case 8:return this._gl.R32UI;case 9:return this._gl.RG32UI;case 10:return this._gl.RGB32UI;case 11:return this._gl.RGBA32UI;default:return this._gl.RGBA32UI}case 1:switch(t){case 6:return this._gl.R32F;case 7:return this._gl.RG32F;case 4:return this._gl.RGB32F;case 5:return this._gl.RGBA32F;default:return this._gl.RGBA32F}case 2:switch(t){case 6:return this._gl.R16F;case 7:return this._gl.RG16F;case 4:return this._gl.RGB16F;case 5:return this._gl.RGBA16F;default:return this._gl.RGBA16F}case 10:return this._gl.RGB565;case 13:return this._gl.R11F_G11F_B10F;case 14:return this._gl.RGB9_E5;case 8:return this._gl.RGBA4;case 9:return this._gl.RGB5_A1;case 11:switch(t){case 5:return this._gl.RGB10_A2;case 11:return this._gl.RGB10_A2UI;default:return this._gl.RGB10_A2}}return i?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA8}readPixels(e,t,i,s,r=!0,n=!0,o=null){const h=r?4:3,l=r?this._gl.RGBA:this._gl.RGB,c=i*s*h;if(!o)o=new Uint8Array(c);else if(o.length=this._sampleCount||e>=this._samples.length)return 0;const t=this._wrapPosition(this._pos-1);return this._samples[this._wrapPosition(t-e)]}isSaturated(){return this._sampleCount>=this._samples.length}reset(){this.average=0,this.variance=0,this._sampleCount=0,this._pos=0,this._m2=0}_wrapPosition(e){const t=this._samples.length;return(e%t+t)%t}}he.prototype.setAlphaMode=function(a,e=!1,t=0){if(this._alphaMode[t]===a){if(!e){const s=a===0;this.depthCullingState.depthMask!==s&&(this.depthCullingState.depthMask=s)}return}const i=a===0;this._alphaState.setAlphaBlend(!i,t),this._alphaState.setAlphaMode(a,t),e||(this.depthCullingState.depthMask=i),this._alphaMode[t]=a};he.prototype.updateRawTexture=function(a,e,t,i,s=null,r=0,n=!1){if(!a)return;const o=this._getRGBABufferInternalSizedFormat(r,t,n),h=this._getInternalFormat(t),l=this._getWebGLTextureType(r);this._bindTextureDirectly(this._gl.TEXTURE_2D,a,!0),this._unpackFlipY(i===void 0?!0:!!i),this._doNotHandleContextLost||(a._bufferView=e,a.format=t,a.type=r,a.invertY=i,a._compression=s),a.width%4!==0&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,1),s&&e?this._gl.compressedTexImage2D(this._gl.TEXTURE_2D,0,this.getCaps().s3tc[s],a.width,a.height,0,e):this._gl.texImage2D(this._gl.TEXTURE_2D,0,o,a.width,a.height,0,h,l,e),a.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),a.isReady=!0};he.prototype.createRawTexture=function(a,e,t,i,s,r,n,o=null,h=0,l=0,c=!1){const u=new Et(this,3);u.baseWidth=e,u.baseHeight=t,u.width=e,u.height=t,u.format=i,u.generateMipMaps=s,u.samplingMode=n,u.invertY=r,u._compression=o,u.type=h,u._useSRGBBuffer=this._getUseSRGBBuffer(c,!s),this._doNotHandleContextLost||(u._bufferView=a),this.updateRawTexture(u,a,i,r,o,h,u._useSRGBBuffer),this._bindTextureDirectly(this._gl.TEXTURE_2D,u,!0);const f=this._getSamplingParameters(n,s);return this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,f.mag),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,f.min),s&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._internalTexturesCache.push(u),u};he.prototype.createRawCubeTexture=function(a,e,t,i,s,r,n,o=null){const h=this._gl,l=new Et(this,8);l.isCube=!0,l.format=t,l.type=i,this._doNotHandleContextLost||(l._bufferViewArray=a);const c=this._getWebGLTextureType(i);let u=this._getInternalFormat(t);u===h.RGB&&(u=h.RGBA),c===h.FLOAT&&!this._caps.textureFloatLinearFiltering?(s=!1,n=1,w.Warn("Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")):c===this._gl.HALF_FLOAT_OES&&!this._caps.textureHalfFloatLinearFiltering?(s=!1,n=1,w.Warn("Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")):c===h.FLOAT&&!this._caps.textureFloatRender?(s=!1,w.Warn("Render to float textures is not supported. Mipmap generation forced to false.")):c===h.HALF_FLOAT&&!this._caps.colorBufferFloat&&(s=!1,w.Warn("Render to half float textures is not supported. Mipmap generation forced to false."));const f=e,d=f;if(l.width=f,l.height=d,l.invertY=r,l._compression=o,!this.needPOTTextures||Hs(l.width)&&Hs(l.height)||(s=!1),a)this.updateRawCubeTexture(l,a,t,i,r,o);else{const m=this._getRGBABufferInternalSizedFormat(i),A=0;this._bindTextureDirectly(h.TEXTURE_CUBE_MAP,l,!0);for(let E=0;E<6;E++)o?h.compressedTexImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+E,A,this.getCaps().s3tc[o],l.width,l.height,0,void 0):h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+E,A,m,l.width,l.height,0,u,c,null);this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)}this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,l,!0),a&&s&&this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);const p=this._getSamplingParameters(n,s);return h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_MAG_FILTER,p.mag),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_MIN_FILTER,p.min),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),this._bindTextureDirectly(h.TEXTURE_CUBE_MAP,null),l.generateMipMaps=s,l.samplingMode=n,l.isReady=!0,l};he.prototype.updateRawCubeTexture=function(a,e,t,i,s,r=null,n=0){a._bufferViewArray=e,a.format=t,a.type=i,a.invertY=s,a._compression=r;const o=this._gl,h=this._getWebGLTextureType(i);let l=this._getInternalFormat(t);const c=this._getRGBABufferInternalSizedFormat(i);let u=!1;l===o.RGB&&(l=o.RGBA,u=!0),this._bindTextureDirectly(o.TEXTURE_CUBE_MAP,a,!0),this._unpackFlipY(s===void 0?!0:!!s),a.width%4!==0&&o.pixelStorei(o.UNPACK_ALIGNMENT,1);for(let d=0;d<6;d++){let g=e[d];r?o.compressedTexImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+d,n,this.getCaps().s3tc[r],a.width,a.height,0,g):(u&&(g=Lh(g,a.width,a.height,i)),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+d,n,c,a.width,a.height,0,l,h,g))}(!this.needPOTTextures||Hs(a.width)&&Hs(a.height))&&a.generateMipMaps&&n===0&&this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),a.isReady=!0};he.prototype.createRawCubeTextureFromUrl=function(a,e,t,i,s,r,n,o,h=null,l=null,c=3,u=!1){const f=this._gl,d=this.createRawCubeTexture(null,t,i,s,!r,u,c,null);e?.addPendingData(d),d.url=a,d.isReady=!1,this._internalTexturesCache.push(d);const g=(m,A)=>{e?.removePendingData(d),l&&m&&l(m.status+" "+m.statusText,A)},p=async m=>{if(!d._hardwareTexture)return;const A=n(m);if(!A)return;const E=A instanceof Promise?await A:A,I=d.width;if(o){const M=this._getWebGLTextureType(s);let C=this._getInternalFormat(i);const x=this._getRGBABufferInternalSizedFormat(s);let S=!1;C===f.RGB&&(C=f.RGBA,S=!0),this._bindTextureDirectly(f.TEXTURE_CUBE_MAP,d,!0),this._unpackFlipY(!1);const L=o(E);for(let N=0;N>N;for(let Re=0;Re<6;Re++){let pe=L[N][Re];S&&(pe=Lh(pe,D,D,s)),f.texImage2D(Re,N,x,D,D,0,C,M,pe)}}this._bindTextureDirectly(f.TEXTURE_CUBE_MAP,null)}else this.updateRawCubeTexture(d,E,i,s,u);d.isReady=!0,e?.removePendingData(d),d.onLoadedObservable.notifyObservers(d),d.onLoadedObservable.clear(),h&&h()};return this._loadFile(a,m=>{p(m).catch(A=>{g(void 0,A)})},void 0,e?.offlineProvider,!0,g),d};function Lh(a,e,t,i){let s,r=1;i===1?s=new Float32Array(e*t*4):i===2?(s=new Uint16Array(e*t*4),r=15360):i===7?s=new Uint32Array(e*t*4):s=new Uint8Array(e*t*4);for(let n=0;n-1?c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_CUBE_MAP_POSITIVE_X+i,a._hardwareTexture?.underlyingResource,s):c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,a._hardwareTexture?.underlyingResource,s);let u=a.type!==void 0?this._getWebGLTextureType(a.type):c.UNSIGNED_BYTE;return o?r||(r=Zl(a.type,4*e*t)):u===c.UNSIGNED_BYTE?(r||(r=new Uint8Array(4*e*t)),u=c.UNSIGNED_BYTE):(r||(r=new Float32Array(4*e*t)),u=c.FLOAT),n&&this.flushFramebuffer(),c.readPixels(h,l,e,t,c.RGBA,u,r),c.bindFramebuffer(c.FRAMEBUFFER,this._currentFramebuffer),r};he.prototype._readTexturePixels=function(a,e,t,i=-1,s=0,r=null,n=!0,o=!1,h=0,l=0){return Promise.resolve(this._readTexturePixelsSync(a,e,t,i,s,r,n,o,h,l))};he.prototype.updateDynamicIndexBuffer=function(a,e,t=0){this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER]=null,this.bindIndexBuffer(a);let i;a.is32Bits?i=e instanceof Uint32Array?e:new Uint32Array(e):i=e instanceof Uint16Array?e:new Uint16Array(e),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,i,this._gl.DYNAMIC_DRAW),this._resetIndexBufferBinding()};he.prototype.updateDynamicVertexBuffer=function(a,e,t,i){this.bindArrayBuffer(a),t===void 0&&(t=0);const s=e.byteLength||e.length;i===void 0||i>=s&&t===0?e instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,t,new Float32Array(e)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,t,e):e instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,t,new Float32Array(e).subarray(0,i/4)):(e instanceof ArrayBuffer?e=new Uint8Array(e,0,i):e=new Uint8Array(e.buffer,e.byteOffset,i),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,t,e)),this._resetVertexBufferBinding()};he.prototype._createDepthStencilCubeTexture=function(a,e){const t=new Et(this,12);if(t.isCube=!0,this.webGLVersion===1)return w.Error("Depth cube texture is not supported by WebGL 1."),t;const i={bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1,...e},s=this._gl;this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,t,!0),this._setupDepthStencilTexture(t,a,i.bilinearFiltering,i.comparisonFunction);for(let r=0;r<6;r++)i.generateStencil?s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,s.DEPTH24_STENCIL8,a,a,0,s.DEPTH_STENCIL,s.UNSIGNED_INT_24_8,null):s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,s.DEPTH_COMPONENT24,a,a,0,s.DEPTH_COMPONENT,s.UNSIGNED_INT,null);return this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,null),this._internalTexturesCache.push(t),t};he.prototype._setCubeMapTextureParams=function(a,e,t){const i=this._gl;i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MIN_FILTER,e?i.LINEAR_MIPMAP_LINEAR:i.LINEAR),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),a.samplingMode=e?3:2,e&&this.getCaps().textureMaxLevel&&t!==void 0&&t>0&&(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MAX_LEVEL,t),a._maxLodLevel=t),this._bindTextureDirectly(i.TEXTURE_CUBE_MAP,null)};he.prototype.createCubeTexture=function(a,e,t,i,s=null,r=null,n,o=null,h=!1,l=0,c=0,u=null,f,d=!1,g=null){const p=this._gl;return this.createCubeTextureBase(a,e,t,!!i,s,r,n,o,h,l,c,u,m=>this._bindTextureDirectly(p.TEXTURE_CUBE_MAP,m,!0),(m,A)=>{const E=this.needPOTTextures?Vs(A[0].width,this._caps.maxCubemapTextureSize):A[0].width,I=E,M=[p.TEXTURE_CUBE_MAP_POSITIVE_X,p.TEXTURE_CUBE_MAP_POSITIVE_Y,p.TEXTURE_CUBE_MAP_POSITIVE_Z,p.TEXTURE_CUBE_MAP_NEGATIVE_X,p.TEXTURE_CUBE_MAP_NEGATIVE_Y,p.TEXTURE_CUBE_MAP_NEGATIVE_Z];this._bindTextureDirectly(p.TEXTURE_CUBE_MAP,m,!0),this._unpackFlipY(!1);const C=n?this._getInternalFormat(n,m._useSRGBBuffer):m._useSRGBBuffer?this._glSRGBExtensionValues.SRGB8_ALPHA8:p.RGBA;let x=n?this._getInternalFormat(n):p.RGBA;m._useSRGBBuffer&&this.webGLVersion===1&&(x=C);for(let S=0;S0}get is3D(){return this.depth>0}get size(){return this.width}get width(){return this._size.width??this._size}get height(){return this._size.height??this._size}get layers(){return this._size.layers||0}get depth(){return this._size.depth||0}get texture(){return this._textures?.[0]??null}get textures(){return this._textures}get faceIndices(){return this._faceIndices}get layerIndices(){return this._layerIndices}getBaseArrayLayer(e){if(!this._textures)return-1;const t=this._textures[e],i=this._layerIndices?.[e]??0,s=this._faceIndices?.[e]??0;return t.isCube?i*6+s:t.is3D?0:i}get samples(){return this._samples}setSamples(e,t=!0,i=!1){if(this.samples===e&&!i)return e;const s=this._isMulti?this._engine.updateMultipleRenderTargetTextureSampleCount(this,e,t):this._engine.updateRenderTargetTextureSampleCount(this,e);return this._samples=e,s}resolveMSAATextures(){this.isMulti?this._engine.resolveMultiFramebuffer(this):this._engine.resolveFramebuffer(this)}generateMipMaps(){this._engine._currentRenderTarget===this&&(this.isMulti?this._engine.unBindMultiColorAttachmentFramebuffer(this,!0):this._engine.unBindFramebuffer(this,!0)),this.isMulti?this._engine.generateMipMapsMultiFramebuffer(this):this._engine.generateMipMapsFramebuffer(this)}constructor(e,t,i,s,r){this._textures=null,this._faceIndices=null,this._layerIndices=null,this._samples=1,this._attachments=null,this._generateStencilBuffer=!1,this._generateDepthBuffer=!1,this._depthStencilTextureWithStencil=!1,this.disableAutomaticMSAAResolve=!1,this.resolveMSAAColors=!0,this.resolveMSAADepth=!1,this.resolveMSAAStencil=!1,this.depthReadOnly=!1,this.stencilReadOnly=!1,this._isMulti=e,this._isCube=t,this._size=i,this._engine=s,this._depthStencilTexture=null,this.label=r}setTextures(e){Array.isArray(e)?this._textures=e:e?this._textures=[e]:this._textures=null}setTexture(e,t=0,i=!0){this._textures||(this._textures=[]),this._textures[t]!==e&&(this._textures[t]&&i&&this._textures[t].dispose(),this._textures[t]=e)}setLayerAndFaceIndices(e,t){this._layerIndices=e,this._faceIndices=t}setLayerAndFaceIndex(e=0,t,i){this._layerIndices||(this._layerIndices=[]),this._faceIndices||(this._faceIndices=[]),t!==void 0&&t>=0&&(this._layerIndices[e]=t),i!==void 0&&i>=0&&(this._faceIndices[e]=i)}createDepthStencilTexture(e=0,t=!0,i=!1,s=1,r=14,n){return this._depthStencilTexture?.dispose(),this._depthStencilTextureWithStencil=i,this._depthStencilTextureLabel=n,this._depthStencilTexture=this._engine.createDepthStencilTexture(this._size,{bilinearFiltering:t,comparisonFunction:e,generateStencil:i,isCube:this._isCube,samples:s,depthTextureFormat:r,label:n},this),this._depthStencilTexture}_shareDepth(e){this.shareDepth(e)}shareDepth(e){this._depthStencilTexture&&(e._depthStencilTexture&&e._depthStencilTexture.dispose(),e._depthStencilTexture=this._depthStencilTexture,e._depthStencilTextureWithStencil=this._depthStencilTextureWithStencil,this._depthStencilTexture.incrementReferences())}_swapAndDie(e){this.texture&&this.texture._swapAndDie(e),this._textures=null,this.dispose(!0)}_cloneRenderTargetWrapper(){let e=null;if(this._isMulti){const t=this.textures;if(t&&t.length>0){let i=!1,s=t.length,r=-1;const n=t[t.length-1]._source;(n===14||n===12)&&(i=!0,r=t[t.length-1].format,s--);const o=[],h=[],l=[],c=[],u=[],f=[],d=[],g={};for(let A=0;A1&&e.setSamples(this.samples),e._swapRenderTargetWrapper(this),e.dispose()}}releaseTextures(){if(this._textures)for(let e=0;e1){const c=this._context;l=c["COLOR_ATTACHMENT"+t],e.is2DArray||e.is3D?(i=i??this.layerIndices?.[t]??0,c.framebufferTextureLayer(c.FRAMEBUFFER,l,r.underlyingResource,s,i)):e.isCube?(i=i??this.faceIndices?.[t]??0,c.framebufferTexture2D(c.FRAMEBUFFER,l,c.TEXTURE_CUBE_MAP_POSITIVE_X+i,r.underlyingResource,s)):c.framebufferTexture2D(c.FRAMEBUFFER,l,c.TEXTURE_2D,r.underlyingResource,s)}else{const c=this._context;l=c["COLOR_ATTACHMENT"+t+"_WEBGL"];const u=i!==void 0?c.TEXTURE_CUBE_MAP_POSITIVE_X+i:c.TEXTURE_2D;c.framebufferTexture2D(c.FRAMEBUFFER,l,u,r.underlyingResource,s)}if(e._autoMSAAManagement&&this._MSAAFramebuffer){const c=this._context;o._bindUnboundFramebuffer(this._MSAAFramebuffer),c.framebufferRenderbuffer(c.FRAMEBUFFER,l,c.RENDERBUFFER,r.getMSAARenderBuffer())}o._bindUnboundFramebuffer(h)}setTexture(e,t=0,i=!0){super.setTexture(e,t,i),this._bindTextureRenderTarget(e,t)}setLayerAndFaceIndices(e,t){if(super.setLayerAndFaceIndices(e,t),!this.textures||!this.layerIndices||!this.faceIndices)return;const i=this._attachments?.length??this.textures.length;for(let s=0;s1){const p=n._hardwareTexture.getMSAARenderBuffer(0);t._MSAAFramebuffer=d.createFramebuffer(),this._bindUnboundFramebuffer(t._MSAAFramebuffer),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.RENDERBUFFER,p),this._bindUnboundFramebuffer(null)}return t};he.prototype._createDepthStencilTexture=function(a,e,t){const i=this._gl,s=a.layers||0,r=a.depth||0;let n=i.TEXTURE_2D;s!==0?n=i.TEXTURE_2D_ARRAY:r!==0&&(n=i.TEXTURE_3D);const o=new Et(this,12);if(o.label=e.label,!this._caps.depthTextureExtension)return w.Error("Depth texture is not supported by your browser or hardware."),o;const h={bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1,...e};if(this._bindTextureDirectly(n,o,!0),this._setupDepthStencilTexture(o,a,h.comparisonFunction===0?!1:h.bilinearFiltering,h.comparisonFunction,h.samples),h.depthTextureFormat!==void 0){if(h.depthTextureFormat!==15&&h.depthTextureFormat!==16&&h.depthTextureFormat!==17&&h.depthTextureFormat!==13&&h.depthTextureFormat!==14&&h.depthTextureFormat!==18)return w.Error(`Depth texture ${h.depthTextureFormat} format is not supported.`),o;o.format=h.depthTextureFormat}else o.format=h.generateStencil?13:16;const l=bs(o.format),c=this._getWebGLTextureTypeFromDepthTextureFormat(o.format),u=l?i.DEPTH_STENCIL:i.DEPTH_COMPONENT,f=this._getInternalFormatFromDepthTextureFormat(o.format,!0,l);return o.is2DArray?i.texImage3D(n,0,f,o.width,o.height,s,0,u,c,null):o.is3D?i.texImage3D(n,0,f,o.width,o.height,r,0,u,c,null):i.texImage2D(n,0,f,o.width,o.height,0,u,c,null),this._bindTextureDirectly(n,null),this._internalTexturesCache.push(o),t._depthStencilBuffer&&(i.deleteRenderbuffer(t._depthStencilBuffer),t._depthStencilBuffer=null),this._bindUnboundFramebuffer(t._MSAAFramebuffer??t._framebuffer),t._generateStencilBuffer=l,t._depthStencilTextureWithStencil=l,t._depthStencilBuffer=this._setupFramebufferDepthAttachments(t._generateStencilBuffer,t._generateDepthBuffer,t.width,t.height,t.samples,o.format),this._bindUnboundFramebuffer(null),o};he.prototype.updateRenderTargetTextureSampleCount=function(a,e){if(this.webGLVersion<2||!a)return 1;if(a.samples===e)return e;const t=this._gl;e=Math.min(e,this.getCaps().maxMSAASamples),a._depthStencilBuffer&&(t.deleteRenderbuffer(a._depthStencilBuffer),a._depthStencilBuffer=null),a._MSAAFramebuffer&&(t.deleteFramebuffer(a._MSAAFramebuffer),a._MSAAFramebuffer=null);const i=a.texture?._hardwareTexture;if(i?.releaseMSAARenderBuffers(),a.texture&&e>1&&typeof t.renderbufferStorageMultisample=="function"){const r=t.createFramebuffer();if(!r)throw new Error("Unable to create multi sampled framebuffer");a._MSAAFramebuffer=r,this._bindUnboundFramebuffer(a._MSAAFramebuffer);const n=this._createRenderBuffer(a.texture.width,a.texture.height,e,-1,this._getRGBABufferInternalSizedFormat(a.texture.type,a.texture.format,a.texture._useSRGBBuffer),t.COLOR_ATTACHMENT0,!1);if(!n)throw new Error("Unable to create multi sampled framebuffer");i?.addMSAARenderBuffer(n)}this._bindUnboundFramebuffer(a._MSAAFramebuffer??a._framebuffer),a.texture&&(a.texture.samples=e),a._samples=e;const s=a._depthStencilTexture?a._depthStencilTexture.format:void 0;return a._depthStencilBuffer=this._setupFramebufferDepthAttachments(a._generateStencilBuffer,a._generateDepthBuffer,a.width,a.height,e,s),this._bindUnboundFramebuffer(null),e};he.prototype._setupDepthStencilTexture=function(a,e,t,i,s=1){const r=e.width??e,n=e.height??e,o=e.layers||0,h=e.depth||0;a.baseWidth=r,a.baseHeight=n,a.width=r,a.height=n,a.is2DArray=o>0,a.depth=o||h,a.isReady=!0,a.samples=s,a.generateMipMaps=!1,a.samplingMode=t?2:1,a.type=0,a._comparisonFunction=i;const l=this._gl,c=this._getTextureTarget(a),u=this._getSamplingParameters(a.samplingMode,!1);l.texParameteri(c,l.TEXTURE_MAG_FILTER,u.mag),l.texParameteri(c,l.TEXTURE_MIN_FILTER,u.min),l.texParameteri(c,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(c,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),this.webGLVersion>1&&(i===0?(l.texParameteri(c,l.TEXTURE_COMPARE_FUNC,515),l.texParameteri(c,l.TEXTURE_COMPARE_MODE,l.NONE)):(l.texParameteri(c,l.TEXTURE_COMPARE_FUNC,i),l.texParameteri(c,l.TEXTURE_COMPARE_MODE,l.COMPARE_REF_TO_TEXTURE)))};he.prototype.setDepthStencilTexture=function(a,e,t,i){a!==void 0&&(e&&(this._boundUniforms[a]=e),!t||!t.depthStencilTexture?this._setTexture(a,null,void 0,void 0,i):this._setTexture(a,t,!1,!0,i))};he.prototype.createRenderTargetCubeTexture=function(a,e){const t=this._createHardwareRenderTargetWrapper(!1,!0,a),i={generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:0,samplingMode:3,format:5,...e};i.generateStencilBuffer=i.generateDepthBuffer&&i.generateStencilBuffer,(i.type===1&&!this._caps.textureFloatLinearFiltering||i.type===2&&!this._caps.textureHalfFloatLinearFiltering)&&(i.samplingMode=1);const s=this._gl,r=new Et(this,5);this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,r,!0);const n=this._getSamplingParameters(i.samplingMode,i.generateMipMaps);i.type===1&&!this._caps.textureFloat&&(i.type=0,w.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MAG_FILTER,n.mag),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MIN_FILTER,n.min),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);for(let h=0;h<6;h++)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,this._getRGBABufferInternalSizedFormat(i.type,i.format),a,a,0,this._getInternalFormat(i.format),this._getWebGLTextureType(i.type),null);const o=s.createFramebuffer();return this._bindUnboundFramebuffer(o),t._depthStencilBuffer=this._setupFramebufferDepthAttachments(i.generateStencilBuffer,i.generateDepthBuffer,a,a),i.generateMipMaps&&s.generateMipmap(s.TEXTURE_CUBE_MAP),this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,null),this._bindUnboundFramebuffer(null),t._framebuffer=o,t._generateDepthBuffer=i.generateDepthBuffer,t._generateStencilBuffer=i.generateStencilBuffer,r.width=a,r.height=a,r.isReady=!0,r.isCube=!0,r.samples=1,r.generateMipMaps=i.generateMipMaps,r.samplingMode=i.samplingMode,r.type=i.type,r.format=i.format,this._internalTexturesCache.push(r),t.setTextures(r),t};const ri=[Math.sqrt(1/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(3/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(15/(4*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(5/(16*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(15/(16*Math.PI))],ld=[()=>1,a=>a.y,a=>a.z,a=>a.x,a=>a.x*a.y,a=>a.y*a.z,a=>3*a.z*a.z-1,a=>a.x*a.z,a=>a.x*a.x-a.y*a.y],_i=(a,e)=>ri[a]*ld[a](e),gi=[Math.PI,2*Math.PI/3,2*Math.PI/3,2*Math.PI/3,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4];class qs{constructor(){this.preScaled=!1,this.l00=_.Zero(),this.l1_1=_.Zero(),this.l10=_.Zero(),this.l11=_.Zero(),this.l2_2=_.Zero(),this.l2_1=_.Zero(),this.l20=_.Zero(),this.l21=_.Zero(),this.l22=_.Zero()}addLight(e,t,i){v.Vector3[0].set(t.r,t.g,t.b);const s=v.Vector3[0],r=v.Vector3[1];s.scaleToRef(i,r),r.scaleToRef(_i(0,e),v.Vector3[2]),this.l00.addInPlace(v.Vector3[2]),r.scaleToRef(_i(1,e),v.Vector3[2]),this.l1_1.addInPlace(v.Vector3[2]),r.scaleToRef(_i(2,e),v.Vector3[2]),this.l10.addInPlace(v.Vector3[2]),r.scaleToRef(_i(3,e),v.Vector3[2]),this.l11.addInPlace(v.Vector3[2]),r.scaleToRef(_i(4,e),v.Vector3[2]),this.l2_2.addInPlace(v.Vector3[2]),r.scaleToRef(_i(5,e),v.Vector3[2]),this.l2_1.addInPlace(v.Vector3[2]),r.scaleToRef(_i(6,e),v.Vector3[2]),this.l20.addInPlace(v.Vector3[2]),r.scaleToRef(_i(7,e),v.Vector3[2]),this.l21.addInPlace(v.Vector3[2]),r.scaleToRef(_i(8,e),v.Vector3[2]),this.l22.addInPlace(v.Vector3[2])}scaleInPlace(e){this.l00.scaleInPlace(e),this.l1_1.scaleInPlace(e),this.l10.scaleInPlace(e),this.l11.scaleInPlace(e),this.l2_2.scaleInPlace(e),this.l2_1.scaleInPlace(e),this.l20.scaleInPlace(e),this.l21.scaleInPlace(e),this.l22.scaleInPlace(e)}convertIncidentRadianceToIrradiance(){this.l00.scaleInPlace(gi[0]),this.l1_1.scaleInPlace(gi[1]),this.l10.scaleInPlace(gi[2]),this.l11.scaleInPlace(gi[3]),this.l2_2.scaleInPlace(gi[4]),this.l2_1.scaleInPlace(gi[5]),this.l20.scaleInPlace(gi[6]),this.l21.scaleInPlace(gi[7]),this.l22.scaleInPlace(gi[8])}convertIrradianceToLambertianRadiance(){this.scaleInPlace(1/Math.PI)}preScaleForRendering(){this.preScaled=!0,this.l00.scaleInPlace(ri[0]),this.l1_1.scaleInPlace(ri[1]),this.l10.scaleInPlace(ri[2]),this.l11.scaleInPlace(ri[3]),this.l2_2.scaleInPlace(ri[4]),this.l2_1.scaleInPlace(ri[5]),this.l20.scaleInPlace(ri[6]),this.l21.scaleInPlace(ri[7]),this.l22.scaleInPlace(ri[8])}updateFromArray(e){return _.FromArrayToRef(e[0],0,this.l00),_.FromArrayToRef(e[1],0,this.l1_1),_.FromArrayToRef(e[2],0,this.l10),_.FromArrayToRef(e[3],0,this.l11),_.FromArrayToRef(e[4],0,this.l2_2),_.FromArrayToRef(e[5],0,this.l2_1),_.FromArrayToRef(e[6],0,this.l20),_.FromArrayToRef(e[7],0,this.l21),_.FromArrayToRef(e[8],0,this.l22),this}updateFromFloatsArray(e){return _.FromFloatsToRef(e[0],e[1],e[2],this.l00),_.FromFloatsToRef(e[3],e[4],e[5],this.l1_1),_.FromFloatsToRef(e[6],e[7],e[8],this.l10),_.FromFloatsToRef(e[9],e[10],e[11],this.l11),_.FromFloatsToRef(e[12],e[13],e[14],this.l2_2),_.FromFloatsToRef(e[15],e[16],e[17],this.l2_1),_.FromFloatsToRef(e[18],e[19],e[20],this.l20),_.FromFloatsToRef(e[21],e[22],e[23],this.l21),_.FromFloatsToRef(e[24],e[25],e[26],this.l22),this}static FromArray(e){return new qs().updateFromArray(e)}static FromPolynomial(e){const t=new qs;return t.l00=e.xx.scale(.376127).add(e.yy.scale(.376127)).add(e.zz.scale(.376126)),t.l1_1=e.y.scale(.977204),t.l10=e.z.scale(.977204),t.l11=e.x.scale(.977204),t.l2_2=e.xy.scale(1.16538),t.l2_1=e.yz.scale(1.16538),t.l20=e.zz.scale(1.34567).subtract(e.xx.scale(.672834)).subtract(e.yy.scale(.672834)),t.l21=e.zx.scale(1.16538),t.l22=e.xx.scale(1.16538).subtract(e.yy.scale(1.16538)),t.l1_1.scaleInPlace(-1),t.l11.scaleInPlace(-1),t.l2_1.scaleInPlace(-1),t.l21.scaleInPlace(-1),t.scaleInPlace(Math.PI),t}}class js{constructor(){this.x=_.Zero(),this.y=_.Zero(),this.z=_.Zero(),this.xx=_.Zero(),this.yy=_.Zero(),this.zz=_.Zero(),this.xy=_.Zero(),this.yz=_.Zero(),this.zx=_.Zero()}get preScaledHarmonics(){return this._harmonics||(this._harmonics=qs.FromPolynomial(this)),this._harmonics.preScaled||this._harmonics.preScaleForRendering(),this._harmonics}addAmbient(e){v.Vector3[0].copyFromFloats(e.r,e.g,e.b);const t=v.Vector3[0];this.xx.addInPlace(t),this.yy.addInPlace(t),this.zz.addInPlace(t)}scaleInPlace(e){this.x.scaleInPlace(e),this.y.scaleInPlace(e),this.z.scaleInPlace(e),this.xx.scaleInPlace(e),this.yy.scaleInPlace(e),this.zz.scaleInPlace(e),this.yz.scaleInPlace(e),this.zx.scaleInPlace(e),this.xy.scaleInPlace(e)}updateFromHarmonics(e){return this._harmonics=e,this.x.copyFrom(e.l11),this.x.scaleInPlace(1.02333).scaleInPlace(-1),this.y.copyFrom(e.l1_1),this.y.scaleInPlace(1.02333).scaleInPlace(-1),this.z.copyFrom(e.l10),this.z.scaleInPlace(1.02333),this.xx.copyFrom(e.l00),v.Vector3[0].copyFrom(e.l20).scaleInPlace(.247708),v.Vector3[1].copyFrom(e.l22).scaleInPlace(.429043),this.xx.scaleInPlace(.886277).subtractInPlace(v.Vector3[0]).addInPlace(v.Vector3[1]),this.yy.copyFrom(e.l00),this.yy.scaleInPlace(.886277).subtractInPlace(v.Vector3[0]).subtractInPlace(v.Vector3[1]),this.zz.copyFrom(e.l00),v.Vector3[0].copyFrom(e.l20).scaleInPlace(.495417),this.zz.scaleInPlace(.886277).addInPlace(v.Vector3[0]),this.yz.copyFrom(e.l2_1),this.yz.scaleInPlace(.858086).scaleInPlace(-1),this.zx.copyFrom(e.l21),this.zx.scaleInPlace(.858086).scaleInPlace(-1),this.xy.copyFrom(e.l2_2),this.xy.scaleInPlace(.858086),this.scaleInPlace(1/Math.PI),this}static FromHarmonics(e){return new js().updateFromHarmonics(e)}static FromArray(e){const t=new js;return _.FromArrayToRef(e[0],0,t.x),_.FromArrayToRef(e[1],0,t.y),_.FromArrayToRef(e[2],0,t.z),_.FromArrayToRef(e[3],0,t.xx),_.FromArrayToRef(e[4],0,t.yy),_.FromArrayToRef(e[5],0,t.zz),_.FromArrayToRef(e[6],0,t.yz),_.FromArrayToRef(e[7],0,t.zx),_.FromArrayToRef(e[8],0,t.xy),t}}he.prototype.createPrefilteredCubeTexture=function(a,e,t,i,s=null,r=null,n,o=null,h=!0){const l=async c=>{if(!c){s&&s(null);return}const u=c.texture;if(h?c.info.sphericalPolynomial&&(u._sphericalPolynomial=c.info.sphericalPolynomial):u._sphericalPolynomial=u._sphericalPolynomial??new js,u._source=9,this.getCaps().textureLOD){s&&s(u);return}const f=3,d=this._gl,g=c.width;if(!g)return;const{DDSTools:p}=await G(async()=>{const{DDSTools:A}=await import("./dds-DwCXTB3r.js");return{DDSTools:A}},__vite__mapDeps([41,42,13,14]),import.meta.url),m=[];for(let A=0;A{this._loadFile(a,r=>{i(r)},void 0,e,t,(r,n)=>{s(n)})})};const Fr=new Map;function pi(a,e){cd(a)&&w.Warn(`Extension with the name '${a}' already exists`),Fr.set(a,e)}function cd(a){return Fr.delete(a)}function ud(a,e){(e==="image/ktx"||e==="image/ktx2")&&(a=".ktx"),Fr.has(a)||(a.endsWith(".ies")&&pi(".ies",async()=>await G(()=>import("./iesTextureLoader-CjaJLPsO.js"),__vite__mapDeps([43,13,14]),import.meta.url).then(i=>new i._IESTextureLoader)),a.endsWith(".dds")&&pi(".dds",async()=>await G(()=>import("./ddsTextureLoader-HyrebNeu.js"),__vite__mapDeps([44,41,42,13,14]),import.meta.url).then(i=>new i._DDSTextureLoader)),a.endsWith(".basis")&&pi(".basis",async()=>await G(()=>import("./basisTextureLoader-BZgL1qDr.js"),__vite__mapDeps([45,13,14]),import.meta.url).then(i=>new i._BasisTextureLoader)),a.endsWith(".env")&&pi(".env",async()=>await G(()=>import("./envTextureLoader-Dy75k5v5.js"),__vite__mapDeps([46,47,13,14,40]),import.meta.url).then(i=>new i._ENVTextureLoader)),a.endsWith(".hdr")&&pi(".hdr",async()=>await G(()=>import("./hdrTextureLoader-BTuqRXGJ.js"),__vite__mapDeps([48,49,13,14]),import.meta.url).then(i=>new i._HDRTextureLoader)),(a.endsWith(".ktx")||a.endsWith(".ktx2"))&&(pi(".ktx",async()=>await G(()=>import("./ktxTextureLoader-DMjs-eqh.js"),__vite__mapDeps([50,51,13,14]),import.meta.url).then(i=>new i._KTXTextureLoader)),pi(".ktx2",async()=>await G(()=>import("./ktxTextureLoader-DMjs-eqh.js"),__vite__mapDeps([50,51,13,14]),import.meta.url).then(i=>new i._KTXTextureLoader))),a.endsWith(".tga")&&pi(".tga",async()=>await G(()=>import("./tgaTextureLoader-BmfDIWUh.js"),__vite__mapDeps([52,13,14]),import.meta.url).then(i=>new i._TGATextureLoader)),a.endsWith(".exr")&&pi(".exr",async()=>await G(()=>import("./exrTextureLoader-BpOmAN3q.js"),__vite__mapDeps([53,13,14]),import.meta.url).then(i=>new i._ExrTextureLoader)));const t=Fr.get(a);return t?Promise.resolve(t(e)):null}H.GetCompatibleTextureLoader=ud;function dd(a){!a||!a.setAttribute||(a.setAttribute("touch-action","none"),a.style.touchAction="none",a.style.webkitTapHighlightColor="transparent")}function fd(a,e,t){a._onCanvasFocus=()=>{a.onCanvasFocusObservable.notifyObservers(a)},a._onCanvasBlur=()=>{a.onCanvasBlurObservable.notifyObservers(a)},a._onCanvasContextMenu=s=>{a.disableContextMenu&&s.preventDefault()},e.addEventListener("focus",a._onCanvasFocus),e.addEventListener("blur",a._onCanvasBlur),e.addEventListener("contextmenu",a._onCanvasContextMenu),a._onBlur=()=>{a.disablePerformanceMonitorInBackground&&a.performanceMonitor.disable(),a._windowIsBackground=!0},a._onFocus=()=>{a.disablePerformanceMonitorInBackground&&a.performanceMonitor.enable(),a._windowIsBackground=!1},a._onCanvasPointerOut=s=>{document.elementFromPoint(s.clientX,s.clientY)!==e&&a.onCanvasPointerOutObservable.notifyObservers(s)};const i=a.getHostWindow();i&&typeof i.addEventListener=="function"&&(i.addEventListener("blur",a._onBlur),i.addEventListener("focus",a._onFocus)),e.addEventListener("pointerout",a._onCanvasPointerOut),t.doNotHandleTouchAction||dd(e),!H.audioEngine&&t.audioEngine&&H.AudioEngineFactory&&(H.audioEngine=H.AudioEngineFactory(a.getRenderingCanvas(),a.getAudioContext(),a.getAudioDestination())),Fs()&&(a._onFullscreenChange=()=>{a.isFullscreen=!!document.fullscreenElement,a.isFullscreen&&a._pointerLockRequested&&e&&Uh(e)},document.addEventListener("fullscreenchange",a._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",a._onFullscreenChange,!1),a._onPointerLockChange=()=>{a.isPointerLock=document.pointerLockElement===e},document.addEventListener("pointerlockchange",a._onPointerLockChange,!1),document.addEventListener("webkitpointerlockchange",a._onPointerLockChange,!1)),a.enableOfflineSupport=H.OfflineProviderFactory!==void 0,a._deterministicLockstep=!!t.deterministicLockstep,a._lockstepMaxSteps=t.lockstepMaxSteps||0,a._timeStep=t.timeStep||1/60}function _d(a,e){Te.Instances.length===1&&H.audioEngine&&(H.audioEngine.dispose(),H.audioEngine=null);const t=a.getHostWindow();t&&typeof t.removeEventListener=="function"&&(t.removeEventListener("blur",a._onBlur),t.removeEventListener("focus",a._onFocus)),e&&(e.removeEventListener("focus",a._onCanvasFocus),e.removeEventListener("blur",a._onCanvasBlur),e.removeEventListener("pointerout",a._onCanvasPointerOut),e.removeEventListener("contextmenu",a._onCanvasContextMenu)),Fs()&&(document.removeEventListener("fullscreenchange",a._onFullscreenChange),document.removeEventListener("mozfullscreenchange",a._onFullscreenChange),document.removeEventListener("webkitfullscreenchange",a._onFullscreenChange),document.removeEventListener("msfullscreenchange",a._onFullscreenChange),document.removeEventListener("pointerlockchange",a._onPointerLockChange),document.removeEventListener("mspointerlockchange",a._onPointerLockChange),document.removeEventListener("mozpointerlockchange",a._onPointerLockChange),document.removeEventListener("webkitpointerlockchange",a._onPointerLockChange))}function gd(a){const e=document.createElement("span");e.textContent="Hg",e.style.font=a;const t=document.createElement("div");t.style.display="inline-block",t.style.width="1px",t.style.height="0px",t.style.verticalAlign="bottom";const i=document.createElement("div");i.style.whiteSpace="nowrap",i.appendChild(e),i.appendChild(t),document.body.appendChild(i);let s=0,r=0;try{r=t.getBoundingClientRect().top-e.getBoundingClientRect().top,t.style.verticalAlign="baseline",s=t.getBoundingClientRect().top-e.getBoundingClientRect().top}finally{document.body.removeChild(i)}return{ascent:s,height:r,descent:r-s}}async function pd(a,e,t){return await new Promise((i,s)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{a.createImageBitmap(r,t).then(n=>{i(n)})})},r.onerror=()=>{s(`Error loading image ${r.src}`)},r.src=e})}function md(a,e,t,i){const r=a.createCanvas(t,i).getContext("2d");if(!r)throw new Error("Unable to get 2d context for resizeImageBitmap");return r.drawImage(e,0,0),r.getImageData(0,0,t,i).data}function Td(a){const e=a.requestFullscreen||a.webkitRequestFullscreen;e&&e.call(a)}function bd(){const a=document;document.exitFullscreen?document.exitFullscreen():a.webkitCancelFullScreen&&a.webkitCancelFullScreen()}function Uh(a){if(a.requestPointerLock){const e=a.requestPointerLock();e instanceof Promise?e.then(()=>{a.focus()}).catch(()=>{}):a.focus()}}function Ed(){document.exitPointerLock&&document.exitPointerLock()}class V extends he{static get NpmPackage(){return H.NpmPackage}static get Version(){return H.Version}static get Instances(){return Te.Instances}static get LastCreatedEngine(){return Te.LastCreatedEngine}static get LastCreatedScene(){return Te.LastCreatedScene}static DefaultLoadingScreenFactory(e){return H.DefaultLoadingScreenFactory(e)}get _supportsHardwareTextureRescaling(){return!!V._RescalePostProcessFactory}_measureFps(){this._performanceMonitor.sampleFrame(),this._fps=this._performanceMonitor.averageFPS,this._deltaTime=this._performanceMonitor.instantaneousFrameTime||0}get performanceMonitor(){return this._performanceMonitor}constructor(e,t,i,s=!1){super(e,t,i,s),this.customAnimationFrameRequester=null,this._performanceMonitor=new nd,this._drawCalls=new oi,e&&(this._features.supportRenderPasses=!0,i=this._creationOptions)}_initGLContext(){super._initGLContext(),this._rescalePostProcess=null}_sharedInit(e){super._sharedInit(e),fd(this,e,this._creationOptions)}resizeImageBitmap(e,t,i){return md(this,e,t,i)}async _createImageBitmapFromSource(e,t){return await pd(this,e,t)}switchFullscreen(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)}enterFullscreen(e){this.isFullscreen||(this._pointerLockRequested=e,this._renderingCanvas&&Td(this._renderingCanvas))}exitFullscreen(){this.isFullscreen&&bd()}setDitheringState(e){e?this._gl.enable(this._gl.DITHER):this._gl.disable(this._gl.DITHER)}setRasterizerState(e){e?this._gl.disable(this._gl.RASTERIZER_DISCARD):this._gl.enable(this._gl.RASTERIZER_DISCARD)}setDirectViewport(e,t,i,s){const r=this._cachedViewport;return this._cachedViewport=null,this._viewport(e,t,i,s),r}scissorClear(e,t,i,s,r){this.enableScissor(e,t,i,s),this.clear(r,!0,!0,!0),this.disableScissor()}enableScissor(e,t,i,s){const r=this._gl;r.enable(r.SCISSOR_TEST),r.scissor(e,t,i,s)}disableScissor(){const e=this._gl;e.disable(e.SCISSOR_TEST)}getVertexShaderSource(e){const t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[0]):null}getFragmentShaderSource(e){const t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[1]):null}set framebufferDimensionsObject(e){this._framebufferDimensionsObject=e,this._framebufferDimensionsObject&&this.onResizeObservable.notifyObservers(this)}_rebuildBuffers(){for(const e of this.scenes)e.resetCachedMaterial(),e._rebuildGeometries();for(const e of this._virtualScenes)e.resetCachedMaterial(),e._rebuildGeometries();super._rebuildBuffers()}getFontOffset(e){return gd(e)}_cancelFrame(){if(this.customAnimationFrameRequester){if(this._frameHandler!==0){this._frameHandler=0;const{cancelAnimationFrame:e}=this.customAnimationFrameRequester;e&&e(this.customAnimationFrameRequester.requestID)}}else super._cancelFrame()}_renderLoop(e){this._processFrame(e),this._activeRenderLoops.length>0&&this._frameHandler===0&&(this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=this._queueNewFrame(this.customAnimationFrameRequester.renderFunction||this._boundRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()))}enterPointerlock(){this._renderingCanvas&&Uh(this._renderingCanvas)}exitPointerlock(){Ed()}beginFrame(){this._measureFps(),super.beginFrame()}_deletePipelineContext(e){const t=e;t&&t.program&&t.transformFeedback&&(this.deleteTransformFeedback(t.transformFeedback),t.transformFeedback=null),super._deletePipelineContext(e)}createShaderProgram(e,t,i,s,r,n=null){r=r||this._gl,this.onBeforeShaderCompilationObservable.notifyObservers(this);const o=super.createShaderProgram(e,t,i,s,r,n);return this.onAfterShaderCompilationObservable.notifyObservers(this),o}_createShaderProgram(e,t,i,s,r=null){const n=s.createProgram();if(e.program=n,!n)throw new Error("Unable to create program");if(s.attachShader(n,t),s.attachShader(n,i),this.webGLVersion>1&&r){const o=this.createTransformFeedback();this.bindTransformFeedback(o),this.setTranformFeedbackVaryings(n,r),e.transformFeedback=o}return s.linkProgram(n),this.webGLVersion>1&&r&&this.bindTransformFeedback(null),e.context=s,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),n}_releaseTexture(e){super._releaseTexture(e)}_releaseRenderTargetWrapper(e){super._releaseRenderTargetWrapper(e);for(const t of this.scenes){for(const i of t.postProcesses)i._outputTexture===e&&(i._outputTexture=null);for(const i of t.cameras)for(const s of i._postProcesses)s&&s._outputTexture===e&&(s._outputTexture=null)}}_rescaleTexture(e,t,i,s,r){this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_S,this._gl.CLAMP_TO_EDGE),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_T,this._gl.CLAMP_TO_EDGE);const n=this.createRenderTargetTexture({width:t.width,height:t.height},{generateMipMaps:!1,type:0,samplingMode:2,generateDepthBuffer:!1,generateStencilBuffer:!1});if(!this._rescalePostProcess&&V._RescalePostProcessFactory&&(this._rescalePostProcess=V._RescalePostProcessFactory(this)),this._rescalePostProcess){this._rescalePostProcess.externalTextureSamplerBinding=!0;const o=()=>{this._rescalePostProcess.onApply=function(c){c._bindTexture("textureSampler",e)};let l=i;l||(l=this.scenes[this.scenes.length-1]),l.postProcessManager.directRender([this._rescalePostProcess],n,!0),this._bindTextureDirectly(this._gl.TEXTURE_2D,t,!0),this._gl.copyTexImage2D(this._gl.TEXTURE_2D,0,s,0,0,t.width,t.height,0),this.unBindFramebuffer(n),n.dispose(),r&&r()},h=this._rescalePostProcess.getEffect();h?h.executeWhenCompiled(o):this._rescalePostProcess.onEffectCreatedObservable.addOnce(l=>{l.executeWhenCompiled(o)})}}wrapWebGLTexture(e,t=!1,i=3,s=0,r=0){const n=new wh(e,this._gl),o=new Et(this,0,!0);return o._hardwareTexture=n,o.baseWidth=s,o.baseHeight=r,o.width=s,o.height=r,o.isReady=!0,o.useMipMaps=t,this.updateTextureSamplingMode(i,o),o}_uploadImageToTexture(e,t,i=0,s=0){const r=this._gl,n=this._getWebGLTextureType(e.type),o=this._getInternalFormat(e.format),h=this._getRGBABufferInternalSizedFormat(e.type,o),l=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(l,e,!0),this._unpackFlipY(e.invertY);let c=r.TEXTURE_2D;e.isCube&&(c=r.TEXTURE_CUBE_MAP_POSITIVE_X+i),r.texImage2D(c,s,h,o,n,t),this._bindTextureDirectly(l,null,!0)}updateTextureComparisonFunction(e,t){if(this.webGLVersion===1){w.Error("WebGL 1 does not support texture comparison.");return}const i=this._gl;e.isCube?(this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,e,!0),t===0?(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,515),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):(this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),t===0?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,515),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),e._comparisonFunction=t}createInstancesBuffer(e){const t=this._gl.createBuffer();if(!t)throw new Error("Unable to create instance buffer");const i=new Ys(t);return i.capacity=e,this.bindArrayBuffer(i),this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.DYNAMIC_DRAW),i.references=1,i}deleteInstancesBuffer(e){this._gl.deleteBuffer(e)}async _clientWaitAsync(e,t=0,i=10){const s=this._gl;return await new Promise((r,n)=>{tr(()=>{const o=s.clientWaitSync(e,t,0);if(o==s.WAIT_FAILED)throw new Error("clientWaitSync failed");return o!=s.TIMEOUT_EXPIRED},r,n,i)})}_readPixelsAsync(e,t,i,s,r,n,o){if(this._webGLVersion<2)throw new Error("_readPixelsAsync only work on WebGL2+");const h=this._gl,l=h.createBuffer();h.bindBuffer(h.PIXEL_PACK_BUFFER,l),h.bufferData(h.PIXEL_PACK_BUFFER,o.byteLength,h.STREAM_READ),h.readPixels(e,t,i,s,r,n,0),h.bindBuffer(h.PIXEL_PACK_BUFFER,null);const c=h.fenceSync(h.SYNC_GPU_COMMANDS_COMPLETE,0);return c?(h.flush(),this._clientWaitAsync(c,0,10).then(()=>(h.deleteSync(c),h.bindBuffer(h.PIXEL_PACK_BUFFER,l),h.getBufferSubData(h.PIXEL_PACK_BUFFER,0,o),h.bindBuffer(h.PIXEL_PACK_BUFFER,null),h.deleteBuffer(l),o))):null}dispose(){this.hideLoadingUI(),this._rescalePostProcess&&this._rescalePostProcess.dispose(),_d(this,this._renderingCanvas),super.dispose()}}V.ALPHA_DISABLE=0;V.ALPHA_ADD=1;V.ALPHA_COMBINE=2;V.ALPHA_SUBTRACT=3;V.ALPHA_MULTIPLY=4;V.ALPHA_MAXIMIZED=5;V.ALPHA_ONEONE=6;V.ALPHA_PREMULTIPLIED=7;V.ALPHA_PREMULTIPLIED_PORTERDUFF=8;V.ALPHA_INTERPOLATE=9;V.ALPHA_SCREENMODE=10;V.DELAYLOADSTATE_NONE=0;V.DELAYLOADSTATE_LOADED=1;V.DELAYLOADSTATE_LOADING=2;V.DELAYLOADSTATE_NOTLOADED=4;V.NEVER=512;V.ALWAYS=519;V.LESS=513;V.EQUAL=514;V.LEQUAL=515;V.GREATER=516;V.GEQUAL=518;V.NOTEQUAL=517;V.KEEP=7680;V.REPLACE=7681;V.INCR=7682;V.DECR=7683;V.INVERT=5386;V.INCR_WRAP=34055;V.DECR_WRAP=34056;V.TEXTURE_CLAMP_ADDRESSMODE=0;V.TEXTURE_WRAP_ADDRESSMODE=1;V.TEXTURE_MIRROR_ADDRESSMODE=2;V.TEXTUREFORMAT_ALPHA=0;V.TEXTUREFORMAT_LUMINANCE=1;V.TEXTUREFORMAT_LUMINANCE_ALPHA=2;V.TEXTUREFORMAT_RGB=4;V.TEXTUREFORMAT_RGBA=5;V.TEXTUREFORMAT_RED=6;V.TEXTUREFORMAT_R=6;V.TEXTUREFORMAT_R16_UNORM=33322;V.TEXTUREFORMAT_RG16_UNORM=33324;V.TEXTUREFORMAT_RGB16_UNORM=32852;V.TEXTUREFORMAT_RGBA16_UNORM=32859;V.TEXTUREFORMAT_R16_SNORM=36760;V.TEXTUREFORMAT_RG16_SNORM=36761;V.TEXTUREFORMAT_RGB16_SNORM=36762;V.TEXTUREFORMAT_RGBA16_SNORM=36763;V.TEXTUREFORMAT_RG=7;V.TEXTUREFORMAT_RED_INTEGER=8;V.TEXTUREFORMAT_R_INTEGER=8;V.TEXTUREFORMAT_RG_INTEGER=9;V.TEXTUREFORMAT_RGB_INTEGER=10;V.TEXTUREFORMAT_RGBA_INTEGER=11;V.TEXTURETYPE_UNSIGNED_BYTE=0;V.TEXTURETYPE_UNSIGNED_INT=0;V.TEXTURETYPE_FLOAT=1;V.TEXTURETYPE_HALF_FLOAT=2;V.TEXTURETYPE_BYTE=3;V.TEXTURETYPE_SHORT=4;V.TEXTURETYPE_UNSIGNED_SHORT=5;V.TEXTURETYPE_INT=6;V.TEXTURETYPE_UNSIGNED_INTEGER=7;V.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8;V.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9;V.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10;V.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11;V.TEXTURETYPE_UNSIGNED_INT_24_8=12;V.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13;V.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14;V.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15;V.TEXTURE_NEAREST_SAMPLINGMODE=1;V.TEXTURE_BILINEAR_SAMPLINGMODE=2;V.TEXTURE_TRILINEAR_SAMPLINGMODE=3;V.TEXTURE_NEAREST_NEAREST_MIPLINEAR=8;V.TEXTURE_LINEAR_LINEAR_MIPNEAREST=11;V.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3;V.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4;V.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5;V.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6;V.TEXTURE_NEAREST_LINEAR=7;V.TEXTURE_NEAREST_NEAREST=1;V.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9;V.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10;V.TEXTURE_LINEAR_LINEAR=2;V.TEXTURE_LINEAR_NEAREST=12;V.TEXTURE_EXPLICIT_MODE=0;V.TEXTURE_SPHERICAL_MODE=1;V.TEXTURE_PLANAR_MODE=2;V.TEXTURE_CUBIC_MODE=3;V.TEXTURE_PROJECTION_MODE=4;V.TEXTURE_SKYBOX_MODE=5;V.TEXTURE_INVCUBIC_MODE=6;V.TEXTURE_EQUIRECTANGULAR_MODE=7;V.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8;V.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9;V.SCALEMODE_FLOOR=1;V.SCALEMODE_NEAREST=2;V.SCALEMODE_CEILING=3;const Ad=Object.freeze(Object.defineProperty({__proto__:null,Engine:V},Symbol.toStringTag,{value:"Module"}));class Es extends rt{_gatherImports(e,t){e?(this._webGPUReady=!0,t.push(Promise.all([G(()=>import("./pass.fragment-CTt6kMR9.js"),__vite__mapDeps([54,13,14]),import.meta.url)]))):t.push(Promise.all([G(()=>import("./pass.fragment-DOtTp0aB.js"),__vite__mapDeps([55,13,14]),import.meta.url)])),super._gatherImports(e,t)}constructor(e,t=null,i){const s={name:e,engine:t||V.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:Es.FragmentUrl,...i};s.engine||(s.engine=V.LastCreatedEngine),super(s)}}Es.FragmentUrl="pass";class zr extends rt{_gatherImports(e,t){e?(this._webGPUReady=!0,t.push(Promise.all([G(()=>import("./passCube.fragment-CZ0sbEYV.js"),__vite__mapDeps([56,13,14]),import.meta.url)]))):t.push(Promise.all([G(()=>import("./passCube.fragment-plsc4uSf.js"),__vite__mapDeps([57,13,14]),import.meta.url)])),super._gatherImports(e,t)}constructor(e,t=null,i){super({...i,name:e,engine:t||V.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:zr.FragmentUrl,defines:"#define POSITIVEX"}),this._face=0}get face(){return this._face}set face(e){if(!(e<0||e>5))switch(this._face=e,this._face){case 0:this.updateEffect("#define POSITIVEX");break;case 1:this.updateEffect("#define NEGATIVEX");break;case 2:this.updateEffect("#define POSITIVEY");break;case 3:this.updateEffect("#define NEGATIVEY");break;case 4:this.updateEffect("#define POSITIVEZ");break;case 5:this.updateEffect("#define NEGATIVEZ");break}}}zr.FragmentUrl="passCube";class Wr extends je{getClassName(){return"PassPostProcess"}constructor(e,t,i=null,s,r,n,o=0,h=!1){const l={size:typeof t=="number"?t:void 0,camera:i,samplingMode:s,engine:r,reusable:n,textureType:o,blockCompilation:h,...t};super(e,Es.FragmentUrl,{effectWrapper:typeof t=="number"||!t.effectWrapper?new Es(e,r,l):void 0,...l})}static _Parse(e,t,i,s){return le.Parse(()=>new Wr(e.name,e.options,t,e.renderTargetSamplingMode,e._engine,e.reusable),e,i,s)}}nt("BABYLON.PassPostProcess",Wr);class Hn extends je{get face(){return this._effectWrapper.face}set face(e){this._effectWrapper.face=e}getClassName(){return"PassCubePostProcess"}constructor(e,t,i=null,s,r,n,o=0,h=!1){const l={size:typeof t=="number"?t:void 0,camera:i,samplingMode:s,engine:r,reusable:n,textureType:o,blockCompilation:h,...t};super(e,Es.FragmentUrl,{effectWrapper:typeof t=="number"||!t.effectWrapper?new zr(e,r,l):void 0,...l})}static _Parse(e,t,i,s){return le.Parse(()=>new Hn(e.name,e.options,t,e.renderTargetSamplingMode,e._engine,e.reusable),e,i,s)}}T([R()],Hn.prototype,"face",null);H._RescalePostProcessFactory=a=>new Wr("rescale",1,null,2,a,!1,0);function Rd(a,e,t,i,s,r,n,o){const h=e.getEngine();return e.isReady=!1,s=s??e.samplingMode,i=i??e.type,r=r??e.format,n=n??e.width,o=o??e.height,i===-1&&(i=0),new Promise(l=>{const c=new je("postprocess",a,null,null,1,null,s,h,!1,void 0,i,void 0,null,!1,r);c.externalTextureSamplerBinding=!0;const u=h.createRenderTargetTexture({width:n,height:o},{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:s,type:i,format:r});c.onEffectCreatedObservable.addOnce(f=>{f.executeWhenCompiled(()=>{c.onApply=d=>{d._bindTexture("textureSampler",e),d.setFloat2("scale",1,1)},t.postProcessManager.directRender([c],u,!0),h.restoreDefaultFramebuffer(),h._releaseTexture(e),c&&c.dispose(),u._swapAndDie(e),e.type=i,e.format=5,e.isReady=!0,l(e)})})})}let _r,Ba;function S_(a){_r||(_r=new Float32Array(1),Ba=new Int32Array(_r.buffer)),_r[0]=a;const e=Ba[0];let t=e>>16&32768,i=e>>12&2047;const s=e>>23&255;return s<103?t:s>142?(t|=31744,t|=(s==255?0:1)&&e&8388607,t):s<113?(i|=2048,t|=(i>>114-s)+(i>>113-s&1),t):(t|=s-112<<10|i>>1,t+=i&1,t)}function M_(a){const e=(a&32768)>>15,t=(a&31744)>>10,i=a&1023;return t===0?(e?-1:1)*Math.pow(2,-14)*(i/Math.pow(2,10)):t==31?i?NaN:(e?-1:1)*(1/0):(e?-1:1)*Math.pow(2,t-15)*(1+i/Math.pow(2,10))}class Na{static ExpandRGBDTexture(e){const t=e._texture;if(!t||!e.isRGBD)return;const i=t.getEngine(),s=i.getCaps(),r=t.isReady;let n=!1;s.textureHalfFloatRender&&s.textureHalfFloatLinearFiltering?(n=!0,t.type=2):s.textureFloatRender&&s.textureFloatLinearFiltering&&(n=!0,t.type=1),n&&(t.isReady=!1,t._isRGBD=!1,t.invertY=!1);const o=async()=>{const h=i.isWebGPU,l=h?1:0;t.isReady=!1,h?await G(()=>import("./rgbdDecode.fragment-DhHWySqi.js"),__vite__mapDeps([58,3,13,14]),import.meta.url):await G(()=>import("./rgbdDecode.fragment-CAQSGKQb.js"),__vite__mapDeps([59,25,13,14]),import.meta.url);const c=new je("rgbdDecode","rgbdDecode",null,null,1,null,3,i,!1,void 0,t.type,void 0,null,!1,void 0,l);c.externalTextureSamplerBinding=!0;const u=i.createRenderTargetTexture(t.width,{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:t.samplingMode,type:t.type,format:5});c.onEffectCreatedObservable.addOnce(f=>{f.executeWhenCompiled(()=>{c.onApply=d=>{d._bindTexture("textureSampler",t),d.setFloat2("scale",1,1)},e.getScene().postProcessManager.directRender([c],u,!0),i.restoreDefaultFramebuffer(),i._releaseTexture(t),c&&c.dispose(),u._swapAndDie(t),t.isReady=!0})})};n&&(r?o():e.onLoadObservable.addOnce(o))}static async EncodeTextureToRGBD(e,t,i=0){return t.getEngine().isWebGPU?await G(()=>import("./rgbdEncode.fragment-Dp82zIf3.js"),__vite__mapDeps([60,3,13,14]),import.meta.url):await G(()=>import("./rgbdEncode.fragment-PqVu9J5Q.js"),__vite__mapDeps([61,25,13,14]),import.meta.url),await Rd("rgbdEncode",e,t,i,1,5)}}const yd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR42u29yY5tWXIlZnbuiSaTbZFUkZRKrCKhElASQA0EoQABgn6hJvoXzfUP+gP9hWb6Bg00IgRoQJaKqUxmZmTEe8/v0uB2u7Fm2T7HIyIrnz88uPvt3f2a2WrMbOvf/u3PvvzP/sUf/N6//i8vf/lv/3v5H//d//Sb//Uq/5u8yf8hV/m/5Cp/L1f5hVzlG7nKJ7mKyJuIXN/hPwqXI/g++zq6rPI5u8z+WqfLre+zy7PrVv9L8brsMiGvk8XLmM/sdfHXal4e3ad6GXPdyu2ij8u/+uv/5cuf/OSLfdtEfvUr+dnf/d0X//t3H/7bf/hP//N/928h/0Yg/4VA/kogfyGQP5Wr/IFAvhbIlwK5CGQTPP+9z5uPeePJSW+yo2+s/GtN30Rnv1E+f5zxof9R/lSXv/nr//mrr3+i+5dfyX7ZZQP07Tffys//8R/l/9TtX7790T/7r/8G8pdy+/8XAvnnAvkzgfwzgfyxQP5AIL8vkJ8K5KsmMVzu1U7p5PA5AXxOAJ8TwPf7sX/51ZeXfcemqnp9w/W77/S7X/6T/vzf/7383RWCX3/z05/9i3/13/0PX//eX/2FyP8tIv+PiPy9iPy/IvIzEfm5iPxCRH4lIt/c/393//9BRD6KyKf7f488fP74/PH544dJAF9cLl98IZfLBZtuqterXr/7Dt9982v95S9+Lv+gF/3i7Spv/8lf/vnf/vGf/dF/JfKnIvLnIvLvReQ/NEngn0TklyLy6/v/34jIt00iGJOBlxAsdvv54/PH5493SQCXy9t2ueh2ueimKorrFbjq9eNH+fDtb+TXv/ol/vHyhX4Fxfbx7euPf/Lnf/PfiPyeiPyhiPxxkwB+fk8AvxzQgJcIrGTwFsiAEXH4/PH54/PHUgLY7whgu2C7bLqpQgHB2xvePn6SDx8+6G9+84384vKF/IPu8iVU9Y/+7C/+jWxffiHytYj8VER+X0T+oEEBvxqQwCMJeIngo5EI3goIwVMIPn98/vj8ESaAbbtu2ybbvl8u2ybbdtluSECA65u8ffqIDx8+6G++/VZ/efkV/sO261dQXP7wT/7kX8vl8qXIFyLylbySwe/dE0CLAr65B/9vGn0gQwRMMqgmhM/J4fPH548eAezbZd/lsm3YtssNAYiqiogAAkCvb5/k46cP8u2HD/rrb7+R/2/b9Wu9yJe//8d/9Ney6S5yEZFdRL68/38khG/uKOCnAwoYkcCoEXwkEgGDDq7CeQfyOTl8/vhd1QCum26ybZtu2yabbrKpQvXue1yvuF6v+vbpTT5+/CDffviAX1++1V9sO77WXb/66R/+4V/dgkbllQi+aBLBV/dE8LWRALwkYCWCNyMZXElkwLTMeMkga/P4/PH547ccAVwuctkvdxSw6bbdtYDbTfSZBN7e8PHTR/3u4wf55vKd/nL7DX6mu3791U9//5+/gkNFZGuSgZUQvnKowKgLWLTAQgRtEniTuEfwaELw0MJvf3LQzynud+53uG+X6y3gN9kul+2y6XVT1U27JCDAFVc8ksAn/e7jR/nN5YP+avtWfq6Xy9f7Vz/9w1dgRYngiyYhfNkkgzYBWHTg44AEMmqQUYQKOmDaiCIa8TmsfmzB+DnZDQjgcpGLbti2y3bZHjRAdRMVvb/dcYU8kcDbPQlsH/CrbddfbF98+RPZfvLFnAQeieCRDC5DMvju/vmD4JkEvjRQgKULeGggowdHkAHTYxihg89vu88I5UeGAPSOAFTlrgPopiqbKPSmCKreUoAAkCcSePukHz590m8vH+WbD9/JP335k6/+tA86KxFchv8jMvhiogE4JQm8XhfKqOAqx5qRPyeGzx8/cgSwbXcUoLJtim27C4Oi93+4v6VxQwKAvl2v+Hj9pB8+fZJvt4/yzfbF9lPdv/wJnsE2BogmyeCRED40tGFvksIXiSbgiYSRRpDNDZ6BDI6ghM+J4fPHeyKAO+zX7cb9t4tedMMNAQju5V+f1uAtBSiu1zsduMrHy5t8ePsk3376KN98sX/xE5FPAnm7/782o0DiUINXMkCXCB7/P94/e87AWUmARQWVvgMuKej9t1RLBp+Tw+ePgwngsutFFdu26WXbbl+rSvdfbnqAiuA23QcBgCugV1zl7e1NPm5v+LC96XfbJ/1W9y++fgXjA3bDYXV+MuhRwSPwL3JLMFYC+HS/LU8HYrGwIhwyNOF12SvgM4SgztdifP85MXz+KGsA2C6X7aJ6bXSAOwrY5OYIqGy3d5uq4P5GhABXuV6veLvRAf10fZMPb2/y3b7vX7+g+9v98/WOBq7GG7RNAlYy+Dgkhhb+Xxp0sE8IAC4SGAP/TbgVJK/PoJPBnAiwPKxsXfbbnRg+i3s/JAK4Q/4b9NfLtomBAqCickMBjy7BuywAUVyv8na94tMjCVzf9KNcLl/0SeA6oAEYb1i9g+FtSALb/bKL8/+t+wxXFMyswqiHoK4ToIgKqslgpg1qUC0QoYbvJZg/B/q5v4szHmPX7YEAsD0CX25OwEUVm9xag1+agKg+nxQArnKjAtDr9U0+Xd/k4/UqH7bL5YsewrcBBiMJZPRAp6TwQgWfjM9vgRbgUYGL8AvLWH2gqhesCokeUmCSwPsnhs8fP2YNYMO2XeSmAWxy2VQaXeDmDIhApf33rD4PTUCuV+DtCn27XuXT5ir8VmCJ2G5BpBM8/r/dEcJb8/0lEQMtJHA5TAlqNuLRhJChhEpSqFabH3di+G1AGj+W1/dyAR4IYJNNnuLf6+tWC9CHHiAtFhAIFLjK2/Uqn65X+SS67aK+3QeTDoy/IG2ogQ7fb/dAtz5vBgrYGqrwNtCHsVfgIvwK07OTQBURVNCBFpKCOjqCHn5L/67TgTN+fpySAC56nwSUi256kXsSuFGAVyLoUIDo8/Pz7fdoErr/v17lk162HbgHvFpIYDfoAJJfW4sGPjkU4VNAF8ZEcLmLhdc7kljdY1y1Dq9yLiI4IiRqcLujb138KIPn80ejATwRwIbtBvn1cqv+2J78/5EI5N4cJA8qIPcmwRsKAHDF9WYP6mV7VmrgLuTpxYTcMEW0LAmoQxFsuvAI8tv/a/C5fV2ZMMiKg++FCM7RDPRu8ebWY7VG6VJi+Bzk35MI2LsAckMAgwvQ0gC5DQjd3ABg2HQLAPpEAlZ1Bu7VV7MGHDFRAbo3VKsTbAY9sPWC/uvx86gBbDK3D1eEQS8pbAeSgSwmhepnJb6uBv/o/PzHLzxWA/X7TH77De5j6AGQi6o0CUGfCOD2X7cXAlCFQABtEsGLDtxuOyQB2UTQBKZe5GUPXgkUYCUAbZJRhBDeuq8xBf+bgwbehDm+BFQi2IJksOocvA8ysIMfxluVcRsY/eB3JzH8GFDAXQO48X/dcIf9jyDHptIigDsFkEe066tBSETQUYF7ElDdYEBytN4+rk9UcBPfrKaZqFHWcw3i4J8/X4ev2//bSXqAhwTay6OEIPLD2Ipt8OtAGzxkwLw9WVFRjTc/qC6H3+YK/b1oAA0KuOizHfieCLaHHiAb5NYTIC9EMEbZrVEQt1xwhVy1UfBh8PUOquMizwaap3tQXfY5B//tea/NZdfhsvbz+PURQTDSGWB87VX/7WSd4KxjUqrIgE0IUkoKGnhIvwvawpGf6eECXJ7tv4qbA7DJgwpsKthEmmYgfaAAffYF3HLxo0vwNjJ0SwRWMG4db4eh1gPNm18vQ+us/0eGmxDemu/fnM/X4evq/8342ksGHgLY5LyT/zg0wM8lcMjgGFXwqIOVFJBQw99eCvF9oZL9Mfl3QwAvIXDsBRC9R+fz8x0FPBLB0xJEpwUobrfAkARgIAF41h3wQgP6QAmX5E/7eI43IxGwwf/moIkRyWRJQIPgt9CA9b39nzt4bYUWjAlCjWDPgv8IEjgLJfzuaAsrv9VdVG4OwOXW/fdoA35qAdL0BDwvf6AAUVHd8LIEu94A3K+Q+2YxaB84MOH62P//qoo38fCRDERE2zf0JfmDa+MieElAjcDPKz+mRKCOtdgGtXaBjgNJ4H2owSpNeAW/rRH4CaHSpMwnBYYycjgSJwfie9CR6mPu20Uv8kABF206AvXlBMiIBPSlB9wjBW1fwEuSb94296VCqgMaGCt/G1BbExi3IG+r3a3J6P48Gv/J0YmEYoiGY7V/SxwFCwGoE/xa0AJ0CEiV9QPCJb1OJ5F1VTjEY2/MO9AEJvj1BJTQpqLfTlGwjABuzT962e4IoKnyrdh3+/6mzDVJ4PHOxj0JqGKoy20+wBMN6D1gLWi9NQHfVP5MEEPzjGYy8BMAOnTAJgEr8HUIejRo5xrA5xkR5AngmiSHs+zDDAmMgWzTg55GSJEmHE8IvWPAoYTfhWak/Wn/bQ0CGLSAjv83SUEfKp5q24LXuQICpzrjrgWoza8xVE00CQCORdhMJuTUT/rjuls0gO4Iby8BIEgK6gS7BsGuTtDrScH/fR68biUHNVGBnxjeNyHEvQe/ve3LZQqgG3rof6cEclsNflG9J4KtaQ8WHcVBHS1BtHE4QP9OBMS98mpbKTeDW7dJwRsnHpMBTFJpV4I+b0kY/NqInVFSyBLANbnMSgBM8F+Fqfxq/h657/Up+GaBnwV9hRqc9bZ/vA6vu+T9E8KPJWns94UfTeCj2QXwCHS9dNL8Xf3Ho/rfewSeFODGDV69AU0y6NFAE1DP3qK++rdB7/1HRxf86gT376zOr99T/h/ioBiXWQkgQgVeIrCC/WomhDmQK+hASI2ARQZKooHMLdCJwGEBBXC3+uERwg+VOHZ9ioAt9H80AI06wGgJ3nQA3BoCut6AhxYwgcPOFnxuFnrphk+NIKIGrWPQtgz3b0i7Y6D5rs1GKqTop0nQX52vmQC4BkjA+r4a7Kx9WLENGeegkhSETBCrNXIMdi/444Rw1n6E96ry7OPuj8UfLxtQ78NA2iSBbg7gIiIbdDLsb5agPhLC3RkYKv8NDbS2YGsatNRAG2oQwf9ZIOydgy1MAzBkAw8UwEEIDzSAqdPQ6za0PkeJAMH3Z0wXniUSZoHvBXU2mcjQgv56TedIKglCpIoQfgwCIjOytd8WgN0bfxoR8Fn9Gx0Aj5Zgq0lIZbsH/ibSJoFnS+C98g9ooHEELI3gliy25yONIiE6pb0NfBlyNEYyENoodkKwgl6I6s8kARgJ4ZoEfuYWHLEJa0LhSBXm7kImGeSfVdoJ1DO2G7WXsehAptupSOoyrCSF904k+6vt98X/ZcM98Hsd4JYIXhQAIg3/f9AAUYhsLQKAtkHVBnzjCKhOoYl2ym+iBtvzDzQ2DLXJ4PUmbJHAVnBQX4jkxfvHhNDqAdHXGQJgv0aSDGItgOseHIU+K9hXnIJzkoGlEKzNHagTdJ6VWEUH4iCKH4fd2AwDPaYBm4Wgng4gQ9V/CoGiuNmD04AQtNGMGzSAAQ2I2pzfogY9LRh7BrbOh4+D30sAencljFu2CUFrwY8UAWRfWwGvVOVfbx2uIILM0pwDv082dUTw8hYs8L+uIWiHGpWgClnAa1lMPJogovvvbePPs/q3Xr++kgCsfgB5oQF9WYKPJqEn6G+OE3i5AqouF59FQOmahQC8rlPLj38kg1c2f30vw+XaoIX24/pMGIgSBoZqoH3wo0sIIGlA9PWcCPrAtpPB8eBf6x1o6cHra+2+tpIFP4PgBfxZtZUJfo4qxELT948D9ucK8Mt9+ccjIQw6QJcEbrD/1g340ATuDgDkFfx6twSf1f9xvuBECYxq/7ythQQGm+5JDx6Brw4CkMGT3wgscCUoQ4sU2t6DR2ciBjTgtcpenQoZVX9NuL4Owc+dVaDursYVkVALX+shjSBKBuvCYDUZjE5BdNkxdHAUBexyHwB6NP7Iyw7sxUDViwge1t+mz8B/LAvVx/c3PeBBCToB8IUGOgqA3iV4yUg6UAOxaUFHDx6CYS8SorMOue0CCJGAf5YfRhoAI+A1CvwxqNkAY5yAIx2EQmkFfeWOXi+nEdSQQA0ZHMEItiagJArQxDXIrj8nCfQi4HZPAttrIahso9oPQ/2/JwV5JQU8zw+7I4D7/sBn4EO6rjw0FR+i3Z9fHtahzsFvJgM0X+tmVH5vaYiNDGAigewAz+gyNLThnjCURQFR1b9d3lZvnVqmj9mEPDKIUIC4KCCjBXywS4N+otp/Hk3QVthOkwEKlV9PQwXjT7s/zwF4Qf9toAAzFdjuaEB6S7D1//U5FIQu2MevO0rQQH8ZmoXE6B/IkgE60XCjVoq8gt2iCG0S8L5GdxkM1cGsfsCMArSCAnrr7dzAZxCEEpepvB8tqHJ/q+bmJGGts/AcAXFOMMeTwC7Pw0B6CtCtA2vWgonqBQJFSwH0JQK29OB2kvgj2HHXAoyeAIsCQO0kMNECAhFMqCBf8mElAkyBbX1tJQP2RJ/ha0gpAfS9l+/5n00CkrQpq0MZbOdAuxmMvHswog62jZj7BnYQe19b14kxNq2D/ehX/p68HEcF+x3yP7z/V/A/q/5DA3i5A/dzA5pdgbKp3v3/wQF4Bb70WkCTHGRAA6+KL0bFl6FJaFw0ImZwm6igSwbbwPn9RMBWf3sN2JgA/BVh/Rg0kQBgePf6HglAHLFQwqQQOwDjbdVxNZjR4iM6Qa3WxwvNxh0JFb3g/WzFQQS8b/ttKcDWoABtUMAd8j9hf0MB2uDXhzX4CHj03L9DBU3Qjz0C0l4mLSLQPicOOwZoVCB6P6dA7nDbGkVuxcNr8PU2JQO4wX5trEqmccZaHU4q8oCDFOpzAnOwqyMIMktNNNAHouDGxO37DgArQZzlmp/14W1QlqHTMaIIx7SCx0+5yza7AKJ3IXBrNAHVDcMZAU/BT/vgv/ULPOA+XiLggAREDF2g0ci6xNDRglegd7P7TWWH5oJfayliEg7bScQRBVgI4Ookg/F6rvpLWP29swREqA3CaG8/FpKqS8DTAV4TiBqIqtxfzaQRLys5I0XEFIFrPbZRQb+16Fgi2LvJv8EFUPW1gGfQv1T/F/d/HBnccP7rAwnIIyHI4ArgWeGbU4eHy6Tx/EeTZIb5bo/BsMBjmjBE08f/RB0PHYBd9eVRAGY7cHRwiBf8WeCPHY1bgBTa9xKTELzEkQX9CPtl0gJiqsAmCT7I8xbjivh3JGFI+D2nBcSJQJ8agDX+O9iBL7UfG4bzAkcaICrbtYHz1ycSmGmAjJfL3CMgT3tQpmrfB7gxSzC1DnvdhQMieG47u75+kTouKNkM8c/+vq/Q7ZYjO/hhVvRq8F/9gGfhP8aqE9EIdR6LTwJ1h0BItyDqB8iFwuNqASscRnYioxOg9ApvnYA35f8e9Ohbfe8J4rknoFkO0lmA2gmAG0YK0DkB4ieEjiLoMD8wBzom27ANZkzIoU8EMHk/uo1mzeVoEoRWKn8L/62EYAX/lsB7D/LXg74uAMr9oGivJ0CNJCGD6i9DhZdQF+gtOp4S+NODRzsDVbhdgv4BqTMNyIL9SCKwL9/FGPp5oQKxIf8A/UX6r231H7YIqLML0Ae2GtrADOvRQH5b/MPE9dt9BGLNG8jVTAQvIaK5TtvvvWQgDvyXIClUA78S9Nfg7VtIBlO7cbsEYkQDMot+ygQ7QwmOawTHnAM2XUSnJvPIYRYMmYPS+sv3J+cfP3d04JYIXsF/EwMbBKB9Q9AY+BiSwFj9mzrSXmcJhFPVHySTbgHJCPvRQ/z7G/SVUETsg0ZF+i3CRoCjhf7y1A9mOiDD7TwdwEoEXjLwAv+avLE2B7Jnb+OqDpBoAchoQJskxKnss0vu7Q2YhcDv4ySeLOg9GsCKiUIihP7yfW7zbTsBh0TQfN0iAWn9f72Z56/Ax9P7j5OAH/Qvv3/QxKfk0DgDuP+R3USg3bzBC7bO/QT9Eeh9QvDPG7glBQzJwK740lAFFgFk8P88CqDGAa223YckWYhr+c0BPdwetl2ocnsfzePAWcVnnAIp6gDVhDLyfV4nqFEDPxHsbWD3k4BDkN+pARqKMLYBPzYEvxp9xmCHQQdgWH/9EtH2TIFpu3AH/cdGydv1j0TQbRrq+D/mLcX3ZACZ15bF378CG0My6Kq/zoGOQwhASDFwFbxyNGBuSxbCEhQ/uEPe/6gAERWQObCVVfjPpQX+rexxYhYFxIkgpgX7Y/vPs+Pvxf9vwt8kAs7i32t3QCP+3SPaTwIytQXP38u0PESm+YER+o9B3vr8mETAUfDrEkPI80ck0FZ0dXh9U+HRbhey0cAc2H7A4y4egoD6y8JfkBiigLdFP8v2W00E8deT2IeAKujZ/QAVKpAtKI20gLWksHedfgPcb+0+NEHefd9vB9rayi8h7J91gBbaw20MsnWAF5xHkyDUCOoXp+yrOwwxcKj0aL6fFppaaKDv6OpHR5sgx5BAlK/+fYhuP1D196o8e7lFBaKqv5YIMnFQpd0FGVR35RJCnCDaABaXBtgbiSwtICMtalKC+1JQ6bx/PLcDPQL91QFodQNKpwOgF/9eqcBxBBqRcKAAVk+ArQOMx1RYGgB6naDhlK+uQQwJYx4meQbxtNnYQwMjt/d4f3M9ZE4UOld1LAh99fbfzOxiEkKFCkTJIUIMUeVnJ/9sDt8/e1NEJOi9oVHDGYhgnSLss9DX2IAqw1zALUncKcDr0FB5NP+0cBQNrEezDiyiADPkt9qGpwoPdL0AGPx/NOKeyf3b9WJNdfcFv6bKd2cLMJVfJ6Y3B6wB9WFUfWWEwKMfGiQL+3bz9XGQz2EHKhF41GCtZyDi/gUCsNhYoAr3UNJ58YidHKqnMb/6AB5J4N73/4L+t7mAkeeP3P+1LNSB/l0SkMEd8DcEuUlguEw6t2AU/PCE/q++Akw6QFf1u6SBrj1ZnnhG50AfkoGIdf7gJv1KcSfgzWWkQ9U33Z3tHXYASKJ9e/YhU90rvD+q9Ej69/wxYJVs506Eg/r3DkMDzEdDBRGgcZay49XihLA30P+l8N+hf1f57/0AoxbQbwYaan/rBMirE9Dk+sBzTkC8JNDEUlv5McB8PP19Y01Gayep+hC/2zvQ/2HGLAurowsNGlA1cnqGGzeH5weiYLZm7h3QQC4O2tXdhvMMk1ZS5ebpgI8eMrPvPGkwaxayk8Yc6PMOBPEdC1XZ+2UfbfOPtxLMQQAG9BcZFoF0gp/RKjxe7+oAw9T7ZPWhgedodgz0gf5KBtrtIZhQAZpAV1Bi36w6t98qVfH7hqGI318lLCjLCUFlxRHwqYEH9a2qb4XjWvDT7kBwfbZA5P0+PNuRuW1yf4yNQH3zzwv6b70QOJ0G9OT/dhoYRUGT15uQH/71MjQLtQlxfDuiCXrtM+SkA+icQdH6sU/xz7Ze7FlubV4TpoTQ2osdpaEjtqADmEU7OkBEFoLeC3IWFFeswJXKXzkboNL+wzcFHU8hTGKIboO7CLi1/P+5F+gydQhuvRbwEgxvtACmANikhLTbj0gCYk8KdlYgmj+4Ymaod7TwahwadICuX0Cm2fE5iNHPK0x/CDV66Kyg1MnqjNFBnhBoLQCgUULfaVe5nq/6EQWY67bXCszUb+7232fVPz51iGB12owK9peyP1T4raMFF/OEYJP792mgXYfZ04GHMAhBkCSmSj+dKqRPgVFGHbpLEGMiGFeQWfSgrY52VxaeDUPSNJI0P7NoisG729HHl78z6hxfs9rV3m4JjgM/lsui2qmThjCfDFSb+I9vwUqG5wwL55U7C+6ot8B+7N2o6r3q37T9trfpjgmTvv7PSQATLLeRAOZhIJHBQfDQQJPBdUwEbVW3+L08EcEE/9G4ANrCeWcnPKRHDupbNynMx5AA9IRYLmrc/YLSiD5EaEBS/s/TgnU9ILcH19n+CpHwegLejx7Mn/d25fdN+e9U/1vgb7bqf08MOtf8EXxaoh+GY8L6gDfhvs4i6HQ7seYI2sv1GchdMsBIG3xlvxcCRzdgCPTn+6q/TW00VE8Q9FaFv+R2VlOM1vm/hhjhDCdgNflVKME5B47I9xT8z0YgPAJ8myb/LqHy36j/Mwqw9AALxuO1JVjiuQAYLcFzIhiEPe05fk8tRjGw7yWQbsfuLAT2VqOId1osnr0F49VM8INACPHDoBz4B5mqqSnUgyh3ArjXxfQH5BbgUS8gP7aU+w0zHD9GGD0CGHf+P1p/DeivlhU4BbxR9a2kYFR58YaDZCUR2P0DMmgED2eg77puegy6PgDphEB0CwlG/i9d+/Hs34pBEQrBn0W51mqGnJAk3ACCHeiqkQ1XFQA5AlKH7Lk8yJKWY3/nym14h2C3JvxeMwD9ZVMz0BPMi1n1RbKl1cYhIVblF3G0ATsRiCMUvoK9//OgcwYMoe+ZKOLlC6/Xk50br9NFz9fanqA8UIYSpCwlBO4kHc4WLLBfBHVaKwKgLQjmP4Un61Vq+3s7Bsyi0WztmLjJwJwFeE0I2vD/1Q6MVwefxfUf32skCPbCnxQqf+QMPEUDHZ7vGeyj020JgkPXXwsldA7SYR1RE3h94NvNtugswcgxXEkIcBPCGZ1rmrgDC0A4K88nm2fn/eTnpQtWyZfybRoK8Dro4zYDIMGsf7saTBzvX0SMbkAD6o9CYbsfMK38cJKD9l2FJt9/VGs0h5Gib33pxMKWNsigFUh3G2un+/N1WUglI/EEx8fq27vUNnwsiOoKecL7kQS8VnWAGCFUgn6dBtQhv40CmIYggwK0uwDHRGAuBXVdfwzHUjZzATLMAoyJ4FmBhzaWBlrHld9CCWpPHRqofBqMReMGTJ78q9rDes1Tv7/0m0v0AFHXNR6P6g30SHivin7V1BOhh3iWPwvps/yE836L2XiwnUT8x2iHgfqhnwn667QHEE8oLQjEvtEW7GYBZDrDVkwNIO4G5GiBDf9fGoFM6n+vbEtzXwP6u9AduaWnGYSLAlVdl/AU+ikrSeEIKgwdaZ4AACAASURBVKj4/wtgHcHtdO2nWKcBkPfxcvnNQvsj2Me9f02r76T8q0IBn9OLKfz1HX8yVXQYGoAB/2UeBQ5/5kCL6+H/OGGoRnLSwdd3oH8r7KkGTbgIxEwVWvnF8KOpHnyzfF9Jod5Px+IF1h8owyitDw/XEgRb5bPqbt1uvn7qBIQ16vtS/u+DP3cR7CH0WWJgd5mTJKYgNzoGjQrfvu99NDBC+bnyW1x/qhTatv2OaMKgJWPvv5kwnMgxHYGFRtJW8VMl3uP+MgoqSZyWFKr7+KIDw1d6+IiOgZI4+d5iYL3imzbgyO+tph9t2oSBxOM3ugHtPoFZ1LM0hF4kXNEBssvVgPdjdXZWK7uKvyS3q1Xb1WQwtVDqSUggq+Vw3t56JA2cz7PXOwGNW1ecwxPhfe3QEUsDsFaAz8jg0nf+iZMAHNg/XSazDuC18Iq1HBRrOsAQ8NLB+16g614jmuSgs3bROxE55D+WDDQNA4ivdMJ9M1b309UqknaDU8ObV9/PwmMPATvTMAxpABLBzugUtV9bLdhNDQA+7B9tQJ06/7QNDHGSwtgZOCIA47InIoDdROQGtt0U1HI3GaoUnCnC/rzBMQJteN17+VaAzYNA7e+PFqHQUyXPUYB7iQYa5ZFjq1Zqpx8Uqu/XT7+6BWC1Xaj0GlBIwMoHu7UzcI/6/Acb8KIq+hzmGWmAYnADrIpvKP7TZeLaf0LAeQkGgebbq9FToI44p654F47tekKkI0L5PQNZPsDwPBpy/ni+wKMN76Vav4+2cFZFf8+JwAraMt0DFB7beA/u4Zz/a+RXx0M/ct4/jwaNAS8G17eSwmta0Fhx0VRxJkHMivso+onMXr+YwdWKbgioy1jp4x4AzIKg5lEA7wvHEYCRmdx11TAuT6lDLVl4KvXkAET9P4RT8H2u+lg9EPQIpw+/NpJ7RwE8HaDv/Mu4f3OdNkq/EfAiEiOANjEALvcWL9gfFV4NZbgbQc6qPky4Pm35QZxtH1f4j+P/jXuaYPcWwIEH/fmEPBoAO4m4LGxV3txOQqDU+dXgey+UwSzuqP++uImO/u/6ogCb7wTc1n61sL+vZi87rxnrNas+giTg6QLzaUCjIp6JfhwtGI7AjBBB9JjDY4ePYVR6ZPgN4owVv6Q2N5hhVHwNeYrM+w6dN6K1sMHZm/Ce7bHe3dzKr1xw1w4JrSQMZtgnoQHlr18fzunAszD4qurNUg/TDqzx/lfCaO6t4tACMUQ6P6htWjDPC1hCoZ8kpODzJ70MUR9AODcgwyqyPhmE+wfHYB/hvSqt6qeXUShhXH+d9SR8DzrDaZZdpSp/HxqLMQuATgDU/qDPRgOIeT8cvz/h/XC6BtE7ACLOWPE0KIS4UUjmZaJ2grBphiWgT41BUVWZfP3AnEIT6OrfoF122l2rMycBoU5i/OXoUZ4/aglsXwLzHNU++FVF3qikOj5HXm2PBitT1WuvJRAB+6O//W0/PY8vQH5IrAsMs/WuVmAdHBrQgrbOxJShXwRSsu08h8JMBpo0+aDTALwV4tbswgzHrftG/dJKIAQb5h9KCssWIMeto+GYqG12/HWGjx8kzqNJaa0noMWOr2KwW01AMwJoNvhMQda2/RKQP/3ecABM3g9uD6BY68Ntz9+nDOMb5iV+hIE+dP/Zs/wwJhJ9mgBnohBuStABUXjugF3hkXF9ZZJAjefKdHZCc389LoStKvIl7QIEb1d9RyciQgFDI9Cjyccc/23Aam7/PZJBhgDgin5CtQvbCzX8ip9YgIFtOAt+w0owp/hOiCWgEGbVHuYjRigPGR/YOnEoqPDoV5z5YqB3mRq2ox5ICmSSgAP1Ne+XV2NE+/vuFbCTRADxtS70VRBCjgBk2OyDUQiUgfl77b7DwaHm2rAZ7osRSOOUoHgKfNBSLI767+oDYrfwZvqChSpGfj3pFwZFsCJg2jeIQQBUiyI4WgD68ww4qO8khuWkkIuDrxWv2nv+UTBpJYiPd0KemTA8qqFiuUF1jWS3BoG6pADJq751JqBI0wvAVPyMQvjcX1zbELltKK+zBiXRFiRxG+b7q3M9xuLdzR8g0gCGNzSM5gNYfqGO9CBT8OHct6oB3KsSDBisUnwsFuISQaRHxDSv0vptt2oeLHMERfRn/FG/Cx01EpgIQG8LP+/i37PKw53xn6sYCM4/JwSRrCnIeB1ZkLsawDhaPKv/njU3wnZ/dBdGE8+YTHSG8+ofGgIjsC19YnwdM/KAnTSsqj6ig7uGgIPw3nYFzhhIIvriAxFP9CQd4HSlnzgxONIdrE7A8ZDPx9fjib8ifgegNIliRgdx95+E1T7+3nQVNNhEzDgGA3T2rEDLduwtPpuuouPcs8swwXFjdTaMKt+jA5gUAQPcf95KJQxYU0cYxEDvsBSmYuukp7AwnqniC9Afa5z8vboI68ImT0t26CvwBzSggkj447r9IojvCn7U92J/Hw0QSdwZKNNjxPCfSxRqnATkdwpOwh88oc4J8KTSm/wdbZjrc+4iFP8YO0/5JJDCfaijK5xVXevqfg6zGRrQf83chvX4aRfAE//6vv5+6490U4ADdO7QgM/5bcHP/n4OtCQhBEFeDWSvos8DPq8/IwzLzjpa8/U6MMSkBklDm8e0mn3QIY7XG1Om8wzN48y7HwhOK3P0/ZwUQHHv4psbdoVeb9VlAjChBCdtDDpOKTh9ZfcagOYq31RFjN4/gwBYzp8lAwYNwBELhZoxECeZxMlAzWGdCRV0fQWGHo8+8Kx+AAxnCIzowAxy9KvNepWfsfp4RR9kUrD88CPVTuXRybhqqTHcnxEGndsgub1Gdug8yz9fHt3Hpl57x/mfCOC29FOSQ7/noAZR5W3Ob24UMpuPYAYiQrQgk1gnFoUIKr4vKFpV15pHUJO3Y5rfH3UFHU4bGkU+NKJ9f2hJyOMxDBDpjAgwiYqvk5TqNl9EH2Arb6fA3yaA4cBtPWewhkEcIQJBlGzYp6zRmr1v+e3Fv27xpzvyI44NGDkCIi7CGNV9Dw0M8NtHC2vUwHINumCGNG8erxOwtQINsW88Tlwdoc+F85nI559ngEDpt2F/Uu3hiXYrkN/pBFS26hYDAkFgErMK67y9mGBA3L5ore5izf8b3n805MOq/t7XU4WHv1DUF/5gugCSOAIW/59uMwl6CHWAib8bvfxWl9/rBGEMTTwDfG+ezEYG4yk6FvRPuPwE+wvc39IRjENWM+/cm5b0W4Pf4WuKUnw/vD6eDbB1ETs5vl77Dhnm/51g6wPWwQAqxnivgQaeS3gy/u/1H4hpTPrIgHAN0mSgXUX13YP5PMIuQAfBr/f70cdeE+QoCX3i8nFMLcAjInBoAIYqt1LhC1WdtvmSab28AYffaeivCB+ohdYQgfUa/WS4ToMsNLHLc9nnvPZLwn1/EefPVf+U/xvnCVSEQEkEQEnEQJO7S7RvYDxNeNYKrG7DKMhtsQ8cMmhgPKKKj+F7CiHYFR5KIIPxOmg5IVAtu3ACQSPh7CzUQOgAej5CWEkIe3vgxz0ROGO//qYfz/dnLT+ZxDr4QW0eNCJBorCFOVC312Ec2TiY5Bk0cAaQmiA1VH1MOwDHQ0kHdEDDf+2UTWhS4Z8diQMicLx8MLBfverLcP/jQzF0P8EJj5+NGK9RCz755S6F/f1+X/gxeP+Wsedv+vF8/54aSPJYFjIQd624MDz/UDLQnr8HU3ztKHRf8Qeno1vyAQJBaLcMtTV3cvgP56COCqd/QP9xLgBkH4BxO13n4hNUDtACC6G1S3zqooZ6Ba4lp/zcAFb7iERKQwQcF39IFJjdXECGADw0IE4gg674pYAnk4HoHPx54tD5daO5vxrugSkMjgiiqc7TVKAT6AT8R4ckbHEQCYR/IZBxJgA+XZjsR7vaoRpIxWqeqfXuGC2CxwudicwePEB1kNkaZCuwyF0DuKv/4sz9mzP/Qxdg3BDkBTMC8Q+loD6UGBzx0Kz6eAX/KArOQTlPHFoI4vVtf4rNuLrca9edRn4xBP7k8w+9AgZCgBfEUZWfEs8iFNZ3UO7TqmkjCO/rWdgco/yIqHcQWaC2EGTzgz5y/iXQAvyx3riyxxV/JeBriaGB9OrTA5g9/eokM+37GszqfA/UZk9iW5UnCtBqBl3XoNN6Ag/+zy6A5evPAp+TIFDn15gQw9rjrOzFX0s2JBVAxa/nP1a6AsNWYGjPNGPLTQgBsNUFvOA3Ht9o/rGDN0tWOCcxJGp+f7++kkP7PxcGv1+GjkaLt/fawpwwerQxBJNW4b+PJsYEgiAYYdEAGIlDNaAbRkIgK3ut0jKByp+8yz23X6GttmBmjwDvChgiYLP5V/zhH6/110sGcKo5CkggCngxnIPoPja0j2B+1BRkiYJiviaLJqghDI63G2nAgAxMCuDdnoD0wIQm+urMB3VuAwbBrFGgGgnhAFqg9+ujKsLxB3qGCQNEEtPinIQlAj4WgIw7/iXc9V/x/yUWFs2KH504bAh4aYWf4TrTLGTy9YbftyLeVOWNfYNyt/ji29mQnqMAltU3ioTtbX343yv/1u0YPUBz6zB702tQucnX0gWaFh6DgPdmhXaapGotw0SFz1qDiTMdd8h45HfcqCPRUhA3+NmKz1l9teCPaMd4urGaewRitNBDdahR5c3AfQmDCFT9vmtQEwqAYXX4XI2n23Z9B/Yb1FL+LWox6wHGbZSo6FR1LzyG+3hriSZvWT6jfXhl2cmQZJDrAbuYAqAHo1GA/EOgD8eGcU7A8eDvH4fQBuAhBL/Zp/vamPTrRENDGLTV/7E1WEPLDlP/PwzU4YhusIMUgfIPAr6Dhv5R4y2r8ldFwiFoYHnmr8TAHbhRQSZOctH598ZYhqt6wP7q/ouqe77RJxvzFYaji/z4vna4v5cUMDXqDAJ5ytktqtBDckyjvJg04hl16LB0xFfyMfD77PZjErGQRRjYIfSvoAXntks0ok8MsUC4KARWnYPlJBeIgLeFrUgDOHYCag0/XNAbWgRwQuLAsaQwIhC1g7+jCNKuT38JfnYSyTi+QQEwwHeT4/dWHYxJPxfOj5oAnRQqgU3YgGZSOaDyK3n/qkDYBKptzR3oD6B4fyRKjp2AzSl80YR/3P+/1vBjX18Jbu+YsrMRgbqPP8zrDLTAaupphfeZtyPs9BPztpLSBZjowF3woYRwBwOWaqbev15b7X4RWsiqYiY6ZkFEIoUwUA2OrkeEQE8HYNyD/rl3m88jCGgO/nPW3xy8x4Q/HBcM1dYg5q8N+B/SBSYhtD0EY1PRGLDoKIBHF3yLz4H/gSYQJRETgqeB2d4vC8L2NVnQn4PoVJJAcP0inahAfdXVI8CFszjRagCTtRdV7Sr895NBpRKXIT64RMFw/iw5eChhEvmmyUIH+k+Qu3cLzOAN6ILlFvgWnx3YWFDz0f38ze9GlfP6UQ3ojEY0gtqRIEbA5/WgQFhsEuIeL75uTzvqHktAWfj/OD6sQXssROcGiRgFn0QVkld7OznMDT7CJKzhMIqxW9B+LCOQdH4uyxIcE49VTSeLj0wKjzcp2oDXQA8YoDEGBLMW0BJw+eAxXejPV/IXd59/tp5rVyYXDw5BlRetSpQAcvgfOwVM8ObzBq/AQ2wX4lwkQV3vNhYFfn2LFgaoDU1ogqsfqGkJYmrj9Tr22KQwBLzbLuzDeA9yzyJjVRfwegWq0H+FThDPA6ZhZwX2M2Kh4waovCzAWJTzD/qY00c+6PM8coz08VNqglzx54LfHuTJK7z2rwX35ABLg1DzsZ7Qv7l/f2yXDlbf4C/irg0MJ0aCuD0wP74MrxfdFlX7tq+vtRdCpvt599EG9Yz3V+P+Oj/n4zLruZHcJ7oMt/MNp9eD6HEeFb6/TMfbWo85Pb79HJo8t3371/PuIAZqMvjPC34nVV6ZB4hEuA7AzA5cfU0y2n6ux89D/35/n2/vWY5Bf0qwf3tPLISO1Tap9qzFB6eap/beqI94NCCbGwgqOItY3CGl446CaQ8i2Q9g0AvmgJOnBoAA0gu17tsKtKS7D4udgCYERy2QIceCX/P7mBW+g/7D9S6Mn50CS0eAoQPDcBjopIA5+EcxEjLweRjXq0UbLIjcBxsGx2IZvlf0ATjz/6qypAmY7bhrk4ahsIis6ccXKHdueAfUgk+RWPCLh42c6zEeKyJpRTdRAOqBbl/Wq/uT+q+Fx3FoTIuCzc6+hN8j4veGjuAnhSE5gKnco3A3XwYlq2sq+lmP4yEOpqEoG0M+mGDYuYT0pKCFHgLHKt3T7T9p8GcWH+n1UwGa8X6kQt2x4CeqPexegT6o/Z4Cr313PHdgrsS2ZReLfpKIf+IMFnmVmwxQ9AhithYT73+p2s+JIVfrjwiHnpAZrSsr9CMstQXP1+1+510N/q8E/YoekMN9OMFvi5LvkRDsy9rgFCOoPdpgaQIWBZjf5KCSQszZJ1ivTvLokpen6tsJAVND0NFqb6GUGg2Im4Dyx9Pn7/0dm4pADAslJzTv+dKNrAPQ0wyySm7bj1RQgbAXsRa4R+mBJzpaQmHLmy0BLoL+Nh2ZRca8uUc6P37k97n451fvTieAE8BdZ2ItqFEK6oOJIYPsiU4woo140Oh+H/UC++gatHYcOFT+2y3AYvD1rM/fpxdUcsAi70c0OxAEP45X/hymE9XeoC0zfYhbcqfbhs09HpwnKMDR6g0mmYyKth/UcLl9ITGQ8N1S6s+gA1HvQCc2pluPvN2Br8SyZyfyxPP/VhCi1L1HWX2CQCuAE8TIq/sBYdANZmTIwqq0sb0HIzhhugBeUpBZLFyA8y+EErsBUYDZHYN9QAAooQwOws+uQlhdESSSqk5Qsh8LSYI6LDS1AbmOvLlRBqQIeITvM36+TP63VfE5hFClCTr9zEyVFwS3STQBy66DMHB+PJWIrfgGnYBx2dTboPa2X49GaBVlePA7CFx4iaGi4ns0aLVjMGvtPTDtmO4XEE8E5Kb/8qYai+NHl60LgAICcUCoJPVeiYG6Pxw/X9VFNVbFn9FNPzXoIRDTyzcpREYB5Fm1EQQn3KRi9wKApR8Tz48SwxnV3qM0q7ZhpdKvr0zfY+gO4oQf+EGPFYW/Xf5hwWsUgxiBbShGoGIx+D2eH1h2EeR3UQMH4zMaUKr4033nzkSkfQADelFbLOQCalxdxvN8mInhPas9bxtGJw29Fx3Y8429MAS0fL33Oeo7qFZeiToCC3B/VSNYuU0fgDnkhxGgMFdxiYEY7MYel+OHPH30IMeVFK1C79l+QdXVpFqHlMAXEf3EYDyfkkGdNvJ8f3RAXU0jpgM7jMNA5yCrtfzOicKG/M9bgEkEjqqPPDEcDfqVwGZv6zcO9avDfOhf4OmLFd9OLBHHdxp51HvOBlnAoQksYjASA1xnIhPsapTCPjbsGB2YevpPpgM73EYeSYIftgPgte6CWesVBB9QEgfnWYMgoeC8ql69bWoRIqYHvSIv/u26bj/jdqZ9KSGk74JRo6QS9PuTiSHm6Z62kLUGH0UO4rwWrhtRETkR4iKRdI8giJ2D2nUCMjsA0TXiVDb98NAf/rCMlajA9wesWHZrAe1dlwRyVI2jx4KkyUHSx7YDe6YD4tOC6XW01puEdAJwaEJzf1uATHi6ZlSCpBQscsh6C1xRcWEG4bCFeKcAVhVlDu54JQIkTT21hptIT/Afk0kMcS9BKfjBJozcDXCrtgbWXxbMAw3INQIxtQJPAGwXmYaBbYh4SCsuKwLOAQ5awKskCMmRg8P3xwlBfbosQaDqyZqBkyQe1CLQACoTgN4qbyHsPwkTiF2pYaj6MAXBmUosQHnUEYCsBL3MW39SNKMJ5PfoBsT33DVJCEbFnBCMOkHfvj6Xq8uw+dgRIhGgAiUqf5QgKDFyhe8nnYrlqn9sG1GoAfirubygX4H+8IM1CmQrMFAJ5ExzKIp54nPoVU2Auh6eBShDlTV4u5c4HE/fVvjFrsII0Ik6QX+Iq68jB19ziLoKC27FYe0gC+j1RSS+BgB7AvAM3m8HLdy5fV60C8RMVuhD1ieQB32MCCq0QPJuvuw5IHF/geMKwOPdpmsxBwVEfGEOgeincJqNmuSFIPhPq/xM81CWIIi+gCFBqDX3QPYd2OcCRo6GZBoA3AM+00aesAOQ7/2Pe/vBCXoguD4OBD1WfPwClzcui12AuH+gC0gEwW72KfjBCQRBr05D0IQc7N8PzOCMehPWK384MPVDJQim7yDdoiRTItzzFV/ZOX9sYFetP0fsQzb6O7wOoFjxk89YoQXv+BmSN+yYHYO+BsDRAXHhuJXsEFbdIEGZQWUkNVNzGA9NZUVBIQL7jASR0AclE4Pb7JN3BO72mG92+o8UG3nybj+mASh0FsLKn9GPxDrEcS2Au35BzHO1BksriIJdpqWjKR1wlpR4fN977rZqI+XbYjYDgVDpcYQalOYKMiuQbB3G6Pu/HlMbi9a0EMkksXtjvvXTfgMKAEZRN/i/O7yD8Da2S2Bdh3ICWfp8yuMkYl5a4df4vVWt4UF0yyqEnaT6swYyWB8/j111Y1ERS9oB0SLMtBGDEBD1PEHwtdjUEAHnqmoHU4wCDAoAS+lHwtu9eQLUAgmxVvAuMB9cELMV3m8EUtcBYYI9nkNIEEJYrQeUHfnzzRyC39j8CgSkir/E0P2odnAmAqDnDIhqrtV9BDNS2POjv/0pwKr6z1h/PMz3uf9ykFYq9TtoAXSwpz0HljdvBCVAPY6t7osv6gFhMpkX13rcfXQMIpuTsfTibkfOPRAC2meLRipI4mDPwMD5x+v3+Ey+qEfACwoUEkKQSMZxYJDz9R68PyP43yvo2aYf881rNQbZgRU/jp80QnW/hdXqJxMvCFxXQSNHpE8QiF4XI+wFfQcw7VL2Md7RRajsKgh2D+6SLAKPF356+/7yXYBTUgFy/38StUjFHweD+iiHh8/LV/i/TSvGk4L5x7F6AsIKbgb4C0YjgdGRIToGUx7cgS3JKP8pRcgak95BJGQbjaJdBYQ1qHYnYHL8F45QgHx2gLMQ2cDxBD/4SeR0LSDi5XzPQNjM4ySE/HGG6g+ugltLNSARn281BPtNO72eJLjdX4ITSEgpQvJYFEUg24f1qAYQNQdxx6Q/RcB85j9f+03zf2QV33IDPHegNgPABTfqFR8cZK9TA7/ll0EQbUUHW8Gr1d+MSadia+LRHwhunv87yWoJ3h/pRDwJAbDNQQFd2P2mH4kP/wDT/ZeN3CK3+ZjvgVpw4r20AMafb58j4N1UMknuj6iCx883PU9g2VHVH5JX2eEcPghSgRBCKPzK0Q3fknwPN0Hk0CyC0zBkz//7duEetgFjVtypASDI4CsknYJgYDhqsBxxy29+eyxrAZX75EEf8f+CkOcijMDDHx4ASYGGu8WHgPwpHJc0qOG8FgFTuVk0cRZVePFwHEIUEu8xSHoL5qWg4I7/HgOKXe2dcnu2SSdCGIDTA+AcxY1zYL6Q6AAFu+/1GvjKPSeEoJV3NiM4Dz9C6oWkEav+NWjPWXNOIkKgNTi2I8LeBgaZHJxqrC4oNXoB9pzzMws/OW3ghSyQJgjbygOVEDhoj4nHLld8HPD6UUMFVLIgKrTL7cFoBRLQgEdXIseZ2/HhFPKbk4d5tYWwwR0nIFQSD2P5gQhs6meVfB+Bkyz2fOIvX/zxqsSODuAGIOLtPNnmIPCrv6Kqvgz3q4tCwNl9lWYfnsdHj2HTgQw5IBHwULmfSu1jEV3gDFSxTBmqSEVqiYK2IkWcRiAkwV/cyW9YhqHXDw9dkNQAcO6HFNJT7oChfrPUYc3KY17zAd+evAwF2w5SCKLV4EuCEKsKfjBVWHu9Q9Arh4CoBqEMWYBsNX7YgKP/69uC3M7/mOOz232QT+ox4iCyJGEFP4oBHd+GVvXBwX35nqp7qeIbV6L6tdZub3ueJ+gBIKgC6S5gOQFxDoGr+Bv2nzqbknd7ph/EmXzO0o+kZdc/wqvQkAOUffVMzKtYgx5Vob1/+HAfCdzHSiXHenX35/2JTr3KZ9Ruj2lYiMhLIFoNyMq9hFroeYMTE0bSLbhb4l3YlFPa6hMd2jk8dmrDgdQCnC4/+ANFlYTB6ATlx2GDGXP1rvL+SnWHw+cJes5/rRWt4H2pw9GklD4uSMpwasIQiaYR92gIyFX5S8dtRZt/nCAH48VXW3hRE/HKOsGquj8EM85Q9cfeAV4XwNGAlmIFIwPYrfLKuxV476RRetzcdeAsRSZhiHizCKEIOHn3EMOWy5X4uIJnXX6sFiBFLaBm/THOQAkVJK9j6TKwiSDTBWpwHkSPQJX7U959uAkoaTUuug6oQCBz1Zlxm0OJSIoIw04M+7zCGuYiznCfHww9AN6Ir+HXA7lfn2oBSJ2FOOh8SzINfmcAyITq8JX/sOMPx6A9LeYtVfwgCBZhdu25OB9/XmWWNPUEPD5dUuJ68wd1AqD2+w1PI9KxE9BW5t3z/igdYGWiL7L+wPv9jgVY8f0ZcbCKCuLAHN+c5wa69Zpr0J9t2KnpAGzyiAIPiFalJ8/xXrrA6Y+/8NoDnWCPNwFJzf5DpVkHte8hx76P+HU1+HEytEeSEIzAsu5r6wPJGu6oLz8VrKofXLce+ywIHhNa/Dmw8LrptWXZ4NKZm4pr/QQ7Qk8ehMrPtAF7PQCD309QgRgRZMKgAbFREAfBBXNalbHA9cEHMo4IgIUuPjjBWEUFEQpYTkhVO43eRiynJw9Jjj8TOUIlJExK+0wA4gWgQvcFBHAc7P4/u78/Ff4CC5ATB3P3oUwFClYgcALcxzp/B9Ez4DUV8RjBbsCBrMH4dLNwIDaCGhA6o3pXksdBvYBsktrXDgNJKAFy1Z+ZGIy5NXgXoBT8a3ZgVSPIUAMV6DjLxhsV8wX4n4ibbONObHNyCr8Z4FinNFjg8ziiF5zSV8A99u7Zdf5OisvVaAAAG3VJREFU/kIPAJLWX3hUIFD6o7MD4WkHIMXBk4IftSrPNBJVk0OoC7ice8HGS8XBKDoz/YFBLaQi392lGpCMJfhD9xVkx5Xbj73P9V4m1j0v73x9FjDDPlYvATkgFAVWcdNvJBamliOjAwRV0EpeRymAe717kMYRyy/j5FwFBX0fP7Dyx8gq8wn2ZXi8GfGYR+lFcGJSxa3Y84WgzBHetlU4cvKY44Ps4iP9fsgsPGEhQTAcHqwwGCj61SoPexKwasXFqtxq8qhD9SixoBBYcJEDNzmIoi3J7QkoJActVHocTVpPBCDhElAvMDK1PT/Sq3DwB/ygmyB9GNhYDH4so4Foy48kkPtZfZEv1PQTxYpyX0EI3Bu+/5krcN8fgwVdwWu2JNVNWAk+PcOOPMNdGFyAZ5Aj6gicgzNfwuHZg0HrLxBWfjSRl88fVCo/apX/IBrIvf65ZxtEoK9Bec4KZIPLe76osQns46NwW0pUPCPAyMc4A/KXOwZzFLGbAqD5xhhbgBcWfoJBAlarcCSQgdQJ+Movnih4gjZQTw51rz588y/ZgxVUEAQ8soCfX8OR26JwujCLGFAMsOjnwGrlPuQw9D/PPv8BYVR7pG/eeFtQpsLzR2KFI8SwKj9KlX++HeLOPuSBKrKeHBi7L4b+Kx184+ptAp4Trcscv69oARVYzWgaK01H1X0K3zNSmARKtxXYHvwJuT+8gLGGWgpHcWOmBeljFB2Ckg6wiAYOqfxEK3GMCAj6kIiTWdCBCXhkjUKMgJcLk271N9uLSbtvvK0S69OXAvoA5z94VsFubbmZvx4QAnXgBnJxENyQjy38wef81uPhxMpPJIQzr5ckuUTKe0wZyN57iFTWga8GvCwlh5UqvYgmaNV9XSxEVWs40kkosFwA70RgNOu8mLZfR6wDiwRa35y7j08NksqPQhcfkRBK/J8R75Iz+9C8gJpqzwiIeZII3QnYOkJWbVEI5jNuA+o2BwK82ifwnpSgHwaC+GNAdmW2VXfC+vPu6wR6lBj84C9WfvivZyUhZMJlJhjSukDlFJ3g4AvGJfC1iEpQJ/CaEd7G9wds7p71+odruKrHip/C7RdsxeVjzIxhoNkFGOW/+sk/YVAGtltfzZAIfzix8gcHhZCXpcGN2u69qWqD9OlRFAy7x2fQBhHUiETB+DocqvArYt98f+AEAXApsEmEcNLC0t2uPHCqPQIXwHYDfI4/9+8LMpchqr5HK39MJSrBXwnutNqjovjHFdq+fcHLp7YLR4mGgduW5hFpAXUoL4cTTuW5HJSkB5PC0S7A+8c+837DyoM1J9iv/po/o3BunlDqPjOSO/YbLFd+FGy9sxKFeT8b+nLNPrkAyD53FtT27yUS32yqUaEGTMBiASGcZ0FmK8nWxbvjC1q6WQC4VdWdAcBY8eFoAzIrC0b7Wt8wlPcIdE1FhUWeKU1Igv8Q/0dl4k/NnYSxdlDon8diUDeuQB4c8XVzcahRgyyZmNC+LAgeCfSVALde8/t1DCYawNoePGT83wlOpFUdOZKwxn89OsMEf0X8CxJCBN/dwKbFwkSMgx0ACJJDJD4iC1JEYh6XcEqVHpx4+J4I4UiAl26r5x64sttvSlAn3LBuQCz6edU8C+J5epBrC4YP52EFDgHrCw1B0eU9bOaTgh3wmYvQV3Oqqcf53XnVNXUBELX1xtSgFrirlII5d3HFulxBCNEfZx0h7K2f34XwdHpuYQcguN189Ow/nPXclaUcqMH5leCXjKOjbv3F0a7i2ZaRHmBe5zwnhA9S736ZC8AH8LHkg/T5znYgmES1dtuzGo92qwHIquiWX+4KgVLd8utv9Ml1BQNhEJW/FOgweiTguCUoQHkEwYhjfQIgm8eAzPKzHqAG5xGiiPyxeGRRaYetUpDVpHVC1T9bHGyaknb/TQTnuG7rDYwYCUT7/cMjtILzA+Go/FPw581F/mWeTkDuBsBCAK8ki+A29nMzPn4Rzjv6QV7xWW4fzQFUxb9jQQ1qc28kMi4mDl1NBr4usIsz5ltZqNm7AeJXfuTHd7nioLEyPBISU+8/tP1AC4Il/n+YGmjg2NiBRdl6yCw//zG5ph7bqaBuz8B4VMU/TqSsNPbwCeZA1cdxyG9SgKzRZPL+GXFOiH1/SFZ9wX8M3zUgvH8a4rMBjZj/h1W9MrwTiN6MlsCKiI4gycBzgV/xUaQGjGDHwHiYi0VIzeEAasCpNuL76AC7BIEl7i4AIxnAfoMxk35eJbZ68wWEUChs8IPz/EEE9BkUoNA4RCWSLJkY1h0Y/dG9bVCtUVPe7QRhtStXG4nOECDfUxc4Uw/Ik8JkA9o9+a83IrfHH11EdFUWc4phNgVFWkPsIHBnCvCCYBSgqEN9qtoXuwHhByYoJJA7BxIkkRwpDGgAHo+vQ3ZGOwCFJCJKUAx4MBpFZWvReeLgtBBkDDQu2OJxXa7SE/P4ZiUPHABjY1DsFIhPAaygWewiXK72hHjow/k8gCL6gKES8qcDZ7A+EhYlWCPGCX1wXIwzkQEKt8cP6iqkC0FEhFj/ZYtvXCtwuBLcDT5wXN+9H6ZEIkTwV/x/s78fXFX3siWHEKrC3tw7EFZ31Ll7ttknQyEMGgAqCaVe1bGk8r8nFWCQQR0h7CY0dsU/mIeIuA1AGCo02Q0YVXxub36sG1Qgfo0CBBUXxap+ECFEycQVyViBEBFPt14TK9rZHB9EwMG7DPXOv0OVHkdtx7OSCXfb3av4CFZGTwQBwT7/hKPHE4PzpJ4L4+FM9r1n8B+B+9R9I4Fu9brYUZgCunZWNxdQgIs8mASBQ4F8hJpEiaf4GPihk8FdAxin/kybjZjTj+mAQy6ihZ9whDvHAWB6BKrBXQr+5SBfqPaINwiz12UIwoTmbPACZY/fshBBBKNlW8ZCHwH/cVKSOZMm4Mxk4OwE9JeB+EFkn1IzcPQoiSB4vGgNeJSoik1A7m0TCmE/HrggB+/1M12C1Z18ACGoIeH1pH2IhAqFWgBq+kDFEWAvA3X8tpW0cnSD5WAOriOHhnYraF1eLTkS8P/QsHUBdtMPnOrMaANJE9AZiaKWII5Ue/8PTHn/UcCSTgIF2xN4zdmAQYIAKeBFl6FiO0aKfq5jcImHfPwTxcEdRmD3LcFoAva1Hdjm9UgGggI9YOoPkOBYLsT8HlG3nucMDGkOOJ8CkNOELdSO7D5qqAeJYBb2GpABgRi2gxLITgrOQ9C937HgB+0i7MeRx3gfPWCXLtgbLJAu/gCFBPzRX8eADJqCvA3FViC/BlOQC4LZyrBq8BdQAOUKoKjqR7v7EFfVFMojPgEoSlJesNIePyLHwW9NRgq7E6HvUN8A0yj0wyWDHRZ3J2A1jHdMyu3hCGwSDwdRir7h9VP7AKLgPoMCgKziOFLtrUm8aIFHlgxYfz8WBYUU55iAXauo+evJaIK/NTgRJM9sUcZRzcCnMdNKMJc7usnAyrpxHYkTRHK+n1HxS01LheAHqRWwKIDqLvQC0+PupHZgBawfVGsiniTVHwZHRqbUI/D4Cd+ftgyLAR1ehkIiqaKFw7MJEwUIuK5zsu4svoFYCFKgBJZACBuppOId2RDkPZas8H9kULcA9a0KTCQDGtpnzT+RMJiOGseHl4BQ1C29AWUXIIf/OIwwqoNEK3SCuA7FRiBrE9B4/PcrGJ1OQNj83F4Xbol/TgVHfMiIZLAdcaVkgh8sLrd+liNQH/FqsNTfj15m1J0X+ffZuq/gTY7QnvIfJz6UzBJLs83ItQpt3RfZz5iuGfNPajpngUm0R8DoA5jDlzsOTAwZjzsC3Jjxg7H914PjlcskGdghgx9HG4OOQH34uwQyzz61/0qiYNQjXxECuWYbGM/DrjtPH/Mw/K+gBLLSA+cEfPr4MroArzcDuybbr8Zc72i2UnzeHnTgzD4Ug78SzIvCoARVOQxaFFR3TzWnkkHUVFShEuqKxZnKz4p4YYcf8ZhYhuu8wFgSHcuuwCJagI4bgchJQK/qe9c/RT6nGcg6KGREJpb+MI0EY/b0jcsni3AJBeCQNsBOFVYoApcM2Aom4VFgIRdHpeIG8D3YaxBD+qCiQ+rBOSVnci8hzkAG1t/pgHA4uwDzmu8xFKkkkIqCfkIRs204r/hiDgutoAAcowBMZ9+KS0CcXVBOHCvJw2jMQSJyeoeExF2DuTuRcuWAo9sefyUQ6/oBaIjPtiRH1KvQKvygAHb171d+vc4GRMDPoxN/kL5pwlVh1mBQ1quQJAJ5j0TgOAis+h8d3mnC8xTKE34+8sDNjyVXE6nFMN+H39TQDmocHScENvN74LoGScGU4f7g6IG3n3C3qnG6JBS+Z5tHOOzRYQx+u7MZmAl0OSsRLAS/VIKfRAWU92+12aaVPksGDBWQuCMvgNy2M2Mt8EwqbjosZAec5xLEAmXmcFTHiOWARWglpNpjdEtBQRxJJU5VL5/7F1X86XntXgUK4q+KggsUoIIK8oA+kgy4+zLaACqQGTVOX6MBWdehL6BxHn+tlyBMDGAqufd7WOX5WTJwKYDfXJJP2GXDPk7Tj5Ed7BOG7DMFaBRAJgI/+H2Ngeb2SKb0zkoGlQBHkefDr7xMA5HZeJPtKIzyApI9gmnPgf1c3mulfhe0gFekDCdNFnrOwi4Gs6eTACNjB+Uegcgojog4V25P8bctRYY6RL8AJklE9ACFAGZdBEahd4d4CmghFhbzcwaXYH5qTlS6DY+KfNH5Avzjo2JJ0poDkSCMxLn73H/eB+ifvgvyIFCWAji7BWC8hd0qj0FziMdrS70BlVbgamIgcmotGZDNPwm0L9l5iHv7WRoAFx57ScFS2r2iwot8oKu8l+TOCOg2mZ2nFdjTgOFQENzKkJ8OjEnsE8f6AzyXwT6MNF3RDRnuj0Lwo6wTlBMDIyqaz6G+RiLJMg/KUrQV/rh9uH0tWduwoxmky0kSMQ+rnXxZsGadgnxfgk1pCnsIsGYltvfdzTOBIclIsN8MLAGcz5gBwj94AE8DuC9Molip/JGwB57nRyJiyD3pyk6q5ij+3TzRLohcqyqCEQBTepF15+WVmW8SEr5jMUUkx3oMIsrH3ndwAQganKzyMpOJNxMQooGBYwcByw7axIhgPRGEr6GSGJhkAELoQ1YRg+dPeD5IIRDIqq5PA2Jh0Rq0YcS8XBi0ghGRFpCtWTdum5+yLOsQf2EuYY8AfnbQZDgCjHxBSKwTGpt8QCIDVH3/4H5OwEvldhliINwAFLsEyyIfGKV+vm3eEehVqKTdNxtDiPoLHCRiuwTJxCECxMDqDjTvZ63KaPKvRgV2i/F3ohm88V8LN8hgJcXD5pVGIPPNn9EBqSQC0I4AMxBUcQNCkarkFgSn/oCs9GCVep4eUG5BRAOcQOCWlGSc3If0IFqRfURQGRrKewPKEJ9sLnIowKCcw+f48N6UHjqYtgInaCCkBbPSj8VEkCr2g8U43wY1xX/BNkwreQrzg+oaJghOCGTU8RBxuIp6VFOGoEXgEsBLIgV6gBgxoLSI5CgiYNT+GBHsU01GthrceiMUtv9KgAYktgVNeGrBbtiOQVi9x8WjiAW7UNUnm4Vet7WtsFgDCDYEwQ/EVL1PnQf/xCDLTowTh4c4HPRDoQaiwhKIAae4B7xgCBydI/CDPOrevK0FR4p6w3VfoXgQiB3T1N8Y1PCD0X19JqcHGfzB5WkQE4p/kdeXBcEVUXEIFqSij82lMyrWq/7c+LFHA7z5/dwOHHg8s/Y8C2CmhbmALtare+4UWLfb25BmXABKABTniC8gRAP2yvDAiUAsElnrxFzITQa/sAFecAOY7zPV/8jMQHSbWAiUPGkQNABhw85xrSCv+mMSzFR8+7mjw01A8f4F8S/td4jnDHYxpT8/OEyV3gz2+GTfdAeAszswfJNGlQhEIjB0Bls0BKn4Iw7WKu9f1gmSagmvqleEwJwnZwjO7npz1HdCJ1hS/mlBcRXyF3i/M7NxqJFoeH27z7nnJaBmpUZKHsTbGUc1ALEoIGsGYl9ixS50gjAT/VhB8IzvGTrBVfWEz1MzAkRFTtecW731VdjNQPukVdhdn0Y8d/a7WYH6i/TBPBzUFwAlHwtGHOQISrgb1AMUgDETTA3+THAdeRJhg59V/Ektofa9I8wxVICkC7QQSAd2O3cftzPzdMK6aA4iZI4ILfYRbb9RgqICt2AxVnYZ4kkBvHOBxT/zN9ybHx/f5Ql2fkGCX6ANm6F8WCfqAS+Eq5AGcHJd2IFHagTMHAAj+mWBnDXuc81CjhsAi5dL2K8QCYI1aJ/PJtSSxEFXASv7C2I3ZB9/a0j/7nDn/j1pHsz9Jr8fNpxPBUAUUYD4wz5GBlmyAiORjtAIGDFwzSUwqiNZ1d1tPiB7/Q9VeI9KeJU16/knkEeQJEALjY4rkp74fCZiMDSA/PgvT/aT2gYgp5E/P29AKBQAo6TRth5T4VesQFb0i4K7RA2MZpgyFXCEQHCOixuYMPgy2L7+45ezSSKt2oUkURlpXkEMOLSiXPuDQZjk63N5bmzOSxQdLHX7AhwUEA0BAeQPJIQzkAuFlOK/GtyLdiGDKEBdllQ7YouxV2Xdwza9So4Kp5Z0yAgUhTlJgFzSFrznIHYIwKcCu2/L3LsCg6UI1b1/CA+ApIV5/32HqOIjdQusE4azip5Wc1b0q/QGIAlaWEJbXP3r/L+AEipw/+BtkQVY9fIM2i/ZhgVEgJO6DZ1ksVtlYdoQAPhVO0oKmYBmnAYco4DRCRB3TwCziptaE0auER9/VzRqKNOEYINOQg2m1l9GpGNQAhh1v6UmxNQh2M4+LmlUzll0OTjYQOaGlZAEMCrdhmBphaMBwBADrSQQc3//He8KgFETT7p6BHnjj2X9EXsDjrgBS6ihoAmcSQVYmE4JgYWFpp1waAQRoqDzxDhU+HxSnZHz/9JEY6Y5MJA+cwoWrt99+U3Mc/9g/NQTFaigAEtwB1yBzwzucZSX7RZEILhR1d5GDCsBLVUdIQvsldZfEJt5i/MHx2hGJZFkVVyK242iFeh58oBUFqIQbkfp2DV2X0CkAYgv1sU+P+I/HmBu8nErugdRnUWhfp+A/ddlbEH3uQlBsNobUEMHasK1HOYn8BEEvCUaiuigXRIKj+sGOPA4KAWz9/s7WxcgB4+a6/fI2osEwv4yOENAiPf+wQhbc/5f0gGisWuQaRFmGoIqguARWsBQgTTocDLMT5OJUQnhqdCEig+/EShKSEgTVV0MBMnz04BcshPnLk/+OaV0/dwKzB4QUt1NB6uTDfGOP+cNm9mEsBAFiM7AQh9AKVEU75vy68jeOxrUC4mDEuYO0oLqoSdHaEF2eXYYSm0V+oEOwpLmYFOF3Z4CmAeBTIGueiIw2xoKPzDBJVBXQ5g5O8/twwA+QguIjJt3+g0NQEcDfUXgO5gsqlTBLkQLdl86K3CWneitQ8sg/5oWAUJP2C3V3RoEyji5n4b9lB4t9pz2CA+cAFn1Z9I/uzYsU/ELtEBOCHYQQqGcFejV+yeuRJX31zsKV5IGjway9z6PLDxKwNEPsBuOEiqw57jGgOtZ1Y++T50AuMFl7hPIbhskiOwsATtRoc7rS7dXrpcgrMCGJca6ELJo+Y0be0BW5ZKGcFz4y8W9BduwcDnK9iO5fagsKpp9ANnvDPxeP8THNyIVFo1AMas8Qk5v2Ytm0LCCYAXqn+wQsPTBh/5Bcnne14Os3uCQt28vsK1WUESJFviBgAW//3u9PLxusXchcCR2WsNzv/ImvgZzzkUByDUAIrjTvmSHAowpJBQE4SUlxMxnARlQbIqkArVAJ6pBBvELCCKlkyCDAP45BYfEPfcUpfMch3Vn4bheYK4E66BxAxHSVd5INgEPgU/NBCDfNQ8Ho1CoINAPQAW/QT8OCIZlNFCB84XhoDChFByHGjx35v9BLgyhmojqHYb5QYXnuAecvua0hZe6BV9f7v4ibvgvamrmAc1TmaEir0LQ9h97eYAYVoM/nWA60i8Q3Ifezha9BqaaL3zvqd6IAuwwLSCCuCLuJWch4h30giPtyiAphKEBcCu9BV5wwzkMxID8rhMwdwMhcSFgrBT3RUTQboAUg3+p+Qe1IGarOioVnazmefV3lHpwA0AcLWCahUiXwePHWJsP+GH1gnp/we5KfOhJAbsj0H/BIEb04TbrTPsAyb2LLu93KwfCvn5PLAwrOXAa72eEQRo1CNdw5IprsAZ3hApy9zlcITG2vpCihsRSYxNS+J4vdBZ6B52eqRcQ/QXmSjAWSfa/5GA5qEg4iJFtm624AqXLrSA2gx8p1Mdqcghv41S0lSp/xAYs9gakQc4Ie2RTUYwYgt748mV+FU1Xgp14eW3XYZ6cdqGTNHwHICTwEeTPl0jEZwIgP9gDEaogeg5IHWCF+1eoAhvEKPB/EAeTRsM/pSAP5wjWEUMM1/NJRhwJbpJSgK7S7zF3EOsI5jBQBK9DV80Z8Y0COzvmWzJXgDl40KEC6cqvqgi4OB5cpgLFYK/1CvDiItXqC6/S87wfAUfPtxqfGNzlYaOjlf1IsHPPvffHgDAoEeEST4ZLZUd/RSo91/BjXY5ggWgQ4In3fyj4mUqPrInHOCLKO3wUwRsfyXpt1nEIRLrqcWeTuk7bigsbid1zD4iDRQtnIdQsyIXnFCn1I9D7ADgxEhOvR5AJosoUbu1FkJyYCi9OhQERoIx+4AX/YqUXQhtYEwKN4Cy1HntLMmtaAQpqfrT/UCoLSxeswjA5UWPPi0mjajUWxMTdVusNvt/ChMdmILK5IRMFu90BMEzFYHdg2GAgeYVHMMJIBTA7EFTx/5fpgTFXz9w/en0ZjD8kCDoKPNGwlB01BmoWQbh+AxR689mBponGJOr9OwmMu3dtJ/ylW1Tik4ElUPmR9RqII+pVhD9ychABMQ51gOIZg+/G+5mGIzLB1JJC5WhzYjhJ7IWmLDpA8jzsAafUPkB2WnFBF4iSxkq1ty7f25rv/+EQLOxs2oUdTSA9HIR9swdBlCcFe9owPC3XWDDC0ISVzsEVbSCF/sWdA5Fu4HJqankp2SeQCYYrImNalfmhpVxYrGkUS4LeSUjg8dD7+D7w/ybIfy7vlB9/HJ978zr7/45Qgajzj+4EjIK/ULHPRAOlKr/aG0AFcqCyu0GcW45Igh6JMJmhA49/U+cEssHNJhtXDC1MOya3j/sAiAGcrEtqtgjBD6wEzSDc7D8o6C8rIqAZyPk+NQoNLAZ1hR64Yl1FBY648smUYKnSg1Xwk/0DyRyArByMUobyByhCcPnOaPyoegREFS4jNfYAw+IHCjdC1J2WDZBke/OyN85J24WiXwDYPoJyYuCD238ulvuzwt6KgHf0shWKsqCFFGjB/w8HU8eeTED9wAAAAABJRU5ErkJggg==",xd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAF9UlEQVR4nGWVy64eVxGF16X27u7/HMcyuZGYAINwmTBigngBXoc34El4B0ZMGDJjFCExQUIKiRKZYBITHdvn/L1rF4P+c+yEUqmH9WmtrrWLkdB4C1/91h/9yn947D8+8CfdlBeGGAMtqwNd6K7VWAJrw9qwLtw2nDaernh6wKuHPD3S1Vs6vaPT97W9r/Wx1seKUWj7Uzz6vX79T//wF/Gbx/7rw/jsFB/39nlrX7q99LKrp5bJZXAtrqW1uJIncbNOXafBU+o0tZW28got0AJ3KACsE4OfYvmzfvDMb/+4//Td9snD9rfr9vHWnyz9361/1fpNLLde0mt5pTZ7a9pCm32SrqQTfZI3aqNXHAwvcAB4BPwnk/oMEcqX8eaz1t9cHjxs7133f5z6p2v/Ylme9eWmLbexjlhnrPBirz3WxWv30rw0L/Yi96PpDrcDcPMEfq+qvQCfsFF1blcv2js3vb2xLNd9O/XT1p8u/Vlfnvd+25bResXC6BFLj2WJpUdv7uEe0exGByPoOAC//BH+cgNqUjfkU4mOEetde+O2vf+y8br71Nva+9q/XpYXvZ97z9ardUXrra3RerQWrUU4myLk4AzYiADwJ+NRQ41i7MSNEBIcM5YR1+f21rnlXcPWtbVYW1/a7dL21mZvbK211lv01lpEtIi0MxTmFGzMAABAN6gF1CTPxI1gkXa5Z5xGPNrbfo6xB/bQubW9nXvkHtXDPfqIJd2bI+1mpZjmNK17QFuxDzhBJued8Fy0KLvcp7fpNzJuM3JE7daIWGKMqAylW0bLiHQ0e1ppTXEK8Qrwkzv8fUIua6oG553wQpRIme7lbfpBxm3GnoEMZ+wZlYGMlu6pNh1pT3nqALCEugCeAB2ohKqYk9hZd4JFS5ThDm/lB9N305nGtKfnNKZiqk23qZhySZOcYhHFewXfI54UMCBDOYlU3TMkSaYWaCtdwXu5yprOKUxrqk9FyUWXNKXiBfCNgucGboGAUBwUJzFYO3G+MCwFtdAn6K6UZZSyXCXBAUVdGCoS5IVxAcQNujAHKCiLLHJqDtWZh1GHV0Et8EYNqOABTUhglKJoyKBBgSwCBC6Ajz7Azz+GiJbwhFTkZCXnEM6EJcuHDmmlztCkBE2IkMGAAhQoSCBBvgYA0G6xN4DgLE5IU5iqZA1hJ8zDqCY2qktJHfEnZSpIk6bE++kEXwHUEBMCmBBBFzE5UzNZuyBRshlSSF0aEg6MaDHIgyFCPAqvA/YdIjTgQ3WBLNZkpWoQPnRIUljdGiIkHd9jumgeO0ESEI97cNTPJj6Z4ISOZh1JUSVLwiAs7pRp02aTypRUhwIzjvhfPCKF1wH/BTqwA5pQlnYyipgs6dDBQVncZatZaZUlsUxZYVq0jyfm8kNeBzz/Gu0ETrjABAURAoTJOVVJpDAoM3ZOc5olfmMK42CYMrRTAr6tIK6QiSA84VtIIEosslSTNYUkUxyS5aEDQ6tMmQ7YDMOmjziYx8E56oPEl8DdDgM2/BLeIJVw9CRSTClZg97ZrDl0BF6m49V0GTIZQL4CvNuxFj47w4ASmqUkAalYU+DBoIbK8hAG506aZTLonWFG0IMa1AAHXlegW9wFGuAJG97hhFkqiuCxUZyqSSWR5GCZHKxB7nSwDcZADHiACQ4eJ/Oot9+BvsaLQD2Hby9RUEEs1cUlcdKpmWKSQ2VyqAY56J0RiEEPOqHxXYv2W4yJuANWxBkBOKEGFcwyjlhMYdLJSjLJpA8FAxqMwXZRQA0wgdQ94Hcf4nqDFnQhBDcY5YJUIqSSpnxpRqone6ol+2Af7Il2MJJxnN/8lgIA8yWQUKItaBMRsGEdDIrQoYNTnGSyBqdZQSY16IEYaANOOKn/A+htXH+OdgLOiB1BBOEGCz5ejmO6JpGEeexVJTmohJNORqIlnVDyO4CvvsT2AGm0BVEHo0IMHeEooeQipzDFY5eSNcigLgwoGYlIKHF/ky9Z+xD/WrCfoQUuRCGAKBhlwIBRQvmSuykkMYHkqx7EAPK+/wdqEbWmfB0bfwAAAABJRU5ErkJggg==";let Sd=0;const kh=(a,e,t,i)=>{if(!a[t]){const s=a.useDelayedTextureLoading;a.useDelayedTextureLoading=!1;const r=a._blockEntityCollection;a._blockEntityCollection=!1;const n=z.CreateFromBase64String(e,i+Sd++,a,!0,!1,z.BILINEAR_SAMPLINGMODE);a._blockEntityCollection=r;const o=a.getEngine().getLoadedTexturesCache(),h=o.indexOf(n.getInternalTexture());h!==-1&&o.splice(h,1),n.isRGBD=!0,n.wrapU=z.CLAMP_ADDRESSMODE,n.wrapV=z.CLAMP_ADDRESSMODE,a[t]=n,a.useDelayedTextureLoading=s,Na.ExpandRGBDTexture(n);const l=a.getEngine().onContextRestoredObservable.add(()=>{n.isRGBD=!0;const c=a.onBeforeRenderObservable.add(()=>{n.isReady()&&(a.onBeforeRenderObservable.remove(c),Na.ExpandRGBDTexture(n))})});a.onDisposeObservable.add(()=>{a.getEngine().onContextRestoredObservable.remove(l)})}return a[t]},Gh=a=>kh(a,yd,"environmentBRDFTexture","EnvironmentBRDFTexture"),C_=a=>kh(a,xd,"environmentFuzzBRDFTexture","EnvironmentFuzzBRDFTexture"),Md=new RegExp("^([gimus]+)!");class vi{constructor(e){this._plugins=[],this._activePlugins=[],this._activePluginsForExtraEvents=[],this._material=e,this._scene=e.getScene(),this._engine=this._scene.getEngine()}_addPlugin(e){for(let s=0;sthis._handlePluginEvent(s,r),this._plugins.push(e),this._plugins.sort((s,r)=>s.priority-r.priority),this._codeInjectionPoints={};const i={};i[vi._MaterialPluginClassToMainDefine[t]]={type:"boolean",default:!0};for(const s of this._plugins)s.collectDefines(i),this._collectPointNames("vertex",s.getCustomCode("vertex",this._material.shaderLanguage)),this._collectPointNames("fragment",s.getCustomCode("fragment",this._material.shaderLanguage));return this._defineNamesFromPlugins=i,!0}_activatePlugin(e){this._activePlugins.indexOf(e)===-1&&(this._activePlugins.push(e),this._activePlugins.sort((t,i)=>t.priority-i.priority),this._material._callbackPluginEventIsReadyForSubMesh=this._handlePluginEventIsReadyForSubMesh.bind(this),this._material._callbackPluginEventPrepareDefinesBeforeAttributes=this._handlePluginEventPrepareDefinesBeforeAttributes.bind(this),this._material._callbackPluginEventPrepareDefines=this._handlePluginEventPrepareDefines.bind(this),this._material._callbackPluginEventBindForSubMesh=this._handlePluginEventBindForSubMesh.bind(this),e.registerForExtraEvents&&(this._activePluginsForExtraEvents.push(e),this._activePluginsForExtraEvents.sort((t,i)=>t.priority-i.priority),this._material._callbackPluginEventHasRenderTargetTextures=this._handlePluginEventHasRenderTargetTextures.bind(this),this._material._callbackPluginEventFillRenderTargetTextures=this._handlePluginEventFillRenderTargetTextures.bind(this),this._material._callbackPluginEventHardBindForSubMesh=this._handlePluginEventHardBindForSubMesh.bind(this)))}getPlugin(e){for(let t=0;t0&&i.uniforms.push(...this._uniformList),this._samplerList.length>0&&i.samplers.push(...this._samplerList),this._uboList.length>0&&i.uniformBuffersNames.push(...this._uboList),i.customCode=this._injectCustomCode(i,i.customCode);break}case 8:{const i=t;this._uboDeclaration="",this._vertexDeclaration="",this._fragmentDeclaration="",this._uniformList=[],this._samplerList=[],this._uboList=[];const s=this._material.shaderLanguage===1;for(const r of this._plugins){const n=r.getUniforms(this._material.shaderLanguage);if(n){if(n.ubo)for(const o of n.ubo){if(o.size&&o.type){const h=o.arraySize??0;if(i.ubo.addUniform(o.name,o.size,h),s){let l;switch(o.type){case"mat4":l="mat4x4f";break;case"float":l="f32";break;default:l=`${o.type}f`;break}h>0?this._uboDeclaration+=`uniform ${o.name}: array<${l}, ${h}>; +`:this._uboDeclaration+=`uniform ${o.name}: ${l}; +`}else this._uboDeclaration+=`${o.type} ${o.name}${h>0?`[${h}]`:""}; +`}this._uniformList.push(o.name)}n.vertex&&(this._vertexDeclaration+=n.vertex+` +`),n.fragment&&(this._fragmentDeclaration+=n.fragment+` +`),n.externalUniforms&&this._uniformList.push(...n.externalUniforms)}r.getSamplers(this._samplerList),r.getUniformBuffersNames(this._uboList)}break}}}_collectPointNames(e,t){if(t)for(const i in t)this._codeInjectionPoints[e]||(this._codeInjectionPoints[e]={}),this._codeInjectionPoints[e][i]=!0}_injectCustomCode(e,t){return(i,s)=>{t&&(s=t(i,s)),this._uboDeclaration&&(s=s.replace("#define ADDITIONAL_UBO_DECLARATION",this._uboDeclaration)),this._vertexDeclaration&&(s=s.replace("#define ADDITIONAL_VERTEX_DECLARATION",this._vertexDeclaration)),this._fragmentDeclaration&&(s=s.replace("#define ADDITIONAL_FRAGMENT_DECLARATION",this._fragmentDeclaration));const r=this._codeInjectionPoints?.[i];if(!r)return s;let n=null;for(let o in r){let h="";for(const l of this._activePlugins){let c=l.getCustomCode(i,this._material.shaderLanguage)?.[o];c&&(l.resolveIncludes&&(n===null&&(n={defines:[],indexParameters:e.indexParameters,isFragment:!1,shouldUseHighPrecisionShader:this._engine._shouldUseHighPrecisionShader,processor:void 0,supportsUniformBuffers:this._engine.supportsUniformBuffers,shadersRepository:We.GetShadersRepository(0),includesShadersStore:We.GetIncludesShadersStore(0),version:void 0,platformName:this._engine.shaderPlatformName,processingContext:void 0,isNDCHalfZRange:this._engine.isNDCHalfZRange,useReverseDepthBuffer:this._engine.useReverseDepthBuffer,processCodeAfterIncludes:void 0}),n.isFragment=i==="fragment",Cr(c,n,u=>c=u)),h+=c+` +`)}if(h.length>0)if(o.charAt(0)==="!"){o=o.substring(1);let l="g";if(o.charAt(0)==="!")l="",o=o.substring(1);else{const d=Md.exec(o);d&&d.length>=2&&(l=d[1],o=o.substring(l.length+1))}l.indexOf("g")<0&&(l+="g");const c=s,u=new RegExp(o,l);let f=u.exec(c);for(;f!==null;){let d=h;for(let g=0;g{Id()});const Cd=[];let Ua=null;function Id(){Cd.length=0,F.OnEventObservable.remove(Ua),Ua=null}class Qt{isCompatible(e){return e===0}_enable(e){e&&this._pluginManager._activatePlugin(this)}constructor(e,t,i,s,r=!0,n=!1,o=!1){this.priority=500,this.resolveIncludes=!1,this.registerForExtraEvents=!1,this.doNotSerialize=!1,this._material=e,this.name=t,this.priority=i,this.resolveIncludes=o,e.pluginManager||(e.pluginManager=new vi(e),e.onDisposeObservable.add(()=>{e.pluginManager=void 0})),this._pluginDefineNames=s,this._pluginManager=e.pluginManager,r&&this._pluginManager._addPlugin(this),n&&this._enable(!0),this.markAllDefinesAsDirty=e._dirtyCallbacks[127]}getClassName(){return"MaterialPluginBase"}isReadyForSubMesh(e,t,i,s){return!0}hardBindForSubMesh(e,t,i,s){}bindForSubMesh(e,t,i,s){}dispose(e){}getCustomCode(e,t=0){return null}collectDefines(e){if(this._pluginDefineNames)for(const t of Object.keys(this._pluginDefineNames)){if(t[0]==="_")continue;const i=typeof this._pluginDefineNames[t];e[t]={type:i==="number"?"number":i==="string"?"string":i==="boolean"?"boolean":"object",default:this._pluginDefineNames[t]}}}prepareDefinesBeforeAttributes(e,t,i){}prepareDefines(e,t,i){}hasTexture(e){return!1}hasRenderTargetTextures(){return!1}fillRenderTargetTextures(e){}getActiveTextures(e){}getAnimatables(e){}addFallbacks(e,t,i){return i}getSamplers(e){}getAttributes(e,t,i){}getUniformBuffersNames(e){}getUniforms(e=0){return{}}copyTo(e){le.Clone(()=>e,this)}serialize(){return le.Serialize(this)}parse(e,t,i){le.Parse(()=>this,e,t,i)}}T([R()],Qt.prototype,"name",void 0);T([R()],Qt.prototype,"priority",void 0);T([R()],Qt.prototype,"resolveIncludes",void 0);T([R()],Qt.prototype,"registerForExtraEvents",void 0);nt("BABYLON.MaterialPluginBase",Qt);class Pd extends Si{constructor(){super(...arguments),this.BRDF_V_HEIGHT_CORRELATED=!1,this.MS_BRDF_ENERGY_CONSERVATION=!1,this.SPHERICAL_HARMONICS=!1,this.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=!1,this.MIX_IBL_RADIANCE_WITH_IRRADIANCE=!0,this.LEGACY_SPECULAR_ENERGY_CONSERVATION=!1,this.BASE_DIFFUSE_MODEL=0,this.DIELECTRIC_SPECULAR_MODEL=0,this.CONDUCTOR_SPECULAR_MODEL=0}}class xe extends Qt{_markAllSubMeshesAsMiscDirty(){this._internalMarkAllSubMeshesAsMiscDirty()}isCompatible(){return!0}constructor(e,t=!0){super(e,"PBRBRDF",90,new Pd,t),this._useEnergyConservation=xe.DEFAULT_USE_ENERGY_CONSERVATION,this.useEnergyConservation=xe.DEFAULT_USE_ENERGY_CONSERVATION,this._useSmithVisibilityHeightCorrelated=xe.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this.useSmithVisibilityHeightCorrelated=xe.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this._useSphericalHarmonics=xe.DEFAULT_USE_SPHERICAL_HARMONICS,this.useSphericalHarmonics=xe.DEFAULT_USE_SPHERICAL_HARMONICS,this._useSpecularGlossinessInputEnergyConservation=xe.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION,this.useSpecularGlossinessInputEnergyConservation=xe.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION,this._mixIblRadianceWithIrradiance=xe.DEFAULT_MIX_IBL_RADIANCE_WITH_IRRADIANCE,this.mixIblRadianceWithIrradiance=xe.DEFAULT_MIX_IBL_RADIANCE_WITH_IRRADIANCE,this._useLegacySpecularEnergyConservation=xe.DEFAULT_USE_LEGACY_SPECULAR_ENERGY_CONSERVATION,this.useLegacySpecularEnergyConservation=xe.DEFAULT_USE_LEGACY_SPECULAR_ENERGY_CONSERVATION,this._baseDiffuseModel=xe.DEFAULT_DIFFUSE_MODEL,this.baseDiffuseModel=xe.DEFAULT_DIFFUSE_MODEL,this._dielectricSpecularModel=xe.DEFAULT_DIELECTRIC_SPECULAR_MODEL,this.dielectricSpecularModel=xe.DEFAULT_DIELECTRIC_SPECULAR_MODEL,this._conductorSpecularModel=xe.DEFAULT_CONDUCTOR_SPECULAR_MODEL,this.conductorSpecularModel=xe.DEFAULT_CONDUCTOR_SPECULAR_MODEL,this._internalMarkAllSubMeshesAsMiscDirty=e._dirtyCallbacks[16],this._enable(!0)}prepareDefines(e){e.BRDF_V_HEIGHT_CORRELATED=this._useSmithVisibilityHeightCorrelated,e.MS_BRDF_ENERGY_CONSERVATION=this._useEnergyConservation&&this._useSmithVisibilityHeightCorrelated,e.SPHERICAL_HARMONICS=this._useSphericalHarmonics,e.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=this._useSpecularGlossinessInputEnergyConservation,e.MIX_IBL_RADIANCE_WITH_IRRADIANCE=this._mixIblRadianceWithIrradiance,e.LEGACY_SPECULAR_ENERGY_CONSERVATION=this._useLegacySpecularEnergyConservation,e.BASE_DIFFUSE_MODEL=this._baseDiffuseModel,e.DIELECTRIC_SPECULAR_MODEL=this._dielectricSpecularModel,e.CONDUCTOR_SPECULAR_MODEL=this._conductorSpecularModel}getClassName(){return"PBRBRDFConfiguration"}}xe.DEFAULT_USE_ENERGY_CONSERVATION=!0;xe.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED=!0;xe.DEFAULT_USE_SPHERICAL_HARMONICS=!0;xe.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION=!0;xe.DEFAULT_MIX_IBL_RADIANCE_WITH_IRRADIANCE=!0;xe.DEFAULT_USE_LEGACY_SPECULAR_ENERGY_CONSERVATION=!0;xe.DEFAULT_DIFFUSE_MODEL=0;xe.DEFAULT_DIELECTRIC_SPECULAR_MODEL=0;xe.DEFAULT_CONDUCTOR_SPECULAR_MODEL=0;T([R(),B("_markAllSubMeshesAsMiscDirty")],xe.prototype,"useEnergyConservation",void 0);T([R(),B("_markAllSubMeshesAsMiscDirty")],xe.prototype,"useSmithVisibilityHeightCorrelated",void 0);T([R(),B("_markAllSubMeshesAsMiscDirty")],xe.prototype,"useSphericalHarmonics",void 0);T([R(),B("_markAllSubMeshesAsMiscDirty")],xe.prototype,"useSpecularGlossinessInputEnergyConservation",void 0);T([R(),B("_markAllSubMeshesAsMiscDirty")],xe.prototype,"mixIblRadianceWithIrradiance",void 0);T([R(),B("_markAllSubMeshesAsMiscDirty")],xe.prototype,"useLegacySpecularEnergyConservation",void 0);T([R("baseDiffuseModel"),B("_markAllSubMeshesAsMiscDirty")],xe.prototype,"baseDiffuseModel",void 0);T([R("dielectricSpecularModel"),B("_markAllSubMeshesAsMiscDirty")],xe.prototype,"dielectricSpecularModel",void 0);T([R("conductorSpecularModel"),B("_markAllSubMeshesAsMiscDirty")],xe.prototype,"conductorSpecularModel",void 0);class ka{constructor(){this.previousWorldMatrices={},this.previousBones={}}static AddUniforms(e){e.push("previousWorld","previousViewProjection","mPreviousBones")}static AddSamplers(e){}bindForSubMesh(e,t,i,s,r){if(t.prePassRenderer&&t.prePassRenderer.enabled&&t.prePassRenderer.currentRTisSceneRT&&(t.prePassRenderer.getIndex(2)!==-1||t.prePassRenderer.getIndex(11)!==-1)){this.previousWorldMatrices[i.uniqueId]||(this.previousWorldMatrices[i.uniqueId]=s.clone()),this.previousViewProjection||(this.previousViewProjection=t.getTransformMatrix().clone(),this.currentViewProjection=t.getTransformMatrix().clone());const n=t.getEngine();this.currentViewProjection.updateFlag!==t.getTransformMatrix().updateFlag?(this._lastUpdateFrameId=n.frameId,this.previousViewProjection.copyFrom(this.currentViewProjection),this.currentViewProjection.copyFrom(t.getTransformMatrix())):this._lastUpdateFrameId!==n.frameId&&(this._lastUpdateFrameId=n.frameId,this.previousViewProjection.copyFrom(this.currentViewProjection)),e.setMatrix("previousWorld",this.previousWorldMatrices[i.uniqueId]),e.setMatrix("previousViewProjection",this.previousViewProjection),this.previousWorldMatrices[i.uniqueId]=s.clone()}}}class ns{constructor(e,t,i,s){this.name=e,this.worldAxisForNormal=t,this.worldAxisForFileX=i,this.worldAxisForFileY=s}}class Xr{static ConvertCubeMapTextureToSphericalPolynomial(e){if(!e.isCube)return null;e.getScene()?.getEngine().flushFramebuffer();const t=e.getSize().width,i=e.readPixels(0,void 0,void 0,!1),s=e.readPixels(1,void 0,void 0,!1);let r,n;e.isRenderTarget?(r=e.readPixels(3,void 0,void 0,!1),n=e.readPixels(2,void 0,void 0,!1)):(r=e.readPixels(2,void 0,void 0,!1),n=e.readPixels(3,void 0,void 0,!1));const o=e.readPixels(4,void 0,void 0,!1),h=e.readPixels(5,void 0,void 0,!1),l=e.gammaSpace,c=5;let u=0;return(e.textureType==1||e.textureType==2)&&(u=1),new Promise(f=>{Promise.all([s,i,r,n,o,h]).then(([d,g,p,m,A,E])=>{const I={size:t,right:g,left:d,up:p,down:m,front:A,back:E,format:c,type:u,gammaSpace:l};f(this.ConvertCubeMapToSphericalPolynomial(I))})})}static _AreaElement(e,t){return Math.atan2(e*t,Math.sqrt(e*e+t*t+1))}static ConvertCubeMapToSphericalPolynomial(e){const t=new qs;let i=0;const s=2/e.size,r=s,n=.5*s,o=n-1;for(let f=0;f<6;f++){const d=this._FileFaces[f],g=e[d.name];let p=o;const m=e.format===5?4:3;for(let A=0;AN){const pe=N/Re;x*=pe,S*=pe,L*=pe}}else x=be(x,0,N),S=be(S,0,N),L=be(L,0,N);const D=new q(x,S,L);t.addLight(M,D,C),i+=C,E+=s}p+=r}}const u=4*Math.PI*6/6/i;return t.scaleInPlace(u),t.convertIncidentRadianceToIrradiance(),t.convertIrradianceToLambertianRadiance(),js.FromHarmonics(t)}}Xr._FileFaces=[new ns("right",new _(1,0,0),new _(0,0,-1),new _(0,-1,0)),new ns("left",new _(-1,0,0),new _(0,0,1),new _(0,-1,0)),new ns("up",new _(0,1,0),new _(1,0,0),new _(0,0,1)),new ns("down",new _(0,-1,0),new _(1,0,0),new _(0,0,-1)),new ns("front",new _(0,0,1),new _(1,0,0),new _(0,-1,0)),new ns("back",new _(0,0,-1),new _(-1,0,0),new _(0,-1,0))];Xr.MAX_HDRI_VALUE=4096;Xr.PRESERVE_CLAMPED_COLORS=!1;De.prototype.forceSphericalPolynomialsRecompute=function(){this._texture&&(this._texture._sphericalPolynomial=null,this._texture._sphericalPolynomialPromise=null,this._texture._sphericalPolynomialComputed=!1)};Object.defineProperty(De.prototype,"sphericalPolynomial",{get:function(){if(this._texture){if(this._texture._sphericalPolynomial||this._texture._sphericalPolynomialComputed)return this._texture._sphericalPolynomial;if(this._texture.isReady)return this._texture._sphericalPolynomialPromise||(this._texture._sphericalPolynomialPromise=Xr.ConvertCubeMapTextureToSphericalPolynomial(this),this._texture._sphericalPolynomialPromise===null?this._texture._sphericalPolynomialComputed=!0:this._texture._sphericalPolynomialPromise.then(a=>{this._texture._sphericalPolynomial=a,this._texture._sphericalPolynomialComputed=!0})),null}return null},set:function(a){this._texture&&(this._texture._sphericalPolynomial=a)},enumerable:!0,configurable:!0});class vd extends Si{constructor(){super(...arguments),this.CLEARCOAT=!1,this.CLEARCOAT_DEFAULTIOR=!1,this.CLEARCOAT_TEXTURE=!1,this.CLEARCOAT_TEXTURE_ROUGHNESS=!1,this.CLEARCOAT_TEXTUREDIRECTUV=0,this.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV=0,this.CLEARCOAT_BUMP=!1,this.CLEARCOAT_BUMPDIRECTUV=0,this.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,this.CLEARCOAT_REMAP_F0=!1,this.CLEARCOAT_TINT=!1,this.CLEARCOAT_TINT_TEXTURE=!1,this.CLEARCOAT_TINT_TEXTUREDIRECTUV=0,this.CLEARCOAT_TINT_GAMMATEXTURE=!1}}class dt extends Qt{_markAllSubMeshesAsTexturesDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}isCompatible(){return!0}constructor(e,t=!0){super(e,"PBRClearCoat",100,new vd,t),this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.roughness=0,this._indexOfRefraction=dt._DefaultIndexOfRefraction,this.indexOfRefraction=dt._DefaultIndexOfRefraction,this._texture=null,this.texture=null,this._useRoughnessFromMainTexture=!0,this.useRoughnessFromMainTexture=!0,this._textureRoughness=null,this.textureRoughness=null,this._remapF0OnInterfaceChange=!0,this.remapF0OnInterfaceChange=!0,this._bumpTexture=null,this.bumpTexture=null,this._isTintEnabled=!1,this.isTintEnabled=!1,this.tintColor=q.White(),this.tintColorAtDistance=1,this.tintThickness=1,this._tintTexture=null,this.tintTexture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1]}isReadyForSubMesh(e,t,i){if(!this._isEnabled)return!0;const s=this._material._disableBumpMap;return!(e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&U.ClearCoatTextureEnabled&&!this._texture.isReadyOrNotBlocking()||this._textureRoughness&&U.ClearCoatTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking()||i.getCaps().standardDerivatives&&this._bumpTexture&&U.ClearCoatBumpTextureEnabled&&!s&&!this._bumpTexture.isReady()||this._isTintEnabled&&this._tintTexture&&U.ClearCoatTintTextureEnabled&&!this._tintTexture.isReadyOrNotBlocking()))}prepareDefinesBeforeAttributes(e,t){this._isEnabled?(e.CLEARCOAT=!0,e.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,e.CLEARCOAT_REMAP_F0=this._remapF0OnInterfaceChange,e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&U.ClearCoatTextureEnabled?Ne(this._texture,e,"CLEARCOAT_TEXTURE"):e.CLEARCOAT_TEXTURE=!1,this._textureRoughness&&U.ClearCoatTextureEnabled?Ne(this._textureRoughness,e,"CLEARCOAT_TEXTURE_ROUGHNESS"):e.CLEARCOAT_TEXTURE_ROUGHNESS=!1,this._bumpTexture&&U.ClearCoatBumpTextureEnabled?Ne(this._bumpTexture,e,"CLEARCOAT_BUMP"):e.CLEARCOAT_BUMP=!1,e.CLEARCOAT_DEFAULTIOR=this._indexOfRefraction===dt._DefaultIndexOfRefraction,this._isTintEnabled?(e.CLEARCOAT_TINT=!0,this._tintTexture&&U.ClearCoatTintTextureEnabled?(Ne(this._tintTexture,e,"CLEARCOAT_TINT_TEXTURE"),e.CLEARCOAT_TINT_GAMMATEXTURE=this._tintTexture.gammaSpace):e.CLEARCOAT_TINT_TEXTURE=!1):(e.CLEARCOAT_TINT=!1,e.CLEARCOAT_TINT_TEXTURE=!1))):(e.CLEARCOAT=!1,e.CLEARCOAT_TEXTURE=!1,e.CLEARCOAT_TEXTURE_ROUGHNESS=!1,e.CLEARCOAT_BUMP=!1,e.CLEARCOAT_TINT=!1,e.CLEARCOAT_TINT_TEXTURE=!1,e.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.CLEARCOAT_DEFAULTIOR=!1,e.CLEARCOAT_TEXTUREDIRECTUV=0,e.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV=0,e.CLEARCOAT_BUMPDIRECTUV=0,e.CLEARCOAT_REMAP_F0=!1,e.CLEARCOAT_TINT_TEXTUREDIRECTUV=0,e.CLEARCOAT_TINT_GAMMATEXTURE=!1)}bindForSubMesh(e,t,i,s){if(!this._isEnabled)return;const r=s.materialDefines,n=this._material.isFrozen,o=this._material._disableBumpMap,h=this._material._invertNormalMapX,l=this._material._invertNormalMapY;if(!e.useUbo||!n||!e.isSync){(this._texture||this._textureRoughness)&&U.ClearCoatTextureEnabled&&(e.updateFloat4("vClearCoatInfos",this._texture?.coordinatesIndex??0,this._texture?.level??0,this._textureRoughness?.coordinatesIndex??0,this._textureRoughness?.level??0),this._texture&&Ue(this._texture,e,"clearCoat"),this._textureRoughness&&!r.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE&&Ue(this._textureRoughness,e,"clearCoatRoughness")),this._bumpTexture&&i.getCaps().standardDerivatives&&U.ClearCoatTextureEnabled&&!o&&(e.updateFloat2("vClearCoatBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level),Ue(this._bumpTexture,e,"clearCoatBump"),t._mirroredCameraPosition?e.updateFloat2("vClearCoatTangentSpaceParams",h?1:-1,l?1:-1):e.updateFloat2("vClearCoatTangentSpaceParams",h?-1:1,l?-1:1)),this._tintTexture&&U.ClearCoatTintTextureEnabled&&(e.updateFloat2("vClearCoatTintInfos",this._tintTexture.coordinatesIndex,this._tintTexture.level),Ue(this._tintTexture,e,"clearCoatTint")),e.updateFloat2("vClearCoatParams",this.intensity,this.roughness);const c=1-this._indexOfRefraction,u=1+this._indexOfRefraction,f=Math.pow(-c/u,2),d=1/this._indexOfRefraction;e.updateFloat4("vClearCoatRefractionParams",f,d,c,u),this._isTintEnabled&&(e.updateFloat4("vClearCoatTintParams",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintThickness)),e.updateFloat("clearCoatColorAtDistance",Math.max(1e-5,this.tintColorAtDistance)))}t.texturesEnabled&&(this._texture&&U.ClearCoatTextureEnabled&&e.setTexture("clearCoatSampler",this._texture),this._textureRoughness&&!r.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE&&U.ClearCoatTextureEnabled&&e.setTexture("clearCoatRoughnessSampler",this._textureRoughness),this._bumpTexture&&i.getCaps().standardDerivatives&&U.ClearCoatBumpTextureEnabled&&!o&&e.setTexture("clearCoatBumpSampler",this._bumpTexture),this._isTintEnabled&&this._tintTexture&&U.ClearCoatTintTextureEnabled&&e.setTexture("clearCoatTintSampler",this._tintTexture))}hasTexture(e){return this._texture===e||this._textureRoughness===e||this._bumpTexture===e||this._tintTexture===e}getActiveTextures(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness),this._bumpTexture&&e.push(this._bumpTexture),this._tintTexture&&e.push(this._tintTexture)}getAnimatables(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&this._textureRoughness.animations.length>0&&e.push(this._textureRoughness),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._tintTexture&&this._tintTexture.animations&&this._tintTexture.animations.length>0&&e.push(this._tintTexture)}dispose(e){e&&(this._texture?.dispose(),this._textureRoughness?.dispose(),this._bumpTexture?.dispose(),this._tintTexture?.dispose())}getClassName(){return"PBRClearCoatConfiguration"}addFallbacks(e,t,i){return e.CLEARCOAT_BUMP&&t.addFallback(i++,"CLEARCOAT_BUMP"),e.CLEARCOAT_TINT&&t.addFallback(i++,"CLEARCOAT_TINT"),e.CLEARCOAT&&t.addFallback(i++,"CLEARCOAT"),i}getSamplers(e){e.push("clearCoatSampler","clearCoatRoughnessSampler","clearCoatBumpSampler","clearCoatTintSampler")}getUniforms(){return{ubo:[{name:"vClearCoatParams",size:2,type:"vec2"},{name:"vClearCoatRefractionParams",size:4,type:"vec4"},{name:"vClearCoatInfos",size:4,type:"vec4"},{name:"clearCoatMatrix",size:16,type:"mat4"},{name:"clearCoatRoughnessMatrix",size:16,type:"mat4"},{name:"vClearCoatBumpInfos",size:2,type:"vec2"},{name:"vClearCoatTangentSpaceParams",size:2,type:"vec2"},{name:"clearCoatBumpMatrix",size:16,type:"mat4"},{name:"vClearCoatTintParams",size:4,type:"vec4"},{name:"clearCoatColorAtDistance",size:1,type:"float"},{name:"vClearCoatTintInfos",size:2,type:"vec2"},{name:"clearCoatTintMatrix",size:16,type:"mat4"}]}}}dt._DefaultIndexOfRefraction=1.5;T([R(),B("_markAllSubMeshesAsTexturesDirty")],dt.prototype,"isEnabled",void 0);T([R()],dt.prototype,"intensity",void 0);T([R()],dt.prototype,"roughness",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],dt.prototype,"indexOfRefraction",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],dt.prototype,"texture",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],dt.prototype,"useRoughnessFromMainTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],dt.prototype,"textureRoughness",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],dt.prototype,"remapF0OnInterfaceChange",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],dt.prototype,"bumpTexture",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],dt.prototype,"isTintEnabled",void 0);T([At()],dt.prototype,"tintColor",void 0);T([R()],dt.prototype,"tintColorAtDistance",void 0);T([R()],dt.prototype,"tintThickness",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],dt.prototype,"tintTexture",void 0);class Dd extends Si{constructor(){super(...arguments),this.IRIDESCENCE=!1,this.IRIDESCENCE_TEXTURE=!1,this.IRIDESCENCE_TEXTUREDIRECTUV=0,this.IRIDESCENCE_THICKNESS_TEXTURE=!1,this.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV=0}}class Mt extends Qt{_markAllSubMeshesAsTexturesDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}isCompatible(){return!0}constructor(e,t=!0){super(e,"PBRIridescence",110,new Dd,t),this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.minimumThickness=Mt._DefaultMinimumThickness,this.maximumThickness=Mt._DefaultMaximumThickness,this.indexOfRefraction=Mt._DefaultIndexOfRefraction,this._texture=null,this.texture=null,this._thicknessTexture=null,this.thicknessTexture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1]}isReadyForSubMesh(e,t){return this._isEnabled?!(e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&U.IridescenceTextureEnabled&&!this._texture.isReadyOrNotBlocking()||this._thicknessTexture&&U.IridescenceTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())):!0}prepareDefinesBeforeAttributes(e,t){this._isEnabled?(e.IRIDESCENCE=!0,e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&U.IridescenceTextureEnabled?Ne(this._texture,e,"IRIDESCENCE_TEXTURE"):e.IRIDESCENCE_TEXTURE=!1,this._thicknessTexture&&U.IridescenceTextureEnabled?Ne(this._thicknessTexture,e,"IRIDESCENCE_THICKNESS_TEXTURE"):e.IRIDESCENCE_THICKNESS_TEXTURE=!1)):(e.IRIDESCENCE=!1,e.IRIDESCENCE_TEXTURE=!1,e.IRIDESCENCE_THICKNESS_TEXTURE=!1,e.IRIDESCENCE_TEXTUREDIRECTUV=0,e.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV=0)}bindForSubMesh(e,t){if(!this._isEnabled)return;const i=this._material.isFrozen;(!e.useUbo||!i||!e.isSync)&&((this._texture||this._thicknessTexture)&&U.IridescenceTextureEnabled&&(e.updateFloat4("vIridescenceInfos",this._texture?.coordinatesIndex??0,this._texture?.level??0,this._thicknessTexture?.coordinatesIndex??0,this._thicknessTexture?.level??0),this._texture&&Ue(this._texture,e,"iridescence"),this._thicknessTexture&&Ue(this._thicknessTexture,e,"iridescenceThickness")),e.updateFloat4("vIridescenceParams",this.intensity,this.indexOfRefraction,this.minimumThickness,this.maximumThickness)),t.texturesEnabled&&(this._texture&&U.IridescenceTextureEnabled&&e.setTexture("iridescenceSampler",this._texture),this._thicknessTexture&&U.IridescenceTextureEnabled&&e.setTexture("iridescenceThicknessSampler",this._thicknessTexture))}hasTexture(e){return this._texture===e||this._thicknessTexture===e}getActiveTextures(e){this._texture&&e.push(this._texture),this._thicknessTexture&&e.push(this._thicknessTexture)}getAnimatables(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._thicknessTexture&&this._thicknessTexture.animations&&this._thicknessTexture.animations.length>0&&e.push(this._thicknessTexture)}dispose(e){e&&(this._texture?.dispose(),this._thicknessTexture?.dispose())}getClassName(){return"PBRIridescenceConfiguration"}addFallbacks(e,t,i){return e.IRIDESCENCE&&t.addFallback(i++,"IRIDESCENCE"),i}getSamplers(e){e.push("iridescenceSampler","iridescenceThicknessSampler")}getUniforms(){return{ubo:[{name:"vIridescenceParams",size:4,type:"vec4"},{name:"vIridescenceInfos",size:4,type:"vec4"},{name:"iridescenceMatrix",size:16,type:"mat4"},{name:"iridescenceThicknessMatrix",size:16,type:"mat4"}]}}}Mt._DefaultMinimumThickness=100;Mt._DefaultMaximumThickness=400;Mt._DefaultIndexOfRefraction=1.3;T([R(),B("_markAllSubMeshesAsTexturesDirty")],Mt.prototype,"isEnabled",void 0);T([R()],Mt.prototype,"intensity",void 0);T([R()],Mt.prototype,"minimumThickness",void 0);T([R()],Mt.prototype,"maximumThickness",void 0);T([R()],Mt.prototype,"indexOfRefraction",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],Mt.prototype,"texture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],Mt.prototype,"thicknessTexture",void 0);class Od extends Si{constructor(){super(...arguments),this.ANISOTROPIC=!1,this.ANISOTROPIC_TEXTURE=!1,this.ANISOTROPIC_TEXTUREDIRECTUV=0,this.ANISOTROPIC_LEGACY=!1,this.MAINUV1=!1}}class Ms extends Qt{set angle(e){this.direction.x=Math.cos(e),this.direction.y=Math.sin(e)}get angle(){return Math.atan2(this.direction.y,this.direction.x)}_markAllSubMeshesAsTexturesDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}_markAllSubMeshesAsMiscDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsMiscDirty()}isCompatible(){return!0}constructor(e,t=!0){super(e,"PBRAnisotropic",110,new Od,t),this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.direction=new Q(1,0),this._texture=null,this.texture=null,this._legacy=!1,this.legacy=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1],this._internalMarkAllSubMeshesAsMiscDirty=e._dirtyCallbacks[16]}isReadyForSubMesh(e,t){return this._isEnabled?!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&U.AnisotropicTextureEnabled&&!this._texture.isReadyOrNotBlocking()):!0}prepareDefinesBeforeAttributes(e,t,i){this._isEnabled?(e.ANISOTROPIC=this._isEnabled,this._isEnabled&&!i.isVerticesDataPresent(b.TangentKind)&&(e._needUVs=!0,e.MAINUV1=!0),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&U.AnisotropicTextureEnabled?Ne(this._texture,e,"ANISOTROPIC_TEXTURE"):e.ANISOTROPIC_TEXTURE=!1),e._areMiscDirty&&(e.ANISOTROPIC_LEGACY=this._legacy)):(e.ANISOTROPIC=!1,e.ANISOTROPIC_TEXTURE=!1,e.ANISOTROPIC_TEXTUREDIRECTUV=0,e.ANISOTROPIC_LEGACY=!1)}bindForSubMesh(e,t){if(!this._isEnabled)return;const i=this._material.isFrozen;(!e.useUbo||!i||!e.isSync)&&(this._texture&&U.AnisotropicTextureEnabled&&(e.updateFloat2("vAnisotropyInfos",this._texture.coordinatesIndex,this._texture.level),Ue(this._texture,e,"anisotropy")),e.updateFloat3("vAnisotropy",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&U.AnisotropicTextureEnabled&&e.setTexture("anisotropySampler",this._texture)}hasTexture(e){return this._texture===e}getActiveTextures(e){this._texture&&e.push(this._texture)}getAnimatables(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)}dispose(e){e&&this._texture&&this._texture.dispose()}getClassName(){return"PBRAnisotropicConfiguration"}addFallbacks(e,t,i){return e.ANISOTROPIC&&t.addFallback(i++,"ANISOTROPIC"),i}getSamplers(e){e.push("anisotropySampler")}getUniforms(){return{ubo:[{name:"vAnisotropy",size:3,type:"vec3"},{name:"vAnisotropyInfos",size:2,type:"vec2"},{name:"anisotropyMatrix",size:16,type:"mat4"}]}}parse(e,t,i){super.parse(e,t,i),e.legacy===void 0&&(this.legacy=!0)}}T([R(),B("_markAllSubMeshesAsTexturesDirty")],Ms.prototype,"isEnabled",void 0);T([R()],Ms.prototype,"intensity",void 0);T([co()],Ms.prototype,"direction",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],Ms.prototype,"texture",void 0);T([R(),B("_markAllSubMeshesAsMiscDirty")],Ms.prototype,"legacy",void 0);class Fd extends Si{constructor(){super(...arguments),this.SHEEN=!1,this.SHEEN_TEXTURE=!1,this.SHEEN_GAMMATEXTURE=!1,this.SHEEN_TEXTURE_ROUGHNESS=!1,this.SHEEN_TEXTUREDIRECTUV=0,this.SHEEN_TEXTURE_ROUGHNESSDIRECTUV=0,this.SHEEN_LINKWITHALBEDO=!1,this.SHEEN_ROUGHNESS=!1,this.SHEEN_ALBEDOSCALING=!1,this.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=!1}}class li extends Qt{_markAllSubMeshesAsTexturesDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}isCompatible(){return!0}constructor(e,t=!0){super(e,"Sheen",120,new Fd,t),this._isEnabled=!1,this.isEnabled=!1,this._linkSheenWithAlbedo=!1,this.linkSheenWithAlbedo=!1,this.intensity=1,this.color=q.White(),this._texture=null,this.texture=null,this._useRoughnessFromMainTexture=!0,this.useRoughnessFromMainTexture=!0,this._roughness=null,this.roughness=null,this._textureRoughness=null,this.textureRoughness=null,this._albedoScaling=!1,this.albedoScaling=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1]}isReadyForSubMesh(e,t){return this._isEnabled?!(e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&U.SheenTextureEnabled&&!this._texture.isReadyOrNotBlocking()||this._textureRoughness&&U.SheenTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking())):!0}prepareDefinesBeforeAttributes(e,t){this._isEnabled?(e.SHEEN=!0,e.SHEEN_LINKWITHALBEDO=this._linkSheenWithAlbedo,e.SHEEN_ROUGHNESS=this._roughness!==null,e.SHEEN_ALBEDOSCALING=this._albedoScaling,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&U.SheenTextureEnabled?(Ne(this._texture,e,"SHEEN_TEXTURE"),e.SHEEN_GAMMATEXTURE=this._texture.gammaSpace):e.SHEEN_TEXTURE=!1,this._textureRoughness&&U.SheenTextureEnabled?Ne(this._textureRoughness,e,"SHEEN_TEXTURE_ROUGHNESS"):e.SHEEN_TEXTURE_ROUGHNESS=!1)):(e.SHEEN=!1,e.SHEEN_TEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS=!1,e.SHEEN_LINKWITHALBEDO=!1,e.SHEEN_ROUGHNESS=!1,e.SHEEN_ALBEDOSCALING=!1,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.SHEEN_GAMMATEXTURE=!1,e.SHEEN_TEXTUREDIRECTUV=0,e.SHEEN_TEXTURE_ROUGHNESSDIRECTUV=0)}bindForSubMesh(e,t,i,s){if(!this._isEnabled)return;const r=s.materialDefines,n=this._material.isFrozen;(!e.useUbo||!n||!e.isSync)&&((this._texture||this._textureRoughness)&&U.SheenTextureEnabled&&(e.updateFloat4("vSheenInfos",this._texture?.coordinatesIndex??0,this._texture?.level??0,this._textureRoughness?.coordinatesIndex??0,this._textureRoughness?.level??0),this._texture&&Ue(this._texture,e,"sheen"),this._textureRoughness&&!r.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE&&Ue(this._textureRoughness,e,"sheenRoughness")),e.updateFloat4("vSheenColor",this.color.r,this.color.g,this.color.b,this.intensity),this._roughness!==null&&e.updateFloat("vSheenRoughness",this._roughness)),t.texturesEnabled&&(this._texture&&U.SheenTextureEnabled&&e.setTexture("sheenSampler",this._texture),this._textureRoughness&&!r.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE&&U.SheenTextureEnabled&&e.setTexture("sheenRoughnessSampler",this._textureRoughness))}hasTexture(e){return this._texture===e||this._textureRoughness===e}getActiveTextures(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness)}getAnimatables(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&this._textureRoughness.animations.length>0&&e.push(this._textureRoughness)}dispose(e){e&&(this._texture?.dispose(),this._textureRoughness?.dispose())}getClassName(){return"PBRSheenConfiguration"}addFallbacks(e,t,i){return e.SHEEN&&t.addFallback(i++,"SHEEN"),i}getSamplers(e){e.push("sheenSampler","sheenRoughnessSampler")}getUniforms(){return{ubo:[{name:"vSheenColor",size:4,type:"vec4"},{name:"vSheenRoughness",size:1,type:"float"},{name:"vSheenInfos",size:4,type:"vec4"},{name:"sheenMatrix",size:16,type:"mat4"},{name:"sheenRoughnessMatrix",size:16,type:"mat4"}]}}}T([R(),B("_markAllSubMeshesAsTexturesDirty")],li.prototype,"isEnabled",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],li.prototype,"linkSheenWithAlbedo",void 0);T([R()],li.prototype,"intensity",void 0);T([At()],li.prototype,"color",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],li.prototype,"texture",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],li.prototype,"useRoughnessFromMainTexture",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],li.prototype,"roughness",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],li.prototype,"textureRoughness",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],li.prototype,"albedoScaling",void 0);class wd extends Si{constructor(){super(...arguments),this.SUBSURFACE=!1,this.SS_REFRACTION=!1,this.SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS=!1,this.SS_TRANSLUCENCY=!1,this.SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS=!1,this.SS_SCATTERING=!1,this.SS_DISPERSION=!1,this.SS_THICKNESSANDMASK_TEXTURE=!1,this.SS_THICKNESSANDMASK_TEXTUREDIRECTUV=0,this.SS_HAS_THICKNESS=!1,this.SS_REFRACTIONINTENSITY_TEXTURE=!1,this.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV=0,this.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,this.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV=0,this.SS_TRANSLUCENCYCOLOR_TEXTURE=!1,this.SS_TRANSLUCENCYCOLOR_TEXTUREDIRECTUV=0,this.SS_TRANSLUCENCYCOLOR_TEXTURE_GAMMA=!1,this.SS_REFRACTIONMAP_3D=!1,this.SS_REFRACTIONMAP_OPPOSITEZ=!1,this.SS_LODINREFRACTIONALPHA=!1,this.SS_GAMMAREFRACTION=!1,this.SS_RGBDREFRACTION=!1,this.SS_LINEARSPECULARREFRACTION=!1,this.SS_LINKREFRACTIONTOTRANSPARENCY=!1,this.SS_ALBEDOFORREFRACTIONTINT=!1,this.SS_ALBEDOFORTRANSLUCENCYTINT=!1,this.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,this.SS_USE_THICKNESS_AS_DEPTH=!1,this.SS_USE_GLTF_TEXTURES=!1,this.SS_APPLY_ALBEDO_AFTER_SUBSURFACE=!1,this.SS_TRANSLUCENCY_LEGACY=!1}}class Ce extends Qt{get scatteringDiffusionProfile(){return this._scene.subSurfaceConfiguration?this._scene.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex]:null}set scatteringDiffusionProfile(e){this._scene.enableSubSurfaceForPrePass()&&e&&(this._scatteringDiffusionProfileIndex=this._scene.subSurfaceConfiguration.addDiffusionProfile(e))}get volumeIndexOfRefraction(){return this._volumeIndexOfRefraction>=1?this._volumeIndexOfRefraction:this._indexOfRefraction}set volumeIndexOfRefraction(e){e>=1?this._volumeIndexOfRefraction=e:this._volumeIndexOfRefraction=-1}get legacyTransluceny(){return this.legacyTranslucency}set legacyTransluceny(e){this.legacyTranslucency=e}_markAllSubMeshesAsTexturesDirty(){this._enable(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}_markScenePrePassDirty(){this._enable(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled),this._internalMarkAllSubMeshesAsTexturesDirty(),this._internalMarkScenePrePassDirty()}isCompatible(){return!0}constructor(e,t=!0){super(e,"PBRSubSurface",130,new wd,t),this._isRefractionEnabled=!1,this.isRefractionEnabled=!1,this._isTranslucencyEnabled=!1,this.isTranslucencyEnabled=!1,this._isDispersionEnabled=!1,this.isDispersionEnabled=!1,this._isScatteringEnabled=!1,this.isScatteringEnabled=!1,this._scatteringDiffusionProfileIndex=0,this.refractionIntensity=1,this.translucencyIntensity=1,this._useAlbedoToTintRefraction=!1,this.useAlbedoToTintRefraction=!1,this._useAlbedoToTintTranslucency=!1,this.useAlbedoToTintTranslucency=!1,this._thicknessTexture=null,this.thicknessTexture=null,this._refractionTexture=null,this.refractionTexture=null,this._indexOfRefraction=1.5,this.indexOfRefraction=1.5,this._volumeIndexOfRefraction=-1,this._invertRefractionY=!1,this.invertRefractionY=!1,this._linkRefractionWithTransparency=!1,this.linkRefractionWithTransparency=!1,this.minimumThickness=0,this.maximumThickness=1,this.useThicknessAsDepth=!1,this.tintColor=q.White(),this.tintColorAtDistance=1,this.dispersion=0,this.diffusionDistance=q.White(),this._useMaskFromThicknessTexture=!1,this.useMaskFromThicknessTexture=!1,this._refractionIntensityTexture=null,this.refractionIntensityTexture=null,this._translucencyIntensityTexture=null,this.translucencyIntensityTexture=null,this.translucencyColor=null,this._translucencyColorTexture=null,this.translucencyColorTexture=null,this._useGltfStyleTextures=!0,this.useGltfStyleTextures=!0,this.applyAlbedoAfterSubSurface=Ce.DEFAULT_APPLY_ALBEDO_AFTERSUBSURFACE,this.legacyTranslucency=Ce.DEFAULT_LEGACY_TRANSLUCENCY,this._scene=e.getScene(),this.registerForExtraEvents=!0,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1],this._internalMarkScenePrePassDirty=e._dirtyCallbacks[32]}isReadyForSubMesh(e,t){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._thicknessTexture&&U.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking()||this._refractionIntensityTexture&&U.RefractionIntensityTextureEnabled&&!this._refractionIntensityTexture.isReadyOrNotBlocking()||this._translucencyColorTexture&&U.TranslucencyColorTextureEnabled&&!this._translucencyColorTexture.isReadyOrNotBlocking()||this._translucencyIntensityTexture&&U.TranslucencyIntensityTextureEnabled&&!this._translucencyIntensityTexture.isReadyOrNotBlocking())return!1;const i=this._getRefractionTexture(t);if(i&&U.RefractionTextureEnabled&&!i.isReadyOrNotBlocking())return!1}return!0}prepareDefinesBeforeAttributes(e,t){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled){e.SUBSURFACE=!1,e.SS_DISPERSION=!1,e.SS_TRANSLUCENCY=!1,e.SS_SCATTERING=!1,e.SS_REFRACTION=!1,e.SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS=!1,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS=!1,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_THICKNESSANDMASK_TEXTUREDIRECTUV=0,e.SS_HAS_THICKNESS=!1,e.SS_REFRACTIONINTENSITY_TEXTURE=!1,e.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV=0,e.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,e.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV=0,e.SS_REFRACTIONMAP_3D=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,e.SS_ALBEDOFORTRANSLUCENCYTINT=!1,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,e.SS_USE_THICKNESS_AS_DEPTH=!1,e.SS_USE_GLTF_TEXTURES=!1,e.SS_TRANSLUCENCYCOLOR_TEXTURE=!1,e.SS_TRANSLUCENCYCOLOR_TEXTUREDIRECTUV=0,e.SS_TRANSLUCENCYCOLOR_TEXTURE_GAMMA=!1,e.SS_APPLY_ALBEDO_AFTER_SUBSURFACE=!1;return}if(e._areTexturesDirty){if(e.SUBSURFACE=!0,e.SS_DISPERSION=this._isDispersionEnabled,e.SS_TRANSLUCENCY=this._isTranslucencyEnabled,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS=!1,e.SS_TRANSLUCENCY_LEGACY=this.legacyTranslucency,e.SS_SCATTERING=this._isScatteringEnabled,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_REFRACTIONINTENSITY_TEXTURE=!1,e.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,e.SS_HAS_THICKNESS=!1,e.SS_USE_GLTF_TEXTURES=!1,e.SS_REFRACTION=!1,e.SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS=!1,e.SS_REFRACTIONMAP_3D=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,e.SS_ALBEDOFORTRANSLUCENCYTINT=!1,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,e.SS_USE_THICKNESS_AS_DEPTH=!1,e.SS_TRANSLUCENCYCOLOR_TEXTURE=!1,e.SS_APPLY_ALBEDO_AFTER_SUBSURFACE=this.applyAlbedoAfterSubSurface,e._areTexturesDirty&&t.texturesEnabled&&(this._thicknessTexture&&U.ThicknessTextureEnabled&&Ne(this._thicknessTexture,e,"SS_THICKNESSANDMASK_TEXTURE"),this._refractionIntensityTexture&&U.RefractionIntensityTextureEnabled&&Ne(this._refractionIntensityTexture,e,"SS_REFRACTIONINTENSITY_TEXTURE"),this._translucencyIntensityTexture&&U.TranslucencyIntensityTextureEnabled&&Ne(this._translucencyIntensityTexture,e,"SS_TRANSLUCENCYINTENSITY_TEXTURE"),this._translucencyColorTexture&&U.TranslucencyColorTextureEnabled&&(Ne(this._translucencyColorTexture,e,"SS_TRANSLUCENCYCOLOR_TEXTURE"),e.SS_TRANSLUCENCYCOLOR_TEXTURE_GAMMA=this._translucencyColorTexture.gammaSpace)),e.SS_HAS_THICKNESS=this.maximumThickness-this.minimumThickness!==0,e.SS_USE_GLTF_TEXTURES=this._useGltfStyleTextures,e.SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS=this._useMaskFromThicknessTexture&&!this._refractionIntensityTexture,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS=this._useMaskFromThicknessTexture&&!this._translucencyIntensityTexture,this._isRefractionEnabled&&t.texturesEnabled){const i=this._getRefractionTexture(t);i&&U.RefractionTextureEnabled&&(e.SS_REFRACTION=!0,e.SS_REFRACTIONMAP_3D=i.isCube,e.SS_GAMMAREFRACTION=i.gammaSpace,e.SS_RGBDREFRACTION=i.isRGBD,e.SS_LINEARSPECULARREFRACTION=i.linearSpecularLOD,e.SS_REFRACTIONMAP_OPPOSITEZ=this._scene.useRightHandedSystem&&i.isCube?!i.invertZ:i.invertZ,e.SS_LODINREFRACTIONALPHA=i.lodLevelInAlpha,e.SS_LINKREFRACTIONTOTRANSPARENCY=this._linkRefractionWithTransparency,e.SS_ALBEDOFORREFRACTIONTINT=this._useAlbedoToTintRefraction,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=i.isCube&&i.boundingBoxSize,e.SS_USE_THICKNESS_AS_DEPTH=this.useThicknessAsDepth)}this._isTranslucencyEnabled&&(e.SS_ALBEDOFORTRANSLUCENCYTINT=this._useAlbedoToTintTranslucency)}}hardBindForSubMesh(e,t,i,s){if(!(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled))if(this.maximumThickness===0&&this.minimumThickness===0)e.updateFloat2("vThicknessParam",0,0);else{s.getRenderingMesh().getWorldMatrix().decompose(v.Vector3[0]);const r=Math.max(Math.abs(v.Vector3[0].x),Math.abs(v.Vector3[0].y),Math.abs(v.Vector3[0].z));e.updateFloat2("vThicknessParam",this.minimumThickness*r,(this.maximumThickness-this.minimumThickness)*r)}}bindForSubMesh(e,t,i,s){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled)return;const r=s.materialDefines,n=this._material.isFrozen,o=this._material.realTimeFiltering,h=r.LODBASEDMICROSFURACE,l=this._getRefractionTexture(t);if(!e.useUbo||!n||!e.isSync){if(this._thicknessTexture&&U.ThicknessTextureEnabled&&(e.updateFloat2("vThicknessInfos",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),Ue(this._thicknessTexture,e,"thickness")),this._refractionIntensityTexture&&U.RefractionIntensityTextureEnabled&&r.SS_REFRACTIONINTENSITY_TEXTURE&&(e.updateFloat2("vRefractionIntensityInfos",this._refractionIntensityTexture.coordinatesIndex,this._refractionIntensityTexture.level),Ue(this._refractionIntensityTexture,e,"refractionIntensity")),this._translucencyColorTexture&&U.TranslucencyColorTextureEnabled&&r.SS_TRANSLUCENCYCOLOR_TEXTURE&&(e.updateFloat2("vTranslucencyColorInfos",this._translucencyColorTexture.coordinatesIndex,this._translucencyColorTexture.level),Ue(this._translucencyColorTexture,e,"translucencyColor")),this._translucencyIntensityTexture&&U.TranslucencyIntensityTextureEnabled&&r.SS_TRANSLUCENCYINTENSITY_TEXTURE&&(e.updateFloat2("vTranslucencyIntensityInfos",this._translucencyIntensityTexture.coordinatesIndex,this._translucencyIntensityTexture.level),Ue(this._translucencyIntensityTexture,e,"translucencyIntensity")),l&&U.RefractionTextureEnabled){e.updateMatrix("refractionMatrix",l.getRefractionTextureMatrix());let c=1;l.isCube||l.depth&&(c=l.depth);const u=l.getSize().width,f=this.volumeIndexOfRefraction;if(e.updateFloat4("vRefractionInfos",l.level,1/f,c,this._invertRefractionY?-1:1),e.updateFloat4("vRefractionMicrosurfaceInfos",u,l.lodGenerationScale,l.lodGenerationOffset,1/this.indexOfRefraction),o&&e.updateFloat2("vRefractionFilteringInfo",u,Math.log2(u)),l.boundingBoxSize){const d=l;e.updateVector3("vRefractionPosition",d.boundingBoxPosition),e.updateVector3("vRefractionSize",d.boundingBoxSize)}}this._isScatteringEnabled&&e.updateFloat("scatteringDiffusionProfile",this._scatteringDiffusionProfileIndex),e.updateColor3("vDiffusionDistance",this.diffusionDistance),e.updateFloat4("vTintColor",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintColorAtDistance)),e.updateColor4("vTranslucencyColor",this.translucencyColor??this.tintColor,0),e.updateFloat3("vSubSurfaceIntensity",this.refractionIntensity,this.translucencyIntensity,0),e.updateFloat("dispersion",this.dispersion)}t.texturesEnabled&&(this._thicknessTexture&&U.ThicknessTextureEnabled&&e.setTexture("thicknessSampler",this._thicknessTexture),this._refractionIntensityTexture&&U.RefractionIntensityTextureEnabled&&r.SS_REFRACTIONINTENSITY_TEXTURE&&e.setTexture("refractionIntensitySampler",this._refractionIntensityTexture),this._translucencyIntensityTexture&&U.TranslucencyIntensityTextureEnabled&&r.SS_TRANSLUCENCYINTENSITY_TEXTURE&&e.setTexture("translucencyIntensitySampler",this._translucencyIntensityTexture),this._translucencyColorTexture&&U.TranslucencyColorTextureEnabled&&r.SS_TRANSLUCENCYCOLOR_TEXTURE&&e.setTexture("translucencyColorSampler",this._translucencyColorTexture),l&&U.RefractionTextureEnabled&&(h?e.setTexture("refractionSampler",l):(e.setTexture("refractionSampler",l._lodTextureMid||l),e.setTexture("refractionSamplerLow",l._lodTextureLow||l),e.setTexture("refractionSamplerHigh",l._lodTextureHigh||l))))}_getRefractionTexture(e){return this._refractionTexture?this._refractionTexture:this._isRefractionEnabled?e.environmentTexture:null}get disableAlphaBlending(){return this._isRefractionEnabled&&this._linkRefractionWithTransparency}fillRenderTargetTextures(e){U.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&e.push(this._refractionTexture)}hasTexture(e){return this._thicknessTexture===e||this._refractionTexture===e||this._refractionIntensityTexture===e||this._translucencyIntensityTexture===e||this._translucencyColorTexture===e}hasRenderTargetTextures(){return!!(U.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)}getActiveTextures(e){this._thicknessTexture&&e.push(this._thicknessTexture),this._refractionTexture&&e.push(this._refractionTexture),this._refractionIntensityTexture&&e.push(this._refractionIntensityTexture),this._translucencyColorTexture&&e.push(this._translucencyColorTexture),this._translucencyIntensityTexture&&e.push(this._translucencyIntensityTexture)}getAnimatables(e){this._thicknessTexture&&this._thicknessTexture.animations&&this._thicknessTexture.animations.length>0&&e.push(this._thicknessTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture),this._refractionIntensityTexture&&this._refractionIntensityTexture.animations&&this._refractionIntensityTexture.animations.length>0&&e.push(this._refractionIntensityTexture),this._translucencyColorTexture&&this._translucencyColorTexture.animations&&this._translucencyColorTexture.animations.length>0&&e.push(this._translucencyColorTexture),this._translucencyIntensityTexture&&this._translucencyIntensityTexture.animations&&this._translucencyIntensityTexture.animations.length>0&&e.push(this._translucencyIntensityTexture)}dispose(e){e&&(this._thicknessTexture&&this._thicknessTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose(),this._refractionIntensityTexture&&this._refractionIntensityTexture.dispose(),this._translucencyColorTexture&&this._translucencyColorTexture.dispose(),this._translucencyIntensityTexture&&this._translucencyIntensityTexture.dispose())}getClassName(){return"PBRSubSurfaceConfiguration"}addFallbacks(e,t,i){return e.SS_SCATTERING&&t.addFallback(i++,"SS_SCATTERING"),e.SS_TRANSLUCENCY&&t.addFallback(i++,"SS_TRANSLUCENCY"),i}getSamplers(e){e.push("thicknessSampler","refractionIntensitySampler","translucencyIntensitySampler","refractionSampler","refractionSamplerLow","refractionSamplerHigh","translucencyColorSampler")}getUniforms(){return{ubo:[{name:"vRefractionMicrosurfaceInfos",size:4,type:"vec4"},{name:"vRefractionFilteringInfo",size:2,type:"vec2"},{name:"vTranslucencyIntensityInfos",size:2,type:"vec2"},{name:"vRefractionInfos",size:4,type:"vec4"},{name:"refractionMatrix",size:16,type:"mat4"},{name:"vThicknessInfos",size:2,type:"vec2"},{name:"vRefractionIntensityInfos",size:2,type:"vec2"},{name:"thicknessMatrix",size:16,type:"mat4"},{name:"refractionIntensityMatrix",size:16,type:"mat4"},{name:"translucencyIntensityMatrix",size:16,type:"mat4"},{name:"vThicknessParam",size:2,type:"vec2"},{name:"vDiffusionDistance",size:3,type:"vec3"},{name:"vTintColor",size:4,type:"vec4"},{name:"vSubSurfaceIntensity",size:3,type:"vec3"},{name:"vRefractionPosition",size:3,type:"vec3"},{name:"vRefractionSize",size:3,type:"vec3"},{name:"scatteringDiffusionProfile",size:1,type:"float"},{name:"dispersion",size:1,type:"float"},{name:"vTranslucencyColor",size:4,type:"vec4"},{name:"vTranslucencyColorInfos",size:2,type:"vec2"},{name:"translucencyColorMatrix",size:16,type:"mat4"}]}}}Ce.DEFAULT_APPLY_ALBEDO_AFTERSUBSURFACE=!1;Ce.DEFAULT_LEGACY_TRANSLUCENCY=!1;T([R(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"isRefractionEnabled",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"isTranslucencyEnabled",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"isDispersionEnabled",void 0);T([R(),B("_markScenePrePassDirty")],Ce.prototype,"isScatteringEnabled",void 0);T([R()],Ce.prototype,"_scatteringDiffusionProfileIndex",void 0);T([R()],Ce.prototype,"refractionIntensity",void 0);T([R()],Ce.prototype,"translucencyIntensity",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"useAlbedoToTintRefraction",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"useAlbedoToTintTranslucency",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"thicknessTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"refractionTexture",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"indexOfRefraction",void 0);T([R()],Ce.prototype,"_volumeIndexOfRefraction",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"volumeIndexOfRefraction",null);T([R(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"invertRefractionY",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"linkRefractionWithTransparency",void 0);T([R()],Ce.prototype,"minimumThickness",void 0);T([R()],Ce.prototype,"maximumThickness",void 0);T([R()],Ce.prototype,"useThicknessAsDepth",void 0);T([At()],Ce.prototype,"tintColor",void 0);T([R()],Ce.prototype,"tintColorAtDistance",void 0);T([R()],Ce.prototype,"dispersion",void 0);T([At()],Ce.prototype,"diffusionDistance",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"useMaskFromThicknessTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"refractionIntensityTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"translucencyIntensityTexture",void 0);T([At()],Ce.prototype,"translucencyColor",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"translucencyColorTexture",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],Ce.prototype,"useGltfStyleTextures",void 0);T([R()],Ce.prototype,"applyAlbedoAfterSubSurface",void 0);T([R()],Ce.prototype,"legacyTranslucency",void 0);class Ld extends Si{constructor(){super(...arguments),this.DETAIL=!1,this.DETAILDIRECTUV=0,this.DETAIL_NORMALBLENDMETHOD=0}}class ss extends Qt{_markAllSubMeshesAsTexturesDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}isCompatible(){return!0}constructor(e,t=!0){super(e,"DetailMap",140,new Ld,t),this._texture=null,this.diffuseBlendLevel=1,this.roughnessBlendLevel=1,this.bumpLevel=1,this._normalBlendMethod=F.MATERIAL_NORMALBLENDMETHOD_WHITEOUT,this._isEnabled=!1,this.isEnabled=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1]}isReadyForSubMesh(e,t,i){return this._isEnabled?!(e._areTexturesDirty&&t.texturesEnabled&&i.getCaps().standardDerivatives&&this._texture&&U.DetailTextureEnabled&&!this._texture.isReady()):!0}prepareDefines(e,t){if(this._isEnabled){e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod;const i=t.getEngine();e._areTexturesDirty&&(i.getCaps().standardDerivatives&&this._texture&&U.DetailTextureEnabled&&this._isEnabled?(Ne(this._texture,e,"DETAIL"),e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod):e.DETAIL=!1)}else e.DETAIL=!1}bindForSubMesh(e,t){if(!this._isEnabled)return;const i=this._material.isFrozen;(!e.useUbo||!i||!e.isSync)&&this._texture&&U.DetailTextureEnabled&&(e.updateFloat4("vDetailInfos",this._texture.coordinatesIndex,this.diffuseBlendLevel,this.bumpLevel,this.roughnessBlendLevel),Ue(this._texture,e,"detail")),t.texturesEnabled&&this._texture&&U.DetailTextureEnabled&&e.setTexture("detailSampler",this._texture)}hasTexture(e){return this._texture===e}getActiveTextures(e){this._texture&&e.push(this._texture)}getAnimatables(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)}dispose(e){e&&this._texture?.dispose()}getClassName(){return"DetailMapConfiguration"}getSamplers(e){e.push("detailSampler")}getUniforms(){return{ubo:[{name:"vDetailInfos",size:4,type:"vec4"},{name:"detailMatrix",size:16,type:"mat4"}]}}}T([Oe("detailTexture"),B("_markAllSubMeshesAsTexturesDirty")],ss.prototype,"texture",void 0);T([R()],ss.prototype,"diffuseBlendLevel",void 0);T([R()],ss.prototype,"roughnessBlendLevel",void 0);T([R()],ss.prototype,"bumpLevel",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],ss.prototype,"normalBlendMethod",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],ss.prototype,"isEnabled",void 0);var Ga;(function(a){a[a.Zero=0]="Zero",a[a.One=1]="One",a[a.MaxViewZ=2]="MaxViewZ",a[a.NoClear=3]="NoClear"})(Ga||(Ga={}));class It{static CreateConfiguration(e){return It._Configurations[e]={defines:{},previousWorldMatrices:{},previousViewProjection:P.Zero(),currentViewProjection:P.Zero(),previousBones:{},lastUpdateFrameId:-1,excludedSkinnedMesh:[],reverseCulling:!1},It._Configurations[e]}static DeleteConfiguration(e){delete It._Configurations[e]}static GetConfiguration(e){return It._Configurations[e]}static AddUniformsAndSamplers(e,t){e.push("previousWorld","previousViewProjection","mPreviousBones")}static MarkAsDirty(e,t){for(const i of t)if(i.subMeshes)for(const s of i.subMeshes)s._removeDrawWrapper(e)}static PrepareDefines(e,t,i){if(!i._arePrePassDirty)return;const s=It._Configurations[e];if(!s)return;i.PREPASS=!0;let r=0;for(let n=0;n(this._renderTargets.reset(),U.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._renderTargets.push(this._reflectionTexture),this._eventInfo.renderTargets=this._renderTargets,this._callbackPluginEventFillRenderTargetTextures(this._eventInfo),this._renderTargets),this._environmentBRDFTexture=Gh(this.getScene()),this.prePassConfiguration=new ka}get hasRenderTargetTextures(){return U.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget?!0:this._cacheHasRenderTargetTextures}get isPrePassCapable(){return!this.disableDepthWrite}getClassName(){return"PBRBaseMaterial"}get _disableAlphaBlending(){return this._transparencyMode===ve.PBRMATERIAL_OPAQUE||this._transparencyMode===ve.PBRMATERIAL_ALPHATEST||this.subSurface?.disableAlphaBlending}needAlphaBlending(){return this._hasTransparencyMode?this._transparencyModeIsBlend:this._disableAlphaBlending?!1:this.alpha<1||this._opacityTexture!=null||this._shouldUseAlphaFromAlbedoTexture()}needAlphaTesting(){return this._hasTransparencyMode?this._transparencyModeIsTest:this.subSurface?.disableAlphaBlending?!1:this._hasAlphaChannel()&&(this._transparencyMode==null||this._transparencyMode===ve.PBRMATERIAL_ALPHATEST)}_shouldUseAlphaFromAlbedoTexture(){return this._albedoTexture!=null&&this._albedoTexture.hasAlpha&&this._useAlphaFromAlbedoTexture&&this._transparencyMode!==ve.PBRMATERIAL_OPAQUE}_hasAlphaChannel(){return this._albedoTexture!=null&&this._albedoTexture.hasAlpha||this._opacityTexture!=null}getAlphaTestTexture(){return this._albedoTexture}isReadyForSubMesh(e,t,i){this._uniformBufferLayoutBuilt||this.buildUniformLayout();const s=t._drawWrapper;if(s.effect&&this.isFrozen&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(this._callbackPluginEventGeneric(4,this._eventInfo),t.materialDefines=new Ha(this._eventInfo.defineNames));const r=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;const n=this.getScene(),o=n.getEngine();if(r._areTexturesDirty&&(this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._cacheHasRenderTargetTextures=this._eventInfo.hasRenderTargetTextures,n.texturesEnabled)){if(this._albedoTexture&&U.DiffuseTextureEnabled&&!this._albedoTexture.isReadyOrNotBlocking()||this._baseWeightTexture&&U.BaseWeightTextureEnabled&&!this._baseWeightTexture.isReadyOrNotBlocking()||this._baseDiffuseRoughnessTexture&&U.BaseDiffuseRoughnessTextureEnabled&&!this._baseDiffuseRoughnessTexture.isReadyOrNotBlocking()||this._ambientTexture&&U.AmbientTextureEnabled&&!this._ambientTexture.isReadyOrNotBlocking()||this._opacityTexture&&U.OpacityTextureEnabled&&!this._opacityTexture.isReadyOrNotBlocking())return!1;const f=this._getReflectionTexture();if(f&&U.ReflectionTextureEnabled){if(!f.isReadyOrNotBlocking())return!1;if(f.irradianceTexture){if(!f.irradianceTexture.isReadyOrNotBlocking())return!1}else if(!f.sphericalPolynomial&&f.getInternalTexture()?._sphericalPolynomialPromise)return!1}if(this._lightmapTexture&&U.LightmapTextureEnabled&&!this._lightmapTexture.isReadyOrNotBlocking()||this._emissiveTexture&&U.EmissiveTextureEnabled&&!this._emissiveTexture.isReadyOrNotBlocking())return!1;if(U.SpecularTextureEnabled){if(this._metallicTexture){if(!this._metallicTexture.isReadyOrNotBlocking())return!1}else if(this._reflectivityTexture&&!this._reflectivityTexture.isReadyOrNotBlocking())return!1;if(this._metallicReflectanceTexture&&!this._metallicReflectanceTexture.isReadyOrNotBlocking()||this._reflectanceTexture&&!this._reflectanceTexture.isReadyOrNotBlocking()||this._microSurfaceTexture&&!this._microSurfaceTexture.isReadyOrNotBlocking())return!1}if(o.getCaps().standardDerivatives&&this._bumpTexture&&U.BumpTextureEnabled&&!this._disableBumpMap&&!this._bumpTexture.isReady()||this._environmentBRDFTexture&&U.ReflectionTextureEnabled&&!this._environmentBRDFTexture.isReady())return!1}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=r,this._eventInfo.subMesh=t,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh||r._areImageProcessingDirty&&this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady())return!1;if(r.AREALIGHTUSED||r.CLUSTLIGHT_BATCH){for(let f=0;f{this.shaderLanguage===1?await Promise.all([G(()=>import("./pbr.vertex-DRZMMP8Z.js"),__vite__mapDeps([62,63,2,64,65,66,3,67,4,5,6,68,69,7,8,9,70,10,71,11,12,72,13,14]),import.meta.url),G(()=>import("./pbr.fragment-D0TIhE0g.js"),__vite__mapDeps([73,74,63,2,64,75,66,16,76,17,19,10,20,3,77,68,67,78,79,21,13,14]),import.meta.url)]):await Promise.all([G(()=>import("./pbr.vertex-DLH7HICr.js"),__vite__mapDeps([80,81,82,24,83,84,25,85,26,27,86,87,28,29,30,88,31,89,13,14]),import.meta.url),G(()=>import("./pbr.fragment-SkdUmqQC.js"),__vite__mapDeps([90,91,82,24,83,92,84,33,93,34,37,31,38,25,94,86,85,95,36,13,14]),import.meta.url)]),this._shadersLoaded=!0}},l);return this._eventInfo.customCode=void 0,M}_prepareDefines(e,t,i,s=null,r=null){const n=t.hasThinInstances,o=this.getScene(),h=o.getEngine();lh(o,e,i,!0,this._maxSimultaneousLights,this._disableLighting),i._needNormals=!0,fh(o,i);const l=this.needAlphaBlendingForMesh(e)&&this.getScene().useOrderIndependentTransparency;if(su(o,i,this.canRenderToMRT&&!l),iu(o,i,l),It.PrepareDefines(h.currentRenderPassId,e,i),i.METALLICWORKFLOW=this.isMetallicWorkflow(),i._areTexturesDirty){i._needUVs=!1;for(let c=1;c<=6;++c)i["MAINUV"+c]=!1;if(o.texturesEnabled){i.ALBEDODIRECTUV=0,i.BASE_WEIGHTDIRECTUV=0,i.BASE_DIFFUSE_ROUGHNESSDIRECTUV=0,i.AMBIENTDIRECTUV=0,i.OPACITYDIRECTUV=0,i.EMISSIVEDIRECTUV=0,i.REFLECTIVITYDIRECTUV=0,i.MICROSURFACEMAPDIRECTUV=0,i.METALLIC_REFLECTANCEDIRECTUV=0,i.REFLECTANCEDIRECTUV=0,i.BUMPDIRECTUV=0,i.LIGHTMAPDIRECTUV=0,h.getCaps().textureLOD&&(i.LODBASEDMICROSFURACE=!0),this._albedoTexture&&U.DiffuseTextureEnabled?(Ne(this._albedoTexture,i,"ALBEDO"),i.GAMMAALBEDO=this._albedoTexture.gammaSpace):i.ALBEDO=!1,this._baseWeightTexture&&U.BaseWeightTextureEnabled?Ne(this._baseWeightTexture,i,"BASE_WEIGHT"):i.BASE_WEIGHT=!1,this._baseDiffuseRoughnessTexture&&U.BaseDiffuseRoughnessTextureEnabled?Ne(this._baseDiffuseRoughnessTexture,i,"BASE_DIFFUSE_ROUGHNESS"):i.BASE_DIFFUSE_ROUGHNESS=!1,this._ambientTexture&&U.AmbientTextureEnabled?(Ne(this._ambientTexture,i,"AMBIENT"),i.AMBIENTINGRAYSCALE=this._useAmbientInGrayScale):i.AMBIENT=!1,this._opacityTexture&&U.OpacityTextureEnabled?(Ne(this._opacityTexture,i,"OPACITY"),i.OPACITYRGB=this._opacityTexture.getAlphaFromRGB):i.OPACITY=!1;const c=this._getReflectionTexture(),u=this._forceIrradianceInFragment||this.realTimeFiltering||this._twoSidedLighting||h.getCaps().maxVaryingVectors<=8||this._baseDiffuseRoughnessTexture!=null;ch(o,c,i,this.realTimeFiltering,this.realTimeFilteringQuality,!u),this._lightmapTexture&&U.LightmapTextureEnabled?(Ne(this._lightmapTexture,i,"LIGHTMAP"),i.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,i.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace,i.RGBDLIGHTMAP=this._lightmapTexture.isRGBD):i.LIGHTMAP=!1,this._emissiveTexture&&U.EmissiveTextureEnabled?(Ne(this._emissiveTexture,i,"EMISSIVE"),i.GAMMAEMISSIVE=this._emissiveTexture.gammaSpace):i.EMISSIVE=!1,U.SpecularTextureEnabled?(this._metallicTexture?(Ne(this._metallicTexture,i,"REFLECTIVITY"),i.ROUGHNESSSTOREINMETALMAPALPHA=this._useRoughnessFromMetallicTextureAlpha,i.ROUGHNESSSTOREINMETALMAPGREEN=!this._useRoughnessFromMetallicTextureAlpha&&this._useRoughnessFromMetallicTextureGreen,i.METALLNESSSTOREINMETALMAPBLUE=this._useMetallnessFromMetallicTextureBlue,i.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed,i.REFLECTIVITY_GAMMA=!1):this._reflectivityTexture?(Ne(this._reflectivityTexture,i,"REFLECTIVITY"),i.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,i.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap,i.REFLECTIVITY_GAMMA=this._reflectivityTexture.gammaSpace):i.REFLECTIVITY=!1,this._metallicReflectanceTexture||this._reflectanceTexture?(i.METALLIC_REFLECTANCE_USE_ALPHA_ONLY=this._useOnlyMetallicFromMetallicReflectanceTexture,this._metallicReflectanceTexture?(Ne(this._metallicReflectanceTexture,i,"METALLIC_REFLECTANCE"),i.METALLIC_REFLECTANCE_GAMMA=this._metallicReflectanceTexture.gammaSpace):i.METALLIC_REFLECTANCE=!1,this._reflectanceTexture&&(!this._metallicReflectanceTexture||this._metallicReflectanceTexture&&this._useOnlyMetallicFromMetallicReflectanceTexture)?(Ne(this._reflectanceTexture,i,"REFLECTANCE"),i.REFLECTANCE_GAMMA=this._reflectanceTexture.gammaSpace):i.REFLECTANCE=!1):(i.METALLIC_REFLECTANCE=!1,i.REFLECTANCE=!1),this._microSurfaceTexture?Ne(this._microSurfaceTexture,i,"MICROSURFACEMAP"):i.MICROSURFACEMAP=!1):(i.REFLECTIVITY=!1,i.MICROSURFACEMAP=!1),h.getCaps().standardDerivatives&&this._bumpTexture&&U.BumpTextureEnabled&&!this._disableBumpMap?(Ne(this._bumpTexture,i,"BUMP"),this._useParallax&&this._albedoTexture&&U.DiffuseTextureEnabled?(i.PARALLAX=!0,i.PARALLAX_RHS=o.useRightHandedSystem,i.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):i.PARALLAX=!1,i.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):(i.BUMP=!1,i.PARALLAX=!1,i.PARALLAX_RHS=!1,i.PARALLAXOCCLUSION=!1,i.OBJECTSPACE_NORMALMAP=!1),this._environmentBRDFTexture&&U.ReflectionTextureEnabled?(i.ENVIRONMENTBRDF=!0,i.ENVIRONMENTBRDF_RGBD=this._environmentBRDFTexture.isRGBD):(i.ENVIRONMENTBRDF=!1,i.ENVIRONMENTBRDF_RGBD=!1),this._shouldUseAlphaFromAlbedoTexture()?i.ALPHAFROMALBEDO=!0:i.ALPHAFROMALBEDO=!1}i.SPECULAROVERALPHA=this._useSpecularOverAlpha,this._lightFalloff===ve.LIGHTFALLOFF_STANDARD?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===ve.LIGHTFALLOFF_GLTF?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!0):(i.USEPHYSICALLIGHTFALLOFF=!0,i.USEGLTFLIGHTFALLOFF=!1),i.RADIANCEOVERALPHA=this._useRadianceOverAlpha,!this.backFaceCulling&&this._twoSidedLighting?i.TWOSIDEDLIGHTING=!0:i.TWOSIDEDLIGHTING=!1,i.MIRRORED=!!o._mirroredCameraPosition,i.SPECULARAA=h.getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}(i._areTexturesDirty||i._areMiscDirty)&&(i.ALPHATESTVALUE=`${this._alphaCutOff}${this._alphaCutOff%1===0?".":""}`,i.PREMULTIPLYALPHA=this.alphaMode===7||this.alphaMode===8,i.ALPHABLEND=this.needAlphaBlendingForMesh(e),i.ALPHAFRESNEL=this._useAlphaFresnel||this._useLinearAlphaFresnel,i.LINEARALPHAFRESNEL=this._useLinearAlphaFresnel),i._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(i),i.FORCENORMALFORWARD=this._forceNormalForward,i.RADIANCEOCCLUSION=this._useRadianceOcclusion,i.HORIZONOCCLUSION=this._useHorizonOcclusion,i._areMiscDirty&&(hh(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),i,this._applyDecalMapAfterDetailMap,this._useVertexPulling,t,this._isVertexOutputInvariant),i.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!e.isVerticesDataPresent(b.NormalKind),i.DEBUGMODE=this._debugMode),uh(o,h,this,i,!!s,r,n),this._eventInfo.defines=i,this._eventInfo.mesh=e,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),dh(e,i,!0,!0,!0,this._transparencyMode!==ve.PBRMATERIAL_OPAQUE),this._callbackPluginEventPrepareDefines(this._eventInfo)}forceCompilation(e,t,i){const s={clipPlane:!1,useInstances:!1,...i};this._uniformBufferLayoutBuilt||this.buildUniformLayout(),this._callbackPluginEventGeneric(4,this._eventInfo),(()=>{if(this._breakShaderLoadedCheck)return;const n=new Ha(this._eventInfo.defineNames),o=this._prepareEffect(e,e,n,void 0,void 0,s.useInstances,s.clipPlane);this._onEffectCreatedObservable&&(as.effect=o,as.subMesh=null,this._onEffectCreatedObservable.notifyObservers(as)),o.isReady()?t&&t(this):o.onCompileObservable.add(()=>{t&&t(this)})})()}buildUniformLayout(){const e=this._uniformBuffer;e.addUniform("vAlbedoInfos",2),e.addUniform("vBaseWeightInfos",2),e.addUniform("vBaseDiffuseRoughnessInfos",2),e.addUniform("vAmbientInfos",4),e.addUniform("vOpacityInfos",2),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vReflectivityInfos",3),e.addUniform("vMicroSurfaceSamplerInfos",2),e.addUniform("vBumpInfos",3),e.addUniform("albedoMatrix",16),e.addUniform("baseWeightMatrix",16),e.addUniform("baseDiffuseRoughnessMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("reflectivityMatrix",16),e.addUniform("microSurfaceSamplerMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("vAlbedoColor",4),e.addUniform("baseWeight",1),e.addUniform("baseDiffuseRoughness",1),e.addUniform("vLightingIntensity",4),e.addUniform("pointSize",1),e.addUniform("vReflectivityColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("vAmbientColor",3),e.addUniform("vDebugMode",2),e.addUniform("vMetallicReflectanceFactors",4),e.addUniform("vMetallicReflectanceInfos",2),e.addUniform("metallicReflectanceMatrix",16),e.addUniform("vReflectanceInfos",2),e.addUniform("reflectanceMatrix",16),e.addUniform("cameraInfo",4),ph(e,!0,!0,!0,!0,!0),super.buildUniformLayout()}bindForSubMesh(e,t,i){const s=this.getScene(),r=i.materialDefines;if(!r)return;const n=i.effect;if(!n)return;this._activeEffect=n,t.getMeshUniformBuffer().bindToEffect(n,"Mesh"),t.transferToEffect(e);const o=s.getEngine();this._uniformBuffer.bindToEffect(n,"Material"),this.prePassConfiguration.bindForSubMesh(this._activeEffect,s,t,e,this.isFrozen),It.Bind(o.currentRenderPassId,this._activeEffect,t,e,this);const h=s.activeCamera;h?this._uniformBuffer.updateFloat4("cameraInfo",h.minZ,h.maxZ,0,0):this._uniformBuffer.updateFloat4("cameraInfo",0,0,0,0),this._eventInfo.subMesh=i,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),r.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));const l=this._mustRebind(s,n,i,t.visibility);sh(t,this._activeEffect,this.prePassConfiguration);let c=null;const u=this._uniformBuffer;if(l){if(this.bindViewProjection(n),c=this._getReflectionTexture(),!u.useUbo||!this.isFrozen||!u.isSync||i._drawWrapper._forceRebindOnNextCall){if(s.texturesEnabled&&(this._albedoTexture&&U.DiffuseTextureEnabled&&(u.updateFloat2("vAlbedoInfos",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),Ue(this._albedoTexture,u,"albedo")),this._baseWeightTexture&&U.BaseWeightTextureEnabled&&(u.updateFloat2("vBaseWeightInfos",this._baseWeightTexture.coordinatesIndex,this._baseWeightTexture.level),Ue(this._baseWeightTexture,u,"baseWeight")),this._baseDiffuseRoughnessTexture&&U.BaseDiffuseRoughnessTextureEnabled&&(u.updateFloat2("vBaseDiffuseRoughnessInfos",this._baseDiffuseRoughnessTexture.coordinatesIndex,this._baseDiffuseRoughnessTexture.level),Ue(this._baseDiffuseRoughnessTexture,u,"baseDiffuseRoughness")),this._ambientTexture&&U.AmbientTextureEnabled&&(u.updateFloat4("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),Ue(this._ambientTexture,u,"ambient")),this._opacityTexture&&U.OpacityTextureEnabled&&(u.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),Ue(this._opacityTexture,u,"opacity")),this._emissiveTexture&&U.EmissiveTextureEnabled&&(u.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),Ue(this._emissiveTexture,u,"emissive")),this._lightmapTexture&&U.LightmapTextureEnabled&&(u.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),Ue(this._lightmapTexture,u,"lightmap")),U.SpecularTextureEnabled&&(this._metallicTexture?(u.updateFloat3("vReflectivityInfos",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),Ue(this._metallicTexture,u,"reflectivity")):this._reflectivityTexture&&(u.updateFloat3("vReflectivityInfos",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),Ue(this._reflectivityTexture,u,"reflectivity")),this._metallicReflectanceTexture&&(u.updateFloat2("vMetallicReflectanceInfos",this._metallicReflectanceTexture.coordinatesIndex,this._metallicReflectanceTexture.level),Ue(this._metallicReflectanceTexture,u,"metallicReflectance")),this._reflectanceTexture&&r.REFLECTANCE&&(u.updateFloat2("vReflectanceInfos",this._reflectanceTexture.coordinatesIndex,this._reflectanceTexture.level),Ue(this._reflectanceTexture,u,"reflectance")),this._microSurfaceTexture&&(u.updateFloat2("vMicroSurfaceSamplerInfos",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),Ue(this._microSurfaceTexture,u,"microSurfaceSampler"))),this._bumpTexture&&o.getCaps().standardDerivatives&&U.BumpTextureEnabled&&!this._disableBumpMap&&(u.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),Ue(this._bumpTexture,u,"bump"),s._mirroredCameraPosition?u.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):u.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),th(s,r,u,this._reflectionColor,c,this.realTimeFiltering,!0,!0,!0,!0,!0)),this.pointsCloud&&u.updateFloat("pointSize",this.pointSize),r.METALLICWORKFLOW){Vt.Color4[0].r=this._metallic===void 0||this._metallic===null?1:this._metallic,Vt.Color4[0].g=this._roughness===void 0||this._roughness===null?1:this._roughness;const f=this.subSurface?._indexOfRefraction??1.5,d=1;Vt.Color4[0].b=f;const g=Math.pow((f-d)/(f+d),2);Vt.Color4[0].a=g,u.updateDirectColor4("vReflectivityColor",Vt.Color4[0]),u.updateColor4("vMetallicReflectanceFactors",this._metallicReflectanceColor,this._metallicF0Factor)}else u.updateColor4("vReflectivityColor",this._reflectivityColor,this._microSurface);u.updateColor3("vEmissiveColor",U.EmissiveTextureEnabled?this._emissiveColor:q.BlackReadOnly),!r.SS_REFRACTION&&this.subSurface?._linkRefractionWithTransparency?u.updateColor4("vAlbedoColor",this._albedoColor,1):u.updateColor4("vAlbedoColor",this._albedoColor,this.alpha),u.updateFloat("baseWeight",this._baseWeight),u.updateFloat("baseDiffuseRoughness",this._baseDiffuseRoughness||0),this._lightingInfos.x=this._directIntensity,this._lightingInfos.y=this._emissiveIntensity,this._lightingInfos.z=this._environmentIntensity*s.environmentIntensity,this._lightingInfos.w=this._specularIntensity,u.updateVector4("vLightingIntensity",this._lightingInfos),s.ambientColor.multiplyToRef(this._ambientColor,this._globalAmbientColor),u.updateColor3("vAmbientColor",this._globalAmbientColor),u.updateFloat2("vDebugMode",this.debugLimit,this.debugFactor)}s.texturesEnabled&&(this._albedoTexture&&U.DiffuseTextureEnabled&&u.setTexture("albedoSampler",this._albedoTexture),this._baseWeightTexture&&U.BaseWeightTextureEnabled&&u.setTexture("baseWeightSampler",this._baseWeightTexture),this._baseDiffuseRoughnessTexture&&U.BaseDiffuseRoughnessTextureEnabled&&u.setTexture("baseDiffuseRoughnessSampler",this._baseDiffuseRoughnessTexture),this._ambientTexture&&U.AmbientTextureEnabled&&u.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&U.OpacityTextureEnabled&&u.setTexture("opacitySampler",this._opacityTexture),ih(s,r,u,c,this.realTimeFiltering),r.ENVIRONMENTBRDF&&u.setTexture("environmentBrdfSampler",this._environmentBRDFTexture),this._emissiveTexture&&U.EmissiveTextureEnabled&&u.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&U.LightmapTextureEnabled&&u.setTexture("lightmapSampler",this._lightmapTexture),U.SpecularTextureEnabled&&(this._metallicTexture?u.setTexture("reflectivitySampler",this._metallicTexture):this._reflectivityTexture&&u.setTexture("reflectivitySampler",this._reflectivityTexture),this._metallicReflectanceTexture&&u.setTexture("metallicReflectanceSampler",this._metallicReflectanceTexture),this._reflectanceTexture&&r.REFLECTANCE&&u.setTexture("reflectanceSampler",this._reflectanceTexture),this._microSurfaceTexture&&u.setTexture("microSurfaceSampler",this._microSurfaceTexture)),this._bumpTexture&&o.getCaps().standardDerivatives&&U.BumpTextureEnabled&&!this._disableBumpMap&&u.setTexture("bumpSampler",this._bumpTexture)),this.getScene().useOrderIndependentTransparency&&this.needAlphaBlendingForMesh(t)&&this.getScene().depthPeelingRenderer.bind(n),this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo),jo(this._activeEffect,this,s),this.bindEyePosition(n)}else s.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._needToBindSceneUbo=!0);(l||!this.isFrozen)&&(s.lightsEnabled&&!this._disableLighting&&rh(s,t,this._activeEffect,r,this._maxSimultaneousLights),(s.fogEnabled&&t.applyFog&&s.fogMode!==tt.FOGMODE_NONE||c||this.subSurface.refractionTexture||t.receiveShadows||r.PREPASS||r.CLUSTLIGHT_BATCH)&&this.bindView(n),$o(s,t,this._activeEffect,!0),r.NUM_MORPH_INFLUENCERS&&eh(t,this._activeEffect),r.BAKED_VERTEX_ANIMATION_TEXTURE&&t.bakedVertexAnimationManager?.bind(n,r.INSTANCES),this._imageProcessingConfiguration.bind(this._activeEffect),Zo(r,this._activeEffect,s)),this._afterBind(t,this._activeEffect,i),u.update()}getAnimatables(){const e=super.getAnimatables();return this._albedoTexture&&this._albedoTexture.animations&&this._albedoTexture.animations.length>0&&e.push(this._albedoTexture),this._baseWeightTexture&&this._baseWeightTexture.animations&&this._baseWeightTexture.animations.length>0&&e.push(this._baseWeightTexture),this._baseDiffuseRoughnessTexture&&this._baseDiffuseRoughnessTexture.animations&&this._baseDiffuseRoughnessTexture.animations.length>0&&e.push(this._baseDiffuseRoughnessTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&e.push(this._emissiveTexture),this._metallicTexture&&this._metallicTexture.animations&&this._metallicTexture.animations.length>0?e.push(this._metallicTexture):this._reflectivityTexture&&this._reflectivityTexture.animations&&this._reflectivityTexture.animations.length>0&&e.push(this._reflectivityTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&e.push(this._lightmapTexture),this._metallicReflectanceTexture&&this._metallicReflectanceTexture.animations&&this._metallicReflectanceTexture.animations.length>0&&e.push(this._metallicReflectanceTexture),this._reflectanceTexture&&this._reflectanceTexture.animations&&this._reflectanceTexture.animations.length>0&&e.push(this._reflectanceTexture),this._microSurfaceTexture&&this._microSurfaceTexture.animations&&this._microSurfaceTexture.animations.length>0&&e.push(this._microSurfaceTexture),e}_getReflectionTexture(){return this._reflectionTexture?this._reflectionTexture:this.getScene().environmentTexture}getActiveTextures(){const e=super.getActiveTextures();return this._albedoTexture&&e.push(this._albedoTexture),this._baseWeightTexture&&e.push(this._baseWeightTexture),this._baseDiffuseRoughnessTexture&&e.push(this._baseDiffuseRoughnessTexture),this._ambientTexture&&e.push(this._ambientTexture),this._opacityTexture&&e.push(this._opacityTexture),this._reflectionTexture&&e.push(this._reflectionTexture),this._emissiveTexture&&e.push(this._emissiveTexture),this._reflectivityTexture&&e.push(this._reflectivityTexture),this._metallicTexture&&e.push(this._metallicTexture),this._metallicReflectanceTexture&&e.push(this._metallicReflectanceTexture),this._reflectanceTexture&&e.push(this._reflectanceTexture),this._microSurfaceTexture&&e.push(this._microSurfaceTexture),this._bumpTexture&&e.push(this._bumpTexture),this._lightmapTexture&&e.push(this._lightmapTexture),e}hasTexture(e){return!!(super.hasTexture(e)||this._albedoTexture===e||this._baseWeightTexture===e||this._baseDiffuseRoughnessTexture===e||this._ambientTexture===e||this._opacityTexture===e||this._reflectionTexture===e||this._emissiveTexture===e||this._reflectivityTexture===e||this._metallicTexture===e||this._metallicReflectanceTexture===e||this._reflectanceTexture===e||this._microSurfaceTexture===e||this._bumpTexture===e||this._lightmapTexture===e)}setPrePassRenderer(){if(!this.subSurface?.isScatteringEnabled)return!1;const e=this.getScene().enableSubSurfaceForPrePass();return e&&(e.enabled=!0),!0}dispose(e,t){this._breakShaderLoadedCheck=!0,t&&(this._environmentBRDFTexture&&this.getScene().environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),this._albedoTexture?.dispose(),this._baseWeightTexture?.dispose(),this._baseDiffuseRoughnessTexture?.dispose(),this._ambientTexture?.dispose(),this._opacityTexture?.dispose(),this._reflectionTexture?.dispose(),this._emissiveTexture?.dispose(),this._metallicTexture?.dispose(),this._reflectivityTexture?.dispose(),this._bumpTexture?.dispose(),this._lightmapTexture?.dispose(),this._metallicReflectanceTexture?.dispose(),this._reflectanceTexture?.dispose(),this._microSurfaceTexture?.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),super.dispose(e,t)}}ve.PBRMATERIAL_OPAQUE=F.MATERIAL_OPAQUE;ve.PBRMATERIAL_ALPHATEST=F.MATERIAL_ALPHATEST;ve.PBRMATERIAL_ALPHABLEND=F.MATERIAL_ALPHABLEND;ve.PBRMATERIAL_ALPHATESTANDBLEND=F.MATERIAL_ALPHATESTANDBLEND;ve.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=0;ve.LIGHTFALLOFF_PHYSICAL=0;ve.LIGHTFALLOFF_GLTF=1;ve.LIGHTFALLOFF_STANDARD=2;ve.ForceGLSL=!1;T([B("_markAllSubMeshesAsMiscDirty")],ve.prototype,"debugMode",void 0);class j extends ve{get refractionTexture(){return this.subSurface.refractionTexture}set refractionTexture(e){this.subSurface.refractionTexture=e,e?this.subSurface.isRefractionEnabled=!0:this.subSurface.linkRefractionWithTransparency||(this.subSurface.isRefractionEnabled=!1)}get indexOfRefraction(){return this.subSurface.indexOfRefraction}set indexOfRefraction(e){this.subSurface.indexOfRefraction=e}get invertRefractionY(){return this.subSurface.invertRefractionY}set invertRefractionY(e){this.subSurface.invertRefractionY=e}get linkRefractionWithTransparency(){return this.subSurface.linkRefractionWithTransparency}set linkRefractionWithTransparency(e){this.subSurface.linkRefractionWithTransparency=e,e&&(this.subSurface.isRefractionEnabled=!0)}get usePhysicalLightFalloff(){return this._lightFalloff===ve.LIGHTFALLOFF_PHYSICAL}set usePhysicalLightFalloff(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),e?this._lightFalloff=ve.LIGHTFALLOFF_PHYSICAL:this._lightFalloff=ve.LIGHTFALLOFF_STANDARD)}get useGLTFLightFalloff(){return this._lightFalloff===ve.LIGHTFALLOFF_GLTF}set useGLTFLightFalloff(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),e?this._lightFalloff=ve.LIGHTFALLOFF_GLTF:this._lightFalloff=ve.LIGHTFALLOFF_STANDARD)}constructor(e,t,i=!1){super(e,t,i),this.directIntensity=1,this.emissiveIntensity=1,this.environmentIntensity=1,this.specularIntensity=1,this.disableBumpMap=!1,this.ambientTextureStrength=1,this.ambientTextureImpactOnAnalyticalLights=j.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,this.metallicF0Factor=1,this.metallicReflectanceColor=q.White(),this.useOnlyMetallicFromMetallicReflectanceTexture=!1,this.ambientColor=new q(0,0,0),this.albedoColor=new q(1,1,1),this.baseWeight=1,this.reflectivityColor=new q(1,1,1),this.reflectionColor=new q(1,1,1),this.emissiveColor=new q(0,0,0),this.microSurface=1,this.useLightmapAsShadowmap=!1,this.useAlphaFromAlbedoTexture=!1,this.forceAlphaTest=!1,this.alphaCutOff=.4,this.useSpecularOverAlpha=!0,this.useMicroSurfaceFromReflectivityMapAlpha=!1,this.useRoughnessFromMetallicTextureAlpha=!0,this.useRoughnessFromMetallicTextureGreen=!1,this.useMetallnessFromMetallicTextureBlue=!1,this.useAmbientOcclusionFromMetallicTextureRed=!1,this.useAmbientInGrayScale=!1,this.useAutoMicroSurfaceFromReflectivityMap=!1,this.useRadianceOverAlpha=!0,this.useObjectSpaceNormalMap=!1,this.useParallax=!1,this.useParallaxOcclusion=!1,this.parallaxScaleBias=.05,this.disableLighting=!1,this.forceIrradianceInFragment=!1,this.maxSimultaneousLights=4,this.invertNormalMapX=!1,this.invertNormalMapY=!1,this.twoSidedLighting=!1,this.useAlphaFresnel=!1,this.useLinearAlphaFresnel=!1,this.environmentBRDFTexture=null,this.forceNormalForward=!1,this.enableSpecularAntiAliasing=!1,this.useHorizonOcclusion=!0,this.useRadianceOcclusion=!0,this.unlit=!1,this.applyDecalMapAfterDetailMap=!1,this._environmentBRDFTexture=Gh(this.getScene())}getClassName(){return"PBRMaterial"}clone(e,t=!0,i=""){const s=le.Clone(()=>new j(e,this.getScene()),this,{cloneTexturesOnlyOnce:t});return s.id=e,s.name=e,this.stencil.copyTo(s.stencil),this._clonePlugins(s,i),s}serialize(){const e=super.serialize();return e.customType="BABYLON.PBRMaterial",e}static Parse(e,t,i){const s=le.Parse(()=>new j(e.name,t),e,t,i);return e.stencil&&s.stencil.parse(e.stencil,t,i),F._ParsePlugins(e,s,t,i),e.clearCoat&&s.clearCoat.parse(e.clearCoat,t,i),e.anisotropy&&s.anisotropy.parse(e.anisotropy,t,i),e.brdf&&s.brdf.parse(e.brdf,t,i),e.sheen&&s.sheen.parse(e.sheen,t,i),e.subSurface&&s.subSurface.parse(e.subSurface,t,i),e.iridescence&&s.iridescence.parse(e.iridescence,t,i),s}}j.PBRMATERIAL_OPAQUE=ve.PBRMATERIAL_OPAQUE;j.PBRMATERIAL_ALPHATEST=ve.PBRMATERIAL_ALPHATEST;j.PBRMATERIAL_ALPHABLEND=ve.PBRMATERIAL_ALPHABLEND;j.PBRMATERIAL_ALPHATESTANDBLEND=ve.PBRMATERIAL_ALPHATESTANDBLEND;j.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=ve.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"directIntensity",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"emissiveIntensity",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"environmentIntensity",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"specularIntensity",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"disableBumpMap",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"albedoTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"baseWeightTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"baseDiffuseRoughnessTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"ambientTexture",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"ambientTextureStrength",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"ambientTextureImpactOnAnalyticalLights",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesAndMiscDirty")],j.prototype,"opacityTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"reflectionTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"emissiveTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"reflectivityTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"metallicTexture",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"metallic",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"roughness",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"metallicF0Factor",void 0);T([At(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"metallicReflectanceColor",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useOnlyMetallicFromMetallicReflectanceTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"metallicReflectanceTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"reflectanceTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"microSurfaceTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"bumpTexture",void 0);T([Oe(),B("_markAllSubMeshesAsTexturesDirty",null)],j.prototype,"lightmapTexture",void 0);T([At("ambient"),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"ambientColor",void 0);T([At("albedo"),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"albedoColor",void 0);T([R("baseWeight"),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"baseWeight",void 0);T([R("baseDiffuseRoughness"),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"baseDiffuseRoughness",void 0);T([At("reflectivity"),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"reflectivityColor",void 0);T([At("reflection"),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"reflectionColor",void 0);T([At("emissive"),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"emissiveColor",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"microSurface",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useLightmapAsShadowmap",void 0);T([R(),B("_markAllSubMeshesAsTexturesAndMiscDirty")],j.prototype,"useAlphaFromAlbedoTexture",void 0);T([R(),B("_markAllSubMeshesAsTexturesAndMiscDirty")],j.prototype,"forceAlphaTest",void 0);T([R(),B("_markAllSubMeshesAsTexturesAndMiscDirty")],j.prototype,"alphaCutOff",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useSpecularOverAlpha",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useMicroSurfaceFromReflectivityMapAlpha",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useRoughnessFromMetallicTextureAlpha",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useRoughnessFromMetallicTextureGreen",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useMetallnessFromMetallicTextureBlue",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useAmbientInGrayScale",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useAutoMicroSurfaceFromReflectivityMap",void 0);T([R()],j.prototype,"usePhysicalLightFalloff",null);T([R()],j.prototype,"useGLTFLightFalloff",null);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useRadianceOverAlpha",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useObjectSpaceNormalMap",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useParallax",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useParallaxOcclusion",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"parallaxScaleBias",void 0);T([R(),B("_markAllSubMeshesAsLightsDirty")],j.prototype,"disableLighting",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"forceIrradianceInFragment",void 0);T([R(),B("_markAllSubMeshesAsLightsDirty")],j.prototype,"maxSimultaneousLights",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"invertNormalMapX",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"invertNormalMapY",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"twoSidedLighting",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useAlphaFresnel",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useLinearAlphaFresnel",void 0);T([B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"environmentBRDFTexture",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"forceNormalForward",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"enableSpecularAntiAliasing",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useHorizonOcclusion",void 0);T([R(),B("_markAllSubMeshesAsTexturesDirty")],j.prototype,"useRadianceOcclusion",void 0);T([R(),B("_markAllSubMeshesAsMiscDirty")],j.prototype,"unlit",void 0);T([R(),B("_markAllSubMeshesAsMiscDirty")],j.prototype,"applyDecalMapAfterDetailMap",void 0);nt("BABYLON.PBRMaterial",j);const I_=Object.freeze(Object.defineProperty({__proto__:null,PBRMaterial:j},Symbol.toStringTag,{value:"Module"}));function vs(a,e,t){const i=a.getVertexBuffer(t);if(!i)return null;const s=i.getData();if(!s)return null;let r;return es(s,i.byteStride*e,i.byteStride,i.getSize(),i.type,1,i.normalized,n=>r=n),r}function kd(a,e,t){const i=vs(a,e,b.PositionKind);if(!i||i.some(s=>isNaN(s??Number.NaN)))return!1;if(a.morphTargetManager){const s=e*3;for(let r=0;r4,o=n?vs(a,e,b.MatricesIndicesExtraKind):null,h=n?vs(a,e,b.MatricesWeightsExtraKind):null,l=a.skeleton.getTransformMatrices(a),c=v.Matrix[0],u=v.Matrix[1];c.reset();for(let f=0;f0&&(P.FromFloat32ArrayToRefScaled(l,Math.floor(s[f]*16),d,u),c.addToSelf(u))}if(o&&h)for(let f=0;f0&&(P.FromFloat32ArrayToRefScaled(l,Math.floor(o[f]*16),d,u),c.addToSelf(u))}_.TransformCoordinatesFromFloatsToRef(i[0],i[1],i[2],c,t)}}return!0}function Gd(a,e,t,i){t.set(0,0,0);for(let s=0;s<3;s++){const r=e.pointIndex[s];if(!kd(a,r,v.Vector3[s]))return!1;v.Vector3[s].scaleAndAddToRef(e.barycentric[s],t)}if(_.TransformCoordinatesToRef(t,a.getWorldMatrix(),t),i){const s=v.Vector3[0],r=v.Vector3[1],n=v.Vector3[2],o=v.Vector3[3],h=v.Vector3[4];o.copyFrom(r),o.subtractInPlace(s),h.copyFrom(n),h.subtractInPlace(s),o.normalize(),h.normalize(),_.CrossToRef(o,h,i),a.material&&a.material.sideOrientation===(a.getScene().useRightHandedSystem?0:1)&&i.scaleInPlace(-1),_.TransformNormalToRef(i,a.getWorldMatrix(),i),i.normalize()}return!0}ne._GroundMeshParser=(a,e)=>ar.Parse(a,e);class ar extends ne{constructor(e,t){super(e,t),this.generateOctree=!1}getClassName(){return"GroundMesh"}get subdivisions(){return Math.min(this._subdivisionsX,this._subdivisionsY)}get subdivisionsX(){return this._subdivisionsX}get subdivisionsY(){return this._subdivisionsY}optimize(e,t=32){this._subdivisionsX=e,this._subdivisionsY=e,this.subdivide(e);const i=this;i.createOrUpdateSubmeshesOctree&&i.createOrUpdateSubmeshesOctree(t)}getHeightAtCoordinates(e,t){const i=this.getWorldMatrix(),s=v.Matrix[5];i.invertToRef(s);const r=v.Vector3[8];if(_.TransformCoordinatesFromFloatsToRef(e,0,t,s,r),e=r.x,t=r.z,e=this._maxX||t<=this._minZ||t>this._maxZ)return this.position.y;(!this._heightQuads||this._heightQuads.length==0)&&(this._initHeightQuads(),this._computeHeightQuads());const n=this._getFacetAt(e,t),o=-(n.x*e+n.z*t+n.w)/n.y;return _.TransformCoordinatesFromFloatsToRef(0,o,0,i,r),r.y}getNormalAtCoordinates(e,t){const i=new _(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,i),i}getNormalAtCoordinatesToRef(e,t,i){const s=this.getWorldMatrix(),r=v.Matrix[5];s.invertToRef(r);const n=v.Vector3[8];if(_.TransformCoordinatesFromFloatsToRef(e,0,t,r,n),e=n.x,t=n.z,ethis._maxX||tthis._maxZ)return this;(!this._heightQuads||this._heightQuads.length==0)&&(this._initHeightQuads(),this._computeHeightQuads());const o=this._getFacetAt(e,t);return _.TransformNormalFromFloatsToRef(o.x,o.y,o.z,s,i),this}updateCoordinateHeights(){return(!this._heightQuads||this._heightQuads.length==0)&&this._initHeightQuads(),this._computeHeightQuads(),this}_getFacetAt(e,t){const i=Math.floor((e+this._maxX)*this._subdivisionsX/this._width),s=Math.floor(-(t+this._maxZ)*this._subdivisionsY/this._height+this._subdivisionsY),r=this._heightQuads[s*this._subdivisionsX+i];let n;return ta.maxHeight){l=!0;const u=a.maxHeight;a.maxHeight=a.minHeight,a.minHeight=u}for(r=0;r<=a.subdivisions;r++)for(n=0;n<=a.subdivisions;n++){const u=new _(n*a.width/a.subdivisions-a.width/2,0,(a.subdivisions-r)*a.height/a.subdivisions-a.height/2),f=(u.x+a.width/2)/a.width*(a.bufferWidth-1)|0,d=(1-(u.z+a.height/2)/a.height)*(a.bufferHeight-1)|0,g=(f+d*a.bufferWidth)*4;let p=a.buffer[g]/255,m=a.buffer[g+1]/255,A=a.buffer[g+2]/255;const E=a.buffer[g+3]/255;l&&(p=1-p,m=1-m,A=1-A);const I=p*o.r+m*o.g+A*o.b;E>=h?u.y=a.minHeight+(a.maxHeight-a.minHeight)*I:u.y=a.minHeight-Me,a.heightBuffer&&(a.heightBuffer[r*(a.subdivisions+1)+n]=u.y),t.push(u.x,u.y,u.z),i.push(0,0,0),s.push(n/a.subdivisions,1-r/a.subdivisions)}for(r=0;r=a.minHeight,m=t[f*3+1]>=a.minHeight,A=t[d*3+1]>=a.minHeight;p&&m&&A&&(e.push(u),e.push(f),e.push(d)),t[g*3+1]>=a.minHeight&&p&&A&&(e.push(g),e.push(u),e.push(d))}$.ComputeNormals(t,e,i);const c=new $;return c.indices=e,c.positions=t,c.normals=i,c.uvs=s,c}function Hd(a,e={},t){const i=new ar(a,t);return i._setReady(!1),i._subdivisionsX=e.subdivisionsX||e.subdivisions||1,i._subdivisionsY=e.subdivisionsY||e.subdivisions||1,i._width=e.width||1,i._height=e.height||1,i._maxX=i._width/2,i._maxZ=i._height/2,i._minX=-i._maxX,i._minZ=-i._maxZ,Hh(e).applyToMesh(i,e.updatable),i._setReady(!0),i}function Vd(a,e,t=null){const i=new ne(a,t);return Vh(e).applyToMesh(i,e.updatable),i}function zd(a,e,t={},i=null){const s=t.width||10,r=t.height||10,n=t.subdivisions||1,o=t.minHeight||0,h=t.maxHeight||1,l=t.colorFilter||new q(.3,.59,.11),c=t.alphaFilter||0,u=t.updatable,f=t.onReady;i=i||Te.LastCreatedScene;const d=new ar(a,i);d._subdivisionsX=n,d._subdivisionsY=n,d._width=s,d._height=r,d._maxX=d._width/2,d._maxZ=d._height/2,d._minX=-d._maxX,d._minZ=-d._maxZ,d._setReady(!1);let g;t.passHeightBufferInCallback&&(g=new Float32Array((n+1)*(n+1)));const p=(m,A,E)=>{zh({width:s,height:r,subdivisions:n,minHeight:o,maxHeight:h,colorFilter:l,buffer:m,bufferWidth:A,bufferHeight:E,alphaFilter:c,heightBuffer:g}).applyToMesh(d,u),f&&f(d,g),d._setReady(!0)};if(typeof e=="string"){const m=A=>{const E=A.width,I=A.height;if(i.isDisposed)return;const M=i?.getEngine().resizeImageBitmap(A,E,I);p(M,E,I)};se.LoadImage(e,m,t.onError?t.onError:()=>{},i.offlineProvider)}else p(e.data,e.width,e.height);return d}$.CreateGround=Hh;$.CreateTiledGround=Vh;$.CreateGroundFromHeightMap=zh;ne.CreateGround=(a,e,t,i,s,r)=>Hd(a,{width:e,height:t,subdivisions:i,updatable:r},s);ne.CreateTiledGround=(a,e,t,i,s,r,n,o,h)=>Vd(a,{xmin:e,zmin:t,xmax:i,zmax:s,subdivisions:r,precision:n,updatable:h},o);ne.CreateGroundFromHeightMap=(a,e,t,i,s,r,n,o,h,l,c)=>zd(a,e,{width:t,height:i,subdivisions:s,minHeight:r,maxHeight:n,updatable:h,onReady:l,alphaFilter:c},o);function Wh(a){let t=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23];const i=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],s=[];let r=[];const n=a.width||a.size||1,o=a.height||a.size||1,h=a.depth||a.size||1,l=a.wrap||!1;let c=a.topBaseAt===void 0?1:a.topBaseAt,u=a.bottomBaseAt===void 0?0:a.bottomBaseAt;c=(c+4)%4,u=(u+4)%4;const f=[2,0,3,1],d=[2,0,1,3];let g=f[c],p=d[u],m=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1];if(l){t=[2,3,0,2,0,1,4,5,6,4,6,7,9,10,11,9,11,8,12,14,15,12,13,14],m=[-1,1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1];let S=[[1,1,1],[-1,1,1],[-1,1,-1],[1,1,-1]],L=[[-1,-1,1],[1,-1,1],[1,-1,-1],[-1,-1,-1]];const N=[17,18,19,16],D=[22,23,20,21];for(;g>0;)S.unshift(S.pop()),N.unshift(N.pop()),g--;for(;p>0;)L.unshift(L.pop()),D.unshift(D.pop()),p--;S=S.flat(),L=L.flat(),m=m.concat(S).concat(L),t.push(N[0],N[2],N[3],N[0],N[1],N[2]),t.push(D[0],D[2],D[3],D[0],D[1],D[2])}const A=[n/2,o/2,h/2];r=m.reduce((S,L,N)=>S.concat(L*A[N%3]),[]);const E=a.sideOrientation===0?0:a.sideOrientation||$.DEFAULTSIDE,I=a.faceUV||new Array(6),M=a.faceColors,C=[];for(let S=0;S<6;S++)I[S]===void 0&&(I[S]=new ge(0,0,1,1)),M&&M[S]===void 0&&(M[S]=new fe(1,1,1,1));for(let S=0;S<6;S++)if(s.push(I[S].z,I[S].w),s.push(I[S].x,I[S].w),s.push(I[S].x,I[S].y),s.push(I[S].z,I[S].y),M)for(let L=0;L<4;L++)C.push(M[S].r,M[S].g,M[S].b,M[S].a);$._ComputeSides(E,r,t,i,s,a.frontUVs,a.backUVs);const x=new $;if(x.indices=t,x.positions=r,x.normals=i,x.uvs=s,M){const S=E===$.DOUBLESIDE?C.concat(C):C;x.colors=S}return x}function Xh(a,e={},t=null){const i=new ne(a,t);return e.sideOrientation=ne._GetDefaultSideOrientation(e.sideOrientation),i._originalBuilderSideOrientation=e.sideOrientation,Wh(e).applyToMesh(i,e.updatable),i}$.CreateBox=Wh;ne.CreateBox=(a,e,t=null,i,s)=>Xh(a,{size:e,sideOrientation:s,updatable:i},t);function Va(a){const e=a.minimum.x,t=a.minimum.y,i=a.minimum.z,s=a.maximum.x,r=a.maximum.y,n=a.maximum.z;return[new _(e,t,i),new _(s,r,n),new _(s,t,i),new _(e,r,i),new _(e,t,n),new _(s,r,i),new _(e,r,n),new _(s,t,n)]}function Wd(a,e=null,t=1/6){const i=v.Vector3[0],s=new Map,r=new Map,n=a.reduce((d,g)=>Math.max(d,g.getTotalVertices()),0),o=Array.from({length:n},()=>new _),h=Array.from({length:n},()=>new _);for(const d of a){const g=d.getVerticesData(b.PositionKind);if(!g)continue;const p=d.getTotalVertices();o.length=Math.max(o.length,p),h.length=Math.max(o.length,p);for(let M=0,C=0;M4,C=M?d.getVerticesData(b.MatricesWeightsExtraKind):null,x=M?d.getVerticesData(b.MatricesIndicesExtraKind):null,S=r.get(d.uniqueId)||new Map;r.set(d.uniqueId,S);const L=(N,D,Re,pe)=>{for(let ce=D;ce0){const oe=pe[ce],Ye=S.get(oe);Ye?(Ye.minimum.minimizeInPlace(o[N]),Ye.maximum.maximizeInPlace(h[N])):S.set(oe,{minimum:o[N].clone(),maximum:h[N].clone()})}};for(let N=0,D=0;N{const M=Va(E),C=m[I].getAbsoluteInverseBindMatrix();for(const x of M)_.TransformCoordinatesToRef(x,C,x);A.set(I,M)})}}}const u=Array.from({length:a.length},()=>({minimum:new _().setAll(Number.POSITIVE_INFINITY),maximum:new _().setAll(Number.NEGATIVE_INFINITY)})),f=()=>{for(let d=0;d{for(const x of M){const S=E[C].getFinalMatrix().multiplyToRef(m,v.Matrix[0]);_.TransformCoordinatesToRef(x,S,i),u[d].minimum.minimizeInPlace(i),u[d].maximum.maximizeInPlace(i)}})}else for(const E of l.get(g.uniqueId))_.TransformCoordinatesToRef(E,m,i),u[d].minimum.minimizeInPlace(i),u[d].maximum.maximizeInPlace(i)}};if(e&&e.isStarted){const d=e.getCurrentFrame(),g=t/e.getLength(0,1);for(let p=e.from;p<=e.to;p+=g)e.goToFrame(p),f();e.goToFrame(d)}else f();return u}function Xd(a){const e=[b.UVKind,b.UV2Kind,b.UV3Kind,b.UV4Kind,b.UV5Kind,b.UV6Kind];for(const t of a){const i=new Set(e),s=t.material?.getActiveTextures();if(s)for(const r of s)i.delete(e[r.coordinatesIndex]);i.forEach(r=>{t.isVerticesDataPresent(r)&&t.removeVerticesData(r)})}}class Vn{get resolve(){return this._resolve}get reject(){return this._reject}constructor(){this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}}class Rr{constructor(){this._currentOperation=Promise.resolve()}lockAsync(e,t){t?.throwIfAborted();const i=t?()=>(t.throwIfAborted(),e()):e,s=this._currentOperation.then(i);return this._currentOperation=new Promise(r=>{s.then(()=>r(),r)}),s}static async LockAsync(e,t,i){if(i?.throwIfAborted(),t.length===0)return await e();const s=new Vn;let r=0;for(const n of t)n.lockAsync(async()=>(r++,r===t.length&&s.resolve(await e()),await s.promise),i).catch(o=>s.reject(o));return await s.promise}}function Kh(...a){const e=t=>!!t&&typeof t=="object";return a.reduce((t,i)=>{const s=Object.keys(i);for(const r of s){const n=t[r],o=i[r];Array.isArray(n)&&Array.isArray(o)?t[r]=n.concat(...o):e(n)&&e(o)?t[r]=Kh(n,o):t[r]=o}return t},{})}class Kd{constructor(e){this._factory=e}get value(){return this._factory&&(this._value=this._factory(),this._factory=void 0),this._value}}class Mi{getDescription(){return""}apply(e,t){return!0}constructor(e=0){this.priority=e}}class nn extends Mi{getDescription(){return"Reducing render target texture size to "+this.maximumSize}constructor(e=0,t=1024,i=.5){super(e),this.priority=e,this.maximumSize=t,this.step=i}apply(e,t){let i=!0;for(let s=0;sthis.maximumSize&&(r.scale(this.step),i=!1)}return i}}class Sn extends Mi{getDescription(){return"Setting hardware scaling level to "+this._currentScale}constructor(e=0,t=2,i=.25){super(e),this.priority=e,this.maximumScale=t,this.step=i,this._currentScale=-1,this._directionOffset=1}apply(e,t){return this._currentScale===-1&&(this._currentScale=e.getEngine().getHardwareScalingLevel(),this._currentScale>this.maximumScale&&(this._directionOffset=-1)),this._currentScale+=this._directionOffset*this.step,this._currentScale=Math.min(this.maximumScale,this._currentScale),e.getEngine().setHardwareScalingLevel(this._currentScale),this._directionOffset===1?this._currentScale>=this.maximumScale:this._currentScale<=this.maximumScale}}class an extends Mi{getDescription(){return"Turning shadows on/off"}apply(e,t){return e.shadowsEnabled=t.isInImprovementMode,!0}}class on extends Mi{getDescription(){return"Turning post-processes on/off"}apply(e,t){return e.postProcessesEnabled=t.isInImprovementMode,!0}}class hn extends Mi{getDescription(){return"Turning lens flares on/off"}apply(e,t){return e.lensFlaresEnabled=t.isInImprovementMode,!0}}class Yd extends Mi{getDescription(){return this.onGetDescription?this.onGetDescription():"Running user defined callback"}apply(e,t){return this.onApply?this.onApply(e,t):!0}}class ln extends Mi{getDescription(){return"Turning particles on/off"}apply(e,t){return e.particlesEnabled=t.isInImprovementMode,!0}}class za extends Mi{getDescription(){return"Turning render targets off"}apply(e,t){return e.renderTargetsEnabled=t.isInImprovementMode,!0}}class Di extends Mi{constructor(){super(...arguments),this._canBeMerged=e=>{if(!(e instanceof ne))return!1;const t=e;return!(t.isDisposed()||!t.isVisible||!t.isEnabled()||t.instances.length>0||t.skeleton||t.hasLODLevels||t.getTotalVertices()===0)}}static get UpdateSelectionTree(){return Di._UpdateSelectionTree}static set UpdateSelectionTree(e){Di._UpdateSelectionTree=e}getDescription(){return"Merging similar meshes together"}apply(e,t,i){const s=e.meshes.slice(0);let r=s.length;for(let o=0;o{this._sceneDisposeObserver=null,this.dispose()})}stop(){this._isRunning=!1}reset(){this._currentPriorityLevel=0}start(){this._isRunning||(this._isRunning=!0,this._scene.executeWhenReady(()=>{setTimeout(()=>{this._checkCurrentState()},this._trackerDuration)}))}_checkCurrentState(){if(!this._isRunning)return;const e=this._scene,t=this._options;if(this._currentFrameRate=Math.round(e.getEngine().getFps()),this._improvementMode&&this._currentFrameRate<=this._targetFrameRate||!this._improvementMode&&this._currentFrameRate>=this._targetFrameRate){this._isRunning=!1,this.onSuccessObservable.notifyObservers(this);return}let i=!0,s=!0;for(let r=0;r{setTimeout(()=>{this._checkCurrentState()},this._trackerDuration)})}dispose(){this.stop(),this.onSuccessObservable.clear(),this.onFailureObservable.clear(),this.onNewOptimizationAppliedObservable.clear(),this._sceneDisposeObserver&&this._scene.onDisposeObservable.remove(this._sceneDisposeObserver)}static OptimizeAsync(e,t,i,s){const r=new zn(e,t||Ji.ModerateDegradationAllowed(),!1);return i&&r.onSuccessObservable.add(()=>{i()}),s&&r.onFailureObservable.add(()=>{s()}),r.start(),r}}class Yh{constructor(e,t,i){this.name=e,this._parentTask=t,this._context=i,this.disabled=!1}setInitializeFunc(e){this._initFunc=e}setExecuteFunc(e){this._executeFunc=e}_execute(){this.disabled||this._executeFunc(this._context)}_initialize(){this._initFunc?.(this._context)}_isValid(){return this._executeFunc!==void 0?null:"Execute function is not set (call setExecuteFunc to set it)"}_dispose(){}}class Wa extends Yh{static IsObjectListPass(e){return e.setObjectList!==void 0}get objectList(){return this._objectList}setObjectList(e){this._objectList=e}constructor(e,t,i,s){super(e,t,i),this._engine=s}_isValid(){const e=super._isValid();return e||(this._objectList!==void 0?null:"Object list is not set (call setObjectList to set it)")}}class Mn extends Yh{static IsRenderPass(e){return e.setRenderTarget!==void 0}get renderTarget(){return this._renderTarget}get renderTargetDepth(){return this._renderTargetDepth}get frameGraphRenderTarget(){return this._frameGraphRenderTarget}constructor(e,t,i,s){super(e,t,i),this._dependencies=new Set,this.depthReadOnly=!1,this.stencilReadOnly=!1,this._engine=s}setRenderTarget(e){this._renderTarget=e}setRenderTargetDepth(e){this._renderTargetDepth=e}addDependencies(e){if(e!==void 0)if(Array.isArray(e))for(const t of e)this._dependencies.add(t);else this._dependencies.add(e)}collectDependencies(e){const t=this._dependencies.keys();for(let i=t.next();i.done!==!0;i=t.next())e.add(i.value);if(this._renderTarget!==void 0)if(Array.isArray(this._renderTarget))for(const i of this._renderTarget)i!==void 0&&e.add(i);else e.add(this._renderTarget);this._renderTargetDepth!==void 0&&e.add(this._renderTargetDepth)}setOutputLayerAndFaceIndices(e){const t=this.frameGraphRenderTarget.renderTargetWrapper;if(t)for(const i of e)t.setLayerAndFaceIndex(i.targetIndex,i.layerIndex,i.faceIndex)}_initialize(){this._frameGraphRenderTarget=this._context.createRenderTarget(this.name,this._renderTarget,this._renderTargetDepth,this.depthReadOnly,this.stencilReadOnly),super._initialize()}_execute(){const e=this._context.enableDebugMarkers;this._context.enableDebugMarkers=!this._parentTask._disableDebugMarkers,this._context.bindRenderTarget(this._frameGraphRenderTarget),super._execute(),this._context.restoreDefaultFramebuffer(),this._context.enableDebugMarkers=e}_isValid(){const e=super._isValid();return e||(this._renderTarget!==void 0||this.renderTargetDepth!==void 0?null:"Render target and render target depth cannot both be undefined.")}_dispose(){this._frameGraphRenderTarget?.dispose()}}class or{get name(){return this._name}set name(e){this._name=e}get disabled(){return this._disabled}set disabled(e){this._disabled=e}get passes(){return this._passes}get passesDisabled(){return this._passesDisabled}getClassName(){return"FrameGraphTask"}initAsync(){return Promise.resolve()}isReady(){return!0}dispose(){this._reset(),this.onTexturesAllocatedObservable.clear(),this.onBeforeTaskExecute.clear(),this.onAfterTaskExecute.clear()}constructor(e,t){this._passes=[],this._passesDisabled=[],this._disabled=!1,this._disableDebugMarkers=!1,this.onTexturesAllocatedObservable=new O,this.onBeforeTaskExecute=new O,this.onAfterTaskExecute=new O,this.name=e,this._frameGraph=t,this._reset()}_reset(){for(const e of this._passes)e._dispose();for(const e of this._passesDisabled)e._dispose();this._passes.length=0,this._passesDisabled.length=0}_addPass(e,t){t?this._passesDisabled.push(e):this._passes.push(e)}_checkTask(){let e=null,t=null,i;for(const h of this._passes){const l=h._isValid();if(l)throw new Error(`Pass "${h.name}" is not valid. ${l}`);if(Mn.IsRenderPass(h)){const c=Array.isArray(h.renderTarget)?h.renderTarget:[h.renderTarget];e=[];for(const u of c)u!==void 0&&e.push(this._frameGraph.textureManager.getTextureFromHandle(u));t=h.renderTargetDepth!==void 0?this._frameGraph.textureManager.getTextureFromHandle(h.renderTargetDepth):null}else Wa.IsObjectListPass(h)&&(i=h.objectList)}let s=null,r=[],n=null,o;for(const h of this._passesDisabled){const l=h._isValid();if(l)throw new Error(`Pass "${h.name}" is not valid. ${l}`);if(Mn.IsRenderPass(h)){const c=Array.isArray(h.renderTarget)?h.renderTarget:[h.renderTarget];s=[];for(const u of c)u!==void 0&&s.push(this._frameGraph.textureManager.getTextureFromHandle(u));r=c,n=h.renderTargetDepth!==void 0?this._frameGraph.textureManager.getTextureFromHandle(h.renderTargetDepth):null}else Wa.IsObjectListPass(h)&&(o=h.objectList)}if(this._passesDisabled.length>0){if(!this._checkSameRenderTarget(e,s)){let h=!0;for(const l of r)if(l!==void 0&&!this._frameGraph.textureManager.isHistoryTexture(l)){h=!1;break}if(!h)throw new Error(`The output texture of the task "${this.name}" is different when it is enabled or disabled.`)}if(t!==n&&n!==null)throw new Error(`The output depth texture of the task "${this.name}" is different when it is enabled or disabled.`);if(i!==o&&o!==null)throw new Error(`The output object list of the task "${this.name}" is different when it is enabled or disabled.`)}}_execute(){const e=this._disabled&&this._passesDisabled.length>0?this._passesDisabled:this._passes;this.onBeforeTaskExecute.notifyObservers(this),this._disableDebugMarkers||this._frameGraph.engine._debugPushGroup?.(`${this.getClassName()} (${this.name})`);for(const t of e)t._execute();this._disableDebugMarkers||this._frameGraph.engine._debugPopGroup?.(),this.onAfterTaskExecute.notifyObservers(this)}_initializePasses(){this._disableDebugMarkers||this._frameGraph.engine._debugPushGroup?.(`${this.getClassName()} (${this.name})`);for(const e of this._passes)e._initialize();for(const e of this._passesDisabled)e._initialize();this._disableDebugMarkers||this._frameGraph.engine._debugPopGroup?.()}_checkSameRenderTarget(e,t){if(e===null||t===null)return e===t;if(e.length!==t.length)return!1;for(let i=0;i0}_updateLayerAndFaceIndices(e){this._layerAndFaceIndicesUpdated&&(e.setOutputLayerAndFaceIndices(this._outputLayerAndFaceIndices),this._layerAndFaceIndicesUpdated=!1)}}he.prototype.restoreSingleAttachment=function(){const a=this._gl;this.bindAttachments([a.BACK])};he.prototype.restoreSingleAttachmentForRenderTarget=function(){const a=this._gl;this.bindAttachments([a.COLOR_ATTACHMENT0])};he.prototype.buildTextureLayout=function(a,e=!1){const t=this._gl,i=[];if(e)i.push(t.BACK);else for(let s=0;s1&&(e.depthTextureFormat===13||e.depthTextureFormat===17||e.depthTextureFormat===16||e.depthTextureFormat===14||e.depthTextureFormat===18)&&(o=e.depthTextureFormat)),o===void 0&&(o=r?13:14);const D=this._gl,Re=this._currentFramebuffer,pe=D.createFramebuffer();this._bindUnboundFramebuffer(pe);const ce=a.width??a,oe=a.height??a,Ye=[],Qe=[],ft=this.webGLVersion>1&&(o===13||o===17||o===18);N.label=e?.label??"MultiRenderTargetWrapper",N._framebuffer=pe,N._generateDepthBuffer=n||s,N._generateStencilBuffer=n?ft:r,N._depthStencilBuffer=this._setupFramebufferDepthAttachments(N._generateStencilBuffer,N._generateDepthBuffer,ce,oe,1,o),N._attachments=Qe;for(let de=0;de1||this.isWebGPU);const ki=this.webGLVersion>1,Cs=D[ki?"COLOR_ATTACHMENT"+de:"COLOR_ATTACHMENT"+de+"_WEBGL"];if(Qe.push(Cs),ke===-1||L)continue;const Ze=new Et(this,6);Ye[de]=Ze,D.activeTexture(D["TEXTURE"+de]),D.bindTexture(ke,Ze._hardwareTexture.underlyingResource),D.texParameteri(ke,D.TEXTURE_MAG_FILTER,Ui.mag),D.texParameteri(ke,D.TEXTURE_MIN_FILTER,Ui.min),D.texParameteri(ke,D.TEXTURE_WRAP_S,D.CLAMP_TO_EDGE),D.texParameteri(ke,D.TEXTURE_WRAP_T,D.CLAMP_TO_EDGE);const Gi=this._getRGBABufferInternalSizedFormat(we,at,$e),Hi=this._getInternalFormat(at),Vi=this._getWebGLTextureType(we);if(ki&&(ke===35866||ke===32879))ke===35866?Ze.is2DArray=!0:Ze.is3D=!0,Ze.baseDepth=Ze.depth=Ni,D.texImage3D(ke,0,Gi,ce,oe,Ni,0,Hi,Vi,null);else if(ke===34067){for(let zi=0;zi<6;zi++)D.texImage2D(D.TEXTURE_CUBE_MAP_POSITIVE_X+zi,0,Gi,ce,oe,0,Hi,Vi,null);Ze.isCube=!0}else D.texImage2D(D.TEXTURE_2D,0,Gi,ce,oe,0,Hi,Vi,null);i&&D.generateMipmap(ke),this._bindTextureDirectly(ke,null),Ze.baseWidth=ce,Ze.baseHeight=oe,Ze.width=ce,Ze.height=oe,Ze.isReady=!0,Ze.samples=1,Ze.generateMipMaps=i,Ze.samplingMode=Fe,Ze.type=we,Ze._useSRGBBuffer=$e,Ze.format=at,Ze.label=S[de]??N.label+"-Texture"+de,this._internalTexturesCache.push(Ze)}if(n&&this._caps.depthTextureExtension&&!L){const de=new Et(this,14);let Fe=5,we=D.DEPTH_COMPONENT16,$e=D.DEPTH_COMPONENT,at=D.UNSIGNED_SHORT,ke=D.DEPTH_ATTACHMENT;this.webGLVersion<2?we=D.DEPTH_COMPONENT:o===14?(Fe=1,at=D.FLOAT,we=D.DEPTH_COMPONENT32F):o===18?(Fe=0,at=D.FLOAT_32_UNSIGNED_INT_24_8_REV,we=D.DEPTH32F_STENCIL8,$e=D.DEPTH_STENCIL,ke=D.DEPTH_STENCIL_ATTACHMENT):o===16?(Fe=0,at=D.UNSIGNED_INT,we=D.DEPTH_COMPONENT24,ke=D.DEPTH_ATTACHMENT):(o===13||o===17)&&(Fe=12,at=D.UNSIGNED_INT_24_8,we=D.DEPTH24_STENCIL8,$e=D.DEPTH_STENCIL,ke=D.DEPTH_STENCIL_ATTACHMENT),this._bindTextureDirectly(D.TEXTURE_2D,de,!0),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MAG_FILTER,D.NEAREST),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MIN_FILTER,D.NEAREST),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_S,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_T,D.CLAMP_TO_EDGE),D.texImage2D(D.TEXTURE_2D,0,we,ce,oe,0,$e,at,null),D.framebufferTexture2D(D.FRAMEBUFFER,ke,D.TEXTURE_2D,de._hardwareTexture.underlyingResource,0),this._bindTextureDirectly(D.TEXTURE_2D,null),N._depthStencilTexture=de,N._depthStencilTextureWithStencil=ft,de.baseWidth=ce,de.baseHeight=oe,de.width=ce,de.height=oe,de.isReady=!0,de.samples=1,de.generateMipMaps=i,de.samplingMode=1,de.format=o,de.type=Fe,de.label=N.label+"-DepthStencil",Ye[h]=de,this._internalTexturesCache.push(de)}if(N.setTextures(Ye),t&&D.drawBuffers(Qe),this._bindUnboundFramebuffer(Re),N.setLayerAndFaceIndices(C,M),this.resetTextureCache(),!L)this.updateMultipleRenderTargetTextureSampleCount(N,l,t);else if(l>1){const de=D.createFramebuffer();if(!de)throw new Error("Unable to create multi sampled framebuffer");N._samples=l,N._MSAAFramebuffer=de,h>0&&t&&(this._bindUnboundFramebuffer(de),D.drawBuffers(Qe),this._bindUnboundFramebuffer(Re))}return N};he.prototype.updateMultipleRenderTargetTextureSampleCount=function(a,e,t=!0){if(this.webGLVersion<2||!a)return 1;if(a.samples===e)return e;const i=this._gl;e=Math.min(e,this.getCaps().maxMSAASamples),a._depthStencilBuffer&&(i.deleteRenderbuffer(a._depthStencilBuffer),a._depthStencilBuffer=null),a._MSAAFramebuffer&&(i.deleteFramebuffer(a._MSAAFramebuffer),a._MSAAFramebuffer=null);const s=a._attachments.length;for(let n=0;n1&&typeof i.renderbufferStorageMultisample=="function"){const n=i.createFramebuffer();if(!n)throw new Error("Unable to create multi sampled framebuffer");a._MSAAFramebuffer=n,this._bindUnboundFramebuffer(n);const o=[];for(let h=0;h1?"COLOR_ATTACHMENT"+h:"COLOR_ATTACHMENT"+h+"_WEBGL"],f=this._createRenderBuffer(l.width,l.height,e,-1,this._getRGBABufferInternalSizedFormat(l.type,l.format,l._useSRGBBuffer),u);if(!f)throw new Error("Unable to create multi sampled framebuffer");c.addMSAARenderBuffer(f),l.samples=e,o.push(u)}t&&i.drawBuffers(o)}else this._bindUnboundFramebuffer(a._framebuffer);const r=a._depthStencilTexture?a._depthStencilTexture.format:void 0;return a._depthStencilBuffer=this._setupFramebufferDepthAttachments(a._generateStencilBuffer,a._generateDepthBuffer,a.width,a.height,e,r),this._bindUnboundFramebuffer(null),a._samples=e,e};he.prototype.generateMipMapsMultiFramebuffer=function(a){const e=a,t=this._gl;if(e.isMulti)for(let i=0;i1?"COLOR_ATTACHMENT"+n:"COLOR_ATTACHMENT"+n+"_WEBGL"],t.readBuffer(s[n]),t.drawBuffers(s),t.blitFramebuffer(0,0,o.width,o.height,0,0,o.width,o.height,i,t.NEAREST)}for(let n=0;n1?"COLOR_ATTACHMENT"+n:"COLOR_ATTACHMENT"+n+"_WEBGL"];t.drawBuffers(s),t.bindFramebuffer(this._gl.FRAMEBUFFER,e._MSAAFramebuffer)};const jh=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class Ds extends Bi{get isSupported(){return this._engine?.getCaps().drawBuffersExtension??!1}get textures(){return this._textures}get count(){return this._count}get depthTexture(){return this._textures[this._textures.length-1]}set wrapU(e){if(this._textures)for(let t=0;t0&&(this._createInternalTextures(),this._createTextures(n))}_initTypes(e,t,i,s,r,n,o,h,l,c){for(let u=0;u{this.onAfterRenderObservable.notifyObservers(t)})}dispose(e=!1){this._releaseTextures(),e?this._texture=null:this.releaseInternalTextures(),super.dispose()}releaseInternalTextures(){const e=this._renderTarget?.textures;if(e){for(let t=e.length-1;t>=0;t--)this._textures[t]._texture=null;this._renderTarget?.dispose(),this._renderTarget=null}}}class Ei{get passCount(){return this._passCount}set passCount(e){this._passCount!==e&&(this._passCount=e,this._createRenderPassIds())}get useRenderPasses(){return this._useRenderPasses}set useRenderPasses(e){this._useRenderPasses!==e&&(this._useRenderPasses=e,this._createRenderPassIds())}addExcludedMesh(e){this._excludedMeshes.indexOf(e.uniqueId)===-1&&this._excludedMeshes.push(e.uniqueId)}removeExcludedMesh(e){const t=this._excludedMeshes.indexOf(e.uniqueId);t!==-1&&this._excludedMeshes.splice(t,1)}get shaderLanguage(){return this._shaderLanguage}get blendOutput(){return this._blendOutput}set blendOutput(e){this._blendOutput=e,this._disposeTextures(),e&&this._createTextures()}constructor(e,t=5){this._depthMrts=[],this._thinTextures=[],this._colorMrts=[],this._currentPingPongState=0,this._layoutCacheFormat=[[!0],[!0,!0],[!0,!0,!0]],this._layoutCache=[],this._candidateSubMeshes=new it(10),this._excludedSubMeshes=new it(10),this._excludedMeshes=[],this._colorCache=[new fe(Ei._DEPTH_CLEAR_VALUE,Ei._DEPTH_CLEAR_VALUE,0,0),new fe(-Ei._MIN_DEPTH,Ei._MAX_DEPTH,0,0),new fe(0,0,0,0)],this._shaderLanguage=0,this._scene=e,this._engine=e.getEngine(),this._passCount=t;for(let i=0;i{this._shaderLanguage===1?await G(()=>import("./oitBackBlend.fragment-2SkQ74Uj.js"),__vite__mapDeps([96,13,14]),import.meta.url):await G(()=>import("./oitBackBlend.fragment-MvwpfZ6x.js"),__vite__mapDeps([97,13,14]),import.meta.url)}}),this._blendBackEffectWrapperPingPong=new rt({fragmentShader:"oitBackBlend",useShaderStore:!0,engine:this._engine,samplerNames:["uBackColor"],uniformNames:[],shaderLanguage:this._shaderLanguage,extraInitializationsAsync:async()=>{this._shaderLanguage===1?await G(()=>import("./oitBackBlend.fragment-2SkQ74Uj.js"),__vite__mapDeps([96,13,14]),import.meta.url):await G(()=>import("./oitBackBlend.fragment-MvwpfZ6x.js"),__vite__mapDeps([97,13,14]),import.meta.url)}}),this._finalEffectWrapper=new rt({fragmentShader:e,useShaderStore:!0,engine:this._engine,samplerNames:t,uniformNames:[],shaderLanguage:this._shaderLanguage,extraInitializationsAsync:async()=>{this._shaderLanguage===1?await G(()=>import("./oitFinalSimpleBlend.fragment-C05G8A8O.js"),__vite__mapDeps([98,13,14]),import.meta.url):await G(()=>import("./oitFinalSimpleBlend.fragment-Do9a99j5.js"),__vite__mapDeps([99,13,14]),import.meta.url)}}),this._effectRenderer=new $u(this._engine)}setPrePassRenderer(e){}bind(e){e.setTexture("oitDepthSampler",this._thinTextures[this._currentPingPongState*3]),e.setTexture("oitFrontColorSampler",this._thinTextures[this._currentPingPongState*3+1])}_renderSubMeshes(e){let t;this._useRenderPasses&&(t={});for(let i=0;i{this._renderer.options.doNotChangeAspectRatio||i.updateTransformMatrix(!0)}),this._oitRenderer=new Ei(i),this._oitRenderer.useRenderPasses=!0,this.outputTexture=this._frameGraph.textureManager.createDanglingHandle(),this.outputDepthTexture=this._frameGraph.textureManager.createDanglingHandle(),this.onBeforeTaskExecute.add(()=>{this._disableDebugMarkers=this._engine._enableGPUDebugMarkers&&this._sceneHasClusteredLights()})}isReady(){return this._renderer.renderList=this.objectList.meshes,this._renderer.particleSystemList=this.objectList.particleSystems,this._renderer.isReadyForRendering(this._textureWidth,this._textureHeight)}getClassName(){return"FrameGraphObjectRendererTask"}record(e=!1,t){this._checkParameters();const i=this._getTargetHandles(),s=this._checkTextureCompatibility(i);this._resolveDanglingHandles(i),this._setLightsForShadow(),this._rtForOrderIndependentTransparency?.dispose();const r=this._frameGraph.addRenderPass(this.name);if(r.setRenderTarget(i),r.setRenderTargetDepth(this.depthTexture),r.setInitializeFunc(()=>{this._rtForOrderIndependentTransparency=new Qh(this.name+"_oitRT",this._frameGraph.textureManager,this.targetTexture,this.depthTexture)}),r.setExecuteFunc(n=>{this._renderer.renderList=this.objectList.meshes,this._renderer.particleSystemList=this.objectList.particleSystems,this._updateLayerAndFaceIndices(r);const o=r.frameGraphRenderTarget.renderTargetWrapper;o&&(o.resolveMSAAColors=this.resolveMSAAColors,o.resolveMSAADepth=this.resolveMSAADepth),this._useOITForTransparentMeshes&&this._oitRenderer.blendOutput!==this._rtForOrderIndependentTransparency.renderTargetWrapper&&(this._oitRenderer.blendOutput=this._rtForOrderIndependentTransparency.renderTargetWrapper);const h=this.getBoundingBoxRenderer?.(),l=h&&h.renderList.length>0?h.renderList.data.slice():[];h&&(l.length=h.renderList.length);const c=this._prepareRendering(n,s),u=this._scene._depthPeelingRenderer;this._scene._depthPeelingRenderer=this._oitRenderer;const f=this._renderer.activeCamera;if(f&&f.cameraRigMode!==0&&!f._renderingMultiview){for(let d=0;d{})}return r}dispose(){this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable),this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable),this._externalObjectRenderer||this._renderer.dispose(),this._oitRenderer.dispose(),this._rtForOrderIndependentTransparency?.dispose(),super.dispose()}_resolveDanglingHandles(e){e.length>0&&this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture,e[0]),this.depthTexture!==void 0&&this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture,this.depthTexture)}_checkParameters(){if(this.targetTexture===void 0||this.objectList===void 0||this.camera===void 0)throw new Error(`FrameGraphObjectRendererTask ${this.name}: targetTexture, objectList, and camera are required`)}_checkTextureCompatibility(e){const t=this.getClassName();let i=e.length>0?this._frameGraph.textureManager.getTextureDescription(e[0]):null,s=!1;if(this.depthTexture!==void 0){if(i&&this.depthTexture!==ni&&e[0]===Ut)throw new Error(`${t} ${this.name}: the back buffer depth/stencil texture is the only depth texture allowed when the target is the back buffer color`);const r=this._frameGraph.textureManager.getTextureDescription(this.depthTexture);if(i||(i=r),r.options.samples!==i.options.samples)throw new Error(`${t} ${this.name}: the depth texture "${r.options.labels?.[0]??"noname"}" (${r.options.samples} samples) and the output texture "${i.options.labels?.[0]??"noname"}" (${i.options.samples} samples) must have the same number of samples`);if(r.size.width!==i.size.width||r.size.height!==i.size.height)throw new Error(`${t} ${this.name}: the depth texture (size: ${r.size.width}x${r.size.height}) and the target texture (size: ${i.size.width}x${i.size.height}) must have the same dimensions.`);s=!0}return this._textureWidth=i?.size.width??1,this._textureHeight=i?.size.height??1,s}_getTargetHandles(){return Array.isArray(this.targetTexture)?this.targetTexture:[this.targetTexture]}_prepareRendering(e,t){return e.setDepthStates(this.depthTest&&t,this.depthWrite&&t),null}_setLightsForShadow(){const e=new Set,t=new Map;if(this.shadowGenerators)for(const i of this.shadowGenerators){const s=i.shadowGenerator,r=s.getLight();r.isEnabled()&&r.shadowEnabled&&(e.add(r),i.getClassName()==="FrameGraphCascadedShadowGeneratorTask"?r._shadowGenerators.set(i.camera,s):r._shadowGenerators.set(null,s))}this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable),this._onBeforeRenderObservable=this._renderer.onBeforeRenderObservable.add(()=>{for(let i=0;i{for(let i=0;i{const o=n.frameGraphRenderTarget.renderTargetWrapper;o&&(o.disableAutomaticMSAAResolve=!0)}),n.setExecuteFunc(o=>{this._updateLayerAndFaceIndices(n),r.copyFrom(this.color),this.convertColorToLinearSpace&&r.toLinearSpaceToRef(r),o.clearAttachments(r,s,!!this.clearColor,!!this.clearDepth,!!this.clearStencil,this.stencilValue)}),!e){const o=this._frameGraph.addRenderPass(this.name+"_disabled",!0);o.setRenderTarget(i),o.setRenderTargetDepth(this.depthTexture),o.setExecuteFunc(h=>{})}return n}}class hi extends rt{_gatherImports(e,t){e?(this._webGPUReady=!0,t.push(Promise.all([G(()=>import("./kernelBlur.fragment-DQBu662A.js"),__vite__mapDeps([100,101,102,13,14]),import.meta.url),G(()=>import("./kernelBlur.vertex-pWey8ouW.js"),__vite__mapDeps([103,101,13,14]),import.meta.url)]))):t.push(Promise.all([G(()=>import("./kernelBlur.fragment-Ur-RzLkw.js"),__vite__mapDeps([104,105,106,13,14]),import.meta.url),G(()=>import("./kernelBlur.vertex-DPmcm8PU.js"),__vite__mapDeps([107,105,13,14]),import.meta.url)]))}constructor(e,t=null,i,s,r){const n=!!r?.blockCompilation;super({...r,name:e,engine:t||V.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:hi.FragmentUrl,uniforms:hi.Uniforms,samplers:hi.Samplers,vertexUrl:hi.VertexUrl,blockCompilation:!0}),this._packedFloat=!1,this._staticDefines="",this.textureWidth=0,this.textureHeight=0,this._staticDefines=r?Array.isArray(r.defines)?r.defines.join(` +`):r.defines||"":"",this.options.blockCompilation=n,i!==void 0&&(this.direction=i),s!==void 0&&(this.kernel=s)}set kernel(e){this._idealKernel!==e&&(e=Math.max(e,1),this._idealKernel=e,this._kernel=this._nearestBestKernel(e),this.options.blockCompilation||this._updateParameters())}get kernel(){return this._idealKernel}set packedFloat(e){this._packedFloat!==e&&(this._packedFloat=e,this.options.blockCompilation||this._updateParameters())}get packedFloat(){return this._packedFloat}bind(e=!1){super.bind(e),this._drawWrapper.effect.setFloat2("delta",1/this.textureWidth*this.direction.x,1/this.textureHeight*this.direction.y)}_updateParameters(e,t){const i=this._kernel,s=(i-1)/2;let r=[],n=[],o=0;for(let m=0;m0)return Math.max(i,3);return Math.max(t,3)}_gaussianWeight(e){const t=.3333333333333333,i=Math.sqrt(2*Math.PI)*t,s=-(e*e/(2*t*t));return 1/i*Math.exp(s)}_glslFloat(e,t=8){return e.toFixed(t).replace(/0+$/,"")}}hi.VertexUrl="kernelBlur";hi.FragmentUrl="kernelBlur";hi.Uniforms=["delta","direction"];hi.Samplers=["circleOfConfusionSampler"];class $h extends or{get drawWrapper(){return this._postProcessDrawWrapper}constructor(e,t,i){super(e,t),this.sourceSamplingMode=2,this.depthReadOnly=!1,this.stencilReadOnly=!1,this.disableColorWrite=!1,this.drawBackFace=!1,this.depthTest=!0,this.postProcess=i,this._postProcessDrawWrapper=this.postProcess.drawWrapper,this.outputTexture=this._frameGraph.textureManager.createDanglingHandle(),this.outputDepthAttachmentTexture=this._frameGraph.textureManager.createDanglingHandle()}isReady(){return this.postProcess.isReady()}getClassName(){return"FrameGraphPostProcessTask"}record(e=!1,t,i){if(this.sourceTexture===void 0&&this.targetTexture===void 0)throw new Error(`FrameGraphPostProcessTask "${this.name}": sourceTexture or targetTexture is required`);const s=this.sourceTexture!==void 0?this._frameGraph.textureManager.getTextureCreationOptions(this.sourceTexture):void 0;if(s&&(s.options.samples=1),this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture,this.targetTexture,this.name,s),this.depthAttachmentTexture!==void 0&&this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthAttachmentTexture,this.depthAttachmentTexture),s){const o=this._frameGraph.textureManager.getTextureAbsoluteDimensions(s);this._sourceWidth=o.width,this._sourceHeight=o.height}const r=this._frameGraph.textureManager.getTextureDescription(this.outputTexture);this._outputWidth=r.size.width,this._outputHeight=r.size.height;const n=this._frameGraph.addRenderPass(this.name);if(n.depthReadOnly=this.depthReadOnly,n.stencilReadOnly=this.stencilReadOnly,n.addDependencies(this.sourceTexture),n.setRenderTarget(this.outputTexture),n.setRenderTargetDepth(this.depthAttachmentTexture),n.setExecuteFunc(o=>{o.pushDebugGroup(`Apply post-process (${this.name})`),this.sourceTexture!==void 0&&o.setTextureSamplingMode(this.sourceTexture,this.sourceSamplingMode),t?.(o),this.viewport&&o.setViewport(this.viewport),o.applyFullScreenEffect(this._postProcessDrawWrapper,()=>{this.sourceTexture!==void 0&&o.bindTextureHandle(this._postProcessDrawWrapper.effect,"textureSampler",this.sourceTexture),i?.(o),this.postProcess.bind()},this.stencilState,this.disableColorWrite,this.drawBackFace,this.depthTest,this.viewport!==void 0),o.restoreDefaultFramebuffer(),o.popDebugGroup()}),!e){const o=this._frameGraph.addRenderPass(this.name+"_disabled",!0);o.depthReadOnly=this.depthReadOnly,o.stencilReadOnly=this.stencilReadOnly,o.addDependencies(this.sourceTexture),o.setRenderTarget(this.outputTexture),o.setRenderTargetDepth(this.depthAttachmentTexture),o.setExecuteFunc(h=>{this.sourceTexture!==void 0&&(this.viewport&&h.setViewport(this.viewport),h.copyTexture(this.sourceTexture,void 0,this.viewport!==void 0))})}return n}dispose(){this.postProcess.dispose(),super.dispose()}}class Xa extends $h{constructor(e,t,i){super(e,t,i||new hi(e,t.engine,new Q(1,0),10))}getClassName(){return"FrameGraphBlurTask"}record(e=!1,t,i){const s=super.record(e,t,i);return this.postProcess.textureWidth=this._outputWidth,this.postProcess.textureHeight=this._outputHeight,s}}function Ci(a){return a.width!==void 0}function Bs(a){return Ci(a)?{width:a.width,height:a.height}:{width:a,height:a}}var pt;(function(a){a[a.Task=0]="Task",a[a.Graph=1]="Graph",a[a.External=2]="External"})(pt||(pt={}));class ai{constructor(e,t=!1,i){this.engine=e,this._debugTextures=t,this._scene=i,this._textures=new Map,this._historyTextures=new Map,this._isRecordingTask=!1,this.showDebugLogsForTextureAllcationOptimization=!1,this._backBufferTextureEntry=null,this._backBufferDepthStencilTextureEntry=null,this._backBufferTextureOverriden=!1,this._addSystemTextures()}isBackbuffer(e){return this._backBufferTextureOverriden?!1:this._isBackbuffer(e)}_isBackbuffer(e){if(e===Ut||e===ni)return!0;const t=this._textures.get(e);return t?t.refHandle===Ut||t.refHandle===ni:!1}isBackbufferColor(e){if(this._backBufferTextureOverriden)return!1;if(e===Ut)return!0;const t=this._textures.get(e);return t?t.refHandle===Ut:!1}isBackbufferDepthStencil(e){if(this._backBufferTextureOverriden)return!1;if(e===ni)return!0;const t=this._textures.get(e);return t?t.refHandle===ni:!1}isHistoryTexture(e,t=!1){const i=this._textures.get(e);return i?(e=i.refHandle??e,t?this._textures.get(e)?.historyTexture===!0:this._historyTextures.has(e)):!1}getTextureCreationOptions(e,t=!1){e=this._textures.get(e)?.refHandle??e;const i=this._textures.get(e),s=i.creationOptions;return{size:Ci(s.size)?{...s.size}:s.size,sizeIsPercentage:s.sizeIsPercentage,options:ai.CloneTextureOptions(s.options,i.textureIndex),isHistoryTexture:t?s.isHistoryTexture:!1}}getTextureDescription(e){const t=this.getTextureCreationOptions(e);return{size:t.sizeIsPercentage?this.getAbsoluteDimensions(t.size):Ci(t.size)?t.size:{width:t.size,height:t.size},options:t.options}}getTextureHandleOrCreateTexture(e,t,i){if(e===void 0){if(t===void 0||i===void 0)throw new Error("getTextureHandleOrCreateTexture: Either handle or newTextureName and creationOptions must be provided.");return this.createRenderTargetTexture(t,i)}return e}getTextureFromHandle(e,t){const i=this._textures.get(e),s=i?.refHandle,r=s!==void 0?this._textures.get(s):i,n=s!==void 0?s:e,o=this._historyTextures.get(n);return o?o.textures[t?o.index:o.index^1]:r.texture}importTexture(e,t,i){i!==void 0&&this._freeEntry(i);const s={size:{width:t.width,height:t.height},sizeIsPercentage:!1,isHistoryTexture:!1,options:{createMipMaps:t.generateMipMaps,samples:t.samples,types:[t.type],formats:[t.format],useSRGBBuffers:[t._useSRGBBuffer],creationFlags:[t._creationFlags],labels:t.label?[t.label]:["imported"]}};return this._createHandleForTexture(e,t,s,pt.External,i)}createRenderTargetTexture(e,t,i){return this._createHandleForTexture(e,null,{size:Ci(t.size)?{...t.size}:t.size,sizeIsPercentage:t.sizeIsPercentage,isHistoryTexture:t.isHistoryTexture,options:ai.CloneTextureOptions(t.options,void 0,!0)},this._isRecordingTask?pt.Task:pt.Graph,i)}createRenderTarget(e,t,i,s,r){const n=new Qh(e,this,t,i),o=n.renderTargetWrapper;if(o!==void 0&&(o.depthReadOnly=!!s,o.stencilReadOnly=!!r,t)){const h=Array.isArray(t)?t:[t];for(let l=0;l{if(!this._backBufferTextureOverriden&&(n===Ut||n===ni)||r.refHandle!==void 0||e&&r.aliasHandle!==void 0)return;const o=r.creationOptions,h=r.textureIndex||0,l=o.sizeIsPercentage?this.getAbsoluteDimensions(o.size,t,i):Bs(o.size),c=ai._GetTextureBlockInformation(o.options.types?.[h]??0,o.options.formats[h]),u=Math.ceil(l.width/c.width)*Math.ceil(l.height/c.height)*c.length;let f=u;o.options.createMipMaps&&(f=Math.floor(f*4/3)),(o.options.samples||1)>1&&(f+=u),s+=f}),s}get backBufferTextureOverriden(){return this._backBufferTextureOverriden}setBackBufferTextures(e,t,i,s){if((e===0||t===0)&&(!i||!s)){if(this._backBufferTextureOverriden){let n=this._textures.get(Ut);n.texture?.dispose(),n.texture=null,n.debug?.dispose(),n.debug=void 0,n=this._textures.get(ni),n.texture?.dispose(),n.texture=null,n.debug?.dispose(),n.debug=void 0}this._backBufferTextureEntry=null,this._backBufferDepthStencilTextureEntry=null,this._backBufferTextureOverriden=!1,this._addSystemTextures();return}this._backBufferTextureOverriden=!0;const r={width:e,height:t};this._backBufferTextureEntry={name:"backbuffer color",texture:null,creationOptions:i??{size:r,options:{createMipMaps:!1,samples:this.engine.getCreationOptions().antialias?4:1,types:[0],formats:[5],useSRGBBuffers:[!1],creationFlags:[0],labels:["backbuffer color"]},sizeIsPercentage:!1},namespace:pt.Graph,lifespan:{firstTask:Number.MAX_VALUE,lastTask:0}},this._backBufferTextureEntry.textureDescriptionHash=this._createTextureDescriptionHash(this._backBufferTextureEntry.creationOptions),this._backBufferDepthStencilTextureEntry={name:"backbuffer depth/stencil",texture:null,creationOptions:s??{size:r,options:{createMipMaps:!1,samples:this.engine.getCreationOptions().antialias?4:1,types:[0],formats:[this.engine.isStencilEnable?13:14],useSRGBBuffers:[!1],creationFlags:[0],labels:["backbuffer depth/stencil"]},sizeIsPercentage:!1},namespace:pt.Graph,lifespan:{firstTask:Number.MAX_VALUE,lastTask:0}},this._backBufferDepthStencilTextureEntry.textureDescriptionHash=this._createTextureDescriptionHash(this._backBufferDepthStencilTextureEntry.creationOptions),this._addSystemTextures()}resetBackBufferTextures(){this.setBackBufferTextures(0,0)}get hasHistoryTextures(){return this._historyTextures.size>0}_dispose(){this._releaseTextures()}_allocateTextures(e){e&&this._optimizeTextureAllocation(e),this._textures.forEach(t=>{if(!t.texture){if(t.refHandle!==void 0){const i=this._textures.get(t.refHandle);t.texture=i.texture,t.texture?.incrementReferences(),i.refHandle===Ut&&(t.refHandle=Ut),i.refHandle===ni&&(t.refHandle=ni)}else if(t.namespace!==pt.External)if(t.aliasHandle!==void 0){const i=this._textures.get(t.aliasHandle);t.texture=i.texture,t.texture.incrementReferences()}else{const i=t.creationOptions,s=Bs(i.sizeIsPercentage?this.getAbsoluteDimensions(i.size):i.size),r=t.textureIndex||0,n=i.options.targetTypes?.[r]??3553,o=n===32879,h=n===35866||n===3735928559,l=i.options.layerCounts?.[r]??0,c={createMipMaps:i.options.createMipMaps,samples:i.options.samples,type:i.options.types?.[r],format:i.options.formats?.[r],useSRGBBuffer:i.options.useSRGBBuffers?.[r],creationFlags:i.options.creationFlags?.[r],label:i.options.labels?.[r]??`${t.name}${r>0?"#"+r:""}`,samplingMode:1,createMSAATexture:i.options.samples>1,isCube:n===34067||n===3735928559},u=xn(c.format),f=bs(c.format),d=u&&f?12:u||f?14:5,g=this.engine._createInternalTexture({width:s.width,height:s.height,depth:o?l:void 0,layers:h?l:void 0},c,!1,d);u&&(g.type=sd(g.format)),t.texture=g}}t.texture&&t.refHandle===void 0&&(t.debug?.dispose(),t.debug=this._createDebugTexture(t.name,t.texture))}),this._historyTextures.forEach(t=>{for(let i=0;i{t.lifespan&&(t.lifespan.firstTask=Number.MAX_VALUE,t.lifespan.lastTask=0),t.aliasHandle=void 0,(e||t.namespace!==pt.External)&&(t.debug?.dispose(),t.debug=void 0),t.namespace!==pt.External&&(t.texture?.dispose(),t.texture=null,(e||t.namespace===pt.Task)&&(this._textures.delete(i),this._historyTextures.delete(i)))}),this._historyTextures.forEach(t=>{for(let i=0;i{e.index=e.index^1;const t=e.textures[e.index];if(t)for(const{renderTargetWrapper:i,textureIndex:s}of e.references)i.setTexture(t,s,!1)})}_addSystemTextures(){const e={width:this.engine.getRenderWidth(!0),height:this.engine.getRenderHeight(!0)};this._textures.set(Ut,this._backBufferTextureEntry??{name:"backbuffer color",texture:null,creationOptions:{size:e,options:{createMipMaps:!1,samples:this.engine.getCreationOptions().antialias?4:1,types:[0],formats:[5],useSRGBBuffers:[!1],creationFlags:[0],labels:["backbuffer color"]},sizeIsPercentage:!1},namespace:pt.External}),this._textures.set(ni,this._backBufferDepthStencilTextureEntry??{name:"backbuffer depth/stencil",texture:null,creationOptions:{size:e,options:{createMipMaps:!1,samples:this.engine.getCreationOptions().antialias?4:1,types:[0],formats:[16],useSRGBBuffers:[!1],creationFlags:[0],labels:["backbuffer depth/stencil"]},sizeIsPercentage:!1},namespace:pt.External})}_createDebugTexture(e,t){if(!this._debugTextures)return;const i=new z(null,this._scene);return i.name=e,i._texture=t,i._texture.incrementReferences(),i}_freeEntry(e){const t=this._textures.get(e);t&&(t.debug?.dispose(),this._textures.delete(e))}_createHandleForTexture(e,t,i,s,r,n){r=r??ai._Counter++,n=n||0;const o=i.isHistoryTexture?`${e} ping`:e;let h=i.options.labels?.[n]??"";h===o&&(h="");const l={texture:t,name:`${o}${h?" "+h:""}`,creationOptions:{size:Ci(i.size)?i.size:{width:i.size,height:i.size},options:i.options,sizeIsPercentage:i.sizeIsPercentage,isHistoryTexture:i.isHistoryTexture},namespace:s,textureIndex:n,textureDescriptionHash:this._createTextureDescriptionHash(i),lifespan:{firstTask:Number.MAX_VALUE,lastTask:0},historyTexture:i.isHistoryTexture};if(this._textures.set(r,l),s===pt.External)return r;if(i.isHistoryTexture){const c={size:{...l.creationOptions.size},options:{...l.creationOptions.options},sizeIsPercentage:l.creationOptions.sizeIsPercentage,isHistoryTexture:!1},u=this._createHandleForTexture(`${e} pong`,null,c,s);return this._textures.get(u).historyTexture=!0,this._historyTextures.set(r,{textures:[null,null],handles:[r,u],index:0,references:[]}),r}if(i.options.types&&i.options.types.length>1&&n===0){const c=i.options.types.length,u={size:Ci(i.size)?i.size:{width:i.size,height:i.size},options:i.options,sizeIsPercentage:i.sizeIsPercentage};for(let f=1;f=h.firstTask){g=!0;break}if(!g){this.showDebugLogsForTextureAllcationOptimization&&w.Log(`Texture ${r} (${n.name}) reuses cache entry ${f}`),d.push(h),n.aliasHandle=f,c=!0;break}}c||l.push([r,[h]])}else t.set(o,[[r,[h]]])}}_computeTextureLifespan(e){this.showDebugLogsForTextureAllcationOptimization&&w.Log("================== Dump of texture dependencies for all tasks/passes ==================");for(let t=0;t0&&this._computeTextureLifespanForPasses(i,t,i.passes),i.passesDisabled.length>0&&this._computeTextureLifespanForPasses(i,t,i.passesDisabled),i.dependencies&&(this.showDebugLogsForTextureAllcationOptimization&&w.Log(`task#${t} (${i.name}), global dependencies`),this._updateLifespan(t*100+99,i.dependencies))}if(this.showDebugLogsForTextureAllcationOptimization){w.Log("================== Texture lifespans ==================");const t=this._textures.keys();for(let i=t.next();i.done!==!0;i=t.next()){const s=i.value,r=this._textures.get(s);r.refHandle!==void 0||r.namespace===pt.External||this._historyTextures.has(s)||w.Log(`${s} (${r.name}): ${r.lifespan.firstTask} - ${r.lifespan.lastTask}`)}}}_computeTextureLifespanForPasses(e,t,i){for(let s=0;simport("./glowBlurPostProcess.fragment-9rC-Cuk0.js"),__vite__mapDeps([108,13,14]),import.meta.url))):t.push(G(()=>import("./glowBlurPostProcess.fragment-z431ChCJ.js"),__vite__mapDeps([109,13,14]),import.meta.url)),super._gatherImports(e,t)}bind(){super.bind(),this._drawWrapper.effect.setFloat2("screenSize",this.textureWidth,this.textureHeight),this._drawWrapper.effect.setVector2("direction",this.direction),this._drawWrapper.effect.setFloat("blurWidth",this.kernel)}}As.FragmentUrl="glowBlurPostProcess";As.Uniforms=["screenSize","direction","blurWidth"];class Ka extends or{isReady(){return!this.customIsReady||this.customIsReady()}constructor(e,t){super(e,t)}getClassName(){return"FrameGraphExecuteTask"}record(){if(!this.func)throw new Error("FrameGraphExecuteTask: Execute task must have a function.");const e=this._frameGraph.addPass(this.name);return e.setExecuteFunc(i=>{this.func(i)}),this._frameGraph.addPass(this.name+"_disabled",!0).setExecuteFunc(i=>{this.funcDisabled?.(i)}),e}}class Ya extends $h{constructor(e,t,i){super(e,t,i||new As(e,t.engine,new Q(1,0),1))}getClassName(){return"FrameGraphGlowBlurTask"}record(e=!1,t,i){const s=super.record(e,t,i);return this.postProcess.textureWidth=this._outputWidth,this.postProcess.textureHeight=this._outputHeight,s}}class jd extends or{get name(){return this._name}set name(e){if(this._name=e,this._blurX)for(let t=0;t{this.layer.onBeforeBlurObservable.hasObservers()&&this.layer.onBeforeBlurObservable.notifyObservers(this.layer)},this._onAfterBlurTask.func=()=>{this.layer.onAfterBlurObservable.hasObservers()&&this.layer.onAfterBlurObservable.notifyObservers(this.layer)}),this.outputTexture=this._frameGraph.textureManager.createDanglingHandle()}isReady(){return this._objectRendererForLayer.isReady()&&this.layer.isLayerReady()}getClassName(){return"FrameGraphBaseLayerTask"}record(){if(this.targetTexture===void 0||this.objectRendererTask===void 0)throw new Error(`${this.constructor.name} "${this.name}": targetTexture and objectRendererTask are required`);this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture,this.targetTexture);let e,t,i;if(this.layerTexture)i=this.layerTexture,t=this._frameGraph.textureManager.getTextureCreationOptions(this.layerTexture),e=Bs(t.size),t.size=e;else{const p=this._frameGraph.textureManager.getTextureCreationOptions(this.targetTexture),m=this.layer._options.mainTextureFixedSize?Math.max(2,this.layer._options.mainTextureFixedSize):0;e=Bs(p.size),e.width=m||Math.floor(e.width*(this.layer._options.mainTextureRatio||.1))||1,e.height=m||Math.floor(e.height*(this.layer._options.mainTextureRatio||.1))||1,t={size:e,options:{createMipMaps:!1,types:[this.layer._options.mainTextureType],formats:[5],samples:1,useSRGBBuffers:[!1],creationFlags:[0]},sizeIsPercentage:this.layer._options.mainTextureFixedSize?!1:p.sizeIsPercentage},i=this._frameGraph.textureManager.createRenderTargetTexture(`${this.name} Color`,t)}const s={size:e,options:ai.CloneTextureOptions(t.options),sizeIsPercentage:t.sizeIsPercentage};s.options.formats[0]=14;const r=this._frameGraph.textureManager.createRenderTargetTexture(`${this.name} Depth`,s);this._clearLayerTextures.targetTexture=i,this._clearLayerTextures.depthTexture=r,this._clearLayerTextures.color=this.layer.neutralColor,this._clearLayerTextures.clearDepth=!0;const n=this._clearLayerTextures.record();this._objectRendererForLayer.targetTexture=this._clearLayerTextures.outputTexture,this._objectRendererForLayer.depthTexture=this._clearLayerTextures.outputDepthTexture,this._objectRendererForLayer.camera=this.objectRendererTask.camera,this._objectRendererForLayer.objectList=this.objectRendererTask.objectList,this._objectRendererForLayer.disableShadows=!0;const o=this._objectRendererForLayer.record();let h=0;this._engine.getCaps().textureHalfFloatRender?h=2:h=0,t.options.types[0]=h;const l=this.layer._options.blurTextureSizeRatio!==void 0?this.layer._options.blurTextureSizeRatio||.1:void 0;l!==void 0&&(e.width=Math.floor(e.width*l)||1,e.height=Math.floor(e.height*l)||1);const c=this._onBeforeBlurTask?.record(),u=[];for(let p=0;p>1,e.height=e.height>>1}const f=this._onAfterBlurTask?.record();this.objectRendererTask.objectRenderer.onBeforeRenderObservable.remove(this._onBeforeObservableObserver),this._onBeforeObservableObserver=this.objectRendererTask.objectRenderer.onBeforeRenderObservable.add(()=>{const p=this.layer.shouldRender();n.disabled=!p,o.disabled=!p,c&&(c.disabled=!p);for(let m=0;m{this.layer.shouldRender()&&this.layer.needStencil()&&this._engine.setStencilBuffer(!1)}),this.layer.bindTexturesForCompose=void 0,this._clearAfterRenderingGroupObserver();const d=this._frameGraph.addRenderPass(this.name);for(let p=0;p{this.layer.bindTexturesForCompose=m=>{for(let A=0;A0?A+1:""}`,this._blurY[A].outputTexture)},this.layer._options.renderingGroupId!==-1&&(this._onAfterRenderingGroupObserver=this._scene.onAfterRenderingGroupObservable.add(m=>{!this.layer.shouldRender()||m.renderingGroupId!==this.layer._options.renderingGroupId||m.renderingManager!==this.objectRendererTask.objectRenderer.renderingManager||(this._objectRendererForLayer.objectList=this.objectRendererTask.objectList,p.saveDepthStates(),p.setDepthStates(!1,!1),p._applyRenderTarget(),this.layer.compose(),p.restoreDepthStates())}))}),d.setExecuteFunc(p=>{p.setTextureSamplingMode(this._blurY[this._blurY.length-1].targetTexture,2),this.layer._options.renderingGroupId===-1&&this.layer.shouldRender()&&(this._objectRendererForLayer.objectList=this.objectRendererTask.objectList,p.setDepthStates(!1,!1),p._applyRenderTarget(),this.layer.compose())});const g=this._frameGraph.addRenderPass(this.name+"_disabled",!0);g.setRenderTarget(this.outputTexture),this._setRenderTargetDepth&&g.setRenderTargetDepth(this.objectRendererTask.depthTexture),g.setExecuteFunc(p=>{})}_clearAfterRenderingGroupObserver(){this._scene.onAfterRenderingGroupObservable.remove(this._onAfterRenderingGroupObserver),this._onAfterRenderingGroupObserver=null}dispose(){this._clearAfterRenderingGroupObserver(),this._clearLayerTextures.dispose(),this._objectRendererForLayer.dispose(),this._onBeforeBlurTask?.dispose(),this._onAfterBlurTask?.dispose(),this.layer.dispose();for(let e=0;e1?t=this.originalScene.activeCameras[this.originalScene.activeCameras.length-1]:t=this.originalScene.activeCamera,e&&t&&t.isRigCamera?t.rigParent:t}}setRenderCamera(e){this._renderCamera=e}_getSharedGizmoLight(){return this._sharedGizmoLight||(this._sharedGizmoLight=new Ss("shared gizmo light",new _(0,1,0),this.utilityLayerScene),this._sharedGizmoLight.intensity=2,this._sharedGizmoLight.groundColor=q.Gray()),this._sharedGizmoLight}static get DefaultUtilityLayer(){return ht._DefaultUtilityLayer==null?ht._CreateDefaultUtilityLayerFromScene(Te.LastCreatedScene):ht._DefaultUtilityLayer}static _CreateDefaultUtilityLayerFromScene(e){return ht._DefaultUtilityLayer=new ht(e),ht._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce(()=>{ht._DefaultUtilityLayer=null}),ht._DefaultUtilityLayer}static get DefaultKeepDepthUtilityLayer(){return ht._DefaultKeepDepthUtilityLayer==null&&(ht._DefaultKeepDepthUtilityLayer=new ht(Te.LastCreatedScene),ht._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,ht._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce(()=>{ht._DefaultKeepDepthUtilityLayer=null})),ht._DefaultKeepDepthUtilityLayer}constructor(e,t=!0,i=!1){this.originalScene=e,this.handleEvents=t,this._pointerCaptures={},this._lastPointerEvents={},this._sharedGizmoLight=null,this._renderCamera=null,this.pickUtilitySceneFirst=!0,this.shouldRender=!0,this.onlyCheckPointerDownEvents=!0,this.processAllEvents=!1,this.pickingEnabled=!0,this.onPointerOutObservable=new O,this.utilityLayerScene=new tt(e.getEngine(),{virtual:!0,useFloatingOrigin:e.floatingOriginMode}),this.utilityLayerScene.useRightHandedSystem=e.useRightHandedSystem,this.utilityLayerScene._allowPostProcessClearColor=!1,this.utilityLayerScene.postProcessesEnabled=!1,this.utilityLayerScene.detachControl(),t&&(this._originalPointerObserver=e.onPrePointerObservable.add(s=>{if(!this.utilityLayerScene.activeCamera||!this.pickingEnabled||!this.processAllEvents&&s.type!==te.POINTERMOVE&&s.type!==te.POINTERUP&&s.type!==te.POINTERDOWN&&s.type!==te.POINTERDOUBLETAP)return;this.utilityLayerScene.pointerX=e.pointerX,this.utilityLayerScene.pointerY=e.pointerY;const r=s.event;if(e.isPointerCaptured(r.pointerId)){this._pointerCaptures[r.pointerId]=!1;return}const n=h=>{let l=null;if(s.nearInteractionPickingInfo)s.nearInteractionPickingInfo.pickedMesh.getScene()==h?l=s.nearInteractionPickingInfo:l=new ms;else if(h!==this.utilityLayerScene&&s.originalPickingInfo)l=s.originalPickingInfo;else{let c=null;this._renderCamera&&(c=h._activeCamera,h._activeCamera=this._renderCamera,s.ray=null),l=s.ray?h.pickWithRay(s.ray):h.pick(e.pointerX,e.pointerY),c&&(h._activeCamera=c)}return l},o=n(this.utilityLayerScene);if(!s.ray&&o&&(s.ray=o.ray),s.originalPickingInfo?.aimTransform&&o&&(o.aimTransform=s.originalPickingInfo.aimTransform,o.gripTransform=s.originalPickingInfo.gripTransform),this.utilityLayerScene.onPrePointerObservable.notifyObservers(s),this.onlyCheckPointerDownEvents&&s.type!=te.POINTERDOWN){s.skipOnPointerObservable||this.utilityLayerScene.onPointerObservable.notifyObservers(new kt(s.type,s.event,o),s.type),s.type===te.POINTERUP&&this._pointerCaptures[r.pointerId]&&(this._pointerCaptures[r.pointerId]=!1);return}if(this.utilityLayerScene.autoClearDepthAndStencil||this.pickUtilitySceneFirst)o&&o.hit&&(s.skipOnPointerObservable||this.utilityLayerScene.onPointerObservable.notifyObservers(new kt(s.type,s.event,o),s.type),s.skipOnPointerObservable=!0);else{const h=n(e),l=s.event;h&&o&&(o.distance===0&&h.pickedMesh?this.mainSceneTrackerPredicate&&this.mainSceneTrackerPredicate(h.pickedMesh)?(this._notifyObservers(s,h,l),s.skipOnPointerObservable=!0):s.type===te.POINTERDOWN?(this._pointerCaptures[l.pointerId]=!0,this._notifyObservers(s,h,l)):(s.type===te.POINTERMOVE||s.type===te.POINTERUP)&&(this._lastPointerEvents[l.pointerId]&&(this.onPointerOutObservable.notifyObservers(l.pointerId),delete this._lastPointerEvents[l.pointerId]),this._notifyObservers(s,h,l)):!this._pointerCaptures[l.pointerId]&&(o.distance0)):!this._pointerCaptures[l.pointerId]&&o.distance>=h.distance&&(this.mainSceneTrackerPredicate&&this.mainSceneTrackerPredicate(h.pickedMesh)?(this._notifyObservers(s,h,l),s.skipOnPointerObservable=!0):((s.type===te.POINTERMOVE||s.type===te.POINTERUP)&&this._lastPointerEvents[l.pointerId]&&(this.onPointerOutObservable.notifyObservers(l.pointerId),delete this._lastPointerEvents[l.pointerId]),this._notifyObservers(s,o,l))),s.type===te.POINTERUP&&this._pointerCaptures[l.pointerId]&&(this._pointerCaptures[l.pointerId]=!1))}}),this._originalPointerObserver&&e.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver)),this.utilityLayerScene.autoClear=!1,i||(this._afterRenderObserver=this.originalScene.onAfterRenderCameraObservable.add(s=>{this.shouldRender&&s==this.getRenderCamera()&&this.render()})),this._sceneDisposeObserver=this.originalScene.onDisposeObservable.add(()=>{this.dispose()}),this._updateCamera()}_notifyObservers(e,t,i){e.skipOnPointerObservable||(this.utilityLayerScene.onPointerObservable.notifyObservers(new kt(e.type,e.event,t),e.type),this._lastPointerEvents[i.pointerId]=!0)}render(){if(this._updateCamera(),this.utilityLayerScene.activeCamera){const e=this.utilityLayerScene.activeCamera.getScene(),t=this.utilityLayerScene.activeCamera;t._scene=this.utilityLayerScene,t.leftCamera&&(t.leftCamera._scene=this.utilityLayerScene),t.rightCamera&&(t.rightCamera._scene=this.utilityLayerScene),this.utilityLayerScene.render(!1),t._scene=e,t.leftCamera&&(t.leftCamera._scene=e),t.rightCamera&&(t.rightCamera._scene=e)}}dispose(){this.onPointerOutObservable.clear(),this._afterRenderObserver&&this.originalScene.onAfterCameraRenderObservable.remove(this._afterRenderObserver),this._sceneDisposeObserver&&this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver),this._originalPointerObserver&&this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver),this.utilityLayerScene.dispose()}_updateCamera(){this.utilityLayerScene.cameraToUseForPointers=this.getRenderCamera(),this.utilityLayerScene.activeCamera=this.getRenderCamera()}}ht._DefaultUtilityLayer=null;ht._DefaultKeepDepthUtilityLayer=null;class Qd extends or{get camera(){return this._camera}set camera(e){this._camera=e,this.layer.setRenderCamera(e),this.layer.utilityLayerScene.activeCamera=e}constructor(e,t,i,s=!0){super(e,t),this.layer=new ht(i,s,!0),this.layer.utilityLayerScene._useCurrentFrameBuffer=!0,this.outputTexture=this._frameGraph.textureManager.createDanglingHandle()}getClassName(){return"FrameGraphUtilityLayerRendererTask"}record(){if(!this.targetTexture||!this.camera)throw new Error(`FrameGraphUtilityLayerRendererTask "${this.name}": targetTexture and camera are required`);this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture,this.targetTexture);const e=this._frameGraph.addRenderPass(this.name);e.setRenderTarget(this.outputTexture),e.setExecuteFunc(i=>{i.render(this.layer)});const t=this._frameGraph.addRenderPass(this.name+"_disabled",!0);t.setRenderTarget(this.outputTexture),t.setExecuteFunc(i=>{})}dispose(){this.layer.dispose(),super.dispose()}}function Zd(a){const e=Wn.FindMainObjectRenderer(a);if(e)return e.camera;const t=a.tasks;for(let i=t.length-1;i>=0;i--){const s=t[i];if(s instanceof Qd)return s.camera}return null}function $d(a){const e=a.getTasksByType(Zh);let t=null;for(let i=e.length-1;i>=0;--i){const s=e[i].objectList.meshes;if(e[i].isMainObjectRenderer)return e[i];(!s||s.length>0)&&!t&&(t=e[i])}return t}function Jd(a,e=!0){const t=a.scene,i=new ht(t,e,!0);i.utilityLayerScene.activeCamera=t.activeCamera;let s=Wn.FindMainCamera(t.frameGraph);!s&&t.cameras.length>0&&(s=t.cameras[0]),s&&(i.setRenderCamera(s),i.utilityLayerScene.activeCamera=s);const r=t.onAfterRenderObservable.add(()=>{i.render()});return i.utilityLayerScene.onDisposeObservable.addOnce(()=>{t.onAfterRenderObservable.remove(r)}),i}const Wn={FindMainCamera:Zd,FindMainObjectRenderer:$d,CreateUtilityLayerRenderer:Jd};class ef{constructor(e,t){this._disableRenderingRefCount=0,this._currentPerformancePriorityMode=0,this._isEnabling=!1,this._enableCancelFunctions=new Map,this._disableCancelFunctions=new Map,this.showDebugLogs=!1,this._scene=e,this._engine=e.getEngine(),this._engine.isWebGPU&&(this._options={morphTargetsNumMaxInfluences:20,...t},this._engine.snapshotRenderingMode=1,this.fixMeshes(),this._onResizeObserver=this._engine.onResizeObservable.add(()=>{this._log("onResize","start"),this._fastSnapshotRenderingEnabled?(this.disableSnapshotRendering(),this.enableSnapshotRendering()):this._isEnabling&&(this._enableCancelFunctions.forEach(i=>i()),this._enableCancelFunctions.clear(),this._disableRenderingRefCount++,this.enableSnapshotRendering()),this._log("onResize","end")}),this._scene.onBeforeRenderObservable.add(()=>{if(!this._fastSnapshotRenderingEnabled)return;for(const s of e.skeletons)s.prepare(!0);for(const s of e.meshes)if(s.infiniteDistance&&s.transferToEffect(s.computeWorldMatrix(!0)),s.skeleton&&s.transferToEffect(s.computeWorldMatrix(!0)),s.getClassName()==="GaussianSplattingMesh"&&s._postToWorker(),s.morphTargetManager&&s.subMeshes)for(const r of s.subMeshes){const n=r._drawWrapper,o=n.effect;if(o){const h=n.drawContext.buffers.LeftOver,l=o._pipelineContext?.uniformBuffer;h&&l&&l.setDataBuffer(h)&&(s.morphTargetManager._bind(o),eh(s,o),l.update())}}let i=e.activeCamera;if(e.frameGraph&&(i=Wn.FindMainCamera(e.frameGraph)||i),e.spriteManagers&&i)for(const s of e.spriteManagers){const n=s.spriteRenderer;this._spriteRendererUpdateEffects(n._drawWrapperBase,n._drawWrapperDepth,i)}}))}get isReady(){return!this._isEnabling}enableSnapshotRendering(){if(!this._engine.isWebGPU||--this._disableRenderingRefCount>0)return;this._log("enableSnapshotRendering","called"),this._disableCancelFunctions.size>0&&this._log("enableSnapshotRendering",`cancelling ${this._disableCancelFunctions.size} "disable" callbacks`),this._disableCancelFunctions.forEach(t=>t()),this._disableCancelFunctions.clear(),this._isEnabling=!0,this._disableRenderingRefCount=0,this._currentPerformancePriorityMode=this._pendingCurrentPerformancePriorityMode??this._scene.performancePriority,this._pendingCurrentPerformancePriorityMode=void 0,this._scene.performancePriority=0;const e=()=>{this._enableCancelFunctions.delete(e);const t=this._engine.frameId+2;this._log("enableSnapshotRendering",`scene ready, add callbacks for frames ${t} and ${t+1}`),this._executeAtFrame(t,()=>{this._log("enableSnapshotRendering","callback #1, enable snapshot rendering at the engine level"),this._engine.snapshotRendering=!0}),this._executeAtFrame(t+1,()=>{this._log("enableSnapshotRendering","callback #2, signals that snapshot rendering helper is ready"),this._isEnabling=!1})};this._enableCancelFunctions.set(e,()=>this._scene.onReadyObservable.removeCallback(e)),this._scene.executeWhenReady(e)}disableSnapshotRendering(){if(this._engine.isWebGPU){if(this._log("disableSnapshotRendering","called"),this._disableRenderingRefCount===0&&(this._enableCancelFunctions.size>0&&this._log("disableSnapshotRendering",`cancelling ${this._enableCancelFunctions.size} "enable" callbacks`),this._enableCancelFunctions.forEach(e=>e()),this._enableCancelFunctions.clear(),this._isEnabling=!1,this._scene.performancePriority=0,this._currentPerformancePriorityMode!==0)){this._log("disableSnapshotRendering",`makes sure that the scene is rendered once in BackwardCompatible mode (code: 0) before switching to mode ${this._currentPerformancePriorityMode}`),this._pendingCurrentPerformancePriorityMode=this._currentPerformancePriorityMode;const e=()=>{this._log("disableSnapshotRendering",`scene ready, add callback for frame ${this._engine.frameId+2}`),this._executeAtFrame(this._engine.frameId+2,()=>{this._log("disableSnapshotRendering",`switching to performance priority mode ${this._pendingCurrentPerformancePriorityMode}`),this._scene.performancePriority=this._pendingCurrentPerformancePriorityMode,this._pendingCurrentPerformancePriorityMode=void 0},"whenDisabled")};this._disableCancelFunctions.set(e,()=>this._scene.onReadyObservable.removeCallback(e)),this._scene.executeWhenReady(e)}this._engine.snapshotRendering=!1,this._disableRenderingRefCount++}}fixMeshes(e){if(this._engine.isWebGPU){e=e||this._scene.meshes;for(const t of e)t.ignoreCameraMaxZ=!1,t.morphTargetManager&&(t.morphTargetManager.numMaxInfluencers=Math.min(t.morphTargetManager.numTargets,this._options.morphTargetsNumMaxInfluences))}}updateMesh(e,t=!0){if(this._fastSnapshotRenderingEnabled){if(Array.isArray(e)){for(const i of e)(!t||!this._updateInstancedMesh(i))&&i.transferToEffect(i.computeWorldMatrix());return}(!t||!this._updateInstancedMesh(e))&&e.transferToEffect(e.computeWorldMatrix())}}_updateInstancedMesh(e){if(e.hasInstances){if(e.subMeshes){const t=e;for(const i of t.subMeshes){const s=t._getInstancesRenderList(i._id);t._updateInstancedBuffers(i,s,s.parent.instancesBufferSize,this._engine)}}return!0}else if(e.isAnInstance)return!0;return!1}updateMeshesForEffectLayer(e,t=!0){if(!this._engine.isWebGPU)return;const i=e instanceof jd?e.objectRendererForLayer.objectRenderer.renderPassId:e.mainTexture.renderPassId;t?this._onBeforeRenderObserverUpdateLayer=this._scene.onBeforeRenderObservable.add(()=>{this._updateMeshMatricesForRenderPassId(i)}):this._updateMeshMatricesForRenderPassId(i)}dispose(){this._engine.isWebGPU&&(this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserverUpdateLayer),this._engine.onResizeObservable.remove(this._onResizeObserver))}get _fastSnapshotRenderingEnabled(){return this._engine.snapshotRendering&&this._engine.snapshotRenderingMode===1}_updateMeshMatricesForRenderPassId(e){if(!this._fastSnapshotRenderingEnabled)return;const t=this._scene.objectRenderers.find(i=>i.renderPassId===e)?.activeCamera?.getTransformationMatrix()??this._scene.getTransformMatrix();for(let i=0;i{this._engine.frameId>=e&&(this._engine.onEndFrameObservable.remove(r),i==="whenEnabled"?this._enableCancelFunctions.delete(s):this._disableCancelFunctions.delete(s),t())},r=this._engine.onEndFrameObservable.add(s);i==="whenEnabled"?this._enableCancelFunctions.set(s,()=>this._engine.onEndFrameObservable.remove(r)):this._disableCancelFunctions.set(s,()=>this._engine.onEndFrameObservable.remove(r))}_log(e,t){this.showDebugLogs&&w.Log(`[Frame: ${this._engine.frameId}] SnapshotRenderingHelper:${e} - ${t}`)}}function tf(a){const e=a.split("?")[0],t=e.lastIndexOf(".");return t>-1?e.substring(t).toLowerCase():""}const qa={name:"bvh",extensions:{".bvh":{isBinary:!1}}},gr="Z2xURg",ja={name:"gltf",extensions:{".gltf":{isBinary:!1,mimeType:"model/gltf+json"},".glb":{isBinary:!0,mimeType:"model/gltf-binary"}},canDirectLoad(a){return a.indexOf("asset")!==-1&&a.indexOf("version")!==-1||a.startsWith("data:base64,"+gr)||a.startsWith("data:;base64,"+gr)||a.startsWith("data:application/octet-stream;base64,"+gr)||a.startsWith("data:model/gltf-binary;base64,"+gr)}},Qa={name:"obj",extensions:".obj"},Za={name:"splat",extensions:{".splat":{isBinary:!0},".ply":{isBinary:!0},".spz":{isBinary:!0},".json":{isBinary:!1},".sog":{isBinary:!0}}},sf={name:"stl",extensions:{".stl":{isBinary:!0}}},Xn=new Map,P_=Xn;function ye(a,e,t){rf(a)&&w.Warn(`Extension with the name '${a}' already exists`),Xn.set(a,{isGLTFExtension:e,factory:t})}function rf(a){return Xn.delete(a)}function nf(){ye("EXT_lights_image_based",!0,async a=>{const{EXT_lights_image_based:e}=await G(async()=>{const{EXT_lights_image_based:t}=await import("./EXT_lights_image_based-BkkYWPdh.js");return{EXT_lights_image_based:t}},__vite__mapDeps([110,47,13,14,40,111,42,112,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("EXT_mesh_gpu_instancing",!0,async a=>{const{EXT_mesh_gpu_instancing:e}=await G(async()=>{const{EXT_mesh_gpu_instancing:t}=await import("./EXT_mesh_gpu_instancing-Dk4bl8lI.js");return{EXT_mesh_gpu_instancing:t}},__vite__mapDeps([118,112,13,14,113,114,115,116,117,119]),import.meta.url);return new e(a)}),ye("EXT_meshopt_compression",!0,async a=>{const{EXT_meshopt_compression:e}=await G(async()=>{const{EXT_meshopt_compression:t}=await import("./EXT_meshopt_compression-C80C3Ae6.js");return{EXT_meshopt_compression:t}},__vite__mapDeps([120,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("EXT_texture_avif",!0,async a=>{const{EXT_texture_avif:e}=await G(async()=>{const{EXT_texture_avif:t}=await import("./EXT_texture_avif-D-6Hx_6U.js");return{EXT_texture_avif:t}},__vite__mapDeps([121,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("EXT_texture_webp",!0,async a=>{const{EXT_texture_webp:e}=await G(async()=>{const{EXT_texture_webp:t}=await import("./EXT_texture_webp-ARKFdfJg.js");return{EXT_texture_webp:t}},__vite__mapDeps([122,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("ExtrasAsMetadata",!1,async a=>{const{ExtrasAsMetadata:e}=await G(async()=>{const{ExtrasAsMetadata:t}=await import("./ExtrasAsMetadata-Bw6ELUiM.js");return{ExtrasAsMetadata:t}},__vite__mapDeps([123,13,14]),import.meta.url);return new e(a)}),ye("KHR_animation_pointer",!0,async a=>{const{KHR_animation_pointer:e}=await G(async()=>{const{KHR_animation_pointer:t}=await import("./KHR_animation_pointer-_r4j3nDo.js");return{KHR_animation_pointer:t}},__vite__mapDeps([124,117,125,13,14]),import.meta.url);return new e(a)}),ye("KHR_draco_mesh_compression",!0,async a=>{const{KHR_draco_mesh_compression:e}=await G(async()=>{const{KHR_draco_mesh_compression:t}=await import("./KHR_draco_mesh_compression-CsW9PsVH.js");return{KHR_draco_mesh_compression:t}},__vite__mapDeps([126,51,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_interactivity",!0,async a=>{const{KHR_interactivity:e}=await G(async()=>{const{KHR_interactivity:t}=await import("./KHR_interactivity-BtMudStn.js").then(i=>i.K);return{KHR_interactivity:t}},__vite__mapDeps([127,13,14,128,117]),import.meta.url);return new e(a)}),ye("KHR_lights_punctual",!0,async a=>{const{KHR_lights:e}=await G(async()=>{const{KHR_lights:t}=await import("./KHR_lights_punctual-BAbq2qYj.js");return{KHR_lights:t}},__vite__mapDeps([129,117,112,13,14,113,114,115,116]),import.meta.url);return new e(a)}),ye("EXT_lights_area",!0,async a=>{const{EXT_lights_area:e}=await G(async()=>{const{EXT_lights_area:t}=await import("./EXT_lights_area-CaG6NvhR.js");return{EXT_lights_area:t}},__vite__mapDeps([130,115,112,13,14,113,114,116,117]),import.meta.url);return new e(a)}),ye("EXT_lights_ies",!0,async a=>{const{EXT_lights_ies:e}=await G(async()=>{const{EXT_lights_ies:t}=await import("./EXT_lights_ies-uJl7poYh.js");return{EXT_lights_ies:t}},__vite__mapDeps([131,117,112,13,14,113,114,115,116]),import.meta.url);return new e(a)}),ye("KHR_materials_anisotropy",!0,async a=>{const{KHR_materials_anisotropy:e}=await G(async()=>{const{KHR_materials_anisotropy:t}=await import("./KHR_materials_anisotropy-Dittpx8X.js");return{KHR_materials_anisotropy:t}},__vite__mapDeps([132,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_clearcoat",!0,async a=>{const{KHR_materials_clearcoat:e}=await G(async()=>{const{KHR_materials_clearcoat:t}=await import("./KHR_materials_clearcoat-DS70653e.js");return{KHR_materials_clearcoat:t}},__vite__mapDeps([133,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_diffuse_roughness",!0,async a=>{const{KHR_materials_diffuse_roughness:e}=await G(async()=>{const{KHR_materials_diffuse_roughness:t}=await import("./KHR_materials_diffuse_roughness-BbnIWM_S.js");return{KHR_materials_diffuse_roughness:t}},__vite__mapDeps([134,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_diffuse_transmission",!0,async a=>{const{KHR_materials_diffuse_transmission:e}=await G(async()=>{const{KHR_materials_diffuse_transmission:t}=await import("./KHR_materials_diffuse_transmission-DS01W3tb.js");return{KHR_materials_diffuse_transmission:t}},__vite__mapDeps([135,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_dispersion",!0,async a=>{const{KHR_materials_dispersion:e}=await G(async()=>{const{KHR_materials_dispersion:t}=await import("./KHR_materials_dispersion-DpxfNQCn.js");return{KHR_materials_dispersion:t}},__vite__mapDeps([136,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_emissive_strength",!0,async a=>{const{KHR_materials_emissive_strength:e}=await G(async()=>{const{KHR_materials_emissive_strength:t}=await import("./KHR_materials_emissive_strength-BqChGRqL.js");return{KHR_materials_emissive_strength:t}},__vite__mapDeps([137,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_ior",!0,async a=>{const{KHR_materials_ior:e}=await G(async()=>{const{KHR_materials_ior:t}=await import("./KHR_materials_ior-BE6_deSQ.js");return{KHR_materials_ior:t}},__vite__mapDeps([138,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_iridescence",!0,async a=>{const{KHR_materials_iridescence:e}=await G(async()=>{const{KHR_materials_iridescence:t}=await import("./KHR_materials_iridescence-ezzlpHRh.js");return{KHR_materials_iridescence:t}},__vite__mapDeps([139,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_pbrSpecularGlossiness",!0,async a=>{const{KHR_materials_pbrSpecularGlossiness:e}=await G(async()=>{const{KHR_materials_pbrSpecularGlossiness:t}=await import("./KHR_materials_pbrSpecularGlossiness-Cf_AZprx.js");return{KHR_materials_pbrSpecularGlossiness:t}},__vite__mapDeps([140,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_sheen",!0,async a=>{const{KHR_materials_sheen:e}=await G(async()=>{const{KHR_materials_sheen:t}=await import("./KHR_materials_sheen-BCArul3M.js");return{KHR_materials_sheen:t}},__vite__mapDeps([141,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_specular",!0,async a=>{const{KHR_materials_specular:e}=await G(async()=>{const{KHR_materials_specular:t}=await import("./KHR_materials_specular-Dr1ARbmK.js");return{KHR_materials_specular:t}},__vite__mapDeps([142,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_transmission",!0,async a=>{const{KHR_materials_transmission:e}=await G(async()=>{const{KHR_materials_transmission:t}=await import("./KHR_materials_transmission-4IzmwuFj.js");return{KHR_materials_transmission:t}},__vite__mapDeps([143,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_unlit",!0,async a=>{const{KHR_materials_unlit:e}=await G(async()=>{const{KHR_materials_unlit:t}=await import("./KHR_materials_unlit-DM_zxK5v.js");return{KHR_materials_unlit:t}},__vite__mapDeps([144,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_variants",!0,async a=>{const{KHR_materials_variants:e}=await G(async()=>{const{KHR_materials_variants:t}=await import("./KHR_materials_variants-BwQ4yKQI.js");return{KHR_materials_variants:t}},__vite__mapDeps([145,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_materials_volume",!0,async a=>{const{KHR_materials_volume:e}=await G(async()=>{const{KHR_materials_volume:t}=await import("./KHR_materials_volume-BJpG2B3c.js");return{KHR_materials_volume:t}},__vite__mapDeps([146,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_mesh_quantization",!0,async a=>{const{KHR_mesh_quantization:e}=await G(async()=>{const{KHR_mesh_quantization:t}=await import("./KHR_mesh_quantization-CvyzOSoH.js");return{KHR_mesh_quantization:t}},__vite__mapDeps([147,13,14]),import.meta.url);return new e(a)}),ye("KHR_texture_basisu",!0,async a=>{const{KHR_texture_basisu:e}=await G(async()=>{const{KHR_texture_basisu:t}=await import("./KHR_texture_basisu-iW9bNKGX.js");return{KHR_texture_basisu:t}},__vite__mapDeps([148,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_texture_transform",!0,async a=>{const{KHR_texture_transform:e}=await G(async()=>{const{KHR_texture_transform:t}=await import("./KHR_texture_transform-DDUX66hd.js");return{KHR_texture_transform:t}},__vite__mapDeps([149,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_xmp_json_ld",!0,async a=>{const{KHR_xmp_json_ld:e}=await G(async()=>{const{KHR_xmp_json_ld:t}=await import("./KHR_xmp_json_ld-DX3w5iqB.js");return{KHR_xmp_json_ld:t}},__vite__mapDeps([150,13,14]),import.meta.url);return new e(a)}),ye("MSFT_audio_emitter",!0,async a=>{const{MSFT_audio_emitter:e}=await G(async()=>{const{MSFT_audio_emitter:t}=await import("./MSFT_audio_emitter-C84vLoK2.js");return{MSFT_audio_emitter:t}},__vite__mapDeps([151,152,153,154,13,14,155,156,157,158,159,112,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("MSFT_lod",!0,async a=>{const{MSFT_lod:e}=await G(async()=>{const{MSFT_lod:t}=await import("./MSFT_lod-CdNjehaf.js");return{MSFT_lod:t}},__vite__mapDeps([160,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("MSFT_minecraftMesh",!0,async a=>{const{MSFT_minecraftMesh:e}=await G(async()=>{const{MSFT_minecraftMesh:t}=await import("./MSFT_minecraftMesh-B8XzSlpi.js");return{MSFT_minecraftMesh:t}},__vite__mapDeps([161,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("MSFT_sRGBFactors",!0,async a=>{const{MSFT_sRGBFactors:e}=await G(async()=>{const{MSFT_sRGBFactors:t}=await import("./MSFT_sRGBFactors-DIaDjzzZ.js");return{MSFT_sRGBFactors:t}},__vite__mapDeps([162,112,13,14,113,114,115,116,117]),import.meta.url);return new e(a)}),ye("KHR_node_visibility",!0,async a=>{const{KHR_node_visibility:e}=await G(async()=>{const{KHR_node_visibility:t}=await import("./KHR_node_visibility-D952nLJv.js");return{KHR_node_visibility:t}},__vite__mapDeps([163,117,13,14]),import.meta.url);return new e(a)}),ye("KHR_node_hoverability",!0,async a=>{const{KHR_node_hoverability:e}=await G(async()=>{const{KHR_node_hoverability:t}=await import("./KHR_node_hoverability-bcsnWtSP.js");return{KHR_node_hoverability:t}},__vite__mapDeps([164,128,117,13,14]),import.meta.url);return new e(a)}),ye("KHR_node_selectability",!0,async a=>{const{KHR_node_selectability:e}=await G(async()=>{const{KHR_node_selectability:t}=await import("./KHR_node_selectability-C9CKUBKq.js");return{KHR_node_selectability:t}},__vite__mapDeps([165,128,117,13,14]),import.meta.url);return new e(a)})}function af(){Ps({...qa,createPlugin:async a=>{const{BVHFileLoader:e}=await G(async()=>{const{BVHFileLoader:t}=await import("./bvhFileLoader-DyExPWsV.js");return{BVHFileLoader:t}},__vite__mapDeps([166,116,113,114,115,13,14]),import.meta.url);return new e(a[qa.name])}}),Ps({...ja,createPlugin:async a=>{const{GLTFFileLoader:e}=await G(async()=>{const{GLTFFileLoader:t}=await import("./glTFLoader-Bp7IfGPK.js");return{GLTFFileLoader:t}},__vite__mapDeps([112,13,14,113,114,115,116,117]),import.meta.url);return new e(a[ja.name])}}),nf(),Ps({...Qa,createPlugin:async a=>{const{OBJFileLoader:e}=await G(async()=>{const{OBJFileLoader:t}=await import("./objFileLoader-B25jxNQb.js");return{OBJFileLoader:t}},__vite__mapDeps([167,116,168,13,14]),import.meta.url);return new e(a[Qa.name])}}),Ps({...Za,createPlugin:async a=>{const{SPLATFileLoader:e}=await G(async()=>{const{SPLATFileLoader:t}=await import("./splatFileLoader-DWVxOgqv.js");return{SPLATFileLoader:t}},__vite__mapDeps([169,13,14,170,37,31,38,24,83,28,29,25,19,10,20,2,64,3,7,8,115,119,116,171,168]),import.meta.url);return new e(a[Za.name])}}),Ps({...sf,createPlugin:async()=>{const{STLFileLoader:a}=await G(async()=>{const{STLFileLoader:e}=await import("./stlFileLoader-TUWjk2So.js");return{STLFileLoader:e}},__vite__mapDeps([172,116,168,13,14]),import.meta.url);return new a}})}const of=new Kd(()=>Promise.all([G(()=>import("./ssao2RenderingPipeline-f26SouVj.js"),__vite__mapDeps([173,174,175,13,14,37,93,25,26,88,27,24,28,89,176,115]),import.meta.url),G(()=>import("./prePassRendererSceneComponent-DTI6ZAyl.js"),__vite__mapDeps([177,13,14,175,37,93,25,26,88,27,24,28,89]),import.meta.url),G(()=>import("./geometryBufferRendererSceneComponent-BF80mcVG.js"),__vite__mapDeps([178,175,13,14,37,93,25,26,88,27,24,28,89]),import.meta.url),G(()=>Promise.resolve().then(()=>jh),void 0,import.meta.url),G(()=>import("./engine.multiRender-DvoXejHB.js"),__vite__mapDeps([179,180,5,12,6,3,181,64,2,79,154,13,14]),import.meta.url)])),hf=["none","normal","high"],lf=["none","standard","aces","neutral"];function Jh(a){return lf.includes(a)}function cf(a){return hf.includes(a)}function cn(...a){for(const e of a)e?.throwIfAborted()}async function $a(a,e,t){t=t??tf(a);const i=await(async()=>{if(t===".hdr"){const{HDRCubeTexture:r}=await G(async()=>{const{HDRCubeTexture:n}=await import("./hdrCubeTexture-CWo-FOyr.js");return{HDRCubeTexture:n}},__vite__mapDeps([182,13,14,183,115,49]),import.meta.url);return()=>new r(a,e,256,!1,!0,!1,!0,void 0,void 0,void 0,!0,!0)}else{const{CubeTexture:r}=await G(async()=>{const{CubeTexture:n}=await import("./cubeTexture-BcGycaMd.js");return{CubeTexture:n}},__vite__mapDeps([111,42,13,14]),import.meta.url);return()=>new r(a,e,null,!1,null,null,null,void 0,!0,t,!0)}})(),s=e.useDelayedTextureLoading;try{return e.useDelayedTextureLoading=!1,i()}finally{e.useDelayedTextureLoading=s}}function uf(a,e,t,i){const s=a.blockMaterialDirtyMechanism;a.blockMaterialDirtyMechanism=!0;try{const r=Xh("hdrSkyBox",{sideOrientation:ne.BACKSIDE},a),n=new _e("skyBox",a);return n.imageProcessingConfiguration=new ue,n.reflectionTexture=t,t.coordinatesMode=z.SKYBOX_MODE,n.reflectionBlur=i,r.material=n,r.isPickable=!1,r.infiniteDistance=!0,r.applyFog=!1,el(r,e),r}finally{a.blockMaterialDirtyMechanism=s}}function el(a,e){a?.scaling.setAll((e.maxZ-e.minZ)/2)}function df(a){return a.flatMap(e=>Wd(e.assetContainer.meshes,e.assetContainer.animationGroups[e.selectedAnimation]))}function ff(a){if(a.length===0)return null;const e=new _(Math.min(...a.map(r=>r.minimum.x)),Math.min(...a.map(r=>r.minimum.y)),Math.min(...a.map(r=>r.minimum.z))),t=new _(Math.max(...a.map(r=>r.maximum.x)),Math.max(...a.map(r=>r.maximum.y)),Math.max(...a.map(r=>r.maximum.z))),i=t.subtract(e),s=e.add(i.scale(.5));return{extents:{min:e.asArray(),max:t.asArray()},size:i.asArray(),center:s.asArray()}}function _f(a){const s=a.clone();return s.y>0&&(s.y*=-1),s.y>-.01&&(s.y=Math.min(s.y*10,-.05)),s}function pr(a){const e=df(a);return ff(e)}function $t(a){(async()=>{try{await a}catch(e){e instanceof Ot||w.Error(e)}})()}async function tl(a,e){await G(()=>import("./ray-DFqjcUAE.js"),__vite__mapDeps([171,13,14]),import.meta.url);const t=a.assetContainer.scene,i=e.getForwardRay(100,e.getWorldMatrix(),e.globalPosition),s=e.globalPosition.clone();let r=1e-4;const n=_.Zero(),o=t.pickWithRay(i,f=>a.assetContainer.meshes.includes(f));if(o&&o.hit)n.copyFrom(o.pickedPoint);else{const f=a.getWorldBounds(),d=f?f.center:[0,0,0],g=_.FromArray(d),p=i.direction.clone();n.copyFrom(s),r=_.Distance(s,g),p.scaleAndAddToRef(r,n)}const h=_.Zero();s.subtractToRef(n,h),o&&o.hit&&(r=h.length());const l=Eh(h),c=Ah(h.y,r),u=n.asArray();return{type:"world",position:u,normal:u,cameraOrbit:[l,c,r]}}const Je={clearColor:[0,0,0,0],autoSuspendRendering:!0,environmentConfig:{intensity:1,blur:.3,rotation:0},environmentLighting:"auto",environmentSkybox:"none",cameraAutoOrbit:{enabled:!1,delay:2e3,speed:.05},animationAutoPlay:!1,animationSpeed:1,shadowConfig:{quality:"none"},postProcessing:{toneMapping:"neutral",contrast:1,exposure:1,ssao:"auto"},useRightHandedSystem:!1},gf={lighting:!0,skybox:!0};class Kn{constructor(){this.screenPosition=[NaN,NaN],this.worldPosition=[NaN,NaN,NaN],this.visibility=NaN}}class Yn{constructor(e,t){this._engine=e,this._options=t,this.showDebugLogs=!1,this.onEnvironmentChanged=new O,this.onEnvironmentConfigurationChanged=new O,this.onEnvironmentError=new O,this.onShadowsConfigurationChanged=new O,this.onPostProcessingChanged=new O,this.onModelChanged=new O,this.onModelError=new O,this.onLoadingProgressChanged=new O,this.onCameraAutoOrbitChanged=new O,this.onSelectedAnimationChanged=new O,this.onAnimationSpeedChanged=new O,this.onIsAnimationPlayingChanged=new O,this.onAnimationProgressChanged=new O,this.onSelectedMaterialVariantChanged=new O,this.onHotSpotsChanged=new O,this.onCamerasAsHotSpotsChanged=new O,this._renderedLastFrame=null,this._sceneOptimizer=null,this._tempVectors=xi(4,_.Zero),this._meshDataCache=new Map,this._renderLoopController=null,this._loadedModelsBacking=[],this._activeModelBacking=null,this._environmentSkyboxMode="none",this._environmentLightingMode="none",this._skybox=null,this._skyboxBlur=this._options?.environmentConfig?.blur??Je.environmentConfig.blur,this._skyboxTexture=null,this._reflectionTexture=null,this._reflectionsIntensity=this._options?.environmentConfig?.intensity??Je.environmentConfig.intensity,this._reflectionsRotation=this._options?.environmentConfig?.rotation??Je.environmentConfig.rotation,this._light=null,this._ssaoOption=this._options?.postProcessing?.ssao??Je.postProcessing.ssao,this._ssaoPipeline=null,this._autoSuspendRendering=this._options?.autoSuspendRendering??Je.autoSuspendRendering,this._sceneMutated=!1,this._suspendRenderCount=0,this._isDisposed=!1,this._loadModelLock=new Rr,this._loadModelAbortController=null,this._loadEnvironmentLock=new Rr,this._loadEnvironmentAbortController=null,this._camerasAsHotSpotsAbortController=null,this._updateShadowsLock=new Rr,this._shadowsAbortController=null,this._loadOperations=new Set,this._activeAnimationObservers=[],this._animationSpeed=this._options?.animationSpeed??Je.animationSpeed,this._camerasAsHotSpots=!1,this._hotSpots=this._options?.hotSpots??{},this._shadowQuality=this._options?.shadowConfig?.quality??Je.shadowConfig.quality,this._shadowState={},this._defaultHardwareScalingLevel=this._lastHardwareScalingLevel=this._engine.getHardwareScalingLevel();{const s=new tt(this._engine);s.useRightHandedSystem=this._options?.useRightHandedSystem??Je.useRightHandedSystem;const r=new j("default Material",s);r.albedoColor=new q(.4,.4,.4),r.metallic=0,r.roughness=1,r.baseDiffuseRoughness=1,r.microSurface=0,s.defaultMaterial=r,this._toneMappingEnabled=s.imageProcessingConfiguration.toneMappingEnabled,this._toneMappingType=s.imageProcessingConfiguration.toneMappingType,this._contrast=s.imageProcessingConfiguration.contrast,this._exposure=s.imageProcessingConfiguration.exposure,this._imageProcessingConfigurationObserver=s.imageProcessingConfiguration.onUpdateParameters.add(()=>{let o=!1;this._toneMappingEnabled!==s.imageProcessingConfiguration.toneMappingEnabled&&(this._toneMappingEnabled=s.imageProcessingConfiguration.toneMappingEnabled,o=!0),this._toneMappingType!==s.imageProcessingConfiguration.toneMappingType&&(this._toneMappingType=s.imageProcessingConfiguration.toneMappingType,o=!0),this._contrast!==s.imageProcessingConfiguration.contrast&&(this._contrast=s.imageProcessingConfiguration.contrast,o=!0),this._exposure!==s.imageProcessingConfiguration.exposure&&(this._exposure=s.imageProcessingConfiguration.exposure,o=!0),o&&this.onPostProcessingChanged.notifyObservers()});const n=new Ie("Viewer Default Camera",0,0,1,_.Zero(),s);n.useInputToRestoreState=!1,n.useAutoRotationBehavior=!0,n.onViewMatrixChangedObservable.add(()=>{this._markSceneMutated()}),s.onClearColorChangedObservable.add(()=>{this._markSceneMutated()}),s.onPointerObservable.add(async o=>{const h=await this._pick(o.event.offsetX,o.event.offsetY);if(h?.pickedPoint){const l=h.pickedPoint.subtract(n.position).dot(n.getForwardRay().direction);n.target=n.position.add(n.getForwardRay().direction.scale(l)),n.radius=l,n.interpolateTo(void 0,void 0,void 0,h.pickedPoint)}else this.resetCamera(!0)},te.POINTERDOUBLETAP),s.onNewCameraAddedObservable.add(o=>{this.camerasAsHotSpots&&$t(this._addCameraHotSpot(o,this._camerasAsHotSpotsAbortController?.signal))}),s.onCameraRemovedObservable.add(o=>{this._removeCameraHotSpot(o)}),this._scene=s,this._camera=n}this._scene.skipFrustumClipping=!0,this._scene.skipPointerDownPicking=!0,this._scene.skipPointerUpPicking=!0,this._scene.skipPointerMovePicking=!0,this._snapshotHelper=new ef(this._scene,{morphTargetsNumMaxInfluences:30}),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add(()=>{this._snapshotHelper.updateMesh(this._scene.meshes)}),this._camera.attachControl(),this._autoRotationBehavior=this._camera.getBehaviorByName("AutoRotation"),this._reset(!1,"camera"),$t(this.resetEnvironment()),this._beginRendering();const i=this;this._options?.onInitialized?.({scene:i._scene,camera:i._camera,get model(){return i._activeModel??null},suspendRendering:()=>this._suspendRendering(),markSceneMutated:()=>this._markSceneMutated(),pick:async(s,r)=>await this._pick(s,r)}),this._reset(!1,"source","environment","post-processing")}get cameraAutoOrbit(){return{enabled:this._camera.behaviors.includes(this._autoRotationBehavior),speed:this._autoRotationBehavior.idleRotationSpeed,delay:this._autoRotationBehavior.idleRotationWaitTime}}set cameraAutoOrbit(e){e.enabled!==void 0&&e.enabled!==this.cameraAutoOrbit.enabled&&(e.enabled?this._camera.addBehavior(this._autoRotationBehavior):this._camera.removeBehavior(this._autoRotationBehavior)),e.delay!==void 0&&(this._autoRotationBehavior.idleRotationWaitTime=e.delay),e.speed!==void 0&&(this._autoRotationBehavior.idleRotationSpeed=e.speed),this.onCameraAutoOrbitChanged.notifyObservers()}get environmentConfig(){return{intensity:this._reflectionsIntensity,blur:this._skyboxBlur,rotation:this._reflectionsRotation}}set environmentConfig(e){e.blur!==void 0&&this._changeSkyboxBlur(e.blur),e.intensity!==void 0&&(this._changeEnvironmentIntensity(e.intensity),this._changeShadowLightIntensity()),e.rotation!==void 0&&(this._changeEnvironmentRotation(e.rotation),this._rotateShadowLightWithEnvironment()),this.onEnvironmentConfigurationChanged.notifyObservers()}get shadowConfig(){return{quality:this._shadowQuality}}async updateShadows(e){e.quality&&this._shadowQuality!==e.quality&&(this._shadowQuality=e.quality,await this._updateShadows(),this.onShadowsConfigurationChanged.notifyObservers())}_changeSkyboxBlur(e){if(e!==this._skyboxBlur&&(this._skyboxBlur=e,this._skybox)){const t=this._skybox.material;t instanceof _e&&(this._snapshotHelper.disableSnapshotRendering(),t.reflectionBlur=this._skyboxBlur,this._snapshotHelper.enableSnapshotRendering(),this._markSceneMutated())}}_changeEnvironmentRotation(e){e!==this._reflectionsRotation&&(this._reflectionsRotation=e,this._snapshotHelper.disableSnapshotRendering(),this._skyboxTexture&&(this._skyboxTexture.rotationY=this._reflectionsRotation),this._reflectionTexture&&(this._reflectionTexture.rotationY=this._reflectionsRotation),this._snapshotHelper.enableSnapshotRendering(),this._markSceneMutated())}_changeEnvironmentIntensity(e){e!==this._reflectionsIntensity&&(this._reflectionsIntensity=e,this._snapshotHelper.disableSnapshotRendering(),this._skyboxTexture&&(this._skyboxTexture.level=this._reflectionsIntensity),this._reflectionTexture&&(this._reflectionTexture.level=this._reflectionsIntensity),this._snapshotHelper.enableSnapshotRendering(),this._markSceneMutated())}_updateAutoClear(){this._scene.autoClear=!0,this._markSceneMutated()}get postProcessing(){let e="none";if(this._toneMappingEnabled)switch(this._toneMappingType){case ue.TONEMAPPING_STANDARD:e="standard";break;case ue.TONEMAPPING_ACES:e="aces";break;case ue.TONEMAPPING_KHR_PBR_NEUTRAL:e="neutral";break}return{toneMapping:e,contrast:this._contrast,exposure:this._exposure,ssao:this._ssaoOption}}set postProcessing(e){if(this._snapshotHelper.disableSnapshotRendering(),e.toneMapping!==void 0)if(e.toneMapping==="none")this._scene.imageProcessingConfiguration.toneMappingEnabled=!1;else{switch(e.toneMapping){case"standard":this._scene.imageProcessingConfiguration.toneMappingType=ue.TONEMAPPING_STANDARD;break;case"aces":this._scene.imageProcessingConfiguration.toneMappingType=ue.TONEMAPPING_ACES;break;case"neutral":this._scene.imageProcessingConfiguration.toneMappingType=ue.TONEMAPPING_KHR_PBR_NEUTRAL;break}this._scene.imageProcessingConfiguration.toneMappingEnabled=!0}e.contrast!==void 0&&(this._scene.imageProcessingConfiguration.contrast=e.contrast),e.exposure!==void 0&&(this._scene.imageProcessingConfiguration.exposure=e.exposure),e.ssao&&this._ssaoOption!==e.ssao&&(this._ssaoOption=e.ssao,this._updateSSAOPipeline()),this._scene.imageProcessingConfiguration.isEnabled=this._toneMappingEnabled||this._contrast!==1||this._exposure!==1||this._ssaoPipeline!==null,this._snapshotHelper.enableSnapshotRendering(),this._markSceneMutated()}get loadingProgress(){if(this._loadOperations.size>0){let e=0;for(const t of this._loadOperations){if(t.progress==null)return!0;e+=t.progress}return e/this._loadOperations.size}return!1}get _loadedModels(){return this._loadedModelsBacking}get _activeModel(){return this._activeModelBacking}_setActiveModel(...e){const[t,i]=e;t!==this._activeModelBacking&&(this._activeModelBacking=t,this._updateLight(),$t(this._updateShadows()),this._updateSSAOPipeline(),this._applyAnimationSpeed(),this._selectAnimation(0,!1),this.onSelectedMaterialVariantChanged.notifyObservers(),this._reframeCamera(!0,t?[t]:void 0),this.onModelChanged.notifyObservers(i?.source??null))}async _enableSSAOPipeline(e){const t=this._loadedModels.length>0,i=this._loadedModels.some(s=>s.assetContainer.materials.length>0);if(e==="enabled"||e==="auto"&&t&&!i){const[{SSAO2RenderingPipeline:s}]=await of.value;this._ssaoPipeline||(this._scene.postProcessRenderPipelineManager.onNewPipelineAddedObservable.add(o=>{o.name==="ssao"&&this.onPostProcessingChanged.notifyObservers()}),this._scene.postProcessRenderPipelineManager.onPipelineRemovedObservable.add(o=>{o.name==="ssao"&&this.onPostProcessingChanged.notifyObservers()}));const r={ssaoRatio:1,blurRatio:1};this._ssaoPipeline=new s("ssao",this._scene,r);const n=this._getWorldBounds(this._loadedModels);if(this._ssaoPipeline&&n){const o=_.FromArray(n.size).length();this._ssaoPipeline.expensiveBlur=!0,this._ssaoPipeline.maxZ=o*2;const h=50;this._ssaoPipeline.radius=be(Ii(1,5,be((o-1)/h,0,1)),1,5),this._ssaoPipeline.totalStrength=be(Ii(.3,1,be((o-1)/h,0,1)),.3,1),this._ssaoPipeline.samples=Math.round(be(Ii(8,32,be((o-1)/h,0,1)),8,32))}this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline("ssao",this._camera)}}_disableSSAOPipeline(){this._ssaoPipeline&&(this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline("ssao",this._camera),this._scene.postProcessRenderPipelineManager.removePipeline("ssao"),this._ssaoPipeline?.dispose(),this._ssaoPipeline=null)}_updateSSAOPipeline(){!this._ssaoPipeline&&(this._ssaoOption==="auto"||this._ssaoOption==="enabled")?$t(this._enableSSAOPipeline(this._ssaoOption)):this._ssaoOption==="disabled"&&this._disableSSAOPipeline()}get animations(){return this._activeModel?.assetContainer.animationGroups.map(e=>e.name)??[]}get selectedAnimation(){return this._activeModel?.selectedAnimation??-1}set selectedAnimation(e){this._selectAnimation(e,this._loadOperations.size===0)}_selectAnimation(e,t=!0){e=Math.round(be(e,-1,this.animations.length-1)),this._activeModel&&e!==this._activeModel.selectedAnimation&&(this._activeAnimationObservers.forEach(i=>i.remove()),this._activeAnimationObservers=[],this._activeModel.selectedAnimation=e,this._activeAnimation&&(this._activeAnimationObservers=[this._activeAnimation.onAnimationGroupPlayObservable.add(()=>{this.onIsAnimationPlayingChanged.notifyObservers()}),this._activeAnimation.onAnimationGroupPauseObservable.add(()=>{this.onIsAnimationPlayingChanged.notifyObservers()}),this._activeAnimation.onAnimationGroupEndObservable.add(()=>{this.onIsAnimationPlayingChanged.notifyObservers(),this.onAnimationProgressChanged.notifyObservers()})],this._reframeCamera(t)),this.onSelectedAnimationChanged.notifyObservers(),this.onAnimationProgressChanged.notifyObservers())}get isAnimationPlaying(){return this._activeModelBacking?._animationPlaying()??!1}get animationSpeed(){return this._animationSpeed}set animationSpeed(e){this._animationSpeed=e,this._applyAnimationSpeed(),this.onAnimationSpeedChanged.notifyObservers()}get animationProgress(){return this._activeAnimation?this._activeAnimation.getCurrentFrame()/(this._activeAnimation.to-this._activeAnimation.from):0}set animationProgress(e){this._activeAnimation&&(this._activeAnimation.goToFrame(e*(this._activeAnimation.to-this._activeAnimation.from)),this.onAnimationProgressChanged.notifyObservers(),this._autoRotationBehavior.resetLastInteractionTime(),this._markSceneMutated())}get _activeAnimation(){return this._activeModel?.assetContainer.animationGroups[this._activeModel?.selectedAnimation]??null}get materialVariants(){return this._activeModel?.materialVariantsController?.variants??[]}get selectedMaterialVariant(){return this._activeModel?.selectedMaterialVariant??null}set selectedMaterialVariant(e){this._activeModel&&e&&(this._activeModel.selectedMaterialVariant=e)}get hotSpots(){return this._hotSpots}set hotSpots(e){this._hotSpots=e,this.onHotSpotsChanged.notifyObservers()}get camerasAsHotSpots(){return this._camerasAsHotSpots}set camerasAsHotSpots(e){this._camerasAsHotSpots!==e&&(this._camerasAsHotSpots=e,this._toggleCamerasAsHotSpots(),this.onCamerasAsHotSpotsChanged.notifyObservers())}_beginLoadOperation(){const e=this;let t=null;const i={get progress(){return t},set progress(s){t=s,e.onLoadingProgressChanged.notifyObservers()},dispose:()=>{e._loadOperations.delete(i),e.onLoadingProgressChanged.notifyObservers()}};return this._loadOperations.add(i),this.onLoadingProgressChanged.notifyObservers(),i}async loadModel(e,t,i){await this._updateModel(e,t,i)}async resetModel(e){await this._updateModel(void 0,void 0,e)}async _loadModel(e,t,i){this._throwIfDisposedOrAborted(i);const s=this._beginLoadOperation(),r=t?.onProgress,n=u=>{r?.(u),s.progress=u.lengthComputable?u.loaded/u.total:null};delete t?.onProgress;let o=null;const h=t?.pluginOptions?.gltf?.extensionOptions?.KHR_materials_variants?.onLoaded,l=u=>{h?.(u),o=u};delete t?.pluginOptions?.gltf?.extensionOptions?.KHR_materials_variants?.onLoaded,t=Kh({onProgress:n,pluginOptions:{gltf:{transparencyAsCoverage:!0,extensionOptions:{KHR_materials_variants:{onLoaded:l}}}}},t??{}),this._snapshotHelper.disableSnapshotRendering();try{const u=await Ku(e,this._scene,t);Xd(u.meshes.filter(m=>m instanceof ne)),u.animationGroups.forEach(m=>{m.start(!0,this.animationSpeed),m.pause()}),u.addAllToScene(),this._snapshotHelper.fixMeshes(u.meshes);let f=-1;const d=[],g=this,p={assetContainer:u,materialVariantsController:o,_animationPlaying:()=>u.animationGroups[f]?.isPlaying??!1,_shouldRender:()=>{const m=p?.assetContainer.animationGroups.some(A=>A.animatables.some(E=>E.animationStarted));return p._animationPlaying()||m},getHotSpotToRef:(m,A)=>this._getHotSpotToRef(u,m,A),dispose:()=>{this._snapshotHelper.disableSnapshotRendering(),u.meshes.forEach(A=>this._meshDataCache.delete(A)),u.dispose();const m=this._loadedModelsBacking.indexOf(p);m!==-1&&(this._loadedModelsBacking.splice(m,1),p===this._activeModel&&this._setActiveModel(null)),this._snapshotHelper.enableSnapshotRendering(),this._markSceneMutated()},getWorldBounds:(m=f)=>{let A=d[m];return A||(A=pr([p]),A&&(d[m]=A)),A},resetWorldBounds:()=>{d.length=0},get selectedAnimation(){return f},set selectedAnimation(m){let A=u.animationGroups[f];const E=A?.isPlaying??!1;A&&(A.pause(),A.goToFrame(0)),f=m,A=u.animationGroups[f],$t(g._updateShadows()),A&&(A.goToFrame(0),A.play(!0),E||A.pause())},makeActive:m=>{this._setActiveModel(p,m)},set selectedMaterialVariant(m){if(o){let A=m;A||(A=o.variants[0]),A!==o.selectedVariant&&o.variants.includes(A)&&(g._snapshotHelper.disableSnapshotRendering(),o.selectedVariant=A,g._snapshotHelper.enableSnapshotRendering(),g._markSceneMutated(),g.onSelectedMaterialVariantChanged.notifyObservers())}},get selectedMaterialVariant(){return o?o.selectedVariant:null}};return this._loadedModelsBacking.push(p),p}catch(u){throw this.onModelError.notifyObservers(u),u}finally{s.dispose(),this._snapshotHelper.enableSnapshotRendering(),this._markSceneMutated()}}async _updateModel(e,t,i){this._throwIfDisposedOrAborted(i),this._loadModelAbortController?.abort(new Ot("New model is being loaded before previous model finished loading."));const s=this._loadModelAbortController=new AbortController;await this._loadModelLock.lockAsync(async()=>{cn(i,s.signal),this._activeModel?.dispose(),this._activeModelBacking=null,this.selectedAnimation=-1,e&&((await this._loadModel(e,t,s.signal)).makeActive(Object.assign({source:e,interpolateCamera:!1},t)),this._reset(!1,"camera","animation","material-variant"))});const r=this._loadedModels.some(o=>o.assetContainer.materials.some(h=>h instanceof j)),n=this._loadedModels.some(o=>o.assetContainer.meshes.some(h=>!h.material));!this._scene.environmentTexture&&(r||n)&&await this.resetEnvironment({lighting:!0},i),this._startSceneOptimizer(!0)}async _updateShadows(){this._shadowsAbortController?.abort(new Ot("Shadows quality is being change before previous shadows finished initializing."));const e=this._shadowsAbortController=new AbortController;await this._updateShadowsLock.lockAsync(async()=>{this._shadowQuality==="none"?this._disposeShadows():(this._reflectionTexture||await this.loadEnvironment("auto",{lighting:!0,skybox:!1}),this._shadowQuality==="normal"?await this._updateShadowMap(e.signal):this._shadowQuality==="high"&&await this._updateEnvShadow(e.signal))})}_changeShadowLightIntensity(){this._shadowState.high&&(this._shadowState.high.pipeline.resetAccumulation(),this._startIblShadowsRenderTime())}_rotateShadowLightWithEnvironment(){this._shadowQuality==="normal"&&this._shadowState.normal?this._shadowState.normal.light&&this._shadowState.normal.refreshLightPositionDirection(this._reflectionsRotation):this._shadowQuality==="high"&&this._shadowState.high&&(this._shadowState.high.pipeline?.resetAccumulation(),this._startIblShadowsRenderTime())}_startIblShadowsRenderTime(){if(this._shadowState.high){this._shadowState.high.renderTimer!=null?clearTimeout(this._shadowState.high.renderTimer):this._snapshotHelper.disableSnapshotRendering(),this._shadowState.high.shouldRender=!0;const e=()=>{this._shadowState.high&&(this._shadowState.high.shouldRender=!1,this._shadowState.high.renderTimer=null),this._snapshotHelper.enableSnapshotRendering()};this._shadowState.high.renderTimer=setTimeout(e,this._shadowState.high.pipeline.shadowRemanence*4e3)}}async _updateEnvShadow(e){const[{ShaderMaterial:t},{ShaderLanguage:i},{CreateDisc:s},{IblShadowsRenderPipeline:r}]=await Promise.all([G(()=>import("./shaderMaterial-yE1litoM.js"),__vite__mapDeps([170,13,14]),import.meta.url),G(()=>import("./shaderLanguage-BjwqUAVi.js"),[],import.meta.url),G(()=>import("./discBuilder-DHjTJ34Z.js"),__vite__mapDeps([184,13,14]),import.meta.url),G(()=>import("./iblShadowsRenderPipeline-CSk08uxh.js"),__vite__mapDeps([185,13,14,170,183,115,175,37,93,25,26,88,27,24,28,89,174,186,168,178,187]),import.meta.url),G(()=>Promise.resolve().then(()=>jh),void 0,import.meta.url),G(()=>import("./engine.multiRender-DvoXejHB.js"),__vite__mapDeps([179,180,5,12,6,3,181,64,2,79,154,13,14]),import.meta.url),G(()=>import("./postProcessRenderPipelineManagerSceneComponent-SOlAp6R6.js"),__vite__mapDeps([176,13,14]),import.meta.url)]);this._throwIfDisposedOrAborted(e,this._loadModelAbortController?.signal,this._loadEnvironmentAbortController?.signal);let n=this._shadowState.high;const o=pr(this._loadedModelsBacking);if(!o){n?.ground.setEnabled(!1),this._log("No models loaded, cannot create shadows.");return}const h=4,l=_.FromArray(o.size).length(),c=h*l,u=()=>{if(this._shadowState.high){this._snapshotHelper.disableSnapshotRendering();const{pipeline:f,groundMaterial:d,ground:g}=this._shadowState.high;d?.setVector2("renderTargetSize",new Q(this._scene.getEngine().getRenderWidth(),this._scene.getEngine().getRenderHeight())),d?.setFloat("shadowOpacity",f.shadowOpacity),d?.setTexture("shadowTexture",f._getAccumulatedTexture());const p=h*f?.voxelGridSize;g?.scaling.set(p,p,p),this._snapshotHelper.enableSnapshotRendering(),this._markSceneMutated()}};if(this._snapshotHelper.disableSnapshotRendering(),!n){const f=new r("ibl shadows",this._scene,{resolutionExp:6,sampleDirections:3,ssShadowsEnabled:!0,shadowRemanence:.7,triPlanarVoxelization:!0},[this._camera]);f.toggleShadow(!1);const g=this._scene.getEngine().isWebGPU?1:0,p={attributes:["position","uv"],uniforms:["world","worldView","worldViewProjection","view","projection","renderTargetSize","shadowOpacity"],samplers:["shadowTexture"],shaderLanguage:g,extraInitializationsAsync:async()=>{g===1?await Promise.all([G(()=>import("./envShadowGround.vertex-oRlsSdho-CnFcyQnS.js"),__vite__mapDeps([188,13,14]),import.meta.url),G(()=>import("./envShadowGround.fragment-CB8lNguw-DdRKeRcB.js"),__vite__mapDeps([189,13,14]),import.meta.url)]):await Promise.all([G(()=>import("./envShadowGround.vertex-6NXvyWvr-C08bpIyH.js"),__vite__mapDeps([190,13,14]),import.meta.url),G(()=>import("./envShadowGround.fragment-L1sPCORS-CJ6Fvma3.js"),__vite__mapDeps([191,13,14]),import.meta.url)])}},m=new t("envShadowGroundMaterial",this._scene,"envShadowGround",p);m.alphaMode=y.ALPHA_MULTIPLY,m.alpha=.99,u(),f.onShadowTextureReadyObservable.addOnce(u);const A=this._engine.onResizeObservable.add(()=>{u(),f?.resetAccumulation(),this._startIblShadowsRenderTime()});this._camera.onViewMatrixChangedObservable.add(()=>{this._startIblShadowsRenderTime()});const E=s("envShadowGround",{radius:c,tessellation:64},this._scene);E.setEnabled(!1),E.rotation.x=Math.PI/2,E.position.y=o.extents.min[1],E.material=m,n={pipeline:f,groundMaterial:m,resizeObserver:A,shouldRender:!0,ground:E}}n.pipeline.clearShadowCastingMeshes(),n.pipeline.clearShadowReceivingMaterials();for(const f of this._loadedModelsBacking){const d=f.assetContainer.meshes;for(const g of d)g instanceof ne&&(n.pipeline.addShadowCastingMesh(g),g.material&&n.pipeline.addShadowReceivingMaterial(g.material))}n.pipeline.onVoxelizationCompleteObservable.addOnce(()=>{this._snapshotHelper.disableSnapshotRendering(),u(),n.pipeline.toggleShadow(!0),n.ground.setEnabled(!0),this._snapshotHelper.enableSnapshotRendering(),this._markSceneMutated()}),n.ground.position.y=o.extents.min[1],n.pipeline.updateSceneBounds(),n.pipeline.updateVoxelization(),n.pipeline.resetAccumulation(),this._shadowState.normal?.ground.setEnabled(!1),this._startIblShadowsRenderTime(),this._shadowState.high=n,this._snapshotHelper.enableSnapshotRendering(),this._markSceneMutated()}async _findIblDominantDirection(e){return this._reflectionTexture&&e.iblSource!==this._reflectionTexture&&(e.iblSource=this._reflectionTexture,await e.renderWhenReady()),await e.findDominantDirection()}async _updateShadowMap(e){const[{CreateDisc:t},{RenderTargetTexture:i},{ShadowGenerator:s},{IblCdfGenerator:r}]=await Promise.all([G(()=>import("./discBuilder-DHjTJ34Z.js"),__vite__mapDeps([184,13,14]),import.meta.url),G(()=>Promise.resolve().then(()=>Ju),void 0,import.meta.url),G(()=>import("./shadowGenerator-D_kEUQNK.js"),__vite__mapDeps([192,13,14]),import.meta.url),G(()=>import("./iblCdfGenerator-BLPdciVw.js").then(m=>m.i),__vite__mapDeps([183,13,14,115]),import.meta.url),G(()=>import("./iblCdfGeneratorSceneComponent-Buukicac.js"),__vite__mapDeps([187,183,13,14,115]),import.meta.url),G(()=>import("./shadowGeneratorSceneComponent-Cw9Z1Dfz.js"),__vite__mapDeps([193,192,13,14,37,106,26,88,28,27,194]),import.meta.url)]);this._throwIfDisposedOrAborted(e,this._loadModelAbortController?.signal,this._loadEnvironmentAbortController?.signal);let n=this._shadowState.normal;const o=pr(this._loadedModelsBacking);if(!o){n?.ground.setEnabled(!1),this._log("No models loaded, cannot create shadows.");return}const h=_.FromArray(o.size).length();if(this._shadowQuality!=="normal")return;const l=n?.iblDirection.iblCdfGenerator?n?.iblDirection.iblCdfGenerator:new r(this._engine),c=await this._findIblDominantDirection(l);this._throwIfDisposedOrAborted(e,this._loadModelAbortController?.signal,this._loadEnvironmentAbortController?.signal),this._snapshotHelper.disableSnapshotRendering();const u=4096,d=h*20,g=h*3,p=c?be(c.length(),0,1):.5;if(!n){const m=new ii("shadowMapDirectionalLight",_.Zero(),this._scene);m.autoUpdateExtends=!1;const A=new s(u,m);A.setDarkness(Ii(.8,.2,p)),A.setTransparencyShadow(!0),A.filteringQuality=s.QUALITY_HIGH,A.useBlurExponentialShadowMap=!0,A.enableSoftTransparentShadow=!0,A.bias=h/1e3,A.useKernelBlur=!0,A.blurKernel=Math.floor(Ii(64,8,p));const E=A.getShadowMap();E&&(E.refreshRate=i.REFRESHRATE_RENDER_ONEVERYFRAME,E.renderList=this._scene.meshes.slice());const I=new _e("shadowMapGroundMaterial",this._scene);I.shadowOnly=!0,I.primaryColor=q.Black();const M=t("shadowMapGround",{radius:d,tessellation:64},this._scene);M.rotation.x=Math.PI/2,M.receiveShadows=!0,M.position.y=o.extents.min[1],M.material=I;const C=n={light:m,generator:A,ground:M,shouldRender:!0,iblDirection:{iblCdfGenerator:l,positionFactor:g,direction:c},refreshLightPositionDirection(x){let S=this.iblDirection.direction.normalizeToNew();this.light.getScene().useRightHandedSystem&&(S.z*=-1);const L=P.RotationY(x*-1);S=_.TransformCoordinates(S,L),this.light.position=S.scale(this.iblDirection.positionFactor),this.light.direction=_f(S.negate())}};await new Promise((x,S)=>{tr(()=>E.isReadyForRendering(),()=>x(void 0),()=>S(new Error("Failed to get shadow map generator ready")))}),A.onAfterShadowMapRenderObservable.addOnce(()=>{C.shouldRender=!1})}n.iblDirection.direction=c,n.iblDirection.positionFactor=g,n.refreshLightPositionDirection(this._reflectionsRotation),n.light.shadowFrustumSize=h*4;for(const m of this._loadedModelsBacking)for(const A of m.assetContainer.meshes)n.generator.addShadowCaster(A,!1),A.receiveShadows=!0;n.ground.position.y=o.extents.min[1],n.ground.scaling.set(d,d,d),this._shadowState.high?.ground.setEnabled(!1),this._shadowState.high?.pipeline.toggleShadow(!1),n.ground.setEnabled(!0),this._shadowState.normal=n,this._snapshotHelper.enableSnapshotRendering(),this._markSceneMutated()}_disposeShadows(){if(this._snapshotHelper.disableSnapshotRendering(),!this._shadowState)return;for(const i of this._loadedModelsBacking){const s=i.assetContainer.meshes,r=i.assetContainer.meshes[0];this._shadowState.normal?.generator.removeShadowCaster(r,!0),r.receiveShadows=!1;for(const n of s)n instanceof ne&&(this._shadowState.high?.pipeline.removeShadowCastingMesh(n),n.material&&this._shadowState.high?.pipeline.removeShadowReceivingMaterial(n.material))}const e=this._shadowState.high,t=this._shadowState.normal;t&&(t.generator.dispose(),t.light.dispose(),t.ground.dispose(!0,!0),t.iblDirection.iblCdfGenerator.dispose(),this._scene.removeMesh(t.ground)),e&&(e.resizeObserver.remove(),e.pipeline.dispose(),e.ground.dispose(!0,!0),this._scene.removeMesh(e.ground),e.renderTimer&&clearTimeout(e.renderTimer)),delete this._shadowState.normal,delete this._shadowState.high,this.onShadowsConfigurationChanged.clear(),this._snapshotHelper.enableSnapshotRendering(),this._markSceneMutated()}async loadEnvironment(e,t,i){await this._updateEnvironment(e,t,i)}async resetEnvironment(e,t){const i=[];if(e?.lighting&&this._scene.materials.some(s=>s instanceof j)){const s={...e,skybox:!1};e={...e,lighting:!1},i.push(this._updateEnvironment("auto",s,t))}i.push(this._updateEnvironment(void 0,e,t)),await Promise.all(i)}_setEnvironmentLighting(e){this._reflectionTexture=e,this._scene.environmentTexture=this._reflectionTexture,this._reflectionTexture.level=this.environmentConfig.intensity,this._reflectionTexture.rotationY=this.environmentConfig.rotation}_setEnvironmentSkybox(e){this._skyboxTexture=e,this._skyboxTexture.level=this.environmentConfig.intensity,this._skyboxTexture.rotationY=this.environmentConfig.rotation,this._skybox=uf(this._scene,this._camera,this._skyboxTexture,this.environmentConfig.blur),this._skybox.setEnabled(!0),this._snapshotHelper.fixMeshes([this._skybox]),this._updateAutoClear()}async _updateEnvironment(e,t=gf,i){if(this._throwIfDisposedOrAborted(i),!t.lighting&&!t.skybox)return;e=e?.trim(),e==="auto"&&(t={...t,extension:".env"}),this._loadEnvironmentAbortController?.abort(new Ot("New environment is being loaded before previous environment finished loading."));const s=this._loadEnvironmentAbortController=new AbortController;await this._loadEnvironmentLock.lockAsync(async()=>{cn(i,s.signal);const r=async()=>(await G(async()=>{const{default:c}=await import("./defaultEnvironment-5jBs1zfd-DPUnnTO0.js");return{default:c}},[],import.meta.url)).default,n=async c=>{await new Promise((u,f)=>{const d=c.onLoadObservable.addOnce(()=>{g.remove(),u()}),g=z.OnTextureLoadErrorObservable.add(p=>{p===c&&(d.remove(),g.remove(),f(new Error("Failed to load environment texture.")))})})},o=e?e==="auto"?"auto":"url":"none";this._environmentLightingMode=t.lighting?o:this._environmentLightingMode,this._environmentSkyboxMode=t.skybox?o:this._environmentSkyboxMode;let h=this._reflectionTexture?.url,l=this._skyboxTexture?.url;this._snapshotHelper.disableSnapshotRendering();try{this._environmentLightingMode==="auto"&&this._environmentSkyboxMode==="auto"?h=l=await r():(this._environmentLightingMode!=="auto"&&t.lighting&&(h=e),this._environmentSkyboxMode!=="auto"&&t.skybox&&(l=e),this._environmentLightingMode==="auto"&&(h=l??await r()),this._environmentSkyboxMode==="auto"&&(l=h??await r()));const c=[];if(h!==this._reflectionTexture?.url&&(this._reflectionTexture?.dispose(),this._reflectionTexture=null,this._scene.environmentTexture=null,h))if(h===this._skyboxTexture?.url)this._setEnvironmentLighting(this._skyboxTexture.clone());else{const u=await $a(h,this._scene,t.extension);c.push(n(u)),this._setEnvironmentLighting(u)}if(l!==this._skyboxTexture?.url&&(this._skybox?.dispose(void 0,!0),this._skyboxTexture=null,this._skybox=null,this._updateAutoClear(),l))if(l===this._reflectionTexture?.url)this._setEnvironmentSkybox(this._reflectionTexture.clone());else{const u=await $a(l,this._scene,t.extension);c.push(n(u)),this._setEnvironmentSkybox(u)}await Promise.all(c),this._updateLight(),$t(this._updateShadows()),this.onEnvironmentChanged.notifyObservers()}catch(c){throw this.onEnvironmentError.notifyObservers(c),c}finally{this._snapshotHelper.enableSnapshotRendering(),this._markSceneMutated()}})}toggleAnimation(){this.isAnimationPlaying?this.pauseAnimation():this.playAnimation()}playAnimation(){this._activeAnimation?.play(!0)}async pauseAnimation(){this._activeAnimation?.pause()}resetCamera(e){e==null&&(e=this.selectedAnimation!==(this._options?.selectedAnimation??0)),e?this._reframeCamera(!0):this._reset(!0,"camera")}updateCamera(e){this._reframeCameraFromBounds(!0,this._loadedModels,e.alpha??NaN,e.beta??NaN,e.radius??NaN,e.targetX??NaN,e.targetY??NaN,e.targetZ??NaN)}reset(...e){this._reset(!0,...e)}_reset(e,...t){if((t.length===0||t.includes("source"))&&$t(this._updateModel(this._options?.source)),(t.length===0||t.includes("environment"))&&(this._scene.clearColor=new fe(...this._options?.clearColor??Je.clearColor),this.environmentConfig={intensity:this._options?.environmentConfig?.intensity??Je.environmentConfig.intensity,blur:this._options?.environmentConfig?.blur??Je.environmentConfig.blur,rotation:this._options?.environmentConfig?.rotation??Je.environmentConfig.rotation},this._options?.environmentLighting===this._options?.environmentSkybox?$t(this._updateEnvironment(this._options?.environmentLighting,{lighting:!0,skybox:!0})):($t(this._updateEnvironment(this._options?.environmentLighting,{lighting:!0})),$t(this._updateEnvironment(this._options?.environmentSkybox,{skybox:!0})))),(t.length===0||t.includes("shadow"))&&(this._shadowQuality=this._options?.shadowConfig?.quality??Je.shadowConfig.quality,$t(this.updateShadows({quality:this._shadowQuality}))),(t.length===0||t.includes("animation"))&&(this.animationSpeed=this._options?.animationSpeed??Je.animationSpeed,this.selectedAnimation=this._options?.selectedAnimation??0,this._options?.animationAutoPlay?this.playAnimation():this.pauseAnimation()),t.length===0||t.includes("camera")){const i=Number(this._options?.cameraOrbit?.[0]),s=Number(this._options?.cameraOrbit?.[1]),r=Number(this._options?.cameraOrbit?.[2]),n=Number(this._options?.cameraTarget?.[0]),o=Number(this._options?.cameraTarget?.[1]),h=Number(this._options?.cameraTarget?.[2]);this._reframeCameraFromBounds(e,this._loadedModels,isNaN(i)?void 0:i,isNaN(s)?void 0:s,isNaN(r)?void 0:r,isNaN(n)?void 0:n,isNaN(o)?void 0:o,isNaN(h)?void 0:h),this.cameraAutoOrbit={enabled:this._options?.cameraAutoOrbit?.enabled??Je.cameraAutoOrbit.enabled,speed:this._options?.cameraAutoOrbit?.speed??Je.cameraAutoOrbit.speed,delay:this._options?.cameraAutoOrbit?.delay??Je.cameraAutoOrbit.delay}}(t.length===0||t.includes("post-processing"))&&(this.postProcessing={toneMapping:this._options?.postProcessing?.toneMapping??Je.postProcessing.toneMapping,contrast:this._options?.postProcessing?.contrast??Je.postProcessing.contrast,exposure:this._options?.postProcessing?.exposure??Je.postProcessing.exposure,ssao:this._options?.postProcessing?.ssao??Je.postProcessing.ssao}),(t.length===0||t.includes("material-variant"))&&(this.selectedMaterialVariant=this._options?.selectedMaterialVariant??null)}dispose(){this.selectedAnimation=-1,this.animationProgress=0,this._loadEnvironmentAbortController?.abort(new Ot("Thew viewer is being disposed.")),this._loadModelAbortController?.abort(new Ot("Thew viewer is being disposed.")),this._camerasAsHotSpotsAbortController?.abort(new Ot("Thew viewer is being disposed.")),this._shadowsAbortController?.abort(new Ot("Thew viewer is being disposed.")),this._renderLoopController?.dispose(),this._activeModel?.dispose(),this._loadedModelsBacking.forEach(e=>e.dispose()),this._disposeShadows(),this._scene.dispose(),this.onEnvironmentChanged.clear(),this.onEnvironmentError.clear(),this.onEnvironmentConfigurationChanged.clear(),this.onPostProcessingChanged.clear(),this.onModelChanged.clear(),this.onModelError.clear(),this.onCameraAutoOrbitChanged.clear(),this.onSelectedAnimationChanged.clear(),this.onAnimationSpeedChanged.clear(),this.onIsAnimationPlayingChanged.clear(),this.onAnimationProgressChanged.clear(),this.onSelectedMaterialVariantChanged.clear(),this.onHotSpotsChanged.clear(),this.onCamerasAsHotSpotsChanged.clear(),this.onLoadingProgressChanged.clear(),this._imageProcessingConfigurationObserver.remove(),this._beforeRenderObserver.remove(),this._isDisposed=!0}getHotSpotToRef(e,t){return this._getHotSpotToRef(this._loadedModels.flatMap(i=>i.assetContainer.meshes),e,t)}_getHotSpotToRef(...e){const[t,i,s]=e,r=Array.isArray(t)?t:t?.meshes,n=this._tempVectors[2],o=this._tempVectors[1],h=this._tempVectors[0];if(i.type==="surface"){const d=r?.[i.meshIndex];if(!d||!Gd(d,i,o,n))return!1}else o.copyFromFloats(i.position[0],i.position[1],i.position[2]),n.copyFromFloats(i.normal[0],i.normal[1],i.normal[2]);const l=this._camera.viewport.width*this._engine.getRenderWidth()*this._engine.getHardwareScalingLevel(),c=this._camera.viewport.height*this._engine.getRenderHeight()*this._engine.getHardwareScalingLevel(),u=this._scene;_.ProjectToRef(o,P.IdentityReadOnly,u.getTransformMatrix(),new ps(0,0,l,c),h),s.screenPosition[0]=h.x,s.screenPosition[1]=h.y,s.worldPosition[0]=o.x,s.worldPosition[1]=o.y,s.worldPosition[2]=o.z;const f=this._tempVectors[3];return f.copyFrom(this._camera.globalPosition),f.subtractInPlace(o),f.normalize(),s.visibility=_.Dot(f,n),!0}queryHotSpot(e,t){return this._queryHotSpot(e,t)!=null}focusHotSpot(e){const t=new Kn,i=this._queryHotSpot(e,t);if(i){this.pauseAnimation();const s=i.cameraOrbit??[void 0,void 0,void 0];return this._camera.interpolateTo(s[0],s[1],s[2],new _(t.worldPosition[0],t.worldPosition[1],t.worldPosition[2])),!0}return!1}_queryHotSpot(e,t){const i=this.hotSpots?.[e];return i&&this.getHotSpotToRef(i,t)?i:null}async _addCameraHotSpot(e,t){if(e!==this._camera){const i=await this._createHotSpotFromCamera(e);i&&!t?.aborted&&(this.hotSpots={...this.hotSpots,[`camera-${e.name}`]:i})}}_removeCameraHotSpot(e){delete this.hotSpots[`camera-${e.name}`],this.hotSpots={...this.hotSpots}}_toggleCamerasAsHotSpots(){if(!this.camerasAsHotSpots)this._camerasAsHotSpotsAbortController?.abort(),this._camerasAsHotSpotsAbortController=null,this._scene.cameras.forEach(e=>this._removeCameraHotSpot(e));else{const e=this._camerasAsHotSpotsAbortController=new AbortController;this._scene.cameras.forEach(async t=>await this._addCameraHotSpot(t,e.signal))}}async _createHotSpotFromCamera(e){if(e instanceof Ie){const t=e.target.asArray();return{type:"world",position:t,normal:t,cameraOrbit:[e.alpha,e.beta,e.radius]}}return this._activeModel?await tl(this._activeModel,e):null}get _shouldRender(){return!this._autoSuspendRendering||this._sceneMutated||!this._snapshotHelper.isReady||this._shadowState.normal?.shouldRender||this._shadowState.high?.shouldRender||this._loadedModelsBacking.some(e=>e._shouldRender())}_markSceneMutated(){this._sceneMutated=!0}_suspendRendering(){this._renderLoopController?.dispose(),this._suspendRenderCount++;let e=!1;return{dispose:()=>{e||(e=!0,this._suspendRenderCount--,this._suspendRenderCount===0&&this._beginRendering())}}}_beginRendering(){if(!this._renderLoopController){let e=!1;const t=()=>{this._log("Viewer Resumed Rendering"),this._engine.setHardwareScalingLevel(this._lastHardwareScalingLevel),this._engine.performanceMonitor.enable(),this._snapshotHelper.enableSnapshotRendering(),this._startSceneOptimizer()},i=()=>{this._log("Viewer Suspended Rendering"),this._renderedLastFrame=!1,e=!1,this._lastHardwareScalingLevel=this._engine.getHardwareScalingLevel(),this._stopSceneOptimizer(),this._snapshotHelper.disableSnapshotRendering(),this._engine.performanceMonitor.disable(),this._engine.setHardwareScalingLevel(this._defaultHardwareScalingLevel),this._engine.beginFrame(),this._scene.render(),this._engine.endFrame()},s=()=>{let n=this._shouldRender;!n&&this._renderedLastFrame&&!e&&(e=this._scene.isReady(!0),n=!0),n?(this._renderedLastFrame||(this._renderedLastFrame!==null&&t(),this._renderedLastFrame=!0),this._sceneMutated=!1,this._scene.render(),this._camera.panningSensibility=5e3/this._camera.radius,this._camera.speed=this._camera.radius*.2,this._camera.inputs.attached.keyboard.zoomingSensibility=500/this._camera.radius,this.isAnimationPlaying&&(this.onAnimationProgressChanged.notifyObservers(),this._autoRotationBehavior.resetLastInteractionTime())):(this._camera.update(),this._renderedLastFrame&&i())};this._engine.runRenderLoop(s);let r=!1;this._renderLoopController={dispose:()=>{r||(r=!0,this._engine.stopRenderLoop(s),this._renderLoopController=null,this._renderedLastFrame&&i())}}}}_reframeCamera(e=!1,t=this._loadedModelsBacking){this._reframeCameraFromBounds(e,t)}_getWorldBounds(e){return pr(e)}_getCameraConfig(e){let t=1,i=_.Zero();const s=this._getWorldBounds(e);s&&(this._camera.lowerRadiusLimit=null,t=_.FromArray(s.size).length()*1.1,i=_.FromArray(s.center),isFinite(t)||(t=1,i.copyFromFloats(0,0,0)));const r=t*.001,n=t*5,o=t*.001,h=t*1e3;return{radius:t,target:i,lowerRadiusLimit:r,upperRadiusLimit:n,minZ:o,maxZ:h}}_reframeCameraFromBounds(e,t,i,s,r,n,o,h){let l=1;const c=_.Zero();let u=Math.PI/2,f=Math.PI/2.4;const{radius:d,target:g,lowerRadiusLimit:p,upperRadiusLimit:m,minZ:A,maxZ:E}=this._getCameraConfig(t);this._camera.lowerRadiusLimit=p,this._camera.upperRadiusLimit=m,this._camera.minZ=A,this._camera.maxZ=E,u=i??u,f=s??f,l=r??d,c.x=n??g.x,c.y=o??g.y,c.z=h??g.z,e?this._camera.interpolateTo(u,f,l,c,void 0,.1):(this._camera.stopInterpolation(),isNaN(u)||(this._camera.alpha=u),isNaN(f)||(this._camera.beta=f),isNaN(l)||(this._camera.radius=l),this._camera.setTarget(new _(isNaN(c.x)?this._camera.target.x:c.x,isNaN(c.y)?this._camera.target.y:c.y,isNaN(c.z)?this._camera.target.z:c.z),void 0,void 0,!0)),this._camera.wheelDeltaPercentage=.01,this._camera.useNaturalPinchZoom=!0,el(this._skybox,this._camera)}_updateLight(){let e;if(this._loadedModels.length===0)e=!1;else{const t=this._loadedModels.some(r=>r.assetContainer.lights.length>0),i=!!this._reflectionTexture,s=this._loadedModels.some(r=>r.assetContainer.materials.some(n=>!(n instanceof j)));t?e=!1:e=!i||s}e?this._light||(this._light=new Ss("defaultLight",_.Up(),this._scene)):(this._light?.dispose(),this._light=null)}_applyAnimationSpeed(){this._activeModel?.assetContainer.animationGroups.forEach(e=>e.speedRatio=this._animationSpeed)}async _pick(e,t){if(await G(()=>import("./ray-DFqjcUAE.js"),__vite__mapDeps([171,13,14]),import.meta.url),this._loadedModels.length>0){const i=this._loadedModelsBacking.flatMap(r=>r.assetContainer.meshes);i.forEach(r=>{let n=this._meshDataCache.get(r);n||(n={},this._meshDataCache.set(r,n)),r.refreshBoundingInfo({applyMorph:!0,applySkeleton:!0,cache:n})});const s=this._scene.pick(e,t,r=>i.includes(r));if(s.hit)return s}return null}_startSceneOptimizer(e=!1){this._stopSceneOptimizer(),e&&this._engine.setHardwareScalingLevel(this._defaultHardwareScalingLevel);const t=new Ji(60,1e3),i=new Sn(void 0,1);t.addOptimization(i),this._sceneOptimizer=new zn(this._scene,t),this._sceneOptimizer.start()}_stopSceneOptimizer(){this._sceneOptimizer?.dispose(),this._sceneOptimizer=null}_log(e){this.showDebugLogs&&w.Log(e)}_throwIfDisposedOrAborted(...e){if(this._isDisposed)throw new Error("Viewer is disposed.");cn(...e)}}af();const yr=globalThis,qn=yr.ShadowRoot&&(yr.ShadyCSS===void 0||yr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,jn=Symbol(),Ja=new WeakMap;let il=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==jn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(qn&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=Ja.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Ja.set(t,e))}return e}toString(){return this.cssText}};const pf=a=>new il(typeof a=="string"?a:a+"",void 0,jn),sl=(a,...e)=>{const t=a.length===1?a[0]:e.reduce(((i,s,r)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+a[r+1]),a[0]);return new il(t,a,jn)},mf=(a,e)=>{if(qn)a.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const t of e){const i=document.createElement("style"),s=yr.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,a.appendChild(i)}},eo=qn?a=>a:a=>a instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return pf(t)})(a):a;const{is:Tf,defineProperty:bf,getOwnPropertyDescriptor:Ef,getOwnPropertyNames:Af,getOwnPropertySymbols:Rf,getPrototypeOf:yf}=Object,Kr=globalThis,to=Kr.trustedTypes,xf=to?to.emptyScript:"",Sf=Kr.reactiveElementPolyfillSupport,Ns=(a,e)=>a,wr={toAttribute(a,e){switch(e){case Boolean:a=a?xf:null;break;case Object:case Array:a=a==null?a:JSON.stringify(a)}return a},fromAttribute(a,e){let t=a;switch(e){case Boolean:t=a!==null;break;case Number:t=a===null?null:Number(a);break;case Object:case Array:try{t=JSON.parse(a)}catch{t=null}}return t}},Qn=(a,e)=>!Tf(a,e),io={attribute:!0,type:String,converter:wr,reflect:!1,useDefault:!1,hasChanged:Qn};Symbol.metadata??=Symbol("metadata"),Kr.litPropertyMetadata??=new WeakMap;let os=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=io){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);s!==void 0&&bf(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:r}=Ef(this.prototype,e)??{get(){return this[t]},set(n){this[t]=n}};return{get:s,set(n){const o=s?.call(this);r?.call(this,n),this.requestUpdate(e,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??io}static _$Ei(){if(this.hasOwnProperty(Ns("elementProperties")))return;const e=yf(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ns("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ns("properties"))){const t=this.properties,i=[...Af(t),...Rf(t)];for(const s of i)this.createProperty(s,t[s])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,s]of t)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const s=this._$Eu(t,i);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const s of i)t.unshift(eo(s))}else e!==void 0&&t.push(eo(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return mf(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){const r=(i.converter?.toAttribute!==void 0?i.converter:wr).toAttribute(t,i.type);this._$Em=e,r==null?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(e,t){const i=this.constructor,s=i._$Eh.get(e);if(s!==void 0&&this._$Em!==s){const r=i.getPropertyOptions(s),n=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:wr;this._$Em=s,this[s]=n.fromAttribute(t,r.type)??this._$Ej?.get(s)??null,this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){const s=this.constructor,r=this[e];if(i??=s.getPropertyOptions(e),!((i.hasChanged??Qn)(r,t)||i.useDefault&&i.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,i))))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:r},n){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),r!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),s===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[s,r]of this._$Ep)this[s]=r;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[s,r]of i){const{wrapped:n}=r,o=this[s];n!==!0||this._$AL.has(s)||o===void 0||this.C(s,void 0,r,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((i=>i.hostUpdate?.())),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};os.elementStyles=[],os.shadowRootOptions={mode:"open"},os[Ns("elementProperties")]=new Map,os[Ns("finalized")]=new Map,Sf?.({ReactiveElement:os}),(Kr.reactiveElementVersions??=[]).push("2.1.0");const Zn=globalThis,Lr=Zn.trustedTypes,so=Lr?Lr.createPolicy("lit-html",{createHTML:a=>a}):void 0,rl="$lit$",Pi=`lit$${Math.random().toFixed(9).slice(2)}$`,nl="?"+Pi,Mf=`<${nl}>`,is=document,Qs=()=>is.createComment(""),Zs=a=>a===null||typeof a!="object"&&typeof a!="function",$n=Array.isArray,Cf=a=>$n(a)||typeof a?.[Symbol.iterator]=="function",un=`[ +\f\r]`,Os=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ro=/-->/g,no=/>/g,Ki=RegExp(`>|${un}(?:([^\\s"'>=/]+)(${un}*=${un}*(?:[^ +\f\r"'\`<>=]|("|')|))|$)`,"g"),ao=/'/g,oo=/"/g,al=/^(?:script|style|textarea|title)$/i,If=a=>(e,...t)=>({_$litType$:a,strings:e,values:t}),ot=If(1),Rs=Symbol.for("lit-noChange"),ut=Symbol.for("lit-nothing"),ho=new WeakMap,Qi=is.createTreeWalker(is,129);function ol(a,e){if(!$n(a)||!a.hasOwnProperty("raw"))throw Error("invalid template strings array");return so!==void 0?so.createHTML(e):e}const Pf=(a,e)=>{const t=a.length-1,i=[];let s,r=e===2?"":e===3?"":"",n=Os;for(let o=0;o"?(n=s??Os,u=-1):c[1]===void 0?u=-2:(u=n.lastIndex-c[2].length,l=c[1],n=c[3]===void 0?Ki:c[3]==='"'?oo:ao):n===oo||n===ao?n=Ki:n===ro||n===no?n=Os:(n=Ki,s=void 0);const d=n===Ki&&a[o+1].startsWith("/>")?" ":"";r+=n===Os?h+Mf:u>=0?(i.push(l),h.slice(0,u)+rl+h.slice(u)+Pi+d):h+Pi+(u===-2?o:d)}return[ol(a,r+(a[t]||"")+(e===2?"":e===3?"":"")),i]};class $s{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let r=0,n=0;const o=e.length-1,h=this.parts,[l,c]=Pf(e,t);if(this.el=$s.createElement(l,i),Qi.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(s=Qi.nextNode())!==null&&h.length0){s.textContent=Lr?Lr.emptyScript:"";for(let d=0;d2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=ut}_$AI(e,t=this,i,s){const r=this.strings;let n=!1;if(r===void 0)e=ys(this,e,t,0),n=!Zs(e)||e!==this._$AH&&e!==Rs,n&&(this._$AH=e);else{const o=e;let h,l;for(e=r[0],h=0;h{const i=t?.renderBefore??e;let s=i._$litPart$;if(s===void 0){const r=t?.renderBefore??null;i._$litPart$=s=new hr(e.insertBefore(Qs(),r),r,void 0,t??{})}return s._$AI(a),s};const Jn=globalThis;let _s=class extends os{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Bf(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Rs}};_s._$litElement$=!0,_s.finalized=!0,Jn.litElementHydrateSupport?.({LitElement:_s});const Nf=Jn.litElementPolyfillSupport;Nf?.({LitElement:_s});(Jn.litElementVersions??=[]).push("4.2.0");const hl=a=>(e,t)=>{t!==void 0?t.addInitializer((()=>{customElements.define(a,e)})):customElements.define(a,e)};const Uf={attribute:!0,type:String,converter:wr,reflect:!1,hasChanged:Qn},kf=(a=Uf,e,t)=>{const{kind:i,metadata:s}=t;let r=globalThis.litPropertyMetadata.get(s);if(r===void 0&&globalThis.litPropertyMetadata.set(s,r=new Map),i==="setter"&&((a=Object.create(a)).wrapped=!0),r.set(t.name,a),i==="accessor"){const{name:n}=t;return{set(o){const h=e.get.call(this);e.set.call(this,o),this.requestUpdate(n,h,a)},init(o){return o!==void 0&&this.C(n,void 0,a,o),o}}}if(i==="setter"){const{name:n}=t;return function(o){const h=this[n];e.call(this,o),this.requestUpdate(n,h,a)}}throw Error("Unsupported decorator location: "+i)};function Be(a){return(e,t)=>typeof t=="object"?kf(a,e,t):((i,s,r)=>{const n=s.hasOwnProperty(r);return s.constructor.createProperty(r,i),n?Object.getOwnPropertyDescriptor(s,r):void 0})(a,e,t)}function lr(a){return Be({...a,state:!0,attribute:!1})}const Gf=(a,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(a,e,t),t);function ll(a,e){return(t,i,s)=>{const r=n=>n.renderRoot?.querySelector(a)??null;return Gf(t,i,{get(){return r(this)}})}}const Hf=a=>a.strings===void 0;const Vf={CHILD:2},zf=a=>(...e)=>({_$litDirective$:a,values:e});class Wf{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}const Us=(a,e)=>{const t=a._$AN;if(t===void 0)return!1;for(const i of t)i._$AO?.(e,!1),Us(i,e);return!0},Br=a=>{let e,t;do{if((e=a._$AM)===void 0)break;t=e._$AN,t.delete(a),a=e}while(t?.size===0)},cl=a=>{for(let e;e=a._$AM;a=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(a))break;t.add(a),Yf(e)}};function Xf(a){this._$AN!==void 0?(Br(this),this._$AM=a,cl(this)):this._$AM=a}function Kf(a,e=!1,t=0){const i=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(e)if(Array.isArray(i))for(let r=t;r{a.type==Vf.CHILD&&(a._$AP??=Kf,a._$AQ??=Xf)};class qf extends Wf{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),cl(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Us(this,e),Br(this))}setValue(e){if(Hf(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}const dn=new WeakMap,jf=zf(class extends qf{render(a){return ut}update(a,[e]){const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=a.options?.host,this.rt(this.ct=a.element)),ut}rt(a){if(this.isConnected||(a=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=dn.get(e);t===void 0&&(t=new WeakMap,dn.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,a),a!==void 0&&this.G.call(this.ht,a)}else this.G.value=a}get lt(){return typeof this.G=="function"?dn.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),mr={antialias:!0,adaptToDeviceRatio:!0,enableAllFeatures:!0,setMaximumLimits:!0};function Qf(){return"gpu"in navigator&&"chrome"in window?"WebGPU":"WebGL"}async function ul(a,e={}){const t=new Vn;e=new Proxy(e,{get(o,h){switch(h){case"antialias":return o.antialias??mr.antialias;case"adaptToDeviceRatio":return o.adaptToDeviceRatio??mr.adaptToDeviceRatio;case"enableAllFeatures":return o.enableAllFeatures??mr.enableAllFeatures;case"setMaximumLimits":return o.setMaximumLimits??mr.setMaximumLimits;case"onInitialized":return l=>{o.onInitialized?.(l),t.resolve(l)};default:return o[h]}}});const i=[];let s;switch(e.engine??Qf()){case"WebGPU":{const{WebGPUEngine:o}=await G(async()=>{const{WebGPUEngine:l}=await import("./webgpuEngine-C4n6cvIQ.js");return{WebGPUEngine:l}},__vite__mapDeps([180,5,12,6,3,181,64,2,79,154,13,14]),import.meta.url),h=new o(a,e);try{await h.initAsync(),s=h;break}catch{w.Warn("Failed to initialize WebGPU engine. Falling back to WebGL.")}}case"WebGL":{const{Engine:o}=await G(async()=>{const{Engine:h}=await Promise.resolve().then(()=>Ad);return{Engine:h}},void 0,import.meta.url);s=new o(a,void 0,e);break}}if(e.onFaulted){const o=e.onFaulted,h=s.onContextLostObservable.addOnce(()=>{o(new Error("The engine context was lost."))});i.push(()=>h.remove())}const r=e?.viewerClass??Yn,n=new r(s,e);{const o=await t.promise;let h=!1;const l=new ResizeObserver(()=>{h=!0,o.markSceneMutated()});l.observe(a),i.push(()=>l.disconnect());const c=o.scene.onBeforeRenderObservable.add(()=>{h&&(s.resize(),h=!1)});i.push(()=>c.remove());let u=null;const f=new IntersectionObserver(d=>{d.length>0&&(d[d.length-1].isIntersecting?(u?.dispose(),u=null):u=o.suspendRendering())});f.observe(a),i.push(()=>f.disconnect())}return i.push(n.dispose.bind(n)),i.push(()=>s.dispose()),n.dispose=()=>i.forEach(o=>o()),n}const Zf="M5 5.27368C5 3.56682 6.82609 2.48151 8.32538 3.2973L20.687 10.0235C22.2531 10.8756 22.2531 13.124 20.687 13.9762L8.32538 20.7024C6.82609 21.5181 5 20.4328 5 18.726V5.27368Z",$f="M5.74609 3C4.7796 3 3.99609 3.7835 3.99609 4.75V19.25C3.99609 20.2165 4.7796 21 5.74609 21H9.24609C10.2126 21 10.9961 20.2165 10.9961 19.25V4.75C10.9961 3.7835 10.2126 3 9.24609 3H5.74609ZM14.7461 3C13.7796 3 12.9961 3.7835 12.9961 4.75V19.25C12.9961 20.2165 13.7796 21 14.7461 21H18.2461C19.2126 21 19.9961 20.2165 19.9961 19.25V4.75C19.9961 3.7835 19.2126 3 18.2461 3H14.7461Z",Jf="M7.20711 2.54289C7.59763 2.93342 7.59763 3.56658 7.20711 3.95711L5.41421 5.75H13.25C17.6683 5.75 21.25 9.33172 21.25 13.75C21.25 18.1683 17.6683 21.75 13.25 21.75C8.83172 21.75 5.25 18.1683 5.25 13.75C5.25 13.1977 5.69772 12.75 6.25 12.75C6.80228 12.75 7.25 13.1977 7.25 13.75C7.25 17.0637 9.93629 19.75 13.25 19.75C16.5637 19.75 19.25 17.0637 19.25 13.75C19.25 10.4363 16.5637 7.75 13.25 7.75H5.41421L7.20711 9.54289C7.59763 9.93342 7.59763 10.5666 7.20711 10.9571C6.81658 11.3476 6.18342 11.3476 5.79289 10.9571L2.29289 7.45711C1.90237 7.06658 1.90237 6.43342 2.29289 6.04289L5.79289 2.54289C6.18342 2.15237 6.81658 2.15237 7.20711 2.54289Z",e_="M12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14ZM6 12C6 8.68629 8.68629 6 12 6C15.3137 6 18 8.68629 18 12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12ZM12 8C9.79086 8 8 9.79086 8 12C8 14.2091 9.79086 16 12 16C14.2091 16 16 14.2091 16 12C16 9.79086 14.2091 8 12 8ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4Z",t_="M5 12C5 8.13401 8.13401 5 12 5C13.32 5 14.5542 5.36484 15.608 6H15C14.4477 6 14 6.44772 14 7C14 7.55228 14.4477 8 15 8H18C18.5523 8 19 7.55228 19 7C19 6 19 5 19 4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V4.51575C15.5702 3.5588 13.85 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 11.6199 20.9764 11.2448 20.9304 10.8763C20.8621 10.3282 20.3624 9.93935 19.8144 10.0077C19.2663 10.076 18.8775 10.5757 18.9458 11.1237C18.9815 11.4104 19 11.7028 19 12C19 15.866 15.866 19 12 19C8.13401 19 5 15.866 5 12Z",lo=[.5,1,1.5,2];function i_(a){if(!a)return null;const e=document.createElement("canvas");e.width=e.height=1;const t=e.getContext("2d");if(!t)throw new Error("Unable to get 2d context for parseColor");t.clearRect(0,0,1,1),t.fillStyle=a,t.fillRect(0,0,1,1);const i=t.getImageData(0,0,1,1).data;return new fe(i[0]/255,i[1]/255,i[2]/255,i[3]/255)}function s_(a){if(a==="WebGL"||a==="WebGPU")return a}function mi(a){return a==null?null:Number(a)}function Tr(a){if(!a)return null;const e=a.trim().split(/\s+/);if(e.length!==3)throw new Error(`Camera orbit and target should be defined as three space separated numbers, but was specified as "${a}".`);return e.map(t=>Number(t))}function r_(a){return!a||!Jh(a)?null:a}function n_(a){return!a||!cf(a)?null:a}function a_(a){return!a||a==="auto"?"auto":a==="reframe"?"reframe":a.trim().split(/\s+/)}class Se extends _s{constructor(e,t={}){super(),this._viewerClass=e,this._options=t,this._viewerLock=new Rr,this._animationSliderResizeObserver=null,this._propertyBindings=[this._createPropertyBinding("clearColor",i=>i.scene.onClearColorChangedObservable,i=>i.scene.clearColor=this.clearColor??new fe(0,0,0,0),i=>this.clearColor=i.scene.clearColor),this._createPropertyBinding("skyboxBlur",i=>i.viewer.onEnvironmentConfigurationChanged,i=>i.viewer.environmentConfig={blur:this.skyboxBlur??i.viewer.environmentConfig.blur},i=>this.skyboxBlur=i.viewer.environmentConfig.blur),this._createPropertyBinding("environmentIntensity",i=>i.viewer.onEnvironmentConfigurationChanged,i=>i.viewer.environmentConfig={intensity:this.environmentIntensity??i.viewer.environmentConfig.intensity},i=>this.environmentIntensity=i.viewer.environmentConfig.intensity),this._createPropertyBinding("environmentRotation",i=>i.viewer.onEnvironmentConfigurationChanged,i=>i.viewer.environmentConfig={rotation:this.environmentRotation??i.viewer.environmentConfig.rotation},i=>this.environmentRotation=i.viewer.environmentConfig.rotation),this._createPropertyBinding("toneMapping",i=>i.viewer.onPostProcessingChanged,i=>{this.toneMapping&&(i.viewer.postProcessing={toneMapping:this.toneMapping})},i=>this.toneMapping=i.viewer.postProcessing?.toneMapping),this._createPropertyBinding("contrast",i=>i.viewer.onPostProcessingChanged,i=>i.viewer.postProcessing={contrast:this.contrast??void 0},i=>this.contrast=i.viewer.postProcessing.contrast),this._createPropertyBinding("exposure",i=>i.viewer.onPostProcessingChanged,i=>i.viewer.postProcessing={exposure:this.exposure??void 0},i=>this.exposure=i.viewer.postProcessing.exposure),this._createPropertyBinding("ssao",i=>i.viewer.onPostProcessingChanged,i=>i.viewer.postProcessing={ssao:this.ssao??void 0},i=>this.ssao=i.viewer.postProcessing.ssao),this._createPropertyBinding("cameraAutoOrbit",i=>i.viewer.onCameraAutoOrbitChanged,i=>i.viewer.cameraAutoOrbit={enabled:this.cameraAutoOrbit},i=>this.cameraAutoOrbit=i.viewer.cameraAutoOrbit.enabled),this._createPropertyBinding("cameraAutoOrbitSpeed",i=>i.viewer.onCameraAutoOrbitChanged,i=>i.viewer.cameraAutoOrbit={speed:this.cameraAutoOrbitSpeed??void 0},i=>this.cameraAutoOrbitSpeed=i.viewer.cameraAutoOrbit.speed),this._createPropertyBinding("cameraAutoOrbitDelay",i=>i.viewer.onCameraAutoOrbitChanged,i=>i.viewer.cameraAutoOrbit={delay:this.cameraAutoOrbitDelay??void 0},i=>this.cameraAutoOrbitDelay=i.viewer.cameraAutoOrbit.delay),this._createPropertyBinding("animationSpeed",i=>i.viewer.onAnimationSpeedChanged,i=>i.viewer.animationSpeed=this.animationSpeed,i=>{let s=i.viewer.animationSpeed;s=lo.reduce((r,n)=>Math.abs(n-s)new Event(r))}),this._createPropertyBinding("selectedAnimation",i=>i.viewer.onSelectedAnimationChanged,i=>i.viewer.selectedAnimation=this.selectedAnimation??i.viewer.selectedAnimation,i=>this.selectedAnimation=i.viewer.selectedAnimation),this._createPropertyBinding("selectedMaterialVariant",i=>i.viewer.onSelectedMaterialVariantChanged,i=>i.viewer.selectedMaterialVariant=this.selectedMaterialVariant??i.viewer.selectedMaterialVariant??"",i=>this.selectedMaterialVariant=i.viewer.selectedMaterialVariant),this._createPropertyBinding("hotSpots",i=>i.viewer.onHotSpotsChanged,i=>i.viewer.hotSpots=this.hotSpots??i.viewer.hotSpots,i=>this.hotSpots=i.viewer.hotSpots),this._createPropertyBinding("camerasAsHotSpots",i=>i.viewer.onCamerasAsHotSpotsChanged,i=>i.viewer.camerasAsHotSpots=this.camerasAsHotSpots??i.viewer.camerasAsHotSpots,i=>this.camerasAsHotSpots=i.viewer.camerasAsHotSpots)],this._isFaultedBacking=!1,this.engine=this._options.engine,this.renderWhenIdle=this._options.autoSuspendRendering===!1,this.source=this._options.source??null,this.extension=null,this.environmentLighting=this._options.environmentLighting??null,this.environmentSkybox=this._options.environmentSkybox??null,this.environmentIntensity=this._options.environmentConfig?.intensity??null,this.environmentRotation=this._options.environmentConfig?.rotation??null,this.shadowQuality=null,this._loadingProgress=!1,this.skyboxBlur=this._options.environmentConfig?.blur??null,this.toneMapping=this._options.postProcessing?.toneMapping??null,this.contrast=this._options.postProcessing?.contrast??null,this.exposure=this._options.postProcessing?.exposure??null,this.ssao=this._options.postProcessing?.ssao??null,this.clearColor=this._options.clearColor?new fe(this._options.clearColor[0],this._options.clearColor[1],this._options.clearColor[2],this._options.clearColor[3]??1):null,this.cameraAutoOrbit=this._options.cameraAutoOrbit?.enabled??!1,this.cameraAutoOrbitSpeed=this._options.cameraAutoOrbit?.speed??null,this.cameraAutoOrbitDelay=this._options.cameraAutoOrbit?.delay??null,this.hotSpots=this._options.hotSpots??{},this.animationAutoPlay=!!this._options.animationAutoPlay,this.selectedAnimation=this._options.selectedAnimation??null,this.animationSpeed=this._options.animationSpeed??1,this.animationProgress=0,this._animations=[],this._isAnimationPlaying=!1,this._showAnimationSlider=!0,this.selectedMaterialVariant=this._options.selectedMaterialVariant??null,this.camerasAsHotSpots=!1,this.resetMode="auto"}static get observedAttributes(){return[...super.observedAttributes,"camera-orbit","camera-target"]}get viewerDetails(){return this._viewerDetails}queryHotSpot(e,t){return this._viewerDetails?this._viewerDetails.viewer.queryHotSpot(e,t):!1}focusHotSpot(e){return this._viewerDetails?this._viewerDetails.viewer.focusHotSpot(e):!1}get _isFaulted(){return this._isFaultedBacking}get environment(){return{lighting:this.environmentLighting,skybox:this.environmentSkybox}}set environment(e){this.environmentLighting=e||null,this.environmentSkybox=e||null}get loadingProgress(){return this._loadingProgress}get _hasHotSpots(){return Object.keys(this.hotSpots).length>0}get animations(){return this._animations}get _hasAnimations(){return this._animations.length>0}get isAnimationPlaying(){return this._isAnimationPlaying}get materialVariants(){return this._viewerDetails?.viewer.materialVariants??[]}toggleAnimation(){this._viewerDetails?.viewer.toggleAnimation()}reset(){this._reset(this.resetMode)}_reset(e){switch(e){case"auto":this._viewerDetails?.viewer.resetCamera(void 0);break;case"reframe":this._viewerDetails?.viewer.resetCamera(!0);break;default:this._viewerDetails?.viewer.reset(...e);break}}resetCamera(){this._reset("reframe")}reload(){this._tearDownViewer(),this._setupViewer()}connectedCallback(){super.connectedCallback(),this._setupViewer()}disconnectedCallback(){super.disconnectedCallback(),this._tearDownViewer()}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),this.hasUpdated){if(e=="camera-orbit"){const s=Tr(i);s?this._viewerDetails?.viewer.updateCamera({alpha:s[0],beta:s[1],radius:s[2]}):this._viewerDetails?.viewer.resetCamera(!1)}else if(e=="camera-target"){const s=Tr(i);s?this._viewerDetails?.viewer.updateCamera({targetX:s[0],targetY:s[1],targetZ:s[2]}):this._viewerDetails?.viewer.resetCamera(!1)}}}update(e){super.update(e),this._hotSpotSelect&&(this._hotSpotSelect.value="");let t=!1;if(e.get("renderWhenIdle")!=null)t=!0;else if(e.has("engine")){const i=e.get("engine");i&&this.engine!==i&&(t=!0)}t?(this._tearDownViewer(),this._setupViewer()):(this._propertyBindings.filter(i=>e.has(i.property)).forEach(i=>i.updateViewer()),e.has("source")&&this._updateModel(),(e.has("environmentLighting")||e.has("environmentSkybox"))&&this._updateEnv({lighting:e.has("environmentLighting"),skybox:e.has("environmentSkybox")}),e.has("shadowQuality")&&this._updateShadows(this.shadowQuality))}render(){return ot` +
          +
          + ${this._renderOverlay()} +
          + `}_renderProgressBar(){const e=this.loadingProgress!==!1,t=typeof this.loadingProgress=="boolean"?0:this.loadingProgress*100,i=this.loadingProgress===!0;return ot` +
          +
          +
          + `}_renderToolbar(){let e=[];if(this._viewerDetails?.model!=null){this._hasAnimations&&e.push(ot` +
          + + +
          + + ${this.animations.length>1?ot``:""} + `),this.materialVariants.length>1&&e.push(ot` + + `),e.push(ot` + + `),this._hasHotSpots&&e.push(ot` +
          + + + +
          + `);const t=e.length,i=ot`
          `;e=e.reduce((s,r,n)=>n0?ot`
          ${e}
          `:ot``}_renderReloadButton(){return ot`${this._isFaulted?ot` + + `:""}`}_renderOverlay(){return ot` + + ${this._renderProgressBar()} + ${this._renderToolbar()} + ${this._renderReloadButton()} + `}_dispatchCustomEvent(e,t){this.dispatchEvent(t(e))}_onSelectedAnimationChanged(e){const t=e.target;this.selectedAnimation=Number(t.value)}_onAnimationSpeedChanged(e){const t=e.target;this.animationSpeed=Number(t.value)}_onAnimationTimelineChanged(e){if(this._viewerDetails){const t=e.target,i=Number(t.value);i!==this.animationProgress&&(this._viewerDetails.viewer.animationProgress=i)}}_onAnimationTimelinePointerDown(e){this._viewerDetails?.viewer.isAnimationPlaying&&(this._viewerDetails.viewer.pauseAnimation(),e.target.addEventListener("pointerup",()=>this._viewerDetails?.viewer.playAnimation(),{once:!0}))}_onMaterialVariantChanged(e){const t=e.target;this.selectedMaterialVariant=t.value}_onHotSpotsChanged(e){const t=e.target,i=t.value;t.value="",this.focusHotSpot(i)}_onAnimationSliderChanged(e){this._animationSliderResizeObserver?.disconnect(),e&&(this._animationSliderResizeObserver=new ResizeObserver(()=>{this._showAnimationSlider=e.clientWidth>=80}),this._animationSliderResizeObserver.observe(e))}_createPropertyBinding(e,t,i,s){return{property:e,onInitialized:r=>{t(r).add(()=>{s(r)}),i(r)},updateViewer:()=>{this._viewerDetails&&i(this._viewerDetails)}}}async _setupViewer(){await this._viewerLock.lockAsync(async()=>{if(this._canvasContainer||await this.updateComplete,this._canvasContainer&&!this._viewerDetails){const e=document.createElement("canvas");e.className="full-size canvas",e.setAttribute("touch-action","none"),this._canvasContainer.appendChild(e);{const i=new Vn,s=this,r=await this._createViewer(e,new Proxy(this._options,{get(o,h){switch(h){case"engine":return s.engine??o.engine;case"autoSuspendRendering":return!(s.hasAttribute("render-when-idle")||o.autoSuspendRendering===!1);case"source":return s.getAttribute("source")??o.source;case"environmentLighting":return s.getAttribute("environment-lighting")??s.getAttribute("environment")??o.environmentLighting;case"environmentSkybox":return s.getAttribute("environment-skybox")??s.getAttribute("environment")??o.environmentSkybox;case"environmentConfig":return{intensity:mi(s.getAttribute("environment-intensity"))??o.environmentConfig?.intensity,blur:mi(s.getAttribute("skybox-blur"))??o.environmentConfig?.blur,rotation:mi(s.getAttribute("environment-rotation"))??o.environmentConfig?.rotation};case"shadowConfig":return{quality:n_(s.getAttribute("shadow-quality"))??o.shadowConfig?.quality};case"cameraOrbit":return Tr(s.getAttribute("camera-orbit"))??o.cameraOrbit;case"cameraTarget":return Tr(s.getAttribute("camera-target"))??o.cameraTarget;case"cameraAutoOrbit":return{enabled:s.hasAttribute("camera-auto-orbit")||o.cameraAutoOrbit?.enabled,speed:mi(s.getAttribute("camera-auto-orbit-speed"))??o.cameraAutoOrbit?.speed,delay:mi(s.getAttribute("camera-auto-orbit-delay"))??o.cameraAutoOrbit?.delay};case"animationAutoPlay":return s.hasAttribute("animation-auto-play")||o.animationAutoPlay;case"animationSpeed":return mi(s.getAttribute("animation-speed"))??o.animationSpeed;case"selectedAnimation":return mi(s.getAttribute("selected-animation"))??o.selectedAnimation;case"postProcessing":return{toneMapping:r_(s.getAttribute("tone-mapping"))??o.postProcessing?.toneMapping,contrast:mi(s.getAttribute("contrast"))??o.postProcessing?.contrast,exposure:mi(s.getAttribute("exposure"))??o.postProcessing?.exposure,ssao:s.hasAttribute("ssao")||o.postProcessing?.ssao};case"selectedMaterialVariant":return s.getAttribute("material-variant")??o.selectedMaterialVariant;case"onInitialized":return l=>{o.onInitialized?.(l),i.resolve(l)};case"onFaulted":return l=>{s._isFaultedBacking=!0,o.onFaulted?.(l),s._tearDownViewer()};default:return o[h]}}})),n=await i.promise;this._viewerDetails=Object.assign(n,{viewer:r})}const t=this._viewerDetails;t.viewer.onEnvironmentChanged.add(()=>{this._dispatchCustomEvent("environmentchange",i=>new Event(i))}),t.viewer.onEnvironmentConfigurationChanged.add(()=>{this._dispatchCustomEvent("environmentconfigurationchange",i=>new Event(i))}),t.viewer.onEnvironmentError.add(i=>{this._dispatchCustomEvent("environmenterror",s=>new ErrorEvent(s,{error:i}))}),t.viewer.onShadowsConfigurationChanged.add(()=>{this._dispatchCustomEvent("shadowsconfigurationchange",i=>new Event(i))}),t.viewer.onModelChanged.add(i=>{this._animations=[...t.viewer.animations],this._dispatchCustomEvent("modelchange",s=>new CustomEvent(s,{detail:i}))}),t.viewer.onModelError.add(i=>{this._animations=[...t.viewer.animations],this._dispatchCustomEvent("modelerror",s=>new ErrorEvent(s,{error:i}))}),t.viewer.onLoadingProgressChanged.add(()=>{this._loadingProgress=t.viewer.loadingProgress,this._dispatchCustomEvent("loadingprogresschange",i=>new Event(i))}),t.viewer.onSelectedAnimationChanged.add(()=>{this._dispatchCustomEvent("selectedanimationchange",i=>new Event(i))}),t.viewer.onIsAnimationPlayingChanged.add(()=>{this._isAnimationPlaying=t.viewer.isAnimationPlaying??!1,this._dispatchCustomEvent("animationplayingchange",i=>new Event(i))}),t.viewer.onAnimationProgressChanged.add(()=>{this.animationProgress=t.viewer.animationProgress??0,this._dispatchCustomEvent("animationprogresschange",i=>new Event(i))}),t.viewer.onSelectedMaterialVariantChanged.add(()=>{this._dispatchCustomEvent("selectedmaterialvariantchange",i=>new Event(i))}),t.scene.onAfterRenderCameraObservable.add(()=>{this._dispatchCustomEvent("viewerrender",i=>new Event(i))}),this._propertyBindings.forEach(i=>i.onInitialized(t)),this._dispatchCustomEvent("viewerready",i=>new Event(i))}this._isFaultedBacking=!1})}async _createViewer(e,t){return await ul(e,Object.assign(t,{viewerClass:this._viewerClass}))}async _tearDownViewer(){await this._viewerLock.lockAsync(async()=>{this._viewerDetails&&(this._viewerDetails.viewer.dispose(),this._viewerDetails=void 0),this._loadingProgress=!1,this._canvasContainer&&this._canvasContainer.firstElementChild&&this._canvasContainer.removeChild(this._canvasContainer.firstElementChild)})}async _updateModel(){if(this._viewerDetails)try{this.source?await this._viewerDetails.viewer.loadModel(this.source,{pluginExtension:this.extension??void 0}):await this._viewerDetails.viewer.resetModel()}catch(e){e instanceof Ot||w.Error(e)}}async _updateEnv(e){if(this._viewerDetails)try{const t=[];e.lighting&&e.skybox&&this.environmentLighting===this.environmentSkybox?t.push([this.environmentLighting,{lighting:!0,skybox:!0}]):(e.lighting&&t.push([this.environmentLighting,{lighting:!0}]),e.skybox&&t.push([this.environmentSkybox,{skybox:!0}]));const i=t.map(async([s,r])=>{s?await this._viewerDetails?.viewer.loadEnvironment(s,r):await this._viewerDetails?.viewer.resetEnvironment(r)});await Promise.all(i)}catch(t){t instanceof Ot||w.Error(t)}}async _updateShadows(e){if(e)try{const t={quality:e};await this._viewerDetails?.viewer.updateShadows(t)}catch(t){t instanceof Ot||w.Error(t)}}}Se.styles=sl` + :host { + --ui-foreground-color: white; + --ui-background-hue: 233; + --ui-background-saturation: 8%; + --ui-background-lightness: 39%; + --ui-background-opacity: 0.75; + --ui-background-color: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), var(--ui-background-opacity)); + --ui-background-color-hover: hsla( + var(--ui-background-hue), + var(--ui-background-saturation), + calc(var(--ui-background-lightness) - 10%), + calc(var(--ui-background-opacity) - 0.1) + ); + all: inherit; + overflow: hidden; + } + + .full-size { + display: block; + position: relative; + width: 100%; + height: 100%; + } + + .canvas { + outline: none; + } + + .children-slot { + position: absolute; + top: 0; + background: transparent; + pointer-events: none; + } + + .reload-button { + position: absolute; + top: 50%; + left: 50%; + width: 25%; + transform: translate(-50%, -50%); + color: var(--ui-foreground-color); + background-color: var(--ui-background-color); + border: 1px solid transparent; + border-radius: 24px; + padding: 0; + cursor: pointer; + outline: none; + } + + .reload-button:hover { + background-color: var(--ui-background-color-hover); + } + + .bar { + position: absolute; + width: calc(100% - 24px); + min-width: 370px; + max-width: 1280px; + left: 50%; + transform: translateX(-50%); + background-color: var(--ui-background-color); + } + + .bar-min { + width: unset; + min-width: unset; + max-width: unset; + } + + .loading-progress-outer { + height: 4px; + border-radius: 4px; + border: 1px solid var(--ui-background-color); + outline: none; + top: 12px; + pointer-events: none; + transition: opacity 0.5s ease; + } + + .loading-progress-outer-inactive { + opacity: 0; + /* Set the background color to the foreground color while in the inactive state so that the color seen is correct while fading out the opacity. */ + background-color: var(--ui-foreground-color); + } + + .loading-progress-inner { + width: 0; + height: 100%; + border-radius: inherit; + background-color: var(--ui-foreground-color); + transition: width 0.3s linear; + } + + /* The right side of the inner progress bar starts aligned with the left side of the outer progress bar (container). + So, if the width is 30%, then the left side of the inner progress bar moves a total of 130% of the width of the container. + This is why the first keyframe is at 23% ((100/130)*30). + */ + @keyframes indeterminate { + 0% { + left: 0%; + width: 0%; + } + 23% { + left: 0%; + width: 30%; + } + 77% { + left: 70%; + width: 30%; + } + 100% { + left: 100%; + width: 0%; + } + } + + .loading-progress-inner-indeterminate { + position: absolute; + animation: indeterminate 1.5s infinite; + animation-timing-function: linear; + } + + .tool-bar { + display: flex; + flex-direction: row; + align-items: center; + border-radius: 12px; + border-color: var(--ui-foreground-color); + height: 48px; + bottom: 12px; + color: var(--ui-foreground-color); + -webkit-tap-highlight-color: transparent; + } + + .tool-bar * { + height: 100%; + min-width: 48px; + } + + .tool-bar .divider { + min-width: 1px; + margin: 0px 6px; + height: 66%; + background-color: var(--ui-foreground-color); + } + + .tool-bar select { + background: none; + min-width: 52px; + max-width: 128px; + border: 1px solid transparent; + border-radius: inherit; + color: inherit; + font-size: 14px; + padding: 0px 12px; + cursor: pointer; + outline: none; + appearance: none; /* Remove default styling */ + -webkit-appearance: none; /* Remove default styling for Safari */ + } + + .tool-bar .select-container { + position: relative; + display: flex; + border-radius: inherit; + border-width: 0; + padding: 0; + } + + .tool-bar .select-container select { + position: absolute; + min-width: 0; + width: 100%; + } + + .tool-bar .select-container button { + position: absolute; + border-width: 0; + } + + .tool-bar select:hover, + .tool-bar select:focus { + background-color: var(--ui-background-color-hover); + } + + .tool-bar select option { + background-color: var(--ui-background-color); + color: var(--ui-foreground-color); + } + + .tool-bar select:focus-visible { + border-color: inherit; + } + + .tool-bar button { + background: none; + border: 1px solid transparent; + border-radius: inherit; + color: inherit; + padding: 0; + cursor: pointer; + outline: none; + } + + .tool-bar button:hover { + background-color: var(--ui-background-color-hover); + } + + .tool-bar button:focus-visible { + border-color: inherit; + } + + .tool-bar button svg { + width: 32px; + height: 32px; + } + + .animation-timeline { + display: flex; + flex: 1; + position: relative; + overflow: hidden; + cursor: pointer; + align-items: center; + border-radius: inherit; + border-color: inherit; + } + + .animation-timeline-input { + -webkit-appearance: none; + cursor: pointer; + width: 100%; + height: 100%; + outline: none; + border: 1px solid transparent; + border-radius: inherit; + padding: 0 12px; + background-color: transparent; + } + + .animation-timeline-input:focus-visible { + border-color: inherit; + } + + /*Chrome -webkit */ + + .animation-timeline-input::-webkit-slider-thumb { + -webkit-appearance: none; + width: 20px; + height: 20px; + border: 2px solid; + color: var(--ui-foreground-color); + border-radius: 50%; + background: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), 1); + margin-top: -10px; + } + + .animation-timeline-input::-webkit-slider-runnable-track { + height: 2px; + -webkit-appearance: none; + background-color: var(--ui-foreground-color); + } + + /** FireFox -moz */ + + .animation-timeline-input::-moz-range-progress { + height: 2px; + background-color: var(--ui-foreground-color); + } + + .animation-timeline-input::-moz-range-thumb { + width: 16px; + height: 16px; + border: 2px solid var(--ui-foreground-color); + border-radius: 50%; + background: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), 1); + } + + .animation-timeline-input::-moz-range-track { + height: 2px; + background: var(--ui-foreground-color); + } + `;T([lr()],Se.prototype,"_isFaultedBacking",void 0);T([Be({converter:s_})],Se.prototype,"engine",void 0);T([Be({attribute:"render-when-idle",type:Boolean})],Se.prototype,"renderWhenIdle",void 0);T([Be()],Se.prototype,"source",void 0);T([Be()],Se.prototype,"extension",void 0);T([Be({hasChanged:(a,e)=>a.lighting!==e.lighting||a.skybox!==e.skybox})],Se.prototype,"environment",null);T([Be({attribute:"environment-lighting"})],Se.prototype,"environmentLighting",void 0);T([Be({attribute:"environment-skybox"})],Se.prototype,"environmentSkybox",void 0);T([Be({type:Number,attribute:"environment-intensity"})],Se.prototype,"environmentIntensity",void 0);T([Be({type:Number,attribute:"environment-rotation"})],Se.prototype,"environmentRotation",void 0);T([Be({attribute:"shadow-quality"})],Se.prototype,"shadowQuality",void 0);T([lr()],Se.prototype,"_loadingProgress",void 0);T([Be({attribute:"skybox-blur"})],Se.prototype,"skyboxBlur",void 0);T([Be({attribute:"tone-mapping",converter:a=>!a||!Jh(a)?"neutral":a})],Se.prototype,"toneMapping",void 0);T([Be()],Se.prototype,"contrast",void 0);T([Be()],Se.prototype,"exposure",void 0);T([Be({type:String})],Se.prototype,"ssao",void 0);T([Be({attribute:"clear-color",converter:{fromAttribute:i_,toAttribute:a=>a?a.toHexString():null}})],Se.prototype,"clearColor",void 0);T([Be({attribute:"camera-auto-orbit",type:Boolean})],Se.prototype,"cameraAutoOrbit",void 0);T([Be({attribute:"camera-auto-orbit-speed",type:Number})],Se.prototype,"cameraAutoOrbitSpeed",void 0);T([Be({attribute:"camera-auto-orbit-delay",type:Number})],Se.prototype,"cameraAutoOrbitDelay",void 0);T([Be({attribute:"hotspots",converter:a=>a?JSON.parse(a):{}})],Se.prototype,"hotSpots",void 0);T([Be({attribute:"animation-auto-play",type:Boolean})],Se.prototype,"animationAutoPlay",void 0);T([Be({attribute:"selected-animation",type:Number})],Se.prototype,"selectedAnimation",void 0);T([Be({attribute:"animation-speed"})],Se.prototype,"animationSpeed",void 0);T([Be({attribute:!1})],Se.prototype,"animationProgress",void 0);T([lr()],Se.prototype,"_animations",void 0);T([lr()],Se.prototype,"_isAnimationPlaying",void 0);T([lr()],Se.prototype,"_showAnimationSlider",void 0);T([Be({attribute:"material-variant"})],Se.prototype,"selectedMaterialVariant",void 0);T([Be({attribute:"cameras-as-hotspots",type:Boolean})],Se.prototype,"camerasAsHotSpots",void 0);T([Be({attribute:"reset-mode",converter:a_})],Se.prototype,"resetMode",void 0);T([ll("#canvasContainer")],Se.prototype,"_canvasContainer",void 0);T([ll("#hotSpotSelect")],Se.prototype,"_hotSpotSelect",void 0);let Nr=class extends Se{constructor(e){super(Yn,e)}};Nr=T([hl("babylon-viewer")],Nr);function o_(a,e){customElements.define(a,class extends Nr{constructor(){super(e)}})}let Js=class extends _s{constructor(){super(...arguments),this._internals=this.attachInternals(),this._mutationObserver=new MutationObserver(e=>{e.some(t=>t.type==="childList")&&this._sanitizeInnerHTML()}),this._viewerAttachment=null,this._connectingAbortController=null,this._updateAnnotation=null,this.hotSpot=""}connectedCallback(){super.connectedCallback(),this._internals.states?.add("invalid"),this._connectingAbortController?.abort(),this._connectingAbortController=new AbortController;const e=this._connectingAbortController.signal;(async()=>{if(this.parentElement?.matches(":not(:defined)")&&(await customElements.whenDefined(this.parentElement?.tagName.toLowerCase()),e.aborted))return;if(!(this.parentElement instanceof Se)){console.warn("The babylon-viewer-annotation element must be a child of a babylon-viewer element.");return}this._mutationObserver.observe(this,{childList:!0,characterData:!0}),this._sanitizeInnerHTML();const t=this.parentElement,i=new Kn,s=this._updateAnnotation=()=>{if(this.hotSpot)if(t.queryHotSpot(this.hotSpot,i)){const[r,n]=i.screenPosition;this.style.transform=`translate(${r}px, ${n}px)`,this._internals.states?.delete("invalid"),i.visibility<=0?this._internals.states?.add("back-facing"):this._internals.states?.delete("back-facing")}else this._internals.states?.add("invalid")};this._updateAnnotation(),t.addEventListener("viewerrender",s),this._viewerAttachment={dispose(){t.removeEventListener("viewerrender",s)}}})()}disconnectedCallback(){super.disconnectedCallback(),this._connectingAbortController?.abort(),this._connectingAbortController=null,this._viewerAttachment?.dispose(),this._viewerAttachment=null,this._internals.states?.add("invalid"),this._updateAnnotation=null}render(){return ot`
          ${this.hotSpot}
          `}update(e){super.update(e),e.has("hotSpot")&&this._updateAnnotation?.()}_sanitizeInnerHTML(){this.innerHTML.trim().length===0&&(this.innerHTML="")}};Js.styles=sl` + :host { + --annotation-foreground-color: black; + --annotation-background-color: white; + display: inline-block; + position: absolute; + transition: opacity 0.25s; + } + + :host([hidden]) { + display: none; + } + + :host(:state(back-facing)) { + opacity: 0.2; + } + + :host(:state(invalid)) { + display: none; + } + + .annotation { + transform: translate(-50%, -135%); + font-size: 14px; + padding: 0px 6px; + border-radius: 6px; + color: var(--annotation-foreground-color); + background-color: var(--annotation-background-color); + } + + .annotation::after { + content: ""; + position: absolute; + left: 50%; + height: 60%; + aspect-ratio: 1; + transform: translate(-50%, 110%) rotate(-45deg); + background-color: inherit; + clip-path: polygon(0 0, 100% 100%, 0 100%, 0 0); + } + `;T([Be({attribute:"hotspot"})],Js.prototype,"hotSpot",void 0);Js=T([hl("babylon-viewer-annotation")],Js);const L_=Object.freeze(Object.defineProperty({__proto__:null,ConfigureCustomViewerElement:o_,CreateHotSpotFromCamera:tl,CreateViewerForCanvas:ul,DefaultViewerOptions:Je,get HTML3DAnnotationElement(){return Js},get HTML3DElement(){return Nr},Viewer:Yn,ViewerElement:Se,ViewerHotSpotResult:Kn},Symbol.toStringTag,{value:"Module"}));export{sh as $,H as A,De as B,q as C,ss as D,vh as E,nh as F,Oi as G,oh as H,Et as I,b as J,ah as K,w as L,P as M,Jo as N,O,ka as P,qc as Q,nt as R,We as S,z as T,_h as U,_ as V,ue as W,gh as X,qo as Y,ph as Z,T as _,re as a,ua as a$,Ue as a0,th as a1,jo as a2,rh as a3,$o as a4,eh as a5,Zo as a6,U as a7,Dh as a8,Ih as a9,je as aA,be as aB,Mo as aC,$u as aD,rt as aE,yi as aF,rf as aG,ye as aH,me as aI,j as aJ,y as aK,Bi as aL,Vn as aM,M_ as aN,S_ as aO,Xr as aP,te as aQ,gu as aR,A_ as aS,E_ as aT,b_ as aU,_u as aV,T_ as aW,R_ as aX,xh as aY,ms as aZ,Me as a_,Ph as aa,Bd as ab,Si as ac,Oe as ad,B as ae,At as af,l_ as ag,Q as ah,ge as ai,Gh as aj,C_ as ak,ih as al,u_ as am,qe as an,W as ao,Ai as ap,Te as aq,Hr as ar,k as as,So as at,Dr as au,Lt as av,sf as aw,Ps as ax,js as ay,vl as az,tt as b,zt as b$,yh as b0,J as b1,Kc as b2,m_ as b3,p_ as b4,Yc as b5,gt as b6,hi as b7,co as b8,fe as b9,Ve as bA,Wr as bB,Qt as bC,ve as bD,Rn as bE,g_ as bF,Ks as bG,Xs as bH,sr as bI,Ru as bJ,et as bK,f_ as bL,ja as bM,gr as bN,Ln as bO,Li as bP,xs as bQ,P_ as bR,Kh as bS,Kd as bT,__ as bU,wn as bV,Ir as bW,Dc as bX,ze as bY,d_ as bZ,Eo as b_,ct as ba,kn as bb,Gc as bc,Gr as bd,ie as be,qa as bf,Ct as bg,ae as bh,Ae as bi,qs as bj,nr as bk,ii as bl,Ii as bm,V as bn,tr as bo,Tt as bp,Qa as bq,Rl as br,Au as bs,Eu as bt,bu,Tu as bv,mu as bw,pu as bx,vt as by,Ds as bz,v as c,Cc as c0,Mc as c1,y_ as c2,Un as c3,Za as c4,oi as c5,K as c6,ic as c7,na as c8,sc as c9,ir as ca,Zl as cb,Ac as cc,Ec as cd,Ti as ce,od as cf,sd as cg,bs as ch,gd as ci,nd as cj,Lo as ck,fd as cl,md as cm,pd as cn,Td as co,bd as cp,Uh as cq,Ed as cr,mh as cs,wo as ct,_d as cu,x_ as cv,I_ as cw,L_ as cx,se as d,le as e,qt as f,c_ as g,Bn as h,On as i,tf as j,ud as k,ne as l,$ as m,it as n,F as o,lh as p,fh as q,su as r,R as s,iu as t,It as u,Ne as v,ch as w,hh as x,uh as y,dh as z}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-CglBvmLb.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-CglBvmLb.js new file mode 100644 index 0000000000000000000000000000000000000000..2ea32c25fb558ef9ec302385f2b426c1d023b481 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-CglBvmLb.js @@ -0,0 +1,2 @@ +import{w as qt,p as g,m as Zt,b as ke,f as ge,q as He,i as u,d as Pt,k as Je,u as Ke,s as Qe}from"./i18n-Dnhn5Rxr.js";import{R as st,y as ce,x as f,t as h,a as s,T as lt,u as C,X as m,W as z,w as t,V as q,Y as Z,z as Ue,S as V,a5 as U,a0 as M,a6 as ee,M as Tt,a7 as E}from"./index-DWyDLubb.js";import{r as $e,l as zt}from"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{I as et}from"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{C as tt}from"./Clear-BF6j078A.js";function Pe(a){let e=["","k","M","G","T","P","E","Z"],r=0;for(;a>1e3&&rze(a,e[l],r[l],_[l]));if(typeof r=="object"){const y={};for(const l in r)y[l]=ze(a,e[l],r[l],_[l]);return y}else throw new Error(`Cannot spring ${typeof r} values`)}}function rt(a,e={}){const r=qt(a),{stiffness:_=.15,damping:y=.8,precision:l=.01}=e;let I,o,c,P=a,S=a,R=1,le=0,b=!1;function X(B,T={}){S=B;const ne=c={};return a==null||T.hard||A.stiffness>=1&&A.damping>=1?(b=!0,I=$e.now(),P=B,r.set(a=S),Promise.resolve()):(T.soft&&(le=1/((T.soft===!0?.5:+T.soft)*60),R=0),o||(I=$e.now(),b=!1,o=zt(Y=>{if(b)return b=!1,o=null,!1;R=Math.min(R+le,1);const te=Math.min(Y-I,1e3/30),ae={inv_mass:R,opts:A,settled:!0,dt:te*60/1e3},re=ze(ae,P,a,S);return I=Y,P=a,r.set(a=re),ae.settled&&(o=null),!ae.settled})),new Promise(Y=>{o.promise.then(()=>{ne===c&&Y()})}))}const A={set:X,update:(B,T)=>X(B(S,a),T),subscribe:r.subscribe,stiffness:_,damping:y,precision:l};return A}var It=z('
          ');function St(a,e){st(e,!0);const r=()=>He(o,"$top",y),_=()=>He(c,"$bottom",y),[y,l]=Zt();let I=g(e,"margin",3,!0);const o=rt([0,0]),c=rt([0,0]);let P=C(!1);async function S(){await Promise.all([o.set([125,140]),c.set([-125,-140])]),await Promise.all([o.set([-125,140]),c.set([125,-140])]),await Promise.all([o.set([-125,0]),c.set([125,-0])]),await Promise.all([o.set([125,0]),c.set([-125,0])])}async function R(){await S(),t(P)||R()}async function le(){await Promise.all([o.set([125,0]),c.set([-125,0])]),R()}ce(()=>(le(),()=>{f(P,!0)}));var b=It();let X;var A=q(b),B=q(A),T=m(B);Z(A),Z(b),h(()=>{X=ke(b,1,"svelte-1vhirvf",null,X,{margin:I()}),ge(B,`transform: translate(${r()[0]??""}px, ${r()[1]??""}px);`),ge(T,`transform: translate(${_()[0]??""}px, ${_()[1]??""}px);`)}),s(a,b),lt(),l()}let Le=[],Te=!1;const At=typeof window<"u",nt=At?window.requestAnimationFrame:a=>{};async function Bt(a,e=!0){if(!(window.__gradio_mode__==="website"||window.__gradio_mode__!=="app"&&e!==!0)){if(Le.push(a),!Te)Te=!0;else return;await Tt(),nt(()=>{let r=[0,0];for(let _=0;_ '),Dt=z('
          '),Et=z(" ",1),Rt=z(" ",1),Xt=z('
          '),Gt=z('

          ',1),Nt=z("
          ",1),Ot=z('
          ',1),Wt=z("
          "),Ht=z('
          ',1);function ea(a,e){st(e,!0);let r=g(e,"eta",3,null),_=g(e,"scroll_to_output",3,!1),y=g(e,"timer",3,!0),l=g(e,"show_progress",3,"full"),I=g(e,"message",3,null),o=g(e,"progress",3,null),c=g(e,"variant",3,"default"),P=g(e,"loading_text",3,"Loading..."),S=g(e,"absolute",3,!0),R=g(e,"translucent",3,!1),le=g(e,"border",3,!1),b=g(e,"validation_error",7,null),X=g(e,"show_validation_error",3,!0),A=g(e,"type",3,null),B=g(e,"used_cache",3,null),T=g(e,"cache_duration",3,null),ne=g(e,"avg_time",3,null),Y,te=!1,ae=C(0),re=C(null),me=C(null),Ie=C(!1),xe=C(null),Ve=C(!1),pe=C(!1),Se=C(null),Ae=C(null),Be=C("from cache"),je=C(!1),Me=null,Ce=null;const it=U(()=>!(X()&&b())&&(A()==="input"||!e.status||e.status==="complete"||l()==="hidden"||e.status=="streaming"));let ye=C(0);const ot=U(()=>t(me)===null||t(me)<=0||!t(ye)?0:Math.min(t(ye)/t(me),1)),vt=U(()=>t(ye).toFixed(1));let ut=U(()=>o()==null),Fe=U(()=>r()??t(re));function Ye(){nt(()=>{f(ye,(performance.now()-t(ae))/1e3),te&&Ye()})}let G=U(()=>{let i=null;o()!=null?i=o().map(w=>{if(w.index!=null&&w.length!=null)return w.index/w.length;if(w.progress!=null)return w.progress}):i=null;let d,L="";return i?(d=i[i.length-1],d===0?L="0":L="150ms"):d=void 0,{progress_level:i,last_progress_level:d,progress_bar_transition:L}});function ft(){te||(f(re,f(xe,null),!0),f(ae,performance.now(),!0),te=!0,Ye())}function dt(){f(re,f(xe,null),!0),te&&(te=!1)}ce(()=>{e.status==="pending"?ft():Ue(()=>{dt()})}),ce(()=>{Y&&_()&&(e.status==="pending"||e.status==="complete")&&Bt(Y,e.autoscroll)}),ce(()=>{t(Fe)!=null&&t(re)!==t(Fe)&&(f(me,(performance.now()-t(ae))/1e3+t(Fe)),f(xe,t(me).toFixed(1),!0),f(re,t(Fe),!0))});function _t(){f(Ie,!1)}ce(()=>{Ue(()=>{_t()}),e.status==="error"&&I()&&f(Ie,!0)}),ce(()=>{e.status==="complete"&&A()==="output"&&B()&&T()!=null&&(f(Se,T().toFixed(1),!0),f(Be,B()==="full"?"from cache":"used cache",!0),f(je,ne()!=null&&ne()>T()&&ne()>0,!0),f(Ae,t(je)?ne().toFixed(1):null,!0),f(Ve,!0),f(pe,!1),Me&&clearTimeout(Me),Ce&&clearTimeout(Ce),Me=setTimeout(()=>{f(pe,!0),Ce=setTimeout(()=>{f(Ve,!1),f(pe,!1)},500)},1750))});var De=Ht(),ie=V(De);let Ee,Re;var Xe=q(ie);{var ct=i=>{var d=Yt(),L=q(d),w=m(L),j=q(w);{let D=U(()=>e.i18n?e.i18n("common.clear"):"Clear");et(j,{get Icon(){return tt},get label(){return t(D)},disabled:!1,size:"x-small",background:"var(--background-fill-primary)",color:"var(--error-background-text)",border:"var(--border-color-primary)",onclick:()=>b(null)})}Z(w),Z(d),h(()=>M(L,`${b()??""} `)),s(i,d)};u(Xe,i=>{b()&&X()&&i(ct)})}var gt=m(Xe,2);{var mt=i=>{var d=Nt(),L=V(d);{var w=n=>{var v=Dt();let x;h(()=>x=ge(v,"",x,{transform:`translateX(${(t(ot)||0)*100-100}%)`})),s(n,v)};u(L,n=>{c()==="default"&&t(ut)&&l()==="full"&&n(w)})}var j=m(L,2);let D;var $=q(j);{var he=n=>{var v=ee(),x=V(v);Je(x,17,o,Ke,(O,p)=>{var k=ee(),W=V(k);{var ue=H=>{var J=Et(),fe=V(J);{var Ze=K=>{var se=E();h((be,we)=>M(se,`${be??""}/${we??""}`),[()=>Pe(t(p).index||0),()=>Pe(t(p).length)]),s(K,se)},de=K=>{var se=E();h(be=>M(se,be),[()=>Pe(t(p).index||0)]),s(K,se)};u(fe,K=>{t(p).length!=null?K(Ze):K(de,!1)})}var _e=m(fe);h(()=>M(_e,` ${t(p).unit??""} | `)),s(H,J)};u(W,H=>{t(p).index!=null&&H(ue)})}s(O,k)}),s(n,v)},N=n=>{var v=ee(),x=V(v);{var O=k=>{var W=E();h(()=>M(W,`queue: ${e.queue_position+1}/${e.queue_size??""} |`)),s(k,W)},p=k=>{var W=ee(),ue=V(W);{var H=J=>{var fe=E("processing |");s(J,fe)};u(ue,J=>{e.queue_position===0&&J(H)},!0)}s(k,W)};u(x,k=>{e.queue_position!==null&&e.queue_size!==void 0&&e.queue_position>=0?k(O):k(p,!1)},!0)}s(n,v)};u($,n=>{o()?n(he):n(N,!1)})}var oe=m($,2);{var qe=n=>{var v=E();h(()=>M(v,`${t(vt)??""}${r()?`/${t(xe)}`:""}s`)),s(n,v)};u(oe,n=>{y()&&n(qe)})}Z(j);var ve=m(j,2);{var xt=n=>{var v=Xt(),x=q(v),O=q(x);{var p=H=>{var J=ee(),fe=V(J);Je(fe,17,o,Ke,(Ze,de,_e)=>{var K=ee(),se=V(K);{var be=we=>{var Ge=Rt(),Ne=V(Ge);{var Lt=F=>{var Q=E(" /");s(F,Q)};u(Ne,F=>{_e!==0&&F(Lt)})}var Oe=m(Ne,2);{var kt=F=>{var Q=E();h(()=>M(Q,t(de).desc)),s(F,Q)};u(Oe,F=>{t(de).desc!=null&&F(kt)})}var We=m(Oe,2);{var Vt=F=>{var Q=E("-");s(F,Q)};u(We,F=>{t(de).desc!=null&&t(G).progress_level&&t(G).progress_level[_e]!=null&&F(Vt)})}var jt=m(We,2);{var Mt=F=>{var Q=E();h(Ct=>M(Q,`${Ct??""}%`),[()=>(100*(t(G).progress_level[_e]||0)).toFixed(1)]),s(F,Q)};u(jt,F=>{t(G).progress_level!=null&&F(Mt)})}s(we,Ge)};u(se,we=>{(t(de).desc!=null||t(G).progress_level&&t(G).progress_level[_e]!=null)&&we(be)})}s(Ze,K)}),s(H,J)};u(O,H=>{o()!=null&&H(p)})}Z(x);var k=m(x,2),W=q(k);let ue;Z(k),Z(v),h(()=>ue=ge(W,"",ue,{width:`${t(G).last_progress_level*100}%`,transition:t(G).progress_bar_transition})),s(n,v)},pt=n=>{var v=ee(),x=V(v);{var O=p=>{{let k=U(()=>c()==="default");St(p,{get margin(){return t(k)}})}};u(x,p=>{l()==="full"&&p(O)},!0)}s(n,v)};u(ve,n=>{t(G).last_progress_level!=null?n(xt):n(pt,!1)})}var yt=m(ve,2);{var Ft=n=>{var v=Gt(),x=V(v),O=q(x,!0);Z(x);var p=m(x,2);Qe(p,e,"additional-loading-text",{}),h(()=>M(O,P())),s(n,v)};u(yt,n=>{y()||n(Ft)})}h(()=>D=ke(j,1,"progress-text svelte-1uj8rng",null,D,{"meta-text-center":c()==="center","meta-text":c()==="default"})),s(i,d)},ht=i=>{var d=ee(),L=V(d);{var w=j=>{var D=Ot(),$=V(D),he=q($);{let ve=U(()=>e.i18n("common.clear"));et(he,{get Icon(){return tt},get label(){return t(ve)},disabled:!1,$$events:{click:()=>{e.on_clear_status?.()}}})}Z($);var N=m($,2),oe=q(N,!0);Z(N);var qe=m(N,2);Qe(qe,e,"error",{}),h(ve=>M(oe,ve),[()=>e.i18n("common.error")]),s(j,D)};u(L,j=>{e.status==="error"&&j(w)},!0)}s(i,d)};u(gt,i=>{e.status==="pending"?i(mt):i(ht,!1)})}Z(ie),Pt(ie,i=>Y=i,()=>Y);var bt=m(ie,2);{var wt=i=>{var d=Wt();let L,w;var j=q(d),D=m(j);{var $=N=>{var oe=E();h(()=>M(oe,`~${t(Ae)??""}s + → `)),s(N,oe)};u(D,N=>{t(je)&&N($)})}var he=m(D);Z(d),h(()=>{L=ke(d,1,"cache-indicator svelte-1uj8rng",null,L,{"fade-out":t(pe)}),w=ge(d,"",w,{position:S()?"absolute":"static"}),M(j,`⚡ ${t(Be)??""}: `),M(he,`${t(Se)??""}s`)}),s(i,d)};u(bt,i=>{t(Ve)&&i(wt)})}h(()=>{Ee=ke(ie,1,`wrap ${c()??""} ${l()??""}`,"svelte-1uj8rng",Ee,{"no-click":b()&&X(),hide:t(it),translucent:c()==="center"&&(e.status==="pending"||e.status==="error")||R()||l()==="minimal"||b(),generating:e.status==="generating"&&l()==="full",border:le()}),Re=ge(ie,"",Re,{position:S()?"absolute":"static",padding:S()?"0":"var(--size-8) 0"})}),s(a,De),lt()}export{St as L,ea as S,at as i,rt as s}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-CyHPbdIk.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-CyHPbdIk.css new file mode 100644 index 0000000000000000000000000000000000000000..02fa55c998765f56dc82cc402ffdbdd7ea3e1d02 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-CyHPbdIk.css @@ -0,0 +1 @@ +.gradio-container-6-13-0,.gradio-container-6-13-0 *,.gradio-container-6-13-0 :before,.gradio-container-6-13-0 :after{box-sizing:border-box;border-width:0;border-style:solid}.gradio-container-6-13-0 html{-webkit-text-size-adjust:100%;line-height:1.5;font-family:var(--font-sans);-moz-tab-size:4;tab-size:2}body{margin:0;line-height:inherit}.gradio-container-6-13-0 hr{border-top-width:1px;height:0;color:inherit}.gradio-container-6-13-0 abbr:where([title]){text-decoration:underline dotted}.gradio-container-6-13-0 h1,.gradio-container-6-13-0 h2,.gradio-container-6-13-0 h3,.gradio-container-6-13-0 h4,.gradio-container-6-13-0 h5,.gradio-container-6-13-0 h6{font-weight:inherit;font-size:inherit}.gradio-container-6-13-0 a{color:inherit;text-decoration:inherit}.gradio-container-6-13-0 b,.gradio-container-6-13-0 strong{font-weight:bolder}.gradio-container-6-13-0 code,.gradio-container-6-13-0 kbd,.gradio-container-6-13-0 samp,.gradio-container-6-13-0 pre{font-family:-var(--font-mono)}.gradio-container-6-13-0 small{font-size:80%}.gradio-container-6-13-0 sub,.gradio-container-6-13-0 sup{position:relative;vertical-align:baseline;font-size:75%;line-height:0}.gradio-container-6-13-0 sub{bottom:-.25em}.gradio-container-6-13-0 sup{top:-.5em}.gradio-container-6-13-0 table{border-color:inherit;text-indent:0}.gradio-container-6-13-0 button,.gradio-container-6-13-0 input,.gradio-container-6-13-0 optgroup,.gradio-container-6-13-0 select,.gradio-container-6-13-0 textarea{margin:0;padding:0;color:inherit;font-weight:inherit;font-size:100%;line-height:inherit;font-family:inherit}.gradio-container-6-13-0 button,.gradio-container-6-13-0 select{text-transform:none}.gradio-container-6-13-0 button,.gradio-container-6-13-0 [type=button],.gradio-container-6-13-0 [type=reset],.gradio-container-6-13-0 [type=submit]{-webkit-appearance:button;background-image:none;background-color:transparent}.gradio-container-6-13-0 :-moz-focusring{outline:auto}.gradio-container-6-13-0 :-moz-ui-invalid{box-shadow:none}.gradio-container-6-13-0 progress{vertical-align:baseline}.gradio-container-6-13-0 ::-webkit-inner-spin-button,.gradio-container-6-13-0 ::-webkit-outer-spin-button{height:auto}.gradio-container-6-13-0 [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.gradio-container-6-13-0 ::-webkit-search-decoration{-webkit-appearance:none}.gradio-container-6-13-0 ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.gradio-container-6-13-0 summary{display:list-item}.gradio-container-6-13-0 blockquote,.gradio-container-6-13-0 dl,.gradio-container-6-13-0 dd,.gradio-container-6-13-0 h1,.gradio-container-6-13-0 h2,.gradio-container-6-13-0 h3,.gradio-container-6-13-0 h4,.gradio-container-6-13-0 h5,.gradio-container-6-13-0 h6,.gradio-container-6-13-0 hr,.gradio-container-6-13-0 figure,.gradio-container-6-13-0 p,.gradio-container-6-13-0 pre{margin:0}.gradio-container-6-13-0 fieldset{margin:0;padding:0}.gradio-container-6-13-0 legend{padding:0}.gradio-container-6-13-0 ol,.gradio-container-6-13-0 ul,.gradio-container-6-13-0 menu{margin:0;padding:0}.gradio-container-6-13-0 textarea{resize:vertical}.gradio-container-6-13-0 input::placeholder,.gradio-container-6-13-0 textarea::placeholder{opacity:1;color:--color-var(--color-grey-400)}.gradio-container-6-13-0 button,.gradio-container-6-13-0 [role=button]{cursor:pointer}.gradio-container-6-13-0 :disabled{cursor:default}.gradio-container-6-13-0 img,.gradio-container-6-13-0 svg,.gradio-container-6-13-0 video,.gradio-container-6-13-0 canvas,.gradio-container-6-13-0 audio,.gradio-container-6-13-0 iframe,.gradio-container-6-13-0 embed,.gradio-container-6-13-0 object{display:block;vertical-align:middle}.gradio-container-6-13-0 img,.gradio-container-6-13-0 video{max-width:100%;height:auto;margin:0}.gradio-container-6-13-0 [hidden]{display:none}.gradio-container-6-13-0 [type=text],.gradio-container-6-13-0 [type=email],.gradio-container-6-13-0 [type=url],.gradio-container-6-13-0 [type=password],.gradio-container-6-13-0 [type=number],.gradio-container-6-13-0 [type=date],.gradio-container-6-13-0 [type=datetime-local],.gradio-container-6-13-0 [type=month],.gradio-container-6-13-0 [type=search],.gradio-container-6-13-0 [type=tel],.gradio-container-6-13-0 [type=time],.gradio-container-6-13-0 [type=week],.gradio-container-6-13-0 [multiple],.gradio-container-6-13-0 textarea,.gradio-container-6-13-0 select{--tw-shadow: 0 0 #0000;appearance:none;border-width:1px;border-color:#6b7280;border-radius:0;background-color:#fff;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem}.gradio-container-6-13-0 [type=checkbox],.gradio-container-6-13-0 [type=radio]{color-adjust:exact;display:inline-block;flex-shrink:0;vertical-align:middle;appearance:none;border-width:1px;background-origin:border-box;padding:0;width:1rem;height:1rem;color:#2563eb;user-select:none}.gradio-container-6-13-0 [type=checkbox]:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")}.gradio-container-6-13-0 [type=radio]:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e")}.gradio-container-6-13-0 select{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");background-position:right .5rem center;background-size:1.5em 1.5em;background-repeat:no-repeat;padding-right:2.5rem}.gradio-container-6-13-0 [type=checkbox]:checked,.gradio-container-6-13-0 [type=radio]:checked{background-position:center;background-size:100% 100%;background-repeat:no-repeat}.gradio-container-6-13-0 [type=checkbox]:checked:hover,.gradio-container-6-13-0 [type=checkbox]:checked:focus,.gradio-container-6-13-0 [type=radio]:checked:hover,.gradio-container-6-13-0 [type=radio]:checked:focus{border-color:transparent}.gradio-container-6-13-0 [type=checkbox]:focus-visible,.gradio-container-6-13-0 [type=radio]:focus-visible{outline:none}.gradio-container-6-13-0 gradio-lite{display:flex}.gradio-container-6-13-0 gradio-lite:not(:defined){display:none}.gradio-container-6-13-0 .scroll-hide{-ms-overflow-style:none;scrollbar-width:none}.gradio-container-6-13-0 .sr-only{clip:rect(0,0,0,0);position:absolute;margin:-1px;border-width:0;padding:0;width:1px;height:1px;overflow:hidden;white-space:nowrap}.gradio-container-6-13-0 .scroll-hide::-webkit-scrollbar{display:none}.gradio-container-6-13-0{-webkit-text-size-adjust:100%;line-height:1.5;font-family:var(--font);-moz-tab-size:4;tab-size:4}.gradio-container-6-13-0 .cropper-container{position:relative;-ms-touch-action:none;touch-action:none;font-size:0;line-height:0;direction:ltr;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.gradio-container-6-13-0 .cropper-container img{display:block;image-orientation:0deg;width:100%;min-width:0!important;max-width:none!important;height:100%;min-height:0!important;max-height:none!important}.gradio-container-6-13-0 .cropper-wrap-box,.gradio-container-6-13-0 .cropper-canvas,.gradio-container-6-13-0 .cropper-drag-box,.gradio-container-6-13-0 .cropper-crop-box,.gradio-container-6-13-0 .cropper-modal{position:absolute;inset:0}.gradio-container-6-13-0 .cropper-wrap-box,.gradio-container-6-13-0 .cropper-canvas{overflow:hidden}.gradio-container-6-13-0 .cropper-drag-box{opacity:0;background-color:#fff}.gradio-container-6-13-0 .cropper-modal{opacity:.5;background-color:#000}.gradio-container-6-13-0 .cropper-view-box{display:block;outline:1px solid #39f;outline-color:#3399ffbf;width:100%;height:100%;overflow:hidden}.gradio-container-6-13-0 .cropper-dashed{display:block;position:absolute;opacity:.5;border:0 dashed #eee}.gradio-container-6-13-0 .cropper-dashed.dashed-h{top:calc(100% / 3);left:0;border-top-width:1px;border-bottom-width:1px;width:100%;height:calc(100% / 3)}.gradio-container-6-13-0 .cropper-dashed.dashed-v{top:0;left:calc(100% / 3);border-right-width:1px;border-left-width:1px;width:calc(100% / 3);height:100%}.gradio-container-6-13-0 .cropper-center{display:block;position:absolute;top:50%;left:50%;opacity:.75;width:0;height:0}.gradio-container-6-13-0 .cropper-center:before,.gradio-container-6-13-0 .cropper-center:after{display:block;position:absolute;background-color:#eee;content:" "}.gradio-container-6-13-0 .cropper-center:before{top:0;left:-3px;width:7px;height:1px}.gradio-container-6-13-0 .cropper-center:after{top:-3px;left:0;width:1px;height:7px}.gradio-container-6-13-0 .cropper-face,.gradio-container-6-13-0 .cropper-line,.gradio-container-6-13-0 .cropper-point{display:block;position:absolute;opacity:.1;width:100%;height:100%}.gradio-container-6-13-0 .cropper-face{top:0;left:0;background-color:#fff}.gradio-container-6-13-0 .cropper-line{background-color:#39f}.gradio-container-6-13-0 .cropper-line.line-e{top:0;right:-3px;cursor:ew-resize;width:5px}.gradio-container-6-13-0 .cropper-line.line-n{top:-3px;left:0;cursor:ns-resize;height:5px}.gradio-container-6-13-0 .cropper-line.line-w{top:0;left:-3px;cursor:ew-resize;width:5px}.gradio-container-6-13-0 .cropper-line.line-s{bottom:-3px;left:0;cursor:ns-resize;height:5px}.gradio-container-6-13-0 .cropper-point{opacity:.75;background-color:#39f;width:5px;height:5px}.gradio-container-6-13-0 .cropper-point.point-e{top:50%;right:-3px;cursor:ew-resize;margin-top:-3px}.gradio-container-6-13-0 .cropper-point.point-n{top:-3px;left:50%;cursor:ns-resize;margin-left:-3px}.gradio-container-6-13-0 .cropper-point.point-w{top:50%;left:-3px;cursor:ew-resize;margin-top:-3px}.gradio-container-6-13-0 .cropper-point.point-s{bottom:-3px;left:50%;cursor:s-resize;margin-left:-3px}.gradio-container-6-13-0 .cropper-point.point-ne{top:-3px;right:-3px;cursor:nesw-resize}.gradio-container-6-13-0 .cropper-point.point-nw{top:-3px;left:-3px;cursor:nwse-resize}.gradio-container-6-13-0 .cropper-point.point-sw{bottom:-3px;left:-3px;cursor:nesw-resize}.gradio-container-6-13-0 .cropper-point.point-se{right:-3px;bottom:-3px;opacity:1;cursor:nwse-resize;width:20px;height:20px}@media(min-width:768px){.gradio-container-6-13-0 .cropper-point.point-se{width:15px;height:15px}}@media(min-width:992px){.gradio-container-6-13-0 .cropper-point.point-se{width:10px;height:10px}}@media(min-width:1200px){.gradio-container-6-13-0 .cropper-point.point-se{opacity:.75;width:5px;height:5px}}.gradio-container-6-13-0 .cropper-point.point-se:before{display:block;position:absolute;right:-50%;bottom:-50%;opacity:0;background-color:#39f;width:200%;height:200%;content:" "}.gradio-container-6-13-0 .cropper-invisible{opacity:0}.gradio-container-6-13-0 .cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.gradio-container-6-13-0 .cropper-hide{display:block;position:absolute;width:0;height:0}.gradio-container-6-13-0 .cropper-hidden{display:none!important}.gradio-container-6-13-0 .cropper-move{cursor:move}.gradio-container-6-13-0 .cropper-crop{cursor:crosshair}.gradio-container-6-13-0 .cropper-disabled .cropper-drag-box,.gradio-container-6-13-0 .cropper-disabled .cropper-face,.gradio-container-6-13-0 .cropper-disabled .cropper-line,.gradio-container-6-13-0 .cropper-disabled .cropper-point{cursor:not-allowed}:root{--scale-0: 1rem;--scale-1: 1.125rem;--scale-2: 1.25rem;--scale-3: 1.5rem;--scale-4: 1.875rem;--scale-5: 2.25rem;--scale-6: 3rem;--scale-7: 3.75rem;--scale-8: 4.5rem;--scale-9: 6rem;--scale-10: 8rem;--scale-000: .75rem;--scale-00: .875rem;--scale-fluid-0: clamp(.875rem, .8rem + .25vw, 1rem);--scale-fluid-1: clamp(1rem, .925rem + .25vw, 1.125rem);--scale-fluid-2: clamp(1.125rem, 1.05rem + .25vw, 1.25rem);--scale-fluid-3: clamp(1.25rem, 1.1rem + .5vw, 1.5rem);--scale-fluid-4: clamp(1.5rem, 1.275rem + .75vw, 1.875rem);--scale-fluid-5: clamp(1.875rem, 1.65rem + .75vw, 2.25rem);--scale-fluid-6: clamp(2.25rem, 1.8rem + 1.5vw, 3rem);--scale-fluid-7: clamp(3rem, 2.55rem + 1.5vw, 3.75rem);--scale-fluid-8: clamp(3.75rem, 3.3rem + 1.5vw, 4.5rem);--scale-fluid-9: clamp(4.5rem, 3.6rem + 3vw, 6rem);--scale-fluid-10: clamp(6rem, 4.8rem + 4vw, 8rem);--scale-fluid-000: clamp(.625rem, .55rem + .25vw, .75rem);--scale-fluid-00: clamp(.75rem, .675rem + .25vw, .875rem);--font-sans: IBM Plex Sans, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono: IBM Plex Mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--weight-light: 300;--weight-regular: 400;--weight-medium: 500;--weight-semibold: 600;--weight-bold: 700;--weight-extrabold: 800;--weight-black: 900;--line-none: 1;--line-xs: 1.125;--line-sm: 1.4;--line-md: 1.5;--line-lg: 1.625;--line-xl: 2;--letter-xs: -.05em;--letter-sm: -.025em;--letter-none: 0em;--letter-lg: .025em;--letter-xl: .05em;--prose-xs: 45ch;--prose-sm: 55ch;--prose-md: 65ch;--prose-lg: 75ch;--prose-xl: 85ch;--size-1: 4px;--size-2: 8px;--size-3: 12px;--size-4: 16px;--size-5: 20px;--size-6: 24px;--size-7: 28px;--size-8: 32px;--size-9: 36px;--size-10: 40px;--size-11: 44px;--size-12: 48px;--size-14: 56px;--size-16: 64px;--size-20: 80px;--size-24: 96px;--size-28: 112px;--size-32: 128px;--size-36: 144px;--size-40: 160px;--size-44: 176px;--size-48: 192px;--size-52: 208px;--size-56: 224px;--size-60: 240px;--size-64: 256px;--size-72: 288px;--size-80: 320px;--size-96: 384px;--size-px: 1px;--size-full: 100%;--size-screen: 100vw;--size-min: min-content;--size-max: max-content;--size-0.5: 2px;--size-0-5: 2px;--size-1.5: 6px;--size-1-5: 6px;--size-2.5: 10px;--size-2-5: 10px;--size-screen-h: 100vh;--width-xs: 480px;--width-sm: 640px;--width-md: 768px;--width-lg: 1024px;--width-xl: 1280px;--ratio-square: 1/1;--ratio-portrait: 3/4;--ratio-landscape: 4/3;--ratio-tall: 2/3;--ratio-wide: 3/2;--ratio-widescreen: 16/9;--ratio-golden: 1.618/1;--radius-100: 100%;--radius-xs: 2px;--radius-sm: 4px;--radius-md: 6px;--radius-lg: 8px;--radius-xl: 12px;--radius-full: 9999px;--radius-2xl: 16px;--radius-3xl: 22px;--blur-xs: blur(4px);--blur-sm: blur(8px);--blur-md: blur(16px);--blur-lg: blur(24px);--blur-xl: blur(40px);--layer-1: 10;--layer-2: 20;--layer-3: 30;--layer-4: 40;--layer-5: 50;--layer-below: -1;--layer-top: 2147483647;--shadow-xs: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px 0 rgba(0, 0, 0, .06);--shadow-sm: 0 4px 6px -2px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .06);--shadow-md: 0 12px 16px -4px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);--shadow-lg: 0 20px 24px -4px rgba(0, 0, 0, .1), 0 8px 8px -4px rgba(0, 0, 0, .04);--shadow-xl: 0 24px 48px -12px rgba(0, 0, 0, .25);--ease-in-sine: cubic-bezier(.47, 0, .745, .715);--ease-out-sine: cubic-bezier(.39, .575, .565, 1);--ease-in-out-sine: cubic-bezier(.445, .05, .55, .95);--ease-in-quad: cubic-bezier(.55, .085, .68, .53);--ease-out-quad: cubic-bezier(.25, .46, .45, .94);--ease-in-out-quad: cubic-bezier(.455, .03, .515, .955);--ease-in-cubic: cubic-bezier(.55, .055, .675, .19);--ease-out-cubic: cubic-bezier(.215, .61, .355, 1);--ease-in-out-cubic: cubic-bezier(.645, .045, .355, 1);--ease-in-quart: cubic-bezier(.895, .03, .685, .22);--ease-out-quart: cubic-bezier(.165, .84, .44, 1);--ease-in-out-quart: cubic-bezier(.77, 0, .175, 1);--ease-in-quint: cubic-bezier(.755, .05, .855, .06);--ease-out-quint: cubic-bezier(.23, 1, .32, 1);--ease-in-out-quint: cubic-bezier(.86, 0, .07, 1);--ease-in-expo: cubic-bezier(.95, .05, .795, .035);--ease-out-expo: cubic-bezier(.19, 1, .22, 1);--ease-in-out-expo: cubic-bezier(1, 0, 0, 1);--ease-in-circ: cubic-bezier(.6, .04, .98, .335);--ease-out-circ: cubic-bezier(.075, .82, .165, 1);--ease-in-out-circ: cubic-bezier(.785, .135, .15, .86);--ease-in-back: cubic-bezier(.6, -.28, .735, .045);--ease-out-back: cubic-bezier(.175, .885, .32, 1.275);--ease-in-out-back: cubic-bezier(.68, -.55, .265, 1.55);--color-black: #000;--color-white: #fff;--color-grey-50: #f9fafb;--color-grey-100: #f3f4f6;--color-grey-200: #e5e7eb;--color-grey-300: #d1d5db;--color-grey-400: #9ca3af;--color-grey-500: #6b7280;--color-grey-600: #4b5563;--color-grey-700: #374151;--color-grey-800: #1f2937;--color-grey-900: #111827;--color-grey-950: #0b0f19;--color-grey: #6b7280;--color-slate-50: #f8fafc;--color-slate-100: #f1f5f9;--color-slate-200: #e2e8f0;--color-slate-300: #cbd5e1;--color-slate-400: #94a3b8;--color-slate-500: #64748b;--color-slate-600: #475569;--color-slate-700: #334155;--color-slate-800: #1e293b;--color-slate-900: #0f172a;--color-slate-950: #020617;--color-slate: var(--color-slate-500);--color-zinc-50: #fafafa;--color-zinc-100: #f4f4f5;--color-zinc-200: #e4e4e7;--color-zinc-300: #d4d4d8;--color-zinc-400: #a1a1aa;--color-zinc-500: #71717a;--color-zinc-600: #52525b;--color-zinc-700: #3f3f46;--color-zinc-800: #27272a;--color-zinc-900: #18181b;--color-zinc-950: #09090b;--color-zinc: var(--color-zinc-500);--color-stone-50: #fafaf9;--color-stone-100: #f5f5f4;--color-stone-200: #e7e5e4;--color-stone-300: #d6d3d1;--color-stone-400: #a8a29e;--color-stone-500: #78716c;--color-stone-600: #57534e;--color-stone-700: #44403c;--color-stone-800: #292524;--color-stone-900: #1c1917;--color-stone-950: #0c0a09;--color-stone: var(--color-stone-500);--color-red-50: #fef2f2;--color-red-100: #fee2e2;--color-red-200: #fecaca;--color-red-300: #fca5a5;--color-red-400: #f87171;--color-red-500: #ef4444;--color-red-600: #dc2626;--color-red-700: #b91c1c;--color-red-800: #991b1b;--color-red-900: #7f1d1d;--color-red-950: #63171a;--color-red: #ef4444;--color-orange-50: #fff2e5;--color-orange-100: #ffe5cc;--color-orange-200: #ffd8b4;--color-orange-300: #ffb066;--color-orange-400: #ff9633;--color-orange-500: #ff7c00;--color-orange-600: #ee7400;--color-orange-700: #ce6400;--color-orange-800: #a45000;--color-orange-900: #5c2d00;--color-orange-950: #3c1f00;--color-orange: #f97316;--color-amber-50: #fffbeb;--color-amber-100: #fef3c7;--color-amber-200: #fde68a;--color-amber-300: #fcd34d;--color-amber-400: #fbbf24;--color-amber-500: #f59e0b;--color-amber-600: #d97706;--color-amber-700: #b45309;--color-amber-800: #92400e;--color-amber-900: #78350f;--color-amber-950: #451a03;--color-amber: var(--color-amber-500);--color-yellow-50: #fffbeb;--color-yellow-100: #fff9c2;--color-yellow-200: #fef08a;--color-yellow-300: #fde047;--color-yellow-400: #facc15;--color-yellow-500: #eab308;--color-yellow-600: #ca8a04;--color-yellow-700: #a16207;--color-yellow-800: #854d0e;--color-yellow-900: #713f12;--color-yellow-950: #633112;--color-yellow: #eab308;--color-lime-50: #f7fee7;--color-lime-100: #ecfccb;--color-lime-200: #d9f99d;--color-lime-300: #bef264;--color-lime-400: #a3e635;--color-lime-500: #84cc16;--color-lime-600: #65a30d;--color-lime-700: #4d7c0f;--color-lime-800: #3f6212;--color-lime-900: #365314;--color-lime-950: #1a2e05;--color-lime: var(--color-lime-500);--color-green-50: #ecfdf5;--color-green-100: #d1fae5;--color-green-200: #bbf7d0;--color-green-300: #86efac;--color-green-400: #4ade80;--color-green-500: #22c55e;--color-green-600: #16a34a;--color-green-700: #15803d;--color-green-800: #166534;--color-green-900: #14532d;--color-green-950: #134227;--color-green: #22c55e;--color-teal-50: #f0fdfa;--color-teal-100: #ccfbf1;--color-teal-200: #99f6e4;--color-teal-300: #5eead4;--color-teal-400: #2dd4bf;--color-teal-500: #14b8a6;--color-teal-600: #0d9488;--color-teal-700: #0f766e;--color-teal-800: #115e59;--color-teal-900: #134e4a;--color-teal-950: #042f2e;--color-teal: var(--color-teal-500);--color-cyan-50: #ecfeff;--color-cyan-100: #cffafe;--color-cyan-200: #a5f3fc;--color-cyan-300: #67e8f9;--color-cyan-400: #22d3ee;--color-cyan-500: #06b6d4;--color-cyan-600: #0891b2;--color-cyan-700: #0e7490;--color-cyan-800: #155e75;--color-cyan-900: #164e63;--color-cyan-950: #083344;--color-cyan: var(--color-cyan-500);--color-sky-50: #f0f9ff;--color-sky-100: #e0f2fe;--color-sky-200: #bae6fd;--color-sky-300: #7dd3fc;--color-sky-400: #38bdf8;--color-sky-500: #0ea5e9;--color-sky-600: #0284c7;--color-sky-700: #0369a1;--color-sky-800: #075985;--color-sky-900: #0c4a6e;--color-sky-950: #082f49;--color-sky: var(--color-sky-500);--color-blue-50: #eff6ff;--color-blue-100: #dbeafe;--color-blue-200: #bfdbfe;--color-blue-300: #93c5fd;--color-blue-400: #60a5fa;--color-blue-500: #0ea5e9;--color-blue-600: #2563eb;--color-blue-700: #1d4ed8;--color-blue-800: #1e40af;--color-blue-900: #1e3a8a;--color-blue-950: #1c366b;--color-blue: #0ea5e9;--color-indigo-50: #eef2ff;--color-indigo-100: #e0e7ff;--color-indigo-200: #c7d2fe;--color-indigo-300: #a5b4fc;--color-indigo-400: #818cf8;--color-indigo-500: #6366f1;--color-indigo-600: #4f46e5;--color-indigo-700: #4338ca;--color-indigo-800: #3730a3;--color-indigo-900: #312e81;--color-indigo-950: #1e1b4b;--color-indigo: var(--color-indigo-500);--color-violet-50: #f5f3ff;--color-violet-100: #ede9fe;--color-violet-200: #ddd6fe;--color-violet-300: #c4b5fd;--color-violet-400: #a78bfa;--color-violet-500: #8b5cf6;--color-violet-600: #7c3aed;--color-violet-700: #6d28d9;--color-violet-800: #5b21b6;--color-violet-900: #4c1d95;--color-violet-950: #2e1065;--color-violet: var(--color-violet-500);--color-purple-50: #faf5ff;--color-purple-100: #f3e8ff;--color-purple-200: #e9d5ff;--color-purple-300: #d8b4fe;--color-purple-400: #c084fc;--color-purple-500: #a855f7;--color-purple-600: #9333ea;--color-purple-700: #7e22ce;--color-purple-800: #6b21a8;--color-purple-900: #581c87;--color-purple-950: #3b0764;--color-purple: var(--color-purple-500);--color-fuchsia-50: #fdf4ff;--color-fuchsia-100: #fae8ff;--color-fuchsia-200: #f5d0fe;--color-fuchsia-300: #f0abfc;--color-fuchsia-400: #e879f9;--color-fuchsia-500: #d946ef;--color-fuchsia-600: #c026d3;--color-fuchsia-700: #a21caf;--color-fuchsia-800: #86198f;--color-fuchsia-900: #701a75;--color-fuchsia-950: #4a044e;--color-fuchsia: var(--color-fuchsia-500);--color-pink-50: #fdf2f8;--color-pink-100: #fce7f3;--color-pink-200: #fbcfe8;--color-pink-300: #f9a8d4;--color-pink-400: #f472b6;--color-pink-500: #ec4899;--color-pink-600: #db2777;--color-pink-700: #be185d;--color-pink-800: #9d174d;--color-pink-900: #831843;--color-pink-950: #500724;--color-pink: var(--color-pink-500);--color-rose-50: #fff1f2;--color-rose-100: #ffe4e6;--color-rose-200: #fecdd3;--color-rose-300: #fda4af;--color-rose-400: #fb7185;--color-rose-500: #f43f5e;--color-rose-600: #e11d48;--color-rose-700: #be123c;--color-rose-800: #9f1239;--color-rose-900: #881337;--color-rose-950: #4c0519;--color-rose: var(--color-rose-500);--color-blue-10: #fafcff;--color-grey-10: #fdfdfe;--color-red-10: #fffbfb;--color-green-10: #f9fefc;--color-orange-10: #fffbf6;--color-yellow-10: #fffef8;--grid-2: repeat(2, minmax(0, 1fr));--grid-3: repeat(3, minmax(0, 1fr));--grid-4: repeat(4, minmax(0, 1fr));--grid-5: repeat(5, minmax(0, 1fr));--grid-6: repeat(6, minmax(0, 1fr));--grid-7: repeat(7, minmax(0, 1fr));--grid-8: repeat(8, minmax(0, 1fr));--grid-9: repeat(9, minmax(0, 1fr));--grid-10: repeat(10, minmax(0, 1fr));--grid-11: repeat(11, minmax(0, 1fr));--grid-12: repeat(12, minmax(0, 1fr));--grid-page-width: var(--width-xl);--grid-page-gutter: 5vw;--grid-page-main: 2 / 3;--grid-page: minmax(var(--grid-page-gutter), 1fr) minmax(0, var(--grid-page-width)) minmax(var(--grid-page-gutter), 1fr)}.gradio-container-6-13-0 .prose{font-weight:var(--prose-text-weight);font-size:var(--text-md)}.gradio-container-6-13-0 .prose *{color:var(--body-text-color)}.gradio-container-6-13-0 .prose p{margin-bottom:var(--spacing-sm);line-height:var(--line-lg)}.gradio-container-6-13-0 .prose h1,.gradio-container-6-13-0 .prose h2,.gradio-container-6-13-0 .prose h3,.gradio-container-6-13-0 .prose h4,.gradio-container-6-13-0 .prose h5{margin:var(--spacing-xxl) 0 var(--spacing-lg);font-weight:var(--prose-header-text-weight);line-height:1.3;color:var(--body-text-color)}.gradio-container-6-13-0 .prose>*:first-child{margin-top:0}.gradio-container-6-13-0 .prose h1{font-size:var(--text-xxl)}.gradio-container-6-13-0 .prose h2{font-size:var(--text-xl)}.gradio-container-6-13-0 .prose h3{font-size:var(--text-lg)}.gradio-container-6-13-0 .prose h4{font-size:1.1em}.gradio-container-6-13-0 .prose h5{font-size:1.05em}.gradio-container-6-13-0 .prose ul{list-style:circle inside}.gradio-container-6-13-0 .prose ol{list-style:decimal inside}.gradio-container-6-13-0 .prose ul>p,.gradio-container-6-13-0 .prose li>p{display:inline}.gradio-container-6-13-0 .prose ol,.gradio-container-6-13-0 .prose ul{margin-top:0;padding-left:0}.gradio-container-6-13-0 .prose ul ul,.gradio-container-6-13-0 .prose ul ol,.gradio-container-6-13-0 .prose ol ol,.gradio-container-6-13-0 .prose ol ul{margin:.5em 0;font-size:90%;padding-inline-start:2em}.gradio-container-6-13-0 .prose li{margin-bottom:.5em}.gradio-container-6-13-0 .prose th,.gradio-container-6-13-0 .prose td{border-bottom:1px solid #e1e1e1;padding:var(--text-xs) var(--text-md);text-align:left}.gradio-container-6-13-0 .prose button,.gradio-container-6-13-0 .prose .button,.gradio-container-6-13-0 .prose input,.gradio-container-6-13-0 .prose textarea,.gradio-container-6-13-0 .prose select,.gradio-container-6-13-0 .prose fieldset{margin-bottom:var(--spacing-sm)}.gradio-container-6-13-0 .prose pre,.gradio-container-6-13-0 .prose blockquote,.gradio-container-6-13-0 .prose dl,.gradio-container-6-13-0 .prose figure,.gradio-container-6-13-0 .prose table,.gradio-container-6-13-0 .prose p,.gradio-container-6-13-0 .prose ul,.gradio-container-6-13-0 .prose ol,.gradio-container-6-13-0 .prose form{margin-bottom:var(--spacing-md)}.gradio-container-6-13-0 .prose table,.gradio-container-6-13-0 .prose tr,.gradio-container-6-13-0 .prose td,.gradio-container-6-13-0 .prose th{border:1px solid var(--body-text-color)}.gradio-container-6-13-0 .prose table{border-collapse:collapse;margin-bottom:var(--spacing-xxl)}.gradio-container-6-13-0 .prose a{color:var(--link-text-color);text-decoration:underline}.gradio-container-6-13-0 .prose a:visited{color:var(--link-text-color-visited)}.gradio-container-6-13-0 .prose a:hover{color:var(--link-text-color-hover)}.gradio-container-6-13-0 .prose a:active{color:var(--link-text-color-active)}.gradio-container-6-13-0 .prose hr{margin-top:3em;margin-bottom:3.5em;border-width:0;border-top:1px solid #e1e1e1}.gradio-container-6-13-0 .prose blockquote{margin:var(--size-6) 0!important;border-left:5px solid var(--border-color-primary);padding-left:var(--size-2)}.gradio-container-6-13-0 .prose :last-child{margin-bottom:0!important}.gradio-container-6-13-0 .gradio-style input[type=text],.gradio-container-6-13-0 .gradio-style input[type=number],.gradio-container-6-13-0 .gradio-style textarea{outline:none!important;background:var(--input-background-fill);padding:var(--input-padding);color:var(--body-text-color);font-weight:var(--input-text-weight);font-size:var(--input-text-size);line-height:var(--line-sm);border:var(--input-border-width) solid var(--input-border-color);border-radius:var(--input-radius)}.gradio-container-6-13-0 .gradio-style input[type=text]:disabled,.gradio-container-6-13-0 .gradio-style input[type=number]:disabled,.gradio-container-6-13-0 .gradio-style textarea:disabled{-webkit-opacity:1;opacity:1}.gradio-container-6-13-0 .gradio-style input[type=text]:focus,.gradio-container-6-13-0 .gradio-style input[type=number]:focus,.gradio-container-6-13-0 .gradio-style textarea:focus{box-shadow:var(--input-shadow-focus);border-color:var(--input-border-color-focus);background:var(--input-background-fill-focus)}.gradio-container-6-13-0 .gradio-style input[type=text]::placeholder,.gradio-container-6-13-0 .gradio-style input[type=number]::placeholder,.gradio-container-6-13-0 .gradio-style textarea::placeholder{color:var(--input-placeholder-color)}.gradio-container-6-13-0 .gradio-style button,.gradio-container-6-13-0 .gradio-style a{transition:var(--button-transition);padding:var(--size-0-5) var(--size-2);text-align:center}.gradio-container-6-13-0 .gradio-style button:hover{transform:var(--button-transform-hover)}.gradio-container-6-13-0 .gradio-style button:active,.gradio-container-6-13-0 .gradio-style a:active{transform:var(--button-transform-active)}.gradio-container-6-13-0 .gradio-style button[disabled],.gradio-container-6-13-0 .gradio-style a.disabled{opacity:.5;filter:grayscale(30%);cursor:not-allowed;transform:none}.gradio-container-6-13-0 .gradio-style button{border:var(--button-border-width) solid var(--button-secondary-border-color);background:var(--button-secondary-background-fill);color:var(--button-secondary-text-color);box-shadow:var(--button-secondary-shadow);border-radius:var(--button-large-radius);padding:var(--button-large-padding);font-weight:var(--button-large-text-weight);font-size:var(--button-large-text-size)}.gradio-container-6-13-0 .gradio-style button:hover,.gradio-container-6-13-0 .gradio-style button[disabled]{background:var(--button-secondary-background-fill-hover);color:var(--button-secondary-text-color-hover)}.gradio-container-6-13-0 .gradio-style button:hover{border-color:var(--button-secondary-border-color-hover);box-shadow:var(--button-secondary-shadow-hover)}.gradio-container-6-13-0 .gradio-style button:active{box-shadow:var(--button-secondary-shadow-active)}.gradio-container-6-13-0 .gradio-style button[disabled]{border-color:var(--button-secondary-border-color)}.gradio-container-6-13-0 .gradio-style input[type=checkbox]{--ring-color: transparent;position:relative;box-shadow:var(--checkbox-shadow);border:1px solid var(--checkbox-border-color);border-radius:var(--checkbox-border-radius);background-color:var(--checkbox-background-color);line-height:var(--line-sm)}.gradio-container-6-13-0 .gradio-style input[type=checkbox]:checked,.gradio-container-6-13-0 .gradio-style input[type=checkbox]:checked:hover,.gradio-container-6-13-0 .gradio-style input[type=checkbox]:checked:focus{background-image:var(--checkbox-check);background-color:var(--checkbox-background-color-selected);border-color:var(--checkbox-border-color-focus)}.gradio-container-6-13-0 .gradio-style input[type=checkbox]:checked:focus{background-image:var(--checkbox-check);background-color:var(--checkbox-background-color-selected);border-color:var(--checkbox-border-color-focus)}.gradio-container-6-13-0 .gradio-style input[type=checkbox]:hover{border-color:var(--checkbox-border-color-hover);background-color:var(--checkbox-background-color-hover)}.gradio-container-6-13-0 .gradio-style input[type=checkbox]:focus{border-color:var(--checkbox-border-color-focus);background-color:var(--checkbox-background-color-focus)}.gradio-container-6-13-0 .gradio-style input[type=checkbox]:indeterminate{background-image:none;background-color:var(--checkbox-background-color-selected);border-color:var(--checkbox-border-color-focus);position:relative}.gradio-container-6-13-0 .gradio-style input[type=checkbox]:indeterminate:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:8px;height:2px;background-color:#fff}.gradio-container-6-13-0 .gradio-style input[type=checkbox]:indeterminate:hover{background-color:var(--checkbox-background-color-selected);border-color:var(--checkbox-border-color-hover)}.gradio-container-6-13-0 .gradio-style input[type=checkbox]:indeterminate:focus{background-color:var(--checkbox-background-color-selected);border-color:var(--checkbox-border-color-focus)}.gradio-container-6-13-0 .gradio-style input[type=checkbox][disabled],.gradio-container-6-13-0 .gradio-style input[type=checkbox] .disabled{cursor:not-allowed!important}.gradio-container-6-13-0 .gradio-style input[type=checkbox]:hover{cursor:pointer}.gradio-container-6-13-0 .gradio-style input[type=radio]{--ring-color: transparent;position:relative;box-shadow:var(--checkbox-shadow);border:var(--checkbox-border-width) solid var(--checkbox-border-color);border-radius:var(--radius-full);background-color:var(--checkbox-background-color);line-height:var(--line-sm)}.gradio-container-6-13-0 .gradio-style input[type=radio]:checked,.gradio-container-6-13-0 .gradio-style input[type=radio]:checked:hover{border-color:var(--checkbox-border-color-selected);background-image:var(--radio-circle);background-color:var(--checkbox-background-color-selected)}.gradio-container-6-13-0 .gradio-style input[type=radio]:checked:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);border-radius:50%;background-color:#fff}.gradio-container-6-13-0 .gradio-style input[type=radio]:hover{border-color:var(--checkbox-border-color-hover);background-color:var(--checkbox-background-color-hover)}.gradio-container-6-13-0 .gradio-style input[type=radio]:focus{border-color:var(--checkbox-border-color-focus);background-color:var(--checkbox-background-color-focus)}.gradio-container-6-13-0 .gradio-style input[type=radio]:checked:focus{border-color:var(--checkbox-border-color-focus);background-image:var(--radio-circle);background-color:var(--checkbox-background-color-selected)}.gradio-container-6-13-0 .gradio-style input[type=radio] input[disabled],.gradio-container-6-13-0 .gradio-style input[type=radio] .disabled{cursor:not-allowed} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-DEPmb5JS.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-DEPmb5JS.css new file mode 100644 index 0000000000000000000000000000000000000000..3518ef9b9ef9d8f8d73b1a48c58443e109b31e11 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-DEPmb5JS.css @@ -0,0 +1 @@ +.mic-select.svelte-ym1wxn{height:var(--size-8);background:var(--block-background-fill);padding:0px var(--spacing-xxl);border-radius:var(--button-large-radius);font-size:var(--text-md);border:1px solid var(--block-border-color);gap:var(--size-1)}select.svelte-ym1wxn{text-overflow:ellipsis;max-width:var(--size-40)}@media(max-width:375px){select.svelte-ym1wxn{width:100%}}.controls.svelte-1xuh0j1{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap}.wrapper.svelte-1xuh0j1{display:flex;align-items:center;flex-wrap:wrap}.record.svelte-1xuh0j1{margin-right:var(--spacing-md)}.stop-button-paused.svelte-1xuh0j1{display:none;height:var(--size-8);width:var(--size-20);background-color:var(--block-background-fill);border-radius:var(--button-large-radius);align-items:center;border:1px solid var(--block-border-color);margin:var(--size-1) var(--size-1) 0 0}.stop-button-paused.svelte-1xuh0j1:before{content:"";height:var(--size-4);width:var(--size-4);border-radius:var(--radius-full);background:var(--primary-600);margin:0 var(--spacing-xl)}.stop-button.svelte-1xuh0j1:before{content:"";height:var(--size-4);width:var(--size-4);border-radius:var(--radius-full);background:var(--primary-600);margin:0 var(--spacing-xl);animation:svelte-1xuh0j1-scaling 1.8s infinite}.stop-button.svelte-1xuh0j1{display:none;height:var(--size-8);width:var(--size-20);background-color:var(--block-background-fill);border-radius:var(--button-large-radius);align-items:center;border:1px solid var(--primary-600);margin:var(--size-1) var(--size-1) 0 0}.record-button.svelte-1xuh0j1:before{content:"";height:var(--size-4);width:var(--size-4);border-radius:var(--radius-full);background:var(--primary-600);margin:0 var(--spacing-xl)}.record-button.svelte-1xuh0j1{height:var(--size-8);background-color:var(--block-background-fill);border-radius:var(--button-large-radius);display:flex;align-items:center;border:1px solid var(--block-border-color);padding-right:var(--spacing-xl)}.duration-button.svelte-1xuh0j1{border-radius:var(--button-large-radius)}.stop-button.svelte-1xuh0j1:disabled{cursor:not-allowed}.record-button.svelte-1xuh0j1:disabled{cursor:not-allowed;opacity:.5}@keyframes svelte-1xuh0j1-scaling{0%{background-color:var(--primary-600);scale:1}50%{background-color:var(--primary-600);scale:1.2}to{background-color:var(--primary-600);scale:1}}.pause-button.svelte-1xuh0j1{display:none;height:var(--size-8);width:var(--size-20);border:1px solid var(--block-border-color);border-radius:var(--button-large-radius);padding:var(--spacing-md);margin:var(--size-1) var(--size-1) 0 0}.resume-button.svelte-1xuh0j1{display:none;height:var(--size-8);width:var(--size-20);border:1px solid var(--block-border-color);border-radius:var(--button-large-radius);padding:var(--spacing-xl);line-height:1px;font-size:var(--text-md);margin:var(--size-1) var(--size-1) 0 0}.duration.svelte-1xuh0j1{display:flex;height:var(--size-8);width:var(--size-20);border:1px solid var(--block-border-color);padding:var(--spacing-md);align-items:center;justify-content:center;margin:var(--size-1) var(--size-1) 0 0}::part(region){border-radius:var(--radius-md);height:98%!important;border:1px solid var(--trim-region-color);background-color:unset;border-width:1px 3px}::part(region):after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background:var(--trim-region-color);opacity:.2;border-radius:var(--radius-md)}::part(region-handle){width:5px!important;border:none}.microphone.svelte-j9q3sk{width:100%;display:none}.component-wrapper.svelte-j9q3sk{padding:var(--size-3);width:100%}.timestamps.svelte-j9q3sk{display:flex;justify-content:space-between;align-items:center;width:100%;padding:var(--size-1) 0;margin:var(--spacing-md) 0}.time.svelte-j9q3sk,.duration.svelte-j9q3sk{color:var(--neutral-400)}.trim-duration.svelte-j9q3sk{color:var(--color-accent);margin-right:var(--spacing-sm)}.controls.svelte-m6ymia{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap}.mic-wrap.svelte-m6ymia{display:block;align-items:center;margin:var(--spacing-xl)}.icon.svelte-m6ymia{width:var(--size-4);height:var(--size-4);fill:var(--primary-600);stroke:var(--primary-600)}.stop-button-paused.svelte-m6ymia{display:none;height:var(--size-8);width:var(--size-20);background-color:var(--block-background-fill);border-radius:var(--button-large-radius);align-items:center;border:1px solid var(--block-border-color);margin-right:5px}.stop-button-paused.svelte-m6ymia:before{content:"";height:var(--size-4);width:var(--size-4);border-radius:var(--radius-full);background:var(--primary-600);margin:0 var(--spacing-xl)}.stop-button.svelte-m6ymia:before{content:"";height:var(--size-4);width:var(--size-4);border-radius:var(--radius-full);background:var(--primary-600);margin:0 var(--spacing-xl);animation:svelte-m6ymia-scaling 1.8s infinite}.stop-button.svelte-m6ymia{height:var(--size-8);width:var(--size-20);background-color:var(--block-background-fill);border-radius:var(--button-large-radius);align-items:center;border:1px solid var(--primary-600);margin-right:5px;display:flex}.spinner-button.svelte-m6ymia{height:var(--size-8);width:var(--size-24);background-color:var(--block-background-fill);border-radius:var(--radius-3xl);align-items:center;border:1px solid var(--primary-600);margin:0 var(--spacing-xl);display:flex;justify-content:space-evenly}.record-button.svelte-m6ymia:before{content:"";height:var(--size-4);width:var(--size-4);border-radius:var(--radius-full);background:var(--primary-600);margin:0 var(--spacing-xl)}.record-button.svelte-m6ymia{height:var(--size-8);width:var(--size-24);background-color:var(--block-background-fill);border-radius:var(--button-large-radius);display:flex;align-items:center;border:1px solid var(--block-border-color)}@keyframes svelte-m6ymia-scaling{0%{background-color:var(--primary-600);scale:1}50%{background-color:var(--primary-600);scale:1.2}to{background-color:var(--primary-600);scale:1}}.audio-container.svelte-ocxd3m{height:calc(var(--size-full) - var(--size-6));display:flex;flex-direction:column;justify-content:space-between} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-DUwqQ_4P.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-DUwqQ_4P.js new file mode 100644 index 0000000000000000000000000000000000000000..685db15746bc2e8e9a93b14b9ca6ef5b0fa5ee02 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-DUwqQ_4P.js @@ -0,0 +1 @@ +import{P as L,N as $,a as E,D as j,b as y,T as S,I as G}from"./Code-BLWhl1y6.js";var N={};class v{constructor(t,e,s,i,h,r,n,o,a,u=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=a,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new v(t,[],e,s,s,0,[],0,i?new R(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&r.buffer[n-4]==0&&r.buffer[n-1]>-1){if(e==s)return;if(r.buffer[n-2]>=e){r.buffer[n-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i,!r.stateFlag(h,1)&&(i>s||e<=r.maxNode)&&(this.reducePos=i),this.pushState(h,Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}else this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4)}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new v(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new U(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;ho&1&&n==r)||i.push(e[h],r)}e=i}let s=[];for(let i=0;i>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,a=this.stack.length-n*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e0&&this.emitLookAhead()}}class R{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class U{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class A{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new A(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new A(this.stack,this.pos,this.index)}}function x(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,n=!0),h+=o,n)break;h*=46}e?e[i++]=h:e=new t(h)}return e}class P{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const z=new P;class H{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=z,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;for(;hs.to:h>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e=this.chunk2Pos&&sn.to&&(this.chunk2=this.chunk2.slice(0,n.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=z,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;O(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class W{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(O(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(h||i++,r==null)break;t.reset(r,t.token)}i&&(t.reset(s,t.token),t.acceptToken(this.elseToken,i))}}W.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class Z{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function O(l,t,e,s,i,h){let r=0,n=1<0){let p=l[c];if(o.allows(p)&&(t.token.value==-1||t.token.value==p||q(p,t.token.value,i,h))){t.acceptToken(p);break}}let u=t.next,f=0,d=l[r+2];if(t.next<0&&d>f&&l[a+d*3-3]==65535){r=l[a+d*3-1];continue t}for(;f>1,p=a+c+(c<<1),b=l[p],M=l[p+1]||65536;if(u=M)f=c+1;else{r=l[p+2],t.advance();continue t}}break}}function I(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function q(l,t,e,s){let i=I(e,s,t);return i<0||I(e,s,l)t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class J{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?D(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?D(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(h instanceof S){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(h),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+h.length}}}class K{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new P)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let a=0;af.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let d=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!u.extend&&(s=f,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new P,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new P,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r=0&&s.p.parser.dialect.allows(n>>1)){(n&1)==0?t.value=n>>1:t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;ht.bufferLength*4?new J(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;re)s.push(n);else{if(this.advanceStack(n,s,t))continue;{i||(i=[],h=[]),i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}}break}}if(!s.length){let r=i&&X(i);if(r)return g&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw g&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r)return g&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((n,o)=>o.score-n.score);s.length>r;)s.pop();s.some(n=>n.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r500&&a.buffer.length>500)if((n.score-a.score||n.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&(s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,u=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?h.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!a||(f.prop(y.contextHash)||0)==u))return t.useNode(f,d),g&&console.log(r+this.stackID(t)+` (via reuse of ${h.getName(f.type.id)})`),!0;if(!(f instanceof S)||f.children.length==0||f.positions[0]>0)break;let c=f.children[0];if(c instanceof S&&f.positions[0]==0)f=c;else break}}let n=h.stateSlot(t.state,4);if(n>0)return t.reduce(n),g&&console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;ai?e.push(p):s.push(p)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return B(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r ":"";if(n.deadEnd&&(h||(h=!0,n.restart(),g&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,s))))continue;let f=n.split(),d=u;for(let c=0;c<10&&f.forceReduce()&&(g&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));c++)g&&(d=this.stackID(f)+" -> ");for(let c of n.recoverByInsert(o))g&&console.log(u+this.stackID(c)+" (via recover-insert)"),this.advanceFully(c,s);this.stream.end>n.pos?(a==n.pos&&(a++,o=0),n.recoverByDelete(o,a),g&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`),B(n,s)):(!i||i.scorel;class _{constructor(t){this.start=t.start,this.shift=t.shift||C,this.reduce=t.reduce||C,this.reuse=t.reuse||C,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class w extends L{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;nt.topRules[n][1]),i=[];for(let n=0;n=0)h(u,o,n[a++]);else{let f=n[a+-u];for(let d=-u;d>0;d--)h(n[a++],o,f);a++}}}this.nodeSet=new $(e.map((n,o)=>E.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=j;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;ntypeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new Q(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let a=h+(r>>1);h0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];e.some((h,r)=>r&1&&h==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(w.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(h=>h.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find(n=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=F(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);r>=0&&(s[r]=!0)}let i=null;for(let h=0;hs)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.scorel.external(e,s)<<1|t}return l.get}export{_ as C,Z as E,w as L,W as a}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-DWyDLubb.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-DWyDLubb.js new file mode 100644 index 0000000000000000000000000000000000000000..f2a391ceb9e7f69ea5b6737b4c87d3c8db977a54 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-DWyDLubb.js @@ -0,0 +1,45 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Index-BJAly1p_.js","./i18n-Dnhn5Rxr.js","./i18n-9kYrHpuJ.css","./index-CglBvmLb.js","./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js","./html-Ih_5QVTo.js","./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js","./snippet-BWgYNF9D.js","./ScrollFade-DV-0xzhB.css","./index-B_pwUImq.js","./StreamingBar-CMuqaV2j.css","./Clear-BF6j078A.js","./Index-CI7BqPz-.css","./index-DkrWwIux.js","./index-tFQomdd2.js","./utils.svelte-CCyS_0CY.js","./clone-BkeCM4Nl.js"])))=>i.map(i=>d[i]); +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();const ps="modulepreload",vs=function(e,t){return new URL(e,t).href},jn={},ht=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let h=function(f){return Promise.all(f.map(l=>Promise.resolve(l).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");s=h(n.map(f=>{if(f=vs(f,r),f in jn)return;jn[f]=!0;const l=f.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(r)for(let v=o.length-1;v>=0;v--){const p=o[v];if(p.href===f&&(!l||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${u}`))return;const d=document.createElement("link");if(d.rel=l?"stylesheet":ps,l||(d.as="script"),d.crossOrigin="",d.href=f,c&&d.setAttribute("nonce",c),document.head.appendChild(d),l)return new Promise((v,p)=>{d.addEventListener("load",v),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},ms="host",or="queue/data",gs="queue/join",Mn="upload",ws="login",Nt="config",ys="info",bs="runtime",Es="sleeptime",Ss="heartbeat",ks="component_server",Ts="reset",As="cancel",xs="app_id",ar="This application is currently busy. Please try again. ",Se="Connection errored out. ",Ee="Could not resolve app config. ",$s="Could not get space status. ",Os="Could not get API info. ",wn="Space metadata could not be loaded. ",Rs="Invalid URL. A full URL path is required.",Cs="Not authorized to access this space. ",lr="Invalid credentials. Could not login. ",Ns="Login credentials are required to access this space.",Ps="File system access is only available in Node.js environments",cr="Root URL not found in client config",Ls="Error uploading file";async function Un(e,t,n){try{return(await(await fetch(`https://huggingface.co/api/spaces/${e}/jwt`,{headers:{Authorization:`Bearer ${t}`,...n?{Cookie:n}:{}}})).json()).token||!1}catch{return!1}}function Is(e){let t={};return e.forEach(({api_name:n,id:r})=>{n&&(t[n]=r)}),t}async function Ds(e){const t=this.options.token?{Authorization:`Bearer ${this.options.token}`}:{};if(t["Content-Type"]="application/json",typeof window<"u"&&window.gradio_config&&location.origin!=="http://localhost:9876"){if(window.gradio_config.current_page&&(e=e.substring(0,e.lastIndexOf("/"))),window.gradio_config.dev_mode||typeof window<"u"&&window?.BUILD_MODE==="dev"){let n=sn(e,this.deep_link?Nt+"?deep_link="+this.deep_link:Nt);const r=await this.fetch(n,{headers:t,credentials:"include"}),s=await qn(r,!!this.options.auth);s.root=e||s.root,window.gradio_config={...s,current_page:window.gradio_config.current_page}}return{...window.gradio_config}}else if(e){let n=sn(e,this.deep_link?Nt+"?deep_link="+this.deep_link:Nt);const r=await this.fetch(n,{headers:t,credentials:"include"}),s=await qn(r,!!this.options.auth);return s.root||(s.root=e),s}throw new Error(Ee)}async function qn(e,t){if(e?.status===401&&!t){const r=(await e.json())?.detail?.auth_message;throw new Error(r||Ns)}else if(e?.status===401&&t)throw new Error(lr);if(e?.status===200){let n=await e.json();return n.dependencies?.forEach((r,s)=>{r.id===void 0&&(r.id=s)}),n}else if(e?.status===401)throw new Error(Cs);throw new Error(Ee)}async function js(){const{http_protocol:e,host:t}=await bn(this.app_reference,this.options.token);try{if(this.options.auth){const n=await ur(e,t,this.options.auth,this.fetch,this.options.token);n&&this.set_cookies(n)}}catch(n){throw Error(n.message)}}async function ur(e,t,n,r,s){const i=new FormData;i.append("username",n?.[0]),i.append("password",n?.[1]);let o={};s&&(o.Authorization=`Bearer ${s}`);const a=await r(`${e}//${t}/${ws}`,{headers:o,method:"POST",body:i,credentials:"include"});if(a.status===200)return a.headers.get("set-cookie");throw a.status===401?new Error(lr):new Error(wn)}function en(e){if(e.startsWith("http")){const{protocol:t,host:n,pathname:r}=new URL(e);return{ws_protocol:t==="https:"?"wss":"ws",http_protocol:t,host:n+(r!=="/"?r:"")}}return{ws_protocol:"wss",http_protocol:"https:",host:new URL(e).host}}const fr=e=>{let t=[];return e.split(/,(?=\s*[^\s=;]+=[^\s=;]+)/).forEach(r=>{const[s,i]=r.split(";")[0].split("=");s&&i&&t.push(`${s.trim()}=${i.trim()}`)}),t},yn=/^[a-zA-Z0-9_\-\.]+\/[a-zA-Z0-9_\-\.]+$/,Ms=/.*hf\.space\/{0,1}.*$/;async function bn(e,t){const n={};t&&(n.Authorization=`Bearer ${t}`);const r=e.trim().replace(/\/$/,"");if(yn.test(r))try{const i=(await(await fetch(`https://huggingface.co/api/spaces/${r}/${ms}`,{headers:n})).json()).host;return{space_id:e,...en(i)}}catch{throw new Error(wn)}if(Ms.test(r)){const{ws_protocol:s,http_protocol:i,host:o}=en(r);return{space_id:o.split("/")[0].replace(".hf.space",""),ws_protocol:s,http_protocol:i,host:o}}return{space_id:!1,...en(r)}}const sn=(...e)=>{try{return e.reduce((t,n)=>(t=t.replace(/\/+$/,""),n=n.replace(/^\/+/,""),new URL(n,t+"/").toString()))}catch{throw new Error(Rs)}};function Us(e,t,n){const r={named_endpoints:{},unnamed_endpoints:{}};return Object.keys(e).forEach(s=>{(s==="named_endpoints"||s==="unnamed_endpoints")&&(r[s]={},Object.entries(e[s]).forEach(([i,{parameters:o,returns:a}])=>{const c=t.dependencies.find(l=>l.api_name===i||l.api_name===i.replace("/",""))?.id||n[i.replace("/","")]||-1,h=c!==-1?t.dependencies.find(l=>l.id==c)?.types:{generator:!1,cancel:!1};if(c!==-1&&t.dependencies.find(l=>l.id==c)?.inputs?.length!==o.length){const l=t.dependencies.find(u=>u.id==c).inputs.map(u=>t.components.find(d=>d.id===u)?.type);try{l.forEach((u,d)=>{if(u==="state"){const v={component:"state",example:null,parameter_default:null,parameter_has_default:!0,parameter_name:null,hidden:!0};o.splice(d,0,v)}})}catch(u){console.error(u)}}const f=(l,u,d,v)=>({...l,description:Fs(l?.type,d),type:qs(l?.type,u,d,v)||""});r[s][i]={parameters:o.map(l=>f(l,l?.component,l?.serializer,"parameter")),returns:a.map(l=>f(l,l?.component,l?.serializer,"return")),type:h}}))}),r}function qs(e,t,n,r){if(t==="Api")return e.type;switch(e?.type){case"string":return"string";case"boolean":return"boolean";case"number":return"number"}if(n==="JSONSerializable"||n==="StringSerializable")return"any";if(n==="ListStringSerializable")return"string[]";if(t==="Image")return r==="parameter"?"Blob | File | Buffer":"string";if(n==="FileSerializable")return e?.type==="array"?r==="parameter"?"(Blob | File | Buffer)[]":"{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]":r==="parameter"?"Blob | File | Buffer":"{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}";if(n==="GallerySerializable")return r==="parameter"?"[(Blob | File | Buffer), (string | null)][]":"[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]"}function Fs(e,t){return t==="GallerySerializable"?"array of [file, label] tuples":t==="ListStringSerializable"?"array of strings":t==="FileSerializable"?"array of files or single file":e?.description}function Fn(e,t){switch(e.msg){case"send_data":return{type:"data"};case"send_hash":return{type:"hash"};case"queue_full":return{type:"update",status:{queue:!0,message:ar,stage:"error",code:e.code,success:e.success}};case"heartbeat":return{type:"heartbeat"};case"unexpected_error":return{type:"unexpected_error",status:{queue:!0,message:e.message,session_not_found:e.session_not_found,stage:"error",success:!1}};case"broken_connection":return{type:"broken_connection",status:{queue:!0,message:e.message,stage:"error",success:!1}};case"estimation":return{type:"update",status:{queue:!0,stage:t||"pending",code:e.code,size:e.queue_size,position:e.rank,eta:e.rank_eta,success:e.success}};case"progress":return{type:"update",status:{queue:!0,stage:"pending",code:e.code,progress_data:e.progress_data,success:e.success}};case"log":return{type:"log",data:e};case"process_generating":return{type:"generating",status:{queue:!0,message:e.success?null:e.output.error,stage:e.success?"generating":"error",code:e.code,progress_data:e.progress_data,eta:e.average_duration,changed_state_ids:e.success?e.output.changed_state_ids:void 0},data:e.success?e.output:null};case"process_streaming":return{type:"streaming",status:{queue:!0,message:e.output.error,stage:"streaming",time_limit:e.time_limit,code:e.code,progress_data:e.progress_data,eta:e.eta},data:e.output};case"process_completed":return"error"in e.output?{type:"update",status:{queue:!0,title:e.output.title??"Error",message:e.output.error??"An error occurred",visible:e.output.visible,duration:e.output.duration,stage:"error",code:e.code,success:e.success}}:{type:"complete",status:{queue:!0,message:e.success?void 0:e.output.error,stage:e.success?"complete":"error",code:e.code,progress_data:e.progress_data,changed_state_ids:e.success?e.output.changed_state_ids:void 0,used_cache:e.used_cache,cache_duration:e.cache_duration,avg_time:e.avg_time},data:e.success?e.output:null};case"process_starts":return{type:"update",status:{queue:!0,stage:"pending",code:e.code,size:e.rank,position:0,success:e.success,eta:e.eta},original_msg:"process_starts"}}return{type:"none",status:{stage:"error",queue:!0}}}const zs=(e=[],t)=>{const n=t?t.parameters:[];if(Array.isArray(e))return t&&n.length>0&&e.length>n.length&&console.warn("Too many arguments provided for the endpoint."),e;const r=[],s=Object.keys(e);return n.forEach((i,o)=>{if(e.hasOwnProperty(i.parameter_name))r[o]=e[i.parameter_name];else if(i.parameter_has_default)r[o]=i.parameter_default;else throw new Error(`No value provided for required parameter: ${i.parameter_name}`)}),s.forEach(i=>{if(!n.some(o=>o.parameter_name===i))throw new Error(`Parameter \`${i}\` is not a valid keyword argument. Please refer to the API for usage.`)}),r.forEach((i,o)=>{if(i===void 0&&!n[o].parameter_has_default)throw new Error(`No value provided for required parameter: ${n[o].parameter_name}`)}),r};async function Bs(){if(this.api_info)return this.api_info;const{token:e}=this.options,{config:t}=this,n={"Content-Type":"application/json"};if(e&&(n.Authorization=`Bearer ${e}`),!!t)try{let r,s;if(typeof window<"u"&&window.gradio_api_info)s=window.gradio_api_info;else{const i=sn(t.root,this.api_prefix,ys);if(r=await this.fetch(i,{headers:n,credentials:"include"}),!r.ok)throw new Error(Se);s=await r.json()}return"api"in s&&(s=s.api),s.named_endpoints["/predict"]&&!s.unnamed_endpoints[0]&&(s.unnamed_endpoints[0]=s.named_endpoints["/predict"]),Us(s,t,this.api_map)}catch(r){throw new Error("Could not get API info. "+r.message)}}async function Gs(e,t,n){const r={};this?.options?.token&&(r.Authorization=`Bearer ${this.options.token}`);const s=1e3,i=[];let o;for(let a=0;a{h.append("files",l)});try{const l=n?`${e}${this.api_prefix}/${Mn}?upload_id=${n}`:`${e}${this.api_prefix}/${Mn}`;o=await this.fetch(l,{method:"POST",body:h,headers:r,credentials:"include"})}catch(l){throw new Error(Se+l.message)}if(!o.ok){const l=await o.text();return{error:`HTTP ${o.status}: ${l}`}}const f=await o.json();f&&i.push(...f)}return{files:i}}const Hs={radix:1e3,unit:["b","kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"]},Vs={radix:1024,unit:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"]},Ys={radix:1024,unit:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"]},zn={si:Hs,iec:Vs,jedec:Ys};function Ws(e,t=1,n="jedec"){e=Math.abs(e);const{radix:r,unit:s}=zn[n]||zn.jedec;let i=0;for(;e>=r;)e/=r,++i;return`${e.toFixed(t)} ${s[i]}`}async function Ks(e,t,n,r){let s=(Array.isArray(e)?e:[e]).map(o=>o.blob);const i=s.filter(o=>o.size>(r??1/0));if(i.length)throw new Error(`File(s) exceed the maximum allowed size of ${Ws(r||1/0)}: ${i.map(o=>`"${o.name}"`).join(", ")}`);return await Promise.all(await this.upload_files(t,s,n).then(async o=>{if(o.error)throw new Error(o.error);return o.files?o.files.map((a,c)=>new Ft({...e[c],path:a,url:`${t}${this.api_prefix}/file=${a}`})):[]}))}async function ia(e,t){return e.map(n=>new Ft({path:n.name,orig_name:n.name,blob:n,size:n.size,mime_type:n.type,is_stream:t}))}class Ft{path;url;orig_name;size;blob;is_stream;mime_type;alt_text;b64;meta={_type:"gradio.FileData"};constructor({path:t,url:n,orig_name:r,size:s,blob:i,is_stream:o,mime_type:a,alt_text:c,b64:h}){this.path=t,this.url=n,this.orig_name=r,this.size=s,this.blob=n?void 0:i,this.is_stream=o,this.mime_type=a,this.alt_text=c,this.b64=h}}class Js{type;command;meta;fileData;constructor(t,n){this.type="command",this.command=t,this.meta=n}}typeof process<"u"&&process.versions&&process.versions.node;function Bn(e,t,n){for(;n.length>1;){const s=n.shift();if(typeof s=="string"||typeof s=="number")e=e[s];else throw new Error("Invalid key type")}const r=n.shift();if(typeof r=="string"||typeof r=="number")e[r]=t;else throw new Error("Invalid key type")}async function on(e,t=void 0,n=[],r=!1,s=void 0){if(Array.isArray(e)){let i=[];return await Promise.all(e.map(async(o,a)=>{let c=n.slice();c.push(String(a));const h=await on(e[a],r?s?.parameters[a]?.component||void 0:t,c,!1,s);i=i.concat(h)})),i}else{if(globalThis.Buffer&&e instanceof globalThis.Buffer||e instanceof Blob)return[{path:n,blob:new Blob([e]),type:t}];if(typeof e=="object"&&e!==null){let i=[];for(const o of Object.keys(e)){const a=[...n,o],c=e[o];i=i.concat(await on(c,void 0,a,!1,s))}return i}}return[]}function Zs(e,t){let n=t?.dependencies?.find(r=>r.id==e)?.queue;return n!=null?!n:!t.enable_queue}function Xs(e,t){return new Promise((n,r)=>{const s=new MessageChannel;s.port1.onmessage=(({data:i})=>{s.port1.close(),n(i)}),window.parent.postMessage(e,t,[s.port2])})}function Pt(e,t,n,r,s=!1){if(r==="input"&&!s)throw new Error("Invalid code path. Cannot skip state inputs for input.");if(r==="output"&&s)return e;let i=[],o=0;const a=r==="input"?t.inputs:t.outputs;for(let c=0;cl.id===h)?.type==="state"){if(s)if(e.length===a.length){const l=e[o];i.push(l),o++}else i.push(null);else{o++;continue}continue}else{const l=e[o];i.push(l),o++}}return i}async function Qs(e,t,n){const r=this;await ei(r,t);const s=await on(t,void 0,[],!0,n);return(await Promise.all(s.map(async({path:o,blob:a,type:c})=>{if(!a)return{path:o,type:c};const h=await r.upload_files(e,[a]),f=h.files&&h.files[0];return{path:o,file_url:f,type:c,name:typeof File<"u"&&a instanceof File?a?.name:void 0}}))).forEach(({path:o,file_url:a,type:c,name:h})=>{if(c==="Gallery")Bn(t,a,o);else if(a){const f=new Ft({path:a,orig_name:h});Bn(t,f,o)}}),t}async function ei(e,t){if(!(e.config?.root||e.config?.root_url))throw new Error(cr);await dr(e,t)}async function dr(e,t,n=[]){for(const r in t)t[r]instanceof Js?await ti(e,t,r):typeof t[r]=="object"&&t[r]!==null&&await dr(e,t[r],[...n,r])}async function ti(e,t,n){let r=t[n];const s=e.config?.root||e.config?.root_url;if(!s)throw new Error(cr);try{let i,o;if(typeof process<"u"&&process.versions&&process.versions.node){const f=await ht(()=>import("./__vite-browser-external-D7Ct-6yo.js").then(u=>u._),[],import.meta.url);o=(await ht(()=>import("./__vite-browser-external-D7Ct-6yo.js").then(u=>u._),[],import.meta.url)).resolve(process.cwd(),r.meta.path),i=await f.readFile(o)}else throw new Error(Ps);const a=new Blob([i],{type:"application/octet-stream"}),c=await e.upload_files(s,[a]),h=c.files&&c.files[0];if(h){const f=new Ft({path:h,orig_name:r.meta.name||""});t[n]=f}}catch(i){console.error(Ls,i)}}async function ni(e,t,n){const r={"Content-Type":"application/json"};this.options.token&&(r.Authorization=`Bearer ${this.options.token}`);try{var s=await this.fetch(e,{method:"POST",body:JSON.stringify(t),headers:{...r,...n},credentials:"include"})}catch{return[{error:Se},500]}let i,o;try{i=await s.json(),o=s.status}catch(a){i={error:`Could not parse server response: ${a}`},o=500}return[i,o]}async function ri(e,t={}){let n=!1,r=!1;if(!this.config)throw new Error("Could not resolve app config");if(typeof e=="number")this.config.dependencies.find(s=>s.id==e);else{const s=e.replace(/^\//,"");this.config.dependencies.find(i=>i.id==this.api_map[s])}return new Promise(async(s,i)=>{const o=this.submit(e,t,null,null,!0);let a;for await(const c of o)c.type==="data"&&(r&&s(a),n=!0,a=c),c.type==="status"&&(c.stage==="error"&&i(c),c.stage==="complete"&&(r=!0,n&&s(a)))})}async function _t(e,t,n){let r=t==="subdomain"?`https://huggingface.co/api/spaces/by-subdomain/${e}`:`https://huggingface.co/api/spaces/${e}`,s,i;try{if(s=await fetch(r),i=s.status,i!==200)throw new Error;s=await s.json()}catch{n({status:"error",load_status:"error",message:$s,detail:"NOT_FOUND"});return}if(!s||i!==200)return;const{runtime:{stage:o},id:a}=s;switch(o){case"STOPPED":case"SLEEPING":n({status:"sleeping",load_status:"pending",message:"Space is asleep. Waking it up...",detail:o}),setTimeout(()=>{_t(e,t,n)},1e3);break;case"PAUSED":n({status:"paused",load_status:"error",message:"This space has been paused by the author. If you would like to try this demo, consider duplicating the space.",detail:o,discussions_enabled:await Gn(a)});break;case"RUNNING":case"RUNNING_BUILDING":n({status:"running",load_status:"complete",message:"Space is running.",detail:o});break;case"BUILDING":n({status:"building",load_status:"pending",message:"Space is building...",detail:o}),setTimeout(()=>{_t(e,t,n)},1e3);break;case"APP_STARTING":n({status:"starting",load_status:"pending",message:"Space is starting...",detail:o}),setTimeout(()=>{_t(e,t,n)},1e3);break;default:n({status:"space_error",load_status:"error",message:"This space is experiencing an issue.",detail:o,discussions_enabled:await Gn(a)});break}}const hr=async(e,t)=>{let n=0;const r=12,s=5e3;return new Promise(i=>{_t(e,yn.test(e)?"space_name":"subdomain",o=>{t(o),o.status==="running"||o.status==="error"||o.status==="paused"||o.status==="space_error"?i():(o.status==="sleeping"||o.status==="building")&&(n{hr(e,t).then(i)},s)):i())})})},si=/^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;async function Gn(e){try{const t=await fetch(`https://huggingface.co/api/spaces/${e}/discussions`,{method:"HEAD"}),n=t.headers.get("x-error-message");return!(!t.ok||n&&si.test(n))}catch{return!1}}async function ii(e,t){const n={};t&&(n.Authorization=`Bearer ${t}`);try{const r=await fetch(`https://huggingface.co/api/spaces/${e}/${bs}`,{headers:n});if(r.status!==200)throw new Error("Space hardware could not be obtained.");const{hardware:s}=await r.json();return s.current}catch(r){throw new Error(r.message)}}async function oi(e,t,n){const r={};n&&(r.Authorization=`Bearer ${n}`);const s={seconds:t};try{const i=await fetch(`https://huggingface.co/api/spaces/${e}/${Es}`,{method:"POST",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(s)});if(i.status!==200)throw new Error("Could not set sleep timeout on duplicated Space. Please visit *ADD HF LINK TO SETTINGS* to set a timeout manually to reduce billing charges.");return await i.json()}catch(i){throw new Error(i.message)}}const Hn=["cpu-basic","cpu-upgrade","cpu-xl","t4-small","t4-medium","a10g-small","a10g-large","a10g-largex2","a10g-largex4","a100-large","zero-a10g","h100","h100x8"];async function ai(e,t){const{token:n,private:r,hardware:s,timeout:i,auth:o}=t;if(s&&!Hn.includes(s))throw new Error(`Invalid hardware type provided. Valid types are: ${Hn.map(m=>`"${m}"`).join(",")}.`);const{http_protocol:a,host:c}=await bn(e,n);let h=null;if(o){const m=await ur(a,c,o,fetch);m&&(h=fr(m))}const f={Authorization:`Bearer ${n}`,"Content-Type":"application/json",...h?{Cookie:h.join("; ")}:{}},l=(await(await fetch("https://huggingface.co/api/whoami-v2",{headers:f})).json()).name,u=e.split("/")[1],d={repository:`${l}/${u}`};r&&(d.private=!0);let v;try{s||(v=await ii(e,n))}catch(m){throw Error(wn+m.message)}const p=s||v||"cpu-basic";d.hardware=p;try{const m=await fetch(`https://huggingface.co/api/spaces/${e}/duplicate`,{method:"POST",headers:f,body:JSON.stringify(d)});if(m.status===409)try{return await It.connect(`${l}/${u}`,t)}catch(Ce){throw console.error("Failed to connect Client instance:",Ce),Ce}else if(m.status!==200)throw new Error(m.statusText);const U=await m.json();return await oi(`${l}/${u}`,i||300,n),await It.connect(li(U.url),t)}catch(m){throw new Error(m)}}function li(e){const t=/https:\/\/huggingface.co\/spaces\/([^/]+\/[^/]+)/,n=e.match(t);if(n)return n[1]}const Vn="supports-zerogpu-headers";let Yn=!1;function ci(){return typeof window<"u"&&typeof document<"u"&&typeof window.addEventListener=="function"}function _r(e){return e.includes(".dev.")?`https://moon-${e.split(".")[1]}.dev.spaces.huggingface.tech`:e.endsWith(".hf.space")?"https://huggingface.co":null}function ui(){if(!ci()||Yn)return;window.addEventListener("message",t=>{t.data===Vn&&(window.supports_zerogpu_headers=!0)}),Yn=!0;const e=_r(window.location.hostname);e&&window.parent!==window&&window.parent.postMessage(Vn,e)}class fi extends TransformStream{#e="";constructor(t={allowCR:!1}){super({transform:(n,r)=>{for(n=this.#e+n;;){const s=n.indexOf(` +`),i=t.allowCR?n.indexOf("\r"):-1;if(i!==-1&&i!==n.length-1&&(s===-1||s-1>i)){r.enqueue(n.slice(0,i)),n=n.slice(i+1);continue}if(s===-1)break;const o=n[s-1]==="\r"?s-1:s;r.enqueue(n.slice(0,o)),n=n.slice(s+1)}this.#e=n},flush:n=>{if(this.#e==="")return;const r=t.allowCR&&this.#e.endsWith("\r")?this.#e.slice(0,-1):this.#e;n.enqueue(r)}})}}function di(e){let t=new TextDecoderStream,n=new fi({allowCR:!0});return e.pipeThrough(t).pipeThrough(n)}function hi(e){let n=/[:]\s*/.exec(e),r=n&&n.index;if(r)return[e.substring(0,r),e.substring(r+n[0].length)]}function Wn(e,t,n){e.get(t)||e.set(t,n)}async function*_i(e,t){if(!e.body)return;let n=di(e.body),r,s=n.getReader(),i;for(;;){if(t&&t.aborted)return s.cancel();if(r=await s.read(),r.done)return;if(!r.value){i&&(yield i),i=void 0;continue}let[o,a]=hi(r.value)||[];o==="data"?(i||={},i[o]=i[o]?i[o]+` +`+a:a):o==="event"?(i||={},i[o]=a):o==="id"?(i||={},i[o]=String(+a)===a?+a:a):o==="retry"&&(i||={},i[o]=+a||void 0)}}async function pi(e,t){let n=new Request(e,t);Wn(n.headers,"Accept","text/event-stream"),Wn(n.headers,"Content-Type","application/json");let r=await fetch(n);if(!r.ok)throw r;return _i(r,n.signal)}async function vi(){let{event_callbacks:e,unclosed_events:t,pending_stream_messages:n,stream_status:r,config:s,jwt:i}=this;const o=this;if(!s)throw new Error("Could not resolve app config");r.open=!0;let a=null,c=new URLSearchParams({session_hash:this.session_hash}).toString(),h=new URL(`${s.root}${this.api_prefix}/${or}?${c}`);if(i&&h.searchParams.set("__sign",i),a=this.stream(h),!a){console.warn("Cannot connect to SSE endpoint: "+h.toString());return}a.onmessage=async function(f){let l=JSON.parse(f.data);if(l.msg==="close_stream"){En(r,o.abort_controller);return}const u=l.event_id;if(!u)await Promise.all(Object.keys(e).map(d=>e[d](l)));else if(e[u]&&s){l.msg==="process_completed"&&["sse","sse_v1","sse_v2","sse_v2.1","sse_v3"].includes(s.protocol)&&t.delete(u);let d=e[u];typeof window<"u"&&typeof document<"u"?setTimeout(d,0,l):d(l)}else n[u]||(n[u]=[]),n[u].push(l)},a.onerror=async function(f){console.error(f),await Promise.all(Object.keys(e).map(l=>e[l]({msg:"broken_connection",message:Se})))}}function En(e,t){e&&(e.open=!1,t?.abort())}function mi(e,t,n){!e[t]?(e[t]=[],n.data.forEach((s,i)=>{e[t][i]=s})):n.data.forEach((s,i)=>{let o=gi(e[t][i],s);e[t][i]=o,n.data[i]=o})}function gi(e,t){return t.forEach(([n,r,s])=>{e=wi(e,r,n,s)}),e}function wi(e,t,n,r){if(t.length===0){if(n==="replace")return r;if(n==="append")return e+r;throw new Error(`Unsupported action: ${n}`)}let s=e;for(let o=0;o{console.warn("Method not implemented.")},onerror:null,onmessage:null,onopen:null,readyState:0,url:e.toString(),withCredentials:!1,CONNECTING:0,OPEN:1,CLOSED:2,addEventListener:()=>{throw new Error("Method not implemented.")},dispatchEvent:()=>{throw new Error("Method not implemented.")},removeEventListener:()=>{throw new Error("Method not implemented.")}};return pi(e,t).then(async r=>{n.readyState=n.OPEN;try{for await(const s of r)n.onmessage&&n.onmessage(s);n.readyState=n.CLOSED}catch(s){n.onerror&&n.onerror(s),n.readyState=n.CLOSED}}).catch(r=>{console.error(r),n.onerror&&n.onerror(r),n.readyState=n.CLOSED}),n}function bi(e,t={},n,r,s,i){try{let o=function(E){(s||ls[E.type])&&f(E)},a=function(){for(ds=!0;ut.length>0;)ut.shift()({value:void 0,done:!0})},c=function(E){ut.length>0?ut.shift()(E):Xt.push(E)},h=function(E){c(Ei(E)),a()},f=function(E){c({value:E,done:!1})},l=function(){return Xt.length>0?Promise.resolve(Xt.shift()):new Promise(E=>ut.push(E))};const{token:u}=this.options,{fetch:d,app_reference:v,config:p,session_hash:m,api_info:U,api_map:Ce,stream_status:Ge,pending_stream_messages:He,pending_diff_streams:Ne,event_callbacks:Jt,unclosed_events:is,post_data:Zt,options:Ot,api_prefix:me}=this,Nn=i||{"x-gradio-user":"api"},os=this;if(!U)throw new Error("No API found");if(!p)throw new Error("Could not resolve app config");let{fn_index:b,endpoint_info:Pn,dependency:lt}=Si(U,e,Ce,p),as=zs(t,Pn),Ve,ge=p.protocol??"ws";if(ge==="ws")throw new Error("WebSocket protocol is not supported in this version");let Ye="",sa=()=>Ye;const S=typeof e=="number"?"/predict":e;let Rt,P=null,we=!1,Ln={},ct=typeof window<"u"&&typeof document<"u"?new URLSearchParams(window.location.search).toString():"";const ls=Ot?.events?.reduce((E,oe)=>(E[oe]=!0,E),{})||{};async function cs(){let E={},oe={};E={event_id:P},oe={event_id:P,session_hash:m,fn_index:b};try{if(!p)throw new Error("Could not resolve app config");"event_id"in oe&&await d(`${p.root}${me}/${As}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(oe)}),await d(`${p.root}${me}/${Ts}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(E)})}catch{console.warn("The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable.")}}const us=async E=>{await this._resolve_heartbeat(E)};async function In(E){if(!p)return;let oe=E.render_id;p.components=[...p.components.filter(I=>I.props.rendered_in!==oe),...E.components],p.dependencies=[...p.dependencies.filter(I=>I.rendered_in!==oe),...E.dependencies];const Ct=p.components.some(I=>I.type==="state"),O=p.dependencies.some(I=>I.targets.some(We=>We[1]==="unload"));p.connect_heartbeat=Ct||O,await us(p),o({type:"render",data:E,endpoint:S,fn_index:b})}const fs=this.handle_blob(p.root,as,Pn).then(async E=>{if(Rt={data:Pt(E,lt,p.components,"input",!0)||[],event_data:n,fn_index:b,trigger_id:r},Zs(b,p))o({type:"status",endpoint:S,stage:"pending",queue:!1,fn_index:b,time:new Date}),Zt(`${p.root}${me}/run${S.startsWith("/")?S:`/${S}`}${ct?"?"+ct:""}`,{...Rt,session_hash:m},Nn).then(async([O,I])=>{const We=O.data;if(I==200)o({type:"data",endpoint:S,fn_index:b,data:Pt(We,lt,p.components,"output",Ot.with_null_state),time:new Date,event_data:n,trigger_id:r}),O.render_config&&await In(O.render_config),o({type:"status",endpoint:S,fn_index:b,stage:"complete",eta:O.average_duration,queue:!1,time:new Date});else{const ae=O?.error===Se;o({type:"status",stage:"error",endpoint:S,fn_index:b,message:O.error,broken:ae,queue:!1,time:new Date})}}).catch(O=>{o({type:"status",stage:"error",message:O.message,endpoint:S,fn_index:b,queue:!1,time:new Date})});else if(ge=="sse"){o({type:"status",stage:"pending",queue:!0,endpoint:S,fn_index:b,time:new Date});var Ct=new URLSearchParams({fn_index:b.toString(),session_hash:m}).toString();let O=new URL(`${p.root}${me}/${or}?${ct?ct+"&":""}${Ct}`);if(this.jwt&&O.searchParams.set("__sign",this.jwt),Ve=this.stream(O),!Ve)return Promise.reject(new Error("Cannot connect to SSE endpoint: "+O.toString()));Ve.onmessage=async function(I){const We=JSON.parse(I.data),{type:ae,status:ye,data:R}=Fn(We,Ln[b]);if(ae==="update"&&ye&&!we)o({type:"status",endpoint:S,fn_index:b,time:new Date,...ye}),ye.stage==="error"&&(Ve?.close(),a());else if(ae==="data"){let[Ke,Pe]=await Zt(`${p.root}${me}/queue/data`,{...Rt,session_hash:m,event_id:P});Pe!==200&&(o({type:"status",stage:"error",message:Se,queue:!0,endpoint:S,fn_index:b,time:new Date}),Ve?.close(),a())}else ae==="complete"?we=ye:ae==="log"?o({type:"log",title:R.title,log:R.log,level:R.level,endpoint:S,duration:R.duration,visible:R.visible,fn_index:b}):(ae==="generating"||ae==="streaming")&&o({type:"status",time:new Date,...ye,stage:ye?.stage,queue:!0,endpoint:S,fn_index:b});R&&(o({type:"data",time:new Date,data:Pt(R.data,lt,p.components,"output",Ot.with_null_state),endpoint:S,fn_index:b,event_data:n,trigger_id:r}),we&&(o({type:"status",time:new Date,...we,stage:ye?.stage,queue:!0,endpoint:S,fn_index:b}),Ve?.close(),a()))}}else if(ge=="sse_v1"||ge=="sse_v2"||ge=="sse_v2.1"||ge=="sse_v3"){o({type:"status",stage:"pending",queue:!0,endpoint:S,fn_index:b,time:new Date});let O="";typeof window<"u"&&typeof document<"u"&&(O=window?.location?.hostname);const I=_r(O);return(typeof window<"u"&&typeof document<"u"&&window.parent!=window&&!!I&&window.supports_zerogpu_headers?Xs("zerogpu-headers",I):Promise.resolve(null)).then(R=>{const Ke={...Nn,...R||{}};return Zt(`${p.root}${me}/${gs}?${ct}`,{...Rt,session_hash:m},Ke)}).then(async([R,Ke])=>{if(R.event_id&&(Ye=R.event_id),Ke===503)o({type:"status",stage:"error",message:ar,queue:!0,endpoint:S,fn_index:b,time:new Date,visible:!0});else if(Ke===422)o({type:"status",stage:"error",message:R.detail,queue:!0,endpoint:S,fn_index:b,code:"validation_error",time:new Date,visible:!0}),a();else if(Ke!==200){const Pe=R?.error===Se;o({type:"status",stage:"error",broken:Pe,message:Pe?Se:R.detail||R.error,queue:!0,endpoint:S,fn_index:b,time:new Date,visible:!0})}else{P=R.event_id,Ye=P;let Pe=async function(Qt){try{const{type:H,status:V,data:Y,original_msg:hs}=Fn(Qt,Ln[b]);if(H=="heartbeat")return;if(H==="update"&&V&&!we)o({type:"status",endpoint:S,fn_index:b,time:new Date,original_msg:hs,...V});else if(H==="complete")we=V;else if(H=="unexpected_error"||H=="broken_connection"){console.error("Unexpected error",V?.message);const _s=H==="broken_connection";o({type:"status",stage:"error",message:V?.message||"An Unexpected Error Occurred!",queue:!0,endpoint:S,broken:_s,session_not_found:V?.session_not_found,fn_index:b,time:new Date})}else if(H==="log"){o({type:"log",title:Y.title,log:Y.log,level:Y.level,endpoint:S,duration:Y.duration,visible:Y.visible,fn_index:b});return}else(H==="generating"||H==="streaming")&&(o({type:"status",time:new Date,...V,stage:V?.stage,queue:!0,endpoint:S,fn_index:b}),Y&<.connection!=="stream"&&["sse_v2","sse_v2.1","sse_v3"].includes(ge)&&mi(Ne,P,Y));Y&&(o({type:"data",time:new Date,data:Pt(Y.data,lt,p.components,"output",Ot.with_null_state),endpoint:S,fn_index:b}),Y.render_config&&await In(Y.render_config),we&&(o({type:"status",time:new Date,...we,stage:V?.stage,queue:!0,endpoint:S,fn_index:b}),a())),(V?.stage==="complete"||V?.stage==="error")&&(Jt[P]&&delete Jt[P],P in Ne&&delete Ne[P])}catch(H){console.error("Unexpected client exception",H),o({type:"status",stage:"error",message:"An Unexpected Error Occurred!",queue:!0,endpoint:S,fn_index:b,time:new Date}),["sse_v2","sse_v2.1","sse_v3"].includes(ge)&&(En(Ge,os.abort_controller),Ge.open=!1,a())}};P in He&&(He[P].forEach(Qt=>Pe(Qt)),delete He[P]),Jt[P]=Pe,is.add(P),Ge.open||await this.open_stream()}})}});let ds=!1;const Xt=[],ut=[],Dn={[Symbol.asyncIterator]:()=>Dn,next:l,throw:async E=>(h(E),l()),return:async()=>(a(),{value:void 0,done:!0}),cancel:cs,send_chunk:E=>{this.post_data(`${p.root}${me}/stream/${Ye}`,{...E,session_hash:this.session_hash})},close_stream:()=>{this.post_data(`${p.root}${me}/stream/${Ye}/close`,{}),a()},event_id:()=>Ye,wait_for_id:async()=>(await fs,P)};return Dn}catch(o){throw console.error("Submit function encountered an error:",o),o}}function Ei(e){return{then:(t,n)=>n(e)}}function Si(e,t,n,r){let s,i,o;if(typeof t=="number")s=t,i=e.unnamed_endpoints[s],o=r.dependencies.find(a=>a.id==t);else{const a=t.replace(/^\//,"");s=n[a],i=e.named_endpoints[t.trim()],o=r.dependencies.find(c=>c.id==n[a])}if(typeof s!="number")throw new Error("There is no endpoint matching that name of fn_index matching that number.");return{fn_index:s,endpoint_info:i,dependency:o}}class It{app_reference;options;deep_link=null;config;api_prefix="";api_info;api_map={};session_hash=Math.random().toString(36).substring(2);jwt=!1;last_status={};cookies=null;stream_status={open:!1};closed=!1;pending_stream_messages={};pending_diff_streams={};event_callbacks={};unclosed_events=new Set;heartbeat_event=null;abort_controller=null;stream_instance=null;current_payload;get_url_config(t=null){if(!this.config)throw new Error(Ee);t===null&&(t=window.location.href);const n=o=>o.replace(/^\/+|\/+$/g,"");let r=n(new URL(this.config.root).pathname),s=n(new URL(t).pathname),i;return s.startsWith(r)?i=n(s.substring(r.length)):i="",this.get_page_config(i)}get_page_config(t){if(!this.config)throw new Error(Ee);let n=this.config;return t in n.page||(t=""),{...n,current_page:t,layout:n.page[t].layout,components:n.components.filter(r=>n.page[t].components.includes(r.id)),dependencies:this.config.dependencies.filter(r=>n.page[t].dependencies.includes(r.id))}}fetch(t,n){const r=new Headers(n?.headers||{});return this&&this.cookies&&r.append("Cookie",this.cookies),this&&this.options.headers&&new Headers(this.options.headers).forEach((i,o)=>{r.append(o,i)}),fetch(t,{...n,headers:r})}stream(t){const n=new Headers;return this&&this.cookies&&n.append("Cookie",this.cookies),this&&this.options.headers&&new Headers(this.options.headers).forEach((s,i)=>{n.append(i,s)}),this&&this.options.token&&n.append("Authorization",`Bearer ${this.options.token}`),this.abort_controller=new AbortController,this.stream_instance=yi(t.toString(),{credentials:"include",headers:n,signal:this.abort_controller.signal}),this.stream_instance}view_api;upload_files;upload;handle_blob;post_data;submit;predict;open_stream;resolve_config;resolve_cookies;constructor(t,n={events:["data"]}){this.app_reference=t,this.deep_link=n.query_params?.deep_link||null,n.events||(n.events=["data"]),this.options=n,this.current_payload={},n.cookies&&(this.cookies=n.cookies),this.view_api=Bs.bind(this),this.upload_files=Gs.bind(this),this.handle_blob=Qs.bind(this),this.post_data=ni.bind(this),this.submit=bi.bind(this),this.predict=ri.bind(this),this.open_stream=vi.bind(this),this.resolve_config=Ds.bind(this),this.resolve_cookies=js.bind(this),this.upload=Ks.bind(this),this.fetch=this.fetch.bind(this),this.handle_space_success=this.handle_space_success.bind(this),this.stream=this.stream.bind(this)}async init(){ui(),this.options.auth&&await this.resolve_cookies(),await this._resolve_config().then(({config:t})=>this._resolve_heartbeat(t)),this.api_info=await this.view_api(),this.api_map=Is(this.config?.dependencies||[])}async _resolve_heartbeat(t){if(t&&(this.config=t,this.api_prefix=t.api_prefix||"",this.config&&this.config.connect_heartbeat&&this.config.space_id&&this.options.token&&(this.jwt=await Un(this.config.space_id,this.options.token,this.cookies))),t.space_id&&this.options.token&&(this.jwt=await Un(t.space_id,this.options.token)),this.config&&this.config.connect_heartbeat){const n=new URL(`${this.config.root}${this.api_prefix}/${Ss}/${this.session_hash}`);this.jwt&&n.searchParams.set("__sign",this.jwt),this.heartbeat_event||(this.heartbeat_event=this.stream(n))}}static async connect(t,n={events:["data"]}){const r=new this(t,n);return n.session_hash&&(r.session_hash=n.session_hash),await r.init(),r}async reconnect(){const t=new URL(`${this.config.root}${this.api_prefix}/${xs}`);let n;try{const r=await this.fetch(t);if(!r.ok)throw new Error;n=(await r.json()).app_id}catch{return"broken"}return n!==this.config.app_id?"changed":"connected"}close(){this.closed=!0,En(this.stream_status,this.abort_controller)}set_current_payload(t){this.current_payload=t}static async duplicate(t,n={events:["data"]}){return ai(t,n)}async _resolve_config(){const{http_protocol:t,host:n,space_id:r}=await bn(this.app_reference,this.options.token),{status_callback:s}=this.options;r&&s&&await hr(r,s);let i;try{let o=`${t}//${n}`;if(i=await this.resolve_config(o),!i)throw new Error(Ee);return this.config_success(i)}catch(o){if(r&&s)_t(r,yn.test(r)?"space_name":"subdomain",this.handle_space_success);else throw s&&s({status:"error",message:"Could not load this space.",load_status:"error",detail:"NOT_FOUND"}),Error(o)}}async config_success(t){if(this.config=t,this.api_prefix=t.api_prefix||"",this.config.auth_required)return this.prepare_return_obj();try{this.api_info=await this.view_api()}catch(n){console.error(Os+n.message)}return this.prepare_return_obj()}async handle_space_success(t){if(!this)throw new Error(Ee);const{status_callback:n}=this.options;if(n&&n(t),t.status==="running")try{if(this.config=await this._resolve_config(),this.api_prefix=this?.config?.api_prefix||"",!this.config)throw new Error(Ee);return await this.config_success(this.config)}catch(r){throw n&&n({status:"error",message:"Could not load this space.",load_status:"error",detail:"NOT_FOUND"}),r}}async component_server(t,n,r){if(!this.config)throw new Error(Ee);const s={},{token:i}=this.options,{session_hash:o}=this;i&&(s.Authorization=`Bearer ${this.options.token}`);let a,c=this.config.components.find(f=>f.id===t);c?.props?.root_url?a=c.props.root_url:a=this.config.root;let h;if(typeof r=="object"&&r!==null&&"binary"in r){const f=r;h=new FormData;for(const l in f.data)l!=="binary"&&h.append(l,f.data[l]);h.set("component_id",t.toString()),h.set("fn_name",n),h.set("session_hash",o)}else h=JSON.stringify({data:r,component_id:t,fn_name:n,session_hash:o}),s["Content-Type"]="application/json";i&&(s.Authorization=`Bearer ${i}`);try{const f=await this.fetch(`${a}${this.api_prefix}/${ks}/`,{method:"POST",body:h,headers:s,credentials:"include"});if(!f.ok)throw new Error("Could not connect to component server: "+f.statusText);return await f.json()}catch(f){console.warn(f)}}set_cookies(t){this.cookies=fr(t).join("; ")}prepare_return_obj(){return{config:this.config,predict:this.predict,submit:this.submit,view_api:this.view_api,component_server:this.component_server}}}const ki="production",_=!ki.toLowerCase().startsWith("prod");var pr=Array.isArray,Ti=Array.prototype.indexOf,Ai=Array.from,xe=Object.defineProperty,Qe=Object.getOwnPropertyDescriptor,xi=Object.getOwnPropertyDescriptors,$i=Object.prototype,Oi=Array.prototype,vr=Object.getPrototypeOf,Kn=Object.isExtensible;function oa(e){return typeof e=="function"}const aa=()=>{};function la(e){return typeof e?.then=="function"}function ca(e){return e()}function Ri(e){for(var t=0;t{e=r,t=s});return{promise:n,resolve:e,reject:t}}function ua(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);const n=[];for(const r of e)if(n.push(r),n.length===t)break;return n}const $=2,gt=4,et=8,Dt=1<<24,_e=16,se=32,Be=64,zt=128,B=512,N=1024,L=2048,ie=4096,ee=8192,ce=16384,Et=32768,wt=65536,jt=1<<17,gr=1<<18,it=1<<19,wr=1<<20,fa=1<<25,$e=32768,an=1<<21,Bt=1<<22,ke=1<<23,Te=Symbol("$state"),da=Symbol("legacy props"),ha=Symbol(""),yr=Symbol("proxy path"),De=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},pa=1,Gt=3,Ht=8;function St(e){if(_){const t=new Error(`lifecycle_outside_component +\`${e}(...)\` can only be used during component initialisation +https://svelte.dev/e/lifecycle_outside_component`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Ci(){if(_){const e=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function va(){if(_){const e=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function Ni(){if(_){const e=new Error(`derived_references_self +A derived value cannot reference itself recursively +https://svelte.dev/e/derived_references_self`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/derived_references_self")}function Pi(e){if(_){const t=new Error(`effect_in_teardown +\`${e}\` cannot be used inside an effect cleanup function +https://svelte.dev/e/effect_in_teardown`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function Li(){if(_){const e=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Ii(e){if(_){const t=new Error(`effect_orphan +\`${e}\` can only be used inside an effect (e.g. during component initialisation) +https://svelte.dev/e/effect_orphan`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_orphan")}function Di(){if(_){const e=new Error(`effect_update_depth_exceeded +Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state +https://svelte.dev/e/effect_update_depth_exceeded`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ma(){if(_){const e=new Error("invalid_snippet\nCould not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\nhttps://svelte.dev/e/invalid_snippet");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invalid_snippet")}function ji(e){if(_){const t=new Error(`lifecycle_legacy_only +\`${e}(...)\` cannot be used in runes mode +https://svelte.dev/e/lifecycle_legacy_only`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/lifecycle_legacy_only")}function ga(e){if(_){const t=new Error(`props_invalid_value +Cannot do \`bind:${e}={undefined}\` when \`${e}\` has a fallback value +https://svelte.dev/e/props_invalid_value`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/props_invalid_value")}function wa(e){if(_){const t=new Error(`props_rest_readonly +Rest element properties of \`$props()\` such as \`${e}\` are readonly +https://svelte.dev/e/props_rest_readonly`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/props_rest_readonly")}function Mi(e){if(_){const t=new Error(`rune_outside_svelte +The \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files +https://svelte.dev/e/rune_outside_svelte`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function Ui(){if(_){const e=new Error("set_context_after_init\n`setContext` must be called when a component first initializes, not in a subsequent effect or after an `await` expression\nhttps://svelte.dev/e/set_context_after_init");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/set_context_after_init")}function qi(){if(_){const e=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Fi(){if(_){const e=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function zi(){if(_){const e=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Bi(){if(_){const e=new Error("svelte_boundary_reset_onerror\nA `` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const ya=1,ba=2,Ea=4,Sa=8,ka=16,Ta=1,Aa=2,xa=4,$a=8,Oa=16,Ra=1,Ca=2,Na=4,Gi=1,Hi=2,Vi="[",br="[!",Er="]",Vt={},C=Symbol(),Yi=Symbol("filename"),Pa="http://www.w3.org/1999/xhtml",La="http://www.w3.org/2000/svg",Ia="@attach";var pe="font-weight: bold",ve="font-weight: normal";function Da(e,t,n){_?console.warn(`%c[svelte] hydration_attribute_changed +%cThe \`${e}\` attribute on \`${t}\` changed its value between server and client renders. The client value, \`${n}\`, will be ignored in favour of the server value +https://svelte.dev/e/hydration_attribute_changed`,pe,ve):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function ja(e){_?console.warn(`%c[svelte] hydration_html_changed +%c${e?`The value of an \`{@html ...}\` block ${e} changed between server and client renders. The client value will be ignored in favour of the server value`:"The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value"} +https://svelte.dev/e/hydration_html_changed`,pe,ve):console.warn("https://svelte.dev/e/hydration_html_changed")}function Yt(e){_?console.warn(`%c[svelte] hydration_mismatch +%cHydration failed because the initial UI does not match what was rendered on the server +https://svelte.dev/e/hydration_mismatch`,pe,ve):console.warn("https://svelte.dev/e/hydration_mismatch")}function Wi(){_?console.warn(`%c[svelte] lifecycle_double_unmount +%cTried to unmount a component that was not mounted +https://svelte.dev/e/lifecycle_double_unmount`,pe,ve):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Ma(){_?console.warn("%c[svelte] select_multiple_invalid_value\n%cThe `value` property of a `');function tt(Q,e){we(e,!0);let o=d(e,"micDevices",15);Se(()=>{if(typeof window<"u"&&navigator.mediaDevices){let s=[];Oe.getAvailableAudioDevices().then(a=>{o(a),a.forEach(i=>{i.deviceId&&s.push(i)}),o(s)}).catch(a=>{a instanceof DOMException&&a.name=="NotAllowedError"&&e.onerror?.(e.i18n("audio.allow_recording_access"))})}});var f=jt(),K=D(f);{var t=s=>{var a=Et(),i=D(a,!0);S(a),a.value=a.__value="",te(P=>ee(i,P),[()=>e.i18n("audio.no_microphone")]),_(s,a)},y=s=>{var a=oe(),i=G(a);Qe(i,17,o,Ze,(P,v)=>{var h=Mt(),E=D(h,!0);S(h);var C={};te(()=>{ee(E,r(v).label),C!==(C=r(v).deviceId)&&(h.value=(h.__value=r(v).deviceId)??"")}),_(P,h)}),_(s,a)};U(K,s=>{!o()||o().length===0?s(t):s(y,!1)})}S(f),te(()=>f.disabled=!o()||o().length===0),_(Q,f),pe()}var Ct=j(''),It=j('
          ');function Lt(Q,e){we(e,!0);let o=d(e,"recording",3,!1),f=d(e,"timing",3,!1),K=q(De([])),t,y,s,a,i,P=q(!1);const v=()=>{t.style.display="none",a.style.display="flex",y.style.display="block"},h=()=>{e.record.isPaused()&&(e.record.resumeRecording(),e.record.stopRecording()),e.record.stopMic(),t.style.display="flex",a.style.display="none",y.style.display="none",t.disabled=!1},E=()=>{y.style.display="none",s.style.display="block",a.style.display="none",i.style.display="flex"},C=()=>{y.style.display="block",s.style.display="none",t.style.display="none",a.style.display="flex",i.style.display="none"};Se(()=>{e.record.on("record-start",v),e.record.on("record-end",h),e.record.on("record-pause",E),e.record.on("record-resume",C)}),et(()=>{e.record.un("record-start",v),e.record.un("record-end",h),e.record.un("record-pause",E),e.record.un("record-resume",C)}),$(()=>{o()&&!r(P)?e.record.startMic().then(()=>{e.record.startRecording(),p(P,!0)}):!o()&&r(P)&&(e.record.isPaused()&&e.record.resumeRecording(),e.record.stopRecording(),p(P,!1))});var N=It(),V=D(N),O=D(V);O.__click=()=>e.record.startRecording();var F=D(O,!0);S(O),ie(O,u=>t=u,()=>t);var l=R(O,2);l.__click=()=>{e.record.isPaused()&&(e.record.resumeRecording(),e.record.stopRecording()),e.record.stopRecording()};var B=D(l,!0);S(l),ie(l,u=>a=u,()=>a);var M=R(l,2);M.__click=()=>{e.record.isPaused()&&(e.record.resumeRecording(),e.record.stopRecording()),e.record.stopRecording()};var A=D(M,!0);S(M),ie(M,u=>i=u,()=>i);var I=R(M,2);I.__click=()=>e.record.pauseRecording();var z=D(I);Dt(z),S(I),ie(I,u=>y=u,()=>y);var k=R(I,2);k.__click=()=>e.record.resumeRecording();var g=D(k,!0);S(k),ie(k,u=>s=u,()=>s);var x=R(k,2);{var T=u=>{var Z=Ct(),c=D(Z,!0);S(Z),te(()=>ee(c,e.record_time)),_(u,Z)};U(x,u=>{f()&&!e.show_recording_waveform&&u(T)})}S(V);var W=R(V,2);tt(W,{get i18n(){return e.i18n},get micDevices(){return r(K)},set micDevices(u){p(K,u,!0)}}),S(N),te((u,Z,c,ue,se)=>{ee(F,u),qe(l,1,`stop-button ${Z??""}`,"svelte-1xuh0j1"),ee(B,c),ee(A,ue),ee(g,se)},[()=>e.i18n("audio.record"),()=>e.record.isPaused()?"stop-button-paused":"",()=>e.i18n("audio.stop"),()=>e.i18n("audio.stop"),()=>e.i18n("audio.resume")]),_(Q,N),pe()}$e(["click"]);var Ut=j(''),zt=j(''),Tt=j(''),Wt=j('
          '),qt=j('
          ');function Ot(Q,e){we(e,!0);let o=d(e,"mode",15),f=d(e,"waveform_options",19,()=>({show_recording_waveform:!0})),K=d(e,"editable",3,!0),t=d(e,"recording",3,!1),y,s=q(void 0),a=q(!1),i,P,v=q(void 0),h=q(null),E,C,N=q(0),V=q(0),O,F=q(!1),l=q(0),B=q(!1);const M=()=>{clearInterval(O),O=setInterval(()=>{ct(V)},1e3)};function A(){if(M(),p(F,!0),e.onstartrecording?.(),f().show_recording_waveform){let n=P;n&&(n.style.display="block")}}async function I(n){p(V,0),p(F,!1),clearInterval(O);try{const b=await n.arrayBuffer(),ne=await new AudioContext({sampleRate:e.waveform_settings.sampleRate}).decodeAudioData(b);ne&&await Xe(ne).then(async le=>{await e.dispatch_blob([le],"change"),await e.dispatch_blob([le],"stop_recording")})}catch(b){console.error(b)}}$(()=>{r(v)?.on("record-resume",()=>{M()})}),$(()=>{r(s)?.on("decode",n=>{p(N,n,!0),C&&(C.textContent=Ae(n))})}),$(()=>{r(s)?.on("timeupdate",n=>E&&(E.textContent=Ae(n)))}),$(()=>{r(s)?.on("pause",()=>{e.onpause?.(),p(a,!1)})}),$(()=>{r(s)?.on("play",()=>{e.onplay?.(),p(a,!0)})}),$(()=>{r(s)?.on("finish",()=>{e.onstop?.(),p(a,!1)})});const z=()=>{P&&(P.innerHTML=""),y!==void 0&&y.destroy(),P&&(y=We.create({...e.waveform_settings,normalize:!1,container:P}),p(v,y.registerPlugin(Oe.create()),!0),r(v)?.on("record-end",I),r(v)?.on("record-start",A),r(v)?.on("record-pause",()=>{e.onpauserecording?.(),clearInterval(O)}),r(v)?.on("record-end",n=>{p(h,URL.createObjectURL(n),!0);const b=P,re=i;b&&(b.style.display="none"),re&&r(h)&&(re.innerHTML="",k())}),p(B,!0))},k=()=>{let n=i;!r(h)||!n||p(s,We.create({container:n,url:r(h),...e.waveform_settings}),!0)},g=async(n,b)=>{o("edit");const re=r(s)?.getDecodedData();re&&await Xe(re,n,b).then(async ne=>{await e.dispatch_blob([ne],"change"),await e.dispatch_blob([ne],"stop_recording"),r(s)?.destroy(),k()}),e.onedit?.()};Se(()=>{z(),window.addEventListener("keydown",n=>{i&&i.contains(document.activeElement)&&(n.key==="ArrowRight"?Ye(r(s),.1):n.key==="ArrowLeft"&&Ye(r(s),-.1))})});var x=qt(),T=D(x);ie(T,n=>P=n,()=>P);var W=R(T,2);ie(W,n=>i=n,()=>i);var u=R(W,2);{var Z=n=>{var b=Wt(),re=D(b);ie(re,Y=>E=Y,()=>E);var ne=R(re,2),le=D(ne);{var ye=Y=>{var X=Ut(),de=D(X,!0);S(X),te(ge=>ee(de,ge),[()=>Ae(r(l))]),_(Y,X)};U(le,Y=>{o()==="edit"&&r(l)>0&&Y(ye)})}var Le=R(le,2);{var Be=Y=>{var X=zt(),de=D(X,!0);S(X),te(ge=>ee(de,ge),[()=>Ae(r(V))]),_(Y,X)},Ee=Y=>{var X=Tt();ie(X,de=>C=de,()=>C),_(Y,X)};U(Le,Y=>{r(F)?Y(Be):Y(Ee,!1)})}S(ne),S(b),_(n,b)};U(u,n=>{(r(F)||r(h))&&f().show_recording_waveform&&n(Z)})}var c=R(u,2);{var ue=n=>{{let b=H(()=>Ae(r(V)));Lt(n,{get record(){return r(v)},get i18n(){return e.i18n},get timing(){return r(F)},get recording(){return t()},get show_recording_waveform(){return f().show_recording_waveform},get record_time(){return r(b)}})}};U(c,n=>{r(B)&&!r(h)&&n(ue)})}var se=R(c,2);{var Ge=n=>{ft(n,{get waveform(){return r(s)},get container(){return i},get playing(){return r(a)},get audio_duration(){return r(N)},get i18n(){return e.i18n},get editable(){return K()},interactive:!0,handle_trim_audio:g,show_redo:!0,get handle_reset_value(){return e.handle_reset_value},get waveform_options(){return f()},get trimDuration(){return r(l)},set trimDuration(b){p(l,b,!0)},get mode(){return o()},set mode(b){o(b)}})};U(se,n=>{r(s)&&r(h)&&n(Ge)})}S(x),_(Q,x),pe()}var Gt=j('
          '),Ht=j(''),Nt=j(''),Vt=j(''),Ft=j('
          ');function Yt(Q,e){we(e,!0);let o=d(e,"recording",3,!1),f=d(e,"paused_recording",3,!1),K=d(e,"waveform_options",19,()=>({show_recording_waveform:!0})),t=d(e,"waiting",3,!1),y,s,a,i=q(De([]));Se(()=>{P()});const P=()=>{y!==void 0&&y.destroy(),a&&(y=We.create({...e.waveform_settings,normalize:!1,container:a}),s=y.registerPlugin(Oe.create()))};var v=Ft(),h=D(v);{var E=l=>{var B=Gt();let M;ie(B,A=>a=A,()=>a),te(()=>M=st(B,"",M,{display:o()?"block":"none"})),_(l,B)};U(h,l=>{K().show_recording_waveform&&l(E)})}var C=R(h,2),N=D(C);{var V=l=>{var B=Ht();B.__click=()=>{s?.stopMic(),e.stop()};var M=R(D(B));S(B),te(A=>{qe(B,1,lt(f()?"stop-button-paused":"stop-button"),"svelte-m6ymia"),ee(M,` ${A??""}`)},[()=>f()?e.i18n("audio.pause"):e.i18n("audio.stop")]),_(l,B)},O=l=>{var B=oe(),M=G(B);{var A=z=>{var k=Nt();k.__click=()=>{e.stop()};var g=D(k),x=D(g);St(x),S(g);var T=R(g);S(k),te(W=>ee(T,` ${W??""}`),[()=>e.i18n("audio.waiting")]),_(z,k)},I=z=>{var k=Vt();k.__click=()=>{s?.startMic(),e.record()};var g=R(D(k));S(k),te(x=>ee(g,` ${x??""}`),[()=>e.i18n("audio.record")]),_(z,k)};U(M,z=>{o()&&t()?z(A):z(I,!1)},!0)}_(l,B)};U(N,l=>{o()&&!t()?l(V):l(O,!1)})}var F=R(N,2);tt(F,{get i18n(){return e.i18n},get micDevices(){return r(i)},set micDevices(l){p(i,l,!0)}}),S(C),S(v),_(Q,v),pe()}$e(["click"]);let Ke;async function Xt(){const{MediaRecorder:Q,register:e}=await Ne(async()=>{const{MediaRecorder:f,register:K}=await import("./module-C85Cvh0Z.js");return{MediaRecorder:f,register:K}},__vite__mapDeps([0,1]),import.meta.url),{connect:o}=await Ne(async()=>{const{connect:f}=await import("./module-B5lWqP2v.js");return{connect:f}},__vite__mapDeps([2,1]),import.meta.url);return e(await o()),Ke=Q,Ke}var Jt=j(" ",1),Kt=j(" ",1),Qt=j("
          ",1);function Zt(Q,e){we(e,!0);let o=d(e,"value",15,null),f=d(e,"subtitles",3,null),K=d(e,"show_label",3,!0),t=d(e,"buttons",19,()=>["download","share"]),y=d(e,"on_custom_button_click",3,null),s=d(e,"sources",19,()=>["microphone","upload"]),a=d(e,"pending",3,!1),i=d(e,"streaming",3,!1),P=d(e,"trim_region_settings",19,()=>({})),v=d(e,"waveform_options",19,()=>({})),h=d(e,"dragging",15,!1),E=d(e,"active_source",15,"microphone"),C=d(e,"handle_reset_value",3,()=>{}),N=d(e,"editable",3,!0),V=d(e,"max_file_size",3,null),O=d(e,"stream_every",3,.1),F=d(e,"uploading",15,!1),l=d(e,"recording",15,!1),B=d(e,"class_name",3,""),M=d(e,"upload_promise",15),A=d(e,"initial_value",15),I=d(e,"playback_position",15),z=d(e,"time_limit",3,null),k=d(e,"stream_state",3,"closed");$(()=>{e.ondrag?.(h())});let g,x=q(""),T,W=[],u=!1,Z=!1,c;const ue=44;let se=[];typeof window<"u"&&i()&&Xt().then(m=>{c=m});const n=m=>m.map(w=>w instanceof Blob?w:w.slice()),b=async(m,w)=>{let ae=new File(n(m),"audio.wav",{type:"audio/wav"});if(ae.size===0)return;const ce=await _t([ae],w==="stream");A(o()),o((await e.upload(ce,e.root,void 0,V()||void 0))?.filter(Boolean)[0]),w==="stream"?e.onstream?.(o()):w==="change"?e.onchange?.(o()):w==="stop_recording"&&e.onstop_recording?.()};et(()=>{i()&&g&&g.state!=="inactive"&&g.stop()});async function re(){let m;try{m=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(w){if(!navigator.mediaDevices){e.onerror?.(e.i18n("audio.no_device_support"));return}if(w instanceof DOMException&&w.name=="NotAllowedError"){e.onerror?.(e.i18n("audio.allow_recording_access"));return}throw w}m!=null&&(i()?(g=new c(m,{mimeType:"audio/wav"}),g.addEventListener("dataavailable",ne)):(g=new MediaRecorder(m),g.addEventListener("dataavailable",w=>{se.push(w.data)})),g.addEventListener("stop",async()=>{l(!1),g.stop(),await b(se,"change"),await b(se,"stop_recording"),se=[]}),Z=!0)}async function ne(m){let w=await m.data.arrayBuffer(),ae=new Uint8Array(w);if(T||(T=new Uint8Array(w.slice(0,ue)),ae=new Uint8Array(w.slice(ue))),a())W.push(ae);else{let ce=[T].concat(W,[ae]);if(!l()||k()==="waiting")return;b(ce,"stream"),W=[]}}$(()=>{if(u&&a()===!1&&(u=!1,T&&W)){let m=[T].concat(W);W=[],b(m,"stream")}});async function le(){l(!0),e.onstart_recording?.(),Z||await re(),T=void 0,i()&&g.state!="recording"&&g.start(O()*1e3)}function ye(){e.onchange?.(null),e.onclear?.(),p(x,""),o(null)}function Le(m){o(m),e.onchange?.(m),e.onupload?.(m)}async function Be(){l(!1),i()&&(e.onclose_stream?.(),e.onstop_recording?.(),g.stop(),a()&&(u=!0),await b(se,"stop_recording"),e.onclear?.(),p(x,""))}$(()=>{!l()&&g&&r(x)!==""&&Be()}),$(()=>{l()&&g&&le()});var Ee=Qt(),Y=G(Ee);{let m=H(()=>E()==="upload"&&o()===null),w=H(()=>e.label||e.i18n("audio.audio"));kt(Y,{get show_label(){return K()},get Icon(){return Rt},get float(){return r(m)},get label(){return r(w)}})}var X=R(Y,2),de=D(X);At(de,{get time_limit(){return z()}});var ge=R(de,2);{var rt=m=>{var w=oe(),ae=G(w);{var ce=J=>{var fe=Jt(),_e=G(fe);Fe(_e,{get i18n(){return e.i18n},onclear:ye});var xe=R(_e,2);{var me=L=>{{let he=H(()=>k()==="waiting");Yt(L,{record:le,get recording(){return l()},stop:Be,get i18n(){return e.i18n},get waveform_settings(){return e.waveform_settings},get waveform_options(){return v()},get waiting(){return r(he)}})}},ve=L=>{Ot(L,{get i18n(){return e.i18n},get editable(){return N()},get recording(){return l()},dispatch_blob:b,get waveform_settings(){return e.waveform_settings},get waveform_options(){return v()},get handle_reset_value(){return C()},onstartrecording:()=>e.onstart_recording?.(),onpauserecording:()=>e.onpause_recording?.(),onstoprecording:()=>e.onstop_recording?.(),get mode(){return r(x)},set mode(he){p(x,he,!0)}})};U(xe,L=>{i()?L(me):L(ve,!1)})}_(J,fe)},ke=J=>{var fe=oe(),_e=G(fe);{var xe=me=>{{let ve=H(()=>e.i18n("audio.drop_to_upload"));pt(me,{filetype:"audio/aac,audio/midi,audio/mpeg,audio/ogg,audio/wav,audio/x-wav,audio/opus,audio/webm,audio/flac,audio/vnd.rn-realaudio,audio/x-ms-wma,audio/x-aiff,audio/amr,audio/*",onload:Le,onerror:L=>e.onerror?.(L),get root(){return e.root},get max_file_size(){return V()},get upload(){return e.upload},get stream_handler(){return e.stream_handler},get aria_label(){return r(ve)},get upload_promise(){return M()},set upload_promise(L){M(L)},get dragging(){return h()},set dragging(L){h(L)},get uploading(){return F()},set uploading(L){F(L)},children:(L,he)=>{var Me=oe(),Re=G(Me);{var je=Pe=>{var Ce=oe(),Ue=G(Ce);wt(Ue,()=>e.children),_(Pe,Ce)};U(Re,Pe=>{e.children&&Pe(je)})}_(L,Me)},$$slots:{default:!0}})}};U(_e,me=>{E()==="upload"&&me(xe)},!0)}_(J,fe)};U(ae,J=>{E()==="microphone"?J(ce):J(ke,!1)})}_(m,w)},at=m=>{var w=Kt(),ae=G(w);{let ke=H(()=>t()===null||t().some(J=>typeof J=="string"&&J==="download")?o().url:null);Fe(ae,{get i18n(){return e.i18n},onclear:ye,onedit:()=>{p(x,"edit"),e.onedit?.()},get download(){return r(ke)},children:(J,fe)=>{var _e=oe(),xe=G(_e);{var me=ve=>{var L=oe(),he=G(L);Qe(he,17,t,Ze,(Me,Re)=>{var je=oe(),Pe=G(je);{var Ce=be=>{var Ie=oe(),nt=G(Ie);{var it=ze=>{xt(ze,{get i18n(){return e.i18n},get onerror(){return e.onerror},onshare:()=>{},formatter:async Te=>!Te||!Te.url?"":``,get value(){return o()}})};U(nt,ze=>{r(Re)==="share"&&ze(it)})}_(be,Ie)},Ue=be=>{Pt(be,{get button(){return r(Re)},on_click:Ie=>{y()&&y()(Ie)}})};U(Pe,be=>{typeof r(Re)=="string"?be(Ce):be(Ue,!1)})}_(Me,je)}),_(ve,L)};U(xe,ve=>{o()!==null&&t()&&ve(me)})}_(J,_e)},$$slots:{default:!0}})}var ce=R(ae,2);{let ke=H(()=>Array.isArray(f())?f():f()?.url);ht(ce,{get value(){return o()},get subtitles(){return r(ke)},get label(){return e.label},get i18n(){return e.i18n},dispatch_blob:b,get waveform_settings(){return e.waveform_settings},get waveform_options(){return v()},get trim_region_settings(){return P()},get handle_reset_value(){return C()},get editable(){return N()},get loop(){return e.loop},interactive:!0,get onstop(){return e.onstop},get onplay(){return e.onplay},get onpause(){return e.onpause},get onedit(){return e.onedit},get mode(){return r(x)},set mode(J){p(x,J,!0)},get playback_position(){return I()},set playback_position(J){I(J)}})}_(m,w)};U(ge,m=>{o()==null||i()?m(rt):m(at,!1)})}var ot=R(ge,2);yt(ot,{get sources(){return s()},handle_clear:ye,get active_source(){return E()},set active_source(m){E(m)}}),S(X),te(()=>{qe(X,1,`audio-container ${B()??""}`,"svelte-ocxd3m"),dt(X,"data-testid",e.label?"waveform-"+e.label:"unlabelled-audio")}),_(Q,Ee),pe()}var $t=j(" ",1),er=j(" ",1);function Ir(Q,e){we(e,!0);let o=ut(e,["$$slots","$$events","$$legacy"]),f=q(void 0);e.props.stream_every=.1;class K extends gt{async get_data(){return r(f)&&(await r(f),await mt()),await super.get_data()}}const t=new K(o);let y=H(()=>t.shared.label||t.i18n("audio.audio")),s=H(()=>e.minimal??t.props.minimal??!1),a=H(()=>t.props.sources?t.props.sources[0]:null),i=q(De(t.props.value));const P=()=>{r(i)===null||t.props.value===r(i)||(t.props.value=r(i))};let v=q(!1),h=q(De(t.props.recording??!1));$(()=>{t.props.recording=r(h)});let E="darkorange",C=De({height:50,barWidth:2,barGap:3,cursorWidth:2,cursorColor:"#ddd5e9",autoplay:t.props.autoplay,barRadius:10,dragToSeek:!0,normalize:!0,minPxPerSec:20,waveColor:t.props.waveform_options.waveform_color||"#9ca3af",progressColor:t.props.waveform_options.waveform_progress_color||E,mediaControls:t.props.waveform_options.show_controls??!1,sampleRate:t.props.waveform_options.sample_rate||44100});const N={color:t.props.waveform_options.trim_region_color,drag:!0,resize:!0};function V(){document.documentElement.style.setProperty("--trim-region-color",N.color||E)}function O(A){const[I,z]=A.includes("Invalid file type")?["warning","complete"]:["error","error"];t.shared.loading_status&&(t.shared.loading_status.status=z,t.shared.loading_status.message=A),t.dispatch(I,A)}t.watch_for_change(),Se(()=>{V()});var F=oe(),l=G(F);{var B=A=>{{let I=H(()=>r(v)?"focus":"base");Je(A,{variant:"solid",get border_mode(){return r(I)},padding:!1,allow_overflow:!1,get elem_id(){return t.shared.elem_id},get elem_classes(){return t.shared.elem_classes},get visible(){return t.shared.visible},get container(){return t.shared.container},get scale(){return t.shared.scale},get min_width(){return t.shared.min_width},children:(z,k)=>{var g=$t(),x=G(g);Ve(x,He({get autoscroll(){return t.shared.autoscroll},get i18n(){return t.i18n}},()=>t.shared.loading_status,{on_clear_status:()=>t.dispatch("clear_status",t.shared.loading_status)}));var T=R(x,2);{let W=H(()=>t.props.buttons??["download","share"]);bt(T,{get i18n(){return t.i18n},get show_label(){return t.shared.show_label},get buttons(){return r(W)},get value(){return t.props.value},get subtitles(){return t.props.subtitles},get label(){return r(y)},get loop(){return t.props.loop},get waveform_settings(){return C},get waveform_options(){return t.props.waveform_options},get editable(){return t.props.editable},get minimal(){return r(s)},on_custom_button_click:u=>{t.dispatch("custom_button_click",{id:u})},onshare:u=>t.dispatch("share",u),onerror:u=>t.dispatch("error",u.detail),onplay:()=>t.dispatch("play"),onpause:()=>t.dispatch("pause"),onstop:()=>t.dispatch("stop"),get playback_position(){return t.props.playback_position},set playback_position(u){t.props.playback_position=u}})}_(z,g)},$$slots:{default:!0}})}},M=A=>{{let I=H(()=>t.props.value===null&&r(a)==="upload"?"dashed":"solid"),z=H(()=>r(v)?"focus":"base");Je(A,{get variant(){return r(I)},get border_mode(){return r(z)},padding:!1,allow_overflow:!1,get elem_id(){return t.shared.elem_id},get elem_classes(){return t.shared.elem_classes},get visible(){return t.shared.visible},get container(){return t.shared.container},get scale(){return t.shared.scale},get min_width(){return t.shared.min_width},children:(k,g)=>{var x=er(),T=G(x);Ve(T,He({get autoscroll(){return t.shared.autoscroll},get i18n(){return t.i18n}},()=>t.shared.loading_status,{on_clear_status:()=>t.dispatch("clear_status",t.shared.loading_status)}));var W=R(T,2);{let u=H(()=>t.props.buttons??[]),Z=H(()=>r(a)||void 0);Zt(W,{get label(){return r(y)},get show_label(){return t.shared.show_label},get buttons(){return r(u)},on_custom_button_click:c=>{t.dispatch("custom_button_click",{id:c})},get value(){return t.props.value},get subtitles(){return t.props.subtitles},onchange:c=>t.props.value=c,onstream:c=>{t.props.value=c,t.dispatch("stream",t.props.value)},ondrag:c=>p(v,c,!0),get root(){return t.shared.root},get sources(){return t.props.sources},get active_source(){return r(Z)},get pending(){return t.shared.loading_status.pending},get streaming(){return t.props.streaming},get loop(){return t.props.loop},get max_file_size(){return t.shared.max_file_size},handle_reset_value:P,get editable(){return t.props.editable},onedit:()=>t.dispatch("edit"),onplay:()=>t.dispatch("play"),onpause:()=>t.dispatch("pause"),onstop:()=>t.dispatch("stop"),onstart_recording:()=>t.dispatch("start_recording"),onpause_recording:()=>t.dispatch("pause_recording"),onstop_recording:()=>{t.dispatch("stop_recording"),t.dispatch("input")},onupload:()=>{t.dispatch("upload"),t.dispatch("input")},onclear:()=>{t.dispatch("clear"),t.dispatch("input")},onerror:O,onclose_stream:()=>t.dispatch("close_stream","stream"),get i18n(){return t.i18n},get waveform_settings(){return C},get waveform_options(){return t.props.waveform_options},get trim_region_settings(){return N},get stream_every(){return t.props.stream_every},get stream_state(){return t.shared.loading_status.stream_state},upload:(...c)=>t.shared.client.upload(...c),stream_handler:(...c)=>t.shared.client.stream(...c),get time_limit(){return t.shared.loading_status.time_limit},get upload_promise(){return r(f)},set upload_promise(c){p(f,c,!0)},get initial_value(){return r(i)},set initial_value(c){p(i,c,!0)},get recording(){return r(h)},set recording(c){p(h,c,!0)},get dragging(){return r(v)},set dragging(c){p(v,c,!0)},get playback_position(){return t.props.playback_position},set playback_position(c){t.props.playback_position=c},children:(c,ue)=>{Bt(c,{get i18n(){return t.i18n},type:"audio"})},$$slots:{default:!0}})}_(k,x)},$$slots:{default:!0}})}};U(l,A=>{t.shared.interactive?A(M,!1):A(B)})}_(Q,F),pe()}export{zr as BaseExample,Zt as BaseInteractiveAudio,ht as BasePlayer,bt as BaseStaticAudio,Ir as default}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-o-aMX0pU.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-o-aMX0pU.js new file mode 100644 index 0000000000000000000000000000000000000000..1f8aa9fcbe6796e8a19539dac45ac34cca84f110 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-o-aMX0pU.js @@ -0,0 +1,6 @@ +import{P as st,a as Q,b as v,m as it,N as Ee,s as Ie,T as H,p as ot,t as m,d as X,E as P,n as z,L as fe,o as at,q as lt,r as ht,u as ft,v as ut,w as dt,x as pt,y as ct,z as mt,f as Me,g as gt,A as kt,B as ue,F as Lt}from"./Code-BLWhl1y6.js";import{html as bt,htmlCompletionSource as wt}from"./index-rD6wvNSx.js";import"./i18n-Dnhn5Rxr.js";import"./index-DWyDLubb.js";import"./index-DUwqQ_4P.js";import"./index-B2xAlaja.js";import"./index-DYwhoY3R.js";class _{static create(e,r,n,s,i){let o=s+(s<<8)+e+(r<<4)|0;return new _(e,r,n,o,i,[],[])}constructor(e,r,n,s,i,o,a){this.type=e,this.value=r,this.from=n,this.hash=s,this.end=i,this.children=o,this.positions=a,this.hashProp=[[v.contextHash,s]]}addChild(e,r){e.prop(v.contextHash)!=this.hash&&(e=new H(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(r)}toTree(e,r=this.end){let n=this.children.length-1;return n>=0&&(r=Math.max(r,this.positions[n]+this.children[n].length+this.from)),new H(e.types[this.type],this.children,this.positions,r-this.from).balance({makeTree:(s,i,o)=>new H(Q.none,s,i,o,this.hashProp)})}}var u;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(u||(u={}));class St{constructor(e,r){this.start=e,this.content=r,this.marks=[],this.parsers=[]}}class Ct{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return O(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,r=0,n=0){for(let s=r;s=e.stack[r.depth+1].value+r.baseIndent)return!0;if(r.indent>=r.baseIndent+4)return!1;let n=(t.type==u.OrderedList?oe:ie)(r,e,!1);return n>0&&(t.type!=u.BulletList||se(r,e,!1)<0)&&r.text.charCodeAt(r.pos+n-1)==t.value}const He={[u.Blockquote](t,e,r){return r.next!=62?!1:(r.markers.push(k(u.QuoteMark,e.lineStart+r.pos,e.lineStart+r.pos+1)),r.moveBase(r.pos+(A(r.text.charCodeAt(r.pos+1))?2:1)),t.end=e.lineStart+r.text.length,!0)},[u.ListItem](t,e,r){return r.indent-1?!1:(r.moveBaseColumn(r.baseIndent+t.value),!0)},[u.OrderedList]:de,[u.BulletList]:de,[u.Document](){return!0}};function A(t){return t==32||t==9||t==10||t==13}function O(t,e=0){for(;er&&A(t.charCodeAt(e-1));)e--;return e}function Pe(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(De.SetextHeading)>-1||n<3?-1:1}function Ne(t,e){for(let r=t.stack.length-1;r>=0;r--)if(t.stack[r].type==e)return!0;return!1}function ie(t,e,r){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||A(t.text.charCodeAt(t.pos+1)))&&(!r||Ne(e,u.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){n++;if(n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||s!=46&&s!=41||nt.pos+1||t.next!=49)?-1:n+1-t.pos}function ye(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e6?-1:r}function Re(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,Te=/\?>/,ee=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(i)return t.append(k(u.Comment,r,r+1+i[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(k(u.ProcessingInstruction,r,r+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(k(u.HTMLTag,r,r+1+a[0].length)):-1},Emphasis(t,e,r){if(e!=95&&e!=42)return-1;let n=r+1;for(;t.char(n)==e;)n++;let s=t.slice(r-1,r),i=t.slice(n,n+1),o=F.test(s),a=F.test(i),l=/\s|^$/.test(s),h=/\s|^$/.test(i),f=!h&&(!a||l||o),p=!l&&(!o||h||a),d=f&&(e==42||!p||o),c=p&&(e==42||!f||a);return t.append(new C(e==95?_e:je,r,n,(d?1:0)|(c?2:0)))},HardBreak(t,e,r){if(e==92&&t.char(r+1)==10)return t.append(k(u.HardBreak,r,r+2));if(e==32){let n=r+1;for(;t.char(n)==32;)n++;if(t.char(n)==10&&n>=r+2)return t.append(k(u.HardBreak,r,n+1))}return-1},Link(t,e,r){return e==91?t.append(new C(M,r,r+1,1)):-1},Image(t,e,r){return e==33&&t.char(r+1)==91?t.append(new C(j,r,r+2,1)):-1},LinkEnd(t,e,r){if(e!=93)return-1;for(let n=t.parts.length-1;n>=0;n--){let s=t.parts[n];if(s instanceof C&&(s.type==M||s.type==j)){if(!s.side||t.skipSpace(s.to)==r&&!/[(\[]/.test(t.slice(r+1,r+2)))return t.parts[n]=null,-1;let i=t.takeContent(n),o=t.parts[n]=Mt(t,i,s.type==M?u.Link:u.Image,s.from,r+1);if(s.type==M)for(let a=0;ae?k(u.URL,e+r,i+r):i==t.length?null:!1}}function Qe(t,e,r){let n=t.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let s=n==40?41:n;for(let i=e+1,o=!1;i=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,r){return this.text.slice(e-this.offset,r-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,r,n,s,i){return this.append(new C(e,r,n,(s?1:0)|(i?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let r=this.parts[e];if(r instanceof C&&(r.type==M||r.type==j))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n=e;l--){let g=this.parts[l];if(g instanceof C&&g.side&1&&g.type==s.type&&!(i&&(s.side&1||g.side&2)&&(g.to-g.from+o)%3==0&&((g.to-g.from)%3||o%3))){a=g;break}}if(!a)continue;let h=s.type.resolve,f=[],p=a.from,d=s.to;if(i){let g=Math.min(2,a.to-a.from,o);p=a.to-g,d=s.from+g,h=g==1?"Emphasis":"StrongEmphasis"}a.type.mark&&f.push(this.elt(a.type.mark,p,a.to));for(let g=l+1;g=0;r--){let n=this.parts[r];if(n instanceof C&&n.type==e&&n.side&1)return r}return null}takeContent(e){let r=this.resolveMarkers(e);return this.parts.length=e,r}getDelimiterAt(e){let r=this.parts[e];return r instanceof C?r:null}skipSpace(e){return O(this.text,e-this.offset)+this.offset}elt(e,r,n,s){return typeof e=="string"?k(this.parser.getNodeType(e),r,n,s):new Ue(e,r)}}ae.linkStart=M;ae.imageStart=j;function re(t,e){if(!e.length)return t;if(!t.length)return e;let r=t.slice(),n=0;for(let s of e){for(;n(e?e-1:0))return!1;if(this.fragmentEnd<0){let i=this.fragment.to;for(;i>0&&this.input.read(i-1,i)!=` +`;)i--;this.fragmentEnd=i?i-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let s=e+this.fragment.offset;for(;n.to<=s;)if(!n.parent())return!1;for(;;){if(n.from>=s)return this.fragment.from<=r;if(!n.childAfter(s))return!1}}matches(e){let r=this.cursor.tree;return r&&r.prop(v.contextHash)==e}takeNodes(e){let r=this.cursor,n=this.fragment.offset,s=this.fragmentEnd-(this.fragment.openEnd?1:0),i=e.absoluteLineStart,o=i,a=e.block.children.length,l=o,h=a;for(;;){if(r.to-n>s){if(r.type.isAnonymous&&r.firstChild())continue;break}let f=Ve(r.from-n,e.ranges);if(r.to-n<=e.ranges[e.rangeI].to)e.addNode(r.tree,f);else{let p=new H(e.parser.nodeSet.types[u.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(p,r.tree),e.addNode(p,f)}if(r.type.is("Block")&&(Ht.indexOf(r.type.id)<0?(o=r.to-n,a=e.block.children.length):(o=l,a=h),l=r.to-n,h=e.block.children.length),!r.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-i}}function Ve(t,e){let r=t;for(let n=1;n$[t]),Object.keys($).map(t=>De[t]),Object.keys($),Bt,He,Object.keys(G).map(t=>G[t]),Object.keys(G),[]);function yt(t,e,r){let n=[];for(let s=t.firstChild,i=e;;s=s.nextSibling){let o=s?s.from:r;if(o>i&&n.push({from:i,to:o}),!s)break;i=s.to}return n}function Rt(t){let{codeParser:e,htmlParser:r}=t;return{wrap:ot((s,i)=>{let o=s.type.id;if(e&&(o==u.CodeBlock||o==u.FencedCode)){let a="";if(o==u.FencedCode){let h=s.node.getChild(u.CodeInfo);h&&(a=i.read(h.from,h.to))}let l=e(a);if(l)return{parser:l,overlay:h=>h.type.id==u.CodeText,bracketed:o==u.FencedCode}}else if(r&&(o==u.HTMLBlock||o==u.HTMLTag||o==u.CommentBlock))return{parser:r,overlay:yt(s.node,s.from,s.to)};return null})}}const Ot={resolve:"Strikethrough",mark:"StrikethroughMark"},Tt={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":m.strikethrough}},{name:"StrikethroughMark",style:m.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,r){if(e!=126||t.char(r+1)!=126||t.char(r+2)==126)return-1;let n=t.slice(r-1,r),s=t.slice(r+2,r+3),i=/\s|^$/.test(n),o=/\s|^$/.test(s),a=F.test(n),l=F.test(s);return t.addDelimiter(Ot,r,r+2,!o&&(!l||i||a),!i&&(!a||o||l))},after:"Emphasis"}]};function T(t,e,r=0,n,s=0){let i=0,o=!0,a=-1,l=-1,h=!1,f=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let p=r;p-1)&&i++,o=!1,n&&(a>-1&&f(),n.push(t.elt("TableDelimiter",p+s,p+s+1))),a=l=-1):(h||d!=32&&d!=9)&&(a<0&&(a=p),l=p+1),h=!h&&d==92}return a>-1&&(i++,n&&f()),i}function ge(t,e){for(let r=e;rs instanceof ke)||!ge(e.text,e.basePos))return!1;let n=t.peekLine();return Ge.test(n)&&T(t,e.text,e.basePos)==T(t,n,e.basePos)},before:"SetextHeading"}]};class Dt{nextLine(){return!1}finish(e,r){return e.addLeafElement(r,e.elt("Task",r.start,r.start+r.content.length,[e.elt("TaskMarker",r.start,r.start+3),...e.parser.parseInline(r.content.slice(3),r.start+3)])),!0}}const Ft={defineNodes:[{name:"Task",block:!0,style:m.list},{name:"TaskMarker",style:m.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new Dt:null},after:"SetextHeading"}]},Le=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,be=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,Xt=/[\w-]+\.[\w-]+($|\/)/,we=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Se=/\/[a-zA-Z\d@.]+/gy;function Ce(t,e,r,n){let s=0;for(let i=e;i-1)return-1;let n=e+r[0].length;for(;;){let s=t[n-1],i;if(/[?!.,:*_~]/.test(s)||s==")"&&Ce(t,e,n,")")>Ce(t,e,n,"("))n--;else if(s==";"&&(i=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,n))))n=e+i.index;else break}return n}function Ae(t,e){we.lastIndex=e;let r=we.exec(t);if(!r)return-1;let n=r[0][r[0].length-1];return n=="_"||n=="-"?-1:e+r[0].length-(n=="."?1:0)}const Ut={parseInline:[{name:"Autolink",parse(t,e,r){let n=r-t.offset;if(n&&/\w/.test(t.text[n-1]))return-1;Le.lastIndex=n;let s=Le.exec(t.text),i=-1;if(!s)return-1;if(s[1]||s[2]){if(i=$t(t.text,n+s[0].length),i>-1&&t.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(n,i));i=n+o[0].length}}else s[3]?i=Ae(t.text,n):(i=Ae(t.text,n+s[0].length),i>-1&&s[0]=="xmpp:"&&(Se.lastIndex=i,s=Se.exec(t.text),s&&(i=s.index+s[0].length)));return i<0?-1:(t.addElement(t.elt("URL",r,i+t.offset)),i+t.offset)}}]},_t=[zt,Ft,Tt,Ut];function Ke(t,e,r){return(n,s,i)=>{if(s!=t||n.char(i+1)==t)return-1;let o=[n.elt(r,i,i+1)];for(let a=i+1;a"}}}),Ye=new v,We=Nt.configure({props:[Me.add(t=>!t.is("Block")||t.is("Document")||ne(t)!=null||Zt(t)?void 0:(e,r)=>({from:r.doc.lineAt(e.from).to,to:e.to})),Ye.add(ne),gt.add({Document:()=>null}),kt.add({Document:Je})]});function ne(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function Zt(t){return t.name=="OrderedList"||t.name=="BulletList"}function Vt(t,e){let r=t;for(;;){let n=r.nextSibling,s;if(!n||(s=ne(n.type))!=null&&s<=e)break;r=n}return r.to}const Gt=dt.of((t,e,r)=>{for(let n=X(t).resolveInner(r,-1);n&&!(n.fromr)return{from:r,to:i}}return null});function le(t){return new ft(Je,t,[],"markdown")}const Kt=le(We),Jt=We.configure([_t,qt,jt,Qt,{props:[Me.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),q=le(Jt);function Yt(t,e){return r=>{if(r&&t){let n=null;if(r=/\S*/.exec(r)[0],typeof t=="function"?n=t(r):n=ue.matchLanguageName(t,r,!0),n instanceof ue)return n.support?n.support.language.parser:Lt.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}class K{constructor(e,r,n,s,i,o,a){this.node=e,this.from=r,this.to=n,this.spaceBefore=s,this.spaceAfter=i,this.type=o,this.item=a}blank(e,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length0;s--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(e,r){let n=this.node.name=="OrderedList"?String(+tt(this.item,e)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function et(t,e){let r=[],n=[];for(let s=t;s;s=s.parent){if(s.name=="FencedCode")return n;(s.name=="ListItem"||s.name=="Blockquote")&&r.push(s)}for(let s=r.length-1;s>=0;s--){let i=r[s],o,a=e.lineAt(i.from),l=i.from-a.from;if(i.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))n.push(new K(i,l,l+o[0].length,"",o[1],">",null));else if(i.name=="ListItem"&&i.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let h=o[3],f=o[0].length;h.length>=4&&(h=h.slice(0,h.length-4),f-=4),n.push(new K(i.parent,l,l+f,o[1],h,o[2],i))}else if(i.name=="ListItem"&&i.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let h=o[4],f=o[0].length;h.length>4&&(h=h.slice(0,h.length-4),f-=4);let p=o[2];o[3]&&(p+=o[3].replace(/[xX]/," ")),n.push(new K(i.parent,l,l+f,o[1],h,p,i))}}return n}function tt(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function J(t,e,r,n=0){for(let s=-1,i=t;;){if(i.name=="ListItem"){let a=tt(i,e),l=+a[2];if(s>=0){if(l!=s+1)return;r.push({from:i.from+a[1].length,to:i.from+a[0].length,insert:String(s+2+n)})}s=l}let o=i.nextSibling;if(!o)break;i=o}}function he(t,e){let r=/^[ \t]*/.exec(t)[0].length;if(!r||e.facet(ut)!=" ")return t;let n=z(t,4,r),s="";for(let i=n;i>0;)i>=4?(s+=" ",i-=4):(s+=" ",i--);return s+t.slice(r)}const Wt=(t={})=>({state:e,dispatch:r})=>{let n=X(e),{doc:s}=e,i=null,o=e.changeByRange(a=>{if(!a.empty||!q.isActiveAt(e,a.from,-1)&&!q.isActiveAt(e,a.from,1))return i={range:a};let l=a.from,h=s.lineAt(l),f=et(n.resolveInner(l,-1),s);for(;f.length&&f[f.length-1].from>l-h.from;)f.pop();if(!f.length)return i={range:a};let p=f[f.length-1];if(p.to-p.spaceAfter.length>l-h.from)return i={range:a};let d=l>=p.to-p.spaceAfter.length&&!/\S/.test(h.text.slice(p.to));if(p.item&&d){let w=p.node.firstChild,S=p.node.getChild("ListItem","ListItem");if(w.to>=l||S&&S.to0&&!/[^\s>]/.test(s.lineAt(h.from-1).text)||t.nonTightLists===!1){let b=f.length>1?f[f.length-2]:null,E,I="";b&&b.item?(E=h.from+b.from,I=b.marker(s,1)):E=h.from+(b?b.to:0);let y=[{from:E,to:l,insert:I}];return p.node.name=="OrderedList"&&J(p.item,s,y,-2),b&&b.node.name=="OrderedList"&&J(b.item,s,y),{range:P.cursor(E+I.length),changes:y}}else{let b=Be(f,e,h);return{range:P.cursor(l+b.length+1),changes:{from:h.from,insert:b+e.lineBreak}}}}if(p.node.name=="Blockquote"&&d&&h.from){let w=s.lineAt(h.from-1),S=/>\s*$/.exec(w.text);if(S&&S.index==p.from){let b=e.changes([{from:w.from+S.index,to:w.to},{from:h.from+p.from,to:h.to}]);return{range:a.map(b),changes:b}}}let c=[];p.node.name=="OrderedList"&&J(p.item,s,c);let L=p.item&&p.item.from]*/.exec(h.text)[0].length>=p.to)for(let w=0,S=f.length-1;w<=S;w++)g+=w==S&&!L?f[w].marker(s,1):f[w].blank(wh.from&&/\s/.test(h.text.charAt(B-h.from-1));)B--;return g=he(g,e),tr(p.node,e.doc)&&(g=Be(f,e,h)+e.lineBreak+g),c.push({from:B,to:l,insert:e.lineBreak+g}),{range:P.cursor(B+g.length+1),changes:c}});return i?!1:(r(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},er=Wt();function xe(t){return t.name=="QuoteMark"||t.name=="ListMark"}function tr(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let r=t.firstChild,n=t.getChild("ListItem","ListItem");if(!n)return!1;let s=e.lineAt(r.to),i=e.lineAt(n.from),o=/^[\s>]*$/.test(s.text);return s.number+(o?0:1){let r=X(t),n=null,s=t.changeByRange(i=>{let o=i.from,{doc:a}=t;if(i.empty&&q.isActiveAt(t,i.from)){let l=a.lineAt(o),h=et(rr(r,o),a);if(h.length){let f=h[h.length-1],p=f.to-f.spaceAfter.length+(f.spaceAfter?1:0);if(o-l.from>p&&!/\S/.test(l.text.slice(p,o-l.from)))return{range:P.cursor(l.from+p),changes:{from:l.from+p,to:o}};if(o-l.from==p&&(!f.item||l.from<=f.item.from||!/\S/.test(l.text.slice(0,f.to)))){let d=l.from+f.from;if(f.item&&f.node.from{var r;let{main:n}=e.state.selection;if(n.empty)return!1;let s=(r=t.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!q.isActiveAt(e.state,n.from,1)))return!1;let i=X(e.state),o=!1;return i.iterate({from:n.from,to:n.to,enter:a=>{(a.from>n.from||ar.test(a.name))&&(o=!0)},leave:a=>{a.to=65&&e<=90||e==95||e>=97&&e<=122||e>=161}let N=null,G=null,I=0;function Y(e,a){let r=e.pos+a;if(I==r&&G==e)return N;let l=e.peek(a),t="";for(;lt(l);)t+=String.fromCharCode(l),l=e.peek(++a);return G=e,I=r,N=t?t.toLowerCase():l==rt||l==nt?void 0:null}const oe=60,X=62,E=47,rt=63,nt=33,st=45;function j(e,a){this.name=e,this.parent=a}const ot=[R,le,ee,te,ae],it=new he({start:null,shift(e,a,r,l){return ot.indexOf(a)>-1?new j(Y(l,1)||"",e):e},reduce(e,a){return a==re&&e?e.parent:e},reuse(e,a,r,l){let t=a.type.id;return t==R||t==He?new j(Y(l,1)||"",e):e},strict:!1}),ut=new $((e,a)=>{if(e.next!=oe){e.next<0&&a.context&&e.acceptToken(_);return}e.advance();let r=e.next==E;r&&e.advance();let l=Y(e,0);if(l===void 0)return;if(!l)return e.acceptToken(r?Ge:Ne);let t=a.context?a.context.name:null;if(r){if(l==t)return e.acceptToken(ze);if(t&&at[t])return e.acceptToken(_,-2);if(a.dialectEnabled(Je))return e.acceptToken(De);for(let s=a.context;s;s=s.parent)if(s.name==l)return;e.acceptToken(We)}else{if(l=="script")return e.acceptToken(ee);if(l=="style")return e.acceptToken(te);if(l=="textarea")return e.acceptToken(ae);if(tt.hasOwnProperty(l))return e.acceptToken(le);t&&W[t]&&W[t][l]?e.acceptToken(_,-1):e.acceptToken(R)}},{contextual:!0}),Ot=new $(e=>{for(let a=0,r=0;;r++){if(e.next<0){r&&e.acceptToken(D);break}if(e.next==st)a++;else if(e.next==X&&a>=2){r>=3&&e.acceptToken(D,-2);break}else a=0;e.advance()}});function dt(e){for(;e;e=e.parent)if(e.name=="svg"||e.name=="math")return!0;return!1}const ct=new $((e,a)=>{if(e.next==E&&e.peek(1)==X){let r=a.dialectEnabled(et)||dt(a.context);e.acceptToken(r?Be:z,2)}else e.next==X&&e.acceptToken(z,1)});function Z(e,a,r){let l=2+e.length;return new $(t=>{for(let s=0,o=0,i=0;;i++){if(t.next<0){i&&t.acceptToken(a);break}if(s==0&&t.next==oe||s==1&&t.next==E||s>=2&&so?t.acceptToken(a,-o):t.acceptToken(r,-(o-2));break}else if((t.next==10||t.next==13)&&i){t.acceptToken(a,1);break}else s=o=0;t.advance()}})}const pt=Z("script",Ae,Ye),mt=Z("style",Me,Re),ft=Z("textarea",Ee,Ze),gt=Pe({"Text RawText IncompleteTag IncompleteCloseTag":b.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":b.angleBracket,TagName:b.tagName,"MismatchedCloseTag/TagName":[b.tagName,b.invalid],AttributeName:b.attributeName,"AttributeValue UnquotedAttributeValue":b.attributeValue,Is:b.definitionOperator,"EntityReference CharacterReference":b.character,Comment:b.blockComment,ProcessingInst:b.processingInstruction,DoctypeDecl:b.documentMeta}),St=be.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:",c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:it,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[gt],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let f=i.type.id;if(f==Ue)return q(i,u,r);if(f==Le)return q(i,u,l);if(f==Fe)return q(i,u,t);if(f==re&&s.length){let p=i.node,d=p.firstChild,m=d&&U(d,u),O;if(m){for(let c of s)if(c.tag==m&&(!c.attrs||c.attrs(O||(O=ie(d,u))))){let S=p.lastChild,h=S.type.id==Ke?S.from:p.to;if(h>d.to)return{parser:c.parser,overlay:[{from:d.to,to:h}]}}}}if(o&&f==ne){let p=i.node,d;if(d=p.firstChild){let m=o[u.read(d.from,d.to)];if(m)for(let O of m){if(O.tagName&&O.tagName!=U(p.parent,u))continue;let c=p.lastChild;if(c.type.id==A){let S=c.from+1,h=c.lastChild,T=c.to-(h&&h.isError?0:1);if(T>S)return{parser:O.parser,overlay:[{from:S,to:T}],bracketed:!0}}else if(c.type.id==se)return{parser:O.parser,overlay:[{from:c.from,to:c.to}]}}}}return null})}const V=["_blank","_self","_top","_parent"],C=["ascii","utf-8","utf-16","latin1","latin1"],k=["get","post","put","delete"],Q=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],g=["true","false"],n={},bt={a:{attrs:{href:null,ping:null,type:null,media:null,target:V,hreflang:null}},abbr:n,address:n,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:n,aside:n,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:n,base:{attrs:{href:null,target:V}},bdi:n,bdo:n,blockquote:{attrs:{cite:null}},body:n,br:n,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Q,formmethod:k,formnovalidate:["novalidate"],formtarget:V,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:n,center:n,cite:n,code:n,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:n,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:n,div:n,dl:n,dt:n,em:n,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:n,figure:n,footer:n,form:{attrs:{action:null,name:null,"accept-charset":C,autocomplete:["on","off"],enctype:Q,method:k,novalidate:["novalidate"],target:V}},h1:n,h2:n,h3:n,h4:n,h5:n,h6:n,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:n,hgroup:n,hr:n,html:{attrs:{manifest:null}},i:n,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Q,formmethod:k,formnovalidate:["novalidate"],formtarget:V,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:n,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:n,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:n,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:C,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:n,noscript:n,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:n,param:{attrs:{name:null,value:null}},pre:n,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:n,rt:n,ruby:n,samp:n,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:C}},section:n,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:n,source:{attrs:{src:null,type:null,media:null}},span:n,strong:n,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:n,summary:n,sup:n,table:n,tbody:n,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:n,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:n,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:n,time:{attrs:{datetime:null}},title:n,tr:n,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:n,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:n},Oe={accesskey:null,class:null,contenteditable:g,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:g,autocorrect:g,autocapitalize:g,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":g,"aria-autocomplete":["inline","list","both","none"],"aria-busy":g,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":g,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":g,"aria-hidden":g,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":g,"aria-multiselectable":g,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":g,"aria-relevant":null,"aria-required":g,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},de="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of de)Oe[e]=null;class y{constructor(a,r){this.tags={...bt,...a},this.globalAttrs={...Oe,...r},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}y.default=new y;function P(e,a,r=e.length){if(!a)return"";let l=a.firstChild,t=l&&l.getChild("TagName");return t?e.sliceString(t.from,Math.min(t.to,r)):""}function x(e,a=!1){for(;e;e=e.parent)if(e.name=="Element")if(a)a=!1;else return e;return null}function ce(e,a,r){let l=r.tags[P(e,x(a))];return l?.children||r.allTags}function B(e,a){let r=[];for(let l=x(a);l&&!l.type.isTop;l=x(l.parent)){let t=P(e,l);if(t&&l.lastChild.name=="CloseTag")break;t&&r.indexOf(t)<0&&(a.name=="EndTag"||a.from>=l.firstChild.to)&&r.push(t)}return r}const pe=/^[:\-\.\w\u00b7-\uffff]*$/;function L(e,a,r,l,t){let s=/\s*>/.test(e.sliceDoc(t,t+5))?"":">",o=x(r,r.name=="StartTag"||r.name=="TagName");return{from:l,to:t,options:ce(e.doc,o,a).map(i=>({label:i,type:"type"})).concat(B(e.doc,r).map((i,u)=>({label:"/"+i,apply:"/"+i+s,type:"type",boost:99-u}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function F(e,a,r,l){let t=/\s*>/.test(e.sliceDoc(l,l+5))?"":">";return{from:r,to:l,options:B(e.doc,a).map((s,o)=>({label:s,apply:s+t,type:"type",boost:99-o})),validFor:pe}}function ht(e,a,r,l){let t=[],s=0;for(let o of ce(e.doc,r,a))t.push({label:"<"+o,type:"type"});for(let o of B(e.doc,r))t.push({label:"",type:"type",boost:99-s++});return{from:l,to:l,options:t,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Tt(e,a,r,l,t){let s=x(r),o=s?a.tags[P(e.doc,s)]:null,i=o&&o.attrs?Object.keys(o.attrs):[],u=o&&o.globalAttrs===!1?i:i.length?i.concat(a.globalAttrNames):a.globalAttrNames;return{from:l,to:t,options:u.map(f=>({label:f,type:"property"})),validFor:pe}}function Pt(e,a,r,l,t){var s;let o=(s=r.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),i=[],u;if(o){let f=e.sliceDoc(o.from,o.to),p=a.globalAttrs[f];if(!p){let d=x(r),m=d?a.tags[P(e.doc,d)]:null;p=m?.attrs&&m.attrs[f]}if(p){let d=e.sliceDoc(l,t).toLowerCase(),m='"',O='"';/^['"]/.test(d)?(u=d[0]=='"'?/^[^"]*$/:/^[^']*$/,m="",O=e.sliceDoc(t,t+1)==d[0]?"":d[0],d=d.slice(1),l++):u=/^[^\s<>='"]*$/;for(let c of p)i.push({label:c,apply:m+c+O,type:"constant"})}}return{from:l,to:t,options:i,validFor:u}}function me(e,a){let{state:r,pos:l}=a,t=K(r).resolveInner(l,-1),s=t.resolve(l);for(let o=l,i;s==t&&(i=t.childBefore(o));){let u=i.lastChild;if(!u||!u.type.isError||u.fromme(l,t)}const Vt=M.parser.configure({top:"SingleExpression"}),fe=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:qe.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:Ce.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:ke.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:Vt},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:M.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:J.parser}],ge=[{name:"style",parser:J.parser.configure({top:"Styles"})}].concat(de.map(e=>({name:e,parser:M.parser}))),Se=we.define({name:"html",parser:St.configure({props:[ve.add({Element(e){let a=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+a[0].length?e.continue():e.lineIndent(e.node.from)+(a[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].lengthe.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),v=Se.configure({wrap:ue(fe,ge)});function kt(e={}){let a="",r;e.matchClosingTags===!1&&(a="noMatch"),e.selfClosingTags===!0&&(a=(a?a+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(r=ue((e.nestedLanguages||[]).concat(fe),(e.nestedAttributes||[]).concat(ge)));let l=r?Se.configure({wrap:r,dialect:a}):a?v.configure({dialect:a}):v;return new ye(l,[v.data.of({autocomplete:xt(e)}),e.autoCloseTags!==!1?yt:[],Qe().support,_e().support])}const H=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),yt=xe.inputHandler.of((e,a,r,l,t)=>{if(e.composing||e.state.readOnly||a!=r||l!=">"&&l!="/"||!v.isActiveAt(e.state,a,-1))return!1;let s=t(),{state:o}=s,i=o.changeByRange(u=>{var f,p,d;let m=o.doc.sliceString(u.from-1,u.to)==l,{head:O}=u,c=K(o).resolveInner(O,-1),S;if(m&&l==">"&&c.name=="EndTag"){let h=c.parent;if(((p=(f=h.parent)===null||f===void 0?void 0:f.lastChild)===null||p===void 0?void 0:p.name)!="CloseTag"&&(S=P(o.doc,h.parent,O))&&!H.has(S)){let T=O+(o.doc.sliceString(O,O+1)===">"?1:0),w=``;return{range:u,changes:{from:O,to:T,insert:w}}}}else if(m&&l=="/"&&c.name=="IncompleteCloseTag"){let h=c.parent;if(c.from==O-2&&((d=h.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(S=P(o.doc,h,O))&&!H.has(S)){let T=O+(o.doc.sliceString(O,O+1)===">"?1:0),w=`${S}>`;return{range:Ve.cursor(O+w.length,-1),changes:{from:O,to:T,insert:w}}}}return{range:u}});return i.changes.empty?!1:(e.dispatch([s,o.update(i,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});export{yt as autoCloseTags,kt as html,Ct as htmlCompletionSource,xt as htmlCompletionSourceWith,v as htmlLanguage}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-tFQomdd2.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-tFQomdd2.js new file mode 100644 index 0000000000000000000000000000000000000000..cc10034fd931d4ea72f41067fd16efa18ddf80a0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-tFQomdd2.js @@ -0,0 +1 @@ +var f=Object.prototype.hasOwnProperty;function s(t,e,r){for(r of t.keys())if(u(r,e))return r}function u(t,e){var r,i,n;if(t===e)return!0;if(t&&e&&(r=t.constructor)===e.constructor){if(r===Date)return t.getTime()===e.getTime();if(r===RegExp)return t.toString()===e.toString();if(r===Array){if((i=t.length)===e.length)for(;i--&&u(t[i],e[i]););return i===-1}if(r===Set){if(t.size!==e.size)return!1;for(i of t)if(n=i,n&&typeof n=="object"&&(n=s(e,n),!n)||!e.has(n))return!1;return!0}if(r===Map){if(t.size!==e.size)return!1;for(i of t)if(n=i[0],n&&typeof n=="object"&&(n=s(e,n),!n)||!u(i[1],e.get(n)))return!1;return!0}if(r===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(r===DataView){if((i=t.byteLength)===e.byteLength)for(;i--&&t.getInt8(i)===e.getInt8(i););return i===-1}if(ArrayBuffer.isView(t)){if((i=t.byteLength)===e.byteLength)for(;i--&&t[i]===e[i];);return i===-1}if(!r||typeof t=="object"){i=0;for(r in t)if(f.call(t,r)&&++i&&!f.call(e,r)||!(r in e)||!u(t[r],e[r]))return!1;return Object.keys(e).length===i}}return t!==t&&e!==e}export{u as d}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-uLojFN0n.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-uLojFN0n.css new file mode 100644 index 0000000000000000000000000000000000000000..7582b07724a5bcc8ffc2e5bfc40a491fdc65b94c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/index-uLojFN0n.css @@ -0,0 +1 @@ +.file-name.svelte-ey25pz{padding:var(--size-6);font-size:var(--text-xxl);word-break:break-all}.file-size.svelte-ey25pz{padding:var(--size-2);font-size:var(--text-xl)}.upload-container.svelte-ey25pz{height:100%;width:100%}.video-container.svelte-ey25pz{display:flex;height:100%;flex-direction:column;justify-content:center;align-items:center} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/infoDiagram-WHAUD3N6-MJfiAORX.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/infoDiagram-WHAUD3N6-MJfiAORX.js new file mode 100644 index 0000000000000000000000000000000000000000..8df285f39e2d51e2586d2d92af556dd907effe06 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/infoDiagram-WHAUD3N6-MJfiAORX.js @@ -0,0 +1,2 @@ +import{_ as e,l as o,I as i,d as n,K as p}from"./mermaid.core-7TB2QPZo.js";import{p as g}from"./treemap-KMMF4GRG-B4w9v4mX.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";import"./select-BigU4G0v.js";import"./min-ljrXhbfm.js";import"./_baseUniq-DT1kfcxk.js";var m={parse:e(async r=>{const a=await g("info",r);o.debug(a)},"parse")},d={version:p.version+""},v=e(()=>d.version,"getVersion"),c={getVersion:v},l=e((r,a,s)=>{o.debug(`rendering info diagram +`+r);const t=i(a);n(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${s}`)},"draw"),f={draw:l},F={parser:m,db:c,renderer:f};export{F as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/init-Dmth1JHB.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/init-Dmth1JHB.js new file mode 100644 index 0000000000000000000000000000000000000000..3b68f9cedb54ecfe4b6cedad20b7e17ee8e5de62 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/init-Dmth1JHB.js @@ -0,0 +1 @@ +function a(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function s(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}export{s as a,a as i}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/input-DrerMDOL.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/input-DrerMDOL.js new file mode 100644 index 0000000000000000000000000000000000000000..0f8cb94a81da4fdc811559a9a89d692ef8d35138 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/input-DrerMDOL.js @@ -0,0 +1 @@ +import{J as t,D as m,K as y,L as s,M as D,z as E,B as u,N as V,O as x,P as g,Q as w,h as b}from"./index-DWyDLubb.js";function B(e,r,c=r){var d=new WeakSet;t(e,"input",async l=>{m&&e.type==="checkbox"&&y();var f=l?e.defaultValue:e.value;if(f=k(e)?i(f):f,c(f),s!==null&&d.add(s),await D(),f!==(f=r())){var v=e.selectionStart,o=e.selectionEnd,h=e.value.length;if(e.value=f??"",o!==null){var a=e.value.length;v===o&&o===h&&a>h?(e.selectionStart=a,e.selectionEnd=a):(e.selectionStart=v,e.selectionEnd=Math.min(o,a))}}}),(b&&e.defaultValue!==e.value||E(r)==null&&e.value)&&(c(k(e)?i(e.value):e.value),s!==null&&d.add(s)),u(()=>{m&&e.type==="checkbox"&&y();var l=r();if(e===document.activeElement){var f=g??s;if(d.has(f))return}k(e)&&l===i(e.value)||e.type==="date"&&!l&&!e.value||l!==e.value&&(e.value=l??"")})}const n=new Set;function M(e,r,c,d,l=d){var f=c.getAttribute("type")==="checkbox",v=e;let o=!1;if(r!==null)for(var h of r)v=v[h]??=[];v.push(c),t(c,"change",()=>{var a=c.__value;f&&(a=S(v,a,c.checked)),l(a)},()=>l(f?[]:null)),u(()=>{var a=d();if(b&&c.defaultChecked!==c.checked){o=!0;return}f?(a=a||[],c.checked=a.includes(c.__value)):c.checked=w(c.__value,a)}),V(()=>{var a=v.indexOf(c);a!==-1&&v.splice(a,1)}),n.has(v)||(n.add(v),x(()=>{v.sort((a,_)=>a.compareDocumentPosition(_)===4?-1:1),n.delete(v)})),x(()=>{if(o){var a;if(f)a=S(v,a,c.checked);else{var _=v.find(C=>C.checked);a=_?.__value}l(a)}})}function O(e,r,c=r){t(e,"change",d=>{var l=d?e.defaultChecked:e.checked;c(l)}),(b&&e.defaultChecked!==e.checked||E(r)==null)&&c(e.checked),u(()=>{var d=r();e.checked=!!d})}function S(e,r,c){for(var d=new Set,l=0;l;attribute world1 : vec4;attribute world2 : vec4;attribute world3 : vec4; +#ifdef INSTANCESCOLOR +attribute instanceColor : vec4; +#endif +#if defined(THIN_INSTANCES) && !defined(WORLD_UBO) +uniform world : mat4x4; +#endif +#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR) +attribute previousWorld0 : vec4;attribute previousWorld1 : vec4;attribute previousWorld2 : vec4;attribute previousWorld3 : vec4; +#ifdef THIN_INSTANCES +uniform previousWorld : mat4x4; +#endif +#endif +#else +#if !defined(WORLD_UBO) +uniform world : mat4x4; +#endif +#if defined(VELOCITY) || defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR) +uniform previousWorld : mat4x4; +#endif +#endif +`;e.IncludesShadersStoreWGSL[d]||(e.IncludesShadersStoreWGSL[d]=i); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/instancesVertex-CO_CTxxp.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/instancesVertex-CO_CTxxp.js new file mode 100644 index 0000000000000000000000000000000000000000..f9da29d4f13710acbfcf5ba16cf42d363219a02f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/instancesVertex-CO_CTxxp.js @@ -0,0 +1,36 @@ +import{S as e}from"./index-CDrXokXW.js";const r="bakedVertexAnimationDeclaration",i=`#ifdef BAKED_VERTEX_ANIMATION_TEXTURE +uniform bakedVertexAnimationTime: f32;uniform bakedVertexAnimationTextureSizeInverted: vec2;uniform bakedVertexAnimationSettings: vec4;var bakedVertexAnimationTexture : texture_2d; +#ifdef INSTANCES +attribute bakedVertexAnimationSettingsInstanced : vec4; +#endif +fn readMatrixFromRawSamplerVAT(smp : texture_2d,index : f32,frame : f32)->mat4x4 +{let offset=i32(index)*4;let frameUV=i32(frame);let m0=textureLoad(smp,vec2(offset+0,frameUV),0);let m1=textureLoad(smp,vec2(offset+1,frameUV),0);let m2=textureLoad(smp,vec2(offset+2,frameUV),0);let m3=textureLoad(smp,vec2(offset+3,frameUV),0);return mat4x4(m0,m1,m2,m3);} +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=i);const d="instancesVertex",f=`#ifdef INSTANCES +var finalWorld=mat4x4(vertexInputs.world0,vertexInputs.world1,vertexInputs.world2,vertexInputs.world3); +#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR) +var finalPreviousWorld=mat4x4( +vertexInputs.previousWorld0,vertexInputs.previousWorld1, +vertexInputs.previousWorld2,vertexInputs.previousWorld3); +#endif +#ifdef THIN_INSTANCES +#if !defined(WORLD_UBO) +finalWorld=uniforms.world*finalWorld; +#else +finalWorld=mesh.world*finalWorld; +#endif +#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR) +finalPreviousWorld=uniforms.previousWorld*finalPreviousWorld; +#endif +#endif +#else +#if !defined(WORLD_UBO) +var finalWorld=uniforms.world; +#else +var finalWorld=mesh.world; +#endif +#if defined(PREPASS_VELOCITY) || defined(VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) || defined(VELOCITY_LINEAR) +var finalPreviousWorld=uniforms.previousWorld; +#endif +#endif +`;e.IncludesShadersStoreWGSL[d]||(e.IncludesShadersStoreWGSL[d]=f); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ja-us1feo4m.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ja-us1feo4m.js new file mode 100644 index 0000000000000000000000000000000000000000..6818aee33d17d51d8a0694e9d30494f49c4fd7ac --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ja-us1feo4m.js @@ -0,0 +1 @@ +const S="日本語",o={annotated_image:"注釈付き画像"},e={allow_recording_access:"録音のためにマイクへのアクセスを許可してください",audio:"音声",record_from_microphone:"マイクから録音",stop_recording:"録音を停止",no_device_support:"メディアデバイスにアクセスできません。安全なソース(https)またはlocalhostで実行していること(またはssl_verifyに有効なSSL証明書を渡していること)、ブラウザにデバイスへのアクセスを許可していることを確認してください",stop:"停止",resume:"再開",record:"録音",no_microphone:"マイクが見つかりません",pause:"一時停止",play:"再生",waiting:"待機中",drop_to_upload:"ここにオーディオファイルをドロップしてアップロードしてください"},r={connection_can_break:"モバイルでは、このタブがフォーカスを失うかデバイスがスリープモードになると接続が切断され、キュー内の位置が失われる可能性があります",long_requests_queue:"保留中のリクエストの長いキューがあります。このSpaceを複製してスキップしてください",lost_connection:"ページを離れたため接続が切断されました。キューに戻ります...",waiting_for_inputs:"ファイルのアップロードが完了するのを待っています。再度お試しください"},t={checkbox:"チェックボックス",checkbox_group:"チェックボックスグループ"},_={code:"コード"},c={color_picker:"カラーピッカー"},a={built_with:"で作成",built_with_gradio:"Gradioで作成",clear:"クリア",download:"ダウンロード",edit:"編集",empty:"空",error:"エラー",hosted_on:"でホスト",loading:"読み込み中",logo:"ロゴ",or:"または",remove:"削除",settings:"設定",share:"共有",submit:"送信",undo:"元に戻す",no_devices:"デバイスが見つかりません",language:"言語",display_theme:"表示テーマ",pwa:"プログレッシブウェブアプリ"},n={incorrect_format:"不正なフォーマット、CSVとTSVファイルのみサポートされています",new_column:"列を追加",new_row:"新しい行",add_row_above:"上に行を追加",add_row_below:"下に行を追加",add_column_left:"左に列を追加",add_column_right:"右に列を追加",delete_row:"行を削除",delete_column:"列を削除",sort_column:"列をソート",sort_ascending:"昇順に並べ替え",sort_descending:"降順に並べ替え",drop_to_upload:"CSVまたはTSVファイルをここにドロップして、データをデータフレームにインポートします",clear_sort:"ソートをクリア"},s={dropdown:"ドロップダウン"},d={build_error:"ビルドエラーがあります",config_error:"設定エラーがあります",contact_page_author:"ページの作者に連絡して知らせてください",no_app_file:"アプリファイルがありません",runtime_error:"ランタイムエラーがあります",space_not_working:'"Spaceが動作していません。理由:" {0}',space_paused:"Spaceが一時停止されています",use_via_api:"APIを介して使用",use_via_api_or_mcp:"APIまたはMCP経由で使用"},i={uploading:"アップロード中..."},l={highlighted_text:"ハイライトされたテキスト"},p={allow_webcam_access:"録画のためにウェブカメラへのアクセスを許可してください",brush_color:"ブラシの色",brush_radius:"ブラシのサイズ",image:"画像",remove_image:"画像を削除",select_brush_color:"ブラシの色を選択",start_drawing:"描画を開始",use_brush:"ブラシを使用",drop_to_upload:"ここに画像ファイルをドロップしてアップロードしてください"},u={label:"ラベル"},g={enable_cookies:"シークレットモードでHuggingFace Spaceを訪問している場合、サードパーティのCookieを有効にする必要があります",incorrect_credentials:"認証情報が正しくありません",username:"ユーザー名",password:"パスワード",login:"ログイン"},m={number:"数値"},b={plot:"プロット"},h={radio:"ラジオボタン"},w={slider:"スライダー"},k={click_to_upload:"クリックしてアップロード",drop_audio:"音声をここにドロップ",drop_csv:"CSVファイルをここにドロップ",drop_file:"ファイルをここにドロップ",drop_image:"画像をここにドロップ",drop_video:"動画をここにドロップ",drop_gallery:"メディアをここにドロップ",paste_clipboard:"クリップボードから貼り付け"},f={drop_to_upload:"ビデオファイルをここにドロップしてアップロードしてください"},v={edit:"編集",retry:"再試行",undo:"元に戻す",submit:"送信",cancel:"キャンセル",like:"いいね",dislike:"よくないね",clear:"会話をクリア"},x={_name:"日本語","3D_model":{"3d_model":"3Dモデル",drop_to_upload:"3D モデル (.obj, .glb, .stl, .gltf, .splat, .ply) ファイルをここにドロップしてアップロードしてください"},annotated_image:o,audio:e,blocks:r,checkbox:t,code:_,color_picker:c,common:a,dataframe:n,dropdown:s,errors:d,file:i,highlighted_text:l,image:p,label:u,login:g,number:m,plot:b,radio:h,slider:w,upload_text:k,video:f,chatbot:v};export{S as _name,o as annotated_image,e as audio,r as blocks,v as chatbot,t as checkbox,_ as code,c as color_picker,a as common,n as dataframe,x as default,s as dropdown,d as errors,i as file,l as highlighted_text,p as image,u as label,g as login,m as number,b as plot,h as radio,w as slider,k as upload_text,f as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/jinja2-C4DGRd-O.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/jinja2-C4DGRd-O.js new file mode 100644 index 0000000000000000000000000000000000000000..2eadb3bf4cd12dbbb9007606e5963ddee1e6fce4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/jinja2-C4DGRd-O.js @@ -0,0 +1 @@ +var l=["and","as","block","endblock","by","cycle","debug","else","elif","extends","filter","endfilter","firstof","do","for","endfor","if","endif","ifchanged","endifchanged","ifequal","endifequal","ifnotequal","set","raw","endraw","endifnotequal","in","include","load","not","now","or","parsed","regroup","reversed","spaceless","call","endcall","macro","endmacro","endspaceless","ssi","templatetag","openblock","closeblock","openvariable","closevariable","without","context","openbrace","closebrace","opencomment","closecomment","widthratio","url","with","endwith","get_current_language","trans","endtrans","noop","blocktrans","endblocktrans","get_available_languages","get_current_language_bidi","pluralize","autoescape","endautoescape"],c=/^[+\-*&%=<>!?|~^]/,f=/^[:\[\(\{]/,o=["true","false"],r=/^(\d[+\-\*\/])?\d+(\.\d+)?/;l=new RegExp("(("+l.join(")|(")+"))\\b");o=new RegExp("(("+o.join(")|(")+"))\\b");function u(n,e){var i=n.peek();if(e.incomment)return n.skipTo("#}")?(n.eatWhile(/\#|}/),e.incomment=!1):n.skipToEnd(),"comment";if(e.intag){if(e.operator){if(e.operator=!1,n.match(o))return"atom";if(n.match(r))return"number"}if(e.sign){if(e.sign=!1,n.match(o))return"atom";if(n.match(r))return"number"}if(e.instring)return i==e.instring&&(e.instring=!1),n.next(),"string";if(i=="'"||i=='"')return e.instring=i,n.next(),"string";if(e.inbraces>0&&i==")")n.next(),e.inbraces--;else if(i=="(")n.next(),e.inbraces++;else if(e.inbrackets>0&&i=="]")n.next(),e.inbrackets--;else if(i=="[")n.next(),e.inbrackets++;else{if(!e.lineTag&&(n.match(e.intag+"}")||n.eat("-")&&n.match(e.intag+"}")))return e.intag=!1,"tag";if(n.match(c))return e.operator=!0,"operator";if(n.match(f))e.sign=!0;else{if(n.column()==1&&e.lineTag&&n.match(l))return"keyword";if(n.eat(" ")||n.sol()){if(n.match(l))return"keyword";if(n.match(o))return"atom";if(n.match(r))return"number";n.sol()&&n.next()}else n.next()}}return"variable"}else if(n.eat("{")){if(n.eat("#"))return e.incomment=!0,n.skipTo("#}")?(n.eatWhile(/\#|}/),e.incomment=!1):n.skipToEnd(),"comment";if(i=n.eat(/\{|%/))return e.intag=i,e.inbraces=0,e.inbrackets=0,i=="{"&&(e.intag="}"),n.eat("-"),"tag"}else if(n.eat("#")){if(n.peek()=="#")return n.skipToEnd(),"comment";if(!n.eol())return e.intag=!0,e.lineTag=!0,e.inbraces=0,e.inbrackets=0,"tag"}n.next()}const a={name:"jinja2",startState:function(){return{tokenize:u,inbrackets:0,inbraces:0}},token:function(n,e){var i=e.tokenize(n,e);return n.eol()&&e.lineTag&&!e.instring&&e.inbraces==0&&e.inbrackets==0&&(e.intag=!1,e.lineTag=!1),i},languageData:{commentTokens:{block:{open:"{#",close:"#}",line:"##"}}}};export{a as jinja2}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/journeyDiagram-XKPGCS4Q-CF8rya2c.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/journeyDiagram-XKPGCS4Q-CF8rya2c.js new file mode 100644 index 0000000000000000000000000000000000000000..ef9160040873cac8b16d0953d3f48512d9a0dff0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/journeyDiagram-XKPGCS4Q-CF8rya2c.js @@ -0,0 +1,139 @@ +import{a as gt,g as lt,f as mt,d as xt}from"./chunk-TZMSLE5B-bT_t1BIn.js";import{g as kt}from"./chunk-FMBD7UC4-DNqeu8Dh.js";import{g as _t,s as vt,a as bt,b as wt,q as Tt,p as St,_ as n,c as R,d as $t,y as Mt}from"./mermaid.core-7TB2QPZo.js";import{s as X}from"./select-BigU4G0v.js";import{d as et}from"./arc-Bt_eNeYl.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";var U=(function(){var t=n(function(h,i,a,l){for(a=a||{},l=h.length;l--;a[h[l]]=i);return a},"o"),e=[6,8,10,11,12,14,16,17,18],s=[1,9],c=[1,10],r=[1,11],f=[1,12],u=[1,13],y=[1,14],g={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:n(function(i,a,l,d,p,o,b){var k=o.length-1;switch(p){case 1:return o[k-1];case 2:this.$=[];break;case 3:o[k-1].push(o[k]),this.$=o[k-1];break;case 4:case 5:this.$=o[k];break;case 6:case 7:this.$=[];break;case 8:d.setDiagramTitle(o[k].substr(6)),this.$=o[k].substr(6);break;case 9:this.$=o[k].trim(),d.setAccTitle(this.$);break;case 10:case 11:this.$=o[k].trim(),d.setAccDescription(this.$);break;case 12:d.addSection(o[k].substr(8)),this.$=o[k].substr(8);break;case 13:d.addTask(o[k-1],o[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:s,12:c,14:r,16:f,17:u,18:y},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:s,12:c,14:r,16:f,17:u,18:y},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:n(function(i,a){if(a.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=a,l}},"parseError"),parse:n(function(i){var a=this,l=[0],d=[],p=[null],o=[],b=this.table,k="",C=0,K=0,dt=2,Q=1,yt=o.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(i,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;o.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,p.length=p.length-w,o.length=o.length-w}n(pt,"popStack");function D(){var w;return w=d.pop()||_.lex()||Q,typeof w!="number"&&(w instanceof Array&&(d=w,w=d.pop()),w=a.symbols_[w]||w),w}n(D,"lex");for(var v,A,T,q,F={},N,M,tt,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((v===null||typeof v>"u")&&(v=D()),T=b[A]&&b[A][v]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in b[A])this.terminals_[N]&&N>dt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`: +`+_.showPosition()+` +Expecting `+z.join(", ")+", got '"+(this.terminals_[v]||v)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(v==Q?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[v]||v,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+v);switch(T[0]){case 1:l.push(v),p.push(_.yytext),o.push(_.yylloc),l.push(T[1]),v=null,K=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=p[p.length-M],F._$={first_line:o[o.length-(M||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(M||1)].first_column,last_column:o[o.length-1].last_column},ft&&(F._$.range=[o[o.length-(M||1)].range[0],o[o.length-1].range[1]]),q=this.performAction.apply(F,[k,K,C,I.yy,T[1],p,o].concat(yt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),p=p.slice(0,-1*M),o=o.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),p.push(F.$),o.push(F._$),tt=b[l[l.length-2]][l[l.length-1]],l.push(tt);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:n(function(a,l){if(this.yy.parser)this.yy.parser.parseError(a,l);else throw new Error(a)},"parseError"),setInput:n(function(i,a){return this.yy=a||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:n(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var a=i.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:n(function(i){var a=i.length,l=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===d.length?this.yylloc.first_column:0)+d[d.length-l.length].length-l[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n(function(i){this.unput(this.match.slice(i))},"less"),pastInput:n(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n(function(){var i=this.pastInput(),a=new Array(i.length+1).join("-");return i+this.upcomingInput()+` +`+a+"^"},"showPosition"),test_match:n(function(i,a){var l,d,p;if(this.options.backtrack_lexer&&(p={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(p.yylloc.range=this.yylloc.range.slice(0))),d=i[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],l=this.performAction.call(this,this.yy,this,a,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),l)return l;if(this._backtrack){for(var o in p)this[o]=p[o];return!1}return!1},"test_match"),next:n(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,a,l,d;this._more||(this.yytext="",this.match="");for(var p=this._currentRules(),o=0;oa[0].length)){if(a=l,d=o,this.options.backtrack_lexer){if(i=this.test_match(l,p[o]),i!==!1)return i;if(this._backtrack){a=!1;continue}else return!1}else if(!this.options.flex)break}return a?(i=this.test_match(a,p[d]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:n(function(){var a=this.next();return a||this.lex()},"lex"),begin:n(function(a){this.conditionStack.push(a)},"begin"),popState:n(function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:n(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:n(function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},"topState"),pushState:n(function(a){this.begin(a)},"pushState"),stateStackSize:n(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:n(function(a,l,d,p){switch(d){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),14;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 18;case 16:return 19;case 17:return":";case 18:return 6;case 19:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18,19],inclusive:!0}}};return h})();g.lexer=m;function x(){this.yy={}}return n(x,"Parser"),x.prototype=g,g.Parser=x,new x})();U.parser=U;var Et=U,V="",Z=[],L=[],B=[],Ct=n(function(){Z.length=0,L.length=0,V="",B.length=0,Mt()},"clear"),Pt=n(function(t){V=t,Z.push(t)},"addSection"),It=n(function(){return Z},"getSections"),At=n(function(){let t=it();const e=100;let s=0;for(;!t&&s{s.people&&t.push(...s.people)}),[...new Set(t)].sort()},"updateActors"),Vt=n(function(t,e){const s=e.substr(1).split(":");let c=0,r=[];s.length===1?(c=Number(s[0]),r=[]):(c=Number(s[0]),r=s[1].split(","));const f=r.map(y=>y.trim()),u={section:V,type:V,people:f,task:t,score:c};B.push(u)},"addTask"),Rt=n(function(t){const e={section:V,type:V,description:t,task:t,classes:[]};L.push(e)},"addTaskOrg"),it=n(function(){const t=n(function(s){return B[s].processed},"compileTask");let e=!0;for(const[s,c]of B.entries())t(s),e=e&&c.processed;return e},"compileTasks"),Lt=n(function(){return Ft()},"getActors"),rt={getConfig:n(()=>R().journey,"getConfig"),clear:Ct,setDiagramTitle:St,getDiagramTitle:Tt,setAccTitle:wt,getAccTitle:bt,setAccDescription:vt,getAccDescription:_t,addSection:Pt,getSections:It,getTasks:At,addTask:Vt,addTaskOrg:Rt,getActors:Lt},Bt=n(t=>`.label { + font-family: ${t.fontFamily}; + color: ${t.textColor}; + } + .mouth { + stroke: #666; + } + + line { + stroke: ${t.textColor} + } + + .legend { + fill: ${t.textColor}; + font-family: ${t.fontFamily}; + } + + .label text { + fill: #333; + } + .label { + color: ${t.textColor} + } + + .face { + ${t.faceColor?`fill: ${t.faceColor}`:"fill: #FFF8DC"}; + stroke: #999; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${t.mainBkg}; + stroke: ${t.nodeBorder}; + stroke-width: 1px; + } + + .node .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + .arrowheadPath { + fill: ${t.arrowheadColor}; + } + + .edgePath .path { + stroke: ${t.lineColor}; + stroke-width: 1.5px; + } + + .flowchart-link { + stroke: ${t.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${t.edgeLabelBackground}; + rect { + opacity: 0.5; + } + text-align: center; + } + + .cluster rect { + } + + .cluster text { + fill: ${t.titleColor}; + } + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${t.fontFamily}; + font-size: 12px; + background: ${t.tertiaryColor}; + border: 1px solid ${t.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .task-type-0, .section-type-0 { + ${t.fillType0?`fill: ${t.fillType0}`:""}; + } + .task-type-1, .section-type-1 { + ${t.fillType0?`fill: ${t.fillType1}`:""}; + } + .task-type-2, .section-type-2 { + ${t.fillType0?`fill: ${t.fillType2}`:""}; + } + .task-type-3, .section-type-3 { + ${t.fillType0?`fill: ${t.fillType3}`:""}; + } + .task-type-4, .section-type-4 { + ${t.fillType0?`fill: ${t.fillType4}`:""}; + } + .task-type-5, .section-type-5 { + ${t.fillType0?`fill: ${t.fillType5}`:""}; + } + .task-type-6, .section-type-6 { + ${t.fillType0?`fill: ${t.fillType6}`:""}; + } + .task-type-7, .section-type-7 { + ${t.fillType0?`fill: ${t.fillType7}`:""}; + } + + .actor-0 { + ${t.actor0?`fill: ${t.actor0}`:""}; + } + .actor-1 { + ${t.actor1?`fill: ${t.actor1}`:""}; + } + .actor-2 { + ${t.actor2?`fill: ${t.actor2}`:""}; + } + .actor-3 { + ${t.actor3?`fill: ${t.actor3}`:""}; + } + .actor-4 { + ${t.actor4?`fill: ${t.actor4}`:""}; + } + .actor-5 { + ${t.actor5?`fill: ${t.actor5}`:""}; + } + ${kt()} +`,"getStyles"),jt=Bt,J=n(function(t,e){return xt(t,e)},"drawRect"),Nt=n(function(t,e){const c=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),r=t.append("g");r.append("circle").attr("cx",e.cx-15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),r.append("circle").attr("cx",e.cx+15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function f(g){const m=et().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);g.append("path").attr("class","mouth").attr("d",m).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}n(f,"smile");function u(g){const m=et().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);g.append("path").attr("class","mouth").attr("d",m).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}n(u,"sad");function y(g){g.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return n(y,"ambivalent"),e.score>3?f(r):e.score<3?u(r):y(r),c},"drawFace"),ot=n(function(t,e){const s=t.append("circle");return s.attr("cx",e.cx),s.attr("cy",e.cy),s.attr("class","actor-"+e.pos),s.attr("fill",e.fill),s.attr("stroke",e.stroke),s.attr("r",e.r),s.class!==void 0&&s.attr("class",s.class),e.title!==void 0&&s.append("title").text(e.title),s},"drawCircle"),ct=n(function(t,e){return mt(t,e)},"drawText"),zt=n(function(t,e){function s(r,f,u,y,g){return r+","+f+" "+(r+u)+","+f+" "+(r+u)+","+(f+y-g)+" "+(r+u-g*1.2)+","+(f+y)+" "+r+","+(f+y)}n(s,"genPoints");const c=t.append("polygon");c.attr("points",s(e.x,e.y,50,20,7)),c.attr("class","labelBox"),e.y=e.y+e.labelMargin,e.x=e.x+.5*e.labelMargin,ct(t,e)},"drawLabel"),Wt=n(function(t,e,s){const c=t.append("g"),r=lt();r.x=e.x,r.y=e.y,r.fill=e.fill,r.width=s.width*e.taskCount+s.diagramMarginX*(e.taskCount-1),r.height=s.height,r.class="journey-section section-type-"+e.num,r.rx=3,r.ry=3,J(c,r),ht(s)(e.text,c,r.x,r.y,r.width,r.height,{class:"journey-section section-type-"+e.num},s,e.colour)},"drawSection"),nt=-1,Ot=n(function(t,e,s){const c=e.x+s.width/2,r=t.append("g");nt++,r.append("line").attr("id","task"+nt).attr("x1",c).attr("y1",e.y).attr("x2",c).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Nt(r,{cx:c,cy:300+(5-e.score)*30,score:e.score});const u=lt();u.x=e.x,u.y=e.y,u.fill=e.fill,u.width=s.width,u.height=s.height,u.class="task task-type-"+e.num,u.rx=3,u.ry=3,J(r,u);let y=e.x+14;e.people.forEach(g=>{const m=e.actors[g].color,x={cx:y,cy:e.y,r:7,fill:m,stroke:"#000",title:g,pos:e.actors[g].position};ot(r,x),y+=10}),ht(s)(e.task,r,u.x,u.y,u.width,u.height,{class:"task"},s,e.colour)},"drawTask"),Yt=n(function(t,e){gt(t,e)},"drawBackgroundRect"),ht=(function(){function t(r,f,u,y,g,m,x,h){const i=f.append("text").attr("x",u+g/2).attr("y",y+m/2+5).style("font-color",h).style("text-anchor","middle").text(r);c(i,x)}n(t,"byText");function e(r,f,u,y,g,m,x,h,i){const{taskFontSize:a,taskFontFamily:l}=h,d=r.split(//gi);for(let p=0;p{const f=E[r].color,u={cx:20,cy:c,r:7,fill:f,stroke:"#000",pos:E[r].position};j.drawCircle(t,u);let y=t.append("text").attr("visibility","hidden").text(r);const g=y.node().getBoundingClientRect().width;y.remove();let m=[];if(g<=s)m=[r];else{const x=r.split(" ");let h="";y=t.append("text").attr("visibility","hidden"),x.forEach(i=>{const a=h?`${h} ${i}`:i;if(y.text(a),y.node().getBoundingClientRect().width>s){if(h&&m.push(h),h=i,y.text(i),y.node().getBoundingClientRect().width>s){let d="";for(const p of i)d+=p,y.text(d+"-"),y.node().getBoundingClientRect().width>s&&(m.push(d.slice(0,-1)+"-"),d=p);h=d}}else h=a}),h&&m.push(h),y.remove()}m.forEach((x,h)=>{const i={x:40,y:c+7+h*20,fill:"#666",text:x,textMargin:e.boxTextMargin??5},l=j.drawText(t,i).node().getBoundingClientRect().width;l>W&&l>e.leftMargin-l&&(W=l)}),c+=Math.max(20,m.length*20)})}n(ut,"drawActorLegend");var $=R().journey,P=0,Xt=n(function(t,e,s,c){const r=R(),f=r.journey.titleColor,u=r.journey.titleFontSize,y=r.journey.titleFontFamily,g=r.securityLevel;let m;g==="sandbox"&&(m=X("#i"+e));const x=g==="sandbox"?X(m.nodes()[0].contentDocument.body):X("body");S.init();const h=x.select("#"+e);j.initGraphics(h);const i=c.db.getTasks(),a=c.db.getDiagramTitle(),l=c.db.getActors();for(const C in E)delete E[C];let d=0;l.forEach(C=>{E[C]={color:$.actorColours[d%$.actorColours.length],position:d},d++}),ut(h),P=$.leftMargin+W,S.insert(0,0,P,Object.keys(E).length*50),Gt(h,i,0);const p=S.getBounds();a&&h.append("text").text(a).attr("x",P).attr("font-size",u).attr("font-weight","bold").attr("y",25).attr("fill",f).attr("font-family",y);const o=p.stopy-p.starty+2*$.diagramMarginY,b=P+p.stopx+2*$.diagramMarginX;$t(h,o,b,$.useMaxWidth),h.append("line").attr("x1",P).attr("y1",$.height*4).attr("x2",b-P-4).attr("y2",$.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)");const k=a?70:0;h.attr("viewBox",`${p.startx} -25 ${b} ${o+k}`),h.attr("preserveAspectRatio","xMinYMin meet"),h.attr("height",o+k+25)},"draw"),S={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:n(function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},"init"),updateVal:n(function(t,e,s,c){t[e]===void 0?t[e]=s:t[e]=c(s,t[e])},"updateVal"),updateBounds:n(function(t,e,s,c){const r=R().journey,f=this;let u=0;function y(g){return n(function(x){u++;const h=f.sequenceItems.length-u+1;f.updateVal(x,"starty",e-h*r.boxMargin,Math.min),f.updateVal(x,"stopy",c+h*r.boxMargin,Math.max),f.updateVal(S.data,"startx",t-h*r.boxMargin,Math.min),f.updateVal(S.data,"stopx",s+h*r.boxMargin,Math.max),g!=="activation"&&(f.updateVal(x,"startx",t-h*r.boxMargin,Math.min),f.updateVal(x,"stopx",s+h*r.boxMargin,Math.max),f.updateVal(S.data,"starty",e-h*r.boxMargin,Math.min),f.updateVal(S.data,"stopy",c+h*r.boxMargin,Math.max))},"updateItemBounds")}n(y,"updateFn"),this.sequenceItems.forEach(y())},"updateBounds"),insert:n(function(t,e,s,c){const r=Math.min(t,s),f=Math.max(t,s),u=Math.min(e,c),y=Math.max(e,c);this.updateVal(S.data,"startx",r,Math.min),this.updateVal(S.data,"starty",u,Math.min),this.updateVal(S.data,"stopx",f,Math.max),this.updateVal(S.data,"stopy",y,Math.max),this.updateBounds(r,u,f,y)},"insert"),bumpVerticalPos:n(function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},"bumpVerticalPos"),getVerticalPos:n(function(){return this.verticalPos},"getVerticalPos"),getBounds:n(function(){return this.data},"getBounds")},G=$.sectionFills,st=$.sectionColours,Gt=n(function(t,e,s){const c=R().journey;let r="";const f=c.height*2+c.diagramMarginY,u=s+f;let y=0,g="#CCC",m="black",x=0;for(const[h,i]of e.entries()){if(r!==i.section){g=G[y%G.length],x=y%G.length,m=st[y%st.length];let l=0;const d=i.section;for(let o=h;o(E[d]&&(l[d]=E[d]),l),{});i.x=h*c.taskMargin+h*c.width+P,i.y=u,i.width=c.diagramMarginX,i.height=c.diagramMarginY,i.colour=m,i.fill=g,i.num=x,i.actors=a,j.drawTask(t,i,c),S.insert(i.x,i.y,i.x+i.width+c.taskMargin,450)}},"drawTasks"),at={setConf:Ht,draw:Xt},re={parser:Et,db:rt,renderer:at,styles:jt,init:n(t=>{at.setConf(t.journey),rt.clear()},"init")};export{re as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kanban-definition-3W4ZIXB7-DqtHVgz8.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kanban-definition-3W4ZIXB7-DqtHVgz8.js new file mode 100644 index 0000000000000000000000000000000000000000..79f3af584bed3fefbb5207923ab45d9cac469fb8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kanban-definition-3W4ZIXB7-DqtHVgz8.js @@ -0,0 +1,89 @@ +import{_ as o,l as te,c as H,I as fe,$ as ye,a0 as me,a1 as be,T as _e,F as K,h as j,t as Ee,J as ke,V as Se,W as ce,X as le}from"./mermaid.core-7TB2QPZo.js";import{g as Ne}from"./chunk-FMBD7UC4-DNqeu8Dh.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";import"./select-BigU4G0v.js";var $=(function(){var e=o(function(O,i,n,r){for(n=n||{},r=O.length;r--;n[O[r]]=i);return n},"o"),u=[1,4],p=[1,13],s=[1,12],d=[1,15],E=[1,16],m=[1,20],l=[1,19],D=[6,7,8],I=[1,26],g=[1,24],w=[1,25],_=[6,7,11],G=[1,31],N=[6,7,11,24],V=[1,6,13,16,17,20,23],b=[1,35],A=[1,36],L=[1,6,7,11,13,16,17,20,23],M=[1,38],T={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:o(function(i,n,r,a,h,t,U){var c=t.length-1;switch(h){case 6:case 7:return a;case 8:a.getLogger().trace("Stop NL ");break;case 9:a.getLogger().trace("Stop EOF ");break;case 11:a.getLogger().trace("Stop NL2 ");break;case 12:a.getLogger().trace("Stop EOF2 ");break;case 15:a.getLogger().info("Node: ",t[c-1].id),a.addNode(t[c-2].length,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 16:a.getLogger().info("Node: ",t[c].id),a.addNode(t[c-1].length,t[c].id,t[c].descr,t[c].type);break;case 17:a.getLogger().trace("Icon: ",t[c]),a.decorateNode({icon:t[c]});break;case 18:case 23:a.decorateNode({class:t[c]});break;case 19:a.getLogger().trace("SPACELIST");break;case 20:a.getLogger().trace("Node: ",t[c-1].id),a.addNode(0,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 21:a.getLogger().trace("Node: ",t[c].id),a.addNode(0,t[c].id,t[c].descr,t[c].type);break;case 22:a.decorateNode({icon:t[c]});break;case 27:a.getLogger().trace("node found ..",t[c-2]),this.$={id:t[c-1],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 28:this.$={id:t[c],descr:t[c],type:0};break;case 29:a.getLogger().trace("node found ..",t[c-3]),this.$={id:t[c-3],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 30:this.$=t[c-1]+t[c];break;case 31:this.$=t[c];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:u},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:u},{6:p,7:[1,10],9:9,12:11,13:s,14:14,16:d,17:E,18:17,19:18,20:m,23:l},e(D,[2,3]),{1:[2,2]},e(D,[2,4]),e(D,[2,5]),{1:[2,6],6:p,12:21,13:s,14:14,16:d,17:E,18:17,19:18,20:m,23:l},{6:p,9:22,12:11,13:s,14:14,16:d,17:E,18:17,19:18,20:m,23:l},{6:I,7:g,10:23,11:w},e(_,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:m,23:l}),e(_,[2,19]),e(_,[2,21],{15:30,24:G}),e(_,[2,22]),e(_,[2,23]),e(N,[2,25]),e(N,[2,26]),e(N,[2,28],{20:[1,32]}),{21:[1,33]},{6:I,7:g,10:34,11:w},{1:[2,7],6:p,12:21,13:s,14:14,16:d,17:E,18:17,19:18,20:m,23:l},e(V,[2,14],{7:b,11:A}),e(L,[2,8]),e(L,[2,9]),e(L,[2,10]),e(_,[2,16],{15:37,24:G}),e(_,[2,17]),e(_,[2,18]),e(_,[2,20],{24:M}),e(N,[2,31]),{21:[1,39]},{22:[1,40]},e(V,[2,13],{7:b,11:A}),e(L,[2,11]),e(L,[2,12]),e(_,[2,15],{24:M}),e(N,[2,30]),{22:[1,41]},e(N,[2,27]),e(N,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(i,n){if(n.recoverable)this.trace(i);else{var r=new Error(i);throw r.hash=n,r}},"parseError"),parse:o(function(i){var n=this,r=[0],a=[],h=[null],t=[],U=this.table,c="",W=0,se=0,ue=2,re=1,ge=t.slice.call(arguments,1),y=Object.create(this.lexer),R={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(R.yy[J]=this.yy[J]);y.setInput(i,R.yy),R.yy.lexer=y,R.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var q=y.yylloc;t.push(q);var de=y.options&&y.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){r.length=r.length-2*S,h.length=h.length-S,t.length=t.length-S}o(pe,"popStack");function ae(){var S;return S=a.pop()||y.lex()||re,typeof S!="number"&&(S instanceof Array&&(a=S,S=a.pop()),S=n.symbols_[S]||S),S}o(ae,"lex");for(var k,P,x,Q,F={},z,C,oe,X;;){if(P=r[r.length-1],this.defaultActions[P]?x=this.defaultActions[P]:((k===null||typeof k>"u")&&(k=ae()),x=U[P]&&U[P][k]),typeof x>"u"||!x.length||!x[0]){var Z="";X=[];for(z in U[P])this.terminals_[z]&&z>ue&&X.push("'"+this.terminals_[z]+"'");y.showPosition?Z="Parse error on line "+(W+1)+`: +`+y.showPosition()+` +Expecting `+X.join(", ")+", got '"+(this.terminals_[k]||k)+"'":Z="Parse error on line "+(W+1)+": Unexpected "+(k==re?"end of input":"'"+(this.terminals_[k]||k)+"'"),this.parseError(Z,{text:y.match,token:this.terminals_[k]||k,line:y.yylineno,loc:q,expected:X})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+k);switch(x[0]){case 1:r.push(k),h.push(y.yytext),t.push(y.yylloc),r.push(x[1]),k=null,se=y.yyleng,c=y.yytext,W=y.yylineno,q=y.yylloc;break;case 2:if(C=this.productions_[x[1]][1],F.$=h[h.length-C],F._$={first_line:t[t.length-(C||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(C||1)].first_column,last_column:t[t.length-1].last_column},de&&(F._$.range=[t[t.length-(C||1)].range[0],t[t.length-1].range[1]]),Q=this.performAction.apply(F,[c,se,W,R.yy,x[1],h,t].concat(ge)),typeof Q<"u")return Q;C&&(r=r.slice(0,-1*C*2),h=h.slice(0,-1*C),t=t.slice(0,-1*C)),r.push(this.productions_[x[1]][0]),h.push(F.$),t.push(F._$),oe=U[r[r.length-2]][r[r.length-1]],r.push(oe);break;case 3:return!0}}return!0},"parse")},Y=(function(){var O={EOF:1,parseError:o(function(n,r){if(this.yy.parser)this.yy.parser.parseError(n,r);else throw new Error(n)},"parseError"),setInput:o(function(i,n){return this.yy=n||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var n=i.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:o(function(i){var n=i.length,r=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var a=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var h=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===a.length?this.yylloc.first_column:0)+a[a.length-r.length].length-r[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[h[0],h[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(i){this.unput(this.match.slice(i))},"less"),pastInput:o(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var i=this.pastInput(),n=new Array(i.length+1).join("-");return i+this.upcomingInput()+` +`+n+"^"},"showPosition"),test_match:o(function(i,n){var r,a,h;if(this.options.backtrack_lexer&&(h={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(h.yylloc.range=this.yylloc.range.slice(0))),a=i[0].match(/(?:\r\n?|\n).*/g),a&&(this.yylineno+=a.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:a?a[a.length-1].length-a[a.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],r=this.performAction.call(this,this.yy,this,n,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var t in h)this[t]=h[t];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,n,r,a;this._more||(this.yytext="",this.match="");for(var h=this._currentRules(),t=0;tn[0].length)){if(n=r,a=t,this.options.backtrack_lexer){if(i=this.test_match(r,h[t]),i!==!1)return i;if(this._backtrack){n=!1;continue}else return!1}else if(!this.options.flex)break}return n?(i=this.test_match(n,h[a]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var n=this.next();return n||this.lex()},"lex"),begin:o(function(n){this.conditionStack.push(n)},"begin"),popState:o(function(){var n=this.conditionStack.length-1;return n>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(n){return n=this.conditionStack.length-1-Math.abs(n||0),n>=0?this.conditionStack[n]:"INITIAL"},"topState"),pushState:o(function(n){this.begin(n)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(n,r,a,h){switch(a){case 0:return this.pushState("shapeData"),r.yytext="",24;case 1:return this.pushState("shapeDataStr"),24;case 2:return this.popState(),24;case 3:const t=/\n\s*/g;return r.yytext=r.yytext.replace(t,"
          "),24;case 4:return 24;case 5:this.popState();break;case 6:return n.getLogger().trace("Found comment",r.yytext),6;case 7:return 8;case 8:this.begin("CLASS");break;case 9:return this.popState(),17;case 10:this.popState();break;case 11:n.getLogger().trace("Begin icon"),this.begin("ICON");break;case 12:return n.getLogger().trace("SPACELINE"),6;case 13:return 7;case 14:return 16;case 15:n.getLogger().trace("end icon"),this.popState();break;case 16:return n.getLogger().trace("Exploding node"),this.begin("NODE"),20;case 17:return n.getLogger().trace("Cloud"),this.begin("NODE"),20;case 18:return n.getLogger().trace("Explosion Bang"),this.begin("NODE"),20;case 19:return n.getLogger().trace("Cloud Bang"),this.begin("NODE"),20;case 20:return this.begin("NODE"),20;case 21:return this.begin("NODE"),20;case 22:return this.begin("NODE"),20;case 23:return this.begin("NODE"),20;case 24:return 13;case 25:return 23;case 26:return 11;case 27:this.begin("NSTR2");break;case 28:return"NODE_DESCR";case 29:this.popState();break;case 30:n.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 31:return n.getLogger().trace("description:",r.yytext),"NODE_DESCR";case 32:this.popState();break;case 33:return this.popState(),n.getLogger().trace("node end ))"),"NODE_DEND";case 34:return this.popState(),n.getLogger().trace("node end )"),"NODE_DEND";case 35:return this.popState(),n.getLogger().trace("node end ...",r.yytext),"NODE_DEND";case 36:return this.popState(),n.getLogger().trace("node end (("),"NODE_DEND";case 37:return this.popState(),n.getLogger().trace("node end (-"),"NODE_DEND";case 38:return this.popState(),n.getLogger().trace("node end (-"),"NODE_DEND";case 39:return this.popState(),n.getLogger().trace("node end (("),"NODE_DEND";case 40:return this.popState(),n.getLogger().trace("node end (("),"NODE_DEND";case 41:return n.getLogger().trace("Long description:",r.yytext),21;case 42:return n.getLogger().trace("Long description:",r.yytext),21}},"anonymous"),rules:[/^(?:@\{)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^\"]+)/i,/^(?:[^}^"]+)/i,/^(?:\})/i,/^(?:\s*%%.*)/i,/^(?:kanban\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}@]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{shapeDataEndBracket:{rules:[],inclusive:!1},shapeDataStr:{rules:[2,3],inclusive:!1},shapeData:{rules:[1,4,5],inclusive:!1},CLASS:{rules:[9,10],inclusive:!1},ICON:{rules:[14,15],inclusive:!1},NSTR2:{rules:[28,29],inclusive:!1},NSTR:{rules:[31,32],inclusive:!1},NODE:{rules:[27,30,33,34,35,36,37,38,39,40,41,42],inclusive:!1},INITIAL:{rules:[0,6,7,8,11,12,13,16,17,18,19,20,21,22,23,24,25,26],inclusive:!0}}};return O})();T.lexer=Y;function B(){this.yy={}}return o(B,"Parser"),B.prototype=T,T.Parser=B,new B})();$.parser=$;var xe=$,v=[],ne=[],ee=0,ie={},ve=o(()=>{v=[],ne=[],ee=0,ie={}},"clear"),De=o(e=>{if(v.length===0)return null;const u=v[0].level;let p=null;for(let s=v.length-1;s>=0;s--)if(v[s].level===u&&!p&&(p=v[s]),v[s].levell.parentId===d.id);for(const l of m){const D={id:l.id,parentId:d.id,label:j(l.label??"",s),isGroup:!1,ticket:l?.ticket,priority:l?.priority,assigned:l?.assigned,icon:l?.icon,shape:"kanbanItem",level:l.level,rx:5,ry:5,cssStyles:["text-align: left"]};u.push(D)}}return{nodes:u,edges:e,other:{},config:H()}},"getData"),Oe=o((e,u,p,s,d)=>{const E=H();let m=E.mindmap?.padding??K.mindmap.padding;switch(s){case f.ROUNDED_RECT:case f.RECT:case f.HEXAGON:m*=2}const l={id:j(u,E)||"kbn"+ee++,level:e,label:j(p,E),width:E.mindmap?.maxNodeWidth??K.mindmap.maxNodeWidth,padding:m,isGroup:!1};if(d!==void 0){let I;d.includes(` +`)?I=d+` +`:I=`{ +`+d+` +}`;const g=Ee(I,{schema:ke});if(g.shape&&(g.shape!==g.shape.toLowerCase()||g.shape.includes("_")))throw new Error(`No such shape: ${g.shape}. Shape names should be lowercase.`);g?.shape&&g.shape==="kanbanItem"&&(l.shape=g?.shape),g?.label&&(l.label=g?.label),g?.icon&&(l.icon=g?.icon.toString()),g?.assigned&&(l.assigned=g?.assigned.toString()),g?.ticket&&(l.ticket=g?.ticket.toString()),g?.priority&&(l.priority=g?.priority)}const D=De(e);D?l.parentId=D.id||"kbn"+ee++:ne.push(l),v.push(l)},"addNode"),f={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},Ie=o((e,u)=>{switch(te.debug("In get type",e,u),e){case"[":return f.RECT;case"(":return u===")"?f.ROUNDED_RECT:f.CLOUD;case"((":return f.CIRCLE;case")":return f.CLOUD;case"))":return f.BANG;case"{{":return f.HEXAGON;default:return f.DEFAULT}},"getType"),Ce=o((e,u)=>{ie[e]=u},"setElementForId"),we=o(e=>{if(!e)return;const u=H(),p=v[v.length-1];e.icon&&(p.icon=j(e.icon,u)),e.class&&(p.cssClasses=j(e.class,u))},"decorateNode"),Ae=o(e=>{switch(e){case f.DEFAULT:return"no-border";case f.RECT:return"rect";case f.ROUNDED_RECT:return"rounded-rect";case f.CIRCLE:return"circle";case f.CLOUD:return"cloud";case f.BANG:return"bang";case f.HEXAGON:return"hexgon";default:return"no-border"}},"type2Str"),Te=o(()=>te,"getLogger"),Re=o(e=>ie[e],"getElementById"),Pe={clear:ve,addNode:Oe,getSections:he,getData:Le,nodeType:f,getType:Ie,setElementForId:Ce,decorateNode:we,type2Str:Ae,getLogger:Te,getElementById:Re},Ve=Pe,Be=o(async(e,u,p,s)=>{te.debug(`Rendering kanban diagram +`+e);const E=s.db.getData(),m=H();m.htmlLabels=!1;const l=fe(u),D=l.append("g");D.attr("class","sections");const I=l.append("g");I.attr("class","items");const g=E.nodes.filter(b=>b.isGroup);let w=0;const _=10,G=[];let N=25;for(const b of g){const A=m?.kanban?.sectionWidth||200;w=w+1,b.x=A*w+(w-1)*_/2,b.width=A,b.y=0,b.height=A*3,b.rx=5,b.ry=5,b.cssClasses=b.cssClasses+" section-"+w;const L=await ye(D,b);N=Math.max(N,L?.labelBBox?.height),G.push(L)}let V=0;for(const b of g){const A=G[V];V=V+1;const L=m?.kanban?.sectionWidth||200,M=-L*3/2+N;let T=M;const Y=E.nodes.filter(i=>i.parentId===b.id);for(const i of Y){if(i.isGroup)throw new Error("Groups within groups are not allowed in Kanban diagrams");i.x=b.x,i.width=L-1.5*_;const r=(await me(I,i,{config:m})).node().getBBox();i.y=T+r.height/2,await be(i),T=i.y+r.height/2+_/2}const B=A.cluster.select("rect"),O=Math.max(T-M+3*_,50)+(N-25);B.attr("height",O)}_e(void 0,l,m.mindmap?.padding??K.kanban.padding,m.mindmap?.useMaxWidth??K.kanban.useMaxWidth)},"draw"),Fe={draw:Be},je=o(e=>{let u="";for(let s=0;se.darkMode?le(s,d):ce(s,d),"adjuster");for(let s=0;s` + .edge { + stroke-width: 3; + } + ${je(e)} + .section-root rect, .section-root path, .section-root circle, .section-root polygon { + fill: ${e.git0}; + } + .section-root text { + fill: ${e.gitBranchLabel0}; + } + .icon-container { + height:100%; + display: flex; + justify-content: center; + align-items: center; + } + .edge { + fill: none; + } + .cluster-label, .label { + color: ${e.textColor}; + fill: ${e.textColor}; + } + .kanban-label { + dy: 1em; + alignment-baseline: middle; + text-anchor: middle; + dominant-baseline: middle; + text-align: center; + } + ${Ne()} +`,"getStyles"),Me=Ge,Je={db:Ve,renderer:Fe,parser:xe,styles:Me};export{Je as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/katex-CS_DgrDy.css b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/katex-CS_DgrDy.css new file mode 100644 index 0000000000000000000000000000000000000000..971969c8145bb3c580981cba0aa45ecff9f0c5ed --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/katex-CS_DgrDy.css @@ -0,0 +1 @@ +@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(./KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(./KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(./KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(./KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(./KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(./KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(./KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(./KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(./KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(./KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(./KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(./KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(./KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(./KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(./KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(./KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(./KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(./KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(./KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(./KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(./KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(./KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(./KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(./KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(./KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(./KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(./KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(./KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(./KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(./KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(./KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(./KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(./KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(./KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(./KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(./KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(./KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(./KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(./KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(./KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(./KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(./KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(./KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(./KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(./KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(./KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(./KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(./KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(./KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(./KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(./KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(./KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(./KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(./KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(./KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(./KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(./KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(./KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(./KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.gradio-container-6-13-0 .katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.gradio-container-6-13-0 .katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.gradio-container-6-13-0 .katex .katex-version:after{content:"0.16.27"}.gradio-container-6-13-0 .katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.gradio-container-6-13-0 .katex .katex-html>.newline{display:block}.gradio-container-6-13-0 .katex .base{position:relative;white-space:nowrap;width:-webkit-min-content;width:-moz-min-content;width:min-content}.gradio-container-6-13-0 .katex .base,.gradio-container-6-13-0 .katex .strut{display:inline-block}.gradio-container-6-13-0 .katex .textbf{font-weight:700}.gradio-container-6-13-0 .katex .textit{font-style:italic}.gradio-container-6-13-0 .katex .textrm{font-family:KaTeX_Main}.gradio-container-6-13-0 .katex .textsf{font-family:KaTeX_SansSerif}.gradio-container-6-13-0 .katex .texttt{font-family:KaTeX_Typewriter}.gradio-container-6-13-0 .katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.gradio-container-6-13-0 .katex .mathit{font-family:KaTeX_Main;font-style:italic}.gradio-container-6-13-0 .katex .mathrm{font-style:normal}.gradio-container-6-13-0 .katex .mathbf{font-family:KaTeX_Main;font-weight:700}.gradio-container-6-13-0 .katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.gradio-container-6-13-0 .katex .amsrm,.gradio-container-6-13-0 .katex .mathbb,.gradio-container-6-13-0 .katex .textbb{font-family:KaTeX_AMS}.gradio-container-6-13-0 .katex .mathcal{font-family:KaTeX_Caligraphic}.gradio-container-6-13-0 .katex .mathfrak,.gradio-container-6-13-0 .katex .textfrak{font-family:KaTeX_Fraktur}.gradio-container-6-13-0 .katex .mathboldfrak,.gradio-container-6-13-0 .katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.gradio-container-6-13-0 .katex .mathtt{font-family:KaTeX_Typewriter}.gradio-container-6-13-0 .katex .mathscr,.gradio-container-6-13-0 .katex .textscr{font-family:KaTeX_Script}.gradio-container-6-13-0 .katex .mathsf,.gradio-container-6-13-0 .katex .textsf{font-family:KaTeX_SansSerif}.gradio-container-6-13-0 .katex .mathboldsf,.gradio-container-6-13-0 .katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.gradio-container-6-13-0 .katex .mathitsf,.gradio-container-6-13-0 .katex .mathsfit,.gradio-container-6-13-0 .katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.gradio-container-6-13-0 .katex .mainrm{font-family:KaTeX_Main;font-style:normal}.gradio-container-6-13-0 .katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.gradio-container-6-13-0 .katex .vlist-r{display:table-row}.gradio-container-6-13-0 .katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.gradio-container-6-13-0 .katex .vlist>span{display:block;height:0;position:relative}.gradio-container-6-13-0 .katex .vlist>span>span{display:inline-block}.gradio-container-6-13-0 .katex .vlist>span>.pstrut{overflow:hidden;width:0}.gradio-container-6-13-0 .katex .vlist-t2{margin-right:-2px}.gradio-container-6-13-0 .katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.gradio-container-6-13-0 .katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.gradio-container-6-13-0 .katex .hbox{width:100%}.gradio-container-6-13-0 .katex .hbox,.gradio-container-6-13-0 .katex .thinbox{display:inline-flex;flex-direction:row}.gradio-container-6-13-0 .katex .thinbox{max-width:0;width:0}.gradio-container-6-13-0 .katex .msupsub{text-align:left}.gradio-container-6-13-0 .katex .mfrac>span>span{text-align:center}.gradio-container-6-13-0 .katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.gradio-container-6-13-0 .katex .hdashline,.gradio-container-6-13-0 .katex .hline,.gradio-container-6-13-0 .katex .mfrac .frac-line,.gradio-container-6-13-0 .katex .overline .overline-line,.gradio-container-6-13-0 .katex .rule,.gradio-container-6-13-0 .katex .underline .underline-line{min-height:1px}.gradio-container-6-13-0 .katex .mspace{display:inline-block}.gradio-container-6-13-0 .katex .clap,.gradio-container-6-13-0 .katex .llap,.gradio-container-6-13-0 .katex .rlap{position:relative;width:0}.gradio-container-6-13-0 .katex .clap>.inner,.gradio-container-6-13-0 .katex .llap>.inner,.gradio-container-6-13-0 .katex .rlap>.inner{position:absolute}.gradio-container-6-13-0 .katex .clap>.fix,.gradio-container-6-13-0 .katex .llap>.fix,.gradio-container-6-13-0 .katex .rlap>.fix{display:inline-block}.gradio-container-6-13-0 .katex .llap>.inner{right:0}.gradio-container-6-13-0 .katex .clap>.inner,.gradio-container-6-13-0 .katex .rlap>.inner{left:0}.gradio-container-6-13-0 .katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.gradio-container-6-13-0 .katex .rule{border:0 solid;display:inline-block;position:relative}.gradio-container-6-13-0 .katex .hline,.gradio-container-6-13-0 .katex .overline .overline-line,.gradio-container-6-13-0 .katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.gradio-container-6-13-0 .katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.gradio-container-6-13-0 .katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size1.size1,.gradio-container-6-13-0 .katex .sizing.reset-size1.size1{font-size:1em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size1.size2,.gradio-container-6-13-0 .katex .sizing.reset-size1.size2{font-size:1.2em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size1.size3,.gradio-container-6-13-0 .katex .sizing.reset-size1.size3{font-size:1.4em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size1.size4,.gradio-container-6-13-0 .katex .sizing.reset-size1.size4{font-size:1.6em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size1.size5,.gradio-container-6-13-0 .katex .sizing.reset-size1.size5{font-size:1.8em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size1.size6,.gradio-container-6-13-0 .katex .sizing.reset-size1.size6{font-size:2em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size1.size7,.gradio-container-6-13-0 .katex .sizing.reset-size1.size7{font-size:2.4em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size1.size8,.gradio-container-6-13-0 .katex .sizing.reset-size1.size8{font-size:2.88em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size1.size9,.gradio-container-6-13-0 .katex .sizing.reset-size1.size9{font-size:3.456em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size1.size10,.gradio-container-6-13-0 .katex .sizing.reset-size1.size10{font-size:4.148em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size1.size11,.gradio-container-6-13-0 .katex .sizing.reset-size1.size11{font-size:4.976em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size2.size1,.gradio-container-6-13-0 .katex .sizing.reset-size2.size1{font-size:.8333333333em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size2.size2,.gradio-container-6-13-0 .katex .sizing.reset-size2.size2{font-size:1em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size2.size3,.gradio-container-6-13-0 .katex .sizing.reset-size2.size3{font-size:1.1666666667em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size2.size4,.gradio-container-6-13-0 .katex .sizing.reset-size2.size4{font-size:1.3333333333em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size2.size5,.gradio-container-6-13-0 .katex .sizing.reset-size2.size5{font-size:1.5em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size2.size6,.gradio-container-6-13-0 .katex .sizing.reset-size2.size6{font-size:1.6666666667em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size2.size7,.gradio-container-6-13-0 .katex .sizing.reset-size2.size7{font-size:2em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size2.size8,.gradio-container-6-13-0 .katex .sizing.reset-size2.size8{font-size:2.4em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size2.size9,.gradio-container-6-13-0 .katex .sizing.reset-size2.size9{font-size:2.88em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size2.size10,.gradio-container-6-13-0 .katex .sizing.reset-size2.size10{font-size:3.4566666667em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size2.size11,.gradio-container-6-13-0 .katex .sizing.reset-size2.size11{font-size:4.1466666667em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size3.size1,.gradio-container-6-13-0 .katex .sizing.reset-size3.size1{font-size:.7142857143em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size3.size2,.gradio-container-6-13-0 .katex .sizing.reset-size3.size2{font-size:.8571428571em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size3.size3,.gradio-container-6-13-0 .katex .sizing.reset-size3.size3{font-size:1em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size3.size4,.gradio-container-6-13-0 .katex .sizing.reset-size3.size4{font-size:1.1428571429em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size3.size5,.gradio-container-6-13-0 .katex .sizing.reset-size3.size5{font-size:1.2857142857em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size3.size6,.gradio-container-6-13-0 .katex .sizing.reset-size3.size6{font-size:1.4285714286em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size3.size7,.gradio-container-6-13-0 .katex .sizing.reset-size3.size7{font-size:1.7142857143em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size3.size8,.gradio-container-6-13-0 .katex .sizing.reset-size3.size8{font-size:2.0571428571em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size3.size9,.gradio-container-6-13-0 .katex .sizing.reset-size3.size9{font-size:2.4685714286em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size3.size10,.gradio-container-6-13-0 .katex .sizing.reset-size3.size10{font-size:2.9628571429em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size3.size11,.gradio-container-6-13-0 .katex .sizing.reset-size3.size11{font-size:3.5542857143em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size4.size1,.gradio-container-6-13-0 .katex .sizing.reset-size4.size1{font-size:.625em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size4.size2,.gradio-container-6-13-0 .katex .sizing.reset-size4.size2{font-size:.75em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size4.size3,.gradio-container-6-13-0 .katex .sizing.reset-size4.size3{font-size:.875em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size4.size4,.gradio-container-6-13-0 .katex .sizing.reset-size4.size4{font-size:1em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size4.size5,.gradio-container-6-13-0 .katex .sizing.reset-size4.size5{font-size:1.125em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size4.size6,.gradio-container-6-13-0 .katex .sizing.reset-size4.size6{font-size:1.25em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size4.size7,.gradio-container-6-13-0 .katex .sizing.reset-size4.size7{font-size:1.5em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size4.size8,.gradio-container-6-13-0 .katex .sizing.reset-size4.size8{font-size:1.8em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size4.size9,.gradio-container-6-13-0 .katex .sizing.reset-size4.size9{font-size:2.16em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size4.size10,.gradio-container-6-13-0 .katex .sizing.reset-size4.size10{font-size:2.5925em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size4.size11,.gradio-container-6-13-0 .katex .sizing.reset-size4.size11{font-size:3.11em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size5.size1,.gradio-container-6-13-0 .katex .sizing.reset-size5.size1{font-size:.5555555556em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size5.size2,.gradio-container-6-13-0 .katex .sizing.reset-size5.size2{font-size:.6666666667em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size5.size3,.gradio-container-6-13-0 .katex .sizing.reset-size5.size3{font-size:.7777777778em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size5.size4,.gradio-container-6-13-0 .katex .sizing.reset-size5.size4{font-size:.8888888889em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size5.size5,.gradio-container-6-13-0 .katex .sizing.reset-size5.size5{font-size:1em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size5.size6,.gradio-container-6-13-0 .katex .sizing.reset-size5.size6{font-size:1.1111111111em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size5.size7,.gradio-container-6-13-0 .katex .sizing.reset-size5.size7{font-size:1.3333333333em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size5.size8,.gradio-container-6-13-0 .katex .sizing.reset-size5.size8{font-size:1.6em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size5.size9,.gradio-container-6-13-0 .katex .sizing.reset-size5.size9{font-size:1.92em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size5.size10,.gradio-container-6-13-0 .katex .sizing.reset-size5.size10{font-size:2.3044444444em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size5.size11,.gradio-container-6-13-0 .katex .sizing.reset-size5.size11{font-size:2.7644444444em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size6.size1,.gradio-container-6-13-0 .katex .sizing.reset-size6.size1{font-size:.5em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size6.size2,.gradio-container-6-13-0 .katex .sizing.reset-size6.size2{font-size:.6em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size6.size3,.gradio-container-6-13-0 .katex .sizing.reset-size6.size3{font-size:.7em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size6.size4,.gradio-container-6-13-0 .katex .sizing.reset-size6.size4{font-size:.8em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size6.size5,.gradio-container-6-13-0 .katex .sizing.reset-size6.size5{font-size:.9em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size6.size6,.gradio-container-6-13-0 .katex .sizing.reset-size6.size6{font-size:1em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size6.size7,.gradio-container-6-13-0 .katex .sizing.reset-size6.size7{font-size:1.2em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size6.size8,.gradio-container-6-13-0 .katex .sizing.reset-size6.size8{font-size:1.44em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size6.size9,.gradio-container-6-13-0 .katex .sizing.reset-size6.size9{font-size:1.728em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size6.size10,.gradio-container-6-13-0 .katex .sizing.reset-size6.size10{font-size:2.074em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size6.size11,.gradio-container-6-13-0 .katex .sizing.reset-size6.size11{font-size:2.488em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size7.size1,.gradio-container-6-13-0 .katex .sizing.reset-size7.size1{font-size:.4166666667em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size7.size2,.gradio-container-6-13-0 .katex .sizing.reset-size7.size2{font-size:.5em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size7.size3,.gradio-container-6-13-0 .katex .sizing.reset-size7.size3{font-size:.5833333333em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size7.size4,.gradio-container-6-13-0 .katex .sizing.reset-size7.size4{font-size:.6666666667em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size7.size5,.gradio-container-6-13-0 .katex .sizing.reset-size7.size5{font-size:.75em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size7.size6,.gradio-container-6-13-0 .katex .sizing.reset-size7.size6{font-size:.8333333333em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size7.size7,.gradio-container-6-13-0 .katex .sizing.reset-size7.size7{font-size:1em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size7.size8,.gradio-container-6-13-0 .katex .sizing.reset-size7.size8{font-size:1.2em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size7.size9,.gradio-container-6-13-0 .katex .sizing.reset-size7.size9{font-size:1.44em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size7.size10,.gradio-container-6-13-0 .katex .sizing.reset-size7.size10{font-size:1.7283333333em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size7.size11,.gradio-container-6-13-0 .katex .sizing.reset-size7.size11{font-size:2.0733333333em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size8.size1,.gradio-container-6-13-0 .katex .sizing.reset-size8.size1{font-size:.3472222222em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size8.size2,.gradio-container-6-13-0 .katex .sizing.reset-size8.size2{font-size:.4166666667em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size8.size3,.gradio-container-6-13-0 .katex .sizing.reset-size8.size3{font-size:.4861111111em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size8.size4,.gradio-container-6-13-0 .katex .sizing.reset-size8.size4{font-size:.5555555556em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size8.size5,.gradio-container-6-13-0 .katex .sizing.reset-size8.size5{font-size:.625em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size8.size6,.gradio-container-6-13-0 .katex .sizing.reset-size8.size6{font-size:.6944444444em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size8.size7,.gradio-container-6-13-0 .katex .sizing.reset-size8.size7{font-size:.8333333333em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size8.size8,.gradio-container-6-13-0 .katex .sizing.reset-size8.size8{font-size:1em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size8.size9,.gradio-container-6-13-0 .katex .sizing.reset-size8.size9{font-size:1.2em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size8.size10,.gradio-container-6-13-0 .katex .sizing.reset-size8.size10{font-size:1.4402777778em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size8.size11,.gradio-container-6-13-0 .katex .sizing.reset-size8.size11{font-size:1.7277777778em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size9.size1,.gradio-container-6-13-0 .katex .sizing.reset-size9.size1{font-size:.2893518519em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size9.size2,.gradio-container-6-13-0 .katex .sizing.reset-size9.size2{font-size:.3472222222em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size9.size3,.gradio-container-6-13-0 .katex .sizing.reset-size9.size3{font-size:.4050925926em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size9.size4,.gradio-container-6-13-0 .katex .sizing.reset-size9.size4{font-size:.462962963em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size9.size5,.gradio-container-6-13-0 .katex .sizing.reset-size9.size5{font-size:.5208333333em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size9.size6,.gradio-container-6-13-0 .katex .sizing.reset-size9.size6{font-size:.5787037037em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size9.size7,.gradio-container-6-13-0 .katex .sizing.reset-size9.size7{font-size:.6944444444em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size9.size8,.gradio-container-6-13-0 .katex .sizing.reset-size9.size8{font-size:.8333333333em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size9.size9,.gradio-container-6-13-0 .katex .sizing.reset-size9.size9{font-size:1em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size9.size10,.gradio-container-6-13-0 .katex .sizing.reset-size9.size10{font-size:1.2002314815em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size9.size11,.gradio-container-6-13-0 .katex .sizing.reset-size9.size11{font-size:1.4398148148em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size10.size1,.gradio-container-6-13-0 .katex .sizing.reset-size10.size1{font-size:.2410800386em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size10.size2,.gradio-container-6-13-0 .katex .sizing.reset-size10.size2{font-size:.2892960463em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size10.size3,.gradio-container-6-13-0 .katex .sizing.reset-size10.size3{font-size:.337512054em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size10.size4,.gradio-container-6-13-0 .katex .sizing.reset-size10.size4{font-size:.3857280617em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size10.size5,.gradio-container-6-13-0 .katex .sizing.reset-size10.size5{font-size:.4339440694em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size10.size6,.gradio-container-6-13-0 .katex .sizing.reset-size10.size6{font-size:.4821600771em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size10.size7,.gradio-container-6-13-0 .katex .sizing.reset-size10.size7{font-size:.5785920926em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size10.size8,.gradio-container-6-13-0 .katex .sizing.reset-size10.size8{font-size:.6943105111em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size10.size9,.gradio-container-6-13-0 .katex .sizing.reset-size10.size9{font-size:.8331726133em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size10.size10,.gradio-container-6-13-0 .katex .sizing.reset-size10.size10{font-size:1em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size10.size11,.gradio-container-6-13-0 .katex .sizing.reset-size10.size11{font-size:1.1996142719em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size11.size1,.gradio-container-6-13-0 .katex .sizing.reset-size11.size1{font-size:.2009646302em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size11.size2,.gradio-container-6-13-0 .katex .sizing.reset-size11.size2{font-size:.2411575563em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size11.size3,.gradio-container-6-13-0 .katex .sizing.reset-size11.size3{font-size:.2813504823em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size11.size4,.gradio-container-6-13-0 .katex .sizing.reset-size11.size4{font-size:.3215434084em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size11.size5,.gradio-container-6-13-0 .katex .sizing.reset-size11.size5{font-size:.3617363344em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size11.size6,.gradio-container-6-13-0 .katex .sizing.reset-size11.size6{font-size:.4019292605em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size11.size7,.gradio-container-6-13-0 .katex .sizing.reset-size11.size7{font-size:.4823151125em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size11.size8,.gradio-container-6-13-0 .katex .sizing.reset-size11.size8{font-size:.578778135em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size11.size9,.gradio-container-6-13-0 .katex .sizing.reset-size11.size9{font-size:.6945337621em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size11.size10,.gradio-container-6-13-0 .katex .sizing.reset-size11.size10{font-size:.8336012862em}.gradio-container-6-13-0 .katex .fontsize-ensurer.reset-size11.size11,.gradio-container-6-13-0 .katex .sizing.reset-size11.size11{font-size:1em}.gradio-container-6-13-0 .katex .delimsizing.size1{font-family:KaTeX_Size1}.gradio-container-6-13-0 .katex .delimsizing.size2{font-family:KaTeX_Size2}.gradio-container-6-13-0 .katex .delimsizing.size3{font-family:KaTeX_Size3}.gradio-container-6-13-0 .katex .delimsizing.size4{font-family:KaTeX_Size4}.gradio-container-6-13-0 .katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.gradio-container-6-13-0 .katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.gradio-container-6-13-0 .katex .nulldelimiter{display:inline-block;width:.12em}.gradio-container-6-13-0 .katex .delimcenter,.gradio-container-6-13-0 .katex .op-symbol{position:relative}.gradio-container-6-13-0 .katex .op-symbol.small-op{font-family:KaTeX_Size1}.gradio-container-6-13-0 .katex .op-symbol.large-op{font-family:KaTeX_Size2}.gradio-container-6-13-0 .katex .accent>.vlist-t,.gradio-container-6-13-0 .katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.gradio-container-6-13-0 .katex .overlay{display:block}.gradio-container-6-13-0 .katex .mtable .vertical-separator{display:inline-block;min-width:1px}.gradio-container-6-13-0 .katex .mtable .arraycolsep{display:inline-block}.gradio-container-6-13-0 .katex .mtable .col-align-c>.vlist-t{text-align:center}.gradio-container-6-13-0 .katex .mtable .col-align-l>.vlist-t{text-align:left}.gradio-container-6-13-0 .katex .mtable .col-align-r>.vlist-t{text-align:right}.gradio-container-6-13-0 .katex .svg-align{text-align:left}.gradio-container-6-13-0 .katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.gradio-container-6-13-0 .katex svg path{stroke:none}.gradio-container-6-13-0 .katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.gradio-container-6-13-0 .katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.gradio-container-6-13-0 .katex .stretchy:after,.gradio-container-6-13-0 .katex .stretchy:before{content:""}.gradio-container-6-13-0 .katex .hide-tail{overflow:hidden;position:relative;width:100%}.gradio-container-6-13-0 .katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.gradio-container-6-13-0 .katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.gradio-container-6-13-0 .katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.gradio-container-6-13-0 .katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.gradio-container-6-13-0 .katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.gradio-container-6-13-0 .katex .x-arrow-pad{padding:0 .5em}.gradio-container-6-13-0 .katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.gradio-container-6-13-0 .katex .mover,.gradio-container-6-13-0 .katex .munder,.gradio-container-6-13-0 .katex .x-arrow{text-align:center}.gradio-container-6-13-0 .katex .boxpad{padding:0 .3em}.gradio-container-6-13-0 .katex .fbox,.gradio-container-6-13-0 .katex .fcolorbox{border:.04em solid;box-sizing:border-box}.gradio-container-6-13-0 .katex .cancel-pad{padding:0 .2em}.gradio-container-6-13-0 .katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.gradio-container-6-13-0 .katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.gradio-container-6-13-0 .katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.gradio-container-6-13-0 .katex .anglpad{padding:0 .03889em}.gradio-container-6-13-0 .katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.gradio-container-6-13-0 .katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.gradio-container-6-13-0 .katex .mtr-glue{width:50%}.gradio-container-6-13-0 .katex .cd-vert-arrow{display:inline-block;position:relative}.gradio-container-6-13-0 .katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.gradio-container-6-13-0 .katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.gradio-container-6-13-0 .katex-display{display:block;margin:1em 0;text-align:center}.gradio-container-6-13-0 .katex-display>.katex{display:block;text-align:center;white-space:nowrap}.gradio-container-6-13-0 .katex-display>.katex>.katex-html{display:block;position:relative}.gradio-container-6-13-0 .katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.gradio-container-6-13-0 .katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.gradio-container-6-13-0 .katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo} diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/katex-XbL3y5x-.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/katex-XbL3y5x-.js new file mode 100644 index 0000000000000000000000000000000000000000..d477fa514724cbbcd96e6afc780dd10ae99e23bf --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/katex-XbL3y5x-.js @@ -0,0 +1,261 @@ +class u0{constructor(e,t,a){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=a}static range(e,t){return t?!e||!e.loc||!t.loc||e.loc.lexer!==t.loc.lexer?null:new u0(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}}class m0{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new m0(t,u0.range(this,e))}}class M{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var a="KaTeX parse error: "+e,n,s,u=t&&t.loc;if(u&&u.start<=u.end){var h=u.lexer.input;n=u.start,s=u.end,n===h.length?a+=" at end of input: ":a+=" at position "+(n+1)+": ";var c=h.slice(n,s).replace(/[^]/g,"$&̲"),p;n>15?p="…"+h.slice(n-15,n):p=h.slice(0,n);var g;s+15":">","<":"<",'"':""","'":"'"},ba=/[&><"']/g;function ya(r){return String(r).replace(ba,e=>ga[e])}var vr=function r(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?r(e.body[0]):e:e.type==="font"?r(e.body):e},xa=function(e){var t=vr(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},wa=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},ka=function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},V={deflt:fa,escape:ya,hyphenate:va,getBaseElem:vr,isCharacterBox:xa,protocolFromUrl:ka},ze={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:r=>"#"+r},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:r=>Math.max(0,r),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:r=>Math.max(0,r),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:r=>Math.max(0,r),cli:"-e, --max-expand ",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};function Sa(r){if(r.default)return r.default;var e=r.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class dt{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var t in ze)if(ze.hasOwnProperty(t)){var a=ze[t];this[t]=e[t]!==void 0?a.processor?a.processor(e[t]):e[t]:Sa(a)}}reportNonstrict(e,t,a){var n=this.strict;if(typeof n=="function"&&(n=n(e,t,a)),!(!n||n==="ignore")){if(n===!0||n==="error")throw new M("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+e+"]"),a);n==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+n+"': "+t+" ["+e+"]"))}}useStrictBehavior(e,t,a){var n=this.strict;if(typeof n=="function")try{n=n(e,t,a)}catch{n="error"}return!n||n==="ignore"?!1:n===!0||n==="error"?!0:n==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+n+"': "+t+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var t=V.protocolFromUrl(e.url);if(t==null)return!1;e.protocol=t}var a=typeof this.trust=="function"?this.trust(e):this.trust;return!!a}}class O0{constructor(e,t,a){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=a}sup(){return y0[Ma[this.id]]}sub(){return y0[za[this.id]]}fracNum(){return y0[Aa[this.id]]}fracDen(){return y0[Ta[this.id]]}cramp(){return y0[Ba[this.id]]}text(){return y0[Da[this.id]]}isTight(){return this.size>=2}}var ft=0,Te=1,ee=2,B0=3,le=4,f0=5,te=6,n0=7,y0=[new O0(ft,0,!1),new O0(Te,0,!0),new O0(ee,1,!1),new O0(B0,1,!0),new O0(le,2,!1),new O0(f0,2,!0),new O0(te,3,!1),new O0(n0,3,!0)],Ma=[le,f0,le,f0,te,n0,te,n0],za=[f0,f0,f0,f0,n0,n0,n0,n0],Aa=[ee,B0,le,f0,te,n0,te,n0],Ta=[B0,B0,f0,f0,n0,n0,n0,n0],Ba=[Te,Te,B0,B0,f0,f0,n0,n0],Da=[ft,Te,ee,B0,ee,B0,ee,B0],R={DISPLAY:y0[ft],TEXT:y0[ee],SCRIPT:y0[le],SCRIPTSCRIPT:y0[te]},nt=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function Ca(r){for(var e=0;e=n[0]&&r<=n[1])return t.name}return null}var Ae=[];nt.forEach(r=>r.blocks.forEach(e=>Ae.push(...e)));function gr(r){for(var e=0;e=Ae[e]&&r<=Ae[e+1])return!0;return!1}var _0=80,Na=function(e,t){return"M95,"+(622+e+t)+` +c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 +c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 +c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 +s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 +c69,-144,104.5,-217.7,106.5,-221 +l`+e/2.075+" -"+e+` +c5.3,-9.3,12,-14,20,-14 +H400000v`+(40+e)+`H845.2724 +s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 +c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z +M`+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},qa=function(e,t){return"M263,"+(601+e+t)+`c0.7,0,18,39.7,52,119 +c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 +c340,-704.7,510.7,-1060.3,512,-1067 +l`+e/2.084+" -"+e+` +c4.7,-7.3,11,-11,19,-11 +H40000v`+(40+e)+`H1012.3 +s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 +c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 +s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 +c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z +M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},Ra=function(e,t){return"M983 "+(10+e+t)+` +l`+e/3.13+" -"+e+` +c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+` +H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 +s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 +c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 +c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 +c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 +c53.7,-170.3,84.5,-266.8,92.5,-289.5z +M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},Ea=function(e,t){return"M424,"+(2398+e+t)+` +c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 +c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 +s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 +s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 +l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000 +v`+(40+e)+`H1014.6 +s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 +c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+t+` +h400000v`+(40+e)+"h-400000z"},Ia=function(e,t){return"M473,"+(2713+e+t)+` +c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+` +c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7 +s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 +c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 +s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, +606zM`+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"},Fa=function(e){var t=e/2;return"M400000 "+e+" H0 L"+t+" 0 l65 45 L145 "+(e-80)+" H400000z"},Oa=function(e,t,a){var n=a-54-t-e;return"M702 "+(e+t)+"H400000"+(40+e)+` +H742v`+n+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 +h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 +c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 +219 661 l218 661zM702 `+t+"H400000v"+(40+e)+"H742z"},Ha=function(e,t,a){t=1e3*t;var n="";switch(e){case"sqrtMain":n=Na(t,_0);break;case"sqrtSize1":n=qa(t,_0);break;case"sqrtSize2":n=Ra(t,_0);break;case"sqrtSize3":n=Ea(t,_0);break;case"sqrtSize4":n=Ia(t,_0);break;case"sqrtTall":n=Oa(t,_0,a)}return n},La=function(e,t){switch(e){case"⎜":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"∣":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"∥":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z"+("M367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z");case"⎟":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"⎢":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"⎥":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"⎪":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"⏐":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"‖":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257z"+("M478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z");default:return""}},Ft={doubleleftarrow:`M262 157 +l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 + 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 + 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 +c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 + 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 +-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 +-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z +m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l +-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 + 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 +-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 +-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 +-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 +c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 +-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120 + 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 +-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 +c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 + 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 + 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 + l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 +-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 + 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 + 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 + 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 +-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80 +H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 + 435 0h399565z`,leftgroupunder:`M400000 262 +H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 + 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 +-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 +-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 +-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 + 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 +-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 +-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z +m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 + 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 + 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 +-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 + 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 +-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 +v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 +-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 +-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 + 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z +M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z +M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 +-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 +c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 + 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z +M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334 +c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 +-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 + 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 + 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214 +c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 + 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 + 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 +-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 +-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z +m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 +60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 +-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z +m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 +c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 +-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z +m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 +85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 +-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z +m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 +c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128 +-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 + 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 + 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 +-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 + 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l +-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 +s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 +c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 + 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 +-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 + 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 + 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 +-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 +-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 + 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 +-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 + 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z +m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 + 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 +-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 +-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 + 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 + 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 +-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z +m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 + 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 +-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 + 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z +M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 + 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 +-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 +-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40 + 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 +-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 +-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 +-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 + 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167 +c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 + 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 + 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 +-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 + 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 +-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 + 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 + 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 +-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418 +-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 + 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 +c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 + 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 +-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 + 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 + 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 + -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 +-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 + 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 + 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 + -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 +3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 +10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 +-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 +-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 +H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 +c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 +c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, +-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 +c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 +c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 +s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 +121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 +s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 +c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z +M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 +-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 +13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 +-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 +-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 +151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 +c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 +c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 +c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z +M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, +1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, +-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z +M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},Pa=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+` v1759 h347 v-84 +H403z M403 1759 V0 H319 V1759 v`+t+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+` v1759 H0 v84 H347z +M347 1759 V0 H263 V1759 v`+t+" v1759 h84z";case"vert":return"M145 15 v585 v"+t+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+" v585 h43z";case"doublevert":return"M145 15 v585 v"+t+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+` v585 h43z +M367 15 v585 v`+t+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+t+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+t+` v1715 h263 v84 H319z +MM319 602 V0 H403 V602 v`+t+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+t+` v1799 H0 v-84 H319z +MM319 602 V0 H403 V602 v`+t+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+` v602 h84z +M403 1759 V0 H319 V1759 v`+t+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+` v602 h84z +M347 1759 V0 h-84 V1759 v`+t+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 +c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, +-36,557 l0,`+(t+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, +949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 +c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, +-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 +l0,-`+(t+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, +-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, +63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 +c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(t+9)+` +c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 +c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 +c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 +c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 +l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class oe{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;tt.toText();return this.children.map(e).join("")}}var x0={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},ve={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},Ot={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function Va(r,e){x0[r]=e}function pt(r,e,t){if(!x0[e])throw new Error("Font metrics not found for font: "+e+".");var a=r.charCodeAt(0),n=x0[e][a];if(!n&&r[0]in Ot&&(a=Ot[r[0]].charCodeAt(0),n=x0[e][a]),!n&&t==="text"&&gr(a)&&(n=x0[e][77]),n)return{depth:n[0],height:n[1],italic:n[2],skew:n[3],width:n[4]}}var Ue={};function Ga(r){var e;if(r>=5?e=0:r>=3?e=1:e=2,!Ue[e]){var t=Ue[e]={cssEmPerMu:ve.quad[e]/18};for(var a in ve)ve.hasOwnProperty(a)&&(t[a]=ve[a][e])}return Ue[e]}var Ua=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Ht=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Lt=function(e,t){return t.size<2?e:Ua[e-1][t.size-1]};class T0{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||T0.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=Ht[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var a in e)e.hasOwnProperty(a)&&(t[a]=e[a]);return new T0(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:Lt(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:Ht[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=Lt(T0.BASESIZE,e);return this.size===t&&this.textSize===T0.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==T0.BASESIZE?["sizing","reset-size"+this.size,"size"+T0.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Ga(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}T0.BASESIZE=6;var it={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Ya={ex:!0,em:!0,mu:!0},br=function(e){return typeof e!="string"&&(e=e.unit),e in it||e in Ya||e==="ex"},K=function(e,t){var a;if(e.unit in it)a=it[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit==="mu")a=t.fontMetrics().cssEmPerMu;else{var n;if(t.style.isTight()?n=t.havingStyle(t.style.text()):n=t,e.unit==="ex")a=n.fontMetrics().xHeight;else if(e.unit==="em")a=n.fontMetrics().quad;else throw new M("Invalid unit: '"+e.unit+"'");n!==t&&(a*=n.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*a,t.maxSize)},A=function(e){return+e.toFixed(4)+"em"},P0=function(e){return e.filter(t=>t).join(" ")},yr=function(e,t,a){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=a||{},t){t.style.isTight()&&this.classes.push("mtight");var n=t.getColor();n&&(this.style.color=n)}},xr=function(e){var t=document.createElement(e);t.className=P0(this.classes);for(var a in this.style)this.style.hasOwnProperty(a)&&(t.style[a]=this.style[a]);for(var n in this.attributes)this.attributes.hasOwnProperty(n)&&t.setAttribute(n,this.attributes[n]);for(var s=0;s/=\x00-\x1f]/,wr=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+V.escape(P0(this.classes))+'"');var a="";for(var n in this.style)this.style.hasOwnProperty(n)&&(a+=V.hyphenate(n)+":"+this.style[n]+";");a&&(t+=' style="'+V.escape(a)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(Xa.test(s))throw new M("Invalid attribute name '"+s+"'");t+=" "+s+'="'+V.escape(this.attributes[s])+'"'}t+=">";for(var u=0;u",t};class he{constructor(e,t,a,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,yr.call(this,e,a,n),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return xr.call(this,"span")}toMarkup(){return wr.call(this,"span")}}class vt{constructor(e,t,a,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,yr.call(this,t,n),this.children=a||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return xr.call(this,"a")}toMarkup(){return wr.call(this,"a")}}class $a{constructor(e,t,a){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=a}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var t in this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e}toMarkup(){var e=''+V.escape(this.alt)+'0&&(t=document.createElement("span"),t.style.marginRight=A(this.italic)),this.classes.length>0&&(t=t||document.createElement("span"),t.className=P0(this.classes));for(var a in this.style)this.style.hasOwnProperty(a)&&(t=t||document.createElement("span"),t.style[a]=this.style[a]);return t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="0&&(a+="margin-right:"+this.italic+"em;");for(var n in this.style)this.style.hasOwnProperty(n)&&(a+=V.hyphenate(n)+":"+this.style[n]+";");a&&(e=!0,t+=' style="'+V.escape(a)+'"');var s=V.escape(this.text);return e?(t+=">",t+=s,t+="",t):s}}class C0{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");for(var a in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,a)&&t.setAttribute(a,this.attributes[a]);for(var n=0;n':''}}class st{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"line");for(var a in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,a)&&t.setAttribute(a,this.attributes[a]);return t}toMarkup(){var e=" but got "+String(r)+".")}var Za={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Ka={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},$={math:{},text:{}};function i(r,e,t,a,n,s){$[r][n]={font:e,group:t,replace:a},s&&a&&($[r][a]=$[r][n])}var l="math",k="text",o="main",d="ams",W="accent-token",D="bin",i0="close",re="inner",q="mathord",_="op-token",c0="open",qe="punct",f="rel",R0="spacing",v="textord";i(l,o,f,"≡","\\equiv",!0);i(l,o,f,"≺","\\prec",!0);i(l,o,f,"≻","\\succ",!0);i(l,o,f,"∼","\\sim",!0);i(l,o,f,"⊥","\\perp");i(l,o,f,"⪯","\\preceq",!0);i(l,o,f,"⪰","\\succeq",!0);i(l,o,f,"≃","\\simeq",!0);i(l,o,f,"∣","\\mid",!0);i(l,o,f,"≪","\\ll",!0);i(l,o,f,"≫","\\gg",!0);i(l,o,f,"≍","\\asymp",!0);i(l,o,f,"∥","\\parallel");i(l,o,f,"⋈","\\bowtie",!0);i(l,o,f,"⌣","\\smile",!0);i(l,o,f,"⊑","\\sqsubseteq",!0);i(l,o,f,"⊒","\\sqsupseteq",!0);i(l,o,f,"≐","\\doteq",!0);i(l,o,f,"⌢","\\frown",!0);i(l,o,f,"∋","\\ni",!0);i(l,o,f,"∝","\\propto",!0);i(l,o,f,"⊢","\\vdash",!0);i(l,o,f,"⊣","\\dashv",!0);i(l,o,f,"∋","\\owns");i(l,o,qe,".","\\ldotp");i(l,o,qe,"⋅","\\cdotp");i(l,o,v,"#","\\#");i(k,o,v,"#","\\#");i(l,o,v,"&","\\&");i(k,o,v,"&","\\&");i(l,o,v,"ℵ","\\aleph",!0);i(l,o,v,"∀","\\forall",!0);i(l,o,v,"ℏ","\\hbar",!0);i(l,o,v,"∃","\\exists",!0);i(l,o,v,"∇","\\nabla",!0);i(l,o,v,"♭","\\flat",!0);i(l,o,v,"ℓ","\\ell",!0);i(l,o,v,"♮","\\natural",!0);i(l,o,v,"♣","\\clubsuit",!0);i(l,o,v,"℘","\\wp",!0);i(l,o,v,"♯","\\sharp",!0);i(l,o,v,"♢","\\diamondsuit",!0);i(l,o,v,"ℜ","\\Re",!0);i(l,o,v,"♡","\\heartsuit",!0);i(l,o,v,"ℑ","\\Im",!0);i(l,o,v,"♠","\\spadesuit",!0);i(l,o,v,"§","\\S",!0);i(k,o,v,"§","\\S");i(l,o,v,"¶","\\P",!0);i(k,o,v,"¶","\\P");i(l,o,v,"†","\\dag");i(k,o,v,"†","\\dag");i(k,o,v,"†","\\textdagger");i(l,o,v,"‡","\\ddag");i(k,o,v,"‡","\\ddag");i(k,o,v,"‡","\\textdaggerdbl");i(l,o,i0,"⎱","\\rmoustache",!0);i(l,o,c0,"⎰","\\lmoustache",!0);i(l,o,i0,"⟯","\\rgroup",!0);i(l,o,c0,"⟮","\\lgroup",!0);i(l,o,D,"∓","\\mp",!0);i(l,o,D,"⊖","\\ominus",!0);i(l,o,D,"⊎","\\uplus",!0);i(l,o,D,"⊓","\\sqcap",!0);i(l,o,D,"∗","\\ast");i(l,o,D,"⊔","\\sqcup",!0);i(l,o,D,"◯","\\bigcirc",!0);i(l,o,D,"∙","\\bullet",!0);i(l,o,D,"‡","\\ddagger");i(l,o,D,"≀","\\wr",!0);i(l,o,D,"⨿","\\amalg");i(l,o,D,"&","\\And");i(l,o,f,"⟵","\\longleftarrow",!0);i(l,o,f,"⇐","\\Leftarrow",!0);i(l,o,f,"⟸","\\Longleftarrow",!0);i(l,o,f,"⟶","\\longrightarrow",!0);i(l,o,f,"⇒","\\Rightarrow",!0);i(l,o,f,"⟹","\\Longrightarrow",!0);i(l,o,f,"↔","\\leftrightarrow",!0);i(l,o,f,"⟷","\\longleftrightarrow",!0);i(l,o,f,"⇔","\\Leftrightarrow",!0);i(l,o,f,"⟺","\\Longleftrightarrow",!0);i(l,o,f,"↦","\\mapsto",!0);i(l,o,f,"⟼","\\longmapsto",!0);i(l,o,f,"↗","\\nearrow",!0);i(l,o,f,"↩","\\hookleftarrow",!0);i(l,o,f,"↪","\\hookrightarrow",!0);i(l,o,f,"↘","\\searrow",!0);i(l,o,f,"↼","\\leftharpoonup",!0);i(l,o,f,"⇀","\\rightharpoonup",!0);i(l,o,f,"↙","\\swarrow",!0);i(l,o,f,"↽","\\leftharpoondown",!0);i(l,o,f,"⇁","\\rightharpoondown",!0);i(l,o,f,"↖","\\nwarrow",!0);i(l,o,f,"⇌","\\rightleftharpoons",!0);i(l,d,f,"≮","\\nless",!0);i(l,d,f,"","\\@nleqslant");i(l,d,f,"","\\@nleqq");i(l,d,f,"⪇","\\lneq",!0);i(l,d,f,"≨","\\lneqq",!0);i(l,d,f,"","\\@lvertneqq");i(l,d,f,"⋦","\\lnsim",!0);i(l,d,f,"⪉","\\lnapprox",!0);i(l,d,f,"⊀","\\nprec",!0);i(l,d,f,"⋠","\\npreceq",!0);i(l,d,f,"⋨","\\precnsim",!0);i(l,d,f,"⪹","\\precnapprox",!0);i(l,d,f,"≁","\\nsim",!0);i(l,d,f,"","\\@nshortmid");i(l,d,f,"∤","\\nmid",!0);i(l,d,f,"⊬","\\nvdash",!0);i(l,d,f,"⊭","\\nvDash",!0);i(l,d,f,"⋪","\\ntriangleleft");i(l,d,f,"⋬","\\ntrianglelefteq",!0);i(l,d,f,"⊊","\\subsetneq",!0);i(l,d,f,"","\\@varsubsetneq");i(l,d,f,"⫋","\\subsetneqq",!0);i(l,d,f,"","\\@varsubsetneqq");i(l,d,f,"≯","\\ngtr",!0);i(l,d,f,"","\\@ngeqslant");i(l,d,f,"","\\@ngeqq");i(l,d,f,"⪈","\\gneq",!0);i(l,d,f,"≩","\\gneqq",!0);i(l,d,f,"","\\@gvertneqq");i(l,d,f,"⋧","\\gnsim",!0);i(l,d,f,"⪊","\\gnapprox",!0);i(l,d,f,"⊁","\\nsucc",!0);i(l,d,f,"⋡","\\nsucceq",!0);i(l,d,f,"⋩","\\succnsim",!0);i(l,d,f,"⪺","\\succnapprox",!0);i(l,d,f,"≆","\\ncong",!0);i(l,d,f,"","\\@nshortparallel");i(l,d,f,"∦","\\nparallel",!0);i(l,d,f,"⊯","\\nVDash",!0);i(l,d,f,"⋫","\\ntriangleright");i(l,d,f,"⋭","\\ntrianglerighteq",!0);i(l,d,f,"","\\@nsupseteqq");i(l,d,f,"⊋","\\supsetneq",!0);i(l,d,f,"","\\@varsupsetneq");i(l,d,f,"⫌","\\supsetneqq",!0);i(l,d,f,"","\\@varsupsetneqq");i(l,d,f,"⊮","\\nVdash",!0);i(l,d,f,"⪵","\\precneqq",!0);i(l,d,f,"⪶","\\succneqq",!0);i(l,d,f,"","\\@nsubseteqq");i(l,d,D,"⊴","\\unlhd");i(l,d,D,"⊵","\\unrhd");i(l,d,f,"↚","\\nleftarrow",!0);i(l,d,f,"↛","\\nrightarrow",!0);i(l,d,f,"⇍","\\nLeftarrow",!0);i(l,d,f,"⇏","\\nRightarrow",!0);i(l,d,f,"↮","\\nleftrightarrow",!0);i(l,d,f,"⇎","\\nLeftrightarrow",!0);i(l,d,f,"△","\\vartriangle");i(l,d,v,"ℏ","\\hslash");i(l,d,v,"▽","\\triangledown");i(l,d,v,"◊","\\lozenge");i(l,d,v,"Ⓢ","\\circledS");i(l,d,v,"®","\\circledR");i(k,d,v,"®","\\circledR");i(l,d,v,"∡","\\measuredangle",!0);i(l,d,v,"∄","\\nexists");i(l,d,v,"℧","\\mho");i(l,d,v,"Ⅎ","\\Finv",!0);i(l,d,v,"⅁","\\Game",!0);i(l,d,v,"‵","\\backprime");i(l,d,v,"▲","\\blacktriangle");i(l,d,v,"▼","\\blacktriangledown");i(l,d,v,"■","\\blacksquare");i(l,d,v,"⧫","\\blacklozenge");i(l,d,v,"★","\\bigstar");i(l,d,v,"∢","\\sphericalangle",!0);i(l,d,v,"∁","\\complement",!0);i(l,d,v,"ð","\\eth",!0);i(k,o,v,"ð","ð");i(l,d,v,"╱","\\diagup");i(l,d,v,"╲","\\diagdown");i(l,d,v,"□","\\square");i(l,d,v,"□","\\Box");i(l,d,v,"◊","\\Diamond");i(l,d,v,"¥","\\yen",!0);i(k,d,v,"¥","\\yen",!0);i(l,d,v,"✓","\\checkmark",!0);i(k,d,v,"✓","\\checkmark");i(l,d,v,"ℶ","\\beth",!0);i(l,d,v,"ℸ","\\daleth",!0);i(l,d,v,"ℷ","\\gimel",!0);i(l,d,v,"ϝ","\\digamma",!0);i(l,d,v,"ϰ","\\varkappa");i(l,d,c0,"┌","\\@ulcorner",!0);i(l,d,i0,"┐","\\@urcorner",!0);i(l,d,c0,"└","\\@llcorner",!0);i(l,d,i0,"┘","\\@lrcorner",!0);i(l,d,f,"≦","\\leqq",!0);i(l,d,f,"⩽","\\leqslant",!0);i(l,d,f,"⪕","\\eqslantless",!0);i(l,d,f,"≲","\\lesssim",!0);i(l,d,f,"⪅","\\lessapprox",!0);i(l,d,f,"≊","\\approxeq",!0);i(l,d,D,"⋖","\\lessdot");i(l,d,f,"⋘","\\lll",!0);i(l,d,f,"≶","\\lessgtr",!0);i(l,d,f,"⋚","\\lesseqgtr",!0);i(l,d,f,"⪋","\\lesseqqgtr",!0);i(l,d,f,"≑","\\doteqdot");i(l,d,f,"≓","\\risingdotseq",!0);i(l,d,f,"≒","\\fallingdotseq",!0);i(l,d,f,"∽","\\backsim",!0);i(l,d,f,"⋍","\\backsimeq",!0);i(l,d,f,"⫅","\\subseteqq",!0);i(l,d,f,"⋐","\\Subset",!0);i(l,d,f,"⊏","\\sqsubset",!0);i(l,d,f,"≼","\\preccurlyeq",!0);i(l,d,f,"⋞","\\curlyeqprec",!0);i(l,d,f,"≾","\\precsim",!0);i(l,d,f,"⪷","\\precapprox",!0);i(l,d,f,"⊲","\\vartriangleleft");i(l,d,f,"⊴","\\trianglelefteq");i(l,d,f,"⊨","\\vDash",!0);i(l,d,f,"⊪","\\Vvdash",!0);i(l,d,f,"⌣","\\smallsmile");i(l,d,f,"⌢","\\smallfrown");i(l,d,f,"≏","\\bumpeq",!0);i(l,d,f,"≎","\\Bumpeq",!0);i(l,d,f,"≧","\\geqq",!0);i(l,d,f,"⩾","\\geqslant",!0);i(l,d,f,"⪖","\\eqslantgtr",!0);i(l,d,f,"≳","\\gtrsim",!0);i(l,d,f,"⪆","\\gtrapprox",!0);i(l,d,D,"⋗","\\gtrdot");i(l,d,f,"⋙","\\ggg",!0);i(l,d,f,"≷","\\gtrless",!0);i(l,d,f,"⋛","\\gtreqless",!0);i(l,d,f,"⪌","\\gtreqqless",!0);i(l,d,f,"≖","\\eqcirc",!0);i(l,d,f,"≗","\\circeq",!0);i(l,d,f,"≜","\\triangleq",!0);i(l,d,f,"∼","\\thicksim");i(l,d,f,"≈","\\thickapprox");i(l,d,f,"⫆","\\supseteqq",!0);i(l,d,f,"⋑","\\Supset",!0);i(l,d,f,"⊐","\\sqsupset",!0);i(l,d,f,"≽","\\succcurlyeq",!0);i(l,d,f,"⋟","\\curlyeqsucc",!0);i(l,d,f,"≿","\\succsim",!0);i(l,d,f,"⪸","\\succapprox",!0);i(l,d,f,"⊳","\\vartriangleright");i(l,d,f,"⊵","\\trianglerighteq");i(l,d,f,"⊩","\\Vdash",!0);i(l,d,f,"∣","\\shortmid");i(l,d,f,"∥","\\shortparallel");i(l,d,f,"≬","\\between",!0);i(l,d,f,"⋔","\\pitchfork",!0);i(l,d,f,"∝","\\varpropto");i(l,d,f,"◀","\\blacktriangleleft");i(l,d,f,"∴","\\therefore",!0);i(l,d,f,"∍","\\backepsilon");i(l,d,f,"▶","\\blacktriangleright");i(l,d,f,"∵","\\because",!0);i(l,d,f,"⋘","\\llless");i(l,d,f,"⋙","\\gggtr");i(l,d,D,"⊲","\\lhd");i(l,d,D,"⊳","\\rhd");i(l,d,f,"≂","\\eqsim",!0);i(l,o,f,"⋈","\\Join");i(l,d,f,"≑","\\Doteq",!0);i(l,d,D,"∔","\\dotplus",!0);i(l,d,D,"∖","\\smallsetminus");i(l,d,D,"⋒","\\Cap",!0);i(l,d,D,"⋓","\\Cup",!0);i(l,d,D,"⩞","\\doublebarwedge",!0);i(l,d,D,"⊟","\\boxminus",!0);i(l,d,D,"⊞","\\boxplus",!0);i(l,d,D,"⋇","\\divideontimes",!0);i(l,d,D,"⋉","\\ltimes",!0);i(l,d,D,"⋊","\\rtimes",!0);i(l,d,D,"⋋","\\leftthreetimes",!0);i(l,d,D,"⋌","\\rightthreetimes",!0);i(l,d,D,"⋏","\\curlywedge",!0);i(l,d,D,"⋎","\\curlyvee",!0);i(l,d,D,"⊝","\\circleddash",!0);i(l,d,D,"⊛","\\circledast",!0);i(l,d,D,"⋅","\\centerdot");i(l,d,D,"⊺","\\intercal",!0);i(l,d,D,"⋒","\\doublecap");i(l,d,D,"⋓","\\doublecup");i(l,d,D,"⊠","\\boxtimes",!0);i(l,d,f,"⇢","\\dashrightarrow",!0);i(l,d,f,"⇠","\\dashleftarrow",!0);i(l,d,f,"⇇","\\leftleftarrows",!0);i(l,d,f,"⇆","\\leftrightarrows",!0);i(l,d,f,"⇚","\\Lleftarrow",!0);i(l,d,f,"↞","\\twoheadleftarrow",!0);i(l,d,f,"↢","\\leftarrowtail",!0);i(l,d,f,"↫","\\looparrowleft",!0);i(l,d,f,"⇋","\\leftrightharpoons",!0);i(l,d,f,"↶","\\curvearrowleft",!0);i(l,d,f,"↺","\\circlearrowleft",!0);i(l,d,f,"↰","\\Lsh",!0);i(l,d,f,"⇈","\\upuparrows",!0);i(l,d,f,"↿","\\upharpoonleft",!0);i(l,d,f,"⇃","\\downharpoonleft",!0);i(l,o,f,"⊶","\\origof",!0);i(l,o,f,"⊷","\\imageof",!0);i(l,d,f,"⊸","\\multimap",!0);i(l,d,f,"↭","\\leftrightsquigarrow",!0);i(l,d,f,"⇉","\\rightrightarrows",!0);i(l,d,f,"⇄","\\rightleftarrows",!0);i(l,d,f,"↠","\\twoheadrightarrow",!0);i(l,d,f,"↣","\\rightarrowtail",!0);i(l,d,f,"↬","\\looparrowright",!0);i(l,d,f,"↷","\\curvearrowright",!0);i(l,d,f,"↻","\\circlearrowright",!0);i(l,d,f,"↱","\\Rsh",!0);i(l,d,f,"⇊","\\downdownarrows",!0);i(l,d,f,"↾","\\upharpoonright",!0);i(l,d,f,"⇂","\\downharpoonright",!0);i(l,d,f,"⇝","\\rightsquigarrow",!0);i(l,d,f,"⇝","\\leadsto");i(l,d,f,"⇛","\\Rrightarrow",!0);i(l,d,f,"↾","\\restriction");i(l,o,v,"‘","`");i(l,o,v,"$","\\$");i(k,o,v,"$","\\$");i(k,o,v,"$","\\textdollar");i(l,o,v,"%","\\%");i(k,o,v,"%","\\%");i(l,o,v,"_","\\_");i(k,o,v,"_","\\_");i(k,o,v,"_","\\textunderscore");i(l,o,v,"∠","\\angle",!0);i(l,o,v,"∞","\\infty",!0);i(l,o,v,"′","\\prime");i(l,o,v,"△","\\triangle");i(l,o,v,"Γ","\\Gamma",!0);i(l,o,v,"Δ","\\Delta",!0);i(l,o,v,"Θ","\\Theta",!0);i(l,o,v,"Λ","\\Lambda",!0);i(l,o,v,"Ξ","\\Xi",!0);i(l,o,v,"Π","\\Pi",!0);i(l,o,v,"Σ","\\Sigma",!0);i(l,o,v,"Υ","\\Upsilon",!0);i(l,o,v,"Φ","\\Phi",!0);i(l,o,v,"Ψ","\\Psi",!0);i(l,o,v,"Ω","\\Omega",!0);i(l,o,v,"A","Α");i(l,o,v,"B","Β");i(l,o,v,"E","Ε");i(l,o,v,"Z","Ζ");i(l,o,v,"H","Η");i(l,o,v,"I","Ι");i(l,o,v,"K","Κ");i(l,o,v,"M","Μ");i(l,o,v,"N","Ν");i(l,o,v,"O","Ο");i(l,o,v,"P","Ρ");i(l,o,v,"T","Τ");i(l,o,v,"X","Χ");i(l,o,v,"¬","\\neg",!0);i(l,o,v,"¬","\\lnot");i(l,o,v,"⊤","\\top");i(l,o,v,"⊥","\\bot");i(l,o,v,"∅","\\emptyset");i(l,d,v,"∅","\\varnothing");i(l,o,q,"α","\\alpha",!0);i(l,o,q,"β","\\beta",!0);i(l,o,q,"γ","\\gamma",!0);i(l,o,q,"δ","\\delta",!0);i(l,o,q,"ϵ","\\epsilon",!0);i(l,o,q,"ζ","\\zeta",!0);i(l,o,q,"η","\\eta",!0);i(l,o,q,"θ","\\theta",!0);i(l,o,q,"ι","\\iota",!0);i(l,o,q,"κ","\\kappa",!0);i(l,o,q,"λ","\\lambda",!0);i(l,o,q,"μ","\\mu",!0);i(l,o,q,"ν","\\nu",!0);i(l,o,q,"ξ","\\xi",!0);i(l,o,q,"ο","\\omicron",!0);i(l,o,q,"π","\\pi",!0);i(l,o,q,"ρ","\\rho",!0);i(l,o,q,"σ","\\sigma",!0);i(l,o,q,"τ","\\tau",!0);i(l,o,q,"υ","\\upsilon",!0);i(l,o,q,"ϕ","\\phi",!0);i(l,o,q,"χ","\\chi",!0);i(l,o,q,"ψ","\\psi",!0);i(l,o,q,"ω","\\omega",!0);i(l,o,q,"ε","\\varepsilon",!0);i(l,o,q,"ϑ","\\vartheta",!0);i(l,o,q,"ϖ","\\varpi",!0);i(l,o,q,"ϱ","\\varrho",!0);i(l,o,q,"ς","\\varsigma",!0);i(l,o,q,"φ","\\varphi",!0);i(l,o,D,"∗","*",!0);i(l,o,D,"+","+");i(l,o,D,"−","-",!0);i(l,o,D,"⋅","\\cdot",!0);i(l,o,D,"∘","\\circ",!0);i(l,o,D,"÷","\\div",!0);i(l,o,D,"±","\\pm",!0);i(l,o,D,"×","\\times",!0);i(l,o,D,"∩","\\cap",!0);i(l,o,D,"∪","\\cup",!0);i(l,o,D,"∖","\\setminus",!0);i(l,o,D,"∧","\\land");i(l,o,D,"∨","\\lor");i(l,o,D,"∧","\\wedge",!0);i(l,o,D,"∨","\\vee",!0);i(l,o,v,"√","\\surd");i(l,o,c0,"⟨","\\langle",!0);i(l,o,c0,"∣","\\lvert");i(l,o,c0,"∥","\\lVert");i(l,o,i0,"?","?");i(l,o,i0,"!","!");i(l,o,i0,"⟩","\\rangle",!0);i(l,o,i0,"∣","\\rvert");i(l,o,i0,"∥","\\rVert");i(l,o,f,"=","=");i(l,o,f,":",":");i(l,o,f,"≈","\\approx",!0);i(l,o,f,"≅","\\cong",!0);i(l,o,f,"≥","\\ge");i(l,o,f,"≥","\\geq",!0);i(l,o,f,"←","\\gets");i(l,o,f,">","\\gt",!0);i(l,o,f,"∈","\\in",!0);i(l,o,f,"","\\@not");i(l,o,f,"⊂","\\subset",!0);i(l,o,f,"⊃","\\supset",!0);i(l,o,f,"⊆","\\subseteq",!0);i(l,o,f,"⊇","\\supseteq",!0);i(l,d,f,"⊈","\\nsubseteq",!0);i(l,d,f,"⊉","\\nsupseteq",!0);i(l,o,f,"⊨","\\models");i(l,o,f,"←","\\leftarrow",!0);i(l,o,f,"≤","\\le");i(l,o,f,"≤","\\leq",!0);i(l,o,f,"<","\\lt",!0);i(l,o,f,"→","\\rightarrow",!0);i(l,o,f,"→","\\to");i(l,d,f,"≱","\\ngeq",!0);i(l,d,f,"≰","\\nleq",!0);i(l,o,R0," ","\\ ");i(l,o,R0," ","\\space");i(l,o,R0," ","\\nobreakspace");i(k,o,R0," ","\\ ");i(k,o,R0," "," ");i(k,o,R0," ","\\space");i(k,o,R0," ","\\nobreakspace");i(l,o,R0,null,"\\nobreak");i(l,o,R0,null,"\\allowbreak");i(l,o,qe,",",",");i(l,o,qe,";",";");i(l,d,D,"⊼","\\barwedge",!0);i(l,d,D,"⊻","\\veebar",!0);i(l,o,D,"⊙","\\odot",!0);i(l,o,D,"⊕","\\oplus",!0);i(l,o,D,"⊗","\\otimes",!0);i(l,o,v,"∂","\\partial",!0);i(l,o,D,"⊘","\\oslash",!0);i(l,d,D,"⊚","\\circledcirc",!0);i(l,d,D,"⊡","\\boxdot",!0);i(l,o,D,"△","\\bigtriangleup");i(l,o,D,"▽","\\bigtriangledown");i(l,o,D,"†","\\dagger");i(l,o,D,"⋄","\\diamond");i(l,o,D,"⋆","\\star");i(l,o,D,"◃","\\triangleleft");i(l,o,D,"▹","\\triangleright");i(l,o,c0,"{","\\{");i(k,o,v,"{","\\{");i(k,o,v,"{","\\textbraceleft");i(l,o,i0,"}","\\}");i(k,o,v,"}","\\}");i(k,o,v,"}","\\textbraceright");i(l,o,c0,"{","\\lbrace");i(l,o,i0,"}","\\rbrace");i(l,o,c0,"[","\\lbrack",!0);i(k,o,v,"[","\\lbrack",!0);i(l,o,i0,"]","\\rbrack",!0);i(k,o,v,"]","\\rbrack",!0);i(l,o,c0,"(","\\lparen",!0);i(l,o,i0,")","\\rparen",!0);i(k,o,v,"<","\\textless",!0);i(k,o,v,">","\\textgreater",!0);i(l,o,c0,"⌊","\\lfloor",!0);i(l,o,i0,"⌋","\\rfloor",!0);i(l,o,c0,"⌈","\\lceil",!0);i(l,o,i0,"⌉","\\rceil",!0);i(l,o,v,"\\","\\backslash");i(l,o,v,"∣","|");i(l,o,v,"∣","\\vert");i(k,o,v,"|","\\textbar",!0);i(l,o,v,"∥","\\|");i(l,o,v,"∥","\\Vert");i(k,o,v,"∥","\\textbardbl");i(k,o,v,"~","\\textasciitilde");i(k,o,v,"\\","\\textbackslash");i(k,o,v,"^","\\textasciicircum");i(l,o,f,"↑","\\uparrow",!0);i(l,o,f,"⇑","\\Uparrow",!0);i(l,o,f,"↓","\\downarrow",!0);i(l,o,f,"⇓","\\Downarrow",!0);i(l,o,f,"↕","\\updownarrow",!0);i(l,o,f,"⇕","\\Updownarrow",!0);i(l,o,_,"∐","\\coprod");i(l,o,_,"⋁","\\bigvee");i(l,o,_,"⋀","\\bigwedge");i(l,o,_,"⨄","\\biguplus");i(l,o,_,"⋂","\\bigcap");i(l,o,_,"⋃","\\bigcup");i(l,o,_,"∫","\\int");i(l,o,_,"∫","\\intop");i(l,o,_,"∬","\\iint");i(l,o,_,"∭","\\iiint");i(l,o,_,"∏","\\prod");i(l,o,_,"∑","\\sum");i(l,o,_,"⨂","\\bigotimes");i(l,o,_,"⨁","\\bigoplus");i(l,o,_,"⨀","\\bigodot");i(l,o,_,"∮","\\oint");i(l,o,_,"∯","\\oiint");i(l,o,_,"∰","\\oiiint");i(l,o,_,"⨆","\\bigsqcup");i(l,o,_,"∫","\\smallint");i(k,o,re,"…","\\textellipsis");i(l,o,re,"…","\\mathellipsis");i(k,o,re,"…","\\ldots",!0);i(l,o,re,"…","\\ldots",!0);i(l,o,re,"⋯","\\@cdots",!0);i(l,o,re,"⋱","\\ddots",!0);i(l,o,v,"⋮","\\varvdots");i(k,o,v,"⋮","\\varvdots");i(l,o,W,"ˊ","\\acute");i(l,o,W,"ˋ","\\grave");i(l,o,W,"¨","\\ddot");i(l,o,W,"~","\\tilde");i(l,o,W,"ˉ","\\bar");i(l,o,W,"˘","\\breve");i(l,o,W,"ˇ","\\check");i(l,o,W,"^","\\hat");i(l,o,W,"⃗","\\vec");i(l,o,W,"˙","\\dot");i(l,o,W,"˚","\\mathring");i(l,o,q,"","\\@imath");i(l,o,q,"","\\@jmath");i(l,o,v,"ı","ı");i(l,o,v,"ȷ","ȷ");i(k,o,v,"ı","\\i",!0);i(k,o,v,"ȷ","\\j",!0);i(k,o,v,"ß","\\ss",!0);i(k,o,v,"æ","\\ae",!0);i(k,o,v,"œ","\\oe",!0);i(k,o,v,"ø","\\o",!0);i(k,o,v,"Æ","\\AE",!0);i(k,o,v,"Œ","\\OE",!0);i(k,o,v,"Ø","\\O",!0);i(k,o,W,"ˊ","\\'");i(k,o,W,"ˋ","\\`");i(k,o,W,"ˆ","\\^");i(k,o,W,"˜","\\~");i(k,o,W,"ˉ","\\=");i(k,o,W,"˘","\\u");i(k,o,W,"˙","\\.");i(k,o,W,"¸","\\c");i(k,o,W,"˚","\\r");i(k,o,W,"ˇ","\\v");i(k,o,W,"¨",'\\"');i(k,o,W,"˝","\\H");i(k,o,W,"◯","\\textcircled");var kr={"--":!0,"---":!0,"``":!0,"''":!0};i(k,o,v,"–","--",!0);i(k,o,v,"–","\\textendash");i(k,o,v,"—","---",!0);i(k,o,v,"—","\\textemdash");i(k,o,v,"‘","`",!0);i(k,o,v,"‘","\\textquoteleft");i(k,o,v,"’","'",!0);i(k,o,v,"’","\\textquoteright");i(k,o,v,"“","``",!0);i(k,o,v,"“","\\textquotedblleft");i(k,o,v,"”","''",!0);i(k,o,v,"”","\\textquotedblright");i(l,o,v,"°","\\degree",!0);i(k,o,v,"°","\\degree");i(k,o,v,"°","\\textdegree",!0);i(l,o,v,"£","\\pounds");i(l,o,v,"£","\\mathsterling",!0);i(k,o,v,"£","\\pounds");i(k,o,v,"£","\\textsterling",!0);i(l,d,v,"✠","\\maltese");i(k,d,v,"✠","\\maltese");var Vt='0123456789/@."';for(var Ye=0;Ye0)return b0(s,p,n,t,u.concat(g));if(c){var y,x;if(c==="boldsymbol"){var w=_a(s,n,t,u,a);y=w.fontName,x=[w.fontClass]}else h?(y=zr[c].fontName,x=[c]):(y=xe(c,t.fontWeight,t.fontShape),x=[c,t.fontWeight,t.fontShape]);if(Re(s,y,n).metrics)return b0(s,y,n,t,u.concat(x));if(kr.hasOwnProperty(s)&&y.slice(0,10)==="Typewriter"){for(var z=[],T=0;T{if(P0(r.classes)!==P0(e.classes)||r.skew!==e.skew||r.maxFontSize!==e.maxFontSize)return!1;if(r.classes.length===1){var t=r.classes[0];if(t==="mbin"||t==="mord")return!1}for(var a in r.style)if(r.style.hasOwnProperty(a)&&r.style[a]!==e.style[a])return!1;for(var n in e.style)if(e.style.hasOwnProperty(n)&&r.style[n]!==e.style[n])return!1;return!0},r1=r=>{for(var e=0;et&&(t=u.height),u.depth>a&&(a=u.depth),u.maxFontSize>n&&(n=u.maxFontSize)}e.height=t,e.depth=a,e.maxFontSize=n},l0=function(e,t,a,n){var s=new he(e,t,a,n);return gt(s),s},Sr=(r,e,t,a)=>new he(r,e,t,a),a1=function(e,t,a){var n=l0([e],[],t);return n.height=Math.max(a||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),n.style.borderBottomWidth=A(n.height),n.maxFontSize=1,n},n1=function(e,t,a,n){var s=new vt(e,t,a,n);return gt(s),s},Mr=function(e){var t=new oe(e);return gt(t),t},i1=function(e,t){return e instanceof oe?l0([],[e],t):e},s1=function(e){if(e.positionType==="individualShift"){for(var t=e.children,a=[t[0]],n=-t[0].shift-t[0].elem.depth,s=n,u=1;u{var t=l0(["mspace"],[],e),a=K(r,e);return t.style.marginRight=A(a),t},xe=function(e,t,a){var n="";switch(e){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=e}var s;return t==="textbf"&&a==="textit"?s="BoldItalic":t==="textbf"?s="Bold":t==="textit"?s="Italic":s="Regular",n+"-"+s},zr={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Ar={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},o1=function(e,t){var[a,n,s]=Ar[e],u=new V0(a),h=new C0([u],{width:A(n),height:A(s),style:"width:"+A(n),viewBox:"0 0 "+1e3*n+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),c=Sr(["overlay"],[h],t);return c.height=s,c.style.height=A(s),c.style.width=A(n),c},b={fontMap:zr,makeSymbol:b0,mathsym:Qa,makeSpan:l0,makeSvgSpan:Sr,makeLineSpan:a1,makeAnchor:n1,makeFragment:Mr,wrapFragment:i1,makeVList:l1,makeOrd:e1,makeGlue:u1,staticSvg:o1,svgData:Ar,tryCombineChars:r1},Z={number:3,unit:"mu"},$0={number:4,unit:"mu"},A0={number:5,unit:"mu"},h1={mord:{mop:Z,mbin:$0,mrel:A0,minner:Z},mop:{mord:Z,mop:Z,mrel:A0,minner:Z},mbin:{mord:$0,mop:$0,mopen:$0,minner:$0},mrel:{mord:A0,mop:A0,mopen:A0,minner:A0},mopen:{},mclose:{mop:Z,mbin:$0,mrel:A0,minner:Z},mpunct:{mord:Z,mop:Z,mrel:A0,mopen:Z,mclose:Z,mpunct:Z,minner:Z},minner:{mord:Z,mop:Z,mbin:$0,mrel:A0,mopen:Z,mpunct:Z,minner:Z}},m1={mord:{mop:Z},mop:{mord:Z,mop:Z},mbin:{},mrel:{},mopen:{},mclose:{mop:Z},mpunct:{},minner:{mop:Z}},Tr={},De={},Ce={};function B(r){for(var{type:e,names:t,props:a,handler:n,htmlBuilder:s,mathmlBuilder:u}=r,h={type:e,numArgs:a.numArgs,argTypes:a.argTypes,allowedInArgument:!!a.allowedInArgument,allowedInText:!!a.allowedInText,allowedInMath:a.allowedInMath===void 0?!0:a.allowedInMath,numOptionalArgs:a.numOptionalArgs||0,infix:!!a.infix,primitive:!!a.primitive,handler:n},c=0;c{var C=T.classes[0],N=z.classes[0];C==="mbin"&&d1.includes(N)?T.classes[0]="mord":N==="mbin"&&c1.includes(C)&&(z.classes[0]="mord")},{node:y},x,w),$t(s,(z,T)=>{var C=ut(T),N=ut(z),I=C&&N?z.hasClass("mtight")?m1[C][N]:h1[C][N]:null;if(I)return b.makeGlue(I,p)},{node:y},x,w),s},$t=function r(e,t,a,n,s){n&&e.push(n);for(var u=0;ux=>{e.splice(y+1,0,x),u++})(u)}n&&e.pop()},Br=function(e){return e instanceof oe||e instanceof vt||e instanceof he&&e.hasClass("enclosing")?e:null},v1=function r(e,t){var a=Br(e);if(a){var n=a.children;if(n.length){if(t==="right")return r(n[n.length-1],"right");if(t==="left")return r(n[0],"left")}}return e},ut=function(e,t){return e?(t&&(e=v1(e,t)),p1[e.classes[0]]||null):null},ue=function(e,t){var a=["nulldelimiter"].concat(e.baseSizingClasses());return N0(t.concat(a))},L=function(e,t,a){if(!e)return N0();if(De[e.type]){var n=De[e.type](e,t);if(a&&t.size!==a.size){n=N0(t.sizingClasses(a),[n],t);var s=t.sizeMultiplier/a.sizeMultiplier;n.height*=s,n.depth*=s}return n}else throw new M("Got group of unknown type: '"+e.type+"'")};function we(r,e){var t=N0(["base"],r,e),a=N0(["strut"]);return a.style.height=A(t.height+t.depth),t.depth&&(a.style.verticalAlign=A(-t.depth)),t.children.unshift(a),t}function ot(r,e){var t=null;r.length===1&&r[0].type==="tag"&&(t=r[0].tag,r=r[0].body);var a=t0(r,e,"root"),n;a.length===2&&a[1].hasClass("tag")&&(n=a.pop());for(var s=[],u=[],h=0;h0&&(s.push(we(u,e)),u=[]),s.push(a[h]));u.length>0&&s.push(we(u,e));var p;t?(p=we(t0(t,e,!0)),p.classes=["tag"],s.push(p)):n&&s.push(n);var g=N0(["katex-html"],s);if(g.setAttribute("aria-hidden","true"),p){var y=p.children[0];y.style.height=A(g.height+g.depth),g.depth&&(y.style.verticalAlign=A(-g.depth))}return g}function Dr(r){return new oe(r)}class h0{constructor(e,t,a){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=a||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=P0(this.classes));for(var a=0;a0&&(e+=' class ="'+V.escape(P0(this.classes))+'"'),e+=">";for(var a=0;a",e}toText(){return this.children.map(e=>e.toText()).join("")}}class w0{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return V.escape(this.toText())}toText(){return this.text}}class g1{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",A(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var S={MathNode:h0,TextNode:w0,SpaceNode:g1,newDocumentFragment:Dr},v0=function(e,t,a){return $[t][e]&&$[t][e].replace&&e.charCodeAt(0)!==55349&&!(kr.hasOwnProperty(e)&&a&&(a.fontFamily&&a.fontFamily.slice(4,6)==="tt"||a.font&&a.font.slice(4,6)==="tt"))&&(e=$[t][e].replace),new S.TextNode(e)},bt=function(e){return e.length===1?e[0]:new S.MathNode("mrow",e)},yt=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";var a=t.font;if(!a||a==="mathnormal")return null;var n=e.mode;if(a==="mathit")return"italic";if(a==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(a==="mathbf")return"bold";if(a==="mathbb")return"double-struck";if(a==="mathsfit")return"sans-serif-italic";if(a==="mathfrak")return"fraktur";if(a==="mathscr"||a==="mathcal")return"script";if(a==="mathsf")return"sans-serif";if(a==="mathtt")return"monospace";var s=e.text;if(["\\imath","\\jmath"].includes(s))return null;$[n][s]&&$[n][s].replace&&(s=$[n][s].replace);var u=b.fontMap[a].fontName;return pt(s,u,n)?b.fontMap[a].variant:null};function je(r){if(!r)return!1;if(r.type==="mi"&&r.children.length===1){var e=r.children[0];return e instanceof w0&&e.text==="."}else if(r.type==="mo"&&r.children.length===1&&r.getAttribute("separator")==="true"&&r.getAttribute("lspace")==="0em"&&r.getAttribute("rspace")==="0em"){var t=r.children[0];return t instanceof w0&&t.text===","}else return!1}var o0=function(e,t,a){if(e.length===1){var n=X(e[0],t);return a&&n instanceof h0&&n.type==="mo"&&(n.setAttribute("lspace","0em"),n.setAttribute("rspace","0em")),[n]}for(var s=[],u,h=0;h=1&&(u.type==="mn"||je(u))){var p=c.children[0];p instanceof h0&&p.type==="mn"&&(p.children=[...u.children,...p.children],s.pop())}else if(u.type==="mi"&&u.children.length===1){var g=u.children[0];if(g instanceof w0&&g.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var y=c.children[0];y instanceof w0&&y.text.length>0&&(y.text=y.text.slice(0,1)+"̸"+y.text.slice(1),s.pop())}}}s.push(c),u=c}return s},G0=function(e,t,a){return bt(o0(e,t,a))},X=function(e,t){if(!e)return new S.MathNode("mrow");if(Ce[e.type]){var a=Ce[e.type](e,t);return a}else throw new M("Got group of unknown type: '"+e.type+"'")};function Wt(r,e,t,a,n){var s=o0(r,t),u;s.length===1&&s[0]instanceof h0&&["mrow","mtable"].includes(s[0].type)?u=s[0]:u=new S.MathNode("mrow",s);var h=new S.MathNode("annotation",[new S.TextNode(e)]);h.setAttribute("encoding","application/x-tex");var c=new S.MathNode("semantics",[u,h]),p=new S.MathNode("math",[c]);p.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),a&&p.setAttribute("display","block");var g=n?"katex":"katex-mathml";return b.makeSpan([g],[p])}var Cr=function(e){return new T0({style:e.displayMode?R.DISPLAY:R.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},Nr=function(e,t){if(t.displayMode){var a=["katex-display"];t.leqno&&a.push("leqno"),t.fleqn&&a.push("fleqn"),e=b.makeSpan(a,[e])}return e},b1=function(e,t,a){var n=Cr(a),s;if(a.output==="mathml")return Wt(e,t,n,a.displayMode,!0);if(a.output==="html"){var u=ot(e,n);s=b.makeSpan(["katex"],[u])}else{var h=Wt(e,t,n,a.displayMode,!1),c=ot(e,n);s=b.makeSpan(["katex"],[h,c])}return Nr(s,a)},y1=function(e,t,a){var n=Cr(a),s=ot(e,n),u=b.makeSpan(["katex"],[s]);return Nr(u,a)},x1={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},w1=function(e){var t=new S.MathNode("mo",[new S.TextNode(x1[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},k1={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},S1=function(e){return e.type==="ordgroup"?e.body.length:1},M1=function(e,t){function a(){var h=4e5,c=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(c)){var p=e,g=S1(p.base),y,x,w;if(g>5)c==="widehat"||c==="widecheck"?(y=420,h=2364,w=.42,x=c+"4"):(y=312,h=2340,w=.34,x="tilde4");else{var z=[1,1,2,2,3,3][g];c==="widehat"||c==="widecheck"?(h=[0,1062,2364,2364,2364][z],y=[0,239,300,360,420][z],w=[0,.24,.3,.3,.36,.42][z],x=c+z):(h=[0,600,1033,2339,2340][z],y=[0,260,286,306,312][z],w=[0,.26,.286,.3,.306,.34][z],x="tilde"+z)}var T=new V0(x),C=new C0([T],{width:"100%",height:A(w),viewBox:"0 0 "+h+" "+y,preserveAspectRatio:"none"});return{span:b.makeSvgSpan([],[C],t),minWidth:0,height:w}}else{var N=[],I=k1[c],[F,G,H]=I,U=H/1e3,P=F.length,j,Y;if(P===1){var z0=I[3];j=["hide-tail"],Y=[z0]}else if(P===2)j=["halfarrow-left","halfarrow-right"],Y=["xMinYMin","xMaxYMin"];else if(P===3)j=["brace-left","brace-center","brace-right"],Y=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+P+" children.");for(var r0=0;r00&&(n.style.minWidth=A(s)),n},z1=function(e,t,a,n,s){var u,h=e.height+e.depth+a+n;if(/fbox|color|angl/.test(t)){if(u=b.makeSpan(["stretchy",t],[],s),t==="fbox"){var c=s.color&&s.getColor();c&&(u.style.borderColor=c)}}else{var p=[];/^[bx]cancel$/.test(t)&&p.push(new st({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&p.push(new st({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var g=new C0(p,{width:"100%",height:A(h)});u=b.makeSvgSpan([],[g],s)}return u.height=h,u.style.height=A(h),u},q0={encloseSpan:z1,mathMLnode:w1,svgSpan:M1};function O(r,e){if(!r||r.type!==e)throw new Error("Expected node of type "+e+", but got "+(r?"node of type "+r.type:String(r)));return r}function xt(r){var e=Ee(r);if(!e)throw new Error("Expected node of symbol group type, but got "+(r?"node of type "+r.type:String(r)));return e}function Ee(r){return r&&(r.type==="atom"||Ka.hasOwnProperty(r.type))?r:null}var wt=(r,e)=>{var t,a,n;r&&r.type==="supsub"?(a=O(r.base,"accent"),t=a.base,r.base=t,n=ja(L(r,e)),r.base=a):(a=O(r,"accent"),t=a.base);var s=L(t,e.havingCrampedStyle()),u=a.isShifty&&V.isCharacterBox(t),h=0;if(u){var c=V.getBaseElem(t),p=L(c,e.havingCrampedStyle());h=Pt(p).skew}var g=a.label==="\\c",y=g?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),x;if(a.isStretchy)x=q0.svgSpan(a,e),x=b.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:x,wrapperClasses:["svg-align"],wrapperStyle:h>0?{width:"calc(100% - "+A(2*h)+")",marginLeft:A(2*h)}:void 0}]},e);else{var w,z;a.label==="\\vec"?(w=b.staticSvg("vec",e),z=b.svgData.vec[1]):(w=b.makeOrd({mode:a.mode,text:a.label},e,"textord"),w=Pt(w),w.italic=0,z=w.width,g&&(y+=w.depth)),x=b.makeSpan(["accent-body"],[w]);var T=a.label==="\\textcircled";T&&(x.classes.push("accent-full"),y=s.height);var C=h;T||(C-=z/2),x.style.left=A(C),a.label==="\\textcircled"&&(x.style.top=".2em"),x=b.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-y},{type:"elem",elem:x}]},e)}var N=b.makeSpan(["mord","accent"],[x],e);return n?(n.children[0]=N,n.height=Math.max(N.height,n.height),n.classes[0]="mord",n):N},qr=(r,e)=>{var t=r.isStretchy?q0.mathMLnode(r.label):new S.MathNode("mo",[v0(r.label,r.mode)]),a=new S.MathNode("mover",[X(r.base,e),t]);return a.setAttribute("accent","true"),a},A1=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(r=>"\\"+r).join("|"));B({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(r,e)=>{var t=Ne(e[0]),a=!A1.test(r.funcName),n=!a||r.funcName==="\\widehat"||r.funcName==="\\widetilde"||r.funcName==="\\widecheck";return{type:"accent",mode:r.parser.mode,label:r.funcName,isStretchy:a,isShifty:n,base:t}},htmlBuilder:wt,mathmlBuilder:qr});B({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(r,e)=>{var t=e[0],a=r.parser.mode;return a==="math"&&(r.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+r.funcName+" works only in text mode"),a="text"),{type:"accent",mode:a,label:r.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:wt,mathmlBuilder:qr});B({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:a}=r,n=e[0];return{type:"accentUnder",mode:t.mode,label:a,base:n}},htmlBuilder:(r,e)=>{var t=L(r.base,e),a=q0.svgSpan(r,e),n=r.label==="\\utilde"?.12:0,s=b.makeVList({positionType:"top",positionData:t.height,children:[{type:"elem",elem:a,wrapperClasses:["svg-align"]},{type:"kern",size:n},{type:"elem",elem:t}]},e);return b.makeSpan(["mord","accentunder"],[s],e)},mathmlBuilder:(r,e)=>{var t=q0.mathMLnode(r.label),a=new S.MathNode("munder",[X(r.base,e),t]);return a.setAttribute("accentunder","true"),a}});var ke=r=>{var e=new S.MathNode("mpadded",r?[r]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};B({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:a,funcName:n}=r;return{type:"xArrow",mode:a.mode,label:n,body:e[0],below:t[0]}},htmlBuilder(r,e){var t=e.style,a=e.havingStyle(t.sup()),n=b.wrapFragment(L(r.body,a,e),e),s=r.label.slice(0,2)==="\\x"?"x":"cd";n.classes.push(s+"-arrow-pad");var u;r.below&&(a=e.havingStyle(t.sub()),u=b.wrapFragment(L(r.below,a,e),e),u.classes.push(s+"-arrow-pad"));var h=q0.svgSpan(r,e),c=-e.fontMetrics().axisHeight+.5*h.height,p=-e.fontMetrics().axisHeight-.5*h.height-.111;(n.depth>.25||r.label==="\\xleftequilibrium")&&(p-=n.depth);var g;if(u){var y=-e.fontMetrics().axisHeight+u.height+.5*h.height+.111;g=b.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:p},{type:"elem",elem:h,shift:c},{type:"elem",elem:u,shift:y}]},e)}else g=b.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:p},{type:"elem",elem:h,shift:c}]},e);return g.children[0].children[0].children[1].classes.push("svg-align"),b.makeSpan(["mrel","x-arrow"],[g],e)},mathmlBuilder(r,e){var t=q0.mathMLnode(r.label);t.setAttribute("minsize",r.label.charAt(0)==="x"?"1.75em":"3.0em");var a;if(r.body){var n=ke(X(r.body,e));if(r.below){var s=ke(X(r.below,e));a=new S.MathNode("munderover",[t,s,n])}else a=new S.MathNode("mover",[t,n])}else if(r.below){var u=ke(X(r.below,e));a=new S.MathNode("munder",[t,u])}else a=ke(),a=new S.MathNode("mover",[t,a]);return a}});var T1=b.makeSpan;function Rr(r,e){var t=t0(r.body,e,!0);return T1([r.mclass],t,e)}function Er(r,e){var t,a=o0(r.body,e);return r.mclass==="minner"?t=new S.MathNode("mpadded",a):r.mclass==="mord"?r.isCharacterBox?(t=a[0],t.type="mi"):t=new S.MathNode("mi",a):(r.isCharacterBox?(t=a[0],t.type="mo"):t=new S.MathNode("mo",a),r.mclass==="mbin"?(t.attributes.lspace="0.22em",t.attributes.rspace="0.22em"):r.mclass==="mpunct"?(t.attributes.lspace="0em",t.attributes.rspace="0.17em"):r.mclass==="mopen"||r.mclass==="mclose"?(t.attributes.lspace="0em",t.attributes.rspace="0em"):r.mclass==="minner"&&(t.attributes.lspace="0.0556em",t.attributes.width="+0.1111em")),t}B({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(r,e){var{parser:t,funcName:a}=r,n=e[0];return{type:"mclass",mode:t.mode,mclass:"m"+a.slice(5),body:Q(n),isCharacterBox:V.isCharacterBox(n)}},htmlBuilder:Rr,mathmlBuilder:Er});var Ie=r=>{var e=r.type==="ordgroup"&&r.body.length?r.body[0]:r;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};B({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(r,e){var{parser:t}=r;return{type:"mclass",mode:t.mode,mclass:Ie(e[0]),body:Q(e[1]),isCharacterBox:V.isCharacterBox(e[1])}}});B({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(r,e){var{parser:t,funcName:a}=r,n=e[1],s=e[0],u;a!=="\\stackrel"?u=Ie(n):u="mrel";var h={type:"op",mode:n.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:a!=="\\stackrel",body:Q(n)},c={type:"supsub",mode:s.mode,base:h,sup:a==="\\underset"?null:s,sub:a==="\\underset"?s:null};return{type:"mclass",mode:t.mode,mclass:u,body:[c],isCharacterBox:V.isCharacterBox(c)}},htmlBuilder:Rr,mathmlBuilder:Er});B({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"pmb",mode:t.mode,mclass:Ie(e[0]),body:Q(e[0])}},htmlBuilder(r,e){var t=t0(r.body,e,!0),a=b.makeSpan([r.mclass],t,e);return a.style.textShadow="0.02em 0.01em 0.04px",a},mathmlBuilder(r,e){var t=o0(r.body,e),a=new S.MathNode("mstyle",t);return a.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),a}});var B1={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},jt=()=>({type:"styling",body:[],mode:"math",style:"display"}),Zt=r=>r.type==="textord"&&r.text==="@",D1=(r,e)=>(r.type==="mathord"||r.type==="atom")&&r.text===e;function C1(r,e,t){var a=B1[r];switch(a){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return t.callFunction(a,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var n=t.callFunction("\\\\cdleft",[e[0]],[]),s={type:"atom",text:a,mode:"math",family:"rel"},u=t.callFunction("\\Big",[s],[]),h=t.callFunction("\\\\cdright",[e[1]],[]),c={type:"ordgroup",mode:"math",body:[n,u,h]};return t.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return t.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var p={type:"textord",text:"\\Vert",mode:"math"};return t.callFunction("\\Big",[p],[])}default:return{type:"textord",text:" ",mode:"math"}}}function N1(r){var e=[];for(r.gullet.beginGroup(),r.gullet.macros.set("\\cr","\\\\\\relax"),r.gullet.beginGroup();;){e.push(r.parseExpression(!1,"\\\\")),r.gullet.endGroup(),r.gullet.beginGroup();var t=r.fetch().text;if(t==="&"||t==="\\\\")r.consume();else if(t==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new M("Expected \\\\ or \\cr or \\end",r.nextToken)}for(var a=[],n=[a],s=0;s-1))if("<>AV".indexOf(p)>-1)for(var y=0;y<2;y++){for(var x=!0,w=c+1;wAV=|." after @',u[c]);var z=C1(p,g,r),T={type:"styling",body:[z],mode:"math",style:"display"};a.push(T),h=jt()}s%2===0?a.push(h):a.shift(),a=[],n.push(a)}r.gullet.endGroup(),r.gullet.endGroup();var C=new Array(n[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:n,arraystretch:1,addJot:!0,rowGaps:[null],cols:C,colSeparationType:"CD",hLinesBeforeRow:new Array(n.length+1).fill([])}}B({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:a}=r;return{type:"cdlabel",mode:t.mode,side:a.slice(4),label:e[0]}},htmlBuilder(r,e){var t=e.havingStyle(e.style.sup()),a=b.wrapFragment(L(r.label,t,e),e);return a.classes.push("cd-label-"+r.side),a.style.bottom=A(.8-a.depth),a.height=0,a.depth=0,a},mathmlBuilder(r,e){var t=new S.MathNode("mrow",[X(r.label,e)]);return t=new S.MathNode("mpadded",[t]),t.setAttribute("width","0"),r.side==="left"&&t.setAttribute("lspace","-1width"),t.setAttribute("voffset","0.7em"),t=new S.MathNode("mstyle",[t]),t.setAttribute("displaystyle","false"),t.setAttribute("scriptlevel","1"),t}});B({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(r,e){var{parser:t}=r;return{type:"cdlabelparent",mode:t.mode,fragment:e[0]}},htmlBuilder(r,e){var t=b.wrapFragment(L(r.fragment,e),e);return t.classes.push("cd-vert-arrow"),t},mathmlBuilder(r,e){return new S.MathNode("mrow",[X(r.fragment,e)])}});B({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(r,e){for(var{parser:t}=r,a=O(e[0],"ordgroup"),n=a.body,s="",u=0;u=1114111)throw new M("\\@char with invalid code point "+s);return c<=65535?p=String.fromCharCode(c):(c-=65536,p=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:t.mode,text:p}}});var Ir=(r,e)=>{var t=t0(r.body,e.withColor(r.color),!1);return b.makeFragment(t)},Fr=(r,e)=>{var t=o0(r.body,e.withColor(r.color)),a=new S.MathNode("mstyle",t);return a.setAttribute("mathcolor",r.color),a};B({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(r,e){var{parser:t}=r,a=O(e[0],"color-token").color,n=e[1];return{type:"color",mode:t.mode,color:a,body:Q(n)}},htmlBuilder:Ir,mathmlBuilder:Fr});B({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(r,e){var{parser:t,breakOnTokenText:a}=r,n=O(e[0],"color-token").color;t.gullet.macros.set("\\current@color",n);var s=t.parseExpression(!0,a);return{type:"color",mode:t.mode,color:n,body:s}},htmlBuilder:Ir,mathmlBuilder:Fr});B({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(r,e,t){var{parser:a}=r,n=a.gullet.future().text==="["?a.parseSizeGroup(!0):null,s=!a.settings.displayMode||!a.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:a.mode,newLine:s,size:n&&O(n,"size").value}},htmlBuilder(r,e){var t=b.makeSpan(["mspace"],[],e);return r.newLine&&(t.classes.push("newline"),r.size&&(t.style.marginTop=A(K(r.size,e)))),t},mathmlBuilder(r,e){var t=new S.MathNode("mspace");return r.newLine&&(t.setAttribute("linebreak","newline"),r.size&&t.setAttribute("height",A(K(r.size,e)))),t}});var ht={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Or=r=>{var e=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new M("Expected a control sequence",r);return e},q1=r=>{var e=r.gullet.popToken();return e.text==="="&&(e=r.gullet.popToken(),e.text===" "&&(e=r.gullet.popToken())),e},Hr=(r,e,t,a)=>{var n=r.gullet.macros.get(t.text);n==null&&(t.noexpand=!0,n={tokens:[t],numArgs:0,unexpandable:!r.gullet.isExpandable(t.text)}),r.gullet.macros.set(e,n,a)};B({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(r){var{parser:e,funcName:t}=r;e.consumeSpaces();var a=e.fetch();if(ht[a.text])return(t==="\\global"||t==="\\\\globallong")&&(a.text=ht[a.text]),O(e.parseFunction(),"internal");throw new M("Invalid token after macro prefix",a)}});B({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,a=e.gullet.popToken(),n=a.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(n))throw new M("Expected a control sequence",a);for(var s=0,u,h=[[]];e.gullet.future().text!=="{";)if(a=e.gullet.popToken(),a.text==="#"){if(e.gullet.future().text==="{"){u=e.gullet.future(),h[s].push("{");break}if(a=e.gullet.popToken(),!/^[1-9]$/.test(a.text))throw new M('Invalid argument number "'+a.text+'"');if(parseInt(a.text)!==s+1)throw new M('Argument number "'+a.text+'" out of order');s++,h.push([])}else{if(a.text==="EOF")throw new M("Expected a macro definition");h[s].push(a.text)}var{tokens:c}=e.gullet.consumeArg();return u&&c.unshift(u),(t==="\\edef"||t==="\\xdef")&&(c=e.gullet.expandTokens(c),c.reverse()),e.gullet.macros.set(n,{tokens:c,numArgs:s,delimiters:h},t===ht[t]),{type:"internal",mode:e.mode}}});B({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,a=Or(e.gullet.popToken());e.gullet.consumeSpaces();var n=q1(e);return Hr(e,a,n,t==="\\\\globallet"),{type:"internal",mode:e.mode}}});B({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,a=Or(e.gullet.popToken()),n=e.gullet.popToken(),s=e.gullet.popToken();return Hr(e,a,s,t==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(n),{type:"internal",mode:e.mode}}});var ie=function(e,t,a){var n=$.math[e]&&$.math[e].replace,s=pt(n||e,t,a);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return s},kt=function(e,t,a,n){var s=a.havingBaseStyle(t),u=b.makeSpan(n.concat(s.sizingClasses(a)),[e],a),h=s.sizeMultiplier/a.sizeMultiplier;return u.height*=h,u.depth*=h,u.maxFontSize=s.sizeMultiplier,u},Lr=function(e,t,a){var n=t.havingBaseStyle(a),s=(1-t.sizeMultiplier/n.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=A(s),e.height-=s,e.depth+=s},R1=function(e,t,a,n,s,u){var h=b.makeSymbol(e,"Main-Regular",s,n),c=kt(h,t,n,u);return a&&Lr(c,n,t),c},E1=function(e,t,a,n){return b.makeSymbol(e,"Size"+t+"-Regular",a,n)},Pr=function(e,t,a,n,s,u){var h=E1(e,t,s,n),c=kt(b.makeSpan(["delimsizing","size"+t],[h],n),R.TEXT,n,u);return a&&Lr(c,n,R.TEXT),c},Ze=function(e,t,a){var n;t==="Size1-Regular"?n="delim-size1":n="delim-size4";var s=b.makeSpan(["delimsizinginner",n],[b.makeSpan([],[b.makeSymbol(e,t,a)])]);return{type:"elem",elem:s}},Ke=function(e,t,a){var n=x0["Size4-Regular"][e.charCodeAt(0)]?x0["Size4-Regular"][e.charCodeAt(0)][4]:x0["Size1-Regular"][e.charCodeAt(0)][4],s=new V0("inner",La(e,Math.round(1e3*t))),u=new C0([s],{width:A(n),height:A(t),style:"width:"+A(n),viewBox:"0 0 "+1e3*n+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),h=b.makeSvgSpan([],[u],a);return h.height=t,h.style.height=A(t),h.style.width=A(n),{type:"elem",elem:h}},mt=.008,Se={type:"kern",size:-1*mt},I1=["|","\\lvert","\\rvert","\\vert"],F1=["\\|","\\lVert","\\rVert","\\Vert"],Vr=function(e,t,a,n,s,u){var h,c,p,g,y="",x=0;h=p=g=e,c=null;var w="Size1-Regular";e==="\\uparrow"?p=g="⏐":e==="\\Uparrow"?p=g="‖":e==="\\downarrow"?h=p="⏐":e==="\\Downarrow"?h=p="‖":e==="\\updownarrow"?(h="\\uparrow",p="⏐",g="\\downarrow"):e==="\\Updownarrow"?(h="\\Uparrow",p="‖",g="\\Downarrow"):I1.includes(e)?(p="∣",y="vert",x=333):F1.includes(e)?(p="∥",y="doublevert",x=556):e==="["||e==="\\lbrack"?(h="⎡",p="⎢",g="⎣",w="Size4-Regular",y="lbrack",x=667):e==="]"||e==="\\rbrack"?(h="⎤",p="⎥",g="⎦",w="Size4-Regular",y="rbrack",x=667):e==="\\lfloor"||e==="⌊"?(p=h="⎢",g="⎣",w="Size4-Regular",y="lfloor",x=667):e==="\\lceil"||e==="⌈"?(h="⎡",p=g="⎢",w="Size4-Regular",y="lceil",x=667):e==="\\rfloor"||e==="⌋"?(p=h="⎥",g="⎦",w="Size4-Regular",y="rfloor",x=667):e==="\\rceil"||e==="⌉"?(h="⎤",p=g="⎥",w="Size4-Regular",y="rceil",x=667):e==="("||e==="\\lparen"?(h="⎛",p="⎜",g="⎝",w="Size4-Regular",y="lparen",x=875):e===")"||e==="\\rparen"?(h="⎞",p="⎟",g="⎠",w="Size4-Regular",y="rparen",x=875):e==="\\{"||e==="\\lbrace"?(h="⎧",c="⎨",g="⎩",p="⎪",w="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(h="⎫",c="⎬",g="⎭",p="⎪",w="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(h="⎧",g="⎩",p="⎪",w="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(h="⎫",g="⎭",p="⎪",w="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(h="⎧",g="⎭",p="⎪",w="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(h="⎫",g="⎩",p="⎪",w="Size4-Regular");var z=ie(h,w,s),T=z.height+z.depth,C=ie(p,w,s),N=C.height+C.depth,I=ie(g,w,s),F=I.height+I.depth,G=0,H=1;if(c!==null){var U=ie(c,w,s);G=U.height+U.depth,H=2}var P=T+F+G,j=Math.max(0,Math.ceil((t-P)/(H*N))),Y=P+j*H*N,z0=n.fontMetrics().axisHeight;a&&(z0*=n.sizeMultiplier);var r0=Y/2-z0,e0=[];if(y.length>0){var Y0=Y-T-F,s0=Math.round(Y*1e3),g0=Pa(y,Math.round(Y0*1e3)),E0=new V0(y,g0),j0=(x/1e3).toFixed(3)+"em",Z0=(s0/1e3).toFixed(3)+"em",Le=new C0([E0],{width:j0,height:Z0,viewBox:"0 0 "+x+" "+s0}),I0=b.makeSvgSpan([],[Le],n);I0.height=s0/1e3,I0.style.width=j0,I0.style.height=Z0,e0.push({type:"elem",elem:I0})}else{if(e0.push(Ze(g,w,s)),e0.push(Se),c===null){var F0=Y-T-F+2*mt;e0.push(Ke(p,F0,n))}else{var d0=(Y-T-F-G)/2+2*mt;e0.push(Ke(p,d0,n)),e0.push(Se),e0.push(Ze(c,w,s)),e0.push(Se),e0.push(Ke(p,d0,n))}e0.push(Se),e0.push(Ze(h,w,s))}var ne=n.havingBaseStyle(R.TEXT),Pe=b.makeVList({positionType:"bottom",positionData:r0,children:e0},ne);return kt(b.makeSpan(["delimsizing","mult"],[Pe],ne),R.TEXT,n,u)},Je=80,Qe=.08,_e=function(e,t,a,n,s){var u=Ha(e,n,a),h=new V0(e,u),c=new C0([h],{width:"400em",height:A(t),viewBox:"0 0 400000 "+a,preserveAspectRatio:"xMinYMin slice"});return b.makeSvgSpan(["hide-tail"],[c],s)},O1=function(e,t){var a=t.havingBaseSizing(),n=Xr("\\surd",e*a.sizeMultiplier,Yr,a),s=a.sizeMultiplier,u=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),h,c=0,p=0,g=0,y;return n.type==="small"?(g=1e3+1e3*u+Je,e<1?s=1:e<1.4&&(s=.7),c=(1+u+Qe)/s,p=(1+u)/s,h=_e("sqrtMain",c,g,u,t),h.style.minWidth="0.853em",y=.833/s):n.type==="large"?(g=(1e3+Je)*se[n.size],p=(se[n.size]+u)/s,c=(se[n.size]+u+Qe)/s,h=_e("sqrtSize"+n.size,c,g,u,t),h.style.minWidth="1.02em",y=1/s):(c=e+u+Qe,p=e+u,g=Math.floor(1e3*e+u)+Je,h=_e("sqrtTall",c,g,u,t),h.style.minWidth="0.742em",y=1.056),h.height=p,h.style.height=A(c),{span:h,advanceWidth:y,ruleWidth:(t.fontMetrics().sqrtRuleThickness+u)*s}},Gr=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],H1=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],Ur=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],se=[0,1.2,1.8,2.4,3],L1=function(e,t,a,n,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),Gr.includes(e)||Ur.includes(e))return Pr(e,t,!1,a,n,s);if(H1.includes(e))return Vr(e,se[t],!1,a,n,s);throw new M("Illegal delimiter: '"+e+"'")},P1=[{type:"small",style:R.SCRIPTSCRIPT},{type:"small",style:R.SCRIPT},{type:"small",style:R.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],V1=[{type:"small",style:R.SCRIPTSCRIPT},{type:"small",style:R.SCRIPT},{type:"small",style:R.TEXT},{type:"stack"}],Yr=[{type:"small",style:R.SCRIPTSCRIPT},{type:"small",style:R.SCRIPT},{type:"small",style:R.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],G1=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},Xr=function(e,t,a,n){for(var s=Math.min(2,3-n.style.size),u=s;ut)return a[u]}return a[a.length-1]},$r=function(e,t,a,n,s,u){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var h;Ur.includes(e)?h=P1:Gr.includes(e)?h=Yr:h=V1;var c=Xr(e,t,h,n);return c.type==="small"?R1(e,c.style,a,n,s,u):c.type==="large"?Pr(e,c.size,a,n,s,u):Vr(e,t,a,n,s,u)},U1=function(e,t,a,n,s,u){var h=n.fontMetrics().axisHeight*n.sizeMultiplier,c=901,p=5/n.fontMetrics().ptPerEm,g=Math.max(t-h,a+h),y=Math.max(g/500*c,2*g-p);return $r(e,y,!0,n,s,u)},D0={sqrtImage:O1,sizedDelim:L1,sizeToMaxHeight:se,customSizedDelim:$r,leftRightDelim:U1},Kt={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Y1=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Fe(r,e){var t=Ee(r);if(t&&Y1.includes(t.text))return t;throw t?new M("Invalid delimiter '"+t.text+"' after '"+e.funcName+"'",r):new M("Invalid delimiter type '"+r.type+"'",r)}B({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(r,e)=>{var t=Fe(e[0],r);return{type:"delimsizing",mode:r.parser.mode,size:Kt[r.funcName].size,mclass:Kt[r.funcName].mclass,delim:t.text}},htmlBuilder:(r,e)=>r.delim==="."?b.makeSpan([r.mclass]):D0.sizedDelim(r.delim,r.size,e,r.mode,[r.mclass]),mathmlBuilder:r=>{var e=[];r.delim!=="."&&e.push(v0(r.delim,r.mode));var t=new S.MathNode("mo",e);r.mclass==="mopen"||r.mclass==="mclose"?t.setAttribute("fence","true"):t.setAttribute("fence","false"),t.setAttribute("stretchy","true");var a=A(D0.sizeToMaxHeight[r.size]);return t.setAttribute("minsize",a),t.setAttribute("maxsize",a),t}});function Jt(r){if(!r.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}B({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=r.parser.gullet.macros.get("\\current@color");if(t&&typeof t!="string")throw new M("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:r.parser.mode,delim:Fe(e[0],r).text,color:t}}});B({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=Fe(e[0],r),a=r.parser;++a.leftrightDepth;var n=a.parseExpression(!1);--a.leftrightDepth,a.expect("\\right",!1);var s=O(a.parseFunction(),"leftright-right");return{type:"leftright",mode:a.mode,body:n,left:t.text,right:s.delim,rightColor:s.color}},htmlBuilder:(r,e)=>{Jt(r);for(var t=t0(r.body,e,!0,["mopen","mclose"]),a=0,n=0,s=!1,u=0;u{Jt(r);var t=o0(r.body,e);if(r.left!=="."){var a=new S.MathNode("mo",[v0(r.left,r.mode)]);a.setAttribute("fence","true"),t.unshift(a)}if(r.right!=="."){var n=new S.MathNode("mo",[v0(r.right,r.mode)]);n.setAttribute("fence","true"),r.rightColor&&n.setAttribute("mathcolor",r.rightColor),t.push(n)}return bt(t)}});B({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=Fe(e[0],r);if(!r.parser.leftrightDepth)throw new M("\\middle without preceding \\left",t);return{type:"middle",mode:r.parser.mode,delim:t.text}},htmlBuilder:(r,e)=>{var t;if(r.delim===".")t=ue(e,[]);else{t=D0.sizedDelim(r.delim,1,e,r.mode,[]);var a={delim:r.delim,options:e};t.isMiddle=a}return t},mathmlBuilder:(r,e)=>{var t=r.delim==="\\vert"||r.delim==="|"?v0("|","text"):v0(r.delim,r.mode),a=new S.MathNode("mo",[t]);return a.setAttribute("fence","true"),a.setAttribute("lspace","0.05em"),a.setAttribute("rspace","0.05em"),a}});var St=(r,e)=>{var t=b.wrapFragment(L(r.body,e),e),a=r.label.slice(1),n=e.sizeMultiplier,s,u=0,h=V.isCharacterBox(r.body);if(a==="sout")s=b.makeSpan(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/n,u=-.5*e.fontMetrics().xHeight;else if(a==="phase"){var c=K({number:.6,unit:"pt"},e),p=K({number:.35,unit:"ex"},e),g=e.havingBaseSizing();n=n/g.sizeMultiplier;var y=t.height+t.depth+c+p;t.style.paddingLeft=A(y/2+c);var x=Math.floor(1e3*y*n),w=Fa(x),z=new C0([new V0("phase",w)],{width:"400em",height:A(x/1e3),viewBox:"0 0 400000 "+x,preserveAspectRatio:"xMinYMin slice"});s=b.makeSvgSpan(["hide-tail"],[z],e),s.style.height=A(y),u=t.depth+c+p}else{/cancel/.test(a)?h||t.classes.push("cancel-pad"):a==="angl"?t.classes.push("anglpad"):t.classes.push("boxpad");var T=0,C=0,N=0;/box/.test(a)?(N=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),T=e.fontMetrics().fboxsep+(a==="colorbox"?0:N),C=T):a==="angl"?(N=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),T=4*N,C=Math.max(0,.25-t.depth)):(T=h?.2:0,C=T),s=q0.encloseSpan(t,a,T,C,e),/fbox|boxed|fcolorbox/.test(a)?(s.style.borderStyle="solid",s.style.borderWidth=A(N)):a==="angl"&&N!==.049&&(s.style.borderTopWidth=A(N),s.style.borderRightWidth=A(N)),u=t.depth+C,r.backgroundColor&&(s.style.backgroundColor=r.backgroundColor,r.borderColor&&(s.style.borderColor=r.borderColor))}var I;if(r.backgroundColor)I=b.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:u},{type:"elem",elem:t,shift:0}]},e);else{var F=/cancel|phase/.test(a)?["svg-align"]:[];I=b.makeVList({positionType:"individualShift",children:[{type:"elem",elem:t,shift:0},{type:"elem",elem:s,shift:u,wrapperClasses:F}]},e)}return/cancel/.test(a)&&(I.height=t.height,I.depth=t.depth),/cancel/.test(a)&&!h?b.makeSpan(["mord","cancel-lap"],[I],e):b.makeSpan(["mord"],[I],e)},Mt=(r,e)=>{var t=0,a=new S.MathNode(r.label.indexOf("colorbox")>-1?"mpadded":"menclose",[X(r.body,e)]);switch(r.label){case"\\cancel":a.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":a.setAttribute("notation","downdiagonalstrike");break;case"\\phase":a.setAttribute("notation","phasorangle");break;case"\\sout":a.setAttribute("notation","horizontalstrike");break;case"\\fbox":a.setAttribute("notation","box");break;case"\\angl":a.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(t=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,a.setAttribute("width","+"+2*t+"pt"),a.setAttribute("height","+"+2*t+"pt"),a.setAttribute("lspace",t+"pt"),a.setAttribute("voffset",t+"pt"),r.label==="\\fcolorbox"){var n=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);a.setAttribute("style","border: "+n+"em solid "+String(r.borderColor))}break;case"\\xcancel":a.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return r.backgroundColor&&a.setAttribute("mathbackground",r.backgroundColor),a};B({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(r,e,t){var{parser:a,funcName:n}=r,s=O(e[0],"color-token").color,u=e[1];return{type:"enclose",mode:a.mode,label:n,backgroundColor:s,body:u}},htmlBuilder:St,mathmlBuilder:Mt});B({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(r,e,t){var{parser:a,funcName:n}=r,s=O(e[0],"color-token").color,u=O(e[1],"color-token").color,h=e[2];return{type:"enclose",mode:a.mode,label:n,backgroundColor:u,borderColor:s,body:h}},htmlBuilder:St,mathmlBuilder:Mt});B({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\fbox",body:e[0]}}});B({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:a}=r,n=e[0];return{type:"enclose",mode:t.mode,label:a,body:n}},htmlBuilder:St,mathmlBuilder:Mt});B({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\angl",body:e[0]}}});var Wr={};function k0(r){for(var{type:e,names:t,props:a,handler:n,htmlBuilder:s,mathmlBuilder:u}=r,h={type:e,numArgs:a.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:n},c=0;c{var e=r.parser.settings;if(!e.displayMode)throw new M("{"+r.envName+"} can be used only in display mode.")};function zt(r){if(r.indexOf("ed")===-1)return r.indexOf("*")===-1}function U0(r,e,t){var{hskipBeforeAndAfter:a,addJot:n,cols:s,arraystretch:u,colSeparationType:h,autoTag:c,singleRow:p,emptySingleRow:g,maxNumCols:y,leqno:x}=e;if(r.gullet.beginGroup(),p||r.gullet.macros.set("\\cr","\\\\\\relax"),!u){var w=r.gullet.expandMacroAsText("\\arraystretch");if(w==null)u=1;else if(u=parseFloat(w),!u||u<0)throw new M("Invalid \\arraystretch: "+w)}r.gullet.beginGroup();var z=[],T=[z],C=[],N=[],I=c!=null?[]:void 0;function F(){c&&r.gullet.macros.set("\\@eqnsw","1",!0)}function G(){I&&(r.gullet.macros.get("\\df@tag")?(I.push(r.subparse([new m0("\\df@tag")])),r.gullet.macros.set("\\df@tag",void 0,!0)):I.push(!!c&&r.gullet.macros.get("\\@eqnsw")==="1"))}for(F(),N.push(Qt(r));;){var H=r.parseExpression(!1,p?"\\end":"\\\\");r.gullet.endGroup(),r.gullet.beginGroup(),H={type:"ordgroup",mode:r.mode,body:H},t&&(H={type:"styling",mode:r.mode,style:t,body:[H]}),z.push(H);var U=r.fetch().text;if(U==="&"){if(y&&z.length===y){if(p||h)throw new M("Too many tab characters: &",r.nextToken);r.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}r.consume()}else if(U==="\\end"){G(),z.length===1&&H.type==="styling"&&H.body[0].body.length===0&&(T.length>1||!g)&&T.pop(),N.length0&&(F+=.25),p.push({pos:F,isDashed:fe[pe]})}for(G(u[0]),a=0;a0&&(r0+=I,Pfe))for(a=0;a=h)){var J0=void 0;(n>0||e.hskipBeforeAndAfter)&&(J0=V.deflt(d0.pregap,x),J0!==0&&(g0=b.makeSpan(["arraycolsep"],[]),g0.style.width=A(J0),s0.push(g0)));var Q0=[];for(a=0;a0){for(var ca=b.makeLineSpan("hline",t,g),da=b.makeLineSpan("hdashline",t,g),Ve=[{type:"elem",elem:c,shift:0}];p.length>0;){var Et=p.pop(),It=Et.pos-e0;Et.isDashed?Ve.push({type:"elem",elem:da,shift:It}):Ve.push({type:"elem",elem:ca,shift:It})}c=b.makeVList({positionType:"individualShift",children:Ve},t)}if(j0.length===0)return b.makeSpan(["mord"],[c],t);var Ge=b.makeVList({positionType:"individualShift",children:j0},t);return Ge=b.makeSpan(["tag"],[Ge],t),b.makeFragment([c,Ge])},X1={c:"center ",l:"left ",r:"right "},M0=function(e,t){for(var a=[],n=new S.MathNode("mtd",[],["mtr-glue"]),s=new S.MathNode("mtd",[],["mml-eqn-num"]),u=0;u0){var z=e.cols,T="",C=!1,N=0,I=z.length;z[0].type==="separator"&&(x+="top ",N=1),z[z.length-1].type==="separator"&&(x+="bottom ",I-=1);for(var F=N;F0?"left ":"",x+=j[j.length-1].length>0?"right ":"";for(var Y=1;Y-1?"alignat":"align",s=e.envName==="split",u=U0(e.parser,{cols:a,addJot:!0,autoTag:s?void 0:zt(e.envName),emptySingleRow:!0,colSeparationType:n,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),h,c=0,p={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&t[0].type==="ordgroup"){for(var g="",y=0;y0&&w&&(C=1),a[z]={type:"align",align:T,pregap:C,postgap:0}}return u.colSeparationType=w?"align":"alignat",u};k0({type:"array",names:["array","darray"],props:{numArgs:1},handler(r,e){var t=Ee(e[0]),a=t?[e[0]]:O(e[0],"ordgroup").body,n=a.map(function(u){var h=xt(u),c=h.text;if("lcr".indexOf(c)!==-1)return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new M("Unknown column alignment: "+c,u)}),s={cols:n,hskipBeforeAndAfter:!0,maxNumCols:n.length};return U0(r.parser,s,At(r.envName))},htmlBuilder:S0,mathmlBuilder:M0});k0({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(r){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[r.envName.replace("*","")],t="c",a={hskipBeforeAndAfter:!1,cols:[{type:"align",align:t}]};if(r.envName.charAt(r.envName.length-1)==="*"){var n=r.parser;if(n.consumeSpaces(),n.fetch().text==="["){if(n.consume(),n.consumeSpaces(),t=n.fetch().text,"lcr".indexOf(t)===-1)throw new M("Expected l or c or r",n.nextToken);n.consume(),n.consumeSpaces(),n.expect("]"),n.consume(),a.cols=[{type:"align",align:t}]}}var s=U0(r.parser,a,At(r.envName)),u=Math.max(0,...s.body.map(h=>h.length));return s.cols=new Array(u).fill({type:"align",align:t}),e?{type:"leftright",mode:r.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:S0,mathmlBuilder:M0});k0({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(r){var e={arraystretch:.5},t=U0(r.parser,e,"script");return t.colSeparationType="small",t},htmlBuilder:S0,mathmlBuilder:M0});k0({type:"array",names:["subarray"],props:{numArgs:1},handler(r,e){var t=Ee(e[0]),a=t?[e[0]]:O(e[0],"ordgroup").body,n=a.map(function(u){var h=xt(u),c=h.text;if("lc".indexOf(c)!==-1)return{type:"align",align:c};throw new M("Unknown column alignment: "+c,u)});if(n.length>1)throw new M("{subarray} can contain only one column");var s={cols:n,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=U0(r.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new M("{subarray} can contain only one column");return s},htmlBuilder:S0,mathmlBuilder:M0});k0({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(r){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},t=U0(r.parser,e,At(r.envName));return{type:"leftright",mode:r.mode,body:[t],left:r.envName.indexOf("r")>-1?".":"\\{",right:r.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:S0,mathmlBuilder:M0});k0({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Zr,htmlBuilder:S0,mathmlBuilder:M0});k0({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(r){["gather","gather*"].includes(r.envName)&&Oe(r);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:zt(r.envName),emptySingleRow:!0,leqno:r.parser.settings.leqno};return U0(r.parser,e,"display")},htmlBuilder:S0,mathmlBuilder:M0});k0({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Zr,htmlBuilder:S0,mathmlBuilder:M0});k0({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(r){Oe(r);var e={autoTag:zt(r.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:r.parser.settings.leqno};return U0(r.parser,e,"display")},htmlBuilder:S0,mathmlBuilder:M0});k0({type:"array",names:["CD"],props:{numArgs:0},handler(r){return Oe(r),N1(r.parser)},htmlBuilder:S0,mathmlBuilder:M0});m("\\nonumber","\\gdef\\@eqnsw{0}");m("\\notag","\\nonumber");B({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(r,e){throw new M(r.funcName+" valid only within array environment")}});var _t=Wr;B({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(r,e){var{parser:t,funcName:a}=r,n=e[0];if(n.type!=="ordgroup")throw new M("Invalid environment name",n);for(var s="",u=0;u{var t=r.font,a=e.withFont(t);return L(r.body,a)},Jr=(r,e)=>{var t=r.font,a=e.withFont(t);return X(r.body,a)},er={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};B({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:a}=r,n=Ne(e[0]),s=a;return s in er&&(s=er[s]),{type:"font",mode:t.mode,font:s.slice(1),body:n}},htmlBuilder:Kr,mathmlBuilder:Jr});B({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(r,e)=>{var{parser:t}=r,a=e[0],n=V.isCharacterBox(a);return{type:"mclass",mode:t.mode,mclass:Ie(a),body:[{type:"font",mode:t.mode,font:"boldsymbol",body:a}],isCharacterBox:n}}});B({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:a,breakOnTokenText:n}=r,{mode:s}=t,u=t.parseExpression(!0,n),h="math"+a.slice(1);return{type:"font",mode:s,font:h,body:{type:"ordgroup",mode:t.mode,body:u}}},htmlBuilder:Kr,mathmlBuilder:Jr});var Qr=(r,e)=>{var t=e;return r==="display"?t=t.id>=R.SCRIPT.id?t.text():R.DISPLAY:r==="text"&&t.size===R.DISPLAY.size?t=R.TEXT:r==="script"?t=R.SCRIPT:r==="scriptscript"&&(t=R.SCRIPTSCRIPT),t},Tt=(r,e)=>{var t=Qr(r.size,e.style),a=t.fracNum(),n=t.fracDen(),s;s=e.havingStyle(a);var u=L(r.numer,s,e);if(r.continued){var h=8.5/e.fontMetrics().ptPerEm,c=3.5/e.fontMetrics().ptPerEm;u.height=u.height0?z=3*x:z=7*x,T=e.fontMetrics().denom1):(y>0?(w=e.fontMetrics().num2,z=x):(w=e.fontMetrics().num3,z=3*x),T=e.fontMetrics().denom2);var C;if(g){var I=e.fontMetrics().axisHeight;w-u.depth-(I+.5*y){var t=new S.MathNode("mfrac",[X(r.numer,e),X(r.denom,e)]);if(!r.hasBarLine)t.setAttribute("linethickness","0px");else if(r.barSize){var a=K(r.barSize,e);t.setAttribute("linethickness",A(a))}var n=Qr(r.size,e.style);if(n.size!==e.style.size){t=new S.MathNode("mstyle",[t]);var s=n.size===R.DISPLAY.size?"true":"false";t.setAttribute("displaystyle",s),t.setAttribute("scriptlevel","0")}if(r.leftDelim!=null||r.rightDelim!=null){var u=[];if(r.leftDelim!=null){var h=new S.MathNode("mo",[new S.TextNode(r.leftDelim.replace("\\",""))]);h.setAttribute("fence","true"),u.push(h)}if(u.push(t),r.rightDelim!=null){var c=new S.MathNode("mo",[new S.TextNode(r.rightDelim.replace("\\",""))]);c.setAttribute("fence","true"),u.push(c)}return bt(u)}return t};B({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:a}=r,n=e[0],s=e[1],u,h=null,c=null,p="auto";switch(a){case"\\dfrac":case"\\frac":case"\\tfrac":u=!0;break;case"\\\\atopfrac":u=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":u=!1,h="(",c=")";break;case"\\\\bracefrac":u=!1,h="\\{",c="\\}";break;case"\\\\brackfrac":u=!1,h="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}switch(a){case"\\dfrac":case"\\dbinom":p="display";break;case"\\tfrac":case"\\tbinom":p="text";break}return{type:"genfrac",mode:t.mode,continued:!1,numer:n,denom:s,hasBarLine:u,leftDelim:h,rightDelim:c,size:p,barSize:null}},htmlBuilder:Tt,mathmlBuilder:Bt});B({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(r,e)=>{var{parser:t,funcName:a}=r,n=e[0],s=e[1];return{type:"genfrac",mode:t.mode,continued:!0,numer:n,denom:s,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});B({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(r){var{parser:e,funcName:t,token:a}=r,n;switch(t){case"\\over":n="\\frac";break;case"\\choose":n="\\binom";break;case"\\atop":n="\\\\atopfrac";break;case"\\brace":n="\\\\bracefrac";break;case"\\brack":n="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:n,token:a}}});var tr=["display","text","script","scriptscript"],rr=function(e){var t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};B({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(r,e){var{parser:t}=r,a=e[4],n=e[5],s=Ne(e[0]),u=s.type==="atom"&&s.family==="open"?rr(s.text):null,h=Ne(e[1]),c=h.type==="atom"&&h.family==="close"?rr(h.text):null,p=O(e[2],"size"),g,y=null;p.isBlank?g=!0:(y=p.value,g=y.number>0);var x="auto",w=e[3];if(w.type==="ordgroup"){if(w.body.length>0){var z=O(w.body[0],"textord");x=tr[Number(z.text)]}}else w=O(w,"textord"),x=tr[Number(w.text)];return{type:"genfrac",mode:t.mode,numer:a,denom:n,continued:!1,hasBarLine:g,barSize:y,leftDelim:u,rightDelim:c,size:x}},htmlBuilder:Tt,mathmlBuilder:Bt});B({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(r,e){var{parser:t,funcName:a,token:n}=r;return{type:"infix",mode:t.mode,replaceWith:"\\\\abovefrac",size:O(e[0],"size").value,token:n}}});B({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(r,e)=>{var{parser:t,funcName:a}=r,n=e[0],s=wa(O(e[1],"infix").size),u=e[2],h=s.number>0;return{type:"genfrac",mode:t.mode,numer:n,denom:u,continued:!1,hasBarLine:h,barSize:s,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:Tt,mathmlBuilder:Bt});var _r=(r,e)=>{var t=e.style,a,n;r.type==="supsub"?(a=r.sup?L(r.sup,e.havingStyle(t.sup()),e):L(r.sub,e.havingStyle(t.sub()),e),n=O(r.base,"horizBrace")):n=O(r,"horizBrace");var s=L(n.base,e.havingBaseStyle(R.DISPLAY)),u=q0.svgSpan(n,e),h;if(n.isOver?(h=b.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:u}]},e),h.children[0].children[0].children[1].classes.push("svg-align")):(h=b.makeVList({positionType:"bottom",positionData:s.depth+.1+u.height,children:[{type:"elem",elem:u},{type:"kern",size:.1},{type:"elem",elem:s}]},e),h.children[0].children[0].children[0].classes.push("svg-align")),a){var c=b.makeSpan(["mord",n.isOver?"mover":"munder"],[h],e);n.isOver?h=b.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:a}]},e):h=b.makeVList({positionType:"bottom",positionData:c.depth+.2+a.height+a.depth,children:[{type:"elem",elem:a},{type:"kern",size:.2},{type:"elem",elem:c}]},e)}return b.makeSpan(["mord",n.isOver?"mover":"munder"],[h],e)},$1=(r,e)=>{var t=q0.mathMLnode(r.label);return new S.MathNode(r.isOver?"mover":"munder",[X(r.base,e),t])};B({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:a}=r;return{type:"horizBrace",mode:t.mode,label:a,isOver:/^\\over/.test(a),base:e[0]}},htmlBuilder:_r,mathmlBuilder:$1});B({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,a=e[1],n=O(e[0],"url").url;return t.settings.isTrusted({command:"\\href",url:n})?{type:"href",mode:t.mode,href:n,body:Q(a)}:t.formatUnsupportedCmd("\\href")},htmlBuilder:(r,e)=>{var t=t0(r.body,e,!1);return b.makeAnchor(r.href,[],t,e)},mathmlBuilder:(r,e)=>{var t=G0(r.body,e);return t instanceof h0||(t=new h0("mrow",[t])),t.setAttribute("href",r.href),t}});B({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,a=O(e[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:a}))return t.formatUnsupportedCmd("\\url");for(var n=[],s=0;s{var{parser:t,funcName:a,token:n}=r,s=O(e[0],"raw").string,u=e[1];t.settings.strict&&t.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var h,c={};switch(a){case"\\htmlClass":c.class=s,h={command:"\\htmlClass",class:s};break;case"\\htmlId":c.id=s,h={command:"\\htmlId",id:s};break;case"\\htmlStyle":c.style=s,h={command:"\\htmlStyle",style:s};break;case"\\htmlData":{for(var p=s.split(","),g=0;g{var t=t0(r.body,e,!1),a=["enclosing"];r.attributes.class&&a.push(...r.attributes.class.trim().split(/\s+/));var n=b.makeSpan(a,t,e);for(var s in r.attributes)s!=="class"&&r.attributes.hasOwnProperty(s)&&n.setAttribute(s,r.attributes[s]);return n},mathmlBuilder:(r,e)=>G0(r.body,e)});B({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"htmlmathml",mode:t.mode,html:Q(e[0]),mathml:Q(e[1])}},htmlBuilder:(r,e)=>{var t=t0(r.html,e,!1);return b.makeFragment(t)},mathmlBuilder:(r,e)=>G0(r.mathml,e)});var et=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new M("Invalid size: '"+e+"' in \\includegraphics");var a={number:+(t[1]+t[2]),unit:t[3]};if(!br(a))throw new M("Invalid unit: '"+a.unit+"' in \\includegraphics.");return a};B({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(r,e,t)=>{var{parser:a}=r,n={number:0,unit:"em"},s={number:.9,unit:"em"},u={number:0,unit:"em"},h="";if(t[0])for(var c=O(t[0],"raw").string,p=c.split(","),g=0;g{var t=K(r.height,e),a=0;r.totalheight.number>0&&(a=K(r.totalheight,e)-t);var n=0;r.width.number>0&&(n=K(r.width,e));var s={height:A(t+a)};n>0&&(s.width=A(n)),a>0&&(s.verticalAlign=A(-a));var u=new $a(r.src,r.alt,s);return u.height=t,u.depth=a,u},mathmlBuilder:(r,e)=>{var t=new S.MathNode("mglyph",[]);t.setAttribute("alt",r.alt);var a=K(r.height,e),n=0;if(r.totalheight.number>0&&(n=K(r.totalheight,e)-a,t.setAttribute("valign",A(-n))),t.setAttribute("height",A(a+n)),r.width.number>0){var s=K(r.width,e);t.setAttribute("width",A(s))}return t.setAttribute("src",r.src),t}});B({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:a}=r,n=O(e[0],"size");if(t.settings.strict){var s=a[1]==="m",u=n.value.unit==="mu";s?(u||t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" supports only mu units, "+("not "+n.value.unit+" units")),t.mode!=="math"&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" works only in math mode")):u&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" doesn't support mu units")}return{type:"kern",mode:t.mode,dimension:n.value}},htmlBuilder(r,e){return b.makeGlue(r.dimension,e)},mathmlBuilder(r,e){var t=K(r.dimension,e);return new S.SpaceNode(t)}});B({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:a}=r,n=e[0];return{type:"lap",mode:t.mode,alignment:a.slice(5),body:n}},htmlBuilder:(r,e)=>{var t;r.alignment==="clap"?(t=b.makeSpan([],[L(r.body,e)]),t=b.makeSpan(["inner"],[t],e)):t=b.makeSpan(["inner"],[L(r.body,e)]);var a=b.makeSpan(["fix"],[]),n=b.makeSpan([r.alignment],[t,a],e),s=b.makeSpan(["strut"]);return s.style.height=A(n.height+n.depth),n.depth&&(s.style.verticalAlign=A(-n.depth)),n.children.unshift(s),n=b.makeSpan(["thinbox"],[n],e),b.makeSpan(["mord","vbox"],[n],e)},mathmlBuilder:(r,e)=>{var t=new S.MathNode("mpadded",[X(r.body,e)]);if(r.alignment!=="rlap"){var a=r.alignment==="llap"?"-1":"-0.5";t.setAttribute("lspace",a+"width")}return t.setAttribute("width","0px"),t}});B({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){var{funcName:t,parser:a}=r,n=a.mode;a.switchMode("math");var s=t==="\\("?"\\)":"$",u=a.parseExpression(!1,s);return a.expect(s),a.switchMode(n),{type:"styling",mode:a.mode,style:"text",body:u}}});B({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){throw new M("Mismatched "+r.funcName)}});var ar=(r,e)=>{switch(e.style.size){case R.DISPLAY.size:return r.display;case R.TEXT.size:return r.text;case R.SCRIPT.size:return r.script;case R.SCRIPTSCRIPT.size:return r.scriptscript;default:return r.text}};B({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"mathchoice",mode:t.mode,display:Q(e[0]),text:Q(e[1]),script:Q(e[2]),scriptscript:Q(e[3])}},htmlBuilder:(r,e)=>{var t=ar(r,e),a=t0(t,e,!1);return b.makeFragment(a)},mathmlBuilder:(r,e)=>{var t=ar(r,e);return G0(t,e)}});var ea=(r,e,t,a,n,s,u)=>{r=b.makeSpan([],[r]);var h=t&&V.isCharacterBox(t),c,p;if(e){var g=L(e,a.havingStyle(n.sup()),a);p={elem:g,kern:Math.max(a.fontMetrics().bigOpSpacing1,a.fontMetrics().bigOpSpacing3-g.depth)}}if(t){var y=L(t,a.havingStyle(n.sub()),a);c={elem:y,kern:Math.max(a.fontMetrics().bigOpSpacing2,a.fontMetrics().bigOpSpacing4-y.height)}}var x;if(p&&c){var w=a.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+r.depth+u;x=b.makeVList({positionType:"bottom",positionData:w,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:A(-s)},{type:"kern",size:c.kern},{type:"elem",elem:r},{type:"kern",size:p.kern},{type:"elem",elem:p.elem,marginLeft:A(s)},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}else if(c){var z=r.height-u;x=b.makeVList({positionType:"top",positionData:z,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:A(-s)},{type:"kern",size:c.kern},{type:"elem",elem:r}]},a)}else if(p){var T=r.depth+u;x=b.makeVList({positionType:"bottom",positionData:T,children:[{type:"elem",elem:r},{type:"kern",size:p.kern},{type:"elem",elem:p.elem,marginLeft:A(s)},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}else return r;var C=[x];if(c&&s!==0&&!h){var N=b.makeSpan(["mspace"],[],a);N.style.marginRight=A(s),C.unshift(N)}return b.makeSpan(["mop","op-limits"],C,a)},ta=["\\smallint"],ae=(r,e)=>{var t,a,n=!1,s;r.type==="supsub"?(t=r.sup,a=r.sub,s=O(r.base,"op"),n=!0):s=O(r,"op");var u=e.style,h=!1;u.size===R.DISPLAY.size&&s.symbol&&!ta.includes(s.name)&&(h=!0);var c;if(s.symbol){var p=h?"Size2-Regular":"Size1-Regular",g="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(g=s.name.slice(1),s.name=g==="oiint"?"\\iint":"\\iiint"),c=b.makeSymbol(s.name,p,"math",e,["mop","op-symbol",h?"large-op":"small-op"]),g.length>0){var y=c.italic,x=b.staticSvg(g+"Size"+(h?"2":"1"),e);c=b.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:x,shift:h?.08:0}]},e),s.name="\\"+g,c.classes.unshift("mop"),c.italic=y}}else if(s.body){var w=t0(s.body,e,!0);w.length===1&&w[0]instanceof p0?(c=w[0],c.classes[0]="mop"):c=b.makeSpan(["mop"],w,e)}else{for(var z=[],T=1;T{var t;if(r.symbol)t=new h0("mo",[v0(r.name,r.mode)]),ta.includes(r.name)&&t.setAttribute("largeop","false");else if(r.body)t=new h0("mo",o0(r.body,e));else{t=new h0("mi",[new w0(r.name.slice(1))]);var a=new h0("mo",[v0("⁡","text")]);r.parentIsSupSub?t=new h0("mrow",[t,a]):t=Dr([t,a])}return t},W1={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};B({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(r,e)=>{var{parser:t,funcName:a}=r,n=a;return n.length===1&&(n=W1[n]),{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:ae,mathmlBuilder:me});B({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var{parser:t}=r,a=e[0];return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Q(a)}},htmlBuilder:ae,mathmlBuilder:me});var j1={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};B({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:ae,mathmlBuilder:me});B({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:ae,mathmlBuilder:me});B({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(r){var{parser:e,funcName:t}=r,a=t;return a.length===1&&(a=j1[a]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:a}},htmlBuilder:ae,mathmlBuilder:me});var ra=(r,e)=>{var t,a,n=!1,s;r.type==="supsub"?(t=r.sup,a=r.sub,s=O(r.base,"operatorname"),n=!0):s=O(r,"operatorname");var u;if(s.body.length>0){for(var h=s.body.map(y=>{var x=y.text;return typeof x=="string"?{type:"textord",mode:y.mode,text:x}:y}),c=t0(h,e.withFont("mathrm"),!0),p=0;p{for(var t=o0(r.body,e.withFont("mathrm")),a=!0,n=0;ng.toText()).join("");t=[new S.TextNode(h)]}var c=new S.MathNode("mi",t);c.setAttribute("mathvariant","normal");var p=new S.MathNode("mo",[v0("⁡","text")]);return r.parentIsSupSub?new S.MathNode("mrow",[c,p]):S.newDocumentFragment([c,p])};B({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:a}=r,n=e[0];return{type:"operatorname",mode:t.mode,body:Q(n),alwaysHandleSupSub:a==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:ra,mathmlBuilder:Z1});m("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");W0({type:"ordgroup",htmlBuilder(r,e){return r.semisimple?b.makeFragment(t0(r.body,e,!1)):b.makeSpan(["mord"],t0(r.body,e,!0),e)},mathmlBuilder(r,e){return G0(r.body,e,!0)}});B({type:"overline",names:["\\overline"],props:{numArgs:1},handler(r,e){var{parser:t}=r,a=e[0];return{type:"overline",mode:t.mode,body:a}},htmlBuilder(r,e){var t=L(r.body,e.havingCrampedStyle()),a=b.makeLineSpan("overline-line",e),n=e.fontMetrics().defaultRuleThickness,s=b.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t},{type:"kern",size:3*n},{type:"elem",elem:a},{type:"kern",size:n}]},e);return b.makeSpan(["mord","overline"],[s],e)},mathmlBuilder(r,e){var t=new S.MathNode("mo",[new S.TextNode("‾")]);t.setAttribute("stretchy","true");var a=new S.MathNode("mover",[X(r.body,e),t]);return a.setAttribute("accent","true"),a}});B({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,a=e[0];return{type:"phantom",mode:t.mode,body:Q(a)}},htmlBuilder:(r,e)=>{var t=t0(r.body,e.withPhantom(),!1);return b.makeFragment(t)},mathmlBuilder:(r,e)=>{var t=o0(r.body,e);return new S.MathNode("mphantom",t)}});B({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,a=e[0];return{type:"hphantom",mode:t.mode,body:a}},htmlBuilder:(r,e)=>{var t=b.makeSpan([],[L(r.body,e.withPhantom())]);if(t.height=0,t.depth=0,t.children)for(var a=0;a{var t=o0(Q(r.body),e),a=new S.MathNode("mphantom",t),n=new S.MathNode("mpadded",[a]);return n.setAttribute("height","0px"),n.setAttribute("depth","0px"),n}});B({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,a=e[0];return{type:"vphantom",mode:t.mode,body:a}},htmlBuilder:(r,e)=>{var t=b.makeSpan(["inner"],[L(r.body,e.withPhantom())]),a=b.makeSpan(["fix"],[]);return b.makeSpan(["mord","rlap"],[t,a],e)},mathmlBuilder:(r,e)=>{var t=o0(Q(r.body),e),a=new S.MathNode("mphantom",t),n=new S.MathNode("mpadded",[a]);return n.setAttribute("width","0px"),n}});B({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r,a=O(e[0],"size").value,n=e[1];return{type:"raisebox",mode:t.mode,dy:a,body:n}},htmlBuilder(r,e){var t=L(r.body,e),a=K(r.dy,e);return b.makeVList({positionType:"shift",positionData:-a,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(r,e){var t=new S.MathNode("mpadded",[X(r.body,e)]),a=r.dy.number+r.dy.unit;return t.setAttribute("voffset",a),t}});B({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(r){var{parser:e}=r;return{type:"internal",mode:e.mode}}});B({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(r,e,t){var{parser:a}=r,n=t[0],s=O(e[0],"size"),u=O(e[1],"size");return{type:"rule",mode:a.mode,shift:n&&O(n,"size").value,width:s.value,height:u.value}},htmlBuilder(r,e){var t=b.makeSpan(["mord","rule"],[],e),a=K(r.width,e),n=K(r.height,e),s=r.shift?K(r.shift,e):0;return t.style.borderRightWidth=A(a),t.style.borderTopWidth=A(n),t.style.bottom=A(s),t.width=a,t.height=n+s,t.depth=-s,t.maxFontSize=n*1.125*e.sizeMultiplier,t},mathmlBuilder(r,e){var t=K(r.width,e),a=K(r.height,e),n=r.shift?K(r.shift,e):0,s=e.color&&e.getColor()||"black",u=new S.MathNode("mspace");u.setAttribute("mathbackground",s),u.setAttribute("width",A(t)),u.setAttribute("height",A(a));var h=new S.MathNode("mpadded",[u]);return n>=0?h.setAttribute("height",A(n)):(h.setAttribute("height",A(n)),h.setAttribute("depth",A(-n))),h.setAttribute("voffset",A(n)),h}});function aa(r,e,t){for(var a=t0(r,e,!1),n=e.sizeMultiplier/t.sizeMultiplier,s=0;s{var t=e.havingSize(r.size);return aa(r.body,t,e)};B({type:"sizing",names:nr,props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{breakOnTokenText:t,funcName:a,parser:n}=r,s=n.parseExpression(!1,t);return{type:"sizing",mode:n.mode,size:nr.indexOf(a)+1,body:s}},htmlBuilder:K1,mathmlBuilder:(r,e)=>{var t=e.havingSize(r.size),a=o0(r.body,t),n=new S.MathNode("mstyle",a);return n.setAttribute("mathsize",A(t.sizeMultiplier)),n}});B({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(r,e,t)=>{var{parser:a}=r,n=!1,s=!1,u=t[0]&&O(t[0],"ordgroup");if(u)for(var h="",c=0;c{var t=b.makeSpan([],[L(r.body,e)]);if(!r.smashHeight&&!r.smashDepth)return t;if(r.smashHeight&&(t.height=0,t.children))for(var a=0;a{var t=new S.MathNode("mpadded",[X(r.body,e)]);return r.smashHeight&&t.setAttribute("height","0px"),r.smashDepth&&t.setAttribute("depth","0px"),t}});B({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:a}=r,n=t[0],s=e[0];return{type:"sqrt",mode:a.mode,body:s,index:n}},htmlBuilder(r,e){var t=L(r.body,e.havingCrampedStyle());t.height===0&&(t.height=e.fontMetrics().xHeight),t=b.wrapFragment(t,e);var a=e.fontMetrics(),n=a.defaultRuleThickness,s=n;e.style.idt.height+t.depth+u&&(u=(u+y-t.height-t.depth)/2);var x=c.height-t.height-u-p;t.style.paddingLeft=A(g);var w=b.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t,wrapperClasses:["svg-align"]},{type:"kern",size:-(t.height+x)},{type:"elem",elem:c},{type:"kern",size:p}]},e);if(r.index){var z=e.havingStyle(R.SCRIPTSCRIPT),T=L(r.index,z,e),C=.6*(w.height-w.depth),N=b.makeVList({positionType:"shift",positionData:-C,children:[{type:"elem",elem:T}]},e),I=b.makeSpan(["root"],[N]);return b.makeSpan(["mord","sqrt"],[I,w],e)}else return b.makeSpan(["mord","sqrt"],[w],e)},mathmlBuilder(r,e){var{body:t,index:a}=r;return a?new S.MathNode("mroot",[X(t,e),X(a,e)]):new S.MathNode("msqrt",[X(t,e)])}});var ir={display:R.DISPLAY,text:R.TEXT,script:R.SCRIPT,scriptscript:R.SCRIPTSCRIPT};B({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r,e){var{breakOnTokenText:t,funcName:a,parser:n}=r,s=n.parseExpression(!0,t),u=a.slice(1,a.length-5);return{type:"styling",mode:n.mode,style:u,body:s}},htmlBuilder(r,e){var t=ir[r.style],a=e.havingStyle(t).withFont("");return aa(r.body,a,e)},mathmlBuilder(r,e){var t=ir[r.style],a=e.havingStyle(t),n=o0(r.body,a),s=new S.MathNode("mstyle",n),u={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},h=u[r.style];return s.setAttribute("scriptlevel",h[0]),s.setAttribute("displaystyle",h[1]),s}});var J1=function(e,t){var a=e.base;if(a)if(a.type==="op"){var n=a.limits&&(t.style.size===R.DISPLAY.size||a.alwaysHandleSupSub);return n?ae:null}else if(a.type==="operatorname"){var s=a.alwaysHandleSupSub&&(t.style.size===R.DISPLAY.size||a.limits);return s?ra:null}else{if(a.type==="accent")return V.isCharacterBox(a.base)?wt:null;if(a.type==="horizBrace"){var u=!e.sub;return u===a.isOver?_r:null}else return null}else return null};W0({type:"supsub",htmlBuilder(r,e){var t=J1(r,e);if(t)return t(r,e);var{base:a,sup:n,sub:s}=r,u=L(a,e),h,c,p=e.fontMetrics(),g=0,y=0,x=a&&V.isCharacterBox(a);if(n){var w=e.havingStyle(e.style.sup());h=L(n,w,e),x||(g=u.height-w.fontMetrics().supDrop*w.sizeMultiplier/e.sizeMultiplier)}if(s){var z=e.havingStyle(e.style.sub());c=L(s,z,e),x||(y=u.depth+z.fontMetrics().subDrop*z.sizeMultiplier/e.sizeMultiplier)}var T;e.style===R.DISPLAY?T=p.sup1:e.style.cramped?T=p.sup3:T=p.sup2;var C=e.sizeMultiplier,N=A(.5/p.ptPerEm/C),I=null;if(c){var F=r.base&&r.base.type==="op"&&r.base.name&&(r.base.name==="\\oiint"||r.base.name==="\\oiiint");(u instanceof p0||F)&&(I=A(-u.italic))}var G;if(h&&c){g=Math.max(g,T,h.depth+.25*p.xHeight),y=Math.max(y,p.sub2);var H=p.defaultRuleThickness,U=4*H;if(g-h.depth-(c.height-y)0&&(g+=P,y-=P)}var j=[{type:"elem",elem:c,shift:y,marginRight:N,marginLeft:I},{type:"elem",elem:h,shift:-g,marginRight:N}];G=b.makeVList({positionType:"individualShift",children:j},e)}else if(c){y=Math.max(y,p.sub1,c.height-.8*p.xHeight);var Y=[{type:"elem",elem:c,marginLeft:I,marginRight:N}];G=b.makeVList({positionType:"shift",positionData:y,children:Y},e)}else if(h)g=Math.max(g,T,h.depth+.25*p.xHeight),G=b.makeVList({positionType:"shift",positionData:-g,children:[{type:"elem",elem:h,marginRight:N}]},e);else throw new Error("supsub must have either sup or sub.");var z0=ut(u,"right")||"mord";return b.makeSpan([z0],[u,b.makeSpan(["msupsub"],[G])],e)},mathmlBuilder(r,e){var t=!1,a,n;r.base&&r.base.type==="horizBrace"&&(n=!!r.sup,n===r.base.isOver&&(t=!0,a=r.base.isOver)),r.base&&(r.base.type==="op"||r.base.type==="operatorname")&&(r.base.parentIsSupSub=!0);var s=[X(r.base,e)];r.sub&&s.push(X(r.sub,e)),r.sup&&s.push(X(r.sup,e));var u;if(t)u=a?"mover":"munder";else if(r.sub)if(r.sup){var p=r.base;p&&p.type==="op"&&p.limits&&e.style===R.DISPLAY||p&&p.type==="operatorname"&&p.alwaysHandleSupSub&&(e.style===R.DISPLAY||p.limits)?u="munderover":u="msubsup"}else{var c=r.base;c&&c.type==="op"&&c.limits&&(e.style===R.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===R.DISPLAY)?u="munder":u="msub"}else{var h=r.base;h&&h.type==="op"&&h.limits&&(e.style===R.DISPLAY||h.alwaysHandleSupSub)||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(h.limits||e.style===R.DISPLAY)?u="mover":u="msup"}return new S.MathNode(u,s)}});W0({type:"atom",htmlBuilder(r,e){return b.mathsym(r.text,r.mode,e,["m"+r.family])},mathmlBuilder(r,e){var t=new S.MathNode("mo",[v0(r.text,r.mode)]);if(r.family==="bin"){var a=yt(r,e);a==="bold-italic"&&t.setAttribute("mathvariant",a)}else r.family==="punct"?t.setAttribute("separator","true"):(r.family==="open"||r.family==="close")&&t.setAttribute("stretchy","false");return t}});var na={mi:"italic",mn:"normal",mtext:"normal"};W0({type:"mathord",htmlBuilder(r,e){return b.makeOrd(r,e,"mathord")},mathmlBuilder(r,e){var t=new S.MathNode("mi",[v0(r.text,r.mode,e)]),a=yt(r,e)||"italic";return a!==na[t.type]&&t.setAttribute("mathvariant",a),t}});W0({type:"textord",htmlBuilder(r,e){return b.makeOrd(r,e,"textord")},mathmlBuilder(r,e){var t=v0(r.text,r.mode,e),a=yt(r,e)||"normal",n;return r.mode==="text"?n=new S.MathNode("mtext",[t]):/[0-9]/.test(r.text)?n=new S.MathNode("mn",[t]):r.text==="\\prime"?n=new S.MathNode("mo",[t]):n=new S.MathNode("mi",[t]),a!==na[n.type]&&n.setAttribute("mathvariant",a),n}});var tt={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},rt={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};W0({type:"spacing",htmlBuilder(r,e){if(rt.hasOwnProperty(r.text)){var t=rt[r.text].className||"";if(r.mode==="text"){var a=b.makeOrd(r,e,"textord");return a.classes.push(t),a}else return b.makeSpan(["mspace",t],[b.mathsym(r.text,r.mode,e)],e)}else{if(tt.hasOwnProperty(r.text))return b.makeSpan(["mspace",tt[r.text]],[],e);throw new M('Unknown type of space "'+r.text+'"')}},mathmlBuilder(r,e){var t;if(rt.hasOwnProperty(r.text))t=new S.MathNode("mtext",[new S.TextNode(" ")]);else{if(tt.hasOwnProperty(r.text))return new S.MathNode("mspace");throw new M('Unknown type of space "'+r.text+'"')}return t}});var sr=()=>{var r=new S.MathNode("mtd",[]);return r.setAttribute("width","50%"),r};W0({type:"tag",mathmlBuilder(r,e){var t=new S.MathNode("mtable",[new S.MathNode("mtr",[sr(),new S.MathNode("mtd",[G0(r.body,e)]),sr(),new S.MathNode("mtd",[G0(r.tag,e)])])]);return t.setAttribute("width","100%"),t}});var lr={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},ur={"\\textbf":"textbf","\\textmd":"textmd"},Q1={"\\textit":"textit","\\textup":"textup"},or=(r,e)=>{var t=r.font;if(t){if(lr[t])return e.withTextFontFamily(lr[t]);if(ur[t])return e.withTextFontWeight(ur[t]);if(t==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(Q1[t])};B({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:a}=r,n=e[0];return{type:"text",mode:t.mode,body:Q(n),font:a}},htmlBuilder(r,e){var t=or(r,e),a=t0(r.body,t,!0);return b.makeSpan(["mord","text"],a,t)},mathmlBuilder(r,e){var t=or(r,e);return G0(r.body,t)}});B({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"underline",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=L(r.body,e),a=b.makeLineSpan("underline-line",e),n=e.fontMetrics().defaultRuleThickness,s=b.makeVList({positionType:"top",positionData:t.height,children:[{type:"kern",size:n},{type:"elem",elem:a},{type:"kern",size:3*n},{type:"elem",elem:t}]},e);return b.makeSpan(["mord","underline"],[s],e)},mathmlBuilder(r,e){var t=new S.MathNode("mo",[new S.TextNode("‾")]);t.setAttribute("stretchy","true");var a=new S.MathNode("munder",[X(r.body,e),t]);return a.setAttribute("accentunder","true"),a}});B({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"vcenter",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=L(r.body,e),a=e.fontMetrics().axisHeight,n=.5*(t.height-a-(t.depth+a));return b.makeVList({positionType:"shift",positionData:n,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(r,e){return new S.MathNode("mpadded",[X(r.body,e)],["vcenter"])}});B({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(r,e,t){throw new M("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(r,e){for(var t=hr(r),a=[],n=e.havingStyle(e.style.text()),s=0;sr.body.replace(/ /g,r.star?"␣":" "),L0=Tr,ia=`[ \r + ]`,_1="\\\\[a-zA-Z@]+",e4="\\\\[^\uD800-\uDFFF]",t4="("+_1+")"+ia+"*",r4=`\\\\( +|[ \r ]+ +?)[ \r ]*`,ct="[̀-ͯ]",a4=new RegExp(ct+"+$"),n4="("+ia+"+)|"+(r4+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(ct+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(ct+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+t4)+("|"+e4+")");class mr{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(n4,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new m0("EOF",new u0(this,t,t));var a=this.tokenRegex.exec(e);if(a===null||a.index!==t)throw new M("Unexpected character: '"+e[t]+"'",new m0(e[t],new u0(this,t,t+1)));var n=a[6]||a[3]||(a[2]?"\\ ":" ");if(this.catcodes[n]===14){var s=e.indexOf(` +`,this.tokenRegex.lastIndex);return s===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=s+1,this.lex()}return new m0(n,new u0(this,t,this.tokenRegex.lastIndex))}}class i4{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new M("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(e[t]==null?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,a){if(a===void 0&&(a=!1),a){for(var n=0;n0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var s=this.undefStack[this.undefStack.length-1];s&&!s.hasOwnProperty(e)&&(s[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}}var s4=jr;m("\\noexpand",function(r){var e=r.popToken();return r.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});m("\\expandafter",function(r){var e=r.popToken();return r.expandOnce(!0),{tokens:[e],numArgs:0}});m("\\@firstoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[0],numArgs:0}});m("\\@secondoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[1],numArgs:0}});m("\\@ifnextchar",function(r){var e=r.consumeArgs(3);r.consumeSpaces();var t=r.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});m("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");m("\\TextOrMath",function(r){var e=r.consumeArgs(2);return r.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var cr={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};m("\\char",function(r){var e=r.popToken(),t,a="";if(e.text==="'")t=8,e=r.popToken();else if(e.text==='"')t=16,e=r.popToken();else if(e.text==="`")if(e=r.popToken(),e.text[0]==="\\")a=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new M("\\char` missing argument");a=e.text.charCodeAt(0)}else t=10;if(t){if(a=cr[e.text],a==null||a>=t)throw new M("Invalid base-"+t+" digit "+e.text);for(var n;(n=cr[r.future().text])!=null&&n{var n=r.consumeArg().tokens;if(n.length!==1)throw new M("\\newcommand's first argument must be a macro name");var s=n[0].text,u=r.isDefined(s);if(u&&!e)throw new M("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!u&&!t)throw new M("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var h=0;if(n=r.consumeArg().tokens,n.length===1&&n[0].text==="["){for(var c="",p=r.expandNextToken();p.text!=="]"&&p.text!=="EOF";)c+=p.text,p=r.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new M("Invalid number of arguments: "+c);h=parseInt(c),n=r.consumeArg().tokens}return u&&a||r.macros.set(s,{tokens:n,numArgs:h}),""};m("\\newcommand",r=>Dt(r,!1,!0,!1));m("\\renewcommand",r=>Dt(r,!0,!1,!1));m("\\providecommand",r=>Dt(r,!0,!0,!0));m("\\message",r=>{var e=r.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""});m("\\errmessage",r=>{var e=r.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""});m("\\show",r=>{var e=r.popToken(),t=e.text;return console.log(e,r.macros.get(t),L0[t],$.math[t],$.text[t]),""});m("\\bgroup","{");m("\\egroup","}");m("~","\\nobreakspace");m("\\lq","`");m("\\rq","'");m("\\aa","\\r a");m("\\AA","\\r A");m("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");m("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");m("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");m("ℬ","\\mathscr{B}");m("ℰ","\\mathscr{E}");m("ℱ","\\mathscr{F}");m("ℋ","\\mathscr{H}");m("ℐ","\\mathscr{I}");m("ℒ","\\mathscr{L}");m("ℳ","\\mathscr{M}");m("ℛ","\\mathscr{R}");m("ℭ","\\mathfrak{C}");m("ℌ","\\mathfrak{H}");m("ℨ","\\mathfrak{Z}");m("\\Bbbk","\\Bbb{k}");m("·","\\cdotp");m("\\llap","\\mathllap{\\textrm{#1}}");m("\\rlap","\\mathrlap{\\textrm{#1}}");m("\\clap","\\mathclap{\\textrm{#1}}");m("\\mathstrut","\\vphantom{(}");m("\\underbar","\\underline{\\text{#1}}");m("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');m("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");m("\\ne","\\neq");m("≠","\\neq");m("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");m("∉","\\notin");m("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");m("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");m("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");m("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");m("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");m("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");m("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");m("⟂","\\perp");m("‼","\\mathclose{!\\mkern-0.8mu!}");m("∌","\\notni");m("⌜","\\ulcorner");m("⌝","\\urcorner");m("⌞","\\llcorner");m("⌟","\\lrcorner");m("©","\\copyright");m("®","\\textregistered");m("️","\\textregistered");m("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');m("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');m("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');m("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');m("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");m("⋮","\\vdots");m("\\varGamma","\\mathit{\\Gamma}");m("\\varDelta","\\mathit{\\Delta}");m("\\varTheta","\\mathit{\\Theta}");m("\\varLambda","\\mathit{\\Lambda}");m("\\varXi","\\mathit{\\Xi}");m("\\varPi","\\mathit{\\Pi}");m("\\varSigma","\\mathit{\\Sigma}");m("\\varUpsilon","\\mathit{\\Upsilon}");m("\\varPhi","\\mathit{\\Phi}");m("\\varPsi","\\mathit{\\Psi}");m("\\varOmega","\\mathit{\\Omega}");m("\\substack","\\begin{subarray}{c}#1\\end{subarray}");m("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");m("\\boxed","\\fbox{$\\displaystyle{#1}$}");m("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");m("\\implies","\\DOTSB\\;\\Longrightarrow\\;");m("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");m("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");m("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var dr={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};m("\\dots",function(r){var e="\\dotso",t=r.expandAfterFuture().text;return t in dr?e=dr[t]:(t.slice(0,4)==="\\not"||t in $.math&&["bin","rel"].includes($.math[t].group))&&(e="\\dotsb"),e});var Ct={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};m("\\dotso",function(r){var e=r.future().text;return e in Ct?"\\ldots\\,":"\\ldots"});m("\\dotsc",function(r){var e=r.future().text;return e in Ct&&e!==","?"\\ldots\\,":"\\ldots"});m("\\cdots",function(r){var e=r.future().text;return e in Ct?"\\@cdots\\,":"\\@cdots"});m("\\dotsb","\\cdots");m("\\dotsm","\\cdots");m("\\dotsi","\\!\\cdots");m("\\dotsx","\\ldots\\,");m("\\DOTSI","\\relax");m("\\DOTSB","\\relax");m("\\DOTSX","\\relax");m("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");m("\\,","\\tmspace+{3mu}{.1667em}");m("\\thinspace","\\,");m("\\>","\\mskip{4mu}");m("\\:","\\tmspace+{4mu}{.2222em}");m("\\medspace","\\:");m("\\;","\\tmspace+{5mu}{.2777em}");m("\\thickspace","\\;");m("\\!","\\tmspace-{3mu}{.1667em}");m("\\negthinspace","\\!");m("\\negmedspace","\\tmspace-{4mu}{.2222em}");m("\\negthickspace","\\tmspace-{5mu}{.277em}");m("\\enspace","\\kern.5em ");m("\\enskip","\\hskip.5em\\relax");m("\\quad","\\hskip1em\\relax");m("\\qquad","\\hskip2em\\relax");m("\\tag","\\@ifstar\\tag@literal\\tag@paren");m("\\tag@paren","\\tag@literal{({#1})}");m("\\tag@literal",r=>{if(r.macros.get("\\df@tag"))throw new M("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});m("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");m("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");m("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");m("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");m("\\newline","\\\\\\relax");m("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var sa=A(x0["Main-Regular"][84][1]-.7*x0["Main-Regular"][65][1]);m("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+sa+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");m("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+sa+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");m("\\hspace","\\@ifstar\\@hspacer\\@hspace");m("\\@hspace","\\hskip #1\\relax");m("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");m("\\ordinarycolon",":");m("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");m("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');m("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');m("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');m("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');m("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');m("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');m("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');m("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');m("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');m("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');m("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');m("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');m("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');m("∷","\\dblcolon");m("∹","\\eqcolon");m("≔","\\coloneqq");m("≕","\\eqqcolon");m("⩴","\\Coloneqq");m("\\ratio","\\vcentcolon");m("\\coloncolon","\\dblcolon");m("\\colonequals","\\coloneqq");m("\\coloncolonequals","\\Coloneqq");m("\\equalscolon","\\eqqcolon");m("\\equalscoloncolon","\\Eqqcolon");m("\\colonminus","\\coloneq");m("\\coloncolonminus","\\Coloneq");m("\\minuscolon","\\eqcolon");m("\\minuscoloncolon","\\Eqcolon");m("\\coloncolonapprox","\\Colonapprox");m("\\coloncolonsim","\\Colonsim");m("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");m("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");m("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");m("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");m("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");m("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");m("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");m("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");m("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");m("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");m("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");m("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");m("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");m("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");m("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");m("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");m("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");m("\\nleqq","\\html@mathml{\\@nleqq}{≰}");m("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");m("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");m("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");m("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");m("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");m("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");m("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");m("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");m("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");m("\\imath","\\html@mathml{\\@imath}{ı}");m("\\jmath","\\html@mathml{\\@jmath}{ȷ}");m("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");m("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");m("⟦","\\llbracket");m("⟧","\\rrbracket");m("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");m("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");m("⦃","\\lBrace");m("⦄","\\rBrace");m("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");m("⦵","\\minuso");m("\\darr","\\downarrow");m("\\dArr","\\Downarrow");m("\\Darr","\\Downarrow");m("\\lang","\\langle");m("\\rang","\\rangle");m("\\uarr","\\uparrow");m("\\uArr","\\Uparrow");m("\\Uarr","\\Uparrow");m("\\N","\\mathbb{N}");m("\\R","\\mathbb{R}");m("\\Z","\\mathbb{Z}");m("\\alef","\\aleph");m("\\alefsym","\\aleph");m("\\Alpha","\\mathrm{A}");m("\\Beta","\\mathrm{B}");m("\\bull","\\bullet");m("\\Chi","\\mathrm{X}");m("\\clubs","\\clubsuit");m("\\cnums","\\mathbb{C}");m("\\Complex","\\mathbb{C}");m("\\Dagger","\\ddagger");m("\\diamonds","\\diamondsuit");m("\\empty","\\emptyset");m("\\Epsilon","\\mathrm{E}");m("\\Eta","\\mathrm{H}");m("\\exist","\\exists");m("\\harr","\\leftrightarrow");m("\\hArr","\\Leftrightarrow");m("\\Harr","\\Leftrightarrow");m("\\hearts","\\heartsuit");m("\\image","\\Im");m("\\infin","\\infty");m("\\Iota","\\mathrm{I}");m("\\isin","\\in");m("\\Kappa","\\mathrm{K}");m("\\larr","\\leftarrow");m("\\lArr","\\Leftarrow");m("\\Larr","\\Leftarrow");m("\\lrarr","\\leftrightarrow");m("\\lrArr","\\Leftrightarrow");m("\\Lrarr","\\Leftrightarrow");m("\\Mu","\\mathrm{M}");m("\\natnums","\\mathbb{N}");m("\\Nu","\\mathrm{N}");m("\\Omicron","\\mathrm{O}");m("\\plusmn","\\pm");m("\\rarr","\\rightarrow");m("\\rArr","\\Rightarrow");m("\\Rarr","\\Rightarrow");m("\\real","\\Re");m("\\reals","\\mathbb{R}");m("\\Reals","\\mathbb{R}");m("\\Rho","\\mathrm{P}");m("\\sdot","\\cdot");m("\\sect","\\S");m("\\spades","\\spadesuit");m("\\sub","\\subset");m("\\sube","\\subseteq");m("\\supe","\\supseteq");m("\\Tau","\\mathrm{T}");m("\\thetasym","\\vartheta");m("\\weierp","\\wp");m("\\Zeta","\\mathrm{Z}");m("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");m("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");m("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");m("\\bra","\\mathinner{\\langle{#1}|}");m("\\ket","\\mathinner{|{#1}\\rangle}");m("\\braket","\\mathinner{\\langle{#1}\\rangle}");m("\\Bra","\\left\\langle#1\\right|");m("\\Ket","\\left|#1\\right\\rangle");var la=r=>e=>{var t=e.consumeArg().tokens,a=e.consumeArg().tokens,n=e.consumeArg().tokens,s=e.consumeArg().tokens,u=e.macros.get("|"),h=e.macros.get("\\|");e.macros.beginGroup();var c=y=>x=>{r&&(x.macros.set("|",u),n.length&&x.macros.set("\\|",h));var w=y;if(!y&&n.length){var z=x.future();z.text==="|"&&(x.popToken(),w=!0)}return{tokens:w?n:a,numArgs:0}};e.macros.set("|",c(!1)),n.length&&e.macros.set("\\|",c(!0));var p=e.consumeArg().tokens,g=e.expandTokens([...s,...p,...t]);return e.macros.endGroup(),{tokens:g.reverse(),numArgs:0}};m("\\bra@ket",la(!1));m("\\bra@set",la(!0));m("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");m("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");m("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");m("\\angln","{\\angl n}");m("\\blue","\\textcolor{##6495ed}{#1}");m("\\orange","\\textcolor{##ffa500}{#1}");m("\\pink","\\textcolor{##ff00af}{#1}");m("\\red","\\textcolor{##df0030}{#1}");m("\\green","\\textcolor{##28ae7b}{#1}");m("\\gray","\\textcolor{gray}{#1}");m("\\purple","\\textcolor{##9d38bd}{#1}");m("\\blueA","\\textcolor{##ccfaff}{#1}");m("\\blueB","\\textcolor{##80f6ff}{#1}");m("\\blueC","\\textcolor{##63d9ea}{#1}");m("\\blueD","\\textcolor{##11accd}{#1}");m("\\blueE","\\textcolor{##0c7f99}{#1}");m("\\tealA","\\textcolor{##94fff5}{#1}");m("\\tealB","\\textcolor{##26edd5}{#1}");m("\\tealC","\\textcolor{##01d1c1}{#1}");m("\\tealD","\\textcolor{##01a995}{#1}");m("\\tealE","\\textcolor{##208170}{#1}");m("\\greenA","\\textcolor{##b6ffb0}{#1}");m("\\greenB","\\textcolor{##8af281}{#1}");m("\\greenC","\\textcolor{##74cf70}{#1}");m("\\greenD","\\textcolor{##1fab54}{#1}");m("\\greenE","\\textcolor{##0d923f}{#1}");m("\\goldA","\\textcolor{##ffd0a9}{#1}");m("\\goldB","\\textcolor{##ffbb71}{#1}");m("\\goldC","\\textcolor{##ff9c39}{#1}");m("\\goldD","\\textcolor{##e07d10}{#1}");m("\\goldE","\\textcolor{##a75a05}{#1}");m("\\redA","\\textcolor{##fca9a9}{#1}");m("\\redB","\\textcolor{##ff8482}{#1}");m("\\redC","\\textcolor{##f9685d}{#1}");m("\\redD","\\textcolor{##e84d39}{#1}");m("\\redE","\\textcolor{##bc2612}{#1}");m("\\maroonA","\\textcolor{##ffbde0}{#1}");m("\\maroonB","\\textcolor{##ff92c6}{#1}");m("\\maroonC","\\textcolor{##ed5fa6}{#1}");m("\\maroonD","\\textcolor{##ca337c}{#1}");m("\\maroonE","\\textcolor{##9e034e}{#1}");m("\\purpleA","\\textcolor{##ddd7ff}{#1}");m("\\purpleB","\\textcolor{##c6b9fc}{#1}");m("\\purpleC","\\textcolor{##aa87ff}{#1}");m("\\purpleD","\\textcolor{##7854ab}{#1}");m("\\purpleE","\\textcolor{##543b78}{#1}");m("\\mintA","\\textcolor{##f5f9e8}{#1}");m("\\mintB","\\textcolor{##edf2df}{#1}");m("\\mintC","\\textcolor{##e0e5cc}{#1}");m("\\grayA","\\textcolor{##f6f7f7}{#1}");m("\\grayB","\\textcolor{##f0f1f2}{#1}");m("\\grayC","\\textcolor{##e3e5e6}{#1}");m("\\grayD","\\textcolor{##d6d8da}{#1}");m("\\grayE","\\textcolor{##babec2}{#1}");m("\\grayF","\\textcolor{##888d93}{#1}");m("\\grayG","\\textcolor{##626569}{#1}");m("\\grayH","\\textcolor{##3b3e40}{#1}");m("\\grayI","\\textcolor{##21242c}{#1}");m("\\kaBlue","\\textcolor{##314453}{#1}");m("\\kaGreen","\\textcolor{##71B307}{#1}");var ua={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class l4{constructor(e,t,a){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new i4(s4,t.macros),this.mode=a,this.stack=[]}feed(e){this.lexer=new mr(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,a,n;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:n,end:a}=this.consumeArg(["]"])}else({tokens:n,start:t,end:a}=this.consumeArg());return this.pushToken(new m0("EOF",a.loc)),this.pushTokens(n),new m0("",u0.range(t,a))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var t=[],a=e&&e.length>0;a||this.consumeSpaces();var n=this.future(),s,u=0,h=0;do{if(s=this.popToken(),t.push(s),s.text==="{")++u;else if(s.text==="}"){if(--u,u===-1)throw new M("Extra }",s)}else if(s.text==="EOF")throw new M("Unexpected end of input in a macro argument, expected '"+(e&&a?e[h]:"}")+"'",s);if(e&&a)if((u===0||u===1&&e[h]==="{")&&s.text===e[h]){if(++h,h===e.length){t.splice(-h,h);break}}else h=0}while(u!==0||a);return n.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:n,end:s}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new M("The length of delimiters doesn't match the number of args!");for(var a=t[0],n=0;nthis.settings.maxExpand)throw new M("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),a=t.text,n=t.noexpand?null:this._getExpansion(a);if(n==null||e&&n.unexpandable){if(e&&n==null&&a[0]==="\\"&&!this.isDefined(a))throw new M("Undefined control sequence: "+a);return this.pushToken(t),!1}this.countExpansion(1);var s=n.tokens,u=this.consumeArgs(n.numArgs,n.delimiters);if(n.numArgs){s=s.slice();for(var h=s.length-1;h>=0;--h){var c=s[h];if(c.text==="#"){if(h===0)throw new M("Incomplete placeholder at end of macro body",c);if(c=s[--h],c.text==="#")s.splice(h+1,1);else if(/^[1-9]$/.test(c.text))s.splice(h,2,...u[+c.text-1]);else throw new M("Not a valid argument number",c)}}}return this.pushTokens(s),s.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new m0(e)]):void 0}expandTokens(e){var t=[],a=this.stack.length;for(this.pushTokens(e);this.stack.length>a;)if(this.expandOnce(!0)===!1){var n=this.stack.pop();n.treatAsRelax&&(n.noexpand=!1,n.treatAsRelax=!1),t.push(n)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(a=>a.text).join("")}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var a=this.lexer.catcodes[e];if(a!=null&&a!==13)return}var n=typeof t=="function"?t(this):t;if(typeof n=="string"){var s=0;if(n.indexOf("#")!==-1)for(var u=n.replace(/##/g,"");u.indexOf("#"+(s+1))!==-1;)++s;for(var h=new mr(n,this.settings),c=[],p=h.lex();p.text!=="EOF";)c.push(p),p=h.lex();c.reverse();var g={tokens:c,numArgs:s};return g}return n}isDefined(e){return this.macros.has(e)||L0.hasOwnProperty(e)||$.math.hasOwnProperty(e)||$.text.hasOwnProperty(e)||ua.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:L0.hasOwnProperty(e)&&!L0[e].primitive}}var fr=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Me=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),at={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},pr={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class He{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new l4(e,t,this.mode),this.settings=t,this.leftrightDepth=0}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new M("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new m0("}")),this.gullet.pushTokens(e);var a=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,a}parseExpression(e,t){for(var a=[];;){this.mode==="math"&&this.consumeSpaces();var n=this.fetch();if(He.endOfExpression.indexOf(n.text)!==-1||t&&n.text===t||e&&L0[n.text]&&L0[n.text].infix)break;var s=this.parseAtom(t);if(s){if(s.type==="internal")continue}else break;a.push(s)}return this.mode==="text"&&this.formLigatures(a),this.handleInfixNodes(a)}handleInfixNodes(e){for(var t=-1,a,n=0;n=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var h=$[this.mode][t].group,c=u0.range(e),p;if(Za.hasOwnProperty(h)){var g=h;p={type:"atom",mode:this.mode,family:g,loc:c,text:t}}else p={type:h,mode:this.mode,loc:c,text:t};u=p}else if(t.charCodeAt(0)>=128)this.settings.strict&&(gr(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),e)),u={type:"textord",mode:"text",loc:u0.range(e),text:t};else return null;if(this.consume(),s)for(var y=0;y;uniform delta: vec2f;varying sampleCenter: vec2f; +#ifdef DOF +var circleOfConfusionSamplerSampler: sampler;var circleOfConfusionSampler: texture_2d;fn sampleCoC(offset: vec2f)->f32 {var coc: f32=textureSample(circleOfConfusionSampler,circleOfConfusionSamplerSampler,offset).r;return coc; } +#endif +#include[0..varyingCount] +#ifdef PACKEDFLOAT +#include +#endif +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var computedWeight: f32=0.0; +#ifdef PACKEDFLOAT +var blend: f32=0.; +#else +var blend: vec4f= vec4f(0.); +#endif +#ifdef DOF +var sumOfWeights: f32=CENTER_WEIGHT; +var factor: f32=0.0; +#ifdef PACKEDFLOAT +blend+=unpack(textureSample(textureSampler,textureSamplerSampler,input.sampleCenter))*CENTER_WEIGHT; +#else +blend+=textureSample(textureSampler,textureSamplerSampler,input.sampleCenter)*CENTER_WEIGHT; +#endif +#endif +#include[0..varyingCount] +#include[0..depCount] +#ifdef PACKEDFLOAT +fragmentOutputs.color=pack(blend); +#else +fragmentOutputs.color=blend; +#endif +#ifdef DOF +fragmentOutputs.color/=sumOfWeights; +#endif +}`;e.ShadersStoreWGSL[r]||(e.ShadersStoreWGSL[r]=n);const i={name:r,shader:n};export{i as kernelBlurPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlur.fragment-Ur-RzLkw.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlur.fragment-Ur-RzLkw.js new file mode 100644 index 0000000000000000000000000000000000000000..4a64dd433d30df6579fb78c0bf77257522a1f96c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlur.fragment-Ur-RzLkw.js @@ -0,0 +1,57 @@ +import{S as e}from"./index-CDrXokXW.js";import"./kernelBlurVaryingDeclaration-CscI0tkK.js";import"./packingFunctions-BPfzqklr.js";import"./index-DWyDLubb.js";const r="kernelBlurFragment",o=`#ifdef DOF +factor=sampleCoC(sampleCoord{X}); +computedWeight=KERNEL_WEIGHT{X}*factor;sumOfWeights+=computedWeight; +#else +computedWeight=KERNEL_WEIGHT{X}; +#endif +#ifdef PACKEDFLOAT +blend+=unpack(texture2D(textureSampler,sampleCoord{X}))*computedWeight; +#else +blend+=texture2D(textureSampler,sampleCoord{X})*computedWeight; +#endif +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=o);const l="kernelBlurFragment2",d=`#ifdef DOF +factor=sampleCoC(sampleCenter+delta*KERNEL_DEP_OFFSET{X});computedWeight=KERNEL_DEP_WEIGHT{X}*factor;sumOfWeights+=computedWeight; +#else +computedWeight=KERNEL_DEP_WEIGHT{X}; +#endif +#ifdef PACKEDFLOAT +blend+=unpack(texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X}))*computedWeight; +#else +blend+=texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X})*computedWeight; +#endif +`;e.IncludesShadersStore[l]||(e.IncludesShadersStore[l]=d);const t="kernelBlurPixelShader",n=`uniform sampler2D textureSampler;uniform vec2 delta;varying vec2 sampleCenter; +#ifdef DOF +uniform sampler2D circleOfConfusionSampler;float sampleCoC(in vec2 offset) {float coc=texture2D(circleOfConfusionSampler,offset).r;return coc; } +#endif +#include[0..varyingCount] +#ifdef PACKEDFLOAT +#include +#endif +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) +{float computedWeight=0.0; +#ifdef PACKEDFLOAT +float blend=0.; +#else +vec4 blend=vec4(0.); +#endif +#ifdef DOF +float sumOfWeights=CENTER_WEIGHT; +float factor=0.0; +#ifdef PACKEDFLOAT +blend+=unpack(texture2D(textureSampler,sampleCenter))*CENTER_WEIGHT; +#else +blend+=texture2D(textureSampler,sampleCenter)*CENTER_WEIGHT; +#endif +#endif +#include[0..varyingCount] +#include[0..depCount] +#ifdef PACKEDFLOAT +gl_FragColor=pack(blend); +#else +gl_FragColor=blend; +#endif +#ifdef DOF +gl_FragColor/=sumOfWeights; +#endif +}`;e.ShadersStore[t]||(e.ShadersStore[t]=n);const s={name:t,shader:n};export{s as kernelBlurPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlur.vertex-DPmcm8PU.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlur.vertex-DPmcm8PU.js new file mode 100644 index 0000000000000000000000000000000000000000..9b577d1cbc588a43f17b2889129f1a2c0bb54139 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlur.vertex-DPmcm8PU.js @@ -0,0 +1,11 @@ +import{S as e}from"./index-CDrXokXW.js";import"./kernelBlurVaryingDeclaration-CscI0tkK.js";import"./index-DWyDLubb.js";const n="kernelBlurVertex",o="sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};";e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=o);const r="kernelBlurVertexShader",t=`attribute vec2 position;uniform vec2 delta;varying vec2 sampleCenter; +#include[0..varyingCount] +const vec2 madd=vec2(0.5,0.5); +#define CUSTOM_VERTEX_DEFINITIONS +void main(void) { +#define CUSTOM_VERTEX_MAIN_BEGIN +sampleCenter=(position*madd+madd); +#include[0..varyingCount] +gl_Position=vec4(position,0.0,1.0); +#define CUSTOM_VERTEX_MAIN_END +}`;e.ShadersStore[r]||(e.ShadersStore[r]=t);const s={name:r,shader:t};export{s as kernelBlurVertexShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlur.vertex-pWey8ouW.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlur.vertex-pWey8ouW.js new file mode 100644 index 0000000000000000000000000000000000000000..55b6047c6d0d844224ac95c5f1194d66d4a5e8fc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlur.vertex-pWey8ouW.js @@ -0,0 +1,11 @@ +import{S as e}from"./index-CDrXokXW.js";import"./kernelBlurVaryingDeclaration-BQ29TGU2.js";import"./index-DWyDLubb.js";const r="kernelBlurVertex",o="vertexOutputs.sampleCoord{X}=vertexOutputs.sampleCenter+uniforms.delta*KERNEL_OFFSET{X};";e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=o);const t="kernelBlurVertexShader",n=`attribute position: vec2f;uniform delta: vec2f;varying sampleCenter: vec2f; +#include[0..varyingCount] +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs {const madd: vec2f= vec2f(0.5,0.5); +#define CUSTOM_VERTEX_MAIN_BEGIN +vertexOutputs.sampleCenter=(input.position*madd+madd); +#include[0..varyingCount] +vertexOutputs.position= vec4f(input.position,0.0,1.0); +#define CUSTOM_VERTEX_MAIN_END +}`;e.ShadersStoreWGSL[t]||(e.ShadersStoreWGSL[t]=n);const u={name:t,shader:n};export{u as kernelBlurVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlurVaryingDeclaration-BQ29TGU2.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlurVaryingDeclaration-BQ29TGU2.js new file mode 100644 index 0000000000000000000000000000000000000000..f1b58fdc6ea7dd9350a1bc604d458a0536115201 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlurVaryingDeclaration-BQ29TGU2.js @@ -0,0 +1 @@ +import{S as e}from"./index-CDrXokXW.js";const r="kernelBlurVaryingDeclaration",a="varying sampleCoord{X}: vec2f;";e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=a); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlurVaryingDeclaration-CscI0tkK.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlurVaryingDeclaration-CscI0tkK.js new file mode 100644 index 0000000000000000000000000000000000000000..bf67db90c8f3f347226a4b5be074fd4eb8fc8910 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/kernelBlurVaryingDeclaration-CscI0tkK.js @@ -0,0 +1 @@ +import{S as e}from"./index-CDrXokXW.js";const r="kernelBlurVaryingDeclaration",a="varying vec2 sampleCoord{X};";e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=a); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/key-Xd_8JrI4.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/key-Xd_8JrI4.js new file mode 100644 index 0000000000000000000000000000000000000000..65164d049012634ff4351d7b4b08fc4830f34049 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/key-Xd_8JrI4.js @@ -0,0 +1 @@ +import{p as t,a9 as i,h as c,e as f}from"./index-DWyDLubb.js";import{B as y}from"./i18n-Dnhn5Rxr.js";function k(e,r,n){c&&f();var s=new y(e),o=!i();t(()=>{var a=r();o&&a!==null&&typeof a=="object"&&(a={}),s.ensure(a,n)})}export{k}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ko-olQgpapS.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ko-olQgpapS.js new file mode 100644 index 0000000000000000000000000000000000000000..9b87cc98511e09b5530215cf3845e07caf68e1b8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ko-olQgpapS.js @@ -0,0 +1 @@ +const S="한국어",o={annotated_image:"주석이 달린 이미지"},e={allow_recording_access:"녹음을 위해 마이크 접근을 허용해 주세요.",audio:"오디오",record_from_microphone:"마이크로 녹음",stop_recording:"녹음 중지",no_device_support:"미디어 장치에 접근할 수 없습니다. 보안 소스(https) 또는 localhost에서 실행 중인지(또는 ssl_verify에 유효한 SSL 인증서를 전달했는지), 브라우저에 장치 접근 권한을 부여했는지 확인하세요.",stop:"중지",resume:"재개",record:"녹음",no_microphone:"마이크를 찾을 수 없습니다",pause:"일시정지",play:"재생",waiting:"대기 중",drop_to_upload:"오디오 파일을 여기에 놓아 업로드하세요."},r={connection_can_break:"모바일에서는 이 탭이 포커스를 잃거나 기기가 절전 모드로 전환되면 연결이 끊어져 대기열의 위치를 잃을 수 있습니다.",long_requests_queue:"대기 중인 요청의 긴 대기열이 있습니다. 이 Space를 복제하여 건너뛰세요.",lost_connection:"페이지를 떠나 연결이 끊어졌습니다. 대기열로 돌아가는 중...",waiting_for_inputs:"파일 업로드가 완료될 때까지 기다렸다가 다시 시도해주세요."},t={checkbox:"체크박스",checkbox_group:"체크박스 그룹"},_={code:"코드"},c={color_picker:"색상 선택기"},a={built_with:"로 제작됨",built_with_gradio:"Gradio로 제작됨",clear:"지우기",download:"다운로드",edit:"편집",empty:"비어 있음",error:"오류",hosted_on:"에서 호스팅됨",loading:"로딩 중",logo:"로고",or:"또는",remove:"제거",settings:"설정",share:"공유",submit:"제출",undo:"실행 취소",no_devices:"장치를 찾을 수 없습니다",language:"언어",display_theme:"디스플레이 테마",pwa:"프로그레시브 웹 앱"},n={incorrect_format:"잘못된 형식입니다. CSV 및 TSV 파일만 지원됩니다",new_column:"열 추가",new_row:"새 행",add_row_above:"위에 행 추가",add_row_below:"아래에 행 추가",add_column_left:"왼쪽에 열 추가",add_column_right:"오른쪽에 열 추가",delete_row:"행 삭제",delete_column:"열 삭제",sort_column:"정렬 열",sort_ascending:"오름차순 정렬",sort_descending:"내림차순 정렬",drop_to_upload:"CSV 또는 TSV 파일을 여기에 끌어다 놓아 데이터프레임에 데이터를 가져올 수 있습니다.",clear_sort:"정렬 해제"},s={dropdown:"드롭다운"},d={build_error:"빌드 오류가 있습니다",config_error:"구성 오류가 있습니다",contact_page_author:"페이지 작성자에게 연락하여 알려주세요.",no_app_file:"앱 파일이 없습니다",runtime_error:"런타임 오류가 있습니다",space_not_working:'"Space가 작동하지 않는 이유:" {0}',space_paused:"space가 일시 중지되었습니다",use_via_api:"API를 통해 사용",use_via_api_or_mcp:"API 또는 MCP를 통해 사용"},i={uploading:"업로드 중..."},l={highlighted_text:"강조 표시된 텍스트"},p={allow_webcam_access:"녹화를 위해 웹캠 접근을 허용해 주세요.",brush_color:"브러시 색상",brush_radius:"브러시 크기",image:"이미지",remove_image:"이미지 제거",select_brush_color:"브러시 색상 선택",start_drawing:"그리기 시작",use_brush:"브러시 사용",drop_to_upload:"이곳에 이미지 파일을 끌어다 놓으세요."},u={label:"레이블"},g={enable_cookies:"시크릿 모드에서 HuggingFace Space를 방문하는 경우 타사 쿠키를 활성화해야 합니다.",incorrect_credentials:"잘못된 자격 증명",username:"사용자 이름",password:"비밀번호",login:"로그인"},m={number:"숫자"},b={plot:"플롯"},h={radio:"라디오"},w={slider:"슬라이더"},k={click_to_upload:"클릭하여 업로드",drop_audio:"오디오를 여기에 드롭",drop_csv:"CSV를 여기에 드롭",drop_file:"파일을 여기에 드롭",drop_image:"이미지를 여기에 드롭",drop_video:"비디오를 여기에 드롭",drop_gallery:"미디어를 여기에 드롭",paste_clipboard:"클립보드에서 붙여넣기"},f={drop_to_upload:"여기에 비디오 파일을 끌어다 놓으세요."},v={edit:"편집",retry:"다시 시도",undo:"실행 취소",submit:"제출",cancel:"취소",like:"좋아요",dislike:"싫어요",clear:"대화 지우기"},x={_name:"한국어","3D_model":{"3d_model":"3D 모델",drop_to_upload:"3D 모델 (.obj, .glb, .stl, .gltf, .splat, 또는 .ply) 파일을 여기에 놓아 업로드하세요."},annotated_image:o,audio:e,blocks:r,checkbox:t,code:_,color_picker:c,common:a,dataframe:n,dropdown:s,errors:d,file:i,highlighted_text:l,image:p,label:u,login:g,number:m,plot:b,radio:h,slider:w,upload_text:k,video:f,chatbot:v};export{S as _name,o as annotated_image,e as audio,r as blocks,v as chatbot,t as checkbox,_ as code,c as color_picker,a as common,n as dataframe,x as default,s as dropdown,d as errors,i as file,l as highlighted_text,p as image,u as label,g as login,m as number,b as plot,h as radio,w as slider,k as upload_text,f as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ktxTextureLoader-DMjs-eqh.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ktxTextureLoader-DMjs-eqh.js new file mode 100644 index 0000000000000000000000000000000000000000..0b7a653f7a2db09bcea36293f6c88d2fb1a25c5e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ktxTextureLoader-DMjs-eqh.js @@ -0,0 +1 @@ +import{L as n,d as _}from"./index-CDrXokXW.js";import{A as u}from"./workerPool-CfMXSLnf.js";import"./index-DWyDLubb.js";class d{constructor(s,e){if(this.data=s,this.isInvalid=!1,!d.IsValid(s)){this.isInvalid=!0,n.Error("texture missing KTX identifier");return}const i=Uint32Array.BYTES_PER_ELEMENT,r=new DataView(this.data.buffer,this.data.byteOffset+12,13*i),a=r.getUint32(0,!0)===67305985;if(this.glType=r.getUint32(1*i,a),this.glTypeSize=r.getUint32(2*i,a),this.glFormat=r.getUint32(3*i,a),this.glInternalFormat=r.getUint32(4*i,a),this.glBaseInternalFormat=r.getUint32(5*i,a),this.pixelWidth=r.getUint32(6*i,a),this.pixelHeight=r.getUint32(7*i,a),this.pixelDepth=r.getUint32(8*i,a),this.numberOfArrayElements=r.getUint32(9*i,a),this.numberOfFaces=r.getUint32(10*i,a),this.numberOfMipmapLevels=r.getUint32(11*i,a),this.bytesOfKeyValueData=r.getUint32(12*i,a),this.glType!==0){n.Error("only compressed formats currently supported"),this.isInvalid=!0;return}else this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels);if(this.pixelHeight===0||this.pixelDepth!==0){n.Error("only 2D textures currently supported"),this.isInvalid=!0;return}if(this.numberOfArrayElements!==0){n.Error("texture arrays not currently supported"),this.isInvalid=!0;return}if(this.numberOfFaces!==e){n.Error("number of faces expected"+e+", but found "+this.numberOfFaces),this.isInvalid=!0;return}this.loadType=d.COMPRESSED_2D}uploadLevels(s,e){this.loadType===d.COMPRESSED_2D&&this._upload2DCompressedLevels(s,e)}_upload2DCompressedLevels(s,e){let i=d.HEADER_LEN+this.bytesOfKeyValueData,r=this.pixelWidth,c=this.pixelHeight;const a=e?this.numberOfMipmapLevels:1;for(let f=0;f=12){const e=new Uint8Array(s.buffer,s.byteOffset,12);if(e[0]===171&&e[1]===75&&e[2]===84&&e[3]===88&&e[4]===32&&e[5]===49&&e[6]===49&&e[7]===187&&e[8]===13&&e[9]===10&&e[10]===26&&e[11]===10)return!0}return!1}}d.HEADER_LEN=64;d.COMPRESSED_2D=0;d.COMPRESSED_3D=1;d.TEX_2D=2;d.TEX_3D=3;var h;(function(t){t[t.ETC1S=0]="ETC1S",t[t.UASTC4x4=1]="UASTC4x4"})(h||(h={}));var m;(function(t){t[t.ASTC_4X4_RGBA=0]="ASTC_4X4_RGBA",t[t.ASTC_4x4_RGBA=0]="ASTC_4x4_RGBA",t[t.BC7_RGBA=1]="BC7_RGBA",t[t.BC3_RGBA=2]="BC3_RGBA",t[t.BC1_RGB=3]="BC1_RGB",t[t.PVRTC1_4_RGBA=4]="PVRTC1_4_RGBA",t[t.PVRTC1_4_RGB=5]="PVRTC1_4_RGB",t[t.ETC2_RGBA=6]="ETC2_RGBA",t[t.ETC1_RGB=7]="ETC1_RGB",t[t.RGBA32=8]="RGBA32",t[t.R8=9]="R8",t[t.RG8=10]="RG8"})(m||(m={}));var U;(function(t){t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGBA_ASTC_4X4_KHR=37808]="COMPRESSED_RGBA_ASTC_4X4_KHR",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.RGBA8Format=32856]="RGBA8Format",t[t.R8Format=33321]="R8Format",t[t.RG8Format=33323]="RG8Format"})(U||(U={}));function A(t,s){const e=s?.jsDecoderModule||KTX2DECODER;t&&(t.wasmBaseUrl&&(e.Transcoder.WasmBaseUrl=t.wasmBaseUrl),t.wasmUASTCToASTC&&(e.LiteTranscoder_UASTC_ASTC.WasmModuleURL=t.wasmUASTCToASTC),t.wasmUASTCToBC7&&(e.LiteTranscoder_UASTC_BC7.WasmModuleURL=t.wasmUASTCToBC7),t.wasmUASTCToRGBA_UNORM&&(e.LiteTranscoder_UASTC_RGBA_UNORM.WasmModuleURL=t.wasmUASTCToRGBA_UNORM),t.wasmUASTCToRGBA_SRGB&&(e.LiteTranscoder_UASTC_RGBA_SRGB.WasmModuleURL=t.wasmUASTCToRGBA_SRGB),t.wasmUASTCToR8_UNORM&&(e.LiteTranscoder_UASTC_R8_UNORM.WasmModuleURL=t.wasmUASTCToR8_UNORM),t.wasmUASTCToRG8_UNORM&&(e.LiteTranscoder_UASTC_RG8_UNORM.WasmModuleURL=t.wasmUASTCToRG8_UNORM),t.jsMSCTranscoder&&(e.MSCTranscoder.JSModuleURL=t.jsMSCTranscoder),t.wasmMSCTranscoder&&(e.MSCTranscoder.WasmModuleURL=t.wasmMSCTranscoder),t.wasmZSTDDecoder&&(e.ZSTDDecoder.WasmModuleURL=t.wasmZSTDDecoder)),s&&(s.wasmUASTCToASTC&&(e.LiteTranscoder_UASTC_ASTC.WasmBinary=s.wasmUASTCToASTC),s.wasmUASTCToBC7&&(e.LiteTranscoder_UASTC_BC7.WasmBinary=s.wasmUASTCToBC7),s.wasmUASTCToRGBA_UNORM&&(e.LiteTranscoder_UASTC_RGBA_UNORM.WasmBinary=s.wasmUASTCToRGBA_UNORM),s.wasmUASTCToRGBA_SRGB&&(e.LiteTranscoder_UASTC_RGBA_SRGB.WasmBinary=s.wasmUASTCToRGBA_SRGB),s.wasmUASTCToR8_UNORM&&(e.LiteTranscoder_UASTC_R8_UNORM.WasmBinary=s.wasmUASTCToR8_UNORM),s.wasmUASTCToRG8_UNORM&&(e.LiteTranscoder_UASTC_RG8_UNORM.WasmBinary=s.wasmUASTCToRG8_UNORM),s.jsMSCTranscoder&&(e.MSCTranscoder.JSModule=s.jsMSCTranscoder),s.wasmMSCTranscoder&&(e.MSCTranscoder.WasmBinary=s.wasmMSCTranscoder),s.wasmZSTDDecoder&&(e.ZSTDDecoder.WasmBinary=s.wasmZSTDDecoder))}function G(t){typeof t>"u"&&typeof KTX2DECODER<"u"&&(t=KTX2DECODER);let s;onmessage=e=>{if(e.data)switch(e.data.action){case"init":{const i=e.data.urls;i&&(i.jsDecoderModule&&typeof t>"u"&&(importScripts(i.jsDecoderModule),t=KTX2DECODER),A(i)),e.data.wasmBinaries&&A(void 0,{...e.data.wasmBinaries,jsDecoderModule:t}),s=new t.KTX2Decoder,postMessage({action:"init"});break}case"setDefaultDecoderOptions":{t.KTX2Decoder.DefaultDecoderOptions=e.data.options;break}case"decode":s.decode(e.data.data,e.data.caps,e.data.options).then(i=>{const r=[];for(let c=0;c{postMessage({action:"decoded",success:!1,msg:i})});break}}}async function M(t,s,e){return await new Promise((i,r)=>{const c=f=>{t.removeEventListener("error",c),t.removeEventListener("message",a),r(f)},a=f=>{f.data.action==="init"&&(t.removeEventListener("error",c),t.removeEventListener("message",a),i(t))};t.addEventListener("error",c),t.addEventListener("message",a),t.postMessage({action:"init",urls:e,wasmBinaries:s})})}class y{constructor(){this._isDirty=!0,this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC=!0,this._ktx2DecoderOptions={}}get isDirty(){return this._isDirty}get useRGBAIfASTCBC7NotAvailableWhenUASTC(){return this._useRGBAIfASTCBC7NotAvailableWhenUASTC}set useRGBAIfASTCBC7NotAvailableWhenUASTC(s){this._useRGBAIfASTCBC7NotAvailableWhenUASTC!==s&&(this._useRGBAIfASTCBC7NotAvailableWhenUASTC=s,this._isDirty=!0)}get useRGBAIfOnlyBC1BC3AvailableWhenUASTC(){return this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC}set useRGBAIfOnlyBC1BC3AvailableWhenUASTC(s){this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC!==s&&(this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC=s,this._isDirty=!0)}get forceRGBA(){return this._forceRGBA}set forceRGBA(s){this._forceRGBA!==s&&(this._forceRGBA=s,this._isDirty=!0)}get forceR8(){return this._forceR8}set forceR8(s){this._forceR8!==s&&(this._forceR8=s,this._isDirty=!0)}get forceRG8(){return this._forceRG8}set forceRG8(s){this._forceRG8!==s&&(this._forceRG8=s,this._isDirty=!0)}get bypassTranscoders(){return this._bypassTranscoders}set bypassTranscoders(s){this._bypassTranscoders!==s&&(this._bypassTranscoders=s,this._isDirty=!0)}_getKTX2DecoderOptions(){if(!this._isDirty)return this._ktx2DecoderOptions;this._isDirty=!1;const s={};return this._useRGBAIfASTCBC7NotAvailableWhenUASTC!==void 0&&(s.useRGBAIfASTCBC7NotAvailableWhenUASTC=this._useRGBAIfASTCBC7NotAvailableWhenUASTC),this._forceRGBA!==void 0&&(s.forceRGBA=this._forceRGBA),this._forceR8!==void 0&&(s.forceR8=this._forceR8),this._forceRG8!==void 0&&(s.forceRG8=this._forceRG8),this._bypassTranscoders!==void 0&&(s.bypassTranscoders=this._bypassTranscoders),this.useRGBAIfOnlyBC1BC3AvailableWhenUASTC&&(s.transcodeFormatDecisionTree={UASTC:{transcodeFormat:[m.BC1_RGB,m.BC3_RGBA],yes:{transcodeFormat:m.RGBA32,engineFormat:32856,roundToMultiple4:!1}}}),this._ktx2DecoderOptions=s,s}}class o{static GetDefaultNumWorkers(){return typeof navigator!="object"||!navigator.hardwareConcurrency?1:Math.min(Math.floor(navigator.hardwareConcurrency*.5),4)}static _Initialize(s){if(o._WorkerPoolPromise||o._DecoderModulePromise)return;const e={wasmBaseUrl:_.ScriptBaseUrl,jsDecoderModule:_.GetBabylonScriptURL(this.URLConfig.jsDecoderModule,!0),wasmUASTCToASTC:_.GetBabylonScriptURL(this.URLConfig.wasmUASTCToASTC,!0),wasmUASTCToBC7:_.GetBabylonScriptURL(this.URLConfig.wasmUASTCToBC7,!0),wasmUASTCToRGBA_UNORM:_.GetBabylonScriptURL(this.URLConfig.wasmUASTCToRGBA_UNORM,!0),wasmUASTCToRGBA_SRGB:_.GetBabylonScriptURL(this.URLConfig.wasmUASTCToRGBA_SRGB,!0),wasmUASTCToR8_UNORM:_.GetBabylonScriptURL(this.URLConfig.wasmUASTCToR8_UNORM,!0),wasmUASTCToRG8_UNORM:_.GetBabylonScriptURL(this.URLConfig.wasmUASTCToRG8_UNORM,!0),jsMSCTranscoder:_.GetBabylonScriptURL(this.URLConfig.jsMSCTranscoder,!0),wasmMSCTranscoder:_.GetBabylonScriptURL(this.URLConfig.wasmMSCTranscoder,!0),wasmZSTDDecoder:_.GetBabylonScriptURL(this.URLConfig.wasmZSTDDecoder,!0)};s&&typeof Worker=="function"&&typeof URL<"u"?o._WorkerPoolPromise=new Promise(i=>{const r=`${A}(${G})()`,c=URL.createObjectURL(new Blob([r],{type:"application/javascript"}));i(new u(s,async()=>await M(new Worker(c),void 0,e)))}):typeof o._KTX2DecoderModule>"u"?o._DecoderModulePromise=_.LoadBabylonScriptAsync(e.jsDecoderModule).then(()=>(o._KTX2DecoderModule=KTX2DECODER,o._KTX2DecoderModule.MSCTranscoder.UseFromWorkerThread=!1,o._KTX2DecoderModule.WASMMemoryManager.LoadBinariesFromCurrentThread=!0,A(e,o._KTX2DecoderModule),new o._KTX2DecoderModule.KTX2Decoder)):(o._KTX2DecoderModule.MSCTranscoder.UseFromWorkerThread=!1,o._KTX2DecoderModule.WASMMemoryManager.LoadBinariesFromCurrentThread=!0,o._DecoderModulePromise=Promise.resolve(new o._KTX2DecoderModule.KTX2Decoder))}constructor(s,e=o.DefaultNumWorkers){this._engine=s;const i=typeof e=="object"&&e.workerPool||o.WorkerPool;if(i)o._WorkerPoolPromise=Promise.resolve(i);else{typeof e=="object"?o._KTX2DecoderModule=e?.binariesAndModulesContainer?.jsDecoderModule:typeof KTX2DECODER<"u"&&(o._KTX2DecoderModule=KTX2DECODER);const r=typeof e=="number"?e:e.numWorkers??o.DefaultNumWorkers;o._Initialize(r)}}async _uploadAsync(s,e,i){const r=this._engine.getCaps(),c={astc:!!r.astc,bptc:!!r.bptc,s3tc:!!r.s3tc,pvrtc:!!r.pvrtc,etc2:!!r.etc2,etc1:!!r.etc1};if(o._WorkerPoolPromise){const a=await o._WorkerPoolPromise;return await new Promise((f,l)=>{a.push((R,T)=>{const C=S=>{R.removeEventListener("error",C),R.removeEventListener("message",p),l(S),T()},p=S=>{if(S.data.action==="decoded"){if(R.removeEventListener("error",C),R.removeEventListener("message",p),!S.data.success)l({message:S.data.msg});else try{this._createTexture(S.data.decodedData,e,i),f()}catch(D){l({message:D})}T()}};R.addEventListener("error",C),R.addEventListener("message",p),R.postMessage({action:"setDefaultDecoderOptions",options:o.DefaultDecoderOptions._getKTX2DecoderOptions()});const B=new Uint8Array(s.byteLength);B.set(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)),R.postMessage({action:"decode",data:B,caps:c,options:i},[B.buffer])})})}else if(o._DecoderModulePromise){const a=await o._DecoderModulePromise;return o.DefaultDecoderOptions.isDirty&&(o._KTX2DecoderModule.KTX2Decoder.DefaultDecoderOptions=o.DefaultDecoderOptions._getKTX2DecoderOptions()),await new Promise((f,l)=>{a.decode(s,r).then(R=>{this._createTexture(R,e),f()}).catch(R=>{l({message:R})})})}throw new Error("KTX2 decoder module is not available")}_createTexture(s,e,i){this._engine._bindTextureDirectly(3553,e),i&&(i.transcodedFormat=s.transcodedFormat,i.isInGammaSpace=s.isInGammaSpace,i.hasAlpha=s.hasAlpha,i.transcoderName=s.transcoderName);let c=!0;switch(s.transcodedFormat){case 32856:e.type=0,e.format=5;break;case 33321:e.type=0,e.format=6;break;case 33323:e.type=0,e.format=7;break;default:e.format=s.transcodedFormat,c=!1;break}if(e._gammaSpace=s.isInGammaSpace,e.generateMipMaps=s.mipmaps.length>1,e.width=s.mipmaps[0].width,e.height=s.mipmaps[0].height,s.errors)throw new Error("KTX2 container - could not transcode the data. "+s.errors);for(let a=0;a=12){const e=new Uint8Array(s.buffer,s.byteOffset,12);if(e[0]===171&&e[1]===75&&e[2]===84&&e[3]===88&&e[4]===32&&e[5]===50&&e[6]===48&&e[7]===187&&e[8]===13&&e[9]===10&&e[10]===26&&e[11]===10)return!0}return!1}}o.URLConfig={jsDecoderModule:"https://cdn.babylonjs.com/babylon.ktx2Decoder.js",wasmUASTCToASTC:null,wasmUASTCToBC7:null,wasmUASTCToRGBA_UNORM:null,wasmUASTCToRGBA_SRGB:null,wasmUASTCToR8_UNORM:null,wasmUASTCToRG8_UNORM:null,jsMSCTranscoder:null,wasmMSCTranscoder:null,wasmZSTDDecoder:null};o.DefaultNumWorkers=o.GetDefaultNumWorkers();o.DefaultDecoderOptions=new y;function w(t){switch(t){case 35916:return 33776;case 35918:return 33778;case 35919:return 33779;case 37493:return 37492;case 37497:return 37496;case 37495:return 37494;case 37840:return 37808;case 36493:return 36492}return null}class L{constructor(){this.supportCascades=!1}loadCubeData(s,e,i,r){if(Array.isArray(s))return;e._invertVScale=!e.invertY;const c=e.getEngine(),a=new d(s,6),f=a.numberOfMipmapLevels>1&&e.generateMipMaps;c._unpackFlipY(!0),a.uploadLevels(e,e.generateMipMaps),e.width=a.pixelWidth,e.height=a.pixelHeight,c._setCubeMapTextureParams(e,f,a.numberOfMipmapLevels-1),e.isReady=!0,e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear(),r&&r()}loadData(s,e,i,r){if(d.IsValid(s)){e._invertVScale=!e.invertY;const c=new d(s,1),a=w(c.glInternalFormat);a?(e.format=a,e._useSRGBBuffer=e.getEngine()._getUseSRGBBuffer(!0,e.generateMipMaps),e._gammaSpace=!0):e.format=c.glInternalFormat,i(c.pixelWidth,c.pixelHeight,e.generateMipMaps,!0,()=>{c.uploadLevels(e,e.generateMipMaps)},c.isInvalid)}else o.IsValid(s)?new o(e.getEngine())._uploadAsync(s,e,r).then(()=>{i(e.width,e.height,e.generateMipMaps,!0,()=>{},!1)},a=>{n.Warn(`Failed to load KTX2 texture data: ${a.message}`),i(0,0,!1,!1,()=>{},!0)}):(n.Error("texture missing KTX identifier"),i(0,0,!1,!1,()=>{},!0))}}export{L as _KTXTextureLoader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/layout-BrVEphHT.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/layout-BrVEphHT.js new file mode 100644 index 0000000000000000000000000000000000000000..0d736e3b751e66641d1a791dc9e8abfdae3afb6d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/layout-BrVEphHT.js @@ -0,0 +1 @@ +import{b as Ge,G as g,i as m,v as E}from"./graph-BVwx8Qtr.js";import{i as z,c as C,k as Ye,o as $e,p as ve,q as pe,t as De,u as we,v as qe,w as be,d as G,x as We,b as ze,y as Xe,n as f,m as I,r as B}from"./_baseUniq-DT1kfcxk.js";import{f as O,b as me,a as He,c as Ue,m as w,d as P}from"./min-ljrXhbfm.js";import{aD as M,b0 as Je,b1 as Ke,aK as ge,b2 as S,au as ye,aV as Ze,am as Qe,a_ as en,b3 as nn,ao as xe,aZ as rn,aJ as Ee,an as ke,aB as tn,aM as an,b4 as X}from"./mermaid.core-7TB2QPZo.js";var on=/\s/;function un(e){for(var n=e.length;n--&&on.test(e.charAt(n)););return n}var dn=/^\s+/;function sn(e){return e&&e.slice(0,un(e)+1).replace(dn,"")}var re=NaN,fn=/^[-+]0x[0-9a-f]+$/i,cn=/^0b[01]+$/i,ln=/^0o[0-7]+$/i,hn=parseInt;function vn(e){if(typeof e=="number")return e;if(z(e))return re;if(M(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=M(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=sn(e);var r=cn.test(e);return r||ln.test(e)?hn(e.slice(2),r?2:8):fn.test(e)?re:+e}var te=1/0,pn=17976931348623157e292;function T(e){if(!e)return e===0?e:0;if(e=vn(e),e===te||e===-te){var n=e<0?-1:1;return n*pn}return e===e?e:0}function wn(e){var n=T(e),r=n%1;return n===n?r?n-r:n:0}function bn(e){return Je(Ke(e,void 0,O),e+"")}var mn=1,gn=4;function yn(e){return Ge(e,mn|gn)}var Oe=Object.prototype,xn=Oe.hasOwnProperty,En=ge(function(e,n){e=Object(e);var r=-1,t=n.length,i=t>2?n[2]:void 0;for(i&&S(n[0],n[1],i)&&(t=1);++r-1?i[o?n[a]:a]:void 0}}var On=Math.max;function Nn(e,n,r){var t=e==null?0:e.length;if(!t)return-1;var i=r==null?0:wn(r);return i<0&&(i=On(t+i,0)),$e(e,C(n),i)}var U=kn(Nn);function Ln(e,n){return e==null?e:en(e,ve(n),ye)}function Pn(e,n){return e&&pe(e,ve(n))}function _n(e,n){return e>n}var Cn=Object.prototype,In=Cn.hasOwnProperty;function Rn(e,n){return e!=null&&In.call(e,n)}function Ne(e,n){return e!=null&&De(e,n,Rn)}function j(e,n){var r={};return n=C(n),pe(e,function(t,i,o){nn(r,i,n(t,i,o))}),r}function y(e){return e&&e.length?me(e,xe,_n):void 0}function J(e,n){return e&&e.length?me(e,C(n),He):void 0}function Tn(e,n,r,t){if(!M(e))return e;n=we(n,e);for(var i=-1,o=n.length,a=o-1,u=e;u!=null&&++in||o&&a&&d&&!u&&!s||t&&a&&d||!r&&d||!i)return 1;if(!t&&!o&&!s&&e=u)return d;var s=r[t];return d*(s=="desc"?-1:1)}}return e.index-n.index}function Bn(e,n,r){n.length?n=G(n,function(o){return ke(o)?function(a){return be(a,o.length===1?o[0]:o)}:o}):n=[xe];var t=-1;n=G(n,tn(C));var i=Ue(e,function(o,a,u){var d=G(n,function(s){return s(o)});return{criteria:d,index:++t,value:o}});return Sn(i,function(o,a){return An(o,a,r)})}function jn(e,n){return Mn(e,n,function(r,t){return We(e,t)})}var A=bn(function(e,n){return e==null?{}:jn(e,n)}),Vn=Math.ceil,Gn=Math.max;function Yn(e,n,r,t){for(var i=-1,o=Gn(Vn((n-e)/(r||1)),0),a=Array(o);o--;)a[++i]=e,e+=r;return a}function $n(e){return function(n,r,t){return t&&typeof t!="number"&&S(n,r,t)&&(r=t=void 0),n=T(n),r===void 0?(r=n,n=0):r=T(r),t=t===void 0?n1&&S(e,n[0],n[1])?n=[]:r>2&&S(n[0],n[1],n[2])&&(n=[n[0]]),Bn(e,ze(n),[])}),Dn=0;function K(e){var n=++Dn;return Xe(e)+n}function qn(e,n,r){for(var t=-1,i=e.length,o=n.length,a={};++t0;--u)if(a=n[u].dequeue(),a){t=t.concat(Y(e,n,r,a,!0));break}}}return t}function Y(e,n,r,t,i){var o=i?[]:void 0;return f(e.inEdges(t.v),function(a){var u=e.edge(a),d=e.node(a.v);i&&o.push({v:a.v,w:a.w}),d.out-=u,H(n,r,d)}),f(e.outEdges(t.v),function(a){var u=e.edge(a),d=a.w,s=e.node(d);s.in-=u,H(n,r,s)}),e.removeNode(t.v),o}function Kn(e,n){var r=new g,t=0,i=0;f(e.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),f(e.edges(),function(u){var d=r.edge(u.v,u.w)||0,s=n(u),c=d+s;r.setEdge(u.v,u.w,c),i=Math.max(i,r.node(u.v).out+=s),t=Math.max(t,r.node(u.w).in+=s)});var o=k(i+t+3).map(function(){return new zn}),a=t+1;return f(r.nodes(),function(u){H(o,a,r.node(u))}),{graph:r,buckets:o,zeroIdx:a}}function H(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function Zn(e){var n=e.graph().acyclicer==="greedy"?Un(e,r(e)):Qn(e);f(n,function(t){var i=e.edge(t);e.removeEdge(t),i.forwardName=t.name,i.reversed=!0,e.setEdge(t.w,t.v,i,K("rev"))});function r(t){return function(i){return t.edge(i).weight}}}function Qn(e){var n=[],r={},t={};function i(o){Object.prototype.hasOwnProperty.call(t,o)||(t[o]=!0,r[o]=!0,f(e.outEdges(o),function(a){Object.prototype.hasOwnProperty.call(r,a.w)?n.push(a):i(a.w)}),delete r[o])}return f(e.nodes(),i),n}function er(e){f(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function N(e,n,r,t){var i;do i=K(t);while(e.hasNode(i));return r.dummy=n,e.setNode(i,r),i}function nr(e){var n=new g().setGraph(e.graph());return f(e.nodes(),function(r){n.setNode(r,e.node(r))}),f(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+i.weight,minlen:Math.max(t.minlen,i.minlen)})}),n}function Le(e){var n=new g({multigraph:e.isMultigraph()}).setGraph(e.graph());return f(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),f(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function ae(e,n){var r=e.x,t=e.y,i=n.x-r,o=n.y-t,a=e.width/2,u=e.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var d,s;return Math.abs(o)*a>Math.abs(i)*u?(o<0&&(u=-u),d=u*i/o,s=u):(i<0&&(a=-a),d=a,s=a*o/i),{x:r+d,y:t+s}}function V(e){var n=w(k(Pe(e)+1),function(){return[]});return f(e.nodes(),function(r){var t=e.node(r),i=t.rank;m(i)||(n[i][t.order]=r)}),n}function rr(e){var n=P(w(e.nodes(),function(r){return e.node(r).rank}));f(e.nodes(),function(r){var t=e.node(r);Ne(t,"rank")&&(t.rank-=n)})}function tr(e){var n=P(w(e.nodes(),function(o){return e.node(o).rank})),r=[];f(e.nodes(),function(o){var a=e.node(o).rank-n;r[a]||(r[a]=[]),r[a].push(o)});var t=0,i=e.graph().nodeRankFactor;f(r,function(o,a){m(o)&&a%i!==0?--t:t&&f(o,function(u){e.node(u).rank+=t})})}function oe(e,n,r,t){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=t),N(e,"border",i,n)}function Pe(e){return y(w(e.nodes(),function(n){var r=e.node(n).rank;if(!m(r))return r}))}function ir(e,n){var r={lhs:[],rhs:[]};return f(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function ar(e,n){return n()}function or(e){function n(r){var t=e.children(r),i=e.node(r);if(t.length&&f(t,n),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;oa.lim&&(u=a,d=!0);var s=I(n.edges(),function(c){return d===se(e,e.node(c.v),u)&&d!==se(e,e.node(c.w),u)});return J(s,function(c){return _(n,c)})}function Ae(e,n,r,t){var i=r.v,o=r.w;e.removeEdge(i,o),e.setEdge(t.v,t.w,{}),ee(e),Q(e,n),xr(e,n)}function xr(e,n){var r=U(e.nodes(),function(i){return!n.node(i).parent}),t=gr(e,r);t=t.slice(1),f(t,function(i){var o=e.node(i).parent,a=n.edge(i,o),u=!1;a||(a=n.edge(o,i),u=!0),n.node(i).rank=n.node(o).rank+(u?a.minlen:-a.minlen)})}function Er(e,n,r){return e.hasEdge(n,r)}function se(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function kr(e){switch(e.graph().ranker){case"network-simplex":fe(e);break;case"tight-tree":Nr(e);break;case"longest-path":Or(e);break;default:fe(e)}}var Or=Z;function Nr(e){Z(e),Ce(e)}function fe(e){x(e)}function Lr(e){var n=N(e,"root",{},"_root"),r=Pr(e),t=y(E(r))-1,i=2*t+1;e.graph().nestingRoot=n,f(e.edges(),function(a){e.edge(a).minlen*=i});var o=_r(e)+1;f(e.children(),function(a){Be(e,n,i,o,t,r,a)}),e.graph().nodeRankFactor=i}function Be(e,n,r,t,i,o,a){var u=e.children(a);if(!u.length){a!==n&&e.setEdge(n,a,{weight:0,minlen:r});return}var d=oe(e,"_bt"),s=oe(e,"_bb"),c=e.node(a);e.setParent(d,a),c.borderTop=d,e.setParent(s,a),c.borderBottom=s,f(u,function(l){Be(e,n,r,t,i,o,l);var h=e.node(l),v=h.borderTop?h.borderTop:l,p=h.borderBottom?h.borderBottom:l,b=h.borderTop?t:2*t,L=v!==p?1:i-o[a]+1;e.setEdge(d,v,{weight:b,minlen:L,nestingEdge:!0}),e.setEdge(p,s,{weight:b,minlen:L,nestingEdge:!0})}),e.parent(a)||e.setEdge(n,d,{weight:0,minlen:i+o[a]})}function Pr(e){var n={};function r(t,i){var o=e.children(t);o&&o.length&&f(o,function(a){r(a,i+1)}),n[t]=i}return f(e.children(),function(t){r(t,1)}),n}function _r(e){return B(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function Cr(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,f(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function Ir(e,n,r){var t={},i;f(r,function(o){for(var a=e.parent(o),u,d;a;){if(u=e.parent(a),u?(d=t[u],t[u]=a):(d=i,i=a),d&&d!==a){n.setEdge(d,a);return}a=u}})}function Rr(e,n,r){var t=Tr(e),i=new g({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return e.node(o)});return f(e.nodes(),function(o){var a=e.node(o),u=e.parent(o);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(i.setNode(o),i.setParent(o,u||t),f(e[r](o),function(d){var s=d.v===o?d.w:d.v,c=i.edge(s,o),l=m(c)?0:c.weight;i.setEdge(s,o,{weight:e.edge(d).weight+l})}),Object.prototype.hasOwnProperty.call(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))}),i}function Tr(e){for(var n;e.hasNode(n=K("_root")););return n}function Mr(e,n){for(var r=0,t=1;t0;)c%2&&(l+=u[c+1]),c=c-1>>1,u[c]+=s.weight;d+=s.weight*l})),d}function Fr(e){var n={},r=I(e.nodes(),function(u){return!e.children(u).length}),t=y(w(r,function(u){return e.node(u).rank})),i=w(k(t+1),function(){return[]});function o(u){if(!Ne(n,u)){n[u]=!0;var d=e.node(u);i[d.rank].push(u),f(e.successors(u),o)}}var a=R(r,function(u){return e.node(u).rank});return f(a,o),i}function Ar(e,n){return w(n,function(r){var t=e.inEdges(r);if(t.length){var i=B(t,function(o,a){var u=e.edge(a),d=e.node(a.v);return{sum:o.sum+u.weight*d.order,weight:o.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function Br(e,n){var r={};f(e,function(i,o){var a=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:o};m(i.barycenter)||(a.barycenter=i.barycenter,a.weight=i.weight)}),f(n.edges(),function(i){var o=r[i.v],a=r[i.w];!m(o)&&!m(a)&&(a.indegree++,o.out.push(r[i.w]))});var t=I(r,function(i){return!i.indegree});return jr(t)}function jr(e){var n=[];function r(o){return function(a){a.merged||(m(a.barycenter)||m(o.barycenter)||a.barycenter>=o.barycenter)&&Vr(o,a)}}function t(o){return function(a){a.in.push(o),--a.indegree===0&&e.push(a)}}for(;e.length;){var i=e.pop();n.push(i),f(i.in.reverse(),r(i)),f(i.out,t(i))}return w(I(n,function(o){return!o.merged}),function(o){return A(o,["vs","i","barycenter","weight"])})}function Vr(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function Gr(e,n){var r=ir(e,function(c){return Object.prototype.hasOwnProperty.call(c,"barycenter")}),t=r.lhs,i=R(r.rhs,function(c){return-c.i}),o=[],a=0,u=0,d=0;t.sort(Yr(!!n)),d=ce(o,i,d),f(t,function(c){d+=c.vs.length,o.push(c.vs),a+=c.barycenter*c.weight,u+=c.weight,d=ce(o,i,d)});var s={vs:O(o)};return u&&(s.barycenter=a/u,s.weight=u),s}function ce(e,n,r){for(var t;n.length&&(t=F(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Yr(e){return function(n,r){return n.barycenterr.barycenter?1:e?r.i-n.i:n.i-r.i}}function je(e,n,r,t){var i=e.children(n),o=e.node(n),a=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,d={};a&&(i=I(i,function(p){return p!==a&&p!==u}));var s=Ar(e,i);f(s,function(p){if(e.children(p.v).length){var b=je(e,p.v,r,t);d[p.v]=b,Object.prototype.hasOwnProperty.call(b,"barycenter")&&Dr(p,b)}});var c=Br(s,r);$r(c,d);var l=Gr(c,t);if(a&&(l.vs=O([a,l.vs,u]),e.predecessors(a).length)){var h=e.node(e.predecessors(a)[0]),v=e.node(e.predecessors(u)[0]);Object.prototype.hasOwnProperty.call(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+v.order)/(l.weight+2),l.weight+=2}return l}function $r(e,n){f(e,function(r){r.vs=O(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function Dr(e,n){m(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function qr(e){var n=Pe(e),r=le(e,k(1,n+1),"inEdges"),t=le(e,k(n-1,-1,-1),"outEdges"),i=Fr(e);he(e,i);for(var o=Number.POSITIVE_INFINITY,a,u=0,d=0;d<4;++u,++d){Wr(u%2?r:t,u%4>=2),i=V(e);var s=Mr(e,i);sa||u>n[d].lim));for(s=d,d=t;(d=e.parent(d))!==s;)o.push(d);return{path:i.concat(o.reverse()),lca:s}}function Hr(e){var n={},r=0;function t(i){var o=r;f(e.children(i),t),n[i]={low:o,lim:r++}}return f(e.children(),t),n}function Ur(e,n){var r={};function t(i,o){var a=0,u=0,d=i.length,s=F(o);return f(o,function(c,l){var h=Kr(e,c),v=h?e.node(h).order:d;(h||c===s)&&(f(o.slice(u,l+1),function(p){f(e.predecessors(p),function(b){var L=e.node(b),ne=L.order;(nes)&&Ve(r,h,c)})})}function i(o,a){var u=-1,d,s=0;return f(a,function(c,l){if(e.node(c).dummy==="border"){var h=e.predecessors(c);h.length&&(d=e.node(h[0]).order,t(a,s,l,u,d),s=l,u=d)}t(a,s,a.length,d,o.length)}),a}return B(n,i),r}function Kr(e,n){if(e.node(n).dummy)return U(e.predecessors(n),function(r){return e.node(r).dummy})}function Ve(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[n];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Zr(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function Qr(e,n,r,t){var i={},o={},a={};return f(n,function(u){f(u,function(d,s){i[d]=d,o[d]=d,a[d]=s})}),f(n,function(u){var d=-1;f(u,function(s){var c=t(s);if(c.length){c=R(c,function(b){return a[b]});for(var l=(c.length-1)/2,h=Math.floor(l),v=Math.ceil(l);h<=v;++h){var p=c[h];o[s]===s&&d{var t=r(" buildLayoutGraph",()=>yt(e));r(" runLayout",()=>ft(t,r)),r(" updateInputGraph",()=>ct(e,t))})}function ft(e,n){n(" makeSpaceForEdgeLabels",()=>xt(e)),n(" removeSelfEdges",()=>It(e)),n(" acyclic",()=>Zn(e)),n(" nestingGraph.run",()=>Lr(e)),n(" rank",()=>kr(Le(e))),n(" injectEdgeLabelProxies",()=>Et(e)),n(" removeEmptyRanks",()=>tr(e)),n(" nestingGraph.cleanup",()=>Cr(e)),n(" normalizeRanks",()=>rr(e)),n(" assignRankMinMax",()=>kt(e)),n(" removeEdgeLabelProxies",()=>Ot(e)),n(" normalize.run",()=>cr(e)),n(" parentDummyChains",()=>zr(e)),n(" addBorderSegments",()=>or(e)),n(" order",()=>qr(e)),n(" insertSelfEdges",()=>Rt(e)),n(" adjustCoordinateSystem",()=>ur(e)),n(" position",()=>dt(e)),n(" positionSelfEdges",()=>Tt(e)),n(" removeBorderNodes",()=>Ct(e)),n(" normalize.undo",()=>hr(e)),n(" fixupEdgeLabelCoords",()=>Pt(e)),n(" undoCoordinateSystem",()=>dr(e)),n(" translateGraph",()=>Nt(e)),n(" assignNodeIntersects",()=>Lt(e)),n(" reversePoints",()=>_t(e)),n(" acyclic.undo",()=>er(e))}function ct(e,n){f(e.nodes(),function(r){var t=e.node(r),i=n.node(r);t&&(t.x=i.x,t.y=i.y,n.children(r).length&&(t.width=i.width,t.height=i.height))}),f(e.edges(),function(r){var t=e.edge(r),i=n.edge(r);t.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(t.x=i.x,t.y=i.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var lt=["nodesep","edgesep","ranksep","marginx","marginy"],ht={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},vt=["acyclicer","ranker","rankdir","align"],pt=["width","height"],wt={width:0,height:0},bt=["minlen","weight","width","height","labeloffset"],mt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},gt=["labelpos"];function yt(e){var n=new g({multigraph:!0,compound:!0}),r=W(e.graph());return n.setGraph(X({},ht,q(r,lt),A(r,vt))),f(e.nodes(),function(t){var i=W(e.node(t));n.setNode(t,En(q(i,pt),wt)),n.setParent(t,e.parent(t))}),f(e.edges(),function(t){var i=W(e.edge(t));n.setEdge(t,X({},mt,q(i,bt),A(i,gt)))}),n}function xt(e){var n=e.graph();n.ranksep/=2,f(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function Et(e){f(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),i=e.node(n.w),o={rank:(i.rank-t.rank)/2+t.rank,e:n};N(e,"edge-proxy",o,"_ep")}})}function kt(e){var n=0;f(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=y(n,t.maxRank))}),e.graph().maxRank=n}function Ot(e){f(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function Nt(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,i=0,o=e.graph(),a=o.marginx||0,u=o.marginy||0;function d(s){var c=s.x,l=s.y,h=s.width,v=s.height;n=Math.min(n,c-h/2),r=Math.max(r,c+h/2),t=Math.min(t,l-v/2),i=Math.max(i,l+v/2)}f(e.nodes(),function(s){d(e.node(s))}),f(e.edges(),function(s){var c=e.edge(s);Object.prototype.hasOwnProperty.call(c,"x")&&d(c)}),n-=a,t-=u,f(e.nodes(),function(s){var c=e.node(s);c.x-=n,c.y-=t}),f(e.edges(),function(s){var c=e.edge(s);f(c.points,function(l){l.x-=n,l.y-=t}),Object.prototype.hasOwnProperty.call(c,"x")&&(c.x-=n),Object.prototype.hasOwnProperty.call(c,"y")&&(c.y-=t)}),o.width=r-n+a,o.height=i-t+u}function Lt(e){f(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),i=e.node(n.w),o,a;r.points?(o=r.points[0],a=r.points[r.points.length-1]):(r.points=[],o=i,a=t),r.points.unshift(ae(t,o)),r.points.push(ae(i,a))})}function Pt(e){f(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function _t(e){f(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function Ct(e){f(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),i=e.node(r.borderBottom),o=e.node(F(r.borderLeft)),a=e.node(F(r.borderRight));r.width=Math.abs(a.x-o.x),r.height=Math.abs(i.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),f(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function It(e){f(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function Rt(e){var n=V(e);f(n,function(r){var t=0;f(r,function(i,o){var a=e.node(i);a.order=o+t,f(a.selfEdges,function(u){N(e,"selfedge",{width:u.label.width,height:u.label.height,rank:a.rank,order:o+ ++t,e:u.e,label:u.label},"_se")}),delete a.selfEdges})})}function Tt(e){f(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),i=t.x+t.width/2,o=t.y,a=r.x-i,u=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{x:i+a,y:o},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],r.label.x=r.x,r.label.y=r.y}})}function q(e,n){return j(A(e,n),Number)}function W(e){var n={};return f(e,function(r,t){n[t.toLowerCase()]=r}),n}export{Bt as l}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/lightFragment-BRK1HqYL.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/lightFragment-BRK1HqYL.js new file mode 100644 index 0000000000000000000000000000000000000000..4e320f66dd829a0bfd0748aef5ded9a77c5cdbd5 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/lightFragment-BRK1HqYL.js @@ -0,0 +1,376 @@ +import{S as e}from"./index-CDrXokXW.js";const i="clusteredLightingFunctions",o=`struct ClusteredLight {vec4 vLightData;vec4 vLightDiffuse;vec4 vLightSpecular;vec4 vLightDirection;vec4 vLightFalloff;}; +#define inline +ClusteredLight getClusteredLight(sampler2D lightDataTexture,int index) {return ClusteredLight( +texelFetch(lightDataTexture,ivec2(0,index),0), +texelFetch(lightDataTexture,ivec2(1,index),0), +texelFetch(lightDataTexture,ivec2(2,index),0), +texelFetch(lightDataTexture,ivec2(3,index),0), +texelFetch(lightDataTexture,ivec2(4,index),0) +);} +int getClusteredSliceIndex(vec2 sliceData,float viewDepth) {return int(log(viewDepth)*sliceData.x+sliceData.y);} +`;e.IncludesShadersStore[i]||(e.IncludesShadersStore[i]=o);const t="lightFragment",n=`#ifdef LIGHT{X} +#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X}) +#else +vec4 diffuse{X}=light{X}.vLightDiffuse; +#define CUSTOM_LIGHT{X}_COLOR +#if defined(PBR) && defined(CLUSTLIGHT{X}) && defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +{int sliceIndex=min(getClusteredSliceIndex(light{X}.vSliceData,vViewDepth),CLUSTLIGHT_SLICES-1);info=computeClusteredLighting( +lightDataTexture{X}, +tileMaskTexture{X}, +light{X}.vLightData, +ivec2(light{X}.vSliceRanges[sliceIndex]), +viewDirectionW, +normalW, +vPositionW, +surfaceAlbedo, +reflectivityOut +#ifdef IRIDESCENCE +,iridescenceIntensity +#endif +#ifdef SS_TRANSLUCENCY +,subSurfaceOut +#endif +#ifdef SPECULARTERM +,AARoughnessFactors.x +#endif +#ifdef ANISOTROPIC +,anisotropicOut +#endif +#ifdef SHEEN +,sheenOut +#endif +#ifdef CLEARCOAT +,clearcoatOut +#endif +);} +#elif defined(PBR) +#ifdef SPOTLIGHT{X} +preInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW); +#elif defined(POINTLIGHT{X}) +preInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW); +#elif defined(HEMILIGHT{X}) +preInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW); +#elif defined(DIRLIGHT{X}) +preInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW); +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +preInfo=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,normalW,vPositionW,light{X}.vLightData,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,roughness); +#endif +preInfo.NdotV=NdotV; +#ifdef SPOTLIGHT{X} +#ifdef LIGHT_FALLOFF_GLTF{X} +preInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y); +#ifdef IESLIGHTTEXTURE{X} +preInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X}); +#else +preInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w); +#endif +#elif defined(LIGHT_FALLOFF_PHYSICAL{X}) +preInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared); +#ifdef IESLIGHTTEXTURE{X} +preInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X}); +#else +preInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w); +#endif +#elif defined(LIGHT_FALLOFF_STANDARD{X}) +preInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x); +#ifdef IESLIGHTTEXTURE{X} +preInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X}); +#else +preInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w); +#endif +#else +preInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y); +#ifdef IESLIGHTTEXTURE{X} +preInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X}); +#else +preInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w); +#endif +#endif +#elif defined(POINTLIGHT{X}) +#ifdef LIGHT_FALLOFF_GLTF{X} +preInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y); +#elif defined(LIGHT_FALLOFF_PHYSICAL{X}) +preInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared); +#elif defined(LIGHT_FALLOFF_STANDARD{X}) +preInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x); +#else +preInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y); +#endif +#else +preInfo.attenuation=1.0; +#endif +#if defined(HEMILIGHT{X}) +preInfo.roughness=roughness; +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +preInfo.roughness=roughness; +#else +preInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance); +#endif +preInfo.diffuseRoughness=diffuseRoughness;preInfo.surfaceAlbedo=surfaceAlbedo; +#ifdef IRIDESCENCE +preInfo.iridescenceIntensity=iridescenceIntensity; +#endif +#ifdef SS_TRANSLUCENCY +info.diffuseTransmission=vec3(0.0); +#endif +#ifdef HEMILIGHT{X} +info.diffuse=computeHemisphericDiffuseLighting(preInfo,diffuse{X}.rgb,light{X}.vLightGround); +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +info.diffuse=computeAreaDiffuseLighting(preInfo,diffuse{X}.rgb); +#elif defined(SS_TRANSLUCENCY) +#ifndef SS_TRANSLUCENCY_LEGACY +info.diffuse=computeDiffuseLighting(preInfo,diffuse{X}.rgb)*(1.0-subSurfaceOut.translucencyIntensity);info.diffuseTransmission=computeDiffuseTransmittedLighting(preInfo,diffuse{X}.rgb,subSurfaceOut.transmittance); +#else +info.diffuse=computeDiffuseTransmittedLighting(preInfo,diffuse{X}.rgb,subSurfaceOut.transmittance); +#endif +#else +info.diffuse=computeDiffuseLighting(preInfo,diffuse{X}.rgb); +#endif +#ifdef SPECULARTERM +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +info.specular=computeAreaSpecularLighting(preInfo,light{X}.vLightSpecular.rgb,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90); +#else +#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) +{vec3 metalFresnel=reflectivityOut.specularWeight*getF82Specular(preInfo.VdotH,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90,reflectivityOut.roughness);vec3 dielectricFresnel=fresnelSchlickGGX(preInfo.VdotH,reflectivityOut.dielectricColorF0,reflectivityOut.colorReflectanceF90);coloredFresnel=mix(dielectricFresnel,metalFresnel,reflectivityOut.metallic);} +#else +coloredFresnel=fresnelSchlickGGX(preInfo.VdotH,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90); +#endif +#ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION +{float NdotH=dot(normalW,preInfo.H);vec3 fresnel=fresnelSchlickGGX(NdotH,vec3(reflectanceF0),specularEnvironmentR90);info.diffuse*=(vec3(1.0)-fresnel);} +#endif +#ifdef ANISOTROPIC +info.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb); +#else +info.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,coloredFresnel,AARoughnessFactors.x,diffuse{X}.rgb); +#endif +#endif +#endif +#ifndef AREALIGHT{X} +#ifdef SHEEN +#ifdef SHEEN_LINKWITHALBEDO +preInfo.roughness=sheenOut.sheenIntensity; +#else +#ifdef HEMILIGHT{X} +preInfo.roughness=sheenOut.sheenRoughness; +#else +preInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance); +#endif +#endif +info.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb); +#endif +#ifdef CLEARCOAT +#ifdef HEMILIGHT{X} +preInfo.roughness=clearcoatOut.clearCoatRoughness; +#else +preInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance); +#endif +info.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,diffuse{X}.rgb); +#ifdef CLEARCOAT_TINT +absorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);info.diffuse*=absorption; +#ifdef SS_TRANSLUCENCY +info.diffuseTransmission*=absorption; +#endif +#ifdef SPECULARTERM +info.specular*=absorption; +#endif +#endif +info.diffuse*=info.clearCoat.w; +#ifdef SS_TRANSLUCENCY +info.diffuseTransmission*=info.clearCoat.w; +#endif +#ifdef SPECULARTERM +info.specular*=info.clearCoat.w; +#endif +#ifdef SHEEN +info.sheen*=info.clearCoat.w; +#endif +#endif +#endif +#else +#ifdef SPOTLIGHT{X} +#ifdef IESLIGHTTEXTURE{X} +info=computeIESSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness,iesLightTexture{X}); +#else +info=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness); +#endif +#elif defined(HEMILIGHT{X}) +info=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness); +#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X}) +info=computeLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness); +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +info=computeAreaLighting(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,normalW,vPositionW,light{X}.vLightData.xyz,light{X}.vLightWidth.rgb,light{X}.vLightHeight.rgb,diffuse{X}.rgb,light{X}.vLightSpecular.rgb, +#ifdef AREALIGHTNOROUGHTNESS +0.5 +#else +vReflectionInfos.y +#endif +); +#elif defined(CLUSTLIGHT{X}) && CLUSTLIGHT_BATCH>0 +{int sliceIndex=min(getClusteredSliceIndex(light{X}.vSliceData,vViewDepth),CLUSTLIGHT_SLICES-1);info=computeClusteredLighting(lightDataTexture{X},tileMaskTexture{X},viewDirectionW,normalW,light{X}.vLightData,ivec2(light{X}.vSliceRanges[sliceIndex]),glossiness);} +#endif +#endif +#ifdef PROJECTEDLIGHTTEXTURE{X} +info.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightTexture{X},textureProjectionMatrix{X},vPositionW); +#endif +#endif +#ifdef SHADOW{X} +#ifdef SHADOWCSM{X} +for (int i=0; i=0.) {index{X}=i;break;}} +#ifdef SHADOWCSMUSESHADOWMAXZ{X} +if (index{X}>=0) +#endif +{ +#if defined(SHADOWPCF{X}) +#if defined(SHADOWLOWQUALITY{X}) +shadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#elif defined(SHADOWMEDIUMQUALITY{X}) +shadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#else +shadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#elif defined(SHADOWPCSS{X}) +#if defined(SHADOWLOWQUALITY{X}) +shadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X}); +#elif defined(SHADOWMEDIUMQUALITY{X}) +shadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X}); +#else +shadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X}); +#endif +#else +shadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#ifdef SHADOWCSMDEBUG{X} +shadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}]; +#endif +#ifndef SHADOWCSMNOBLEND{X} +float frustumLength=frustumLengths{X}[index{X}];float diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};if (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.) +{index{X}+=1;float nextShadow=0.; +#if defined(SHADOWPCF{X}) +#if defined(SHADOWLOWQUALITY{X}) +nextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#elif defined(SHADOWMEDIUMQUALITY{X}) +nextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#else +nextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#elif defined(SHADOWPCSS{X}) +#if defined(SHADOWLOWQUALITY{X}) +nextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X}); +#elif defined(SHADOWMEDIUMQUALITY{X}) +nextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X}); +#else +nextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X}); +#endif +#else +nextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +shadow=mix(nextShadow,shadow,diffRatio); +#ifdef SHADOWCSMDEBUG{X} +shadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio); +#endif +} +#endif +} +#elif defined(SHADOWCLOSEESM{X}) +#if defined(SHADOWCUBE{X}) +shadow=computeShadowWithCloseESMCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues); +#else +shadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w); +#endif +#elif defined(SHADOWESM{X}) +#if defined(SHADOWCUBE{X}) +shadow=computeShadowWithESMCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues); +#else +shadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w); +#endif +#elif defined(SHADOWPOISSON{X}) +#if defined(SHADOWCUBE{X}) +shadow=computeShadowWithPoissonSamplingCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues); +#else +shadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#elif defined(SHADOWPCF{X}) +#if defined(SHADOWLOWQUALITY{X}) +shadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#elif defined(SHADOWMEDIUMQUALITY{X}) +shadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#else +shadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#elif defined(SHADOWPCSS{X}) +#if defined(SHADOWLOWQUALITY{X}) +shadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#elif defined(SHADOWMEDIUMQUALITY{X}) +shadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#else +shadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthTexture{X},shadowTexture{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#else +#if defined(SHADOWCUBE{X}) +shadow=computeShadowCube(vPositionW,light{X}.vLightData.xyz,shadowTexture{X},light{X}.shadowsInfo.x,light{X}.depthValues); +#else +shadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowTexture{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#endif +#ifdef SHADOWONLY +#ifndef SHADOWINUSE +#define SHADOWINUSE +#endif +globalShadow+=shadow;shadowLightCount+=1.0; +#endif +#else +shadow=1.; +#endif +aggShadow+=shadow;numLights+=1.0; +#ifndef SHADOWONLY +#ifdef CUSTOMUSERLIGHTING +diffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow); +#ifdef SPECULARTERM +specularBase+=computeCustomSpecularLighting(info,specularBase,shadow); +#endif +#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) +diffuseBase+=lightmapColor.rgb*shadow; +#ifdef SPECULARTERM +#ifndef LIGHTMAPNOSPECULAR{X} +specularBase+=info.specular*shadow*lightmapColor.rgb; +#endif +#endif +#ifdef CLEARCOAT +#ifndef LIGHTMAPNOSPECULAR{X} +clearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb; +#endif +#endif +#ifdef SHEEN +#ifndef LIGHTMAPNOSPECULAR{X} +sheenBase+=info.sheen.rgb*shadow; +#endif +#endif +#else +#ifdef SHADOWCSMDEBUG{X} +diffuseBase+=info.diffuse*shadowDebug{X}; +#else +diffuseBase+=info.diffuse*shadow; +#endif +#ifdef SS_TRANSLUCENCY +diffuseTransmissionBase+=info.diffuseTransmission*shadow; +#endif +#ifdef SPECULARTERM +specularBase+=info.specular*shadow; +#endif +#ifdef CLEARCOAT +clearCoatBase+=info.clearCoat.rgb*shadow; +#endif +#ifdef SHEEN +sheenBase+=info.sheen.rgb*shadow; +#endif +#endif +#endif +#endif +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=n); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/lightFragment-DhtXFpEE.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/lightFragment-DhtXFpEE.js new file mode 100644 index 0000000000000000000000000000000000000000..e8aef927b54210fd5855454eb0dd9372fe623152 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/lightFragment-DhtXFpEE.js @@ -0,0 +1,374 @@ +import{S as e}from"./index-CDrXokXW.js";const i="lightFragment",t=`#ifdef LIGHT{X} +#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X}) +#else +var diffuse{X}: vec4f=light{X}.vLightDiffuse; +#define CUSTOM_LIGHT{X}_COLOR +#if defined(PBR) && defined(CLUSTLIGHT{X}) +{let sliceIndex=min(getClusteredSliceIndex(light{X}.vSliceData,fragmentInputs.vViewDepth),CLUSTLIGHT_SLICES-1);info=computeClusteredLighting( +lightDataTexture{X}, +&tileMaskBuffer{X}, +light{X}.vLightData, +vec2u(light{X}.vSliceRanges[sliceIndex].xy), +viewDirectionW, +normalW, +fragmentInputs.vPositionW, +surfaceAlbedo, +reflectivityOut, +#ifdef IRIDESCENCE +iridescenceIntensity, +#endif +#ifdef SS_TRANSLUCENCY +subSurfaceOut, +#endif +#ifdef SPECULARTERM +AARoughnessFactors.x, +#endif +#ifdef ANISOTROPIC +anisotropicOut, +#endif +#ifdef SHEEN +sheenOut, +#endif +#ifdef CLEARCOAT +clearcoatOut, +#endif +);} +#elif defined(PBR) +#ifdef SPOTLIGHT{X} +preInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,fragmentInputs.vPositionW); +#elif defined(POINTLIGHT{X}) +preInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,fragmentInputs.vPositionW); +#elif defined(HEMILIGHT{X}) +preInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW); +#elif defined(DIRLIGHT{X}) +preInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW); +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +preInfo=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC1SamplerSampler,areaLightsLTC2Sampler,areaLightsLTC2SamplerSampler,viewDirectionW,normalW,fragmentInputs.vPositionW,light{X}.vLightData.xyz,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,roughness); +#endif +preInfo.NdotV=NdotV; +#ifdef SPOTLIGHT{X} +#ifdef LIGHT_FALLOFF_GLTF{X} +preInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y); +#ifdef IESLIGHTTEXTURE{X} +preInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X},iesLightTexture{X}Sampler); +#else +preInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w); +#endif +#elif defined(LIGHT_FALLOFF_PHYSICAL{X}) +preInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared); +#ifdef IESLIGHTTEXTURE{X} +preInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X},iesLightTexture{X}Sampler); +#else +preInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w); +#endif +#elif defined(LIGHT_FALLOFF_STANDARD{X}) +preInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x); +#ifdef IESLIGHTTEXTURE{X} +preInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X},iesLightTexture{X}Sampler); +#else +preInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w); +#endif +#else +preInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y); +#ifdef IESLIGHTTEXTURE{X} +preInfo.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo.L,iesLightTexture{X},iesLightTexture{X}Sampler); +#else +preInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w); +#endif +#endif +#elif defined(POINTLIGHT{X}) +#ifdef LIGHT_FALLOFF_GLTF{X} +preInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y); +#elif defined(LIGHT_FALLOFF_PHYSICAL{X}) +preInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared); +#elif defined(LIGHT_FALLOFF_STANDARD{X}) +preInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x); +#else +preInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y); +#endif +#else +preInfo.attenuation=1.0; +#endif +#if defined(HEMILIGHT{X}) +preInfo.roughness=roughness; +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +preInfo.roughness=roughness; +#else +preInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance); +#endif +preInfo.diffuseRoughness=diffuseRoughness;preInfo.surfaceAlbedo=surfaceAlbedo; +#ifdef IRIDESCENCE +preInfo.iridescenceIntensity=iridescenceIntensity; +#endif +#ifdef SS_TRANSLUCENCY +info.diffuseTransmission=vec3f(0.0); +#endif +#ifdef HEMILIGHT{X} +info.diffuse=computeHemisphericDiffuseLighting(preInfo,diffuse{X}.rgb,light{X}.vLightGround); +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +info.diffuse=computeAreaDiffuseLighting(preInfo,diffuse{X}.rgb); +#elif defined(SS_TRANSLUCENCY) +#ifndef SS_TRANSLUCENCY_LEGACY +info.diffuse=computeDiffuseLighting(preInfo,diffuse{X}.rgb)*(1.0-subSurfaceOut.translucencyIntensity);info.diffuseTransmission=computeDiffuseTransmittedLighting(preInfo,diffuse{X}.rgb,subSurfaceOut.transmittance); +#else +info.diffuse=computeDiffuseTransmittedLighting(preInfo,diffuse{X}.rgb,subSurfaceOut.transmittance); +#endif +#else +info.diffuse=computeDiffuseLighting(preInfo,diffuse{X}.rgb); +#endif +#ifdef SPECULARTERM +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +info.specular=computeAreaSpecularLighting(preInfo,light{X}.vLightSpecular.rgb,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90); +#else +#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) +{let metalFresnel: vec3f=vec3f(reflectivityOut.specularWeight)*getF82Specular(preInfo.VdotH,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90,reflectivityOut.roughness);let dielectricFresnel: vec3f=fresnelSchlickGGXVec3(preInfo.VdotH,reflectivityOut.dielectricColorF0,reflectivityOut.colorReflectanceF90);coloredFresnel=mix(dielectricFresnel,metalFresnel,reflectivityOut.metallic);} +#else +coloredFresnel=fresnelSchlickGGXVec3(preInfo.VdotH,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90); +#endif +#ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION +{let NdotH: f32=dot(normalW,preInfo.H);let fresnel: vec3f=fresnelSchlickGGXVec3(NdotH,vec3f(reflectanceF0),specularEnvironmentR90);info.diffuse*=(vec3f(1.0)-fresnel);} +#endif +#ifdef ANISOTROPIC +info.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb); +#else +info.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,coloredFresnel,AARoughnessFactors.x,diffuse{X}.rgb); +#endif +#endif +#endif +#ifndef AREALIGHT{X} +#ifdef SHEEN +#ifdef SHEEN_LINKWITHALBEDO +preInfo.roughness=sheenOut.sheenIntensity; +#else +#ifdef HEMILIGHT{X} +preInfo.roughness=sheenOut.sheenRoughness; +#else +preInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance); +#endif +#endif +info.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,diffuse{X}.rgb); +#endif +#ifdef CLEARCOAT +#ifdef HEMILIGHT{X} +preInfo.roughness=clearcoatOut.clearCoatRoughness; +#else +preInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance); +#endif +info.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,diffuse{X}.rgb); +#ifdef CLEARCOAT_TINT +absorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);info.diffuse*=absorption; +#ifdef SS_TRANSLUCENCY +info.diffuseTransmission*=absorption; +#endif +#ifdef SPECULARTERM +info.specular*=absorption; +#endif +#endif +info.diffuse*=info.clearCoat.w; +#ifdef SS_TRANSLUCENCY +info.diffuseTransmission*=info.clearCoat.w; +#endif +#ifdef SPECULARTERM +info.specular*=info.clearCoat.w; +#endif +#ifdef SHEEN +info.sheen*=info.clearCoat.w; +#endif +#endif +#endif +#else +#ifdef SPOTLIGHT{X} +#ifdef IESLIGHTTEXTURE{X} +info=computeIESSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness,iesLightTexture{X},iesLightTexture{X}Sampler); +#else +info=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness); +#endif +#elif defined(HEMILIGHT{X}) +info=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness); +#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X}) +info=computeLighting(viewDirectionW,normalW,light{X}.vLightData,diffuse{X}.rgb,light{X}.vLightSpecular.rgb,diffuse{X}.a,glossiness); +#elif define(AREALIGHT{X}) && defined(AREALIGHTSUPPORTED) +info=computeAreaLighting(areaLightsLTC1Sampler,areaLightsLTC1SamplerSampler,areaLightsLTC2Sampler,areaLightsLTC2SamplerSampler,viewDirectionW,normalW,fragmentInputs.vPositionW,light{X}.vLightData.xyz,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,diffuse{X}.rgb,light{X}.vLightSpecular.rgb, +#ifdef AREALIGHTNOROUGHTNESS +0.5 +#else +uniforms.vReflectionInfos.y +#endif +); +#elif defined(CLUSTLIGHT{X}) +{let sliceIndex=min(getClusteredSliceIndex(light{X}.vSliceData,fragmentInputs.vViewDepth),CLUSTLIGHT_SLICES-1);info=computeClusteredLighting(lightDataTexture{X},&tileMaskBuffer{X},viewDirectionW,normalW,light{X}.vLightData,vec2u(light{X}.vSliceRanges[sliceIndex].xy),glossiness);} +#endif +#endif +#ifdef PROJECTEDLIGHTTEXTURE{X} +info.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightTexture{X},projectionLightTexture{X}Sampler,uniforms.textureProjectionMatrix{X},fragmentInputs.vPositionW); +#endif +#endif +#ifdef SHADOW{X} +#ifdef SHADOWCSMDEBUG{X} +var shadowDebug{X}: vec3f; +#endif +#ifdef SHADOWCSM{X} +#ifdef SHADOWCSMUSESHADOWMAXZ{X} +var index{X}: i32=-1; +#else +var index{X}: i32=SHADOWCSMNUM_CASCADES{X}-1; +#endif +var diff{X}: f32=0.;vPositionFromLight{X}[0]=fragmentInputs.vPositionFromLight{X}_0;vPositionFromLight{X}[1]=fragmentInputs.vPositionFromLight{X}_1;vPositionFromLight{X}[2]=fragmentInputs.vPositionFromLight{X}_2;vPositionFromLight{X}[3]=fragmentInputs.vPositionFromLight{X}_3;vDepthMetric{X}[0]=fragmentInputs.vDepthMetric{X}_0;vDepthMetric{X}[1]=fragmentInputs.vDepthMetric{X}_1;vDepthMetric{X}[2]=fragmentInputs.vDepthMetric{X}_2;vDepthMetric{X}[3]=fragmentInputs.vDepthMetric{X}_3;for (var i:i32=0; i=0.) {index{X}=i;break;}} +#ifdef SHADOWCSMUSESHADOWMAXZ{X} +if (index{X}>=0) +#endif +{ +#if defined(SHADOWPCF{X}) +#if defined(SHADOWLOWQUALITY{X}) +shadow=computeShadowWithCSMPCF1(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#elif defined(SHADOWMEDIUMQUALITY{X}) +shadow=computeShadowWithCSMPCF3(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#else +shadow=computeShadowWithCSMPCF5(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#elif defined(SHADOWPCSS{X}) +#if defined(SHADOWLOWQUALITY{X}) +shadow=computeShadowWithCSMPCSS16(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,uniforms.lightSizeUVCorrection{X}[index{X}],uniforms.depthCorrection{X}[index{X}],uniforms.penumbraDarkness{X}); +#elif defined(SHADOWMEDIUMQUALITY{X}) +shadow=computeShadowWithCSMPCSS32(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,uniforms.lightSizeUVCorrection{X}[index{X}],uniforms.depthCorrection{X}[index{X}],uniforms.penumbraDarkness{X}); +#else +shadow=computeShadowWithCSMPCSS64(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,uniforms.lightSizeUVCorrection{X}[index{X}],uniforms.depthCorrection{X}[index{X}],uniforms.penumbraDarkness{X}); +#endif +#else +shadow=computeShadowCSM(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#ifdef SHADOWCSMDEBUG{X} +shadowDebug{X}=vec3f(shadow)*vCascadeColorsMultiplier{X}[index{X}]; +#endif +#ifndef SHADOWCSMNOBLEND{X} +var frustumLength:f32=uniforms.frustumLengths{X}[index{X}];var diffRatio:f32=clamp(diff{X}/frustumLength,0.,1.)*uniforms.cascadeBlendFactor{X};if (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.) +{index{X}+=1;var nextShadow: f32=0.; +#if defined(SHADOWPCF{X}) +#if defined(SHADOWLOWQUALITY{X}) +nextShadow=computeShadowWithCSMPCF1(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],,shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#elif defined(SHADOWMEDIUMQUALITY{X}) +nextShadow=computeShadowWithCSMPCF3(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#else +nextShadow=computeShadowWithCSMPCF5(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#elif defined(SHADOWPCSS{X}) +#if defined(SHADOWLOWQUALITY{X}) +nextShadow=computeShadowWithCSMPCSS16(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,uniforms.lightSizeUVCorrection{X}[index{X}],uniforms.depthCorrection{X}[index{X}],uniforms.penumbraDarkness{X}); +#elif defined(SHADOWMEDIUMQUALITY{X}) +nextShadow=computeShadowWithCSMPCSS32(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,uniforms.lightSizeUVCorrection{X}[index{X}],uniforms.depthCorrection{X}[index{X}],uniforms.penumbraDarkness{X}); +#else +nextShadow=computeShadowWithCSMPCSS64(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,uniforms.lightSizeUVCorrection{X}[index{X}],uniforms.depthCorrection{X}[index{X}],uniforms.penumbraDarkness{X}); +#endif +#else +nextShadow=computeShadowCSM(index{X},vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +shadow=mix(nextShadow,shadow,diffRatio); +#ifdef SHADOWCSMDEBUG{X} +shadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio); +#endif +} +#endif +} +#elif defined(SHADOWCLOSEESM{X}) +#if defined(SHADOWCUBE{X}) +shadow=computeShadowWithCloseESMCube(fragmentInputs.vPositionW,light{X}.vLightData.xyz,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues); +#else +shadow=computeShadowWithCloseESM(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w); +#endif +#elif defined(SHADOWESM{X}) +#if defined(SHADOWCUBE{X}) +shadow=computeShadowWithESMCube(fragmentInputs.vPositionW,light{X}.vLightData.xyz,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues); +#else +shadow=computeShadowWithESM(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w); +#endif +#elif defined(SHADOWPOISSON{X}) +#if defined(SHADOWCUBE{X}) +shadow=computeShadowWithPoissonSamplingCube(fragmentInputs.vPositionW,light{X}.vLightData.xyz,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues); +#else +shadow=computeShadowWithPoissonSampling(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#elif defined(SHADOWPCF{X}) +#if defined(SHADOWLOWQUALITY{X}) +shadow=computeShadowWithPCF1(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#elif defined(SHADOWMEDIUMQUALITY{X}) +shadow=computeShadowWithPCF3(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#else +shadow=computeShadowWithPCF5(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#elif defined(SHADOWPCSS{X}) +#if defined(SHADOWLOWQUALITY{X}) +shadow=computeShadowWithPCSS16(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#elif defined(SHADOWMEDIUMQUALITY{X}) +shadow=computeShadowWithPCSS32(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#else +shadow=computeShadowWithPCSS64(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},depthTexture{X},depthTexture{X}Sampler,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#else +#if defined(SHADOWCUBE{X}) +shadow=computeShadowCube(fragmentInputs.vPositionW,light{X}.vLightData.xyz,shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.depthValues); +#else +shadow=computeShadow(fragmentInputs.vPositionFromLight{X},fragmentInputs.vDepthMetric{X},shadowTexture{X},shadowTexture{X}Sampler,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w); +#endif +#endif +#ifdef SHADOWONLY +#ifndef SHADOWINUSE +#define SHADOWINUSE +#endif +globalShadow+=shadow;shadowLightCount+=1.0; +#endif +#else +shadow=1.; +#endif +aggShadow+=shadow;numLights+=1.0; +#ifndef SHADOWONLY +#ifdef CUSTOMUSERLIGHTING +diffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow); +#ifdef SPECULARTERM +specularBase+=computeCustomSpecularLighting(info,specularBase,shadow); +#endif +#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) +diffuseBase+=lightmapColor.rgb*shadow; +#ifdef SPECULARTERM +#ifndef LIGHTMAPNOSPECULAR{X} +specularBase+=info.specular*shadow*lightmapColor.rgb; +#endif +#endif +#ifdef CLEARCOAT +#ifndef LIGHTMAPNOSPECULAR{X} +clearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb; +#endif +#endif +#ifdef SHEEN +#ifndef LIGHTMAPNOSPECULAR{X} +sheenBase+=info.sheen.rgb*shadow; +#endif +#endif +#else +#ifdef SHADOWCSMDEBUG{X} +diffuseBase+=info.diffuse*shadowDebug{X}; +#else +diffuseBase+=info.diffuse*shadow; +#endif +#ifdef SS_TRANSLUCENCY +diffuseTransmissionBase+=info.diffuseTransmission*shadow; +#endif +#ifdef SPECULARTERM +specularBase+=info.specular*shadow; +#endif +#ifdef CLEARCOAT +clearCoatBase+=info.clearCoat.rgb*shadow; +#endif +#ifdef SHEEN +sheenBase+=info.sheen.rgb*shadow; +#endif +#endif +#endif +#endif +`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=t); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/lightsFragmentFunctions-DcPOaMby.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/lightsFragmentFunctions-DcPOaMby.js new file mode 100644 index 0000000000000000000000000000000000000000..cb27a9eba050f23cc3db7d5e6289bc75d5412892 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/lightsFragmentFunctions-DcPOaMby.js @@ -0,0 +1,92 @@ +import{S as e}from"./index-CDrXokXW.js";import"./shadowsFragmentFunctions-CTsFFgyf.js";const t="lightsFragmentFunctions",i=`struct lightingInfo +{diffuse: vec3f, +#ifdef SPECULARTERM +specular: vec3f, +#endif +#ifdef NDOTL +ndl: f32, +#endif +};fn computeLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32)->lightingInfo {var result: lightingInfo;var lightVectorW: vec3f;var attenuation: f32=1.0;if (lightData.w==0.) +{var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);} +else +{lightVectorW=normalize(-lightData.xyz);} +var ndl: f32=max(0.,dot(vNormal,lightVectorW)); +#ifdef NDOTL +result.ndl=ndl; +#endif +result.diffuse=ndl*diffuseColor*attenuation; +#ifdef SPECULARTERM +var angleW: vec3f=normalize(viewDirectionW+lightVectorW);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation; +#endif +return result;} +fn getAttenuation(cosAngle: f32,exponent: f32)->f32 {return max(0.,pow(cosAngle,exponent));} +fn getIESAttenuation(cosAngle: f32,iesLightTexture: texture_2d,iesLightTextureSampler: sampler)->f32 {var angle=acos(cosAngle)/PI;return textureSampleLevel(iesLightTexture,iesLightTextureSampler,vec2f(angle,0),0.).r;} +fn computeBasicSpotLighting(viewDirectionW: vec3f,lightVectorW: vec3f,vNormal: vec3f,attenuation: f32,diffuseColor: vec3f,specularColor: vec3f,glossiness: f32)->lightingInfo {var result: lightingInfo;var ndl: f32=max(0.,dot(vNormal,lightVectorW)); +#ifdef NDOTL +result.ndl=ndl; +#endif +result.diffuse=ndl*diffuseColor*attenuation; +#ifdef SPECULARTERM +var angleW: vec3f=normalize(viewDirectionW+lightVectorW);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation; +#endif +return result;} +fn computeIESSpotLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,lightDirection: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32,iesLightTexture: texture_2d,iesLightTextureSampler: sampler)->lightingInfo {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;var lightVectorW: vec3f=normalize(direction);var attenuation: f32=max(0.,1.0-length(direction)/range);var dotProduct=dot(lightDirection.xyz,-lightVectorW);var cosAngle: f32=max(0.,dotProduct);if (cosAngle>=lightDirection.w) +{attenuation*=getIESAttenuation(dotProduct,iesLightTexture,iesLightTextureSampler);return computeBasicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);} +var result: lightingInfo;result.diffuse=vec3f(0.); +#ifdef SPECULARTERM +result.specular=vec3f(0.); +#endif +#ifdef NDOTL +result.ndl=0.; +#endif +return result;} +fn computeSpotLighting(viewDirectionW: vec3f,vNormal: vec3f ,lightData: vec4f,lightDirection: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32)->lightingInfo {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;var lightVectorW: vec3f=normalize(direction);var attenuation: f32=max(0.,1.0-length(direction)/range);var cosAngle: f32=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w) +{attenuation*=getAttenuation(cosAngle,lightData.w);return computeBasicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);} +var result: lightingInfo;result.diffuse=vec3f(0.); +#ifdef SPECULARTERM +result.specular=vec3f(0.); +#endif +#ifdef NDOTL +result.ndl=0.; +#endif +return result;} +fn computeHemisphericLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,diffuseColor: vec3f,specularColor: vec3f,groundColor: vec3f,glossiness: f32)->lightingInfo {var result: lightingInfo;var ndl: f32=dot(vNormal,lightData.xyz)*0.5+0.5; +#ifdef NDOTL +result.ndl=ndl; +#endif +result.diffuse=mix(groundColor,diffuseColor,ndl); +#ifdef SPECULARTERM +var angleW: vec3f=normalize(viewDirectionW+lightData.xyz);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor; +#endif +return result;} +fn computeProjectionTextureDiffuseLighting(projectionLightTexture: texture_2d,projectionLightSampler: sampler,textureProjectionMatrix: mat4x4f,posW: vec3f)->vec3f {var strq: vec4f=textureProjectionMatrix*vec4f(posW,1.0);strq/=strq.w;var textureColor: vec3f=textureSample(projectionLightTexture,projectionLightSampler,strq.xy).rgb;return textureColor;} +#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +#include +var areaLightsLTC1SamplerSampler: sampler;var areaLightsLTC1Sampler: texture_2d;var areaLightsLTC2SamplerSampler: sampler;var areaLightsLTC2Sampler: texture_2d;fn computeAreaLighting(ltc1: texture_2d,ltc1Sampler:sampler,ltc2:texture_2d,ltc2Sampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightPosition:vec3f,halfWidth:vec3f, halfHeight:vec3f,diffuseColor:vec3f,specularColor:vec3f,roughness:f32 )->lightingInfo +{var result: lightingInfo;var data: areaLightData=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc1Sampler,ltc2,ltc2Sampler,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness); +#ifdef SPECULARTERM +var fresnel:vec3f=( specularColor*data.Fresnel.x+( vec3f( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular; +#endif +result.diffuse+=diffuseColor*data.Diffuse;return result;} +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +#include +fn computeClusteredLighting( +lightDataTexture: texture_2d, +tileMaskBuffer: ptr>, +viewDirectionW: vec3f, +vNormal: vec3f, +lightData: vec4f, +sliceRange: vec2u, +glossiness: f32 +)->lightingInfo {var result: lightingInfo;let tilePosition=vec2u(fragmentInputs.position.xy*lightData.xy);let maskResolution=vec2u(lightData.zw);var tileIndex=(tilePosition.x*maskResolution.x+tilePosition.y)*maskResolution.y;let batchRange=sliceRange/CLUSTLIGHT_BATCH;var batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tileIndex+=batchRange.x;for (var i=batchRange.x; i<=batchRange.y; i+=1) {var mask=tileMaskBuffer[tileIndex];tileIndex+=1;let maskOffset=max(sliceRange.x,batchOffset)-batchOffset; +let maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while mask != 0 {let trailing=firstTrailingBit(mask);mask ^= 1u<=lightDirection.w) +{ +attenuation*=getIESAttenuation(dotProduct,iesLightSampler);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);} +lightingInfo result;result.diffuse=vec3(0.); +#ifdef SPECULARTERM +result.specular=vec3(0.); +#endif +#ifdef NDOTL +result.ndl=0.; +#endif +return result;} +lightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {vec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w) +{ +attenuation*=getAttenuation(cosAngle,lightData.w);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);} +lightingInfo result;result.diffuse=vec3(0.); +#ifdef SPECULARTERM +result.specular=vec3(0.); +#endif +#ifdef NDOTL +result.ndl=0.; +#endif +return result;} +lightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {lightingInfo result;float ndl=dot(vNormal,lightData.xyz)*0.5+0.5; +#ifdef NDOTL +result.ndl=ndl; +#endif +result.diffuse=mix(groundColor,diffuseColor,ndl); +#ifdef SPECULARTERM +vec3 angleW=normalize(viewDirectionW+lightData.xyz);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor; +#endif +return result;} +#define inline +vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix,vec3 posW){vec4 strq=textureProjectionMatrix*vec4(posW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return textureColor;} +#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +#include +uniform sampler2D areaLightsLTC1Sampler;uniform sampler2D areaLightsLTC2Sampler; +#define inline +lightingInfo computeAreaLighting(sampler2D ltc1,sampler2D ltc2,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec3 lightPosition,vec3 halfWidth,vec3 halfHeight,vec3 diffuseColor,vec3 specularColor,float roughness) +{lightingInfo result;areaLightData data=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc2,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness); +#ifdef SPECULARTERM +vec3 fresnel=( specularColor*data.Fresnel.x+( vec3( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular; +#endif +result.diffuse+=diffuseColor*data.Diffuse;return result;} +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +#include +#define inline +lightingInfo computeClusteredLighting( +sampler2D lightDataTexture, +sampler2D tileMaskTexture, +vec3 viewDirectionW, +vec3 vNormal, +vec4 lightData, +ivec2 sliceRange, +float glossiness +) {lightingInfo result;ivec2 tilePosition=ivec2(gl_FragCoord.xy*lightData.xy);int maskHeight=int(lightData.z);tilePosition.y=min(tilePosition.y,maskHeight-1);ivec2 batchRange=sliceRange/CLUSTLIGHT_BATCH;int batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tilePosition.y+=maskHeight*batchRange.x;for (int i=batchRange.x; i<=batchRange.y; i+=1) {uint mask=uint(texelFetch(tileMaskTexture,tilePosition,0).r);tilePosition.y+=maskHeight;int maskOffset=max(sliceRange.x-batchOffset,0);int maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while (mask != 0u) {uint bit=mask & -mask;mask ^= bit;int position=onlyBitPosition(bit);ClusteredLight light=getClusteredLight(lightDataTexture,batchOffset+maskOffset+position);lightingInfo info;if (light.vLightDirection.w<0.0) {info=computeLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);} else {info=computeSpotLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDirection,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);} +result.diffuse+=info.diffuse; +#ifdef SPECULARTERM +result.specular+=info.specular; +#endif +} +batchOffset+=CLUSTLIGHT_BATCH;} +return result;} +#endif +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=i); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/linear-8mDBZVC7.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/linear-8mDBZVC7.js new file mode 100644 index 0000000000000000000000000000000000000000..569b50e56be3265acaf54a16c302941b4d291c10 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/linear-8mDBZVC7.js @@ -0,0 +1 @@ +import{o as F,q as d,r as w,u as k,v as z}from"./step-B-Gbak1k.js";import{i as B}from"./init-Dmth1JHB.js";import{e as g,a as I,b as P,f as V}from"./defaultLocale-CzDG__Ur.js";function M(n,r){return n==null||r==null?NaN:nr?1:n>=r?0:NaN}function $(n,r){return n==null||r==null?NaN:rn?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===$?n:L,t=n,e=n);function u(o,c,i=0,h=o.length){if(i>>1;t(o[l],c)<0?i=l+1:h=l}while(i>>1;t(o[l],c)<=0?i=l+1:h=l}while(ii&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function L(){return 0}function O(n){return n===null?NaN:+n}function*hn(n,r){if(r===void 0)for(let t of n)t!=null&&(t=+t)>=t&&(yield t);else{let t=-1;for(let e of n)(e=r(e,++t,n))!=null&&(e=+e)>=e&&(yield e)}}const j=R(M),T=j.right,mn=j.left;R(O).center;const C=Math.sqrt(50),E=Math.sqrt(10),G=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=C?10:f>=E?5:f>=G?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/ir&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*ir&&--c),c0))return[];if(n===r)return[n];const e=r=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;ir&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),d)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,D){return e=s,u=D,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=J(n,r,t),f;switch(e=I(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),P(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return V(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return H(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o0;){if(i=p(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},B.apply(n,arguments),on(n)}export{en as a,R as b,un as c,Y as d,X as e,M as f,an as g,T as h,U as i,N as j,mn as k,fn as l,O as m,hn as n,gn as o,W as p,K as q,q as r,Q as s,J as t,_ as u,on as v,tn as w,H as x,m as y}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/logDepthDeclaration-DbMKMukk.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/logDepthDeclaration-DbMKMukk.js new file mode 100644 index 0000000000000000000000000000000000000000..06f0c2014bf5d4edb60849e5cd8c79d73830728c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/logDepthDeclaration-DbMKMukk.js @@ -0,0 +1,4 @@ +import{S as e}from"./index-CDrXokXW.js";const t="logDepthDeclaration",a=`#ifdef LOGARITHMICDEPTH +uniform float logarithmicDepthConstant;varying float vFragmentDepth; +#endif +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=a); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/logDepthDeclaration-DkdfQs4e.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/logDepthDeclaration-DkdfQs4e.js new file mode 100644 index 0000000000000000000000000000000000000000..bed7a14afb984b69274d3ab871699a7a8c7ff876 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/logDepthDeclaration-DkdfQs4e.js @@ -0,0 +1,4 @@ +import{S as e}from"./index-CDrXokXW.js";const r="logDepthDeclaration",t=`#ifdef LOGARITHMICDEPTH +uniform logarithmicDepthConstant: f32;varying vFragmentDepth: f32; +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=t); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/logDepthVertex-DDooPwab.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/logDepthVertex-DDooPwab.js new file mode 100644 index 0000000000000000000000000000000000000000..0626d5b82bb8cef9c3595cade39468309eab989c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/logDepthVertex-DDooPwab.js @@ -0,0 +1,10 @@ +import{S as e}from"./index-CDrXokXW.js";const t="fogVertexDeclaration",r=`#ifdef FOG +varying vec3 vFogDistance; +#endif +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=r);const o="fogVertex",s=`#ifdef FOG +vFogDistance=(view*worldPos).xyz; +#endif +`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=s);const n="logDepthVertex",a=`#ifdef LOGARITHMICDEPTH +vFragmentDepth=1.0+gl_Position.w;gl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant; +#endif +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=a); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/logDepthVertex-D_A6gsii.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/logDepthVertex-D_A6gsii.js new file mode 100644 index 0000000000000000000000000000000000000000..037bffdcd3d5d1dc2f48223afd31a661d3d8aedc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/logDepthVertex-D_A6gsii.js @@ -0,0 +1,14 @@ +import{S as e}from"./index-CDrXokXW.js";const t="fogVertexDeclaration",o=`#ifdef FOG +varying vFogDistance: vec3f; +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=o);const s="fogVertex",n=`#ifdef FOG +#ifdef SCENE_UBO +vertexOutputs.vFogDistance=(scene.view*worldPos).xyz; +#else +vertexOutputs.vFogDistance=(uniforms.view*worldPos).xyz; +#endif +#endif +`;e.IncludesShadersStoreWGSL[s]||(e.IncludesShadersStoreWGSL[s]=n);const r="logDepthVertex",i=`#ifdef LOGARITHMICDEPTH +vertexOutputs.vFragmentDepth=1.0+vertexOutputs.position.w;vertexOutputs.position.z=log2(max(0.000001,vertexOutputs.vFragmentDepth))*uniforms.logarithmicDepthConstant; +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=i); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/lt-C3SHU62J.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/lt-C3SHU62J.js new file mode 100644 index 0000000000000000000000000000000000000000..87a0f9e9edade16bf384b8aa8480bc34740a81b0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/lt-C3SHU62J.js @@ -0,0 +1 @@ +const i="Lietuvių",a={built_with_gradio:"Sukurta su Gradio",clear:"Išvalyti",or:"arba",submit:"Pateikti",settings:"Nustatymai",built_with:"sukurta su",download:"Atsisiųsti",edit:"Redaguoti",empty:"Tuščia",error:"Klaida",hosted_on:"Talpinama",loading:"Kraunama",logo:"logotipas",remove:"Pašalinti",share:"Dalintis",undo:"Atšaukti",no_devices:"Nerasta jokių įrenginių",language:"Kalba",display_theme:"Ekrano tema",pwa:"Progresyvi interneto programėlė"},e={click_to_upload:"Spustelėkite norėdami įkelti",drop_audio:"Įkelkite garso įrašą čia",drop_csv:"Įkelkite CSV čia",drop_file:"Įkelkite failą čia",drop_image:"Įkelkite paveikslėlį čia",drop_video:"Įkelkite vaizdo įrašą čia",drop_gallery:"Įkelkite mediją čia",paste_clipboard:"Įklijuoti iš iškarpinės"},t={annotated_image:"Pažymėtas paveikslėlis"},o={allow_recording_access:"Prašome suteikti prieigą prie mikrofono įrašymui.",audio:"Garsas",drop_to_upload:"Įkelkite garso failą čia",record_from_microphone:"Įrašyti iš mikrofono",stop_recording:"Stabdyti įrašymą",no_device_support:"Nepavyko pasiekti medijos įrenginių. Patikrinkite, ar naudojate saugią prieigą (https) arba localhost (arba perduodate galiojantį SSL sertifikatą į ssl_verify), ir leidžiate naršyklei prieiti prie jūsų įrenginio.",stop:"Stabdyti",resume:"Tęsti",record:"Įrašyti",no_microphone:"Mikrofonas nerastas",pause:"Pristabdyti",play:"Groti",waiting:"Laukiama"},r={connection_can_break:"Mobiliajame įrenginyje ryšys gali nutrūkti, jei šis skirtukas bus neaktyvus arba įrenginys užmigs, todėl galite prarasti savo vietą eilėje.",long_requests_queue:"Yra ilga laukiančių užklausų eilė. Dubliuokite šią erdvę, kad praleistumėte eilę.",lost_connection:"Ryšys nutrūko išėjus iš puslapio. Vėl jungiamasi į eilę...",waiting_for_inputs:"Laukiama, kol bus baigti įkelti failai, prašome bandyti dar kartą."},s={checkbox:"Žymimasis langelis",checkbox_group:"Žymimųjų langelių grupė"},l={code:"Kodas"},n={color_picker:"Spalvos pasirinkimas"},d={incorrect_format:"Neteisingas formatas, palaikomi tik CSV ir TSV failai",new_column:"Pridėti stulpelį",new_row:"Nauja eilutė",add_row_above:"Pridėti eilutę viršuje",add_row_below:"Pridėti eilutę žemiau",delete_row:"Ištrinti eilutę",delete_column:"Ištrinti stulpelį",add_column_left:"Pridėti stulpelį kairėje",add_column_right:"Pridėti stulpelį dešinėje",sort_column:"Rikiuoti stulpelį",sort_ascending:"Rikiuoti didėjančia tvarka",sort_descending:"Rikiuoti mažėjančia tvarka",drop_to_upload:"Įkelkite CSV arba TSV failus čia, kad importuotumėte duomenis į duomenų lentelę",clear_sort:"Išvalyti rikiavimą"},u={dropdown:"Išskleidžiamasis sąrašas"},k={build_error:"yra kompiliavimo klaida",config_error:"yra konfigūracijos klaida",contact_page_author:"Prašome susisiekti su puslapio autoriumi.",no_app_file:"nėra programos failo",runtime_error:"yra vykdymo klaida",space_not_working:'"Erdvė neveikia, nes" {0}',space_paused:"erdvė yra pristabdyta",use_via_api:"Naudoti per API",use_via_api_or_mcp:"Naudoti per API arba MCP"},p={uploading:"Įkeliama..."},_={highlighted_text:"Paryškintas tekstas"},c={allow_webcam_access:"Prašome suteikti prieigą prie internetinės kameros įrašymui.",brush_color:"Teptuko spalva",brush_radius:"Teptuko dydis",image:"Paveikslėlis",remove_image:"Pašalinti paveikslėlį",select_brush_color:"Pasirinkite teptuko spalvą",start_drawing:"Pradėti piešti",use_brush:"Naudoti teptuką",drop_to_upload:"Įkelkite paveikslėlio failą čia"},m={label:"Etiketė"},g={enable_cookies:"Jei lankotės HuggingFace erdvėje inkognito režimu, turite leisti trečiųjų šalių slapukus.",incorrect_credentials:"Neteisingi prisijungimo duomenys",username:"Vartotojo vardas",password:"Slaptažodis",login:"Prisijungti"},b={number:"Skaičius"},y={plot:"Grafikas"},v={radio:"Pasirinkimo mygtukas"},f={slider:"Slankiklis"},j={drop_to_upload:"Įkelkite vaizdo įrašo failą čia"},P={edit:"Redaguoti",retry:"Bandyti dar kartą",undo:"Atšaukti",submit:"Pateikti",cancel:"Atšaukti",like:"Patinka",dislike:"Nepatinka",clear:"Išvalyti pokalbį"},h={_name:i,common:a,upload_text:e,"3D_model":{"3d_model":"3D modelis",drop_to_upload:"Įkelkite 3D modelio failą (.obj, .glb, .stl, .gltf, .splat arba .ply) čia"},annotated_image:t,audio:o,blocks:r,checkbox:s,code:l,color_picker:n,dataframe:d,dropdown:u,errors:k,file:p,highlighted_text:_,image:c,label:m,login:g,number:b,plot:y,radio:v,slider:f,video:j,chatbot:P};export{i as _name,t as annotated_image,o as audio,r as blocks,P as chatbot,s as checkbox,l as code,n as color_picker,a as common,d as dataframe,h as default,u as dropdown,k as errors,p as file,_ as highlighted_text,c as image,m as label,g as login,b as number,y as plot,v as radio,f as slider,e as upload_text,j as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mainUVVaryingDeclaration-CYLIf35n.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mainUVVaryingDeclaration-CYLIf35n.js new file mode 100644 index 0000000000000000000000000000000000000000..fb3ee704cd889e952588a2c8bb455643784f7efa --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mainUVVaryingDeclaration-CYLIf35n.js @@ -0,0 +1,4 @@ +import{S as e}from"./index-CDrXokXW.js";const a="mainUVVaryingDeclaration",r=`#ifdef MAINUV{X} +varying vec2 vMainUV{X}; +#endif +`;e.IncludesShadersStore[a]||(e.IncludesShadersStore[a]=r); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mainUVVaryingDeclaration-gz09aLXv.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mainUVVaryingDeclaration-gz09aLXv.js new file mode 100644 index 0000000000000000000000000000000000000000..ca8767d97401f2ea8e5df3c633b620de1c5c73b8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mainUVVaryingDeclaration-gz09aLXv.js @@ -0,0 +1,4 @@ +import{S as e}from"./index-CDrXokXW.js";const a="mainUVVaryingDeclaration",r=`#ifdef MAINUV{X} +varying vMainUV{X}: vec2f; +#endif +`;e.IncludesShadersStoreWGSL[a]||(e.IncludesShadersStoreWGSL[a]=r); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mcp-DNm9doVd.svg b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mcp-DNm9doVd.svg new file mode 100644 index 0000000000000000000000000000000000000000..50e023b102b42faea998ce427e90d07a2b86ec7b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mcp-DNm9doVd.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mermaid.core-7TB2QPZo.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mermaid.core-7TB2QPZo.js new file mode 100644 index 0000000000000000000000000000000000000000..0feba7a035e0a8b5ef31637240694cf26e918448 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mermaid.core-7TB2QPZo.js @@ -0,0 +1,250 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dagre-6UL2VRFP-BN0m3k96.js","./graph-BVwx8Qtr.js","./_baseUniq-DT1kfcxk.js","./layout-BrVEphHT.js","./min-ljrXhbfm.js","./clone-CREevivd.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./i18n-Dnhn5Rxr.js","./i18n-9kYrHpuJ.css","./step-B-Gbak1k.js","./dispatch-kxCwF96_.js","./select-BigU4G0v.js","./cose-bilkent-S5V4N54A-D75Zovpi.js","./cytoscape.esm-5J0xJHOV.js","./c4Diagram-YG6GDRKO-DjbbCTFy.js","./chunk-TZMSLE5B-bT_t1BIn.js","./flowDiagram-NV44I4VS-D9HAgoN0.js","./chunk-FMBD7UC4-DNqeu8Dh.js","./chunk-55IACEB6-d9HCWWHk.js","./chunk-QN33PNHL-w0eYMV5T.js","./channel-CA-Tyyit.js","./erDiagram-Q2GNP2WA-BA7V4EyD.js","./gitGraphDiagram-NY62KEGX-BgYjZPZA.js","./chunk-4BX2VUAB-Zuu4IE0p.js","./chunk-QZHKN3VN-DkLSlLbb.js","./treemap-KMMF4GRG-B4w9v4mX.js","./ganttDiagram-JELNMOA3-j8t2SK-P.js","./time-BMaLdJ6b.js","./linear-8mDBZVC7.js","./init-Dmth1JHB.js","./defaultLocale-CzDG__Ur.js","./infoDiagram-WHAUD3N6-MJfiAORX.js","./pieDiagram-ADFJNKIX-CMO7fUEe.js","./arc-Bt_eNeYl.js","./ordinal-BeghXfj9.js","./quadrantDiagram-AYHSOK5B-PRy5QUyE.js","./xychartDiagram-PRI3JC2R-DG74V_zU.js","./range-OtVwhkKS.js","./requirementDiagram-UZGBJVZJ-C2v_TNfg.js","./sequenceDiagram-WL72ISMW-BAq_mB_E.js","./classDiagram-2ON5EDUG-ByHtPLEH.js","./chunk-B4BG7PRW-D5EXR74z.js","./classDiagram-v2-WZHVMYZB-ByHtPLEH.js","./stateDiagram-FKZM4ZOC-BLr48BHD.js","./chunk-DI55MBZ5-vHqaMaYD.js","./stateDiagram-v2-4FDKWEC3-BnlJCfwo.js","./journeyDiagram-XKPGCS4Q-CF8rya2c.js","./timeline-definition-IT6M3QCI-BjzgPbAR.js","./mindmap-definition-VGOIOE7T-BSbRsNcp.js","./kanban-definition-3W4ZIXB7-DqtHVgz8.js","./sankeyDiagram-TZEHDZUN-DvP84S6l.js","./colors-Cc3OSVma.js","./diagram-S2PKOQOG-CEnWRsMT.js","./diagram-QEK2KX5R-D6_C2dWJ.js","./blockDiagram-VD42YOAC-BIkysrgD.js","./architectureDiagram-VXUJARFQ-Od4R8hlz.js","./diagram-PSM6KHXK-CdCLy2g4.js","./index-BU4IRnz1.js"])))=>i.map(i=>d[i]); +import{af as pt}from"./index-DWyDLubb.js";import{G as jp}from"./i18n-Dnhn5Rxr.js";import{a4 as Yp,a6 as Up,q as Gp,r as Mo,u as Eo,v as Vp,a3 as Xp,a2 as Zp,a5 as Kp,D as Xl,E as Zl,F as Kl,G as Ql,I as Jl,H as tc,J as Qp,K as Bn,N as ec,L as Jp,M as tg,Q as rc,P as eg,O as rg,S as ig,T as ag,U as ng,k as qi,l as sg}from"./step-B-Gbak1k.js";import{d as og}from"./dispatch-kxCwF96_.js";import{n as ic,m as lg,a as cg,b as hg,c as La,d as li,s as ht}from"./select-BigU4G0v.js";var $o={name:"mermaid",version:"11.12.2",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.1.1","@iconify/utils":"^3.0.1","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.13",dayjs:"^1.11.18",dompurify:"^3.2.5",katex:"^0.16.22",khroma:"^2.1.0","lodash-es":"^4.17.21",marked:"^16.2.1",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.5","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",canvas:"^3.1.2",chokidar:"3.6.0",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.1.0",jison:"^0.4.18","js-base64":"^3.7.8",jsdom:"^26.1.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.3",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.13","type-fest":"^4.35.0",typedoc:"^0.28.12","typedoc-plugin-markdown":"^4.8.1",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.6.4","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}},Hi={exports:{}},ug=Hi.exports,Fo;function dg(){return Fo||(Fo=1,(function(e,t){(function(r,i){e.exports=i()})(ug,(function(){var r=1e3,i=6e4,a=36e5,n="millisecond",s="second",o="minute",l="hour",c="day",h="week",u="month",d="quarter",f="year",g="date",m="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(B){var A=["th","st","nd","rd"],_=B%100;return"["+B+(A[(_-20)%10]||A[_]||A[0])+"]"}},k=function(B,A,_){var $=String(B);return!$||$.length>=A?B:""+Array(A+1-$.length).join(_)+B},v={s:k,z:function(B){var A=-B.utcOffset(),_=Math.abs(A),$=Math.floor(_/60),M=_%60;return(A<=0?"+":"-")+k($,2,"0")+":"+k(M,2,"0")},m:function B(A,_){if(A.date()<_.date())return-B(_,A);var $=12*(_.year()-A.year())+(_.month()-A.month()),M=A.clone().add($,u),q=_-M<0,V=A.clone().add($+(q?-1:1),u);return+(-($+(_-M)/(q?M-V:V-M))||0)},a:function(B){return B<0?Math.ceil(B)||0:Math.floor(B)},p:function(B){return{M:u,y:f,w:h,d:c,D:g,h:l,m:o,s,ms:n,Q:d}[B]||String(B||"").toLowerCase().replace(/s$/,"")},u:function(B){return B===void 0}},w="en",L={};L[w]=b;var T="$isDayjsObject",D=function(B){return B instanceof N||!(!B||!B[T])},I=function B(A,_,$){var M;if(!A)return w;if(typeof A=="string"){var q=A.toLowerCase();L[q]&&(M=q),_&&(L[q]=_,M=q);var V=A.split("-");if(!M&&V.length>1)return B(V[0])}else{var K=A.name;L[K]=A,M=K}return!$&&M&&(w=M),M||!$&&w},O=function(B,A){if(D(B))return B.clone();var _=typeof A=="object"?A:{};return _.date=B,_.args=arguments,new N(_)},E=v;E.l=I,E.i=D,E.w=function(B,A){return O(B,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var N=(function(){function B(_){this.$L=I(_.locale,null,!0),this.parse(_),this.$x=this.$x||_.x||{},this[T]=!0}var A=B.prototype;return A.parse=function(_){this.$d=(function($){var M=$.date,q=$.utc;if(M===null)return new Date(NaN);if(E.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var V=M.match(y);if(V){var K=V[2]-1||0,J=(V[7]||"0").substring(0,3);return q?new Date(Date.UTC(V[1],K,V[3]||1,V[4]||0,V[5]||0,V[6]||0,J)):new Date(V[1],K,V[3]||1,V[4]||0,V[5]||0,V[6]||0,J)}}return new Date(M)})(_),this.init()},A.init=function(){var _=this.$d;this.$y=_.getFullYear(),this.$M=_.getMonth(),this.$D=_.getDate(),this.$W=_.getDay(),this.$H=_.getHours(),this.$m=_.getMinutes(),this.$s=_.getSeconds(),this.$ms=_.getMilliseconds()},A.$utils=function(){return E},A.isValid=function(){return this.$d.toString()!==m},A.isSame=function(_,$){var M=O(_);return this.startOf($)<=M&&M<=this.endOf($)},A.isAfter=function(_,$){return O(_)ac(e,"name",{value:t,configurable:!0}),gg=(e,t)=>{for(var r in t)ac(e,r,{get:t[r],enumerable:!0})},Te={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},F={trace:p((...e)=>{},"trace"),debug:p((...e)=>{},"debug"),info:p((...e)=>{},"info"),warn:p((...e)=>{},"warn"),error:p((...e)=>{},"error"),fatal:p((...e)=>{},"fatal")},Cs=p(function(e="fatal"){let t=Te.fatal;typeof e=="string"?e.toLowerCase()in Te&&(t=Te[e]):typeof e=="number"&&(t=e),F.trace=()=>{},F.debug=()=>{},F.info=()=>{},F.warn=()=>{},F.error=()=>{},F.fatal=()=>{},t<=Te.fatal&&(F.fatal=console.error?console.error.bind(console,Kt("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Kt("FATAL"))),t<=Te.error&&(F.error=console.error?console.error.bind(console,Kt("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Kt("ERROR"))),t<=Te.warn&&(F.warn=console.warn?console.warn.bind(console,Kt("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Kt("WARN"))),t<=Te.info&&(F.info=console.info?console.info.bind(console,Kt("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Kt("INFO"))),t<=Te.debug&&(F.debug=console.debug?console.debug.bind(console,Kt("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Kt("DEBUG"))),t<=Te.trace&&(F.trace=console.debug?console.debug.bind(console,Kt("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Kt("TRACE")))},"setLogLevel"),Kt=p(e=>`%c${pg().format("ss.SSS")} : ${e} : `,"format");const ji={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const a=r<.5?r*(1+t):r+t-r*t,n=2*r-a;switch(i){case"r":return ji.hue2rgb(n,a,e+1/3)*255;case"g":return ji.hue2rgb(n,a,e)*255;case"b":return ji.hue2rgb(n,a,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;const a=Math.max(e,t,r),n=Math.min(e,t,r),s=(a+n)/2;if(i==="l")return s*100;if(a===n)return 0;const o=a-n,l=s>.5?o/(2-a-n):o/(a+n);if(i==="s")return l*100;switch(a){case e:return((t-r)/o+(tt>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},yg={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},st={channel:ji,lang:mg,unit:yg},Re={};for(let e=0;e<=255;e++)Re[e]=st.unit.dec2hex(e);const Ft={ALL:0,RGB:1,HSL:2};class xg{constructor(){this.type=Ft.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=Ft.ALL}is(t){return this.type===t}}class bg{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new xg}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=Ft.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:i,l:a}=t;r===void 0&&(t.h=st.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=st.channel.rgb2hsl(t,"s")),a===void 0&&(t.l=st.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:i,b:a}=t;r===void 0&&(t.r=st.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=st.channel.hsl2rgb(t,"g")),a===void 0&&(t.b=st.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(Ft.HSL)&&r!==void 0?r:(this._ensureHSL(),st.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(Ft.HSL)&&r!==void 0?r:(this._ensureHSL(),st.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(Ft.HSL)&&r!==void 0?r:(this._ensureHSL(),st.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(Ft.RGB)&&r!==void 0?r:(this._ensureRGB(),st.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(Ft.RGB)&&r!==void 0?r:(this._ensureRGB(),st.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(Ft.RGB)&&r!==void 0?r:(this._ensureRGB(),st.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(Ft.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(Ft.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(Ft.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(Ft.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(Ft.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(Ft.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const Aa=new bg({r:0,g:0,b:0,a:0},"transparent"),kr={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(kr.re);if(!t)return;const r=t[1],i=parseInt(r,16),a=r.length,n=a%4===0,s=a>4,o=s?1:17,l=s?8:4,c=n?0:-1,h=s?255:15;return Aa.set({r:(i>>l*(c+3)&h)*o,g:(i>>l*(c+2)&h)*o,b:(i>>l*(c+1)&h)*o,a:n?(i&h)*o/255:1},e)},stringify:e=>{const{r:t,g:r,b:i,a}=e;return a<1?`#${Re[Math.round(t)]}${Re[Math.round(r)]}${Re[Math.round(i)]}${Re[Math.round(a*255)]}`:`#${Re[Math.round(t)]}${Re[Math.round(r)]}${Re[Math.round(i)]}`}},Ke={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(Ke.hueRe);if(t){const[,r,i]=t;switch(i){case"grad":return st.channel.clamp.h(parseFloat(r)*.9);case"rad":return st.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return st.channel.clamp.h(parseFloat(r)*360)}}return st.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(Ke.re);if(!r)return;const[,i,a,n,s,o]=r;return Aa.set({h:Ke._hue2deg(i),s:st.channel.clamp.s(parseFloat(a)),l:st.channel.clamp.l(parseFloat(n)),a:s?st.channel.clamp.a(o?parseFloat(s)/100:parseFloat(s)):1},e)},stringify:e=>{const{h:t,s:r,l:i,a}=e;return a<1?`hsla(${st.lang.round(t)}, ${st.lang.round(r)}%, ${st.lang.round(i)}%, ${a})`:`hsl(${st.lang.round(t)}, ${st.lang.round(r)}%, ${st.lang.round(i)}%)`}},ri={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=ri.colors[e];if(t)return kr.parse(t)},stringify:e=>{const t=kr.stringify(e);for(const r in ri.colors)if(ri.colors[r]===t)return r}},Xr={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(Xr.re);if(!r)return;const[,i,a,n,s,o,l,c,h]=r;return Aa.set({r:st.channel.clamp.r(a?parseFloat(i)*2.55:parseFloat(i)),g:st.channel.clamp.g(s?parseFloat(n)*2.55:parseFloat(n)),b:st.channel.clamp.b(l?parseFloat(o)*2.55:parseFloat(o)),a:c?st.channel.clamp.a(h?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:i,a}=e;return a<1?`rgba(${st.lang.round(t)}, ${st.lang.round(r)}, ${st.lang.round(i)}, ${st.lang.round(a)})`:`rgb(${st.lang.round(t)}, ${st.lang.round(r)}, ${st.lang.round(i)})`}},xe={format:{keyword:ri,hex:kr,rgb:Xr,rgba:Xr,hsl:Ke,hsla:Ke},parse:e=>{if(typeof e!="string")return e;const t=kr.parse(e)||Xr.parse(e)||Ke.parse(e)||ri.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(Ft.HSL)||e.data.r===void 0?Ke.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?Xr.stringify(e):kr.stringify(e)},nc=(e,t)=>{const r=xe.parse(e);for(const i in t)r[i]=st.channel.clamp[i](t[i]);return xe.stringify(r)},ii=(e,t,r=0,i=1)=>{if(typeof e!="number")return nc(e,{a:t});const a=Aa.set({r:st.channel.clamp.r(e),g:st.channel.clamp.g(t),b:st.channel.clamp.b(r),a:st.channel.clamp.a(i)});return xe.stringify(a)},Cg=e=>{const{r:t,g:r,b:i}=xe.parse(e),a=.2126*st.channel.toLinear(t)+.7152*st.channel.toLinear(r)+.0722*st.channel.toLinear(i);return st.lang.round(a)},kg=e=>Cg(e)>=.5,xi=e=>!kg(e),sc=(e,t,r)=>{const i=xe.parse(e),a=i[t],n=st.channel.clamp[t](a+r);return a!==n&&(i[t]=n),xe.stringify(i)},H=(e,t)=>sc(e,"l",t),et=(e,t)=>sc(e,"l",-t),S=(e,t)=>{const r=xe.parse(e),i={};for(const a in t)t[a]&&(i[a]=r[a]+t[a]);return nc(e,i)},wg=(e,t,r=50)=>{const{r:i,g:a,b:n,a:s}=xe.parse(e),{r:o,g:l,b:c,a:h}=xe.parse(t),u=r/100,d=u*2-1,f=s-h,m=((d*f===-1?d:(d+f)/(1+d*f))+1)/2,y=1-m,x=i*m+o*y,b=a*m+l*y,k=n*m+c*y,v=s*u+h*(1-u);return ii(x,b,k,v)},z=(e,t=100)=>{const r=xe.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,wg(r,e,t)};const{entries:oc,setPrototypeOf:Do,isFrozen:vg,getPrototypeOf:Sg,getOwnPropertyDescriptor:Tg}=Object;let{freeze:jt,seal:Qt,create:Ln}=Object,{apply:An,construct:Mn}=typeof Reflect<"u"&&Reflect;jt||(jt=function(t){return t});Qt||(Qt=function(t){return t});An||(An=function(t,r){for(var i=arguments.length,a=new Array(i>2?i-2:0),n=2;n1?r-1:0),a=1;a1?r-1:0),a=1;a2&&arguments[2]!==void 0?arguments[2]:Yi;Do&&Do(e,null);let i=t.length;for(;i--;){let a=t[i];if(typeof a=="string"){const n=r(a);n!==a&&(vg(t)||(t[i]=n),a=n)}e[a]=!0}return e}function Eg(e){for(let t=0;t/gm),Rg=Qt(/\$\{[\w\W]*/gm),Ig=Qt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Pg=Qt(/^aria-[\-\w]+$/),lc=Qt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ng=Qt(/^(?:\w+script|data):/i),zg=Qt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),cc=Qt(/^html$/i),Wg=Qt(/^[a-z][.\w]*(-[.\w]+)+$/i);var zo=Object.freeze({__proto__:null,ARIA_ATTR:Pg,ATTR_WHITESPACE:zg,CUSTOM_ELEMENT:Wg,DATA_ATTR:Ig,DOCTYPE_NAME:cc,ERB_EXPR:Og,IS_ALLOWED_URI:lc,IS_SCRIPT_OR_DATA:Ng,MUSTACHE_EXPR:Dg,TMPLIT_EXPR:Rg});const qr={element:1,text:3,progressingInstruction:7,comment:8,document:9},qg=function(){return typeof window>"u"?null:window},Hg=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const a="data-tt-policy-suffix";r&&r.hasAttribute(a)&&(i=r.getAttribute(a));const n="dompurify"+(i?"#"+i:"");try{return t.createPolicy(n,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},Wo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function hc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qg();const t=tt=>hc(tt);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==qr.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const i=r,a=i.currentScript,{DocumentFragment:n,HTMLTemplateElement:s,Node:o,Element:l,NodeFilter:c,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:u,DOMParser:d,trustedTypes:f}=e,g=l.prototype,m=Wr(g,"cloneNode"),y=Wr(g,"remove"),x=Wr(g,"nextSibling"),b=Wr(g,"childNodes"),k=Wr(g,"parentNode");if(typeof s=="function"){const tt=r.createElement("template");tt.content&&tt.content.ownerDocument&&(r=tt.content.ownerDocument)}let v,w="";const{implementation:L,createNodeIterator:T,createDocumentFragment:D,getElementsByTagName:I}=r,{importNode:O}=i;let E=Wo();t.isSupported=typeof oc=="function"&&typeof k=="function"&&L&&L.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:N,ERB_EXPR:R,TMPLIT_EXPR:B,DATA_ATTR:A,ARIA_ATTR:_,IS_SCRIPT_OR_DATA:$,ATTR_WHITESPACE:M,CUSTOM_ELEMENT:q}=zo;let{IS_ALLOWED_URI:V}=zo,K=null;const J=ot({},[...Ro,...un,...dn,...fn,...Io]);let Z=null;const ct=ot({},[...Po,...pn,...No,...Di]);let nt=Object.seal(Ln(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ct=null,kt=null;const Nt=Object.seal(Ln(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ee=!0,xt=!0,re=!1,Oe=!0,ie=!1,_i=!0,Ue=!1,Qa=!1,Ja=!1,dr=!1,Bi=!1,Li=!1,fo=!0,po=!1;const Rp="user-content-";let tn=!0,Rr=!1,fr={},ue=null;const en=ot({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let go=null;const mo=ot({},["audio","video","img","source","image","track"]);let rn=null;const yo=ot({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ai="http://www.w3.org/1998/Math/MathML",Mi="http://www.w3.org/2000/svg",we="http://www.w3.org/1999/xhtml";let pr=we,an=!1,nn=null;const Ip=ot({},[Ai,Mi,we],cn);let Ei=ot({},["mi","mo","mn","ms","mtext"]),$i=ot({},["annotation-xml"]);const Pp=ot({},["title","style","font","a","script"]);let Ir=null;const Np=["application/xhtml+xml","text/html"],zp="text/html";let St=null,gr=null;const Wp=r.createElement("form"),xo=function(C){return C instanceof RegExp||C instanceof Function},sn=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(gr&&gr===C)){if((!C||typeof C!="object")&&(C={}),C=pe(C),Ir=Np.indexOf(C.PARSER_MEDIA_TYPE)===-1?zp:C.PARSER_MEDIA_TYPE,St=Ir==="application/xhtml+xml"?cn:Yi,K=ae(C,"ALLOWED_TAGS")?ot({},C.ALLOWED_TAGS,St):J,Z=ae(C,"ALLOWED_ATTR")?ot({},C.ALLOWED_ATTR,St):ct,nn=ae(C,"ALLOWED_NAMESPACES")?ot({},C.ALLOWED_NAMESPACES,cn):Ip,rn=ae(C,"ADD_URI_SAFE_ATTR")?ot(pe(yo),C.ADD_URI_SAFE_ATTR,St):yo,go=ae(C,"ADD_DATA_URI_TAGS")?ot(pe(mo),C.ADD_DATA_URI_TAGS,St):mo,ue=ae(C,"FORBID_CONTENTS")?ot({},C.FORBID_CONTENTS,St):en,Ct=ae(C,"FORBID_TAGS")?ot({},C.FORBID_TAGS,St):pe({}),kt=ae(C,"FORBID_ATTR")?ot({},C.FORBID_ATTR,St):pe({}),fr=ae(C,"USE_PROFILES")?C.USE_PROFILES:!1,ee=C.ALLOW_ARIA_ATTR!==!1,xt=C.ALLOW_DATA_ATTR!==!1,re=C.ALLOW_UNKNOWN_PROTOCOLS||!1,Oe=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ie=C.SAFE_FOR_TEMPLATES||!1,_i=C.SAFE_FOR_XML!==!1,Ue=C.WHOLE_DOCUMENT||!1,dr=C.RETURN_DOM||!1,Bi=C.RETURN_DOM_FRAGMENT||!1,Li=C.RETURN_TRUSTED_TYPE||!1,Ja=C.FORCE_BODY||!1,fo=C.SANITIZE_DOM!==!1,po=C.SANITIZE_NAMED_PROPS||!1,tn=C.KEEP_CONTENT!==!1,Rr=C.IN_PLACE||!1,V=C.ALLOWED_URI_REGEXP||lc,pr=C.NAMESPACE||we,Ei=C.MATHML_TEXT_INTEGRATION_POINTS||Ei,$i=C.HTML_INTEGRATION_POINTS||$i,nt=C.CUSTOM_ELEMENT_HANDLING||{},C.CUSTOM_ELEMENT_HANDLING&&xo(C.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(nt.tagNameCheck=C.CUSTOM_ELEMENT_HANDLING.tagNameCheck),C.CUSTOM_ELEMENT_HANDLING&&xo(C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(nt.attributeNameCheck=C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(nt.allowCustomizedBuiltInElements=C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ie&&(xt=!1),Bi&&(dr=!0),fr&&(K=ot({},Io),Z=[],fr.html===!0&&(ot(K,Ro),ot(Z,Po)),fr.svg===!0&&(ot(K,un),ot(Z,pn),ot(Z,Di)),fr.svgFilters===!0&&(ot(K,dn),ot(Z,pn),ot(Z,Di)),fr.mathMl===!0&&(ot(K,fn),ot(Z,No),ot(Z,Di))),C.ADD_TAGS&&(typeof C.ADD_TAGS=="function"?Nt.tagCheck=C.ADD_TAGS:(K===J&&(K=pe(K)),ot(K,C.ADD_TAGS,St))),C.ADD_ATTR&&(typeof C.ADD_ATTR=="function"?Nt.attributeCheck=C.ADD_ATTR:(Z===ct&&(Z=pe(Z)),ot(Z,C.ADD_ATTR,St))),C.ADD_URI_SAFE_ATTR&&ot(rn,C.ADD_URI_SAFE_ATTR,St),C.FORBID_CONTENTS&&(ue===en&&(ue=pe(ue)),ot(ue,C.FORBID_CONTENTS,St)),C.ADD_FORBID_CONTENTS&&(ue===en&&(ue=pe(ue)),ot(ue,C.ADD_FORBID_CONTENTS,St)),tn&&(K["#text"]=!0),Ue&&ot(K,["html","head","body"]),K.table&&(ot(K,["tbody"]),delete Ct.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw zr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw zr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=C.TRUSTED_TYPES_POLICY,w=v.createHTML("")}else v===void 0&&(v=Hg(f,a)),v!==null&&typeof w=="string"&&(w=v.createHTML(""));jt&&jt(C),gr=C}},bo=ot({},[...un,...dn,...$g]),Co=ot({},[...fn,...Fg]),qp=function(C){let P=k(C);(!P||!P.tagName)&&(P={namespaceURI:pr,tagName:"template"});const X=Yi(C.tagName),mt=Yi(P.tagName);return nn[C.namespaceURI]?C.namespaceURI===Mi?P.namespaceURI===we?X==="svg":P.namespaceURI===Ai?X==="svg"&&(mt==="annotation-xml"||Ei[mt]):!!bo[X]:C.namespaceURI===Ai?P.namespaceURI===we?X==="math":P.namespaceURI===Mi?X==="math"&&$i[mt]:!!Co[X]:C.namespaceURI===we?P.namespaceURI===Mi&&!$i[mt]||P.namespaceURI===Ai&&!Ei[mt]?!1:!Co[X]&&(Pp[X]||!bo[X]):!!(Ir==="application/xhtml+xml"&&nn[C.namespaceURI]):!1},de=function(C){Pr(t.removed,{element:C});try{k(C).removeChild(C)}catch{y(C)}},Ge=function(C,P){try{Pr(t.removed,{attribute:P.getAttributeNode(C),from:P})}catch{Pr(t.removed,{attribute:null,from:P})}if(P.removeAttribute(C),C==="is")if(dr||Bi)try{de(P)}catch{}else try{P.setAttribute(C,"")}catch{}},ko=function(C){let P=null,X=null;if(Ja)C=""+C;else{const wt=hn(C,/^[\r\n\t ]+/);X=wt&&wt[0]}Ir==="application/xhtml+xml"&&pr===we&&(C=''+C+"");const mt=v?v.createHTML(C):C;if(pr===we)try{P=new d().parseFromString(mt,Ir)}catch{}if(!P||!P.documentElement){P=L.createDocument(pr,"template",null);try{P.documentElement.innerHTML=an?w:mt}catch{}}const $t=P.body||P.documentElement;return C&&X&&$t.insertBefore(r.createTextNode(X),$t.childNodes[0]||null),pr===we?I.call(P,Ue?"html":"body")[0]:Ue?P.documentElement:$t},wo=function(C){return T.call(C.ownerDocument||C,C,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},on=function(C){return C instanceof u&&(typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||!(C.attributes instanceof h)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function")},vo=function(C){return typeof o=="function"&&C instanceof o};function ve(tt,C,P){Fi(tt,X=>{X.call(t,C,P,gr)})}const So=function(C){let P=null;if(ve(E.beforeSanitizeElements,C,null),on(C))return de(C),!0;const X=St(C.nodeName);if(ve(E.uponSanitizeElement,C,{tagName:X,allowedTags:K}),_i&&C.hasChildNodes()&&!vo(C.firstElementChild)&&zt(/<[/\w!]/g,C.innerHTML)&&zt(/<[/\w!]/g,C.textContent)||C.nodeType===qr.progressingInstruction||_i&&C.nodeType===qr.comment&&zt(/<[/\w]/g,C.data))return de(C),!0;if(!(Nt.tagCheck instanceof Function&&Nt.tagCheck(X))&&(!K[X]||Ct[X])){if(!Ct[X]&&_o(X)&&(nt.tagNameCheck instanceof RegExp&&zt(nt.tagNameCheck,X)||nt.tagNameCheck instanceof Function&&nt.tagNameCheck(X)))return!1;if(tn&&!ue[X]){const mt=k(C)||C.parentNode,$t=b(C)||C.childNodes;if($t&&mt){const wt=$t.length;for(let Ut=wt-1;Ut>=0;--Ut){const Se=m($t[Ut],!0);Se.__removalCount=(C.__removalCount||0)+1,mt.insertBefore(Se,x(C))}}}return de(C),!0}return C instanceof l&&!qp(C)||(X==="noscript"||X==="noembed"||X==="noframes")&&zt(/<\/no(script|embed|frames)/i,C.innerHTML)?(de(C),!0):(ie&&C.nodeType===qr.text&&(P=C.textContent,Fi([N,R,B],mt=>{P=Nr(P,mt," ")}),C.textContent!==P&&(Pr(t.removed,{element:C.cloneNode()}),C.textContent=P)),ve(E.afterSanitizeElements,C,null),!1)},To=function(C,P,X){if(fo&&(P==="id"||P==="name")&&(X in r||X in Wp))return!1;if(!(xt&&!kt[P]&&zt(A,P))){if(!(ee&&zt(_,P))){if(!(Nt.attributeCheck instanceof Function&&Nt.attributeCheck(P,C))){if(!Z[P]||kt[P]){if(!(_o(C)&&(nt.tagNameCheck instanceof RegExp&&zt(nt.tagNameCheck,C)||nt.tagNameCheck instanceof Function&&nt.tagNameCheck(C))&&(nt.attributeNameCheck instanceof RegExp&&zt(nt.attributeNameCheck,P)||nt.attributeNameCheck instanceof Function&&nt.attributeNameCheck(P,C))||P==="is"&&nt.allowCustomizedBuiltInElements&&(nt.tagNameCheck instanceof RegExp&&zt(nt.tagNameCheck,X)||nt.tagNameCheck instanceof Function&&nt.tagNameCheck(X))))return!1}else if(!rn[P]){if(!zt(V,Nr(X,M,""))){if(!((P==="src"||P==="xlink:href"||P==="href")&&C!=="script"&&Lg(X,"data:")===0&&go[C])){if(!(re&&!zt($,Nr(X,M,"")))){if(X)return!1}}}}}}}return!0},_o=function(C){return C!=="annotation-xml"&&hn(C,q)},Bo=function(C){ve(E.beforeSanitizeAttributes,C,null);const{attributes:P}=C;if(!P||on(C))return;const X={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Z,forceKeepAttr:void 0};let mt=P.length;for(;mt--;){const $t=P[mt],{name:wt,namespaceURI:Ut,value:Se}=$t,mr=St(wt),ln=Se;let At=wt==="value"?ln:Ag(ln);if(X.attrName=mr,X.attrValue=At,X.keepAttr=!0,X.forceKeepAttr=void 0,ve(E.uponSanitizeAttribute,C,X),At=X.attrValue,po&&(mr==="id"||mr==="name")&&(Ge(wt,C),At=Rp+At),_i&&zt(/((--!?|])>)|<\/(style|title|textarea)/i,At)){Ge(wt,C);continue}if(mr==="attributename"&&hn(At,"href")){Ge(wt,C);continue}if(X.forceKeepAttr)continue;if(!X.keepAttr){Ge(wt,C);continue}if(!Oe&&zt(/\/>/i,At)){Ge(wt,C);continue}ie&&Fi([N,R,B],Ao=>{At=Nr(At,Ao," ")});const Lo=St(C.nodeName);if(!To(Lo,mr,At)){Ge(wt,C);continue}if(v&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!Ut)switch(f.getAttributeType(Lo,mr)){case"TrustedHTML":{At=v.createHTML(At);break}case"TrustedScriptURL":{At=v.createScriptURL(At);break}}if(At!==ln)try{Ut?C.setAttributeNS(Ut,wt,At):C.setAttribute(wt,At),on(C)?de(C):Oo(t.removed)}catch{Ge(wt,C)}}ve(E.afterSanitizeAttributes,C,null)},Hp=function tt(C){let P=null;const X=wo(C);for(ve(E.beforeSanitizeShadowDOM,C,null);P=X.nextNode();)ve(E.uponSanitizeShadowNode,P,null),So(P),Bo(P),P.content instanceof n&&tt(P.content);ve(E.afterSanitizeShadowDOM,C,null)};return t.sanitize=function(tt){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},P=null,X=null,mt=null,$t=null;if(an=!tt,an&&(tt=""),typeof tt!="string"&&!vo(tt))if(typeof tt.toString=="function"){if(tt=tt.toString(),typeof tt!="string")throw zr("dirty is not a string, aborting")}else throw zr("toString is not a function");if(!t.isSupported)return tt;if(Qa||sn(C),t.removed=[],typeof tt=="string"&&(Rr=!1),Rr){if(tt.nodeName){const Se=St(tt.nodeName);if(!K[Se]||Ct[Se])throw zr("root node is forbidden and cannot be sanitized in-place")}}else if(tt instanceof o)P=ko(""),X=P.ownerDocument.importNode(tt,!0),X.nodeType===qr.element&&X.nodeName==="BODY"||X.nodeName==="HTML"?P=X:P.appendChild(X);else{if(!dr&&!ie&&!Ue&&tt.indexOf("<")===-1)return v&&Li?v.createHTML(tt):tt;if(P=ko(tt),!P)return dr?null:Li?w:""}P&&Ja&&de(P.firstChild);const wt=wo(Rr?tt:P);for(;mt=wt.nextNode();)So(mt),Bo(mt),mt.content instanceof n&&Hp(mt.content);if(Rr)return tt;if(dr){if(Bi)for($t=D.call(P.ownerDocument);P.firstChild;)$t.appendChild(P.firstChild);else $t=P;return(Z.shadowroot||Z.shadowrootmode)&&($t=O.call(i,$t,!0)),$t}let Ut=Ue?P.outerHTML:P.innerHTML;return Ue&&K["!doctype"]&&P.ownerDocument&&P.ownerDocument.doctype&&P.ownerDocument.doctype.name&&zt(cc,P.ownerDocument.doctype.name)&&(Ut=" +`+Ut),ie&&Fi([N,R,B],Se=>{Ut=Nr(Ut,Se," ")}),v&&Li?v.createHTML(Ut):Ut},t.setConfig=function(){let tt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};sn(tt),Qa=!0},t.clearConfig=function(){gr=null,Qa=!1},t.isValidAttribute=function(tt,C,P){gr||sn({});const X=St(tt),mt=St(C);return To(X,mt,P)},t.addHook=function(tt,C){typeof C=="function"&&Pr(E[tt],C)},t.removeHook=function(tt,C){if(C!==void 0){const P=_g(E[tt],C);return P===-1?void 0:Bg(E[tt],P,1)[0]}return Oo(E[tt])},t.removeHooks=function(tt){E[tt]=[]},t.removeAllHooks=function(){E=Wo()},t}var vr=hc(),uc=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,ai=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,jg=/\s*%%.*\n/gm,dc=class extends Error{static{p(this,"UnknownDiagramError")}constructor(e){super(e),this.name="UnknownDiagramError"}},er={},ks=p(function(e,t){e=e.replace(uc,"").replace(ai,"").replace(jg,` +`);for(const[r,{detector:i}]of Object.entries(er))if(i(e,t))return r;throw new dc(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),En=p((...e)=>{for(const{id:t,detector:r,loader:i}of e)fc(t,r,i)},"registerLazyLoadedDiagrams"),fc=p((e,t,r)=>{er[e]&&F.warn(`Detector with key ${e} already exists. Overwriting.`),er[e]={detector:t,loader:r},F.debug(`Detector with key ${e} added${r?" with loader":""}`)},"addDetector"),Yg=p(e=>er[e].loader,"getDiagramLoader"),$n=p((e,t,{depth:r=2,clobber:i=!1}={})=>{const a={depth:r,clobber:i};return Array.isArray(t)&&!Array.isArray(e)?(t.forEach(n=>$n(e,n,a)),e):Array.isArray(t)&&Array.isArray(e)?(t.forEach(n=>{e.includes(n)||e.push(n)}),e):e===void 0||r<=0?e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t:(t!==void 0&&typeof e=="object"&&typeof t=="object"&&Object.keys(t).forEach(n=>{typeof t[n]=="object"&&(e[n]===void 0||typeof e[n]=="object")?(e[n]===void 0&&(e[n]=Array.isArray(t[n])?[]:{}),e[n]=$n(e[n],t[n],{depth:r-1,clobber:i})):(i||typeof e[n]!="object"&&typeof t[n]!="object")&&(e[n]=t[n])}),e)},"assignWithDepth"),_t=$n,Ma="#ffffff",Ea="#f2f2f2",Wt=p((e,t)=>t?S(e,{s:-40,l:10}):S(e,{s:-40,l:-10}),"mkBorder"),Ug=class{static{p(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||S(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||S(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Wt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Wt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Wt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Wt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||z(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||z(this.tertiaryColor),this.lineColor=this.lineColor||z(this.background),this.arrowheadColor=this.arrowheadColor||z(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?et(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||et(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||z(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||H(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||et(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||et(this.mainBkg,10)):(this.rowOdd=this.rowOdd||H(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||H(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||S(this.primaryColor,{h:30}),this.cScale4=this.cScale4||S(this.primaryColor,{h:60}),this.cScale5=this.cScale5||S(this.primaryColor,{h:90}),this.cScale6=this.cScale6||S(this.primaryColor,{h:120}),this.cScale7=this.cScale7||S(this.primaryColor,{h:150}),this.cScale8=this.cScale8||S(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||S(this.primaryColor,{h:270}),this.cScale10=this.cScale10||S(this.primaryColor,{h:300}),this.cScale11=this.cScale11||S(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Gg=p(e=>{const t=new Ug;return t.calculate(e),t},"getThemeVariables"),Vg=class{static{p(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=H(this.primaryColor,16),this.tertiaryColor=S(this.primaryColor,{h:-160}),this.primaryBorderColor=z(this.background),this.secondaryBorderColor=Wt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Wt(this.tertiaryColor,this.darkMode),this.primaryTextColor=z(this.primaryColor),this.secondaryTextColor=z(this.secondaryColor),this.tertiaryTextColor=z(this.tertiaryColor),this.lineColor=z(this.background),this.textColor=z(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=H(z("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=ii(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.sectionBkgColor=et("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=et(this.sectionBkgColor,10),this.taskBorderColor=ii(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=ii(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||H(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||et(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd"}updateColors(){this.secondBkg=H(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=H(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=H(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=this.darkTextColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=S(this.primaryColor,{h:64}),this.fillType3=S(this.secondaryColor,{h:64}),this.fillType4=S(this.primaryColor,{h:-64}),this.fillType5=S(this.secondaryColor,{h:-64}),this.fillType6=S(this.primaryColor,{h:128}),this.fillType7=S(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||S(this.primaryColor,{h:30}),this.cScale4=this.cScale4||S(this.primaryColor,{h:60}),this.cScale5=this.cScale5||S(this.primaryColor,{h:90}),this.cScale6=this.cScale6||S(this.primaryColor,{h:120}),this.cScale7=this.cScale7||S(this.primaryColor,{h:150}),this.cScale8=this.cScale8||S(this.primaryColor,{h:210}),this.cScale9=this.cScale9||S(this.primaryColor,{h:270}),this.cScale10=this.cScale10||S(this.primaryColor,{h:300}),this.cScale11=this.cScale11||S(this.primaryColor,{h:330});for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Xg=p(e=>{const t=new Vg;return t.calculate(e),t},"getThemeVariables"),Zg=class{static{p(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=S(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=S(this.primaryColor,{h:-160}),this.primaryBorderColor=Wt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Wt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Wt(this.tertiaryColor,this.darkMode),this.primaryTextColor=z(this.primaryColor),this.secondaryTextColor=z(this.secondaryColor),this.tertiaryTextColor=z(this.tertiaryColor),this.lineColor=z(this.background),this.textColor=z(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=ii(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.updateColors()}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||S(this.primaryColor,{h:30}),this.cScale4=this.cScale4||S(this.primaryColor,{h:60}),this.cScale5=this.cScale5||S(this.primaryColor,{h:90}),this.cScale6=this.cScale6||S(this.primaryColor,{h:120}),this.cScale7=this.cScale7||S(this.primaryColor,{h:150}),this.cScale8=this.cScale8||S(this.primaryColor,{h:210}),this.cScale9=this.cScale9||S(this.primaryColor,{h:270}),this.cScale10=this.cScale10||S(this.primaryColor,{h:300}),this.cScale11=this.cScale11||S(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||et(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||et(this.tertiaryColor,40);for(let e=0;e{this[r]==="calculated"&&(this[r]=void 0)}),typeof e!="object"){this.updateColors();return}const t=Object.keys(e);t.forEach(r=>{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Kg=p(e=>{const t=new Zg;return t.calculate(e),t},"getThemeVariables"),Qg=class{static{p(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=H("#cde498",10),this.primaryBorderColor=Wt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Wt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Wt(this.tertiaryColor,this.darkMode),this.primaryTextColor=z(this.primaryColor),this.secondaryTextColor=z(this.secondaryColor),this.tertiaryTextColor=z(this.primaryColor),this.lineColor=z(this.background),this.textColor=z(this.background),this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.actorBorder=et(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||S(this.primaryColor,{h:30}),this.cScale4=this.cScale4||S(this.primaryColor,{h:60}),this.cScale5=this.cScale5||S(this.primaryColor,{h:90}),this.cScale6=this.cScale6||S(this.primaryColor,{h:120}),this.cScale7=this.cScale7||S(this.primaryColor,{h:150}),this.cScale8=this.cScale8||S(this.primaryColor,{h:210}),this.cScale9=this.cScale9||S(this.primaryColor,{h:270}),this.cScale10=this.cScale10||S(this.primaryColor,{h:300}),this.cScale11=this.cScale11||S(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||et(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||et(this.tertiaryColor,40);for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},Jg=p(e=>{const t=new Qg;return t.calculate(e),t},"getThemeVariables"),tm=class{static{p(this,"Theme")}constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=H(this.contrast,55),this.background="#ffffff",this.tertiaryColor=S(this.primaryColor,{h:-160}),this.primaryBorderColor=Wt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Wt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Wt(this.tertiaryColor,this.darkMode),this.primaryTextColor=z(this.primaryColor),this.secondaryTextColor=z(this.secondaryColor),this.tertiaryTextColor=z(this.tertiaryColor),this.lineColor=z(this.background),this.textColor=z(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||H(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.secondBkg=H(this.contrast,55),this.border2=this.contrast,this.actorBorder=H(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},em=p(e=>{const t=new tm;return t.calculate(e),t},"getThemeVariables"),Ae={base:{getThemeVariables:Gg},dark:{getThemeVariables:Xg},default:{getThemeVariables:Kg},forest:{getThemeVariables:Jg},neutral:{getThemeVariables:em}},fe={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:!0,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:""},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},pc={...fe,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:Ae.default.getThemeVariables(),sequence:{...fe.sequence,messageFont:p(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:p(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:p(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1},gantt:{...fe.gantt,tickInterval:void 0,useWidth:void 0},c4:{...fe.c4,useWidth:void 0,personFont:p(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...fe.flowchart,inheritDir:!1},external_personFont:p(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:p(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:p(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:p(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:p(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:p(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:p(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:p(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:p(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:p(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:p(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:p(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:p(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:p(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:p(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:p(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:p(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:p(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:p(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:p(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:p(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...fe.pie,useWidth:984},xyChart:{...fe.xyChart,useWidth:void 0},requirement:{...fe.requirement,useWidth:void 0},packet:{...fe.packet},radar:{...fe.radar},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","}},gc=p((e,t="")=>Object.keys(e).reduce((r,i)=>Array.isArray(e[i])?r:typeof e[i]=="object"&&e[i]!==null?[...r,t+i,...gc(e[i],"")]:[...r,t+i],[]),"keyify"),rm=new Set(gc(pc,"")),mc=pc,ra=p(e=>{if(F.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>ra(t));return}for(const t of Object.keys(e)){if(F.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!rm.has(t)||e[t]==null){F.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){F.debug("sanitizing object",t),ra(e[t]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const i of r)t.includes(i)&&(F.debug("sanitizing css option",t),e[t]=im(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const r=e.themeVariables[t];r?.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}F.debug("After sanitization",e)}},"sanitizeDirective"),im=p(e=>{let t=0,r=0;for(const i of e){if(t{let r=_t({},e),i={};for(const a of t)bc(a),i=_t(i,a);if(r=_t(r,i),i.theme&&i.theme in Ae){const a=_t({},ia),n=_t(a.themeVariables||{},i.themeVariables);r.theme&&r.theme in Ae&&(r.themeVariables=Ae[r.theme].getThemeVariables(n))}return ni=r,Cc(ni),ni},"updateCurrentConfig"),am=p(e=>(Vt=_t({},Sr),Vt=_t(Vt,e),e.theme&&Ae[e.theme]&&(Vt.themeVariables=Ae[e.theme].getThemeVariables(e.themeVariables)),$a(Vt,rr),Vt),"setSiteConfig"),nm=p(e=>{ia=_t({},e)},"saveConfigFromInitialize"),sm=p(e=>(Vt=_t(Vt,e),$a(Vt,rr),Vt),"updateSiteConfig"),yc=p(()=>_t({},Vt),"getSiteConfig"),xc=p(e=>(Cc(e),_t(ni,e),Ot()),"setConfig"),Ot=p(()=>_t({},ni),"getConfig"),bc=p(e=>{e&&(["secure",...Vt.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(F.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&bc(e[t])}))},"sanitize"),om=p(e=>{ra(e),e.fontFamily&&!e.themeVariables?.fontFamily&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),rr.push(e),$a(Vt,rr)},"addDirective"),aa=p((e=Vt)=>{rr=[],$a(e,rr)},"reset"),lm={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."},qo={},cm=p(e=>{qo[e]||(F.warn(lm[e]),qo[e]=!0)},"issueWarning"),Cc=p(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&cm("LAZY_LOAD_DEPRECATED")},"checkConfig"),WS=p(()=>{let e={};ia&&(e=_t(e,ia));for(const t of rr)e=_t(e,t);return e},"getUserDefinedConfig"),bi=//gi,hm=p(e=>e?vc(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),um=(()=>{let e=!1;return()=>{e||(kc(),e=!0)}})();function kc(){const e="data-temp-href-target";vr.addHook("beforeSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),vr.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}p(kc,"setupDompurifyHooks");var wc=p(e=>(um(),vr.sanitize(e)),"removeScript"),Ho=p((e,t)=>{if(t.flowchart?.htmlLabels!==!1){const r=t.securityLevel;r==="antiscript"||r==="strict"?e=wc(e):r!=="loose"&&(e=vc(e),e=e.replace(//g,">"),e=e.replace(/=/g,"="),e=gm(e))}return e},"sanitizeMore"),Jt=p((e,t)=>e&&(t.dompurifyConfig?e=vr.sanitize(Ho(e,t),t.dompurifyConfig).toString():e=vr.sanitize(Ho(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),dm=p((e,t)=>typeof e=="string"?Jt(e,t):e.flat().map(r=>Jt(r,t)),"sanitizeTextOrArray"),fm=p(e=>bi.test(e),"hasBreaks"),pm=p(e=>e.split(bi),"splitBreaks"),gm=p(e=>e.replace(/#br#/g,"
          "),"placeholderToBreak"),vc=p(e=>e.replace(bi,"#br#"),"breakToPlaceholder"),mm=p(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),Lt=p(e=>!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),ym=p(function(...e){const t=e.filter(r=>!isNaN(r));return Math.max(...t)},"getMax"),xm=p(function(...e){const t=e.filter(r=>!isNaN(r));return Math.min(...t)},"getMin"),jo=p(function(e){const t=e.split(/(,)/),r=[];for(let i=0;i0&&i+1Math.max(0,e.split(t).length-1),"countOccurrence"),bm=p((e,t)=>{const r=Fn(e,"~"),i=Fn(t,"~");return r===1&&i===1},"shouldCombineSets"),Cm=p(e=>{const t=Fn(e,"~");let r=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),r=!0);const i=[...e];let a=i.indexOf("~"),n=i.lastIndexOf("~");for(;a!==-1&&n!==-1&&a!==n;)i[a]="<",i[n]=">",a=i.indexOf("~"),n=i.lastIndexOf("~");return r&&i.unshift("~"),i.join("")},"processSet"),Yo=p(()=>window.MathMLElement!==void 0,"isMathMLSupported"),Dn=/\$\$(.*)\$\$/g,Tr=p(e=>(e.match(Dn)?.length??0)>0,"hasKatex"),qS=p(async(e,t)=>{const r=document.createElement("div");r.innerHTML=await ws(e,t),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0",document.querySelector("body")?.insertAdjacentElement("beforeend",r);const a={width:r.clientWidth,height:r.clientHeight};return r.remove(),a},"calculateMathMLDimensions"),km=p(async(e,t)=>{if(!Tr(e))return e;if(!(Yo()||t.legacyMathML||t.forceLegacyMathML))return e.replace(Dn,"MathML is unsupported in this environment.");{const{default:r}=await pt(async()=>{const{default:a}=await import("./katex-XbL3y5x-.js");return{default:a}},[],import.meta.url),i=t.forceLegacyMathML||!Yo()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(bi).map(a=>Tr(a)?`
          ${a}
          `:`
          ${a}
          `).join("").replace(Dn,(a,n)=>r.renderToString(n,{throwOnError:!0,displayMode:!0,output:i}).replace(/\n/g," ").replace(//g,""))}},"renderKatexUnsanitized"),ws=p(async(e,t)=>Jt(await km(e,t),t),"renderKatexSanitized"),Mr={getRows:hm,sanitizeText:Jt,sanitizeTextOrArray:dm,hasBreaks:fm,splitBreaks:pm,lineBreakRegex:bi,removeScript:wc,getUrl:mm,evaluate:Lt,getMax:ym,getMin:xm},wm=p(function(e,t){for(let r of t)e.attr(r[0],r[1])},"d3Attrs"),vm=p(function(e,t,r){let i=new Map;return r?(i.set("width","100%"),i.set("style",`max-width: ${t}px;`)):(i.set("height",e),i.set("width",t)),i},"calculateSvgSizeAttrs"),Sc=p(function(e,t,r,i){const a=vm(t,r,i);wm(e,a)},"configureSvgSize"),Sm=p(function(e,t,r,i){const a=t.node().getBBox(),n=a.width,s=a.height;F.info(`SVG bounds: ${n}x${s}`,a);let o=0,l=0;F.info(`Graph bounds: ${o}x${l}`,e),o=n+r*2,l=s+r*2,F.info(`Calculated bounds: ${o}x${l}`),Sc(t,l,o,i);const c=`${a.x-r} ${a.y-r} ${a.width+2*r} ${a.height+2*r}`;t.attr("viewBox",c)},"setupGraphViewbox"),Ui={},Tm=p((e,t,r)=>{let i="";return e in Ui&&Ui[e]?i=Ui[e](r):F.warn(`No theme found for ${e}`),` & { + font-family: ${r.fontFamily}; + font-size: ${r.fontSize}; + fill: ${r.textColor} + } + @keyframes edge-animation-frame { + from { + stroke-dashoffset: 0; + } + } + @keyframes dash { + to { + stroke-dashoffset: 0; + } + } + & .edge-animation-slow { + stroke-dasharray: 9,5 !important; + stroke-dashoffset: 900; + animation: dash 50s linear infinite; + stroke-linecap: round; + } + & .edge-animation-fast { + stroke-dasharray: 9,5 !important; + stroke-dashoffset: 900; + animation: dash 20s linear infinite; + stroke-linecap: round; + } + /* Classes common for multiple diagrams */ + + & .error-icon { + fill: ${r.errorBkgColor}; + } + & .error-text { + fill: ${r.errorTextColor}; + stroke: ${r.errorTextColor}; + } + + & .edge-thickness-normal { + stroke-width: 1px; + } + & .edge-thickness-thick { + stroke-width: 3.5px + } + & .edge-pattern-solid { + stroke-dasharray: 0; + } + & .edge-thickness-invisible { + stroke-width: 0; + fill: none; + } + & .edge-pattern-dashed{ + stroke-dasharray: 3; + } + .edge-pattern-dotted { + stroke-dasharray: 2; + } + + & .marker { + fill: ${r.lineColor}; + stroke: ${r.lineColor}; + } + & .marker.cross { + stroke: ${r.lineColor}; + } + + & svg { + font-family: ${r.fontFamily}; + font-size: ${r.fontSize}; + } + & p { + margin: 0 + } + + ${i} + + ${t} +`},"getStyles"),_m=p((e,t)=>{t!==void 0&&(Ui[e]=t)},"addStylesForDiagram"),Bm=Tm,Tc={};gg(Tc,{clear:()=>Lm,getAccDescription:()=>$m,getAccTitle:()=>Mm,getDiagramTitle:()=>Dm,setAccDescription:()=>Em,setAccTitle:()=>Am,setDiagramTitle:()=>Fm});var vs="",Ss="",Ts="",_s=p(e=>Jt(e,Ot()),"sanitizeText"),Lm=p(()=>{vs="",Ts="",Ss=""},"clear"),Am=p(e=>{vs=_s(e).replace(/^\s+/g,"")},"setAccTitle"),Mm=p(()=>vs,"getAccTitle"),Em=p(e=>{Ts=_s(e).replace(/\n\s+/g,` +`)},"setAccDescription"),$m=p(()=>Ts,"getAccDescription"),Fm=p(e=>{Ss=_s(e)},"setDiagramTitle"),Dm=p(()=>Ss,"getDiagramTitle"),Uo=F,Om=Cs,dt=Ot,HS=xc,jS=Sr,Bs=p(e=>Jt(e,dt()),"sanitizeText"),Rm=Sm,Im=p(()=>Tc,"getCommonDb"),na={},sa=p((e,t,r)=>{na[e]&&Uo.warn(`Diagram with id ${e} already registered. Overwriting.`),na[e]=t,r&&fc(e,r),_m(e,t.styles),t.injectUtils?.(Uo,Om,dt,Bs,Rm,Im(),()=>{})},"registerDiagram"),On=p(e=>{if(e in na)return na[e];throw new Pm(e)},"getDiagram"),Pm=class extends Error{static{p(this,"DiagramNotFoundError")}constructor(e){super(`Diagram ${e} not found.`)}};function Go(e,t,r){var i=new Yp;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,r),i}var Nm=og("start","end","cancel","interrupt"),zm=[],_c=0,Vo=1,Rn=2,Gi=3,Xo=4,In=5,Vi=6;function Fa(e,t,r,i,a,n){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;Wm(e,r,{name:t,index:i,group:a,on:Nm,tween:zm,time:n.time,delay:n.delay,duration:n.duration,ease:n.ease,timer:null,state:_c})}function Ls(e,t){var r=he(e,t);if(r.state>_c)throw new Error("too late; already scheduled");return r}function Ce(e,t){var r=he(e,t);if(r.state>Gi)throw new Error("too late; already running");return r}function he(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function Wm(e,t,r){var i=e.__transition,a;i[t]=r,r.timer=Up(n,0,r.time);function n(c){r.state=Vo,r.timer.restart(s,r.delay,r.time),r.delay<=c&&s(c-r.delay)}function s(c){var h,u,d,f;if(r.state!==Vo)return l();for(h in i)if(f=i[h],f.name===r.name){if(f.state===Gi)return Go(s);f.state===Xo?(f.state=Vi,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete i[h]):+hRn&&i.state=0&&(t=t.slice(0,r)),!t||t==="start"})}function xy(e,t,r){var i,a,n=yy(t)?Ls:Ce;return function(){var s=n(this,e),o=s.on;o!==i&&(a=(i=o).copy()).on(t,r),s.on=a}}function by(e,t){var r=this._id;return arguments.length<2?he(this.node(),r).on.on(e):this.each(xy(r,e,t))}function Cy(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function ky(){return this.on("end.remove",Cy(this._id))}function wy(e){var t=this._name,r=this._id;typeof e!="function"&&(e=cg(e));for(var i=this._groups,a=i.length,n=new Array(a),s=0;s{const{securityLevel:t}=dt();let r=ht("body");if(t==="sandbox"){const n=ht(`#i${e}`).node()?.contentDocument??document;r=ht(n.body)}return r.select(`#${e}`)},"selectSvgElement");function Ms(e){return typeof e>"u"||e===null}p(Ms,"isNothing");function Fc(e){return typeof e=="object"&&e!==null}p(Fc,"isObject");function Dc(e){return Array.isArray(e)?e:Ms(e)?[]:[e]}p(Dc,"toArray");function Oc(e,t){var r,i,a,n;if(t)for(n=Object.keys(t),r=0,i=n.length;ro&&(n=" ... ",t=i-o+n.length),r-i>o&&(s=" ...",r=i+o-s.length),{str:n+e.slice(t,r).replace(/\t/g,"→")+s,pos:i-t+n.length}}p(Xi,"getLine");function Zi(e,t){return Bt.repeat(" ",t-e.length)+e}p(Zi,"padStart");function Pc(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,i=[0],a=[],n,s=-1;n=r.exec(e.buffer);)a.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&s<0&&(s=i.length-2);s<0&&(s=i.length-1);var o="",l,c,h=Math.min(e.line+t.linesAfter,a.length).toString().length,u=t.maxLength-(t.indent+h+3);for(l=1;l<=t.linesBefore&&!(s-l<0);l++)c=Xi(e.buffer,i[s-l],a[s-l],e.position-(i[s]-i[s-l]),u),o=Bt.repeat(" ",t.indent)+Zi((e.line-l+1).toString(),h)+" | "+c.str+` +`+o;for(c=Xi(e.buffer,i[s],a[s],e.position,u),o+=Bt.repeat(" ",t.indent)+Zi((e.line+1).toString(),h)+" | "+c.str+` +`,o+=Bt.repeat("-",t.indent+h+3+c.pos)+`^ +`,l=1;l<=t.linesAfter&&!(s+l>=a.length);l++)c=Xi(e.buffer,i[s+l],a[s+l],e.position-(i[s]-i[s+l]),u),o+=Bt.repeat(" ",t.indent)+Zi((e.line+l+1).toString(),h)+" | "+c.str+` +`;return o.replace(/\n$/,"")}p(Pc,"makeSnippet");var t0=Pc,e0=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],r0=["scalar","sequence","mapping"];function Nc(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(i){t[String(i)]=r})}),t}p(Nc,"compileStyleAliases");function zc(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(e0.indexOf(r)===-1)throw new Xt('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=Nc(t.styleAliases||null),r0.indexOf(this.kind)===-1)throw new Xt('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}p(zc,"Type$1");var Rt=zc;function Pn(e,t){var r=[];return e[t].forEach(function(i){var a=r.length;r.forEach(function(n,s){n.tag===i.tag&&n.kind===i.kind&&n.multi===i.multi&&(a=s)}),r[a]=i}),r}p(Pn,"compileList");function Wc(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,r;function i(a){a.multi?(e.multi[a.kind].push(a),e.multi.fallback.push(a)):e[a.kind][a.tag]=e.fallback[a.tag]=a}for(p(i,"collectType"),t=0,r=arguments.length;t=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},"binary"),octal:p(function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},"octal"),decimal:p(function(e){return e.toString(10)},"decimal"),hexadecimal:p(function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),u0=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function th(e){return!(e===null||!u0.test(e)||e[e.length-1]==="_")}p(th,"resolveYamlFloat");function eh(e){var t,r;return t=e.replace(/_/g,"").toLowerCase(),r=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:r*parseFloat(t,10)}p(eh,"constructYamlFloat");var d0=/^[-+]?[0-9]+e/;function rh(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Bt.isNegativeZero(e))return"-0.0";return r=e.toString(10),d0.test(r)?r.replace("e",".e"):r}p(rh,"representYamlFloat");function ih(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||Bt.isNegativeZero(e))}p(ih,"isFloat");var f0=new Rt("tag:yaml.org,2002:float",{kind:"scalar",resolve:th,construct:eh,predicate:ih,represent:rh,defaultStyle:"lowercase"}),ah=o0.extend({implicit:[l0,c0,h0,f0]}),p0=ah,nh=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),sh=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function oh(e){return e===null?!1:nh.exec(e)!==null||sh.exec(e)!==null}p(oh,"resolveYamlTimestamp");function lh(e){var t,r,i,a,n,s,o,l=0,c=null,h,u,d;if(t=nh.exec(e),t===null&&(t=sh.exec(e)),t===null)throw new Error("Date resolve error");if(r=+t[1],i=+t[2]-1,a=+t[3],!t[4])return new Date(Date.UTC(r,i,a));if(n=+t[4],s=+t[5],o=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(h=+t[10],u=+(t[11]||0),c=(h*60+u)*6e4,t[9]==="-"&&(c=-c)),d=new Date(Date.UTC(r,i,a,n,s,o,l)),c&&d.setTime(d.getTime()-c),d}p(lh,"constructYamlTimestamp");function ch(e){return e.toISOString()}p(ch,"representYamlTimestamp");var g0=new Rt("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:oh,construct:lh,instanceOf:Date,represent:ch});function hh(e){return e==="<<"||e===null}p(hh,"resolveYamlMerge");var m0=new Rt("tag:yaml.org,2002:merge",{kind:"scalar",resolve:hh}),$s=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= +\r`;function uh(e){if(e===null)return!1;var t,r,i=0,a=e.length,n=$s;for(r=0;r64)){if(t<0)return!1;i+=6}return i%8===0}p(uh,"resolveYamlBinary");function dh(e){var t,r,i=e.replace(/[\r\n=]/g,""),a=i.length,n=$s,s=0,o=[];for(t=0;t>16&255),o.push(s>>8&255),o.push(s&255)),s=s<<6|n.indexOf(i.charAt(t));return r=a%4*6,r===0?(o.push(s>>16&255),o.push(s>>8&255),o.push(s&255)):r===18?(o.push(s>>10&255),o.push(s>>2&255)):r===12&&o.push(s>>4&255),new Uint8Array(o)}p(dh,"constructYamlBinary");function fh(e){var t="",r=0,i,a,n=e.length,s=$s;for(i=0;i>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]),r=(r<<8)+e[i];return a=n%3,a===0?(t+=s[r>>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]):a===2?(t+=s[r>>10&63],t+=s[r>>4&63],t+=s[r<<2&63],t+=s[64]):a===1&&(t+=s[r>>2&63],t+=s[r<<4&63],t+=s[64],t+=s[64]),t}p(fh,"representYamlBinary");function ph(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}p(ph,"isBinary");var y0=new Rt("tag:yaml.org,2002:binary",{kind:"scalar",resolve:uh,construct:dh,predicate:ph,represent:fh}),x0=Object.prototype.hasOwnProperty,b0=Object.prototype.toString;function gh(e){if(e===null)return!0;var t=[],r,i,a,n,s,o=e;for(r=0,i=o.length;r>10)+55296,(e-65536&1023)+56320)}p(Ah,"charFromCodepoint");var Mh=new Array(256),Eh=new Array(256);for(Ve=0;Ve<256;Ve++)Mh[Ve]=zn(Ve)?1:0,Eh[Ve]=zn(Ve);var Ve;function $h(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||kh,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}p($h,"State$1");function Fs(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=t0(r),new Xt(t,r)}p(Fs,"generateError");function Q(e,t){throw Fs(e,t)}p(Q,"throwError");function ci(e,t){e.onWarning&&e.onWarning.call(null,Fs(e,t))}p(ci,"throwWarning");var Ko={YAML:p(function(t,r,i){var a,n,s;t.version!==null&&Q(t,"duplication of %YAML directive"),i.length!==1&&Q(t,"YAML directive accepts exactly one argument"),a=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),a===null&&Q(t,"ill-formed argument of the YAML directive"),n=parseInt(a[1],10),s=parseInt(a[2],10),n!==1&&Q(t,"unacceptable YAML version of the document"),t.version=i[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&ci(t,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:p(function(t,r,i){var a,n;i.length!==2&&Q(t,"TAG directive accepts exactly two arguments"),a=i[0],n=i[1],Sh.test(a)||Q(t,"ill-formed tag handle (first argument) of the TAG directive"),Ne.call(t.tagMap,a)&&Q(t,'there is a previously declared suffix for "'+a+'" tag handle'),Th.test(n)||Q(t,"ill-formed tag prefix (second argument) of the TAG directive");try{n=decodeURIComponent(n)}catch{Q(t,"tag prefix is malformed: "+n)}t.tagMap[a]=n},"handleTagDirective")};function Me(e,t,r,i){var a,n,s,o;if(t1&&(e.result+=Bt.repeat(` +`,t-1))}p(Oa,"writeFoldedLines");function Fh(e,t,r){var i,a,n,s,o,l,c,h,u=e.kind,d=e.result,f;if(f=e.input.charCodeAt(e.position),qt(f)||Qe(f)||f===35||f===38||f===42||f===33||f===124||f===62||f===39||f===34||f===37||f===64||f===96||(f===63||f===45)&&(a=e.input.charCodeAt(e.position+1),qt(a)||r&&Qe(a)))return!1;for(e.kind="scalar",e.result="",n=s=e.position,o=!1;f!==0;){if(f===58){if(a=e.input.charCodeAt(e.position+1),qt(a)||r&&Qe(a))break}else if(f===35){if(i=e.input.charCodeAt(e.position-1),qt(i))break}else{if(e.position===e.lineStart&&Ci(e)||r&&Qe(f))break;if(le(f))if(l=e.line,c=e.lineStart,h=e.lineIndent,bt(e,!1,-1),e.lineIndent>=t){o=!0,f=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=l,e.lineStart=c,e.lineIndent=h;break}}o&&(Me(e,n,s,!1),Oa(e,e.line-l),n=s=e.position,o=!1),Pe(f)||(s=e.position+1),f=e.input.charCodeAt(++e.position)}return Me(e,n,s,!1),e.result?!0:(e.kind=u,e.result=d,!1)}p(Fh,"readPlainScalar");function Dh(e,t){var r,i,a;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,i=a=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(Me(e,i,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)i=e.position,e.position++,a=e.position;else return!0;else le(r)?(Me(e,i,a,!0),Oa(e,bt(e,!1,t)),i=a=e.position):e.position===e.lineStart&&Ci(e)?Q(e,"unexpected end of the document within a single quoted scalar"):(e.position++,a=e.position);Q(e,"unexpected end of the stream within a single quoted scalar")}p(Dh,"readSingleQuotedScalar");function Oh(e,t){var r,i,a,n,s,o;if(o=e.input.charCodeAt(e.position),o!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(o=e.input.charCodeAt(e.position))!==0;){if(o===34)return Me(e,r,e.position,!0),e.position++,!0;if(o===92){if(Me(e,r,e.position,!0),o=e.input.charCodeAt(++e.position),le(o))bt(e,!1,t);else if(o<256&&Mh[o])e.result+=Eh[o],e.position++;else if((s=Bh(o))>0){for(a=s,n=0;a>0;a--)o=e.input.charCodeAt(++e.position),(s=_h(o))>=0?n=(n<<4)+s:Q(e,"expected hexadecimal character");e.result+=Ah(n),e.position++}else Q(e,"unknown escape sequence");r=i=e.position}else le(o)?(Me(e,r,i,!0),Oa(e,bt(e,!1,t)),r=i=e.position):e.position===e.lineStart&&Ci(e)?Q(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}Q(e,"unexpected end of the stream within a double quoted scalar")}p(Oh,"readDoubleQuotedScalar");function Rh(e,t){var r=!0,i,a,n,s=e.tag,o,l=e.anchor,c,h,u,d,f,g=Object.create(null),m,y,x,b;if(b=e.input.charCodeAt(e.position),b===91)h=93,f=!1,o=[];else if(b===123)h=125,f=!0,o={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),b=e.input.charCodeAt(++e.position);b!==0;){if(bt(e,!0,t),b=e.input.charCodeAt(e.position),b===h)return e.position++,e.tag=s,e.anchor=l,e.kind=f?"mapping":"sequence",e.result=o,!0;r?b===44&&Q(e,"expected the node content, but found ','"):Q(e,"missed comma between flow collection entries"),y=m=x=null,u=d=!1,b===63&&(c=e.input.charCodeAt(e.position+1),qt(c)&&(u=d=!0,e.position++,bt(e,!0,t))),i=e.line,a=e.lineStart,n=e.position,ir(e,t,la,!1,!0),y=e.tag,m=e.result,bt(e,!0,t),b=e.input.charCodeAt(e.position),(d||e.line===i)&&b===58&&(u=!0,b=e.input.charCodeAt(++e.position),bt(e,!0,t),ir(e,t,la,!1,!0),x=e.result),f?Je(e,o,g,y,m,x,i,a,n):u?o.push(Je(e,null,g,y,m,x,i,a,n)):o.push(m),bt(e,!0,t),b=e.input.charCodeAt(e.position),b===44?(r=!0,b=e.input.charCodeAt(++e.position)):r=!1}Q(e,"unexpected end of the stream within a flow collection")}p(Rh,"readFlowCollection");function Ih(e,t){var r,i,a=gn,n=!1,s=!1,o=t,l=0,c=!1,h,u;if(u=e.input.charCodeAt(e.position),u===124)i=!1;else if(u===62)i=!0;else return!1;for(e.kind="scalar",e.result="";u!==0;)if(u=e.input.charCodeAt(++e.position),u===43||u===45)gn===a?a=u===43?Zo:T0:Q(e,"repeat of a chomping mode identifier");else if((h=Lh(u))>=0)h===0?Q(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?Q(e,"repeat of an indentation width identifier"):(o=t+h-1,s=!0);else break;if(Pe(u)){do u=e.input.charCodeAt(++e.position);while(Pe(u));if(u===35)do u=e.input.charCodeAt(++e.position);while(!le(u)&&u!==0)}for(;u!==0;){for(Da(e),e.lineIndent=0,u=e.input.charCodeAt(e.position);(!s||e.lineIndento&&(o=e.lineIndent),le(u)){l++;continue}if(e.lineIndentt)&&l!==0)Q(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&(y&&(s=e.line,o=e.lineStart,l=e.position),ir(e,t,ca,!0,a)&&(y?g=e.result:m=e.result),y||(Je(e,u,d,f,g,m,s,o,l),f=g=m=null),bt(e,!0,-1),b=e.input.charCodeAt(e.position)),(e.line===n||e.lineIndent>t)&&b!==0)Q(e,"bad indentation of a mapping entry");else if(e.lineIndentt?l=1:e.lineIndent===t?l=0:e.lineIndentt?l=1:e.lineIndent===t?l=0:e.lineIndent tag; it should be "scalar", not "'+e.kind+'"'),u=0,d=e.implicitTypes.length;u"),e.result!==null&&g.kind!==e.kind&&Q(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Q(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||h}p(ir,"composeNode");function qh(e){var t=e.position,r,i,a,n=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(s=e.input.charCodeAt(e.position))!==0&&(bt(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(n=!0,s=e.input.charCodeAt(++e.position),r=e.position;s!==0&&!qt(s);)s=e.input.charCodeAt(++e.position);for(i=e.input.slice(r,e.position),a=[],i.length<1&&Q(e,"directive name must not be less than one character in length");s!==0;){for(;Pe(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!le(s));break}if(le(s))break;for(r=e.position;s!==0&&!qt(s);)s=e.input.charCodeAt(++e.position);a.push(e.input.slice(r,e.position))}s!==0&&Da(e),Ne.call(Ko,i)?Ko[i](e,i,a):ci(e,'unknown document directive "'+i+'"')}if(bt(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,bt(e,!0,-1)):n&&Q(e,"directives end mark is expected"),ir(e,e.lineIndent-1,ca,!1,!0),bt(e,!0,-1),e.checkLineBreaks&&B0.test(e.input.slice(t,e.position))&&ci(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Ci(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,bt(e,!0,-1));return}if(e.position"u"&&(r=t,t=null);var i=Ds(e,r);if(typeof t!="function")return i;for(var a=0,n=i.length;a=55296&&r<=56319&&t+1=56320&&i<=57343)?(r-55296)*1024+i-56320+65536:r}p(Cr,"codePointAt");function Rs(e){var t=/^\n* /;return t.test(e)}p(Rs,"needIndentIndicator");var iu=1,Gn=2,au=3,nu=4,xr=5;function su(e,t,r,i,a,n,s,o){var l,c=0,h=null,u=!1,d=!1,f=i!==-1,g=-1,m=eu(Cr(e,0))&&ru(Cr(e,e.length-1));if(t||s)for(l=0;l=65536?l+=2:l++){if(c=Cr(e,l),!Br(c))return xr;m=m&&Un(c,h,o),h=c}else{for(l=0;l=65536?l+=2:l++){if(c=Cr(e,l),c===hi)u=!0,f&&(d=d||l-g-1>i&&e[g+1]!==" ",g=l);else if(!Br(c))return xr;m=m&&Un(c,h,o),h=c}d=d||f&&l-g-1>i&&e[g+1]!==" "}return!u&&!d?m&&!s&&!a(e)?iu:n===ui?xr:Gn:r>9&&Rs(e)?xr:s?n===ui?xr:Gn:d?nu:au}p(su,"chooseScalarStyle");function ou(e,t,r,i,a){e.dump=(function(){if(t.length===0)return e.quotingType===ui?'""':"''";if(!e.noCompatMode&&(V0.indexOf(t)!==-1||X0.test(t)))return e.quotingType===ui?'"'+t+'"':"'"+t+"'";var n=e.indent*Math.max(1,r),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-n),o=i||e.flowLevel>-1&&r>=e.flowLevel;function l(c){return tu(e,c)}switch(p(l,"testAmbiguity"),su(t,o,e.indent,s,l,e.quotingType,e.forceQuotes&&!i,a)){case iu:return t;case Gn:return"'"+t.replace(/'/g,"''")+"'";case au:return"|"+Vn(t,e.indent)+Xn(jn(t,n));case nu:return">"+Vn(t,e.indent)+Xn(jn(lu(t,s),n));case xr:return'"'+cu(t)+'"';default:throw new Xt("impossible error: invalid scalar style")}})()}p(ou,"writeScalar");function Vn(e,t){var r=Rs(e)?String(t):"",i=e[e.length-1]===` +`,a=i&&(e[e.length-2]===` +`||e===` +`),n=a?"+":i?"":"-";return r+n+` +`}p(Vn,"blockHeader");function Xn(e){return e[e.length-1]===` +`?e.slice(0,-1):e}p(Xn,"dropEndingNewline");function lu(e,t){for(var r=/(\n+)([^\n]*)/g,i=(function(){var c=e.indexOf(` +`);return c=c!==-1?c:e.length,r.lastIndex=c,Zn(e.slice(0,c),t)})(),a=e[0]===` +`||e[0]===" ",n,s;s=r.exec(e);){var o=s[1],l=s[2];n=l[0]===" ",i+=o+(!a&&!n&&l!==""?` +`:"")+Zn(l,t),a=n}return i}p(lu,"foldString");function Zn(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,i,a=0,n,s=0,o=0,l="";i=r.exec(e);)o=i.index,o-a>t&&(n=s>a?s:o,l+=` +`+e.slice(a,n),a=n+1),s=o;return l+=` +`,e.length-a>t&&s>a?l+=e.slice(a,s)+` +`+e.slice(s+1):l+=e.slice(a),l.slice(1)}p(Zn,"foldLine");function cu(e){for(var t="",r=0,i,a=0;a=65536?a+=2:a++)r=Cr(e,a),i=Pt[r],!i&&Br(r)?(t+=e[a],r>=65536&&(t+=e[a+1])):t+=i||Qh(r);return t}p(cu,"escapeString");function hu(e,t,r){var i="",a=e.tag,n,s,o;for(n=0,s=r.length;n"u"&&be(e,t,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=a,e.dump="["+i+"]"}p(hu,"writeFlowSequence");function Kn(e,t,r,i){var a="",n=e.tag,s,o,l;for(s=0,o=r.length;s"u"&&be(e,t+1,null,!0,!0,!1,!0))&&((!i||a!=="")&&(a+=ua(e,t)),e.dump&&hi===e.dump.charCodeAt(0)?a+="-":a+="- ",a+=e.dump);e.tag=n,e.dump=a||"[]"}p(Kn,"writeBlockSequence");function uu(e,t,r){var i="",a=e.tag,n=Object.keys(r),s,o,l,c,h;for(s=0,o=n.length;s1024&&(h+="? "),h+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),be(e,t,c,!1,!1)&&(h+=e.dump,i+=h));e.tag=a,e.dump="{"+i+"}"}p(uu,"writeFlowMapping");function du(e,t,r,i){var a="",n=e.tag,s=Object.keys(r),o,l,c,h,u,d;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new Xt("sortKeys must be a boolean or a function");for(o=0,l=s.length;o1024,u&&(e.dump&&hi===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,u&&(d+=ua(e,t)),be(e,t+1,h,!0,u)&&(e.dump&&hi===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,a+=d));e.tag=n,e.dump=a||"{}"}p(du,"writeBlockMapping");function Qn(e,t,r){var i,a,n,s,o,l;for(a=r?e.explicitTypes:e.implicitTypes,n=0,s=a.length;n tag resolver accepts not "'+l+'" style');e.dump=i}return!0}return!1}p(Qn,"detectType");function be(e,t,r,i,a,n,s){e.tag=null,e.dump=r,Qn(e,r,!1)||Qn(e,r,!0);var o=jh.call(e.dump),l=i,c;i&&(i=e.flowLevel<0||e.flowLevel>t);var h=o==="[object Object]"||o==="[object Array]",u,d;if(h&&(u=e.duplicates.indexOf(r),d=u!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&t>0)&&(a=!1),d&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(h&&d&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),o==="[object Object]")i&&Object.keys(e.dump).length!==0?(du(e,t,e.dump,a),d&&(e.dump="&ref_"+u+e.dump)):(uu(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else if(o==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?Kn(e,t-1,e.dump,a):Kn(e,t,e.dump,a),d&&(e.dump="&ref_"+u+e.dump)):(hu(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else if(o==="[object String]")e.tag!=="?"&&ou(e,e.dump,t,n,l);else{if(o==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Xt("unacceptable kind of an object to dump "+o)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}p(be,"writeNode");function fu(e,t){var r=[],i=[],a,n;for(da(e,r,i),a=0,n=i.length;aArray.isArray(e)?{x:e[0],y:e[1]}:e,"pointTransformer"),ex=p(e=>({x:p(function(t,r,i){let a=0;const n=yt(i[0]).x=0?1:-1)}else if(r===i.length-1&&Object.hasOwn(Dt,e.arrowTypeEnd)){const{angle:f,deltaX:g}=Kr(i[i.length-1],i[i.length-2]);a=Dt[e.arrowTypeEnd]*Math.cos(f)*(g>=0?1:-1)}const s=Math.abs(yt(t).x-yt(i[i.length-1]).x),o=Math.abs(yt(t).y-yt(i[i.length-1]).y),l=Math.abs(yt(t).x-yt(i[0]).x),c=Math.abs(yt(t).y-yt(i[0]).y),h=Dt[e.arrowTypeStart],u=Dt[e.arrowTypeEnd],d=1;if(s0&&o0&&c=0?1:-1)}else if(r===i.length-1&&Object.hasOwn(Dt,e.arrowTypeEnd)){const{angle:f,deltaY:g}=Kr(i[i.length-1],i[i.length-2]);a=Dt[e.arrowTypeEnd]*Math.abs(Math.sin(f))*(g>=0?1:-1)}const s=Math.abs(yt(t).y-yt(i[i.length-1]).y),o=Math.abs(yt(t).x-yt(i[i.length-1]).x),l=Math.abs(yt(t).y-yt(i[0]).y),c=Math.abs(yt(t).x-yt(i[0]).x),h=Dt[e.arrowTypeStart],u=Dt[e.arrowTypeEnd],d=1;if(s0&&o0&&c{const t=e?.subGraphTitleMargin?.top??0,r=e?.subGraphTitleMargin?.bottom??0,i=t+r;return{subGraphTitleTopMargin:t,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:i}},"getSubGraphTitleMargins"),rx=p(e=>{const{handDrawnSeed:t}=dt();return{fill:e,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:e,seed:t}},"solidStateFill"),Er=p(e=>{const t=ix([...e.cssCompiledStyles||[],...e.cssStyles||[],...e.labelStyle||[]]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),ix=p(e=>{const t=new Map;return e.forEach(r=>{const[i,a]=r.split(":");t.set(i.trim(),a?.trim())}),t},"styles2Map"),pu=p(e=>e==="color"||e==="font-size"||e==="font-family"||e==="font-weight"||e==="font-style"||e==="text-decoration"||e==="text-align"||e==="text-transform"||e==="line-height"||e==="letter-spacing"||e==="word-spacing"||e==="text-shadow"||e==="text-overflow"||e==="white-space"||e==="word-wrap"||e==="word-break"||e==="overflow-wrap"||e==="hyphens","isLabelStyle"),U=p(e=>{const{stylesArray:t}=Er(e),r=[],i=[],a=[],n=[];return t.forEach(s=>{const o=s[0];pu(o)?r.push(s.join(":")+" !important"):(i.push(s.join(":")+" !important"),o.includes("stroke")&&a.push(s.join(":")+" !important"),o==="fill"&&n.push(s.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:i.join(";"),stylesArray:t,borderStyles:a,backgroundStyles:n}},"styles2String"),Y=p((e,t)=>{const{themeVariables:r,handDrawnSeed:i}=dt(),{nodeBorder:a,mainBkg:n}=r,{stylesMap:s}=Er(e);return Object.assign({roughness:.7,fill:s.get("fill")||n,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:s.get("stroke")||a,seed:i,strokeWidth:s.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0],strokeLineDash:ax(s.get("stroke-dasharray"))},t)},"userNodeOverrides"),ax=p(e=>{if(!e)return[0,0];const t=e.trim().split(/\s+/).map(Number);if(t.length===1){const a=isNaN(t[0])?0:t[0];return[a,a]}const r=isNaN(t[0])?0:t[0],i=isNaN(t[1])?0:t[1];return[r,i]},"getStrokeDashArray"),Hr={},Tt={},Jo;function nx(){return Jo||(Jo=1,Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.BLANK_URL=Tt.relativeFirstCharacters=Tt.whitespaceEscapeCharsRegex=Tt.urlSchemeRegex=Tt.ctrlCharactersRegex=Tt.htmlCtrlEntityRegex=Tt.htmlEntitiesRegex=Tt.invalidProtocolRegex=void 0,Tt.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,Tt.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,Tt.htmlCtrlEntityRegex=/&(newline|tab);/gi,Tt.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,Tt.urlSchemeRegex=/^.+(:|:)/gim,Tt.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,Tt.relativeFirstCharacters=[".","/"],Tt.BLANK_URL="about:blank"),Tt}var tl;function sx(){if(tl)return Hr;tl=1,Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.sanitizeUrl=void 0;var e=nx();function t(s){return e.relativeFirstCharacters.indexOf(s[0])>-1}function r(s){var o=s.replace(e.ctrlCharactersRegex,"");return o.replace(e.htmlEntitiesRegex,function(l,c){return String.fromCharCode(c)})}function i(s){return URL.canParse(s)}function a(s){try{return decodeURIComponent(s)}catch{return s}}function n(s){if(!s)return e.BLANK_URL;var o,l=a(s.trim());do l=r(l).replace(e.htmlCtrlEntityRegex,"").replace(e.ctrlCharactersRegex,"").replace(e.whitespaceEscapeCharsRegex,"").trim(),l=a(l),o=l.match(e.ctrlCharactersRegex)||l.match(e.htmlEntitiesRegex)||l.match(e.htmlCtrlEntityRegex)||l.match(e.whitespaceEscapeCharsRegex);while(o&&o.length>0);var c=l;if(!c)return e.BLANK_URL;if(t(c))return c;var h=c.trimStart(),u=h.match(e.urlSchemeRegex);if(!u)return c;var d=u[0].toLowerCase().trim();if(e.invalidProtocolRegex.test(d))return e.BLANK_URL;var f=h.replace(/\\/g,"/");if(d==="mailto:"||d.includes("://"))return f;if(d==="http:"||d==="https:"){if(!i(f))return e.BLANK_URL;var g=new URL(f);return g.protocol=g.protocol.toLowerCase(),g.hostname=g.hostname.toLowerCase(),g.toString()}return f}return Hr.sanitizeUrl=n,Hr}var ox=sx(),gu=typeof global=="object"&&global&&global.Object===Object&&global,lx=typeof self=="object"&&self&&self.Object===Object&&self,ke=gu||lx||Function("return this")(),fa=ke.Symbol,mu=Object.prototype,cx=mu.hasOwnProperty,hx=mu.toString,jr=fa?fa.toStringTag:void 0;function ux(e){var t=cx.call(e,jr),r=e[jr];try{e[jr]=void 0;var i=!0}catch{}var a=hx.call(e);return i&&(t?e[jr]=r:delete e[jr]),a}var dx=Object.prototype,fx=dx.toString;function px(e){return fx.call(e)}var gx="[object Null]",mx="[object Undefined]",el=fa?fa.toStringTag:void 0;function $r(e){return e==null?e===void 0?mx:gx:el&&el in Object(e)?ux(e):px(e)}function or(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var yx="[object AsyncFunction]",xx="[object Function]",bx="[object GeneratorFunction]",Cx="[object Proxy]";function Ps(e){if(!or(e))return!1;var t=$r(e);return t==xx||t==bx||t==yx||t==Cx}var mn=ke["__core-js_shared__"],rl=(function(){var e=/[^.]+$/.exec(mn&&mn.keys&&mn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function kx(e){return!!rl&&rl in e}var wx=Function.prototype,vx=wx.toString;function lr(e){if(e!=null){try{return vx.call(e)}catch{}try{return e+""}catch{}}return""}var Sx=/[\\^$.*+?()[\]{}|]/g,Tx=/^\[object .+?Constructor\]$/,_x=Function.prototype,Bx=Object.prototype,Lx=_x.toString,Ax=Bx.hasOwnProperty,Mx=RegExp("^"+Lx.call(Ax).replace(Sx,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ex(e){if(!or(e)||kx(e))return!1;var t=Ps(e)?Mx:Tx;return t.test(lr(e))}function $x(e,t){return e?.[t]}function cr(e,t){var r=$x(e,t);return Ex(r)?r:void 0}var fi=cr(Object,"create");function Fx(){this.__data__=fi?fi(null):{},this.size=0}function Dx(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ox="__lodash_hash_undefined__",Rx=Object.prototype,Ix=Rx.hasOwnProperty;function Px(e){var t=this.__data__;if(fi){var r=t[e];return r===Ox?void 0:r}return Ix.call(t,e)?t[e]:void 0}var Nx=Object.prototype,zx=Nx.hasOwnProperty;function Wx(e){var t=this.__data__;return fi?t[e]!==void 0:zx.call(t,e)}var qx="__lodash_hash_undefined__";function Hx(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=fi&&t===void 0?qx:t,this}function ar(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t-1}function Zx(e,t){var r=this.__data__,i=Ia(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}function De(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t-1&&e%1==0&&e<=vb}function za(e){return e!=null&&ku(e.length)&&!Ps(e)}function Sb(e){return wi(e)&&za(e)}function Tb(){return!1}var wu=typeof exports=="object"&&exports&&!exports.nodeType&&exports,cl=wu&&typeof module=="object"&&module&&!module.nodeType&&module,_b=cl&&cl.exports===wu,hl=_b?ke.Buffer:void 0,Bb=hl?hl.isBuffer:void 0,zs=Bb||Tb,Lb="[object Object]",Ab=Function.prototype,Mb=Object.prototype,vu=Ab.toString,Eb=Mb.hasOwnProperty,$b=vu.call(Object);function Fb(e){if(!wi(e)||$r(e)!=Lb)return!1;var t=bu(e);if(t===null)return!0;var r=Eb.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&vu.call(r)==$b}var Db="[object Arguments]",Ob="[object Array]",Rb="[object Boolean]",Ib="[object Date]",Pb="[object Error]",Nb="[object Function]",zb="[object Map]",Wb="[object Number]",qb="[object Object]",Hb="[object RegExp]",jb="[object Set]",Yb="[object String]",Ub="[object WeakMap]",Gb="[object ArrayBuffer]",Vb="[object DataView]",Xb="[object Float32Array]",Zb="[object Float64Array]",Kb="[object Int8Array]",Qb="[object Int16Array]",Jb="[object Int32Array]",t1="[object Uint8Array]",e1="[object Uint8ClampedArray]",r1="[object Uint16Array]",i1="[object Uint32Array]",gt={};gt[Xb]=gt[Zb]=gt[Kb]=gt[Qb]=gt[Jb]=gt[t1]=gt[e1]=gt[r1]=gt[i1]=!0;gt[Db]=gt[Ob]=gt[Gb]=gt[Rb]=gt[Vb]=gt[Ib]=gt[Pb]=gt[Nb]=gt[zb]=gt[Wb]=gt[qb]=gt[Hb]=gt[jb]=gt[Yb]=gt[Ub]=!1;function a1(e){return wi(e)&&ku(e.length)&&!!gt[$r(e)]}function n1(e){return function(t){return e(t)}}var Su=typeof exports=="object"&&exports&&!exports.nodeType&&exports,si=Su&&typeof module=="object"&&module&&!module.nodeType&&module,s1=si&&si.exports===Su,yn=s1&&gu.process,ul=(function(){try{var e=si&&si.require&&si.require("util").types;return e||yn&&yn.binding&&yn.binding("util")}catch{}})(),dl=ul&&ul.isTypedArray,Ws=dl?n1(dl):a1;function ts(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var o1=Object.prototype,l1=o1.hasOwnProperty;function c1(e,t,r){var i=e[t];(!(l1.call(e,t)&&Ra(i,r))||r===void 0&&!(t in e))&&Ns(e,t,r)}function h1(e,t,r,i){var a=!r;r||(r={});for(var n=-1,s=t.length;++n-1&&e%1==0&&e0){if(++t>=B1)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var E1=M1(_1);function $1(e,t){return E1(S1(e,t,Lu),e+"")}function F1(e,t,r){if(!or(r))return!1;var i=typeof t;return(i=="number"?za(r)&&Tu(t,r.length):i=="string"&&t in r)?Ra(r[t],e):!1}function D1(e){return $1(function(t,r){var i=-1,a=r.length,n=a>1?r[a-1]:void 0,s=a>2?r[2]:void 0;for(n=e.length>3&&typeof n=="function"?(a--,n):void 0,s&&F1(r[0],r[1],s)&&(n=a<3?void 0:n,a=1),t=Object(t);++io.args);ra(s),i=_t(i,[...s])}else i=r.args;if(!i)return;let a=ks(e,t);const n="config";return i[n]!==void 0&&(a==="flowchart-v2"&&(a="flowchart"),i[a]=i[n],delete i[n]),i},"detectInit"),Au=p(function(e,t=null){try{const r=new RegExp(`[%]{2}(?![{]${P1.source})(?=[}][%]{2}).* +`,"ig");e=e.trim().replace(r,"").replace(/'/gm,'"'),F.debug(`Detecting diagram directive${t!==null?" type:"+t:""} based on the text:${e}`);let i;const a=[];for(;(i=ai.exec(e))!==null;)if(i.index===ai.lastIndex&&ai.lastIndex++,i&&!t||t&&i[1]?.match(t)||t&&i[2]?.match(t)){const n=i[1]?i[1]:i[2],s=i[3]?i[3].trim():i[4]?JSON.parse(i[4].trim()):null;a.push({type:n,args:s})}return a.length===0?{type:e,args:null}:a.length===1?a[0]:a}catch(r){return F.error(`ERROR: ${r.message} - Unable to parse directive type: '${t}' based on the text: '${e}'`),{type:void 0,args:null}}},"detectDirective"),z1=p(function(e){return e.replace(ai,"")},"removeDirectives"),W1=p(function(e,t){for(const[r,i]of t.entries())if(i.match(e))return r;return-1},"isSubstringInArray");function qs(e,t){if(!e)return t;const r=`curve${e.charAt(0).toUpperCase()+e.slice(1)}`;return I1[r]??t}p(qs,"interpolateToCurve");function Mu(e,t){const r=e.trim();if(r)return t.securityLevel!=="loose"?ox.sanitizeUrl(r):r}p(Mu,"formatUrl");var q1=p((e,...t)=>{const r=e.split("."),i=r.length-1,a=r[i];let n=window;for(let s=0;s{r+=Hs(a,t),t=a});const i=r/2;return js(e,i)}p(Eu,"traverseEdge");function $u(e){return e.length===1?e[0]:Eu(e)}p($u,"calcLabelPosition");var pl=p((e,t=2)=>{const r=Math.pow(10,t);return Math.round(e*r)/r},"roundNumber"),js=p((e,t)=>{let r,i=t;for(const a of e){if(r){const n=Hs(a,r);if(n===0)return r;if(n=1)return{x:a.x,y:a.y};if(s>0&&s<1)return{x:pl((1-s)*r.x+s*a.x,5),y:pl((1-s)*r.y+s*a.y,5)}}}r=a}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),H1=p((e,t,r)=>{F.info(`our points ${JSON.stringify(t)}`),t[0]!==r&&(t=t.reverse());const a=js(t,25),n=e?10:5,s=Math.atan2(t[0].y-a.y,t[0].x-a.x),o={x:0,y:0};return o.x=Math.sin(s)*n+(t[0].x+a.x)/2,o.y=-Math.cos(s)*n+(t[0].y+a.y)/2,o},"calcCardinalityPosition");function Fu(e,t,r){const i=structuredClone(r);F.info("our points",i),t!=="start_left"&&t!=="start_right"&&i.reverse();const a=25+e,n=js(i,a),s=10+e*.5,o=Math.atan2(i[0].y-n.y,i[0].x-n.x),l={x:0,y:0};return t==="start_left"?(l.x=Math.sin(o+Math.PI)*s+(i[0].x+n.x)/2,l.y=-Math.cos(o+Math.PI)*s+(i[0].y+n.y)/2):t==="end_right"?(l.x=Math.sin(o-Math.PI)*s+(i[0].x+n.x)/2-5,l.y=-Math.cos(o-Math.PI)*s+(i[0].y+n.y)/2-5):t==="end_left"?(l.x=Math.sin(o)*s+(i[0].x+n.x)/2-5,l.y=-Math.cos(o)*s+(i[0].y+n.y)/2-5):(l.x=Math.sin(o)*s+(i[0].x+n.x)/2,l.y=-Math.cos(o)*s+(i[0].y+n.y)/2),l}p(Fu,"calcTerminalLabelPosition");function Du(e){let t="",r="";for(const i of e)i!==void 0&&(i.startsWith("color:")||i.startsWith("text-align:")?r=r+i+";":t=t+i+";");return{style:t,labelStyle:r}}p(Du,"getStylesFromArray");var gl=0,j1=p(()=>(gl++,"id-"+Math.random().toString(36).substr(2,12)+"-"+gl),"generateId");function Ou(e){let t="";const r="0123456789abcdef",i=r.length;for(let a=0;aOu(e.length),"random"),U1=p(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),G1=p(function(e,t){const r=t.text.replace(Mr.lineBreakRegex," "),[,i]=Wa(t.fontSize),a=e.append("text");a.attr("x",t.x),a.attr("y",t.y),a.style("text-anchor",t.anchor),a.style("font-family",t.fontFamily),a.style("font-size",i),a.style("font-weight",t.fontWeight),a.attr("fill",t.fill),t.class!==void 0&&a.attr("class",t.class);const n=a.append("tspan");return n.attr("x",t.x+t.textMargin*2),n.attr("fill",t.fill),n.text(r),a},"drawSimpleText"),V1=ki((e,t,r)=>{if(!e||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"
          "},r),Mr.lineBreakRegex.test(e)))return e;const i=e.split(" ").filter(Boolean),a=[];let n="";return i.forEach((s,o)=>{const l=$e(`${s} `,r),c=$e(n,r);if(l>t){const{hyphenatedStrings:d,remainingWord:f}=X1(s,t,"-",r);a.push(n,...d),n=f}else c+l>=t?(a.push(n),n=s):n=[n,s].filter(Boolean).join(" ");o+1===i.length&&a.push(n)}),a.filter(s=>s!=="").join(r.joinWith)},(e,t,r)=>`${e}${t}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),X1=ki((e,t,r="-",i)=>{i=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},i);const a=[...e],n=[];let s="";return a.forEach((o,l)=>{const c=`${s}${o}`;if($e(c,i)>=t){const u=l+1,d=a.length===u,f=`${c}${r}`;n.push(d?c:f),s=""}else s=c}),{hyphenatedStrings:n,remainingWord:s}},(e,t,r="-",i)=>`${e}${t}${r}${i.fontSize}${i.fontWeight}${i.fontFamily}`);function Ru(e,t){return Ys(e,t).height}p(Ru,"calculateTextHeight");function $e(e,t){return Ys(e,t).width}p($e,"calculateTextWidth");var Ys=ki((e,t)=>{const{fontSize:r=12,fontFamily:i="Arial",fontWeight:a=400}=t;if(!e)return{width:0,height:0};const[,n]=Wa(r),s=["sans-serif",i],o=e.split(Mr.lineBreakRegex),l=[],c=ht("body");if(!c.remove)return{width:0,height:0,lineHeight:0};const h=c.append("svg");for(const d of s){let f=0;const g={width:0,height:0,lineHeight:0};for(const m of o){const y=U1();y.text=m||R1;const x=G1(h,y).style("font-size",n).style("font-weight",a).style("font-family",d),b=(x._groups||x)[0][0].getBBox();if(b.width===0&&b.height===0)throw new Error("svg element not in render tree");g.width=Math.round(Math.max(g.width,b.width)),f=Math.round(b.height),g.height+=f,g.lineHeight=Math.round(Math.max(g.lineHeight,f))}l.push(g)}h.remove();const u=isNaN(l[1].height)||isNaN(l[1].width)||isNaN(l[1].lineHeight)||l[0].height>l[1].height&&l[0].width>l[1].width&&l[0].lineHeight>l[1].lineHeight?0:1;return l[u]},(e,t)=>`${e}${t.fontSize}${t.fontWeight}${t.fontFamily}`),Z1=class{constructor(e=!1,t){this.count=0,this.count=t?t.length:0,this.next=e?()=>this.count++:()=>Date.now()}static{p(this,"InitIDGenerator")}},Oi,K1=p(function(e){return Oi=Oi||document.createElement("div"),e=escape(e).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),Oi.innerHTML=e,unescape(Oi.textContent)},"entityDecode");function Us(e){return"str"in e}p(Us,"isDetailedError");var Q1=p((e,t,r,i)=>{if(!i)return;const a=e.node()?.getBBox();a&&e.append("text").text(i).attr("text-anchor","middle").attr("x",a.x+a.width/2).attr("y",-r).attr("class",t)},"insertTitle"),Wa=p(e=>{if(typeof e=="number")return[e,e+"px"];const t=parseInt(e??"",10);return Number.isNaN(t)?[void 0,void 0]:e===String(t)?[t,e+"px"]:[t,e]},"parseFontSize");function Gs(e,t){return O1({},e,t)}p(Gs,"cleanAndMerge");var oe={assignWithDepth:_t,wrapLabel:V1,calculateTextHeight:Ru,calculateTextWidth:$e,calculateTextDimensions:Ys,cleanAndMerge:Gs,detectInit:N1,detectDirective:Au,isSubstringInArray:W1,interpolateToCurve:qs,calcLabelPosition:$u,calcCardinalityPosition:H1,calcTerminalLabelPosition:Fu,formatUrl:Mu,getStylesFromArray:Du,generateId:j1,random:Y1,runFunc:q1,entityDecode:K1,insertTitle:Q1,isLabelCoordinateInPath:Iu,parseFontSize:Wa,InitIDGenerator:Z1},J1=p(function(e){let t=e;return t=t.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/#\w+;/g,function(r){const i=r.substring(1,r.length-1);return/^\+?\d+$/.test(i)?"fl°°"+i+"¶ß":"fl°"+i+"¶ß"}),t},"encodeEntities"),hr=p(function(e){return e.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),YS=p((e,t,{counter:r=0,prefix:i,suffix:a},n)=>n||`${i?`${i}_`:""}${e}_${t}_${r}${a?`_${a}`:""}`,"getEdgeId");function It(e){return e??null}p(It,"handleUndefinedAttr");function Iu(e,t){const r=Math.round(e.x),i=Math.round(e.y),a=t.replace(/(\d+\.\d+)/g,n=>Math.round(parseFloat(n)).toString());return a.includes(r.toString())||a.includes(i.toString())}p(Iu,"isLabelCoordinateInPath");const tC=Object.freeze({left:0,top:0,width:16,height:16}),ya=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Pu=Object.freeze({...tC,...ya}),eC=Object.freeze({...Pu,body:"",hidden:!1}),rC=Object.freeze({width:null,height:null}),iC=Object.freeze({...rC,...ya}),aC=(e,t,r,i="")=>{const a=e.split(":");if(e.slice(0,1)==="@"){if(a.length<2||a.length>3)return null;i=a.shift().slice(1)}if(a.length>3||!a.length)return null;if(a.length>1){const o=a.pop(),l=a.pop(),c={provider:a.length>0?a[0]:i,prefix:l,name:o};return xn(c)?c:null}const n=a[0],s=n.split("-");if(s.length>1){const o={provider:i,prefix:s.shift(),name:s.join("-")};return xn(o)?o:null}if(r&&i===""){const o={provider:i,prefix:"",name:n};return xn(o,r)?o:null}return null},xn=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;function nC(e,t){const r={};!e.hFlip!=!t.hFlip&&(r.hFlip=!0),!e.vFlip!=!t.vFlip&&(r.vFlip=!0);const i=((e.rotate||0)+(t.rotate||0))%4;return i&&(r.rotate=i),r}function ml(e,t){const r=nC(e,t);for(const i in eC)i in ya?i in e&&!(i in r)&&(r[i]=ya[i]):i in t?r[i]=t[i]:i in e&&(r[i]=e[i]);return r}function sC(e,t){const r=e.icons,i=e.aliases||Object.create(null),a=Object.create(null);function n(s){if(r[s])return a[s]=[];if(!(s in a)){a[s]=null;const o=i[s]&&i[s].parent,l=o&&n(o);l&&(a[s]=[o].concat(l))}return a[s]}return(t||Object.keys(r).concat(Object.keys(i))).forEach(n),a}function yl(e,t,r){const i=e.icons,a=e.aliases||Object.create(null);let n={};function s(o){n=ml(i[o]||a[o],n)}return s(t),r.forEach(s),ml(e,n)}function oC(e,t){if(e.icons[t])return yl(e,t,[]);const r=sC(e,[t])[t];return r?yl(e,t,r):null}const lC=/(-?[0-9.]*[0-9]+[0-9.]*)/g,cC=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function xl(e,t,r){if(t===1)return e;if(r=r||100,typeof e=="number")return Math.ceil(e*t*r)/r;if(typeof e!="string")return e;const i=e.split(lC);if(i===null||!i.length)return e;const a=[];let n=i.shift(),s=cC.test(n);for(;;){if(s){const o=parseFloat(n);isNaN(o)?a.push(n):a.push(Math.ceil(o*t*r)/r)}else a.push(n);if(n=i.shift(),n===void 0)return a.join("");s=!s}}function hC(e,t="defs"){let r="";const i=e.indexOf("<"+t);for(;i>=0;){const a=e.indexOf(">",i),n=e.indexOf("",n);if(s===-1)break;r+=e.slice(a+1,n).trim(),e=e.slice(0,i).trim()+e.slice(s+1)}return{defs:r,content:e}}function uC(e,t){return e?""+e+""+t:t}function dC(e,t,r){const i=hC(e);return uC(i.defs,t+i.content+r)}const fC=e=>e==="unset"||e==="undefined"||e==="none";function pC(e,t){const r={...Pu,...e},i={...iC,...t},a={left:r.left,top:r.top,width:r.width,height:r.height};let n=r.body;[r,i].forEach(m=>{const y=[],x=m.hFlip,b=m.vFlip;let k=m.rotate;x?b?k+=2:(y.push("translate("+(a.width+a.left).toString()+" "+(0-a.top).toString()+")"),y.push("scale(-1 1)"),a.top=a.left=0):b&&(y.push("translate("+(0-a.left).toString()+" "+(a.height+a.top).toString()+")"),y.push("scale(1 -1)"),a.top=a.left=0);let v;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:v=a.height/2+a.top,y.unshift("rotate(90 "+v.toString()+" "+v.toString()+")");break;case 2:y.unshift("rotate(180 "+(a.width/2+a.left).toString()+" "+(a.height/2+a.top).toString()+")");break;case 3:v=a.width/2+a.left,y.unshift("rotate(-90 "+v.toString()+" "+v.toString()+")");break}k%2===1&&(a.left!==a.top&&(v=a.left,a.left=a.top,a.top=v),a.width!==a.height&&(v=a.width,a.width=a.height,a.height=v)),y.length&&(n=dC(n,'',""))});const s=i.width,o=i.height,l=a.width,c=a.height;let h,u;s===null?(u=o===null?"1em":o==="auto"?c:o,h=xl(u,l/c)):(h=s==="auto"?l:s,u=o===null?xl(h,c/l):o==="auto"?c:o);const d={},f=(m,y)=>{fC(y)||(d[m]=y.toString())};f("width",h),f("height",u);const g=[a.left,a.top,l,c];return d.viewBox=g.join(" "),{attributes:d,viewBox:g,body:n}}const gC=/\sid="(\S+)"/g,bl=new Map;function mC(e){e=e.replace(/[0-9]+$/,"")||"a";const t=bl.get(e)||0;return bl.set(e,t+1),t?`${e}${t}`:e}function yC(e){const t=[];let r;for(;r=gC.exec(e);)t.push(r[1]);if(!t.length)return e;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(a=>{const n=mC(a),s=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+s+')([")]|\\.[a-z])',"g"),"$1"+n+i+"$3")}),e=e.replace(new RegExp(i,"g"),""),e}function xC(e,t){let r=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const i in t)r+=" "+i+'="'+t[i]+'"';return'"+e+""}function Vs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ur=Vs();function Nu(e){ur=e}var oi={exec:()=>null};function ut(e,t=""){let r=typeof e=="string"?e:e.source,i={replace:(a,n)=>{let s=typeof n=="string"?n:n.source;return s=s.replace(Ht.caret,"$1"),r=r.replace(a,s),i},getRegex:()=>new RegExp(r,t)};return i}var bC=(()=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},CC=/^(?:[ \t]*(?:\n|$))+/,kC=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,wC=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,vC=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Xs=/(?:[*+-]|\d{1,9}[.)])/,zu=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wu=ut(zu).replace(/bull/g,Xs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),SC=ut(zu).replace(/bull/g,Xs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Zs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,TC=/^[^\n]+/,Ks=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,_C=ut(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ks).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),BC=ut(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Xs).getRegex(),qa="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Qs=/|$))/,LC=ut("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Qs).replace("tag",qa).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qu=ut(Zs).replace("hr",vi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",qa).getRegex(),AC=ut(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qu).getRegex(),Js={blockquote:AC,code:kC,def:_C,fences:wC,heading:vC,hr:vi,html:LC,lheading:Wu,list:BC,newline:CC,paragraph:qu,table:oi,text:TC},Cl=ut("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",vi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",qa).getRegex(),MC={...Js,lheading:SC,table:Cl,paragraph:ut(Zs).replace("hr",vi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Cl).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",qa).getRegex()},EC={...Js,html:ut(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Qs).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:oi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ut(Zs).replace("hr",vi).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",Wu).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},$C=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,FC=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Hu=/^( {2,}|\\)\n(?!\s*$)/,DC=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",bC?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Uu=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,NC=ut(Uu,"u").replace(/punct/g,Ha).getRegex(),zC=ut(Uu,"u").replace(/punct/g,Yu).getRegex(),Gu="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",WC=ut(Gu,"gu").replace(/notPunctSpace/g,ju).replace(/punctSpace/g,to).replace(/punct/g,Ha).getRegex(),qC=ut(Gu,"gu").replace(/notPunctSpace/g,IC).replace(/punctSpace/g,RC).replace(/punct/g,Yu).getRegex(),HC=ut("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ju).replace(/punctSpace/g,to).replace(/punct/g,Ha).getRegex(),jC=ut(/\\(punct)/,"gu").replace(/punct/g,Ha).getRegex(),YC=ut(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),UC=ut(Qs).replace("(?:-->|$)","-->").getRegex(),GC=ut("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",UC).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),xa=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,VC=ut(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",xa).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Vu=ut(/^!?\[(label)\]\[(ref)\]/).replace("label",xa).replace("ref",Ks).getRegex(),Xu=ut(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ks).getRegex(),XC=ut("reflink|nolink(?!\\()","g").replace("reflink",Vu).replace("nolink",Xu).getRegex(),kl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,eo={_backpedal:oi,anyPunctuation:jC,autolink:YC,blockSkip:PC,br:Hu,code:FC,del:oi,emStrongLDelim:NC,emStrongRDelimAst:WC,emStrongRDelimUnd:HC,escape:$C,link:VC,nolink:Xu,punctuation:OC,reflink:Vu,reflinkSearch:XC,tag:GC,text:DC,url:oi},ZC={...eo,link:ut(/^!?\[(label)\]\((.*?)\)/).replace("label",xa).getRegex(),reflink:ut(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",xa).getRegex()},es={...eo,emStrongRDelimAst:qC,emStrongLDelim:zC,url:ut(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",kl).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ut(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},wl=e=>QC[e];function ge(e,t){if(t){if(Ht.escapeTest.test(e))return e.replace(Ht.escapeReplace,wl)}else if(Ht.escapeTestNoEncode.test(e))return e.replace(Ht.escapeReplaceNoEncode,wl);return e}function vl(e){try{e=encodeURI(e).replace(Ht.percentDecode,"%")}catch{return null}return e}function Sl(e,t){let r=e.replace(Ht.findPipe,(n,s,o)=>{let l=!1,c=s;for(;--c>=0&&o[c]==="\\";)l=!l;return l?"|":" |"}),i=r.split(Ht.splitPipe),a=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length0?-2:-1}function Tl(e,t,r,i,a){let n=t.href,s=t.title||null,o=e[1].replace(a.other.outputLinkReplace,"$1");i.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:n,title:s,text:o,tokens:i.inlineTokens(o)};return i.state.inLink=!1,l}function t2(e,t,r){let i=e.match(r.other.indentCodeCompensation);if(i===null)return t;let a=i[1];return t.split(` +`).map(n=>{let s=n.match(r.other.beginningSpace);if(s===null)return n;let[o]=s;return o.length>=a.length?n.slice(a.length):n}).join(` +`)}var ba=class{options;rules;lexer;constructor(t){this.options=t||ur}space(t){let r=this.rules.block.newline.exec(t);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(t){let r=this.rules.block.code.exec(t);if(r){let i=r[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?i:Ur(i,` +`)}}}fences(t){let r=this.rules.block.fences.exec(t);if(r){let i=r[0],a=t2(i,r[3]||"",this.rules);return{type:"code",raw:i,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:a}}}heading(t){let r=this.rules.block.heading.exec(t);if(r){let i=r[2].trim();if(this.rules.other.endingHash.test(i)){let a=Ur(i,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(i=a.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(t){let r=this.rules.block.hr.exec(t);if(r)return{type:"hr",raw:Ur(r[0],` +`)}}blockquote(t){let r=this.rules.block.blockquote.exec(t);if(r){let i=Ur(r[0],` +`).split(` +`),a="",n="",s=[];for(;i.length>0;){let o=!1,l=[],c;for(c=0;c1,n={type:"list",raw:"",ordered:a,start:a?+i.slice(0,-1):"",loose:!1,items:[]};i=a?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=a?i:"[*+-]");let s=this.rules.other.listItemRegex(i),o=!1;for(;t;){let c=!1,h="",u="";if(!(r=s.exec(t))||this.rules.block.hr.test(t))break;h=r[0],t=t.substring(h.length);let d=r[2].split(` +`,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),f=t.split(` +`,1)[0],g=!d.trim(),m=0;if(this.options.pedantic?(m=2,u=d.trimStart()):g?m=r[1].length+1:(m=r[2].search(this.rules.other.nonSpaceChar),m=m>4?1:m,u=d.slice(m),m+=r[1].length),g&&this.rules.other.blankLine.test(f)&&(h+=f+` +`,t=t.substring(f.length+1),c=!0),!c){let b=this.rules.other.nextBulletRegex(m),k=this.rules.other.hrRegex(m),v=this.rules.other.fencesBeginRegex(m),w=this.rules.other.headingBeginRegex(m),L=this.rules.other.htmlBeginRegex(m);for(;t;){let T=t.split(` +`,1)[0],D;if(f=T,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),D=f):D=f.replace(this.rules.other.tabCharGlobal," "),v.test(f)||w.test(f)||L.test(f)||b.test(f)||k.test(f))break;if(D.search(this.rules.other.nonSpaceChar)>=m||!f.trim())u+=` +`+D.slice(m);else{if(g||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||v.test(d)||w.test(d)||k.test(d))break;u+=` +`+f}!g&&!f.trim()&&(g=!0),h+=T+` +`,t=t.substring(T.length+1),d=D.slice(m)}}n.loose||(o?n.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(o=!0));let y=null,x;this.options.gfm&&(y=this.rules.other.listIsTask.exec(u),y&&(x=y[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:h,task:!!y,checked:x,loose:!1,text:u,tokens:[]}),n.raw+=h}let l=n.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let c=0;cd.type==="space"),u=h.length>0&&h.some(d=>this.rules.other.anyLine.test(d.raw));n.loose=u}if(n.loose)for(let c=0;c({text:l,tokens:this.lexer.inline(l),header:!1,align:s.align[c]})));return s}}lheading(t){let r=this.rules.block.lheading.exec(t);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(t){let r=this.rules.block.paragraph.exec(t);if(r){let i=r[1].charAt(r[1].length-1)===` +`?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:i,tokens:this.lexer.inline(i)}}}text(t){let r=this.rules.block.text.exec(t);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(t){let r=this.rules.inline.escape.exec(t);if(r)return{type:"escape",raw:r[0],text:r[1]}}tag(t){let r=this.rules.inline.tag.exec(t);if(r)return!this.lexer.state.inLink&&this.rules.other.startATag.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(t){let r=this.rules.inline.link.exec(t);if(r){let i=r[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let s=Ur(i.slice(0,-1),"\\");if((i.length-s.length)%2===0)return}else{let s=JC(r[2],"()");if(s===-2)return;if(s>-1){let o=(r[0].indexOf("!")===0?5:4)+r[1].length+s;r[2]=r[2].substring(0,s),r[0]=r[0].substring(0,o).trim(),r[3]=""}}let a=r[2],n="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(a);s&&(a=s[1],n=s[3])}else n=r[3]?r[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?a=a.slice(1):a=a.slice(1,-1)),Tl(r,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer,this.rules)}}reflink(t,r){let i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){let a=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=r[a.toLowerCase()];if(!n){let s=i[0].charAt(0);return{type:"text",raw:s,text:s}}return Tl(i,n,i[0],this.lexer,this.rules)}}emStrong(t,r,i=""){let a=this.rules.inline.emStrongLDelim.exec(t);if(!(!a||a[3]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[2])||!i||this.rules.inline.punctuation.exec(i))){let n=[...a[0]].length-1,s,o,l=n,c=0,h=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,r=r.slice(-1*t.length+n);(a=h.exec(r))!=null;){if(s=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!s)continue;if(o=[...s].length,a[3]||a[4]){l+=o;continue}else if((a[5]||a[6])&&n%3&&!((n+o)%3)){c+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+c);let u=[...a[0]][0].length,d=t.slice(0,n+a.index+u+o);if(Math.min(n,o)%2){let g=d.slice(1,-1);return{type:"em",raw:d,text:g,tokens:this.lexer.inlineTokens(g)}}let f=d.slice(2,-2);return{type:"strong",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){let r=this.rules.inline.code.exec(t);if(r){let i=r[2].replace(this.rules.other.newLineCharGlobal," "),a=this.rules.other.nonSpaceChar.test(i),n=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return a&&n&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:r[0],text:i}}}br(t){let r=this.rules.inline.br.exec(t);if(r)return{type:"br",raw:r[0]}}del(t){let r=this.rules.inline.del.exec(t);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(t){let r=this.rules.inline.autolink.exec(t);if(r){let i,a;return r[2]==="@"?(i=r[1],a="mailto:"+i):(i=r[1],a=i),{type:"link",raw:r[0],text:i,href:a,tokens:[{type:"text",raw:i,text:i}]}}}url(t){let r;if(r=this.rules.inline.url.exec(t)){let i,a;if(r[2]==="@")i=r[0],a="mailto:"+i;else{let n;do n=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])?.[0]??"";while(n!==r[0]);i=r[0],r[1]==="www."?a="http://"+r[0]:a=r[0]}return{type:"link",raw:r[0],text:i,href:a,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(t){let r=this.rules.inline.text.exec(t);if(r){let i=this.lexer.state.inRawBlock;return{type:"text",raw:r[0],text:r[0],escaped:i}}}},ne=class rs{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ur,this.options.tokenizer=this.options.tokenizer||new ba,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:Ht,block:Ri.normal,inline:Yr.normal};this.options.pedantic?(r.block=Ri.pedantic,r.inline=Yr.pedantic):this.options.gfm&&(r.block=Ri.gfm,this.options.breaks?r.inline=Yr.breaks:r.inline=Yr.gfm),this.tokenizer.rules=r}static get rules(){return{block:Ri,inline:Yr}}static lex(t,r){return new rs(r).lex(t)}static lexInline(t,r){return new rs(r).inlineTokens(t)}lex(t){t=t.replace(Ht.carriageReturn,` +`),this.blockTokens(t,this.tokens);for(let r=0;r(a=s.call({lexer:this},t,r))?(t=t.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);let s=r.at(-1);a.raw.length===1&&s!==void 0?s.raw+=` +`:r.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);let s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(` +`)?"":` +`)+a.raw,s.text+=` +`+a.text,this.inlineQueue.at(-1).src=s.text):r.push(a);continue}if(a=this.tokenizer.fences(t)){t=t.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.heading(t)){t=t.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.hr(t)){t=t.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.blockquote(t)){t=t.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.list(t)){t=t.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.html(t)){t=t.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.def(t)){t=t.substring(a.raw.length);let s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(` +`)?"":` +`)+a.raw,s.text+=` +`+a.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},r.push(a));continue}if(a=this.tokenizer.table(t)){t=t.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.lheading(t)){t=t.substring(a.raw.length),r.push(a);continue}let n=t;if(this.options.extensions?.startBlock){let s=1/0,o=t.slice(1),l;this.options.extensions.startBlock.forEach(c=>{l=c.call({lexer:this},o),typeof l=="number"&&l>=0&&(s=Math.min(s,l))}),s<1/0&&s>=0&&(n=t.substring(0,s+1))}if(this.state.top&&(a=this.tokenizer.paragraph(n))){let s=r.at(-1);i&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(` +`)?"":` +`)+a.raw,s.text+=` +`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(a),i=n.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);let s=r.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(` +`)?"":` +`)+a.raw,s.text+=` +`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(a);continue}if(t){let s="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let i=t,a=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)l.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,a.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let n;for(;(a=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)n=a[2]?a[2].length:0,i=i.slice(0,a.index+n)+"["+"a".repeat(a[0].length-n-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let s=!1,o="";for(;t;){s||(o=""),s=!1;let l;if(this.options.extensions?.inline?.some(h=>(l=h.call({lexer:this},t,r))?(t=t.substring(l.raw.length),r.push(l),!0):!1))continue;if(l=this.tokenizer.escape(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.tag(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.link(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(l.raw.length);let h=r.at(-1);l.type==="text"&&h?.type==="text"?(h.raw+=l.raw,h.text+=l.text):r.push(l);continue}if(l=this.tokenizer.emStrong(t,i,o)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.codespan(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.br(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.del(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.autolink(t)){t=t.substring(l.raw.length),r.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(t))){t=t.substring(l.raw.length),r.push(l);continue}let c=t;if(this.options.extensions?.startInline){let h=1/0,u=t.slice(1),d;this.options.extensions.startInline.forEach(f=>{d=f.call({lexer:this},u),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(c=t.substring(0,h+1))}if(l=this.tokenizer.inlineText(c)){t=t.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),s=!0;let h=r.at(-1);h?.type==="text"?(h.raw+=l.raw,h.text+=l.text):r.push(l);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return r}},Ca=class{options;parser;constructor(t){this.options=t||ur}space(t){return""}code({text:t,lang:r,escaped:i}){let a=(r||"").match(Ht.notSpaceStart)?.[0],n=t.replace(Ht.endingNewline,"")+` +`;return a?'
          '+(i?n:ge(n,!0))+`
          +`:"
          "+(i?n:ge(n,!0))+`
          +`}blockquote({tokens:t}){return`
          +${this.parser.parse(t)}
          +`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:r}){return`${this.parser.parseInline(t)} +`}hr(t){return`
          +`}list(t){let r=t.ordered,i=t.start,a="";for(let o=0;o +`+a+" +`}listitem(t){let r="";if(t.task){let i=this.checkbox({checked:!!t.checked});t.loose?t.tokens[0]?.type==="paragraph"?(t.tokens[0].text=i+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=i+" "+ge(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):r+=i+" "}return r+=this.parser.parse(t.tokens,!!t.loose),`
        • ${r}
        • +`}checkbox({checked:t}){return"'}paragraph({tokens:t}){return`

          ${this.parser.parseInline(t)}

          +`}table(t){let r="",i="";for(let n=0;n${a}`),` + +`+r+` +`+a+`
          +`}tablerow({text:t}){return` +${t} +`}tablecell(t){let r=this.parser.parseInline(t.tokens),i=t.header?"th":"td";return(t.align?`<${i} align="${t.align}">`:`<${i}>`)+r+` +`}strong({tokens:t}){return`${this.parser.parseInline(t)}`}em({tokens:t}){return`${this.parser.parseInline(t)}`}codespan({text:t}){return`${ge(t,!0)}`}br(t){return"
          "}del({tokens:t}){return`${this.parser.parseInline(t)}`}link({href:t,title:r,tokens:i}){let a=this.parser.parseInline(i),n=vl(t);if(n===null)return a;t=n;let s='
          ",s}image({href:t,title:r,text:i,tokens:a}){a&&(i=this.parser.parseInline(a,this.parser.textRenderer));let n=vl(t);if(n===null)return ge(i);t=n;let s=`${i}{let o=n[s].flat(1/0);i=i.concat(this.walkTokens(o,r))}):n.tokens&&(i=i.concat(this.walkTokens(n.tokens,r)))}}return i}use(...t){let r=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(i=>{let a={...i};if(a.async=this.defaults.async||a.async||!1,i.extensions&&(i.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let s=r.renderers[n.name];s?r.renderers[n.name]=function(...o){let l=n.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:r.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=r[n.level];s?s.unshift(n.tokenizer):r[n.level]=[n.tokenizer],n.start&&(n.level==="block"?r.startBlock?r.startBlock.push(n.start):r.startBlock=[n.start]:n.level==="inline"&&(r.startInline?r.startInline.push(n.start):r.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(r.childTokens[n.name]=n.childTokens)}),a.extensions=r),i.renderer){let n=this.defaults.renderer||new Ca(this.defaults);for(let s in i.renderer){if(!(s in n))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,l=i.renderer[o],c=n[o];n[o]=(...h)=>{let u=l.apply(n,h);return u===!1&&(u=c.apply(n,h)),u||""}}a.renderer=n}if(i.tokenizer){let n=this.defaults.tokenizer||new ba(this.defaults);for(let s in i.tokenizer){if(!(s in n))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,l=i.tokenizer[o],c=n[o];n[o]=(...h)=>{let u=l.apply(n,h);return u===!1&&(u=c.apply(n,h)),u}}a.tokenizer=n}if(i.hooks){let n=this.defaults.hooks||new Qr;for(let s in i.hooks){if(!(s in n))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,l=i.hooks[o],c=n[o];Qr.passThroughHooks.has(s)?n[o]=h=>{if(this.defaults.async&&Qr.passThroughHooksRespectAsync.has(s))return(async()=>{let d=await l.call(n,h);return c.call(n,d)})();let u=l.call(n,h);return c.call(n,u)}:n[o]=(...h)=>{if(this.defaults.async)return(async()=>{let d=await l.apply(n,h);return d===!1&&(d=await c.apply(n,h)),d})();let u=l.apply(n,h);return u===!1&&(u=c.apply(n,h)),u}}a.hooks=n}if(i.walkTokens){let n=this.defaults.walkTokens,s=i.walkTokens;a.walkTokens=function(o){let l=[];return l.push(s.call(this,o)),n&&(l=l.concat(n.call(this,o))),l}}this.defaults={...this.defaults,...a}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,r){return ne.lex(t,r??this.defaults)}parser(t,r){return se.parse(t,r??this.defaults)}parseMarkdown(t){return(r,i)=>{let a={...i},n={...this.defaults,...a},s=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&a.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=t),n.async)return(async()=>{let o=n.hooks?await n.hooks.preprocess(r):r,l=await(n.hooks?await n.hooks.provideLexer():t?ne.lex:ne.lexInline)(o,n),c=n.hooks?await n.hooks.processAllTokens(l):l;n.walkTokens&&await Promise.all(this.walkTokens(c,n.walkTokens));let h=await(n.hooks?await n.hooks.provideParser():t?se.parse:se.parseInline)(c,n);return n.hooks?await n.hooks.postprocess(h):h})().catch(s);try{n.hooks&&(r=n.hooks.preprocess(r));let o=(n.hooks?n.hooks.provideLexer():t?ne.lex:ne.lexInline)(r,n);n.hooks&&(o=n.hooks.processAllTokens(o)),n.walkTokens&&this.walkTokens(o,n.walkTokens);let l=(n.hooks?n.hooks.provideParser():t?se.parse:se.parseInline)(o,n);return n.hooks&&(l=n.hooks.postprocess(l)),l}catch(o){return s(o)}}}onError(t,r){return i=>{if(i.message+=` +Please report this to https://github.com/markedjs/marked.`,t){let a="

          An error occurred:

          "+ge(i.message+"",!0)+"
          ";return r?Promise.resolve(a):a}if(r)return Promise.reject(i);throw i}}},nr=new e2;function ft(e,t){return nr.parse(e,t)}ft.options=ft.setOptions=function(e){return nr.setOptions(e),ft.defaults=nr.defaults,Nu(ft.defaults),ft};ft.getDefaults=Vs;ft.defaults=ur;ft.use=function(...e){return nr.use(...e),ft.defaults=nr.defaults,Nu(ft.defaults),ft};ft.walkTokens=function(e,t){return nr.walkTokens(e,t)};ft.parseInline=nr.parseInline;ft.Parser=se;ft.parser=se.parse;ft.Renderer=Ca;ft.TextRenderer=ro;ft.Lexer=ne;ft.lexer=ne.lex;ft.Tokenizer=ba;ft.Hooks=Qr;ft.parse=ft;ft.options;ft.setOptions;ft.use;ft.walkTokens;ft.parseInline;se.parse;ne.lex;function Zu(e){for(var t=[],r=1;r?',height:80,width:80},as=new Map,Ku=new Map,i2=p(e=>{for(const t of e){if(!t.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(F.debug("Registering icon pack:",t.name),"loader"in t)Ku.set(t.name,t.loader);else if("icons"in t)as.set(t.name,t.icons);else throw F.error("Invalid icon loader:",t),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),Qu=p(async(e,t)=>{const r=aC(e,!0,t!==void 0);if(!r)throw new Error(`Invalid icon name: ${e}`);const i=r.prefix||t;if(!i)throw new Error(`Icon name must contain a prefix: ${e}`);let a=as.get(i);if(!a){const s=Ku.get(i);if(!s)throw new Error(`Icon set not found: ${r.prefix}`);try{a={...await s(),prefix:i},as.set(i,a)}catch(o){throw F.error(o),new Error(`Failed to load icon set: ${r.prefix}`)}}const n=oC(a,r.name);if(!n)throw new Error(`Icon not found: ${e}`);return n},"getRegisteredIconData"),a2=p(async e=>{try{return await Qu(e),!0}catch{return!1}},"isIconAvailable"),Si=p(async(e,t,r)=>{let i;try{i=await Qu(e,t?.fallbackPrefix)}catch(s){F.error(s),i=r2}const a=pC(i,t),n=xC(yC(a.body),{...a.attributes,...r});return Jt(n,Ot())},"getIconSVG");function Ju(e,{markdownAutoWrap:t}){const i=e.replace(//g,` +`).replace(/\n{2,}/g,` +`),a=Zu(i);return t===!1?a.replace(/ /g," "):a}p(Ju,"preprocessMarkdown");function td(e,t={}){const r=Ju(e,t),i=ft.lexer(r),a=[[]];let n=0;function s(o,l="normal"){o.type==="text"?o.text.split(` +`).forEach((h,u)=>{u!==0&&(n++,a.push([])),h.split(" ").forEach(d=>{d=d.replace(/'/g,"'"),d&&a[n].push({content:d,type:l})})}):o.type==="strong"||o.type==="em"?o.tokens.forEach(c=>{s(c,o.type)}):o.type==="html"&&a[n].push({content:o.text,type:"normal"})}return p(s,"processNode"),i.forEach(o=>{o.type==="paragraph"?o.tokens?.forEach(l=>{s(l)}):o.type==="html"?a[n].push({content:o.text,type:"normal"}):a[n].push({content:o.raw,type:"normal"})}),a}p(td,"markdownToLines");function ed(e,{markdownAutoWrap:t}={}){const r=ft.lexer(e);function i(a){return a.type==="text"?t===!1?a.text.replace(/\n */g,"
          ").replace(/ /g," "):a.text.replace(/\n */g,"
          "):a.type==="strong"?`${a.tokens?.map(i).join("")}`:a.type==="em"?`${a.tokens?.map(i).join("")}`:a.type==="paragraph"?`

          ${a.tokens?.map(i).join("")}

          `:a.type==="space"?"":a.type==="html"?`${a.text}`:a.type==="escape"?a.text:(F.warn(`Unsupported markdown: ${a.type}`),a.raw)}return p(i,"output"),r.map(i).join("")}p(ed,"markdownToHTML");function rd(e){return Intl.Segmenter?[...new Intl.Segmenter().segment(e)].map(t=>t.segment):[...e]}p(rd,"splitTextToChars");function id(e,t){const r=rd(t.content);return io(e,[],r,t.type)}p(id,"splitWordToFitWidth");function io(e,t,r,i){if(r.length===0)return[{content:t.join(""),type:i},{content:"",type:i}];const[a,...n]=r,s=[...t,a];return e([{content:s.join(""),type:i}])?io(e,s,n,i):(t.length===0&&a&&(t.push(a),r.shift()),[{content:t.join(""),type:i},{content:r.join(""),type:i}])}p(io,"splitWordToFitWidthRecursion");function ad(e,t){if(e.some(({content:r})=>r.includes(` +`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return ka(e,t)}p(ad,"splitLineToFitWidth");function ka(e,t,r=[],i=[]){if(e.length===0)return i.length>0&&r.push(i),r.length>0?r:[];let a="";e[0].content===" "&&(a=" ",e.shift());const n=e.shift()??{content:" ",type:"normal"},s=[...i];if(a!==""&&s.push({content:a,type:"normal"}),s.push(n),t(s))return ka(e,t,r,s);if(i.length>0)r.push(i),e.unshift(n);else if(n.content){const[o,l]=id(t,n);r.push([o]),l.content&&e.unshift(l)}return ka(e,t,r)}p(ka,"splitLineToFitWidthRecursion");function ns(e,t){t&&e.attr("style",t)}p(ns,"applyStyle");async function nd(e,t,r,i,a=!1,n=Ot()){const s=e.append("foreignObject");s.attr("width",`${10*r}px`),s.attr("height",`${10*r}px`);const o=s.append("xhtml:div"),l=Tr(t.label)?await ws(t.label.replace(Mr.lineBreakRegex,` +`),n):Jt(t.label,n),c=t.isNode?"nodeLabel":"edgeLabel",h=o.append("span");h.html(l),ns(h,t.labelStyle),h.attr("class",`${c} ${i}`),ns(o,t.labelStyle),o.style("display","table-cell"),o.style("white-space","nowrap"),o.style("line-height","1.5"),o.style("max-width",r+"px"),o.style("text-align","center"),o.attr("xmlns","http://www.w3.org/1999/xhtml"),a&&o.attr("class","labelBkg");let u=o.node().getBoundingClientRect();return u.width===r&&(o.style("display","table"),o.style("white-space","break-spaces"),o.style("width",r+"px"),u=o.node().getBoundingClientRect()),s.node()}p(nd,"addHtmlSpan");function ja(e,t,r){return e.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",t*r-.1+"em").attr("dy",r+"em")}p(ja,"createTspan");function sd(e,t,r){const i=e.append("text"),a=ja(i,1,t);Ya(a,r);const n=a.node().getComputedTextLength();return i.remove(),n}p(sd,"computeWidthOfText");function n2(e,t,r){const i=e.append("text"),a=ja(i,1,t);Ya(a,[{content:r,type:"normal"}]);const n=a.node()?.getBoundingClientRect();return n&&i.remove(),n}p(n2,"computeDimensionOfText");function od(e,t,r,i=!1){const n=t.append("g"),s=n.insert("rect").attr("class","background").attr("style","stroke: none"),o=n.append("text").attr("y","-10.1");let l=0;for(const c of r){const h=p(d=>sd(n,1.1,d)<=e,"checkWidth"),u=h(c)?[c]:ad(c,h);for(const d of u){const f=ja(o,l,1.1);Ya(f,d),l++}}if(i){const c=o.node().getBBox(),h=2;return s.attr("x",c.x-h).attr("y",c.y-h).attr("width",c.width+2*h).attr("height",c.height+2*h),n.node()}else return o.node()}p(od,"createFormattedText");function Ya(e,t){e.text(""),t.forEach((r,i)=>{const a=e.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");i===0?a.text(r.content):a.text(" "+r.content)})}p(Ya,"updateTextContentAndStyles");async function ld(e,t={}){const r=[];e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(a,n,s)=>(r.push((async()=>{const o=`${n}:${s}`;return await a2(o)?await Si(o,void 0,{class:"label-icon"}):``})()),a));const i=await Promise.all(r);return e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>i.shift()??"")}p(ld,"replaceIconSubstring");var He=p(async(e,t="",{style:r="",isTitle:i=!1,classes:a="",useHtmlLabels:n=!0,isNode:s=!0,width:o=200,addSvgBackground:l=!1}={},c)=>{if(F.debug("XYZ createText",t,r,i,a,n,s,"addSvgBackground: ",l),n){const h=ed(t,c),u=await ld(hr(h),c),d=t.replace(/\\\\/g,"\\"),f={isNode:s,label:Tr(t)?d:u,labelStyle:r.replace("fill:","color:")};return await nd(e,f,o,a,l,c)}else{const h=t.replace(//g,"
          "),u=td(h.replace("
          ","
          "),c),d=od(o,e,u,t?l:!1);if(s){/stroke:/.exec(r)&&(r=r.replace("stroke:","lineColor:"));const f=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");ht(d).attr("style",f)}else{const f=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");ht(d).select("rect").attr("style",f.replace(/background:/g,"fill:"));const g=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");ht(d).select("text").attr("style",g)}return d}},"createText");function bn(e,t,r){if(e&&e.length){const[i,a]=t,n=Math.PI/180*r,s=Math.cos(n),o=Math.sin(n);for(const l of e){const[c,h]=l;l[0]=(c-i)*s-(h-a)*o+i,l[1]=(c-i)*o+(h-a)*s+a}}}function s2(e,t){return e[0]===t[0]&&e[1]===t[1]}function o2(e,t,r,i=1){const a=r,n=Math.max(t,.1),s=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,o=[0,0];if(a)for(const c of s)bn(c,o,a);const l=(function(c,h,u){const d=[];for(const b of c){const k=[...b];s2(k[0],k[k.length-1])||k.push([k[0][0],k[0][1]]),k.length>2&&d.push(k)}const f=[];h=Math.max(h,.1);const g=[];for(const b of d)for(let k=0;kb.ymink.ymin?1:b.xk.x?1:b.ymax===k.ymax?0:(b.ymax-k.ymax)/Math.abs(b.ymax-k.ymax))),!g.length)return f;let m=[],y=g[0].ymin,x=0;for(;m.length||g.length;){if(g.length){let b=-1;for(let k=0;ky);k++)b=k;g.splice(0,b+1).forEach((k=>{m.push({s:y,edge:k})}))}if(m=m.filter((b=>!(b.edge.ymax<=y))),m.sort(((b,k)=>b.edge.x===k.edge.x?0:(b.edge.x-k.edge.x)/Math.abs(b.edge.x-k.edge.x))),(u!==1||x%h==0)&&m.length>1)for(let b=0;b=m.length)break;const v=m[b].edge,w=m[k].edge;f.push([[Math.round(v.x),y],[Math.round(w.x),y]])}y+=u,m.forEach((b=>{b.edge.x=b.edge.x+u*b.edge.islope})),x++}return f})(s,n,i);if(a){for(const c of s)bn(c,o,-a);(function(c,h,u){const d=[];c.forEach((f=>d.push(...f))),bn(d,h,u)})(l,o,-a)}return l}function Ti(e,t){var r;const i=t.hachureAngle+90;let a=t.hachureGap;a<0&&(a=4*t.strokeWidth),a=Math.round(Math.max(a,.1));let n=1;return t.roughness>=1&&(((r=t.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(n=a),o2(e,a,i,n||1)}class ao{constructor(t){this.helper=t}fillPolygons(t,r){return this._fillPolygons(t,r)}_fillPolygons(t,r){const i=Ti(t,r);return{type:"fillSketch",ops:this.renderLines(i,r)}}renderLines(t,r){const i=[];for(const a of t)i.push(...this.helper.doubleLineOps(a[0][0],a[0][1],a[1][0],a[1][1],r));return i}}function Ua(e){const t=e[0],r=e[1];return Math.sqrt(Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2))}class l2 extends ao{fillPolygons(t,r){let i=r.hachureGap;i<0&&(i=4*r.strokeWidth),i=Math.max(i,.1);const a=Ti(t,Object.assign({},r,{hachureGap:i})),n=Math.PI/180*r.hachureAngle,s=[],o=.5*i*Math.cos(n),l=.5*i*Math.sin(n);for(const[c,h]of a)Ua([c,h])&&s.push([[c[0]-o,c[1]+l],[...h]],[[c[0]+o,c[1]-l],[...h]]);return{type:"fillSketch",ops:this.renderLines(s,r)}}}class c2 extends ao{fillPolygons(t,r){const i=this._fillPolygons(t,r),a=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),n=this._fillPolygons(t,a);return i.ops=i.ops.concat(n.ops),i}}class h2{constructor(t){this.helper=t}fillPolygons(t,r){const i=Ti(t,r=Object.assign({},r,{hachureAngle:0}));return this.dotsOnLines(i,r)}dotsOnLines(t,r){const i=[];let a=r.hachureGap;a<0&&(a=4*r.strokeWidth),a=Math.max(a,.1);let n=r.fillWeight;n<0&&(n=r.strokeWidth/2);const s=a/4;for(const o of t){const l=Ua(o),c=l/a,h=Math.ceil(c)-1,u=l-h*a,d=(o[0][0]+o[1][0])/2-a/4,f=Math.min(o[0][1],o[1][1]);for(let g=0;g{const o=Ua(s),l=Math.floor(o/(i+a)),c=(o+a-l*(i+a))/2;let h=s[0],u=s[1];h[0]>u[0]&&(h=s[1],u=s[0]);const d=Math.atan((u[1]-h[1])/(u[0]-h[0]));for(let f=0;f{const s=Ua(n),o=Math.round(s/(2*r));let l=n[0],c=n[1];l[0]>c[0]&&(l=n[1],c=n[0]);const h=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let u=0;uh%2?c+r:c+t));n.push({key:"C",data:l}),t=l[4],r=l[5];break}case"Q":n.push({key:"Q",data:[...o]}),t=o[2],r=o[3];break;case"q":{const l=o.map(((c,h)=>h%2?c+r:c+t));n.push({key:"Q",data:l}),t=l[2],r=l[3];break}case"A":n.push({key:"A",data:[...o]}),t=o[5],r=o[6];break;case"a":t+=o[5],r+=o[6],n.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],t,r]});break;case"H":n.push({key:"H",data:[...o]}),t=o[0];break;case"h":t+=o[0],n.push({key:"H",data:[t]});break;case"V":n.push({key:"V",data:[...o]}),r=o[0];break;case"v":r+=o[0],n.push({key:"V",data:[r]});break;case"S":n.push({key:"S",data:[...o]}),t=o[2],r=o[3];break;case"s":{const l=o.map(((c,h)=>h%2?c+r:c+t));n.push({key:"S",data:l}),t=l[2],r=l[3];break}case"T":n.push({key:"T",data:[...o]}),t=o[0],r=o[1];break;case"t":t+=o[0],r+=o[1],n.push({key:"T",data:[t,r]});break;case"Z":case"z":n.push({key:"Z",data:[]}),t=i,r=a}return n}function hd(e){const t=[];let r="",i=0,a=0,n=0,s=0,o=0,l=0;for(const{key:c,data:h}of e){switch(c){case"M":t.push({key:"M",data:[...h]}),[i,a]=h,[n,s]=h;break;case"C":t.push({key:"C",data:[...h]}),i=h[4],a=h[5],o=h[2],l=h[3];break;case"L":t.push({key:"L",data:[...h]}),[i,a]=h;break;case"H":i=h[0],t.push({key:"L",data:[i,a]});break;case"V":a=h[0],t.push({key:"L",data:[i,a]});break;case"S":{let u=0,d=0;r==="C"||r==="S"?(u=i+(i-o),d=a+(a-l)):(u=i,d=a),t.push({key:"C",data:[u,d,...h]}),o=h[0],l=h[1],i=h[2],a=h[3];break}case"T":{const[u,d]=h;let f=0,g=0;r==="Q"||r==="T"?(f=i+(i-o),g=a+(a-l)):(f=i,g=a);const m=i+2*(f-i)/3,y=a+2*(g-a)/3,x=u+2*(f-u)/3,b=d+2*(g-d)/3;t.push({key:"C",data:[m,y,x,b,u,d]}),o=f,l=g,i=u,a=d;break}case"Q":{const[u,d,f,g]=h,m=i+2*(u-i)/3,y=a+2*(d-a)/3,x=f+2*(u-f)/3,b=g+2*(d-g)/3;t.push({key:"C",data:[m,y,x,b,f,g]}),o=u,l=d,i=f,a=g;break}case"A":{const u=Math.abs(h[0]),d=Math.abs(h[1]),f=h[2],g=h[3],m=h[4],y=h[5],x=h[6];u===0||d===0?(t.push({key:"C",data:[i,a,y,x,y,x]}),i=y,a=x):(i!==y||a!==x)&&(ud(i,a,y,x,u,d,f,g,m).forEach((function(b){t.push({key:"C",data:b})})),i=y,a=x);break}case"Z":t.push({key:"Z",data:[]}),i=n,a=s}r=c}return t}function Gr(e,t,r){return[e*Math.cos(r)-t*Math.sin(r),e*Math.sin(r)+t*Math.cos(r)]}function ud(e,t,r,i,a,n,s,o,l,c){const h=(u=s,Math.PI*u/180);var u;let d=[],f=0,g=0,m=0,y=0;if(c)[f,g,m,y]=c;else{[e,t]=Gr(e,t,-h),[r,i]=Gr(r,i,-h);const R=(e-r)/2,B=(t-i)/2;let A=R*R/(a*a)+B*B/(n*n);A>1&&(A=Math.sqrt(A),a*=A,n*=A);const _=a*a,$=n*n,M=_*$-_*B*B-$*R*R,q=_*B*B+$*R*R,V=(o===l?-1:1)*Math.sqrt(Math.abs(M/q));m=V*a*B/n+(e+r)/2,y=V*-n*R/a+(t+i)/2,f=Math.asin(parseFloat(((t-y)/n).toFixed(9))),g=Math.asin(parseFloat(((i-y)/n).toFixed(9))),eg&&(f-=2*Math.PI),!l&&g>f&&(g-=2*Math.PI)}let x=g-f;if(Math.abs(x)>120*Math.PI/180){const R=g,B=r,A=i;g=l&&g>f?f+120*Math.PI/180*1:f+120*Math.PI/180*-1,d=ud(r=m+a*Math.cos(g),i=y+n*Math.sin(g),B,A,a,n,s,0,l,[g,R,m,y])}x=g-f;const b=Math.cos(f),k=Math.sin(f),v=Math.cos(g),w=Math.sin(g),L=Math.tan(x/4),T=4/3*a*L,D=4/3*n*L,I=[e,t],O=[e+T*k,t-D*b],E=[r+T*w,i-D*v],N=[r,i];if(O[0]=2*I[0]-O[0],O[1]=2*I[1]-O[1],c)return[O,E,N].concat(d);{d=[O,E,N].concat(d);const R=[];for(let B=0;B2){const a=[];for(let n=0;n2*Math.PI&&(f=0,g=2*Math.PI);const m=2*Math.PI/l.curveStepCount,y=Math.min(m/2,(g-f)/2),x=$l(y,c,h,u,d,f,g,1,l);if(!l.disableMultiStroke){const b=$l(y,c,h,u,d,f,g,1.5,l);x.push(...b)}return s&&(o?x.push(...ze(c,h,c+u*Math.cos(f),h+d*Math.sin(f),l),...ze(c,h,c+u*Math.cos(g),h+d*Math.sin(g),l)):x.push({op:"lineTo",data:[c,h]},{op:"lineTo",data:[c+u*Math.cos(f),h+d*Math.sin(f)]})),{type:"path",ops:x}}function Al(e,t){const r=hd(cd(no(e))),i=[];let a=[0,0],n=[0,0];for(const{key:s,data:o}of r)switch(s){case"M":n=[o[0],o[1]],a=[o[0],o[1]];break;case"L":i.push(...ze(n[0],n[1],o[0],o[1],t)),n=[o[0],o[1]];break;case"C":{const[l,c,h,u,d,f]=o;i.push(...y2(l,c,h,u,d,f,n,t)),n=[d,f];break}case"Z":i.push(...ze(n[0],n[1],a[0],a[1],t)),n=[a[0],a[1]]}return{type:"path",ops:i}}function wn(e,t){const r=[];for(const i of e)if(i.length){const a=t.maxRandomnessOffset||0,n=i.length;if(n>2){r.push({op:"move",data:[i[0][0]+at(a,t),i[0][1]+at(a,t)]});for(let s=1;s500?.4:-.0016668*l+1.233334;let h=a.maxRandomnessOffset||0;h*h*100>o&&(h=l/10);const u=h/2,d=.2+.2*pd(a);let f=a.bowing*a.maxRandomnessOffset*(i-t)/200,g=a.bowing*a.maxRandomnessOffset*(e-r)/200;f=at(f,a,c),g=at(g,a,c);const m=[],y=()=>at(u,a,c),x=()=>at(h,a,c),b=a.preserveVertices;return s?m.push({op:"move",data:[e+(b?0:y()),t+(b?0:y())]}):m.push({op:"move",data:[e+(b?0:at(h,a,c)),t+(b?0:at(h,a,c))]}),s?m.push({op:"bcurveTo",data:[f+e+(r-e)*d+y(),g+t+(i-t)*d+y(),f+e+2*(r-e)*d+y(),g+t+2*(i-t)*d+y(),r+(b?0:y()),i+(b?0:y())]}):m.push({op:"bcurveTo",data:[f+e+(r-e)*d+x(),g+t+(i-t)*d+x(),f+e+2*(r-e)*d+x(),g+t+2*(i-t)*d+x(),r+(b?0:x()),i+(b?0:x())]}),m}function Pi(e,t,r){if(!e.length)return[];const i=[];i.push([e[0][0]+at(t,r),e[0][1]+at(t,r)]),i.push([e[0][0]+at(t,r),e[0][1]+at(t,r)]);for(let a=1;a3){const n=[],s=1-r.curveTightness;a.push({op:"move",data:[e[1][0],e[1][1]]});for(let o=1;o+21&&a.push(o)):a.push(o),a.push(e[t+3])}else{const l=e[t+0],c=e[t+1],h=e[t+2],u=e[t+3],d=Xe(l,c,.5),f=Xe(c,h,.5),g=Xe(h,u,.5),m=Xe(d,f,.5),y=Xe(f,g,.5),x=Xe(m,y,.5);ls([l,d,m,x],0,r,a),ls([x,y,g,u],0,r,a)}var n,s;return a}function b2(e,t){return Sa(e,0,e.length,t)}function Sa(e,t,r,i,a){const n=a||[],s=e[t],o=e[r-1];let l=0,c=1;for(let h=t+1;hl&&(l=u,c=h)}return Math.sqrt(l)>i?(Sa(e,t,c+1,i,n),Sa(e,c,r,i,n)):(n.length||n.push(s),n.push(o)),n}function vn(e,t=.15,r){const i=[],a=(e.length-1)/3;for(let n=0;n0?Sa(i,0,i.length,r):i}const Zt="none";class Ta{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,r,i){return{shape:t,sets:r||[],options:i||this.defaultOptions}}line(t,r,i,a,n){const s=this._o(n);return this._d("line",[dd(t,r,i,a,s)],s)}rectangle(t,r,i,a,n){const s=this._o(n),o=[],l=m2(t,r,i,a,s);if(s.fill){const c=[[t,r],[t+i,r],[t+i,r+a],[t,r+a]];s.fillStyle==="solid"?o.push(wn([c],s)):o.push(yr([c],s))}return s.stroke!==Zt&&o.push(l),this._d("rectangle",o,s)}ellipse(t,r,i,a,n){const s=this._o(n),o=[],l=fd(i,a,s),c=ss(t,r,s,l);if(s.fill)if(s.fillStyle==="solid"){const h=ss(t,r,s,l).opset;h.type="fillPath",o.push(h)}else o.push(yr([c.estimatedPoints],s));return s.stroke!==Zt&&o.push(c.opset),this._d("ellipse",o,s)}circle(t,r,i,a){const n=this.ellipse(t,r,i,i,a);return n.shape="circle",n}linearPath(t,r){const i=this._o(r);return this._d("linearPath",[Ki(t,!1,i)],i)}arc(t,r,i,a,n,s,o=!1,l){const c=this._o(l),h=[],u=Ll(t,r,i,a,n,s,o,!0,c);if(o&&c.fill)if(c.fillStyle==="solid"){const d=Object.assign({},c);d.disableMultiStroke=!0;const f=Ll(t,r,i,a,n,s,!0,!1,d);f.type="fillPath",h.push(f)}else h.push((function(d,f,g,m,y,x,b){const k=d,v=f;let w=Math.abs(g/2),L=Math.abs(m/2);w+=at(.01*w,b),L+=at(.01*L,b);let T=y,D=x;for(;T<0;)T+=2*Math.PI,D+=2*Math.PI;D-T>2*Math.PI&&(T=0,D=2*Math.PI);const I=(D-T)/b.curveStepCount,O=[];for(let E=T;E<=D;E+=I)O.push([k+w*Math.cos(E),v+L*Math.sin(E)]);return O.push([k+w*Math.cos(D),v+L*Math.sin(D)]),O.push([k,v]),yr([O],b)})(t,r,i,a,n,s,c));return c.stroke!==Zt&&h.push(u),this._d("arc",h,c)}curve(t,r){const i=this._o(r),a=[],n=Bl(t,i);if(i.fill&&i.fill!==Zt)if(i.fillStyle==="solid"){const s=Bl(t,Object.assign(Object.assign({},i),{disableMultiStroke:!0,roughness:i.roughness?i.roughness+i.fillShapeRoughnessGain:0}));a.push({type:"fillPath",ops:this._mergedShape(s.ops)})}else{const s=[],o=t;if(o.length){const l=typeof o[0][0]=="number"?[o]:o;for(const c of l)c.length<3?s.push(...c):c.length===3?s.push(...vn(Fl([c[0],c[0],c[1],c[2]]),10,(1+i.roughness)/2)):s.push(...vn(Fl(c),10,(1+i.roughness)/2))}s.length&&a.push(yr([s],i))}return i.stroke!==Zt&&a.push(n),this._d("curve",a,i)}polygon(t,r){const i=this._o(r),a=[],n=Ki(t,!0,i);return i.fill&&(i.fillStyle==="solid"?a.push(wn([t],i)):a.push(yr([t],i))),i.stroke!==Zt&&a.push(n),this._d("polygon",a,i)}path(t,r){const i=this._o(r),a=[];if(!t)return this._d("path",a,i);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const n=i.fill&&i.fill!=="transparent"&&i.fill!==Zt,s=i.stroke!==Zt,o=!!(i.simplification&&i.simplification<1),l=(function(h,u,d){const f=hd(cd(no(h))),g=[];let m=[],y=[0,0],x=[];const b=()=>{x.length>=4&&m.push(...vn(x,u)),x=[]},k=()=>{b(),m.length&&(g.push(m),m=[])};for(const{key:w,data:L}of f)switch(w){case"M":k(),y=[L[0],L[1]],m.push(y);break;case"L":b(),m.push([L[0],L[1]]);break;case"C":if(!x.length){const T=m.length?m[m.length-1]:y;x.push([T[0],T[1]])}x.push([L[0],L[1]]),x.push([L[2],L[3]]),x.push([L[4],L[5]]);break;case"Z":b(),m.push([y[0],y[1]])}if(k(),!d)return g;const v=[];for(const w of g){const L=b2(w,d);L.length&&v.push(L)}return v})(t,1,o?4-4*(i.simplification||1):(1+i.roughness)/2),c=Al(t,i);if(n)if(i.fillStyle==="solid")if(l.length===1){const h=Al(t,Object.assign(Object.assign({},i),{disableMultiStroke:!0,roughness:i.roughness?i.roughness+i.fillShapeRoughnessGain:0}));a.push({type:"fillPath",ops:this._mergedShape(h.ops)})}else a.push(wn(l,i));else a.push(yr(l,i));return s&&(o?l.forEach((h=>{a.push(Ki(h,!1,i))})):a.push(c)),this._d("path",a,i)}opsToPath(t,r){let i="";for(const a of t.ops){const n=typeof r=="number"&&r>=0?a.data.map((s=>+s.toFixed(r))):a.data;switch(a.op){case"move":i+=`M${n[0]} ${n[1]} `;break;case"bcurveTo":i+=`C${n[0]} ${n[1]}, ${n[2]} ${n[3]}, ${n[4]} ${n[5]} `;break;case"lineTo":i+=`L${n[0]} ${n[1]} `}}return i.trim()}toPaths(t){const r=t.sets||[],i=t.options||this.defaultOptions,a=[];for(const n of r){let s=null;switch(n.type){case"path":s={d:this.opsToPath(n),stroke:i.stroke,strokeWidth:i.strokeWidth,fill:Zt};break;case"fillPath":s={d:this.opsToPath(n),stroke:Zt,strokeWidth:0,fill:i.fill||Zt};break;case"fillSketch":s=this.fillSketch(n,i)}s&&a.push(s)}return a}fillSketch(t,r){let i=r.fillWeight;return i<0&&(i=r.strokeWidth/2),{d:this.opsToPath(t),stroke:r.fill||Zt,strokeWidth:i,fill:Zt}}_mergedShape(t){return t.filter(((r,i)=>i===0||r.op!=="move"))}}class C2{constructor(t,r){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new Ta(r)}draw(t){const r=t.sets||[],i=t.options||this.getDefaultOptions(),a=this.ctx,n=t.options.fixedDecimalPlaceDigits;for(const s of r)switch(s.type){case"path":a.save(),a.strokeStyle=i.stroke==="none"?"transparent":i.stroke,a.lineWidth=i.strokeWidth,i.strokeLineDash&&a.setLineDash(i.strokeLineDash),i.strokeLineDashOffset&&(a.lineDashOffset=i.strokeLineDashOffset),this._drawToContext(a,s,n),a.restore();break;case"fillPath":{a.save(),a.fillStyle=i.fill||"";const o=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(a,s,n,o),a.restore();break}case"fillSketch":this.fillSketch(a,s,i)}}fillSketch(t,r,i){let a=i.fillWeight;a<0&&(a=i.strokeWidth/2),t.save(),i.fillLineDash&&t.setLineDash(i.fillLineDash),i.fillLineDashOffset&&(t.lineDashOffset=i.fillLineDashOffset),t.strokeStyle=i.fill||"",t.lineWidth=a,this._drawToContext(t,r,i.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,r,i,a="nonzero"){t.beginPath();for(const n of r.ops){const s=typeof i=="number"&&i>=0?n.data.map((o=>+o.toFixed(i))):n.data;switch(n.op){case"move":t.moveTo(s[0],s[1]);break;case"bcurveTo":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"lineTo":t.lineTo(s[0],s[1])}}r.type==="fillPath"?t.fill(a):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,r,i,a,n){const s=this.gen.line(t,r,i,a,n);return this.draw(s),s}rectangle(t,r,i,a,n){const s=this.gen.rectangle(t,r,i,a,n);return this.draw(s),s}ellipse(t,r,i,a,n){const s=this.gen.ellipse(t,r,i,a,n);return this.draw(s),s}circle(t,r,i,a){const n=this.gen.circle(t,r,i,a);return this.draw(n),n}linearPath(t,r){const i=this.gen.linearPath(t,r);return this.draw(i),i}polygon(t,r){const i=this.gen.polygon(t,r);return this.draw(i),i}arc(t,r,i,a,n,s,o=!1,l){const c=this.gen.arc(t,r,i,a,n,s,o,l);return this.draw(c),c}curve(t,r){const i=this.gen.curve(t,r);return this.draw(i),i}path(t,r){const i=this.gen.path(t,r);return this.draw(i),i}}const Ni="http://www.w3.org/2000/svg";class k2{constructor(t,r){this.svg=t,this.gen=new Ta(r)}draw(t){const r=t.sets||[],i=t.options||this.getDefaultOptions(),a=this.svg.ownerDocument||window.document,n=a.createElementNS(Ni,"g"),s=t.options.fixedDecimalPlaceDigits;for(const o of r){let l=null;switch(o.type){case"path":l=a.createElementNS(Ni,"path"),l.setAttribute("d",this.opsToPath(o,s)),l.setAttribute("stroke",i.stroke),l.setAttribute("stroke-width",i.strokeWidth+""),l.setAttribute("fill","none"),i.strokeLineDash&&l.setAttribute("stroke-dasharray",i.strokeLineDash.join(" ").trim()),i.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${i.strokeLineDashOffset}`);break;case"fillPath":l=a.createElementNS(Ni,"path"),l.setAttribute("d",this.opsToPath(o,s)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",i.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(a,o,i)}l&&n.appendChild(l)}return n}fillSketch(t,r,i){let a=i.fillWeight;a<0&&(a=i.strokeWidth/2);const n=t.createElementNS(Ni,"path");return n.setAttribute("d",this.opsToPath(r,i.fixedDecimalPlaceDigits)),n.setAttribute("stroke",i.fill||""),n.setAttribute("stroke-width",a+""),n.setAttribute("fill","none"),i.fillLineDash&&n.setAttribute("stroke-dasharray",i.fillLineDash.join(" ").trim()),i.fillLineDashOffset&&n.setAttribute("stroke-dashoffset",`${i.fillLineDashOffset}`),n}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,r){return this.gen.opsToPath(t,r)}line(t,r,i,a,n){const s=this.gen.line(t,r,i,a,n);return this.draw(s)}rectangle(t,r,i,a,n){const s=this.gen.rectangle(t,r,i,a,n);return this.draw(s)}ellipse(t,r,i,a,n){const s=this.gen.ellipse(t,r,i,a,n);return this.draw(s)}circle(t,r,i,a){const n=this.gen.circle(t,r,i,a);return this.draw(n)}linearPath(t,r){const i=this.gen.linearPath(t,r);return this.draw(i)}polygon(t,r){const i=this.gen.polygon(t,r);return this.draw(i)}arc(t,r,i,a,n,s,o=!1,l){const c=this.gen.arc(t,r,i,a,n,s,o,l);return this.draw(c)}curve(t,r){const i=this.gen.curve(t,r);return this.draw(i)}path(t,r){const i=this.gen.path(t,r);return this.draw(i)}}var j={canvas:(e,t)=>new C2(e,t),svg:(e,t)=>new k2(e,t),generator:e=>new Ta(e),newSeed:()=>Ta.newSeed()},it=p(async(e,t,r)=>{let i;const a=t.useHtmlLabels||Lt(dt()?.htmlLabels);r?i=r:i="node default";const n=e.insert("g").attr("class",i).attr("id",t.domId||t.id),s=n.insert("g").attr("class","label").attr("style",It(t.labelStyle));let o;t.label===void 0?o="":o=typeof t.label=="string"?t.label:t.label[0];const l=await He(s,Jt(hr(o),dt()),{useHtmlLabels:a,width:t.width||dt().flowchart?.wrappingWidth,cssClasses:"markdown-node-label",style:t.labelStyle,addSvgBackground:!!t.icon||!!t.img});let c=l.getBBox();const h=(t?.padding??0)/2;if(a){const u=l.children[0],d=ht(l),f=u.getElementsByTagName("img");if(f){const g=o.replace(/]*>/g,"").trim()==="";await Promise.all([...f].map(m=>new Promise(y=>{function x(){if(m.style.display="flex",m.style.flexDirection="column",g){const b=dt().fontSize?dt().fontSize:window.getComputedStyle(document.body).fontSize,k=5,[v=mc.fontSize]=Wa(b),w=v*k+"px";m.style.minWidth=w,m.style.maxWidth=w}else m.style.width="100%";y(m)}p(x,"setupImage"),setTimeout(()=>{m.complete&&x()}),m.addEventListener("error",x),m.addEventListener("load",x)})))}c=u.getBoundingClientRect(),d.attr("width",c.width),d.attr("height",c.height)}return a?s.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"):s.attr("transform","translate(0, "+-c.height/2+")"),t.centerLabel&&s.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),s.insert("rect",":first-child"),{shapeSvg:n,bbox:c,halfPadding:h,label:s}},"labelHelper"),Sn=p(async(e,t,r)=>{const i=r.useHtmlLabels||Lt(dt()?.flowchart?.htmlLabels),a=e.insert("g").attr("class","label").attr("style",r.labelStyle||""),n=await He(a,Jt(hr(t),dt()),{useHtmlLabels:i,width:r.width||dt()?.flowchart?.wrappingWidth,style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img});let s=n.getBBox();const o=r.padding/2;if(Lt(dt()?.flowchart?.htmlLabels)){const l=n.children[0],c=ht(n);s=l.getBoundingClientRect(),c.attr("width",s.width),c.attr("height",s.height)}return i?a.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"):a.attr("transform","translate(0, "+-s.height/2+")"),r.centerLabel&&a.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),a.insert("rect",":first-child"),{shapeSvg:e,bbox:s,halfPadding:o,label:a}},"insertLabel"),G=p((e,t)=>{const r=t.node().getBBox();e.width=r.width,e.height=r.height},"updateNodeBounds"),rt=p((e,t)=>(e.look==="handDrawn"?"rough-node":"node")+" "+e.cssClasses+" "+(t||""),"getNodeClasses");function lt(e){const t=e.map((r,i)=>`${i===0?"M":"L"}${r.x},${r.y}`);return t.push("Z"),t.join(" ")}p(lt,"createPathFromPoints");function We(e,t,r,i,a,n){const s=[],l=r-e,c=i-t,h=l/n,u=2*Math.PI/h,d=t+c/2;for(let f=0;f<=50;f++){const g=f/50,m=e+g*l,y=d+a*Math.sin(u*(m-e));s.push({x:m,y})}return s}p(We,"generateFullSineWavePoints");function gi(e,t,r,i,a,n){const s=[],o=a*Math.PI/180,h=(n*Math.PI/180-o)/(i-1);for(let u=0;u{var r=e.x,i=e.y,a=t.x-r,n=t.y-i,s=e.width/2,o=e.height/2,l,c;return Math.abs(n)*s>Math.abs(a)*o?(n<0&&(o=-o),l=n===0?0:o*a/n,c=o):(a<0&&(s=-s),l=s,c=a===0?0:s*n/a),{x:r+l,y:i+c}},"intersectRect"),Dr=w2;function gd(e,t){t&&e.attr("style",t)}p(gd,"applyStyle");async function md(e){const t=ht(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),r=t.append("xhtml:div"),i=dt();let a=e.label;e.label&&Tr(e.label)&&(a=await ws(e.label.replace(Mr.lineBreakRegex,` +`),i));const s='"+a+"";return r.html(Jt(s,i)),gd(r,e.labelStyle),r.style("display","inline-block"),r.style("padding-right","1px"),r.style("white-space","nowrap"),r.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}p(md,"addHtmlLabel");var v2=p(async(e,t,r,i)=>{let a=e||"";if(typeof a=="object"&&(a=a[0]),Lt(dt().flowchart.htmlLabels)){a=a.replace(/\\n|\n/g,"
          "),F.info("vertexText"+a);const n={isNode:i,label:hr(a).replace(/fa[blrs]?:fa-[\w-]+/g,o=>``),labelStyle:t&&t.replace("fill:","color:")};return await md(n)}else{const n=document.createElementNS("http://www.w3.org/2000/svg","text");n.setAttribute("style",t.replace("color:","fill:"));let s=[];typeof a=="string"?s=a.split(/\\n|\n|/gi):Array.isArray(a)?s=a:s=[];for(const o of s){const l=document.createElementNS("http://www.w3.org/2000/svg","tspan");l.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),l.setAttribute("dy","1em"),l.setAttribute("x","0"),r?l.setAttribute("class","title-row"):l.setAttribute("class","row"),l.textContent=o.trim(),n.appendChild(l)}return n}},"createLabel"),tr=v2,je=p((e,t,r,i,a)=>["M",e+a,t,"H",e+r-a,"A",a,a,0,0,1,e+r,t+a,"V",t+i-a,"A",a,a,0,0,1,e+r-a,t+i,"H",e+a,"A",a,a,0,0,1,e,t+i-a,"V",t+a,"A",a,a,0,0,1,e+a,t,"Z"].join(" "),"createRoundedRectPathD"),yd=p(async(e,t)=>{F.info("Creating subgraph rect for ",t.id,t);const r=dt(),{themeVariables:i,handDrawnSeed:a}=r,{clusterBkg:n,clusterBorder:s}=i,{labelStyles:o,nodeStyles:l,borderStyles:c,backgroundStyles:h}=U(t),u=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),d=Lt(r.flowchart.htmlLabels),f=u.insert("g").attr("class","cluster-label "),g=await He(f,t.label,{style:t.labelStyle,useHtmlLabels:d,isNode:!0});let m=g.getBBox();if(Lt(r.flowchart.htmlLabels)){const T=g.children[0],D=ht(g);m=T.getBoundingClientRect(),D.attr("width",m.width),D.attr("height",m.height)}const y=t.width<=m.width+t.padding?m.width+t.padding:t.width;t.width<=m.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;const x=t.height,b=t.x-y/2,k=t.y-x/2;F.trace("Data ",t,JSON.stringify(t));let v;if(t.look==="handDrawn"){const T=j.svg(u),D=Y(t,{roughness:.7,fill:n,stroke:s,fillWeight:3,seed:a}),I=T.path(je(b,k,y,x,0),D);v=u.insert(()=>(F.debug("Rough node insert CXC",I),I),":first-child"),v.select("path:nth-child(2)").attr("style",c.join(";")),v.select("path").attr("style",h.join(";").replace("fill","stroke"))}else v=u.insert("rect",":first-child"),v.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",b).attr("y",k).attr("width",y).attr("height",x);const{subGraphTitleTopMargin:w}=Is(r);if(f.attr("transform",`translate(${t.x-m.width/2}, ${t.y-t.height/2+w})`),o){const T=f.select("span");T&&T.attr("style",o)}const L=v.node().getBBox();return t.offsetX=0,t.width=L.width,t.height=L.height,t.offsetY=m.height-t.padding/2,t.intersect=function(T){return Dr(t,T)},{cluster:u,labelBBox:m}},"rect"),S2=p((e,t)=>{const r=e.insert("g").attr("class","note-cluster").attr("id",t.id),i=r.insert("rect",":first-child"),a=0*t.padding,n=a/2;i.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-n).attr("y",t.y-t.height/2-n).attr("width",t.width+a).attr("height",t.height+a).attr("fill","none");const s=i.node().getBBox();return t.width=s.width,t.height=s.height,t.intersect=function(o){return Dr(t,o)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),T2=p(async(e,t)=>{const r=dt(),{themeVariables:i,handDrawnSeed:a}=r,{altBackground:n,compositeBackground:s,compositeTitleBackground:o,nodeBorder:l}=i,c=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-id",t.id).attr("data-look",t.look),h=c.insert("g",":first-child"),u=c.insert("g").attr("class","cluster-label");let d=c.append("rect");const f=u.node().appendChild(await tr(t.label,t.labelStyle,void 0,!0));let g=f.getBBox();if(Lt(r.flowchart.htmlLabels)){const I=f.children[0],O=ht(f);g=I.getBoundingClientRect(),O.attr("width",g.width),O.attr("height",g.height)}const m=0*t.padding,y=m/2,x=(t.width<=g.width+t.padding?g.width+t.padding:t.width)+m;t.width<=g.width+t.padding?t.diff=(x-t.width)/2-t.padding:t.diff=-t.padding;const b=t.height+m,k=t.height+m-g.height-6,v=t.x-x/2,w=t.y-b/2;t.width=x;const L=t.y-t.height/2-y+g.height+2;let T;if(t.look==="handDrawn"){const I=t.cssClasses.includes("statediagram-cluster-alt"),O=j.svg(c),E=t.rx||t.ry?O.path(je(v,w,x,b,10),{roughness:.7,fill:o,fillStyle:"solid",stroke:l,seed:a}):O.rectangle(v,w,x,b,{seed:a});T=c.insert(()=>E,":first-child");const N=O.rectangle(v,L,x,k,{fill:I?n:s,fillStyle:I?"hachure":"solid",stroke:l,seed:a});T=c.insert(()=>E,":first-child"),d=c.insert(()=>N)}else T=h.insert("rect",":first-child"),T.attr("class","outer").attr("x",v).attr("y",w).attr("width",x).attr("height",b).attr("data-look",t.look),d.attr("class","inner").attr("x",v).attr("y",L).attr("width",x).attr("height",k);u.attr("transform",`translate(${t.x-g.width/2}, ${w+1-(Lt(r.flowchart.htmlLabels)?0:3)})`);const D=T.node().getBBox();return t.height=D.height,t.offsetX=0,t.offsetY=g.height-t.padding/2,t.labelBBox=g,t.intersect=function(I){return Dr(t,I)},{cluster:c,labelBBox:g}},"roundedWithTitle"),_2=p(async(e,t)=>{F.info("Creating subgraph rect for ",t.id,t);const r=dt(),{themeVariables:i,handDrawnSeed:a}=r,{clusterBkg:n,clusterBorder:s}=i,{labelStyles:o,nodeStyles:l,borderStyles:c,backgroundStyles:h}=U(t),u=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),d=Lt(r.flowchart.htmlLabels),f=u.insert("g").attr("class","cluster-label "),g=await He(f,t.label,{style:t.labelStyle,useHtmlLabels:d,isNode:!0,width:t.width});let m=g.getBBox();if(Lt(r.flowchart.htmlLabels)){const T=g.children[0],D=ht(g);m=T.getBoundingClientRect(),D.attr("width",m.width),D.attr("height",m.height)}const y=t.width<=m.width+t.padding?m.width+t.padding:t.width;t.width<=m.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;const x=t.height,b=t.x-y/2,k=t.y-x/2;F.trace("Data ",t,JSON.stringify(t));let v;if(t.look==="handDrawn"){const T=j.svg(u),D=Y(t,{roughness:.7,fill:n,stroke:s,fillWeight:4,seed:a}),I=T.path(je(b,k,y,x,t.rx),D);v=u.insert(()=>(F.debug("Rough node insert CXC",I),I),":first-child"),v.select("path:nth-child(2)").attr("style",c.join(";")),v.select("path").attr("style",h.join(";").replace("fill","stroke"))}else v=u.insert("rect",":first-child"),v.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",b).attr("y",k).attr("width",y).attr("height",x);const{subGraphTitleTopMargin:w}=Is(r);if(f.attr("transform",`translate(${t.x-m.width/2}, ${t.y-t.height/2+w})`),o){const T=f.select("span");T&&T.attr("style",o)}const L=v.node().getBBox();return t.offsetX=0,t.width=L.width,t.height=L.height,t.offsetY=m.height-t.padding/2,t.intersect=function(T){return Dr(t,T)},{cluster:u,labelBBox:m}},"kanbanSection"),B2=p((e,t)=>{const r=dt(),{themeVariables:i,handDrawnSeed:a}=r,{nodeBorder:n}=i,s=e.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-look",t.look),o=s.insert("g",":first-child"),l=0*t.padding,c=t.width+l;t.diff=-t.padding;const h=t.height+l,u=t.x-c/2,d=t.y-h/2;t.width=c;let f;if(t.look==="handDrawn"){const y=j.svg(s).rectangle(u,d,c,h,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:n,seed:a});f=s.insert(()=>y,":first-child")}else f=o.insert("rect",":first-child"),f.attr("class","divider").attr("x",u).attr("y",d).attr("width",c).attr("height",h).attr("data-look",t.look);const g=f.node().getBBox();return t.height=g.height,t.offsetX=0,t.offsetY=0,t.intersect=function(m){return Dr(t,m)},{cluster:s,labelBBox:{}}},"divider"),L2=yd,A2={rect:yd,squareRect:L2,roundedWithTitle:T2,noteGroup:S2,divider:B2,kanbanSection:_2},xd=new Map,M2=p(async(e,t)=>{const r=t.shape||"rect",i=await A2[r](e,t);return xd.set(t.id,i),i},"insertCluster"),KS=p(()=>{xd=new Map},"clear");function bd(e,t){return e.intersect(t)}p(bd,"intersectNode");var E2=bd;function Cd(e,t,r,i){var a=e.x,n=e.y,s=a-i.x,o=n-i.y,l=Math.sqrt(t*t*o*o+r*r*s*s),c=Math.abs(t*r*s/l);i.x0}p(cs,"sameSign");var F2=vd;function Sd(e,t,r){let i=e.x,a=e.y,n=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(h){s=Math.min(s,h.x),o=Math.min(o,h.y)}):(s=Math.min(s,t.x),o=Math.min(o,t.y));let l=i-e.width/2-s,c=a-e.height/2-o;for(let h=0;h1&&n.sort(function(h,u){let d=h.x-r.x,f=h.y-r.y,g=Math.sqrt(d*d+f*f),m=u.x-r.x,y=u.y-r.y,x=Math.sqrt(m*m+y*y);return gh,":first-child");return u.attr("class","anchor").attr("style",It(o)),G(t,u),t.intersect=function(d){return F.info("Circle intersect",t,s,d),W.circle(t,s,d)},n}p(Td,"anchor");function hs(e,t,r,i,a,n,s){const l=(e+r)/2,c=(t+i)/2,h=Math.atan2(i-t,r-e),u=(r-e)/2,d=(i-t)/2,f=u/a,g=d/n,m=Math.sqrt(f**2+g**2);if(m>1)throw new Error("The given radii are too small to create an arc between the points.");const y=Math.sqrt(1-m**2),x=l+y*n*Math.sin(h)*(s?-1:1),b=c-y*a*Math.cos(h)*(s?-1:1),k=Math.atan2((t-b)/n,(e-x)/a);let w=Math.atan2((i-b)/n,(r-x)/a)-k;s&&w<0&&(w+=2*Math.PI),!s&&w>0&&(w-=2*Math.PI);const L=[];for(let T=0;T<20;T++){const D=T/19,I=k+D*w,O=x+a*Math.cos(I),E=b+n*Math.sin(I);L.push({x:O,y:E})}return L}p(hs,"generateArcPoints");async function _d(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=n.width+t.padding+20,o=n.height+t.padding,l=o/2,c=l/(2.5+o/50),{cssStyles:h}=t,u=[{x:s/2,y:-o/2},{x:-s/2,y:-o/2},...hs(-s/2,-o/2,-s/2,o/2,c,l,!1),{x:s/2,y:o/2},...hs(s/2,o/2,s/2,-o/2,c,l,!0)],d=j.svg(a),f=Y(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const g=lt(u),m=d.path(g,f),y=a.insert(()=>m,":first-child");return y.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",h),i&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",i),y.attr("transform",`translate(${c/2}, 0)`),G(t,y),t.intersect=function(x){return W.polygon(t,u,x)},a}p(_d,"bowTieRect");function Ye(e,t,r,i){return e.insert("polygon",":first-child").attr("points",i.map(function(a){return a.x+","+a.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+r/2+")")}p(Ye,"insertPolygonShape");async function Bd(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=n.height+t.padding,o=12,l=n.width+t.padding+o,c=0,h=l,u=-s,d=0,f=[{x:c+o,y:u},{x:h,y:u},{x:h,y:d},{x:c,y:d},{x:c,y:u+o},{x:c+o,y:u}];let g;const{cssStyles:m}=t;if(t.look==="handDrawn"){const y=j.svg(a),x=Y(t,{}),b=lt(f),k=y.path(b,x);g=a.insert(()=>k,":first-child").attr("transform",`translate(${-l/2}, ${s/2})`),m&&g.attr("style",m)}else g=Ye(a,l,s,f);return i&&g.attr("style",i),G(t,g),t.intersect=function(y){return W.polygon(t,f,y)},a}p(Bd,"card");function Ld(e,t){const{nodeStyles:r}=U(t);t.label="";const i=e.insert("g").attr("class",rt(t)).attr("id",t.domId??t.id),{cssStyles:a}=t,n=Math.max(28,t.width??0),s=[{x:0,y:n/2},{x:n/2,y:0},{x:0,y:-n/2},{x:-n/2,y:0}],o=j.svg(i),l=Y(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=lt(s),h=o.path(c,l),u=i.insert(()=>h,":first-child");return a&&t.look!=="handDrawn"&&u.selectAll("path").attr("style",a),r&&t.look!=="handDrawn"&&u.selectAll("path").attr("style",r),t.width=28,t.height=28,t.intersect=function(d){return W.polygon(t,s,d)},i}p(Ld,"choice");async function so(e,t,r){const{labelStyles:i,nodeStyles:a}=U(t);t.labelStyle=i;const{shapeSvg:n,bbox:s,halfPadding:o}=await it(e,t,rt(t)),l=r?.padding??o,c=s.width/2+l;let h;const{cssStyles:u}=t;if(t.look==="handDrawn"){const d=j.svg(n),f=Y(t,{}),g=d.circle(0,0,c*2,f);h=n.insert(()=>g,":first-child"),h.attr("class","basic label-container").attr("style",It(u))}else h=n.insert("circle",":first-child").attr("class","basic label-container").attr("style",a).attr("r",c).attr("cx",0).attr("cy",0);return G(t,h),t.calcIntersect=function(d,f){const g=d.width/2;return W.circle(d,g,f)},t.intersect=function(d){return F.info("Circle intersect",t,c,d),W.circle(t,c,d)},n}p(so,"circle");function Ad(e){const t=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),i=e*2,a={x:i/2*t,y:i/2*r},n={x:-(i/2)*t,y:i/2*r},s={x:-(i/2)*t,y:-(i/2)*r},o={x:i/2*t,y:-(i/2)*r};return`M ${n.x},${n.y} L ${o.x},${o.y} + M ${a.x},${a.y} L ${s.x},${s.y}`}p(Ad,"createLine");function Md(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r,t.label="";const a=e.insert("g").attr("class",rt(t)).attr("id",t.domId??t.id),n=Math.max(30,t?.width??0),{cssStyles:s}=t,o=j.svg(a),l=Y(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=o.circle(0,0,n*2,l),h=Ad(n),u=o.path(h,l),d=a.insert(()=>c,":first-child");return d.insert(()=>u),s&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",s),i&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",i),G(t,d),t.intersect=function(f){return F.info("crossedCircle intersect",t,{radius:n,point:f}),W.circle(t,n,f)},a}p(Md,"crossedCircle");function Be(e,t,r,i=100,a=0,n=180){const s=[],o=a*Math.PI/180,h=(n*Math.PI/180-o)/(i-1);for(let u=0;uk,":first-child").attr("stroke-opacity",0),v.insert(()=>x,":first-child"),v.attr("class","text"),h&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",h),i&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",i),v.attr("transform",`translate(${c}, 0)`),s.attr("transform",`translate(${-o/2+c-(n.x-(n.left??0))},${-l/2+(t.padding??0)/2-(n.y-(n.top??0))})`),G(t,v),t.intersect=function(w){return W.polygon(t,d,w)},a}p(Ed,"curlyBraceLeft");function Le(e,t,r,i=100,a=0,n=180){const s=[],o=a*Math.PI/180,h=(n*Math.PI/180-o)/(i-1);for(let u=0;uk,":first-child").attr("stroke-opacity",0),v.insert(()=>x,":first-child"),v.attr("class","text"),h&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",h),i&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",i),v.attr("transform",`translate(${-c}, 0)`),s.attr("transform",`translate(${-o/2+(t.padding??0)/2-(n.x-(n.left??0))},${-l/2+(t.padding??0)/2-(n.y-(n.top??0))})`),G(t,v),t.intersect=function(w){return W.polygon(t,d,w)},a}p($d,"curlyBraceRight");function Mt(e,t,r,i=100,a=0,n=180){const s=[],o=a*Math.PI/180,h=(n*Math.PI/180-o)/(i-1);for(let u=0;uT,":first-child").attr("stroke-opacity",0),D.insert(()=>b,":first-child"),D.insert(()=>w,":first-child"),D.attr("class","text"),h&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",h),i&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",i),D.attr("transform",`translate(${c-c/4}, 0)`),s.attr("transform",`translate(${-o/2+(t.padding??0)/2-(n.x-(n.left??0))},${-l/2+(t.padding??0)/2-(n.y-(n.top??0))})`),G(t,D),t.intersect=function(I){return W.polygon(t,f,I)},a}p(Fd,"curlyBraces");async function Dd(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=80,o=20,l=Math.max(s,(n.width+(t.padding??0)*2)*1.25,t?.width??0),c=Math.max(o,n.height+(t.padding??0)*2,t?.height??0),h=c/2,{cssStyles:u}=t,d=j.svg(a),f=Y(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const g=l,m=c,y=g-h,x=m/4,b=[{x:y,y:0},{x,y:0},{x:0,y:m/2},{x,y:m},{x:y,y:m},...gi(-y,-m/2,h,50,270,90)],k=lt(b),v=d.path(k,f),w=a.insert(()=>v,":first-child");return w.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",u),i&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",i),w.attr("transform",`translate(${-l/2}, ${-c/2})`),G(t,w),t.intersect=function(L){return W.polygon(t,b,L)},a}p(Dd,"curvedTrapezoid");var O2=p((e,t,r,i,a,n)=>[`M${e},${t+n}`,`a${a},${n} 0,0,0 ${r},0`,`a${a},${n} 0,0,0 ${-r},0`,`l0,${i}`,`a${a},${n} 0,0,0 ${r},0`,`l0,${-i}`].join(" "),"createCylinderPathD"),R2=p((e,t,r,i,a,n)=>[`M${e},${t+n}`,`M${e+r},${t+n}`,`a${a},${n} 0,0,0 ${-r},0`,`l0,${i}`,`a${a},${n} 0,0,0 ${r},0`,`l0,${-i}`].join(" "),"createOuterCylinderPathD"),I2=p((e,t,r,i,a,n)=>[`M${e-r/2},${-i/2}`,`a${a},${n} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");async function Od(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=Math.max(n.width+t.padding,t.width??0),l=o/2,c=l/(2.5+o/50),h=Math.max(n.height+c+t.padding,t.height??0);let u;const{cssStyles:d}=t;if(t.look==="handDrawn"){const f=j.svg(a),g=R2(0,0,o,h,l,c),m=I2(0,c,o,h,l,c),y=f.path(g,Y(t,{})),x=f.path(m,Y(t,{fill:"none"}));u=a.insert(()=>x,":first-child"),u=a.insert(()=>y,":first-child"),u.attr("class","basic label-container"),d&&u.attr("style",d)}else{const f=O2(0,0,o,h,l,c);u=a.insert("path",":first-child").attr("d",f).attr("class","basic label-container").attr("style",It(d)).attr("style",i)}return u.attr("label-offset-y",c),u.attr("transform",`translate(${-o/2}, ${-(h/2+c)})`),G(t,u),s.attr("transform",`translate(${-(n.width/2)-(n.x-(n.left??0))}, ${-(n.height/2)+(t.padding??0)/1.5-(n.y-(n.top??0))})`),t.intersect=function(f){const g=W.rect(t,f),m=g.x-(t.x??0);if(l!=0&&(Math.abs(m)<(t.width??0)/2||Math.abs(m)==(t.width??0)/2&&Math.abs(g.y-(t.y??0))>(t.height??0)/2-c)){let y=c*c*(1-m*m/(l*l));y>0&&(y=Math.sqrt(y)),y=c-y,f.y-(t.y??0)>0&&(y=-y),g.y+=y}return g},a}p(Od,"cylinder");async function Rd(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=n.width+t.padding,l=n.height+t.padding,c=l*.2,h=-o/2,u=-l/2-c/2,{cssStyles:d}=t,f=j.svg(a),g=Y(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const m=[{x:h,y:u+c},{x:-h,y:u+c},{x:-h,y:-u},{x:h,y:-u},{x:h,y:u},{x:-h,y:u},{x:-h,y:u+c}],y=f.polygon(m.map(b=>[b.x,b.y]),g),x=a.insert(()=>y,":first-child");return x.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",i),s.attr("transform",`translate(${h+(t.padding??0)/2-(n.x-(n.left??0))}, ${u+c+(t.padding??0)/2-(n.y-(n.top??0))})`),G(t,x),t.intersect=function(b){return W.rect(t,b)},a}p(Rd,"dividedRectangle");async function Id(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,halfPadding:s}=await it(e,t,rt(t)),l=n.width/2+s+5,c=n.width/2+s;let h;const{cssStyles:u}=t;if(t.look==="handDrawn"){const d=j.svg(a),f=Y(t,{roughness:.2,strokeWidth:2.5}),g=Y(t,{roughness:.2,strokeWidth:1.5}),m=d.circle(0,0,l*2,f),y=d.circle(0,0,c*2,g);h=a.insert("g",":first-child"),h.attr("class",It(t.cssClasses)).attr("style",It(u)),h.node()?.appendChild(m),h.node()?.appendChild(y)}else{h=a.insert("g",":first-child");const d=h.insert("circle",":first-child"),f=h.insert("circle");h.attr("class","basic label-container").attr("style",i),d.attr("class","outer-circle").attr("style",i).attr("r",l).attr("cx",0).attr("cy",0),f.attr("class","inner-circle").attr("style",i).attr("r",c).attr("cx",0).attr("cy",0)}return G(t,h),t.intersect=function(d){return F.info("DoubleCircle intersect",t,l,d),W.circle(t,l,d)},a}p(Id,"doublecircle");function Pd(e,t,{config:{themeVariables:r}}){const{labelStyles:i,nodeStyles:a}=U(t);t.label="",t.labelStyle=i;const n=e.insert("g").attr("class",rt(t)).attr("id",t.domId??t.id),s=7,{cssStyles:o}=t,l=j.svg(n),{nodeBorder:c}=r,h=Y(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(h.roughness=0);const u=l.circle(0,0,s*2,h),d=n.insert(()=>u,":first-child");return d.selectAll("path").attr("style",`fill: ${c} !important;`),o&&o.length>0&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",o),a&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",a),G(t,d),t.intersect=function(f){return F.info("filledCircle intersect",t,{radius:s,point:f}),W.circle(t,s,f)},n}p(Pd,"filledCircle");async function Nd(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=n.width+(t.padding??0),l=o+n.height,c=o+n.height,h=[{x:0,y:-l},{x:c,y:-l},{x:c/2,y:0}],{cssStyles:u}=t,d=j.svg(a),f=Y(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const g=lt(h),m=d.path(g,f),y=a.insert(()=>m,":first-child").attr("transform",`translate(${-l/2}, ${l/2})`);return u&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",u),i&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",i),t.width=o,t.height=l,G(t,y),s.attr("transform",`translate(${-n.width/2-(n.x-(n.left??0))}, ${-l/2+(t.padding??0)/2+(n.y-(n.top??0))})`),t.intersect=function(x){return F.info("Triangle intersect",t,h,x),W.polygon(t,h,x)},a}p(Nd,"flippedTriangle");function zd(e,t,{dir:r,config:{state:i,themeVariables:a}}){const{nodeStyles:n}=U(t);t.label="";const s=e.insert("g").attr("class",rt(t)).attr("id",t.domId??t.id),{cssStyles:o}=t;let l=Math.max(70,t?.width??0),c=Math.max(10,t?.height??0);r==="LR"&&(l=Math.max(10,t?.width??0),c=Math.max(70,t?.height??0));const h=-1*l/2,u=-1*c/2,d=j.svg(s),f=Y(t,{stroke:a.lineColor,fill:a.lineColor});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const g=d.rectangle(h,u,l,c,f),m=s.insert(()=>g,":first-child");o&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",o),n&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",n),G(t,m);const y=i?.padding??0;return t.width&&t.height&&(t.width+=y/2||0,t.height+=y/2||0),t.intersect=function(x){return W.rect(t,x)},s}p(zd,"forkJoin");async function Wd(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const a=80,n=50,{shapeSvg:s,bbox:o}=await it(e,t,rt(t)),l=Math.max(a,o.width+(t.padding??0)*2,t?.width??0),c=Math.max(n,o.height+(t.padding??0)*2,t?.height??0),h=c/2,{cssStyles:u}=t,d=j.svg(s),f=Y(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const g=[{x:-l/2,y:-c/2},{x:l/2-h,y:-c/2},...gi(-l/2+h,0,h,50,90,270),{x:l/2-h,y:c/2},{x:-l/2,y:c/2}],m=lt(g),y=d.path(m,f),x=s.insert(()=>y,":first-child");return x.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",u),i&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",i),G(t,x),t.intersect=function(b){return F.info("Pill intersect",t,{radius:h,point:b}),W.polygon(t,g,b)},s}p(Wd,"halfRoundedRectangle");async function qd(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=n.height+(t.padding??0),o=n.width+(t.padding??0)*2.5,{cssStyles:l}=t,c=j.svg(a),h=Y(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");let u=o/2;const d=u/6;u=u+d;const f=s/2,g=f/2,m=u-g,y=[{x:-m,y:-f},{x:0,y:-f},{x:m,y:-f},{x:u,y:0},{x:m,y:f},{x:0,y:f},{x:-m,y:f},{x:-u,y:0}],x=lt(y),b=c.path(x,h),k=a.insert(()=>b,":first-child");return k.attr("class","basic label-container"),l&&t.look!=="handDrawn"&&k.selectChildren("path").attr("style",l),i&&t.look!=="handDrawn"&&k.selectChildren("path").attr("style",i),t.width=o,t.height=s,G(t,k),t.intersect=function(v){return W.polygon(t,y,v)},a}p(qd,"hexagon");async function Hd(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.label="",t.labelStyle=r;const{shapeSvg:a}=await it(e,t,rt(t)),n=Math.max(30,t?.width??0),s=Math.max(30,t?.height??0),{cssStyles:o}=t,l=j.svg(a),c=Y(t,{});t.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const h=[{x:0,y:0},{x:n,y:0},{x:0,y:s},{x:n,y:s}],u=lt(h),d=l.path(u,c),f=a.insert(()=>d,":first-child");return f.attr("class","basic label-container"),o&&t.look!=="handDrawn"&&f.selectChildren("path").attr("style",o),i&&t.look!=="handDrawn"&&f.selectChildren("path").attr("style",i),f.attr("transform",`translate(${-n/2}, ${-s/2})`),G(t,f),t.intersect=function(g){return F.info("Pill intersect",t,{points:h}),W.polygon(t,h,g)},a}p(Hd,"hourglass");async function jd(e,t,{config:{themeVariables:r,flowchart:i}}){const{labelStyles:a}=U(t);t.labelStyle=a;const n=t.assetHeight??48,s=t.assetWidth??48,o=Math.max(n,s),l=i?.wrappingWidth;t.width=Math.max(o,l??0);const{shapeSvg:c,bbox:h,label:u}=await it(e,t,"icon-shape default"),d=t.pos==="t",f=o,g=o,{nodeBorder:m}=r,{stylesMap:y}=Er(t),x=-g/2,b=-f/2,k=t.label?8:0,v=j.svg(c),w=Y(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const L=v.rectangle(x,b,g,f,w),T=Math.max(g,h.width),D=f+h.height+k,I=v.rectangle(-T/2,-D/2,T,D,{...w,fill:"transparent",stroke:"none"}),O=c.insert(()=>L,":first-child"),E=c.insert(()=>I);if(t.icon){const N=c.append("g");N.html(`${await Si(t.icon,{height:o,width:o,fallbackPrefix:""})}`);const R=N.node().getBBox(),B=R.width,A=R.height,_=R.x,$=R.y;N.attr("transform",`translate(${-B/2-_},${d?h.height/2+k/2-A/2-$:-h.height/2-k/2-A/2-$})`),N.attr("style",`color: ${y.get("stroke")??m};`)}return u.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${d?-D/2:D/2-h.height})`),O.attr("transform",`translate(0,${d?h.height/2+k/2:-h.height/2-k/2})`),G(t,E),t.intersect=function(N){if(F.info("iconSquare intersect",t,N),!t.label)return W.rect(t,N);const R=t.x??0,B=t.y??0,A=t.height??0;let _=[];return d?_=[{x:R-h.width/2,y:B-A/2},{x:R+h.width/2,y:B-A/2},{x:R+h.width/2,y:B-A/2+h.height+k},{x:R+g/2,y:B-A/2+h.height+k},{x:R+g/2,y:B+A/2},{x:R-g/2,y:B+A/2},{x:R-g/2,y:B-A/2+h.height+k},{x:R-h.width/2,y:B-A/2+h.height+k}]:_=[{x:R-g/2,y:B-A/2},{x:R+g/2,y:B-A/2},{x:R+g/2,y:B-A/2+f},{x:R+h.width/2,y:B-A/2+f},{x:R+h.width/2/2,y:B+A/2},{x:R-h.width/2,y:B+A/2},{x:R-h.width/2,y:B-A/2+f},{x:R-g/2,y:B-A/2+f}],W.polygon(t,_,N)},c}p(jd,"icon");async function Yd(e,t,{config:{themeVariables:r,flowchart:i}}){const{labelStyles:a}=U(t);t.labelStyle=a;const n=t.assetHeight??48,s=t.assetWidth??48,o=Math.max(n,s),l=i?.wrappingWidth;t.width=Math.max(o,l??0);const{shapeSvg:c,bbox:h,label:u}=await it(e,t,"icon-shape default"),d=20,f=t.label?8:0,g=t.pos==="t",{nodeBorder:m,mainBkg:y}=r,{stylesMap:x}=Er(t),b=j.svg(c),k=Y(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const v=x.get("fill");k.stroke=v??y;const w=c.append("g");t.icon&&w.html(`${await Si(t.icon,{height:o,width:o,fallbackPrefix:""})}`);const L=w.node().getBBox(),T=L.width,D=L.height,I=L.x,O=L.y,E=Math.max(T,D)*Math.SQRT2+d*2,N=b.circle(0,0,E,k),R=Math.max(E,h.width),B=E+h.height+f,A=b.rectangle(-R/2,-B/2,R,B,{...k,fill:"transparent",stroke:"none"}),_=c.insert(()=>N,":first-child"),$=c.insert(()=>A);return w.attr("transform",`translate(${-T/2-I},${g?h.height/2+f/2-D/2-O:-h.height/2-f/2-D/2-O})`),w.attr("style",`color: ${x.get("stroke")??m};`),u.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${g?-B/2:B/2-h.height})`),_.attr("transform",`translate(0,${g?h.height/2+f/2:-h.height/2-f/2})`),G(t,$),t.intersect=function(M){return F.info("iconSquare intersect",t,M),W.rect(t,M)},c}p(Yd,"iconCircle");async function Ud(e,t,{config:{themeVariables:r,flowchart:i}}){const{labelStyles:a}=U(t);t.labelStyle=a;const n=t.assetHeight??48,s=t.assetWidth??48,o=Math.max(n,s),l=i?.wrappingWidth;t.width=Math.max(o,l??0);const{shapeSvg:c,bbox:h,halfPadding:u,label:d}=await it(e,t,"icon-shape default"),f=t.pos==="t",g=o+u*2,m=o+u*2,{nodeBorder:y,mainBkg:x}=r,{stylesMap:b}=Er(t),k=-m/2,v=-g/2,w=t.label?8:0,L=j.svg(c),T=Y(t,{});t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");const D=b.get("fill");T.stroke=D??x;const I=L.path(je(k,v,m,g,5),T),O=Math.max(m,h.width),E=g+h.height+w,N=L.rectangle(-O/2,-E/2,O,E,{...T,fill:"transparent",stroke:"none"}),R=c.insert(()=>I,":first-child").attr("class","icon-shape2"),B=c.insert(()=>N);if(t.icon){const A=c.append("g");A.html(`${await Si(t.icon,{height:o,width:o,fallbackPrefix:""})}`);const _=A.node().getBBox(),$=_.width,M=_.height,q=_.x,V=_.y;A.attr("transform",`translate(${-$/2-q},${f?h.height/2+w/2-M/2-V:-h.height/2-w/2-M/2-V})`),A.attr("style",`color: ${b.get("stroke")??y};`)}return d.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${f?-E/2:E/2-h.height})`),R.attr("transform",`translate(0,${f?h.height/2+w/2:-h.height/2-w/2})`),G(t,B),t.intersect=function(A){if(F.info("iconSquare intersect",t,A),!t.label)return W.rect(t,A);const _=t.x??0,$=t.y??0,M=t.height??0;let q=[];return f?q=[{x:_-h.width/2,y:$-M/2},{x:_+h.width/2,y:$-M/2},{x:_+h.width/2,y:$-M/2+h.height+w},{x:_+m/2,y:$-M/2+h.height+w},{x:_+m/2,y:$+M/2},{x:_-m/2,y:$+M/2},{x:_-m/2,y:$-M/2+h.height+w},{x:_-h.width/2,y:$-M/2+h.height+w}]:q=[{x:_-m/2,y:$-M/2},{x:_+m/2,y:$-M/2},{x:_+m/2,y:$-M/2+g},{x:_+h.width/2,y:$-M/2+g},{x:_+h.width/2/2,y:$+M/2},{x:_-h.width/2,y:$+M/2},{x:_-h.width/2,y:$-M/2+g},{x:_-m/2,y:$-M/2+g}],W.polygon(t,q,A)},c}p(Ud,"iconRounded");async function Gd(e,t,{config:{themeVariables:r,flowchart:i}}){const{labelStyles:a}=U(t);t.labelStyle=a;const n=t.assetHeight??48,s=t.assetWidth??48,o=Math.max(n,s),l=i?.wrappingWidth;t.width=Math.max(o,l??0);const{shapeSvg:c,bbox:h,halfPadding:u,label:d}=await it(e,t,"icon-shape default"),f=t.pos==="t",g=o+u*2,m=o+u*2,{nodeBorder:y,mainBkg:x}=r,{stylesMap:b}=Er(t),k=-m/2,v=-g/2,w=t.label?8:0,L=j.svg(c),T=Y(t,{});t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");const D=b.get("fill");T.stroke=D??x;const I=L.path(je(k,v,m,g,.1),T),O=Math.max(m,h.width),E=g+h.height+w,N=L.rectangle(-O/2,-E/2,O,E,{...T,fill:"transparent",stroke:"none"}),R=c.insert(()=>I,":first-child"),B=c.insert(()=>N);if(t.icon){const A=c.append("g");A.html(`${await Si(t.icon,{height:o,width:o,fallbackPrefix:""})}`);const _=A.node().getBBox(),$=_.width,M=_.height,q=_.x,V=_.y;A.attr("transform",`translate(${-$/2-q},${f?h.height/2+w/2-M/2-V:-h.height/2-w/2-M/2-V})`),A.attr("style",`color: ${b.get("stroke")??y};`)}return d.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${f?-E/2:E/2-h.height})`),R.attr("transform",`translate(0,${f?h.height/2+w/2:-h.height/2-w/2})`),G(t,B),t.intersect=function(A){if(F.info("iconSquare intersect",t,A),!t.label)return W.rect(t,A);const _=t.x??0,$=t.y??0,M=t.height??0;let q=[];return f?q=[{x:_-h.width/2,y:$-M/2},{x:_+h.width/2,y:$-M/2},{x:_+h.width/2,y:$-M/2+h.height+w},{x:_+m/2,y:$-M/2+h.height+w},{x:_+m/2,y:$+M/2},{x:_-m/2,y:$+M/2},{x:_-m/2,y:$-M/2+h.height+w},{x:_-h.width/2,y:$-M/2+h.height+w}]:q=[{x:_-m/2,y:$-M/2},{x:_+m/2,y:$-M/2},{x:_+m/2,y:$-M/2+g},{x:_+h.width/2,y:$-M/2+g},{x:_+h.width/2/2,y:$+M/2},{x:_-h.width/2,y:$+M/2},{x:_-h.width/2,y:$-M/2+g},{x:_-m/2,y:$-M/2+g}],W.polygon(t,q,A)},c}p(Gd,"iconSquare");async function Vd(e,t,{config:{flowchart:r}}){const i=new Image;i.src=t?.img??"",await i.decode();const a=Number(i.naturalWidth.toString().replace("px","")),n=Number(i.naturalHeight.toString().replace("px",""));t.imageAspectRatio=a/n;const{labelStyles:s}=U(t);t.labelStyle=s;const o=r?.wrappingWidth;t.defaultWidth=r?.wrappingWidth;const l=Math.max(t.label?o??0:0,t?.assetWidth??a),c=t.constraint==="on"&&t?.assetHeight?t.assetHeight*t.imageAspectRatio:l,h=t.constraint==="on"?c/t.imageAspectRatio:t?.assetHeight??n;t.width=Math.max(c,o??0);const{shapeSvg:u,bbox:d,label:f}=await it(e,t,"image-shape default"),g=t.pos==="t",m=-c/2,y=-h/2,x=t.label?8:0,b=j.svg(u),k=Y(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const v=b.rectangle(m,y,c,h,k),w=Math.max(c,d.width),L=h+d.height+x,T=b.rectangle(-w/2,-L/2,w,L,{...k,fill:"none",stroke:"none"}),D=u.insert(()=>v,":first-child"),I=u.insert(()=>T);if(t.img){const O=u.append("image");O.attr("href",t.img),O.attr("width",c),O.attr("height",h),O.attr("preserveAspectRatio","none"),O.attr("transform",`translate(${-c/2},${g?L/2-h:-L/2})`)}return f.attr("transform",`translate(${-d.width/2-(d.x-(d.left??0))},${g?-h/2-d.height/2-x/2:h/2-d.height/2+x/2})`),D.attr("transform",`translate(0,${g?d.height/2+x/2:-d.height/2-x/2})`),G(t,I),t.intersect=function(O){if(F.info("iconSquare intersect",t,O),!t.label)return W.rect(t,O);const E=t.x??0,N=t.y??0,R=t.height??0;let B=[];return g?B=[{x:E-d.width/2,y:N-R/2},{x:E+d.width/2,y:N-R/2},{x:E+d.width/2,y:N-R/2+d.height+x},{x:E+c/2,y:N-R/2+d.height+x},{x:E+c/2,y:N+R/2},{x:E-c/2,y:N+R/2},{x:E-c/2,y:N-R/2+d.height+x},{x:E-d.width/2,y:N-R/2+d.height+x}]:B=[{x:E-c/2,y:N-R/2},{x:E+c/2,y:N-R/2},{x:E+c/2,y:N-R/2+h},{x:E+d.width/2,y:N-R/2+h},{x:E+d.width/2/2,y:N+R/2},{x:E-d.width/2,y:N+R/2},{x:E-d.width/2,y:N-R/2+h},{x:E-c/2,y:N-R/2+h}],W.polygon(t,B,O)},u}p(Vd,"imageSquare");async function Xd(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=Math.max(n.width+(t.padding??0)*2,t?.width??0),o=Math.max(n.height+(t.padding??0)*2,t?.height??0),l=[{x:0,y:0},{x:s,y:0},{x:s+3*o/6,y:-o},{x:-3*o/6,y:-o}];let c;const{cssStyles:h}=t;if(t.look==="handDrawn"){const u=j.svg(a),d=Y(t,{}),f=lt(l),g=u.path(f,d);c=a.insert(()=>g,":first-child").attr("transform",`translate(${-s/2}, ${o/2})`),h&&c.attr("style",h)}else c=Ye(a,s,o,l);return i&&c.attr("style",i),t.width=s,t.height=o,G(t,c),t.intersect=function(u){return W.polygon(t,l,u)},a}p(Xd,"inv_trapezoid");async function Ga(e,t,r){const{labelStyles:i,nodeStyles:a}=U(t);t.labelStyle=i;const{shapeSvg:n,bbox:s}=await it(e,t,rt(t)),o=Math.max(s.width+r.labelPaddingX*2,t?.width||0),l=Math.max(s.height+r.labelPaddingY*2,t?.height||0),c=-o/2,h=-l/2;let u,{rx:d,ry:f}=t;const{cssStyles:g}=t;if(r?.rx&&r.ry&&(d=r.rx,f=r.ry),t.look==="handDrawn"){const m=j.svg(n),y=Y(t,{}),x=d||f?m.path(je(c,h,o,l,d||0),y):m.rectangle(c,h,o,l,y);u=n.insert(()=>x,":first-child"),u.attr("class","basic label-container").attr("style",It(g))}else u=n.insert("rect",":first-child"),u.attr("class","basic label-container").attr("style",a).attr("rx",It(d)).attr("ry",It(f)).attr("x",c).attr("y",h).attr("width",o).attr("height",l);return G(t,u),t.calcIntersect=function(m,y){return W.rect(m,y)},t.intersect=function(m){return W.rect(t,m)},n}p(Ga,"drawRect");async function Zd(e,t){const{shapeSvg:r,bbox:i,label:a}=await it(e,t,"label"),n=r.insert("rect",":first-child");return n.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),a.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),G(t,n),t.intersect=function(l){return W.rect(t,l)},r}p(Zd,"labelRect");async function Kd(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=Math.max(n.width+(t.padding??0),t?.width??0),o=Math.max(n.height+(t.padding??0),t?.height??0),l=[{x:0,y:0},{x:s+3*o/6,y:0},{x:s,y:-o},{x:-(3*o)/6,y:-o}];let c;const{cssStyles:h}=t;if(t.look==="handDrawn"){const u=j.svg(a),d=Y(t,{}),f=lt(l),g=u.path(f,d);c=a.insert(()=>g,":first-child").attr("transform",`translate(${-s/2}, ${o/2})`),h&&c.attr("style",h)}else c=Ye(a,s,o,l);return i&&c.attr("style",i),t.width=s,t.height=o,G(t,c),t.intersect=function(u){return W.polygon(t,l,u)},a}p(Kd,"lean_left");async function Qd(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=Math.max(n.width+(t.padding??0),t?.width??0),o=Math.max(n.height+(t.padding??0),t?.height??0),l=[{x:-3*o/6,y:0},{x:s,y:0},{x:s+3*o/6,y:-o},{x:0,y:-o}];let c;const{cssStyles:h}=t;if(t.look==="handDrawn"){const u=j.svg(a),d=Y(t,{}),f=lt(l),g=u.path(f,d);c=a.insert(()=>g,":first-child").attr("transform",`translate(${-s/2}, ${o/2})`),h&&c.attr("style",h)}else c=Ye(a,s,o,l);return i&&c.attr("style",i),t.width=s,t.height=o,G(t,c),t.intersect=function(u){return W.polygon(t,l,u)},a}p(Qd,"lean_right");function Jd(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.label="",t.labelStyle=r;const a=e.insert("g").attr("class",rt(t)).attr("id",t.domId??t.id),{cssStyles:n}=t,s=Math.max(35,t?.width??0),o=Math.max(35,t?.height??0),l=7,c=[{x:s,y:0},{x:0,y:o+l/2},{x:s-2*l,y:o+l/2},{x:0,y:2*o},{x:s,y:o-l/2},{x:2*l,y:o-l/2}],h=j.svg(a),u=Y(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");const d=lt(c),f=h.path(d,u),g=a.insert(()=>f,":first-child");return n&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",n),i&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",i),g.attr("transform",`translate(-${s/2},${-o})`),G(t,g),t.intersect=function(m){return F.info("lightningBolt intersect",t,m),W.polygon(t,c,m)},a}p(Jd,"lightningBolt");var P2=p((e,t,r,i,a,n,s)=>[`M${e},${t+n}`,`a${a},${n} 0,0,0 ${r},0`,`a${a},${n} 0,0,0 ${-r},0`,`l0,${i}`,`a${a},${n} 0,0,0 ${r},0`,`l0,${-i}`,`M${e},${t+n+s}`,`a${a},${n} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),N2=p((e,t,r,i,a,n,s)=>[`M${e},${t+n}`,`M${e+r},${t+n}`,`a${a},${n} 0,0,0 ${-r},0`,`l0,${i}`,`a${a},${n} 0,0,0 ${r},0`,`l0,${-i}`,`M${e},${t+n+s}`,`a${a},${n} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),z2=p((e,t,r,i,a,n)=>[`M${e-r/2},${-i/2}`,`a${a},${n} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");async function tf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=Math.max(n.width+(t.padding??0),t.width??0),l=o/2,c=l/(2.5+o/50),h=Math.max(n.height+c+(t.padding??0),t.height??0),u=h*.1;let d;const{cssStyles:f}=t;if(t.look==="handDrawn"){const g=j.svg(a),m=N2(0,0,o,h,l,c,u),y=z2(0,c,o,h,l,c),x=Y(t,{}),b=g.path(m,x),k=g.path(y,x);a.insert(()=>k,":first-child").attr("class","line"),d=a.insert(()=>b,":first-child"),d.attr("class","basic label-container"),f&&d.attr("style",f)}else{const g=P2(0,0,o,h,l,c,u);d=a.insert("path",":first-child").attr("d",g).attr("class","basic label-container").attr("style",It(f)).attr("style",i)}return d.attr("label-offset-y",c),d.attr("transform",`translate(${-o/2}, ${-(h/2+c)})`),G(t,d),s.attr("transform",`translate(${-(n.width/2)-(n.x-(n.left??0))}, ${-(n.height/2)+c-(n.y-(n.top??0))})`),t.intersect=function(g){const m=W.rect(t,g),y=m.x-(t.x??0);if(l!=0&&(Math.abs(y)<(t.width??0)/2||Math.abs(y)==(t.width??0)/2&&Math.abs(m.y-(t.y??0))>(t.height??0)/2-c)){let x=c*c*(1-y*y/(l*l));x>0&&(x=Math.sqrt(x)),x=c-x,g.y-(t.y??0)>0&&(x=-x),m.y+=x}return m},a}p(tf,"linedCylinder");async function ef(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=Math.max(n.width+(t.padding??0)*2,t?.width??0),l=Math.max(n.height+(t.padding??0)*2,t?.height??0),c=l/4,h=l+c,{cssStyles:u}=t,d=j.svg(a),f=Y(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const g=[{x:-o/2-o/2*.1,y:-h/2},{x:-o/2-o/2*.1,y:h/2},...We(-o/2-o/2*.1,h/2,o/2+o/2*.1,h/2,c,.8),{x:o/2+o/2*.1,y:-h/2},{x:-o/2-o/2*.1,y:-h/2},{x:-o/2,y:-h/2},{x:-o/2,y:h/2*1.1},{x:-o/2,y:-h/2}],m=d.polygon(g.map(x=>[x.x,x.y]),f),y=a.insert(()=>m,":first-child");return y.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",u),i&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",i),y.attr("transform",`translate(0,${-c/2})`),s.attr("transform",`translate(${-o/2+(t.padding??0)+o/2*.1/2-(n.x-(n.left??0))},${-l/2+(t.padding??0)-c/2-(n.y-(n.top??0))})`),G(t,y),t.intersect=function(x){return W.polygon(t,g,x)},a}p(ef,"linedWaveEdgedRect");async function rf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=Math.max(n.width+(t.padding??0)*2,t?.width??0),l=Math.max(n.height+(t.padding??0)*2,t?.height??0),c=5,h=-o/2,u=-l/2,{cssStyles:d}=t,f=j.svg(a),g=Y(t,{}),m=[{x:h-c,y:u+c},{x:h-c,y:u+l+c},{x:h+o-c,y:u+l+c},{x:h+o-c,y:u+l},{x:h+o,y:u+l},{x:h+o,y:u+l-c},{x:h+o+c,y:u+l-c},{x:h+o+c,y:u-c},{x:h+c,y:u-c},{x:h+c,y:u},{x:h,y:u},{x:h,y:u+c}],y=[{x:h,y:u+c},{x:h+o-c,y:u+c},{x:h+o-c,y:u+l},{x:h+o,y:u+l},{x:h+o,y:u},{x:h,y:u}];t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const x=lt(m),b=f.path(x,g),k=lt(y),v=f.path(k,{...g,fill:"none"}),w=a.insert(()=>v,":first-child");return w.insert(()=>b,":first-child"),w.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",i),s.attr("transform",`translate(${-(n.width/2)-c-(n.x-(n.left??0))}, ${-(n.height/2)+c-(n.y-(n.top??0))})`),G(t,w),t.intersect=function(L){return W.polygon(t,m,L)},a}p(rf,"multiRect");async function af(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=Math.max(n.width+(t.padding??0)*2,t?.width??0),l=Math.max(n.height+(t.padding??0)*2,t?.height??0),c=l/4,h=l+c,u=-o/2,d=-h/2,f=5,{cssStyles:g}=t,m=We(u-f,d+h+f,u+o-f,d+h+f,c,.8),y=m?.[m.length-1],x=[{x:u-f,y:d+f},{x:u-f,y:d+h+f},...m,{x:u+o-f,y:y.y-f},{x:u+o,y:y.y-f},{x:u+o,y:y.y-2*f},{x:u+o+f,y:y.y-2*f},{x:u+o+f,y:d-f},{x:u+f,y:d-f},{x:u+f,y:d},{x:u,y:d},{x:u,y:d+f}],b=[{x:u,y:d+f},{x:u+o-f,y:d+f},{x:u+o-f,y:y.y-f},{x:u+o,y:y.y-f},{x:u+o,y:d},{x:u,y:d}],k=j.svg(a),v=Y(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");const w=lt(x),L=k.path(w,v),T=lt(b),D=k.path(T,v),I=a.insert(()=>L,":first-child");return I.insert(()=>D),I.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&I.selectAll("path").attr("style",g),i&&t.look!=="handDrawn"&&I.selectAll("path").attr("style",i),I.attr("transform",`translate(0,${-c/2})`),s.attr("transform",`translate(${-(n.width/2)-f-(n.x-(n.left??0))}, ${-(n.height/2)+f-c/2-(n.y-(n.top??0))})`),G(t,I),t.intersect=function(O){return W.polygon(t,x,O)},a}p(af,"multiWaveEdgedRectangle");async function nf(e,t,{config:{themeVariables:r}}){const{labelStyles:i,nodeStyles:a}=U(t);t.labelStyle=i,t.useHtmlLabels||Ot().flowchart?.htmlLabels!==!1||(t.centerLabel=!0);const{shapeSvg:s,bbox:o,label:l}=await it(e,t,rt(t)),c=Math.max(o.width+(t.padding??0)*2,t?.width??0),h=Math.max(o.height+(t.padding??0)*2,t?.height??0),u=-c/2,d=-h/2,{cssStyles:f}=t,g=j.svg(s),m=Y(t,{fill:r.noteBkgColor,stroke:r.noteBorderColor});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=g.rectangle(u,d,c,h,m),x=s.insert(()=>y,":first-child");return x.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",f),a&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",a),l.attr("transform",`translate(${-o.width/2-(o.x-(o.left??0))}, ${-(o.height/2)-(o.y-(o.top??0))})`),G(t,x),t.intersect=function(b){return W.rect(t,b)},s}p(nf,"note");var W2=p((e,t,r)=>[`M${e+r/2},${t}`,`L${e+r},${t-r/2}`,`L${e+r/2},${t-r}`,`L${e},${t-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function sf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=n.width+t.padding,o=n.height+t.padding,l=s+o,c=.5,h=[{x:l/2,y:0},{x:l,y:-l/2},{x:l/2,y:-l},{x:0,y:-l/2}];let u;const{cssStyles:d}=t;if(t.look==="handDrawn"){const f=j.svg(a),g=Y(t,{}),m=W2(0,0,l),y=f.path(m,g);u=a.insert(()=>y,":first-child").attr("transform",`translate(${-l/2+c}, ${l/2})`),d&&u.attr("style",d)}else u=Ye(a,l,l,h),u.attr("transform",`translate(${-l/2+c}, ${l/2})`);return i&&u.attr("style",i),G(t,u),t.calcIntersect=function(f,g){const m=f.width,y=[{x:m/2,y:0},{x:m,y:-m/2},{x:m/2,y:-m},{x:0,y:-m/2}],x=W.polygon(f,y,g);return{x:x.x-.5,y:x.y-.5}},t.intersect=function(f){return this.calcIntersect(t,f)},a}p(sf,"question");async function of(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=Math.max(n.width+(t.padding??0),t?.width??0),l=Math.max(n.height+(t.padding??0),t?.height??0),c=-o/2,h=-l/2,u=h/2,d=[{x:c+u,y:h},{x:c,y:0},{x:c+u,y:-h},{x:-c,y:-h},{x:-c,y:h}],{cssStyles:f}=t,g=j.svg(a),m=Y(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=lt(d),x=g.path(y,m),b=a.insert(()=>x,":first-child");return b.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",f),i&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",i),b.attr("transform",`translate(${-u/2},0)`),s.attr("transform",`translate(${-u/2-n.width/2-(n.x-(n.left??0))}, ${-(n.height/2)-(n.y-(n.top??0))})`),G(t,b),t.intersect=function(k){return W.polygon(t,d,k)},a}p(of,"rect_left_inv_arrow");async function lf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;let a;t.cssClasses?a="node "+t.cssClasses:a="node default";const n=e.insert("g").attr("class",a).attr("id",t.domId||t.id),s=n.insert("g"),o=n.insert("g").attr("class","label").attr("style",i),l=t.description,c=t.label,h=o.node().appendChild(await tr(c,t.labelStyle,!0,!0));let u={width:0,height:0};if(Lt(dt()?.flowchart?.htmlLabels)){const D=h.children[0],I=ht(h);u=D.getBoundingClientRect(),I.attr("width",u.width),I.attr("height",u.height)}F.info("Text 2",l);const d=l||[],f=h.getBBox(),g=o.node().appendChild(await tr(d.join?d.join("
          "):d,t.labelStyle,!0,!0)),m=g.children[0],y=ht(g);u=m.getBoundingClientRect(),y.attr("width",u.width),y.attr("height",u.height);const x=(t.padding||0)/2;ht(g).attr("transform","translate( "+(u.width>f.width?0:(f.width-u.width)/2)+", "+(f.height+x+5)+")"),ht(h).attr("transform","translate( "+(u.width(F.debug("Rough node insert CXC",O),E),":first-child"),L=n.insert(()=>(F.debug("Rough node insert CXC",O),O),":first-child")}else L=s.insert("rect",":first-child"),T=s.insert("line"),L.attr("class","outer title-state").attr("style",i).attr("x",-u.width/2-x).attr("y",-u.height/2-x).attr("width",u.width+(t.padding||0)).attr("height",u.height+(t.padding||0)),T.attr("class","divider").attr("x1",-u.width/2-x).attr("x2",u.width/2+x).attr("y1",-u.height/2-x+f.height+x).attr("y2",-u.height/2-x+f.height+x);return G(t,L),t.intersect=function(D){return W.rect(t,D)},n}p(lf,"rectWithTitle");function Jr(e,t,r,i,a,n,s){const l=(e+r)/2,c=(t+i)/2,h=Math.atan2(i-t,r-e),u=(r-e)/2,d=(i-t)/2,f=u/a,g=d/n,m=Math.sqrt(f**2+g**2);if(m>1)throw new Error("The given radii are too small to create an arc between the points.");const y=Math.sqrt(1-m**2),x=l+y*n*Math.sin(h)*(s?-1:1),b=c-y*a*Math.cos(h)*(s?-1:1),k=Math.atan2((t-b)/n,(e-x)/a);let w=Math.atan2((i-b)/n,(r-x)/a)-k;s&&w<0&&(w+=2*Math.PI),!s&&w>0&&(w-=2*Math.PI);const L=[];for(let T=0;T<20;T++){const D=T/19,I=k+D*w,O=x+a*Math.cos(I),E=b+n*Math.sin(I);L.push({x:O,y:E})}return L}p(Jr,"generateArcPoints");async function cf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=t?.padding??0,o=t?.padding??0,l=(t?.width?t?.width:n.width)+s*2,c=(t?.height?t?.height:n.height)+o*2,h=t.radius||5,u=t.taper||5,{cssStyles:d}=t,f=j.svg(a),g=Y(t,{});t.stroke&&(g.stroke=t.stroke),t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const m=[{x:-l/2+u,y:-c/2},{x:l/2-u,y:-c/2},...Jr(l/2-u,-c/2,l/2,-c/2+u,h,h,!0),{x:l/2,y:-c/2+u},{x:l/2,y:c/2-u},...Jr(l/2,c/2-u,l/2-u,c/2,h,h,!0),{x:l/2-u,y:c/2},{x:-l/2+u,y:c/2},...Jr(-l/2+u,c/2,-l/2,c/2-u,h,h,!0),{x:-l/2,y:c/2-u},{x:-l/2,y:-c/2+u},...Jr(-l/2,-c/2+u,-l/2+u,-c/2,h,h,!0)],y=lt(m),x=f.path(y,g),b=a.insert(()=>x,":first-child");return b.attr("class","basic label-container outer-path"),d&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",d),i&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",i),G(t,b),t.intersect=function(k){return W.polygon(t,m,k)},a}p(cf,"roundedRect");async function hf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=t?.padding??0,l=Math.max(n.width+(t.padding??0)*2,t?.width??0),c=Math.max(n.height+(t.padding??0)*2,t?.height??0),h=-n.width/2-o,u=-n.height/2-o,{cssStyles:d}=t,f=j.svg(a),g=Y(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const m=[{x:h,y:u},{x:h+l+8,y:u},{x:h+l+8,y:u+c},{x:h-8,y:u+c},{x:h-8,y:u},{x:h,y:u},{x:h,y:u+c}],y=f.polygon(m.map(b=>[b.x,b.y]),g),x=a.insert(()=>y,":first-child");return x.attr("class","basic label-container").attr("style",It(d)),i&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",i),d&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",i),s.attr("transform",`translate(${-l/2+4+(t.padding??0)-(n.x-(n.left??0))},${-c/2+(t.padding??0)-(n.y-(n.top??0))})`),G(t,x),t.intersect=function(b){return W.rect(t,b)},a}p(hf,"shadedProcess");async function uf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=Math.max(n.width+(t.padding??0)*2,t?.width??0),l=Math.max(n.height+(t.padding??0)*2,t?.height??0),c=-o/2,h=-l/2,{cssStyles:u}=t,d=j.svg(a),f=Y(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const g=[{x:c,y:h},{x:c,y:h+l},{x:c+o,y:h+l},{x:c+o,y:h-l/2}],m=lt(g),y=d.path(m,f),x=a.insert(()=>y,":first-child");return x.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",u),i&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",i),x.attr("transform",`translate(0, ${l/4})`),s.attr("transform",`translate(${-o/2+(t.padding??0)-(n.x-(n.left??0))}, ${-l/4+(t.padding??0)-(n.y-(n.top??0))})`),G(t,x),t.intersect=function(b){return W.polygon(t,g,b)},a}p(uf,"slopedRect");async function df(e,t){const r={rx:0,ry:0,labelPaddingX:t.labelPaddingX??(t?.padding||0)*2,labelPaddingY:(t?.padding||0)*1};return Ga(e,t,r)}p(df,"squareRect");async function ff(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=n.height+t.padding,o=n.width+s/4+t.padding,l=s/2,{cssStyles:c}=t,h=j.svg(a),u=Y(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");const d=[{x:-o/2+l,y:-s/2},{x:o/2-l,y:-s/2},...gi(-o/2+l,0,l,50,90,270),{x:o/2-l,y:s/2},...gi(o/2-l,0,l,50,270,450)],f=lt(d),g=h.path(f,u),m=a.insert(()=>g,":first-child");return m.attr("class","basic label-container outer-path"),c&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",c),i&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",i),G(t,m),t.intersect=function(y){return W.polygon(t,d,y)},a}p(ff,"stadium");async function pf(e,t){return Ga(e,t,{rx:5,ry:5})}p(pf,"state");function gf(e,t,{config:{themeVariables:r}}){const{labelStyles:i,nodeStyles:a}=U(t);t.labelStyle=i;const{cssStyles:n}=t,{lineColor:s,stateBorder:o,nodeBorder:l}=r,c=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),h=j.svg(c),u=Y(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");const d=h.circle(0,0,14,{...u,stroke:s,strokeWidth:2}),f=o??l,g=h.circle(0,0,5,{...u,fill:f,stroke:f,strokeWidth:2,fillStyle:"solid"}),m=c.insert(()=>d,":first-child");return m.insert(()=>g),n&&m.selectAll("path").attr("style",n),a&&m.selectAll("path").attr("style",a),G(t,m),t.intersect=function(y){return W.circle(t,7,y)},c}p(gf,"stateEnd");function mf(e,t,{config:{themeVariables:r}}){const{lineColor:i}=r,a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let n;if(t.look==="handDrawn"){const o=j.svg(a).circle(0,0,14,rx(i));n=a.insert(()=>o),n.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14)}else n=a.insert("circle",":first-child"),n.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14);return G(t,n),t.intersect=function(s){return W.circle(t,7,s)},a}p(mf,"stateStart");async function yf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=(t?.padding||0)/2,o=n.width+t.padding,l=n.height+t.padding,c=-n.width/2-s,h=-n.height/2-s,u=[{x:0,y:0},{x:o,y:0},{x:o,y:-l},{x:0,y:-l},{x:0,y:0},{x:-8,y:0},{x:o+8,y:0},{x:o+8,y:-l},{x:-8,y:-l},{x:-8,y:0}];if(t.look==="handDrawn"){const d=j.svg(a),f=Y(t,{}),g=d.rectangle(c-8,h,o+16,l,f),m=d.line(c,h,c,h+l,f),y=d.line(c+o,h,c+o,h+l,f);a.insert(()=>m,":first-child"),a.insert(()=>y,":first-child");const x=a.insert(()=>g,":first-child"),{cssStyles:b}=t;x.attr("class","basic label-container").attr("style",It(b)),G(t,x)}else{const d=Ye(a,o,l,u);i&&d.attr("style",i),G(t,d)}return t.intersect=function(d){return W.polygon(t,u,d)},a}p(yf,"subroutine");async function xf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=Math.max(n.width+(t.padding??0)*2,t?.width??0),o=Math.max(n.height+(t.padding??0)*2,t?.height??0),l=-s/2,c=-o/2,h=.2*o,u=.2*o,{cssStyles:d}=t,f=j.svg(a),g=Y(t,{}),m=[{x:l-h/2,y:c},{x:l+s+h/2,y:c},{x:l+s+h/2,y:c+o},{x:l-h/2,y:c+o}],y=[{x:l+s-h/2,y:c+o},{x:l+s+h/2,y:c+o},{x:l+s+h/2,y:c+o-u}];t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const x=lt(m),b=f.path(x,g),k=lt(y),v=f.path(k,{...g,fillStyle:"solid"}),w=a.insert(()=>v,":first-child");return w.insert(()=>b,":first-child"),w.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",i),G(t,w),t.intersect=function(L){return W.polygon(t,m,L)},a}p(xf,"taggedRect");async function bf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=Math.max(n.width+(t.padding??0)*2,t?.width??0),l=Math.max(n.height+(t.padding??0)*2,t?.height??0),c=l/4,h=.2*o,u=.2*l,d=l+c,{cssStyles:f}=t,g=j.svg(a),m=Y(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const y=[{x:-o/2-o/2*.1,y:d/2},...We(-o/2-o/2*.1,d/2,o/2+o/2*.1,d/2,c,.8),{x:o/2+o/2*.1,y:-d/2},{x:-o/2-o/2*.1,y:-d/2}],x=-o/2+o/2*.1,b=-d/2-u*.4,k=[{x:x+o-h,y:(b+l)*1.4},{x:x+o,y:b+l-u},{x:x+o,y:(b+l)*.9},...We(x+o,(b+l)*1.3,x+o-h,(b+l)*1.5,-l*.03,.5)],v=lt(y),w=g.path(v,m),L=lt(k),T=g.path(L,{...m,fillStyle:"solid"}),D=a.insert(()=>T,":first-child");return D.insert(()=>w,":first-child"),D.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",f),i&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",i),D.attr("transform",`translate(0,${-c/2})`),s.attr("transform",`translate(${-o/2+(t.padding??0)-(n.x-(n.left??0))},${-l/2+(t.padding??0)-c/2-(n.y-(n.top??0))})`),G(t,D),t.intersect=function(I){return W.polygon(t,y,I)},a}p(bf,"taggedWaveEdgedRectangle");async function Cf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=Math.max(n.width+t.padding,t?.width||0),o=Math.max(n.height+t.padding,t?.height||0),l=-s/2,c=-o/2,h=a.insert("rect",":first-child");return h.attr("class","text").attr("style",i).attr("rx",0).attr("ry",0).attr("x",l).attr("y",c).attr("width",s).attr("height",o),G(t,h),t.intersect=function(u){return W.rect(t,u)},a}p(Cf,"text");var q2=p((e,t,r,i,a,n)=>`M${e},${t} + a${a},${n} 0,0,1 0,${-i} + l${r},0 + a${a},${n} 0,0,1 0,${i} + M${r},${-i} + a${a},${n} 0,0,0 0,${i} + l${-r},0`,"createCylinderPathD"),H2=p((e,t,r,i,a,n)=>[`M${e},${t}`,`M${e+r},${t}`,`a${a},${n} 0,0,0 0,${-i}`,`l${-r},0`,`a${a},${n} 0,0,0 0,${i}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),j2=p((e,t,r,i,a,n)=>[`M${e+r/2},${-i/2}`,`a${a},${n} 0,0,0 0,${i}`].join(" "),"createInnerCylinderPathD");async function kf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s,halfPadding:o}=await it(e,t,rt(t)),l=t.look==="neo"?o*2:o,c=n.height+l,h=c/2,u=h/(2.5+c/50),d=n.width+u+l,{cssStyles:f}=t;let g;if(t.look==="handDrawn"){const m=j.svg(a),y=H2(0,0,d,c,u,h),x=j2(0,0,d,c,u,h),b=m.path(y,Y(t,{})),k=m.path(x,Y(t,{fill:"none"}));g=a.insert(()=>k,":first-child"),g=a.insert(()=>b,":first-child"),g.attr("class","basic label-container"),f&&g.attr("style",f)}else{const m=q2(0,0,d,c,u,h);g=a.insert("path",":first-child").attr("d",m).attr("class","basic label-container").attr("style",It(f)).attr("style",i),g.attr("class","basic label-container"),f&&g.selectAll("path").attr("style",f),i&&g.selectAll("path").attr("style",i)}return g.attr("label-offset-x",u),g.attr("transform",`translate(${-d/2}, ${c/2} )`),s.attr("transform",`translate(${-(n.width/2)-u-(n.x-(n.left??0))}, ${-(n.height/2)-(n.y-(n.top??0))})`),G(t,g),t.intersect=function(m){const y=W.rect(t,m),x=y.y-(t.y??0);if(h!=0&&(Math.abs(x)<(t.height??0)/2||Math.abs(x)==(t.height??0)/2&&Math.abs(y.x-(t.x??0))>(t.width??0)/2-u)){let b=u*u*(1-x*x/(h*h));b!=0&&(b=Math.sqrt(Math.abs(b))),b=u-b,m.x-(t.x??0)>0&&(b=-b),y.x+=b}return y},a}p(kf,"tiltedCylinder");async function wf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=n.width+t.padding,o=n.height+t.padding,l=[{x:-3*o/6,y:0},{x:s+3*o/6,y:0},{x:s,y:-o},{x:0,y:-o}];let c;const{cssStyles:h}=t;if(t.look==="handDrawn"){const u=j.svg(a),d=Y(t,{}),f=lt(l),g=u.path(f,d);c=a.insert(()=>g,":first-child").attr("transform",`translate(${-s/2}, ${o/2})`),h&&c.attr("style",h)}else c=Ye(a,s,o,l);return i&&c.attr("style",i),t.width=s,t.height=o,G(t,c),t.intersect=function(u){return W.polygon(t,l,u)},a}p(wf,"trapezoid");async function vf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=60,o=20,l=Math.max(s,n.width+(t.padding??0)*2,t?.width??0),c=Math.max(o,n.height+(t.padding??0)*2,t?.height??0),{cssStyles:h}=t,u=j.svg(a),d=Y(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const f=[{x:-l/2*.8,y:-c/2},{x:l/2*.8,y:-c/2},{x:l/2,y:-c/2*.6},{x:l/2,y:c/2},{x:-l/2,y:c/2},{x:-l/2,y:-c/2*.6}],g=lt(f),m=u.path(g,d),y=a.insert(()=>m,":first-child");return y.attr("class","basic label-container"),h&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",h),i&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",i),G(t,y),t.intersect=function(x){return W.polygon(t,f,x)},a}p(vf,"trapezoidalPentagon");async function Sf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=Lt(dt().flowchart?.htmlLabels),l=n.width+(t.padding??0),c=l+n.height,h=l+n.height,u=[{x:0,y:0},{x:h,y:0},{x:h/2,y:-c}],{cssStyles:d}=t,f=j.svg(a),g=Y(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const m=lt(u),y=f.path(m,g),x=a.insert(()=>y,":first-child").attr("transform",`translate(${-c/2}, ${c/2})`);return d&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",d),i&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",i),t.width=l,t.height=c,G(t,x),s.attr("transform",`translate(${-n.width/2-(n.x-(n.left??0))}, ${c/2-(n.height+(t.padding??0)/(o?2:1)-(n.y-(n.top??0)))})`),t.intersect=function(b){return F.info("Triangle intersect",t,u,b),W.polygon(t,u,b)},a}p(Sf,"triangle");async function Tf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=Math.max(n.width+(t.padding??0)*2,t?.width??0),l=Math.max(n.height+(t.padding??0)*2,t?.height??0),c=l/8,h=l+c,{cssStyles:u}=t,f=70-o,g=f>0?f/2:0,m=j.svg(a),y=Y(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const x=[{x:-o/2-g,y:h/2},...We(-o/2-g,h/2,o/2+g,h/2,c,.8),{x:o/2+g,y:-h/2},{x:-o/2-g,y:-h/2}],b=lt(x),k=m.path(b,y),v=a.insert(()=>k,":first-child");return v.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",u),i&&t.look!=="handDrawn"&&v.selectAll("path").attr("style",i),v.attr("transform",`translate(0,${-c/2})`),s.attr("transform",`translate(${-o/2+(t.padding??0)-(n.x-(n.left??0))},${-l/2+(t.padding??0)-c-(n.y-(n.top??0))})`),G(t,v),t.intersect=function(w){return W.polygon(t,x,w)},a}p(Tf,"waveEdgedRectangle");async function _f(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n}=await it(e,t,rt(t)),s=100,o=50,l=Math.max(n.width+(t.padding??0)*2,t?.width??0),c=Math.max(n.height+(t.padding??0)*2,t?.height??0),h=l/c;let u=l,d=c;u>d*h?d=u/h:u=d*h,u=Math.max(u,s),d=Math.max(d,o);const f=Math.min(d*.2,d/4),g=d+f*2,{cssStyles:m}=t,y=j.svg(a),x=Y(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const b=[{x:-u/2,y:g/2},...We(-u/2,g/2,u/2,g/2,f,1),{x:u/2,y:-g/2},...We(u/2,-g/2,-u/2,-g/2,f,-1)],k=lt(b),v=y.path(k,x),w=a.insert(()=>v,":first-child");return w.attr("class","basic label-container"),m&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",m),i&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",i),G(t,w),t.intersect=function(L){return W.polygon(t,b,L)},a}p(_f,"waveRectangle");async function Bf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,label:s}=await it(e,t,rt(t)),o=Math.max(n.width+(t.padding??0)*2,t?.width??0),l=Math.max(n.height+(t.padding??0)*2,t?.height??0),c=5,h=-o/2,u=-l/2,{cssStyles:d}=t,f=j.svg(a),g=Y(t,{}),m=[{x:h-c,y:u-c},{x:h-c,y:u+l},{x:h+o,y:u+l},{x:h+o,y:u-c}],y=`M${h-c},${u-c} L${h+o},${u-c} L${h+o},${u+l} L${h-c},${u+l} L${h-c},${u-c} + M${h-c},${u} L${h+o},${u} + M${h},${u-c} L${h},${u+l}`;t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const x=f.path(y,g),b=a.insert(()=>x,":first-child");return b.attr("transform",`translate(${c/2}, ${c/2})`),b.attr("class","basic label-container"),d&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",d),i&&t.look!=="handDrawn"&&b.selectAll("path").attr("style",i),s.attr("transform",`translate(${-(n.width/2)+c/2-(n.x-(n.left??0))}, ${-(n.height/2)+c/2-(n.y-(n.top??0))})`),G(t,b),t.intersect=function(k){return W.polygon(t,m,k)},a}p(Bf,"windowPane");async function oo(e,t){const r=t;if(r.alias&&(t.label=r.alias),t.look==="handDrawn"){const{themeVariables:J}=Ot(),{background:Z}=J,ct={...t,id:t.id+"-background",look:"default",cssStyles:["stroke: none",`fill: ${Z}`]};await oo(e,ct)}const i=Ot();t.useHtmlLabels=i.htmlLabels;let a=i.er?.diagramPadding??10,n=i.er?.entityPadding??6;const{cssStyles:s}=t,{labelStyles:o,nodeStyles:l}=U(t);if(r.attributes.length===0&&t.label){const J={rx:0,ry:0,labelPaddingX:a,labelPaddingY:a*1.5};$e(t.label,i)+J.labelPaddingX*20){const J=u.width+a*2-(m+y+x+b);m+=J/w,y+=J/w,x>0&&(x+=J/w),b>0&&(b+=J/w)}const T=m+y+x+b,D=j.svg(h),I=Y(t,{});t.look!=="handDrawn"&&(I.roughness=0,I.fillStyle="solid");let O=0;g.length>0&&(O=g.reduce((J,Z)=>J+(Z?.rowHeight??0),0));const E=Math.max(L.width+a*2,t?.width||0,T),N=Math.max((O??0)+u.height,t?.height||0),R=-E/2,B=-N/2;h.selectAll("g:not(:first-child)").each((J,Z,ct)=>{const nt=ht(ct[Z]),Ct=nt.attr("transform");let kt=0,Nt=0;if(Ct){const xt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(Ct);xt&&(kt=parseFloat(xt[1]),Nt=parseFloat(xt[2]),nt.attr("class").includes("attribute-name")?kt+=m:nt.attr("class").includes("attribute-keys")?kt+=m+y:nt.attr("class").includes("attribute-comment")&&(kt+=m+y+x))}nt.attr("transform",`translate(${R+a/2+kt}, ${Nt+B+u.height+n/2})`)}),h.select(".name").attr("transform","translate("+-u.width/2+", "+(B+n/2)+")");const A=D.rectangle(R,B,E,N,I),_=h.insert(()=>A,":first-child").attr("style",s.join("")),{themeVariables:$}=Ot(),{rowEven:M,rowOdd:q,nodeBorder:V}=$;f.push(0);for(const[J,Z]of g.entries()){const nt=(J+1)%2===0&&Z.yOffset!==0,Ct=D.rectangle(R,u.height+B+Z?.yOffset,E,Z?.rowHeight,{...I,fill:nt?M:q,stroke:V});h.insert(()=>Ct,"g.label").attr("style",s.join("")).attr("class",`row-rect-${nt?"even":"odd"}`)}let K=D.line(R,u.height+B,E+R,u.height+B,I);h.insert(()=>K).attr("class","divider"),K=D.line(m+R,u.height+B,m+R,N+B,I),h.insert(()=>K).attr("class","divider"),k&&(K=D.line(m+y+R,u.height+B,m+y+R,N+B,I),h.insert(()=>K).attr("class","divider")),v&&(K=D.line(m+y+x+R,u.height+B,m+y+x+R,N+B,I),h.insert(()=>K).attr("class","divider"));for(const J of f)K=D.line(R,u.height+B+J,E+R,u.height+B+J,I),h.insert(()=>K).attr("class","divider");if(G(t,_),l&&t.look!=="handDrawn"){const Z=l.split(";")?.filter(ct=>ct.includes("stroke"))?.map(ct=>`${ct}`).join("; ");h.selectAll("path").attr("style",Z??""),h.selectAll(".row-rect-even path").attr("style",l)}return t.intersect=function(J){return W.rect(t,J)},h}p(oo,"erBox");async function br(e,t,r,i=0,a=0,n=[],s=""){const o=e.insert("g").attr("class",`label ${n.join(" ")}`).attr("transform",`translate(${i}, ${a})`).attr("style",s);t!==jo(t)&&(t=jo(t),t=t.replaceAll("<","<").replaceAll(">",">"));const l=o.node().appendChild(await He(o,t,{width:$e(t,r)+100,style:s,useHtmlLabels:r.htmlLabels},r));if(t.includes("<")||t.includes(">")){let h=l.children[0];for(h.textContent=h.textContent.replaceAll("<","<").replaceAll(">",">");h.childNodes[0];)h=h.childNodes[0],h.textContent=h.textContent.replaceAll("<","<").replaceAll(">",">")}let c=l.getBBox();if(Lt(r.htmlLabels)){const h=l.children[0];h.style.textAlign="start";const u=ht(l);c=h.getBoundingClientRect(),u.attr("width",c.width),u.attr("height",c.height)}return c}p(br,"addText");async function Lf(e,t,r,i,a=r.class.padding??12){const n=i?0:3,s=e.insert("g").attr("class",rt(t)).attr("id",t.domId||t.id);let o=null,l=null,c=null,h=null,u=0,d=0,f=0;if(o=s.insert("g").attr("class","annotation-group text"),t.annotations.length>0){const b=t.annotations[0];await ti(o,{text:`«${b}»`},0),u=o.node().getBBox().height}l=s.insert("g").attr("class","label-group text"),await ti(l,t,0,["font-weight: bolder"]);const g=l.node().getBBox();d=g.height,c=s.insert("g").attr("class","members-group text");let m=0;for(const b of t.members){const k=await ti(c,b,m,[b.parseClassifier()]);m+=k+n}f=c.node().getBBox().height,f<=0&&(f=a/2),h=s.insert("g").attr("class","methods-group text");let y=0;for(const b of t.methods){const k=await ti(h,b,y,[b.parseClassifier()]);y+=k+n}let x=s.node().getBBox();if(o!==null){const b=o.node().getBBox();o.attr("transform",`translate(${-b.width/2})`)}return l.attr("transform",`translate(${-g.width/2}, ${u})`),x=s.node().getBBox(),c.attr("transform",`translate(0, ${u+d+a*2})`),x=s.node().getBBox(),h.attr("transform",`translate(0, ${u+d+(f?f+a*4:a*2)})`),x=s.node().getBBox(),{shapeSvg:s,bbox:x}}p(Lf,"textHelper");async function ti(e,t,r,i=[]){const a=e.insert("g").attr("class","label").attr("style",i.join("; ")),n=Ot();let s="useHtmlLabels"in t?t.useHtmlLabels:Lt(n.htmlLabels)??!0,o="";"text"in t?o=t.text:o=t.label,!s&&o.startsWith("\\")&&(o=o.substring(1)),Tr(o)&&(s=!0);const l=await He(a,Bs(hr(o)),{width:$e(o,n)+50,classes:"markdown-node-label",useHtmlLabels:s},n);let c,h=1;if(s){const u=l.children[0],d=ht(l);h=u.innerHTML.split("
          ").length,u.innerHTML.includes("")&&(h+=u.innerHTML.split("").length-1);const f=u.getElementsByTagName("img");if(f){const g=o.replace(/]*>/g,"").trim()==="";await Promise.all([...f].map(m=>new Promise(y=>{function x(){if(m.style.display="flex",m.style.flexDirection="column",g){const b=n.fontSize?.toString()??window.getComputedStyle(document.body).fontSize,v=parseInt(b,10)*5+"px";m.style.minWidth=v,m.style.maxWidth=v}else m.style.width="100%";y(m)}p(x,"setupImage"),setTimeout(()=>{m.complete&&x()}),m.addEventListener("error",x),m.addEventListener("load",x)})))}c=u.getBoundingClientRect(),d.attr("width",c.width),d.attr("height",c.height)}else{i.includes("font-weight: bolder")&&ht(l).selectAll("tspan").attr("font-weight",""),h=l.children.length;const u=l.children[0];(l.textContent===""||l.textContent.includes(">"))&&(u.textContent=o[0]+o.substring(1).replaceAll(">",">").replaceAll("<","<").trim(),o[1]===" "&&(u.textContent=u.textContent[0]+" "+u.textContent.substring(1))),u.textContent==="undefined"&&(u.textContent=""),c=l.getBBox()}return a.attr("transform","translate(0,"+(-c.height/(2*h)+r)+")"),c.height}p(ti,"addText");async function Af(e,t){const r=dt(),i=r.class.padding??12,a=i,n=t.useHtmlLabels??Lt(r.htmlLabels)??!0,s=t;s.annotations=s.annotations??[],s.members=s.members??[],s.methods=s.methods??[];const{shapeSvg:o,bbox:l}=await Lf(e,t,r,n,a),{labelStyles:c,nodeStyles:h}=U(t);t.labelStyle=c,t.cssStyles=s.styles||"";const u=s.styles?.join(";")||h||"";t.cssStyles||(t.cssStyles=u.replaceAll("!important","").split(";"));const d=s.members.length===0&&s.methods.length===0&&!r.class?.hideEmptyMembersBox,f=j.svg(o),g=Y(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const m=l.width;let y=l.height;s.members.length===0&&s.methods.length===0?y+=a:s.members.length>0&&s.methods.length===0&&(y+=a*2);const x=-m/2,b=-y/2,k=f.rectangle(x-i,b-i-(d?i:s.members.length===0&&s.methods.length===0?-i/2:0),m+2*i,y+2*i+(d?i*2:s.members.length===0&&s.methods.length===0?-i:0),g),v=o.insert(()=>k,":first-child");v.attr("class","basic label-container");const w=v.node().getBBox();o.selectAll(".text").each((I,O,E)=>{const N=ht(E[O]),R=N.attr("transform");let B=0;if(R){const M=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(R);M&&(B=parseFloat(M[2]))}let A=B+b+i-(d?i:s.members.length===0&&s.methods.length===0?-i/2:0);n||(A-=4);let _=x;(N.attr("class").includes("label-group")||N.attr("class").includes("annotation-group"))&&(_=-N.node()?.getBBox().width/2||0,o.selectAll("text").each(function($,M,q){window.getComputedStyle(q[M]).textAnchor==="middle"&&(_=0)})),N.attr("transform",`translate(${_}, ${A})`)});const L=o.select(".annotation-group").node().getBBox().height-(d?i/2:0)||0,T=o.select(".label-group").node().getBBox().height-(d?i/2:0)||0,D=o.select(".members-group").node().getBBox().height-(d?i/2:0)||0;if(s.members.length>0||s.methods.length>0||d){const I=f.line(w.x,L+T+b+i,w.x+w.width,L+T+b+i,g);o.insert(()=>I).attr("class","divider").attr("style",u)}if(d||s.members.length>0||s.methods.length>0){const I=f.line(w.x,L+T+D+b+a*2+i,w.x+w.width,L+T+D+b+i+a*2,g);o.insert(()=>I).attr("class","divider").attr("style",u)}if(s.look!=="handDrawn"&&o.selectAll("path").attr("style",u),v.select(":nth-child(2)").attr("style",u),o.selectAll(".divider").select("path").attr("style",u),t.labelStyle?o.selectAll("span").attr("style",t.labelStyle):o.selectAll("span").attr("style",u),!n){const I=RegExp(/color\s*:\s*([^;]*)/),O=I.exec(u);if(O){const E=O[0].replace("color","fill");o.selectAll("tspan").attr("style",E)}else if(c){const E=I.exec(c);if(E){const N=E[0].replace("color","fill");o.selectAll("tspan").attr("style",N)}}}return G(t,v),t.intersect=function(I){return W.rect(t,I)},o}p(Af,"classBox");async function Mf(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const a=t,n=t,s=20,o=20,l="verifyMethod"in t,c=rt(t),h=e.insert("g").attr("class",c).attr("id",t.domId??t.id);let u;l?u=await me(h,`<<${a.type}>>`,0,t.labelStyle):u=await me(h,"<<Element>>",0,t.labelStyle);let d=u;const f=await me(h,a.name,d,t.labelStyle+"; font-weight: bold;");if(d+=f+o,l){const L=await me(h,`${a.requirementId?`ID: ${a.requirementId}`:""}`,d,t.labelStyle);d+=L;const T=await me(h,`${a.text?`Text: ${a.text}`:""}`,d,t.labelStyle);d+=T;const D=await me(h,`${a.risk?`Risk: ${a.risk}`:""}`,d,t.labelStyle);d+=D,await me(h,`${a.verifyMethod?`Verification: ${a.verifyMethod}`:""}`,d,t.labelStyle)}else{const L=await me(h,`${n.type?`Type: ${n.type}`:""}`,d,t.labelStyle);d+=L,await me(h,`${n.docRef?`Doc Ref: ${n.docRef}`:""}`,d,t.labelStyle)}const g=(h.node()?.getBBox().width??200)+s,m=(h.node()?.getBBox().height??200)+s,y=-g/2,x=-m/2,b=j.svg(h),k=Y(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const v=b.rectangle(y,x,g,m,k),w=h.insert(()=>v,":first-child");if(w.attr("class","basic label-container").attr("style",i),h.selectAll(".label").each((L,T,D)=>{const I=ht(D[T]),O=I.attr("transform");let E=0,N=0;if(O){const _=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(O);_&&(E=parseFloat(_[1]),N=parseFloat(_[2]))}const R=N-m/2;let B=y+s/2;(T===0||T===1)&&(B=E),I.attr("transform",`translate(${B}, ${R+s})`)}),d>u+f+o){const L=b.line(y,x+u+f+o,y+g,x+u+f+o,k);h.insert(()=>L).attr("style",i)}return G(t,w),t.intersect=function(L){return W.rect(t,L)},h}p(Mf,"requirementBox");async function me(e,t,r,i=""){if(t==="")return 0;const a=e.insert("g").attr("class","label").attr("style",i),n=dt(),s=n.htmlLabels??!0,o=await He(a,Bs(hr(t)),{width:$e(t,n)+50,classes:"markdown-node-label",useHtmlLabels:s,style:i},n);let l;if(s){const c=o.children[0],h=ht(o);l=c.getBoundingClientRect(),h.attr("width",l.width),h.attr("height",l.height)}else{const c=o.children[0];for(const h of c.children)h.textContent=h.textContent.replaceAll(">",">").replaceAll("<","<"),i&&h.setAttribute("style",i);l=o.getBBox(),l.height+=6}return a.attr("transform",`translate(${-l.width/2},${-l.height/2+r})`),l.height}p(me,"addText");var Y2=p(e=>{switch(e){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");async function Ef(e,t,{config:r}){const{labelStyles:i,nodeStyles:a}=U(t);t.labelStyle=i||"";const n=10,s=t.width;t.width=(t.width??200)-10;const{shapeSvg:o,bbox:l,label:c}=await it(e,t,rt(t)),h=t.padding||10;let u="",d;"ticket"in t&&t.ticket&&r?.kanban?.ticketBaseUrl&&(u=r?.kanban?.ticketBaseUrl.replace("#TICKET#",t.ticket),d=o.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",u).attr("target","_blank"));const f={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1};let g,m;d?{label:g,bbox:m}=await Sn(d,"ticket"in t&&t.ticket||"",f):{label:g,bbox:m}=await Sn(o,"ticket"in t&&t.ticket||"",f);const{label:y,bbox:x}=await Sn(o,"assigned"in t&&t.assigned||"",f);t.width=s;const b=10,k=t?.width||0,v=Math.max(m.height,x.height)/2,w=Math.max(l.height+b*2,t?.height||0)+v,L=-k/2,T=-w/2;c.attr("transform","translate("+(h-k/2)+", "+(-v-l.height/2)+")"),g.attr("transform","translate("+(h-k/2)+", "+(-v+l.height/2)+")"),y.attr("transform","translate("+(h+k/2-x.width-2*n)+", "+(-v+l.height/2)+")");let D;const{rx:I,ry:O}=t,{cssStyles:E}=t;if(t.look==="handDrawn"){const N=j.svg(o),R=Y(t,{}),B=I||O?N.path(je(L,T,k,w,I||0),R):N.rectangle(L,T,k,w,R);D=o.insert(()=>B,":first-child"),D.attr("class","basic label-container").attr("style",E||null)}else{D=o.insert("rect",":first-child"),D.attr("class","basic label-container __APA__").attr("style",a).attr("rx",I??5).attr("ry",O??5).attr("x",L).attr("y",T).attr("width",k).attr("height",w);const N="priority"in t&&t.priority;if(N){const R=o.append("line"),B=L+2,A=T+Math.floor((I??0)/2),_=T+w-Math.floor((I??0)/2);R.attr("x1",B).attr("y1",A).attr("x2",B).attr("y2",_).attr("stroke-width","4").attr("stroke",Y2(N))}}return G(t,D),t.height=w,t.intersect=function(N){return W.rect(t,N)},o}p(Ef,"kanbanItem");async function $f(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,halfPadding:s,label:o}=await it(e,t,rt(t)),l=n.width+10*s,c=n.height+8*s,h=.15*l,{cssStyles:u}=t,d=n.width+20,f=n.height+20,g=Math.max(l,d),m=Math.max(c,f);o.attr("transform",`translate(${-n.width/2}, ${-n.height/2})`);let y;const x=`M0 0 + a${h},${h} 1 0,0 ${g*.25},${-1*m*.1} + a${h},${h} 1 0,0 ${g*.25},0 + a${h},${h} 1 0,0 ${g*.25},0 + a${h},${h} 1 0,0 ${g*.25},${m*.1} + + a${h},${h} 1 0,0 ${g*.15},${m*.33} + a${h*.8},${h*.8} 1 0,0 0,${m*.34} + a${h},${h} 1 0,0 ${-1*g*.15},${m*.33} + + a${h},${h} 1 0,0 ${-1*g*.25},${m*.15} + a${h},${h} 1 0,0 ${-1*g*.25},0 + a${h},${h} 1 0,0 ${-1*g*.25},0 + a${h},${h} 1 0,0 ${-1*g*.25},${-1*m*.15} + + a${h},${h} 1 0,0 ${-1*g*.1},${-1*m*.33} + a${h*.8},${h*.8} 1 0,0 0,${-1*m*.34} + a${h},${h} 1 0,0 ${g*.1},${-1*m*.33} + H0 V0 Z`;if(t.look==="handDrawn"){const b=j.svg(a),k=Y(t,{}),v=b.path(x,k);y=a.insert(()=>v,":first-child"),y.attr("class","basic label-container").attr("style",It(u))}else y=a.insert("path",":first-child").attr("class","basic label-container").attr("style",i).attr("d",x);return y.attr("transform",`translate(${-g/2}, ${-m/2})`),G(t,y),t.calcIntersect=function(b,k){return W.rect(b,k)},t.intersect=function(b){return F.info("Bang intersect",t,b),W.rect(t,b)},a}p($f,"bang");async function Ff(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,halfPadding:s,label:o}=await it(e,t,rt(t)),l=n.width+2*s,c=n.height+2*s,h=.15*l,u=.25*l,d=.35*l,f=.2*l,{cssStyles:g}=t;let m;const y=`M0 0 + a${h},${h} 0 0,1 ${l*.25},${-1*l*.1} + a${d},${d} 1 0,1 ${l*.4},${-1*l*.1} + a${u},${u} 1 0,1 ${l*.35},${l*.2} + + a${h},${h} 1 0,1 ${l*.15},${c*.35} + a${f},${f} 1 0,1 ${-1*l*.15},${c*.65} + + a${u},${h} 1 0,1 ${-1*l*.25},${l*.15} + a${d},${d} 1 0,1 ${-1*l*.5},0 + a${h},${h} 1 0,1 ${-1*l*.25},${-1*l*.15} + + a${h},${h} 1 0,1 ${-1*l*.1},${-1*c*.35} + a${f},${f} 1 0,1 ${l*.1},${-1*c*.65} + H0 V0 Z`;if(t.look==="handDrawn"){const x=j.svg(a),b=Y(t,{}),k=x.path(y,b);m=a.insert(()=>k,":first-child"),m.attr("class","basic label-container").attr("style",It(g))}else m=a.insert("path",":first-child").attr("class","basic label-container").attr("style",i).attr("d",y);return o.attr("transform",`translate(${-n.width/2}, ${-n.height/2})`),m.attr("transform",`translate(${-l/2}, ${-c/2})`),G(t,m),t.calcIntersect=function(x,b){return W.rect(x,b)},t.intersect=function(x){return F.info("Cloud intersect",t,x),W.rect(t,x)},a}p(Ff,"cloud");async function Df(e,t){const{labelStyles:r,nodeStyles:i}=U(t);t.labelStyle=r;const{shapeSvg:a,bbox:n,halfPadding:s,label:o}=await it(e,t,rt(t)),l=n.width+8*s,c=n.height+2*s,h=5,u=` + M${-l/2} ${c/2-h} + v${-c+2*h} + q0,-${h} ${h},-${h} + h${l-2*h} + q${h},0 ${h},${h} + v${c-2*h} + q0,${h} -${h},${h} + h${-l+2*h} + q-${h},0 -${h},-${h} + Z + `,d=a.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("style",i).attr("d",u);return a.append("line").attr("class","node-line-").attr("x1",-l/2).attr("y1",c/2).attr("x2",l/2).attr("y2",c/2),o.attr("transform",`translate(${-n.width/2}, ${-n.height/2})`),a.append(()=>o.node()),G(t,d),t.calcIntersect=function(f,g){return W.rect(f,g)},t.intersect=function(f){return W.rect(t,f)},a}p(Df,"defaultMindmapNode");async function Of(e,t){const r={padding:t.padding??0};return so(e,t,r)}p(Of,"mindmapCircle");var U2=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:df},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:cf},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:ff},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:yf},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:Od},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:so},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:$f},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:Ff},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:sf},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:qd},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:Qd},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:Kd},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:wf},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:Xd},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:Id},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Cf},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Bd},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:hf},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:mf},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:gf},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:zd},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:Hd},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:Ed},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:$d},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:Fd},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:Jd},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:Tf},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:Wd},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:kf},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:tf},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:Dd},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:Rd},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:Sf},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:Bf},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:Pd},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:vf},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:Nd},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:uf},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:af},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:rf},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:_d},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:Md},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:bf},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:xf},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:_f},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:of},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:ef}],G2=p(()=>{const t=[...Object.entries({state:pf,choice:Ld,note:nf,rectWithTitle:lf,labelRect:Zd,iconSquare:Gd,iconCircle:Yd,icon:jd,iconRounded:Ud,imageSquare:Vd,anchor:Td,kanbanItem:Ef,mindmapCircle:Of,defaultMindmapNode:Df,classBox:Af,erBox:oo,requirementBox:Mf}),...U2.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(a=>[a,r.handler]))];return Object.fromEntries(t)},"generateShapeMap"),Rf=G2();function V2(e){return e in Rf}p(V2,"isValidShape");var Va=new Map;async function If(e,t,r){let i,a;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");const n=t.shape?Rf[t.shape]:void 0;if(!n)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let s;r.config.securityLevel==="sandbox"?s="_top":t.linkTarget&&(s=t.linkTarget||"_blank"),i=e.insert("svg:a").attr("xlink:href",t.link).attr("target",s??null),a=await n(i,t,r)}else a=await n(e,t,r),i=a;return t.tooltip&&a.attr("title",t.tooltip),Va.set(t.id,i),t.haveCallback&&i.attr("class",i.attr("class")+" clickable"),i}p(If,"insertNode");var QS=p((e,t)=>{Va.set(t.id,e)},"setNodeElem"),JS=p(()=>{Va.clear()},"clear"),tT=p(e=>{const t=Va.get(e.id);F.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const r=8,i=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+i-e.width/2)+", "+(e.y-e.height/2-r)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),i},"positionNode"),X2=p((e,t,r,i,a,n)=>{t.arrowTypeStart&&Dl(e,"start",t.arrowTypeStart,r,i,a,n),t.arrowTypeEnd&&Dl(e,"end",t.arrowTypeEnd,r,i,a,n)},"addEdgeMarkers"),Z2={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},Dl=p((e,t,r,i,a,n,s)=>{const o=Z2[r];if(!o){F.warn(`Unknown arrow type: ${r}`);return}const l=o.type,h=`${a}_${n}-${l}${t==="start"?"Start":"End"}`;if(s&&s.trim()!==""){const u=s.replace(/[^\dA-Za-z]/g,"_"),d=`${h}_${u}`;if(!document.getElementById(d)){const f=document.getElementById(h);if(f){const g=f.cloneNode(!0);g.id=d,g.querySelectorAll("path, circle, line").forEach(y=>{y.setAttribute("stroke",s),o.fill&&y.setAttribute("fill",s)}),f.parentNode?.appendChild(g)}}e.attr(`marker-${t}`,`url(${i}#${d})`)}else e.attr(`marker-${t}`,`url(${i}#${h})`)},"addEdgeMarker"),_a=new Map,Et=new Map,eT=p(()=>{_a.clear(),Et.clear()},"clear"),zi=p(e=>e?e.reduce((r,i)=>r+";"+i,""):"","getLabelStyles"),K2=p(async(e,t)=>{let r=Lt(dt().flowchart.htmlLabels);const{labelStyles:i}=U(t);t.labelStyle=i;const a=await He(e,t.label,{style:t.labelStyle,useHtmlLabels:r,addSvgBackground:!0,isNode:!1});F.info("abc82",t,t.labelType);const n=e.insert("g").attr("class","edgeLabel"),s=n.insert("g").attr("class","label").attr("data-id",t.id);s.node().appendChild(a);let o=a.getBBox();if(r){const c=a.children[0],h=ht(a);o=c.getBoundingClientRect(),h.attr("width",o.width),h.attr("height",o.height)}s.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),_a.set(t.id,n),t.width=o.width,t.height=o.height;let l;if(t.startLabelLeft){const c=await tr(t.startLabelLeft,zi(t.labelStyle)),h=e.insert("g").attr("class","edgeTerminals"),u=h.insert("g").attr("class","inner");l=u.node().appendChild(c);const d=c.getBBox();u.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),Et.get(t.id)||Et.set(t.id,{}),Et.get(t.id).startLeft=h,ei(l,t.startLabelLeft)}if(t.startLabelRight){const c=await tr(t.startLabelRight,zi(t.labelStyle)),h=e.insert("g").attr("class","edgeTerminals"),u=h.insert("g").attr("class","inner");l=h.node().appendChild(c),u.node().appendChild(c);const d=c.getBBox();u.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),Et.get(t.id)||Et.set(t.id,{}),Et.get(t.id).startRight=h,ei(l,t.startLabelRight)}if(t.endLabelLeft){const c=await tr(t.endLabelLeft,zi(t.labelStyle)),h=e.insert("g").attr("class","edgeTerminals"),u=h.insert("g").attr("class","inner");l=u.node().appendChild(c);const d=c.getBBox();u.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),h.node().appendChild(c),Et.get(t.id)||Et.set(t.id,{}),Et.get(t.id).endLeft=h,ei(l,t.endLabelLeft)}if(t.endLabelRight){const c=await tr(t.endLabelRight,zi(t.labelStyle)),h=e.insert("g").attr("class","edgeTerminals"),u=h.insert("g").attr("class","inner");l=u.node().appendChild(c);const d=c.getBBox();u.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),h.node().appendChild(c),Et.get(t.id)||Et.set(t.id,{}),Et.get(t.id).endRight=h,ei(l,t.endLabelRight)}return a},"insertEdgeLabel");function ei(e,t){dt().flowchart.htmlLabels&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}p(ei,"setTerminalWidth");var Q2=p((e,t)=>{F.debug("Moving label abc88 ",e.id,e.label,_a.get(e.id),t);let r=t.updatedPath?t.updatedPath:t.originalPath;const i=dt(),{subGraphTitleTotalMargin:a}=Is(i);if(e.label){const n=_a.get(e.id);let s=e.x,o=e.y;if(r){const l=oe.calcLabelPosition(r);F.debug("Moving label "+e.label+" from (",s,",",o,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(s=l.x,o=l.y)}n.attr("transform",`translate(${s}, ${o+a/2})`)}if(e.startLabelLeft){const n=Et.get(e.id).startLeft;let s=e.x,o=e.y;if(r){const l=oe.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);s=l.x,o=l.y}n.attr("transform",`translate(${s}, ${o})`)}if(e.startLabelRight){const n=Et.get(e.id).startRight;let s=e.x,o=e.y;if(r){const l=oe.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);s=l.x,o=l.y}n.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelLeft){const n=Et.get(e.id).endLeft;let s=e.x,o=e.y;if(r){const l=oe.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);s=l.x,o=l.y}n.attr("transform",`translate(${s}, ${o})`)}if(e.endLabelRight){const n=Et.get(e.id).endRight;let s=e.x,o=e.y;if(r){const l=oe.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);s=l.x,o=l.y}n.attr("transform",`translate(${s}, ${o})`)}},"positionEdgeLabel"),J2=p((e,t)=>{const r=e.x,i=e.y,a=Math.abs(t.x-r),n=Math.abs(t.y-i),s=e.width/2,o=e.height/2;return a>=s||n>=o},"outsideNode"),tk=p((e,t,r)=>{F.debug(`intersection calc abc89: + outsidePoint: ${JSON.stringify(t)} + insidePoint : ${JSON.stringify(r)} + node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const i=e.x,a=e.y,n=Math.abs(i-r.x),s=e.width/2;let o=r.xMath.abs(i-t.x)*l){let u=r.y{F.warn("abc88 cutPathAtIntersect",e,t);let r=[],i=e[0],a=!1;return e.forEach(n=>{if(F.info("abc88 checking point",n,t),!J2(t,n)&&!a){const s=tk(t,i,n);F.debug("abc88 inside",n,i,s),F.debug("abc88 intersection",s,t);let o=!1;r.forEach(l=>{o=o||l.x===s.x&&l.y===s.y}),r.some(l=>l.x===s.x&&l.y===s.y)?F.warn("abc88 no intersect",s,r):r.push(s),a=!0}else F.warn("abc88 outside",n,i),i=n,a||r.push(n)}),F.debug("returning points",r),r},"cutPathAtIntersect");function Pf(e){const t=[],r=[];for(let i=1;i5&&Math.abs(n.y-a.y)>5||a.y===n.y&&n.x===s.x&&Math.abs(n.x-a.x)>5&&Math.abs(n.y-s.y)>5)&&(t.push(n),r.push(i))}return{cornerPoints:t,cornerPointPositions:r}}p(Pf,"extractCornerPoints");var Rl=p(function(e,t,r){const i=t.x-e.x,a=t.y-e.y,n=Math.sqrt(i*i+a*a),s=r/n;return{x:t.x-s*i,y:t.y-s*a}},"findAdjacentPoint"),ek=p(function(e){const{cornerPointPositions:t}=Pf(e),r=[];for(let i=0;i10&&Math.abs(n.y-a.y)>=10){F.debug("Corner point fixing",Math.abs(n.x-a.x),Math.abs(n.y-a.y));const f=5;s.x===o.x?d={x:c<0?o.x-f+u:o.x+f-u,y:h<0?o.y-u:o.y+u}:d={x:c<0?o.x-u:o.x+u,y:h<0?o.y-f+u:o.y+f-u}}else F.debug("Corner point skipping fixing",Math.abs(n.x-a.x),Math.abs(n.y-a.y));r.push(d,l)}else r.push(e[i]);return r},"fixCorners"),rk=p((e,t,r)=>{const i=e-t-r,a=2,n=2,s=a+n,o=Math.floor(i/s),l=Array(o).fill(`${a} ${n}`).join(" ");return`0 ${t} ${l} ${r}`},"generateDashArray"),ik=p(function(e,t,r,i,a,n,s,o=!1){const{handDrawnSeed:l}=dt();let c=t.points,h=!1;const u=a;var d=n;const f=[];for(const B in t.cssCompiledStyles)pu(B)||f.push(t.cssCompiledStyles[B]);F.debug("UIO intersect check",t.points,d.x,u.x),d.intersect&&u.intersect&&!o&&(c=c.slice(1,t.points.length-1),c.unshift(u.intersect(c[0])),F.debug("Last point UIO",t.start,"-->",t.end,c[c.length-1],d,d.intersect(c[c.length-1])),c.push(d.intersect(c[c.length-1])));const g=btoa(JSON.stringify(c));t.toCluster&&(F.info("to cluster abc88",r.get(t.toCluster)),c=Ol(t.points,r.get(t.toCluster).node),h=!0),t.fromCluster&&(F.debug("from cluster abc88",r.get(t.fromCluster),JSON.stringify(c,null,2)),c=Ol(c.reverse(),r.get(t.fromCluster).node).reverse(),h=!0);let m=c.filter(B=>!Number.isNaN(B.y));m=ek(m);let y=qi;switch(y=Bn,t.curve){case"linear":y=Bn;break;case"basis":y=qi;break;case"cardinal":y=rc;break;case"bumpX":y=Ec;break;case"bumpY":y=$c;break;case"catmullRom":y=ec;break;case"monotoneX":y=tc;break;case"monotoneY":y=Jl;break;case"natural":y=Ql;break;case"step":y=Kl;break;case"stepAfter":y=Zl;break;case"stepBefore":y=Xl;break;default:y=qi}const{x,y:b}=ex(t),k=sg().x(x).y(b).curve(y);let v;switch(t.thickness){case"normal":v="edge-thickness-normal";break;case"thick":v="edge-thickness-thick";break;case"invisible":v="edge-thickness-invisible";break;default:v="edge-thickness-normal"}switch(t.pattern){case"solid":v+=" edge-pattern-solid";break;case"dotted":v+=" edge-pattern-dotted";break;case"dashed":v+=" edge-pattern-dashed";break;default:v+=" edge-pattern-solid"}let w,L=t.curve==="rounded"?Nf(zf(m,t),5):k(m);const T=Array.isArray(t.style)?t.style:[t.style];let D=T.find(B=>B?.startsWith("stroke:")),I=!1;if(t.look==="handDrawn"){const B=j.svg(e);Object.assign([],m);const A=B.path(L,{roughness:.3,seed:l});v+=" transition",w=ht(A).select("path").attr("id",t.id).attr("class"," "+v+(t.classes?" "+t.classes:"")).attr("style",T?T.reduce(($,M)=>$+";"+M,""):"");let _=w.attr("d");w.attr("d",_),e.node().appendChild(w.node())}else{const B=f.join(";"),A=T?T.reduce((J,Z)=>J+Z+";",""):"";let _="";t.animate&&(_=" edge-animation-fast"),t.animation&&(_=" edge-animation-"+t.animation);const $=(B?B+";"+A+";":A)+";"+(T?T.reduce((J,Z)=>J+";"+Z,""):"");w=e.append("path").attr("d",L).attr("id",t.id).attr("class"," "+v+(t.classes?" "+t.classes:"")+(_??"")).attr("style",$),D=$.match(/stroke:([^;]+)/)?.[1],I=t.animate===!0||!!t.animation||B.includes("animation");const M=w.node(),q=typeof M.getTotalLength=="function"?M.getTotalLength():0,V=Qo[t.arrowTypeStart]||0,K=Qo[t.arrowTypeEnd]||0;if(t.look==="neo"&&!I){const Z=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?rk(q,V,K):`0 ${V} ${q-V-K} ${K}`}; stroke-dashoffset: 0;`;w.attr("style",Z+w.attr("style"))}}w.attr("data-edge",!0),w.attr("data-et","edge"),w.attr("data-id",t.id),w.attr("data-points",g),t.showPoints&&m.forEach(B=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",B.x).attr("cy",B.y)});let O="";(dt().flowchart.arrowMarkerAbsolute||dt().state.arrowMarkerAbsolute)&&(O=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,O=O.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),F.info("arrowTypeStart",t.arrowTypeStart),F.info("arrowTypeEnd",t.arrowTypeEnd),X2(w,t,O,s,i,D);const E=Math.floor(c.length/2),N=c[E];oe.isLabelCoordinateInPath(N,w.attr("d"))||(h=!0);let R={};return h&&(R.updatedPath=c),R.originalPath=t.points,R},"insertEdge");function Nf(e,t){if(e.length<2)return"";let r="";const i=e.length,a=1e-5;for(let n=0;n({...a}));if(e.length>=2&&Dt[t.arrowTypeStart]){const a=Dt[t.arrowTypeStart],n=e[0],s=e[1],{angle:o}=us(n,s),l=a*Math.cos(o),c=a*Math.sin(o);r[0].x=n.x+l,r[0].y=n.y+c}const i=e.length;if(i>=2&&Dt[t.arrowTypeEnd]){const a=Dt[t.arrowTypeEnd],n=e[i-1],s=e[i-2],{angle:o}=us(s,n),l=a*Math.cos(o),c=a*Math.sin(o);r[i-1].x=n.x-l,r[i-1].y=n.y-c}return r}p(zf,"applyMarkerOffsetsToPoints");var ak=p((e,t,r,i)=>{t.forEach(a=>{Ck[a](e,r,i)})},"insertMarkers"),nk=p((e,t,r)=>{F.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),sk=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),ok=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),lk=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),ck=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),hk=p((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),uk=p((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),dk=p((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),fk=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),pk=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),gk=p((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),i.append("path").attr("d","M9,0 L9,18");const a=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");a.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),a.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),mk=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),yk=p((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),i.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const a=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");a.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),a.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),xk=p((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0 + L20,10 + M20,10 + L0,20`)},"requirement_arrow"),bk=p((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),Ck={extension:nk,composition:sk,aggregation:ok,dependency:lk,lollipop:ck,point:hk,circle:uk,cross:dk,barb:fk,only_one:pk,zero_or_one:gk,one_or_more:mk,zero_or_more:yk,requirement_arrow:xk,requirement_contains:bk},kk=ak,wk={common:Mr,getConfig:Ot,insertCluster:M2,insertEdge:ik,insertEdgeLabel:K2,insertMarkers:kk,insertNode:If,interpolateToCurve:qs,labelHelper:it,log:F,positionEdgeLabel:Q2},mi={},Wf=p(e=>{for(const t of e)mi[t.name]=t},"registerLayoutLoaders"),vk=p(()=>{Wf([{name:"dagre",loader:p(async()=>await pt(()=>import("./dagre-6UL2VRFP-BN0m3k96.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url),"loader")},{name:"cose-bilkent",loader:p(async()=>await pt(()=>import("./cose-bilkent-S5V4N54A-D75Zovpi.js"),__vite__mapDeps([13,14,8,6,7,9,12,10,11]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");vk();var rT=p(async(e,t)=>{if(!(e.layoutAlgorithm in mi))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const r=mi[e.layoutAlgorithm];return(await r.loader()).render(e,t,wk,{algorithm:r.algorithm})},"render"),iT=p((e="",{fallback:t="dagre"}={})=>{if(e in mi)return e;if(t in mi)return F.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),qf="comm",Hf="rule",jf="decl",Sk="@import",Tk="@namespace",_k="@keyframes",Bk="@layer",Yf=Math.abs,lo=String.fromCharCode;function Uf(e){return e.trim()}function Ji(e,t,r){return e.replace(t,r)}function Lk(e,t,r){return e.indexOf(t,r)}function wr(e,t){return e.charCodeAt(t)|0}function Lr(e,t,r){return e.slice(t,r)}function ye(e){return e.length}function Ak(e){return e.length}function Wi(e,t){return t.push(e),e}var Xa=1,Ar=1,Gf=0,te=0,vt=0,Or="";function co(e,t,r,i,a,n,s,o){return{value:e,root:t,parent:r,type:i,props:a,children:n,line:Xa,column:Ar,length:s,return:"",siblings:o}}function Mk(){return vt}function Ek(){return vt=te>0?wr(Or,--te):0,Ar--,vt===10&&(Ar=1,Xa--),vt}function ce(){return vt=te2||yi(vt)>3?"":" "}function Ok(e,t){for(;--t&&ce()&&!(vt<48||vt>102||vt>57&&vt<65||vt>70&&vt<97););return Za(e,ta()+(t<6&&Ie()==32&&ce()==32))}function ds(e){for(;ce();)switch(vt){case e:return te;case 34:case 39:e!==34&&e!==39&&ds(vt);break;case 40:e===41&&ds(e);break;case 92:ce();break}return te}function Rk(e,t){for(;ce()&&e+vt!==57;)if(e+vt===84&&Ie()===47)break;return"/*"+Za(t,te-1)+"*"+lo(e===47?e:ce())}function Ik(e){for(;!yi(Ie());)ce();return Za(e,te)}function Pk(e){return Fk(ea("",null,null,null,[""],e=$k(e),0,[0],e))}function ea(e,t,r,i,a,n,s,o,l){for(var c=0,h=0,u=s,d=0,f=0,g=0,m=1,y=1,x=1,b=0,k="",v=a,w=n,L=i,T=k;y;)switch(g=b,b=ce()){case 40:if(g!=108&&wr(T,u-1)==58){Lk(T+=Ji(Tn(b),"&","&\f"),"&\f",Yf(c?o[c-1]:0))!=-1&&(x=-1);break}case 34:case 39:case 91:T+=Tn(b);break;case 9:case 10:case 13:case 32:T+=Dk(g);break;case 92:T+=Ok(ta()-1,7);continue;case 47:switch(Ie()){case 42:case 47:Wi(Nk(Rk(ce(),ta()),t,r,l),l),(yi(g||1)==5||yi(Ie()||1)==5)&&ye(T)&&Lr(T,-1,void 0)!==" "&&(T+=" ");break;default:T+="/"}break;case 123*m:o[c++]=ye(T)*x;case 125*m:case 59:case 0:switch(b){case 0:case 125:y=0;case 59+h:x==-1&&(T=Ji(T,/\f/g,"")),f>0&&(ye(T)-u||m===0&&g===47)&&Wi(f>32?Pl(T+";",i,r,u-1,l):Pl(Ji(T," ","")+";",i,r,u-2,l),l);break;case 59:T+=";";default:if(Wi(L=Il(T,t,r,c,h,a,o,k,v=[],w=[],u,n),n),b===123)if(h===0)ea(T,t,L,L,v,n,u,o,w);else{switch(d){case 99:if(wr(T,3)===110)break;case 108:if(wr(T,2)===97)break;default:h=0;case 100:case 109:case 115:}h?ea(e,L,L,i&&Wi(Il(e,L,L,0,0,a,o,k,a,v=[],u,w),w),a,w,u,o,i?v:w):ea(T,L,L,L,[""],w,0,o,w)}}c=h=f=0,m=x=1,k=T="",u=s;break;case 58:u=1+ye(T),f=g;default:if(m<1){if(b==123)--m;else if(b==125&&m++==0&&Ek()==125)continue}switch(T+=lo(b),b*m){case 38:x=h>0?1:(T+="\f",-1);break;case 44:o[c++]=(ye(T)-1)*x,x=1;break;case 64:Ie()===45&&(T+=Tn(ce())),d=Ie(),h=u=ye(k=T+=Ik(ta())),b++;break;case 45:g===45&&ye(T)==2&&(m=0)}}return n}function Il(e,t,r,i,a,n,s,o,l,c,h,u){for(var d=a-1,f=a===0?n:[""],g=Ak(f),m=0,y=0,x=0;m0?f[b]+" "+k:Ji(k,/&\f/g,f[b])))&&(l[x++]=v);return co(e,t,r,a===0?Hf:o,l,c,h,u)}function Nk(e,t,r,i){return co(e,t,r,qf,lo(Mk()),Lr(e,2,-2),0,i)}function Pl(e,t,r,i,a){return co(e,t,r,jf,Lr(e,0,i),Lr(e,i+1,-1),i,a)}function fs(e,t){for(var r="",i=0;i/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),rw=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./c4Diagram-YG6GDRKO-DjbbCTFy.js");return{diagram:t}},__vite__mapDeps([15,16,12,6,7,8,9,10,11]),import.meta.url);return{id:Vf,diagram:e}},"loader"),iw={id:Vf,detector:ew,loader:rw},aw=iw,Xf="flowchart",nw=p((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),sw=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-D9HAgoN0.js");return{diagram:t}},__vite__mapDeps([17,18,19,12,20,21,6,7,8,9,10,11]),import.meta.url);return{id:Xf,diagram:e}},"loader"),ow={id:Xf,detector:nw,loader:sw},lw=ow,Zf="flowchart-v2",cw=p((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),hw=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-D9HAgoN0.js");return{diagram:t}},__vite__mapDeps([17,18,19,12,20,21,6,7,8,9,10,11]),import.meta.url);return{id:Zf,diagram:e}},"loader"),uw={id:Zf,detector:cw,loader:hw},dw=uw,Kf="er",fw=p(e=>/^\s*erDiagram/.test(e),"detector"),pw=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./erDiagram-Q2GNP2WA-BA7V4EyD.js");return{diagram:t}},__vite__mapDeps([22,19,12,20,21,6,7,8,9,10,11]),import.meta.url);return{id:Kf,diagram:e}},"loader"),gw={id:Kf,detector:fw,loader:pw},mw=gw,Qf="gitGraph",yw=p(e=>/^\s*gitGraph/.test(e),"detector"),xw=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-NY62KEGX-BgYjZPZA.js");return{diagram:t}},__vite__mapDeps([23,24,25,26,6,7,4,2,12,8,9,10,11]),import.meta.url);return{id:Qf,diagram:e}},"loader"),bw={id:Qf,detector:yw,loader:xw},Cw=bw,Jf="gantt",kw=p(e=>/^\s*gantt/.test(e),"detector"),ww=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./ganttDiagram-JELNMOA3-j8t2SK-P.js");return{diagram:t}},__vite__mapDeps([27,8,6,7,9,28,10,29,30,31,12,11]),import.meta.url);return{id:Jf,diagram:e}},"loader"),vw={id:Jf,detector:kw,loader:ww},Sw=vw,tp="info",Tw=p(e=>/^\s*info/.test(e),"detector"),_w=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./infoDiagram-WHAUD3N6-MJfiAORX.js");return{diagram:t}},__vite__mapDeps([32,26,6,7,4,2,8,9,10,11,12]),import.meta.url);return{id:tp,diagram:e}},"loader"),Bw={id:tp,detector:Tw,loader:_w},ep="pie",Lw=p(e=>/^\s*pie/.test(e),"detector"),Aw=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./pieDiagram-ADFJNKIX-CMO7fUEe.js");return{diagram:t}},__vite__mapDeps([33,24,26,6,7,4,2,34,10,35,30,8,9,11,12]),import.meta.url);return{id:ep,diagram:e}},"loader"),Mw={id:ep,detector:Lw,loader:Aw},rp="quadrantChart",Ew=p(e=>/^\s*quadrantChart/.test(e),"detector"),$w=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./quadrantDiagram-AYHSOK5B-PRy5QUyE.js");return{diagram:t}},__vite__mapDeps([36,29,10,30,31,12,6,7,8,9,11]),import.meta.url);return{id:rp,diagram:e}},"loader"),Fw={id:rp,detector:Ew,loader:$w},Dw=Fw,ip="xychart",Ow=p(e=>/^\s*xychart(-beta)?/.test(e),"detector"),Rw=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./xychartDiagram-PRI3JC2R-DG74V_zU.js");return{diagram:t}},__vite__mapDeps([37,30,35,38,29,10,31,6,7,8,9,11,12]),import.meta.url);return{id:ip,diagram:e}},"loader"),Iw={id:ip,detector:Ow,loader:Rw},Pw=Iw,ap="requirement",Nw=p(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),zw=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./requirementDiagram-UZGBJVZJ-C2v_TNfg.js");return{diagram:t}},__vite__mapDeps([39,19,12,20,6,7,8,9,10,11]),import.meta.url);return{id:ap,diagram:e}},"loader"),Ww={id:ap,detector:Nw,loader:zw},qw=Ww,np="sequence",Hw=p(e=>/^\s*sequenceDiagram/.test(e),"detector"),jw=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./sequenceDiagram-WL72ISMW-BAq_mB_E.js");return{diagram:t}},__vite__mapDeps([40,16,25,12,6,7,8,9,10,11]),import.meta.url);return{id:np,diagram:e}},"loader"),Yw={id:np,detector:Hw,loader:jw},Uw=Yw,sp="class",Gw=p((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),Vw=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./classDiagram-2ON5EDUG-ByHtPLEH.js");return{diagram:t}},__vite__mapDeps([41,42,18,19,12,20,6,7,8,9,10,11]),import.meta.url);return{id:sp,diagram:e}},"loader"),Xw={id:sp,detector:Gw,loader:Vw},Zw=Xw,op="classDiagram",Kw=p((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),Qw=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./classDiagram-v2-WZHVMYZB-ByHtPLEH.js");return{diagram:t}},__vite__mapDeps([43,42,18,19,12,20,6,7,8,9,10,11]),import.meta.url);return{id:op,diagram:e}},"loader"),Jw={id:op,detector:Kw,loader:Qw},tv=Jw,lp="state",ev=p((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),rv=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./stateDiagram-FKZM4ZOC-BLr48BHD.js");return{diagram:t}},__vite__mapDeps([44,45,19,12,20,1,2,3,4,10,6,7,8,9,11]),import.meta.url);return{id:lp,diagram:e}},"loader"),iv={id:lp,detector:ev,loader:rv},av=iv,cp="stateDiagram",nv=p((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),sv=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-4FDKWEC3-BnlJCfwo.js");return{diagram:t}},__vite__mapDeps([46,45,19,12,20,6,7,8,9,10,11]),import.meta.url);return{id:cp,diagram:e}},"loader"),ov={id:cp,detector:nv,loader:sv},lv=ov,hp="journey",cv=p(e=>/^\s*journey/.test(e),"detector"),hv=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./journeyDiagram-XKPGCS4Q-CF8rya2c.js");return{diagram:t}},__vite__mapDeps([47,16,18,12,34,10,6,7,8,9,11]),import.meta.url);return{id:hp,diagram:e}},"loader"),uv={id:hp,detector:cv,loader:hv},dv=uv,fv=p((e,t,r)=>{F.debug(`rendering svg for syntax error +`);const i=Gy(t),a=i.append("g");i.attr("viewBox","0 0 2412 512"),Sc(i,100,512,!0),a.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),a.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),a.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),a.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),a.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),a.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),a.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),a.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),up={draw:fv},pv=up,gv={db:{},renderer:up,parser:{parse:p(()=>{},"parse")}},mv=gv,dp="flowchart-elk",yv=p((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),xv=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-D9HAgoN0.js");return{diagram:t}},__vite__mapDeps([17,18,19,12,20,21,6,7,8,9,10,11]),import.meta.url);return{id:dp,diagram:e}},"loader"),bv={id:dp,detector:yv,loader:xv},Cv=bv,fp="timeline",kv=p(e=>/^\s*timeline/.test(e),"detector"),wv=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./timeline-definition-IT6M3QCI-BjzgPbAR.js");return{diagram:t}},__vite__mapDeps([48,12,34,10,6,7,8,9,11]),import.meta.url);return{id:fp,diagram:e}},"loader"),vv={id:fp,detector:kv,loader:wv},Sv=vv,pp="mindmap",Tv=p(e=>/^\s*mindmap/.test(e),"detector"),_v=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./mindmap-definition-VGOIOE7T-BSbRsNcp.js");return{diagram:t}},__vite__mapDeps([49,19,12,20,6,7,8,9,10,11]),import.meta.url);return{id:pp,diagram:e}},"loader"),Bv={id:pp,detector:Tv,loader:_v},Lv=Bv,gp="kanban",Av=p(e=>/^\s*kanban/.test(e),"detector"),Mv=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./kanban-definition-3W4ZIXB7-DqtHVgz8.js");return{diagram:t}},__vite__mapDeps([50,18,6,7,8,9,10,11,12]),import.meta.url);return{id:gp,diagram:e}},"loader"),Ev={id:gp,detector:Av,loader:Mv},$v=Ev,mp="sankey",Fv=p(e=>/^\s*sankey(-beta)?/.test(e),"detector"),Dv=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./sankeyDiagram-TZEHDZUN-DvP84S6l.js");return{diagram:t}},__vite__mapDeps([51,35,30,52,12,6,7,8,9,10,11]),import.meta.url);return{id:mp,diagram:e}},"loader"),Ov={id:mp,detector:Fv,loader:Dv},Rv=Ov,yp="packet",Iv=p(e=>/^\s*packet(-beta)?/.test(e),"detector"),Pv=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./diagram-S2PKOQOG-CEnWRsMT.js");return{diagram:t}},__vite__mapDeps([53,24,26,6,7,4,2,8,9,10,11,12]),import.meta.url);return{id:yp,diagram:e}},"loader"),Nv={id:yp,detector:Iv,loader:Pv},xp="radar",zv=p(e=>/^\s*radar-beta/.test(e),"detector"),Wv=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./diagram-QEK2KX5R-D6_C2dWJ.js");return{diagram:t}},__vite__mapDeps([54,24,26,6,7,4,2,8,9,10,11,12]),import.meta.url);return{id:xp,diagram:e}},"loader"),qv={id:xp,detector:zv,loader:Wv},bp="block",Hv=p(e=>/^\s*block(-beta)?/.test(e),"detector"),jv=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./blockDiagram-VD42YOAC-BIkysrgD.js");return{diagram:t}},__vite__mapDeps([55,18,5,1,2,21,12,10,6,7,8,9,11]),import.meta.url);return{id:bp,diagram:e}},"loader"),Yv={id:bp,detector:Hv,loader:jv},Uv=Yv,Cp="architecture",Gv=p(e=>/^\s*architecture/.test(e),"detector"),Vv=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./architectureDiagram-VXUJARFQ-Od4R8hlz.js");return{diagram:t}},__vite__mapDeps([56,24,26,6,7,4,2,14,8,9,12,10,11]),import.meta.url);return{id:Cp,diagram:e}},"loader"),Xv={id:Cp,detector:Gv,loader:Vv},Zv=Xv,kp="treemap",Kv=p(e=>/^\s*treemap/.test(e),"detector"),Qv=p(async()=>{const{diagram:e}=await pt(async()=>{const{diagram:t}=await import("./diagram-PSM6KHXK-CdCLy2g4.js");return{diagram:t}},__vite__mapDeps([57,20,24,26,6,7,4,2,31,35,30,58,12,8,9,10,11]),import.meta.url);return{id:kp,diagram:e}},"loader"),Jv={id:kp,detector:Kv,loader:Qv},Yl=!1,Ka=p(()=>{Yl||(Yl=!0,sa("error",mv,e=>e.toLowerCase().trim()==="error"),sa("---",{db:{clear:p(()=>{},"clear")},styles:{},renderer:{draw:p(()=>{},"draw")},parser:{parse:p(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:p(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),En(Cv,Lv,Zv),En(aw,$v,tv,Zw,mw,Sw,Bw,Mw,qw,Uw,dw,lw,Sv,Cw,lv,av,dv,Dw,Rv,Nv,Pw,Uv,qv,Jv))},"addDiagrams"),tS=p(async()=>{F.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(er).map(async([r,{detector:i,loader:a}])=>{if(a)try{On(r)}catch{try{const{diagram:n,id:s}=await a();sa(s,n,i)}catch(n){throw F.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete er[r],n}}}))).filter(r=>r.status==="rejected");if(t.length>0){F.error(`Failed to load ${t.length} external diagrams`);for(const r of t)F.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),eS="graphics-document document";function wp(e,t){e.attr("role",eS),t!==""&&e.attr("aria-roledescription",t)}p(wp,"setA11yDiagramInfo");function vp(e,t,r,i){if(e.insert!==void 0){if(r){const a=`chart-desc-${i}`;e.attr("aria-describedby",a),e.insert("desc",":first-child").attr("id",a).text(r)}if(t){const a=`chart-title-${i}`;e.attr("aria-labelledby",a),e.insert("title",":first-child").attr("id",a).text(t)}}}p(vp,"addSVGa11yTitleDescription");var xs=class Sp{constructor(t,r,i,a,n){this.type=t,this.text=r,this.db=i,this.parser=a,this.renderer=n}static{p(this,"Diagram")}static async fromText(t,r={}){const i=Ot(),a=ks(t,i);t=J1(t)+` +`;try{On(a)}catch{const c=Yg(a);if(!c)throw new dc(`Diagram ${a} not found.`);const{id:h,diagram:u}=await c();sa(h,u)}const{db:n,parser:s,renderer:o,init:l}=On(a);return s.parser&&(s.parser.yy=n),n.clear?.(),l?.(i),r.title&&n.setDiagramTitle?.(r.title),await s.parse(t),new Sp(a,t,n,s,o)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},Ul=[],rS=p(()=>{Ul.forEach(e=>{e()}),Ul=[]},"attachFunctions"),iS=p(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Tp(e){const t=e.match(uc);if(!t)return{text:e,metadata:{}};let r=tx(t[1],{schema:J0})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const i={};return r.displayMode&&(i.displayMode=r.displayMode.toString()),r.title&&(i.title=r.title.toString()),r.config&&(i.config=r.config),{text:e.slice(t[0].length),metadata:i}}p(Tp,"extractFrontMatter");var aS=p(e=>e.replace(/\r\n?/g,` +`).replace(/<(\w+)([^>]*)>/g,(t,r,i)=>"<"+r+i.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),nS=p(e=>{const{text:t,metadata:r}=Tp(e),{displayMode:i,title:a,config:n={}}=r;return i&&(n.gantt||(n.gantt={}),n.gantt.displayMode=i),{title:a,config:n,text:t}},"processFrontmatter"),sS=p(e=>{const t=oe.detectInit(e)??{},r=oe.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:i})=>i==="wrap"):r?.type==="wrap"&&(t.wrap=!0),{text:z1(e),directive:t}},"processDirectives");function ho(e){const t=aS(e),r=nS(t),i=sS(r.text),a=Gs(r.config,i.directive);return e=iS(i.text),{code:e,title:r.title,config:a}}p(ho,"preprocessDiagram");function _p(e){const t=new TextEncoder().encode(e),r=Array.from(t,i=>String.fromCodePoint(i)).join("");return btoa(r)}p(_p,"toBase64");var oS=5e4,lS="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",cS="sandbox",hS="loose",uS="http://www.w3.org/2000/svg",dS="http://www.w3.org/1999/xlink",fS="http://www.w3.org/1999/xhtml",pS="100%",gS="100%",mS="border:0;margin:0;",yS="margin:0",xS="allow-top-navigation-by-user-activation allow-popups",bS='The "iframe" tag is not supported by your browser.',CS=["foreignobject"],kS=["dominant-baseline"];function uo(e){const t=ho(e);return aa(),om(t.config??{}),t}p(uo,"processAndSetConfigs");async function Bp(e,t){Ka();try{const{code:r,config:i}=uo(e);return{diagramType:(await Ap(r)).type,config:i}}catch(r){if(t?.suppressErrors)return!1;throw r}}p(Bp,"parse");var Gl=p((e,t,r=[])=>` +.${e} ${t} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),wS=p((e,t=new Map)=>{let r="";if(e.themeCSS!==void 0&&(r+=` +${e.themeCSS}`),e.fontFamily!==void 0&&(r+=` +:root { --mermaid-font-family: ${e.fontFamily}}`),e.altFontFamily!==void 0&&(r+=` +:root { --mermaid-alt-font-family: ${e.altFontFamily}}`),t instanceof Map){const s=e.htmlLabels??e.flowchart?.htmlLabels?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(o=>{jl(o.styles)||s.forEach(l=>{r+=Gl(o.id,l,o.styles)}),jl(o.textStyles)||(r+=Gl(o.id,"tspan",(o?.textStyles||[]).map(l=>l.replace("color","fill"))))})}return r},"createCssStyles"),vS=p((e,t,r,i)=>{const a=wS(e,r),n=Bm(t,a,e.themeVariables);return fs(Pk(`${i}{${n}}`),zk)},"createUserStyles"),SS=p((e="",t,r)=>{let i=e;return!r&&!t&&(i=i.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),i=hr(i),i=i.replace(/
          /g,"
          "),i},"cleanUpSvgCode"),TS=p((e="",t)=>{const r=t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+"px":gS,i=_p(`${e}`);return``},"putIntoIFrame"),Vl=p((e,t,r,i,a)=>{const n=e.append("div");n.attr("id",r),i&&n.attr("style",i);const s=n.append("svg").attr("id",t).attr("width","100%").attr("xmlns",uS);return a&&s.attr("xmlns:xlink",a),s.append("g"),e},"appendDivSvgG");function bs(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}p(bs,"sandboxedIframe");var _S=p((e,t,r,i)=>{e.getElementById(t)?.remove(),e.getElementById(r)?.remove(),e.getElementById(i)?.remove()},"removeExistingElements"),BS=p(async function(e,t,r){Ka();const i=uo(t);t=i.code;const a=Ot();F.debug(a),t.length>(a?.maxTextSize??oS)&&(t=lS);const n="#"+e,s="i"+e,o="#"+s,l="d"+e,c="#"+l,h=p(()=>{const R=ht(d?o:c).node();R&&"remove"in R&&R.remove()},"removeTempElements");let u=ht("body");const d=a.securityLevel===cS,f=a.securityLevel===hS,g=a.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),d){const N=bs(ht(r),s);u=ht(N.nodes()[0].contentDocument.body),u.node().style.margin=0}else u=ht(r);Vl(u,e,l,`font-family: ${g}`,dS)}else{if(_S(document,e,l,s),d){const N=bs(ht("body"),s);u=ht(N.nodes()[0].contentDocument.body),u.node().style.margin=0}else u=ht("body");Vl(u,e,l)}let m,y;try{m=await xs.fromText(t,{title:i.title})}catch(N){if(a.suppressErrorRendering)throw h(),N;m=await xs.fromText("error"),y=N}const x=u.select(c).node(),b=m.type,k=x.firstChild,v=k.firstChild,w=m.renderer.getClasses?.(t,m),L=vS(a,b,w,n),T=document.createElement("style");T.innerHTML=L,k.insertBefore(T,v);try{await m.renderer.draw(t,e,$o.version,m)}catch(N){throw a.suppressErrorRendering?h():pv.draw(t,e,$o.version),N}const D=u.select(`${c} svg`),I=m.db.getAccTitle?.(),O=m.db.getAccDescription?.();Mp(b,D,I,O),u.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns",fS);let E=u.select(c).node().innerHTML;if(F.debug("config.arrowMarkerAbsolute",a.arrowMarkerAbsolute),E=SS(E,d,Lt(a.arrowMarkerAbsolute)),d){const N=u.select(c+" svg").node();E=TS(E,N)}else f||(E=vr.sanitize(E,{ADD_TAGS:CS,ADD_ATTR:kS,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(rS(),y)throw y;return h(),{diagramType:b,svg:E,bindFunctions:m.db.bindFunctions}},"render");function Lp(e={}){const t=_t({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),nm(t),t?.theme&&t.theme in Ae?t.themeVariables=Ae[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=Ae.default.getThemeVariables(t.themeVariables));const r=typeof t=="object"?am(t):yc();Cs(r.logLevel),Ka()}p(Lp,"initialize");var Ap=p((e,t={})=>{const{code:r}=ho(e);return xs.fromText(r,t)},"getDiagramFromText");function Mp(e,t,r,i){wp(t,e),vp(t,r,i,t.attr("id"))}p(Mp,"addA11yInfo");var sr=Object.freeze({render:BS,parse:Bp,getDiagramFromText:Ap,initialize:Lp,getConfig:Ot,setConfig:xc,getSiteConfig:yc,updateSiteConfig:sm,reset:p(()=>{aa()},"reset"),globalReset:p(()=>{aa(Sr)},"globalReset"),defaultConfig:Sr});Cs(Ot().logLevel);aa(Ot());var LS=p((e,t,r)=>{F.warn(e),Us(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),Ep=p(async function(e={querySelector:".mermaid"}){try{await AS(e)}catch(t){if(Us(t)&&F.error(t.str),Fe.parseError&&Fe.parseError(t),!e.suppressErrors)throw F.error("Use the suppressErrors option to suppress these errors"),t}},"run"),AS=p(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){const i=sr.getConfig();F.debug(`${e?"":"No "}Callback function found`);let a;if(r)a=r;else if(t)a=document.querySelectorAll(t);else throw new Error("Nodes and querySelector are both undefined");F.debug(`Found ${a.length} diagrams`),i?.startOnLoad!==void 0&&(F.debug("Start On Load: "+i?.startOnLoad),sr.updateSiteConfig({startOnLoad:i?.startOnLoad}));const n=new oe.InitIDGenerator(i.deterministicIds,i.deterministicIDSeed);let s;const o=[];for(const l of Array.from(a)){if(F.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const c=`mermaid-${n.next()}`;s=l.innerHTML,s=Zu(oe.entityDecode(s)).trim().replace(//gi,"
          ");const h=oe.detectInit(s);h&&F.debug("Detected early reinit: ",h);try{const{svg:u,bindFunctions:d}=await Op(c,s,l);l.innerHTML=u,e&&await e(c),d&&d(l)}catch(u){LS(u,o,Fe.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),$p=p(function(e){sr.initialize(e)},"initialize"),MS=p(async function(e,t,r){F.warn("mermaid.init is deprecated. Please use run instead."),e&&$p(e);const i={postRenderCallback:r,querySelector:".mermaid"};typeof t=="string"?i.querySelector=t:t&&(t instanceof HTMLElement?i.nodes=[t]:i.nodes=t),await Ep(i)},"init"),ES=p(async(e,{lazyLoad:t=!0}={})=>{Ka(),En(...e),t===!1&&await tS()},"registerExternalDiagrams"),Fp=p(function(){if(Fe.startOnLoad){const{startOnLoad:e}=sr.getConfig();e&&Fe.run().catch(t=>F.error("Mermaid failed to initialize",t))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",Fp,!1);var $S=p(function(e){Fe.parseError=e},"setParseErrorHandler"),Ba=[],_n=!1,Dp=p(async()=>{if(!_n){for(_n=!0;Ba.length>0;){const e=Ba.shift();if(e)try{await e()}catch(t){F.error("Error executing queue",t)}}_n=!1}},"executeQueue"),FS=p(async(e,t)=>new Promise((r,i)=>{const a=p(()=>new Promise((n,s)=>{sr.parse(e,t).then(o=>{n(o),r(o)},o=>{F.error("Error parsing",o),Fe.parseError?.(o),s(o),i(o)})}),"performCall");Ba.push(a),Dp().catch(i)}),"parse"),Op=p((e,t,r)=>new Promise((i,a)=>{const n=p(()=>new Promise((s,o)=>{sr.render(e,t,r).then(l=>{s(l),i(l)},l=>{F.error("Error parsing",l),Fe.parseError?.(l),o(l),a(l)})}),"performCall");Ba.push(n),Dp().catch(a)}),"render"),DS=p(()=>Object.keys(er).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),Fe={startOnLoad:!0,mermaidAPI:sr,parse:FS,render:Op,init:MS,run:Ep,registerExternalDiagrams:ES,registerLayoutLoaders:Wf,initialize:$p,parseError:void 0,contentLoaded:Fp,setParseErrorHandler:$S,detectType:ks,registerIconPacks:i2,getRegisteredDiagramsMetadata:DS},OS=Fe;const aT=Object.freeze(Object.defineProperty({__proto__:null,default:OS},Symbol.toStringTag,{value:"Module"}));export{M2 as $,ii as A,gg as B,xe as C,Rm as D,Gs as E,mc as F,Ot as G,Y1 as H,Gy as I,J0 as J,$o as K,Kg as L,Tr as M,qS as N,Wa as O,mm as P,ws as Q,jo as R,j1 as S,Sm as T,st as U,xi as V,H as W,et as X,Tc as Y,R1 as Z,p as _,Mm as a,ms as a$,If as a0,tT as a1,ex as a2,Lt as a3,He as a4,Is as a5,ld as a6,hr as a7,Du as a8,U as a9,Ze as aA,n1 as aB,ul as aC,or as aD,mb as aE,zs as aF,fb as aG,bb as aH,Fr as aI,c1 as aJ,$1 as aK,Sb as aL,T1 as aM,Ps as aN,jl as aO,$r as aP,m1 as aQ,jk as aR,ki as aS,ga as aT,qe as aU,Ra as aV,sl as aW,Ws as aX,ku as aY,Tu as aZ,ub as a_,pu as aa,n2 as ab,kk as ac,JS as ad,eT as ae,KS as af,G as ag,QS as ah,ik as ai,Q2 as aj,K2 as ak,WS as al,za as am,ma as an,Lu as ao,Si as ap,i2 as aq,r2 as ar,pg as as,h1 as at,_u as au,bu as av,pb as aw,fa as ax,gb as ay,wi as az,Am as b,E1 as b0,S1 as b1,F1 as b2,Ns as b3,O1 as b4,aT as b5,dt as c,Sc as d,_t as e,$e as f,$m as g,Jt as h,ox as i,Mr as j,Ru as k,F as l,bi as m,HS as n,iT as o,Fm as p,Dm as q,rT as r,Em as s,tx as t,oe as u,V2 as v,V1 as w,YS as x,Lm as y,jS as z}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mesh.vertexData.functions-ayNlGC5K.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mesh.vertexData.functions-ayNlGC5K.js new file mode 100644 index 0000000000000000000000000000000000000000..c4cde3af57817d35b46bd000f41af9a8215d0711 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mesh.vertexData.functions-ayNlGC5K.js @@ -0,0 +1 @@ +function l(o){return Math.floor(o/8)}function y(o){return 1<=this.size)throw new RangeError("Bit index out of range");const n=l(e),r=y(e);return(this._byteArray[n]&r)!==0}set(e,n){if(e>=this.size)throw new RangeError("Bit index out of range");const r=l(e),s=y(e);n?this._byteArray[r]|=s:this._byteArray[r]&=~s}}function w(o){const e=[],n=o.length/3;for(let t=0;t{const a=[t];for(;a.length>0;){const c=a.pop();if(!s.get(c)){s.set(c,!0),h.push(e[c]);for(const f of e[c]){const u=r.get(f);if(!u)return;for(const g of u)s.get(g)||a.push(g)}}}};for(let t=0;t, +visibility : f32,};var mesh : Mesh; +#define WORLD_UBO +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=s); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/meshUboDeclaration-C6raEdzf.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/meshUboDeclaration-C6raEdzf.js new file mode 100644 index 0000000000000000000000000000000000000000..24e78c03242ec8b63ea3c3e2352208a3f76d6907 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/meshUboDeclaration-C6raEdzf.js @@ -0,0 +1,8 @@ +import{S as o}from"./index-CDrXokXW.js";const e="meshUboDeclaration",i=`#ifdef WEBGL2 +uniform mat4 world;uniform float visibility; +#else +layout(std140,column_major) uniform;uniform Mesh +{mat4 world;float visibility;}; +#endif +#define WORLD_UBO +`;o.IncludesShadersStore[e]||(o.IncludesShadersStore[e]=i); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/min-ljrXhbfm.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/min-ljrXhbfm.js new file mode 100644 index 0000000000000000000000000000000000000000..54575e8e0948312ed0d32bdd07e619b3b1f91a49 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/min-ljrXhbfm.js @@ -0,0 +1 @@ +import{b as m,a as b,c as d,d as h,i as l}from"./_baseUniq-DT1kfcxk.js";import{am as o,an as g,ao as p}from"./mermaid.core-7TB2QPZo.js";function M(a){var n=a==null?0:a.length;return n?m(a):[]}function v(a,n){var s=-1,t=o(a)?Array(a.length):[];return b(a,function(f,i,e){t[++s]=n(f,i,e)}),t}function k(a,n){var s=g(a)?h:v;return s(a,d(n))}function x(a,n){return a"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");$=crypto.getRandomValues.bind(crypto)}return $(me)}const _e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ie={randomUUID:_e};function be(e,r,i){if(ie.randomUUID&&!e)return ie.randomUUID();e=e||{};const l=e.random??e.rng?.()??Ee();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,ye(l)}var W=(function(){var e=c(function(L,n,t,o){for(t=t||{},o=L.length;o--;t[L[o]]=n);return t},"o"),r=[1,4],i=[1,13],l=[1,12],p=[1,15],h=[1,16],f=[1,20],E=[1,19],u=[6,7,8],z=[1,26],X=[1,24],Y=[1,25],b=[6,7,11],q=[1,6,13,15,16,19,22],J=[1,33],K=[1,34],I=[1,6,7,11,13,15,16,19,22],M={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:c(function(n,t,o,a,g,s,C){var d=s.length-1;switch(g){case 6:case 7:return a;case 8:a.getLogger().trace("Stop NL ");break;case 9:a.getLogger().trace("Stop EOF ");break;case 11:a.getLogger().trace("Stop NL2 ");break;case 12:a.getLogger().trace("Stop EOF2 ");break;case 15:a.getLogger().info("Node: ",s[d].id),a.addNode(s[d-1].length,s[d].id,s[d].descr,s[d].type);break;case 16:a.getLogger().trace("Icon: ",s[d]),a.decorateNode({icon:s[d]});break;case 17:case 21:a.decorateNode({class:s[d]});break;case 18:a.getLogger().trace("SPACELIST");break;case 19:a.getLogger().trace("Node: ",s[d].id),a.addNode(0,s[d].id,s[d].descr,s[d].type);break;case 20:a.decorateNode({icon:s[d]});break;case 25:a.getLogger().trace("node found ..",s[d-2]),this.$={id:s[d-1],descr:s[d-1],type:a.getType(s[d-2],s[d])};break;case 26:this.$={id:s[d],descr:s[d],type:a.nodeType.DEFAULT};break;case 27:a.getLogger().trace("node found ..",s[d-3]),this.$={id:s[d-3],descr:s[d-1],type:a.getType(s[d-2],s[d])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:r},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:r},{6:i,7:[1,10],9:9,12:11,13:l,14:14,15:p,16:h,17:17,18:18,19:f,22:E},e(u,[2,3]),{1:[2,2]},e(u,[2,4]),e(u,[2,5]),{1:[2,6],6:i,12:21,13:l,14:14,15:p,16:h,17:17,18:18,19:f,22:E},{6:i,9:22,12:11,13:l,14:14,15:p,16:h,17:17,18:18,19:f,22:E},{6:z,7:X,10:23,11:Y},e(b,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:f,22:E}),e(b,[2,18]),e(b,[2,19]),e(b,[2,20]),e(b,[2,21]),e(b,[2,23]),e(b,[2,24]),e(b,[2,26],{19:[1,30]}),{20:[1,31]},{6:z,7:X,10:32,11:Y},{1:[2,7],6:i,12:21,13:l,14:14,15:p,16:h,17:17,18:18,19:f,22:E},e(q,[2,14],{7:J,11:K}),e(I,[2,8]),e(I,[2,9]),e(I,[2,10]),e(b,[2,15]),e(b,[2,16]),e(b,[2,17]),{20:[1,35]},{21:[1,36]},e(q,[2,13],{7:J,11:K}),e(I,[2,11]),e(I,[2,12]),{21:[1,37]},e(b,[2,25]),e(b,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(n,t){if(t.recoverable)this.trace(n);else{var o=new Error(n);throw o.hash=t,o}},"parseError"),parse:c(function(n){var t=this,o=[0],a=[],g=[null],s=[],C=this.table,d="",w=0,Q=0,se=2,Z=1,re=s.slice.call(arguments,1),y=Object.create(this.lexer),x={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(x.yy[F]=this.yy[F]);y.setInput(n,x.yy),x.yy.lexer=y,x.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var B=y.yylloc;s.push(B);var oe=y.options&&y.options.ranges;typeof x.yy.parseError=="function"?this.parseError=x.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ae(S){o.length=o.length-2*S,g.length=g.length-S,s.length=s.length-S}c(ae,"popStack");function ee(){var S;return S=a.pop()||y.lex()||Z,typeof S!="number"&&(S instanceof Array&&(a=S,S=a.pop()),S=t.symbols_[S]||S),S}c(ee,"lex");for(var _,v,D,j,T={},A,N,te,U;;){if(v=o[o.length-1],this.defaultActions[v]?D=this.defaultActions[v]:((_===null||typeof _>"u")&&(_=ee()),D=C[v]&&C[v][_]),typeof D>"u"||!D.length||!D[0]){var G="";U=[];for(A in C[v])this.terminals_[A]&&A>se&&U.push("'"+this.terminals_[A]+"'");y.showPosition?G="Parse error on line "+(w+1)+`: +`+y.showPosition()+` +Expecting `+U.join(", ")+", got '"+(this.terminals_[_]||_)+"'":G="Parse error on line "+(w+1)+": Unexpected "+(_==Z?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(G,{text:y.match,token:this.terminals_[_]||_,line:y.yylineno,loc:B,expected:U})}if(D[0]instanceof Array&&D.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+_);switch(D[0]){case 1:o.push(_),g.push(y.yytext),s.push(y.yylloc),o.push(D[1]),_=null,Q=y.yyleng,d=y.yytext,w=y.yylineno,B=y.yylloc;break;case 2:if(N=this.productions_[D[1]][1],T.$=g[g.length-N],T._$={first_line:s[s.length-(N||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(N||1)].first_column,last_column:s[s.length-1].last_column},oe&&(T._$.range=[s[s.length-(N||1)].range[0],s[s.length-1].range[1]]),j=this.performAction.apply(T,[d,Q,w,x.yy,D[1],g,s].concat(re)),typeof j<"u")return j;N&&(o=o.slice(0,-1*N*2),g=g.slice(0,-1*N),s=s.slice(0,-1*N)),o.push(this.productions_[D[1]][0]),g.push(T.$),s.push(T._$),te=C[o[o.length-2]][o[o.length-1]],o.push(te);break;case 3:return!0}}return!0},"parse")},ne=(function(){var L={EOF:1,parseError:c(function(t,o){if(this.yy.parser)this.yy.parser.parseError(t,o);else throw new Error(t)},"parseError"),setInput:c(function(n,t){return this.yy=t||this.yy||{},this._input=n,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var n=this._input[0];this.yytext+=n,this.yyleng++,this.offset++,this.match+=n,this.matched+=n;var t=n.match(/(?:\r\n?|\n).*/g);return t?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),n},"input"),unput:c(function(n){var t=n.length,o=n.split(/(?:\r\n?|\n)/g);this._input=n+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var a=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var g=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===a.length?this.yylloc.first_column:0)+a[a.length-o.length].length-o[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[g[0],g[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(n){this.unput(this.match.slice(n))},"less"),pastInput:c(function(){var n=this.matched.substr(0,this.matched.length-this.match.length);return(n.length>20?"...":"")+n.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var n=this.match;return n.length<20&&(n+=this._input.substr(0,20-n.length)),(n.substr(0,20)+(n.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var n=this.pastInput(),t=new Array(n.length+1).join("-");return n+this.upcomingInput()+` +`+t+"^"},"showPosition"),test_match:c(function(n,t){var o,a,g;if(this.options.backtrack_lexer&&(g={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(g.yylloc.range=this.yylloc.range.slice(0))),a=n[0].match(/(?:\r\n?|\n).*/g),a&&(this.yylineno+=a.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:a?a[a.length-1].length-a[a.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+n[0].length},this.yytext+=n[0],this.match+=n[0],this.matches=n,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(n[0].length),this.matched+=n[0],o=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),o)return o;if(this._backtrack){for(var s in g)this[s]=g[s];return!1}return!1},"test_match"),next:c(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var n,t,o,a;this._more||(this.yytext="",this.match="");for(var g=this._currentRules(),s=0;st[0].length)){if(t=o,a=s,this.options.backtrack_lexer){if(n=this.test_match(o,g[s]),n!==!1)return n;if(this._backtrack){t=!1;continue}else return!1}else if(!this.options.flex)break}return t?(n=this.test_match(t,g[a]),n!==!1?n:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:c(function(){var t=this.next();return t||this.lex()},"lex"),begin:c(function(t){this.conditionStack.push(t)},"begin"),popState:c(function(){var t=this.conditionStack.length-1;return t>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:c(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:c(function(t){return t=this.conditionStack.length-1-Math.abs(t||0),t>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:c(function(t){this.begin(t)},"pushState"),stateStackSize:c(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:c(function(t,o,a,g){switch(a){case 0:return t.getLogger().trace("Found comment",o.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:t.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return t.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:t.getLogger().trace("end icon"),this.popState();break;case 10:return t.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return t.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return t.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return t.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:t.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return t.getLogger().trace("description:",o.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),t.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),t.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),t.getLogger().trace("node end ...",o.yytext),"NODE_DEND";case 30:return this.popState(),t.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),t.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),t.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),t.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),t.getLogger().trace("node end (("),"NODE_DEND";case 35:return t.getLogger().trace("Long description:",o.yytext),20;case 36:return t.getLogger().trace("Long description:",o.yytext),20}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return L})();M.lexer=ne;function R(){this.yy={}}return c(R,"Parser"),R.prototype=M,M.Parser=R,new R})();W.parser=W;var Se=W,k={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},De=class{constructor(){this.nodes=[],this.count=0,this.elements={},this.getLogger=this.getLogger.bind(this),this.nodeType=k,this.clear(),this.getType=this.getType.bind(this),this.getElementById=this.getElementById.bind(this),this.getParent=this.getParent.bind(this),this.getMindmap=this.getMindmap.bind(this),this.addNode=this.addNode.bind(this),this.decorateNode=this.decorateNode.bind(this)}static{c(this,"MindmapDB")}clear(){this.nodes=[],this.count=0,this.elements={},this.baseLevel=void 0}getParent(e){for(let r=this.nodes.length-1;r>=0;r--)if(this.nodes[r].level0?this.nodes[0]:null}addNode(e,r,i,l){O.info("addNode",e,r,i,l);let p=!1;this.nodes.length===0?(this.baseLevel=e,e=0,p=!0):this.baseLevel!==void 0&&(e=e-this.baseLevel,p=!1);const h=H();let f=h.mindmap?.padding??V.mindmap.padding;switch(l){case this.nodeType.ROUNDED_RECT:case this.nodeType.RECT:case this.nodeType.HEXAGON:f*=2;break}const E={id:this.count++,nodeId:P(r,h),level:e,descr:P(i,h),type:l,children:[],width:h.mindmap?.maxNodeWidth??V.mindmap.maxNodeWidth,padding:f,isRoot:p},u=this.getParent(e);if(u)u.children.push(E),this.nodes.push(E);else if(p)this.nodes.push(E);else throw new Error(`There can be only one root. No parent could be found for ("${E.descr}")`)}getType(e,r){switch(O.debug("In get type",e,r),e){case"[":return this.nodeType.RECT;case"(":return r===")"?this.nodeType.ROUNDED_RECT:this.nodeType.CLOUD;case"((":return this.nodeType.CIRCLE;case")":return this.nodeType.CLOUD;case"))":return this.nodeType.BANG;case"{{":return this.nodeType.HEXAGON;default:return this.nodeType.DEFAULT}}setElementForId(e,r){this.elements[e]=r}getElementById(e){return this.elements[e]}decorateNode(e){if(!e)return;const r=H(),i=this.nodes[this.nodes.length-1];e.icon&&(i.icon=P(e.icon,r)),e.class&&(i.class=P(e.class,r))}type2Str(e){switch(e){case this.nodeType.DEFAULT:return"no-border";case this.nodeType.RECT:return"rect";case this.nodeType.ROUNDED_RECT:return"rounded-rect";case this.nodeType.CIRCLE:return"circle";case this.nodeType.CLOUD:return"cloud";case this.nodeType.BANG:return"bang";case this.nodeType.HEXAGON:return"hexgon";default:return"no-border"}}assignSections(e,r){if(e.level===0?e.section=void 0:e.section=r,e.children)for(const[i,l]of e.children.entries()){const p=e.level===0?i:r;this.assignSections(l,p)}}flattenNodes(e,r){const i=["mindmap-node"];e.isRoot===!0?i.push("section-root","section--1"):e.section!==void 0&&i.push(`section-${e.section}`),e.class&&i.push(e.class);const l=i.join(" "),p=c(f=>{switch(f){case k.CIRCLE:return"mindmapCircle";case k.RECT:return"rect";case k.ROUNDED_RECT:return"rounded";case k.CLOUD:return"cloud";case k.BANG:return"bang";case k.HEXAGON:return"hexagon";case k.DEFAULT:return"defaultMindmapNode";case k.NO_BORDER:default:return"rect"}},"getShapeFromType"),h={id:e.id.toString(),domId:"node_"+e.id.toString(),label:e.descr,isGroup:!1,shape:p(e.type),width:e.width,height:e.height??0,padding:e.padding,cssClasses:l,cssStyles:[],look:"default",icon:e.icon,x:e.x,y:e.y,level:e.level,nodeId:e.nodeId,type:e.type,section:e.section};if(r.push(h),e.children)for(const f of e.children)this.flattenNodes(f,r)}generateEdges(e,r){if(e.children)for(const i of e.children){let l="edge";i.section!==void 0&&(l+=` section-edge-${i.section}`);const p=e.level+1;l+=` edge-depth-${p}`;const h={id:`edge_${e.id}_${i.id}`,start:e.id.toString(),end:i.id.toString(),type:"normal",curve:"basis",thickness:"normal",look:"default",classes:l,depth:e.level,section:i.section};r.push(h),this.generateEdges(i,r)}}getData(){const e=this.getMindmap(),r=H(),l=ge().layout!==void 0,p=r;if(l||(p.layout="cose-bilkent"),!e)return{nodes:[],edges:[],config:p};O.debug("getData: mindmapRoot",e,r),this.assignSections(e);const h=[],f=[];this.flattenNodes(e,h),this.generateEdges(e,f),O.debug(`getData: processed ${h.length} nodes and ${f.length} edges`);const E=new Map;for(const u of h)E.set(u.id,{shape:u.shape,width:u.width,height:u.height,padding:u.padding});return{nodes:h,edges:f,config:p,rootNode:e,markers:["point"],direction:"TB",nodeSpacing:50,rankSpacing:50,shapes:Object.fromEntries(E),type:"mindmap",diagramId:"mindmap-"+be()}}getLogger(){return O}},Ne=c(async(e,r,i,l)=>{O.debug(`Rendering mindmap diagram +`+e);const p=l.db,h=p.getData(),f=ce(r,h.config.securityLevel);h.type=l.type,h.layoutAlgorithm=he(h.config.layout,{fallback:"cose-bilkent"}),h.diagramId=r,p.getMindmap()&&(h.nodes.forEach(u=>{u.shape==="rounded"?(u.radius=15,u.taper=15,u.stroke="none",u.width=0,u.padding=15):u.shape==="circle"?u.padding=10:u.shape==="rect"&&(u.width=0,u.padding=10)}),await de(h,f),le(f,h.config.mindmap?.padding??V.mindmap.padding,"mindmapDiagram",h.config.mindmap?.useMaxWidth??V.mindmap.useMaxWidth))},"draw"),ke={draw:Ne},Le=c(e=>{let r="";for(let i=0;i` + .edge { + stroke-width: 3; + } + ${Le(e)} + .section-root rect, .section-root path, .section-root circle, .section-root polygon { + fill: ${e.git0}; + } + .section-root text { + fill: ${e.gitBranchLabel0}; + } + .section-root span { + color: ${e.gitBranchLabel0}; + } + .section-2 span { + color: ${e.gitBranchLabel0}; + } + .icon-container { + height:100%; + display: flex; + justify-content: center; + align-items: center; + } + .edge { + fill: none; + } + .mindmap-node-label { + dy: 1em; + alignment-baseline: middle; + text-anchor: middle; + dominant-baseline: middle; + text-align: center; + } +`,"getStyles"),ve=xe,Pe={get db(){return new De},renderer:ke,parser:Se,styles:ve};export{Pe as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/misc-vsnLZ-Y1.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/misc-vsnLZ-Y1.js new file mode 100644 index 0000000000000000000000000000000000000000..a52681f1797ee9d03b824100b6bf13df7b205b5b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/misc-vsnLZ-Y1.js @@ -0,0 +1 @@ +import{$ as t}from"./index-DWyDLubb.js";function b(e,r){var a=e.$$events?.[r.type],l=t(a)?a.slice():a==null?[]:[a];for(var s of l)s.call(this,r)}export{b}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/module-B5lWqP2v.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/module-B5lWqP2v.js new file mode 100644 index 0000000000000000000000000000000000000000..104141379eb272fc33cc3dc91c651a7999cbc774 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/module-B5lWqP2v.js @@ -0,0 +1 @@ +import{c as a}from"./module-DoWOc2fJ.js";const i=a({characterize:({call:e})=>()=>e("characterize"),encode:({call:e})=>(t,r)=>e("encode",{recordingId:t,timeslice:r}),record:({call:e})=>async(t,r,o)=>{await e("record",{recordingId:t,sampleRate:r,typedArrays:o},o.map(({buffer:n})=>n).filter(n=>n instanceof ArrayBuffer))}}),u=e=>{const t=new Worker(e);return i(t)},c=`(()=>{var e={775:function(e,t,r){!function(e,t,r,n){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(t),a=o(r),i=o(n),u=function(e,t){return void 0===t?e:t.reduce((function(e,t){if("capitalize"===t){var r=e.charAt(0).toUpperCase(),n=e.slice(1);return"".concat(r).concat(n)}return"dashify"===t?a.default(e):"prependIndefiniteArticle"===t?"".concat(i.default(e)," ").concat(e):e}),e)},c=function(e){var t=e.name+e.modifiers.map((function(e){return"\\\\.".concat(e,"\\\\(\\\\)")})).join("");return new RegExp("\\\\$\\\\{".concat(t,"}"),"g")},l=function(e,t){for(var r=/\\\${([^.}]+)((\\.[^(]+\\(\\))*)}/g,n=[],o=r.exec(e);null!==o;){var a={modifiers:[],name:o[1]};if(void 0!==o[3])for(var i=/\\.[^(]+\\(\\)/g,l=i.exec(o[2]);null!==l;)a.modifiers.push(l[0].slice(1,-2)),l=i.exec(o[2]);n.push(a),o=r.exec(e)}var d=n.reduce((function(e,r){return e.map((function(e){return"string"==typeof e?e.split(c(r)).reduce((function(e,n,o){return 0===o?[n]:r.name in t?[].concat(s.default(e),[u(t[r.name],r.modifiers),n]):[].concat(s.default(e),[function(e){return u(e[r.name],r.modifiers)},n])}),[]):[e]})).reduce((function(e,t){return[].concat(s.default(e),s.default(t))}),[])}),[e]);return function(e){return d.reduce((function(t,r){return[].concat(s.default(t),"string"==typeof r?[r]:[r(e)])}),[]).join("")}},d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=void 0===e.code?void 0:l(e.code,t),n=void 0===e.message?void 0:l(e.message,t);function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0,s=void 0===o&&(t instanceof Error||void 0!==t.code&&"Exception"===t.code.slice(-9))?{cause:t,missingParameters:{}}:{cause:o,missingParameters:t},a=s.cause,i=s.missingParameters,u=void 0===n?new Error:new Error(n(i));return null!==a&&(u.cause=a),void 0!==r&&(u.code=r(i)),void 0!==e.status&&(u.status=e.status),u}return o};e.compile=d,Object.defineProperty(e,"__esModule",{value:!0})}(t,r(106),r(881),r(507))},881:e=>{"use strict";e.exports=(e,t)=>{if("string"!=typeof e)throw new TypeError("expected a string");return e.trim().replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\\W/g,(e=>/[À-ž]/.test(e)?e:"-")).replace(/^-+|-+$/g,"").replace(/-{2,}/g,(e=>t&&t.condense?"-":e)).toLowerCase()}},107:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:an)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),l=t(c);e.addUniqueNumber=l,e.generateUniqueNumber=c,Object.defineProperty(e,"__esModule",{value:!0})}(t)},507:e=>{var t=function(e){var t,r,n=/\\w+/.exec(e);if(!n)return"an";var o=(r=n[0]).toLowerCase(),s=["honest","hour","hono"];for(t in s)if(0==o.indexOf(s[t]))return"an";if(1==o.length)return"aedhilmnorsx".indexOf(o)>=0?"an":"a";if(r.match(/(?!FJO|[HLMNS]Y.|RY[EO]|SQU|(F[LR]?|[HL]|MN?|N|RH?|S[CHKLMNPTVW]?|X(YL)?)[AEIOU])[FHLMNRSX][A-Z]/))return"an";var a=[/^e[uw]/,/^onc?e\\b/,/^uni([^nmd]|mo)/,/^u[bcfhjkqrst][aeiou]/];for(t=0;t=0?"an":"a":"aeiou".indexOf(o[0])>=0||o.match(/^y(b[lor]|cl[ea]|fere|gg|p[ios]|rou|tt)/)?"an":"a"};void 0!==e.exports?e.exports=t:window.indefiniteArticle=t},768:e=>{e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r{var n=r(768);e.exports=function(e){if(Array.isArray(e))return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports},642:e=>{e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},344:e=>{e.exports=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.")},e.exports.__esModule=!0,e.exports.default=e.exports},106:(e,t,r)=>{var n=r(907),o=r(642),s=r(906),a=r(344);e.exports=function(e){return n(e)||o(e)||s(e)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},906:(e,t,r)=>{var n=r(768);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";var e=r(775);const t=-32603,n=-32602,o=-32601,s=(0,e.compile)({message:'The requested method called "\${method}" is not supported.',status:o}),a=(0,e.compile)({message:'The handler of the method called "\${method}" returned no required result.',status:t}),i=(0,e.compile)({message:'The handler of the method called "\${method}" returned an unexpected result.',status:t}),u=(0,e.compile)({message:'The specified parameter called "portId" with the given value "\${portId}" does not identify a port connected to this worker.',status:n}),c=(e,t)=>async r=>{let{data:{id:n,method:o,params:u}}=r;const c=t[o];try{if(void 0===c)throw s({method:o});const t=void 0===u?c():c(u);if(void 0===t)throw a({method:o});const r=t instanceof Promise?await t:t;if(null===n){if(void 0!==r.result)throw i({method:o})}else{if(void 0===r.result)throw i({method:o});const{result:t,transferables:s=[]}=r;e.postMessage({id:n,result:t},s)}}catch(t){const{message:r,status:o=-32603}=t;e.postMessage({error:{code:o,message:r},id:n})}};var l=r(107);const d=new Map,f=(e,t,r)=>({...t,connect:r=>{let{port:n}=r;n.start();const o=e(n,t),s=(0,l.generateUniqueNumber)(d);return d.set(s,(()=>{o(),n.close(),d.delete(s)})),{result:s}},disconnect:e=>{let{portId:t}=e;const r=d.get(t);if(void 0===r)throw u({portId:t.toString()});return r(),{result:null}},isSupported:async()=>{if(await new Promise((e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=t=>{let{data:r}=t;return e(null!==r)},n.postMessage(t,[t])}))){const e=r();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),p=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;const n=f(p,t,r),o=c(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},m=e=>e.reduce(((e,t)=>e+t.length),0),h=(e,t)=>{const r=[];let n=0;e:for(;nt){const o=n-t;r.forEach(((t,r)=>{const n=t.pop(),s=n.length-o;t.push(n.subarray(0,s)),e[r].unshift(n.subarray(s))}))}return r},v=new Map,g=(e=>(t,r,n)=>{const o=e.get(t);if(void 0===o){const o={channelDataArrays:n.map((e=>[e])),isComplete:!0,sampleRate:r};return e.set(t,o),o}return o.channelDataArrays.forEach(((e,t)=>e.push(n[t]))),o})(v),x=((e,t)=>(r,n,o,s)=>{const a=o>>3,i="subsequent"===n?0:44,u=r.length,c=e(r[0]),l=new ArrayBuffer(c*u*a+i),d=new DataView(l);return"subsequent"!==n&&t(d,o,u,"complete"===n?c:Number.POSITIVE_INFINITY,s),r.forEach(((e,t)=>{let r=i+t*a;e.forEach((e=>{const t=e.length;for(let n=0;n{const s=t>>3,a=Math.min(n*r*s,4294967251);e.setUint32(0,1380533830),e.setUint32(4,a+36,!0),e.setUint32(8,1463899717),e.setUint32(12,1718449184),e.setUint32(16,16,!0),e.setUint16(20,1,!0),e.setUint16(22,r,!0),e.setUint32(24,o,!0),e.setUint32(28,o*r*s,!0),e.setUint16(32,r*s,!0),e.setUint16(34,t,!0),e.setUint32(36,1684108385),e.setUint32(40,a,!0)})),w=new Map;p(self,{characterize:()=>({result:/^audio\\/wav$/}),encode:e=>{let{recordingId:t,timeslice:r}=e;const n=w.get(t);void 0!==n&&(w.delete(t),n.reject(new Error("Another request was made to initiate an encoding.")));const o=v.get(t);if(null!==r){if(void 0===o||m(o.channelDataArrays[0])*(1e3/o.sampleRate){w.set(t,{reject:n,resolve:e,timeslice:r})}));const e=h(o.channelDataArrays,Math.ceil(r*(o.sampleRate/1e3))),n=x(e,o.isComplete?"initial":"subsequent",16,o.sampleRate);return o.isComplete=!1,{result:n,transferables:n}}if(void 0!==o){const e=x(o.channelDataArrays,o.isComplete?"complete":"subsequent",16,o.sampleRate);return v.delete(t),{result:e,transferables:e}}return{result:[],transferables:[]}},record:e=>{let{recordingId:t,sampleRate:r,typedArrays:n}=e;const o=g(t,r,n),s=w.get(t);if(void 0!==s&&m(o.channelDataArrays[0])*(1e3/r)>=s.timeslice){const e=h(o.channelDataArrays,Math.ceil(s.timeslice*(r/1e3))),n=x(e,o.isComplete?"initial":"subsequent",16,r);o.isComplete=!1,w.delete(t),s.resolve({result:n,transferables:n})}return{result:null}}})})()})();`,l=new Blob([c],{type:"application/javascript; charset=utf-8"}),s=URL.createObjectURL(l),d=u(s),p=d.connect;URL.revokeObjectURL(s);export{p as connect}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/module-C85Cvh0Z.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/module-C85Cvh0Z.js new file mode 100644 index 0000000000000000000000000000000000000000..31a608de6b977ead25f8ef44f04583c5830031b3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/module-C85Cvh0Z.js @@ -0,0 +1,3 @@ +import{c as zn,a as Xn,g as Yn}from"./module-DoWOc2fJ.js";const Mt=new Set,Hn=zn({deregister:({call:e})=>t=>e("deregister",{port:t},[t]),encode:({call:e})=>async(t,n)=>{const r=await e("encode",{encoderId:t,timeslice:n});return Mt.delete(t),r},instantiate:({call:e})=>async(t,n)=>{const r=Xn(Mt),o=await e("instantiate",{encoderId:r,mimeType:t,sampleRate:n});return{encoderId:r,port:o}},register:({call:e})=>t=>e("register",{port:t},[t])}),Zn=e=>{const t=new Worker(e);return Hn(t)},Kn=`(()=>{var e={455:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:an)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,c=r(i),l=a(c,i),d=t(l);e.addUniqueNumber=d,e.generateUniqueNumber=l}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";var e=r(455);const t=new WeakMap,n=new WeakMap,o=(r=>{const o=(s=r,{...s,connect:e=>{let{call:r}=e;return async()=>{const{port1:e,port2:n}=new MessageChannel,o=await r("connect",{port:e},[e]);return t.set(n,o),n}},disconnect:e=>{let{call:r}=e;return async e=>{const n=t.get(e);if(void 0===n)throw new Error("The given port is not connected.");await r("disconnect",{portId:n})}},isSupported:e=>{let{call:t}=e;return()=>t("isSupported")}});var s;return t=>{const r=(e=>{if(n.has(e))return n.get(e);const t=new Map;return n.set(e,t),t})(t);t.addEventListener("message",(e=>{let{data:t}=e;const{id:n}=t;if(null!==n&&r.has(n)){const{reject:e,resolve:o}=r.get(n);r.delete(n),void 0===t.error?o(t.result):e(new Error(t.error.message))}})),(e=>"function"==typeof e.start)(t)&&t.start();const s=function(n){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return new Promise(((a,i)=>{const c=(0,e.generateUniqueNumber)(r);r.set(c,{reject:i,resolve:a}),null===o?t.postMessage({id:c,method:n},s):t.postMessage({id:c,method:n,params:o},s)}))},a=function(e,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];t.postMessage({id:null,method:e,params:r},n)};let i={};for(const[e,t]of Object.entries(o))i={...i,[e]:t({call:s,notify:a})};return{...i}}})({characterize:e=>{let{call:t}=e;return()=>t("characterize")},encode:e=>{let{call:t}=e;return(e,r)=>t("encode",{recordingId:e,timeslice:r})},record:e=>{let{call:t}=e;return async(e,r,n)=>{await t("record",{recordingId:e,sampleRate:r,typedArrays:n},n.map((e=>{let{buffer:t}=e;return t})))}}}),s=-32603,a=-32602,i=-32601,c=(e,t)=>Object.assign(new Error(e),{status:t}),l=e=>c('The handler of the method called "'.concat(e,'" returned an unexpected result.'),s),d=(e,t)=>async r=>{let{data:{id:n,method:o,params:a}}=r;const d=t[o];try{if(void 0===d)throw(e=>c('The requested method called "'.concat(e,'" is not supported.'),i))(o);const t=void 0===a?d():d(a);if(void 0===t)throw(e=>c('The handler of the method called "'.concat(e,'" returned no required result.'),s))(o);const r=t instanceof Promise?await t:t;if(null===n){if(void 0!==r.result)throw l(o)}else{if(void 0===r.result)throw l(o);const{result:t,transferables:s=[]}=r;e.postMessage({id:n,result:t},s)}}catch(t){const{message:r,status:o=-32603}=t;e.postMessage({error:{code:o,message:r},id:n})}},u=new Map,h=(t,r,n)=>({...r,connect:n=>{let{port:o}=n;o.start();const s=t(o,r),a=(0,e.generateUniqueNumber)(u);return u.set(a,(()=>{s(),o.close(),u.delete(a)})),{result:a}},disconnect:e=>{let{portId:t}=e;const r=u.get(t);if(void 0===r)throw(e=>c('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),a))(t);return r(),{result:null}},isSupported:async()=>{if(await new Promise((e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=t=>{let{data:r}=t;return e(null!==r)},n.postMessage(t,[t])}))){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),f=function(e,t){const r=h(f,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0),n=d(e,r);return e.addEventListener("message",n),()=>e.removeEventListener("message",n)},p=e=>{e.onmessage=null,e.close()},w=new Map,m=new WeakMap,g=((e,t)=>r=>{const n=t.get(r);if(void 0===n)throw new Error("There is no encoder stored which wraps this port.");e.delete(n),t.delete(r)})(w,m),v=new Map,y=(e=>t=>{const r=e.get(t);if(void 0===r)throw new Error("There was no instance of an encoder stored with the given id.");return r})(v),M=((e,t)=>r=>{const n=t(r);return e.delete(r),n})(v,y),E=((e,t)=>r=>{const[n,o,s,a]=t(r);return s?new Promise((t=>{o.onmessage=s=>{let{data:i}=s;0===i.length?(e(o),t(n.encode(r,null))):n.record(r,a,i)}})):n.encode(r,null)})(p,M),b=(e=>t=>{for(const[r,n]of Array.from(e.values()))if(r.test(t))return n;throw new Error("There is no encoder registered which could handle the given mimeType.")})(w),T=((e,t,r)=>(n,o,s)=>{if(t.has(n))throw new Error('There is already an encoder registered with an id called "'.concat(n,'".'));const a=r(o),{port1:i,port2:c}=new MessageChannel,l=[a,i,!0,s];return t.set(n,l),i.onmessage=t=>{let{data:r}=t;0===r.length?(e(i),l[2]=!1):a.record(n,s,r.map((e=>"number"==typeof e?new Float32Array(e):e)))},c})(p,v,b),I=((e,t,r)=>async n=>{const o=r(n),s=await o.characterize(),a=s.toString();if(e.has(a)||t.has(n))throw new Error("There is already an encoder stored which handles exactly the same mime types.");return e.set(a,[s,o]),t.set(n,a),s})(w,m,o),A=(e=>(t,r)=>{const[n]=e(t);return n.encode(t,r)})(y);f(self,{deregister:async e=>{let{port:t}=e;return{result:g(t)}},encode:async e=>{let{encoderId:t,timeslice:r}=e;const n=null===r?await E(t):await A(t,r);return{result:n,transferables:n}},instantiate:e=>{let{encoderId:t,mimeType:r,sampleRate:n}=e;const o=T(t,r,n);return{result:o,transferables:[o]}},register:async e=>{let{port:t}=e;return{result:await I(t)}}})})()})();`,Qn=new Blob([Kn],{type:"application/javascript; charset=utf-8"}),zt=URL.createObjectURL(Qn),it=Zn(zt),Se=it.encode,Xt=it.instantiate,Jn=it.register;URL.revokeObjectURL(zt);const er=e=>(t,n)=>{if(e===null)throw new Error("A native BlobEvent could not be created.");return new e(t,n)},tr=(e,t)=>(n,r,o)=>{const s=[];let a=r,c=0;for(;cclass{constructor(r=null){this._listeners=new WeakMap,this._nativeEventTarget=r===null?e():r}addEventListener(r,o,s){if(o!==null){let a=this._listeners.get(o);a===void 0&&(a=t(this,o),typeof o=="function"&&this._listeners.set(o,a)),this._nativeEventTarget.addEventListener(r,a,s)}}dispatchEvent(r){return this._nativeEventTarget.dispatchEvent(r)}removeEventListener(r,o,s){const a=o===null?void 0:this._listeners.get(o);this._nativeEventTarget.removeEventListener(r,a===void 0?null:a,s)}},rr=e=>()=>{if(e===null)throw new Error("A native EventTarget could not be created.");return e.document.createElement("p")},or=(e="")=>{try{return new DOMException(e,"InvalidModificationError")}catch(t){return t.code=13,t.message=e,t.name="InvalidModificationError",t}},sr=()=>{try{return new DOMException("","InvalidStateError")}catch(e){return e.code=11,e.name="InvalidStateError",e}},ar=(e,t,n,r,o,s,a)=>class extends s{constructor(i,u={}){const{mimeType:d}=u;if(a!==null&&(d===void 0||a.isTypeSupported!==void 0&&a.isTypeSupported(d))){const l=e(a,i,u);super(l),this._internalMediaRecorder=l}else if(d!==void 0&&o.some(l=>l.test(d)))super(),a!==null&&a.isTypeSupported!==void 0&&a.isTypeSupported("audio/webm;codecs=pcm")?this._internalMediaRecorder=r(this,a,i,d):this._internalMediaRecorder=n(this,i,d);else throw a!==null&&e(a,i,u),t();this._ondataavailable=null,this._onerror=null,this._onpause=null,this._onresume=null,this._onstart=null,this._onstop=null}get mimeType(){return this._internalMediaRecorder.mimeType}get ondataavailable(){return this._ondataavailable===null?this._ondataavailable:this._ondataavailable[0]}set ondataavailable(i){if(this._ondataavailable!==null&&this.removeEventListener("dataavailable",this._ondataavailable[1]),typeof i=="function"){const u=i.bind(this);this.addEventListener("dataavailable",u),this._ondataavailable=[i,u]}else this._ondataavailable=null}get onerror(){return this._onerror===null?this._onerror:this._onerror[0]}set onerror(i){if(this._onerror!==null&&this.removeEventListener("error",this._onerror[1]),typeof i=="function"){const u=i.bind(this);this.addEventListener("error",u),this._onerror=[i,u]}else this._onerror=null}get onpause(){return this._onpause===null?this._onpause:this._onpause[0]}set onpause(i){if(this._onpause!==null&&this.removeEventListener("pause",this._onpause[1]),typeof i=="function"){const u=i.bind(this);this.addEventListener("pause",u),this._onpause=[i,u]}else this._onpause=null}get onresume(){return this._onresume===null?this._onresume:this._onresume[0]}set onresume(i){if(this._onresume!==null&&this.removeEventListener("resume",this._onresume[1]),typeof i=="function"){const u=i.bind(this);this.addEventListener("resume",u),this._onresume=[i,u]}else this._onresume=null}get onstart(){return this._onstart===null?this._onstart:this._onstart[0]}set onstart(i){if(this._onstart!==null&&this.removeEventListener("start",this._onstart[1]),typeof i=="function"){const u=i.bind(this);this.addEventListener("start",u),this._onstart=[i,u]}else this._onstart=null}get onstop(){return this._onstop===null?this._onstop:this._onstop[0]}set onstop(i){if(this._onstop!==null&&this.removeEventListener("stop",this._onstop[1]),typeof i=="function"){const u=i.bind(this);this.addEventListener("stop",u),this._onstop=[i,u]}else this._onstop=null}get state(){return this._internalMediaRecorder.state}pause(){return this._internalMediaRecorder.pause()}resume(){return this._internalMediaRecorder.resume()}start(i){return this._internalMediaRecorder.start(i)}stop(){return this._internalMediaRecorder.stop()}static isTypeSupported(i){return a!==null&&a.isTypeSupported!==void 0&&a.isTypeSupported(i)||o.some(u=>u.test(i))}},ir=e=>e!==null&&e.BlobEvent!==void 0?e.BlobEvent:null,cr=(e,t,n)=>{const r=new Map,o=new WeakMap,s=new WeakMap,a=new e(t,n),c=new WeakMap;let i=!1;return a.addEventListener=(u=>(d,l,w)=>{let m=l;if(typeof l=="function")if(d==="dataavailable"){const h=[];m=f=>{i&&a.state==="inactive"?h.push(f):l.call(a,f)},r.set(l,h),o.set(l,m)}else d==="error"?(m=h=>{h instanceof ErrorEvent?l.call(a,h):l.call(a,new ErrorEvent("error",{error:h.error}))},s.set(l,m)):d==="stop"&&(m=h=>{for(const[f,g]of r.entries())if(g.length>0){const[p]=g;g.length>1&&Object.defineProperty(p,"data",{value:new Blob(g.map(({data:A})=>A),{type:p.data.type})}),g.length=0,f.call(a,p)}i=!1,l.call(a,h)},c.set(l,m));return u.call(a,d,m,w)})(a.addEventListener),a.removeEventListener=(u=>(d,l,w)=>{let m=l;if(typeof l=="function"){if(d==="dataavailable"){r.delete(l);const h=o.get(l);h!==void 0&&(m=h)}else if(d==="error"){const h=s.get(l);h!==void 0&&(m=h)}else if(d==="stop"){const h=c.get(l);h!==void 0&&(m=h)}}return u.call(a,d,m,w)})(a.removeEventListener),a.start=(u=>d=>(i=d!==void 0,d===void 0?u.call(a):u.call(a,d)))(a.start),a},ur=e=>e===null||e.MediaRecorder===void 0?null:e.MediaRecorder,Yt=()=>{try{return new DOMException("","NotSupportedError")}catch(e){return e.code=9,e.name="NotSupportedError",e}},lr=e=>(t,n,r,o=2)=>{const s=e(t,n);if(s===null)return s;const{length:a,value:c}=s;if(r==="master")return{content:null,length:a};if(n+a+c>t.byteLength)return null;if(r==="binary"){const i=(c/Float32Array.BYTES_PER_ELEMENT-1)/o,u=Array.from({length:o},()=>new Float32Array(i));for(let d=0;d(t,n)=>{const r=e(t,n);if(r===null)return r;const{length:o,value:s}=r;return s===35?{length:o,type:"binary"}:s===46||s===97||s===88713574||s===106212971||s===139690087||s===172351395||s===256095861?{length:o,type:"master"}:{length:o,type:"unknown"}},fr=e=>(t,n)=>{const r=e(t,n);if(r===null)return r;const o=n+Math.floor((r-1)/8);if(o+r>t.byteLength)return null;let a=t.getUint8(o)&(1<<8-r%8)-1;for(let c=1;c{},Ot=e=>{throw e};function pr(e){return e?e.next&&e.error&&e.complete?e:{complete:(e.complete??Ne).bind(e),error:(e.error??Ot).bind(e),next:(e.next??Ne).bind(e)}:{complete:Ne,error:Ot,next:Ne}}const mr=e=>(t,n,r)=>e(o=>{const s=a=>o.next(a);return t.addEventListener(n,s,r),()=>t.removeEventListener(n,s,r)}),gr=(e,t)=>{const n=()=>{},r=o=>typeof o[0]=="function";return o=>{const s=((...a)=>{const c=o(r(a)?t({next:a[0]}):t(...a));return c!==void 0?c:n});return s[Symbol.observable]=()=>({subscribe:(...a)=>({unsubscribe:s(...a)})}),e(s)}},wr=gr(hr,pr),Ht=mr(wr),vr=(e,t,n)=>async r=>{const o=new e([n],{type:"application/javascript; charset=utf-8"}),s=t.createObjectURL(o);try{await r(s)}finally{t.revokeObjectURL(s)}},_r=e=>({data:t})=>{const{id:n}=t;if(n!==null){const r=e.get(n);if(r!==void 0){const{reject:o,resolve:s}=r;e.delete(n),t.error===void 0?s(t.result):o(new Error(t.error.message))}}},yr=e=>(t,n)=>(r,o=[])=>new Promise((s,a)=>{const c=e(t);t.set(c,{reject:a,resolve:s}),n.postMessage({id:c,...r},o)}),Er=(e,t,n,r)=>(o,s,a={})=>{const c={channelCountMode:"explicit",numberOfInputs:1,numberOfOutputs:0},i=new o(s,"recorder-audio-worklet-processor",{...a,...c}),u=new Map,d=t(u,i.port),l=n(i.port,"message")(e(u));i.port.start();let w="inactive";return Object.defineProperties(i,{pause:{get(){return async()=>(r(["recording"],w),w="paused",d({method:"pause"}))}},port:{get(){throw new Error("The port of a RecorderAudioWorkletNode can't be accessed.")}},record:{get(){return async m=>(r(["inactive"],w),w="recording",d({method:"record",params:{encoderPort:m}},[m]))}},resume:{get(){return async()=>(r(["paused"],w),w="recording",d({method:"resume"}))}},stop:{get(){return async()=>{r(["paused","recording"],w),w="stopped";try{await d({method:"stop"})}finally{l()}}}}}),i},br=(e,t)=>{if(!e.includes(t))throw new Error(`Expected the state to be ${e.map(n=>`"${n}"`).join(" or ")} but it was "${t}".`)},Ar='(()=>{"use strict";class e extends AudioWorkletProcessor{constructor(){super(),this._encoderPort=null,this._numberOfChannels=0,this._state="inactive",this.port.onmessage=({data:e})=>{"pause"===e.method?"active"===this._state||"recording"===this._state?(this._state="paused",this._sendAcknowledgement(e.id)):this._sendUnexpectedStateError(e.id):"record"===e.method?"inactive"===this._state?(this._encoderPort=e.params.encoderPort,this._state="active",this._sendAcknowledgement(e.id)):this._sendUnexpectedStateError(e.id):"resume"===e.method?"paused"===this._state?(this._state="active",this._sendAcknowledgement(e.id)):this._sendUnexpectedStateError(e.id):"stop"===e.method?"active"!==this._state&&"paused"!==this._state&&"recording"!==this._state||null===this._encoderPort?this._sendUnexpectedStateError(e.id):(this._stop(this._encoderPort),this._sendAcknowledgement(e.id)):"number"==typeof e.id&&this.port.postMessage({error:{code:-32601,message:"The requested method is not supported."},id:e.id})}}process([e]){if("inactive"===this._state||"paused"===this._state)return!0;if("active"===this._state){if(void 0===e)throw new Error("No channelData was received for the first input.");if(0===e.length)return!0;this._state="recording"}if("recording"===this._state&&null!==this._encoderPort){if(void 0===e)throw new Error("No channelData was received for the first input.");return 0===e.length?this._encoderPort.postMessage(Array.from({length:this._numberOfChannels},()=>128)):(this._encoderPort.postMessage(e,e.map(({buffer:e})=>e)),this._numberOfChannels=e.length),!0}return!1}_sendAcknowledgement(e){this.port.postMessage({id:e,result:null})}_sendUnexpectedStateError(e){this.port.postMessage({error:{code:-32603,message:"The internal state does not allow to process the given message."},id:e})}_stop(e){e.postMessage([]),e.close(),this._encoderPort=null,this._state="stopped"}}e.parameterDescriptors=[],registerProcessor("recorder-audio-worklet-processor",e)})();',Cr=vr(Blob,URL,Ar),Tr=Er(_r,yr(Yn),Ht,br),kt=(e,t,n)=>({endTime:t,insertTime:n,type:"exponentialRampToValue",value:e}),It=(e,t,n)=>({endTime:t,insertTime:n,type:"linearRampToValue",value:e}),Ke=(e,t)=>({startTime:t,type:"setValue",value:e}),Zt=(e,t,n)=>({duration:n,startTime:t,type:"setValueCurve",values:e}),Kt=(e,t,{startTime:n,target:r,timeConstant:o})=>r+(t-r)*Math.exp((n-e)/o),me=e=>e.type==="exponentialRampToValue",Re=e=>e.type==="linearRampToValue",re=e=>me(e)||Re(e),ct=e=>e.type==="setValue",J=e=>e.type==="setValueCurve",Le=(e,t,n,r)=>{const o=e[t];return o===void 0?r:re(o)||ct(o)?o.value:J(o)?o.values[o.values.length-1]:Kt(n,Le(e,t-1,o.startTime,r),o)},St=(e,t,n,r,o)=>n===void 0?[r.insertTime,o]:re(n)?[n.endTime,n.value]:ct(n)?[n.startTime,n.value]:J(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,Le(e,t-1,n.startTime,o)],Qe=e=>e.type==="cancelAndHold",Je=e=>e.type==="cancelScheduledValues",ne=e=>Qe(e)||Je(e)?e.cancelTime:me(e)||Re(e)?e.endTime:e.startTime,Rt=(e,t,n,{endTime:r,value:o})=>n===o?o:0n+(e-t)/(r-t)*(o-n),Mr=(e,t)=>{const n=Math.floor(t),r=Math.ceil(t);return n===r?e[n]:(1-(t-n))*e[n]+(1-(r-t))*e[r]},Nr=(e,{duration:t,startTime:n,values:r})=>{const o=(e-n)/t*(r.length-1);return Mr(r,o)},Oe=e=>e.type==="setTarget";class Or{constructor(t){this._automationEvents=[],this._currenTime=0,this._defaultValue=t}[Symbol.iterator](){return this._automationEvents[Symbol.iterator]()}add(t){const n=ne(t);if(Qe(t)||Je(t)){const r=this._automationEvents.findIndex(s=>Je(t)&&J(s)?s.startTime+s.duration>=n:ne(s)>=n),o=this._automationEvents[r];if(r!==-1&&(this._automationEvents=this._automationEvents.slice(0,r)),Qe(t)){const s=this._automationEvents[this._automationEvents.length-1];if(o!==void 0&&re(o)){if(s!==void 0&&Oe(s))throw new Error("The internal list is malformed.");const a=s===void 0?o.insertTime:J(s)?s.startTime+s.duration:ne(s),c=s===void 0?this._defaultValue:J(s)?s.values[s.values.length-1]:s.value,i=me(o)?Rt(n,a,c,o):Lt(n,a,c,o),u=me(o)?kt(i,n,this._currenTime):It(i,n,this._currenTime);this._automationEvents.push(u)}if(s!==void 0&&Oe(s)&&this._automationEvents.push(Ke(this.getValue(n),n)),s!==void 0&&J(s)&&s.startTime+s.duration>n){const a=n-s.startTime,c=(s.values.length-1)/s.duration,i=Math.max(2,1+Math.ceil(a*c)),u=a/(i-1)*c,d=s.values.slice(0,i);if(u<1)for(let l=1;lne(a)>n),o=r===-1?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[r-1];if(o!==void 0&&J(o)&&ne(o)+o.duration>n)return!1;const s=me(t)?kt(t.value,t.endTime,this._currenTime):Re(t)?It(t.value,n,this._currenTime):t;if(r===-1)this._automationEvents.push(s);else{if(J(t)&&n+t.duration>ne(this._automationEvents[r]))return!1;this._automationEvents.splice(r,0,s)}}return!0}flush(t){const n=this._automationEvents.findIndex(r=>ne(r)>t);if(n>1){const r=this._automationEvents.slice(n-1),o=r[0];Oe(o)&&r.unshift(Ke(Le(this._automationEvents,n-2,o.startTime,this._defaultValue),o.startTime)),this._automationEvents=r}}getValue(t){if(this._automationEvents.length===0)return this._defaultValue;const n=this._automationEvents.findIndex(a=>ne(a)>t),r=this._automationEvents[n],o=(n===-1?this._automationEvents.length:n)-1,s=this._automationEvents[o];if(s!==void 0&&Oe(s)&&(r===void 0||!re(r)||r.insertTime>t))return Kt(t,Le(this._automationEvents,o-1,s.startTime,this._defaultValue),s);if(s!==void 0&&ct(s)&&(r===void 0||!re(r)))return s.value;if(s!==void 0&&J(s)&&(r===void 0||!re(r)||s.startTime+s.duration>t))return t({cancelTime:e,type:"cancelAndHold"}),Ir=e=>({cancelTime:e,type:"cancelScheduledValues"}),Sr=(e,t)=>({endTime:t,type:"exponentialRampToValue",value:e}),Rr=(e,t)=>({endTime:t,type:"linearRampToValue",value:e}),Lr=(e,t,n)=>({startTime:t,target:e,timeConstant:n,type:"setTarget"}),Pr=()=>new DOMException("","AbortError"),Br=e=>(t,n,[r,o,s],a)=>{e(t[o],[n,r,s],c=>c[0]===n&&c[1]===r,a)},Ur=e=>(t,n,r)=>{const o=[];for(let s=0;s(t,n)=>{e.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:n})},ge=new WeakSet,Qt=new WeakMap,Jt=new WeakMap,en=new WeakMap,tn=new WeakMap,nn=new WeakMap,rn=new WeakMap,et=new WeakMap,tt=new WeakMap,nt=new WeakMap,on={construct(){return on}},Wr=e=>{try{const t=new Proxy(e,on);new t}catch{return!1}return!0},Pt=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,Bt=(e,t)=>{const n=[];let r=e.replace(/^[\s]+/,""),o=r.match(Pt);for(;o!==null;){const s=o[1].slice(1,-1),a=o[0].replace(/([\s]+)?;?$/,"").replace(s,new URL(s,t).toString());n.push(a),r=r.slice(o[0].length).replace(/^[\s]+/,""),o=r.match(Pt)}return[n.join(";"),r]},Ut=e=>{if(e!==void 0&&!Array.isArray(e))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},Dt=e=>{if(!Wr(e))throw new TypeError("The given value for processorCtor should be a constructor.");if(e.prototype===null||typeof e.prototype!="object")throw new TypeError("The given value for processorCtor should have a prototype.")},Vr=(e,t,n,r,o,s,a,c,i,u,d,l,w)=>{let m=0;return(h,f,g={credentials:"omit"})=>{const p=d.get(h);if(p!==void 0&&p.has(f))return Promise.resolve();const A=u.get(h);if(A!==void 0){const E=A.get(f);if(E!==void 0)return E}const _=s(h),T=_.audioWorklet===void 0?o(f).then(([E,b])=>{const[y,v]=Bt(E,b),N=`${y};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${v} +})})(window,'_AWGS')`;return n(N)}).then(()=>{const E=w._AWGS.pop();if(E===void 0)throw new SyntaxError;r(_.currentTime,_.sampleRate,()=>E(class{},void 0,(b,y)=>{if(b.trim()==="")throw t();const v=tt.get(_);if(v!==void 0){if(v.has(b))throw t();Dt(y),Ut(y.parameterDescriptors),v.set(b,y)}else Dt(y),Ut(y.parameterDescriptors),tt.set(_,new Map([[b,y]]))},_.sampleRate,void 0,void 0))}):Promise.all([o(f),Promise.resolve(e(l,l))]).then(([[E,b],y])=>{const v=m+1;m=v;const[N,I]=Bt(E,b),W=`${N};((AudioWorkletProcessor,registerProcessor)=>{${I} +})(${y?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${y?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${y?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${v}',class extends AudioWorkletProcessor{process(){return !1}})`,B=new Blob([W],{type:"application/javascript; charset=utf-8"}),S=URL.createObjectURL(B);return _.audioWorklet.addModule(S,g).then(()=>{if(c(_))return _;const L=a(_);return L.audioWorklet.addModule(S,g).then(()=>L)}).then(L=>{if(i===null)throw new SyntaxError;try{new i(L,`__sac${v}`)}catch{throw new SyntaxError}}).finally(()=>URL.revokeObjectURL(S))});return A===void 0?u.set(h,new Map([[f,T]])):A.set(f,T),T.then(()=>{const E=d.get(h);E===void 0?d.set(h,new Set([f])):E.add(f)}).finally(()=>{const E=u.get(h);E!==void 0&&E.delete(f)}),T}},K=(e,t)=>{const n=e.get(t);if(n===void 0)throw new Error("A value with the given key could not be found.");return n},Ve=(e,t)=>{const n=Array.from(e).filter(t);if(n.length>1)throw Error("More than one element was found.");if(n.length===0)throw Error("No element was found.");const[r]=n;return e.delete(r),r},sn=(e,t,n,r)=>{const o=K(e,t),s=Ve(o,a=>a[0]===n&&a[1]===r);return o.size===0&&e.delete(t),s},be=e=>K(rn,e),Pe=e=>{if(ge.has(e))throw new Error("The AudioNode is already stored.");ge.add(e),be(e).forEach(t=>t(!0))},an=e=>"port"in e,ut=e=>{if(!ge.has(e))throw new Error("The AudioNode is not stored.");ge.delete(e),be(e).forEach(t=>t(!1))},rt=(e,t)=>{!an(e)&&t.every(n=>n.size===0)&&ut(e)},xr=(e,t,n,r,o,s,a,c,i,u,d,l,w)=>{const m=new WeakMap;return(h,f,g,p,A)=>{const{activeInputs:_,passiveInputs:T}=s(f),{outputs:E}=s(h),b=c(h),y=v=>{const N=i(f),I=i(h);if(v){const M=sn(T,h,g,p);e(_,h,M,!1),!A&&!l(h)&&n(I,N,g,p),w(f)&&Pe(f)}else{const M=r(_,h,g,p);t(T,p,M,!1),!A&&!l(h)&&o(I,N,g,p);const U=a(f);if(U===0)d(f)&&rt(f,_);else{const R=m.get(f);R!==void 0&&clearTimeout(R),m.set(f,setTimeout(()=>{d(f)&&rt(f,_)},U*1e3))}}};return u(E,[f,g,p],v=>v[0]===f&&v[1]===g&&v[2]===p,!0)?(b.add(y),d(h)?e(_,h,[g,p,y],!0):t(T,p,[h,g,y],!0),!0):!1}},Fr=e=>(t,n,[r,o,s],a)=>{const c=t.get(r);c===void 0?t.set(r,new Set([[o,n,s]])):e(c,[o,n,s],i=>i[0]===o&&i[1]===n,a)},jr=e=>(t,n)=>{const r=e(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});n.connect(r).connect(t.destination);const o=()=>{n.removeEventListener("ended",o),n.disconnect(r),r.disconnect()};n.addEventListener("ended",o)},Gr=e=>(t,n)=>{e(t).add(n)},cn=(e,t)=>e.context===t,Wt=e=>{try{e.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},ue=()=>new DOMException("","IndexSizeError"),$r=e=>{e.getChannelData=(t=>n=>{try{return t.call(e,n)}catch(r){throw r.code===12?ue():r}})(e.getChannelData)},qr={numberOfChannels:1},zr=(e,t,n,r,o,s,a,c)=>{let i=null;return class un{constructor(d){if(o===null)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:l,numberOfChannels:w,sampleRate:m}={...qr,...d};i===null&&(i=new o(1,1,44100));const h=r!==null&&t(s,s)?new r({length:l,numberOfChannels:w,sampleRate:m}):i.createBuffer(w,l,m);if(h.numberOfChannels===0)throw n();return typeof h.copyFromChannel!="function"?(a(h),$r(h)):t(Wt,()=>Wt(h))||c(h),e.add(h),h}static[Symbol.hasInstance](d){return d!==null&&typeof d=="object"&&Object.getPrototypeOf(d)===un.prototype||e.has(d)}}},xe=-34028234663852886e22,lt=-xe,ae=e=>ge.has(e),Xr={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},Yr=(e,t,n,r,o,s,a,c)=>class extends e{constructor(u,d){const l=s(u),w={...Xr,...d},m=o(l,w),h=a(l),f=h?t():null;super(u,!1,m,f),this._audioBufferSourceNodeRenderer=f,this._isBufferNullified=!1,this._isBufferSet=w.buffer!==null,this._nativeAudioBufferSourceNode=m,this._onended=null,this._playbackRate=n(this,h,m.playbackRate,lt,xe)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(u){if(this._nativeAudioBufferSourceNode.buffer=u,u!==null){if(this._isBufferSet)throw r();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(u){this._nativeAudioBufferSourceNode.loop=u}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(u){this._nativeAudioBufferSourceNode.loopEnd=u}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(u){this._nativeAudioBufferSourceNode.loopStart=u}get onended(){return this._onended}set onended(u){const d=typeof u=="function"?c(this,u):null;this._nativeAudioBufferSourceNode.onended=d;const l=this._nativeAudioBufferSourceNode.onended;this._onended=l!==null&&l===d?u:l}get playbackRate(){return this._playbackRate}start(u=0,d=0,l){if(this._nativeAudioBufferSourceNode.start(u,d,l),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.start=l===void 0?[u,d]:[u,d,l]),this.context.state!=="closed"){Pe(this);const w=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",w),ae(this)&&ut(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",w)}}stop(u=0){this._nativeAudioBufferSourceNode.stop(u),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.stop=u)}},Hr=(e,t,n,r,o)=>()=>{const s=new WeakMap;let a=null,c=null;const i=async(u,d)=>{let l=n(u);const w=cn(l,d);if(!w){const m={buffer:l.buffer,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,loop:l.loop,loopEnd:l.loopEnd,loopStart:l.loopStart,playbackRate:l.playbackRate.value};l=t(d,m),a!==null&&l.start(...a),c!==null&&l.stop(c)}return s.set(d,l),w?await e(d,u.playbackRate,l.playbackRate):await r(d,u.playbackRate,l.playbackRate),await o(u,d,l),l};return{set start(u){a=u},set stop(u){c=u},render(u,d){const l=s.get(d);return l!==void 0?Promise.resolve(l):i(u,d)}}},Zr=e=>"playbackRate"in e,Kr=e=>"frequency"in e&&"gain"in e,Qr=e=>"offset"in e,Jr=e=>!("frequency"in e)&&"gain"in e,eo=e=>"detune"in e&&"frequency"in e&&!("gain"in e),to=e=>"pan"in e,z=e=>K(Qt,e),Ae=e=>K(en,e),ot=(e,t)=>{const{activeInputs:n}=z(e);n.forEach(o=>o.forEach(([s])=>{t.includes(e)||ot(s,[...t,e])}));const r=Zr(e)?[e.playbackRate]:an(e)?Array.from(e.parameters.values()):Kr(e)?[e.Q,e.detune,e.frequency,e.gain]:Qr(e)?[e.offset]:Jr(e)?[e.gain]:eo(e)?[e.detune,e.frequency]:to(e)?[e.pan]:[];for(const o of r){const s=Ae(o);s!==void 0&&s.activeInputs.forEach(([a])=>ot(a,t))}ae(e)&&ut(e)},no=e=>{ot(e.destination,[])},ro=e=>e===void 0||typeof e=="number"||typeof e=="string"&&(e==="balanced"||e==="interactive"||e==="playback"),oo=(e,t,n,r,o,s,a,c)=>class extends e{constructor(u,d){const l=s(u),w=a(l),m=o(l,d,w),h=w?t(c):null;super(u,!1,m,h),this._isNodeOfNativeOfflineAudioContext=w,this._nativeAudioDestinationNode=m}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(u){if(this._isNodeOfNativeOfflineAudioContext)throw r();if(u>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=u}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(u){if(this._isNodeOfNativeOfflineAudioContext)throw r();this._nativeAudioDestinationNode.channelCountMode=u}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}},so=e=>{const t=new WeakMap,n=async(r,o)=>{const s=o.destination;return t.set(o,s),await e(r,o,s),s};return{render(r,o){const s=t.get(o);return s!==void 0?Promise.resolve(s):n(r,o)}}},ao=(e,t,n,r,o,s,a,c)=>(i,u)=>{const d=u.listener,l=()=>{const E=new Float32Array(1),b=t(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),y=a(u);let v=!1,N=[0,0,-1,0,1,0],I=[0,0,0];const M=()=>{if(v)return;v=!0;const B=r(u,256,9,0);B.onaudioprocess=({inputBuffer:S})=>{const L=[s(S,E,0),s(S,E,1),s(S,E,2),s(S,E,3),s(S,E,4),s(S,E,5)];L.some((O,P)=>O!==N[P])&&(d.setOrientation(...L),N=L);const D=[s(S,E,6),s(S,E,7),s(S,E,8)];D.some((O,P)=>O!==I[P])&&(d.setPosition(...D),I=D)},b.connect(B)},U=B=>S=>{S!==N[B]&&(N[B]=S,d.setOrientation(...N))},R=B=>S=>{S!==I[B]&&(I[B]=S,d.setPosition(...I))},W=(B,S,L)=>{const D=n(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:S});D.connect(b,0,B),D.start(),Object.defineProperty(D.offset,"defaultValue",{get(){return S}});const O=e({context:i},y,D.offset,lt,xe);return c(O,"value",P=>()=>P.call(O),P=>x=>{try{P.call(O,x)}catch($){if($.code!==9)throw $}M(),y&&L(x)}),O.cancelAndHoldAtTime=(P=>y?()=>{throw o()}:(...x)=>{const $=P.apply(O,x);return M(),$})(O.cancelAndHoldAtTime),O.cancelScheduledValues=(P=>y?()=>{throw o()}:(...x)=>{const $=P.apply(O,x);return M(),$})(O.cancelScheduledValues),O.exponentialRampToValueAtTime=(P=>y?()=>{throw o()}:(...x)=>{const $=P.apply(O,x);return M(),$})(O.exponentialRampToValueAtTime),O.linearRampToValueAtTime=(P=>y?()=>{throw o()}:(...x)=>{const $=P.apply(O,x);return M(),$})(O.linearRampToValueAtTime),O.setTargetAtTime=(P=>y?()=>{throw o()}:(...x)=>{const $=P.apply(O,x);return M(),$})(O.setTargetAtTime),O.setValueAtTime=(P=>y?()=>{throw o()}:(...x)=>{const $=P.apply(O,x);return M(),$})(O.setValueAtTime),O.setValueCurveAtTime=(P=>y?()=>{throw o()}:(...x)=>{const $=P.apply(O,x);return M(),$})(O.setValueCurveAtTime),O};return{forwardX:W(0,0,U(0)),forwardY:W(1,0,U(1)),forwardZ:W(2,-1,U(2)),positionX:W(6,0,R(0)),positionY:W(7,0,R(1)),positionZ:W(8,0,R(2)),upX:W(3,0,U(3)),upY:W(4,1,U(4)),upZ:W(5,0,U(5))}},{forwardX:w,forwardY:m,forwardZ:h,positionX:f,positionY:g,positionZ:p,upX:A,upY:_,upZ:T}=d.forwardX===void 0?l():d;return{get forwardX(){return w},get forwardY(){return m},get forwardZ(){return h},get positionX(){return f},get positionY(){return g},get positionZ(){return p},get upX(){return A},get upY(){return _},get upZ(){return T}}},Be=e=>"context"in e,Ce=e=>Be(e[0]),le=(e,t,n,r)=>{for(const o of e)if(n(o)){if(r)return!1;throw Error("The set contains at least one similar element.")}return e.add(t),!0},Vt=(e,t,[n,r],o)=>{le(e,[t,n,r],s=>s[0]===t&&s[1]===n,o)},xt=(e,[t,n,r],o)=>{const s=e.get(t);s===void 0?e.set(t,new Set([[n,r]])):le(s,[n,r],a=>a[0]===n,o)},ln=e=>"inputs"in e,st=(e,t,n,r)=>{if(ln(t)){const o=t.inputs[r];return e.connect(o,n,0),[o,n,0]}return e.connect(t,n,r),[t,n,r]},dn=(e,t,n)=>{for(const r of e)if(r[0]===t&&r[1]===n)return e.delete(r),r;return null},io=(e,t,n)=>Ve(e,r=>r[0]===t&&r[1]===n),fn=(e,t)=>{if(!be(e).delete(t))throw new Error("Missing the expected event listener.")},hn=(e,t,n)=>{const r=K(e,t),o=Ve(r,s=>s[0]===n);return r.size===0&&e.delete(t),o},at=(e,t,n,r)=>{ln(t)?e.disconnect(t.inputs[r],n,0):e.disconnect(t,n,r)},H=e=>K(Jt,e),ye=e=>K(tn,e),ie=e=>et.has(e),Ie=e=>!ge.has(e),Ft=(e,t)=>new Promise(n=>{if(t!==null)n(!0);else{const r=e.createScriptProcessor(256,1,1),o=e.createGain(),s=e.createBuffer(1,2,44100),a=s.getChannelData(0);a[0]=1,a[1]=1;const c=e.createBufferSource();c.buffer=s,c.loop=!0,c.connect(r).connect(e.destination),c.connect(o),c.disconnect(o),r.onaudioprocess=i=>{const u=i.inputBuffer.getChannelData(0);Array.prototype.some.call(u,d=>d===1)?n(!0):n(!1),c.stop(),r.onaudioprocess=null,c.disconnect(r),r.disconnect(e.destination)},c.start()}}),He=(e,t)=>{const n=new Map;for(const r of e)for(const o of r){const s=n.get(o);n.set(o,s===void 0?1:s+1)}n.forEach((r,o)=>t(o,r))},Ue=e=>"context"in e,co=e=>{const t=new Map;e.connect=(n=>(r,o=0,s=0)=>{const a=Ue(r)?n(r,o,s):n(r,o),c=t.get(r);return c===void 0?t.set(r,[{input:s,output:o}]):c.every(i=>i.input!==s||i.output!==o)&&c.push({input:s,output:o}),a})(e.connect.bind(e)),e.disconnect=(n=>(r,o,s)=>{if(n.apply(e),r===void 0)t.clear();else if(typeof r=="number")for(const[a,c]of t){const i=c.filter(u=>u.output!==r);i.length===0?t.delete(a):t.set(a,i)}else if(t.has(r))if(o===void 0)t.delete(r);else{const a=t.get(r);if(a!==void 0){const c=a.filter(i=>i.output!==o&&(i.input!==s||s===void 0));c.length===0?t.delete(r):t.set(r,c)}}for(const[a,c]of t)c.forEach(i=>{Ue(a)?e.connect(a,i.output,i.input):e.connect(a,i.output)})})(e.disconnect)},uo=(e,t,n,r)=>{const{activeInputs:o,passiveInputs:s}=Ae(t),{outputs:a}=z(e),c=be(e),i=u=>{const d=H(e),l=ye(t);if(u){const w=hn(s,e,n);Vt(o,e,w,!1),!r&&!ie(e)&&d.connect(l,n)}else{const w=io(o,e,n);xt(s,w,!1),!r&&!ie(e)&&d.disconnect(l,n)}};return le(a,[t,n],u=>u[0]===t&&u[1]===n,!0)?(c.add(i),ae(e)?Vt(o,e,[n,i],!0):xt(s,[e,n,i],!0),!0):!1},lo=(e,t,n,r)=>{const{activeInputs:o,passiveInputs:s}=z(t),a=dn(o[r],e,n);return a===null?[sn(s,e,n,r)[2],!1]:[a[2],!0]},fo=(e,t,n)=>{const{activeInputs:r,passiveInputs:o}=Ae(t),s=dn(r,e,n);return s===null?[hn(o,e,n)[1],!1]:[s[2],!0]},dt=(e,t,n,r,o)=>{const[s,a]=lo(e,n,r,o);if(s!==null&&(fn(e,s),a&&!t&&!ie(e)&&at(H(e),H(n),r,o)),ae(n)){const{activeInputs:c}=z(n);rt(n,c)}},ft=(e,t,n,r)=>{const[o,s]=fo(e,n,r);o!==null&&(fn(e,o),s&&!t&&!ie(e)&&H(e).disconnect(ye(n),r))},ho=(e,t)=>{const n=z(e),r=[];for(const o of n.outputs)Ce(o)?dt(e,t,...o):ft(e,t,...o),r.push(o[0]);return n.outputs.clear(),r},po=(e,t,n)=>{const r=z(e),o=[];for(const s of r.outputs)s[1]===n&&(Ce(s)?dt(e,t,...s):ft(e,t,...s),o.push(s[0]),r.outputs.delete(s));return o},mo=(e,t,n,r,o)=>{const s=z(e);return Array.from(s.outputs).filter(a=>a[0]===n&&(r===void 0||a[1]===r)&&(o===void 0||a[2]===o)).map(a=>(Ce(a)?dt(e,t,...a):ft(e,t,...a),s.outputs.delete(a),a[0]))},go=(e,t,n,r,o,s,a,c,i,u,d,l,w,m,h,f)=>class extends u{constructor(p,A,_,T){super(_),this._context=p,this._nativeAudioNode=_;const E=d(p);l(E)&&n(Ft,()=>Ft(E,f))!==!0&&co(_),Jt.set(this,_),rn.set(this,new Set),p.state!=="closed"&&A&&Pe(this),e(this,T,_)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(p){this._nativeAudioNode.channelCount=p}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(p){this._nativeAudioNode.channelCountMode=p}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(p){this._nativeAudioNode.channelInterpretation=p}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(p,A=0,_=0){if(A<0||A>=this._nativeAudioNode.numberOfOutputs)throw o();const T=d(this._context),E=h(T);if(w(p)||m(p))throw s();if(Be(p)){const v=H(p);try{const I=st(this._nativeAudioNode,v,A,_),M=Ie(this);(E||M)&&this._nativeAudioNode.disconnect(...I),this.context.state!=="closed"&&!M&&Ie(p)&&Pe(p)}catch(I){throw I.code===12?s():I}if(t(this,p,A,_,E)){const I=i([this],p);He(I,r(E))}return p}const b=ye(p);if(b.name==="playbackRate"&&b.maxValue===1024)throw a();try{this._nativeAudioNode.connect(b,A),(E||Ie(this))&&this._nativeAudioNode.disconnect(b,A)}catch(v){throw v.code===12?s():v}if(uo(this,p,A,E)){const v=i([this],p);He(v,r(E))}}disconnect(p,A,_){let T;const E=d(this._context),b=h(E);if(p===void 0)T=ho(this,b);else if(typeof p=="number"){if(p<0||p>=this.numberOfOutputs)throw o();T=po(this,b,p)}else{if(A!==void 0&&(A<0||A>=this.numberOfOutputs)||Be(p)&&_!==void 0&&(_<0||_>=p.numberOfInputs))throw o();if(T=mo(this,b,p,A,_),T.length===0)throw s()}for(const y of T){const v=i([this],y);He(v,c)}}},wo=(e,t,n,r,o,s,a,c,i,u,d,l,w)=>(m,h,f,g=null,p=null)=>{const A=f.value,_=new Or(A),T=h?r(_):null,E={get defaultValue(){return A},get maxValue(){return g===null?f.maxValue:g},get minValue(){return p===null?f.minValue:p},get value(){return f.value},set value(b){f.value=b,E.setValueAtTime(b,m.context.currentTime)},cancelAndHoldAtTime(b){if(typeof f.cancelAndHoldAtTime=="function")T===null&&_.flush(m.context.currentTime),_.add(o(b)),f.cancelAndHoldAtTime(b);else{const y=Array.from(_).pop();T===null&&_.flush(m.context.currentTime),_.add(o(b));const v=Array.from(_).pop();f.cancelScheduledValues(b),y!==v&&v!==void 0&&(v.type==="exponentialRampToValue"?f.exponentialRampToValueAtTime(v.value,v.endTime):v.type==="linearRampToValue"?f.linearRampToValueAtTime(v.value,v.endTime):v.type==="setValue"?f.setValueAtTime(v.value,v.startTime):v.type==="setValueCurve"&&f.setValueCurveAtTime(v.values,v.startTime,v.duration))}return E},cancelScheduledValues(b){return T===null&&_.flush(m.context.currentTime),_.add(s(b)),f.cancelScheduledValues(b),E},exponentialRampToValueAtTime(b,y){if(b===0)throw new RangeError;if(!Number.isFinite(y)||y<0)throw new RangeError;const v=m.context.currentTime;return T===null&&_.flush(v),Array.from(_).length===0&&(_.add(u(A,v)),f.setValueAtTime(A,v)),_.add(a(b,y)),f.exponentialRampToValueAtTime(b,y),E},linearRampToValueAtTime(b,y){const v=m.context.currentTime;return T===null&&_.flush(v),Array.from(_).length===0&&(_.add(u(A,v)),f.setValueAtTime(A,v)),_.add(c(b,y)),f.linearRampToValueAtTime(b,y),E},setTargetAtTime(b,y,v){return T===null&&_.flush(m.context.currentTime),_.add(i(b,y,v)),f.setTargetAtTime(b,y,v),E},setValueAtTime(b,y){return T===null&&_.flush(m.context.currentTime),_.add(u(b,y)),f.setValueAtTime(b,y),E},setValueCurveAtTime(b,y,v){const N=b instanceof Float32Array?b:new Float32Array(b);if(l!==null&&l.name==="webkitAudioContext"){const I=y+v,M=m.context.sampleRate,U=Math.ceil(y*M),R=Math.floor(I*M),W=R-U,B=new Float32Array(W);for(let L=0;L({replay(t){for(const n of e)if(n.type==="exponentialRampToValue"){const{endTime:r,value:o}=n;t.exponentialRampToValueAtTime(o,r)}else if(n.type==="linearRampToValue"){const{endTime:r,value:o}=n;t.linearRampToValueAtTime(o,r)}else if(n.type==="setTarget"){const{startTime:r,target:o,timeConstant:s}=n;t.setTargetAtTime(o,r,s)}else if(n.type==="setValue"){const{startTime:r,value:o}=n;t.setValueAtTime(o,r)}else if(n.type==="setValueCurve"){const{duration:r,startTime:o,values:s}=n;t.setValueCurveAtTime(s,o,r)}else throw new Error("Can't apply an unknown automation.")}});class pn{constructor(t){this._map=new Map(t)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(t,n=null){return this._map.forEach((r,o)=>t.call(n,r,o,this))}get(t){return this._map.get(t)}has(t){return this._map.has(t)}keys(){return this._map.keys()}values(){return this._map.values()}}const _o={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}},yo=(e,t,n,r,o,s,a,c,i,u,d,l,w,m)=>class extends t{constructor(f,g,p){var A;const _=c(f),T=i(_),E=d({..._o,...p});w(E);const b=tt.get(_),y=b?.get(g),v=T||_.state!=="closed"?_:(A=a(_))!==null&&A!==void 0?A:_,N=o(v,T?null:f.baseLatency,u,g,y,E),I=T?r(g,E,y):null;super(f,!0,N,I);const M=[];N.parameters.forEach((R,W)=>{const B=n(this,T,R);M.push([W,B])}),this._nativeAudioWorkletNode=N,this._onprocessorerror=null,this._parameters=new pn(M),T&&e(_,this);const{activeInputs:U}=s(this);l(N,U)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(f){const g=typeof f=="function"?m(this,f):null;this._nativeAudioWorkletNode.onprocessorerror=g;const p=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=p!==null&&p===g?f:p}get parameters(){return this._parameters===null?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}};function De(e,t,n,r,o){if(typeof e.copyFromChannel=="function")t[n].byteLength===0&&(t[n]=new Float32Array(128)),e.copyFromChannel(t[n],r,o);else{const s=e.getChannelData(r);if(t[n].byteLength===0)t[n]=s.slice(o,o+128);else{const a=new Float32Array(s.buffer,o*Float32Array.BYTES_PER_ELEMENT,128);t[n].set(a)}}}const mn=(e,t,n,r,o)=>{typeof e.copyToChannel=="function"?t[n].byteLength!==0&&e.copyToChannel(t[n],r,o):t[n].byteLength!==0&&e.getChannelData(r).set(t[n],o)},We=(e,t)=>{const n=[];for(let r=0;r{const n=K(nt,e),r=H(t);return K(n,r)},bo=async(e,t,n,r,o,s,a)=>{const c=t===null?Math.ceil(e.context.length/128)*128:t.length,i=r.channelCount*r.numberOfInputs,u=o.reduce((g,p)=>g+p,0),d=u===0?null:n.createBuffer(u,c,n.sampleRate);if(s===void 0)throw new Error("Missing the processor constructor.");const l=z(e),w=await Eo(n,e),m=We(r.numberOfInputs,r.channelCount),h=We(r.numberOfOutputs,o),f=Array.from(e.parameters.keys()).reduce((g,p)=>({...g,[p]:new Float32Array(128)}),{});for(let g=0;g0&&t!==null)for(let p=0;p{De(t,f,p,i+A,g)});for(let p=0;pl.activeInputs[T].size===0?[]:_),A=a(g/n.sampleRate,n.sampleRate,()=>w.process(p,h,f));if(d!==null)for(let _=0,T=0;_(g,p,A)=>{const _=new WeakMap;let T=null;const E=async(b,y)=>{let v=d(b),N=null;const I=cn(v,y),M=Array.isArray(p.outputChannelCount)?p.outputChannelCount:Array.from(p.outputChannelCount);if(l===null){const U=M.reduce((S,L)=>S+L,0),R=o(y,{channelCount:Math.max(1,U),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,U)}),W=[];for(let S=0;S{const x=new w(O,Math.ceil(b.context.length/128)*128,y.sampleRate),$=[],fe=[];for(let j=0;j{const X=s(x,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:j.value});return await m(x,j,X.offset),X})),pe=r(x,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,L+D)});for(let j=0;jh(b,x,j))),f(x)})(),y,p,M,A,u)}const U=await T,R=n(y,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[W,B,S]=N;U!==null&&(R.buffer=U,R.start(0)),R.connect(W);for(let L=0,D=0;L(n,r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e.get(n);if(s!==void 0)return s;try{const a=r();return a instanceof Promise?(e.set(n,a),a.catch(()=>!1).then(c=>(e.delete(n),t.set(n,c),c))):(t.set(n,a),a)}catch{return t.set(n,!1),!1}},To=e=>(t,n,r)=>e(n,t,r),Mo=e=>(t,n,r=0,o=0)=>{const s=t[r];if(s===void 0)throw e();return Ue(n)?s.connect(n,0,o):s.connect(n,0)},No=e=>t=>(e[0]=t,e[0]),Oo=(e,t,n,r,o,s,a,c)=>(i,u)=>{const d=t.get(i);if(d===void 0)throw new Error("Missing the expected cycle count.");const l=s(i.context),w=c(l);if(d===u){if(t.delete(i),!w&&a(i)){const m=r(i),{outputs:h}=n(i);for(const f of h)if(Ce(f)){const g=r(f[0]);e(m,g,f[1],f[2])}else{const g=o(f[0]);m.connect(g,f[1])}}}else t.set(i,d-u)},ko=e=>(t,n,r,o)=>e(t[o],s=>s[0]===n&&s[1]===r),Io=e=>(t,n)=>{e(t).delete(n)},So=e=>"delayTime"in e,Ro=(e,t,n)=>function r(o,s){const a=Be(s)?s:n(e,s);if(So(a))return[];if(o[0]===a)return[o];if(o.includes(a))return[];const{outputs:c}=t(a);return Array.from(c).map(i=>r([...o,a],i[0])).reduce((i,u)=>i.concat(u),[])},ke=(e,t,n)=>{const r=t[n];if(r===void 0)throw e();return r},Lo=e=>(t,n=void 0,r=void 0,o=0)=>n===void 0?t.forEach(s=>s.disconnect()):typeof n=="number"?ke(e,t,n).disconnect():Ue(n)?r===void 0?t.forEach(s=>s.disconnect(n)):o===void 0?ke(e,t,r).disconnect(n,0):ke(e,t,r).disconnect(n,0,o):r===void 0?t.forEach(s=>s.disconnect(n)):ke(e,t,r).disconnect(n,0),Po=e=>t=>new Promise((n,r)=>{if(e===null){r(new SyntaxError);return}const o=e.document.head;if(o===null)r(new SyntaxError);else{const s=e.document.createElement("script"),a=new Blob([t],{type:"application/javascript"}),c=URL.createObjectURL(a),i=e.onerror,u=()=>{e.onerror=i,URL.revokeObjectURL(c)};e.onerror=(d,l,w,m,h)=>{if(l===c||l===e.location.href&&w===1&&m===1)return u(),r(h),!1;if(i!==null)return i(d,l,w,m,h)},s.onerror=()=>{u(),r(new SyntaxError)},s.onload=()=>{u(),n()},s.src=c,s.type="module",o.appendChild(s)}}),Bo=e=>class{constructor(n){this._nativeEventTarget=n,this._listeners=new WeakMap}addEventListener(n,r,o){if(r!==null){let s=this._listeners.get(r);s===void 0&&(s=e(this,r),typeof r=="function"&&this._listeners.set(r,s)),this._nativeEventTarget.addEventListener(n,s,o)}}dispatchEvent(n){return this._nativeEventTarget.dispatchEvent(n)}removeEventListener(n,r,o){const s=r===null?void 0:this._listeners.get(r);this._nativeEventTarget.removeEventListener(n,s===void 0?null:s,o)}},Uo=e=>(t,n,r)=>{Object.defineProperties(e,{currentFrame:{configurable:!0,get(){return Math.round(t*n)}},currentTime:{configurable:!0,get(){return t}}});try{return r()}finally{e!==null&&(delete e.currentFrame,delete e.currentTime)}},Do=e=>async t=>{try{const n=await fetch(t);if(n.ok)return[await n.text(),n.url]}catch{}throw e()},Wo=(e,t)=>n=>t(e,n),Vo=e=>t=>{const n=e(t);if(n.renderer===null)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return n.renderer},xo=e=>t=>{var n;return(n=e.get(t))!==null&&n!==void 0?n:0},Fo=e=>t=>{const n=e(t);if(n.renderer===null)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer},jo=e=>t=>e.get(t),Z=()=>new DOMException("","InvalidStateError"),Go=e=>t=>{const n=e.get(t);if(n===void 0)throw Z();return n},$o=(e,t)=>n=>{let r=e.get(n);if(r!==void 0)return r;if(t===null)throw new Error("Missing the native OfflineAudioContext constructor.");return r=new t(1,1,44100),e.set(n,r),r},qo=e=>t=>{const n=e.get(t);if(n===void 0)throw new Error("The context has no set of AudioWorkletNodes.");return n},zo=()=>new DOMException("","InvalidAccessError"),Xo=(e,t,n,r,o,s)=>a=>(c,i)=>{const u=e.get(c);if(u===void 0){if(!a&&s(c)){const d=r(c),{outputs:l}=n(c);for(const w of l)if(Ce(w)){const m=r(w[0]);t(d,m,w[1],w[2])}else{const m=o(w[0]);d.disconnect(m,w[1])}}e.set(c,i)}else e.set(c,u+i)},Yo=e=>t=>e!==null&&t instanceof e,Ho=e=>t=>e!==null&&typeof e.AudioNode=="function"&&t instanceof e.AudioNode,Zo=e=>t=>e!==null&&typeof e.AudioParam=="function"&&t instanceof e.AudioParam,Ko=e=>t=>e!==null&&t instanceof e,Qo=e=>e!==null&&e.isSecureContext,Jo=(e,t,n,r)=>class extends e{constructor(s,a){const c=n(s),i=t(c,a);if(r(c))throw new TypeError;super(s,!0,i,null),this._nativeMediaStreamAudioSourceNode=i}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}},es=(e,t,n,r,o)=>class extends r{constructor(a={}){if(o===null)throw new Error("Missing the native AudioContext constructor.");let c;try{c=new o(a)}catch(d){throw d.code===12&&d.message==="sampleRate is not in range"?t():d}if(c===null)throw n();if(!ro(a.latencyHint))throw new TypeError(`The provided value '${a.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(a.sampleRate!==void 0&&c.sampleRate!==a.sampleRate)throw t();super(c,2);const{latencyHint:i}=a,{sampleRate:u}=c;if(this._baseLatency=typeof c.baseLatency=="number"?c.baseLatency:i==="balanced"?512/u:i==="interactive"||i===void 0?256/u:i==="playback"?1024/u:Math.max(2,Math.min(128,Math.round(i*u/128)))*128/u,this._nativeAudioContext=c,o.name==="webkitAudioContext"?(this._nativeGainNode=c.createGain(),this._nativeOscillatorNode=c.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(c.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,c.state==="running"){this._state="suspended";const d=()=>{this._state==="suspended"&&(this._state=null),c.removeEventListener("statechange",d)};c.addEventListener("statechange",d)}}get baseLatency(){return this._baseLatency}get state(){return this._state!==null?this._state:this._nativeAudioContext.state}close(){return this.state==="closed"?this._nativeAudioContext.close().then(()=>{throw e()}):(this._state==="suspended"&&(this._state=null),this._nativeAudioContext.close().then(()=>{this._nativeGainNode!==null&&this._nativeOscillatorNode!==null&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),no(this)}))}resume(){return this._state==="suspended"?new Promise((a,c)=>{const i=()=>{this._nativeAudioContext.removeEventListener("statechange",i),this._nativeAudioContext.state==="running"?a():this.resume().then(a,c)};this._nativeAudioContext.addEventListener("statechange",i)}):this._nativeAudioContext.resume().catch(a=>{throw a===void 0||a.code===15?e():a})}suspend(){return this._nativeAudioContext.suspend().catch(a=>{throw a===void 0?e():a})}},ts=(e,t,n,r,o,s)=>class extends n{constructor(c,i){super(c),this._nativeContext=c,nn.set(this,c),r(c)&&o.set(c,new Set),this._destination=new e(this,i),this._listener=t(this,c),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(c){const i=typeof c=="function"?s(this,c):null;this._nativeContext.onstatechange=i;const u=this._nativeContext.onstatechange;this._onstatechange=u!==null&&u===i?c:u}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}},jt=e=>{const t=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const n=e.decodeAudioData(t.buffer,()=>{});return n===void 0?!1:(n.catch(()=>{}),!0)}catch{}return!1},ns=(e,t)=>(n,r,o)=>{const s=new Set;return n.connect=(a=>(c,i=0,u=0)=>{const d=s.size===0;if(t(c))return a.call(n,c,i,u),e(s,[c,i,u],l=>l[0]===c&&l[1]===i&&l[2]===u,!0),d&&r(),c;a.call(n,c,i),e(s,[c,i],l=>l[0]===c&&l[1]===i,!0),d&&r()})(n.connect),n.disconnect=(a=>(c,i,u)=>{const d=s.size>0;if(c===void 0)a.apply(n),s.clear();else if(typeof c=="number"){a.call(n,c);for(const w of s)w[1]===c&&s.delete(w)}else{t(c)?a.call(n,c,i,u):a.call(n,c,i);for(const w of s)w[0]===c&&(i===void 0||w[1]===i)&&(u===void 0||w[2]===u)&&s.delete(w)}const l=s.size===0;d&&l&&o()})(n.disconnect),n},se=(e,t,n)=>{const r=t[n];r!==void 0&&r!==e[n]&&(e[n]=r)},Te=(e,t)=>{se(e,t,"channelCount"),se(e,t,"channelCountMode"),se(e,t,"channelInterpretation")},rs=e=>e===null?null:e.hasOwnProperty("AudioBuffer")?e.AudioBuffer:null,ht=(e,t,n)=>{const r=t[n];r!==void 0&&r!==e[n].value&&(e[n].value=r)},os=e=>{e.start=(t=>{let n=!1;return(r=0,o=0,s)=>{if(n)throw Z();t.call(e,r,o,s),n=!0}})(e.start)},gn=e=>{e.start=(t=>(n=0,r=0,o)=>{if(typeof o=="number"&&o<0||r<0||n<0)throw new RangeError("The parameters can't be negative.");t.call(e,n,r,o)})(e.start)},wn=e=>{e.stop=(t=>(n=0)=>{if(n<0)throw new RangeError("The parameter can't be negative.");t.call(e,n)})(e.stop)},ss=(e,t,n,r,o,s,a,c,i,u,d)=>(l,w)=>{const m=l.createBufferSource();return Te(m,w),ht(m,w,"playbackRate"),se(m,w,"buffer"),se(m,w,"loop"),se(m,w,"loopEnd"),se(m,w,"loopStart"),t(n,()=>n(l))||os(m),t(r,()=>r(l))||i(m),t(o,()=>o(l))||u(m,l),t(s,()=>s(l))||gn(m),t(a,()=>a(l))||d(m,l),t(c,()=>c(l))||wn(m),e(l,m),m},as=e=>e===null?null:e.hasOwnProperty("AudioContext")?e.AudioContext:e.hasOwnProperty("webkitAudioContext")?e.webkitAudioContext:null,is=(e,t)=>(n,r,o)=>{const s=n.destination;if(s.channelCount!==r)try{s.channelCount=r}catch{}o&&s.channelCountMode!=="explicit"&&(s.channelCountMode="explicit"),s.maxChannelCount===0&&Object.defineProperty(s,"maxChannelCount",{value:r});const a=e(n,{channelCount:r,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,gain:1});return t(a,"channelCount",c=>()=>c.call(a),c=>i=>{c.call(a,i);try{s.channelCount=i}catch(u){if(i>s.maxChannelCount)throw u}}),t(a,"channelCountMode",c=>()=>c.call(a),c=>i=>{c.call(a,i),s.channelCountMode=i}),t(a,"channelInterpretation",c=>()=>c.call(a),c=>i=>{c.call(a,i),s.channelInterpretation=i}),Object.defineProperty(a,"maxChannelCount",{get:()=>s.maxChannelCount}),a.connect(s),a},cs=e=>e===null?null:e.hasOwnProperty("AudioWorkletNode")?e.AudioWorkletNode:null,us=e=>{const{port1:t}=new MessageChannel;try{t.postMessage(e)}finally{t.close()}},ls=(e,t,n,r,o)=>(s,a,c,i,u,d)=>{if(c!==null)try{const l=new c(s,i,d),w=new Map;let m=null;if(Object.defineProperties(l,{channelCount:{get:()=>d.channelCount,set:()=>{throw e()}},channelCountMode:{get:()=>"explicit",set:()=>{throw e()}},onprocessorerror:{get:()=>m,set:h=>{typeof m=="function"&&l.removeEventListener("processorerror",m),m=typeof h=="function"?h:null,typeof m=="function"&&l.addEventListener("processorerror",m)}}}),l.addEventListener=(h=>(...f)=>{if(f[0]==="processorerror"){const g=typeof f[1]=="function"?f[1]:typeof f[1]=="object"&&f[1]!==null&&typeof f[1].handleEvent=="function"?f[1].handleEvent:null;if(g!==null){const p=w.get(f[1]);p!==void 0?f[1]=p:(f[1]=A=>{A.type==="error"?(Object.defineProperties(A,{type:{value:"processorerror"}}),g(A)):g(new ErrorEvent(f[0],{...A}))},w.set(g,f[1]))}}return h.call(l,"error",f[1],f[2]),h.call(l,...f)})(l.addEventListener),l.removeEventListener=(h=>(...f)=>{if(f[0]==="processorerror"){const g=w.get(f[1]);g!==void 0&&(w.delete(f[1]),f[1]=g)}return h.call(l,"error",f[1],f[2]),h.call(l,f[0],f[1],f[2])})(l.removeEventListener),d.numberOfOutputs!==0){const h=n(s,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return l.connect(h).connect(s.destination),o(l,()=>h.disconnect(),()=>h.connect(s.destination))}return l}catch(l){throw l.code===11?r():l}if(u===void 0)throw r();return us(d),t(s,a,u,d)},ds=(e,t)=>e===null?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(e*t))))),fs=e=>new Promise((t,n)=>{const{port1:r,port2:o}=new MessageChannel;r.onmessage=({data:s})=>{r.close(),o.close(),t(s)},r.onmessageerror=({data:s})=>{r.close(),o.close(),n(s)},o.postMessage(e)}),hs=async(e,t)=>{const n=await fs(t);return new e(n)},ps=(e,t,n,r)=>{let o=nt.get(e);o===void 0&&(o=new WeakMap,nt.set(e,o));const s=hs(n,r);return o.set(t,s),s},ms=(e,t,n,r,o,s,a,c,i,u,d,l,w)=>(m,h,f,g)=>{if(g.numberOfInputs===0&&g.numberOfOutputs===0)throw i();const p=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(p.some(C=>C<1))throw i();if(p.length!==g.numberOfOutputs)throw t();if(g.channelCountMode!=="explicit")throw i();const A=g.channelCount*g.numberOfInputs,_=p.reduce((C,k)=>C+k,0),T=f.parameterDescriptors===void 0?0:f.parameterDescriptors.length;if(A+T>6||_>6)throw i();const E=new MessageChannel,b=[],y=[];for(let C=0;CC===void 0?0:C},maxValue:{get:()=>k===void 0?lt:k},minValue:{get:()=>q===void 0?xe:q}}),v.push(V)}const N=r(m,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,A+T)}),I=ds(h,m.sampleRate),M=c(m,I,A+T,Math.max(1,_)),U=o(m,{channelCount:Math.max(1,_),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,_)}),R=[];for(let C=0;C{const q=v[k];return q.connect(N,0,A+k),q.start(0),[C,q.offset]}));N.connect(M);let B=g.channelInterpretation,S=null;const L=g.numberOfOutputs===0?[M]:R,D={get bufferSize(){return I},get channelCount(){return g.channelCount},set channelCount(C){throw n()},get channelCountMode(){return g.channelCountMode},set channelCountMode(C){throw n()},get channelInterpretation(){return B},set channelInterpretation(C){for(const k of b)k.channelInterpretation=C;B=C},get context(){return M.context},get inputs(){return b},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},get onprocessorerror(){return S},set onprocessorerror(C){typeof S=="function"&&D.removeEventListener("processorerror",S),S=typeof C=="function"?C:null,typeof S=="function"&&D.addEventListener("processorerror",S)},get parameters(){return W},get port(){return E.port2},addEventListener(...C){return M.addEventListener(C[0],C[1],C[2])},connect:e.bind(null,L),disconnect:u.bind(null,L),dispatchEvent(...C){return M.dispatchEvent(C[0])},removeEventListener(...C){return M.removeEventListener(C[0],C[1],C[2])}},O=new Map;E.port1.addEventListener=(C=>(...k)=>{if(k[0]==="message"){const q=typeof k[1]=="function"?k[1]:typeof k[1]=="object"&&k[1]!==null&&typeof k[1].handleEvent=="function"?k[1].handleEvent:null;if(q!==null){const F=O.get(k[1]);F!==void 0?k[1]=F:(k[1]=V=>{d(m.currentTime,m.sampleRate,()=>q(V))},O.set(q,k[1]))}}return C.call(E.port1,k[0],k[1],k[2])})(E.port1.addEventListener),E.port1.removeEventListener=(C=>(...k)=>{if(k[0]==="message"){const q=O.get(k[1]);q!==void 0&&(O.delete(k[1]),k[1]=q)}return C.call(E.port1,k[0],k[1],k[2])})(E.port1.removeEventListener);let P=null;Object.defineProperty(E.port1,"onmessage",{get:()=>P,set:C=>{typeof P=="function"&&E.port1.removeEventListener("message",P),P=typeof C=="function"?C:null,typeof P=="function"&&(E.port1.addEventListener("message",P),E.port1.start())}}),f.prototype.port=E.port1;let x=null;ps(m,D,f,g).then(C=>x=C);const fe=We(g.numberOfInputs,g.channelCount),he=We(g.numberOfOutputs,p),pe=f.parameterDescriptors===void 0?[]:f.parameterDescriptors.reduce((C,{name:k})=>({...C,[k]:new Float32Array(128)}),{});let j=!0;const X=()=>{g.numberOfOutputs>0&&M.disconnect(U);for(let C=0,k=0;C{if(x!==null){const q=l(D);for(let F=0;F{De(C,pe,V,A+G,F)});for(let V=0;V{if(q[te].size>0)return Me.set(te,I/128),Y;const Ye=Me.get(te);return Ye===void 0?[]:(Y.every($n=>$n.every(qn=>qn===0))&&(Ye===1?Me.delete(te):Me.set(te,Ye-1)),Y)});j=d(m.currentTime+F/m.sampleRate,m.sampleRate,()=>x.process(V,he,pe));for(let Y=0,te=0;YM.connect(Xe).connect(m.destination),Tt=()=>{M.disconnect(Xe),Xe.disconnect()},jn=()=>{if(j){Tt(),g.numberOfOutputs>0&&M.connect(U);for(let C=0,k=0;C{j&&(Ct(),X()),ze=!1};return Ct(),w(D,jn,Gn)},gs=(e,t)=>(n,r)=>{const o=n.createChannelMerger(r.numberOfInputs);return e!==null&&e.name==="webkitAudioContext"&&t(n,o),Te(o,r),o},ws=e=>{const t=e.numberOfOutputs;Object.defineProperty(e,"channelCount",{get:()=>t,set:n=>{if(n!==t)throw Z()}}),Object.defineProperty(e,"channelCountMode",{get:()=>"explicit",set:n=>{if(n!=="explicit")throw Z()}}),Object.defineProperty(e,"channelInterpretation",{get:()=>"discrete",set:n=>{if(n!=="discrete")throw Z()}})},vn=(e,t)=>{const n=e.createChannelSplitter(t.numberOfOutputs);return Te(n,t),ws(n),n},vs=(e,t,n,r,o)=>(s,a)=>{if(s.createConstantSource===void 0)return n(s,a);const c=s.createConstantSource();return Te(c,a),ht(c,a,"offset"),t(r,()=>r(s))||gn(c),t(o,()=>o(s))||wn(c),e(s,c),c},_n=(e,t)=>(e.connect=t.connect.bind(t),e.disconnect=t.disconnect.bind(t),e),_s=(e,t,n,r)=>(o,{offset:s,...a})=>{const c=o.createBuffer(1,2,44100),i=t(o,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),u=n(o,{...a,gain:s}),d=c.getChannelData(0);d[0]=1,d[1]=1,i.buffer=c,i.loop=!0;const l={get bufferSize(){},get channelCount(){return u.channelCount},set channelCount(h){u.channelCount=h},get channelCountMode(){return u.channelCountMode},set channelCountMode(h){u.channelCountMode=h},get channelInterpretation(){return u.channelInterpretation},set channelInterpretation(h){u.channelInterpretation=h},get context(){return u.context},get inputs(){return[]},get numberOfInputs(){return i.numberOfInputs},get numberOfOutputs(){return u.numberOfOutputs},get offset(){return u.gain},get onended(){return i.onended},set onended(h){i.onended=h},addEventListener(...h){return i.addEventListener(h[0],h[1],h[2])},dispatchEvent(...h){return i.dispatchEvent(h[0])},removeEventListener(...h){return i.removeEventListener(h[0],h[1],h[2])},start(h=0){i.start.call(i,h)},stop(h=0){i.stop.call(i,h)}},w=()=>i.connect(u),m=()=>i.disconnect(u);return e(o,i),r(_n(l,u),w,m)},oe=(e,t)=>{const n=e.createGain();return Te(n,t),ht(n,t,"gain"),n},ys=(e,{mediaStream:t})=>{const n=t.getAudioTracks();n.sort((s,a)=>s.ida.id?1:0);const r=n.slice(0,1),o=e.createMediaStreamSource(new MediaStream(r));return Object.defineProperty(o,"mediaStream",{value:t}),o},Es=e=>e===null?null:e.hasOwnProperty("OfflineAudioContext")?e.OfflineAudioContext:e.hasOwnProperty("webkitOfflineAudioContext")?e.webkitOfflineAudioContext:null,pt=(e,t,n,r)=>e.createScriptProcessor(t,n,r),de=()=>new DOMException("","NotSupportedError"),bs=(e,t)=>(n,r,o)=>(e(r).replay(o),t(r,n,o)),As=(e,t,n)=>async(r,o,s)=>{const a=e(r);await Promise.all(a.activeInputs.map((c,i)=>Array.from(c).map(async([u,d])=>{const w=await t(u).render(u,o),m=r.context.destination;!n(u)&&(r!==m||!n(r))&&w.connect(s,d,i)})).reduce((c,i)=>[...c,...i],[]))},Cs=(e,t,n)=>async(r,o,s)=>{const a=t(r);await Promise.all(Array.from(a.activeInputs).map(async([c,i])=>{const d=await e(c).render(c,o);n(c)||d.connect(s,i)}))},Ts=(e,t,n,r)=>o=>e(jt,()=>jt(o))?Promise.resolve(e(r,r)).then(s=>{if(!s){const a=n(o,512,0,1);o.oncomplete=()=>{a.onaudioprocess=null,a.disconnect()},a.onaudioprocess=()=>o.currentTime,a.connect(o.destination)}return o.startRendering()}):new Promise(s=>{const a=t(o,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});o.oncomplete=c=>{a.disconnect(),s(c.renderedBuffer)},a.connect(o.destination),o.startRendering()}),Ms=e=>(t,n)=>{e.set(t,n)},Ns=e=>()=>{if(e===null)return!1;try{new e({length:1,sampleRate:44100})}catch{return!1}return!0},Os=(e,t)=>async()=>{if(e===null)return!0;if(t===null)return!1;const n=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),r=new t(1,128,44100),o=URL.createObjectURL(n);let s=!1,a=!1;try{await r.audioWorklet.addModule(o);const c=new e(r,"a",{numberOfOutputs:0}),i=r.createOscillator();c.port.onmessage=()=>s=!0,c.onprocessorerror=()=>a=!0,i.connect(c),i.start(0),await r.startRendering(),await new Promise(u=>setTimeout(u))}catch{}finally{URL.revokeObjectURL(o)}return s&&!a},ks=(e,t)=>()=>{if(t===null)return Promise.resolve(!1);const n=new t(1,1,44100),r=e(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise(o=>{n.oncomplete=()=>{r.disconnect(),o(n.currentTime!==0)},n.startRendering()})},Is=()=>new DOMException("","UnknownError"),Ss=()=>typeof window>"u"?null:window,Rs=(e,t)=>n=>{n.copyFromChannel=(r,o,s=0)=>{const a=e(s),c=e(o);if(c>=n.numberOfChannels)throw t();const i=n.length,u=n.getChannelData(c),d=r.length;for(let l=a<0?-a:0;l+a{const a=e(s),c=e(o);if(c>=n.numberOfChannels)throw t();const i=n.length,u=n.getChannelData(c),d=r.length;for(let l=a<0?-a:0;l+at=>{t.copyFromChannel=(n=>(r,o,s=0)=>{const a=e(s),c=e(o);if(a(r,o,s=0)=>{const a=e(s),c=e(o);if(a(t,n)=>{const r=n.createBuffer(1,1,44100);t.buffer===null&&(t.buffer=r),e(t,"buffer",o=>()=>{const s=o.call(t);return s===r?null:s},o=>s=>o.call(t,s===null?r:s))},Bs=(e,t)=>(n,r)=>{r.channelCount=1,r.channelCountMode="explicit",Object.defineProperty(r,"channelCount",{get:()=>1,set:()=>{throw e()}}),Object.defineProperty(r,"channelCountMode",{get:()=>"explicit",set:()=>{throw e()}});const o=n.createBufferSource();t(r,()=>{const c=r.numberOfInputs;for(let i=0;io.disconnect(r))},Us=(e,t,n)=>e.copyFromChannel===void 0?e.getChannelData(n)[0]:(e.copyFromChannel(t,n),t[0]),mt=(e,t,n,r)=>{let o=e;for(;!o.hasOwnProperty(t);)o=Object.getPrototypeOf(o);const{get:s,set:a}=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,{get:n(s),set:r(a)})},Ds=e=>({...e,outputChannelCount:e.outputChannelCount!==void 0?e.outputChannelCount:e.numberOfInputs===1&&e.numberOfOutputs===1?[e.channelCount]:Array.from({length:e.numberOfOutputs},()=>1)}),yn=(e,t,n)=>{try{e.setValueAtTime(t,n)}catch(r){if(r.code!==9)throw r;yn(e,t,n+1e-7)}},Ws=e=>{const t=e.createBufferSource();t.start();try{t.start()}catch{return!0}return!1},Vs=e=>{const t=e.createBufferSource(),n=e.createBuffer(1,1,44100);t.buffer=n;try{t.start(0,1)}catch{return!1}return!0},xs=e=>{const t=e.createBufferSource();t.start();try{t.stop()}catch{return!1}return!0},En=e=>{const t=e.createOscillator();try{t.start(-1)}catch(n){return n instanceof RangeError}return!1},Fs=e=>{const t=e.createBuffer(1,1,44100),n=e.createBufferSource();n.buffer=t,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},bn=e=>{const t=e.createOscillator();try{t.stop(-1)}catch(n){return n instanceof RangeError}return!1},js=e=>{const{port1:t,port2:n}=new MessageChannel;try{t.postMessage(e)}finally{t.close(),n.close()}},Gs=e=>{e.start=(t=>(n=0,r=0,o)=>{const s=e.buffer,a=s===null?r:Math.min(s.duration,r);s!==null&&a>s.duration-.5/e.context.sampleRate?t.call(e,n,0,0):t.call(e,n,a,o)})(e.start)},$s=(e,t)=>{const n=t.createGain();e.connect(n);const r=(o=>()=>{o.call(e,n),e.removeEventListener("ended",r)})(e.disconnect);e.addEventListener("ended",r),_n(e,n),e.stop=(o=>{let s=!1;return(a=0)=>{if(s)try{o.call(e,a)}catch{n.gain.setValueAtTime(0,a)}else o.call(e,a),s=!0}})(e.stop)},Fe=(e,t)=>n=>{const r={value:e};return Object.defineProperties(n,{currentTarget:r,target:r}),typeof t=="function"?t.call(e,n):t.handleEvent.call(e,n)},qs=Br(le),zs=Fr(le),Xs=ko(Ve),Ys=new WeakMap,Hs=xo(Ys),we=Co(new Map,new WeakMap),Q=Ss(),An=Vo(z),gt=As(z,An,ie),ce=Go(nn),ve=Es(Q),ee=Ko(ve),Cn=new WeakMap,Tn=Bo(Fe),je=as(Q),Zs=Yo(je),Mn=Ho(Q),Ks=Zo(Q),Ee=cs(Q),Ge=go(Ur(Qt),xr(qs,zs,st,Xs,at,z,Hs,be,H,le,ae,ie,Ie),we,Xo(et,at,z,H,ye,ae),ue,zo,de,Oo(st,et,z,H,ye,ce,ae,ee),Ro(Cn,z,K),Tn,ce,Zs,Mn,Ks,ee,Ee),Qs=new WeakSet,Gt=rs(Q),Nn=No(new Uint32Array(1)),Js=Rs(Nn,ue),ea=Ls(Nn),ta=zr(Qs,we,de,Gt,ve,Ns(Gt),Js,ea),wt=jr(oe),On=Cs(An,Ae,ie),kn=To(On),$e=ss(wt,we,Ws,Vs,xs,En,Fs,bn,Gs,Ps(mt),$s),In=bs(Fo(Ae),On),na=Hr(kn,$e,H,In,gt),vt=wo(Dr(en),Cn,tn,vo,kr,Ir,Sr,Rr,Lr,Ke,Zt,je,yn),ra=Yr(Ge,na,vt,Z,$e,ce,ee,Fe),oa=oo(Ge,so,ue,Z,is(oe,mt),ce,ee,gt),qe=ns(le,Mn),sa=Bs(Z,qe),_t=gs(je,sa),aa=_s(wt,$e,oe,qe),yt=vs(wt,we,aa,En,bn),ia=Ts(we,oe,pt,ks(oe,ve)),ca=ao(vt,_t,yt,pt,de,Us,ee,mt),Sn=new WeakMap,ua=ts(oa,ca,Tn,ee,Sn,Fe),Rn=Qo(Q),Et=Uo(Q),Ln=new WeakMap,la=$o(Ln,ve),$t=Rn?Vr(we,de,Po(Q),Et,Do(Pr),ce,la,ee,Ee,new WeakMap,new WeakMap,Os(Ee,ve),Q):void 0,da=Jo(Ge,ys,ce,ee),Pn=qo(Sn),fa=Gr(Pn),Bn=Mo(ue),ha=Io(Pn),Un=Lo(ue),Dn=new WeakMap,pa=Wo(Dn,K),ma=ms(Bn,ue,Z,_t,vn,yt,oe,pt,de,Un,Et,pa,qe),ga=ls(Z,ma,oe,de,qe),wa=Ao(kn,Bn,$e,_t,vn,yt,oe,ha,Un,Et,H,Ee,ve,In,gt,ia),va=jo(Ln),_a=Ms(Dn),qt=Rn?yo(fa,Ge,vt,wa,ga,z,va,ce,ee,Ee,Ds,_a,js,Fe):void 0,ya=es(Z,de,Is,ua,je),Wn="Missing AudioWorklet support. Maybe this is not running in a secure context.",Ea=async(e,t,n,r,o)=>{const{encoderId:s,port:a}=await Xt(o,t.sampleRate);if(qt===void 0)throw new Error(Wn);const c=new ra(t,{buffer:e}),i=new da(t,{mediaStream:r}),u=Tr(qt,t,{channelCount:n});return{audioBufferSourceNode:c,encoderId:s,mediaStreamAudioSourceNode:i,port:a,recorderAudioWorkletNode:u}},ba=(e,t,n,r)=>(o,s,a)=>{var c;const i=(c=s.getAudioTracks()[0])===null||c===void 0?void 0:c.getSettings().sampleRate,u=new ya({latencyHint:"playback",sampleRate:i}),d=Math.max(1024,Math.ceil(u.baseLatency*u.sampleRate)),l=new ta({length:d,sampleRate:u.sampleRate}),w=[],m=Cr(v=>{if($t===void 0)throw new Error(Wn);return $t(u,v)});let h=null,f=null,g=null,p=null,A=!0;const _=v=>{o.dispatchEvent(e("dataavailable",{data:new Blob(v,{type:a})}))},T=async(v,N)=>{const I=await Se(v,N);g===null?w.push(...I):(_(I),p=T(v,N))},E=()=>(A=!0,u.resume()),b=()=>{g!==null&&(h!==null&&(s.removeEventListener("addtrack",h),s.removeEventListener("removetrack",h)),f!==null&&clearTimeout(f),g.then(async({encoderId:v,mediaStreamAudioSourceNode:N,recorderAudioWorkletNode:I})=>{p!==null&&(p.catch(()=>{}),p=null),await I.stop(),N.disconnect(I);const M=await Se(v,null);g===null&&await y(),_([...w,...M]),w.length=0,o.dispatchEvent(new Event("stop"))}),g=null)},y=()=>(A=!1,u.suspend());return y(),{get mimeType(){return a},get state(){return g===null?"inactive":A?"recording":"paused"},pause(){if(g===null)throw n();A&&(y(),o.dispatchEvent(new Event("pause")))},resume(){if(g===null)throw n();A||(E(),o.dispatchEvent(new Event("resume")))},start(v){var N;if(g!==null)throw n();if(s.getVideoTracks().length>0)throw r();o.dispatchEvent(new Event("start"));const I=s.getAudioTracks(),M=I.length===0?2:(N=I[0].getSettings().channelCount)!==null&&N!==void 0?N:2;g=Promise.all([E(),m.then(()=>Ea(l,u,M,s,a))]).then(async([,{audioBufferSourceNode:R,encoderId:W,mediaStreamAudioSourceNode:B,port:S,recorderAudioWorkletNode:L}])=>(B.connect(L),await new Promise(D=>{R.onended=D,R.connect(L),R.start(u.currentTime+d/u.sampleRate)}),R.disconnect(L),await L.record(S),v!==void 0&&(p=T(W,v)),{encoderId:W,mediaStreamAudioSourceNode:B,recorderAudioWorkletNode:L}));const U=s.getTracks();h=()=>{b(),o.dispatchEvent(new ErrorEvent("error",{error:t()}))},s.addEventListener("addtrack",h),s.addEventListener("removetrack",h),f=setInterval(()=>{const R=s.getTracks();(R.length!==U.length||R.some((W,B)=>W!==U[B]))&&h!==null&&h()},1e3)},stop:b}};class Ze{constructor(t,n=0,r){if(n<0||r!==void 0&&r<0)throw new RangeError;const o=t.reduce((d,l)=>d+l.byteLength,0);if(n>o||r!==void 0&&n+r>o)throw new RangeError;const s=[],a=r===void 0?o-n:r,c=[];let i=0,u=n;for(const d of t)if(c.length===0)if(d.byteLength>u){i=d.byteLength-u;const l=i>a?a:i;s.push(new DataView(d,u,l)),c.push(d)}else u-=d.byteLength;else if(ia?d.byteLength-i+a:d.byteLength;s.push(new DataView(d,0,l)),c.push(d)}this._buffers=c,this._byteLength=a,this._byteOffset=u,this._dataViews=s,this._internalBuffer=new DataView(new ArrayBuffer(8))}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get byteOffset(){return this._byteOffset}getFloat32(t,n){return this._internalBuffer.setUint8(0,this.getUint8(t+0)),this._internalBuffer.setUint8(1,this.getUint8(t+1)),this._internalBuffer.setUint8(2,this.getUint8(t+2)),this._internalBuffer.setUint8(3,this.getUint8(t+3)),this._internalBuffer.getFloat32(0,n)}getFloat64(t,n){return this._internalBuffer.setUint8(0,this.getUint8(t+0)),this._internalBuffer.setUint8(1,this.getUint8(t+1)),this._internalBuffer.setUint8(2,this.getUint8(t+2)),this._internalBuffer.setUint8(3,this.getUint8(t+3)),this._internalBuffer.setUint8(4,this.getUint8(t+4)),this._internalBuffer.setUint8(5,this.getUint8(t+5)),this._internalBuffer.setUint8(6,this.getUint8(t+6)),this._internalBuffer.setUint8(7,this.getUint8(t+7)),this._internalBuffer.getFloat64(0,n)}getInt16(t,n){return this._internalBuffer.setUint8(0,this.getUint8(t+0)),this._internalBuffer.setUint8(1,this.getUint8(t+1)),this._internalBuffer.getInt16(0,n)}getInt32(t,n){return this._internalBuffer.setUint8(0,this.getUint8(t+0)),this._internalBuffer.setUint8(1,this.getUint8(t+1)),this._internalBuffer.setUint8(2,this.getUint8(t+2)),this._internalBuffer.setUint8(3,this.getUint8(t+3)),this._internalBuffer.getInt32(0,n)}getInt8(t){const[n,r]=this._findDataViewWithOffset(t);return n.getInt8(t-r)}getUint16(t,n){return this._internalBuffer.setUint8(0,this.getUint8(t+0)),this._internalBuffer.setUint8(1,this.getUint8(t+1)),this._internalBuffer.getUint16(0,n)}getUint32(t,n){return this._internalBuffer.setUint8(0,this.getUint8(t+0)),this._internalBuffer.setUint8(1,this.getUint8(t+1)),this._internalBuffer.setUint8(2,this.getUint8(t+2)),this._internalBuffer.setUint8(3,this.getUint8(t+3)),this._internalBuffer.getUint32(0,n)}getUint8(t){const[n,r]=this._findDataViewWithOffset(t);return n.getUint8(t-r)}setFloat32(t,n,r){this._internalBuffer.setFloat32(0,n,r),this.setUint8(t,this._internalBuffer.getUint8(0)),this.setUint8(t+1,this._internalBuffer.getUint8(1)),this.setUint8(t+2,this._internalBuffer.getUint8(2)),this.setUint8(t+3,this._internalBuffer.getUint8(3))}setFloat64(t,n,r){this._internalBuffer.setFloat64(0,n,r),this.setUint8(t,this._internalBuffer.getUint8(0)),this.setUint8(t+1,this._internalBuffer.getUint8(1)),this.setUint8(t+2,this._internalBuffer.getUint8(2)),this.setUint8(t+3,this._internalBuffer.getUint8(3)),this.setUint8(t+4,this._internalBuffer.getUint8(4)),this.setUint8(t+5,this._internalBuffer.getUint8(5)),this.setUint8(t+6,this._internalBuffer.getUint8(6)),this.setUint8(t+7,this._internalBuffer.getUint8(7))}setInt16(t,n,r){this._internalBuffer.setInt16(0,n,r),this.setUint8(t,this._internalBuffer.getUint8(0)),this.setUint8(t+1,this._internalBuffer.getUint8(1))}setInt32(t,n,r){this._internalBuffer.setInt32(0,n,r),this.setUint8(t,this._internalBuffer.getUint8(0)),this.setUint8(t+1,this._internalBuffer.getUint8(1)),this.setUint8(t+2,this._internalBuffer.getUint8(2)),this.setUint8(t+3,this._internalBuffer.getUint8(3))}setInt8(t,n){const[r,o]=this._findDataViewWithOffset(t);r.setInt8(t-o,n)}setUint16(t,n,r){this._internalBuffer.setUint16(0,n,r),this.setUint8(t,this._internalBuffer.getUint8(0)),this.setUint8(t+1,this._internalBuffer.getUint8(1))}setUint32(t,n,r){this._internalBuffer.setUint32(0,n,r),this.setUint8(t,this._internalBuffer.getUint8(0)),this.setUint8(t+1,this._internalBuffer.getUint8(1)),this.setUint8(t+2,this._internalBuffer.getUint8(2)),this.setUint8(t+3,this._internalBuffer.getUint8(3))}setUint8(t,n){const[r,o]=this._findDataViewWithOffset(t);r.setUint8(t-o,n)}_findDataViewWithOffset(t){let n=0;for(const r of this._dataViews){const o=n+r.byteLength;if(t>=n&&t(r,o,s,a)=>{const c=[],i=new o(s,{mimeType:"audio/webm;codecs=pcm"});let u=null,d=()=>{};const l=h=>{r.dispatchEvent(e("dataavailable",{data:new Blob(h,{type:a})}))},w=async(h,f)=>{const g=await Se(h,f);i.state==="inactive"?c.push(...g):(l(g),u=w(h,f))},m=()=>{i.state!=="inactive"&&(u!==null&&(u.catch(()=>{}),u=null),d(),d=()=>{},i.stop())};return i.addEventListener("error",h=>{m(),r.dispatchEvent(new ErrorEvent("error",{error:h.error}))}),i.addEventListener("pause",()=>r.dispatchEvent(new Event("pause"))),i.addEventListener("resume",()=>r.dispatchEvent(new Event("resume"))),i.addEventListener("start",()=>r.dispatchEvent(new Event("start"))),{get mimeType(){return a},get state(){return i.state},pause(){return i.pause()},resume(){return i.resume()},start(h){const[f]=s.getAudioTracks();if(f!==void 0&&i.state==="inactive"){const{channelCount:g,sampleRate:p}=f.getSettings();if(g===void 0)throw new Error("The channelCount is not defined.");if(p===void 0)throw new Error("The sampleRate is not defined.");let A=!1,_=!1,T=0,E=Xt(a,p);d=()=>{_=!0};const b=Ht(i,"dataavailable")(({data:y})=>{T+=1,E=E.then(async({dataView:v=null,elementType:N=null,encoderId:I,port:M})=>{const U=await y.arrayBuffer();T-=1;const R=v===null?new Ze([U]):new Ze([...v.buffers,U],v.byteOffset);if(!A&&i.state==="recording"&&!_){const D=n(R,0);if(D===null)return{dataView:R,elementType:N,encoderId:I,port:M};const{value:O}=D;if(O!==172351395)return{dataView:v,elementType:N,encoderId:I,port:M};A=!0}const{currentElementType:W,offset:B,contents:S}=t(R,N,g),L=BM.postMessage(D,D.map(({buffer:O})=>O))),T===0&&(i.state==="inactive"||_)&&(Se(I,null).then(D=>{l([...c,...D]),c.length=0,r.dispatchEvent(new Event("stop"))}),M.postMessage([]),M.close(),b()),{dataView:L,elementType:W,encoderId:I,port:M}})});h!==void 0&&E.then(({encoderId:y})=>u=w(y,h))}i.start(100)},stop:m}},Ca=()=>typeof window>"u"?null:window,Vn=(e,t)=>{if(t>=e.byteLength)return null;const n=e.getUint8(t);if(n>127)return 1;if(n>63)return 2;if(n>31)return 3;if(n>15)return 4;if(n>7)return 5;if(n>3)return 6;if(n>1)return 7;if(n>0)return 8;const r=Vn(e,t+1);return r===null?null:r+8},Ta=(e,t)=>n=>{const r={value:e};return Object.defineProperties(n,{currentTarget:r,target:r}),typeof t=="function"?t.call(e,n):t.handleEvent.call(e,n)},xn=[],bt=Ca(),Ma=ir(bt),Fn=er(Ma),Na=ba(Fn,or,sr,Yt),At=fr(Vn),Oa=lr(At),ka=dr(At),Ia=tr(Oa,ka),Sa=Aa(Fn,Ia,At),Ra=rr(bt),La=ur(bt),za=ar(cr,Yt,Na,Sa,xn,nr(Ra,Ta),La),Xa=async e=>{xn.push(await Jn(e))};export{za as MediaRecorder,Xa as register}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/module-DoWOc2fJ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/module-DoWOc2fJ.js new file mode 100644 index 0000000000000000000000000000000000000000..d9c7113af7f647645a69e9e8197d8a7547d32a3f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/module-DoWOc2fJ.js @@ -0,0 +1 @@ +const m=t=>r=>{const e=t(r);return r.add(e),e},O=t=>(r,e)=>(t.set(r,e),e),h=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,p=536870912,l=p*2,b=(t,r)=>e=>{const a=r.get(e);let n=a===void 0?e.size:ah)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;e.has(n);)n=Math.floor(Math.random()*h);return t(e,n)},w=new WeakMap,A=O(w),g=b(A,w),y=m(g),I=(t,r,e,a)=>n=>{const d=r(n);return u=>{const i=t(u);u.addEventListener("message",(({data:s})=>{const{id:o}=s;if(o!==null&&i.has(o)){const{reject:c,resolve:E}=i.get(o);i.delete(o),s.error===void 0?E(s.result):c(new Error(s.error.message))}})),a(u)&&u.start();const M=(s,o=null,c=[])=>new Promise((E,N)=>{const _=e(i);i.set(_,{reject:N,resolve:E}),o===null?u.postMessage({id:_,method:s},c):u.postMessage({id:_,method:s,params:o},c)}),T=(s,o,c=[])=>{u.postMessage({id:null,method:s,params:o},c)};let f={};for(const[s,o]of Object.entries(d))f={...f,[s]:o({call:M,notify:T})};return{...f}}},W=t=>r=>{if(t.has(r))return t.get(r);const e=new Map;return t.set(r,e),e},k=t=>r=>({...r,connect:({call:e})=>async()=>{const{port1:a,port2:n}=new MessageChannel,d=await e("connect",{port:a},[a]);return t.set(n,d),n},disconnect:({call:e})=>async a=>{const n=t.get(a);if(n===void 0)throw new Error("The given port is not connected.");await e("disconnect",{portId:n})},isSupported:({call:e})=>()=>e("isSupported")}),R=t=>typeof t.start=="function",q=I(W(new WeakMap),k(new WeakMap),g,R);export{y as a,q as c,g}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mollweide-XXUPULVr.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mollweide-XXUPULVr.js new file mode 100644 index 0000000000000000000000000000000000000000..d212a8c90da1dfeb14995e7bed0f561ddb7db66e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/mollweide-XXUPULVr.js @@ -0,0 +1,3 @@ +import{I as It}from"./ordinal-BeghXfj9.js";import{f as Se,n as Pu,m as zu,j as ie,o as Iu,q as Tu,r as ku,s as Lu,i as We,u as vr,v as Zn,w as Je,a as Qe,x as yr,y as Rn,h as Ve}from"./linear-8mDBZVC7.js";import{R as $i,x as qu,y as Cu,z as Du,Y as mr,Z as wr,C as Fu,B as nr,X as _r,A as hn,_ as Yu,$ as ju,q as Ou,u as Xu,a0 as Bu,a1 as Hu,v as Uu,a2 as Gu,a3 as Ku,a4 as Zu,a5 as Wu,a6 as Ju,w as Ai,a as K,K as Qu,a7 as Vu,a8 as no,n as to,l as eo,t as ro,b as io,p as uo}from"./step-B-Gbak1k.js";import{m as xr,a as Mr,F as oo,G as ao,E as Sr,i as lo,H as so,I as fo,J as co,A as ho,s as go,u as po,r as vo,v as yo,w as mo,x as wo,y as _o,K as xo,L as Mo}from"./time-BMaLdJ6b.js";import{d as So}from"./dispatch-kxCwF96_.js";import{r as Xn}from"./range-OtVwhkKS.js";import{o as Rt,d as Er,e as Eo,r as $o,c as tr,N as Ni,f as Ao,b as bi,s as No,p as bo}from"./index-BU4IRnz1.js";import{i as Fn,a as zn}from"./init-Dmth1JHB.js";import{a as Ro,f as Po}from"./defaultLocale-CzDG__Ur.js";import{c as _n}from"./colors-Cc3OSVma.js";function zo(n,t){let e=0,r,i=0,u=0;if(t===void 0)for(let o of n)o!=null&&(o=+o)>=o&&(r=o-i,i+=r/++e,u+=r*(o-i));else{let o=-1;for(let a of n)(a=t(a,++o,n))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++e,u+=r*(a-i))}if(e>1)return u/(e-1)}function Zs(n,t){const e=zo(n,t);return e&&Math.sqrt(e)}class tn{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let r=0;for(let i=0;i0){for(o=t[--e];e>0&&(r=o,i=t[--e],o=r+i,u=i-(o-r),!u););e>0&&(u<0&&t[e-1]<0||u>0&&t[e-1]>0)&&(i=u*2,r=o+i,i==r-o&&(o=r))}return o}}function Ws(n,t){return Array.from(t,e=>n[e])}function Io(n=Se){if(n===Se)return Ri;if(typeof n!="function")throw new TypeError("compare is not a function");return(t,e)=>{const r=n(t,e);return r||r===0?r:(n(e,e)===0)-(n(t,t)===0)}}function Ri(n,t){return(n==null||!(n>=n))-(t==null||!(t>=t))||(nt?1:0)}function Pi(n,t,e=0,r=1/0,i){if(t=Math.floor(t),e=Math.floor(Math.max(0,e)),r=Math.floor(Math.min(n.length-1,r)),!(e<=t&&t<=r))return n;for(i=i===void 0?Ri:Io(i);r>e;){if(r-e>600){const f=r-e+1,l=t-e+1,h=Math.log(f),s=.5*Math.exp(2*h/3),c=.5*Math.sqrt(h*s*(f-s)/f)*(l-f/2<0?-1:1),g=Math.max(e,Math.floor(t-l*s/f+c)),d=Math.min(r,Math.floor(t+(f-l)*s/f+c));Pi(n,t,g,d,i)}const u=n[t];let o=e,a=r;for(Jn(n,e,t),i(n[r],u)>0&&Jn(n,e,r);o0;)--a}i(n[e],u)===0?Jn(n,e,a):(++a,Jn(n,a,r)),a<=t&&(e=a+1),t<=a&&(r=a-1)}return n}function Jn(n,t,e){const r=n[t];n[t]=n[e],n[e]=r}function To(n,t,e){if(n=Float64Array.from(Pu(n,e)),!(!(r=n.length)||isNaN(t=+t))){if(t<=0||r<2)return xr(n);if(t>=1)return Mr(n);var r,i=(r-1)*t,u=Math.floor(i),o=Mr(Pi(n,u).subarray(0,u+1)),a=xr(n.subarray(u+1));return o+(a-o)*(i-u)}}function ko(n,t,e=zu){if(!(!(r=n.length)||isNaN(t=+t))){if(t<=0||r<2)return+e(n[0],0,n);if(t>=1)return+e(n[r-1],r-1,n);var r,i=(r-1)*t,u=Math.floor(i),o=+e(n[u],u,n),a=+e(n[u+1],u+1,n);return o+(a-o)*(i-u)}}function Js(n,t){let e=0,r=0;if(t===void 0)for(let i of n)i!=null&&(i=+i)>=i&&(++e,r+=i);else{let i=-1;for(let u of n)(u=t(u,++i,n))!=null&&(u=+u)>=u&&(++e,r+=u)}if(e)return r/e}function Qs(n,t){return To(n,.5,t)}function*Lo(n){for(const t of n)yield*t}function zi(n){return Array.from(Lo(n))}function Vs(n,t){let e=0;for(let r of n)(r=+r)&&(e+=r);return e}function nf(n,...t){n=new It(n),t=t.map(qo);n:for(const e of n)for(const r of t)if(!r.has(e)){n.delete(e);continue n}return n}function qo(n){return n instanceof It?n:new It(n)}function tf(...n){const t=new It;for(const e of n)for(const r of e)t.add(r);return t}var Ii=-.14861,er=1.78277,rr=-.29227,ue=-.90649,ct=1.97294,$r=ct*ue,Ar=ct*er,Nr=er*rr-ue*Ii;function Co(n){if(n instanceof qn)return new qn(n.h,n.s,n.l,n.opacity);n instanceof $i||(n=qu(n));var t=n.r/255,e=n.g/255,r=n.b/255,i=(Nr*r+$r*t-Ar*e)/(Nr+$r-Ar),u=r-i,o=(ct*(e-i)-rr*u)/ue,a=Math.sqrt(o*o+u*u)/(ct*i*(1-i)),f=a?Math.atan2(o,u)*oo-120:NaN;return new qn(f<0?f+360:f,a,i,n.opacity)}function Ee(n,t,e,r){return arguments.length===1?Co(n):new qn(n,t,e,r??1)}function qn(n,t,e,r){this.h=+n,this.s=+t,this.l=+e,this.opacity=+r}Cu(qn,Ee,Du(Fu,{brighter(n){return n=n==null?wr:Math.pow(wr,n),new qn(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?mr:Math.pow(mr,n),new qn(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=isNaN(this.h)?0:(this.h+120)*ao,t=+this.l,e=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(n),i=Math.sin(n);return new $i(255*(t+e*(Ii*r+er*i)),255*(t+e*(rr*r+ue*i)),255*(t+e*(ct*r)),this.opacity)}}));function Do(n){var t=n.length;return function(e){return n[Math.max(0,Math.min(t-1,Math.floor(e*t)))]}}function Fo(n,t){var e=nr(+n,+t);return function(r){var i=e(r);return i-360*Math.floor(i/360)}}var Yo=1e-12;function br(n){return((n=Math.exp(n))+1/n)/2}function jo(n){return((n=Math.exp(n))-1/n)/2}function Oo(n){return((n=Math.exp(2*n))-1)/(n+1)}const Xo=(function n(t,e,r){function i(u,o){var a=u[0],f=u[1],l=u[2],h=o[0],s=o[1],c=o[2],g=h-a,d=s-f,p=g*g+d*d,v,y;if(pl==h>-l?(u=l,l=t[++s]):(u=h,h=r[++c]);let g=0;if(sl==h>-l?(o=l+u,a=u-(o-l),l=t[++s]):(o=h+u,a=u-(o-h),h=r[++c]),u=o,a!==0&&(i[g++]=a);sl==h>-l?(o=u+l,f=o-u,a=u-(o-f)+(l-f),l=t[++s]):(o=u+h,f=o-u,a=u-(o-f)+(h-f),h=r[++c]),u=o,a!==0&&(i[g++]=a);for(;s=L||-P>=L||(s=n-M,a=n-(M+s)+(s-i),s=e-N,l=e-(N+s)+(s-i),s=t-$,f=t-($+s)+(s-u),s=r-z,h=r-(z+s)+(s-u),a===0&&f===0&&l===0&&h===0)||(L=na*o+Wo*Math.abs(P),P+=M*h+z*a-($*l+N*f),P>=L||-P>=L))return P;m=a*z,c=G*a,g=c-(c-a),d=a-g,c=G*z,p=c-(c-z),v=z-p,x=d*v-(m-g*p-d*p-g*v),E=f*N,c=G*f,g=c-(c-f),d=f-g,c=G*N,p=c-(c-N),v=N-p,b=d*v-(E-g*p-d*p-g*v),y=x-b,s=x-y,Z[0]=x-(y+s)+(s-b),w=m+y,s=w-m,_=m-(w-s)+(y-s),y=_-E,s=_-y,Z[1]=_-(y+s)+(s-E),A=w+y,s=A-w,Z[2]=w-(A-s)+(y-s),Z[3]=A;const S=ce(4,jn,4,Z,Rr);m=M*h,c=G*M,g=c-(c-M),d=M-g,c=G*h,p=c-(c-h),v=h-p,x=d*v-(m-g*p-d*p-g*v),E=$*l,c=G*$,g=c-(c-$),d=$-g,c=G*l,p=c-(c-l),v=l-p,b=d*v-(E-g*p-d*p-g*v),y=x-b,s=x-y,Z[0]=x-(y+s)+(s-b),w=m+y,s=w-m,_=m-(w-s)+(y-s),y=_-E,s=_-y,Z[1]=_-(y+s)+(s-E),A=w+y,s=A-w,Z[2]=w-(A-s)+(y-s),Z[3]=A;const R=ce(S,Rr,4,Z,Pr);m=a*h,c=G*a,g=c-(c-a),d=a-g,c=G*h,p=c-(c-h),v=h-p,x=d*v-(m-g*p-d*p-g*v),E=f*l,c=G*f,g=c-(c-f),d=f-g,c=G*l,p=c-(c-l),v=l-p,b=d*v-(E-g*p-d*p-g*v),y=x-b,s=x-y,Z[0]=x-(y+s)+(s-b),w=m+y,s=w-m,_=m-(w-s)+(y-s),y=_-E,s=_-y,Z[1]=_-(y+s)+(s-E),A=w+y,s=A-w,Z[2]=w-(A-s)+(y-s),Z[3]=A;const q=ce(R,Pr,4,Z,zr);return zr[q-1]}function wt(n,t,e,r,i,u){const o=(t-u)*(e-i),a=(n-i)*(r-u),f=o-a,l=Math.abs(o+a);return Math.abs(f)>=Qo*l?f:-ta(n,t,e,r,i,u,l)}const Ir=Math.pow(2,-52),_t=new Uint32Array(512);class Tt{static from(t,e=oa,r=aa){const i=t.length,u=new Float64Array(i*2);for(let o=0;o>1;if(e>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const r=Math.max(2*e-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:r,_hullTri:i,_hullHash:u}=this,o=t.length>>1;let a=1/0,f=1/0,l=-1/0,h=-1/0;for(let M=0;Ml&&(l=N),$>h&&(h=$),this._ids[M]=M}const s=(a+l)/2,c=(f+h)/2;let g,d,p;for(let M=0,N=1/0;M0&&(d=M,N=$)}let w=t[2*d],_=t[2*d+1],m=1/0;for(let M=0;Mz&&(M[N++]=P,z=L)}this.hull=M.subarray(0,N),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(wt(v,y,w,_,x,E)<0){const M=d,N=w,$=_;d=p,w=x,_=E,p=M,x=N,E=$}const b=ua(v,y,w,_,x,E);this._cx=b.x,this._cy=b.y;for(let M=0;M0&&Math.abs(P-N)<=Ir&&Math.abs(L-$)<=Ir||(N=P,$=L,z===g||z===d||z===p))continue;let S=0;for(let fn=0,dn=this._hashKey(P,L);fn=0;)if(R=q,R===S){R=-1;break}if(R===-1)continue;let j=this._addTriangle(R,z,r[R],-1,-1,i[R]);i[z]=this._legalize(j+2),i[R]=j,A++;let Y=r[R];for(;q=r[Y],wt(P,L,t[2*Y],t[2*Y+1],t[2*q],t[2*q+1])<0;)j=this._addTriangle(Y,z,q,i[z],-1,i[Y]),i[z]=this._legalize(j+2),r[Y]=Y,A--,Y=q;if(R===S)for(;q=e[R],wt(P,L,t[2*q],t[2*q+1],t[2*R],t[2*R+1])<0;)j=this._addTriangle(q,z,R,-1,i[R],i[q]),this._legalize(j+2),i[q]=j,r[R]=R,A--,R=q;this._hullStart=e[z]=R,r[R]=e[Y]=z,r[z]=Y,u[this._hashKey(P,L)]=z,u[this._hashKey(t[2*R],t[2*R+1])]=R}this.hull=new Uint32Array(A);for(let M=0,N=this._hullStart;M0?3-e:1+e)/4}function he(n,t,e,r){const i=n-e,u=t-r;return i*i+u*u}function ra(n,t,e,r,i,u,o,a){const f=n-o,l=t-a,h=e-o,s=r-a,c=i-o,g=u-a,d=f*f+l*l,p=h*h+s*s,v=c*c+g*g;return f*(s*v-p*g)-l*(h*v-p*c)+d*(h*g-s*c)<0}function ia(n,t,e,r,i,u){const o=e-n,a=r-t,f=i-n,l=u-t,h=o*o+a*a,s=f*f+l*l,c=.5/(o*l-a*f),g=(l*h-a*s)*c,d=(o*s-f*h)*c;return g*g+d*d}function ua(n,t,e,r,i,u){const o=e-n,a=r-t,f=i-n,l=u-t,h=o*o+a*a,s=f*f+l*l,c=.5/(o*l-a*f),g=n+(l*h-a*s)*c,d=t+(o*s-f*h)*c;return{x:g,y:d}}function Bn(n,t,e,r){if(r-e<=20)for(let i=e+1;i<=r;i++){const u=n[i],o=t[u];let a=i-1;for(;a>=e&&t[n[a]]>o;)n[a+1]=n[a--];n[a+1]=u}else{const i=e+r>>1;let u=e+1,o=r;Qn(n,i,u),t[n[e]]>t[n[r]]&&Qn(n,e,r),t[n[u]]>t[n[r]]&&Qn(n,u,r),t[n[e]]>t[n[u]]&&Qn(n,e,u);const a=n[u],f=t[a];for(;;){do u++;while(t[n[u]]f);if(o=o-e?(Bn(n,t,u,r),Bn(n,t,e,o-1)):(Bn(n,t,e,o-1),Bn(n,t,u,r))}}function Qn(n,t,e){const r=n[t];n[t]=n[e],n[e]=r}function oa(n){return n[0]}function aa(n){return n[1]}const Tr=1e-6;class Ln{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,r){t=+t,e=+e,r=+r;const i=t+r,u=e;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${u}`:(Math.abs(this._x1-i)>Tr||Math.abs(this._y1-u)>Tr)&&(this._+="L"+i+","+u),r&&(this._+=`A${r},${r},0,1,1,${t-r},${e}A${r},${r},0,1,1,${this._x1=i},${this._y1=u}`)}rect(t,e,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+r}v${+i}h${-r}Z`}value(){return this._||null}}class $e{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}class la{constructor(t,[e,r,i,u]=[0,0,960,500]){if(!((i=+i)>=(e=+e))||!((u=+u)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=e,this.ymax=u,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:r},vectors:i}=this;let u,o;const a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let p=0,v=0,y=r.length,w,_;p1;)u-=2;for(let o=2;o0){if(e>=this.ymax)return null;(o=(this.ymax-e)/i)0){if(t>=this.xmax)return null;(o=(this.xmax-t)/r)this.xmax?2:0)|(ethis.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let e=0;e1e-10)return!1}return!0}function ga(n,t,e){return[n+Math.sin(n+t)*e,t+Math.cos(n-t)*e]}class qi{static from(t,e=fa,r=ca,i){return new qi("length"in t?pa(t,e,r,i):Float64Array.from(da(t,e,r,i)))}constructor(t){this._delaunator=new Tt(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,e=this.points;if(t.hull&&t.hull.length>2&&ha(t)){this.collinear=Int32Array.from({length:e.length/2},(c,g)=>g).sort((c,g)=>e[2*c]-e[2*g]||e[2*c+1]-e[2*g+1]);const f=this.collinear[0],l=this.collinear[this.collinear.length-1],h=[e[2*f],e[2*f+1],e[2*l],e[2*l+1]],s=1e-8*Math.hypot(h[3]-h[1],h[2]-h[0]);for(let c=0,g=e.length/2;c0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],o[i[0]]=1,i.length===2&&(o[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new la(this,t)}*neighbors(t){const{inedges:e,hull:r,_hullIndex:i,halfedges:u,triangles:o,collinear:a}=this;if(a){const s=a.indexOf(t);s>0&&(yield a[s-1]),s=0&&u!==r&&u!==i;)r=u;return u}_step(t,e,r){const{inedges:i,hull:u,_hullIndex:o,halfedges:a,triangles:f,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let h=t,s=On(e-l[t*2],2)+On(r-l[t*2+1],2);const c=i[t];let g=c;do{let d=f[g];const p=On(e-l[d*2],2)+On(r-l[d*2+1],2);if(p=(s=(a+l)/2))?a=s:l=s,(v=e>=(c=(f+h)/2))?f=c:h=c,i=u,!(u=u[y=v<<1|p]))return i[y]=o,n;if(g=+n._x.call(null,u.data),d=+n._y.call(null,u.data),t===g&&e===d)return o.next=u,i?i[y]=o:n._root=o,n;do i=i?i[y]=new Array(4):n._root=new Array(4),(p=t>=(s=(a+l)/2))?a=s:l=s,(v=e>=(c=(f+h)/2))?f=c:h=c;while((y=v<<1|p)===(w=(d>=c)<<1|g>=s));return i[w]=u,i[y]=o,n}function ya(n){var t,e,r=n.length,i,u,o=new Array(r),a=new Array(r),f=1/0,l=1/0,h=-1/0,s=-1/0;for(e=0;eh&&(h=i),us&&(s=u));if(f>h||l>s)return this;for(this.cover(f,l).cover(h,s),e=0;en||n>=i||r>t||t>=u;)switch(l=(th||(a=d.y0)>s||(f=d.x1)=y)<<1|n>=v)&&(d=c[c.length-1],c[c.length-1]=c[c.length-1-p],c[c.length-1-p]=d)}else{var w=n-+this._x.call(null,g.data),_=t-+this._y.call(null,g.data),m=w*w+_*_;if(m=(c=(o+f)/2))?o=c:f=c,(p=s>=(g=(a+l)/2))?a=g:l=g,t=e,!(e=e[v=p<<1|d]))return this;if(!e.length)break;(t[v+1&3]||t[v+2&3]||t[v+3&3])&&(r=t,y=v)}for(;e.data!==n;)if(i=e,!(e=e.next))return this;return(u=e.next)&&delete e.next,i?(u?i.next=u:delete i.next,this):t?(u?t[v]=u:delete t[v],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(r?r[y]=e:this._root=e),this):(this._root=u,this)}function Sa(n){for(var t=0,e=n.length;tc.index){var $=g-A.x-A.vx,z=d-A.y-A.vy,P=$*$+z*z;Pg+N||Ed+N||bl.r&&(l.r=l[h].r)}function f(){if(t){var l,h=t.length,s;for(e=new Array(h),l=0;l[t(x,E,o),x])),m;for(v=0,a=new Array(y);v(n=(La*n+qa)%qr)/qr}function Da(n){return n.x}function Fa(n){return n.y}var Ya=10,ja=Math.PI*(3-Math.sqrt(5));function lf(n){var t,e=1,r=.001,i=1-Math.pow(r,1/300),u=0,o=.6,a=new Map,f=Ju(s),l=So("tick","end"),h=Ca();n==null&&(n=[]);function s(){c(),l.call("tick",t),e1?(v==null?a.delete(p):a.set(p,d(v)),t):a.get(p)},find:function(p,v,y){var w=0,_=n.length,m,x,E,b,A;for(y==null?y=1/0:y*=y,w=0;w<_;++w)b=n[w],m=p-b.x,x=v-b.y,E=m*m+x*x,E1?(l.on(p,v),t):l.on(p)}}}function sf(){var n,t,e,r,i=nn(-30),u,o=1,a=1/0,f=.81;function l(g){var d,p=n.length,v=ir(n,Da,Fa).visitAfter(s);for(r=g,d=0;d=a)return;(g.data!==t||g.next)&&(y===0&&(y=Pn(e),m+=y*y),w===0&&(w=Pn(e),m+=w*w),m0?1:n<0?-1:0},rn=Math.sqrt,or=Math.tan;function Fi(n){return n>1?0:n<-1?D:Math.acos(n)}function an(n){return n>1?B:n<-1?-B:Math.asin(n)}function U(){}function Ct(n,t){n&&Dr.hasOwnProperty(n.type)&&Dr[n.type](n,t)}var Cr={Feature:function(n,t){Ct(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;++r=0?1:-1,i=r*e,u=k(t),o=I(t),a=Pe*o,f=Re*u+a*k(i),l=a*r*I(i);Dt.add(pn(l,f)),be=n,Re=u,Pe=o}function hf(n){return Ft=new tn,En(n,wn),Ft*2}function Yt(n){return[pn(n[1],n[0]),an(n[2])]}function Cn(n){var t=n[0],e=n[1],r=k(e);return[r*k(t),r*I(t),I(e)]}function Mt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function Gn(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function pe(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function St(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function jt(n){var t=rn(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var O,on,X,sn,kn,Xi,Bi,Un,ot,bn,Nn,Sn={point:ze,lineStart:Yr,lineEnd:jr,polygonStart:function(){Sn.point=Ui,Sn.lineStart=Ha,Sn.lineEnd=Ua,ot=new tn,wn.polygonStart()},polygonEnd:function(){wn.polygonEnd(),Sn.point=ze,Sn.lineStart=Yr,Sn.lineEnd=jr,Dt<0?(O=-(X=180),on=-(sn=90)):ot>T?sn=90:ot<-T&&(on=-90),Nn[0]=O,Nn[1]=X},sphere:function(){O=-(X=180),on=-(sn=90)}};function ze(n,t){bn.push(Nn=[O=n,X=n]),tsn&&(sn=t)}function Hi(n,t){var e=Cn([n*C,t*C]);if(Un){var r=Gn(Un,e),i=[r[1],-r[0],0],u=Gn(i,r);jt(u),u=Yt(u);var o=n-kn,a=o>0?1:-1,f=u[0]*H*a,l,h=F(o)>180;h^(a*knsn&&(sn=l)):(f=(f+360)%360-180,h^(a*knsn&&(sn=t))),h?nln(O,X)&&(X=n):ln(n,X)>ln(O,X)&&(O=n):X>=O?(nX&&(X=n)):n>kn?ln(O,n)>ln(O,X)&&(X=n):ln(n,X)>ln(O,X)&&(O=n)}else bn.push(Nn=[O=n,X=n]);tsn&&(sn=t),Un=e,kn=n}function Yr(){Sn.point=Hi}function jr(){Nn[0]=O,Nn[1]=X,Sn.point=ze,Un=null}function Ui(n,t){if(Un){var e=n-kn;ot.add(F(e)>180?e+(e>0?360:-360):e)}else Xi=n,Bi=t;wn.point(n,t),Hi(n,t)}function Ha(){wn.lineStart()}function Ua(){Ui(Xi,Bi),wn.lineEnd(),F(ot)>T&&(O=-(X=180)),Nn[0]=O,Nn[1]=X,Un=null}function ln(n,t){return(t-=n)<0?t+360:t}function Ga(n,t){return n[0]-t[0]}function Or(n,t){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:tln(r[0],r[1])&&(r[1]=i[1]),ln(i[0],r[1])>ln(r[0],r[1])&&(r[0]=i[0])):u.push(r=i);for(o=-1/0,e=u.length-1,t=0,r=u[e];t<=e;r=i,++t)i=u[t],(a=ln(r[1],i[0]))>o&&(o=a,O=i[0],X=r[1])}return bn=Nn=null,O===1/0||on===1/0?[[NaN,NaN],[NaN,NaN]]:[[O,on],[X,sn]]}var Vn,Ot,Xt,Bt,Ht,Ut,Gt,Kt,Ie,Te,ke,Gi,Ki,W,J,Q,vn={sphere:U,point:ar,lineStart:Xr,lineEnd:Br,polygonStart:function(){vn.lineStart=Wa,vn.lineEnd=Ja},polygonEnd:function(){vn.lineStart=Xr,vn.lineEnd=Br}};function ar(n,t){n*=C,t*=C;var e=k(t);vt(e*k(n),e*I(n),I(t))}function vt(n,t,e){++Vn,Xt+=(n-Xt)/Vn,Bt+=(t-Bt)/Vn,Ht+=(e-Ht)/Vn}function Xr(){vn.point=Ka}function Ka(n,t){n*=C,t*=C;var e=k(t);W=e*k(n),J=e*I(n),Q=I(t),vn.point=Za,vt(W,J,Q)}function Za(n,t){n*=C,t*=C;var e=k(t),r=e*k(n),i=e*I(n),u=I(t),o=pn(rn((o=J*u-Q*i)*o+(o=Q*r-W*u)*o+(o=W*i-J*r)*o),W*r+J*i+Q*u);Ot+=o,Ut+=o*(W+(W=r)),Gt+=o*(J+(J=i)),Kt+=o*(Q+(Q=u)),vt(W,J,Q)}function Br(){vn.point=ar}function Wa(){vn.point=Qa}function Ja(){Zi(Gi,Ki),vn.point=ar}function Qa(n,t){Gi=n,Ki=t,n*=C,t*=C,vn.point=Zi;var e=k(t);W=e*k(n),J=e*I(n),Q=I(t),vt(W,J,Q)}function Zi(n,t){n*=C,t*=C;var e=k(t),r=e*k(n),i=e*I(n),u=I(t),o=J*u-Q*i,a=Q*r-W*u,f=W*i-J*r,l=Ae(o,a,f),h=an(l),s=l&&-h/l;Ie.add(s*o),Te.add(s*a),ke.add(s*f),Ot+=h,Ut+=h*(W+(W=r)),Gt+=h*(J+(J=i)),Kt+=h*(Q+(Q=u)),vt(W,J,Q)}function pf(n){Vn=Ot=Xt=Bt=Ht=Ut=Gt=Kt=0,Ie=new tn,Te=new tn,ke=new tn,En(n,vn);var t=+Ie,e=+Te,r=+ke,i=Ae(t,e,r);return iD&&(n-=Math.round(n/en)*en),[n,t]}qe.invert=qe;function Wi(n,t,e){return(n%=en)?t||e?Le(Ur(n),Gr(t,e)):Ur(n):t||e?Gr(t,e):qe}function Hr(n){return function(t,e){return t+=n,F(t)>D&&(t-=Math.round(t/en)*en),[t,e]}}function Ur(n){var t=Hr(n);return t.invert=Hr(-n),t}function Gr(n,t){var e=k(n),r=I(n),i=k(t),u=I(t);function o(a,f){var l=k(f),h=k(a)*l,s=I(a)*l,c=I(f),g=c*e+h*r;return[pn(s*i-g*u,h*e-c*r),an(g*i+s*u)]}return o.invert=function(a,f){var l=k(f),h=k(a)*l,s=I(a)*l,c=I(f),g=c*i-s*u;return[pn(s*i+c*u,h*e+g*r),an(g*e-h*r)]},o}function Va(n){n=Wi(n[0]*C,n[1]*C,n.length>2?n[2]*C:0);function t(e){return e=n(e[0]*C,e[1]*C),e[0]*=H,e[1]*=H,e}return t.invert=function(e){return e=n.invert(e[0]*C,e[1]*C),e[0]*=H,e[1]*=H,e},t}function nl(n,t,e,r,i,u){if(e){var o=k(t),a=I(t),f=r*e;i==null?(i=t+r*en,u=t-f/2):(i=Kr(o,i),u=Kr(o,u),(r>0?iu)&&(i+=r*en));for(var l,h=i;r>0?h>u:h1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Pt(n,t){return F(n[0]-t[0])=0;--a)i.point((s=h[a])[0],s[1]);else r(c.x,c.p.x,-1,i);c=c.p}c=c.o,h=c.z,g=!g}while(!c.v);i.lineEnd()}}}function Zr(n){if(t=n.length){for(var t,e=0,r=n[0],i;++e=0?1:-1,N=M*A,$=N>D,z=v*E;if(f.add(pn(z*M*I(N),y*b+z*k(N))),o+=$?A+M*en:A,$^d>=e^m>=e){var P=Gn(Cn(g),Cn(_));jt(P);var L=Gn(u,P);jt(L);var S=($^A>=0?-1:1)*an(L[2]);(r>S||r===S&&(P[0]||P[1]))&&(a+=$^A>=0?1:-1)}}return(o<-T||o0){for(f||(i.polygonStart(),f=!0),i.lineStart(),E=0;E1&&m&2&&x.push(x.pop().concat(x.shift())),h.push(x.filter(el))}}return c}}function el(n){return n.length>1}function rl(n,t){return((n=n.x)[0]<0?n[1]-B-T:B-n[1])-((t=t.x)[0]<0?t[1]-B-T:B-t[1])}const Wr=Vi(function(){return!0},il,ol,[-D,-B]);function il(n){var t=NaN,e=NaN,r=NaN,i;return{lineStart:function(){n.lineStart(),i=1},point:function(u,o){var a=u>0?D:-D,f=F(u-t);F(f-D)0?B:-B),n.point(r,e),n.lineEnd(),n.lineStart(),n.point(a,e),n.point(u,e),i=0):r!==a&&f>=D&&(F(t-r)T?Wn((I(t)*(u=k(r))*I(e)-I(r)*(i=k(t))*I(n))/(i*u*o)):(t+r)/2}function ol(n,t,e,r){var i;if(n==null)i=e*B,r.point(-D,i),r.point(0,i),r.point(D,i),r.point(D,0),r.point(D,-i),r.point(0,-i),r.point(-D,-i),r.point(-D,0),r.point(-D,i);else if(F(n[0]-t[0])>T){var u=n[0]0,i=F(t)>T;function u(h,s,c,g){nl(g,n,e,c,h,s)}function o(h,s){return k(h)*k(s)>t}function a(h){var s,c,g,d,p;return{lineStart:function(){d=g=!1,p=1},point:function(v,y){var w=[v,y],_,m=o(v,y),x=r?m?0:l(v,y):m?l(v+(v<0?D:-D),y):0;if(!s&&(d=g=m)&&h.lineStart(),m!==g&&(_=f(s,w),(!_||Pt(s,_)||Pt(w,_))&&(w[2]=1)),m!==g)p=0,m?(h.lineStart(),_=f(w,s),h.point(_[0],_[1])):(_=f(s,w),h.point(_[0],_[1],2),h.lineEnd()),s=_;else if(i&&s&&r^m){var E;!(x&c)&&(E=f(w,s,!0))&&(p=0,r?(h.lineStart(),h.point(E[0][0],E[0][1]),h.point(E[1][0],E[1][1]),h.lineEnd()):(h.point(E[1][0],E[1][1]),h.lineEnd(),h.lineStart(),h.point(E[0][0],E[0][1],3)))}m&&(!s||!Pt(s,w))&&h.point(w[0],w[1]),s=w,g=m,c=x},lineEnd:function(){g&&h.lineEnd(),s=null},clean:function(){return p|(d&&g)<<1}}}function f(h,s,c){var g=Cn(h),d=Cn(s),p=[1,0,0],v=Gn(g,d),y=Mt(v,v),w=v[0],_=y-w*w;if(!_)return!c&&h;var m=t*y/_,x=-t*w/_,E=Gn(p,v),b=St(p,m),A=St(v,x);pe(b,A);var M=E,N=Mt(b,M),$=Mt(M,M),z=N*N-$*(Mt(b,b)-1);if(!(z<0)){var P=rn(z),L=St(M,(-N-P)/$);if(pe(L,b),L=Yt(L),!c)return L;var S=h[0],R=s[0],q=h[1],j=s[1],Y;R0^L[1]<(F(L[0]-S)D^(S<=L[0]&&L[0]<=R)){var Mn=St(M,(-N+P)/$);return pe(Mn,b),[L,Yt(Mn)]}}}function l(h,s){var c=r?n:D-n,g=0;return h<-c?g|=1:h>c&&(g|=2),s<-c?g|=4:s>c&&(g|=8),g}return Vi(o,a,u,r?[0,-n]:[-D,n-D])}function ll(n,t,e,r,i,u){var o=n[0],a=n[1],f=t[0],l=t[1],h=0,s=1,c=f-o,g=l-a,d;if(d=e-o,!(!c&&d>0)){if(d/=c,c<0){if(d0){if(d>s)return;d>h&&(h=d)}if(d=i-o,!(!c&&d<0)){if(d/=c,c<0){if(d>s)return;d>h&&(h=d)}else if(c>0){if(d0)){if(d/=g,g<0){if(d0){if(d>s)return;d>h&&(h=d)}if(d=u-a,!(!g&&d<0)){if(d/=g,g<0){if(d>s)return;d>h&&(h=d)}else if(g>0){if(d0&&(n[0]=o+h*c,n[1]=a+h*g),s<1&&(t[0]=o+s*c,t[1]=a+s*g),!0}}}}}var nt=1e9,$t=-nt;function nu(n,t,e,r){function i(l,h){return n<=l&&l<=e&&t<=h&&h<=r}function u(l,h,s,c){var g=0,d=0;if(l==null||(g=o(l,s))!==(d=o(h,s))||f(l,h)<0^s>0)do c.point(g===0||g===3?n:e,g>1?r:t);while((g=(g+s+4)%4)!==d);else c.point(h[0],h[1])}function o(l,h){return F(l[0]-n)0?0:3:F(l[0]-e)0?2:1:F(l[1]-t)0?1:0:h>0?3:2}function a(l,h){return f(l.x,h.x)}function f(l,h){var s=o(l,1),c=o(h,1);return s!==c?s-c:s===0?h[1]-l[1]:s===1?l[0]-h[0]:s===2?l[1]-h[1]:h[0]-l[0]}return function(l){var h=l,s=Ji(),c,g,d,p,v,y,w,_,m,x,E,b={point:A,lineStart:z,lineEnd:P,polygonStart:N,polygonEnd:$};function A(S,R){i(S,R)&&h.point(S,R)}function M(){for(var S=0,R=0,q=g.length;Rr&&(mt-Tn)*(r-Mn)>(Yn-Mn)*(n-Tn)&&++S:Yn<=r&&(mt-Tn)*(r-Mn)<(Yn-Mn)*(n-Tn)&&--S;return S}function N(){h=s,c=[],g=[],E=!0}function $(){var S=M(),R=E&&S,q=(c=zi(c)).length;(R||q)&&(l.polygonStart(),R&&(l.lineStart(),u(null,null,1,l),l.lineEnd()),q&&Qi(c,a,S,u,l),l.polygonEnd()),h=l,c=g=d=null}function z(){b.point=L,g&&g.push(d=[]),x=!0,m=!1,w=_=NaN}function P(){c&&(L(p,v),y&&m&&s.rejoin(),c.push(s.result())),b.point=A,m&&h.lineEnd()}function L(S,R){var q=i(S,R);if(g&&d.push([S,R]),x)p=S,v=R,y=q,x=!1,q&&(h.lineStart(),h.point(S,R));else if(q&&m)h.point(S,R);else{var j=[w=Math.max($t,Math.min(nt,w)),_=Math.max($t,Math.min(nt,_))],Y=[S=Math.max($t,Math.min(nt,S)),R=Math.max($t,Math.min(nt,R))];ll(j,Y,n,t,e,r)?(m||(h.lineStart(),h.point(j[0],j[1])),h.point(Y[0],Y[1]),q||h.lineEnd(),E=!1):q&&(h.lineStart(),h.point(S,R),E=!1)}w=S,_=R,m=q}return b}}function Jr(n,t,e){var r=Xn(n,t-T,e).concat(t);return function(i){return r.map(function(u){return[i,u]})}}function Qr(n,t,e){var r=Xn(n,t-T,e).concat(t);return function(i){return r.map(function(u){return[u,i]})}}function df(){var n,t,e,r,i,u,o,a,f=10,l=f,h=90,s=360,c,g,d,p,v=2.5;function y(){return{type:"MultiLineString",coordinates:w()}}function w(){return Xn(xt(r/h)*h,e,h).map(d).concat(Xn(xt(a/s)*s,o,s).map(p)).concat(Xn(xt(t/f)*f,n,f).filter(function(_){return F(_%h)>T}).map(c)).concat(Xn(xt(u/l)*l,i,l).filter(function(_){return F(_%s)>T}).map(g))}return y.lines=function(){return w().map(function(_){return{type:"LineString",coordinates:_}})},y.outline=function(){return{type:"Polygon",coordinates:[d(r).concat(p(o).slice(1),d(e).reverse().slice(1),p(a).reverse().slice(1))]}},y.extent=function(_){return arguments.length?y.extentMajor(_).extentMinor(_):y.extentMinor()},y.extentMajor=function(_){return arguments.length?(r=+_[0][0],e=+_[1][0],a=+_[0][1],o=+_[1][1],r>e&&(_=r,r=e,e=_),a>o&&(_=a,a=o,o=_),y.precision(v)):[[r,a],[e,o]]},y.extentMinor=function(_){return arguments.length?(t=+_[0][0],n=+_[1][0],u=+_[0][1],i=+_[1][1],t>n&&(_=t,t=n,n=_),u>i&&(_=u,u=i,i=_),y.precision(v)):[[t,u],[n,i]]},y.step=function(_){return arguments.length?y.stepMajor(_).stepMinor(_):y.stepMinor()},y.stepMajor=function(_){return arguments.length?(h=+_[0],s=+_[1],y):[h,s]},y.stepMinor=function(_){return arguments.length?(f=+_[0],l=+_[1],y):[f,l]},y.precision=function(_){return arguments.length?(v=+_,c=Jr(u,i,90),g=Qr(t,n,v),d=Jr(a,o,90),p=Qr(r,e,v),y):v},y.extentMajor([[-180,-90+T],[180,90-T]]).extentMinor([[-180,-80-T],[180,80+T]])}const ht=n=>n;var ve=new tn,Ce=new tn,tu,eu,De,Fe,$n={point:U,lineStart:U,lineEnd:U,polygonStart:function(){$n.lineStart=sl,$n.lineEnd=cl},polygonEnd:function(){$n.lineStart=$n.lineEnd=$n.point=U,ve.add(F(Ce)),Ce=new tn},result:function(){var n=ve/2;return ve=new tn,n}};function sl(){$n.point=fl}function fl(n,t){$n.point=ru,tu=De=n,eu=Fe=t}function ru(n,t){Ce.add(Fe*n-De*t),De=n,Fe=t}function cl(){ru(tu,eu)}var Kn=1/0,Zt=Kn,gt=-Kn,Wt=gt,Jt={point:hl,lineStart:U,lineEnd:U,polygonStart:U,polygonEnd:U,result:function(){var n=[[Kn,Zt],[gt,Wt]];return gt=Wt=-(Zt=Kn=1/0),n}};function hl(n,t){ngt&&(gt=n),tWt&&(Wt=t)}var Ye=0,je=0,tt=0,Qt=0,Vt=0,Hn=0,Oe=0,Xe=0,et=0,iu,uu,yn,mn,cn={point:Dn,lineStart:Vr,lineEnd:ni,polygonStart:function(){cn.lineStart=dl,cn.lineEnd=vl},polygonEnd:function(){cn.point=Dn,cn.lineStart=Vr,cn.lineEnd=ni},result:function(){var n=et?[Oe/et,Xe/et]:Hn?[Qt/Hn,Vt/Hn]:tt?[Ye/tt,je/tt]:[NaN,NaN];return Ye=je=tt=Qt=Vt=Hn=Oe=Xe=et=0,n}};function Dn(n,t){Ye+=n,je+=t,++tt}function Vr(){cn.point=gl}function gl(n,t){cn.point=pl,Dn(yn=n,mn=t)}function pl(n,t){var e=n-yn,r=t-mn,i=rn(e*e+r*r);Qt+=i*(yn+n)/2,Vt+=i*(mn+t)/2,Hn+=i,Dn(yn=n,mn=t)}function ni(){cn.point=Dn}function dl(){cn.point=yl}function vl(){ou(iu,uu)}function yl(n,t){cn.point=ou,Dn(iu=yn=n,uu=mn=t)}function ou(n,t){var e=n-yn,r=t-mn,i=rn(e*e+r*r);Qt+=i*(yn+n)/2,Vt+=i*(mn+t)/2,Hn+=i,i=mn*n-yn*t,Oe+=i*(yn+n),Xe+=i*(mn+t),et+=i*3,Dn(yn=n,mn=t)}function au(n){this._context=n}au.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,en);break}}},result:U};var Be=new tn,ye,lu,su,rt,it,pt={point:U,lineStart:function(){pt.point=ml},lineEnd:function(){ye&&fu(lu,su),pt.point=U},polygonStart:function(){ye=!0},polygonEnd:function(){ye=null},result:function(){var n=+Be;return Be=new tn,n}};function ml(n,t){pt.point=fu,lu=rt=n,su=it=t}function fu(n,t){rt-=n,it-=t,Be.add(rn(rt*rt+it*it)),rt=n,it=t}let ti,ne,ei,ri;class ii{constructor(t){this._append=t==null?cu:wl(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,e){switch(this._point){case 0:{this._append`M${t},${e}`,this._point=1;break}case 1:{this._append`L${t},${e}`;break}default:{if(this._append`M${t},${e}`,this._radius!==ei||this._append!==ne){const r=this._radius,i=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,ei=r,ne=this._append,ri=this._,this._=i}this._+=ri;break}}}result(){const t=this._;return this._="",t.length?t:null}}function cu(n){let t=1;this._+=n[0];for(const e=n.length;t=0))throw new RangeError(`invalid digits: ${n}`);if(t>15)return cu;if(t!==ti){const e=10**t;ti=t,ne=function(i){let u=1;this._+=i[0];for(const o=i.length;u=0))throw new RangeError(`invalid digits: ${a}`);e=f}return t===null&&(u=new ii(e)),o},o.projection(n).digits(e).context(t)}function oe(n){return function(t){var e=new He;for(var r in n)e[r]=n[r];return e.stream=t,e}}function He(){}He.prototype={constructor:He,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function lr(n,t,e){var r=n.clipExtent&&n.clipExtent();return n.scale(150).translate([0,0]),r!=null&&n.clipExtent(null),En(e,n.stream(Jt)),t(Jt.result()),r!=null&&n.clipExtent(r),n}function ae(n,t,e){return lr(n,function(r){var i=t[1][0]-t[0][0],u=t[1][1]-t[0][1],o=Math.min(i/(r[1][0]-r[0][0]),u/(r[1][1]-r[0][1])),a=+t[0][0]+(i-o*(r[1][0]+r[0][0]))/2,f=+t[0][1]+(u-o*(r[1][1]+r[0][1]))/2;n.scale(150*o).translate([a,f])},e)}function sr(n,t,e){return ae(n,[[0,0],t],e)}function fr(n,t,e){return lr(n,function(r){var i=+t,u=i/(r[1][0]-r[0][0]),o=(i-u*(r[1][0]+r[0][0]))/2,a=-u*r[0][1];n.scale(150*u).translate([o,a])},e)}function cr(n,t,e){return lr(n,function(r){var i=+t,u=i/(r[1][1]-r[0][1]),o=-u*r[0][0],a=(i-u*(r[1][1]+r[0][1]))/2;n.scale(150*u).translate([o,a])},e)}var ui=16,_l=k(30*C);function oi(n,t){return+t?Ml(n,t):xl(n)}function xl(n){return oe({point:function(t,e){t=n(t,e),this.stream.point(t[0],t[1])}})}function Ml(n,t){function e(r,i,u,o,a,f,l,h,s,c,g,d,p,v){var y=l-r,w=h-i,_=y*y+w*w;if(_>4*t&&p--){var m=o+c,x=a+g,E=f+d,b=rn(m*m+x*x+E*E),A=an(E/=b),M=F(F(E)-1)t||F((y*P+w*L)/_-.5)>.3||o*c+a*g+f*d<_l)&&(e(r,i,u,o,a,f,$,z,M,m/=b,x/=b,E,p,v),v.point($,z),e($,z,M,m,x,E,l,h,s,c,g,d,p,v))}}return function(r){var i,u,o,a,f,l,h,s,c,g,d,p,v={point:y,lineStart:w,lineEnd:m,polygonStart:function(){r.polygonStart(),v.lineStart=x},polygonEnd:function(){r.polygonEnd(),v.lineStart=w}};function y(A,M){A=n(A,M),r.point(A[0],A[1])}function w(){s=NaN,v.point=_,r.lineStart()}function _(A,M){var N=Cn([A,M]),$=n(A,M);e(s,c,h,g,d,p,s=$[0],c=$[1],h=A,g=N[0],d=N[1],p=N[2],ui,r),r.point(s,c)}function m(){v.point=y,r.lineEnd()}function x(){w(),v.point=E,v.lineEnd=b}function E(A,M){_(i=A,M),u=s,o=c,a=g,f=d,l=p,v.point=_}function b(){e(s,c,h,g,d,p,u,o,i,a,f,l,ui,r),v.lineEnd=m,m()}return v}}var Sl=oe({point:function(n,t){this.stream.point(n*C,t*C)}});function El(n){return oe({point:function(t,e){var r=n(t,e);return this.stream.point(r[0],r[1])}})}function $l(n,t,e,r,i){function u(o,a){return o*=r,a*=i,[t+n*o,e-n*a]}return u.invert=function(o,a){return[(o-t)/n*r,(e-a)/n*i]},u}function ai(n,t,e,r,i,u){if(!u)return $l(n,t,e,r,i);var o=k(u),a=I(u),f=o*n,l=a*n,h=o/n,s=a/n,c=(a*e-o*t)/n,g=(a*t+o*e)/n;function d(p,v){return p*=r,v*=i,[f*p-l*v+t,e-l*p-f*v]}return d.invert=function(p,v){return[r*(h*p-s*v+c),i*(g-s*p-h*v)]},d}function xn(n){return hu(function(){return n})()}function hu(n){var t,e=150,r=480,i=250,u=0,o=0,a=0,f=0,l=0,h,s=0,c=1,g=1,d=null,p=Wr,v=null,y,w,_,m=ht,x=.5,E,b,A,M,N;function $(S){return A(S[0]*C,S[1]*C)}function z(S){return S=A.invert(S[0],S[1]),S&&[S[0]*H,S[1]*H]}$.stream=function(S){return M&&N===S?M:M=Sl(El(h)(p(E(m(N=S)))))},$.preclip=function(S){return arguments.length?(p=S,d=void 0,L()):p},$.postclip=function(S){return arguments.length?(m=S,v=y=w=_=null,L()):m},$.clipAngle=function(S){return arguments.length?(p=+S?al(d=S*C):(d=null,Wr),L()):d*H},$.clipExtent=function(S){return arguments.length?(m=S==null?(v=y=w=_=null,ht):nu(v=+S[0][0],y=+S[0][1],w=+S[1][0],_=+S[1][1]),L()):v==null?null:[[v,y],[w,_]]},$.scale=function(S){return arguments.length?(e=+S,P()):e},$.translate=function(S){return arguments.length?(r=+S[0],i=+S[1],P()):[r,i]},$.center=function(S){return arguments.length?(u=S[0]%360*C,o=S[1]%360*C,P()):[u*H,o*H]},$.rotate=function(S){return arguments.length?(a=S[0]%360*C,f=S[1]%360*C,l=S.length>2?S[2]%360*C:0,P()):[a*H,f*H,l*H]},$.angle=function(S){return arguments.length?(s=S%360*C,P()):s*H},$.reflectX=function(S){return arguments.length?(c=S?-1:1,P()):c<0},$.reflectY=function(S){return arguments.length?(g=S?-1:1,P()):g<0},$.precision=function(S){return arguments.length?(E=oi(b,x=S*S),L()):rn(x)},$.fitExtent=function(S,R){return ae($,S,R)},$.fitSize=function(S,R){return sr($,S,R)},$.fitWidth=function(S,R){return fr($,S,R)},$.fitHeight=function(S,R){return cr($,S,R)};function P(){var S=ai(e,0,0,c,g,s).apply(null,t(u,o)),R=ai(e,r-S[0],i-S[1],c,g,s);return h=Wi(a,f,l),b=Le(t,R),A=Le(h,b),E=oi(b,x),L()}function L(){return M=N=null,$}return function(){return t=n.apply(this,arguments),$.invert=t.invert&&z,P()}}function hr(n){var t=0,e=D/3,r=hu(n),i=r(t,e);return i.parallels=function(u){return arguments.length?r(t=u[0]*C,e=u[1]*C):[t*H,e*H]},i}function Al(n){var t=k(n);function e(r,i){return[r*t,I(i)/t]}return e.invert=function(r,i){return[r/t,an(i*t)]},e}function Nl(n,t){var e=I(n),r=(e+I(t))/2;if(F(r)=.12&&v<.234&&p>=-.425&&p<-.214?i:v>=.166&&v<.234&&p>=-.214&&p<-.115?o:e).invert(c)},h.stream=function(c){return n&&t===c?n:n=Rl([e.stream(t=c),i.stream(c),o.stream(c)])},h.precision=function(c){return arguments.length?(e.precision(c),i.precision(c),o.precision(c),s()):e.precision()},h.scale=function(c){return arguments.length?(e.scale(c),i.scale(c*.35),o.scale(c),h.translate(e.translate())):e.scale()},h.translate=function(c){if(!arguments.length)return e.translate();var g=e.scale(),d=+c[0],p=+c[1];return r=e.translate(c).clipExtent([[d-.455*g,p-.238*g],[d+.455*g,p+.238*g]]).stream(l),u=i.translate([d-.307*g,p+.201*g]).clipExtent([[d-.425*g+T,p+.12*g+T],[d-.214*g-T,p+.234*g-T]]).stream(l),a=o.translate([d-.205*g,p+.212*g]).clipExtent([[d-.214*g+T,p+.166*g+T],[d-.115*g-T,p+.234*g-T]]).stream(l),s()},h.fitExtent=function(c,g){return ae(h,c,g)},h.fitSize=function(c,g){return sr(h,c,g)},h.fitWidth=function(c,g){return fr(h,c,g)},h.fitHeight=function(c,g){return cr(h,c,g)};function s(){return n=t=null,h}return h.scale(1070)}function gu(n){return function(t,e){var r=k(t),i=k(e),u=n(r*i);return u===1/0?[2,0]:[u*i*I(t),u*I(e)]}}function yt(n){return function(t,e){var r=rn(t*t+e*e),i=n(r),u=I(i),o=k(i);return[pn(t*u,r*o),an(r&&e*u/r)]}}var pu=gu(function(n){return rn(2/(1+n))});pu.invert=yt(function(n){return 2*an(n/2)});function mf(){return xn(pu).scale(124.75).clipAngle(180-.001)}var du=gu(function(n){return(n=Fi(n))&&n/I(n)});du.invert=yt(function(n){return n});function wf(){return xn(du).scale(79.4188).clipAngle(180-.001)}function le(n,t){return[n,qt(or((B+t)/2))]}le.invert=function(n,t){return[n,2*Wn(Di(t))-B]};function _f(){return vu(le).scale(961/en)}function vu(n){var t=xn(n),e=t.center,r=t.scale,i=t.translate,u=t.clipExtent,o=null,a,f,l;t.scale=function(s){return arguments.length?(r(s),h()):r()},t.translate=function(s){return arguments.length?(i(s),h()):i()},t.center=function(s){return arguments.length?(e(s),h()):e()},t.clipExtent=function(s){return arguments.length?(s==null?o=a=f=l=null:(o=+s[0][0],a=+s[0][1],f=+s[1][0],l=+s[1][1]),h()):o==null?null:[[o,a],[f,l]]};function h(){var s=D*r(),c=t(Va(t.rotate()).invert([0,0]));return u(o==null?[[c[0]-s,c[1]-s],[c[0]+s,c[1]+s]]:n===le?[[Math.max(c[0]-s,o),a],[Math.min(c[0]+s,f),l]]:[[o,Math.max(c[1]-s,a)],[f,Math.min(c[1]+s,l)]])}return h()}function At(n){return or((B+n)/2)}function Pl(n,t){var e=k(n),r=n===t?I(n):qt(e/k(t))/qt(At(t)/At(n)),i=e*ge(At(n),r)/r;if(!r)return le;function u(o,a){i>0?a<-B+T&&(a=-B+T):a>B-T&&(a=B-T);var f=i/ge(At(a),r);return[f*I(r*o),i-f*k(r*o)]}return u.invert=function(o,a){var f=i-a,l=gn(r)*rn(o*o+f*f),h=pn(o,F(f))*gn(f);return f*r<0&&(h-=D*gn(o)*gn(f)),[h/r,2*Wn(ge(i/l,1/r))-B]},u}function xf(){return hr(Pl).scale(109.5).parallels([30,30])}function te(n,t){return[n,t]}te.invert=te;function Mf(){return xn(te).scale(152.63)}function zl(n,t){var e=k(n),r=n===t?I(n):(e-k(t))/(t-n),i=e/r+n;if(F(r)T&&--r>0);return[n/(.8707+(u=e*e)*(-.131979+u*(-.013791+u*u*u*(.003971-.001529*u)))),e]};function Nf(){return xn(wu).scale(175.295)}function _u(n,t){return[k(t)*I(n),I(t)]}_u.invert=yt(an);function bf(){return xn(_u).scale(249.5).clipAngle(90+T)}function xu(n,t){var e=k(t),r=1+k(n)*e;return[e*I(n)/r,I(t)/r]}xu.invert=yt(function(n){return 2*Wn(n)});function Rf(){return xn(xu).scale(250).clipAngle(142)}function Mu(n,t){return[qt(or((B+t)/2)),-n]}Mu.invert=function(n,t){return[-t,2*Wn(Di(n))-B]};function Pf(){var n=vu(Mu),t=n.center,e=n.rotate;return n.center=function(r){return arguments.length?t([-r[1],r[0]]):(r=t(),[r[1],-r[0]])},n.rotate=function(r){return arguments.length?e([r[0],r[1],r.length>2?r[2]+90:90]):(r=e(),[r[0],r[1],r[2]-90])},e([0,0,90]).scale(159.155)}function Tl(n,t){return n.parent===t.parent?1:2}function kl(n){return n.reduce(Ll,0)/n.length}function Ll(n,t){return n+t.x}function ql(n){return 1+n.reduce(Cl,0)}function Cl(n,t){return Math.max(n,t.y)}function Dl(n){for(var t;t=n.children;)n=t[0];return n}function Fl(n){for(var t;t=n.children;)n=t[t.length-1];return n}function zf(){var n=Tl,t=1,e=1,r=!1;function i(u){var o,a=0;u.eachAfter(function(c){var g=c.children;g?(c.x=kl(g),c.y=ql(g)):(c.x=o?a+=n(c,o):0,c.y=0,o=c)});var f=Dl(u),l=Fl(u),h=f.x-n(f,l)/2,s=l.x+n(l,f)/2;return u.eachAfter(r?function(c){c.x=(c.x-u.x)*t,c.y=(u.y-c.y)*e}:function(c){c.x=(c.x-h)/(s-h)*t,c.y=(1-(u.y?c.y/u.y:1))*e})}return i.separation=function(u){return arguments.length?(n=u,i):n},i.size=function(u){return arguments.length?(r=!1,t=+u[0],e=+u[1],i):r?null:[t,e]},i.nodeSize=function(u){return arguments.length?(r=!0,t=+u[0],e=+u[1],i):r?[t,e]:null},i}const Yl=1664525,jl=1013904223,li=4294967296;function Ol(){let n=1;return()=>(n=(Yl*n+jl)%li)/li}function Xl(n){return typeof n=="object"&&"length"in n?n:Array.from(n)}function Bl(n,t){let e=n.length,r,i;for(;e;)i=t()*e--|0,r=n[e],n[e]=n[i],n[i]=r;return n}function Hl(n,t){for(var e=0,r=(n=Bl(Array.from(n),t)).length,i=[],u,o;e0&&e*e>r*r+i*i}function me(n,t){for(var e=0;e1e-6?($+Math.sqrt($*$-4*N*z))/(2*N):z/$);return{x:r+E+b*P,y:i+A+M*P,r:P}}function si(n,t,e){var r=n.x-t.x,i,u,o=n.y-t.y,a,f,l=r*r+o*o;l?(u=t.r+e.r,u*=u,f=n.r+e.r,f*=f,u>f?(i=(l+f-u)/(2*l),a=Math.sqrt(Math.max(0,f/l-i*i)),e.x=n.x-i*r-a*o,e.y=n.y-i*o+a*r):(i=(l+u-f)/(2*l),a=Math.sqrt(Math.max(0,u/l-i*i)),e.x=t.x+i*r-a*o,e.y=t.y+i*o+a*r)):(e.x=t.x+e.r,e.y=t.y)}function fi(n,t){var e=n.r+t.r-1e-6,r=t.x-n.x,i=t.y-n.y;return e>0&&e*e>r*r+i*i}function ci(n){var t=n._,e=n.next._,r=t.r+e.r,i=(t.x*e.r+e.x*t.r)/r,u=(t.y*e.r+e.y*t.r)/r;return i*i+u*u}function bt(n){this._=n,this.next=null,this.previous=null}function Zl(n,t){if(!(u=(n=Xl(n)).length))return 0;var e,r,i,u,o,a,f,l,h,s,c;if(e=n[0],e.x=0,e.y=0,!(u>1))return e.r;if(r=n[1],e.x=-r.r,r.x=e.r,r.y=0,!(u>2))return e.r+r.r;si(r,e,i=n[2]),e=new bt(e),r=new bt(r),i=new bt(i),e.next=i.previous=r,r.next=e.previous=i,i.next=r.previous=e;n:for(f=3;fns(e(m,x,i))),w=y.map(di),_=new Set(y).add("");for(const m of w)_.has(m)||(_.add(m),y.push(m),w.push(di(m)),u.push(_e));o=(m,x)=>y[x],a=(m,x)=>w[x]}for(h=0,f=u.length;h=0&&(g=u[y],g.data===_e);--y)g.data=null}if(s.parent=Jl,s.eachBefore(function(y){y.depth=y.parent.depth+1,--f}).eachBefore(Ao),s.parent=null,f>0)throw new Error("cycle");return s}return r.id=function(i){return arguments.length?(n=Rt(i),r):n},r.parentId=function(i){return arguments.length?(t=Rt(i),r):t},r.path=function(i){return arguments.length?(e=Rt(i),r):e},r}function ns(n){n=`${n}`;let t=n.length;return Ge(n,t-1)&&!Ge(n,t-2)&&(n=n.slice(0,-1)),n[0]==="/"?n:`/${n}`}function di(n){let t=n.length;if(t<2)return"";for(;--t>1&&!Ge(n,t););return n.slice(0,t)}function Ge(n,t){if(n[t]==="/"){let e=0;for(;t>0&&n[--t]==="\\";)++e;if((e&1)===0)return!0}return!1}function ts(n,t){return n.parent===t.parent?1:2}function xe(n){var t=n.children;return t?t[0]:n.t}function Me(n){var t=n.children;return t?t[t.length-1]:n.t}function es(n,t,e){var r=e/(t.i-n.i);t.c-=r,t.s+=e,n.c+=r,t.z+=e,t.m+=e}function rs(n){for(var t=0,e=0,r=n.children,i=r.length,u;--i>=0;)u=r[i],u.z+=t,u.m+=t,t+=u.s+(e+=u.c)}function is(n,t,e){return n.a.parent===t.parent?n.a:e}function zt(n,t){this._=n,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}zt.prototype=Object.create(Ni.prototype);function us(n){for(var t=new zt(n,0),e,r=[t],i,u,o,a;e=r.pop();)if(u=e._.children)for(e.children=new Array(a=u.length),o=a-1;o>=0;--o)r.push(i=e.children[o]=new zt(u[o],o)),i.parent=e;return(t.parent=new zt(null,0)).children=[t],t}function Lf(){var n=ts,t=1,e=1,r=null;function i(l){var h=us(l);if(h.eachAfter(u),h.parent.m=-h.z,h.eachBefore(o),r)l.eachBefore(f);else{var s=l,c=l,g=l;l.eachBefore(function(w){w.xc.x&&(c=w),w.depth>g.depth&&(g=w)});var d=s===c?1:n(s,c)/2,p=d-s.x,v=t/(c.x+d+p),y=e/(g.depth||1);l.eachBefore(function(w){w.x=(w.x+p)*v,w.y=w.depth*y})}return l}function u(l){var h=l.children,s=l.parent.children,c=l.i?s[l.i-1]:null;if(h){rs(l);var g=(h[0].z+h[h.length-1].z)/2;c?(l.z=c.z+n(l._,c._),l.m=l.z-g):l.z=g}else c&&(l.z=c.z+n(l._,c._));l.parent.A=a(l,c,l.parent.A||s[0])}function o(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,h,s){if(h){for(var c=l,g=l,d=h,p=c.parent.children[0],v=c.m,y=g.m,w=d.m,_=p.m,m;d=Me(d),c=xe(c),d&&c;)p=xe(p),g=Me(g),g.a=l,m=d.z+w-c.z-v+n(d._,c._),m>0&&(es(is(d,l,s),l,m),v+=m,y+=m),w+=d.m,v+=c.m,_+=p.m,y+=g.m;d&&!Me(g)&&(g.t=d,g.m+=w-y),c&&!xe(p)&&(p.t=c,p.m+=v-_,s=l)}return s}function f(l){l.x*=t,l.y=l.depth*e}return i.separation=function(l){return arguments.length?(n=l,i):n},i.size=function(l){return arguments.length?(r=!1,t=+l[0],e=+l[1],i):r?null:[t,e]},i.nodeSize=function(l){return arguments.length?(r=!0,t=+l[0],e=+l[1],i):r?[t,e]:null},i}function qf(n,t,e,r,i){var u=n.children,o,a=u.length,f,l=new Array(a+1);for(l[0]=f=o=0;o=c-1){var w=u[s];w.x0=d,w.y0=p,w.x1=v,w.y1=y;return}for(var _=l[s],m=g/2+_,x=s+1,E=c-1;x>>1;l[b]y-p){var N=g?(d*M+v*A)/g:v;h(s,x,A,d,p,N,y),h(x,c,M,N,p,v,y)}else{var $=g?(p*M+y*A)/g:y;h(s,x,A,d,p,v,$),h(x,c,M,d,$,v,y)}}}function Cf(n,t,e,r,i){(n.depth&1?bi:tr)(n,t,e,r,i)}const Df=(function n(t){function e(r,i,u,o,a){if((f=r._squarify)&&f.ratio===t)for(var f,l,h,s,c=-1,g,d=f.length,p=r.value;++c1?r:1)},e})(bo);function os(n){var t;function e(r){return r==null||isNaN(r=+r)?t:r}return e.invert=e,e.domain=e.range=function(r){return arguments.length?(n=Array.from(r,vr),e):n.slice()},e.unknown=function(r){return arguments.length?(t=r,e):t},e.copy=function(){return os(n).unknown(t)},n=arguments.length?Array.from(n,vr):[0,1],Zn(e)}function vi(n){return Math.log(n)}function yi(n){return Math.exp(n)}function as(n){return-Math.log(-n)}function ls(n){return-Math.exp(-n)}function ss(n){return isFinite(n)?+("1e"+n):n<0?0:n}function fs(n){return n===10?ss:n===Math.E?Math.exp:t=>Math.pow(n,t)}function cs(n){return n===Math.E?Math.log:n===10&&Math.log10||n===2&&Math.log2||(n=Math.log(n),t=>Math.log(t)/n)}function mi(n){return(t,e)=>-n(-t,e)}function gr(n){const t=n(vi,yi),e=t.domain;let r=10,i,u;function o(){return i=cs(r),u=fs(r),e()[0]<0?(i=mi(i),u=mi(u),n(as,ls)):n(vi,yi),t}return t.base=function(a){return arguments.length?(r=+a,o()):r},t.domain=function(a){return arguments.length?(e(a),o()):e()},t.ticks=a=>{const f=e();let l=f[0],h=f[f.length-1];const s=h0){for(;c<=g;++c)for(d=1;dh)break;y.push(p)}}else for(;c<=g;++c)for(d=r-1;d>=1;--d)if(p=c>0?d/u(-c):d*u(c),!(ph)break;y.push(p)}y.length*2{if(a==null&&(a=10),f==null&&(f=r===10?"s":","),typeof f!="function"&&(!(r%1)&&(f=Ro(f)).precision==null&&(f.trim=!0),f=Po(f)),a===1/0)return f;const l=Math.max(1,r*a/t.ticks().length);return h=>{let s=h/u(Math.round(i(h)));return s*re(fo(e(),{floor:a=>u(Math.floor(i(a))),ceil:a=>u(Math.ceil(i(a)))})),t}function hs(){const n=gr(Je()).domain([1,10]);return n.copy=()=>Qe(n,hs()).base(n.base()),Fn.apply(n,arguments),n}function wi(n){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/n))}}function _i(n){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*n}}function pr(n){var t=1,e=n(wi(t),_i(t));return e.constant=function(r){return arguments.length?n(wi(t=+r),_i(t)):t},Zn(e)}function gs(){var n=pr(Je());return n.copy=function(){return Qe(n,gs()).constant(n.constant())},Fn.apply(n,arguments)}function xi(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function ps(n){return n<0?-Math.sqrt(-n):Math.sqrt(n)}function ds(n){return n<0?-n*n:n*n}function dr(n){var t=n(Rn,Rn),e=1;function r(){return e===1?n(Rn,Rn):e===.5?n(ps,ds):n(xi(e),xi(1/e))}return t.exponent=function(i){return arguments.length?(e=+i,r()):e},Zn(t)}function $u(){var n=dr(Je());return n.copy=function(){return Qe(n,$u()).exponent(n.exponent())},Fn.apply(n,arguments),n}function Ff(){return $u.apply(null,arguments).exponent(.5)}function vs(){var n=[],t=[],e=[],r;function i(){var o=0,a=Math.max(1,t.length);for(e=new Array(a-1);++o0?e[a-1]:n[0],a=e?[r[e-1],t]:[r[l-1],r[l]]},o.unknown=function(f){return arguments.length&&(u=f),o},o.thresholds=function(){return r.slice()},o.copy=function(){return ys().domain([n,t]).range(i).unknown(u)},Fn.apply(Zn(o),arguments)}function ms(){var n=[.5],t=[0,1],e,r=1;function i(u){return u!=null&&u<=u?t[Ve(n,u,0,r)]:e}return i.domain=function(u){return arguments.length?(n=Array.from(u),r=Math.min(n.length,t.length-1),i):n.slice()},i.range=function(u){return arguments.length?(t=Array.from(u),r=Math.min(n.length,t.length-1),i):t.slice()},i.invertExtent=function(u){var o=t.indexOf(u);return[n[o-1],n[o]]},i.unknown=function(u){return arguments.length?(e=u,i):e},i.copy=function(){return ms().domain(n).range(t).unknown(e)},Fn.apply(i,arguments)}function Yf(){return Fn.apply(co(Mo,xo,_o,wo,mo,yo,vo,po,go,ho).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function se(){var n=0,t=1,e,r,i,u,o=Rn,a=!1,f;function l(s){return s==null||isNaN(s=+s)?f:o(i===0?.5:(s=(u(s)-e)*i,a?Math.max(0,Math.min(1,s)):s))}l.domain=function(s){return arguments.length?([n,t]=s,e=u(n=+n),r=u(t=+t),i=e===r?0:1/(r-e),l):[n,t]},l.clamp=function(s){return arguments.length?(a=!!s,l):a},l.interpolator=function(s){return arguments.length?(o=s,l):o};function h(s){return function(c){var g,d;return arguments.length?([g,d]=c,o=s(g,d),l):[o(0),o(1)]}}return l.range=h(ie),l.rangeRound=h(We),l.unknown=function(s){return arguments.length?(f=s,l):f},function(s){return u=s,e=s(n),r=s(t),i=e===r?0:1/(r-e),l}}function In(n,t){return t.domain(n.domain()).interpolator(n.interpolator()).clamp(n.clamp()).unknown(n.unknown())}function ws(){var n=Zn(se()(Rn));return n.copy=function(){return In(n,ws())},zn.apply(n,arguments)}function _s(){var n=gr(se()).domain([1,10]);return n.copy=function(){return In(n,_s()).base(n.base())},zn.apply(n,arguments)}function xs(){var n=pr(se());return n.copy=function(){return In(n,xs()).constant(n.constant())},zn.apply(n,arguments)}function Au(){var n=dr(se());return n.copy=function(){return In(n,Au()).exponent(n.exponent())},zn.apply(n,arguments)}function jf(){return Au.apply(null,arguments).exponent(.5)}function fe(){var n=0,t=.5,e=1,r=1,i,u,o,a,f,l=Rn,h,s=!1,c;function g(p){return isNaN(p=+p)?c:(p=.5+((p=+h(p))-u)*(r*p=g;--d)a.point(_[d],m[d]);a.lineEnd(),a.areaEnd()}y&&(_[c]=+n(v,c,s),m[c]=+t(v,c,s),a.point(r?+r(v,c,s):_[c],e?+e(v,c,s):m[c]))}if(w)return a=null,w+""||null}function h(){return eo().defined(i).curve(o).context(u)}return l.x=function(s){return arguments.length?(n=typeof s=="function"?s:K(+s),r=null,l):n},l.x0=function(s){return arguments.length?(n=typeof s=="function"?s:K(+s),l):n},l.x1=function(s){return arguments.length?(r=s==null?null:typeof s=="function"?s:K(+s),l):r},l.y=function(s){return arguments.length?(t=typeof s=="function"?s:K(+s),e=null,l):t},l.y0=function(s){return arguments.length?(t=typeof s=="function"?s:K(+s),l):t},l.y1=function(s){return arguments.length?(e=s==null?null:typeof s=="function"?s:K(+s),l):e},l.lineX0=l.lineY0=function(){return h().x(n).y(t)},l.lineY1=function(){return h().x(n).y(e)},l.lineX1=function(){return h().x(r).y(t)},l.defined=function(s){return arguments.length?(i=typeof s=="function"?s:K(!!s),l):i},l.curve=function(s){return arguments.length?(o=s,u!=null&&(a=o(u)),l):o},l.context=function(s){return arguments.length?(s==null?u=a=null:a=o(u=s),l):u},l}const $s={draw(n,t){const e=io(t/uo);n.moveTo(e,0),n.arc(0,0,e,0,ro)}};function nc(n,t){let e=null,r=Ai(i);n=typeof n=="function"?n:K(n||$s),t=typeof t=="function"?t:K(t===void 0?64:+t);function i(){let u;if(e||(e=u=r()),n.apply(this,arguments).draw(e,+t.apply(this,arguments)),u)return e=null,u+""||null}return i.type=function(u){return arguments.length?(n=typeof u=="function"?u:K(u),i):n},i.size=function(u){return arguments.length?(t=typeof u=="function"?u:K(+u),i):t},i.context=function(u){return arguments.length?(e=u??null,i):e},i}const As=/("(?:[^\\"]|\\.)*")|[:,]/g;function tc(n,t={}){const e=JSON.stringify([1],void 0,t.indent===void 0?2:t.indent).slice(2,-3),r=e===""?1/0:t.maxLength===void 0?80:t.maxLength;let{replacer:i}=t;return(function u(o,a,f){o&&typeof o.toJSON=="function"&&(o=o.toJSON());const l=JSON.stringify(o,i);if(l===void 0)return l;const h=r-a.length-f;if(l.length<=h){const s=l.replace(As,(c,g)=>g||`${c} `);if(s.length<=h)return s}if(i!=null&&(o=JSON.parse(l),i=void 0),typeof o=="object"&&o!==null){const s=a+e,c=[];let g=0,d,p;if(Array.isArray(o)){d="[",p="]";const{length:v}=o;for(;g0)return[d,e+c.join(`, +${s}`),p].join(` +${a}`)}return l})(n,"",0)}function Ns(n){return n}function bs(n){if(n==null)return Ns;var t,e,r=n.scale[0],i=n.scale[1],u=n.translate[0],o=n.translate[1];return function(a,f){f||(t=e=0);var l=2,h=a.length,s=new Array(h);for(s[0]=(t+=a[0])*r+u,s[1]=(e+=a[1])*i+o;l1)r=Is(n,t,e);else for(i=0,r=new Array(u=n.arcs.length);i1?Ze:n<-1?-Ze:Math.asin(n)}function Ls(n){return n>0?Math.sqrt(n):0}function qs(n,t){var e=n*re(t),r=30,i;do t-=i=(t+re(t)-e)/(1+Ke(t));while(Ts(i)>ks&&--r>0);return t/2}function Cs(n,t,e){function r(i,u){return[n*i*Ke(u=qs(e,u)),t*re(u)]}return r.invert=function(i,u){return u=Ei(u/t),[i/(n*Ke(u)),Ei((2*u+re(2*u))/e)]},r}var Ds=Cs(Si/Ze,Si,Ru);function ic(){return xn(Ds).scale(169.529)}export{ef as $,ms as A,Qf as B,Jf as C,Wf as D,Zf as E,Kf as F,Gf as G,Uf as H,Hf as I,Xf as J,Bf as K,Vf as L,Vs as M,Pf as N,Rf as O,bf as P,Nf as Q,ic as R,nc as S,_f as T,Af as U,$f as V,Mf as W,Ef as X,Sf as Y,Ue as Z,xf as _,ko as a,wf as a0,mf as a1,yf as a2,bl as a3,vf as a4,df as a5,lf as a6,cf as a7,ff as a8,af as a9,sf as aa,of as ab,uf as ac,If as ad,Tf as ae,kf as af,zf as ag,Lf as ah,Df as ai,Cf as aj,qf as ak,qi as al,Ws as am,nf as an,tf as ao,hf as ap,gf as aq,pf as ar,rf as as,tc as at,Qs as b,Js as c,Zs as d,$u as e,ec as f,gs as g,ws as h,os as i,_s as j,Au as k,hs as l,rc as m,jf as n,xs as o,Li as p,To as q,Ms as r,Ff as s,Ss as t,Yf as u,Nu as v,Of as w,Es as x,vs as y,ys as z}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/morphTargetsVertex-7Q90Wwr8.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/morphTargetsVertex-7Q90Wwr8.js new file mode 100644 index 0000000000000000000000000000000000000000..bf6d0fcde815e387dda2ca25004d3aa928a029d7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/morphTargetsVertex-7Q90Wwr8.js @@ -0,0 +1,101 @@ +import{S as e}from"./index-CDrXokXW.js";const r="morphTargetsVertexGlobalDeclaration",T=`#ifdef MORPHTARGETS +uniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS]; +#ifdef MORPHTARGETS_TEXTURE +uniform float morphTargetTextureIndices[NUM_MORPH_INFLUENCERS];uniform vec3 morphTargetTextureInfo;uniform highp sampler2DArray morphTargets;vec3 readVector3FromRawSampler(int targetIndex,float vertexIndex) +{ +float y=floor(vertexIndex/morphTargetTextureInfo.y);float x=vertexIndex-y*morphTargetTextureInfo.y;vec3 textureUV=vec3((x+0.5)/morphTargetTextureInfo.y,(y+0.5)/morphTargetTextureInfo.z,morphTargetTextureIndices[targetIndex]);return texture(morphTargets,textureUV).xyz;} +vec4 readVector4FromRawSampler(int targetIndex,float vertexIndex) +{ +float y=floor(vertexIndex/morphTargetTextureInfo.y);float x=vertexIndex-y*morphTargetTextureInfo.y;vec3 textureUV=vec3((x+0.5)/morphTargetTextureInfo.y,(y+0.5)/morphTargetTextureInfo.z,morphTargetTextureIndices[targetIndex]);return texture(morphTargets,textureUV);} +#endif +#endif +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=T);const t="morphTargetsVertexDeclaration",o=`#ifdef MORPHTARGETS +#ifndef MORPHTARGETS_TEXTURE +#ifdef MORPHTARGETS_POSITION +attribute vec3 position{X}; +#endif +#ifdef MORPHTARGETS_NORMAL +attribute vec3 normal{X}; +#endif +#ifdef MORPHTARGETS_TANGENT +attribute vec3 tangent{X}; +#endif +#ifdef MORPHTARGETS_UV +attribute vec2 uv_{X}; +#endif +#ifdef MORPHTARGETS_UV2 +attribute vec2 uv2_{X}; +#endif +#ifdef MORPHTARGETS_COLOR +attribute vec4 color{X}; +#endif +#elif {X}==0 +uniform float morphTargetCount; +#endif +#endif +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=o);const f="morphTargetsVertexGlobal",a=`#ifdef MORPHTARGETS +#ifdef MORPHTARGETS_TEXTURE +float vertexID; +#endif +#endif +`;e.IncludesShadersStore[f]||(e.IncludesShadersStore[f]=a);const n="morphTargetsVertex",d=`#ifdef MORPHTARGETS +#ifdef MORPHTARGETS_TEXTURE +#if {X}==0 +for (int i=0; i=morphTargetCount) break;vertexID=float(gl_VertexID)*morphTargetTextureInfo.x; +#ifdef MORPHTARGETS_POSITION +positionUpdated+=(readVector3FromRawSampler(i,vertexID)-position)*morphTargetInfluences[i]; +#endif +#ifdef MORPHTARGETTEXTURE_HASPOSITIONS +vertexID+=1.0; +#endif +#ifdef MORPHTARGETS_NORMAL +normalUpdated+=(readVector3FromRawSampler(i,vertexID) -normal)*morphTargetInfluences[i]; +#endif +#ifdef MORPHTARGETTEXTURE_HASNORMALS +vertexID+=1.0; +#endif +#ifdef MORPHTARGETS_UV +uvUpdated+=(readVector3FromRawSampler(i,vertexID).xy-uv)*morphTargetInfluences[i]; +#endif +#ifdef MORPHTARGETTEXTURE_HASUVS +vertexID+=1.0; +#endif +#ifdef MORPHTARGETS_TANGENT +tangentUpdated.xyz+=(readVector3FromRawSampler(i,vertexID) -tangent.xyz)*morphTargetInfluences[i]; +#endif +#ifdef MORPHTARGETTEXTURE_HASTANGENTS +vertexID+=1.0; +#endif +#ifdef MORPHTARGETS_UV2 +uv2Updated+=(readVector3FromRawSampler(i,vertexID).xy-uv2)*morphTargetInfluences[i]; +#endif +#ifdef MORPHTARGETTEXTURE_HASUV2S +vertexID+=1.0; +#endif +#ifdef MORPHTARGETS_COLOR +colorUpdated+=(readVector4FromRawSampler(i,vertexID)-color)*morphTargetInfluences[i]; +#endif +} +#endif +#else +#ifdef MORPHTARGETS_POSITION +positionUpdated+=(position{X}-position)*morphTargetInfluences[{X}]; +#endif +#ifdef MORPHTARGETS_NORMAL +normalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}]; +#endif +#ifdef MORPHTARGETS_TANGENT +tangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}]; +#endif +#ifdef MORPHTARGETS_UV +uvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}]; +#endif +#ifdef MORPHTARGETS_UV2 +uv2Updated+=(uv2_{X}-uv2)*morphTargetInfluences[{X}]; +#endif +#ifdef MORPHTARGETS_COLOR +colorUpdated+=(color{X}-color)*morphTargetInfluences[{X}]; +#endif +#endif +#endif +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=d); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/morphTargetsVertex-DcRl6X3j.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/morphTargetsVertex-DcRl6X3j.js new file mode 100644 index 0000000000000000000000000000000000000000..2da77fd712a3b90906f08cf3a5cde334b05abf6b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/morphTargetsVertex-DcRl6X3j.js @@ -0,0 +1,64 @@ +import{S as e}from"./index-CDrXokXW.js";const t="morphTargetsVertexGlobal",n=`#ifdef MORPHTARGETS +#ifdef MORPHTARGETS_TEXTURE +var vertexID : f32; +#endif +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=n);const r="morphTargetsVertex",d=`#ifdef MORPHTARGETS +#ifdef MORPHTARGETS_TEXTURE +#if {X}==0 +for (var i=0; i=uniforms.morphTargetCount) {break;} +vertexID=f32(vertexInputs.vertexIndex)*uniforms.morphTargetTextureInfo.x; +#ifdef MORPHTARGETS_POSITION +positionUpdated=positionUpdated+(readVector3FromRawSampler(i,vertexID)-vertexInputs.position)*uniforms.morphTargetInfluences[i]; +#endif +#ifdef MORPHTARGETTEXTURE_HASPOSITIONS +vertexID=vertexID+1.0; +#endif +#ifdef MORPHTARGETS_NORMAL +normalUpdated=normalUpdated+(readVector3FromRawSampler(i,vertexID) -vertexInputs.normal)*uniforms.morphTargetInfluences[i]; +#endif +#ifdef MORPHTARGETTEXTURE_HASNORMALS +vertexID=vertexID+1.0; +#endif +#ifdef MORPHTARGETS_UV +uvUpdated=uvUpdated+(readVector3FromRawSampler(i,vertexID).xy-vertexInputs.uv)*uniforms.morphTargetInfluences[i]; +#endif +#ifdef MORPHTARGETTEXTURE_HASUVS +vertexID=vertexID+1.0; +#endif +#ifdef MORPHTARGETS_TANGENT +tangentUpdated=vec4f(tangentUpdated.xyz+(readVector3FromRawSampler(i,vertexID) -vertexInputs.tangent.xyz)*uniforms.morphTargetInfluences[i],tangentUpdated.a); +#endif +#ifdef MORPHTARGETTEXTURE_HASTANGENTS +vertexID=vertexID+1.0; +#endif +#ifdef MORPHTARGETS_UV2 +uv2Updated=uv2Updated+(readVector3FromRawSampler(i,vertexID).xy-vertexInputs.uv2)*uniforms.morphTargetInfluences[i]; +#endif +#ifdef MORPHTARGETS_COLOR +colorUpdated=colorUpdated+(readVector4FromRawSampler(i,vertexID)-vertexInputs.color)*uniforms.morphTargetInfluences[i]; +#endif +} +#endif +#else +#ifdef MORPHTARGETS_POSITION +positionUpdated=positionUpdated+(vertexInputs.position{X}-vertexInputs.position)*uniforms.morphTargetInfluences[{X}]; +#endif +#ifdef MORPHTARGETS_NORMAL +normalUpdated=normalUpdated+(vertexInputs.normal{X}-vertexInputs.normal)*uniforms.morphTargetInfluences[{X}]; +#endif +#ifdef MORPHTARGETS_TANGENT +tangentUpdated=vec4f(tangentUpdated.xyz+(vertexInputs.tangent{X}-vertexInputs.tangent.xyz)*uniforms.morphTargetInfluences[{X}],tangentUpdated.a); +#endif +#ifdef MORPHTARGETS_UV +uvUpdated=uvUpdated+(vertexInputs.uv_{X}-vertexInputs.uv)*uniforms.morphTargetInfluences[{X}]; +#endif +#ifdef MORPHTARGETS_UV2 +uv2Updated=uv2Updated+(vertexInputs.uv2_{X}-vertexInputs.uv2)*uniforms.morphTargetInfluences[{X}]; +#endif +#ifdef MORPHTARGETS_COLOR +colorUpdated=colorUpdated+(vertexInputs.color{X}-vertexInputs.color)*uniforms.morphTargetInfluences[{X}]; +#endif +#endif +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=d); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/morphTargetsVertexDeclaration-BsT9JpOT.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/morphTargetsVertexDeclaration-BsT9JpOT.js new file mode 100644 index 0000000000000000000000000000000000000000..7cdb554c481373fee643832315876a4489ff9bc1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/morphTargetsVertexDeclaration-BsT9JpOT.js @@ -0,0 +1,36 @@ +import{S as e}from"./index-CDrXokXW.js";const r="morphTargetsVertexGlobalDeclaration",f=`#ifdef MORPHTARGETS +uniform morphTargetInfluences : array; +#ifdef MORPHTARGETS_TEXTURE +uniform morphTargetTextureIndices : array;uniform morphTargetTextureInfo : vec3;var morphTargets : texture_2d_array;var morphTargetsSampler : sampler;fn readVector3FromRawSampler(targetIndex : i32,vertexIndex : f32)->vec3 +{ +let y=floor(vertexIndex/uniforms.morphTargetTextureInfo.y);let x=vertexIndex-y*uniforms.morphTargetTextureInfo.y;let textureUV=vec2((x+0.5)/uniforms.morphTargetTextureInfo.y,(y+0.5)/uniforms.morphTargetTextureInfo.z);return textureSampleLevel(morphTargets,morphTargetsSampler,textureUV,i32(uniforms.morphTargetTextureIndices[targetIndex]),0.0).xyz;} +fn readVector4FromRawSampler(targetIndex : i32,vertexIndex : f32)->vec4 +{ +let y=floor(vertexIndex/uniforms.morphTargetTextureInfo.y);let x=vertexIndex-y*uniforms.morphTargetTextureInfo.y;let textureUV=vec2((x+0.5)/uniforms.morphTargetTextureInfo.y,(y+0.5)/uniforms.morphTargetTextureInfo.z);return textureSampleLevel(morphTargets,morphTargetsSampler,textureUV,i32(uniforms.morphTargetTextureIndices[targetIndex]),0.0);} +#endif +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=f);const t="morphTargetsVertexDeclaration",o=`#ifdef MORPHTARGETS +#ifndef MORPHTARGETS_TEXTURE +#ifdef MORPHTARGETS_POSITION +attribute position{X} : vec3; +#endif +#ifdef MORPHTARGETS_NORMAL +attribute normal{X} : vec3; +#endif +#ifdef MORPHTARGETS_TANGENT +attribute tangent{X} : vec3; +#endif +#ifdef MORPHTARGETS_UV +attribute uv_{X} : vec2; +#endif +#ifdef MORPHTARGETS_UV2 +attribute uv2_{X} : vec2; +#endif +#ifdef MORPHTARGETS_COLOR +attribute color{X} : vec4; +#endif +#elif {X}==0 +uniform morphTargetCount: f32; +#endif +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=o); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/nb-FznSaSMV.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/nb-FznSaSMV.js new file mode 100644 index 0000000000000000000000000000000000000000..4c09b7a5a4a167f0c897ab9279748301aa8b7584 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/nb-FznSaSMV.js @@ -0,0 +1 @@ +const e="Norsk bokmål",o={annotated_image:"Annotert bilde"},r={allow_recording_access:"Vennligst tillat mikrofontilgang for opptak.",audio:"Lyd",record_from_microphone:"Ta opp fra mikrofon",stop_recording:"Stopp opptak",no_device_support:"Kan ikke få tilgang til medieenheter. Sørg for at du kjører på en sikker kilde (https) eller localhost (eller har gitt et gyldig SSL-sertifikat til ssl_verify), og at du har gitt nettleseren tilgang til enheten din.",stop:"Stopp",resume:"Fortsett",record:"Ta opp",no_microphone:"Ingen mikrofon funnet",pause:"Pause",play:"Spill av",waiting:"Venter",drop_to_upload:"Slipp en lydfil her for å laste opp"},t={connection_can_break:"På mobil kan tilkoblingen brytes hvis denne fanen mister fokus eller enheten går i dvale, og du mister plassen din i køen.",long_requests_queue:"Det er en lang kø med ventende forespørsler. Dupliser denne Space for å hoppe over køen.",lost_connection:"Mistet tilkobling på grunn av at siden ble forlatt. Går tilbake til køen...",waiting_for_inputs:"Venter på at fil(er) skal bli lastet opp, vennligst prøv igjen."},n={checkbox:"Avkrysningsboks",checkbox_group:"Avkrysningsboksgruppe"},i={code:"Kode"},l={color_picker:"Fargevelger"},a={built_with:"bygget med",built_with_gradio:"Bygget med Gradio",clear:"Tøm",download:"Last ned",edit:"Rediger",empty:"Tom",error:"Feil",hosted_on:"Hostet på",loading:"Laster",logo:"Logo",or:"eller",remove:"Fjern",settings:"Innstillinger",share:"Del",submit:"Send",undo:"Angre",no_devices:"Ingen enheter funnet",language:"Språk",display_theme:"Visningstema",pwa:"Progressiv webapplikasjon"},s={incorrect_format:"Feil format, kun CSV- og TSV-filer støttes",new_column:"Legg til kolonne",new_row:"Ny rad",add_row_above:"Legg til rad over",add_row_below:"Legg til rad under",add_column_left:"Legg til kolonne til venstre",add_column_right:"Legg til kolonne til høyre",delete_row:"Slett rad",delete_column:"Slett kolonne",sort_column:"Sorter kolonne",sort_ascending:"Sorter stigende",sort_descending:"Sorter synkende",drop_to_upload:"Slipp CSV- eller TSV-filer her for å importere data til dataramme",clear_sort:"Fjern sortering"},d={dropdown:"Nedtrekksmeny"},p={build_error:"Det er en byggefeil",config_error:"Det er en konfigurasjonsfeil",contact_page_author:"Vennligst kontakt sidens forfatter for å informere dem.",no_app_file:"Det er ingen app-fil",runtime_error:"Det er en kjøretidsfeil",space_not_working:'"Space fungerer ikke fordi" {0}',space_paused:"Space er pauset",use_via_api:"Bruk via API",use_via_api_or_mcp:"Bruk via API eller MCP"},g={uploading:"Laster opp..."},_={highlighted_text:"Uthevet tekst"},c={allow_webcam_access:"Vennligst tillat webkameratilgang for opptak.",brush_color:"Penselfarge",brush_radius:"Penselstørrelse",image:"Bilde",remove_image:"Fjern bilde",select_brush_color:"Velg penselfarge",start_drawing:"Start tegning",use_brush:"Bruk pensel",drop_to_upload:"Slipp en bildefil her for å laste opp"},k={label:"Etikett"},u={enable_cookies:"Hvis du besøker en HuggingFace Space i inkognitomodus, må du aktivere tredjeparts informasjonskapsler.",incorrect_credentials:"Feil påloggingsinformasjon",username:"Brukernavn",password:"Passord",login:"Logg inn"},m={number:"Tall"},f={plot:"Plott"},b={radio:"Radioknapp"},h={slider:"Glidebryter"},v={click_to_upload:"Klikk for å laste opp",drop_audio:"Slipp lyd her",drop_csv:"Slipp CSV her",drop_file:"Slipp fil her",drop_image:"Slipp bilde her",drop_video:"Slipp video her",drop_gallery:"Slipp media her",paste_clipboard:"Lim inn fra utklippstavle"},S={drop_to_upload:"Slipp en videofil her for å laste opp"},w={edit:"Rediger",retry:"Prøv igjen",undo:"Angre",submit:"Send",cancel:"Avbryt",like:"Liker",dislike:"Liker ikke",clear:"Tøm samtalen"},y={_name:e,"3D_model":{"3d_model":"3D-modell",drop_to_upload:"Slipp en 3D-modell (.obj, .glb, .stl, .gltf, .splat eller .ply) fil her for å laste opp"},annotated_image:o,audio:r,blocks:t,checkbox:n,code:i,color_picker:l,common:a,dataframe:s,dropdown:d,errors:p,file:g,highlighted_text:_,image:c,label:k,login:u,number:m,plot:f,radio:b,slider:h,upload_text:v,video:S,chatbot:w};export{e as _name,o as annotated_image,r as audio,t as blocks,w as chatbot,n as checkbox,i as code,l as color_picker,a as common,s as dataframe,y as default,d as dropdown,p as errors,g as file,_ as highlighted_text,c as image,k as label,u as login,m as number,f as plot,b as radio,h as slider,v as upload_text,S as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/nl-B4KNpP3D.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/nl-B4KNpP3D.js new file mode 100644 index 0000000000000000000000000000000000000000..18b45a6c512dc06019543cfa975119710651d517 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/nl-B4KNpP3D.js @@ -0,0 +1 @@ +const e="Nederlands",o={built_with_gradio:"Gemaakt met Gradio",clear:"Wissen",or:"of",submit:"Verzenden",settings:"Instellingen",built_with:"Gebouwd met",download:"Downloaden",edit:"Bewerken",empty:"Leeg",error:"Fout",hosted_on:"Gehost op",loading:"Laden",logo:"Logo",remove:"Verwijderen",share:"Delen",undo:"Ongedaan maken",no_devices:"Geen apparaten gevonden",language:"Taal",display_theme:"Weergavethema",pwa:"Progressieve Web App"},n={click_to_upload:"Klik om te uploaden",drop_audio:"Sleep een geluidsbestand hier",drop_csv:"Sleep een CSV-bestand hier",drop_file:"Sleep een bestand hier",drop_image:"Sleep een afbeelding hier",drop_video:"Sleep een video hier",drop_gallery:"Sleep media hier",paste_clipboard:"Plakken vanuit klembord"},a={annotated_image:"Geannoteerde afbeelding"},t={allow_recording_access:"Geef alstublieft toegang tot de microfoon voor opname.",audio:"Audio",drop_to_upload:"Sleep een audiobestand hier om te uploaden",record_from_microphone:"Opnemen via microfoon",stop_recording:"Opname stoppen",no_device_support:"Media-apparaten konden niet worden benaderd. Controleer of u werkt vanaf een beveiligde oorsprong (https) of localhost (of u een geldig SSL-certificaat heeft doorgegeven aan ssl_verify), en of u browsertoestemming heeft gegeven voor toegang tot uw apparaat.",stop:"Stoppen",resume:"Hervatten",record:"Opnemen",no_microphone:"Geen microfoon gevonden",pause:"Pauzeren",play:"Afspelen",waiting:"Wachten"},r={connection_can_break:"Op mobiel kan de verbinding verbroken worden als dit tabblad niet actief is of het apparaat in slaapstand gaat, waardoor je plaats in de wachtrij verloren gaat.",long_requests_queue:"Er is een lange wachtrij van aanvragen. Dupliceer deze Space om de wachtrij over te slaan.",lost_connection:"Verbinding verloren door het verlaten van de pagina. Opnieuw aansluiten in de wachtrij...",waiting_for_inputs:"Wachten tot het uploaden van bestand(en) is voltooid, probeer het opnieuw."},i={checkbox:"Selectievakje",checkbox_group:"Selectievakjesgroep"},d={code:"Code"},l={color_picker:"Kleurkiezer"},s={incorrect_format:"Onjuist formaat, alleen CSV- en TSV-bestanden worden ondersteund",new_column:"Kolom toevoegen",new_row:"Nieuwe rij",add_row_above:"Rij boven toevoegen",add_row_below:"Rij onder toevoegen",delete_row:"Rij verwijderen",delete_column:"Kolom verwijderen",add_column_left:"Kolom links toevoegen",add_column_right:"Kolom rechts toevoegen",sort_column:"Kolom sorteren",sort_ascending:"Oplopend sorteren",sort_descending:"Aflopend sorteren",drop_to_upload:"Sleep CSV- of TSV-bestanden hier om gegevens in het dataframe te importeren",clear_sort:"Sortering wissen"},c={dropdown:"Vervolgkeuzelijst"},p={build_error:"Er is een bouwfout",config_error:"Er is een configuratiefout",contact_page_author:"Neem contact op met de auteur van de pagina om dit te melden.",no_app_file:"Er is geen app-bestand",runtime_error:"Er is een runtime-fout",space_not_working:'"Space werkt niet omdat" {0}',space_paused:"De Space is gepauzeerd",use_via_api:"Gebruik via API",use_via_api_or_mcp:"Gebruik via API of MCP"},u={uploading:"Uploaden..."},g={highlighted_text:"Gemarkeerde tekst"},_={allow_webcam_access:"Geef alstublieft toegang tot de webcam voor opname.",brush_color:"Penseelkleur",brush_radius:"Penseelgrootte",image:"Afbeelding",remove_image:"Afbeelding verwijderen",select_brush_color:"Penseelkleur kiezen",start_drawing:"Beginnen met tekenen",use_brush:"Penseel gebruiken",drop_to_upload:"Sleep een afbeelding hier om te uploaden"},m={label:"Label"},b={enable_cookies:"Als u een HuggingFace Space bezoekt in incognitomodus, moet u cookies van derden inschakelen.",incorrect_credentials:"Onjuiste inloggegevens",username:"Gebruikersnaam",password:"Wachtwoord",login:"Inloggen"},v={number:"Getal"},h={plot:"Grafiek"},k={radio:"Keuzerondje"},w={slider:"Schuifbalk"},f={drop_to_upload:"Sleep een videobestand hier om te uploaden"},S={edit:"Bewerken",retry:"Opnieuw proberen",undo:"Ongedaan maken",submit:"Verzenden",cancel:"Annuleren",like:"Vind ik leuk",dislike:"Vind ik niet leuk",clear:"Gesprek wissen"},j={_name:e,common:o,upload_text:n,"3D_model":{"3d_model":"3D-model",drop_to_upload:"Sleep een 3D-model (.obj, .glb, .stl, .gltf, .splat of .ply) bestand hier om te uploaden"},annotated_image:a,audio:t,blocks:r,checkbox:i,code:d,color_picker:l,dataframe:s,dropdown:c,errors:p,file:u,highlighted_text:g,image:_,label:m,login:b,number:v,plot:h,radio:k,slider:w,video:f,chatbot:S};export{e as _name,a as annotated_image,t as audio,r as blocks,S as chatbot,i as checkbox,d as code,l as color_picker,o as common,s as dataframe,j as default,c as dropdown,p as errors,u as file,g as highlighted_text,_ as image,m as label,b as login,v as number,h as plot,k as radio,w as slider,n as upload_text,f as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/objFileLoader-B25jxNQb.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/objFileLoader-B25jxNQb.js new file mode 100644 index 0000000000000000000000000000000000000000..1084ded3b9ff97bc8c958123e483082bc4e7bca9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/objFileLoader-B25jxNQb.js @@ -0,0 +1,3 @@ +import{C as b,T as j,b9 as M,J as B,V as w,ah as V,L,bp as P,l as v,m as E,bq as C,d as x,ax as D}from"./index-CDrXokXW.js";import{A}from"./assetContainer-D7EiOqw6.js";import{S as T}from"./standardMaterial-C4-ZPPCc.js";import"./index-DWyDLubb.js";class f{constructor(){this.materials=[]}parseMTL(t,n,i,o){if(n instanceof ArrayBuffer)return;const l=n.split(` +`),h=/\s+/;let _,a=null;for(let c=0;c=0?r.substring(0,s):r;e=e.toLowerCase();const p=s>=0?r.substring(s+1).trim():"";if(e==="newmtl")a&&this.materials.push(a),t._blockEntityCollection=!!o,a=new T(p,t),a._parentContainer=o,t._blockEntityCollection=!1;else if(e==="kd"&&a)_=p.split(h,3).map(parseFloat),a.diffuseColor=b.FromArray(_);else if(e==="ka"&&a)_=p.split(h,3).map(parseFloat),a.ambientColor=b.FromArray(_);else if(e==="ks"&&a)_=p.split(h,3).map(parseFloat),a.specularColor=b.FromArray(_);else if(e==="ke"&&a)_=p.split(h,3).map(parseFloat),a.emissiveColor=b.FromArray(_);else if(e==="ns"&&a)a.specularPower=parseFloat(p);else if(e==="d"&&a)a.alpha=parseFloat(p);else if(e==="map_ka"&&a)a.ambientTexture=f._GetTexture(i,p,t);else if(e==="map_kd"&&a)a.diffuseTexture=f._GetTexture(i,p,t);else if(e==="map_ks"&&a)a.specularTexture=f._GetTexture(i,p,t);else if(e!=="map_ns")if(e==="map_bump"&&a){const d=p.split(h),F=d.indexOf("-bm");let g=null;F>=0&&(g=d[F+1],d.splice(F,2)),a.bumpTexture=f._GetTexture(i,d.join(" "),t),a.bumpTexture&&g!==null&&(a.bumpTexture.level=parseFloat(g))}else e==="map_d"&&a&&(a.opacityTexture=f._GetTexture(i,p,t))}a&&this.materials.push(a)}static _GetTexture(t,n,i){if(!n)return null;let o=t;if(t==="file:"){let l=n.lastIndexOf("\\");l===-1&&(l=n.lastIndexOf("/")),l>-1?o+=n.substring(l+1):o+=n}else o+=n;return new j(o,i,!1,f.INVERT_TEXTURE_Y)}}f.INVERT_TEXTURE_Y=!0;class m{constructor(t,n,i){this._positions=[],this._normals=[],this._uvs=[],this._colors=[],this._extColors=[],this._meshesFromObj=[],this._indicesForBabylon=[],this._wrappedPositionForBabylon=[],this._wrappedUvsForBabylon=[],this._wrappedColorsForBabylon=[],this._wrappedNormalsForBabylon=[],this._tuplePosNorm=[],this._curPositionInIndices=0,this._hasMeshes=!1,this._unwrappedPositionsForBabylon=[],this._unwrappedColorsForBabylon=[],this._unwrappedNormalsForBabylon=[],this._unwrappedUVForBabylon=[],this._triangles=[],this._materialNameFromObj="",this._objMeshName="",this._increment=1,this._isFirstMaterial=!0,this._grayColor=new M(.5,.5,.5,1),this._hasLineData=!1,this._materialToUse=t,this._babylonMeshesArray=n,this._loadingOptions=i}_isInArray(t,n){t[n[0]]||(t[n[0]]={normals:[],idx:[]});const i=t[n[0]].normals.indexOf(n[1]);return i===-1?-1:t[n[0]].idx[i]}_isInArrayUV(t,n){t[n[0]]||(t[n[0]]={normals:[],idx:[],uv:[]});const i=t[n[0]].normals.indexOf(n[1]);return i!=1&&n[2]===t[n[0]].uv[i]?t[n[0]].idx[i]:-1}_setData(t){t.indiceUvsFromObj??(t.indiceUvsFromObj=-1),t.indiceNormalFromObj??(t.indiceNormalFromObj=-1);let n;this._loadingOptions.optimizeWithUV?n=this._isInArrayUV(this._tuplePosNorm,[t.indicePositionFromObj,t.indiceNormalFromObj,t.indiceUvsFromObj]):n=this._isInArray(this._tuplePosNorm,[t.indicePositionFromObj,t.indiceNormalFromObj]),n===-1?(this._indicesForBabylon.push(this._wrappedPositionForBabylon.length),this._wrappedPositionForBabylon.push(t.positionVectorFromOBJ),t.textureVectorFromOBJ!==void 0&&this._wrappedUvsForBabylon.push(t.textureVectorFromOBJ),t.normalsVectorFromOBJ!==void 0&&this._wrappedNormalsForBabylon.push(t.normalsVectorFromOBJ),t.positionColorsFromOBJ!==void 0&&this._wrappedColorsForBabylon.push(t.positionColorsFromOBJ),this._tuplePosNorm[t.indicePositionFromObj].normals.push(t.indiceNormalFromObj),this._tuplePosNorm[t.indicePositionFromObj].idx.push(this._curPositionInIndices++),this._loadingOptions.optimizeWithUV&&this._tuplePosNorm[t.indicePositionFromObj].uv.push(t.indiceUvsFromObj)):this._indicesForBabylon.push(n)}_unwrapData(){try{for(let t=0;t0&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._unwrapData(),this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._handledMesh.indices=this._indicesForBabylon.slice(),this._handledMesh.positions=this._unwrappedPositionsForBabylon.slice(),this._unwrappedNormalsForBabylon.length&&(this._handledMesh.normals=this._unwrappedNormalsForBabylon.slice()),this._unwrappedUVForBabylon.length&&(this._handledMesh.uvs=this._unwrappedUVForBabylon.slice()),this._unwrappedColorsForBabylon.length&&(this._handledMesh.colors=this._unwrappedColorsForBabylon.slice()),this._handledMesh.hasLines=this._hasLineData,this._indicesForBabylon.length=0,this._unwrappedPositionsForBabylon.length=0,this._unwrappedColorsForBabylon.length=0,this._unwrappedNormalsForBabylon.length=0,this._unwrappedUVForBabylon.length=0,this._hasLineData=!1)}_optimizeNormals(t){const n=t.getVerticesData(B.PositionKind),i=t.getVerticesData(B.NormalKind),o={};if(!n||!i)return;for(let h=0;hthis._triangles.push(r[0],r[s],r[s+1]),this._handednessSign=1):i.useRightHandedSystem?(this._pushTriangle=(r,s)=>this._triangles.push(r[0],r[s+1],r[s]),this._handednessSign=1):(this._pushTriangle=(r,s)=>this._triangles.push(r[0],r[s],r[s+1]),this._handednessSign=-1);const h=n.split(` +`),_=[];let a=[];_.push(a);for(let r=0;r=7){const p=parseFloat(e[4]),d=parseFloat(e[5]),F=parseFloat(e[6]);this._colors.push(new M(p>1?p/255:p,d>1?d/255:d,F>1?F/255:F,e.length===7||e[7]===void 0?1:parseFloat(e[7])))}else this._colors.push(this._grayColor)}else if((e=m.NormalPattern.exec(s))!==null)this._normals.push(new w(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])));else if((e=m.UVPattern.exec(s))!==null)this._uvs.push(new V(parseFloat(e[1])*this._loadingOptions.UVScaling.x,parseFloat(e[2])*this._loadingOptions.UVScaling.y));else if((e=m.FacePattern3.exec(s))!==null)this._setDataForCurrentFaceWithPattern3(e[1].trim().split(" "),1);else if((e=m.FacePattern4.exec(s))!==null)this._setDataForCurrentFaceWithPattern4(e[1].trim().split(" "),1);else if((e=m.FacePattern5.exec(s))!==null)this._setDataForCurrentFaceWithPattern5(e[1].trim().split(" "),1);else if((e=m.FacePattern2.exec(s))!==null)this._setDataForCurrentFaceWithPattern2(e[1].trim().split(" "),1);else if((e=m.FacePattern1.exec(s))!==null)this._setDataForCurrentFaceWithPattern1(e[1].trim().split(" "),1);else if((e=m.LinePattern1.exec(s))!==null)this._setDataForCurrentFaceWithPattern1(e[1].trim().split(" "),0),this._hasLineData=!0;else if((e=m.LinePattern2.exec(s))!==null)this._setDataForCurrentFaceWithPattern2(e[1].trim().split(" "),0),this._hasLineData=!0;else if(e=m._GetZbrushMRGB(s,!this._loadingOptions.importVertexColors))for(const p of e)this._extColors.push(p);else if((e=m.LinePattern3.exec(s))!==null)this._setDataForCurrentFaceWithPattern3(e[1].trim().split(" "),0),this._hasLineData=!0;else if(m.GroupDescriptor.test(s)||m.ObjectDescriptor.test(s)){const p={name:s.substring(2).trim(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:m.ObjectDescriptor.test(s)};this._addPreviousObjMesh(),this._meshesFromObj.push(p),this._hasMeshes=!0,this._isFirstMaterial=!0,this._increment=1}else if(m.UseMtlDescriptor.test(s)){if(this._materialNameFromObj=s.substring(7).trim(),!this._isFirstMaterial||!this._hasMeshes){this._addPreviousObjMesh();const p={name:(this._objMeshName||"mesh")+"_mm"+this._increment.toString(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:!1};this._increment++,this._meshesFromObj.push(p),this._hasMeshes=!0}this._hasMeshes&&this._isFirstMaterial&&(this._meshesFromObj[this._meshesFromObj.length-1].materialName=this._materialNameFromObj,this._isFirstMaterial=!1)}else m.MtlLibGroupDescriptor.test(s)?l(s.substring(7).trim()):m.SmoothDescriptor.test(s)||L.Log("Unhandled expression at line : "+s)}if(this._hasMeshes&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData(),this._handledMesh.indices=this._indicesForBabylon,this._handledMesh.positions=this._unwrappedPositionsForBabylon,this._unwrappedNormalsForBabylon.length&&(this._handledMesh.normals=this._unwrappedNormalsForBabylon),this._unwrappedUVForBabylon.length&&(this._handledMesh.uvs=this._unwrappedUVForBabylon),this._unwrappedColorsForBabylon.length&&(this._handledMesh.colors=this._unwrappedColorsForBabylon),this._handledMesh.hasLines=this._hasLineData),!this._hasMeshes){let r=null;if(this._indicesForBabylon.length)this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData();else{for(const s of this._positions)this._unwrappedPositionsForBabylon.push(s.x,s.y,s.z);if(this._normals.length)for(const s of this._normals)this._unwrappedNormalsForBabylon.push(s.x,s.y,s.z);if(this._uvs.length)for(const s of this._uvs)this._unwrappedUVForBabylon.push(s.x,s.y);if(this._extColors.length)for(const s of this._extColors)this._unwrappedColorsForBabylon.push(s.r,s.g,s.b,s.a);else if(this._colors.length)for(const s of this._colors)this._unwrappedColorsForBabylon.push(s.r,s.g,s.b,s.a);this._materialNameFromObj||(r=new T(P.RandomId(),i),r.pointsCloud=!0,this._materialNameFromObj=r.name,this._normals.length||(r.disableLighting=!0,r.emissiveColor=b.White()))}this._meshesFromObj.push({name:P.RandomId(),indices:this._indicesForBabylon,positions:this._unwrappedPositionsForBabylon,colors:this._unwrappedColorsForBabylon,normals:this._unwrappedNormalsForBabylon,uvs:this._unwrappedUVForBabylon,materialName:this._materialNameFromObj,directMaterial:r,isObject:!0,hasLines:this._hasLineData})}for(let r=0;r=0;--p)if(this._meshesFromObj[p].isObject&&this._meshesFromObj[p]._babylonMesh){s.parent=this._meshesFromObj[p]._babylonMesh;break}}if(this._materialToUse.push(this._meshesFromObj[r].materialName),this._handledMesh.hasLines&&(s._internalMetadata??(s._internalMetadata={}),s._internalMetadata._isLine=!0),this._handledMesh.positions?.length===0){this._babylonMeshesArray.push(s);continue}const e=new E;if(e.indices=this._handledMesh.indices,e.positions=this._handledMesh.positions,this._loadingOptions.computeNormals||!this._handledMesh.normals){const p=new Array;E.ComputeNormals(this._handledMesh.positions,this._handledMesh.indices,p),e.normals=p}else e.normals=this._handledMesh.normals;this._handledMesh.uvs&&(e.uvs=this._handledMesh.uvs),this._handledMesh.colors&&(e.colors=this._handledMesh.colors),e.applyToMesh(s),this._loadingOptions.invertY&&(s.scaling.y*=-1),this._loadingOptions.optimizeNormals&&this._optimizeNormals(s),this._babylonMeshesArray.push(s),this._handledMesh.directMaterial&&(s.material=this._handledMesh.directMaterial)}}}m.ObjectDescriptor=/^o/;m.GroupDescriptor=/^g/;m.MtlLibGroupDescriptor=/^mtllib /;m.UseMtlDescriptor=/^usemtl /;m.SmoothDescriptor=/^s /;m.VertexPattern=/^v(\s+[\d|.|+|\-|e|E]+){3,7}/;m.NormalPattern=/^vn(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/;m.UVPattern=/^vt(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/;m.FacePattern1=/^f\s+(([\d]{1,}[\s]?){3,})+/;m.FacePattern2=/^f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/;m.FacePattern3=/^f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/;m.FacePattern4=/^f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/;m.FacePattern5=/^f\s+(((-[\d]{1,}\/-[\d]{1,}\/-[\d]{1,}[\s]?){3,})+)/;m.LinePattern1=/^l\s+(([\d]{1,}[\s]?){2,})+/;m.LinePattern2=/^l\s+((([\d]{1,}\/[\d]{1,}[\s]?){2,})+)/;m.LinePattern3=/^l\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){2,})+)/;class u{static get INVERT_TEXTURE_Y(){return f.INVERT_TEXTURE_Y}static set INVERT_TEXTURE_Y(t){f.INVERT_TEXTURE_Y=t}constructor(t){this.name=C.name,this.extensions=C.extensions,this._assetContainer=null,this._loadingOptions={...u._DefaultLoadingOptions,...t??{}}}static get _DefaultLoadingOptions(){return{computeNormals:u.COMPUTE_NORMALS,optimizeNormals:u.OPTIMIZE_NORMALS,importVertexColors:u.IMPORT_VERTEX_COLORS,invertY:u.INVERT_Y,invertTextureY:u.INVERT_TEXTURE_Y,UVScaling:u.UV_SCALING,materialLoadingFailsSilently:u.MATERIAL_LOADING_FAILS_SILENTLY,optimizeWithUV:u.OPTIMIZE_WITH_UV,skipMaterials:u.SKIP_MATERIALS,useLegacyBehavior:u.USE_LEGACY_BEHAVIOR}}_loadMTL(t,n,i,o){const l=n+t;x.LoadFile(l,i,void 0,void 0,!1,(h,_)=>{o(l,_)})}createPlugin(t){return new u(t[C.name])}canDirectLoad(){return!1}importMeshAsync(t,n,i,o){return this._parseSolidAsync(t,n,i,o).then(l=>({meshes:l,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}))}loadAsync(t,n,i){return this.importMeshAsync(null,t,n,i).then(()=>{})}loadAssetContainerAsync(t,n,i){const o=new A(t);return this._assetContainer=o,this.importMeshAsync(null,t,n,i).then(l=>(l.meshes.forEach(h=>o.meshes.push(h)),l.meshes.forEach(h=>{const _=h.material;_&&o.materials.indexOf(_)==-1&&(o.materials.push(_),_.getActiveTextures().forEach(c=>{o.textures.indexOf(c)==-1&&o.textures.push(c)}))}),this._assetContainer=null,o)).catch(l=>{throw this._assetContainer=null,l})}_parseSolidAsync(t,n,i,o){let l="";const h=new f,_=[],a=[];i=i.replace(/#.*$/gm,"").trim(),new m(_,a,this._loadingOptions).parse(t,i,n,this._assetContainer,s=>{l=s});const r=[];return l!==""&&!this._loadingOptions.skipMaterials&&r.push(new Promise((s,e)=>{this._loadMTL(l,o,p=>{try{h.parseMTL(n,p,o,this._assetContainer);for(let d=0;d-1;)g.push(y),F=y+1;if(y===-1&&g.length===0)h.materials[d].dispose();else for(let O=0;O{x.Warn(`Error downloading MTL file: '${l}'`),this._loadingOptions.materialLoadingFailsSilently?s():e(d)})})),Promise.all(r).then(()=>{const s=e=>!!(e._internalMetadata?._isLine??!1);return a.forEach(e=>{if(s(e)){let p=e.material??new T(e.name+"_line",n);p.getBindedMeshes().filter(F=>!s(F)).length>0&&(p=p.clone(p.name+"_line")??p),p.wireframe=!0,e.material=p,e._internalMetadata&&(e._internalMetadata._isLine=void 0)}}),a})}}u.OPTIMIZE_WITH_UV=!0;u.INVERT_Y=!1;u.IMPORT_VERTEX_COLORS=!1;u.COMPUTE_NORMALS=!1;u.OPTIMIZE_NORMALS=!1;u.UV_SCALING=new V(1,1);u.SKIP_MATERIALS=!1;u.MATERIAL_LOADING_FAILS_SILENTLY=!0;u.USE_LEGACY_BEHAVIOR=!1;D(new u);export{u as OBJFileLoader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/objectModelMapping-CGWnurZP.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/objectModelMapping-CGWnurZP.js new file mode 100644 index 0000000000000000000000000000000000000000..c78933a0def53eb669ff136de570dd40894f61c1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/objectModelMapping-CGWnurZP.js @@ -0,0 +1 @@ +import{bk as d,M as l,V as h,aI as L,T as P,an as j,_ as m,s as f,ad as C,R as N,ah as y,ao as b,b9 as R,aK as M}from"./index-CDrXokXW.js";j.AddNodeConstructor("Light_Type_2",(e,t)=>()=>new a(e,h.Zero(),h.Zero(),0,0,t));class a extends d{get iesProfileTexture(){return this._iesProfileTexture}set iesProfileTexture(t){this._iesProfileTexture!==t&&(this._iesProfileTexture=t,this._iesProfileTexture&&a._IsTexture(this._iesProfileTexture)&&this._iesProfileTexture.onLoadObservable.addOnce(()=>{this._markMeshesAsLightDirty()}))}get angle(){return this._angle}set angle(t){this._angle=t,this._cosHalfAngle=Math.cos(t*.5),this._projectionTextureProjectionLightDirty=!0,this.forceProjectionMatrixCompute(),this._computeAngleValues()}get innerAngle(){return this._innerAngle}set innerAngle(t){this._innerAngle=t,this._computeAngleValues()}get shadowAngleScale(){return this._shadowAngleScale}set shadowAngleScale(t){this._shadowAngleScale=t,this.forceProjectionMatrixCompute()}get projectionTextureMatrix(){return this._projectionTextureMatrix}get projectionTextureLightNear(){return this._projectionTextureLightNear}set projectionTextureLightNear(t){this._projectionTextureLightNear=t,this._projectionTextureProjectionLightDirty=!0}get projectionTextureLightFar(){return this._projectionTextureLightFar}set projectionTextureLightFar(t){this._projectionTextureLightFar=t,this._projectionTextureProjectionLightDirty=!0}get projectionTextureUpDirection(){return this._projectionTextureUpDirection}set projectionTextureUpDirection(t){this._projectionTextureUpDirection=t,this._projectionTextureProjectionLightDirty=!0}get projectionTexture(){return this._projectionTexture}set projectionTexture(t){this._projectionTexture!==t&&(this._projectionTexture=t,this._projectionTextureDirty=!0,this._projectionTexture&&!this._projectionTexture.isReady()&&(a._IsProceduralTexture(this._projectionTexture)?this._projectionTexture.getEffect().executeWhenCompiled(()=>{this._markMeshesAsLightDirty()}):a._IsTexture(this._projectionTexture)&&this._projectionTexture.onLoadObservable.addOnce(()=>{this._markMeshesAsLightDirty()})))}static _IsProceduralTexture(t){return t.onGeneratedObservable!==void 0}static _IsTexture(t){return t.onLoadObservable!==void 0}get projectionTextureProjectionLightMatrix(){return this._projectionTextureProjectionLightMatrix}set projectionTextureProjectionLightMatrix(t){this._projectionTextureProjectionLightMatrix=t,this._projectionTextureProjectionLightDirty=!1,this._projectionTextureDirty=!0}constructor(t,r,i,n,s,u,_){super(t,u,_),this._innerAngle=0,this._iesProfileTexture=null,this._projectionTextureMatrix=l.Zero(),this._projectionTextureLightNear=1e-6,this._projectionTextureLightFar=1e3,this._projectionTextureUpDirection=h.Up(),this._projectionTextureViewLightDirty=!0,this._projectionTextureProjectionLightDirty=!0,this._projectionTextureDirty=!0,this._projectionTextureViewTargetVector=h.Zero(),this._projectionTextureViewLightMatrix=l.Zero(),this._projectionTextureProjectionLightMatrix=l.Zero(),this._projectionTextureScalingMatrix=l.FromValues(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),this.position=r,this.direction=i,this.angle=n,this.exponent=s}getClassName(){return"SpotLight"}getTypeID(){return L.LIGHTTYPEID_SPOTLIGHT}_setDirection(t){super._setDirection(t),this._projectionTextureViewLightDirty=!0}_setPosition(t){super._setPosition(t),this._projectionTextureViewLightDirty=!0}_setDefaultShadowProjectionMatrix(t,r,i){const n=this.getScene().activeCamera;if(!n)return;this._shadowAngleScale=this._shadowAngleScale||1;const s=this._shadowAngleScale*this._angle,u=this.shadowMinZ!==void 0?this.shadowMinZ:n.minZ,_=this.shadowMaxZ!==void 0?this.shadowMaxZ:n.maxZ,c=this.getScene().getEngine().useReverseDepthBuffer;l.PerspectiveFovLHToRef(s,1,c?_:u,c?u:_,t,!0,this._scene.getEngine().isNDCHalfZRange,void 0,c)}_computeProjectionTextureViewLightMatrix(){this._projectionTextureViewLightDirty=!1,this._projectionTextureDirty=!0,this.getAbsolutePosition().addToRef(this.getShadowDirection(),this._projectionTextureViewTargetVector),l.LookAtLHToRef(this.getAbsolutePosition(),this._projectionTextureViewTargetVector,this._projectionTextureUpDirection,this._projectionTextureViewLightMatrix)}_computeProjectionTextureProjectionLightMatrix(){this._projectionTextureProjectionLightDirty=!1,this._projectionTextureDirty=!0;const t=this.projectionTextureLightFar,r=this.projectionTextureLightNear,i=t/(t-r),n=-i*r,s=1/Math.tan(this._angle/2);l.FromValuesToRef(s/1,0,0,0,0,s,0,0,0,0,i,1,0,0,n,0,this._projectionTextureProjectionLightMatrix)}_computeProjectionTextureMatrix(){if(this._projectionTextureDirty=!1,this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix,this._projectionTextureMatrix),this._projectionTexture instanceof P){const t=this._projectionTexture.uScale/2,r=this._projectionTexture.vScale/2;l.FromValuesToRef(t,0,0,0,0,r,0,0,0,0,.5,0,.5,.5,.5,1,this._projectionTextureScalingMatrix)}this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix,this._projectionTextureMatrix)}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightDirection",3),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}_computeAngleValues(){this._lightAngleScale=1/Math.max(.001,Math.cos(this._innerAngle*.5)-this._cosHalfAngle),this._lightAngleOffset=-this._cosHalfAngle*this._lightAngleScale}transferTexturesToEffect(t,r){return this.projectionTexture&&this.projectionTexture.isReady()&&(this._projectionTextureViewLightDirty&&this._computeProjectionTextureViewLightMatrix(),this._projectionTextureProjectionLightDirty&&this._computeProjectionTextureProjectionLightMatrix(),this._projectionTextureDirty&&this._computeProjectionTextureMatrix(),t.setMatrix("textureProjectionMatrix"+r,this._projectionTextureMatrix),t.setTexture("projectionLightTexture"+r,this.projectionTexture)),this._iesProfileTexture&&this._iesProfileTexture.isReady()&&t.setTexture("iesLightTexture"+r,this._iesProfileTexture),this}transferToEffect(t,r){let i;const n=this._scene.floatingOriginOffset;return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x-n.x,this.transformedPosition.y-n.y,this.transformedPosition.z-n.z,this.exponent,r),i=h.Normalize(this.transformedDirection)):(this._uniformBuffer.updateFloat4("vLightData",this.position.x-n.x,this.position.y-n.y,this.position.z-n.z,this.exponent,r),i=h.Normalize(this.direction)),this._uniformBuffer.updateFloat4("vLightDirection",i.x,i.y,i.z,this._cosHalfAngle,r),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,this._lightAngleScale,this._lightAngleOffset,r),this}transferToNodeMaterialEffect(t,r){let i;return this.computeTransformedInformation()?i=h.Normalize(this.transformedDirection):i=h.Normalize(this.direction),this.getScene().useRightHandedSystem?t.setFloat3(r,-i.x,-i.y,-i.z):t.setFloat3(r,i.x,i.y,i.z),this}dispose(){super.dispose(),this._projectionTexture&&this._projectionTexture.dispose(),this._iesProfileTexture&&(this._iesProfileTexture.dispose(),this._iesProfileTexture=null)}getDepthMinZ(t){const r=this._scene.getEngine(),i=this.shadowMinZ!==void 0?this.shadowMinZ:t?.minZ??0;return r.useReverseDepthBuffer&&r.isNDCHalfZRange?i:this._scene.getEngine().isNDCHalfZRange?0:i}getDepthMaxZ(t){const r=this._scene.getEngine(),i=this.shadowMaxZ!==void 0?this.shadowMaxZ:t?.maxZ??1e4;return r.useReverseDepthBuffer&&r.isNDCHalfZRange?0:i}prepareLightSpecificDefines(t,r){t["SPOTLIGHT"+r]=!0,t["PROJECTEDLIGHTTEXTURE"+r]=!!(this.projectionTexture&&this.projectionTexture.isReady()),t["IESLIGHTTEXTURE"+r]=!!(this._iesProfileTexture&&this._iesProfileTexture.isReady())}}m([f()],a.prototype,"angle",null);m([f()],a.prototype,"innerAngle",null);m([f()],a.prototype,"shadowAngleScale",null);m([f()],a.prototype,"exponent",void 0);m([f()],a.prototype,"projectionTextureLightNear",null);m([f()],a.prototype,"projectionTextureLightFar",null);m([f()],a.prototype,"projectionTextureUpDirection",null);m([C("projectedLightTexture")],a.prototype,"_projectionTexture",void 0);N("BABYLON.SpotLight",a);const D=[{regex:new RegExp("^/nodes/\\d+/extensions/")}];class S{constructor(t,r){this._gltf=t,this._infoTree=r}convert(t){let r=this._gltf,i=this._infoTree,n;if(!t.startsWith("/"))throw new Error("Path must start with a /");const s=t.split("/");if(s.shift(),s[s.length-1].includes(".length")){const c=s[s.length-1].split(".");s.pop(),s.push(...c)}let u=!1;for(const _ of s){const c=_==="length";if(c&&!i.__array__)throw new Error(`Path ${t} is invalid`);if(i.__ignoreObjectTree__&&(u=!0),i.__array__&&!c)i=i.__array__;else if(i=i[_],!i)throw new Error(`Path ${t} is invalid`);if(!u)if(r===void 0){if(!D.find(x=>x.regex.test(t)))throw new Error(`Path ${t} is invalid`)}else c||(r=r?.[_]);(i.__target__||c)&&(n=r)}return{object:n,info:i}}}const v={length:{type:"number",get:e=>e.length,getTarget:e=>e.map(t=>t._babylonTransformNode),getPropertyName:[()=>"length"]},__array__:{__target__:!0,translation:{type:"Vector3",get:e=>e._babylonTransformNode?.position,set:(e,t)=>t._babylonTransformNode?.position.copyFrom(e),getTarget:e=>e._babylonTransformNode,getPropertyName:[()=>"position"]},rotation:{type:"Quaternion",get:e=>e._babylonTransformNode?.rotationQuaternion,set:(e,t)=>t._babylonTransformNode?.rotationQuaternion?.copyFrom(e),getTarget:e=>e._babylonTransformNode,getPropertyName:[()=>"rotationQuaternion"]},scale:{type:"Vector3",get:e=>e._babylonTransformNode?.scaling,set:(e,t)=>t._babylonTransformNode?.scaling.copyFrom(e),getTarget:e=>e._babylonTransformNode,getPropertyName:[()=>"scaling"]},weights:{length:{type:"number",get:e=>e._numMorphTargets,getTarget:e=>e._babylonTransformNode,getPropertyName:[()=>"influence"]},__array__:{__target__:!0,type:"number",get:(e,t)=>t!==void 0?e._primitiveBabylonMeshes?.[0].morphTargetManager?.getTarget(t).influence:void 0,getTarget:e=>e._babylonTransformNode,getPropertyName:[()=>"influence"]},type:"number[]",get:(e,t)=>[0],getTarget:e=>e._babylonTransformNode,getPropertyName:[()=>"influence"]},matrix:{type:"Matrix",get:e=>l.Compose(e._babylonTransformNode?.scaling,e._babylonTransformNode?.rotationQuaternion,e._babylonTransformNode?.position),getTarget:e=>e._babylonTransformNode,isReadOnly:!0},globalMatrix:{type:"Matrix",get:e=>{const t=l.Identity();let r=e.parent;for(;r&&r.parent;)r=r.parent;const i=e._babylonTransformNode?.position._isDirty||e._babylonTransformNode?.rotationQuaternion?._isDirty||e._babylonTransformNode?.scaling._isDirty;if(r){const n=r._babylonTransformNode?.computeWorldMatrix(!0).invert();n&&e._babylonTransformNode?.computeWorldMatrix(i)?.multiplyToRef(n,t)}else e._babylonTransformNode&&t.copyFrom(e._babylonTransformNode.computeWorldMatrix(i));return t},getTarget:e=>e._babylonTransformNode,isReadOnly:!0},extensions:{EXT_lights_ies:{multiplier:{type:"number",get:e=>e._babylonTransformNode?.getChildren(t=>t instanceof a,!0)[0]?.intensity,getTarget:e=>e._babylonTransformNode?.getChildren(t=>t instanceof a,!0)[0],set:(e,t)=>{if(t._babylonTransformNode){const r=t._babylonTransformNode.getChildren(i=>i instanceof a,!0)[0];r&&(r.intensity=e)}}},color:{type:"Color3",get:e=>e._babylonTransformNode?.getChildren(t=>t instanceof a,!0)[0]?.diffuse,getTarget:e=>e._babylonTransformNode?.getChildren(t=>t instanceof a,!0)[0],set:(e,t)=>{if(t._babylonTransformNode){const r=t._babylonTransformNode.getChildren(i=>i instanceof a,!0)[0];r&&(r.diffuse=e)}}}},KHR_node_visibility:{visible:{type:"boolean",get:e=>e._primitiveBabylonMeshes?e._primitiveBabylonMeshes[0].isVisible:!1,getTarget:()=>{},set:(e,t)=>{t._primitiveBabylonMeshes&&t._primitiveBabylonMeshes.forEach(r=>r.isVisible=e)}}}}}},F={length:{type:"number",get:e=>e.length,getTarget:e=>e.map(t=>t._babylonAnimationGroup),getPropertyName:[()=>"length"]},__array__:{}},w={length:{type:"number",get:e=>e.length,getTarget:e=>e.map(t=>t.primitives[0]._instanceData?.babylonSourceMesh),getPropertyName:[()=>"length"]},__array__:{}},A={__array__:{__target__:!0,orthographic:{xmag:{componentsCount:2,type:"Vector2",get:e=>new y(e._babylonCamera?.orthoLeft??0,e._babylonCamera?.orthoRight??0),set:(e,t)=>{t._babylonCamera&&(t._babylonCamera.orthoLeft=e.x,t._babylonCamera.orthoRight=e.y)},getTarget:e=>e,getPropertyName:[()=>"orthoLeft",()=>"orthoRight"]},ymag:{componentsCount:2,type:"Vector2",get:e=>new y(e._babylonCamera?.orthoBottom??0,e._babylonCamera?.orthoTop??0),set:(e,t)=>{t._babylonCamera&&(t._babylonCamera.orthoBottom=e.x,t._babylonCamera.orthoTop=e.y)},getTarget:e=>e,getPropertyName:[()=>"orthoBottom",()=>"orthoTop"]},zfar:{type:"number",get:e=>e._babylonCamera?.maxZ,set:(e,t)=>{t._babylonCamera&&(t._babylonCamera.maxZ=e)},getTarget:e=>e,getPropertyName:[()=>"maxZ"]},znear:{type:"number",get:e=>e._babylonCamera?.minZ,set:(e,t)=>{t._babylonCamera&&(t._babylonCamera.minZ=e)},getTarget:e=>e,getPropertyName:[()=>"minZ"]}},perspective:{aspectRatio:{type:"number",get:e=>e._babylonCamera?.getEngine().getAspectRatio(e._babylonCamera),getTarget:e=>e,getPropertyName:[()=>"aspectRatio"],isReadOnly:!0},yfov:{type:"number",get:e=>e._babylonCamera?.fov,set:(e,t)=>{t._babylonCamera&&(t._babylonCamera.fov=e)},getTarget:e=>e,getPropertyName:[()=>"fov"]},zfar:{type:"number",get:e=>e._babylonCamera?.maxZ,set:(e,t)=>{t._babylonCamera&&(t._babylonCamera.maxZ=e)},getTarget:e=>e,getPropertyName:[()=>"maxZ"]},znear:{type:"number",get:e=>e._babylonCamera?.minZ,set:(e,t)=>{t._babylonCamera&&(t._babylonCamera.minZ=e)},getTarget:e=>e,getPropertyName:[()=>"minZ"]}}}},H={__array__:{__target__:!0,emissiveFactor:{type:"Color3",get:(e,t,r)=>o(e,t,r).emissiveColor,set:(e,t,r,i)=>o(t,r,i).emissiveColor.copyFrom(e),getTarget:(e,t,r)=>o(e,t,r),getPropertyName:[()=>"emissiveColor"]},emissiveTexture:{extensions:{KHR_texture_transform:g("emissiveTexture")}},normalTexture:{scale:{type:"number",get:(e,t,r)=>p(e,r,"bumpTexture")?.level,set:(e,t,r,i)=>{const n=p(t,i,"bumpTexture");n&&(n.level=e)},getTarget:(e,t,r)=>o(e,t,r),getPropertyName:[()=>"level"]},extensions:{KHR_texture_transform:g("bumpTexture")}},occlusionTexture:{strength:{type:"number",get:(e,t,r)=>o(e,t,r).ambientTextureStrength,set:(e,t,r,i)=>{const n=o(t,r,i);n&&(n.ambientTextureStrength=e)},getTarget:(e,t,r)=>o(e,t,r),getPropertyName:[()=>"ambientTextureStrength"]},extensions:{KHR_texture_transform:g("ambientTexture")}},pbrMetallicRoughness:{baseColorFactor:{type:"Color4",get:(e,t,r)=>{const i=o(e,t,r);return R.FromColor3(i.albedoColor,i.alpha)},set:(e,t,r,i)=>{const n=o(t,r,i);n.albedoColor.set(e.r,e.g,e.b),n.alpha=e.a},getTarget:(e,t,r)=>o(e,t,r),getPropertyName:[()=>"albedoColor",()=>"alpha"]},baseColorTexture:{extensions:{KHR_texture_transform:g("albedoTexture")}},metallicFactor:{type:"number",get:(e,t,r)=>o(e,t,r).metallic,set:(e,t,r,i)=>{const n=o(t,r,i);n&&(n.metallic=e)},getTarget:(e,t,r)=>o(e,t,r),getPropertyName:[()=>"metallic"]},roughnessFactor:{type:"number",get:(e,t,r)=>o(e,t,r).roughness,set:(e,t,r,i)=>{const n=o(t,r,i);n&&(n.roughness=e)},getTarget:(e,t,r)=>o(e,t,r),getPropertyName:[()=>"roughness"]},metallicRoughnessTexture:{extensions:{KHR_texture_transform:g("metallicTexture")}}},extensions:{KHR_materials_anisotropy:{anisotropyStrength:{type:"number",get:(e,t,r)=>o(e,t,r).anisotropy.intensity,set:(e,t,r,i)=>{o(t,r,i).anisotropy.intensity=e},getTarget:(e,t,r)=>o(e,t,r),getPropertyName:[()=>"anisotropy.intensity"]},anisotropyRotation:{type:"number",get:(e,t,r)=>o(e,t,r).anisotropy.angle,set:(e,t,r,i)=>{o(t,r,i).anisotropy.angle=e},getTarget:(e,t,r)=>o(e,t,r),getPropertyName:[()=>"anisotropy.angle"]},anisotropyTexture:{extensions:{KHR_texture_transform:g("anisotropy","texture")}}},KHR_materials_clearcoat:{clearcoatFactor:{type:"number",get:(e,t,r)=>o(e,t,r).clearCoat.intensity,set:(e,t,r,i)=>{o(t,r,i).clearCoat.intensity=e},getTarget:(e,t,r)=>o(e,t,r),getPropertyName:[()=>"clearCoat.intensity"]},clearcoatRoughnessFactor:{type:"number",get:(e,t,r)=>o(e,t,r).clearCoat.roughness,set:(e,t,r,i)=>{o(t,r,i).clearCoat.roughness=e},getTarget:(e,t,r)=>o(e,t,r),getPropertyName:[()=>"clearCoat.roughness"]},clearcoatTexture:{extensions:{KHR_texture_transform:g("clearCoat","texture")}},clearcoatNormalTexture:{scale:{type:"number",get:(e,t,r)=>o(e,t,r).clearCoat.bumpTexture?.level,getTarget:o,set:(e,t,r,i)=>o(t,r,i).clearCoat.bumpTexture.level=e},extensions:{KHR_texture_transform:g("clearCoat","bumpTexture")}},clearcoatRoughnessTexture:{extensions:{KHR_texture_transform:g("clearCoat","textureRoughness")}}},KHR_materials_dispersion:{dispersion:{type:"number",get:(e,t,r)=>o(e,t,r).subSurface.dispersion,getTarget:o,set:(e,t,r,i)=>o(t,r,i).subSurface.dispersion=e}},KHR_materials_emissive_strength:{emissiveStrength:{type:"number",get:(e,t,r)=>o(e,t,r).emissiveIntensity,getTarget:o,set:(e,t,r,i)=>o(t,r,i).emissiveIntensity=e}},KHR_materials_ior:{ior:{type:"number",get:(e,t,r)=>o(e,t,r).indexOfRefraction,getTarget:o,set:(e,t,r,i)=>o(t,r,i).indexOfRefraction=e}},KHR_materials_iridescence:{iridescenceFactor:{type:"number",get:(e,t,r)=>o(e,t,r).iridescence.intensity,getTarget:o,set:(e,t,r,i)=>o(t,r,i).iridescence.intensity=e},iridescenceIor:{type:"number",get:(e,t,r)=>o(e,t,r).iridescence.indexOfRefraction,getTarget:o,set:(e,t,r,i)=>o(t,r,i).iridescence.indexOfRefraction=e},iridescenceTexture:{extensions:{KHR_texture_transform:g("iridescence","texture")}},iridescenceThicknessMaximum:{type:"number",get:(e,t,r)=>o(e,t,r).iridescence.maximumThickness,getTarget:o,set:(e,t,r,i)=>o(t,r,i).iridescence.maximumThickness=e},iridescenceThicknessMinimum:{type:"number",get:(e,t,r)=>o(e,t,r).iridescence.minimumThickness,getTarget:o,set:(e,t,r,i)=>o(t,r,i).iridescence.minimumThickness=e},iridescenceThicknessTexture:{extensions:{KHR_texture_transform:g("iridescence","thicknessTexture")}}},KHR_materials_sheen:{sheenColorFactor:{type:"Color3",get:(e,t,r)=>o(e,t,r).sheen.color,getTarget:o,set:(e,t,r,i)=>o(t,r,i).sheen.color.copyFrom(e)},sheenColorTexture:{extensions:{KHR_texture_transform:g("sheen","texture")}},sheenRoughnessFactor:{type:"number",get:(e,t,r)=>o(e,t,r).sheen.intensity,getTarget:o,set:(e,t,r,i)=>o(t,r,i).sheen.intensity=e},sheenRoughnessTexture:{extensions:{KHR_texture_transform:g("sheen","thicknessTexture")}}},KHR_materials_specular:{specularFactor:{type:"number",get:(e,t,r)=>o(e,t,r).metallicF0Factor,getTarget:o,set:(e,t,r,i)=>o(t,r,i).metallicF0Factor=e,getPropertyName:[()=>"metallicF0Factor"]},specularColorFactor:{type:"Color3",get:(e,t,r)=>o(e,t,r).metallicReflectanceColor,getTarget:o,set:(e,t,r,i)=>o(t,r,i).metallicReflectanceColor.copyFrom(e),getPropertyName:[()=>"metallicReflectanceColor"]},specularTexture:{extensions:{KHR_texture_transform:g("metallicReflectanceTexture")}},specularColorTexture:{extensions:{KHR_texture_transform:g("reflectanceTexture")}}},KHR_materials_transmission:{transmissionFactor:{type:"number",get:(e,t,r)=>o(e,t,r).subSurface.refractionIntensity,getTarget:o,set:(e,t,r,i)=>o(t,r,i).subSurface.refractionIntensity=e,getPropertyName:[()=>"subSurface.refractionIntensity"]},transmissionTexture:{extensions:{KHR_texture_transform:g("subSurface","refractionIntensityTexture")}}},KHR_materials_diffuse_transmission:{diffuseTransmissionFactor:{type:"number",get:(e,t,r)=>o(e,t,r).subSurface.translucencyIntensity,getTarget:o,set:(e,t,r,i)=>o(t,r,i).subSurface.translucencyIntensity=e},diffuseTransmissionTexture:{extensions:{KHR_texture_transform:g("subSurface","translucencyIntensityTexture")}},diffuseTransmissionColorFactor:{type:"Color3",get:(e,t,r)=>o(e,t,r).subSurface.translucencyColor,getTarget:o,set:(e,t,r,i)=>e&&o(t,r,i).subSurface.translucencyColor?.copyFrom(e)},diffuseTransmissionColorTexture:{extensions:{KHR_texture_transform:g("subSurface","translucencyColorTexture")}}},KHR_materials_volume:{attenuationColor:{type:"Color3",get:(e,t,r)=>o(e,t,r).subSurface.tintColor,getTarget:o,set:(e,t,r,i)=>o(t,r,i).subSurface.tintColor.copyFrom(e)},attenuationDistance:{type:"number",get:(e,t,r)=>o(e,t,r).subSurface.tintColorAtDistance,getTarget:o,set:(e,t,r,i)=>o(t,r,i).subSurface.tintColorAtDistance=e},thicknessFactor:{type:"number",get:(e,t,r)=>o(e,t,r).subSurface.maximumThickness,getTarget:o,set:(e,t,r,i)=>o(t,r,i).subSurface.maximumThickness=e},thicknessTexture:{extensions:{KHR_texture_transform:g("subSurface","thicknessTexture")}}}}}},Z={KHR_lights_punctual:{lights:{length:{type:"number",get:e=>e.length,getTarget:e=>e.map(t=>t._babylonLight),getPropertyName:[e=>"length"]},__array__:{__target__:!0,color:{type:"Color3",get:e=>e._babylonLight?.diffuse,set:(e,t)=>t._babylonLight?.diffuse.copyFrom(e),getTarget:e=>e._babylonLight,getPropertyName:[e=>"diffuse"]},intensity:{type:"number",get:e=>e._babylonLight?.intensity,set:(e,t)=>t._babylonLight?t._babylonLight.intensity=e:void 0,getTarget:e=>e._babylonLight,getPropertyName:[e=>"intensity"]},range:{type:"number",get:e=>e._babylonLight?.range,set:(e,t)=>t._babylonLight?t._babylonLight.range=e:void 0,getTarget:e=>e._babylonLight,getPropertyName:[e=>"range"]},spot:{innerConeAngle:{type:"number",get:e=>e._babylonLight?.innerAngle,set:(e,t)=>t._babylonLight?t._babylonLight.innerAngle=e:void 0,getTarget:e=>e._babylonLight,getPropertyName:[e=>"innerConeAngle"]},outerConeAngle:{type:"number",get:e=>e._babylonLight?.angle,set:(e,t)=>t._babylonLight?t._babylonLight.angle=e:void 0,getTarget:e=>e._babylonLight,getPropertyName:[e=>"outerConeAngle"]}}}}},EXT_lights_area:{lights:{length:{type:"number",get:e=>e.length,getTarget:e=>e.map(t=>t._babylonLight),getPropertyName:[e=>"length"]},__array__:{__target__:!0,color:{type:"Color3",get:e=>e._babylonLight?.diffuse,set:(e,t)=>t._babylonLight?.diffuse.copyFrom(e),getTarget:e=>e._babylonLight,getPropertyName:[e=>"diffuse"]},intensity:{type:"number",get:e=>e._babylonLight?.intensity,set:(e,t)=>t._babylonLight?t._babylonLight.intensity=e:void 0,getTarget:e=>e._babylonLight,getPropertyName:[e=>"intensity"]},size:{type:"number",get:e=>e._babylonLight?.height,set:(e,t)=>t._babylonLight?t._babylonLight.height=e:void 0,getTarget:e=>e._babylonLight,getPropertyName:[e=>"size"]},rect:{aspect:{type:"number",get:e=>e._babylonLight?.width/e._babylonLight?.height,set:(e,t)=>t._babylonLight?t._babylonLight.width=e*t._babylonLight.height:void 0,getTarget:e=>e._babylonLight,getPropertyName:[e=>"aspect"]}}}}},EXT_lights_ies:{lights:{length:{type:"number",get:e=>e.length,getTarget:e=>e.map(t=>t._babylonLight),getPropertyName:[e=>"length"]}}},EXT_lights_image_based:{lights:{length:{type:"number",get:e=>e.length,getTarget:e=>e.map(t=>t._babylonTexture),getPropertyName:[e=>"length"]},__array__:{__target__:!0,intensity:{type:"number",get:e=>e._babylonTexture?.level,set:(e,t)=>{t._babylonTexture&&(t._babylonTexture.level=e)},getTarget:e=>e._babylonTexture},rotation:{type:"Quaternion",get:e=>e._babylonTexture&&b.FromRotationMatrix(e._babylonTexture?.getReflectionTextureMatrix()),set:(e,t)=>{t._babylonTexture&&(t._babylonTexture.getScene()?.useRightHandedSystem||(e=b.Inverse(e)),l.FromQuaternionToRef(e,t._babylonTexture.getReflectionTextureMatrix()))},getTarget:e=>e._babylonTexture}}}}};function p(e,t,r,i){const n=o(e);return i?n[r][i]:n[r]}function o(e,t,r){return e._data?.[r?.fillMode??M.MATERIAL_TriangleFillMode]?.babylonMaterial}function g(e,t){return{offset:{componentsCount:2,type:"Vector2",get:(r,i,n)=>{const s=p(r,n,e,t);return new y(s?.uOffset,s?.vOffset)},getTarget:o,set:(r,i,n,s)=>{const u=p(i,s,e,t);u.uOffset=r.x,u.vOffset=r.y},getPropertyName:[()=>`${e}${t?"."+t:""}.uOffset`,()=>`${e}${t?"."+t:""}.vOffset`]},rotation:{type:"number",get:(r,i,n)=>p(r,n,e,t)?.wAng,getTarget:o,set:(r,i,n,s)=>p(i,s,e,t).wAng=r,getPropertyName:[()=>`${e}${t?"."+t:""}.wAng`]},scale:{componentsCount:2,type:"Vector2",get:(r,i,n)=>{const s=p(r,n,e,t);return new y(s?.uScale,s?.vScale)},getTarget:o,set:(r,i,n,s)=>{const u=p(i,s,e,t);u.uScale=r.x,u.vScale=r.y},getPropertyName:[()=>`${e}${t?"."+t:""}.uScale`,()=>`${e}${t?"."+t:""}.vScale`]}}}const T={cameras:A,nodes:v,materials:H,extensions:Z,animations:F,meshes:w};function E(e){return new S(e,T)}function B(e){const t=e.split("/").map(i=>i.replace(/{}/g,"__array__"));let r=T;for(const i of t)i&&(r=r[i]);if(r&&r.type&&r.get)return r}function k(e,t){const r=e.split("/").map(n=>n.replace(/{}/g,"__array__"));let i=T;for(const n of r)n&&(i=i[n]);i&&i.type&&i.get&&(i.interpolation=t)}function z(e,t){const r=e.split("/").map(n=>n.replace(/{}/g,"__array__"));let i=T;for(const n of r)if(n){if(!i[n]){if(n==="?"){i.__ignoreObjectTree__=!0;continue}i[n]={},n==="__array__"&&(i[n].__target__=!0)}i=i[n]}Object.assign(i,t)}export{z as A,E as G,k as S,a,B as b}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitBackBlend.fragment-2SkQ74Uj.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitBackBlend.fragment-2SkQ74Uj.js new file mode 100644 index 0000000000000000000000000000000000000000..898921ce84c166aff15c2c53c9cb311206efc3de --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitBackBlend.fragment-2SkQ74Uj.js @@ -0,0 +1,3 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const t="oitBackBlendPixelShader",e=`var uBackColor: texture_2d;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=textureLoad(uBackColor,vec2i(fragmentInputs.position.xy),0);if (fragmentOutputs.color.a==0.0) {discard;}} +`;r.ShadersStoreWGSL[t]||(r.ShadersStoreWGSL[t]=e);const n={name:t,shader:e};export{n as oitBackBlendPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitBackBlend.fragment-MvwpfZ6x.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitBackBlend.fragment-MvwpfZ6x.js new file mode 100644 index 0000000000000000000000000000000000000000..57883db69c473e42214d04f2de7a19d7b6fddb8e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitBackBlend.fragment-MvwpfZ6x.js @@ -0,0 +1,2 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const o="oitBackBlendPixelShader",e=`precision highp float;uniform sampler2D uBackColor;void main() {glFragColor=texelFetch(uBackColor,ivec2(gl_FragCoord.xy),0);if (glFragColor.a==0.0) { +discard;}}`;r.ShadersStore[o]||(r.ShadersStore[o]=e);const l={name:o,shader:e};export{l as oitBackBlendPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitFinalSimpleBlend.fragment-C05G8A8O.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitFinalSimpleBlend.fragment-C05G8A8O.js new file mode 100644 index 0000000000000000000000000000000000000000..f8795ae533c665f24472b941c713baad38ecea4f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitFinalSimpleBlend.fragment-C05G8A8O.js @@ -0,0 +1,3 @@ +import{S as o}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const r="oitFinalSimpleBlendPixelShader",t=`var uFrontColor: texture_2d;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var fragCoord: vec2i=vec2i(fragmentInputs.position.xy);var frontColor: vec4f=textureLoad(uFrontColor,fragCoord,0);fragmentOutputs.color=frontColor;} +`;o.ShadersStoreWGSL[r]||(o.ShadersStoreWGSL[r]=t);const a={name:r,shader:t};export{a as oitFinalSimpleBlendPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitFinalSimpleBlend.fragment-Do9a99j5.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitFinalSimpleBlend.fragment-Do9a99j5.js new file mode 100644 index 0000000000000000000000000000000000000000..7fb3799a0be5a92f94a8cd6b738015850df67fbc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitFinalSimpleBlend.fragment-Do9a99j5.js @@ -0,0 +1,2 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const o="oitFinalSimpleBlendPixelShader",e=`precision highp float;uniform sampler2D uFrontColor;void main() {ivec2 fragCoord=ivec2(gl_FragCoord.xy);vec4 frontColor=texelFetch(uFrontColor,fragCoord,0);glFragColor=frontColor;} +`;r.ShadersStore[o]||(r.ShadersStore[o]=e);const t={name:o,shader:e};export{t as oitFinalSimpleBlendPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitFragment-BcbCWH3V.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitFragment-BcbCWH3V.js new file mode 100644 index 0000000000000000000000000000000000000000..d57f0605558ac40cb18053eff322a1307dbfa6d4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/oitFragment-BcbCWH3V.js @@ -0,0 +1,47 @@ +import{S as e}from"./index-CDrXokXW.js";const t="prePassDeclaration",o=`#ifdef PREPASS +#ifdef PREPASS_LOCAL_POSITION +varying vPosition : vec3f; +#endif +#ifdef PREPASS_DEPTH +varying vViewPos: vec3f; +#endif +#ifdef PREPASS_NORMALIZED_VIEW_DEPTH +varying vNormViewDepth: f32; +#endif +#if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) +varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f; +#endif +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=o);const r="oitDeclaration",n=`#ifdef ORDER_INDEPENDENT_TRANSPARENCY +#define MAX_DEPTH 99999.0 +var oitDepthSamplerSampler: sampler;var oitDepthSampler: texture_2d;var oitFrontColorSamplerSampler: sampler;var oitFrontColorSampler: texture_2d; +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=n);const a="depthPrePass",s=`#ifdef DEPTHPREPASS +fragmentOutputs.color= vec4f(0.,0.,0.,1.0);return fragmentOutputs; +#endif +`;e.IncludesShadersStoreWGSL[a]||(e.IncludesShadersStoreWGSL[a]=s);const f="oitFragment",i=`#ifdef ORDER_INDEPENDENT_TRANSPARENCY +var fragDepth: f32=fragmentInputs.position.z; +#ifdef ORDER_INDEPENDENT_TRANSPARENCY_16BITS +var halfFloat: u32=pack2x16float( vec2f(fragDepth));var full: vec2f=unpack2x16float(halfFloat);fragDepth=full.x; +#endif +var fragCoord: vec2i=vec2i(fragmentInputs.position.xy);var lastDepth: vec2f=textureLoad(oitDepthSampler,fragCoord,0).rg;var lastFrontColor: vec4f=textureLoad(oitFrontColorSampler,fragCoord,0);fragmentOutputs.depth=vec2f(-MAX_DEPTH);fragmentOutputs.frontColor=lastFrontColor;fragmentOutputs.backColor= vec4f(0.0); +#ifdef USE_REVERSE_DEPTHBUFFER +var furthestDepth: f32=-lastDepth.x;var nearestDepth: f32=lastDepth.y; +#else +var nearestDepth: f32=-lastDepth.x;var furthestDepth: f32=lastDepth.y; +#endif +var alphaMultiplier: f32=1.0-lastFrontColor.a; +#ifdef USE_REVERSE_DEPTHBUFFER +if (fragDepth>nearestDepth || fragDepthfurthestDepth) { +#endif +return fragmentOutputs;} +#ifdef USE_REVERSE_DEPTHBUFFER +if (fragDepthfurthestDepth) { +#else +if (fragDepth>nearestDepth && fragDepthnearestDepth || fragDepthfurthestDepth) { +#endif +return;} +#ifdef USE_REVERSE_DEPTHBUFFER +if (fragDepthfurthestDepth) { +#else +if (fragDepth>nearestDepth && fragDepth0 +uniform vec2 vDebugMode; +#endif +#ifdef DETAIL +uniform vec4 vDetailInfos; +#endif +#include +#ifdef USESPHERICALFROMREFLECTIONMAP +#ifdef SPHERICAL_HARMONICS +uniform vec3 vSphericalL00;uniform vec3 vSphericalL1_1;uniform vec3 vSphericalL10;uniform vec3 vSphericalL11;uniform vec3 vSphericalL2_2;uniform vec3 vSphericalL2_1;uniform vec3 vSphericalL20;uniform vec3 vSphericalL21;uniform vec3 vSphericalL22; +#else +uniform vec3 vSphericalX;uniform vec3 vSphericalY;uniform vec3 vSphericalZ;uniform vec3 vSphericalXX_ZZ;uniform vec3 vSphericalYY_ZZ;uniform vec3 vSphericalZZ;uniform vec3 vSphericalXY;uniform vec3 vSphericalYZ;uniform vec3 vSphericalZX; +#endif +#endif +#define ADDITIONAL_FRAGMENT_DECLARATION +`;e.IncludesShadersStore[i]||(e.IncludesShadersStore[i]=h);const n="openpbrFragmentSamplersDeclaration",N=`#include(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor,_SAMPLERNAME_,baseColor) +#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight) +#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_SAMPLERNAME_,baseDiffuseRoughness) +#include(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness,_SAMPLERNAME_,baseMetalness) +#include(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight,_SAMPLERNAME_,specularWeight) +#include(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor,_SAMPLERNAME_,specularColor) +#include(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness,_SAMPLERNAME_,specularRoughness) +#include(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy,_SAMPLERNAME_,specularRoughnessAnisotropy) +#include(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight,_SAMPLERNAME_,coatWeight) +#include(_DEFINENAME_,COAT_COLOR,_VARYINGNAME_,CoatColor,_SAMPLERNAME_,coatColor) +#include(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness,_SAMPLERNAME_,coatRoughness) +#include(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy,_SAMPLERNAME_,coatRoughnessAnisotropy) +#include(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening,_SAMPLERNAME_,coatDarkening) +#include(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight,_SAMPLERNAME_,fuzzWeight) +#include(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor,_SAMPLERNAME_,fuzzColor) +#include(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness,_SAMPLERNAME_,fuzzRoughness) +#include(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity,_SAMPLERNAME_,geometryOpacity) +#include(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent,_SAMPLERNAME_,geometryTangent) +#include(_DEFINENAME_,GEOMETRY_COAT_TANGENT,_VARYINGNAME_,GeometryCoatTangent,_SAMPLERNAME_,geometryCoatTangent) +#include(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor,_SAMPLERNAME_,emissionColor) +#include(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight,_SAMPLERNAME_,thinFilmWeight) +#include(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness,_SAMPLERNAME_,thinFilmThickness) +#include(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion,_SAMPLERNAME_,ambientOcclusion) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal) +#ifdef REFLECTION +#ifdef REFLECTIONMAP_3D +#define sampleReflection(s,c) textureCube(s,c) +uniform samplerCube reflectionSampler; +#ifdef LODBASEDMICROSFURACE +#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l) +#else +uniform samplerCube reflectionSamplerLow;uniform samplerCube reflectionSamplerHigh; +#endif +#ifdef USEIRRADIANCEMAP +uniform samplerCube irradianceSampler; +#endif +#else +#define sampleReflection(s,c) texture2D(s,c) +uniform sampler2D reflectionSampler; +#ifdef LODBASEDMICROSFURACE +#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l) +#else +uniform sampler2D reflectionSamplerLow;uniform sampler2D reflectionSamplerHigh; +#endif +#ifdef USEIRRADIANCEMAP +uniform sampler2D irradianceSampler; +#endif +#endif +#ifdef REFLECTIONMAP_SKYBOX +varying vec3 vPositionUVW; +#else +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vec3 vDirectionW; +#endif +#endif +#endif +#ifdef ENVIRONMENTBRDF +uniform sampler2D environmentBrdfSampler; +#endif +#ifdef FUZZENVIRONMENTBRDF +uniform sampler2D environmentFuzzBrdfSampler; +#endif +#if defined(ANISOTROPIC) || defined(FUZZ) +uniform sampler2D blueNoiseSampler; +#endif +#ifdef IBL_CDF_FILTERING +uniform sampler2D icdfSampler; +#endif +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=N);const a="openpbrNormalMapFragmentMainFunctions",A=`#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || defined(ANISOTROPIC) || defined(FUZZ) || defined(DETAIL) +#if defined(TANGENT) && defined(NORMAL) +varying mat3 vTBN; +#endif +#ifdef OBJECTSPACE_NORMALMAP +uniform mat4 normalMatrix; +#if defined(WEBGL2) || defined(WEBGPU) +mat4 toNormalMatrix(mat4 wMatrix) +{mat4 ret=inverse(wMatrix);ret=transpose(ret);ret[0][3]=0.;ret[1][3]=0.;ret[2][3]=0.;ret[3]=vec4(0.,0.,0.,1.);return ret;} +#else +mat4 toNormalMatrix(mat4 m) +{float +a00=m[0][0],a01=m[0][1],a02=m[0][2],a03=m[0][3], +a10=m[1][0],a11=m[1][1],a12=m[1][2],a13=m[1][3], +a20=m[2][0],a21=m[2][1],a22=m[2][2],a23=m[2][3], +a30=m[3][0],a31=m[3][1],a32=m[3][2],a33=m[3][3], +b00=a00*a11-a01*a10, +b01=a00*a12-a02*a10, +b02=a00*a13-a03*a10, +b03=a01*a12-a02*a11, +b04=a01*a13-a03*a11, +b05=a02*a13-a03*a12, +b06=a20*a31-a21*a30, +b07=a20*a32-a22*a30, +b08=a20*a33-a23*a30, +b09=a21*a32-a22*a31, +b10=a21*a33-a23*a31, +b11=a22*a33-a23*a32, +det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;mat4 mi=mat4( +a11*b11-a12*b10+a13*b09, +a02*b10-a01*b11-a03*b09, +a31*b05-a32*b04+a33*b03, +a22*b04-a21*b05-a23*b03, +a12*b08-a10*b11-a13*b07, +a00*b11-a02*b08+a03*b07, +a32*b02-a30*b05-a33*b01, +a20*b05-a22*b02+a23*b01, +a10*b10-a11*b08+a13*b06, +a01*b08-a00*b10-a03*b06, +a30*b04-a31*b02+a33*b00, +a21*b02-a20*b04-a23*b00, +a11*b07-a10*b09-a12*b06, +a00*b09-a01*b07+a02*b06, +a31*b01-a30*b03-a32*b00, +a20*b03-a21*b01+a22*b00)/det;return mat4(mi[0][0],mi[1][0],mi[2][0],mi[3][0], +mi[0][1],mi[1][1],mi[2][1],mi[3][1], +mi[0][2],mi[1][2],mi[2][2],mi[3][2], +mi[0][3],mi[1][3],mi[2][3],mi[3][3]);} +#endif +#endif +vec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale) +{ +#ifdef NORMALXYSCALE +normal=normalize(normal*vec3(scale,scale,1.0)); +#endif +return normalize(cotangentFrame*normal);} +vec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale) +{return perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);} +mat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams) +{vec3 dp1=dFdx(p);vec3 dp2=dFdy(p);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;float det=max(dot(tangent,tangent),dot(bitangent,bitangent));float invmax=det==0.0 ? 0.0 : inversesqrt(det);return mat3(tangent*invmax,bitangent*invmax,normal);} +#endif +`;e.IncludesShadersStore[a]||(e.IncludesShadersStore[a]=A);const t="openpbrNormalMapFragmentFunctions",S=`#if defined(GEOMETRY_NORMAL) +#include(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal,_SAMPLERNAME_,geometryNormal) +#endif +#if defined(GEOMETRY_COAT_NORMAL) +#include(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal,_SAMPLERNAME_,geometryCoatNormal) +#endif +#if defined(DETAIL) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail) +#endif +#if defined(GEOMETRY_NORMAL) && defined(PARALLAX) +const float minSamples=4.;const float maxSamples=15.;const int iMaxSamples=15;vec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {float parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;parallaxLimit*=parallaxScale;vec2 vOffsetDir=normalize(vViewDirCoT.xy);vec2 vMaxOffset=vOffsetDir*parallaxLimit;float numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));float stepSize=1.0/numSamples;float currRayHeight=1.0;vec2 vCurrOffset=vec2(0,0);vec2 vLastOffset=vec2(0,0);float lastSampledHeight=1.0;float currSampledHeight=1.0;bool keepWorking=true;for (int i=0; icurrRayHeight) +{float delta1=currSampledHeight-currRayHeight;float delta2=(currRayHeight+stepSize)-lastSampledHeight;float ratio=delta1/(delta1+delta2);vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;keepWorking=false;} +else +{currRayHeight-=stepSize;vLastOffset=vCurrOffset; +#ifdef PARALLAX_RHS +vCurrOffset-=stepSize*vMaxOffset; +#else +vCurrOffset+=stepSize*vMaxOffset; +#endif +lastSampledHeight=currSampledHeight;}} +return vCurrOffset;} +vec2 parallaxOffset(vec3 viewDir,float heightScale) +{float height=texture2D(geometryNormalSampler,vGeometryNormalUV).w;vec2 texCoordOffset=heightScale*viewDir.xy*height; +#ifdef PARALLAX_RHS +return texCoordOffset; +#else +return -texCoordOffset; +#endif +} +#endif +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=S);const r="openpbrDielectricReflectance",F=`struct ReflectanceParams +{float F0;float F90;vec3 coloredF0;vec3 coloredF90;}; +#define pbr_inline +ReflectanceParams dielectricReflectance( +in float insideIOR,in float outsideIOR,in vec3 specularColor,in float specularWeight +) +{ReflectanceParams outParams;float dielectricF0=pow((insideIOR-outsideIOR)/(insideIOR+outsideIOR),2.0);float dielectricF0_NoSpec=pow((1.0-outsideIOR)/(1.0+outsideIOR),2.0);float f90Scale=clamp(2.0*abs(insideIOR-outsideIOR),0.0,1.0);float f90Scale_NoSpec=clamp(2.0*abs(1.0-outsideIOR),0.0,1.0); +#if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR) +vec3 dielectricColorF90=specularColor.rgb*vec3(f90Scale);vec3 dielectricColorF90_NoSpec=specularColor.rgb*vec3(f90Scale_NoSpec); +#else +vec3 dielectricColorF90=vec3(f90Scale);vec3 dielectricColorF90_NoSpec=vec3(f90Scale_NoSpec); +#endif +#if DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_GLTF +float maxF0=max(specularColor.r,max(specularColor.g,specularColor.b));outParams.F0=mix(dielectricF0_NoSpec,dielectricF0,specularWeight)*maxF0; +#else +outParams.F0=mix(dielectricF0_NoSpec,dielectricF0,specularWeight); +#endif +outParams.F90=mix(f90Scale_NoSpec,f90Scale,specularWeight);outParams.coloredF0=mix(vec3(dielectricF0_NoSpec),vec3(dielectricF0),specularWeight)*specularColor.rgb;outParams.coloredF90=mix(dielectricColorF90_NoSpec,dielectricColorF90,specularWeight);return outParams;} +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=F);const l="openpbrConductorReflectance",T=`#define pbr_inline +ReflectanceParams conductorReflectance(in vec3 baseColor,in vec3 specularColor,in float specularWeight) +{ReflectanceParams outParams; +#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) +outParams.coloredF0=baseColor*specularWeight;outParams.coloredF90=specularColor*specularWeight; +#else +outParams.coloredF0=baseColor;outParams.coloredF90=vec3(1.0); +#endif +outParams.F0=1.0;outParams.F90=1.0;return outParams;}`;e.IncludesShadersStore[l]||(e.IncludesShadersStore[l]=T);const f="openpbrBlockAmbientOcclusion",L=`struct ambientOcclusionOutParams +{vec3 ambientOcclusionColor; +#if DEBUGMODE>0 && defined(AMBIENT_OCCLUSION) +vec3 ambientOcclusionColorMap; +#endif +}; +#define pbr_inline +ambientOcclusionOutParams ambientOcclusionBlock( +#ifdef AMBIENT_OCCLUSION +in vec3 ambientOcclusionColorMap_, +in vec2 ambientInfos +#endif +) +{ambientOcclusionOutParams outParams;vec3 ambientOcclusionColor=vec3(1.,1.,1.); +#ifdef AMBIENT_OCCLUSION +vec3 ambientOcclusionColorMap=ambientOcclusionColorMap_*ambientInfos.y; +#ifdef AMBIENTINGRAYSCALE +ambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r); +#endif +#if DEBUGMODE>0 +outParams.ambientOcclusionColorMap=ambientOcclusionColorMap; +#endif +#endif +outParams.ambientOcclusionColor=ambientOcclusionColor;return outParams;} +`;e.IncludesShadersStore[f]||(e.IncludesShadersStore[f]=L);const c="openpbrGeometryInfo",O=`struct geometryInfoOutParams +{float NdotV;float NdotVUnclamped;vec3 environmentBrdf;float horizonOcclusion;};struct geometryInfoAnisoOutParams +{float NdotV;float NdotVUnclamped;vec3 environmentBrdf;float horizonOcclusion;float anisotropy;vec3 anisotropicTangent;vec3 anisotropicBitangent;mat3 TBN;}; +#define pbr_inline +geometryInfoOutParams geometryInfo( +in vec3 normalW,in vec3 viewDirectionW,in float roughness,in vec3 geometricNormalW +) +{geometryInfoOutParams outParams;outParams.NdotVUnclamped=dot(normalW,viewDirectionW);outParams.NdotV=absEps(outParams.NdotVUnclamped); +#if defined(ENVIRONMENTBRDF) +outParams.environmentBrdf=getBRDFLookup(outParams.NdotV,roughness); +#else +outParams.environmentBrdf=vec3(0.0); +#endif +outParams.horizonOcclusion=1.0; +#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX) +#ifdef HORIZONOCCLUSION +#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) +#ifdef REFLECTIONMAP_3D +outParams.horizonOcclusion=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW); +#endif +#endif +#endif +#endif +return outParams;} +#define pbr_inline +geometryInfoAnisoOutParams geometryInfoAniso( +in vec3 normalW,in vec3 viewDirectionW,in float roughness,in vec3 geometricNormalW +,in vec3 vAnisotropy,in mat3 TBN +) +{geometryInfoOutParams geoInfo=geometryInfo(normalW,viewDirectionW,roughness,geometricNormalW);geometryInfoAnisoOutParams outParams;outParams.NdotV=geoInfo.NdotV;outParams.NdotVUnclamped=geoInfo.NdotVUnclamped;outParams.environmentBrdf=geoInfo.environmentBrdf;outParams.horizonOcclusion=geoInfo.horizonOcclusion;outParams.anisotropy=vAnisotropy.b;vec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);mat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));outParams.anisotropicTangent=normalize(anisoTBN*anisotropyDirection);outParams.anisotropicBitangent=normalize(cross(anisoTBN[2],outParams.anisotropicTangent));outParams.TBN=TBN;return outParams;}`;e.IncludesShadersStore[c]||(e.IncludesShadersStore[c]=O);const s="openpbrIblFunctions",C=`#ifdef REFLECTION +vec3 sampleIrradiance( +in vec3 surfaceNormal +#if defined(NORMAL) && defined(USESPHERICALINVERTEX) +,in vec3 vEnvironmentIrradianceSH +#endif +#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D)) +,in mat4 iblMatrix +#endif +#ifdef USEIRRADIANCEMAP +#ifdef REFLECTIONMAP_3D +,in samplerCube irradianceSampler +#else +,in sampler2D irradianceSampler +#endif +#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION +,in vec3 reflectionDominantDirection +#endif +#endif +#ifdef REALTIME_FILTERING +,in vec2 vReflectionFilteringInfo +#ifdef IBL_CDF_FILTERING +,in sampler2D icdfSampler +#endif +#endif +,in vec2 vReflectionInfos +,in vec3 viewDirectionW +,in float diffuseRoughness +,in vec3 surfaceAlbedo +) {vec3 environmentIrradiance=vec3(0.,0.,0.); +#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D)) +vec3 irradianceVector=(iblMatrix*vec4(surfaceNormal,0)).xyz;vec3 irradianceView=(iblMatrix*vec4(viewDirectionW,0)).xyz; +#if !defined(USE_IRRADIANCE_DOMINANT_DIRECTION) && !defined(REALTIME_FILTERING) +#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY +{float NdotV=max(dot(surfaceNormal,viewDirectionW),0.0);irradianceVector=mix(irradianceVector,irradianceView,(0.5*(1.0-NdotV))*diffuseRoughness);} +#endif +#endif +#ifdef REFLECTIONMAP_OPPOSITEZ +irradianceVector.z*=-1.0; +#endif +#ifdef INVERTCUBICMAP +irradianceVector.y*=-1.0; +#endif +#endif +#ifdef USESPHERICALFROMREFLECTIONMAP +#if defined(NORMAL) && defined(USESPHERICALINVERTEX) +environmentIrradiance=vEnvironmentIrradianceSH; +#else +#if defined(REALTIME_FILTERING) +environmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo,diffuseRoughness,surfaceAlbedo,irradianceView +#ifdef IBL_CDF_FILTERING +,icdfSampler +#endif +); +#else +environmentIrradiance=computeEnvironmentIrradiance(irradianceVector); +#endif +#endif +#elif defined(USEIRRADIANCEMAP) +#ifdef REFLECTIONMAP_3D +vec4 environmentIrradianceFromTexture=sampleReflection(irradianceSampler,irradianceVector); +#else +vec4 environmentIrradianceFromTexture=sampleReflection(irradianceSampler,reflectionCoords); +#endif +environmentIrradiance=environmentIrradianceFromTexture.rgb; +#ifdef RGBDREFLECTION +environmentIrradiance.rgb=fromRGBD(environmentIrradianceFromTexture); +#endif +#ifdef GAMMAREFLECTION +environmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb); +#endif +#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION +vec3 Ls=normalize(reflectionDominantDirection);float NoL=dot(irradianceVector,Ls);float NoV=dot(irradianceVector,irradianceView);vec3 diffuseRoughnessTerm=vec3(1.0); +#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON +float LoV=dot (Ls,irradianceView);float mag=length(reflectionDominantDirection)*2.0;vec3 clampedAlbedo=clamp(surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;diffuseRoughnessTerm=diffuseRoughnessTerm/clampedAlbedo;diffuseRoughnessTerm=mix(vec3(1.0),diffuseRoughnessTerm,sqrt(clamp(mag*NoV,0.0,1.0))); +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY +vec3 H=(irradianceView+Ls)*0.5;float VoH=dot(irradianceView,H);diffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI); +#endif +environmentIrradiance=environmentIrradiance.rgb*diffuseRoughnessTerm; +#endif +#endif +environmentIrradiance*=vReflectionInfos.x;return environmentIrradiance;} +#define pbr_inline +#ifdef REFLECTIONMAP_3D +vec3 createReflectionCoords( +#else +vec2 createReflectionCoords( +#endif +in vec3 vPositionW +,in vec3 normalW +) +{vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW); +#ifdef REFLECTIONMAP_OPPOSITEZ +reflectionVector.z*=-1.0; +#endif +#ifdef REFLECTIONMAP_3D +vec3 reflectionCoords=reflectionVector; +#else +vec2 reflectionCoords=reflectionVector.xy; +#ifdef REFLECTIONMAP_PROJECTION +reflectionCoords/=reflectionVector.z; +#endif +reflectionCoords.y=1.0-reflectionCoords.y; +#endif +return reflectionCoords;} +#define pbr_inline +#define inline +vec3 sampleRadiance( +in float alphaG +,in vec3 vReflectionMicrosurfaceInfos +,in vec2 vReflectionInfos +,in geometryInfoOutParams geoInfo +#ifdef REFLECTIONMAP_3D +,in samplerCube reflectionSampler +,const vec3 reflectionCoords +#else +,in sampler2D reflectionSampler +,const vec2 reflectionCoords +#endif +#ifdef REALTIME_FILTERING +,in vec2 vReflectionFilteringInfo +#endif +) +{vec4 environmentRadiance=vec4(0.,0.,0.,0.); +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,geoInfo.NdotVUnclamped); +#elif defined(LINEARSPECULARREFLECTION) +float reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness); +#else +float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG); +#endif +reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z; +#ifdef REALTIME_FILTERING +environmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0); +#else +environmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD); +#endif +#ifdef RGBDREFLECTION +environmentRadiance.rgb=fromRGBD(environmentRadiance); +#endif +#ifdef GAMMAREFLECTION +environmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb); +#endif +environmentRadiance.rgb*=vec3(vReflectionInfos.x);return environmentRadiance.rgb;} +#if defined(ANISOTROPIC) +#define pbr_inline +#define inline +vec3 sampleRadianceAnisotropic( +in float alphaG +,in vec3 vReflectionMicrosurfaceInfos +,in vec2 vReflectionInfos +,in geometryInfoAnisoOutParams geoInfo +,const vec3 normalW +,const vec3 viewDirectionW +,const vec3 positionW +,const vec3 noise +#ifdef REFLECTIONMAP_3D +,in samplerCube reflectionSampler +#else +,in sampler2D reflectionSampler +#endif +#ifdef REALTIME_FILTERING +,in vec2 vReflectionFilteringInfo +#endif +) +{vec4 environmentRadiance=vec4(0.,0.,0.,0.);float alphaT=alphaG*sqrt(2.0/(1.0+(1.0-geoInfo.anisotropy)*(1.0-geoInfo.anisotropy)));float alphaB=(1.0-geoInfo.anisotropy)*alphaT;alphaG=alphaB; +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,geoInfo.NdotVUnclamped); +#elif defined(LINEARSPECULARREFLECTION) +float reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness); +#else +float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG); +#endif +reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z; +#ifdef REALTIME_FILTERING +vec3 view=(reflectionMatrix*vec4(viewDirectionW,0.0)).xyz;vec3 tangent=(reflectionMatrix*vec4(geoInfo.anisotropicTangent,0.0)).xyz;vec3 bitangent=(reflectionMatrix*vec4(geoInfo.anisotropicBitangent,0.0)).xyz;vec3 normal=(reflectionMatrix*vec4(normalW,0.0)).xyz; +#ifdef REFLECTIONMAP_OPPOSITEZ +view.z*=-1.0;tangent.z*=-1.0;bitangent.z*=-1.0;normal.z*=-1.0; +#endif +environmentRadiance = +vec4(radianceAnisotropic(alphaT,alphaB,reflectionSampler, +view,tangent, +bitangent,normal, +vReflectionFilteringInfo,noise.xy), +1.0); +#else +const int samples=16;vec4 radianceSample=vec4(0.0);vec3 reflectionCoords=vec3(0.0);float sample_weight=0.0;float total_weight=0.0;float step=1.0/float(max(samples-1,1));for (int i=0; i0.0) {float blend=t;bentNormal=normalize(mix(normalW,geoInfo.anisotropicTangent,blend));} else {bentNormal=normalW;} +reflectionCoords=createReflectionCoords(positionW,bentNormal);radianceSample=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD); +#ifdef RGBDREFLECTION +environmentRadiance.rgb+=sample_weight*fromRGBD(radianceSample); +#elif defined(GAMMAREFLECTION) +environmentRadiance.rgb+=sample_weight*toLinearSpace(radianceSample.rgb); +#else +environmentRadiance.rgb+=sample_weight*radianceSample.rgb; +#endif +total_weight+=sample_weight;} +environmentRadiance=vec4(environmentRadiance.xyz/float(total_weight),1.0); +#endif +environmentRadiance.rgb*=vec3(vReflectionInfos.x);return environmentRadiance.rgb;} +#endif +#define pbr_inline +vec3 conductorIblFresnel(in ReflectanceParams reflectance,in float NdotV,in float roughness,in vec3 environmentBrdf) +{ +#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) +vec3 albedoF0=mix(reflectance.coloredF0,pow(reflectance.coloredF0,vec3(1.4)),roughness);return getF82Specular(NdotV,albedoF0,reflectance.coloredF90,roughness); +#else +return getReflectanceFromBRDFLookup(reflectance.coloredF0,reflectance.coloredF90,environmentBrdf); +#endif +} +#endif +`;e.IncludesShadersStore[s]||(e.IncludesShadersStore[s]=C);const d="openpbrNormalMapFragment",b=`vec2 uvOffset=vec2(0.0,0.0); +#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || defined(PARALLAX) || defined(DETAIL) +#ifdef NORMALXYSCALE +float normalScale=1.0; +#elif defined(GEOMETRY_NORMAL) +float normalScale=vGeometryNormalInfos.y; +#else +float normalScale=1.0; +#endif +#if defined(TANGENT) && defined(NORMAL) +mat3 TBN=vTBN; +#elif defined(GEOMETRY_NORMAL) +vec2 TBNUV=gl_FrontFacing ? vGeometryNormalUV : -vGeometryNormalUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vTangentSpaceParams); +#else +vec2 TBNUV=gl_FrontFacing ? vDetailUV : -vDetailUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vec2(1.,1.)); +#endif +#elif defined(ANISOTROPIC) || defined(FUZZ) +#if defined(TANGENT) && defined(NORMAL) +mat3 TBN=vTBN; +#else +vec2 TBNUV=gl_FrontFacing ? vMainUV1 : -vMainUV1;mat3 TBN=cotangent_frame(normalW,vPositionW,TBNUV,vec2(1.,1.)); +#endif +#endif +#ifdef PARALLAX +mat3 invTBN=transposeMat3(TBN); +#ifdef PARALLAXOCCLUSION +#else +#endif +#endif +#ifdef DETAIL +vec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);vec2 detailNormalRG=detailColor.wy*2.0-1.0;float detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));vec3 detailNormal=vec3(detailNormalRG,detailNormalB); +#endif +#ifdef GEOMETRY_COAT_NORMAL +coatNormalW=perturbNormal(TBN,texture2D(geometryCoatNormalSampler,vGeometryCoatNormalUV+uvOffset).xyz,vGeometryCoatNormalInfos.y); +#endif +#ifdef GEOMETRY_NORMAL +#ifdef OBJECTSPACE_NORMALMAP +#define CUSTOM_FRAGMENT_BUMP_FRAGMENT +normalW=normalize(texture2D(geometryNormalSampler,vGeometryNormalUV).xyz *2.0-1.0);normalW=normalize(mat3(normalMatrix)*normalW); +#elif !defined(DETAIL) +normalW=perturbNormal(TBN,texture2D(geometryNormalSampler,vGeometryNormalUV+uvOffset).xyz,vGeometryNormalInfos.y); +#else +vec3 sampledNormal=texture2D(geometryNormalSampler,vGeometryNormalUV+uvOffset).xyz*2.0-1.0; +#if DETAIL_NORMALBLENDMETHOD==0 +detailNormal.xy*=vDetailInfos.z;vec3 blendedNormal=normalize(vec3(sampledNormal.xy+detailNormal.xy,sampledNormal.z*detailNormal.z)); +#elif DETAIL_NORMALBLENDMETHOD==1 +detailNormal.xy*=vDetailInfos.z;sampledNormal+=vec3(0.0,0.0,1.0);detailNormal*=vec3(-1.0,-1.0,1.0);vec3 blendedNormal=sampledNormal*dot(sampledNormal,detailNormal)/sampledNormal.z-detailNormal; +#endif +normalW=perturbNormalBase(TBN,blendedNormal,vGeometryNormalInfos.y); +#endif +#elif defined(DETAIL) +detailNormal.xy*=vDetailInfos.z;normalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z); +#endif +`;e.IncludesShadersStore[d]||(e.IncludesShadersStore[d]=b);const m="openpbrBlockNormalFinal",D=`#if defined(FORCENORMALFORWARD) && defined(NORMAL) +vec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w; +#if defined(TWOSIDEDLIGHTING) +faceNormal=gl_FrontFacing ? faceNormal : -faceNormal; +#endif +normalW*=sign(dot(normalW,faceNormal));coatNormalW*=sign(dot(coatNormalW,faceNormal)); +#endif +#if defined(TWOSIDEDLIGHTING) && defined(NORMAL) +#if defined(MIRRORED) +normalW=gl_FrontFacing ? -normalW : normalW;coatNormalW=gl_FrontFacing ? -coatNormalW : coatNormalW; +#else +normalW=gl_FrontFacing ? normalW : -normalW;coatNormalW=gl_FrontFacing ? coatNormalW : -coatNormalW; +#endif +#endif +`;e.IncludesShadersStore[m]||(e.IncludesShadersStore[m]=D);const u="openpbrBaseLayerData",M=`vec3 base_color=vec3(0.8);float base_metalness=0.0;float base_diffuse_roughness=0.0;float specular_weight=1.0;float specular_roughness=0.3;vec3 specular_color=vec3(1.0);float specular_roughness_anisotropy=0.0;float specular_ior=1.5;float alpha=1.0;vec2 geometry_tangent=vec2(1.0,0.0); +#ifdef BASE_WEIGHT +vec4 baseWeightFromTexture=texture2D(baseWeightSampler,vBaseWeightUV+uvOffset); +#endif +#ifdef BASE_COLOR +vec4 baseColorFromTexture=texture2D(baseColorSampler,vBaseColorUV+uvOffset); +#endif +#ifdef BASE_METALNESS +vec4 metallicFromTexture=texture2D(baseMetalnessSampler,vBaseMetalnessUV+uvOffset); +#endif +#if defined(ROUGHNESSSTOREINMETALMAPGREEN) && defined(BASE_METALNESS) +float roughnessFromTexture=metallicFromTexture.g; +#elif defined(SPECULAR_ROUGHNESS) +float roughnessFromTexture=texture2D(specularRoughnessSampler,vSpecularRoughnessUV+uvOffset).r; +#endif +#ifdef GEOMETRY_TANGENT +vec3 geometryTangentFromTexture=texture2D(geometryTangentSampler,vGeometryTangentUV+uvOffset).rgb; +#endif +#ifdef SPECULAR_ROUGHNESS_ANISOTROPY +float anisotropyFromTexture=texture2D(specularRoughnessAnisotropySampler,vSpecularRoughnessAnisotropyUV+uvOffset).r*vSpecularRoughnessAnisotropyInfos.y; +#endif +#ifdef BASE_DIFFUSE_ROUGHNESS +float baseDiffuseRoughnessFromTexture=texture2D(baseDiffuseRoughnessSampler,vBaseDiffuseRoughnessUV+uvOffset).r; +#endif +#ifdef GEOMETRY_OPACITY +vec4 opacityFromTexture=texture2D(geometryOpacitySampler,vGeometryOpacityUV+uvOffset); +#endif +#ifdef DECAL +vec4 decalFromTexture=texture2D(decalSampler,vDecalUV+uvOffset); +#endif +#ifdef SPECULAR_COLOR +vec4 specularColorFromTexture=texture2D(specularColorSampler,vSpecularColorUV+uvOffset); +#endif +#ifdef SPECULAR_WEIGHT +#ifdef SPECULAR_WEIGHT_IN_ALPHA +float specularWeightFromTexture=texture2D(specularWeightSampler,vSpecularWeightUV+uvOffset).a; +#else +float specularWeightFromTexture=texture2D(specularWeightSampler,vSpecularWeightUV+uvOffset).r; +#endif +#endif +#if defined(ANISOTROPIC) || defined(FUZZ) +vec3 noise=texture2D(blueNoiseSampler,gl_FragCoord.xy/256.0).xyz; +#endif +base_color=vBaseColor.rgb; +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +base_color*=vColor.rgb; +#endif +#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES) +alpha*=vColor.a; +#endif +base_color*=vec3(vBaseWeight);alpha=vBaseColor.a;base_metalness=vReflectanceInfo.x;base_diffuse_roughness=vBaseDiffuseRoughness;specular_roughness=vReflectanceInfo.y;specular_color=vSpecularColor.rgb;specular_weight=vReflectanceInfo.a;specular_ior=vReflectanceInfo.z;specular_roughness_anisotropy=vSpecularAnisotropy.b;geometry_tangent=vSpecularAnisotropy.rg; +#ifdef BASE_COLOR +#ifdef BASE_COLOR_GAMMA +base_color*=toLinearSpace(baseColorFromTexture.rgb); +#else +base_color*=baseColorFromTexture.rgb; +#endif +base_color*=vBaseColorInfos.y; +#endif +#ifdef BASE_WEIGHT +base_color*=baseWeightFromTexture.r; +#endif +#if defined(BASE_COLOR) && defined(ALPHA_FROM_BASE_COLOR_TEXTURE) +alpha*=baseColorFromTexture.a; +#elif defined(GEOMETRY_OPACITY) +alpha*=opacityFromTexture.r;alpha*=vGeometryOpacityInfos.y; +#endif +#ifdef ALPHATEST +#if DEBUGMODE != 88 +if (alpha0.0) { +#ifdef REFLECTIONMAP_3D +vec3 reflectionCoords=vec3(0.,0.,0.); +#else +vec2 reflectionCoords=vec2(0.,0.); +#endif +reflectionCoords=createReflectionCoords(vPositionW,coatNormalW);float coatAlphaG=coat_roughness*coat_roughness; +#ifdef ANISOTROPIC_COAT +coatEnvironmentLight=sampleRadianceAnisotropic(coatAlphaG,vReflectionMicrosurfaceInfos.rgb,vReflectionInfos +,coatGeoInfo +,coatNormalW +,viewDirectionW +,vPositionW +,noise +,reflectionSampler +#ifdef REALTIME_FILTERING +,vReflectionFilteringInfo +#endif +); +#else +coatEnvironmentLight=sampleRadiance(coatAlphaG,vReflectionMicrosurfaceInfos.rgb,vReflectionInfos +,coatGeoInfo +,reflectionSampler +,reflectionCoords +#ifdef REALTIME_FILTERING +,vReflectionFilteringInfo +#endif +); +#endif +} +#ifdef FUZZ +float modifiedFuzzRoughness=clamp(fuzz_roughness*(1.0-0.5*environmentFuzzBrdf.y),0.0,1.0);vec3 fuzzEnvironmentLight=vec3(0.0);float totalWeight=0.0;float fuzzIblFresnel=sqrt(environmentFuzzBrdf.z);for (int i=0; i0.0) {coatIblFresnel=getReflectanceFromBRDFLookup(vec3(coatReflectance.F0),vec3(coatReflectance.F90),coatGeoInfo.environmentBrdf).r;} +vec3 slab_diffuse_ibl=vec3(0.,0.,0.);vec3 slab_glossy_ibl=vec3(0.,0.,0.);vec3 slab_metal_ibl=vec3(0.,0.,0.);vec3 slab_coat_ibl=vec3(0.,0.,0.);slab_diffuse_ibl=baseDiffuseEnvironmentLight*vLightingIntensity.z;slab_diffuse_ibl*=aoOut.ambientOcclusionColor;slab_glossy_ibl=baseSpecularEnvironmentLight*vLightingIntensity.z;slab_metal_ibl=baseSpecularEnvironmentLight*conductorIblFresnel*vLightingIntensity.z;vec3 coatAbsorption=vec3(1.0);if (coat_weight>0.0) {slab_coat_ibl=coatEnvironmentLight*vLightingIntensity.z;float hemisphere_avg_fresnel=coatReflectance.F0+0.5*(1.0-coatReflectance.F0);float averageReflectance=(coatIblFresnel+hemisphere_avg_fresnel)*0.5;float roughnessFactor=1.0-coat_roughness*0.5;averageReflectance*=roughnessFactor;float darkened_transmission=(1.0-averageReflectance)*(1.0-averageReflectance);darkened_transmission=mix(1.0,darkened_transmission,coat_darkening);float sin2=1.0-coatGeoInfo.NdotV*coatGeoInfo.NdotV;sin2=sin2/(coat_ior*coat_ior);float cos_t=sqrt(1.0-sin2);float coatPathLength=1.0/cos_t;vec3 colored_transmission=pow(coat_color,vec3(coatPathLength));coatAbsorption=mix(vec3(1.0),colored_transmission*darkened_transmission,coat_weight);} +#ifdef FUZZ +vec3 slab_fuzz_ibl=fuzzEnvironmentLight*vLightingIntensity.z; +#endif +vec3 slab_subsurface_ibl=vec3(0.,0.,0.);vec3 slab_translucent_base_ibl=vec3(0.,0.,0.);slab_diffuse_ibl*=base_color.rgb; +#define CUSTOM_FRAGMENT_BEFORE_IBLLAYERCOMPOSITION +vec3 material_opaque_base_ibl=mix(slab_diffuse_ibl,slab_subsurface_ibl,subsurface_weight);vec3 material_dielectric_base_ibl=mix(material_opaque_base_ibl,slab_translucent_base_ibl,transmission_weight);vec3 material_dielectric_gloss_ibl=material_dielectric_base_ibl*(1.0-dielectricIblFresnel)+slab_glossy_ibl*dielectricIblColoredFresnel;vec3 material_base_substrate_ibl=mix(material_dielectric_gloss_ibl,slab_metal_ibl,base_metalness);vec3 material_coated_base_ibl=layer(material_base_substrate_ibl,slab_coat_ibl,coatIblFresnel,coatAbsorption,vec3(1.0)); +#ifdef FUZZ +material_surface_ibl=layer(material_coated_base_ibl,slab_fuzz_ibl,fuzzIblFresnel*fuzz_weight,vec3(1.0),fuzz_color); +#else +material_surface_ibl=material_coated_base_ibl; +#endif +#endif +`;e.IncludesShadersStore[p]||(e.IncludesShadersStore[p]=x);const I="openpbrDirectLightingInit",y=`#ifdef LIGHT{X} +preLightingInfo preInfo{X};preLightingInfo preInfoCoat{X};vec4 lightColor{X}=light{X}.vLightDiffuse;float shadow{X}=1.; +#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X}) +#else +#define CUSTOM_LIGHT{X}_COLOR +#ifdef SPOTLIGHT{X} +preInfo{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW);preInfoCoat{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW,vPositionW); +#elif defined(POINTLIGHT{X}) +preInfo{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW);preInfoCoat{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW,vPositionW); +#elif defined(HEMILIGHT{X}) +preInfo{X}=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);preInfoCoat{X}=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW); +#elif defined(DIRLIGHT{X}) +preInfo{X}=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);preInfoCoat{X}=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW); +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +preInfo{X}=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,normalW,vPositionW,light{X}.vLightData,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,specular_roughness);preInfoCoat{X}=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,coatNormalW,vPositionW,light{X}.vLightData,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,coat_roughness); +#endif +preInfo{X}.NdotV=baseGeoInfo.NdotV;preInfoCoat{X}.NdotV=coatGeoInfo.NdotV; +#ifdef SPOTLIGHT{X} +#ifdef LIGHT_FALLOFF_GLTF{X} +preInfo{X}.attenuation=computeDistanceLightFalloff_GLTF(preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.y); +#ifdef IESLIGHTTEXTURE{X} +preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X}); +#else +preInfo{X}.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w); +#endif +#elif defined(LIGHT_FALLOFF_PHYSICAL{X}) +preInfo{X}.attenuation=computeDistanceLightFalloff_Physical(preInfo{X}.lightDistanceSquared); +#ifdef IESLIGHTTEXTURE{X} +preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X}); +#else +preInfo{X}.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightDirection.w); +#endif +#elif defined(LIGHT_FALLOFF_STANDARD{X}) +preInfo{X}.attenuation=computeDistanceLightFalloff_Standard(preInfo{X}.lightOffset,light{X}.vLightFalloff.x); +#ifdef IESLIGHTTEXTURE{X} +preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X}); +#else +preInfo{X}.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightDirection.w,light{X}.vLightData.w); +#endif +#else +preInfo{X}.attenuation=computeDistanceLightFalloff(preInfo{X}.lightOffset,preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y); +#ifdef IESLIGHTTEXTURE{X} +preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X}); +#else +preInfo{X}.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w); +#endif +#endif +#elif defined(POINTLIGHT{X}) +#ifdef LIGHT_FALLOFF_GLTF{X} +preInfo{X}.attenuation=computeDistanceLightFalloff_GLTF(preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.y); +#elif defined(LIGHT_FALLOFF_PHYSICAL{X}) +preInfo{X}.attenuation=computeDistanceLightFalloff_Physical(preInfo{X}.lightDistanceSquared); +#elif defined(LIGHT_FALLOFF_STANDARD{X}) +preInfo{X}.attenuation=computeDistanceLightFalloff_Standard(preInfo{X}.lightOffset,light{X}.vLightFalloff.x); +#else +preInfo{X}.attenuation=computeDistanceLightFalloff(preInfo{X}.lightOffset,preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y); +#endif +#else +preInfo{X}.attenuation=1.0; +#endif +preInfoCoat{X}.attenuation=preInfo{X}.attenuation; +#if defined(HEMILIGHT{X}) +preInfo{X}.roughness=specular_roughness;preInfoCoat{X}.roughness=coat_roughness; +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +preInfo{X}.roughness=specular_roughness;preInfoCoat{X}.roughness=coat_roughness; +#else +preInfo{X}.roughness=adjustRoughnessFromLightProperties(specular_roughness,light{X}.vLightSpecular.a,preInfo{X}.lightDistance);preInfoCoat{X}.roughness=adjustRoughnessFromLightProperties(coat_roughness,light{X}.vLightSpecular.a,preInfoCoat{X}.lightDistance); +#endif +preInfo{X}.diffuseRoughness=base_diffuse_roughness;preInfo{X}.surfaceAlbedo=base_color.rgb; +#endif +#endif +`;e.IncludesShadersStore[I]||(e.IncludesShadersStore[I]=y);const v="openpbrDirectLighting",U=`#ifdef LIGHT{X} +{vec3 slab_diffuse=vec3(0.,0.,0.);vec3 slab_subsurface=vec3(0.,0.,0.);vec3 slab_translucent=vec3(0.,0.,0.);vec3 slab_glossy=vec3(0.,0.,0.);float specularFresnel=0.0;vec3 specularColoredFresnel=vec3(0.,0.,0.);vec3 slab_metal=vec3(0.,0.,0.);vec3 slab_coat=vec3(0.,0.,0.);float coatFresnel=0.0;vec3 slab_fuzz=vec3(0.,0.,0.);float fuzzFresnel=0.0; +#ifdef HEMILIGHT{X} +slab_diffuse=computeHemisphericDiffuseLighting(preInfo{X},lightColor{X}.rgb,light{X}.vLightGround); +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +slab_diffuse=computeAreaDiffuseLighting(preInfo{X},lightColor{X}.rgb); +#else +slab_diffuse=computeDiffuseLighting(preInfo{X},lightColor{X}.rgb); +#endif +#ifdef PROJECTEDLIGHTTEXTURE{X} +slab_diffuse*=computeProjectionTextureDiffuseLighting(projectionLightTexture{X},textureProjectionMatrix{X},vPositionW); +#endif +numLights+=1.0; +#ifdef FUZZ +float fuzzNdotH=max(dot(fuzzNormalW,preInfo{X}.H),0.0);vec3 fuzzBrdf=getFuzzBRDFLookup(fuzzNdotH,sqrt(fuzz_roughness)); +#endif +#ifdef THIN_FILM +float thin_film_desaturation_scale=(thin_film_ior-1.0)*sqrt(thin_film_thickness*0.001); +#endif +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +slab_glossy=computeAreaSpecularLighting(preInfo{X},light{X}.vLightSpecular.rgb,baseConductorReflectance.F0,baseConductorReflectance.F90); +#else +{ +#ifdef ANISOTROPIC_BASE +slab_glossy=computeAnisotropicSpecularLighting(preInfo{X},viewDirectionW,normalW, +baseGeoInfo.anisotropicTangent,baseGeoInfo.anisotropicBitangent,baseGeoInfo.anisotropy, +0.0,lightColor{X}.rgb); +#else +slab_glossy=computeSpecularLighting(preInfo{X},normalW,vec3(1.0),vec3(1.0),specular_roughness,lightColor{X}.rgb); +#endif +float NdotH=dot(normalW,preInfo{X}.H);specularFresnel=fresnelSchlickGGX(NdotH,baseDielectricReflectance.F0,baseDielectricReflectance.F90);specularColoredFresnel=specularFresnel*specular_color; +#ifdef THIN_FILM +float thinFilmIorScale=clamp(2.0*abs(thin_film_ior-1.0),0.0,1.0);vec3 thinFilmDielectricFresnel=evalIridescence(thin_film_outside_ior,thin_film_ior,preInfo{X}.VdotH,thin_film_thickness,baseDielectricReflectance.coloredF0);thinFilmDielectricFresnel=mix(thinFilmDielectricFresnel,vec3(dot(thinFilmDielectricFresnel,vec3(0.3333))),thin_film_desaturation_scale);specularColoredFresnel=mix(specularColoredFresnel,thinFilmDielectricFresnel*specular_color,thin_film_weight*thinFilmIorScale); +#endif +} +#endif +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +slab_metal=computeAreaSpecularLighting(preInfo{X},light{X}.vLightSpecular.rgb,baseConductorReflectance.F0,baseConductorReflectance.F90); +#else +{ +#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) +vec3 coloredFresnel=getF82Specular(preInfo{X}.VdotH,baseConductorReflectance.coloredF0,baseConductorReflectance.coloredF90,specular_roughness); +#else +vec3 coloredFresnel=fresnelSchlickGGX(preInfo{X}.VdotH,baseConductorReflectance.coloredF0,baseConductorReflectance.coloredF90); +#endif +#ifdef THIN_FILM +float thinFilmIorScale=clamp(2.0*abs(thin_film_ior-1.0),0.0,1.0);vec3 thinFilmConductorFresnel=evalIridescence(thin_film_outside_ior,thin_film_ior,preInfo{X}.VdotH,thin_film_thickness,baseConductorReflectance.coloredF0);thinFilmConductorFresnel=mix(thinFilmConductorFresnel,vec3(dot(thinFilmConductorFresnel,vec3(0.3333))),thin_film_desaturation_scale);coloredFresnel=mix(coloredFresnel,specular_weight*thinFilmIorScale*thinFilmConductorFresnel,thin_film_weight); +#endif +#ifdef ANISOTROPIC_BASE +slab_metal=computeAnisotropicSpecularLighting(preInfo{X},viewDirectionW,normalW,baseGeoInfo.anisotropicTangent,baseGeoInfo.anisotropicBitangent,baseGeoInfo.anisotropy,0.0,lightColor{X}.rgb); +#else +slab_metal=computeSpecularLighting(preInfo{X},normalW,vec3(1.0),coloredFresnel,specular_roughness,lightColor{X}.rgb); +#endif +} +#endif +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +slab_coat=computeAreaSpecularLighting(preInfoCoat{X},light{X}.vLightSpecular.rgb,coatReflectance.F0,coatReflectance.F90); +#else +{ +#ifdef ANISOTROPIC_COAT +slab_coat=computeAnisotropicSpecularLighting(preInfoCoat{X},viewDirectionW,coatNormalW, +coatGeoInfo.anisotropicTangent,coatGeoInfo.anisotropicBitangent,coatGeoInfo.anisotropy, +0.0,lightColor{X}.rgb); +#else +slab_coat=computeSpecularLighting(preInfoCoat{X},coatNormalW,vec3(coatReflectance.F0),vec3(1.0),coat_roughness,lightColor{X}.rgb); +#endif +float NdotH=dot(coatNormalW,preInfoCoat{X}.H);coatFresnel=fresnelSchlickGGX(NdotH,coatReflectance.F0,coatReflectance.F90);} +#endif +vec3 coatAbsorption=vec3(1.0);if (coat_weight>0.0) {float cosTheta_view=max(preInfoCoat{X}.NdotV,0.001);float cosTheta_light=max(preInfoCoat{X}.NdotL,0.001);float fresnel_view=coatReflectance.F0+(1.0-coatReflectance.F0)*pow(1.0-cosTheta_view,5.0);float fresnel_light=coatReflectance.F0+(1.0-coatReflectance.F0)*pow(1.0-cosTheta_light,5.0);float averageReflectance=(fresnel_view+fresnel_light)*0.5;float darkened_transmission=(1.0-averageReflectance)/(1.0+averageReflectance);darkened_transmission=mix(1.0,darkened_transmission,coat_darkening);float sin2=1.0-cosTheta_view*cosTheta_view;sin2=sin2/(coat_ior*coat_ior);float cos_t=sqrt(1.0-sin2);float coatPathLength=1.0/cos_t;vec3 colored_transmission=pow(coat_color,vec3(coatPathLength));coatAbsorption=mix(vec3(1.0),colored_transmission*darkened_transmission,coat_weight);} +#ifdef FUZZ +fuzzFresnel=fuzzBrdf.z;vec3 fuzzNormalW=mix(normalW,coatNormalW,coat_weight);float fuzzNdotV=max(dot(fuzzNormalW,viewDirectionW.xyz),0.0);float fuzzNdotL=max(dot(fuzzNormalW,preInfo{X}.L),0.0);slab_fuzz=lightColor{X}.rgb*preInfo{X}.attenuation*evalFuzz(preInfo{X}.L,fuzzNdotL,fuzzNdotV,fuzzTangent,fuzzBitangent,fuzzBrdf); +#else +vec3 fuzz_color=vec3(0.0); +#endif +slab_diffuse*=base_color.rgb;vec3 material_opaque_base=mix(slab_diffuse,slab_subsurface,subsurface_weight);vec3 material_dielectric_base=mix(material_opaque_base,slab_translucent,transmission_weight);vec3 material_dielectric_gloss=material_dielectric_base*(1.0-specularFresnel)+slab_glossy*specularColoredFresnel;vec3 material_base_substrate=mix(material_dielectric_gloss,slab_metal,base_metalness);vec3 material_coated_base=layer(material_base_substrate,slab_coat,coatFresnel,coatAbsorption,vec3(1.0));material_surface_direct+=layer(material_coated_base,slab_fuzz,fuzzFresnel*fuzz_weight,vec3(1.0),fuzz_color);} +#endif +`;e.IncludesShadersStore[v]||(e.IncludesShadersStore[v]=U);const o="openpbrPixelShader",R=`#define OPENPBR_FRAGMENT_SHADER +#define CUSTOM_FRAGMENT_EXTENSION +#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) +#extension GL_OES_standard_derivatives : enable +#endif +#ifdef LODBASEDMICROSFURACE +#extension GL_EXT_shader_texture_lod : enable +#endif +#define CUSTOM_FRAGMENT_BEGIN +#ifdef LOGARITHMICDEPTH +#extension GL_EXT_frag_depth : enable +#endif +#include[SCENE_MRT_COUNT] +precision highp float; +#include +#ifndef FROMLINEARSPACE +#define FROMLINEARSPACE +#endif +#include<__decl__openpbrFragment> +#include +#include<__decl__lightFragment>[0..maxSimultaneousLights] +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef REFLECTION +#include +#endif +#define CUSTOM_FRAGMENT_DEFINITIONS +#include +#include +#include +#include +#include +vec3 layer(vec3 slab_bottom,vec3 slab_top,float lerp_factor,vec3 bottom_multiplier,vec3 top_multiplier) {return mix(slab_bottom*bottom_multiplier,slab_top*top_multiplier,lerp_factor);} +void main(void) { +#define CUSTOM_FRAGMENT_MAIN_BEGIN +#include +#include +vec3 coatNormalW=normalW; +#include +#include +#include +#include +#include +#include +float subsurface_weight=0.0;float transmission_weight=0.0; +#define CUSTOM_FRAGMENT_UPDATE_ALPHA +#include +#define CUSTOM_FRAGMENT_BEFORE_LIGHTS +ambientOcclusionOutParams aoOut; +#ifdef AMBIENT_OCCLUSION +vec3 ambientOcclusionFromTexture=texture2D(ambientOcclusionSampler,vAmbientOcclusionUV+uvOffset).rgb; +#endif +aoOut=ambientOcclusionBlock( +#ifdef AMBIENT_OCCLUSION +ambientOcclusionFromTexture, +vAmbientOcclusionInfos +#endif +); +#ifdef ANISOTROPIC_COAT +geometryInfoAnisoOutParams coatGeoInfo=geometryInfoAniso( +coatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW +,vec3(geometry_coat_tangent.x,geometry_coat_tangent.y,coat_roughness_anisotropy),TBN +); +#else +geometryInfoOutParams coatGeoInfo=geometryInfo( +coatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW +); +#endif +specular_roughness=mix(specular_roughness,pow(min(1.0,pow(specular_roughness,4.0)+2.0*pow(coat_roughness,4.0)),0.25),coat_weight); +#ifdef ANISOTROPIC_BASE +geometryInfoAnisoOutParams baseGeoInfo=geometryInfoAniso( +normalW,viewDirectionW.xyz,specular_roughness,geometricNormalW +,vec3(geometry_tangent.x,geometry_tangent.y,specular_roughness_anisotropy),TBN +); +#else +geometryInfoOutParams baseGeoInfo=geometryInfo( +normalW,viewDirectionW.xyz,specular_roughness,geometricNormalW +); +#endif +#ifdef FUZZ +vec3 fuzzNormalW=normalize(mix(normalW,coatNormalW,coat_weight));vec3 fuzzTangent=normalize(TBN[0]);fuzzTangent=normalize(fuzzTangent-dot(fuzzTangent,fuzzNormalW)*fuzzNormalW);vec3 fuzzBitangent=cross(fuzzNormalW,fuzzTangent);geometryInfoOutParams fuzzGeoInfo=geometryInfo( +fuzzNormalW,viewDirectionW.xyz,fuzz_roughness,geometricNormalW +); +#endif +ReflectanceParams coatReflectance;coatReflectance=dielectricReflectance( +coat_ior +,1.0 +,vec3(1.0) +,coat_weight +); +#ifdef THIN_FILM +float thin_film_outside_ior=mix(1.0,coat_ior,coat_weight); +#endif +ReflectanceParams baseDielectricReflectance;{float effectiveCoatIor=mix(1.0,coat_ior,coat_weight);baseDielectricReflectance=dielectricReflectance( +specular_ior +,effectiveCoatIor +,specular_color +,specular_weight +);} +ReflectanceParams baseConductorReflectance;baseConductorReflectance=conductorReflectance(base_color,specular_color,specular_weight);vec3 material_surface_ibl=vec3(0.,0.,0.); +#include +vec3 material_surface_direct=vec3(0.,0.,0.); +#if defined(LIGHT0) +float aggShadow=0.;float numLights=0.; +#include[0..maxSimultaneousLights] +#include[0..maxSimultaneousLights] +#endif +vec3 material_surface_emission=vEmissionColor; +#ifdef EMISSION_COLOR +vec3 emissionColorTex=texture2D(emissionColorSampler,vEmissionColorUV+uvOffset).rgb; +#ifdef EMISSION_COLOR_GAMMA +material_surface_emission*=toLinearSpace(emissionColorTex.rgb); +#else +material_surface_emission*=emissionColorTex.rgb; +#endif +material_surface_emission*= vEmissionColorInfos.y; +#endif +material_surface_emission*=vLightingIntensity.y; +#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION +vec4 finalColor=vec4(material_surface_ibl+material_surface_direct+material_surface_emission,alpha); +#define CUSTOM_FRAGMENT_BEFORE_FOG +finalColor=max(finalColor,0.0); +#include +#include(color,finalColor) +#include +#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR +#ifdef PREPASS +#include +#endif +#if !defined(PREPASS) || defined(WEBGL2) +gl_FragColor=finalColor; +#endif +#include +#if ORDER_INDEPENDENT_TRANSPARENCY +if (fragDepth==nearestDepth) {frontColor.rgb+=finalColor.rgb*finalColor.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-finalColor.a);} else {backColor+=finalColor;} +#endif +#include +#define CUSTOM_FRAGMENT_MAIN_END +} +`;e.ShadersStore[o]||(e.ShadersStore[o]=R);const ne={name:o,shader:R};export{ne as openpbrPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbr.fragment-DZlw1Ils.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbr.fragment-DZlw1Ils.js new file mode 100644 index 0000000000000000000000000000000000000000..ae676b0fd2570a4c901c31f37f8532f6226d302b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbr.fragment-DZlw1Ils.js @@ -0,0 +1,1141 @@ +import{S as e}from"./index-CDrXokXW.js";import"./oitFragment-BcbCWH3V.js";import"./openpbrUboDeclaration-Dw_NcTG6.js";import"./pbrDebug-FlFed75Q.js";import"./shadowsFragmentFunctions-CTsFFgyf.js";import"./samplerFragmentDeclaration-cxB-jdDJ.js";import"./imageProcessingFunctions-BbtoaTge.js";import"./clipPlaneFragment-C7XUrTAZ.js";import"./logDepthDeclaration-DkdfQs4e.js";import"./fogFragment-DmA8Y7To.js";import"./helperFunctions-CZpZ-EbL.js";import"./hdrFilteringFunctions-DD5EqJpN.js";import"./harmonicsFunctions-DjLTZRig.js";import"./pbrBRDFFunctions-baMKuu65.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./meshUboDeclaration-Bk1ASTX2.js";import"./mainUVVaryingDeclaration-gz09aLXv.js";const a="openpbrFragmentSamplersDeclaration",S=`#include(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor,_SAMPLERNAME_,baseColor) +#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight) +#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_SAMPLERNAME_,baseDiffuseRoughness) +#include(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness,_SAMPLERNAME_,baseMetalness) +#include(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight,_SAMPLERNAME_,specularWeight) +#include(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor,_SAMPLERNAME_,specularColor) +#include(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness,_SAMPLERNAME_,specularRoughness) +#include(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy,_SAMPLERNAME_,specularRoughnessAnisotropy) +#include(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight,_SAMPLERNAME_,coatWeight) +#include(_DEFINENAME_,COAT_COLOR,_VARYINGNAME_,CoatColor,_SAMPLERNAME_,coatColor) +#include(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness,_SAMPLERNAME_,coatRoughness) +#include(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy,_SAMPLERNAME_,coatRoughnessAnisotropy) +#include(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening,_SAMPLERNAME_,coatDarkening) +#include(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight,_SAMPLERNAME_,fuzzWeight) +#include(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor,_SAMPLERNAME_,fuzzColor) +#include(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness,_SAMPLERNAME_,fuzzRoughness) +#include(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity,_SAMPLERNAME_,geometryOpacity) +#include(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent,_SAMPLERNAME_,geometryTangent) +#include(_DEFINENAME_,GEOMETRY_COAT_TANGENT,_VARYINGNAME_,GeometryCoatTangent,_SAMPLERNAME_,geometryCoatTangent) +#include(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor,_SAMPLERNAME_,emissionColor) +#include(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight,_SAMPLERNAME_,thinFilmWeight) +#include(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness,_SAMPLERNAME_,thinFilmThickness) +#include(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion,_SAMPLERNAME_,ambientOcclusion) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal) +#ifdef REFLECTION +#ifdef REFLECTIONMAP_3D +var reflectionSamplerSampler: sampler;var reflectionSampler: texture_cube; +#ifdef LODBASEDMICROSFURACE +#else +var reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_cube;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_cube; +#endif +#ifdef USEIRRADIANCEMAP +var irradianceSamplerSampler: sampler;var irradianceSampler: texture_cube; +#endif +#else +var reflectionSamplerSampler: sampler;var reflectionSampler: texture_2d; +#ifdef LODBASEDMICROSFURACE +#else +var reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_2d;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_2d; +#endif +#ifdef USEIRRADIANCEMAP +var irradianceSamplerSampler: sampler;var irradianceSampler: texture_2d; +#endif +#endif +#ifdef REFLECTIONMAP_SKYBOX +varying vPositionUVW: vec3f; +#else +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vDirectionW: vec3f; +#endif +#endif +#endif +#ifdef ENVIRONMENTBRDF +var environmentBrdfSamplerSampler: sampler;var environmentBrdfSampler: texture_2d; +#endif +#ifdef FUZZENVIRONMENTBRDF +var environmentFuzzBrdfSamplerSampler: sampler;var environmentFuzzBrdfSampler: texture_2d; +#endif +#if defined(ANISOTROPIC) || defined(FUZZ) +var blueNoiseSamplerSampler: sampler;var blueNoiseSampler: texture_2d; +#endif +#ifdef IBL_CDF_FILTERING +var icdfSamplerSampler: sampler;var icdfSampler: texture_2d; +#endif +`;e.IncludesShadersStoreWGSL[a]||(e.IncludesShadersStoreWGSL[a]=S);const n="openpbrNormalMapFragmentMainFunctions",h=`#if defined(GEOMETRY_NORMAL) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(FUZZ) || defined(DETAIL) +#if defined(TANGENT) && defined(NORMAL) +varying vTBN0: vec3f;varying vTBN1: vec3f;varying vTBN2: vec3f; +#endif +#ifdef OBJECTSPACE_NORMALMAP +uniform normalMatrix: mat4x4f;fn toNormalMatrix(m: mat4x4f)->mat4x4f +{var a00=m[0][0];var a01=m[0][1];var a02=m[0][2];var a03=m[0][3];var a10=m[1][0];var a11=m[1][1];var a12=m[1][2];var a13=m[1][3];var a20=m[2][0]; +var a21=m[2][1];var a22=m[2][2];var a23=m[2][3];var a30=m[3][0]; +var a31=m[3][1];var a32=m[3][2];var a33=m[3][3];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05=a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;var det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;var mi=mat4x4( +(a11*b11-a12*b10+a13*b09)/det, +(a02*b10-a01*b11-a03*b09)/det, +(a31*b05-a32*b04+a33*b03)/det, +(a22*b04-a21*b05-a23*b03)/det, +(a12*b08-a10*b11-a13*b07)/det, +(a00*b11-a02*b08+a03*b07)/det, +(a32*b02-a30*b05-a33*b01)/det, +(a20*b05-a22*b02+a23*b01)/det, +(a10*b10-a11*b08+a13*b06)/det, +(a01*b08-a00*b10-a03*b06)/det, +(a30*b04-a31*b02+a33*b00)/det, +(a21*b02-a20*b04-a23*b00)/det, +(a11*b07-a10*b09-a12*b06)/det, +(a00*b09-a01*b07+a02*b06)/det, +(a31*b01-a30*b03-a32*b00)/det, +(a20*b03-a21*b01+a22*b00)/det);return mat4x4(mi[0][0],mi[1][0],mi[2][0],mi[3][0], +mi[0][1],mi[1][1],mi[2][1],mi[3][1], +mi[0][2],mi[1][2],mi[2][2],mi[3][2], +mi[0][3],mi[1][3],mi[2][3],mi[3][3]);} +#endif +fn perturbNormalBase(cotangentFrame: mat3x3f,normal: vec3f,scale: f32)->vec3f +{var output=normal; +#ifdef NORMALXYSCALE +output=normalize(output* vec3f(scale,scale,1.0)); +#endif +return normalize(cotangentFrame*output);} +fn perturbNormal(cotangentFrame: mat3x3f,textureSample: vec3f,scale: f32)->vec3f +{return perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);} +fn cotangent_frame(normal: vec3f,p: vec3f,uv: vec2f,tangentSpaceParams: vec2f)->mat3x3f +{var dp1: vec3f=dpdx(p);var dp2: vec3f=dpdy(p);var duv1: vec2f=dpdx(uv);var duv2: vec2f=dpdy(uv);var dp2perp: vec3f=cross(dp2,normal);var dp1perp: vec3f=cross(normal,dp1);var tangent: vec3f=dp2perp*duv1.x+dp1perp*duv2.x;var bitangent: vec3f=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;var det: f32=max(dot(tangent,tangent),dot(bitangent,bitangent));var invmax: f32=select(inverseSqrt(det),0.0,det==0.0);return mat3x3f(tangent*invmax,bitangent*invmax,normal);} +#endif +`;e.IncludesShadersStoreWGSL[n]||(e.IncludesShadersStoreWGSL[n]=h);const i="openpbrNormalMapFragmentFunctions",R=`#if defined(GEOMETRY_NORMAL) +#include(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal,_SAMPLERNAME_,geometryNormal) +#endif +#if defined(GEOMETRY_COAT_NORMAL) +#include(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal,_SAMPLERNAME_,geometryCoatNormal) +#endif +#if defined(DETAIL) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail) +#endif +#if defined(GEOMETRY_NORMAL) && defined(PARALLAX) +const minSamples: f32=4.;const maxSamples: f32=15.;const iMaxSamples: i32=15;fn parallaxOcclusion(vViewDirCoT: vec3f,vNormalCoT: vec3f,texCoord: vec2f,parallaxScale: f32)->vec2f {var parallaxLimit: f32=length(vViewDirCoT.xy)/vViewDirCoT.z;parallaxLimit*=parallaxScale;var vOffsetDir: vec2f=normalize(vViewDirCoT.xy);var vMaxOffset: vec2f=vOffsetDir*parallaxLimit;var numSamples: f32=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));var stepSize: f32=1.0/numSamples;var currRayHeight: f32=1.0;var vCurrOffset: vec2f= vec2f(0,0);var vLastOffset: vec2f= vec2f(0,0);var lastSampledHeight: f32=1.0;var currSampledHeight: f32=1.0;var keepWorking: bool=true;for (var i: i32=0; icurrRayHeight) +{var delta1: f32=currSampledHeight-currRayHeight;var delta2: f32=(currRayHeight+stepSize)-lastSampledHeight;var ratio: f32=delta1/(delta1+delta2);vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;keepWorking=false;} +else +{currRayHeight-=stepSize;vLastOffset=vCurrOffset; +#ifdef PARALLAX_RHS +vCurrOffset-=stepSize*vMaxOffset; +#else +vCurrOffset+=stepSize*vMaxOffset; +#endif +lastSampledHeight=currSampledHeight;}} +return vCurrOffset;} +fn parallaxOffset(viewDir: vec3f,heightScale: f32)->vec2f +{var height: f32=textureSample(geometryNormalSampler,geometryNormalSamplerSampler,fragmentInputs.vGeometryNormalUV).w;var texCoordOffset: vec2f=heightScale*viewDir.xy*height; +#ifdef PARALLAX_RHS +return texCoordOffset; +#else +return -texCoordOffset; +#endif +} +#endif +`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=R);const o="openpbrDielectricReflectance",N=`struct ReflectanceParams +{F0: f32, +F90: f32, +coloredF0: vec3f, +coloredF90: vec3f,}; +#define pbr_inline +fn dielectricReflectance( +insideIOR: f32,outsideIOR: f32,specularColor: vec3f,specularWeight: f32 +)->ReflectanceParams +{var outParams: ReflectanceParams;let dielectricF0=pow((insideIOR-outsideIOR)/(insideIOR+outsideIOR),2.0); +#if DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_GLTF +let maxF0=max(specularColor.r,max(specularColor.g,specularColor.b));outParams.F0=dielectricF0*maxF0*specularWeight; +#else +outParams.F0=dielectricF0*specularWeight; +#endif +let f90Scale=clamp(2.0f*abs(insideIOR-outsideIOR),0.0f,1.0f);outParams.F90=f90Scale*specularWeight;outParams.coloredF0=vec3f(dielectricF0*specularWeight)*specularColor.rgb; +#if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR) +let dielectricColorF90: vec3f=specularColor.rgb*vec3f(f90Scale)*specularWeight; +#else +let dielectricColorF90: vec3f=vec3f(f90Scale)*specularWeight; +#endif +outParams.coloredF90=dielectricColorF90;return outParams;} +`;e.IncludesShadersStoreWGSL[o]||(e.IncludesShadersStoreWGSL[o]=N);const t="openpbrConductorReflectance",A=`#define pbr_inline +fn conductorReflectance(baseColor: vec3f,specularColor: vec3f,specularWeight: f32)->ReflectanceParams +{var outParams: ReflectanceParams; +#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) +outParams.coloredF0=baseColor*specularWeight;outParams.coloredF90=specularColor*specularWeight; +#else +outParams.coloredF0=baseColor;outParams.coloredF90=vec3f(1.0f); +#endif +outParams.F0=1.0f;outParams.F90=1.0f;return outParams;}`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=A);const f="openpbrBlockAmbientOcclusion",L=`struct ambientOcclusionOutParams +{ambientOcclusionColor: vec3f, +#if DEBUGMODE>0 && defined(AMBIENT_OCCLUSION) +ambientOcclusionColorMap: vec3f +#endif +}; +#define pbr_inline +fn ambientOcclusionBlock( +#ifdef AMBIENT_OCCLUSION +ambientOcclusionColorMap_: vec3f, +ambientInfos: vec2f +#endif +)->ambientOcclusionOutParams +{ +var outParams: ambientOcclusionOutParams;var ambientOcclusionColor: vec3f= vec3f(1.,1.,1.); +#ifdef AMBIENT_OCCLUSION +var ambientOcclusionColorMap: vec3f=ambientOcclusionColorMap_*ambientInfos.y; +#ifdef AMBIENTINGRAYSCALE +ambientOcclusionColorMap= vec3f(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r); +#endif +#if DEBUGMODE>0 +outParams.ambientOcclusionColorMap=ambientOcclusionColorMap; +#endif +#endif +outParams.ambientOcclusionColor=ambientOcclusionColor;return outParams;} +`;e.IncludesShadersStoreWGSL[f]||(e.IncludesShadersStoreWGSL[f]=L);const l="openpbrGeometryInfo",T=`struct geometryInfoOutParams +{NdotV: f32, +NdotVUnclamped: f32, +environmentBrdf: vec3f, +horizonOcclusion: f32};struct geometryInfoAnisoOutParams +{NdotV: f32, +NdotVUnclamped: f32, +environmentBrdf: vec3f, +horizonOcclusion: f32, +anisotropy: f32, +anisotropicTangent: vec3f, +anisotropicBitangent: vec3f, +TBN: mat3x3};fn geometryInfo( +normalW: vec3f,viewDirectionW: vec3f,roughness: f32,geometricNormalW: vec3f +)->geometryInfoOutParams +{var outParams: geometryInfoOutParams;outParams.NdotVUnclamped=dot(normalW,viewDirectionW);outParams.NdotV=absEps(outParams.NdotVUnclamped); +#if defined(ENVIRONMENTBRDF) +outParams.environmentBrdf=getBRDFLookup(outParams.NdotV,roughness); +#else +outParams.environmentBrdf=vec3f(0.0); +#endif +outParams.horizonOcclusion=1.0f; +#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX) +#ifdef HORIZONOCCLUSION +#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) +#ifdef REFLECTIONMAP_3D +outParams.horizonOcclusion=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW); +#endif +#endif +#endif +#endif +return outParams;} +fn geometryInfoAniso( +normalW: vec3f,viewDirectionW: vec3f,roughness: f32,geometricNormalW: vec3f +,vAnisotropy: vec3f,TBN: mat3x3 +)->geometryInfoAnisoOutParams +{let geoInfo: geometryInfoOutParams=geometryInfo(normalW,viewDirectionW,roughness,geometricNormalW);var outParams: geometryInfoAnisoOutParams;outParams.NdotV=geoInfo.NdotV;outParams.NdotVUnclamped=geoInfo.NdotVUnclamped;outParams.environmentBrdf=geoInfo.environmentBrdf;outParams.horizonOcclusion=geoInfo.horizonOcclusion;outParams.anisotropy=vAnisotropy.b;let anisotropyDirection: vec3f=vec3f(vAnisotropy.xy,0.);let anisoTBN: mat3x3=mat3x3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));outParams.anisotropicTangent=normalize(anisoTBN*anisotropyDirection);outParams.anisotropicBitangent=normalize(cross(anisoTBN[2],outParams.anisotropicTangent));outParams.TBN=TBN;return outParams;} +`;e.IncludesShadersStoreWGSL[l]||(e.IncludesShadersStoreWGSL[l]=T);const s="openpbrIblFunctions",F=`#ifdef REFLECTION +fn sampleIrradiance( +surfaceNormal: vec3f +#if defined(NORMAL) && defined(USESPHERICALINVERTEX) +,vEnvironmentIrradianceSH: vec3f +#endif +#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D)) +,iblMatrix: mat4x4f +#endif +#ifdef USEIRRADIANCEMAP +#ifdef REFLECTIONMAP_3D +,irradianceSampler: texture_cube +,irradianceSamplerSampler: sampler +#else +,irradianceSampler: texture_2d +,irradianceSamplerSampler: sampler +#endif +#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION +,reflectionDominantDirection: vec3f +#endif +#endif +#ifdef REALTIME_FILTERING +,reflectionFilteringInfo: vec2f +#ifdef IBL_CDF_FILTERING +,icdfSampler: texture_2d +,icdfSamplerSampler: sampler +#endif +#endif +,reflectionInfos: vec2f +,viewDirectionW: vec3f +,diffuseRoughness: f32 +,surfaceAlbedo: vec3f +)->vec3f {var environmentIrradiance=vec3f(0.,0.,0.); +#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D)) +var irradianceVector=(iblMatrix*vec4f(surfaceNormal,0.0f)).xyz;let irradianceView=(iblMatrix*vec4f(viewDirectionW,0.0f)).xyz; +#if !defined(USE_IRRADIANCE_DOMINANT_DIRECTION) && !defined(REALTIME_FILTERING) +#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY +{let NdotV=max(dot(surfaceNormal,viewDirectionW),0.0f);irradianceVector=mix(irradianceVector,irradianceView,(0.5f*(1.0f-NdotV))*diffuseRoughness);} +#endif +#endif +#ifdef REFLECTIONMAP_OPPOSITEZ +irradianceVector.z*=-1.0f; +#endif +#ifdef INVERTCUBICMAP +irradianceVector.y*=-1.0f; +#endif +#endif +#ifdef USESPHERICALFROMREFLECTIONMAP +#if defined(NORMAL) && defined(USESPHERICALINVERTEX) +environmentIrradiance=vEnvironmentIrradianceSH; +#else +#if defined(REALTIME_FILTERING) +environmentIrradiance=irradiance(reflectionSampler,reflectionSamplerSampler,irradianceVector,reflectionFilteringInfo,diffuseRoughness,surfaceAlbedo,irradianceView +#ifdef IBL_CDF_FILTERING +,icdfSampler +,icdfSamplerSampler +#endif +); +#else +environmentIrradiance=computeEnvironmentIrradiance(irradianceVector); +#endif +#endif +#elif defined(USEIRRADIANCEMAP) +#ifdef REFLECTIONMAP_3D +let environmentIrradianceFromTexture: vec4f=textureSample(irradianceSampler,irradianceSamplerSampler,irradianceVector); +#else +let environmentIrradianceFromTexture: vec4f=textureSample(irradianceSampler,irradianceSamplerSampler,reflectionCoords); +#endif +environmentIrradiance=environmentIrradianceFromTexture.rgb; +#ifdef RGBDREFLECTION +environmentIrradiance.rgb=fromRGBD(environmentIrradianceFromTexture); +#endif +#ifdef GAMMAREFLECTION +environmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb); +#endif +#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION +let Ls: vec3f=normalize(reflectionDominantDirection);let NoL: f32=dot(irradianceVector,Ls);let NoV: f32=dot(irradianceVector,irradianceView);var diffuseRoughnessTerm=vec3f(1.0f); +#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON +let LoV: f32=dot (Ls,irradianceView);let mag: f32=length(reflectionDominantDirection)*2.0f;let clampedAlbedo: vec3f=clamp(surfaceAlbedo,vec3f(0.1f),vec3f(1.0f));diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;diffuseRoughnessTerm=diffuseRoughnessTerm/clampedAlbedo;diffuseRoughnessTerm=mix(vec3f(1.0f),diffuseRoughnessTerm,sqrt(clamp(mag*NoV,0.0f,1.0f))); +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY +let H: vec3f=(irradianceView+Ls)*0.5f;let VoH: f32=dot(irradianceView,H);diffuseRoughnessTerm=vec3f(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI); +#endif +environmentIrradiance=environmentIrradiance.rgb*diffuseRoughnessTerm; +#endif +#endif +environmentIrradiance*=reflectionInfos.x;return environmentIrradiance;} +#ifdef REFLECTIONMAP_3D +fn createReflectionCoords(vPositionW: vec3f,normalW: vec3f)->vec3f +#else +fn createReflectionCoords(vPositionW: vec3f,normalW: vec3f)->vec2f +#endif +{var reflectionVector: vec3f=computeReflectionCoords(vec4f(vPositionW,1.0f),normalW); +#ifdef REFLECTIONMAP_OPPOSITEZ +reflectionVector.z*=-1.0; +#endif +#ifdef REFLECTIONMAP_3D +var reflectionCoords: vec3f=reflectionVector; +#else +var reflectionCoords: vec2f=reflectionVector.xy; +#ifdef REFLECTIONMAP_PROJECTION +reflectionCoords/=reflectionVector.z; +#endif +reflectionCoords.y=1.0f-reflectionCoords.y; +#endif +return reflectionCoords;} +fn sampleRadiance( +alphaG: f32 +,reflectionMicrosurfaceInfos: vec3f +,reflectionInfos: vec2f +,geoInfo: geometryInfoOutParams +#ifdef REFLECTIONMAP_3D +,reflectionSampler: texture_cube +,reflectionSamplerSampler: sampler +,reflectionCoords: vec3f +#else +,reflectionSampler: texture_2d +,reflectionSamplerSampler: sampler +,reflectionCoords: vec2f +#endif +#ifdef REALTIME_FILTERING +,reflectionFilteringInfo: vec2f +#endif +)->vec3f {var environmentRadiance: vec4f=vec4f(0.f,0.f,0.f,0.f); +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +var reflectionLOD: f32=getLodFromAlphaG(reflectionMicrosurfaceInfos.x,alphaG,geoInfo.NdotVUnclamped); +#elif defined(LINEARSPECULARREFLECTION) +var reflectionLOD: f32=getLinearLodFromRoughness(reflectionMicrosurfaceInfos.x,roughness); +#else +var reflectionLOD: f32=getLodFromAlphaG(reflectionMicrosurfaceInfos.x,alphaG); +#endif +reflectionLOD=reflectionLOD*reflectionMicrosurfaceInfos.y+reflectionMicrosurfaceInfos.z; +#ifdef REALTIME_FILTERING +environmentRadiance=vec4f(radiance(alphaG,reflectionSampler,reflectionSamplerSampler,reflectionCoords,reflectionFilteringInfo),1.0f); +#else +environmentRadiance=textureSampleLevel(reflectionSampler,reflectionSamplerSampler,reflectionCoords,reflectionLOD); +#endif +#ifdef RGBDREFLECTION +environmentRadiance.rgb=fromRGBD(environmentRadiance); +#endif +#ifdef GAMMAREFLECTION +environmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb); +#endif +return environmentRadiance.rgb;} +#if defined(ANISOTROPIC) +fn sampleRadianceAnisotropic( +alphaG: f32 +,reflectionMicrosurfaceInfos: vec3f +,reflectionInfos: vec2f +,geoInfo: geometryInfoAnisoOutParams +,normalW: vec3f +,viewDirectionW: vec3f +,positionW: vec3f +,noise: vec3f +#ifdef REFLECTIONMAP_3D +,reflectionSampler: texture_cube +,reflectionSamplerSampler: sampler +#else +,reflectionSampler: texture_2d +,reflectionSamplerSampler: sampler +#endif +#ifdef REALTIME_FILTERING +,reflectionFilteringInfo: vec2f +#endif +)->vec3f {var environmentRadiance: vec4f=vec4f(0.f,0.f,0.f,0.f);let alphaT=alphaG*sqrt(2.0f/(1.0f+(1.0f-geoInfo.anisotropy)*(1.0f-geoInfo.anisotropy)));let alphaB=(1.0f-geoInfo.anisotropy)*alphaT;let modifiedAlphaG=alphaB; +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +var reflectionLOD: f32=getLodFromAlphaG(reflectionMicrosurfaceInfos.x,modifiedAlphaG,geoInfo.NdotVUnclamped); +#elif defined(LINEARSPECULARREFLECTION) +var reflectionLOD: f32=getLinearLodFromRoughness(reflectionMicrosurfaceInfos.x,roughness); +#else +var reflectionLOD: f32=getLodFromAlphaG(reflectionMicrosurfaceInfos.x,modifiedAlphaG); +#endif +reflectionLOD=reflectionLOD*reflectionMicrosurfaceInfos.y+reflectionMicrosurfaceInfos.z; +#ifdef REALTIME_FILTERING +var view=(uniforms.reflectionMatrix*vec4f(viewDirectionW,0.0f)).xyz;var tangent=(uniforms.reflectionMatrix*vec4f(geoInfo.anisotropicTangent,0.0f)).xyz;var bitangent=(uniforms.reflectionMatrix*vec4f(geoInfo.anisotropicBitangent,0.0f)).xyz;var normal=(uniforms.reflectionMatrix*vec4f(normalW,0.0f)).xyz; +#ifdef REFLECTIONMAP_OPPOSITEZ +view.z*=-1.0f;tangent.z*=-1.0f;bitangent.z*=-1.0f;normal.z*=-1.0f; +#endif +environmentRadiance = +vec4f(radianceAnisotropic(alphaT,alphaB,reflectionSampler,reflectionSamplerSampler, +view,tangent, +bitangent,normal, +reflectionFilteringInfo,noise.xy), +1.0f); +#else +const samples: i32=16;var radianceSample=vec4f(0.0);var accumulatedRadiance=vec3f(0.0);var reflectionCoords=vec3f(0.0);var sample_weight=0.0f;var total_weight=0.0f;let step=1.0f/f32(max(samples-1,1));for (var i: i32=0; i0.0) {let blend: f32=t;bentNormal=normalize(mix(normalW,geoInfo.anisotropicTangent,blend));} else {bentNormal=normalW;} +reflectionCoords=createReflectionCoords(positionW,bentNormal);radianceSample=textureSampleLevel(reflectionSampler,reflectionSamplerSampler,reflectionCoords,reflectionLOD); +#ifdef RGBDREFLECTION +accumulatedRadiance+=vec3f(sample_weight)*fromRGBD(radianceSample); +#elif defined(GAMMAREFLECTION) +accumulatedRadiance+=vec3f(sample_weight)*toLinearSpace(radianceSample.rgb); +#else +accumulatedRadiance+=vec3f(sample_weight)*radianceSample.rgb; +#endif +total_weight+=sample_weight;} +environmentRadiance=vec4f(accumulatedRadiance/vec3f(total_weight),1.0f); +#endif +environmentRadiance=vec4f(environmentRadiance.rgb*reflectionInfos.xxx,environmentRadiance.a);return environmentRadiance.rgb;} +#endif +fn conductorIblFresnel(reflectance: ReflectanceParams,NdotV: f32,roughness: f32,environmentBrdf: vec3f)->vec3f +{ +#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) +let albedoF0: vec3f=mix(reflectance.coloredF0,pow(reflectance.coloredF0,vec3f(1.4f)),roughness);return getF82Specular(NdotV,albedoF0,reflectance.coloredF90,roughness); +#else +return getReflectanceFromBRDFLookup(reflectance.coloredF0,reflectance.coloredF90,environmentBrdf); +#endif +} +#endif +`;e.IncludesShadersStoreWGSL[s]||(e.IncludesShadersStoreWGSL[s]=F);const c="openpbrNormalMapFragment",O=`var uvOffset: vec2f= vec2f(0.0,0.0); +#if defined(GEOMETRY_NORMAL) || defined(GEOMETRY_COAT_NORMAL) || defined(PARALLAX) || defined(DETAIL) +#ifdef NORMALXYSCALE +var normalScale: f32=1.0; +#elif defined(GEOMETRY_NORMAL) +var normalScale: f32=uniforms.vGeometryNormalInfos.y; +#else +var normalScale: f32=1.0; +#endif +#if defined(TANGENT) && defined(NORMAL) +var TBN: mat3x3f=mat3x3(input.vTBN0,input.vTBN1,input.vTBN2); +#elif defined(GEOMETRY_NORMAL) +var TBNUV: vec2f=select(-fragmentInputs.vGeometryNormalUV,fragmentInputs.vGeometryNormalUV,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW*normalScale,input.vPositionW,TBNUV,uniforms.vTangentSpaceParams); +#else +var TBNUV: vec2f=select(-fragmentInputs.vDetailUV,fragmentInputs.vDetailUV,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW*normalScale,input.vPositionW,TBNUV, vec2f(1.,1.)); +#endif +#elif defined(ANISOTROPIC) || defined(FUZZ) +#if defined(TANGENT) && defined(NORMAL) +var TBN: mat3x3f=mat3x3(input.vTBN0,input.vTBN1,input.vTBN2); +#else +var TBNUV: vec2f=select( -fragmentInputs.vMainUV1,fragmentInputs.vMainUV1,fragmentInputs.frontFacing);var TBN: mat3x3f=cotangent_frame(normalW,input.vPositionW,TBNUV, vec2f(1.,1.)); +#endif +#endif +#ifdef PARALLAX +var invTBN: mat3x3f=transposeMat3(TBN); +#ifdef PARALLAXOCCLUSION +#else +#endif +#endif +#ifdef DETAIL +var detailColor: vec4f=textureSample(detailSampler,detailSamplerSampler,fragmentInputs.vDetailUV+uvOffset);var detailNormalRG: vec2f=detailColor.wy*2.0-1.0;var detailNormalB: f32=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));var detailNormal: vec3f= vec3f(detailNormalRG,detailNormalB); +#endif +#ifdef GEOMETRY_COAT_NORMAL +coatNormalW=perturbNormal(TBN,textureSample(geometryCoatNormalSampler,geometryCoatNormalSamplerSampler,fragmentInputs.vGeometryCoatNormalUV+uvOffset).xyz,uniforms.vGeometryCoatNormalInfos.y); +#endif +#ifdef GEOMETRY_NORMAL +#ifdef OBJECTSPACE_NORMALMAP +#define CUSTOM_FRAGMENT_BUMP_FRAGMENT +normalW=normalize(textureSample(geometryNormalSampler,geometryNormalSamplerSampler,fragmentInputs.vGeometryNormalUV).xyz *2.0-1.0);normalW=normalize(mat3x3f(uniforms.normalMatrix[0].xyz,uniforms.normalMatrix[1].xyz,uniforms.normalMatrix[2].xyz)*normalW); +#elif !defined(DETAIL) +normalW=perturbNormal(TBN,textureSample(geometryNormalSampler,geometryNormalSamplerSampler,fragmentInputs.vGeometryNormalUV+uvOffset).xyz,uniforms.vGeometryNormalInfos.y); +#else +var sampledNormal: vec3f=textureSample(geometryNormalSampler,geometryNormalSamplerSampler,fragmentInputs.vGeometryNormalUV+uvOffset).xyz*2.0-1.0; +#if DETAIL_NORMALBLENDMETHOD==0 +detailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);var blendedNormal: vec3f=normalize( vec3f(sampledNormal.xy+detailNormal.xy,sampledNormal.z*detailNormal.z)); +#elif DETAIL_NORMALBLENDMETHOD==1 +detailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);sampledNormal+= vec3f(0.0,0.0,1.0);detailNormal*= vec3f(-1.0,-1.0,1.0);var blendedNormal: vec3f=sampledNormal*dot(sampledNormal,detailNormal)/sampledNormal.z-detailNormal; +#endif +normalW=perturbNormalBase(TBN,blendedNormal,uniforms.vGeometryNormalInfos.y); +#endif +#elif defined(DETAIL) +detailNormal=vec3f(detailNormal.xy*uniforms.vDetailInfos.z,detailNormal.z);normalW=perturbNormalBase(TBN,detailNormal,uniforms.vDetailInfos.z); +#endif +`;e.IncludesShadersStoreWGSL[c]||(e.IncludesShadersStoreWGSL[c]=O);const m="openpbrBlockNormalFinal",b=`#if defined(FORCENORMALFORWARD) && defined(NORMAL) +var faceNormal: vec3f=normalize(cross(dpdx(fragmentInputs.vPositionW),dpdy(fragmentInputs.vPositionW)))*scene.vEyePosition.w; +#if defined(TWOSIDEDLIGHTING) +faceNormal=select(-faceNormal,faceNormal,fragmentInputs.frontFacing); +#endif +normalW*=sign(dot(normalW,faceNormal));coatNormalW*=sign(dot(coatNormalW,faceNormal)); +#endif +#if defined(TWOSIDEDLIGHTING) && defined(NORMAL) +#if defined(MIRRORED) +normalW=select(normalW,-normalW,fragmentInputs.frontFacing);coatNormalW=select(coatNormalW,-coatNormalW,fragmentInputs.frontFacing); +#else +normalW=select(-normalW,normalW,fragmentInputs.frontFacing);coatNormalW=select(-coatNormalW,coatNormalW,fragmentInputs.frontFacing); +#endif +#endif +`;e.IncludesShadersStoreWGSL[m]||(e.IncludesShadersStoreWGSL[m]=b);const d="openpbrBaseLayerData",C=`var base_color=vec3f(0.8);var base_metalness: f32=0.0;var base_diffuse_roughness: f32=0.0;var specular_weight: f32=1.0;var specular_roughness: f32=0.3;var specular_color: vec3f=vec3f(1.0);var specular_roughness_anisotropy: f32=0.0;var specular_ior: f32=1.5;var alpha: f32=1.0;var geometry_tangent: vec2f=vec2f(1.0,0.0); +#ifdef BASE_WEIGHT +let baseWeightFromTexture: vec4f=textureSample(baseWeightSampler,baseWeightSamplerSampler,fragmentInputs.vBaseWeightUV+uvOffset); +#endif +#ifdef BASE_COLOR +let baseColorFromTexture: vec4f=textureSample(baseColorSampler,baseColorSamplerSampler,fragmentInputs.vBaseColorUV+uvOffset); +#endif +#ifdef BASE_METALNESS +let metallicFromTexture: vec4f=textureSample(baseMetalnessSampler,baseMetalnessSamplerSampler,fragmentInputs.vBaseMetalnessUV+uvOffset); +#endif +#ifdef BASE_DIFFUSE_ROUGHNESS +let baseDiffuseRoughnessFromTexture: f32=textureSample(baseDiffuseRoughnessSampler,baseDiffuseRoughnessSamplerSampler,fragmentInputs.vBaseDiffuseRoughnessUV+uvOffset).r; +#endif +#ifdef GEOMETRY_TANGENT +let geometryTangentFromTexture: vec3f=textureSample(geometryTangentSampler,geometryTangentSamplerSampler,fragmentInputs.vGeometryTangentUV+uvOffset).rgb; +#endif +#ifdef SPECULAR_ROUGHNESS_ANISOTROPY +let anisotropyFromTexture: f32=textureSample(specularRoughnessAnisotropySampler,specularRoughnessAnisotropySamplerSampler,fragmentInputs.vSpecularRoughnessAnisotropyUV+uvOffset).r*uniforms.vSpecularRoughnessAnisotropyInfos.y; +#endif +#ifdef GEOMETRY_OPACITY +let opacityFromTexture: vec4f=textureSample(geometryOpacitySampler,geometryOpacitySamplerSampler,fragmentInputs.vGeometryOpacityUV+uvOffset); +#endif +#ifdef DECAL +let decalFromTexture: vec4f=textureSample(decalSampler,decalSamplerSampler,fragmentInputs.vDecalUV+uvOffset); +#endif +#ifdef SPECULAR_COLOR +let specularColorFromTexture: vec4f=textureSample(specularColorSampler,specularColorSamplerSampler,fragmentInputs.vSpecularColorUV+uvOffset); +#endif +#if defined(SPECULAR_WEIGHT) +#ifdef SPECULAR_WEIGHT_IN_ALPHA +let specularWeightFromTexture: f32=textureSample(specularWeightSampler,specularWeightSamplerSampler,fragmentInputs.vSpecularWeightUV+uvOffset).a; +#else +let specularWeightFromTexture: f32=textureSample(specularWeightSampler,specularWeightSamplerSampler,fragmentInputs.vSpecularWeightUV+uvOffset).r; +#endif +#endif +#if defined(ANISOTROPIC) || defined(FUZZ) +let noise=textureSample(blueNoiseSampler,blueNoiseSamplerSampler,fragmentInputs.position.xy/256.0).xyz; +#endif +#if defined(ROUGHNESSSTOREINMETALMAPGREEN) && defined(BASE_METALNESS) +let roughnessFromTexture: f32=metallicFromTexture.g; +#elif defined(SPECULAR_ROUGHNESS) +let roughnessFromTexture: f32=textureSample(specularRoughnessSampler,specularRoughnessSamplerSampler,fragmentInputs.vSpecularRoughnessUV+uvOffset).r; +#endif +base_color=uniforms.vBaseColor.rgb; +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +base_color*=fragmentInputs.vColor.rgb; +#endif +#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES) +alpha*=fragmentInputs.vColor.a; +#endif +base_color*=vec3(uniforms.vBaseWeight);alpha=uniforms.vBaseColor.a;base_metalness=uniforms.vReflectanceInfo.x;base_diffuse_roughness=uniforms.vBaseDiffuseRoughness;specular_roughness=uniforms.vReflectanceInfo.y;specular_color=uniforms.vSpecularColor.rgb;specular_weight=uniforms.vReflectanceInfo.a;specular_ior=uniforms.vReflectanceInfo.z;specular_roughness_anisotropy=uniforms.vSpecularAnisotropy.b;geometry_tangent=uniforms.vSpecularAnisotropy.rg; +#ifdef BASE_COLOR +#ifdef BASE_COLOR_GAMMA +base_color*=toLinearSpace(baseColorFromTexture.rgb); +#else +base_color*=baseColorFromTexture.rgb; +#endif +base_color*=uniforms.vBaseColorInfos.y; +#endif +#ifdef BASE_WEIGHT +base_color*=baseWeightFromTexture.r; +#endif +#if defined(BASE_COLOR) && defined(ALPHA_FROM_BASE_COLOR_TEXTURE) +alpha*=baseColorFromTexture.a; +#elif defined(GEOMETRY_OPACITY) +alpha*=opacityFromTexture.a;alpha*=uniforms.vGeometryOpacityInfos.y; +#endif +#ifdef ALPHATEST +#if DEBUGMODE != 88 +if (alpha0.0) { +#ifdef REFLECTIONMAP_3D +var reflectionCoords: vec3f=vec3f(0.f,0.f,0.f); +#else +var reflectionCoords: vec2f=vec2f(0.f,0.f); +#endif +reflectionCoords=createReflectionCoords(fragmentInputs.vPositionW,coatNormalW);var coatAlphaG: f32=coat_roughness*coat_roughness; +#ifdef ANISOTROPIC_COAT +coatEnvironmentLight=sampleRadianceAnisotropic(coatAlphaG,uniforms.vReflectionMicrosurfaceInfos.rgb,uniforms.vReflectionInfos +,coatGeoInfo +,coatNormalW +,viewDirectionW +,fragmentInputs.vPositionW +,noise +,reflectionSampler +,reflectionSamplerSampler +#ifdef REALTIME_FILTERING +,uniforms.vReflectionFilteringInfo +#endif +); +#else +coatEnvironmentLight=sampleRadiance(coatAlphaG,uniforms.vReflectionMicrosurfaceInfos.rgb,uniforms.vReflectionInfos +,coatGeoInfo +,reflectionSampler +,reflectionSamplerSampler +,reflectionCoords +#ifdef REALTIME_FILTERING +,uniforms.vReflectionFilteringInfo +#endif +); +#endif +} +#ifdef FUZZ +let modifiedFuzzRoughness: f32=clamp(fuzz_roughness*(1.0f-0.5f*environmentFuzzBrdf.y),0.0f,1.0f);var fuzzEnvironmentLight=vec3f(0.0f,0.0f,0.0f);var totalWeight=0.0f;let fuzzIblFresnel: f32=sqrt(environmentFuzzBrdf.z);for (var i: i32=0; i0.0) {coatIblFresnel=getReflectanceFromBRDFWithEnvLookup(vec3f(coatReflectance.F0),vec3f(coatReflectance.F90),coatGeoInfo.environmentBrdf).r;} +var slab_diffuse_ibl: vec3f=vec3f(0.,0.,0.);var slab_glossy_ibl: vec3f=vec3f(0.,0.,0.);var slab_metal_ibl: vec3f=vec3f(0.,0.,0.);var slab_coat_ibl: vec3f=vec3f(0.,0.,0.);slab_diffuse_ibl=baseDiffuseEnvironmentLight*uniforms.vLightingIntensity.z;slab_diffuse_ibl*=aoOut.ambientOcclusionColor;slab_glossy_ibl=baseSpecularEnvironmentLight*uniforms.vLightingIntensity.z;slab_metal_ibl=baseSpecularEnvironmentLight*conductorIblFresnel*uniforms.vLightingIntensity.z;var coatAbsorption=vec3f(1.0);if (coat_weight>0.0) {slab_coat_ibl=coatEnvironmentLight*uniforms.vLightingIntensity.z;let hemisphere_avg_fresnel: f32=coatReflectance.F0+0.5f*(1.0f-coatReflectance.F0);var averageReflectance: f32=(coatIblFresnel+hemisphere_avg_fresnel)*0.5f;let roughnessFactor=1.0f-coat_roughness*0.5f;averageReflectance*=roughnessFactor;var darkened_transmission: f32=(1.0f-averageReflectance)*(1.0f-averageReflectance);darkened_transmission=mix(1.0,darkened_transmission,coat_darkening);var sin2: f32=1.0f-coatGeoInfo.NdotV*coatGeoInfo.NdotV;sin2=sin2/(coat_ior*coat_ior);let cos_t: f32=sqrt(1.0f-sin2);let coatPathLength=1.0f/cos_t;let colored_transmission: vec3f=pow(coat_color,vec3f(coatPathLength));coatAbsorption=mix(vec3f(1.0f),colored_transmission*vec3f(darkened_transmission),coat_weight);} +#ifdef FUZZ +let slab_fuzz_ibl=fuzzEnvironmentLight*uniforms.vLightingIntensity.z; +#endif +var slab_subsurface_ibl: vec3f=vec3f(0.,0.,0.);var slab_translucent_base_ibl: vec3f=vec3f(0.,0.,0.);slab_diffuse_ibl*=base_color.rgb; +#define CUSTOM_FRAGMENT_BEFORE_IBLLAYERCOMPOSITION +let material_opaque_base_ibl: vec3f=mix(slab_diffuse_ibl,slab_subsurface_ibl,subsurface_weight);let material_dielectric_base_ibl: vec3f=mix(material_opaque_base_ibl,slab_translucent_base_ibl,transmission_weight);let material_dielectric_gloss_ibl: vec3f=material_dielectric_base_ibl*(1.0-dielectricIblFresnel)+slab_glossy_ibl*dielectricIblColoredFresnel;let material_base_substrate_ibl: vec3f=mix(material_dielectric_gloss_ibl,slab_metal_ibl,base_metalness);let material_coated_base_ibl: vec3f=layer(material_base_substrate_ibl,slab_coat_ibl,coatIblFresnel,coatAbsorption,vec3f(1.0f)); +#ifdef FUZZ +material_surface_ibl=layer(material_coated_base_ibl,slab_fuzz_ibl,fuzzIblFresnel*fuzz_weight,vec3(1.0),fuzz_color); +#else +material_surface_ibl=material_coated_base_ibl; +#endif +#endif +`;e.IncludesShadersStoreWGSL[g]||(e.IncludesShadersStoreWGSL[g]=x);const v="openpbrDirectLightingInit",P=`#ifdef LIGHT{X} +var preInfo{X}: preLightingInfo;var preInfoCoat{X}: preLightingInfo;let lightColor{X}: vec4f=light{X}.vLightDiffuse;var shadow{X}: f32=1.0f; +#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X}) +#else +#define CUSTOM_LIGHT{X}_COLOR +#ifdef SPOTLIGHT{X} +preInfo{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW);preInfoCoat{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW,vPositionW); +#elif defined(POINTLIGHT{X}) +preInfo{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW,vPositionW);preInfoCoat{X}=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW,vPositionW); +#elif defined(HEMILIGHT{X}) +preInfo{X}=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);preInfoCoat{X}=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW); +#elif defined(DIRLIGHT{X}) +preInfo{X}=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);preInfoCoat{X}=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,coatNormalW); +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +preInfo{X}=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,normalW,vPositionW,light{X}.vLightData,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,specular_roughness);preInfoCoat{X}=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,coatNormalW,vPositionW,light{X}.vLightData,light{X}.vLightWidth.xyz,light{X}.vLightHeight.xyz,coat_roughness); +#endif +preInfo{X}.NdotV=baseGeoInfo.NdotV;preInfoCoat{X}.NdotV=coatGeoInfo.NdotV; +#ifdef SPOTLIGHT{X} +#ifdef LIGHT_FALLOFF_GLTF{X} +preInfo{X}.attenuation=computeDistanceLightFalloff_GLTF(preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.y); +#ifdef IESLIGHTTEXTURE{X} +preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X}); +#else +preInfo{X}.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w); +#endif +#elif defined(LIGHT_FALLOFF_PHYSICAL{X}) +preInfo{X}.attenuation=computeDistanceLightFalloff_Physical(preInfo{X}.lightDistanceSquared); +#ifdef IESLIGHTTEXTURE{X} +preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X}); +#else +preInfo{X}.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightDirection.w); +#endif +#elif defined(LIGHT_FALLOFF_STANDARD{X}) +preInfo{X}.attenuation=computeDistanceLightFalloff_Standard(preInfo{X}.lightOffset,light{X}.vLightFalloff.x); +#ifdef IESLIGHTTEXTURE{X} +preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X}); +#else +preInfo{X}.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightDirection.w,light{X}.vLightData.w); +#endif +#else +preInfo{X}.attenuation=computeDistanceLightFalloff(preInfo{X}.lightOffset,preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y); +#ifdef IESLIGHTTEXTURE{X} +preInfo{X}.attenuation*=computeDirectionalLightFalloff_IES(light{X}.vLightDirection.xyz,preInfo{X}.L,iesLightTexture{X}); +#else +preInfo{X}.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo{X}.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w); +#endif +#endif +#elif defined(POINTLIGHT{X}) +#ifdef LIGHT_FALLOFF_GLTF{X} +preInfo{X}.attenuation=computeDistanceLightFalloff_GLTF(preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.y); +#elif defined(LIGHT_FALLOFF_PHYSICAL{X}) +preInfo{X}.attenuation=computeDistanceLightFalloff_Physical(preInfo{X}.lightDistanceSquared); +#elif defined(LIGHT_FALLOFF_STANDARD{X}) +preInfo{X}.attenuation=computeDistanceLightFalloff_Standard(preInfo{X}.lightOffset,light{X}.vLightFalloff.x); +#else +preInfo{X}.attenuation=computeDistanceLightFalloff(preInfo{X}.lightOffset,preInfo{X}.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y); +#endif +#else +preInfo{X}.attenuation=1.0f; +#endif +preInfoCoat{X}.attenuation=preInfo{X}.attenuation; +#if defined(HEMILIGHT{X}) +preInfo{X}.roughness=specular_roughness;preInfoCoat{X}.roughness=coat_roughness; +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +preInfo{X}.roughness=specular_roughness;preInfoCoat{X}.roughness=coat_roughness; +#else +preInfo{X}.roughness=adjustRoughnessFromLightProperties(specular_roughness,light{X}.vLightSpecular.a,preInfo{X}.lightDistance);preInfoCoat{X}.roughness=adjustRoughnessFromLightProperties(coat_roughness,light{X}.vLightSpecular.a,preInfoCoat{X}.lightDistance); +#endif +preInfo{X}.diffuseRoughness=base_diffuse_roughness;preInfo{X}.surfaceAlbedo=base_color.rgb; +#endif +#endif +`;e.IncludesShadersStoreWGSL[v]||(e.IncludesShadersStoreWGSL[v]=P);const I="openpbrDirectLighting",z=`#ifdef LIGHT{X} +{var slab_diffuse: vec3f=vec3f(0.f,0.f,0.f);var slab_subsurface: vec3f=vec3f(0.f,0.f,0.f);var slab_translucent: vec3f=vec3f(0.f,0.f,0.f);var slab_glossy: vec3f=vec3f(0.f,0.f,0.f);var specularFresnel: f32=0.0f;var specularColoredFresnel: vec3f=vec3f(0.f,0.f,0.f);var slab_metal: vec3f=vec3f(0.f,0.f,0.f);var slab_coat: vec3f=vec3f(0.f,0.f,0.f);var coatFresnel: f32=0.0f;var slab_fuzz: vec3f=vec3f(0.f,0.f,0.f);var fuzzFresnel: f32=0.0f; +#ifdef HEMILIGHT{X} +slab_diffuse=computeHemisphericDiffuseLighting(preInfo{X},lightColor{X}.rgb,light{X}.vLightGround); +#elif defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +slab_diffuse=computeAreaDiffuseLighting(preInfo{X},lightColor{X}.rgb); +#else +slab_diffuse=computeDiffuseLighting(preInfo{X},lightColor{X}.rgb); +#endif +#ifdef PROJECTEDLIGHTTEXTURE{X} +slab_diffuse*=computeProjectionTextureDiffuseLighting(projectionLightTexture{X},textureProjectionMatrix{X},vPositionW); +#endif +numLights+=1.0f; +#ifdef FUZZ +let fuzzNdotH: f32=max(dot(fuzzNormalW,preInfo{X}.H),0.0f);let fuzzBrdf: vec3f=getFuzzBRDFLookup(fuzzNdotH,sqrt(fuzz_roughness)); +#endif +#ifdef THIN_FILM +let thin_film_desaturation_scale: f32=(thin_film_ior-1.0f)*sqrt(thin_film_thickness*0.001f); +#endif +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +slab_glossy=computeAreaSpecularLighting(preInfo{X},light{X}.vLightSpecular.rgb,baseConductorReflectance.F0,baseConductorReflectance.F90); +#else +{ +#ifdef ANISOTROPIC_BASE +slab_glossy=computeAnisotropicSpecularLighting(preInfo{X},viewDirectionW,normalW, +baseGeoInfo.anisotropicTangent,baseGeoInfo.anisotropicBitangent,baseGeoInfo.anisotropy, +0.0f,lightColor{X}.rgb); +#else +slab_glossy=computeSpecularLighting(preInfo{X},normalW,vec3(1.0),vec3(1.0),specular_roughness,lightColor{X}.rgb); +#endif +let NdotH: f32=dot(normalW,preInfo{X}.H);specularFresnel=fresnelSchlickGGX(NdotH,baseDielectricReflectance.F0,baseDielectricReflectance.F90);specularColoredFresnel=specularFresnel*specular_color; +#ifdef THIN_FILM +let thinFilmIorScale: f32=clamp(2.0f*abs(thin_film_ior-1.0f),0.0f,1.0f);var thinFilmDielectricFresnel: vec3f=evalIridescence(thin_film_outside_ior,thin_film_ior,preInfo{X}.VdotH,thin_film_thickness,baseDielectricReflectance.coloredF0);thinFilmDielectricFresnel=mix(thinFilmDielectricFresnel,vec3f(dot(thinFilmDielectricFresnel,vec3f(0.3333f))),thin_film_desaturation_scale);specularColoredFresnel=mix(specularColoredFresnel,thinFilmDielectricFresnel*specular_color,thin_film_weight*thinFilmIorScale); +#endif +} +#endif +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +slab_metal=computeAreaSpecularLighting(preInfo{X},light{X}.vLightSpecular.rgb,baseConductorReflectance.F0,baseConductorReflectance.F90); +#else +{ +#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) +var coloredFresnel: vec3f=getF82Specular(preInfo{X}.VdotH,baseConductorReflectance.coloredF0,baseConductorReflectance.coloredF90,specular_roughness); +#else +var coloredFresnel: vec3f=fresnelSchlickGGX(preInfo{X}.VdotH,baseConductorReflectance.coloredF0,baseConductorReflectance.coloredF90); +#endif +#ifdef THIN_FILM +let thinFilmIorScale: f32=clamp(2.0f*abs(thin_film_ior-1.0f),0.0f,1.0f);var thinFilmConductorFresnel=evalIridescence(thin_film_outside_ior,thin_film_ior,preInfo{X}.VdotH,thin_film_thickness,baseConductorReflectance.coloredF0);thinFilmConductorFresnel=mix(thinFilmConductorFresnel,vec3f(dot(thinFilmConductorFresnel,vec3f(0.3333f))),thin_film_desaturation_scale);coloredFresnel=mix(coloredFresnel,specular_weight*thinFilmIorScale*thinFilmConductorFresnel,thin_film_weight); +#endif +#ifdef ANISOTROPIC_BASE +slab_metal=computeAnisotropicSpecularLighting(preInfo{X},viewDirectionW,normalW,baseGeoInfo.anisotropicTangent,baseGeoInfo.anisotropicBitangent,baseGeoInfo.anisotropy,0.0,lightColor{X}.rgb); +#else +slab_metal=computeSpecularLighting(preInfo{X},normalW,vec3f(baseConductorReflectance.coloredF0),coloredFresnel,specular_roughness,lightColor{X}.rgb); +#endif +} +#endif +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +slab_coat=computeAreaSpecularLighting(preInfoCoat{X},light{X}.vLightSpecular.rgb,coatReflectance.F0,coatReflectance.F90); +#else +{ +#ifdef ANISOTROPIC_COAT +slab_coat=computeAnisotropicSpecularLighting(preInfoCoat{X},viewDirectionW,coatNormalW, +coatGeoInfo.anisotropicTangent,coatGeoInfo.anisotropicBitangent,coatGeoInfo.anisotropy,0.0, +lightColor{X}.rgb); +#else +slab_coat=computeSpecularLighting(preInfoCoat{X},coatNormalW,vec3f(coatReflectance.F0),vec3f(1.0f),coat_roughness,lightColor{X}.rgb); +#endif +let NdotH: f32=dot(coatNormalW,preInfoCoat{X}.H);coatFresnel=fresnelSchlickGGX(NdotH,coatReflectance.F0,coatReflectance.F90);} +#endif +var coatAbsorption=vec3f(1.0f);if (coat_weight>0.0) {let cosTheta_view: f32=max(preInfoCoat{X}.NdotV,0.001f);let cosTheta_light: f32=max(preInfoCoat{X}.NdotL,0.001f);let fresnel_view: f32=coatReflectance.F0+(1.0f-coatReflectance.F0)*pow(1.0f-cosTheta_view,5.0);let fresnel_light: f32=coatReflectance.F0+(1.0f-coatReflectance.F0)*pow(1.0f-cosTheta_light,5.0);let averageReflectance: f32=(fresnel_view+fresnel_light)*0.5;var darkened_transmission: f32=(1.0f-averageReflectance)/(1.0f+averageReflectance);darkened_transmission=mix(1.0f,darkened_transmission,coat_darkening);var sin2: f32=1.0f-coatGeoInfo.NdotV*coatGeoInfo.NdotV;sin2=sin2/(coat_ior*coat_ior);let cos_t: f32=sqrt(1.0f-sin2);let coatPathLength=1.0f/cos_t;let colored_transmission: vec3f=pow(coat_color,vec3f(coatPathLength));coatAbsorption=mix(vec3f(1.0f),colored_transmission*vec3f(darkened_transmission),coat_weight);} +#ifdef FUZZ +fuzzFresnel=fuzzBrdf.z;let fuzzNormalW=mix(normalW,coatNormalW,coat_weight);let fuzzNdotV: f32=max(dot(fuzzNormalW,viewDirectionW.xyz),0.0f);let fuzzNdotL: f32=max(dot(fuzzNormalW,preInfo{X}.L),0.0);slab_fuzz=lightColor{X}.rgb*preInfo{X}.attenuation*evalFuzz(preInfo{X}.L,fuzzNdotL,fuzzNdotV,fuzzTangent,fuzzBitangent,fuzzBrdf); +#else +let fuzz_color=vec3f(0.0); +#endif +slab_diffuse*=base_color.rgb;let material_opaque_base: vec3f=mix(slab_diffuse,slab_subsurface,subsurface_weight);let material_dielectric_base: vec3f=mix(material_opaque_base,slab_translucent,transmission_weight);let material_dielectric_gloss: vec3f=material_dielectric_base*(1.0f-specularFresnel)+slab_glossy*specularColoredFresnel;let material_base_substrate: vec3f=mix(material_dielectric_gloss,slab_metal,base_metalness);let material_coated_base: vec3f=layer(material_base_substrate,slab_coat,coatFresnel,coatAbsorption,vec3f(1.0f));material_surface_direct+=layer(material_coated_base,slab_fuzz,fuzzFresnel*fuzz_weight,vec3f(1.0f),fuzz_color);} +#endif +`;e.IncludesShadersStoreWGSL[I]||(e.IncludesShadersStoreWGSL[I]=z);const r="openpbrPixelShader",E=`#define OPENPBR_FRAGMENT_SHADER +#define CUSTOM_FRAGMENT_BEGIN +#include[SCENE_MRT_COUNT] +#include +#ifndef FROMLINEARSPACE +#define FROMLINEARSPACE +#endif +#include +#include +#include[0..maxSimultaneousLights] +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef REFLECTION +#include +#endif +#define CUSTOM_FRAGMENT_DEFINITIONS +#include +#include +#include +#include +#include +fn layer(slab_bottom: vec3f,slab_top: vec3f,lerp_factor: f32,bottom_multiplier: vec3f,top_multiplier: vec3f)->vec3f {return mix(slab_bottom*bottom_multiplier,slab_top*top_multiplier,lerp_factor);} +@fragment +fn main(input: FragmentInputs)->FragmentOutputs { +#define CUSTOM_FRAGMENT_MAIN_BEGIN +#include +#include +var coatNormalW: vec3f=normalW; +#include +#include +#include +#include +#include +#include +var subsurface_weight: f32=0.0f;var transmission_weight: f32=0.0f; +#define CUSTOM_FRAGMENT_UPDATE_ALPHA +#include +#define CUSTOM_FRAGMENT_BEFORE_LIGHTS +var aoOut: ambientOcclusionOutParams; +#ifdef AMBIENT_OCCLUSION +var ambientOcclusionFromTexture: vec3f=textureSample(ambientOcclusionSampler,ambientOcclusionSamplerSampler,fragmentInputs.vAmbientOcclusionUV+uvOffset).rgb; +#endif +aoOut=ambientOcclusionBlock( +#ifdef AMBIENT_OCCLUSION +ambientOcclusionFromTexture, +uniforms.vAmbientOcclusionInfos +#endif +); +#ifdef ANISOTROPIC_COAT +let coatGeoInfo: geometryInfoAnisoOutParams=geometryInfoAniso( +coatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW +,vec3f(geometry_coat_tangent.x,geometry_coat_tangent.y,coat_roughness_anisotropy),TBN +); +#else +let coatGeoInfo: geometryInfoOutParams=geometryInfo( +coatNormalW,viewDirectionW.xyz,coat_roughness,geometricNormalW +); +#endif +specular_roughness=mix(specular_roughness,pow(min(1.0f,pow(specular_roughness,4.0f)+2.0f*pow(coat_roughness,4.0f)),0.25f),coat_weight); +#ifdef ANISOTROPIC_BASE +let baseGeoInfo: geometryInfoAnisoOutParams=geometryInfoAniso( +normalW,viewDirectionW.xyz,specular_roughness,geometricNormalW +,vec3f(geometry_tangent.x,geometry_tangent.y,specular_roughness_anisotropy),TBN +); +#else +let baseGeoInfo: geometryInfoOutParams=geometryInfo( +normalW,viewDirectionW.xyz,specular_roughness,geometricNormalW +); +#endif +#ifdef FUZZ +let fuzzNormalW=normalize(mix(normalW,coatNormalW,coat_weight));var fuzzTangent=normalize(TBN[0]);fuzzTangent=normalize(fuzzTangent-dot(fuzzTangent,fuzzNormalW)*fuzzNormalW);let fuzzBitangent=cross(fuzzNormalW,fuzzTangent);let fuzzGeoInfo: geometryInfoOutParams=geometryInfo( +fuzzNormalW,viewDirectionW.xyz,fuzz_roughness,geometricNormalW +); +#endif +let coatReflectance: ReflectanceParams=dielectricReflectance( +coat_ior +,1.0f +,vec3f(1.0f) +,coat_weight +); +#ifdef THIN_FILM +let thin_film_outside_ior: f32=mix(1.0f,coat_ior,coat_weight); +#endif +let baseDielectricReflectance: ReflectanceParams=dielectricReflectance( +specular_ior +,mix(1.0f,coat_ior,coat_weight) +,specular_color +,specular_weight +);let baseConductorReflectance: ReflectanceParams=conductorReflectance(base_color,specular_color,specular_weight);var material_surface_ibl: vec3f=vec3f(0.f,0.f,0.f); +#include +var material_surface_direct: vec3f=vec3f(0.f,0.f,0.f); +#if defined(LIGHT0) +var aggShadow: f32=0.f;var numLights: f32=0.f; +#include[0..maxSimultaneousLights] +#include[0..maxSimultaneousLights] +#endif +var material_surface_emission: vec3f=uniforms.vEmissionColor; +#ifdef EMISSION_COLOR +let emissionColorTex: vec3f=textureSample(emissionColorSampler,emissionColorSamplerSampler,uniforms.vEmissionColorUV+uvOffset).rgb; +#ifdef EMISSION_COLOR_GAMMA +material_surface_emission*=toLinearSpace(emissionColorTex.rgb); +#else +material_surface_emission*=emissionColorTex.rgb; +#endif +material_surface_emission*= uniforms.vEmissionColorInfos.y; +#endif +material_surface_emission*=uniforms.vLightingIntensity.y; +#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION +var finalColor: vec4f=vec4f(material_surface_ibl+material_surface_direct+material_surface_emission,alpha); +#define CUSTOM_FRAGMENT_BEFORE_FOG +finalColor=max(finalColor,vec4f(0.0)); +#include +#include(color,finalColor) +#include +#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR +#ifdef PREPASS +#include +#endif +#if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY) +fragmentOutputs.color=finalColor; +#endif +#include +#if ORDER_INDEPENDENT_TRANSPARENCY +if (fragDepth==nearestDepth) {fragmentOutputs.frontColor=vec4f(fragmentOutputs.frontColor.rgb+finalColor.rgb*finalColor.a*alphaMultiplier,1.0-alphaMultiplier*(1.0-finalColor.a));} else {fragmentOutputs.backColor+=finalColor;} +#endif +#include +#define CUSTOM_FRAGMENT_MAIN_END +} +`;e.ShadersStoreWGSL[r]||(e.ShadersStoreWGSL[r]=E);const re={name:r,shader:E};export{re as openpbrPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbr.vertex-D6UaDo0k.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbr.vertex-D6UaDo0k.js new file mode 100644 index 0000000000000000000000000000000000000000..240d543157618664303ef0d0d3d1382d8a5807cd --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbr.vertex-D6UaDo0k.js @@ -0,0 +1,320 @@ +import{S as e}from"./index-CDrXokXW.js";import"./vertexColorMixing-DUmDzlXI.js";import"./openpbrUboDeclaration-DTjWMuUO.js";import"./mainUVVaryingDeclaration-CYLIf35n.js";import"./helperFunctions-BkWNqKeI.js";import"./pbrBRDFFunctions-BEHyjaG2.js";import"./bakedVertexAnimation-BwUJBnNt.js";import"./instancesDeclaration-BAnfKLCo.js";import"./harmonicsFunctions-O6-VFzXR.js";import"./clipPlaneVertex-Bmw4TNCQ.js";import"./logDepthVertex-DDooPwab.js";import"./shadowsVertex-DbGd-etA.js";import"./morphTargetsVertex-7Q90Wwr8.js";import"./logDepthDeclaration-DbMKMukk.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./meshUboDeclaration-C6raEdzf.js";const n="openpbrVertexDeclaration",a=`uniform mat4 view;uniform mat4 viewProjection;uniform vec4 vEyePosition; +#ifdef MULTIVIEW +mat4 viewProjectionR; +#endif +#ifdef BASE_COLOR +uniform vec2 vBaseColorInfos;uniform mat4 baseColorMatrix; +#endif +#ifdef BASE_WEIGHT +uniform mat4 baseWeightMatrix;uniform vec2 vBaseWeightInfos; +#endif +uniform float vBaseDiffuseRoughness; +#ifdef BASE_DIFFUSE_ROUGHNESS +uniform mat4 baseDiffuseRoughnessMatrix;uniform vec2 vBaseDiffuseRoughnessInfos; +#endif +#ifdef AMBIENT_OCCLUSION +uniform vec2 vAmbientOcclusionInfos;uniform mat4 ambientOcclusionMatrix; +#endif +#ifdef EMISSION_COLOR +uniform vec2 vEmissionColorInfos;uniform mat4 emissionColorMatrix; +#endif +#ifdef LIGHTMAP +uniform vec2 vLightmapInfos;uniform mat4 lightmapMatrix; +#endif +#ifdef BASE_METALNESS +uniform vec2 vBaseMetalnessInfos;uniform mat4 baseMetalnessMatrix; +#endif +#ifdef SPECULAR_WEIGHT +uniform vec2 vSpecularWeightInfos;uniform mat4 specularWeightMatrix; +#endif +#ifdef SPECULAR_COLOR +uniform vec2 vSpecularColorInfos;uniform mat4 specularColorMatrix; +#endif +#ifdef SPECULAR_ROUGHNESS +uniform vec2 vSpecularRoughnessInfos;uniform mat4 specularRoughnessMatrix; +#endif +#ifdef SPECULAR_ROUGHNESS_ANISOTROPY +uniform vec2 vSpecularRoughnessAnisotropyInfos;uniform mat4 specularRoughnessAnisotropyMatrix; +#endif +#ifdef COAT_WEIGHT +uniform vec2 vCoatWeightInfos;uniform mat4 coatWeightMatrix; +#endif +#ifdef COAT_COLOR +uniform vec2 vCoatColorInfos;uniform mat4 coatColorMatrix; +#endif +#ifdef COAT_ROUGHNESS +uniform vec2 vCoatRoughnessInfos;uniform mat4 coatRoughnessMatrix; +#endif +#ifdef COAT_ROUGHNESS_ANISOTROPY +uniform vec2 vCoatRoughnessAnisotropyInfos;uniform mat4 coatRoughnessAnisotropyMatrix; +#endif +#ifdef COAT_IOR +uniform vec2 vCoatIorInfos;uniform mat4 coatIorMatrix; +#endif +#ifdef COAT_DARKENING +uniform vec2 vCoatDarkeningInfos;uniform mat4 coatDarkeningMatrix; +#endif +#ifdef FUZZ_WEIGHT +uniform vec2 vFuzzWeightInfos;uniform mat4 fuzzWeightMatrix; +#endif +#ifdef FUZZ_COLOR +uniform vec2 vFuzzColorInfos;uniform mat4 fuzzColorMatrix; +#endif +#ifdef FUZZ_ROUGHNESS +uniform vec2 vFuzzRoughnessInfos;uniform mat4 fuzzRoughnessMatrix; +#endif +#ifdef GEOMETRY_NORMAL +uniform vec2 vGeometryNormalInfos;uniform mat4 geometryNormalMatrix; +#endif +#ifdef GEOMETRY_TANGENT +uniform vec2 vGeometryTangentInfos;uniform mat4 geometryTangentMatrix; +#endif +#ifdef GEOMETRY_COAT_NORMAL +uniform vec2 vGeometryCoatNormalInfos;uniform mat4 geometryCoatNormalMatrix; +#endif +#ifdef THIN_FILM_WEIGHT +uniform vec2 vThinFilmWeightInfos;uniform mat4 thinFilmWeightMatrix; +#endif +#ifdef THIN_FILM_THICKNESS +uniform vec2 vThinFilmThicknessInfos;uniform mat4 thinFilmThicknessMatrix; +#endif +#ifdef GEOMETRY_OPACITY +uniform mat4 geometryOpacityMatrix;uniform vec2 vGeometryOpacityInfos; +#endif +#ifdef POINTSIZE +uniform float pointSize; +#endif +uniform vec4 cameraInfo; +#ifdef REFLECTION +uniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix; +#endif +#ifdef NORMAL +#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX) +#ifdef USESPHERICALFROMREFLECTIONMAP +#ifdef SPHERICAL_HARMONICS +uniform vec3 vSphericalL00;uniform vec3 vSphericalL1_1;uniform vec3 vSphericalL10;uniform vec3 vSphericalL11;uniform vec3 vSphericalL2_2;uniform vec3 vSphericalL2_1;uniform vec3 vSphericalL20;uniform vec3 vSphericalL21;uniform vec3 vSphericalL22; +#else +uniform vec3 vSphericalX;uniform vec3 vSphericalY;uniform vec3 vSphericalZ;uniform vec3 vSphericalXX_ZZ;uniform vec3 vSphericalYY_ZZ;uniform vec3 vSphericalZZ;uniform vec3 vSphericalXY;uniform vec3 vSphericalYZ;uniform vec3 vSphericalZX; +#endif +#endif +#endif +#endif +#ifdef DETAIL +uniform vec4 vDetailInfos;uniform mat4 detailMatrix; +#endif +#include +#define ADDITIONAL_VERTEX_DECLARATION +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=a);const o="openpbrNormalMapVertexDeclaration",E=`#if defined(GEOMETRY_NORMAL) || defined(PARALLAX) || defined(GEOMETRY_COAT_NORMAL) || defined(ANISOTROPIC) || defined(FUZZ) +#if defined(TANGENT) && defined(NORMAL) +varying mat3 vTBN; +#endif +#endif +`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=E);const r="openpbrNormalMapVertex",_=`#if defined(GEOMETRY_NORMAL) || defined(PARALLAX) || defined(GEOMETRY_COAT_NORMAL) || defined(ANISOTROPIC) || defined(FUZZ) +#if defined(TANGENT) && defined(NORMAL) +vec3 tbnNormal=normalize(normalUpdated);vec3 tbnTangent=normalize(tangentUpdated.xyz);vec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;vTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal); +#endif +#endif +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=_);const i="openpbrVertexShader",t=`#define OPENPBR_VERTEX_SHADER +#define CUSTOM_VERTEX_EXTENSION +precision highp float; +#include<__decl__openpbrVertex> +#define CUSTOM_VERTEX_BEGIN +attribute vec3 position; +#ifdef NORMAL +attribute vec3 normal; +#endif +#ifdef TANGENT +attribute vec4 tangent; +#endif +#ifdef UV1 +attribute vec2 uv; +#endif +#include[2..7] +#include[1..7] +#ifdef VERTEXCOLOR +attribute vec4 color; +#endif +#include +#include +#include +#include +#include +#include +#include(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor) +#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight) +#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness) +#include(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness) +#include(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight) +#include(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor) +#include(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness) +#include(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy) +#include(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight) +#include(_DEFINENAME_,COAT_COLOR,_VARYINGNAME_,CoatColor) +#include(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness) +#include(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy) +#include(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening) +#include(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight) +#include(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor) +#include(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness) +#include(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal) +#include(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent) +#include(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal) +#include(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity) +#include(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor) +#include(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight) +#include(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness) +#include(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail) +varying vec3 vPositionW; +#if DEBUGMODE>0 +varying vec4 vClipSpacePosition; +#endif +#ifdef NORMAL +varying vec3 vNormalW; +#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX) +varying vec3 vEnvironmentIrradiance; +#include +#endif +#endif +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +varying vec4 vColor; +#endif +#include +#include +#include +#include<__decl__lightVxFragment>[0..maxSimultaneousLights] +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef REFLECTIONMAP_SKYBOX +varying vec3 vPositionUVW; +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vec3 vDirectionW; +#endif +#include +#define CUSTOM_VERTEX_DEFINITIONS +void main(void) { +#define CUSTOM_VERTEX_MAIN_BEGIN +vec3 positionUpdated=position; +#ifdef NORMAL +vec3 normalUpdated=normal; +#endif +#ifdef TANGENT +vec4 tangentUpdated=tangent; +#endif +#ifdef UV1 +vec2 uvUpdated=uv; +#endif +#ifdef UV2 +vec2 uv2Updated=uv2; +#endif +#ifdef VERTEXCOLOR +vec4 colorUpdated=color; +#endif +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef REFLECTIONMAP_SKYBOX +vPositionUVW=positionUpdated; +#endif +#define CUSTOM_VERTEX_UPDATE_POSITION +#define CUSTOM_VERTEX_UPDATE_NORMAL +#include +#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED) +vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0); +#endif +#include +#include +vec4 worldPos=finalWorld*vec4(positionUpdated,1.0);vPositionW=vec3(worldPos); +#ifdef PREPASS +#include +#endif +#ifdef NORMAL +mat3 normalWorld=mat3(finalWorld); +#if defined(INSTANCES) && defined(THIN_INSTANCES) +vNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vNormalW=normalize(normalWorld*vNormalW); +#else +#ifdef NONUNIFORMSCALING +normalWorld=transposeMat3(inverseMat3(normalWorld)); +#endif +vNormalW=normalize(normalWorld*normalUpdated); +#endif +#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX) +#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY +vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW); +#if !defined(NATIVE) && !defined(WEBGPU) +bool bbb=any(isnan(position));if (bbb) { } +#endif +float NdotV=max(dot(vNormalW,viewDirectionW),0.0);vec3 roughNormal=mix(vNormalW,viewDirectionW,(0.5*(1.0-NdotV))*vBaseDiffuseRoughness);vec3 reflectionVector=vec3(reflectionMatrix*vec4(roughNormal,0)).xyz; +#else +vec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz; +#endif +#ifdef REFLECTIONMAP_OPPOSITEZ +reflectionVector.z*=-1.0; +#endif +vEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector); +#endif +#endif +#define CUSTOM_VERTEX_UPDATE_WORLDPOS +#ifdef MULTIVIEW +if (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;} +#else +gl_Position=viewProjection*worldPos; +#endif +#if DEBUGMODE>0 +vClipSpacePosition=gl_Position; +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +vDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0))); +#endif +#ifndef UV1 +vec2 uvUpdated=vec2(0.,0.); +#endif +#ifndef UV2 +vec2 uv2Updated=vec2(0.,0.); +#endif +#ifdef MAINUV1 +vMainUV1=uvUpdated; +#endif +#ifdef MAINUV2 +vMainUV2=uv2Updated; +#endif +#include[3..7] +#include(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor,_MATRIXNAME_,baseColor,_INFONAME_,BaseColorInfos.x) +#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_MATRIXNAME_,baseWeight,_INFONAME_,BaseWeightInfos.x) +#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_MATRIXNAME_,baseDiffuseRoughness,_INFONAME_,BaseDiffuseRoughnessInfos.x) +#include(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness,_MATRIXNAME_,baseMetalness,_INFONAME_,BaseMetalnessInfos.x) +#include(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight,_MATRIXNAME_,specularWeight,_INFONAME_,SpecularWeightInfos.x) +#include(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor,_MATRIXNAME_,specularColor,_INFONAME_,SpecularColorInfos.x) +#include(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness,_MATRIXNAME_,specularRoughness,_INFONAME_,SpecularRoughnessInfos.x) +#include(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy,_MATRIXNAME_,specularRoughnessAnisotropy,_INFONAME_,SpecularRoughnessAnisotropyInfos.x) +#include(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight,_MATRIXNAME_,coatWeight,_INFONAME_,CoatWeightInfos.x) +#include(_DEFINENAME_,COAT_COLOR,_VARYINGNAME_,CoatColor,_MATRIXNAME_,coatColor,_INFONAME_,CoatColorInfos.x) +#include(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness,_MATRIXNAME_,coatRoughness,_INFONAME_,CoatRoughnessInfos.x) +#include(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy,_MATRIXNAME_,coatRoughnessAnisotropy,_INFONAME_,CoatRoughnessAnisotropyInfos.x) +#include(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening,_MATRIXNAME_,coatDarkening,_INFONAME_,CoatDarkeningInfos.x) +#include(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight,_MATRIXNAME_,fuzzWeight,_INFONAME_,FuzzWeightInfos.x) +#include(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor,_MATRIXNAME_,fuzzColor,_INFONAME_,FuzzColorInfos.x) +#include(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness,_MATRIXNAME_,fuzzRoughness,_INFONAME_,FuzzRoughnessInfos.x) +#include(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal,_MATRIXNAME_,geometryNormal,_INFONAME_,GeometryNormalInfos.x) +#include(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal,_MATRIXNAME_,geometryCoatNormal,_INFONAME_,GeometryCoatNormalInfos.x) +#include(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity,_MATRIXNAME_,geometryOpacity,_INFONAME_,GeometryOpacityInfos.x) +#include(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent,_MATRIXNAME_,geometryTangent,_INFONAME_,GeometryTangentInfos.x) +#include(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor,_MATRIXNAME_,emissionColor,_INFONAME_,EmissionColorInfos.x) +#include(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight,_MATRIXNAME_,thinFilmWeight,_INFONAME_,ThinFilmWeightInfos.x) +#include(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness,_MATRIXNAME_,thinFilmThickness,_INFONAME_,ThinFilmThicknessInfos.x) +#include(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion,_MATRIXNAME_,ambientOcclusion,_INFONAME_,AmbientOcclusionInfos.x) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x) +#include +#include +#include +#include[0..maxSimultaneousLights] +#include +#if defined(POINTSIZE) && !defined(WEBGPU) +gl_PointSize=pointSize; +#endif +#include +#define CUSTOM_VERTEX_MAIN_END +} +`;e.ShadersStore[i]||(e.ShadersStore[i]=t);const V={name:i,shader:t};export{V as openpbrVertexShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbr.vertex-O7ZI4RUT.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbr.vertex-O7ZI4RUT.js new file mode 100644 index 0000000000000000000000000000000000000000..f8b9aafb2f612186a54550d37cea15ff44d0cde8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbr.vertex-O7ZI4RUT.js @@ -0,0 +1,205 @@ +import{S as e}from"./index-CDrXokXW.js";import"./openpbrUboDeclaration-Dw_NcTG6.js";import"./vertexColorMixing-8t5JaWwM.js";import"./mainUVVaryingDeclaration-gz09aLXv.js";import"./helperFunctions-CZpZ-EbL.js";import"./pbrBRDFFunctions-baMKuu65.js";import"./bonesDeclaration-Bh_c0MF7.js";import"./instancesVertex-CO_CTxxp.js";import"./instancesDeclaration-DZdrWbmN.js";import"./harmonicsFunctions-DjLTZRig.js";import"./clipPlaneVertex-J3Krgsee.js";import"./logDepthVertex-D_A6gsii.js";import"./shadowsVertex-CygJ_RUp.js";import"./morphTargetsVertexDeclaration-BsT9JpOT.js";import"./logDepthDeclaration-DkdfQs4e.js";import"./morphTargetsVertex-DcRl6X3j.js";import"./bonesVertex-bl6LLSA1.js";import"./bakedVertexAnimation-DoavwM49.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./meshUboDeclaration-Bk1ASTX2.js";const t="openpbrNormalMapVertexDeclaration",o=`#if defined(GEOMETRY_NORMAL) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(FUZZ) +#if defined(TANGENT) && defined(NORMAL) +varying vTBN0: vec3f;varying vTBN1: vec3f;varying vTBN2: vec3f; +#endif +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=o);const i="openpbrNormalMapVertex",E=`#if defined(GEOMETRY_NORMAL) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(FUZZ) +#if defined(TANGENT) && defined(NORMAL) +var tbnNormal: vec3f=normalize(normalUpdated);var tbnTangent: vec3f=normalize(tangentUpdated.xyz);var tbnBitangent: vec3f=cross(tbnNormal,tbnTangent)*tangentUpdated.w;var matTemp= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz)* mat3x3f(tbnTangent,tbnBitangent,tbnNormal);vertexOutputs.vTBN0=matTemp[0];vertexOutputs.vTBN1=matTemp[1];vertexOutputs.vTBN2=matTemp[2]; +#endif +#endif +`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=E);const n="openpbrVertexShader",r=`#define OPENPBR_VERTEX_SHADER +#include +#define CUSTOM_VERTEX_BEGIN +attribute position: vec3f; +#ifdef NORMAL +attribute normal: vec3f; +#endif +#ifdef TANGENT +attribute tangent: vec4f; +#endif +#ifdef UV1 +attribute uv: vec2f; +#endif +#include[2..7] +#include[1..7] +#ifdef VERTEXCOLOR +attribute color: vec4f; +#endif +#include +#include +#include +#include +#include +#include +#include(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor) +#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight) +#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness) +#include(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness) +#include(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight) +#include(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor) +#include(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness) +#include(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy) +#include(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight) +#include(_DEFINENAME_,COAT_COLOR,_VARYINGNAME_,CoatColor) +#include(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness) +#include(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy) +#include(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening) +#include(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight) +#include(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor) +#include(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness) +#include(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal) +#include(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent) +#include(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal) +#include(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity) +#include(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor) +#include(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight) +#include(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness) +#include(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail) +varying vPositionW: vec3f; +#if DEBUGMODE>0 +varying vClipSpacePosition: vec4f; +#endif +#ifdef NORMAL +varying vNormalW: vec3f; +#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX) +varying vEnvironmentIrradiance: vec3f; +#include +#endif +#endif +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +varying vColor: vec4f; +#endif +#include +#include +#include +#include[0..maxSimultaneousLights] +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef REFLECTIONMAP_SKYBOX +varying vPositionUVW: vec3f; +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vDirectionW: vec3f; +#endif +#include +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs { +#define CUSTOM_VERTEX_MAIN_BEGIN +var positionUpdated: vec3f=vertexInputs.position; +#ifdef NORMAL +var normalUpdated: vec3f=vertexInputs.normal; +#endif +#ifdef TANGENT +var tangentUpdated: vec4f=vertexInputs.tangent; +#endif +#ifdef UV1 +var uvUpdated: vec2f=vertexInputs.uv; +#endif +#ifdef UV2 +var uv2Updated: vec2f=vertexInputs.uv2; +#endif +#ifdef VERTEXCOLOR +var colorUpdated: vec4f=vertexInputs.color; +#endif +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef REFLECTIONMAP_SKYBOX +vertexOutputs.vPositionUVW=positionUpdated; +#endif +#define CUSTOM_VERTEX_UPDATE_POSITION +#define CUSTOM_VERTEX_UPDATE_NORMAL +#include +#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED) +vertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*vec4f(positionUpdated,1.0); +#endif +#include +#include +var worldPos: vec4f=finalWorld* vec4f(positionUpdated,1.0);vertexOutputs.vPositionW= worldPos.xyz; +#ifdef PREPASS +#include +#endif +#ifdef NORMAL +var normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz); +#if defined(INSTANCES) && defined(THIN_INSTANCES) +vertexOutputs.vNormalW=normalUpdated/ vec3f(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vertexOutputs.vNormalW=normalize(normalWorld*vertexOutputs.vNormalW); +#else +#ifdef NONUNIFORMSCALING +normalWorld=transposeMat3(inverseMat3(normalWorld)); +#endif +vertexOutputs.vNormalW=normalize(normalWorld*normalUpdated); +#endif +#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX) +#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY +var viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-vertexOutputs.vPositionW);var NdotV: f32=max(dot(vertexOutputs.vNormalW,viewDirectionW),0.0);var roughNormal: vec3f=mix(vertexOutputs.vNormalW,viewDirectionW,(0.5*(1.0-NdotV))*uniforms.vBaseDiffuseRoughness);var reflectionVector: vec3f= (uniforms.reflectionMatrix* vec4f(roughNormal,0)).xyz; +#else +var reflectionVector: vec3f= (uniforms.reflectionMatrix* vec4f(vertexOutputs.vNormalW,0)).xyz; +#endif +#ifdef REFLECTIONMAP_OPPOSITEZ +reflectionVector.z*=-1.0; +#endif +vertexOutputs.vEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector); +#endif +#endif +#define CUSTOM_VERTEX_UPDATE_WORLDPOS +#ifdef MULTIVIEW +if (gl_ViewID_OVR==0u) {vertexOutputs.position=scene.viewProjection*worldPos;} else {vertexOutputs.position=scene.viewProjectionR*worldPos;} +#else +vertexOutputs.position=scene.viewProjection*worldPos; +#endif +#if DEBUGMODE>0 +vertexOutputs.vClipSpacePosition=vertexOutputs.position; +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +vertexOutputs.vDirectionW=normalize((finalWorld*vec4f(positionUpdated,0.0)).xyz); +#endif +#ifndef UV1 +var uvUpdated: vec2f= vec2f(0.,0.); +#endif +#ifdef MAINUV1 +vertexOutputs.vMainUV1=uvUpdated; +#endif +#ifndef UV2 +var uv2Updated: vec2f= vec2f(0.,0.); +#endif +#ifdef MAINUV2 +vertexOutputs.vMainUV2=uv2Updated; +#endif +#include[3..7] +#include(_DEFINENAME_,BASE_COLOR,_VARYINGNAME_,BaseColor,_MATRIXNAME_,baseColor,_INFONAME_,BaseColorInfos.x) +#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_MATRIXNAME_,baseWeight,_INFONAME_,BaseWeightInfos.x) +#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_MATRIXNAME_,baseDiffuseRoughness,_INFONAME_,BaseDiffuseRoughnessInfos.x) +#include(_DEFINENAME_,BASE_METALNESS,_VARYINGNAME_,BaseMetalness,_MATRIXNAME_,baseMetalness,_INFONAME_,BaseMetalnessInfos.x) +#include(_DEFINENAME_,SPECULAR_WEIGHT,_VARYINGNAME_,SpecularWeight,_MATRIXNAME_,specularWeight,_INFONAME_,SpecularWeightInfos.x) +#include(_DEFINENAME_,SPECULAR_COLOR,_VARYINGNAME_,SpecularColor,_MATRIXNAME_,specularColor,_INFONAME_,SpecularColorInfos.x) +#include(_DEFINENAME_,SPECULAR_ROUGHNESS,_VARYINGNAME_,SpecularRoughness,_MATRIXNAME_,specularRoughness,_INFONAME_,SpecularRoughnessInfos.x) +#include(_DEFINENAME_,SPECULAR_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,SpecularRoughnessAnisotropy,_MATRIXNAME_,specularRoughnessAnisotropy,_INFONAME_,SpecularRoughnessAnisotropyInfos.x) +#include(_DEFINENAME_,COAT_WEIGHT,_VARYINGNAME_,CoatWeight,_MATRIXNAME_,coatWeight,_INFONAME_,CoatWeightInfos.x) +#include(_DEFINENAME_,COAT_COLOR,_VARYNAME_,CoatColor,_MATRIXNAME_,coatColor,_INFONAME_,CoatColorInfos.x) +#include(_DEFINENAME_,COAT_ROUGHNESS,_VARYINGNAME_,CoatRoughness,_MATRIXNAME_,coatRoughness,_INFONAME_,CoatRoughnessInfos.x) +#include(_DEFINENAME_,COAT_ROUGHNESS_ANISOTROPY,_VARYINGNAME_,CoatRoughnessAnisotropy,_MATRIXNAME_,coatRoughnessAnisotropy,_INFONAME_,CoatRoughnessAnisotropyInfos.x) +#include(_DEFINENAME_,COAT_DARKENING,_VARYINGNAME_,CoatDarkening,_MATRIXNAME_,coatDarkening,_INFONAME_,CoatDarkeningInfos.x) +#include(_DEFINENAME_,FUZZ_WEIGHT,_VARYINGNAME_,FuzzWeight,_MATRIXNAME_,fuzzWeight,_INFONAME_,FuzzWeightInfos.x) +#include(_DEFINENAME_,FUZZ_COLOR,_VARYINGNAME_,FuzzColor,_MATRIXNAME_,fuzzColor,_INFONAME_,FuzzColorInfos.x) +#include(_DEFINENAME_,FUZZ_ROUGHNESS,_VARYINGNAME_,FuzzRoughness,_MATRIXNAME_,fuzzRoughness,_INFONAME_,FuzzRoughnessInfos.x) +#include(_DEFINENAME_,GEOMETRY_NORMAL,_VARYINGNAME_,GeometryNormal,_MATRIXNAME_,geometryNormal,_INFONAME_,GeometryNormalInfos.x) +#include(_DEFINENAME_,GEOMETRY_TANGENT,_VARYINGNAME_,GeometryTangent,_MATRIXNAME_,geometryTangent,_INFONAME_,GeometryTangentInfos.x) +#include(_DEFINENAME_,GEOMETRY_COAT_NORMAL,_VARYINGNAME_,GeometryCoatNormal,_MATRIXNAME_,geometryCoatNormal,_INFONAME_,GeometryCoatNormalInfos.x) +#include(_DEFINENAME_,GEOMETRY_OPACITY,_VARYINGNAME_,GeometryOpacity,_MATRIXNAME_,geometryOpacity,_INFONAME_,GeometryOpacityInfos.x) +#include(_DEFINENAME_,EMISSION_COLOR,_VARYINGNAME_,EmissionColor,_MATRIXNAME_,emissionColor,_INFONAME_,EmissionColorInfos.x) +#include(_DEFINENAME_,THIN_FILM_WEIGHT,_VARYINGNAME_,ThinFilmWeight,_MATRIXNAME_,thinFilmWeight,_INFONAME_,ThinFilmWeightInfos.x) +#include(_DEFINENAME_,THIN_FILM_THICKNESS,_VARYINGNAME_,ThinFilmThickness,_MATRIXNAME_,thinFilmThickness,_INFONAME_,ThinFilmThicknessInfos.x) +#include(_DEFINENAME_,AMBIENT_OCCLUSION,_VARYINGNAME_,AmbientOcclusion,_MATRIXNAME_,ambientOcclusion,_INFONAME_,AmbientOcclusionInfos.x) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x) +#include +#include +#include +#include[0..maxSimultaneousLights] +#include +#include +#define CUSTOM_VERTEX_MAIN_END +}`;e.ShadersStoreWGSL[n]||(e.ShadersStoreWGSL[n]=r);const S={name:n,shader:r};export{S as openpbrVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbrMaterial-527Jzq5y.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbrMaterial-527Jzq5y.js new file mode 100644 index 0000000000000000000000000000000000000000..e7114061ee23a3c35104462a8f15a2a33328f927 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbrMaterial-527Jzq5y.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./openpbr.vertex-O7ZI4RUT.js","./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./openpbrUboDeclaration-Dw_NcTG6.js","./sceneUboDeclaration-BH1tZjjY.js","./meshUboDeclaration-Bk1ASTX2.js","./vertexColorMixing-8t5JaWwM.js","./mainUVVaryingDeclaration-gz09aLXv.js","./helperFunctions-CZpZ-EbL.js","./pbrBRDFFunctions-baMKuu65.js","./bonesDeclaration-Bh_c0MF7.js","./instancesVertex-CO_CTxxp.js","./instancesDeclaration-DZdrWbmN.js","./harmonicsFunctions-DjLTZRig.js","./clipPlaneVertex-J3Krgsee.js","./logDepthVertex-D_A6gsii.js","./shadowsVertex-CygJ_RUp.js","./morphTargetsVertexDeclaration-BsT9JpOT.js","./logDepthDeclaration-DkdfQs4e.js","./morphTargetsVertex-DcRl6X3j.js","./bonesVertex-bl6LLSA1.js","./bakedVertexAnimation-DoavwM49.js","./openpbr.fragment-DZlw1Ils.js","./oitFragment-BcbCWH3V.js","./pbrDebug-FlFed75Q.js","./shadowsFragmentFunctions-CTsFFgyf.js","./samplerFragmentDeclaration-cxB-jdDJ.js","./imageProcessingFunctions-BbtoaTge.js","./clipPlaneFragment-C7XUrTAZ.js","./fogFragment-DmA8Y7To.js","./hdrFilteringFunctions-DD5EqJpN.js","./openpbr.vertex-D6UaDo0k.js","./vertexColorMixing-DUmDzlXI.js","./openpbrUboDeclaration-DTjWMuUO.js","./sceneUboDeclaration-C4vXUqkq.js","./meshUboDeclaration-C6raEdzf.js","./mainUVVaryingDeclaration-CYLIf35n.js","./helperFunctions-BkWNqKeI.js","./pbrBRDFFunctions-BEHyjaG2.js","./bakedVertexAnimation-BwUJBnNt.js","./instancesDeclaration-BAnfKLCo.js","./harmonicsFunctions-O6-VFzXR.js","./clipPlaneVertex-Bmw4TNCQ.js","./logDepthVertex-DDooPwab.js","./shadowsVertex-DbGd-etA.js","./morphTargetsVertex-7Q90Wwr8.js","./logDepthDeclaration-DbMKMukk.js","./openpbr.fragment-CW3v0ozH.js","./oitFragment-_o5mqRWd.js","./pbrDebug-ChQlKLz5.js","./shadowsFragmentFunctions-QR4_Qrt1.js","./bumpFragment-CNMCo4HD.js","./imageProcessingFunctions-dvOnE6xp.js","./clipPlaneFragment-T8W7CIC5.js","./fogFragment-R9KOnWn-.js","./hdrFilteringFunctions-DFleLIbL.js"])))=>i.map(i=>d[i]); +import{af as D}from"./index-DWyDLubb.js";import{ah as b,o as R,C as P,ai as Y,n as Z,L as C,T as K,d as j,a7 as O,aj as Q,ak as G,P as z,e as w,J as y,Z as $,u as U,$ as q,a0 as J,a1 as ee,c as F,al as te,a2 as se,a3 as ie,b as re,a4 as ae,a5 as oe,a6 as ne,E as le,H as he,F as ue,K as _e,N as Te,Q as Ae,U as fe,Y as ce,W as k,X as pe,p as me,q as Ee,r as Re,t as ge,v as Se,w as Le,x as Ie,y as Oe,z as ye,a8 as Fe,a9 as Pe,aa as de,ab as Ne,ac as Ce,_ as i,am as o,s as f,ae as c,R as xe}from"./index-CDrXokXW.js";const d={effect:null,subMesh:null};class N{populateVectorFromLinkedProperties(t){const r=t.dimension[0];for(const e in this.linkedProperties){const a=this.linkedProperties[e],n=a.numComponents;if(rr-n){n==1?C.Error(`Float property ${a.name} has an offset that is too large.`):C.Error(`Vector${n} property ${a.name} won't fit in Vector${r} or has an offset that is too large.`);return}typeof a.value=="number"?N._tmpArray[a.targetUniformComponentOffset]=a.value:a.value.toArray(N._tmpArray,a.targetUniformComponentOffset)}t.fromArray(N._tmpArray)}constructor(t,r){this.linkedProperties={},this.name=t,this.numComponents=r}}N._tmpArray=[0,0,0,0];class A{constructor(t,r,e,a,n=0){this.targetUniformComponentNum=4,this.targetUniformComponentOffset=0,this.name=t,this.targetUniformName=e,this.defaultValue=r,this.value=r,this.targetUniformComponentNum=a,this.targetUniformComponentOffset=n}get numComponents(){return typeof this.defaultValue=="number"?1:this.defaultValue.dimension[0]}}class p{get samplerName(){return this.samplerPrefix+"Sampler"}get samplerInfoName(){return"v"+this.samplerPrefix.charAt(0).toUpperCase()+this.samplerPrefix.slice(1)+"Infos"}get samplerMatrixName(){return this.samplerPrefix+"Matrix"}constructor(t,r,e){this.value=null,this.samplerPrefix="",this.textureDefine="",this.name=t,this.samplerPrefix=r,this.textureDefine=e}}class Me extends Ne(Ce){}class V extends de(Me){constructor(t){super(t),this.NUM_SAMPLES="0",this.REALTIME_FILTERING=!1,this.IBL_CDF_FILTERING=!1,this.VERTEXCOLOR=!1,this.BAKED_VERTEX_ANIMATION_TEXTURE=!1,this.VERTEXALPHA=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.ALPHABLEND=!1,this.ALPHA_FROM_BASE_COLOR_TEXTURE=!1,this.ALPHATESTVALUE="0.5",this.PREMULTIPLYALPHA=!1,this.REFLECTIVITY_GAMMA=!1,this.REFLECTIVITYDIRECTUV=0,this.SPECULARTERM=!1,this.LODBASEDMICROSFURACE=!0,this.METALLICWORKFLOW=!0,this.ROUGHNESSSTOREINMETALMAPALPHA=!1,this.ROUGHNESSSTOREINMETALMAPGREEN=!1,this.METALLNESSSTOREINMETALMAPBLUE=!1,this.AOSTOREINMETALMAPRED=!1,this.SPECULAR_WEIGHT_IN_ALPHA=!1,this.SPECULAR_WEIGHT_FROM_SPECULAR_COLOR_TEXTURE=!1,this.SPECULAR_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE=!1,this.COAT_ROUGHNESS_FROM_GREEN_CHANNEL=!1,this.COAT_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE=!1,this.USE_GLTF_STYLE_ANISOTROPY=!1,this.THIN_FILM_THICKNESS_FROM_THIN_FILM_TEXTURE=!1,this.FUZZ_ROUGHNESS_FROM_TEXTURE_ALPHA=!1,this.ENVIRONMENTBRDF=!1,this.ENVIRONMENTBRDF_RGBD=!1,this.FUZZENVIRONMENTBRDF=!1,this.NORMAL=!1,this.TANGENT=!1,this.OBJECTSPACE_NORMALMAP=!1,this.PARALLAX=!1,this.PARALLAX_RHS=!1,this.PARALLAXOCCLUSION=!1,this.NORMALXYSCALE=!0,this.ANISOTROPIC=!1,this.ANISOTROPIC_OPENPBR=!0,this.ANISOTROPIC_BASE=!1,this.ANISOTROPIC_COAT=!1,this.FUZZ_IBL_SAMPLES=6,this.FUZZ=!1,this.THIN_FILM=!1,this.IRIDESCENCE=!1,this.REFLECTION=!1,this.REFLECTIONMAP_3D=!1,this.REFLECTIONMAP_SPHERICAL=!1,this.REFLECTIONMAP_PLANAR=!1,this.REFLECTIONMAP_CUBIC=!1,this.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,this.REFLECTIONMAP_PROJECTION=!1,this.REFLECTIONMAP_SKYBOX=!1,this.REFLECTIONMAP_EXPLICIT=!1,this.REFLECTIONMAP_EQUIRECTANGULAR=!1,this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,this.INVERTCUBICMAP=!1,this.USESPHERICALFROMREFLECTIONMAP=!1,this.USEIRRADIANCEMAP=!1,this.USE_IRRADIANCE_DOMINANT_DIRECTION=!1,this.USESPHERICALINVERTEX=!1,this.REFLECTIONMAP_OPPOSITEZ=!1,this.LODINREFLECTIONALPHA=!1,this.GAMMAREFLECTION=!1,this.RGBDREFLECTION=!1,this.RADIANCEOCCLUSION=!1,this.HORIZONOCCLUSION=!1,this.INSTANCES=!1,this.THIN_INSTANCES=!1,this.INSTANCESCOLOR=!1,this.PREPASS=!1,this.PREPASS_COLOR=!1,this.PREPASS_COLOR_INDEX=-1,this.PREPASS_IRRADIANCE=!1,this.PREPASS_IRRADIANCE_INDEX=-1,this.PREPASS_ALBEDO=!1,this.PREPASS_ALBEDO_INDEX=-1,this.PREPASS_ALBEDO_SQRT=!1,this.PREPASS_ALBEDO_SQRT_INDEX=-1,this.PREPASS_DEPTH=!1,this.PREPASS_DEPTH_INDEX=-1,this.PREPASS_SCREENSPACE_DEPTH=!1,this.PREPASS_SCREENSPACE_DEPTH_INDEX=-1,this.PREPASS_NORMALIZED_VIEW_DEPTH=!1,this.PREPASS_NORMALIZED_VIEW_DEPTH_INDEX=-1,this.PREPASS_NORMAL=!1,this.PREPASS_NORMAL_INDEX=-1,this.PREPASS_NORMAL_WORLDSPACE=!1,this.PREPASS_WORLD_NORMAL=!1,this.PREPASS_WORLD_NORMAL_INDEX=-1,this.PREPASS_POSITION=!1,this.PREPASS_POSITION_INDEX=-1,this.PREPASS_LOCAL_POSITION=!1,this.PREPASS_LOCAL_POSITION_INDEX=-1,this.PREPASS_VELOCITY=!1,this.PREPASS_VELOCITY_INDEX=-1,this.PREPASS_VELOCITY_LINEAR=!1,this.PREPASS_VELOCITY_LINEAR_INDEX=-1,this.PREPASS_REFLECTIVITY=!1,this.PREPASS_REFLECTIVITY_INDEX=-1,this.SCENE_MRT_COUNT=0,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.BONETEXTURE=!1,this.BONES_VELOCITY_ENABLED=!1,this.NONUNIFORMSCALING=!1,this.MORPHTARGETS=!1,this.MORPHTARGETS_POSITION=!1,this.MORPHTARGETS_NORMAL=!1,this.MORPHTARGETS_TANGENT=!1,this.MORPHTARGETS_UV=!1,this.MORPHTARGETS_UV2=!1,this.MORPHTARGETS_COLOR=!1,this.MORPHTARGETTEXTURE_HASPOSITIONS=!1,this.MORPHTARGETTEXTURE_HASNORMALS=!1,this.MORPHTARGETTEXTURE_HASTANGENTS=!1,this.MORPHTARGETTEXTURE_HASUVS=!1,this.MORPHTARGETTEXTURE_HASUV2S=!1,this.MORPHTARGETTEXTURE_HASCOLORS=!1,this.NUM_MORPH_INFLUENCERS=0,this.MORPHTARGETS_TEXTURE=!1,this.USEPHYSICALLIGHTFALLOFF=!1,this.USEGLTFLIGHTFALLOFF=!1,this.TWOSIDEDLIGHTING=!1,this.MIRRORED=!1,this.SHADOWFLOAT=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.LOGARITHMICDEPTH=!1,this.CAMERA_ORTHOGRAPHIC=!1,this.CAMERA_PERSPECTIVE=!1,this.AREALIGHTSUPPORTED=!0,this.FORCENORMALFORWARD=!1,this.SPECULARAA=!1,this.UNLIT=!1,this.DECAL_AFTER_DETAIL=!1,this.DEBUGMODE=0,this.CLUSTLIGHT_SLICES=0,this.CLUSTLIGHT_BATCH=0,this.BRDF_V_HEIGHT_CORRELATED=!0,this.MS_BRDF_ENERGY_CONSERVATION=!0,this.SPHERICAL_HARMONICS=!0,this.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=!0,this.MIX_IBL_RADIANCE_WITH_IRRADIANCE=!0,this.LEGACY_SPECULAR_ENERGY_CONSERVATION=!1,this.BASE_DIFFUSE_MODEL=0,this.DIELECTRIC_SPECULAR_MODEL=1,this.CONDUCTOR_SPECULAR_MODEL=1,this.rebuild()}reset(){super.reset(),this.ALPHATESTVALUE="0.5",this.NORMALXYSCALE=!0}}class De extends Fe(Pe){}class s extends De{get geometryTangentAngle(){return Math.atan2(this.geometryTangent.y,this.geometryTangent.x)}set geometryTangentAngle(t){this.geometryTangent=new b(Math.cos(t),Math.sin(t))}get geometryCoatTangentAngle(){return Math.atan2(this.geometryCoatTangent.y,this.geometryCoatTangent.x)}set geometryCoatTangentAngle(t){this.geometryCoatTangent=new b(Math.cos(t),Math.sin(t))}get usePhysicalLightFalloff(){return this._lightFalloff===R.LIGHTFALLOFF_PHYSICAL}set usePhysicalLightFalloff(t){t!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),t?this._lightFalloff=R.LIGHTFALLOFF_PHYSICAL:this._lightFalloff=R.LIGHTFALLOFF_STANDARD)}get useGLTFLightFalloff(){return this._lightFalloff===R.LIGHTFALLOFF_GLTF}set useGLTFLightFalloff(t){t!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),t?this._lightFalloff=R.LIGHTFALLOFF_GLTF:this._lightFalloff=R.LIGHTFALLOFF_STANDARD)}get realTimeFiltering(){return this._realTimeFiltering}set realTimeFiltering(t){this._realTimeFiltering=t,this.markAsDirty(1)}get realTimeFilteringQuality(){return this._realTimeFilteringQuality}set realTimeFilteringQuality(t){this._realTimeFilteringQuality=t,this.markAsDirty(1)}get fuzzSampleNumber(){return this._fuzzSampleNumber}set fuzzSampleNumber(t){this._fuzzSampleNumber=t,this.markAsDirty(1)}get canRenderToMRT(){return!0}constructor(t,r,e=!1){super(t,r,void 0,e||s.ForceGLSL),this._baseWeight=new A("base_weight",1,"vBaseWeight",1),this._baseWeightTexture=new p("base_weight","baseWeight","BASE_WEIGHT"),this._baseColor=new A("base_color",P.White(),"vBaseColor",4),this._baseColorTexture=new p("base_color","baseColor","BASE_COLOR"),this._baseDiffuseRoughness=new A("base_diffuse_roughness",0,"vBaseDiffuseRoughness",1),this._baseDiffuseRoughnessTexture=new p("base_diffuse_roughness","baseDiffuseRoughness","BASE_DIFFUSE_ROUGHNESS"),this._baseMetalness=new A("base_metalness",0,"vReflectanceInfo",4,0),this._baseMetalnessTexture=new p("base_metalness","baseMetalness","BASE_METALNESS"),this._specularWeight=new A("specular_weight",1,"vReflectanceInfo",4,3),this._specularWeightTexture=new p("specular_weight","specularWeight","SPECULAR_WEIGHT"),this._specularColor=new A("specular_color",P.White(),"vSpecularColor",4),this._specularColorTexture=new p("specular_color","specularColor","SPECULAR_COLOR"),this._specularRoughness=new A("specular_roughness",.3,"vReflectanceInfo",4,1),this._specularRoughnessTexture=new p("specular_roughness","specularRoughness","SPECULAR_ROUGHNESS"),this._specularRoughnessAnisotropy=new A("specular_roughness_anisotropy",0,"vSpecularAnisotropy",3,2),this._specularRoughnessAnisotropyTexture=new p("specular_roughness_anisotropy","specularRoughnessAnisotropy","SPECULAR_ROUGHNESS_ANISOTROPY"),this._specularIor=new A("specular_ior",1.5,"vReflectanceInfo",4,2),this._coatWeight=new A("coat_weight",0,"vCoatWeight",1,0),this._coatWeightTexture=new p("coat_weight","coatWeight","COAT_WEIGHT"),this._coatColor=new A("coat_color",P.White(),"vCoatColor",3,0),this._coatColorTexture=new p("coat_color","coatColor","COAT_COLOR"),this._coatRoughness=new A("coat_roughness",0,"vCoatRoughness",1,0),this._coatRoughnessTexture=new p("coat_roughness","coatRoughness","COAT_ROUGHNESS"),this._coatRoughnessAnisotropy=new A("coat_roughness_anisotropy",0,"vCoatRoughnessAnisotropy",1),this._coatRoughnessAnisotropyTexture=new p("coat_roughness_anisotropy","coatRoughnessAnisotropy","COAT_ROUGHNESS_ANISOTROPY"),this._coatIor=new A("coat_ior",1.5,"vCoatIor",1,0),this._coatDarkening=new A("coat_darkening",1,"vCoatDarkening",1,0),this._coatDarkeningTexture=new p("coat_darkening","coatDarkening","COAT_DARKENING"),this.useCoatRoughnessFromWeightTexture=!1,this._fuzzWeight=new A("fuzz_weight",0,"vFuzzWeight",1,0),this._fuzzWeightTexture=new p("fuzz_weight","fuzzWeight","FUZZ_WEIGHT"),this._fuzzColor=new A("fuzz_color",P.White(),"vFuzzColor",3,0),this._fuzzColorTexture=new p("fuzz_color","fuzzColor","FUZZ_COLOR"),this._fuzzRoughness=new A("fuzz_roughness",.5,"vFuzzRoughness",1,0),this._fuzzRoughnessTexture=new p("fuzz_roughness","fuzzRoughness","FUZZ_ROUGHNESS"),this._geometryNormalTexture=new p("geometry_normal","geometryNormal","GEOMETRY_NORMAL"),this._geometryTangent=new A("geometry_tangent",new b(1,0),"vSpecularAnisotropy",3,0),this._geometryTangentTexture=new p("geometry_tangent","geometryTangent","GEOMETRY_TANGENT"),this._geometryCoatNormalTexture=new p("geometry_coat_normal","geometryCoatNormal","GEOMETRY_COAT_NORMAL"),this._geometryCoatTangent=new A("geometry_coat_tangent",new b(1,0),"vGeometryCoatTangent",2,0),this._geometryCoatTangentTexture=new p("geometry_coat_tangent","geometryCoatTangent","GEOMETRY_COAT_TANGENT"),this._geometryOpacity=new A("geometry_opacity",1,"vBaseColor",4,3),this._geometryOpacityTexture=new p("geometry_opacity","geometryOpacity","GEOMETRY_OPACITY"),this._emissionLuminance=new A("emission_luminance",1,"vLightingIntensity",4,1),this._emissionColor=new A("emission_color",P.Black(),"vEmissionColor",3),this._emissionColorTexture=new p("emission_color","emissionColor","EMISSION_COLOR"),this._thinFilmWeight=new A("thin_film_weight",0,"vThinFilmWeight",1,0),this._thinFilmWeightTexture=new p("thin_film_weight","thinFilmWeight","THIN_FILM_WEIGHT"),this._thinFilmThickness=new A("thin_film_thickness",.5,"vThinFilmThickness",2,0),this._thinFilmThicknessMin=new A("thin_film_thickness_min",0,"vThinFilmThickness",2,1),this._thinFilmThicknessTexture=new p("thin_film_thickness","thinFilmThickness","THIN_FILM_THICKNESS"),this._thinFilmIor=new A("thin_film_ior",1.4,"vThinFilmIor",1,0),this._ambientOcclusionTexture=new p("ambient_occlusion","ambientOcclusion","AMBIENT_OCCLUSION"),this._uniformsList={},this._samplersList={},this._samplerDefines={},this.directIntensity=1,this.environmentIntensity=1,this.useSpecularWeightFromTextureAlpha=!1,this.forceAlphaTest=!1,this.alphaCutOff=.4,this.useAmbientOcclusionFromMetallicTextureRed=!1,this.useAmbientInGrayScale=!1,this.useObjectSpaceNormalMap=!1,this.useParallax=!1,this.useParallaxOcclusion=!1,this.parallaxScaleBias=.05,this.disableLighting=!1,this.forceIrradianceInFragment=!1,this.maxSimultaneousLights=4,this.invertNormalMapX=!1,this.invertNormalMapY=!1,this.twoSidedLighting=!1,this.useAlphaFresnel=!1,this.useLinearAlphaFresnel=!1,this.environmentBRDFTexture=null,this.forceNormalForward=!1,this.enableSpecularAntiAliasing=!1,this.useHorizonOcclusion=!0,this.useRadianceOcclusion=!0,this.unlit=!1,this.applyDecalMapAfterDetailMap=!1,this._lightingInfos=new Y(this.directIntensity,1,this.environmentIntensity,1),this._radianceTexture=null,this._useSpecularWeightFromAlpha=!1,this._useSpecularWeightFromSpecularColorTexture=!1,this._useSpecularRoughnessAnisotropyFromTangentTexture=!1,this._useCoatRoughnessAnisotropyFromTangentTexture=!1,this._useCoatRoughnessFromGreenChannel=!1,this._useGltfStyleAnisotropy=!1,this._useFuzzRoughnessFromTextureAlpha=!1,this._useHorizonOcclusion=!0,this._useRadianceOcclusion=!0,this._useAlphaFromBaseColorTexture=!1,this._useAmbientOcclusionFromMetallicTextureRed=!1,this._useRoughnessFromMetallicTextureGreen=!1,this._useMetallicFromMetallicTextureBlue=!1,this._useThinFilmThicknessFromTextureGreen=!1,this._lightFalloff=R.LIGHTFALLOFF_PHYSICAL,this._useObjectSpaceNormalMap=!1,this._useParallax=!1,this._useParallaxOcclusion=!1,this._parallaxScaleBias=.05,this._disableLighting=!1,this._maxSimultaneousLights=4,this._invertNormalMapX=!1,this._invertNormalMapY=!1,this._twoSidedLighting=!1,this._alphaCutOff=.4,this._useAlphaFresnel=!1,this._useLinearAlphaFresnel=!1,this._environmentBRDFTexture=null,this._environmentFuzzBRDFTexture=null,this._forceIrradianceInFragment=!1,this._realTimeFiltering=!1,this._realTimeFilteringQuality=8,this._fuzzSampleNumber=4,this._forceNormalForward=!1,this._enableSpecularAntiAliasing=!1,this._renderTargets=new Z(16),this._unlit=!1,this._applyDecalMapAfterDetailMap=!1,this._debugMode=0,this._shadersLoaded=!1,this._breakShaderLoadedCheck=!1,this.debugMode=0,this.debugLimit=-1,this.debugFactor=1,this._cacheHasRenderTargetTextures=!1,this._transparencyMode=R.MATERIAL_OPAQUE,this.getScene()&&!this.getScene()?.getEngine().isWebGPU&&this.getScene().getEngine().webGLVersion<2&&C.Error("OpenPBRMaterial: WebGL 2.0 or above is required for this material."),s._noiseTextures[this.getScene().uniqueId]||(s._noiseTextures[this.getScene().uniqueId]=new K(j.GetAssetUrl("https://assets.babylonjs.com/core/blue_noise/blue_noise_rgb.png"),this.getScene(),!1,!0,1),this.getScene().onDisposeObservable.addOnce(()=>{s._noiseTextures[this.getScene().uniqueId]?.dispose(),delete s._noiseTextures[this.getScene().uniqueId]})),this._attachImageProcessingConfiguration(null),this.getRenderTargetTextures=()=>(this._renderTargets.reset(),O.ReflectionTextureEnabled&&this._radianceTexture&&this._radianceTexture.isRenderTarget&&this._renderTargets.push(this._radianceTexture),this._eventInfo.renderTargets=this._renderTargets,this._callbackPluginEventFillRenderTargetTextures(this._eventInfo),this._renderTargets),this._environmentBRDFTexture=Q(this.getScene()),this._environmentFuzzBRDFTexture=G(this.getScene()),this.prePassConfiguration=new z,this._propertyList={};for(const n of Object.getOwnPropertyNames(this)){const u=this[n];u instanceof A&&(this._propertyList[n]=u)}Object.keys(this._propertyList).forEach(n=>{const u=this._propertyList[n];let T=this._uniformsList[u.targetUniformName];T?T.numComponents!==u.targetUniformComponentNum&&C.Error(`Uniform ${u.targetUniformName} already exists of size ${T.numComponents}, but trying to set it to ${u.targetUniformComponentNum}.`):(T=new N(u.targetUniformName,u.targetUniformComponentNum),this._uniformsList[u.targetUniformName]=T),T.linkedProperties[u.name]=u}),this._samplersList={};for(const n of Object.getOwnPropertyNames(this)){const u=this[n];u instanceof p&&(this._samplersList[n]=u)}for(const n in this._samplersList){const T=this._samplersList[n].textureDefine;this._samplerDefines[T]={type:"boolean",default:!1},this._samplerDefines[T+"DIRECTUV"]={type:"number",default:0},this._samplerDefines[T+"_GAMMA"]={type:"boolean",default:!1}}this._baseWeight,this._baseWeightTexture,this._baseColor,this._baseColorTexture,this._baseDiffuseRoughness,this._baseDiffuseRoughnessTexture,this._baseMetalness,this._baseMetalnessTexture,this._specularWeight,this._specularWeightTexture,this._specularColor,this._specularColorTexture,this._specularRoughness,this._specularIor,this._specularRoughnessTexture,this._specularRoughnessAnisotropy,this._specularRoughnessAnisotropyTexture,this._coatWeight,this._coatWeightTexture,this._coatColor,this._coatColorTexture,this._coatRoughness,this._coatRoughnessTexture,this._coatRoughnessAnisotropy,this._coatRoughnessAnisotropyTexture,this._coatIor,this._coatDarkening,this._coatDarkeningTexture,this._fuzzWeight,this._fuzzWeightTexture,this._fuzzColor,this._fuzzColorTexture,this._fuzzRoughness,this._fuzzRoughnessTexture,this._geometryNormalTexture,this._geometryTangent,this._geometryTangentTexture,this._geometryCoatNormalTexture,this._geometryCoatTangent,this._geometryCoatTangentTexture,this._geometryOpacity,this._geometryOpacityTexture,this._thinFilmWeight,this._thinFilmWeightTexture,this._thinFilmThickness,this._thinFilmThicknessMin,this._thinFilmThicknessTexture,this._thinFilmIor,this._emissionLuminance,this._emissionColor,this._emissionColorTexture,this._ambientOcclusionTexture}get hasRenderTargetTextures(){return O.ReflectionTextureEnabled&&this._radianceTexture&&this._radianceTexture.isRenderTarget?!0:this._cacheHasRenderTargetTextures}get isPrePassCapable(){return!this.disableDepthWrite}getClassName(){return"OpenPBRMaterial"}get transparencyMode(){return this._transparencyMode}set transparencyMode(t){this._transparencyMode!==t&&(this._transparencyMode=t,this._markAllSubMeshesAsTexturesAndMiscDirty())}_shouldUseAlphaFromBaseColorTexture(){return this._hasAlphaChannel()&&this._transparencyMode!==R.MATERIAL_OPAQUE&&!this.geometryOpacityTexture}_hasAlphaChannel(){return this.baseColorTexture!=null&&this.baseColorTexture.hasAlpha&&this._useAlphaFromBaseColorTexture||this.geometryOpacityTexture!=null}clone(t,r=!0,e=""){const a=w.Clone(()=>new s(t,this.getScene()),this,{cloneTexturesOnlyOnce:r});return a.id=t,a.name=t,this.stencil.copyTo(a.stencil),this._clonePlugins(a,e),a}serialize(){const t=super.serialize();return t.customType="BABYLON.OpenPBRMaterial",t}static Parse(t,r,e){const a=w.Parse(()=>new s(t.name,r),t,r,e);return t.stencil&&a.stencil.parse(t.stencil,r,e),R._ParsePlugins(t,a,r,e),a}forceCompilation(t,r,e){const a={clipPlane:!1,useInstances:!1,...e};this._uniformBufferLayoutBuilt||this.buildUniformLayout(),this._callbackPluginEventGeneric(4,this._eventInfo),(()=>{if(this._breakShaderLoadedCheck)return;const u=new V({...this._eventInfo.defineNames||{},...this._samplerDefines||{}}),T=this._prepareEffect(t,t,u,void 0,void 0,a.useInstances,a.clipPlane);this._onEffectCreatedObservable&&(d.effect=T,d.subMesh=null,this._onEffectCreatedObservable.notifyObservers(d)),T.isReady()?r&&r(this):T.onCompileObservable.add(()=>{r&&r(this)})})()}isReadyForSubMesh(t,r,e){this._uniformBufferLayoutBuilt||this.buildUniformLayout();const a=r._drawWrapper;if(a.effect&&this.isFrozen&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===e)return!0;r.materialDefines||(this._callbackPluginEventGeneric(4,this._eventInfo),r.materialDefines=new V({...this._eventInfo.defineNames||{},...this._samplerDefines||{}}));const n=r.materialDefines;if(this._isReadyForSubMesh(r))return!0;const u=this.getScene(),T=u.getEngine();if(n._areTexturesDirty&&(this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._cacheHasRenderTargetTextures=this._eventInfo.hasRenderTargetTextures,u.texturesEnabled)){for(const m in this._samplersList){const E=this._samplersList[m];if(E.value&&!E.value.isReadyOrNotBlocking())return!1}const h=this._getRadianceTexture();if(h&&O.ReflectionTextureEnabled){if(!h.isReadyOrNotBlocking())return!1;if(h.irradianceTexture){if(!h.irradianceTexture.isReadyOrNotBlocking())return!1}else if(!h.sphericalPolynomial&&h.getInternalTexture()?._sphericalPolynomialPromise)return!1}if(this._environmentBRDFTexture&&O.ReflectionTextureEnabled&&!this._environmentBRDFTexture.isReady()||this._environmentFuzzBRDFTexture&&O.ReflectionTextureEnabled&&!this._environmentFuzzBRDFTexture.isReady()||s._noiseTextures[u.uniqueId]&&!s._noiseTextures[u.uniqueId].isReady())return!1}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=n,this._eventInfo.subMesh=r,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh||n._areImageProcessingDirty&&this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady())return!1;if(n.AREALIGHTUSED){for(let h=0;h{t.addUniform(r.name,r.numComponents)}),Object.values(this._samplersList).forEach(r=>{t.addUniform(r.samplerInfoName,2),t.addUniform(r.samplerMatrixName,16)}),super.buildUniformLayout()}bindForSubMesh(t,r,e){const a=this.getScene(),n=e.materialDefines;if(!n)return;const u=e.effect;if(!u)return;this._activeEffect=u,r.getMeshUniformBuffer().bindToEffect(u,"Mesh"),r.transferToEffect(t);const T=a.getEngine();this._uniformBuffer.bindToEffect(u,"Material"),this.prePassConfiguration.bindForSubMesh(this._activeEffect,a,r,t,this.isFrozen),U.Bind(T.currentRenderPassId,this._activeEffect,r,t,this);const g=a.activeCamera;g?this._uniformBuffer.updateFloat4("cameraInfo",g.minZ,g.maxZ,0,0):this._uniformBuffer.updateFloat4("cameraInfo",0,0,0,0),this._eventInfo.subMesh=e,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),n.OBJECTSPACE_NORMALMAP&&(t.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));const S=this._mustRebind(a,u,e,r.visibility);q(r,this._activeEffect,this.prePassConfiguration);let _=null;const l=this._uniformBuffer;if(S){if(this.bindViewProjection(u),_=this._getRadianceTexture(),!l.useUbo||!this.isFrozen||!l.isSync||e._drawWrapper._forceRebindOnNextCall){if(a.texturesEnabled){for(const h in this._samplersList){const m=this._samplersList[h];m.value&&(l.updateFloat2(m.samplerInfoName,m.value.coordinatesIndex,m.value.level),J(m.value,l,m.samplerPrefix))}this.geometryNormalTexture&&(a._mirroredCameraPosition?l.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):l.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),ee(a,n,l,P.White(),_,this.realTimeFiltering,!0,!0,!0,!0,!0)}this.pointsCloud&&l.updateFloat("pointSize",this.pointSize),Object.values(this._uniformsList).forEach(h=>{h.numComponents===4?(h.populateVectorFromLinkedProperties(F.Vector4[0]),l.updateVector4(h.name,F.Vector4[0])):h.numComponents===3?(h.populateVectorFromLinkedProperties(F.Vector3[0]),l.updateVector3(h.name,F.Vector3[0])):h.numComponents===2?(h.populateVectorFromLinkedProperties(F.Vector2[0]),l.updateFloat2(h.name,F.Vector2[0].x,F.Vector2[0].y)):h.numComponents===1&&l.updateFloat(h.name,h.linkedProperties[Object.keys(h.linkedProperties)[0]].value)}),this._lightingInfos.x=this.directIntensity,this._lightingInfos.y=this.emissionLuminance,this._lightingInfos.z=this.environmentIntensity*a.environmentIntensity,this._lightingInfos.w=1,l.updateVector4("vLightingIntensity",this._lightingInfos),l.updateFloat2("vDebugMode",this.debugLimit,this.debugFactor)}if(a.texturesEnabled){for(const h in this._samplersList){const m=this._samplersList[h];m.value&&l.setTexture(m.samplerName,m.value)}te(a,n,l,_,this.realTimeFiltering),n.ENVIRONMENTBRDF&&l.setTexture("environmentBrdfSampler",this._environmentBRDFTexture),n.FUZZENVIRONMENTBRDF&&l.setTexture("environmentFuzzBrdfSampler",this._environmentFuzzBRDFTexture),(n.ANISOTROPIC||n.FUZZ)&&l.setTexture("blueNoiseSampler",s._noiseTextures[this.getScene().uniqueId])}this.getScene().useOrderIndependentTransparency&&this.needAlphaBlendingForMesh(r)&&this.getScene().depthPeelingRenderer.bind(u),this._eventInfo.subMesh=e,this._callbackPluginEventBindForSubMesh(this._eventInfo),se(this._activeEffect,this,a),this.bindEyePosition(u)}else a.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._needToBindSceneUbo=!0);(S||!this.isFrozen)&&(a.lightsEnabled&&!this._disableLighting&&ie(a,r,this._activeEffect,n,this._maxSimultaneousLights),(a.fogEnabled&&r.applyFog&&a.fogMode!==re.FOGMODE_NONE||_||r.receiveShadows||n.PREPASS)&&this.bindView(u),ae(a,r,this._activeEffect,!0),n.NUM_MORPH_INFLUENCERS&&oe(r,this._activeEffect),n.BAKED_VERTEX_ANIMATION_TEXTURE&&r.bakedVertexAnimationManager?.bind(u,n.INSTANCES),this._imageProcessingConfiguration.bind(this._activeEffect),ne(n,this._activeEffect,a)),this._afterBind(r,this._activeEffect,e),l.update()}getAnimatables(){const t=super.getAnimatables();for(const r in this._samplersList){const e=this._samplersList[r];e.value&&e.value.animations&&e.value.animations.length>0&&t.push(e.value)}return this._radianceTexture&&this._radianceTexture.animations&&this._radianceTexture.animations.length>0&&t.push(this._radianceTexture),t}getActiveTextures(){const t=super.getActiveTextures();for(const r in this._samplersList){const e=this._samplersList[r];e.value&&t.push(e.value)}return this._radianceTexture&&t.push(this._radianceTexture),t}hasTexture(t){if(super.hasTexture(t))return!0;for(const r in this._samplersList)if(this._samplersList[r].value===t)return!0;return this._radianceTexture===t}setPrePassRenderer(){return!1}dispose(t,r){if(this._breakShaderLoadedCheck=!0,r){this._environmentBRDFTexture&&this.getScene().environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),this._environmentFuzzBRDFTexture&&this.getScene().environmentFuzzBRDFTexture!==this._environmentFuzzBRDFTexture&&this._environmentFuzzBRDFTexture.dispose();for(const e in this._samplersList)this._samplersList[e].value?.dispose();this._radianceTexture?.dispose()}this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),super.dispose(t,r)}_getRadianceTexture(){return this._radianceTexture?this._radianceTexture:this.getScene().environmentTexture}_prepareEffect(t,r,e,a=null,n=null,u=null,T=null){if(this._prepareDefines(t,r,e,u,T),!e.isDirty)return null;e.markAsProcessed();const S=this.getScene().getEngine(),_=new le;let l=0;e.USESPHERICALINVERTEX&&_.addFallback(l++,"USESPHERICALINVERTEX"),e.FOG&&_.addFallback(l,"FOG"),e.SPECULARAA&&_.addFallback(l,"SPECULARAA"),e.POINTSIZE&&_.addFallback(l,"POINTSIZE"),e.LOGARITHMICDEPTH&&_.addFallback(l,"LOGARITHMICDEPTH"),e.PARALLAX&&_.addFallback(l,"PARALLAX"),e.PARALLAX_RHS&&_.addFallback(l,"PARALLAX_RHS"),e.PARALLAXOCCLUSION&&_.addFallback(l++,"PARALLAXOCCLUSION"),e.ENVIRONMENTBRDF&&_.addFallback(l++,"ENVIRONMENTBRDF"),e.TANGENT&&_.addFallback(l++,"TANGENT"),l=he(e,_,this._maxSimultaneousLights,l++),e.SPECULARTERM&&_.addFallback(l++,"SPECULARTERM"),e.USESPHERICALFROMREFLECTIONMAP&&_.addFallback(l++,"USESPHERICALFROMREFLECTIONMAP"),e.USEIRRADIANCEMAP&&_.addFallback(l++,"USEIRRADIANCEMAP"),e.NORMAL&&_.addFallback(l++,"NORMAL"),e.VERTEXCOLOR&&_.addFallback(l++,"VERTEXCOLOR"),e.MORPHTARGETS&&_.addFallback(l++,"MORPHTARGETS"),e.MULTIVIEW&&_.addFallback(0,"MULTIVIEW");const h=[y.PositionKind];e.NORMAL&&h.push(y.NormalKind),e.TANGENT&&h.push(y.TangentKind);for(let I=1;I<=6;++I)e["UV"+I]&&h.push(`uv${I===1?"":I}`);e.VERTEXCOLOR&&h.push(y.ColorKind),ue(h,t,e,_),_e(h,e),Te(h,t,e),Ae(h,t,e);let m="openpbr";const E=["world","view","viewProjection","vEyePosition","vLightsType","visibility","vFogInfos","vFogColor","pointSize","mBones","normalMatrix","vLightingIntensity","logarithmicDepthConstant","vTangentSpaceParams","boneTextureWidth","vDebugMode","morphTargetTextureInfo","morphTargetTextureIndices","cameraInfo"];for(const I in this._uniformsList)E.push(I);const L=["environmentBrdfSampler","blueNoiseSampler","boneSampler","morphTargets","oitDepthSampler","oitFrontColorSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"];e.FUZZENVIRONMENTBRDF&&L.push("environmentFuzzBrdfSampler");for(const I in this._samplersList){const v=this._samplersList[I];L.push(v.samplerName),E.push(v.samplerInfoName),E.push(v.samplerMatrixName)}fe(E,L,!0);const M=["Material","Scene","Mesh"],H={maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:e.NUM_MORPH_INFLUENCERS};this._eventInfo.fallbacks=_,this._eventInfo.fallbackRank=l,this._eventInfo.defines=e,this._eventInfo.uniforms=E,this._eventInfo.attributes=h,this._eventInfo.samplers=L,this._eventInfo.uniformBuffersNames=M,this._eventInfo.customCode=void 0,this._eventInfo.mesh=t,this._eventInfo.indexParameters=H,this._callbackPluginEventGeneric(128,this._eventInfo),U.AddUniformsAndSamplers(E,L),z.AddUniforms(E),ce(E),k&&(k.PrepareUniforms(E,e),k.PrepareSamplers(L,e)),pe({uniformsNames:E,uniformBuffersNames:M,samplers:L,defines:e,maxSimultaneousLights:this._maxSimultaneousLights});const B={};this.customShaderNameResolve&&(m=this.customShaderNameResolve(m,E,M,L,e,h,B));const W=e.toString(),X=S.createEffect(m,{attributes:h,uniformsNames:E,uniformBuffersNames:M,samplers:L,defines:W,fallbacks:_,onCompiled:a,onError:n,indexParameters:H,processFinalCode:B.processFinalCode,processCodeAfterIncludes:this._eventInfo.customCode,multiTarget:e.PREPASS,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:async()=>{this.shaderLanguage===1?await Promise.all([D(()=>import("./openpbr.vertex-O7ZI4RUT.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]),import.meta.url),D(()=>import("./openpbr.fragment-DZlw1Ils.js"),__vite__mapDeps([23,1,2,3,24,4,5,6,25,8,26,27,28,29,19,30,9,31,14,10]),import.meta.url)]):await Promise.all([D(()=>import("./openpbr.vertex-D6UaDo0k.js"),__vite__mapDeps([32,1,2,3,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47]),import.meta.url),D(()=>import("./openpbr.fragment-CW3v0ozH.js"),__vite__mapDeps([48,1,2,3,49,34,35,36,50,37,51,52,53,54,47,55,38,56,42,39]),import.meta.url)]),this._shadersLoaded=!0}},S);return this._eventInfo.customCode=void 0,X}_prepareDefines(t,r,e,a=null,n=null){const u=r.hasThinInstances,T=this.getScene(),g=T.getEngine();me(T,t,e,!0,this._maxSimultaneousLights,this._disableLighting),e._needNormals=!0,Ee(T,e);const S=this.needAlphaBlendingForMesh(t)&&this.getScene().useOrderIndependentTransparency;if(Re(T,e,this.canRenderToMRT&&!S),ge(T,e,S),U.PrepareDefines(g.currentRenderPassId,t,e),e.METALLICWORKFLOW=!0,e._areTexturesDirty){e._needUVs=!1;for(let _=1;_<=6;++_)e["MAINUV"+_]=!1;if(T.texturesEnabled){for(const h in this._samplersList){const m=this._samplersList[h];m.value?(Se(m.value,e,m.textureDefine),e[m.textureDefine+"_GAMMA"]=m.value.gammaSpace):e[m.textureDefine]=!1}const _=this._getRadianceTexture(),l=this._forceIrradianceInFragment||this.realTimeFiltering||this._twoSidedLighting||g.getCaps().maxVaryingVectors<=8||this._baseDiffuseRoughnessTexture!=null;Le(T,_,e,this.realTimeFiltering,this.realTimeFilteringQuality,!l),this._baseMetalnessTexture&&(e.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed),e.SPECULAR_WEIGHT_IN_ALPHA=this._useSpecularWeightFromAlpha,e.SPECULAR_WEIGHT_FROM_SPECULAR_COLOR_TEXTURE=this._useSpecularWeightFromSpecularColorTexture,e.SPECULAR_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE=this._useSpecularRoughnessAnisotropyFromTangentTexture,e.COAT_ROUGHNESS_ANISOTROPY_FROM_TANGENT_TEXTURE=this._useCoatRoughnessAnisotropyFromTangentTexture,e.COAT_ROUGHNESS_FROM_GREEN_CHANNEL=this._useCoatRoughnessFromGreenChannel,e.ROUGHNESSSTOREINMETALMAPGREEN=this._useRoughnessFromMetallicTextureGreen,e.FUZZ_ROUGHNESS_FROM_TEXTURE_ALPHA=this._useFuzzRoughnessFromTextureAlpha,e.METALLNESSSTOREINMETALMAPBLUE=this._useMetallicFromMetallicTextureBlue,e.THIN_FILM_THICKNESS_FROM_THIN_FILM_TEXTURE=this._useThinFilmThicknessFromTextureGreen,this.geometryNormalTexture?(this._useParallax&&this.baseColorTexture&&O.DiffuseTextureEnabled?(e.PARALLAX=!0,e.PARALLAX_RHS=T.useRightHandedSystem,e.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):e.PARALLAX=!1,e.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):(e.PARALLAX=!1,e.PARALLAX_RHS=!1,e.PARALLAXOCCLUSION=!1,e.OBJECTSPACE_NORMALMAP=!1),this._environmentBRDFTexture&&O.ReflectionTextureEnabled?(e.ENVIRONMENTBRDF=!0,e.ENVIRONMENTBRDF_RGBD=this._environmentBRDFTexture.isRGBD):(e.ENVIRONMENTBRDF=!1,e.ENVIRONMENTBRDF_RGBD=!1),this._environmentFuzzBRDFTexture?e.FUZZENVIRONMENTBRDF=!0:e.FUZZENVIRONMENTBRDF=!1,this._shouldUseAlphaFromBaseColorTexture()?e.ALPHA_FROM_BASE_COLOR_TEXTURE=!0:e.ALPHA_FROM_BASE_COLOR_TEXTURE=!1}this._lightFalloff===R.LIGHTFALLOFF_STANDARD?(e.USEPHYSICALLIGHTFALLOFF=!1,e.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===R.LIGHTFALLOFF_GLTF?(e.USEPHYSICALLIGHTFALLOFF=!1,e.USEGLTFLIGHTFALLOFF=!0):(e.USEPHYSICALLIGHTFALLOFF=!0,e.USEGLTFLIGHTFALLOFF=!1),!this.backFaceCulling&&this._twoSidedLighting?e.TWOSIDEDLIGHTING=!0:e.TWOSIDEDLIGHTING=!1,e.MIRRORED=!!T._mirroredCameraPosition,e.SPECULARAA=g.getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}(e._areTexturesDirty||e._areMiscDirty)&&(e.ALPHATESTVALUE=`${this._alphaCutOff}${this._alphaCutOff%1===0?".":""}`,e.PREMULTIPLYALPHA=this.alphaMode===7||this.alphaMode===8,e.ALPHABLEND=this.needAlphaBlendingForMesh(t)),e._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(e),e.FORCENORMALFORWARD=this._forceNormalForward,e.RADIANCEOCCLUSION=this._useRadianceOcclusion,e.HORIZONOCCLUSION=this._useHorizonOcclusion,(this.specularRoughnessAnisotropy>0||this.coatRoughnessAnisotropy>0)&&s._noiseTextures[T.uniqueId]&&O.ReflectionTextureEnabled?(e.ANISOTROPIC=!0,t.isVerticesDataPresent(y.TangentKind)||(e._needUVs=!0,e.MAINUV1=!0),this._useGltfStyleAnisotropy&&(e.USE_GLTF_STYLE_ANISOTROPY=!0),e.ANISOTROPIC_BASE=this.specularRoughnessAnisotropy>0,e.ANISOTROPIC_COAT=this.coatRoughnessAnisotropy>0):(e.ANISOTROPIC=!1,e.USE_GLTF_STYLE_ANISOTROPY=!1,e.ANISOTROPIC_BASE=!1,e.ANISOTROPIC_COAT=!1),e.THIN_FILM=this.thinFilmWeight>0,e.IRIDESCENCE=this.thinFilmWeight>0,e.FUZZ=this.fuzzWeight>0&&O.ReflectionTextureEnabled,e.FUZZ?(t.isVerticesDataPresent(y.TangentKind)||(e._needUVs=!0,e.MAINUV1=!0),this._environmentFuzzBRDFTexture=G(this.getScene()),e.FUZZ_IBL_SAMPLES=this.fuzzSampleNumber):(this._environmentFuzzBRDFTexture=null,e.FUZZENVIRONMENTBRDF=!1,e.FUZZ_IBL_SAMPLES=0),e._areMiscDirty&&(Ie(t,T,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(t),e,this._applyDecalMapAfterDetailMap,this._useVertexPulling,r,this._isVertexOutputInvariant),e.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!t.isVerticesDataPresent(y.NormalKind),e.DEBUGMODE=this._debugMode),Oe(T,g,this,e,!!a,n,u),this._eventInfo.defines=e,this._eventInfo.mesh=t,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),ye(t,e,!0,!0,!0,this._transparencyMode!==R.MATERIAL_OPAQUE),this._callbackPluginEventPrepareDefines(this._eventInfo)}}s._noiseTextures={};s.ForceGLSL=!1;i([o("_markAllSubMeshesAsTexturesDirty","baseWeight")],s.prototype,"_baseWeight",void 0);i([o("_markAllSubMeshesAsTexturesDirty","baseWeightTexture")],s.prototype,"_baseWeightTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","baseColor")],s.prototype,"_baseColor",void 0);i([o("_markAllSubMeshesAsTexturesDirty","baseColorTexture")],s.prototype,"_baseColorTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","baseDiffuseRoughness")],s.prototype,"_baseDiffuseRoughness",void 0);i([o("_markAllSubMeshesAsTexturesDirty","baseDiffuseRoughnessTexture")],s.prototype,"_baseDiffuseRoughnessTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","baseMetalness")],s.prototype,"_baseMetalness",void 0);i([o("_markAllSubMeshesAsTexturesDirty","baseMetalnessTexture")],s.prototype,"_baseMetalnessTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","specularWeight")],s.prototype,"_specularWeight",void 0);i([o("_markAllSubMeshesAsTexturesDirty","specularWeightTexture")],s.prototype,"_specularWeightTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","specularColor")],s.prototype,"_specularColor",void 0);i([o("_markAllSubMeshesAsTexturesDirty","specularColorTexture")],s.prototype,"_specularColorTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","specularRoughness")],s.prototype,"_specularRoughness",void 0);i([o("_markAllSubMeshesAsTexturesDirty","specularRoughnessTexture")],s.prototype,"_specularRoughnessTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","specularRoughnessAnisotropy")],s.prototype,"_specularRoughnessAnisotropy",void 0);i([o("_markAllSubMeshesAsTexturesDirty","specularRoughnessAnisotropyTexture")],s.prototype,"_specularRoughnessAnisotropyTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","specularIor")],s.prototype,"_specularIor",void 0);i([o("_markAllSubMeshesAsTexturesDirty","coatWeight")],s.prototype,"_coatWeight",void 0);i([o("_markAllSubMeshesAsTexturesDirty","coatWeightTexture")],s.prototype,"_coatWeightTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","coatColor")],s.prototype,"_coatColor",void 0);i([o("_markAllSubMeshesAsTexturesDirty","coatColorTexture")],s.prototype,"_coatColorTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","coatRoughness")],s.prototype,"_coatRoughness",void 0);i([o("_markAllSubMeshesAsTexturesDirty","coatRoughnessTexture")],s.prototype,"_coatRoughnessTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","coatRoughnessAnisotropy")],s.prototype,"_coatRoughnessAnisotropy",void 0);i([o("_markAllSubMeshesAsTexturesDirty","coatRoughnessAnisotropyTexture")],s.prototype,"_coatRoughnessAnisotropyTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","coatIor")],s.prototype,"_coatIor",void 0);i([o("_markAllSubMeshesAsTexturesDirty","coatDarkening")],s.prototype,"_coatDarkening",void 0);i([o("_markAllSubMeshesAsTexturesDirty","coatDarkeningTexture")],s.prototype,"_coatDarkeningTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","fuzzWeight")],s.prototype,"_fuzzWeight",void 0);i([o("_markAllSubMeshesAsTexturesDirty","fuzzWeightTexture")],s.prototype,"_fuzzWeightTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","fuzzColor")],s.prototype,"_fuzzColor",void 0);i([o("_markAllSubMeshesAsTexturesDirty","fuzzColorTexture")],s.prototype,"_fuzzColorTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","fuzzRoughness")],s.prototype,"_fuzzRoughness",void 0);i([o("_markAllSubMeshesAsTexturesDirty","fuzzRoughnessTexture")],s.prototype,"_fuzzRoughnessTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","geometryNormalTexture")],s.prototype,"_geometryNormalTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","geometryTangent")],s.prototype,"_geometryTangent",void 0);i([o("_markAllSubMeshesAsTexturesDirty","geometryTangentTexture")],s.prototype,"_geometryTangentTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","geometryCoatNormalTexture")],s.prototype,"_geometryCoatNormalTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","geometryCoatTangent")],s.prototype,"_geometryCoatTangent",void 0);i([o("_markAllSubMeshesAsTexturesDirty","geometryCoatTangentTexture")],s.prototype,"_geometryCoatTangentTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","geometryOpacity")],s.prototype,"_geometryOpacity",void 0);i([o("_markAllSubMeshesAsTexturesDirty","geometryOpacityTexture")],s.prototype,"_geometryOpacityTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","emissionLuminance")],s.prototype,"_emissionLuminance",void 0);i([o("_markAllSubMeshesAsTexturesDirty","emissionColor")],s.prototype,"_emissionColor",void 0);i([o("_markAllSubMeshesAsTexturesDirty","emissionColorTexture")],s.prototype,"_emissionColorTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","thinFilmWeight")],s.prototype,"_thinFilmWeight",void 0);i([o("_markAllSubMeshesAsTexturesDirty","thinFilmWeightTexture")],s.prototype,"_thinFilmWeightTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","thinFilmThickness")],s.prototype,"_thinFilmThickness",void 0);i([o("_markAllSubMeshesAsTexturesDirty","thinFilmThicknessMin")],s.prototype,"_thinFilmThicknessMin",void 0);i([o("_markAllSubMeshesAsTexturesDirty","thinFilmThicknessTexture")],s.prototype,"_thinFilmThicknessTexture",void 0);i([o("_markAllSubMeshesAsTexturesDirty","thinFilmIor")],s.prototype,"_thinFilmIor",void 0);i([o("_markAllSubMeshesAsTexturesDirty","ambientOcclusionTexture")],s.prototype,"_ambientOcclusionTexture",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"directIntensity",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"environmentIntensity",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useSpecularWeightFromTextureAlpha",void 0);i([f(),c("_markAllSubMeshesAsTexturesAndMiscDirty")],s.prototype,"forceAlphaTest",void 0);i([f(),c("_markAllSubMeshesAsTexturesAndMiscDirty")],s.prototype,"alphaCutOff",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useAmbientInGrayScale",void 0);i([f()],s.prototype,"usePhysicalLightFalloff",null);i([f()],s.prototype,"useGLTFLightFalloff",null);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useObjectSpaceNormalMap",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useParallax",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useParallaxOcclusion",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"parallaxScaleBias",void 0);i([f(),c("_markAllSubMeshesAsLightsDirty")],s.prototype,"disableLighting",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"forceIrradianceInFragment",void 0);i([f(),c("_markAllSubMeshesAsLightsDirty")],s.prototype,"maxSimultaneousLights",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"invertNormalMapX",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"invertNormalMapY",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"twoSidedLighting",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useAlphaFresnel",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useLinearAlphaFresnel",void 0);i([c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"environmentBRDFTexture",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"forceNormalForward",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"enableSpecularAntiAliasing",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useHorizonOcclusion",void 0);i([f(),c("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useRadianceOcclusion",void 0);i([f(),c("_markAllSubMeshesAsMiscDirty")],s.prototype,"unlit",void 0);i([f(),c("_markAllSubMeshesAsMiscDirty")],s.prototype,"applyDecalMapAfterDetailMap",void 0);i([c("_markAllSubMeshesAsMiscDirty")],s.prototype,"debugMode",void 0);i([f()],s.prototype,"transparencyMode",null);xe("BABYLON.OpenPBRMaterial",s);export{s as OpenPBRMaterial,V as OpenPBRMaterialDefines}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbrMaterialLoadingAdapter-DUmKUa7I.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbrMaterialLoadingAdapter-DUmKUa7I.js new file mode 100644 index 0000000000000000000000000000000000000000..5f78b4c9e9c5847a7bd6ccab3ab928fbea1ea816 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbrMaterialLoadingAdapter-DUmKUa7I.js @@ -0,0 +1 @@ +class s{constructor(e){this._material=e}get material(){return this._material}get isUnlit(){return this._material.unlit}set isUnlit(e){this._material.unlit=e}set backFaceCulling(e){this._material.backFaceCulling=e}get backFaceCulling(){return this._material.backFaceCulling}set twoSidedLighting(e){this._material.twoSidedLighting=e}get twoSidedLighting(){return this._material.twoSidedLighting}set alphaCutOff(e){}get alphaCutOff(){return .5}set useAlphaFromBaseColorTexture(e){this._material._useAlphaFromBaseColorTexture=e}get useAlphaFromBaseColorTexture(){return!1}get transparencyAsAlphaCoverage(){return!1}set transparencyAsAlphaCoverage(e){}set baseColor(e){this._material.baseColor=e}get baseColor(){return this._material.baseColor}set baseColorTexture(e){this._material.baseColorTexture=e}get baseColorTexture(){return this._material.baseColorTexture}set baseDiffuseRoughness(e){this._material.baseDiffuseRoughness=e}get baseDiffuseRoughness(){return this._material.baseDiffuseRoughness}set baseDiffuseRoughnessTexture(e){this._material.baseDiffuseRoughnessTexture=e}get baseDiffuseRoughnessTexture(){return this._material.baseDiffuseRoughnessTexture}set baseMetalness(e){this._material.baseMetalness=e}get baseMetalness(){return this._material.baseMetalness}set baseMetalnessTexture(e){this._material.baseMetalnessTexture=e}get baseMetalnessTexture(){return this._material.baseMetalnessTexture}set useRoughnessFromMetallicTextureGreen(e){this._material._useRoughnessFromMetallicTextureGreen=e}set useMetallicFromMetallicTextureBlue(e){this._material._useMetallicFromMetallicTextureBlue=e}enableSpecularEdgeColor(e=!1){}set specularWeight(e){this._material.specularWeight=e}get specularWeight(){return this._material.specularWeight}set specularWeightTexture(e){this._material.specularColorTexture===e?(this._material.specularWeightTexture=null,this._material._useSpecularWeightFromSpecularColorTexture=!0,this._material._useSpecularWeightFromAlpha=!0):this._material.specularWeightTexture=e}get specularWeightTexture(){return this._material.specularWeightTexture}set specularColor(e){this._material.specularColor=e}get specularColor(){return this._material.specularColor}set specularColorTexture(e){this._material.specularColorTexture=e,this._material.specularWeightTexture===this._material.specularColorTexture&&(this._material.specularWeightTexture=null,this._material._useSpecularWeightFromSpecularColorTexture=!0,this._material._useSpecularWeightFromAlpha=!0)}get specularColorTexture(){return this._material.specularColorTexture}set specularRoughness(e){this._material.specularRoughness=e}get specularRoughness(){return this._material.specularRoughness}set specularRoughnessTexture(e){this._material.specularRoughnessTexture=e}get specularRoughnessTexture(){return this._material.specularRoughnessTexture}set specularIor(e){this._material.specularIor=e}get specularIor(){return this._material.specularIor}set emissionColor(e){this._material.emissionColor=e}get emissionColor(){return this._material.emissionColor}set emissionLuminance(e){this._material.emissionLuminance=e}get emissionLuminance(){return this._material.emissionLuminance}set emissionColorTexture(e){this._material.emissionColorTexture=e}get emissionColorTexture(){return this._material.emissionColorTexture}set ambientOcclusionTexture(e){this._material.ambientOcclusionTexture=e}get ambientOcclusionTexture(){return this._material.ambientOcclusionTexture}set ambientOcclusionTextureStrength(e){const t=this._material.ambientOcclusionTexture;t&&(t.level=e)}get ambientOcclusionTextureStrength(){return this._material.ambientOcclusionTexture?.level??1}configureCoat(){}set coatWeight(e){this._material.coatWeight=e}get coatWeight(){return this._material.coatWeight}set coatWeightTexture(e){this._material.coatWeightTexture=e}get coatWeightTexture(){return this._material.coatWeightTexture}set coatColor(e){this._material.coatColor=e}set coatColorTexture(e){this._material.coatColorTexture=e}set coatRoughness(e){this._material.coatRoughness=e}get coatRoughness(){return this._material.coatRoughness}set coatRoughnessTexture(e){this._material.coatRoughnessTexture=e,e&&(this._material._useCoatRoughnessFromGreenChannel=!0)}get coatRoughnessTexture(){return this._material.coatRoughnessTexture}set coatIor(e){this._material.coatIor=e}set coatDarkening(e){this._material.coatDarkening=e}set coatDarkeningTexture(e){this._material.coatDarkeningTexture=e}set coatRoughnessAnisotropy(e){this._material.coatRoughnessAnisotropy=e}get coatRoughnessAnisotropy(){return this._material.coatRoughnessAnisotropy}set geometryCoatTangentAngle(e){this._material.geometryCoatTangentAngle=e}set geometryCoatTangentTexture(e){this._material.geometryCoatTangentTexture=e,e&&(this._material._useCoatRoughnessAnisotropyFromTangentTexture=!0)}get geometryCoatTangentTexture(){return this._material.geometryCoatTangentTexture}set transmissionWeight(e){}set transmissionWeightTexture(e){}get transmissionWeight(){return 0}set transmissionDispersionAbbeNumber(e){}configureTransmission(){}set transmissionDepth(e){}set transmissionColor(e){}set volumeThicknessTexture(e){}set volumeThickness(e){}configureSubsurface(){}set subsurfaceWeight(e){}get subsurfaceWeight(){return 0}set subsurfaceWeightTexture(e){}set subsurfaceColor(e){}set subsurfaceColorTexture(e){}configureFuzz(){}set fuzzWeight(e){this._material.fuzzWeight=e}set fuzzWeightTexture(e){this._material.fuzzWeightTexture=e}set fuzzColor(e){this._material.fuzzColor=e}set fuzzColorTexture(e){this._material.fuzzColorTexture=e}set fuzzRoughness(e){this._material.fuzzRoughness=e}set fuzzRoughnessTexture(e){this._material.fuzzRoughnessTexture=e,this._material._useFuzzRoughnessFromTextureAlpha=!0}set specularRoughnessAnisotropy(e){this._material.specularRoughnessAnisotropy=e}get specularRoughnessAnisotropy(){return this._material.specularRoughnessAnisotropy}set geometryTangentAngle(e){this._material.geometryTangentAngle=e}set geometryTangentTexture(e){this._material.geometryTangentTexture=e,this._material._useSpecularRoughnessAnisotropyFromTangentTexture=!0}get geometryTangentTexture(){return this._material.geometryTangentTexture}configureGltfStyleAnisotropy(e=!0){this._material._useGltfStyleAnisotropy=e}set thinFilmWeight(e){this._material.thinFilmWeight=e}set thinFilmIor(e){this._material.thinFilmIor=e}set thinFilmThicknessMinimum(e){this._material.thinFilmThicknessMin=e/1e3}set thinFilmThicknessMaximum(e){this._material.thinFilmThickness=e/1e3}set thinFilmWeightTexture(e){this._material.thinFilmWeightTexture=e}set thinFilmThicknessTexture(e){this._material.thinFilmThicknessTexture=e,this._material._useThinFilmThicknessFromTextureGreen=!0}set unlit(e){this._material.unlit=e}set geometryOpacity(e){this._material.geometryOpacity=e}get geometryOpacity(){return this._material.geometryOpacity}set geometryNormalTexture(e){this._material.geometryNormalTexture=e}get geometryNormalTexture(){return this._material.geometryNormalTexture}setNormalMapInversions(e,t){}set geometryCoatNormalTexture(e){this._material.geometryCoatNormalTexture=e}get geometryCoatNormalTexture(){return this._material.geometryCoatNormalTexture}set geometryCoatNormalTextureScale(e){this._material.geometryCoatNormalTexture&&(this._material.geometryCoatNormalTexture.level=e)}}export{s as OpenPBRMaterialLoadingAdapter}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbrUboDeclaration-DTjWMuUO.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbrUboDeclaration-DTjWMuUO.js new file mode 100644 index 0000000000000000000000000000000000000000..de6ef2af658c9a0f1ae5b734f08956508069eacb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbrUboDeclaration-DTjWMuUO.js @@ -0,0 +1,6 @@ +import{S as e}from"./index-CDrXokXW.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./meshUboDeclaration-C6raEdzf.js";const o="openpbrUboDeclaration",a=`layout(std140,column_major) uniform;uniform Material {vec2 vTangentSpaceParams;vec4 vLightingIntensity;float pointSize;vec2 vDebugMode;vec4 cameraInfo;vec2 vReflectionInfos;mat4 reflectionMatrix;vec3 vReflectionMicrosurfaceInfos;vec3 vReflectionPosition;vec3 vReflectionSize;vec2 vReflectionFilteringInfo;vec3 vReflectionDominantDirection;vec3 vReflectionColor;vec3 vSphericalL00;vec3 vSphericalL1_1;vec3 vSphericalL10;vec3 vSphericalL11;vec3 vSphericalL2_2;vec3 vSphericalL2_1;vec3 vSphericalL20;vec3 vSphericalL21;vec3 vSphericalL22;vec3 vSphericalX;vec3 vSphericalY;vec3 vSphericalZ;vec3 vSphericalXX_ZZ;vec3 vSphericalYY_ZZ;vec3 vSphericalZZ;vec3 vSphericalXY;vec3 vSphericalYZ;vec3 vSphericalZX;float vBaseWeight;vec4 vBaseColor;float vBaseDiffuseRoughness;vec4 vReflectanceInfo;vec4 vSpecularColor;vec3 vSpecularAnisotropy;float vCoatWeight;vec3 vCoatColor;float vCoatRoughness;float vCoatRoughnessAnisotropy;float vCoatIor;float vCoatDarkening;float vFuzzWeight;vec3 vFuzzColor;float vFuzzRoughness;vec2 vGeometryCoatTangent;vec3 vEmissionColor;float vThinFilmWeight;vec2 vThinFilmThickness;float vThinFilmIor;vec2 vBaseWeightInfos;mat4 baseWeightMatrix;vec2 vBaseColorInfos;mat4 baseColorMatrix;vec2 vBaseDiffuseRoughnessInfos;mat4 baseDiffuseRoughnessMatrix;vec2 vBaseMetalnessInfos;mat4 baseMetalnessMatrix;vec2 vSpecularWeightInfos;mat4 specularWeightMatrix;vec2 vSpecularColorInfos;mat4 specularColorMatrix;vec2 vSpecularRoughnessInfos;mat4 specularRoughnessMatrix;vec2 vSpecularRoughnessAnisotropyInfos;mat4 specularRoughnessAnisotropyMatrix;vec2 vCoatWeightInfos;mat4 coatWeightMatrix;vec2 vCoatColorInfos;mat4 coatColorMatrix;vec2 vCoatRoughnessInfos;mat4 coatRoughnessMatrix;vec2 vCoatRoughnessAnisotropyInfos;mat4 coatRoughnessAnisotropyMatrix;vec2 vCoatDarkeningInfos;mat4 coatDarkeningMatrix;vec2 vFuzzWeightInfos;mat4 fuzzWeightMatrix;vec2 vFuzzColorInfos;mat4 fuzzColorMatrix;vec2 vFuzzRoughnessInfos;mat4 fuzzRoughnessMatrix;vec2 vGeometryNormalInfos;mat4 geometryNormalMatrix;vec2 vGeometryTangentInfos;mat4 geometryTangentMatrix;vec2 vGeometryCoatNormalInfos;mat4 geometryCoatNormalMatrix;vec2 vGeometryCoatTangentInfos;mat4 geometryCoatTangentMatrix;vec2 vGeometryOpacityInfos;mat4 geometryOpacityMatrix;vec2 vEmissionColorInfos;mat4 emissionColorMatrix;vec2 vThinFilmWeightInfos;mat4 thinFilmWeightMatrix;vec2 vThinFilmThicknessInfos;mat4 thinFilmThicknessMatrix;vec2 vAmbientOcclusionInfos;mat4 ambientOcclusionMatrix; +#define ADDITIONAL_UBO_DECLARATION +}; +#include +#include +`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=a); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbrUboDeclaration-Dw_NcTG6.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbrUboDeclaration-Dw_NcTG6.js new file mode 100644 index 0000000000000000000000000000000000000000..99d548dfb46f4d4a0f94c2ffaa805f731a15fd1a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/openpbrUboDeclaration-Dw_NcTG6.js @@ -0,0 +1,5 @@ +import{S as o}from"./index-CDrXokXW.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./meshUboDeclaration-Bk1ASTX2.js";const f="openpbrUboDeclaration",i=`uniform vTangentSpaceParams: vec2f;uniform vLightingIntensity: vec4f;uniform pointSize: f32;uniform vDebugMode: vec2f;uniform cameraInfo: vec4f;uniform vReflectionInfos: vec2f;uniform reflectionMatrix: mat4x4f;uniform vReflectionMicrosurfaceInfos: vec3f;uniform vReflectionPosition: vec3f;uniform vReflectionSize: vec3f;uniform vReflectionFilteringInfo: vec2f;uniform vReflectionDominantDirection: vec3f;uniform vReflectionColor: vec3f;uniform vSphericalL00: vec3f;uniform vSphericalL1_1: vec3f;uniform vSphericalL10: vec3f;uniform vSphericalL11: vec3f;uniform vSphericalL2_2: vec3f;uniform vSphericalL2_1: vec3f;uniform vSphericalL20: vec3f;uniform vSphericalL21: vec3f;uniform vSphericalL22: vec3f;uniform vSphericalX: vec3f;uniform vSphericalY: vec3f;uniform vSphericalZ: vec3f;uniform vSphericalXX_ZZ: vec3f;uniform vSphericalYY_ZZ: vec3f;uniform vSphericalZZ: vec3f;uniform vSphericalXY: vec3f;uniform vSphericalYZ: vec3f;uniform vSphericalZX: vec3f;uniform vBaseWeight: f32;uniform vBaseColor: vec4f;uniform vBaseDiffuseRoughness: f32;uniform vReflectanceInfo: vec4f;uniform vSpecularColor: vec4f;uniform vSpecularAnisotropy: vec3f;uniform vCoatWeight: f32;uniform vCoatColor: vec3f;uniform vCoatRoughness: f32;uniform vCoatRoughnessAnisotropy: f32;uniform vCoatIor: f32;uniform vCoatDarkening : f32;uniform vFuzzWeight: f32;uniform vFuzzColor: vec3f;uniform vFuzzRoughness: f32;uniform vGeometryCoatTangent: vec2f;uniform vEmissionColor: vec3f;uniform vThinFilmWeight: f32;uniform vThinFilmThickness: vec2f;uniform vThinFilmIor: f32;uniform vBaseWeightInfos: vec2f;uniform baseWeightMatrix: mat4x4f;uniform vBaseColorInfos: vec2f;uniform baseColorMatrix: mat4x4f;uniform vBaseDiffuseRoughnessInfos: vec2f;uniform baseDiffuseRoughnessMatrix: mat4x4f;uniform vBaseMetalnessInfos: vec2f;uniform baseMetalnessMatrix: mat4x4f;uniform vSpecularWeightInfos: vec2f;uniform specularWeightMatrix: mat4x4f;uniform vSpecularColorInfos: vec2f;uniform specularColorMatrix: mat4x4f;uniform vSpecularRoughnessInfos: vec2f;uniform specularRoughnessMatrix: mat4x4f;uniform vSpecularRoughnessAnisotropyInfos: vec2f;uniform specularRoughnessAnisotropyMatrix: mat4x4f;uniform vCoatWeightInfos: vec2f;uniform coatWeightMatrix: mat4x4f;uniform vCoatColorInfos: vec2f;uniform coatColorMatrix: mat4x4f;uniform vCoatRoughnessInfos: vec2f;uniform coatRoughnessMatrix: mat4x4f;uniform vCoatRoughnessAnisotropyInfos: vec2f;uniform coatRoughnessAnisotropyMatrix: mat4x4f;uniform vCoatDarkeningInfos : vec2f;uniform coatDarkeningMatrix : mat4x4f;uniform vFuzzWeightInfos: vec2f;uniform fuzzWeightMatrix: mat4x4f;uniform vFuzzColorInfos: vec2f;uniform fuzzColorMatrix: mat4x4f;uniform vFuzzRoughnessInfos: vec2f;uniform fuzzRoughnessMatrix: mat4x4f;uniform vGeometryNormalInfos: vec2f;uniform geometryNormalMatrix: mat4x4f;uniform vGeometryTangentInfos: vec2f;uniform geometryTangentMatrix: mat4x4f;uniform vGeometryCoatNormalInfos: vec2f;uniform geometryCoatNormalMatrix: mat4x4f;uniform vGeometryCoatTangentInfos: vec2f;uniform geometryCoatTangentMatrix: mat4x4f;uniform vGeometryOpacityInfos: vec2f;uniform geometryOpacityMatrix: mat4x4f;uniform vEmissionInfos: vec2f;uniform emissionMatrix: mat4x4f;uniform vThinFilmWeightInfos: vec2f;uniform thinFilmWeightMatrix: mat4x4f;uniform vThinFilmThicknessInfos: vec2f;uniform thinFilmThicknessMatrix: mat4x4f;uniform vAmbientOcclusionInfos: vec2f;uniform ambientOcclusionMatrix: mat4x4f; +#define ADDITIONAL_UBO_DECLARATION +#include +#include +`;o.IncludesShadersStoreWGSL[f]||(o.IncludesShadersStoreWGSL[f]=i); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ordinal-BeghXfj9.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ordinal-BeghXfj9.js new file mode 100644 index 0000000000000000000000000000000000000000..7908cf03f736d9fe5593fc776051c9f4ccf4d90d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ordinal-BeghXfj9.js @@ -0,0 +1 @@ +import{i as p}from"./init-Dmth1JHB.js";class a extends Map{constructor(e,n=h){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,s]of e)this.set(r,s)}get(e){return super.get(o(this,e))}has(e){return super.has(o(this,e))}set(e,n){return super.set(f(this,e),n)}delete(e){return super.delete(l(this,e))}}class m extends Set{constructor(e,n=h){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const r of e)this.add(r)}has(e){return super.has(o(this,e))}add(e){return super.add(f(this,e))}delete(e){return super.delete(l(this,e))}}function o({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function f({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function l({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function h(t){return t!==null&&typeof t=="object"?t.valueOf():t}const c=Symbol("implicit");function d(){var t=new a,e=[],n=[],r=c;function s(u){let i=t.get(u);if(i===void 0){if(r!==c)return r;t.set(u,i=e.push(u)-1)}return n[i%n.length]}return s.domain=function(u){if(!arguments.length)return e.slice();e=[],t=new a;for(const i of u)t.has(i)||t.set(i,e.push(i)-1);return s},s.range=function(u){return arguments.length?(n=Array.from(u),s):n.slice()},s.unknown=function(u){return arguments.length?(r=u,s):r},s.copy=function(){return d(e,n).unknown(r)},p.apply(s,arguments),s}export{m as I,c as i,d as o}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/packingFunctions-BOaWr_dk.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/packingFunctions-BOaWr_dk.js new file mode 100644 index 0000000000000000000000000000000000000000..e1774b69e6a84604cce2d80724a6d41298bb3e4b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/packingFunctions-BOaWr_dk.js @@ -0,0 +1,4 @@ +import{S as e}from"./index-CDrXokXW.js";const t="packingFunctions",c=`fn pack(depth: f32)->vec4f +{const bit_shift: vec4f= vec4f(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const bit_mask: vec4f= vec4f(0.0,1.0/255.0,1.0/255.0,1.0/255.0);var res: vec4f=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} +fn unpack(color: vec4f)->f32 +{const bit_shift: vec4f= vec4f(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(color,bit_shift);}`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=c); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/packingFunctions-BPfzqklr.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/packingFunctions-BPfzqklr.js new file mode 100644 index 0000000000000000000000000000000000000000..24b24136bda4be1f762c04f598a9588253c155ca --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/packingFunctions-BPfzqklr.js @@ -0,0 +1,4 @@ +import{S as t}from"./index-CDrXokXW.js";const e="packingFunctions",c=`vec4 pack(float depth) +{const vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} +float unpack(vec4 color) +{const vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(color,bit_shift);}`;t.IncludesShadersStore[e]||(t.IncludesShadersStore[e]=c); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pass.fragment-CTt6kMR9.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pass.fragment-CTt6kMR9.js new file mode 100644 index 0000000000000000000000000000000000000000..1a04e7fdc20a8f488dd6fb97ad288f6d9f6875d0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pass.fragment-CTt6kMR9.js @@ -0,0 +1,4 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="passPixelShader",t=`varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d; +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,input.vUV);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=t);const p={name:e,shader:t};export{p as passPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pass.fragment-DOtTp0aB.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pass.fragment-DOtTp0aB.js new file mode 100644 index 0000000000000000000000000000000000000000..a8a1930c501cfd3b23a02323d6854b119508b153 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pass.fragment-DOtTp0aB.js @@ -0,0 +1,4 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="passPixelShader",a=`varying vec2 vUV;uniform sampler2D textureSampler; +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) +{gl_FragColor=texture2D(textureSampler,vUV);}`;r.ShadersStore[e]||(r.ShadersStore[e]=a);const S={name:e,shader:a};export{S as passPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/passCube.fragment-CZ0sbEYV.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/passCube.fragment-CZ0sbEYV.js new file mode 100644 index 0000000000000000000000000000000000000000..6c7e52eaa901ee29276c8328cd742df71999be79 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/passCube.fragment-CZ0sbEYV.js @@ -0,0 +1,23 @@ +import{S as t}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="passCubePixelShader",r=`varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_cube; +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var uv: vec2f=input.vUV*2.0-1.0; +#ifdef POSITIVEX +fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,vec3f(1.001,uv.y,uv.x)); +#endif +#ifdef NEGATIVEX +fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,vec3f(-1.001,uv.y,uv.x)); +#endif +#ifdef POSITIVEY +fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,vec3f(uv.y,1.001,uv.x)); +#endif +#ifdef NEGATIVEY +fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,vec3f(uv.y,-1.001,uv.x)); +#endif +#ifdef POSITIVEZ +fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,vec3f(uv,1.001)); +#endif +#ifdef NEGATIVEZ +fragmentOutputs.color=textureSample(textureSampler,textureSamplerSampler,vec3f(uv,-1.001)); +#endif +}`;t.ShadersStoreWGSL[e]||(t.ShadersStoreWGSL[e]=r);const S={name:e,shader:r};export{S as passCubePixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/passCube.fragment-plsc4uSf.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/passCube.fragment-plsc4uSf.js new file mode 100644 index 0000000000000000000000000000000000000000..e5cee108509d47ae9269c0b913612490d667131e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/passCube.fragment-plsc4uSf.js @@ -0,0 +1,23 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="passCubePixelShader",t=`varying vec2 vUV;uniform samplerCube textureSampler; +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) +{vec2 uv=vUV*2.0-1.0; +#ifdef POSITIVEX +gl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x)); +#endif +#ifdef NEGATIVEX +gl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x)); +#endif +#ifdef POSITIVEY +gl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x)); +#endif +#ifdef NEGATIVEY +gl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x)); +#endif +#ifdef POSITIVEZ +gl_FragColor=textureCube(textureSampler,vec3(uv,1.001)); +#endif +#ifdef NEGATIVEZ +gl_FragColor=textureCube(textureSampler,vec3(uv,-1.001)); +#endif +}`;r.ShadersStore[e]||(r.ShadersStore[e]=t);const o={name:e,shader:t};export{o as passCubePixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbr.fragment-D0TIhE0g.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbr.fragment-D0TIhE0g.js new file mode 100644 index 0000000000000000000000000000000000000000..bb06df6b03e3435ee0c49ac071fdd9699a003b31 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbr.fragment-D0TIhE0g.js @@ -0,0 +1,2480 @@ +import{S as e}from"./index-CDrXokXW.js";import"./oitFragment-BcbCWH3V.js";import"./pbrUboDeclaration-Bwg_eWAt.js";import"./pbrDebug-FlFed75Q.js";import"./shadowsFragmentFunctions-CTsFFgyf.js";import"./samplerFragmentDeclaration-cxB-jdDJ.js";import"./imageProcessingFunctions-BbtoaTge.js";import"./clipPlaneFragment-C7XUrTAZ.js";import"./logDepthDeclaration-DkdfQs4e.js";import"./fogFragment-DmA8Y7To.js";import"./helperFunctions-CZpZ-EbL.js";import"./hdrFilteringFunctions-DD5EqJpN.js";import"./harmonicsFunctions-DjLTZRig.js";import"./pbrBRDFFunctions-baMKuu65.js";import"./bumpFragment-BDPY2JKo.js";import"./decalFragment-iGkmQ-pm.js";import"./lightFragment-DhtXFpEE.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./meshUboDeclaration-Bk1ASTX2.js";import"./mainUVVaryingDeclaration-gz09aLXv.js";const i="samplerFragmentAlternateDeclaration",O=`#ifdef _DEFINENAME_ +#if _DEFINENAME_DIRECTUV==1 +#define v_VARYINGNAME_UV vMainUV1 +#elif _DEFINENAME_DIRECTUV==2 +#define v_VARYINGNAME_UV vMainUV2 +#elif _DEFINENAME_DIRECTUV==3 +#define v_VARYINGNAME_UV vMainUV3 +#elif _DEFINENAME_DIRECTUV==4 +#define v_VARYINGNAME_UV vMainUV4 +#elif _DEFINENAME_DIRECTUV==5 +#define v_VARYINGNAME_UV vMainUV5 +#elif _DEFINENAME_DIRECTUV==6 +#define v_VARYINGNAME_UV vMainUV6 +#else +varying v_VARYINGNAME_UV: vec2f; +#endif +#endif +`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=O);const r="pbrFragmentSamplersDeclaration",T=`#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo) +#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight) +#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_SAMPLERNAME_,baseDiffuseRoughness) +#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient) +#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity) +#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive) +#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap) +#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_SAMPLERNAME_,reflectivity) +#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_SAMPLERNAME_,microSurface) +#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_SAMPLERNAME_,metallicReflectance) +#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_SAMPLERNAME_,reflectance) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal) +#ifdef CLEARCOAT +#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_SAMPLERNAME_,clearCoat) +#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness) +#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) +var clearCoatRoughnessSamplerSampler: sampler;var clearCoatRoughnessSampler: texture_2d; +#endif +#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_SAMPLERNAME_,clearCoatBump) +#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_SAMPLERNAME_,clearCoatTint) +#endif +#ifdef IRIDESCENCE +#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_SAMPLERNAME_,iridescence) +#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_SAMPLERNAME_,iridescenceThickness) +#endif +#ifdef SHEEN +#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_SAMPLERNAME_,sheen) +#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness) +#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) +var sheenRoughnessSamplerSampler: sampler;var sheenRoughnessSampler: texture_2d; +#endif +#endif +#ifdef ANISOTROPIC +#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_SAMPLERNAME_,anisotropy) +#endif +#ifdef REFLECTION +#ifdef REFLECTIONMAP_3D +var reflectionSamplerSampler: sampler;var reflectionSampler: texture_cube; +#ifdef LODBASEDMICROSFURACE +#else +var reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_cube;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_cube; +#endif +#ifdef USEIRRADIANCEMAP +var irradianceSamplerSampler: sampler;var irradianceSampler: texture_cube; +#endif +#else +var reflectionSamplerSampler: sampler;var reflectionSampler: texture_2d; +#ifdef LODBASEDMICROSFURACE +#else +var reflectionLowSamplerSampler: sampler;var reflectionLowSampler: texture_2d;var reflectionHighSamplerSampler: sampler;var reflectionHighSampler: texture_2d; +#endif +#ifdef USEIRRADIANCEMAP +var irradianceSamplerSampler: sampler;var irradianceSampler: texture_2d; +#endif +#endif +#ifdef REFLECTIONMAP_SKYBOX +varying vPositionUVW: vec3f; +#else +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vDirectionW: vec3f; +#endif +#endif +#endif +#ifdef ENVIRONMENTBRDF +var environmentBrdfSamplerSampler: sampler;var environmentBrdfSampler: texture_2d; +#endif +#ifdef SUBSURFACE +#ifdef SS_REFRACTION +#ifdef SS_REFRACTIONMAP_3D +var refractionSamplerSampler: sampler;var refractionSampler: texture_cube; +#ifdef LODBASEDMICROSFURACE +#else +var refractionLowSamplerSampler: sampler;var refractionLowSampler: texture_cube;var refractionHighSamplerSampler: sampler;var refractionHighSampler: texture_cube; +#endif +#else +var refractionSamplerSampler: sampler;var refractionSampler: texture_2d; +#ifdef LODBASEDMICROSFURACE +#else +var refractionLowSamplerSampler: sampler;var refractionLowSampler: texture_2d;var refractionHighSamplerSampler: sampler;var refractionHighSampler: texture_2d; +#endif +#endif +#endif +#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_SAMPLERNAME_,thickness) +#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_SAMPLERNAME_,refractionIntensity) +#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_SAMPLERNAME_,translucencyIntensity) +#include(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor,_SAMPLERNAME_,translucencyColor) +#endif +#ifdef IBL_CDF_FILTERING +var icdfSamplerSampler: sampler;var icdfSampler: texture_2d; +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=T);const n="pbrBlockAlbedoOpacity",L=`struct albedoOpacityOutParams +{surfaceAlbedo: vec3f, +alpha: f32}; +#define pbr_inline +fn albedoOpacityBlock( +vAlbedoColor: vec4f +#ifdef ALBEDO +,albedoTexture: vec4f +,albedoInfos: vec2f +#endif +,baseWeight: f32 +#ifdef BASE_WEIGHT +,baseWeightTexture: vec4f +,vBaseWeightInfos: vec2f +#endif +#ifdef OPACITY +,opacityMap: vec4f +,vOpacityInfos: vec2f +#endif +#ifdef DETAIL +,detailColor: vec4f +,vDetailInfos: vec4f +#endif +#ifdef DECAL +,decalColor: vec4f +,vDecalInfos: vec4f +#endif +)->albedoOpacityOutParams +{var outParams: albedoOpacityOutParams;var surfaceAlbedo: vec3f=vAlbedoColor.rgb;var alpha: f32=vAlbedoColor.a; +#ifdef ALBEDO +#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST) +alpha*=albedoTexture.a; +#endif +#ifdef GAMMAALBEDO +surfaceAlbedo*=toLinearSpaceVec3(albedoTexture.rgb); +#else +surfaceAlbedo*=albedoTexture.rgb; +#endif +surfaceAlbedo*=albedoInfos.y; +#endif +#ifndef DECAL_AFTER_DETAIL +#include +#endif +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +surfaceAlbedo*=fragmentInputs.vColor.rgb; +#endif +#ifdef DETAIL +var detailAlbedo: f32=2.0*mix(0.5,detailColor.r,vDetailInfos.y);surfaceAlbedo=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo; +#endif +#ifdef DECAL_AFTER_DETAIL +#include +#endif +#define CUSTOM_FRAGMENT_UPDATE_ALBEDO +surfaceAlbedo*=baseWeight; +#ifdef BASE_WEIGHT +surfaceAlbedo*=baseWeightTexture.r; +#endif +#ifdef OPACITY +#ifdef OPACITYRGB +alpha=getLuminance(opacityMap.rgb); +#else +alpha*=opacityMap.a; +#endif +alpha*=vOpacityInfos.y; +#endif +#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES) +alpha*=fragmentInputs.vColor.a; +#endif +#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL) +#ifdef ALPHATEST +#if DEBUGMODE != 88 +if (alpha0 +#ifdef METALLICWORKFLOW +#ifdef REFLECTIVITY +surfaceMetallicColorMap: vec4f, +#endif +metallicF0: vec3f, +#else +#ifdef REFLECTIVITY +surfaceReflectivityColorMap: vec4f, +#endif +#endif +#endif +}; +#define pbr_inline +fn reflectivityBlock( +reflectivityColor: vec4f +#ifdef METALLICWORKFLOW +,surfaceAlbedo: vec3f +,metallicReflectanceFactors: vec4f +#endif +,baseDiffuseRoughness: f32 +#ifdef BASE_DIFFUSE_ROUGHNESS +,baseDiffuseRoughnessTexture: f32 +,baseDiffuseRoughnessInfos: vec2f +#endif +#ifdef REFLECTIVITY +,reflectivityInfos: vec3f +,surfaceMetallicOrReflectivityColorMap: vec4f +#endif +#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED) +,ambientOcclusionColorIn: vec3f +#endif +#ifdef MICROSURFACEMAP +,microSurfaceTexel: vec4f +#endif +#ifdef DETAIL +,detailColor: vec4f +,vDetailInfos: vec4f +#endif +)->reflectivityOutParams +{var outParams: reflectivityOutParams;var microSurface: f32=reflectivityColor.a;var surfaceReflectivityColor: vec3f=reflectivityColor.rgb; +#ifdef METALLICWORKFLOW +var metallicRoughness: vec2f=surfaceReflectivityColor.rg;var ior: f32=surfaceReflectivityColor.b; +#ifdef REFLECTIVITY +#if DEBUGMODE>0 +outParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap; +#endif +#ifdef AOSTOREINMETALMAPRED +var aoStoreInMetalMap: vec3f= vec3f(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);outParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,reflectivityInfos.z); +#endif +#ifdef METALLNESSSTOREINMETALMAPBLUE +metallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b; +#else +metallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r; +#endif +#ifdef ROUGHNESSSTOREINMETALMAPALPHA +metallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a; +#else +#ifdef ROUGHNESSSTOREINMETALMAPGREEN +metallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g; +#endif +#endif +#endif +#ifdef DETAIL +var detailRoughness: f32=mix(0.5,detailColor.b,vDetailInfos.w);var loLerp: f32=mix(0.,metallicRoughness.g,detailRoughness*2.);var hiLerp: f32=mix(metallicRoughness.g,1.,(detailRoughness-0.5)*2.);metallicRoughness.g=mix(loLerp,hiLerp,step(detailRoughness,0.5)); +#endif +#ifdef MICROSURFACEMAP +metallicRoughness.g*=microSurfaceTexel.r; +#endif +#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS +microSurface=1.0-metallicRoughness.g;var baseColor: vec3f=surfaceAlbedo;outParams.metallic=metallicRoughness.r;outParams.specularWeight=metallicReflectanceFactors.a;var dielectricF0 : f32=reflectivityColor.a*outParams.specularWeight;surfaceReflectivityColor=metallicReflectanceFactors.rgb; +#if DEBUGMODE>0 +outParams.metallicF0=dielectricF0*surfaceReflectivityColor; +#endif +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +outParams.surfaceAlbedo=baseColor.rgb*(vec3f(1.0)-vec3f(dielectricF0)*surfaceReflectivityColor)*(1.0-outParams.metallic); +#else +outParams.surfaceAlbedo=baseColor.rgb; +#endif +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +{let reflectivityColor: vec3f=mix(dielectricF0*surfaceReflectivityColor,baseColor.rgb,outParams.metallic);outParams.reflectanceF0=max(reflectivityColor.r,max(reflectivityColor.g,reflectivityColor.b));} +#else +#if DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_GLTF +let maxF0: f32=max(surfaceReflectivityColor.r,max(surfaceReflectivityColor.g,surfaceReflectivityColor.b));outParams.reflectanceF0=mix(dielectricF0*maxF0,1.0f,outParams.metallic); +#else +outParams.reflectanceF0=mix(dielectricF0,1.0,outParams.metallic); +#endif +#endif +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +outParams.reflectanceF90=vec3(outParams.specularWeight);var f90Scale: f32=1.0; +#else +var f90Scale: f32=clamp(2.0*(ior-1.0),0.0,1.0);outParams.reflectanceF90=vec3(mix( +outParams.specularWeight*f90Scale,1.0,outParams.metallic)); +#endif +outParams.dielectricColorF0=vec3f(dielectricF0*surfaceReflectivityColor);var metallicColorF0: vec3f=baseColor.rgb;outParams.colorReflectanceF0=mix(outParams.dielectricColorF0,metallicColorF0,outParams.metallic); +#if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR) +let dielectricColorF90 +: vec3f=surfaceReflectivityColor * +vec3f(outParams.specularWeight*f90Scale); +#else +let dielectricColorF90 +: vec3f=vec3f(outParams.specularWeight*f90Scale); +#endif +#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) +let conductorColorF90: vec3f=surfaceReflectivityColor; +#else +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +let conductorColorF90: vec3f=outParams.reflectanceF90; +#else +let conductorColorF90: vec3f=vec3f(1.0f); +#endif +#endif +outParams.colorReflectanceF90=mix(dielectricColorF90,conductorColorF90,outParams.metallic); +#else +#ifdef REFLECTIVITY +surfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb; +#if DEBUGMODE>0 +outParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap; +#endif +#ifdef MICROSURFACEFROMREFLECTIVITYMAP +microSurface*=surfaceMetallicOrReflectivityColorMap.a;microSurface*=reflectivityInfos.z; +#else +#ifdef MICROSURFACEAUTOMATIC +microSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor); +#endif +#ifdef MICROSURFACEMAP +microSurface*=microSurfaceTexel.r; +#endif +#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE +#endif +#endif +outParams.colorReflectanceF0=surfaceReflectivityColor;outParams.reflectanceF0=max(surfaceReflectivityColor.r,max(surfaceReflectivityColor.g,surfaceReflectivityColor.b));outParams.reflectanceF90=vec3f(1.0); +#if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR) +outParams.colorReflectanceF90=surfaceReflectivityColor; +#else +outParams.colorReflectanceF90=vec3(1.0); +#endif +#endif +microSurface=saturate(microSurface);var roughness: f32=1.-microSurface;var diffuseRoughness: f32=baseDiffuseRoughness; +#ifdef BASE_DIFFUSE_ROUGHNESS +diffuseRoughness*=baseDiffuseRoughnessTexture*baseDiffuseRoughnessInfos.y; +#endif +outParams.microSurface=microSurface;outParams.roughness=roughness;outParams.diffuseRoughness=diffuseRoughness;return outParams;} +`;e.IncludesShadersStoreWGSL[f]||(e.IncludesShadersStoreWGSL[f]=_);const o="pbrBlockAmbientOcclusion",M=`struct ambientOcclusionOutParams +{ambientOcclusionColor: vec3f, +#if DEBUGMODE>0 && defined(AMBIENT) +ambientOcclusionColorMap: vec3f +#endif +}; +#define pbr_inline +fn ambientOcclusionBlock( +#ifdef AMBIENT +ambientOcclusionColorMap_: vec3f, +vAmbientInfos: vec4f +#endif +)->ambientOcclusionOutParams +{ +var outParams: ambientOcclusionOutParams;var ambientOcclusionColor: vec3f= vec3f(1.,1.,1.); +#ifdef AMBIENT +var ambientOcclusionColorMap: vec3f=ambientOcclusionColorMap_*vAmbientInfos.y; +#ifdef AMBIENTINGRAYSCALE +ambientOcclusionColorMap= vec3f(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r); +#endif +ambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z); +#if DEBUGMODE>0 +outParams.ambientOcclusionColorMap=ambientOcclusionColorMap; +#endif +#endif +outParams.ambientOcclusionColor=ambientOcclusionColor;return outParams;} +`;e.IncludesShadersStoreWGSL[o]||(e.IncludesShadersStoreWGSL[o]=M);const t="pbrBlockAlphaFresnel",F=`#ifdef ALPHAFRESNEL +#if defined(ALPHATEST) || defined(ALPHABLEND) +struct alphaFresnelOutParams +{alpha: f32};fn faceforward(N: vec3,I: vec3,Nref: vec3)->vec3 {return select(N,-N,dot(Nref,I)>0.0);} +#define pbr_inline +fn alphaFresnelBlock( +normalW: vec3f, +viewDirectionW: vec3f, +alpha: f32, +microSurface: f32 +)->alphaFresnelOutParams +{var outParams: alphaFresnelOutParams;var opacityPerceptual: f32=alpha; +#ifdef LINEARALPHAFRESNEL +var opacity0: f32=opacityPerceptual; +#else +var opacity0: f32=opacityPerceptual*opacityPerceptual; +#endif +var opacity90: f32=fresnelGrazingReflectance(opacity0);var normalForward: vec3f=faceforward(normalW,-viewDirectionW,normalW);outParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)), vec3f(opacity0), vec3f(opacity90),sqrt(microSurface)).x; +#ifdef ALPHATEST +if (outParams.alpha0 && defined(ANISOTROPIC_TEXTURE) +anisotropyMapData: vec3f +#endif +}; +#define pbr_inline +fn anisotropicBlock( +vAnisotropy: vec3f, +roughness: f32, +#ifdef ANISOTROPIC_TEXTURE +anisotropyMapData: vec3f, +#endif +TBN: mat3x3f, +normalW: vec3f, +viewDirectionW: vec3f +)->anisotropicOutParams +{ +var outParams: anisotropicOutParams;var anisotropy: f32=vAnisotropy.b;var anisotropyDirection: vec3f= vec3f(vAnisotropy.xy,0.); +#ifdef ANISOTROPIC_TEXTURE +var amd=anisotropyMapData.rg;anisotropy*=anisotropyMapData.b; +#if DEBUGMODE>0 +outParams.anisotropyMapData=anisotropyMapData; +#endif +amd=amd*2.0-1.0; +#ifdef ANISOTROPIC_LEGACY +anisotropyDirection=vec3f(anisotropyDirection.xy*amd,anisotropyDirection.z); +#else +anisotropyDirection=vec3f(mat2x2f(anisotropyDirection.x,anisotropyDirection.y,-anisotropyDirection.y,anisotropyDirection.x)*normalize(amd),anisotropyDirection.z); +#endif +#endif +var anisoTBN: mat3x3f= mat3x3f(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));var anisotropicTangent: vec3f=normalize(anisoTBN*anisotropyDirection);var anisotropicBitangent: vec3f=normalize(cross(anisoTBN[2],anisotropicTangent));outParams.anisotropy=anisotropy;outParams.anisotropicTangent=anisotropicTangent;outParams.anisotropicBitangent=anisotropicBitangent;outParams.anisotropicNormal=getAnisotropicBentNormals(anisotropicTangent,anisotropicBitangent,normalW,viewDirectionW,anisotropy,roughness);return outParams;} +#endif +`;e.IncludesShadersStoreWGSL[c]||(e.IncludesShadersStoreWGSL[c]=D);const l="pbrBlockReflection",h=`#ifdef REFLECTION +struct reflectionOutParams +{environmentRadiance: vec4f +,environmentIrradiance: vec3f +#ifdef REFLECTIONMAP_3D +,reflectionCoords: vec3f +#else +,reflectionCoords: vec2f +#endif +#ifdef SS_TRANSLUCENCY +#ifdef USESPHERICALFROMREFLECTIONMAP +#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX) +,irradianceVector: vec3f +#endif +#endif +#endif +}; +#define pbr_inline +#ifdef REFLECTIONMAP_3D +fn createReflectionCoords( +vPositionW: vec3f, +normalW: vec3f, +#ifdef ANISOTROPIC +anisotropicOut: anisotropicOutParams, +#endif +)->vec3f +{var reflectionCoords: vec3f; +#else +fn createReflectionCoords( +vPositionW: vec3f, +normalW: vec3f, +#ifdef ANISOTROPIC +anisotropicOut: anisotropicOutParams, +#endif +)->vec2f +{ +var reflectionCoords: vec2f; +#endif +#ifdef ANISOTROPIC +var reflectionVector: vec3f=computeReflectionCoords( vec4f(vPositionW,1.0),anisotropicOut.anisotropicNormal); +#else +var reflectionVector: vec3f=computeReflectionCoords( vec4f(vPositionW,1.0),normalW); +#endif +#ifdef REFLECTIONMAP_OPPOSITEZ +reflectionVector.z*=-1.0; +#endif +#ifdef REFLECTIONMAP_3D +reflectionCoords=reflectionVector; +#else +reflectionCoords=reflectionVector.xy; +#ifdef REFLECTIONMAP_PROJECTION +reflectionCoords/=reflectionVector.z; +#endif +reflectionCoords.y=1.0-reflectionCoords.y; +#endif +return reflectionCoords;} +#define pbr_inline +fn sampleReflectionTexture( +alphaG: f32 +,vReflectionMicrosurfaceInfos: vec3f +,vReflectionInfos: vec2f +,vReflectionColor: vec3f +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +,NdotVUnclamped: f32 +#endif +#ifdef LINEARSPECULARREFLECTION +,roughness: f32 +#endif +#ifdef REFLECTIONMAP_3D +,reflectionSampler: texture_cube +,reflectionSamplerSampler: sampler +,reflectionCoords: vec3f +#else +,reflectionSampler: texture_2d +,reflectionSamplerSampler: sampler +,reflectionCoords: vec2f +#endif +#ifndef LODBASEDMICROSFURACE +#ifdef REFLECTIONMAP_3D +,reflectionLowSampler: texture_cube +,reflectionLowSamplerSampler: sampler +,reflectionHighSampler: texture_cube +,reflectionHighSamplerSampler: sampler +#else +,reflectionLowSampler: texture_2d +,reflectionLowSamplerSampler: sampler +,reflectionHighSampler: texture_2d +,reflectionHighSamplerSampler: sampler +#endif +#endif +#ifdef REALTIME_FILTERING +,vReflectionFilteringInfo: vec2f +#endif +)->vec4f +{var environmentRadiance: vec4f; +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +var reflectionLOD: f32=getLodFromAlphaGNdotV(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped); +#elif defined(LINEARSPECULARREFLECTION) +var reflectionLOD: f32=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness); +#else +var reflectionLOD: f32=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG); +#endif +#ifdef LODBASEDMICROSFURACE +reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z; +#ifdef LODINREFLECTIONALPHA +var automaticReflectionLOD: f32=UNPACK_LOD(textureSample(reflectionSampler,reflectionSamplerSampler,reflectionCoords).a);var requestedReflectionLOD: f32=max(automaticReflectionLOD,reflectionLOD); +#else +var requestedReflectionLOD: f32=reflectionLOD; +#endif +#ifdef REALTIME_FILTERING +environmentRadiance= vec4f(radiance(alphaG,reflectionSampler,reflectionSamplerSampler,reflectionCoords,vReflectionFilteringInfo),1.0); +#else +environmentRadiance=textureSampleLevel(reflectionSampler,reflectionSamplerSampler,reflectionCoords,reflectionLOD); +#endif +#else +var lodReflectionNormalized: f32=saturate(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x));var lodReflectionNormalizedDoubled: f32=lodReflectionNormalized*2.0;var environmentMid: vec4f=textureSample(reflectionSampler,reflectionSamplerSampler,reflectionCoords);if (lodReflectionNormalizedDoubled<1.0){environmentRadiance=mix( +textureSample(reflectionHighSampler,reflectionHighSamplerSampler,reflectionCoords), +environmentMid, +lodReflectionNormalizedDoubled +);} else {environmentRadiance=mix( +environmentMid, +textureSample(reflectionLowSampler,reflectionLowSamplerSampler,reflectionCoords), +lodReflectionNormalizedDoubled-1.0 +);} +#endif +var envRadiance=environmentRadiance.rgb; +#ifdef RGBDREFLECTION +envRadiance=fromRGBD(environmentRadiance); +#endif +#ifdef GAMMAREFLECTION +envRadiance=toLinearSpaceVec3(environmentRadiance.rgb); +#endif +envRadiance*=vReflectionInfos.x;envRadiance*=vReflectionColor.rgb;return vec4f(envRadiance,environmentRadiance.a);} +#define pbr_inline +fn reflectionBlock( +vPositionW: vec3f +,normalW: vec3f +,alphaG: f32 +,vReflectionMicrosurfaceInfos: vec3f +,vReflectionInfos: vec2f +,vReflectionColor: vec3f +#ifdef ANISOTROPIC +,anisotropicOut: anisotropicOutParams +#endif +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +,NdotVUnclamped: f32 +#endif +#ifdef LINEARSPECULARREFLECTION +,roughness: f32 +#endif +#ifdef REFLECTIONMAP_3D +,reflectionSampler: texture_cube +,reflectionSamplerSampler: sampler +#else +,reflectionSampler: texture_2d +,reflectionSamplerSampler: sampler +#endif +#if defined(NORMAL) && defined(USESPHERICALINVERTEX) +,vEnvironmentIrradiance: vec3f +#endif +#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D)) +,reflectionMatrix: mat4x4f +#endif +#ifdef USEIRRADIANCEMAP +#ifdef REFLECTIONMAP_3D +,irradianceSampler: texture_cube +,irradianceSamplerSampler: sampler +#else +,irradianceSampler: texture_2d +,irradianceSamplerSampler: sampler +#endif +#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION +,reflectionDominantDirection: vec3f +#endif +#endif +#ifndef LODBASEDMICROSFURACE +#ifdef REFLECTIONMAP_3D +,reflectionLowSampler: texture_cube +,reflectionLowSamplerSampler: sampler +,reflectionHighSampler: texture_cube +,reflectionHighSamplerSampler: sampler +#else +,reflectionLowSampler: texture_2d +,reflectionLowSamplerSampler: sampler +,reflectionHighSampler: texture_2d +,reflectionHighSamplerSampler: sampler +#endif +#endif +#ifdef REALTIME_FILTERING +,vReflectionFilteringInfo: vec2f +#ifdef IBL_CDF_FILTERING +,icdfSampler: texture_2d +,icdfSamplerSampler: sampler +#endif +#endif +,viewDirectionW: vec3f +,diffuseRoughness: f32 +,surfaceAlbedo: vec3f +)->reflectionOutParams +{var outParams: reflectionOutParams;var environmentRadiance: vec4f= vec4f(0.,0.,0.,0.); +#ifdef REFLECTIONMAP_3D +var reflectionCoords: vec3f= vec3f(0.); +#else +var reflectionCoords: vec2f= vec2f(0.); +#endif +reflectionCoords=createReflectionCoords( +vPositionW, +normalW, +#ifdef ANISOTROPIC +anisotropicOut, +#endif +);environmentRadiance=sampleReflectionTexture( +alphaG +,vReflectionMicrosurfaceInfos +,vReflectionInfos +,vReflectionColor +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +,NdotVUnclamped +#endif +#ifdef LINEARSPECULARREFLECTION +,roughness +#endif +#ifdef REFLECTIONMAP_3D +,reflectionSampler +,reflectionSamplerSampler +,reflectionCoords +#else +,reflectionSampler +,reflectionSamplerSampler +,reflectionCoords +#endif +#ifndef LODBASEDMICROSFURACE +,reflectionLowSampler +,reflectionLowSamplerSampler +,reflectionHighSampler +,reflectionHighSamplerSampler +#endif +#ifdef REALTIME_FILTERING +,vReflectionFilteringInfo +#endif +);var environmentIrradiance: vec3f= vec3f(0.,0.,0.); +#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D)) +#ifdef ANISOTROPIC +var irradianceVector: vec3f= (reflectionMatrix* vec4f(anisotropicOut.anisotropicNormal,0)).xyz; +#else +var irradianceVector: vec3f= (reflectionMatrix* vec4f(normalW,0)).xyz; +#endif +var irradianceView: vec3f= (reflectionMatrix* vec4f(viewDirectionW,0)).xyz; +#if !defined(USE_IRRADIANCE_DOMINANT_DIRECTION) && !defined(REALTIME_FILTERING) +#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY +var NdotV: f32=max(dot(normalW,viewDirectionW),0.0);irradianceVector=mix(irradianceVector,irradianceView,(0.5*(1.0-NdotV))*diffuseRoughness); +#endif +#endif +#ifdef REFLECTIONMAP_OPPOSITEZ +irradianceVector.z*=-1.0; +#endif +#ifdef INVERTCUBICMAP +irradianceVector.y*=-1.0; +#endif +#endif +#ifdef USESPHERICALFROMREFLECTIONMAP +#if defined(NORMAL) && defined(USESPHERICALINVERTEX) +environmentIrradiance=vEnvironmentIrradiance; +#else +#if defined(REALTIME_FILTERING) +environmentIrradiance=irradiance(reflectionSampler,reflectionSamplerSampler,irradianceVector,vReflectionFilteringInfo,diffuseRoughness,surfaceAlbedo,irradianceView +#ifdef IBL_CDF_FILTERING +,icdfSampler +,icdfSamplerSampler +#endif +); +#else +environmentIrradiance=computeEnvironmentIrradiance(irradianceVector); +#endif +#ifdef SS_TRANSLUCENCY +outParams.irradianceVector=irradianceVector; +#endif +#endif +#elif defined(USEIRRADIANCEMAP) +#ifdef REFLECTIONMAP_3D +var environmentIrradiance4: vec4f=textureSample(irradianceSampler,irradianceSamplerSampler,irradianceVector); +#else +var environmentIrradiance4: vec4f=textureSample(irradianceSampler,irradianceSamplerSampler,reflectionCoords); +#endif +#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION +var Ls: vec3f=normalize(reflectionDominantDirection);var NoL: f32=dot(irradianceVector,Ls);var NoV: f32=dot(irradianceVector,irradianceView);var diffuseRoughnessTerm: vec3f=vec3f(1.0); +#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON +var LoV: f32=dot(Ls,irradianceView);var mag: f32=length(reflectionDominantDirection)*2.0f;var clampedAlbedo: vec3f=clamp(surfaceAlbedo,vec3f(0.1),vec3f(1.0));diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;diffuseRoughnessTerm=diffuseRoughnessTerm/clampedAlbedo;diffuseRoughnessTerm=mix(vec3f(1.0),diffuseRoughnessTerm,sqrt(clamp(mag*NoV,0.0,1.0f))); +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY +var H: vec3f=(irradianceView+Ls)*0.5f;var VoH: f32=dot(irradianceView,H);diffuseRoughnessTerm=vec3f(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI); +#endif +environmentIrradiance=environmentIrradiance4.rgb*diffuseRoughnessTerm; +#else +environmentIrradiance=environmentIrradiance4.rgb; +#endif +#ifdef RGBDREFLECTION +environmentIrradiance=fromRGBD(environmentIrradiance4); +#endif +#ifdef GAMMAREFLECTION +environmentIrradiance=toLinearSpaceVec3(environmentIrradiance.rgb); +#endif +#endif +environmentIrradiance*=vReflectionColor.rgb*vReflectionInfos.x; +#ifdef MIX_IBL_RADIANCE_WITH_IRRADIANCE +outParams.environmentRadiance=vec4f(mix(environmentRadiance.rgb,environmentIrradiance,alphaG),environmentRadiance.a); +#else +outParams.environmentRadiance=environmentRadiance; +#endif +outParams.environmentIrradiance=environmentIrradiance;outParams.reflectionCoords=reflectionCoords;return outParams;} +#endif +`;e.IncludesShadersStoreWGSL[l]||(e.IncludesShadersStoreWGSL[l]=h);const d="pbrBlockSheen",g=`#ifdef SHEEN +struct sheenOutParams +{sheenIntensity: f32 +,sheenColor: vec3f +,sheenRoughness: f32 +#ifdef SHEEN_LINKWITHALBEDO +,surfaceAlbedo: vec3f +#endif +#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING) +,sheenAlbedoScaling: f32 +#endif +#if defined(REFLECTION) && defined(ENVIRONMENTBRDF) +,finalSheenRadianceScaled: vec3f +#endif +#if DEBUGMODE>0 +#ifdef SHEEN_TEXTURE +,sheenMapData: vec4f +#endif +#if defined(REFLECTION) && defined(ENVIRONMENTBRDF) +,sheenEnvironmentReflectance: vec3f +#endif +#endif +}; +#define pbr_inline +fn sheenBlock( +vSheenColor: vec4f +#ifdef SHEEN_ROUGHNESS +,vSheenRoughness: f32 +#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE) +,sheenMapRoughnessData: vec4f +#endif +#endif +,roughness: f32 +#ifdef SHEEN_TEXTURE +,sheenMapData: vec4f +,sheenMapLevel: f32 +#endif +,reflectance: f32 +#ifdef SHEEN_LINKWITHALBEDO +,baseColor: vec3f +,surfaceAlbedo: vec3f +#endif +#ifdef ENVIRONMENTBRDF +,NdotV: f32 +,environmentBrdf: vec3f +#endif +#if defined(REFLECTION) && defined(ENVIRONMENTBRDF) +,AARoughnessFactors: vec2f +,vReflectionMicrosurfaceInfos: vec3f +,vReflectionInfos: vec2f +,vReflectionColor: vec3f +,vLightingIntensity: vec4f +#ifdef REFLECTIONMAP_3D +,reflectionSampler: texture_cube +,reflectionSamplerSampler: sampler +,reflectionCoords: vec3f +#else +,reflectionSampler: texture_2d +,reflectionSamplerSampler: sampler +,reflectionCoords: vec2f +#endif +,NdotVUnclamped: f32 +#ifndef LODBASEDMICROSFURACE +#ifdef REFLECTIONMAP_3D +,reflectionLowSampler: texture_cube +,reflectionLowSamplerSampler: sampler +,reflectionHighSampler: texture_cube +,reflectionHighSamplerSampler: sampler +#else +,reflectionLowSampler: texture_2d +,reflectionLowSamplerSampler: sampler +,reflectionHighSampler: texture_2d +,reflectionHighSamplerSampler: sampler +#endif +#endif +#ifdef REALTIME_FILTERING +,vReflectionFilteringInfo: vec2f +#endif +#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION) +,seo: f32 +#endif +#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D) +,eho: f32 +#endif +#endif +)->sheenOutParams +{var outParams: sheenOutParams;var sheenIntensity: f32=vSheenColor.a; +#ifdef SHEEN_TEXTURE +#if DEBUGMODE>0 +outParams.sheenMapData=sheenMapData; +#endif +#endif +#ifdef SHEEN_LINKWITHALBEDO +var sheenFactor: f32=pow5(1.0-sheenIntensity);var sheenColor: vec3f=baseColor.rgb*(1.0-sheenFactor);var sheenRoughness: f32=sheenIntensity;outParams.surfaceAlbedo=surfaceAlbedo*sheenFactor; +#ifdef SHEEN_TEXTURE +sheenIntensity*=sheenMapData.a; +#endif +#else +var sheenColor: vec3f=vSheenColor.rgb; +#ifdef SHEEN_TEXTURE +#ifdef SHEEN_GAMMATEXTURE +sheenColor*=toLinearSpaceVec3(sheenMapData.rgb); +#else +sheenColor*=sheenMapData.rgb; +#endif +sheenColor*=sheenMapLevel; +#endif +#ifdef SHEEN_ROUGHNESS +var sheenRoughness: f32=vSheenRoughness; +#ifdef SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE +#if defined(SHEEN_TEXTURE) +sheenRoughness*=sheenMapData.a; +#endif +#elif defined(SHEEN_TEXTURE_ROUGHNESS) +sheenRoughness*=sheenMapRoughnessData.a; +#endif +#else +var sheenRoughness: f32=roughness; +#ifdef SHEEN_TEXTURE +sheenIntensity*=sheenMapData.a; +#endif +#endif +#if !defined(SHEEN_ALBEDOSCALING) +sheenIntensity*=(1.-reflectance); +#endif +sheenColor*=sheenIntensity; +#endif +#ifdef ENVIRONMENTBRDF +/*#ifdef SHEEN_SOFTER +var environmentSheenBrdf: vec3f= vec3f(0.,0.,getBRDFLookupCharlieSheen(NdotV,sheenRoughness)); +#else*/ +#ifdef SHEEN_ROUGHNESS +var environmentSheenBrdf: vec3f=getBRDFLookup(NdotV,sheenRoughness); +#else +var environmentSheenBrdf: vec3f=environmentBrdf; +#endif +/*#endif*/ +#endif +#if defined(REFLECTION) && defined(ENVIRONMENTBRDF) +var sheenAlphaG: f32=convertRoughnessToAverageSlope(sheenRoughness); +#ifdef SPECULARAA +sheenAlphaG+=AARoughnessFactors.y; +#endif +var environmentSheenRadiance: vec4f= vec4f(0.,0.,0.,0.);environmentSheenRadiance=sampleReflectionTexture( +sheenAlphaG +,vReflectionMicrosurfaceInfos +,vReflectionInfos +,vReflectionColor +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +,NdotVUnclamped +#endif +#ifdef LINEARSPECULARREFLECTION +,sheenRoughness +#endif +,reflectionSampler +,reflectionSamplerSampler +,reflectionCoords +#ifndef LODBASEDMICROSFURACE +,reflectionLowSampler +,reflectionLowSamplerSampler +,reflectionHighSampler +,reflectionHighSamplerSampler +#endif +#ifdef REALTIME_FILTERING +,vReflectionFilteringInfo +#endif +);var sheenEnvironmentReflectance: vec3f=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf); +#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION) +sheenEnvironmentReflectance*=seo; +#endif +#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D) +sheenEnvironmentReflectance*=eho; +#endif +#if DEBUGMODE>0 +outParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance; +#endif +outParams.finalSheenRadianceScaled= +environmentSheenRadiance.rgb * +sheenEnvironmentReflectance * +vLightingIntensity.z; +#endif +#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING) +outParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b; +#endif +outParams.sheenIntensity=sheenIntensity;outParams.sheenColor=sheenColor;outParams.sheenRoughness=sheenRoughness;return outParams;} +#endif +`;e.IncludesShadersStoreWGSL[d]||(e.IncludesShadersStoreWGSL[d]=g);const s="pbrBlockClearcoat",P=`struct clearcoatOutParams +{specularEnvironmentR0: vec3f, +conservationFactor: f32, +clearCoatNormalW: vec3f, +clearCoatAARoughnessFactors: vec2f, +clearCoatIntensity: f32, +clearCoatRoughness: f32, +#ifdef REFLECTION +finalClearCoatRadianceScaled: vec3f, +#endif +#ifdef CLEARCOAT_TINT +absorption: vec3f, +clearCoatNdotVRefract: f32, +clearCoatColor: vec3f, +clearCoatThickness: f32, +#endif +#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION) +energyConservationFactorClearCoat: vec3f, +#endif +#if DEBUGMODE>0 +#ifdef CLEARCOAT_BUMP +TBNClearCoat: mat3x3f, +#endif +#ifdef CLEARCOAT_TEXTURE +clearCoatMapData: vec2f, +#endif +#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE) +clearCoatTintMapData: vec4f, +#endif +#ifdef REFLECTION +environmentClearCoatRadiance: vec4f, +clearCoatEnvironmentReflectance: vec3f, +#endif +clearCoatNdotV: f32 +#endif +}; +#ifdef CLEARCOAT +#define pbr_inline +fn clearcoatBlock( +vPositionW: vec3f +,geometricNormalW: vec3f +,viewDirectionW: vec3f +,vClearCoatParams: vec2f +#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) +,clearCoatMapRoughnessData: vec4f +#endif +,specularEnvironmentR0: vec3f +#ifdef CLEARCOAT_TEXTURE +,clearCoatMapData: vec2f +#endif +#ifdef CLEARCOAT_TINT +,vClearCoatTintParams: vec4f +,clearCoatColorAtDistance: f32 +,vClearCoatRefractionParams: vec4f +#ifdef CLEARCOAT_TINT_TEXTURE +,clearCoatTintMapData: vec4f +#endif +#endif +#ifdef CLEARCOAT_BUMP +,vClearCoatBumpInfos: vec2f +,clearCoatBumpMapData: vec4f +,vClearCoatBumpUV: vec2f +#if defined(TANGENT) && defined(NORMAL) +,vTBN: mat3x3f +#else +,vClearCoatTangentSpaceParams: vec2f +#endif +#ifdef OBJECTSPACE_NORMALMAP +,normalMatrix: mat4x4f +#endif +#endif +#if defined(FORCENORMALFORWARD) && defined(NORMAL) +,faceNormal: vec3f +#endif +#ifdef REFLECTION +,vReflectionMicrosurfaceInfos: vec3f +,vReflectionInfos: vec2f +,vReflectionColor: vec3f +,vLightingIntensity: vec4f +#ifdef REFLECTIONMAP_3D +,reflectionSampler: texture_cube +,reflectionSamplerSampler: sampler +#else +,reflectionSampler: texture_2d +,reflectionSamplerSampler: sampler +#endif +#ifndef LODBASEDMICROSFURACE +#ifdef REFLECTIONMAP_3D +,reflectionLowSampler: texture_cube +,reflectionLowSamplerSampler: sampler +,reflectionHighSampler: texture_cube +,reflectionHighSamplerSampler: sampler +#else +,reflectionLowSampler: texture_2d +,reflectionLowSamplerSampler: sampler +,reflectionHighSampler: texture_2d +,reflectionHighSamplerSampler: sampler +#endif +#endif +#ifdef REALTIME_FILTERING +,vReflectionFilteringInfo: vec2f +#endif +#endif +#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING) +,frontFacingMultiplier: f32 +#endif +)->clearcoatOutParams +{var outParams: clearcoatOutParams;var clearCoatIntensity: f32=vClearCoatParams.x;var clearCoatRoughness: f32=vClearCoatParams.y; +#ifdef CLEARCOAT_TEXTURE +clearCoatIntensity*=clearCoatMapData.x; +#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE +clearCoatRoughness*=clearCoatMapData.y; +#endif +#if DEBUGMODE>0 +outParams.clearCoatMapData=clearCoatMapData; +#endif +#endif +#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) +clearCoatRoughness*=clearCoatMapRoughnessData.y; +#endif +outParams.clearCoatIntensity=clearCoatIntensity;outParams.clearCoatRoughness=clearCoatRoughness; +#ifdef CLEARCOAT_TINT +var clearCoatColor: vec3f=vClearCoatTintParams.rgb;var clearCoatThickness: f32=vClearCoatTintParams.a; +#ifdef CLEARCOAT_TINT_TEXTURE +#ifdef CLEARCOAT_TINT_GAMMATEXTURE +clearCoatColor*=toLinearSpaceVec3(clearCoatTintMapData.rgb); +#else +clearCoatColor*=clearCoatTintMapData.rgb; +#endif +clearCoatThickness*=clearCoatTintMapData.a; +#if DEBUGMODE>0 +outParams.clearCoatTintMapData=clearCoatTintMapData; +#endif +#endif +outParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);outParams.clearCoatThickness=clearCoatThickness; +#endif +#ifdef CLEARCOAT_REMAP_F0 +var specularEnvironmentR0Updated: vec3f=getR0RemappedForClearCoat(specularEnvironmentR0); +#else +var specularEnvironmentR0Updated: vec3f=specularEnvironmentR0; +#endif +outParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);var clearCoatNormalW: vec3f=geometricNormalW; +#ifdef CLEARCOAT_BUMP +#ifdef NORMALXYSCALE +var clearCoatNormalScale: f32=1.0; +#else +var clearCoatNormalScale: f32=vClearCoatBumpInfos.y; +#endif +#if defined(TANGENT) && defined(NORMAL) +var TBNClearCoat: mat3x3f=vTBN; +#else +var TBNClearCoatUV: vec2f=vClearCoatBumpUV*frontFacingMultiplier;var TBNClearCoat: mat3x3f=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,TBNClearCoatUV,vClearCoatTangentSpaceParams); +#endif +#if DEBUGMODE>0 +outParams.TBNClearCoat=TBNClearCoat; +#endif +#ifdef OBJECTSPACE_NORMALMAP +clearCoatNormalW=normalize(clearCoatBumpMapData.xyz *2.0-1.0);clearCoatNormalW=normalize( mat3x3f(normalMatrix[0].xyz,normalMatrix[1].xyz,normalMatrix[2].xyz)*clearCoatNormalW); +#else +clearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y); +#endif +#endif +#if defined(FORCENORMALFORWARD) && defined(NORMAL) +clearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal)); +#endif +#if defined(TWOSIDEDLIGHTING) && defined(NORMAL) +clearCoatNormalW=clearCoatNormalW*frontFacingMultiplier; +#endif +outParams.clearCoatNormalW=clearCoatNormalW;outParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);var clearCoatNdotVUnclamped: f32=dot(clearCoatNormalW,viewDirectionW);var clearCoatNdotV: f32=absEps(clearCoatNdotVUnclamped); +#if DEBUGMODE>0 +outParams.clearCoatNdotV=clearCoatNdotV; +#endif +#ifdef CLEARCOAT_TINT +var clearCoatVRefract: vec3f=refract(-viewDirectionW,clearCoatNormalW,vClearCoatRefractionParams.y);outParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract)); +#endif +#if defined(ENVIRONMENTBRDF) && (!defined(REFLECTIONMAP_SKYBOX) || defined(MS_BRDF_ENERGY_CONSERVATION)) +var environmentClearCoatBrdf: vec3f=getBRDFLookup(clearCoatNdotV,clearCoatRoughness); +#endif +#if defined(REFLECTION) +var clearCoatAlphaG: f32=convertRoughnessToAverageSlope(clearCoatRoughness); +#ifdef SPECULARAA +clearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y; +#endif +var environmentClearCoatRadiance: vec4f= vec4f(0.,0.,0.,0.);var clearCoatReflectionVector: vec3f=computeReflectionCoords( vec4f(vPositionW,1.0),clearCoatNormalW); +#ifdef REFLECTIONMAP_OPPOSITEZ +clearCoatReflectionVector.z*=-1.0; +#endif +#ifdef REFLECTIONMAP_3D +var clearCoatReflectionCoords: vec3f=clearCoatReflectionVector; +#else +var clearCoatReflectionCoords: vec2f=clearCoatReflectionVector.xy; +#ifdef REFLECTIONMAP_PROJECTION +clearCoatReflectionCoords/=clearCoatReflectionVector.z; +#endif +clearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y; +#endif +environmentClearCoatRadiance=sampleReflectionTexture( +clearCoatAlphaG +,vReflectionMicrosurfaceInfos +,vReflectionInfos +,vReflectionColor +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +,clearCoatNdotVUnclamped +#endif +#ifdef LINEARSPECULARREFLECTION +,clearCoatRoughness +#endif +,reflectionSampler +,reflectionSamplerSampler +,clearCoatReflectionCoords +#ifndef LODBASEDMICROSFURACE +,reflectionLowSampler +,reflectionLowSamplerSampler +,reflectionHighSampler +,reflectionHighSamplerSampler +#endif +#ifdef REALTIME_FILTERING +,vReflectionFilteringInfo +#endif +); +#if DEBUGMODE>0 +outParams.environmentClearCoatRadiance=environmentClearCoatRadiance; +#endif +#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX) +var clearCoatEnvironmentReflectance: vec3f=getReflectanceFromBRDFLookup(vec3f(uniforms.vClearCoatRefractionParams.x),environmentClearCoatBrdf); +#ifdef HORIZONOCCLUSION +#ifdef BUMP +#ifdef REFLECTIONMAP_3D +var clearCoatEho: f32=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);clearCoatEnvironmentReflectance*=clearCoatEho; +#endif +#endif +#endif +#else +var clearCoatEnvironmentReflectance: vec3f=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV, vec3f(1.), vec3f(1.),sqrt(1.-clearCoatRoughness)); +#endif +clearCoatEnvironmentReflectance*=clearCoatIntensity; +#if DEBUGMODE>0 +outParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance; +#endif +outParams.finalClearCoatRadianceScaled= +environmentClearCoatRadiance.rgb * +clearCoatEnvironmentReflectance * +vLightingIntensity.z; +#endif +#if defined(CLEARCOAT_TINT) +outParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity); +#endif +var fresnelIBLClearCoat: f32=fresnelSchlickGGX(clearCoatNdotV,uniforms.vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnelIBLClearCoat*=clearCoatIntensity;outParams.conservationFactor=(1.-fresnelIBLClearCoat); +#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION) +outParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf); +#endif +return outParams;} +#endif +`;e.IncludesShadersStoreWGSL[s]||(e.IncludesShadersStoreWGSL[s]=P);const E="pbrBlockIridescence",U=`struct iridescenceOutParams +{iridescenceIntensity: f32, +iridescenceIOR: f32, +iridescenceThickness: f32, +specularEnvironmentR0: vec3f}; +#ifdef IRIDESCENCE +fn iridescenceBlock( +vIridescenceParams: vec4f +,viewAngle_: f32 +,specularEnvironmentR0: vec3f +#ifdef IRIDESCENCE_TEXTURE +,iridescenceMapData: vec2f +#endif +#ifdef IRIDESCENCE_THICKNESS_TEXTURE +,iridescenceThicknessMapData: vec2f +#endif +#ifdef CLEARCOAT +,NdotVUnclamped: f32 +,vClearCoatParams: vec2f +#ifdef CLEARCOAT_TEXTURE +,clearCoatMapData: vec2f +#endif +#endif +)->iridescenceOutParams +{var outParams: iridescenceOutParams;var iridescenceIntensity: f32=vIridescenceParams.x;var iridescenceIOR: f32=vIridescenceParams.y;var iridescenceThicknessMin: f32=vIridescenceParams.z;var iridescenceThicknessMax: f32=vIridescenceParams.w;var iridescenceThicknessWeight: f32=1.;var viewAngle=viewAngle_; +#ifdef IRIDESCENCE_TEXTURE +iridescenceIntensity*=iridescenceMapData.x; +#endif +#if defined(IRIDESCENCE_THICKNESS_TEXTURE) +iridescenceThicknessWeight=iridescenceThicknessMapData.g; +#endif +var iridescenceThickness: f32=mix(iridescenceThicknessMin,iridescenceThicknessMax,iridescenceThicknessWeight);var topIor: f32=1.; +#ifdef CLEARCOAT +var clearCoatIntensity: f32=vClearCoatParams.x; +#ifdef CLEARCOAT_TEXTURE +clearCoatIntensity*=clearCoatMapData.x; +#endif +topIor=mix(1.0,uniforms.vClearCoatRefractionParams.w-1.,clearCoatIntensity);viewAngle=sqrt(1.0+((1.0/topIor)*(1.0/topIor))*((NdotVUnclamped*NdotVUnclamped)-1.0)); +#endif +var iridescenceFresnel: vec3f=evalIridescence(topIor,iridescenceIOR,viewAngle,iridescenceThickness,specularEnvironmentR0);outParams.specularEnvironmentR0=mix(specularEnvironmentR0,iridescenceFresnel,iridescenceIntensity);outParams.iridescenceIntensity=iridescenceIntensity;outParams.iridescenceThickness=iridescenceThickness;outParams.iridescenceIOR=iridescenceIOR;return outParams;} +#endif +`;e.IncludesShadersStoreWGSL[E]||(e.IncludesShadersStoreWGSL[E]=U);const R="pbrBlockSubSurface",b=`struct subSurfaceOutParams +{specularEnvironmentReflectance: vec3f, +#ifdef SS_REFRACTION +finalRefraction: vec3f, +surfaceAlbedo: vec3f, +#ifdef SS_LINKREFRACTIONTOTRANSPARENCY +alpha: f32, +#endif +refractionOpacity: f32, +#endif +#ifdef SS_TRANSLUCENCY +transmittance: vec3f, +translucencyIntensity: f32, +#ifdef REFLECTION +refractionIrradiance: vec3f, +#endif +#endif +#if DEBUGMODE>0 +#ifdef SS_THICKNESSANDMASK_TEXTURE +thicknessMap: vec4f, +#endif +#ifdef SS_REFRACTION +environmentRefraction: vec4f, +refractionTransmittance: vec3f +#endif +#endif +}; +#ifdef SUBSURFACE +#ifdef SS_REFRACTION +#define pbr_inline +fn sampleEnvironmentRefraction( +ior: f32 +,thickness: f32 +,refractionLOD: f32 +,normalW: vec3f +,vPositionW: vec3f +,viewDirectionW: vec3f +,view: mat4x4f +,vRefractionInfos: vec4f +,refractionMatrix: mat4x4f +,vRefractionMicrosurfaceInfos: vec4f +,alphaG: f32 +#ifdef SS_REFRACTIONMAP_3D +,refractionSampler: texture_cube +,refractionSamplerSampler: sampler +#ifndef LODBASEDMICROSFURACE +,refractionLowSampler: texture_cube +,refractionLowSamplerSampler: sampler +,refractionHighSampler: texture_cube +,refractionHighSamplerSampler: sampler +#endif +#else +,refractionSampler: texture_2d +,refractionSamplerSampler: sampler +#ifndef LODBASEDMICROSFURACE +,refractionLowSampler: texture_2d +,refractionLowSamplerSampler: sampler +,refractionHighSampler: texture_2d +,refractionHighSamplerSampler: sampler +#endif +#endif +#ifdef ANISOTROPIC +,anisotropicOut: anisotropicOutParams +#endif +#ifdef REALTIME_FILTERING +,vRefractionFilteringInfo: vec2f +#endif +#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC +,refractionPosition: vec3f +,refractionSize: vec3f +#endif +)->vec4f {var environmentRefraction: vec4f= vec4f(0.,0.,0.,0.); +#ifdef ANISOTROPIC +var refractionVector: vec3f=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,ior); +#else +var refractionVector: vec3f=refract(-viewDirectionW,normalW,ior); +#endif +#ifdef SS_REFRACTIONMAP_OPPOSITEZ +refractionVector.z*=-1.0; +#endif +#ifdef SS_REFRACTIONMAP_3D +#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC +refractionVector=parallaxCorrectNormal(vPositionW,refractionVector,refractionSize,refractionPosition); +#endif +refractionVector.y=refractionVector.y*vRefractionInfos.w;var refractionCoords: vec3f=refractionVector;refractionCoords= (refractionMatrix* vec4f(refractionCoords,0)).xyz; +#else +#ifdef SS_USE_THICKNESS_AS_DEPTH +var vRefractionUVW: vec3f= (refractionMatrix*(view* vec4f(vPositionW+refractionVector*thickness,1.0))).xyz; +#else +var vRefractionUVW: vec3f= (refractionMatrix*(view* vec4f(vPositionW+refractionVector*vRefractionInfos.z,1.0))).xyz; +#endif +var refractionCoords: vec2f=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y; +#endif +#ifdef LODBASEDMICROSFURACE +var lod=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z; +#ifdef SS_LODINREFRACTIONALPHA +var automaticRefractionLOD: f32=UNPACK_LOD(textureSample(refractionSampler,refractionSamplerSampler,refractionCoords).a);var requestedRefractionLOD: f32=max(automaticRefractionLOD,lod); +#else +var requestedRefractionLOD: f32=lod; +#endif +#if defined(REALTIME_FILTERING) && defined(SS_REFRACTIONMAP_3D) +environmentRefraction= vec4f(radiance(alphaG,refractionSampler,refractionSamplerSampler,refractionCoords,vRefractionFilteringInfo),1.0); +#else +environmentRefraction=textureSampleLevel(refractionSampler,refractionSamplerSampler,refractionCoords,requestedRefractionLOD); +#endif +#else +var lodRefractionNormalized: f32=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));var lodRefractionNormalizedDoubled: f32=lodRefractionNormalized*2.0;var environmentRefractionMid: vec4f=textureSample(refractionSampler,refractionSamplerSampler,refractionCoords);if (lodRefractionNormalizedDoubled<1.0){environmentRefraction=mix( +textureSample(refractionHighSampler,refractionHighSamplerSampler,refractionCoords), +environmentRefractionMid, +lodRefractionNormalizedDoubled +);} else {environmentRefraction=mix( +environmentRefractionMid, +textureSample(refractionLowSampler,refractionLowSamplerSampler,refractionCoords), +lodRefractionNormalizedDoubled-1.0 +);} +#endif +var refraction=environmentRefraction.rgb; +#ifdef SS_RGBDREFRACTION +refraction=fromRGBD(environmentRefraction); +#endif +#ifdef SS_GAMMAREFRACTION +refraction=toLinearSpaceVec3(environmentRefraction.rgb); +#endif +return vec4f(refraction,environmentRefraction.a);} +#endif +#define pbr_inline +fn subSurfaceBlock( +vSubSurfaceIntensity: vec3f +,vThicknessParam: vec2f +,vTintColor: vec4f +,normalW: vec3f +,specularEnvironmentReflectance: vec3f +#ifdef SS_THICKNESSANDMASK_TEXTURE +,thicknessMap: vec4f +#endif +#ifdef SS_REFRACTIONINTENSITY_TEXTURE +,refractionIntensityMap: vec4f +#endif +#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE +,translucencyIntensityMap: vec4f +#endif +#ifdef REFLECTION +#ifdef SS_TRANSLUCENCY +,reflectionMatrix: mat4x4f +#ifdef USESPHERICALFROMREFLECTIONMAP +#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX) +,irradianceVector_: vec3f +#endif +#if defined(REALTIME_FILTERING) +,reflectionSampler: texture_cube +,reflectionSamplerSampler: sampler +,vReflectionFilteringInfo: vec2f +#ifdef IBL_CDF_FILTERING +,icdfSampler: texture_2d +,icdfSamplerSampler: sampler +#endif +#endif +#endif +#ifdef USEIRRADIANCEMAP +#ifdef REFLECTIONMAP_3D +,irradianceSampler: texture_cube +,irradianceSamplerSampler: sampler +#else +,irradianceSampler: texture_2d +,irradianceSamplerSampler: sampler +#endif +#endif +#endif +#endif +#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY) +,surfaceAlbedo: vec3f +#endif +#ifdef SS_REFRACTION +,vPositionW: vec3f +,viewDirectionW: vec3f +,view: mat4x4f +,vRefractionInfos: vec4f +,refractionMatrix: mat4x4f +,vRefractionMicrosurfaceInfos: vec4f +,vLightingIntensity: vec4f +#ifdef SS_LINKREFRACTIONTOTRANSPARENCY +,alpha: f32 +#endif +#ifdef SS_LODINREFRACTIONALPHA +,NdotVUnclamped: f32 +#endif +#ifdef SS_LINEARSPECULARREFRACTION +,roughness: f32 +#endif +,alphaG: f32 +#ifdef SS_REFRACTIONMAP_3D +,refractionSampler: texture_cube +,refractionSamplerSampler: sampler +#ifndef LODBASEDMICROSFURACE +,refractionLowSampler: texture_cube +,refractionLowSamplerSampler: sampler +,refractionHighSampler: texture_cube +,refractionHighSamplerSampler: sampler +#endif +#else +,refractionSampler: texture_2d +,refractionSamplerSampler: sampler +#ifndef LODBASEDMICROSFURACE +,refractionLowSampler: texture_2d +,refractionLowSamplerSampler: sampler +,refractionHighSampler: texture_2d +,refractionHighSamplerSampler: sampler +#endif +#endif +#ifdef ANISOTROPIC +,anisotropicOut: anisotropicOutParams +#endif +#ifdef REALTIME_FILTERING +,vRefractionFilteringInfo: vec2f +#endif +#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC +,refractionPosition: vec3f +,refractionSize: vec3f +#endif +#ifdef SS_DISPERSION +,dispersion: f32 +#endif +#endif +#ifdef SS_TRANSLUCENCY +,vDiffusionDistance: vec3f +,vTranslucencyColor: vec4f +#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE +,translucencyColorMap: vec4f +#endif +#endif +)->subSurfaceOutParams +{var outParams: subSurfaceOutParams;outParams.specularEnvironmentReflectance=specularEnvironmentReflectance; +#ifdef SS_REFRACTION +var refractionIntensity: f32=vSubSurfaceIntensity.x; +#ifdef SS_LINKREFRACTIONTOTRANSPARENCY +refractionIntensity*=(1.0-alpha);outParams.alpha=1.0; +#endif +#endif +#ifdef SS_TRANSLUCENCY +var translucencyIntensity: f32=vSubSurfaceIntensity.y; +#endif +#ifdef SS_THICKNESSANDMASK_TEXTURE +#ifdef SS_USE_GLTF_TEXTURES +var thickness: f32=thicknessMap.g*vThicknessParam.y+vThicknessParam.x; +#else +var thickness: f32=thicknessMap.r*vThicknessParam.y+vThicknessParam.x; +#endif +#if DEBUGMODE>0 +outParams.thicknessMap=thicknessMap; +#endif +#if defined(SS_REFRACTION) && defined(SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS) +#ifdef SS_USE_GLTF_TEXTURES +refractionIntensity*=thicknessMap.r; +#else +refractionIntensity*=thicknessMap.g; +#endif +#endif +#if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS) +#ifdef SS_USE_GLTF_TEXTURES +translucencyIntensity*=thicknessMap.a; +#else +translucencyIntensity*=thicknessMap.b; +#endif +#endif +#else +var thickness: f32=vThicknessParam.y; +#endif +#if defined(SS_REFRACTION) && defined(SS_REFRACTIONINTENSITY_TEXTURE) +#ifdef SS_USE_GLTF_TEXTURES +refractionIntensity*=refractionIntensityMap.r; +#else +refractionIntensity*=refractionIntensityMap.g; +#endif +#endif +#if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCYINTENSITY_TEXTURE) +#ifdef SS_USE_GLTF_TEXTURES +translucencyIntensity*=translucencyIntensityMap.a; +#else +translucencyIntensity*=translucencyIntensityMap.b; +#endif +#endif +#ifdef SS_TRANSLUCENCY +thickness=maxEps(thickness);var translucencyColor: vec4f=vTranslucencyColor; +#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE +translucencyColor*=translucencyColorMap; +#endif +var transmittance: vec3f=transmittanceBRDF_Burley(translucencyColor.rgb,vDiffusionDistance,thickness);transmittance*=translucencyIntensity;outParams.transmittance=transmittance;outParams.translucencyIntensity=translucencyIntensity; +#endif +#ifdef SS_REFRACTION +var environmentRefraction: vec4f= vec4f(0.,0.,0.,0.); +#ifdef SS_HAS_THICKNESS +var ior: f32=vRefractionInfos.y; +#else +var ior: f32=vRefractionMicrosurfaceInfos.w; +#endif +#ifdef SS_LODINREFRACTIONALPHA +var refractionAlphaG: f32=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));var refractionLOD: f32=getLodFromAlphaGNdotV(vRefractionMicrosurfaceInfos.x,refractionAlphaG,NdotVUnclamped); +#elif defined(SS_LINEARSPECULARREFRACTION) +var refractionRoughness: f32=alphaG;refractionRoughness=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));var refractionLOD: f32=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,refractionRoughness); +#else +var refractionAlphaG: f32=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));var refractionLOD: f32=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG); +#endif +var refraction_ior: f32=vRefractionInfos.y; +#ifdef SS_DISPERSION +var realIOR: f32=1.0/refraction_ior;var iorDispersionSpread: f32=0.04*dispersion*(realIOR-1.0);var iors: vec3f= vec3f(1.0/(realIOR-iorDispersionSpread),refraction_ior,1.0/(realIOR+iorDispersionSpread));for (var i: i32=0; i<3; i++) {refraction_ior=iors[i]; +#endif +var envSample: vec4f=sampleEnvironmentRefraction(refraction_ior,thickness,refractionLOD,normalW,vPositionW,viewDirectionW,view,vRefractionInfos,refractionMatrix,vRefractionMicrosurfaceInfos,alphaG +#ifdef SS_REFRACTIONMAP_3D +,refractionSampler +,refractionSamplerSampler +#ifndef LODBASEDMICROSFURACE +,refractionLowSampler +,refractionLowSamplerSampler +,refractionHighSampler +,refractionHighSamplerSampler +#endif +#else +,refractionSampler +,refractionSamplerSampler +#ifndef LODBASEDMICROSFURACE +,refractionLowSampler +,refractionLowSamplerSampler +,refractionHighSampler +,refractionHighSamplerSampler +#endif +#endif +#ifdef ANISOTROPIC +,anisotropicOut +#endif +#ifdef REALTIME_FILTERING +,vRefractionFilteringInfo +#endif +#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC +,refractionPosition +,refractionSize +#endif +); +#ifdef SS_DISPERSION +environmentRefraction[i]=envSample[i];} +#else +environmentRefraction=envSample; +#endif +environmentRefraction=vec4f(environmentRefraction.rgb*vRefractionInfos.x,environmentRefraction.a); +#endif +#ifdef SS_REFRACTION +var refractionTransmittance: vec3f= vec3f(refractionIntensity); +#ifdef SS_THICKNESSANDMASK_TEXTURE +var volumeAlbedo: vec3f=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambertVec3(volumeAlbedo,thickness); +#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY) +var maxChannel: f32=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);var volumeAlbedo: vec3f=saturateVec3(maxChannel*surfaceAlbedo);environmentRefraction=vec4f(environmentRefraction.rgb*volumeAlbedo,environmentRefraction.a); +#else +var volumeAlbedo: vec3f=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambertVec3(volumeAlbedo,vThicknessParam.y); +#endif +#ifdef SS_ALBEDOFORREFRACTIONTINT +environmentRefraction=vec4f(environmentRefraction.rgb*surfaceAlbedo.rgb,environmentRefraction.a); +#endif +outParams.surfaceAlbedo=surfaceAlbedo;outParams.refractionOpacity=1.-refractionIntensity; +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +outParams.surfaceAlbedo*=outParams.refractionOpacity; +#endif +#ifdef UNUSED_MULTIPLEBOUNCES +var bounceSpecularEnvironmentReflectance: vec3f=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);outParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity); +#endif +#if DEBUGMODE>0 +outParams.refractionTransmittance=refractionTransmittance; +#endif +outParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;outParams.finalRefraction*=vec3f(1.0)-specularEnvironmentReflectance; +#if DEBUGMODE>0 +outParams.environmentRefraction=environmentRefraction; +#endif +#endif +#if defined(REFLECTION) && defined(SS_TRANSLUCENCY) +#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP) +var irradianceVector: vec3f= (reflectionMatrix* vec4f(normalW,0)).xyz; +#ifdef REFLECTIONMAP_OPPOSITEZ +irradianceVector.z*=-1.0; +#endif +#ifdef INVERTCUBICMAP +irradianceVector.y*=-1.0; +#endif +#else +var irradianceVector: vec3f=irradianceVector_; +#endif +#if defined(USESPHERICALFROMREFLECTIONMAP) +#if defined(REALTIME_FILTERING) +var refractionIrradiance: vec3f=irradiance(reflectionSampler,reflectionSamplerSampler,-irradianceVector,vReflectionFilteringInfo,0.0,surfaceAlbedo,irradianceVector +#ifdef IBL_CDF_FILTERING +,icdfSampler +,icdfSamplerSampler +#endif +); +#else +var refractionIrradiance: vec3f=computeEnvironmentIrradiance(-irradianceVector); +#endif +#elif defined(USEIRRADIANCEMAP) +#ifdef REFLECTIONMAP_3D +var irradianceCoords: vec3f=irradianceVector; +#else +var irradianceCoords: vec2f=irradianceVector.xy; +#ifdef REFLECTIONMAP_PROJECTION +irradianceCoords/=irradianceVector.z; +#endif +irradianceCoords.y=1.0-irradianceCoords.y; +#endif +var temp: vec4f=textureSample(irradianceSampler,irradianceSamplerSampler,-irradianceCoords);var refractionIrradiance=temp.rgb; +#ifdef RGBDREFLECTION +refractionIrradiance=fromRGBD(temp).rgb; +#endif +#ifdef GAMMAREFLECTION +refractionIrradiance=toLinearSpaceVec3(refractionIrradiance); +#endif +#else +var refractionIrradiance: vec3f= vec3f(0.); +#endif +refractionIrradiance*=transmittance; +#ifdef SS_ALBEDOFORTRANSLUCENCYTINT +refractionIrradiance*=surfaceAlbedo.rgb; +#endif +outParams.refractionIrradiance=refractionIrradiance; +#endif +return outParams;} +#endif +`;e.IncludesShadersStoreWGSL[R]||(e.IncludesShadersStoreWGSL[R]=b);const m="pbrBlockNormalFinal",y=`#if defined(FORCENORMALFORWARD) && defined(NORMAL) +var faceNormal: vec3f=normalize(cross(dpdx(fragmentInputs.vPositionW),dpdy(fragmentInputs.vPositionW)))*scene.vEyePosition.w; +#if defined(TWOSIDEDLIGHTING) +faceNormal=select(-faceNormal,faceNormal,fragmentInputs.frontFacing); +#endif +normalW*=sign(dot(normalW,faceNormal)); +#endif +#if defined(TWOSIDEDLIGHTING) && defined(NORMAL) +#if defined(MIRRORED) +normalW=select(normalW,-normalW,fragmentInputs.frontFacing); +#else +normalW=select(-normalW,normalW,fragmentInputs.frontFacing); +#endif +#endif +`;e.IncludesShadersStoreWGSL[m]||(e.IncludesShadersStoreWGSL[m]=y);const S="pbrBlockLightmapInit",B=`#ifdef LIGHTMAP +var lightmapColor: vec4f=textureSample(lightmapSampler,lightmapSamplerSampler,fragmentInputs.vLightmapUV+uvOffset); +#ifdef RGBDLIGHTMAP +lightmapColor=vec4f(fromRGBD(lightmapColor),lightmapColor.a); +#endif +#ifdef GAMMALIGHTMAP +lightmapColor=vec4f(toLinearSpaceVec3(lightmapColor.rgb),lightmapColor.a); +#endif +lightmapColor=vec4f(lightmapColor.rgb*uniforms.vLightmapInfos.y,lightmapColor.a); +#endif +`;e.IncludesShadersStoreWGSL[S]||(e.IncludesShadersStoreWGSL[S]=B);const C="pbrBlockGeometryInfo",G=`var NdotVUnclamped: f32=dot(normalW,viewDirectionW);var NdotV: f32=absEps(NdotVUnclamped);var alphaG: f32=convertRoughnessToAverageSlope(roughness);var AARoughnessFactors: vec2f=getAARoughnessFactors(normalW.xyz); +#ifdef SPECULARAA +alphaG+=AARoughnessFactors.y; +#endif +#if defined(ENVIRONMENTBRDF) +var environmentBrdf: vec3f=getBRDFLookup(NdotV,roughness); +#endif +#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX) +#ifdef RADIANCEOCCLUSION +#ifdef AMBIENTINGRAYSCALE +var ambientMonochrome: f32=aoOut.ambientOcclusionColor.r; +#else +var ambientMonochrome: f32=getLuminance(aoOut.ambientOcclusionColor); +#endif +var seo: f32=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped); +#endif +#ifdef HORIZONOCCLUSION +#ifdef BUMP +#ifdef REFLECTIONMAP_3D +var eho: f32=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW); +#endif +#endif +#endif +#endif +`;e.IncludesShadersStoreWGSL[C]||(e.IncludesShadersStoreWGSL[C]=G);const u="pbrBlockReflectance",V=`#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX) +var baseSpecularEnvironmentReflectance: vec3f=getReflectanceFromBRDFWithEnvLookup(vec3f(reflectanceF0),vec3f(reflectivityOut.reflectanceF90),environmentBrdf); +#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) +let metalEnvironmentReflectance: vec3f=vec3f(reflectivityOut.specularWeight)*getF82Specular(NdotV,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90,reflectivityOut.roughness);let dielectricEnvironmentReflectance=getReflectanceFromBRDFWithEnvLookup(reflectivityOut.dielectricColorF0,reflectivityOut.colorReflectanceF90,environmentBrdf);var colorSpecularEnvironmentReflectance: vec3f=mix(dielectricEnvironmentReflectance,metalEnvironmentReflectance,reflectivityOut.metallic); +#else +var colorSpecularEnvironmentReflectance=getReflectanceFromBRDFWithEnvLookup(clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90,environmentBrdf); +#endif +#ifdef RADIANCEOCCLUSION +colorSpecularEnvironmentReflectance*=seo; +#endif +#ifdef HORIZONOCCLUSION +#ifdef BUMP +#ifdef REFLECTIONMAP_3D +colorSpecularEnvironmentReflectance*=eho; +#endif +#endif +#endif +#else +var colorSpecularEnvironmentReflectance: vec3f=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));var baseSpecularEnvironmentReflectance: vec3f=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,vec3f(reflectanceF0),vec3f(reflectivityOut.reflectanceF90),sqrt(microSurface)); +#endif +#ifdef CLEARCOAT +colorSpecularEnvironmentReflectance*=clearcoatOut.conservationFactor; +#if defined(CLEARCOAT_TINT) +colorSpecularEnvironmentReflectance*=clearcoatOut.absorption; +#endif +#endif +`;e.IncludesShadersStoreWGSL[u]||(e.IncludesShadersStoreWGSL[u]=V);const v="pbrBlockDirectLighting",x=`var diffuseBase: vec3f=vec3f(0.,0.,0.); +#ifdef SS_TRANSLUCENCY +var diffuseTransmissionBase: vec3f=vec3f(0.,0.,0.); +#endif +#ifdef SPECULARTERM +var specularBase: vec3f=vec3f(0.,0.,0.); +#endif +#ifdef CLEARCOAT +var clearCoatBase: vec3f=vec3f(0.,0.,0.); +#endif +#ifdef SHEEN +var sheenBase: vec3f=vec3f(0.,0.,0.); +#endif +#if defined(SPECULARTERM) && defined(LIGHT0) +var coloredFresnel: vec3f=vec3f(0.,0.,0.); +#endif +var preInfo: preLightingInfo;var info: lightingInfo;var shadow: f32=1.; +var aggShadow: f32=0.;var numLights: f32=0.; +#if defined(CLEARCOAT) && defined(CLEARCOAT_TINT) +var absorption: vec3f=vec3f(0.); +#endif +`;e.IncludesShadersStoreWGSL[v]||(e.IncludesShadersStoreWGSL[v]=x);const p="pbrBlockFinalLitComponents",H=`aggShadow=aggShadow/numLights; +#if defined(ENVIRONMENTBRDF) +#ifdef MS_BRDF_ENERGY_CONSERVATION +var baseSpecularEnergyConservationFactor: vec3f=getEnergyConservationFactor(vec3f(reflectanceF0),environmentBrdf);var coloredEnergyConservationFactor: vec3f=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf); +#endif +#endif +#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF) +surfaceAlbedo=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb; +#endif +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +#ifndef METALLICWORKFLOW +#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION +surfaceAlbedo=vec3f(1.-reflectanceF0)*surfaceAlbedo.rgb; +#endif +#endif +#endif +#ifdef REFLECTION +var finalIrradiance: vec3f=reflectionOut.environmentIrradiance; +#ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION +#if defined(METALLICWORKFLOW) || defined(SPECULAR_GLOSSINESS_ENERGY_CONSERVATION) +var baseSpecularEnergy: vec3f=vec3f(baseSpecularEnvironmentReflectance); +#if defined(ENVIRONMENTBRDF) +#ifdef MS_BRDF_ENERGY_CONSERVATION +baseSpecularEnergy*=baseSpecularEnergyConservationFactor; +#endif +#endif +finalIrradiance*=clamp(vec3f(1.0)-baseSpecularEnergy,vec3f(0.0),vec3f(1.0)); +#endif +#endif +#if defined(CLEARCOAT) +finalIrradiance*=clearcoatOut.conservationFactor; +#if defined(CLEARCOAT_TINT) +finalIrradiance*=clearcoatOut.absorption; +#endif +#endif +#ifndef SS_APPLY_ALBEDO_AFTER_SUBSURFACE +finalIrradiance*=surfaceAlbedo.rgb; +#endif +#if defined(SS_REFRACTION) +finalIrradiance*=subSurfaceOut.refractionOpacity; +#endif +#if defined(SS_TRANSLUCENCY) +finalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);finalIrradiance+=subSurfaceOut.refractionIrradiance; +#endif +#ifdef SS_APPLY_ALBEDO_AFTER_SUBSURFACE +finalIrradiance*=surfaceAlbedo.rgb; +#endif +finalIrradiance*=uniforms.vLightingIntensity.z;finalIrradiance*=aoOut.ambientOcclusionColor; +#endif +#ifdef SPECULARTERM +var finalSpecular: vec3f=specularBase;finalSpecular=max(finalSpecular,vec3f(0.0));var finalSpecularScaled: vec3f=finalSpecular*uniforms.vLightingIntensity.x*uniforms.vLightingIntensity.w; +#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION) +finalSpecularScaled*=coloredEnergyConservationFactor; +#endif +#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING) +finalSpecularScaled*=sheenOut.sheenAlbedoScaling; +#endif +#endif +#ifdef REFLECTION +var finalRadiance: vec3f=reflectionOut.environmentRadiance.rgb;finalRadiance*=colorSpecularEnvironmentReflectance;;var finalRadianceScaled: vec3f=finalRadiance*uniforms.vLightingIntensity.z; +#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION) +finalRadianceScaled*=coloredEnergyConservationFactor; +#endif +#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING) +finalRadianceScaled*=sheenOut.sheenAlbedoScaling; +#endif +#endif +#ifdef SHEEN +var finalSheen: vec3f=sheenBase*sheenOut.sheenColor;finalSheen=max(finalSheen,vec3f(0.0));var finalSheenScaled: vec3f=finalSheen*uniforms.vLightingIntensity.x*uniforms.vLightingIntensity.w; +#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF) +sheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor; +#if defined(CLEARCOAT_TINT) +sheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption; +#endif +#endif +#endif +#ifdef CLEARCOAT +var finalClearCoat: vec3f=clearCoatBase;finalClearCoat=max(finalClearCoat,vec3f(0.0));var finalClearCoatScaled: vec3f=finalClearCoat*uniforms.vLightingIntensity.x*uniforms.vLightingIntensity.w; +#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION) +finalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat; +#endif +#ifdef SS_REFRACTION +subSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor; +#ifdef CLEARCOAT_TINT +subSurfaceOut.finalRefraction*=clearcoatOut.absorption; +#endif +#endif +#endif +#ifdef ALPHABLEND +var luminanceOverAlpha: f32=0.0; +#if defined(REFLECTION) && defined(RADIANCEOVERALPHA) +luminanceOverAlpha+=getLuminance(finalRadianceScaled); +#if defined(CLEARCOAT) +luminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled); +#endif +#endif +#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA) +luminanceOverAlpha+=getLuminance(finalSpecularScaled); +#endif +#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA) +luminanceOverAlpha+=getLuminance(finalClearCoatScaled); +#endif +#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA) +alpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha); +#endif +#endif +`;e.IncludesShadersStoreWGSL[p]||(e.IncludesShadersStoreWGSL[p]=H);const A="pbrBlockFinalUnlitComponents",W=`var finalDiffuse: vec3f=diffuseBase;finalDiffuse*=surfaceAlbedo; +#if defined(SS_REFRACTION) && !defined(UNLIT) && !defined(LEGACY_SPECULAR_ENERGY_CONSERVATION) +finalDiffuse*=subSurfaceOut.refractionOpacity; +#endif +#if defined(SS_TRANSLUCENCY) && !defined(UNLIT) +finalDiffuse+=diffuseTransmissionBase; +#endif +finalDiffuse=max(finalDiffuse,vec3f(0.0));finalDiffuse*=uniforms.vLightingIntensity.x;var finalAmbient: vec3f=uniforms.vAmbientColor;finalAmbient*=surfaceAlbedo.rgb;var finalEmissive: vec3f=uniforms.vEmissiveColor; +#ifdef EMISSIVE +var emissiveColorTex: vec3f=textureSample(emissiveSampler,emissiveSamplerSampler,fragmentInputs.vEmissiveUV+uvOffset).rgb; +#ifdef GAMMAEMISSIVE +finalEmissive*=toLinearSpaceVec3(emissiveColorTex.rgb); +#else +finalEmissive*=emissiveColorTex.rgb; +#endif +finalEmissive*= uniforms.vEmissiveInfos.y; +#endif +finalEmissive*=uniforms.vLightingIntensity.y; +#ifdef AMBIENT +var ambientOcclusionForDirectDiffuse: vec3f=mix( vec3f(1.),aoOut.ambientOcclusionColor,uniforms.vAmbientInfos.w); +#else +var ambientOcclusionForDirectDiffuse: vec3f=aoOut.ambientOcclusionColor; +#endif +finalAmbient*=aoOut.ambientOcclusionColor;finalDiffuse*=ambientOcclusionForDirectDiffuse; +`;e.IncludesShadersStoreWGSL[A]||(e.IncludesShadersStoreWGSL[A]=W);const I="pbrBlockFinalColorComposition",Y=`var finalColor: vec4f= vec4f( +#ifndef UNLIT +#ifdef REFLECTION +finalIrradiance + +#endif +#ifdef SPECULARTERM +finalSpecularScaled + +#endif +#ifdef SHEEN +finalSheenScaled + +#endif +#ifdef CLEARCOAT +finalClearCoatScaled + +#endif +#ifdef REFLECTION +finalRadianceScaled + +#if defined(SHEEN) && defined(ENVIRONMENTBRDF) +sheenOut.finalSheenRadianceScaled + +#endif +#ifdef CLEARCOAT +clearcoatOut.finalClearCoatRadianceScaled + +#endif +#endif +#ifdef SS_REFRACTION +subSurfaceOut.finalRefraction + +#endif +#endif +finalAmbient + +finalDiffuse, +alpha); +#ifdef LIGHTMAP +#ifndef LIGHTMAPEXCLUDED +#ifdef USELIGHTMAPASSHADOWMAP +finalColor=vec4f(finalColor.rgb*lightmapColor.rgb,finalColor.a); +#else +finalColor=vec4f(finalColor.rgb+lightmapColor.rgb,finalColor.a); +#endif +#endif +#endif +finalColor=vec4f(finalColor.rgb+finalEmissive,finalColor.a); +#define CUSTOM_FRAGMENT_BEFORE_FOG +finalColor=max(finalColor,vec4f(0.0)); +`;e.IncludesShadersStoreWGSL[I]||(e.IncludesShadersStoreWGSL[I]=Y);const a="pbrPixelShader",N=`#define PBR_FRAGMENT_SHADER +#define CUSTOM_FRAGMENT_BEGIN +#include[SCENE_MRT_COUNT] +#include +#ifndef FROMLINEARSPACE +#define FROMLINEARSPACE +#endif +#include +#include +#include[0..maxSimultaneousLights] +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef REFLECTION +#include +#endif +#define CUSTOM_FRAGMENT_DEFINITIONS +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +@fragment +fn main(input: FragmentInputs)->FragmentOutputs { +#define CUSTOM_FRAGMENT_MAIN_BEGIN +#include +#include +#include +#include +var albedoOpacityOut: albedoOpacityOutParams; +#ifdef ALBEDO +var albedoTexture: vec4f=textureSample(albedoSampler,albedoSamplerSampler,fragmentInputs.vAlbedoUV+uvOffset); +#endif +#ifdef BASE_WEIGHT +var baseWeightTexture: vec4f=textureSample(baseWeightSampler,baseWeightSamplerSampler,fragmentInputs.vBaseWeightUV+uvOffset); +#endif +#ifdef OPACITY +var opacityMap: vec4f=textureSample(opacitySampler,opacitySamplerSampler,fragmentInputs.vOpacityUV+uvOffset); +#endif +#ifdef DECAL +var decalColor: vec4f=textureSample(decalSampler,decalSamplerSampler,fragmentInputs.vDecalUV+uvOffset); +#endif +albedoOpacityOut=albedoOpacityBlock( +uniforms.vAlbedoColor +#ifdef ALBEDO +,albedoTexture +,uniforms.vAlbedoInfos +#endif +,uniforms.baseWeight +#ifdef BASE_WEIGHT +,baseWeightTexture +,uniforms.vBaseWeightInfos +#endif +#ifdef OPACITY +,opacityMap +,uniforms.vOpacityInfos +#endif +#ifdef DETAIL +,detailColor +,uniforms.vDetailInfos +#endif +#ifdef DECAL +,decalColor +,uniforms.vDecalInfos +#endif +);var surfaceAlbedo: vec3f=albedoOpacityOut.surfaceAlbedo;var alpha: f32=albedoOpacityOut.alpha; +#define CUSTOM_FRAGMENT_UPDATE_ALPHA +#include +#define CUSTOM_FRAGMENT_BEFORE_LIGHTS +var aoOut: ambientOcclusionOutParams; +#ifdef AMBIENT +var ambientOcclusionColorMap: vec3f=textureSample(ambientSampler,ambientSamplerSampler,fragmentInputs.vAmbientUV+uvOffset).rgb; +#endif +aoOut=ambientOcclusionBlock( +#ifdef AMBIENT +ambientOcclusionColorMap, +uniforms.vAmbientInfos +#endif +); +#include +#ifdef UNLIT +var diffuseBase: vec3f= vec3f(1.,1.,1.); +#else +var baseColor: vec3f=surfaceAlbedo;var reflectivityOut: reflectivityOutParams; +#if defined(REFLECTIVITY) +var surfaceMetallicOrReflectivityColorMap: vec4f=textureSample(reflectivitySampler,reflectivitySamplerSampler,fragmentInputs.vReflectivityUV+uvOffset);var baseReflectivity: vec4f=surfaceMetallicOrReflectivityColorMap; +#ifndef METALLICWORKFLOW +#ifdef REFLECTIVITY_GAMMA +surfaceMetallicOrReflectivityColorMap=toLinearSpaceVec4(surfaceMetallicOrReflectivityColorMap); +#endif +surfaceMetallicOrReflectivityColorMap=vec4f(surfaceMetallicOrReflectivityColorMap.rgb*uniforms.vReflectivityInfos.y,surfaceMetallicOrReflectivityColorMap.a); +#endif +#endif +#if defined(MICROSURFACEMAP) +var microSurfaceTexel: vec4f=textureSample(microSurfaceSampler,microSurfaceSamplerSampler,fragmentInputs.vMicroSurfaceSamplerUV+uvOffset)*uniforms.vMicroSurfaceSamplerInfos.y; +#endif +#ifdef BASE_DIFFUSE_ROUGHNESS +var baseDiffuseRoughnessTexture: f32=textureSample(baseDiffuseRoughnessSampler,baseDiffuseRoughnessSamplerSampler,fragmentInputs.vBaseDiffuseRoughnessUV+uvOffset).x; +#endif +#ifdef METALLICWORKFLOW +var metallicReflectanceFactors: vec4f=uniforms.vMetallicReflectanceFactors; +#ifdef REFLECTANCE +var reflectanceFactorsMap: vec4f=textureSample(reflectanceSampler,reflectanceSamplerSampler,fragmentInputs.vReflectanceUV+uvOffset); +#ifdef REFLECTANCE_GAMMA +reflectanceFactorsMap=toLinearSpaceVec4(reflectanceFactorsMap); +#endif +metallicReflectanceFactors=vec4f(metallicReflectanceFactors.rgb*reflectanceFactorsMap.rgb,metallicReflectanceFactors.a); +#endif +#ifdef METALLIC_REFLECTANCE +var metallicReflectanceFactorsMap: vec4f=textureSample(metallicReflectanceSampler,metallicReflectanceSamplerSampler,fragmentInputs.vMetallicReflectanceUV+uvOffset); +#ifdef METALLIC_REFLECTANCE_GAMMA +metallicReflectanceFactorsMap=toLinearSpaceVec4(metallicReflectanceFactorsMap); +#endif +#ifndef METALLIC_REFLECTANCE_USE_ALPHA_ONLY +metallicReflectanceFactors=vec4f(metallicReflectanceFactors.rgb*metallicReflectanceFactorsMap.rgb,metallicReflectanceFactors.a); +#endif +metallicReflectanceFactors.a*=metallicReflectanceFactorsMap.a; +#endif +#endif +reflectivityOut=reflectivityBlock( +uniforms.vReflectivityColor +#ifdef METALLICWORKFLOW +,surfaceAlbedo +,metallicReflectanceFactors +#endif +,uniforms.baseDiffuseRoughness +#ifdef BASE_DIFFUSE_ROUGHNESS +,baseDiffuseRoughnessTexture +,uniforms.vBaseDiffuseRoughnessInfos +#endif +#ifdef REFLECTIVITY +,uniforms.vReflectivityInfos +,surfaceMetallicOrReflectivityColorMap +#endif +#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED) +,aoOut.ambientOcclusionColor +#endif +#ifdef MICROSURFACEMAP +,microSurfaceTexel +#endif +#ifdef DETAIL +,detailColor +,uniforms.vDetailInfos +#endif +);var microSurface: f32=reflectivityOut.microSurface;var roughness: f32=reflectivityOut.roughness;var diffuseRoughness: f32=reflectivityOut.diffuseRoughness; +#ifdef METALLICWORKFLOW +surfaceAlbedo=reflectivityOut.surfaceAlbedo; +#endif +#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED) +aoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor; +#endif +#ifdef ALPHAFRESNEL +#if defined(ALPHATEST) || defined(ALPHABLEND) +var alphaFresnelOut: alphaFresnelOutParams;alphaFresnelOut=alphaFresnelBlock( +normalW, +viewDirectionW, +alpha, +microSurface +);alpha=alphaFresnelOut.alpha; +#endif +#endif +#include +#ifdef ANISOTROPIC +var anisotropicOut: anisotropicOutParams; +#ifdef ANISOTROPIC_TEXTURE +var anisotropyMapData: vec3f=textureSample(anisotropySampler,anisotropySamplerSampler,fragmentInputs.vAnisotropyUV+uvOffset).rgb*uniforms.vAnisotropyInfos.y; +#endif +anisotropicOut=anisotropicBlock( +uniforms.vAnisotropy, +roughness, +#ifdef ANISOTROPIC_TEXTURE +anisotropyMapData, +#endif +TBN, +normalW, +viewDirectionW +); +#endif +#ifdef REFLECTION +var reflectionOut: reflectionOutParams; +#ifndef USE_CUSTOM_REFLECTION +reflectionOut=reflectionBlock( +fragmentInputs.vPositionW +,normalW +,alphaG +,uniforms.vReflectionMicrosurfaceInfos +,uniforms.vReflectionInfos +,uniforms.vReflectionColor +#ifdef ANISOTROPIC +,anisotropicOut +#endif +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +,NdotVUnclamped +#endif +#ifdef LINEARSPECULARREFLECTION +,roughness +#endif +,reflectionSampler +,reflectionSamplerSampler +#if defined(NORMAL) && defined(USESPHERICALINVERTEX) +,fragmentInputs.vEnvironmentIrradiance +#endif +#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D)) +,uniforms.reflectionMatrix +#endif +#ifdef USEIRRADIANCEMAP +,irradianceSampler +,irradianceSamplerSampler +#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION +,uniforms.vReflectionDominantDirection +#endif +#endif +#ifndef LODBASEDMICROSFURACE +,reflectionLowSampler +,reflectionLowSamplerSampler +,reflectionHighSampler +,reflectionHighSamplerSampler +#endif +#ifdef REALTIME_FILTERING +,uniforms.vReflectionFilteringInfo +#ifdef IBL_CDF_FILTERING +,icdfSampler +,icdfSamplerSampler +#endif +#endif +,viewDirectionW +,diffuseRoughness +,surfaceAlbedo +); +#else +#define CUSTOM_REFLECTION +#endif +#endif +#include +#ifdef SHEEN +var sheenOut: sheenOutParams; +#ifdef SHEEN_TEXTURE +var sheenMapData: vec4f=textureSample(sheenSampler,sheenSamplerSampler,fragmentInputs.vSheenUV+uvOffset); +#endif +#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE) +var sheenMapRoughnessData: vec4f=textureSample(sheenRoughnessSampler,sheenRoughnessSamplerSampler,fragmentInputs.vSheenRoughnessUV+uvOffset)*uniforms.vSheenInfos.w; +#endif +sheenOut=sheenBlock( +uniforms.vSheenColor +#ifdef SHEEN_ROUGHNESS +,uniforms.vSheenRoughness +#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE) +,sheenMapRoughnessData +#endif +#endif +,roughness +#ifdef SHEEN_TEXTURE +,sheenMapData +,uniforms.vSheenInfos.y +#endif +,reflectanceF0 +#ifdef SHEEN_LINKWITHALBEDO +,baseColor +,surfaceAlbedo +#endif +#ifdef ENVIRONMENTBRDF +,NdotV +,environmentBrdf +#endif +#if defined(REFLECTION) && defined(ENVIRONMENTBRDF) +,AARoughnessFactors +,uniforms.vReflectionMicrosurfaceInfos +,uniforms.vReflectionInfos +,uniforms.vReflectionColor +,uniforms.vLightingIntensity +,reflectionSampler +,reflectionSamplerSampler +,reflectionOut.reflectionCoords +,NdotVUnclamped +#ifndef LODBASEDMICROSFURACE +,reflectionLowSampler +,reflectionLowSamplerSampler +,reflectionHighSampler +,reflectionHighSamplerSampler +#endif +#ifdef REALTIME_FILTERING +,uniforms.vReflectionFilteringInfo +#endif +#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION) +,seo +#endif +#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D) +,eho +#endif +#endif +); +#ifdef SHEEN_LINKWITHALBEDO +surfaceAlbedo=sheenOut.surfaceAlbedo; +#endif +#endif +#ifdef CLEARCOAT +#ifdef CLEARCOAT_TEXTURE +var clearCoatMapData: vec2f=textureSample(clearCoatSampler,clearCoatSamplerSampler,fragmentInputs.vClearCoatUV+uvOffset).rg*uniforms.vClearCoatInfos.y; +#endif +#endif +#ifdef IRIDESCENCE +var iridescenceOut: iridescenceOutParams; +#ifdef IRIDESCENCE_TEXTURE +var iridescenceMapData: vec2f=textureSample(iridescenceSampler,iridescenceSamplerSampler,fragmentInputs.vIridescenceUV+uvOffset).rg*uniforms.vIridescenceInfos.y; +#endif +#ifdef IRIDESCENCE_THICKNESS_TEXTURE +var iridescenceThicknessMapData: vec2f=textureSample(iridescenceThicknessSampler,iridescenceThicknessSamplerSampler,fragmentInputs.vIridescenceThicknessUV+uvOffset).rg*uniforms.vIridescenceInfos.w; +#endif +iridescenceOut=iridescenceBlock( +uniforms.vIridescenceParams +,NdotV +,specularEnvironmentR0 +#ifdef IRIDESCENCE_TEXTURE +,iridescenceMapData +#endif +#ifdef IRIDESCENCE_THICKNESS_TEXTURE +,iridescenceThicknessMapData +#endif +#ifdef CLEARCOAT +,NdotVUnclamped +,uniforms.vClearCoatParams +#ifdef CLEARCOAT_TEXTURE +,clearCoatMapData +#endif +#endif +);var iridescenceIntensity: f32=iridescenceOut.iridescenceIntensity;specularEnvironmentR0=iridescenceOut.specularEnvironmentR0; +#endif +var clearcoatOut: clearcoatOutParams; +#ifdef CLEARCOAT +#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) +var clearCoatMapRoughnessData: vec4f=textureSample(clearCoatRoughnessSampler,clearCoatRoughnessSamplerSampler,fragmentInputs.vClearCoatRoughnessUV+uvOffset)*uniforms.vClearCoatInfos.w; +#endif +#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE) +var clearCoatTintMapData: vec4f=textureSample(clearCoatTintSampler,clearCoatTintSamplerSampler,fragmentInputs.vClearCoatTintUV+uvOffset); +#endif +#ifdef CLEARCOAT_BUMP +var clearCoatBumpMapData: vec4f=textureSample(clearCoatBumpSampler,clearCoatBumpSamplerSampler,fragmentInputs.vClearCoatBumpUV+uvOffset); +#endif +clearcoatOut=clearcoatBlock( +fragmentInputs.vPositionW +,geometricNormalW +,viewDirectionW +,uniforms.vClearCoatParams +#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) +,clearCoatMapRoughnessData +#endif +,specularEnvironmentR0 +#ifdef CLEARCOAT_TEXTURE +,clearCoatMapData +#endif +#ifdef CLEARCOAT_TINT +,uniforms.vClearCoatTintParams +,uniforms.clearCoatColorAtDistance +,uniforms.vClearCoatRefractionParams +#ifdef CLEARCOAT_TINT_TEXTURE +,clearCoatTintMapData +#endif +#endif +#ifdef CLEARCOAT_BUMP +,uniforms.vClearCoatBumpInfos +,clearCoatBumpMapData +,fragmentInputs.vClearCoatBumpUV +#if defined(TANGENT) && defined(NORMAL) +,mat3x3(input.vTBN0,input.vTBN1,input.vTBN2) +#else +,uniforms.vClearCoatTangentSpaceParams +#endif +#ifdef OBJECTSPACE_NORMALMAP +,uniforms.normalMatrix +#endif +#endif +#if defined(FORCENORMALFORWARD) && defined(NORMAL) +,faceNormal +#endif +#ifdef REFLECTION +,uniforms.vReflectionMicrosurfaceInfos +,uniforms.vReflectionInfos +,uniforms.vReflectionColor +,uniforms.vLightingIntensity +,reflectionSampler +,reflectionSamplerSampler +#ifndef LODBASEDMICROSFURACE +,reflectionLowSampler +,reflectionLowSamplerSampler +,reflectionHighSampler +,reflectionHighSamplerSampler +#endif +#ifdef REALTIME_FILTERING +,uniforms.vReflectionFilteringInfo +#endif +#endif +#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING) +,select(-1.,1.,fragmentInputs.frontFacing) +#endif +); +#else +clearcoatOut.specularEnvironmentR0=specularEnvironmentR0; +#endif +#include +var subSurfaceOut: subSurfaceOutParams; +#ifdef SUBSURFACE +#ifdef SS_THICKNESSANDMASK_TEXTURE +var thicknessMap: vec4f=textureSample(thicknessSampler,thicknessSamplerSampler,fragmentInputs.vThicknessUV+uvOffset); +#endif +#ifdef SS_REFRACTIONINTENSITY_TEXTURE +var refractionIntensityMap: vec4f=textureSample(refractionIntensitySampler,refractionIntensitySamplerSampler,fragmentInputs.vRefractionIntensityUV+uvOffset); +#endif +#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE +var translucencyIntensityMap: vec4f=textureSample(translucencyIntensitySampler,translucencyIntensitySamplerSampler,fragmentInputs.vTranslucencyIntensityUV+uvOffset); +#endif +#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE +var translucencyColorMap: vec4f=textureSample(translucencyColorSampler,translucencyColorSamplerSampler,fragmentInputs.vTranslucencyColorUV+uvOffset); +#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE_GAMMA +translucencyColorMap=toLinearSpaceVec4(translucencyColorMap); +#endif +#endif +subSurfaceOut=subSurfaceBlock( +uniforms.vSubSurfaceIntensity +,uniforms.vThicknessParam +,uniforms.vTintColor +,normalW +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +,vec3f(max(colorSpecularEnvironmentReflectance.r,max(colorSpecularEnvironmentReflectance.g,colorSpecularEnvironmentReflectance.b))) +#else +,baseSpecularEnvironmentReflectance +#endif +#ifdef SS_THICKNESSANDMASK_TEXTURE +,thicknessMap +#endif +#ifdef SS_REFRACTIONINTENSITY_TEXTURE +,refractionIntensityMap +#endif +#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE +,translucencyIntensityMap +#endif +#ifdef REFLECTION +#ifdef SS_TRANSLUCENCY +,uniforms.reflectionMatrix +#ifdef USESPHERICALFROMREFLECTIONMAP +#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX) +,reflectionOut.irradianceVector +#endif +#if defined(REALTIME_FILTERING) +,reflectionSampler +,reflectionSamplerSampler +,uniforms.vReflectionFilteringInfo +#ifdef IBL_CDF_FILTERING +,icdfSampler +,icdfSamplerSampler +#endif +#endif +#endif +#ifdef USEIRRADIANCEMAP +,irradianceSampler +,irradianceSamplerSampler +#endif +#endif +#endif +#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY) +,surfaceAlbedo +#endif +#ifdef SS_REFRACTION +,fragmentInputs.vPositionW +,viewDirectionW +,scene.view +,uniforms.vRefractionInfos +,uniforms.refractionMatrix +,uniforms.vRefractionMicrosurfaceInfos +,uniforms.vLightingIntensity +#ifdef SS_LINKREFRACTIONTOTRANSPARENCY +,alpha +#endif +#ifdef SS_LODINREFRACTIONALPHA +,NdotVUnclamped +#endif +#ifdef SS_LINEARSPECULARREFRACTION +,roughness +#endif +,alphaG +,refractionSampler +,refractionSamplerSampler +#ifndef LODBASEDMICROSFURACE +,refractionLowSampler +,refractionLowSamplerSampler +,refractionHighSampler +,refractionHighSamplerSampler +#endif +#ifdef ANISOTROPIC +,anisotropicOut +#endif +#ifdef REALTIME_FILTERING +,uniforms.vRefractionFilteringInfo +#endif +#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC +,uniforms.vRefractionPosition +,uniforms.vRefractionSize +#endif +#ifdef SS_DISPERSION +,uniforms.dispersion +#endif +#endif +#ifdef SS_TRANSLUCENCY +,uniforms.vDiffusionDistance +,uniforms.vTranslucencyColor +#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE +,translucencyColorMap +#endif +#endif +); +#ifdef SS_REFRACTION +surfaceAlbedo=subSurfaceOut.surfaceAlbedo; +#ifdef SS_LINKREFRACTIONTOTRANSPARENCY +alpha=subSurfaceOut.alpha; +#endif +#endif +#else +subSurfaceOut.specularEnvironmentReflectance=colorSpecularEnvironmentReflectance; +#endif +#include +#include[0..maxSimultaneousLights] +#include +#endif +#include +#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION +#include +#include +#include(color,finalColor) +#include +#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR +#ifdef PREPASS +#include +#endif +#if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY) +fragmentOutputs.color=finalColor; +#endif +#include +#if ORDER_INDEPENDENT_TRANSPARENCY +if (fragDepth==nearestDepth) {fragmentOutputs.frontColor=vec4f(fragmentOutputs.frontColor.rgb+finalColor.rgb*finalColor.a*alphaMultiplier,1.0-alphaMultiplier*(1.0-finalColor.a));} else {fragmentOutputs.backColor+=finalColor;} +#endif +#include +#define CUSTOM_FRAGMENT_MAIN_END +} +`;e.ShadersStoreWGSL[a]||(e.ShadersStoreWGSL[a]=N);const de={name:a,shader:N};export{de as pbrPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbr.fragment-SkdUmqQC.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbr.fragment-SkdUmqQC.js new file mode 100644 index 0000000000000000000000000000000000000000..6f2b4273cc56124459756309e53a0cc46a4c4d7a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbr.fragment-SkdUmqQC.js @@ -0,0 +1,2657 @@ +import{S as e}from"./index-CDrXokXW.js";import"./oitFragment-_o5mqRWd.js";import"./pbrUboDeclaration-BaPvJwLw.js";import"./pbrDebug-ChQlKLz5.js";import"./shadowsFragmentFunctions-QR4_Qrt1.js";import"./bumpFragment-CNMCo4HD.js";import"./imageProcessingFunctions-dvOnE6xp.js";import"./clipPlaneFragment-T8W7CIC5.js";import"./logDepthDeclaration-DbMKMukk.js";import"./fogFragment-R9KOnWn-.js";import"./helperFunctions-BkWNqKeI.js";import"./hdrFilteringFunctions-DFleLIbL.js";import"./harmonicsFunctions-O6-VFzXR.js";import"./pbrBRDFFunctions-BEHyjaG2.js";import"./decalFragment-BXuRa219.js";import"./lightFragment-BRK1HqYL.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./meshUboDeclaration-C6raEdzf.js";import"./mainUVVaryingDeclaration-CYLIf35n.js";const n="pbrFragmentDeclaration",_=`uniform vec4 vEyePosition;uniform vec3 vReflectionColor;uniform vec4 vAlbedoColor;uniform float baseWeight;uniform float baseDiffuseRoughness;uniform vec4 vLightingIntensity;uniform vec4 vReflectivityColor;uniform vec4 vMetallicReflectanceFactors;uniform vec3 vEmissiveColor;uniform float visibility;uniform vec3 vAmbientColor; +#ifdef ALBEDO +uniform vec2 vAlbedoInfos; +#endif +#ifdef BASE_WEIGHT +uniform vec2 vBaseWeightInfos; +#endif +#ifdef BASE_DIFFUSE_ROUGHNESS +uniform vec2 vBaseDiffuseRoughnessInfos; +#endif +#ifdef AMBIENT +uniform vec4 vAmbientInfos; +#endif +#ifdef BUMP +uniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams; +#endif +#ifdef OPACITY +uniform vec2 vOpacityInfos; +#endif +#ifdef EMISSIVE +uniform vec2 vEmissiveInfos; +#endif +#ifdef LIGHTMAP +uniform vec2 vLightmapInfos; +#endif +#ifdef REFLECTIVITY +uniform vec3 vReflectivityInfos; +#endif +#ifdef MICROSURFACEMAP +uniform vec2 vMicroSurfaceSamplerInfos; +#endif +#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION) || defined(PREPASS) +uniform mat4 view; +#endif +#ifdef REFLECTION +uniform vec2 vReflectionInfos; +#ifdef REALTIME_FILTERING +uniform vec2 vReflectionFilteringInfo; +#endif +uniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos; +#if defined(USEIRRADIANCEMAP) && defined(USE_IRRADIANCE_DOMINANT_DIRECTION) +uniform vec3 vReflectionDominantDirection; +#endif +#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC) +uniform vec3 vReflectionPosition;uniform vec3 vReflectionSize; +#endif +#endif +#if defined(SS_REFRACTION) && defined(SS_USE_LOCAL_REFRACTIONMAP_CUBIC) +uniform vec3 vRefractionPosition;uniform vec3 vRefractionSize; +#endif +#ifdef CLEARCOAT +uniform vec2 vClearCoatParams;uniform vec4 vClearCoatRefractionParams; +#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS) +uniform vec4 vClearCoatInfos; +#endif +#ifdef CLEARCOAT_TEXTURE +uniform mat4 clearCoatMatrix; +#endif +#ifdef CLEARCOAT_TEXTURE_ROUGHNESS +uniform mat4 clearCoatRoughnessMatrix; +#endif +#ifdef CLEARCOAT_BUMP +uniform vec2 vClearCoatBumpInfos;uniform vec2 vClearCoatTangentSpaceParams;uniform mat4 clearCoatBumpMatrix; +#endif +#ifdef CLEARCOAT_TINT +uniform vec4 vClearCoatTintParams;uniform float clearCoatColorAtDistance; +#ifdef CLEARCOAT_TINT_TEXTURE +uniform vec2 vClearCoatTintInfos;uniform mat4 clearCoatTintMatrix; +#endif +#endif +#endif +#ifdef IRIDESCENCE +uniform vec4 vIridescenceParams; +#if defined(IRIDESCENCE_TEXTURE) || defined(IRIDESCENCE_THICKNESS_TEXTURE) +uniform vec4 vIridescenceInfos; +#endif +#ifdef IRIDESCENCE_TEXTURE +uniform mat4 iridescenceMatrix; +#endif +#ifdef IRIDESCENCE_THICKNESS_TEXTURE +uniform mat4 iridescenceThicknessMatrix; +#endif +#endif +#ifdef ANISOTROPIC +uniform vec3 vAnisotropy; +#ifdef ANISOTROPIC_TEXTURE +uniform vec2 vAnisotropyInfos;uniform mat4 anisotropyMatrix; +#endif +#endif +#ifdef SHEEN +uniform vec4 vSheenColor; +#ifdef SHEEN_ROUGHNESS +uniform float vSheenRoughness; +#endif +#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS) +uniform vec4 vSheenInfos; +#endif +#ifdef SHEEN_TEXTURE +uniform mat4 sheenMatrix; +#endif +#ifdef SHEEN_TEXTURE_ROUGHNESS +uniform mat4 sheenRoughnessMatrix; +#endif +#endif +#ifdef SUBSURFACE +#ifdef SS_REFRACTION +uniform vec4 vRefractionMicrosurfaceInfos;uniform vec4 vRefractionInfos;uniform mat4 refractionMatrix; +#ifdef REALTIME_FILTERING +uniform vec2 vRefractionFilteringInfo; +#endif +#ifdef SS_DISPERSION +uniform float dispersion; +#endif +#endif +#ifdef SS_THICKNESSANDMASK_TEXTURE +uniform vec2 vThicknessInfos;uniform mat4 thicknessMatrix; +#endif +#ifdef SS_REFRACTIONINTENSITY_TEXTURE +uniform vec2 vRefractionIntensityInfos;uniform mat4 refractionIntensityMatrix; +#endif +#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE +uniform vec2 vTranslucencyIntensityInfos;uniform mat4 translucencyIntensityMatrix; +#endif +uniform vec2 vThicknessParam;uniform vec3 vDiffusionDistance;uniform vec4 vTintColor;uniform vec3 vSubSurfaceIntensity;uniform vec4 vTranslucencyColor; +#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE +uniform vec2 vTranslucencyColorInfos;uniform mat4 translucencyColorMatrix; +#endif +#endif +#ifdef PREPASS +#ifdef SS_SCATTERING +uniform float scatteringDiffusionProfile; +#endif +#endif +#if DEBUGMODE>0 +uniform vec2 vDebugMode; +#endif +#ifdef DETAIL +uniform vec4 vDetailInfos; +#endif +#include +#ifdef USESPHERICALFROMREFLECTIONMAP +#ifdef SPHERICAL_HARMONICS +uniform vec3 vSphericalL00;uniform vec3 vSphericalL1_1;uniform vec3 vSphericalL10;uniform vec3 vSphericalL11;uniform vec3 vSphericalL2_2;uniform vec3 vSphericalL2_1;uniform vec3 vSphericalL20;uniform vec3 vSphericalL21;uniform vec3 vSphericalL22; +#else +uniform vec3 vSphericalX;uniform vec3 vSphericalY;uniform vec3 vSphericalZ;uniform vec3 vSphericalXX_ZZ;uniform vec3 vSphericalYY_ZZ;uniform vec3 vSphericalZZ;uniform vec3 vSphericalXY;uniform vec3 vSphericalYZ;uniform vec3 vSphericalZX; +#endif +#endif +#define ADDITIONAL_FRAGMENT_DECLARATION +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=_);const a="samplerFragmentAlternateDeclaration",M=`#ifdef _DEFINENAME_ +#if _DEFINENAME_DIRECTUV==1 +#define v_VARYINGNAME_UV vMainUV1 +#elif _DEFINENAME_DIRECTUV==2 +#define v_VARYINGNAME_UV vMainUV2 +#elif _DEFINENAME_DIRECTUV==3 +#define v_VARYINGNAME_UV vMainUV3 +#elif _DEFINENAME_DIRECTUV==4 +#define v_VARYINGNAME_UV vMainUV4 +#elif _DEFINENAME_DIRECTUV==5 +#define v_VARYINGNAME_UV vMainUV5 +#elif _DEFINENAME_DIRECTUV==6 +#define v_VARYINGNAME_UV vMainUV6 +#else +varying vec2 v_VARYINGNAME_UV; +#endif +#endif +`;e.IncludesShadersStore[a]||(e.IncludesShadersStore[a]=M);const r="pbrFragmentSamplersDeclaration",D=`#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo) +#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight) +#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_SAMPLERNAME_,baseDiffuseRoughness) +#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient) +#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity) +#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive) +#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap) +#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_SAMPLERNAME_,reflectivity) +#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_SAMPLERNAME_,microSurface) +#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_SAMPLERNAME_,metallicReflectance) +#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_SAMPLERNAME_,reflectance) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal) +#ifdef CLEARCOAT +#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_SAMPLERNAME_,clearCoat) +#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness) +#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) +uniform sampler2D clearCoatRoughnessSampler; +#endif +#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_SAMPLERNAME_,clearCoatBump) +#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_SAMPLERNAME_,clearCoatTint) +#endif +#ifdef IRIDESCENCE +#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_SAMPLERNAME_,iridescence) +#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_SAMPLERNAME_,iridescenceThickness) +#endif +#ifdef SHEEN +#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_SAMPLERNAME_,sheen) +#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness) +#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) +uniform sampler2D sheenRoughnessSampler; +#endif +#endif +#ifdef ANISOTROPIC +#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_SAMPLERNAME_,anisotropy) +#endif +#ifdef REFLECTION +#ifdef REFLECTIONMAP_3D +#define sampleReflection(s,c) textureCube(s,c) +uniform samplerCube reflectionSampler; +#ifdef LODBASEDMICROSFURACE +#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l) +#else +uniform samplerCube reflectionSamplerLow;uniform samplerCube reflectionSamplerHigh; +#endif +#ifdef USEIRRADIANCEMAP +uniform samplerCube irradianceSampler; +#endif +#else +#define sampleReflection(s,c) texture2D(s,c) +uniform sampler2D reflectionSampler; +#ifdef LODBASEDMICROSFURACE +#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l) +#else +uniform sampler2D reflectionSamplerLow;uniform sampler2D reflectionSamplerHigh; +#endif +#ifdef USEIRRADIANCEMAP +uniform sampler2D irradianceSampler; +#endif +#endif +#ifdef REFLECTIONMAP_SKYBOX +varying vec3 vPositionUVW; +#else +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vec3 vDirectionW; +#endif +#endif +#endif +#ifdef ENVIRONMENTBRDF +uniform sampler2D environmentBrdfSampler; +#endif +#ifdef SUBSURFACE +#ifdef SS_REFRACTION +#ifdef SS_REFRACTIONMAP_3D +#define sampleRefraction(s,c) textureCube(s,c) +uniform samplerCube refractionSampler; +#ifdef LODBASEDMICROSFURACE +#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l) +#else +uniform samplerCube refractionSamplerLow;uniform samplerCube refractionSamplerHigh; +#endif +#else +#define sampleRefraction(s,c) texture2D(s,c) +uniform sampler2D refractionSampler; +#ifdef LODBASEDMICROSFURACE +#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l) +#else +uniform sampler2D refractionSamplerLow;uniform sampler2D refractionSamplerHigh; +#endif +#endif +#endif +#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_SAMPLERNAME_,thickness) +#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_SAMPLERNAME_,refractionIntensity) +#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_SAMPLERNAME_,translucencyIntensity) +#include(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor,_SAMPLERNAME_,translucencyColor) +#endif +#ifdef IBL_CDF_FILTERING +uniform sampler2D icdfSampler; +#endif +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=D);const f="pbrBlockAlbedoOpacity",h=`struct albedoOpacityOutParams +{vec3 surfaceAlbedo;float alpha;}; +#define pbr_inline +albedoOpacityOutParams albedoOpacityBlock( +in vec4 vAlbedoColor +#ifdef ALBEDO +,in vec4 albedoTexture +,in vec2 albedoInfos +#endif +,in float baseWeight +#ifdef BASE_WEIGHT +,in vec4 baseWeightTexture +,in vec2 vBaseWeightInfos +#endif +#ifdef OPACITY +,in vec4 opacityMap +,in vec2 vOpacityInfos +#endif +#ifdef DETAIL +,in vec4 detailColor +,in vec4 vDetailInfos +#endif +#ifdef DECAL +,in vec4 decalColor +,in vec4 vDecalInfos +#endif +) +{albedoOpacityOutParams outParams;vec3 surfaceAlbedo=vAlbedoColor.rgb;float alpha=vAlbedoColor.a; +#ifdef ALBEDO +#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST) +alpha*=albedoTexture.a; +#endif +#ifdef GAMMAALBEDO +surfaceAlbedo*=toLinearSpace(albedoTexture.rgb); +#else +surfaceAlbedo*=albedoTexture.rgb; +#endif +surfaceAlbedo*=albedoInfos.y; +#endif +#ifndef DECAL_AFTER_DETAIL +#include +#endif +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +surfaceAlbedo*=vColor.rgb; +#endif +#ifdef DETAIL +float detailAlbedo=2.0*mix(0.5,detailColor.r,vDetailInfos.y);surfaceAlbedo.rgb=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo; +#endif +#ifdef DECAL_AFTER_DETAIL +#include +#endif +#define CUSTOM_FRAGMENT_UPDATE_ALBEDO +surfaceAlbedo*=baseWeight; +#ifdef BASE_WEIGHT +surfaceAlbedo*=baseWeightTexture.r; +#endif +#ifdef OPACITY +#ifdef OPACITYRGB +alpha=getLuminance(opacityMap.rgb); +#else +alpha*=opacityMap.a; +#endif +alpha*=vOpacityInfos.y; +#endif +#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES) +alpha*=vColor.a; +#endif +#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL) +#ifdef ALPHATEST +#if DEBUGMODE != 88 +if (alpha0 +#ifdef METALLICWORKFLOW +#ifdef REFLECTIVITY +vec4 surfaceMetallicColorMap; +#endif +vec3 metallicF0; +#else +#ifdef REFLECTIVITY +vec4 surfaceReflectivityColorMap; +#endif +#endif +#endif +}; +#define pbr_inline +reflectivityOutParams reflectivityBlock( +in vec4 reflectivityColor +#ifdef METALLICWORKFLOW +,in vec3 surfaceAlbedo +,in vec4 metallicReflectanceFactors +#endif +,in float baseDiffuseRoughness +#ifdef BASE_DIFFUSE_ROUGHNESS +,in float baseDiffuseRoughnessTexture +,in vec2 baseDiffuseRoughnessInfos +#endif +#ifdef REFLECTIVITY +,in vec3 reflectivityInfos +,in vec4 surfaceMetallicOrReflectivityColorMap +#endif +#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED) +,in vec3 ambientOcclusionColorIn +#endif +#ifdef MICROSURFACEMAP +,in vec4 microSurfaceTexel +#endif +#ifdef DETAIL +,in vec4 detailColor +,in vec4 vDetailInfos +#endif +) +{reflectivityOutParams outParams;float microSurface=reflectivityColor.a;vec3 surfaceReflectivityColor=reflectivityColor.rgb; +#ifdef METALLICWORKFLOW +vec2 metallicRoughness=surfaceReflectivityColor.rg;float ior=surfaceReflectivityColor.b; +#ifdef REFLECTIVITY +#if DEBUGMODE>0 +outParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap; +#endif +#ifdef AOSTOREINMETALMAPRED +vec3 aoStoreInMetalMap=vec3(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);outParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,reflectivityInfos.z); +#endif +#ifdef METALLNESSSTOREINMETALMAPBLUE +metallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b; +#else +metallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r; +#endif +#ifdef ROUGHNESSSTOREINMETALMAPALPHA +metallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a; +#else +#ifdef ROUGHNESSSTOREINMETALMAPGREEN +metallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g; +#endif +#endif +#endif +#ifdef DETAIL +float detailRoughness=mix(0.5,detailColor.b,vDetailInfos.w);float loLerp=mix(0.,metallicRoughness.g,detailRoughness*2.);float hiLerp=mix(metallicRoughness.g,1.,(detailRoughness-0.5)*2.);metallicRoughness.g=mix(loLerp,hiLerp,step(detailRoughness,0.5)); +#endif +#ifdef MICROSURFACEMAP +metallicRoughness.g*=microSurfaceTexel.r; +#endif +#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS +microSurface=1.0-metallicRoughness.g;vec3 baseColor=surfaceAlbedo;outParams.metallic=metallicRoughness.r;outParams.specularWeight=metallicReflectanceFactors.a;float dielectricF0=reflectivityColor.a*outParams.specularWeight;surfaceReflectivityColor=metallicReflectanceFactors.rgb; +#if DEBUGMODE>0 +outParams.metallicF0=vec3(dielectricF0)*surfaceReflectivityColor; +#endif +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +outParams.surfaceAlbedo=baseColor.rgb*(vec3(1.0)-vec3(dielectricF0)*surfaceReflectivityColor)*(1.0-outParams.metallic); +#else +outParams.surfaceAlbedo=baseColor.rgb; +#endif +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +{vec3 reflectivityColor=mix(dielectricF0*surfaceReflectivityColor,baseColor.rgb,outParams.metallic);outParams.reflectanceF0=max(reflectivityColor.r,max(reflectivityColor.g,reflectivityColor.b));} +#else +#if DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_GLTF +float maxF0=max(surfaceReflectivityColor.r,max(surfaceReflectivityColor.g,surfaceReflectivityColor.b));outParams.reflectanceF0=mix(dielectricF0*maxF0,1.0,outParams.metallic); +#else +outParams.reflectanceF0=mix(dielectricF0,1.0,outParams.metallic); +#endif +#endif +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +outParams.reflectanceF90=vec3(outParams.specularWeight);float f90Scale=1.0; +#else +float f90Scale=clamp(2.0*(ior-1.0),0.0,1.0);outParams.reflectanceF90=vec3(mix(outParams.specularWeight*f90Scale,1.0,outParams.metallic)); +#endif +outParams.dielectricColorF0=vec3(dielectricF0*surfaceReflectivityColor);vec3 metallicColorF0=baseColor.rgb;outParams.colorReflectanceF0=mix(outParams.dielectricColorF0,metallicColorF0,outParams.metallic); +#if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR) +vec3 dielectricColorF90=surfaceReflectivityColor*vec3(outParams.specularWeight)*vec3(f90Scale); +#else +vec3 dielectricColorF90=vec3(outParams.specularWeight*f90Scale); +#endif +#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) +vec3 conductorColorF90=surfaceReflectivityColor; +#else +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +vec3 conductorColorF90=outParams.reflectanceF90; +#else +vec3 conductorColorF90=vec3(1.0); +#endif +#endif +outParams.colorReflectanceF90=mix(dielectricColorF90,conductorColorF90,outParams.metallic); +#else +#ifdef REFLECTIVITY +surfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb; +#if DEBUGMODE>0 +outParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap; +#endif +#ifdef MICROSURFACEFROMREFLECTIVITYMAP +microSurface*=surfaceMetallicOrReflectivityColorMap.a;microSurface*=reflectivityInfos.z; +#else +#ifdef MICROSURFACEAUTOMATIC +microSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor); +#endif +#ifdef MICROSURFACEMAP +microSurface*=microSurfaceTexel.r; +#endif +#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE +#endif +#endif +outParams.colorReflectanceF0=surfaceReflectivityColor;outParams.reflectanceF0=max(surfaceReflectivityColor.r,max(surfaceReflectivityColor.g,surfaceReflectivityColor.b));outParams.reflectanceF90=vec3(1.0); +#if (DIELECTRIC_SPECULAR_MODEL==DIELECTRIC_SPECULAR_MODEL_OPENPBR) +outParams.colorReflectanceF90=surfaceReflectivityColor; +#else +outParams.colorReflectanceF90=vec3(1.0); +#endif +#endif +microSurface=saturate(microSurface);float roughness=1.-microSurface;float diffuseRoughness=baseDiffuseRoughness; +#ifdef BASE_DIFFUSE_ROUGHNESS +diffuseRoughness*=baseDiffuseRoughnessTexture*baseDiffuseRoughnessInfos.y; +#endif +outParams.microSurface=microSurface;outParams.roughness=roughness;outParams.diffuseRoughness=diffuseRoughness;return outParams;} +`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=F);const t="pbrBlockAmbientOcclusion",g=`struct ambientOcclusionOutParams +{vec3 ambientOcclusionColor; +#if DEBUGMODE>0 && defined(AMBIENT) +vec3 ambientOcclusionColorMap; +#endif +};ambientOcclusionOutParams ambientOcclusionBlock( +#ifdef AMBIENT +in vec3 ambientOcclusionColorMap_, +in vec4 vAmbientInfos +#endif +) +{ambientOcclusionOutParams outParams;vec3 ambientOcclusionColor=vec3(1.,1.,1.); +#ifdef AMBIENT +vec3 ambientOcclusionColorMap=ambientOcclusionColorMap_*vAmbientInfos.y; +#ifdef AMBIENTINGRAYSCALE +ambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r); +#endif +ambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z); +#if DEBUGMODE>0 +outParams.ambientOcclusionColorMap=ambientOcclusionColorMap; +#endif +#endif +outParams.ambientOcclusionColor=ambientOcclusionColor;return outParams;} +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=g);const c="pbrBlockAlphaFresnel",P=`#ifdef ALPHAFRESNEL +#if defined(ALPHATEST) || defined(ALPHABLEND) +struct alphaFresnelOutParams +{float alpha;}; +#define pbr_inline +alphaFresnelOutParams alphaFresnelBlock( +in vec3 normalW, +in vec3 viewDirectionW, +in float alpha, +in float microSurface +) +{alphaFresnelOutParams outParams;float opacityPerceptual=alpha; +#ifdef LINEARALPHAFRESNEL +float opacity0=opacityPerceptual; +#else +float opacity0=opacityPerceptual*opacityPerceptual; +#endif +float opacity90=fresnelGrazingReflectance(opacity0);vec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);outParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x; +#ifdef ALPHATEST +if (outParams.alpha0 && defined(ANISOTROPIC_TEXTURE) +vec3 anisotropyMapData; +#endif +}; +#define pbr_inline +anisotropicOutParams anisotropicBlock( +in vec3 vAnisotropy, +in float roughness, +#ifdef ANISOTROPIC_TEXTURE +in vec3 anisotropyMapData, +#endif +in mat3 TBN, +in vec3 normalW, +in vec3 viewDirectionW +) +{anisotropicOutParams outParams;float anisotropy=vAnisotropy.b;vec3 anisotropyDirection=vec3(vAnisotropy.xy,0.); +#ifdef ANISOTROPIC_TEXTURE +anisotropy*=anisotropyMapData.b; +#if DEBUGMODE>0 +outParams.anisotropyMapData=anisotropyMapData; +#endif +anisotropyMapData.rg=anisotropyMapData.rg*2.0-1.0; +#ifdef ANISOTROPIC_LEGACY +anisotropyDirection.rg*=anisotropyMapData.rg; +#else +anisotropyDirection.xy=mat2(anisotropyDirection.x,anisotropyDirection.y,-anisotropyDirection.y,anisotropyDirection.x)*normalize(anisotropyMapData.rg); +#endif +#endif +mat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));vec3 anisotropicTangent=normalize(anisoTBN*anisotropyDirection);vec3 anisotropicBitangent=normalize(cross(anisoTBN[2],anisotropicTangent));outParams.anisotropy=anisotropy;outParams.anisotropicTangent=anisotropicTangent;outParams.anisotropicBitangent=anisotropicBitangent;outParams.anisotropicNormal=getAnisotropicBentNormals(anisotropicTangent,anisotropicBitangent,normalW,viewDirectionW,anisotropy,roughness);return outParams;} +#endif +`;e.IncludesShadersStore[l]||(e.IncludesShadersStore[l]=U);const d="pbrBlockReflection",b=`#ifdef REFLECTION +struct reflectionOutParams +{vec4 environmentRadiance;vec3 environmentIrradiance; +#ifdef REFLECTIONMAP_3D +vec3 reflectionCoords; +#else +vec2 reflectionCoords; +#endif +#ifdef SS_TRANSLUCENCY +#ifdef USESPHERICALFROMREFLECTIONMAP +#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX) +vec3 irradianceVector; +#endif +#endif +#endif +}; +#define pbr_inline +void createReflectionCoords( +in vec3 vPositionW, +in vec3 normalW, +#ifdef ANISOTROPIC +in anisotropicOutParams anisotropicOut, +#endif +#ifdef REFLECTIONMAP_3D +out vec3 reflectionCoords +#else +out vec2 reflectionCoords +#endif +) +{ +#ifdef ANISOTROPIC +vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),anisotropicOut.anisotropicNormal); +#else +vec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW); +#endif +#ifdef REFLECTIONMAP_OPPOSITEZ +reflectionVector.z*=-1.0; +#endif +#ifdef REFLECTIONMAP_3D +reflectionCoords=reflectionVector; +#else +reflectionCoords=reflectionVector.xy; +#ifdef REFLECTIONMAP_PROJECTION +reflectionCoords/=reflectionVector.z; +#endif +reflectionCoords.y=1.0-reflectionCoords.y; +#endif +} +#define pbr_inline +#define inline +void sampleReflectionTexture( +in float alphaG, +in vec3 vReflectionMicrosurfaceInfos, +in vec2 vReflectionInfos, +in vec3 vReflectionColor, +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +in float NdotVUnclamped, +#endif +#ifdef LINEARSPECULARREFLECTION +in float roughness, +#endif +#ifdef REFLECTIONMAP_3D +in samplerCube reflectionSampler, +const vec3 reflectionCoords, +#else +in sampler2D reflectionSampler, +const vec2 reflectionCoords, +#endif +#ifndef LODBASEDMICROSFURACE +#ifdef REFLECTIONMAP_3D +in samplerCube reflectionSamplerLow, +in samplerCube reflectionSamplerHigh, +#else +in sampler2D reflectionSamplerLow, +in sampler2D reflectionSamplerHigh, +#endif +#endif +#ifdef REALTIME_FILTERING +in vec2 vReflectionFilteringInfo, +#endif +out vec4 environmentRadiance +) +{ +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped); +#elif defined(LINEARSPECULARREFLECTION) +float reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness); +#else +float reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG); +#endif +#ifdef LODBASEDMICROSFURACE +reflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z; +#ifdef LODINREFLECTIONALPHA +float automaticReflectionLOD=UNPACK_LOD(sampleReflection(reflectionSampler,reflectionCoords).a);float requestedReflectionLOD=max(automaticReflectionLOD,reflectionLOD); +#else +float requestedReflectionLOD=reflectionLOD; +#endif +#ifdef REALTIME_FILTERING +environmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0); +#else +environmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD); +#endif +#else +float lodReflectionNormalized=saturate(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x));float lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;vec4 environmentMid=sampleReflection(reflectionSampler,reflectionCoords);if (lodReflectionNormalizedDoubled<1.0){environmentRadiance=mix( +sampleReflection(reflectionSamplerHigh,reflectionCoords), +environmentMid, +lodReflectionNormalizedDoubled +);} else {environmentRadiance=mix( +environmentMid, +sampleReflection(reflectionSamplerLow,reflectionCoords), +lodReflectionNormalizedDoubled-1.0 +);} +#endif +#ifdef RGBDREFLECTION +environmentRadiance.rgb=fromRGBD(environmentRadiance); +#endif +#ifdef GAMMAREFLECTION +environmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb); +#endif +environmentRadiance.rgb*=vReflectionInfos.x;environmentRadiance.rgb*=vReflectionColor.rgb;} +#define pbr_inline +#define inline +reflectionOutParams reflectionBlock( +in vec3 vPositionW +,in vec3 normalW +,in float alphaG +,in vec3 vReflectionMicrosurfaceInfos +,in vec2 vReflectionInfos +,in vec3 vReflectionColor +#ifdef ANISOTROPIC +,in anisotropicOutParams anisotropicOut +#endif +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +,in float NdotVUnclamped +#endif +#ifdef LINEARSPECULARREFLECTION +,in float roughness +#endif +#ifdef REFLECTIONMAP_3D +,in samplerCube reflectionSampler +#else +,in sampler2D reflectionSampler +#endif +#if defined(NORMAL) && defined(USESPHERICALINVERTEX) +,in vec3 vEnvironmentIrradiance +#endif +#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D)) +,in mat4 reflectionMatrix +#endif +#ifdef USEIRRADIANCEMAP +#ifdef REFLECTIONMAP_3D +,in samplerCube irradianceSampler +#else +,in sampler2D irradianceSampler +#endif +#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION +,in vec3 reflectionDominantDirection +#endif +#endif +#ifndef LODBASEDMICROSFURACE +#ifdef REFLECTIONMAP_3D +,in samplerCube reflectionSamplerLow +,in samplerCube reflectionSamplerHigh +#else +,in sampler2D reflectionSamplerLow +,in sampler2D reflectionSamplerHigh +#endif +#endif +#ifdef REALTIME_FILTERING +,in vec2 vReflectionFilteringInfo +#ifdef IBL_CDF_FILTERING +,in sampler2D icdfSampler +#endif +#endif +,in vec3 viewDirectionW +,in float diffuseRoughness +,in vec3 surfaceAlbedo +) +{reflectionOutParams outParams;vec4 environmentRadiance=vec4(0.,0.,0.,0.); +#ifdef REFLECTIONMAP_3D +vec3 reflectionCoords=vec3(0.); +#else +vec2 reflectionCoords=vec2(0.); +#endif +createReflectionCoords( +vPositionW, +normalW, +#ifdef ANISOTROPIC +anisotropicOut, +#endif +reflectionCoords +);sampleReflectionTexture( +alphaG, +vReflectionMicrosurfaceInfos, +vReflectionInfos, +vReflectionColor, +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +NdotVUnclamped, +#endif +#ifdef LINEARSPECULARREFLECTION +roughness, +#endif +#ifdef REFLECTIONMAP_3D +reflectionSampler, +reflectionCoords, +#else +reflectionSampler, +reflectionCoords, +#endif +#ifndef LODBASEDMICROSFURACE +reflectionSamplerLow, +reflectionSamplerHigh, +#endif +#ifdef REALTIME_FILTERING +vReflectionFilteringInfo, +#endif +environmentRadiance +);vec3 environmentIrradiance=vec3(0.,0.,0.); +#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D)) +#ifdef ANISOTROPIC +vec3 irradianceVector=vec3(reflectionMatrix*vec4(anisotropicOut.anisotropicNormal,0)).xyz; +#else +vec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz; +#endif +vec3 irradianceView=vec3(reflectionMatrix*vec4(viewDirectionW,0)).xyz; +#if !defined(USE_IRRADIANCE_DOMINANT_DIRECTION) && !defined(REALTIME_FILTERING) +#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY +float NdotV=max(dot(normalW,viewDirectionW),0.0);irradianceVector=mix(irradianceVector,irradianceView,(0.5*(1.0-NdotV))*diffuseRoughness); +#endif +#endif +#ifdef REFLECTIONMAP_OPPOSITEZ +irradianceVector.z*=-1.0; +#endif +#ifdef INVERTCUBICMAP +irradianceVector.y*=-1.0; +#endif +#endif +#ifdef USESPHERICALFROMREFLECTIONMAP +#if defined(NORMAL) && defined(USESPHERICALINVERTEX) +environmentIrradiance=vEnvironmentIrradiance; +#else +#if defined(REALTIME_FILTERING) +environmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo,diffuseRoughness,surfaceAlbedo,irradianceView +#ifdef IBL_CDF_FILTERING +,icdfSampler +#endif +); +#else +environmentIrradiance=computeEnvironmentIrradiance(irradianceVector); +#endif +#ifdef SS_TRANSLUCENCY +outParams.irradianceVector=irradianceVector; +#endif +#endif +#elif defined(USEIRRADIANCEMAP) +#ifdef REFLECTIONMAP_3D +vec4 environmentIrradiance4=sampleReflection(irradianceSampler,irradianceVector); +#else +vec4 environmentIrradiance4=sampleReflection(irradianceSampler,reflectionCoords); +#endif +environmentIrradiance=environmentIrradiance4.rgb; +#ifdef RGBDREFLECTION +environmentIrradiance.rgb=fromRGBD(environmentIrradiance4); +#endif +#ifdef GAMMAREFLECTION +environmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb); +#endif +#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION +vec3 Ls=normalize(reflectionDominantDirection);float NoL=dot(irradianceVector,Ls);float NoV=dot(irradianceVector,irradianceView);vec3 diffuseRoughnessTerm=vec3(1.0); +#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON +float LoV=dot (Ls,irradianceView);float mag=length(reflectionDominantDirection)*2.0;vec3 clampedAlbedo=clamp(surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseRoughnessTerm=diffuseBRDF_EON(clampedAlbedo,diffuseRoughness,NoL,NoV,LoV)*PI;diffuseRoughnessTerm=diffuseRoughnessTerm/clampedAlbedo;diffuseRoughnessTerm=mix(vec3(1.0),diffuseRoughnessTerm,sqrt(clamp(mag*NoV,0.0,1.0))); +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY +vec3 H=(irradianceView+Ls)*0.5;float VoH=dot(irradianceView,H);diffuseRoughnessTerm=vec3(diffuseBRDF_Burley(NoL,NoV,VoH,diffuseRoughness)*PI); +#endif +environmentIrradiance=environmentIrradiance.rgb*diffuseRoughnessTerm; +#endif +#endif +environmentIrradiance*=vReflectionColor.rgb*vReflectionInfos.x; +#ifdef MIX_IBL_RADIANCE_WITH_IRRADIANCE +outParams.environmentRadiance=vec4(mix(environmentRadiance.rgb,environmentIrradiance,alphaG),environmentRadiance.a); +#else +outParams.environmentRadiance=environmentRadiance; +#endif +outParams.environmentIrradiance=environmentIrradiance;outParams.reflectionCoords=reflectionCoords;return outParams;} +#endif +`;e.IncludesShadersStore[d]||(e.IncludesShadersStore[d]=b);const s="pbrBlockSheen",y=`#ifdef SHEEN +struct sheenOutParams +{float sheenIntensity;vec3 sheenColor;float sheenRoughness; +#ifdef SHEEN_LINKWITHALBEDO +vec3 surfaceAlbedo; +#endif +#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING) +float sheenAlbedoScaling; +#endif +#if defined(REFLECTION) && defined(ENVIRONMENTBRDF) +vec3 finalSheenRadianceScaled; +#endif +#if DEBUGMODE>0 +#ifdef SHEEN_TEXTURE +vec4 sheenMapData; +#endif +#if defined(REFLECTION) && defined(ENVIRONMENTBRDF) +vec3 sheenEnvironmentReflectance; +#endif +#endif +}; +#define pbr_inline +#define inline +sheenOutParams sheenBlock( +in vec4 vSheenColor +#ifdef SHEEN_ROUGHNESS +,in float vSheenRoughness +#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE) +,in vec4 sheenMapRoughnessData +#endif +#endif +,in float roughness +#ifdef SHEEN_TEXTURE +,in vec4 sheenMapData +,in float sheenMapLevel +#endif +,in float reflectance +#ifdef SHEEN_LINKWITHALBEDO +,in vec3 baseColor +,in vec3 surfaceAlbedo +#endif +#ifdef ENVIRONMENTBRDF +,in float NdotV +,in vec3 environmentBrdf +#endif +#if defined(REFLECTION) && defined(ENVIRONMENTBRDF) +,in vec2 AARoughnessFactors +,in vec3 vReflectionMicrosurfaceInfos +,in vec2 vReflectionInfos +,in vec3 vReflectionColor +,in vec4 vLightingIntensity +#ifdef REFLECTIONMAP_3D +,in samplerCube reflectionSampler +,in vec3 reflectionCoords +#else +,in sampler2D reflectionSampler +,in vec2 reflectionCoords +#endif +,in float NdotVUnclamped +#ifndef LODBASEDMICROSFURACE +#ifdef REFLECTIONMAP_3D +,in samplerCube reflectionSamplerLow +,in samplerCube reflectionSamplerHigh +#else +,in sampler2D reflectionSamplerLow +,in sampler2D reflectionSamplerHigh +#endif +#endif +#ifdef REALTIME_FILTERING +,in vec2 vReflectionFilteringInfo +#endif +#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION) +,in float seo +#endif +#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D) +,in float eho +#endif +#endif +) +{sheenOutParams outParams;float sheenIntensity=vSheenColor.a; +#ifdef SHEEN_TEXTURE +#if DEBUGMODE>0 +outParams.sheenMapData=sheenMapData; +#endif +#endif +#ifdef SHEEN_LINKWITHALBEDO +float sheenFactor=pow5(1.0-sheenIntensity);vec3 sheenColor=baseColor.rgb*(1.0-sheenFactor);float sheenRoughness=sheenIntensity;outParams.surfaceAlbedo=surfaceAlbedo*sheenFactor; +#ifdef SHEEN_TEXTURE +sheenIntensity*=sheenMapData.a; +#endif +#else +vec3 sheenColor=vSheenColor.rgb; +#ifdef SHEEN_TEXTURE +#ifdef SHEEN_GAMMATEXTURE +sheenColor.rgb*=toLinearSpace(sheenMapData.rgb); +#else +sheenColor.rgb*=sheenMapData.rgb; +#endif +sheenColor.rgb*=sheenMapLevel; +#endif +#ifdef SHEEN_ROUGHNESS +float sheenRoughness=vSheenRoughness; +#ifdef SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE +#if defined(SHEEN_TEXTURE) +sheenRoughness*=sheenMapData.a; +#endif +#elif defined(SHEEN_TEXTURE_ROUGHNESS) +sheenRoughness*=sheenMapRoughnessData.a; +#endif +#else +float sheenRoughness=roughness; +#ifdef SHEEN_TEXTURE +sheenIntensity*=sheenMapData.a; +#endif +#endif +#if !defined(SHEEN_ALBEDOSCALING) +sheenIntensity*=(1.-reflectance); +#endif +sheenColor*=sheenIntensity; +#endif +#ifdef ENVIRONMENTBRDF +/*#ifdef SHEEN_SOFTER +vec3 environmentSheenBrdf=vec3(0.,0.,getBRDFLookupCharlieSheen(NdotV,sheenRoughness)); +#else*/ +#ifdef SHEEN_ROUGHNESS +vec3 environmentSheenBrdf=getBRDFLookup(NdotV,sheenRoughness); +#else +vec3 environmentSheenBrdf=environmentBrdf; +#endif +/*#endif*/ +#endif +#if defined(REFLECTION) && defined(ENVIRONMENTBRDF) +float sheenAlphaG=convertRoughnessToAverageSlope(sheenRoughness); +#ifdef SPECULARAA +sheenAlphaG+=AARoughnessFactors.y; +#endif +vec4 environmentSheenRadiance=vec4(0.,0.,0.,0.);sampleReflectionTexture( +sheenAlphaG, +vReflectionMicrosurfaceInfos, +vReflectionInfos, +vReflectionColor, +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +NdotVUnclamped, +#endif +#ifdef LINEARSPECULARREFLECTION +sheenRoughness, +#endif +reflectionSampler, +reflectionCoords, +#ifndef LODBASEDMICROSFURACE +reflectionSamplerLow, +reflectionSamplerHigh, +#endif +#ifdef REALTIME_FILTERING +vReflectionFilteringInfo, +#endif +environmentSheenRadiance +);vec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf); +#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION) +sheenEnvironmentReflectance*=seo; +#endif +#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D) +sheenEnvironmentReflectance*=eho; +#endif +#if DEBUGMODE>0 +outParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance; +#endif +outParams.finalSheenRadianceScaled= +environmentSheenRadiance.rgb * +sheenEnvironmentReflectance * +vLightingIntensity.z; +#endif +#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING) +outParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b; +#endif +outParams.sheenIntensity=sheenIntensity;outParams.sheenColor=sheenColor;outParams.sheenRoughness=sheenRoughness;return outParams;} +#endif +`;e.IncludesShadersStore[s]||(e.IncludesShadersStore[s]=y);const E="pbrBlockClearcoat",B=`struct clearcoatOutParams +{vec3 specularEnvironmentR0;float conservationFactor;vec3 clearCoatNormalW;vec2 clearCoatAARoughnessFactors;float clearCoatIntensity;float clearCoatRoughness; +#ifdef REFLECTION +vec3 finalClearCoatRadianceScaled; +#endif +#ifdef CLEARCOAT_TINT +vec3 absorption;float clearCoatNdotVRefract;vec3 clearCoatColor;float clearCoatThickness; +#endif +#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION) +vec3 energyConservationFactorClearCoat; +#endif +#if DEBUGMODE>0 +#ifdef CLEARCOAT_BUMP +mat3 TBNClearCoat; +#endif +#ifdef CLEARCOAT_TEXTURE +vec2 clearCoatMapData; +#endif +#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE) +vec4 clearCoatTintMapData; +#endif +#ifdef REFLECTION +vec4 environmentClearCoatRadiance;vec3 clearCoatEnvironmentReflectance; +#endif +float clearCoatNdotV; +#endif +}; +#ifdef CLEARCOAT +#define pbr_inline +#define inline +clearcoatOutParams clearcoatBlock( +in vec3 vPositionW +,in vec3 geometricNormalW +,in vec3 viewDirectionW +,in vec2 vClearCoatParams +#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) +,in vec4 clearCoatMapRoughnessData +#endif +,in vec3 specularEnvironmentR0 +#ifdef CLEARCOAT_TEXTURE +,in vec2 clearCoatMapData +#endif +#ifdef CLEARCOAT_TINT +,in vec4 vClearCoatTintParams +,in float clearCoatColorAtDistance +,in vec4 vClearCoatRefractionParams +#ifdef CLEARCOAT_TINT_TEXTURE +,in vec4 clearCoatTintMapData +#endif +#endif +#ifdef CLEARCOAT_BUMP +,in vec2 vClearCoatBumpInfos +,in vec4 clearCoatBumpMapData +,in vec2 vClearCoatBumpUV +#if defined(TANGENT) && defined(NORMAL) +,in mat3 vTBN +#else +,in vec2 vClearCoatTangentSpaceParams +#endif +#ifdef OBJECTSPACE_NORMALMAP +,in mat4 normalMatrix +#endif +#endif +#if defined(FORCENORMALFORWARD) && defined(NORMAL) +,in vec3 faceNormal +#endif +#ifdef REFLECTION +,in vec3 vReflectionMicrosurfaceInfos +,in vec2 vReflectionInfos +,in vec3 vReflectionColor +,in vec4 vLightingIntensity +#ifdef REFLECTIONMAP_3D +,in samplerCube reflectionSampler +#else +,in sampler2D reflectionSampler +#endif +#ifndef LODBASEDMICROSFURACE +#ifdef REFLECTIONMAP_3D +,in samplerCube reflectionSamplerLow +,in samplerCube reflectionSamplerHigh +#else +,in sampler2D reflectionSamplerLow +,in sampler2D reflectionSamplerHigh +#endif +#endif +#ifdef REALTIME_FILTERING +,in vec2 vReflectionFilteringInfo +#endif +#endif +#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING) +,in float frontFacingMultiplier +#endif +) +{clearcoatOutParams outParams;float clearCoatIntensity=vClearCoatParams.x;float clearCoatRoughness=vClearCoatParams.y; +#ifdef CLEARCOAT_TEXTURE +clearCoatIntensity*=clearCoatMapData.x; +#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE +clearCoatRoughness*=clearCoatMapData.y; +#endif +#if DEBUGMODE>0 +outParams.clearCoatMapData=clearCoatMapData; +#endif +#endif +#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) +clearCoatRoughness*=clearCoatMapRoughnessData.y; +#endif +outParams.clearCoatIntensity=clearCoatIntensity;outParams.clearCoatRoughness=clearCoatRoughness; +#ifdef CLEARCOAT_TINT +vec3 clearCoatColor=vClearCoatTintParams.rgb;float clearCoatThickness=vClearCoatTintParams.a; +#ifdef CLEARCOAT_TINT_TEXTURE +#ifdef CLEARCOAT_TINT_GAMMATEXTURE +clearCoatColor*=toLinearSpace(clearCoatTintMapData.rgb); +#else +clearCoatColor*=clearCoatTintMapData.rgb; +#endif +clearCoatThickness*=clearCoatTintMapData.a; +#if DEBUGMODE>0 +outParams.clearCoatTintMapData=clearCoatTintMapData; +#endif +#endif +outParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);outParams.clearCoatThickness=clearCoatThickness; +#endif +#ifdef CLEARCOAT_REMAP_F0 +vec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0); +#else +vec3 specularEnvironmentR0Updated=specularEnvironmentR0; +#endif +outParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);vec3 clearCoatNormalW=geometricNormalW; +#ifdef CLEARCOAT_BUMP +#ifdef NORMALXYSCALE +float clearCoatNormalScale=1.0; +#else +float clearCoatNormalScale=vClearCoatBumpInfos.y; +#endif +#if defined(TANGENT) && defined(NORMAL) +mat3 TBNClearCoat=vTBN; +#else +vec2 TBNClearCoatUV=vClearCoatBumpUV*frontFacingMultiplier;mat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,TBNClearCoatUV,vClearCoatTangentSpaceParams); +#endif +#if DEBUGMODE>0 +outParams.TBNClearCoat=TBNClearCoat; +#endif +#ifdef OBJECTSPACE_NORMALMAP +clearCoatNormalW=normalize(clearCoatBumpMapData.xyz *2.0-1.0);clearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW); +#else +clearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y); +#endif +#endif +#if defined(FORCENORMALFORWARD) && defined(NORMAL) +clearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal)); +#endif +#if defined(TWOSIDEDLIGHTING) && defined(NORMAL) +clearCoatNormalW=clearCoatNormalW*frontFacingMultiplier; +#endif +outParams.clearCoatNormalW=clearCoatNormalW;outParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);float clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);float clearCoatNdotV=absEps(clearCoatNdotVUnclamped); +#if DEBUGMODE>0 +outParams.clearCoatNdotV=clearCoatNdotV; +#endif +#ifdef CLEARCOAT_TINT +vec3 clearCoatVRefract=refract(-viewDirectionW,clearCoatNormalW,vClearCoatRefractionParams.y);outParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract)); +#endif +#if defined(ENVIRONMENTBRDF) && (!defined(REFLECTIONMAP_SKYBOX) || defined(MS_BRDF_ENERGY_CONSERVATION)) +vec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness); +#endif +#if defined(REFLECTION) +float clearCoatAlphaG=convertRoughnessToAverageSlope(clearCoatRoughness); +#ifdef SPECULARAA +clearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y; +#endif +vec4 environmentClearCoatRadiance=vec4(0.,0.,0.,0.);vec3 clearCoatReflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),clearCoatNormalW); +#ifdef REFLECTIONMAP_OPPOSITEZ +clearCoatReflectionVector.z*=-1.0; +#endif +#ifdef REFLECTIONMAP_3D +vec3 clearCoatReflectionCoords=clearCoatReflectionVector; +#else +vec2 clearCoatReflectionCoords=clearCoatReflectionVector.xy; +#ifdef REFLECTIONMAP_PROJECTION +clearCoatReflectionCoords/=clearCoatReflectionVector.z; +#endif +clearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y; +#endif +sampleReflectionTexture( +clearCoatAlphaG, +vReflectionMicrosurfaceInfos, +vReflectionInfos, +vReflectionColor, +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +clearCoatNdotVUnclamped, +#endif +#ifdef LINEARSPECULARREFLECTION +clearCoatRoughness, +#endif +reflectionSampler, +clearCoatReflectionCoords, +#ifndef LODBASEDMICROSFURACE +reflectionSamplerLow, +reflectionSamplerHigh, +#endif +#ifdef REALTIME_FILTERING +vReflectionFilteringInfo, +#endif +environmentClearCoatRadiance +); +#if DEBUGMODE>0 +outParams.environmentClearCoatRadiance=environmentClearCoatRadiance; +#endif +#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX) +vec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf); +#ifdef HORIZONOCCLUSION +#ifdef BUMP +#ifdef REFLECTIONMAP_3D +float clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);clearCoatEnvironmentReflectance*=clearCoatEho; +#endif +#endif +#endif +#else +vec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness)); +#endif +clearCoatEnvironmentReflectance*=clearCoatIntensity; +#if DEBUGMODE>0 +outParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance; +#endif +outParams.finalClearCoatRadianceScaled= +environmentClearCoatRadiance.rgb * +clearCoatEnvironmentReflectance * +vLightingIntensity.z; +#endif +#if defined(CLEARCOAT_TINT) +outParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity); +#endif +float fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnelIBLClearCoat*=clearCoatIntensity;outParams.conservationFactor=(1.-fresnelIBLClearCoat); +#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION) +outParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf); +#endif +return outParams;} +#endif +`;e.IncludesShadersStore[E]||(e.IncludesShadersStore[E]=B);const R="pbrBlockIridescence",G=`struct iridescenceOutParams +{float iridescenceIntensity;float iridescenceIOR;float iridescenceThickness;vec3 specularEnvironmentR0;}; +#ifdef IRIDESCENCE +#define pbr_inline +#define inline +iridescenceOutParams iridescenceBlock( +in vec4 vIridescenceParams +,in float viewAngle +,in vec3 specularEnvironmentR0 +#ifdef IRIDESCENCE_TEXTURE +,in vec2 iridescenceMapData +#endif +#ifdef IRIDESCENCE_THICKNESS_TEXTURE +,in vec2 iridescenceThicknessMapData +#endif +#ifdef CLEARCOAT +,in float NdotVUnclamped +,in vec2 vClearCoatParams +#ifdef CLEARCOAT_TEXTURE +,in vec2 clearCoatMapData +#endif +#endif +) +{iridescenceOutParams outParams;float iridescenceIntensity=vIridescenceParams.x;float iridescenceIOR=vIridescenceParams.y;float iridescenceThicknessMin=vIridescenceParams.z;float iridescenceThicknessMax=vIridescenceParams.w;float iridescenceThicknessWeight=1.; +#ifdef IRIDESCENCE_TEXTURE +iridescenceIntensity*=iridescenceMapData.x; +#endif +#if defined(IRIDESCENCE_THICKNESS_TEXTURE) +iridescenceThicknessWeight=iridescenceThicknessMapData.g; +#endif +float iridescenceThickness=mix(iridescenceThicknessMin,iridescenceThicknessMax,iridescenceThicknessWeight);float topIor=1.; +#ifdef CLEARCOAT +float clearCoatIntensity=vClearCoatParams.x; +#ifdef CLEARCOAT_TEXTURE +clearCoatIntensity*=clearCoatMapData.x; +#endif +topIor=mix(1.0,vClearCoatRefractionParams.w-1.,clearCoatIntensity);viewAngle=sqrt(1.0+square(1.0/topIor)*(square(NdotVUnclamped)-1.0)); +#endif +vec3 iridescenceFresnel=evalIridescence(topIor,iridescenceIOR,viewAngle,iridescenceThickness,specularEnvironmentR0);outParams.specularEnvironmentR0=mix(specularEnvironmentR0,iridescenceFresnel,iridescenceIntensity);outParams.iridescenceIntensity=iridescenceIntensity;outParams.iridescenceThickness=iridescenceThickness;outParams.iridescenceIOR=iridescenceIOR;return outParams;} +#endif +`;e.IncludesShadersStore[R]||(e.IncludesShadersStore[R]=G);const C="pbrBlockSubSurface",V=`struct subSurfaceOutParams +{vec3 specularEnvironmentReflectance; +#ifdef SS_REFRACTION +vec3 finalRefraction;vec3 surfaceAlbedo; +#ifdef SS_LINKREFRACTIONTOTRANSPARENCY +float alpha; +#endif +float refractionOpacity; +#endif +#ifdef SS_TRANSLUCENCY +vec3 transmittance;float translucencyIntensity; +#ifdef REFLECTION +vec3 refractionIrradiance; +#endif +#endif +#if DEBUGMODE>0 +#ifdef SS_THICKNESSANDMASK_TEXTURE +vec4 thicknessMap; +#endif +#ifdef SS_REFRACTION +vec4 environmentRefraction;vec3 refractionTransmittance; +#endif +#endif +}; +#ifdef SUBSURFACE +#ifdef SS_REFRACTION +#define pbr_inline +#define inline +vec4 sampleEnvironmentRefraction( +in float ior +,in float thickness +,in float refractionLOD +,in vec3 normalW +,in vec3 vPositionW +,in vec3 viewDirectionW +,in mat4 view +,in vec4 vRefractionInfos +,in mat4 refractionMatrix +,in vec4 vRefractionMicrosurfaceInfos +,in float alphaG +#ifdef SS_REFRACTIONMAP_3D +,in samplerCube refractionSampler +#ifndef LODBASEDMICROSFURACE +,in samplerCube refractionSamplerLow +,in samplerCube refractionSamplerHigh +#endif +#else +,in sampler2D refractionSampler +#ifndef LODBASEDMICROSFURACE +,in sampler2D refractionSamplerLow +,in sampler2D refractionSamplerHigh +#endif +#endif +#ifdef ANISOTROPIC +,in anisotropicOutParams anisotropicOut +#endif +#ifdef REALTIME_FILTERING +,in vec2 vRefractionFilteringInfo +#endif +#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC +,in vec3 refractionPosition +,in vec3 refractionSize +#endif +) {vec4 environmentRefraction=vec4(0.,0.,0.,0.); +#ifdef ANISOTROPIC +vec3 refractionVector=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,ior); +#else +vec3 refractionVector=refract(-viewDirectionW,normalW,ior); +#endif +#ifdef SS_REFRACTIONMAP_OPPOSITEZ +refractionVector.z*=-1.0; +#endif +#ifdef SS_REFRACTIONMAP_3D +#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC +refractionVector=parallaxCorrectNormal(vPositionW,refractionVector,refractionSize,refractionPosition); +#endif +refractionVector.y=refractionVector.y*vRefractionInfos.w;vec3 refractionCoords=refractionVector;refractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0)); +#else +#ifdef SS_USE_THICKNESS_AS_DEPTH +vec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*thickness,1.0))); +#else +vec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0))); +#endif +vec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y; +#endif +#ifdef LODBASEDMICROSFURACE +refractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z; +#ifdef SS_LODINREFRACTIONALPHA +float automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);float requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD); +#else +float requestedRefractionLOD=refractionLOD; +#endif +#if defined(REALTIME_FILTERING) && defined(SS_REFRACTIONMAP_3D) +environmentRefraction=vec4(radiance(alphaG,refractionSampler,refractionCoords,vRefractionFilteringInfo),1.0); +#else +environmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD); +#endif +#else +float lodRefractionNormalized=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));float lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;vec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);if (lodRefractionNormalizedDoubled<1.0){environmentRefraction=mix( +sampleRefraction(refractionSamplerHigh,refractionCoords), +environmentRefractionMid, +lodRefractionNormalizedDoubled +);} else {environmentRefraction=mix( +environmentRefractionMid, +sampleRefraction(refractionSamplerLow,refractionCoords), +lodRefractionNormalizedDoubled-1.0 +);} +#endif +#ifdef SS_RGBDREFRACTION +environmentRefraction.rgb=fromRGBD(environmentRefraction); +#endif +#ifdef SS_GAMMAREFRACTION +environmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb); +#endif +return environmentRefraction;} +#endif +#define pbr_inline +#define inline +subSurfaceOutParams subSurfaceBlock( +in vec3 vSubSurfaceIntensity +,in vec2 vThicknessParam +,in vec4 vTintColor +,in vec3 normalW +,in vec3 vSpecularEnvironmentReflectance +#ifdef SS_THICKNESSANDMASK_TEXTURE +,in vec4 thicknessMap +#endif +#ifdef SS_REFRACTIONINTENSITY_TEXTURE +,in vec4 refractionIntensityMap +#endif +#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE +,in vec4 translucencyIntensityMap +#endif +#ifdef REFLECTION +#ifdef SS_TRANSLUCENCY +,in mat4 reflectionMatrix +#ifdef USESPHERICALFROMREFLECTIONMAP +#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX) +,in vec3 irradianceVector_ +#endif +#if defined(REALTIME_FILTERING) +,in samplerCube reflectionSampler +,in vec2 vReflectionFilteringInfo +#ifdef IBL_CDF_FILTERING +,in sampler2D icdfSampler +#endif +#endif +#endif +#ifdef USEIRRADIANCEMAP +#ifdef REFLECTIONMAP_3D +,in samplerCube irradianceSampler +#else +,in sampler2D irradianceSampler +#endif +#endif +#endif +#endif +#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY) +,in vec3 surfaceAlbedo +#endif +#ifdef SS_REFRACTION +,in vec3 vPositionW +,in vec3 viewDirectionW +,in mat4 view +,in vec4 vRefractionInfos +,in mat4 refractionMatrix +,in vec4 vRefractionMicrosurfaceInfos +,in vec4 vLightingIntensity +#ifdef SS_LINKREFRACTIONTOTRANSPARENCY +,in float alpha +#endif +#ifdef SS_LODINREFRACTIONALPHA +,in float NdotVUnclamped +#endif +#ifdef SS_LINEARSPECULARREFRACTION +,in float roughness +#endif +,in float alphaG +#ifdef SS_REFRACTIONMAP_3D +,in samplerCube refractionSampler +#ifndef LODBASEDMICROSFURACE +,in samplerCube refractionSamplerLow +,in samplerCube refractionSamplerHigh +#endif +#else +,in sampler2D refractionSampler +#ifndef LODBASEDMICROSFURACE +,in sampler2D refractionSamplerLow +,in sampler2D refractionSamplerHigh +#endif +#endif +#ifdef ANISOTROPIC +,in anisotropicOutParams anisotropicOut +#endif +#ifdef REALTIME_FILTERING +,in vec2 vRefractionFilteringInfo +#endif +#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC +,in vec3 refractionPosition +,in vec3 refractionSize +#endif +#ifdef SS_DISPERSION +,in float dispersion +#endif +#endif +#ifdef SS_TRANSLUCENCY +,in vec3 vDiffusionDistance +,in vec4 vTranslucencyColor +#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE +,in vec4 translucencyColorMap +#endif +#endif +) +{subSurfaceOutParams outParams;outParams.specularEnvironmentReflectance=vSpecularEnvironmentReflectance; +#ifdef SS_REFRACTION +float refractionIntensity=vSubSurfaceIntensity.x; +#ifdef SS_LINKREFRACTIONTOTRANSPARENCY +refractionIntensity*=(1.0-alpha);outParams.alpha=1.0; +#endif +#endif +#ifdef SS_TRANSLUCENCY +float translucencyIntensity=vSubSurfaceIntensity.y; +#endif +#ifdef SS_THICKNESSANDMASK_TEXTURE +#ifdef SS_USE_GLTF_TEXTURES +float thickness=thicknessMap.g*vThicknessParam.y+vThicknessParam.x; +#else +float thickness=thicknessMap.r*vThicknessParam.y+vThicknessParam.x; +#endif +#if DEBUGMODE>0 +outParams.thicknessMap=thicknessMap; +#endif +#if defined(SS_REFRACTION) && defined(SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS) +#ifdef SS_USE_GLTF_TEXTURES +refractionIntensity*=thicknessMap.r; +#else +refractionIntensity*=thicknessMap.g; +#endif +#endif +#if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS) +#ifdef SS_USE_GLTF_TEXTURES +translucencyIntensity*=thicknessMap.a; +#else +translucencyIntensity*=thicknessMap.b; +#endif +#endif +#else +float thickness=vThicknessParam.y; +#endif +#if defined(SS_REFRACTION) && defined(SS_REFRACTIONINTENSITY_TEXTURE) +#ifdef SS_USE_GLTF_TEXTURES +refractionIntensity*=refractionIntensityMap.r; +#else +refractionIntensity*=refractionIntensityMap.g; +#endif +#endif +#if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCYINTENSITY_TEXTURE) +#ifdef SS_USE_GLTF_TEXTURES +translucencyIntensity*=translucencyIntensityMap.a; +#else +translucencyIntensity*=translucencyIntensityMap.b; +#endif +#endif +#ifdef SS_TRANSLUCENCY +thickness=maxEps(thickness);vec4 translucencyColor=vTranslucencyColor; +#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE +translucencyColor*=translucencyColorMap; +#endif +vec3 transmittance=transmittanceBRDF_Burley(translucencyColor.rgb,vDiffusionDistance,thickness);transmittance*=translucencyIntensity;outParams.transmittance=transmittance;outParams.translucencyIntensity=translucencyIntensity; +#endif +#ifdef SS_REFRACTION +vec4 environmentRefraction=vec4(0.,0.,0.,0.); +#ifdef SS_HAS_THICKNESS +float ior=vRefractionInfos.y; +#else +float ior=vRefractionMicrosurfaceInfos.w; +#endif +#ifdef SS_LODINREFRACTIONALPHA +float refractionAlphaG=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG,NdotVUnclamped); +#elif defined(SS_LINEARSPECULARREFRACTION) +float refractionRoughness=alphaG;refractionRoughness=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,refractionRoughness); +#else +float refractionAlphaG=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG); +#endif +float refraction_ior=vRefractionInfos.y; +#ifdef SS_DISPERSION +float realIOR=1.0/refraction_ior;float iorDispersionSpread=0.04*dispersion*(realIOR-1.0);vec3 iors=vec3(1.0/(realIOR-iorDispersionSpread),refraction_ior,1.0/(realIOR+iorDispersionSpread));for (int i=0; i<3; i++) {refraction_ior=iors[i]; +#endif +vec4 envSample=sampleEnvironmentRefraction(refraction_ior,thickness,refractionLOD,normalW,vPositionW,viewDirectionW,view,vRefractionInfos,refractionMatrix,vRefractionMicrosurfaceInfos,alphaG +#ifdef SS_REFRACTIONMAP_3D +,refractionSampler +#ifndef LODBASEDMICROSFURACE +,refractionSamplerLow +,refractionSamplerHigh +#endif +#else +,refractionSampler +#ifndef LODBASEDMICROSFURACE +,refractionSamplerLow +,refractionSamplerHigh +#endif +#endif +#ifdef ANISOTROPIC +,anisotropicOut +#endif +#ifdef REALTIME_FILTERING +,vRefractionFilteringInfo +#endif +#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC +,refractionPosition +,refractionSize +#endif +); +#ifdef SS_DISPERSION +environmentRefraction[i]=envSample[i];} +#else +environmentRefraction=envSample; +#endif +environmentRefraction.rgb*=vRefractionInfos.x; +#endif +#ifdef SS_REFRACTION +vec3 refractionTransmittance=vec3(refractionIntensity); +#ifdef SS_THICKNESSANDMASK_TEXTURE +vec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambert(volumeAlbedo,thickness); +#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY) +float maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);vec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);environmentRefraction.rgb*=volumeAlbedo; +#else +vec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y); +#endif +#ifdef SS_ALBEDOFORREFRACTIONTINT +environmentRefraction.rgb*=surfaceAlbedo.rgb; +#endif +outParams.surfaceAlbedo=surfaceAlbedo;outParams.refractionOpacity=1.-refractionIntensity; +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +outParams.surfaceAlbedo*=outParams.refractionOpacity; +#endif +#ifdef UNUSED_MULTIPLEBOUNCES +vec3 bounceSpecularEnvironmentReflectance=(2.0*vSpecularEnvironmentReflectance)/(1.0+vSpecularEnvironmentReflectance);outParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,vSpecularEnvironmentReflectance,refractionIntensity); +#endif +#if DEBUGMODE>0 +outParams.refractionTransmittance=refractionTransmittance; +#endif +outParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;outParams.finalRefraction*=vec3(1.0)-vSpecularEnvironmentReflectance; +#if DEBUGMODE>0 +outParams.environmentRefraction=environmentRefraction; +#endif +#endif +#if defined(REFLECTION) && defined(SS_TRANSLUCENCY) +#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP) +vec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz; +#ifdef REFLECTIONMAP_OPPOSITEZ +irradianceVector.z*=-1.0; +#endif +#ifdef INVERTCUBICMAP +irradianceVector.y*=-1.0; +#endif +#else +vec3 irradianceVector=irradianceVector_; +#endif +#if defined(USESPHERICALFROMREFLECTIONMAP) +#if defined(REALTIME_FILTERING) +vec3 refractionIrradiance=irradiance(reflectionSampler,-irradianceVector,vReflectionFilteringInfo,0.0,surfaceAlbedo,irradianceVector +#ifdef IBL_CDF_FILTERING +,icdfSampler +#endif +); +#else +vec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector); +#endif +#elif defined(USEIRRADIANCEMAP) +#ifdef REFLECTIONMAP_3D +vec3 irradianceCoords=irradianceVector; +#else +vec2 irradianceCoords=irradianceVector.xy; +#ifdef REFLECTIONMAP_PROJECTION +irradianceCoords/=irradianceVector.z; +#endif +irradianceCoords.y=1.0-irradianceCoords.y; +#endif +vec4 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceCoords); +#ifdef RGBDREFLECTION +refractionIrradiance.rgb=fromRGBD(refractionIrradiance); +#endif +#ifdef GAMMAREFLECTION +refractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb); +#endif +#else +vec4 refractionIrradiance=vec4(0.); +#endif +refractionIrradiance.rgb*=transmittance; +#ifdef SS_ALBEDOFORTRANSLUCENCYTINT +refractionIrradiance.rgb*=surfaceAlbedo.rgb; +#endif +outParams.refractionIrradiance=refractionIrradiance.rgb; +#endif +return outParams;} +#endif +`;e.IncludesShadersStore[C]||(e.IncludesShadersStore[C]=V);const u="pbrBlockReflectance0",H=`float reflectanceF0=reflectivityOut.reflectanceF0;vec3 specularEnvironmentR0=reflectivityOut.colorReflectanceF0;vec3 specularEnvironmentR90=reflectivityOut.colorReflectanceF90; +#ifdef ALPHAFRESNEL +float reflectance90=fresnelGrazingReflectance(reflectanceF0);specularEnvironmentR90=specularEnvironmentR90*reflectance90; +#endif +`;e.IncludesShadersStore[u]||(e.IncludesShadersStore[u]=H);const S="pbrClusteredLightingFunctions",x=`#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +#include +#define inline +lightingInfo computeClusteredLighting( +sampler2D lightDataTexture, +sampler2D tileMaskTexture, +vec4 lightData, +ivec2 sliceRange, +vec3 V, +vec3 N, +vec3 posW, +vec3 surfaceAlbedo, +reflectivityOutParams reflectivityOut +#ifdef IRIDESCENCE +,float iridescenceIntensity +#endif +#ifdef SS_TRANSLUCENCY +,subSurfaceOutParams subSurfaceOut +#endif +#ifdef SPECULARTERM +,float AARoughnessFactor +#endif +#ifdef ANISOTROPIC +,anisotropicOutParams anisotropicOut +#endif +#ifdef SHEEN +,sheenOutParams sheenOut +#endif +#ifdef CLEARCOAT +,clearcoatOutParams clearcoatOut +#endif +) {float NdotV=absEps(dot(N,V)); +#include +#ifdef CLEARCOAT +specularEnvironmentR0=clearcoatOut.specularEnvironmentR0; +#endif +lightingInfo result;ivec2 tilePosition=ivec2(gl_FragCoord.xy*lightData.xy);int maskHeight=int(lightData.z);tilePosition.y=min(tilePosition.y,maskHeight-1);ivec2 batchRange=sliceRange/CLUSTLIGHT_BATCH;int batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tilePosition.y+=maskHeight*batchRange.x;for (int i=batchRange.x; i<=batchRange.y; i+=1) {uint mask=uint(texelFetch(tileMaskTexture,tilePosition,0).r);tilePosition.y+=maskHeight;int maskOffset=max(sliceRange.x-batchOffset,0);int maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while (mask != 0u) {uint bit=mask & -mask;mask ^= bit;int position=onlyBitPosition(bit);ClusteredLight light=getClusteredLight(lightDataTexture,batchOffset+maskOffset+position);preLightingInfo preInfo=computePointAndSpotPreLightingInfo(light.vLightData,V,N,posW);preInfo.NdotV=NdotV;preInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light.vLightFalloff.x,light.vLightFalloff.y);if (light.vLightDirection.w>=0.0) {preInfo.attenuation*=computeDirectionalLightFalloff(light.vLightDirection.xyz,preInfo.L,light.vLightDirection.w,light.vLightData.w,light.vLightFalloff.z,light.vLightFalloff.w);} +preInfo.roughness=adjustRoughnessFromLightProperties(reflectivityOut.roughness,light.vLightSpecular.a,preInfo.lightDistance);preInfo.diffuseRoughness=reflectivityOut.diffuseRoughness;preInfo.surfaceAlbedo=surfaceAlbedo; +#ifdef IRIDESCENCE +preInfo.iridescenceIntensity=iridescenceIntensity; +#endif +lightingInfo info; +#ifdef SS_TRANSLUCENCY +#ifdef SS_TRANSLUCENCY_LEGACY +info.diffuse=computeDiffuseTransmittedLighting(preInfo,light.vLightDiffuse.rgb,subSurfaceOut.transmittance);info.diffuseTransmission=vec3(0); +#else +info.diffuse=computeDiffuseLighting(preInfo,light.vLightDiffuse.rgb)*(1.0-subSurfaceOut.translucencyIntensity);info.diffuseTransmission=computeDiffuseTransmittedLighting(preInfo,light.vLightDiffuse.rgb,subSurfaceOut.transmittance); +#endif +#else +info.diffuse=computeDiffuseLighting(preInfo,light.vLightDiffuse.rgb); +#endif +#ifdef SPECULARTERM +#if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR +vec3 metalFresnel=reflectivityOut.specularWeight*getF82Specular(preInfo.VdotH,specularEnvironmentR0,reflectivityOut.colorReflectanceF90,reflectivityOut.roughness);vec3 dielectricFresnel=fresnelSchlickGGX(preInfo.VdotH,reflectivityOut.dielectricColorF0,reflectivityOut.colorReflectanceF90);vec3 coloredFresnel=mix(dielectricFresnel,metalFresnel,reflectivityOut.metallic); +#else +vec3 coloredFresnel=fresnelSchlickGGX(preInfo.VdotH,specularEnvironmentR0,reflectivityOut.colorReflectanceF90); +#endif +#ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION +float NdotH=dot(N,preInfo.H);vec3 fresnel=fresnelSchlickGGX(NdotH,vec3(reflectanceF0),specularEnvironmentR90);info.diffuse*=(vec3(1.0)-fresnel); +#endif +#ifdef ANISOTROPIC +info.specular=computeAnisotropicSpecularLighting(preInfo,V,N,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactor,light.vLightDiffuse.rgb); +#else +info.specular=computeSpecularLighting(preInfo,N,specularEnvironmentR0,coloredFresnel,AARoughnessFactor,light.vLightDiffuse.rgb); +#endif +#endif +#ifdef SHEEN +#ifdef SHEEN_LINKWITHALBEDO +preInfo.roughness=sheenOut.sheenIntensity; +#else +preInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light.vLightSpecular.a,preInfo.lightDistance); +#endif +info.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactor,light.vLightDiffuse.rgb); +#endif +#ifdef CLEARCOAT +preInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light.vLightSpecular.a,preInfo.lightDistance);info.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,light.vLightDiffuse.rgb); +#ifdef CLEARCOAT_TINT +float absorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);info.diffuse*=absorption; +#ifdef SS_TRANSLUCENCY +info.diffuseTransmission*=absorption; +#endif +#ifdef SPECULARTERM +info.specular*=absorption; +#endif +#endif +info.diffuse*=info.clearCoat.w; +#ifdef SS_TRANSLUCENCY +info.diffuseTransmission*=info.clearCoat.w; +#endif +#ifdef SPECULARTERM +info.specular*=info.clearCoat.w; +#endif +#ifdef SHEEN +info.sheen*=info.clearCoat.w; +#endif +#endif +result.diffuse+=info.diffuse; +#ifdef SS_TRANSLUCENCY +result.diffuseTransmission+=info.diffuseTransmission; +#endif +#ifdef SPECULARTERM +result.specular+=info.specular; +#endif +#ifdef CLEARCOAT +result.clearCoat+=info.clearCoat; +#endif +#ifdef SHEEN +result.sheen+=info.sheen; +#endif +} +batchOffset+=CLUSTLIGHT_BATCH;} +return result;} +#endif +`;e.IncludesShadersStore[S]||(e.IncludesShadersStore[S]=x);const m="pbrBlockNormalFinal",W=`#if defined(FORCENORMALFORWARD) && defined(NORMAL) +vec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w; +#if defined(TWOSIDEDLIGHTING) +faceNormal=gl_FrontFacing ? faceNormal : -faceNormal; +#endif +normalW*=sign(dot(normalW,faceNormal)); +#endif +#if defined(TWOSIDEDLIGHTING) && defined(NORMAL) +#if defined(MIRRORED) +normalW=gl_FrontFacing ? -normalW : normalW; +#else +normalW=gl_FrontFacing ? normalW : -normalW; +#endif +#endif +`;e.IncludesShadersStore[m]||(e.IncludesShadersStore[m]=W);const A="pbrBlockLightmapInit",Y=`#ifdef LIGHTMAP +vec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset); +#ifdef RGBDLIGHTMAP +lightmapColor.rgb=fromRGBD(lightmapColor); +#endif +#ifdef GAMMALIGHTMAP +lightmapColor.rgb=toLinearSpace(lightmapColor.rgb); +#endif +lightmapColor.rgb*=vLightmapInfos.y; +#endif +`;e.IncludesShadersStore[A]||(e.IncludesShadersStore[A]=Y);const I="pbrBlockGeometryInfo",k=`float NdotVUnclamped=dot(normalW,viewDirectionW);float NdotV=absEps(NdotVUnclamped);float alphaG=convertRoughnessToAverageSlope(roughness);vec2 AARoughnessFactors=getAARoughnessFactors(normalW.xyz); +#ifdef SPECULARAA +alphaG+=AARoughnessFactors.y; +#endif +#if defined(ENVIRONMENTBRDF) +vec3 environmentBrdf=getBRDFLookup(NdotV,roughness); +#endif +#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX) +#ifdef RADIANCEOCCLUSION +#ifdef AMBIENTINGRAYSCALE +float ambientMonochrome=aoOut.ambientOcclusionColor.r; +#else +float ambientMonochrome=getLuminance(aoOut.ambientOcclusionColor); +#endif +float seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped); +#endif +#ifdef HORIZONOCCLUSION +#ifdef BUMP +#ifdef REFLECTIONMAP_3D +float eho=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW); +#endif +#endif +#endif +#endif +`;e.IncludesShadersStore[I]||(e.IncludesShadersStore[I]=k);const v="pbrBlockReflectance",X=`#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX) +vec3 baseSpecularEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(reflectanceF0),reflectivityOut.reflectanceF90,environmentBrdf); +#if (CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR) +vec3 metalEnvironmentReflectance=reflectivityOut.specularWeight*getF82Specular(NdotV,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90,reflectivityOut.roughness);vec3 dielectricEnvironmentReflectance=getReflectanceFromBRDFLookup(reflectivityOut.dielectricColorF0,reflectivityOut.colorReflectanceF90,environmentBrdf);vec3 colorSpecularEnvironmentReflectance=mix(dielectricEnvironmentReflectance,metalEnvironmentReflectance,reflectivityOut.metallic); +#else +vec3 colorSpecularEnvironmentReflectance=getReflectanceFromBRDFLookup(clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90,environmentBrdf); +#endif +#ifdef RADIANCEOCCLUSION +colorSpecularEnvironmentReflectance*=seo; +#endif +#ifdef HORIZONOCCLUSION +#ifdef BUMP +#ifdef REFLECTIONMAP_3D +colorSpecularEnvironmentReflectance*=eho; +#endif +#endif +#endif +#else +vec3 colorSpecularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));vec3 baseSpecularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,vec3(reflectanceF0),reflectivityOut.reflectanceF90,sqrt(microSurface)); +#endif +#ifdef CLEARCOAT +colorSpecularEnvironmentReflectance*=clearcoatOut.conservationFactor; +#if defined(CLEARCOAT_TINT) +colorSpecularEnvironmentReflectance*=clearcoatOut.absorption; +#endif +#endif +`;e.IncludesShadersStore[v]||(e.IncludesShadersStore[v]=X);const N="pbrBlockDirectLighting",w=`vec3 diffuseBase=vec3(0.,0.,0.); +#ifdef SS_TRANSLUCENCY +vec3 diffuseTransmissionBase=vec3(0.,0.,0.); +#endif +#ifdef SPECULARTERM +vec3 specularBase=vec3(0.,0.,0.); +#endif +#ifdef CLEARCOAT +vec3 clearCoatBase=vec3(0.,0.,0.); +#endif +#ifdef SHEEN +vec3 sheenBase=vec3(0.,0.,0.); +#endif +#if defined(SPECULARTERM) && defined(LIGHT0) +vec3 coloredFresnel; +#endif +preLightingInfo preInfo;lightingInfo info;float shadow=1.; +float aggShadow=0.;float numLights=0.; +#if defined(CLEARCOAT) && defined(CLEARCOAT_TINT) +vec3 absorption=vec3(0.); +#endif +`;e.IncludesShadersStore[N]||(e.IncludesShadersStore[N]=w);const T="pbrBlockFinalLitComponents",K=`aggShadow=aggShadow/numLights; +#if defined(ENVIRONMENTBRDF) +#ifdef MS_BRDF_ENERGY_CONSERVATION +vec3 baseSpecularEnergyConservationFactor=getEnergyConservationFactor(vec3(reflectanceF0),environmentBrdf);vec3 coloredEnergyConservationFactor=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf); +#endif +#endif +#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF) +surfaceAlbedo.rgb=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb; +#endif +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +#ifndef METALLICWORKFLOW +#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION +surfaceAlbedo.rgb=(1.-reflectanceF0)*surfaceAlbedo.rgb; +#endif +#endif +#endif +#ifdef REFLECTION +vec3 finalIrradiance=reflectionOut.environmentIrradiance; +#ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION +#if defined(METALLICWORKFLOW) || defined(SPECULAR_GLOSSINESS_ENERGY_CONSERVATION) +vec3 baseSpecularEnergy=vec3(baseSpecularEnvironmentReflectance); +#if defined(ENVIRONMENTBRDF) +#ifdef MS_BRDF_ENERGY_CONSERVATION +baseSpecularEnergy*=baseSpecularEnergyConservationFactor; +#endif +#endif +finalIrradiance*=clamp(vec3(1.0)-baseSpecularEnergy,0.0,1.0); +#endif +#endif +#if defined(CLEARCOAT) +finalIrradiance*=clearcoatOut.conservationFactor; +#if defined(CLEARCOAT_TINT) +finalIrradiance*=clearcoatOut.absorption; +#endif +#endif +#ifndef SS_APPLY_ALBEDO_AFTER_SUBSURFACE +finalIrradiance*=surfaceAlbedo.rgb; +#endif +#if defined(SS_REFRACTION) +finalIrradiance*=subSurfaceOut.refractionOpacity; +#endif +#if defined(SS_TRANSLUCENCY) +finalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);finalIrradiance+=subSurfaceOut.refractionIrradiance; +#endif +#ifdef SS_APPLY_ALBEDO_AFTER_SUBSURFACE +finalIrradiance*=surfaceAlbedo.rgb; +#endif +finalIrradiance*=vLightingIntensity.z;finalIrradiance*=aoOut.ambientOcclusionColor; +#endif +#ifdef SPECULARTERM +vec3 finalSpecular=specularBase;finalSpecular=max(finalSpecular,0.0);vec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w; +#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION) +finalSpecularScaled*=coloredEnergyConservationFactor; +#endif +#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING) +finalSpecularScaled*=sheenOut.sheenAlbedoScaling; +#endif +#endif +#ifdef REFLECTION +vec3 finalRadiance=reflectionOut.environmentRadiance.rgb;finalRadiance*=colorSpecularEnvironmentReflectance;vec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z; +#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION) +finalRadianceScaled*=coloredEnergyConservationFactor; +#endif +#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING) +finalRadianceScaled*=sheenOut.sheenAlbedoScaling; +#endif +#endif +#ifdef SHEEN +vec3 finalSheen=sheenBase*sheenOut.sheenColor;finalSheen=max(finalSheen,0.0);vec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w; +#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF) +sheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor; +#if defined(CLEARCOAT_TINT) +sheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption; +#endif +#endif +#endif +#ifdef CLEARCOAT +vec3 finalClearCoat=clearCoatBase;finalClearCoat=max(finalClearCoat,0.0);vec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w; +#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION) +finalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat; +#endif +#ifdef SS_REFRACTION +subSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor; +#ifdef CLEARCOAT_TINT +subSurfaceOut.finalRefraction*=clearcoatOut.absorption; +#endif +#endif +#endif +#ifdef ALPHABLEND +float luminanceOverAlpha=0.0; +#if defined(REFLECTION) && defined(RADIANCEOVERALPHA) +luminanceOverAlpha+=getLuminance(finalRadianceScaled); +#if defined(CLEARCOAT) +luminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled); +#endif +#endif +#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA) +luminanceOverAlpha+=getLuminance(finalSpecularScaled); +#endif +#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA) +luminanceOverAlpha+=getLuminance(finalClearCoatScaled); +#endif +#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA) +alpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha); +#endif +#endif +`;e.IncludesShadersStore[T]||(e.IncludesShadersStore[T]=K);const O="pbrBlockFinalUnlitComponents",z=`vec3 finalDiffuse=diffuseBase;finalDiffuse*=surfaceAlbedo; +#if defined(SS_REFRACTION) && !defined(UNLIT) && !defined(LEGACY_SPECULAR_ENERGY_CONSERVATION) +finalDiffuse*=subSurfaceOut.refractionOpacity; +#endif +#if defined(SS_TRANSLUCENCY) && !defined(UNLIT) +finalDiffuse+=diffuseTransmissionBase; +#endif +finalDiffuse=max(finalDiffuse,0.0);finalDiffuse*=vLightingIntensity.x;vec3 finalAmbient=vAmbientColor;finalAmbient*=surfaceAlbedo.rgb;vec3 finalEmissive=vEmissiveColor; +#ifdef EMISSIVE +vec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb; +#ifdef GAMMAEMISSIVE +finalEmissive*=toLinearSpace(emissiveColorTex.rgb); +#else +finalEmissive*=emissiveColorTex.rgb; +#endif +finalEmissive*= vEmissiveInfos.y; +#endif +finalEmissive*=vLightingIntensity.y; +#ifdef AMBIENT +vec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),aoOut.ambientOcclusionColor,vAmbientInfos.w); +#else +vec3 ambientOcclusionForDirectDiffuse=aoOut.ambientOcclusionColor; +#endif +finalAmbient*=aoOut.ambientOcclusionColor;finalDiffuse*=ambientOcclusionForDirectDiffuse; +`;e.IncludesShadersStore[O]||(e.IncludesShadersStore[O]=z);const p="pbrBlockFinalColorComposition",$=`vec4 finalColor=vec4( +#ifndef UNLIT +#ifdef REFLECTION +finalIrradiance + +#endif +#ifdef SPECULARTERM +finalSpecularScaled + +#endif +#ifdef SHEEN +finalSheenScaled + +#endif +#ifdef CLEARCOAT +finalClearCoatScaled + +#endif +#ifdef REFLECTION +finalRadianceScaled + +#if defined(SHEEN) && defined(ENVIRONMENTBRDF) +sheenOut.finalSheenRadianceScaled + +#endif +#ifdef CLEARCOAT +clearcoatOut.finalClearCoatRadianceScaled + +#endif +#endif +#ifdef SS_REFRACTION +subSurfaceOut.finalRefraction + +#endif +#endif +finalAmbient + +finalDiffuse, +alpha); +#ifdef LIGHTMAP +#ifndef LIGHTMAPEXCLUDED +#ifdef USELIGHTMAPASSHADOWMAP +finalColor.rgb*=lightmapColor.rgb; +#else +finalColor.rgb+=lightmapColor.rgb; +#endif +#endif +#endif +finalColor.rgb+=finalEmissive; +#define CUSTOM_FRAGMENT_BEFORE_FOG +finalColor=max(finalColor,0.0); +`;e.IncludesShadersStore[p]||(e.IncludesShadersStore[p]=$);const i="pbrPixelShader",L=`#define PBR_FRAGMENT_SHADER +#define CUSTOM_FRAGMENT_EXTENSION +#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) +#extension GL_OES_standard_derivatives : enable +#endif +#ifdef LODBASEDMICROSFURACE +#extension GL_EXT_shader_texture_lod : enable +#endif +#define CUSTOM_FRAGMENT_BEGIN +#ifdef LOGARITHMICDEPTH +#extension GL_EXT_frag_depth : enable +#endif +#if SCENE_MRT_COUNT>0 +#include[SCENE_MRT_COUNT] +#endif +precision highp float; +#include +#ifndef FROMLINEARSPACE +#define FROMLINEARSPACE +#endif +#include<__decl__pbrFragment> +#include +#include<__decl__lightFragment>[0..maxSimultaneousLights] +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef REFLECTION +#include +#endif +#define CUSTOM_FRAGMENT_DEFINITIONS +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(void) { +#define CUSTOM_FRAGMENT_MAIN_BEGIN +#include +#include +#include +#include +albedoOpacityOutParams albedoOpacityOut; +#ifdef ALBEDO +vec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset); +#endif +#ifdef BASE_WEIGHT +vec4 baseWeightTexture=texture2D(baseWeightSampler,vBaseWeightUV+uvOffset); +#endif +#ifdef OPACITY +vec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset); +#endif +#ifdef DECAL +vec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset); +#endif +albedoOpacityOut=albedoOpacityBlock( +vAlbedoColor +#ifdef ALBEDO +,albedoTexture +,vAlbedoInfos +#endif +,baseWeight +#ifdef BASE_WEIGHT +,baseWeightTexture +,vBaseWeightInfos +#endif +#ifdef OPACITY +,opacityMap +,vOpacityInfos +#endif +#ifdef DETAIL +,detailColor +,vDetailInfos +#endif +#ifdef DECAL +,decalColor +,vDecalInfos +#endif +);vec3 surfaceAlbedo=albedoOpacityOut.surfaceAlbedo;float alpha=albedoOpacityOut.alpha; +#define CUSTOM_FRAGMENT_UPDATE_ALPHA +#include +#define CUSTOM_FRAGMENT_BEFORE_LIGHTS +ambientOcclusionOutParams aoOut; +#ifdef AMBIENT +vec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb; +#endif +aoOut=ambientOcclusionBlock( +#ifdef AMBIENT +ambientOcclusionColorMap, +vAmbientInfos +#endif +); +#include +#ifdef UNLIT +vec3 diffuseBase=vec3(1.,1.,1.); +#else +vec3 baseColor=surfaceAlbedo;reflectivityOutParams reflectivityOut; +#if defined(REFLECTIVITY) +vec4 surfaceMetallicOrReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);vec4 baseReflectivity=surfaceMetallicOrReflectivityColorMap; +#ifndef METALLICWORKFLOW +#ifdef REFLECTIVITY_GAMMA +surfaceMetallicOrReflectivityColorMap=toLinearSpace(surfaceMetallicOrReflectivityColorMap); +#endif +surfaceMetallicOrReflectivityColorMap.rgb*=vReflectivityInfos.y; +#endif +#endif +#if defined(MICROSURFACEMAP) +vec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y; +#endif +#ifdef METALLICWORKFLOW +vec4 metallicReflectanceFactors=vMetallicReflectanceFactors; +#ifdef REFLECTANCE +vec4 reflectanceFactorsMap=texture2D(reflectanceSampler,vReflectanceUV+uvOffset); +#ifdef REFLECTANCE_GAMMA +reflectanceFactorsMap=toLinearSpace(reflectanceFactorsMap); +#endif +metallicReflectanceFactors.rgb*=reflectanceFactorsMap.rgb; +#endif +#ifdef METALLIC_REFLECTANCE +vec4 metallicReflectanceFactorsMap=texture2D(metallicReflectanceSampler,vMetallicReflectanceUV+uvOffset); +#ifdef METALLIC_REFLECTANCE_GAMMA +metallicReflectanceFactorsMap=toLinearSpace(metallicReflectanceFactorsMap); +#endif +#ifndef METALLIC_REFLECTANCE_USE_ALPHA_ONLY +metallicReflectanceFactors.rgb*=metallicReflectanceFactorsMap.rgb; +#endif +metallicReflectanceFactors.a*=metallicReflectanceFactorsMap.a; +#endif +#endif +#ifdef BASE_DIFFUSE_ROUGHNESS +float baseDiffuseRoughnessTexture=texture2D(baseDiffuseRoughnessSampler,vBaseDiffuseRoughnessUV+uvOffset).r; +#endif +reflectivityOut=reflectivityBlock( +vReflectivityColor +#ifdef METALLICWORKFLOW +,surfaceAlbedo +,metallicReflectanceFactors +#endif +,baseDiffuseRoughness +#ifdef BASE_DIFFUSE_ROUGHNESS +,baseDiffuseRoughnessTexture +,vBaseDiffuseRoughnessInfos +#endif +#ifdef REFLECTIVITY +,vReflectivityInfos +,surfaceMetallicOrReflectivityColorMap +#endif +#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED) +,aoOut.ambientOcclusionColor +#endif +#ifdef MICROSURFACEMAP +,microSurfaceTexel +#endif +#ifdef DETAIL +,detailColor +,vDetailInfos +#endif +);float microSurface=reflectivityOut.microSurface;float roughness=reflectivityOut.roughness;float diffuseRoughness=reflectivityOut.diffuseRoughness; +#ifdef METALLICWORKFLOW +surfaceAlbedo=reflectivityOut.surfaceAlbedo; +#endif +#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED) +aoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor; +#endif +#ifdef ALPHAFRESNEL +#if defined(ALPHATEST) || defined(ALPHABLEND) +alphaFresnelOutParams alphaFresnelOut;alphaFresnelOut=alphaFresnelBlock( +normalW, +viewDirectionW, +alpha, +microSurface +);alpha=alphaFresnelOut.alpha; +#endif +#endif +#include +#ifdef ANISOTROPIC +anisotropicOutParams anisotropicOut; +#ifdef ANISOTROPIC_TEXTURE +vec3 anisotropyMapData=texture2D(anisotropySampler,vAnisotropyUV+uvOffset).rgb*vAnisotropyInfos.y; +#endif +anisotropicOut=anisotropicBlock( +vAnisotropy, +roughness, +#ifdef ANISOTROPIC_TEXTURE +anisotropyMapData, +#endif +TBN, +normalW, +viewDirectionW +); +#endif +#ifdef REFLECTION +reflectionOutParams reflectionOut; +#ifndef USE_CUSTOM_REFLECTION +reflectionOut=reflectionBlock( +vPositionW +,normalW +,alphaG +,vReflectionMicrosurfaceInfos +,vReflectionInfos +,vReflectionColor +#ifdef ANISOTROPIC +,anisotropicOut +#endif +#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX) +,NdotVUnclamped +#endif +#ifdef LINEARSPECULARREFLECTION +,roughness +#endif +,reflectionSampler +#if defined(NORMAL) && defined(USESPHERICALINVERTEX) +,vEnvironmentIrradiance +#endif +#if (defined(USESPHERICALFROMREFLECTIONMAP) && (!defined(NORMAL) || !defined(USESPHERICALINVERTEX))) || (defined(USEIRRADIANCEMAP) && defined(REFLECTIONMAP_3D)) +,reflectionMatrix +#endif +#ifdef USEIRRADIANCEMAP +,irradianceSampler +#ifdef USE_IRRADIANCE_DOMINANT_DIRECTION +,vReflectionDominantDirection +#endif +#endif +#ifndef LODBASEDMICROSFURACE +,reflectionSamplerLow +,reflectionSamplerHigh +#endif +#ifdef REALTIME_FILTERING +,vReflectionFilteringInfo +#ifdef IBL_CDF_FILTERING +,icdfSampler +#endif +#endif +,viewDirectionW +,diffuseRoughness +,baseColor +); +#else +#define CUSTOM_REFLECTION +#endif +#endif +#include +#ifdef SHEEN +sheenOutParams sheenOut; +#ifdef SHEEN_TEXTURE +vec4 sheenMapData=texture2D(sheenSampler,vSheenUV+uvOffset); +#endif +#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE) +vec4 sheenMapRoughnessData=texture2D(sheenRoughnessSampler,vSheenRoughnessUV+uvOffset)*vSheenInfos.w; +#endif +sheenOut=sheenBlock( +vSheenColor +#ifdef SHEEN_ROUGHNESS +,vSheenRoughness +#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE) +,sheenMapRoughnessData +#endif +#endif +,roughness +#ifdef SHEEN_TEXTURE +,sheenMapData +,vSheenInfos.y +#endif +,reflectanceF0 +#ifdef SHEEN_LINKWITHALBEDO +,baseColor +,surfaceAlbedo +#endif +#ifdef ENVIRONMENTBRDF +,NdotV +,environmentBrdf +#endif +#if defined(REFLECTION) && defined(ENVIRONMENTBRDF) +,AARoughnessFactors +,vReflectionMicrosurfaceInfos +,vReflectionInfos +,vReflectionColor +,vLightingIntensity +,reflectionSampler +,reflectionOut.reflectionCoords +,NdotVUnclamped +#ifndef LODBASEDMICROSFURACE +,reflectionSamplerLow +,reflectionSamplerHigh +#endif +#ifdef REALTIME_FILTERING +,vReflectionFilteringInfo +#endif +#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION) +,seo +#endif +#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D) +,eho +#endif +#endif +); +#ifdef SHEEN_LINKWITHALBEDO +surfaceAlbedo=sheenOut.surfaceAlbedo; +#endif +#endif +#ifdef CLEARCOAT +#ifdef CLEARCOAT_TEXTURE +vec2 clearCoatMapData=texture2D(clearCoatSampler,vClearCoatUV+uvOffset).rg*vClearCoatInfos.y; +#endif +#endif +#ifdef IRIDESCENCE +iridescenceOutParams iridescenceOut; +#ifdef IRIDESCENCE_TEXTURE +vec2 iridescenceMapData=texture2D(iridescenceSampler,vIridescenceUV+uvOffset).rg*vIridescenceInfos.y; +#endif +#ifdef IRIDESCENCE_THICKNESS_TEXTURE +vec2 iridescenceThicknessMapData=texture2D(iridescenceThicknessSampler,vIridescenceThicknessUV+uvOffset).rg*vIridescenceInfos.w; +#endif +iridescenceOut=iridescenceBlock( +vIridescenceParams +,NdotV +,specularEnvironmentR0 +#ifdef IRIDESCENCE_TEXTURE +,iridescenceMapData +#endif +#ifdef IRIDESCENCE_THICKNESS_TEXTURE +,iridescenceThicknessMapData +#endif +#ifdef CLEARCOAT +,NdotVUnclamped +,vClearCoatParams +#ifdef CLEARCOAT_TEXTURE +,clearCoatMapData +#endif +#endif +);float iridescenceIntensity=iridescenceOut.iridescenceIntensity;specularEnvironmentR0=iridescenceOut.specularEnvironmentR0; +#endif +clearcoatOutParams clearcoatOut; +#ifdef CLEARCOAT +#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) +vec4 clearCoatMapRoughnessData=texture2D(clearCoatRoughnessSampler,vClearCoatRoughnessUV+uvOffset)*vClearCoatInfos.w; +#endif +#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE) +vec4 clearCoatTintMapData=texture2D(clearCoatTintSampler,vClearCoatTintUV+uvOffset); +#endif +#ifdef CLEARCOAT_BUMP +vec4 clearCoatBumpMapData=texture2D(clearCoatBumpSampler,vClearCoatBumpUV+uvOffset); +#endif +clearcoatOut=clearcoatBlock( +vPositionW +,geometricNormalW +,viewDirectionW +,vClearCoatParams +#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) +,clearCoatMapRoughnessData +#endif +,specularEnvironmentR0 +#ifdef CLEARCOAT_TEXTURE +,clearCoatMapData +#endif +#ifdef CLEARCOAT_TINT +,vClearCoatTintParams +,clearCoatColorAtDistance +,vClearCoatRefractionParams +#ifdef CLEARCOAT_TINT_TEXTURE +,clearCoatTintMapData +#endif +#endif +#ifdef CLEARCOAT_BUMP +,vClearCoatBumpInfos +,clearCoatBumpMapData +,vClearCoatBumpUV +#if defined(TANGENT) && defined(NORMAL) +,vTBN +#else +,vClearCoatTangentSpaceParams +#endif +#ifdef OBJECTSPACE_NORMALMAP +,normalMatrix +#endif +#endif +#if defined(FORCENORMALFORWARD) && defined(NORMAL) +,faceNormal +#endif +#ifdef REFLECTION +,vReflectionMicrosurfaceInfos +,vReflectionInfos +,vReflectionColor +,vLightingIntensity +,reflectionSampler +#ifndef LODBASEDMICROSFURACE +,reflectionSamplerLow +,reflectionSamplerHigh +#endif +#ifdef REALTIME_FILTERING +,vReflectionFilteringInfo +#endif +#endif +#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING) +,(gl_FrontFacing ? 1. : -1.) +#endif +); +#else +clearcoatOut.specularEnvironmentR0=specularEnvironmentR0; +#endif +#include +subSurfaceOutParams subSurfaceOut; +#ifdef SUBSURFACE +#ifdef SS_THICKNESSANDMASK_TEXTURE +vec4 thicknessMap=texture2D(thicknessSampler,vThicknessUV+uvOffset); +#endif +#ifdef SS_REFRACTIONINTENSITY_TEXTURE +vec4 refractionIntensityMap=texture2D(refractionIntensitySampler,vRefractionIntensityUV+uvOffset); +#endif +#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE +vec4 translucencyIntensityMap=texture2D(translucencyIntensitySampler,vTranslucencyIntensityUV+uvOffset); +#endif +#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE +vec4 translucencyColorMap=texture2D(translucencyColorSampler,vTranslucencyColorUV+uvOffset); +#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE_GAMMA +translucencyColorMap=toLinearSpace(translucencyColorMap); +#endif +#endif +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +vec3 vSpecularEnvironmentReflectance=vec3(max(colorSpecularEnvironmentReflectance.r,max(colorSpecularEnvironmentReflectance.g,colorSpecularEnvironmentReflectance.b))); +#endif +subSurfaceOut=subSurfaceBlock( +vSubSurfaceIntensity +,vThicknessParam +,vTintColor +,normalW +#ifdef LEGACY_SPECULAR_ENERGY_CONSERVATION +,vSpecularEnvironmentReflectance +#else +,baseSpecularEnvironmentReflectance +#endif +#ifdef SS_THICKNESSANDMASK_TEXTURE +,thicknessMap +#endif +#ifdef SS_REFRACTIONINTENSITY_TEXTURE +,refractionIntensityMap +#endif +#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE +,translucencyIntensityMap +#endif +#ifdef REFLECTION +#ifdef SS_TRANSLUCENCY +,reflectionMatrix +#ifdef USESPHERICALFROMREFLECTIONMAP +#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX) +,reflectionOut.irradianceVector +#endif +#if defined(REALTIME_FILTERING) +,reflectionSampler +,vReflectionFilteringInfo +#ifdef IBL_CDF_FILTERING +,icdfSampler +#endif +#endif +#endif +#ifdef USEIRRADIANCEMAP +,irradianceSampler +#endif +#endif +#endif +#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY) +,surfaceAlbedo +#endif +#ifdef SS_REFRACTION +,vPositionW +,viewDirectionW +,view +,vRefractionInfos +,refractionMatrix +,vRefractionMicrosurfaceInfos +,vLightingIntensity +#ifdef SS_LINKREFRACTIONTOTRANSPARENCY +,alpha +#endif +#ifdef SS_LODINREFRACTIONALPHA +,NdotVUnclamped +#endif +#ifdef SS_LINEARSPECULARREFRACTION +,roughness +#endif +,alphaG +,refractionSampler +#ifndef LODBASEDMICROSFURACE +,refractionSamplerLow +,refractionSamplerHigh +#endif +#ifdef ANISOTROPIC +,anisotropicOut +#endif +#ifdef REALTIME_FILTERING +,vRefractionFilteringInfo +#endif +#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC +,vRefractionPosition +,vRefractionSize +#endif +#ifdef SS_DISPERSION +,dispersion +#endif +#endif +#ifdef SS_TRANSLUCENCY +,vDiffusionDistance +,vTranslucencyColor +#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE +,translucencyColorMap +#endif +#endif +); +#ifdef SS_REFRACTION +surfaceAlbedo=subSurfaceOut.surfaceAlbedo; +#ifdef SS_LINKREFRACTIONTOTRANSPARENCY +alpha=subSurfaceOut.alpha; +#endif +#endif +#else +subSurfaceOut.specularEnvironmentReflectance=colorSpecularEnvironmentReflectance; +#endif +#include +#include[0..maxSimultaneousLights] +#include +#endif +#include +#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION +#include +#include +#include(color,finalColor) +#include +#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR +#ifdef PREPASS +#include +#endif +#if !defined(PREPASS) || defined(WEBGL2) +gl_FragColor=finalColor; +#endif +#include +#if ORDER_INDEPENDENT_TRANSPARENCY +if (fragDepth==nearestDepth) {frontColor.rgb+=finalColor.rgb*finalColor.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-finalColor.a);} else {backColor+=finalColor;} +#endif +#include +#define CUSTOM_FRAGMENT_MAIN_END +} +`;e.ShadersStore[i]||(e.ShadersStore[i]=L);const ue={name:i,shader:L};export{ue as pbrPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbr.vertex-DLH7HICr.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbr.vertex-DLH7HICr.js new file mode 100644 index 0000000000000000000000000000000000000000..d30494e06130f156b635098e1b80fe39adeed839 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbr.vertex-DLH7HICr.js @@ -0,0 +1,357 @@ +import{S as e}from"./index-CDrXokXW.js";import"./vertexColorMixing-DUmDzlXI.js";import"./pbrUboDeclaration-BaPvJwLw.js";import"./mainUVVaryingDeclaration-CYLIf35n.js";import"./helperFunctions-BkWNqKeI.js";import"./pbrBRDFFunctions-BEHyjaG2.js";import"./bakedVertexAnimation-BwUJBnNt.js";import"./instancesDeclaration-BAnfKLCo.js";import"./harmonicsFunctions-O6-VFzXR.js";import"./bumpVertexDeclaration-Bd2S82Ce.js";import"./clipPlaneVertex-Bmw4TNCQ.js";import"./logDepthVertex-DDooPwab.js";import"./shadowsVertex-DbGd-etA.js";import"./morphTargetsVertex-7Q90Wwr8.js";import"./logDepthDeclaration-DbMKMukk.js";import"./bumpVertex-B5e3s1jQ.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./meshUboDeclaration-C6raEdzf.js";const n="pbrVertexDeclaration",r=`uniform mat4 view;uniform mat4 viewProjection;uniform vec4 vEyePosition; +#ifdef MULTIVIEW +mat4 viewProjectionR; +#endif +#ifdef ALBEDO +uniform mat4 albedoMatrix;uniform vec2 vAlbedoInfos; +#endif +#ifdef BASE_WEIGHT +uniform mat4 baseWeightMatrix;uniform vec2 vBaseWeightInfos; +#endif +uniform float baseDiffuseRoughness; +#ifdef BASE_DIFFUSE_ROUGHNESS +uniform mat4 baseDiffuseRoughnessMatrix;uniform vec2 vBaseDiffuseRoughnessInfos; +#endif +#ifdef AMBIENT +uniform mat4 ambientMatrix;uniform vec4 vAmbientInfos; +#endif +#ifdef OPACITY +uniform mat4 opacityMatrix;uniform vec2 vOpacityInfos; +#endif +#ifdef EMISSIVE +uniform vec2 vEmissiveInfos;uniform mat4 emissiveMatrix; +#endif +#ifdef LIGHTMAP +uniform vec2 vLightmapInfos;uniform mat4 lightmapMatrix; +#endif +#ifdef REFLECTIVITY +uniform vec3 vReflectivityInfos;uniform mat4 reflectivityMatrix; +#endif +#ifdef METALLIC_REFLECTANCE +uniform vec2 vMetallicReflectanceInfos;uniform mat4 metallicReflectanceMatrix; +#endif +#ifdef REFLECTANCE +uniform vec2 vReflectanceInfos;uniform mat4 reflectanceMatrix; +#endif +#ifdef MICROSURFACEMAP +uniform vec2 vMicroSurfaceSamplerInfos;uniform mat4 microSurfaceSamplerMatrix; +#endif +#ifdef BUMP +uniform vec3 vBumpInfos;uniform mat4 bumpMatrix; +#endif +#ifdef POINTSIZE +uniform float pointSize; +#endif +uniform vec4 cameraInfo; +#ifdef REFLECTION +uniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix; +#endif +#ifdef CLEARCOAT +#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS) +uniform vec4 vClearCoatInfos; +#endif +#ifdef CLEARCOAT_TEXTURE +uniform mat4 clearCoatMatrix; +#endif +#ifdef CLEARCOAT_TEXTURE_ROUGHNESS +uniform mat4 clearCoatRoughnessMatrix; +#endif +#ifdef CLEARCOAT_BUMP +uniform vec2 vClearCoatBumpInfos;uniform mat4 clearCoatBumpMatrix; +#endif +#ifdef CLEARCOAT_TINT_TEXTURE +uniform vec2 vClearCoatTintInfos;uniform mat4 clearCoatTintMatrix; +#endif +#endif +#ifdef IRIDESCENCE +#if defined(IRIDESCENCE_TEXTURE) || defined(IRIDESCENCE_THICKNESS_TEXTURE) +uniform vec4 vIridescenceInfos; +#endif +#ifdef IRIDESCENCE_TEXTURE +uniform mat4 iridescenceMatrix; +#endif +#ifdef IRIDESCENCE_THICKNESS_TEXTURE +uniform mat4 iridescenceThicknessMatrix; +#endif +#endif +#ifdef ANISOTROPIC +#ifdef ANISOTROPIC_TEXTURE +uniform vec2 vAnisotropyInfos;uniform mat4 anisotropyMatrix; +#endif +#endif +#ifdef SHEEN +#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS) +uniform vec4 vSheenInfos; +#endif +#ifdef SHEEN_TEXTURE +uniform mat4 sheenMatrix; +#endif +#ifdef SHEEN_TEXTURE_ROUGHNESS +uniform mat4 sheenRoughnessMatrix; +#endif +#endif +#ifdef SUBSURFACE +#ifdef SS_REFRACTION +uniform vec4 vRefractionInfos;uniform mat4 refractionMatrix; +#endif +#ifdef SS_THICKNESSANDMASK_TEXTURE +uniform vec2 vThicknessInfos;uniform mat4 thicknessMatrix; +#endif +#ifdef SS_REFRACTIONINTENSITY_TEXTURE +uniform vec2 vRefractionIntensityInfos;uniform mat4 refractionIntensityMatrix; +#endif +#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE +uniform vec2 vTranslucencyIntensityInfos;uniform mat4 translucencyIntensityMatrix; +#endif +#ifdef SS_TRANSLUCENCYCOLOR_TEXTURE +uniform vec2 vTranslucencyColorInfos;uniform mat4 translucencyColorMatrix; +#endif +#endif +#ifdef NORMAL +#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX) +#ifdef USESPHERICALFROMREFLECTIONMAP +#ifdef SPHERICAL_HARMONICS +uniform vec3 vSphericalL00;uniform vec3 vSphericalL1_1;uniform vec3 vSphericalL10;uniform vec3 vSphericalL11;uniform vec3 vSphericalL2_2;uniform vec3 vSphericalL2_1;uniform vec3 vSphericalL20;uniform vec3 vSphericalL21;uniform vec3 vSphericalL22; +#else +uniform vec3 vSphericalX;uniform vec3 vSphericalY;uniform vec3 vSphericalZ;uniform vec3 vSphericalXX_ZZ;uniform vec3 vSphericalYY_ZZ;uniform vec3 vSphericalZZ;uniform vec3 vSphericalXY;uniform vec3 vSphericalYZ;uniform vec3 vSphericalZX; +#endif +#endif +#endif +#endif +#ifdef DETAIL +uniform vec4 vDetailInfos;uniform mat4 detailMatrix; +#endif +#include +#define ADDITIONAL_VERTEX_DECLARATION +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=r);const i="pbrVertexShader",E=`#define PBR_VERTEX_SHADER +#define CUSTOM_VERTEX_EXTENSION +precision highp float; +#include<__decl__pbrVertex> +#define CUSTOM_VERTEX_BEGIN +attribute vec3 position; +#ifdef NORMAL +attribute vec3 normal; +#endif +#ifdef TANGENT +attribute vec4 tangent; +#endif +#ifdef UV1 +attribute vec2 uv; +#endif +#include[2..7] +#include[1..7] +#ifdef VERTEXCOLOR +attribute vec4 color; +#endif +#include +#include +#include +#include +#include +#include +#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo) +#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight) +#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail) +#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient) +#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity) +#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive) +#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap) +#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity) +#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler) +#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance) +#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance) +#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal) +#ifdef CLEARCOAT +#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat) +#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness) +#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump) +#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint) +#endif +#ifdef IRIDESCENCE +#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence) +#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness) +#endif +#ifdef SHEEN +#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen) +#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness) +#endif +#ifdef ANISOTROPIC +#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy) +#endif +#ifdef SUBSURFACE +#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness) +#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity) +#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity) +#include(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor) +#endif +varying vec3 vPositionW; +#if DEBUGMODE>0 +varying vec4 vClipSpacePosition; +#endif +#ifdef NORMAL +varying vec3 vNormalW; +#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX) +varying vec3 vEnvironmentIrradiance; +#include +#endif +#endif +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +varying vec4 vColor; +#endif +#include +#include +#include +#include<__decl__lightVxFragment>[0..maxSimultaneousLights] +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef REFLECTIONMAP_SKYBOX +varying vec3 vPositionUVW; +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vec3 vDirectionW; +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +varying float vViewDepth; +#endif +#include +#define CUSTOM_VERTEX_DEFINITIONS +void main(void) { +#define CUSTOM_VERTEX_MAIN_BEGIN +vec3 positionUpdated=position; +#ifdef NORMAL +vec3 normalUpdated=normal; +#endif +#ifdef TANGENT +vec4 tangentUpdated=tangent; +#endif +#ifdef UV1 +vec2 uvUpdated=uv; +#endif +#ifdef UV2 +vec2 uv2Updated=uv2; +#endif +#ifdef VERTEXCOLOR +vec4 colorUpdated=color; +#endif +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef REFLECTIONMAP_SKYBOX +vPositionUVW=positionUpdated; +#endif +#define CUSTOM_VERTEX_UPDATE_POSITION +#define CUSTOM_VERTEX_UPDATE_NORMAL +#include +#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED) +vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0); +#endif +#include +#include +vec4 worldPos=finalWorld*vec4(positionUpdated,1.0);vPositionW=vec3(worldPos); +#ifdef PREPASS +#include +#endif +#ifdef NORMAL +mat3 normalWorld=mat3(finalWorld); +#if defined(INSTANCES) && defined(THIN_INSTANCES) +vNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vNormalW=normalize(normalWorld*vNormalW); +#else +#ifdef NONUNIFORMSCALING +normalWorld=transposeMat3(inverseMat3(normalWorld)); +#endif +vNormalW=normalize(normalWorld*normalUpdated); +#endif +#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX) +#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY +vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);float NdotV=max(dot(vNormalW,viewDirectionW),0.0);vec3 roughNormal=mix(vNormalW,viewDirectionW,(0.5*(1.0-NdotV))*baseDiffuseRoughness);vec3 reflectionVector=vec3(reflectionMatrix*vec4(roughNormal,0)).xyz; +#else +vec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz; +#endif +#ifdef REFLECTIONMAP_OPPOSITEZ +reflectionVector.z*=-1.0; +#endif +vEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector); +#endif +#endif +#define CUSTOM_VERTEX_UPDATE_WORLDPOS +#ifdef MULTIVIEW +if (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;} +#else +gl_Position=viewProjection*worldPos; +#endif +#if DEBUGMODE>0 +vClipSpacePosition=gl_Position; +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +vDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0))); +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +#ifdef RIGHT_HANDED +vViewDepth=-(view*worldPos).z; +#else +vViewDepth=(view*worldPos).z; +#endif +#endif +#ifndef UV1 +vec2 uvUpdated=vec2(0.,0.); +#endif +#ifndef UV2 +vec2 uv2Updated=vec2(0.,0.); +#endif +#ifdef MAINUV1 +vMainUV1=uvUpdated; +#endif +#ifdef MAINUV2 +vMainUV2=uv2Updated; +#endif +#include[3..7] +#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_MATRIXNAME_,albedo,_INFONAME_,AlbedoInfos.x) +#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_MATRIXNAME_,baseWeight,_INFONAME_,BaseWeightInfos.x) +#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_MATRIXNAME_,baseDiffuseRoughness,_INFONAME_,BaseDiffuseRoughnessInfos.x) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x) +#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x) +#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x) +#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x) +#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x) +#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_MATRIXNAME_,reflectivity,_INFONAME_,ReflectivityInfos.x) +#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_MATRIXNAME_,microSurfaceSampler,_INFONAME_,MicroSurfaceSamplerInfos.x) +#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_MATRIXNAME_,metallicReflectance,_INFONAME_,MetallicReflectanceInfos.x) +#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_MATRIXNAME_,reflectance,_INFONAME_,ReflectanceInfos.x) +#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x) +#ifdef CLEARCOAT +#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_MATRIXNAME_,clearCoat,_INFONAME_,ClearCoatInfos.x) +#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness,_MATRIXNAME_,clearCoatRoughness,_INFONAME_,ClearCoatInfos.z) +#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_MATRIXNAME_,clearCoatBump,_INFONAME_,ClearCoatBumpInfos.x) +#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_MATRIXNAME_,clearCoatTint,_INFONAME_,ClearCoatTintInfos.x) +#endif +#ifdef IRIDESCENCE +#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_MATRIXNAME_,iridescence,_INFONAME_,IridescenceInfos.x) +#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_MATRIXNAME_,iridescenceThickness,_INFONAME_,IridescenceInfos.z) +#endif +#ifdef SHEEN +#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_MATRIXNAME_,sheen,_INFONAME_,SheenInfos.x) +#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness,_MATRIXNAME_,sheenRoughness,_INFONAME_,SheenInfos.z) +#endif +#ifdef ANISOTROPIC +#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_MATRIXNAME_,anisotropy,_INFONAME_,AnisotropyInfos.x) +#endif +#ifdef SUBSURFACE +#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_MATRIXNAME_,thickness,_INFONAME_,ThicknessInfos.x) +#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_MATRIXNAME_,refractionIntensity,_INFONAME_,RefractionIntensityInfos.x) +#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_MATRIXNAME_,translucencyIntensity,_INFONAME_,TranslucencyIntensityInfos.x) +#include(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor,_MATRIXNAME_,translucencyColor,_INFONAME_,TranslucencyColorInfos.x) +#endif +#include +#include +#include +#include[0..maxSimultaneousLights] +#include +#if defined(POINTSIZE) && !defined(WEBGPU) +gl_PointSize=pointSize; +#endif +#include +#define CUSTOM_VERTEX_MAIN_END +} +`;e.ShadersStore[i]||(e.ShadersStore[i]=E);const p={name:i,shader:E};export{p as pbrVertexShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbr.vertex-DRZMMP8Z.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbr.vertex-DRZMMP8Z.js new file mode 100644 index 0000000000000000000000000000000000000000..f8571e402c22e6f01f26b83c2a4ef92efcab8478 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbr.vertex-DRZMMP8Z.js @@ -0,0 +1,227 @@ +import{S as E}from"./index-CDrXokXW.js";import"./pbrUboDeclaration-Bwg_eWAt.js";import"./vertexColorMixing-8t5JaWwM.js";import"./mainUVVaryingDeclaration-gz09aLXv.js";import"./helperFunctions-CZpZ-EbL.js";import"./pbrBRDFFunctions-baMKuu65.js";import"./bonesDeclaration-Bh_c0MF7.js";import"./instancesVertex-CO_CTxxp.js";import"./instancesDeclaration-DZdrWbmN.js";import"./harmonicsFunctions-DjLTZRig.js";import"./bumpVertexDeclaration-BZI6C33v.js";import"./clipPlaneVertex-J3Krgsee.js";import"./logDepthVertex-D_A6gsii.js";import"./shadowsVertex-CygJ_RUp.js";import"./morphTargetsVertexDeclaration-BsT9JpOT.js";import"./logDepthDeclaration-DkdfQs4e.js";import"./morphTargetsVertex-DcRl6X3j.js";import"./bonesVertex-bl6LLSA1.js";import"./bakedVertexAnimation-DoavwM49.js";import"./bumpVertex-D9JGroSY.js";import"./index-DWyDLubb.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./meshUboDeclaration-Bk1ASTX2.js";const e="pbrVertexShader",i=`#define PBR_VERTEX_SHADER +#include +#define CUSTOM_VERTEX_BEGIN +attribute position: vec3f; +#ifdef NORMAL +attribute normal: vec3f; +#endif +#ifdef TANGENT +attribute tangent: vec4f; +#endif +#ifdef UV1 +attribute uv: vec2f; +#endif +#include[2..7] +#include[1..7] +#ifdef VERTEXCOLOR +attribute color: vec4f; +#endif +#include +#include +#include +#include +#include +#include +#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo) +#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight) +#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail) +#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient) +#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity) +#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive) +#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap) +#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity) +#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler) +#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance) +#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance) +#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal) +#ifdef CLEARCOAT +#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat) +#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness) +#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump) +#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint) +#endif +#ifdef IRIDESCENCE +#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence) +#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness) +#endif +#ifdef SHEEN +#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen) +#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness) +#endif +#ifdef ANISOTROPIC +#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy) +#endif +#ifdef SUBSURFACE +#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness) +#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity) +#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity) +#include(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor) +#endif +varying vPositionW: vec3f; +#if DEBUGMODE>0 +varying vClipSpacePosition: vec4f; +#endif +#ifdef NORMAL +varying vNormalW: vec3f; +#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX) +varying vEnvironmentIrradiance: vec3f; +#include +#endif +#endif +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +varying vColor: vec4f; +#endif +#include +#include +#include +#include[0..maxSimultaneousLights] +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef REFLECTIONMAP_SKYBOX +varying vPositionUVW: vec3f; +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +varying vDirectionW: vec3f; +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +varying vViewDepth: f32; +#endif +#include +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs { +#define CUSTOM_VERTEX_MAIN_BEGIN +var positionUpdated: vec3f=vertexInputs.position; +#ifdef NORMAL +var normalUpdated: vec3f=vertexInputs.normal; +#endif +#ifdef TANGENT +var tangentUpdated: vec4f=vertexInputs.tangent; +#endif +#ifdef UV1 +var uvUpdated: vec2f=vertexInputs.uv; +#endif +#ifdef UV2 +var uv2Updated: vec2f=vertexInputs.uv2; +#endif +#ifdef VERTEXCOLOR +var colorUpdated: vec4f=vertexInputs.color; +#endif +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef REFLECTIONMAP_SKYBOX +vertexOutputs.vPositionUVW=positionUpdated; +#endif +#define CUSTOM_VERTEX_UPDATE_POSITION +#define CUSTOM_VERTEX_UPDATE_NORMAL +#include +#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED) +vertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*vec4f(positionUpdated,1.0); +#endif +#include +#include +var worldPos: vec4f=finalWorld* vec4f(positionUpdated,1.0);vertexOutputs.vPositionW= worldPos.xyz; +#ifdef PREPASS +#include +#endif +#ifdef NORMAL +var normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz); +#if defined(INSTANCES) && defined(THIN_INSTANCES) +vertexOutputs.vNormalW=normalUpdated/ vec3f(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vertexOutputs.vNormalW=normalize(normalWorld*vertexOutputs.vNormalW); +#else +#ifdef NONUNIFORMSCALING +normalWorld=transposeMat3(inverseMat3(normalWorld)); +#endif +vertexOutputs.vNormalW=normalize(normalWorld*normalUpdated); +#endif +#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX) +#if BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LAMBERT && BASE_DIFFUSE_MODEL != BRDF_DIFFUSE_MODEL_LEGACY +var viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-vertexOutputs.vPositionW);var NdotV: f32=max(dot(vertexOutputs.vNormalW,viewDirectionW),0.0);var roughNormal: vec3f=mix(vertexOutputs.vNormalW,viewDirectionW,(0.5*(1.0-NdotV))*uniforms.baseDiffuseRoughness);var reflectionVector: vec3f= (uniforms.reflectionMatrix* vec4f(roughNormal,0)).xyz; +#else +var reflectionVector: vec3f= (uniforms.reflectionMatrix* vec4f(vertexOutputs.vNormalW,0)).xyz; +#endif +#ifdef REFLECTIONMAP_OPPOSITEZ +reflectionVector.z*=-1.0; +#endif +vertexOutputs.vEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector); +#endif +#endif +#define CUSTOM_VERTEX_UPDATE_WORLDPOS +#ifdef MULTIVIEW +if (gl_ViewID_OVR==0u) {vertexOutputs.position=scene.viewProjection*worldPos;} else {vertexOutputs.position=scene.viewProjectionR*worldPos;} +#else +vertexOutputs.position=scene.viewProjection*worldPos; +#endif +#if DEBUGMODE>0 +vertexOutputs.vClipSpacePosition=vertexOutputs.position; +#endif +#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) +vertexOutputs.vDirectionW=normalize((finalWorld*vec4f(positionUpdated,0.0)).xyz); +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +#ifdef RIGHT_HANDED +vertexOutputs.vViewDepth=-(scene.view*worldPos).z; +#else +vertexOutputs.vViewDepth=(scene.view*worldPos).z; +#endif +#endif +#ifndef UV1 +var uvUpdated: vec2f= vec2f(0.,0.); +#endif +#ifdef MAINUV1 +vertexOutputs.vMainUV1=uvUpdated; +#endif +#ifndef UV2 +var uv2Updated: vec2f= vec2f(0.,0.); +#endif +#ifdef MAINUV2 +vertexOutputs.vMainUV2=uv2Updated; +#endif +#include[3..7] +#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_MATRIXNAME_,albedo,_INFONAME_,AlbedoInfos.x) +#include(_DEFINENAME_,BASE_WEIGHT,_VARYINGNAME_,BaseWeight,_MATRIXNAME_,baseWeight,_INFONAME_,BaseWeightInfos.x) +#include(_DEFINENAME_,BASE_DIFFUSE_ROUGHNESS,_VARYINGNAME_,BaseDiffuseRoughness,_MATRIXNAME_,baseDiffuseRoughness,_INFONAME_,BaseDiffuseRoughnessInfos.x) +#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x) +#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x) +#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x) +#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x) +#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x) +#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_MATRIXNAME_,reflectivity,_INFONAME_,ReflectivityInfos.x) +#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_MATRIXNAME_,microSurfaceSampler,_INFONAME_,MicroSurfaceSamplerInfos.x) +#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_MATRIXNAME_,metallicReflectance,_INFONAME_,MetallicReflectanceInfos.x) +#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_MATRIXNAME_,reflectance,_INFONAME_,ReflectanceInfos.x) +#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x) +#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x) +#ifdef CLEARCOAT +#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_MATRIXNAME_,clearCoat,_INFONAME_,ClearCoatInfos.x) +#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness,_MATRIXNAME_,clearCoatRoughness,_INFONAME_,ClearCoatInfos.z) +#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_MATRIXNAME_,clearCoatBump,_INFONAME_,ClearCoatBumpInfos.x) +#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_MATRIXNAME_,clearCoatTint,_INFONAME_,ClearCoatTintInfos.x) +#endif +#ifdef IRIDESCENCE +#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_MATRIXNAME_,iridescence,_INFONAME_,IridescenceInfos.x) +#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_MATRIXNAME_,iridescenceThickness,_INFONAME_,IridescenceInfos.z) +#endif +#ifdef SHEEN +#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_MATRIXNAME_,sheen,_INFONAME_,SheenInfos.x) +#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness,_MATRIXNAME_,sheenRoughness,_INFONAME_,SheenInfos.z) +#endif +#ifdef ANISOTROPIC +#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_MATRIXNAME_,anisotropy,_INFONAME_,AnisotropyInfos.x) +#endif +#ifdef SUBSURFACE +#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_MATRIXNAME_,thickness,_INFONAME_,ThicknessInfos.x) +#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_MATRIXNAME_,refractionIntensity,_INFONAME_,RefractionIntensityInfos.x) +#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_MATRIXNAME_,translucencyIntensity,_INFONAME_,TranslucencyIntensityInfos.x) +#include(_DEFINENAME_,SS_TRANSLUCENCYCOLOR_TEXTURE,_VARYINGNAME_,TranslucencyColor,_MATRIXNAME_,translucencyColor,_INFONAME_,TranslucencyColorInfos.x) +#endif +#include +#include +#include +#include[0..maxSimultaneousLights] +#include +#include +#define CUSTOM_VERTEX_MAIN_END +}`;E.ShadersStoreWGSL[e]||(E.ShadersStoreWGSL[e]=i);const C={name:e,shader:i};export{C as pbrVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrBRDFFunctions-BEHyjaG2.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrBRDFFunctions-BEHyjaG2.js new file mode 100644 index 0000000000000000000000000000000000000000..1e646adf6dab05e1efb9dee5be7e0536d7fe6db1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrBRDFFunctions-BEHyjaG2.js @@ -0,0 +1,169 @@ +import{S as e}from"./index-CDrXokXW.js";const t="pbrBRDFFunctions",o=`#define FRESNEL_MAXIMUM_ON_ROUGH 0.25 +#define BRDF_DIFFUSE_MODEL_EON 0 +#define BRDF_DIFFUSE_MODEL_BURLEY 1 +#define BRDF_DIFFUSE_MODEL_LAMBERT 2 +#define BRDF_DIFFUSE_MODEL_LEGACY 3 +#define DIELECTRIC_SPECULAR_MODEL_GLTF 0 +#define DIELECTRIC_SPECULAR_MODEL_OPENPBR 1 +#define CONDUCTOR_SPECULAR_MODEL_GLTF 0 +#define CONDUCTOR_SPECULAR_MODEL_OPENPBR 1 +#if !defined(PBR_VERTEX_SHADER) && !defined(OPENPBR_VERTEX_SHADER) +#ifdef MS_BRDF_ENERGY_CONSERVATION +vec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);} +#endif +#if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR +vec3 getF82Specular(float NdotV,vec3 F0,vec3 edgeTint,float roughness) {const float cos_theta_max=0.142857143; +const float one_minus_cos_theta_max_to_the_fifth=0.462664366; +const float one_minus_cos_theta_max_to_the_sixth=0.396569457; +vec3 white_minus_F0=vec3(1.0)-F0;vec3 b_numerator=(F0+white_minus_F0*one_minus_cos_theta_max_to_the_fifth)*(vec3(1.0)-edgeTint);const float b_denominator=cos_theta_max*one_minus_cos_theta_max_to_the_sixth;const float b_denominator_reciprocal=1.0/b_denominator;vec3 b=b_numerator*b_denominator_reciprocal; +float cos_theta=max(roughness,NdotV);float one_minus_cos_theta=1.0-cos_theta;vec3 offset_from_F0=(white_minus_F0-b*cos_theta*one_minus_cos_theta)*pow(one_minus_cos_theta,5.0);return clamp(F0+offset_from_F0,0.0,1.0);} +#endif +#ifdef FUZZENVIRONMENTBRDF +vec3 getFuzzBRDFLookup(float NdotV,float perceptualRoughness) {vec2 UV=vec2(perceptualRoughness,NdotV);vec4 brdfLookup=texture2D(environmentFuzzBrdfSampler,UV);const vec2 RiRange=vec2(0.0,0.75);const vec2 ARange =vec2(0.005,0.88);const vec2 BRange =vec2(-0.18,0.002);brdfLookup.r=mix(ARange.x, ARange.y, brdfLookup.r);brdfLookup.g=mix(BRange.x, BRange.y, brdfLookup.g);brdfLookup.b=mix(RiRange.x,RiRange.y,brdfLookup.b);return brdfLookup.rgb;} +#endif +#ifdef ENVIRONMENTBRDF +vec3 getBRDFLookup(float NdotV,float perceptualRoughness) {vec2 UV=vec2(NdotV,perceptualRoughness);vec4 brdfLookup=texture2D(environmentBrdfSampler,UV); +#ifdef ENVIRONMENTBRDF_RGBD +brdfLookup.rgb=fromRGBD(brdfLookup.rgba); +#endif +return brdfLookup.rgb;} +vec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) { +#ifdef BRDF_V_HEIGHT_CORRELATED +vec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y; +#else +vec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y; +#endif +return reflectance;} +vec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) { +#ifdef BRDF_V_HEIGHT_CORRELATED +vec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0); +#else +vec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y; +#endif +return reflectance;} +#endif +/* NOT USED +#if defined(SHEEN) && defined(SHEEN_SOFTER) +float getBRDFLookupCharlieSheen(float NdotV,float perceptualRoughness) +{float c=1.0-NdotV;float c3=c*c*c;return 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));} +#endif +*/ +#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL) +vec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness) +{float weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));} +#endif +#if defined(SHEEN) && defined(ENVIRONMENTBRDF) +/** +* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture. +* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table +*/ +vec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {vec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;return sheenEnvironmentReflectance;} +#endif +vec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90) +{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);} +float fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90) +{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);} +#ifdef CLEARCOAT +vec3 getR0RemappedForClearCoat(vec3 f0) { +#ifdef CLEARCOAT_DEFAULTIOR +#ifdef MOBILE +return saturate(f0*(f0*0.526868+0.529324)-0.0482256); +#else +return saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998); +#endif +#else +vec3 s=sqrt(f0);vec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);return square(t); +#endif +} +#endif +#ifdef IRIDESCENCE +const mat3 XYZ_TO_REC709=mat3( +3.2404542,-0.9692660, 0.0556434, +-1.5371385, 1.8760108,-0.2040259, +-0.4985314, 0.0415560, 1.0572252 +);vec3 getIORTfromAirToSurfaceR0(vec3 f0) {vec3 sqrtF0=sqrt(f0);return (1.+sqrtF0)/(1.-sqrtF0);} +vec3 getR0fromIORs(vec3 iorT,float iorI) {return square((iorT-vec3(iorI))/(iorT+vec3(iorI)));} +float getR0fromIORs(float iorT,float iorI) {return square((iorT-iorI)/(iorT+iorI));} +vec3 evalSensitivity(float opd,vec3 shift) {float phase=2.0*PI*opd*1.0e-9;const vec3 val=vec3(5.4856e-13,4.4201e-13,5.2481e-13);const vec3 pos=vec3(1.6810e+06,1.7953e+06,2.2084e+06);const vec3 var=vec3(4.3278e+09,9.3046e+09,6.6121e+09);vec3 xyz=val*sqrt(2.0*PI*var)*cos(pos*phase+shift)*exp(-square(phase)*var);xyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));xyz/=1.0685e-7;vec3 srgb=XYZ_TO_REC709*xyz;return srgb;} +vec3 evalIridescence(float outsideIOR,float eta2,float cosTheta1,float thinFilmThickness,vec3 baseF0) {vec3 I=vec3(1.0);float iridescenceIOR=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));float sinTheta2Sq=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));float cosTheta2Sq=1.0-sinTheta2Sq;if (cosTheta2Sq<0.0) {return I;} +float cosTheta2=sqrt(cosTheta2Sq);float R0=getR0fromIORs(iridescenceIOR,outsideIOR);float R12=fresnelSchlickGGX(cosTheta1,R0,1.);float R21=R12;float T121=1.0-R12;float phi12=0.0;if (iridescenceIOR0.0 ? s/max(mu_i,mu_o) : s; +float AF=1.0/(1.0+constant1_FON*sigma); +vec3 f_ss=(rho*RECIPROCAL_PI)*AF*(1.0+sigma*sovertF); +float EFo=E_FON_approx(mu_o,sigma); +float EFi=E_FON_approx(mu_i,sigma); +float avgEF=AF*(1.0+constant2_FON*sigma); +vec3 rho_ms=(rho*rho)*avgEF/(vec3(1.0)-rho*(1.0-avgEF));const float eps=1.0e-7;vec3 f_ms=(rho_ms*RECIPROCAL_PI)*max(eps,1.0-EFo) +* max(eps,1.0-EFi) +/ max(eps,1.0-avgEF);return (f_ss+f_ms);} +#ifdef SS_TRANSLUCENCY +vec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {vec3 S=1./maxEps(diffusionDistance);vec3 temp=exp((-0.333333333*thickness)*S);return tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);} +float computeWrappedDiffuseNdotL(float NdotL,float w) {float t=1.0+w;float invt2=1.0/square(t);return saturate((NdotL+w)*invt2);} +#endif +#endif +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=o); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrBRDFFunctions-baMKuu65.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrBRDFFunctions-baMKuu65.js new file mode 100644 index 0000000000000000000000000000000000000000..4f1ca159d959fc6565a598c6b3fd9fd99a3beab1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrBRDFFunctions-baMKuu65.js @@ -0,0 +1,173 @@ +import{S as e}from"./index-CDrXokXW.js";const f="pbrBRDFFunctions",r=`#define FRESNEL_MAXIMUM_ON_ROUGH 0.25 +#define BRDF_DIFFUSE_MODEL_EON 0 +#define BRDF_DIFFUSE_MODEL_BURLEY 1 +#define BRDF_DIFFUSE_MODEL_LAMBERT 2 +#define BRDF_DIFFUSE_MODEL_LEGACY 3 +#define DIELECTRIC_SPECULAR_MODEL_GLTF 0 +#define DIELECTRIC_SPECULAR_MODEL_OPENPBR 1 +#define CONDUCTOR_SPECULAR_MODEL_GLTF 0 +#define CONDUCTOR_SPECULAR_MODEL_OPENPBR 1 +#if !defined(PBR_VERTEX_SHADER) && !defined(OPENPBR_VERTEX_SHADER) +#ifdef MS_BRDF_ENERGY_CONSERVATION +fn getEnergyConservationFactor(specularEnvironmentR0: vec3f,environmentBrdf: vec3f)->vec3f {return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);} +#endif +#if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR +fn getF82Specular(NdotV: f32,F0: vec3f,edgeTint: vec3f,roughness: f32)->vec3f {const cos_theta_max: f32=0.142857143; +const one_minus_cos_theta_max_to_the_fifth: f32=0.462664366; +const one_minus_cos_theta_max_to_the_sixth: f32=0.396569457; +let white_minus_F0: vec3f=vec3f(1.0f)-F0;let b_numerator: vec3f=(F0+white_minus_F0*one_minus_cos_theta_max_to_the_fifth)*(vec3f(1.0)-edgeTint);const b_denominator: f32=cos_theta_max*one_minus_cos_theta_max_to_the_sixth;const b_denominator_reciprocal: f32=1.0f/b_denominator;let b: vec3f=b_numerator*b_denominator_reciprocal; +let cos_theta: f32=max(roughness,NdotV);let one_minus_cos_theta: f32=1.0-cos_theta;let offset_from_F0: vec3f=(white_minus_F0-b*cos_theta*one_minus_cos_theta)*pow(one_minus_cos_theta,5.0f);return clamp(F0+offset_from_F0,vec3f(0.0f),vec3f(1.0f));} +#endif +#ifdef FUZZENVIRONMENTBRDF +fn getFuzzBRDFLookup(NdotV: f32,perceptualRoughness: f32)->vec3f {let UV: vec2f=vec2f(perceptualRoughness,NdotV);var brdfLookup: vec4f=textureSample(environmentFuzzBrdfSampler,environmentFuzzBrdfSamplerSampler,UV);const RiRange: vec2f=vec2f(0.0f,0.75f);const ARange: vec2f=vec2f(0.005f,0.88f);const BRange: vec2f=vec2f(-0.18f,0.002f);brdfLookup.r=mix(ARange.x, ARange.y, brdfLookup.r);brdfLookup.g=mix(BRange.x, BRange.y, brdfLookup.g);brdfLookup.b=mix(RiRange.x,RiRange.y,brdfLookup.b);return brdfLookup.rgb;} +#endif +#ifdef ENVIRONMENTBRDF +fn getBRDFLookup(NdotV: f32,perceptualRoughness: f32)->vec3f {var UV: vec2f= vec2f(NdotV,perceptualRoughness);var brdfLookup: vec4f= textureSample(environmentBrdfSampler,environmentBrdfSamplerSampler,UV); +#ifdef ENVIRONMENTBRDF_RGBD +brdfLookup=vec4f(fromRGBD(brdfLookup.rgba),brdfLookup.a); +#endif +return brdfLookup.rgb;} +fn getReflectanceFromBRDFWithEnvLookup(specularEnvironmentR0: vec3f,specularEnvironmentR90: vec3f,environmentBrdf: vec3f)->vec3f { +#ifdef BRDF_V_HEIGHT_CORRELATED +var reflectance: vec3f=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y; +#else +var reflectance: vec3f=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y; +#endif +return reflectance;} +fn getReflectanceFromBRDFLookup(specularEnvironmentR0: vec3f,environmentBrdf: vec3f)->vec3f { +#ifdef BRDF_V_HEIGHT_CORRELATED +var reflectance: vec3f=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0); +#else +var reflectance: vec3f=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y; +#endif +return reflectance;} +#endif +/* NOT USED +#if defined(SHEEN) && defined(SHEEN_SOFTER) +fn getBRDFLookupCharlieSheen(NdotV: f32,perceptualRoughness: f32)->f32 +{var c: f32=1.0-NdotV;var c3: f32=c*c*c;return 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));} +#endif +*/ +#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL) +fn getReflectanceFromAnalyticalBRDFLookup_Jones(VdotN: f32,reflectance0: vec3f,reflectance90: vec3f,smoothness: f32)->vec3f +{var weight: f32=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));} +#endif +#if defined(SHEEN) && defined(ENVIRONMENTBRDF) +/** +* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture. +* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table +*/ +fn getSheenReflectanceFromBRDFLookup(reflectance0: vec3f,environmentBrdf: vec3f)->vec3f {var sheenEnvironmentReflectance: vec3f=reflectance0*environmentBrdf.b;return sheenEnvironmentReflectance;} +#endif +fn fresnelSchlickGGXVec3(VdotH: f32,reflectance0: vec3f,reflectance90: vec3f)->vec3f +{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);} +fn fresnelSchlickGGX(VdotH: f32,reflectance0: f32,reflectance90: f32)->f32 +{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);} +#ifdef CLEARCOAT +fn getR0RemappedForClearCoat(f0: vec3f)->vec3f { +#ifdef CLEARCOAT_DEFAULTIOR +#ifdef MOBILE +return saturateVec3(f0*(f0*0.526868+0.529324)-0.0482256); +#else +return saturateVec3(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998); +#endif +#else +var s: vec3f=sqrt(f0);var t: vec3f=(uniforms.vClearCoatRefractionParams.z+uniforms.vClearCoatRefractionParams.w*s)/(uniforms.vClearCoatRefractionParams.w+uniforms.vClearCoatRefractionParams.z*s);return squareVec3(t); +#endif +} +#endif +#ifdef IRIDESCENCE +const XYZ_TO_REC709: mat3x3f= mat3x3f( +3.2404542,-0.9692660, 0.0556434, +-1.5371385, 1.8760108,-0.2040259, +-0.4985314, 0.0415560, 1.0572252 +);fn getIORTfromAirToSurfaceR0(f0: vec3f)->vec3f {var sqrtF0: vec3f=sqrt(f0);return (1.+sqrtF0)/(1.-sqrtF0);} +fn getR0fromIORsVec3(iorT: vec3f,iorI: f32)->vec3f {return squareVec3((iorT- vec3f(iorI))/(iorT+ vec3f(iorI)));} +fn getR0fromIORs(iorT: f32,iorI: f32)->f32 {return square((iorT-iorI)/(iorT+iorI));} +fn evalSensitivity(opd: f32,shift: vec3f)->vec3f {var phase: f32=2.0*PI*opd*1.0e-9;const val: vec3f= vec3f(5.4856e-13,4.4201e-13,5.2481e-13);const pos: vec3f= vec3f(1.6810e+06,1.7953e+06,2.2084e+06);const vr: vec3f= vec3f(4.3278e+09,9.3046e+09,6.6121e+09);var xyz: vec3f=val*sqrt(2.0*PI*vr)*cos(pos*phase+shift)*exp(-square(phase)*vr);xyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));xyz/=1.0685e-7;var srgb: vec3f=XYZ_TO_REC709*xyz;return srgb;} +fn evalIridescence(outsideIOR: f32,eta2: f32,cosTheta1: f32,thinFilmThickness: f32,baseF0: vec3f)->vec3f {var I: vec3f= vec3f(1.0);var iridescenceIOR: f32=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));var sinTheta2Sq: f32=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));var cosTheta2Sq: f32=1.0-sinTheta2Sq;if (cosTheta2Sq<0.0) {return I;} +var cosTheta2: f32=sqrt(cosTheta2Sq);var R0: f32=getR0fromIORs(iridescenceIOR,outsideIOR);var R12: f32=fresnelSchlickGGX(cosTheta1,R0,1.);var R21: f32=R12;var T121: f32=1.0-R12;var phi12: f32=0.0;if (iridescenceIORf32 +{var a2: f32=alphaG*alphaG;var d: f32=NdotH*NdotH*(a2-1.0)+1.0;return a2/(PI*d*d);} +#ifdef SHEEN +fn normalDistributionFunction_CharlieSheen(NdotH: f32,alphaG: f32)->f32 +{var invR: f32=1./alphaG;var cos2h: f32=NdotH*NdotH;var sin2h: f32=1.-cos2h;return (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);} +#endif +#ifdef ANISOTROPIC +fn normalDistributionFunction_BurleyGGX_Anisotropic(NdotH: f32,TdotH: f32,BdotH: f32,alphaTB: vec2f)->f32 {var a2: f32=alphaTB.x*alphaTB.y;var v: vec3f= vec3f(alphaTB.y*TdotH,alphaTB.x *BdotH,a2*NdotH);var v2: f32=dot(v,v);var w2: f32=a2/v2;return a2*w2*w2*RECIPROCAL_PI;} +#endif +#ifdef BRDF_V_HEIGHT_CORRELATED +fn smithVisibility_GGXCorrelated(NdotL: f32,NdotV: f32,alphaG: f32)->f32 { +#ifdef MOBILE +var GGXV: f32=NdotL*(NdotV*(1.0-alphaG)+alphaG);var GGXL: f32=NdotV*(NdotL*(1.0-alphaG)+alphaG);return 0.5/(GGXV+GGXL); +#else +var a2: f32=alphaG*alphaG;var GGXV: f32=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);var GGXL: f32=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);return 0.5/(GGXV+GGXL); +#endif +} +#else +fn smithVisibilityG1_TrowbridgeReitzGGXFast(dot: f32,alphaG: f32)->f32 +{ +#ifdef MOBILE +return 1.0/(dot+alphaG+(1.0-alphaG)*dot )); +#else +var alphaSquared: f32=alphaG*alphaG;return 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot)); +#endif +} +fn smithVisibility_TrowbridgeReitzGGXFast(NdotL: f32,NdotV: f32,alphaG: f32)->f32 +{var visibility: f32=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);return visibility;} +#endif +#ifdef ANISOTROPIC +fn smithVisibility_GGXCorrelated_Anisotropic(NdotL: f32,NdotV: f32,TdotV: f32,BdotV: f32,TdotL: f32,BdotL: f32,alphaTB: vec2f)->f32 {var lambdaV: f32=NdotL*length( vec3f(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));var lambdaL: f32=NdotV*length( vec3f(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));var v: f32=0.5/(lambdaV+lambdaL);return v;} +#endif +#ifdef CLEARCOAT +fn visibility_Kelemen(VdotH: f32)->f32 {return 0.25/(VdotH*VdotH); } +#endif +#ifdef SHEEN +fn visibility_Ashikhmin(NdotL: f32,NdotV: f32)->f32 +{return 1./(4.*(NdotL+NdotV-NdotL*NdotV));} +/* NOT USED +#ifdef SHEEN_SOFTER +fn l(x: f32,alphaG: f32)->f32 +{var oneMinusAlphaSq: f32=(1.0-alphaG)*(1.0-alphaG);var a: f32=mix(21.5473,25.3245,oneMinusAlphaSq);var b: f32=mix(3.82987,3.32435,oneMinusAlphaSq);var c: f32=mix(0.19823,0.16801,oneMinusAlphaSq);var d: f32=mix(-1.97760,-1.27393,oneMinusAlphaSq);var e: f32=mix(-4.32054,-4.85967,oneMinusAlphaSq);return a/(1.0+b*pow(x,c))+d*x+e;} +fn lambdaSheen(cosTheta: f32,alphaG: f32)->f32 +{return abs(cosTheta)<0.5 ? exp(l(cosTheta,alphaG)) : exp(2.0*l(0.5,alphaG)-l(1.0-cosTheta,alphaG));} +fn visibility_CharlieSheen(NdotL: f32,NdotV: f32,alphaG: f32)->f32 +{var G: f32=1.0/(1.0+lambdaSheen(NdotV,alphaG)+lambdaSheen(NdotL,alphaG));return G/(4.0*NdotV*NdotL);} +#endif +*/ +#endif +const constant1_FON: f32=0.5f-2.0f/(3.0f*PI);const constant2_FON: f32=2.0f/3.0f-28.0f/(15.0f*PI);fn E_FON_approx(mu: f32,roughness: f32)->f32 +{var sigma: f32=roughness; +var mucomp: f32=1.0f-mu;var mucomp2: f32=mucomp*mucomp;const Gcoeffs: mat2x2f=mat2x2f(0.0571085289f,-0.332181442f, +0.491881867f,0.0714429953f);var GoverPi: f32=dot(Gcoeffs*vec2f(mucomp,mucomp2),vec2f(1.0f,mucomp2));return (1.0f+sigma*GoverPi)/(1.0f+constant1_FON*sigma);} +fn diffuseBRDF_EON(albedo: vec3f,roughness: f32,NdotL: f32,NdotV: f32,LdotV: f32)->vec3f +{var rho: vec3f=albedo;var sigma: f32=roughness; +var mu_i: f32=NdotL; +var mu_o: f32=NdotV; +var s: f32=LdotV-mu_i*mu_o; +var sovertF: f32=select(s,s/max(mu_i,mu_o),s>0.0f); +var AF: f32=1.0f/(1.0f+constant1_FON*sigma); +var f_ss: vec3f=(rho*RECIPROCAL_PI)*AF*(1.0f+sigma*sovertF); +var EFo: f32=E_FON_approx(mu_o,sigma); +var EFi: f32=E_FON_approx(mu_i,sigma); +var avgEF: f32=AF*(1.0f+constant2_FON*sigma); +var rho_ms: vec3f=(rho*rho)*avgEF/(vec3f(1.0f)-rho*(1.0f-avgEF));const eps: f32=1.0e-7f;var f_ms: vec3f=(rho_ms*RECIPROCAL_PI)*max(eps,1.0f-EFo) +* max(eps,1.0f-EFi) +/ max(eps,1.0f-avgEF);return (f_ss+f_ms);} +fn diffuseBRDF_Burley(NdotL: f32,NdotV: f32,VdotH: f32,roughness: f32)->f32 {var diffuseFresnelNV: f32=pow5(saturateEps(1.0-NdotL));var diffuseFresnelNL: f32=pow5(saturateEps(1.0-NdotV));var diffuseFresnel90: f32=0.5+2.0*VdotH*VdotH*roughness;var fresnel: f32 = +(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) * +(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);return fresnel/PI;} +#ifdef SS_TRANSLUCENCY +fn transmittanceBRDF_Burley(tintColor: vec3f,diffusionDistance: vec3f,thickness: f32)->vec3f {var S: vec3f=1./maxEpsVec3(diffusionDistance);var temp: vec3f=exp((-0.333333333*thickness)*S);return tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);} +fn computeWrappedDiffuseNdotL(NdotL: f32,w: f32)->f32 {var t: f32=1.0+w;var invt2: f32=1.0/(t*t);return saturate((NdotL+w)*invt2);} +#endif +#endif +`;e.IncludesShadersStoreWGSL[f]||(e.IncludesShadersStoreWGSL[f]=r); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrDebug-ChQlKLz5.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrDebug-ChQlKLz5.js new file mode 100644 index 0000000000000000000000000000000000000000..a3b8d3083449244b67ef8f550d47325e5d106fc8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrDebug-ChQlKLz5.js @@ -0,0 +1,513 @@ +import{S as e}from"./index-CDrXokXW.js";import"./mainUVVaryingDeclaration-CYLIf35n.js";import"./shadowsFragmentFunctions-QR4_Qrt1.js";const o="pbrFragmentExtraDeclaration",g=`varying vec3 vPositionW; +#if DEBUGMODE>0 +varying vec4 vClipSpacePosition; +#endif +#include[1..7] +#ifdef NORMAL +varying vec3 vNormalW; +#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX) +varying vec3 vEnvironmentIrradiance; +#endif +#endif +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +varying vec4 vColor; +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +varying float vViewDepth; +#endif +`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=g);const t="subSurfaceScatteringFunctions",E=`bool testLightingForSSS(float diffusionProfile) +{return diffusionProfile<1.;}`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=E);const i="pbrHelperFunctions",u=`#define MINIMUMVARIANCE 0.0005 +float convertRoughnessToAverageSlope(float roughness) +{return square(roughness)+MINIMUMVARIANCE;} +float fresnelGrazingReflectance(float reflectance0) {float reflectance90=saturate(reflectance0*25.0);return reflectance90;} +vec2 getAARoughnessFactors(vec3 normalVector) { +#ifdef SPECULARAA +vec3 nDfdx=dFdx(normalVector.xyz);vec3 nDfdy=dFdy(normalVector.xyz);float slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));float geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);float geometricAlphaGFactor=sqrt(slopeSquare);geometricAlphaGFactor*=0.75;return vec2(geometricRoughnessFactor,geometricAlphaGFactor); +#else +return vec2(0.); +#endif +} +#ifdef ANISOTROPIC +#ifdef ANISOTROPIC_LEGACY +vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);float alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);return vec2(alphaT,alphaB);} +vec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy,float roughness) {vec3 anisotropicFrameDirection;if (anisotropy>=0.0) {anisotropicFrameDirection=B;} else {anisotropicFrameDirection=T;} +vec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);vec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);vec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));return anisotropicNormal;} +#elif ANISOTROPIC_OPENPBR +vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=alphaG*sqrt(2.0/(1.0+(1.0-anisotropy)*(1.0-anisotropy)));float alphaB=max(alphaT*(1.0-anisotropy),MINIMUMVARIANCE);return vec2(alphaT,alphaB);} +#else +vec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(mix(alphaG,1.0,anisotropy*anisotropy),MINIMUMVARIANCE);float alphaB=max(alphaG,MINIMUMVARIANCE);return vec2(alphaT,alphaB);} +vec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy,float roughness) {vec3 bentNormal=cross(B,V);bentNormal=normalize(cross(bentNormal,B));float a=square(square(1.0-anisotropy*(1.0-roughness)));bentNormal=normalize(mix(bentNormal,N,a));return bentNormal;} +#endif +#endif +#if defined(CLEARCOAT) || defined(SS_REFRACTION) +vec3 cocaLambert(vec3 alpha,float distance) {return exp(-alpha*distance);} +vec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {return cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));} +vec3 computeColorAtDistanceInMedia(vec3 color,float distance) {return -log(color)/distance;} +vec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 clearCoatAbsorption=mix(vec3(1.0), +cocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness), +clearCoatIntensity);return clearCoatAbsorption;} +#endif +#ifdef MICROSURFACEAUTOMATIC +float computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor) +{const float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;float reflectivityLuminance=getLuminance(reflectivityColor);float reflectivityLuma=sqrt(reflectivityLuminance);microSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;return microSurface;} +#endif +`;e.IncludesShadersStore[i]||(e.IncludesShadersStore[i]=u);const r="pbrDirectLightingSetupFunctions",D=`struct preLightingInfo +{vec3 lightOffset;float lightDistanceSquared;float lightDistance;float attenuation;vec3 L;vec3 H;float NdotV;float NdotLUnclamped;float NdotL;float VdotH;float LdotV;float roughness;float diffuseRoughness;vec3 surfaceAlbedo; +#ifdef IRIDESCENCE +float iridescenceIntensity; +#endif +#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +vec3 areaLightDiffuse; +#ifdef SPECULARTERM +vec3 areaLightSpecular;vec4 areaLightFresnel; +#endif +#endif +};preLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N,vec3 posW) {preLightingInfo result;result.lightOffset=lightData.xyz-posW;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);result.L=normalize(result.lightOffset);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;} +preLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.lightDistance=length(-lightData.xyz);result.L=normalize(-lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);result.LdotV=dot(result.L,V);result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;} +preLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.NdotL=dot(N,lightData.xyz)*0.5+0.5;result.NdotL=saturateEps(result.NdotL);result.NdotLUnclamped=result.NdotL; +#ifdef SPECULARTERM +result.L=normalize(lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H)); +#endif +result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;} +#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +#include +uniform sampler2D areaLightsLTC1Sampler;uniform sampler2D areaLightsLTC2Sampler;preLightingInfo computeAreaPreLightingInfo(sampler2D ltc1,sampler2D ltc2,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec4 lightData,vec3 halfWidth,vec3 halfHeight,float roughness ) +{preLightingInfo result;result.lightOffset=lightData.xyz-vPosition;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);areaLightData data=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc2,viewDirectionW,vNormal,vPosition,lightData.xyz,halfWidth,halfHeight,roughness); +#ifdef SPECULARTERM +result.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular; +#endif +result.areaLightDiffuse=data.Diffuse;result.LdotV=0.;result.roughness=0.;result.diffuseRoughness=0.;result.surfaceAlbedo=vec3(0.);return result;} +#endif +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=D);const a="pbrDirectLightingFalloffFunctions",L=`float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range) +{return max(0.,1.0-length(lightOffset)/range);} +float computeDistanceLightFalloff_Physical(float lightDistanceSquared) +{return 1.0/maxEps(lightDistanceSquared);} +float computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange) +{float lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);float factor=lightDistanceSquared*inverseSquaredRange;float attenuation=saturate(1.0-factor*factor);attenuation*=attenuation;lightDistanceFalloff*=attenuation;return lightDistanceFalloff;} +float computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange) +{ +#ifdef USEPHYSICALLIGHTFALLOFF +return computeDistanceLightFalloff_Physical(lightDistanceSquared); +#elif defined(USEGLTFLIGHTFALLOFF) +return computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange); +#else +return computeDistanceLightFalloff_Standard(lightOffset,range); +#endif +} +float computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent) +{float falloff=0.0;float cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle) +{falloff=max(0.,pow(cosAngle,exponent));} +return falloff;} +float computeDirectionalLightFalloff_IES(vec3 lightDirection,vec3 directionToLightCenterW,sampler2D iesLightSampler) +{float cosAngle=dot(-lightDirection,directionToLightCenterW);float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;} +float computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle) +{const float kMinusLog2ConeAngleIntensityRatio=6.64385618977; +float concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);vec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);float falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;} +float computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset) +{float cd=dot(-lightDirection,directionToLightCenterW);float falloff=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;} +float computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset) +{ +#ifdef USEPHYSICALLIGHTFALLOFF +return computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle); +#elif defined(USEGLTFLIGHTFALLOFF) +return computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset); +#else +return computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent); +#endif +}`;e.IncludesShadersStore[a]||(e.IncludesShadersStore[a]=L);const n="pbrDirectLightingFunctions",A=`#define CLEARCOATREFLECTANCE90 1.0 +struct lightingInfo +{vec3 diffuse; +#ifdef SS_TRANSLUCENCY +vec3 diffuseTransmission; +#endif +#ifdef SPECULARTERM +vec3 specular; +#endif +#ifdef CLEARCOAT +vec4 clearCoat; +#endif +#ifdef SHEEN +vec3 sheen; +#endif +};float adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) { +#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF) +float lightRoughness=lightRadius/lightDistance;float totalRoughness=saturate(lightRoughness+roughness);return totalRoughness; +#else +return roughness; +#endif +} +vec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {return mix(groundColor,lightColor,info.NdotL);} +#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +vec3 computeAreaDiffuseLighting(preLightingInfo info,vec3 lightColor) {return info.areaLightDiffuse*lightColor;} +#endif +vec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {vec3 diffuseTerm=vec3(1.0/PI); +#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY +diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness)); +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY +diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness)); +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON +vec3 clampedAlbedo=clamp(info.surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo; +#endif +return diffuseTerm*info.attenuation*info.NdotL*lightColor;} +#define inline +vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix,vec3 posW){vec4 strq=textureProjectionMatrix*vec4(posW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return toLinearSpace(textureColor);} +#ifdef SS_TRANSLUCENCY +vec3 computeDiffuseTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {vec3 transmittanceNdotL=vec3(0.);float NdotL=absEps(info.NdotLUnclamped); +#ifndef SS_TRANSLUCENCY_LEGACY +if (info.NdotLUnclamped<0.0) { +#endif +float wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);float trAdapt=step(0.,info.NdotLUnclamped);transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt); +#ifndef SS_TRANSLUCENCY_LEGACY +} +vec3 diffuseTerm=vec3(1.0/PI); +#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY +diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness)); +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY +diffuseTerm=vec3(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness)); +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON +vec3 clampedAlbedo=clamp(info.surfaceAlbedo,vec3(0.1),vec3(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo; +#endif +#else +float diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness); +#endif +return diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;} +#endif +#ifdef SPECULARTERM +vec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 fresnel,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float roughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(roughness); +#ifdef IRIDESCENCE +fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity); +#endif +float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG); +#ifdef BRDF_V_HEIGHT_CORRELATED +float smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG); +#else +float smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG); +#endif +vec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;} +#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +vec3 computeAreaSpecularLighting(preLightingInfo info,vec3 specularColor,vec3 reflectance0,vec3 reflectance90) {vec3 fresnel=specularColor*info.areaLightFresnel.x*reflectance0+( vec3( 1.0 )-specularColor )*info.areaLightFresnel.y*reflectance90;return specularColor*fresnel*info.areaLightSpecular;} +#endif +#endif +#ifdef FUZZ +float evalFuzz(vec3 L,float NdotL,float NdotV,vec3 T,vec3 B,vec3 ltcLut) +{if (NdotL<=0.0 || NdotV<=0.0) +return 0.0;mat3 M=mat3( +vec3(ltcLut.r,0.0,0.0), +vec3(ltcLut.g,1.0,0.0), +vec3(0.0,0.0,1.0) +);vec3 Llocal=vec3(dot(L,T),dot(L,B),NdotL);vec3 Lwarp=normalize(M*Llocal);float cosThetaWarp=max(Lwarp.z,0.0);return cosThetaWarp*NdotL;} +#endif +#if defined(ANISOTROPIC) && defined(ANISOTROPIC_OPENPBR) +vec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float TdotH=dot(T,info.H);float BdotH=dot(B,info.H);float TdotV=dot(T,V);float BdotV=dot(B,V);float TdotL=dot(T,info.L);float BdotL=dot(B,info.L);float alphaG=convertRoughnessToAverageSlope(info.roughness);vec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,square(geometricRoughnessFactor));float distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);float smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);vec3 specTerm=vec3(distribution*smithVisibility);return specTerm*info.attenuation*info.NdotL*lightColor;} +#elif defined(ANISOTROPIC) +vec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float TdotH=dot(T,info.H);float BdotH=dot(B,info.H);float TdotV=dot(T,V);float BdotV=dot(B,V);float TdotL=dot(T,info.L);float BdotL=dot(B,info.L);float alphaG=convertRoughnessToAverageSlope(info.roughness);vec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,square(geometricRoughnessFactor));vec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90); +#ifdef IRIDESCENCE +fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity); +#endif +float distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);float smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);vec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;} +#endif +#ifdef CLEARCOAT +vec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {float NccdotL=saturateEps(dot(Ncc,info.L));float NccdotH=saturateEps(dot(Ncc,info.H));float clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);float fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnel*=clearCoatIntensity;float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);float kelemenVisibility=visibility_Kelemen(info.VdotH);float clearCoatTerm=fresnel*distribution*kelemenVisibility;return vec4( +clearCoatTerm*info.attenuation*NccdotL*lightColor, +1.0-fresnel +);} +vec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);float NdotLRefract=saturateEps(dot(Ncc,LRefract));vec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);return absorption;} +#endif +#ifdef SHEEN +vec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float roughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(roughness);float fresnel=1.;float distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);/*#ifdef SHEEN_SOFTER +float visibility=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG); +#else */ +float visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);/* #endif */ +float sheenTerm=fresnel*distribution*visibility;return sheenTerm*info.attenuation*info.NdotL*lightColor;} +#endif +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=A);const l="pbrIBLFunctions",h=`#if defined(REFLECTION) || defined(SS_REFRACTION) +float getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {float microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;float lod=log2(microsurfaceAverageSlopeTexels);return lod;} +float getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {float lod=log2(cubeMapDimensionPixels)*roughness;return lod;} +#endif +#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION) +float environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {float temp=NdotVUnclamped+ambientOcclusion;return saturate(square(temp)-1.0+ambientOcclusion);} +#endif +#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION) +float environmentHorizonOcclusion(vec3 view,vec3 normal,vec3 geometricNormal) {vec3 reflection=reflect(view,normal);float temp=saturate(1.0+1.1*dot(reflection,geometricNormal));return square(temp);} +#endif +#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA) +#define UNPACK_LOD(x) (1.0-x)*255.0 +float getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {float microsurfaceAverageSlope=alphaG;microsurfaceAverageSlope*=sqrt(abs(NdotV));return getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);} +#endif +`;e.IncludesShadersStore[l]||(e.IncludesShadersStore[l]=h);const f="pbrBlockNormalGeometric",C=`vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW); +#ifdef NORMAL +vec3 normalW=normalize(vNormalW); +#else +vec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w; +#endif +vec3 geometricNormalW=normalW; +#if defined(TWOSIDEDLIGHTING) && defined(NORMAL) +geometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW; +#endif +`;e.IncludesShadersStore[f]||(e.IncludesShadersStore[f]=C);const c="pbrBlockImageProcessing",S=`#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING) +#if !defined(SKIPFINALCOLORCLAMP) +finalColor.rgb=clamp(finalColor.rgb,0.,30.0); +#endif +#else +finalColor=applyImageProcessing(finalColor); +#endif +finalColor.a*=visibility; +#ifdef PREMULTIPLYALPHA +finalColor.rgb*=finalColor.a; +#endif +`;e.IncludesShadersStore[c]||(e.IncludesShadersStore[c]=S);const s="pbrBlockPrePass",v=`#if SCENE_MRT_COUNT>0 +float writeGeometryInfo=finalColor.a>ALPHATESTVALUE ? 1.0 : 0.0; +#ifdef PREPASS_POSITION +gl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo); +#endif +#ifdef PREPASS_LOCAL_POSITION +gl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo); +#endif +#if defined(PREPASS_VELOCITY) +vec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo); +#elif defined(PREPASS_VELOCITY_LINEAR) +vec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_ALBEDO +gl_FragData[PREPASS_ALBEDO_INDEX]=vec4(surfaceAlbedo,writeGeometryInfo); +#endif +#ifdef PREPASS_ALBEDO_SQRT +vec3 sqAlbedo=sqrt(surfaceAlbedo); +#endif +#ifdef PREPASS_IRRADIANCE +vec3 irradiance=finalDiffuse; +#ifndef UNLIT +#ifdef REFLECTION +irradiance+=finalIrradiance; +#endif +#endif +#ifdef SS_SCATTERING +#ifdef PREPASS_COLOR +gl_FragData[PREPASS_COLOR_INDEX]=vec4(finalColor.rgb-irradiance,finalColor.a); +#endif +irradiance/=sqAlbedo; +#else +#ifdef PREPASS_COLOR +gl_FragData[PREPASS_COLOR_INDEX]=finalColor; +#endif +float scatteringDiffusionProfile=255.; +#endif +gl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(clamp(irradiance,vec3(0.),vec3(1.)),writeGeometryInfo*scatteringDiffusionProfile/255.); +#elif defined(PREPASS_COLOR) +gl_FragData[PREPASS_COLOR_INDEX]=vec4(finalColor.rgb,finalColor.a); +#endif +#ifdef PREPASS_DEPTH +gl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_SCREENSPACE_DEPTH +gl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_NORMALIZED_VIEW_DEPTH +gl_FragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4(vNormViewDepth,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_NORMAL +#ifdef PREPASS_NORMAL_WORLDSPACE +gl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo); +#else +gl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo); +#endif +#endif +#ifdef PREPASS_WORLD_NORMAL +gl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo); +#endif +#ifdef PREPASS_ALBEDO_SQRT +gl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqAlbedo,writeGeometryInfo); +#endif +#ifdef PREPASS_REFLECTIVITY +#ifndef UNLIT +gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(specularEnvironmentR0,microSurface)*writeGeometryInfo; +#else +gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4( 0.0,0.0,0.0,1.0 )*writeGeometryInfo; +#endif +#endif +#endif +`;e.IncludesShadersStore[s]||(e.IncludesShadersStore[s]=v);const d="pbrDebug",O=`#if DEBUGMODE>0 +if (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) { +#if DEBUGMODE==1 +gl_FragColor.rgb=vPositionW.rgb; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==2 && defined(NORMAL) +gl_FragColor.rgb=vNormalW.rgb; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC) +gl_FragColor.rgb=TBN[0]; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC) +gl_FragColor.rgb=TBN[1]; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==5 +gl_FragColor.rgb=normalW; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==6 && defined(MAINUV1) +gl_FragColor.rgb=vec3(vMainUV1,0.0); +#elif DEBUGMODE==7 && defined(MAINUV2) +gl_FragColor.rgb=vec3(vMainUV2,0.0); +#elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP) +gl_FragColor.rgb=clearcoatOut.TBNClearCoat[0]; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP) +gl_FragColor.rgb=clearcoatOut.TBNClearCoat[1]; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==10 && defined(CLEARCOAT) +gl_FragColor.rgb=clearcoatOut.clearCoatNormalW; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==11 && defined(ANISOTROPIC) +gl_FragColor.rgb=anisotropicOut.anisotropicNormal; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==12 && defined(ANISOTROPIC) +gl_FragColor.rgb=anisotropicOut.anisotropicTangent; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==13 && defined(ANISOTROPIC) +gl_FragColor.rgb=anisotropicOut.anisotropicBitangent; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==20 && defined(ALBEDO) +gl_FragColor.rgb=albedoTexture.rgb; +#ifndef GAMMAALBEDO +#define DEBUGMODE_GAMMA +#endif +#elif DEBUGMODE==21 && defined(AMBIENT) +gl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb; +#elif DEBUGMODE==22 && defined(OPACITY) +gl_FragColor.rgb=opacityMap.rgb; +#elif DEBUGMODE==23 && defined(EMISSIVE) +gl_FragColor.rgb=emissiveColorTex.rgb; +#ifndef GAMMAEMISSIVE +#define DEBUGMODE_GAMMA +#endif +#elif DEBUGMODE==24 && defined(LIGHTMAP) +gl_FragColor.rgb=lightmapColor.rgb; +#ifndef GAMMALIGHTMAP +#define DEBUGMODE_GAMMA +#endif +#elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW) +gl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb; +#elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW) +gl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE) +gl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0); +#elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE) +gl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb; +#elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE) +gl_FragColor.rgb=sheenOut.sheenMapData.rgb; +#elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE) +gl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb; +#elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE) +gl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb; +#elif DEBUGMODE==32 && defined(BUMP) +gl_FragColor.rgb=texture2D(bumpSampler,vBumpUV).rgb; +#elif DEBUGMODE==40 && defined(SS_REFRACTION) +gl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==41 && defined(REFLECTION) +gl_FragColor.rgb=reflectionOut.environmentRadiance.rgb; +#ifndef GAMMAREFLECTION +#define DEBUGMODE_GAMMA +#endif +#elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION) +gl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==50 +gl_FragColor.rgb=diffuseBase.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==51 && defined(SPECULARTERM) +gl_FragColor.rgb=specularBase.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==52 && defined(CLEARCOAT) +gl_FragColor.rgb=clearCoatBase.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==53 && defined(SHEEN) +gl_FragColor.rgb=sheenBase.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==54 && defined(REFLECTION) +gl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb; +#ifndef GAMMAREFLECTION +#define DEBUGMODE_GAMMA +#endif +#elif DEBUGMODE==60 +gl_FragColor.rgb=surfaceAlbedo.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==61 +gl_FragColor.rgb=clearcoatOut.specularEnvironmentR0; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==62 && defined(METALLICWORKFLOW) +gl_FragColor.rgb=vec3(reflectivityOut.metallic); +#elif DEBUGMODE==71 && defined(METALLICWORKFLOW) +gl_FragColor.rgb=reflectivityOut.metallicF0; +#elif DEBUGMODE==63 +gl_FragColor.rgb=vec3(roughness); +#elif DEBUGMODE==64 +gl_FragColor.rgb=vec3(alphaG); +#elif DEBUGMODE==65 +gl_FragColor.rgb=vec3(NdotV); +#elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) +gl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==67 && defined(CLEARCOAT) +gl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness); +#elif DEBUGMODE==68 && defined(CLEARCOAT) +gl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV); +#elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY) +gl_FragColor.rgb=subSurfaceOut.transmittance; +#elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION) +gl_FragColor.rgb=subSurfaceOut.refractionTransmittance; +#elif DEBUGMODE==72 +gl_FragColor.rgb=vec3(microSurface); +#elif DEBUGMODE==73 +gl_FragColor.rgb=vAlbedoColor.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==74 && !defined(METALLICWORKFLOW) +gl_FragColor.rgb=vReflectivityColor.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==75 +gl_FragColor.rgb=vEmissiveColor.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION) +gl_FragColor.rgb=vec3(seo); +#elif DEBUGMODE==81 && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D) +gl_FragColor.rgb=vec3(eho); +#elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION) +gl_FragColor.rgb=vec3(energyConservationFactor); +#elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX) +gl_FragColor.rgb=baseSpecularEnvironmentReflectance; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX) +gl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION) +gl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==86 && defined(ALPHABLEND) +gl_FragColor.rgb=vec3(luminanceOverAlpha); +#elif DEBUGMODE==87 +gl_FragColor.rgb=vec3(alpha); +#elif DEBUGMODE==88 && defined(ALBEDO) +gl_FragColor.rgb=vec3(albedoTexture.a); +#elif DEBUGMODE==89 +gl_FragColor.rgb=aoOut.ambientOcclusionColor.rgb; +#else +float stripeWidth=30.;float stripePos=floor(gl_FragCoord.x/stripeWidth);float whichColor=mod(stripePos,2.);vec3 color1=vec3(.6,.2,.2);vec3 color2=vec3(.3,.1,.1);gl_FragColor.rgb=mix(color1,color2,whichColor); +#endif +gl_FragColor.rgb*=vDebugMode.y; +#ifdef DEBUGMODE_NORMALIZE +gl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5; +#endif +#ifdef DEBUGMODE_GAMMA +gl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb); +#endif +gl_FragColor.a=1.0; +#ifdef PREPASS +gl_FragData[0]=toLinearSpace(gl_FragColor); +gl_FragData[1]=vec4(0.,0.,0.,0.); +#endif +#ifdef DEBUGMODE_FORCERETURN +return; +#endif +} +#endif +`;e.IncludesShadersStore[d]||(e.IncludesShadersStore[d]=O); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrDebug-FlFed75Q.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrDebug-FlFed75Q.js new file mode 100644 index 0000000000000000000000000000000000000000..c367097f822e97439018a24fb5d7324e1340c596 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrDebug-FlFed75Q.js @@ -0,0 +1,669 @@ +import{S as e}from"./index-CDrXokXW.js";import"./mainUVVaryingDeclaration-gz09aLXv.js";import"./shadowsFragmentFunctions-CTsFFgyf.js";const i="pbrFragmentExtraDeclaration",E=`varying vPositionW: vec3f; +#if DEBUGMODE>0 +varying vClipSpacePosition: vec4f; +#endif +#include[1..7] +#ifdef NORMAL +varying vNormalW: vec3f; +#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX) +varying vEnvironmentIrradiance: vec3f; +#endif +#endif +#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +varying vColor: vec4f; +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +varying vViewDepth: f32; +#endif +`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=E);const t="subSurfaceScatteringFunctions",g=`fn testLightingForSSS(diffusionProfile: f32)->bool +{return diffusionProfile<1.;}`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=g);const f="pbrHelperFunctions",v=`#define MINIMUMVARIANCE 0.0005 +fn convertRoughnessToAverageSlope(roughness: f32)->f32 +{return roughness*roughness+MINIMUMVARIANCE;} +fn fresnelGrazingReflectance(reflectance0: f32)->f32 {var reflectance90: f32=saturate(reflectance0*25.0);return reflectance90;} +fn getAARoughnessFactors(normalVector: vec3f)->vec2f { +#ifdef SPECULARAA +var nDfdx: vec3f=dpdx(normalVector.xyz);var nDfdy: vec3f=dpdy(normalVector.xyz);var slopeSquare: f32=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));var geometricRoughnessFactor: f32=pow(saturate(slopeSquare),0.333);var geometricAlphaGFactor: f32=sqrt(slopeSquare);geometricAlphaGFactor*=0.75;return vec2f(geometricRoughnessFactor,geometricAlphaGFactor); +#else +return vec2f(0.); +#endif +} +#ifdef ANISOTROPIC +#ifdef ANISOTROPIC_LEGACY +fn getAnisotropicRoughness(alphaG: f32,anisotropy: f32)->vec2f {var alphaT: f32=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);var alphaB: f32=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);return vec2f(alphaT,alphaB);} +fn getAnisotropicBentNormals(T: vec3f,B: vec3f,N: vec3f,V: vec3f,anisotropy: f32,roughness: f32)->vec3f {var anisotropicFrameDirection: vec3f=select(T,B,anisotropy>=0.0);var anisotropicFrameTangent: vec3f=cross(normalize(anisotropicFrameDirection),V);var anisotropicFrameNormal: vec3f=cross(anisotropicFrameTangent,anisotropicFrameDirection);var anisotropicNormal: vec3f=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));return anisotropicNormal;} +#elif ANISOTROPIC_OPENPBR +fn getAnisotropicRoughness(alphaG: f32,anisotropy: f32)->vec2f {var alphaT: f32=alphaG*sqrt(2.0/(1.0+(1.0-anisotropy)*(1.0-anisotropy)));var alphaB: f32=max(alphaT*(1.0-anisotropy),MINIMUMVARIANCE);return vec2f(alphaT,alphaB);} +#else +fn getAnisotropicRoughness(alphaG: f32,anisotropy: f32)->vec2f {var alphaT: f32=max(mix(alphaG,1.0,anisotropy*anisotropy),MINIMUMVARIANCE);var alphaB: f32=max(alphaG,MINIMUMVARIANCE);return vec2f(alphaT,alphaB);} +fn getAnisotropicBentNormals(T: vec3f,B: vec3f,N: vec3f,V: vec3f,anisotropy: f32,roughness: f32)->vec3f {var bentNormal: vec3f=cross(B,V);bentNormal=normalize(cross(bentNormal,B));var sq=1.0-anisotropy*(1.0-roughness);var a: f32=sq*sq*sq*sq;bentNormal=normalize(mix(bentNormal,N,a));return bentNormal;} +#endif +#endif +#if defined(CLEARCOAT) || defined(SS_REFRACTION) +fn cocaLambertVec3(alpha: vec3f,distance: f32)->vec3f {return exp(-alpha*distance);} +fn cocaLambert(NdotVRefract: f32,NdotLRefract: f32,alpha: vec3f,thickness: f32)->vec3f {return cocaLambertVec3(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));} +fn computeColorAtDistanceInMedia(color: vec3f,distance: f32)->vec3f {return -log(color)/distance;} +fn computeClearCoatAbsorption(NdotVRefract: f32,NdotLRefract: f32,clearCoatColor: vec3f,clearCoatThickness: f32,clearCoatIntensity: f32)->vec3f {var clearCoatAbsorption: vec3f=mix( vec3f(1.0), +cocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness), +clearCoatIntensity);return clearCoatAbsorption;} +#endif +#ifdef MICROSURFACEAUTOMATIC +fn computeDefaultMicroSurface(microSurface: f32,reflectivityColor: vec3f)->f32 +{const kReflectivityNoAlphaWorkflow_SmoothnessMax: f32=0.95;var reflectivityLuminance: f32=getLuminance(reflectivityColor);var reflectivityLuma: f32=sqrt(reflectivityLuminance);var resultMicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;return resultMicroSurface;} +#endif +`;e.IncludesShadersStoreWGSL[f]||(e.IncludesShadersStoreWGSL[f]=v);const r="pbrDirectLightingSetupFunctions",L=`struct preLightingInfo +{lightOffset: vec3f, +lightDistanceSquared: f32, +lightDistance: f32, +attenuation: f32, +L: vec3f, +H: vec3f, +NdotV: f32, +NdotLUnclamped: f32, +NdotL: f32, +VdotH: f32, +LdotV: f32, +roughness: f32, +diffuseRoughness: f32, +surfaceAlbedo: vec3f, +#ifdef IRIDESCENCE +iridescenceIntensity: f32 +#endif +#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +areaLightDiffuse: vec3f, +#ifdef SPECULARTERM +areaLightSpecular: vec3f, +areaLightFresnel: vec4f +#endif +#endif +};fn computePointAndSpotPreLightingInfo(lightData: vec4f,V: vec3f,N: vec3f,posW: vec3f)->preLightingInfo {var result: preLightingInfo;result.lightOffset=lightData.xyz-posW;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);result.L=normalize(result.lightOffset);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);return result;} +fn computeDirectionalPreLightingInfo(lightData: vec4f,V: vec3f,N: vec3f)->preLightingInfo {var result: preLightingInfo;result.lightDistance=length(-lightData.xyz);result.L=normalize(-lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);result.LdotV=dot(result.L,V);return result;} +fn computeHemisphericPreLightingInfo(lightData: vec4f,V: vec3f,N: vec3f)->preLightingInfo {var result: preLightingInfo;result.NdotL=dot(N,lightData.xyz)*0.5+0.5;result.NdotL=saturateEps(result.NdotL);result.NdotLUnclamped=result.NdotL; +#ifdef SPECULARTERM +result.L=normalize(lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H)); +#endif +return result;} +#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +#include +var areaLightsLTC1SamplerSampler: sampler;var areaLightsLTC1Sampler: texture_2d;var areaLightsLTC2SamplerSampler: sampler;var areaLightsLTC2Sampler: texture_2d;fn computeAreaPreLightingInfo(ltc1: texture_2d,ltc1Sampler:sampler,ltc2:texture_2d,ltc2Sampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightCenter:vec3f,halfWidth:vec3f, halfHeight:vec3f,roughness:f32)->preLightingInfo {var result: preLightingInfo;var data: areaLightData=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc1Sampler,ltc2,ltc2Sampler,viewDirectionW,vNormal,vPosition,lightCenter,halfWidth,halfHeight,roughness); +#ifdef SPECULARTERM +result.areaLightFresnel=data.Fresnel;result.areaLightSpecular=data.Specular; +#endif +result.areaLightDiffuse+=data.Diffuse;return result;} +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=L);const o="pbrDirectLightingFalloffFunctions",h=`fn computeDistanceLightFalloff_Standard(lightOffset: vec3f,range: f32)->f32 +{return max(0.,1.0-length(lightOffset)/range);} +fn computeDistanceLightFalloff_Physical(lightDistanceSquared: f32)->f32 +{return 1.0/maxEps(lightDistanceSquared);} +fn computeDistanceLightFalloff_GLTF(lightDistanceSquared: f32,inverseSquaredRange: f32)->f32 +{var lightDistanceFalloff: f32=1.0/maxEps(lightDistanceSquared);var factor: f32=lightDistanceSquared*inverseSquaredRange;var attenuation: f32=saturate(1.0-factor*factor);attenuation*=attenuation;lightDistanceFalloff*=attenuation;return lightDistanceFalloff;} +fn computeDirectionalLightFalloff_IES(lightDirection: vec3f,directionToLightCenterW: vec3f,iesLightTexture: texture_2d,iesLightTextureSampler: sampler)->f32 +{var cosAngle: f32=dot(-lightDirection,directionToLightCenterW);var angle=acos(cosAngle)/PI;return textureSampleLevel(iesLightTexture,iesLightTextureSampler,vec2f(angle,0),0.).r;} +fn computeDistanceLightFalloff(lightOffset: vec3f,lightDistanceSquared: f32,range: f32,inverseSquaredRange: f32)->f32 +{ +#ifdef USEPHYSICALLIGHTFALLOFF +return computeDistanceLightFalloff_Physical(lightDistanceSquared); +#elif defined(USEGLTFLIGHTFALLOFF) +return computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange); +#else +return computeDistanceLightFalloff_Standard(lightOffset,range); +#endif +} +fn computeDirectionalLightFalloff_Standard(lightDirection: vec3f,directionToLightCenterW: vec3f,cosHalfAngle: f32,exponent: f32)->f32 +{var falloff: f32=0.0;var cosAngle: f32=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle) +{falloff=max(0.,pow(cosAngle,exponent));} +return falloff;} +fn computeDirectionalLightFalloff_Physical(lightDirection: vec3f,directionToLightCenterW: vec3f,cosHalfAngle: f32)->f32 +{const kMinusLog2ConeAngleIntensityRatio: f32=6.64385618977; +var concentrationKappa: f32=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);var lightDirectionSpreadSG: vec4f= vec4f(-lightDirection*concentrationKappa,-concentrationKappa);var falloff: f32=exp2(dot( vec4f(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;} +fn computeDirectionalLightFalloff_GLTF(lightDirection: vec3f,directionToLightCenterW: vec3f,lightAngleScale: f32,lightAngleOffset: f32)->f32 +{var cd: f32=dot(-lightDirection,directionToLightCenterW);var falloff: f32=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;} +fn computeDirectionalLightFalloff(lightDirection: vec3f,directionToLightCenterW: vec3f,cosHalfAngle: f32,exponent: f32,lightAngleScale: f32,lightAngleOffset: f32)->f32 +{ +#ifdef USEPHYSICALLIGHTFALLOFF +return computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle); +#elif defined(USEGLTFLIGHTFALLOFF) +return computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset); +#else +return computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent); +#endif +}`;e.IncludesShadersStoreWGSL[o]||(e.IncludesShadersStoreWGSL[o]=h);const n="pbrBlockReflectance0",p=`var reflectanceF0: f32=reflectivityOut.reflectanceF0;var specularEnvironmentR0: vec3f=reflectivityOut.colorReflectanceF0;var specularEnvironmentR90: vec3f= reflectivityOut.reflectanceF90; +#ifdef ALPHAFRESNEL +var reflectance90: f32=fresnelGrazingReflectance(reflectanceF0);specularEnvironmentR90=specularEnvironmentR90*reflectance90; +#endif +`;e.IncludesShadersStoreWGSL[n]||(e.IncludesShadersStoreWGSL[n]=p);const a="pbrDirectLightingFunctions",D=`#define CLEARCOATREFLECTANCE90 1.0 +struct lightingInfo +{diffuse: vec3f, +#ifdef SS_TRANSLUCENCY +diffuseTransmission: vec3f, +#endif +#ifdef SPECULARTERM +specular: vec3f, +#endif +#ifdef CLEARCOAT +clearCoat: vec4f, +#endif +#ifdef SHEEN +sheen: vec3f +#endif +};fn adjustRoughnessFromLightProperties(roughness: f32,lightRadius: f32,lightDistance: f32)->f32 { +#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF) +var lightRoughness: f32=lightRadius/lightDistance;var totalRoughness: f32=saturate(lightRoughness+roughness);return totalRoughness; +#else +return roughness; +#endif +} +fn computeHemisphericDiffuseLighting(info: preLightingInfo,lightColor: vec3f,groundColor: vec3f)->vec3f {return mix(groundColor,lightColor,info.NdotL);} +#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +fn computeAreaDiffuseLighting(info: preLightingInfo,lightColor: vec3f)->vec3f {return info.areaLightDiffuse*lightColor;} +#endif +fn computeDiffuseLighting(info: preLightingInfo,lightColor: vec3f)->vec3f {var diffuseTerm: vec3f=vec3f(1.0/PI); +#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY +diffuseTerm=vec3f(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness)); +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY +diffuseTerm=vec3f(diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness)); +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON +var clampedAlbedo: vec3f=clamp(info.surfaceAlbedo,vec3f(0.1),vec3f(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness,info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo; +#endif +return diffuseTerm*info.attenuation*info.NdotL*lightColor;} +fn computeProjectionTextureDiffuseLighting(projectionLightTexture: texture_2d,projectionLightSampler: sampler,textureProjectionMatrix: mat4x4f,posW: vec3f)->vec3f{var strq: vec4f=textureProjectionMatrix* vec4f(posW,1.0);strq/=strq.w;var textureColor: vec3f=textureSample(projectionLightTexture,projectionLightSampler,strq.xy).rgb;return toLinearSpaceVec3(textureColor);} +#ifdef SS_TRANSLUCENCY +fn computeDiffuseTransmittedLighting(info: preLightingInfo,lightColor: vec3f,transmittance: vec3f)->vec3f {var transmittanceNdotL=vec3f(0.0);var NdotL: f32=absEps(info.NdotLUnclamped); +#ifndef SS_TRANSLUCENCY_LEGACY +if (info.NdotLUnclamped<0.0) { +#endif +var wrapNdotL: f32=computeWrappedDiffuseNdotL(NdotL,0.02);var trAdapt: f32=step(0.,info.NdotLUnclamped);transmittanceNdotL=mix(transmittance*wrapNdotL, vec3f(wrapNdotL),trAdapt); +#ifndef SS_TRANSLUCENCY_LEGACY +} +var diffuseTerm : vec3f=vec3f(1.0/PI); +#if BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_LEGACY +diffuseTerm=vec3f(diffuseBRDF_Burley( +info.NdotL,info.NdotV,info.VdotH,info.roughness)); +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_BURLEY +diffuseTerm=vec3f(diffuseBRDF_Burley( +info.NdotL,info.NdotV,info.VdotH,info.diffuseRoughness)); +#elif BASE_DIFFUSE_MODEL==BRDF_DIFFUSE_MODEL_EON +var clampedAlbedo: vec3f=clamp(info.surfaceAlbedo,vec3f(0.1),vec3f(1.0));diffuseTerm=diffuseBRDF_EON(clampedAlbedo,info.diffuseRoughness, +info.NdotL,info.NdotV,info.LdotV);diffuseTerm/=clampedAlbedo; +#endif +return (transmittanceNdotL*diffuseTerm)*info.attenuation*lightColor; +#else +let diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);return diffuseTerm*transmittanceNdotL*info.attenuation*lightColor; +#endif +} +#endif +#ifdef SPECULARTERM +fn computeSpecularLighting(info: preLightingInfo,N: vec3f,reflectance0: vec3f,fresnel: vec3f,geometricRoughnessFactor: f32,lightColor: vec3f)->vec3f {var NdotH: f32=saturateEps(dot(N,info.H));var roughness: f32=max(info.roughness,geometricRoughnessFactor);var alphaG: f32=convertRoughnessToAverageSlope(roughness);var modifiedFresnel: vec3f=fresnel; +#ifdef IRIDESCENCE +modifiedFresnel=mix(fresnel,reflectance0,info.iridescenceIntensity); +#endif +var distribution: f32=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG); +#ifdef BRDF_V_HEIGHT_CORRELATED +var smithVisibility: f32=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG); +#else +var smithVisibility: f32=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG); +#endif +var specTerm: vec3f=modifiedFresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;} +#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +fn computeAreaSpecularLighting(info: preLightingInfo,specularColor: vec3f,reflectance0: vec3f,reflectance90: vec3f)->vec3f {var fresnel:vec3f =reflectance0*specularColor*info.areaLightFresnel.x+( vec3f( 1.0 )-specularColor )*info.areaLightFresnel.y*reflectance90;return specularColor*fresnel*info.areaLightSpecular;} +#endif +#endif +#ifdef FUZZ +fn evalFuzz(L: vec3f,NdotL: f32,NdotV: f32,T: vec3f,B: vec3f,ltcLut: vec3f)->f32 +{if (NdotL<=0.0f || NdotV<=0.0f) {return 0.0f;} +let M=mat3x3f( +vec3f(ltcLut.r,0.0f,0.0f), +vec3f(ltcLut.g,1.0f,0.0f), +vec3f(0.0f,0.0f,1.0f) +);let Llocal: vec3f=vec3f(dot(L,T),dot(L,B),NdotL);let Lwarp: vec3f=normalize(M*Llocal);let cosThetaWarp: f32=max(Lwarp.z,0.0f);return cosThetaWarp*NdotL;} +#endif +#if defined(ANISOTROPIC) && defined(ANISOTROPIC_OPENPBR) +fn computeAnisotropicSpecularLighting(info: preLightingInfo,V: vec3f,N: vec3f,T: vec3f,B: vec3f,anisotropy: f32,geometricRoughnessFactor: f32,lightColor: vec3f)->vec3f {var NdotH: f32=saturateEps(dot(N,info.H));var TdotH: f32=dot(T,info.H);var BdotH: f32=dot(B,info.H);var TdotV: f32=dot(T,V);var BdotV: f32=dot(B,V);var TdotL: f32=dot(T,info.L);var BdotL: f32=dot(B,info.L);var alphaG: f32=convertRoughnessToAverageSlope(info.roughness);var alphaTB: vec2f=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,vec2f(geometricRoughnessFactor*geometricRoughnessFactor));var distribution: f32=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);var smithVisibility: f32=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);var specTerm: vec3f=vec3f(distribution*smithVisibility);return specTerm*info.attenuation*info.NdotL*lightColor;} +#elif defined(ANISOTROPIC) +fn computeAnisotropicSpecularLighting(info: preLightingInfo,V: vec3f,N: vec3f,T: vec3f,B: vec3f,anisotropy: f32,reflectance0: vec3f,reflectance90: vec3f,geometricRoughnessFactor: f32,lightColor: vec3f)->vec3f {var NdotH: f32=saturateEps(dot(N,info.H));var TdotH: f32=dot(T,info.H);var BdotH: f32=dot(B,info.H);var TdotV: f32=dot(T,V);var BdotV: f32=dot(B,V);var TdotL: f32=dot(T,info.L);var BdotL: f32=dot(B,info.L);var alphaG: f32=convertRoughnessToAverageSlope(info.roughness);var alphaTB: vec2f=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,vec2f(geometricRoughnessFactor*geometricRoughnessFactor));var fresnel: vec3f=fresnelSchlickGGXVec3(info.VdotH,reflectance0,reflectance90); +#ifdef IRIDESCENCE +fresnel=mix(fresnel,reflectance0,info.iridescenceIntensity); +#endif +var distribution: f32=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);var smithVisibility: f32=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);var specTerm: vec3f=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;} +#endif +#ifdef CLEARCOAT +fn computeClearCoatLighting(info: preLightingInfo,Ncc: vec3f,geometricRoughnessFactor: f32,clearCoatIntensity: f32,lightColor: vec3f)->vec4f {var NccdotL: f32=saturateEps(dot(Ncc,info.L));var NccdotH: f32=saturateEps(dot(Ncc,info.H));var clearCoatRoughness: f32=max(info.roughness,geometricRoughnessFactor);var alphaG: f32=convertRoughnessToAverageSlope(clearCoatRoughness);var fresnel: f32=fresnelSchlickGGX(info.VdotH,uniforms.vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnel*=clearCoatIntensity;var distribution: f32=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);var kelemenVisibility: f32=visibility_Kelemen(info.VdotH);var clearCoatTerm: f32=fresnel*distribution*kelemenVisibility;return vec4f( +clearCoatTerm*info.attenuation*NccdotL*lightColor, +1.0-fresnel +);} +fn computeClearCoatLightingAbsorption(NdotVRefract: f32,L: vec3f,Ncc: vec3f,clearCoatColor: vec3f,clearCoatThickness: f32,clearCoatIntensity: f32)->vec3f {var LRefract: vec3f=-refract(L,Ncc,uniforms.vClearCoatRefractionParams.y);var NdotLRefract: f32=saturateEps(dot(Ncc,LRefract));var absorption: vec3f=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);return absorption;} +#endif +#ifdef SHEEN +fn computeSheenLighting(info: preLightingInfo,N: vec3f,reflectance0: vec3f,reflectance90: vec3f,geometricRoughnessFactor: f32,lightColor: vec3f)->vec3f {var NdotH: f32=saturateEps(dot(N,info.H));var roughness: f32=max(info.roughness,geometricRoughnessFactor);var alphaG: f32=convertRoughnessToAverageSlope(roughness);var fresnel: f32=1.;var distribution: f32=normalDistributionFunction_CharlieSheen(NdotH,alphaG);/*#ifdef SHEEN_SOFTER +var visibility: f32=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG); +#else */ +var visibility: f32=visibility_Ashikhmin(info.NdotL,info.NdotV);/* #endif */ +var sheenTerm: f32=fresnel*distribution*visibility;return sheenTerm*info.attenuation*info.NdotL*lightColor;} +#endif +#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 +#include +fn computeClusteredLighting( +lightDataTexture: texture_2d, +tileMaskBuffer: ptr>, +lightData: vec4f, +sliceRange: vec2u, +V: vec3f, +N: vec3f, +posW: vec3f, +surfaceAlbedo: vec3f, +reflectivityOut: reflectivityOutParams, +#ifdef IRIDESCENCE +iridescenceIntensity: f32, +#endif +#ifdef SS_TRANSLUCENCY +subSurfaceOut: subSurfaceOutParams, +#endif +#ifdef SPECULARTERM +AARoughnessFactor: f32, +#endif +#ifdef ANISOTROPIC +anisotropicOut: anisotropicOutParams, +#endif +#ifdef SHEEN +sheenOut: sheenOutParams, +#endif +#ifdef CLEARCOAT +clearcoatOut: clearcoatOutParams, +#endif +)->lightingInfo {let NdotV=absEps(dot(N,V)); +#include +#ifdef CLEARCOAT +specularEnvironmentR0=clearcoatOut.specularEnvironmentR0; +#endif +var result: lightingInfo;let tilePosition=vec2u(fragmentInputs.position.xy*lightData.xy);let maskResolution=vec2u(lightData.zw);var tileIndex=(tilePosition.x*maskResolution.x+tilePosition.y)*maskResolution.y;let batchRange=sliceRange/CLUSTLIGHT_BATCH;var batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tileIndex+=batchRange.x;for (var i=batchRange.x; i<=batchRange.y; i+=1) {var mask=tileMaskBuffer[tileIndex];tileIndex+=1;let maskOffset=max(sliceRange.x,batchOffset)-batchOffset; +let maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while mask != 0 {let trailing=firstTrailingBit(mask);mask ^= 1u<=0.0 {preInfo.attenuation*=computeDirectionalLightFalloff(light.vLightDirection.xyz,preInfo.L,light.vLightDirection.w,light.vLightData.w,light.vLightFalloff.z,light.vLightFalloff.w);} +preInfo.roughness=adjustRoughnessFromLightProperties(reflectivityOut.roughness,light.vLightSpecular.a,preInfo.lightDistance);preInfo.diffuseRoughness=reflectivityOut.diffuseRoughness;preInfo.surfaceAlbedo=surfaceAlbedo; +#ifdef IRIDESCENCE +preInfo.iridescenceIntensity=iridescenceIntensity; +#endif +var info: lightingInfo; +#ifdef SS_TRANSLUCENCY +#ifdef SS_TRANSLUCENCY_LEGACY +info.diffuse=computeDiffuseTransmittedLighting(preInfo,light.vLightDiffuse.rgb,subSurfaceOut.transmittance);info.diffuseTransmission=vec3(0); +#else +info.diffuse=computeDiffuseLighting(preInfo,light.vLightDiffuse.rgb)*(1.0-subSurfaceOut.translucencyIntensity);info.diffuseTransmission=computeDiffuseTransmittedLighting(preInfo,light.vLightDiffuse.rgb,subSurfaceOut.transmittance); +#endif +#else +info.diffuse=computeDiffuseLighting(preInfo,light.vLightDiffuse.rgb); +#endif +#ifdef SPECULARTERM +#if CONDUCTOR_SPECULAR_MODEL==CONDUCTOR_SPECULAR_MODEL_OPENPBR +let metalFresnel=reflectivityOut.specularWeight*getF82Specular(preInfo.VdotH,specularEnvironmentR0,reflectivityOut.colorReflectanceF90,reflectivityOut.roughness);let dielectricFresnel=fresnelSchlickGGXVec3(preInfo.VdotH,reflectivityOut.dielectricColorF0,reflectivityOut.colorReflectanceF90);let coloredFresnel=mix(dielectricFresnel,metalFresnel,reflectivityOut.metallic); +#else +let coloredFresnel=fresnelSchlickGGXVec3(preInfo.VdotH,specularEnvironmentR0,reflectivityOut.colorReflectanceF90); +#endif +#ifndef LEGACY_SPECULAR_ENERGY_CONSERVATION +let NdotH=dot(N,preInfo.H);let fresnel=fresnelSchlickGGXVec3(NdotH,vec3(reflectanceF0),specularEnvironmentR90);info.diffuse*=(vec3(1.0)-fresnel); +#endif +#ifdef ANISOTROPIC +info.specular=computeAnisotropicSpecularLighting(preInfo,V,N,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactor,light.vLightDiffuse.rgb); +#else +info.specular=computeSpecularLighting(preInfo,N,specularEnvironmentR0,coloredFresnel,AARoughnessFactor,light.vLightDiffuse.rgb); +#endif +#endif +#ifdef SHEEN +#ifdef SHEEN_LINKWITHALBEDO +preInfo.roughness=sheenOut.sheenIntensity; +#else +preInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light.vLightSpecular.a,preInfo.lightDistance); +#endif +info.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactor,light.vLightDiffuse.rgb); +#endif +#ifdef CLEARCOAT +preInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light.vLightSpecular.a,preInfo.lightDistance);info.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,light.vLightDiffuse.rgb); +#ifdef CLEARCOAT_TINT +let absorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);info.diffuse*=absorption; +#ifdef SS_TRANSLUCENCY +info.diffuseTransmission*=absorption; +#endif +#ifdef SPECULARTERM +info.specular*=absorption; +#endif +#endif +info.diffuse*=info.clearCoat.w; +#ifdef SS_TRANSLUCENCY +info.diffuseTransmission*=info.clearCoat.w; +#endif +#ifdef SPECULARTERM +info.specular*=info.clearCoat.w; +#endif +#ifdef SHEEN +info.sheen*=info.clearCoat.w; +#endif +#endif +result.diffuse+=info.diffuse; +#ifdef SS_TRANSLUCENCY +result.diffuseTransmission+=info.diffuseTransmission; +#endif +#ifdef SPECULARTERM +result.specular+=info.specular; +#endif +#ifdef CLEARCOAT +result.clearCoat+=info.clearCoat; +#endif +#ifdef SHEEN +result.sheen+=info.sheen; +#endif +} +batchOffset+=CLUSTLIGHT_BATCH;} +return result;} +#endif +`;e.IncludesShadersStoreWGSL[a]||(e.IncludesShadersStoreWGSL[a]=D);const c="pbrIBLFunctions",S=`#if defined(REFLECTION) || defined(SS_REFRACTION) +fn getLodFromAlphaG(cubeMapDimensionPixels: f32,microsurfaceAverageSlope: f32)->f32 {var microsurfaceAverageSlopeTexels: f32=cubeMapDimensionPixels*microsurfaceAverageSlope;var lod: f32=log2(microsurfaceAverageSlopeTexels);return lod;} +fn getLinearLodFromRoughness(cubeMapDimensionPixels: f32,roughness: f32)->f32 {var lod: f32=log2(cubeMapDimensionPixels)*roughness;return lod;} +#endif +#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION) +fn environmentRadianceOcclusion(ambientOcclusion: f32,NdotVUnclamped: f32)->f32 {var temp: f32=NdotVUnclamped+ambientOcclusion;return saturate(temp*temp-1.0+ambientOcclusion);} +#endif +#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION) +fn environmentHorizonOcclusion(view: vec3f,normal: vec3f,geometricNormal: vec3f)->f32 {var reflection: vec3f=reflect(view,normal);var temp: f32=saturate(1.0+1.1*dot(reflection,geometricNormal));return temp*temp;} +#endif +#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA) +fn UNPACK_LOD(x: f32)->f32 {return (1.0-x)*255.0;} +fn getLodFromAlphaGNdotV(cubeMapDimensionPixels: f32,alphaG: f32,NdotV: f32)->f32 {var microsurfaceAverageSlope: f32=alphaG;microsurfaceAverageSlope*=sqrt(abs(NdotV));return getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);} +#endif +`;e.IncludesShadersStoreWGSL[c]||(e.IncludesShadersStoreWGSL[c]=S);const l="pbrBlockNormalGeometric",m=`var viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-input.vPositionW); +#ifdef NORMAL +var normalW: vec3f=normalize(input.vNormalW); +#else +var normalW: vec3f=normalize(cross(dpdx(input.vPositionW),dpdy(input.vPositionW)))*scene.vEyePosition.w; +#endif +var geometricNormalW: vec3f=normalW; +#if defined(TWOSIDEDLIGHTING) && defined(NORMAL) +geometricNormalW=select(-geometricNormalW,geometricNormalW,fragmentInputs.frontFacing); +#endif +`;e.IncludesShadersStoreWGSL[l]||(e.IncludesShadersStoreWGSL[l]=m);const s="pbrBlockImageProcessing",A=`#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING) +#if !defined(SKIPFINALCOLORCLAMP) +finalColor=vec4f(clamp(finalColor.rgb,vec3f(0.),vec3f(30.0)),finalColor.a); +#endif +#else +finalColor=applyImageProcessing(finalColor); +#endif +finalColor=vec4f(finalColor.rgb,finalColor.a*mesh.visibility); +#ifdef PREMULTIPLYALPHA +finalColor=vec4f(finalColor.rgb*finalColor.a,finalColor.a);; +#endif +`;e.IncludesShadersStoreWGSL[s]||(e.IncludesShadersStoreWGSL[s]=A);const d="pbrBlockPrePass",O=`#if SCENE_MRT_COUNT>0 +var writeGeometryInfo: f32=select(0.0,1.0,finalColor.a>ALPHATESTVALUE);var fragData: array,SCENE_MRT_COUNT>; +#ifdef PREPASS_POSITION +fragData[PREPASS_POSITION_INDEX]= vec4f(fragmentInputs.vPositionW,writeGeometryInfo); +#endif +#ifdef PREPASS_LOCAL_POSITION +fragData[PREPASS_LOCAL_POSITION_INDEX]=vec4f(fragmentInputs.vPosition,writeGeometryInfo); +#endif +#ifdef PREPASS_VELOCITY +var a: vec2f=(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w)*0.5+0.5;var b: vec2f=(fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w)*0.5+0.5;var velocity: vec2f=abs(a-b);velocity= vec2f(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;fragData[PREPASS_VELOCITY_INDEX]= vec4f(velocity,0.0,writeGeometryInfo); +#elif defined(PREPASS_VELOCITY_LINEAR) +var velocity : vec2f=vec2f(0.5)*((fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w) - +(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w));fragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4f(velocity,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_ALBEDO +fragData[PREPASS_ALBEDO_INDEX]=vec4f(surfaceAlbedo,writeGeometryInfo); +#endif +#ifdef PREPASS_ALBEDO_SQRT +var sqAlbedo : vec3f=sqrt(surfaceAlbedo); +#endif +#ifdef PREPASS_IRRADIANCE +var irradiance : vec3f=finalDiffuse; +#ifndef UNLIT +#ifdef REFLECTION +irradiance+=finalIrradiance; +#endif +#endif +#ifdef SS_SCATTERING +#ifdef PREPASS_COLOR +fragData[PREPASS_COLOR_INDEX]=vec4f(finalColor.rgb-irradiance,finalColor.a); +#endif +irradiance/=sqAlbedo;fragData[PREPASS_IRRADIANCE_INDEX]=vec4f(clamp(irradiance,vec3f(0.),vec3f(1.)),writeGeometryInfo*uniforms.scatteringDiffusionProfile/255.); +#else +#ifdef PREPASS_COLOR +fragData[PREPASS_COLOR_INDEX]=finalColor; +#endif +fragData[PREPASS_IRRADIANCE_INDEX]=vec4f(clamp(irradiance,vec3f(0.),vec3f(1.)),writeGeometryInfo); +#endif +#elif defined(PREPASS_COLOR) +fragData[PREPASS_COLOR_INDEX]=vec4f(finalColor.rgb,finalColor.a); +#endif +#ifdef PREPASS_DEPTH +fragData[PREPASS_DEPTH_INDEX]=vec4f(fragmentInputs.vViewPos.z,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_SCREENSPACE_DEPTH +fragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4f(fragmentInputs.position.z,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_NORMALIZED_VIEW_DEPTH +fragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4f(fragmentInputs.vNormViewDepth,0.0,0.0,writeGeometryInfo); +#endif +#ifdef PREPASS_NORMAL +#ifdef PREPASS_NORMAL_WORLDSPACE +fragData[PREPASS_NORMAL_INDEX]=vec4f(normalW,writeGeometryInfo); +#else +fragData[PREPASS_NORMAL_INDEX]=vec4f(normalize((scene.view*vec4f(normalW,0.0)).rgb),writeGeometryInfo); +#endif +#endif +#ifdef PREPASS_WORLD_NORMAL +fragData[PREPASS_WORLD_NORMAL_INDEX]=vec4f(normalW*0.5+0.5,writeGeometryInfo); +#endif +#ifdef PREPASS_ALBEDO_SQRT +fragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4f(sqAlbedo,writeGeometryInfo); +#endif +#ifdef PREPASS_REFLECTIVITY +#ifndef UNLIT +fragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(specularEnvironmentR0,microSurface)*writeGeometryInfo; +#else +fragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(0.0,0.0,0.0,1.0)*writeGeometryInfo; +#endif +#endif +#if SCENE_MRT_COUNT>0 +fragmentOutputs.fragData0=fragData[0]; +#endif +#if SCENE_MRT_COUNT>1 +fragmentOutputs.fragData1=fragData[1]; +#endif +#if SCENE_MRT_COUNT>2 +fragmentOutputs.fragData2=fragData[2]; +#endif +#if SCENE_MRT_COUNT>3 +fragmentOutputs.fragData3=fragData[3]; +#endif +#if SCENE_MRT_COUNT>4 +fragmentOutputs.fragData4=fragData[4]; +#endif +#if SCENE_MRT_COUNT>5 +fragmentOutputs.fragData5=fragData[5]; +#endif +#if SCENE_MRT_COUNT>6 +fragmentOutputs.fragData6=fragData[6]; +#endif +#if SCENE_MRT_COUNT>7 +fragmentOutputs.fragData7=fragData[7]; +#endif +#endif +`;e.IncludesShadersStoreWGSL[d]||(e.IncludesShadersStoreWGSL[d]=O);const u="pbrDebug",C=`#if DEBUGMODE>0 +if (input.vClipSpacePosition.x/input.vClipSpacePosition.w>=uniforms.vDebugMode.x) {var color: vec3f; +#if DEBUGMODE==1 +color=fragmentInputs.vPositionW.rgb; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==2 && defined(NORMAL) +color=fragmentInputs.vNormalW.rgb; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC) +color=TBN[0]; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC) +color=TBN[1]; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==5 +color=normalW; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==6 && defined(MAINUV1) +color= vec3f(input.vMainUV1,0.0); +#elif DEBUGMODE==7 && defined(MAINUV2) +color= vec3f(input.vMainUV2,0.0); +#elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP) +color=clearcoatOut.TBNClearCoat[0]; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP) +color=clearcoatOut.TBNClearCoat[1]; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==10 && defined(CLEARCOAT) +color=clearcoatOut.clearCoatNormalW; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==11 && defined(ANISOTROPIC) +color=anisotropicOut.anisotropicNormal; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==12 && defined(ANISOTROPIC) +color=anisotropicOut.anisotropicTangent; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==13 && defined(ANISOTROPIC) +color=anisotropicOut.anisotropicBitangent; +#define DEBUGMODE_NORMALIZE +#elif DEBUGMODE==20 && defined(ALBEDO) +color=albedoTexture.rgb; +#ifndef GAMMAALBEDO +#define DEBUGMODE_GAMMA +#endif +#elif DEBUGMODE==21 && defined(AMBIENT) +color=aoOut.ambientOcclusionColorMap.rgb; +#elif DEBUGMODE==22 && defined(OPACITY) +color=opacityMap.rgb; +#elif DEBUGMODE==23 && defined(EMISSIVE) +color=emissiveColorTex.rgb; +#ifndef GAMMAEMISSIVE +#define DEBUGMODE_GAMMA +#endif +#elif DEBUGMODE==24 && defined(LIGHTMAP) +color=lightmapColor; +#ifndef GAMMALIGHTMAP +#define DEBUGMODE_GAMMA +#endif +#elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW) +color=reflectivityOut.surfaceMetallicColorMap.rgb; +#elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW) +color=reflectivityOut.surfaceReflectivityColorMap.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE) +color= vec3f(clearcoatOut.clearCoatMapData.rg,0.0); +#elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE) +color=clearcoatOut.clearCoatTintMapData.rgb; +#elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE) +color=sheenOut.sheenMapData.rgb; +#elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE) +color=anisotropicOut.anisotropyMapData.rgb; +#elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE) +color=subSurfaceOut.thicknessMap.rgb; +#elif DEBUGMODE==32 && defined(BUMP) +color=textureSample(bumpSampler,bumpSamplerSampler,fragmentInputs.vBumpUV).rgb; +#elif DEBUGMODE==40 && defined(SS_REFRACTION) +color=subSurfaceOut.environmentRefraction.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==41 && defined(REFLECTION) +color=reflectionOut.environmentRadiance.rgb; +#ifndef GAMMAREFLECTION +#define DEBUGMODE_GAMMA +#endif +#elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION) +color=clearcoatOut.environmentClearCoatRadiance.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==50 +color=diffuseBase.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==51 && defined(SPECULARTERM) +color=specularBase.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==52 && defined(CLEARCOAT) +color=clearCoatBase.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==53 && defined(SHEEN) +color=sheenBase.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==54 && defined(REFLECTION) +color=reflectionOut.environmentIrradiance.rgb; +#ifndef GAMMAREFLECTION +#define DEBUGMODE_GAMMA +#endif +#elif DEBUGMODE==60 +color=surfaceAlbedo.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==61 +color=clearcoatOut.specularEnvironmentR0; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==62 && defined(METALLICWORKFLOW) +color= vec3f(reflectivityOut.metallic); +#elif DEBUGMODE==71 && defined(METALLICWORKFLOW) +color=reflectivityOut.metallicF0; +#elif DEBUGMODE==63 +color= vec3f(roughness); +#elif DEBUGMODE==64 +color= vec3f(alphaG); +#elif DEBUGMODE==65 +color= vec3f(NdotV); +#elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) +color=clearcoatOut.clearCoatColor; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==67 && defined(CLEARCOAT) +color= vec3f(clearcoatOut.clearCoatRoughness); +#elif DEBUGMODE==68 && defined(CLEARCOAT) +color= vec3f(clearcoatOut.clearCoatNdotV); +#elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY) +color=subSurfaceOut.transmittance; +#elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION) +color=subSurfaceOut.refractionTransmittance; +#elif DEBUGMODE==72 +color= vec3f(microSurface); +#elif DEBUGMODE==73 +color=uniforms.vAlbedoColor.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==74 && !defined(METALLICWORKFLOW) +color=uniforms.vReflectivityColor.rgb; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==75 +color=uniforms.vEmissiveColor; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION) +color= vec3f(seo); +#elif DEBUGMODE==81 && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D) +color= vec3f(eho); +#elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION) +color= vec3f(energyConservationFactor); +#elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX) +color=baseSpecularEnvironmentReflectance; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX) +color=clearcoatOut.clearCoatEnvironmentReflectance; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION) +color=sheenOut.sheenEnvironmentReflectance; +#define DEBUGMODE_GAMMA +#elif DEBUGMODE==86 && defined(ALPHABLEND) +color= vec3f(luminanceOverAlpha); +#elif DEBUGMODE==87 +color= vec3f(alpha); +#elif DEBUGMODE==88 && defined(ALBEDO) +color= vec3f(albedoTexture.a); +#elif DEBUGMODE==89 +color=aoOut.ambientOcclusionColor; +#else +var stripeWidth: f32=30.;var stripePos: f32=abs(floor(input.position.x/stripeWidth));var whichColor: f32=((stripePos)%(2.));var color1: vec3f= vec3f(.6,.2,.2);var color2: vec3f= vec3f(.3,.1,.1);color=mix(color1,color2,whichColor); +#endif +color*=uniforms.vDebugMode.y; +#ifdef DEBUGMODE_NORMALIZE +color=normalize(color)*0.5+0.5; +#endif +#ifdef DEBUGMODE_GAMMA +color=toGammaSpaceVec3(color); +#endif +fragmentOutputs.color=vec4f(color,1.0); +#ifdef PREPASS +fragmentOutputs.fragData0=toLinearSpaceVec3(color); +fragmentOutputs.fragData1=vec4f(0.,0.,0.,0.); +#endif +#ifdef DEBUGMODE_FORCERETURN +return fragmentOutputs; +#endif +} +#endif +`;e.IncludesShadersStoreWGSL[u]||(e.IncludesShadersStoreWGSL[u]=C); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrMaterialLoadingAdapter-BV-CpLvi.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrMaterialLoadingAdapter-BV-CpLvi.js new file mode 100644 index 0000000000000000000000000000000000000000..75729bc351dfce98ae4fdbf0c2b35025fa2e07da --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrMaterialLoadingAdapter-BV-CpLvi.js @@ -0,0 +1 @@ +import{aK as t,C as i}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";class u{constructor(e){this._material=e,this._material.enableSpecularAntiAliasing=!0}get material(){return this._material}get isUnlit(){return this._material.unlit}set isUnlit(e){this._material.unlit=e}set backFaceCulling(e){this._material.backFaceCulling=e}get backFaceCulling(){return this._material.backFaceCulling}set twoSidedLighting(e){this._material.twoSidedLighting=e}get twoSidedLighting(){return this._material.twoSidedLighting}set alphaCutOff(e){this._material.alphaCutOff=e}get alphaCutOff(){return this._material.alphaCutOff}set useAlphaFromBaseColorTexture(e){this._material.useAlphaFromAlbedoTexture=e}get useAlphaFromBaseColorTexture(){return this._material.useAlphaFromAlbedoTexture}get transparencyAsAlphaCoverage(){return this._material.useRadianceOverAlpha||this._material.useSpecularOverAlpha}set transparencyAsAlphaCoverage(e){this._material.useRadianceOverAlpha=!e,this._material.useSpecularOverAlpha=!e}set baseColor(e){this._material.albedoColor=e}get baseColor(){return this._material.albedoColor}set baseColorTexture(e){this._material.albedoTexture=e}get baseColorTexture(){return this._material.albedoTexture}set baseDiffuseRoughness(e){this._material.baseDiffuseRoughness=e,e>0&&(this._material.brdf.baseDiffuseModel=t.MATERIAL_DIFFUSE_MODEL_E_OREN_NAYAR)}get baseDiffuseRoughness(){return this._material.baseDiffuseRoughness??0}set baseDiffuseRoughnessTexture(e){this._material.baseDiffuseRoughnessTexture=e}get baseDiffuseRoughnessTexture(){return this._material.baseDiffuseRoughnessTexture}set baseMetalness(e){this._material.metallic=e}get baseMetalness(){return this._material.metallic??1}set baseMetalnessTexture(e){this._material.metallicTexture=e}get baseMetalnessTexture(){return this._material.metallicTexture}set useRoughnessFromMetallicTextureGreen(e){this._material.useRoughnessFromMetallicTextureGreen=e,this._material.useRoughnessFromMetallicTextureAlpha=!e}set useMetallicFromMetallicTextureBlue(e){this._material.useMetallnessFromMetallicTextureBlue=e}enableSpecularEdgeColor(e=!1){e&&(this._material.brdf.dielectricSpecularModel=t.MATERIAL_DIELECTRIC_SPECULAR_MODEL_OPENPBR,this._material.brdf.conductorSpecularModel=t.MATERIAL_CONDUCTOR_SPECULAR_MODEL_OPENPBR)}set specularWeight(e){this._material.metallicF0Factor=e}get specularWeight(){return this._material.metallicF0Factor??1}set specularWeightTexture(e){e?(this._material.metallicReflectanceTexture=e,this._material.useOnlyMetallicFromMetallicReflectanceTexture=!0):(this._material.metallicReflectanceTexture=null,this._material.useOnlyMetallicFromMetallicReflectanceTexture=!1)}get specularWeightTexture(){return this._material.metallicReflectanceTexture}set specularColor(e){this._material.metallicReflectanceColor=e}get specularColor(){return this._material.metallicReflectanceColor}set specularColorTexture(e){this._material.reflectanceTexture=e}get specularColorTexture(){return this._material.reflectanceTexture}set specularRoughness(e){this._material.roughness=e}get specularRoughness(){return this._material.roughness??1}set specularRoughnessTexture(e){this.baseMetalnessTexture||(this._material.metallicTexture=e)}get specularRoughnessTexture(){return this._material.metallicTexture}set specularIor(e){this._material.indexOfRefraction=e}get specularIor(){return this._material.indexOfRefraction}set emissionColor(e){this._material.emissiveColor=e}get emissionColor(){return this._material.emissiveColor}set emissionLuminance(e){this._material.emissiveIntensity=e}get emissionLuminance(){return this._material.emissiveIntensity}set emissionColorTexture(e){this._material.emissiveTexture=e}get emissionColorTexture(){return this._material.emissiveTexture}set ambientOcclusionTexture(e){this._material.ambientTexture=e,e&&(this._material.useAmbientInGrayScale=!0)}get ambientOcclusionTexture(){return this._material.ambientTexture}set ambientOcclusionTextureStrength(e){this._material.ambientTextureStrength=e}get ambientOcclusionTextureStrength(){return this._material.ambientTextureStrength??1}configureCoat(){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.useRoughnessFromMainTexture=!1,this._material.clearCoat.remapF0OnInterfaceChange=!1}set coatWeight(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.intensity=e}get coatWeight(){return this._material.clearCoat.intensity}set coatWeightTexture(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.texture=e}get coatWeightTexture(){return this._material.clearCoat.texture}set coatColor(e){this._material.clearCoat.isTintEnabled=e!=i.White(),this._material.clearCoat.tintColor=e}set coatColorTexture(e){this._material.clearCoat.tintTexture=e}set coatRoughness(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.roughness=e}get coatRoughness(){return this._material.clearCoat.roughness??0}set coatRoughnessTexture(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.useRoughnessFromMainTexture=!1,this._material.clearCoat.textureRoughness=e}get coatRoughnessTexture(){return this._material.clearCoat.textureRoughness}set coatIor(e){this._material.clearCoat.indexOfRefraction=e}set coatDarkening(e){}set coatDarkeningTexture(e){}set coatRoughnessAnisotropy(e){}get coatRoughnessAnisotropy(){return 0}set geometryCoatTangentAngle(e){}set geometryCoatTangentTexture(e){}get geometryCoatTangentTexture(){return null}set transmissionWeight(e){this._material.subSurface.isRefractionEnabled=e>0,this._material.subSurface.refractionIntensity=e}get transmissionWeight(){return this._material.subSurface.refractionIntensity}set transmissionWeightTexture(e){this._material.subSurface.isRefractionEnabled=!0,this._material.subSurface.refractionIntensityTexture=e,this._material.subSurface.useGltfStyleTextures=!0}set transmissionDepth(e){this._material.subSurface.tintColorAtDistance=e}set transmissionColor(e){this._material.subSurface.tintColor=e}set transmissionDispersionAbbeNumber(e){e>0?(this._material.subSurface.isDispersionEnabled=!0,this._material.subSurface.dispersion=20/e):(this._material.subSurface.isDispersionEnabled=!1,this._material.subSurface.dispersion=0)}configureTransmission(){this._material.subSurface.volumeIndexOfRefraction=1,this._material.subSurface.useAlbedoToTintRefraction=!0,this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=0}set volumeThicknessTexture(e){this._material.subSurface.thicknessTexture=e,this._material.subSurface.useGltfStyleTextures=!0}set volumeThickness(e){this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=e,this._material.subSurface.useThicknessAsDepth=!0,e>0&&(this._material.subSurface.volumeIndexOfRefraction=this._material.indexOfRefraction)}configureSubsurface(){this._material.subSurface.useGltfStyleTextures=!0,this._material.subSurface.volumeIndexOfRefraction=1,this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=0,this._material.subSurface.useAlbedoToTintTranslucency=!1}set subsurfaceWeight(e){this._material.subSurface.isTranslucencyEnabled=e>0,this._material.subSurface.translucencyIntensity=e}get subsurfaceWeight(){return this._material.subSurface.isTranslucencyEnabled?this._material.subSurface.translucencyIntensity:0}set subsurfaceWeightTexture(e){this._material.subSurface.translucencyIntensityTexture=e}set subsurfaceColor(e){this._material.subSurface.tintColor=e}set subsurfaceColorTexture(e){this._material.subSurface.translucencyColorTexture=e}configureFuzz(){this._material.sheen.isEnabled=!0,this._material.sheen.useRoughnessFromMainTexture=!1,this._material.sheen.albedoScaling=!0}set fuzzWeight(e){this._material.sheen.isEnabled=!0,this._material.sheen.intensity=e}set fuzzWeightTexture(e){this._material.sheen.texture||(this._material.sheen.texture=e)}set fuzzColor(e){this._material.sheen.isEnabled=!0,this._material.sheen.color=e}set fuzzColorTexture(e){this._material.sheen.texture=e}set fuzzRoughness(e){this._material.sheen.isEnabled=!0,this._material.sheen.roughness=e}set fuzzRoughnessTexture(e){this._material.sheen.isEnabled=!0,this._material.sheen.textureRoughness=e}set specularRoughnessAnisotropy(e){this._material.anisotropy.isEnabled=!0,this._material.anisotropy.intensity=e}get specularRoughnessAnisotropy(){return this._material.anisotropy.intensity}set geometryTangentAngle(e){this._material.anisotropy.isEnabled=!0,this._material.anisotropy.angle=e}set geometryTangentTexture(e){this._material.anisotropy.isEnabled=!0,this._material.anisotropy.texture=e}get geometryTangentTexture(){return this._material.anisotropy.texture}configureGltfStyleAnisotropy(e=!0){}set thinFilmWeight(e){this._material.iridescence.isEnabled=e>0,this._material.iridescence.intensity=e}set thinFilmIor(e){this._material.iridescence.indexOfRefraction=e}set thinFilmThicknessMinimum(e){this._material.iridescence.minimumThickness=e}set thinFilmThicknessMaximum(e){this._material.iridescence.maximumThickness=e}set thinFilmWeightTexture(e){this._material.iridescence.texture=e}set thinFilmThicknessTexture(e){this._material.iridescence.thicknessTexture=e}set transmissionDispersion(e){this._material._dispersion=e}set unlit(e){this._material.unlit=e}set geometryOpacity(e){this._material.alpha=e}get geometryOpacity(){return this._material.alpha}set geometryNormalTexture(e){this._material.bumpTexture=e,this._material.forceIrradianceInFragment=!0}get geometryNormalTexture(){return this._material.bumpTexture}setNormalMapInversions(e,a){this._material.invertNormalMapX=e,this._material.invertNormalMapY=a}set geometryCoatNormalTexture(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.bumpTexture=e}get geometryCoatNormalTexture(){return this._material.clearCoat.bumpTexture}set geometryCoatNormalTextureScale(e){this._material.clearCoat.bumpTexture&&(this._material.clearCoat.bumpTexture.level=e)}}export{u as PBRMaterialLoadingAdapter}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrUboDeclaration-BaPvJwLw.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrUboDeclaration-BaPvJwLw.js new file mode 100644 index 0000000000000000000000000000000000000000..deed7fc8351a052e7a1819fe34e01fdc2c1004c5 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrUboDeclaration-BaPvJwLw.js @@ -0,0 +1,6 @@ +import{S as e}from"./index-CDrXokXW.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./meshUboDeclaration-C6raEdzf.js";const c="pbrUboDeclaration",v=`layout(std140,column_major) uniform;uniform Material {vec2 vAlbedoInfos;vec2 vBaseWeightInfos;vec2 vBaseDiffuseRoughnessInfos;vec4 vAmbientInfos;vec2 vOpacityInfos;vec2 vEmissiveInfos;vec2 vLightmapInfos;vec3 vReflectivityInfos;vec2 vMicroSurfaceSamplerInfos;vec3 vBumpInfos;mat4 albedoMatrix;mat4 baseWeightMatrix;mat4 baseDiffuseRoughnessMatrix;mat4 ambientMatrix;mat4 opacityMatrix;mat4 emissiveMatrix;mat4 lightmapMatrix;mat4 reflectivityMatrix;mat4 microSurfaceSamplerMatrix;mat4 bumpMatrix;vec2 vTangentSpaceParams;vec4 vAlbedoColor;float baseWeight;float baseDiffuseRoughness;vec4 vLightingIntensity;float pointSize;vec4 vReflectivityColor;vec3 vEmissiveColor;vec3 vAmbientColor;vec2 vDebugMode;vec4 vMetallicReflectanceFactors;vec2 vMetallicReflectanceInfos;mat4 metallicReflectanceMatrix;vec2 vReflectanceInfos;mat4 reflectanceMatrix;vec4 cameraInfo;vec2 vReflectionInfos;mat4 reflectionMatrix;vec3 vReflectionMicrosurfaceInfos;vec3 vReflectionPosition;vec3 vReflectionSize;vec2 vReflectionFilteringInfo;vec3 vReflectionDominantDirection;vec3 vReflectionColor;vec3 vSphericalL00;vec3 vSphericalL1_1;vec3 vSphericalL10;vec3 vSphericalL11;vec3 vSphericalL2_2;vec3 vSphericalL2_1;vec3 vSphericalL20;vec3 vSphericalL21;vec3 vSphericalL22;vec3 vSphericalX;vec3 vSphericalY;vec3 vSphericalZ;vec3 vSphericalXX_ZZ;vec3 vSphericalYY_ZZ;vec3 vSphericalZZ;vec3 vSphericalXY;vec3 vSphericalYZ;vec3 vSphericalZX; +#define ADDITIONAL_UBO_DECLARATION +}; +#include +#include +`;e.IncludesShadersStore[c]||(e.IncludesShadersStore[c]=v); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrUboDeclaration-Bwg_eWAt.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrUboDeclaration-Bwg_eWAt.js new file mode 100644 index 0000000000000000000000000000000000000000..c3f3a88f707d3ebee0f8ec3311074083e1d305f3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pbrUboDeclaration-Bwg_eWAt.js @@ -0,0 +1,5 @@ +import{S as f}from"./index-CDrXokXW.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./meshUboDeclaration-Bk1ASTX2.js";const e="pbrUboDeclaration",i=`uniform vAlbedoInfos: vec2f;uniform vBaseWeightInfos: vec2f;uniform vBaseDiffuseRoughnessInfos: vec2f;uniform vAmbientInfos: vec4f;uniform vOpacityInfos: vec2f;uniform vEmissiveInfos: vec2f;uniform vLightmapInfos: vec2f;uniform vReflectivityInfos: vec3f;uniform vMicroSurfaceSamplerInfos: vec2f;uniform vBumpInfos: vec3f;uniform albedoMatrix: mat4x4f;uniform baseWeightMatrix: mat4x4f;uniform baseDiffuseRoughnessMatrix: mat4x4f;uniform ambientMatrix: mat4x4f;uniform opacityMatrix: mat4x4f;uniform emissiveMatrix: mat4x4f;uniform lightmapMatrix: mat4x4f;uniform reflectivityMatrix: mat4x4f;uniform microSurfaceSamplerMatrix: mat4x4f;uniform bumpMatrix: mat4x4f;uniform vTangentSpaceParams: vec2f;uniform vAlbedoColor: vec4f;uniform baseWeight: f32;uniform baseDiffuseRoughness: f32;uniform vLightingIntensity: vec4f;uniform pointSize: f32;uniform vReflectivityColor: vec4f;uniform vEmissiveColor: vec3f;uniform vAmbientColor: vec3f;uniform vDebugMode: vec2f;uniform vMetallicReflectanceFactors: vec4f;uniform vMetallicReflectanceInfos: vec2f;uniform metallicReflectanceMatrix: mat4x4f;uniform vReflectanceInfos: vec2f;uniform reflectanceMatrix: mat4x4f;uniform cameraInfo: vec4f;uniform vReflectionInfos: vec2f;uniform reflectionMatrix: mat4x4f;uniform vReflectionMicrosurfaceInfos: vec3f;uniform vReflectionPosition: vec3f;uniform vReflectionSize: vec3f;uniform vReflectionFilteringInfo: vec2f;uniform vReflectionDominantDirection: vec3f;uniform vReflectionColor: vec3f;uniform vSphericalL00: vec3f;uniform vSphericalL1_1: vec3f;uniform vSphericalL10: vec3f;uniform vSphericalL11: vec3f;uniform vSphericalL2_2: vec3f;uniform vSphericalL2_1: vec3f;uniform vSphericalL20: vec3f;uniform vSphericalL21: vec3f;uniform vSphericalL22: vec3f;uniform vSphericalX: vec3f;uniform vSphericalY: vec3f;uniform vSphericalZ: vec3f;uniform vSphericalXX_ZZ: vec3f;uniform vSphericalYY_ZZ: vec3f;uniform vSphericalZZ: vec3f;uniform vSphericalXY: vec3f;uniform vSphericalYZ: vec3f;uniform vSphericalZX: vec3f; +#define ADDITIONAL_UBO_DECLARATION +#include +#include +`;f.IncludesShadersStoreWGSL[e]||(f.IncludesShadersStoreWGSL[e]=i); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pieDiagram-ADFJNKIX-CMO7fUEe.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pieDiagram-ADFJNKIX-CMO7fUEe.js new file mode 100644 index 0000000000000000000000000000000000000000..2631a650975d0fb7641c33dda7734f569f4b02c9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pieDiagram-ADFJNKIX-CMO7fUEe.js @@ -0,0 +1,30 @@ +import{g as j,s as q,a as Z,b as H,q as J,p as K,_ as u,l as z,c as Q,E as X,I as Y,O as ee,d as te,y as ae,F as re}from"./mermaid.core-7TB2QPZo.js";import{p as ne}from"./chunk-4BX2VUAB-Zuu4IE0p.js";import{p as ie}from"./treemap-KMMF4GRG-B4w9v4mX.js";import{d as R}from"./arc-Bt_eNeYl.js";import{o as se}from"./ordinal-BeghXfj9.js";import{a as S,t as F,n as oe}from"./step-B-Gbak1k.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./dispatch-kxCwF96_.js";import"./select-BigU4G0v.js";import"./min-ljrXhbfm.js";import"./_baseUniq-DT1kfcxk.js";import"./init-Dmth1JHB.js";function le(e,a){return ae?1:a>=e?0:NaN}function ce(e){return e}function pe(){var e=ce,a=le,f=null,y=S(0),s=S(F),l=S(0);function o(t){var n,c=(t=oe(t)).length,d,x,h=0,p=new Array(c),i=new Array(c),v=+y.apply(this,arguments),w=Math.min(F,Math.max(-F,s.apply(this,arguments)-v)),m,C=Math.min(Math.abs(w)/c,l.apply(this,arguments)),$=C*(w<0?-1:1),g;for(n=0;n0&&(h+=g);for(a!=null?p.sort(function(A,D){return a(i[A],i[D])}):f!=null&&p.sort(function(A,D){return f(t[A],t[D])}),n=0,x=h?(w-c*$)/h:0;n0?g*x:0)+$,i[d]={data:t[d],index:n,value:g,startAngle:v,endAngle:m,padAngle:C};return i}return o.value=function(t){return arguments.length?(e=typeof t=="function"?t:S(+t),o):e},o.sortValues=function(t){return arguments.length?(a=t,f=null,o):a},o.sort=function(t){return arguments.length?(f=t,a=null,o):f},o.startAngle=function(t){return arguments.length?(y=typeof t=="function"?t:S(+t),o):y},o.endAngle=function(t){return arguments.length?(s=typeof t=="function"?t:S(+t),o):s},o.padAngle=function(t){return arguments.length?(l=typeof t=="function"?t:S(+t),o):l},o}var ue=re.pie,G={sections:new Map,showData:!1},T=G.sections,N=G.showData,de=structuredClone(ue),ge=u(()=>structuredClone(de),"getConfig"),fe=u(()=>{T=new Map,N=G.showData,ae()},"clear"),me=u(({label:e,value:a})=>{if(a<0)throw new Error(`"${e}" has invalid value: ${a}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);T.has(e)||(T.set(e,a),z.debug(`added new section: ${e}, with value: ${a}`))},"addSection"),he=u(()=>T,"getSections"),ve=u(e=>{N=e},"setShowData"),Se=u(()=>N,"getShowData"),L={getConfig:ge,clear:fe,setDiagramTitle:K,getDiagramTitle:J,setAccTitle:H,getAccTitle:Z,setAccDescription:q,getAccDescription:j,addSection:me,getSections:he,setShowData:ve,getShowData:Se},ye=u((e,a)=>{ne(e,a),a.setShowData(e.showData),e.sections.map(a.addSection)},"populateDb"),xe={parse:u(async e=>{const a=await ie("pie",e);z.debug(a),ye(a,L)},"parse")},we=u(e=>` + .pieCircle{ + stroke: ${e.pieStrokeColor}; + stroke-width : ${e.pieStrokeWidth}; + opacity : ${e.pieOpacity}; + } + .pieOuterCircle{ + stroke: ${e.pieOuterStrokeColor}; + stroke-width: ${e.pieOuterStrokeWidth}; + fill: none; + } + .pieTitleText { + text-anchor: middle; + font-size: ${e.pieTitleTextSize}; + fill: ${e.pieTitleTextColor}; + font-family: ${e.fontFamily}; + } + .slice { + font-family: ${e.fontFamily}; + fill: ${e.pieSectionTextColor}; + font-size:${e.pieSectionTextSize}; + // fill: white; + } + .legend text { + fill: ${e.pieLegendTextColor}; + font-family: ${e.fontFamily}; + font-size: ${e.pieLegendTextSize}; + } +`,"getStyles"),Ae=we,De=u(e=>{const a=[...e.values()].reduce((s,l)=>s+l,0),f=[...e.entries()].map(([s,l])=>({label:s,value:l})).filter(s=>s.value/a*100>=1).sort((s,l)=>l.value-s.value);return pe().value(s=>s.value)(f)},"createPieArcs"),Ce=u((e,a,f,y)=>{z.debug(`rendering pie chart +`+e);const s=y.db,l=Q(),o=X(s.getConfig(),l.pie),t=40,n=18,c=4,d=450,x=d,h=Y(a),p=h.append("g");p.attr("transform","translate("+x/2+","+d/2+")");const{themeVariables:i}=l;let[v]=ee(i.pieOuterStrokeWidth);v??=2;const w=o.textPosition,m=Math.min(x,d)/2-t,C=R().innerRadius(0).outerRadius(m),$=R().innerRadius(m*w).outerRadius(m*w);p.append("circle").attr("cx",0).attr("cy",0).attr("r",m+v/2).attr("class","pieOuterCircle");const g=s.getSections(),A=De(g),D=[i.pie1,i.pie2,i.pie3,i.pie4,i.pie5,i.pie6,i.pie7,i.pie8,i.pie9,i.pie10,i.pie11,i.pie12];let E=0;g.forEach(r=>{E+=r});const O=A.filter(r=>(r.data.value/E*100).toFixed(0)!=="0"),b=se(D);p.selectAll("mySlices").data(O).enter().append("path").attr("d",C).attr("fill",r=>b(r.data.label)).attr("class","pieCircle"),p.selectAll("mySlices").data(O).enter().append("text").text(r=>(r.data.value/E*100).toFixed(0)+"%").attr("transform",r=>"translate("+$.centroid(r)+")").style("text-anchor","middle").attr("class","slice"),p.append("text").text(s.getDiagramTitle()).attr("x",0).attr("y",-400/2).attr("class","pieTitleText");const W=[...g.entries()].map(([r,M])=>({label:r,value:M})),k=p.selectAll(".legend").data(W).enter().append("g").attr("class","legend").attr("transform",(r,M)=>{const P=n+c,B=P*W.length/2,V=12*n,U=M*P-B;return"translate("+V+","+U+")"});k.append("rect").attr("width",n).attr("height",n).style("fill",r=>b(r.label)).style("stroke",r=>b(r.label)),k.append("text").attr("x",n+c).attr("y",n-c).text(r=>s.getShowData()?`${r.label} [${r.value}]`:r.label);const _=Math.max(...k.selectAll("text").nodes().map(r=>r?.getBoundingClientRect().width??0)),I=x+t+n+c+_;h.attr("viewBox",`0 0 ${I} ${d}`),te(h,d,I,o.useMaxWidth)},"draw"),$e={draw:Ce},Re={parser:xe,db:L,renderer:$e,styles:Ae};export{Re as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pl-DgzvenUF.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pl-DgzvenUF.js new file mode 100644 index 0000000000000000000000000000000000000000..845549bb0639b3570f30a4f1e886818afcb20058 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pl-DgzvenUF.js @@ -0,0 +1 @@ +const o="Polski",a={annotated_image:"Obraz z adnotacjami"},e={allow_recording_access:"Proszę zezwolić na dostęp do mikrofonu w celu nagrywania.",audio:"Audio",record_from_microphone:"Nagraj z mikrofonu",stop_recording:"Zatrzymaj nagrywanie",no_device_support:"Nie można uzyskać dostępu do urządzeń multimedialnych. Upewnij się, że działasz na bezpiecznym źródle (https) lub localhost (lub przekazałeś prawidłowy certyfikat SSL do ssl_verify), i że zezwoliłeś przeglądarce na dostęp do twojego urządzenia.",stop:"Stop",resume:"Wznów",record:"Nagrywaj",no_microphone:"Nie znaleziono mikrofonu",pause:"Pauza",play:"Odtwórz",waiting:"Oczekiwanie",drop_to_upload:"Upuść plik audio tutaj, aby go przesłać"},i={connection_can_break:"Na urządzeniu mobilnym połączenie może zostać przerwane, jeśli ta karta straci fokus lub urządzenie przejdzie w tryb uśpienia, tracąc twoje miejsce w kolejce.",long_requests_queue:"Istnieje długa kolejka oczekujących żądań. Zduplikuj ten Space, aby ją pominąć.",lost_connection:"Utracono połączenie z powodu opuszczenia strony. Powrót do kolejki...",waiting_for_inputs:"Oczekiwanie na zakończenie przesyłania pliku(ów), proszę spróbować ponownie."},r={checkbox:"Pole wyboru",checkbox_group:"Grupa pól wyboru"},t={code:"Kod"},n={color_picker:"Wybór koloru"},l={built_with:"Zbudowane z",built_with_gradio:"Zbudowane z Gradio",clear:"Wyczyść",download:"Pobierz",edit:"Edytuj",empty:"Pusty",error:"Błąd",hosted_on:"Hostowane na",loading:"Ładowanie",logo:"Logo",or:"lub",remove:"Usuń",settings:"Ustawienia",share:"Udostępnij",submit:"Wyślij",undo:"Cofnij",no_devices:"Nie znaleziono urządzeń",language:"Język",display_theme:"Motyw wyświetlania",pwa:"Progresywna aplikacja webowa"},s={incorrect_format:"Nieprawidłowy format, obsługiwane są tylko pliki CSV i TSV",new_column:"Dodaj kolumnę",new_row:"Nowy wiersz",add_row_above:"Dodaj wiersz powyżej",add_row_below:"Dodaj wiersz poniżej",add_column_left:"Dodaj kolumnę po lewej",add_column_right:"Dodaj kolumnę po prawej",delete_row:"Usuń wiersz",delete_column:"Usuń kolumnę",sort_column:"Sortuj kolumnę",sort_ascending:"Sortuj rosnąco",sort_descending:"Sortuj malejąco",drop_to_upload:"Upuść pliki CSV lub TSV tutaj, aby zaimportować dane do ramki danych",clear_sort:"Wyczyść sortowanie"},d={dropdown:"Lista rozwijana"},p={build_error:"Wystąpił błąd kompilacji",config_error:"Wystąpił błąd konfiguracji",contact_page_author:"Proszę skontaktować się z autorem strony, aby go poinformować.",no_app_file:"Brak pliku aplikacji",runtime_error:"Wystąpił błąd wykonania",space_not_working:'"Space nie działa, ponieważ" {0}',space_paused:"Space jest wstrzymany",use_via_api:"Użyj przez API",use_via_api_or_mcp:"Użyj przez API lub MCP"},u={uploading:"Przesyłanie..."},c={highlighted_text:"Wyróżniony tekst"},z={allow_webcam_access:"Proszę zezwolić na dostęp do kamery internetowej w celu nagrywania.",brush_color:"Kolor pędzla",brush_radius:"Rozmiar pędzla",image:"Obraz",remove_image:"Usuń obraz",select_brush_color:"Wybierz kolor pędzla",start_drawing:"Rozpocznij rysowanie",use_brush:"Użyj pędzla",drop_to_upload:"Upuść plik obrazu tutaj, aby go przesłać"},_={label:"Etykieta"},w={enable_cookies:"Jeśli odwiedzasz HuggingFace Space w trybie incognito, musisz włączyć pliki cookie stron trzecich.",incorrect_credentials:"Nieprawidłowe dane logowania",username:"Nazwa użytkownika",password:"Hasło",login:"Zaloguj się"},y={number:"Liczba"},k={plot:"Wykres"},b={radio:"Przycisk opcji"},j={slider:"Suwak"},m={click_to_upload:"Kliknij, aby przesłać",drop_audio:"Upuść plik audio tutaj",drop_csv:"Upuść plik CSV tutaj",drop_file:"Upuść plik tutaj",drop_image:"Upuść obraz tutaj",drop_video:"Upuść plik wideo tutaj",drop_gallery:"Upuść media tutaj",paste_clipboard:"Wklej ze schowka"},g={drop_to_upload:"Upuść plik wideo tutaj, aby go przesłać"},h={edit:"Edytuj",retry:"Spróbuj ponownie",undo:"Cofnij",submit:"Wyślij",cancel:"Anuluj",like:"Lubię to",dislike:"Nie lubię tego",clear:"Wyczyść czat"},f={_name:o,"3D_model":{"3d_model":"Model 3D",drop_to_upload:"Upuść plik modelu 3D (.obj, .glb, .stl, .gltf, .splat lub .ply) tutaj, aby go przesłać"},annotated_image:a,audio:e,blocks:i,checkbox:r,code:t,color_picker:n,common:l,dataframe:s,dropdown:d,errors:p,file:u,highlighted_text:c,image:z,label:_,login:w,number:y,plot:k,radio:b,slider:j,upload_text:m,video:g,chatbot:h};export{o as _name,a as annotated_image,e as audio,i as blocks,h as chatbot,r as checkbox,t as code,n as color_picker,l as common,s as dataframe,f as default,d as dropdown,p as errors,u as file,c as highlighted_text,z as image,_ as label,w as login,y as number,k as plot,b as radio,j as slider,m as upload_text,g as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pointCloudVertex-C-QHJpr_.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pointCloudVertex-C-QHJpr_.js new file mode 100644 index 0000000000000000000000000000000000000000..657ee3ca7e6f134f49c70dd07dc3bbc8ee13b5bf --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pointCloudVertex-C-QHJpr_.js @@ -0,0 +1,4 @@ +import{S as e}from"./index-CDrXokXW.js";const d="pointCloudVertex",i=`#if defined(POINTSIZE) && !defined(WEBGPU) +gl_PointSize=pointSize; +#endif +`;e.IncludesShadersStore[d]||(e.IncludesShadersStore[d]=i); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/postProcessRenderEffect-Bq4hKPLg.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/postProcessRenderEffect-Bq4hKPLg.js new file mode 100644 index 0000000000000000000000000000000000000000..d4e5dfc6bbcec60e1be50d5b272690f753a8682a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/postProcessRenderEffect-Bq4hKPLg.js @@ -0,0 +1 @@ +import{aY as _,d as i,_ as d,s as m}from"./index-CDrXokXW.js";class p{get name(){return this._name}get cameras(){return this._cameras}get engine(){return this._engine}constructor(t,s){this._engine=t,this.uniqueId=_.UniqueId,this._name=s,this._renderEffects={},this._renderEffectsForIsolatedPass=new Array,this._cameras=[]}getClassName(){return"PostProcessRenderPipeline"}get isSupported(){for(const t in this._renderEffects)if(Object.prototype.hasOwnProperty.call(this._renderEffects,t)&&!this._renderEffects[t].isSupported)return!1;return!0}addEffect(t){this._renderEffects[t._name]=t}_rebuild(){}_enableEffect(t,s){const e=this._renderEffects[t];e&&e._enable(i.MakeArray(s||this._cameras))}_disableEffect(t,s){const e=this._renderEffects[t];e&&e._disable(i.MakeArray(s||this._cameras))}_attachCameras(t,s){const e=i.MakeArray(t||this._cameras);if(!e)return;const a=[];let r;for(r=0;r0){const e=this._renderEffects[s[0]].getPostProcesses();e&&(e[0].samples=t)}return!0}_adaptPostProcessesToViewPort(){const t=Object.keys(this._renderEffects);for(const s of t){const e=this._renderEffects[s].getPostProcesses();if(e)for(const a of e)a.adaptScaleToCurrentViewport=!0}}setPrePassRenderer(t){return!1}dispose(){}}d([m()],p.prototype,"_name",void 0);class P{constructor(t,s,e,a=!0){this._name=s,this._singleInstance=a,this._getPostProcesses=e,this._cameras={},this._indicesForCamera={},this._postProcesses={}}get isSupported(){for(const t in this._postProcesses)if(Object.prototype.hasOwnProperty.call(this._postProcesses,t)){const s=this._postProcesses[t];for(let e=0;e;uniform scale: vec2;varying vUV: vec2;const madd=vec2(0.5,0.5); +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs { +#define CUSTOM_VERTEX_MAIN_BEGIN +vertexOutputs.vUV=(vertexInputs.position*madd+madd)*uniforms.scale;vertexOutputs.position=vec4(vertexInputs.position,0.0,1.0); +#define CUSTOM_VERTEX_MAIN_END +} +`;t.ShadersStoreWGSL[e]||(t.ShadersStoreWGSL[e]=r);const n={name:e,shader:r};export{n as postprocessVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/prePassRendererSceneComponent-DTI6ZAyl.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/prePassRendererSceneComponent-DTI6ZAyl.js new file mode 100644 index 0000000000000000000000000000000000000000..232f87efa5753325917800ab3d059e971b7f3e82 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/prePassRendererSceneComponent-DTI6ZAyl.js @@ -0,0 +1,6 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./imageProcessing.fragment-BiH-FQNj.js","./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./imageProcessingFunctions-BbtoaTge.js","./helperFunctions-CZpZ-EbL.js","./imageProcessing.fragment-B8CxpJrd.js","./imageProcessingFunctions-dvOnE6xp.js","./helperFunctions-BkWNqKeI.js"])))=>i.map(i=>d[i]); +import{aE as C,aq as T,W as f,bn as E,_ as R,s as b,aA as y,bz as S,b9 as p,o as v,be as x,a,b as _,L as F}from"./index-CDrXokXW.js";import{af as d}from"./index-DWyDLubb.js";import{G as h}from"./geometryBufferRenderer-GNaIIBSt.js";import"./clipPlaneFragment-T8W7CIC5.js";import"./bumpFragment-CNMCo4HD.js";import"./helperFunctions-BkWNqKeI.js";import"./bakedVertexAnimation-BwUJBnNt.js";import"./morphTargetsVertex-7Q90Wwr8.js";import"./instancesDeclaration-BAnfKLCo.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./clipPlaneVertex-Bmw4TNCQ.js";import"./bumpVertex-B5e3s1jQ.js";class c extends C{_gatherImports(e,t){e?(this._webGPUReady=!0,t.push(d(()=>import("./imageProcessing.fragment-BiH-FQNj.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url))):t.push(d(()=>import("./imageProcessing.fragment-B8CxpJrd.js"),__vite__mapDeps([6,1,2,3,7,8]),import.meta.url))}get imageProcessingConfiguration(){return this._imageProcessingConfiguration}set imageProcessingConfiguration(e){e.applyByPostProcess=!0,this._attachImageProcessingConfiguration(e)}_attachImageProcessingConfiguration(e,t=!1){if(e!==this._imageProcessingConfiguration){if(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e)this._imageProcessingConfiguration=e;else{let s=this.options.scene;if(!s){const r=this.options.engine;if(r&&r.scenes){const i=r.scenes;s=i[i.length-1]}else s=T.LastCreatedScene}s?this._imageProcessingConfiguration=s.imageProcessingConfiguration:this._imageProcessingConfiguration=new f}this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add(()=>{this._updateParameters()})),t||this._updateParameters()}}get colorCurves(){return this.imageProcessingConfiguration.colorCurves}set colorCurves(e){this.imageProcessingConfiguration.colorCurves=e}get colorCurvesEnabled(){return this.imageProcessingConfiguration.colorCurvesEnabled}set colorCurvesEnabled(e){this.imageProcessingConfiguration.colorCurvesEnabled=e}get colorGradingTexture(){return this.imageProcessingConfiguration.colorGradingTexture}set colorGradingTexture(e){this.imageProcessingConfiguration.colorGradingTexture=e}get colorGradingEnabled(){return this.imageProcessingConfiguration.colorGradingEnabled}set colorGradingEnabled(e){this.imageProcessingConfiguration.colorGradingEnabled=e}get exposure(){return this.imageProcessingConfiguration.exposure}set exposure(e){this.imageProcessingConfiguration.exposure=e}get toneMappingEnabled(){return this._imageProcessingConfiguration.toneMappingEnabled}set toneMappingEnabled(e){this._imageProcessingConfiguration.toneMappingEnabled=e}get toneMappingType(){return this._imageProcessingConfiguration.toneMappingType}set toneMappingType(e){this._imageProcessingConfiguration.toneMappingType=e}get contrast(){return this.imageProcessingConfiguration.contrast}set contrast(e){this.imageProcessingConfiguration.contrast=e}get vignetteStretch(){return this.imageProcessingConfiguration.vignetteStretch}set vignetteStretch(e){this.imageProcessingConfiguration.vignetteStretch=e}get vignetteCentreX(){return this.imageProcessingConfiguration.vignetteCenterX}set vignetteCentreX(e){this.imageProcessingConfiguration.vignetteCenterX=e}get vignetteCentreY(){return this.imageProcessingConfiguration.vignetteCenterY}set vignetteCentreY(e){this.imageProcessingConfiguration.vignetteCenterY=e}get vignetteCenterY(){return this.imageProcessingConfiguration.vignetteCenterY}set vignetteCenterY(e){this.imageProcessingConfiguration.vignetteCenterY=e}get vignetteCenterX(){return this.imageProcessingConfiguration.vignetteCenterX}set vignetteCenterX(e){this.imageProcessingConfiguration.vignetteCenterX=e}get vignetteWeight(){return this.imageProcessingConfiguration.vignetteWeight}set vignetteWeight(e){this.imageProcessingConfiguration.vignetteWeight=e}get vignetteColor(){return this.imageProcessingConfiguration.vignetteColor}set vignetteColor(e){this.imageProcessingConfiguration.vignetteColor=e}get vignetteCameraFov(){return this.imageProcessingConfiguration.vignetteCameraFov}set vignetteCameraFov(e){this.imageProcessingConfiguration.vignetteCameraFov=e}get vignetteBlendMode(){return this.imageProcessingConfiguration.vignetteBlendMode}set vignetteBlendMode(e){this.imageProcessingConfiguration.vignetteBlendMode=e}get vignetteEnabled(){return this.imageProcessingConfiguration.vignetteEnabled}set vignetteEnabled(e){this.imageProcessingConfiguration.vignetteEnabled=e}get ditheringIntensity(){return this.imageProcessingConfiguration.ditheringIntensity}set ditheringIntensity(e){this.imageProcessingConfiguration.ditheringIntensity=e}get ditheringEnabled(){return this.imageProcessingConfiguration.ditheringEnabled}set ditheringEnabled(e){this.imageProcessingConfiguration.ditheringEnabled=e}get fromLinearSpace(){return this._fromLinearSpace}set fromLinearSpace(e){this._fromLinearSpace!==e&&(this._fromLinearSpace=e,this._updateParameters())}get outputTextureWidth(){return this.imageProcessingConfiguration.outputTextureWidth}set outputTextureWidth(e){this.imageProcessingConfiguration.outputTextureWidth=e}get outputTextureHeight(){return this.imageProcessingConfiguration.outputTextureHeight}set outputTextureHeight(e){this.imageProcessingConfiguration.outputTextureHeight=e}constructor(e,t=null,s){super({...s,name:e,engine:t||E.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:c.FragmentUrl}),this._fromLinearSpace=!0,this._defines={IMAGEPROCESSING:!1,VIGNETTE:!1,VIGNETTEBLENDMODEMULTIPLY:!1,VIGNETTEBLENDMODEOPAQUE:!1,TONEMAPPING:0,CONTRAST:!1,COLORCURVES:!1,COLORGRADING:!1,COLORGRADING3D:!1,FROMLINEARSPACE:!1,SAMPLER3DGREENDEPTH:!1,SAMPLER3DBGRMAP:!1,DITHER:!1,IMAGEPROCESSINGPOSTPROCESS:!1,EXPOSURE:!1,SKIPFINALCOLORCLAMP:!1};const r=s?.imageProcessingConfiguration;r?(r.applyByPostProcess=!0,this._attachImageProcessingConfiguration(r,!0),this._updateParameters()):(this._attachImageProcessingConfiguration(null,!0),this.imageProcessingConfiguration.applyByPostProcess=!0)}_updateParameters(){this._defines.FROMLINEARSPACE=this._fromLinearSpace,this.imageProcessingConfiguration.prepareDefines(this._defines,!0);let e="";for(const r in this._defines){const i=this._defines[r];switch(typeof i){case"number":case"string":e+=`#define ${r} ${i}; +`;break;default:i&&(e+=`#define ${r}; +`);break}}const t=["textureSampler"],s=["scale"];f&&(f.PrepareSamplers(t,this._defines),f.PrepareUniforms(s,this._defines)),this.updateEffect(e,s,t)}bind(e=!1){super.bind(e),this.imageProcessingConfiguration.bind(this.effect,this.overrideAspectRatio)}dispose(){super.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration&&(this.imageProcessingConfiguration.applyByPostProcess=!1)}}c.FragmentUrl="imageProcessing";class P extends y{get _imageProcessingConfiguration(){return this._effectWrapper.imageProcessingConfiguration}get imageProcessingConfiguration(){return this._effectWrapper.imageProcessingConfiguration}set imageProcessingConfiguration(e){this._effectWrapper.imageProcessingConfiguration=e}get isSupported(){const e=this.getEffect();return!e||e.isSupported}get colorCurves(){return this.imageProcessingConfiguration.colorCurves}set colorCurves(e){this.imageProcessingConfiguration.colorCurves=e}get colorCurvesEnabled(){return this.imageProcessingConfiguration.colorCurvesEnabled}set colorCurvesEnabled(e){this.imageProcessingConfiguration.colorCurvesEnabled=e}get colorGradingTexture(){return this.imageProcessingConfiguration.colorGradingTexture}set colorGradingTexture(e){this.imageProcessingConfiguration.colorGradingTexture=e}get colorGradingEnabled(){return this.imageProcessingConfiguration.colorGradingEnabled}set colorGradingEnabled(e){this.imageProcessingConfiguration.colorGradingEnabled=e}get exposure(){return this.imageProcessingConfiguration.exposure}set exposure(e){this.imageProcessingConfiguration.exposure=e}get toneMappingEnabled(){return this._imageProcessingConfiguration.toneMappingEnabled}set toneMappingEnabled(e){this._imageProcessingConfiguration.toneMappingEnabled=e}get toneMappingType(){return this._imageProcessingConfiguration.toneMappingType}set toneMappingType(e){this._imageProcessingConfiguration.toneMappingType=e}get contrast(){return this.imageProcessingConfiguration.contrast}set contrast(e){this.imageProcessingConfiguration.contrast=e}get vignetteStretch(){return this.imageProcessingConfiguration.vignetteStretch}set vignetteStretch(e){this.imageProcessingConfiguration.vignetteStretch=e}get vignetteCentreX(){return this.imageProcessingConfiguration.vignetteCenterX}set vignetteCentreX(e){this.imageProcessingConfiguration.vignetteCenterX=e}get vignetteCentreY(){return this.imageProcessingConfiguration.vignetteCenterY}set vignetteCentreY(e){this.imageProcessingConfiguration.vignetteCenterY=e}get vignetteCenterY(){return this.imageProcessingConfiguration.vignetteCenterY}set vignetteCenterY(e){this.imageProcessingConfiguration.vignetteCenterY=e}get vignetteCenterX(){return this.imageProcessingConfiguration.vignetteCenterX}set vignetteCenterX(e){this.imageProcessingConfiguration.vignetteCenterX=e}get vignetteWeight(){return this.imageProcessingConfiguration.vignetteWeight}set vignetteWeight(e){this.imageProcessingConfiguration.vignetteWeight=e}get vignetteColor(){return this.imageProcessingConfiguration.vignetteColor}set vignetteColor(e){this.imageProcessingConfiguration.vignetteColor=e}get vignetteCameraFov(){return this.imageProcessingConfiguration.vignetteCameraFov}set vignetteCameraFov(e){this.imageProcessingConfiguration.vignetteCameraFov=e}get vignetteBlendMode(){return this.imageProcessingConfiguration.vignetteBlendMode}set vignetteBlendMode(e){this.imageProcessingConfiguration.vignetteBlendMode=e}get vignetteEnabled(){return this.imageProcessingConfiguration.vignetteEnabled}set vignetteEnabled(e){this.imageProcessingConfiguration.vignetteEnabled=e}get ditheringIntensity(){return this.imageProcessingConfiguration.ditheringIntensity}set ditheringIntensity(e){this.imageProcessingConfiguration.ditheringIntensity=e}get ditheringEnabled(){return this.imageProcessingConfiguration.ditheringEnabled}set ditheringEnabled(e){this.imageProcessingConfiguration.ditheringEnabled=e}get fromLinearSpace(){return this._effectWrapper.fromLinearSpace}set fromLinearSpace(e){this._effectWrapper.fromLinearSpace=e}constructor(e,t,s=null,r,i,g,u=0,l){const m={size:typeof t=="number"?t:void 0,camera:s,samplingMode:r,engine:i,reusable:g,textureType:u,imageProcessingConfiguration:l,scene:s?.getScene(),...t,blockCompilation:!0};super(e,c.FragmentUrl,{effectWrapper:typeof t=="number"||!t.effectWrapper?new c(e,i,m):void 0,...m}),this.onApply=()=>{this._effectWrapper.overrideAspectRatio=this.aspectRatio}}getClassName(){return"ImageProcessingPostProcess"}_updateParameters(){this._effectWrapper._updateParameters()}dispose(e){super.dispose(e),this._imageProcessingConfiguration&&(this.imageProcessingConfiguration.applyByPostProcess=!1)}}R([b()],P.prototype,"fromLinearSpace",null);class A extends S{constructor(e,t,s,r,i,g){super(e,s,r,i,g),this._beforeCompositionPostProcesses=[],this._internalTextureDirty=!1,this.enabled=!1,this.renderTargetTexture=null,this.renderTargetTexture=t}_createCompositionEffect(){this.imageProcessingPostProcess=new P("prePassComposition",1,null,void 0,this._engine),this.imageProcessingPostProcess._updateParameters()}_checkSize(){const e=this._engine.getRenderWidth(!0),t=this._engine.getRenderHeight(!0),s=this.getRenderWidth(),r=this.getRenderHeight();(s!==e||r!==t)&&(this.resize({width:e,height:t}),this._internalTextureDirty=!0)}updateCount(e,t,s){super.updateCount(e,t,s),this._internalTextureDirty=!0}_resetPostProcessChain(){this._beforeCompositionPostProcesses.length=0}dispose(){const e=this._scene;if(super.dispose(),e&&e.prePassRenderer){const t=e.prePassRenderer.renderTargets.indexOf(this);t!==-1&&e.prePassRenderer.renderTargets.splice(t,1)}this.imageProcessingPostProcess&&this.imageProcessingPostProcess.dispose(),this.renderTargetTexture&&(this.renderTargetTexture._prePassRenderTarget=null),this._outputPostProcess&&(this._outputPostProcess.autoClear=!0,this._outputPostProcess.restoreDefaultInputTexture())}}class n{get generateNormalsInWorldSpace(){return this._generateNormalsInWorldSpace}set generateNormalsInWorldSpace(e){this._generateNormalsInWorldSpace!==e&&(this._generateNormalsInWorldSpace=e,this._markAllMaterialsAsPrePassDirty())}getIndex(e){return this._textureIndices[e]}get samples(){return this.defaultRT.samples}set samples(e){this.defaultRT.samples=e}get useSpecificClearForDepthTexture(){return this._useSpecificClearForDepthTexture}set useSpecificClearForDepthTexture(e){this._useSpecificClearForDepthTexture!==e&&(this._useSpecificClearForDepthTexture=e,this._isDirty=!0)}getRenderTarget(){return this._currentTarget}_setRenderTarget(e){e?this._currentTarget=e:(this._currentTarget=this.defaultRT,this._engine.currentRenderPassId=this._scene.activeCamera?.renderPassId??this._currentTarget.renderPassId)}get currentRTisSceneRT(){return this._currentTarget===this.defaultRT}_refreshGeometryBufferRendererLink(){if(this.doNotUseGeometryRendererFallback)this._geometryBuffer&&this._geometryBuffer._unlinkPrePassRenderer(),this._geometryBuffer=null,this._scene.disableGeometryBufferRenderer();else{if(this._geometryBuffer=this._scene.enableGeometryBufferRenderer(),!this._geometryBuffer){this.doNotUseGeometryRendererFallback=!0;return}this._geometryBuffer._linkPrePassRenderer(this)}}get enabled(){return this._enabled}constructor(e){this.excludedSkinnedMesh=[],this.excludedMaterials=[],this.mrtCount=0,this._mrtTypes=[],this._mrtFormats=[],this._mrtLayout=[],this._mrtNames=[],this._textureIndices=[],this._generateNormalsInWorldSpace=!1,this._useSpecificClearForDepthTexture=!1,this._isDirty=!0,this._effectConfigurations=[],this.doNotUseGeometryRendererFallback=!0,this.renderTargets=[],this._clearColor=new p(0,0,0,0),this._clearDepthColor=new p(0,0,0,1),this._enabled=!1,this._needsCompositionForThisPass=!1,this.disableGammaTransform=!1,this._scene=e,this._engine=e.getEngine();let t=0;this._engine._caps.textureFloat&&this._engine._caps.textureFloatLinearFiltering?t=1:this._engine._caps.textureHalfFloat&&this._engine._caps.textureHalfFloatLinearFiltering&&(t=2);for(let s=0;s0&&(this._useSpecificClearForDepthTexture&&this._mrtLayout[i]===5?(t.push(!1),s.push(!0)):(t.push(!0),s.push(!1)),r.push(!1));this._multiRenderAttachments=this._engine.buildTextureLayout(e),this._clearAttachments=this._engine.buildTextureLayout(t),this._clearDepthAttachments=this._engine.buildTextureLayout(s),this._defaultAttachments=this._engine.buildTextureLayout(r)}_resetLayout(){for(let e=0;el!=null),this._scene.autoClear=!0;const r=this._hasImageProcessing(this._postProcessesSourceForThisPass);this._needsCompositionForThisPass=!r&&!this.disableGammaTransform&&this._needsImageProcessing()&&!s;const i=this._getFirstPostProcess(this._postProcessesSourceForThisPass),g=e._beforeCompositionPostProcesses&&e._beforeCompositionPostProcesses[0];let u=null;this._scene.imageProcessingConfiguration.applyByPostProcess=this._needsCompositionForThisPass||r,this._needsCompositionForThisPass&&!e.imageProcessingPostProcess&&e._createCompositionEffect(),g?u=g:this._needsCompositionForThisPass?u=e.imageProcessingPostProcess:i&&(u=i),this._bindFrameBuffer(),this._linkInternalTexture(e,u)}_linkInternalTexture(e,t){t&&(t.autoClear=!1,t.inputTexture=e.renderTarget),e._outputPostProcess!==t&&(e._outputPostProcess&&this._unlinkInternalTexture(e),e._outputPostProcess=t),e._internalTextureDirty&&(this._updateGeometryBufferLayout(),e._internalTextureDirty=!1)}_unlinkInternalTexture(e){e._outputPostProcess&&(e._outputPostProcess.autoClear=!0,e._outputPostProcess.restoreDefaultInputTexture(),e._outputPostProcess=null)}_needsImageProcessing(){for(let e=0;e0?this._scene.activeCameras[0]:this._scene.activeCamera;if(!r)continue;t=r._postProcesses}if(t&&(t=t.filter(r=>r!=null),t)){for(let r=0;r=0;e--)this.renderTargets[e].dispose();for(let e=0;e{throw x("PrePassRendererSceneComponent")};n.TextureFormats=[{purpose:0,type:2,format:5,name:"prePass_Irradiance"},{purpose:1,type:2,format:5,name:"prePass_Position"},{purpose:2,type:0,format:5,name:"prePass_Velocity"},{purpose:3,type:0,format:5,name:"prePass_Reflectivity"},{purpose:4,type:2,format:5,name:"prePass_Color"},{purpose:5,type:1,format:6,name:"prePass_Depth"},{purpose:6,type:2,format:5,name:"prePass_Normal"},{purpose:7,type:0,format:5,name:"prePass_Albedo"},{purpose:8,type:0,format:5,name:"prePass_WorldNormal"},{purpose:9,type:2,format:5,name:"prePass_LocalPosition"},{purpose:10,type:1,format:6,name:"prePass_ScreenDepth"},{purpose:11,type:2,format:5,name:"prePass_VelocityLinear"}];Object.defineProperty(_.prototype,"prePassRenderer",{get:function(){return this._prePassRenderer},set:function(o){o&&o.isSupported&&(this._prePassRenderer=o)},enumerable:!0,configurable:!0});_.prototype.enablePrePassRenderer=function(){return this._prePassRenderer?this._prePassRenderer:(this._prePassRenderer=new n(this),this._prePassRenderer.isSupported||(this._prePassRenderer=null,F.Error(`PrePassRenderer needs WebGL 2 support. +Maybe you tried to use the following features that need the PrePassRenderer : + + Subsurface Scattering`)),this._prePassRenderer)};_.prototype.disablePrePassRenderer=function(){this._prePassRenderer&&(this._prePassRenderer.dispose(),this._prePassRenderer=null)};class I{constructor(e){this.name=a.NAME_PREPASSRENDERER,this.scene=e}register(){this.scene._beforeCameraDrawStage.registerStep(a.STEP_BEFORECAMERADRAW_PREPASS,this,this._beforeCameraDraw),this.scene._afterCameraDrawStage.registerStep(a.STEP_AFTERCAMERADRAW_PREPASS,this,this._afterCameraDraw),this.scene._beforeRenderTargetDrawStage.registerStep(a.STEP_BEFORERENDERTARGETDRAW_PREPASS,this,this._beforeRenderTargetDraw),this.scene._afterRenderTargetDrawStage.registerStep(a.STEP_AFTERCAMERADRAW_PREPASS,this,this._afterRenderTargetDraw),this.scene._beforeClearStage.registerStep(a.STEP_BEFORECLEAR_PREPASS,this,this._beforeClearStage),this.scene._beforeRenderTargetClearStage.registerStep(a.STEP_BEFORERENDERTARGETCLEAR_PREPASS,this,this._beforeRenderTargetClearStage),this.scene._beforeRenderingMeshStage.registerStep(a.STEP_BEFORERENDERINGMESH_PREPASS,this,this._beforeRenderingMeshStage),this.scene._afterRenderingMeshStage.registerStep(a.STEP_AFTERRENDERINGMESH_PREPASS,this,this._afterRenderingMeshStage)}_beforeRenderTargetDraw(e,t,s){this.scene.prePassRenderer&&!e.noPrePassRenderer&&(this.scene.prePassRenderer._setRenderTarget(e._prePassRenderTarget),this.scene.prePassRenderer._beforeDraw(void 0,t,s))}_afterRenderTargetDraw(e,t,s){this.scene.prePassRenderer&&!e.noPrePassRenderer&&this.scene.prePassRenderer._afterDraw(t,s)}_beforeRenderTargetClearStage(e){this.scene.prePassRenderer&&!e.noPrePassRenderer&&(e._prePassRenderTarget||(e._prePassRenderTarget=this.scene.prePassRenderer._createRenderTarget(e.name+"_prePassRTT",e)),this.scene.prePassRenderer._setRenderTarget(e._prePassRenderTarget),this.scene.prePassRenderer._clear())}_beforeCameraDraw(e){this.scene.prePassRenderer&&(this.scene.prePassRenderer._setRenderTarget(null),this.scene.prePassRenderer._beforeDraw(e))}_afterCameraDraw(){this.scene.prePassRenderer&&this.scene.prePassRenderer._afterDraw()}_beforeClearStage(){this.scene.prePassRenderer&&(this.scene.prePassRenderer._setRenderTarget(null),this.scene.prePassRenderer._clear())}_beforeRenderingMeshStage(e,t,s,r){if(!r)return;const i=e.getScene();i.prePassRenderer&&i.prePassRenderer.bindAttachmentsForEffect(r,t)}_afterRenderingMeshStage(e){const t=e.getScene();t.prePassRenderer&&t.prePassRenderer.restoreAttachments()}rebuild(){}dispose(){this.scene.disablePrePassRenderer()}}n._SceneComponentInitialization=o=>{let e=o._getComponent(a.NAME_PREPASSRENDERER);e||(e=new I(o),o._addComponent(e))};export{I as PrePassRendererSceneComponent}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/prism-python-B4lzO_Nz.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/prism-python-B4lzO_Nz.js new file mode 100644 index 0000000000000000000000000000000000000000..c75fb05df143f383822bd00e6141a37c6c0ee3c0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/prism-python-B4lzO_Nz.js @@ -0,0 +1,2 @@ +import{J as W,G as te}from"./i18n-Dnhn5Rxr.js";var q={exports:{}},J;function ae(){return J||(J=1,(function(G){var N=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var i=(function(g){var h=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,y=0,F={},s={manual:g.Prism&&g.Prism.manual,disableWorkerMessageHandler:g.Prism&&g.Prism.disableWorkerMessageHandler,util:{encode:function t(e){return e instanceof b?new b(e.type,t(e.content),e.alias):Array.isArray(e)?e.map(t):e.replace(/&/g,"&").replace(/"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(n){var t=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(n.stack)||[])[1];if(t){var e=document.getElementsByTagName("script");for(var a in e)if(e[a].src==t)return e[a]}return null}},isActive:function(t,e,a){for(var n="no-"+e;t;){var r=t.classList;if(r.contains(e))return!0;if(r.contains(n))return!1;t=t.parentElement}return!!a}},languages:{plain:F,plaintext:F,text:F,txt:F,extend:function(t,e){var a=s.util.clone(s.languages[t]);for(var n in e)a[n]=e[n];return a},insertBefore:function(t,e,a,n){n=n||s.languages;var r=n[t],l={};for(var o in r)if(r.hasOwnProperty(o)){if(o==e)for(var u in a)a.hasOwnProperty(u)&&(l[u]=a[u]);a.hasOwnProperty(o)||(l[o]=r[o])}var d=n[t];return n[t]=l,s.languages.DFS(s.languages,function(m,A){A===d&&m!=t&&(this[m]=l)}),l},DFS:function t(e,a,n,r){r=r||{};var l=s.util.objId;for(var o in e)if(e.hasOwnProperty(o)){a.call(e,o,e[o],n||o);var u=e[o],d=s.util.type(u);d==="Object"&&!r[l(u)]?(r[l(u)]=!0,t(u,a,null,r)):d==="Array"&&!r[l(u)]&&(r[l(u)]=!0,t(u,a,o,r))}}},plugins:{},highlightAll:function(t,e){s.highlightAllUnder(document,t,e)},highlightAllUnder:function(t,e,a){var n={callback:a,container:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};s.hooks.run("before-highlightall",n),n.elements=Array.prototype.slice.apply(n.container.querySelectorAll(n.selector)),s.hooks.run("before-all-elements-highlight",n);for(var r=0,l;l=n.elements[r++];)s.highlightElement(l,e===!0,n.callback)},highlightElement:function(t,e,a){var n=s.util.getLanguage(t),r=s.languages[n];s.util.setLanguage(t,n);var l=t.parentElement;l&&l.nodeName.toLowerCase()==="pre"&&s.util.setLanguage(l,n);var o=t.textContent,u={element:t,language:n,grammar:r,code:o};function d(A){u.highlightedCode=A,s.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,s.hooks.run("after-highlight",u),s.hooks.run("complete",u),a&&a.call(u.element)}if(s.hooks.run("before-sanity-check",u),l=u.element.parentElement,l&&l.nodeName.toLowerCase()==="pre"&&!l.hasAttribute("tabindex")&&l.setAttribute("tabindex","0"),!u.code){s.hooks.run("complete",u),a&&a.call(u.element);return}if(s.hooks.run("before-highlight",u),!u.grammar){d(s.util.encode(u.code));return}if(e&&g.Worker){var m=new Worker(s.filename);m.onmessage=function(A){d(A.data)},m.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else d(s.highlight(u.code,u.grammar,u.language))},highlight:function(t,e,a){var n={code:t,grammar:e,language:a};if(s.hooks.run("before-tokenize",n),!n.grammar)throw new Error('The language "'+n.language+'" has no grammar.');return n.tokens=s.tokenize(n.code,n.grammar),s.hooks.run("after-tokenize",n),b.stringify(s.util.encode(n.tokens),n.language)},tokenize:function(t,e){var a=e.rest;if(a){for(var n in a)e[n]=a[n];delete e.rest}var r=new _;return S(r,r.head,t),T(t,r,e,r.head,0),C(r)},hooks:{all:{},add:function(t,e){var a=s.hooks.all;a[t]=a[t]||[],a[t].push(e)},run:function(t,e){var a=s.hooks.all[t];if(!(!a||!a.length))for(var n=0,r;r=a[n++];)r(e)}},Token:b};g.Prism=s;function b(t,e,a,n){this.type=t,this.content=e,this.alias=a,this.length=(n||"").length|0}b.stringify=function t(e,a){if(typeof e=="string")return e;if(Array.isArray(e)){var n="";return e.forEach(function(d){n+=t(d,a)}),n}var r={type:e.type,content:t(e.content,a),tag:"span",classes:["token",e.type],attributes:{},language:a},l=e.alias;l&&(Array.isArray(l)?Array.prototype.push.apply(r.classes,l):r.classes.push(l)),s.hooks.run("wrap",r);var o="";for(var u in r.attributes)o+=" "+u+'="'+(r.attributes[u]||"").replace(/"/g,""")+'"';return"<"+r.tag+' class="'+r.classes.join(" ")+'"'+o+">"+r.content+""};function E(t,e,a,n){t.lastIndex=e;var r=t.exec(a);if(r&&n&&r[1]){var l=r[1].length;r.index+=l,r[0]=r[0].slice(l)}return r}function T(t,e,a,n,r,l){for(var o in a)if(!(!a.hasOwnProperty(o)||!a[o])){var u=a[o];u=Array.isArray(u)?u:[u];for(var d=0;d=l.reach);w+=v.value.length,v=v.next){var $=v.value;if(e.length>t.length)return;if(!($ instanceof b)){var z=1,x;if(Z){if(x=E(B,w,t,H),!x||x.index>=t.length)break;var L=x.index,V=x.index+x[0].length,k=w;for(k+=v.value.length;L>=k;)v=v.next,k+=v.value.length;if(k-=v.value.length,w=k,v.value instanceof b)continue;for(var P=v;P!==e.tail&&(kl.reach&&(l.reach=R);var D=v.prev;M&&(D=S(e,D,M),w+=M.length),j(e,D,z);var ee=new b(o,A?s.tokenize(I,A):I,K,I);if(v=S(e,D,ee),U&&S(e,v,U),z>1){var O={cause:o+","+d,reach:R};T(t,e,a,v.prev,w,O),l&&O.reach>l.reach&&(l.reach=O.reach)}}}}}}function _(){var t={value:null,prev:null,next:null},e={value:null,prev:t,next:null};t.next=e,this.head=t,this.tail=e,this.length=0}function S(t,e,a){var n=e.next,r={value:a,prev:e,next:n};return e.next=r,n.prev=r,t.length++,r}function j(t,e,a){for(var n=e.next,r=0;r/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},i.languages.markup.tag.inside["attr-value"].inside.entity=i.languages.markup.entity,i.languages.markup.doctype.inside["internal-subset"].inside=i.languages.markup,i.hooks.add("wrap",function(g){g.type==="entity"&&(g.attributes.title=g.content.replace(/&/,"&"))}),Object.defineProperty(i.languages.markup.tag,"addInlined",{value:function(h,y){var F={};F["language-"+y]={pattern:/(^$)/i,lookbehind:!0,inside:i.languages[y]},F.cdata=/^$/i;var s={"included-cdata":{pattern://i,inside:F}};s["language-"+y]={pattern:/[\s\S]+/,inside:i.languages[y]};var b={};b[h]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return h}),"i"),lookbehind:!0,greedy:!0,inside:s},i.languages.insertBefore("markup","cdata",b)}}),Object.defineProperty(i.languages.markup.tag,"addAttribute",{value:function(g,h){i.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+g+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[h,"language-"+h],inside:i.languages[h]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),i.languages.html=i.languages.markup,i.languages.mathml=i.languages.markup,i.languages.svg=i.languages.markup,i.languages.xml=i.languages.extend("markup",{}),i.languages.ssml=i.languages.xml,i.languages.atom=i.languages.xml,i.languages.rss=i.languages.xml,(function(g){var h=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;g.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+h.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+h.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+h.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+h.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:h,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},g.languages.css.atrule.inside.rest=g.languages.css;var y=g.languages.markup;y&&(y.tag.addInlined("style","css"),y.tag.addAttribute("style","css"))})(i),i.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},i.languages.javascript=i.languages.extend("clike",{"class-name":[i.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),i.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,i.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:i.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:i.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:i.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:i.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:i.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),i.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:i.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),i.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),i.languages.markup&&(i.languages.markup.tag.addInlined("script","javascript"),i.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),i.languages.js=i.languages.javascript,(function(){if(typeof i>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var g="Loading…",h=function(p,c){return"✖ Error "+p+" while fetching file: "+c},y="✖ Error: File does not exist or is empty",F={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},s="data-src-status",b="loading",E="loaded",T="failed",_="pre[data-src]:not(["+s+'="'+E+'"]):not(['+s+'="'+b+'"])';function S(p,c,f){var t=new XMLHttpRequest;t.open("GET",p,!0),t.onreadystatechange=function(){t.readyState==4&&(t.status<400&&t.responseText?c(t.responseText):t.status>=400?f(h(t.status,t.statusText)):f(y))},t.send(null)}function j(p){var c=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p||"");if(c){var f=Number(c[1]),t=c[2],e=c[3];return t?e?[f,Number(e)]:[f,void 0]:[f,f]}}i.hooks.add("before-highlightall",function(p){p.selector+=", "+_}),i.hooks.add("before-sanity-check",function(p){var c=p.element;if(c.matches(_)){p.code="",c.setAttribute(s,b);var f=c.appendChild(document.createElement("CODE"));f.textContent=g;var t=c.getAttribute("data-src"),e=p.language;if(e==="none"){var a=(/\.(\w+)$/.exec(t)||[,"none"])[1];e=F[a]||a}i.util.setLanguage(f,e),i.util.setLanguage(c,e);var n=i.plugins.autoloader;n&&n.loadLanguages(e),S(t,function(r){c.setAttribute(s,E);var l=j(c.getAttribute("data-range"));if(l){var o=r.split(/\r\n?|\n/g),u=l[0],d=l[1]==null?o.length:l[1];u<0&&(u+=o.length),u=Math.max(0,Math.min(u-1,o.length)),d<0&&(d+=o.length),d=Math.max(0,Math.min(d,o.length)),r=o.slice(u,d).join(` +`),c.hasAttribute("data-start")||c.setAttribute("data-start",String(u+1))}f.textContent=r,i.highlightElement(f)},function(r){c.setAttribute(s,T),f.textContent=r})}}),i.plugins.fileHighlight={highlight:function(c){for(var f=(c||document).querySelectorAll(_),t=0,e;e=f[t++];)i.highlightElement(e)}};var C=!1;i.fileHighlight=function(){C||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),C=!0),i.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(q)),q.exports}var ne=ae();const se=te(ne);var X={},Y;function re(){return Y||(Y=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),X}re();export{se as P,ne as p}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/procedural.vertex-BeyWwzKr.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/procedural.vertex-BeyWwzKr.js new file mode 100644 index 0000000000000000000000000000000000000000..3c9a2e74f6e290e58243e0bba26a3748a2de9b6c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/procedural.vertex-BeyWwzKr.js @@ -0,0 +1,7 @@ +import{S as o}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="proceduralVertexShader",i=`attribute vec2 position;varying vec2 vPosition;varying vec2 vUV;const vec2 madd=vec2(0.5,0.5); +#define CUSTOM_VERTEX_DEFINITIONS +void main(void) { +#define CUSTOM_VERTEX_MAIN_BEGIN +vPosition=position;vUV=position*madd+madd;gl_Position=vec4(position,0.0,1.0); +#define CUSTOM_VERTEX_MAIN_END +}`;o.ShadersStore[e]||(o.ShadersStore[e]=i);const d={name:e,shader:i};export{d as proceduralVertexShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/procedural.vertex-C_VYs-T2.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/procedural.vertex-C_VYs-T2.js new file mode 100644 index 0000000000000000000000000000000000000000..171def14bf74451a20951b3d40fd8f2320b0d351 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/procedural.vertex-C_VYs-T2.js @@ -0,0 +1,8 @@ +import{S as t}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="proceduralVertexShader",i=`attribute position: vec2f;varying vPosition: vec2f;varying vUV: vec2f;const madd: vec2f= vec2f(0.5,0.5); +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs { +#define CUSTOM_VERTEX_MAIN_BEGIN +vertexOutputs.vPosition=input.position;vertexOutputs.vUV=input.position*madd+madd;vertexOutputs.position= vec4f(input.position,0.0,1.0); +#define CUSTOM_VERTEX_MAIN_END +}`;t.ShadersStoreWGSL[e]||(t.ShadersStoreWGSL[e]=i);const n={name:e,shader:i};export{n as proceduralVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pt-BR-BumPWABt.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pt-BR-BumPWABt.js new file mode 100644 index 0000000000000000000000000000000000000000..99d6d3f7b01579343c34482bb77b597e2e632a5e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pt-BR-BumPWABt.js @@ -0,0 +1 @@ +const o="Português do Brasil",a={built_with_gradio:"Construído com Gradio",clear:"Limpar",error:"Erro",flag:"Marcar",loading:"Carregando",or:"ou",submit:"Enviar",built_with:"Construído com",download:"Baixar",edit:"Editar",empty:"Vazio",hosted_on:"Hospedado em",logo:"Logotipo",settings:"Configurações",undo:"Desfazer",no_devices:"Nenhum dispositivo encontrado",language:"Idioma",display_theme:"Tema de exibição",pwa:"Aplicativo web progressivo",share:"Compartilhar",remove:"Remover"},e={click_to_upload:"Clique para fazer upload",drop_audio:"Solte o áudio aqui",drop_csv:"Solte o CSV aqui",drop_file:"Solte o arquivo aqui",drop_image:"Solte a imagem aqui",drop_video:"Solte o vídeo aqui",drop_gallery:"Solte a mídia aqui",paste_clipboard:"Colar da área de transferência"},r={annotated_image:"Imagem anotada"},i={allow_recording_access:"Por favor, permita o acesso ao microfone para gravação.",audio:"Áudio",drop_to_upload:"Solte um arquivo de áudio aqui para fazer upload",record_from_microphone:"Gravar do microfone",stop_recording:"Parar gravação",no_device_support:"Os dispositivos de mídia não puderam ser acessados. Verifique se você está executando em uma origem segura (https) ou localhost (ou se forneceu um certificado SSL válido para ssl_verify), e se permitiu o acesso do navegador ao seu dispositivo.",stop:"Parar",resume:"Retomar",record:"Gravar",no_microphone:"Nenhum microfone encontrado",pause:"Pausar",play:"Reproduzir",waiting:"Aguardando"},d={connection_can_break:"No celular, a conexão pode ser interrompida se esta aba ficar em segundo plano ou se o dispositivo entrar em modo de repouso, fazendo você perder sua posição na fila.",long_requests_queue:"Há uma longa fila de solicitações pendentes. Duplique este Space para pular a fila.",lost_connection:"Conexão perdida ao sair da página. Retornando para a fila...",waiting_for_inputs:"Aguardando o(s) arquivo(s) terminar(em) de ser carregado(s), por favor, tente novamente."},n={checkbox:"Caixa de seleção",checkbox_group:"Grupo de caixas de seleção"},t={code:"Código"},s={color_picker:"Seletor de cor"},c={incorrect_format:"Formato incorreto, apenas arquivos CSV e TSV são suportados",new_column:"Adicionar coluna",new_row:"Nova linha",add_row_above:"Adicionar linha acima",add_row_below:"Adicionar linha abaixo",delete_row:"Excluir linha",delete_column:"Excluir coluna",add_column_left:"Adicionar coluna à esquerda",add_column_right:"Adicionar coluna à direita",sort_column:"Classificar coluna",sort_ascending:"Ordenar em ordem crescente",sort_descending:"Ordenar em ordem decrescente",drop_to_upload:"Solte arquivos CSV ou TSV aqui para importar dados para o dataframe",clear_sort:"Limpar classificação",filter:"Filtrar",clear_filter:"Limpar filtros"},l={dropdown:"Menu suspenso"},u={build_error:"Houve um erro de compilação",config_error:"Há um erro de configuração",contact_page_author:"Por favor, entre em contato com o autor da página para informá-lo.",no_app_file:"Não há arquivo de aplicativo",space_not_working:'"O Space não está funcionando porque" {0}',space_paused:"O Space está pausado",use_via_api:"Usar via API",use_via_api_or_mcp:"Usar via API ou MCP",runtime_error:"Houve um erro de execução"},p={uploading:"Carregando..."},m={highlighted_text:"Texto destacado"},_={allow_webcam_access:"Por favor, permita o acesso à webcam para gravação.",brush_color:"Cor do pincel",brush_radius:"Tamanho do pincel",image:"Imagem",remove_image:"Remover imagem",select_brush_color:"Selecione a cor do pincel",start_drawing:"Começar a desenhar",use_brush:"Usar pincel",drop_to_upload:"Solte um arquivo de imagem aqui para fazer upload"},g={label:"Rótulo"},v={enable_cookies:"Se você estiver visitando um HuggingFace Space no modo incógnito, você deve habilitar cookies de terceiros.",incorrect_credentials:"Credenciais incorretas",username:"Nome de usuário",password:"Senha",login:"Entrar"},f={number:"Número"},h={plot:"Gráfico"},b={radio:"Botão de opção"},q={slider:"Controle deslizante"},S={drop_to_upload:"Solte um arquivo de vídeo aqui para fazer upload"},w={edit:"Editar",retry:"Tentar novamente",undo:"Desfazer",submit:"Enviar",cancel:"Cancelar",like:"Gostei",dislike:"Não gostei",clear:"Limpar conversa"},C={_name:o,common:a,upload_text:e,"3D_model":{"3d_model":"Modelo 3D",drop_to_upload:"Solte um arquivo de modelo 3D (.obj, .glb, .stl, .gltf, .splat ou .ply) aqui para fazer upload"},annotated_image:r,audio:i,blocks:d,checkbox:n,code:t,color_picker:s,dataframe:c,dropdown:l,errors:u,file:p,highlighted_text:m,image:_,label:g,login:v,number:f,plot:h,radio:b,slider:q,video:S,chatbot:w};export{o as _name,r as annotated_image,i as audio,d as blocks,w as chatbot,n as checkbox,t as code,s as color_picker,a as common,c as dataframe,C as default,l as dropdown,u as errors,p as file,m as highlighted_text,_ as image,g as label,v as login,f as number,h as plot,b as radio,q as slider,e as upload_text,S as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pt-CMxRi3jz.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pt-CMxRi3jz.js new file mode 100644 index 0000000000000000000000000000000000000000..37ba41eaeb0f90ae88005cfc5c1ce7b6b6d2a0d7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/pt-CMxRi3jz.js @@ -0,0 +1 @@ +const o="Português",a={annotated_image:"Imagem anotada"},e={allow_recording_access:"Por favor, permita o acesso ao microfone para gravação.",audio:"Áudio",record_from_microphone:"Gravar do microfone",stop_recording:"Parar gravação",no_device_support:"Não é possível aceder a dispositivos de média. Certifique-se de que está a executar numa fonte segura (https) ou localhost (ou passou um certificado SSL válido para ssl_verify), e que permitiu o acesso do navegador ao seu dispositivo.",stop:"Parar",resume:"Retomar",record:"Gravar",no_microphone:"Nenhum microfone encontrado",pause:"Pausar",play:"Reproduzir",waiting:"Aguardando",drop_to_upload:"Solte um arquivo de áudio aqui para fazer upload"},r={connection_can_break:"No telemóvel, a ligação pode ser interrompida se este separador perder o foco ou o dispositivo entrar em modo de suspensão, perdendo a sua posição na fila.",long_requests_queue:"Há uma longa fila de solicitações pendentes. Duplique este Space para saltar a fila.",lost_connection:"Ligação perdida devido à saída da página. A voltar à fila...",waiting_for_inputs:"A aguardar o término do carregamento do(s) ficheiro(s), por favor, tente novamente."},i={checkbox:"Caixa de seleção",checkbox_group:"Grupo de caixas de seleção"},d={code:"Código"},t={color_picker:"Seletor de cor"},s={built_with:"Construído com",built_with_gradio:"Construído com Gradio",clear:"Limpar",download:"Descarregar",edit:"Editar",empty:"Vazio",error:"Erro",hosted_on:"Alojado em",loading:"A carregar",logo:"Logótipo",or:"ou",remove:"Remover",settings:"Configurações",share:"Partilhar",submit:"Enviar",undo:"Desfazer",no_devices:"Nenhum dispositivo encontrado",language:"Idioma",display_theme:"Tema de exibição",pwa:"Aplicação web progressiva"},n={incorrect_format:"Formato incorreto, apenas ficheiros CSV e TSV são suportados",new_column:"Adicionar coluna",new_row:"Nova linha",add_row_above:"Adicionar linha acima",add_row_below:"Adicionar linha abaixo",add_column_left:"Adicionar coluna à esquerda",add_column_right:"Adicionar coluna à direita",delete_row:"Eliminar linha",delete_column:"Eliminar coluna",sort_column:"Ordenar coluna",sort_ascending:"Ordenar por ordem crescente",sort_descending:"Ordenar por ordem decrescente",drop_to_upload:"Solte ficheiros CSV ou TSV aqui para importar dados para o dataframe",clear_sort:"Limpar ordenação",filter:"Filtrar",clear_filter:"Limpar filtros"},c={dropdown:"Lista suspensa"},l={build_error:"Há um erro de compilação",config_error:"Há um erro de configuração",contact_page_author:"Por favor, entre em contacto com o autor da página para informá-lo.",no_app_file:"Não há ficheiro de aplicação",runtime_error:"Há um erro de execução",space_not_working:'"O Space não está a funcionar porque" {0}',space_paused:"O Space está em pausa",use_via_api:"Usar via API",use_via_api_or_mcp:"Usar via API ou MCP"},u={uploading:"A carregar..."},p={highlighted_text:"Texto destacado"},m={allow_webcam_access:"Por favor, permita o acesso à webcam para gravação.",brush_color:"Cor do pincel",brush_radius:"Tamanho do pincel",image:"Imagem",remove_image:"Remover imagem",select_brush_color:"Selecionar cor do pincel",start_drawing:"Começar a desenhar",use_brush:"Usar pincel",drop_to_upload:"Solte um ficheiro de imagem aqui para fazer upload"},_={label:"Rótulo"},g={enable_cookies:"Se estiver a visitar um Space HuggingFace no modo anónimo, precisa de ativar cookies de terceiros.",incorrect_credentials:"Credenciais incorretas",username:"Nome de utilizador",password:"Palavra-passe",login:"Iniciar sessão"},f={number:"Número"},v={plot:"Gráfico"},h={radio:"Botão de opção"},b={slider:"Controlo deslizante"},S={click_to_upload:"Clique para carregar",drop_audio:"Solte o áudio aqui",drop_csv:"Solte o CSV aqui",drop_file:"Solte o ficheiro aqui",drop_image:"Solte a imagem aqui",drop_video:"Solte o vídeo aqui",drop_gallery:"Solte a média aqui",paste_clipboard:"Colar da área de transferência"},w={drop_to_upload:"Solte um ficheiro de vídeo aqui para fazer upload"},q={edit:"Editar",retry:"Tentar novamente",undo:"Desfazer",submit:"Enviar",cancel:"Cancelar",like:"Gosto",dislike:"Não gosto",clear:"Limpar conversa"},C={_name:o,"3D_model":{"3d_model":"Modelo 3D",drop_to_upload:"Solte um arquivo de modelo 3D (.obj, .glb, .stl, .gltf, .splat ou .ply) aqui para fazer upload"},annotated_image:a,audio:e,blocks:r,checkbox:i,code:d,color_picker:t,common:s,dataframe:n,dropdown:c,errors:l,file:u,highlighted_text:p,image:m,label:_,login:g,number:f,plot:v,radio:h,slider:b,upload_text:S,video:w,chatbot:q};export{o as _name,a as annotated_image,e as audio,r as blocks,q as chatbot,i as checkbox,d as code,t as color_picker,s as common,n as dataframe,C as default,c as dropdown,l as errors,u as file,p as highlighted_text,m as image,_ as label,g as login,f as number,v as plot,h as radio,b as slider,S as upload_text,w as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/quadrantDiagram-AYHSOK5B-PRy5QUyE.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/quadrantDiagram-AYHSOK5B-PRy5QUyE.js new file mode 100644 index 0000000000000000000000000000000000000000..ff9062a1973840e61dfab9372a3145be1c50e20b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/quadrantDiagram-AYHSOK5B-PRy5QUyE.js @@ -0,0 +1,7 @@ +import{s as be,g as Se,q as te,p as _e,a as Ae,b as ke,_ as r,c as Et,l as mt,d as Fe,y as Pe,F as D,h as ve,L as Ce}from"./mermaid.core-7TB2QPZo.js";import{l as $t}from"./linear-8mDBZVC7.js";import{s as vt}from"./select-BigU4G0v.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";import"./init-Dmth1JHB.js";import"./defaultLocale-CzDG__Ur.js";var Ct=(function(){var t=r(function(M,s,l,u){for(l=l||{},u=M.length;u--;l[M[u]]=s);return l},"o"),a=[1,3],p=[1,4],f=[1,5],o=[1,6],x=[1,7],_=[1,4,5,10,12,13,14,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],h=[1,4,5,10,12,13,14,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[55,56,57],S=[2,36],q=[1,37],b=[1,36],y=[1,38],T=[1,35],m=[1,43],g=[1,41],rt=[1,14],ct=[1,23],dt=[1,18],ut=[1,19],xt=[1,20],ot=[1,21],bt=[1,22],lt=[1,24],i=[1,25],Dt=[1,26],zt=[1,27],Vt=[1,28],It=[1,29],W=[1,32],U=[1,33],k=[1,34],F=[1,39],P=[1,40],v=[1,42],C=[1,44],O=[1,62],H=[1,61],L=[4,5,8,10,12,13,14,18,44,47,49,55,56,57,63,64,65,66,67],wt=[1,65],Bt=[1,66],Rt=[1,67],Nt=[1,68],Wt=[1,69],Ut=[1,70],Qt=[1,71],Ot=[1,72],Ht=[1,73],Xt=[1,74],Mt=[1,75],Yt=[1,76],I=[4,5,6,7,8,9,10,11,12,13,14,15,18],G=[1,90],K=[1,91],Z=[1,92],J=[1,99],$=[1,93],tt=[1,96],et=[1,94],it=[1,95],at=[1,97],nt=[1,98],St=[1,102],jt=[10,55,56,57],R=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],_t={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:r(function(s,l,u,d,A,e,ht){var n=e.length-1;switch(A){case 23:this.$=e[n];break;case 24:this.$=e[n-1]+""+e[n];break;case 26:this.$=e[n-1]+e[n];break;case 27:this.$=[e[n].trim()];break;case 28:e[n-2].push(e[n].trim()),this.$=e[n-2];break;case 29:this.$=e[n-4],d.addClass(e[n-2],e[n]);break;case 37:this.$=[];break;case 42:this.$=e[n].trim(),d.setDiagramTitle(this.$);break;case 43:this.$=e[n].trim(),d.setAccTitle(this.$);break;case 44:case 45:this.$=e[n].trim(),d.setAccDescription(this.$);break;case 46:d.addSection(e[n].substr(8)),this.$=e[n].substr(8);break;case 47:d.addPoint(e[n-3],"",e[n-1],e[n],[]);break;case 48:d.addPoint(e[n-4],e[n-3],e[n-1],e[n],[]);break;case 49:d.addPoint(e[n-4],"",e[n-2],e[n-1],e[n]);break;case 50:d.addPoint(e[n-5],e[n-4],e[n-2],e[n-1],e[n]);break;case 51:d.setXAxisLeftText(e[n-2]),d.setXAxisRightText(e[n]);break;case 52:e[n-1].text+=" ⟶ ",d.setXAxisLeftText(e[n-1]);break;case 53:d.setXAxisLeftText(e[n]);break;case 54:d.setYAxisBottomText(e[n-2]),d.setYAxisTopText(e[n]);break;case 55:e[n-1].text+=" ⟶ ",d.setYAxisBottomText(e[n-1]);break;case 56:d.setYAxisBottomText(e[n]);break;case 57:d.setQuadrant1Text(e[n]);break;case 58:d.setQuadrant2Text(e[n]);break;case 59:d.setQuadrant3Text(e[n]);break;case 60:d.setQuadrant4Text(e[n]);break;case 64:this.$={text:e[n],type:"text"};break;case 65:this.$={text:e[n-1].text+""+e[n],type:e[n-1].type};break;case 66:this.$={text:e[n],type:"text"};break;case 67:this.$={text:e[n],type:"markdown"};break;case 68:this.$=e[n];break;case 69:this.$=e[n-1]+""+e[n];break}},"anonymous"),table:[{18:a,26:1,27:2,28:p,55:f,56:o,57:x},{1:[3]},{18:a,26:8,27:2,28:p,55:f,56:o,57:x},{18:a,26:9,27:2,28:p,55:f,56:o,57:x},t(_,[2,33],{29:10}),t(h,[2,61]),t(h,[2,62]),t(h,[2,63]),{1:[2,30]},{1:[2,31]},t(c,S,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:q,5:b,10:y,12:T,13:m,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(_,[2,34]),{27:45,55:f,56:o,57:x},t(c,[2,37]),t(c,S,{24:13,32:15,33:16,34:17,43:30,58:31,31:46,4:q,5:b,10:y,12:T,13:m,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,39]),t(c,[2,40]),t(c,[2,41]),{36:[1,47]},{38:[1,48]},{40:[1,49]},t(c,[2,45]),t(c,[2,46]),{18:[1,50]},{4:q,5:b,10:y,12:T,13:m,14:g,43:51,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:52,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:53,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:54,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:55,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:56,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,44:[1,57],47:[1,58],58:60,59:59,63:k,64:F,65:P,66:v,67:C},t(L,[2,64]),t(L,[2,66]),t(L,[2,67]),t(L,[2,70]),t(L,[2,71]),t(L,[2,72]),t(L,[2,73]),t(L,[2,74]),t(L,[2,75]),t(L,[2,76]),t(L,[2,77]),t(L,[2,78]),t(L,[2,79]),t(L,[2,80]),t(_,[2,35]),t(c,[2,38]),t(c,[2,42]),t(c,[2,43]),t(c,[2,44]),{3:64,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,21:63},t(c,[2,53],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,49:[1,77],63:k,64:F,65:P,66:v,67:C}),t(c,[2,56],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,49:[1,78],63:k,64:F,65:P,66:v,67:C}),t(c,[2,57],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,58],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,59],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,60],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),{45:[1,79]},{44:[1,80]},t(L,[2,65]),t(L,[2,81]),t(L,[2,82]),t(L,[2,83]),{3:82,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,18:[1,81]},t(I,[2,23]),t(I,[2,1]),t(I,[2,2]),t(I,[2,3]),t(I,[2,4]),t(I,[2,5]),t(I,[2,6]),t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,10]),t(I,[2,11]),t(I,[2,12]),t(c,[2,52],{58:31,43:83,4:q,5:b,10:y,12:T,13:m,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,55],{58:31,43:84,4:q,5:b,10:y,12:T,13:m,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),{46:[1,85]},{45:[1,86]},{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:88,23:87},t(I,[2,24]),t(c,[2,51],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,54],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,47],{22:88,16:89,23:100,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{46:[1,101]},t(c,[2,29],{10:St}),t(jt,[2,27],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),t(R,[2,25]),t(R,[2,13]),t(R,[2,14]),t(R,[2,15]),t(R,[2,16]),t(R,[2,17]),t(R,[2,18]),t(R,[2,19]),t(R,[2,20]),t(R,[2,21]),t(R,[2,22]),t(c,[2,49],{10:St}),t(c,[2,48],{22:88,16:89,23:104,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:105},t(R,[2,26]),t(c,[2,50],{10:St}),t(jt,[2,28],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt})],defaultActions:{8:[2,30],9:[2,31]},parseError:r(function(s,l){if(l.recoverable)this.trace(s);else{var u=new Error(s);throw u.hash=l,u}},"parseError"),parse:r(function(s){var l=this,u=[0],d=[],A=[null],e=[],ht=this.table,n="",gt=0,Gt=0,ye=2,Kt=1,Te=e.slice.call(arguments,1),E=Object.create(this.lexer),Y={yy:{}};for(var At in this.yy)Object.prototype.hasOwnProperty.call(this.yy,At)&&(Y.yy[At]=this.yy[At]);E.setInput(s,Y.yy),Y.yy.lexer=E,Y.yy.parser=this,typeof E.yylloc>"u"&&(E.yylloc={});var kt=E.yylloc;e.push(kt);var me=E.options&&E.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function qe(B){u.length=u.length-2*B,A.length=A.length-B,e.length=e.length-B}r(qe,"popStack");function Zt(){var B;return B=d.pop()||E.lex()||Kt,typeof B!="number"&&(B instanceof Array&&(d=B,B=d.pop()),B=l.symbols_[B]||B),B}r(Zt,"lex");for(var w,j,N,Ft,st={},pt,X,Jt,yt;;){if(j=u[u.length-1],this.defaultActions[j]?N=this.defaultActions[j]:((w===null||typeof w>"u")&&(w=Zt()),N=ht[j]&&ht[j][w]),typeof N>"u"||!N.length||!N[0]){var Pt="";yt=[];for(pt in ht[j])this.terminals_[pt]&&pt>ye&&yt.push("'"+this.terminals_[pt]+"'");E.showPosition?Pt="Parse error on line "+(gt+1)+`: +`+E.showPosition()+` +Expecting `+yt.join(", ")+", got '"+(this.terminals_[w]||w)+"'":Pt="Parse error on line "+(gt+1)+": Unexpected "+(w==Kt?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(Pt,{text:E.match,token:this.terminals_[w]||w,line:E.yylineno,loc:kt,expected:yt})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+j+", token: "+w);switch(N[0]){case 1:u.push(w),A.push(E.yytext),e.push(E.yylloc),u.push(N[1]),w=null,Gt=E.yyleng,n=E.yytext,gt=E.yylineno,kt=E.yylloc;break;case 2:if(X=this.productions_[N[1]][1],st.$=A[A.length-X],st._$={first_line:e[e.length-(X||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(X||1)].first_column,last_column:e[e.length-1].last_column},me&&(st._$.range=[e[e.length-(X||1)].range[0],e[e.length-1].range[1]]),Ft=this.performAction.apply(st,[n,Gt,gt,Y.yy,N[1],A,e].concat(Te)),typeof Ft<"u")return Ft;X&&(u=u.slice(0,-1*X*2),A=A.slice(0,-1*X),e=e.slice(0,-1*X)),u.push(this.productions_[N[1]][0]),A.push(st.$),e.push(st._$),Jt=ht[u[u.length-2]][u[u.length-1]],u.push(Jt);break;case 3:return!0}}return!0},"parse")},pe=(function(){var M={EOF:1,parseError:r(function(l,u){if(this.yy.parser)this.yy.parser.parseError(l,u);else throw new Error(l)},"parseError"),setInput:r(function(s,l){return this.yy=l||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:r(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var l=s.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:r(function(s){var l=s.length,u=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===d.length?this.yylloc.first_column:0)+d[d.length-u.length].length-u[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:r(function(){return this._more=!0,this},"more"),reject:r(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:r(function(s){this.unput(this.match.slice(s))},"less"),pastInput:r(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:r(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:r(function(){var s=this.pastInput(),l=new Array(s.length+1).join("-");return s+this.upcomingInput()+` +`+l+"^"},"showPosition"),test_match:r(function(s,l){var u,d,A;if(this.options.backtrack_lexer&&(A={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(A.yylloc.range=this.yylloc.range.slice(0))),d=s[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+s[0].length},this.yytext+=s[0],this.match+=s[0],this.matches=s,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(s[0].length),this.matched+=s[0],u=this.performAction.call(this,this.yy,this,l,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),u)return u;if(this._backtrack){for(var e in A)this[e]=A[e];return!1}return!1},"test_match"),next:r(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var s,l,u,d;this._more||(this.yytext="",this.match="");for(var A=this._currentRules(),e=0;el[0].length)){if(l=u,d=e,this.options.backtrack_lexer){if(s=this.test_match(u,A[e]),s!==!1)return s;if(this._backtrack){l=!1;continue}else return!1}else if(!this.options.flex)break}return l?(s=this.test_match(l,A[d]),s!==!1?s:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:r(function(){var l=this.next();return l||this.lex()},"lex"),begin:r(function(l){this.conditionStack.push(l)},"begin"),popState:r(function(){var l=this.conditionStack.length-1;return l>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:r(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:r(function(l){return l=this.conditionStack.length-1-Math.abs(l||0),l>=0?this.conditionStack[l]:"INITIAL"},"topState"),pushState:r(function(l){this.begin(l)},"pushState"),stateStackSize:r(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:r(function(l,u,d,A){switch(d){case 0:break;case 1:break;case 2:return 55;case 3:break;case 4:return this.begin("title"),35;case 5:return this.popState(),"title_value";case 6:return this.begin("acc_title"),37;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),39;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 48;case 14:return 50;case 15:return 49;case 16:return 51;case 17:return 52;case 18:return 53;case 19:return 54;case 20:return 25;case 21:this.begin("md_string");break;case 22:return"MD_STR";case 23:this.popState();break;case 24:this.begin("string");break;case 25:this.popState();break;case 26:return"STR";case 27:this.begin("class_name");break;case 28:return this.popState(),47;case 29:return this.begin("point_start"),44;case 30:return this.begin("point_x"),45;case 31:this.popState();break;case 32:this.popState(),this.begin("point_y");break;case 33:return this.popState(),46;case 34:return 28;case 35:return 4;case 36:return 11;case 37:return 64;case 38:return 10;case 39:return 65;case 40:return 65;case 41:return 14;case 42:return 13;case 43:return 67;case 44:return 66;case 45:return 12;case 46:return 8;case 47:return 5;case 48:return 18;case 49:return 56;case 50:return 63;case 51:return 57}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?: *x-axis *)/i,/^(?: *y-axis *)/i,/^(?: *--+> *)/i,/^(?: *quadrant-1 *)/i,/^(?: *quadrant-2 *)/i,/^(?: *quadrant-3 *)/i,/^(?: *quadrant-4 *)/i,/^(?:classDef\b)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?::::)/i,/^(?:^\w+)/i,/^(?:\s*:\s*\[\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?:\s*\] *)/i,/^(?:\s*,\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?: *quadrantChart *)/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s)/i,/^(?:;)/i,/^(?:[!"#$%&'*+,-.`?\\_/])/i,/^(?:$)/i],conditions:{class_name:{rules:[28],inclusive:!1},point_y:{rules:[33],inclusive:!1},point_x:{rules:[32],inclusive:!1},point_start:{rules:[30,31],inclusive:!1},acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},title:{rules:[5],inclusive:!1},md_string:{rules:[22,23],inclusive:!1},string:{rules:[25,26],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,6,8,10,13,14,15,16,17,18,19,20,21,24,27,29,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],inclusive:!0}}};return M})();_t.lexer=pe;function ft(){this.yy={}}return r(ft,"Parser"),ft.prototype=_t,_t.Parser=ft,new ft})();Ct.parser=Ct;var Le=Ct,V=Ce(),Ee=class{constructor(){this.classes=new Map,this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData()}static{r(this,"QuadrantBuilder")}getDefaultData(){return{titleText:"",quadrant1Text:"",quadrant2Text:"",quadrant3Text:"",quadrant4Text:"",xAxisLeftText:"",xAxisRightText:"",yAxisBottomText:"",yAxisTopText:"",points:[]}}getDefaultConfig(){return{showXAxis:!0,showYAxis:!0,showTitle:!0,chartHeight:D.quadrantChart?.chartWidth||500,chartWidth:D.quadrantChart?.chartHeight||500,titlePadding:D.quadrantChart?.titlePadding||10,titleFontSize:D.quadrantChart?.titleFontSize||20,quadrantPadding:D.quadrantChart?.quadrantPadding||5,xAxisLabelPadding:D.quadrantChart?.xAxisLabelPadding||5,yAxisLabelPadding:D.quadrantChart?.yAxisLabelPadding||5,xAxisLabelFontSize:D.quadrantChart?.xAxisLabelFontSize||16,yAxisLabelFontSize:D.quadrantChart?.yAxisLabelFontSize||16,quadrantLabelFontSize:D.quadrantChart?.quadrantLabelFontSize||16,quadrantTextTopPadding:D.quadrantChart?.quadrantTextTopPadding||5,pointTextPadding:D.quadrantChart?.pointTextPadding||5,pointLabelFontSize:D.quadrantChart?.pointLabelFontSize||12,pointRadius:D.quadrantChart?.pointRadius||5,xAxisPosition:D.quadrantChart?.xAxisPosition||"top",yAxisPosition:D.quadrantChart?.yAxisPosition||"left",quadrantInternalBorderStrokeWidth:D.quadrantChart?.quadrantInternalBorderStrokeWidth||1,quadrantExternalBorderStrokeWidth:D.quadrantChart?.quadrantExternalBorderStrokeWidth||2}}getDefaultThemeConfig(){return{quadrant1Fill:V.quadrant1Fill,quadrant2Fill:V.quadrant2Fill,quadrant3Fill:V.quadrant3Fill,quadrant4Fill:V.quadrant4Fill,quadrant1TextFill:V.quadrant1TextFill,quadrant2TextFill:V.quadrant2TextFill,quadrant3TextFill:V.quadrant3TextFill,quadrant4TextFill:V.quadrant4TextFill,quadrantPointFill:V.quadrantPointFill,quadrantPointTextFill:V.quadrantPointTextFill,quadrantXAxisTextFill:V.quadrantXAxisTextFill,quadrantYAxisTextFill:V.quadrantYAxisTextFill,quadrantTitleFill:V.quadrantTitleFill,quadrantInternalBorderStrokeFill:V.quadrantInternalBorderStrokeFill,quadrantExternalBorderStrokeFill:V.quadrantExternalBorderStrokeFill}}clear(){this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData(),this.classes=new Map,mt.info("clear called")}setData(t){this.data={...this.data,...t}}addPoints(t){this.data.points=[...t,...this.data.points]}addClass(t,a){this.classes.set(t,a)}setConfig(t){mt.trace("setConfig called with: ",t),this.config={...this.config,...t}}setThemeConfig(t){mt.trace("setThemeConfig called with: ",t),this.themeConfig={...this.themeConfig,...t}}calculateSpace(t,a,p,f){const o=this.config.xAxisLabelPadding*2+this.config.xAxisLabelFontSize,x={top:t==="top"&&a?o:0,bottom:t==="bottom"&&a?o:0},_=this.config.yAxisLabelPadding*2+this.config.yAxisLabelFontSize,h={left:this.config.yAxisPosition==="left"&&p?_:0,right:this.config.yAxisPosition==="right"&&p?_:0},c=this.config.titleFontSize+this.config.titlePadding*2,S={top:f?c:0},q=this.config.quadrantPadding+h.left,b=this.config.quadrantPadding+x.top+S.top,y=this.config.chartWidth-this.config.quadrantPadding*2-h.left-h.right,T=this.config.chartHeight-this.config.quadrantPadding*2-x.top-x.bottom-S.top,m=y/2,g=T/2;return{xAxisSpace:x,yAxisSpace:h,titleSpace:S,quadrantSpace:{quadrantLeft:q,quadrantTop:b,quadrantWidth:y,quadrantHalfWidth:m,quadrantHeight:T,quadrantHalfHeight:g}}}getAxisLabels(t,a,p,f){const{quadrantSpace:o,titleSpace:x}=f,{quadrantHalfHeight:_,quadrantHeight:h,quadrantLeft:c,quadrantHalfWidth:S,quadrantTop:q,quadrantWidth:b}=o,y=!!this.data.xAxisRightText,T=!!this.data.yAxisTopText,m=[];return this.data.xAxisLeftText&&a&&m.push({text:this.data.xAxisLeftText,fill:this.themeConfig.quadrantXAxisTextFill,x:c+(y?S/2:0),y:t==="top"?this.config.xAxisLabelPadding+x.top:this.config.xAxisLabelPadding+q+h+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:y?"center":"left",horizontalPos:"top",rotation:0}),this.data.xAxisRightText&&a&&m.push({text:this.data.xAxisRightText,fill:this.themeConfig.quadrantXAxisTextFill,x:c+S+(y?S/2:0),y:t==="top"?this.config.xAxisLabelPadding+x.top:this.config.xAxisLabelPadding+q+h+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:y?"center":"left",horizontalPos:"top",rotation:0}),this.data.yAxisBottomText&&p&&m.push({text:this.data.yAxisBottomText,fill:this.themeConfig.quadrantYAxisTextFill,x:this.config.yAxisPosition==="left"?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+c+b+this.config.quadrantPadding,y:q+h-(T?_/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:T?"center":"left",horizontalPos:"top",rotation:-90}),this.data.yAxisTopText&&p&&m.push({text:this.data.yAxisTopText,fill:this.themeConfig.quadrantYAxisTextFill,x:this.config.yAxisPosition==="left"?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+c+b+this.config.quadrantPadding,y:q+_-(T?_/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:T?"center":"left",horizontalPos:"top",rotation:-90}),m}getQuadrants(t){const{quadrantSpace:a}=t,{quadrantHalfHeight:p,quadrantLeft:f,quadrantHalfWidth:o,quadrantTop:x}=a,_=[{text:{text:this.data.quadrant1Text,fill:this.themeConfig.quadrant1TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:f+o,y:x,width:o,height:p,fill:this.themeConfig.quadrant1Fill},{text:{text:this.data.quadrant2Text,fill:this.themeConfig.quadrant2TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:f,y:x,width:o,height:p,fill:this.themeConfig.quadrant2Fill},{text:{text:this.data.quadrant3Text,fill:this.themeConfig.quadrant3TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:f,y:x+p,width:o,height:p,fill:this.themeConfig.quadrant3Fill},{text:{text:this.data.quadrant4Text,fill:this.themeConfig.quadrant4TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:f+o,y:x+p,width:o,height:p,fill:this.themeConfig.quadrant4Fill}];for(const h of _)h.text.x=h.x+h.width/2,this.data.points.length===0?(h.text.y=h.y+h.height/2,h.text.horizontalPos="middle"):(h.text.y=h.y+this.config.quadrantTextTopPadding,h.text.horizontalPos="top");return _}getQuadrantPoints(t){const{quadrantSpace:a}=t,{quadrantHeight:p,quadrantLeft:f,quadrantTop:o,quadrantWidth:x}=a,_=$t().domain([0,1]).range([f,x+f]),h=$t().domain([0,1]).range([p+o,o]);return this.data.points.map(S=>{const q=this.classes.get(S.className);return q&&(S={...q,...S}),{x:_(S.x),y:h(S.y),fill:S.color??this.themeConfig.quadrantPointFill,radius:S.radius??this.config.pointRadius,text:{text:S.text,fill:this.themeConfig.quadrantPointTextFill,x:_(S.x),y:h(S.y)+this.config.pointTextPadding,verticalPos:"center",horizontalPos:"top",fontSize:this.config.pointLabelFontSize,rotation:0},strokeColor:S.strokeColor??this.themeConfig.quadrantPointFill,strokeWidth:S.strokeWidth??"0px"}})}getBorders(t){const a=this.config.quadrantExternalBorderStrokeWidth/2,{quadrantSpace:p}=t,{quadrantHalfHeight:f,quadrantHeight:o,quadrantLeft:x,quadrantHalfWidth:_,quadrantTop:h,quadrantWidth:c}=p;return[{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:x-a,y1:h,x2:x+c+a,y2:h},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:x+c,y1:h+a,x2:x+c,y2:h+o-a},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:x-a,y1:h+o,x2:x+c+a,y2:h+o},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:x,y1:h+a,x2:x,y2:h+o-a},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:x+_,y1:h+a,x2:x+_,y2:h+o-a},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:x+a,y1:h+f,x2:x+c-a,y2:h+f}]}getTitle(t){if(t)return{text:this.data.titleText,fill:this.themeConfig.quadrantTitleFill,fontSize:this.config.titleFontSize,horizontalPos:"top",verticalPos:"center",rotation:0,y:this.config.titlePadding,x:this.config.chartWidth/2}}build(){const t=this.config.showXAxis&&!!(this.data.xAxisLeftText||this.data.xAxisRightText),a=this.config.showYAxis&&!!(this.data.yAxisTopText||this.data.yAxisBottomText),p=this.config.showTitle&&!!this.data.titleText,f=this.data.points.length>0?"bottom":this.config.xAxisPosition,o=this.calculateSpace(f,t,a,p);return{points:this.getQuadrantPoints(o),quadrants:this.getQuadrants(o),axisLabels:this.getAxisLabels(f,t,a,o),borderLines:this.getBorders(o),title:this.getTitle(p)}}},Tt=class extends Error{static{r(this,"InvalidStyleError")}constructor(t,a,p){super(`value for ${t} ${a} is invalid, please use a valid ${p}`),this.name="InvalidStyleError"}};function Lt(t){return!/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(t)}r(Lt,"validateHexCode");function ee(t){return!/^\d+$/.test(t)}r(ee,"validateNumber");function ie(t){return!/^\d+px$/.test(t)}r(ie,"validateSizeInPixels");var De=Et();function Q(t){return ve(t.trim(),De)}r(Q,"textSanitizer");var z=new Ee;function ae(t){z.setData({quadrant1Text:Q(t.text)})}r(ae,"setQuadrant1Text");function ne(t){z.setData({quadrant2Text:Q(t.text)})}r(ne,"setQuadrant2Text");function se(t){z.setData({quadrant3Text:Q(t.text)})}r(se,"setQuadrant3Text");function re(t){z.setData({quadrant4Text:Q(t.text)})}r(re,"setQuadrant4Text");function oe(t){z.setData({xAxisLeftText:Q(t.text)})}r(oe,"setXAxisLeftText");function le(t){z.setData({xAxisRightText:Q(t.text)})}r(le,"setXAxisRightText");function he(t){z.setData({yAxisTopText:Q(t.text)})}r(he,"setYAxisTopText");function ce(t){z.setData({yAxisBottomText:Q(t.text)})}r(ce,"setYAxisBottomText");function qt(t){const a={};for(const p of t){const[f,o]=p.trim().split(/\s*:\s*/);if(f==="radius"){if(ee(o))throw new Tt(f,o,"number");a.radius=parseInt(o)}else if(f==="color"){if(Lt(o))throw new Tt(f,o,"hex code");a.color=o}else if(f==="stroke-color"){if(Lt(o))throw new Tt(f,o,"hex code");a.strokeColor=o}else if(f==="stroke-width"){if(ie(o))throw new Tt(f,o,"number of pixels (eg. 10px)");a.strokeWidth=o}else throw new Error(`style named ${f} is not supported.`)}return a}r(qt,"parseStyles");function de(t,a,p,f,o){const x=qt(o);z.addPoints([{x:p,y:f,text:Q(t.text),className:a,...x}])}r(de,"addPoint");function ue(t,a){z.addClass(t,qt(a))}r(ue,"addClass");function xe(t){z.setConfig({chartWidth:t})}r(xe,"setWidth");function fe(t){z.setConfig({chartHeight:t})}r(fe,"setHeight");function ge(){const t=Et(),{themeVariables:a,quadrantChart:p}=t;return p&&z.setConfig(p),z.setThemeConfig({quadrant1Fill:a.quadrant1Fill,quadrant2Fill:a.quadrant2Fill,quadrant3Fill:a.quadrant3Fill,quadrant4Fill:a.quadrant4Fill,quadrant1TextFill:a.quadrant1TextFill,quadrant2TextFill:a.quadrant2TextFill,quadrant3TextFill:a.quadrant3TextFill,quadrant4TextFill:a.quadrant4TextFill,quadrantPointFill:a.quadrantPointFill,quadrantPointTextFill:a.quadrantPointTextFill,quadrantXAxisTextFill:a.quadrantXAxisTextFill,quadrantYAxisTextFill:a.quadrantYAxisTextFill,quadrantExternalBorderStrokeFill:a.quadrantExternalBorderStrokeFill,quadrantInternalBorderStrokeFill:a.quadrantInternalBorderStrokeFill,quadrantTitleFill:a.quadrantTitleFill}),z.setData({titleText:te()}),z.build()}r(ge,"getQuadrantData");var ze=r(function(){z.clear(),Pe()},"clear"),Ve={setWidth:xe,setHeight:fe,setQuadrant1Text:ae,setQuadrant2Text:ne,setQuadrant3Text:se,setQuadrant4Text:re,setXAxisLeftText:oe,setXAxisRightText:le,setYAxisTopText:he,setYAxisBottomText:ce,parseStyles:qt,addPoint:de,addClass:ue,getQuadrantData:ge,clear:ze,setAccTitle:ke,getAccTitle:Ae,setDiagramTitle:_e,getDiagramTitle:te,getAccDescription:Se,setAccDescription:be},Ie=r((t,a,p,f)=>{function o(i){return i==="top"?"hanging":"middle"}r(o,"getDominantBaseLine");function x(i){return i==="left"?"start":"middle"}r(x,"getTextAnchor");function _(i){return`translate(${i.x}, ${i.y}) rotate(${i.rotation||0})`}r(_,"getTransformation");const h=Et();mt.debug(`Rendering quadrant chart +`+t);const c=h.securityLevel;let S;c==="sandbox"&&(S=vt("#i"+a));const b=(c==="sandbox"?vt(S.nodes()[0].contentDocument.body):vt("body")).select(`[id="${a}"]`),y=b.append("g").attr("class","main"),T=h.quadrantChart?.chartWidth??500,m=h.quadrantChart?.chartHeight??500;Fe(b,m,T,h.quadrantChart?.useMaxWidth??!0),b.attr("viewBox","0 0 "+T+" "+m),f.db.setHeight(m),f.db.setWidth(T);const g=f.db.getQuadrantData(),rt=y.append("g").attr("class","quadrants"),ct=y.append("g").attr("class","border"),dt=y.append("g").attr("class","data-points"),ut=y.append("g").attr("class","labels"),xt=y.append("g").attr("class","title");g.title&&xt.append("text").attr("x",0).attr("y",0).attr("fill",g.title.fill).attr("font-size",g.title.fontSize).attr("dominant-baseline",o(g.title.horizontalPos)).attr("text-anchor",x(g.title.verticalPos)).attr("transform",_(g.title)).text(g.title.text),g.borderLines&&ct.selectAll("line").data(g.borderLines).enter().append("line").attr("x1",i=>i.x1).attr("y1",i=>i.y1).attr("x2",i=>i.x2).attr("y2",i=>i.y2).style("stroke",i=>i.strokeFill).style("stroke-width",i=>i.strokeWidth);const ot=rt.selectAll("g.quadrant").data(g.quadrants).enter().append("g").attr("class","quadrant");ot.append("rect").attr("x",i=>i.x).attr("y",i=>i.y).attr("width",i=>i.width).attr("height",i=>i.height).attr("fill",i=>i.fill),ot.append("text").attr("x",0).attr("y",0).attr("fill",i=>i.text.fill).attr("font-size",i=>i.text.fontSize).attr("dominant-baseline",i=>o(i.text.horizontalPos)).attr("text-anchor",i=>x(i.text.verticalPos)).attr("transform",i=>_(i.text)).text(i=>i.text.text),ut.selectAll("g.label").data(g.axisLabels).enter().append("g").attr("class","label").append("text").attr("x",0).attr("y",0).text(i=>i.text).attr("fill",i=>i.fill).attr("font-size",i=>i.fontSize).attr("dominant-baseline",i=>o(i.horizontalPos)).attr("text-anchor",i=>x(i.verticalPos)).attr("transform",i=>_(i));const lt=dt.selectAll("g.data-point").data(g.points).enter().append("g").attr("class","data-point");lt.append("circle").attr("cx",i=>i.x).attr("cy",i=>i.y).attr("r",i=>i.radius).attr("fill",i=>i.fill).attr("stroke",i=>i.strokeColor).attr("stroke-width",i=>i.strokeWidth),lt.append("text").attr("x",0).attr("y",0).text(i=>i.text.text).attr("fill",i=>i.text.fill).attr("font-size",i=>i.text.fontSize).attr("dominant-baseline",i=>o(i.text.horizontalPos)).attr("text-anchor",i=>x(i.text.verticalPos)).attr("transform",i=>_(i.text))},"draw"),we={draw:Ie},Me={parser:Le,db:Ve,renderer:we,styles:r(()=>"","styles")};export{Me as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/r-B6wPVr8A.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/r-B6wPVr8A.js new file mode 100644 index 0000000000000000000000000000000000000000..6200cedcd0c0052c588d7f6c373b1a9d208dc362 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/r-B6wPVr8A.js @@ -0,0 +1 @@ +function f(e){for(var n={},r=0;r=!&|~$:]/,t;function p(e,n){t=null;var r=e.next();if(r=="#")return e.skipToEnd(),"comment";if(r=="0"&&e.eat("x"))return e.eatWhile(/[\da-f]/i),"number";if(r=="."&&e.eat(/\d/))return e.match(/\d*(?:e[+\-]?\d+)?/),"number";if(/\d/.test(r))return e.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/),"number";if(r=="'"||r=='"')return n.tokenize=E(r),"string";if(r=="`")return e.match(/[^`]+`/),"string.special";if(r=="."&&e.match(/.(?:[.]|\d+)/))return"keyword";if(/[a-zA-Z\.]/.test(r)){e.eatWhile(/[\w\.]/);var i=e.current();return h.propertyIsEnumerable(i)?"atom":N.propertyIsEnumerable(i)?(A.propertyIsEnumerable(i)&&!e.match(/\s*if(\s+|$)/,!1)&&(t="block"),"keyword"):m.propertyIsEnumerable(i)?"builtin":"variable"}else return r=="%"?(e.skipTo("%")&&e.next(),"variableName.special"):r=="<"&&e.eat("-")||r=="<"&&e.match("<-")||r=="-"&&e.match(/>>?/)||r=="="&&n.ctx.argList?"operator":k.test(r)?(r=="$"||e.eatWhile(k),"operator"):/[\(\){}\[\];]/.test(r)?(t=r,r==";"?"punctuation":null):null}function E(e){return function(n,r){if(n.eat("\\")){var i=n.next();return i=="x"?n.match(/^[a-f0-9]{2}/i):(i=="u"||i=="U")&&n.eat("{")&&n.skipTo("}")?n.next():i=="u"?n.match(/^[a-f0-9]{4}/i):i=="U"?n.match(/^[a-f0-9]{8}/i):/[0-7]/.test(i)&&n.match(/^[0-7]{1,2}/),"string.special"}else{for(var l;(l=n.next())!=null;){if(l==e){r.tokenize=p;break}if(l=="\\"){n.backUp(1);break}}return"string"}}}var v=1,u=2,c=4;function o(e,n,r){e.ctx={type:n,indent:e.indent,flags:0,column:r.column(),prev:e.ctx}}function x(e,n){var r=e.ctx;e.ctx={type:r.type,indent:r.indent,flags:r.flags|n,column:r.column,prev:r.prev}}function a(e){e.indent=e.ctx.indent,e.ctx=e.ctx.prev}const I={name:"r",startState:function(e){return{tokenize:p,ctx:{type:"top",indent:-e,flags:u},indent:0,afterIdent:!1}},token:function(e,n){if(e.sol()&&((n.ctx.flags&3)==0&&(n.ctx.flags|=u),n.ctx.flags&c&&a(n),n.indent=e.indentation()),e.eatSpace())return null;var r=n.tokenize(e,n);return r!="comment"&&(n.ctx.flags&u)==0&&x(n,v),(t==";"||t=="{"||t=="}")&&n.ctx.type=="block"&&a(n),t=="{"?o(n,"}",e):t=="("?(o(n,")",e),n.afterIdent&&(n.ctx.argList=!0)):t=="["?o(n,"]",e):t=="block"?o(n,"block",e):t==n.ctx.type?a(n):n.ctx.type=="block"&&r!="comment"&&x(n,c),n.afterIdent=r=="variable"||r=="keyword",r},indent:function(e,n,r){if(e.tokenize!=p)return 0;var i=n&&n.charAt(0),l=e.ctx,d=i==l.type;return l.flags&c&&(l=l.prev),l.type=="block"?l.indent+(i=="{"?0:r.unit):l.flags&v?l.column+(d?0:1):l.indent+(d?0:r.unit)},languageData:{wordChars:".",commentTokens:{line:"#"},autocomplete:b.concat(g,s)}};export{I as r}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/range-OtVwhkKS.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/range-OtVwhkKS.js new file mode 100644 index 0000000000000000000000000000000000000000..9d2889f6f53880dca68f836ac49699c1bd4061c0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/range-OtVwhkKS.js @@ -0,0 +1 @@ +function i(n,e,r){n=+n,e=+e,r=(a=arguments.length)<2?(e=n,n=0,1):a<3?1:+r;for(var g=-1,a=Math.max(0,Math.ceil((e-n)/r))|0,h=new Array(a);++go.x)return!1}else if(f=1/this.direction.x,a=(r.x-this.origin.x)*f,c=(o.x-this.origin.x)*f,c===-1/0&&(c=1/0),a>c&&(u=a,a=c,c=u),s=Math.max(a,s),l=Math.min(c,l),s>l)return!1;if(Math.abs(this.direction.y)<1e-7){if(this.origin.yo.y)return!1}else if(f=1/this.direction.y,a=(r.y-this.origin.y)*f,c=(o.y-this.origin.y)*f,c===-1/0&&(c=1/0),a>c&&(u=a,a=c,c=u),s=Math.max(a,s),l=Math.min(c,l),s>l)return!1;if(Math.abs(this.direction.z)<1e-7){if(this.origin.zo.z)return!1}else if(f=1/this.direction.z,a=(r.z-this.origin.z)*f,c=(o.z-this.origin.z)*f,c===-1/0&&(c=1/0),a>c&&(u=a,a=c,c=u),s=Math.max(a,s),l=Math.min(c,l),s>l)return!1;return!0}intersectsBox(i,e=0){return this.intersectsBoxMinMax(i.minimum,i.maximum,e)}intersectsSphere(i,e=0){const t=i.center.x-this.origin.x,r=i.center.y-this.origin.y,o=i.center.z-this.origin.z,s=t*t+r*r+o*o,l=i.radius+e,f=l*l;if(s<=f)return!0;const a=t*this.direction.x+r*this.direction.y+o*this.direction.z;return a<0?!1:s-a*a<=f}intersectsTriangle(i,e,t){const r=h._TmpVector3[0],o=h._TmpVector3[1],s=h._TmpVector3[2],l=h._TmpVector3[3],f=h._TmpVector3[4];e.subtractToRef(i,r),t.subtractToRef(i,o),m.CrossToRef(this.direction,o,s);const a=m.Dot(r,s);if(a===0)return null;const c=1/a;this.origin.subtractToRef(i,l);const u=m.Dot(l,s)*c;if(u<-this.epsilon||u>1+this.epsilon)return null;m.CrossToRef(l,r,f);const d=m.Dot(this.direction,f)*c;if(d<-this.epsilon||u+d>1+this.epsilon)return null;const p=m.Dot(o,f)*c;return p>this.length||p<0?null:new A(1-u-d,u,p)}intersectsPlane(i){let e;const t=m.Dot(i.normal,this.direction);if(Math.abs(t)<999999997475243e-21)return null;{const r=m.Dot(i.normal,this.origin);return e=(-i.d-r)/t,e<0?e<-999999997475243e-21?null:0:e}}intersectsAxis(i,e=0){switch(i){case"y":{const t=(this.origin.y-e)/this.direction.y;return t>0?null:new m(this.origin.x+this.direction.x*-t,e,this.origin.z+this.direction.z*-t)}case"x":{const t=(this.origin.x-e)/this.direction.x;return t>0?null:new m(e,this.origin.y+this.direction.y*-t,this.origin.z+this.direction.z*-t)}case"z":{const t=(this.origin.z-e)/this.direction.z;return t>0?null:new m(this.origin.x+this.direction.x*-t,this.origin.y+this.direction.y*-t,e)}default:return null}}intersectsMesh(i,e,t,r=!1,o,s=!1){const l=R.Matrix[0];return i.getWorldMatrix().invertToRef(l),this._tmpRay?h.TransformToRef(this,l,this._tmpRay):this._tmpRay=h.Transform(this,l),i.intersects(this._tmpRay,e,t,r,o,s)}intersectsMeshes(i,e,t){t?t.length=0:t=[];for(let r=0;re.distance?1:0}intersectionSegment(i,e,t){const r=this.origin,o=R.Vector3[0],s=R.Vector3[1],l=R.Vector3[2],f=R.Vector3[3];e.subtractToRef(i,o),this.direction.scaleToRef(h._Rayl,l),r.addToRef(l,s),i.subtractToRef(r,f);const a=m.Dot(o,o),c=m.Dot(o,l),u=m.Dot(l,l),d=m.Dot(o,f),p=m.Dot(l,f),T=a*u-c*c;let g,x=T,y,k=T;Tx&&(g=x,y=p+c,k=u)),y<0?(y=0,-d<0?g=0:-d>a?g=x:(g=-d,x=a)):y>k&&(y=k,-d+c<0?g=0:-d+c>a?g=x:(g=-d+c,x=a));const P=Math.abs(g)0&&C<=this.length&&W.lengthSquared()=n.distance?null:a}function z(n,i,e,t,r,o){let s=null;const l=!!(n.activeCameras&&n.activeCameras.length>1&&n.cameraToUseForPointers!==n.activeCamera),f=n.cameraToUseForPointers||n.activeCamera,a=D.internalPickerForMesh||Z;for(let c=0;c1&&n.cameraToUseForPointers!==n.activeCamera),s=n.cameraToUseForPointers||n.activeCamera,l=D.internalPickerForMesh||Z;for(let f=0;f(n._tempPickingRay||(n._tempPickingRay=h.Zero()),V(n,i,e,l,n._tempPickingRay,o||null),n._tempPickingRay),t,r,!0);return s&&(s.ray=b(n,i,e,M.Identity(),o||null)),s}function j(n,i,e,t,r,o,s,l=!1){const f=z(n,(a,c)=>(n._tempPickingRay||(n._tempPickingRay=h.Zero()),V(n,i,e,a,n._tempPickingRay,o||null,!1,c),n._tempPickingRay),t,r,!1,s);return f&&(f.ray=b(n,i,e,M.Identity(),o||null)),f}function B(n,i,e,t,r){const o=z(n,s=>(n._pickWithRayInverseMatrix||(n._pickWithRayInverseMatrix=M.Identity()),s.invertToRef(n._pickWithRayInverseMatrix),n._cachedRayForTransform||(n._cachedRayForTransform=h.Zero()),h.TransformToRef(i,n._pickWithRayInverseMatrix,n._cachedRayForTransform),n._cachedRayForTransform),e,t,!1,r);return o&&(o.ray=i),o}function X(n,i,e,t,r,o){return E(n,s=>b(n,i,e,s,r||null),t,o)}function $(n,i,e,t){return E(n,r=>(n._pickWithRayInverseMatrix||(n._pickWithRayInverseMatrix=M.Identity()),r.invertToRef(n._pickWithRayInverseMatrix),n._cachedRayForTransform||(n._cachedRayForTransform=h.Zero()),h.TransformToRef(i,n._pickWithRayInverseMatrix,n._cachedRayForTransform),n._cachedRayForTransform),e,t)}function tt(n,i=100,e,t){return F(n,new h(m.Zero(),m.Zero(),i),i,e,t)}function F(n,i,e=100,t,r){t||(t=n.getWorldMatrix()),i.length=e,r?i.origin.copyFrom(r):i.origin.copyFrom(n.position);const o=R.Vector3[2];o.set(0,0,n._scene.useRightHandedSystem?-1:1);const s=R.Vector3[3];return m.TransformNormalToRef(o,t,s),m.NormalizeToRef(s,i.direction),i}function J(n,i){i&&(i.prototype.getForwardRay=function(e=100,t,r){return F(this,new h(m.Zero(),m.Zero(),e),e,t,r)},i.prototype.getForwardRayToRef=function(e,t=100,r,o){return F(this,e,t,r,o)}),n&&(G._IsPickingAvailable=!0,n.prototype.createPickingRay=function(e,t,r,o,s=!1){return b(this,e,t,r,o,s)})}J(I,U);I.prototype.createPickingRayToRef=function(n,i,e,t,r,o=!1,s=!1){return V(this,n,i,e,t,r,o,s)};I.prototype.createPickingRayInCameraSpace=function(n,i,e){return L(this,n,i,e)};I.prototype.createPickingRayInCameraSpaceToRef=function(n,i,e,t){return S(this,n,i,e,t)};I.prototype.pickWithBoundingInfo=function(n,i,e,t,r){return O(this,n,i,e,t,r)};I.prototype.pick=function(n,i,e,t,r,o,s=!1){return j(this,n,i,e,t,r,o,s)};I.prototype.pickWithRay=function(n,i,e,t){return B(this,n,i,e,t)};I.prototype.multiPick=function(n,i,e,t,r){return X(this,n,i,e,t,r)};I.prototype.multiPickWithRay=function(n,i,e){return $(this,n,i,e)};export{J as AddRayExtensions,b as CreatePickingRay,L as CreatePickingRayInCameraSpace,S as CreatePickingRayInCameraSpaceToRef,V as CreatePickingRayToRef,tt as GetForwardRay,F as GetForwardRayToRef,X as MultiPick,$ as MultiPickWithRay,j as Pick,O as PickWithBoundingInfo,B as PickWithRay,D as PickingCustomization,h as Ray}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/record.esm-EHLfhwCm.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/record.esm-EHLfhwCm.js new file mode 100644 index 0000000000000000000000000000000000000000..501b91b6b48f0e4ccba7502e8a4be4aef9de9065 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/record.esm-EHLfhwCm.js @@ -0,0 +1 @@ +function w(v,i,t,e){return new(t||(t=Promise))((function(s,o){function r(u){try{a(e.next(u))}catch(d){o(d)}}function n(u){try{a(e.throw(u))}catch(d){o(d)}}function a(u){var d;u.done?s(u.value):(d=u.value,d instanceof t?d:new t((function(m){m(d)}))).then(r,n)}a((e=e.apply(v,[])).next())}))}class g{constructor(){this.listeners={}}on(i,t,e){if(this.listeners[i]||(this.listeners[i]=new Set),e?.once){const s=(...o)=>{this.un(i,s),t(...o)};return this.listeners[i].add(s),()=>this.un(i,s)}return this.listeners[i].add(t),()=>this.un(i,t)}un(i,t){var e;(e=this.listeners[i])===null||e===void 0||e.delete(t)}once(i,t){return this.on(i,t,{once:!0})}unAll(){this.listeners={}}emit(i,...t){this.listeners[i]&&this.listeners[i].forEach((e=>e(...t)))}}class b extends g{constructor(i){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=i}onInit(){}_init(i){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=i,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach((i=>i())),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}}class y extends g{constructor(){super(...arguments),this.animationFrameId=null,this.isRunning=!1}start(){if(this.isRunning)return;this.isRunning=!0;const i=()=>{this.isRunning&&(this.emit("tick"),this.animationFrameId=requestAnimationFrame(i))};i()}stop(){this.isRunning=!1,this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}destroy(){this.stop()}}const D=["audio/webm","audio/wav","audio/mpeg","audio/mp4","audio/mp3"];class W extends b{constructor(i){var t,e,s,o,r,n;super(Object.assign(Object.assign({},i),{audioBitsPerSecond:(t=i.audioBitsPerSecond)!==null&&t!==void 0?t:128e3,scrollingWaveform:(e=i.scrollingWaveform)!==null&&e!==void 0&&e,scrollingWaveformWindow:(s=i.scrollingWaveformWindow)!==null&&s!==void 0?s:5,continuousWaveform:(o=i.continuousWaveform)!==null&&o!==void 0&&o,renderRecordedAudio:(r=i.renderRecordedAudio)===null||r===void 0||r,mediaRecorderTimeslice:(n=i.mediaRecorderTimeslice)!==null&&n!==void 0?n:void 0})),this.stream=null,this.mediaRecorder=null,this.dataWindow=null,this.isWaveformPaused=!1,this.lastStartTime=0,this.lastDuration=0,this.duration=0,this.micStream=null,this.recordedBlobUrl=null,this.timer=new y,this.subscriptions.push(this.timer.on("tick",(()=>{const a=performance.now()-this.lastStartTime;this.duration=this.isPaused()?this.duration:this.lastDuration+a,this.emit("record-progress",this.duration)})))}static create(i){return new W(i||{})}renderMicStream(i){var t;const e=new AudioContext,s=e.createMediaStreamSource(i),o=e.createAnalyser();s.connect(o),this.options.continuousWaveform&&(o.fftSize=32);const r=o.frequencyBinCount,n=new Float32Array(r);let a=0;this.wavesurfer&&((t=this.originalOptions)!==null&&t!==void 0||(this.originalOptions=Object.assign({},this.wavesurfer.options)),this.wavesurfer.options.interact=!1,this.options.scrollingWaveform&&(this.wavesurfer.options.cursorWidth=0));const u=setInterval((()=>{var d,m,p,f;if(!this.isWaveformPaused){if(o.getFloatTimeDomainData(n),this.options.scrollingWaveform){const l=Math.floor((this.options.scrollingWaveformWindow||0)*e.sampleRate),h=Math.min(l,this.dataWindow?this.dataWindow.length+r:r),c=new Float32Array(l);if(this.dataWindow){const R=Math.max(0,l-this.dataWindow.length);c.set(this.dataWindow.slice(-h+r),R)}c.set(n,l-r),this.dataWindow=c}else if(this.options.continuousWaveform){if(!this.dataWindow){const h=this.options.continuousWaveformDuration?Math.round(100*this.options.continuousWaveformDuration):((m=(d=this.wavesurfer)===null||d===void 0?void 0:d.getWidth())!==null&&m!==void 0?m:0)*window.devicePixelRatio;this.dataWindow=new Float32Array(h)}let l=0;for(let h=0;hl&&(l=c)}if(a+1>this.dataWindow.length){const h=new Float32Array(2*this.dataWindow.length);h.set(this.dataWindow,0),this.dataWindow=h}this.dataWindow[a]=l,a++}else this.dataWindow=n;if(this.wavesurfer){const l=((f=(p=this.dataWindow)===null||p===void 0?void 0:p.length)!==null&&f!==void 0?f:0)/100;this.wavesurfer.load("",[this.dataWindow],this.options.scrollingWaveform?this.options.scrollingWaveformWindow:l).then((()=>{this.wavesurfer&&this.options.continuousWaveform&&(this.wavesurfer.setTime(this.getDuration()/1e3),this.wavesurfer.options.minPxPerSec||this.wavesurfer.setOptions({minPxPerSec:this.wavesurfer.getWidth()/this.wavesurfer.getDuration()}))})).catch((h=>{console.error("Error rendering real-time recording data:",h)}))}}}),10);return{onDestroy:()=>{clearInterval(u),s?.disconnect(),e?.close()},onEnd:()=>{this.isWaveformPaused=!0,this.stopMic()}}}startMic(i){return w(this,void 0,void 0,(function*(){let t;this.micStream&&this.stopMic();try{t=yield navigator.mediaDevices.getUserMedia({audio:i==null||i})}catch(s){throw new Error("Error accessing the microphone: "+s.message)}const e=this.renderMicStream(t);return this.micStream=e,this.unsubscribeDestroy=this.once("destroy",e.onDestroy),this.unsubscribeRecordEnd=this.once("record-end",e.onEnd),this.stream=t,t}))}stopMic(){var i,t,e;(i=this.micStream)===null||i===void 0||i.onDestroy(),(t=this.unsubscribeDestroy)===null||t===void 0||t.call(this),(e=this.unsubscribeRecordEnd)===null||e===void 0||e.call(this),this.micStream=null,this.unsubscribeDestroy=void 0,this.unsubscribeRecordEnd=void 0,this.stream&&(this.stream.getTracks().forEach((s=>s.stop())),this.stream=null,this.mediaRecorder=null)}startRecording(i){return w(this,void 0,void 0,(function*(){const t=this.stream||(yield this.startMic(i));this.dataWindow=null;const e=this.mediaRecorder||new MediaRecorder(t,{mimeType:this.options.mimeType||D.find((r=>MediaRecorder.isTypeSupported(r))),audioBitsPerSecond:this.options.audioBitsPerSecond});this.mediaRecorder=e,this.stopRecording();const s=[];e.ondataavailable=r=>{r.data.size>0&&s.push(r.data),this.emit("record-data-available",r.data)};const o=r=>{var n;const a=new Blob(s,{type:e.mimeType});this.emit(r,a),this.options.renderRecordedAudio&&(this.applyOriginalOptionsIfNeeded(),this.recordedBlobUrl&&URL.revokeObjectURL(this.recordedBlobUrl),this.recordedBlobUrl=URL.createObjectURL(a),(n=this.wavesurfer)===null||n===void 0||n.load(this.recordedBlobUrl))};e.onpause=()=>o("record-pause"),e.onstop=()=>o("record-end"),e.start(this.options.mediaRecorderTimeslice),this.lastStartTime=performance.now(),this.lastDuration=0,this.duration=0,this.isWaveformPaused=!1,this.timer.start(),this.emit("record-start")}))}getDuration(){return this.duration}isRecording(){var i;return((i=this.mediaRecorder)===null||i===void 0?void 0:i.state)==="recording"}isPaused(){var i;return((i=this.mediaRecorder)===null||i===void 0?void 0:i.state)==="paused"}isActive(){var i;return((i=this.mediaRecorder)===null||i===void 0?void 0:i.state)!=="inactive"}stopRecording(){var i;this.isActive()&&((i=this.mediaRecorder)===null||i===void 0||i.stop(),this.timer.stop())}pauseRecording(){var i,t;this.isRecording()&&(this.isWaveformPaused=!0,(i=this.mediaRecorder)===null||i===void 0||i.requestData(),(t=this.mediaRecorder)===null||t===void 0||t.pause(),this.timer.stop(),this.lastDuration=this.duration)}resumeRecording(){var i;this.isPaused()&&(this.isWaveformPaused=!1,(i=this.mediaRecorder)===null||i===void 0||i.resume(),this.timer.start(),this.lastStartTime=performance.now(),this.emit("record-resume"))}static getAvailableAudioDevices(){return w(this,void 0,void 0,(function*(){return navigator.mediaDevices.enumerateDevices().then((i=>i.filter((t=>t.kind==="audioinput"))))}))}destroy(){this.applyOriginalOptionsIfNeeded(),super.destroy(),this.stopRecording(),this.stopMic(),this.recordedBlobUrl&&(URL.revokeObjectURL(this.recordedBlobUrl),this.recordedBlobUrl=null)}applyOriginalOptionsIfNeeded(){this.wavesurfer&&this.originalOptions&&(this.wavesurfer.setOptions(this.originalOptions),delete this.originalOptions)}}export{W as o}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/requirementDiagram-UZGBJVZJ-C2v_TNfg.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/requirementDiagram-UZGBJVZJ-C2v_TNfg.js new file mode 100644 index 0000000000000000000000000000000000000000..3b4a2baac9baae36d54281b7e836fe1e09693d86 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/requirementDiagram-UZGBJVZJ-C2v_TNfg.js @@ -0,0 +1,64 @@ +import{g as je}from"./chunk-55IACEB6-d9HCWWHk.js";import{s as Ge}from"./chunk-QN33PNHL-w0eYMV5T.js";import{_ as o,b as ze,a as Xe,s as Je,g as Ze,p as et,q as tt,c as ke,l as Ne,y as st,B as it,o as rt,r as nt,u as at}from"./mermaid.core-7TB2QPZo.js";import"./select-BigU4G0v.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";var qe=(function(){var e=o(function(P,i,a,c){for(a=a||{},c=P.length;c--;a[P[c]]=i);return a},"o"),u=[1,3],h=[1,4],r=[1,5],n=[1,6],E=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],g=[1,22],R=[2,7],_=[1,26],b=[1,27],N=[1,28],q=[1,29],A=[1,33],C=[1,34],V=[1,35],v=[1,36],x=[1,37],L=[1,38],D=[1,24],O=[1,31],w=[1,32],M=[1,30],d=[1,39],p=[1,40],m=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],$=[1,61],X=[89,90],Ae=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Ee=[27,29],Ce=[1,70],Ve=[1,71],ve=[1,72],xe=[1,73],Le=[1,74],De=[1,75],Oe=[1,76],Z=[1,83],U=[1,80],ee=[1,84],te=[1,85],se=[1,86],ie=[1,87],re=[1,88],ne=[1,89],ae=[1,90],le=[1,91],ce=[1,92],de=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Y=[63,64],we=[1,101],Me=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],T=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],B=[1,110],Q=[1,106],H=[1,107],K=[1,108],W=[1,109],j=[1,111],oe=[1,116],he=[1,117],ue=[1,114],fe=[1,115],_e={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:o(function(i,a,c,s,f,t,me){var l=t.length-1;switch(f){case 4:this.$=t[l].trim(),s.setAccTitle(this.$);break;case 5:case 6:this.$=t[l].trim(),s.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:s.setDirection("TB");break;case 18:s.setDirection("BT");break;case 19:s.setDirection("RL");break;case 20:s.setDirection("LR");break;case 21:s.addRequirement(t[l-3],t[l-4]);break;case 22:s.addRequirement(t[l-5],t[l-6]),s.setClass([t[l-5]],t[l-3]);break;case 23:s.setNewReqId(t[l-2]);break;case 24:s.setNewReqText(t[l-2]);break;case 25:s.setNewReqRisk(t[l-2]);break;case 26:s.setNewReqVerifyMethod(t[l-2]);break;case 29:this.$=s.RequirementType.REQUIREMENT;break;case 30:this.$=s.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=s.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=s.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=s.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=s.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=s.RiskLevel.LOW_RISK;break;case 36:this.$=s.RiskLevel.MED_RISK;break;case 37:this.$=s.RiskLevel.HIGH_RISK;break;case 38:this.$=s.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=s.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=s.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=s.VerifyType.VERIFY_TEST;break;case 42:s.addElement(t[l-3]);break;case 43:s.addElement(t[l-5]),s.setClass([t[l-5]],t[l-3]);break;case 44:s.setNewElementType(t[l-2]);break;case 45:s.setNewElementDocRef(t[l-2]);break;case 48:s.addRelationship(t[l-2],t[l],t[l-4]);break;case 49:s.addRelationship(t[l-2],t[l-4],t[l]);break;case 50:this.$=s.Relationships.CONTAINS;break;case 51:this.$=s.Relationships.COPIES;break;case 52:this.$=s.Relationships.DERIVES;break;case 53:this.$=s.Relationships.SATISFIES;break;case 54:this.$=s.Relationships.VERIFIES;break;case 55:this.$=s.Relationships.REFINES;break;case 56:this.$=s.Relationships.TRACES;break;case 57:this.$=t[l-2],s.defineClass(t[l-1],t[l]);break;case 58:s.setClass(t[l-1],t[l]);break;case 59:s.setClass([t[l-2]],t[l]);break;case 60:case 62:this.$=[t[l]];break;case 61:case 63:this.$=t[l-2].concat([t[l]]);break;case 64:this.$=t[l-2],s.setCssStyle(t[l-1],t[l]);break;case 65:this.$=[t[l]];break;case 66:t[l-2].push(t[l]),this.$=t[l-2];break;case 68:this.$=t[l-1]+t[l];break}},"anonymous"),table:[{3:1,4:2,6:u,9:h,11:r,13:n},{1:[3]},{3:8,4:2,5:[1,7],6:u,9:h,11:r,13:n},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(E,[2,6]),{3:12,4:2,6:u,9:h,11:r,13:n},{1:[2,2]},{4:17,5:g,7:13,8:R,9:h,11:r,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:_,22:b,23:N,24:q,25:23,33:25,41:A,42:C,43:V,44:v,45:x,46:L,54:D,72:O,74:w,77:M,89:d,90:p},e(E,[2,4]),e(E,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:g,7:42,8:R,9:h,11:r,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:_,22:b,23:N,24:q,25:23,33:25,41:A,42:C,43:V,44:v,45:x,46:L,54:D,72:O,74:w,77:M,89:d,90:p},{4:17,5:g,7:43,8:R,9:h,11:r,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:_,22:b,23:N,24:q,25:23,33:25,41:A,42:C,43:V,44:v,45:x,46:L,54:D,72:O,74:w,77:M,89:d,90:p},{4:17,5:g,7:44,8:R,9:h,11:r,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:_,22:b,23:N,24:q,25:23,33:25,41:A,42:C,43:V,44:v,45:x,46:L,54:D,72:O,74:w,77:M,89:d,90:p},{4:17,5:g,7:45,8:R,9:h,11:r,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:_,22:b,23:N,24:q,25:23,33:25,41:A,42:C,43:V,44:v,45:x,46:L,54:D,72:O,74:w,77:M,89:d,90:p},{4:17,5:g,7:46,8:R,9:h,11:r,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:_,22:b,23:N,24:q,25:23,33:25,41:A,42:C,43:V,44:v,45:x,46:L,54:D,72:O,74:w,77:M,89:d,90:p},{4:17,5:g,7:47,8:R,9:h,11:r,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:_,22:b,23:N,24:q,25:23,33:25,41:A,42:C,43:V,44:v,45:x,46:L,54:D,72:O,74:w,77:M,89:d,90:p},{4:17,5:g,7:48,8:R,9:h,11:r,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:_,22:b,23:N,24:q,25:23,33:25,41:A,42:C,43:V,44:v,45:x,46:L,54:D,72:O,74:w,77:M,89:d,90:p},{4:17,5:g,7:49,8:R,9:h,11:r,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:_,22:b,23:N,24:q,25:23,33:25,41:A,42:C,43:V,44:v,45:x,46:L,54:D,72:O,74:w,77:M,89:d,90:p},{4:17,5:g,7:50,8:R,9:h,11:r,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:_,22:b,23:N,24:q,25:23,33:25,41:A,42:C,43:V,44:v,45:x,46:L,54:D,72:O,74:w,77:M,89:d,90:p},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(m,[2,17]),e(m,[2,18]),e(m,[2,19]),e(m,[2,20]),{30:60,33:62,75:$,89:d,90:p},{30:63,33:62,75:$,89:d,90:p},{30:64,33:62,75:$,89:d,90:p},e(X,[2,29]),e(X,[2,30]),e(X,[2,31]),e(X,[2,32]),e(X,[2,33]),e(X,[2,34]),e(Ae,[2,81]),e(Ae,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(Ee,[2,79]),e(Ee,[2,80]),{27:[1,67],29:[1,68]},e(Ee,[2,85]),e(Ee,[2,86]),{62:69,65:Ce,66:Ve,67:ve,68:xe,69:Le,70:De,71:Oe},{62:77,65:Ce,66:Ve,67:ve,68:xe,69:Le,70:De,71:Oe},{30:78,33:62,75:$,89:d,90:p},{73:79,75:Z,76:U,78:81,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},e(de,[2,60]),e(de,[2,62]),{73:93,75:Z,76:U,78:81,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},{30:94,33:62,75:$,76:U,89:d,90:p},{5:[1,95]},{30:96,33:62,75:$,89:d,90:p},{5:[1,97]},{30:98,33:62,75:$,89:d,90:p},{63:[1,99]},e(Y,[2,50]),e(Y,[2,51]),e(Y,[2,52]),e(Y,[2,53]),e(Y,[2,54]),e(Y,[2,55]),e(Y,[2,56]),{64:[1,100]},e(m,[2,59],{76:U}),e(m,[2,64],{76:we}),{33:103,75:[1,102],89:d,90:p},e(Me,[2,65],{79:104,75:Z,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce}),e(T,[2,67]),e(T,[2,69]),e(T,[2,70]),e(T,[2,71]),e(T,[2,72]),e(T,[2,73]),e(T,[2,74]),e(T,[2,75]),e(T,[2,76]),e(T,[2,77]),e(T,[2,78]),e(m,[2,57],{76:we}),e(m,[2,58],{76:U}),{5:B,28:105,31:Q,34:H,36:K,38:W,40:j},{27:[1,112],76:U},{5:oe,40:he,56:113,57:ue,59:fe},{27:[1,118],76:U},{33:119,89:d,90:p},{33:120,89:d,90:p},{75:Z,78:121,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},e(de,[2,61]),e(de,[2,63]),e(T,[2,68]),e(m,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:B,28:126,31:Q,34:H,36:K,38:W,40:j},e(m,[2,28]),{5:[1,127]},e(m,[2,42]),{32:[1,128]},{32:[1,129]},{5:oe,40:he,56:130,57:ue,59:fe},e(m,[2,47]),{5:[1,131]},e(m,[2,48]),e(m,[2,49]),e(Me,[2,66],{79:104,75:Z,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce}),{33:132,89:d,90:p},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(m,[2,27]),{5:B,28:145,31:Q,34:H,36:K,38:W,40:j},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(m,[2,46]),{5:oe,40:he,56:152,57:ue,59:fe},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(m,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(m,[2,43]),{5:B,28:159,31:Q,34:H,36:K,38:W,40:j},{5:B,28:160,31:Q,34:H,36:K,38:W,40:j},{5:B,28:161,31:Q,34:H,36:K,38:W,40:j},{5:B,28:162,31:Q,34:H,36:K,38:W,40:j},{5:oe,40:he,56:163,57:ue,59:fe},{5:oe,40:he,56:164,57:ue,59:fe},e(m,[2,23]),e(m,[2,24]),e(m,[2,25]),e(m,[2,26]),e(m,[2,44]),e(m,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:o(function(i,a){if(a.recoverable)this.trace(i);else{var c=new Error(i);throw c.hash=a,c}},"parseError"),parse:o(function(i){var a=this,c=[0],s=[],f=[null],t=[],me=this.table,l="",Re=0,Fe=0,Qe=2,Pe=1,He=t.slice.call(arguments,1),y=Object.create(this.lexer),G={yy:{}};for(var Se in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Se)&&(G.yy[Se]=this.yy[Se]);y.setInput(i,G.yy),G.yy.lexer=y,G.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var Ie=y.yylloc;t.push(Ie);var Ke=y.options&&y.options.ranges;typeof G.yy.parseError=="function"?this.parseError=G.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function We(I){c.length=c.length-2*I,f.length=f.length-I,t.length=t.length-I}o(We,"popStack");function $e(){var I;return I=s.pop()||y.lex()||Pe,typeof I!="number"&&(I instanceof Array&&(s=I,I=s.pop()),I=a.symbols_[I]||I),I}o($e,"lex");for(var S,z,k,be,J={},ye,F,Ue,ge;;){if(z=c[c.length-1],this.defaultActions[z]?k=this.defaultActions[z]:((S===null||typeof S>"u")&&(S=$e()),k=me[z]&&me[z][S]),typeof k>"u"||!k.length||!k[0]){var Te="";ge=[];for(ye in me[z])this.terminals_[ye]&&ye>Qe&&ge.push("'"+this.terminals_[ye]+"'");y.showPosition?Te="Parse error on line "+(Re+1)+`: +`+y.showPosition()+` +Expecting `+ge.join(", ")+", got '"+(this.terminals_[S]||S)+"'":Te="Parse error on line "+(Re+1)+": Unexpected "+(S==Pe?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(Te,{text:y.match,token:this.terminals_[S]||S,line:y.yylineno,loc:Ie,expected:ge})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+z+", token: "+S);switch(k[0]){case 1:c.push(S),f.push(y.yytext),t.push(y.yylloc),c.push(k[1]),S=null,Fe=y.yyleng,l=y.yytext,Re=y.yylineno,Ie=y.yylloc;break;case 2:if(F=this.productions_[k[1]][1],J.$=f[f.length-F],J._$={first_line:t[t.length-(F||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(F||1)].first_column,last_column:t[t.length-1].last_column},Ke&&(J._$.range=[t[t.length-(F||1)].range[0],t[t.length-1].range[1]]),be=this.performAction.apply(J,[l,Fe,Re,G.yy,k[1],f,t].concat(He)),typeof be<"u")return be;F&&(c=c.slice(0,-1*F*2),f=f.slice(0,-1*F),t=t.slice(0,-1*F)),c.push(this.productions_[k[1]][0]),f.push(J.$),t.push(J._$),Ue=me[c[c.length-2]][c[c.length-1]],c.push(Ue);break;case 3:return!0}}return!0},"parse")},Be=(function(){var P={EOF:1,parseError:o(function(a,c){if(this.yy.parser)this.yy.parser.parseError(a,c);else throw new Error(a)},"parseError"),setInput:o(function(i,a){return this.yy=a||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var a=i.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:o(function(i){var a=i.length,c=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var f=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===s.length?this.yylloc.first_column:0)+s[s.length-c.length].length-c[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[f[0],f[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(i){this.unput(this.match.slice(i))},"less"),pastInput:o(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var i=this.pastInput(),a=new Array(i.length+1).join("-");return i+this.upcomingInput()+` +`+a+"^"},"showPosition"),test_match:o(function(i,a){var c,s,f;if(this.options.backtrack_lexer&&(f={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(f.yylloc.range=this.yylloc.range.slice(0))),s=i[0].match(/(?:\r\n?|\n).*/g),s&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],c=this.performAction.call(this,this.yy,this,a,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var t in f)this[t]=f[t];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,a,c,s;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),t=0;ta[0].length)){if(a=c,s=t,this.options.backtrack_lexer){if(i=this.test_match(c,f[t]),i!==!1)return i;if(this._backtrack){a=!1;continue}else return!1}else if(!this.options.flex)break}return a?(i=this.test_match(a,f[s]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var a=this.next();return a||this.lex()},"lex"),begin:o(function(a){this.conditionStack.push(a)},"begin"),popState:o(function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},"topState"),pushState:o(function(a){this.begin(a)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(a,c,s,f){switch(s){case 0:return"title";case 1:return this.begin("acc_title"),9;case 2:return this.popState(),"acc_title_value";case 3:return this.begin("acc_descr"),11;case 4:return this.popState(),"acc_descr_value";case 5:this.begin("acc_descr_multiline");break;case 6:this.popState();break;case 7:return"acc_descr_multiline_value";case 8:return 21;case 9:return 22;case 10:return 23;case 11:return 24;case 12:return 5;case 13:break;case 14:break;case 15:break;case 16:return 8;case 17:return 6;case 18:return 27;case 19:return 40;case 20:return 29;case 21:return 32;case 22:return 31;case 23:return 34;case 24:return 36;case 25:return 38;case 26:return 41;case 27:return 42;case 28:return 43;case 29:return 44;case 30:return 45;case 31:return 46;case 32:return 47;case 33:return 48;case 34:return 49;case 35:return 50;case 36:return 51;case 37:return 52;case 38:return 53;case 39:return 54;case 40:return 65;case 41:return 66;case 42:return 67;case 43:return 68;case 44:return 69;case 45:return 70;case 46:return 71;case 47:return 57;case 48:return 59;case 49:return this.begin("style"),77;case 50:return 75;case 51:return 81;case 52:return 88;case 53:return"PERCENT";case 54:return 86;case 55:return 84;case 56:break;case 57:this.begin("string");break;case 58:this.popState();break;case 59:return this.begin("style"),72;case 60:return this.begin("style"),74;case 61:return 61;case 62:return 64;case 63:return 63;case 64:this.begin("string");break;case 65:this.popState();break;case 66:return"qString";case 67:return c.yytext=c.yytext.trim(),89;case 68:return 75;case 69:return 80;case 70:return 76}},"anonymous"),rules:[/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::{3})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:style\b)/i,/^(?:\w+)/i,/^(?::)/i,/^(?:;)/i,/^(?:%)/i,/^(?:-)/i,/^(?:#)/i,/^(?: )/i,/^(?:["])/i,/^(?:\n)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^:,\r\n\{\<\>\-\=]*)/i,/^(?:\w+)/i,/^(?:[0-9]+)/i,/^(?:,)/i],conditions:{acc_descr_multiline:{rules:[6,7,68,69,70],inclusive:!1},acc_descr:{rules:[4,68,69,70],inclusive:!1},acc_title:{rules:[2,68,69,70],inclusive:!1},style:{rules:[50,51,52,53,54,55,56,57,58,68,69,70],inclusive:!1},unqString:{rules:[68,69,70],inclusive:!1},token:{rules:[68,69,70],inclusive:!1},string:{rules:[65,66,68,69,70],inclusive:!1},INITIAL:{rules:[0,1,3,5,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,59,60,61,62,63,64,67,68,69,70],inclusive:!0}}};return P})();_e.lexer=Be;function pe(){this.yy={}}return o(pe,"Parser"),pe.prototype=_e,_e.Parser=pe,new pe})();qe.parser=qe;var lt=qe,ct=class{constructor(){this.relations=[],this.latestRequirement=this.getInitialRequirement(),this.requirements=new Map,this.latestElement=this.getInitialElement(),this.elements=new Map,this.classes=new Map,this.direction="TB",this.RequirementType={REQUIREMENT:"Requirement",FUNCTIONAL_REQUIREMENT:"Functional Requirement",INTERFACE_REQUIREMENT:"Interface Requirement",PERFORMANCE_REQUIREMENT:"Performance Requirement",PHYSICAL_REQUIREMENT:"Physical Requirement",DESIGN_CONSTRAINT:"Design Constraint"},this.RiskLevel={LOW_RISK:"Low",MED_RISK:"Medium",HIGH_RISK:"High"},this.VerifyType={VERIFY_ANALYSIS:"Analysis",VERIFY_DEMONSTRATION:"Demonstration",VERIFY_INSPECTION:"Inspection",VERIFY_TEST:"Test"},this.Relationships={CONTAINS:"contains",COPIES:"copies",DERIVES:"derives",SATISFIES:"satisfies",VERIFIES:"verifies",REFINES:"refines",TRACES:"traces"},this.setAccTitle=ze,this.getAccTitle=Xe,this.setAccDescription=Je,this.getAccDescription=Ze,this.setDiagramTitle=et,this.getDiagramTitle=tt,this.getConfig=o(()=>ke().requirement,"getConfig"),this.clear(),this.setDirection=this.setDirection.bind(this),this.addRequirement=this.addRequirement.bind(this),this.setNewReqId=this.setNewReqId.bind(this),this.setNewReqRisk=this.setNewReqRisk.bind(this),this.setNewReqText=this.setNewReqText.bind(this),this.setNewReqVerifyMethod=this.setNewReqVerifyMethod.bind(this),this.addElement=this.addElement.bind(this),this.setNewElementType=this.setNewElementType.bind(this),this.setNewElementDocRef=this.setNewElementDocRef.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setCssStyle=this.setCssStyle.bind(this),this.setClass=this.setClass.bind(this),this.defineClass=this.defineClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}static{o(this,"RequirementDB")}getDirection(){return this.direction}setDirection(e){this.direction=e}resetLatestRequirement(){this.latestRequirement=this.getInitialRequirement()}resetLatestElement(){this.latestElement=this.getInitialElement()}getInitialRequirement(){return{requirementId:"",text:"",risk:"",verifyMethod:"",name:"",type:"",cssStyles:[],classes:["default"]}}getInitialElement(){return{name:"",type:"",docRef:"",cssStyles:[],classes:["default"]}}addRequirement(e,u){return this.requirements.has(e)||this.requirements.set(e,{name:e,type:u,requirementId:this.latestRequirement.requirementId,text:this.latestRequirement.text,risk:this.latestRequirement.risk,verifyMethod:this.latestRequirement.verifyMethod,cssStyles:[],classes:["default"]}),this.resetLatestRequirement(),this.requirements.get(e)}getRequirements(){return this.requirements}setNewReqId(e){this.latestRequirement!==void 0&&(this.latestRequirement.requirementId=e)}setNewReqText(e){this.latestRequirement!==void 0&&(this.latestRequirement.text=e)}setNewReqRisk(e){this.latestRequirement!==void 0&&(this.latestRequirement.risk=e)}setNewReqVerifyMethod(e){this.latestRequirement!==void 0&&(this.latestRequirement.verifyMethod=e)}addElement(e){return this.elements.has(e)||(this.elements.set(e,{name:e,type:this.latestElement.type,docRef:this.latestElement.docRef,cssStyles:[],classes:["default"]}),Ne.info("Added new element: ",e)),this.resetLatestElement(),this.elements.get(e)}getElements(){return this.elements}setNewElementType(e){this.latestElement!==void 0&&(this.latestElement.type=e)}setNewElementDocRef(e){this.latestElement!==void 0&&(this.latestElement.docRef=e)}addRelationship(e,u,h){this.relations.push({type:e,src:u,dst:h})}getRelationships(){return this.relations}clear(){this.relations=[],this.resetLatestRequirement(),this.requirements=new Map,this.resetLatestElement(),this.elements=new Map,this.classes=new Map,st()}setCssStyle(e,u){for(const h of e){const r=this.requirements.get(h)??this.elements.get(h);if(!u||!r)return;for(const n of u)n.includes(",")?r.cssStyles.push(...n.split(",")):r.cssStyles.push(n)}}setClass(e,u){for(const h of e){const r=this.requirements.get(h)??this.elements.get(h);if(r)for(const n of u){r.classes.push(n);const E=this.classes.get(n)?.styles;E&&r.cssStyles.push(...E)}}}defineClass(e,u){for(const h of e){let r=this.classes.get(h);r===void 0&&(r={id:h,styles:[],textStyles:[]},this.classes.set(h,r)),u&&u.forEach(function(n){if(/color/.exec(n)){const E=n.replace("fill","bgFill");r.textStyles.push(E)}r.styles.push(n)}),this.requirements.forEach(n=>{n.classes.includes(h)&&n.cssStyles.push(...u.flatMap(E=>E.split(",")))}),this.elements.forEach(n=>{n.classes.includes(h)&&n.cssStyles.push(...u.flatMap(E=>E.split(",")))})}}getClasses(){return this.classes}getData(){const e=ke(),u=[],h=[];for(const r of this.requirements.values()){const n=r;n.id=r.name,n.cssStyles=r.cssStyles,n.cssClasses=r.classes.join(" "),n.shape="requirementBox",n.look=e.look,u.push(n)}for(const r of this.elements.values()){const n=r;n.shape="requirementBox",n.look=e.look,n.id=r.name,n.cssStyles=r.cssStyles,n.cssClasses=r.classes.join(" "),u.push(n)}for(const r of this.relations){let n=0;const E=r.type===this.Relationships.CONTAINS,g={id:`${r.src}-${r.dst}-${n}`,start:this.requirements.get(r.src)?.name??this.elements.get(r.src)?.name,end:this.requirements.get(r.dst)?.name??this.elements.get(r.dst)?.name,label:`<<${r.type}>>`,classes:"relationshipLine",style:["fill:none",E?"":"stroke-dasharray: 10,7"],labelpos:"c",thickness:"normal",type:"normal",pattern:E?"normal":"dashed",arrowTypeStart:E?"requirement_contains":"",arrowTypeEnd:E?"":"requirement_arrow",look:e.look};h.push(g),n++}return{nodes:u,edges:h,other:{},config:e,direction:this.getDirection()}}},ot=o(e=>` + + marker { + fill: ${e.relationColor}; + stroke: ${e.relationColor}; + } + + marker.cross { + stroke: ${e.lineColor}; + } + + svg { + font-family: ${e.fontFamily}; + font-size: ${e.fontSize}; + } + + .reqBox { + fill: ${e.requirementBackground}; + fill-opacity: 1.0; + stroke: ${e.requirementBorderColor}; + stroke-width: ${e.requirementBorderSize}; + } + + .reqTitle, .reqLabel{ + fill: ${e.requirementTextColor}; + } + .reqLabelBox { + fill: ${e.relationLabelBackground}; + fill-opacity: 1.0; + } + + .req-title-line { + stroke: ${e.requirementBorderColor}; + stroke-width: ${e.requirementBorderSize}; + } + .relationshipLine { + stroke: ${e.relationColor}; + stroke-width: 1; + } + .relationshipLabel { + fill: ${e.relationLabelColor}; + } + .divider { + stroke: ${e.nodeBorder}; + stroke-width: 1; + } + .label { + font-family: ${e.fontFamily}; + color: ${e.nodeTextColor||e.textColor}; + } + .label text,span { + fill: ${e.nodeTextColor||e.textColor}; + color: ${e.nodeTextColor||e.textColor}; + } + .labelBkg { + background-color: ${e.edgeLabelBackground}; + } + +`,"getStyles"),ht=ot,Ye={};it(Ye,{draw:()=>ut});var ut=o(async function(e,u,h,r){Ne.info("REF0:"),Ne.info("Drawing requirement diagram (unified)",u);const{securityLevel:n,state:E,layout:g}=ke(),R=r.db.getData(),_=je(u,n);R.type=r.type,R.layoutAlgorithm=rt(g),R.nodeSpacing=E?.nodeSpacing??50,R.rankSpacing=E?.rankSpacing??50,R.markers=["requirement_contains","requirement_arrow"],R.diagramId=u,await nt(R,_);const b=8;at.insertTitle(_,"requirementDiagramTitleText",E?.titleTopMargin??25,r.db.getDiagramTitle()),Ge(_,b,"requirementDiagram",E?.useMaxWidth??!0)},"draw"),_t={parser:lt,get db(){return new ct},renderer:Ye,styles:ht};export{_t as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/rgbdDecode.fragment-CAQSGKQb.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/rgbdDecode.fragment-CAQSGKQb.js new file mode 100644 index 0000000000000000000000000000000000000000..944ce703f41b2b314ce794488ceecf59dc800186 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/rgbdDecode.fragment-CAQSGKQb.js @@ -0,0 +1,5 @@ +import{S as r}from"./index-CDrXokXW.js";import"./helperFunctions-BkWNqKeI.js";import"./index-DWyDLubb.js";const e="rgbdDecodePixelShader",o=`varying vec2 vUV;uniform sampler2D textureSampler; +#include +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) +{gl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);}`;r.ShadersStore[e]||(r.ShadersStore[e]=o);const i={name:e,shader:o};export{i as rgbdDecodePixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/rgbdDecode.fragment-DhHWySqi.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/rgbdDecode.fragment-DhHWySqi.js new file mode 100644 index 0000000000000000000000000000000000000000..73353f5b861e5ca0145601431105551bafa8ee2c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/rgbdDecode.fragment-DhHWySqi.js @@ -0,0 +1,5 @@ +import{S as r}from"./index-CDrXokXW.js";import"./helperFunctions-CZpZ-EbL.js";import"./index-DWyDLubb.js";const e="rgbdDecodePixelShader",t=`varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d; +#include +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(fromRGBD(textureSample(textureSampler,textureSamplerSampler,input.vUV)),1.0);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=t);const n={name:e,shader:t};export{n as rgbdDecodePixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/rgbdEncode.fragment-Dp82zIf3.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/rgbdEncode.fragment-Dp82zIf3.js new file mode 100644 index 0000000000000000000000000000000000000000..2dc18855dddfe7479d01deaf47456c94a9da4094 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/rgbdEncode.fragment-Dp82zIf3.js @@ -0,0 +1,5 @@ +import{S as r}from"./index-CDrXokXW.js";import"./helperFunctions-CZpZ-EbL.js";import"./index-DWyDLubb.js";const e="rgbdEncodePixelShader",t=`varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d; +#include +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=toRGBD(textureSample(textureSampler,textureSamplerSampler,input.vUV).rgb);}`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=t);const m={name:e,shader:t};export{m as rgbdEncodePixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/rgbdEncode.fragment-PqVu9J5Q.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/rgbdEncode.fragment-PqVu9J5Q.js new file mode 100644 index 0000000000000000000000000000000000000000..02a71b227d85c1132b98e822cf604e7d95daa730 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/rgbdEncode.fragment-PqVu9J5Q.js @@ -0,0 +1,5 @@ +import{S as r}from"./index-CDrXokXW.js";import"./helperFunctions-BkWNqKeI.js";import"./index-DWyDLubb.js";const e="rgbdEncodePixelShader",o=`varying vec2 vUV;uniform sampler2D textureSampler; +#include +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) +{gl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);}`;r.ShadersStore[e]||(r.ShadersStore[e]=o);const i={name:e,shader:o};export{i as rgbdEncodePixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ro-BwkPWvaL.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ro-BwkPWvaL.js new file mode 100644 index 0000000000000000000000000000000000000000..e92bfa41d0e49dfecdb59ce4c9cd3b8a0ed534b8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ro-BwkPWvaL.js @@ -0,0 +1 @@ +const e="Română",i={annotated_image:"Imagine adnotată"},a={allow_recording_access:"Vă rugăm să permiteți accesul la microfon pentru înregistrare.",audio:"Audio",record_from_microphone:"Înregistrare de la microfon",stop_recording:"Oprire înregistrare",no_device_support:"Nu se poate accesa dispozitivele media. Asigurați-vă că rulați pe o sursă sigură (https) sau localhost (sau ați transmis un certificat SSL valid la ssl_verify), și că ați permis browserului accesul la dispozitivul dvs.",stop:"Stop",resume:"Reluare",record:"Înregistrare",no_microphone:"Nu s-a găsit niciun microfon",pause:"Pauză",play:"Redare",waiting:"Așteptare",drop_to_upload:"Plasați un fișier audio aici pentru a-l încărca"},o={connection_can_break:"Pe mobil, conexiunea poate fi întreruptă dacă această filă își pierde focusul sau dispozitivul intră în modul de repaus, pierzându-vă poziția în coadă.",long_requests_queue:"Există o coadă lungă de cereri în așteptare. Duplicați acest Space pentru a o evita.",lost_connection:"Conexiune pierdută din cauza părăsirii paginii. Revenire la coadă...",waiting_for_inputs:"Așteptarea finalizării încărcării fișierului (fișierelor), vă rugăm să reîncercați."},r={checkbox:"Casetă de bifat",checkbox_group:"Grup de casete de bifat"},t={code:"Cod"},c={color_picker:"Selector de culoare"},n={built_with:"Construit cu",built_with_gradio:"Construit cu Gradio",clear:"Șterge",download:"Descarcă",edit:"Editează",empty:"Gol",error:"Eroare",hosted_on:"Găzduit pe",loading:"Se încarcă",logo:"Logo",or:"sau",remove:"Elimină",settings:"Setări",share:"Distribuie",submit:"Trimite",undo:"Anulează",no_devices:"Nu s-au găsit dispozitive",language:"Limbă",display_theme:"Temă de afișare",pwa:"Aplicație web progresivă"},s={incorrect_format:"Format incorect, sunt acceptate doar fișiere CSV și TSV",new_column:"Adaugă coloană",new_row:"Rând nou",add_row_above:"Adaugă rând deasupra",add_row_below:"Adaugă rând dedesubt",add_column_left:"Adaugă coloană la stânga",add_column_right:"Adaugă coloană la dreapta",delete_row:"Șterge rând",delete_column:"Șterge coloana",sort_column:"Sortează coloana",sort_ascending:"Sortează crescător",sort_descending:"Sortează descrescător",drop_to_upload:"Plasați fișiere CSV sau TSV aici pentru a importa datele în tabelul de date",clear_sort:"Șterge sortarea"},l={dropdown:"Listă derulantă"},u={build_error:"Există o eroare de compilare",config_error:"Există o eroare de configurare",contact_page_author:"Vă rugăm să contactați autorul paginii pentru a-l informa.",no_app_file:"Nu există fișier de aplicație",runtime_error:"Există o eroare de execuție",space_not_working:'"Space-ul nu funcționează deoarece" {0}',space_paused:"Space-ul este în pauză",use_via_api:"Utilizați prin API",use_via_api_or_mcp:"Utilizați prin API sau MCP"},d={uploading:"Se încarcă..."},p={highlighted_text:"Text evidențiat"},_={allow_webcam_access:"Vă rugăm să permiteți accesul la camera web pentru înregistrare.",brush_color:"Culoare pensulă",brush_radius:"Dimensiune pensulă",image:"Imagine",remove_image:"Elimină imaginea",select_brush_color:"Selectează culoarea pensulei",start_drawing:"Începe să desenezi",use_brush:"Folosește pensula",drop_to_upload:"Plasați un fișier imagine aici pentru a-l încărca"},g={label:"Etichetă"},m={enable_cookies:"Dacă vizitați un Space HuggingFace în modul incognito, trebuie să activați cookie-urile terțe.",incorrect_credentials:"Credențiale incorecte",username:"Nume de utilizator",password:"Parolă",login:"Autentificare"},b={number:"Număr"},f={plot:"Grafic"},v={radio:"Buton radio"},h={slider:"Glisor"},z={click_to_upload:"Click pentru încărcare",drop_audio:"Plasați audio aici",drop_csv:"Plasați CSV aici",drop_file:"Plasați fișierul aici",drop_image:"Plasați imaginea aici",drop_video:"Plasați video aici",drop_gallery:"Plasați media aici",paste_clipboard:"Lipește din clipboard"},w={drop_to_upload:"Plasați un fișier video aici pentru a-l încărca"},S={edit:"Editează",retry:"Încearcă din nou",undo:"Anulează",submit:"Trimite",cancel:"Anulează",like:"Îmi place",dislike:"Nu-mi place",clear:"Șterge conversația"},P={_name:e,"3D_model":{"3d_model":"Model 3D",drop_to_upload:"Plasați un fișier cu model 3D (.obj, .glb, .stl, .gltf, .splat sau .ply) aici pentru a-l încărca"},annotated_image:i,audio:a,blocks:o,checkbox:r,code:t,color_picker:c,common:n,dataframe:s,dropdown:l,errors:u,file:d,highlighted_text:p,image:_,label:g,login:m,number:b,plot:f,radio:v,slider:h,upload_text:z,video:w,chatbot:S};export{e as _name,i as annotated_image,a as audio,o as blocks,S as chatbot,r as checkbox,t as code,c as color_picker,n as common,s as dataframe,P as default,l as dropdown,u as errors,d as file,p as highlighted_text,_ as image,g as label,m as login,b as number,f as plot,v as radio,h as slider,z as upload_text,w as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ru-Cyxgs-16.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ru-Cyxgs-16.js new file mode 100644 index 0000000000000000000000000000000000000000..1e6de54345febb0e5a0afbb37adefd35a8c35202 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ru-Cyxgs-16.js @@ -0,0 +1 @@ +const o="Русский",e={annotated_image:"Изображение с аннотациями"},t={allow_recording_access:"Пожалуйста, разрешите доступ к микрофону для записи.",audio:"Аудио",record_from_microphone:"Запись с микрофона",stop_recording:"Остановить запись",no_device_support:"Невозможно получить доступ к медиа-устройствам. Убедитесь, что вы работаете с безопасного источника (https) или localhost (или передали действительный SSL-сертификат в ssl_verify), и что вы разрешили браузеру доступ к вашему устройству.",stop:"Стоп",resume:"Продолжить",record:"Запись",no_microphone:"Микрофон не найден",pause:"Пауза",play:"Воспроизвести",waiting:"Ожидание",drop_to_upload:"Перетащите аудиофайл сюда для загрузки"},r={connection_can_break:"На мобильном устройстве соединение может прерваться, если эта вкладка потеряет фокус или устройство перейдет в спящий режим, что приведет к потере вашего места в очереди.",long_requests_queue:"Существует длинная очередь ожидающих запросов. Создайте дубликат этого Space, чтобы пропустить очередь.",lost_connection:"Соединение потеряно из-за ухода со страницы. Возвращение в очередь...",waiting_for_inputs:"Ожидание завершения загрузки файла(ов), пожалуйста, повторите попытку."},c={checkbox:"Флажок",checkbox_group:"Группа флажков"},a={code:"Код"},_={color_picker:"Выбор цвета"},n={built_with:"Создано с помощью",built_with_gradio:"Создано с помощью Gradio",clear:"Очистить",download:"Скачать",edit:"Редактировать",empty:"Пусто",error:"Ошибка",hosted_on:"Размещено на",loading:"Загрузка",logo:"Логотип",or:"или",remove:"Удалить",settings:"Настройки",share:"Поделиться",submit:"Отправить",undo:"Отменить",no_devices:"Устройства не найдены",language:"Язык",display_theme:"Тема оформления",pwa:"Прогрессивное веб-приложение"},s={incorrect_format:"Неверный формат, поддерживаются только файлы CSV и TSV",new_column:"Добавить столбец",new_row:"Новая строка",add_row_above:"Добавить строку выше",add_row_below:"Добавить строку ниже",add_column_left:"Добавить столбец слева",add_column_right:"Добавить столбец справа",delete_row:"Удалить строку",delete_column:"Удалить столбец",sort_column:"Сортировать столбец",sort_ascending:"Сортировать по возрастанию",sort_descending:"Сортировать по убыванию",drop_to_upload:"Перетащите файлы CSV или TSV сюда для импорта данных в таблицу данных",clear_sort:"Очистить сортировку"},d={dropdown:"Выпадающий список"},i={build_error:"Произошла ошибка сборки",config_error:"Произошла ошибка конфигурации",contact_page_author:"Пожалуйста, свяжитесь с автором страницы, чтобы сообщить об этом.",no_app_file:"Отсутствует файл приложения",runtime_error:"Произошла ошибка выполнения",space_not_working:'"Space не работает, потому что" {0}',space_paused:"Space приостановлен",use_via_api:"Использовать через API",use_via_api_or_mcp:"Использовать через API или MCP"},l={uploading:"Загрузка..."},p={highlighted_text:"Выделенный текст"},u={allow_webcam_access:"Пожалуйста, разрешите доступ к веб-камере для записи.",brush_color:"Цвет кисти",brush_radius:"Размер кисти",image:"Изображение",remove_image:"Удалить изображение",select_brush_color:"Выбрать цвет кисти",start_drawing:"Начать рисование",use_brush:"Использовать кисть",drop_to_upload:"Перетащите изображение сюда для загрузки"},g={label:"Метка"},m={enable_cookies:"Если вы посещаете Space HuggingFace в режиме инкогнито, вам необходимо включить сторонние куки.",incorrect_credentials:"Неверные учетные данные",username:"Имя пользователя",password:"Пароль",login:"Войти"},h={number:"Число"},b={plot:"График"},w={radio:"Переключатель"},f={slider:"Ползунок"},k={click_to_upload:"Нажмите для загрузки",drop_audio:"Перетащите аудио сюда",drop_csv:"Перетащите CSV сюда",drop_file:"Перетащите файл сюда",drop_image:"Перетащите изображение сюда",drop_video:"Перетащите видео сюда",drop_gallery:"Перетащите медиа сюда",paste_clipboard:"Вставить из буфера обмена"},v={drop_to_upload:"Перетащите видеофайл сюда для загрузки"},S={edit:"Редактировать",retry:"Повторить",undo:"Отменить",submit:"Отправить",cancel:"Отмена",like:"Нравится",dislike:"Не нравится",clear:"Очистить чат",copy_message:"Копировать сообщение",copied_message:"Сообщение скопировано"},y={new_chat:"Новый чат",message_placeholder:"Введите сообщение...",additional_inputs:"Дополнительные поля",chatbot:"Чат-бот",conversation:"Разговор"},x={_name:o,"3D_model":{"3d_model":"3D-модель",drop_to_upload:"Перетащите сюда 3D-модель (.obj, .glb, .stl, .gltf, .splat или .ply) для загрузки"},annotated_image:e,audio:t,blocks:r,checkbox:c,code:a,color_picker:_,common:n,dataframe:s,dropdown:d,errors:i,file:l,highlighted_text:p,image:u,label:g,login:m,number:h,plot:b,radio:w,slider:f,upload_text:k,video:v,chatbot:S,chat_interface:y};export{o as _name,e as annotated_image,t as audio,r as blocks,y as chat_interface,S as chatbot,c as checkbox,a as code,_ as color_picker,n as common,s as dataframe,x as default,d as dropdown,i as errors,l as file,p as highlighted_text,u as image,g as label,m as login,h as number,b as plot,w as radio,f as slider,k as upload_text,v as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/samplerFragmentDeclaration-cxB-jdDJ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/samplerFragmentDeclaration-cxB-jdDJ.js new file mode 100644 index 0000000000000000000000000000000000000000..b783717131ba940d97350a77f5a40ed4fa482aa6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/samplerFragmentDeclaration-cxB-jdDJ.js @@ -0,0 +1,19 @@ +import{S as e}from"./index-CDrXokXW.js";const E="samplerFragmentDeclaration",_=`#ifdef _DEFINENAME_ +#if _DEFINENAME_DIRECTUV==1 +#define v_VARYINGNAME_UV vMainUV1 +#elif _DEFINENAME_DIRECTUV==2 +#define v_VARYINGNAME_UV vMainUV2 +#elif _DEFINENAME_DIRECTUV==3 +#define v_VARYINGNAME_UV vMainUV3 +#elif _DEFINENAME_DIRECTUV==4 +#define v_VARYINGNAME_UV vMainUV4 +#elif _DEFINENAME_DIRECTUV==5 +#define v_VARYINGNAME_UV vMainUV5 +#elif _DEFINENAME_DIRECTUV==6 +#define v_VARYINGNAME_UV vMainUV6 +#else +varying v_VARYINGNAME_UV: vec2f; +#endif +var _SAMPLERNAME_SamplerSampler: sampler;var _SAMPLERNAME_Sampler: texture_2d; +#endif +`;e.IncludesShadersStoreWGSL[E]||(e.IncludesShadersStoreWGSL[E]=_); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/sankeyDiagram-TZEHDZUN-DvP84S6l.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/sankeyDiagram-TZEHDZUN-DvP84S6l.js new file mode 100644 index 0000000000000000000000000000000000000000..f6812ec27442fb10f4de7b26a77b53e91f71cf34 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/sankeyDiagram-TZEHDZUN-DvP84S6l.js @@ -0,0 +1,10 @@ +import{p as mt,q as kt,s as _t,g as xt,b as vt,a as bt,_ as p,c as ot,z as St,T as wt,y as Lt,j as Et}from"./mermaid.core-7TB2QPZo.js";import{o as At}from"./ordinal-BeghXfj9.js";import{c as Tt}from"./colors-Cc3OSVma.js";import{s as G}from"./select-BigU4G0v.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";import"./init-Dmth1JHB.js";const Mt=Tt("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");function at(t,n){let s;if(n===void 0)for(const c of t)c!=null&&(s=c)&&(s=c);else{let c=-1;for(let h of t)(h=n(h,++c,t))!=null&&(s=h)&&(s=h)}return s}function dt(t,n){let s;if(n===void 0)for(const c of t)c!=null&&(s>c||s===void 0&&c>=c)&&(s=c);else{let c=-1;for(let h of t)(h=n(h,++c,t))!=null&&(s>h||s===void 0&&h>=h)&&(s=h)}return s}function J(t,n){let s=0;if(n===void 0)for(let c of t)(c=+c)&&(s+=c);else{let c=-1;for(let h of t)(h=+n(h,++c,t))&&(s+=h)}return s}function Nt(t){return t.target.depth}function It(t){return t.depth}function Pt(t,n){return n-1-t.height}function pt(t,n){return t.sourceLinks.length?t.depth:n-1}function Ct(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?dt(t.sourceLinks,Nt)-1:0}function Y(t){return function(){return t}}function lt(t,n){return q(t.source,n.source)||t.index-n.index}function ct(t,n){return q(t.target,n.target)||t.index-n.index}function q(t,n){return t.y0-n.y0}function tt(t){return t.value}function Ot(t){return t.index}function zt(t){return t.nodes}function Dt(t){return t.links}function ut(t,n){const s=t.get(n);if(!s)throw new Error("missing: "+n);return s}function ht({nodes:t}){for(const n of t){let s=n.y0,c=s;for(const h of n.sourceLinks)h.y0=s+h.width/2,s+=h.width;for(const h of n.targetLinks)h.y1=c+h.width/2,c+=h.width}}function $t(){let t=0,n=0,s=1,c=1,h=24,b=8,g,k=Ot,i=pt,o,a,_=zt,x=Dt,y=6;function v(){const e={nodes:_.apply(null,arguments),links:x.apply(null,arguments)};return M(e),T(e),N(e),C(e),w(e),ht(e),e}v.update=function(e){return ht(e),e},v.nodeId=function(e){return arguments.length?(k=typeof e=="function"?e:Y(e),v):k},v.nodeAlign=function(e){return arguments.length?(i=typeof e=="function"?e:Y(e),v):i},v.nodeSort=function(e){return arguments.length?(o=e,v):o},v.nodeWidth=function(e){return arguments.length?(h=+e,v):h},v.nodePadding=function(e){return arguments.length?(b=g=+e,v):b},v.nodes=function(e){return arguments.length?(_=typeof e=="function"?e:Y(e),v):_},v.links=function(e){return arguments.length?(x=typeof e=="function"?e:Y(e),v):x},v.linkSort=function(e){return arguments.length?(a=e,v):a},v.size=function(e){return arguments.length?(t=n=0,s=+e[0],c=+e[1],v):[s-t,c-n]},v.extent=function(e){return arguments.length?(t=+e[0][0],s=+e[1][0],n=+e[0][1],c=+e[1][1],v):[[t,n],[s,c]]},v.iterations=function(e){return arguments.length?(y=+e,v):y};function M({nodes:e,links:f}){for(const[l,r]of e.entries())r.index=l,r.sourceLinks=[],r.targetLinks=[];const u=new Map(e.map((l,r)=>[k(l,r,e),l]));for(const[l,r]of f.entries()){r.index=l;let{source:m,target:S}=r;typeof m!="object"&&(m=r.source=ut(u,m)),typeof S!="object"&&(S=r.target=ut(u,S)),m.sourceLinks.push(r),S.targetLinks.push(r)}if(a!=null)for(const{sourceLinks:l,targetLinks:r}of e)l.sort(a),r.sort(a)}function T({nodes:e}){for(const f of e)f.value=f.fixedValue===void 0?Math.max(J(f.sourceLinks,tt),J(f.targetLinks,tt)):f.fixedValue}function N({nodes:e}){const f=e.length;let u=new Set(e),l=new Set,r=0;for(;u.size;){for(const m of u){m.depth=r;for(const{target:S}of m.sourceLinks)l.add(S)}if(++r>f)throw new Error("circular link");u=l,l=new Set}}function C({nodes:e}){const f=e.length;let u=new Set(e),l=new Set,r=0;for(;u.size;){for(const m of u){m.height=r;for(const{source:S}of m.targetLinks)l.add(S)}if(++r>f)throw new Error("circular link");u=l,l=new Set}}function D({nodes:e}){const f=at(e,r=>r.depth)+1,u=(s-t-h)/(f-1),l=new Array(f);for(const r of e){const m=Math.max(0,Math.min(f-1,Math.floor(i.call(null,r,f))));r.layer=m,r.x0=t+m*u,r.x1=r.x0+h,l[m]?l[m].push(r):l[m]=[r]}if(o)for(const r of l)r.sort(o);return l}function B(e){const f=dt(e,u=>(c-n-(u.length-1)*g)/J(u,tt));for(const u of e){let l=n;for(const r of u){r.y0=l,r.y1=l+r.value*f,l=r.y1+g;for(const m of r.sourceLinks)m.width=m.value*f}l=(c-l+g)/(u.length+1);for(let r=0;ru.length)-1)),B(f);for(let u=0;u0))continue;let V=(L/R-S.y0)*f;S.y0+=V,S.y1+=V,E(S)}o===void 0&&m.sort(q),O(m,u)}}function j(e,f,u){for(let l=e.length,r=l-2;r>=0;--r){const m=e[r];for(const S of m){let L=0,R=0;for(const{target:U,value:Z}of S.sourceLinks){let W=Z*(U.layer-S.layer);L+=I(S,U)*W,R+=W}if(!(R>0))continue;let V=(L/R-S.y0)*f;S.y0+=V,S.y1+=V,E(S)}o===void 0&&m.sort(q),O(m,u)}}function O(e,f){const u=e.length>>1,l=e[u];d(e,l.y0-g,u-1,f),z(e,l.y1+g,u+1,f),d(e,c,e.length-1,f),z(e,n,0,f)}function z(e,f,u,l){for(;u1e-6&&(r.y0+=m,r.y1+=m),f=r.y1+g}}function d(e,f,u,l){for(;u>=0;--u){const r=e[u],m=(r.y1-f)*l;m>1e-6&&(r.y0-=m,r.y1-=m),f=r.y0-g}}function E({sourceLinks:e,targetLinks:f}){if(a===void 0){for(const{source:{sourceLinks:u}}of f)u.sort(ct);for(const{target:{targetLinks:u}}of e)u.sort(lt)}}function A(e){if(a===void 0)for(const{sourceLinks:f,targetLinks:u}of e)f.sort(ct),u.sort(lt)}function $(e,f){let u=e.y0-(e.sourceLinks.length-1)*g/2;for(const{target:l,width:r}of e.sourceLinks){if(l===f)break;u+=r+g}for(const{source:l,width:r}of f.targetLinks){if(l===e)break;u-=r}return u}function I(e,f){let u=f.y0-(f.targetLinks.length-1)*g/2;for(const{source:l,width:r}of f.targetLinks){if(l===e)break;u+=r+g}for(const{target:l,width:r}of e.sourceLinks){if(l===f)break;u-=r}return u}return v}var et=Math.PI,nt=2*et,F=1e-6,jt=nt-F;function it(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function gt(){return new it}it.prototype=gt.prototype={constructor:it,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,s,c){this._+="Q"+ +t+","+ +n+","+(this._x1=+s)+","+(this._y1=+c)},bezierCurveTo:function(t,n,s,c,h,b){this._+="C"+ +t+","+ +n+","+ +s+","+ +c+","+(this._x1=+h)+","+(this._y1=+b)},arcTo:function(t,n,s,c,h){t=+t,n=+n,s=+s,c=+c,h=+h;var b=this._x1,g=this._y1,k=s-t,i=c-n,o=b-t,a=g-n,_=o*o+a*a;if(h<0)throw new Error("negative radius: "+h);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(_>F)if(!(Math.abs(a*k-i*o)>F)||!h)this._+="L"+(this._x1=t)+","+(this._y1=n);else{var x=s-b,y=c-g,v=k*k+i*i,M=x*x+y*y,T=Math.sqrt(v),N=Math.sqrt(_),C=h*Math.tan((et-Math.acos((v+_-M)/(2*T*N)))/2),D=C/N,B=C/T;Math.abs(D-1)>F&&(this._+="L"+(t+D*o)+","+(n+D*a)),this._+="A"+h+","+h+",0,0,"+ +(a*x>o*y)+","+(this._x1=t+B*k)+","+(this._y1=n+B*i)}},arc:function(t,n,s,c,h,b){t=+t,n=+n,s=+s,b=!!b;var g=s*Math.cos(c),k=s*Math.sin(c),i=t+g,o=n+k,a=1^b,_=b?c-h:h-c;if(s<0)throw new Error("negative radius: "+s);this._x1===null?this._+="M"+i+","+o:(Math.abs(this._x1-i)>F||Math.abs(this._y1-o)>F)&&(this._+="L"+i+","+o),s&&(_<0&&(_=_%nt+nt),_>jt?this._+="A"+s+","+s+",0,1,"+a+","+(t-g)+","+(n-k)+"A"+s+","+s+",0,1,"+a+","+(this._x1=i)+","+(this._y1=o):_>F&&(this._+="A"+s+","+s+",0,"+ +(_>=et)+","+a+","+(this._x1=t+s*Math.cos(h))+","+(this._y1=n+s*Math.sin(h))))},rect:function(t,n,s,c){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +s+"v"+ +c+"h"+-s+"Z"},toString:function(){return this._}};function ft(t){return function(){return t}}function Bt(t){return t[0]}function Rt(t){return t[1]}var Ft=Array.prototype.slice;function Vt(t){return t.source}function Ut(t){return t.target}function Wt(t){var n=Vt,s=Ut,c=Bt,h=Rt,b=null;function g(){var k,i=Ft.call(arguments),o=n.apply(this,i),a=s.apply(this,i);if(b||(b=k=gt()),t(b,+c.apply(this,(i[0]=o,i)),+h.apply(this,i),+c.apply(this,(i[0]=a,i)),+h.apply(this,i)),k)return b=null,k+""||null}return g.source=function(k){return arguments.length?(n=k,g):n},g.target=function(k){return arguments.length?(s=k,g):s},g.x=function(k){return arguments.length?(c=typeof k=="function"?k:ft(+k),g):c},g.y=function(k){return arguments.length?(h=typeof k=="function"?k:ft(+k),g):h},g.context=function(k){return arguments.length?(b=k??null,g):b},g}function Gt(t,n,s,c,h){t.moveTo(n,s),t.bezierCurveTo(n=(n+c)/2,s,n,h,c,h)}function Yt(){return Wt(Gt)}function qt(t){return[t.source.x1,t.y0]}function Ht(t){return[t.target.x0,t.y1]}function Xt(){return Yt().source(qt).target(Ht)}var st=(function(){var t=p(function(k,i,o,a){for(o=o||{},a=k.length;a--;o[k[a]]=i);return o},"o"),n=[1,9],s=[1,10],c=[1,5,10,12],h={trace:p(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:p(function(i,o,a,_,x,y,v){var M=y.length-1;switch(x){case 7:const T=_.findOrCreateNode(y[M-4].trim().replaceAll('""','"')),N=_.findOrCreateNode(y[M-2].trim().replaceAll('""','"')),C=parseFloat(y[M].trim());_.addLink(T,N,C);break;case 8:case 9:case 11:this.$=y[M];break;case 10:this.$=y[M-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:s},{1:[2,6],7:11,10:[1,12]},t(s,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(c,[2,8]),t(c,[2,9]),{19:[1,16]},t(c,[2,11]),{1:[2,1]},{1:[2,5]},t(s,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:s},{15:18,16:7,17:8,18:n,20:s},{18:[1,19]},t(s,[2,3]),{12:[1,20]},t(c,[2,10]),{15:21,16:7,17:8,18:n,20:s},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:p(function(i,o){if(o.recoverable)this.trace(i);else{var a=new Error(i);throw a.hash=o,a}},"parseError"),parse:p(function(i){var o=this,a=[0],_=[],x=[null],y=[],v=this.table,M="",T=0,N=0,C=2,D=1,B=y.slice.call(arguments,1),w=Object.create(this.lexer),P={yy:{}};for(var j in this.yy)Object.prototype.hasOwnProperty.call(this.yy,j)&&(P.yy[j]=this.yy[j]);w.setInput(i,P.yy),P.yy.lexer=w,P.yy.parser=this,typeof w.yylloc>"u"&&(w.yylloc={});var O=w.yylloc;y.push(O);var z=w.options&&w.options.ranges;typeof P.yy.parseError=="function"?this.parseError=P.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function d(L){a.length=a.length-2*L,x.length=x.length-L,y.length=y.length-L}p(d,"popStack");function E(){var L;return L=_.pop()||w.lex()||D,typeof L!="number"&&(L instanceof Array&&(_=L,L=_.pop()),L=o.symbols_[L]||L),L}p(E,"lex");for(var A,$,I,e,f={},u,l,r,m;;){if($=a[a.length-1],this.defaultActions[$]?I=this.defaultActions[$]:((A===null||typeof A>"u")&&(A=E()),I=v[$]&&v[$][A]),typeof I>"u"||!I.length||!I[0]){var S="";m=[];for(u in v[$])this.terminals_[u]&&u>C&&m.push("'"+this.terminals_[u]+"'");w.showPosition?S="Parse error on line "+(T+1)+`: +`+w.showPosition()+` +Expecting `+m.join(", ")+", got '"+(this.terminals_[A]||A)+"'":S="Parse error on line "+(T+1)+": Unexpected "+(A==D?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(S,{text:w.match,token:this.terminals_[A]||A,line:w.yylineno,loc:O,expected:m})}if(I[0]instanceof Array&&I.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+A);switch(I[0]){case 1:a.push(A),x.push(w.yytext),y.push(w.yylloc),a.push(I[1]),A=null,N=w.yyleng,M=w.yytext,T=w.yylineno,O=w.yylloc;break;case 2:if(l=this.productions_[I[1]][1],f.$=x[x.length-l],f._$={first_line:y[y.length-(l||1)].first_line,last_line:y[y.length-1].last_line,first_column:y[y.length-(l||1)].first_column,last_column:y[y.length-1].last_column},z&&(f._$.range=[y[y.length-(l||1)].range[0],y[y.length-1].range[1]]),e=this.performAction.apply(f,[M,N,T,P.yy,I[1],x,y].concat(B)),typeof e<"u")return e;l&&(a=a.slice(0,-1*l*2),x=x.slice(0,-1*l),y=y.slice(0,-1*l)),a.push(this.productions_[I[1]][0]),x.push(f.$),y.push(f._$),r=v[a[a.length-2]][a[a.length-1]],a.push(r);break;case 3:return!0}}return!0},"parse")},b=(function(){var k={EOF:1,parseError:p(function(o,a){if(this.yy.parser)this.yy.parser.parseError(o,a);else throw new Error(o)},"parseError"),setInput:p(function(i,o){return this.yy=o||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:p(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var o=i.match(/(?:\r\n?|\n).*/g);return o?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:p(function(i){var o=i.length,a=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-o),this.offset-=o;var _=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var x=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===_.length?this.yylloc.first_column:0)+_[_.length-a.length].length-a[0].length:this.yylloc.first_column-o},this.options.ranges&&(this.yylloc.range=[x[0],x[0]+this.yyleng-o]),this.yyleng=this.yytext.length,this},"unput"),more:p(function(){return this._more=!0,this},"more"),reject:p(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:p(function(i){this.unput(this.match.slice(i))},"less"),pastInput:p(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:p(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:p(function(){var i=this.pastInput(),o=new Array(i.length+1).join("-");return i+this.upcomingInput()+` +`+o+"^"},"showPosition"),test_match:p(function(i,o){var a,_,x;if(this.options.backtrack_lexer&&(x={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(x.yylloc.range=this.yylloc.range.slice(0))),_=i[0].match(/(?:\r\n?|\n).*/g),_&&(this.yylineno+=_.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:_?_[_.length-1].length-_[_.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],a=this.performAction.call(this,this.yy,this,o,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a)return a;if(this._backtrack){for(var y in x)this[y]=x[y];return!1}return!1},"test_match"),next:p(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,o,a,_;this._more||(this.yytext="",this.match="");for(var x=this._currentRules(),y=0;yo[0].length)){if(o=a,_=y,this.options.backtrack_lexer){if(i=this.test_match(a,x[y]),i!==!1)return i;if(this._backtrack){o=!1;continue}else return!1}else if(!this.options.flex)break}return o?(i=this.test_match(o,x[_]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:p(function(){var o=this.next();return o||this.lex()},"lex"),begin:p(function(o){this.conditionStack.push(o)},"begin"),popState:p(function(){var o=this.conditionStack.length-1;return o>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:p(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:p(function(o){return o=this.conditionStack.length-1-Math.abs(o||0),o>=0?this.conditionStack[o]:"INITIAL"},"topState"),pushState:p(function(o){this.begin(o)},"pushState"),stateStackSize:p(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:p(function(o,a,_,x){switch(_){case 0:return this.pushState("csv"),4;case 1:return this.pushState("csv"),4;case 2:return 10;case 3:return 5;case 4:return 12;case 5:return this.pushState("escaped_text"),18;case 6:return 20;case 7:return this.popState("escaped_text"),18;case 8:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:sankey\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[2,3,4,5,6,7,8],inclusive:!1},escaped_text:{rules:[7,8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}};return k})();h.lexer=b;function g(){this.yy={}}return p(g,"Parser"),g.prototype=h,h.Parser=g,new g})();st.parser=st;var H=st,Q=[],K=[],X=new Map,Qt=p(()=>{Q=[],K=[],X=new Map,Lt()},"clear"),Kt=class{constructor(t,n,s=0){this.source=t,this.target=n,this.value=s}static{p(this,"SankeyLink")}},Zt=p((t,n,s)=>{Q.push(new Kt(t,n,s))},"addLink"),Jt=class{constructor(t){this.ID=t}static{p(this,"SankeyNode")}},te=p(t=>{t=Et.sanitizeText(t,ot());let n=X.get(t);return n===void 0&&(n=new Jt(t),X.set(t,n),K.push(n)),n},"findOrCreateNode"),ee=p(()=>K,"getNodes"),ne=p(()=>Q,"getLinks"),ie=p(()=>({nodes:K.map(t=>({id:t.ID})),links:Q.map(t=>({source:t.source.ID,target:t.target.ID,value:t.value}))}),"getGraph"),se={nodesMap:X,getConfig:p(()=>ot().sankey,"getConfig"),getNodes:ee,getLinks:ne,getGraph:ie,addLink:Zt,findOrCreateNode:te,getAccTitle:bt,setAccTitle:vt,getAccDescription:xt,setAccDescription:_t,getDiagramTitle:kt,setDiagramTitle:mt,clear:Qt},yt=class rt{static{p(this,"Uid")}static{this.count=0}static next(n){return new rt(n+ ++rt.count)}constructor(n){this.id=n,this.href=`#${n}`}toString(){return"url("+this.href+")"}},re={left:It,right:Pt,center:Ct,justify:pt},oe=p(function(t,n,s,c){const{securityLevel:h,sankey:b}=ot(),g=St.sankey;let k;h==="sandbox"&&(k=G("#i"+n));const i=h==="sandbox"?G(k.nodes()[0].contentDocument.body):G("body"),o=h==="sandbox"?i.select(`[id="${n}"]`):G(`[id="${n}"]`),a=b?.width??g.width,_=b?.height??g.width,x=b?.useMaxWidth??g.useMaxWidth,y=b?.nodeAlignment??g.nodeAlignment,v=b?.prefix??g.prefix,M=b?.suffix??g.suffix,T=b?.showValues??g.showValues,N=c.db.getGraph(),C=re[y];$t().nodeId(d=>d.id).nodeWidth(10).nodePadding(10+(T?15:0)).nodeAlign(C).extent([[0,0],[a,_]])(N);const w=At(Mt);o.append("g").attr("class","nodes").selectAll(".node").data(N.nodes).join("g").attr("class","node").attr("id",d=>(d.uid=yt.next("node-")).id).attr("transform",function(d){return"translate("+d.x0+","+d.y0+")"}).attr("x",d=>d.x0).attr("y",d=>d.y0).append("rect").attr("height",d=>d.y1-d.y0).attr("width",d=>d.x1-d.x0).attr("fill",d=>w(d.id));const P=p(({id:d,value:E})=>T?`${d} +${v}${Math.round(E*100)/100}${M}`:d,"getText");o.append("g").attr("class","node-labels").attr("font-size",14).selectAll("text").data(N.nodes).join("text").attr("x",d=>d.x0
          (d.y1+d.y0)/2).attr("dy",`${T?"0":"0.35"}em`).attr("text-anchor",d=>d.x0(E.uid=yt.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",E=>E.source.x1).attr("x2",E=>E.target.x0);d.append("stop").attr("offset","0%").attr("stop-color",E=>w(E.source.id)),d.append("stop").attr("offset","100%").attr("stop-color",E=>w(E.target.id))}let z;switch(O){case"gradient":z=p(d=>d.uid,"coloring");break;case"source":z=p(d=>w(d.source.id),"coloring");break;case"target":z=p(d=>w(d.target.id),"coloring");break;default:z=O}j.append("path").attr("d",Xt()).attr("stroke",z).attr("stroke-width",d=>Math.max(1,d.width)),wt(void 0,o,0,x)},"draw"),ae={draw:oe},le=p(t=>t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,` +`).trim(),"prepareTextForParsing"),ce=p(t=>`.label { + font-family: ${t.fontFamily}; + }`,"getStyles"),ue=ce,he=H.parse.bind(H);H.parse=t=>he(le(t));var ve={styles:ue,parser:H,db:se,renderer:ae};export{ve as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/sceneUboDeclaration-BH1tZjjY.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/sceneUboDeclaration-BH1tZjjY.js new file mode 100644 index 0000000000000000000000000000000000000000..83334bd3a6c05b2db2102f79c76f5acc866f14c2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/sceneUboDeclaration-BH1tZjjY.js @@ -0,0 +1,10 @@ +import{S as e}from"./index-CDrXokXW.js";const o="sceneUboDeclaration",n=`struct Scene {viewProjection : mat4x4, +#ifdef MULTIVIEW +viewProjectionR : mat4x4, +#endif +view : mat4x4, +projection : mat4x4, +vEyePosition : vec4,}; +#define SCENE_UBO +var scene : Scene; +`;e.IncludesShadersStoreWGSL[o]||(e.IncludesShadersStoreWGSL[o]=n); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/sceneUboDeclaration-C4vXUqkq.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/sceneUboDeclaration-C4vXUqkq.js new file mode 100644 index 0000000000000000000000000000000000000000..dc8a592975033db399d60bacf5f1e62c6f032d8a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/sceneUboDeclaration-C4vXUqkq.js @@ -0,0 +1,6 @@ +import{S as e}from"./index-CDrXokXW.js";const o="sceneUboDeclaration",t=`layout(std140,column_major) uniform;uniform Scene {mat4 viewProjection; +#ifdef MULTIVIEW +mat4 viewProjectionR; +#endif +mat4 view;mat4 projection;vec4 vEyePosition;}; +`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=t); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/select-BigU4G0v.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/select-BigU4G0v.js new file mode 100644 index 0000000000000000000000000000000000000000..6a96e5c30939a01b51990770706176549d782d3d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/select-BigU4G0v.js @@ -0,0 +1 @@ +var g="http://www.w3.org/1999/xhtml";const N={svg:"http://www.w3.org/2000/svg",xhtml:g,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function E(t){var n=t+="",e=n.indexOf(":");return e>=0&&(n=t.slice(0,e))!=="xmlns"&&(t=t.slice(e+1)),N.hasOwnProperty(n)?{space:N[n],local:t}:t}function T(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===g&&n.documentElement.namespaceURI===g?n.createElement(t):n.createElementNS(e,t)}}function k(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function b(t){var n=E(t);return(n.local?k:T)(n)}function H(){}function L(t){return t==null?H:function(){return this.querySelector(t)}}function U(t){typeof t!="function"&&(t=L(t));for(var n=this._groups,e=n.length,i=new Array(e),r=0;r=v&&(v=d+1);!(C=x[v])&&++v=0;)(l=i[r])&&(s&&l.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(l,s),s=l);return this}function yt(t){t||(t=dt);function n(_,p){return _&&p?t(_.__data__,p.__data__):!_-!p}for(var e=this._groups,i=e.length,r=new Array(i),s=0;sn?1:t>=n?0:NaN}function vt(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function mt(){return Array.from(this)}function gt(){for(var t=this._groups,n=0,e=t.length;n1?this.each((n==null?Rt:typeof n=="function"?Vt:Bt)(t,n,e??"")):Mt(this.node(),t)}function Mt(t,n){return t.style.getPropertyValue(n)||B(t).getComputedStyle(t,null).getPropertyValue(n)}function Pt(t){return function(){delete this[t]}}function qt(t,n){return function(){this[t]=n}}function It(t,n){return function(){var e=n.apply(this,arguments);e==null?delete this[t]:this[t]=e}}function Ot(t,n){return arguments.length>1?this.each((n==null?Pt:typeof n=="function"?It:qt)(t,n)):this.node()[t]}function V(t){return t.trim().split(/^|\s+/)}function w(t){return t.classList||new D(t)}function D(t){this._node=t,this._names=V(t.getAttribute("class")||"")}D.prototype={add:function(t){var n=this._names.indexOf(t);n<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function M(t,n){for(var e=w(t),i=-1,r=n.length;++i=0&&(e=n.slice(i+1),n=n.slice(0,i)),{type:n,name:e}})}function _n(t){return function(){var n=this.__on;if(n){for(var e=0,i=-1,r=n.length,s;e"u"&&(Y.yylloc={});var Wt=Y.yylloc;d.push(Wt);var Ee=Y.options&&Y.options.ranges;typeof ft.yy.parseError=="function"?this.parseError=ft.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function be(et){L.length=L.length-2*et,C.length=C.length-et,d.length=d.length-et}f(be,"popStack");function jt(){var et;return et=b.pop()||Y.lex()||$t,typeof et!="number"&&(et instanceof Array&&(b=et,et=b.pop()),et=A.symbols_[et]||et),et}f(jt,"lex");for(var J,yt,it,Ft,bt={},kt,ht,te,Pt;;){if(yt=L[L.length-1],this.defaultActions[yt]?it=this.defaultActions[yt]:((J===null||typeof J>"u")&&(J=jt()),it=vt[yt]&&vt[yt][J]),typeof it>"u"||!it.length||!it[0]){var qt="";Pt=[];for(kt in vt[yt])this.terminals_[kt]&&kt>ye&&Pt.push("'"+this.terminals_[kt]+"'");Y.showPosition?qt="Parse error on line "+(At+1)+`: +`+Y.showPosition()+` +Expecting `+Pt.join(", ")+", got '"+(this.terminals_[J]||J)+"'":qt="Parse error on line "+(At+1)+": Unexpected "+(J==$t?"end of input":"'"+(this.terminals_[J]||J)+"'"),this.parseError(qt,{text:Y.match,token:this.terminals_[J]||J,line:Y.yylineno,loc:Wt,expected:Pt})}if(it[0]instanceof Array&&it.length>1)throw new Error("Parse Error: multiple actions possible at state: "+yt+", token: "+J);switch(it[0]){case 1:L.push(J),C.push(Y.yytext),d.push(Y.yylloc),L.push(it[1]),J=null,Zt=Y.yyleng,u=Y.yytext,At=Y.yylineno,Wt=Y.yylloc;break;case 2:if(ht=this.productions_[it[1]][1],bt.$=C[C.length-ht],bt._$={first_line:d[d.length-(ht||1)].first_line,last_line:d[d.length-1].last_line,first_column:d[d.length-(ht||1)].first_column,last_column:d[d.length-1].last_column},Ee&&(bt._$.range=[d[d.length-(ht||1)].range[0],d[d.length-1].range[1]]),Ft=this.performAction.apply(bt,[u,Zt,At,ft.yy,it[1],C,d].concat(Te)),typeof Ft<"u")return Ft;ht&&(L=L.slice(0,-1*ht*2),C=C.slice(0,-1*ht),d=d.slice(0,-1*ht)),L.push(this.productions_[it[1]][0]),C.push(bt.$),d.push(bt._$),te=vt[L[L.length-2]][L[L.length-1]],L.push(te);break;case 3:return!0}}return!0},"parse")},fe=(function(){var pt={EOF:1,parseError:f(function(A,L){if(this.yy.parser)this.yy.parser.parseError(A,L);else throw new Error(A)},"parseError"),setInput:f(function(v,A){return this.yy=A||this.yy||{},this._input=v,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var v=this._input[0];this.yytext+=v,this.yyleng++,this.offset++,this.match+=v,this.matched+=v;var A=v.match(/(?:\r\n?|\n).*/g);return A?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),v},"input"),unput:f(function(v){var A=v.length,L=v.split(/(?:\r\n?|\n)/g);this._input=v+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-A),this.offset-=A;var b=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),L.length-1&&(this.yylineno-=L.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:L?(L.length===b.length?this.yylloc.first_column:0)+b[b.length-L.length].length-L[0].length:this.yylloc.first_column-A},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-A]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(v){this.unput(this.match.slice(v))},"less"),pastInput:f(function(){var v=this.matched.substr(0,this.matched.length-this.match.length);return(v.length>20?"...":"")+v.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var v=this.match;return v.length<20&&(v+=this._input.substr(0,20-v.length)),(v.substr(0,20)+(v.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var v=this.pastInput(),A=new Array(v.length+1).join("-");return v+this.upcomingInput()+` +`+A+"^"},"showPosition"),test_match:f(function(v,A){var L,b,C;if(this.options.backtrack_lexer&&(C={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(C.yylloc.range=this.yylloc.range.slice(0))),b=v[0].match(/(?:\r\n?|\n).*/g),b&&(this.yylineno+=b.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:b?b[b.length-1].length-b[b.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+v[0].length},this.yytext+=v[0],this.match+=v[0],this.matches=v,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(v[0].length),this.matched+=v[0],L=this.performAction.call(this,this.yy,this,A,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),L)return L;if(this._backtrack){for(var d in C)this[d]=C[d];return!1}return!1},"test_match"),next:f(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var v,A,L,b;this._more||(this.yytext="",this.match="");for(var C=this._currentRules(),d=0;dA[0].length)){if(A=L,b=d,this.options.backtrack_lexer){if(v=this.test_match(L,C[d]),v!==!1)return v;if(this._backtrack){A=!1;continue}else return!1}else if(!this.options.flex)break}return A?(v=this.test_match(A,C[b]),v!==!1?v:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:f(function(){var A=this.next();return A||this.lex()},"lex"),begin:f(function(A){this.conditionStack.push(A)},"begin"),popState:f(function(){var A=this.conditionStack.length-1;return A>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:f(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:f(function(A){return A=this.conditionStack.length-1-Math.abs(A||0),A>=0?this.conditionStack[A]:"INITIAL"},"topState"),pushState:f(function(A){this.begin(A)},"pushState"),stateStackSize:f(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:f(function(A,L,b,C){switch(b){case 0:return 5;case 1:break;case 2:break;case 3:break;case 4:break;case 5:break;case 6:return 19;case 7:return this.begin("CONFIG"),73;case 8:return 74;case 9:return this.popState(),this.popState(),75;case 10:return L.yytext=L.yytext.trim(),71;case 11:return L.yytext=L.yytext.trim(),this.begin("ALIAS"),71;case 12:return this.begin("LINE"),14;case 13:return this.begin("ID"),50;case 14:return this.begin("ID"),52;case 15:return 13;case 16:return this.begin("ID"),53;case 17:return L.yytext=L.yytext.trim(),this.begin("ALIAS"),71;case 18:return this.popState(),this.popState(),this.begin("LINE"),51;case 19:return this.popState(),this.popState(),5;case 20:return this.begin("LINE"),36;case 21:return this.begin("LINE"),37;case 22:return this.begin("LINE"),38;case 23:return this.begin("LINE"),39;case 24:return this.begin("LINE"),49;case 25:return this.begin("LINE"),41;case 26:return this.begin("LINE"),43;case 27:return this.begin("LINE"),48;case 28:return this.begin("LINE"),44;case 29:return this.begin("LINE"),47;case 30:return this.begin("LINE"),46;case 31:return this.popState(),15;case 32:return 16;case 33:return 66;case 34:return 67;case 35:return 60;case 36:return 61;case 37:return 62;case 38:return 63;case 39:return 58;case 40:return 55;case 41:return this.begin("ID"),21;case 42:return this.begin("ID"),23;case 43:return 29;case 44:return 30;case 45:return this.begin("acc_title"),31;case 46:return this.popState(),"acc_title_value";case 47:return this.begin("acc_descr"),33;case 48:return this.popState(),"acc_descr_value";case 49:this.begin("acc_descr_multiline");break;case 50:this.popState();break;case 51:return"acc_descr_multiline_value";case 52:return 6;case 53:return 18;case 54:return 20;case 55:return 65;case 56:return 5;case 57:return L.yytext=L.yytext.trim(),71;case 58:return 78;case 59:return 79;case 60:return 80;case 61:return 81;case 62:return 76;case 63:return 77;case 64:return 82;case 65:return 83;case 66:return 84;case 67:return 85;case 68:return 86;case 69:return 86;case 70:return 69;case 71:return 70;case 72:return 5;case 73:return"INVALID"}},"anonymous"),rules:[/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[0-9]+(?=[ \n]+))/i,/^(?:@\{)/i,/^(?:[^\}]+)/i,/^(?:\})/i,/^(?:[^\<->\->:\n,;@\s]+(?=@\{))/i,/^(?:[^\<->\->:\n,;@]+?([\-]*[^\<->\->:\n,;@]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i,/^(?:box\b)/i,/^(?:participant\b)/i,/^(?:actor\b)/i,/^(?:create\b)/i,/^(?:destroy\b)/i,/^(?:[^<\->\->:\n,;]+?([\-]*[^<\->\->:\n,;]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i,/^(?:as\b)/i,/^(?:(?:))/i,/^(?:loop\b)/i,/^(?:rect\b)/i,/^(?:opt\b)/i,/^(?:alt\b)/i,/^(?:else\b)/i,/^(?:par\b)/i,/^(?:par_over\b)/i,/^(?:and\b)/i,/^(?:critical\b)/i,/^(?:option\b)/i,/^(?:break\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:links\b)/i,/^(?:link\b)/i,/^(?:properties\b)/i,/^(?:details\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:title:\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:off\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^+<\->\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+<\->\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:<<->>)/i,/^(?:-->>)/i,/^(?:<<-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?::(?:(?:no)?wrap)?[^#\n;]*)/i,/^(?::)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[50,51],inclusive:!1},acc_descr:{rules:[48],inclusive:!1},acc_title:{rules:[46],inclusive:!1},ID:{rules:[2,3,7,10,11,17],inclusive:!1},ALIAS:{rules:[2,3,18,19],inclusive:!1},LINE:{rules:[2,3,31],inclusive:!1},CONFIG:{rules:[8,9],inclusive:!1},CONFIG_DATA:{rules:[],inclusive:!1},INITIAL:{rules:[0,1,3,4,5,6,12,13,14,15,16,20,21,22,23,24,25,26,27,28,29,30,32,33,34,35,36,37,38,39,40,41,42,43,44,45,47,49,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73],inclusive:!0}}};return pt})();Vt.lexer=fe;function _t(){this.yy={}}return f(_t,"Parser"),_t.prototype=Vt,Vt.Parser=_t,new _t})();Ht.parser=Ht;var Be=Ht,Ve={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25,AUTONUMBER:26,CRITICAL_START:27,CRITICAL_OPTION:28,CRITICAL_END:29,BREAK_START:30,BREAK_END:31,PAR_OVER_START:32,BIDIRECTIONAL_SOLID:33,BIDIRECTIONAL_DOTTED:34},Ye={FILLED:0,OPEN:1},We={LEFTOF:0,RIGHTOF:1,OVER:2},Mt={ACTOR:"actor",CONTROL:"control",DATABASE:"database",ENTITY:"entity"},Fe=class{constructor(){this.state=new Oe(()=>({prevActor:void 0,actors:new Map,createdActors:new Map,destroyedActors:new Map,boxes:[],messages:[],notes:[],sequenceNumbersEnabled:!1,wrapEnabled:void 0,currentBox:void 0,lastCreated:void 0,lastDestroyed:void 0})),this.setAccTitle=ee,this.setAccDescription=_e,this.setDiagramTitle=Ae,this.getAccTitle=ke,this.getAccDescription=Pe,this.getDiagramTitle=Ne,this.apply=this.apply.bind(this),this.parseBoxData=this.parseBoxData.bind(this),this.parseMessage=this.parseMessage.bind(this),this.clear(),this.setWrap(st().wrap),this.LINETYPE=Ve,this.ARROWTYPE=Ye,this.PLACEMENT=We}static{f(this,"SequenceDB")}addBox(e){this.state.records.boxes.push({name:e.text,wrap:e.wrap??this.autoWrap(),fill:e.color,actorKeys:[]}),this.state.records.currentBox=this.state.records.boxes.slice(-1)[0]}addActor(e,t,n,s,r){let i=this.state.records.currentBox,c;if(r!==void 0){let o;r.includes(` +`)?o=r+` +`:o=`{ +`+r+` +}`,c=Se(o,{schema:Me})}s=c?.type??s;const h=this.state.records.actors.get(e);if(h){if(this.state.records.currentBox&&h.box&&this.state.records.currentBox!==h.box)throw new Error(`A same participant should only be defined in one Box: ${h.name} can't be in '${h.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`);if(i=h.box?h.box:this.state.records.currentBox,h.box=i,h&&t===h.name&&n==null)return}if(n?.text==null&&(n={text:t,type:s}),(s==null||n.text==null)&&(n={text:t,type:s}),this.state.records.actors.set(e,{box:i,name:t,description:n.text,wrap:n.wrap??this.autoWrap(),prevActor:this.state.records.prevActor,links:{},properties:{},actorCnt:null,rectData:null,type:s??"participant"}),this.state.records.prevActor){const o=this.state.records.actors.get(this.state.records.prevActor);o&&(o.nextActor=e)}this.state.records.currentBox&&this.state.records.currentBox.actorKeys.push(e),this.state.records.prevActor=e}activationCount(e){let t,n=0;if(!e)return 0;for(t=0;t>-",token:"->>-",line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["'ACTIVE_PARTICIPANT'"]},c}return this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:e,to:t,message:n?.text??"",wrap:n?.wrap??this.autoWrap(),type:s,activate:r}),!0}hasAtLeastOneBox(){return this.state.records.boxes.length>0}hasAtLeastOneBoxWithTitle(){return this.state.records.boxes.some(e=>e.name)}getMessages(){return this.state.records.messages}getBoxes(){return this.state.records.boxes}getActors(){return this.state.records.actors}getCreatedActors(){return this.state.records.createdActors}getDestroyedActors(){return this.state.records.destroyedActors}getActor(e){return this.state.records.actors.get(e)}getActorKeys(){return[...this.state.records.actors.keys()]}enableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!0}disableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!1}showSequenceNumbers(){return this.state.records.sequenceNumbersEnabled}setWrap(e){this.state.records.wrapEnabled=e}extractWrap(e){if(e===void 0)return{};e=e.trim();const t=/^:?wrap:/.exec(e)!==null?!0:/^:?nowrap:/.exec(e)!==null?!1:void 0;return{cleanedText:(t===void 0?e:e.replace(/^:?(?:no)?wrap:/,"")).trim(),wrap:t}}autoWrap(){return this.state.records.wrapEnabled!==void 0?this.state.records.wrapEnabled:st().sequence?.wrap??!1}clear(){this.state.reset(),Re()}parseMessage(e){const t=e.trim(),{wrap:n,cleanedText:s}=this.extractWrap(t),r={text:s,wrap:n};return Q.debug(`parseMessage: ${JSON.stringify(r)}`),r}parseBoxData(e){const t=/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(e);let n=t?.[1]?t[1].trim():"transparent",s=t?.[2]?t[2].trim():void 0;if(window?.CSS)window.CSS.supports("color",n)||(n="transparent",s=e.trim());else{const c=new Option().style;c.color=n,c.color!==n&&(n="transparent",s=e.trim())}const{wrap:r,cleanedText:i}=this.extractWrap(s);return{text:i?Nt(i,st()):void 0,color:n,wrap:r}}addNote(e,t,n){const s={actor:e,placement:t,message:n.text,wrap:n.wrap??this.autoWrap()},r=[].concat(e,e);this.state.records.notes.push(s),this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:r[0],to:r[1],message:n.text,wrap:n.wrap??this.autoWrap(),type:this.LINETYPE.NOTE,placement:t})}addLinks(e,t){const n=this.getActor(e);try{let s=Nt(t.text,st());s=s.replace(/=/g,"="),s=s.replace(/&/g,"&");const r=JSON.parse(s);this.insertLinks(n,r)}catch(s){Q.error("error while parsing actor link text",s)}}addALink(e,t){const n=this.getActor(e);try{const s={};let r=Nt(t.text,st());const i=r.indexOf("@");r=r.replace(/=/g,"="),r=r.replace(/&/g,"&");const c=r.slice(0,i-1).trim(),h=r.slice(i+1).trim();s[c]=h,this.insertLinks(n,s)}catch(s){Q.error("error while parsing actor link text",s)}}insertLinks(e,t){if(e.links==null)e.links=t;else for(const n in t)e.links[n]=t[n]}addProperties(e,t){const n=this.getActor(e);try{const s=Nt(t.text,st()),r=JSON.parse(s);this.insertProperties(n,r)}catch(s){Q.error("error while parsing actor properties text",s)}}insertProperties(e,t){if(e.properties==null)e.properties=t;else for(const n in t)e.properties[n]=t[n]}boxEnd(){this.state.records.currentBox=void 0}addDetails(e,t){const n=this.getActor(e),s=document.getElementById(t.text);try{const r=s.innerHTML,i=JSON.parse(r);i.properties&&this.insertProperties(n,i.properties),i.links&&this.insertLinks(n,i.links)}catch(r){Q.error("error while parsing actor details text",r)}}getActorProperty(e,t){if(e?.properties!==void 0)return e.properties[t]}apply(e){if(Array.isArray(e))e.forEach(t=>{this.apply(t)});else switch(e.type){case"sequenceIndex":this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:void 0,to:void 0,message:{start:e.sequenceIndex,step:e.sequenceIndexStep,visible:e.sequenceVisible},wrap:!1,type:e.signalType});break;case"addParticipant":this.addActor(e.actor,e.actor,e.description,e.draw,e.config);break;case"createParticipant":if(this.state.records.actors.has(e.actor))throw new Error("It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior");this.state.records.lastCreated=e.actor,this.addActor(e.actor,e.actor,e.description,e.draw,e.config),this.state.records.createdActors.set(e.actor,this.state.records.messages.length);break;case"destroyParticipant":this.state.records.lastDestroyed=e.actor,this.state.records.destroyedActors.set(e.actor,this.state.records.messages.length);break;case"activeStart":this.addSignal(e.actor,void 0,void 0,e.signalType);break;case"activeEnd":this.addSignal(e.actor,void 0,void 0,e.signalType);break;case"addNote":this.addNote(e.actor,e.placement,e.text);break;case"addLinks":this.addLinks(e.actor,e.text);break;case"addALink":this.addALink(e.actor,e.text);break;case"addProperties":this.addProperties(e.actor,e.text);break;case"addDetails":this.addDetails(e.actor,e.text);break;case"addMessage":if(this.state.records.lastCreated){if(e.to!==this.state.records.lastCreated)throw new Error("The created participant "+this.state.records.lastCreated.name+" does not have an associated creating message after its declaration. Please check the sequence diagram.");this.state.records.lastCreated=void 0}else if(this.state.records.lastDestroyed){if(e.to!==this.state.records.lastDestroyed&&e.from!==this.state.records.lastDestroyed)throw new Error("The destroyed participant "+this.state.records.lastDestroyed.name+" does not have an associated destroying message after its declaration. Please check the sequence diagram.");this.state.records.lastDestroyed=void 0}this.addSignal(e.from,e.to,e.msg,e.signalType,e.activate);break;case"boxStart":this.addBox(e.boxData);break;case"boxEnd":this.boxEnd();break;case"loopStart":this.addSignal(void 0,void 0,e.loopText,e.signalType);break;case"loopEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"rectStart":this.addSignal(void 0,void 0,e.color,e.signalType);break;case"rectEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"optStart":this.addSignal(void 0,void 0,e.optText,e.signalType);break;case"optEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"altStart":this.addSignal(void 0,void 0,e.altText,e.signalType);break;case"else":this.addSignal(void 0,void 0,e.altText,e.signalType);break;case"altEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"setAccTitle":ee(e.text);break;case"parStart":this.addSignal(void 0,void 0,e.parText,e.signalType);break;case"and":this.addSignal(void 0,void 0,e.parText,e.signalType);break;case"parEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"criticalStart":this.addSignal(void 0,void 0,e.criticalText,e.signalType);break;case"option":this.addSignal(void 0,void 0,e.optionText,e.signalType);break;case"criticalEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break;case"breakStart":this.addSignal(void 0,void 0,e.breakText,e.signalType);break;case"breakEnd":this.addSignal(void 0,void 0,void 0,e.signalType);break}}getConfig(){return st().sequence}},qe=f(e=>`.actor { + stroke: ${e.actorBorder}; + fill: ${e.actorBkg}; + } + + text.actor > tspan { + fill: ${e.actorTextColor}; + stroke: none; + } + + .actor-line { + stroke: ${e.actorLineColor}; + } + + .innerArc { + stroke-width: 1.5; + stroke-dasharray: none; + } + + .messageLine0 { + stroke-width: 1.5; + stroke-dasharray: none; + stroke: ${e.signalColor}; + } + + .messageLine1 { + stroke-width: 1.5; + stroke-dasharray: 2, 2; + stroke: ${e.signalColor}; + } + + #arrowhead path { + fill: ${e.signalColor}; + stroke: ${e.signalColor}; + } + + .sequenceNumber { + fill: ${e.sequenceNumberColor}; + } + + #sequencenumber { + fill: ${e.signalColor}; + } + + #crosshead path { + fill: ${e.signalColor}; + stroke: ${e.signalColor}; + } + + .messageText { + fill: ${e.signalTextColor}; + stroke: none; + } + + .labelBox { + stroke: ${e.labelBoxBorderColor}; + fill: ${e.labelBoxBkgColor}; + } + + .labelText, .labelText > tspan { + fill: ${e.labelTextColor}; + stroke: none; + } + + .loopText, .loopText > tspan { + fill: ${e.loopTextColor}; + stroke: none; + } + + .loopLine { + stroke-width: 2px; + stroke-dasharray: 2, 2; + stroke: ${e.labelBoxBorderColor}; + fill: ${e.labelBoxBorderColor}; + } + + .note { + //stroke: #decc93; + stroke: ${e.noteBorderColor}; + fill: ${e.noteBkgColor}; + } + + .noteText, .noteText > tspan { + fill: ${e.noteTextColor}; + stroke: none; + } + + .activation0 { + fill: ${e.activationBkgColor}; + stroke: ${e.activationBorderColor}; + } + + .activation1 { + fill: ${e.activationBkgColor}; + stroke: ${e.activationBorderColor}; + } + + .activation2 { + fill: ${e.activationBkgColor}; + stroke: ${e.activationBorderColor}; + } + + .actorPopupMenu { + position: absolute; + } + + .actorPopupMenuPanel { + position: absolute; + fill: ${e.actorBkg}; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4)); +} + .actor-man line { + stroke: ${e.actorBorder}; + fill: ${e.actorBkg}; + } + .actor-man circle, line { + stroke: ${e.actorBorder}; + fill: ${e.actorBkg}; + stroke-width: 2px; + } + +`,"getStyles"),ze=qe,Tt=36,gt="actor-top",xt="actor-bottom",Dt="actor-box",ut="actor-man",It=f(function(e,t){return we(e,t)},"drawRect"),He=f(function(e,t,n,s,r){if(t.links===void 0||t.links===null||Object.keys(t.links).length===0)return{height:0,width:0};const i=t.links,c=t.actorCnt,h=t.rectData;var o="none";r&&(o="block !important");const a=e.append("g");a.attr("id","actor"+c+"_popup"),a.attr("class","actorPopupMenu"),a.attr("display",o);var p="";h.class!==void 0&&(p=" "+h.class);let g=h.width>n?h.width:n;const x=a.append("rect");if(x.attr("class","actorPopupMenuPanel"+p),x.attr("x",h.x),x.attr("y",h.height),x.attr("fill",h.fill),x.attr("stroke",h.stroke),x.attr("width",g),x.attr("height",h.height),x.attr("rx",h.rx),x.attr("ry",h.ry),i!=null){var y=20;for(let k in i){var m=a.append("a"),w=ae.sanitizeUrl(i[k]);m.attr("xlink:href",w),m.attr("target","_blank"),ps(s)(k,m,h.x+10,h.height+y,g,20,{class:"actor"},s),y+=30}}return x.attr("height",y),{height:h.height+y,width:g}},"drawPopup"),Ct=f(function(e){return"var pu = document.getElementById('"+e+"'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }"},"popupMenuToggle"),Rt=f(async function(e,t,n=null){let s=e.append("foreignObject");const r=await ie(t.text,zt()),c=s.append("xhtml:div").attr("style","width: fit-content;").attr("xmlns","http://www.w3.org/1999/xhtml").html(r).node().getBoundingClientRect();if(s.attr("height",Math.round(c.height)).attr("width",Math.round(c.width)),t.class==="noteText"){const h=e.node().firstChild;h.setAttribute("height",c.height+2*t.textMargin);const o=h.getBBox();s.attr("x",Math.round(o.x+o.width/2-c.width/2)).attr("y",Math.round(o.y+o.height/2-c.height/2))}else if(n){let{startx:h,stopx:o,starty:a}=n;if(h>o){const p=h;h=o,o=p}s.attr("x",Math.round(h+Math.abs(h-o)/2-c.width/2)),t.class==="loopText"?s.attr("y",Math.round(a)):s.attr("y",Math.round(a-c.height))}return[s]},"drawKatex"),wt=f(function(e,t){let n=0,s=0;const r=t.text.split(I.lineBreakRegex),[i,c]=re(t.fontSize);let h=[],o=0,a=f(()=>t.y,"yfunc");if(t.valign!==void 0&&t.textMargin!==void 0&&t.textMargin>0)switch(t.valign){case"top":case"start":a=f(()=>Math.round(t.y+t.textMargin),"yfunc");break;case"middle":case"center":a=f(()=>Math.round(t.y+(n+s+t.textMargin)/2),"yfunc");break;case"bottom":case"end":a=f(()=>Math.round(t.y+(n+s+2*t.textMargin)-t.textMargin),"yfunc");break}if(t.anchor!==void 0&&t.textMargin!==void 0&&t.width!==void 0)switch(t.anchor){case"left":case"start":t.x=Math.round(t.x+t.textMargin),t.anchor="start",t.dominantBaseline="middle",t.alignmentBaseline="middle";break;case"middle":case"center":t.x=Math.round(t.x+t.width/2),t.anchor="middle",t.dominantBaseline="middle",t.alignmentBaseline="middle";break;case"right":case"end":t.x=Math.round(t.x+t.width-t.textMargin),t.anchor="end",t.dominantBaseline="middle",t.alignmentBaseline="middle";break}for(let[p,g]of r.entries()){t.textMargin!==void 0&&t.textMargin===0&&i!==void 0&&(o=p*i);const x=e.append("text");x.attr("x",t.x),x.attr("y",a()),t.anchor!==void 0&&x.attr("text-anchor",t.anchor).attr("dominant-baseline",t.dominantBaseline).attr("alignment-baseline",t.alignmentBaseline),t.fontFamily!==void 0&&x.style("font-family",t.fontFamily),c!==void 0&&x.style("font-size",c),t.fontWeight!==void 0&&x.style("font-weight",t.fontWeight),t.fill!==void 0&&x.attr("fill",t.fill),t.class!==void 0&&x.attr("class",t.class),t.dy!==void 0?x.attr("dy",t.dy):o!==0&&x.attr("dy",o);const y=g||De;if(t.tspan){const m=x.append("tspan");m.attr("x",t.x),t.fill!==void 0&&m.attr("fill",t.fill),m.text(y)}else x.text(y);t.valign!==void 0&&t.textMargin!==void 0&&t.textMargin>0&&(s+=(x._groups||x)[0][0].getBBox().height,n=s),h.push(x)}return h},"drawText"),ne=f(function(e,t){function n(r,i,c,h,o){return r+","+i+" "+(r+c)+","+i+" "+(r+c)+","+(i+h-o)+" "+(r+c-o*1.2)+","+(i+h)+" "+r+","+(i+h)}f(n,"genPoints");const s=e.append("polygon");return s.attr("points",n(t.x,t.y,t.width,t.height,7)),s.attr("class","labelBox"),t.y=t.y+t.height/2,wt(e,t),s},"drawLabel"),P=-1,oe=f((e,t,n,s)=>{e.select&&n.forEach(r=>{const i=t.get(r),c=e.select("#actor"+i.actorCnt);!s.mirrorActors&&i.stopy?c.attr("y2",i.stopy+i.height/2):s.mirrorActors&&c.attr("y2",i.stopy)})},"fixLifeLineHeights"),Ue=f(function(e,t,n,s){const r=s?t.stopy:t.starty,i=t.x+t.width/2,c=r+t.height,h=e.append("g").lower();var o=h;s||(P++,Object.keys(t.links||{}).length&&!n.forceMenus&&o.attr("onclick",Ct(`actor${P}_popup`)).attr("cursor","pointer"),o.append("line").attr("id","actor"+P).attr("x1",i).attr("y1",c).attr("x2",i).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),o=h.append("g"),t.actorCnt=P,t.links!=null&&o.attr("id","root-"+P));const a=ct();var p="actor";t.properties?.class?p=t.properties.class:a.fill="#eaeaea",s?p+=` ${xt}`:p+=` ${gt}`,a.x=t.x,a.y=r,a.width=t.width,a.height=t.height,a.class=p,a.rx=3,a.ry=3,a.name=t.name;const g=It(o,a);if(t.rectData=a,t.properties?.icon){const y=t.properties.icon.trim();y.charAt(0)==="@"?Xt(o,a.x+a.width-20,a.y+10,y.substr(1)):Jt(o,a.x+a.width-20,a.y+10,y)}dt(n,z(t.description))(t.description,o,a.x,a.y,a.width,a.height,{class:`actor ${Dt}`},n);let x=t.height;if(g.node){const y=g.node().getBBox();t.height=y.height,x=y.height}return x},"drawActorTypeParticipant"),Ge=f(function(e,t,n,s){const r=s?t.stopy:t.starty,i=t.x+t.width/2,c=r+t.height,h=e.append("g").lower();var o=h;s||(P++,Object.keys(t.links||{}).length&&!n.forceMenus&&o.attr("onclick",Ct(`actor${P}_popup`)).attr("cursor","pointer"),o.append("line").attr("id","actor"+P).attr("x1",i).attr("y1",c).attr("x2",i).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),o=h.append("g"),t.actorCnt=P,t.links!=null&&o.attr("id","root-"+P));const a=ct();var p="actor";t.properties?.class?p=t.properties.class:a.fill="#eaeaea",s?p+=` ${xt}`:p+=` ${gt}`,a.x=t.x,a.y=r,a.width=t.width,a.height=t.height,a.class=p,a.name=t.name;const g=6,x={...a,x:a.x+-g,y:a.y+ +g,class:"actor"},y=It(o,a);if(It(o,x),t.rectData=a,t.properties?.icon){const w=t.properties.icon.trim();w.charAt(0)==="@"?Xt(o,a.x+a.width-20,a.y+10,w.substr(1)):Jt(o,a.x+a.width-20,a.y+10,w)}dt(n,z(t.description))(t.description,o,a.x-g,a.y+g,a.width,a.height,{class:`actor ${Dt}`},n);let m=t.height;if(y.node){const w=y.node().getBBox();t.height=w.height,m=w.height}return m},"drawActorTypeCollections"),Ke=f(function(e,t,n,s){const r=s?t.stopy:t.starty,i=t.x+t.width/2,c=r+t.height,h=e.append("g").lower();let o=h;s||(P++,Object.keys(t.links||{}).length&&!n.forceMenus&&o.attr("onclick",Ct(`actor${P}_popup`)).attr("cursor","pointer"),o.append("line").attr("id","actor"+P).attr("x1",i).attr("y1",c).attr("x2",i).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),o=h.append("g"),t.actorCnt=P,t.links!=null&&o.attr("id","root-"+P));const a=ct();let p="actor";t.properties?.class?p=t.properties.class:a.fill="#eaeaea",s?p+=` ${xt}`:p+=` ${gt}`,a.x=t.x,a.y=r,a.width=t.width,a.height=t.height,a.class=p,a.name=t.name;const g=a.height/2,x=g/(2.5+a.height/50),y=o.append("g"),m=o.append("g");if(y.append("path").attr("d",`M ${a.x},${a.y+g} + a ${x},${g} 0 0 0 0,${a.height} + h ${a.width-2*x} + a ${x},${g} 0 0 0 0,-${a.height} + Z + `).attr("class",p),m.append("path").attr("d",`M ${a.x},${a.y+g} + a ${x},${g} 0 0 0 0,${a.height}`).attr("stroke","#666").attr("stroke-width","1px").attr("class",p),y.attr("transform",`translate(${x}, ${-(a.height/2)})`),m.attr("transform",`translate(${a.width-x}, ${-a.height/2})`),t.rectData=a,t.properties?.icon){const N=t.properties.icon.trim(),S=a.x+a.width-20,O=a.y+10;N.charAt(0)==="@"?Xt(o,S,O,N.substr(1)):Jt(o,S,O,N)}dt(n,z(t.description))(t.description,o,a.x,a.y,a.width,a.height,{class:`actor ${Dt}`},n);let w=t.height;const k=y.select("path:last-child");if(k.node()){const N=k.node().getBBox();t.height=N.height,w=N.height}return w},"drawActorTypeQueue"),Xe=f(function(e,t,n,s){const r=s?t.stopy:t.starty,i=t.x+t.width/2,c=r+75,h=e.append("g").lower();s||(P++,h.append("line").attr("id","actor"+P).attr("x1",i).attr("y1",c).attr("x2",i).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),t.actorCnt=P);const o=e.append("g");let a=ut;s?a+=` ${xt}`:a+=` ${gt}`,o.attr("class",a),o.attr("name",t.name);const p=ct();p.x=t.x,p.y=r,p.fill="#eaeaea",p.width=t.width,p.height=t.height,p.class="actor";const g=t.x+t.width/2,x=r+30,y=18;o.append("defs").append("marker").attr("id","filled-head-control").attr("refX",11).attr("refY",5.8).attr("markerWidth",20).attr("markerHeight",28).attr("orient","172.5").append("path").attr("d","M 14.4 5.6 L 7.2 10.4 L 8.8 5.6 L 7.2 0.8 Z"),o.append("circle").attr("cx",g).attr("cy",x).attr("r",y).attr("fill","#eaeaf7").attr("stroke","#666").attr("stroke-width",1.2),o.append("line").attr("marker-end","url(#filled-head-control)").attr("transform",`translate(${g}, ${x-y})`);const m=o.node().getBBox();return t.height=m.height+2*(n?.sequence?.labelBoxHeight??0),dt(n,z(t.description))(t.description,o,p.x,p.y+y+(s?5:10),p.width,p.height,{class:`actor ${ut}`},n),t.height},"drawActorTypeControl"),Je=f(function(e,t,n,s){const r=s?t.stopy:t.starty,i=t.x+t.width/2,c=r+75,h=e.append("g").lower(),o=e.append("g");let a=ut;s?a+=` ${xt}`:a+=` ${gt}`,o.attr("class",a),o.attr("name",t.name);const p=ct();p.x=t.x,p.y=r,p.fill="#eaeaea",p.width=t.width,p.height=t.height,p.class="actor";const g=t.x+t.width/2,x=r+(s?10:25),y=18;o.append("circle").attr("cx",g).attr("cy",x).attr("r",y).attr("width",t.width).attr("height",t.height),o.append("line").attr("x1",g-y).attr("x2",g+y).attr("y1",x+y).attr("y2",x+y).attr("stroke","#333").attr("stroke-width",2);const m=o.node().getBBox();return t.height=m.height+(n?.sequence?.labelBoxHeight??0),s||(P++,h.append("line").attr("id","actor"+P).attr("x1",i).attr("y1",c).attr("x2",i).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),t.actorCnt=P),dt(n,z(t.description))(t.description,o,p.x,p.y+(s?(x-r+y-5)/2:(x+y-r)/2),p.width,p.height,{class:`actor ${ut}`},n),s?o.attr("transform",`translate(0, ${y/2})`):o.attr("transform",`translate(0, ${y/2})`),t.height},"drawActorTypeEntity"),Qe=f(function(e,t,n,s){const r=s?t.stopy:t.starty,i=t.x+t.width/2,c=r+t.height+2*n.boxTextMargin,h=e.append("g").lower();let o=h;s||(P++,Object.keys(t.links||{}).length&&!n.forceMenus&&o.attr("onclick",Ct(`actor${P}_popup`)).attr("cursor","pointer"),o.append("line").attr("id","actor"+P).attr("x1",i).attr("y1",c).attr("x2",i).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),o=h.append("g"),t.actorCnt=P,t.links!=null&&o.attr("id","root-"+P));const a=ct();let p="actor";t.properties?.class?p=t.properties.class:a.fill="#eaeaea",s?p+=` ${xt}`:p+=` ${gt}`,a.x=t.x,a.y=r,a.width=t.width,a.height=t.height,a.class=p,a.name=t.name,a.x=t.x,a.y=r;const g=a.width/4,x=a.width/4,y=g/2,m=y/(2.5+g/50),w=o.append("g"),k=` + M ${a.x},${a.y+m} + a ${y},${m} 0 0 0 ${g},0 + a ${y},${m} 0 0 0 -${g},0 + l 0,${x-2*m} + a ${y},${m} 0 0 0 ${g},0 + l 0,-${x-2*m} +`;w.append("path").attr("d",k).attr("fill","#eaeaea").attr("stroke","#000").attr("stroke-width",1).attr("class",p),s?w.attr("transform",`translate(${g*1.5}, ${a.height/4-2*m})`):w.attr("transform",`translate(${g*1.5}, ${(a.height+m)/4})`),t.rectData=a,dt(n,z(t.description))(t.description,o,a.x,a.y+(s?(a.height+x)/4:(a.height+m)/2),a.width,a.height,{class:`actor ${Dt}`},n);const N=w.select("path:last-child");if(N.node()){const S=N.node().getBBox();t.height=S.height+(n.sequence.labelBoxHeight??0)}return t.height},"drawActorTypeDatabase"),Ze=f(function(e,t,n,s){const r=s?t.stopy:t.starty,i=t.x+t.width/2,c=r+80,h=30,o=e.append("g").lower();s||(P++,o.append("line").attr("id","actor"+P).attr("x1",i).attr("y1",c).attr("x2",i).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),t.actorCnt=P);const a=e.append("g");let p=ut;s?p+=` ${xt}`:p+=` ${gt}`,a.attr("class",p),a.attr("name",t.name);const g=ct();g.x=t.x,g.y=r,g.fill="#eaeaea",g.width=t.width,g.height=t.height,g.class="actor",a.append("line").attr("id","actor-man-torso"+P).attr("x1",t.x+t.width/2-h*2.5).attr("y1",r+10).attr("x2",t.x+t.width/2-15).attr("y2",r+10),a.append("line").attr("id","actor-man-arms"+P).attr("x1",t.x+t.width/2-h*2.5).attr("y1",r+0).attr("x2",t.x+t.width/2-h*2.5).attr("y2",r+20),a.append("circle").attr("cx",t.x+t.width/2).attr("cy",r+10).attr("r",h);const x=a.node().getBBox();return t.height=x.height+(n.sequence.labelBoxHeight??0),dt(n,z(t.description))(t.description,a,g.x,g.y+(s?h/2-4:h/2+3),g.width,g.height,{class:`actor ${ut}`},n),s?a.attr("transform",`translate(0,${h/2+7})`):a.attr("transform",`translate(0,${h/2+7})`),t.height},"drawActorTypeBoundary"),$e=f(function(e,t,n,s){const r=s?t.stopy:t.starty,i=t.x+t.width/2,c=r+80,h=e.append("g").lower();s||(P++,h.append("line").attr("id","actor"+P).attr("x1",i).attr("y1",c).attr("x2",i).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),t.actorCnt=P);const o=e.append("g");let a=ut;s?a+=` ${xt}`:a+=` ${gt}`,o.attr("class",a),o.attr("name",t.name);const p=ct();p.x=t.x,p.y=r,p.fill="#eaeaea",p.width=t.width,p.height=t.height,p.class="actor",p.rx=3,p.ry=3,o.append("line").attr("id","actor-man-torso"+P).attr("x1",i).attr("y1",r+25).attr("x2",i).attr("y2",r+45),o.append("line").attr("id","actor-man-arms"+P).attr("x1",i-Tt/2).attr("y1",r+33).attr("x2",i+Tt/2).attr("y2",r+33),o.append("line").attr("x1",i-Tt/2).attr("y1",r+60).attr("x2",i).attr("y2",r+45),o.append("line").attr("x1",i).attr("y1",r+45).attr("x2",i+Tt/2-2).attr("y2",r+60);const g=o.append("circle");g.attr("cx",t.x+t.width/2),g.attr("cy",r+10),g.attr("r",15),g.attr("width",t.width),g.attr("height",t.height);const x=o.node().getBBox();return t.height=x.height,dt(n,z(t.description))(t.description,o,p.x,p.y+35,p.width,p.height,{class:`actor ${ut}`},n),t.height},"drawActorTypeActor"),je=f(async function(e,t,n,s){switch(t.type){case"actor":return await $e(e,t,n,s);case"participant":return await Ue(e,t,n,s);case"boundary":return await Ze(e,t,n,s);case"control":return await Xe(e,t,n,s);case"entity":return await Je(e,t,n,s);case"database":return await Qe(e,t,n,s);case"collections":return await Ge(e,t,n,s);case"queue":return await Ke(e,t,n,s)}},"drawActor"),ts=f(function(e,t,n){const r=e.append("g");ce(r,t),t.name&&dt(n)(t.name,r,t.x,t.y+n.boxTextMargin+(t.textMaxHeight||0)/2,t.width,0,{class:"text"},n),r.lower()},"drawBox"),es=f(function(e){return e.append("g")},"anchorElement"),ss=f(function(e,t,n,s,r){const i=ct(),c=t.anchored;i.x=t.startx,i.y=t.starty,i.class="activation"+r%3,i.width=t.stopx-t.startx,i.height=n-t.starty,It(c,i)},"drawActivation"),as=f(async function(e,t,n,s){const{boxMargin:r,boxTextMargin:i,labelBoxHeight:c,labelBoxWidth:h,messageFontFamily:o,messageFontSize:a,messageFontWeight:p}=s,g=e.append("g"),x=f(function(w,k,N,S){return g.append("line").attr("x1",w).attr("y1",k).attr("x2",N).attr("y2",S).attr("class","loopLine")},"drawLoopLine");x(t.startx,t.starty,t.stopx,t.starty),x(t.stopx,t.starty,t.stopx,t.stopy),x(t.startx,t.stopy,t.stopx,t.stopy),x(t.startx,t.starty,t.startx,t.stopy),t.sections!==void 0&&t.sections.forEach(function(w){x(t.startx,w.y,t.stopx,w.y).style("stroke-dasharray","3, 3")});let y=Kt();y.text=n,y.x=t.startx,y.y=t.starty,y.fontFamily=o,y.fontSize=a,y.fontWeight=p,y.anchor="middle",y.valign="middle",y.tspan=!1,y.width=h||50,y.height=c||20,y.textMargin=i,y.class="labelText",ne(g,y),y=le(),y.text=t.title,y.x=t.startx+h/2+(t.stopx-t.startx)/2,y.y=t.starty+r+i,y.anchor="middle",y.valign="middle",y.textMargin=i,y.class="loopText",y.fontFamily=o,y.fontSize=a,y.fontWeight=p,y.wrap=!0;let m=z(y.text)?await Rt(g,y,t):wt(g,y);if(t.sectionTitles!==void 0){for(const[w,k]of Object.entries(t.sectionTitles))if(k.message){y.text=k.message,y.x=t.startx+(t.stopx-t.startx)/2,y.y=t.sections[w].y+r+i,y.class="loopText",y.anchor="middle",y.valign="middle",y.tspan=!1,y.fontFamily=o,y.fontSize=a,y.fontWeight=p,y.wrap=t.wrap,z(y.text)?(t.starty=t.sections[w].y,await Rt(g,y,t)):wt(g,y);let N=Math.round(m.map(S=>(S._groups||S)[0][0].getBBox().height).reduce((S,O)=>S+O));t.sections[w].height+=N-(r+i)}}return t.height=Math.round(t.stopy-t.starty),g},"drawLoop"),ce=f(function(e,t){me(e,t)},"drawBackgroundRect"),rs=f(function(e){e.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),is=f(function(e){e.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),ns=f(function(e){e.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),os=f(function(e){e.append("defs").append("marker").attr("id","arrowhead").attr("refX",7.9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto-start-reverse").append("path").attr("d","M -1 0 L 10 5 L 0 10 z")},"insertArrowHead"),cs=f(function(e){e.append("defs").append("marker").attr("id","filled-head").attr("refX",15.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),ls=f(function(e){e.append("defs").append("marker").attr("id","sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},"insertSequenceNumber"),hs=f(function(e){e.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",4).attr("refY",4.5).append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1pt").attr("d","M 1,2 L 6,7 M 6,2 L 1,7")},"insertArrowCrossHead"),le=f(function(){return{x:0,y:0,fill:void 0,anchor:void 0,style:"#666",width:void 0,height:void 0,textMargin:0,rx:0,ry:0,tspan:!0,valign:void 0}},"getTextObj"),ds=f(function(){return{x:0,y:0,fill:"#EDF2AE",stroke:"#666",width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),dt=(function(){function e(i,c,h,o,a,p,g){const x=c.append("text").attr("x",h+a/2).attr("y",o+p/2+5).style("text-anchor","middle").text(i);r(x,g)}f(e,"byText");function t(i,c,h,o,a,p,g,x){const{actorFontSize:y,actorFontFamily:m,actorFontWeight:w}=x,[k,N]=re(y),S=i.split(I.lineBreakRegex);for(let O=0;Oe.height||0))+(this.loops.length===0?0:this.loops.map(e=>e.height||0).reduce((e,t)=>e+t))+(this.messages.length===0?0:this.messages.map(e=>e.height||0).reduce((e,t)=>e+t))+(this.notes.length===0?0:this.notes.map(e=>e.height||0).reduce((e,t)=>e+t))},"getHeight"),clear:f(function(){this.actors=[],this.boxes=[],this.loops=[],this.messages=[],this.notes=[]},"clear"),addBox:f(function(e){this.boxes.push(e)},"addBox"),addActor:f(function(e){this.actors.push(e)},"addActor"),addLoop:f(function(e){this.loops.push(e)},"addLoop"),addMessage:f(function(e){this.messages.push(e)},"addMessage"),addNote:f(function(e){this.notes.push(e)},"addNote"),lastActor:f(function(){return this.actors[this.actors.length-1]},"lastActor"),lastLoop:f(function(){return this.loops[this.loops.length-1]},"lastLoop"),lastMessage:f(function(){return this.messages[this.messages.length-1]},"lastMessage"),lastNote:f(function(){return this.notes[this.notes.length-1]},"lastNote"),actors:[],boxes:[],loops:[],messages:[],notes:[]},init:f(function(){this.sequenceItems=[],this.activations=[],this.models.clear(),this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0,pe(st())},"init"),updateVal:f(function(e,t,n,s){e[t]===void 0?e[t]=n:e[t]=s(n,e[t])},"updateVal"),updateBounds:f(function(e,t,n,s){const r=this;let i=0;function c(h){return f(function(a){i++;const p=r.sequenceItems.length-i+1;r.updateVal(a,"starty",t-p*l.boxMargin,Math.min),r.updateVal(a,"stopy",s+p*l.boxMargin,Math.max),r.updateVal(T.data,"startx",e-p*l.boxMargin,Math.min),r.updateVal(T.data,"stopx",n+p*l.boxMargin,Math.max),h!=="activation"&&(r.updateVal(a,"startx",e-p*l.boxMargin,Math.min),r.updateVal(a,"stopx",n+p*l.boxMargin,Math.max),r.updateVal(T.data,"starty",t-p*l.boxMargin,Math.min),r.updateVal(T.data,"stopy",s+p*l.boxMargin,Math.max))},"updateItemBounds")}f(c,"updateFn"),this.sequenceItems.forEach(c()),this.activations.forEach(c("activation"))},"updateBounds"),insert:f(function(e,t,n,s){const r=I.getMin(e,n),i=I.getMax(e,n),c=I.getMin(t,s),h=I.getMax(t,s);this.updateVal(T.data,"startx",r,Math.min),this.updateVal(T.data,"starty",c,Math.min),this.updateVal(T.data,"stopx",i,Math.max),this.updateVal(T.data,"stopy",h,Math.max),this.updateBounds(r,c,i,h)},"insert"),newActivation:f(function(e,t,n){const s=n.get(e.from),r=Ot(e.from).length||0,i=s.x+s.width/2+(r-1)*l.activationWidth/2;this.activations.push({startx:i,starty:this.verticalPos+2,stopx:i+l.activationWidth,stopy:void 0,actor:e.from,anchored:V.anchorElement(t)})},"newActivation"),endActivation:f(function(e){const t=this.activations.map(function(n){return n.actor}).lastIndexOf(e.from);return this.activations.splice(t,1)[0]},"endActivation"),createLoop:f(function(e={message:void 0,wrap:!1,width:void 0},t){return{startx:void 0,starty:this.verticalPos,stopx:void 0,stopy:void 0,title:e.message,wrap:e.wrap,width:e.width,height:0,fill:t}},"createLoop"),newLoop:f(function(e={message:void 0,wrap:!1,width:void 0},t){this.sequenceItems.push(this.createLoop(e,t))},"newLoop"),endLoop:f(function(){return this.sequenceItems.pop()},"endLoop"),isLoopOverlap:f(function(){return this.sequenceItems.length?this.sequenceItems[this.sequenceItems.length-1].overlap:!1},"isLoopOverlap"),addSectionToLoop:f(function(e){const t=this.sequenceItems.pop();t.sections=t.sections||[],t.sectionTitles=t.sectionTitles||[],t.sections.push({y:T.getVerticalPos(),height:0}),t.sectionTitles.push(e),this.sequenceItems.push(t)},"addSectionToLoop"),saveVerticalPos:f(function(){this.isLoopOverlap()&&(this.savedVerticalPos=this.verticalPos)},"saveVerticalPos"),resetVerticalPos:f(function(){this.isLoopOverlap()&&(this.verticalPos=this.savedVerticalPos)},"resetVerticalPos"),bumpVerticalPos:f(function(e){this.verticalPos=this.verticalPos+e,this.data.stopy=I.getMax(this.data.stopy,this.verticalPos)},"bumpVerticalPos"),getVerticalPos:f(function(){return this.verticalPos},"getVerticalPos"),getBounds:f(function(){return{bounds:this.data,models:this.models}},"getBounds")},us=f(async function(e,t){T.bumpVerticalPos(l.boxMargin),t.height=l.boxMargin,t.starty=T.getVerticalPos();const n=ct();n.x=t.startx,n.y=t.starty,n.width=t.width||l.width,n.class="note";const s=e.append("g"),r=V.drawRect(s,n),i=Kt();i.x=t.startx,i.y=t.starty,i.width=n.width,i.dy="1em",i.text=t.message,i.class="noteText",i.fontFamily=l.noteFontFamily,i.fontSize=l.noteFontSize,i.fontWeight=l.noteFontWeight,i.anchor=l.noteAlign,i.textMargin=l.noteMargin,i.valign="center";const c=z(i.text)?await Rt(s,i):wt(s,i),h=Math.round(c.map(o=>(o._groups||o)[0][0].getBBox().height).reduce((o,a)=>o+a));r.attr("height",h+2*l.noteMargin),t.height+=h+2*l.noteMargin,T.bumpVerticalPos(h+2*l.noteMargin),t.stopy=t.starty+h+2*l.noteMargin,t.stopx=t.startx+n.width,T.insert(t.startx,t.starty,t.stopx,t.stopy),T.models.addNote(t)},"drawNote"),Et=f(e=>({fontFamily:e.messageFontFamily,fontSize:e.messageFontSize,fontWeight:e.messageFontWeight}),"messageFont"),mt=f(e=>({fontFamily:e.noteFontFamily,fontSize:e.noteFontSize,fontWeight:e.noteFontWeight}),"noteFont"),Ut=f(e=>({fontFamily:e.actorFontFamily,fontSize:e.actorFontSize,fontWeight:e.actorFontWeight}),"actorFont");async function he(e,t){T.bumpVerticalPos(10);const{startx:n,stopx:s,message:r}=t,i=I.splitBreaks(r).length,c=z(r),h=c?await Lt(r,st()):W.calculateTextDimensions(r,Et(l));if(!c){const g=h.height/i;t.height+=g,T.bumpVerticalPos(g)}let o,a=h.height-10;const p=h.width;if(n===s){o=T.getVerticalPos()+a,l.rightAngles||(a+=l.boxMargin,o=T.getVerticalPos()+a),a+=30;const g=I.getMax(p/2,l.width/2);T.insert(n-g,T.getVerticalPos()-10+a,s+g,T.getVerticalPos()+30+a)}else a+=l.boxMargin,o=T.getVerticalPos()+a,T.insert(n,o-10,s,o);return T.bumpVerticalPos(a),t.height+=a,t.stopy=t.starty+t.height,T.insert(t.fromBounds,t.starty,t.toBounds,t.stopy),o}f(he,"boundMessage");var gs=f(async function(e,t,n,s){const{startx:r,stopx:i,starty:c,message:h,type:o,sequenceIndex:a,sequenceVisible:p}=t,g=W.calculateTextDimensions(h,Et(l)),x=Kt();x.x=r,x.y=c+10,x.width=i-r,x.class="messageText",x.dy="1em",x.text=h,x.fontFamily=l.messageFontFamily,x.fontSize=l.messageFontSize,x.fontWeight=l.messageFontWeight,x.anchor=l.messageAlign,x.valign="center",x.textMargin=l.wrapPadding,x.tspan=!1,z(x.text)?await Rt(e,x,{startx:r,stopx:i,starty:n}):wt(e,x);const y=g.width;let m;r===i?l.rightAngles?m=e.append("path").attr("d",`M ${r},${n} H ${r+I.getMax(l.width/2,y/2)} V ${n+25} H ${r}`):m=e.append("path").attr("d","M "+r+","+n+" C "+(r+60)+","+(n-10)+" "+(r+60)+","+(n+30)+" "+r+","+(n+20)):(m=e.append("line"),m.attr("x1",r),m.attr("y1",n),m.attr("x2",i),m.attr("y2",n)),o===s.db.LINETYPE.DOTTED||o===s.db.LINETYPE.DOTTED_CROSS||o===s.db.LINETYPE.DOTTED_POINT||o===s.db.LINETYPE.DOTTED_OPEN||o===s.db.LINETYPE.BIDIRECTIONAL_DOTTED?(m.style("stroke-dasharray","3, 3"),m.attr("class","messageLine1")):m.attr("class","messageLine0");let w="";l.arrowMarkerAbsolute&&(w=Ce(!0)),m.attr("stroke-width",2),m.attr("stroke","none"),m.style("fill","none"),(o===s.db.LINETYPE.SOLID||o===s.db.LINETYPE.DOTTED)&&m.attr("marker-end","url("+w+"#arrowhead)"),(o===s.db.LINETYPE.BIDIRECTIONAL_SOLID||o===s.db.LINETYPE.BIDIRECTIONAL_DOTTED)&&(m.attr("marker-start","url("+w+"#arrowhead)"),m.attr("marker-end","url("+w+"#arrowhead)")),(o===s.db.LINETYPE.SOLID_POINT||o===s.db.LINETYPE.DOTTED_POINT)&&m.attr("marker-end","url("+w+"#filled-head)"),(o===s.db.LINETYPE.SOLID_CROSS||o===s.db.LINETYPE.DOTTED_CROSS)&&m.attr("marker-end","url("+w+"#crosshead)"),(p||l.showSequenceNumbers)&&((o===s.db.LINETYPE.BIDIRECTIONAL_SOLID||o===s.db.LINETYPE.BIDIRECTIONAL_DOTTED)&&(rr&&(r=a.height),a.width+h.x>i&&(i=a.width+h.x)}return{maxHeight:r,maxWidth:i}},"drawActorsPopup"),pe=f(function(e){Le(l,e),e.fontFamily&&(l.actorFontFamily=l.noteFontFamily=l.messageFontFamily=e.fontFamily),e.fontSize&&(l.actorFontSize=l.noteFontSize=l.messageFontSize=e.fontSize),e.fontWeight&&(l.actorFontWeight=l.noteFontWeight=l.messageFontWeight=e.fontWeight)},"setConf"),Ot=f(function(e){return T.activations.filter(function(t){return t.actor===e})},"actorActivations"),se=f(function(e,t){const n=t.get(e),s=Ot(e),r=s.reduce(function(c,h){return I.getMin(c,h.startx)},n.x+n.width/2-1),i=s.reduce(function(c,h){return I.getMax(c,h.stopx)},n.x+n.width/2+1);return[r,i]},"activationBounds");function nt(e,t,n,s,r){T.bumpVerticalPos(n);let i=s;if(t.id&&t.message&&e[t.id]){const c=e[t.id].width,h=Et(l);t.message=W.wrapLabel(`[${t.message}]`,c-2*l.wrapPadding,h),t.width=c,t.wrap=!0;const o=W.calculateTextDimensions(t.message,h),a=I.getMax(o.height,l.labelBoxHeight);i=s+a,Q.debug(`${a} - ${t.message}`)}r(t),T.bumpVerticalPos(i)}f(nt,"adjustLoopHeightForWrap");function ue(e,t,n,s,r,i,c){function h(p,g){p.x{E.add(_.from),E.add(_.to)}),m=m.filter(_=>E.has(_))}xs(a,p,g,m,0,w,!1);const B=await bs(w,p,O,s);V.insertArrowHead(a),V.insertArrowCrossHead(a),V.insertArrowFilledHead(a),V.insertSequenceNumber(a);function q(E,_){const X=T.endActivation(E);X.starty+18>_&&(X.starty=_-6,_+=12),V.drawActivation(a,X,_,l,Ot(E.from).length),T.insert(X.startx,_-10,X.stopx,_)}f(q,"activeEnd");let H=1,Z=1;const at=[],U=[];let G=0;for(const E of w){let _,X,tt;switch(E.type){case s.db.LINETYPE.NOTE:T.resetVerticalPos(),X=E.noteModel,await us(a,X);break;case s.db.LINETYPE.ACTIVE_START:T.newActivation(E,a,p);break;case s.db.LINETYPE.ACTIVE_END:q(E,T.getVerticalPos());break;case s.db.LINETYPE.LOOP_START:nt(B,E,l.boxMargin,l.boxMargin+l.boxTextMargin,M=>T.newLoop(M));break;case s.db.LINETYPE.LOOP_END:_=T.endLoop(),await V.drawLoop(a,_,"loop",l),T.bumpVerticalPos(_.stopy-T.getVerticalPos()),T.models.addLoop(_);break;case s.db.LINETYPE.RECT_START:nt(B,E,l.boxMargin,l.boxMargin,M=>T.newLoop(void 0,M.message));break;case s.db.LINETYPE.RECT_END:_=T.endLoop(),U.push(_),T.models.addLoop(_),T.bumpVerticalPos(_.stopy-T.getVerticalPos());break;case s.db.LINETYPE.OPT_START:nt(B,E,l.boxMargin,l.boxMargin+l.boxTextMargin,M=>T.newLoop(M));break;case s.db.LINETYPE.OPT_END:_=T.endLoop(),await V.drawLoop(a,_,"opt",l),T.bumpVerticalPos(_.stopy-T.getVerticalPos()),T.models.addLoop(_);break;case s.db.LINETYPE.ALT_START:nt(B,E,l.boxMargin,l.boxMargin+l.boxTextMargin,M=>T.newLoop(M));break;case s.db.LINETYPE.ALT_ELSE:nt(B,E,l.boxMargin+l.boxTextMargin,l.boxMargin,M=>T.addSectionToLoop(M));break;case s.db.LINETYPE.ALT_END:_=T.endLoop(),await V.drawLoop(a,_,"alt",l),T.bumpVerticalPos(_.stopy-T.getVerticalPos()),T.models.addLoop(_);break;case s.db.LINETYPE.PAR_START:case s.db.LINETYPE.PAR_OVER_START:nt(B,E,l.boxMargin,l.boxMargin+l.boxTextMargin,M=>T.newLoop(M)),T.saveVerticalPos();break;case s.db.LINETYPE.PAR_AND:nt(B,E,l.boxMargin+l.boxTextMargin,l.boxMargin,M=>T.addSectionToLoop(M));break;case s.db.LINETYPE.PAR_END:_=T.endLoop(),await V.drawLoop(a,_,"par",l),T.bumpVerticalPos(_.stopy-T.getVerticalPos()),T.models.addLoop(_);break;case s.db.LINETYPE.AUTONUMBER:H=E.message.start||H,Z=E.message.step||Z,E.message.visible?s.db.enableSequenceNumbers():s.db.disableSequenceNumbers();break;case s.db.LINETYPE.CRITICAL_START:nt(B,E,l.boxMargin,l.boxMargin+l.boxTextMargin,M=>T.newLoop(M));break;case s.db.LINETYPE.CRITICAL_OPTION:nt(B,E,l.boxMargin+l.boxTextMargin,l.boxMargin,M=>T.addSectionToLoop(M));break;case s.db.LINETYPE.CRITICAL_END:_=T.endLoop(),await V.drawLoop(a,_,"critical",l),T.bumpVerticalPos(_.stopy-T.getVerticalPos()),T.models.addLoop(_);break;case s.db.LINETYPE.BREAK_START:nt(B,E,l.boxMargin,l.boxMargin+l.boxTextMargin,M=>T.newLoop(M));break;case s.db.LINETYPE.BREAK_END:_=T.endLoop(),await V.drawLoop(a,_,"break",l),T.bumpVerticalPos(_.stopy-T.getVerticalPos()),T.models.addLoop(_);break;default:try{tt=E.msgModel,tt.starty=T.getVerticalPos(),tt.sequenceIndex=H,tt.sequenceVisible=s.db.showSequenceNumbers();const M=await he(a,tt);ue(E,tt,M,G,p,g,x),at.push({messageModel:tt,lineStartY:M}),T.models.addMessage(tt)}catch(M){Q.error("error while drawing message",M)}}[s.db.LINETYPE.SOLID_OPEN,s.db.LINETYPE.DOTTED_OPEN,s.db.LINETYPE.SOLID,s.db.LINETYPE.DOTTED,s.db.LINETYPE.SOLID_CROSS,s.db.LINETYPE.DOTTED_CROSS,s.db.LINETYPE.SOLID_POINT,s.db.LINETYPE.DOTTED_POINT,s.db.LINETYPE.BIDIRECTIONAL_SOLID,s.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(E.type)&&(H=H+Z),G++}Q.debug("createdActors",g),Q.debug("destroyedActors",x),await Gt(a,p,m,!1);for(const E of at)await gs(a,E.messageModel,E.lineStartY,s);l.mirrorActors&&await Gt(a,p,m,!0),U.forEach(E=>V.drawBackgroundRect(a,E)),oe(a,p,m,l);for(const E of T.models.boxes){E.height=T.getVerticalPos()-E.y,T.insert(E.x,E.y,E.x+E.width,E.height);const _=l.boxMargin*2;E.startx=E.x-_,E.starty=E.y-_*.25,E.stopx=E.startx+E.width+2*_,E.stopy=E.starty+E.height+_*.75,E.stroke="rgb(0,0,0, 0.5)",V.drawBox(a,E,l)}N&&T.bumpVerticalPos(l.boxMargin);const F=de(a,p,m,o),{bounds:D}=T.getBounds();D.startx===void 0&&(D.startx=0),D.starty===void 0&&(D.starty=0),D.stopx===void 0&&(D.stopx=0),D.stopy===void 0&&(D.stopy=0);let $=D.stopy-D.starty;${const c=Et(l);let h=i.actorKeys.reduce((g,x)=>g+=e.get(x).width+(e.get(x).margin||0),0);const o=l.boxMargin*8;h+=o,h-=2*l.boxTextMargin,i.wrap&&(i.name=W.wrapLabel(i.name,h-2*l.wrapPadding,c));const a=W.calculateTextDimensions(i.name,c);r=I.getMax(a.height,r);const p=I.getMax(h,a.width+2*l.wrapPadding);if(i.margin=l.boxTextMargin,hi.textMaxHeight=r),I.getMax(s,l.height)}f(xe,"calculateActorMargins");var Ts=f(async function(e,t,n){const s=t.get(e.from),r=t.get(e.to),i=s.x,c=r.x,h=e.wrap&&e.message;let o=z(e.message)?await Lt(e.message,st()):W.calculateTextDimensions(h?W.wrapLabel(e.message,l.width,mt(l)):e.message,mt(l));const a={width:h?l.width:I.getMax(l.width,o.width+2*l.noteMargin),height:0,startx:s.x,stopx:0,starty:0,stopy:0,message:e.message};return e.placement===n.db.PLACEMENT.RIGHTOF?(a.width=h?I.getMax(l.width,o.width):I.getMax(s.width/2+r.width/2,o.width+2*l.noteMargin),a.startx=i+(s.width+l.actorMargin)/2):e.placement===n.db.PLACEMENT.LEFTOF?(a.width=h?I.getMax(l.width,o.width+2*l.noteMargin):I.getMax(s.width/2+r.width/2,o.width+2*l.noteMargin),a.startx=i-a.width+(s.width-l.actorMargin)/2):e.to===e.from?(o=W.calculateTextDimensions(h?W.wrapLabel(e.message,I.getMax(l.width,s.width),mt(l)):e.message,mt(l)),a.width=h?I.getMax(l.width,s.width):I.getMax(s.width,l.width,o.width+2*l.noteMargin),a.startx=i+(s.width-a.width)/2):(a.width=Math.abs(i+s.width/2-(c+r.width/2))+l.actorMargin,a.startx=i2,g=f(w=>h?-w:w,"adjustValue");e.from===e.to?a=o:(e.activate&&!p&&(a+=g(l.activationWidth/2-1)),[n.db.LINETYPE.SOLID_OPEN,n.db.LINETYPE.DOTTED_OPEN].includes(e.type)||(a+=g(3)),[n.db.LINETYPE.BIDIRECTIONAL_SOLID,n.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(e.type)&&(o-=g(3)));const x=[s,r,i,c],y=Math.abs(o-a);e.wrap&&e.message&&(e.message=W.wrapLabel(e.message,I.getMax(y+2*l.wrapPadding,l.width),Et(l)));const m=W.calculateTextDimensions(e.message,Et(l));return{width:I.getMax(e.wrap?0:m.width+2*l.wrapPadding,y+2*l.wrapPadding,l.width),height:0,startx:o,stopx:a,starty:0,stopy:0,message:e.message,type:e.type,wrap:e.wrap,fromBounds:Math.min.apply(null,x),toBounds:Math.max.apply(null,x)}},"buildMessageModel"),bs=f(async function(e,t,n,s){const r={},i=[];let c,h,o;for(const a of e){switch(a.type){case s.db.LINETYPE.LOOP_START:case s.db.LINETYPE.ALT_START:case s.db.LINETYPE.OPT_START:case s.db.LINETYPE.PAR_START:case s.db.LINETYPE.PAR_OVER_START:case s.db.LINETYPE.CRITICAL_START:case s.db.LINETYPE.BREAK_START:i.push({id:a.id,msg:a.message,from:Number.MAX_SAFE_INTEGER,to:Number.MIN_SAFE_INTEGER,width:0});break;case s.db.LINETYPE.ALT_ELSE:case s.db.LINETYPE.PAR_AND:case s.db.LINETYPE.CRITICAL_OPTION:a.message&&(c=i.pop(),r[c.id]=c,r[a.id]=c,i.push(c));break;case s.db.LINETYPE.LOOP_END:case s.db.LINETYPE.ALT_END:case s.db.LINETYPE.OPT_END:case s.db.LINETYPE.PAR_END:case s.db.LINETYPE.CRITICAL_END:case s.db.LINETYPE.BREAK_END:c=i.pop(),r[c.id]=c;break;case s.db.LINETYPE.ACTIVE_START:{const g=t.get(a.from?a.from:a.to.actor),x=Ot(a.from?a.from:a.to.actor).length,y=g.x+g.width/2+(x-1)*l.activationWidth/2,m={startx:y,stopx:y+l.activationWidth,actor:a.from,enabled:!0};T.activations.push(m)}break;case s.db.LINETYPE.ACTIVE_END:{const g=T.activations.map(x=>x.actor).lastIndexOf(a.from);T.activations.splice(g,1).splice(0,1)}break}a.placement!==void 0?(h=await Ts(a,t,s),a.noteModel=h,i.forEach(g=>{c=g,c.from=I.getMin(c.from,h.startx),c.to=I.getMax(c.to,h.startx+h.width),c.width=I.getMax(c.width,Math.abs(c.from-c.to))-l.labelBoxWidth})):(o=Es(a,t,s),a.msgModel=o,o.startx&&o.stopx&&i.length>0&&i.forEach(g=>{if(c=g,o.startx===o.stopx){const x=t.get(a.from),y=t.get(a.to);c.from=I.getMin(x.x-o.width/2,x.x-x.width/2,c.from),c.to=I.getMax(y.x+o.width/2,y.x+x.width/2,c.to),c.width=I.getMax(c.width,Math.abs(c.to-c.from))-l.labelBoxWidth}else c.from=I.getMin(o.startx,c.from),c.to=I.getMax(o.stopx,c.to),c.width=I.getMax(c.width,o.width)-l.labelBoxWidth}))}return T.activations=[],Q.debug("Loop type widths:",r),r},"calculateLoopBounds"),ms={bounds:T,drawActors:Gt,drawActorsPopup:de,setConf:pe,draw:fs},Ns={parser:Be,get db(){return new Fe},renderer:ms,styles:ze,init:f(e=>{e.sequence||(e.sequence={}),e.wrap&&(e.sequence.wrap=e.wrap,ve({sequence:{wrap:e.wrap}}))},"init")};export{Ns as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shaderLanguage-BjwqUAVi.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shaderLanguage-BjwqUAVi.js new file mode 100644 index 0000000000000000000000000000000000000000..d444150bccf8d578b65a056ef64733b17dee866b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shaderLanguage-BjwqUAVi.js @@ -0,0 +1 @@ +var L;(function(G){G[G.GLSL=0]="GLSL",G[G.WGSL=1]="WGSL"})(L||(L={}));export{L as ShaderLanguage}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shaderMaterial-yE1litoM.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shaderMaterial-yE1litoM.js new file mode 100644 index 0000000000000000000000000000000000000000..216416e9125cfa05fdbe9e81d92aa653b7ac986d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shaderMaterial-yE1litoM.js @@ -0,0 +1,2 @@ +import{a9 as N,M as E,J as _,b2 as F,b3 as R,Y as q,b4 as j,b as L,b5 as W,$ as z,a2 as D,a6 as G,a4 as K,a5 as X,e as O,T as B,ao as H,b6 as w,aq as U,E as Q,R as J}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const C=new WeakMap;function $(v){const t=v.getVertexBuffers();if(!t)return null;let e=C.get(v);if(!e)e=new Map,C.set(v,e);else{let o=!1;for(const s in t)if(!e.has(s)){o=!0;break}if(!o)return e}for(const o in t){const s=t[o];if(s){const i=s.byteOffset,n=s.byteStride,a=s.type;e.set(o,{offset:i,stride:n,type:a})}}return e}function Y(v,t){t.forEach((e,o)=>{const s=`vp_${o}_info`;v.setFloat3(s,e.offset,e.stride,e.type)})}const P={effect:null,subMesh:null};class p extends N{constructor(t,e,o,s={},i=!0){super(t,e,i),this._textures={},this._internalTextures={},this._textureArrays={},this._externalTextures={},this._floats={},this._ints={},this._uints={},this._floatsArrays={},this._colors3={},this._colors3Arrays={},this._colors4={},this._colors4Arrays={},this._vectors2={},this._vectors3={},this._vectors4={},this._quaternions={},this._quaternionsArrays={},this._matrices={},this._matrixArrays={},this._matrices3x3={},this._matrices2x2={},this._vectors2Arrays={},this._vectors3Arrays={},this._vectors4Arrays={},this._uniformBuffers={},this._textureSamplers={},this._storageBuffers={},this._cachedWorldViewMatrix=new E,this._cachedWorldViewProjectionMatrix=new E,this._multiview=!1,this._vertexPullingMetadata=null,this._materialHelperNeedsPreviousMatrices=!1,this._shaderPath=o,this._options={needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],externalTextures:[],samplerObjects:[],storageBuffers:[],defines:[],useClipPlane:!1,...s}}get shaderPath(){return this._shaderPath}set shaderPath(t){this._shaderPath=t}get options(){return this._options}get isMultiview(){return this._multiview}getClassName(){return"ShaderMaterial"}needAlphaBlending(){return this.alpha<1||this._options.needAlphaBlending}needAlphaTesting(){return this._options.needAlphaTesting}_checkUniform(t){this._options.uniforms.indexOf(t)===-1&&this._options.uniforms.push(t)}setTexture(t,e){return this._options.samplers.indexOf(t)===-1&&this._options.samplers.push(t),this._textures[t]=e,this}setInternalTexture(t,e){return this._options.samplers.indexOf(t)===-1&&this._options.samplers.push(t),this._internalTextures[t]=e,this}removeTexture(t){delete this._textures[t]}setTextureArray(t,e){return this._options.samplers.indexOf(t)===-1&&this._options.samplers.push(t),this._checkUniform(t),this._textureArrays[t]=e,this}setExternalTexture(t,e){return this._options.externalTextures.indexOf(t)===-1&&this._options.externalTextures.push(t),this._externalTextures[t]=e,this}setFloat(t,e){return this._checkUniform(t),this._floats[t]=e,this}setInt(t,e){return this._checkUniform(t),this._ints[t]=e,this}setUInt(t,e){return this._checkUniform(t),this._uints[t]=e,this}setFloats(t,e){return this._checkUniform(t),this._floatsArrays[t]=e,this}setColor3(t,e){return this._checkUniform(t),this._colors3[t]=e,this}setColor3Array(t,e){return this._checkUniform(t),this._colors3Arrays[t]=e.reduce((o,s)=>(o.push(s.r,s.g,s.b),o),[]),this}setColor4(t,e){return this._checkUniform(t),this._colors4[t]=e,this}setColor4Array(t,e){return this._checkUniform(t),this._colors4Arrays[t]=e.reduce((o,s)=>(o.push(s.r,s.g,s.b,s.a),o),[]),this}setVector2(t,e){return this._checkUniform(t),this._vectors2[t]=e,this}setVector3(t,e){return this._checkUniform(t),this._vectors3[t]=e,this}setVector4(t,e){return this._checkUniform(t),this._vectors4[t]=e,this}setQuaternion(t,e){return this._checkUniform(t),this._quaternions[t]=e,this}setQuaternionArray(t,e){return this._checkUniform(t),this._quaternionsArrays[t]=e.reduce((o,s)=>(s.toArray(o,o.length),o),[]),this}setMatrix(t,e){return this._checkUniform(t),this._matrices[t]=e,this}setMatrices(t,e){this._checkUniform(t);const o=new Float32Array(e.length*16);for(let s=0;si===t||i.startsWith(o));return s>=0&&this.options.defines.splice(s,1),(typeof e!="boolean"||e)&&this.options.defines.push(o+e),this}isReadyForSubMesh(t,e,o){return this.isReady(t,o,e)}isReady(t,e,o){const s=o&&this._storeEffectOnSubMeshes;if(this.isFrozen){const h=s?o._drawWrapper:this._drawWrapper;if(h.effect&&h._wasPreviouslyReady&&h._wasPreviouslyUsingInstances===e)return!0}const i=this.getScene(),n=i.getEngine(),a=[],f=[];let c=null,T=this._shaderPath,r=this._options.uniforms,u=this._options.uniformBuffers,x=this._options.samplers;n.getCaps().multiview&&i.activeCamera&&i.activeCamera.outputRenderTarget&&i.activeCamera.outputRenderTarget.getViewCount()>1&&(this._multiview=!0,a.push("#define MULTIVIEW"),r.indexOf("viewProjection")!==-1&&r.indexOf("viewProjectionR")===-1&&r.push("viewProjectionR"));for(let h=0;h4&&(f.push(_.MatricesIndicesExtraKind),f.push(_.MatricesWeightsExtraKind));const h=t.skeleton;a.push("#define NUM_BONE_INFLUENCERS "+t.numBoneInfluencers),c=new Q,c.addCPUSkinningFallback(0,t),h.isUsingTextureForMatrices?(a.push("#define BONETEXTURE"),r.indexOf("boneTextureWidth")===-1&&r.push("boneTextureWidth"),this._options.samplers.indexOf("boneSampler")===-1&&this._options.samplers.push("boneSampler")):(a.push("#define BonesPerMesh "+(h.bones.length+1)),r.indexOf("mBones")===-1&&r.push("mBones"))}else a.push("#define NUM_BONE_INFLUENCERS 0");let d=0;const y=t?t.morphTargetManager:null;if(y){const h=a.indexOf("#define UV1")!==-1,g=a.indexOf("#define UV2")!==-1,k=a.indexOf("#define TANGENT")!==-1,M=a.indexOf("#define NORMAL")!==-1,I=a.indexOf("#define VERTEXCOLOR")!==-1;d=R(y,a,f,t,!0,M,k,h,g,I),y.isUsingTextureForTargets&&(r.indexOf("morphTargetTextureIndices")===-1&&r.push("morphTargetTextureIndices"),this._options.samplers.indexOf("morphTargets")===-1&&this._options.samplers.push("morphTargets")),d>0&&(r=r.slice(),r.push("morphTargetInfluences"),r.push("morphTargetCount"),r.push("morphTargetTextureInfo"),r.push("morphTargetTextureIndices"))}else a.push("#define NUM_MORPH_INFLUENCERS 0");if(t){const h=t.bakedVertexAnimationManager;h&&h.isEnabled&&(a.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),r.indexOf("bakedVertexAnimationSettings")===-1&&r.push("bakedVertexAnimationSettings"),r.indexOf("bakedVertexAnimationTextureSizeInverted")===-1&&r.push("bakedVertexAnimationTextureSizeInverted"),r.indexOf("bakedVertexAnimationTime")===-1&&r.push("bakedVertexAnimationTime"),this._options.samplers.indexOf("bakedVertexAnimationTexture")===-1&&this._options.samplers.push("bakedVertexAnimationTexture"),e&&f.push("bakedVertexAnimationSettingsInstanced"))}for(const h in this._textures)if(!this._textures[h].isReady())return!1;for(const h in this._internalTextures)if(!this._internalTextures[h].isReady)return!1;t&&this.needAlphaTestingForMesh(t)&&a.push("#define ALPHATEST"),this._options.useClipPlane!==!1&&(q(r),j(this,i,a)),i.fogEnabled&&t?.applyFog&&i.fogMode!==L.FOGMODE_NONE&&(a.push("#define FOG"),r.indexOf("view")===-1&&r.push("view"),r.indexOf("vFogInfos")===-1&&r.push("vFogInfos"),r.indexOf("vFogColor")===-1&&r.push("vFogColor")),this._useLogarithmicDepth&&(a.push("#define LOGARITHMICDEPTH"),r.indexOf("logarithmicDepthConstant")===-1&&r.push("logarithmicDepthConstant"));const l=o?o.getRenderingMesh():t;if(l&&this.useVertexPulling){const h=l.geometry;h&&(this._vertexPullingMetadata=$(h),this._vertexPullingMetadata&&this._vertexPullingMetadata.forEach((k,M)=>{r.push(`vp_${M}_info`)})),a.push("#define USE_VERTEX_PULLING");const g=l.geometry?.getIndexBuffer();g&&!l.isUnIndexed&&(a.push("#define VERTEX_PULLING_USE_INDEX_BUFFER"),g.is32Bits&&a.push("#define VERTEX_PULLING_INDEX_BUFFER_32BITS"))}this.customShaderNameResolve&&(r=r.slice(),u=u.slice(),x=x.slice(),T=this.customShaderNameResolve(this.name,r,u,x,a,f));const A=s?o._getDrawWrapper(void 0,!0):this._drawWrapper,S=A?.effect??null,V=A?.defines??null,b=a.join(` +`);let m=S;return V!==b&&(m=n.createEffect(T,{attributes:f,uniformsNames:r,uniformBuffersNames:u,samplers:x,defines:b,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousMorphTargets:d},shaderLanguage:this._options.shaderLanguage,extraInitializationsAsync:this._options.extraInitializationsAsync},n),s?o.setEffect(m,b,this._materialContext):A&&A.setEffect(m,b),this._onEffectCreatedObservable&&(P.effect=m,P.subMesh=o??t?.subMeshes[0]??null,this._onEffectCreatedObservable.notifyObservers(P))),A._wasPreviouslyUsingInstances=!!e,m?.isReady()?(S!==m&&i.resetCachedMaterial(),A._wasPreviouslyReady=!0,!0):!1}bindOnlyWorldMatrix(t,e){const o=e??this.getEffect();if(!o)return;const s=this._options.uniforms;s.indexOf("world")!==-1&&o.setMatrix("world",t);const i=this.getScene();s.indexOf("worldView")!==-1&&(t.multiplyToRef(i.getViewMatrix(),this._cachedWorldViewMatrix),o.setMatrix("worldView",this._cachedWorldViewMatrix)),s.indexOf("worldViewProjection")!==-1&&(t.multiplyToRef(i.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),o.setMatrix("worldViewProjection",this._cachedWorldViewProjectionMatrix)),s.indexOf("view")!==-1&&o.setMatrix("view",i.getViewMatrix())}bindForSubMesh(t,e,o){this.bind(t,e,o._drawWrapperOverride?.effect,o)}bind(t,e,o,s){const i=s&&this._storeEffectOnSubMeshes,n=o??(i?s.effect:this.getEffect());if(!n)return;const a=this.getScene();this._activeEffect=n,this.bindOnlyWorldMatrix(t,o);const f=this._options.uniformBuffers;let c=!1;if(n&&f&&f.length>0&&a.getEngine().supportsUniformBuffers)for(let r=0;rnew p(t,this.getScene(),this._shaderPath,this._options,this._storeEffectOnSubMeshes),this);e.name=t,e.id=t,typeof e._shaderPath=="object"&&(e._shaderPath={...e._shaderPath}),this._options={...this._options};const o=Object.keys(this._options);for(const s of o){const i=this._options[s];Array.isArray(i)&&(this._options[s]=i.slice(0))}this.stencil.copyTo(e.stencil);for(const s in this._textures)e.setTexture(s,this._textures[s]);for(const s in this._internalTextures)e.setInternalTexture(s,this._internalTextures[s]);for(const s in this._textureArrays)e.setTextureArray(s,this._textureArrays[s]);for(const s in this._externalTextures)e.setExternalTexture(s,this._externalTextures[s]);for(const s in this._ints)e.setInt(s,this._ints[s]);for(const s in this._uints)e.setUInt(s,this._uints[s]);for(const s in this._floats)e.setFloat(s,this._floats[s]);for(const s in this._floatsArrays)e.setFloats(s,this._floatsArrays[s]);for(const s in this._colors3)e.setColor3(s,this._colors3[s]);for(const s in this._colors3Arrays)e._colors3Arrays[s]=this._colors3Arrays[s];for(const s in this._colors4)e.setColor4(s,this._colors4[s]);for(const s in this._colors4Arrays)e._colors4Arrays[s]=this._colors4Arrays[s];for(const s in this._vectors2)e.setVector2(s,this._vectors2[s]);for(const s in this._vectors3)e.setVector3(s,this._vectors3[s]);for(const s in this._vectors4)e.setVector4(s,this._vectors4[s]);for(const s in this._quaternions)e.setQuaternion(s,this._quaternions[s]);for(const s in this._quaternionsArrays)e._quaternionsArrays[s]=this._quaternionsArrays[s];for(const s in this._matrices)e.setMatrix(s,this._matrices[s]);for(const s in this._matrixArrays)e._matrixArrays[s]=this._matrixArrays[s].slice();for(const s in this._matrices3x3)e.setMatrix3x3(s,this._matrices3x3[s]);for(const s in this._matrices2x2)e.setMatrix2x2(s,this._matrices2x2[s]);for(const s in this._vectors2Arrays)e.setArray2(s,this._vectors2Arrays[s]);for(const s in this._vectors3Arrays)e.setArray3(s,this._vectors3Arrays[s]);for(const s in this._vectors4Arrays)e.setArray4(s,this._vectors4Arrays[s]);for(const s in this._uniformBuffers)e.setUniformBuffer(s,this._uniformBuffers[s]);for(const s in this._textureSamplers)e.setTextureSampler(s,this._textureSamplers[s]);for(const s in this._storageBuffers)e.setStorageBuffer(s,this._storageBuffers[s]);return e}dispose(t,e,o){if(e){let s;for(s in this._textures)this._textures[s].dispose();for(s in this._internalTextures)this._internalTextures[s].dispose();for(s in this._textureArrays){const i=this._textureArrays[s];for(let n=0;nnew p(t.name,e,t.shaderPath,t.options,t.storeEffectOnSubMeshes),t,e,o);let i;t.stencil&&s.stencil.parse(t.stencil,e,o);for(i in t.textures)s.setTexture(i,B.Parse(t.textures[i],e,o));for(i in t.textureArrays){const n=t.textureArrays[i],a=[];for(let f=0;f(c%3===0?a.push([f]):a[a.length-1].push(f),a),[]).map(a=>({r:a[0],g:a[1],b:a[2]}));s.setColor3Array(i,n)}for(i in t.colors4){const n=t.colors4[i];s.setColor4(i,{r:n[0],g:n[1],b:n[2],a:n[3]})}for(i in t.colors4Arrays){const n=t.colors4Arrays[i].reduce((a,f,c)=>(c%4===0?a.push([f]):a[a.length-1].push(f),a),[]).map(a=>({r:a[0],g:a[1],b:a[2],a:a[3]}));s.setColor4Array(i,n)}for(i in t.vectors2){const n=t.vectors2[i];s.setVector2(i,{x:n[0],y:n[1]})}for(i in t.vectors3){const n=t.vectors3[i];s.setVector3(i,{x:n[0],y:n[1],z:n[2]})}for(i in t.vectors4){const n=t.vectors4[i];s.setVector4(i,{x:n[0],y:n[1],z:n[2],w:n[3]})}for(i in t.quaternions)s.setQuaternion(i,H.FromArray(t.quaternions[i]));for(i in t.matrices)s.setMatrix(i,E.FromArray(t.matrices[i]));for(i in t.matrixArray)s._matrixArrays[i]=new Float32Array(t.matrixArray[i]);for(i in t.matrices3x3)s.setMatrix3x3(i,t.matrices3x3[i]);for(i in t.matrices2x2)s.setMatrix2x2(i,t.matrices2x2[i]);for(i in t.vectors2Arrays)s.setArray2(i,t.vectors2Arrays[i]);for(i in t.vectors3Arrays)s.setArray3(i,t.vectors3Arrays[i]);for(i in t.vectors4Arrays)s.setArray4(i,t.vectors4Arrays[i]);for(i in t.quaternionsArrays)s.setArray4(i,t.quaternionsArrays[i]);return s}static async ParseFromFileAsync(t,e,o,s=""){return await new Promise((i,n)=>{const a=new w;a.addEventListener("readystatechange",()=>{if(a.readyState==4)if(a.status==200){const f=JSON.parse(a.responseText),c=this.Parse(f,o||U.LastCreatedScene,s);t&&(c.name=t),i(c)}else n("Unable to load the ShaderMaterial")}),a.open("GET",e),a.send()})}static async ParseFromSnippetAsync(t,e,o=""){return await new Promise((s,i)=>{const n=new w;n.addEventListener("readystatechange",()=>{if(n.readyState==4)if(n.status==200){const a=JSON.parse(JSON.parse(n.responseText).jsonPayload),f=JSON.parse(a.shaderMaterial),c=this.Parse(f,e||U.LastCreatedScene,o);c.snippetId=t,s(c)}else i("Unable to load the snippet "+t)}),n.open("GET",this.SnippetUrl+"/"+t.replace(/#/g,"/")),n.send()})}}p.SnippetUrl="https://snippet.babylonjs.com";p.CreateFromSnippetAsync=p.ParseFromSnippetAsync;J("BABYLON.ShaderMaterial",p);export{p as ShaderMaterial}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowGenerator-D_kEUQNK.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowGenerator-D_kEUQNK.js new file mode 100644 index 0000000000000000000000000000000000000000..317c32b7edd86552cbc7b1f7328bb9c1f151a1d1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowGenerator-D_kEUQNK.js @@ -0,0 +1,3 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./shadowMap.fragment-DE-Rb_jY.js","./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./packingFunctions-BOaWr_dk.js","./clipPlaneFragment-C7XUrTAZ.js","./shadowMap.vertex-A1qFnkfA.js","./bonesDeclaration-Bh_c0MF7.js","./instancesVertex-CO_CTxxp.js","./morphTargetsVertexDeclaration-BsT9JpOT.js","./helperFunctions-CZpZ-EbL.js","./sceneUboDeclaration-BH1tZjjY.js","./meshUboDeclaration-Bk1ASTX2.js","./clipPlaneVertex-J3Krgsee.js","./morphTargetsVertex-DcRl6X3j.js","./bonesVertex-bl6LLSA1.js","./bakedVertexAnimation-DoavwM49.js","./depthBoxBlur.fragment-D3tCU99k.js","./shadowMapFragmentSoftTransparentShadow-Dw8OP7pX.js","./shadowMap.fragment-DvHQ_b8D.js","./packingFunctions-BPfzqklr.js","./clipPlaneFragment-T8W7CIC5.js","./shadowMap.vertex-CAu9rU1j.js","./bakedVertexAnimation-BwUJBnNt.js","./morphTargetsVertex-7Q90Wwr8.js","./helperFunctions-BkWNqKeI.js","./sceneUboDeclaration-C4vXUqkq.js","./meshUboDeclaration-C6raEdzf.js","./clipPlaneVertex-Bmw4TNCQ.js","./depthBoxBlur.fragment-DyrvnXqO.js","./shadowMapFragmentSoftTransparentShadow-IM26FEnM.js"])))=>i.map(i=>d[i]); +import{af as L}from"./index-DWyDLubb.js";import{aA as v,T as S,b7 as B,e as K,_ as C,b8 as Y,s as z,R as Q,O as F,V as O,M as b,aL as D,b9 as U,ba as y,ah as k,bb as j,aI as H,c as W,a5 as Z,a2 as q,b5 as $,J as M,E as J,b3 as G,b4 as ee,b2 as te,Y as se,bc as ie,bd as V,be as re}from"./index-CDrXokXW.js";class P extends v{get direction(){return this._effectWrapper.direction}set direction(e){this._effectWrapper.direction=e}set kernel(e){this._effectWrapper.kernel=e}get kernel(){return this._effectWrapper.kernel}set packedFloat(e){this._effectWrapper.packedFloat=e}get packedFloat(){return this._effectWrapper.packedFloat}getClassName(){return"BlurPostProcess"}constructor(e,t,s,i,a=null,r=S.BILINEAR_SAMPLINGMODE,h,o,d=0,f="",l=!1,g=5){const c=typeof i=="number"?l:!!i.blockCompilation,_={uniforms:B.Uniforms,samplers:B.Samplers,size:typeof i=="number"?i:void 0,camera:a,samplingMode:r,engine:h,reusable:o,textureType:d,vertexUrl:B.VertexUrl,indexParameters:{varyingCount:0,depCount:0},textureFormat:g,defines:f,...i,blockCompilation:!0};super(e,B.FragmentUrl,{effectWrapper:typeof i=="number"||!i.effectWrapper?new B(e,h,void 0,void 0,_):void 0,..._}),this._effectWrapper.options.blockCompilation=c,this.direction=t,this.onApplyObservable.add(()=>{this._effectWrapper.textureWidth=this._outputTexture?this._outputTexture.width:this.width,this._effectWrapper.textureHeight=this._outputTexture?this._outputTexture.height:this.height}),this.kernel=s}updateEffect(e=null,t=null,s=null,i,a,r){this._effectWrapper._updateParameters(a,r)}static _Parse(e,t,s,i){return K.Parse(()=>new P(e.name,e.direction,e.kernel,e.options,t,e.renderTargetSamplingMode,s.getEngine(),e.reusable,e.textureType,void 0,!1),e,s,i)}}C([Y()],P.prototype,"direction",null);C([z()],P.prototype,"kernel",null);C([z()],P.prototype,"packedFloat",null);Q("BABYLON.BlurPostProcess",P);class n{get bias(){return this._bias}set bias(e){this._bias=e}get normalBias(){return this._normalBias}set normalBias(e){this._normalBias=e}get blurBoxOffset(){return this._blurBoxOffset}set blurBoxOffset(e){this._blurBoxOffset!==e&&(this._blurBoxOffset=e,this._disposeBlurPostProcesses())}get blurScale(){return this._blurScale}set blurScale(e){this._blurScale!==e&&(this._blurScale=e,this._disposeBlurPostProcesses())}get blurKernel(){return this._blurKernel}set blurKernel(e){this._blurKernel!==e&&(this._blurKernel=e,this._disposeBlurPostProcesses())}get useKernelBlur(){return this._useKernelBlur}set useKernelBlur(e){this._useKernelBlur!==e&&(this._useKernelBlur=e,this._disposeBlurPostProcesses())}get depthScale(){return this._depthScale!==void 0?this._depthScale:this._light.getDepthScale()}set depthScale(e){this._depthScale=e}_validateFilter(e){return e}get filter(){return this._filter}set filter(e){if(e=this._validateFilter(e),this._light.needCube()){if(e===n.FILTER_BLUREXPONENTIALSHADOWMAP){this.useExponentialShadowMap=!0;return}else if(e===n.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP){this.useCloseExponentialShadowMap=!0;return}else if(e===n.FILTER_PCF||e===n.FILTER_PCSS){this.usePoissonSampling=!0;return}}if((e===n.FILTER_PCF||e===n.FILTER_PCSS)&&!this._scene.getEngine()._features.supportShadowSamplers){this.usePoissonSampling=!0;return}this._filter!==e&&(this._filter=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty())}get usePoissonSampling(){return this.filter===n.FILTER_POISSONSAMPLING}set usePoissonSampling(e){const t=this._validateFilter(n.FILTER_POISSONSAMPLING);!e&&this.filter!==n.FILTER_POISSONSAMPLING||(this.filter=e?t:n.FILTER_NONE)}get useExponentialShadowMap(){return this.filter===n.FILTER_EXPONENTIALSHADOWMAP}set useExponentialShadowMap(e){const t=this._validateFilter(n.FILTER_EXPONENTIALSHADOWMAP);!e&&this.filter!==n.FILTER_EXPONENTIALSHADOWMAP||(this.filter=e?t:n.FILTER_NONE)}get useBlurExponentialShadowMap(){return this.filter===n.FILTER_BLUREXPONENTIALSHADOWMAP}set useBlurExponentialShadowMap(e){const t=this._validateFilter(n.FILTER_BLUREXPONENTIALSHADOWMAP);!e&&this.filter!==n.FILTER_BLUREXPONENTIALSHADOWMAP||(this.filter=e?t:n.FILTER_NONE)}get useCloseExponentialShadowMap(){return this.filter===n.FILTER_CLOSEEXPONENTIALSHADOWMAP}set useCloseExponentialShadowMap(e){const t=this._validateFilter(n.FILTER_CLOSEEXPONENTIALSHADOWMAP);!e&&this.filter!==n.FILTER_CLOSEEXPONENTIALSHADOWMAP||(this.filter=e?t:n.FILTER_NONE)}get useBlurCloseExponentialShadowMap(){return this.filter===n.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP}set useBlurCloseExponentialShadowMap(e){const t=this._validateFilter(n.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP);!e&&this.filter!==n.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP||(this.filter=e?t:n.FILTER_NONE)}get usePercentageCloserFiltering(){return this.filter===n.FILTER_PCF}set usePercentageCloserFiltering(e){const t=this._validateFilter(n.FILTER_PCF);!e&&this.filter!==n.FILTER_PCF||(this.filter=e?t:n.FILTER_NONE)}get filteringQuality(){return this._filteringQuality}set filteringQuality(e){this._filteringQuality!==e&&(this._filteringQuality=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty())}get useContactHardeningShadow(){return this.filter===n.FILTER_PCSS}set useContactHardeningShadow(e){const t=this._validateFilter(n.FILTER_PCSS);!e&&this.filter!==n.FILTER_PCSS||(this.filter=e?t:n.FILTER_NONE)}get contactHardeningLightSizeUVRatio(){return this._contactHardeningLightSizeUVRatio}set contactHardeningLightSizeUVRatio(e){this._contactHardeningLightSizeUVRatio=e}get darkness(){return this._darkness}set darkness(e){this.setDarkness(e)}getDarkness(){return this._darkness}setDarkness(e){return e>=1?this._darkness=1:e<=0?this._darkness=0:this._darkness=e,this}get transparencyShadow(){return this._transparencyShadow}set transparencyShadow(e){this.setTransparencyShadow(e)}setTransparencyShadow(e){return this._transparencyShadow=e,this}getShadowMap(){return this._shadowMap}getShadowMapForRendering(){return this._shadowMap2?this._shadowMap2:this._shadowMap}getClassName(){return n.CLASSNAME}addShadowCaster(e,t=!0){if(!this._shadowMap)return this;if(this._shadowMap.renderList||(this._shadowMap.renderList=[]),this._shadowMap.renderList.indexOf(e)===-1&&this._shadowMap.renderList.push(e),t)for(const s of e.getChildMeshes())this._shadowMap.renderList.indexOf(s)===-1&&this._shadowMap.renderList.push(s);return this}removeShadowCaster(e,t=!0){if(!this._shadowMap||!this._shadowMap.renderList)return this;const s=this._shadowMap.renderList.indexOf(e);if(s!==-1&&this._shadowMap.renderList.splice(s,1),t)for(const i of e.getChildren())this.removeShadowCaster(i);return this}getLight(){return this._light}get shaderLanguage(){return this._shaderLanguage}_getCamera(){return this._camera??this._scene.activeCamera}get mapSize(){return this._mapSize}set mapSize(e){this._mapSize=e,this._light._markMeshesAsLightDirty(),this.recreateShadowMap()}constructor(e,t,s,i,a,r=!1){this.onBeforeShadowMapRenderObservable=new F,this.onAfterShadowMapRenderObservable=new F,this.onBeforeShadowMapRenderMeshObservable=new F,this.onAfterShadowMapRenderMeshObservable=new F,this.doNotSerialize=!1,this._bias=5e-5,this._normalBias=0,this._blurBoxOffset=1,this._blurScale=2,this._blurKernel=1,this._useKernelBlur=!1,this._filter=n.FILTER_NONE,this._filteringQuality=n.QUALITY_HIGH,this._contactHardeningLightSizeUVRatio=.1,this._darkness=0,this._transparencyShadow=!1,this.enableSoftTransparentShadow=!1,this.useOpacityTextureForTransparentShadow=!1,this.frustumEdgeFalloff=0,this._shaderLanguage=0,this.forceBackFacesOnly=!1,this._lightDirection=O.Zero(),this._viewMatrix=b.Zero(),this._projectionMatrix=b.Zero(),this._transformMatrix=b.Zero(),this._cachedPosition=new O(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cachedDirection=new O(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._currentFaceIndex=0,this._currentFaceIndexCache=0,this._defaultTextureMatrix=b.Identity(),this._shadersLoaded=!1,this._mapSize=e,this._light=t,this._scene=t.getScene(),this._camera=i??null,this._useRedTextureType=!!a,this._initShaderSourceAsync(r);let h=t._shadowGenerators;h||(h=t._shadowGenerators=new Map),h.set(this._camera,this),this.id=t.id,this._useUBO=this._scene.getEngine().supportsUniformBuffers,this._useUBO&&(this._sceneUBOs=[],this._sceneUBOs.push(this._scene.createSceneUniformBuffer(`Scene for Shadow Generator (light "${this._light.name}")`))),n._SceneComponentInitialization(this._scene);const o=this._scene.getEngine().getCaps();s?o.textureFloatRender&&o.textureFloatLinearFiltering?this._textureType=1:o.textureHalfFloatRender&&o.textureHalfFloatLinearFiltering?this._textureType=2:this._textureType=0:o.textureHalfFloatRender&&o.textureHalfFloatLinearFiltering?this._textureType=2:o.textureFloatRender&&o.textureFloatLinearFiltering?this._textureType=1:this._textureType=0,this._initializeGenerator(),this._applyFilterValues()}_initializeGenerator(){this._light._markMeshesAsLightDirty(),this._initializeShadowMap()}_createTargetRenderTexture(){const e=this._scene.getEngine();this._shadowMap?.dispose(),e._features.supportDepthStencilTexture?(this._shadowMap=new D(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube(),void 0,!1,!1,void 0,this._useRedTextureType?6:5),this._shadowMap.createDepthStencilTexture(e.useReverseDepthBuffer?516:513,!0,void 0,void 0,void 0,`DepthStencilForShadowGenerator-${this._light.name}`)):this._shadowMap=new D(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube()),this._shadowMap.noPrePassRenderer=!0}_initializeShadowMap(){if(this._createTargetRenderTexture(),this._shadowMap===null)return;this._shadowMap.wrapU=S.CLAMP_ADDRESSMODE,this._shadowMap.wrapV=S.CLAMP_ADDRESSMODE,this._shadowMap.anisotropicFilteringLevel=1,this._shadowMap.updateSamplingMode(S.BILINEAR_SAMPLINGMODE),this._shadowMap.renderParticles=!1,this._shadowMap.ignoreCameraViewport=!0,this._storedUniqueId&&(this._shadowMap.uniqueId=this._storedUniqueId),this._shadowMap.customRenderFunction=(i,a,r,h)=>this._renderForShadowMap(i,a,r,h),this._shadowMap.customIsReadyFunction=(i,a,r)=>{if(!r||!i.subMeshes)return!0;let h=!0;for(const o of i.subMeshes){const d=o.getRenderingMesh(),l=this._scene.getEngine(),g=o.getMaterial();if(!g||o.verticesCount===0||this.customAllowRendering&&!this.customAllowRendering(o))continue;const c=d._getInstancesRenderList(o._id,!!o.getReplacementMesh());if(c.mustReturn)continue;const _=l.getCaps().instancedArrays&&(c.visibleInstances[o._id]!==null&&c.visibleInstances[o._id]!==void 0||d.hasThinInstances),x=g.needAlphaBlendingForMesh(d);h=this.isReady(o,_,x)&&h}return h};const e=this._scene.getEngine();this._shadowMap.onBeforeBindObservable.add(()=>{this._currentSceneUBO=this._scene.getSceneUniformBuffer(),e._enableGPUDebugMarkers&&(e.restoreDefaultFramebuffer(),e._debugPushGroup?.(`Shadow map generation for pass id ${e.currentRenderPassId}`))}),this._shadowMap.onBeforeRenderObservable.add(i=>{this._sceneUBOs&&this._scene.setSceneUniformBuffer(this._sceneUBOs[0]),this._currentFaceIndex=i,this._filter===n.FILTER_PCF&&e.setColorWrite(!1),this.getTransformMatrix(),V.eyeAtCamera=!1,this._scene.setTransformMatrix(this._viewMatrix,this._projectionMatrix),this._useUBO&&(this._scene.getSceneUniformBuffer().unbindEffect(),this._scene.finalizeSceneUbo())}),this._shadowMap.onAfterUnbindObservable.add(()=>{if(this._sceneUBOs&&this._scene.setSceneUniformBuffer(this._currentSceneUBO),V.eyeAtCamera=!0,this._scene.updateTransformMatrix(),this._filter===n.FILTER_PCF&&e.setColorWrite(!0),!this.useBlurExponentialShadowMap&&!this.useBlurCloseExponentialShadowMap){e._debugPopGroup?.();return}const i=this.getShadowMapForRendering();i&&(this._scene.postProcessManager.directRender(this._blurPostProcesses,i.renderTarget,!0),e.unBindFramebuffer(i.renderTarget,!0)),e._enableGPUDebugMarkers&&e._debugPopGroup?.()});const t=new U(0,0,0,0),s=new U(1,1,1,1);this._shadowMap.onClearObservable.add(i=>{this._filter===n.FILTER_PCF?i.clear(s,!1,!0,!1):this.useExponentialShadowMap||this.useBlurExponentialShadowMap?i.clear(t,!0,!0,!1):i.clear(s,!0,!0,!1)}),this._shadowMap.onResizeObservable.add(i=>{this._storedUniqueId=this._shadowMap.uniqueId,this._mapSize=i.getRenderSize(),this._light._markMeshesAsLightDirty(),this.recreateShadowMap()});for(let i=y.MIN_RENDERINGGROUPS;iimport("./shadowMap.fragment-DE-Rb_jY.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),L(()=>import("./shadowMap.vertex-A1qFnkfA.js"),__vite__mapDeps([6,1,2,3,7,8,9,10,11,12,13,14,15,16]),import.meta.url),L(()=>import("./depthBoxBlur.fragment-D3tCU99k.js"),__vite__mapDeps([17,1,2,3]),import.meta.url),L(()=>import("./shadowMapFragmentSoftTransparentShadow-Dw8OP7pX.js"),__vite__mapDeps([18,1,2,3]),import.meta.url)])):await Promise.all([L(()=>import("./shadowMap.fragment-DvHQ_b8D.js"),__vite__mapDeps([19,1,2,3,20,21]),import.meta.url),L(()=>import("./shadowMap.vertex-CAu9rU1j.js"),__vite__mapDeps([22,1,2,3,23,24,25,26,27,28]),import.meta.url),L(()=>import("./depthBoxBlur.fragment-DyrvnXqO.js"),__vite__mapDeps([29,1,2,3]),import.meta.url),L(()=>import("./shadowMapFragmentSoftTransparentShadow-IM26FEnM.js"),__vite__mapDeps([30,1,2,3]),import.meta.url)]),this._shadersLoaded=!0}_initializeBlurRTTAndPostProcesses(){const e=this._scene.getEngine(),t=this._mapSize/this.blurScale;(!this.useKernelBlur||this.blurScale!==1)&&(this._shadowMap2=new D(this._light.name+"_shadowMap2",t,this._scene,!1,!0,this._textureType,void 0,void 0,!1),this._shadowMap2.wrapU=S.CLAMP_ADDRESSMODE,this._shadowMap2.wrapV=S.CLAMP_ADDRESSMODE,this._shadowMap2.updateSamplingMode(S.BILINEAR_SAMPLINGMODE)),this.useKernelBlur?(this._kernelBlurXPostprocess=new P(this._light.name+"KernelBlurX",new k(1,0),this.blurKernel,1,null,S.BILINEAR_SAMPLINGMODE,e,!1,this._textureType),this._kernelBlurXPostprocess.width=t,this._kernelBlurXPostprocess.height=t,this._kernelBlurXPostprocess.externalTextureSamplerBinding=!0,this._kernelBlurXPostprocess.onApplyObservable.add(s=>{s.setTexture("textureSampler",this._shadowMap)}),this._kernelBlurYPostprocess=new P(this._light.name+"KernelBlurY",new k(0,1),this.blurKernel,1,null,S.BILINEAR_SAMPLINGMODE,e,!1,this._textureType),this._kernelBlurXPostprocess.autoClear=!1,this._kernelBlurYPostprocess.autoClear=!1,this._textureType===0&&(this._kernelBlurXPostprocess.packedFloat=!0,this._kernelBlurYPostprocess.packedFloat=!0),this._blurPostProcesses=[this._kernelBlurXPostprocess,this._kernelBlurYPostprocess]):(this._boxBlurPostprocess=new v(this._light.name+"DepthBoxBlur","depthBoxBlur",["screenSize","boxOffset"],[],1,null,S.BILINEAR_SAMPLINGMODE,e,!1,"#define OFFSET "+this._blurBoxOffset,this._textureType,void 0,void 0,void 0,void 0,this._shaderLanguage),this._boxBlurPostprocess.externalTextureSamplerBinding=!0,this._boxBlurPostprocess.onApplyObservable.add(s=>{s.setFloat2("screenSize",t,t),s.setTexture("textureSampler",this._shadowMap)}),this._boxBlurPostprocess.autoClear=!1,this._blurPostProcesses=[this._boxBlurPostprocess])}_renderForShadowMap(e,t,s,i){let a;if(i.length)for(a=0;a{i!==s&&!m?(s.getMeshUniformBuffer().bindToEffect(u,"Mesh"),s.transferToEffect(E)):(i.getMeshUniformBuffer().bindToEffect(u,"Mesh"),i.transferToEffect(m?E:I))}),this.forceBackFacesOnly&&r.setState(!0,0,!1,!1,h.cullBackFaces),this.onAfterShadowMapRenderObservable.notifyObservers(u),this.onAfterShadowMapRenderMeshObservable.notifyObservers(s)}else this._shadowMap&&this._shadowMap.resetRefreshCounter()}_applyFilterValues(){this._shadowMap&&(this.filter===n.FILTER_NONE||this.filter===n.FILTER_PCSS?this._shadowMap.updateSamplingMode(S.NEAREST_SAMPLINGMODE):this._shadowMap.updateSamplingMode(S.BILINEAR_SAMPLINGMODE))}forceCompilation(e,t){const s={useInstances:!1,...t},i=this.getShadowMap();if(!i){e&&e(this);return}const a=i.renderList;if(!a){e&&e(this);return}const r=[];for(const d of a)r.push(...d.subMeshes);if(r.length===0){e&&e(this);return}let h=0;const o=()=>{if(!(!this._scene||!this._scene.getEngine())){for(;this.isReady(r[h],s.useInstances,r[h].getMaterial()?.needAlphaBlendingForMesh(r[h].getMesh())??!1);)if(h++,h>=r.length){e&&e(this);return}setTimeout(o,16)}};o()}async forceCompilationAsync(e){return await new Promise(t=>{this.forceCompilation(()=>{t()},e)})}_isReadyCustomDefines(e,t,s){}_prepareShadowDefines(e,t,s,i){s.push("#define SM_LIGHTTYPE_"+this._light.getClassName().toUpperCase()),s.push("#define SM_FLOAT "+(this._textureType!==0?"1":"0")),s.push("#define SM_ESM "+(this.useExponentialShadowMap||this.useBlurExponentialShadowMap?"1":"0")),s.push("#define SM_DEPTHTEXTURE "+(this.usePercentageCloserFiltering||this.useContactHardeningShadow?"1":"0"));const a=e.getMesh();return s.push("#define SM_NORMALBIAS "+(this.normalBias&&a.isVerticesDataPresent(M.NormalKind)?"1":"0")),s.push("#define SM_DIRECTIONINLIGHTDATA "+(this.getLight().getTypeID()===H.LIGHTTYPEID_DIRECTIONALLIGHT?"1":"0")),s.push("#define SM_USEDISTANCE "+(this._light.needCube()?"1":"0")),s.push("#define SM_SOFTTRANSPARENTSHADOW "+(this.enableSoftTransparentShadow&&i?"1":"0")),this._isReadyCustomDefines(s,e,t),s}isReady(e,t,s){if(!this._shadersLoaded)return!1;const i=e.getMaterial(),a=i?.shadowDepthWrapper;if(this._opacityTexture=null,!i)return!1;const r=[];if(this._prepareShadowDefines(e,t,r,s),a){if(!a.isReadyForSubMesh(e,r,this,t,this._scene.getEngine().currentRenderPassId))return!1}else{const h=e._getDrawWrapper(void 0,!0);let o=h.effect,d=h.defines;const f=[M.PositionKind],l=e.getMesh();let g=!1,c=!1,_=!1;const x=!1;this.normalBias&&l.isVerticesDataPresent(M.NormalKind)&&(f.push(M.NormalKind),r.push("#define NORMAL"),g=!0,l.nonUniformScaling&&r.push("#define NONUNIFORMSCALING"));const u=i.needAlphaTestingForMesh(l);if((u||i.needAlphaBlendingForMesh(l))&&(this.useOpacityTextureForTransparentShadow?this._opacityTexture=i.opacityTexture:this._opacityTexture=i.getAlphaTestTexture(),this._opacityTexture)){if(!this._opacityTexture.isReady())return!1;const p=i.alphaCutOff??n.DEFAULT_ALPHA_CUTOFF;r.push("#define ALPHATEXTURE"),u&&r.push(`#define ALPHATESTVALUE ${p}${p%1===0?".":""}`),l.isVerticesDataPresent(M.UVKind)&&(f.push(M.UVKind),r.push("#define UV1"),c=!0),l.isVerticesDataPresent(M.UV2Kind)&&this._opacityTexture.coordinatesIndex===1&&(f.push(M.UV2Kind),r.push("#define UV2"),_=!0)}const A=new J;if(l.useBones&&l.computeBonesUsingShaders&&l.skeleton){f.push(M.MatricesIndicesKind),f.push(M.MatricesWeightsKind),l.numBoneInfluencers>4&&(f.push(M.MatricesIndicesExtraKind),f.push(M.MatricesWeightsExtraKind));const p=l.skeleton;r.push("#define NUM_BONE_INFLUENCERS "+l.numBoneInfluencers),l.numBoneInfluencers>0&&A.addCPUSkinningFallback(0,l),p.isUsingTextureForMatrices?r.push("#define BONETEXTURE"):r.push("#define BonesPerMesh "+(p.bones.length+1))}else r.push("#define NUM_BONE_INFLUENCERS 0");const I=l.morphTargetManager?G(l.morphTargetManager,r,f,l,!0,g,!1,c,_,x):0;if(ee(i,this._scene,r),t&&(r.push("#define INSTANCES"),te(f),e.getRenderingMesh().hasThinInstances&&r.push("#define THIN_INSTANCES")),this.customShaderOptions&&this.customShaderOptions.defines)for(const p of this.customShaderOptions.defines)r.indexOf(p)===-1&&r.push(p);const m=l.bakedVertexAnimationManager;m&&m.isEnabled&&(r.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),t&&f.push("bakedVertexAnimationSettingsInstanced"));const E=r.join(` +`);if(d!==E){d=E;let p="shadowMap";const R=["world","mBones","viewProjection","diffuseMatrix","lightDataSM","depthValuesSM","biasAndScaleSM","morphTargetInfluences","morphTargetCount","boneTextureWidth","softTransparentShadowSM","morphTargetTextureInfo","morphTargetTextureIndices","bakedVertexAnimationSettings","bakedVertexAnimationTextureSizeInverted","bakedVertexAnimationTime","bakedVertexAnimationTexture"],w=["diffuseSampler","boneSampler","morphTargets","bakedVertexAnimationTexture"],X=["Scene","Mesh"];if(se(R),this.customShaderOptions){if(p=this.customShaderOptions.shaderName,this.customShaderOptions.attributes)for(const T of this.customShaderOptions.attributes)f.indexOf(T)===-1&&f.push(T);if(this.customShaderOptions.uniforms)for(const T of this.customShaderOptions.uniforms)R.indexOf(T)===-1&&R.push(T);if(this.customShaderOptions.samplers)for(const T of this.customShaderOptions.samplers)w.indexOf(T)===-1&&w.push(T)}const N=this._scene.getEngine();o=N.createEffect(p,{attributes:f,uniformsNames:R,uniformBuffersNames:X,samplers:w,defines:E,fallbacks:A,onCompiled:null,onError:null,indexParameters:{maxSimultaneousMorphTargets:I},shaderLanguage:this._shaderLanguage},N),h.setEffect(o,d)}if(!o.isReady())return!1}return(this.useBlurExponentialShadowMap||this.useBlurCloseExponentialShadowMap)&&(!this._blurPostProcesses||!this._blurPostProcesses.length)&&this._initializeBlurRTTAndPostProcesses(),!(this._kernelBlurXPostprocess&&!this._kernelBlurXPostprocess.isReady()||this._kernelBlurYPostprocess&&!this._kernelBlurYPostprocess.isReady()||this._boxBlurPostprocess&&!this._boxBlurPostprocess.isReady())}prepareDefines(e,t){const s=this._scene,i=this._light;!s.shadowsEnabled||!i.shadowEnabled||(e["SHADOW"+t]=!0,this.useContactHardeningShadow?(e["SHADOWPCSS"+t]=!0,this._filteringQuality===n.QUALITY_LOW?e["SHADOWLOWQUALITY"+t]=!0:this._filteringQuality===n.QUALITY_MEDIUM&&(e["SHADOWMEDIUMQUALITY"+t]=!0)):this.usePercentageCloserFiltering?(e["SHADOWPCF"+t]=!0,this._filteringQuality===n.QUALITY_LOW?e["SHADOWLOWQUALITY"+t]=!0:this._filteringQuality===n.QUALITY_MEDIUM&&(e["SHADOWMEDIUMQUALITY"+t]=!0)):this.usePoissonSampling?e["SHADOWPOISSON"+t]=!0:this.useExponentialShadowMap||this.useBlurExponentialShadowMap?e["SHADOWESM"+t]=!0:(this.useCloseExponentialShadowMap||this.useBlurCloseExponentialShadowMap)&&(e["SHADOWCLOSEESM"+t]=!0),i.needCube()&&(e["SHADOWCUBE"+t]=!0))}bindShadowLight(e,t){const s=this._light,i=this._scene;if(!i.shadowsEnabled||!s.shadowEnabled)return;const a=this._getCamera(),r=this.getShadowMap();if(!r)return;if(!s.needCube()){const o=i.floatingOriginOffset,d=this.getTransformMatrix(),f=i.floatingOriginMode?ie(o,this._viewMatrix,this._projectionMatrix,W.Matrix[0]):d;t.setMatrix("lightMatrix"+e,f)}const h=this.getShadowMapForRendering();this._filter===n.FILTER_PCF?(t.setDepthStencilTexture("shadowTexture"+e,h),s._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),r.getSize().width,1/r.getSize().width,this.frustumEdgeFalloff,e)):this._filter===n.FILTER_PCSS?(t.setDepthStencilTexture("shadowTexture"+e,h),t.setTexture("depthTexture"+e,h),s._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),1/r.getSize().width,this._contactHardeningLightSizeUVRatio*r.getSize().width,this.frustumEdgeFalloff,e)):(t.setTexture("shadowTexture"+e,h),s._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),this.blurScale/r.getSize().width,this.depthScale,this.frustumEdgeFalloff,e)),s._uniformBuffer.updateFloat2("depthValues",this.getLight().getDepthMinZ(a),this.getLight().getDepthMinZ(a)+this.getLight().getDepthMaxZ(a),e)}get viewMatrix(){return this._viewMatrix}get projectionMatrix(){return this._projectionMatrix}getTransformMatrix(){const e=this._scene;if(this._currentRenderId===e.getRenderId()&&this._currentFaceIndexCache===this._currentFaceIndex)return this._transformMatrix;this._currentRenderId=e.getRenderId(),this._currentFaceIndexCache=this._currentFaceIndex;let t=this._light.position;if(this._light.computeTransformedInformation()&&(t=this._light.transformedPosition),O.NormalizeToRef(this._light.getShadowDirection(this._currentFaceIndex),this._lightDirection),Math.abs(O.Dot(this._lightDirection,O.Up()))===1&&(this._lightDirection.z=1e-13),this._light.needProjectionMatrixCompute()||!this._cachedPosition||!this._cachedDirection||!t.equals(this._cachedPosition)||!this._lightDirection.equals(this._cachedDirection)){this._cachedPosition.copyFrom(t),this._cachedDirection.copyFrom(this._lightDirection),b.LookAtLHToRef(t,t.add(this._lightDirection),O.Up(),this._viewMatrix);const s=this.getShadowMap();if(s){const i=s.renderList;i&&this._light.setShadowProjectionMatrix(this._projectionMatrix,this._viewMatrix,i)}this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix)}return this._transformMatrix}recreateShadowMap(){const e=this._shadowMap;if(!e)return;const t=e.renderList;if(this._disposeRTTandPostProcesses(),this._initializeGenerator(),this.filter=this._filter,this._applyFilterValues(),t){this._shadowMap.renderList||(this._shadowMap.renderList=[]);for(const s of t)this._shadowMap.renderList.push(s)}else this._shadowMap.renderList=null}_disposeBlurPostProcesses(){this._shadowMap2&&(this._shadowMap2.dispose(),this._shadowMap2=null),this._boxBlurPostprocess&&(this._boxBlurPostprocess.dispose(),this._boxBlurPostprocess=null),this._kernelBlurXPostprocess&&(this._kernelBlurXPostprocess.dispose(),this._kernelBlurXPostprocess=null),this._kernelBlurYPostprocess&&(this._kernelBlurYPostprocess.dispose(),this._kernelBlurYPostprocess=null),this._blurPostProcesses=[]}_disposeRTTandPostProcesses(){this._shadowMap&&(this._shadowMap.dispose(),this._shadowMap=null),this._disposeBlurPostProcesses()}_disposeSceneUBOs(){if(this._sceneUBOs){for(const e of this._sceneUBOs)e.dispose();this._sceneUBOs=[]}}dispose(){if(this._disposeRTTandPostProcesses(),this._disposeSceneUBOs(),this._light){if(this._light._shadowGenerators){const e=this._light._shadowGenerators.entries();for(let t=e.next();t.done!==!0;t=e.next()){const[s,i]=t.value;i===this&&this._light._shadowGenerators.delete(s)}this._light._shadowGenerators.size===0&&(this._light._shadowGenerators=null)}this._light._markMeshesAsLightDirty()}this.onBeforeShadowMapRenderMeshObservable.clear(),this.onBeforeShadowMapRenderObservable.clear(),this.onAfterShadowMapRenderMeshObservable.clear(),this.onAfterShadowMapRenderObservable.clear()}serialize(){const e={},t=this.getShadowMap();if(!t)return e;if(e.className=this.getClassName(),e.lightId=this._light.id,e.cameraId=this._camera?.id,e.id=this.id,e.mapSize=t.getRenderSize(),e.forceBackFacesOnly=this.forceBackFacesOnly,e.darkness=this.getDarkness(),e.transparencyShadow=this._transparencyShadow,e.frustumEdgeFalloff=this.frustumEdgeFalloff,e.bias=this.bias,e.normalBias=this.normalBias,e.usePercentageCloserFiltering=this.usePercentageCloserFiltering,e.useContactHardeningShadow=this.useContactHardeningShadow,e.contactHardeningLightSizeUVRatio=this.contactHardeningLightSizeUVRatio,e.filteringQuality=this.filteringQuality,e.useExponentialShadowMap=this.useExponentialShadowMap,e.useBlurExponentialShadowMap=this.useBlurExponentialShadowMap,e.useCloseExponentialShadowMap=this.useBlurExponentialShadowMap,e.useBlurCloseExponentialShadowMap=this.useBlurExponentialShadowMap,e.usePoissonSampling=this.usePoissonSampling,e.depthScale=this.depthScale,e.blurBoxOffset=this.blurBoxOffset,e.blurKernel=this.blurKernel,e.blurScale=this.blurScale,e.useKernelBlur=this.useKernelBlur,e.renderList=[],t.renderList)for(let s=0;s{throw re("ShadowGeneratorSceneComponent")};export{n as ShadowGenerator}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowGeneratorSceneComponent-Cw9Z1Dfz.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowGeneratorSceneComponent-Cw9Z1Dfz.js new file mode 100644 index 0000000000000000000000000000000000000000..e9159b3c579476e0a3938ce6efb82ba328ff075b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowGeneratorSceneComponent-Cw9Z1Dfz.js @@ -0,0 +1,164 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./depth.vertex-CtuzpX69.js","./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./bonesDeclaration-Bh_c0MF7.js","./instancesVertex-CO_CTxxp.js","./morphTargetsVertexDeclaration-BsT9JpOT.js","./clipPlaneVertex-J3Krgsee.js","./instancesDeclaration-DZdrWbmN.js","./morphTargetsVertex-DcRl6X3j.js","./bonesVertex-bl6LLSA1.js","./bakedVertexAnimation-DoavwM49.js","./depth.fragment-B8acPKuR.js","./clipPlaneFragment-C7XUrTAZ.js","./packingFunctions-BOaWr_dk.js"])))=>i.map(i=>d[i]); +import{ShadowGenerator as v}from"./shadowGenerator-D_kEUQNK.js";import{S as R,T as F,b9 as J,aL as se,J as A,E as de,b3 as ce,b2 as ue,b4 as fe,Y as le,b1 as _e,$ as me,a2 as pe,a5 as ge,be as ie,aE as xe,bn as j,O as Me,bE as Se,aA as Ce,V as f,M as T,L as q,aq as ve,av as Ee,bd as be,bF as Re,a as X}from"./index-CDrXokXW.js";import{af as I}from"./index-DWyDLubb.js";import"./clipPlaneFragment-T8W7CIC5.js";import"./packingFunctions-BPfzqklr.js";import"./bakedVertexAnimation-BwUJBnNt.js";import"./morphTargetsVertex-7Q90Wwr8.js";import"./clipPlaneVertex-Bmw4TNCQ.js";import"./instancesDeclaration-BAnfKLCo.js";import"./pointCloudVertex-C-QHJpr_.js";const G="depthPixelShader",re=`#ifdef ALPHATEST +varying vec2 vUV;uniform sampler2D diffuseSampler; +#endif +#include +varying float vDepthMetric; +#ifdef PACKED +#include +#endif +#ifdef STORE_CAMERASPACE_Z +varying vec4 vViewPos; +#endif +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) +{ +#include +#ifdef ALPHATEST +if (texture2D(diffuseSampler,vUV).a<0.4) +discard; +#endif +#ifdef STORE_CAMERASPACE_Z +#ifdef PACKED +gl_FragColor=pack(vViewPos.z); +#else +gl_FragColor=vec4(vViewPos.z,0.0,0.0,1.0); +#endif +#else +#ifdef NONLINEARDEPTH +#ifdef PACKED +gl_FragColor=pack(gl_FragCoord.z); +#else +gl_FragColor=vec4(gl_FragCoord.z,0.0,0.0,0.0); +#endif +#else +#ifdef PACKED +gl_FragColor=pack(vDepthMetric); +#else +gl_FragColor=vec4(vDepthMetric,0.0,0.0,1.0); +#endif +#endif +#endif +}`;R.ShadersStore[G]||(R.ShadersStore[G]=re);const De={name:G,shader:re},Ae=Object.freeze(Object.defineProperty({__proto__:null,depthPixelShader:De},Symbol.toStringTag,{value:"Module"})),Q="pointCloudVertexDeclaration",Te=`#ifdef POINTSIZE +uniform float pointSize; +#endif +`;R.IncludesShadersStore[Q]||(R.IncludesShadersStore[Q]=Te);const K="depthVertexShader",ne=`attribute vec3 position; +#include +#include +#include +#include[0..maxSimultaneousMorphTargets] +#include +#include +uniform mat4 viewProjection;uniform vec2 depthValues; +#if defined(ALPHATEST) || defined(NEED_UV) +varying vec2 vUV;uniform mat4 diffuseMatrix; +#ifdef UV1 +attribute vec2 uv; +#endif +#ifdef UV2 +attribute vec2 uv2; +#endif +#endif +#ifdef STORE_CAMERASPACE_Z +uniform mat4 view;varying vec4 vViewPos; +#endif +#include +varying float vDepthMetric; +#define CUSTOM_VERTEX_DEFINITIONS +void main(void) +{vec3 positionUpdated=position; +#ifdef UV1 +vec2 uvUpdated=uv; +#endif +#ifdef UV2 +vec2 uv2Updated=uv2; +#endif +#include +#include[0..maxSimultaneousMorphTargets] +#include +#include +#include +vec4 worldPos=finalWorld*vec4(positionUpdated,1.0); +#include +gl_Position=viewProjection*worldPos; +#ifdef STORE_CAMERASPACE_Z +vViewPos=view*worldPos; +#else +#ifdef USE_REVERSE_DEPTHBUFFER +vDepthMetric=((-gl_Position.z+depthValues.x)/(depthValues.y)); +#else +vDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y)); +#endif +#endif +#if defined(ALPHATEST) || defined(BASIC_RENDER) +#ifdef UV1 +vUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0)); +#endif +#ifdef UV2 +vUV=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0)); +#endif +#endif +#include +} +`;R.ShadersStore[K]||(R.ShadersStore[K]=ne);const Pe={name:K,shader:ne},we=Object.freeze(Object.defineProperty({__proto__:null,depthVertexShader:Pe},Symbol.toStringTag,{value:"Module"}));class B{get shaderLanguage(){return this._shaderLanguage}setMaterialForRendering(e,t){this._depthMap.setMaterialForRendering(e,t)}constructor(e,t=1,i=null,s=!1,r=F.TRILINEAR_SAMPLINGMODE,n=!1,o,h){this._shaderLanguage=0,this.enabled=!0,this.forceDepthWriteTransparentMeshes=!1,this.useOnlyInActiveCamera=!1,this.reverseCulling=!1,this._shadersLoaded=!1,this._scene=e,this._storeNonLinearDepth=s,this._storeCameraSpaceZ=n,this.isPacked=t===0,this.isPacked?this.clearColor=new J(1,1,1,1):this.clearColor=new J(n?0:1,0,0,1),this._initShaderSourceAsync(),B._SceneComponentInitialization(this._scene);const d=e.getEngine();this._camera=i,r!==F.NEAREST_SAMPLINGMODE&&(t===1&&!d._caps.textureFloatLinearFiltering&&(r=F.NEAREST_SAMPLINGMODE),t===2&&!d._caps.textureHalfFloatLinearFiltering&&(r=F.NEAREST_SAMPLINGMODE));const c=this.isPacked||!d._features.supportExtendedTextureFormats?5:6;this._depthMap=h??new se(o??"DepthRenderer",{width:d.getRenderWidth(),height:d.getRenderHeight()},this._scene,!1,!0,t,!1,r,void 0,void 0,void 0,c),this._depthMap.wrapU=F.CLAMP_ADDRESSMODE,this._depthMap.wrapV=F.CLAMP_ADDRESSMODE,this._depthMap.refreshRate=1,this._depthMap.renderParticles=!1,this._depthMap.renderList=null,this._depthMap.noPrePassRenderer=!0,this._depthMap.activeCamera=this._camera,this._depthMap.ignoreCameraViewport=!0,this._depthMap.useCameraPostProcesses=!1,this._depthMap.onClearObservable.add(u=>{u.clear(this.clearColor,!0,!0,!0)}),this._depthMap.onBeforeBindObservable.add(()=>{d._enableGPUDebugMarkers&&(d.restoreDefaultFramebuffer(),d._debugPushGroup?.("Depth renderer"))}),this._depthMap.onAfterUnbindObservable.add(()=>{d._enableGPUDebugMarkers&&d._debugPopGroup?.()}),this._depthMap.customIsReadyFunction=(u,p,l)=>{if((l||p===0)&&u.subMeshes)for(let m=0;m{const p=u.getRenderingMesh(),l=u.getEffectiveMesh(),m=this._scene,a=m.getEngine(),M=u.getMaterial();if(l._internalAbstractMeshDataInfo._isActiveIntermediate=!1,!M||l.infiniteDistance||M.disableDepthWrite||u.verticesCount===0||u._renderId===m.getRenderId())return;const P=l._getWorldMatrixDeterminant()<0;let E=M._getEffectiveOrientation(p);P&&(E=E===0?1:0);const k=E===0;a.setState(M.backFaceCulling,0,!1,k,this.reverseCulling?!M.cullBackFaces:M.cullBackFaces);const y=p._getInstancesRenderList(u._id,!!u.getReplacementMesh());if(y.mustReturn)return;const N=a.getCaps().instancedArrays&&(y.visibleInstances[u._id]!==null&&y.visibleInstances[u._id]!==void 0||p.hasThinInstances),O=this._camera||m.activeCamera;if(this.isReady(u,N)&&O){u._renderId=m.getRenderId();let D=l._internalAbstractMeshDataInfo._materialForRenderPass?.[a.currentRenderPassId];if(D===void 0&&l.getClassName()==="GaussianSplattingMesh"&&(D=l.material.makeDepthRenderingMaterial(this._scene,this._shaderLanguage),this.setMaterialForRendering(l,D),!D.isReady()))return;let L=u._getDrawWrapper();!L&&D&&(L=D._getDrawWrapper());const he=O.mode===_e.ORTHOGRAPHIC_CAMERA;if(!L)return;const C=L.effect;a.enableEffect(L),N||p._bind(u,C,M.fillMode),D?D.bindForSubMesh(l.getWorldMatrix(),l,u):(C.setMatrix("viewProjection",m.getTransformMatrix()),C.setMatrix("world",l.getWorldMatrix()),this._storeCameraSpaceZ&&C.setMatrix("view",m.getViewMatrix()));let W,H;if(he?(W=!a.useReverseDepthBuffer&&a.isNDCHalfZRange?0:1,H=a.useReverseDepthBuffer&&a.isNDCHalfZRange?0:1):(W=a.useReverseDepthBuffer&&a.isNDCHalfZRange?O.minZ:a.isNDCHalfZRange?0:O.minZ,H=a.useReverseDepthBuffer&&a.isNDCHalfZRange?0:O.maxZ),C.setFloat2("depthValues",W,W+H),!D){if(M.needAlphaTestingForMesh(l)){const V=M.getAlphaTestTexture();V&&(C.setTexture("diffuseSampler",V),C.setMatrix("diffuseMatrix",V.getTextureMatrix()))}me(p,C),pe(C,M,m),ge(p,C),p.morphTargetManager&&p.morphTargetManager.isUsingTextureForTargets&&p.morphTargetManager._bind(C);const U=u.getMesh().bakedVertexAnimationManager;U&&U.isEnabled&&U.bind(C,N),M.pointsCloud&&C.setFloat("pointSize",M.pointSize)}p._processRendering(l,u,C,M.fillMode,y,N,(U,V)=>C.setMatrix("world",V))}};this._depthMap.customRenderFunction=(u,p,l,m)=>{let a;if(m.length)for(a=0;aimport("./depth.vertex-CtuzpX69.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url),I(()=>import("./depth.fragment-B8acPKuR.js"),__vite__mapDeps([12,1,2,3,13,14]),import.meta.url)])):await Promise.all([I(()=>Promise.resolve().then(()=>we),void 0,import.meta.url),I(()=>Promise.resolve().then(()=>Ae),void 0,import.meta.url)]),this._shadersLoaded=!0}isReady(e,t){if(!this._shadersLoaded)return!1;const i=this._scene.getEngine(),s=e.getMesh(),r=s.getScene(),n=s._internalAbstractMeshDataInfo._materialForRenderPass?.[i.currentRenderPassId];if(n)return n.isReadyForSubMesh(s,e,t);const o=e.getMaterial();if(!o||o.disableDepthWrite)return!1;const h=[],d=[A.PositionKind];let c=!1,g=!1;const u=!1;o.needAlphaTestingForMesh(s)&&o.getAlphaTestTexture()&&(h.push("#define ALPHATEST"),s.isVerticesDataPresent(A.UVKind)&&(d.push(A.UVKind),h.push("#define UV1"),c=!0),s.isVerticesDataPresent(A.UV2Kind)&&(d.push(A.UV2Kind),h.push("#define UV2"),g=!0));const p=new de;if(s.useBones&&s.computeBonesUsingShaders&&s.skeleton){d.push(A.MatricesIndicesKind),d.push(A.MatricesWeightsKind),s.numBoneInfluencers>4&&(d.push(A.MatricesIndicesExtraKind),d.push(A.MatricesWeightsExtraKind)),h.push("#define NUM_BONE_INFLUENCERS "+s.numBoneInfluencers),s.numBoneInfluencers>0&&p.addCPUSkinningFallback(0,s);const E=s.skeleton;E.isUsingTextureForMatrices?h.push("#define BONETEXTURE"):h.push("#define BonesPerMesh "+(E.bones.length+1))}else h.push("#define NUM_BONE_INFLUENCERS 0");const l=s.morphTargetManager?ce(s.morphTargetManager,h,d,s,!0,!1,!1,c,g,u):0;o.pointsCloud&&h.push("#define POINTSIZE"),t&&(h.push("#define INSTANCES"),ue(d),e.getRenderingMesh().hasThinInstances&&h.push("#define THIN_INSTANCES"));const m=s.bakedVertexAnimationManager;m&&m.isEnabled&&(h.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),t&&d.push("bakedVertexAnimationSettingsInstanced")),this._storeNonLinearDepth&&h.push("#define NONLINEARDEPTH"),this._storeCameraSpaceZ&&h.push("#define STORE_CAMERASPACE_Z"),this.isPacked&&h.push("#define PACKED"),fe(o,r,h);const a=e._getDrawWrapper(void 0,!0),M=a.defines,P=h.join(` +`);if(M!==P){const E=["world","mBones","boneTextureWidth","pointSize","viewProjection","view","diffuseMatrix","depthValues","morphTargetInfluences","morphTargetCount","morphTargetTextureInfo","morphTargetTextureIndices","bakedVertexAnimationSettings","bakedVertexAnimationTextureSizeInverted","bakedVertexAnimationTime","bakedVertexAnimationTexture"],k=["diffuseSampler","morphTargets","boneSampler","bakedVertexAnimationTexture"];le(E),a.setEffect(i.createEffect("depth",{attributes:d,uniformsNames:E,uniformBuffersNames:[],samplers:k,defines:P,fallbacks:p,onCompiled:null,onError:null,indexParameters:{maxSimultaneousMorphTargets:l},shaderLanguage:this._shaderLanguage},i),P)}return a.effect.isReady()}getDepthMap(){return this._depthMap}dispose(){const e=[];for(const t in this._scene._depthRenderer)this._scene._depthRenderer[t]===this&&e.push(t);if(e.length>0){this._depthMap.dispose();for(const t of e)delete this._scene._depthRenderer[t]}}}B.ForceGLSL=!1;B._SceneComponentInitialization=S=>{throw ie("DepthRendererSceneComponent")};var ee;(function(S){S[S.NormalizedViewDepth=0]="NormalizedViewDepth",S[S.ViewDepth=1]="ViewDepth",S[S.ScreenDepth=2]="ScreenDepth"})(ee||(ee={}));class w extends xe{_gatherImports(e,t){e?(this._webGPUReady=!0,t.push(I(()=>Promise.resolve().then(()=>Ue),void 0,import.meta.url))):t.push(I(()=>Promise.resolve().then(()=>Oe),void 0,import.meta.url))}constructor(e,t=null,i="",s){super({...s,name:e,engine:t||j.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:w.FragmentUrl,uniforms:w.Uniforms,defines:i}),this.textureWidth=0,this.textureHeight=0}bind(e=!1){super.bind(e);const t=this.drawWrapper.effect;this.textureWidth===1||this.textureHeight===1?t.setInt2("texSize",this.textureWidth,this.textureHeight):t.setFloat2("texSize",this.textureWidth,this.textureHeight)}}w.FragmentUrl="minmaxRedux";w.Uniforms=["texSize"];const Fe=new Float32Array(4),ze=new Uint8Array(4),b={min:0,max:0};class Ie{get depthRedux(){return this._depthRedux}set depthRedux(e){this._depthRedux!==e&&(this._depthRedux=e,this._recreatePostProcesses())}get textureWidth(){return this._textureWidth}get textureHeight(){return this._textureHeight}constructor(e,t=!0){this.onAfterReductionPerformed=new Me,this._textureWidth=0,this._textureHeight=0,this._scene=e,this._depthRedux=t,this.reductionSteps=[]}setTextureDimensions(e,t,i=0){return e===this._textureWidth&&t===this._textureHeight&&i===this._depthTextureType?!1:(this._textureWidth=e,this._textureHeight=t,this._depthTextureType=i,this._recreatePostProcesses(),!0)}readMinMax(e){const t=e.type===j.TEXTURETYPE_FLOAT||e.type===j.TEXTURETYPE_HALF_FLOAT,i=t?Fe:ze;this._scene.getEngine()._readTexturePixels(e,1,1,-1,0,i,!1),b.min=i[0],b.max=i[1],t||(b.min=b.min/255,b.max=b.max/255),b.min>=b.max&&(b.min=0,b.max=1),this.onAfterReductionPerformed.notifyObservers(b)}dispose(e=!0){e&&(this.onAfterReductionPerformed.clear(),this._textureWidth=0,this._textureHeight=0);for(let t=0;t1||i>1;){t=Math.max(Math.round(t/2),1),i=Math.max(Math.round(i/2),1);const n=new w("Reduction phase "+r,e.getEngine(),"#define "+(t==1&&i==1?"LAST":t==1||i==1?"ONEBEFORELAST":"MAIN"));n.textureWidth=t,n.textureHeight=i,this.reductionSteps.push(n),r++}}}const $="minmaxReduxPixelShader",ae=`varying vec2 vUV;uniform sampler2D textureSampler; +#if defined(INITIAL) +uniform vec2 texSize;void main(void) +{ivec2 coord=ivec2(vUV*(texSize-1.0));float f1=texelFetch(textureSampler,coord,0).r;float f2=texelFetch(textureSampler,coord+ivec2(1,0),0).r;float f3=texelFetch(textureSampler,coord+ivec2(1,1),0).r;float f4=texelFetch(textureSampler,coord+ivec2(0,1),0).r; +#ifdef DEPTH_REDUX +#ifdef VIEW_DEPTH +float minz=3.4e38;if (f1 != 0.0) { minz=f1; } +if (f2 != 0.0) { minz=min(minz,f2); } +if (f3 != 0.0) { minz=min(minz,f3); } +if (f4 != 0.0) { minz=min(minz,f4); } +float maxz=max(max(max(f1,f2),f3),f4); +#else +float minz=min(min(min(f1,f2),f3),f4);float maxz=max(max(max(sign(1.0-f1)*f1,sign(1.0-f2)*f2),sign(1.0-f3)*f3),sign(1.0-f4)*f4); +#endif +#else +float minz=min(min(min(f1,f2),f3),f4);float maxz=max(max(max(f1,f2),f3),f4); +#endif +glFragColor=vec4(minz,maxz,0.,0.);} +#elif defined(MAIN) +uniform vec2 texSize;void main(void) +{ivec2 coord=ivec2(vUV*(texSize-1.0));vec2 f1=texelFetch(textureSampler,coord,0).rg;vec2 f2=texelFetch(textureSampler,coord+ivec2(1,0),0).rg;vec2 f3=texelFetch(textureSampler,coord+ivec2(1,1),0).rg;vec2 f4=texelFetch(textureSampler,coord+ivec2(0,1),0).rg;float minz=min(min(min(f1.x,f2.x),f3.x),f4.x);float maxz=max(max(max(f1.y,f2.y),f3.y),f4.y);glFragColor=vec4(minz,maxz,0.,0.);} +#elif defined(ONEBEFORELAST) +uniform ivec2 texSize;void main(void) +{ivec2 coord=ivec2(vUV*vec2(texSize-1));vec2 f1=texelFetch(textureSampler,coord % texSize,0).rg;vec2 f2=texelFetch(textureSampler,(coord+ivec2(1,0)) % texSize,0).rg;vec2 f3=texelFetch(textureSampler,(coord+ivec2(1,1)) % texSize,0).rg;vec2 f4=texelFetch(textureSampler,(coord+ivec2(0,1)) % texSize,0).rg;float minz=min(min(min(f1.x,f2.x),f3.x),f4.x);float maxz=max(max(max(f1.y,f2.y),f3.y),f4.y);glFragColor=vec4(minz,maxz,0.,0.);} +#elif defined(LAST) +void main(void) +{glFragColor=vec4(0.);if (true) { +discard;}} +#endif +`;R.ShadersStore[$]||(R.ShadersStore[$]=ae);const Be={name:$,shader:ae},Oe=Object.freeze(Object.defineProperty({__proto__:null,minmaxReduxPixelShader:Be},Symbol.toStringTag,{value:"Module"})),Y="minmaxReduxPixelShader",oe=`varying vUV: vec2f;var textureSampler: texture_2d; +#if defined(INITIAL) +uniform texSize: vec2f;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {let coord=vec2i(fragmentInputs.vUV*(uniforms.texSize-1.0));let f1=textureLoad(textureSampler,coord,0).r;let f2=textureLoad(textureSampler,coord+vec2i(1,0),0).r;let f3=textureLoad(textureSampler,coord+vec2i(1,1),0).r;let f4=textureLoad(textureSampler,coord+vec2i(0,1),0).r; +#ifdef DEPTH_REDUX +#ifdef VIEW_DEPTH +var minz=3.4e38;if (f1 != 0.0) { minz=f1; } +if (f2 != 0.0) { minz=min(minz,f2); } +if (f3 != 0.0) { minz=min(minz,f3); } +if (f4 != 0.0) { minz=min(minz,f4); } +let maxz=max(max(max(f1,f2),f3),f4); +#else +let minz=min(min(min(f1,f2),f3),f4);let maxz=max(max(max(sign(1.0-f1)*f1,sign(1.0-f2)*f2),sign(1.0-f3)*f3),sign(1.0-f4)*f4); +#endif +#else +let minz=min(min(min(f1,f2),f3),f4);let maxz=max(max(max(f1,f2),f3),f4); +#endif +fragmentOutputs.color=vec4f(minz,maxz,0.,0.);} +#elif defined(MAIN) +uniform texSize: vec2f;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {let coord=vec2i(fragmentInputs.vUV*(uniforms.texSize-1.0));let f1=textureLoad(textureSampler,coord,0).rg;let f2=textureLoad(textureSampler,coord+vec2i(1,0),0).rg;let f3=textureLoad(textureSampler,coord+vec2i(1,1),0).rg;let f4=textureLoad(textureSampler,coord+vec2i(0,1),0).rg;let minz=min(min(min(f1.x,f2.x),f3.x),f4.x);let maxz=max(max(max(f1.y,f2.y),f3.y),f4.y);fragmentOutputs.color=vec4(minz,maxz,0.,0.);} +#elif defined(ONEBEFORELAST) +uniform texSize: vec2i;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {let coord=vec2i(fragmentInputs.vUV*vec2f(uniforms.texSize-1));let f1=textureLoad(textureSampler,coord % uniforms.texSize,0).rg;let f2=textureLoad(textureSampler,(coord+vec2i(1,0)) % uniforms.texSize,0).rg;let f3=textureLoad(textureSampler,(coord+vec2i(1,1)) % uniforms.texSize,0).rg;let f4=textureLoad(textureSampler,(coord+vec2i(0,1)) % uniforms.texSize,0).rg;let minz=min(min(min(f1.x,f2.x),f3.x),f4.x);let maxz=max(max(max(f1.y,f2.y),f3.y),f4.y);fragmentOutputs.color=vec4(minz,maxz,0.,0.);} +#elif defined(LAST) +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(0.);if (true) { +discard;}} +#endif +`;R.ShadersStoreWGSL[Y]||(R.ShadersStoreWGSL[Y]=oe);const Le={name:Y,shader:oe},Ue=Object.freeze(Object.defineProperty({__proto__:null,minmaxReduxPixelShaderWGSL:Le},Symbol.toStringTag,{value:"Module"}));class Ve{get onAfterReductionPerformed(){return this._thinMinMaxReducer.onAfterReductionPerformed}constructor(e){this._onAfterUnbindObserver=null,this._forceFullscreenViewport=!0,this._activated=!1,this._camera=e,this._postProcessManager=new Se(e.getScene()),this._thinMinMaxReducer=new Ie(e.getScene()),this._reductionSteps=[],this._onContextRestoredObserver=e.getEngine().onContextRestoredObservable.add(()=>{this._postProcessManager._rebuild()})}get sourceTexture(){return this._sourceTexture}setSourceTexture(e,t,i=2,s=!0){if(e!==this._sourceTexture&&(this._thinMinMaxReducer.depthRedux=t,this.deactivate(),this._sourceTexture=e,this._forceFullscreenViewport=s,this._thinMinMaxReducer.setTextureDimensions(e.getRenderWidth(),e.getRenderHeight()))){this._disposePostProcesses();const r=this._thinMinMaxReducer.reductionSteps;for(let n=0;n{d.setTexture("textureSampler",this._sourceTexture)})),n===r.length-1&&this._reductionSteps[n-1].onAfterRenderObservable.add(()=>{this._thinMinMaxReducer.readMinMax(h.inputTexture.texture)})}}}get refreshRate(){return this._sourceTexture?this._sourceTexture.refreshRate:-1}set refreshRate(e){this._sourceTexture&&(this._sourceTexture.refreshRate=e)}get activated(){return this._activated}activate(){this._onAfterUnbindObserver||!this._sourceTexture||(this._onAfterUnbindObserver=this._sourceTexture.onAfterUnbindObservable.add(()=>{const e=this._camera.getScene().getEngine();e._debugPushGroup?.("min max reduction"),this._reductionSteps[0].activate(this._camera),this._postProcessManager.directRender(this._reductionSteps,this._reductionSteps[0].inputTexture,this._forceFullscreenViewport,0,0,!0,this._reductionSteps.length-1),e.unBindFramebuffer(this._reductionSteps[this._reductionSteps.length-1].inputTexture,!1),e._debugPopGroup?.()}),this._activated=!0)}deactivate(){!this._onAfterUnbindObserver||!this._sourceTexture||(this._sourceTexture.onAfterUnbindObservable.remove(this._onAfterUnbindObserver),this._onAfterUnbindObserver=null,this._activated=!1)}dispose(e=!0){e&&(this.onAfterReductionPerformed.clear(),this._camera.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=void 0,this._disposePostProcesses(),this._postProcessManager.dispose(),this._postProcessManager=void 0,this._thinMinMaxReducer.dispose(),this._thinMinMaxReducer=void 0,this._sourceTexture=null)}_disposePostProcesses(){for(let e=0;ethis._computeShadowCastersBoundingInfo())),this._freezeShadowCastersBoundingInfo=e,e&&this._computeShadowCastersBoundingInfo()}_computeShadowCastersBoundingInfo(){if(this._scbiMin.copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._scbiMax.copyFromFloats(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this._shadowMap&&this._shadowMap.renderList){const e=this._shadowMap.renderList;for(let t=0;tt&&(e=0,t=1),e<0&&(e=0),t>1&&(t=1),this._minDistance=e,this._maxDistance=t,this._breaksAreDirty=!0)}get minDistance(){return this._minDistance}get maxDistance(){return this._maxDistance}getClassName(){return x.CLASSNAME}getCascadeMinExtents(e){return e>=0&&e=0&&et.maxZ&&t.maxZ!==0||(this._shadowMaxZ=e,this._light._markMeshesAsLightDirty(),this._breaksAreDirty=!0)}get debug(){return this._debug}set debug(e){this._debug=e,this._light._markMeshesAsLightDirty()}get depthClamp(){return this._depthClamp}set depthClamp(e){this._depthClamp=e}get cascadeBlendPercentage(){return this._cascadeBlendPercentage}set cascadeBlendPercentage(e){this._cascadeBlendPercentage=e,this._light._markMeshesAsLightDirty()}get lambda(){return this._lambda}set lambda(e){const t=Math.min(Math.max(e,0),1);this._lambda!=t&&(this._lambda=t,this._breaksAreDirty=!0)}getCascadeViewMatrix(e){return e>=0&&e=0&&e=0&&e{let s=i.min,r=i.max;s>=r&&(s=0,r=1),(s!=this._minDistance||r!=this._maxDistance)&&this.setMinMaxDistance(s,r)}),this._depthReducer.setDepthRenderer(this._depthRenderer)),this._depthReducer.activate()}}get autoCalcDepthBoundsRefreshRate(){return this._depthReducer?.depthRenderer?.getDepthMap().refreshRate??-1}set autoCalcDepthBoundsRefreshRate(e){this._depthReducer?.depthRenderer&&(this._depthReducer.depthRenderer.getDepthMap().refreshRate=e)}splitFrustum(){this._breaksAreDirty=!0}_splitFrustum(){const e=this._getCamera();if(!e)return;const t=e.minZ,i=e.maxZ||this._shadowMaxZ,s=i-t,r=this._minDistance,n=this._shadowMaxZ=t?Math.min((this._shadowMaxZ-t)/(i-t),this._maxDistance):this._maxDistance,o=t+r*s,h=t+n*s,d=h-o,c=h/o;for(let g=0;gn||(!this._depthClamp||this.filter===v.FILTER_PCSS?(r=Math.min(r,h),this.filter!==v.FILTER_PCSS&&(n=Math.min(n,d))):(n=Math.min(n,d),r=Math.max(r,h),n=Math.max(r+1,n))),T.OrthoOffCenterLHToRef(this._cascadeMinExtents[s].x,this._cascadeMaxExtents[s].x,this._cascadeMinExtents[s].y,this._cascadeMaxExtents[s].y,i?n:r,i?r:n,this._projectionMatrices[s],e.getEngine().isNDCHalfZRange),this._cascadeMinExtents[s].z=r,this._cascadeMaxExtents[s].z=n,this._viewMatrices[s].multiplyToRef(this._projectionMatrices[s],this._transformMatrices[s]),f.TransformCoordinatesToRef(Ne,this._transformMatrices[s],_),_.scaleInPlace(this._mapSize/2),z.copyFromFloats(Math.round(_.x),Math.round(_.y),Math.round(_.z)),z.subtractInPlace(_).scaleInPlace(2/this._mapSize),T.TranslationToRef(z.x,z.y,0,Z),this._projectionMatrices[s].multiplyToRef(Z,this._projectionMatrices[s]),this._viewMatrices[s].multiplyToRef(this._projectionMatrices[s],this._transformMatrices[s]),this._transformMatrices[s].copyToArray(this._transformMatricesAsArray,s*16)}}_computeFrustumInWorldSpace(e){const t=this._getCamera();if(!t)return;const i=this._cascades[e].prevBreakDistance,s=this._cascades[e].breakDistance,r=this._scene.getEngine().isNDCHalfZRange;t.getViewMatrix();const n=t.maxZ===0,o=t.maxZ;n&&(t.maxZ=this._shadowMaxZ,t.getProjectionMatrix(!0));const h=T.Invert(t.getTransformationMatrix());n&&(t.maxZ=o,t.getProjectionMatrix(!0));const d=this._scene.getEngine().useReverseDepthBuffer?4:0;for(let c=0;c{this._sceneUBOs&&this._scene.setSceneUniformBuffer(this._sceneUBOs[t]),this._currentLayer=t,this._filter===v.FILTER_PCF&&e.setColorWrite(!1),be.eyeAtCamera=!1,this._scene.setTransformMatrix(this.getCascadeViewMatrix(t),this.getCascadeProjectionMatrix(t)),this._useUBO&&(this._scene.getSceneUniformBuffer().unbindEffect(),this._scene.finalizeSceneUbo())}),this._shadowMap.onBeforeBindObservable.add(()=>{this._currentSceneUBO=this._scene.getSceneUniformBuffer(),e._enableGPUDebugMarkers&&(e.restoreDefaultFramebuffer(),e._debugPushGroup?.(`Cascaded shadow map generation for pass id ${e.currentRenderPassId}`)),this._breaksAreDirty&&this._splitFrustum(),this._computeMatrices()}),this._splitFrustum()}_bindCustomEffectForRenderSubMeshForShadowMap(e,t){t.setMatrix("viewProjection",this.getCascadeTransformMatrix(this._currentLayer))}_isReadyCustomDefines(e){e.push("#define SM_DEPTHCLAMP "+(this._depthClamp&&this._filter!==v.FILTER_PCSS?"1":"0"))}prepareDefines(e,t){super.prepareDefines(e,t);const i=this._scene,s=this._light;if(!i.shadowsEnabled||!s.shadowEnabled)return;e["SHADOWCSM"+t]=!0,e["SHADOWCSMDEBUG"+t]=this.debug,e["SHADOWCSMNUM_CASCADES"+t]=this.numCascades,e["SHADOWCSM_RIGHTHANDED"+t]=i.useRightHandedSystem;const r=this._getCamera();r&&this._shadowMaxZ<=(r.maxZ||this._shadowMaxZ)&&(e["SHADOWCSMUSESHADOWMAXZ"+t]=!0),this.cascadeBlendPercentage===0&&(e["SHADOWCSMNOBLEND"+t]=!0)}bindShadowLight(e,t){const i=this._light,s=this._scene;if(!s.shadowsEnabled||!i.shadowEnabled)return;const r=this._getCamera();if(!r)return;const n=this.getShadowMap();if(!n)return;const o=n.getSize().width,h=this._transformMatricesAsArray,d=s.floatingOriginMode?Re(this._scene.floatingOriginOffset,this._viewMatrices,this._projectionMatrices,this._numCascades,this._tempTransformMatricesAsArray):h;if(t.setMatrices("lightMatrix"+e,d),t.setArray("viewFrustumZ"+e,this._viewSpaceFrustumsZ),t.setFloat("cascadeBlendFactor"+e,this.cascadeBlendPercentage===0?1e4:1/this.cascadeBlendPercentage),t.setArray("frustumLengths"+e,this._frustumLengths),this._filter===v.FILTER_PCF)t.setDepthStencilTexture("shadowTexture"+e,n),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),o,1/o,this.frustumEdgeFalloff,e);else if(this._filter===v.FILTER_PCSS){for(let c=0;cnew x(s,r,void 0,n));return e.numCascades!==void 0&&(i.numCascades=e.numCascades),e.debug!==void 0&&(i.debug=e.debug),e.stabilizeCascades!==void 0&&(i.stabilizeCascades=e.stabilizeCascades),e.lambda!==void 0&&(i.lambda=e.lambda),e.cascadeBlendPercentage!==void 0&&(i.cascadeBlendPercentage=e.cascadeBlendPercentage),e.depthClamp!==void 0&&(i.depthClamp=e.depthClamp),e.autoCalcDepthBounds!==void 0&&(i.autoCalcDepthBounds=e.autoCalcDepthBounds),e.shadowMaxZ!==void 0&&(i.shadowMaxZ=e.shadowMaxZ),e.penumbraDarkness!==void 0&&(i.penumbraDarkness=e.penumbraDarkness),e.freezeShadowCastersBoundingInfo!==void 0&&(i.freezeShadowCastersBoundingInfo=e.freezeShadowCastersBoundingInfo),e.minDistance!==void 0&&e.maxDistance!==void 0&&i.setMinMaxDistance(e.minDistance,e.maxDistance),i}}x._FrustumCornersNdcSpace=[new f(-1,1,-1),new f(1,1,-1),new f(1,-1,-1),new f(-1,-1,-1),new f(-1,1,1),new f(1,1,1),new f(1,-1,1),new f(-1,-1,1)];x.CLASSNAME="CascadedShadowGenerator";x.DEFAULT_CASCADES_COUNT=4;x.MIN_CASCADES_COUNT=2;x.MAX_CASCADES_COUNT=4;x._SceneComponentInitialization=S=>{throw ie("ShadowGeneratorSceneComponent")};class We{constructor(e){this.name=X.NAME_SHADOWGENERATOR,this.scene=e}register(){this.scene._gatherRenderTargetsStage.registerStep(X.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR,this,this._gatherRenderTargets)}rebuild(){}serialize(e){e.shadowGenerators=[];const t=this.scene.lights;for(const i of t){if(i.doNotSerialize)continue;const s=i.getShadowGenerators();if(s){const r=s.values();for(let n=r.next();n.done!==!0;n=r.next()){const o=n.value;o.doNotSerialize||e.shadowGenerators.push(o.serialize())}}}}addFromContainer(e){}removeFromContainer(e,t){}dispose(){}_gatherRenderTargets(e){const t=this.scene;if(this.scene.shadowsEnabled)for(let i=0;i{let e=S._getComponent(X.NAME_SHADOWGENERATOR);e||(e=new We(S),S._addComponent(e))};export{We as ShadowGeneratorSceneComponent}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMap.fragment-DE-Rb_jY.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMap.fragment-DE-Rb_jY.js new file mode 100644 index 0000000000000000000000000000000000000000..a700dc860906e834c8122b994ba0997443f6733d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMap.fragment-DE-Rb_jY.js @@ -0,0 +1,78 @@ +import{S as e}from"./index-CDrXokXW.js";import"./packingFunctions-BOaWr_dk.js";import"./clipPlaneFragment-C7XUrTAZ.js";import"./index-DWyDLubb.js";const r="bayerDitherFunctions",f=`fn bayerDither2(_P: vec2f)->f32 {return ((2.0*_P.y+_P.x+1.0)%(4.0));} +fn bayerDither4(_P: vec2f)->f32 {var P1: vec2f=((_P)%(2.0)); +var P2: vec2f=floor(0.5*((_P)%(4.0))); +return 4.0*bayerDither2(P1)+bayerDither2(P2);} +fn bayerDither8(_P: vec2f)->f32 {var P1: vec2f=((_P)%(2.0)); +var P2: vec2f=floor(0.5 *((_P)%(4.0))); +var P4: vec2f=floor(0.25*((_P)%(8.0))); +return 4.0*(4.0*bayerDither2(P1)+bayerDither2(P2))+bayerDither2(P4);} +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=f);const t="shadowMapFragmentExtraDeclaration",S=`#if SM_FLOAT==0 +#include +#endif +#if SM_SOFTTRANSPARENTSHADOW==1 +#include +uniform softTransparentShadowSM: vec2f; +#endif +varying vDepthMetricSM: f32; +#if SM_USEDISTANCE==1 +uniform lightDataSM: vec3f;varying vPositionWSM: vec3f; +#endif +uniform biasAndScaleSM: vec3f;uniform depthValuesSM: vec2f; +#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1 +varying zSM: f32; +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=S);const n="shadowMapFragment",s=`var depthSM: f32=fragmentInputs.vDepthMetricSM; +#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1 +#if SM_USEDISTANCE==1 +depthSM=(length(fragmentInputs.vPositionWSM-uniforms.lightDataSM)+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x; +#else +#ifdef USE_REVERSE_DEPTHBUFFER +depthSM=(-fragmentInputs.zSM+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x; +#else +depthSM=(fragmentInputs.zSM+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x; +#endif +#endif +depthSM=clamp(depthSM,0.0,1.0); +#ifdef USE_REVERSE_DEPTHBUFFER +fragmentOutputs.fragDepth=clamp(1.0-depthSM,0.0,1.0); +#else +fragmentOutputs.fragDepth=clamp(depthSM,0.0,1.0); +#endif +#elif SM_USEDISTANCE==1 +depthSM=(length(fragmentInputs.vPositionWSM-uniforms.lightDataSM)+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x; +#endif +#if SM_ESM==1 +depthSM=clamp(exp(-min(87.,uniforms.biasAndScaleSM.z*depthSM)),0.,1.); +#endif +#if SM_FLOAT==1 +fragmentOutputs.color= vec4f(depthSM,1.0,1.0,1.0); +#else +fragmentOutputs.color=pack(depthSM); +#endif +`;e.IncludesShadersStoreWGSL[n]||(e.IncludesShadersStoreWGSL[n]=s);const a="shadowMapPixelShader",i=`#include +#ifdef ALPHATEXTURE +varying vUV: vec2f;var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d; +#endif +#include +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs { +#include +#ifdef ALPHATEXTURE +var opacityMap: vec4f=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vUV);var alphaFromAlphaTexture: f32=opacityMap.a; +#if SM_SOFTTRANSPARENTSHADOW==1 +if (uniforms.softTransparentShadowSM.y==1.0) {opacityMap=vec4f(opacityMap.rgb* vec3f(0.3,0.59,0.11),opacityMap.a);alphaFromAlphaTexture=opacityMap.x+opacityMap.y+opacityMap.z;} +#endif +#ifdef ALPHATESTVALUE +if (alphaFromAlphaTexture=uniforms.softTransparentShadowSM.x*alphaFromAlphaTexture) {discard;} +#else +if ((bayerDither8(floor(((fragmentInputs.position.xy)%(8.0)))))/64.0>=uniforms.softTransparentShadowSM.x) {discard;} +#endif +#endif +#include +}`;e.ShadersStoreWGSL[a]||(e.ShadersStoreWGSL[a]=i);const M={name:a,shader:i};export{M as shadowMapPixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMap.fragment-DvHQ_b8D.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMap.fragment-DvHQ_b8D.js new file mode 100644 index 0000000000000000000000000000000000000000..229632e7975b311876fdf161b50a6a0bc7c1111a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMap.fragment-DvHQ_b8D.js @@ -0,0 +1,79 @@ +import{S as e}from"./index-CDrXokXW.js";import"./packingFunctions-BPfzqklr.js";import"./clipPlaneFragment-T8W7CIC5.js";import"./index-DWyDLubb.js";const r="bayerDitherFunctions",d=`float bayerDither2(vec2 _P) {return mod(2.0*_P.y+_P.x+1.0,4.0);} +float bayerDither4(vec2 _P) {vec2 P1=mod(_P,2.0); +vec2 P2=floor(0.5*mod(_P,4.0)); +return 4.0*bayerDither2(P1)+bayerDither2(P2);} +float bayerDither8(vec2 _P) {vec2 P1=mod(_P,2.0); +vec2 P2=floor(0.5 *mod(_P,4.0)); +vec2 P4=floor(0.25*mod(_P,8.0)); +return 4.0*(4.0*bayerDither2(P1)+bayerDither2(P2))+bayerDither2(P4);} +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=d);const t="shadowMapFragmentExtraDeclaration",o=`#if SM_FLOAT==0 +#include +#endif +#if SM_SOFTTRANSPARENTSHADOW==1 +#include +uniform vec2 softTransparentShadowSM; +#endif +varying float vDepthMetricSM; +#if SM_USEDISTANCE==1 +uniform vec3 lightDataSM;varying vec3 vPositionWSM; +#endif +uniform vec3 biasAndScaleSM;uniform vec2 depthValuesSM; +#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1 +varying float zSM; +#endif +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=o);const i="shadowMapFragment",n=`float depthSM=vDepthMetricSM; +#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1 +#if SM_USEDISTANCE==1 +depthSM=(length(vPositionWSM-lightDataSM)+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x; +#else +#ifdef USE_REVERSE_DEPTHBUFFER +depthSM=(-zSM+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x; +#else +depthSM=(zSM+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x; +#endif +#endif +depthSM=clamp(depthSM,0.0,1.0); +#ifdef USE_REVERSE_DEPTHBUFFER +gl_FragDepth=clamp(1.0-depthSM,0.0,1.0); +#else +gl_FragDepth=clamp(depthSM,0.0,1.0); +#endif +#elif SM_USEDISTANCE==1 +depthSM=(length(vPositionWSM-lightDataSM)+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x; +#endif +#if SM_ESM==1 +depthSM=clamp(exp(-min(87.,biasAndScaleSM.z*depthSM)),0.,1.); +#endif +#if SM_FLOAT==1 +gl_FragColor=vec4(depthSM,1.0,1.0,1.0); +#else +gl_FragColor=pack(depthSM); +#endif +return;`;e.IncludesShadersStore[i]||(e.IncludesShadersStore[i]=n);const a="shadowMapPixelShader",S=`#include +#ifdef ALPHATEXTURE +varying vec2 vUV;uniform sampler2D diffuseSampler; +#endif +#include +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) +{ +#include +#ifdef ALPHATEXTURE +vec4 opacityMap=texture2D(diffuseSampler,vUV);float alphaFromAlphaTexture=opacityMap.a; +#if SM_SOFTTRANSPARENTSHADOW==1 +if (softTransparentShadowSM.y==1.0) {opacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);alphaFromAlphaTexture=opacityMap.x+opacityMap.y+opacityMap.z;} +#endif +#ifdef ALPHATESTVALUE +if (alphaFromAlphaTexture=softTransparentShadowSM.x*alphaFromAlphaTexture) discard; +#else +if ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM.x) discard; +#endif +#endif +#include +}`;e.ShadersStore[a]||(e.ShadersStore[a]=S);const p={name:a,shader:S};export{p as shadowMapPixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMap.vertex-A1qFnkfA.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMap.vertex-A1qFnkfA.js new file mode 100644 index 0000000000000000000000000000000000000000..73b9fcc00d92292bba2c608badea6f56aac5171f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMap.vertex-A1qFnkfA.js @@ -0,0 +1,109 @@ +import{S as e}from"./index-CDrXokXW.js";import"./bonesDeclaration-Bh_c0MF7.js";import"./instancesVertex-CO_CTxxp.js";import"./morphTargetsVertexDeclaration-BsT9JpOT.js";import"./helperFunctions-CZpZ-EbL.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./meshUboDeclaration-Bk1ASTX2.js";import"./clipPlaneVertex-J3Krgsee.js";import"./morphTargetsVertex-DcRl6X3j.js";import"./bonesVertex-bl6LLSA1.js";import"./bakedVertexAnimation-DoavwM49.js";import"./index-DWyDLubb.js";const r="shadowMapVertexExtraDeclaration",a=`#if SM_NORMALBIAS==1 +uniform lightDataSM: vec3f; +#endif +uniform biasAndScaleSM: vec3f;uniform depthValuesSM: vec2f;varying vDepthMetricSM: f32; +#if SM_USEDISTANCE==1 +varying vPositionWSM: vec3f; +#endif +#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1 +varying zSM: f32; +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=a);const t="shadowMapVertexNormalBias",d=`#if SM_NORMALBIAS==1 +#if SM_DIRECTIONINLIGHTDATA==1 +var worldLightDirSM: vec3f=normalize(-uniforms.lightDataSM.xyz); +#else +var directionToLightSM: vec3f=uniforms.lightDataSM.xyz-worldPos.xyz;var worldLightDirSM: vec3f=normalize(directionToLightSM); +#endif +var ndlSM: f32=dot(vNormalW,worldLightDirSM);var sinNLSM: f32=sqrt(1.0-ndlSM*ndlSM);var normalBiasSM: f32=uniforms.biasAndScaleSM.y*sinNLSM;worldPos=vec4f(worldPos.xyz-vNormalW*normalBiasSM,worldPos.w); +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=d);const o="shadowMapVertexMetric",f=`#if SM_USEDISTANCE==1 +vertexOutputs.vPositionWSM=worldPos.xyz; +#endif +#if SM_DEPTHTEXTURE==1 +#ifdef IS_NDC_HALF_ZRANGE +#define BIASFACTOR 0.5 +#else +#define BIASFACTOR 1.0 +#endif +#ifdef USE_REVERSE_DEPTHBUFFER +vertexOutputs.position.z-=uniforms.biasAndScaleSM.x*vertexOutputs.position.w*BIASFACTOR; +#else +vertexOutputs.position.z+=uniforms.biasAndScaleSM.x*vertexOutputs.position.w*BIASFACTOR; +#endif +#endif +#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1 +vertexOutputs.zSM=vertexOutputs.position.z;vertexOutputs.position.z=0.0; +#elif SM_USEDISTANCE==0 +#ifdef USE_REVERSE_DEPTHBUFFER +vertexOutputs.vDepthMetricSM=(-vertexOutputs.position.z+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x; +#else +vertexOutputs.vDepthMetricSM=(vertexOutputs.position.z+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x; +#endif +#endif +`;e.IncludesShadersStoreWGSL[o]||(e.IncludesShadersStoreWGSL[o]=f);const i="shadowMapVertexShader",n=`attribute position: vec3f; +#ifdef NORMAL +attribute normal: vec3f; +#endif +#include +#include +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef INSTANCES +attribute world0: vec4f;attribute world1: vec4f;attribute world2: vec4f;attribute world3: vec4f; +#endif +#include +#include +#include +#ifdef ALPHATEXTURE +varying vUV: vec2f;uniform diffuseMatrix: mat4x4f; +#ifdef UV1 +attribute uv: vec2f; +#endif +#ifdef UV2 +attribute uv2: vec2f; +#endif +#endif +#include +#include +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position; +#ifdef UV1 +var uvUpdated: vec2f=input.uv; +#endif +#ifdef UV2 +var uv2Updated: vec2f=input.uv2; +#endif +#ifdef NORMAL +var normalUpdated: vec3f=input.normal; +#endif +#include +#include[0..maxSimultaneousMorphTargets] +#include +#include +#include +var worldPos: vec4f=finalWorld* vec4f(positionUpdated,1.0); +#ifdef NORMAL +var normWorldSM: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz); +#if defined(INSTANCES) && defined(THIN_INSTANCES) +var vNormalW: vec3f=normalUpdated/ vec3f(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));vNormalW=normalize(normWorldSM*vNormalW); +#else +#ifdef NONUNIFORMSCALING +normWorldSM=transposeMat3(inverseMat3(normWorldSM)); +#endif +var vNormalW: vec3f=normalize(normWorldSM*normalUpdated); +#endif +#endif +#include +vertexOutputs.position=scene.viewProjection*worldPos; +#include +#ifdef ALPHATEXTURE +#ifdef UV1 +vertexOutputs.vUV= (uniforms.diffuseMatrix* vec4f(uvUpdated,1.0,0.0)).xy; +#endif +#ifdef UV2 +vertexOutputs.vUV= (uniforms.diffuseMatrix* vec4f(uv2Updated,1.0,0.0)).xy; +#endif +#endif +#include +}`;e.ShadersStoreWGSL[i]||(e.ShadersStoreWGSL[i]=n);const E={name:i,shader:n};export{E as shadowMapVertexShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMap.vertex-CAu9rU1j.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMap.vertex-CAu9rU1j.js new file mode 100644 index 0000000000000000000000000000000000000000..992c4789e3a4dc864263c5690abb9afd27c8313c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMap.vertex-CAu9rU1j.js @@ -0,0 +1,119 @@ +import{S as e}from"./index-CDrXokXW.js";import"./bakedVertexAnimation-BwUJBnNt.js";import"./morphTargetsVertex-7Q90Wwr8.js";import"./helperFunctions-BkWNqKeI.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./meshUboDeclaration-C6raEdzf.js";import"./clipPlaneVertex-Bmw4TNCQ.js";import"./index-DWyDLubb.js";const o="sceneVertexDeclaration",S=`uniform mat4 viewProjection; +#ifdef MULTIVIEW +uniform mat4 viewProjectionR; +#endif +uniform mat4 view;uniform mat4 projection;uniform vec4 vEyePosition; +`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=S);const r="meshVertexDeclaration",c=`uniform mat4 world;uniform float visibility; +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=c);const t="shadowMapVertexDeclaration",f=`#include +#include +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=f);const a="shadowMapUboDeclaration",M=`layout(std140,column_major) uniform; +#include +#include +`;e.IncludesShadersStore[a]||(e.IncludesShadersStore[a]=M);const n="shadowMapVertexExtraDeclaration",m=`#if SM_NORMALBIAS==1 +uniform vec3 lightDataSM; +#endif +uniform vec3 biasAndScaleSM;uniform vec2 depthValuesSM;varying float vDepthMetricSM; +#if SM_USEDISTANCE==1 +varying vec3 vPositionWSM; +#endif +#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1 +varying float zSM; +#endif +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=m);const d="shadowMapVertexNormalBias",u=`#if SM_NORMALBIAS==1 +#if SM_DIRECTIONINLIGHTDATA==1 +vec3 worldLightDirSM=normalize(-lightDataSM.xyz); +#else +vec3 directionToLightSM=lightDataSM.xyz-worldPos.xyz;vec3 worldLightDirSM=normalize(directionToLightSM); +#endif +float ndlSM=dot(vNormalW,worldLightDirSM);float sinNLSM=sqrt(1.0-ndlSM*ndlSM);float normalBiasSM=biasAndScaleSM.y*sinNLSM;worldPos.xyz-=vNormalW*normalBiasSM; +#endif +`;e.IncludesShadersStore[d]||(e.IncludesShadersStore[d]=u);const l="shadowMapVertexMetric",v=`#if SM_USEDISTANCE==1 +vPositionWSM=worldPos.xyz; +#endif +#if SM_DEPTHTEXTURE==1 +#ifdef IS_NDC_HALF_ZRANGE +#define BIASFACTOR 0.5 +#else +#define BIASFACTOR 1.0 +#endif +#ifdef USE_REVERSE_DEPTHBUFFER +gl_Position.z-=biasAndScaleSM.x*gl_Position.w*BIASFACTOR; +#else +gl_Position.z+=biasAndScaleSM.x*gl_Position.w*BIASFACTOR; +#endif +#endif +#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1 +zSM=gl_Position.z;gl_Position.z=0.0; +#elif SM_USEDISTANCE==0 +#ifdef USE_REVERSE_DEPTHBUFFER +vDepthMetricSM=(-gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x; +#else +vDepthMetricSM=(gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x; +#endif +#endif +`;e.IncludesShadersStore[l]||(e.IncludesShadersStore[l]=v);const i="shadowMapVertexShader",s=`attribute vec3 position; +#ifdef NORMAL +attribute vec3 normal; +#endif +#include +#include +#include +#include[0..maxSimultaneousMorphTargets] +#ifdef INSTANCES +attribute vec4 world0;attribute vec4 world1;attribute vec4 world2;attribute vec4 world3; +#endif +#include +#include<__decl__shadowMapVertex> +#ifdef ALPHATEXTURE +varying vec2 vUV;uniform mat4 diffuseMatrix; +#ifdef UV1 +attribute vec2 uv; +#endif +#ifdef UV2 +attribute vec2 uv2; +#endif +#endif +#include +#include +#define CUSTOM_VERTEX_DEFINITIONS +void main(void) +{vec3 positionUpdated=position; +#ifdef UV1 +vec2 uvUpdated=uv; +#endif +#ifdef UV2 +vec2 uv2Updated=uv2; +#endif +#ifdef NORMAL +vec3 normalUpdated=normal; +#endif +#include +#include[0..maxSimultaneousMorphTargets] +#include +#include +#include +vec4 worldPos=finalWorld*vec4(positionUpdated,1.0); +#ifdef NORMAL +mat3 normWorldSM=mat3(finalWorld); +#if defined(INSTANCES) && defined(THIN_INSTANCES) +vec3 vNormalW=normalUpdated/vec3(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));vNormalW=normalize(normWorldSM*vNormalW); +#else +#ifdef NONUNIFORMSCALING +normWorldSM=transposeMat3(inverseMat3(normWorldSM)); +#endif +vec3 vNormalW=normalize(normWorldSM*normalUpdated); +#endif +#endif +#include +gl_Position=viewProjection*worldPos; +#include +#ifdef ALPHATEXTURE +#ifdef UV1 +vUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0)); +#endif +#ifdef UV2 +vUV=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0)); +#endif +#endif +#include +}`;e.ShadersStore[i]||(e.ShadersStore[i]=s);const D={name:i,shader:s};export{D as shadowMapVertexShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMapFragmentSoftTransparentShadow-Dw8OP7pX.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMapFragmentSoftTransparentShadow-Dw8OP7pX.js new file mode 100644 index 0000000000000000000000000000000000000000..142e8c97b82836953c1c851cc29704a2923b0df3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMapFragmentSoftTransparentShadow-Dw8OP7pX.js @@ -0,0 +1,4 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const a="shadowMapFragmentSoftTransparentShadow",o=`#if SM_SOFTTRANSPARENTSHADOW==1 +if ((bayerDither8(floor(((fragmentInputs.position.xy)%(8.0)))))/64.0>=uniforms.softTransparentShadowSM.x*alpha) {discard;} +#endif +`;r.IncludesShadersStoreWGSL[a]||(r.IncludesShadersStoreWGSL[a]=o);const S={name:a,shader:o};export{S as shadowMapFragmentSoftTransparentShadowWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMapFragmentSoftTransparentShadow-IM26FEnM.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMapFragmentSoftTransparentShadow-IM26FEnM.js new file mode 100644 index 0000000000000000000000000000000000000000..bb2916546c63ac07a0ad2771ef9c217129c4c2a1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowMapFragmentSoftTransparentShadow-IM26FEnM.js @@ -0,0 +1,4 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const a="shadowMapFragmentSoftTransparentShadow",o=`#if SM_SOFTTRANSPARENTSHADOW==1 +if ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM.x*alpha) discard; +#endif +`;r.IncludesShadersStore[a]||(r.IncludesShadersStore[a]=o);const S={name:a,shader:o};export{S as shadowMapFragmentSoftTransparentShadow}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowsFragmentFunctions-CTsFFgyf.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowsFragmentFunctions-CTsFFgyf.js new file mode 100644 index 0000000000000000000000000000000000000000..7ae54f13465379da562e3a75c4d5c1cd42163970 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowsFragmentFunctions-CTsFFgyf.js @@ -0,0 +1,470 @@ +import{S as e}from"./index-CDrXokXW.js";const r="reflectionFunction",s=`fn computeFixedEquirectangularCoords(worldPos: vec4f,worldNormal: vec3f,direction: vec3f)->vec3f +{var lon: f32=atan2(direction.z,direction.x);var lat: f32=acos(direction.y);var sphereCoords: vec2f= vec2f(lon,lat)*RECIPROCAL_PI2*2.0;var s: f32=sphereCoords.x*0.5+0.5;var t: f32=sphereCoords.y;return vec3f(s,t,0); } +fn computeMirroredFixedEquirectangularCoords(worldPos: vec4f,worldNormal: vec3f,direction: vec3f)->vec3f +{var lon: f32=atan2(direction.z,direction.x);var lat: f32=acos(direction.y);var sphereCoords: vec2f= vec2f(lon,lat)*RECIPROCAL_PI2*2.0;var s: f32=sphereCoords.x*0.5+0.5;var t: f32=sphereCoords.y;return vec3f(1.0-s,t,0); } +fn computeEquirectangularCoords(worldPos: vec4f,worldNormal: vec3f,eyePosition: vec3f,reflectionMatrix: mat4x4f)->vec3f +{var cameraToVertex: vec3f=normalize(worldPos.xyz-eyePosition);var r: vec3f=normalize(reflect(cameraToVertex,worldNormal));r= (reflectionMatrix* vec4f(r,0)).xyz;var lon: f32=atan2(r.z,r.x);var lat: f32=acos(r.y);var sphereCoords: vec2f= vec2f(lon,lat)*RECIPROCAL_PI2*2.0;var s: f32=sphereCoords.x*0.5+0.5;var t: f32=sphereCoords.y;return vec3f(s,t,0);} +fn computeSphericalCoords(worldPos: vec4f,worldNormal: vec3f,view: mat4x4f,reflectionMatrix: mat4x4f)->vec3f +{var viewDir: vec3f=normalize((view*worldPos).xyz);var viewNormal: vec3f=normalize((view* vec4f(worldNormal,0.0)).xyz);var r: vec3f=reflect(viewDir,viewNormal);r= (reflectionMatrix* vec4f(r,0)).xyz;r.z=r.z-1.0;var m: f32=2.0*length(r);return vec3f(r.x/m+0.5,1.0-r.y/m-0.5,0);} +fn computePlanarCoords(worldPos: vec4f,worldNormal: vec3f,eyePosition: vec3f,reflectionMatrix: mat4x4f)->vec3f +{var viewDir: vec3f=worldPos.xyz-eyePosition;var coords: vec3f=normalize(reflect(viewDir,worldNormal));return (reflectionMatrix* vec4f(coords,1)).xyz;} +fn computeCubicCoords(worldPos: vec4f,worldNormal: vec3f,eyePosition: vec3f,reflectionMatrix: mat4x4f)->vec3f +{var viewDir: vec3f=normalize(worldPos.xyz-eyePosition);var coords: vec3f=reflect(viewDir,worldNormal);coords= (reflectionMatrix* vec4f(coords,0)).xyz; +#ifdef INVERTCUBICMAP +coords.y*=-1.0; +#endif +return coords;} +fn computeCubicLocalCoords(worldPos: vec4f,worldNormal: vec3f,eyePosition: vec3f,reflectionMatrix: mat4x4f,reflectionSize: vec3f,reflectionPosition: vec3f)->vec3f +{var viewDir: vec3f=normalize(worldPos.xyz-eyePosition);var coords: vec3f=reflect(viewDir,worldNormal);coords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);coords=(reflectionMatrix* vec4f(coords,0)).xyz; +#ifdef INVERTCUBICMAP +coords.y*=-1.0; +#endif +return coords;} +fn computeProjectionCoords(worldPos: vec4f,view: mat4x4f,reflectionMatrix: mat4x4f)->vec3f +{return (reflectionMatrix*(view*worldPos)).xyz;} +fn computeSkyBoxCoords(positionW: vec3f,reflectionMatrix: mat4x4f)->vec3f +{return (reflectionMatrix* vec4f(positionW,1.)).xyz;} +#ifdef REFLECTION +fn computeReflectionCoords(worldPos: vec4f,worldNormal: vec3f)->vec3f +{ +#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED +var direction: vec3f=normalize(fragmentInputs.vDirectionW);return computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction); +#endif +#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED +var direction: vec3f=normalize(fragmentInputs.vDirectionW);return computeFixedEquirectangularCoords(worldPos,worldNormal,direction); +#endif +#ifdef REFLECTIONMAP_EQUIRECTANGULAR +return computeEquirectangularCoords(worldPos,worldNormal,scene.vEyePosition.xyz,uniforms.reflectionMatrix); +#endif +#ifdef REFLECTIONMAP_SPHERICAL +return computeSphericalCoords(worldPos,worldNormal,scene.view,uniforms.reflectionMatrix); +#endif +#ifdef REFLECTIONMAP_PLANAR +return computePlanarCoords(worldPos,worldNormal,scene.vEyePosition.xyz,uniforms.reflectionMatrix); +#endif +#ifdef REFLECTIONMAP_CUBIC +#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC +return computeCubicLocalCoords(worldPos,worldNormal,scene.vEyePosition.xyz,uniforms.reflectionMatrix,uniforms.vReflectionSize,uniforms.vReflectionPosition); +#else +return computeCubicCoords(worldPos,worldNormal,scene.vEyePosition.xyz,uniforms.reflectionMatrix); +#endif +#endif +#ifdef REFLECTIONMAP_PROJECTION +return computeProjectionCoords(worldPos,scene.view,uniforms.reflectionMatrix); +#endif +#ifndef REFLECTIONMAP_CUBIC +#ifdef REFLECTIONMAP_SKYBOX +return computeSkyBoxCoords(fragmentInputs.vPositionUVW,uniforms.reflectionMatrix); +#endif +#endif +#ifdef REFLECTIONMAP_EXPLICIT +return vec3f(0,0,0); +#endif +} +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=s);const t="lightUboDeclaration",v=`#ifdef LIGHT{X} +struct Light{X} +{vLightData: vec4f, +vLightDiffuse: vec4f, +vLightSpecular: vec4f, +#ifdef SPOTLIGHT{X} +vLightDirection: vec4f, +vLightFalloff: vec4f, +#elif defined(POINTLIGHT{X}) +vLightFalloff: vec4f, +#elif defined(HEMILIGHT{X}) +vLightGround: vec3f, +#elif defined(CLUSTLIGHT{X}) +vSliceData: vec2f, +vSliceRanges: array, +#endif +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +vLightWidth: vec4f, +vLightHeight: vec4f, +#endif +shadowsInfo: vec4f, +depthValues: vec2f} ;var light{X} : Light{X}; +#ifdef IESLIGHTTEXTURE{X} +var iesLightTexture{X}Sampler: sampler;var iesLightTexture{X}: texture_2d; +#endif +#ifdef PROJECTEDLIGHTTEXTURE{X} +uniform textureProjectionMatrix{X}: mat4x4f;var projectionLightTexture{X}Sampler: sampler;var projectionLightTexture{X}: texture_2d; +#endif +#ifdef CLUSTLIGHT{X} +var lightDataTexture{X}: texture_2d;var tileMaskBuffer{X}: array; +#endif +#ifdef SHADOW{X} +#ifdef SHADOWCSM{X} +uniform lightMatrix{X}: array;uniform viewFrustumZ{X}: array;uniform frustumLengths{X}: array;uniform cascadeBlendFactor{X}: f32;varying vPositionFromLight{X}_0: vec4f;varying vDepthMetric{X}_0: f32;varying vPositionFromLight{X}_1: vec4f;varying vDepthMetric{X}_1: f32;varying vPositionFromLight{X}_2: vec4f;varying vDepthMetric{X}_2: f32;varying vPositionFromLight{X}_3: vec4f;varying vDepthMetric{X}_3: f32;varying vPositionFromCamera{X}: vec4f;var vPositionFromLight{X}: array;var vDepthMetric{X} : array; +#if defined(SHADOWPCSS{X}) +var shadowTexture{X}Sampler: sampler_comparison; +var shadowTexture{X}: texture_depth_2d_array;var depthTexture{X}Sampler: sampler;var depthTexture{X}: texture_2d_array;uniform lightSizeUVCorrection{X}: array;uniform depthCorrection{X}: array;uniform penumbraDarkness{X}: f32; +#elif defined(SHADOWPCF{X}) +var shadowTexture{X}Sampler: sampler_comparison;var shadowTexture{X}: texture_depth_2d_array; +#else +var shadowTexture{X}Sampler: sampler; +var shadowTexture{X}: texture_2d_array; +#endif +#ifdef SHADOWCSMDEBUG{X} +const vCascadeColorsMultiplier{X}: array=array +( +vec3f ( 1.5,0.0,0.0 ), +vec3f ( 0.0,1.5,0.0 ), +vec3f ( 0.0,0.0,5.5 ), +vec3f ( 1.5,0.0,5.5 ), +vec3f ( 1.5,1.5,0.0 ), +vec3f ( 1.0,1.0,1.0 ), +vec3f ( 0.0,1.0,5.5 ), +vec3f ( 0.5,3.5,0.75 ) +); +#endif +#elif defined(SHADOWCUBE{X}) +var shadowTexture{X}Sampler: sampler;var shadowTexture{X}: texture_cube; +#else +varying vPositionFromLight{X}: vec4f;varying vDepthMetric{X}: f32; +#if defined(SHADOWPCSS{X}) +var shadowTexture{X}Sampler: sampler_comparison; +var shadowTexture{X}: texture_depth_2d;var depthTexture{X}Sampler: sampler; +var depthTexture{X}: texture_2d; +#elif defined(SHADOWPCF{X}) +var shadowTexture{X}Sampler: sampler_comparison;var shadowTexture{X}: texture_depth_2d; +#else +var shadowTexture{X}Sampler: sampler; +var shadowTexture{X}: texture_2d; +#endif +uniform lightMatrix{X}: mat4x4f; +#endif +#endif +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=v);const a="ltcHelperFunctions",f=`fn LTCUv(N: vec3f,V: vec3f,roughness: f32)->vec2f {var LUTSIZE: f32=64.0;var LUTSCALE: f32=( LUTSIZE-1.0 )/LUTSIZE;var LUTBIAS:f32=0.5/LUTSIZE;var dotNV:f32=saturate( dot( N,V ) );var uv:vec2f=vec2f( roughness,sqrt( 1.0-dotNV ) );uv=uv*LUTSCALE+LUTBIAS;return uv;} +fn LTCClippedSphereFormFactor( f:vec3f )->f32 {var l: f32=length( f );return max( ( l*l+f.z )/( l+1.0 ),0.0 );} +fn LTCEdgeVectorFormFactor( v1:vec3f,v2:vec3f )->vec3f {var x:f32=dot( v1,v2 );var y:f32=abs( x );var a:f32=0.8543985+( 0.4965155+0.0145206*y )*y;var b:f32=3.4175940+( 4.1616724+y )*y;var v:f32=a/b;var thetaSintheta:f32=0.0;if( x>0.0 ) +{thetaSintheta=v;} +else +{thetaSintheta=0.5*inverseSqrt( max( 1.0-x*x,0.00000001 ) )-v;} +return cross( v1,v2 )*thetaSintheta;} +fn LTCEvaluate( N:vec3f,V:vec3f,P:vec3f,mInv: mat3x3,rectCoords0:vec3f,rectCoords1:vec3f,rectCoords2:vec3f,rectCoords3:vec3f )->vec3f {var v1:vec3f=rectCoords1-rectCoords0;var v2:vec3f=rectCoords3-rectCoords0;var lightNormal:vec3f=cross( v1,v2 );if( dot( lightNormal,P-rectCoords0 )<0.0 ){return vec3f( 0.0 );} +var T1:vec3f=normalize( V-N*dot( V,N ) );var T2:vec3f=- cross( N,T1 ); +var mat: mat3x3=mInv*transposeMat3( mat3x3( T1,T2,N ) );var coords0: vec3f=mat*( rectCoords0-P );var coords1: vec3f=mat*( rectCoords1-P );var coords2: vec3f=mat*( rectCoords2-P );var coords3: vec3f=mat*( rectCoords3-P );coords0=normalize( coords0 );coords1=normalize( coords1 );coords2=normalize( coords2 );coords3=normalize( coords3 );var vectorFormFactor:vec3f=vec3( 0.0 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords0,coords1 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords1,coords2 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords2,coords3 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords3,coords0 );var result:f32=LTCClippedSphereFormFactor( vectorFormFactor );return vec3f( result );} +struct areaLightData +{Diffuse: vec3f, +Specular: vec3f, +Fresnel: vec4f};fn computeAreaLightSpecularDiffuseFresnel(ltc1: texture_2d,ltc1Sampler:sampler,ltc2:texture_2d,ltc2Sampler:sampler,viewDir: vec3f,normal:vec3f,position:vec3f,lightPos:vec3f,halfWidth:vec3f, halfHeight:vec3f,roughness:f32)->areaLightData {var result: areaLightData;var rectCoords0:vec3f=lightPos+halfWidth-halfHeight; +var rectCoords1:vec3f=lightPos-halfWidth-halfHeight;var rectCoords2:vec3f=lightPos-halfWidth+halfHeight;var rectCoords3:vec3f=lightPos+halfWidth+halfHeight; +#ifdef SPECULARTERM +var uv:vec2f=LTCUv( normal,viewDir,roughness );var t1:vec4f=textureSample( ltc1,ltc1Sampler,uv );var t2:vec4f=textureSample( ltc2,ltc2Sampler,uv );var mInv:mat3x3=mat3x3( +vec3f( t1.x,0,t1.y ), +vec3f( 0,1, 0 ), +vec3f( t1.z,0,t1.w ) +);result.Fresnel=t2;result.Specular=LTCEvaluate( normal,viewDir,position,mInv,rectCoords0,rectCoords1,rectCoords2,rectCoords3 ); +#endif +var mInvEmpty:mat3x3=mat3x3( +vec3f( 1,0,0 ), +vec3f( 0,1,0 ), +vec3f( 0,0,1 ) +);result.Diffuse+=LTCEvaluate( normal,viewDir,position,mInvEmpty,rectCoords0,rectCoords1,rectCoords2,rectCoords3 );return result;}`;e.IncludesShadersStoreWGSL[a]||(e.IncludesShadersStoreWGSL[a]=f);const o="clusteredLightingFunctions",c=`struct ClusteredLight {vLightData: vec4f, +vLightDiffuse: vec4f, +vLightSpecular: vec4f, +vLightDirection: vec4f, +vLightFalloff: vec4f,} +fn getClusteredLight(lightDataTexture: texture_2d,index: u32)->ClusteredLight {return ClusteredLight( +textureLoad(lightDataTexture,vec2u(0,index),0), +textureLoad(lightDataTexture,vec2u(1,index),0), +textureLoad(lightDataTexture,vec2u(2,index),0), +textureLoad(lightDataTexture,vec2u(3,index),0), +textureLoad(lightDataTexture,vec2u(4,index),0) +);} +fn getClusteredSliceIndex(sliceData: vec2f,viewDepth: f32)->i32 {return i32(log(viewDepth)*sliceData.x+sliceData.y);} +`;e.IncludesShadersStoreWGSL[o]||(e.IncludesShadersStoreWGSL[o]=c);const i="shadowsFragmentFunctions",d=`#ifdef SHADOWS +#ifndef SHADOWFLOAT +fn unpack(color: vec4f)->f32 +{const bit_shift: vec4f= vec4f(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(color,bit_shift);} +#endif +fn computeFallOff(value: f32,clipSpace: vec2f,frustumEdgeFalloff: f32)->f32 +{var mask: f32=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));return mix(value,1.0,mask);} +fn computeShadowCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube,shadowSampler: sampler,darkness: f32,depthValues: vec2f)->f32 +{var directionToLight: vec3f=worldPos-lightPosition;var depth: f32=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y; +#ifndef SHADOWFLOAT +var shadow: f32=unpack(textureSample(shadowTexture,shadowSampler,directionToLight)); +#else +var shadow: f32=textureSample(shadowTexture,shadowSampler,directionToLight).x; +#endif +return select(1.0,darkness,depth>shadow);} +fn computeShadowWithPoissonSamplingCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube,shadowSampler: sampler,mapSize: f32,darkness: f32,depthValues: vec2f)->f32 +{var directionToLight: vec3f=worldPos-lightPosition;var depth: f32=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;var visibility: f32=1.;var poissonDisk: array;poissonDisk[0]= vec3f(-1.0,1.0,-1.0);poissonDisk[1]= vec3f(1.0,-1.0,-1.0);poissonDisk[2]= vec3f(-1.0,-1.0,-1.0);poissonDisk[3]= vec3f(1.0,-1.0,1.0); +#ifndef SHADOWFLOAT +if (unpack(textureSample(shadowTexture,shadowSampler,directionToLight+poissonDisk[0]*mapSize)),shadowSampler: sampler,darkness: f32,depthScale: f32,depthValues: vec2f)->f32 +{var directionToLight: vec3f=worldPos-lightPosition;var depth: f32=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);var shadowPixelDepth: f32=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y; +#ifndef SHADOWFLOAT +var shadowMapSample: f32=unpack(textureSample(shadowTexture,shadowSampler,directionToLight)); +#else +var shadowMapSample: f32=textureSample(shadowTexture,shadowSampler,directionToLight).x; +#endif +var esm: f32=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return esm;} +fn computeShadowWithCloseESMCube(worldPos: vec3f,lightPosition: vec3f,shadowTexture: texture_cube,shadowSampler: sampler,darkness: f32,depthScale: f32,depthValues: vec2f)->f32 +{var directionToLight: vec3f=worldPos-lightPosition;var depth: f32=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);var shadowPixelDepth: f32=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y; +#ifndef SHADOWFLOAT +var shadowMapSample: f32=unpack(textureSample(shadowTexture,shadowSampler,directionToLight)); +#else +var shadowMapSample: f32=textureSample(shadowTexture,shadowSampler,directionToLight).x; +#endif +var esm: f32=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return esm;} +fn computeShadowCSM(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d_array,shadowSampler: sampler,darkness: f32,frustumEdgeFalloff: f32)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0); +#ifndef SHADOWFLOAT +var shadow: f32=unpack(textureSample(shadowTexture,shadowSampler,uv,layer)); +#else +var shadow: f32=textureSample(shadowTexture,shadowSampler,uv,layer).x; +#endif +return select(1.,computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff),shadowPixelDepth>shadow );} +fn computeShadow(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d,shadowSampler: sampler,darkness: f32,frustumEdgeFalloff: f32)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0) +{return 1.0;} +else +{var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0); +#ifndef SHADOWFLOAT +var shadow: f32=unpack(textureSampleLevel(shadowTexture,shadowSampler,uv,0.)); +#else +var shadow: f32=textureSampleLevel(shadowTexture,shadowSampler,uv,0.).x; +#endif +return select(1.,computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff),shadowPixelDepth>shadow );}} +fn computeShadowWithPoissonSampling(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d,shadowSampler: sampler,mapSize: f32,darkness: f32,frustumEdgeFalloff: f32)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0) +{return 1.0;} +else +{var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0);var visibility: f32=1.;var poissonDisk: array;poissonDisk[0]= vec2f(-0.94201624,-0.39906216);poissonDisk[1]= vec2f(0.94558609,-0.76890725);poissonDisk[2]= vec2f(-0.094184101,-0.92938870);poissonDisk[3]= vec2f(0.34495938,0.29387760); +#ifndef SHADOWFLOAT +if (unpack(textureSampleLevel(shadowTexture,shadowSampler,uv+poissonDisk[0]*mapSize,0.)),shadowSampler: sampler,darkness: f32,depthScale: f32,frustumEdgeFalloff: f32)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0) +{return 1.0;} +else +{var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0); +#ifndef SHADOWFLOAT +var shadowMapSample: f32=unpack(textureSampleLevel(shadowTexture,shadowSampler,uv,0.)); +#else +var shadowMapSample: f32=textureSampleLevel(shadowTexture,shadowSampler,uv,0.).x; +#endif +var esm: f32=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}} +fn computeShadowWithCloseESM(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_2d,shadowSampler: sampler,darkness: f32,depthScale: f32,frustumEdgeFalloff: f32)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uv: vec2f=0.5*clipSpace.xy+ vec2f(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0) +{return 1.0;} +else +{var shadowPixelDepth: f32=clamp(depthMetric,0.,1.0); +#ifndef SHADOWFLOAT +var shadowMapSample: f32=unpack(textureSampleLevel(shadowTexture,shadowSampler,uv,0.)); +#else +var shadowMapSample: f32=textureSampleLevel(shadowTexture,shadowSampler,uv,0.).x; +#endif +var esm: f32=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}} +fn getZInClip(clipSpace: vec3f,uvDepth: vec3f)->f32 +{ +#ifdef IS_NDC_HALF_ZRANGE +return clipSpace.z; +#else +return uvDepth.z; +#endif +} +const GREATEST_LESS_THAN_ONE: f32=0.99999994; +#define DISABLE_UNIFORMITY_ANALYSIS +fn computeShadowWithCSMPCF1(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,darkness: f32,frustumEdgeFalloff: f32)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=clamp(getZInClip(clipSpace,uvDepth),0.,GREATEST_LESS_THAN_ONE);var shadow: f32=textureSampleCompare(shadowTexture,shadowSampler,uvDepth.xy,layer,uvDepth.z);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);} +fn computeShadowWithCSMPCF3(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=clamp(getZInClip(clipSpace,uvDepth),0.,GREATEST_LESS_THAN_ONE);var uv: vec2f=uvDepth.xy*shadowMapSizeAndInverse.x; +uv+=0.5; +var st: vec2f=fract(uv); +var base_uv: vec2f=floor(uv)-0.5; +base_uv*=shadowMapSizeAndInverse.y; +var uvw0: vec2f=3.-2.*st;var uvw1: vec2f=1.+2.*st;var u: vec2f= vec2f((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;var v: vec2f= vec2f((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;var shadow: f32=0.;shadow+=uvw0.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[0]),layer,uvDepth.z);shadow+=uvw1.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[0]),layer,uvDepth.z);shadow+=uvw0.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[1]),layer,uvDepth.z);shadow+=uvw1.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[1]),layer,uvDepth.z);shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);} +fn computeShadowWithCSMPCF5(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=clamp(getZInClip(clipSpace,uvDepth),0.,GREATEST_LESS_THAN_ONE);var uv: vec2f=uvDepth.xy*shadowMapSizeAndInverse.x; +uv+=0.5; +var st: vec2f=fract(uv); +var base_uv: vec2f=floor(uv)-0.5; +base_uv*=shadowMapSizeAndInverse.y; +var uvw0: vec2f=4.-3.*st;var uvw1: vec2f= vec2f(7.);var uvw2: vec2f=1.+3.*st;var u: vec3f= vec3f((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;var v: vec3f= vec3f((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;var shadow: f32=0.;shadow+=uvw0.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[0]),layer,uvDepth.z);shadow+=uvw1.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[0]),layer,uvDepth.z);shadow+=uvw2.x*uvw0.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[0]),layer,uvDepth.z);shadow+=uvw0.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[1]),layer,uvDepth.z);shadow+=uvw1.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[1]),layer,uvDepth.z);shadow+=uvw2.x*uvw1.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[1]),layer,uvDepth.z);shadow+=uvw0.x*uvw2.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[2]),layer,uvDepth.z);shadow+=uvw1.x*uvw2.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[2]),layer,uvDepth.z);shadow+=uvw2.x*uvw2.y*textureSampleCompare(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[2]),layer,uvDepth.z);shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);} +fn computeShadowWithPCF1(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,darkness: f32,frustumEdgeFalloff: f32)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=getZInClip(clipSpace,uvDepth);if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {var shadow: f32=textureSampleCompareLevel(shadowTexture,shadowSampler,uvDepth.xy,uvDepth.z);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}} +fn computeShadowWithPCF3(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=getZInClip(clipSpace,uvDepth);if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {var uv: vec2f=uvDepth.xy*shadowMapSizeAndInverse.x; +uv+=0.5; +var st: vec2f=fract(uv); +var base_uv: vec2f=floor(uv)-0.5; +base_uv*=shadowMapSizeAndInverse.y; +var uvw0: vec2f=3.-2.*st;var uvw1: vec2f=1.+2.*st;var u: vec2f= vec2f((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;var v: vec2f= vec2f((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;var shadow: f32=0.;shadow+=uvw0.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[0]),uvDepth.z);shadow+=uvw1.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[0]),uvDepth.z);shadow+=uvw0.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[1]),uvDepth.z);shadow+=uvw1.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[1]),uvDepth.z);shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}} +fn computeShadowWithPCF5(vPositionFromLight: vec4f,depthMetric: f32,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeAndInverse: vec2f,darkness: f32,frustumEdgeFalloff: f32)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=getZInClip(clipSpace,uvDepth);if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {var uv: vec2f=uvDepth.xy*shadowMapSizeAndInverse.x; +uv+=0.5; +var st: vec2f=fract(uv); +var base_uv: vec2f=floor(uv)-0.5; +base_uv*=shadowMapSizeAndInverse.y; +var uvw0: vec2f=4.-3.*st;var uvw1: vec2f= vec2f(7.);var uvw2: vec2f=1.+3.*st;var u: vec3f= vec3f((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;var v: vec3f= vec3f((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;var shadow: f32=0.;shadow+=uvw0.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[0]),uvDepth.z);shadow+=uvw1.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[0]),uvDepth.z);shadow+=uvw2.x*uvw0.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[0]),uvDepth.z);shadow+=uvw0.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[1]),uvDepth.z);shadow+=uvw1.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[1]),uvDepth.z);shadow+=uvw2.x*uvw1.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[1]),uvDepth.z);shadow+=uvw0.x*uvw2.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[0],v[2]),uvDepth.z);shadow+=uvw1.x*uvw2.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[1],v[2]),uvDepth.z);shadow+=uvw2.x*uvw2.y*textureSampleCompareLevel(shadowTexture,shadowSampler, base_uv.xy+ vec2f(u[2],v[2]),uvDepth.z);shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}} +const PoissonSamplers32: array=array ( +vec3f(0.06407013,0.05409927,0.), +vec3f(0.7366577,0.5789394,0.), +vec3f(-0.6270542,-0.5320278,0.), +vec3f(-0.4096107,0.8411095,0.), +vec3f(0.6849564,-0.4990818,0.), +vec3f(-0.874181,-0.04579735,0.), +vec3f(0.9989998,0.0009880066,0.), +vec3f(-0.004920578,-0.9151649,0.), +vec3f(0.1805763,0.9747483,0.), +vec3f(-0.2138451,0.2635818,0.), +vec3f(0.109845,0.3884785,0.), +vec3f(0.06876755,-0.3581074,0.), +vec3f(0.374073,-0.7661266,0.), +vec3f(0.3079132,-0.1216763,0.), +vec3f(-0.3794335,-0.8271583,0.), +vec3f(-0.203878,-0.07715034,0.), +vec3f(0.5912697,0.1469799,0.), +vec3f(-0.88069,0.3031784,0.), +vec3f(0.5040108,0.8283722,0.), +vec3f(-0.5844124,0.5494877,0.), +vec3f(0.6017799,-0.1726654,0.), +vec3f(-0.5554981,0.1559997,0.), +vec3f(-0.3016369,-0.3900928,0.), +vec3f(-0.5550632,-0.1723762,0.), +vec3f(0.925029,0.2995041,0.), +vec3f(-0.2473137,0.5538505,0.), +vec3f(0.9183037,-0.2862392,0.), +vec3f(0.2469421,0.6718712,0.), +vec3f(0.3916397,-0.4328209,0.), +vec3f(-0.03576927,-0.6220032,0.), +vec3f(-0.04661255,0.7995201,0.), +vec3f(0.4402924,0.3640312,0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.), +vec3f(0.) +);const PoissonSamplers64: array=array ( +vec3f(-0.613392,0.617481,0.), +vec3f(0.170019,-0.040254,0.), +vec3f(-0.299417,0.791925,0.), +vec3f(0.645680,0.493210,0.), +vec3f(-0.651784,0.717887,0.), +vec3f(0.421003,0.027070,0.), +vec3f(-0.817194,-0.271096,0.), +vec3f(-0.705374,-0.668203,0.), +vec3f(0.977050,-0.108615,0.), +vec3f(0.063326,0.142369,0.), +vec3f(0.203528,0.214331,0.), +vec3f(-0.667531,0.326090,0.), +vec3f(-0.098422,-0.295755,0.), +vec3f(-0.885922,0.215369,0.), +vec3f(0.566637,0.605213,0.), +vec3f(0.039766,-0.396100,0.), +vec3f(0.751946,0.453352,0.), +vec3f(0.078707,-0.715323,0.), +vec3f(-0.075838,-0.529344,0.), +vec3f(0.724479,-0.580798,0.), +vec3f(0.222999,-0.215125,0.), +vec3f(-0.467574,-0.405438,0.), +vec3f(-0.248268,-0.814753,0.), +vec3f(0.354411,-0.887570,0.), +vec3f(0.175817,0.382366,0.), +vec3f(0.487472,-0.063082,0.), +vec3f(-0.084078,0.898312,0.), +vec3f(0.488876,-0.783441,0.), +vec3f(0.470016,0.217933,0.), +vec3f(-0.696890,-0.549791,0.), +vec3f(-0.149693,0.605762,0.), +vec3f(0.034211,0.979980,0.), +vec3f(0.503098,-0.308878,0.), +vec3f(-0.016205,-0.872921,0.), +vec3f(0.385784,-0.393902,0.), +vec3f(-0.146886,-0.859249,0.), +vec3f(0.643361,0.164098,0.), +vec3f(0.634388,-0.049471,0.), +vec3f(-0.688894,0.007843,0.), +vec3f(0.464034,-0.188818,0.), +vec3f(-0.440840,0.137486,0.), +vec3f(0.364483,0.511704,0.), +vec3f(0.034028,0.325968,0.), +vec3f(0.099094,-0.308023,0.), +vec3f(0.693960,-0.366253,0.), +vec3f(0.678884,-0.204688,0.), +vec3f(0.001801,0.780328,0.), +vec3f(0.145177,-0.898984,0.), +vec3f(0.062655,-0.611866,0.), +vec3f(0.315226,-0.604297,0.), +vec3f(-0.780145,0.486251,0.), +vec3f(-0.371868,0.882138,0.), +vec3f(0.200476,0.494430,0.), +vec3f(-0.494552,-0.711051,0.), +vec3f(0.612476,0.705252,0.), +vec3f(-0.578845,-0.768792,0.), +vec3f(-0.772454,-0.090976,0.), +vec3f(0.504440,0.372295,0.), +vec3f(0.155736,0.065157,0.), +vec3f(0.391522,0.849605,0.), +vec3f(-0.620106,-0.328104,0.), +vec3f(0.789239,-0.419965,0.), +vec3f(-0.545396,0.538133,0.), +vec3f(-0.178564,-0.596057,0.) +);fn computeShadowWithCSMPCSS(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d_array,depthSampler: sampler,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,searchTapCount: i32,pcfTapCount: i32,poissonSamplers: array,lightSizeUVCorrection: vec2f,depthCorrection: f32,penumbraDarkness: f32)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=clamp(getZInClip(clipSpace,uvDepth),0.,GREATEST_LESS_THAN_ONE);var uvDepthLayer: vec4f= vec4f(uvDepth.x,uvDepth.y,f32(layer),uvDepth.z);var blockerDepth: f32=0.0;var sumBlockerDepth: f32=0.0;var numBlocker: f32=0.0;for (var i: i32=0; i,depthSampler: sampler,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,searchTapCount: i32,pcfTapCount: i32,poissonSamplers: array)->f32 +{var clipSpace: vec3f=vPositionFromLight.xyz/vPositionFromLight.w;var uvDepth: vec3f= vec3f(0.5*clipSpace.xyz+ vec3f(0.5));uvDepth.z=getZInClip(clipSpace,uvDepth);if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} +var blockerDepth: f32=0.0;var sumBlockerDepth: f32=0.0;var numBlocker: f32=0.0;for (var i: i32=0; i,depthSampler: sampler,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32)->f32 +{return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32);} +fn computeShadowWithPCSS32(vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d,depthSampler: sampler,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32)->f32 +{return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32);} +fn computeShadowWithPCSS64(vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d,depthSampler: sampler,shadowTexture: texture_depth_2d,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32)->f32 +{return computeShadowWithPCSS(vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64);} +fn computeShadowWithCSMPCSS16(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d_array,depthSampler: sampler,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,lightSizeUVCorrection: vec2f,depthCorrection: f32,penumbraDarkness: f32)->f32 +{return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);} +fn computeShadowWithCSMPCSS32(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d_array,depthSampler: sampler,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,lightSizeUVCorrection: vec2f,depthCorrection: f32,penumbraDarkness: f32)->f32 +{return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);} +fn computeShadowWithCSMPCSS64(layer: i32,vPositionFromLight: vec4f,depthMetric: f32,depthTexture: texture_2d_array,depthSampler: sampler,shadowTexture: texture_depth_2d_array,shadowSampler: sampler_comparison,shadowMapSizeInverse: f32,lightSizeUV: f32,darkness: f32,frustumEdgeFalloff: f32,lightSizeUVCorrection: vec2f,depthCorrection: f32,penumbraDarkness: f32)->f32 +{return computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthTexture,depthSampler,shadowTexture,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64,lightSizeUVCorrection,depthCorrection,penumbraDarkness);} +#endif +`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=d); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowsFragmentFunctions-QR4_Qrt1.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowsFragmentFunctions-QR4_Qrt1.js new file mode 100644 index 0000000000000000000000000000000000000000..e2c5c023a04945a05cf7e2de0d67fb7e03c2cee9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowsFragmentFunctions-QR4_Qrt1.js @@ -0,0 +1,568 @@ +import{S as e}from"./index-CDrXokXW.js";const o="reflectionFunction",s=`vec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction) +{float lon=atan(direction.z,direction.x);float lat=acos(direction.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(s,t,0); } +vec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction) +{float lon=atan(direction.z,direction.x);float lat=acos(direction.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(1.0-s,t,0); } +vec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix) +{vec3 cameraToVertex=normalize(worldPos.xyz-eyePosition);vec3 r=normalize(reflect(cameraToVertex,worldNormal));r=vec3(reflectionMatrix*vec4(r,0));float lon=atan(r.z,r.x);float lat=acos(r.y);vec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;float s=sphereCoords.x*0.5+0.5;float t=sphereCoords.y;return vec3(s,t,0);} +vec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix) +{vec3 viewDir=normalize(vec3(view*worldPos));vec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));vec3 r=reflect(viewDir,viewNormal);r=vec3(reflectionMatrix*vec4(r,0));r.z=r.z-1.0;float m=2.0*length(r);return vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);} +vec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix) +{vec3 viewDir=worldPos.xyz-eyePosition;vec3 coords=normalize(reflect(viewDir,worldNormal));return vec3(reflectionMatrix*vec4(coords,1));} +vec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix) +{vec3 viewDir=normalize(worldPos.xyz-eyePosition);vec3 coords=reflect(viewDir,worldNormal);coords=vec3(reflectionMatrix*vec4(coords,0)); +#ifdef INVERTCUBICMAP +coords.y*=-1.0; +#endif +return coords;} +vec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition) +{vec3 viewDir=normalize(worldPos.xyz-eyePosition);vec3 coords=reflect(viewDir,worldNormal);coords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);coords=vec3(reflectionMatrix*vec4(coords,0)); +#ifdef INVERTCUBICMAP +coords.y*=-1.0; +#endif +return coords;} +vec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix) +{return vec3(reflectionMatrix*(view*worldPos));} +vec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix) +{return vec3(reflectionMatrix*vec4(positionW,1.));} +#ifdef REFLECTION +vec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal) +{ +#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED +vec3 direction=normalize(vDirectionW);return computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction); +#endif +#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED +vec3 direction=normalize(vDirectionW);return computeFixedEquirectangularCoords(worldPos,worldNormal,direction); +#endif +#ifdef REFLECTIONMAP_EQUIRECTANGULAR +return computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix); +#endif +#ifdef REFLECTIONMAP_SPHERICAL +return computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix); +#endif +#ifdef REFLECTIONMAP_PLANAR +return computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix); +#endif +#ifdef REFLECTIONMAP_CUBIC +#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC +return computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition); +#else +return computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix); +#endif +#endif +#ifdef REFLECTIONMAP_PROJECTION +return computeProjectionCoords(worldPos,view,reflectionMatrix); +#endif +#ifdef REFLECTIONMAP_SKYBOX +return computeSkyBoxCoords(vPositionUVW,reflectionMatrix); +#endif +#ifdef REFLECTIONMAP_EXPLICIT +return vec3(0,0,0); +#endif +} +#endif +`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=s);const t="lightFragmentDeclaration",c=`#ifdef LIGHT{X} +uniform vec4 vLightData{X};uniform vec4 vLightDiffuse{X}; +#ifdef SPECULARTERM +uniform vec4 vLightSpecular{X}; +#else +vec4 vLightSpecular{X}=vec4(0.); +#endif +#ifdef SHADOW{X} +#ifdef SHADOWCSM{X} +uniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];uniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];uniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];uniform float cascadeBlendFactor{X};varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X}; +#if defined(SHADOWPCSS{X}) +uniform highp sampler2DArrayShadow shadowTexture{X};uniform highp sampler2DArray depthTexture{X};uniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float penumbraDarkness{X}; +#elif defined(SHADOWPCF{X}) +uniform highp sampler2DArrayShadow shadowTexture{X}; +#else +uniform highp sampler2DArray shadowTexture{X}; +#endif +#ifdef SHADOWCSMDEBUG{X} +const vec3 vCascadeColorsMultiplier{X}[8]=vec3[8] +( +vec3 ( 1.5,0.0,0.0 ), +vec3 ( 0.0,1.5,0.0 ), +vec3 ( 0.0,0.0,5.5 ), +vec3 ( 1.5,0.0,5.5 ), +vec3 ( 1.5,1.5,0.0 ), +vec3 ( 1.0,1.0,1.0 ), +vec3 ( 0.0,1.0,5.5 ), +vec3 ( 0.5,3.5,0.75 ) +);vec3 shadowDebug{X}; +#endif +#ifdef SHADOWCSMUSESHADOWMAXZ{X} +int index{X}=-1; +#else +int index{X}=SHADOWCSMNUM_CASCADES{X}-1; +#endif +float diff{X}=0.; +#elif defined(SHADOWCUBE{X}) +uniform samplerCube shadowTexture{X}; +#else +varying vec4 vPositionFromLight{X};varying float vDepthMetric{X}; +#if defined(SHADOWPCSS{X}) +uniform highp sampler2DShadow shadowTexture{X};uniform highp sampler2D depthTexture{X}; +#elif defined(SHADOWPCF{X}) +uniform highp sampler2DShadow shadowTexture{X}; +#else +uniform sampler2D shadowTexture{X}; +#endif +uniform mat4 lightMatrix{X}; +#endif +uniform vec4 shadowsInfo{X};uniform vec2 depthValues{X}; +#endif +#ifdef SPOTLIGHT{X} +uniform vec4 vLightDirection{X};uniform vec4 vLightFalloff{X}; +#elif defined(POINTLIGHT{X}) +uniform vec4 vLightFalloff{X}; +#elif defined(HEMILIGHT{X}) +uniform vec3 vLightGround{X}; +#endif +#ifdef AREALIGHT{X} +uniform vec4 vLightWidth{X};uniform vec4 vLightHeight{X}; +#endif +#ifdef IESLIGHTTEXTURE{X} +uniform sampler2D iesLightTexture{X}; +#endif +#ifdef PROJECTEDLIGHTTEXTURE{X} +uniform mat4 textureProjectionMatrix{X};uniform sampler2D projectionLightTexture{X}; +#endif +#ifdef CLUSTLIGHT{X} +uniform vec2 vSliceData{X};uniform vec2 vSliceRanges{X}[CLUSTLIGHT_SLICES];uniform sampler2D lightDataTexture{X};uniform highp sampler2D tileMaskTexture{X}; +#endif +#endif +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=c);const i="lightUboDeclaration",l=`#ifdef LIGHT{X} +uniform Light{X} +{vec4 vLightData;vec4 vLightDiffuse;vec4 vLightSpecular; +#ifdef SPOTLIGHT{X} +vec4 vLightDirection;vec4 vLightFalloff; +#elif defined(POINTLIGHT{X}) +vec4 vLightFalloff; +#elif defined(HEMILIGHT{X}) +vec3 vLightGround; +#elif defined(CLUSTLIGHT{X}) +vec2 vSliceData;vec2 vSliceRanges[CLUSTLIGHT_SLICES]; +#endif +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +vec4 vLightWidth;vec4 vLightHeight; +#endif +vec4 shadowsInfo;vec2 depthValues;} light{X}; +#ifdef IESLIGHTTEXTURE{X} +uniform sampler2D iesLightTexture{X}; +#endif +#ifdef PROJECTEDLIGHTTEXTURE{X} +uniform mat4 textureProjectionMatrix{X};uniform sampler2D projectionLightTexture{X}; +#endif +#ifdef CLUSTLIGHT{X} +uniform sampler2D lightDataTexture{X};uniform highp sampler2D tileMaskTexture{X}; +#endif +#ifdef SHADOW{X} +#ifdef SHADOWCSM{X} +uniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];uniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];uniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];uniform float cascadeBlendFactor{X};varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X}; +#if defined(SHADOWPCSS{X}) +uniform highp sampler2DArrayShadow shadowTexture{X};uniform highp sampler2DArray depthTexture{X};uniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float penumbraDarkness{X}; +#elif defined(SHADOWPCF{X}) +uniform highp sampler2DArrayShadow shadowTexture{X}; +#else +uniform highp sampler2DArray shadowTexture{X}; +#endif +#ifdef SHADOWCSMDEBUG{X} +const vec3 vCascadeColorsMultiplier{X}[8]=vec3[8] +( +vec3 ( 1.5,0.0,0.0 ), +vec3 ( 0.0,1.5,0.0 ), +vec3 ( 0.0,0.0,5.5 ), +vec3 ( 1.5,0.0,5.5 ), +vec3 ( 1.5,1.5,0.0 ), +vec3 ( 1.0,1.0,1.0 ), +vec3 ( 0.0,1.0,5.5 ), +vec3 ( 0.5,3.5,0.75 ) +);vec3 shadowDebug{X}; +#endif +#ifdef SHADOWCSMUSESHADOWMAXZ{X} +int index{X}=-1; +#else +int index{X}=SHADOWCSMNUM_CASCADES{X}-1; +#endif +float diff{X}=0.; +#elif defined(SHADOWCUBE{X}) +uniform samplerCube shadowTexture{X}; +#else +varying vec4 vPositionFromLight{X};varying float vDepthMetric{X}; +#if defined(SHADOWPCSS{X}) +uniform highp sampler2DShadow shadowTexture{X};uniform highp sampler2D depthTexture{X}; +#elif defined(SHADOWPCF{X}) +uniform highp sampler2DShadow shadowTexture{X}; +#else +uniform sampler2D shadowTexture{X}; +#endif +uniform mat4 lightMatrix{X}; +#endif +#endif +#endif +`;e.IncludesShadersStore[i]||(e.IncludesShadersStore[i]=l);const a="ltcHelperFunctions",v=`vec2 LTCUv( const in vec3 N,const in vec3 V,const in float roughness ) {const float LUTSIZE=64.0;const float LUTSCALE=( LUTSIZE-1.0 )/LUTSIZE;const float LUTBIAS=0.5/LUTSIZE;float dotNV=saturate( dot( N,V ) );vec2 uv=vec2( roughness,sqrt( 1.0-dotNV ) );uv=uv*LUTSCALE+LUTBIAS;return uv;} +float LTCClippedSphereFormFactor( const in vec3 f ) {float l=length( f );return max( ( l*l+f.z )/( l+1.0 ),0.0 );} +vec3 LTCEdgeVectorFormFactor( const in vec3 v1,const in vec3 v2 ) {float x=dot( v1,v2 );float y=abs( x );float a=0.8543985+( 0.4965155+0.0145206*y )*y;float b=3.4175940+( 4.1616724+y )*y;float v=a/b;float thetaSintheta=0.0;if( x>0.0 ) +{thetaSintheta=v;} +else +{thetaSintheta=0.5*inversesqrt( max( 1.0-x*x,1e-7 ) )-v;} +return cross( v1,v2 )*thetaSintheta;} +vec3 LTCEvaluate( const in vec3 N,const in vec3 V,const in vec3 P,const in mat3 mInv,const in vec3 rectCoords[ 4 ] ) {vec3 v1=rectCoords[ 1 ]-rectCoords[ 0 ];vec3 v2=rectCoords[ 3 ]-rectCoords[ 0 ];vec3 lightNormal=cross( v1,v2 );if( dot( lightNormal,P-rectCoords[ 0 ] )<0.0 ) return vec3( 0.0 );vec3 T1,T2;T1=normalize( V-N*dot( V,N ) );T2=- cross( N,T1 ); +mat3 mat=mInv*transposeMat3( mat3( T1,T2,N ) );vec3 coords[ 4 ];coords[ 0 ]=mat*( rectCoords[ 0 ]-P );coords[ 1 ]=mat*( rectCoords[ 1 ]-P );coords[ 2 ]=mat*( rectCoords[ 2 ]-P );coords[ 3 ]=mat*( rectCoords[ 3 ]-P );coords[ 0 ]=normalize( coords[ 0 ] );coords[ 1 ]=normalize( coords[ 1 ] );coords[ 2 ]=normalize( coords[ 2 ] );coords[ 3 ]=normalize( coords[ 3 ] );vec3 vectorFormFactor=vec3( 0.0 );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 0 ],coords[ 1 ] );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 1 ],coords[ 2 ] );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 2 ],coords[ 3 ] );vectorFormFactor+=LTCEdgeVectorFormFactor( coords[ 3 ],coords[ 0 ] );float result=LTCClippedSphereFormFactor( vectorFormFactor );return vec3( result );} +struct areaLightData +{vec3 Diffuse;vec3 Specular;vec4 Fresnel;}; +#define inline +areaLightData computeAreaLightSpecularDiffuseFresnel(const in sampler2D ltc1,const in sampler2D ltc2,const in vec3 viewDir,const in vec3 normal,const in vec3 position,const in vec3 lightPos,const in vec3 halfWidth,const in vec3 halfHeight,const in float roughness) +{areaLightData result;vec3 rectCoords[ 4 ];rectCoords[ 0 ]=lightPos+halfWidth-halfHeight; +rectCoords[ 1 ]=lightPos-halfWidth-halfHeight;rectCoords[ 2 ]=lightPos-halfWidth+halfHeight;rectCoords[ 3 ]=lightPos+halfWidth+halfHeight; +#ifdef SPECULARTERM +vec2 uv=LTCUv( normal,viewDir,roughness );vec4 t1=texture2D( ltc1,uv );vec4 t2=texture2D( ltc2,uv );mat3 mInv=mat3( +vec3( t1.x,0,t1.y ), +vec3( 0,1, 0 ), +vec3( t1.z,0,t1.w ) +);result.Specular=LTCEvaluate( normal,viewDir,position,mInv,rectCoords );result.Fresnel=t2; +#endif +result.Diffuse=LTCEvaluate( normal,viewDir,position,mat3( 1.0 ),rectCoords );return result;}`;e.IncludesShadersStore[a]||(e.IncludesShadersStore[a]=v);const r="shadowsFragmentFunctions",d=`#ifdef SHADOWS +#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) +#define TEXTUREFUNC(s,c,l) texture2DLodEXT(s,c,l) +#else +#define TEXTUREFUNC(s,c,b) texture2D(s,c,b) +#endif +#ifndef SHADOWFLOAT +float unpack(vec4 color) +{const vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(color,bit_shift);} +#endif +float computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff) +{float mask=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));return mix(value,1.0,mask);} +#define inline +float computeShadowCube(vec3 worldPos,vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues) +{vec3 directionToLight=worldPos-lightPosition;float depth=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y; +#ifndef SHADOWFLOAT +float shadow=unpack(textureCube(shadowSampler,directionToLight)); +#else +float shadow=textureCube(shadowSampler,directionToLight).x; +#endif +return depth>shadow ? darkness : 1.0;} +#define inline +float computeShadowWithPoissonSamplingCube(vec3 worldPos,vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues) +{vec3 directionToLight=worldPos-lightPosition;float depth=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;float visibility=1.;vec3 poissonDisk[4];poissonDisk[0]=vec3(-1.0,1.0,-1.0);poissonDisk[1]=vec3(1.0,-1.0,-1.0);poissonDisk[2]=vec3(-1.0,-1.0,-1.0);poissonDisk[3]=vec3(1.0,-1.0,1.0); +#ifndef SHADOWFLOAT +if (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;} +#endif +#define inline +float computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff) +{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0) +{return 1.0;} +else +{float shadowPixelDepth=clamp(depthMetric,0.,1.0); +#ifndef SHADOWFLOAT +float shadow=unpack(TEXTUREFUNC(shadowSampler,uv,0.)); +#else +float shadow=TEXTUREFUNC(shadowSampler,uv,0.).x; +#endif +return shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;}} +#define inline +float computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff) +{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0) +{return 1.0;} +else +{float shadowPixelDepth=clamp(depthMetric,0.,1.0);float visibility=1.;vec2 poissonDisk[4];poissonDisk[0]=vec2(-0.94201624,-0.39906216);poissonDisk[1]=vec2(0.94558609,-0.76890725);poissonDisk[2]=vec2(-0.094184101,-0.92938870);poissonDisk[3]=vec2(0.34495938,0.29387760); +#ifndef SHADOWFLOAT +if (unpack(TEXTUREFUNC(shadowSampler,uv+poissonDisk[0]*mapSize,0.))1.0 || uv.y<0. || uv.y>1.0) +{return 1.0;} +else +{float shadowPixelDepth=clamp(depthMetric,0.,1.0); +#ifndef SHADOWFLOAT +float shadowMapSample=unpack(TEXTUREFUNC(shadowSampler,uv,0.)); +#else +float shadowMapSample=TEXTUREFUNC(shadowSampler,uv,0.).x; +#endif +float esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}} +#define inline +float computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff) +{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0) +{return 1.0;} +else +{float shadowPixelDepth=clamp(depthMetric,0.,1.0); +#ifndef SHADOWFLOAT +float shadowMapSample=unpack(TEXTUREFUNC(shadowSampler,uv,0.)); +#else +float shadowMapSample=TEXTUREFUNC(shadowSampler,uv,0.).x; +#endif +float esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}} +#ifdef IS_NDC_HALF_ZRANGE +#define ZINCLIP clipSpace.z +#else +#define ZINCLIP uvDepth.z +#endif +#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) +#define SMALLEST_ABOVE_ZERO 1.1754943508e-38 +#define GREATEST_LESS_THAN_ONE 0.99999994 +#define DISABLE_UNIFORMITY_ANALYSIS +#define inline +float computeShadowWithCSMPCF1(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,float darkness,float frustumEdgeFalloff) +{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5)); +#ifdef USE_REVERSE_DEPTHBUFFER +uvDepth.z=clamp(ZINCLIP,SMALLEST_ABOVE_ZERO,1.); +#else +uvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE); +#endif +vec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);float shadow=texture2D(shadowSampler,uvDepthLayer);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);} +#define inline +float computeShadowWithCSMPCF3(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff) +{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5)); +#ifdef USE_REVERSE_DEPTHBUFFER +uvDepth.z=clamp(ZINCLIP,SMALLEST_ABOVE_ZERO,1.); +#else +uvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE); +#endif +vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; +uv+=0.5; +vec2 st=fract(uv); +vec2 base_uv=floor(uv)-0.5; +base_uv*=shadowMapSizeAndInverse.y; +vec2 uvw0=3.-2.*st;vec2 uvw1=1.+2.*st;vec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;vec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));shadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));shadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));shadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);} +#define inline +float computeShadowWithCSMPCF5(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff) +{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5)); +#ifdef USE_REVERSE_DEPTHBUFFER +uvDepth.z=clamp(ZINCLIP,SMALLEST_ABOVE_ZERO,1.); +#else +uvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE); +#endif +vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; +uv+=0.5; +vec2 st=fract(uv); +vec2 base_uv=floor(uv)-0.5; +base_uv*=shadowMapSizeAndInverse.y; +vec2 uvw0=4.-3.*st;vec2 uvw1=vec2(7.);vec2 uvw2=1.+3.*st;vec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;vec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));shadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));shadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[0]),layer,uvDepth.z));shadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));shadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));shadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[1]),layer,uvDepth.z));shadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[2]),layer,uvDepth.z));shadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[2]),layer,uvDepth.z));shadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[2]),layer,uvDepth.z));shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);} +#define inline +float computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff) +{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {float shadow=TEXTUREFUNC(shadowSampler,uvDepth,0.);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}} +#define inline +float computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff) +{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; +uv+=0.5; +vec2 st=fract(uv); +vec2 base_uv=floor(uv)-0.5; +base_uv*=shadowMapSizeAndInverse.y; +vec2 uvw0=3.-2.*st;vec2 uvw1=1.+2.*st;vec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;vec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z),0.);shadow+=uvw1.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z),0.);shadow+=uvw0.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z),0.);shadow+=uvw1.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z),0.);shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}} +#define inline +float computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff) +{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;if (depthMetric<0.0 || depthMetric>1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; +uv+=0.5; +vec2 st=fract(uv); +vec2 base_uv=floor(uv)-0.5; +base_uv*=shadowMapSizeAndInverse.y; +vec2 uvw0=4.-3.*st;vec2 uvw1=vec2(7.);vec2 uvw2=1.+3.*st;vec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;vec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z),0.);shadow+=uvw1.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z),0.);shadow+=uvw2.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z),0.);shadow+=uvw0.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z),0.);shadow+=uvw1.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z),0.);shadow+=uvw2.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z),0.);shadow+=uvw0.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z),0.);shadow+=uvw1.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z),0.);shadow+=uvw2.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z),0.);shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}} +const vec3 PoissonSamplers32[64]=vec3[64]( +vec3(0.06407013,0.05409927,0.), +vec3(0.7366577,0.5789394,0.), +vec3(-0.6270542,-0.5320278,0.), +vec3(-0.4096107,0.8411095,0.), +vec3(0.6849564,-0.4990818,0.), +vec3(-0.874181,-0.04579735,0.), +vec3(0.9989998,0.0009880066,0.), +vec3(-0.004920578,-0.9151649,0.), +vec3(0.1805763,0.9747483,0.), +vec3(-0.2138451,0.2635818,0.), +vec3(0.109845,0.3884785,0.), +vec3(0.06876755,-0.3581074,0.), +vec3(0.374073,-0.7661266,0.), +vec3(0.3079132,-0.1216763,0.), +vec3(-0.3794335,-0.8271583,0.), +vec3(-0.203878,-0.07715034,0.), +vec3(0.5912697,0.1469799,0.), +vec3(-0.88069,0.3031784,0.), +vec3(0.5040108,0.8283722,0.), +vec3(-0.5844124,0.5494877,0.), +vec3(0.6017799,-0.1726654,0.), +vec3(-0.5554981,0.1559997,0.), +vec3(-0.3016369,-0.3900928,0.), +vec3(-0.5550632,-0.1723762,0.), +vec3(0.925029,0.2995041,0.), +vec3(-0.2473137,0.5538505,0.), +vec3(0.9183037,-0.2862392,0.), +vec3(0.2469421,0.6718712,0.), +vec3(0.3916397,-0.4328209,0.), +vec3(-0.03576927,-0.6220032,0.), +vec3(-0.04661255,0.7995201,0.), +vec3(0.4402924,0.3640312,0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.), +vec3(0.) +);const vec3 PoissonSamplers64[64]=vec3[64]( +vec3(-0.613392,0.617481,0.), +vec3(0.170019,-0.040254,0.), +vec3(-0.299417,0.791925,0.), +vec3(0.645680,0.493210,0.), +vec3(-0.651784,0.717887,0.), +vec3(0.421003,0.027070,0.), +vec3(-0.817194,-0.271096,0.), +vec3(-0.705374,-0.668203,0.), +vec3(0.977050,-0.108615,0.), +vec3(0.063326,0.142369,0.), +vec3(0.203528,0.214331,0.), +vec3(-0.667531,0.326090,0.), +vec3(-0.098422,-0.295755,0.), +vec3(-0.885922,0.215369,0.), +vec3(0.566637,0.605213,0.), +vec3(0.039766,-0.396100,0.), +vec3(0.751946,0.453352,0.), +vec3(0.078707,-0.715323,0.), +vec3(-0.075838,-0.529344,0.), +vec3(0.724479,-0.580798,0.), +vec3(0.222999,-0.215125,0.), +vec3(-0.467574,-0.405438,0.), +vec3(-0.248268,-0.814753,0.), +vec3(0.354411,-0.887570,0.), +vec3(0.175817,0.382366,0.), +vec3(0.487472,-0.063082,0.), +vec3(-0.084078,0.898312,0.), +vec3(0.488876,-0.783441,0.), +vec3(0.470016,0.217933,0.), +vec3(-0.696890,-0.549791,0.), +vec3(-0.149693,0.605762,0.), +vec3(0.034211,0.979980,0.), +vec3(0.503098,-0.308878,0.), +vec3(-0.016205,-0.872921,0.), +vec3(0.385784,-0.393902,0.), +vec3(-0.146886,-0.859249,0.), +vec3(0.643361,0.164098,0.), +vec3(0.634388,-0.049471,0.), +vec3(-0.688894,0.007843,0.), +vec3(0.464034,-0.188818,0.), +vec3(-0.440840,0.137486,0.), +vec3(0.364483,0.511704,0.), +vec3(0.034028,0.325968,0.), +vec3(0.099094,-0.308023,0.), +vec3(0.693960,-0.366253,0.), +vec3(0.678884,-0.204688,0.), +vec3(0.001801,0.780328,0.), +vec3(0.145177,-0.898984,0.), +vec3(0.062655,-0.611866,0.), +vec3(0.315226,-0.604297,0.), +vec3(-0.780145,0.486251,0.), +vec3(-0.371868,0.882138,0.), +vec3(0.200476,0.494430,0.), +vec3(-0.494552,-0.711051,0.), +vec3(0.612476,0.705252,0.), +vec3(-0.578845,-0.768792,0.), +vec3(-0.772454,-0.090976,0.), +vec3(0.504440,0.372295,0.), +vec3(0.155736,0.065157,0.), +vec3(0.391522,0.849605,0.), +vec3(-0.620106,-0.328104,0.), +vec3(0.789239,-0.419965,0.), +vec3(-0.545396,0.538133,0.), +vec3(-0.178564,-0.596057,0.) +); +#define inline +float computeShadowWithCSMPCSS(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness) +{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5)); +#ifdef USE_REVERSE_DEPTHBUFFER +uvDepth.z=clamp(ZINCLIP,SMALLEST_ABOVE_ZERO,1.); +#else +uvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE); +#endif +vec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);float blockerDepth=0.0;float sumBlockerDepth=0.0;float numBlocker=0.0;for (int i=0; i1.0 || uvDepth.x<0. || uvDepth.x>1.0 || uvDepth.y<0. || uvDepth.y>1.0) {return 1.0;} else {float blockerDepth=0.0;float sumBlockerDepth=0.0;float numBlocker=0.0;for (int i=0; i, +#endif +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +vLightWidth: vec4f, +vLightHeight: vec4f, +#endif +shadowsInfo: vec4f, +depthValues: vec2f} ;var light{X} : Light{X}; +#ifdef SHADOW{X} +#ifdef SHADOWCSM{X} +uniform lightMatrix{X}: array;varying vPositionFromLight{X}_0: vec4f;varying vDepthMetric{X}_0: f32;varying vPositionFromLight{X}_1: vec4f;varying vDepthMetric{X}_1: f32;varying vPositionFromLight{X}_2: vec4f;varying vDepthMetric{X}_2: f32;varying vPositionFromLight{X}_3: vec4f;varying vDepthMetric{X}_3: f32;varying vPositionFromCamera{X}: vec4f; +#elif defined(SHADOWCUBE{X}) +#else +varying vPositionFromLight{X}: vec4f;varying vDepthMetric{X}: f32;uniform lightMatrix{X}: mat4x4f; +#endif +#endif +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=r);const i="shadowsVertex",s=`#ifdef SHADOWS +#if defined(SHADOWCSM{X}) +vertexOutputs.vPositionFromCamera{X}=scene.view*worldPos; +#if SHADOWCSMNUM_CASCADES{X}>0 +vertexOutputs.vPositionFromLight{X}_0=uniforms.lightMatrix{X}[0]*worldPos; +#ifdef USE_REVERSE_DEPTHBUFFER +vertexOutputs.vDepthMetric{X}_0=(-vertexOutputs.vPositionFromLight{X}_0.z+light{X}.depthValues.x)/light{X}.depthValues.y; +#else +vertexOutputs.vDepthMetric{X}_0= (vertexOutputs.vPositionFromLight{X}_0.z+light{X}.depthValues.x)/light{X}.depthValues.y; +#endif +#endif +#if SHADOWCSMNUM_CASCADES{X}>1 +vertexOutputs.vPositionFromLight{X}_1=uniforms.lightMatrix{X}[1]*worldPos; +#ifdef USE_REVERSE_DEPTHBUFFER +vertexOutputs.vDepthMetric{X}_1=(-vertexOutputs.vPositionFromLight{X}_1.z+light{X}.depthValues.x)/light{X}.depthValues.y; +#else +vertexOutputs.vDepthMetric{X}_1= (vertexOutputs.vPositionFromLight{X}_1.z+light{X}.depthValues.x)/light{X}.depthValues.y; +#endif +#endif +#if SHADOWCSMNUM_CASCADES{X}>2 +vertexOutputs.vPositionFromLight{X}_2=uniforms.lightMatrix{X}[2]*worldPos; +#ifdef USE_REVERSE_DEPTHBUFFER +vertexOutputs.vDepthMetric{X}_2=(-vertexOutputs.vPositionFromLight{X}_2.z+light{X}.depthValues.x)/light{X}.depthValues.y; +#else +vertexOutputs.vDepthMetric{X}_2= (vertexOutputs.vPositionFromLight{X}_2.z+light{X}.depthValues.x)/light{X}.depthValues.y; +#endif +#endif +#if SHADOWCSMNUM_CASCADES{X}>3 +vertexOutputs.vPositionFromLight{X}_3=uniforms.lightMatrix{X}[3]*worldPos; +#ifdef USE_REVERSE_DEPTHBUFFER +vertexOutputs.vDepthMetric{X}_3=(-vertexOutputs.vPositionFromLight{X}_3.z+light{X}.depthValues.x)/light{X}.depthValues.y; +#else +vertexOutputs.vDepthMetric{X}_3= (vertexOutputs.vPositionFromLight{X}_3.z+light{X}.depthValues.x)/light{X}.depthValues.y; +#endif +#endif +#elif defined(SHADOW{X}) && !defined(SHADOWCUBE{X}) +vertexOutputs.vPositionFromLight{X}=uniforms.lightMatrix{X}*worldPos; +#ifdef USE_REVERSE_DEPTHBUFFER +vertexOutputs.vDepthMetric{X}=(-vertexOutputs.vPositionFromLight{X}.z+light{X}.depthValues.x)/light{X}.depthValues.y; +#else +vertexOutputs.vDepthMetric{X}=(vertexOutputs.vPositionFromLight{X}.z+light{X}.depthValues.x)/light{X}.depthValues.y; +#endif +#endif +#endif +`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=s); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowsVertex-DbGd-etA.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowsVertex-DbGd-etA.js new file mode 100644 index 0000000000000000000000000000000000000000..ad4bca6cdb8395812feb06b9e66617ee89c11fde --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/shadowsVertex-DbGd-etA.js @@ -0,0 +1,71 @@ +import{S as i}from"./index-CDrXokXW.js";const e="lightVxFragmentDeclaration",o=`#ifdef LIGHT{X} +uniform vec4 vLightData{X};uniform vec4 vLightDiffuse{X}; +#ifdef SPECULARTERM +uniform vec4 vLightSpecular{X}; +#else +vec4 vLightSpecular{X}=vec4(0.); +#endif +#ifdef SHADOW{X} +#ifdef SHADOWCSM{X} +uniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X}; +#elif defined(SHADOWCUBE{X}) +#else +varying vec4 vPositionFromLight{X};varying float vDepthMetric{X};uniform mat4 lightMatrix{X}; +#endif +uniform vec4 shadowsInfo{X};uniform vec2 depthValues{X}; +#endif +#ifdef SPOTLIGHT{X} +uniform vec4 vLightDirection{X};uniform vec4 vLightFalloff{X}; +#elif defined(POINTLIGHT{X}) +uniform vec4 vLightFalloff{X}; +#elif defined(HEMILIGHT{X}) +uniform vec3 vLightGround{X}; +#endif +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +uniform vec4 vLightWidth{X};uniform vec4 vLightHeight{X}; +#endif +#endif +`;i.IncludesShadersStore[e]||(i.IncludesShadersStore[e]=o);const t="lightVxUboDeclaration",n=`#ifdef LIGHT{X} +uniform Light{X} +{vec4 vLightData;vec4 vLightDiffuse;vec4 vLightSpecular; +#ifdef SPOTLIGHT{X} +vec4 vLightDirection;vec4 vLightFalloff; +#elif defined(POINTLIGHT{X}) +vec4 vLightFalloff; +#elif defined(HEMILIGHT{X}) +vec3 vLightGround; +#elif defined(CLUSTLIGHT{X}) +vec2 vSliceData;vec2 vSliceRanges[CLUSTLIGHT_SLICES]; +#endif +#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) +vec4 vLightWidth;vec4 vLightHeight; +#endif +vec4 shadowsInfo;vec2 depthValues;} light{X}; +#ifdef SHADOW{X} +#ifdef SHADOWCSM{X} +uniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X}; +#elif defined(SHADOWCUBE{X}) +#else +varying vec4 vPositionFromLight{X};varying float vDepthMetric{X};uniform mat4 lightMatrix{X}; +#endif +#endif +#endif +`;i.IncludesShadersStore[t]||(i.IncludesShadersStore[t]=n);const f="shadowsVertex",d=`#ifdef SHADOWS +#if defined(SHADOWCSM{X}) +vPositionFromCamera{X}=view*worldPos;for (int i=0; i1&&n.eat("$");var i=n.next();return/['"({]/.test(i)?(e.tokens[0]=l(i,i=="("?"quote":i=="{"?"def":"string"),u(n,e)):(/\d/.test(i)||n.eatWhile(/\w/),e.tokens.shift(),"def")};function w(n){return function(e,i){return e.sol()&&e.string==n&&i.tokens.shift(),e.skipToEnd(),"string.special"}}function u(n,e){return(e.tokens[0]||d)(n,e)}const v={name:"shell",startState:function(){return{tokens:[]}},token:function(n,e){return u(n,e)},languageData:{autocomplete:k.concat(h,p),closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}};export{v as shell}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/size-CtOeLwIl.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/size-CtOeLwIl.js new file mode 100644 index 0000000000000000000000000000000000000000..b849a7e3ba6647ec18cc9ce1cdedff8cf94d7df6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/size-CtOeLwIl.js @@ -0,0 +1 @@ +import{A as a,z as b}from"./index-DWyDLubb.js";class i{#r=new WeakMap;#s;#e;static entries=new WeakMap;constructor(r){this.#e=r}observe(r,s){var e=this.#r.get(r)||new Set;return e.add(s),this.#r.set(r,e),this.#t().observe(r,this.#e),()=>{var o=this.#r.get(r);o.delete(s),o.size===0&&(this.#r.delete(r),this.#s.unobserve(r))}}#t(){return this.#s??(this.#s=new ResizeObserver(r=>{for(var s of r){i.entries.set(s.target,s);for(var e of this.#r.get(s.target)||[])e(s)}}))}}var v=new i({box:"border-box"});function n(t,r,s){var e=v.observe(t,()=>s(t[r]));a(()=>(b(()=>s(t[r])),e))}export{n as b}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/skeleton-3aE04lM6.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/skeleton-3aE04lM6.js new file mode 100644 index 0000000000000000000000000000000000000000..90bf98fc78fe7c172649b9a73c5cc659fcc836fa --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/skeleton-3aE04lM6.js @@ -0,0 +1 @@ +import{B as c}from"./bone-z620UXj2.js";import{M as f,O as p,aq as A,ar as _,L as x,as as b,c as M,at as B,V as R}from"./index-CDrXokXW.js";import{R as T}from"./rawTexture-DYLCXHMF.js";class u{get useTextureToStoreBoneMatrices(){return this._useTextureToStoreBoneMatrices}set useTextureToStoreBoneMatrices(e){this._useTextureToStoreBoneMatrices=e,this._markAsDirty()}get animationPropertiesOverride(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}get isUsingTextureForMatrices(){return this.useTextureToStoreBoneMatrices&&this._canUseTextureForBones}get uniqueId(){return this._uniqueId}constructor(e,t,n){this.name=e,this.id=t,this.bones=[],this.needInitialSkinMatrix=!1,this._isDirty=!0,this._meshesWithPoseMatrix=new Array,this._identity=f.Identity(),this._currentRenderId=-1,this._ranges={},this._absoluteTransformIsDirty=!0,this._canUseTextureForBones=!1,this._uniqueId=0,this._numBonesWithLinkedTransformNode=0,this._hasWaitingData=null,this._parentContainer=null,this.doNotSerialize=!1,this._useTextureToStoreBoneMatrices=!0,this._animationPropertiesOverride=null,this.onBeforeComputeObservable=new p,this.metadata=null,this.bones=[],this._scene=n||A.LastCreatedScene,this._uniqueId=this._scene.getUniqueId(),this._scene.addSkeleton(this),this._isDirty=!0;const i=this._scene.getEngine().getCaps();this._canUseTextureForBones=i.textureFloat&&i.maxVertexTextureImageUnits>0}getClassName(){return"Skeleton"}getChildren(){return this.bones.filter(e=>!e.getParent())}getTransformMatrices(e){if(this.needInitialSkinMatrix){if(!e)throw new Error("getTransformMatrices: When using the needInitialSkinMatrix flag, a mesh must be provided");return e._bonesTransformMatrices||this.prepare(!0),e._bonesTransformMatrices}return(!this._transformMatrices||this._isDirty)&&this.prepare(!this._transformMatrices),this._transformMatrices}getTransformMatrixTexture(e){return this.needInitialSkinMatrix&&e._transformMatrixTexture?e._transformMatrixTexture:this._transformMatrixTexture}getScene(){return this._scene}toString(e){let t=`Name: ${this.name}, nBones: ${this.bones.length}`;if(t+=`, nAnimationRanges: ${this._ranges?Object.keys(this._ranges).length:"none"}`,e){t+=", Ranges: {";let n=!0;for(const i in this._ranges)n&&(t+=", ",n=!1),t+=i;t+="}"}return t}getBoneIndexByName(e){for(let t=0,n=this.bones.length;t-1&&this._meshesWithPoseMatrix.splice(t,1)}_computeTransformMatrices(e,t){this.onBeforeComputeObservable.notifyObservers(this);for(let n=0;n0){for(const t of this.bones)if(t._linkedTransformNode){const n=t._linkedTransformNode;t.position=n.position,n.rotationQuaternion?t.rotationQuaternion=n.rotationQuaternion:t.rotation=n.rotation,t.scaling=n.scaling}}if(this.needInitialSkinMatrix)for(const t of this._meshesWithPoseMatrix){const n=t.getPoseMatrix();let i=this._isDirty;if((!t._bonesTransformMatrices||t._bonesTransformMatrices.length!==16*(this.bones.length+1))&&(t._bonesTransformMatrices=new Float32Array(16*(this.bones.length+1)),i=!0),!!i){if(this._synchronizedWithMesh!==t){this._synchronizedWithMesh=t;for(const s of this.bones)s.getParent()||(s.getBindMatrix().multiplyToRef(n,M.Matrix[1]),s._updateAbsoluteBindMatrices(M.Matrix[1]));if(this.isUsingTextureForMatrices){const s=(this.bones.length+1)*4;(!t._transformMatrixTexture||t._transformMatrixTexture.getSize().width!==s)&&(t._transformMatrixTexture&&t._transformMatrixTexture.dispose(),t._transformMatrixTexture=T.CreateRGBATexture(t._bonesTransformMatrices,(this.bones.length+1)*4,1,this._scene,!1,!1,1,1))}}this._computeTransformMatrices(t._bonesTransformMatrices,n),this.isUsingTextureForMatrices&&t._transformMatrixTexture&&t._transformMatrixTexture.update(t._bonesTransformMatrices)}}else{if(!this._isDirty)return;(!this._transformMatrices||this._transformMatrices.length!==16*(this.bones.length+1))&&(this._transformMatrices=new Float32Array(16*(this.bones.length+1)),this.isUsingTextureForMatrices&&(this._transformMatrixTexture&&this._transformMatrixTexture.dispose(),this._transformMatrixTexture=T.CreateRGBATexture(this._transformMatrices,(this.bones.length+1)*4,1,this._scene,!1,!1,1,1))),this._computeTransformMatrices(this._transformMatrices,null),this.isUsingTextureForMatrices&&this._transformMatrixTexture&&this._transformMatrixTexture.update(this._transformMatrices)}this._isDirty=!1}getAnimatables(){if(!this._animatables||this._animatables.length!==this.bones.length){this._animatables=[];for(let e=0;e-1&&this._parentContainer.skeletons.splice(e,1),this._parentContainer=null}this._transformMatrixTexture&&(this._transformMatrixTexture.dispose(),this._transformMatrixTexture=null)}serialize(){const e={};e.name=this.name,e.id=this.id,this.dimensionsAtRest&&(e.dimensionsAtRest=this.dimensionsAtRest.asArray()),e.bones=[],e.needInitialSkinMatrix=this.needInitialSkinMatrix,this.metadata&&(e.metadata=this.metadata);for(let t=0;t0&&(s.animation=n.animations[0].serialize()),e.ranges=[];for(const h in this._ranges){const o=this._ranges[h];if(!o)continue;const r={};r.name=h,r.from=o.from,r.to=o.to,e.ranges.push(r)}}return e}static Parse(e,t){const n=new u(e.name,e.id,t);e.dimensionsAtRest&&(n.dimensionsAtRest=R.FromArray(e.dimensionsAtRest)),n.needInitialSkinMatrix=e.needInitialSkinMatrix,e.metadata&&(n.metadata=e.metadata);let i;for(i=0;i-1&&(o=n.bones[s.parentBoneIndex]);const r=s.rest?f.FromArray(s.rest):null,a=new c(s.name,n,o,f.FromArray(s.matrix),r,null,h);s.id!==void 0&&s.id!==null&&(a.id=s.id),s.length&&(a.length=s.length),s.metadata&&(a.metadata=s.metadata),s.animation&&a.animations.push(b.Parse(s.animation)),s.linkedTransformNodeId!==void 0&&s.linkedTransformNodeId!==null&&(n._hasWaitingData=!0,a._waitingTransformNodeId=s.linkedTransformNodeId)}if(e.ranges)for(i=0;i0&&(e=this._meshesWithPoseMatrix[0].getPoseMatrix()),e}sortBones(){const e=[],t=new Array(this.bones.length);for(let n=0;n{const n=a()??null;t&&n==null&&l(),r.ensure(n,n&&(e=>n(e,...p)))},o)}export{m as s}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/spatialWebAudio-CBDS0rWd.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/spatialWebAudio-CBDS0rWd.js new file mode 100644 index 0000000000000000000000000000000000000000..52bf6aa4f9e0112fa19a3fbea77e3144fca44d4e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/spatialWebAudio-CBDS0rWd.js @@ -0,0 +1 @@ +import{a as S,_ as O,b as x}from"./webAudioBaseSubGraph-CNNuTFUE.js";import{ao as p,V as r,M as N}from"./index-CDrXokXW.js";import{c as M,b as d,d as D}from"./audioEngine-C797_5QL.js";const i={coneInnerAngle:6.28318530718,coneOuterAngle:6.28318530718,coneOuterVolume:0,distanceModel:"linear",maxDistance:1e4,minDistance:1,orientation:r.Right(),panningModel:"equalpower",position:r.Zero(),rolloffFactor:1,rotation:r.Zero(),rotationQuaternion:new p};function C(e){return e.spatialEnabled||e.spatialAutoUpdate!==void 0||e.spatialConeInnerAngle!==void 0||e.spatialConeOuterAngle!==void 0||e.spatialConeOuterVolume!==void 0||e.spatialDistanceModel!==void 0||e.spatialMaxDistance!==void 0||e.spatialMinDistance!==void 0||e.spatialMinUpdateTime!==void 0||e.spatialOrientation!==void 0||e.spatialPanningModel!==void 0||e.spatialPosition!==void 0||e.spatialRolloffFactor!==void 0||e.spatialRotation!==void 0||e.spatialRotationQuaternion!==void 0}class w{}const b={pan:0};function Q(e){return e.stereoEnabled||e.stereoPan!==void 0}class y{}class F extends S{constructor(t){super("Stereo",t)}setOptions(t){this.pan=t.stereoPan??b.pan}}function f(e){return e.getSubNode("Stereo")}function R(e,t,n){e.callOnSubNode("Stereo",o=>{o[t]=n})}class U extends y{constructor(t){super(),this._pan=b.pan,this._subGraph=t}get pan(){return this._pan}set pan(t){this._pan=t,R(this._subGraph,"pan",t)}}class V extends S{constructor(t){super("Spatial",t),this._attacherComponent=null}get isAttached(){return this._attacherComponent!==null&&this._attacherComponent.isAttached}attach(t,n,o){this.detach(),this._attacherComponent||(this._attacherComponent=new M(this)),this._attacherComponent.attach(t,n,o)}detach(){this._attacherComponent?.detach()}dispose(){super.dispose(),this._attacherComponent?.dispose(),this._attacherComponent=null}setOptions(t){this.coneInnerAngle=t.spatialConeInnerAngle??i.coneInnerAngle,this.coneOuterAngle=t.spatialConeOuterAngle??i.coneOuterAngle,this.coneOuterVolume=t.spatialConeOuterVolume??i.coneOuterVolume,this.distanceModel=t.spatialDistanceModel??i.distanceModel,this.maxDistance=t.spatialMaxDistance??i.maxDistance,this.minDistance=t.spatialMinDistance??i.minDistance,this.orientation=t.spatialOrientation??i.orientation,this.panningModel=t.spatialPanningModel??i.panningModel,this.rolloffFactor=t.spatialRolloffFactor??i.rolloffFactor,t.spatialPosition&&(this.position=t.spatialPosition.clone()),t.spatialRotationQuaternion?this.rotationQuaternion=t.spatialRotationQuaternion.clone():t.spatialRotation?this.rotation=t.spatialRotation.clone():this.rotationQuaternion=i.rotationQuaternion.clone(),this.update()}update(){this.isAttached?this._attacherComponent?.update():(this._updatePosition(),this._updateRotation())}}function s(e){return e.getSubNode("Spatial")}function a(e,t,n){e.callOnSubNode("Spatial",o=>{o[t]=n})}const m=N.Zero(),_=new p;function A(e){return e*Math.PI/180}function g(e){return e*180/Math.PI}async function G(e){return new P(e)}class P extends V{constructor(t){super(t),this._lastOrientation=r.Zero(),this._lastPosition=r.Zero(),this._lastRotation=r.Zero(),this._lastRotationQuaternion=new p,this.orientation=i.orientation.clone(),this.position=i.position.clone(),this.rotation=i.rotation.clone(),this.rotationQuaternion=i.rotationQuaternion.clone(),this.node=new PannerNode(t._audioContext),this._orientationX=new d(t,this.node.orientationX),this._orientationY=new d(t,this.node.orientationY),this._orientationZ=new d(t,this.node.orientationZ),this._positionX=new d(t,this.node.positionX),this._positionY=new d(t,this.node.positionY),this._positionZ=new d(t,this.node.positionZ)}dispose(){super.dispose(),this._orientationX.dispose(),this._orientationY.dispose(),this._orientationZ.dispose(),this._positionX.dispose(),this._positionY.dispose(),this._positionZ.dispose(),this.node.disconnect()}get coneInnerAngle(){return A(this.node.coneInnerAngle)}set coneInnerAngle(t){this.node.coneInnerAngle=g(t)}get coneOuterAngle(){return A(this.node.coneOuterAngle)}set coneOuterAngle(t){this.node.coneOuterAngle=g(t)}get coneOuterVolume(){return this.node.coneOuterGain}set coneOuterVolume(t){this.node.coneOuterGain=t}get distanceModel(){return this.node.distanceModel}set distanceModel(t){this.node.distanceModel=t;const n=this.node.maxDistance;this.node.maxDistance=n+.001,this.node.maxDistance=n}get minDistance(){return this.node.refDistance}set minDistance(t){this.node.refDistance=t}get maxDistance(){return this.node.maxDistance}set maxDistance(t){this.node.maxDistance=t}get panningModel(){return this.node.panningModel}set panningModel(t){this.node.panningModel=t}get rolloffFactor(){return this.node.rolloffFactor}set rolloffFactor(t){this.node.rolloffFactor=t}get _inNode(){return this.node}get _outNode(){return this.node}_updatePosition(){this._lastPosition.equalsWithEpsilon(this.position)||(this._positionX.targetValue=this.position.x,this._positionY.targetValue=this.position.y,this._positionZ.targetValue=this.position.z,this._lastPosition.copyFrom(this.position))}_updateRotation(){let t=!1;if(!this._lastRotationQuaternion.equalsWithEpsilon(this.rotationQuaternion))_.copyFrom(this.rotationQuaternion),this._lastRotationQuaternion.copyFrom(this.rotationQuaternion),t=!0;else if(!this._lastRotation.equalsWithEpsilon(this.rotation))p.FromEulerAnglesToRef(this.rotation.x,this.rotation.y,this.rotation.z,_),this._lastRotation.copyFrom(this.rotation),t=!0;else if(this._lastOrientation.equalsWithEpsilon(this.orientation))return;t&&(N.FromQuaternionToRef(_,m),r.TransformNormalToRef(r.RightReadOnly,m,this.orientation)),this._orientationX.targetValue=this.orientation.x,this._orientationY.targetValue=this.orientation.y,this._orientationZ.targetValue=this.orientation.z}_connect(t){return super._connect(t)?(t._inNode&&this.node.connect(t._inNode),!0):!1}_disconnect(t){return super._disconnect(t)?(t._inNode&&this.node.disconnect(t._inNode),!0):!1}getClassName(){return"_SpatialWebAudioSubNode"}}async function W(e){return new I(e)}class I extends F{constructor(t){super(t),this.node=new StereoPannerNode(t._audioContext),this._pan=new d(t,this.node.pan)}dispose(){super.dispose(),this._pan.dispose()}get pan(){return this._pan.targetValue}set pan(t){this._pan.targetValue=t}get _inNode(){return this.node}get _outNode(){return this.node}getClassName(){return"_StereoWebAudioSubNode"}_connect(t){return super._connect(t)?(t._inNode&&this.node.connect(t._inNode),!0):!1}_disconnect(t){return super._disconnect(t)?(t._inNode&&this.node.disconnect(t._inNode),!0):!1}}class X extends O{constructor(){super(...arguments),this._rootNode=null,this._inputNode=null}async initAsync(t){await super.initAsync(t);let n=!1,o=!1;(n=C(t))&&await this.createAndAddSubNodeAsync("Spatial"),(o=Q(t))&&await this.createAndAddSubNodeAsync("Stereo"),await this._createSubNodePromisesResolvedAsync(),n&&s(this)?.setOptions(t),o&&f(this)?.setOptions(t)}get _inNode(){return this._inputNode}_createSubNode(t){try{return super._createSubNode(t)}catch{}switch(t){case"Spatial":return G(this._owner.engine);case"Stereo":return W(this._owner.engine);default:throw new Error(`Unknown subnode name: ${t}`)}}_onSubNodesChanged(){super._onSubNodesChanged();const t=s(this),n=f(this),o=x(this);if(t&&t.getClassName()!=="_SpatialWebAudioSubNode")throw new Error("Not a WebAudio subnode.");if(n&&n.getClassName()!=="_StereoWebAudioSubNode")throw new Error("Not a WebAudio subnode.");if(o&&o.getClassName()!=="_VolumeWebAudioSubNode")throw new Error("Not a WebAudio subnode.");t&&(t.disconnectAll(),o&&t.connect(o)),n&&(n.disconnectAll(),o&&n.connect(o)),t&&n?(this._rootNode=new GainNode(this._owner.engine._audioContext),this._rootNode.connect(t._outNode),this._rootNode.connect(n._outNode)):(this._rootNode?.disconnect(),this._rootNode=null);let l=null,c=null;if(this._rootNode?c=this._rootNode:(t?l=t:n?l=n:o&&(l=o),c=l?.node??null),this._inputNode!==c){if(this._inputNode&&this._upstreamNodes){const h=this._upstreamNodes.values();for(let u=h.next();!u.done;u=h.next())u.value._outNode?.disconnect(this._inputNode)}if(this._inputNode=c,c&&this._upstreamNodes){const h=this._upstreamNodes.values();for(let u=h.next();!u.done;u=h.next())u.value._outNode?.connect(c)}}}}class E extends w{constructor(t){super(),this._coneInnerAngle=i.coneInnerAngle,this._coneOuterAngle=i.coneOuterAngle,this._coneOuterVolume=i.coneOuterVolume,this._distanceModel=i.distanceModel,this._maxDistance=i.maxDistance,this._minDistance=i.minDistance,this._panningModel=i.panningModel,this._rolloffFactor=i.rolloffFactor;const n=s(t);n?(this._orientation=n.orientation.clone(),this._position=n.position.clone(),this._rotation=n.rotation.clone(),this._rotationQuaternion=n.rotationQuaternion.clone()):(this._orientation=i.orientation.clone(),this._position=i.position.clone(),this._rotation=i.rotation.clone(),this._rotationQuaternion=i.rotationQuaternion.clone(),t.createAndAddSubNodeAsync("Spatial")),this._subGraph=t}dispose(){this._subGraph.removeSubNodeAsync(s(this._subGraph))}get coneInnerAngle(){return this._coneInnerAngle}set coneInnerAngle(t){this._coneInnerAngle=t,a(this._subGraph,"coneInnerAngle",t)}get coneOuterAngle(){return this._coneOuterAngle}set coneOuterAngle(t){this._coneOuterAngle=t,a(this._subGraph,"coneOuterAngle",t)}get coneOuterVolume(){return this._coneOuterVolume}set coneOuterVolume(t){this._coneOuterVolume=t,a(this._subGraph,"coneOuterVolume",t)}get distanceModel(){return this._distanceModel}set distanceModel(t){this._distanceModel=t,a(this._subGraph,"distanceModel",t)}get isAttached(){return this._subGraph.getSubNode("Spatial")?.isAttached??!1}get maxDistance(){return this._maxDistance}set maxDistance(t){t<=0&&(t=1e-6),this._maxDistance=t,a(this._subGraph,"maxDistance",t)}get minDistance(){return this._minDistance}set minDistance(t){this._minDistance=t,a(this._subGraph,"minDistance",t)}get orientation(){return this._orientation}set orientation(t){this._orientation=t,this._updateRotation()}get panningModel(){return this._panningModel}set panningModel(t){this._panningModel=t,a(this._subGraph,"panningModel",t)}get position(){return this._position}set position(t){this._position=t,this._updatePosition()}get rolloffFactor(){return this._rolloffFactor}set rolloffFactor(t){this._rolloffFactor=t,a(this._subGraph,"rolloffFactor",t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._updateRotation()}get rotationQuaternion(){return this._rotationQuaternion}set rotationQuaternion(t){this._rotationQuaternion=t,this._updateRotation()}attach(t,n=!1,o=3){s(this._subGraph)?.attach(t,n,o)}detach(){s(this._subGraph)?.detach()}update(){const t=s(this._subGraph);t&&(t.isAttached?t.update():(this._updatePosition(t),this._updateRotation(t)))}_updatePosition(t=null){if(!t&&(t=s(this._subGraph),!t))return;t.position.equalsWithEpsilon(this._position)||(t.position.copyFrom(this._position),t._updatePosition())}_updateRotation(t=null){!t&&(t=s(this._subGraph),!t)||(t.rotationQuaternion.equalsWithEpsilon(this._rotationQuaternion)?t.rotation.equalsWithEpsilon(this._rotation)?t.orientation.equalsWithEpsilon(this._orientation)||(t.orientation.copyFrom(this._orientation),t._updateRotation(),this._rotation.copyFrom(t.rotation),this._rotationQuaternion.copyFrom(t.rotationQuaternion)):(t.rotation.copyFrom(this._rotation),t._updateRotation(),this._orientation.copyFrom(t.orientation),this._rotationQuaternion.copyFrom(t.rotationQuaternion)):(t.rotationQuaternion.copyFrom(this._rotationQuaternion),t._updateRotation(),this._orientation.copyFrom(t.orientation),this._rotation.copyFrom(t.rotation)))}}class Y extends E{constructor(t,n,o){super(t),this._updaterComponent=new D(this,n,o)}get minUpdateTime(){return this._updaterComponent.minUpdateTime}set minUpdateTime(t){this._updaterComponent.minUpdateTime=t}dispose(){super.dispose(),this._updaterComponent.dispose(),this._updaterComponent=null}}export{C as _,U as a,Y as b,X as c,i as d}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/splatFileLoader-DWVxOgqv.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/splatFileLoader-DWVxOgqv.js new file mode 100644 index 0000000000000000000000000000000000000000..9edfdd05aeaa6b98e984424381a469ce287275ae --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/splatFileLoader-DWVxOgqv.js @@ -0,0 +1,446 @@ +import{aq as be,bb as pt,h as Pt,bY as Nt,S as N,a9 as Wt,x as Vt,y as Zt,z as jt,K as Xt,X as Gt,Y as $t,b1 as _t,a2 as qt,a4 as Kt,a6 as Jt,e as mt,ac as Qt,J as q,R as Lt,bZ as Yt,b_ as es,l as Ie,V as T,m as Ne,M as Ce,b$ as ts,c as J,L as de,c0 as He,c1 as ke,c2 as ss,aO as $,c3 as rs,ah as ne,b9 as L,ao as ns,C as Se,ai as he,bA as re,B as os,c4 as Re,d as as,ax as is}from"./index-CDrXokXW.js";import{af as ye}from"./index-DWyDLubb.js";import{ShaderMaterial as xt}from"./shaderMaterial-yE1litoM.js";import"./clipPlaneFragment-T8W7CIC5.js";import"./logDepthDeclaration-DbMKMukk.js";import"./fogFragment-R9KOnWn-.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./meshUboDeclaration-C6raEdzf.js";import"./clipPlaneVertex-Bmw4TNCQ.js";import"./logDepthVertex-DDooPwab.js";import"./helperFunctions-BkWNqKeI.js";import"./clipPlaneFragment-C7XUrTAZ.js";import"./logDepthDeclaration-DkdfQs4e.js";import"./fogFragment-DmA8Y7To.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./meshUboDeclaration-Bk1ASTX2.js";import"./helperFunctions-CZpZ-EbL.js";import"./clipPlaneVertex-J3Krgsee.js";import"./logDepthVertex-D_A6gsii.js";import{R as we}from"./rawTexture-DYLCXHMF.js";import"./thinInstanceMesh-BDN_yrTe.js";import{A as cs}from"./assetContainer-D7EiOqw6.js";import{Ray as ls}from"./ray-DFqjcUAE.js";import{S as hs}from"./standardMaterial-C4-ZPPCc.js";class fs{constructor(){this.mm=new Map}get(e,t){const s=this.mm.get(e);if(s!==void 0)return s.get(t)}set(e,t,s){let o=this.mm.get(e);o===void 0&&this.mm.set(e,o=new Map),o.set(t,s)}}class us{get standalone(){return this._options?.standalone??!1}get baseMaterial(){return this._baseMaterial}get doNotInjectCode(){return this._options?.doNotInjectCode??!1}constructor(e,t,s){this._baseMaterial=e,this._scene=t??be.LastCreatedScene,this._options=s,this._subMeshToEffect=new Map,this._subMeshToDepthWrapper=new fs,this._meshes=new Map,this._onEffectCreatedObserver=this._baseMaterial.onEffectCreatedObservable.add(o=>{const n=o.subMesh?.getMesh();n&&!this._meshes.has(n)&&this._meshes.set(n,n.onDisposeObservable.add(a=>{const l=this._subMeshToEffect.keys();for(let h=l.next();h.done!==!0;h=l.next()){const i=h.value;i?.getMesh()===a&&(this._subMeshToEffect.delete(i),this._deleteDepthWrapperEffect(i))}})),this._subMeshToEffect.get(o.subMesh)?.[0]!==o.effect&&(this._subMeshToEffect.set(o.subMesh,[o.effect,this._scene.getEngine().currentRenderPassId]),this._deleteDepthWrapperEffect(o.subMesh))})}_deleteDepthWrapperEffect(e){const t=this._subMeshToDepthWrapper.mm.get(e);t&&(t.forEach(s=>{s.mainDrawWrapper.effect?.dispose()}),this._subMeshToDepthWrapper.mm.delete(e))}getEffect(e,t,s){const o=this._subMeshToDepthWrapper.mm.get(e)?.get(t);if(!o)return null;let n=o.drawWrapper[s];return n||(n=o.drawWrapper[s]=new pt(this._scene.getEngine()),n.setEffect(o.mainDrawWrapper.effect,o.mainDrawWrapper.defines)),n}isReadyForSubMesh(e,t,s,o,n){return this.standalone&&!this._baseMaterial.isReadyForSubMesh(e.getMesh(),e,o)?!1:this._makeEffect(e,t,s,n)?.isReady()??!1}dispose(){this._baseMaterial.onEffectCreatedObservable.remove(this._onEffectCreatedObserver),this._onEffectCreatedObserver=null;const e=this._meshes.entries();for(let t=e.next();t.done!==!0;t=e.next()){const[s,o]=t.value;s.onDisposeObservable.remove(o)}}_makeEffect(e,t,s,o){const n=this._scene.getEngine(),a=this._subMeshToEffect.get(e);if(!a)return null;const[l,h]=a;if(!l.isReady())return null;let i=this._subMeshToDepthWrapper.get(e,s);if(!i){const m=new pt(n);m.defines=e._getDrawWrapper(h)?.defines??null,i={drawWrapper:[],mainDrawWrapper:m,depthDefines:"",token:Pt()},i.drawWrapper[o]=m,this._subMeshToDepthWrapper.set(e,s,i)}const _=t.join(` +`);if(i.mainDrawWrapper.effect&&_===i.depthDefines)return i.mainDrawWrapper.effect;i.depthDefines=_;const u=l.getUniformNames().slice();let f=l.vertexSourceCodeBeforeMigration,p=l.fragmentSourceCodeBeforeMigration;if(!f&&!p)return null;if(!this.doNotInjectCode){const m=this._options&&this._options.remappedVariables?`#include(${this._options.remappedVariables.join(",")})`:"#include",C=this._options&&this._options.remappedVariables?`#include(${this._options.remappedVariables.join(",")})`:"#include",E=this._options&&this._options.remappedVariables?`#include(${this._options.remappedVariables.join(",")})`:"#include",c="#include",g="#include";l.shaderLanguage===0?f=f.replace(/void\s+?main/g,` +${g} +void main`):f=f.replace(/@vertex/g,` +${g} +@vertex`),f=f.replace(/#define SHADOWDEPTH_NORMALBIAS|#define CUSTOM_VERTEX_UPDATE_WORLDPOS/g,m),f.indexOf("#define SHADOWDEPTH_METRIC")!==-1?f=f.replace(/#define SHADOWDEPTH_METRIC/g,C):f=f.replace(/}\s*$/g,C+` +}`),f=f.replace(/#define SHADER_NAME.*?\n|out vec4 glFragColor;\n/g,"");const S=p.indexOf("#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW")>=0||p.indexOf("#define CUSTOM_FRAGMENT_BEFORE_FOG")>=0,w=p.indexOf("#define SHADOWDEPTH_FRAGMENT")!==-1;let x="";S?p=p.replace(/#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW|#define CUSTOM_FRAGMENT_BEFORE_FOG/g,E):x=E+` +`,p=p.replace(/void\s+?main/g,Nt.IncludesShadersStore.shadowMapFragmentExtraDeclaration+` +void main`),w?p=p.replace(/#define SHADOWDEPTH_FRAGMENT/g,c):x+=c+` +`,x&&(p=p.replace(/}\s*$/g,x+"}")),u.push("biasAndScaleSM","depthValuesSM","lightDataSM","softTransparentShadowSM")}i.mainDrawWrapper.effect=n.createEffect({vertexSource:f,fragmentSource:p,vertexToken:i.token,fragmentToken:i.token},{attributes:l.getAttributesNames(),uniformsNames:u,uniformBuffersNames:l.getUniformBuffersNames(),samplers:l.getSamplers(),defines:_+` +`+l.defines.replace("#define SHADOWS","").replace(/#define SHADOW\d/g,""),indexParameters:l.getIndexParameters(),shaderLanguage:l.shaderLanguage},n);for(let m=0;m +vec3 color=inColor.rgb; +#ifdef FOG +#include +#endif +return vec4(color,B);} +`;N.IncludesShadersStore[vt]||(N.IncludesShadersStore[vt]=ds);const Fe="gaussianSplattingPixelShader",Ot=`#include +#include +#include +varying vec4 vColor;varying vec2 vPosition; +#include +void main () { +#include +gl_FragColor=gaussianColor(vColor);} +`;N.ShadersStore[Fe]||(N.ShadersStore[Fe]=Ot);const ps={name:Fe,shader:Ot},_s=Object.freeze(Object.defineProperty({__proto__:null,gaussianSplattingPixelShader:ps},Symbol.toStringTag,{value:"Module"})),gt="gaussianSplattingVertexDeclaration",ms="attribute vec3 position;attribute vec4 splatIndex0;attribute vec4 splatIndex1;attribute vec4 splatIndex2;attribute vec4 splatIndex3;uniform mat4 view;uniform mat4 projection;uniform mat4 world;uniform vec4 vEyePosition;";N.IncludesShadersStore[gt]||(N.IncludesShadersStore[gt]=ms);const St="gaussianSplattingUboDeclaration",xs=`#include +#include +attribute vec3 position;attribute vec4 splatIndex0;attribute vec4 splatIndex1;attribute vec4 splatIndex2;attribute vec4 splatIndex3; +`;N.IncludesShadersStore[St]||(N.IncludesShadersStore[St]=xs);const yt="gaussianSplatting",vs=`#if !defined(WEBGL2) && !defined(WEBGPU) && !defined(NATIVE) +mat3 transpose(mat3 matrix) {return mat3(matrix[0][0],matrix[1][0],matrix[2][0], +matrix[0][1],matrix[1][1],matrix[2][1], +matrix[0][2],matrix[1][2],matrix[2][2]);} +#endif +vec2 getDataUV(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return vec2((x+0.5)/textureSize.x,(y+0.5)/textureSize.y);} +#if SH_DEGREE>0 +ivec2 getDataUVint(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return ivec2(uint(x+0.5),uint(y+0.5));} +#endif +struct Splat {vec4 center;vec4 color;vec4 covA;vec4 covB; +#if SH_DEGREE>0 +uvec4 sh0; +#endif +#if SH_DEGREE>1 +uvec4 sh1; +#endif +#if SH_DEGREE>2 +uvec4 sh2; +#endif +};float getSplatIndex(int localIndex) +{float splatIndex;switch (localIndex) +{case 0: splatIndex=splatIndex0.x; break;case 1: splatIndex=splatIndex0.y; break;case 2: splatIndex=splatIndex0.z; break;case 3: splatIndex=splatIndex0.w; break;case 4: splatIndex=splatIndex1.x; break;case 5: splatIndex=splatIndex1.y; break;case 6: splatIndex=splatIndex1.z; break;case 7: splatIndex=splatIndex1.w; break;case 8: splatIndex=splatIndex2.x; break;case 9: splatIndex=splatIndex2.y; break;case 10: splatIndex=splatIndex2.z; break;case 11: splatIndex=splatIndex2.w; break;case 12: splatIndex=splatIndex3.x; break;case 13: splatIndex=splatIndex3.y; break;case 14: splatIndex=splatIndex3.z; break;case 15: splatIndex=splatIndex3.w; break;} +return splatIndex;} +Splat readSplat(float splatIndex) +{Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);splat.center=texture2D(centersTexture,splatUV);splat.color=texture2D(colorsTexture,splatUV);splat.covA=texture2D(covariancesATexture,splatUV)*splat.center.w;splat.covB=texture2D(covariancesBTexture,splatUV)*splat.center.w; +#if SH_DEGREE>0 +ivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);splat.sh0=texelFetch(shTexture0,splatUVint,0); +#endif +#if SH_DEGREE>1 +splat.sh1=texelFetch(shTexture1,splatUVint,0); +#endif +#if SH_DEGREE>2 +splat.sh2=texelFetch(shTexture2,splatUVint,0); +#endif +return splat;} +#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) +vec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[16]) +{const float SH_C0=0.28209479;const float SH_C1=0.48860251;float SH_C2[5];SH_C2[0]=1.092548430;SH_C2[1]=-1.09254843;SH_C2[2]=0.315391565;SH_C2[3]=-1.09254843;SH_C2[4]=0.546274215;float SH_C3[7];SH_C3[0]=-0.59004358;SH_C3[1]=2.890611442;SH_C3[2]=-0.45704579;SH_C3[3]=0.373176332;SH_C3[4]=-0.45704579;SH_C3[5]=1.445305721;SH_C3[6]=-0.59004358;vec3 result=/*SH_C0**/sh[0]; +#if SH_DEGREE>0 +float x=dir.x;float y=dir.y;float z=dir.z;result+=- SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3]; +#if SH_DEGREE>1 +float xx=x*x,yy=y*y,zz=z*z;float xy=x*y,yz=y*z,xz=x*z;result+= +SH_C2[0]*xy*sh[4] + +SH_C2[1]*yz*sh[5] + +SH_C2[2]*(2.0*zz-xx-yy)*sh[6] + +SH_C2[3]*xz*sh[7] + +SH_C2[4]*(xx-yy)*sh[8]; +#if SH_DEGREE>2 +result+= +SH_C3[0]*y*(3.0*xx-yy)*sh[9] + +SH_C3[1]*xy*z*sh[10] + +SH_C3[2]*y*(4.0*zz-xx-yy)*sh[11] + +SH_C3[3]*z*(2.0*zz-3.0*xx-3.0*yy)*sh[12] + +SH_C3[4]*x*(4.0*zz-xx-yy)*sh[13] + +SH_C3[5]*z*(xx-yy)*sh[14] + +SH_C3[6]*x*(xx-3.0*yy)*sh[15]; +#endif +#endif +#endif +return result;} +vec4 decompose(uint value) +{vec4 components=vec4( +float((value ) & 255u), +float((value>>uint( 8)) & 255u), +float((value>>uint(16)) & 255u), +float((value>>uint(24)) & 255u));return components*vec4(2./255.)-vec4(1.);} +vec3 computeSH(Splat splat,vec3 dir) +{vec3 sh[16];sh[0]=vec3(0.,0.,0.); +#if SH_DEGREE>0 +vec4 sh00=decompose(splat.sh0.x);vec4 sh01=decompose(splat.sh0.y);vec4 sh02=decompose(splat.sh0.z);sh[1]=vec3(sh00.x,sh00.y,sh00.z);sh[2]=vec3(sh00.w,sh01.x,sh01.y);sh[3]=vec3(sh01.z,sh01.w,sh02.x); +#endif +#if SH_DEGREE>1 +vec4 sh03=decompose(splat.sh0.w);vec4 sh04=decompose(splat.sh1.x);vec4 sh05=decompose(splat.sh1.y);sh[4]=vec3(sh02.y,sh02.z,sh02.w);sh[5]=vec3(sh03.x,sh03.y,sh03.z);sh[6]=vec3(sh03.w,sh04.x,sh04.y);sh[7]=vec3(sh04.z,sh04.w,sh05.x);sh[8]=vec3(sh05.y,sh05.z,sh05.w); +#endif +#if SH_DEGREE>2 +vec4 sh06=decompose(splat.sh1.z);vec4 sh07=decompose(splat.sh1.w);vec4 sh08=decompose(splat.sh2.x);vec4 sh09=decompose(splat.sh2.y);vec4 sh10=decompose(splat.sh2.z);vec4 sh11=decompose(splat.sh2.w);sh[9]=vec3(sh06.x,sh06.y,sh06.z);sh[10]=vec3(sh06.w,sh07.x,sh07.y);sh[11]=vec3(sh07.z,sh07.w,sh08.x);sh[12]=vec3(sh08.y,sh08.z,sh08.w);sh[13]=vec3(sh09.x,sh09.y,sh09.z);sh[14]=vec3(sh09.w,sh10.x,sh10.y);sh[15]=vec3(sh10.z,sh10.w,sh11.x); +#endif +return computeColorFromSHDegree(dir,sh);} +#else +vec3 computeSH(Splat splat,vec3 dir) +{return vec3(0.,0.,0.);} +#endif +vec4 gaussianSplatting(vec2 meshPos,vec3 worldPos,vec2 scale,vec3 covA,vec3 covB,mat4 worldMatrix,mat4 viewMatrix,mat4 projectionMatrix) +{mat4 modelView=viewMatrix*worldMatrix;vec4 camspace=viewMatrix*vec4(worldPos,1.);vec4 pos2d=projectionMatrix*camspace;float bounds=1.2*pos2d.w;if (pos2d.z<-pos2d.w || pos2d.x<-bounds || pos2d.x>bounds +|| pos2d.y<-bounds || pos2d.y>bounds) {return vec4(0.0,0.0,2.0,1.0);} +mat3 Vrk=mat3( +covA.x,covA.y,covA.z, +covA.y,covB.x,covB.y, +covA.z,covB.y,covB.z +);bool isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;mat3 J;if (isOrtho) {J=mat3( +focal.x,0.,0., +0.,focal.y,0., +0.,0.,0. +);} else {J=mat3( +focal.x/camspace.z,0.,-(focal.x*camspace.x)/(camspace.z*camspace.z), +0.,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z), +0.,0.,0. +);} +mat3 T=transpose(mat3(modelView))*J;mat3 cov2d=transpose(T)*Vrk*T; +#if COMPENSATION +float c00=cov2d[0][0];float c11=cov2d[1][1];float c01=cov2d[0][1];float detOrig=c00*c11-c01*c01; +#endif +cov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize; +#if COMPENSATION +vec3 c2d=vec3(cov2d[0][0],c01,cov2d[1][1]);float detBlur=c2d.x*c2d.z-c2d.y*c2d.y;float compensation=sqrt(max(0.,detOrig/detBlur));vColor.w*=compensation; +#endif +float mid=(cov2d[0][0]+cov2d[1][1])/2.0;float radius=length(vec2((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));float epsilon=0.0001;float lambda1=mid+radius+epsilon,lambda2=mid-radius+epsilon;if (lambda2<0.0) +{return vec4(0.0,0.0,2.0,1.0);} +vec2 diagonalVector=normalize(vec2(cov2d[0][1],lambda1-cov2d[0][0]));vec2 majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;vec2 minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2(diagonalVector.y,-diagonalVector.x);vec2 vCenter=vec2(pos2d);float scaleFactor=isOrtho ? 1.0 : pos2d.w;return vec4( +vCenter ++ ((meshPos.x*majorAxis ++ meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,pos2d.zw);}`;N.IncludesShadersStore[yt]||(N.IncludesShadersStore[yt]=vs);const Be="gaussianSplattingVertexShader",Ft=`#include<__decl__gaussianSplattingVertex> +#ifdef LOGARITHMICDEPTH +#extension GL_EXT_frag_depth : enable +#endif +#include +#include +#include +#include +uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform float alpha;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture; +#if SH_DEGREE>0 +uniform highp usampler2D shTexture0; +#endif +#if SH_DEGREE>1 +uniform highp usampler2D shTexture1; +#endif +#if SH_DEGREE>2 +uniform highp usampler2D shTexture2; +#endif +varying vec4 vColor;varying vec2 vPosition; +#include +void main () {float splatIndex=getSplatIndex(int(position.z+0.5));Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);vec4 worldPos=world*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position.xy; +#if SH_DEGREE>0 +mat3 worldRot=mat3(world);mat3 normWorldRot=inverseMat3(worldRot);vec3 eyeToSplatLocalSpace=normalize(normWorldRot*(worldPos.xyz-eyePosition));vColor.xyz=splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace); +#endif +vColor.w*=alpha;gl_Position=gaussianSplatting(position.xy,worldPos.xyz,vec2(1.,1.),covA,covB,world,view,projection); +#include +#include +#include +} +`;N.ShadersStore[Be]||(N.ShadersStore[Be]=Ft);const gs={name:Be,shader:Ft},Ss=Object.freeze(Object.defineProperty({__proto__:null,gaussianSplattingVertexShader:gs},Symbol.toStringTag,{value:"Module"})),wt="gaussianSplattingFragmentDeclaration",ys=`fn gaussianColor(inColor: vec4f,inPosition: vec2f)->vec4f +{var A : f32=-dot(inPosition,inPosition);if (A>-4.0) +{var B: f32=exp(A)*inColor.a; +#include +var color: vec3f=inColor.rgb; +#ifdef FOG +#include +#endif +return vec4f(color,B);} else {return vec4f(0.0);}} +`;N.IncludesShadersStoreWGSL[wt]||(N.IncludesShadersStoreWGSL[wt]=ys);const Ue="gaussianSplattingPixelShader",Bt=`#include +#include +#include +varying vColor: vec4f;varying vPosition: vec2f; +#include +@fragment +fn main(input: FragmentInputs)->FragmentOutputs { +#include +fragmentOutputs.color=gaussianColor(input.vColor,input.vPosition);} +`;N.ShadersStoreWGSL[Ue]||(N.ShadersStoreWGSL[Ue]=Bt);const ws={name:Ue,shader:Bt},Cs=Object.freeze(Object.defineProperty({__proto__:null,gaussianSplattingPixelShaderWGSL:ws},Symbol.toStringTag,{value:"Module"})),Ct="gaussianSplatting",bs=`fn getDataUV(index: f32,dataTextureSize: vec2f)->vec2 {let y: f32=floor(index/dataTextureSize.x);let x: f32=index-y*dataTextureSize.x;return vec2f((x+0.5),(y+0.5));} +struct Splat {center: vec4f, +color: vec4f, +covA: vec4f, +covB: vec4f, +#if SH_DEGREE>0 +sh0: vec4, +#endif +#if SH_DEGREE>1 +sh1: vec4, +#endif +#if SH_DEGREE>2 +sh2: vec4, +#endif +};fn getSplatIndex(localIndex: i32,splatIndex0: vec4f,splatIndex1: vec4f,splatIndex2: vec4f,splatIndex3: vec4f)->f32 {var splatIndex: f32;switch (localIndex) +{case 0: +{splatIndex=splatIndex0.x;break;} +case 1: +{splatIndex=splatIndex0.y;break;} +case 2: +{splatIndex=splatIndex0.z;break;} +case 3: +{splatIndex=splatIndex0.w;break;} +case 4: +{splatIndex=splatIndex1.x;break;} +case 5: +{splatIndex=splatIndex1.y;break;} +case 6: +{splatIndex=splatIndex1.z;break;} +case 7: +{splatIndex=splatIndex1.w;break;} +case 8: +{splatIndex=splatIndex2.x;break;} +case 9: +{splatIndex=splatIndex2.y;break;} +case 10: +{splatIndex=splatIndex2.z;break;} +case 11: +{splatIndex=splatIndex2.w;break;} +case 12: +{splatIndex=splatIndex3.x;break;} +case 13: +{splatIndex=splatIndex3.y;break;} +case 14: +{splatIndex=splatIndex3.z;break;} +default: +{splatIndex=splatIndex3.w;break;}} +return splatIndex;} +fn readSplat(splatIndex: f32,dataTextureSize: vec2f)->Splat {var splat: Splat;let splatUV=getDataUV(splatIndex,dataTextureSize);let splatUVi32=vec2(i32(splatUV.x),i32(splatUV.y));splat.center=textureLoad(centersTexture,splatUVi32,0);splat.color=textureLoad(colorsTexture,splatUVi32,0);splat.covA=textureLoad(covariancesATexture,splatUVi32,0)*splat.center.w;splat.covB=textureLoad(covariancesBTexture,splatUVi32,0)*splat.center.w; +#if SH_DEGREE>0 +splat.sh0=textureLoad(shTexture0,splatUVi32,0); +#endif +#if SH_DEGREE>1 +splat.sh1=textureLoad(shTexture1,splatUVi32,0); +#endif +#if SH_DEGREE>2 +splat.sh2=textureLoad(shTexture2,splatUVi32,0); +#endif +return splat;} +fn computeColorFromSHDegree(dir: vec3f,sh: array,16>)->vec3f +{let SH_C0: f32=0.28209479;let SH_C1: f32=0.48860251;var SH_C2: array=array( +1.092548430, +-1.09254843, +0.315391565, +-1.09254843, +0.546274215 +);var SH_C3: array=array( +-0.59004358, +2.890611442, +-0.45704579, +0.373176332, +-0.45704579, +1.445305721, +-0.59004358 +);var result: vec3f=/*SH_C0**/sh[0]; +#if SH_DEGREE>0 +let x: f32=dir.x;let y: f32=dir.y;let z: f32=dir.z;result+=-SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3]; +#if SH_DEGREE>1 +let xx: f32=x*x;let yy: f32=y*y;let zz: f32=z*z;let xy: f32=x*y;let yz: f32=y*z;let xz: f32=x*z;result+= +SH_C2[0]*xy*sh[4] + +SH_C2[1]*yz*sh[5] + +SH_C2[2]*(2.0f*zz-xx-yy)*sh[6] + +SH_C2[3]*xz*sh[7] + +SH_C2[4]*(xx-yy)*sh[8]; +#if SH_DEGREE>2 +result+= +SH_C3[0]*y*(3.0f*xx-yy)*sh[9] + +SH_C3[1]*xy*z*sh[10] + +SH_C3[2]*y*(4.0f*zz-xx-yy)*sh[11] + +SH_C3[3]*z*(2.0f*zz-3.0f*xx-3.0f*yy)*sh[12] + +SH_C3[4]*x*(4.0f*zz-xx-yy)*sh[13] + +SH_C3[5]*z*(xx-yy)*sh[14] + +SH_C3[6]*x*(xx-3.0f*yy)*sh[15]; +#endif +#endif +#endif +return result;} +fn decompose(value: u32)->vec4f +{let components : vec4f=vec4f( +f32((value ) & 255u), +f32((value>>u32( 8)) & 255u), +f32((value>>u32(16)) & 255u), +f32((value>>u32(24)) & 255u));return components*vec4f(2./255.)-vec4f(1.);} +fn computeSH(splat: Splat,dir: vec3f)->vec3f +{var sh: array,16>;sh[0]=vec3f(0.,0.,0.); +#if SH_DEGREE>0 +let sh00: vec4f=decompose(splat.sh0.x);let sh01: vec4f=decompose(splat.sh0.y);let sh02: vec4f=decompose(splat.sh0.z);sh[1]=vec3f(sh00.x,sh00.y,sh00.z);sh[2]=vec3f(sh00.w,sh01.x,sh01.y);sh[3]=vec3f(sh01.z,sh01.w,sh02.x); +#endif +#if SH_DEGREE>1 +let sh03: vec4f=decompose(splat.sh0.w);let sh04: vec4f=decompose(splat.sh1.x);let sh05: vec4f=decompose(splat.sh1.y);sh[4]=vec3f(sh02.y,sh02.z,sh02.w);sh[5]=vec3f(sh03.x,sh03.y,sh03.z);sh[6]=vec3f(sh03.w,sh04.x,sh04.y);sh[7]=vec3f(sh04.z,sh04.w,sh05.x);sh[8]=vec3f(sh05.y,sh05.z,sh05.w); +#endif +#if SH_DEGREE>2 +let sh06: vec4f=decompose(splat.sh1.z);let sh07: vec4f=decompose(splat.sh1.w);let sh08: vec4f=decompose(splat.sh2.x);let sh09: vec4f=decompose(splat.sh2.y);let sh10: vec4f=decompose(splat.sh2.z);let sh11: vec4f=decompose(splat.sh2.w);sh[9]=vec3f(sh06.x,sh06.y,sh06.z);sh[10]=vec3f(sh06.w,sh07.x,sh07.y);sh[11]=vec3f(sh07.z,sh07.w,sh08.x);sh[12]=vec3f(sh08.y,sh08.z,sh08.w);sh[13]=vec3f(sh09.x,sh09.y,sh09.z);sh[14]=vec3f(sh09.w,sh10.x,sh10.y);sh[15]=vec3f(sh10.z,sh10.w,sh11.x); +#endif +return computeColorFromSHDegree(dir,sh);} +fn gaussianSplatting( +meshPos: vec2, +worldPos: vec3, +scale: vec2, +covA: vec3, +covB: vec3, +worldMatrix: mat4x4, +viewMatrix: mat4x4, +projectionMatrix: mat4x4, +focal: vec2f, +invViewport: vec2f, +kernelSize: f32 +)->vec4f {let modelView=viewMatrix*worldMatrix;let camspace=viewMatrix*vec4f(worldPos,1.0);let pos2d=projectionMatrix*camspace;let bounds=1.2*pos2d.w;if (pos2d.z<0. || pos2d.x<-bounds || pos2d.x>bounds || pos2d.y<-bounds || pos2d.y>bounds) {return vec4f(0.0,0.0,2.0,1.0);} +let Vrk=mat3x3( +covA.x,covA.y,covA.z, +covA.y,covB.x,covB.y, +covA.z,covB.y,covB.z +);let isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;var J: mat3x3;if (isOrtho) {J=mat3x3( +focal.x,0.0,0.0, +0.0,focal.y,0.0, +0.0,0.0,0.0 +);} else {J=mat3x3( +focal.x/camspace.z,0.0,-(focal.x*camspace.x)/(camspace.z*camspace.z), +0.0,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z), +0.0,0.0,0.0 +);} +let T=transpose(mat3x3( +modelView[0].xyz, +modelView[1].xyz, +modelView[2].xyz))*J;var cov2d=transpose(T)*Vrk*T; +#if COMPENSATION +let c00: f32=cov2d[0][0];let c11: f32=cov2d[1][1];let c01: f32=cov2d[0][1];let detOrig: f32=c00*c11-c01*c01; +#endif +cov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize; +#if COMPENSATION +let c2d: vec3f=vec3f(cov2d[0][0],c01,cov2d[1][1]);let detBlur: f32=c2d.x*c2d.z-c2d.y*c2d.y;let compensation: f32=sqrt(max(0.,detOrig/detBlur));vertexOutputs.vColor.w*=compensation; +#endif +let mid=(cov2d[0][0]+cov2d[1][1])/2.0;let radius=length(vec2((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));let lambda1=mid+radius;let lambda2=mid-radius;if (lambda2<0.0) {return vec4f(0.0,0.0,2.0,1.0);} +let diagonalVector=normalize(vec2(cov2d[0][1],lambda1-cov2d[0][0]));let majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;let minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2(diagonalVector.y,-diagonalVector.x);let vCenter=vec2(pos2d.x,pos2d.y);let scaleFactor=select(pos2d.w,1.0,isOrtho);return vec4f( +vCenter+((meshPos.x*majorAxis+meshPos.y*minorAxis)*invViewport*scaleFactor)*scale, +pos2d.z, +pos2d.w +);}`;N.IncludesShadersStoreWGSL[Ct]||(N.IncludesShadersStoreWGSL[Ct]=bs);const Pe="gaussianSplattingVertexShader",Ut=`#include +#include +#include +#include +#include +#include +attribute splatIndex0: vec4f;attribute splatIndex1: vec4f;attribute splatIndex2: vec4f;attribute splatIndex3: vec4f;attribute position: vec3f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;uniform eyePosition: vec3f;uniform alpha: f32;var covariancesATexture: texture_2d;var covariancesBTexture: texture_2d;var centersTexture: texture_2d;var colorsTexture: texture_2d; +#if SH_DEGREE>0 +var shTexture0: texture_2d; +#endif +#if SH_DEGREE>1 +var shTexture1: texture_2d; +#endif +#if SH_DEGREE>2 +var shTexture2: texture_2d; +#endif +varying vColor: vec4f;varying vPosition: vec2f; +#include +@vertex +fn main(input : VertexInputs)->FragmentInputs {let splatIndex: f32=getSplatIndex(i32(input.position.z+0.5),input.splatIndex0,input.splatIndex1,input.splatIndex2,input.splatIndex3);var splat: Splat=readSplat(splatIndex,uniforms.dataTextureSize);var covA: vec3f=splat.covA.xyz;var covB: vec3f=vec3f(splat.covA.w,splat.covB.xy);let worldPos: vec4f=mesh.world*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=input.position.xy; +#if SH_DEGREE>0 +let worldRot: mat3x3f= mat3x3f(mesh.world[0].xyz,mesh.world[1].xyz,mesh.world[2].xyz);let normWorldRot: mat3x3f=inverseMat3(worldRot);var eyeToSplatLocalSpace: vec3f=normalize(normWorldRot*(worldPos.xyz-uniforms.eyePosition.xyz));vertexOutputs.vColor=vec4f(splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace),splat.color.w*uniforms.alpha); +#else +vertexOutputs.vColor=vec4f(splat.color.xyz,splat.color.w*uniforms.alpha); +#endif +vertexOutputs.position=gaussianSplatting(input.position.xy,worldPos.xyz,vec2f(1.0,1.0),covA,covB,mesh.world,scene.view,scene.projection,uniforms.focal,uniforms.invViewport,uniforms.kernelSize); +#include +#include +#include +} +`;N.ShadersStoreWGSL[Pe]||(N.ShadersStoreWGSL[Pe]=Ut);const Is={name:Pe,shader:Ut},Es=Object.freeze(Object.defineProperty({__proto__:null,gaussianSplattingVertexShaderWGSL:Is},Symbol.toStringTag,{value:"Module"})),bt="gaussianSplattingDepthPixelShader",Ts=`precision highp float;varying vec2 vPosition;varying vec4 vColor; +#ifdef DEPTH_RENDER +varying float vDepthMetric; +#endif +void main(void) {float A=-dot(vPosition,vPosition); +#if defined(SM_SOFTTRANSPARENTSHADOW) && SM_SOFTTRANSPARENTSHADOW==1 +float alpha=exp(A)*vColor.a;if (A<-4.) discard; +#else +if (A<-vColor.a) discard; +#endif +#ifdef DEPTH_RENDER +gl_FragColor=vec4(vDepthMetric,0.0,0.0,1.0); +#endif +}`;N.ShadersStore[bt]||(N.ShadersStore[bt]=Ts);const It="gaussianSplattingDepthVertexShader",As=`#include<__decl__gaussianSplattingVertex> +uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform float alpha;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;varying vec2 vPosition;varying vec4 vColor; +#include +#ifdef DEPTH_RENDER +uniform vec2 depthValues;varying float vDepthMetric; +#endif +void main(void) {float splatIndex=getSplatIndex(int(position.z+0.5));Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);vec4 worldPosGS=world*vec4(splat.center.xyz,1.0);vPosition=position.xy;vColor=splat.color;vColor.w*=alpha;gl_Position=gaussianSplatting(position.xy,worldPosGS.xyz,vec2(1.,1.),covA,covB,world,view,projection); +#ifdef DEPTH_RENDER +#ifdef USE_REVERSE_DEPTHBUFFER +vDepthMetric=((-gl_Position.z+depthValues.x)/(depthValues.y)); +#else +vDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y)); +#endif +#endif +}`;N.ShadersStore[It]||(N.ShadersStore[It]=As);const Et="gaussianSplattingDepthPixelShader",Ds=`#include +varying vPosition: vec2f;varying vColor: vec4f; +#ifdef DEPTH_RENDER +varying vDepthMetric: f32; +#endif +fn checkDiscard(inPosition: vec2f,inColor: vec4f)->vec4f {var A : f32=-dot(inPosition,inPosition);var alpha : f32=exp(A)*inColor.a; +#if defined(SM_SOFTTRANSPARENTSHADOW) && SM_SOFTTRANSPARENTSHADOW==1 +if (A<-4.) {discard;} +#else +if (A<-inColor.a) {discard;} +#endif +#ifdef DEPTH_RENDER +return vec4f(fragmentInputs.vDepthMetric,0.0,0.0,1.0); +#else +return vec4f(inColor.rgb,alpha); +#endif +} +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=checkDiscard(fragmentInputs.vPosition,fragmentInputs.vColor); +#if defined(SM_SOFTTRANSPARENTSHADOW) && SM_SOFTTRANSPARENTSHADOW==1 +var alpha : f32=fragmentOutputs.color.a; +#endif +} +`;N.ShadersStoreWGSL[Et]||(N.ShadersStoreWGSL[Et]=Ds);const Tt="gaussianSplattingDepthVertexShader",Ms=`#include +#include +attribute splatIndex0: vec4f;attribute splatIndex1: vec4f;attribute splatIndex2: vec4f;attribute splatIndex3: vec4f;attribute position: vec3f;uniform invViewport: vec2f;uniform dataTextureSize: vec2f;uniform focal: vec2f;uniform kernelSize: f32;uniform alpha: f32;var covariancesATexture: texture_2d;var covariancesBTexture: texture_2d;var centersTexture: texture_2d;var colorsTexture: texture_2d;varying vPosition: vec2f;varying vColor: vec4f; +#ifdef DEPTH_RENDER +uniform depthValues: vec2f;varying vDepthMetric: f32; +#endif +#include +@vertex +fn main(input : VertexInputs)->FragmentInputs {let splatIndex: f32=getSplatIndex(i32(input.position.z+0.5),input.splatIndex0,input.splatIndex1,input.splatIndex2,input.splatIndex3);var splat: Splat=readSplat(splatIndex,uniforms.dataTextureSize);var covA: vec3f=splat.covA.xyz;var covB: vec3f=vec3f(splat.covA.w,splat.covB.xy);let worldPos: vec4f=mesh.world*vec4f(splat.center.xyz,1.0);vertexOutputs.vPosition=input.position.xy;vertexOutputs.vColor=splat.color;vertexOutputs.vColor.w*=uniforms.alpha;vertexOutputs.position=gaussianSplatting(input.position.xy,worldPos.xyz,vec2f(1.0,1.0),covA,covB,mesh.world,scene.view,scene.projection,uniforms.focal,uniforms.invViewport,uniforms.kernelSize); +#ifdef DEPTH_RENDER +#ifdef USE_REVERSE_DEPTHBUFFER +vertexOutputs.vDepthMetric=((-vertexOutputs.position.z+uniforms.depthValues.x)/(uniforms.depthValues.y)); +#else +vertexOutputs.vDepthMetric=((vertexOutputs.position.z+uniforms.depthValues.x)/(uniforms.depthValues.y)); +#endif +#endif +}`;N.ShadersStoreWGSL[Tt]||(N.ShadersStoreWGSL[Tt]=Ms);class zs extends Qt{constructor(){super(),this.FOG=!1,this.THIN_INSTANCES=!0,this.LOGARITHMICDEPTH=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.SH_DEGREE=0,this.COMPENSATION=!1,this.rebuild()}}class M extends Wt{constructor(e,t){super(e,t),this.kernelSize=M.KernelSize,this._compensation=M.Compensation,this._isDirty=!1,this._sourceMesh=null,this.backFaceCulling=!1,this.shadowDepthWrapper=M._MakeGaussianSplattingShadowDepthWrapper(t,this.shaderLanguage)}set compensation(e){this._isDirty=this._isDirty!=e,this._compensation=e}get compensation(){return this._compensation}get hasRenderTargetTextures(){return!1}needAlphaTesting(){return!1}needAlphaBlending(){return!0}isReadyForSubMesh(e,t){const o=t._drawWrapper;let n=t.materialDefines;if(n&&this._isDirty&&n.markAsUnprocessed(),o.effect&&this.isFrozen&&o._wasPreviouslyReady&&o._wasPreviouslyUsingInstances===!0)return!0;t.materialDefines||(n=t.materialDefines=new zs);const a=this.getScene();if(this._isReadyForSubMesh(t))return!0;if(!this._sourceMesh)return!1;const l=a.getEngine(),h=this._sourceMesh;Vt(e,a,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,!1,n,void 0,void 0,void 0,this._isVertexOutputInvariant),Zt(a,l,this,n,!0,null,!0),jt(e,n,!1,!1),(l.version>1||l.isWebGPU)&&(n.SH_DEGREE=h.shDegree);const i=h.material;if(n.COMPENSATION=i&&i.compensation?i.compensation:M.Compensation,n.isDirty){n.markAsProcessed(),a.resetCachedMaterial(),Xt(M._Attribs,n),Gt({uniformsNames:M._Uniforms,uniformBuffersNames:M._UniformBuffers,samplers:M._Samplers,defines:n}),$t(M._Uniforms);const _=n.toString(),u=a.getEngine().createEffect("gaussianSplatting",{attributes:M._Attribs,uniformsNames:M._Uniforms,uniformBuffersNames:M._UniformBuffers,samplers:M._Samplers,defines:_,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:async()=>{this._shaderLanguage===1?await Promise.all([ye(()=>Promise.resolve().then(()=>Cs),void 0,import.meta.url),ye(()=>Promise.resolve().then(()=>Es),void 0,import.meta.url)]):await Promise.all([ye(()=>Promise.resolve().then(()=>_s),void 0,import.meta.url),ye(()=>Promise.resolve().then(()=>Ss),void 0,import.meta.url)])}},l);t.setEffect(u,n,this._materialContext)}return!t.effect||!t.effect.isReady()?!1:(n._renderId=a.getRenderId(),o._wasPreviouslyReady=!0,o._wasPreviouslyUsingInstances=!0,this._isDirty=!1,!0)}setSourceMesh(e){this._sourceMesh=e}static BindEffect(e,t,s){const o=s.getEngine(),n=s.activeCamera,a=o.getRenderWidth()*n.viewport.width,l=o.getRenderHeight()*n.viewport.height,h=e.material;if(!h._sourceMesh)return;const i=h._sourceMesh,_=n?.rigParent?.rigCameras.length||1;t.setFloat2("invViewport",1/(a/_),1/l);let u=1e3;if(n){const f=n.getProjectionMatrix().m[5];n.fovMode==_t.FOVMODE_VERTICAL_FIXED?u=l*f/2:u=a*f/2}if(t.setFloat2("focal",u,u),t.setFloat("kernelSize",h&&h.kernelSize?h.kernelSize:M.KernelSize),t.setFloat("alpha",h.alpha),s.bindEyePosition(t,"eyePosition",!0),i.covariancesATexture){const f=i.covariancesATexture.getSize();if(t.setFloat2("dataTextureSize",f.width,f.height),t.setTexture("covariancesATexture",i.covariancesATexture),t.setTexture("covariancesBTexture",i.covariancesBTexture),t.setTexture("centersTexture",i.centersTexture),t.setTexture("colorsTexture",i.colorsTexture),i.shTextures)for(let p=0;p{const n=o.material,a=o;M._BindEffectUniforms(a,n,s,e)}),s}static _MakeGaussianSplattingShadowDepthWrapper(e,t){const s=new xt("gaussianSplattingDepth",e,{vertex:"gaussianSplattingDepth",fragment:"gaussianSplattingDepth"},{attributes:M._Attribs,uniforms:M._Uniforms,samplers:M._Samplers,uniformBuffers:M._UniformBuffers,shaderLanguage:t}),o=new us(s,e,{standalone:!0});return s.onBindObservable.add(n=>{const a=n.material,l=n;M._BindEffectUniforms(l,a,s,e)}),o}clone(e){return mt.Clone(()=>new M(e,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.GaussianSplattingMaterial",e}getClassName(){return"GaussianSplattingMaterial"}static Parse(e,t,s){return mt.Parse(()=>new M(e.name,t),e,t,s)}}M.KernelSize=.3;M.Compensation=!1;M._Attribs=[q.PositionKind,"splatIndex0","splatIndex1","splatIndex2","splatIndex3"];M._Samplers=["covariancesATexture","covariancesBTexture","centersTexture","colorsTexture","shTexture0","shTexture1","shTexture2"];M._UniformBuffers=["Scene","Mesh"];M._Uniforms=["world","view","projection","vFogInfos","vFogColor","logarithmicDepthConstant","invViewport","dataTextureSize","focal","eyePosition","kernelSize","alpha","depthValues"];Lt("BABYLON.GaussianSplattingMaterial",M);const Hs=es,X={...Yt,TwoPi:Math.PI*2,Sign:Math.sign,Log2:Math.log2,HCF:Hs},Q=(r,e)=>{const t=(1<{e.x=Q(r>>>21,11),e.y=Q(r>>>11,10),e.z=Q(r,11)},ks=(r,e)=>{e[0]=Q(r>>>24,8)*255,e[1]=Q(r>>>16,8)*255,e[2]=Q(r>>>8,8)*255,e[3]=Q(r,8)*255},Rs=(r,e)=>{const t=1/(Math.sqrt(2)*.5),s=(Q(r>>>20,10)-.5)*t,o=(Q(r>>>10,10)-.5)*t,n=(Q(r,10)-.5)*t,a=Math.sqrt(1-(s*s+o*o+n*n));switch(r>>>30){case 0:e.set(a,s,o,n);break;case 1:e.set(s,a,o,n);break;case 2:e.set(s,o,a,n);break;case 3:e.set(s,o,n,a);break}};var Dt;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r[r.DOUBLE=3]="DOUBLE",r[r.UCHAR=4]="UCHAR",r[r.UNDEFINED=5]="UNDEFINED"})(Dt||(Dt={}));var Mt;(function(r){r[r.MIN_X=0]="MIN_X",r[r.MIN_Y=1]="MIN_Y",r[r.MIN_Z=2]="MIN_Z",r[r.MAX_X=3]="MAX_X",r[r.MAX_Y=4]="MAX_Y",r[r.MAX_Z=5]="MAX_Z",r[r.MIN_SCALE_X=6]="MIN_SCALE_X",r[r.MIN_SCALE_Y=7]="MIN_SCALE_Y",r[r.MIN_SCALE_Z=8]="MIN_SCALE_Z",r[r.MAX_SCALE_X=9]="MAX_SCALE_X",r[r.MAX_SCALE_Y=10]="MAX_SCALE_Y",r[r.MAX_SCALE_Z=11]="MAX_SCALE_Z",r[r.PACKED_POSITION=12]="PACKED_POSITION",r[r.PACKED_ROTATION=13]="PACKED_ROTATION",r[r.PACKED_SCALE=14]="PACKED_SCALE",r[r.PACKED_COLOR=15]="PACKED_COLOR",r[r.X=16]="X",r[r.Y=17]="Y",r[r.Z=18]="Z",r[r.SCALE_0=19]="SCALE_0",r[r.SCALE_1=20]="SCALE_1",r[r.SCALE_2=21]="SCALE_2",r[r.DIFFUSE_RED=22]="DIFFUSE_RED",r[r.DIFFUSE_GREEN=23]="DIFFUSE_GREEN",r[r.DIFFUSE_BLUE=24]="DIFFUSE_BLUE",r[r.OPACITY=25]="OPACITY",r[r.F_DC_0=26]="F_DC_0",r[r.F_DC_1=27]="F_DC_1",r[r.F_DC_2=28]="F_DC_2",r[r.F_DC_3=29]="F_DC_3",r[r.ROT_0=30]="ROT_0",r[r.ROT_1=31]="ROT_1",r[r.ROT_2=32]="ROT_2",r[r.ROT_3=33]="ROT_3",r[r.MIN_COLOR_R=34]="MIN_COLOR_R",r[r.MIN_COLOR_G=35]="MIN_COLOR_G",r[r.MIN_COLOR_B=36]="MIN_COLOR_B",r[r.MAX_COLOR_R=37]="MAX_COLOR_R",r[r.MAX_COLOR_G=38]="MAX_COLOR_G",r[r.MAX_COLOR_B=39]="MAX_COLOR_B",r[r.SH_0=40]="SH_0",r[r.SH_1=41]="SH_1",r[r.SH_2=42]="SH_2",r[r.SH_3=43]="SH_3",r[r.SH_4=44]="SH_4",r[r.SH_5=45]="SH_5",r[r.SH_6=46]="SH_6",r[r.SH_7=47]="SH_7",r[r.SH_8=48]="SH_8",r[r.SH_9=49]="SH_9",r[r.SH_10=50]="SH_10",r[r.SH_11=51]="SH_11",r[r.SH_12=52]="SH_12",r[r.SH_13=53]="SH_13",r[r.SH_14=54]="SH_14",r[r.SH_15=55]="SH_15",r[r.SH_16=56]="SH_16",r[r.SH_17=57]="SH_17",r[r.SH_18=58]="SH_18",r[r.SH_19=59]="SH_19",r[r.SH_20=60]="SH_20",r[r.SH_21=61]="SH_21",r[r.SH_22=62]="SH_22",r[r.SH_23=63]="SH_23",r[r.SH_24=64]="SH_24",r[r.SH_25=65]="SH_25",r[r.SH_26=66]="SH_26",r[r.SH_27=67]="SH_27",r[r.SH_28=68]="SH_28",r[r.SH_29=69]="SH_29",r[r.SH_30=70]="SH_30",r[r.SH_31=71]="SH_31",r[r.SH_32=72]="SH_32",r[r.SH_33=73]="SH_33",r[r.SH_34=74]="SH_34",r[r.SH_35=75]="SH_35",r[r.SH_36=76]="SH_36",r[r.SH_37=77]="SH_37",r[r.SH_38=78]="SH_38",r[r.SH_39=79]="SH_39",r[r.SH_40=80]="SH_40",r[r.SH_41=81]="SH_41",r[r.SH_42=82]="SH_42",r[r.SH_43=83]="SH_43",r[r.SH_44=84]="SH_44",r[r.UNDEFINED=85]="UNDEFINED"})(Mt||(Mt={}));class D extends Ie{get disableDepthSort(){return this._disableDepthSort}set disableDepthSort(e){!this._disableDepthSort&&e?(this._worker?.terminate(),this._worker=null,this._disableDepthSort=!0):this._disableDepthSort&&!e&&(this._disableDepthSort=!1,this._sortIsDirty=!0,this._instanciateWorker())}get viewDirectionFactor(){return T.OneReadOnly}get shDegree(){return this._shDegree}get splatCount(){return this._splatIndex?.length}get splatsData(){return this._splatsData}get covariancesATexture(){return this._covariancesATexture}get covariancesBTexture(){return this._covariancesBTexture}get centersTexture(){return this._centersTexture}get colorsTexture(){return this._colorsTexture}get shTextures(){return this._shTextures}get kernelSize(){return this._material instanceof M?this._material.kernelSize:0}get compensation(){return this._material instanceof M?this._material.compensation:!1}set material(e){this._material=e,this._material.backFaceCulling=!1,this._material.cullBackFaces=!1,e.resetDrawCache()}get material(){return this._material}static _MakeSplatGeometryForMesh(e){const t=new Ne,s=[-2,-2,0,2,-2,0,2,2,0,-2,2,0],o=[0,1,2,0,2,3],n=[],a=[];for(let l=0;lh+l*4))}t.positions=n,t.indices=a.flat(),t.applyToMesh(e)}constructor(e,t=null,s=null,o=!1){super(e,s),this._vertexCount=0,this._worker=null,this._modelViewMatrix=Ce.Identity(),this._canPostToWorker=!0,this._readyToDisplay=!1,this._covariancesATexture=null,this._covariancesBTexture=null,this._centersTexture=null,this._colorsTexture=null,this._splatPositions=null,this._splatIndex=null,this._shTextures=null,this._splatsData=null,this._keepInRam=!1,this._delayedTextureUpdate=null,this._useRGBACovariants=!1,this._material=null,this._tmpCovariances=[0,0,0,0,0,0],this._sortIsDirty=!1,this._shDegree=0,this._cameraViewInfos=new Map,this._disableDepthSort=!1,this._loadingPromise=null,this.subMeshes=[],new ts(0,0,4*D._BatchSize,0,6*D._BatchSize,this),this.setEnabled(!1),this._useRGBACovariants=!this.getEngine().isWebGPU&&this.getEngine().version===1,this._keepInRam=o,t&&(this._loadingPromise=this.loadFileAsync(t));const n=new M(this.name+"_material",this._scene);n.setSourceMesh(this),this._material=n,this._scene.onCameraRemovedObservable.add(a=>{const l=a.uniqueId;this._cameraViewInfos.has(l)&&(this._cameraViewInfos.get(l)?.mesh.dispose(),this._cameraViewInfos.delete(l))})}getLoadingPromise(){return this._loadingPromise}getClassName(){return"GaussianSplattingMesh"}getTotalVertices(){return this._vertexCount}isReady(e=!1){return super.isReady(e,!0)?this._readyToDisplay?!0:(this._postToWorker(!0),!1):!1}_getCameraDirection(e){const t=e.getViewMatrix();this.getWorldMatrix().multiplyToRef(t,this._modelViewMatrix);const s=J.Vector3[1];return s.set(this._modelViewMatrix.m[2],this._modelViewMatrix.m[6],this._modelViewMatrix.m[10]),s.normalize(),s}_postToWorker(e=!1){const s=this._scene.getFrameId();let o=!1;this._cameraViewInfos.forEach(h=>{h.frameIdLastUpdate!==s&&(o=!0)});const n=this._scene.activeCameras?.length?this._scene.activeCameras:[this._scene.activeCamera],a=[];n.forEach(h=>{if(!h)return;const i=h.uniqueId,_=this._cameraViewInfos.get(i);if(_)a.push(_);else{const u=new Ie(this.name+"_cameraMesh_"+i,this._scene);u.reservedDataStore={hidden:!0},u.setEnabled(!1),u.material=this.material,D._MakeSplatGeometryForMesh(u);const f={camera:h,cameraDirection:new T(0,0,0),mesh:u,frameIdLastUpdate:s,splatIndexBufferSet:!1};a.push(f),this._cameraViewInfos.set(i,f)}}),a.sort((h,i)=>h.frameIdLastUpdate-i.frameIdLastUpdate);const l=this._worker||_native&&_native.sortSplats||this._disableDepthSort;(e||o)&&l&&(this._scene.activeCameras?.length||this._scene.activeCamera)&&this._canPostToWorker?a.forEach(h=>{const i=h.camera,_=this._getCameraDirection(i),u=h.cameraDirection,f=T.Dot(_,u);(e||Math.abs(f-1)>=.01)&&this._canPostToWorker&&(h.cameraDirection.copyFrom(_),h.frameIdLastUpdate=s,this._canPostToWorker=!1,this._worker?this._worker.postMessage({view:this._modelViewMatrix.m,depthMix:this._depthMix,useRightHandedSystem:this._scene.useRightHandedSystem,cameraId:i.uniqueId},[this._depthMix.buffer]):_native&&_native.sortSplats&&(_native.sortSplats(this._modelViewMatrix,this._splatPositions,this._splatIndex,this._scene.useRightHandedSystem),h.splatIndexBufferSet?h.mesh.thinInstanceBufferUpdated("splatIndex"):(h.mesh.thinInstanceSetBuffer("splatIndex",this._splatIndex,16,!1),h.splatIndexBufferSet=!0),this._canPostToWorker=!0,this._readyToDisplay=!0))}):this._disableDepthSort&&(a.forEach(h=>{h.splatIndexBufferSet||(h.mesh.thinInstanceSetBuffer("splatIndex",this._splatIndex,16,!1),h.splatIndexBufferSet=!0)}),this._canPostToWorker=!0,this._readyToDisplay=!0)}render(e,t,s){this._postToWorker(),!this._geometry&&this._cameraViewInfos.size&&(this._geometry=this._cameraViewInfos.values().next().value.mesh.geometry);const o=this._scene.activeCamera.uniqueId,n=this._cameraViewInfos.get(o);if(!n||!n.splatIndexBufferSet)return this;const a=n.mesh;return a.getWorldMatrix().copyFrom(this.getWorldMatrix()),a.render(e,t,s)}static _TypeNameToEnum(e){switch(e){case"float":return 0;case"int":return 1;case"uint":return 2;case"double":return 3;case"uchar":return 4}return 5}static _ValueNameToEnum(e){switch(e){case"min_x":return 0;case"min_y":return 1;case"min_z":return 2;case"max_x":return 3;case"max_y":return 4;case"max_z":return 5;case"min_scale_x":return 6;case"min_scale_y":return 7;case"min_scale_z":return 8;case"max_scale_x":return 9;case"max_scale_y":return 10;case"max_scale_z":return 11;case"packed_position":return 12;case"packed_rotation":return 13;case"packed_scale":return 14;case"packed_color":return 15;case"x":return 16;case"y":return 17;case"z":return 18;case"scale_0":return 19;case"scale_1":return 20;case"scale_2":return 21;case"diffuse_red":case"red":return 22;case"diffuse_green":case"green":return 23;case"diffuse_blue":case"blue":return 24;case"f_dc_0":return 26;case"f_dc_1":return 27;case"f_dc_2":return 28;case"f_dc_3":return 29;case"opacity":return 25;case"rot_0":return 30;case"rot_1":return 31;case"rot_2":return 32;case"rot_3":return 33;case"min_r":return 34;case"min_g":return 35;case"min_b":return 36;case"max_r":return 37;case"max_g":return 38;case"max_b":return 39;case"f_rest_0":return 40;case"f_rest_1":return 41;case"f_rest_2":return 42;case"f_rest_3":return 43;case"f_rest_4":return 44;case"f_rest_5":return 45;case"f_rest_6":return 46;case"f_rest_7":return 47;case"f_rest_8":return 48;case"f_rest_9":return 49;case"f_rest_10":return 50;case"f_rest_11":return 51;case"f_rest_12":return 52;case"f_rest_13":return 53;case"f_rest_14":return 54;case"f_rest_15":return 55;case"f_rest_16":return 56;case"f_rest_17":return 57;case"f_rest_18":return 58;case"f_rest_19":return 59;case"f_rest_20":return 60;case"f_rest_21":return 61;case"f_rest_22":return 62;case"f_rest_23":return 63;case"f_rest_24":return 64;case"f_rest_25":return 65;case"f_rest_26":return 66;case"f_rest_27":return 67;case"f_rest_28":return 68;case"f_rest_29":return 69;case"f_rest_30":return 70;case"f_rest_31":return 71;case"f_rest_32":return 72;case"f_rest_33":return 73;case"f_rest_34":return 74;case"f_rest_35":return 75;case"f_rest_36":return 76;case"f_rest_37":return 77;case"f_rest_38":return 78;case"f_rest_39":return 79;case"f_rest_40":return 80;case"f_rest_41":return 81;case"f_rest_42":return 82;case"f_rest_43":return 83;case"f_rest_44":return 84}return 85}static ParseHeader(e){const t=new Uint8Array(e),s=new TextDecoder().decode(t.slice(0,1024*10)),o=`end_header +`,n=s.indexOf(o);if(n<0||!s)return null;const a=parseInt(/element vertex (\d+)\n/.exec(s)[1]),l=/element chunk (\d+)\n/.exec(s);let h=0;l&&(h=parseInt(l[1]));let i=0,_=0;const u={double:8,int:4,uint:4,float:4,short:2,ushort:2,uchar:1,list:0};let f;(function(v){v[v.Vertex=0]="Vertex",v[v.Chunk=1]="Chunk",v[v.SH=2]="SH",v[v.Unused=3]="Unused"})(f||(f={}));let p=1;const m=[],C=[],E=s.slice(0,n).split(` +`);let c=0;for(const v of E)if(v.startsWith("property ")){const[,d,y]=v.split(" "),A=D._ValueNameToEnum(y);A!=85&&(A>=84?c=3:A>=64?c=Math.max(c,2):A>=48&&(c=Math.max(c,1)));const H=D._TypeNameToEnum(d);p==1?(C.push({value:A,type:H,offset:_}),_+=u[d]):p==0?(m.push({value:A,type:H,offset:i}),i+=u[d]):p==2&&m.push({value:A,type:H,offset:i}),u[d]||de.Warn(`Unsupported property type: ${d}.`)}else if(v.startsWith("element ")){const[,d]=v.split(" ");d=="chunk"?p=1:d=="vertex"?p=0:d=="sh"?p=2:p=3}const g=new DataView(e,n+o.length),S=new ArrayBuffer(D._RowOutputLength*a);let w=null,x=0;return c&&(x=((c+1)*(c+1)-1)*3,w=new ArrayBuffer(x*a)),{vertexCount:a,chunkCount:h,rowVertexLength:i,rowChunkLength:_,vertexProperties:m,chunkProperties:C,dataView:g,buffer:S,shDegree:c,shCoefficientCount:x,shBuffer:w}}static _GetCompressedChunks(e,t){if(!e.chunkCount)return null;const s=e.dataView,o=new Array(e.chunkCount);for(let n=0;n>8;let E=255,c=0,g=0,S=0;const w=[];for(let x=0;x=40&&v.value<=84){const y=v.value-40;if(v.type==4&&e.chunkCount){const A=i.getUint8(e.rowChunkLength*e.chunkCount+e.vertexCount*e.rowVertexLength+t*e.shCoefficientCount+y);w[y]=(A*(8/255)-4)*127.5+127.5}else{const A=X.Clamp(d*127.5+127.5,0,255);w[y]=A}}}if(m){const x=e.shDegree==1?3:e.shDegree==2?8:15;for(let v=0;v{t.mesh.dispose()}),super.dispose(e,!0)}_copyTextures(e){if(this._covariancesATexture=e.covariancesATexture?.clone(),this._covariancesBTexture=e.covariancesBTexture?.clone(),this._centersTexture=e.centersTexture?.clone(),this._colorsTexture=e.colorsTexture?.clone(),e._shTextures){this._shTextures=[];for(const t of this._shTextures)this._shTextures?.push(t.clone())}}clone(e=""){const t=new D(e,void 0,this.getScene());t._copySource(this),t.makeGeometryUnique(),t._vertexCount=this._vertexCount,t._copyTextures(this),t._modelViewMatrix=Ce.Identity(),t._splatPositions=this._splatPositions,t._readyToDisplay=!1,t._disableDepthSort=this._disableDepthSort,t._instanciateWorker();const s=this.getBoundingInfo();return t.getBoundingInfo().reConstruct(s.minimum,s.maximum,this.getWorldMatrix()),t.forcedInstanceCount=this.forcedInstanceCount,t.setEnabled(!0),t}_makeEmptySplat(e,t,s,o){const n=this._useRGBACovariants?4:2;this._splatPositions[4*e+0]=0,this._splatPositions[4*e+1]=0,this._splatPositions[4*e+2]=0,t[e*4+0]=$(0),t[e*4+1]=$(0),t[e*4+2]=$(0),t[e*4+3]=$(0),s[e*n+0]=$(0),s[e*n+1]=$(0),o[e*4+3]=0}_makeSplat(e,t,s,o,n,a,l,h,i){const _=J.Matrix[0],u=J.Matrix[1],f=J.Quaternion[0],p=this._useRGBACovariants?4:2,m=t[8*e+0],C=t[8*e+1]*(i.flipY?-1:1),E=t[8*e+2];this._splatPositions[4*e+0]=m,this._splatPositions[4*e+1]=C,this._splatPositions[4*e+2]=E,l.minimizeInPlaceFromFloats(m,C,E),h.maximizeInPlaceFromFloats(m,C,E),f.set((s[32*e+28+1]-127.5)/127.5,(s[32*e+28+2]-127.5)/127.5,(s[32*e+28+3]-127.5)/127.5,-(s[32*e+28+0]-127.5)/127.5),f.normalize(),f.toRotationMatrix(_),Ce.ScalingToRef(t[8*e+3+0]*2,t[8*e+3+1]*2,t[8*e+3+2]*2,u);const c=_.multiplyToRef(u,J.Matrix[0]).m,g=this._tmpCovariances;g[0]=c[0]*c[0]+c[1]*c[1]+c[2]*c[2],g[1]=c[0]*c[4]+c[1]*c[5]+c[2]*c[6],g[2]=c[0]*c[8]+c[1]*c[9]+c[2]*c[10],g[3]=c[4]*c[4]+c[5]*c[5]+c[6]*c[6],g[4]=c[4]*c[8]+c[5]*c[9]+c[6]*c[10],g[5]=c[8]*c[8]+c[9]*c[9]+c[10]*c[10];let S=-1e4;for(let x=0;x<6;x++)S=Math.max(S,Math.abs(g[x]));this._splatPositions[4*e+3]=S;const w=S;o[e*4+0]=$(g[0]/w),o[e*4+1]=$(g[1]/w),o[e*4+2]=$(g[2]/w),o[e*4+3]=$(g[3]/w),n[e*p+0]=$(g[4]/w),n[e*p+1]=$(g[5]/w),a[e*4+0]=s[32*e+24+0],a[e*4+1]=s[32*e+24+1],a[e*4+2]=s[32*e+24+2],a[e*4+3]=s[32*e+24+3]}_updateTextures(e,t,s,o){const n=this._getTextureSize(this._vertexCount),a=(_,u,f,p)=>new we(_,u,f,p,this._scene,!1,!1,2,1),l=(_,u,f,p)=>new we(_,u,f,p,this._scene,!1,!1,2,0),h=(_,u,f,p)=>new we(_,u,f,p,this._scene,!1,!1,1,7),i=(_,u,f,p)=>new we(_,u,f,p,this._scene,!1,!1,2,2);if(this._covariancesATexture){this._delayedTextureUpdate={covA:e,covB:t,colors:s,centers:this._splatPositions,sh:o};const _=Float32Array.from(this._splatPositions),u=this._vertexCount;this._worker&&this._worker.postMessage({positions:_,vertexCount:u},[_.buffer]),this._postToWorker(!0)}else{if(this._covariancesATexture=i(e,n.x,n.y,5),this._covariancesBTexture=i(t,n.x,n.y,this._useRGBACovariants?5:7),this._centersTexture=a(this._splatPositions,n.x,n.y,5),this._colorsTexture=l(s,n.x,n.y,5),o){this._shTextures=[];for(const _ of o){const u=new Uint32Array(_.buffer),f=h(u,n.x,n.y,11);f.wrapU=0,f.wrapV=0,this._shTextures.push(f)}}this._instanciateWorker()}}*_updateData(e,t,s,o={flipY:!1}){this._covariancesATexture||(this._readyToDisplay=!1);const n=new Uint8Array(e),a=new Float32Array(n.buffer);this._keepInRam&&(this._splatsData=e);const l=n.length/D._RowOutputLength;l!=this._vertexCount&&this._updateSplatIndexBuffer(l),this._vertexCount=l,this._shDegree=s?s.length:0;const h=this._getTextureSize(l),i=h.x*h.y,_=D.ProgressiveUpdateAmount??h.y,u=h.x*_;this._splatPositions=new Float32Array(4*i);const f=new Uint16Array(i*4),p=new Uint16Array((this._useRGBACovariants?4:2)*i),m=new Uint8Array(i*4),C=new T(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),E=new T(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);if(D.ProgressiveUpdateAmount){this._updateTextures(f,p,m,s),this.setEnabled(!0);const c=Math.ceil(h.y/_);for(let w=0;wthis._splatIndex.length){this._splatIndex=new Float32Array(t);for(let s=0;s{s.mesh.thinInstanceSetBuffer("splatIndex",this._splatIndex,16,!1)})}this.forcedInstanceCount=t>>4}_updateSubTextures(e,t,s,o,n,a,l){const h=(c,g,S,w,x)=>{this.getEngine().updateTextureData(c.getInternalTexture(),g,0,w,S,x,0,0,!1)},i=this._getTextureSize(this._vertexCount),_=this._useRGBACovariants?4:2,u=n*i.x,f=a*i.x,p=new Uint16Array(t.buffer,u*4*Uint16Array.BYTES_PER_ELEMENT,f*4),m=new Uint16Array(s.buffer,u*_*Uint16Array.BYTES_PER_ELEMENT,f*_),C=new Uint8Array(o.buffer,u*4,f*4),E=new Float32Array(e.buffer,u*4*Float32Array.BYTES_PER_ELEMENT,f*4);if(h(this._covariancesATexture,p,i.x,n,a),h(this._covariancesBTexture,m,i.x,n,a),h(this._centersTexture,E,i.x,n,a),h(this._colorsTexture,C,i.x,n,a),l)for(let c=0;c{this._depthMix=s.data.depthMix;const o=s.data.cameraId,n=new Uint32Array(s.data.depthMix.buffer);if(this._splatIndex)for(let l=0;ls&&(de.Error("GaussianSplatting texture size: ("+s+", "+o+"), maxTextureSize: "+s),o=s),new ne(s,o)}}D._RowOutputLength=32;D._SH_C0=.28209479177387814;D._SplatBatchSize=327680;D._PlyConversionBatchSize=32768;D._BatchSize=16;D.ProgressiveUpdateAmount=0;D._CreateWorker=function(r){let e,t,s,o;r.onmessage=n=>{if(n.data.positions)e=n.data.positions;else{const a=n.data.cameraId,l=n.data.view,h=e.length/4+15&-16;if(!e||!l)throw new Error("positions or view is not defined!");t=n.data.depthMix,s=new Uint32Array(t.buffer),o=new Float32Array(t.buffer);for(let _=0;_0&&t.set(this._uvs32,q.UVKind);let s=0;this._colors32.length>0&&(s=1,t.set(this._colors32,q.ColorKind));const o=new Ie(this.name,this._scene);t.applyToMesh(o,this._updatable),this.mesh=o,this._positions=null,this._uvs=null,this._colors=null,this._updatable||(this.particles.length=0);let n=e;return n||(n=new hs("point cloud material",this._scene),n.emissiveColor=new Se(s,s,s),n.disableLighting=!0,n.pointsCloud=!0,n.pointSize=this._size),o.material=n,o}_addParticle(e,t,s,o){const n=new Os(e,t,s,o,this);return this.particles.push(n),n}_randomUnitVector(e){e.position=new T(Math.random(),Math.random(),Math.random()),e.color=new L(1,1,1,1)}_getColorIndicesForCoord(e,t,s,o){const n=e._groupImageData,a=s*(o*4)+t*4,l=[a,a+1,a+2,a+3],h=l[0],i=l[1],_=l[2],u=l[3],f=n[h],p=n[i],m=n[_],C=n[u];return new L(f/255,p/255,m/255,C)}_setPointsColorOrUV(e,t,s,o,n,a,l,h){h=h??0,s&&e.updateFacetData();const _=2*e.getBoundingInfo().boundingSphere.radius;let u=e.getVerticesData(q.PositionKind);const f=e.getIndices(),p=e.getVerticesData(q.UVKind+(h?h+1:"")),m=e.getVerticesData(q.ColorKind),C=T.Zero();e.computeWorldMatrix();const E=e.getWorldMatrix();if(!E.isIdentity()){u=u.slice(0);for(let j=0;j1&&(ie=1),ce<0&&(ce=0),ce>1&&(ce=1),Se.HSVtoRGBToRef(ut,ie,ce,ge),P.set(ge.r,ge.g,ge.b,1)):P=fe.set(Math.random(),Math.random(),Math.random(),1),G.color=new L(P.x,P.y,P.z,P.w),this._colors.push(P.x,P.y,P.z,P.w))}}_colorFromTexture(e,t,s){if(e.material===null){de.Warn(e.name+"has no material."),t._groupImageData=null,this._setPointsColorOrUV(e,t,s,!0,!1);return}const n=e.material.getActiveTextures();if(n.length===0){de.Warn(e.name+"has no usable texture."),t._groupImageData=null,this._setPointsColorOrUV(e,t,s,!0,!1);return}const a=e.clone();a.setEnabled(!1),this._promises.push(new Promise(l=>{os.WhenAllReady(n,()=>{let h=t._textureNb;h<0&&(h=0),h>n.length-1&&(h=n.length-1);const i=()=>{t._groupImgWidth=n[h].getSize().width,t._groupImgHeight=n[h].getSize().height,this._setPointsColorOrUV(a,t,s,!0,!0,void 0,void 0,n[h].coordinatesIndex),a.dispose(),l()};t._groupImageData=null;const _=n[h].readPixels();_?_.then(u=>{t._groupImageData=u,i()}):i()})}))}_calculateDensity(e,t,s){let o,n,a,l,h,i,_,u,f,p,m,C;const E=T.Zero(),c=T.Zero(),g=T.Zero(),S=T.Zero(),w=T.Zero(),x=T.Zero();let v;const d=[];let y=0;const A=s.length/3;for(let b=0;b0;b--){const U=d[b];if(U===0)H[b]=0;else{const z=(U-d[b-1])/U*B,R=Math.floor(z),V=z-R,k=+(Math.random()3)&&(a=0);const l=e.getVerticesData(q.PositionKind),h=e.getIndices();this._groups.push(this._groupCounter);const i=new Oe(this._groupCounter,null);switch(i._groupDensity=this._calculateDensity(t,l,h),a===2?i._textureNb=o||0:o=o||new L(1,1,1,1),a){case 2:this._colorFromTexture(e,i,!1);break;case 1:this._setPointsColorOrUV(e,i,!1,!1,!1);break;case 0:this._setPointsColorOrUV(e,i,!1);break;case 3:this._setPointsColorOrUV(e,i,!1,void 0,void 0,o,n);break}return this.nbParticles+=t,this._groupCounter++,this._groupCounter-1}addVolumePoints(e,t,s,o,n){let a=s||0;(isNaN(a)||a<0||a>3)&&(a=0);const l=e.getVerticesData(q.PositionKind),h=e.getIndices();this._groups.push(this._groupCounter);const i=new Oe(this._groupCounter,null);switch(i._groupDensity=this._calculateDensity(t,l,h),a===2?i._textureNb=o||0:o=o||new L(1,1,1,1),a){case 2:this._colorFromTexture(e,i,!0);break;case 1:this._setPointsColorOrUV(e,i,!0,!1,!1);break;case 0:this._setPointsColorOrUV(e,i,!0);break;case 3:this._setPointsColorOrUV(e,i,!0,void 0,void 0,o,n);break}return this.nbParticles+=t,this._groupCounter++,this._groupCounter-1}setParticles(e=0,t=this.nbParticles-1,s=!0){if(!this._updatable||!this._isReady)return this;this.beforeUpdateParticles(e,t,s);const o=J.Matrix[0],n=this.mesh,a=this._colors32,l=this._positions32,h=this._uvs32,i=J.Vector3,_=i[5].copyFromFloats(1,0,0),u=i[6].copyFromFloats(0,1,0),f=i[7].copyFromFloats(0,0,1),p=i[8].setAll(Number.MAX_VALUE),m=i[9].setAll(-Number.MAX_VALUE);Ce.IdentityToRef(o);let C=0;if(this.mesh?.isFacetDataEnabled&&(this._computeBoundingBox=!0),t=t>=this.nbParticles?this.nbParticles-1:t,this._computeBoundingBox&&(e!=0||t!=this.nbParticles-1)){const S=this.mesh?.getBoundingInfo();S&&(p.copyFrom(S.minimum),m.copyFrom(S.maximum))}C=0;let E=0,c=0,g=0;for(let S=e;S<=t;S++){const w=this.particles[S];C=w.idx,E=3*C,c=4*C,g=2*C,this.updateParticle(w);const x=w._rotationMatrix,v=w.position,d=w._globalPosition;if(this._computeParticleRotation&&w.getRotationMatrix(o),w.parentId!==null){const O=this.particles[w.parentId],I=O._rotationMatrix,K=O._globalPosition,Y=v.x*I[1]+v.y*I[4]+v.z*I[7],oe=v.x*I[0]+v.y*I[3]+v.z*I[6],te=v.x*I[2]+v.y*I[5]+v.z*I[8];if(d.x=K.x+oe,d.y=K.y+Y,d.z=K.z+te,this._computeParticleRotation){const F=o.m;x[0]=F[0]*I[0]+F[1]*I[3]+F[2]*I[6],x[1]=F[0]*I[1]+F[1]*I[4]+F[2]*I[7],x[2]=F[0]*I[2]+F[1]*I[5]+F[2]*I[8],x[3]=F[4]*I[0]+F[5]*I[3]+F[6]*I[6],x[4]=F[4]*I[1]+F[5]*I[4]+F[6]*I[7],x[5]=F[4]*I[2]+F[5]*I[5]+F[6]*I[8],x[6]=F[8]*I[0]+F[9]*I[3]+F[10]*I[6],x[7]=F[8]*I[1]+F[9]*I[4]+F[10]*I[7],x[8]=F[8]*I[2]+F[9]*I[5]+F[10]*I[8]}}else if(d.x=0,d.y=0,d.z=0,this._computeParticleRotation){const O=o.m;x[0]=O[0],x[1]=O[1],x[2]=O[2],x[3]=O[4],x[4]=O[5],x[5]=O[6],x[6]=O[8],x[7]=O[9],x[8]=O[10]}const A=i[11];w.translateFromPivot?A.setAll(0):A.copyFrom(w.pivot);const H=i[0];H.copyFrom(w.position);const B=H.x-w.pivot.x,b=H.y-w.pivot.y,U=H.z-w.pivot.z;let W=B*x[0]+b*x[3]+U*x[6],z=B*x[1]+b*x[4]+U*x[7],R=B*x[2]+b*x[5]+U*x[8];W+=A.x,z+=A.y,R+=A.z;const V=l[E]=d.x+_.x*W+u.x*z+f.x*R,k=l[E+1]=d.y+_.y*W+u.y*z+f.y*R,Z=l[E+2]=d.z+_.z*W+u.z*z+f.z*R;if(this._computeBoundingBox&&(p.minimizeInPlaceFromFloats(V,k,Z),m.maximizeInPlaceFromFloats(V,k,Z)),this._computeParticleColor&&w.color){const O=w.color,I=this._colors32;I[c]=O.r,I[c+1]=O.g,I[c+2]=O.b,I[c+3]=O.a}if(this._computeParticleTexture&&w.uv){const O=w.uv,I=this._uvs32;I[g]=O.x,I[g+1]=O.y}}return n&&(s&&(this._computeParticleColor&&n.updateVerticesData(q.ColorKind,a,!1,!1),this._computeParticleTexture&&n.updateVerticesData(q.UVKind,h,!1,!1),n.updateVerticesData(q.PositionKind,l,!1,!1)),this._computeBoundingBox&&(n.hasBoundingInfo?n.getBoundingInfo().reConstruct(p,m,n._worldMatrix):n.buildBoundingInfo(p,m,n._worldMatrix))),this.afterUpdateParticles(e,t,s),this}dispose(){this.mesh?.dispose(),this.vars=null,this._positions=null,this._indices=null,this._normals=null,this._uvs=null,this._colors=null,this._indices32=null,this._positions32=null,this._uvs32=null,this._colors32=null}refreshVisibleSize(){return this._isVisibilityBoxLocked||this.mesh?.refreshBoundingInfo(),this}setVisibilityBox(e){if(!this.mesh)return;const t=e/2;this.mesh.buildBoundingInfo(new T(-t,-t,-t),new T(t,t,t))}get isAlwaysVisible(){return this._alwaysVisible}set isAlwaysVisible(e){this.mesh&&(this._alwaysVisible=e,this.mesh.alwaysSelectAsActiveMesh=e)}set computeParticleRotation(e){this._computeParticleRotation=e}set computeParticleColor(e){this._computeParticleColor=e}set computeParticleTexture(e){this._computeParticleTexture=e}get computeParticleColor(){return this._computeParticleColor}get computeParticleTexture(){return this._computeParticleTexture}set computeBoundingBox(e){this._computeBoundingBox=e}get computeBoundingBox(){return this._computeBoundingBox}initParticles(){}recycleParticle(e){return e}updateParticle(e){return e}beforeUpdateParticles(e,t,s){}afterUpdateParticles(e,t,s){}}function Bs(r,e,t){const s=new Uint8Array(r),o=new Uint32Array(r.slice(0,12)),n=o[2],a=s[12],l=s[13],h=s[14],i=s[15],_=o[1];if(i||o[0]!=1347635022||_!=2&&_!=3)return new Promise(d=>{d({mode:3,data:f,hasVertexColors:!1})});const u=32,f=new ArrayBuffer(u*n),p=1/(1<=3){const d=Math.SQRT1_2;for(let y=0;y>>30;let W=H,z=0;for(let k=3;k>=0;--k)if(k!==U){const Z=W&B,O=W>>>9&1;W=W>>>10,b[k]=d*(Z/B),O===1&&(b[k]=-b[k]),z+=b[k]*b[k]}const R=1-z;b[U]=Math.sqrt(Math.max(R,0));const V=[3,0,1,2];for(let k=0;k<4;k++)x[y*32+28+k]=Math.round(127.5+b[V[k]]*127.5);c+=4}}else for(let d=0;d{z({mode:0,data:f,hasVertexColors:!1,sh:B,trainedWithAntialiasing:!!h})})}return new Promise(d=>{d({mode:0,data:f,hasVertexColors:!1,trainedWithAntialiasing:!!h})})}const Ht=.28209479177387814;async function kt(r,e,t){return await new Promise((o,n)=>{const a=t.createCanvasImage();if(!a)throw new Error("Failed to create ImageBitmap");a.onload=()=>{try{const h=t.createCanvas(a.width,a.height);if(!h)throw new Error("Failed to create canvas");const i=h.getContext("2d");if(!i)throw new Error("Failed to get 2D context");i.drawImage(a,0,0);const _=i.getImageData(0,0,h.width,h.height);o({bits:new Uint8Array(_.data.buffer),width:_.width})}catch(h){n(`Error loading image ${a.src} with exception: ${h}`)}},a.onerror=h=>{n(`Error loading image ${a.src} with exception: ${h}`)},a.crossOrigin="anonymous";let l;if(typeof r=="string"){if(!e)throw new Error("filename is required when using a URL");a.src=r+e}else{const h=new Blob([r],{type:"image/webp"});l=URL.createObjectURL(h),a.src=l}})}async function Us(r,e,t){const s=r.count?r.count:r.means.shape[0],o=32,n=new ArrayBuffer(o*s),a=new Float32Array(n),l=new Float32Array(n),h=new Uint8ClampedArray(n),i=new Uint8ClampedArray(n),_=c=>Math.sign(c)*(Math.exp(Math.abs(c))-1),u=e[0].bits,f=e[1].bits;if(!Array.isArray(r.means.mins)||!Array.isArray(r.means.maxs))throw new Error("Missing arrays in SOG data.");for(let c=0;c(c/255-.5)*2/Math.SQRT2,E=e[3].bits;for(let c=0;c{b({mode:0,data:n,hasVertexColors:!1,sh:y})})}return await new Promise(c=>{c({mode:0,data:n,hasVertexColors:!1})})}async function Rt(r,e,t){let s,o;if(r instanceof Map){o=r;const l=o.get("meta.json");if(!l)throw new Error("meta.json not found in files Map");s=JSON.parse(new TextDecoder().decode(l))}else s=r;const n=[...s.means.files,...s.scales.files,...s.quats.files,...s.sh0.files];s.shN&&n.push(...s.shN.files);const a=await Promise.all(n.map(async l=>{if(o&&o.has(l)){const h=o.get(l);return await kt(h,l,t.getEngine())}else return await kt(e,l,t.getEngine())}));return await Us(s,a,t)}class ee{constructor(e=ee._DefaultLoadingOptions){this.name=Re.name,this._assetContainer=null,this.extensions=Re.extensions,this._loadingOptions=e}createPlugin(e){return new ee(e[Re.name])}async importMeshAsync(e,t,s,o,n,a){return await this._parseAsync(e,t,s,o).then(l=>({meshes:l,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}))}static _BuildPointCloud(e,t){if(!t.byteLength)return!1;const s=new Uint8Array(t),o=new Float32Array(t),n=32,a=s.length/n,l=function(h,i){const _=o[8*i+0],u=o[8*i+1],f=o[8*i+2];h.position=new T(_,u,f);const p=s[n*i+24+0]/255,m=s[n*i+24+1]/255,C=s[n*i+24+2]/255;h.color=new L(p,m,C,1)};return e.addPoints(a,l),!0}static _BuildMesh(e,t){const s=new Ie("PLYMesh",e),o=new Uint8Array(t.data),n=new Float32Array(t.data),a=32,l=o.length/a,h=[],i=new Ne;for(let _=0;_"u"&&await as.LoadScriptAsync(this._loadingOptions.deflateURL??"https://unpkg.com/fflate/umd/index.js"),t=window.fflate);const{unzipSync:s}=t,o=s(e),n=new Map;for(const[a,l]of Object.entries(o))n.set(a,l);return n}_parseAsync(e,t,s,o){const n=[],a=u=>{t._blockEntityCollection=!!this._assetContainer;const f=this._loadingOptions.gaussianSplattingMesh??new D("GaussianSplatting",null,t,this._loadingOptions.keepInRam);f._parentContainer=this._assetContainer,n.push(f),f.updateData(u.data,u.sh,{flipY:!1}),f.scaling.y*=-1,f.computeWorldMatrix(!0),t._blockEntityCollection=!1};if(typeof s=="string"){const u=JSON.parse(s);if(u&&u.means&&u.scales&&u.quats&&u.sh0)return new Promise(f=>{Rt(u,o,t).then(p=>{a(p),f(n)}).catch(()=>{throw new Error("Failed to parse SOG data.")})})}const l=s instanceof ArrayBuffer?new Uint8Array(s):s;if(l[0]===80&&l[1]===75)return new Promise(u=>{this._unzipWithFFlateAsync(l).then(f=>{Rt(f,o,t).then(p=>{a(p),u(n)}).catch(()=>{throw new Error("Failed to parse SOG zip data.")})})});const h=new ReadableStream({start(u){u.enqueue(new Uint8Array(s)),u.close()}}),i=new DecompressionStream("gzip"),_=h.pipeThrough(i);return new Promise(u=>{new Response(_).arrayBuffer().then(f=>{Bs(f,t,this._loadingOptions).then(p=>{t._blockEntityCollection=!!this._assetContainer;const m=this._loadingOptions.gaussianSplattingMesh??new D("GaussianSplatting",null,t,this._loadingOptions.keepInRam);if(p.trainedWithAntialiasing){const C=m.material;C.kernelSize=.1,C.compensation=!0}m._parentContainer=this._assetContainer,n.push(m),m.updateData(p.data,p.sh,{flipY:!1}),this._loadingOptions.flipY||(m.scaling.y*=-1,m.computeWorldMatrix(!0)),t._blockEntityCollection=!1,this.applyAutoCameraLimits(p,t),u(n)})}).catch(()=>{ee._ConvertPLYToSplat(s).then(async f=>{switch(t._blockEntityCollection=!!this._assetContainer,f.mode){case 0:{const p=this._loadingOptions.gaussianSplattingMesh??new D("GaussianSplatting",null,t,this._loadingOptions.keepInRam);switch(p._parentContainer=this._assetContainer,n.push(p),p.updateData(f.data,f.sh,{flipY:!1}),p.scaling.y*=-1,f.chirality==="RightHanded"&&(p.scaling.y*=-1),f.upAxis){case"X":p.rotation=new T(0,0,Math.PI/2);break;case"Y":p.rotation=new T(0,0,Math.PI);break;case"Z":p.rotation=new T(-Math.PI/2,Math.PI,0);break}p.computeWorldMatrix(!0)}break;case 1:{const p=new Fs("PointCloud",1,t);ee._BuildPointCloud(p,f.data)?await p.buildMeshAsync().then(m=>{n.push(m)}):p.dispose()}break;case 2:if(f.faces)n.push(ee._BuildMesh(t,f));else throw new Error("PLY mesh doesn't contain face informations.");break;default:throw new Error("Unsupported Splat mode")}t._blockEntityCollection=!1,this.applyAutoCameraLimits(f,t),u(n)})})})}applyAutoCameraLimits(e,t){if(!this._loadingOptions.disableAutoCameraLimits&&(e.safeOrbitCameraRadiusMin!==void 0||e.safeOrbitCameraElevationMinMax!==void 0)&&t.activeCamera?.getClassName()==="ArcRotateCamera"){const s=t.activeCamera;e.safeOrbitCameraElevationMinMax&&(s.lowerBetaLimit=Math.PI*.5-e.safeOrbitCameraElevationMinMax[1],s.upperBetaLimit=Math.PI*.5-e.safeOrbitCameraElevationMinMax[0]),e.safeOrbitCameraRadiusMin&&(s.lowerRadiusLimit=e.safeOrbitCameraRadiusMin)}}loadAssetContainerAsync(e,t,s){const o=new cs(e);return this._assetContainer=o,this.importMeshAsync(null,e,t,s).then(n=>{for(const a of n.meshes)o.meshes.push(a);return this._assetContainer=null,o}).catch(n=>{throw this._assetContainer=null,n})}loadAsync(e,t,s){return this.importMeshAsync(null,e,t,s).then(()=>{})}static _ConvertPLYToSplat(e){const t=new Uint8Array(e),s=new TextDecoder().decode(t.slice(0,1024*10)),o=`end_header +`,n=s.indexOf(o);if(n<0||!s)return new Promise(x=>{x({mode:0,data:e,rawSplat:!0})});const a=parseInt(/element vertex (\d+)\n/.exec(s)[1]),l=/element face (\d+)\n/.exec(s);let h=0;l&&(h=parseInt(l[1]));const i=/element chunk (\d+)\n/.exec(s);let _=0;i&&(_=parseInt(i[1]));let u=0,f=0;const p={double:8,int:4,uint:4,float:4,short:2,ushort:2,uchar:1,list:0},m={Vertex:0,Chunk:1,SH:2,Float_Tuple:3,Float:4,Uchar:5};let C=m.Chunk;const E=[],c=s.slice(0,n).split(` +`),g={};for(const x of c)if(x.startsWith("property ")){const[,v,d]=x.split(" ");if(C==m.Chunk)f+=p[v];else if(C==m.Vertex)E.push({name:d,type:v,offset:u}),u+=p[v];else if(C==m.SH)E.push({name:d,type:v,offset:u});else if(C==m.Float_Tuple){const y=new DataView(e,f,p.float*2);g.safeOrbitCameraElevationMinMax=[y.getFloat32(0,!0),y.getFloat32(4,!0)]}else if(C==m.Float){const y=new DataView(e,f,p.float);g.safeOrbitCameraRadiusMin=y.getFloat32(0,!0)}else if(C==m.Uchar){const y=new DataView(e,f,p.uchar);d=="up_axis"?g.upAxis=y.getUint8(0)==0?"X":y.getUint8(0)==1?"Y":"Z":d=="chirality"&&(g.chirality=y.getUint8(0)==0?"LeftHanded":"RightHanded")}p[v]||de.Warn(`Unsupported property type: ${v}.`)}else if(x.startsWith("element ")){const[,v]=x.split(" ");v=="chunk"?C=m.Chunk:v=="vertex"?C=m.Vertex:v=="sh"?C=m.SH:v=="safe_orbit_camera_elevation_min_max_radians"?C=m.Float_Tuple:v=="safe_orbit_camera_radius_min"?C=m.Float:(v=="up_axis"||v=="chirality")&&(C=m.Uchar)}const S=u,w=f;return D.ConvertPLYWithSHToSplatAsync(e).then(async x=>{const v=new DataView(e,n+o.length);let d=w*_+S*a;const y=[];if(h)for(let z=0;z{z({mode:0,data:x.buffer,sh:x.sh,faces:y,hasVertexColors:!1,compressed:!0,rawSplat:!1})});let A=0,H=0;const B=["x","y","z","scale_0","scale_1","scale_2","opacity","rot_0","rot_1","rot_2","rot_3"],b=["red","green","blue","f_dc_0","f_dc_1","f_dc_2"];for(let z=0;z{z({...g,mode:W,data:x.buffer,sh:x.sh,faces:y,hasVertexColors:!!H,compressed:!1,rawSplat:!1})})})}}ee._DefaultLoadingOptions={keepInRam:!1,flipY:!1};is(new ee);export{ee as SPLATFileLoader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/sql-D0XecflT.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/sql-D0XecflT.js new file mode 100644 index 0000000000000000000000000000000000000000..c7ae761bee67028bc268685ca88c7d20ae248577 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/sql-D0XecflT.js @@ -0,0 +1 @@ +function s(a){var c=a.client||{},h=a.atoms||{false:!0,true:!0,null:!0},p=a.builtin||e(z),S=a.keywords||e(d),_=a.operatorChars||/^[*+\-%<>!=&|~^\/]/,o=a.support||{},y=a.hooks||{},C=a.dateSQL||{date:!0,time:!0,timestamp:!0},Q=a.backslashStringEscapes!==!1,j=a.brackets||/^[\{}\(\)\[\]]/,v=a.punctuation||/^[;.,:]/;function g(t,i){var r=t.next();if(y[r]){var n=y[r](t,i);if(n!==!1)return n}if(o.hexNumber&&(r=="0"&&t.match(/^[xX][0-9a-fA-F]+/)||(r=="x"||r=="X")&&t.match(/^'[0-9a-fA-F]*'/)))return"number";if(o.binaryNumber&&((r=="b"||r=="B")&&t.match(/^'[01]+'/)||r=="0"&&t.match(/^b[01]*/)))return"number";if(r.charCodeAt(0)>47&&r.charCodeAt(0)<58)return t.match(/^[0-9]*(\.[0-9]+)?([eE][-+]?[0-9]+)?/),o.decimallessFloat&&t.match(/^\.(?!\.)/),"number";if(r=="?"&&(t.eatSpace()||t.eol()||t.eat(";")))return"macroName";if(r=="'"||r=='"'&&o.doubleQuote)return i.tokenize=x(r),i.tokenize(t,i);if((o.nCharCast&&(r=="n"||r=="N")||o.charsetCast&&r=="_"&&t.match(/[a-z][a-z0-9]*/i))&&(t.peek()=="'"||t.peek()=='"'))return"keyword";if(o.escapeConstant&&(r=="e"||r=="E")&&(t.peek()=="'"||t.peek()=='"'&&o.doubleQuote))return i.tokenize=function(m,k){return(k.tokenize=x(m.next(),!0))(m,k)},"keyword";if(o.commentSlashSlash&&r=="/"&&t.eat("/"))return t.skipToEnd(),"comment";if(o.commentHash&&r=="#"||r=="-"&&t.eat("-")&&(!o.commentSpaceRequired||t.eat(" ")))return t.skipToEnd(),"comment";if(r=="/"&&t.eat("*"))return i.tokenize=b(1),i.tokenize(t,i);if(r=="."){if(o.zerolessFloat&&t.match(/^(?:\d+(?:e[+-]?\d+)?)/i))return"number";if(t.match(/^\.+/))return null;if(o.ODBCdotTable&&t.match(/^[\w\d_$#]+/))return"type"}else{if(_.test(r))return t.eatWhile(_),"operator";if(j.test(r))return"bracket";if(v.test(r))return t.eatWhile(v),"punctuation";if(r=="{"&&(t.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||t.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";t.eatWhile(/^[_\w\d]/);var l=t.current().toLowerCase();return C.hasOwnProperty(l)&&(t.match(/^( )+'[^']*'/)||t.match(/^( )+"[^"]*"/))?"number":h.hasOwnProperty(l)?"atom":p.hasOwnProperty(l)?"type":S.hasOwnProperty(l)?"keyword":c.hasOwnProperty(l)?"builtin":null}}function x(t,i){return function(r,n){for(var l=!1,m;(m=r.next())!=null;){if(m==t&&!l){n.tokenize=g;break}l=(Q||i)&&!l&&m=="\\"}return"string"}}function b(t){return function(i,r){var n=i.match(/^.*?(\/\*|\*\/)/);return n?n[1]=="/*"?r.tokenize=b(t+1):t>1?r.tokenize=b(t-1):r.tokenize=g:i.skipToEnd(),"comment"}}function w(t,i,r){i.context={prev:i.context,indent:t.indentation(),col:t.column(),type:r}}function L(t){t.indent=t.context.indent,t.context=t.context.prev}return{name:"sql",startState:function(){return{tokenize:g,context:null}},token:function(t,i){if(t.sol()&&i.context&&i.context.align==null&&(i.context.align=!1),i.tokenize==g&&t.eatSpace())return null;var r=i.tokenize(t,i);if(r=="comment")return r;i.context&&i.context.align==null&&(i.context.align=!0);var n=t.current();return n=="("?w(t,i,")"):n=="["?w(t,i,"]"):i.context&&i.context.type==n&&L(i),r},indent:function(t,i,r){var n=t.context;if(!n)return null;var l=i.charAt(0)==n.type;return n.align?n.col+(l?0:1):n.indent+(l?0:r.unit)},languageData:{commentTokens:{line:o.commentSlashSlash?"//":o.commentHash?"#":"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}}}function f(a){for(var c;(c=a.next())!=null;)if(c=="`"&&!a.eat("`"))return"string.special";return a.backUp(a.current().length-1),a.eatWhile(/\w/)?"string.special":null}function N(a){for(var c;(c=a.next())!=null;)if(c=='"'&&!a.eat('"'))return"string.special";return a.backUp(a.current().length-1),a.eatWhile(/\w/)?"string.special":null}function u(a){return a.eat("@")&&(a.match("session."),a.match("local."),a.match("global.")),a.eat("'")?(a.match(/^.*'/),"string.special"):a.eat('"')?(a.match(/^.*"/),"string.special"):a.eat("`")?(a.match(/^.*`/),"string.special"):a.match(/^[0-9a-zA-Z$\.\_]+/)?"string.special":null}function q(a){return a.eat("N")?"atom":a.match(/^[a-zA-Z.#!?]/)?"string.special":null}var d="alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit ";function e(a){for(var c={},h=a.split(" "),p=0;p!=^\&|\/]/,brackets:/^[\{}\(\)]/,punctuation:/^[;.,:/]/,backslashStringEscapes:!1,dateSQL:e("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":u}}),B=s({client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(d+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":u,"`":f,"\\":q}}),D=s({client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(d+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group group_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":u,"`":f,"\\":q}}),O=s({client:e("auth backup bail binary changes check clone databases dbinfo dump echo eqp exit explain fullschema headers help import imposter indexes iotrace limit lint load log mode nullvalue once open output print prompt quit read restore save scanstats schema separator session shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width"),keywords:e(d+"abort action add after all analyze attach autoincrement before begin cascade case cast check collate column commit conflict constraint cross current_date current_time current_timestamp database default deferrable deferred detach each else end escape except exclusive exists explain fail for foreign full glob if ignore immediate index indexed initially inner instead intersect isnull key left limit match natural no notnull null of offset outer plan pragma primary query raise recursive references regexp reindex release rename replace restrict right rollback row savepoint temp temporary then to transaction trigger unique using vacuum view virtual when with without"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text clob bigint int int2 int8 integer float double char varchar date datetime year unsigned signed numeric real"),atoms:e("null current_date current_time current_timestamp"),operatorChars:/^[*+\-%<>!=&|/~]/,dateSQL:e("date time timestamp datetime"),support:e("decimallessFloat zerolessFloat"),hooks:{"@":u,":":u,"?":u,$:u,'"':N,"`":f}}),$=s({client:{},keywords:e("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:e("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:e("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:e("commentSlashSlash decimallessFloat"),hooks:{}}),E=s({client:e("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:e("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:e("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*\/+\-%<>!=~]/,dateSQL:e("date time timestamp"),support:e("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),A=s({keywords:e("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with admin authorization char compact compactions conf cube current current_date current_timestamp day decimal defined dependency directories elem_type exchange file following for grouping hour ignore inner interval jar less logical macro minute month more none noscan over owner partialscan preceding pretty principals protection reload rewrite role roles rollup rows second server sets skewed transactions truncate unbounded unset uri user values window year"),builtin:e("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype key_type utctimestamp value_type varchar"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:e("date timestamp"),support:e("ODBCdotTable doubleQuote binaryNumber hexNumber")}),P=s({client:e("source"),keywords:e(d+"a abort abs absent absolute access according action ada add admin after aggregate alias all allocate also alter always analyse analyze and any are array array_agg array_max_cardinality as asc asensitive assert assertion assignment asymmetric at atomic attach attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli between bigint binary bit bit_length blob blocked bom boolean both breadth by c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain char char_length character character_length character_set_catalog character_set_name character_set_schema characteristics characters check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column column_name columns command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constant constraint constraint_catalog constraint_name constraint_schema constraints constructor contains content continue control conversion convert copy corr corresponding cost count covar_pop covar_samp create cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datatype date datetime_interval_code datetime_interval_precision day db deallocate debug dec decimal declare default defaults deferrable deferred defined definer degree delete delimiter delimiters dense_rank depends depth deref derived desc describe descriptor detach detail deterministic diagnostics dictionary disable discard disconnect dispatch distinct dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain double drop dump dynamic dynamic_function dynamic_function_code each element else elseif elsif empty enable encoding encrypted end end_frame end_partition endexec enforced enum equals errcode error escape event every except exception exclude excluding exclusive exec execute exists exit exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreach foreign fortran forward found frame_row free freeze from fs full function functions fusion g general generated get global go goto grant granted greatest group grouping groups handler having header hex hierarchy hint hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import in include including increment indent index indexes indicator info inherit inherits initially inline inner inout input insensitive insert instance instantiable instead int integer integrity intersect intersection interval into invoker is isnull isolation join k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like like_regex limit link listen ln load local localtime localtimestamp location locator lock locked log logged loop lower m map mapping match matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized not nothing notice notify notnull nowait nth_value ntile null nullable nullif nulls number numeric object occurrences_regex octet_length octets of off offset oids old on only open operator option options or order ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parallel parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password path percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding precision prepare prepared preserve primary print_strict_params prior privileges procedural procedure procedures program public publication query quote raise range rank read reads real reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result result_oid return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns reverse revoke right role rollback rollup routine routine_catalog routine_name routine_schema routines row row_count row_number rows rowtype rule savepoint scale schema schema_name schemas scope scope_catalog scope_name scope_schema scroll search second section security select selective self sensitive sequence sequences serializable server server_name session session_user set setof sets share show similar simple size skip slice smallint snapshot some source space specific specific_name specifictype sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable stacked standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time system_user t table table_name tables tablesample tablespace temp template temporary text then ties time timestamp timezone_hour timezone_minute to token top_level_count trailing transaction transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted union unique unknown unlink unlisten unlogged unnamed unnest until untyped update upper uri usage use_column use_variable user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of values var_pop var_samp varbinary varchar variable_conflict variadic varying verbose version versioning view views volatile warning when whenever where while whitespace width_bucket window with within without work wrapper write xml xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes zone"),builtin:e("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:e("false true null unknown"),operatorChars:/^[*\/+\-%<>!=&|^\/#@?~]/,backslashStringEscapes:!1,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast escapeConstant")}),W=s({keywords:e("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),atoms:e("false true"),builtin:e("blob datetime first key __key__ string integer double boolean null"),operatorChars:/^[*+\-%<>!=]/}),H=s({client:e("source"),keywords:e("abort absolute access action active add admin after aggregate all also alter always analyse analyze and any array as asc assertion assignment asymmetric at authorization backward before begin between bigint binary bit boolean both by cache called cascade cascaded case cast chain char character characteristics check checkpoint class close cluster coalesce codegen collate column comment commit committed concurrency concurrently configuration connection constraint constraints contains content continue conversion copy cost cpu_rate_limit create createdb createexttable createrole createuser cross csv cube current current_catalog current_date current_role current_schema current_time current_timestamp current_user cursor cycle data database day deallocate dec decimal declare decode default defaults deferrable deferred definer delete delimiter delimiters deny desc dictionary disable discard distinct distributed do document domain double drop dxl each else enable encoding encrypted end enum errors escape every except exchange exclude excluding exclusive execute exists explain extension external extract false family fetch fields filespace fill filter first float following for force foreign format forward freeze from full function global grant granted greatest group group_id grouping handler hash having header hold host hour identity if ignore ilike immediate immutable implicit in including inclusive increment index indexes inherit inherits initially inline inner inout input insensitive insert instead int integer intersect interval into invoker is isnull isolation join key language large last leading least left level like limit list listen load local localtime localtimestamp location lock log login mapping master match maxvalue median merge minute minvalue missing mode modifies modify month move name names national natural nchar new newline next no nocreatedb nocreateexttable nocreaterole nocreateuser noinherit nologin none noovercommit nosuperuser not nothing notify notnull nowait null nullif nulls numeric object of off offset oids old on only operator option options or order ordered others out outer over overcommit overlaps overlay owned owner parser partial partition partitions passing password percent percentile_cont percentile_disc placing plans position preceding precision prepare prepared preserve primary prior privileges procedural procedure protocol queue quote randomly range read readable reads real reassign recheck recursive ref references reindex reject relative release rename repeatable replace replica reset resource restart restrict returning returns revoke right role rollback rollup rootpartition row rows rule savepoint scatter schema scroll search second security segment select sequence serializable session session_user set setof sets share show similar simple smallint some split sql stable standalone start statement statistics stdin stdout storage strict strip subpartition subpartitions substring superuser symmetric sysid system table tablespace temp template temporary text then threshold ties time timestamp to trailing transaction treat trigger trim true truncate trusted type unbounded uncommitted unencrypted union unique unknown unlisten until update user using vacuum valid validation validator value values varchar variadic varying verbose version view volatile web when where whitespace window with within without work writable write xml xmlattributes xmlconcat xmlelement xmlexists xmlforest xmlparse xmlpi xmlroot xmlserialize year yes zone"),builtin:e("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")}),R=s({keywords:e("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases data dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"),builtin:e("tinyint smallint int bigint boolean float double string binary timestamp decimal array map struct uniontype delimited serde sequencefile textfile rcfile inputformat outputformat"),atoms:e("false true null"),operatorChars:/^[*\/+\-%<>!=~&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable doubleQuote zerolessFloat")}),I=s({client:e("source"),keywords:e("alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit after all and as at asc avedev avg between by case cast coalesce count create current_timestamp day days delete define desc distinct else end escape events every exists false first from full group having hour hours in inner insert instanceof into irstream is istream join last lastweekday left limit like max match_recognize matches median measures metadatasql min minute minutes msec millisecond milliseconds not null offset on or order outer output partition pattern prev prior regexp retain-union retain-intersection right rstream sec second seconds select set some snapshot sql stddev sum then true unidirectional until update variable weekday when where window"),builtin:{},atoms:e("false true null"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:e("time"),support:e("decimallessFloat zerolessFloat binaryNumber hexNumber")});export{$ as cassandra,I as esper,H as gpSQL,W as gql,A as hive,D as mariaDB,T as msSQL,B as mySQL,P as pgSQL,E as plSQL,R as sparkSQL,s as sql,O as sqlite,F as standardSQL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ssao2.fragment-5fCBoS27.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ssao2.fragment-5fCBoS27.js new file mode 100644 index 0000000000000000000000000000000000000000..2e5f4f73b60a2c1fbaf10630dc3fd6caf78e5c2e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ssao2.fragment-5fCBoS27.js @@ -0,0 +1,68 @@ +import{S as t}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="ssao2PixelShader",o=`precision highp float;uniform sampler2D textureSampler;varying vec2 vUV; +#ifdef SSAO +float scales[16]=float[16]( +0.1, +0.11406250000000001, +0.131640625, +0.15625, +0.187890625, +0.2265625, +0.272265625, +0.325, +0.384765625, +0.4515625, +0.525390625, +0.60625, +0.694140625, +0.7890625, +0.891015625, +1.0 +);uniform float near;uniform float radius;uniform sampler2D depthSampler;uniform sampler2D randomSampler;uniform sampler2D normalSampler;uniform float randTextureTiles;uniform float samplesFactor;uniform vec3 sampleSphere[SAMPLES];uniform float totalStrength;uniform float base; +#ifdef ORTHOGRAPHIC_CAMERA +uniform vec4 viewport; +#else +uniform float xViewport;uniform float yViewport; +#endif +uniform mat3 depthProjection;uniform float maxZ;uniform float minZAspect;uniform vec2 texelSize;uniform mat4 projection;void main() +{vec3 random=textureLod(randomSampler,vUV*randTextureTiles,0.0).rgb;float depth=textureLod(depthSampler,vUV,0.0).r;float depthSign=sign(depth);depth=depth*depthSign;vec3 normal=textureLod(normalSampler,vUV,0.0).rgb;float occlusion=0.0;float correctedRadius=min(radius,minZAspect*depth/near); +#ifdef ORTHOGRAPHIC_CAMERA +vec3 vViewRay=vec3(mix(viewport.x,viewport.y,vUV.x),mix(viewport.z,viewport.w,vUV.y),depthSign); +#else +vec3 vViewRay=vec3((vUV.x*2.0-1.0)*xViewport,(vUV.y*2.0-1.0)*yViewport,depthSign); +#endif +vec3 vDepthFactor=depthProjection*vec3(1.0,1.0,depth);vec3 origin=vViewRay*vDepthFactor;vec3 rvec=random*2.0-1.0;rvec.z=0.0;float dotProduct=dot(rvec,normal);rvec=1.0-abs(dotProduct)>1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);vec3 tangent=normalize(rvec-normal*dot(rvec,normal));vec3 bitangent=cross(normal,tangent);mat3 tbn=mat3(tangent,bitangent,normal);float difference;for (int i=0; i1.0 || offset.y>1.0) {continue;} +float sampleDepth=abs(textureLod(depthSampler,offset.xy,0.0).r);difference=depthSign*samplePosition.z-sampleDepth;float rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);occlusion+=step(EPSILON,difference)*rangeCheck;} +occlusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));float ao=1.0-totalStrength*occlusion*samplesFactor;float result=clamp(ao+base,0.0,1.0);gl_FragColor=vec4(vec3(result),1.0);} +#endif +#ifdef BLUR +uniform float outSize;uniform float soften;uniform float tolerance;uniform int samples; +#ifndef BLUR_BYPASS +uniform sampler2D depthSampler; +#ifdef BLUR_LEGACY +#define inline +float blur13Bilateral(sampler2D image,vec2 uv,vec2 step) {float result=0.0;vec2 off1=vec2(1.411764705882353)*step;vec2 off2=vec2(3.2941176470588234)*step;vec2 off3=vec2(5.176470588235294)*step;float compareDepth=abs(textureLod(depthSampler,uv,0.0).r);float sampleDepth;float weight;float weightSum=30.0;result+=textureLod(image,uv,0.0).r*30.0;sampleDepth=abs(textureLod(depthSampler,uv+off1,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+= weight;result+=textureLod(image,uv+off1,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv-off1,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+= weight;result+=textureLod(image,uv-off1,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv+off2,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureLod(image,uv+off2,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv-off2,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureLod(image,uv-off2,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv+off3,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureLod(image,uv+off3,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv-off3,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureLod(image,uv-off3,0.0).r*weight;return result/weightSum;} +#endif +#endif +void main() +{float result=0.0; +#ifdef BLUR_BYPASS +result=textureLod(textureSampler,vUV,0.0).r; +#else +#ifdef BLUR_H +vec2 step=vec2(1.0/outSize,0.0); +#else +vec2 step=vec2(0.0,1.0/outSize); +#endif +#ifdef BLUR_LEGACY +result=blur13Bilateral(textureSampler,vUV,step); +#else +float compareDepth=abs(textureLod(depthSampler,vUV,0.0).r);float weightSum=0.0;for (int i=-samples; i; +#ifdef SSAO +const scales: array=array( +0.1, +0.11406250000000001, +0.131640625, +0.15625, +0.187890625, +0.2265625, +0.272265625, +0.325, +0.384765625, +0.4515625, +0.525390625, +0.60625, +0.694140625, +0.7890625, +0.891015625, +1.0 +);uniform near: f32;uniform radius: f32;var depthSamplerSampler: sampler;var depthSampler: texture_2d;var randomSamplerSampler: sampler;var randomSampler: texture_2d;var normalSamplerSampler: sampler;var normalSampler: texture_2d;uniform randTextureTiles: f32;uniform samplesFactor: f32;uniform sampleSphere: array;uniform totalStrength: f32;uniform base: f32; +#ifdef ORTHOGRAPHIC_CAMERA +uniform viewport: vec4f; +#else +uniform xViewport: f32;uniform yViewport: f32; +#endif +uniform depthProjection: mat3x3f;uniform maxZ: f32;uniform minZAspect: f32;uniform texelSize: vec2f;uniform projection: mat4x4f;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var random: vec3f=textureSampleLevel(randomSampler,randomSamplerSampler,input.vUV*uniforms.randTextureTiles,0.0).rgb;var depth: f32=textureSampleLevel(depthSampler,depthSamplerSampler,input.vUV,0.0).r;var depthSign: f32=sign(depth);depth=depth*depthSign;var normal: vec3f=textureSampleLevel(normalSampler,normalSamplerSampler,input.vUV,0.0).rgb;var occlusion: f32=0.0;var correctedRadius: f32=min(uniforms.radius,uniforms.minZAspect*depth/uniforms.near); +#ifdef ORTHOGRAPHIC_CAMERA +var vViewRay: vec3f= vec3f(mix(uniforms.viewport.x,uniforms.viewport.y,input.vUV.x),mix(uniforms.viewport.z,uniforms.viewport.w,input.vUV.y),depthSign); +#else +var vViewRay: vec3f= vec3f((input.vUV.x*2.0-1.0)*uniforms.xViewport,(input.vUV.y*2.0-1.0)*uniforms.yViewport,depthSign); +#endif +var vDepthFactor: vec3f=uniforms.depthProjection* vec3f(1.0,1.0,depth);var origin: vec3f=vViewRay*vDepthFactor;var rvec: vec3f=random*2.0-1.0;rvec.z=0.0;var dotProduct: f32=dot(rvec,normal);rvec=select( vec3f(-rvec.y,0.0,rvec.x),rvec,1.0-abs(dotProduct)>1e-2);var tangent: vec3f=normalize(rvec-normal*dot(rvec,normal));var bitangent: vec3f=cross(normal,tangent);var tbn: mat3x3f= mat3x3f(tangent,bitangent,normal);var difference: f32;for (var i: i32=0; i1.0 || offset.y>1.0) {continue;} +var sampleDepth: f32=abs(textureSampleLevel(depthSampler,depthSamplerSampler,offset.xy,0.0).r);difference=depthSign*samplePosition.z-sampleDepth;var rangeCheck: f32=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);occlusion+=step(EPSILON,difference)*rangeCheck;} +occlusion=occlusion*(1.0-smoothstep(uniforms.maxZ*0.75,uniforms.maxZ,depth));var ao: f32=1.0-uniforms.totalStrength*occlusion*uniforms.samplesFactor;var result: f32=clamp(ao+uniforms.base,0.0,1.0);fragmentOutputs.color= vec4f( vec3f(result),1.0);} +#else +#ifdef BLUR +uniform outSize: f32;uniform soften: f32;uniform tolerance: f32;uniform samples: i32; +#ifndef BLUR_BYPASS +var depthSamplerSampler: sampler;var depthSampler: texture_2d; +#ifdef BLUR_LEGACY +fn blur13Bilateral(image: texture_2d,imageSampler: sampler,uv: vec2f,step: vec2f)->f32 {var result: f32=0.0;var off1: vec2f= vec2f(1.411764705882353)*step;var off2: vec2f= vec2f(3.2941176470588234)*step;var off3: vec2f= vec2f(5.176470588235294)*step;var compareDepth: f32=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv,0.0).r);var sampleDepth: f32;var weight: f32;var weightSum: f32=30.0;result+=textureSampleLevel(image,imageSampler,uv,0.0).r*30.0;sampleDepth=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv+off1,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+= weight;result+=textureSampleLevel(image,imageSampler,uv+off1,0.0).r*weight;sampleDepth=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv-off1,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+= weight;result+=textureSampleLevel(image,imageSampler,uv-off1,0.0).r*weight;sampleDepth=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv+off2,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureSampleLevel(image,imageSampler,uv+off2,0.0).r*weight;sampleDepth=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv-off2,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureSampleLevel(image,imageSampler,uv-off2,0.0).r*weight;sampleDepth=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv+off3,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureSampleLevel(image,imageSampler,uv+off3,0.0).r*weight;sampleDepth=abs(textureSampleLevel(depthSampler,depthSamplerSampler,uv-off3,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureSampleLevel(image,imageSampler,uv-off3,0.0).r*weight;return result/weightSum;} +#endif +#endif +@fragment +fn main(input: FragmentInputs)->FragmentOutputs {var result: f32=0.0; +#ifdef BLUR_BYPASS +result=textureSampleLevel(textureSampler,textureSamplerSampler,input.vUV,0.0).r; +#else +#ifdef BLUR_H +var step: vec2f= vec2f(1.0/uniforms.outSize,0.0); +#else +var step: vec2f= vec2f(0.0,1.0/uniforms.outSize); +#endif +#ifdef BLUR_LEGACY +result=blur13Bilateral(textureSampler,textureSamplerSampler,input.vUV,step); +#else +var compareDepth: f32=abs(textureSampleLevel(depthSampler,depthSamplerSampler,input.vUV,0.0).r);var weightSum: f32=0.0;for (var i: i32=-uniforms.samples; ii.map(i=>d[i]); +import{aE as b,b1 as f,bA as x,T as R,V as C,ah as T,bn as E,c as B,aq as w,L as g,bB as F,aA as S,e as A,_ as n,s as a,R as I}from"./index-CDrXokXW.js";import{P as v,a as d}from"./postProcessRenderEffect-Bq4hKPLg.js";import{G as V}from"./geometryBufferRenderer-GNaIIBSt.js";import"./postProcessRenderPipelineManagerSceneComponent-SOlAp6R6.js";import{af as P}from"./index-DWyDLubb.js";import{R as H}from"./rawTexture-DYLCXHMF.js";import"./clipPlaneFragment-T8W7CIC5.js";import"./bumpFragment-CNMCo4HD.js";import"./helperFunctions-BkWNqKeI.js";import"./bakedVertexAnimation-BwUJBnNt.js";import"./morphTargetsVertex-7Q90Wwr8.js";import"./instancesDeclaration-BAnfKLCo.js";import"./sceneUboDeclaration-C4vXUqkq.js";import"./clipPlaneVertex-Bmw4TNCQ.js";import"./bumpVertex-B5e3s1jQ.js";class M{constructor(){this.enabled=!1,this.name="ssao2",this.texturesRequired=[6,5]}}class l extends b{_gatherImports(e,t){e?(this._webGPUReady=!0,t.push(P(()=>import("./ssao2.fragment-cv7-JONb.js"),__vite__mapDeps([0,1,2,3]),import.meta.url))):t.push(P(()=>import("./ssao2.fragment-5fCBoS27.js"),__vite__mapDeps([4,1,2,3]),import.meta.url))}get textureWidth(){return this._textureWidth}set textureWidth(e){this._textureWidth!==e&&(this._textureWidth=e)}get textureHeight(){return this._textureHeight}set textureHeight(e){this._textureHeight!==e&&(this._textureHeight=e)}set samples(e){this._samples=e,this.updateEffect(),this._sampleSphere=this._generateHemisphere()}get samples(){return this._samples}set epsilon(e){this._epsilon=e,this.updateEffect()}get epsilon(){return this._epsilon}updateEffect(){super.updateEffect(this._getDefinesForSSAO())}constructor(e,t,s){super({...s,name:e,engine:t.getEngine(),useShaderStore:!0,useAsPostProcess:!0,fragmentShader:l.FragmentUrl,uniforms:l.Uniforms,samplers:l.Samplers,defines:`#define SSAO +#define SAMPLES 8 +#define EPSILON 0.0001`,shaderLanguage:t.getEngine().isWebGPU?1:0}),this.camera=null,this._textureWidth=0,this._textureHeight=0,this._samples=8,this.totalStrength=1,this.radius=2,this.maxZ=100,this.minZAspect=.2,this.base=0,this._epsilon=.02,this._bits=new Uint32Array(1),this._scene=t,this._createRandomTexture(),this.updateEffect(),this._sampleSphere=this._generateHemisphere()}bind(e=!1){super.bind(e);const t=this._drawWrapper.effect,s=this.camera;if(!s)return;const r=s.getProjectionMatrix();if(t.setArray3("sampleSphere",this._sampleSphere),t.setFloat("randTextureTiles",32),t.setFloat("samplesFactor",1/this.samples),t.setFloat("totalStrength",this.totalStrength),t.setFloat2("texelSize",1/this.textureWidth,1/this.textureHeight),t.setFloat("radius",this.radius),t.setFloat("maxZ",this.maxZ),t.setFloat("minZAspect",this.minZAspect),t.setFloat("base",this.base),t.setFloat("near",s.minZ),s.mode===f.PERSPECTIVE_CAMERA){t.setMatrix3x3("depthProjection",l.PERSPECTIVE_DEPTH_PROJECTION);const i=Math.tan(s.fov/2);s.fovMode===f.FOVMODE_VERTICAL_FIXED?(t.setFloat("xViewport",i*this._scene.getEngine().getAspectRatio(s,!0)),t.setFloat("yViewport",i)):(t.setFloat("xViewport",i),t.setFloat("yViewport",i/this._scene.getEngine().getAspectRatio(s,!0)))}else{const i=this._scene.getEngine().getRenderWidth()/2,h=this._scene.getEngine().getRenderHeight()/2,m=s.orthoLeft??-i,u=s.orthoRight??i,_=s.orthoBottom??-h,y=s.orthoTop??h;t.setMatrix3x3("depthProjection",l.ORTHO_DEPTH_PROJECTION),t.setFloat4("viewport",m,u,_,y)}t.setMatrix("projection",r),t.setTexture("randomSampler",this._randomTexture)}dispose(){this._randomTexture.dispose(),super.dispose()}_createRandomTexture(){const t=new Uint8Array(65536),s=T.Zero();for(let i=0;i>16)>>>0,this._bits[0]=(this._bits[0]&1431655765)<<1|(this._bits[0]&2863311530)>>>1>>>0,this._bits[0]=(this._bits[0]&858993459)<<2|(this._bits[0]&3435973836)>>>2>>>0,this._bits[0]=(this._bits[0]&252645135)<<4|(this._bits[0]&4042322160)>>>4>>>0,this._bits[0]=(this._bits[0]&16711935)<<8|(this._bits[0]&4278255360)>>>8>>>0,this._bits[0]*23283064365386963e-26}_hammersley(e,t){return[e/t,this._radicalInverseVdC(e)]}_hemisphereSampleUniform(e,t){const s=t*2*Math.PI,r=1-e*.85,i=Math.sqrt(1-r*r);return new C(Math.cos(s)*i,Math.sin(s)*i,r)}_generateHemisphere(){const e=this.samples,t=[];let s,r=0;for(;rimport("./ssao2.fragment-cv7-JONb.js"),__vite__mapDeps([0,1,2,3]),import.meta.url))):t.push(P(()=>import("./ssao2.fragment-5fCBoS27.js"),__vite__mapDeps([4,1,2,3]),import.meta.url))}constructor(e,t=null,s,r){super({...r,name:e,engine:t||E.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:p.FragmentUrl,uniforms:p.Uniforms,samplers:p.Samplers,defines:`#define BLUR +`+(s?`#define BLUR_H +`:"")}),this._bypassBlur=!1,this.textureSize=0,this.bilateralSamples=16,this.bilateralSoften=0,this.bilateralTolerance=0,this._expensiveBlur=!0,this._isHorizontal=s;const i=this._getDefinesForBlur(this.expensiveBlur,this.bypassBlur),h=this._getSamplersForBlur(this.bypassBlur);this.updateEffect(i,null,h)}set bypassBlur(e){const t=this._getDefinesForBlur(this.expensiveBlur,e),s=this._getSamplersForBlur(e);this.updateEffect(t,null,s),this._bypassBlur=e}get bypassBlur(){return this._bypassBlur}set expensiveBlur(e){const t=this._getDefinesForBlur(e,this._bypassBlur);this.updateEffect(t),this._expensiveBlur=e}get expensiveBlur(){return this._expensiveBlur}bind(e=!1){super.bind(e);const t=this._drawWrapper.effect;t.setFloat("outSize",this.textureSize),t.setInt("samples",this.bilateralSamples),t.setFloat("soften",this.bilateralSoften),t.setFloat("tolerance",this.bilateralTolerance)}_getSamplersForBlur(e){return e?["textureSampler"]:["textureSampler","depthSampler"]}_getDefinesForBlur(e,t){let s=`#define BLUR +`;return t&&(s+=`#define BLUR_BYPASS +`),e||(s+=`#define BLUR_LEGACY +`),this._isHorizontal?s+`#define BLUR_H +`:s}}p.FragmentUrl="ssao2";p.Uniforms=["outSize","samples","soften","tolerance"];p.Samplers=["textureSampler","depthSampler"];class c extends b{_gatherImports(e,t){e?(this._webGPUReady=!0,t.push(P(()=>import("./ssaoCombine.fragment-CEUhl1QS.js"),__vite__mapDeps([5,1,2,3]),import.meta.url))):t.push(P(()=>import("./ssaoCombine.fragment-Cs-Fcqg-.js"),__vite__mapDeps([6,1,2,3]),import.meta.url))}constructor(e,t=null,s){super({...s,name:e,engine:t||E.LastCreatedEngine,useShaderStore:!0,useAsPostProcess:!0,fragmentShader:c.FragmentUrl,uniforms:c.Uniforms,samplers:c.Samplers}),this.camera=null,this.useViewportInCombineStage=!0}bind(e=!1){super.bind(e);const t=this._drawWrapper.effect;if(this.camera){const s=this.camera.viewport;this.useViewportInCombineStage?t.setVector4("viewport",B.Vector4[0].copyFromFloats(s.x,s.y,s.width,s.height)):t.setVector4("viewport",B.Vector4[0].copyFromFloats(0,0,1,1))}}}c.FragmentUrl="ssaoCombine";c.Uniforms=["viewport"];c.Samplers=["originalColor"];class U{get camera(){return this._ssaoPostProcess.camera}set camera(e){this._ssaoPostProcess.camera=e,this._ssaoCombinePostProcess.camera=e}set samples(e){this._ssaoPostProcess.samples=e}get samples(){return this._ssaoPostProcess.samples}get totalStrength(){return this._ssaoPostProcess.totalStrength}set totalStrength(e){this._ssaoPostProcess.totalStrength=e}get radius(){return this._ssaoPostProcess.radius}set radius(e){this._ssaoPostProcess.radius=e}get maxZ(){return this._ssaoPostProcess.maxZ}set maxZ(e){this._ssaoPostProcess.maxZ=e}get minZAspect(){return this._ssaoPostProcess.minZAspect}set minZAspect(e){this._ssaoPostProcess.minZAspect=e}get base(){return this._ssaoPostProcess.base}set base(e){this._ssaoPostProcess.base=e}get epsilon(){return this._ssaoPostProcess.epsilon}set epsilon(e){this._ssaoPostProcess.epsilon=e}set bypassBlur(e){this._ssaoBlurXPostProcess.bypassBlur=e,this._ssaoBlurYPostProcess.bypassBlur=e}get bypassBlur(){return this._ssaoBlurXPostProcess.bypassBlur}set expensiveBlur(e){this._ssaoBlurXPostProcess.expensiveBlur=e,this._ssaoBlurYPostProcess.expensiveBlur=e}get expensiveBlur(){return this._ssaoBlurXPostProcess.expensiveBlur}get bilateralSamples(){return this._ssaoBlurXPostProcess.bilateralSamples}set bilateralSamples(e){this._ssaoBlurXPostProcess.bilateralSamples=e,this._ssaoBlurYPostProcess.bilateralSamples=e}get bilateralSoften(){return this._ssaoBlurXPostProcess.bilateralSoften}set bilateralSoften(e){this._ssaoBlurXPostProcess.bilateralSoften=e,this._ssaoBlurYPostProcess.bilateralSoften=e}get bilateralTolerance(){return this._ssaoBlurXPostProcess.bilateralTolerance}set bilateralTolerance(e){this._ssaoBlurXPostProcess.bilateralTolerance=e,this._ssaoBlurYPostProcess.bilateralTolerance=e}get useViewportInCombineStage(){return this._ssaoCombinePostProcess.useViewportInCombineStage}set useViewportInCombineStage(e){this._ssaoCombinePostProcess.useViewportInCombineStage=e}isReady(){return this._ssaoPostProcess.isReady()&&this._ssaoBlurXPostProcess.isReady()&&this._ssaoBlurYPostProcess.isReady()&&this._ssaoCombinePostProcess.isReady()}constructor(e,t){this.name=e,this._scene=t,this._ssaoPostProcess=new l(this.name,this._scene),this._ssaoBlurXPostProcess=new p(this.name+" BlurX",this._scene.getEngine(),!0),this._ssaoBlurYPostProcess=new p(this.name+" BlurY",this._scene.getEngine(),!1),this._ssaoCombinePostProcess=new c(this.name+" Combiner",this._scene.getEngine())}dispose(){this._ssaoPostProcess?.dispose(),this._ssaoBlurXPostProcess?.dispose(),this._ssaoBlurYPostProcess?.dispose(),this._ssaoCombinePostProcess?.dispose()}}class o extends v{get totalStrength(){return this._thinSSAORenderingPipeline.totalStrength}set totalStrength(e){this._thinSSAORenderingPipeline.totalStrength=e}get maxZ(){return this._thinSSAORenderingPipeline.maxZ}set maxZ(e){this._thinSSAORenderingPipeline.maxZ=e}get minZAspect(){return this._thinSSAORenderingPipeline.minZAspect}set minZAspect(e){this._thinSSAORenderingPipeline.minZAspect=e}set epsilon(e){this._thinSSAORenderingPipeline.epsilon=e}get epsilon(){return this._thinSSAORenderingPipeline.epsilon}set samples(e){this._thinSSAORenderingPipeline.samples=e}get samples(){return this._thinSSAORenderingPipeline.samples}set textureSamples(e){this._textureSamples=e,this._prePassRenderer?this._prePassRenderer.samples=e:this._originalColorPostProcess.samples=e}get textureSamples(){return this._textureSamples}get _geometryBufferRenderer(){return this._forceGeometryBuffer?this._forcedGeometryBuffer??this._scene.geometryBufferRenderer:null}get _prePassRenderer(){return this._forceGeometryBuffer?null:this._scene.prePassRenderer}get radius(){return this._thinSSAORenderingPipeline.radius}set radius(e){this._thinSSAORenderingPipeline.radius=e}get base(){return this._thinSSAORenderingPipeline.base}set base(e){this._thinSSAORenderingPipeline.base=e}set bypassBlur(e){this._thinSSAORenderingPipeline.bypassBlur=e}get bypassBlur(){return this._thinSSAORenderingPipeline.bypassBlur}set expensiveBlur(e){this._thinSSAORenderingPipeline.expensiveBlur=e}get expensiveBlur(){return this._thinSSAORenderingPipeline.expensiveBlur}get bilateralSamples(){return this._thinSSAORenderingPipeline.bilateralSamples}set bilateralSamples(e){this._thinSSAORenderingPipeline.bilateralSamples=e}get bilateralSoften(){return this._thinSSAORenderingPipeline.bilateralSoften}set bilateralSoften(e){this._thinSSAORenderingPipeline.bilateralSoften=e}get bilateralTolerance(){return this._thinSSAORenderingPipeline.bilateralTolerance}set bilateralTolerance(e){this._thinSSAORenderingPipeline.bilateralTolerance=e}static get IsSupported(){const e=w.LastCreatedEngine;return e?e._features.supportSSAO2:!1}get useViewportInCombineStage(){return this._thinSSAORenderingPipeline.useViewportInCombineStage}set useViewportInCombineStage(e){this._thinSSAORenderingPipeline.useViewportInCombineStage=e}get scene(){return this._scene}constructor(e,t,s,r,i=!1,h=0){if(super(t.getEngine(),e),this.SSAOOriginalSceneColorEffect="SSAOOriginalSceneColorEffect",this.SSAORenderEffect="SSAORenderEffect",this.SSAOBlurHRenderEffect="SSAOBlurHRenderEffect",this.SSAOBlurVRenderEffect="SSAOBlurVRenderEffect",this.SSAOCombineRenderEffect="SSAOCombineRenderEffect",this._textureSamples=1,this._forcedGeometryBuffer=null,this._forceGeometryBuffer=!1,this._currentCameraMode=-1,this._thinSSAORenderingPipeline=new U(e,t),this._scene=t,this._ratio=s,this._textureType=h,i instanceof V?(this._forceGeometryBuffer=!0,this._forcedGeometryBuffer=i):this._forceGeometryBuffer=i,!this.isSupported){g.Error("The current engine does not support SSAO 2.");return}const m=this._ratio.ssaoRatio||s,u=this._ratio.blurRatio||s;this._forceGeometryBuffer?(this._forcedGeometryBuffer||t.enableGeometryBufferRenderer(),t.geometryBufferRenderer?.generateNormalsInWorldSpace&&g.Error("SSAO2RenderingPipeline does not support generateNormalsInWorldSpace=true for the geometry buffer renderer!")):(t.enablePrePassRenderer(),t.prePassRenderer?.generateNormalsInWorldSpace&&g.Error("SSAO2RenderingPipeline does not support generateNormalsInWorldSpace=true for the prepass renderer!")),this._originalColorPostProcess=new F("SSAOOriginalSceneColor",1,null,R.BILINEAR_SAMPLINGMODE,t.getEngine(),void 0,this._textureType),this._originalColorPostProcess.onBeforeRenderObservable.add(()=>{const _=this._scene.activeCamera;this._thinSSAORenderingPipeline._ssaoPostProcess.camera=_,_&&this._currentCameraMode!==_.mode&&(this._currentCameraMode=_.mode,this._thinSSAORenderingPipeline._ssaoPostProcess.updateEffect())}),this._originalColorPostProcess.samples=this.textureSamples,this._createSSAOPostProcess(1,h),this._createBlurPostProcess(m,u,this._textureType),this._createSSAOCombinePostProcess(u,this._textureType),this.addEffect(new d(t.getEngine(),this.SSAOOriginalSceneColorEffect,()=>this._originalColorPostProcess,!0)),this.addEffect(new d(t.getEngine(),this.SSAORenderEffect,()=>this._ssaoPostProcess,!0)),this.addEffect(new d(t.getEngine(),this.SSAOBlurHRenderEffect,()=>this._blurHPostProcess,!0)),this.addEffect(new d(t.getEngine(),this.SSAOBlurVRenderEffect,()=>this._blurVPostProcess,!0)),this.addEffect(new d(t.getEngine(),this.SSAOCombineRenderEffect,()=>this._ssaoCombinePostProcess,!0)),t.postProcessRenderPipelineManager.addPipeline(this),r&&t.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e,r)}getClassName(){return"SSAO2RenderingPipeline"}dispose(e=!1){for(let t=0;t{const m=this._ratio.blurRatio||this._ratio,u=r?this._originalColorPostProcess.width*m:this._originalColorPostProcess.height*m,_=r?this._originalColorPostProcess.width:this._originalColorPostProcess.height;this._thinSSAORenderingPipeline._ssaoBlurXPostProcess.textureSize=u>0?u:_,this._thinSSAORenderingPipeline._ssaoBlurYPostProcess.textureSize=u>0?u:_,this._geometryBufferRenderer?h.setTexture("depthSampler",this._geometryBufferRenderer.getGBuffer().textures[0]):this._prePassRenderer&&h.setTexture("depthSampler",this._prePassRenderer.getRenderTarget().textures[this._prePassRenderer.getIndex(5)])},i.samples=this.textureSamples,i.autoClear=!1,i}_getTextureSize(){const e=this._scene.getEngine(),t=this._prePassRenderer;let s={width:e.getRenderWidth(),height:e.getRenderHeight()};if(t&&this._scene.activeCamera?._getFirstPostProcess()===this._ssaoPostProcess){const r=t.getRenderTarget();r&&r.textures&&(s=r.textures[t.getIndex(4)].getSize())}else this._ssaoPostProcess.inputTexture&&(s.width=this._ssaoPostProcess.inputTexture.width,s.height=this._ssaoPostProcess.inputTexture.height);return s}_createSSAOPostProcess(e,t){this._ssaoPostProcess=new S("ssao",l.FragmentUrl,{size:e,samplingMode:2,engine:this._scene.getEngine(),textureType:t,effectWrapper:this._thinSSAORenderingPipeline._ssaoPostProcess}),this._ssaoPostProcess.autoClear=!1,this._ssaoPostProcess.onApply=s=>{this._geometryBufferRenderer?(s.setTexture("depthSampler",this._geometryBufferRenderer.getGBuffer().textures[0]),s.setTexture("normalSampler",this._geometryBufferRenderer.getGBuffer().textures[1])):this._prePassRenderer&&(s.setTexture("depthSampler",this._prePassRenderer.getRenderTarget().textures[this._prePassRenderer.getIndex(5)]),s.setTexture("normalSampler",this._prePassRenderer.getRenderTarget().textures[this._prePassRenderer.getIndex(6)]));const r=this._getTextureSize();this._thinSSAORenderingPipeline._ssaoPostProcess.textureWidth=r.width,this._thinSSAORenderingPipeline._ssaoPostProcess.textureHeight=r.height},this._ssaoPostProcess.samples=this.textureSamples,this._forceGeometryBuffer||(this._ssaoPostProcess._prePassEffectConfiguration=new M)}_createSSAOCombinePostProcess(e,t){this._ssaoCombinePostProcess=new S("ssaoCombine",c.FragmentUrl,{size:e,samplingMode:2,engine:this._scene.getEngine(),textureType:t,effectWrapper:this._thinSSAORenderingPipeline._ssaoCombinePostProcess}),this._ssaoCombinePostProcess.onApply=s=>{this._thinSSAORenderingPipeline._ssaoCombinePostProcess.camera=this._scene.activeCamera,s.setTextureFromPostProcessOutput("originalColor",this._originalColorPostProcess)},this._ssaoCombinePostProcess.autoClear=!1,this._ssaoCombinePostProcess.samples=this.textureSamples}serialize(){const e=A.Serialize(this);return e.customType="SSAO2RenderingPipeline",e}static Parse(e,t,s){return A.Parse(()=>new o(e._name,t,e._ratio,void 0,e._forceGeometryBuffer,e._textureType),e,t,s)}}n([a()],o.prototype,"totalStrength",null);n([a()],o.prototype,"maxZ",null);n([a()],o.prototype,"minZAspect",null);n([a("epsilon")],o.prototype,"epsilon",null);n([a("samples")],o.prototype,"samples",null);n([a("textureSamples")],o.prototype,"_textureSamples",void 0);n([a()],o.prototype,"_forceGeometryBuffer",void 0);n([a()],o.prototype,"_ratio",void 0);n([a()],o.prototype,"_textureType",void 0);n([a()],o.prototype,"radius",null);n([a()],o.prototype,"base",null);n([a("bypassBlur")],o.prototype,"bypassBlur",null);n([a("expensiveBlur")],o.prototype,"expensiveBlur",null);n([a()],o.prototype,"bilateralSamples",null);n([a()],o.prototype,"bilateralSoften",null);n([a()],o.prototype,"bilateralTolerance",null);I("BABYLON.SSAO2RenderingPipeline",o);export{o as SSAO2RenderingPipeline}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ssaoCombine.fragment-CEUhl1QS.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ssaoCombine.fragment-CEUhl1QS.js new file mode 100644 index 0000000000000000000000000000000000000000..538de2c6437ebbc53488d501c18625c759cf18f0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ssaoCombine.fragment-CEUhl1QS.js @@ -0,0 +1,9 @@ +import{S as r}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="ssaoCombinePixelShader",o=`varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d;var originalColorSampler: sampler;var originalColor: texture_2d;uniform viewport: vec4f; +#define CUSTOM_FRAGMENT_DEFINITIONS +@fragment +fn main(input: FragmentInputs)->FragmentOutputs { +#define CUSTOM_FRAGMENT_MAIN_BEGIN +var uv: vec2f=uniforms.viewport.xy+input.vUV*uniforms.viewport.zw;var ssaoColor: vec4f=textureSample(textureSampler,textureSamplerSampler,uv);var sceneColor: vec4f=textureSample(originalColor,originalColorSampler,uv);fragmentOutputs.color=sceneColor*ssaoColor; +#define CUSTOM_FRAGMENT_MAIN_END +} +`;r.ShadersStoreWGSL[e]||(r.ShadersStoreWGSL[e]=o);const i={name:e,shader:o};export{i as ssaoCombinePixelShaderWGSL}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ssaoCombine.fragment-Cs-Fcqg-.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ssaoCombine.fragment-Cs-Fcqg-.js new file mode 100644 index 0000000000000000000000000000000000000000..682f465862ff78542a1e9b0ddbb2ee59e0f61d67 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ssaoCombine.fragment-Cs-Fcqg-.js @@ -0,0 +1,8 @@ +import{S as o}from"./index-CDrXokXW.js";import"./index-DWyDLubb.js";const e="ssaoCombinePixelShader",r=`uniform sampler2D textureSampler;uniform sampler2D originalColor;uniform vec4 viewport;varying vec2 vUV; +#define CUSTOM_FRAGMENT_DEFINITIONS +void main(void) { +#define CUSTOM_FRAGMENT_MAIN_BEGIN +vec2 uv=viewport.xy+vUV*viewport.zw;vec4 ssaoColor=texture2D(textureSampler,uv);vec4 sceneColor=texture2D(originalColor,uv);gl_FragColor=sceneColor*ssaoColor; +#define CUSTOM_FRAGMENT_MAIN_END +} +`;o.ShadersStore[e]||(o.ShadersStore[e]=r);const t={name:e,shader:r};export{t as ssaoCombinePixelShader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/standardMaterial-C4-ZPPCc.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/standardMaterial-C4-ZPPCc.js new file mode 100644 index 0000000000000000000000000000000000000000..bdd072d26290119f16d69e3d312ef04debefdb8b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/standardMaterial-C4-ZPPCc.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./default.vertex-BXPIbqz9.js","./index-CDrXokXW.js","./index-DWyDLubb.js","./index-CyHPbdIk.css","./defaultUboDeclaration-DefpgvMN.js","./sceneUboDeclaration-BH1tZjjY.js","./meshUboDeclaration-Bk1ASTX2.js","./vertexColorMixing-8t5JaWwM.js","./helperFunctions-CZpZ-EbL.js","./bonesDeclaration-Bh_c0MF7.js","./instancesVertex-CO_CTxxp.js","./instancesDeclaration-DZdrWbmN.js","./mainUVVaryingDeclaration-gz09aLXv.js","./bumpVertexDeclaration-BZI6C33v.js","./clipPlaneVertex-J3Krgsee.js","./logDepthVertex-D_A6gsii.js","./shadowsVertex-CygJ_RUp.js","./morphTargetsVertexDeclaration-BsT9JpOT.js","./logDepthDeclaration-DkdfQs4e.js","./morphTargetsVertex-DcRl6X3j.js","./bonesVertex-bl6LLSA1.js","./bakedVertexAnimation-DoavwM49.js","./bumpVertex-D9JGroSY.js","./default.fragment-51gNkSUo.js","./oitFragment-BcbCWH3V.js","./shadowsFragmentFunctions-CTsFFgyf.js","./lightsFragmentFunctions-DcPOaMby.js","./samplerFragmentDeclaration-cxB-jdDJ.js","./fresnelFunction-cCRUtTOI.js","./imageProcessingFunctions-BbtoaTge.js","./bumpFragment-BDPY2JKo.js","./clipPlaneFragment-C7XUrTAZ.js","./fogFragment-DmA8Y7To.js","./decalFragment-iGkmQ-pm.js","./lightFragment-DhtXFpEE.js","./default.vertex-BP2hbECl.js","./vertexColorMixing-DUmDzlXI.js","./defaultUboDeclaration-D-7rPLB4.js","./sceneUboDeclaration-C4vXUqkq.js","./meshUboDeclaration-C6raEdzf.js","./helperFunctions-BkWNqKeI.js","./bakedVertexAnimation-BwUJBnNt.js","./instancesDeclaration-BAnfKLCo.js","./mainUVVaryingDeclaration-CYLIf35n.js","./bumpVertexDeclaration-Bd2S82Ce.js","./clipPlaneVertex-Bmw4TNCQ.js","./logDepthVertex-DDooPwab.js","./shadowsVertex-DbGd-etA.js","./morphTargetsVertex-7Q90Wwr8.js","./logDepthDeclaration-DbMKMukk.js","./bumpVertex-B5e3s1jQ.js","./pointCloudVertex-C-QHJpr_.js","./default.fragment-C7QPF0yE.js","./oitFragment-_o5mqRWd.js","./shadowsFragmentFunctions-QR4_Qrt1.js","./lightsFragmentFunctions-nqjCe5ZE.js","./lightFragment-BRK1HqYL.js","./bumpFragment-CNMCo4HD.js","./imageProcessingFunctions-dvOnE6xp.js","./clipPlaneFragment-T8W7CIC5.js","./fogFragment-R9KOnWn-.js","./decalFragment-BXuRa219.js"])))=>i.map(i=>d[i]); +import{af as b}from"./index-DWyDLubb.js";import{C as m,n as w,D as Y,P as k,o as N,p as W,q as z,r as K,t as Z,u as y,v as x,w as j,x as Q,y as J,z as $,E as q,H as ee,F as te,J as v,K as se,N as ie,Q as re,U as ae,W as M,X as oe,Y as ne,Z as le,$ as ue,a0 as R,a1 as fe,a2 as he,a3 as Te,b as V,a4 as pe,a5 as Ee,a6 as de,e as G,a7 as f,a8 as _e,a9 as me,aa as ce,ab as Ae,ac as xe,_ as i,ad as _,ae as n,af as F,s as h,ag as L,R as Re}from"./index-CDrXokXW.js";const D={effect:null,subMesh:null};class Pe extends Ae(xe){}class Se extends ce(Pe){constructor(t){super(t),this.DIFFUSE=!1,this.DIFFUSEDIRECTUV=0,this.BAKED_VERTEX_ANIMATION_TEXTURE=!1,this.AMBIENT=!1,this.AMBIENTDIRECTUV=0,this.OPACITY=!1,this.OPACITYDIRECTUV=0,this.OPACITYRGB=!1,this.REFLECTION=!1,this.EMISSIVE=!1,this.EMISSIVEDIRECTUV=0,this.SPECULAR=!1,this.SPECULARDIRECTUV=0,this.BUMP=!1,this.BUMPDIRECTUV=0,this.PARALLAX=!1,this.PARALLAX_RHS=!1,this.PARALLAXOCCLUSION=!1,this.SPECULAROVERALPHA=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.ALPHAFROMDIFFUSE=!1,this.POINTSIZE=!1,this.FOG=!1,this.SPECULARTERM=!1,this.DIFFUSEFRESNEL=!1,this.OPACITYFRESNEL=!1,this.REFLECTIONFRESNEL=!1,this.REFRACTIONFRESNEL=!1,this.EMISSIVEFRESNEL=!1,this.FRESNEL=!1,this.NORMAL=!1,this.TANGENT=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.BONETEXTURE=!1,this.BONES_VELOCITY_ENABLED=!1,this.INSTANCES=!1,this.THIN_INSTANCES=!1,this.INSTANCESCOLOR=!1,this.GLOSSINESS=!1,this.ROUGHNESS=!1,this.EMISSIVEASILLUMINATION=!1,this.LINKEMISSIVEWITHDIFFUSE=!1,this.REFLECTIONFRESNELFROMSPECULAR=!1,this.LIGHTMAP=!1,this.LIGHTMAPDIRECTUV=0,this.OBJECTSPACE_NORMALMAP=!1,this.USELIGHTMAPASSHADOWMAP=!1,this.REFLECTIONMAP_3D=!1,this.REFLECTIONMAP_SPHERICAL=!1,this.REFLECTIONMAP_PLANAR=!1,this.REFLECTIONMAP_CUBIC=!1,this.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,this.USE_LOCAL_REFRACTIONMAP_CUBIC=!1,this.REFLECTIONMAP_PROJECTION=!1,this.REFLECTIONMAP_SKYBOX=!1,this.REFLECTIONMAP_EXPLICIT=!1,this.REFLECTIONMAP_EQUIRECTANGULAR=!1,this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,this.REFLECTIONMAP_OPPOSITEZ=!1,this.INVERTCUBICMAP=!1,this.LOGARITHMICDEPTH=!1,this.REFRACTION=!1,this.REFRACTIONMAP_3D=!1,this.REFLECTIONOVERALPHA=!1,this.TWOSIDEDLIGHTING=!1,this.SHADOWFLOAT=!1,this.MORPHTARGETS=!1,this.MORPHTARGETS_POSITION=!1,this.MORPHTARGETS_NORMAL=!1,this.MORPHTARGETS_TANGENT=!1,this.MORPHTARGETS_UV=!1,this.MORPHTARGETS_UV2=!1,this.MORPHTARGETS_COLOR=!1,this.MORPHTARGETTEXTURE_HASPOSITIONS=!1,this.MORPHTARGETTEXTURE_HASNORMALS=!1,this.MORPHTARGETTEXTURE_HASTANGENTS=!1,this.MORPHTARGETTEXTURE_HASUVS=!1,this.MORPHTARGETTEXTURE_HASUV2S=!1,this.MORPHTARGETTEXTURE_HASCOLORS=!1,this.NUM_MORPH_INFLUENCERS=0,this.MORPHTARGETS_TEXTURE=!1,this.NONUNIFORMSCALING=!1,this.PREMULTIPLYALPHA=!1,this.ALPHATEST_AFTERALLALPHACOMPUTATIONS=!1,this.ALPHABLEND=!0,this.PREPASS=!1,this.PREPASS_COLOR=!1,this.PREPASS_COLOR_INDEX=-1,this.PREPASS_IRRADIANCE=!1,this.PREPASS_IRRADIANCE_INDEX=-1,this.PREPASS_ALBEDO=!1,this.PREPASS_ALBEDO_INDEX=-1,this.PREPASS_ALBEDO_SQRT=!1,this.PREPASS_ALBEDO_SQRT_INDEX=-1,this.PREPASS_DEPTH=!1,this.PREPASS_DEPTH_INDEX=-1,this.PREPASS_SCREENSPACE_DEPTH=!1,this.PREPASS_SCREENSPACE_DEPTH_INDEX=-1,this.PREPASS_NORMALIZED_VIEW_DEPTH=!1,this.PREPASS_NORMALIZED_VIEW_DEPTH_INDEX=-1,this.PREPASS_NORMAL=!1,this.PREPASS_NORMAL_INDEX=-1,this.PREPASS_NORMAL_WORLDSPACE=!1,this.PREPASS_WORLD_NORMAL=!1,this.PREPASS_WORLD_NORMAL_INDEX=-1,this.PREPASS_POSITION=!1,this.PREPASS_POSITION_INDEX=-1,this.PREPASS_LOCAL_POSITION=!1,this.PREPASS_LOCAL_POSITION_INDEX=-1,this.PREPASS_VELOCITY=!1,this.PREPASS_VELOCITY_INDEX=-1,this.PREPASS_VELOCITY_LINEAR=!1,this.PREPASS_VELOCITY_LINEAR_INDEX=-1,this.PREPASS_REFLECTIVITY=!1,this.PREPASS_REFLECTIVITY_INDEX=-1,this.SCENE_MRT_COUNT=0,this.RGBDLIGHTMAP=!1,this.RGBDREFLECTION=!1,this.RGBDREFRACTION=!1,this.MULTIVIEW=!1,this.ORDER_INDEPENDENT_TRANSPARENCY=!1,this.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!1,this.CAMERA_ORTHOGRAPHIC=!1,this.CAMERA_PERSPECTIVE=!1,this.AREALIGHTSUPPORTED=!0,this.USE_VERTEX_PULLING=!1,this.RIGHT_HANDED=!1,this.CLUSTLIGHT_SLICES=0,this.CLUSTLIGHT_BATCH=0,this.IS_REFLECTION_LINEAR=!1,this.IS_REFRACTION_LINEAR=!1,this.DECAL_AFTER_DETAIL=!1,this.rebuild()}}class Ie extends _e(me){}class s extends Ie{get isPrePassCapable(){return!this.disableDepthWrite}get canRenderToMRT(){return!0}constructor(t,a,T=!1){super(t,a,void 0,T||s.ForceGLSL),this._diffuseTexture=null,this._ambientTexture=null,this._opacityTexture=null,this._reflectionTexture=null,this._emissiveTexture=null,this._specularTexture=null,this._bumpTexture=null,this._lightmapTexture=null,this._refractionTexture=null,this.ambientColor=new m(0,0,0),this.diffuseColor=new m(1,1,1),this.specularColor=new m(1,1,1),this.emissiveColor=new m(0,0,0),this.specularPower=64,this._useAlphaFromDiffuseTexture=!1,this._useEmissiveAsIllumination=!1,this._linkEmissiveWithDiffuse=!1,this._useSpecularOverAlpha=!1,this._useReflectionOverAlpha=!1,this._disableLighting=!1,this._useObjectSpaceNormalMap=!1,this._useParallax=!1,this._useParallaxOcclusion=!1,this.parallaxScaleBias=.05,this._roughness=0,this.indexOfRefraction=.98,this.invertRefractionY=!0,this.alphaCutOff=.4,this._useLightmapAsShadowmap=!1,this._useReflectionFresnelFromSpecular=!1,this._useGlossinessFromSpecularMapAlpha=!1,this._maxSimultaneousLights=4,this._invertNormalMapX=!1,this._invertNormalMapY=!1,this._twoSidedLighting=!1,this._applyDecalMapAfterDetailMap=!1,this._shadersLoaded=!1,this._renderTargets=new w(16),this._globalAmbientColor=new m(0,0,0),this._cacheHasRenderTargetTextures=!1,this.detailMap=new Y(this),this._attachImageProcessingConfiguration(null),this.prePassConfiguration=new k,this.getRenderTargetTextures=()=>(this._renderTargets.reset(),s.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._renderTargets.push(this._reflectionTexture),s.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&this._renderTargets.push(this._refractionTexture),this._eventInfo.renderTargets=this._renderTargets,this._callbackPluginEventFillRenderTargetTextures(this._eventInfo),this._renderTargets)}get hasRenderTargetTextures(){return s.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget||s.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget?!0:this._cacheHasRenderTargetTextures}getClassName(){return"StandardMaterial"}needAlphaBlending(){return this._hasTransparencyMode?this._transparencyModeIsBlend:this._disableAlphaBlending?!1:this.alpha<1||this._opacityTexture!=null||this._shouldUseAlphaFromDiffuseTexture()||this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled}needAlphaTesting(){return this._hasTransparencyMode?this._transparencyModeIsTest:this._hasAlphaChannel()&&(this._transparencyMode==null||this._transparencyMode===N.MATERIAL_ALPHATEST)}_shouldUseAlphaFromDiffuseTexture(){return this._diffuseTexture!=null&&this._diffuseTexture.hasAlpha&&this._useAlphaFromDiffuseTexture&&this._transparencyMode!==N.MATERIAL_OPAQUE}_hasAlphaChannel(){return this._diffuseTexture!=null&&this._diffuseTexture.hasAlpha||this._opacityTexture!=null}getAlphaTestTexture(){return this._diffuseTexture}isReadyForSubMesh(t,a,T=!1){this._uniformBufferLayoutBuilt||this.buildUniformLayout();const o=a._drawWrapper;if(o.effect&&this.isFrozen&&o._wasPreviouslyReady&&o._wasPreviouslyUsingInstances===T)return!0;a.materialDefines||(this._callbackPluginEventGeneric(4,this._eventInfo),a.materialDefines=new Se(this._eventInfo.defineNames));const l=this.getScene(),e=a.materialDefines;if(this._isReadyForSubMesh(a))return!0;const c=l.getEngine();e._needNormals=W(l,t,e,!0,this._maxSimultaneousLights,this._disableLighting),z(l,e);const P=this.needAlphaBlendingForMesh(t)&&this.getScene().useOrderIndependentTransparency;if(K(l,e,this.canRenderToMRT&&!P),Z(l,e,P),y.PrepareDefines(c.currentRenderPassId,t,e),e._areTexturesDirty){this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._cacheHasRenderTargetTextures=this._eventInfo.hasRenderTargetTextures,e._needUVs=!1;for(let p=1;p<=6;++p)e["MAINUV"+p]=!1;if(l.texturesEnabled){if(e.DIFFUSEDIRECTUV=0,e.BUMPDIRECTUV=0,e.AMBIENTDIRECTUV=0,e.OPACITYDIRECTUV=0,e.EMISSIVEDIRECTUV=0,e.SPECULARDIRECTUV=0,e.LIGHTMAPDIRECTUV=0,this._diffuseTexture&&s.DiffuseTextureEnabled)if(this._diffuseTexture.isReadyOrNotBlocking())x(this._diffuseTexture,e,"DIFFUSE");else return!1;else e.DIFFUSE=!1;if(this._ambientTexture&&s.AmbientTextureEnabled)if(this._ambientTexture.isReadyOrNotBlocking())x(this._ambientTexture,e,"AMBIENT");else return!1;else e.AMBIENT=!1;if(this._opacityTexture&&s.OpacityTextureEnabled)if(this._opacityTexture.isReadyOrNotBlocking())x(this._opacityTexture,e,"OPACITY"),e.OPACITYRGB=this._opacityTexture.getAlphaFromRGB;else return!1;else e.OPACITY=!1;if(this._reflectionTexture&&s.ReflectionTextureEnabled?(e.ROUGHNESS=this._roughness>0,e.REFLECTIONOVERALPHA=this._useReflectionOverAlpha):(e.ROUGHNESS=!1,e.REFLECTIONOVERALPHA=!1),!j(l,this._reflectionTexture,e))return!1;if(this._emissiveTexture&&s.EmissiveTextureEnabled)if(this._emissiveTexture.isReadyOrNotBlocking())x(this._emissiveTexture,e,"EMISSIVE");else return!1;else e.EMISSIVE=!1;if(this._lightmapTexture&&s.LightmapTextureEnabled)if(this._lightmapTexture.isReadyOrNotBlocking())x(this._lightmapTexture,e,"LIGHTMAP"),e.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,e.RGBDLIGHTMAP=this._lightmapTexture.isRGBD;else return!1;else e.LIGHTMAP=!1;if(this._specularTexture&&s.SpecularTextureEnabled)if(this._specularTexture.isReadyOrNotBlocking())x(this._specularTexture,e,"SPECULAR"),e.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha;else return!1;else e.SPECULAR=!1;if(l.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&s.BumpTextureEnabled){if(this._bumpTexture.isReady())x(this._bumpTexture,e,"BUMP"),e.PARALLAX=this._useParallax,e.PARALLAX_RHS=l.useRightHandedSystem,e.PARALLAXOCCLUSION=this._useParallaxOcclusion;else return!1;e.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else e.BUMP=!1,e.PARALLAX=!1,e.PARALLAX_RHS=!1,e.PARALLAXOCCLUSION=!1;if(this._refractionTexture&&s.RefractionTextureEnabled)if(this._refractionTexture.isReadyOrNotBlocking())e._needUVs=!0,e.REFRACTION=!0,e.REFRACTIONMAP_3D=this._refractionTexture.isCube,e.RGBDREFRACTION=this._refractionTexture.isRGBD,e.USE_LOCAL_REFRACTIONMAP_CUBIC=!!this._refractionTexture.boundingBoxSize;else return!1;else e.REFRACTION=!1;e.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else e.DIFFUSE=!1,e.AMBIENT=!1,e.OPACITY=!1,e.REFLECTION=!1,e.EMISSIVE=!1,e.LIGHTMAP=!1,e.BUMP=!1,e.REFRACTION=!1;e.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),e.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,e.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,e.SPECULAROVERALPHA=this._useSpecularOverAlpha,e.PREMULTIPLYALPHA=this.alphaMode===7||this.alphaMode===8,e.ALPHATEST_AFTERALLALPHACOMPUTATIONS=this.transparencyMode!==null,e.ALPHABLEND=this.transparencyMode===null||this.needAlphaBlendingForMesh(t)}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=e,this._eventInfo.subMesh=a,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(e._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(e),e.IS_REFLECTION_LINEAR=this.reflectionTexture!=null&&!this.reflectionTexture.gammaSpace,e.IS_REFRACTION_LINEAR=this.refractionTexture!=null&&!this.refractionTexture.gammaSpace}if(e._areFresnelDirty&&(s.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(e.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,e.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,e.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,e.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,e.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,e.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,e._needNormals=!0,e.FRESNEL=!0):e.FRESNEL=!1),e.AREALIGHTUSED||e.CLUSTLIGHT_BATCH){for(let p=0;p{this._shaderLanguage===1?await Promise.all([b(()=>import("./default.vertex-BXPIbqz9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]),import.meta.url),b(()=>import("./default.fragment-51gNkSUo.js"),__vite__mapDeps([23,1,2,3,4,5,6,24,12,8,25,26,27,28,29,30,31,18,32,33,34]),import.meta.url)]):await Promise.all([b(()=>import("./default.vertex-BP2hbECl.js"),__vite__mapDeps([35,1,2,3,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51]),import.meta.url),b(()=>import("./default.fragment-C7QPF0yE.js"),__vite__mapDeps([52,1,2,3,53,37,38,39,43,40,54,55,56,57,58,59,49,60,61]),import.meta.url)]),this._shadersLoaded=!0}},c);if(this._eventInfo.customCode=void 0,S)if(this._onEffectCreatedObservable&&(D.effect=S,D.subMesh=a,this._onEffectCreatedObservable.notifyObservers(D)),this.allowShaderHotSwapping&&H&&!S.isReady()){if(S=H,e.markAsUnprocessed(),r=this.isFrozen,p)return e._areLightsDisposed=!0,!1}else l.resetCachedMaterial(),a.setEffect(S,e,this._materialContext)}return!a.effect||!a.effect.isReady()?!1:(e._renderId=l.getRenderId(),o._wasPreviouslyReady=!r,o._wasPreviouslyUsingInstances=T,this._checkScenePerformancePriority(),!0)}buildUniformLayout(){const t=this._uniformBuffer;t.addUniform("diffuseLeftColor",4),t.addUniform("diffuseRightColor",4),t.addUniform("opacityParts",4),t.addUniform("reflectionLeftColor",4),t.addUniform("reflectionRightColor",4),t.addUniform("refractionLeftColor",4),t.addUniform("refractionRightColor",4),t.addUniform("emissiveLeftColor",4),t.addUniform("emissiveRightColor",4),t.addUniform("vDiffuseInfos",2),t.addUniform("vAmbientInfos",2),t.addUniform("vOpacityInfos",2),t.addUniform("vEmissiveInfos",2),t.addUniform("vLightmapInfos",2),t.addUniform("vSpecularInfos",2),t.addUniform("vBumpInfos",3),t.addUniform("diffuseMatrix",16),t.addUniform("ambientMatrix",16),t.addUniform("opacityMatrix",16),t.addUniform("emissiveMatrix",16),t.addUniform("lightmapMatrix",16),t.addUniform("specularMatrix",16),t.addUniform("bumpMatrix",16),t.addUniform("vTangentSpaceParams",2),t.addUniform("pointSize",1),t.addUniform("alphaCutOff",1),t.addUniform("refractionMatrix",16),t.addUniform("vRefractionInfos",4),t.addUniform("vRefractionPosition",3),t.addUniform("vRefractionSize",3),t.addUniform("vSpecularColor",4),t.addUniform("vEmissiveColor",3),t.addUniform("vDiffuseColor",4),t.addUniform("vAmbientColor",3),t.addUniform("cameraInfo",4),le(t,!1,!0),super.buildUniformLayout()}bindForSubMesh(t,a,T){const o=this.getScene(),l=T.materialDefines;if(!l)return;const e=T.effect;if(!e)return;this._activeEffect=e,a.getMeshUniformBuffer().bindToEffect(e,"Mesh"),a.transferToEffect(t),this._uniformBuffer.bindToEffect(e,"Material"),this.prePassConfiguration.bindForSubMesh(this._activeEffect,o,a,t,this.isFrozen),y.Bind(o.getEngine().currentRenderPassId,this._activeEffect,a,t,this);const c=o.activeCamera;c?this._uniformBuffer.updateFloat4("cameraInfo",c.minZ,c.maxZ,0,0):this._uniformBuffer.updateFloat4("cameraInfo",0,0,0,0),this._eventInfo.subMesh=T,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),l.OBJECTSPACE_NORMALMAP&&(t.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));const P=this._mustRebind(o,e,T,a.visibility);ue(a,e);const r=this._uniformBuffer;if(P){if(this.bindViewProjection(e),!r.useUbo||!this.isFrozen||!r.isSync||T._drawWrapper._forceRebindOnNextCall){if(s.FresnelEnabled&&l.FRESNEL&&(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(r.updateColor4("diffuseLeftColor",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),r.updateColor4("diffuseRightColor",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled&&r.updateColor4("opacityParts",new m(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),this.opacityFresnelParameters.power),this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(r.updateColor4("reflectionLeftColor",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),r.updateColor4("reflectionRightColor",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(r.updateColor4("refractionLeftColor",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),r.updateColor4("refractionRightColor",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(r.updateColor4("emissiveLeftColor",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),r.updateColor4("emissiveRightColor",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))),o.texturesEnabled&&(this._diffuseTexture&&s.DiffuseTextureEnabled&&(r.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),R(this._diffuseTexture,r,"diffuse")),this._ambientTexture&&s.AmbientTextureEnabled&&(r.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),R(this._ambientTexture,r,"ambient")),this._opacityTexture&&s.OpacityTextureEnabled&&(r.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),R(this._opacityTexture,r,"opacity")),this._hasAlphaChannel()&&r.updateFloat("alphaCutOff",this.alphaCutOff),fe(o,l,r,m.White(),this._reflectionTexture,!1,!1,!0,!1,!1,!1,this.roughness),(!this._reflectionTexture||!s.ReflectionTextureEnabled)&&r.updateFloat2("vReflectionInfos",0,this.roughness),this._emissiveTexture&&s.EmissiveTextureEnabled&&(r.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),R(this._emissiveTexture,r,"emissive")),this._lightmapTexture&&s.LightmapTextureEnabled&&(r.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),R(this._lightmapTexture,r,"lightmap")),this._specularTexture&&s.SpecularTextureEnabled&&(r.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),R(this._specularTexture,r,"specular")),this._bumpTexture&&o.getEngine().getCaps().standardDerivatives&&s.BumpTextureEnabled&&(r.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),R(this._bumpTexture,r,"bump"),o._mirroredCameraPosition?r.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):r.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&s.RefractionTextureEnabled)){let p=1;if(this._refractionTexture.isCube||(r.updateMatrix("refractionMatrix",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(p=this._refractionTexture.depth)),r.updateFloat4("vRefractionInfos",this._refractionTexture.level,this.indexOfRefraction,p,this.invertRefractionY?-1:1),this._refractionTexture.boundingBoxSize){const u=this._refractionTexture;r.updateVector3("vRefractionPosition",u.boundingBoxPosition),r.updateVector3("vRefractionSize",u.boundingBoxSize)}}this.pointsCloud&&r.updateFloat("pointSize",this.pointSize),r.updateColor4("vSpecularColor",this.specularColor,this.specularPower),r.updateColor3("vEmissiveColor",s.EmissiveTextureEnabled?this.emissiveColor:m.BlackReadOnly),r.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha),o.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),r.updateColor3("vAmbientColor",this._globalAmbientColor)}o.texturesEnabled&&(this._diffuseTexture&&s.DiffuseTextureEnabled&&e.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&s.AmbientTextureEnabled&&e.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&s.OpacityTextureEnabled&&e.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&s.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?e.setTexture("reflectionCubeSampler",this._reflectionTexture):e.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&s.EmissiveTextureEnabled&&e.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&s.LightmapTextureEnabled&&e.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&s.SpecularTextureEnabled&&e.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&o.getEngine().getCaps().standardDerivatives&&s.BumpTextureEnabled&&e.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&s.RefractionTextureEnabled&&(this._refractionTexture.isCube?e.setTexture("refractionCubeSampler",this._refractionTexture):e.setTexture("refraction2DSampler",this._refractionTexture))),this.getScene().useOrderIndependentTransparency&&this.needAlphaBlendingForMesh(a)&&this.getScene().depthPeelingRenderer.bind(e),this._eventInfo.subMesh=T,this._callbackPluginEventBindForSubMesh(this._eventInfo),he(e,this,o),this.bindEyePosition(e)}else o.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._needToBindSceneUbo=!0);(P||!this.isFrozen)&&(o.lightsEnabled&&!this._disableLighting&&Te(o,a,e,l,this._maxSimultaneousLights),(o.fogEnabled&&a.applyFog&&o.fogMode!==V.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture||a.receiveShadows||l.PREPASS||l.CLUSTLIGHT_BATCH)&&this.bindView(e),pe(o,a,e),l.NUM_MORPH_INFLUENCERS&&Ee(a,e),l.BAKED_VERTEX_ANIMATION_TEXTURE&&a.bakedVertexAnimationManager?.bind(e,l.INSTANCES),this.useLogarithmicDepth&&de(l,e,o),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._afterBind(a,this._activeEffect,T),r.update()}getAnimatables(){const t=super.getAnimatables();return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&t.push(this._diffuseTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&t.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&t.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&t.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&t.push(this._emissiveTexture),this._specularTexture&&this._specularTexture.animations&&this._specularTexture.animations.length>0&&t.push(this._specularTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&t.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&t.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&t.push(this._refractionTexture),t}getActiveTextures(){const t=super.getActiveTextures();return this._diffuseTexture&&t.push(this._diffuseTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._specularTexture&&t.push(this._specularTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),this._refractionTexture&&t.push(this._refractionTexture),t}hasTexture(t){return!!(super.hasTexture(t)||this._diffuseTexture===t||this._ambientTexture===t||this._opacityTexture===t||this._reflectionTexture===t||this._emissiveTexture===t||this._specularTexture===t||this._bumpTexture===t||this._lightmapTexture===t||this._refractionTexture===t)}dispose(t,a){a&&(this._diffuseTexture?.dispose(),this._ambientTexture?.dispose(),this._opacityTexture?.dispose(),this._reflectionTexture?.dispose(),this._emissiveTexture?.dispose(),this._specularTexture?.dispose(),this._bumpTexture?.dispose(),this._lightmapTexture?.dispose(),this._refractionTexture?.dispose()),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),super.dispose(t,a)}clone(t,a=!0,T=""){const o=G.Clone(()=>new s(t,this.getScene()),this,{cloneTexturesOnlyOnce:a});return o.name=t,o.id=t,this.stencil.copyTo(o.stencil),this._clonePlugins(o,T),o}static Parse(t,a,T){const o=G.Parse(()=>new s(t.name,a),t,a,T);return t.stencil&&o.stencil.parse(t.stencil,a,T),N._ParsePlugins(t,o,a,T),o}static get DiffuseTextureEnabled(){return f.DiffuseTextureEnabled}static set DiffuseTextureEnabled(t){f.DiffuseTextureEnabled=t}static get DetailTextureEnabled(){return f.DetailTextureEnabled}static set DetailTextureEnabled(t){f.DetailTextureEnabled=t}static get AmbientTextureEnabled(){return f.AmbientTextureEnabled}static set AmbientTextureEnabled(t){f.AmbientTextureEnabled=t}static get OpacityTextureEnabled(){return f.OpacityTextureEnabled}static set OpacityTextureEnabled(t){f.OpacityTextureEnabled=t}static get ReflectionTextureEnabled(){return f.ReflectionTextureEnabled}static set ReflectionTextureEnabled(t){f.ReflectionTextureEnabled=t}static get EmissiveTextureEnabled(){return f.EmissiveTextureEnabled}static set EmissiveTextureEnabled(t){f.EmissiveTextureEnabled=t}static get SpecularTextureEnabled(){return f.SpecularTextureEnabled}static set SpecularTextureEnabled(t){f.SpecularTextureEnabled=t}static get BumpTextureEnabled(){return f.BumpTextureEnabled}static set BumpTextureEnabled(t){f.BumpTextureEnabled=t}static get LightmapTextureEnabled(){return f.LightmapTextureEnabled}static set LightmapTextureEnabled(t){f.LightmapTextureEnabled=t}static get RefractionTextureEnabled(){return f.RefractionTextureEnabled}static set RefractionTextureEnabled(t){f.RefractionTextureEnabled=t}static get ColorGradingTextureEnabled(){return f.ColorGradingTextureEnabled}static set ColorGradingTextureEnabled(t){f.ColorGradingTextureEnabled=t}static get FresnelEnabled(){return f.FresnelEnabled}static set FresnelEnabled(t){f.FresnelEnabled=t}}s.ForceGLSL=!1;i([_("diffuseTexture")],s.prototype,"_diffuseTexture",void 0);i([n("_markAllSubMeshesAsTexturesAndMiscDirty")],s.prototype,"diffuseTexture",void 0);i([_("ambientTexture")],s.prototype,"_ambientTexture",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"ambientTexture",void 0);i([_("opacityTexture")],s.prototype,"_opacityTexture",void 0);i([n("_markAllSubMeshesAsTexturesAndMiscDirty")],s.prototype,"opacityTexture",void 0);i([_("reflectionTexture")],s.prototype,"_reflectionTexture",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"reflectionTexture",void 0);i([_("emissiveTexture")],s.prototype,"_emissiveTexture",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"emissiveTexture",void 0);i([_("specularTexture")],s.prototype,"_specularTexture",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"specularTexture",void 0);i([_("bumpTexture")],s.prototype,"_bumpTexture",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"bumpTexture",void 0);i([_("lightmapTexture")],s.prototype,"_lightmapTexture",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"lightmapTexture",void 0);i([_("refractionTexture")],s.prototype,"_refractionTexture",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"refractionTexture",void 0);i([F("ambient")],s.prototype,"ambientColor",void 0);i([F("diffuse")],s.prototype,"diffuseColor",void 0);i([F("specular")],s.prototype,"specularColor",void 0);i([F("emissive")],s.prototype,"emissiveColor",void 0);i([h()],s.prototype,"specularPower",void 0);i([h("useAlphaFromDiffuseTexture")],s.prototype,"_useAlphaFromDiffuseTexture",void 0);i([n("_markAllSubMeshesAsTexturesAndMiscDirty")],s.prototype,"useAlphaFromDiffuseTexture",void 0);i([h("useEmissiveAsIllumination")],s.prototype,"_useEmissiveAsIllumination",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useEmissiveAsIllumination",void 0);i([h("linkEmissiveWithDiffuse")],s.prototype,"_linkEmissiveWithDiffuse",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"linkEmissiveWithDiffuse",void 0);i([h("useSpecularOverAlpha")],s.prototype,"_useSpecularOverAlpha",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useSpecularOverAlpha",void 0);i([h("useReflectionOverAlpha")],s.prototype,"_useReflectionOverAlpha",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useReflectionOverAlpha",void 0);i([h("disableLighting")],s.prototype,"_disableLighting",void 0);i([n("_markAllSubMeshesAsLightsDirty")],s.prototype,"disableLighting",void 0);i([h("useObjectSpaceNormalMap")],s.prototype,"_useObjectSpaceNormalMap",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useObjectSpaceNormalMap",void 0);i([h("useParallax")],s.prototype,"_useParallax",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useParallax",void 0);i([h("useParallaxOcclusion")],s.prototype,"_useParallaxOcclusion",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useParallaxOcclusion",void 0);i([h()],s.prototype,"parallaxScaleBias",void 0);i([h("roughness")],s.prototype,"_roughness",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"roughness",void 0);i([h()],s.prototype,"indexOfRefraction",void 0);i([h()],s.prototype,"invertRefractionY",void 0);i([h()],s.prototype,"alphaCutOff",void 0);i([h("useLightmapAsShadowmap")],s.prototype,"_useLightmapAsShadowmap",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useLightmapAsShadowmap",void 0);i([L("diffuseFresnelParameters")],s.prototype,"_diffuseFresnelParameters",void 0);i([n("_markAllSubMeshesAsFresnelDirty")],s.prototype,"diffuseFresnelParameters",void 0);i([L("opacityFresnelParameters")],s.prototype,"_opacityFresnelParameters",void 0);i([n("_markAllSubMeshesAsFresnelAndMiscDirty")],s.prototype,"opacityFresnelParameters",void 0);i([L("reflectionFresnelParameters")],s.prototype,"_reflectionFresnelParameters",void 0);i([n("_markAllSubMeshesAsFresnelDirty")],s.prototype,"reflectionFresnelParameters",void 0);i([L("refractionFresnelParameters")],s.prototype,"_refractionFresnelParameters",void 0);i([n("_markAllSubMeshesAsFresnelDirty")],s.prototype,"refractionFresnelParameters",void 0);i([L("emissiveFresnelParameters")],s.prototype,"_emissiveFresnelParameters",void 0);i([n("_markAllSubMeshesAsFresnelDirty")],s.prototype,"emissiveFresnelParameters",void 0);i([h("useReflectionFresnelFromSpecular")],s.prototype,"_useReflectionFresnelFromSpecular",void 0);i([n("_markAllSubMeshesAsFresnelDirty")],s.prototype,"useReflectionFresnelFromSpecular",void 0);i([h("useGlossinessFromSpecularMapAlpha")],s.prototype,"_useGlossinessFromSpecularMapAlpha",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"useGlossinessFromSpecularMapAlpha",void 0);i([h("maxSimultaneousLights")],s.prototype,"_maxSimultaneousLights",void 0);i([n("_markAllSubMeshesAsLightsDirty")],s.prototype,"maxSimultaneousLights",void 0);i([h("invertNormalMapX")],s.prototype,"_invertNormalMapX",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"invertNormalMapX",void 0);i([h("invertNormalMapY")],s.prototype,"_invertNormalMapY",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"invertNormalMapY",void 0);i([h("twoSidedLighting")],s.prototype,"_twoSidedLighting",void 0);i([n("_markAllSubMeshesAsTexturesDirty")],s.prototype,"twoSidedLighting",void 0);i([h("applyDecalMapAfterDetailMap")],s.prototype,"_applyDecalMapAfterDetailMap",void 0);i([n("_markAllSubMeshesAsMiscDirty")],s.prototype,"applyDecalMapAfterDetailMap",void 0);Re("BABYLON.StandardMaterial",s);V.DefaultMaterialFactory=C=>new s("default material",C);export{s as S}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/state.svelte-CXxGByZZ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/state.svelte-CXxGByZZ.js new file mode 100644 index 0000000000000000000000000000000000000000..f23c6b0227ec2a919f69d19441776eb278e5dd83 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/state.svelte-CXxGByZZ.js @@ -0,0 +1 @@ +import{p as E,k as F,m as L,f as M,q as A}from"./i18n-Dnhn5Rxr.js";import{R as C,u as P,v as R,y as T,x as q,t as S,a as k,T as V,W as $,w as d,V as W,Y as I}from"./index-DWyDLubb.js";import{T as Y}from"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{s as b}from"./index-CglBvmLb.js";var j=$('
          '),B=$('
          ');function N(x,s){C(s,!0);const r=()=>A(c,"$top",o),[o,l]=L();let _=E(s,"messages",19,()=>[]);const c=b(0,{stiffness:.4,damping:.5});let u=P(R([]));T(()=>{g(_())}),T(()=>{q(u,f(_()),!0)});function f(e){const t=new Map;return e.forEach(n=>{const a=n.type;t.has(a)||t.set(a,{type:n.type,messages:[],expanded:!0}),t.get(a).messages.push(n)}),Array.from(t.values())}function g(e){e.length>0&&"parentIFrame"in window&&window.parentIFrame?.getPageInfo(t=>{t.scrollTopt.type===e?{...t,expanded:!t.expanded}:t),!0)}var p=B();F(p,21,()=>d(u),e=>e.type,(e,t)=>{var n=j(),a=W(n);Y(a,{get type(){return d(t).type},get messages(){return d(t).messages},get expanded(){return d(t).expanded},ontoggle:()=>h(d(t).type),onclose:v=>s.on_close(v)}),I(n),k(e,n)}),I(p),S(()=>M(p,`--toast-top: ${r()??""}px;`)),k(x,p),V(),l()}class O{current={};fn_outputs={};fn_inputs={};pending_outputs=new Map;fn_status={};show_progress={};register(s,r,o,l){this.fn_outputs[s]=r,this.fn_inputs[s]=o,this.show_progress[s]=l}clear(s){s in this.current&&(this.current[s]={})}update(s){this.resolve_args(s).forEach(({id:o,queue_position:l,queue_size:_,eta:c,status:u,message:f,progress:g,stream_state:h,time_limit:p,type:e,used_cache:t,cache_duration:n,avg_time:a})=>{this.current[o]={queue:s.queue||!1,queue_size:_,queue_position:l,eta:c,stream_state:h,message:f,progress:g||void 0,status:u,fn_index:s.fn_index,time_limit:p,type:e,show_progress:this.show_progress[s.fn_index],used_cache:t,cache_duration:n,avg_time:a}})}set_status(s,r){this.current[s].status=r}resolve_args(s){const{fn_index:r,status:o,size:l=void 0,position:_=null,eta:c=null,message:u=null,stream_state:f=null,time_limit:g=null,progress_data:h=null,used_cache:p=null,cache_duration:e=null,avg_time:t=null}=s,n=this.fn_outputs[r],a=this.fn_status[r],v=this.fn_inputs[r];return n.concat(v).map(i=>{let m;const y=this.pending_outputs.get(i)||0;if(a==="pending"&&o!=="pending"){let w=y-1;this.pending_outputs.set(i,w<0?0:w),m=w>0?"pending":o}else a==="pending"&&o==="pending"?m="pending":a!=="pending"&&o==="pending"?(m="pending",this.pending_outputs.set(i,y+1)):m=o;const z=v.includes(i)&&f?"input":n.includes(i)?"output":"skip";return{id:i,queue_position:_,queue_size:l,eta:c,status:m,message:u,progress:h,stream_state:f,time_limit:g,type:z,used_cache:p,cache_duration:e,avg_time:t}}).filter(i=>i.type!=="skip")}}export{O as L,N as T}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/stateDiagram-FKZM4ZOC-BLr48BHD.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/stateDiagram-FKZM4ZOC-BLr48BHD.js new file mode 100644 index 0000000000000000000000000000000000000000..066af61e0da1b89244bbcd92446317c829082b53 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/stateDiagram-FKZM4ZOC-BLr48BHD.js @@ -0,0 +1 @@ +import{s as P,a as R,S as N}from"./chunk-DI55MBZ5-vHqaMaYD.js";import{_ as f,c as t,l as S,d as W,j as z,P as _,u as U}from"./mermaid.core-7TB2QPZo.js";import{G as C}from"./graph-BVwx8Qtr.js";import{l as F}from"./layout-BrVEphHT.js";import{s as H}from"./select-BigU4G0v.js";import{l as O,k as J}from"./step-B-Gbak1k.js";import"./chunk-55IACEB6-d9HCWWHk.js";import"./chunk-QN33PNHL-w0eYMV5T.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./dispatch-kxCwF96_.js";import"./_baseUniq-DT1kfcxk.js";import"./min-ljrXhbfm.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(g,B,m){const E=g.append("tspan").attr("x",2*t().state.padding).text(B);m||E.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,x=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(g){a||(d(x,g,s),s=!1),a=!1});const w=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),p=x.node().getBBox(),o=Math.max(p.width,n.width);return w.attr("x2",o+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",o+2*t().state.padding).attr("height",p.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),x=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),p=s.node().getBBox().width+n;let o=Math.max(p,x);o===x&&(o=o+n);let g;const B=e.node().getBBox();i.doc,g=a-c,p>x&&(g=(x-o)/2+c),Math.abs(a-B.x)x&&(g=a-(p-x)/2);const m=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",g).attr("y",m).attr("class",d?"alt-composit":"composit").attr("width",o).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",g+c),p<=x&&s.attr("x",a+(o-n)/2-p/2+c),e.insert("rect",":first-child").attr("x",g).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",o).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",g).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",o).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),j=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),q=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),Z=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let x=e.replace(/\r\n/g,"
          ");x=x.replace(/\n/g,"
          ");const a=x.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const w of a){const p=w.trim();if(p.length>0){const o=l.append("tspan");if(o.text(p),s===0){const g=o.node().getBBox();s+=g.height}n+=s,o.attr("x",i+t().state.noteMargin),o.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),K=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=Z(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&j(n),(i.type==="fork"||i.type==="join")&&q(n,i),i.type==="note"&&K(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),A=0,Q=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=O().x(function(s){return s.x}).y(function(s){return s.y}).curve(J),x=e.append("path").attr("d",l(n)).attr("id","edge"+A).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=_(!0)),x.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:w,y:p}=U.calcLabelPosition(i.points),o=z.getRows(d.title);let g=0;const B=[];let m=0,E=0;for(let u=0;u<=o.length;u++){const h=s.append("text").attr("text-anchor","middle").text(o[u]).attr("x",w).attr("y",p+g),y=h.node().getBBox();m=Math.max(m,y.width),E=Math.min(E,y.x),S.info(y.x,w,p+g),g===0&&(g=h.node().getBBox().height,S.info("Title height",g,p)),B.push(h)}let k=g*o.length;if(o.length>1){const u=(o.length-1)*g*.5;B.forEach((h,y)=>h.attr("y",p+y*g-u)),k=g*o.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",w-m/2-t().state.padding/2).attr("y",p-k/2-t().state.padding/2-3.5).attr("width",m+t().state.padding).attr("height",k+t().state.padding),S.info(r)}A++},"drawEdge"),b,T={},V=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const x=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=x.select(`[id='${i}']`);tt(s);const w=c.db.getRootDoc();G(w,s,void 0,!1,x,a,c);const p=b.padding,o=s.node().getBBox(),g=o.width+p*2,B=o.height+p*2,m=g*1.75;W(s,B,m,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+g+" "+B)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),G=f((e,i,d,c,n,l,x)=>{const a=new C({compound:!0,multigraph:!0});let s,w=!0;for(s=0;s{const y=h.parentElement;let v=0,M=0;y&&(y.parentElement&&(v=y.parentElement.getBBox().width),M=parseInt(y.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",v-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let E=m.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),Q(i,a.edge(r),a.edge(r).relation))}),E=m.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=E.width+2*b.padding,k.height=E.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:V,draw:et},yt={parser:R,get db(){return new N(1)},renderer:it,styles:P,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{yt as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/stateDiagram-v2-4FDKWEC3-BnlJCfwo.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/stateDiagram-v2-4FDKWEC3-BnlJCfwo.js new file mode 100644 index 0000000000000000000000000000000000000000..4165c2a5d7780faa7f445559e0b287e00ca5e2ee --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/stateDiagram-v2-4FDKWEC3-BnlJCfwo.js @@ -0,0 +1 @@ +import{s as r,b as e,a,S as i}from"./chunk-DI55MBZ5-vHqaMaYD.js";import{_ as s}from"./mermaid.core-7TB2QPZo.js";import"./chunk-55IACEB6-d9HCWWHk.js";import"./select-BigU4G0v.js";import"./chunk-QN33PNHL-w0eYMV5T.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./step-B-Gbak1k.js";import"./dispatch-kxCwF96_.js";var f={parser:a,get db(){return new i(2)},renderer:e,styles:r,init:s(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/step-B-Gbak1k.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/step-B-Gbak1k.js new file mode 100644 index 0000000000000000000000000000000000000000..464e8826906e17231ac00d5ae3da431ab922e40c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/step-B-Gbak1k.js @@ -0,0 +1 @@ +function ot(t,i,n){t.prototype=i.prototype=n,n.constructor=t}function Xt(t,i){var n=Object.create(t.prototype);for(var e in i)n[e]=i[e];return n}function H(){}var R=.7,O=1/R,M="\\s*([+-]?\\d+)\\s*",P="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",b="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",si=/^#([0-9a-f]{3,8})$/,hi=new RegExp(`^rgb\\(${M},${M},${M}\\)$`),oi=new RegExp(`^rgb\\(${b},${b},${b}\\)$`),ri=new RegExp(`^rgba\\(${M},${M},${M},${P}\\)$`),ai=new RegExp(`^rgba\\(${b},${b},${b},${P}\\)$`),_i=new RegExp(`^hsl\\(${P},${b},${b}\\)$`),li=new RegExp(`^hsla\\(${P},${b},${b},${P}\\)$`),gt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ot(H,rt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:mt,formatHex:mt,formatHex8:ci,formatHsl:fi,formatRgb:wt,toString:wt});function mt(){return this.rgb().formatHex()}function ci(){return this.rgb().formatHex8()}function fi(){return At(this).formatHsl()}function wt(){return this.rgb().formatRgb()}function rt(t){var i,n;return t=(t+"").trim().toLowerCase(),(i=si.exec(t))?(n=i[1].length,i=parseInt(i[1],16),n===6?vt(i):n===3?new x(i>>8&15|i>>4&240,i>>4&15|i&240,(i&15)<<4|i&15,1):n===8?A(i>>24&255,i>>16&255,i>>8&255,(i&255)/255):n===4?A(i>>12&15|i>>8&240,i>>8&15|i>>4&240,i>>4&15|i&240,((i&15)<<4|i&15)/255):null):(i=hi.exec(t))?new x(i[1],i[2],i[3],1):(i=oi.exec(t))?new x(i[1]*255/100,i[2]*255/100,i[3]*255/100,1):(i=ri.exec(t))?A(i[1],i[2],i[3],i[4]):(i=ai.exec(t))?A(i[1]*255/100,i[2]*255/100,i[3]*255/100,i[4]):(i=_i.exec(t))?Nt(i[1],i[2]/100,i[3]/100,1):(i=li.exec(t))?Nt(i[1],i[2]/100,i[3]/100,i[4]):gt.hasOwnProperty(t)?vt(gt[t]):t==="transparent"?new x(NaN,NaN,NaN,0):null}function vt(t){return new x(t>>16&255,t>>8&255,t&255,1)}function A(t,i,n,e){return e<=0&&(t=i=n=NaN),new x(t,i,n,e)}function ui(t){return t instanceof H||(t=rt(t)),t?(t=t.rgb(),new x(t.r,t.g,t.b,t.opacity)):new x}function Y(t,i,n,e){return arguments.length===1?ui(t):new x(t,i,n,e??1)}function x(t,i,n,e){this.r=+t,this.g=+i,this.b=+n,this.opacity=+e}ot(x,Y,Xt(H,{brighter(t){return t=t==null?O:Math.pow(O,t),new x(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?R:Math.pow(R,t),new x(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new x(k(this.r),k(this.g),k(this.b),j(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:kt,formatHex:kt,formatHex8:xi,formatRgb:$t,toString:$t}));function kt(){return`#${v(this.r)}${v(this.g)}${v(this.b)}`}function xi(){return`#${v(this.r)}${v(this.g)}${v(this.b)}${v((isNaN(this.opacity)?1:this.opacity)*255)}`}function $t(){const t=j(this.opacity);return`${t===1?"rgb(":"rgba("}${k(this.r)}, ${k(this.g)}, ${k(this.b)}${t===1?")":`, ${t})`}`}function j(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function k(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function v(t){return t=k(t),(t<16?"0":"")+t.toString(16)}function Nt(t,i,n,e){return e<=0?t=i=n=NaN:n<=0||n>=1?t=i=NaN:i<=0&&(t=NaN),new p(t,i,n,e)}function At(t){if(t instanceof p)return new p(t.h,t.s,t.l,t.opacity);if(t instanceof H||(t=rt(t)),!t)return new p;if(t instanceof p)return t;t=t.rgb();var i=t.r/255,n=t.g/255,e=t.b/255,s=Math.min(i,n,e),h=Math.max(i,n,e),o=NaN,r=h-s,a=(h+s)/2;return r?(i===h?o=(n-e)/r+(n0&&a<1?0:o,new p(o,r,a,t.opacity)}function pi(t,i,n,e){return arguments.length===1?At(t):new p(t,i,n,e??1)}function p(t,i,n,e){this.h=+t,this.s=+i,this.l=+n,this.opacity=+e}ot(p,pi,Xt(H,{brighter(t){return t=t==null?O:Math.pow(O,t),new p(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?R:Math.pow(R,t),new p(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,i=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,e=n+(n<.5?n:1-n)*i,s=2*n-e;return new x(W(t>=240?t-240:t+120,s,e),W(t,s,e),W(t<120?t+240:t-120,s,e),this.opacity)},clamp(){return new p(Mt(this.h),I(this.s),I(this.l),j(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=j(this.opacity);return`${t===1?"hsl(":"hsla("}${Mt(this.h)}, ${I(this.s)*100}%, ${I(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Mt(t){return t=(t||0)%360,t<0?t+360:t}function I(t){return Math.max(0,Math.min(1,t||0))}function W(t,i,n){return(t<60?i+(n-i)*t/60:t<180?n:t<240?i+(n-i)*(240-t)/60:i)*255}function It(t,i,n,e,s){var h=t*t,o=h*t;return((1-3*t+3*h-o)*i+(4-6*h+3*o)*n+(1+3*t+3*h-3*o)*e+o*s)/6}function di(t){var i=t.length-1;return function(n){var e=n<=0?n=0:n>=1?(n=1,i-1):Math.floor(n*i),s=t[e],h=t[e+1],o=e>0?t[e-1]:2*s-h,r=e()=>t;function Bt(t,i){return function(n){return t+n*i}}function bi(t,i,n){return t=Math.pow(t,n),i=Math.pow(i,n)-t,n=1/n,function(e){return Math.pow(t+e*i,n)}}function Ii(t,i){var n=i-t;return n?Bt(t,n>180||n<-180?n-360*Math.round(n/360):n):at(isNaN(t)?i:t)}function gi(t){return(t=+t)==1?Ot:function(i,n){return n-i?bi(i,n,t):at(isNaN(i)?n:i)}}function Ot(t,i){var n=i-t;return n?Bt(t,n):at(isNaN(t)?i:t)}const Bi=(function t(i){var n=gi(i);function e(s,h){var o=n((s=Y(s)).r,(h=Y(h)).r),r=n(s.g,h.g),a=n(s.b,h.b),l=Ot(s.opacity,h.opacity);return function(_){return s.r=o(_),s.g=r(_),s.b=a(_),s.opacity=l(_),s+""}}return e.gamma=t,e})(1);function Yt(t){return function(i){var n=i.length,e=new Array(n),s=new Array(n),h=new Array(n),o,r;for(o=0;on&&(h=i.slice(n,h),r[o]?r[o]+=h:r[++o]=h),(e=e[0])===(s=s[0])?r[o]?r[o]+=s:r[++o]=s:(r[++o]=null,a.push({i:o,x:m(e,s)})),n=J.lastIndex;return n180?_+=360:_-l>180&&(l+=360),f.push({i:c.push(s(c)+"rotate(",null,e)-2,x:m(l,_)})):_&&c.push(s(c)+"rotate("+_+e)}function r(l,_,c,f){l!==_?f.push({i:c.push(s(c)+"skewX(",null,e)-2,x:m(l,_)}):_&&c.push(s(c)+"skewX("+_+e)}function a(l,_,c,f,u,d){if(l!==c||_!==f){var y=u.push(s(u)+"scale(",null,",",null,")");d.push({i:y-4,x:m(l,c)},{i:y-2,x:m(_,f)})}else(c!==1||f!==1)&&u.push(s(u)+"scale("+c+","+f+")")}return function(l,_){var c=[],f=[];return l=t(l),_=t(_),h(l.translateX,l.translateY,_.translateX,_.translateY,c,f),o(l.rotate,_.rotate,c,f),r(l.skewX,_.skewX,c,f),a(l.scaleX,l.scaleY,_.scaleX,_.scaleY,c,f),l=_=null,function(u){for(var d=-1,y=f.length,X;++d=0&&t._call.call(void 0,i),t=t._next;--T}function Et(){$=(L=q.now())+G,T=S=0;try{Mi()}finally{T=0,Ei(),$=0}}function Ti(){var t=q.now(),i=t-L;i>Lt&&(G-=i,L=t)}function Ei(){for(var t,i=z,n,e=1/0;i;)i._call?(e>i._time&&(e=i._time),t=i,i=i._next):(n=i._next,i._next=null,i=t?t._next=n:z=n);C=t,et(e)}function et(t){if(!T){S&&(S=clearTimeout(S));var i=t-$;i>24?(t<1/0&&(S=setTimeout(Et,t-q.now()-G)),E&&(E=clearInterval(E))):(E||(L=q.now(),E=setInterval(Ti,Lt)),T=1,Dt(Et))}}const st=Math.PI,ht=2*st,w=1e-6,Si=ht-w;function Zt(t){this._+=t[0];for(let i=1,n=t.length;i=0))throw new Error(`invalid digits: ${t}`);if(i>15)return Zt;const n=10**i;return function(e){this._+=e[0];for(let s=1,h=e.length;sw)if(!(Math.abs(c*a-l*_)>w)||!h)this._append`L${this._x1=i},${this._y1=n}`;else{let u=e-o,d=s-r,y=a*a+l*l,X=u*u+d*d,pt=Math.sqrt(y),dt=Math.sqrt(f),yt=h*Math.tan((st-Math.acos((y+f-X)/(2*pt*dt)))/2),V=yt/dt,bt=yt/pt;Math.abs(V-1)>w&&this._append`L${i+V*_},${n+V*c}`,this._append`A${h},${h},0,0,${+(c*u>_*d)},${this._x1=i+bt*a},${this._y1=n+bt*l}`}}arc(i,n,e,s,h,o){if(i=+i,n=+n,e=+e,o=!!o,e<0)throw new Error(`negative radius: ${e}`);let r=e*Math.cos(s),a=e*Math.sin(s),l=i+r,_=n+a,c=1^o,f=o?s-h:h-s;this._x1===null?this._append`M${l},${_}`:(Math.abs(this._x1-l)>w||Math.abs(this._y1-_)>w)&&this._append`L${l},${_}`,e&&(f<0&&(f=f%ht+ht),f>Si?this._append`A${e},${e},0,1,${c},${i-r},${n-a}A${e},${e},0,1,${c},${this._x1=l},${this._y1=_}`:f>w&&this._append`A${e},${e},0,${+(f>=st)},${c},${this._x1=i+e*Math.cos(h)},${this._y1=n+e*Math.sin(h)}`)}rect(i,n,e,s){this._append`M${this._x0=this._x1=+i},${this._y0=this._y1=+n}h${e=+e}v${+s}h${-e}Z`}toString(){return this._}}function Ri(){return new _t}Ri.prototype=_t.prototype;function N(t){return function(){return t}}const Di=Math.abs,Fi=Math.atan2,Zi=Math.cos,Gi=Math.max,Ki=Math.min,Qi=Math.sin,Vi=Math.sqrt,St=1e-12,lt=Math.PI,Ct=lt/2,Wi=2*lt;function Ji(t){return t>1?0:t<-1?lt:Math.acos(t)}function Ui(t){return t>=1?Ct:t<=-1?-Ct:Math.asin(t)}function Pi(t){let i=3;return t.digits=function(n){if(!arguments.length)return i;if(n==null)i=null;else{const e=Math.floor(n);if(!(e>=0))throw new RangeError(`invalid digits: ${n}`);i=e}return t},()=>new _t(i)}function qi(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Gt(t){this._context=t}Gt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;default:this._context.lineTo(t,i);break}}};function Hi(t){return new Gt(t)}function Xi(t){return t[0]}function Ai(t){return t[1]}function tn(t,i){var n=N(!0),e=null,s=Hi,h=null,o=Pi(r);t=typeof t=="function"?t:t===void 0?Xi:N(t),i=typeof i=="function"?i:i===void 0?Ai:N(i);function r(a){var l,_=(a=qi(a)).length,c,f=!1,u;for(e==null&&(h=s(u=o())),l=0;l<=_;++l)!(l<_&&n(c=a[l],l,a))===f&&((f=!f)?h.lineStart():h.lineEnd()),f&&h.point(+t(c,l,a),+i(c,l,a));if(u)return h=null,u+""||null}return r.x=function(a){return arguments.length?(t=typeof a=="function"?a:N(+a),r):t},r.y=function(a){return arguments.length?(i=typeof a=="function"?a:N(+a),r):i},r.defined=function(a){return arguments.length?(n=typeof a=="function"?a:N(!!a),r):n},r.curve=function(a){return arguments.length?(s=a,e!=null&&(h=s(e)),r):s},r.context=function(a){return arguments.length?(a==null?e=h=null:h=s(e=a),r):e},r}function g(){}function D(t,i,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+i)/6,(t._y0+4*t._y1+n)/6)}function K(t){this._context=t}K.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:D(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:D(this,t,i);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}};function nn(t){return new K(t)}function Kt(t){this._context=t}Kt.prototype={areaStart:g,areaEnd:g,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._x2=t,this._y2=i;break;case 1:this._point=2,this._x3=t,this._y3=i;break;case 2:this._point=3,this._x4=t,this._y4=i,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+i)/6);break;default:D(this,t,i);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}};function en(t){return new Kt(t)}function Qt(t){this._context=t}Qt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,e=(this._y0+4*this._y1+i)/6;this._line?this._context.lineTo(n,e):this._context.moveTo(n,e);break;case 3:this._point=4;default:D(this,t,i);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}};function sn(t){return new Qt(t)}function Vt(t,i){this._basis=new K(t),this._beta=i}Vt.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,i=this._y,n=t.length-1;if(n>0)for(var e=t[0],s=i[0],h=t[n]-e,o=i[n]-s,r=-1,a;++r<=n;)a=r/n,this._basis.point(this._beta*t[r]+(1-this._beta)*(e+a*h),this._beta*i[r]+(1-this._beta)*(s+a*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,i){this._x.push(+t),this._y.push(+i)}};const hn=(function t(i){function n(e){return i===1?new K(e):new Vt(e,i)}return n.beta=function(e){return t(+e)},n})(.85);function F(t,i,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-i),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function ct(t,i){this._context=t,this._k=(1-i)/6}ct.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:F(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2,this._x1=t,this._y1=i;break;case 2:this._point=3;default:F(this,t,i);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};const on=(function t(i){function n(e){return new ct(e,i)}return n.tension=function(e){return t(+e)},n})(0);function ft(t,i){this._context=t,this._k=(1-i)/6}ft.prototype={areaStart:g,areaEnd:g,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._x3=t,this._y3=i;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=i);break;case 2:this._point=3,this._x5=t,this._y5=i;break;default:F(this,t,i);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};const rn=(function t(i){function n(e){return new ft(e,i)}return n.tension=function(e){return t(+e)},n})(0);function ut(t,i){this._context=t,this._k=(1-i)/6}ut.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:F(this,t,i);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};const an=(function t(i){function n(e){return new ut(e,i)}return n.tension=function(e){return t(+e)},n})(0);function xt(t,i,n){var e=t._x1,s=t._y1,h=t._x2,o=t._y2;if(t._l01_a>St){var r=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,a=3*t._l01_a*(t._l01_a+t._l12_a);e=(e*r-t._x0*t._l12_2a+t._x2*t._l01_2a)/a,s=(s*r-t._y0*t._l12_2a+t._y2*t._l01_2a)/a}if(t._l23_a>St){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,_=3*t._l23_a*(t._l23_a+t._l12_a);h=(h*l+t._x1*t._l23_2a-i*t._l12_2a)/_,o=(o*l+t._y1*t._l23_2a-n*t._l12_2a)/_}t._context.bezierCurveTo(e,s,h,o,t._x2,t._y2)}function Wt(t,i){this._context=t,this._alpha=i}Wt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,e=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+e*e,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3;default:xt(this,t,i);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};const _n=(function t(i){function n(e){return i?new Wt(e,i):new ct(e,0)}return n.alpha=function(e){return t(+e)},n})(.5);function Jt(t,i){this._context=t,this._alpha=i}Jt.prototype={areaStart:g,areaEnd:g,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,e=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+e*e,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=i;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=i);break;case 2:this._point=3,this._x5=t,this._y5=i;break;default:xt(this,t,i);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};const ln=(function t(i){function n(e){return i?new Jt(e,i):new ft(e,0)}return n.alpha=function(e){return t(+e)},n})(.5);function Ut(t,i){this._context=t,this._alpha=i}Ut.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,e=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+e*e,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:xt(this,t,i);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};const cn=(function t(i){function n(e){return i?new Ut(e,i):new ut(e,0)}return n.alpha=function(e){return t(+e)},n})(.5);function ti(t){this._context=t}ti.prototype={areaStart:g,areaEnd:g,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,i){t=+t,i=+i,this._point?this._context.lineTo(t,i):(this._point=1,this._context.moveTo(t,i))}};function fn(t){return new ti(t)}function Rt(t){return t<0?-1:1}function Pt(t,i,n){var e=t._x1-t._x0,s=i-t._x1,h=(t._y1-t._y0)/(e||s<0&&-0),o=(n-t._y1)/(s||e<0&&-0),r=(h*s+o*e)/(e+s);return(Rt(h)+Rt(o))*Math.min(Math.abs(h),Math.abs(o),.5*Math.abs(r))||0}function qt(t,i){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-i)/2:i}function U(t,i,n){var e=t._x0,s=t._y0,h=t._x1,o=t._y1,r=(h-e)/3;t._context.bezierCurveTo(e+r,s+r*i,h-r,o-r*n,h,o)}function Z(t){this._context=t}Z.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:U(this,this._t0,qt(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){var n=NaN;if(t=+t,i=+i,!(t===this._x1&&i===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3,U(this,qt(this,n=Pt(this,t,i)),n);break;default:U(this,this._t0,n=Pt(this,t,i));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i,this._t0=n}}};function ii(t){this._context=new ni(t)}(ii.prototype=Object.create(Z.prototype)).point=function(t,i){Z.prototype.point.call(this,i,t)};function ni(t){this._context=t}ni.prototype={moveTo:function(t,i){this._context.moveTo(i,t)},closePath:function(){this._context.closePath()},lineTo:function(t,i){this._context.lineTo(i,t)},bezierCurveTo:function(t,i,n,e,s,h){this._context.bezierCurveTo(i,t,e,n,h,s)}};function un(t){return new Z(t)}function xn(t){return new ii(t)}function ei(t){this._context=t}ei.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,i=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],i[0]):this._context.moveTo(t[0],i[0]),n===2)this._context.lineTo(t[1],i[1]);else for(var e=Ht(t),s=Ht(i),h=0,o=1;o=0;--i)s[i]=(o[i]-s[i+1])/h[i];for(h[n-1]=(t[n]+s[n-1])/2,i=0;i=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,i),this._context.lineTo(t,i);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,i)}break}}this._x=t,this._y=i}};function dn(t){return new Q(t,.5)}function yn(t){return new Q(t,0)}function bn(t){return new Q(t,1)}export{yi as $,Ot as A,Ii as B,H as C,yn as D,bn as E,dn as F,pn as G,un as H,xn as I,fn as J,Hi as K,cn as L,ln as M,_n as N,rn as O,an as P,on as Q,x as R,hn as S,sn as T,en as U,Ri as V,Y as W,pi as X,R as Y,O as Z,di as _,N as a,Oi as a0,Yi as a1,zi as a2,Li as a3,nt as a4,Ft as a5,Ni as a6,Xi as a7,Ai as a8,Vi as b,Zi as c,Di as d,St as e,Fi as f,Gi as g,Ct as h,Ui as i,Ji as j,nn as k,tn as l,Ki as m,qi as n,at as o,lt as p,m as q,rt as r,Qi as s,Wi as t,Bi as u,ji as v,Pi as w,ui as x,ot as y,Xt as z}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/stex-C3f8Ysf7.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/stex-C3f8Ysf7.js new file mode 100644 index 0000000000000000000000000000000000000000..cec927db562e526dcf103304ced75b4a4917f73d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/stex-C3f8Ysf7.js @@ -0,0 +1 @@ +function k(b){function h(t,n){t.cmdState.push(n)}function g(t){return t.cmdState.length>0?t.cmdState[t.cmdState.length-1]:null}function p(t){var n=t.cmdState.pop();n&&n.closeBracket()}function s(t){for(var n=t.cmdState,e=n.length-1;e>=0;e--){var a=n[e];if(a.name!="DEFAULT")return a}return{styleIdentifier:function(){return null}}}function i(t,n,e){return function(){this.name=t,this.bracketNo=0,this.style=n,this.styles=e,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var r={};r.importmodule=i("importmodule","tag",["string","builtin"]),r.documentclass=i("documentclass","tag",["","atom"]),r.usepackage=i("usepackage","tag",["atom"]),r.begin=i("begin","tag",["atom"]),r.end=i("end","tag",["atom"]),r.label=i("label","tag",["atom"]),r.ref=i("ref","tag",["atom"]),r.eqref=i("eqref","tag",["atom"]),r.cite=i("cite","tag",["atom"]),r.bibitem=i("bibitem","tag",["atom"]),r.Bibitem=i("Bibitem","tag",["atom"]),r.RBibitem=i("RBibitem","tag",["atom"]),r.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function f(t,n){t.f=n}function l(t,n){var e;if(t.match(/^\\[a-zA-Z@\xc0-\u1fff\u2060-\uffff]+/)){var a=t.current().slice(1);return e=r.hasOwnProperty(a)?r[a]:r.DEFAULT,e=new e,h(n,e),f(n,d),e.style}if(t.match(/^\\[$&%#{}_]/)||t.match(/^\\[,;!\/\\]/))return"tag";if(t.match("\\["))return f(n,function(m,c){return o(m,c,"\\]")}),"keyword";if(t.match("\\("))return f(n,function(m,c){return o(m,c,"\\)")}),"keyword";if(t.match("$$"))return f(n,function(m,c){return o(m,c,"$$")}),"keyword";if(t.match("$"))return f(n,function(m,c){return o(m,c,"$")}),"keyword";var u=t.next();if(u=="%")return t.skipToEnd(),"comment";if(u=="}"||u=="]"){if(e=g(n),e)e.closeBracket(u),f(n,d);else return"error";return"bracket"}else return u=="{"||u=="["?(e=r.DEFAULT,e=new e,h(n,e),"bracket"):/\d/.test(u)?(t.eatWhile(/[\w.%]/),"atom"):(t.eatWhile(/[\w\-_]/),e=s(n),e.name=="begin"&&(e.argument=t.current()),e.styleIdentifier())}function o(t,n,e){if(t.eatSpace())return null;if(e&&t.match(e))return f(n,l),"keyword";if(t.match(/^\\[a-zA-Z@]+/))return"tag";if(t.match(/^[a-zA-Z]+/))return"variableName.special";if(t.match(/^\\[$&%#{}_]/)||t.match(/^\\[,;!\/]/)||t.match(/^[\^_&]/))return"tag";if(t.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(t.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var a=t.next();return a=="{"||a=="}"||a=="["||a=="]"||a=="("||a==")"?"bracket":a=="%"?(t.skipToEnd(),"comment"):"error"}function d(t,n){var e=t.peek(),a;return e=="{"||e=="["?(a=g(n),a.openBracket(e),t.eat(e),f(n,l),"bracket"):/[ \t\r]/.test(e)?(t.eat(e),null):(f(n,l),p(n),l(t,n))}return{name:"stex",startState:function(){var t=b?function(n,e){return o(n,e)}:l;return{cmdState:[],f:t}},copyState:function(t){return{cmdState:t.cmdState.slice(),f:t.f}},token:function(t,n){return n.f(t,n)},blankLine:function(t){t.f=l,t.cmdState.length=0},languageData:{commentTokens:{line:"%"}}}}const y=k(!1),S=k(!0);export{y as stex,S as stexMath}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/stlFileLoader-TUWjk2So.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/stlFileLoader-TUWjk2So.js new file mode 100644 index 0000000000000000000000000000000000000000..6807baaa3d9c3a368a70abf361c6029068c2b6e4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/stlFileLoader-TUWjk2So.js @@ -0,0 +1 @@ +import{aw as O,l as g,d as N,J as d,ax as I}from"./index-CDrXokXW.js";import{A as b}from"./assetContainer-D7EiOqw6.js";import"./standardMaterial-C4-ZPPCc.js";import"./index-DWyDLubb.js";class f{constructor(){this.solidPattern=/solid (\S*)([\S\s]*?)endsolid[ ]*(\S*)/g,this.facetsPattern=/facet([\s\S]*?)endfacet/g,this.normalPattern=/normal[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.vertexPattern=/vertex[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.name=O.name,this.extensions=O.extensions}importMesh(r,o,t,i,c){let s;if(typeof t!="string"){if(this._isBinary(t)){const e=new g("stlmesh",o);return this._parseBinary(e,t),c&&c.push(e),!0}t=new TextDecoder().decode(new Uint8Array(t))}for(;s=this.solidPattern.exec(t);){let e=s[1];const u=s[3];if(u&&e!=u)return N.Error("Error in STL, solid name != endsolid name"),!1;if(r&&e){if(r instanceof Array){if(!r.indexOf(e))continue}else if(e!==r)continue}e=e||"stlmesh";const a=new g(e,o);this._parseASCII(a,s[2]),c&&c.push(a)}return!0}load(r,o,t){return this.importMesh(null,r,o,t,null)}loadAssetContainer(r,o,t){const i=new b(r);return r._blockEntityCollection=!0,this.importMesh(null,r,o,t,i.meshes),r._blockEntityCollection=!1,i}_isBinary(r){const o=new DataView(r);if(o.byteLength<=80)return!1;const t=32/8*3+32/8*3*3+16/8,i=o.getUint32(80,!0);if(80+32/8+i*t===o.byteLength)return!0;const c=[115,111,108,105,100];for(let s=0;s<5;s++)if(o.getUint8(s)!==c[s])return!0;return!1}_parseBinary(r,o){const t=new DataView(o),i=t.getUint32(80,!0),c=84,s=50;let e=0;const u=new Float32Array(i*3*3),a=new Float32Array(i*3*3),l=new Uint32Array(i*3);let n=0;for(let E=0;En.length){A.Error("Unable to load TGA file - Not enough data");return}c+=r.id_length;let _=!1,f=!1,p=!1;switch(r.image_type){case L:_=!0;case U:f=!0;break;case O:_=!0;case d:break;case Y:_=!0;case N:p=!0;break}let m;const u=r.pixel_size>>3,g=r.width*r.height*u;let s;if(f&&(s=n.subarray(c,c+=r.colormap_length*(r.colormap_size>>3))),_){m=new Uint8Array(g);let I,y,w,b=0;const T=new Uint8Array(u);for(;c>z){default:case C:h=0,i=1,l=r.width,a=0,t=1,e=r.height;break;case P:h=0,i=1,l=r.width,a=r.height-1,t=-1,e=-1;break;case M:h=r.width-1,i=-1,l=-1,a=0,t=1,e=r.height;break;case B:h=r.width-1,i=-1,l=-1,a=r.height-1,t=-1,e=-1;break}const x="_getImageData"+(p?"Grey":"")+r.pixel_size+"bits",D=j[x](r,s,m,a,t,e,h,i,l);o.getEngine()._uploadDataToTextureDirectly(o,D)}function H(o,n,c,r,_,f,p,m,u){const g=c,s=n,h=o.width,a=o.height;let i,t=0,e,l;const x=new Uint8Array(h*a*4);for(l=r;l!==f;l+=_)for(e=p;e!==u;e+=m,t++)i=g[t],x[(e+h*l)*4+3]=255,x[(e+h*l)*4+2]=s[i*3+0],x[(e+h*l)*4+1]=s[i*3+1],x[(e+h*l)*4+0]=s[i*3+2];return x}function S(o,n,c,r,_,f,p,m,u){const g=c,s=o.width,h=o.height;let a,i=0,t,e;const l=new Uint8Array(s*h*4);for(e=r;e!==f;e+=_)for(t=p;t!==u;t+=m,i+=2){a=g[i+0]+(g[i+1]<<8);const x=((a&31744)>>10)*255/31|0,D=((a&992)>>5)*255/31|0,E=(a&31)*255/31|0;l[(t+s*e)*4+0]=x,l[(t+s*e)*4+1]=D,l[(t+s*e)*4+2]=E,l[(t+s*e)*4+3]=a&32768?0:255}return l}function X(o,n,c,r,_,f,p,m,u){const g=c,s=o.width,h=o.height;let a=0,i,t;const e=new Uint8Array(s*h*4);for(t=r;t!==f;t+=_)for(i=p;i!==u;i+=m,a+=3)e[(i+s*t)*4+3]=255,e[(i+s*t)*4+2]=g[a+0],e[(i+s*t)*4+1]=g[a+1],e[(i+s*t)*4+0]=g[a+2];return e}function v(o,n,c,r,_,f,p,m,u){const g=c,s=o.width,h=o.height;let a=0,i,t;const e=new Uint8Array(s*h*4);for(t=r;t!==f;t+=_)for(i=p;i!==u;i+=m,a+=4)e[(i+s*t)*4+2]=g[a+0],e[(i+s*t)*4+1]=g[a+1],e[(i+s*t)*4+0]=g[a+2],e[(i+s*t)*4+3]=g[a+3];return e}function F(o,n,c,r,_,f,p,m,u){const g=c,s=o.width,h=o.height;let a,i=0,t,e;const l=new Uint8Array(s*h*4);for(e=r;e!==f;e+=_)for(t=p;t!==u;t+=m,i++)a=g[i],l[(t+s*e)*4+0]=a,l[(t+s*e)*4+1]=a,l[(t+s*e)*4+2]=a,l[(t+s*e)*4+3]=255;return l}function K(o,n,c,r,_,f,p,m,u){const g=c,s=o.width,h=o.height;let a=0,i,t;const e=new Uint8Array(s*h*4);for(t=r;t!==f;t+=_)for(i=p;i!==u;i+=m,a+=2)e[(i+s*t)*4+0]=g[a+0],e[(i+s*t)*4+1]=g[a+0],e[(i+s*t)*4+2]=g[a+0],e[(i+s*t)*4+3]=g[a+1];return e}const j={GetTGAHeader:G,UploadContent:R,_getImageData8bits:H,_getImageData16bits:S,_getImageData24bits:X,_getImageData32bits:v,_getImageDataGrey8bits:F,_getImageDataGrey16bits:K};class Q{constructor(){this.supportCascades=!1}loadCubeData(){throw".env not supported in Cube."}loadData(n,c,r){const _=new Uint8Array(n.buffer,n.byteOffset,n.byteLength),f=G(_);r(f.width,f.height,c.generateMipMaps,!1,()=>{R(c,_)})}}export{Q as _TGATextureLoader}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/th-CTbdxu88.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/th-CTbdxu88.js new file mode 100644 index 0000000000000000000000000000000000000000..ff6af8f29aedf729126a7f65ad6244fbd11c1604 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/th-CTbdxu88.js @@ -0,0 +1 @@ +const o="ภาษาไทย",e={annotated_image:"รูปภาพที่มีคำอธิบาย"},t={allow_recording_access:"กรุณาอนุญาตการเข้าถึงไมโครโฟนเพื่อบันทึกเสียง",audio:"เสียง",drop_to_upload:"ลากและวางไฟล์เสียงที่นี่เพื่ออัปโหลด",record_from_microphone:"บันทึกจากไมโครโฟน",stop_recording:"หยุดบันทึก",no_device_support:"ไม่สามารถเข้าถึงอุปกรณ์สื่อได้ โปรดตรวจสอบว่าคุณใช้งานบนโดเมนที่ปลอดภัย (https) หรือ localhost (หรือคุณได้กำหนดค่า SSL ที่ถูกต้อง) และอนุญาตให้เบราว์เซอร์เข้าถึงอุปกรณ์ของคุณ",stop:"หยุด",resume:"ทำงานต่อ",record:"บันทึก",no_microphone:"ไม่พบไมโครโฟน",pause:"หยุดชั่วคราว",play:"เล่น",waiting:"กำลังรอ"},r={connection_can_break:"บนมือถือ การเชื่อมต่ออาจหลุดหากแท็บนี้ไม่ได้อยู่ในโฟกัสหรืออุปกรณ์เข้าสู่โหมดพัก ส่งผลให้เสียตำแหน่งในคิว",long_requests_queue:"มีคิวคำขอรออยู่เป็นจำนวนมาก คัดลอก Space นี้เพื่อข้ามคิว",lost_connection:"การเชื่อมต่อขาดหายเนื่องจากออกจากหน้า กำลังเข้าคิวใหม่...",waiting_for_inputs:"กำลังรอไฟล์อัปโหลดเสร็จ กรุณาลองใหม่"},_={checkbox:"กล่องเลือก",checkbox_group:"กลุ่มกล่องเลือก"},c={code:"โค้ด"},a={color_picker:"ตัวเลือกสี"},n={built_with:"สร้างด้วย",built_with_gradio:"สร้างด้วย Gradio",clear:"ล้าง",download:"ดาวน์โหลด",edit:"แก้ไข",empty:"ว่างเปล่า",error:"ข้อผิดพลาด",hosted_on:"โฮสต์บน",loading:"กำลังโหลด",logo:"โลโก้",or:"หรือ",remove:"ลบ",settings:"การตั้งค่า",share:"แชร์",submit:"ส่ง",undo:"เลิกทำ",no_devices:"ไม่พบอุปกรณ์",language:"ภาษา",display_theme:"ธีมการแสดงผล",pwa:"โปรเกรสซีฟเว็บแอป"},d={incorrect_format:"รูปแบบไม่ถูกต้อง รองรับเฉพาะไฟล์ CSV และ TSV",new_column:"เพิ่มคอลัมน์",new_row:"แถวใหม่",add_row_above:"เพิ่มแถวด้านบน",add_row_below:"เพิ่มแถวด้านล่าง",delete_row:"ลบแถว",delete_column:"ลบคอลัมน์",add_column_left:"เพิ่มคอลัมน์ทางซ้าย",add_column_right:"เพิ่มคอลัมน์ทางขวา",sort_column:"เรียงลำดับคอลัมน์",sort_ascending:"เรียงจากน้อยไปมาก",sort_descending:"เรียงจากมากไปน้อย",drop_to_upload:"ลากและวางไฟล์ CSV หรือ TSV ที่นี่เพื่อนำเข้าข้อมูลลงในตาราง",clear_sort:"ล้างการเรียงลำดับ"},s={dropdown:"เมนูดรอปดาวน์"},i={build_error:"เกิดข้อผิดพลาดในการสร้าง",config_error:"เกิดข้อผิดพลาดในการกำหนดค่า",contact_page_author:"โปรดติดต่อผู้ดูแลเพจเพื่อแจ้งให้ทราบ",no_app_file:"ไม่พบไฟล์แอป",runtime_error:"เกิดข้อผิดพลาดขณะทำงาน",space_not_working:'"Space ใช้งานไม่ได้เนื่องจาก" {0}',space_paused:"Space ถูกหยุดชั่วคราว",use_via_api:"ใช้งานผ่าน API",use_via_api_or_mcp:"ใช้งานผ่าน API หรือ MCP"},l={uploading:"กำลังอัปโหลด..."},p={highlighted_text:"ข้อความที่ถูกเน้น"},u={allow_webcam_access:"กรุณาอนุญาตการเข้าถึงเว็บแคมเพื่อบันทึกภาพ",brush_color:"สีแปรง",brush_radius:"ขนาดแปรง",image:"รูปภาพ",remove_image:"ลบรูปภาพ",select_brush_color:"เลือกสีแปรง",start_drawing:"เริ่มวาด",use_brush:"ใช้แปรง",drop_to_upload:"ลากและวางไฟล์รูปภาพที่นี่เพื่ออัปโหลด"},g={label:"ป้ายกำกับ"},m={enable_cookies:"หากคุณเข้าใช้งาน HuggingFace Space ในโหมดไม่ระบุตัวตน คุณต้องเปิดใช้งานคุกกี้ของบุคคลที่สาม",incorrect_credentials:"ชื่อผู้ใช้หรือรหัสผ่านไม่ถูกต้อง",username:"ชื่อผู้ใช้",password:"รหัสผ่าน",login:"เข้าสู่ระบบ"},b={number:"ตัวเลข"},h={plot:"กราฟ"},w={radio:"ปุ่มตัวเลือก"},k={slider:"แถบเลื่อน"},f={click_to_upload:"คลิกเพื่ออัปโหลด",drop_audio:"ลากและวางไฟล์เสียงที่นี่",drop_csv:"ลากและวางไฟล์ CSV ที่นี่",drop_file:"ลากและวางไฟล์ที่นี่",drop_image:"ลากและวางไฟล์รูปภาพที่นี่",drop_video:"ลากและวางไฟล์วิดีโอที่นี่",drop_gallery:"ลากและวางไฟล์สื่อที่นี่",paste_clipboard:"วางจากคลิปบอร์ด"},S={drop_to_upload:"ลากและวางไฟล์วิดีโอที่นี่เพื่ออัปโหลด"},v={edit:"แก้ไข",retry:"ลองใหม่",undo:"เลิกทำ",submit:"ส่ง",cancel:"ยกเลิก",like:"ถูกใจ",dislike:"ไม่ถูกใจ",clear:"ล้างการสนทนา"},x={_name:o,"3D_model":{"3d_model":"โมเดล 3 มิติ",drop_to_upload:"ลากและวางไฟล์โมเดล 3 มิติ (.obj, .glb, .stl, .gltf, .splat, หรือ .ply) ที่นี่เพื่ออัปโหลด"},annotated_image:e,audio:t,blocks:r,checkbox:_,code:c,color_picker:a,common:n,dataframe:d,dropdown:s,errors:i,file:l,highlighted_text:p,image:u,label:g,login:m,number:b,plot:h,radio:w,slider:k,upload_text:f,video:S,chatbot:v};export{o as _name,e as annotated_image,t as audio,r as blocks,v as chatbot,_ as checkbox,c as code,a as color_picker,n as common,d as dataframe,x as default,s as dropdown,i as errors,l as file,p as highlighted_text,u as image,g as label,m as login,b as number,h as plot,w as radio,k as slider,f as upload_text,S as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/thinInstanceMesh-BDN_yrTe.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/thinInstanceMesh-BDN_yrTe.js new file mode 100644 index 0000000000000000000000000000000000000000..72b2ab7b6a7c276f15fc92ab179b71f9ee08023a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/thinInstanceMesh-BDN_yrTe.js @@ -0,0 +1 @@ +import{l as i,L as S,M as c,J as s,au as g,av as _,c as u,V as B}from"./index-CDrXokXW.js";i.prototype.thinInstanceAdd=function(t,e=!0){if(!this.getScene().getEngine().getCaps().instancedArrays)return S.Error("Thin Instances are not supported on this device as Instanced Array extension not supported"),-1;this._thinInstanceUpdateBufferSize("matrix",Array.isArray(t)?t.length:1);const a=this._thinInstanceDataStorage.instancesCount;if(Array.isArray(t))for(let n=0;n=this._thinInstanceDataStorage.instancesCount)return!1;const n=this._thinInstanceDataStorage.matrixData;return e.copyToArray(n,t*16),this._thinInstanceDataStorage.worldMatrices&&(this._thinInstanceDataStorage.worldMatrices[t]=e),a&&(this.thinInstanceBufferUpdated("matrix"),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)),!0};i.prototype.thinInstanceSetAttributeAt=function(t,e,a,n=!0){return t===s.ColorKind&&(t=s.ColorInstanceKind),!this._userThinInstanceBuffersStorage||!this._userThinInstanceBuffersStorage.data[t]||e>=this._thinInstanceDataStorage.instancesCount?!1:(this._thinInstanceUpdateBufferSize(t,0),this._userThinInstanceBuffersStorage.data[t].set(a,e*this._userThinInstanceBuffersStorage.strides[t]),n&&this.thinInstanceBufferUpdated(t),!0)};Object.defineProperty(i.prototype,"thinInstanceCount",{get:function(){return this._thinInstanceDataStorage.instancesCount},set:function(t){const e=this._thinInstanceDataStorage.matrixData??this.source?._thinInstanceDataStorage.matrixData,a=e?e.length/16:0;t<=a&&(this._thinInstanceDataStorage.instancesCount=t)},enumerable:!0,configurable:!0});i.prototype._thinInstanceCreateMatrixBuffer=function(t,e,a=!0){const n=new g(this.getEngine(),e,!a,16,!1,!0);for(let o=0;o<4;o++)this.setVerticesBuffer(n.createVertexBuffer(t+o,o*4,4));return n};i.prototype.thinInstanceSetBuffer=function(t,e,a=0,n=!0){if(a=a||16,t==="matrix")this._thinInstanceDataStorage.matrixBuffer?.dispose(),this._thinInstanceDataStorage.matrixBuffer=null,this._thinInstanceDataStorage.matrixBufferSize=e?e.length:32*a,this._thinInstanceDataStorage.matrixData=e,this._thinInstanceDataStorage.worldMatrices=null,e!==null?(this._thinInstanceDataStorage.instancesCount=e.length/a,this._thinInstanceDataStorage.matrixBuffer=this._thinInstanceCreateMatrixBuffer("world",e,n),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)):(this._thinInstanceDataStorage.instancesCount=0,this.doNotSyncBoundingInfo||this.refreshBoundingInfo());else if(t==="previousMatrix")this._thinInstanceDataStorage.previousMatrixBuffer?.dispose(),this._thinInstanceDataStorage.previousMatrixBuffer=null,this._thinInstanceDataStorage.previousMatrixData=e,e!==null&&(this._thinInstanceDataStorage.previousMatrixBuffer=this._thinInstanceCreateMatrixBuffer("previousWorld",e,n));else if(t==="splatIndex"&&e){this._thinInstanceInitializeUserStorage(),this._thinInstanceDataStorage.instancesCount=e.length/a,this._userThinInstanceBuffersStorage.data[t]=e,this._userThinInstanceBuffersStorage.strides[t]=a,this._userThinInstanceBuffersStorage.sizes[t]=e.length;const o=new g(this.getEngine(),e,!0,16,!1,!0);this._thinInstanceDataStorage.matrixBuffer=o;for(let r=0;r<4;r++)this.setVerticesBuffer(o.createVertexBuffer(t+r,r*4,4))}else t===s.ColorKind&&(t=s.ColorInstanceKind),e===null?this._userThinInstanceBuffersStorage?.data[t]&&(this.removeVerticesData(t),delete this._userThinInstanceBuffersStorage.data[t],delete this._userThinInstanceBuffersStorage.strides[t],delete this._userThinInstanceBuffersStorage.sizes[t],delete this._userThinInstanceBuffersStorage.vertexBuffers[t]):(this._thinInstanceInitializeUserStorage(),this._userThinInstanceBuffersStorage.data[t]=e,this._userThinInstanceBuffersStorage.strides[t]=a,this._userThinInstanceBuffersStorage.sizes[t]=e.length,this._userThinInstanceBuffersStorage.vertexBuffers[t]=new s(this.getEngine(),e,t,!n,!1,a,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[t]))};i.prototype.thinInstanceBufferUpdated=function(t){t==="matrix"?(this.thinInstanceAllowAutomaticStaticBufferRecreation&&this._thinInstanceDataStorage.matrixBuffer&&!this._thinInstanceDataStorage.matrixBuffer.isUpdatable()&&this._thinInstanceRecreateBuffer(t),this._thinInstanceDataStorage.matrixBuffer?.updateDirectly(this._thinInstanceDataStorage.matrixData,0,this._thinInstanceDataStorage.instancesCount)):t==="previousMatrix"?(this.thinInstanceAllowAutomaticStaticBufferRecreation&&this._thinInstanceDataStorage.previousMatrixBuffer&&!this._thinInstanceDataStorage.previousMatrixBuffer.isUpdatable()&&this._thinInstanceRecreateBuffer(t),this._thinInstanceDataStorage.previousMatrixBuffer?.updateDirectly(this._thinInstanceDataStorage.previousMatrixData,0,this._thinInstanceDataStorage.instancesCount)):t==="splatIndex"?this._thinInstanceDataStorage.matrixBuffer?.updateDirectly(this._userThinInstanceBuffersStorage.data[t],0,this._thinInstanceDataStorage.instancesCount):(t===s.ColorKind&&(t=s.ColorInstanceKind),this._userThinInstanceBuffersStorage?.vertexBuffers[t]&&(this.thinInstanceAllowAutomaticStaticBufferRecreation&&!this._userThinInstanceBuffersStorage.vertexBuffers[t].isUpdatable()&&this._thinInstanceRecreateBuffer(t),this._userThinInstanceBuffersStorage.vertexBuffers[t].updateDirectly(this._userThinInstanceBuffersStorage.data[t],0)))};i.prototype.thinInstancePartialBufferUpdate=function(t,e,a){t==="matrix"?this._thinInstanceDataStorage.matrixBuffer&&this._thinInstanceDataStorage.matrixBuffer.updateDirectly(e,a):(t===s.ColorKind&&(t=s.ColorInstanceKind),this._userThinInstanceBuffersStorage?.vertexBuffers[t]&&this._userThinInstanceBuffersStorage.vertexBuffers[t].updateDirectly(e,a))};i.prototype.thinInstanceGetWorldMatrices=function(){if(!this._thinInstanceDataStorage.matrixData||!this._thinInstanceDataStorage.matrixBuffer)return[];const t=this._thinInstanceDataStorage.matrixData;if(!this._thinInstanceDataStorage.worldMatrices){this._thinInstanceDataStorage.worldMatrices=[];for(let e=0;e=r)&&(t=r);else{let r=-1;for(let i of e)(i=n(i,++r,e))!=null&&(t=i)&&(t=i)}return t}function ar(e,n){let t;if(n===void 0)for(const r of e)r!=null&&(t>r||t===void 0&&r>=r)&&(t=r);else{let r=-1;for(let i of e)(i=n(i,++r,e))!=null&&(t>i||t===void 0&&i>=i)&&(t=i)}return t}const kn=Math.PI/180,In=180/Math.PI,ee=18,ze=.96422,qe=1,Qe=.82521,Ve=4/29,Q=6/29,_e=3*Q*Q,On=Q*Q*Q;function Je(e){if(e instanceof x)return new x(e.l,e.a,e.b,e.opacity);if(e instanceof L)return Xe(e);e instanceof de||(e=Yn(e));var n=fe(e.r),t=fe(e.g),r=fe(e.b),i=ce((.2225045*n+.7168786*t+.0606169*r)/qe),a,c;return n===t&&t===r?a=c=i:(a=ce((.4360747*n+.3850649*t+.1430804*r)/ze),c=ce((.0139322*n+.0971045*t+.7141733*r)/Qe)),new x(116*i-16,500*(a-i),200*(i-c),e.opacity)}function An(e,n,t,r){return arguments.length===1?Je(e):new x(e,n,t,r??1)}function x(e,n,t,r){this.l=+e,this.a=+n,this.b=+t,this.opacity=+r}Ze(x,An,Pe(Re,{brighter(e){return new x(this.l+ee*(e??1),this.a,this.b,this.opacity)},darker(e){return new x(this.l-ee*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,n=isNaN(this.a)?e:e+this.a/500,t=isNaN(this.b)?e:e-this.b/200;return n=ze*se(n),e=qe*se(e),t=Qe*se(t),new de(le(3.1338561*n-1.6168667*e-.4906146*t),le(-.9787684*n+1.9161415*e+.033454*t),le(.0719453*n-.2289914*e+1.4052427*t),this.opacity)}}));function ce(e){return e>On?Math.pow(e,1/3):e/_e+Ve}function se(e){return e>Q?e*e*e:_e*(e-Ve)}function le(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function fe(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function dn(e){if(e instanceof L)return new L(e.h,e.c,e.l,e.opacity);if(e instanceof x||(e=Je(e)),e.a===0&&e.b===0)return new L(NaN,0(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),n(a,1),e(a),a),i.round=a=>{const c=i(a),h=i.ceil(a);return a-c(n(a=new Date(+a),c==null?1:Math.floor(c)),a),i.range=(a,c,h)=>{const U=[];if(a=i.ceil(a),h=h==null?1:Math.floor(h),!(a0))return U;let y;do U.push(y=new Date(+a)),n(a,h),e(a);while(yM(c=>{if(c>=c)for(;e(c),!a(c);)c.setTime(c-1)},(c,h)=>{if(c>=c)if(h<0)for(;++h<=0;)for(;n(c,-1),!a(c););else for(;--h>=0;)for(;n(c,1),!a(c););}),t&&(i.count=(a,c)=>(ge.setTime(+a),he.setTime(+c),e(ge),e(he),Math.floor(t(ge,he))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(r?c=>r(c)%a===0:c=>i.count(0,c)%a===0):i)),i}const ne=M(()=>{},(e,n)=>{e.setTime(+e+n)},(e,n)=>n-e);ne.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?M(n=>{n.setTime(Math.floor(n/e)*e)},(n,t)=>{n.setTime(+n+t*e)},(n,t)=>(t-n)/e):ne);ne.range;const N=1e3,Y=N*60,k=Y*60,I=k*24,Ce=I*7,Fe=I*30,me=I*365,q=M(e=>{e.setTime(e-e.getMilliseconds())},(e,n)=>{e.setTime(+e+n*N)},(e,n)=>(n-e)/N,e=>e.getUTCSeconds());q.range;const Ue=M(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*N)},(e,n)=>{e.setTime(+e+n*Y)},(e,n)=>(n-e)/Y,e=>e.getMinutes());Ue.range;const $e=M(e=>{e.setUTCSeconds(0,0)},(e,n)=>{e.setTime(+e+n*Y)},(e,n)=>(n-e)/Y,e=>e.getUTCMinutes());$e.range;const De=M(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*N-e.getMinutes()*Y)},(e,n)=>{e.setTime(+e+n*k)},(e,n)=>(n-e)/k,e=>e.getHours());De.range;const je=M(e=>{e.setUTCMinutes(0,0,0)},(e,n)=>{e.setTime(+e+n*k)},(e,n)=>(n-e)/k,e=>e.getUTCHours());je.range;const G=M(e=>e.setHours(0,0,0,0),(e,n)=>e.setDate(e.getDate()+n),(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Y)/I,e=>e.getDate()-1);G.range;const pe=M(e=>{e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n)},(e,n)=>(n-e)/I,e=>e.getUTCDate()-1);pe.range;const Ge=M(e=>{e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n)},(e,n)=>(n-e)/I,e=>Math.floor(e/I));Ge.range;function P(e){return M(n=>{n.setDate(n.getDate()-(n.getDay()+7-e)%7),n.setHours(0,0,0,0)},(n,t)=>{n.setDate(n.getDate()+t*7)},(n,t)=>(t-n-(t.getTimezoneOffset()-n.getTimezoneOffset())*Y)/Ce)}const ue=P(0),te=P(1),Pn=P(2),Rn=P(3),V=P(4),zn=P(5),qn=P(6);ue.range;te.range;Pn.range;Rn.range;V.range;zn.range;qn.range;function R(e){return M(n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-e)%7),n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCDate(n.getUTCDate()+t*7)},(n,t)=>(t-n)/Ce)}const ve=R(0),re=R(1),Qn=R(2),Vn=R(3),_=R(4),_n=R(5),Jn=R(6);ve.range;re.range;Qn.range;Vn.range;_.range;_n.range;Jn.range;const we=M(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,n)=>{e.setMonth(e.getMonth()+n)},(e,n)=>n.getMonth()-e.getMonth()+(n.getFullYear()-e.getFullYear())*12,e=>e.getMonth());we.range;const Ee=M(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCMonth(e.getUTCMonth()+n)},(e,n)=>n.getUTCMonth()-e.getUTCMonth()+(n.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Ee.range;const O=M(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n)},(e,n)=>n.getFullYear()-e.getFullYear(),e=>e.getFullYear());O.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:M(n=>{n.setFullYear(Math.floor(n.getFullYear()/e)*e),n.setMonth(0,1),n.setHours(0,0,0,0)},(n,t)=>{n.setFullYear(n.getFullYear()+t*e)});O.range;const d=M(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n)},(e,n)=>n.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());d.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:M(n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/e)*e),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCFullYear(n.getUTCFullYear()+t*e)});d.range;function Ke(e,n,t,r,i,a){const c=[[q,1,N],[q,5,5*N],[q,15,15*N],[q,30,30*N],[a,1,Y],[a,5,5*Y],[a,15,15*Y],[a,30,30*Y],[i,1,k],[i,3,3*k],[i,6,6*k],[i,12,12*k],[r,1,I],[r,2,2*I],[t,1,Ce],[n,1,Fe],[n,3,3*Fe],[e,1,me]];function h(y,T,F){const D=TX).right(c,D);if(w===c.length)return e.every(Se(y/me,T/me,F));if(w===0)return ne.every(Math.max(Se(y,T,F),1));const[A,J]=c[D/c[w-1][2]53)return null;"w"in u||(u.w=1),"Z"in u?(m=Te(B(u.y,0,1)),b=m.getUTCDay(),m=b>4||b===0?re.ceil(m):re(m),m=pe.offset(m,(u.V-1)*7),u.y=m.getUTCFullYear(),u.m=m.getUTCMonth(),u.d=m.getUTCDate()+(u.w+6)%7):(m=ye(B(u.y,0,1)),b=m.getDay(),m=b>4||b===0?te.ceil(m):te(m),m=G.offset(m,(u.V-1)*7),u.y=m.getFullYear(),u.m=m.getMonth(),u.d=m.getDate()+(u.w+6)%7)}else("W"in u||"U"in u)&&("w"in u||(u.w="u"in u?u.u%7:"W"in u?1:0),b="Z"in u?Te(B(u.y,0,1)).getUTCDay():ye(B(u.y,0,1)).getDay(),u.m=0,u.d="W"in u?(u.w+6)%7+u.W*7-(b+5)%7:u.w+u.U*7-(b+6)%7);return"Z"in u?(u.H+=u.Z/100|0,u.M+=u.Z%100,Te(u)):ye(u)}}function E(o,l,f,u){for(var v=0,m=l.length,b=f.length,S,Z;v=b)return-1;if(S=l.charCodeAt(v++),S===37){if(S=l.charAt(v++),Z=ie[S in Ye?l.charAt(v++):S],!Z||(u=Z(o,f,u))<0)return-1}else if(S!=f.charCodeAt(u++))return-1}return u}function on(o,l,f){var u=y.exec(l.slice(f));return u?(o.p=T.get(u[0].toLowerCase()),f+u[0].length):-1}function cn(o,l,f){var u=w.exec(l.slice(f));return u?(o.w=A.get(u[0].toLowerCase()),f+u[0].length):-1}function sn(o,l,f){var u=F.exec(l.slice(f));return u?(o.w=D.get(u[0].toLowerCase()),f+u[0].length):-1}function ln(o,l,f){var u=ae.exec(l.slice(f));return u?(o.m=oe.get(u[0].toLowerCase()),f+u[0].length):-1}function fn(o,l,f){var u=J.exec(l.slice(f));return u?(o.m=X.get(u[0].toLowerCase()),f+u[0].length):-1}function gn(o,l,f){return E(o,n,l,f)}function hn(o,l,f){return E(o,t,l,f)}function mn(o,l,f){return E(o,r,l,f)}function yn(o){return c[o.getDay()]}function Tn(o){return a[o.getDay()]}function Mn(o){return U[o.getMonth()]}function Cn(o){return h[o.getMonth()]}function Un(o){return i[+(o.getHours()>=12)]}function Dn(o){return 1+~~(o.getMonth()/3)}function pn(o){return c[o.getUTCDay()]}function vn(o){return a[o.getUTCDay()]}function wn(o){return U[o.getUTCMonth()]}function bn(o){return h[o.getUTCMonth()]}function Sn(o){return i[+(o.getUTCHours()>=12)]}function Fn(o){return 1+~~(o.getUTCMonth()/3)}return{format:function(o){var l=s(o+="",H);return l.toString=function(){return o},l},parse:function(o){var l=p(o+="",!1);return l.toString=function(){return o},l},utcFormat:function(o){var l=s(o+="",W);return l.toString=function(){return o},l},utcParse:function(o){var l=p(o+="",!0);return l.toString=function(){return o},l}}}var Ye={"-":"",_:" ",0:"0"},C=/^\s*\d+/,jn=/^%/,Gn=/[\\^$*+?|[\]().{}]/g;function g(e,n,t){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a[n.toLowerCase(),t]))}function Kn(e,n,t){var r=C.exec(n.slice(t,t+1));return r?(e.w=+r[0],t+r[0].length):-1}function et(e,n,t){var r=C.exec(n.slice(t,t+1));return r?(e.u=+r[0],t+r[0].length):-1}function nt(e,n,t){var r=C.exec(n.slice(t,t+2));return r?(e.U=+r[0],t+r[0].length):-1}function tt(e,n,t){var r=C.exec(n.slice(t,t+2));return r?(e.V=+r[0],t+r[0].length):-1}function rt(e,n,t){var r=C.exec(n.slice(t,t+2));return r?(e.W=+r[0],t+r[0].length):-1}function xe(e,n,t){var r=C.exec(n.slice(t,t+4));return r?(e.y=+r[0],t+r[0].length):-1}function He(e,n,t){var r=C.exec(n.slice(t,t+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),t+r[0].length):-1}function ut(e,n,t){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(t,t+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),t+r[0].length):-1}function at(e,n,t){var r=C.exec(n.slice(t,t+1));return r?(e.q=r[0]*3-3,t+r[0].length):-1}function ot(e,n,t){var r=C.exec(n.slice(t,t+2));return r?(e.m=r[0]-1,t+r[0].length):-1}function We(e,n,t){var r=C.exec(n.slice(t,t+2));return r?(e.d=+r[0],t+r[0].length):-1}function it(e,n,t){var r=C.exec(n.slice(t,t+3));return r?(e.m=0,e.d=+r[0],t+r[0].length):-1}function Le(e,n,t){var r=C.exec(n.slice(t,t+2));return r?(e.H=+r[0],t+r[0].length):-1}function ct(e,n,t){var r=C.exec(n.slice(t,t+2));return r?(e.M=+r[0],t+r[0].length):-1}function st(e,n,t){var r=C.exec(n.slice(t,t+2));return r?(e.S=+r[0],t+r[0].length):-1}function lt(e,n,t){var r=C.exec(n.slice(t,t+3));return r?(e.L=+r[0],t+r[0].length):-1}function ft(e,n,t){var r=C.exec(n.slice(t,t+6));return r?(e.L=Math.floor(r[0]/1e3),t+r[0].length):-1}function gt(e,n,t){var r=jn.exec(n.slice(t,t+1));return r?t+r[0].length:-1}function ht(e,n,t){var r=C.exec(n.slice(t));return r?(e.Q=+r[0],t+r[0].length):-1}function mt(e,n,t){var r=C.exec(n.slice(t));return r?(e.s=+r[0],t+r[0].length):-1}function Ne(e,n){return g(e.getDate(),n,2)}function yt(e,n){return g(e.getHours(),n,2)}function Tt(e,n){return g(e.getHours()%12||12,n,2)}function Mt(e,n){return g(1+G.count(O(e),e),n,3)}function en(e,n){return g(e.getMilliseconds(),n,3)}function Ct(e,n){return en(e,n)+"000"}function Ut(e,n){return g(e.getMonth()+1,n,2)}function Dt(e,n){return g(e.getMinutes(),n,2)}function pt(e,n){return g(e.getSeconds(),n,2)}function vt(e){var n=e.getDay();return n===0?7:n}function wt(e,n){return g(ue.count(O(e)-1,e),n,2)}function nn(e){var n=e.getDay();return n>=4||n===0?V(e):V.ceil(e)}function bt(e,n){return e=nn(e),g(V.count(O(e),e)+(O(e).getDay()===4),n,2)}function St(e){return e.getDay()}function Ft(e,n){return g(te.count(O(e)-1,e),n,2)}function Yt(e,n){return g(e.getFullYear()%100,n,2)}function xt(e,n){return e=nn(e),g(e.getFullYear()%100,n,2)}function Ht(e,n){return g(e.getFullYear()%1e4,n,4)}function Wt(e,n){var t=e.getDay();return e=t>=4||t===0?V(e):V.ceil(e),g(e.getFullYear()%1e4,n,4)}function Lt(e){var n=e.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+g(n/60|0,"0",2)+g(n%60,"0",2)}function ke(e,n){return g(e.getUTCDate(),n,2)}function Nt(e,n){return g(e.getUTCHours(),n,2)}function kt(e,n){return g(e.getUTCHours()%12||12,n,2)}function It(e,n){return g(1+pe.count(d(e),e),n,3)}function tn(e,n){return g(e.getUTCMilliseconds(),n,3)}function Ot(e,n){return tn(e,n)+"000"}function At(e,n){return g(e.getUTCMonth()+1,n,2)}function dt(e,n){return g(e.getUTCMinutes(),n,2)}function Zt(e,n){return g(e.getUTCSeconds(),n,2)}function Pt(e){var n=e.getUTCDay();return n===0?7:n}function Rt(e,n){return g(ve.count(d(e)-1,e),n,2)}function rn(e){var n=e.getUTCDay();return n>=4||n===0?_(e):_.ceil(e)}function zt(e,n){return e=rn(e),g(_.count(d(e),e)+(d(e).getUTCDay()===4),n,2)}function qt(e){return e.getUTCDay()}function Qt(e,n){return g(re.count(d(e)-1,e),n,2)}function Vt(e,n){return g(e.getUTCFullYear()%100,n,2)}function _t(e,n){return e=rn(e),g(e.getUTCFullYear()%100,n,2)}function Jt(e,n){return g(e.getUTCFullYear()%1e4,n,4)}function Xt(e,n){var t=e.getUTCDay();return e=t>=4||t===0?_(e):_.ceil(e),g(e.getUTCFullYear()%1e4,n,4)}function Bt(){return"+0000"}function Ie(){return"%"}function Oe(e){return+e}function Ae(e){return Math.floor(+e/1e3)}var z,un,$t,jt,Gt;Et({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Et(e){return z=$n(e),un=z.format,$t=z.parse,jt=z.utcFormat,Gt=z.utcParse,z}function Kt(e){return new Date(e)}function er(e){return e instanceof Date?+e:+new Date(+e)}function an(e,n,t,r,i,a,c,h,U,y){var T=Wn(),F=T.invert,D=T.domain,w=y(".%L"),A=y(":%S"),J=y("%I:%M"),X=y("%I %p"),ae=y("%a %d"),oe=y("%b %d"),H=y("%B"),W=y("%Y");function ie(s){return(U(s)"u"&&(g.yylloc={});var M=g.yylloc;o.push(M);var z=g.options&&g.options.ranges;typeof b.yy.parseError=="function"?this.parseError=b.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Z(T){c.length=c.length-2*T,y.length=y.length-T,o.length=o.length-T}s(Z,"popStack");function tt(){var T;return T=u.pop()||g.lex()||U,typeof T!="number"&&(T instanceof Array&&(u=T,T=u.pop()),T=a.symbols_[T]||T),T}s(tt,"lex");for(var S,A,I,J,R={},B,$,et,O;;){if(A=c[c.length-1],this.defaultActions[A]?I=this.defaultActions[A]:((S===null||typeof S>"u")&&(S=tt()),I=w[A]&&w[A][S]),typeof I>"u"||!I.length||!I[0]){var K="";O=[];for(B in w[A])this.terminals_[B]&&B>W&&O.push("'"+this.terminals_[B]+"'");g.showPosition?K="Parse error on line "+(N+1)+`: +`+g.showPosition()+` +Expecting `+O.join(", ")+", got '"+(this.terminals_[S]||S)+"'":K="Parse error on line "+(N+1)+": Unexpected "+(S==U?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(K,{text:g.match,token:this.terminals_[S]||S,line:g.yylineno,loc:M,expected:O})}if(I[0]instanceof Array&&I.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+S);switch(I[0]){case 1:c.push(S),y.push(g.yytext),o.push(g.yylloc),c.push(I[1]),S=null,P=g.yyleng,v=g.yytext,N=g.yylineno,M=g.yylloc;break;case 2:if($=this.productions_[I[1]][1],R.$=y[y.length-$],R._$={first_line:o[o.length-($||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-($||1)].first_column,last_column:o[o.length-1].last_column},z&&(R._$.range=[o[o.length-($||1)].range[0],o[o.length-1].range[1]]),J=this.performAction.apply(R,[v,P,N,b.yy,I[1],y,o].concat(H)),typeof J<"u")return J;$&&(c=c.slice(0,-1*$*2),y=y.slice(0,-1*$),o=o.slice(0,-1*$)),c.push(this.productions_[I[1]][0]),y.push(R.$),o.push(R._$),et=w[c[c.length-2]][c[c.length-1]],c.push(et);break;case 3:return!0}}return!0},"parse")},k=(function(){var x={EOF:1,parseError:s(function(a,c){if(this.yy.parser)this.yy.parser.parseError(a,c);else throw new Error(a)},"parseError"),setInput:s(function(r,a){return this.yy=a||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var a=r.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var a=r.length,c=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var y=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===u.length?this.yylloc.first_column:0)+u[u.length-c.length].length-c[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[y[0],y[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),a=new Array(r.length+1).join("-");return r+this.upcomingInput()+` +`+a+"^"},"showPosition"),test_match:s(function(r,a){var c,u,y;if(this.options.backtrack_lexer&&(y={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(y.yylloc.range=this.yylloc.range.slice(0))),u=r[0].match(/(?:\r\n?|\n).*/g),u&&(this.yylineno+=u.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:u?u[u.length-1].length-u[u.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],c=this.performAction.call(this,this.yy,this,a,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var o in y)this[o]=y[o];return!1}return!1},"test_match"),next:s(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,a,c,u;this._more||(this.yytext="",this.match="");for(var y=this._currentRules(),o=0;oa[0].length)){if(a=c,u=o,this.options.backtrack_lexer){if(r=this.test_match(c,y[o]),r!==!1)return r;if(this._backtrack){a=!1;continue}else return!1}else if(!this.options.flex)break}return a?(r=this.test_match(a,y[u]),r!==!1?r:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:s(function(){var a=this.next();return a||this.lex()},"lex"),begin:s(function(a){this.conditionStack.push(a)},"begin"),popState:s(function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:s(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:s(function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},"topState"),pushState:s(function(a){this.begin(a)},"pushState"),stateStackSize:s(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:s(function(a,c,u,y){switch(u){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),14;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 21;case 16:return 20;case 17:return 6;case 18:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18],inclusive:!0}}};return x})();p.lexer=k;function _(){this.yy={}}return s(_,"Parser"),_.prototype=p,p.Parser=_,new _})();Q.parser=Q;var Tt=Q,at={};wt(at,{addEvent:()=>yt,addSection:()=>ht,addTask:()=>pt,addTaskOrg:()=>gt,clear:()=>ct,default:()=>It,getCommonDb:()=>ot,getSections:()=>dt,getTasks:()=>ut});var F="",lt=0,X=[],G=[],V=[],ot=s(()=>St,"getCommonDb"),ct=s(function(){X.length=0,G.length=0,F="",V.length=0,Et()},"clear"),ht=s(function(n){F=n,X.push(n)},"addSection"),dt=s(function(){return X},"getSections"),ut=s(function(){let n=it();const t=100;let e=0;for(;!n&&ee.id===lt-1).events.push(n)},"addEvent"),gt=s(function(n){const t={section:F,type:F,description:n,task:n,classes:[]};G.push(t)},"addTaskOrg"),it=s(function(){const n=s(function(e){return V[e].processed},"compileTask");let t=!0;for(const[e,l]of V.entries())n(e),t=t&&l.processed;return t},"compileTasks"),It={clear:ct,getCommonDb:ot,addSection:ht,getSections:dt,getTasks:ut,addTask:pt,addTaskOrg:gt,addEvent:yt},Nt=12,q=s(function(n,t){const e=n.append("rect");return e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),e.attr("rx",t.rx),e.attr("ry",t.ry),t.class!==void 0&&e.attr("class",t.class),e},"drawRect"),Lt=s(function(n,t){const l=n.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),i=n.append("g");i.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),i.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function d(m){const p=nt().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);m.append("path").attr("class","mouth").attr("d",p).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}s(d,"smile");function h(m){const p=nt().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);m.append("path").attr("class","mouth").attr("d",p).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}s(h,"sad");function f(m){m.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return s(f,"ambivalent"),t.score>3?d(i):t.score<3?h(i):f(i),l},"drawFace"),Mt=s(function(n,t){const e=n.append("circle");return e.attr("cx",t.cx),e.attr("cy",t.cy),e.attr("class","actor-"+t.pos),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("r",t.r),e.class!==void 0&&e.attr("class",e.class),t.title!==void 0&&e.append("title").text(t.title),e},"drawCircle"),ft=s(function(n,t){const e=t.text.replace(//gi," "),l=n.append("text");l.attr("x",t.x),l.attr("y",t.y),l.attr("class","legend"),l.style("text-anchor",t.anchor),t.class!==void 0&&l.attr("class",t.class);const i=l.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.text(e),l},"drawText"),$t=s(function(n,t){function e(i,d,h,f,m){return i+","+d+" "+(i+h)+","+d+" "+(i+h)+","+(d+f-m)+" "+(i+h-m*1.2)+","+(d+f)+" "+i+","+(d+f)}s(e,"genPoints");const l=n.append("polygon");l.attr("points",e(t.x,t.y,50,20,7)),l.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,ft(n,t)},"drawLabel"),Ht=s(function(n,t,e){const l=n.append("g"),i=Y();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=e.width,i.height=e.height,i.class="journey-section section-type-"+t.num,i.rx=3,i.ry=3,q(l,i),mt(e)(t.text,l,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+t.num},e,t.colour)},"drawSection"),rt=-1,Pt=s(function(n,t,e){const l=t.x+e.width/2,i=n.append("g");rt++,i.append("line").attr("id","task"+rt).attr("x1",l).attr("y1",t.y).attr("x2",l).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Lt(i,{cx:l,cy:300+(5-t.score)*30,score:t.score});const h=Y();h.x=t.x,h.y=t.y,h.fill=t.fill,h.width=e.width,h.height=e.height,h.class="task task-type-"+t.num,h.rx=3,h.ry=3,q(i,h),mt(e)(t.task,i,h.x,h.y,h.width,h.height,{class:"task"},e,t.colour)},"drawTask"),At=s(function(n,t){q(n,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),Ct=s(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),Y=s(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),mt=(function(){function n(i,d,h,f,m,p,k,_){const x=d.append("text").attr("x",h+m/2).attr("y",f+p/2+5).style("font-color",_).style("text-anchor","middle").text(i);l(x,k)}s(n,"byText");function t(i,d,h,f,m,p,k,_,x){const{taskFontSize:r,taskFontFamily:a}=_,c=i.split(//gi);for(let u=0;u)/).reverse(),i,d=[],h=1.1,f=e.attr("y"),m=parseFloat(e.attr("dy")),p=e.text(null).append("tspan").attr("x",0).attr("y",f).attr("dy",m+"em");for(let k=0;kt||i==="
          ")&&(d.pop(),p.text(d.join(" ").trim()),i==="
          "?d=[""]:d=[i],p=e.append("tspan").attr("x",0).attr("y",f).attr("dy",h+"em").text(i))})}s(D,"wrap");var Ft=s(function(n,t,e,l){const i=e%Nt-1,d=n.append("g");t.section=i,d.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+i));const h=d.append("g"),f=d.append("g"),p=f.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(D,t.width).node().getBBox(),k=l.fontSize?.replace?l.fontSize.replace("px",""):l.fontSize;return t.height=p.height+k*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,f.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),Wt(h,t,i,l),t},"drawNode"),Vt=s(function(n,t,e){const l=n.append("g"),d=l.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(D,t.width).node().getBBox(),h=e.fontSize?.replace?e.fontSize.replace("px",""):e.fontSize;return l.remove(),d.height+h*1.1*.5+t.padding},"getVirtualNodeHeight"),Wt=s(function(n,t,e){n.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("d",`M0 ${t.height-5} v${-t.height+10} q0,-5 5,-5 h${t.width-10} q5,0 5,5 v${t.height-5} H0 Z`),n.append("line").attr("class","node-line-"+e).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),C={drawRect:q,drawCircle:Mt,drawSection:Ht,drawText:ft,drawLabel:$t,drawTask:Pt,drawBackgroundRect:At,getTextObj:Ct,getNoteRect:Y,initGraphics:Rt,drawNode:Ft,getVirtualNodeHeight:Vt},zt=s(function(n,t,e,l){const i=xt(),d=i.timeline?.leftMargin??50;E.debug("timeline",l.db);const h=i.securityLevel;let f;h==="sandbox"&&(f=j("#i"+t));const p=(h==="sandbox"?j(f.nodes()[0].contentDocument.body):j("body")).select("#"+t);p.append("g");const k=l.db.getTasks(),_=l.db.getCommonDb().getDiagramTitle();E.debug("task",k),C.initGraphics(p);const x=l.db.getSections();E.debug("sections",x);let r=0,a=0,c=0,u=0,y=50+d,o=50;u=50;let w=0,v=!0;x.forEach(function(H){const g={number:w,descr:H,section:w,width:150,padding:20,maxHeight:r},b=C.getVirtualNodeHeight(p,g,i);E.debug("sectionHeight before draw",b),r=Math.max(r,b+20)});let N=0,P=0;E.debug("tasks.length",k.length);for(const[H,g]of k.entries()){const b={number:H,descr:g,section:g.section,width:150,padding:20,maxHeight:a},L=C.getVirtualNodeHeight(p,b,i);E.debug("taskHeight before draw",L),a=Math.max(a,L+20),N=Math.max(N,g.events.length);let M=0;for(const z of g.events){const Z={descr:z,section:g.section,number:g.section,width:150,padding:20,maxHeight:50};M+=C.getVirtualNodeHeight(p,Z,i)}g.events.length>0&&(M+=(g.events.length-1)*10),P=Math.max(P,M)}E.debug("maxSectionHeight before draw",r),E.debug("maxTaskHeight before draw",a),x&&x.length>0?x.forEach(H=>{const g=k.filter(z=>z.section===H),b={number:w,descr:H,section:w,width:200*Math.max(g.length,1)-50,padding:20,maxHeight:r};E.debug("sectionNode",b);const L=p.append("g"),M=C.drawNode(L,b,w,i);E.debug("sectionNode output",M),L.attr("transform",`translate(${y}, ${u})`),o+=r+50,g.length>0&&st(p,g,w,y,o,a,i,N,P,r,!1),y+=200*Math.max(g.length,1),o=u,w++}):(v=!1,st(p,k,w,y,o,a,i,N,P,r,!0));const W=p.node().getBBox();E.debug("bounds",W),_&&p.append("text").text(_).attr("x",W.width/2-d).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),c=v?r+a+150:a+100,p.append("g").attr("class","lineWrapper").append("line").attr("x1",d).attr("y1",c).attr("x2",W.width+3*d).attr("y2",c).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),kt(void 0,p,i.timeline?.padding??50,i.timeline?.useMaxWidth??!1)},"draw"),st=s(function(n,t,e,l,i,d,h,f,m,p,k){for(const _ of t){const x={descr:_.task,section:e,number:e,width:150,padding:20,maxHeight:d};E.debug("taskNode",x);const r=n.append("g").attr("class","taskWrapper"),c=C.drawNode(r,x,e,h).height;if(E.debug("taskHeight after draw",c),r.attr("transform",`translate(${l}, ${i})`),d=Math.max(d,c),_.events){const u=n.append("g").attr("class","lineWrapper");let y=d;i+=100,y=y+Bt(n,_.events,e,l,i,h),i-=100,u.append("line").attr("x1",l+190/2).attr("y1",i+d).attr("x2",l+190/2).attr("y2",i+d+100+m+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5")}l=l+200,k&&!h.timeline?.disableMulticolor&&e++}i=i-10},"drawTasks"),Bt=s(function(n,t,e,l,i,d){let h=0;const f=i;i=i+100;for(const m of t){const p={descr:m,section:e,number:e,width:150,padding:20,maxHeight:50};E.debug("eventNode",p);const k=n.append("g").attr("class","eventWrapper"),x=C.drawNode(k,p,e,d).height;h=h+x,k.attr("transform",`translate(${l}, ${i})`),i=i+10+x}return i=f,h},"drawEvents"),Ot={setConf:s(()=>{},"setConf"),draw:zt},jt=s(n=>{let t="";for(let e=0;e` + .edge { + stroke-width: 3; + } + ${jt(n)} + .section-root rect, .section-root path, .section-root circle { + fill: ${n.git0}; + } + .section-root text { + fill: ${n.gitBranchLabel0}; + } + .icon-container { + height:100%; + display: flex; + justify-content: center; + align-items: center; + } + .edge { + fill: none; + } + .eventWrapper { + filter: brightness(120%); + } +`,"getStyles"),qt=Gt,Dt={db:at,renderer:Ot,parser:Tt,styles:qt};export{Dt as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/tinycolor-BQBUvzv5.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/tinycolor-BQBUvzv5.js new file mode 100644 index 0000000000000000000000000000000000000000..7ba6ce16a29fed177c39526c0b8dc077b3e70dcf --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/tinycolor-BQBUvzv5.js @@ -0,0 +1 @@ +import"./i18n-Dnhn5Rxr.js";import{a as T,f as C}from"./index-DWyDLubb.js";var E=C('');function it(t){var r=E();T(t,r)}function _(t){"@babel/helpers - typeof";return _=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_(t)}var I=/^\s+/,P=/\s+$/;function s(t,r){if(t=t||"",r=r||{},t instanceof s)return t;if(!(this instanceof s))return new s(t,r);var e=N(t);this._originalInput=t,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=Math.round(100*this._a)/100,this._format=r.format||e.format,this._gradientType=r.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=e.ok}s.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var r=this.toRgb();return(r.r*299+r.g*587+r.b*114)/1e3},getLuminance:function(){var r=this.toRgb(),e,a,i,n,h,f;return e=r.r/255,a=r.g/255,i=r.b/255,e<=.03928?n=e/12.92:n=Math.pow((e+.055)/1.055,2.4),a<=.03928?h=a/12.92:h=Math.pow((a+.055)/1.055,2.4),i<=.03928?f=i/12.92:f=Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*h+.0722*f},setAlpha:function(r){return this._a=R(r),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var r=A(this._r,this._g,this._b);return{h:r.h*360,s:r.s,v:r.v,a:this._a}},toHsvString:function(){var r=A(this._r,this._g,this._b),e=Math.round(r.h*360),a=Math.round(r.s*100),i=Math.round(r.v*100);return this._a==1?"hsv("+e+", "+a+"%, "+i+"%)":"hsva("+e+", "+a+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var r=x(this._r,this._g,this._b);return{h:r.h*360,s:r.s,l:r.l,a:this._a}},toHslString:function(){var r=x(this._r,this._g,this._b),e=Math.round(r.h*360),a=Math.round(r.s*100),i=Math.round(r.l*100);return this._a==1?"hsl("+e+", "+a+"%, "+i+"%)":"hsla("+e+", "+a+"%, "+i+"%, "+this._roundA+")"},toHex:function(r){return S(this._r,this._g,this._b,r)},toHexString:function(r){return"#"+this.toHex(r)},toHex8:function(r){return G(this._r,this._g,this._b,this._a,r)},toHex8String:function(r){return"#"+this.toHex8(r)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(u(this._r,255)*100)+"%",g:Math.round(u(this._g,255)*100)+"%",b:Math.round(u(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(u(this._r,255)*100)+"%, "+Math.round(u(this._g,255)*100)+"%, "+Math.round(u(this._b,255)*100)+"%)":"rgba("+Math.round(u(this._r,255)*100)+"%, "+Math.round(u(this._g,255)*100)+"%, "+Math.round(u(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:K[S(this._r,this._g,this._b,!0)]||!1},toFilter:function(r){var e="#"+k(this._r,this._g,this._b,this._a),a=e,i=this._gradientType?"GradientType = 1, ":"";if(r){var n=s(r);a="#"+k(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+a+")"},toString:function(r){var e=!!r;r=r||this._format;var a=!1,i=this._a<1&&this._a>=0,n=!e&&i&&(r==="hex"||r==="hex6"||r==="hex3"||r==="hex4"||r==="hex8"||r==="name");return n?r==="name"&&this._a===0?this.toName():this.toRgbString():(r==="rgb"&&(a=this.toRgbString()),r==="prgb"&&(a=this.toPercentageRgbString()),(r==="hex"||r==="hex6")&&(a=this.toHexString()),r==="hex3"&&(a=this.toHexString(!0)),r==="hex4"&&(a=this.toHex8String(!0)),r==="hex8"&&(a=this.toHex8String()),r==="name"&&(a=this.toName()),r==="hsl"&&(a=this.toHslString()),r==="hsv"&&(a=this.toHsvString()),a||this.toHexString())},clone:function(){return s(this.toString())},_applyModification:function(r,e){var a=r.apply(null,[this].concat([].slice.call(e)));return this._r=a._r,this._g=a._g,this._b=a._b,this.setAlpha(a._a),this},lighten:function(){return this._applyModification(U,arguments)},brighten:function(){return this._applyModification(V,arguments)},darken:function(){return this._applyModification($,arguments)},desaturate:function(){return this._applyModification(O,arguments)},saturate:function(){return this._applyModification(q,arguments)},greyscale:function(){return this._applyModification(D,arguments)},spin:function(){return this._applyModification(j,arguments)},_applyCombination:function(r,e){return r.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(X,arguments)},complement:function(){return this._applyCombination(Z,arguments)},monochromatic:function(){return this._applyCombination(J,arguments)},splitcomplement:function(){return this._applyCombination(W,arguments)},triad:function(){return this._applyCombination(w,[3])},tetrad:function(){return this._applyCombination(w,[4])}};s.fromRatio=function(t,r){if(_(t)=="object"){var e={};for(var a in t)t.hasOwnProperty(a)&&(a==="a"?e[a]=t[a]:e[a]=m(t[a]));t=e}return s(t,r)};function N(t){var r={r:0,g:0,b:0},e=1,a=null,i=null,n=null,h=!1,f=!1;return typeof t=="string"&&(t=et(t)),_(t)=="object"&&(p(t.r)&&p(t.g)&&p(t.b)?(r=L(t.r,t.g,t.b),h=!0,f=String(t.r).substr(-1)==="%"?"prgb":"rgb"):p(t.h)&&p(t.s)&&p(t.v)?(a=m(t.s),i=m(t.v),r=z(t.h,a,i),h=!0,f="hsv"):p(t.h)&&p(t.s)&&p(t.l)&&(a=m(t.s),n=m(t.l),r=B(t.h,a,n),h=!0,f="hsl"),t.hasOwnProperty("a")&&(e=t.a)),e=R(e),{ok:h,format:t.format||f,r:Math.min(255,Math.max(r.r,0)),g:Math.min(255,Math.max(r.g,0)),b:Math.min(255,Math.max(r.b,0)),a:e}}function L(t,r,e){return{r:u(t,255)*255,g:u(r,255)*255,b:u(e,255)*255}}function x(t,r,e){t=u(t,255),r=u(r,255),e=u(e,255);var a=Math.max(t,r,e),i=Math.min(t,r,e),n,h,f=(a+i)/2;if(a==i)n=h=0;else{var o=a-i;switch(h=f>.5?o/(2-a-i):o/(a+i),a){case t:n=(r-e)/o+(r1&&(d-=1),d<1/6?g+(v-g)*6*d:d<1/2?v:d<2/3?g+(v-g)*(2/3-d)*6:g}if(r===0)a=i=n=e;else{var f=e<.5?e*(1+r):e+r-e*r,o=2*e-f;a=h(o,f,t+1/3),i=h(o,f,t),n=h(o,f,t-1/3)}return{r:a*255,g:i*255,b:n*255}}function A(t,r,e){t=u(t,255),r=u(r,255),e=u(e,255);var a=Math.max(t,r,e),i=Math.min(t,r,e),n,h,f=a,o=a-i;if(h=a===0?0:o/a,a==i)n=0;else{switch(a){case t:n=(r-e)/o+(r>1)+720)%360;--r;)a.h=(a.h+i)%360,n.push(s(a));return n}function J(t,r){r=r||6;for(var e=s(t).toHsv(),a=e.h,i=e.s,n=e.v,h=[],f=1/r;r--;)h.push(s({h:a,s:i,v:n})),n=(n+f)%1;return h}s.mix=function(t,r,e){e=e===0?0:e||50;var a=s(t).toRgb(),i=s(r).toRgb(),n=e/100,h={r:(i.r-a.r)*n+a.r,g:(i.g-a.g)*n+a.g,b:(i.b-a.b)*n+a.b,a:(i.a-a.a)*n+a.a};return s(h)};s.readability=function(t,r){var e=s(t),a=s(r);return(Math.max(e.getLuminance(),a.getLuminance())+.05)/(Math.min(e.getLuminance(),a.getLuminance())+.05)};s.isReadable=function(t,r,e){var a=s.readability(t,r),i,n;switch(n=!1,i=rt(e),i.level+i.size){case"AAsmall":case"AAAlarge":n=a>=4.5;break;case"AAlarge":n=a>=3;break;case"AAAsmall":n=a>=7;break}return n};s.mostReadable=function(t,r,e){var a=null,i=0,n,h,f,o;e=e||{},h=e.includeFallbackColors,f=e.level,o=e.size;for(var g=0;gi&&(i=n,a=s(r[g]));return s.isReadable(t,a,{level:f,size:o})||!h?a:(e.includeFallbackColors=!1,s.mostReadable(t,["#fff","#000"],e))};var M=s.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},K=s.hexNames=Q(M);function Q(t){var r={};for(var e in t)t.hasOwnProperty(e)&&(r[t[e]]=e);return r}function R(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function u(t,r){Y(t)&&(t="100%");var e=tt(t);return t=Math.min(r,Math.max(0,parseFloat(t))),e&&(t=parseInt(t*r,10)/100),Math.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function y(t){return Math.min(1,Math.max(0,t))}function l(t){return parseInt(t,16)}function Y(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function tt(t){return typeof t=="string"&&t.indexOf("%")!=-1}function b(t){return t.length==1?"0"+t:""+t}function m(t){return t<=1&&(t=t*100+"%"),t}function F(t){return Math.round(parseFloat(t)*255).toString(16)}function H(t){return l(t)/255}var c=(function(){var t="[-\\+]?\\d+%?",r="[-\\+]?\\d*\\.\\d+%?",e="(?:"+r+")|(?:"+t+")",a="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?",i="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";return{CSS_UNIT:new RegExp(e),rgb:new RegExp("rgb"+a),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+a),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+a),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function p(t){return!!c.CSS_UNIT.exec(t)}function et(t){t=t.replace(I,"").replace(P,"").toLowerCase();var r=!1;if(M[t])t=M[t],r=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var e;return(e=c.rgb.exec(t))?{r:e[1],g:e[2],b:e[3]}:(e=c.rgba.exec(t))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=c.hsl.exec(t))?{h:e[1],s:e[2],l:e[3]}:(e=c.hsla.exec(t))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=c.hsv.exec(t))?{h:e[1],s:e[2],v:e[3]}:(e=c.hsva.exec(t))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=c.hex8.exec(t))?{r:l(e[1]),g:l(e[2]),b:l(e[3]),a:H(e[4]),format:r?"name":"hex8"}:(e=c.hex6.exec(t))?{r:l(e[1]),g:l(e[2]),b:l(e[3]),format:r?"name":"hex"}:(e=c.hex4.exec(t))?{r:l(e[1]+""+e[1]),g:l(e[2]+""+e[2]),b:l(e[3]+""+e[3]),a:H(e[4]+""+e[4]),format:r?"name":"hex8"}:(e=c.hex3.exec(t))?{r:l(e[1]+""+e[1]),g:l(e[2]+""+e[2]),b:l(e[3]+""+e[3]),format:r?"name":"hex"}:!1}function rt(t){var r,e;return t=t||{level:"AA",size:"small"},r=(t.level||"AA").toUpperCase(),e=(t.size||"small").toLowerCase(),r!=="AA"&&r!=="AAA"&&(r="AA"),e!=="small"&&e!=="large"&&(e="small"),{level:r,size:e}}export{it as E,s as t}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/tr-yUbHBZLl.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/tr-yUbHBZLl.js new file mode 100644 index 0000000000000000000000000000000000000000..21ae2d5a5b2ffd0386b2a7e4e0c367407d162b4e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/tr-yUbHBZLl.js @@ -0,0 +1 @@ +const a="Türkçe",e={built_with_gradio:"Gradio ile oluşturulmuştur",clear:"Temizle",or:"veya",submit:"Gönder",built_with:"İle oluşturuldu",download:"İndir",edit:"Düzenle",empty:"Boş",error:"Hata",hosted_on:"Şurada barındırılıyor:",loading:"Yükleniyor",logo:"Logo",remove:"Kaldır",settings:"Ayarlar",share:"Paylaş",undo:"Geri Al",no_devices:"Hiçbir cihaz bulunamadı",language:"Dil",display_theme:"Görünüm Teması",pwa:"Progressive Web Uygulaması"},r={click_to_upload:"Yüklemek için tıkla",drop_audio:"Ses dosyasını buraya sürükle",drop_csv:"CSV dosyasını buraya sürükle",drop_file:"Dosyayı buraya sürükle",drop_image:"Resmi buraya sürükle",drop_video:"Videoyu buraya sürükle",drop_gallery:"Medyayı buraya bırak",paste_clipboard:"Panodan yapıştır"},i={annotated_image:"Açıklamalı Görüntü"},n={allow_recording_access:"Lütfen kayıt yapmak için mikrofona erişim izni verin.",audio:"Ses",drop_to_upload:"Yüklemek için bir ses dosyasını buraya bırakın",record_from_microphone:"Mikrofondan kaydet",stop_recording:"Kaydı durdur",no_device_support:"Medya cihazlarına erişilemedi. Güvenli bir kökende (https) veya yerel makinede (localhost) çalıştığınızdan emin olun (veya geçerli bir SSL sertifikası ile ssl_verify'yi geçtiniz) ve tarayıcınızın cihazınıza erişim izni verdiğini kontrol edin.",stop:"Durdur",resume:"Devam Et",record:"Kaydet",no_microphone:"Hiçbir mikrofon bulunamadı",pause:"Duraklat",play:"Oynat",waiting:"Bekliyor"},o={connection_can_break:"Mobil cihazda, bu sekme odaklanmadığında veya cihaz uyku moduna geçtiğinde bağlantı kopabilir ve kuyrukta olduğunuz yer kaybedilebilir.",long_requests_queue:"Bekleyen isteklerin uzun bir kuyruğu var. Kuyruktan atlamak için bu Space'i kopyalayın.",lost_connection:"Sayfa terk edildiği için bağlantı kaybedildi. Kuyruğa yeniden katılıyor...",waiting_for_inputs:"Dosya(lar)ın yükleme işlemini tamamlaması bekleniyor, lütfen yeniden deneyin."},l={checkbox:"Onay Kutusu",checkbox_group:"Onay Kutusu Grubu"},t={code:"Kod"},d={color_picker:"Renk Seçici"},s={incorrect_format:"Yanlış format, sadece CSV ve TSV dosyaları destekleniyor",new_column:"Sütun ekle",new_row:"Yeni satır",add_row_above:"Yukarıya satır ekle",add_row_below:"Aşağıya satır ekle",delete_row:"Satırı sil",delete_column:"Sütunu sil",add_column_left:"Sola sütun ekle",add_column_right:"Sağa sütun ekle",sort_column:"Sütunu sırala",sort_ascending:"Artan sırala",sort_descending:"Azalan sırala",drop_to_upload:"Veriyi veri çerçevesine aktarmak için CSV veya TSV dosyalarını buraya bırakın",clear_sort:"Sıralamayı temizle"},u={dropdown:"Açılır Liste"},c={build_error:"Bir derleme hatası var",config_error:"Bir yapılandırma hatası var",contact_page_author:"Lütfen sayfanın yazarıyla iletişime geçin ve bildirin.",no_app_file:"Uygulama dosyası yok",runtime_error:"Bir çalışma zamanı hatası var",space_not_working:'"Space çalışmıyor çünkü" {0}',space_paused:"Space duraklatıldı",use_via_api:"API üzerinden kullan",use_via_api_or_mcp:"API veya MCP üzerinden kullan"},y={uploading:"Yükleniyor..."},_={highlighted_text:"Vurgulanan Metin"},k={allow_webcam_access:"Lütfen kayıt için web kamerasına erişim izni verin.",brush_color:"Fırça rengi",brush_radius:"Fırça boyutu",image:"Görüntü",remove_image:"Resmi kaldır",select_brush_color:"Fırça rengini seç",start_drawing:"Çizim yapmaya başla",use_brush:"Fırça kullan",drop_to_upload:"Yüklemek için bir görüntü dosyasını buraya bırakın"},m={label:"Etiket"},b={enable_cookies:"Eğer HuggingFace Space'i Gizli Mod'da ziyaret ediyorsanız, üçüncü taraf çerezleri etkinleştirmelisiniz.",incorrect_credentials:"Yanlış kimlik bilgileri",username:"Kullanıcı adı",password:"Parola",login:"Giriş yap"},p={number:"Sayı"},g={plot:"Grafik"},v={radio:"Radyo Düğmesi"},h={slider:"Kaydırıcı"},z={drop_to_upload:"Yüklemek için bir video dosyasını buraya bırakın"},f={edit:"Düzenle",retry:"Tekrar Dene",undo:"Geri Al",submit:"Gönder",cancel:"İptal",like:"Beğen",dislike:"Beğenme",clear:"Sohbeti Temizle"},S={_name:a,common:e,upload_text:r,"3D_model":{"3d_model":"3D Model",drop_to_upload:"Yüklemek için bir 3D model dosyasını (.obj, .glb, .stl, .gltf, .splat veya .ply) buraya bırakın"},annotated_image:i,audio:n,blocks:o,checkbox:l,code:t,color_picker:d,dataframe:s,dropdown:u,errors:c,file:y,highlighted_text:_,image:k,label:m,login:b,number:p,plot:g,radio:v,slider:h,video:z,chatbot:f};export{a as _name,i as annotated_image,n as audio,o as blocks,f as chatbot,l as checkbox,t as code,d as color_picker,e as common,s as dataframe,S as default,u as dropdown,c as errors,y as file,_ as highlighted_text,k as image,m as label,b as login,p as number,g as plot,v as radio,h as slider,r as upload_text,z as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/treemap-KMMF4GRG-B4w9v4mX.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/treemap-KMMF4GRG-B4w9v4mX.js new file mode 100644 index 0000000000000000000000000000000000000000..76f8a03bb29fcd8ebcd3e929e32657465330f58e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/treemap-KMMF4GRG-B4w9v4mX.js @@ -0,0 +1,128 @@ +import{af as wt}from"./index-DWyDLubb.js";import{m as st,f as $d,d as Sd}from"./min-ljrXhbfm.js";import{b as xd,l as kd,c as Id,m as Cd,r as fo,n as rs}from"./_baseUniq-DT1kfcxk.js";import{aO as wd}from"./mermaid.core-7TB2QPZo.js";function _d(t,e){return xd(st(t,e))}function Nd(t,e){return t&&t.length?kd(t,Id(e)):[]}function le(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function ze(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function bd(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function Kr(t){return typeof t=="object"&&t!==null&&le(t.container)&&ze(t.reference)&&typeof t.message=="string"}class Yu{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,n){return le(e)&&this.isSubtype(e.$type,n)}isSubtype(e,n){if(e===n)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const i=r[n];if(i!==void 0)return i;{const s=this.computeIsSubtype(e,n);return r[n]=s,s}}getAllSubTypes(e){const n=this.allSubtypes[e];if(n)return n;{const r=this.getAllTypes(),i=[];for(const s of r)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}}function tr(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Xu(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function Ju(t){return tr(t)&&typeof t.fullText=="string"}class ne{constructor(e,n){this.startFn=e,this.nextFn=n}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){const e=this.iterator();let n=0,r=e.next();for(;!r.done;)n++,r=e.next();return n}toArray(){const e=[],n=this.iterator();let r;do r=n.next(),r.value!==void 0&&e.push(r.value);while(!r.done);return e}toSet(){return new Set(this)}toMap(e,n){const r=this.map(i=>[e?e(i):i,n?n(i):i]);return new Map(r)}toString(){return this.join()}concat(e){return new ne(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),n=>{let r;if(!n.firstDone){do if(r=this.nextFn(n.first),!r.done)return r;while(!r.done);n.firstDone=!0}do if(r=n.iterator.next(),!r.done)return r;while(!r.done);return Ae})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=Od(i.value)),s=!0;while(!i.done);return r}indexOf(e,n=0){const r=this.iterator();let i=0,s=r.next();for(;!s.done;){if(i>=n&&s.value===e)return i;s=r.next(),i++}return-1}every(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(!e(r.value))return!1;r=n.next()}return!0}some(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return!0;r=n.next()}return!1}forEach(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;)e(i.value,r),i=n.next(),r++}map(e){return new ne(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?Ae:{done:!1,value:e(i)}})}filter(e){return new ne(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return Ae})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,n){const r=this.iterator();let i=n,s=r.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value),s=r.next();return i}reduceRight(e,n){return this.recursiveReduce(this.iterator(),e,n)}recursiveReduce(e,n,r){const i=e.next();if(i.done)return r;const s=this.recursiveReduce(e,n,r);return s===void 0?i.value:n(s,i.value)}find(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return r.value;r=n.next()}}findIndex(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;){if(e(i.value))return r;i=n.next(),r++}return-1}includes(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(r.value===e)return!0;r=n.next()}return!1}flatMap(e){return new ne(()=>({this:this.startFn()}),n=>{do{if(n.iterator){const s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}const{done:r,value:i}=this.nextFn(n.this);if(!r){const s=e(i);if(si(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return Ae})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new ne(()=>({this:n.startFn()}),r=>{do{if(r.iterator){const a=r.iterator.next();if(a.done)r.iterator=void 0;else return a}const{done:i,value:s}=n.nextFn(r.this);if(!i)if(si(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return Ae})}head(){const n=this.iterator().next();if(!n.done)return n.value}tail(e=1){return new ne(()=>{const n=this.startFn();for(let r=0;r({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?Ae:this.nextFn(n.state)))}distinct(e){return new ne(()=>({set:new Set,internalState:this.startFn()}),n=>{let r;do if(r=this.nextFn(n.internalState),!r.done){const i=e?e(r.value):r.value;if(!n.set.has(i))return n.set.add(i),r}while(!r.done);return Ae})}exclude(e,n){const r=new Set;for(const i of e){const s=n?n(i):i;r.add(s)}return this.filter(i=>{const s=n?n(i):i;return!r.has(s)})}}function Od(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function si(t){return!!t&&typeof t[Symbol.iterator]=="function"}const Ld=new ne(()=>{},()=>Ae),Ae=Object.freeze({done:!0,value:void 0});function re(...t){if(t.length===1){const e=t[0];if(e instanceof ne)return e;if(si(e))return new ne(()=>e[Symbol.iterator](),n=>n.next());if(typeof e.length=="number")return new ne(()=>({index:0}),n=>n.index1?new ne(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){const n=e.iterator.next();if(!n.done)return n;e.iterator=void 0}if(e.array){if(e.arrIndex({iterators:r?.includeRoot?[[e][Symbol.iterator]()]:[n(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){const a=i.iterators[i.iterators.length-1].next();if(a.done)i.iterators.pop();else return i.iterators.push(n(a.value)[Symbol.iterator]()),a}return Ae})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var Ps;(function(t){function e(s){return s.reduce((a,o)=>a+o,0)}t.sum=e;function n(s){return s.reduce((a,o)=>a*o,0)}t.product=n;function r(s){return s.reduce((a,o)=>Math.min(a,o))}t.min=r;function i(s){return s.reduce((a,o)=>Math.max(a,o))}t.max=i})(Ps||(Ps={}));function Ms(t){return new Aa(t,e=>tr(e)?e.content:[],{includeRoot:!0})}function Pd(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function Ds(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function ai(t){if(!t)return;const{offset:e,end:n,range:r}=t;return{range:r,offset:e,end:n,length:n-e}}var rt;(function(t){t[t.Before=0]="Before",t[t.After=1]="After",t[t.OverlapFront=2]="OverlapFront",t[t.OverlapBack=3]="OverlapBack",t[t.Inside=4]="Inside",t[t.Outside=5]="Outside"})(rt||(rt={}));function Md(t,e){if(t.end.linee.end.line||t.start.line===e.end.line&&t.start.character>=e.end.character)return rt.After;const n=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,r=t.end.linert.After}const Fd=/^[\w\p{L}]$/u;function Gd(t,e){if(t){const n=Ud(t,!0);if(n&&ho(n,e))return n;if(Ju(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(ho(s,e))return s}}}}function ho(t,e){return Xu(t)&&e.includes(t.tokenType.name)}function Ud(t,e=!0){for(;t.container;){const n=t.container;let r=n.content.indexOf(t);for(;r>0;){r--;const i=n.content[r];if(e||!i.hidden)return i}t=n}}class Zu extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function lr(t){throw new Error("Error! The input value was not handled.")}const Rr="AbstractRule",Ar="AbstractType",is="Condition",po="TypeDefinition",ss="ValueLiteral",yn="AbstractElement";function Bd(t){return F.isInstance(t,yn)}const Er="ArrayLiteral",$r="ArrayType",Tn="BooleanLiteral";function jd(t){return F.isInstance(t,Tn)}const vn="Conjunction";function Kd(t){return F.isInstance(t,vn)}const Rn="Disjunction";function Hd(t){return F.isInstance(t,Rn)}const Sr="Grammar",as="GrammarImport",An="InferredType";function Qu(t){return F.isInstance(t,An)}const En="Interface";function ec(t){return F.isInstance(t,En)}const os="NamedArgument",$n="Negation";function Vd(t){return F.isInstance(t,$n)}const xr="NumberLiteral",kr="Parameter",Sn="ParameterReference";function Wd(t){return F.isInstance(t,Sn)}const xn="ParserRule";function Ne(t){return F.isInstance(t,xn)}const Ir="ReferenceType",Hr="ReturnType";function zd(t){return F.isInstance(t,Hr)}const kn="SimpleType";function qd(t){return F.isInstance(t,kn)}const Cr="StringLiteral",Yt="TerminalRule";function Ut(t){return F.isInstance(t,Yt)}const In="Type";function tc(t){return F.isInstance(t,In)}const ls="TypeAttribute",wr="UnionType",Cn="Action";function _i(t){return F.isInstance(t,Cn)}const wn="Alternatives";function nc(t){return F.isInstance(t,wn)}const _n="Assignment";function Ot(t){return F.isInstance(t,_n)}const Nn="CharacterRange";function Yd(t){return F.isInstance(t,Nn)}const bn="CrossReference";function Ea(t){return F.isInstance(t,bn)}const On="EndOfFile";function Xd(t){return F.isInstance(t,On)}const Ln="Group";function $a(t){return F.isInstance(t,Ln)}const Pn="Keyword";function Lt(t){return F.isInstance(t,Pn)}const Mn="NegatedToken";function Jd(t){return F.isInstance(t,Mn)}const Dn="RegexToken";function Zd(t){return F.isInstance(t,Dn)}const Fn="RuleCall";function Pt(t){return F.isInstance(t,Fn)}const Gn="TerminalAlternatives";function Qd(t){return F.isInstance(t,Gn)}const Un="TerminalGroup";function eh(t){return F.isInstance(t,Un)}const Bn="TerminalRuleCall";function th(t){return F.isInstance(t,Bn)}const jn="UnorderedGroup";function rc(t){return F.isInstance(t,jn)}const Kn="UntilToken";function nh(t){return F.isInstance(t,Kn)}const Hn="Wildcard";function rh(t){return F.isInstance(t,Hn)}class ic extends Yu{getAllTypes(){return[yn,Rr,Ar,Cn,wn,Er,$r,_n,Tn,Nn,is,vn,bn,Rn,On,Sr,as,Ln,An,En,Pn,os,Mn,$n,xr,kr,Sn,xn,Ir,Dn,Hr,Fn,kn,Cr,Gn,Un,Yt,Bn,In,ls,po,wr,jn,Kn,ss,Hn]}computeIsSubtype(e,n){switch(e){case Cn:case wn:case _n:case Nn:case bn:case On:case Ln:case Pn:case Mn:case Dn:case Fn:case Gn:case Un:case Bn:case jn:case Kn:case Hn:return this.isSubtype(yn,n);case Er:case xr:case Cr:return this.isSubtype(ss,n);case $r:case Ir:case kn:case wr:return this.isSubtype(po,n);case Tn:return this.isSubtype(is,n)||this.isSubtype(ss,n);case vn:case Rn:case $n:case Sn:return this.isSubtype(is,n);case An:case En:case In:return this.isSubtype(Ar,n);case xn:return this.isSubtype(Rr,n)||this.isSubtype(Ar,n);case Yt:return this.isSubtype(Rr,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return Ar;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return Rr;case"Grammar:usedGrammars":return Sr;case"NamedArgument:parameter":case"ParameterReference:parameter":return kr;case"TerminalRuleCall:rule":return Yt;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case yn:return{name:yn,properties:[{name:"cardinality"},{name:"lookahead"}]};case Er:return{name:Er,properties:[{name:"elements",defaultValue:[]}]};case $r:return{name:$r,properties:[{name:"elementType"}]};case Tn:return{name:Tn,properties:[{name:"true",defaultValue:!1}]};case vn:return{name:vn,properties:[{name:"left"},{name:"right"}]};case Rn:return{name:Rn,properties:[{name:"left"},{name:"right"}]};case Sr:return{name:Sr,properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case as:return{name:as,properties:[{name:"path"}]};case An:return{name:An,properties:[{name:"name"}]};case En:return{name:En,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case os:return{name:os,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case $n:return{name:$n,properties:[{name:"value"}]};case xr:return{name:xr,properties:[{name:"value"}]};case kr:return{name:kr,properties:[{name:"name"}]};case Sn:return{name:Sn,properties:[{name:"parameter"}]};case xn:return{name:xn,properties:[{name:"dataType"},{name:"definesHiddenTokens",defaultValue:!1},{name:"definition"},{name:"entry",defaultValue:!1},{name:"fragment",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"inferredType"},{name:"name"},{name:"parameters",defaultValue:[]},{name:"returnType"},{name:"wildcard",defaultValue:!1}]};case Ir:return{name:Ir,properties:[{name:"referenceType"}]};case Hr:return{name:Hr,properties:[{name:"name"}]};case kn:return{name:kn,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case Cr:return{name:Cr,properties:[{name:"value"}]};case Yt:return{name:Yt,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case In:return{name:In,properties:[{name:"name"},{name:"type"}]};case ls:return{name:ls,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case wr:return{name:wr,properties:[{name:"types",defaultValue:[]}]};case Cn:return{name:Cn,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case wn:return{name:wn,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case _n:return{name:_n,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case Nn:return{name:Nn,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case bn:return{name:bn,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case On:return{name:On,properties:[{name:"cardinality"},{name:"lookahead"}]};case Ln:return{name:Ln,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case Pn:return{name:Pn,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case Mn:return{name:Mn,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case Dn:return{name:Dn,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case Fn:return{name:Fn,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Gn:return{name:Gn,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Un:return{name:Un,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Bn:return{name:Bn,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case jn:return{name:jn,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Kn:return{name:Kn,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case Hn:return{name:Hn,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const F=new ic;function ih(t){for(const[e,n]of Object.entries(t))e.startsWith("$")||(Array.isArray(n)?n.forEach((r,i)=>{le(r)&&(r.$container=t,r.$containerProperty=e,r.$containerIndex=i)}):le(n)&&(n.$container=t,n.$containerProperty=e))}function Ni(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function pt(t){const n=Fs(t).$document;if(!n)throw new Error("AST node has no document.");return n}function Fs(t){for(;t.$container;)t=t.$container;return t}function Sa(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e?.range;return new ne(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndexSa(n,e))}function Jt(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new Aa(t,n=>Sa(n,e),{includeRoot:!0})}function mo(t,e){var n;if(!e)return!0;const r=(n=t.$cstNode)===null||n===void 0?void 0:n.range;return r?Dd(r,e):!1}function sc(t){return new ne(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class bi{visitChildren(e){for(const n in e){const r=e[n];e.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const uh=/\r?\n/gm,ch=new oc;class fh extends bi{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){const n=String.fromCharCode(e.value);if(!this.multiline&&n===` +`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=Oi(n);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(e){if(!this.multiline){const n=this.regex.substring(e.loc.begin,e.loc.end),r=new RegExp(n);this.multiline=!!` +`.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const n=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}}const cs=new fh;function dh(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),cs.reset(t),cs.visit(ch.pattern(t)),cs.multiline}catch{return!1}}const hh=`\f +\r \v              \u2028\u2029   \uFEFF`.split("");function Gs(t){const e=typeof t=="string"?new RegExp(t):t;return hh.some(n=>e.test(n))}function Oi(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ph(t){return Array.prototype.map.call(t,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:Oi(e)).join("")}function mh(t,e){const n=gh(t),r=e.match(n);return!!r&&r[0].length>0}function gh(t){typeof t=="string"&&(t=new RegExp(t));const e=t,n=t.source;let r=0;function i(){let s="",a;function o(u){s+=n.substr(r,u),r+=u}function l(u){s+="(?:"+n.substr(r,u)+"|$)",r+=u}for(;r",r)-r+1);break;default:l(2);break}break;case"[":a=/\[(?:\\.|.)*?\]/g,a.lastIndex=r,a=a.exec(n)||[],l(a[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":a=/\{\d+,?\d*\}/g,a.lastIndex=r,a=a.exec(n),a?o(a[0].length):l(1);break;case"(":if(n[r+1]==="?")switch(n[r+2]){case":":s+="(?:",r+=3,s+=i()+"|$)";break;case"=":s+="(?=",r+=3,s+=i()+")";break;case"!":a=r,r+=3,i(),s+=n.substr(a,r-a);break;case"<":switch(n[r+3]){case"=":case"!":a=r,r+=4,i(),s+=n.substr(a,r-a);break;default:o(n.indexOf(">",r)-r+1),s+=i()+"|$)";break}break}else o(1),s+=i()+"|$)";break;case")":return++r,s;default:l(1);break}return s}return new RegExp(i(),t.flags)}function yh(t){return t.rules.find(e=>Ne(e)&&e.entry)}function Th(t){return t.rules.filter(e=>Ut(e)&&e.hidden)}function lc(t,e){const n=new Set,r=yh(t);if(!r)return new Set(t.rules);const i=[r].concat(Th(t));for(const a of i)uc(a,n,e);const s=new Set;for(const a of t.rules)(n.has(a.name)||Ut(a)&&a.hidden)&&s.add(a);return s}function uc(t,e,n){e.add(t.name),ur(t).forEach(r=>{if(Pt(r)||n){const i=r.rule.ref;i&&!e.has(i.name)&&uc(i,e,n)}})}function vh(t){if(t.terminal)return t.terminal;if(t.type.ref){const e=fc(t.type.ref);return e?.terminal}}function Rh(t){return t.hidden&&!Gs(Ca(t))}function Ah(t,e){return!t||!e?[]:xa(t,e,t.astNode,!0)}function cc(t,e,n){if(!t||!e)return;const r=xa(t,e,t.astNode,!0);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function xa(t,e,n,r){if(!r){const i=Ni(t.grammarSource,Ot);if(i&&i.feature===e)return[t]}return tr(t)&&t.astNode===n?t.content.flatMap(i=>xa(i,e,n,!1)):[]}function Eh(t,e,n){if(!t)return;const r=$h(t,e,t?.astNode);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function $h(t,e,n){if(t.astNode!==n)return[];if(Lt(t.grammarSource)&&t.grammarSource.value===e)return[t];const r=Ms(t).iterator();let i;const s=[];do if(i=r.next(),!i.done){const a=i.value;a.astNode===n?Lt(a.grammarSource)&&a.grammarSource.value===e&&s.push(a):r.prune()}while(!i.done);return s}function Sh(t){var e;const n=t.astNode;for(;n===((e=t.container)===null||e===void 0?void 0:e.astNode);){const r=Ni(t.grammarSource,Ot);if(r)return r;t=t.container}}function fc(t){let e=t;return Qu(e)&&(_i(e.$container)?e=e.$container.$container:Ne(e.$container)?e=e.$container:lr(e.$container)),dc(t,e,new Map)}function dc(t,e,n){var r;function i(s,a){let o;return Ni(s,Ot)||(o=dc(a,a,n)),n.set(t,o),o}if(n.has(t))return n.get(t);n.set(t,void 0);for(const s of ur(e)){if(Ot(s)&&s.feature.toLowerCase()==="name")return n.set(t,s),s;if(Pt(s)&&Ne(s.rule.ref))return i(s,s.rule.ref);if(qd(s)&&(!((r=s.typeRef)===null||r===void 0)&&r.ref))return i(s,s.typeRef.ref)}}function hc(t){return pc(t,new Set)}function pc(t,e){if(e.has(t))return!0;e.add(t);for(const n of ur(t))if(Pt(n)){if(!n.rule.ref||Ne(n.rule.ref)&&!pc(n.rule.ref,e))return!1}else{if(Ot(n))return!1;if(_i(n))return!1}return!!t.definition}function ka(t){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){const e=t.returnType.ref;if(e){if(Ne(e))return e.name;if(ec(e)||tc(e))return e.name}}}function Ia(t){var e;if(Ne(t))return hc(t)?t.name:(e=ka(t))!==null&&e!==void 0?e:t.name;if(ec(t)||tc(t)||zd(t))return t.name;if(_i(t)){const n=xh(t);if(n)return n}else if(Qu(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function xh(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return Ia(t.type.ref)}function kh(t){var e,n,r;return Ut(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":(r=ka(t))!==null&&r!==void 0?r:t.name}function Ca(t){const e={s:!1,i:!1,u:!1},n=un(t.definition,e),r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(n,r)}const wa=/[\s\S]/.source;function un(t,e){if(Qd(t))return Ih(t);if(eh(t))return Ch(t);if(Yd(t))return Nh(t);if(th(t)){const n=t.rule.ref;if(!n)throw new Error("Missing rule reference.");return at(un(n.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(Jd(t))return _h(t);if(nh(t))return wh(t);if(Zd(t)){const n=t.regex.lastIndexOf("/"),r=t.regex.substring(1,n),i=t.regex.substring(n+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),at(r,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(rh(t))return at(wa,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function Ih(t){return at(t.elements.map(e=>un(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function Ch(t){return at(t.elements.map(e=>un(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function wh(t){return at(`${wa}*?${un(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function _h(t){return at(`(?!${un(t.terminal)})${wa}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function Nh(t){return t.right?at(`[${fs(t.left)}-${fs(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):at(fs(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function fs(t){return Oi(t.value)}function at(t,e){var n;return(e.wrap!==!1||e.lookahead)&&(t=`(${(n=e.lookahead)!==null&&n!==void 0?n:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}function bh(t){const e=[],n=t.Grammar;for(const r of n.rules)Ut(r)&&Rh(r)&&dh(Ca(r))&&e.push(r.name);return{multilineCommentRules:e,nameRegexp:Fd}}var mc=typeof global=="object"&&global&&global.Object===Object&&global,Oh=typeof self=="object"&&self&&self.Object===Object&&self,Ye=mc||Oh||Function("return this")(),be=Ye.Symbol,gc=Object.prototype,Lh=gc.hasOwnProperty,Ph=gc.toString,pn=be?be.toStringTag:void 0;function Mh(t){var e=Lh.call(t,pn),n=t[pn];try{t[pn]=void 0;var r=!0}catch{}var i=Ph.call(t);return r&&(e?t[pn]=n:delete t[pn]),i}var Dh=Object.prototype,Fh=Dh.toString;function Gh(t){return Fh.call(t)}var Uh="[object Null]",Bh="[object Undefined]",To=be?be.toStringTag:void 0;function Rt(t){return t==null?t===void 0?Bh:Uh:To&&To in Object(t)?Mh(t):Gh(t)}function Be(t){return t!=null&&typeof t=="object"}var jh="[object Symbol]";function Li(t){return typeof t=="symbol"||Be(t)&&Rt(t)==jh}function Pi(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n0){if(++e>=vp)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function $p(t){return function(){return t}}var ui=(function(){try{var t=jt(Object,"defineProperty");return t({},"",{}),t}catch{}})(),Sp=ui?function(t,e){return ui(t,"toString",{configurable:!0,enumerable:!1,value:$p(e),writable:!0})}:en,xp=Ep(Sp);function Tc(t,e){for(var n=-1,r=t==null?0:t.length;++n-1}var Cp=9007199254740991,wp=/^(?:0|[1-9]\d*)$/;function Di(t,e){var n=typeof t;return e=e??Cp,!!e&&(n=="number"||n!="symbol"&&wp.test(t))&&t>-1&&t%1==0&&t-1&&t%1==0&&t<=Op}function Xe(t){return t!=null&&Oa(t.length)&&!ct(t)}function Ac(t,e,n){if(!Oe(n))return!1;var r=typeof e;return(r=="number"?Xe(n)&&Di(e,n.length):r=="string"&&e in n)?cr(n[e],t):!1}function Lp(t){return ba(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,a&&Ac(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++r-1}function Vm(t,e){var n=this.__data__,r=Bi(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function ft(t){var e=-1,n=t==null?0:t.length;for(this.clear();++ei?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++ro))return!1;var u=s.get(t),c=s.get(e);if(u&&c)return u==e&&c==t;var f=-1,d=!0,h=n&By?new tn:void 0;for(s.set(t,e),s.set(e,t);++f2?e[2]:void 0;for(i&&Ac(e[0],e[1],i)&&(r=1);++n=NT&&(s=Ka,a=!1,e=new tn(e));e:for(;++i-1?i[s?e[a]:a]:void 0}}var DT=Math.max;function FT(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:Mi(n);return i<0&&(i=DT(r+i,0)),vc(t,Je(e),i)}var rn=MT(FT);function je(t){return t&&t.length?t[0]:void 0}function GT(t,e){var n=-1,r=Xe(t)?Array(t.length):[];return Kt(t,function(i,s,a){r[++n]=e(i,s,a)}),r}function I(t,e){var n=P(t)?Pi:GT;return n(t,Je(e))}function _e(t,e){return Ua(I(t,e))}var UT=Object.prototype,BT=UT.hasOwnProperty,jT=wT(function(t,e,n){BT.call(t,n)?t[n].push(e):Na(t,n,[e])}),KT=Object.prototype,HT=KT.hasOwnProperty;function VT(t,e){return t!=null&&HT.call(t,e)}function C(t,e){return t!=null&&Bc(t,e,VT)}var WT="[object String]";function pe(t){return typeof t=="string"||!P(t)&&Be(t)&&Rt(t)==WT}function zT(t,e){return Pi(e,function(n){return t[n]})}function J(t){return t==null?[]:zT(t,Le(t))}var qT=Math.max;function de(t,e,n,r){t=Xe(t)?t:J(t),n=n?Mi(n):0;var i=t.length;return n<0&&(n=qT(i+n,0)),pe(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&_a(t,e,n)>-1}function Yo(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return _a(t,e,i)}var YT="[object Map]",XT="[object Set]",JT=Object.prototype,ZT=JT.hasOwnProperty;function U(t){if(t==null)return!0;if(Xe(t)&&(P(t)||typeof t=="string"||typeof t.splice=="function"||nr(t)||La(t)||Gi(t)))return!t.length;var e=we(t);if(e==YT||e==XT)return!t.size;if(dr(t))return!Ic(t).length;for(var n in t)if(ZT.call(t,n))return!1;return!0}var QT="[object RegExp]";function ev(t){return Be(t)&&Rt(t)==QT}var Xo=mt&&mt.isRegExp,ot=Xo?Ui(Xo):ev;function lt(t){return t===void 0}var tv="Expected a function";function nv(t){if(typeof t!="function")throw new TypeError(tv);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function rv(t,e,n,r){if(!Oe(t))return t;e=Ki(e,t);for(var i=-1,s=e.length,a=s-1,o=t;o!=null&&++i=uv){var u=lv(t);if(u)return Ha(u);a=!1,i=Ka,l=new tn}else l=o;e:for(;++r{n.accept(e)})}}class ce extends Ze{constructor(e){super([]),this.idx=1,$e(this,Ke(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class cn extends Ze{constructor(e){super(e.definition),this.orgText="",$e(this,Ke(e,n=>n!==void 0))}}class me extends Ze{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,$e(this,Ke(e,n=>n!==void 0))}}let ie=class extends Ze{constructor(e){super(e.definition),this.idx=1,$e(this,Ke(e,n=>n!==void 0))}};class xe extends Ze{constructor(e){super(e.definition),this.idx=1,$e(this,Ke(e,n=>n!==void 0))}}class ke extends Ze{constructor(e){super(e.definition),this.idx=1,$e(this,Ke(e,n=>n!==void 0))}}class z extends Ze{constructor(e){super(e.definition),this.idx=1,$e(this,Ke(e,n=>n!==void 0))}}class ge extends Ze{constructor(e){super(e.definition),this.idx=1,$e(this,Ke(e,n=>n!==void 0))}}class ye extends Ze{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,$e(this,Ke(e,n=>n!==void 0))}}class j{constructor(e){this.idx=1,$e(this,Ke(e,n=>n!==void 0))}accept(e){e.visit(this)}}function hv(t){return I(t,Wr)}function Wr(t){function e(n){return I(n,Wr)}if(t instanceof ce){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return pe(t.label)&&(n.label=t.label),n}else{if(t instanceof me)return{type:"Alternative",definition:e(t.definition)};if(t instanceof ie)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof xe)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof ke)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Wr(new j({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof ge)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Wr(new j({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof z)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof ye)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof j){const n={type:"Terminal",name:t.terminalType.name,label:fv(t.terminalType),idx:t.idx};pe(t.label)&&(n.terminalLabel=t.label);const r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=ot(r)?r.source:r),n}else{if(t instanceof cn)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class fn{visit(e){const n=e;switch(n.constructor){case ce:return this.visitNonTerminal(n);case me:return this.visitAlternative(n);case ie:return this.visitOption(n);case xe:return this.visitRepetitionMandatory(n);case ke:return this.visitRepetitionMandatoryWithSeparator(n);case ge:return this.visitRepetitionWithSeparator(n);case z:return this.visitRepetition(n);case ye:return this.visitAlternation(n);case j:return this.visitTerminal(n);case cn:return this.visitRule(n);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function pv(t){return t instanceof me||t instanceof ie||t instanceof z||t instanceof xe||t instanceof ke||t instanceof ge||t instanceof j||t instanceof cn}function fi(t,e=[]){return t instanceof ie||t instanceof z||t instanceof ge?!0:t instanceof ye?Hc(t.definition,r=>fi(r,e)):t instanceof ce&&de(e,t)?!1:t instanceof Ze?(t instanceof ce&&e.push(t),Ue(t.definition,r=>fi(r,e))):!1}function mv(t){return t instanceof ye}function We(t){if(t instanceof ce)return"SUBRULE";if(t instanceof ie)return"OPTION";if(t instanceof ye)return"OR";if(t instanceof xe)return"AT_LEAST_ONE";if(t instanceof ke)return"AT_LEAST_ONE_SEP";if(t instanceof ge)return"MANY_SEP";if(t instanceof z)return"MANY";if(t instanceof j)return"CONSUME";throw Error("non exhaustive match")}class Wi{walk(e,n=[]){w(e.definition,(r,i)=>{const s=te(e.definition,i+1);if(r instanceof ce)this.walkProdRef(r,s,n);else if(r instanceof j)this.walkTerminal(r,s,n);else if(r instanceof me)this.walkFlat(r,s,n);else if(r instanceof ie)this.walkOption(r,s,n);else if(r instanceof xe)this.walkAtLeastOne(r,s,n);else if(r instanceof ke)this.walkAtLeastOneSep(r,s,n);else if(r instanceof ge)this.walkManySep(r,s,n);else if(r instanceof z)this.walkMany(r,s,n);else if(r instanceof ye)this.walkOr(r,s,n);else throw Error("non exhaustive match")})}walkTerminal(e,n,r){}walkProdRef(e,n,r){}walkFlat(e,n,r){const i=n.concat(r);this.walk(e,i)}walkOption(e,n,r){const i=n.concat(r);this.walk(e,i)}walkAtLeastOne(e,n,r){const i=[new ie({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){const i=Jo(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new ie({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=Jo(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);w(e.definition,s=>{const a=new me({definition:[s]});this.walk(a,i)})}}function Jo(t,e,n){return[new ie({definition:[new j({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function mr(t){if(t instanceof ce)return mr(t.referencedRule);if(t instanceof j)return Tv(t);if(pv(t))return gv(t);if(mv(t))return yv(t);throw Error("non exhaustive match")}function gv(t){let e=[];const n=t.definition;let r=0,i=n.length>r,s,a=!0;for(;i&&a;)s=n[r],a=fi(s),e=e.concat(mr(s)),r=r+1,i=n.length>r;return za(e)}function yv(t){const e=I(t.definition,n=>mr(n));return za(Ge(e))}function Tv(t){return[t.terminalType]}const qc="_~IN~_";class vv extends Wi{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,n,r){}walkProdRef(e,n,r){const i=Av(e.referencedRule,e.idx)+this.topProd.name,s=n.concat(r),a=new me({definition:s}),o=mr(a);this.follows[i]=o}}function Rv(t){const e={};return w(t,n=>{const r=new vv(n).startWalking();$e(e,r)}),e}function Av(t,e){return t.name+e+qc}let zr={};const Ev=new oc;function zi(t){const e=t.toString();if(zr.hasOwnProperty(e))return zr[e];{const n=Ev.pattern(e);return zr[e]=n,n}}function $v(){zr={}}const Yc="Complement Sets are not supported for first char optimization",di=`Unable to use "first char" lexer optimizations: +`;function Sv(t,e=!1){try{const n=zi(t);return Vs(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===Yc)e&&Vc(`${di} Unable to optimize: < ${t.toString()} > + Complement Sets cannot be automatically optimized. + This will disable the lexer's first char optimizations. + See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=` + This will disable the lexer's first char optimizations. + See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Hs(`${di} + Failed parsing: < ${t.toString()} > + Using the @chevrotain/regexp-to-ast library + Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function Vs(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i{if(typeof l=="number")br(l,e,n);else{const u=l;if(n===!0)for(let c=u.from;c<=u.to;c++)br(c,e,n);else{for(let c=u.from;c<=u.to&&c=Wn){const c=u.from>=Wn?u.from:Wn,f=u.to,d=gt(c),h=gt(f);for(let m=d;m<=h;m++)e[m]=m}}}});break;case"Group":Vs(a.value,e,n);break;default:throw Error("Non Exhaustive Match")}const o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&Ws(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return J(e)}function br(t,e,n){const r=gt(t);e[r]=r,n===!0&&xv(t,e)}function xv(t,e){const n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){const i=gt(r.charCodeAt(0));e[i]=i}else{const i=n.toLowerCase();if(i!==n){const s=gt(i.charCodeAt(0));e[s]=s}}}function Zo(t,e){return rn(t.value,n=>{if(typeof n=="number")return de(e,n);{const r=n;return rn(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function Ws(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?P(t.value)?Ue(t.value,Ws):Ws(t.value):!1}class kv extends bi{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){de(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Zo(e,this.targetCharCodes)===void 0&&(this.found=!0):Zo(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function qa(t,e){if(e instanceof RegExp){const n=zi(e),r=new kv(t);return r.visit(n),r.found}else return rn(e,n=>de(t,n.charCodeAt(0)))!==void 0}const Dt="PATTERN",Vn="defaultMode",Or="modes";let Xc=typeof new RegExp("(?:)").sticky=="boolean";function Iv(t,e){e=Wa(e,{useSticky:Xc,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",` +`],tracer:(E,v)=>v()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{Xv()});let r;n("Reject Lexer.NA",()=>{r=Vi(t,E=>E[Dt]===he.NA)});let i=!1,s;n("Transform Patterns",()=>{i=!1,s=I(r,E=>{const v=E[Dt];if(ot(v)){const x=v.source;return x.length===1&&x!=="^"&&x!=="$"&&x!=="."&&!v.ignoreCase?x:x.length===2&&x[0]==="\\"&&!de(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],x[1])?x[1]:e.useSticky?el(v):Qo(v)}else{if(ct(v))return i=!0,{exec:v};if(typeof v=="object")return i=!0,v;if(typeof v=="string"){if(v.length===1)return v;{const x=v.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),M=new RegExp(x);return e.useSticky?el(M):Qo(M)}}else throw Error("non exhaustive match")}})});let a,o,l,u,c;n("misc mapping",()=>{a=I(r,E=>E.tokenTypeIdx),o=I(r,E=>{const v=E.GROUP;if(v!==he.SKIPPED){if(pe(v))return v;if(lt(v))return!1;throw Error("non exhaustive match")}}),l=I(r,E=>{const v=E.LONGER_ALT;if(v)return P(v)?I(v,M=>Yo(r,M)):[Yo(r,v)]}),u=I(r,E=>E.PUSH_MODE),c=I(r,E=>C(E,"POP_MODE"))});let f;n("Line Terminator Handling",()=>{const E=Qc(e.lineTerminatorCharacters);f=I(r,v=>!1),e.positionTracking!=="onlyOffset"&&(f=I(r,v=>C(v,"LINE_BREAKS")?!!v.LINE_BREAKS:Zc(v,E)===!1&&qa(E,v.PATTERN)))});let d,h,m,g;n("Misc Mapping #2",()=>{d=I(r,Jc),h=I(s,zv),m=Se(r,(E,v)=>{const x=v.GROUP;return pe(x)&&x!==he.SKIPPED&&(E[x]=[]),E},{}),g=I(s,(E,v)=>({pattern:s[v],longerAlt:l[v],canLineTerminator:f[v],isCustom:d[v],short:h[v],group:o[v],push:u[v],pop:c[v],tokenTypeIdx:a[v],tokenType:r[v]}))});let R=!0,y=[];return e.safeMode||n("First Char Optimization",()=>{y=Se(r,(E,v,x)=>{if(typeof v.PATTERN=="string"){const M=v.PATTERN.charCodeAt(0),ae=gt(M);ms(E,ae,g[x])}else if(P(v.START_CHARS_HINT)){let M;w(v.START_CHARS_HINT,ae=>{const Me=typeof ae=="string"?ae.charCodeAt(0):ae,Te=gt(Me);M!==Te&&(M=Te,ms(E,Te,g[x]))})}else if(ot(v.PATTERN))if(v.PATTERN.unicode)R=!1,e.ensureOptimizations&&Hs(`${di} Unable to analyze < ${v.PATTERN.toString()} > pattern. + The regexp unicode flag is not currently supported by the regexp-to-ast library. + This will disable the lexer's first char optimizations. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const M=Sv(v.PATTERN,e.ensureOptimizations);U(M)&&(R=!1),w(M,ae=>{ms(E,ae,g[x])})}else e.ensureOptimizations&&Hs(`${di} TokenType: <${v.name}> is using a custom token pattern without providing parameter. + This will disable the lexer's first char optimizations. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),R=!1;return E},[])}),{emptyGroups:m,patternIdxToConfig:g,charCodeToPatternIdxToConfig:y,hasCustom:i,canBeOptimized:R}}function Cv(t,e){let n=[];const r=_v(t);n=n.concat(r.errors);const i=Nv(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(wv(s)),n=n.concat(Gv(s)),n=n.concat(Uv(s,e)),n=n.concat(Bv(s)),n}function wv(t){let e=[];const n=Pe(t,r=>ot(r[Dt]));return e=e.concat(Ov(n)),e=e.concat(Mv(n)),e=e.concat(Dv(n)),e=e.concat(Fv(n)),e=e.concat(Lv(n)),e}function _v(t){const e=Pe(t,i=>!C(i,Dt)),n=I(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:q.MISSING_PATTERN,tokenTypes:[i]})),r=Hi(t,e);return{errors:n,valid:r}}function Nv(t){const e=Pe(t,i=>{const s=i[Dt];return!ot(s)&&!ct(s)&&!C(s,"exec")&&!pe(s)}),n=I(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:q.INVALID_PATTERN,tokenTypes:[i]})),r=Hi(t,e);return{errors:n,valid:r}}const bv=/[^\\][$]/;function Ov(t){class e extends bi{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const n=Pe(t,i=>{const s=i.PATTERN;try{const a=zi(s),o=new e;return o.visit(a),o.found}catch{return bv.test(s.source)}});return I(n,i=>({message:`Unexpected RegExp Anchor Error: + Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$' + See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function Lv(t){const e=Pe(t,r=>r.PATTERN.test(""));return I(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:q.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const Pv=/[^\\[][\^]|^\^/;function Mv(t){class e extends bi{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const n=Pe(t,i=>{const s=i.PATTERN;try{const a=zi(s),o=new e;return o.visit(a),o.found}catch{return Pv.test(s.source)}});return I(n,i=>({message:`Unexpected RegExp Anchor Error: + Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^' + See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function Dv(t){const e=Pe(t,r=>{const i=r[Dt];return i instanceof RegExp&&(i.multiline||i.global)});return I(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:q.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function Fv(t){const e=[];let n=I(t,s=>Se(t,(a,o)=>(s.PATTERN.source===o.PATTERN.source&&!de(e,o)&&o.PATTERN!==he.NA&&(e.push(o),a.push(o)),a),[]));n=pr(n);const r=Pe(n,s=>s.length>1);return I(r,s=>{const a=I(s,l=>l.name);return{message:`The same RegExp pattern ->${je(s).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:q.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function Gv(t){const e=Pe(t,r=>{if(!C(r,"GROUP"))return!1;const i=r.GROUP;return i!==he.SKIPPED&&i!==he.NA&&!pe(i)});return I(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:q.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function Uv(t,e){const n=Pe(t,i=>i.PUSH_MODE!==void 0&&!de(e,i.PUSH_MODE));return I(n,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:q.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function Bv(t){const e=[],n=Se(t,(r,i,s)=>{const a=i.PATTERN;return a===he.NA||(pe(a)?r.push({str:a,idx:s,tokenType:i}):ot(a)&&Kv(a)&&r.push({str:a.source,idx:s,tokenType:i})),r},[]);return w(t,(r,i)=>{w(n,({str:s,idx:a,tokenType:o})=>{if(i${o.name}<- can never be matched. +Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition. +See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:l,type:q.UNREACHABLE_PATTERN,tokenTypes:[r,o]})}})}),e}function jv(t,e){if(ot(e)){const n=e.exec(t);return n!==null&&n.index===0}else{if(ct(e))return e(t,0,[],{});if(C(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function Kv(t){return rn([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function Qo(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function el(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function Hv(t,e,n){const r=[];return C(t,Vn)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Vn+`> property in its definition +`,type:q.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),C(t,Or)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Or+`> property in its definition +`,type:q.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),C(t,Or)&&C(t,Vn)&&!C(t.modes,t.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Vn}: <${t.defaultMode}>which does not exist +`,type:q.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),C(t,Or)&&w(t.modes,(i,s)=>{w(i,(a,o)=>{if(lt(a))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}> +`,type:q.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(C(a,"LONGER_ALT")){const l=P(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];w(l,u=>{!lt(u)&&!de(i,u)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${a.name}> outside of mode <${s}> +`,type:q.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function Vv(t,e,n){const r=[];let i=!1;const s=pr(Ge(J(t.modes))),a=Vi(s,l=>l[Dt]===he.NA),o=Qc(n);return e&&w(a,l=>{const u=Zc(l,o);if(u!==!1){const f={message:Yv(l,u),type:u.issue,tokenType:l};r.push(f)}else C(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):qa(o,l.PATTERN)&&(i=!0)}),e&&!i&&r.push({message:`Warning: No LINE_BREAKS Found. + This Lexer has been defined to track line and column information, + But none of the Token Types can be identified as matching a line terminator. + See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS + for details.`,type:q.NO_LINE_BREAKS_FLAGS}),r}function Wv(t){const e={},n=Le(t);return w(n,r=>{const i=t[r];if(P(i))e[r]=[];else throw Error("non exhaustive match")}),e}function Jc(t){const e=t.PATTERN;if(ot(e))return!1;if(ct(e))return!0;if(C(e,"exec"))return!0;if(pe(e))return!1;throw Error("non exhaustive match")}function zv(t){return pe(t)&&t.length===1?t.charCodeAt(0):!1}const qv={test:function(t){const e=t.length;for(let n=this.lastIndex;n Token Type + Root cause: ${e.errMsg}. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===q.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the option. + The problem is in the <${t.name}> Token Type + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Qc(t){return I(t,n=>pe(n)?n.charCodeAt(0):n)}function ms(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const Wn=256;let qr=[];function gt(t){return t255?255+~~(t/255):t}}function gr(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}function hi(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let tl=1;const ef={};function yr(t){const e=Jv(t);Zv(e),eR(e),Qv(e),w(e,n=>{n.isParent=n.categoryMatches.length>0})}function Jv(t){let e=se(t),n=t,r=!0;for(;r;){n=pr(Ge(I(n,s=>s.CATEGORIES)));const i=Hi(n,e);e=e.concat(i),U(i)?r=!1:n=i}return e}function Zv(t){w(t,e=>{nf(e)||(ef[tl]=e,e.tokenTypeIdx=tl++),nl(e)&&!P(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),nl(e)||(e.CATEGORIES=[]),tR(e)||(e.categoryMatches=[]),nR(e)||(e.categoryMatchesMap={})})}function Qv(t){w(t,e=>{e.categoryMatches=[],w(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(ef[r].tokenTypeIdx)})})}function eR(t){w(t,e=>{tf([],e)})}function tf(t,e){w(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),w(e.CATEGORIES,n=>{const r=t.concat(e);de(r,n)||tf(r,n)})}function nf(t){return C(t,"tokenTypeIdx")}function nl(t){return C(t,"CATEGORIES")}function tR(t){return C(t,"categoryMatches")}function nR(t){return C(t,"categoryMatchesMap")}function rR(t){return C(t,"tokenTypeIdx")}const zs={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,n,r,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`}};var q;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(q||(q={}));const zn={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[` +`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:zs,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(zn);class he{constructor(e,n=zn){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,s)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${i}>`);const{time:o,value:l}=Wc(s),u=o>10?console.warn:console.log;return this.traceInitIndent time: ${o}ms`),this.traceInitIndent--,l}else return s()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object. +a boolean 2nd argument is no longer supported`);this.config=$e({},zn,n);const r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===zn.lineTerminatorsPattern)this.config.lineTerminatorsPattern=qv;else if(this.config.lineTerminatorCharacters===zn.lineTerminatorCharacters)throw Error(`Error: Missing property on the Lexer config. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),P(e)?i={modes:{defaultMode:se(e)},defaultMode:Vn}:(s=!1,i=se(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Hv(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Vv(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},w(i.modes,(o,l)=>{i.modes[l]=Vi(o,u=>lt(u))});const a=Le(i.modes);if(w(i.modes,(o,l)=>{this.TRACE_INIT(`Mode: <${l}> processing`,()=>{if(this.modes.push(l),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Cv(o,a))}),U(this.lexerDefinitionErrors)){yr(o);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=Iv(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[l]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[l]=u.charCodeToPatternIdxToConfig,this.emptyGroups=$e({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[l]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!U(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const l=I(this.lexerDefinitionErrors,u=>u.message).join(`----------------------- +`);throw new Error(`Errors detected in definition of Lexer: +`+l)}w(this.lexerDefinitionWarning,o=>{Vc(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(Xc?(this.chopInput=en,this.match=this.matchWithTest):(this.updateLastIndex=X,this.match=this.matchWithExec),s&&(this.handleModes=X),this.trackStartLines===!1&&(this.computeNewColumn=en),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=X),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const o=Se(this.canModeBeOptimized,(l,u,c)=>(u===!1&&l.push(c),l),[]);if(n.ensureOptimizations&&!U(o))throw Error(`Lexer Modes: < ${o.join(", ")} > cannot be optimized. + Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode. + Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{$v()}),this.TRACE_INIT("toFastProperties",()=>{zc(this)})})}tokenize(e,n=this.defaultMode){if(!U(this.lexerDefinitionErrors)){const i=I(this.lexerDefinitionErrors,s=>s.message).join(`----------------------- +`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer: +`+i)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,s,a,o,l,u,c,f,d,h,m,g,R,y;const E=e,v=E.length;let x=0,M=0;const ae=this.hasCustom?0:Math.floor(e.length/10),Me=new Array(ae),Te=[];let Ve=this.trackStartLines?1:void 0,Ie=this.trackStartLines?1:void 0;const $=Wv(this.emptyGroups),T=this.trackStartLines,k=this.config.lineTerminatorsPattern;let S=0,O=[],b=[];const N=[],ve=[];Object.freeze(ve);let Z;function W(){return O}function It(oe){const Ce=gt(oe),zt=b[Ce];return zt===void 0?ve:zt}const Ed=oe=>{if(N.length===1&&oe.tokenType.PUSH_MODE===void 0){const Ce=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(oe);Te.push({offset:oe.startOffset,line:oe.startLine,column:oe.startColumn,length:oe.image.length,message:Ce})}else{N.pop();const Ce=nn(N);O=this.patternIdxToConfig[Ce],b=this.charCodeToPatternIdxToConfig[Ce],S=O.length;const zt=this.canModeBeOptimized[Ce]&&this.config.safeMode===!1;b&&zt?Z=It:Z=W}};function lo(oe){N.push(oe),b=this.charCodeToPatternIdxToConfig[oe],O=this.patternIdxToConfig[oe],S=O.length,S=O.length;const Ce=this.canModeBeOptimized[oe]&&this.config.safeMode===!1;b&&Ce?Z=It:Z=W}lo.call(this,n);let De;const uo=this.config.recoveryEnabled;for(;xl.length){l=a,u=c,De=et;break}}}break}}if(l!==null){if(f=l.length,d=De.group,d!==void 0&&(h=De.tokenTypeIdx,m=this.createTokenInstance(l,x,h,De.tokenType,Ve,Ie,f),this.handlePayload(m,u),d===!1?M=this.addToken(Me,M,m):$[d].push(m)),e=this.chopInput(e,f),x=x+f,Ie=this.computeNewColumn(Ie,f),T===!0&&De.canLineTerminator===!0){let Re=0,Qe,ht;k.lastIndex=0;do Qe=k.test(l),Qe===!0&&(ht=k.lastIndex-1,Re++);while(Qe===!0);Re!==0&&(Ve=Ve+Re,Ie=f-ht,this.updateTokenEndLineColumnLocation(m,d,ht,Re,Ve,Ie,f))}this.handleModes(De,Ed,lo,m)}else{const Re=x,Qe=Ve,ht=Ie;let et=uo===!1;for(;et===!1&&x ${Qt(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:n,customUserDescription:r,ruleName:i}){const s="Expecting: ",o=` +but found: '`+je(e).image+"'";if(r)return s+r+o;{const l=Se(t,(d,h)=>d.concat(h),[]),u=I(l,d=>`[${I(d,h=>Qt(h)).join(", ")}]`),f=`one of these possible Token sequences: +${I(u,(d,h)=>` ${h+1}. ${d}`).join(` +`)}`;return s+f+o}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:n,ruleName:r}){const i="Expecting: ",a=` +but found: '`+je(e).image+"'";if(n)return i+n+a;{const l=`expecting at least one iteration which starts with one of these possible Token sequences:: + <${I(t,u=>`[${I(u,c=>Qt(c)).join(",")}]`).join(" ,")}>`;return i+l+a}}};Object.freeze(Xt);const aR={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<- +inside top level rule: ->`+t.name+"<-"}},bt={buildDuplicateFoundError(t,e){function n(c){return c instanceof j?c.terminalType.name:c instanceof ce?c.nonTerminalName:""}const r=t.name,i=je(e),s=i.idx,a=We(i),o=n(i),l=s>0;let u=`->${a}${l?s:""}<- ${o?`with argument: ->${o}<-`:""} + appears more than once (${e.length} times) in the top level rule: ->${r}<-. + For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES + `;return u=u.replace(/[ \t]+/g," "),u=u.replace(/\s\s+/g,` +`),u},buildNamespaceConflictError(t){return`Namespace conflict found in grammar. +The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>. +To resolve this make sure each Terminal and Non-Terminal names are unique +This is easy to accomplish by using the convention that Terminal names start with an uppercase letter +and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){const e=I(t.prefixPath,i=>Qt(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix +in inside <${t.topLevelRule.name}> Rule, +<${e}> may appears as a prefix path in all these alternatives. +See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX +For Further details.`},buildAlternationAmbiguityError(t){const e=I(t.prefixPath,i=>Qt(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in inside <${t.topLevelRule.name}> Rule, +<${e}> may appears as a prefix path in all these alternatives. +`;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES +For Further details.`,r},buildEmptyRepetitionError(t){let e=We(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens. +This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in inside <${t.topLevelRule.name}> Rule. +Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives: + inside <${t.topLevelRule.name}> Rule. + has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,n=I(t.leftRecursionPath,s=>s.name),r=`${e} --> ${n.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar. +rule: <${e}> can be invoked from itself (directly or indirectly) +without consuming any Tokens. The grammar path that causes this is: + ${r} + To fix this refactor your grammar to remove the left recursion. +see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof cn?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function oR(t,e){const n=new lR(t,e);return n.resolveRefs(),n.errors}class lR extends fn{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){w(J(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:fe.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class uR extends Wi{constructor(e,n){super(),this.topProd=e,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=se(this.path.ruleStack).reverse(),this.occurrenceStack=se(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,n=[]){this.found||super.walk(e,n)}walkProdRef(e,n,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){U(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class cR extends uR{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),s=new me({definition:i});this.possibleTokTypes=mr(s),this.found=!0}}}class qi extends Wi{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class fR extends qi{walkMany(e,n,r){if(e.idx===this.occurrence){const i=je(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof j&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class fl extends qi{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=je(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof j&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class dR extends qi{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=je(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof j&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class dl extends qi{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=je(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof j&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function qs(t,e,n=[]){n=se(n);let r=[],i=0;function s(o){return o.concat(te(t,i+1))}function a(o){const l=qs(s(o),e,n);return r.concat(l)}for(;n.length{U(l.definition)===!1&&(r=a(l.definition))}),r;if(o instanceof j)n.push(o.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:n,suffixDef:te(t,i)}),r}function of(t,e,n,r){const i="EXIT_NONE_TERMINAL",s=[i],a="EXIT_ALTERNATIVE";let o=!1;const l=e.length,u=l-r-1,c=[],f=[];for(f.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!U(f);){const d=f.pop();if(d===a){o&&nn(f).idx<=u&&f.pop();continue}const h=d.def,m=d.idx,g=d.ruleStack,R=d.occurrenceStack;if(U(h))continue;const y=h[0];if(y===i){const E={idx:m,def:te(h),ruleStack:sr(g),occurrenceStack:sr(R)};f.push(E)}else if(y instanceof j)if(m=0;E--){const v=y.definition[E],x={idx:m,def:v.definition.concat(te(h)),ruleStack:g,occurrenceStack:R};f.push(x),f.push(a)}else if(y instanceof me)f.push({idx:m,def:y.definition.concat(te(h)),ruleStack:g,occurrenceStack:R});else if(y instanceof cn)f.push(hR(y,m,g,R));else throw Error("non exhaustive match")}return c}function hR(t,e,n,r){const i=se(n);i.push(t.name);const s=se(r);return s.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:s}}var H;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(H||(H={}));function Xa(t){if(t instanceof ie||t==="Option")return H.OPTION;if(t instanceof z||t==="Repetition")return H.REPETITION;if(t instanceof xe||t==="RepetitionMandatory")return H.REPETITION_MANDATORY;if(t instanceof ke||t==="RepetitionMandatoryWithSeparator")return H.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof ge||t==="RepetitionWithSeparator")return H.REPETITION_WITH_SEPARATOR;if(t instanceof ye||t==="Alternation")return H.ALTERNATION;throw Error("non exhaustive match")}function hl(t){const{occurrence:e,rule:n,prodType:r,maxLookahead:i}=t,s=Xa(r);return s===H.ALTERNATION?Yi(e,n,i):Xi(e,n,s,i)}function pR(t,e,n,r,i,s){const a=Yi(t,e,n),o=cf(a)?hi:gr;return s(a,r,o,i)}function mR(t,e,n,r,i,s){const a=Xi(t,e,i,n),o=cf(a)?hi:gr;return s(a[0],o,r)}function gR(t,e,n,r){const i=t.length,s=Ue(t,a=>Ue(a,o=>o.length===1));if(e)return function(a){const o=I(a,l=>l.GATE);for(let l=0;lGe(l)),o=Se(a,(l,u,c)=>(w(u,f=>{C(l,f.tokenTypeIdx)||(l[f.tokenTypeIdx]=c),w(f.categoryMatches,d=>{C(l,d)||(l[d]=c)})}),l),{});return function(){const l=this.LA(1);return o[l.tokenTypeIdx]}}else return function(){for(let a=0;as.length===1),i=t.length;if(r&&!n){const s=Ge(t);if(s.length===1&&U(s[0].categoryMatches)){const o=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===o}}else{const a=Se(s,(o,l,u)=>(o[l.tokenTypeIdx]=!0,w(l.categoryMatches,c=>{o[c]=!0}),o),[]);return function(){const o=this.LA(1);return a[o.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;sqs([a],1)),r=pl(n.length),i=I(n,a=>{const o={};return w(a,l=>{const u=gs(l.partialPath);w(u,c=>{o[c]=!0})}),o});let s=n;for(let a=1;a<=e;a++){const o=s;s=pl(o.length);for(let l=0;l{const y=gs(R.partialPath);w(y,E=>{i[l][E]=!0})})}}}}return r}function Yi(t,e,n,r){const i=new lf(t,H.ALTERNATION,r);return e.accept(i),uf(i.result,n)}function Xi(t,e,n,r){const i=new lf(t,n);e.accept(i);const s=i.result,o=new TR(e,t,n).startWalking(),l=new me({definition:s}),u=new me({definition:o});return uf([l,u],r)}function Ys(t,e){e:for(let n=0;n{const i=e[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function cf(t){return Ue(t,e=>Ue(e,n=>Ue(n,r=>U(r.categoryMatches))))}function AR(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return I(e,n=>Object.assign({type:fe.CUSTOM_LOOKAHEAD_VALIDATION},n))}function ER(t,e,n,r){const i=_e(t,l=>$R(l,n)),s=PR(t,e,n),a=_e(t,l=>NR(l,n)),o=_e(t,l=>kR(l,t,r,n));return i.concat(s,a,o)}function $R(t,e){const n=new xR;t.accept(n);const r=n.allProductions,i=jT(r,SR),s=Ke(i,o=>o.length>1);return I(J(s),o=>{const l=je(o),u=e.buildDuplicateFoundError(t,o),c=We(l),f={message:u,type:fe.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:c,occurrence:l.idx},d=ff(l);return d&&(f.parameter=d),f})}function SR(t){return`${We(t)}_#_${t.idx}_#_${ff(t)}`}function ff(t){return t instanceof j?t.terminalType.name:t instanceof ce?t.nonTerminalName:""}class xR extends fn{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function kR(t,e,n,r){const i=[];if(Se(e,(a,o)=>o.name===t.name?a+1:a,0)>1){const a=r.buildDuplicateRuleNameError({topLevelRule:t,grammarName:n});i.push({message:a,type:fe.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function IR(t,e,n){const r=[];let i;return de(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:fe.INVALID_RULE_OVERRIDE,ruleName:t})),r}function df(t,e,n,r=[]){const i=[],s=Yr(e.definition);if(U(s))return[];{const a=t.name;de(s,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:fe.LEFT_RECURSION,ruleName:a});const l=Hi(s,r.concat([t])),u=_e(l,c=>{const f=se(r);return f.push(c),df(t,c,n,f)});return i.concat(u)}}function Yr(t){let e=[];if(U(t))return e;const n=je(t);if(n instanceof ce)e.push(n.referencedRule);else if(n instanceof me||n instanceof ie||n instanceof xe||n instanceof ke||n instanceof ge||n instanceof z)e=e.concat(Yr(n.definition));else if(n instanceof ye)e=Ge(I(n.definition,s=>Yr(s.definition)));else if(!(n instanceof j))throw Error("non exhaustive match");const r=fi(n),i=t.length>1;if(r&&i){const s=te(t);return e.concat(Yr(s))}else return e}class Ja extends fn{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function CR(t,e){const n=new Ja;t.accept(n);const r=n.alternations;return _e(r,s=>{const a=sr(s.definition);return _e(a,(o,l)=>{const u=of([o],[],gr,1);return U(u)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:s,emptyChoiceIdx:l}),type:fe.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:s.idx,alternative:l+1}]:[]})})}function wR(t,e,n){const r=new Ja;t.accept(r);let i=r.alternations;return i=Vi(i,a=>a.ignoreAmbiguities===!0),_e(i,a=>{const o=a.idx,l=a.maxLookahead||e,u=Yi(o,t,l,a),c=OR(u,a,t,n),f=LR(u,a,t,n);return c.concat(f)})}class _R extends fn{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}function NR(t,e){const n=new Ja;t.accept(n);const r=n.alternations;return _e(r,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:s}),type:fe.TOO_MANY_ALTS,ruleName:t.name,occurrence:s.idx}]:[])}function bR(t,e,n){const r=[];return w(t,i=>{const s=new _R;i.accept(s);const a=s.allProductions;w(a,o=>{const l=Xa(o),u=o.maxLookahead||e,c=o.idx,d=Xi(c,i,l,u)[0];if(U(Ge(d))){const h=n.buildEmptyRepetitionError({topLevelRule:i,repetition:o});r.push({message:h,type:fe.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function OR(t,e,n,r){const i=[],s=Se(t,(o,l,u)=>(e.definition[u].ignoreAmbiguities===!0||w(l,c=>{const f=[u];w(t,(d,h)=>{u!==h&&Ys(d,c)&&e.definition[h].ignoreAmbiguities!==!0&&f.push(h)}),f.length>1&&!Ys(i,c)&&(i.push(c),o.push({alts:f,path:c}))}),o),[]);return I(s,o=>{const l=I(o.alts,c=>c+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:l,prefixPath:o.path}),type:fe.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:e.idx,alternatives:o.alts}})}function LR(t,e,n,r){const i=Se(t,(a,o,l)=>{const u=I(o,c=>({idx:l,path:c}));return a.concat(u)},[]);return pr(_e(i,a=>{if(e.definition[a.idx].ignoreAmbiguities===!0)return[];const l=a.idx,u=a.path,c=Pe(i,d=>e.definition[d.idx].ignoreAmbiguities!==!0&&d.idx{const h=[d.idx+1,l+1],m=e.idx===0?"":e.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:h,prefixPath:d.path}),type:fe.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:m,alternatives:h}})}))}function PR(t,e,n){const r=[],i=I(e,s=>s.name);return w(t,s=>{const a=s.name;if(de(i,a)){const o=n.buildNamespaceConflictError(s);r.push({message:o,type:fe.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),r}function MR(t){const e=Wa(t,{errMsgProvider:aR}),n={};return w(t.rules,r=>{n[r.name]=r}),oR(n,e.errMsgProvider)}function DR(t){return t=Wa(t,{errMsgProvider:bt}),ER(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}const hf="MismatchedTokenException",pf="NoViableAltException",mf="EarlyExitException",gf="NotAllInputParsedException",yf=[hf,pf,mf,gf];Object.freeze(yf);function pi(t){return de(yf,t.name)}class Ji extends Error{constructor(e,n){super(e),this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class Tf extends Ji{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=hf}}class FR extends Ji{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=pf}}class GR extends Ji{constructor(e,n){super(e,n),this.name=gf}}class UR extends Ji{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=mf}}const ys={},vf="InRuleRecoveryException";class BR extends Error{constructor(e){super(e),this.name=vf}}class jR{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=C(e,"recoveryEnabled")?e.recoveryEnabled:ut.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=KR)}getTokenToInsert(e){const n=Ya(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return n.isInsertedInRecovery=!0,n}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,n,r,i){const s=this.findReSyncTokenType(),a=this.exportLexerState(),o=[];let l=!1;const u=this.LA(1);let c=this.LA(1);const f=()=>{const d=this.LA(0),h=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:d,ruleName:this.getCurrRuleFullName()}),m=new Tf(h,u,this.LA(0));m.resyncedTokens=sr(o),this.SAVE_ERROR(m)};for(;!l;)if(this.tokenMatcher(c,i)){f();return}else if(r.call(this)){f(),e.apply(this,n);return}else this.tokenMatcher(c,s)?l=!0:(c=this.SKIP_TOKEN(),this.addToResyncTokens(c,o));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,n,r){return!(r===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,n)))}getFollowsForInRuleRecovery(e,n){const r=this.getCurrentGrammarPath(e,n);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(e,n){if(this.canRecoverWithSingleTokenInsertion(e,n))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){const r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new BR("sad sad panda")}canPerformInRuleRecovery(e,n){return this.canRecoverWithSingleTokenInsertion(e,n)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,n){if(!this.canTokenTypeBeInsertedInRecovery(e)||U(n))return!1;const r=this.LA(1);return rn(n,s=>this.tokenMatcher(r,s))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){const n=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(n);return de(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let n=this.LA(1),r=2;for(;;){const i=rn(e,s=>af(n,s));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return ys;const e=this.getLastExplicitRuleShortName(),n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return I(e,(r,i)=>i===0?ys:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:n[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=I(this.buildFullFollowKeyStack(),n=>this.getFollowSetFromFollowKey(n));return Ge(e)}getFollowSetFromFollowKey(e){if(e===ys)return[yt];const n=e.ruleName+e.idxInCallingRule+qc+e.inRule;return this.resyncFollows[n]}addToResyncTokens(e,n){return this.tokenMatcher(e,yt)||n.push(e),n}reSyncTo(e){const n=[];let r=this.LA(1);for(;this.tokenMatcher(r,e)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,n);return sr(n)}attemptInRepetitionRecovery(e,n,r,i,s,a,o){}getCurrentGrammarPath(e,n){const r=this.getHumanReadableRuleStack(),i=se(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:i,lastTok:e,lastTokOccurrence:n}}getHumanReadableRuleStack(){return I(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function KR(t,e,n,r,i,s,a){const o=this.getKeyForAutomaticLookahead(r,i);let l=this.firstAfterRepMap[o];if(l===void 0){const d=this.getCurrRuleFullName(),h=this.getGAstProductions()[d];l=new s(h,i).startWalking(),this.firstAfterRepMap[o]=l}let u=l.token,c=l.occurrence;const f=l.isEndOfRule;this.RULE_STACK.length===1&&f&&u===void 0&&(u=yt,c=1),!(u===void 0||c===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,c,a)&&this.tryInRepetitionRecovery(t,e,n,u)}const HR=4,At=8,Rf=1<df(n,n,bt))}validateEmptyOrAlternatives(e){return _e(e,n=>CR(n,bt))}validateAmbiguousAlternationAlternatives(e,n){return _e(e,r=>wR(r,n,bt))}validateSomeNonEmptyLookaheadPath(e,n){return bR(e,n,bt)}buildLookaheadForAlternation(e){return pR(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,gR)}buildLookaheadForOptional(e){return mR(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Xa(e.prodType),yR)}}class VR{initLooksAhead(e){this.dynamicTokensEnabled=C(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:ut.dynamicTokensEnabled,this.maxLookahead=C(e,"maxLookahead")?e.maxLookahead:ut.maxLookahead,this.lookaheadStrategy=C(e,"lookaheadStrategy")?e.lookaheadStrategy:new Za({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){w(e,n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{const{alternation:r,repetition:i,option:s,repetitionMandatory:a,repetitionMandatoryWithSeparator:o,repetitionWithSeparator:l}=zR(n);w(r,u=>{const c=u.idx===0?"":u.idx;this.TRACE_INIT(`${We(u)}${c}`,()=>{const f=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:n,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),d=Ts(this.fullRuleNameToShort[n.name],Rf,u.idx);this.setLaFuncCache(d,f)})}),w(i,u=>{this.computeLookaheadFunc(n,u.idx,Xs,"Repetition",u.maxLookahead,We(u))}),w(s,u=>{this.computeLookaheadFunc(n,u.idx,Af,"Option",u.maxLookahead,We(u))}),w(a,u=>{this.computeLookaheadFunc(n,u.idx,Js,"RepetitionMandatory",u.maxLookahead,We(u))}),w(o,u=>{this.computeLookaheadFunc(n,u.idx,Xr,"RepetitionMandatoryWithSeparator",u.maxLookahead,We(u))}),w(l,u=>{this.computeLookaheadFunc(n,u.idx,Zs,"RepetitionWithSeparator",u.maxLookahead,We(u))})})})}computeLookaheadFunc(e,n,r,i,s,a){this.TRACE_INIT(`${a}${n===0?"":n}`,()=>{const o=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:n,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),l=Ts(this.fullRuleNameToShort[e.name],r,n);this.setLaFuncCache(l,o)})}getKeyForAutomaticLookahead(e,n){const r=this.getLastExplicitRuleShortName();return Ts(r,e,n)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,n){this.lookAheadFuncsCache.set(e,n)}}class WR extends fn{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}const Lr=new WR;function zR(t){Lr.reset(),t.accept(Lr);const e=Lr.dslMethods;return Lr.reset(),e}function ml(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffseta.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>: + ${s.join(` + +`).replace(/\n/g,` + `)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=e,n}function QR(t,e,n){const r=function(){};Ef(r,t+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return w(e,s=>{i[s]=JR}),r.prototype=i,r.prototype.constructor=r,r}var Qs;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(Qs||(Qs={}));function eA(t,e){return tA(t,e)}function tA(t,e){const n=Pe(e,i=>ct(t[i])===!1),r=I(n,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:Qs.MISSING_METHOD,methodName:i}));return pr(r)}class nA{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=C(e,"nodeLocationTracking")?e.nodeLocationTracking:ut.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=X,this.cstFinallyStateUpdate=X,this.cstPostTerminal=X,this.cstPostNonTerminal=X,this.cstPostRule=X;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=gl,this.setNodeLocationFromNode=gl,this.cstPostRule=X,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=X,this.setNodeLocationFromNode=X,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ml,this.setNodeLocationFromNode=ml,this.cstPostRule=X,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=X,this.setNodeLocationFromNode=X,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=X,this.setNodeLocationFromNode=X,this.cstPostRule=X,this.setInitialNodeLocation=X;else throw Error(`Invalid config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const n=this.LA(1);e.location={startOffset:n.startOffset,startLine:n.startLine,startColumn:n.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const n={name:e,children:Object.create(null)};this.setInitialNodeLocation(n),this.CST_STACK.push(n)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?(r.endOffset=n.endOffset,r.endLine=n.endLine,r.endColumn=n.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?r.endOffset=n.endOffset:r.startOffset=NaN}cstPostTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];qR(r,n,e),this.setNodeLocationFromToken(r.location,n)}cstPostNonTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];YR(r,n,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(lt(this.baseCstVisitorConstructor)){const e=ZR(this.className,Le(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(lt(this.baseCstVisitorWithDefaultsConstructor)){const e=QR(this.className,Le(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class rA{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):gi}LA(e){const n=this.currIdx+e;return n<0||this.tokVectorLength<=n?gi:this.tokVector[n]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class iA{ACTION(e){return e.call(this)}consume(e,n,r){return this.consumeInternal(n,e,r)}subrule(e,n,r){return this.subruleInternal(n,e,r)}option(e,n){return this.optionInternal(n,e)}or(e,n){return this.orInternal(n,e)}many(e,n){return this.manyInternal(e,n)}atLeastOne(e,n){return this.atLeastOneInternal(e,n)}CONSUME(e,n){return this.consumeInternal(e,0,n)}CONSUME1(e,n){return this.consumeInternal(e,1,n)}CONSUME2(e,n){return this.consumeInternal(e,2,n)}CONSUME3(e,n){return this.consumeInternal(e,3,n)}CONSUME4(e,n){return this.consumeInternal(e,4,n)}CONSUME5(e,n){return this.consumeInternal(e,5,n)}CONSUME6(e,n){return this.consumeInternal(e,6,n)}CONSUME7(e,n){return this.consumeInternal(e,7,n)}CONSUME8(e,n){return this.consumeInternal(e,8,n)}CONSUME9(e,n){return this.consumeInternal(e,9,n)}SUBRULE(e,n){return this.subruleInternal(e,0,n)}SUBRULE1(e,n){return this.subruleInternal(e,1,n)}SUBRULE2(e,n){return this.subruleInternal(e,2,n)}SUBRULE3(e,n){return this.subruleInternal(e,3,n)}SUBRULE4(e,n){return this.subruleInternal(e,4,n)}SUBRULE5(e,n){return this.subruleInternal(e,5,n)}SUBRULE6(e,n){return this.subruleInternal(e,6,n)}SUBRULE7(e,n){return this.subruleInternal(e,7,n)}SUBRULE8(e,n){return this.subruleInternal(e,8,n)}SUBRULE9(e,n){return this.subruleInternal(e,9,n)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,n,r=yi){if(de(this.definedRulesNames,e)){const a={message:bt.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:fe.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);const i=this.defineRule(e,n,r);return this[e]=i,i}OVERRIDE_RULE(e,n,r=yi){const i=IR(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);const s=this.defineRule(e,n,r);return this[e]=s,s}BACKTRACK(e,n){return function(){this.isBackTrackingStack.push(1);const r=this.saveRecogState();try{return e.apply(this,n),!0}catch(i){if(pi(i))return!1;throw i}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return hv(J(this.gastProductionsCache))}}class sA{initRecognizerEngine(e,n){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=hi,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},C(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a property. + See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0 + For Further details.`);if(P(e)){if(U(e))throw Error(`A Token Vocabulary cannot be empty. + Note that the first argument for the parser constructor + is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument. + See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0 + For Further details.`)}if(P(e))this.tokensMap=Se(e,(s,a)=>(s[a.name]=a,s),{});else if(C(e,"modes")&&Ue(Ge(J(e.modes)),rR)){const s=Ge(J(e.modes)),a=za(s);this.tokensMap=Se(a,(o,l)=>(o[l.name]=l,o),{})}else if(Oe(e))this.tokensMap=se(e);else throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=yt;const r=C(e,"modes")?Ge(J(e.modes)):J(e),i=Ue(r,s=>U(s.categoryMatches));this.tokenMatcher=i?hi:gr,yr(J(this.tokensMap))}defineRule(e,n,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called' +Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=C(r,"resyncEnabled")?r.resyncEnabled:yi.resyncEnabled,s=C(r,"recoveryValueFunc")?r.recoveryValueFunc:yi.recoveryValueFunc,a=this.ruleShortNameIdx<a.call(this)&&o.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,n){const r=this.getKeyForAutomaticLookahead(Js,e);return this.atLeastOneInternalLogic(e,n,r)}atLeastOneInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const a=n.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=n;if(i.call(this)===!0){let a=this.doSingleRepetition(s);for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,H.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,Js,e,dR)}atLeastOneSepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Xr,e);this.atLeastOneSepFirstInternalLogic(e,n,r)}atLeastOneSepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,dl],o,Xr,e,dl)}else throw this.raiseEarlyExitException(e,H.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(Xs,e);return this.manyInternalLogic(e,n,r)}manyInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const o=n.GATE;if(o!==void 0){const l=i;i=()=>o.call(this)&&l.call(this)}}else s=n;let a=!0;for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,n],i,Xs,e,fR,a)}manySepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Zs,e);this.manySepFirstInternalLogic(e,n,r)}manySepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,fl],o,Zs,e,fl)}}repetitionSepSecondInternal(e,n,r,i,s){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,i,s],r,Xr,e,s)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const r=this.getKeyForAutomaticLookahead(Rf,n),i=P(e)?e:e.DEF,a=this.getLaFuncFromCache(r).call(this,i);if(a!==void 0)return i[a].ALT.call(this);this.raiseNoAltException(n,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const e=this.LA(1),n=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new GR(n,e))}}subruleInternal(e,n,r){let i;try{const s=r!==void 0?r.ARGS:void 0;return this.subruleIdx=n,i=e.apply(this,s),this.cstPostNonTerminal(i,r!==void 0&&r.LABEL!==void 0?r.LABEL:e.ruleName),i}catch(s){throw this.subruleInternalError(s,r,e.ruleName)}}subruleInternalError(e,n,r){throw pi(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,n!==void 0&&n.LABEL!==void 0?n.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,n,r){let i;try{const s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),i=s):this.consumeInternalError(e,s,r)}catch(s){i=this.consumeInternalRecovery(e,n,s)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:e.name,i),i}consumeInternalError(e,n,r){let i;const s=this.LA(0);throw r!==void 0&&r.ERR_MSG?i=r.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:n,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Tf(i,n,s))}consumeInternalRecovery(e,n,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){const i=this.getFollowsForInRuleRecovery(e,n);try{return this.tryInRuleRecovery(e,i)}catch(s){throw s.name===vf?r:s}}else throw r}saveRecogState(){const e=this.errors,n=se(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:n,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,n,r){this.RULE_OCCURRENCE_STACK.push(r),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(n)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),yt)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class aA{initErrorHandler(e){this._errors=[],this.errorMessageProvider=C(e,"errorMessageProvider")?e.errorMessageProvider:ut.errorMessageProvider}SAVE_ERROR(e){if(pi(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:se(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return se(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,n,r){const i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],o=Xi(e,s,n,this.maxLookahead)[0],l=[];for(let c=1;c<=this.maxLookahead;c++)l.push(this.LA(c));const u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:o,actual:l,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new UR(u,this.LA(1),this.LA(0)))}raiseNoAltException(e,n){const r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],s=Yi(e,i,this.maxLookahead),a=[];for(let u=1;u<=this.maxLookahead;u++)a.push(this.LA(u));const o=this.LA(0),l=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:a,previous:o,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new FR(l,this.LA(1),o))}}class oA{initContentAssist(){}computeContentAssist(e,n){const r=this.gastProductionsCache[e];if(lt(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return of([r],n,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const n=je(e.ruleStack),i=this.getGAstProductions()[n];return new cR(i,e).startWalking()}}const Zi={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Zi);const yl=!0,Tl=Math.pow(2,At)-1,$f=sf({name:"RECORDING_PHASE_TOKEN",pattern:he.NA});yr([$f]);const Sf=Ya($f,`This IToken indicates the Parser is in Recording Phase + See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Sf);const lA={name:`This CSTNode indicates the Parser is in Recording Phase + See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class uA{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){const n=e>0?e:"";this[`CONSUME${n}`]=function(r,i){return this.consumeInternalRecord(r,e,i)},this[`SUBRULE${n}`]=function(r,i){return this.subruleInternalRecord(r,e,i)},this[`OPTION${n}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${n}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${n}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${n}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${n}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${n}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,n,r){return this.consumeInternalRecord(n,e,r)},this.subrule=function(e,n,r){return this.subruleInternalRecord(n,e,r)},this.option=function(e,n){return this.optionInternalRecord(n,e)},this.or=function(e,n){return this.orInternalRecord(n,e)},this.many=function(e,n){this.manyInternalRecord(e,n)},this.atLeastOne=function(e,n){this.atLeastOneInternalRecord(e,n)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let n=0;n<10;n++){const r=n>0?n:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,n){return()=>!0}LA_RECORD(e){return gi}topLevelRuleRecord(e,n){try{const r=new cn({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),n.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+` + This error was thrown during the "grammar recording phase" For more info see: + https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,n){return mn.call(this,ie,e,n)}atLeastOneInternalRecord(e,n){mn.call(this,xe,n,e)}atLeastOneSepFirstInternalRecord(e,n){mn.call(this,ke,n,e,yl)}manyInternalRecord(e,n){mn.call(this,z,n,e)}manySepFirstInternalRecord(e,n){mn.call(this,ge,n,e,yl)}orInternalRecord(e,n){return cA.call(this,e,n)}subruleInternalRecord(e,n,r){if(mi(n),!e||C(e,"ruleName")===!1){const o=new Error(` argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}> + inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const i=nn(this.recordingProdStack),s=e.ruleName,a=new ce({idx:n,nonTerminalName:s,label:r?.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?lA:Zi}consumeInternalRecord(e,n,r){if(mi(n),!nf(e)){const a=new Error(` argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}> + inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const i=nn(this.recordingProdStack),s=new j({idx:n,terminalType:e,label:r?.LABEL});return i.definition.push(s),Sf}}function mn(t,e,n,r=!1){mi(n);const i=nn(this.recordingProdStack),s=ct(e)?e:e.DEF,a=new t({definition:[],idx:n});return r&&(a.separator=e.SEP),C(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),Zi}function cA(t,e){mi(e);const n=nn(this.recordingProdStack),r=P(t)===!1,i=r===!1?t:t.DEF,s=new ye({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});C(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const a=Hc(i,o=>ct(o.GATE));return s.hasPredicates=a,n.definition.push(s),w(i,o=>{const l=new me({definition:[]});s.definition.push(l),C(o,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:C(o,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),o.ALT.call(this),this.recordingProdStack.pop()}),Zi}function vl(t){return t===0?"":`${t}`}function mi(t){if(t<0||t>Tl){const e=new Error(`Invalid DSL Method idx value: <${t}> + Idx value must be a none negative value smaller than ${Tl+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class fA{initPerformanceTracer(e){if(C(e,"traceInitPerf")){const n=e.traceInitPerf,r=typeof n=="number";this.traceInitMaxIdent=r?n:1/0,this.traceInitPerf=r?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=ut.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,n){if(this.traceInitPerf===!0){this.traceInitIndent++;const r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${e}>`);const{time:i,value:s}=Wc(n),a=i>10?console.warn:console.log;return this.traceInitIndent time: ${i}ms`),this.traceInitIndent--,s}else return n()}}function dA(t,e){e.forEach(n=>{const r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(t.prototype,i,s):t.prototype[i]=n.prototype[i]})})}const gi=Ya(yt,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(gi);const ut=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Xt,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),yi=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var fe;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(fe||(fe={}));function Rl(t=void 0){return function(){return t}}class Tr{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const n=this.className;this.TRACE_INIT("toFastProps",()=>{zc(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),w(this.definedRulesNames,i=>{const a=this[i].originalGrammarAction;let o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,a)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=MR({rules:J(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(U(r)&&this.skipValidations===!1){const i=DR({rules:J(this.gastProductionsCache),tokenTypes:J(this.tokensMap),errMsgProvider:bt,grammarName:n}),s=AR({lookaheadStrategy:this.lookaheadStrategy,rules:J(this.gastProductionsCache),tokenTypes:J(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),U(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=Rv(J(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,s;(s=(i=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(i,{rules:J(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(J(this.gastProductionsCache))})),!Tr.DEFER_DEFINITION_ERRORS_HANDLING&&!U(this.definitionErrors))throw e=I(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected: + ${e.join(` +------------------------------- +`)}`)})}constructor(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;const r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(e,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),C(n,"ignoredIssues"))throw new Error(`The IParserConfig property has been deprecated. + Please use the flag on the relevant DSL method instead. + See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES + For further details.`);this.skipValidations=C(n,"skipValidations")?n.skipValidations:ut.skipValidations}}Tr.DEFER_DEFINITION_ERRORS_HANDLING=!1;dA(Tr,[jR,VR,nA,rA,sA,iA,aA,oA,uA,fA]);class hA extends Tr{constructor(e,n=ut){const r=se(n);r.outputCst=!1,super(e,r)}}function sn(t,e,n){return`${t.name}_${e}_${n}`}const Tt=1,pA=2,xf=4,kf=5,vr=7,mA=8,gA=9,yA=10,TA=11,If=12;class Qa{constructor(e){this.target=e}isEpsilon(){return!1}}class eo extends Qa{constructor(e,n){super(e),this.tokenType=n}}class Cf extends Qa{constructor(e){super(e)}isEpsilon(){return!0}}class to extends Qa{constructor(e,n,r){super(e),this.rule=n,this.followState=r}isEpsilon(){return!0}}function vA(t){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};RA(e,t);const n=t.length;for(let r=0;rwf(t,e,a));return dn(t,e,r,n,...i)}function kA(t,e,n){const r=Q(t,e,n,{type:Tt});Et(t,r);const i=dn(t,e,r,n,Ht(t,e,n));return IA(t,e,n,i)}function Ht(t,e,n){const r=Cd(st(n.definition,i=>wf(t,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:wA(t,r)}function _f(t,e,n,r,i){const s=r.left,a=r.right,o=Q(t,e,n,{type:TA});Et(t,o);const l=Q(t,e,n,{type:If});return s.loopback=o,l.loopback=o,t.decisionMap[sn(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=o,Y(a,o),i===void 0?(Y(o,s),Y(o,l)):(Y(o,l),Y(o,i.left),Y(i.right,s)),{left:s,right:l}}function Nf(t,e,n,r,i){const s=r.left,a=r.right,o=Q(t,e,n,{type:yA});Et(t,o);const l=Q(t,e,n,{type:If}),u=Q(t,e,n,{type:gA});return o.loopback=u,l.loopback=u,Y(o,s),Y(o,l),Y(a,u),i!==void 0?(Y(u,l),Y(u,i.left),Y(i.right,s)):Y(u,o),t.decisionMap[sn(e,i?"RepetitionWithSeparator":"Repetition",n.idx)]=o,{left:o,right:l}}function IA(t,e,n,r){const i=r.left,s=r.right;return Y(i,s),t.decisionMap[sn(e,"Option",n.idx)]=i,r}function Et(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function dn(t,e,n,r,...i){const s=Q(t,e,r,{type:mA,start:n});n.end=s;for(const o of i)o!==void 0?(Y(n,o.left),Y(o.right,s)):Y(n,s);const a={left:n,right:s};return t.decisionMap[sn(e,CA(r),r.idx)]=n,a}function CA(t){if(t instanceof ye)return"Alternation";if(t instanceof ie)return"Option";if(t instanceof z)return"Repetition";if(t instanceof ge)return"RepetitionWithSeparator";if(t instanceof xe)return"RepetitionMandatory";if(t instanceof ke)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function wA(t,e){const n=e.length;for(let s=0;se.alt)}get key(){let e="";for(const n in this.map)e+=n+":";return e}}function bf(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(n=>n.stateNumber.toString()).join("_")}`}function OA(t,e){const n={};return r=>{const i=r.toString();let s=n[i];return s!==void 0||(s={atnStartState:t,decision:e,states:{}},n[i]=s),s}}class Of{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,n){this.predicates[e]=n}toString(){let e="";const n=this.predicates.length;for(let r=0;rconsole.log(r))}initialize(e){this.atn=vA(e.rules),this.dfas=PA(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:n,rule:r,hasPredicates:i,dynamicTokensEnabled:s}=e,a=this.dfas,o=this.logging,l=sn(r,"Alternation",n),c=this.atn.decisionMap[l].decision,f=st(hl({maxLookahead:1,occurrence:n,prodType:"Alternation",rule:r}),d=>st(d,h=>h[0]));if(El(f,!1)&&!s){const d=fo(f,(h,m,g)=>(rs(m,R=>{R&&(h[R.tokenTypeIdx]=g,rs(R.categoryMatches,y=>{h[y]=g}))}),h),{});return i?function(h){var m;const g=this.LA(1),R=d[g.tokenTypeIdx];if(h!==void 0&&R!==void 0){const y=(m=h[R])===null||m===void 0?void 0:m.GATE;if(y!==void 0&&y.call(this)===!1)return}return R}:function(){const h=this.LA(1);return d[h.tokenTypeIdx]}}else return i?function(d){const h=new Of,m=d===void 0?0:d.length;for(let R=0;Rst(d,h=>h[0]));if(El(f)&&f[0][0]&&!s){const d=f[0],h=$d(d);if(h.length===1&&wd(h[0].categoryMatches)){const g=h[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===g}}else{const m=fo(h,(g,R)=>(R!==void 0&&(g[R.tokenTypeIdx]=!0,rs(R.categoryMatches,y=>{g[y]=!0})),g),{});return function(){const g=this.LA(1);return m[g.tokenTypeIdx]===!0}}}return function(){const d=vs.call(this,a,c,Al,o);return typeof d=="object"?!1:d===0}}}function El(t,e=!0){const n=new Set;for(const r of t){const i=new Set;for(const s of r){if(s===void 0){if(e)break;return!1}const a=[s.tokenTypeIdx].concat(s.categoryMatches);for(const o of a)if(n.has(o)){if(!i.has(o))return!1}else n.add(o),i.add(o)}}return!0}function PA(t){const e=t.decisionStates.length,n=Array(e);for(let r=0;rQt(i)).join(", "),n=t.production.idx===0?"":t.production.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${UA(t.production)}${n}> inside <${t.topLevelRule.name}> Rule, +<${e}> may appears as a prefix path in all these alternatives. +`;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES +For Further details.`,r}function UA(t){if(t instanceof ce)return"SUBRULE";if(t instanceof ie)return"OPTION";if(t instanceof ye)return"OR";if(t instanceof xe)return"AT_LEAST_ONE";if(t instanceof ke)return"AT_LEAST_ONE_SEP";if(t instanceof ge)return"MANY_SEP";if(t instanceof z)return"MANY";if(t instanceof j)return"CONSUME";throw Error("non exhaustive match")}function BA(t,e,n){const r=_d(e.configs.elements,s=>s.state.transitions),i=Nd(r.filter(s=>s instanceof eo).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:n,possibleTokenTypes:i,tokenPath:t}}function jA(t,e){return t.edges[e.tokenTypeIdx]}function KA(t,e,n){const r=new ea,i=[];for(const a of t.elements){if(n.is(a.alt)===!1)continue;if(a.state.type===vr){i.push(a);continue}const o=a.state.transitions.length;for(let l=0;l0&&!qA(s))for(const a of i)s.add(a);return s}function HA(t,e){if(t instanceof eo&&af(e,t.tokenType))return t.target}function VA(t,e){let n;for(const r of t.elements)if(e.is(r.alt)===!0){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}function Lf(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function $l(t,e,n,r){return r=Pf(t,r),e.edges[n.tokenTypeIdx]=r,r}function Pf(t,e){if(e===Ti)return e;const n=e.configs.key,r=t.states[n];return r!==void 0?r:(e.configs.finalize(),t.states[n]=e,e)}function WA(t){const e=new ea,n=t.transitions.length;for(let r=0;r0){const i=[...t.stack],a={state:i.pop(),alt:t.alt,stack:i};vi(a,e)}else e.add(t);return}n.epsilonOnlyTransitions||e.add(t);const r=n.transitions.length;for(let i=0;i1)return!0;return!1}function QA(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var Sl;(function(t){function e(n){return typeof n=="string"}t.is=e})(Sl||(Sl={}));var ta;(function(t){function e(n){return typeof n=="string"}t.is=e})(ta||(ta={}));var xl;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(xl||(xl={}));var Ri;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(Ri||(Ri={}));var D;(function(t){function e(r,i){return r===Number.MAX_VALUE&&(r=Ri.MAX_VALUE),i===Number.MAX_VALUE&&(i=Ri.MAX_VALUE),{line:r,character:i}}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&p.uinteger(i.line)&&p.uinteger(i.character)}t.is=n})(D||(D={}));var L;(function(t){function e(r,i,s,a){if(p.uinteger(r)&&p.uinteger(i)&&p.uinteger(s)&&p.uinteger(a))return{start:D.create(r,i),end:D.create(s,a)};if(D.is(r)&&D.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${s}, ${a}]`)}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&D.is(i.start)&&D.is(i.end)}t.is=n})(L||(L={}));var Ai;(function(t){function e(r,i){return{uri:r,range:i}}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&L.is(i.range)&&(p.string(i.uri)||p.undefined(i.uri))}t.is=n})(Ai||(Ai={}));var kl;(function(t){function e(r,i,s,a){return{targetUri:r,targetRange:i,targetSelectionRange:s,originSelectionRange:a}}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&L.is(i.targetRange)&&p.string(i.targetUri)&&L.is(i.targetSelectionRange)&&(L.is(i.originSelectionRange)||p.undefined(i.originSelectionRange))}t.is=n})(kl||(kl={}));var na;(function(t){function e(r,i,s,a){return{red:r,green:i,blue:s,alpha:a}}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&p.numberRange(i.red,0,1)&&p.numberRange(i.green,0,1)&&p.numberRange(i.blue,0,1)&&p.numberRange(i.alpha,0,1)}t.is=n})(na||(na={}));var Il;(function(t){function e(r,i){return{range:r,color:i}}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&L.is(i.range)&&na.is(i.color)}t.is=n})(Il||(Il={}));var Cl;(function(t){function e(r,i,s){return{label:r,textEdit:i,additionalTextEdits:s}}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&p.string(i.label)&&(p.undefined(i.textEdit)||on.is(i))&&(p.undefined(i.additionalTextEdits)||p.typedArray(i.additionalTextEdits,on.is))}t.is=n})(Cl||(Cl={}));var wl;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(wl||(wl={}));var _l;(function(t){function e(r,i,s,a,o,l){const u={startLine:r,endLine:i};return p.defined(s)&&(u.startCharacter=s),p.defined(a)&&(u.endCharacter=a),p.defined(o)&&(u.kind=o),p.defined(l)&&(u.collapsedText=l),u}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&p.uinteger(i.startLine)&&p.uinteger(i.startLine)&&(p.undefined(i.startCharacter)||p.uinteger(i.startCharacter))&&(p.undefined(i.endCharacter)||p.uinteger(i.endCharacter))&&(p.undefined(i.kind)||p.string(i.kind))}t.is=n})(_l||(_l={}));var ra;(function(t){function e(r,i){return{location:r,message:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&Ai.is(i.location)&&p.string(i.message)}t.is=n})(ra||(ra={}));var Nl;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(Nl||(Nl={}));var bl;(function(t){t.Unnecessary=1,t.Deprecated=2})(bl||(bl={}));var Ol;(function(t){function e(n){const r=n;return p.objectLiteral(r)&&p.string(r.href)}t.is=e})(Ol||(Ol={}));var Ei;(function(t){function e(r,i,s,a,o,l){let u={range:r,message:i};return p.defined(s)&&(u.severity=s),p.defined(a)&&(u.code=a),p.defined(o)&&(u.source=o),p.defined(l)&&(u.relatedInformation=l),u}t.create=e;function n(r){var i;let s=r;return p.defined(s)&&L.is(s.range)&&p.string(s.message)&&(p.number(s.severity)||p.undefined(s.severity))&&(p.integer(s.code)||p.string(s.code)||p.undefined(s.code))&&(p.undefined(s.codeDescription)||p.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(p.string(s.source)||p.undefined(s.source))&&(p.undefined(s.relatedInformation)||p.typedArray(s.relatedInformation,ra.is))}t.is=n})(Ei||(Ei={}));var an;(function(t){function e(r,i,...s){let a={title:r,command:i};return p.defined(s)&&s.length>0&&(a.arguments=s),a}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.title)&&p.string(i.command)}t.is=n})(an||(an={}));var on;(function(t){function e(s,a){return{range:s,newText:a}}t.replace=e;function n(s,a){return{range:{start:s,end:s},newText:a}}t.insert=n;function r(s){return{range:s,newText:""}}t.del=r;function i(s){const a=s;return p.objectLiteral(a)&&p.string(a.newText)&&L.is(a.range)}t.is=i})(on||(on={}));var ia;(function(t){function e(r,i,s){const a={label:r};return i!==void 0&&(a.needsConfirmation=i),s!==void 0&&(a.description=s),a}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&p.string(i.label)&&(p.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(p.string(i.description)||i.description===void 0)}t.is=n})(ia||(ia={}));var ln;(function(t){function e(n){const r=n;return p.string(r)}t.is=e})(ln||(ln={}));var Ll;(function(t){function e(s,a,o){return{range:s,newText:a,annotationId:o}}t.replace=e;function n(s,a,o){return{range:{start:s,end:s},newText:a,annotationId:o}}t.insert=n;function r(s,a){return{range:s,newText:"",annotationId:a}}t.del=r;function i(s){const a=s;return on.is(a)&&(ia.is(a.annotationId)||ln.is(a.annotationId))}t.is=i})(Ll||(Ll={}));var sa;(function(t){function e(r,i){return{textDocument:r,edits:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&ca.is(i.textDocument)&&Array.isArray(i.edits)}t.is=n})(sa||(sa={}));var aa;(function(t){function e(r,i,s){let a={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}t.create=e;function n(r){let i=r;return i&&i.kind==="create"&&p.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||p.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||p.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||ln.is(i.annotationId))}t.is=n})(aa||(aa={}));var oa;(function(t){function e(r,i,s,a){let o={kind:"rename",oldUri:r,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(o.options=s),a!==void 0&&(o.annotationId=a),o}t.create=e;function n(r){let i=r;return i&&i.kind==="rename"&&p.string(i.oldUri)&&p.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||p.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||p.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||ln.is(i.annotationId))}t.is=n})(oa||(oa={}));var la;(function(t){function e(r,i,s){let a={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}t.create=e;function n(r){let i=r;return i&&i.kind==="delete"&&p.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||p.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||p.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||ln.is(i.annotationId))}t.is=n})(la||(la={}));var ua;(function(t){function e(n){let r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(i=>p.string(i.kind)?aa.is(i)||oa.is(i)||la.is(i):sa.is(i)))}t.is=e})(ua||(ua={}));var Pl;(function(t){function e(r){return{uri:r}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.uri)}t.is=n})(Pl||(Pl={}));var Ml;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.uri)&&p.integer(i.version)}t.is=n})(Ml||(Ml={}));var ca;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.uri)&&(i.version===null||p.integer(i.version))}t.is=n})(ca||(ca={}));var Dl;(function(t){function e(r,i,s,a){return{uri:r,languageId:i,version:s,text:a}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.uri)&&p.string(i.languageId)&&p.integer(i.version)&&p.string(i.text)}t.is=n})(Dl||(Dl={}));var fa;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(n){const r=n;return r===t.PlainText||r===t.Markdown}t.is=e})(fa||(fa={}));var ar;(function(t){function e(n){const r=n;return p.objectLiteral(n)&&fa.is(r.kind)&&p.string(r.value)}t.is=e})(ar||(ar={}));var Fl;(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(Fl||(Fl={}));var Gl;(function(t){t.PlainText=1,t.Snippet=2})(Gl||(Gl={}));var Ul;(function(t){t.Deprecated=1})(Ul||(Ul={}));var Bl;(function(t){function e(r,i,s){return{newText:r,insert:i,replace:s}}t.create=e;function n(r){const i=r;return i&&p.string(i.newText)&&L.is(i.insert)&&L.is(i.replace)}t.is=n})(Bl||(Bl={}));var jl;(function(t){t.asIs=1,t.adjustIndentation=2})(jl||(jl={}));var Kl;(function(t){function e(n){const r=n;return r&&(p.string(r.detail)||r.detail===void 0)&&(p.string(r.description)||r.description===void 0)}t.is=e})(Kl||(Kl={}));var Hl;(function(t){function e(n){return{label:n}}t.create=e})(Hl||(Hl={}));var Vl;(function(t){function e(n,r){return{items:n||[],isIncomplete:!!r}}t.create=e})(Vl||(Vl={}));var $i;(function(t){function e(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function n(r){const i=r;return p.string(i)||p.objectLiteral(i)&&p.string(i.language)&&p.string(i.value)}t.is=n})($i||($i={}));var Wl;(function(t){function e(n){let r=n;return!!r&&p.objectLiteral(r)&&(ar.is(r.contents)||$i.is(r.contents)||p.typedArray(r.contents,$i.is))&&(n.range===void 0||L.is(n.range))}t.is=e})(Wl||(Wl={}));var zl;(function(t){function e(n,r){return r?{label:n,documentation:r}:{label:n}}t.create=e})(zl||(zl={}));var ql;(function(t){function e(n,r,...i){let s={label:n};return p.defined(r)&&(s.documentation=r),p.defined(i)?s.parameters=i:s.parameters=[],s}t.create=e})(ql||(ql={}));var Yl;(function(t){t.Text=1,t.Read=2,t.Write=3})(Yl||(Yl={}));var Xl;(function(t){function e(n,r){let i={range:n};return p.number(r)&&(i.kind=r),i}t.create=e})(Xl||(Xl={}));var Jl;(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(Jl||(Jl={}));var Zl;(function(t){t.Deprecated=1})(Zl||(Zl={}));var Ql;(function(t){function e(n,r,i,s,a){let o={name:n,kind:r,location:{uri:s,range:i}};return a&&(o.containerName=a),o}t.create=e})(Ql||(Ql={}));var eu;(function(t){function e(n,r,i,s){return s!==void 0?{name:n,kind:r,location:{uri:i,range:s}}:{name:n,kind:r,location:{uri:i}}}t.create=e})(eu||(eu={}));var tu;(function(t){function e(r,i,s,a,o,l){let u={name:r,detail:i,kind:s,range:a,selectionRange:o};return l!==void 0&&(u.children=l),u}t.create=e;function n(r){let i=r;return i&&p.string(i.name)&&p.number(i.kind)&&L.is(i.range)&&L.is(i.selectionRange)&&(i.detail===void 0||p.string(i.detail))&&(i.deprecated===void 0||p.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=n})(tu||(tu={}));var nu;(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})(nu||(nu={}));var Si;(function(t){t.Invoked=1,t.Automatic=2})(Si||(Si={}));var ru;(function(t){function e(r,i,s){let a={diagnostics:r};return i!=null&&(a.only=i),s!=null&&(a.triggerKind=s),a}t.create=e;function n(r){let i=r;return p.defined(i)&&p.typedArray(i.diagnostics,Ei.is)&&(i.only===void 0||p.typedArray(i.only,p.string))&&(i.triggerKind===void 0||i.triggerKind===Si.Invoked||i.triggerKind===Si.Automatic)}t.is=n})(ru||(ru={}));var iu;(function(t){function e(r,i,s){let a={title:r},o=!0;return typeof i=="string"?(o=!1,a.kind=i):an.is(i)?a.command=i:a.edit=i,o&&s!==void 0&&(a.kind=s),a}t.create=e;function n(r){let i=r;return i&&p.string(i.title)&&(i.diagnostics===void 0||p.typedArray(i.diagnostics,Ei.is))&&(i.kind===void 0||p.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||an.is(i.command))&&(i.isPreferred===void 0||p.boolean(i.isPreferred))&&(i.edit===void 0||ua.is(i.edit))}t.is=n})(iu||(iu={}));var su;(function(t){function e(r,i){let s={range:r};return p.defined(i)&&(s.data=i),s}t.create=e;function n(r){let i=r;return p.defined(i)&&L.is(i.range)&&(p.undefined(i.command)||an.is(i.command))}t.is=n})(su||(su={}));var au;(function(t){function e(r,i){return{tabSize:r,insertSpaces:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.uinteger(i.tabSize)&&p.boolean(i.insertSpaces)}t.is=n})(au||(au={}));var ou;(function(t){function e(r,i,s){return{range:r,target:i,data:s}}t.create=e;function n(r){let i=r;return p.defined(i)&&L.is(i.range)&&(p.undefined(i.target)||p.string(i.target))}t.is=n})(ou||(ou={}));var lu;(function(t){function e(r,i){return{range:r,parent:i}}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&L.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=n})(lu||(lu={}));var uu;(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(uu||(uu={}));var cu;(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(cu||(cu={}));var fu;(function(t){function e(n){const r=n;return p.objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}t.is=e})(fu||(fu={}));var du;(function(t){function e(r,i){return{range:r,text:i}}t.create=e;function n(r){const i=r;return i!=null&&L.is(i.range)&&p.string(i.text)}t.is=n})(du||(du={}));var hu;(function(t){function e(r,i,s){return{range:r,variableName:i,caseSensitiveLookup:s}}t.create=e;function n(r){const i=r;return i!=null&&L.is(i.range)&&p.boolean(i.caseSensitiveLookup)&&(p.string(i.variableName)||i.variableName===void 0)}t.is=n})(hu||(hu={}));var pu;(function(t){function e(r,i){return{range:r,expression:i}}t.create=e;function n(r){const i=r;return i!=null&&L.is(i.range)&&(p.string(i.expression)||i.expression===void 0)}t.is=n})(pu||(pu={}));var mu;(function(t){function e(r,i){return{frameId:r,stoppedLocation:i}}t.create=e;function n(r){const i=r;return p.defined(i)&&L.is(r.stoppedLocation)}t.is=n})(mu||(mu={}));var da;(function(t){t.Type=1,t.Parameter=2;function e(n){return n===1||n===2}t.is=e})(da||(da={}));var ha;(function(t){function e(r){return{value:r}}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&(i.tooltip===void 0||p.string(i.tooltip)||ar.is(i.tooltip))&&(i.location===void 0||Ai.is(i.location))&&(i.command===void 0||an.is(i.command))}t.is=n})(ha||(ha={}));var gu;(function(t){function e(r,i,s){const a={position:r,label:i};return s!==void 0&&(a.kind=s),a}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&D.is(i.position)&&(p.string(i.label)||p.typedArray(i.label,ha.is))&&(i.kind===void 0||da.is(i.kind))&&i.textEdits===void 0||p.typedArray(i.textEdits,on.is)&&(i.tooltip===void 0||p.string(i.tooltip)||ar.is(i.tooltip))&&(i.paddingLeft===void 0||p.boolean(i.paddingLeft))&&(i.paddingRight===void 0||p.boolean(i.paddingRight))}t.is=n})(gu||(gu={}));var yu;(function(t){function e(n){return{kind:"snippet",value:n}}t.createSnippet=e})(yu||(yu={}));var Tu;(function(t){function e(n,r,i,s){return{insertText:n,filterText:r,range:i,command:s}}t.create=e})(Tu||(Tu={}));var vu;(function(t){function e(n){return{items:n}}t.create=e})(vu||(vu={}));var Ru;(function(t){t.Invoked=0,t.Automatic=1})(Ru||(Ru={}));var Au;(function(t){function e(n,r){return{range:n,text:r}}t.create=e})(Au||(Au={}));var Eu;(function(t){function e(n,r){return{triggerKind:n,selectedCompletionInfo:r}}t.create=e})(Eu||(Eu={}));var $u;(function(t){function e(n){const r=n;return p.objectLiteral(r)&&ta.is(r.uri)&&p.string(r.name)}t.is=e})($u||($u={}));var Su;(function(t){function e(s,a,o,l){return new eE(s,a,o,l)}t.create=e;function n(s){let a=s;return!!(p.defined(a)&&p.string(a.uri)&&(p.undefined(a.languageId)||p.string(a.languageId))&&p.uinteger(a.lineCount)&&p.func(a.getText)&&p.func(a.positionAt)&&p.func(a.offsetAt))}t.is=n;function r(s,a){let o=s.getText(),l=i(a,(c,f)=>{let d=c.range.start.line-f.range.start.line;return d===0?c.range.start.character-f.range.start.character:d}),u=o.length;for(let c=l.length-1;c>=0;c--){let f=l[c],d=s.offsetAt(f.range.start),h=s.offsetAt(f.range.end);if(h<=u)o=o.substring(0,d)+f.newText+o.substring(h,o.length);else throw new Error("Overlapping edit");u=d}return o}t.applyEdits=r;function i(s,a){if(s.length<=1)return s;const o=s.length/2|0,l=s.slice(0,o),u=s.slice(o);i(l,a),i(u,a);let c=0,f=0,d=0;for(;c0&&e.push(n.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return D.create(0,e);for(;re?i=a:r=a+1}let s=r-1;return D.create(s,e-n[s])}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1"u"}t.undefined=r;function i(h){return h===!0||h===!1}t.boolean=i;function s(h){return e.call(h)==="[object String]"}t.string=s;function a(h){return e.call(h)==="[object Number]"}t.number=a;function o(h,m,g){return e.call(h)==="[object Number]"&&m<=h&&h<=g}t.numberRange=o;function l(h){return e.call(h)==="[object Number]"&&-2147483648<=h&&h<=2147483647}t.integer=l;function u(h){return e.call(h)==="[object Number]"&&0<=h&&h<=2147483647}t.uinteger=u;function c(h){return e.call(h)==="[object Function]"}t.func=c;function f(h){return h!==null&&typeof h=="object"}t.objectLiteral=f;function d(h,m){return Array.isArray(h)&&h.every(m)}t.typedArray=d})(p||(p={}));class tE{constructor(){this.nodeStack=[]}get current(){var e;return(e=this.nodeStack[this.nodeStack.length-1])!==null&&e!==void 0?e:this.rootNode}buildRootNode(e){return this.rootNode=new Df(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const n=new io;return n.grammarSource=e,n.root=this.rootNode,this.current.content.push(n),this.nodeStack.push(n),n}buildLeafNode(e,n){const r=new pa(e.startOffset,e.image.length,Ds(e),e.tokenType,!n);return r.grammarSource=n,r.root=this.rootNode,this.current.content.push(r),r}removeNode(e){const n=e.container;if(n){const r=n.content.indexOf(e);r>=0&&n.content.splice(r,1)}}addHiddenNodes(e){const n=[];for(const s of e){const a=new pa(s.startOffset,s.image.length,Ds(s),s.tokenType,!0);a.root=this.rootNode,n.push(a)}let r=this.current,i=!1;if(r.content.length>0){r.content.push(...n);return}for(;r.container;){const s=r.container.content.indexOf(r);if(s>0){r.container.content.splice(s,0,...n),i=!0;break}r=r.container}i||this.rootNode.content.unshift(...n)}construct(e){const n=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=n;const r=this.nodeStack.pop();r?.content.length===0&&this.removeNode(r)}}class Mf{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,n;const r=typeof((e=this._astNode)===null||e===void 0?void 0:e.$type)=="string"?this._astNode:(n=this.container)===null||n===void 0?void 0:n.astNode;if(!r)throw new Error("This node has no associated AST element");return r}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}}class pa extends Mf{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,n,r,i,s=!1){super(),this._hidden=s,this._offset=e,this._tokenType=i,this._length=n,this._range=r}}class io extends Mf{constructor(){super(...arguments),this.content=new so(this)}get children(){return this.content}get offset(){var e,n;return(n=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&n!==void 0?n:0}get length(){return this.end-this.offset}get end(){var e,n;return(n=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&n!==void 0?n:0}get range(){const e=this.firstNonHiddenNode,n=this.lastNonHiddenNode;if(e&&n){if(this._rangeCache===void 0){const{range:r}=e,{range:i}=n;this._rangeCache={start:r.start,end:i.end.line=0;e--){const n=this.content[e];if(!n.hidden)return n}return this.content[this.content.length-1]}}class so extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,so.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,n,...r){return this.addParents(r),super.splice(e,n,...r)}addParents(e){for(const n of e)n.container=this.parent}}class Df extends io{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const ma=Symbol("Datatype");function Rs(t){return t.$type===ma}const xu="​",Ff=t=>t.endsWith(xu)?t:t+xu;class Gf{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;const n=this.lexer.definition,r=e.LanguageMetaData.mode==="production";this.wrapper=new aE(n,Object.assign(Object.assign({},e.parser.ParserConfig),{skipValidations:r,errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,n){this.wrapper.wrapOr(e,n)}optional(e,n){this.wrapper.wrapOption(e,n)}many(e,n){this.wrapper.wrapMany(e,n)}atLeastOne(e,n){this.wrapper.wrapAtLeastOne(e,n)}getRule(e){return this.allRules.get(e)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}}class nE extends Gf{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new tE,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,n){const r=this.computeRuleType(e),i=this.wrapper.DEFINE_RULE(Ff(e.name),this.startImplementation(r,n).bind(this));return this.allRules.set(e.name,i),e.entry&&(this.mainRule=i),i}computeRuleType(e){if(!e.fragment){if(hc(e))return ma;{const n=ka(e);return n??e.name}}}parse(e,n={}){this.nodeBuilder.buildRootNode(e);const r=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=r.tokens;const i=n.rule?this.allRules.get(n.rule):this.mainRule;if(!i)throw new Error(n.rule?`No rule found with name '${n.rule}'`:"No main rule available.");const s=i.call(this.wrapper,{});return this.nodeBuilder.addHiddenNodes(r.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:s,lexerErrors:r.errors,lexerReport:r.report,parserErrors:this.wrapper.errors}}startImplementation(e,n){return r=>{const i=!this.isRecording()&&e!==void 0;if(i){const a={$type:e};this.stack.push(a),e===ma&&(a.value="")}let s;try{s=n(r)}catch{s=void 0}return s===void 0&&i&&(s=this.construct()),s}}extractHiddenTokens(e){const n=this.lexerResult.hidden;if(!n.length)return[];const r=e.startOffset;for(let i=0;ir)return n.splice(0,i);return n.splice(0,n.length)}consume(e,n,r){const i=this.wrapper.wrapConsume(e,n);if(!this.isRecording()&&this.isValidToken(i)){const s=this.extractHiddenTokens(i);this.nodeBuilder.addHiddenNodes(s);const a=this.nodeBuilder.buildLeafNode(i,r),{assignment:o,isCrossRef:l}=this.getAssignment(r),u=this.current;if(o){const c=Lt(r)?i.image:this.converter.convert(i.image,a);this.assign(o.operator,o.feature,c,a,l)}else if(Rs(u)){let c=i.image;Lt(r)||(c=this.converter.convert(c,a).toString()),u.value+=c}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,n,r,i,s){let a;!this.isRecording()&&!r&&(a=this.nodeBuilder.buildCompositeNode(i));const o=this.wrapper.wrapSubrule(e,n,s);!this.isRecording()&&a&&a.length>0&&this.performSubruleAssignment(o,i,a)}performSubruleAssignment(e,n,r){const{assignment:i,isCrossRef:s}=this.getAssignment(n);if(i)this.assign(i.operator,i.feature,e,r,s);else if(!i){const a=this.current;if(Rs(a))a.value+=e.toString();else if(typeof e=="object"&&e){const l=this.assignWithoutOverride(e,a);this.stack.pop(),this.stack.push(l)}}}action(e,n){if(!this.isRecording()){let r=this.current;if(n.feature&&n.operator){r=this.construct(),this.nodeBuilder.removeNode(r.$cstNode),this.nodeBuilder.buildCompositeNode(n).content.push(r.$cstNode);const s={$type:e};this.stack.push(s),this.assign(n.operator,n.feature,r,r.$cstNode,!1)}else r.$type=e}}construct(){if(this.isRecording())return;const e=this.current;return ih(e),this.nodeBuilder.construct(e),this.stack.pop(),Rs(e)?this.converter.convert(e.value,e.$cstNode):(sh(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){const n=Ni(e,Ot);this.assignmentMap.set(e,{assignment:n,isCrossRef:n?Ea(n.terminal):!1})}return this.assignmentMap.get(e)}assign(e,n,r,i,s){const a=this.current;let o;switch(s&&typeof r=="string"?o=this.linker.buildReference(a,n,i,r):o=r,e){case"=":{a[n]=o;break}case"?=":{a[n]=!0;break}case"+=":Array.isArray(a[n])||(a[n]=[]),a[n].push(o)}}assignWithoutOverride(e,n){for(const[i,s]of Object.entries(n)){const a=e[i];a===void 0?e[i]=s:Array.isArray(a)&&Array.isArray(s)&&(s.push(...a),e[i]=s)}const r=e.$cstNode;return r&&(r.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}}class rE{buildMismatchTokenMessage(e){return Xt.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Xt.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Xt.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Xt.buildEarlyExitMessage(e)}}class Uf extends rE{buildMismatchTokenMessage({expected:e,actual:n}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${n.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}}class iE extends Gf{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();const n=this.lexer.tokenize(e,{mode:"partial"});return this.tokens=n.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,n){const r=this.wrapper.DEFINE_RULE(Ff(e.name),this.startImplementation(n).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return n=>{const r=this.keepStackSize();try{e(n)}finally{this.resetStackSize(r)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){const e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,n,r){this.wrapper.wrapConsume(e,n),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(e,n,r,i,s){this.before(i),this.wrapper.wrapSubrule(e,n,s),this.after(i)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){const n=this.elementStack.lastIndexOf(e);n>=0&&this.elementStack.splice(n)}}get currIdx(){return this.wrapper.currIdx}}const sE={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new Uf};class aE extends hA{constructor(e,n){const r=n&&"maxLookahead"in n;super(e,Object.assign(Object.assign(Object.assign({},sE),{lookaheadStrategy:r?new Za({maxLookahead:n.maxLookahead}):new LA({logging:n.skipValidations?()=>{}:void 0})}),n))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,n){return this.RULE(e,n)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,n){return this.consume(e,n)}wrapSubrule(e,n,r){return this.subrule(e,n,{ARGS:[r]})}wrapOr(e,n){this.or(e,n)}wrapOption(e,n){this.option(e,n)}wrapMany(e,n){this.many(e,n)}wrapAtLeastOne(e,n){this.atLeastOne(e,n)}}function Bf(t,e,n){return oE({parser:e,tokens:n,ruleNames:new Map},t),e}function oE(t,e){const n=lc(e,!1),r=re(e.rules).filter(Ne).filter(i=>n.has(i));for(const i of r){const s=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});t.parser.rule(i,Ft(s,i.definition))}}function Ft(t,e,n=!1){let r;if(Lt(e))r=pE(t,e);else if(_i(e))r=lE(t,e);else if(Ot(e))r=Ft(t,e.terminal);else if(Ea(e))r=jf(t,e);else if(Pt(e))r=uE(t,e);else if(nc(e))r=fE(t,e);else if(rc(e))r=dE(t,e);else if($a(e))r=hE(t,e);else if(Xd(e)){const i=t.consume++;r=()=>t.parser.consume(i,yt,e)}else throw new Zu(e.$cstNode,`Unexpected element type: ${e.$type}`);return Kf(t,n?void 0:xi(e),r,e.cardinality)}function lE(t,e){const n=Ia(e);return()=>t.parser.action(n,e)}function uE(t,e){const n=e.rule.ref;if(Ne(n)){const r=t.subrule++,i=n.fragment,s=e.arguments.length>0?cE(n,e.arguments):()=>({});return a=>t.parser.subrule(r,Hf(t,n),i,e,s(a))}else if(Ut(n)){const r=t.consume++,i=ga(t,n.name);return()=>t.parser.consume(r,i,e)}else if(n)lr();else throw new Zu(e.$cstNode,`Undefined rule: ${e.rule.$refText}`)}function cE(t,e){const n=e.map(r=>it(r.value));return r=>{const i={};for(let s=0;se(r)||n(r)}else if(Kd(t)){const e=it(t.left),n=it(t.right);return r=>e(r)&&n(r)}else if(Vd(t)){const e=it(t.value);return n=>!e(n)}else if(Wd(t)){const e=t.parameter.ref.name;return n=>n!==void 0&&n[e]===!0}else if(jd(t)){const e=!!t.true;return()=>e}lr()}function fE(t,e){if(e.elements.length===1)return Ft(t,e.elements[0]);{const n=[];for(const i of e.elements){const s={ALT:Ft(t,i,!0)},a=xi(i);a&&(s.GATE=it(a)),n.push(s)}const r=t.or++;return i=>t.parser.alternatives(r,n.map(s=>{const a={ALT:()=>s.ALT(i)},o=s.GATE;return o&&(a.GATE=()=>o(i)),a}))}}function dE(t,e){if(e.elements.length===1)return Ft(t,e.elements[0]);const n=[];for(const o of e.elements){const l={ALT:Ft(t,o,!0)},u=xi(o);u&&(l.GATE=it(u)),n.push(l)}const r=t.or++,i=(o,l)=>{const u=l.getRuleStack().join("-");return`uGroup_${o}_${u}`},s=o=>t.parser.alternatives(r,n.map((l,u)=>{const c={ALT:()=>!0},f=t.parser;c.ALT=()=>{if(l.ALT(o),!f.isRecording()){const h=i(r,f);f.unorderedGroups.get(h)||f.unorderedGroups.set(h,[]);const m=f.unorderedGroups.get(h);typeof m?.[u]>"u"&&(m[u]=!0)}};const d=l.GATE;return d?c.GATE=()=>d(o):c.GATE=()=>{const h=f.unorderedGroups.get(i(r,f));return!h?.[u]},c})),a=Kf(t,xi(e),s,"*");return o=>{a(o),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(r,t.parser))}}function hE(t,e){const n=e.elements.map(r=>Ft(t,r));return r=>n.forEach(i=>i(r))}function xi(t){if($a(t))return t.guardCondition}function jf(t,e,n=e.terminal){if(n)if(Pt(n)&&Ne(n.rule.ref)){const r=n.rule.ref,i=t.subrule++;return s=>t.parser.subrule(i,Hf(t,r),!1,e,s)}else if(Pt(n)&&Ut(n.rule.ref)){const r=t.consume++,i=ga(t,n.rule.ref.name);return()=>t.parser.consume(r,i,e)}else if(Lt(n)){const r=t.consume++,i=ga(t,n.value);return()=>t.parser.consume(r,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);const r=fc(e.type.ref),i=r?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+Ia(e.type.ref));return jf(t,e,i)}}function pE(t,e){const n=t.consume++,r=t.tokens[e.value];if(!r)throw new Error("Could not find token for keyword: "+e.value);return()=>t.parser.consume(n,r,e)}function Kf(t,e,n,r){const i=e&&it(e);if(!r)if(i){const s=t.or++;return a=>t.parser.alternatives(s,[{ALT:()=>n(a),GATE:()=>i(a)},{ALT:Rl(),GATE:()=>!i(a)}])}else return n;if(r==="*"){const s=t.many++;return a=>t.parser.many(s,{DEF:()=>n(a),GATE:i?()=>i(a):void 0})}else if(r==="+"){const s=t.many++;if(i){const a=t.or++;return o=>t.parser.alternatives(a,[{ALT:()=>t.parser.atLeastOne(s,{DEF:()=>n(o)}),GATE:()=>i(o)},{ALT:Rl(),GATE:()=>!i(o)}])}else return a=>t.parser.atLeastOne(s,{DEF:()=>n(a)})}else if(r==="?"){const s=t.optional++;return a=>t.parser.optional(s,{DEF:()=>n(a),GATE:i?()=>i(a):void 0})}else lr()}function Hf(t,e){const n=mE(t,e),r=t.parser.getRule(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function mE(t,e){if(Ne(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let n=e,r=n.$container,i=e.$type;for(;!Ne(r);)($a(r)||nc(r)||rc(r))&&(i=r.elements.indexOf(n).toString()+":"+i),n=r,r=r.$container;return i=r.name+":"+i,t.ruleNames.set(e,i),i}}function ga(t,e){const n=t.tokens[e];if(!n)throw new Error(`Token "${e}" not found."`);return n}function gE(t){const e=t.Grammar,n=t.parser.Lexer,r=new iE(t);return Bf(e,r,n.definition),r.finalize(),r}function yE(t){const e=TE(t);return e.finalize(),e}function TE(t){const e=t.Grammar,n=t.parser.Lexer,r=new nE(t);return Bf(e,r,n.definition)}class Vf{constructor(){this.diagnostics=[]}buildTokens(e,n){const r=re(lc(e,!1)),i=this.buildTerminalTokens(r),s=this.buildKeywordTokens(r,i,n);return i.forEach(a=>{const o=a.PATTERN;typeof o=="object"&&o&&"test"in o&&Gs(o)?s.unshift(a):s.push(a)}),s}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){const e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(Ut).filter(n=>!n.fragment).map(n=>this.buildTerminalToken(n)).toArray()}buildTerminalToken(e){const n=Ca(e),r=this.requiresCustomPattern(n)?this.regexPatternFunction(n):n,i={name:e.name,PATTERN:r};return typeof r=="function"&&(i.LINE_BREAKS=!0),e.hidden&&(i.GROUP=Gs(n)?he.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")||e.flags.includes("s")?!0:!!(e.source.includes("?<=")||e.source.includes("?(n.lastIndex=i,n.exec(r))}buildKeywordTokens(e,n,r){return e.filter(Ne).flatMap(i=>ur(i).filter(Lt)).distinct(i=>i.value).toArray().sort((i,s)=>s.value.length-i.value.length).map(i=>this.buildKeywordToken(i,n,!!r?.caseInsensitive))}buildKeywordToken(e,n,r){const i=this.buildKeywordPattern(e,r),s={name:e.value,PATTERN:i,LONGER_ALT:this.findLongerAlt(e,n)};return typeof i=="function"&&(s.LINE_BREAKS=!0),s}buildKeywordPattern(e,n){return n?new RegExp(ph(e.value)):e.value}findLongerAlt(e,n){return n.reduce((r,i)=>{const s=i?.PATTERN;return s?.source&&mh("^"+s.source+"$",e.value)&&r.push(i),r},[])}}class Wf{convert(e,n){let r=n.grammarSource;if(Ea(r)&&(r=vh(r)),Pt(r)){const i=r.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,n)}return e}runConverter(e,n,r){var i;switch(e.name.toUpperCase()){case"INT":return tt.convertInt(n);case"STRING":return tt.convertString(n);case"ID":return tt.convertID(n)}switch((i=kh(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return tt.convertNumber(n);case"boolean":return tt.convertBoolean(n);case"bigint":return tt.convertBigint(n);case"date":return tt.convertDate(n);default:return n}}}var tt;(function(t){function e(u){let c="";for(let f=1;fe(l))}return ee.stringArray=a,ee}var Nt={},Cu;function qf(){if(Cu)return Nt;Cu=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.Emitter=Nt.Event=void 0;const t=zf();var e;(function(i){const s={dispose(){}};i.None=function(){return s}})(e||(Nt.Event=e={}));class n{add(s,a=null,o){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(s),this._contexts.push(a),Array.isArray(o)&&o.push({dispose:()=>this.remove(s,a)})}remove(s,a=null){if(!this._callbacks)return;let o=!1;for(let l=0,u=this._callbacks.length;l{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(s,a);const l={dispose:()=>{this._callbacks&&(this._callbacks.remove(s,a),l.dispose=r._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(o)&&o.push(l),l}),this._event}fire(s){this._callbacks&&this._callbacks.invoke.call(this._callbacks,s)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return Nt.Emitter=r,r._noop=function(){},Nt}var wu;function RE(){if(wu)return _t;wu=1,Object.defineProperty(_t,"__esModule",{value:!0}),_t.CancellationTokenSource=_t.CancellationToken=void 0;const t=zf(),e=vE(),n=qf();var r;(function(o){o.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:n.Event.None}),o.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:n.Event.None});function l(u){const c=u;return c&&(c===o.None||c===o.Cancelled||e.boolean(c.isCancellationRequested)&&!!c.onCancellationRequested)}o.is=l})(r||(_t.CancellationToken=r={}));const i=Object.freeze(function(o,l){const u=(0,t.default)().timer.setTimeout(o.bind(l),0);return{dispose(){u.dispose()}}});class s{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?i:(this._emitter||(this._emitter=new n.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class a{get token(){return this._token||(this._token=new s),this._token}cancel(){this._token?this._token.cancel():this._token=r.Cancelled}dispose(){this._token?this._token instanceof s&&this._token.dispose():this._token=r.None}}return _t.CancellationTokenSource=a,_t}var V=RE();function AE(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}let Jr=0,EE=10;function $E(){return Jr=performance.now(),new V.CancellationTokenSource}const ki=Symbol("OperationCancelled");function Qi(t){return t===ki}async function Ee(t){if(t===V.CancellationToken.None)return;const e=performance.now();if(e-Jr>=EE&&(Jr=e,await AE(),Jr=performance.now()),t.isCancellationRequested)throw ki}class ao{constructor(){this.promise=new Promise((e,n)=>{this.resolve=r=>(e(r),this),this.reject=r=>(n(r),this)})}}class or{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){const n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){for(const r of e)if(or.isIncremental(r)){const i=Xf(r.range),s=this.offsetAt(i.start),a=this.offsetAt(i.end);this._content=this._content.substring(0,s)+r.text+this._content.substring(a,this._content.length);const o=Math.max(i.start.line,0),l=Math.max(i.end.line,0);let u=this._lineOffsets;const c=_u(r.text,!1,s);if(l-o===c.length)for(let d=0,h=c.length;de?i=a:r=a+1}const s=r-1;return e=this.ensureBeforeEOL(e,n[s]),{line:s,character:e-n[s]}}offsetAt(e){const n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;const r=n[e.line];if(e.character<=0)return r;const i=e.line+1n&&Yf(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){const n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(e){const n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}}var ya;(function(t){function e(i,s,a,o){return new or(i,s,a,o)}t.create=e;function n(i,s,a){if(i instanceof or)return i.update(s,a),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,s){const a=i.getText(),o=Ta(s.map(SE),(c,f)=>{const d=c.range.start.line-f.range.start.line;return d===0?c.range.start.character-f.range.start.character:d});let l=0;const u=[];for(const c of o){const f=i.offsetAt(c.range.start);if(fl&&u.push(a.substring(l,f)),c.newText.length&&u.push(c.newText),l=i.offsetAt(c.range.end)}return u.push(a.substr(l)),u.join("")}t.applyEdits=r})(ya||(ya={}));function Ta(t,e){if(t.length<=1)return t;const n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);Ta(r,e),Ta(i,e);let s=0,a=0,o=0;for(;sn.line||e.line===n.line&&e.character>n.character?{start:n,end:e}:t}function SE(t){const e=Xf(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var Jf;(()=>{var t={470:i=>{function s(l){if(typeof l!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(l))}function a(l,u){for(var c,f="",d=0,h=-1,m=0,g=0;g<=l.length;++g){if(g2){var R=f.lastIndexOf("/");if(R!==f.length-1){R===-1?(f="",d=0):d=(f=f.slice(0,R)).length-1-f.lastIndexOf("/"),h=g,m=0;continue}}else if(f.length===2||f.length===1){f="",d=0,h=g,m=0;continue}}u&&(f.length>0?f+="/..":f="..",d=2)}else f.length>0?f+="/"+l.slice(h+1,g):f=l.slice(h+1,g),d=g-h-1;h=g,m=0}else c===46&&m!==-1?++m:m=-1}return f}var o={resolve:function(){for(var l,u="",c=!1,f=arguments.length-1;f>=-1&&!c;f--){var d;f>=0?d=arguments[f]:(l===void 0&&(l=process.cwd()),d=l),s(d),d.length!==0&&(u=d+"/"+u,c=d.charCodeAt(0)===47)}return u=a(u,!c),c?u.length>0?"/"+u:"/":u.length>0?u:"."},normalize:function(l){if(s(l),l.length===0)return".";var u=l.charCodeAt(0)===47,c=l.charCodeAt(l.length-1)===47;return(l=a(l,!u)).length!==0||u||(l="."),l.length>0&&c&&(l+="/"),u?"/"+l:l},isAbsolute:function(l){return s(l),l.length>0&&l.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var l,u=0;u0&&(l===void 0?l=c:l+="/"+c)}return l===void 0?".":o.normalize(l)},relative:function(l,u){if(s(l),s(u),l===u||(l=o.resolve(l))===(u=o.resolve(u)))return"";for(var c=1;cg){if(u.charCodeAt(h+y)===47)return u.slice(h+y+1);if(y===0)return u.slice(h+y)}else d>g&&(l.charCodeAt(c+y)===47?R=y:y===0&&(R=0));break}var E=l.charCodeAt(c+y);if(E!==u.charCodeAt(h+y))break;E===47&&(R=y)}var v="";for(y=c+R+1;y<=f;++y)y!==f&&l.charCodeAt(y)!==47||(v.length===0?v+="..":v+="/..");return v.length>0?v+u.slice(h+R):(h+=R,u.charCodeAt(h)===47&&++h,u.slice(h))},_makeLong:function(l){return l},dirname:function(l){if(s(l),l.length===0)return".";for(var u=l.charCodeAt(0),c=u===47,f=-1,d=!0,h=l.length-1;h>=1;--h)if((u=l.charCodeAt(h))===47){if(!d){f=h;break}}else d=!1;return f===-1?c?"/":".":c&&f===1?"//":l.slice(0,f)},basename:function(l,u){if(u!==void 0&&typeof u!="string")throw new TypeError('"ext" argument must be a string');s(l);var c,f=0,d=-1,h=!0;if(u!==void 0&&u.length>0&&u.length<=l.length){if(u.length===l.length&&u===l)return"";var m=u.length-1,g=-1;for(c=l.length-1;c>=0;--c){var R=l.charCodeAt(c);if(R===47){if(!h){f=c+1;break}}else g===-1&&(h=!1,g=c+1),m>=0&&(R===u.charCodeAt(m)?--m==-1&&(d=c):(m=-1,d=g))}return f===d?d=g:d===-1&&(d=l.length),l.slice(f,d)}for(c=l.length-1;c>=0;--c)if(l.charCodeAt(c)===47){if(!h){f=c+1;break}}else d===-1&&(h=!1,d=c+1);return d===-1?"":l.slice(f,d)},extname:function(l){s(l);for(var u=-1,c=0,f=-1,d=!0,h=0,m=l.length-1;m>=0;--m){var g=l.charCodeAt(m);if(g!==47)f===-1&&(d=!1,f=m+1),g===46?u===-1?u=m:h!==1&&(h=1):u!==-1&&(h=-1);else if(!d){c=m+1;break}}return u===-1||f===-1||h===0||h===1&&u===f-1&&u===c+1?"":l.slice(u,f)},format:function(l){if(l===null||typeof l!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof l);return(function(u,c){var f=c.dir||c.root,d=c.base||(c.name||"")+(c.ext||"");return f?f===c.root?f+d:f+"/"+d:d})(0,l)},parse:function(l){s(l);var u={root:"",dir:"",base:"",ext:"",name:""};if(l.length===0)return u;var c,f=l.charCodeAt(0),d=f===47;d?(u.root="/",c=1):c=0;for(var h=-1,m=0,g=-1,R=!0,y=l.length-1,E=0;y>=c;--y)if((f=l.charCodeAt(y))!==47)g===-1&&(R=!1,g=y+1),f===46?h===-1?h=y:E!==1&&(E=1):h!==-1&&(E=-1);else if(!R){m=y+1;break}return h===-1||g===-1||E===0||E===1&&h===g-1&&h===m+1?g!==-1&&(u.base=u.name=m===0&&d?l.slice(1,g):l.slice(m,g)):(m===0&&d?(u.name=l.slice(1,h),u.base=l.slice(1,g)):(u.name=l.slice(m,h),u.base=l.slice(m,g)),u.ext=l.slice(h,g)),m>0?u.dir=l.slice(0,m-1):d&&(u.dir="/"),u},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,i.exports=o}},e={};function n(i){var s=e[i];if(s!==void 0)return s.exports;var a=e[i]={exports:{}};return t[i](a,a.exports,n),a.exports}n.d=(i,s)=>{for(var a in s)n.o(s,a)&&!n.o(i,a)&&Object.defineProperty(i,a,{enumerable:!0,get:s[a]})},n.o=(i,s)=>Object.prototype.hasOwnProperty.call(i,s),n.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var r={};(()=>{let i;n.r(r),n.d(r,{URI:()=>d,Utils:()=>Ie}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);const s=/^\w[\w\d+.-]*$/,a=/^\//,o=/^\/\//;function l($,T){if(!$.scheme&&T)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${$.authority}", path: "${$.path}", query: "${$.query}", fragment: "${$.fragment}"}`);if($.scheme&&!s.test($.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if($.path){if($.authority){if(!a.test($.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(o.test($.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}const u="",c="/",f=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class d{static isUri(T){return T instanceof d||!!T&&typeof T.authority=="string"&&typeof T.fragment=="string"&&typeof T.path=="string"&&typeof T.query=="string"&&typeof T.scheme=="string"&&typeof T.fsPath=="string"&&typeof T.with=="function"&&typeof T.toString=="function"}scheme;authority;path;query;fragment;constructor(T,k,S,O,b,N=!1){typeof T=="object"?(this.scheme=T.scheme||u,this.authority=T.authority||u,this.path=T.path||u,this.query=T.query||u,this.fragment=T.fragment||u):(this.scheme=(function(ve,Z){return ve||Z?ve:"file"})(T,N),this.authority=k||u,this.path=(function(ve,Z){switch(ve){case"https":case"http":case"file":Z?Z[0]!==c&&(Z=c+Z):Z=c}return Z})(this.scheme,S||u),this.query=O||u,this.fragment=b||u,l(this,N))}get fsPath(){return E(this)}with(T){if(!T)return this;let{scheme:k,authority:S,path:O,query:b,fragment:N}=T;return k===void 0?k=this.scheme:k===null&&(k=u),S===void 0?S=this.authority:S===null&&(S=u),O===void 0?O=this.path:O===null&&(O=u),b===void 0?b=this.query:b===null&&(b=u),N===void 0?N=this.fragment:N===null&&(N=u),k===this.scheme&&S===this.authority&&O===this.path&&b===this.query&&N===this.fragment?this:new m(k,S,O,b,N)}static parse(T,k=!1){const S=f.exec(T);return S?new m(S[2]||u,ae(S[4]||u),ae(S[5]||u),ae(S[7]||u),ae(S[9]||u),k):new m(u,u,u,u,u)}static file(T){let k=u;if(i&&(T=T.replace(/\\/g,c)),T[0]===c&&T[1]===c){const S=T.indexOf(c,2);S===-1?(k=T.substring(2),T=c):(k=T.substring(2,S),T=T.substring(S)||c)}return new m("file",k,T,u,u)}static from(T){const k=new m(T.scheme,T.authority,T.path,T.query,T.fragment);return l(k,!0),k}toString(T=!1){return v(this,T)}toJSON(){return this}static revive(T){if(T){if(T instanceof d)return T;{const k=new m(T);return k._formatted=T.external,k._fsPath=T._sep===h?T.fsPath:null,k}}return T}}const h=i?1:void 0;class m extends d{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=E(this)),this._fsPath}toString(T=!1){return T?v(this,!0):(this._formatted||(this._formatted=v(this,!1)),this._formatted)}toJSON(){const T={$mid:1};return this._fsPath&&(T.fsPath=this._fsPath,T._sep=h),this._formatted&&(T.external=this._formatted),this.path&&(T.path=this.path),this.scheme&&(T.scheme=this.scheme),this.authority&&(T.authority=this.authority),this.query&&(T.query=this.query),this.fragment&&(T.fragment=this.fragment),T}}const g={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function R($,T,k){let S,O=-1;for(let b=0;b<$.length;b++){const N=$.charCodeAt(b);if(N>=97&&N<=122||N>=65&&N<=90||N>=48&&N<=57||N===45||N===46||N===95||N===126||T&&N===47||k&&N===91||k&&N===93||k&&N===58)O!==-1&&(S+=encodeURIComponent($.substring(O,b)),O=-1),S!==void 0&&(S+=$.charAt(b));else{S===void 0&&(S=$.substr(0,b));const ve=g[N];ve!==void 0?(O!==-1&&(S+=encodeURIComponent($.substring(O,b)),O=-1),S+=ve):O===-1&&(O=b)}}return O!==-1&&(S+=encodeURIComponent($.substring(O))),S!==void 0?S:$}function y($){let T;for(let k=0;k<$.length;k++){const S=$.charCodeAt(k);S===35||S===63?(T===void 0&&(T=$.substr(0,k)),T+=g[S]):T!==void 0&&(T+=$[k])}return T!==void 0?T:$}function E($,T){let k;return k=$.authority&&$.path.length>1&&$.scheme==="file"?`//${$.authority}${$.path}`:$.path.charCodeAt(0)===47&&($.path.charCodeAt(1)>=65&&$.path.charCodeAt(1)<=90||$.path.charCodeAt(1)>=97&&$.path.charCodeAt(1)<=122)&&$.path.charCodeAt(2)===58?$.path[1].toLowerCase()+$.path.substr(2):$.path,i&&(k=k.replace(/\//g,"\\")),k}function v($,T){const k=T?y:R;let S="",{scheme:O,authority:b,path:N,query:ve,fragment:Z}=$;if(O&&(S+=O,S+=":"),(b||O==="file")&&(S+=c,S+=c),b){let W=b.indexOf("@");if(W!==-1){const It=b.substr(0,W);b=b.substr(W+1),W=It.lastIndexOf(":"),W===-1?S+=k(It,!1,!1):(S+=k(It.substr(0,W),!1,!1),S+=":",S+=k(It.substr(W+1),!1,!0)),S+="@"}b=b.toLowerCase(),W=b.lastIndexOf(":"),W===-1?S+=k(b,!1,!0):(S+=k(b.substr(0,W),!1,!0),S+=b.substr(W))}if(N){if(N.length>=3&&N.charCodeAt(0)===47&&N.charCodeAt(2)===58){const W=N.charCodeAt(1);W>=65&&W<=90&&(N=`/${String.fromCharCode(W+32)}:${N.substr(3)}`)}else if(N.length>=2&&N.charCodeAt(1)===58){const W=N.charCodeAt(0);W>=65&&W<=90&&(N=`${String.fromCharCode(W+32)}:${N.substr(2)}`)}S+=k(N,!0,!1)}return ve&&(S+="?",S+=k(ve,!1,!1)),Z&&(S+="#",S+=T?Z:R(Z,!1,!1)),S}function x($){try{return decodeURIComponent($)}catch{return $.length>3?$.substr(0,3)+x($.substr(3)):$}}const M=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function ae($){return $.match(M)?$.replace(M,(T=>x(T))):$}var Me=n(470);const Te=Me.posix||Me,Ve="/";var Ie;(function($){$.joinPath=function(T,...k){return T.with({path:Te.join(T.path,...k)})},$.resolvePath=function(T,...k){let S=T.path,O=!1;S[0]!==Ve&&(S=Ve+S,O=!0);let b=Te.resolve(S,...k);return O&&b[0]===Ve&&!T.authority&&(b=b.substring(1)),T.with({path:b})},$.dirname=function(T){if(T.path.length===0||T.path===Ve)return T;let k=Te.dirname(T.path);return k.length===1&&k.charCodeAt(0)===46&&(k=""),T.with({path:k})},$.basename=function(T){return Te.basename(T.path)},$.extname=function(T){return Te.extname(T.path)}})(Ie||(Ie={}))})(),Jf=r})();const{URI:Gt,Utils:gn}=Jf;var vt;(function(t){t.basename=gn.basename,t.dirname=gn.dirname,t.extname=gn.extname,t.joinPath=gn.joinPath,t.resolvePath=gn.resolvePath;function e(i,s){return i?.toString()===s?.toString()}t.equals=e;function n(i,s){const a=typeof i=="string"?i:i.path,o=typeof s=="string"?s:s.path,l=a.split("/").filter(h=>h.length>0),u=o.split("/").filter(h=>h.length>0);let c=0;for(;ci??(i=ya.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,n??""))}}class kE{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return re(this.documentMap.values())}addDocument(e){const n=e.uri.toString();if(this.documentMap.has(n))throw new Error(`A document with the URI '${n}' is already present.`);this.documentMap.set(n,e)}getDocument(e){const n=e.toString();return this.documentMap.get(n)}async getOrCreateDocument(e,n){let r=this.getDocument(e);return r||(r=await this.langiumDocumentFactory.fromUri(e,n),this.addDocument(r),r)}createDocument(e,n,r){if(r)return this.langiumDocumentFactory.fromString(n,e,r).then(i=>(this.addDocument(i),i));{const i=this.langiumDocumentFactory.fromString(n,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(this.serviceRegistry.getServices(e).references.Linker.unlink(r),r.state=K.Changed,r.precomputedScopes=void 0,r.diagnostics=void 0),r}deleteDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(r.state=K.Changed,this.documentMap.delete(n)),r}}const As=Symbol("ref_resolving");class IE{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,n=V.CancellationToken.None){for(const r of Jt(e.parseResult.value))await Ee(n),sc(r).forEach(i=>this.doLink(i,e))}doLink(e,n){var r;const i=e.reference;if(i._ref===void 0){i._ref=As;try{const s=this.getCandidate(e);if(Kr(s))i._ref=s;else if(i._nodeDescription=s,this.langiumDocuments().hasDocument(s.documentUri)){const a=this.loadAstNode(s);i._ref=a??this.createLinkingError(e,s)}else i._ref=void 0}catch(s){console.error(`An error occurred while resolving reference to '${i.$refText}':`,s);const a=(r=s.message)!==null&&r!==void 0?r:String(s);i._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${i.$refText}': ${a}`})}n.references.push(i)}}unlink(e){for(const n of e.references)delete n._ref,delete n._nodeDescription;e.references=[]}getCandidate(e){const r=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return r??this.createLinkingError(e)}buildReference(e,n,r,i){const s=this,a={$refNode:r,$refText:i,get ref(){var o;if(le(this._ref))return this._ref;if(bd(this._nodeDescription)){const l=s.loadAstNode(this._nodeDescription);this._ref=l??s.createLinkingError({reference:a,container:e,property:n},this._nodeDescription)}else if(this._ref===void 0){this._ref=As;const l=Fs(e).$document,u=s.getLinkedNode({reference:a,container:e,property:n});if(u.error&&l&&l.state=e.end)return s.ref}}if(r){const i=this.nameProvider.getNameNode(r);if(i&&(i===e||Pd(e,i)))return r}}}findDeclarationNode(e){const n=this.findDeclaration(e);if(n?.$cstNode){const r=this.nameProvider.getNameNode(n);return r??n.$cstNode}}findReferences(e,n){const r=[];if(n.includeDeclaration){const s=this.getReferenceToSelf(e);s&&r.push(s)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return n.documentUri&&(i=i.filter(s=>vt.equals(s.sourceUri,n.documentUri))),r.push(...i),re(r)}getReferenceToSelf(e){const n=this.nameProvider.getNameNode(e);if(n){const r=pt(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:r.uri,sourcePath:i,targetUri:r.uri,targetPath:i,segment:ai(n),local:!0}}}}class Ii{constructor(e){if(this.map=new Map,e)for(const[n,r]of e)this.add(n,r)}get size(){return Ps.sum(re(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,n){if(n===void 0)return this.map.delete(e);{const r=this.map.get(e);if(r){const i=r.indexOf(n);if(i>=0)return r.length===1?this.map.delete(e):r.splice(i,1),!0}return!1}}get(e){var n;return(n=this.map.get(e))!==null&&n!==void 0?n:[]}has(e,n){if(n===void 0)return this.map.has(e);{const r=this.map.get(e);return r?r.indexOf(n)>=0:!1}}add(e,n){return this.map.has(e)?this.map.get(e).push(n):this.map.set(e,[n]),this}addAll(e,n){return this.map.has(e)?this.map.get(e).push(...n):this.map.set(e,Array.from(n)),this}forEach(e){this.map.forEach((n,r)=>n.forEach(i=>e(i,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return re(this.map.entries()).flatMap(([e,n])=>n.map(r=>[e,r]))}keys(){return re(this.map.keys())}values(){return re(this.map.values()).flat()}entriesGroupedByKey(){return re(this.map.entries())}}class Nu{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(const[n,r]of e)this.set(n,r)}clear(){this.map.clear(),this.inverse.clear()}set(e,n){return this.map.set(e,n),this.inverse.set(n,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){const n=this.map.get(e);return n!==void 0?(this.map.delete(e),this.inverse.delete(n),!0):!1}}class NE{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,n=V.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,n)}async computeExportsForNode(e,n,r=Sa,i=V.CancellationToken.None){const s=[];this.exportNode(e,s,n);for(const a of r(e))await Ee(i),this.exportNode(a,s,n);return s}exportNode(e,n,r){const i=this.nameProvider.getName(e);i&&n.push(this.descriptions.createDescription(e,i,r))}async computeLocalScopes(e,n=V.CancellationToken.None){const r=e.parseResult.value,i=new Ii;for(const s of ur(r))await Ee(n),this.processNode(s,e,i);return i}processNode(e,n,r){const i=e.$container;if(i){const s=this.nameProvider.getName(e);s&&r.add(i,this.descriptions.createDescription(e,s,n))}}}class bu{constructor(e,n,r){var i;this.elements=e,this.outerScope=n,this.caseInsensitive=(i=r?.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){const n=this.caseInsensitive?this.elements.find(r=>r.name.toLowerCase()===e.toLowerCase()):this.elements.find(r=>r.name===e);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}}class bE{constructor(e,n,r){var i;this.elements=new Map,this.caseInsensitive=(i=r?.caseInsensitive)!==null&&i!==void 0?i:!1;for(const s of e){const a=this.caseInsensitive?s.name.toLowerCase():s.name;this.elements.set(a,s)}this.outerScope=n}getElement(e){const n=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(n);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=re(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}class Zf{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}}class OE extends Zf{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,n){this.throwIfDisposed(),this.cache.set(e,n)}get(e,n){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(n){const r=n();return this.cache.set(e,r),r}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}}class LE extends Zf{constructor(e){super(),this.cache=new Map,this.converter=e??(n=>n)}has(e,n){return this.throwIfDisposed(),this.cacheForContext(e).has(n)}set(e,n,r){this.throwIfDisposed(),this.cacheForContext(e).set(n,r)}get(e,n,r){this.throwIfDisposed();const i=this.cacheForContext(e);if(i.has(n))return i.get(n);if(r){const s=r();return i.set(n,s),s}else return}delete(e,n){return this.throwIfDisposed(),this.cacheForContext(e).delete(n)}clear(e){if(this.throwIfDisposed(),e){const n=this.converter(e);this.cache.delete(n)}else this.cache.clear()}cacheForContext(e){const n=this.converter(e);let r=this.cache.get(n);return r||(r=new Map,this.cache.set(n,r)),r}}class PE extends OE{constructor(e,n){super(),n?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(n,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,i)=>{i.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}}class ME{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new PE(e.shared)}getScope(e){const n=[],r=this.reflection.getReferenceType(e),i=pt(e.container).precomputedScopes;if(i){let a=e.container;do{const o=i.get(a);o.length>0&&n.push(re(o).filter(l=>this.reflection.isSubtype(l.type,r))),a=a.$container}while(a)}let s=this.getGlobalScope(r,e);for(let a=n.length-1;a>=0;a--)s=this.createScope(n[a],s);return s}createScope(e,n,r){return new bu(re(e),n,r)}createScopeForNodes(e,n,r){const i=re(e).map(s=>{const a=this.nameProvider.getName(s);if(a)return this.descriptions.createDescription(s,a)}).nonNullable();return new bu(i,n,r)}getGlobalScope(e,n){return this.globalScopeCache.get(e,()=>new bE(this.indexManager.allElements(e)))}}function DE(t){return typeof t.$comment=="string"}function Ou(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}class FE{constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,n){const r=n??{},i=n?.replacer,s=(o,l)=>this.replacer(o,l,r),a=i?(o,l)=>i(o,l,s):s;try{return this.currentDocument=pt(e),JSON.stringify(e,a,n?.space)}finally{this.currentDocument=void 0}}deserialize(e,n){const r=n??{},i=JSON.parse(e);return this.linkNode(i,i,r),i}replacer(e,n,{refText:r,sourceText:i,textRegions:s,comments:a,uriConverter:o}){var l,u,c,f;if(!this.ignoreProperties.has(e))if(ze(n)){const d=n.ref,h=r?n.$refText:void 0;if(d){const m=pt(d);let g="";this.currentDocument&&this.currentDocument!==m&&(o?g=o(m.uri,n):g=m.uri.toString());const R=this.astNodeLocator.getAstNodePath(d);return{$ref:`${g}#${R}`,$refText:h}}else return{$error:(u=(l=n.error)===null||l===void 0?void 0:l.message)!==null&&u!==void 0?u:"Could not resolve reference",$refText:h}}else if(le(n)){let d;if(s&&(d=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},n)),(!e||n.$document)&&d?.$textRegion&&(d.$textRegion.documentURI=(c=this.currentDocument)===null||c===void 0?void 0:c.uri.toString())),i&&!e&&(d??(d=Object.assign({},n)),d.$sourceText=(f=n.$cstNode)===null||f===void 0?void 0:f.text),a){d??(d=Object.assign({},n));const h=this.commentProvider.getComment(n);h&&(d.$comment=h.replace(/\r/g,""))}return d??n}else return n}addAstNodeRegionWithAssignmentsTo(e){const n=r=>({offset:r.offset,end:r.end,length:r.length,range:r.range});if(e.$cstNode){const r=e.$textRegion=n(e.$cstNode),i=r.assignments={};return Object.keys(e).filter(s=>!s.startsWith("$")).forEach(s=>{const a=Ah(e.$cstNode,s).map(n);a.length!==0&&(i[s]=a)}),e}}linkNode(e,n,r,i,s,a){for(const[l,u]of Object.entries(e))if(Array.isArray(u))for(let c=0;c{await this.handleException(()=>e.call(n,r,i,s),"An error occurred during validation",i,r)}}async handleException(e,n,r,i){try{await e()}catch(s){if(Qi(s))throw s;console.error(`${n}:`,s),s instanceof Error&&s.stack&&console.error(s.stack);const a=s instanceof Error?s.message:String(s);r("error",`${n}: ${a}`,{node:i})}}addEntry(e,n){if(e==="AstNode"){this.entries.add("AstNode",n);return}for(const r of this.reflection.getAllSubTypes(e))this.entries.add(r,n)}getChecks(e,n){let r=re(this.entries.get(e)).concat(this.entries.get("AstNode"));return n&&(r=r.filter(i=>n.includes(i.category))),r.map(i=>i.check)}registerBeforeDocument(e,n=this){this.entriesBefore.push(this.wrapPreparationException(e,"An error occurred during set-up of the validation",n))}registerAfterDocument(e,n=this){this.entriesAfter.push(this.wrapPreparationException(e,"An error occurred during tear-down of the validation",n))}wrapPreparationException(e,n,r){return async(i,s,a,o)=>{await this.handleException(()=>e.call(r,i,s,a,o),n,s,i)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}}class BE{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,n={},r=V.CancellationToken.None){const i=e.parseResult,s=[];if(await Ee(r),(!n.categories||n.categories.includes("built-in"))&&(this.processLexingErrors(i,s,n),n.stopAfterLexingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===Fe.LexingError})||(this.processParsingErrors(i,s,n),n.stopAfterParsingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===Fe.ParsingError}))||(this.processLinkingErrors(e,s,n),n.stopAfterLinkingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===Fe.LinkingError}))))return s;try{s.push(...await this.validateAst(i.value,n,r))}catch(a){if(Qi(a))throw a;console.error("An error occurred during validation:",a)}return await Ee(r),s}processLexingErrors(e,n,r){var i,s,a;const o=[...e.lexerErrors,...(s=(i=e.lexerReport)===null||i===void 0?void 0:i.diagnostics)!==null&&s!==void 0?s:[]];for(const l of o){const u=(a=l.severity)!==null&&a!==void 0?a:"error",c={severity:Es(u),range:{start:{line:l.line-1,character:l.column-1},end:{line:l.line-1,character:l.column+l.length-1}},message:l.message,data:KE(u),source:this.getSource()};n.push(c)}}processParsingErrors(e,n,r){for(const i of e.parserErrors){let s;if(isNaN(i.token.startOffset)){if("previousToken"in i){const a=i.previousToken;if(isNaN(a.startOffset)){const o={line:0,character:0};s={start:o,end:o}}else{const o={line:a.endLine-1,character:a.endColumn};s={start:o,end:o}}}}else s=Ds(i.token);if(s){const a={severity:Es("error"),range:s,message:i.message,data:qn(Fe.ParsingError),source:this.getSource()};n.push(a)}}}processLinkingErrors(e,n,r){for(const i of e.references){const s=i.error;if(s){const a={node:s.container,property:s.property,index:s.index,data:{code:Fe.LinkingError,containerType:s.container.$type,property:s.property,refText:s.reference.$refText}};n.push(this.toDiagnostic("error",s.message,a))}}}async validateAst(e,n,r=V.CancellationToken.None){const i=[],s=(a,o,l)=>{i.push(this.toDiagnostic(a,o,l))};return await this.validateAstBefore(e,n,s,r),await this.validateAstNodes(e,n,s,r),await this.validateAstAfter(e,n,s,r),i}async validateAstBefore(e,n,r,i=V.CancellationToken.None){var s;const a=this.validationRegistry.checksBefore;for(const o of a)await Ee(i),await o(e,r,(s=n.categories)!==null&&s!==void 0?s:[],i)}async validateAstNodes(e,n,r,i=V.CancellationToken.None){await Promise.all(Jt(e).map(async s=>{await Ee(i);const a=this.validationRegistry.getChecks(s.$type,n.categories);for(const o of a)await o(s,r,i)}))}async validateAstAfter(e,n,r,i=V.CancellationToken.None){var s;const a=this.validationRegistry.checksAfter;for(const o of a)await Ee(i),await o(e,r,(s=n.categories)!==null&&s!==void 0?s:[],i)}toDiagnostic(e,n,r){return{message:n,range:jE(r),severity:Es(e),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}}function jE(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=cc(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=Eh(t.node.$cstNode,t.keyword,t.index)),e??(e=t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function Es(t){switch(t){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+t)}}function KE(t){switch(t){case"error":return qn(Fe.LexingError);case"warning":return qn(Fe.LexingWarning);case"info":return qn(Fe.LexingInfo);case"hint":return qn(Fe.LexingHint);default:throw new Error("Invalid diagnostic severity: "+t)}}var Fe;(function(t){t.LexingError="lexing-error",t.LexingWarning="lexing-warning",t.LexingInfo="lexing-info",t.LexingHint="lexing-hint",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(Fe||(Fe={}));class HE{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,n,r){const i=r??pt(e);n??(n=this.nameProvider.getName(e));const s=this.astNodeLocator.getAstNodePath(e);if(!n)throw new Error(`Node at path ${s} has no name.`);let a;const o=()=>{var l;return a??(a=ai((l=this.nameProvider.getNameNode(e))!==null&&l!==void 0?l:e.$cstNode))};return{node:e,name:n,get nameSegment(){return o()},selectionSegment:ai(e.$cstNode),type:e.$type,documentUri:i.uri,path:s}}}class VE{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,n=V.CancellationToken.None){const r=[],i=e.parseResult.value;for(const s of Jt(i))await Ee(n),sc(s).filter(a=>!Kr(a)).forEach(a=>{const o=this.createDescription(a);o&&r.push(o)});return r}createDescription(e){const n=e.reference.$nodeDescription,r=e.reference.$refNode;if(!n||!r)return;const i=pt(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:n.documentUri,targetPath:n.path,segment:ai(r),local:vt.equals(n.documentUri,i)}}}class WE{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){const n=this.getAstNodePath(e.$container),r=this.getPathSegment(e);return n+this.segmentSeparator+r}return""}getPathSegment({$containerProperty:e,$containerIndex:n}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return n!==void 0?e+this.indexSeparator+n:e}getAstNode(e,n){return n.split(this.segmentSeparator).reduce((i,s)=>{if(!i||s.length===0)return i;const a=s.indexOf(this.indexSeparator);if(a>0){const o=s.substring(0,a),l=parseInt(s.substring(a+1)),u=i[o];return u?.[l]}return i[s]},e)}}var zE=qf();class qE{constructor(e){this._ready=new ao,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new zE.Emitter,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var n,r;this.workspaceConfig=(r=(n=e.capabilities.workspace)===null||n===void 0?void 0:n.configuration)!==null&&r!==void 0?r:!1}async initialized(e){if(this.workspaceConfig){if(e.register){const n=this.serviceRegistry.all;e.register({section:n.map(r=>this.toSectionName(r.LanguageMetaData.languageId))})}if(e.fetchConfiguration){const n=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),r=await e.fetchConfiguration(n);n.forEach((i,s)=>{this.updateSectionConfiguration(i.section,r[s])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(n=>{const r=e.settings[n];this.updateSectionConfiguration(n,r),this.onConfigurationSectionUpdateEmitter.fire({section:n,configuration:r})})}updateSectionConfiguration(e,n){this.settings[e]=n}async getConfiguration(e,n){await this.ready;const r=this.toSectionName(e);if(this.settings[r])return this.settings[r][n]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}}var er;(function(t){function e(n){return{dispose:async()=>await n()}}t.create=e})(er||(er={}));class YE{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Ii,this.documentPhaseListeners=new Ii,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=K.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,n={},r=V.CancellationToken.None){var i,s;for(const a of e){const o=a.uri.toString();if(a.state===K.Validated){if(typeof n.validation=="boolean"&&n.validation)a.state=K.IndexedReferences,a.diagnostics=void 0,this.buildState.delete(o);else if(typeof n.validation=="object"){const l=this.buildState.get(o),u=(i=l?.result)===null||i===void 0?void 0:i.validationChecks;if(u){const f=((s=n.validation.categories)!==null&&s!==void 0?s:Ci.all).filter(d=>!u.includes(d));f.length>0&&(this.buildState.set(o,{completed:!1,options:{validation:Object.assign(Object.assign({},n.validation),{categories:f})},result:l.result}),a.state=K.IndexedReferences)}}}else this.buildState.delete(o)}this.currentState=K.Changed,await this.emitUpdate(e.map(a=>a.uri),[]),await this.buildDocuments(e,n,r)}async update(e,n,r=V.CancellationToken.None){this.currentState=K.Changed;for(const a of n)this.langiumDocuments.deleteDocument(a),this.buildState.delete(a.toString()),this.indexManager.remove(a);for(const a of e){if(!this.langiumDocuments.invalidateDocument(a)){const l=this.langiumDocumentFactory.fromModel({$type:"INVALID"},a);l.state=K.Changed,this.langiumDocuments.addDocument(l)}this.buildState.delete(a.toString())}const i=re(e).concat(n).map(a=>a.toString()).toSet();this.langiumDocuments.all.filter(a=>!i.has(a.uri.toString())&&this.shouldRelink(a,i)).forEach(a=>{this.serviceRegistry.getServices(a.uri).references.Linker.unlink(a),a.state=Math.min(a.state,K.ComputedScopes),a.diagnostics=void 0}),await this.emitUpdate(e,n),await Ee(r);const s=this.sortDocuments(this.langiumDocuments.all.filter(a=>{var o;return a.stater(e,n)))}sortDocuments(e){let n=0,r=e.length-1;for(;n=0&&!this.hasTextDocument(e[r]);)r--;nr.error!==void 0)?!0:this.indexManager.isAffected(e,n)}onUpdate(e){return this.updateListeners.push(e),er.create(()=>{const n=this.updateListeners.indexOf(e);n>=0&&this.updateListeners.splice(n,1)})}async buildDocuments(e,n,r){this.prepareBuild(e,n),await this.runCancelable(e,K.Parsed,r,s=>this.langiumDocumentFactory.update(s,r)),await this.runCancelable(e,K.IndexedContent,r,s=>this.indexManager.updateContent(s,r)),await this.runCancelable(e,K.ComputedScopes,r,async s=>{const a=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await a.computeLocalScopes(s,r)}),await this.runCancelable(e,K.Linked,r,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,r)),await this.runCancelable(e,K.IndexedReferences,r,s=>this.indexManager.updateReferences(s,r));const i=e.filter(s=>this.shouldValidate(s));await this.runCancelable(i,K.Validated,r,s=>this.validate(s,r));for(const s of e){const a=this.buildState.get(s.uri.toString());a&&(a.completed=!0)}}prepareBuild(e,n){for(const r of e){const i=r.uri.toString(),s=this.buildState.get(i);(!s||s.completed)&&this.buildState.set(i,{completed:!1,options:n,result:s?.result})}}async runCancelable(e,n,r,i){const s=e.filter(o=>o.stateo.state===n);await this.notifyBuildPhase(a,n,r),this.currentState=n}onBuildPhase(e,n){return this.buildPhaseListeners.add(e,n),er.create(()=>{this.buildPhaseListeners.delete(e,n)})}onDocumentPhase(e,n){return this.documentPhaseListeners.add(e,n),er.create(()=>{this.documentPhaseListeners.delete(e,n)})}waitUntil(e,n,r){let i;if(n&&"path"in n?i=n:r=n,r??(r=V.CancellationToken.None),i){const s=this.langiumDocuments.getDocument(i);if(s&&s.state>e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):r.isCancellationRequested?Promise.reject(ki):new Promise((s,a)=>{const o=this.onBuildPhase(e,()=>{if(o.dispose(),l.dispose(),i){const u=this.langiumDocuments.getDocument(i);s(u?.uri)}else s(void 0)}),l=r.onCancellationRequested(()=>{o.dispose(),l.dispose(),a(ki)})})}async notifyDocumentPhase(e,n,r){const s=this.documentPhaseListeners.get(n).slice();for(const a of s)try{await a(e,r)}catch(o){if(!Qi(o))throw o}}async notifyBuildPhase(e,n,r){if(e.length===0)return;const s=this.buildPhaseListeners.get(n).slice();for(const a of s)await Ee(r),await a(e,r)}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,n){var r,i;const s=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,a=this.getBuildOptions(e).validation,o=typeof a=="object"?a:void 0,l=await s.validateDocument(e,o,n);e.diagnostics?e.diagnostics.push(...l):e.diagnostics=l;const u=this.buildState.get(e.uri.toString());if(u){(r=u.result)!==null&&r!==void 0||(u.result={});const c=(i=o?.categories)!==null&&i!==void 0?i:Ci.all;u.result.validationChecks?u.result.validationChecks.push(...c):u.result.validationChecks=[...c]}}getBuildOptions(e){var n,r;return(r=(n=this.buildState.get(e.uri.toString()))===null||n===void 0?void 0:n.options)!==null&&r!==void 0?r:{}}}class XE{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new LE,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,n){const r=pt(e).uri,i=[];return this.referenceIndex.forEach(s=>{s.forEach(a=>{vt.equals(a.targetUri,r)&&a.targetPath===n&&i.push(a)})}),re(i)}allElements(e,n){let r=re(this.symbolIndex.keys());return n&&(r=r.filter(i=>!n||n.has(i))),r.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,n){var r;return n?this.symbolByTypeIndex.get(e,n,()=>{var s;return((s=this.symbolIndex.get(e))!==null&&s!==void 0?s:[]).filter(o=>this.astReflection.isSubtype(o.type,n))}):(r=this.symbolIndex.get(e))!==null&&r!==void 0?r:[]}remove(e){const n=e.toString();this.symbolIndex.delete(n),this.symbolByTypeIndex.clear(n),this.referenceIndex.delete(n)}async updateContent(e,n=V.CancellationToken.None){const i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,n),s=e.uri.toString();this.symbolIndex.set(s,i),this.symbolByTypeIndex.clear(s)}async updateReferences(e,n=V.CancellationToken.None){const i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,n);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,n){const r=this.referenceIndex.get(e.uri.toString());return r?r.some(i=>!i.local&&n.has(i.targetUri.toString())):!1}}class JE{constructor(e){this.initialBuildOptions={},this._ready=new ao,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(e){var n;this.folders=(n=e.workspaceFolders)!==null&&n!==void 0?n:void 0}initialized(e){return this.mutex.write(n=>{var r;return this.initializeWorkspace((r=this.folders)!==null&&r!==void 0?r:[],n)})}async initializeWorkspace(e,n=V.CancellationToken.None){const r=await this.performStartup(e);await Ee(n),await this.documentBuilder.build(r,this.initialBuildOptions,n)}async performStartup(e){const n=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),r=[],i=s=>{r.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};return await this.loadAdditionalDocuments(e,i),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,n,i))),this._ready.resolve(),r}loadAdditionalDocuments(e,n){return Promise.resolve()}getRootFolder(e){return Gt.parse(e.uri)}async traverseFolder(e,n,r,i){const s=await this.fileSystemProvider.readDirectory(n);await Promise.all(s.map(async a=>{if(this.includeEntry(e,a,r)){if(a.isDirectory)await this.traverseFolder(e,a.uri,r,i);else if(a.isFile){const o=await this.langiumDocuments.getOrCreateDocument(a.uri);i(o)}}}))}includeEntry(e,n,r){const i=vt.basename(n.uri);if(i.startsWith("."))return!1;if(n.isDirectory)return i!=="node_modules"&&i!=="out";if(n.isFile){const s=vt.extname(n.uri);return r.includes(s)}return!1}}class ZE{buildUnexpectedCharactersMessage(e,n,r,i,s){return zs.buildUnexpectedCharactersMessage(e,n,r,i,s)}buildUnableToPopLexerModeMessage(e){return zs.buildUnableToPopLexerModeMessage(e)}}const QE={mode:"full"};class e${constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;const n=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(n);const r=Lu(n)?Object.values(n):n,i=e.LanguageMetaData.mode==="production";this.chevrotainLexer=new he(r,{positionTracking:"full",skipValidations:i,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,n=QE){var r,i,s;const a=this.chevrotainLexer.tokenize(e);return{tokens:a.tokens,errors:a.errors,hidden:(r=a.groups.hidden)!==null&&r!==void 0?r:[],report:(s=(i=this.tokenBuilder).flushLexingReport)===null||s===void 0?void 0:s.call(i,e)}}toTokenTypeDictionary(e){if(Lu(e))return e;const n=Qf(e)?Object.values(e.modes).flat():e,r={};return n.forEach(i=>r[i.name]=i),r}}function t$(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function Qf(t){return t&&"modes"in t&&"defaultMode"in t}function Lu(t){return!t$(t)&&!Qf(t)}function n$(t,e,n){let r,i;typeof t=="string"?(i=e,r=n):(i=t.range.start,r=e),i||(i=D.create(0,0));const s=ed(t),a=oo(r),o=s$({lines:s,position:i,options:a});return c$({index:0,tokens:o,position:i})}function r$(t,e){const n=oo(e),r=ed(t);if(r.length===0)return!1;const i=r[0],s=r[r.length-1],a=n.start,o=n.end;return!!a?.exec(i)&&!!o?.exec(s)}function ed(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(uh)}const Pu=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,i$=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function s$(t){var e,n,r;const i=[];let s=t.position.line,a=t.position.character;for(let o=0;o=c.length){if(i.length>0){const h=D.create(s,a);i.push({type:"break",content:"",range:L.create(h,h)})}}else{Pu.lastIndex=f;const h=Pu.exec(c);if(h){const m=h[0],g=h[1],R=D.create(s,a+f),y=D.create(s,a+f+m.length);i.push({type:"tag",content:g,range:L.create(R,y)}),f+=m.length,f=va(c,f)}if(f0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function a$(t,e,n,r){const i=[];if(t.length===0){const s=D.create(n,r),a=D.create(n,r+e.length);i.push({type:"text",content:e,range:L.create(s,a)})}else{let s=0;for(const o of t){const l=o.index,u=e.substring(s,l);u.length>0&&i.push({type:"text",content:e.substring(s,l),range:L.create(D.create(n,s+r),D.create(n,l+r))});let c=u.length+1;const f=o[1];if(i.push({type:"inline-tag",content:f,range:L.create(D.create(n,s+c+r),D.create(n,s+c+f.length+r))}),c+=f.length,o.length===4){c+=o[2].length;const d=o[3];i.push({type:"text",content:d,range:L.create(D.create(n,s+c+r),D.create(n,s+c+d.length+r))})}else i.push({type:"text",content:"",range:L.create(D.create(n,s+c+r),D.create(n,s+c+r))});s=l+o[0].length}const a=e.substring(s);a.length>0&&i.push({type:"text",content:a,range:L.create(D.create(n,s+r),D.create(n,s+r+a.length))})}return i}const o$=/\S/,l$=/\s*$/;function va(t,e){const n=t.substring(e).match(o$);return n?e+n.index:t.length}function u$(t){const e=t.match(l$);if(e&&typeof e.index=="number")return e.index}function c$(t){var e,n,r,i;const s=D.create(t.position.line,t.position.character);if(t.tokens.length===0)return new Mu([],L.create(s,s));const a=[];for(;t.indexn.name===e)}getTags(e){return this.getAllTags().filter(n=>n.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(const n of this.elements)if(e.length===0)e=n.toString();else{const r=n.toString();e+=Du(e)+r}return e.trim()}toMarkdown(e){let n="";for(const r of this.elements)if(n.length===0)n=r.toMarkdown(e);else{const i=r.toMarkdown(e);n+=Du(n)+i}return n.trim()}}class Ss{constructor(e,n,r,i){this.name=e,this.content=n,this.inline=r,this.range=i}toString(){let e=`@${this.name}`;const n=this.content.toString();return this.content.inlines.length===1?e=`${e} ${n}`:this.content.inlines.length>1&&(e=`${e} +${n}`),this.inline?`{${e}}`:e}toMarkdown(e){var n,r;return(r=(n=e?.renderTag)===null||n===void 0?void 0:n.call(e,this))!==null&&r!==void 0?r:this.toMarkdownDefault(e)}toMarkdownDefault(e){const n=this.content.toMarkdown(e);if(this.inline){const s=p$(this.name,n,e??{});if(typeof s=="string")return s}let r="";e?.tag==="italic"||e?.tag===void 0?r="*":e?.tag==="bold"?r="**":e?.tag==="bold-italic"&&(r="***");let i=`${r}@${this.name}${r}`;return this.content.inlines.length===1?i=`${i} — ${n}`:this.content.inlines.length>1&&(i=`${i} +${n}`),this.inline?`{${i}}`:i}}function p$(t,e,n){var r,i;if(t==="linkplain"||t==="linkcode"||t==="link"){const s=e.indexOf(" ");let a=e;if(s>0){const l=va(e,s);a=e.substring(l),e=e.substring(0,s)}return(t==="linkcode"||t==="link"&&n.link==="code")&&(a=`\`${a}\``),(i=(r=n.renderLink)===null||r===void 0?void 0:r.call(n,e,a))!==null&&i!==void 0?i:m$(e,a)}}function m$(t,e){try{return Gt.parse(t,!0),`[${e}](${t})`}catch{return t}}class Ra{constructor(e,n){this.inlines=e,this.range=n}toString(){let e="";for(let n=0;nr.range.start.line&&(e+=` +`)}return e}toMarkdown(e){let n="";for(let r=0;ri.range.start.line&&(n+=` +`)}return n}}class id{constructor(e,n){this.text=e,this.range=n}toString(){return this.text}toMarkdown(){return this.text}}function Du(t){return t.endsWith(` +`)?` +`:` + +`}class g${constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const n=this.commentProvider.getComment(e);if(n&&r$(n))return n$(n).toMarkdown({renderLink:(i,s)=>this.documentationLinkRenderer(e,i,s),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,n,r){var i;const s=(i=this.findNameInPrecomputedScopes(e,n))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,n);if(s&&s.nameSegment){const a=s.nameSegment.range.start.line+1,o=s.nameSegment.range.start.character+1,l=s.documentUri.with({fragment:`L${a},${o}`});return`[${r}](${l.toString()})`}else return}documentationTagRenderer(e,n){}findNameInPrecomputedScopes(e,n){const i=pt(e).precomputedScopes;if(!i)return;let s=e;do{const o=i.get(s).find(l=>l.name===n);if(o)return o;s=s.$container}while(s)}findNameInGlobalScope(e,n){return this.indexManager.allElements().find(i=>i.name===n)}}class y${constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var n;return DE(e)?e.$comment:(n=Gd(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||n===void 0?void 0:n.text}}class T${constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,n){return Promise.resolve(this.syncParser.parse(e))}}class v${constructor(){this.previousTokenSource=new V.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const n=$E();return this.previousTokenSource=n,this.enqueue(this.writeQueue,e,n.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,n,r=V.CancellationToken.None){const i=new ao,s={action:n,deferred:i,cancellationToken:r};return e.push(s),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;const e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:n,deferred:r,cancellationToken:i})=>{try{const s=await Promise.resolve().then(()=>n(i));r.resolve(s)}catch(s){Qi(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class R${constructor(e){this.grammarElementIdMap=new Nu,this.tokenTypeIdMap=new Nu,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(n=>Object.assign(Object.assign({},n),{message:n.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){const n=new Map,r=new Map;for(const i of Jt(e))n.set(i,{});if(e.$cstNode)for(const i of Ms(e.$cstNode))r.set(i,{});return{astNodes:n,cstNodes:r}}dehydrateAstNode(e,n){const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,n));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const a=[];r[i]=a;for(const o of s)le(o)?a.push(this.dehydrateAstNode(o,n)):ze(o)?a.push(this.dehydrateReference(o,n)):a.push(o)}else le(s)?r[i]=this.dehydrateAstNode(s,n):ze(s)?r[i]=this.dehydrateReference(s,n):s!==void 0&&(r[i]=s);return r}dehydrateReference(e,n){const r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=n.cstNodes.get(e.$refNode)),r}dehydrateCstNode(e,n){const r=n.cstNodes.get(e);return Ju(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=n.astNodes.get(e.astNode),tr(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,n)):Xu(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){const n=e.value,r=this.createHydrationContext(n);return"$cstNode"in n&&this.hydrateCstNode(n.$cstNode,r),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(n,r)}}createHydrationContext(e){const n=new Map,r=new Map;for(const s of Jt(e))n.set(s,{});let i;if(e.$cstNode)for(const s of Ms(e.$cstNode)){let a;"fullText"in s?(a=new Df(s.fullText),i=a):"content"in s?a=new io:"tokenType"in s&&(a=this.hydrateCstLeafNode(s)),a&&(r.set(s,a),a.root=i)}return{astNodes:n,cstNodes:r}}hydrateAstNode(e,n){const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode&&(r.$cstNode=n.cstNodes.get(e.$cstNode));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const a=[];r[i]=a;for(const o of s)le(o)?a.push(this.setParent(this.hydrateAstNode(o,n),r)):ze(o)?a.push(this.hydrateReference(o,r,i,n)):a.push(o)}else le(s)?r[i]=this.setParent(this.hydrateAstNode(s,n),r):ze(s)?r[i]=this.hydrateReference(s,r,i,n):s!==void 0&&(r[i]=s);return r}setParent(e,n){return e.$container=n,e}hydrateReference(e,n,r,i){return this.linker.buildReference(n,r,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,n,r=0){const i=n.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=n.astNodes.get(e.astNode),tr(i))for(const s of e.content){const a=this.hydrateCstNode(s,n,r++);i.content.push(a)}return i}hydrateCstLeafNode(e){const n=this.getTokenType(e.tokenType),r=e.offset,i=e.length,s=e.startLine,a=e.startColumn,o=e.endLine,l=e.endColumn,u=e.hidden;return new pa(r,i,{start:{line:s,character:a},end:{line:o,character:l}},n,u)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){let e=0;for(const n of Jt(this.grammar))Bd(n)&&this.grammarElementIdMap.set(n,e++)}}function $t(t){return{documentation:{CommentProvider:e=>new y$(e),DocumentationProvider:e=>new g$(e)},parser:{AsyncParser:e=>new T$(e),GrammarConfig:e=>bh(e),LangiumParser:e=>yE(e),CompletionParser:e=>gE(e),ValueConverter:()=>new Wf,TokenBuilder:()=>new Vf,Lexer:e=>new e$(e),ParserErrorMessageProvider:()=>new Uf,LexerErrorMessageProvider:()=>new ZE},workspace:{AstNodeLocator:()=>new WE,AstNodeDescriptionProvider:e=>new HE(e),ReferenceDescriptionProvider:e=>new VE(e)},references:{Linker:e=>new IE(e),NameProvider:()=>new wE,ScopeProvider:e=>new ME(e),ScopeComputation:e=>new NE(e),References:e=>new _E(e)},serializer:{Hydrator:e=>new R$(e),JsonSerializer:e=>new FE(e)},validation:{DocumentValidator:e=>new BE(e),ValidationRegistry:e=>new UE(e)},shared:()=>t.shared}}function St(t){return{ServiceRegistry:e=>new GE(e),workspace:{LangiumDocuments:e=>new kE(e),LangiumDocumentFactory:e=>new xE(e),DocumentBuilder:e=>new YE(e),IndexManager:e=>new XE(e),WorkspaceManager:e=>new JE(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new v$,ConfigurationProvider:e=>new qE(e)}}}var Fu;(function(t){t.merge=(e,n)=>wi(wi({},e),n)})(Fu||(Fu={}));function ue(t,e,n,r,i,s,a,o,l){const u=[t,e,n,r,i,s,a,o,l].reduce(wi,{});return sd(u)}const A$=Symbol("isProxy");function sd(t,e){const n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw new Error("Cannot set property on injected service container")},get:(r,i)=>i===A$?!0:Uu(r,i,t,e||n),getOwnPropertyDescriptor:(r,i)=>(Uu(r,i,t,e||n),Object.getOwnPropertyDescriptor(r,i)),has:(r,i)=>i in t,ownKeys:()=>[...Object.getOwnPropertyNames(t)]});return n}const Gu=Symbol();function Uu(t,e,n,r){if(e in t){if(t[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:t[e]});if(t[e]===Gu)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return t[e]}else if(e in n){const i=n[e];t[e]=Gu;try{t[e]=typeof i=="function"?i(r):sd(i,r)}catch(s){throw t[e]=s instanceof Error?s:void 0,s}return t[e]}else return}function wi(t,e){if(e){for(const[n,r]of Object.entries(e))if(r!==void 0){const i=t[n];i!==null&&r!==null&&typeof i=="object"&&typeof r=="object"?t[n]=wi(i,r):t[n]=r}}return t}class E${readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const xt={fileSystemProvider:()=>new E$},$$={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},S$={AstReflection:()=>new ic};function x$(){const t=ue(St(xt),S$),e=ue($t({shared:t}),$$);return t.ServiceRegistry.register(e),e}function Vt(t){var e;const n=x$(),r=n.serializer.JsonSerializer.deserialize(t);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,Gt.parse(`memory://${(e=r.name)!==null&&e!==void 0?e:"grammar"}.langium`)),r}var k$=Object.defineProperty,A=(t,e)=>k$(t,"name",{value:e,configurable:!0}),Bu="Statement",Zr="Architecture";function I$(t){return He.isInstance(t,Zr)}A(I$,"isArchitecture");var Mr="Axis",Yn="Branch";function C$(t){return He.isInstance(t,Yn)}A(C$,"isBranch");var Dr="Checkout",Fr="CherryPicking",xs="ClassDefStatement",Xn="Commit";function w$(t){return He.isInstance(t,Xn)}A(w$,"isCommit");var ks="Curve",Is="Edge",Cs="Entry",Jn="GitGraph";function _$(t){return He.isInstance(t,Jn)}A(_$,"isGitGraph");var ws="Group",Qr="Info";function N$(t){return He.isInstance(t,Qr)}A(N$,"isInfo");var Gr="Item",_s="Junction",Zn="Merge";function b$(t){return He.isInstance(t,Zn)}A(b$,"isMerge");var Ns="Option",ei="Packet";function O$(t){return He.isInstance(t,ei)}A(O$,"isPacket");var ti="PacketBlock";function L$(t){return He.isInstance(t,ti)}A(L$,"isPacketBlock");var ni="Pie";function P$(t){return He.isInstance(t,ni)}A(P$,"isPie");var ri="PieSection";function M$(t){return He.isInstance(t,ri)}A(M$,"isPieSection");var bs="Radar",Os="Service",ii="Treemap";function D$(t){return He.isInstance(t,ii)}A(D$,"isTreemap");var Ls="TreemapRow",Ur="Direction",Br="Leaf",jr="Section",ad=class extends Yu{static{A(this,"MermaidAstReflection")}getAllTypes(){return[Zr,Mr,Yn,Dr,Fr,xs,Xn,ks,Ur,Is,Cs,Jn,ws,Qr,Gr,_s,Br,Zn,Ns,ei,ti,ni,ri,bs,jr,Os,Bu,ii,Ls]}computeIsSubtype(t,e){switch(t){case Yn:case Dr:case Fr:case Xn:case Zn:return this.isSubtype(Bu,e);case Ur:return this.isSubtype(Jn,e);case Br:case jr:return this.isSubtype(Gr,e);default:return!1}}getReferenceType(t){const e=`${t.container.$type}:${t.property}`;if(e==="Entry:axis")return Mr;throw new Error(`${e} is not a valid reference id.`)}getTypeMetaData(t){switch(t){case Zr:return{name:Zr,properties:[{name:"accDescr"},{name:"accTitle"},{name:"edges",defaultValue:[]},{name:"groups",defaultValue:[]},{name:"junctions",defaultValue:[]},{name:"services",defaultValue:[]},{name:"title"}]};case Mr:return{name:Mr,properties:[{name:"label"},{name:"name"}]};case Yn:return{name:Yn,properties:[{name:"name"},{name:"order"}]};case Dr:return{name:Dr,properties:[{name:"branch"}]};case Fr:return{name:Fr,properties:[{name:"id"},{name:"parent"},{name:"tags",defaultValue:[]}]};case xs:return{name:xs,properties:[{name:"className"},{name:"styleText"}]};case Xn:return{name:Xn,properties:[{name:"id"},{name:"message"},{name:"tags",defaultValue:[]},{name:"type"}]};case ks:return{name:ks,properties:[{name:"entries",defaultValue:[]},{name:"label"},{name:"name"}]};case Is:return{name:Is,properties:[{name:"lhsDir"},{name:"lhsGroup",defaultValue:!1},{name:"lhsId"},{name:"lhsInto",defaultValue:!1},{name:"rhsDir"},{name:"rhsGroup",defaultValue:!1},{name:"rhsId"},{name:"rhsInto",defaultValue:!1},{name:"title"}]};case Cs:return{name:Cs,properties:[{name:"axis"},{name:"value"}]};case Jn:return{name:Jn,properties:[{name:"accDescr"},{name:"accTitle"},{name:"statements",defaultValue:[]},{name:"title"}]};case ws:return{name:ws,properties:[{name:"icon"},{name:"id"},{name:"in"},{name:"title"}]};case Qr:return{name:Qr,properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case Gr:return{name:Gr,properties:[{name:"classSelector"},{name:"name"}]};case _s:return{name:_s,properties:[{name:"id"},{name:"in"}]};case Zn:return{name:Zn,properties:[{name:"branch"},{name:"id"},{name:"tags",defaultValue:[]},{name:"type"}]};case Ns:return{name:Ns,properties:[{name:"name"},{name:"value",defaultValue:!1}]};case ei:return{name:ei,properties:[{name:"accDescr"},{name:"accTitle"},{name:"blocks",defaultValue:[]},{name:"title"}]};case ti:return{name:ti,properties:[{name:"bits"},{name:"end"},{name:"label"},{name:"start"}]};case ni:return{name:ni,properties:[{name:"accDescr"},{name:"accTitle"},{name:"sections",defaultValue:[]},{name:"showData",defaultValue:!1},{name:"title"}]};case ri:return{name:ri,properties:[{name:"label"},{name:"value"}]};case bs:return{name:bs,properties:[{name:"accDescr"},{name:"accTitle"},{name:"axes",defaultValue:[]},{name:"curves",defaultValue:[]},{name:"options",defaultValue:[]},{name:"title"}]};case Os:return{name:Os,properties:[{name:"icon"},{name:"iconText"},{name:"id"},{name:"in"},{name:"title"}]};case ii:return{name:ii,properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"},{name:"TreemapRows",defaultValue:[]}]};case Ls:return{name:Ls,properties:[{name:"indent"},{name:"item"}]};case Ur:return{name:Ur,properties:[{name:"accDescr"},{name:"accTitle"},{name:"dir"},{name:"statements",defaultValue:[]},{name:"title"}]};case Br:return{name:Br,properties:[{name:"classSelector"},{name:"name"},{name:"value"}]};case jr:return{name:jr,properties:[{name:"classSelector"},{name:"name"}]};default:return{name:t,properties:[]}}}},He=new ad,ju,F$=A(()=>ju??(ju=Vt(`{"$type":"Grammar","isDeclared":true,"name":"Info","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@7"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)),"InfoGrammar"),Ku,G$=A(()=>Ku??(Ku=Vt(`{"$type":"Grammar","isDeclared":true,"name":"Packet","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"packet"},{"$type":"Keyword","value":"packet-beta"}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"+"},{"$type":"Assignment","feature":"bits","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@9"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)),"PacketGrammar"),Hu,U$=A(()=>Hu??(Hu=Vt(`{"$type":"Grammar","isDeclared":true,"name":"Pie","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"FLOAT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?(0|[1-9][0-9]*)(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@2"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@3"}}]},"fragment":false,"hidden":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)),"PieGrammar"),Vu,B$=A(()=>Vu??(Vu=Vt(`{"$type":"Grammar","isDeclared":true,"name":"Architecture","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"LeftPort","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"RightPort","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/"},"fragment":false,"hidden":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@18"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@19"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[[\\\\w ]+\\\\]/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)),"ArchitectureGrammar"),Wu,j$=A(()=>Wu??(Wu=Vt(`{"$type":"Grammar","isDeclared":true,"name":"GitGraph","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@14"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"TerminalRule","name":"REFERENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)),"GitGraphGrammar"),zu,K$=A(()=>zu??(zu=Vt(`{"$type":"Grammar","isDeclared":true,"name":"Radar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"}}]},"fragment":false,"hidden":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@16"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"interfaces":[{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@2"}}}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"definesHiddenTokens":false,"hiddenTokens":[],"types":[],"usedGrammars":[]}`)),"RadarGrammar"),qu,H$=A(()=>qu??(qu=Vt(`{"$type":"Grammar","isDeclared":true,"name":"Treemap","rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"Treemap","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"TreemapRows","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"TREEMAP_KEYWORD","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap-beta"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"CLASS_DEF","definition":{"$type":"RegexToken","regex":"/classDef\\\\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\\\\s+([^;\\\\r\\\\n]*))?(?:;)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STYLE_SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":::"}},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":"}},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"COMMA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":","}},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false},{"$type":"ParserRule","name":"TreemapRow","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"item","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ClassDef","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Item","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Section","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Leaf","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID2","definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9_]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER2","definition":{"$type":"RegexToken","regex":"/[0-9_\\\\.\\\\,]+/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"MyNumber","dataType":"number","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"Item","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"classSelector","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Section","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[]},{"$type":"Interface","name":"Leaf","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}]},{"$type":"Interface","name":"ClassDefStatement","attributes":[{"$type":"TypeAttribute","name":"className","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"styleText","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"Treemap","attributes":[{"$type":"TypeAttribute","name":"TreemapRows","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@14"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[],"$comment":"/**\\n * Treemap grammar for Langium\\n * Converted from mindmap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treemap declaration.\\n */"}`)),"TreemapGrammar"),V$={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},W$={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},z$={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},q$={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Y$={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},X$={languageId:"radar",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},J$={languageId:"treemap",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Wt={AstReflection:A(()=>new ad,"AstReflection")},Z$={Grammar:A(()=>F$(),"Grammar"),LanguageMetaData:A(()=>V$,"LanguageMetaData"),parser:{}},Q$={Grammar:A(()=>G$(),"Grammar"),LanguageMetaData:A(()=>W$,"LanguageMetaData"),parser:{}},eS={Grammar:A(()=>U$(),"Grammar"),LanguageMetaData:A(()=>z$,"LanguageMetaData"),parser:{}},tS={Grammar:A(()=>B$(),"Grammar"),LanguageMetaData:A(()=>q$,"LanguageMetaData"),parser:{}},nS={Grammar:A(()=>j$(),"Grammar"),LanguageMetaData:A(()=>Y$,"LanguageMetaData"),parser:{}},rS={Grammar:A(()=>K$(),"Grammar"),LanguageMetaData:A(()=>X$,"LanguageMetaData"),parser:{}},iS={Grammar:A(()=>H$(),"Grammar"),LanguageMetaData:A(()=>J$,"LanguageMetaData"),parser:{}},sS=/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,aS=/accTitle[\t ]*:([^\n\r]*)/,oS=/title([\t ][^\n\r]*|)/,lS={ACC_DESCR:sS,ACC_TITLE:aS,TITLE:oS},es=class extends Wf{static{A(this,"AbstractMermaidValueConverter")}runConverter(t,e,n){let r=this.runCommonConverter(t,e,n);return r===void 0&&(r=this.runCustomConverter(t,e,n)),r===void 0?super.runConverter(t,e,n):r}runCommonConverter(t,e,n){const r=lS[t.name];if(r===void 0)return;const i=r.exec(e);if(i!==null){if(i[1]!==void 0)return i[1].trim().replace(/[\t ]{2,}/gm," ");if(i[2]!==void 0)return i[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,` +`)}}},ts=class extends es{static{A(this,"CommonValueConverter")}runCustomConverter(t,e,n){}},kt=class extends Vf{static{A(this,"AbstractMermaidTokenBuilder")}constructor(t){super(),this.keywords=new Set(t)}buildKeywordTokens(t,e,n){const r=super.buildKeywordTokens(t,e,n);return r.forEach(i=>{this.keywords.has(i.name)&&i.PATTERN!==void 0&&(i.PATTERN=new RegExp(i.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),r}};(class extends kt{static{A(this,"CommonTokenBuilder")}});var uS=class extends kt{static{A(this,"GitGraphTokenBuilder")}constructor(){super(["gitGraph"])}},od={parser:{TokenBuilder:A(()=>new uS,"TokenBuilder"),ValueConverter:A(()=>new ts,"ValueConverter")}};function ld(t=xt){const e=ue(St(t),Wt),n=ue($t({shared:e}),nS,od);return e.ServiceRegistry.register(n),{shared:e,GitGraph:n}}A(ld,"createGitGraphServices");var cS=class extends kt{static{A(this,"InfoTokenBuilder")}constructor(){super(["info","showInfo"])}},ud={parser:{TokenBuilder:A(()=>new cS,"TokenBuilder"),ValueConverter:A(()=>new ts,"ValueConverter")}};function cd(t=xt){const e=ue(St(t),Wt),n=ue($t({shared:e}),Z$,ud);return e.ServiceRegistry.register(n),{shared:e,Info:n}}A(cd,"createInfoServices");var fS=class extends kt{static{A(this,"PacketTokenBuilder")}constructor(){super(["packet"])}},fd={parser:{TokenBuilder:A(()=>new fS,"TokenBuilder"),ValueConverter:A(()=>new ts,"ValueConverter")}};function dd(t=xt){const e=ue(St(t),Wt),n=ue($t({shared:e}),Q$,fd);return e.ServiceRegistry.register(n),{shared:e,Packet:n}}A(dd,"createPacketServices");var dS=class extends kt{static{A(this,"PieTokenBuilder")}constructor(){super(["pie","showData"])}},hS=class extends es{static{A(this,"PieValueConverter")}runCustomConverter(t,e,n){if(t.name==="PIE_SECTION_LABEL")return e.replace(/"/g,"").trim()}},hd={parser:{TokenBuilder:A(()=>new dS,"TokenBuilder"),ValueConverter:A(()=>new hS,"ValueConverter")}};function pd(t=xt){const e=ue(St(t),Wt),n=ue($t({shared:e}),eS,hd);return e.ServiceRegistry.register(n),{shared:e,Pie:n}}A(pd,"createPieServices");var pS=class extends kt{static{A(this,"ArchitectureTokenBuilder")}constructor(){super(["architecture"])}},mS=class extends es{static{A(this,"ArchitectureValueConverter")}runCustomConverter(t,e,n){if(t.name==="ARCH_ICON")return e.replace(/[()]/g,"").trim();if(t.name==="ARCH_TEXT_ICON")return e.replace(/["()]/g,"");if(t.name==="ARCH_TITLE")return e.replace(/[[\]]/g,"").trim()}},md={parser:{TokenBuilder:A(()=>new pS,"TokenBuilder"),ValueConverter:A(()=>new mS,"ValueConverter")}};function gd(t=xt){const e=ue(St(t),Wt),n=ue($t({shared:e}),tS,md);return e.ServiceRegistry.register(n),{shared:e,Architecture:n}}A(gd,"createArchitectureServices");var gS=class extends kt{static{A(this,"RadarTokenBuilder")}constructor(){super(["radar-beta"])}},yd={parser:{TokenBuilder:A(()=>new gS,"TokenBuilder"),ValueConverter:A(()=>new ts,"ValueConverter")}};function Td(t=xt){const e=ue(St(t),Wt),n=ue($t({shared:e}),rS,yd);return e.ServiceRegistry.register(n),{shared:e,Radar:n}}A(Td,"createRadarServices");var yS=class extends kt{static{A(this,"TreemapTokenBuilder")}constructor(){super(["treemap"])}},TS=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,vS=class extends es{static{A(this,"TreemapValueConverter")}runCustomConverter(t,e,n){if(t.name==="NUMBER2")return parseFloat(e.replace(/,/g,""));if(t.name==="SEPARATOR")return e.substring(1,e.length-1);if(t.name==="STRING2")return e.substring(1,e.length-1);if(t.name==="INDENTATION")return e.length;if(t.name==="ClassDef"){if(typeof e!="string")return e;const r=TS.exec(e);if(r)return{$type:"ClassDefStatement",className:r[1],styleText:r[2]||void 0}}}};function vd(t){const e=t.validation.TreemapValidator,n=t.validation.ValidationRegistry;if(n){const r={Treemap:e.checkSingleRoot.bind(e)};n.register(r,e)}}A(vd,"registerValidationChecks");var RS=class{static{A(this,"TreemapValidator")}checkSingleRoot(t,e){let n;for(const r of t.TreemapRows)r.item&&(n===void 0&&r.indent===void 0?n=0:r.indent===void 0?e("error","Multiple root nodes are not allowed in a treemap.",{node:r,property:"item"}):n!==void 0&&n>=parseInt(r.indent,10)&&e("error","Multiple root nodes are not allowed in a treemap.",{node:r,property:"item"}))}},Rd={parser:{TokenBuilder:A(()=>new yS,"TokenBuilder"),ValueConverter:A(()=>new vS,"ValueConverter")},validation:{TreemapValidator:A(()=>new RS,"TreemapValidator")}};function Ad(t=xt){const e=ue(St(t),Wt),n=ue($t({shared:e}),iS,Rd);return e.ServiceRegistry.register(n),vd(n),{shared:e,Treemap:n}}A(Ad,"createTreemapServices");var nt={},AS={info:A(async()=>{const{createInfoServices:t}=await wt(async()=>{const{createInfoServices:n}=await Promise.resolve().then(()=>SS);return{createInfoServices:n}},void 0,import.meta.url),e=t().Info.parser.LangiumParser;nt.info=e},"info"),packet:A(async()=>{const{createPacketServices:t}=await wt(async()=>{const{createPacketServices:n}=await Promise.resolve().then(()=>xS);return{createPacketServices:n}},void 0,import.meta.url),e=t().Packet.parser.LangiumParser;nt.packet=e},"packet"),pie:A(async()=>{const{createPieServices:t}=await wt(async()=>{const{createPieServices:n}=await Promise.resolve().then(()=>kS);return{createPieServices:n}},void 0,import.meta.url),e=t().Pie.parser.LangiumParser;nt.pie=e},"pie"),architecture:A(async()=>{const{createArchitectureServices:t}=await wt(async()=>{const{createArchitectureServices:n}=await Promise.resolve().then(()=>IS);return{createArchitectureServices:n}},void 0,import.meta.url),e=t().Architecture.parser.LangiumParser;nt.architecture=e},"architecture"),gitGraph:A(async()=>{const{createGitGraphServices:t}=await wt(async()=>{const{createGitGraphServices:n}=await Promise.resolve().then(()=>CS);return{createGitGraphServices:n}},void 0,import.meta.url),e=t().GitGraph.parser.LangiumParser;nt.gitGraph=e},"gitGraph"),radar:A(async()=>{const{createRadarServices:t}=await wt(async()=>{const{createRadarServices:n}=await Promise.resolve().then(()=>wS);return{createRadarServices:n}},void 0,import.meta.url),e=t().Radar.parser.LangiumParser;nt.radar=e},"radar"),treemap:A(async()=>{const{createTreemapServices:t}=await wt(async()=>{const{createTreemapServices:n}=await Promise.resolve().then(()=>_S);return{createTreemapServices:n}},void 0,import.meta.url),e=t().Treemap.parser.LangiumParser;nt.treemap=e},"treemap")};async function ES(t,e){const n=AS[t];if(!n)throw new Error(`Unknown diagram type: ${t}`);nt[t]||await n();const i=nt[t].parse(e);if(i.lexerErrors.length>0||i.parserErrors.length>0)throw new $S(i);return i.value}A(ES,"parse");var $S=class extends Error{constructor(t){const e=t.lexerErrors.map(r=>r.message).join(` +`),n=t.parserErrors.map(r=>r.message).join(` +`);super(`Parsing failed: ${e} ${n}`),this.result=t}static{A(this,"MermaidParseError")}};const SS=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:ud,createInfoServices:cd},Symbol.toStringTag,{value:"Module"})),xS=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:fd,createPacketServices:dd},Symbol.toStringTag,{value:"Module"})),kS=Object.freeze(Object.defineProperty({__proto__:null,PieModule:hd,createPieServices:pd},Symbol.toStringTag,{value:"Module"})),IS=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:md,createArchitectureServices:gd},Symbol.toStringTag,{value:"Module"})),CS=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:od,createGitGraphServices:ld},Symbol.toStringTag,{value:"Module"})),wS=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:yd,createRadarServices:Td},Symbol.toStringTag,{value:"Module"})),_S=Object.freeze(Object.defineProperty({__proto__:null,TreemapModule:Rd,createTreemapServices:Ad},Symbol.toStringTag,{value:"Module"}));export{ES as p}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/uk-CaUFw2Pq.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/uk-CaUFw2Pq.js new file mode 100644 index 0000000000000000000000000000000000000000..c2c28126440a1af91cd07ed8b20ca6380e928b3e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/uk-CaUFw2Pq.js @@ -0,0 +1 @@ +const o="Українська",e={built_with_gradio:"Зроблено на основі Gradio",clear:"Очистити",or:"або",submit:"Надіслати",settings:"Налаштування",built_with:"Зроблено з",download:"Завантажити",edit:"Редагувати",empty:"Порожній",error:"Помилка",hosted_on:"Розміщено на",loading:"Завантаження",logo:"Логотип",remove:"Видалити",share:"Поділитися",undo:"Скасувати",no_devices:"Пристроїв не знайдено",language:"Мова",display_theme:"Тема оформлення",pwa:"Прогресивний веб-додаток"},r={click_to_upload:"Натисніть, щоб завантажити",drop_audio:"Перетягніть аудіо сюди",drop_csv:"Перетягніть CSV-файл сюди",drop_file:"Перетягніть файл сюди",drop_image:"Перетягніть зображення сюди",drop_video:"Перетягніть відео сюди",drop_gallery:"Перетягніть медіа сюди",paste_clipboard:"Вставити з буфера обміну"},t={annotated_image:"Анотоване зображення"},_={allow_recording_access:"Будь ласка, дайте доступ до мікрофона для запису.",audio:"Аудіо",drop_to_upload:"Перетягніть аудіофайл сюди, щоб завантажити",record_from_microphone:"Записати з мікрофона",stop_recording:"Зупинити запис",no_device_support:"Медійні пристрої не можуть бути доступні. Переконайтеся, що ви запускаєте з захищеного джерела (https) або localhost (або ви передали дійсний SSL-сертифікат до ssl_verify), і ви дозволили браузеру доступ до вашого пристрою.",stop:"Зупинити",resume:"Відновити",record:"Записати",no_microphone:"Мікрофон не виявлено",pause:"Пауза",play:"Відтворити",waiting:"Очікування"},c={connection_can_break:"На мобільному пристрої з'єднання може перерватися, якщо ця вкладка втрачає фокус або пристрій увійде в режим сну, в результаті чого ви втратите своє місце в черзі.",long_requests_queue:"У черзі залишилось багато запитів. Скопіюйте цей Space, щоб пропустити чергу.",lost_connection:"З'єднання втрачено через вихід зі сторінки. Переміщення до кінця черги...",waiting_for_inputs:"Чекаємо завершення завантаження файлу(ів), будь ласка, спробуйте ще раз."},a={checkbox:"Прапорець",checkbox_group:"Група прапорців"},n={code:"Код"},s={color_picker:"Вибір кольору"},d={incorrect_format:"Неправильний формат, підтримуються лише файли CSV та TSV",new_column:"Додати стовпець",new_row:"Новий рядок",add_row_above:"Додати рядок вище",add_row_below:"Додати рядок нижче",delete_row:"Видалити рядок",delete_column:"Видалити стовпець",add_column_left:"Додати стовпець зліва",add_column_right:"Додати стовпець справа",sort_column:"Сортувати стовпець",sort_ascending:"Сортувати за зростанням",sort_descending:"Сортувати за спаданням",drop_to_upload:"Перетягніть CSV або TSV файли сюди, щоб імпортувати дані в таблицю даних",clear_sort:"Очистити сортування"},i={dropdown:"Випадне меню"},l={build_error:"Є помилка побудови",config_error:"Є помилка конфігурації",contact_page_author:"Будь ласка, зв'яжіться з автором сторінки, щоб повідомити.",no_app_file:"Немає файлу додатку",runtime_error:"Є помилка виконання",space_not_working:'"Space не працює, оскільки" {0}',space_paused:"Space призупинено",use_via_api:"Використовувати через API",use_via_api_or_mcp:"Використовувати через API або MCP"},p={uploading:"Завантаження..."},u={highlighted_text:"Виділений текст"},g={allow_webcam_access:"Будь ласка, дайте доступ до веб-камери для запису.",brush_color:"Колір пензля",brush_radius:"Розмір пензля",image:"Зображення",remove_image:"Видалити зображення",select_brush_color:"Виберіть колір пензля",start_drawing:"Почніть малювати",use_brush:"Використовуйте пензель",drop_to_upload:"Перетягніть файл зображення сюди, щоб завантажити"},m={label:"Мітка"},b={enable_cookies:"Якщо ви відвідуєте HuggingFace Space у режимі Інкогніто, вам потрібно увімкнути сторонні куки.",incorrect_credentials:"Неправильні облікові дані",username:"Ім'я користувача",password:"Пароль",login:"Увійти"},h={number:"Число"},w={plot:"Діаграма"},k={radio:"Перемикач"},f={slider:"Повзунок"},v={drop_to_upload:"Перетягніть відеофайл сюди, щоб завантажити"},S={edit:"Редагувати",retry:"Повторити",undo:"Скасувати",submit:"Надіслати",cancel:"Скасувати",like:"Подобається",dislike:"Не подобається",clear:"Очистити чат"},x={_name:o,common:e,upload_text:r,"3D_model":{"3d_model":"3D-модель",drop_to_upload:"Перетягніть файл 3D-моделі (.obj, .glb, .stl, .gltf, .splat або .ply) сюди, щоб завантажити"},annotated_image:t,audio:_,blocks:c,checkbox:a,code:n,color_picker:s,dataframe:d,dropdown:i,errors:l,file:p,highlighted_text:u,image:g,label:m,login:b,number:h,plot:w,radio:k,slider:f,video:v,chatbot:S};export{o as _name,t as annotated_image,_ as audio,c as blocks,S as chatbot,a as checkbox,n as code,s as color_picker,e as common,d as dataframe,x as default,i as dropdown,l as errors,p as file,u as highlighted_text,g as image,m as label,b as login,h as number,w as plot,k as radio,f as slider,r as upload_text,v as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/universal-CFOISHmx.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/universal-CFOISHmx.js new file mode 100644 index 0000000000000000000000000000000000000000..b966bd58027ddac4ca25b481ff659bf4b900d414 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/universal-CFOISHmx.js @@ -0,0 +1 @@ +import{B as s,N as n}from"./index-DWyDLubb.js";function b(o,i,r,f,a){var d=()=>{f(r[o])};r.addEventListener(i,d),a?s(()=>{r[o]=a()}):d(),(r===document.body||r===window||r===document)&&n(()=>{r.removeEventListener(i,d)})}export{b}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ur-Z4lbsgev.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ur-Z4lbsgev.js new file mode 100644 index 0000000000000000000000000000000000000000..290b79f36ceb69f26b396befeacebdba0112c2fc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/ur-Z4lbsgev.js @@ -0,0 +1 @@ +const o="اردو",e={built_with_gradio:"Gradio کے ساتھ بنایا گیا",clear:"صاف کریں",or:"یا",submit:"جمع کریں",settings:"ترتیبات",built_with:"کے ساتھ بنایا گیا",download:"ڈاؤن لوڈ کریں",edit:"ترمیم کریں",empty:"خالی",error:"خطا",hosted_on:"پر میزبانی کی جا رہی ہے",loading:"لوڈ ہو رہا ہے",logo:"لوگو",remove:"حذف کریں",share:"شیئر کریں",undo:"واپس لیں",no_devices:"کوئی ڈیوائس نہیں ملی",language:"زبان",display_theme:"تھیم کی نمائش",pwa:"پروگریسیو ویب ایپ"},r={click_to_upload:"اپ لوڈ کے لیے کلک کریں",drop_audio:"یہاں آڈیو ڈراپ کریں",drop_csv:"یہاں CSV ڈراپ کریں",drop_file:"یہاں فائل ڈراپ کریں",drop_image:"یہاں تصویر ڈراپ کریں",drop_video:"یہاں ویڈیو ڈراپ کریں",drop_gallery:"میڈیا یہاں ڈالیں",paste_clipboard:"کلپ بورڈ سے پیسٹ کریں"},t={annotated_image:"تشریحی تصویر"},_={allow_recording_access:"براہ مہربانی ریکارڈنگ کے لیے مائیکروفون تک رسائی کی اجازت دیں۔",audio:"آڈیو",drop_to_upload:"اپلوڈ کرنے کے لیے آڈیو فائل یہاں ڈراپ کریں",record_from_microphone:"مائیکروفون سے ریکارڈ کریں",stop_recording:"ریکارڈنگ بند کریں",no_device_support:"میڈیا ڈیوائسز تک رسائی حاصل نہیں کی جا سکی۔ یقینی بنائیں کہ آپ محفوظ ذریعہ (https) یا localhost پر چلا رہے ہیں (یا آپ نے ssl_verify میں درست SSL سرٹیفکیٹ منتقل کیا ہے)، اور آپ نے براؤزر کو اپنے ڈیوائس تک رسائی کی اجازت دی ہے۔",stop:"روکیں",resume:"دوبارہ شروع کریں",record:"ریکارڈ کریں",no_microphone:"کوئی مائیکروفون نہیں ملا",pause:"روکیں",play:"چلائیں",waiting:"انتظار کر رہا ہے"},c={connection_can_break:"موبائل پر، اگر اس ٹیب کا فوکس کھو جائے یا ڈیوائس سلیپ موڈ میں چلا جائے تو کنکشن ٹوٹ سکتا ہے، جس سے آپ قطار میں اپنی جگہ کھو سکتے ہیں۔",long_requests_queue:"درخواستوں کی ایک لمبی قطار زیر التواء ہے۔ قطار چھوڑنے کے لیے اس Space کو ڈپلیکیٹ کریں۔",lost_connection:"صفحہ چھوڑنے کی وجہ سے کنکشن کھو گیا۔ قطار میں دوبارہ شامل ہو رہا ہے...",waiting_for_inputs:"فائل(وں) کے اپ لوڈ ہونے کا انتظار ہے، براہ کرم دوبارہ کوشش کریں۔"},a={checkbox:"چیک باکس",checkbox_group:"چیک باکس گروپ"},n={code:"کوڈ"},s={color_picker:"رنگ منتخب کرنے والا"},d={incorrect_format:"غلط فارمیٹ، صرف CSV اور TSV فائلوں کی حمایت کی جاتی ہے",new_column:"کالم شامل کریں",new_row:"نئی قطار",add_row_above:"اوپر قطار شامل کریں",add_row_below:"نیچے قطار شامل کریں",delete_row:"قطار حذف کریں",delete_column:"کالم حذف کریں",add_column_left:"بائیں طرف کالم شامل کریں",add_column_right:"دائیں طرف کالم شامل کریں",sort_column:"کالم کو ترتیب دیں",sort_ascending:"صعودی ترتیب دیں",sort_descending:"نزولی ترتیب دیں",drop_to_upload:"ڈیٹا کو ڈیٹا فریم میں درآمد کرنے کے لیے CSV یا TSV فائلیں یہاں ڈراپ کریں",clear_sort:"ترتیب صاف کریں"},i={dropdown:"ڈراپ ڈاؤن"},l={build_error:"تعمیر میں خطا ہے",config_error:"ترتیب میں خطا ہے",contact_page_author:"براہ کرم صفحہ کے مصنف سے رابطہ کریں تاکہ انہیں مطلع کیا جا سکے۔",no_app_file:"کوئی ایپ فائل نہیں ہے",runtime_error:"رن ٹائم میں خطا ہے",space_not_working:'"Space کام نہیں کر رہا ہے کیونکہ" {0}',space_paused:"Space موقوف ہے",use_via_api:"API کے ذریعے استعمال کریں",use_via_api_or_mcp:"API یا MCP کے ذریعے استعمال کریں"},p={uploading:"اپلوڈ ہو رہا ہے..."},u={highlighted_text:"نمایاں کردہ متن"},g={allow_webcam_access:"براہ مہربانی ریکارڈنگ کے لیے ویب کیم تک رسائی کی اجازت دیں۔",brush_color:"برش کا رنگ",brush_radius:"برش کا سائز",image:"تصویر",remove_image:"تصویر حذف کریں",select_brush_color:"برش کا رنگ منتخب کریں",start_drawing:"ڈرائنگ شروع کریں",use_brush:"برش استعمال کریں",drop_to_upload:"اپلوڈ کرنے کے لیے تصویر فائل یہاں ڈراپ کریں"},m={label:"لیبل"},b={enable_cookies:"اگر آپ انکوگنیٹو موڈ میں HuggingFace Space ملاحظہ کر رہے ہیں تو، آپ کو تیسرے فریق کے کوکیز کو فعال کرنا ہوگا۔",incorrect_credentials:"غلط اسناد",username:"صارف نام",password:"پاس ورڈ",login:"لاگ ان کریں"},h={number:"نمبر"},w={plot:"گراف"},f={radio:"ریڈیو بٹن"},k={slider:"سلائیڈر"},v={drop_to_upload:"اپلوڈ کرنے کے لیے ویڈیو فائل یہاں ڈراپ کریں"},S={edit:"ترمیم",retry:"دوبارہ کوشش",undo:"واپس",submit:"جمع کریں",cancel:"منسوخ",like:"پسند",dislike:"ناپسند",clear:"گفتگو صاف کریں"},x={_name:o,common:e,upload_text:r,"3D_model":{"3d_model":"3D ماڈل",drop_to_upload:"اپلوڈ کرنے کے لیے 3D ماڈل (.obj, .glb, .stl, .gltf, .splat، یا .ply) فائل یہاں ڈراپ کریں"},annotated_image:t,audio:_,blocks:c,checkbox:a,code:n,color_picker:s,dataframe:d,dropdown:i,errors:l,file:p,highlighted_text:u,image:g,label:m,login:b,number:h,plot:w,radio:f,slider:k,video:v,chatbot:S};export{o as _name,t as annotated_image,_ as audio,c as blocks,S as chatbot,a as checkbox,n as code,s as color_picker,e as common,d as dataframe,x as default,i as dropdown,l as errors,p as file,u as highlighted_text,g as image,m as label,b as login,h as number,w as plot,f as radio,k as slider,r as upload_text,v as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/utils.svelte-CCyS_0CY.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/utils.svelte-CCyS_0CY.js new file mode 100644 index 0000000000000000000000000000000000000000..a4cc6429baf61f9013f073fba68dd44f2780e197 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/utils.svelte-CCyS_0CY.js @@ -0,0 +1 @@ +import{u as p,v as u,w as d,x as l,y as m,z as y}from"./index-DWyDLubb.js";import{s as g}from"./clone-BkeCM4Nl.js";import{$ as b}from"./i18n-Dnhn5Rxr.js";const f="__i18n__",w=["label","info","placeholder","description","title","value"];class _ extends Error{constructor(e){super(e),this.name="ShareError"}}async function O(s,e){if(window.__gradio_space__==null)throw new _("Must be on Spaces to share.");let r,t,o;{let c;if(typeof s=="object"&&s.url)c=s.url;else if(typeof s=="string")c=s;else throw new Error("Invalid data format for URL type");const h=await fetch(c);r=await h.blob(),t=h.headers.get("content-type")||"",o=h.headers.get("content-disposition")||""}const i=new File([r],o,{type:t}),n=await fetch("https://huggingface.co/uploads",{method:"POST",body:i,headers:{"Content-Type":i.type,"X-Requested-With":"XMLHttpRequest"}});if(!n.ok){if(n.headers.get("content-type")?.includes("application/json")){const c=await n.json();throw new _(`Upload failed: ${c.error}`)}throw new _("Upload failed.")}return await n.text()}function R(s){s.addEventListener("click",e);async function e(r){const t=r.composedPath(),[o]=t.filter(i=>i?.tagName==="BUTTON"&&i.classList.contains("copy_code_button"));if(o){let i=function(h){h.style.opacity="1",setTimeout(()=>{h.style.opacity="0"},2e3)};r.stopImmediatePropagation();const n=o.parentElement.innerText.trim(),a=Array.from(o.children)[1];await k(n)&&i(a)}}return{destroy(){s.removeEventListener("click",e)}}}async function k(s){let e=!1;if("clipboard"in navigator)await navigator.clipboard.writeText(s),e=!0;else{const r=document.createElement("textarea");r.value=s,r.style.position="absolute",r.style.left="-999999px",document.body.prepend(r),r.select();try{document.execCommand("copy"),e=!0}catch(t){console.error(t),e=!1}finally{r.remove()}}return e}const S=s=>{const e=Math.floor(s/3600),r=Math.floor(s%3600/60),t=Math.round(s)%60,o=`${r<10?"0":""}${r}`,i=`${t<10?"0":""}${t}`;return e>0?`${e}:${o}:${i}`:`${r}:${i}`},x=["elem_id","elem_classes","visible","interactive","server_fns","server","id","target","theme_mode","version","root","autoscroll","max_file_size","formatter","client","load_component","scale","min_width","theme","padding","loading_status","label","show_label","validation_error","show_progress","api_prefix","container","attached_events","register_component","dispatcher"];function $(s){return typeof s=="string"&&s.includes(f)}function j(s,e){const r=s.indexOf(f);if(r===-1)return s;const t=r+f.length,o=s.indexOf("}",t)+1;if(o===0)return s;try{const i=JSON.parse(s.slice(t,o));if(i?.key){const n=e(i.key),a=n!==i.key?n:i.key;return s.slice(0,r)+a+s.slice(o)}}catch{}return s}class L{load_component;#t=p(u({}));get shared(){return d(this.#t)}set shared(e){l(this.#t,e,!0)}#e=p(u({}));get props(){return d(this.#e)}set props(e){l(this.#e,e,!0)}#s=p(e=>e);get i18n(){return d(this.#s)}set i18n(e){l(this.#s,e,!0)}translatable_props={};dispatcher;last_update=null;shared_props=x;mounted=!1;old_value;register_component;constructor(e,r){for(const t in e.shared_props)this.shared[t]=e.shared_props[t];for(const t in e.props)this.props[t]=e.props[t];if(r)for(const t in r)this.props[t]===void 0&&(this.props[t]=r[t]);this.i18n=this.props.i18n??(t=>t);for(const t of w)this.shared[t]=this._translate_and_store("shared",t,e.shared_props[t]),this.props[t]=this._translate_and_store("props",t,e.props[t]);this.load_component=this.shared.load_component,this.register_component=this.shared.register_component||(()=>{}),this.dispatcher=this.shared.dispatcher||(()=>{}),this.register_component(e.shared_props.id,this.set_data.bind(this),this.get_data.bind(this)),m(()=>{for(const t in e.shared_props)this._is_i18n_managed(`shared.${t}`,e.shared_props[t])||(this.shared[t]=e.shared_props[t]);for(const t in e.props)this._is_i18n_managed(`props.${t}`,e.props[t])||(this.props[t]=e.props[t]);this.register_component(e.shared_props.id,this.set_data.bind(this),this.get_data.bind(this)),y(()=>{this.shared.id=e.shared_props.id})}),Object.keys(this.translatable_props).length>0&&b.subscribe(()=>{for(const[t,o]of Object.entries(this.translatable_props)){const[i,n]=t.split("."),a=this.i18n(o);i==="shared"?this.shared[n]=a:this.props[n]=a}})}_is_i18n_managed(e,r){const t=this.translatable_props[e];return t?r===t?!0:(delete this.translatable_props[e],!1):!1}_translate_and_store(e,r,t){if(typeof t!="string")return t;const o=this.i18n(t);return o!==t&&(this.translatable_props[`${e}.${r}`]=t),o}dispatch(e,r){this.dispatcher(this.shared.id,e,r)}async get_data(){return g(this.props)}update(e){this.set_data(e)}set_data(e){for(const r in e){const t=e[r],o=$(t)?this._translate_and_store(this.shared_props.includes(r)?"shared":"props",r,t):t;if(this.shared_props.includes(r)){const i=r;this.shared[i]=o;continue}this.props[r]=o}}watch_for_change(){m(()=>{this.mounted||(this.old_value=this.props.value,this.mounted=!0),this.old_value!=this.props.value&&(this.old_value=this.props.value,this.dispatch("change"))})}}const A=s=>typeof s=="number"?s+"px":s;function H(s){if(!s)return!1;const e=s.scrollHeight>s.clientHeight,r=s.scrollTop>=s.scrollHeight-s.clientHeight-1;return e&&!r}export{L as G,f as I,_ as S,R as a,x as b,A as c,S as f,H as s,j as t,O as u}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/uz-CDq7fxDa.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/uz-CDq7fxDa.js new file mode 100644 index 0000000000000000000000000000000000000000..c1380ff2070158129b1932a738351b9116714887 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/uz-CDq7fxDa.js @@ -0,0 +1 @@ +const a="O'zbek",i={built_with_gradio:"Gradio bilan yaratilgan",clear:"Tozalash",submit:"Yuborish",built_with:"Bilan yaratilgan",download:"Yuklab olish",edit:"Tahrirlash",empty:"Bo'sh",error:"Xato",hosted_on:"Joylashtirilgan",loading:"Yuklanmoqda",logo:"Logo",or:"yoki",remove:"O'chirish",settings:"Sozlamalar",share:"Ulashish",undo:"Bekor qilish",no_devices:"Hech qanday qurilma topilmadi",language:"Til",display_theme:"Ko'rinish mavzusi",pwa:"Progressive web-ilova"},o={click_to_upload:"Yuklash uchun bosing",drop_audio:"Audioni shu yerga tashlang",drop_csv:"CSV faylni shu yerga tashlang",drop_file:"Faylni shu yerga tashlang",drop_image:"Rasmni shu yerga tashlang",drop_video:"Videoni shu yerga tashlang",drop_gallery:"Mediafaylni shu yerga tashlang",paste_clipboard:"Klipboarddan qo'yish"},n={annotated_image:"Izohli rasm"},s={allow_recording_access:"Iltimos, yozib olish uchun mikrofonga ruxsat bering.",audio:"Audio",drop_to_upload:"Audio faylni yuklash uchun shu yerga tashlang",record_from_microphone:"Mikrofondan yozib olish",stop_recording:"Yozib olishni to'xtatish",no_device_support:"Media qurilmalariga kira olmadik. Xavfsiz manbada (https) yoki localhost-da ishlayotganingizni tekshiring (yoki to'g'ri SSL sertifikatini ssl_verify-ga berganingizni) va brauzer qurilmangizga kirishiga ruxsat berganingizni tekshiring.",stop:"To'xtatish",resume:"Davom ettirish",record:"Yozib olish",no_microphone:"Mikrofon topilmadi",pause:"Pauza",play:"Ijro etish",waiting:"Kutilmoqda"},r={connection_can_break:"Mobil qurilmada, agar bu yorliq fokusdan chiqsa yoki qurilma uyqu rejimiga o'tsa, aloqa uzilib, navbatdagi o'rningizni yo'qotishingiz mumkin.",long_requests_queue:"So'rovlar navbati juda uzun. Navbatni chetlab o'tish uchun bu Space-ni nusxalang.",lost_connection:"Sahifadan chiqib ketganligi sababli aloqa uzildi. Navbatga qayta qo'shilmoqda...",waiting_for_inputs:"Fayl(lar) yuklanib bo'lishini kutish, iltimos, qayta urinib ko'ring."},l={checkbox:"Belgilash katagi",checkbox_group:"Belgilash kataklari guruhi"},t={code:"Kod"},e={color_picker:"Rang tanlagich"},h={incorrect_format:"Noto'g'ri format, faqat CSV va TSV fayllari qo'llab-quvvatlanadi",new_column:"Ustun qo'shish",new_row:"Yangi qator",add_row_above:"Yuqoriga qator qo'shish",add_row_below:"Pastga qator qo'shish",delete_row:"Qatorni o'chirish",delete_column:"Ustunni o'chirish",add_column_left:"Chapga ustun qo'shish",add_column_right:"O'ngga ustun qo'shish",sort_column:"Ustunni saralash",sort_ascending:"O'sish tartibida saralash",sort_descending:"Kamayish tartibida saralash",drop_to_upload:"Ma'lumotlarni ma'lumotlar jadvaliga import qilish uchun CSV yoki TSV fayllarini shu yerga tashlang",clear_sort:"Saralashni tozalash"},u={dropdown:"Ochiluvchi ro'yxat"},g={build_error:"Tuzilish xatosi mavjud",config_error:"Konfiguratsiya xatosi mavjud",contact_page_author:"Iltimos, sahifa muallifiga bog'laning va ularga xabar bering.",no_app_file:"Ilova fayli yo'q",runtime_error:"Bajarilish vaqti xatosi mavjud",space_not_working:'"Space ishlamayapti, chunki" {0}',space_paused:"Space to'xtatilgan",use_via_api:"API orqali foydalaning",use_via_api_or_mcp:"API yoki MCP orqali foydalaning"},d={uploading:"Yuklanmoqda..."},c={highlighted_text:"Ajratilgan matn"},_={allow_webcam_access:"Iltimos, yozib olish uchun veb-kameraga ruxsat bering.",brush_color:"Cho'tka rangi",brush_radius:"Cho'tka o'lchami",image:"Rasm",remove_image:"Rasmni o'chirish",select_brush_color:"Cho'tka rangini tanlang",start_drawing:"Chizishni boshlang",use_brush:"Cho'tkadan foydalaning",drop_to_upload:"Rasm faylini yuklash uchun shu yerga tashlang"},m={label:"Yorliq"},b={enable_cookies:"Agar HuggingFace Space-ni Inkognito rejimida ko'rayotgan bo'lsangiz, uchinchi tomon kukilarini yoqishingiz kerak.",incorrect_credentials:"Noto'g'ri kirish ma'lumotlari",username:"Foydalanuvchi nomi",password:"Parol",login:"Kirish"},y={number:"Raqam"},p={plot:"Grafik"},k={radio:"Radio tugma"},q={slider:"Slayder"},f={drop_to_upload:"Video faylni yuklash uchun shu yerga tashlang"},v={edit:"Tahrirlash",retry:"Qayta urinish",undo:"Bekor qilish",submit:"Yuborish",cancel:"Bekor qilish",like:"Yoqdi",dislike:"Yoqmadi",clear:"Suhbatni tozalash"},z={_name:a,common:i,upload_text:o,"3D_model":{"3d_model":"3D model",drop_to_upload:"3D model (.obj, .glb, .stl, .gltf, .splat yoki .ply) faylni yuklash uchun shu yerga tashlang"},annotated_image:n,audio:s,blocks:r,checkbox:l,code:t,color_picker:e,dataframe:h,dropdown:u,errors:g,file:d,highlighted_text:c,image:_,label:m,login:b,number:y,plot:p,radio:k,slider:q,video:f,chatbot:v};export{a as _name,n as annotated_image,s as audio,r as blocks,v as chatbot,l as checkbox,t as code,e as color_picker,i as common,h as dataframe,z as default,u as dropdown,g as errors,d as file,c as highlighted_text,_ as image,m as label,b as login,y as number,p as plot,k as radio,q as slider,o as upload_text,f as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/vertexColorMixing-8t5JaWwM.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/vertexColorMixing-8t5JaWwM.js new file mode 100644 index 0000000000000000000000000000000000000000..20cbc8e50f711a00cf0227fe7c1a620e6aa39649 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/vertexColorMixing-8t5JaWwM.js @@ -0,0 +1,105 @@ +import{S as e}from"./index-CDrXokXW.js";const i="uvAttributeDeclaration",u=`#ifdef UV{X} +attribute uv{X}: vec2f; +#endif +`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=u);const r="prePassVertexDeclaration",v=`#ifdef PREPASS +#ifdef PREPASS_LOCAL_POSITION +varying vPosition : vec3f; +#endif +#ifdef PREPASS_DEPTH +varying vViewPos: vec3f; +#endif +#ifdef PREPASS_NORMALIZED_VIEW_DEPTH +varying vNormViewDepth: f32; +#endif +#if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) +uniform previousViewProjection: mat4x4f;varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f; +#endif +#endif +`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=v);const s="samplerVertexDeclaration",d=`#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0 +varying v_VARYINGNAME_UV: vec2f; +#endif +`;e.IncludesShadersStoreWGSL[s]||(e.IncludesShadersStoreWGSL[s]=d);const t="prePassVertex",I=`#ifdef PREPASS_DEPTH +vertexOutputs.vViewPos=(scene.view*worldPos).rgb; +#endif +#ifdef PREPASS_NORMALIZED_VIEW_DEPTH +vertexOutputs.vNormViewDepth=((scene.view*worldPos).z-uniforms.cameraInfo.x)/(uniforms.cameraInfo.y-uniforms.cameraInfo.x); +#endif +#ifdef PREPASS_LOCAL_POSITION +vertexOutputs.vPosition=positionUpdated.xyz; +#endif +#if (defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED) +vertexOutputs.vCurrentPosition=scene.viewProjection*worldPos; +#if NUM_BONE_INFLUENCERS>0 +var previousInfluence: mat4x4f;previousInfluence=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[0])]*vertexInputs.matricesWeights[0]; +#if NUM_BONE_INFLUENCERS>1 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[1])]*vertexInputs.matricesWeights[1]; +#endif +#if NUM_BONE_INFLUENCERS>2 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[2])]*vertexInputs.matricesWeights[2]; +#endif +#if NUM_BONE_INFLUENCERS>3 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[3])]*vertexInputs.matricesWeights[3]; +#endif +#if NUM_BONE_INFLUENCERS>4 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[0])]*vertexInputs.matricesWeightsExtra[0]; +#endif +#if NUM_BONE_INFLUENCERS>5 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[1])]*vertexInputs.matricesWeightsExtra[1]; +#endif +#if NUM_BONE_INFLUENCERS>6 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[2])]*vertexInputs.matricesWeightsExtra[2]; +#endif +#if NUM_BONE_INFLUENCERS>7 +previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[3])]*vertexInputs.matricesWeightsExtra[3]; +#endif +vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*previousInfluence* vec4f(positionUpdated,1.0); +#else +vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld* vec4f(positionUpdated,1.0); +#endif +#endif +`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=I);const n="uvVariableDeclaration",a=`#ifdef MAINUV{X} +#if !defined(UV{X}) +var uv{X}: vec2f=vec2f(0.,0.); +#else +var uv{X}: vec2f=vertexInputs.uv{X}; +#endif +vertexOutputs.vMainUV{X}=uv{X}; +#endif +`;e.IncludesShadersStoreWGSL[n]||(e.IncludesShadersStoreWGSL[n]=a);const f="samplerVertexImplementation",E=`#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0 +if (uniforms.v_INFONAME_==0.) +{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(uvUpdated,1.0,0.0)).xy;} +#ifdef UV2 +else if (uniforms.v_INFONAME_==1.) +{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(uv2Updated,1.0,0.0)).xy;} +#endif +#ifdef UV3 +else if (uniforms.v_INFONAME_==2.) +{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv3,1.0,0.0)).xy;} +#endif +#ifdef UV4 +else if (uniforms.v_INFONAME_==3.) +{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv4,1.0,0.0)).xy;} +#endif +#ifdef UV5 +else if (uniforms.v_INFONAME_==4.) +{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv5,1.0,0.0)).xy;} +#endif +#ifdef UV6 +else if (uniforms.v_INFONAME_==5.) +{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv6,1.0,0.0)).xy;} +#endif +#endif +`;e.IncludesShadersStoreWGSL[f]||(e.IncludesShadersStoreWGSL[f]=E);const o="vertexColorMixing",c=`#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +vertexOutputs.vColor=vec4f(1.0); +#ifdef VERTEXCOLOR +#ifdef VERTEXALPHA +vertexOutputs.vColor*=vertexInputs.color; +#else +vertexOutputs.vColor=vec4f(vertexOutputs.vColor.rgb*vertexInputs.color.rgb,vertexOutputs.vColor.a); +#endif +#endif +#ifdef INSTANCESCOLOR +vertexOutputs.vColor*=vertexInputs.instanceColor; +#endif +#endif +`;e.IncludesShadersStoreWGSL[o]||(e.IncludesShadersStoreWGSL[o]=c); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/vertexColorMixing-DUmDzlXI.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/vertexColorMixing-DUmDzlXI.js new file mode 100644 index 0000000000000000000000000000000000000000..a15c6f1a56b2fdd3a676c4e3b42210588a133cdc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/vertexColorMixing-DUmDzlXI.js @@ -0,0 +1,106 @@ +import{S as e}from"./index-CDrXokXW.js";const i="decalVertexDeclaration",a=`#ifdef DECAL +uniform vec4 vDecalInfos;uniform mat4 decalMatrix; +#endif +`;e.IncludesShadersStore[i]||(e.IncludesShadersStore[i]=a);const n="uvAttributeDeclaration",c=`#ifdef UV{X} +attribute vec2 uv{X}; +#endif +`;e.IncludesShadersStore[n]||(e.IncludesShadersStore[n]=c);const r="prePassVertexDeclaration",E=`#ifdef PREPASS +#ifdef PREPASS_LOCAL_POSITION +varying vec3 vPosition; +#endif +#ifdef PREPASS_DEPTH +varying vec3 vViewPos; +#endif +#ifdef PREPASS_NORMALIZED_VIEW_DEPTH +varying float vNormViewDepth; +#endif +#if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) +uniform mat4 previousViewProjection;varying vec4 vCurrentPosition;varying vec4 vPreviousPosition; +#endif +#endif +`;e.IncludesShadersStore[r]||(e.IncludesShadersStore[r]=E);const s="samplerVertexDeclaration",v=`#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0 +varying vec2 v_VARYINGNAME_UV; +#endif +`;e.IncludesShadersStore[s]||(e.IncludesShadersStore[s]=v);const d="prePassVertex",I=`#ifdef PREPASS_DEPTH +vViewPos=(view*worldPos).rgb; +#endif +#ifdef PREPASS_NORMALIZED_VIEW_DEPTH +vNormViewDepth=((view*worldPos).z-cameraInfo.x)/(cameraInfo.y-cameraInfo.x); +#endif +#ifdef PREPASS_LOCAL_POSITION +vPosition=positionUpdated.xyz; +#endif +#if (defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED) +vCurrentPosition=viewProjection*worldPos; +#if NUM_BONE_INFLUENCERS>0 +mat4 previousInfluence;previousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0]; +#if NUM_BONE_INFLUENCERS>1 +previousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1]; +#endif +#if NUM_BONE_INFLUENCERS>2 +previousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2]; +#endif +#if NUM_BONE_INFLUENCERS>3 +previousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3]; +#endif +#if NUM_BONE_INFLUENCERS>4 +previousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0]; +#endif +#if NUM_BONE_INFLUENCERS>5 +previousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1]; +#endif +#if NUM_BONE_INFLUENCERS>6 +previousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2]; +#endif +#if NUM_BONE_INFLUENCERS>7 +previousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3]; +#endif +vPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0); +#else +vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0); +#endif +#endif +`;e.IncludesShadersStore[d]||(e.IncludesShadersStore[d]=I);const o="uvVariableDeclaration",N=`#if !defined(UV{X}) && defined(MAINUV{X}) +vec2 uv{X}=vec2(0.,0.); +#endif +#ifdef MAINUV{X} +vMainUV{X}=uv{X}; +#endif +`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=N);const t="samplerVertexImplementation",_=`#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0 +if (v_INFONAME_==0.) +{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uvUpdated,1.0,0.0));} +#ifdef UV2 +else if (v_INFONAME_==1.) +{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv2Updated,1.0,0.0));} +#endif +#ifdef UV3 +else if (v_INFONAME_==2.) +{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv3,1.0,0.0));} +#endif +#ifdef UV4 +else if (v_INFONAME_==3.) +{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv4,1.0,0.0));} +#endif +#ifdef UV5 +else if (v_INFONAME_==4.) +{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv5,1.0,0.0));} +#endif +#ifdef UV6 +else if (v_INFONAME_==5.) +{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv6,1.0,0.0));} +#endif +#endif +`;e.IncludesShadersStore[t]||(e.IncludesShadersStore[t]=_);const f="vertexColorMixing",S=`#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) +vColor=vec4(1.0); +#ifdef VERTEXCOLOR +#ifdef VERTEXALPHA +vColor*=colorUpdated; +#else +vColor.rgb*=colorUpdated.rgb; +#endif +#endif +#ifdef INSTANCESCOLOR +vColor*=instanceColor; +#endif +#endif +`;e.IncludesShadersStore[f]||(e.IncludesShadersStore[f]=S); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioBaseSubGraph-CNNuTFUE.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioBaseSubGraph-CNNuTFUE.js new file mode 100644 index 0000000000000000000000000000000000000000..b5ac970e54c4411c25b42e4d5fb318abdffc7f0d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioBaseSubGraph-CNNuTFUE.js @@ -0,0 +1 @@ +import{e as b,b as A}from"./audioEngine-C797_5QL.js";import{L as _}from"./index-CDrXokXW.js";class y extends b{constructor(e,t){super(e,t,3)}connect(e){if(!this._connect(e))throw new Error("Connect failed")}disconnect(e){if(!this._disconnect(e))throw new Error("Disconnect failed")}disconnectAll(){if(!this._downstreamNodes)throw new Error("Disconnect failed");const e=this._downstreamNodes.values();for(let t=e.next();!t.done;t=e.next())if(!this._disconnect(t.value))throw new Error("Disconnect failed")}}const N={volume:1};class z extends y{constructor(e){super("Volume",e)}setOptions(e){this.setVolume(e.volume??N.volume,{shape:"none"})}}function u(s){return s.getSubNode("Volume")}function D(s,e){return u(s)?.[e]??N[e]}const i={fftSize:2048,minDecibels:-100,maxDecibels:-30,smoothing:.8};function S(s){return s.analyzerEnabled||s.analyzerFFTSize!==void 0||s.analyzerMinDecibels!==void 0||s.analyzerMaxDecibels!==void 0||s.analyzerSmoothing!==void 0}class p{get frequencyBinCount(){return this.fftSize/2}}class g extends y{constructor(e){super("Analyzer",e)}setOptions(e){this.fftSize=e.analyzerFFTSize??i.fftSize,this.minDecibels=e.analyzerMinDecibels??i.minDecibels,this.maxDecibels=e.analyzerMaxDecibels??i.maxDecibels,this.smoothing=e.analyzerSmoothing??i.smoothing}}function r(s){return s.getSubNode("Analyzer")}function d(s,e,t){s.callOnSubNode("Analyzer",n=>{n[e]=t})}let c=null,l=null;function m(){return c||(c=new Uint8Array),c}function f(){return l||(l=new Float32Array),l}class w extends p{constructor(e){super(),this._fftSize=i.fftSize,this._maxDecibels=i.maxDecibels,this._minDecibels=i.minDecibels,this._smoothing=i.smoothing,this._subGraph=e}get fftSize(){return this._fftSize}set fftSize(e){this._fftSize=e,d(this._subGraph,"fftSize",e)}get isEnabled(){return r(this._subGraph)!==null}get minDecibels(){return this._minDecibels}set minDecibels(e){this._minDecibels=e,d(this._subGraph,"minDecibels",e)}get maxDecibels(){return this._maxDecibels}set maxDecibels(e){this._maxDecibels=e,d(this._subGraph,"maxDecibels",e)}get smoothing(){return this._smoothing}set smoothing(e){this._smoothing=e,d(this._subGraph,"smoothing",e)}dispose(){const e=r(this._subGraph);e&&(this._subGraph.removeSubNodeAsync(e),e.dispose())}async enableAsync(){r(this._subGraph)||await this._subGraph.createAndAddSubNodeAsync("Analyzer")}getByteFrequencyData(){const e=r(this._subGraph);return e?e.getByteFrequencyData():(_.Warn("AudioAnalyzer not enabled"),this.enableAsync(),m())}getFloatFrequencyData(){const e=r(this._subGraph);return e?e.getFloatFrequencyData():(_.Warn("AudioAnalyzer not enabled"),this.enableAsync(),f())}}class E extends b{constructor(e,t,n){super(e,t,n),this._analyzer=null}get analyzer(){return this._analyzer??(this._analyzer=new w(this._subGraph))}get volume(){return D(this._subGraph,"volume")}set volume(e){const t=u(this._subGraph);if(!t)throw new Error("No volume subnode");t.volume=e}dispose(){super.dispose(),this._analyzer?.dispose(),this._analyzer=null,this._subGraph.dispose()}setVolume(e,t=null){const n=u(this._subGraph);if(!n)throw new Error("No volume subnode");n.setVolume(e,t)}}class F{constructor(){this._createSubNodePromises={},this._isDisposed=!1,this._subNodes={},this._onSubNodeDisposed=e=>{const t=e;delete this._subNodes[t.name],this._onSubNodesChanged()}}callOnSubNode(e,t){const n=this.getSubNode(e);if(n){t(n);return}this._createSubNodePromisesResolvedAsync().then(()=>{const o=this.getSubNode(e);if(o){t(o);return}this.createAndAddSubNodeAsync(e).then(a=>{t(a)})})}createAndAddSubNodeAsync(e){var t;return(t=this._createSubNodePromises)[e]||(t[e]=this._createSubNode(e).then(n=>(this._addSubNode(n),n))),this._createSubNodePromises[e]}dispose(){this._isDisposed=!0;const e=Object.values(this._subNodes);for(const t of e)t.dispose();this._subNodes={},this._createSubNodePromises={}}getSubNode(e){return this._subNodes[e]??null}async removeSubNodeAsync(e){if(!e)return;await this._createSubNodePromisesResolvedAsync();const t=e.name;this._subNodes[t]&&delete this._subNodes[t],delete this._createSubNodePromises[t],this._onSubNodesChanged()}async _createSubNodePromisesResolvedAsync(){return await Promise.all(Object.values(this._createSubNodePromises))}_addSubNode(e){if(this._isDisposed){e.dispose();return}this._subNodes[e.name]=e,e.onDisposeObservable.addOnce(this._onSubNodeDisposed),this._onSubNodesChanged()}}async function x(s){return new q(s)}class q extends z{constructor(e){super(e);const t=this.node=new GainNode(e._audioContext);this._volume=new A(e,t.gain)}dispose(){super.dispose(),this._volume.dispose()}get volume(){return this._volume.value}set volume(e){this.setVolume(e)}get _inNode(){return this.node}get _outNode(){return this.node}setVolume(e,t=null){this._volume.setTargetValue(e,t)}_connect(e){return super._connect(e)?(e._inNode&&this.node.connect(e._inNode),!0):!1}_disconnect(e){return super._disconnect(e)?(e._inNode&&this.node.disconnect(e._inNode),!0):!1}getClassName(){return"_VolumeWebAudioSubNode"}}async function v(s){return new G(s)}class G extends g{constructor(e){super(e),this._byteFrequencyData=null,this._floatFrequencyData=null,this._analyzerNode=new AnalyserNode(e._audioContext)}get fftSize(){return this._analyzerNode.fftSize}set fftSize(e){e!==this._analyzerNode.fftSize&&(this._analyzerNode.fftSize=e,this._clearArrays())}get _inNode(){return this._analyzerNode}get minDecibels(){return this._analyzerNode.minDecibels}set minDecibels(e){this._analyzerNode.minDecibels=e}get maxDecibels(){return this._analyzerNode.maxDecibels}set maxDecibels(e){this._analyzerNode.maxDecibels=e}get smoothing(){return this._analyzerNode.smoothingTimeConstant}set smoothing(e){this._analyzerNode.smoothingTimeConstant=e}dispose(){super.dispose(),this._clearArrays(),this._byteFrequencyData=null,this._floatFrequencyData=null,this._analyzerNode.disconnect()}getClassName(){return"_WebAudioAnalyzerSubNode"}getByteFrequencyData(){return(!this._byteFrequencyData||this._byteFrequencyData.length===0)&&(this._byteFrequencyData=new Uint8Array(this._analyzerNode.frequencyBinCount)),this._analyzerNode.getByteFrequencyData(this._byteFrequencyData),this._byteFrequencyData}getFloatFrequencyData(){return(!this._floatFrequencyData||this._floatFrequencyData.length===0)&&(this._floatFrequencyData=new Float32Array(this._analyzerNode.frequencyBinCount)),this._analyzerNode.getFloatFrequencyData(this._floatFrequencyData),this._floatFrequencyData}_clearArrays(){this._byteFrequencyData?.set(m()),this._floatFrequencyData?.set(f())}}class P extends F{constructor(e){super(),this._outputNode=null,this._owner=e}async initAsync(e){const t=S(e);if(t&&await this.createAndAddSubNodeAsync("Analyzer"),await this.createAndAddSubNodeAsync("Volume"),await this._createSubNodePromisesResolvedAsync(),t){const o=r(this);if(!o)throw new Error("No analyzer subnode.");o.setOptions(e)}const n=u(this);if(!n)throw new Error("No volume subnode.");if(n.setOptions(e),n.getClassName()!=="_VolumeWebAudioSubNode")throw new Error("Not a WebAudio subnode.");if(this._outputNode=n.node,this._outputNode&&this._downstreamNodes){const o=this._downstreamNodes.values();for(let a=o.next();!a.done;a=o.next()){const h=a.value._inNode;h&&this._outputNode.connect(h)}}}get _inNode(){return this._outputNode}get _outNode(){return this._outputNode}_createSubNode(e){switch(e){case"Analyzer":return v(this._owner.engine);case"Volume":return x(this._owner.engine);default:throw new Error(`Unknown subnode name: ${e}`)}}_onSubNodesChanged(){const e=r(this),t=u(this);e&&t&&t.connect(e)}}export{E as A,P as _,y as a,u as b}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioBus-Dmzu4Bvq.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioBus-Dmzu4Bvq.js new file mode 100644 index 0000000000000000000000000000000000000000..0a3c388c83e5c6b537f87a1701c50db68ef51ee0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioBus-Dmzu4Bvq.js @@ -0,0 +1 @@ +import{A as u}from"./abstractAudioBus-CCAQY1jG.js";import{_ as a,a as o,b as r,c as n}from"./spatialWebAudio-CBDS0rWd.js";import"./webAudioBaseSubGraph-CNNuTFUE.js";import"./audioEngine-C797_5QL.js";import"./index-DWyDLubb.js";import"./index-CDrXokXW.js";class _ extends u{constructor(t,s,e){super(t,s),this._spatialAutoUpdate=!0,this._spatialMinUpdateTime=0,this._outBus=null,this._spatial=null,this._onOutBusDisposed=()=>{this.outBus=this.engine.defaultMainBus},typeof e.spatialAutoUpdate=="boolean"&&(this._spatialAutoUpdate=e.spatialAutoUpdate),typeof e.spatialMinUpdateTime=="number"&&(this._spatialMinUpdateTime=e.spatialMinUpdateTime)}get outBus(){return this._outBus}set outBus(t){if(this._outBus!==t){if(this._outBus&&(this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed),!this._disconnect(this._outBus)))throw new Error("Disconnect failed");if(this._outBus=t,this._outBus&&(this._outBus.onDisposeObservable.add(this._onOutBusDisposed),!this._connect(this._outBus)))throw new Error("Connect failed")}}get spatial(){return this._spatial?this._spatial:this._initSpatialProperty()}dispose(){super.dispose(),this._spatial?.dispose(),this._spatial=null,this._outBus=null}_initSpatialProperty(){return this._spatial=this._createSpatialProperty(this._spatialAutoUpdate,this._spatialMinUpdateTime)}}class i extends _{constructor(t,s,e){super(t,s,e),this._stereo=null,this._subGraph=new i._SubGraph(this)}async _initAsync(t){t.outBus?this.outBus=t.outBus:(await this.engine.isReadyPromise,this.outBus=this.engine.defaultMainBus),await this._subGraph.initAsync(t),a(t)&&this._initSpatialProperty(),this.engine._addNode(this)}dispose(){super.dispose(),this._stereo=null,this.engine._removeNode(this)}get _inNode(){return this._subGraph._inNode}get _outNode(){return this._subGraph._outNode}get stereo(){return this._stereo??(this._stereo=new o(this._subGraph))}getClassName(){return"_WebAudioBus"}_createSpatialProperty(t,s){return new r(this._subGraph,t,s)}_connect(t){return super._connect(t)?(t._inNode&&this._outNode?.connect(t._inNode),!0):!1}_disconnect(t){return super._disconnect(t)?(t._inNode&&this._outNode?.disconnect(t._inNode),!0):!1}}i._SubGraph=class extends n{get _downstreamNodes(){return this._owner._downstreamNodes??null}get _upstreamNodes(){return this._owner._upstreamNodes??null}};export{i as _WebAudioBus}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioMainBus-COw9bIbJ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioMainBus-COw9bIbJ.js new file mode 100644 index 0000000000000000000000000000000000000000..6cad8a7829f1a0d0cdff9a3bc04a3a5a15fc217e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioMainBus-COw9bIbJ.js @@ -0,0 +1 @@ +import{A as s}from"./abstractAudioBus-CCAQY1jG.js";import{_ as i}from"./webAudioBaseSubGraph-CNNuTFUE.js";import"./audioEngine-C797_5QL.js";import"./index-DWyDLubb.js";import"./index-CDrXokXW.js";class r extends s{constructor(e,t){super(e,t)}}class n extends r{constructor(e,t){super(e,t),this._subGraph=new n._SubGraph(this)}async _initAsync(e){if(await this._subGraph.initAsync(e),this.engine.mainOut&&!this._connect(this.engine.mainOut))throw new Error("Connect failed");this.engine._addMainBus(this)}dispose(){super.dispose(),this.engine._removeMainBus(this)}get _inNode(){return this._subGraph._inNode}get _outNode(){return this._subGraph._outNode}_connect(e){return super._connect(e)?(e._inNode&&this._outNode?.connect(e._inNode),!0):!1}_disconnect(e){return super._disconnect(e)?(e._inNode&&this._outNode?.disconnect(e._inNode),!0):!1}getClassName(){return"_WebAudioMainBus"}}n._SubGraph=class extends i{get _downstreamNodes(){return this._owner._downstreamNodes??null}};export{n as _WebAudioMainBus}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioSoundSource-CHASmwKl.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioSoundSource-CHASmwKl.js new file mode 100644 index 0000000000000000000000000000000000000000..726193f0aec4c0a0901f3f4e750f583d299627d5 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioSoundSource-CHASmwKl.js @@ -0,0 +1 @@ +import{A as n}from"./abstractSoundSource-D3oGzC3p.js";import{_ as r,a as u,b as _,c as d}from"./spatialWebAudio-CBDS0rWd.js";import"./webAudioBaseSubGraph-CNNuTFUE.js";import"./audioEngine-C797_5QL.js";import"./index-DWyDLubb.js";import"./index-CDrXokXW.js";class s extends n{constructor(e,t,i,o){super(e,i,o),this._stereo=null,this._audioContext=this.engine._audioContext,this._webAudioNode=t,this._subGraph=new s._SubGraph(this)}async _initAsync(e){e.outBus?this.outBus=e.outBus:e.outBusAutoDefault!==!1&&(await this.engine.isReadyPromise,this.outBus=this.engine.defaultMainBus),await this._subGraph.initAsync(e),r(e)&&this._initSpatialProperty(),this.engine._addNode(this)}get _inNode(){return this._webAudioNode}get _outNode(){return this._subGraph._outNode}get stereo(){return this._stereo??(this._stereo=new u(this._subGraph))}dispose(){super.dispose(),this._stereo=null,this._subGraph.dispose(),this.engine._removeNode(this)}getClassName(){return"_WebAudioSoundSource"}_connect(e){return super._connect(e)?(e._inNode&&this._outNode?.connect(e._inNode),!0):!1}_disconnect(e){return super._disconnect(e)?(e._inNode&&this._outNode?.disconnect(e._inNode),!0):!1}_createSpatialProperty(e,t){return new _(this._subGraph,e,t)}}s._SubGraph=class extends d{get _downstreamNodes(){return this._owner._downstreamNodes??null}get _upstreamNodes(){return this._owner._upstreamNodes??null}_onSubNodesChanged(){super._onSubNodesChanged(),this._owner._inNode.disconnect(),this._owner._subGraph._inNode&&this._owner._inNode.connect(this._owner._subGraph._inNode)}};export{s as _WebAudioSoundSource}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioStaticSound-C9f3HBnG.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioStaticSound-C9f3HBnG.js new file mode 100644 index 0000000000000000000000000000000000000000..4ee03b2acf866f813b95a4325e6685535680d5fc --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioStaticSound-C9f3HBnG.js @@ -0,0 +1 @@ +import{A as h,_ as d}from"./abstractSoundInstance-Cb1S6dEM.js";import{_,a as c,b as f,c as l}from"./spatialWebAudio-CBDS0rWd.js";import{_ as p,a as m,b as u}from"./audioEngine-C797_5QL.js";import"./index-CDrXokXW.js";import"./index-DWyDLubb.js";import"./abstractSoundSource-D3oGzC3p.js";import"./webAudioBaseSubGraph-CNNuTFUE.js";class g extends h{constructor(t,e,i){super(t,e,i)}get duration(){return this._options.duration}set duration(t){this._options.duration=t}get loopStart(){return this._options.loopStart}set loopStart(t){this._options.loopStart=t}get loopEnd(){return this._options.loopEnd}set loopEnd(t){this._options.loopEnd=t}get pitch(){return this._options.pitch}set pitch(t){this._options.pitch=t;const e=this._instances.values();for(let i=e.next();!i.done;i=e.next())i.value.pitch=t}get playbackRate(){return this._options.playbackRate}set playbackRate(t){this._options.playbackRate=t;const e=this._instances.values();for(let i=e.next();!i.done;i=e.next())i.value.playbackRate=t}play(t={}){if(this.state===5){this.resume();return}t.duration??(t.duration=this.duration),t.loop??(t.loop=this.loop),t.loopStart??(t.loopStart=this.loopStart),t.loopEnd??(t.loopEnd=this.loopEnd),t.startOffset??(t.startOffset=this.startOffset),t.volume??(t.volume=1),t.waitTime??(t.waitTime=0);const e=this._createInstance();this._beforePlay(e),e.play(t),this._afterPlay(e),this._stopExcessInstances()}stop(t={}){if(t.waitTime&&0{this._enginePlayTime=0,this._state!==5&&this.onEndedObservable.notifyObservers(this),this._deinitSourceNode()},this._onEngineStateChanged=()=>{this.engine.state==="running"&&(this._options.loop&&this.state===2&&this.play(),this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged))},this._options=e,this._volumeNode=new GainNode(t._audioContext),this._initSourceNode()}dispose(){super.dispose(),this._pitch?.dispose(),this._playbackRate?.dispose(),this._sourceNode=null,this.stop(),this._deinitSourceNode(),this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged)}get currentTime(){if(this._state===1)return 0;const t=this._state===5?0:this.engine.currentTime-this._enginePlayTime;return this._enginePauseTime+t+this._options.startOffset}set currentTime(t){const e=this._state===2||this._state===3;if(e){const i=this._sourceNode;this._deinitSourceNode(),i?.stop(),this._state=1}this.state===5&&(this._enginePauseTime=0),this._options.startOffset=t,e&&this.play()}get _outNode(){return this._volumeNode}set pitch(t){this._pitch?.setTargetValue(t)}set playbackRate(t){this._playbackRate?.setTargetValue(t)}get startTime(){return this._state===1?0:this._enginePlayTime}getClassName(){return"_WebAudioStaticSoundInstance"}play(t={}){if(this._state===3)return;t.duration!==void 0&&(this._options.duration=t.duration),t.loop!==void 0&&(this._options.loop=t.loop),t.loopStart!==void 0&&(this._options.loopStart=t.loopStart),t.loopEnd!==void 0&&(this._options.loopEnd=t.loopEnd),t.startOffset!==void 0&&(this._options.startOffset=t.startOffset);let e=this._options.startOffset;this._state===5&&(e+=this._enginePauseTime,e%=this._sound.buffer.duration),this._enginePlayTime=this.engine.currentTime+(t.waitTime??0),this._volumeNode.gain.value=t.volume??1,this._initSourceNode(),this.engine.state==="running"?(this._setState(3),this._sourceNode?.start(this._enginePlayTime,e,this._options.duration>0?this._options.duration:void 0)):this._options.loop&&(this._setState(2),this.engine.stateChangedObservable.add(this._onEngineStateChanged))}pause(){this._state!==5&&(this._setState(5),this._enginePauseTime+=this.engine.currentTime-this._enginePlayTime,this._state===3?this._sourceNode?.stop():this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged),this._deinitSourceNode())}resume(){this._state===5&&this.play()}stop(t={}){if(this._state!==1){if(this._state===3){const e=this.engine.currentTime+(t.waitTime??0);this._sourceNode?.stop(e)}(t.waitTime===void 0||t.waitTime<=0)&&(this._setState(1),this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged))}}_connect(t){return super._connect(t)?(t instanceof a&&t._inNode&&(this._outNode?.connect(t._inNode),this._isConnected=!0),!0):!1}_disconnect(t){return super._disconnect(t)?(t instanceof a&&t._inNode&&(this._outNode?.disconnect(t._inNode),this._isConnected=!1),!0):!1}_deinitSourceNode(){if(this._sourceNode){if(this._isConnected&&!this._disconnect(this._sound))throw new Error("Disconnect failed");this._sourceNode.disconnect(this._volumeNode),this._sourceNode.removeEventListener("ended",this._onEnded),this._sourceNode=null}}_initSourceNode(){if(!this._sourceNode){if(this._sourceNode=new AudioBufferSourceNode(this._sound._audioContext,{buffer:this._sound.buffer._audioBuffer}),this._sourceNode.addEventListener("ended",this._onEnded,{once:!0}),this._sourceNode.connect(this._volumeNode),!this._connect(this._sound))throw new Error("Connect failed");this._pitch=new u(this.engine,this._sourceNode.detune),this._playbackRate=new u(this.engine,this._sourceNode.playbackRate)}const t=this._sourceNode;t.detune.value=this._sound.pitch,t.loop=this._options.loop,t.loopEnd=this._options.loopEnd,t.loopStart=this._options.loopStart,t.playbackRate.value=this._sound.playbackRate}}export{a as _WebAudioStaticSound,r as _WebAudioStaticSoundBuffer}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioStreamingSound-orB8PSId.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioStreamingSound-orB8PSId.js new file mode 100644 index 0000000000000000000000000000000000000000..b0dfb4633ac91f16b007d443168e667d015ca051 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webAudioStreamingSound-orB8PSId.js @@ -0,0 +1 @@ +import{O as o,d as h,L as d}from"./index-CDrXokXW.js";import{A as _,_ as l}from"./abstractSoundInstance-Cb1S6dEM.js";import{_ as u,a as c,b as p,c as f}from"./spatialWebAudio-CBDS0rWd.js";import{_ as a}from"./audioEngine-C797_5QL.js";import"./index-DWyDLubb.js";import"./abstractSoundSource-D3oGzC3p.js";import"./webAudioBaseSubGraph-CNNuTFUE.js";class m extends _{constructor(e,t,s){super(e,t,s),this._preloadedInstances=new Array}get preloadCount(){return this._options.preloadCount??1}get preloadCompletedCount(){return this._preloadedInstances.length}preloadInstanceAsync(){const e=this._createInstance();return this._addPreloadedInstance(e),e.preloadedPromise}async preloadInstancesAsync(e){for(let t=0;tawait t.preloadedPromise))}play(e={}){if(this.state===5){this.resume();return}let t;this.preloadCompletedCount>0?(t=this._preloadedInstances[0],t.startOffset=this.startOffset,this._removePreloadedInstance(t)):t=this._createInstance();const s=()=>{t.state===3&&(this._stopExcessInstances(),t.onStateChangedObservable.removeCallback(s))};t.onStateChangedObservable.add(s),e.startOffset??(e.startOffset=this.startOffset),e.loop??(e.loop=this.loop),e.volume??(e.volume=1),this._beforePlay(t),t.play(e),this._afterPlay(t)}stop(){if(this._setState(1),!!this._instances)for(const e of Array.from(this._instances))e.stop()}_addPreloadedInstance(e){this._preloadedInstances.includes(e)||this._preloadedInstances.push(e)}_removePreloadedInstance(e){const t=this._preloadedInstances.indexOf(e);t!==-1&&this._preloadedInstances.splice(t,1)}}class g extends l{constructor(e){super(e),this.onReadyObservable=new o,this.preloadedPromise=new Promise((t,s)=>{this._rejectPreloadedProimse=s,this._resolvePreloadedPromise=t}),this.onErrorObservable.add(this._rejectPreloadedProimse),this.onReadyObservable.add(this._resolvePreloadedPromise)}set startOffset(e){this._options.startOffset=e}dispose(){super.dispose(),this.onErrorObservable.clear(),this.onReadyObservable.clear(),this._resolvePreloadedPromise()}}class i extends m{constructor(e,t,s){super(e,t,s),this._stereo=null,this._options={autoplay:s.autoplay??!1,loop:s.loop??!1,maxInstances:s.maxInstances??1/0,preloadCount:s.preloadCount??1,startOffset:s.startOffset??0},this._subGraph=new i._SubGraph(this)}async _initAsync(e,t){const s=this.engine._audioContext;if(!(s instanceof AudioContext))throw new Error("Unsupported audio context type.");this._audioContext=s,this._source=e,t.outBus?this.outBus=t.outBus:t.outBusAutoDefault!==!1&&(await this.engine.isReadyPromise,this.outBus=this.engine.defaultMainBus),await this._subGraph.initAsync(t),u(t)&&this._initSpatialProperty(),this.preloadCount&&await this.preloadInstancesAsync(this.preloadCount),t.autoplay&&this.play(t),this.engine._addSound(this)}get _inNode(){return this._subGraph._inNode}get _outNode(){return this._subGraph._outNode}get stereo(){return this._stereo??(this._stereo=new c(this._subGraph))}dispose(){super.dispose(),this._stereo=null,this._subGraph.dispose(),this.engine._removeSound(this)}getClassName(){return"_WebAudioStreamingSound"}_createInstance(){return new y(this,this._options)}_connect(e){return super._connect(e)?(e._inNode&&this._outNode?.connect(e._inNode),!0):!1}_disconnect(e){return super._disconnect(e)?(e._inNode&&this._outNode?.disconnect(e._inNode),!0):!1}_createSpatialProperty(e,t){return new p(this._subGraph,e,t)}_getOptions(){return this._options}}i._SubGraph=class extends f{get _downstreamNodes(){return this._owner._downstreamNodes??null}get _upstreamNodes(){return this._owner._upstreamNodes??null}};class y extends g{constructor(e,t){if(super(e),this._currentTimeChangedWhilePaused=!1,this._enginePlayTime=1/0,this._enginePauseTime=0,this._isReady=!1,this._isReadyPromise=new Promise((s,n)=>{this._resolveIsReadyPromise=s,this._rejectIsReadyPromise=n}),this._onCanPlayThrough=()=>{this._isReady=!0,this._resolveIsReadyPromise(this._mediaElement),this.onReadyObservable.notifyObservers(this)},this._onEnded=()=>{this.onEndedObservable.notifyObservers(this),this.dispose()},this._onError=s=>{this._setState(4),this.onErrorObservable.notifyObservers(s),this._rejectIsReadyPromise(s),this.dispose()},this._onEngineStateChanged=()=>{this.engine.state==="running"&&(this._options.loop&&this.state===2&&this.play(),this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged))},this._onUserGesture=()=>{this.play()},this._options=t,this._volumeNode=new GainNode(e._audioContext),typeof e._source=="string")this._initFromUrl(e._source);else if(Array.isArray(e._source))this._initFromUrls(e._source);else if(e._source instanceof HTMLMediaElement)this._initFromMediaElement(e._source);else throw new Error(`Invalid streaming sound source (${e._source}).`)}get currentTime(){if(this._state===1)return 0;const e=this._state===5?0:this.engine.currentTime-this._enginePlayTime;return this._enginePauseTime+e+this._options.startOffset}set currentTime(e){const t=this._state===2||this._state===3;t&&(this._mediaElement.pause(),this._state=1),this._options.startOffset=e,t?this.play({startOffset:e}):this._state===5&&(this._currentTimeChangedWhilePaused=!0)}get _outNode(){return this._volumeNode}get startTime(){return this._state===1?0:this._enginePlayTime}dispose(){super.dispose(),this.stop(),this._sourceNode?.disconnect(this._volumeNode),this._sourceNode=null,this._mediaElement.removeEventListener("error",this._onError),this._mediaElement.removeEventListener("ended",this._onEnded),this._mediaElement.removeEventListener("canplaythrough",this._onCanPlayThrough);for(const e of Array.from(this._mediaElement.children))this._mediaElement.removeChild(e);this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged),this.engine.userGestureObservable.removeCallback(this._onUserGesture)}play(e={}){if(this._state===3)return;e.loop!==void 0&&(this._options.loop=e.loop),this._mediaElement.loop=this._options.loop;let t=e.startOffset;this._currentTimeChangedWhilePaused?(t=this._options.startOffset,this._currentTimeChangedWhilePaused=!1):this._state===5&&(t=this.currentTime+this._options.startOffset),t&&t>0&&(this._mediaElement.currentTime=t),this._volumeNode.gain.value=e.volume??1,this._play()}pause(){this._state!==2&&this._state!==3||(this._setState(5),this._enginePauseTime+=this.engine.currentTime-this._enginePlayTime,this._mediaElement.pause())}resume(){this._state===5?this.play():this._currentTimeChangedWhilePaused&&this.play()}stop(){this._state!==1&&this._stop()}getClassName(){return"_WebAudioStreamingSoundInstance"}_connect(e){return super._connect(e)?(e instanceof i&&e._inNode&&this._outNode?.connect(e._inNode),!0):!1}_disconnect(e){return super._disconnect(e)?(e instanceof i&&e._inNode&&this._outNode?.disconnect(e._inNode),!0):!1}_initFromMediaElement(e){if(h.SetCorsBehavior(e.currentSrc,e),e.controls=!1,e.loop=this._options.loop,e.preload="auto",e.addEventListener("canplaythrough",this._onCanPlayThrough,{once:!0}),e.addEventListener("ended",this._onEnded,{once:!0}),e.addEventListener("error",this._onError,{once:!0}),e.load(),this._sourceNode=new MediaElementAudioSourceNode(this._sound._audioContext,{mediaElement:e}),this._sourceNode.connect(this._volumeNode),!this._connect(this._sound))throw new Error("Connect failed");this._mediaElement=e}_initFromUrl(e){const t=new Audio(a(e));this._initFromMediaElement(t)}_initFromUrls(e){const t=new Audio;for(const s of e){const n=document.createElement("source");n.src=a(s),t.appendChild(n)}this._initFromMediaElement(t)}_play(){if(this._setState(2),!this._isReady){this._playWhenReady();return}if(this._state===2)if(this.engine.state==="running"){const e=this._mediaElement.play();this._enginePlayTime=this.engine.currentTime,this._setState(3),e.catch(()=>{this._setState(4),this._options.loop&&this.engine.userGestureObservable.addOnce(this._onUserGesture)})}else this._options.loop?this.engine.stateChangedObservable.add(this._onEngineStateChanged):(this.stop(),this._setState(4))}_playWhenReady(){this._isReadyPromise.then(()=>{this._play()}).catch(()=>{d.Error("Streaming sound instance failed to play"),this._setState(4)})}_stop(){this._mediaElement.pause(),this._setState(1),this._onEnded(),this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged)}}export{i as _WebAudioStreamingSound}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webgpuEngine-C4n6cvIQ.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webgpuEngine-C4n6cvIQ.js new file mode 100644 index 0000000000000000000000000000000000000000..3b253737df19a2c0748f1e3b49941e979e41e14b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/webgpuEngine-C4n6cvIQ.js @@ -0,0 +1,316 @@ +import{az as It,c5 as _e,A as Q,L as S,c6 as re,c7 as At,c8 as Te,c9 as Mt,ca as Ft,aN as Pt,cb as Be,J as w,cc as Lt,cd as Et,I as q,S as ne,d as H,ce as Ot,au as Gt,cf as Ut,cg as Nt,ch as $t,bg as N,ci as Vt,cj as kt,ck as Wt,b9 as de,cl as qt,cm as Qt,cn as Ht,co as Yt,cp as zt,cq as jt,cr as Kt,bY as Xt,cs as Jt,ct as Zt,cu as er,ay as tr}from"./index-CDrXokXW.js";import"./instancesVertex-CO_CTxxp.js";import"./bakedVertexAnimation-DoavwM49.js";import"./instancesDeclaration-DZdrWbmN.js";import"./helperFunctions-CZpZ-EbL.js";import"./fresnelFunction-cCRUtTOI.js";import"./meshUboDeclaration-Bk1ASTX2.js";import"./sceneUboDeclaration-BH1tZjjY.js";import"./decalFragment-iGkmQ-pm.js";import"./audioEngine-C797_5QL.js";import"./index-DWyDLubb.js";class I{static ComputeNumMipmapLevels(e,t){return It(Math.max(e,t))+1}static GetTextureTypeFromFormat(e){switch(e){case"r8unorm":case"r8uint":case"rg8unorm":case"rg8uint":case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8uint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgb10a2uint":case"rgb10a2unorm":case"rgb9e5ufloat":case"rg11b10ufloat":case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":case"bc6h-rgb-ufloat":case"bc5-rg-unorm":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc4-r-unorm":case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":case"etc2-rgb8unorm":case"etc2-rgb8unorm-srgb":case"etc2-rgb8a1unorm":case"etc2-rgb8a1unorm-srgb":case"etc2-rgba8unorm":case"etc2-rgba8unorm-srgb":case"eac-r11unorm":case"eac-rg11unorm":case"astc-4x4-unorm":case"astc-4x4-unorm-srgb":case"astc-5x4-unorm":case"astc-5x4-unorm-srgb":case"astc-5x5-unorm":case"astc-5x5-unorm-srgb":case"astc-6x5-unorm":case"astc-6x5-unorm-srgb":case"astc-6x6-unorm":case"astc-6x6-unorm-srgb":case"astc-8x5-unorm":case"astc-8x5-unorm-srgb":case"astc-8x6-unorm":case"astc-8x6-unorm-srgb":case"astc-8x8-unorm":case"astc-8x8-unorm-srgb":case"astc-10x5-unorm":case"astc-10x5-unorm-srgb":case"astc-10x6-unorm":case"astc-10x6-unorm-srgb":case"astc-10x8-unorm":case"astc-10x8-unorm-srgb":case"astc-10x10-unorm":case"astc-10x10-unorm-srgb":case"astc-12x10-unorm":case"astc-12x10-unorm-srgb":case"astc-12x12-unorm":case"astc-12x12-unorm-srgb":case"stencil8":return 0;case"r8snorm":case"r8sint":case"rg8snorm":case"rg8sint":case"rgba8snorm":case"rgba8sint":case"bc6h-rgb-float":case"bc5-rg-snorm":case"bc4-r-snorm":case"eac-r11snorm":case"eac-rg11snorm":return 3;case"r16uint":case"r16unorm":case"rg16unorm":case"rgba16unorm":case"rg16uint":case"rgba16uint":case"depth16unorm":return 5;case"r16sint":case"r16snorm":case"rg16snorm":case"rgba16snorm":case"rg16sint":case"rgba16sint":return 4;case"r16float":case"rg16float":case"rgba16float":return 2;case"r32uint":case"rg32uint":case"rgba32uint":return 7;case"r32sint":case"rg32sint":case"rgba32sint":return 7;case"r32float":case"rg32float":case"rgba32float":case"depth32float":case"depth32float-stencil8":case"depth24plus":case"depth24plus-stencil8":return 1}return 0}static GetBlockInformationFromFormat(e){switch(e){case"r8unorm":case"r8snorm":case"r8uint":case"r8sint":return{width:1,height:1,length:1};case"r16uint":case"r16sint":case"r16unorm":case"r16snorm":case"r16float":case"rg8unorm":case"rg8snorm":case"rg8uint":case"rg8sint":return{width:1,height:1,length:2};case"r32uint":case"r32sint":case"r32float":case"rg16uint":case"rg16sint":case"rg16float":case"rg16unorm":case"rg16snorm":case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8snorm":case"rgba8uint":case"rgba8sint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgb9e5ufloat":case"rgb10a2uint":case"rgb10a2unorm":case"rg11b10ufloat":return{width:1,height:1,length:4};case"rg32uint":case"rg32sint":case"rg32float":case"rgba16uint":case"rgba16sint":case"rgba16float":case"rgba16unorm":case"rgba16snorm":return{width:1,height:1,length:8};case"rgba32uint":case"rgba32sint":case"rgba32float":return{width:1,height:1,length:16};case"stencil8":throw"No fixed size for Stencil8 format!";case"depth16unorm":return{width:1,height:1,length:2};case"depth24plus":throw"No fixed size for Depth24Plus format!";case"depth24plus-stencil8":throw"No fixed size for Depth24PlusStencil8 format!";case"depth32float":return{width:1,height:1,length:4};case"depth32float-stencil8":return{width:1,height:1,length:5};case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":case"bc6h-rgb-ufloat":case"bc6h-rgb-float":case"bc5-rg-unorm":case"bc5-rg-snorm":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":return{width:4,height:4,length:16};case"bc4-r-unorm":case"bc4-r-snorm":case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":return{width:4,height:4,length:8};case"etc2-rgb8unorm":case"etc2-rgb8unorm-srgb":case"etc2-rgb8a1unorm":case"etc2-rgb8a1unorm-srgb":case"eac-r11unorm":case"eac-r11snorm":return{width:4,height:4,length:8};case"etc2-rgba8unorm":case"etc2-rgba8unorm-srgb":case"eac-rg11unorm":case"eac-rg11snorm":return{width:4,height:4,length:16};case"astc-4x4-unorm":case"astc-4x4-unorm-srgb":return{width:4,height:4,length:16};case"astc-5x4-unorm":case"astc-5x4-unorm-srgb":return{width:5,height:4,length:16};case"astc-5x5-unorm":case"astc-5x5-unorm-srgb":return{width:5,height:5,length:16};case"astc-6x5-unorm":case"astc-6x5-unorm-srgb":return{width:6,height:5,length:16};case"astc-6x6-unorm":case"astc-6x6-unorm-srgb":return{width:6,height:6,length:16};case"astc-8x5-unorm":case"astc-8x5-unorm-srgb":return{width:8,height:5,length:16};case"astc-8x6-unorm":case"astc-8x6-unorm-srgb":return{width:8,height:6,length:16};case"astc-8x8-unorm":case"astc-8x8-unorm-srgb":return{width:8,height:8,length:16};case"astc-10x5-unorm":case"astc-10x5-unorm-srgb":return{width:10,height:5,length:16};case"astc-10x6-unorm":case"astc-10x6-unorm-srgb":return{width:10,height:6,length:16};case"astc-10x8-unorm":case"astc-10x8-unorm-srgb":return{width:10,height:8,length:16};case"astc-10x10-unorm":case"astc-10x10-unorm-srgb":return{width:10,height:10,length:16};case"astc-12x10-unorm":case"astc-12x10-unorm-srgb":return{width:12,height:10,length:16};case"astc-12x12-unorm":case"astc-12x12-unorm-srgb":return{width:12,height:12,length:16}}return{width:1,height:1,length:4}}static IsHardwareTexture(e){return!!e.release}static IsInternalTexture(e){return!!e.dispose}static IsImageBitmap(e){return e.close!==void 0}static IsImageBitmapArray(e){return Array.isArray(e)&&e[0].close!==void 0}static IsCompressedFormat(e){switch(e){case"bc7-rgba-unorm-srgb":case"bc7-rgba-unorm":case"bc6h-rgb-float":case"bc6h-rgb-ufloat":case"bc5-rg-snorm":case"bc5-rg-unorm":case"bc4-r-snorm":case"bc4-r-unorm":case"bc3-rgba-unorm-srgb":case"bc3-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc2-rgba-unorm":case"bc1-rgba-unorm-srgb":case"bc1-rgba-unorm":case"etc2-rgb8unorm":case"etc2-rgb8unorm-srgb":case"etc2-rgb8a1unorm":case"etc2-rgb8a1unorm-srgb":case"etc2-rgba8unorm":case"etc2-rgba8unorm-srgb":case"eac-r11unorm":case"eac-r11snorm":case"eac-rg11unorm":case"eac-rg11snorm":case"astc-4x4-unorm":case"astc-4x4-unorm-srgb":case"astc-5x4-unorm":case"astc-5x4-unorm-srgb":case"astc-5x5-unorm":case"astc-5x5-unorm-srgb":case"astc-6x5-unorm":case"astc-6x5-unorm-srgb":case"astc-6x6-unorm":case"astc-6x6-unorm-srgb":case"astc-8x5-unorm":case"astc-8x5-unorm-srgb":case"astc-8x6-unorm":case"astc-8x6-unorm-srgb":case"astc-8x8-unorm":case"astc-8x8-unorm-srgb":case"astc-10x5-unorm":case"astc-10x5-unorm-srgb":case"astc-10x6-unorm":case"astc-10x6-unorm-srgb":case"astc-10x8-unorm":case"astc-10x8-unorm-srgb":case"astc-10x10-unorm":case"astc-10x10-unorm-srgb":case"astc-12x10-unorm":case"astc-12x10-unorm-srgb":case"astc-12x12-unorm":case"astc-12x12-unorm-srgb":return!0}return!1}static GetWebGPUTextureFormat(e,t,r=!1){switch(t){case 15:return"depth16unorm";case 16:return"depth24plus";case 13:return"depth24plus-stencil8";case 14:return"depth32float";case 18:return"depth32float-stencil8";case 19:return"stencil8";case 36492:return r?"bc7-rgba-unorm-srgb":"bc7-rgba-unorm";case 36495:return"bc6h-rgb-ufloat";case 36494:return"bc6h-rgb-float";case 33779:return r?"bc3-rgba-unorm-srgb":"bc3-rgba-unorm";case 33778:return r?"bc2-rgba-unorm-srgb":"bc2-rgba-unorm";case 33777:case 33776:return r?"bc1-rgba-unorm-srgb":"bc1-rgba-unorm";case 37808:return r?"astc-4x4-unorm-srgb":"astc-4x4-unorm";case 36196:case 37492:return r?"etc2-rgb8unorm-srgb":"etc2-rgb8unorm";case 37496:return r?"etc2-rgba8unorm-srgb":"etc2-rgba8unorm"}switch(e){case 3:switch(t){case 6:return"r8snorm";case 7:return"rg8snorm";case 4:throw"RGB format not supported in WebGPU";case 8:return"r8sint";case 9:return"rg8sint";case 10:throw"RGB_INTEGER format not supported in WebGPU";case 11:return"rgba8sint";default:return"rgba8snorm"}case 0:switch(t){case 6:return"r8unorm";case 7:return"rg8unorm";case 4:throw"TEXTUREFORMAT_RGB format not supported in WebGPU";case 5:return r?"rgba8unorm-srgb":"rgba8unorm";case 12:return r?"bgra8unorm-srgb":"bgra8unorm";case 8:return"r8uint";case 9:return"rg8uint";case 10:throw"RGB_INTEGER format not supported in WebGPU";case 11:return"rgba8uint";case 0:throw"TEXTUREFORMAT_ALPHA format not supported in WebGPU";case 1:throw"TEXTUREFORMAT_LUMINANCE format not supported in WebGPU";case 2:throw"TEXTUREFORMAT_LUMINANCE_ALPHA format not supported in WebGPU";default:return"rgba8unorm"}case 4:switch(t){case 8:return"r16sint";case 9:return"rg16sint";case 10:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";case 11:return"rgba16sint";default:return"rgba16sint"}case 5:switch(t){case 8:return"r16uint";case 9:return"rg16uint";case 10:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";case 11:return"rgba16uint";default:return"rgba16uint"}case 6:switch(t){case 8:return"r32sint";case 9:return"rg32sint";case 10:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";case 11:return"rgba32sint";default:return"rgba32sint"}case 7:switch(t){case 8:return"r32uint";case 9:return"rg32uint";case 10:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";case 11:return"rgba32uint";default:return"rgba32uint"}case 1:switch(t){case 6:return"r32float";case 7:return"rg32float";case 4:throw"TEXTUREFORMAT_RGB format not supported in WebGPU";case 5:return"rgba32float";default:return"rgba32float"}case 2:switch(t){case 6:return"r16float";case 7:return"rg16float";case 4:throw"TEXTUREFORMAT_RGB format not supported in WebGPU";case 5:return"rgba16float";default:return"rgba16float"}case 10:throw"TEXTURETYPE_UNSIGNED_SHORT_5_6_5 format not supported in WebGPU";case 13:switch(t){case 5:return"rg11b10ufloat";case 11:throw"TEXTUREFORMAT_RGBA_INTEGER format not supported in WebGPU when type is TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV";default:return"rg11b10ufloat"}case 14:switch(t){case 5:return"rgb9e5ufloat";case 11:throw"TEXTUREFORMAT_RGBA_INTEGER format not supported in WebGPU when type is TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV";default:return"rgb9e5ufloat"}case 8:throw"TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 format not supported in WebGPU";case 9:throw"TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 format not supported in WebGPU";case 11:switch(t){case 5:return"rgb10a2unorm";case 11:return"rgb10a2uint";default:return"rgb10a2unorm"}}return r?"rgba8unorm-srgb":"rgba8unorm"}static GetNumChannelsFromWebGPUTextureFormat(e){switch(e){case"r8unorm":case"r8snorm":case"r8uint":case"r8sint":case"bc4-r-unorm":case"bc4-r-snorm":case"r16uint":case"r16sint":case"depth16unorm":case"r16float":case"r16unorm":case"r16snorm":case"r32uint":case"r32sint":case"r32float":case"depth32float":case"stencil8":case"depth24plus":case"eac-r11unorm":case"eac-r11snorm":return 1;case"rg8unorm":case"rg8snorm":case"rg8uint":case"rg8sint":case"depth32float-stencil8":case"bc5-rg-unorm":case"bc5-rg-snorm":case"rg16uint":case"rg16sint":case"rg16float":case"rg16unorm":case"rg16snorm":case"rg32uint":case"rg32sint":case"rg32float":case"depth24plus-stencil8":case"eac-rg11unorm":case"eac-rg11snorm":return 2;case"rgb9e5ufloat":case"rg11b10ufloat":case"bc6h-rgb-ufloat":case"bc6h-rgb-float":case"etc2-rgb8unorm":case"etc2-rgb8unorm-srgb":return 3;case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8snorm":case"rgba8uint":case"rgba8sint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgba16unorm":case"rgba16snorm":case"rgb10a2uint":case"rgb10a2unorm":case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":case"rgba16uint":case"rgba16sint":case"rgba16float":case"rgba32uint":case"rgba32sint":case"rgba32float":case"etc2-rgb8a1unorm":case"etc2-rgb8a1unorm-srgb":case"etc2-rgba8unorm":case"etc2-rgba8unorm-srgb":case"astc-4x4-unorm":case"astc-4x4-unorm-srgb":case"astc-5x4-unorm":case"astc-5x4-unorm-srgb":case"astc-5x5-unorm":case"astc-5x5-unorm-srgb":case"astc-6x5-unorm":case"astc-6x5-unorm-srgb":case"astc-6x6-unorm":case"astc-6x6-unorm-srgb":case"astc-8x5-unorm":case"astc-8x5-unorm-srgb":case"astc-8x6-unorm":case"astc-8x6-unorm-srgb":case"astc-8x8-unorm":case"astc-8x8-unorm-srgb":case"astc-10x5-unorm":case"astc-10x5-unorm-srgb":case"astc-10x6-unorm":case"astc-10x6-unorm-srgb":case"astc-10x8-unorm":case"astc-10x8-unorm-srgb":case"astc-10x10-unorm":case"astc-10x10-unorm-srgb":case"astc-12x10-unorm":case"astc-12x10-unorm-srgb":case"astc-12x12-unorm":case"astc-12x12-unorm-srgb":return 4}throw`Unknown format ${e}!`}static HasStencilAspect(e){switch(e){case"stencil8":case"depth32float-stencil8":case"depth24plus-stencil8":return!0}return!1}static HasDepthAspect(e){switch(e){case"depth16unorm":case"depth24plus":case"depth24plus-stencil8":case"depth32float":case"depth32float-stencil8":return!0}return!1}static HasDepthAndStencilAspects(e){switch(e){case"depth32float-stencil8":case"depth24plus-stencil8":return!0}return!1}static GetDepthFormatOnly(e){switch(e){case"depth16unorm":return"depth16unorm";case"depth24plus":return"depth24plus";case"depth24plus-stencil8":return"depth24plus";case"depth32float":return"depth32float";case"depth32float-stencil8":return"depth32float"}return e}static GetSample(e){return e>1?4:1}}class Ct{constructor(){this._gpuTimeInFrameId=-1,this.counter=new _e}_addDuration(e,t){e=0&&(d.push(o[h]),p.push(_))}this.shaderProcessingContext.attributeNamesFromEffect=d,this.shaderProcessingContext.attributeLocationsFromEffect=p}buildUniformLayout(){if(this.shaderProcessingContext.leftOverUniforms.length){this.uniformBuffer?.dispose(),this.uniformBuffer=new re(this.engine,void 0,void 0,"leftOver-"+this._name);for(const e of this.shaderProcessingContext.leftOverUniforms){const t=e.type.replace(/^(.*?)(<.*>)?$/,"$1"),r=P.UniformSizes[t];this.uniformBuffer.addUniform(e.name,r,e.length),this._leftOverUniformsByName[e.name]=e.type}this.uniformBuffer.create()}}setEngine(e){this.engine=e}dispose(){this.uniformBuffer&&this.uniformBuffer.dispose()}setInt(e,t){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateInt(e,t)}setInt2(e,t,r){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateInt2(e,t,r)}setInt3(e,t,r,n){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateInt3(e,t,r,n)}setInt4(e,t,r,n,i){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateInt4(e,t,r,n,i)}setIntArray(e,t){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateIntArray(e,t)}setIntArray2(e,t){this.setIntArray(e,t)}setIntArray3(e,t){this.setIntArray(e,t)}setIntArray4(e,t){this.setIntArray(e,t)}setUInt(e,t){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateUInt(e,t)}setUInt2(e,t,r){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateUInt2(e,t,r)}setUInt3(e,t,r,n){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateUInt3(e,t,r,n)}setUInt4(e,t,r,n,i){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateUInt4(e,t,r,n,i)}setUIntArray(e,t){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateUIntArray(e,t)}setUIntArray2(e,t){this.setUIntArray(e,t)}setUIntArray3(e,t){this.setUIntArray(e,t)}setUIntArray4(e,t){this.setUIntArray(e,t)}setArray(e,t){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateArray(e,t)}setArray2(e,t){this.setArray(e,t)}setArray3(e,t){this.setArray(e,t)}setArray4(e,t){this.setArray(e,t)}setMatrices(e,t){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateMatrices(e,t)}setMatrix(e,t){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateMatrix(e,t)}setMatrix3x3(e,t){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateMatrix3x3(e,t)}setMatrix2x2(e,t){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateMatrix2x2(e,t)}setFloat(e,t){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateFloat(e,t)}setVector2(e,t){this.setFloat2(e,t.x,t.y)}setFloat2(e,t,r){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateFloat2(e,t,r)}setVector3(e,t){this.setFloat3(e,t.x,t.y,t.z)}setFloat3(e,t,r,n){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateFloat3(e,t,r,n)}setVector4(e,t){this.setFloat4(e,t.x,t.y,t.z,t.w)}setQuaternion(e,t){this.setFloat4(e,t.x,t.y,t.z,t.w)}setFloat4(e,t,r,n,i){!this.uniformBuffer||!this._leftOverUniformsByName[e]||this.uniformBuffer.updateFloat4(e,t,r,n,i)}setColor3(e,t){this.setFloat3(e,t.r,t.g,t.b)}setColor4(e,t,r){this.setFloat4(e,t.r,t.g,t.b,r)}setDirectColor4(e,t){this.setFloat4(e,t.r,t.g,t.b,t.a)}_getVertexShaderCode(){return this.sources?.vertex}_getFragmentShaderCode(){return this.sources?.fragment}}const sr=4,nr=65536,pt={mat2:2,mat3:3,mat4:4,mat2x2:2,mat3x3:3,mat4x4:4};class O{static get KnownUBOs(){return O._SimplifiedKnownBindings?O._SimplifiedKnownUBOs:O._KnownUBOs}constructor(e,t=!1){this.vertexBufferKindToNumberOfComponents={},this.shaderLanguage=e,this._attributeNextLocation=0,this._varyingNextLocation=0,this.freeGroupIndex=0,this.freeBindingIndex=0,this.availableVaryings={},this.availableAttributes={},this.availableBuffers={},this.availableTextures={},this.availableSamplers={},this.orderedAttributes=[],this.bindGroupLayoutEntries=[],this.bindGroupLayoutEntryInfo=[],this.bindGroupEntries=[],this.bufferNames=[],this.textureNames=[],this.samplerNames=[],this.leftOverUniforms=[],t||this._findStartingGroupBinding()}_findStartingGroupBinding(){const e=O.KnownUBOs,t=[];for(const r in e){const n=e[r].binding;n.groupIndex!==-1&&(t[n.groupIndex]===void 0?t[n.groupIndex]=n.bindingIndex:t[n.groupIndex]=Math.max(t[n.groupIndex],n.bindingIndex))}this.freeGroupIndex=t.length-1,this.freeGroupIndex===0?(this.freeGroupIndex++,this.freeBindingIndex=0):this.freeBindingIndex=t[t.length-1]+1}getAttributeNextLocation(e,t=0){const r=this._attributeNextLocation;return this._attributeNextLocation+=(pt[e]??1)*(t||1),r}getVaryingNextLocation(e,t=0){const r=this._varyingNextLocation;return this._varyingNextLocation+=(pt[e]??1)*(t||1),r}getNextFreeUBOBinding(){return this._getNextFreeBinding(1)}_getNextFreeBinding(e){if(this.freeBindingIndex>nr-e&&(this.freeGroupIndex++,this.freeBindingIndex=0),this.freeGroupIndex===sr)throw"Too many textures or UBOs have been declared and it is not supported in WebGPU.";const t={groupIndex:this.freeGroupIndex,bindingIndex:this.freeBindingIndex};return this.freeBindingIndex+=e,t}}O._SimplifiedKnownBindings=!0;O._SimplifiedKnownUBOs={Scene:{binding:{groupIndex:0,bindingIndex:0}},Light0:{binding:{groupIndex:-1,bindingIndex:-1}},Light1:{binding:{groupIndex:-1,bindingIndex:-1}},Light2:{binding:{groupIndex:-1,bindingIndex:-1}},Light3:{binding:{groupIndex:-1,bindingIndex:-1}},Light4:{binding:{groupIndex:-1,bindingIndex:-1}},Light5:{binding:{groupIndex:-1,bindingIndex:-1}},Light6:{binding:{groupIndex:-1,bindingIndex:-1}},Light7:{binding:{groupIndex:-1,bindingIndex:-1}},Light8:{binding:{groupIndex:-1,bindingIndex:-1}},Light9:{binding:{groupIndex:-1,bindingIndex:-1}},Light10:{binding:{groupIndex:-1,bindingIndex:-1}},Light11:{binding:{groupIndex:-1,bindingIndex:-1}},Light12:{binding:{groupIndex:-1,bindingIndex:-1}},Light13:{binding:{groupIndex:-1,bindingIndex:-1}},Light14:{binding:{groupIndex:-1,bindingIndex:-1}},Light15:{binding:{groupIndex:-1,bindingIndex:-1}},Light16:{binding:{groupIndex:-1,bindingIndex:-1}},Light17:{binding:{groupIndex:-1,bindingIndex:-1}},Light18:{binding:{groupIndex:-1,bindingIndex:-1}},Light19:{binding:{groupIndex:-1,bindingIndex:-1}},Light20:{binding:{groupIndex:-1,bindingIndex:-1}},Light21:{binding:{groupIndex:-1,bindingIndex:-1}},Light22:{binding:{groupIndex:-1,bindingIndex:-1}},Light23:{binding:{groupIndex:-1,bindingIndex:-1}},Light24:{binding:{groupIndex:-1,bindingIndex:-1}},Light25:{binding:{groupIndex:-1,bindingIndex:-1}},Light26:{binding:{groupIndex:-1,bindingIndex:-1}},Light27:{binding:{groupIndex:-1,bindingIndex:-1}},Light28:{binding:{groupIndex:-1,bindingIndex:-1}},Light29:{binding:{groupIndex:-1,bindingIndex:-1}},Light30:{binding:{groupIndex:-1,bindingIndex:-1}},Light31:{binding:{groupIndex:-1,bindingIndex:-1}},Material:{binding:{groupIndex:-1,bindingIndex:-1}},Mesh:{binding:{groupIndex:-1,bindingIndex:-1}},Internals:{binding:{groupIndex:-1,bindingIndex:-1}}};O._KnownUBOs={Scene:{binding:{groupIndex:0,bindingIndex:0}},Light0:{binding:{groupIndex:1,bindingIndex:0}},Light1:{binding:{groupIndex:1,bindingIndex:1}},Light2:{binding:{groupIndex:1,bindingIndex:2}},Light3:{binding:{groupIndex:1,bindingIndex:3}},Light4:{binding:{groupIndex:1,bindingIndex:4}},Light5:{binding:{groupIndex:1,bindingIndex:5}},Light6:{binding:{groupIndex:1,bindingIndex:6}},Light7:{binding:{groupIndex:1,bindingIndex:7}},Light8:{binding:{groupIndex:1,bindingIndex:8}},Light9:{binding:{groupIndex:1,bindingIndex:9}},Light10:{binding:{groupIndex:1,bindingIndex:10}},Light11:{binding:{groupIndex:1,bindingIndex:11}},Light12:{binding:{groupIndex:1,bindingIndex:12}},Light13:{binding:{groupIndex:1,bindingIndex:13}},Light14:{binding:{groupIndex:1,bindingIndex:14}},Light15:{binding:{groupIndex:1,bindingIndex:15}},Light16:{binding:{groupIndex:1,bindingIndex:16}},Light17:{binding:{groupIndex:1,bindingIndex:17}},Light18:{binding:{groupIndex:1,bindingIndex:18}},Light19:{binding:{groupIndex:1,bindingIndex:19}},Light20:{binding:{groupIndex:1,bindingIndex:20}},Light21:{binding:{groupIndex:1,bindingIndex:21}},Light22:{binding:{groupIndex:1,bindingIndex:22}},Light23:{binding:{groupIndex:1,bindingIndex:23}},Light24:{binding:{groupIndex:1,bindingIndex:24}},Light25:{binding:{groupIndex:1,bindingIndex:25}},Light26:{binding:{groupIndex:1,bindingIndex:26}},Light27:{binding:{groupIndex:1,bindingIndex:27}},Light28:{binding:{groupIndex:1,bindingIndex:28}},Light29:{binding:{groupIndex:1,bindingIndex:29}},Light30:{binding:{groupIndex:1,bindingIndex:30}},Light31:{binding:{groupIndex:1,bindingIndex:31}},Material:{binding:{groupIndex:2,bindingIndex:0}},Mesh:{binding:{groupIndex:2,bindingIndex:1}},Internals:{binding:{groupIndex:2,bindingIndex:2}}};function ee(s,e,t,r){let n=r,i=0,a="";for(;n=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e==95}function fe(s){let e=0,t="",r=!1;const n=[];for(;e=0&&s.charAt(e)!==t&&s.charAt(e)!==r;)e--;return e}function ar(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pe(s,e,t,r){let n=s.indexOf(e);if(n<0)return s;if(t){for(;n++0&&a>0){const o=e.substring(i+1,a);n=+o,isNaN(n)&&(n=+r[o.trim()]),e=e.substring(0,i)}return[e,t,n]}initializeShaders(e){this._webgpuProcessingContext=e,this._missingVaryings.length=0,this._textureArrayProcessing.length=0,this.attributeKeywordName=void 0,this.varyingVertexKeywordName=void 0,this.varyingFragmentKeywordName=void 0}preProcessShaderCode(e,t){const r=`// Internals UBO +uniform ${P.InternalsUBOName} { +float yFactor_; +float textureOutputHeight_; +}; +`,n=e.indexOf("// Internals UBO")!==-1;return t?(this._fragmentIsGLES3=e.indexOf("#version 3")!==-1,this._fragmentIsGLES3&&(this.varyingFragmentKeywordName="in"),n?e:r+`##INJECTCODE## +`+e):(this._vertexIsGLES3=e.indexOf("#version 3")!==-1,this._vertexIsGLES3&&(this.attributeKeywordName="in",this.varyingVertexKeywordName="out"),n?e:r+e)}varyingCheck(e,t){const r=/(flat\s)?\s*\bout\b/,n=/(flat\s)?\s*\bin\b/,i=/(flat\s)?\s*\bvarying\b/;return(t&&this._fragmentIsGLES3?n:!t&&this._vertexIsGLES3?r:i).test(e)}varyingProcessor(e,t,r){this._preProcessors=r;const n=/\s*(flat)?\s*out\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm,i=/\s*(flat)?\s*in\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm,a=/\s*(flat)?\s*varying\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm,u=(t&&this._fragmentIsGLES3?i:!t&&this._vertexIsGLES3?n:a).exec(e);if(u!==null){const c=u[1]??"",l=u[2],h=u[3];let d;t?(d=this._webgpuProcessingContext.availableVaryings[h],this._missingVaryings[d]="",d===void 0&&S.Warn(`Invalid fragment shader: The varying named "${h}" is not declared in the vertex shader! This declaration will be ignored.`)):(d=this._webgpuProcessingContext.getVaryingNextLocation(l,this._getArraySize(h,l,r)[2]),this._webgpuProcessingContext.availableVaryings[h]=d,this._missingVaryings[d]=`layout(location = ${d}) ${c} in ${l} ${h};`),e=e.replace(u[0],d===void 0?"":`layout(location = ${d}) ${c} ${t?"in":"out"} ${l} ${h};`)}return e}attributeProcessor(e,t){this._preProcessors=t;const r=/\s*in\s+(\S+)\s+(\S+)\s*;/gm,n=/\s*attribute\s+(\S+)\s+(\S+)\s*;/gm,a=(this._vertexIsGLES3?r:n).exec(e);if(a!==null){const o=a[1],u=a[2],c=this._webgpuProcessingContext.getAttributeNextLocation(o,this._getArraySize(u,o,t)[2]);this._webgpuProcessingContext.availableAttributes[u]=c,this._webgpuProcessingContext.orderedAttributes[c]=u;const l=this._webgpuProcessingContext.vertexBufferKindToNumberOfComponents[u];if(l!==void 0){const h=l<0?l===-1?"int":"ivec"+-l:l===1?"uint":"uvec"+l,d=`_int_${u}_`;e=e.replace(a[0],`layout(location = ${c}) in ${h} ${d}; ${o} ${u} = ${o}(${d});`)}else e=e.replace(a[0],`layout(location = ${c}) in ${o} ${u};`)}return e}uniformProcessor(e,t,r){this._preProcessors=r;const i=/\s*uniform\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm.exec(e);if(i!==null){let a=i[1],o=i[2];if(a.indexOf("sampler")===0||a.indexOf("sampler")===1){let u=0;[o,a,u]=this._getArraySize(o,a,r);let c=this._webgpuProcessingContext.availableTextures[o];if(!c){c={autoBindSampler:!0,isTextureArray:u>0,isStorageTexture:!1,textures:[],sampleType:"float"};for(let R=0;R<(u||1);++R)c.textures.push(this._webgpuProcessingContext.getNextFreeUBOBinding())}const l=P._SamplerTypeByWebGLSamplerType[a]??"sampler",h=!!P._IsComparisonSamplerByWebGPUSamplerType[l],d=h?"comparison":"filtering",p=o+"Sampler";let _=this._webgpuProcessingContext.availableSamplers[p];_||(_={binding:this._webgpuProcessingContext.getNextFreeUBOBinding(),type:d});const g=a.charAt(0)==="u"?"u":a.charAt(0)==="i"?"i":"";g&&(a=a.substring(1));const f=h?"depth":g==="u"?"uint":g==="i"?"sint":"float";c.sampleType=f;const m=u>0,b=_.binding.groupIndex,x=_.binding.bindingIndex,B=P._SamplerFunctionByWebGLSamplerType[a],y=P._TextureTypeByWebGLSamplerType[a],M=P._GpuTextureViewDimensionByWebGPUTextureType[y];if(!m)u=1,e=`layout(set = ${b}, binding = ${x}) uniform ${l} ${p}; + layout(set = ${c.textures[0].groupIndex}, binding = ${c.textures[0].bindingIndex}) uniform ${g}${y} ${o}Texture; + #define ${o} ${g}${B}(${o}Texture, ${p})`;else{const R=[];R.push(`layout(set = ${b}, binding = ${x}) uniform ${g}${l} ${p};`),e=` +`;for(let v=0;v0?` +`:""}#define ${o}${v} ${g}${B}(${o}Texture${v}, ${p})`}e=R.join(` +`)+e,this._textureArrayProcessing.push(o)}this._webgpuProcessingContext.availableTextures[o]=c,this._webgpuProcessingContext.availableSamplers[p]=_,this._addSamplerBindingDescription(p,_,!t);for(let R=0;R=0,l=` + glFragCoord_ = gl_FragCoord; + if (yFactor_ == 1.) { + glFragCoord_.y = textureOutputHeight_ - glFragCoord_.y; + } + `,h=c?`vec4 glFragCoord_; +`:"",d=e.search(/layout *\(location *= *0\) *out/g)!==-1;if(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod("),e=e.replace(/textureCubeLodEXT\s*\(/g,"textureLod("),e=e.replace(/textureCube\s*\(/g,"texture("),e=e.replace(/gl_FragDepthEXT/g,"gl_FragDepth"),e=e.replace(/gl_FragColor/g,"glFragColor"),e=e.replace(/gl_FragData/g,"glFragData"),e=e.replace(/gl_FragCoord/g,"glFragCoord_"),!this._fragmentIsGLES3)e=e.replace(/void\s+?main\s*\(/g,(o||d?"":`layout(location = 0) out vec4 glFragColor; +`)+"void main(");else{const p=/^\s*out\s+\S+\s+\S+\s*;/gm.exec(e);p!==null&&(e=e.substring(0,p.index)+"layout(location = 0) "+e.substring(p.index))}e=e.replace(/dFdy/g,"(-yFactor_)*dFdy"),e=e.replace("##INJECTCODE##",h),c&&(e=pe(e,"void main",l))}else if("VERTEXOUTPUT_INVARIANT"in a&&(e=`invariant gl_Position; +`+e),e=e.replace(/gl_InstanceID/g,"gl_InstanceIndex"),e=e.replace(/gl_VertexID/g,"gl_VertexIndex"),t.indexOf("#define MULTIVIEW")!==-1)return`#extension GL_OVR_multiview2 : require +layout (num_views = 2) in; +`+e;if(!r){const c=e.lastIndexOf("}");e=e.substring(0,c),e+=`gl_Position.y *= yFactor_; +`,e+="}"}return e}_applyTextureArrayProcessing(e,t){const r=new RegExp(t+"\\s*\\[(.+)?\\]","gm");let n=r.exec(e);for(;n!==null;){const i=n[1];let a=+i;this._preProcessors&&isNaN(a)&&(a=+this._preProcessors[i.trim()]),e=e.replace(n[0],t+a),n=r.exec(e)}return e}_generateLeftOverUBOCode(e,t){let r=`layout(set = ${t.binding.groupIndex}, binding = ${t.binding.bindingIndex}) uniform ${e} { + `;for(const n of this._webgpuProcessingContext.leftOverUniforms)n.length>0?r+=` ${n.type} ${n.name}[${n.length}]; +`:r+=` ${n.type} ${n.name}; +`;return r+=`}; + +`,r}finalizeShaders(e,t){for(let n=0;n0&&(t=i+` +`+t)}const r=this._buildLeftOverUBO();return e=r+e,t=r+t,this._collectBindingNames(),this._preCreateBindGroupEntries(),this._preProcessors=null,this._webgpuProcessingContext.vertexBufferKindToNumberOfComponents={},{vertexCode:e,fragmentCode:t}}}const _t="fragmentOutputs.fragDepth",ur="uniforms",cr="internals",lr={texture_1d:"1d",texture_2d:"2d",texture_2d_array:"2d-array",texture_3d:"3d",texture_cube:"cube",texture_cube_array:"cube-array",texture_multisampled_2d:"2d",texture_depth_2d:"2d",texture_depth_2d_array:"2d-array",texture_depth_cube:"cube",texture_depth_cube_array:"cube-array",texture_depth_multisampled_2d:"2d",texture_storage_1d:"1d",texture_storage_2d:"2d",texture_storage_2d_array:"2d-array",texture_storage_3d:"3d",texture_external:null};class hr extends P{constructor(){super(...arguments),this.shaderLanguage=1,this.uniformRegexp=/uniform\s+(\w+)\s*:\s*(.+)\s*;/,this.textureRegexp=/var\s+(\w+)\s*:\s*((array<\s*)?(texture_\w+)\s*(<\s*(.+)\s*>)?\s*(,\s*\w+\s*>\s*)?);/,this.noPrecision=!0,this.pureMode=!1}_getArraySize(e,t,r){let n=0;const i=t.lastIndexOf(">");if(t.indexOf("array")>=0&&i>0){let a=i;for(;a>0&&t.charAt(a)!==" "&&t.charAt(a)!==",";)a--;const o=t.substring(a+1,i);for(n=+o,isNaN(n)&&(n=+r[o.trim()]);a>0&&(t.charAt(a)===" "||t.charAt(a)===",");)a--;t=t.substring(t.indexOf("<")+1,a+1)}return[e,t,n]}initializeShaders(e){this._webgpuProcessingContext=e,this._attributesInputWGSL=[],this._attributesWGSL=[],this._attributesConversionCodeWGSL=[],this._hasNonFloatAttribute=!1,this._varyingsWGSL=[],this._varyingNamesWGSL=[],this._stridedUniformArrays=[]}preProcessShaderCode(e){const t=this.pureMode?"":`struct ${P.InternalsUBOName} { + yFactor_: f32, + textureOutputHeight_: f32, +}; +var ${cr} : ${P.InternalsUBOName}; +`;return e.indexOf(t)!==-1?e:t+fe(e)}varyingCheck(e){return/(flat|linear|perspective)?\s*(center|centroid|sample)?\s*\bvarying\b/.test(e)}varyingProcessor(e,t,r){const i=/\s*(flat|linear|perspective)?\s*(center|centroid|sample)?\s*varying\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s*:\s*(.+)\s*;/gm.exec(e);if(i!==null){const a=i[1]??"perspective",o=i[2]??"center",u=i[4],c=i[3],l=a==="flat"?`@interpolate(${a})`:`@interpolate(${a}, ${o})`;let h;t?(h=this._webgpuProcessingContext.availableVaryings[c],h===void 0&&S.Warn(`Invalid fragment shader: The varying named "${c}" is not declared in the vertex shader! This declaration will be ignored.`)):(h=this._webgpuProcessingContext.getVaryingNextLocation(u,this._getArraySize(c,u,r)[2]),this._webgpuProcessingContext.availableVaryings[c]=h,this._varyingsWGSL.push(` @location(${h}) ${l} ${c} : ${u},`),this._varyingNamesWGSL.push(c)),e=""}return e}attributeProcessor(e,t){const n=/\s*attribute\s+(\S+)\s*:\s*(.+)\s*;/gm.exec(e);if(n!==null){const i=n[2],a=n[1],o=this._webgpuProcessingContext.getAttributeNextLocation(i,this._getArraySize(a,i,t)[2]);this._webgpuProcessingContext.availableAttributes[a]=o,this._webgpuProcessingContext.orderedAttributes[o]=a;const u=this._webgpuProcessingContext.vertexBufferKindToNumberOfComponents[a];if(u!==void 0){const c=u<0?u===-1?"i32":"vec"+-u+"":u===1?"u32":"vec"+u+"",l=`_int_${a}_`;this._attributesInputWGSL.push(`@location(${o}) ${l} : ${c},`),this._attributesWGSL.push(`${a} : ${i},`),this._attributesConversionCodeWGSL.push(`vertexInputs.${a} = ${i}(vertexInputs_.${l});`),this._hasNonFloatAttribute=!0}else this._attributesInputWGSL.push(`@location(${o}) ${a} : ${i},`),this._attributesWGSL.push(`${a} : ${i},`),this._attributesConversionCodeWGSL.push(`vertexInputs.${a} = vertexInputs_.${a};`);e=""}return e}uniformProcessor(e,t,r){const n=this.uniformRegexp.exec(e);if(n!==null){const i=n[2],a=n[1];this._addUniformToLeftOverUBO(a,i,r),e=""}return e}textureProcessor(e,t,r){const n=this.textureRegexp.exec(e);if(n!==null){const i=n[1],a=n[2],o=!!n[3],u=n[4],c=u.indexOf("storage")>0,l=n[6],h=c?l.substring(0,l.indexOf(",")).trim():null;let d=o?this._getArraySize(i,a,r)[2]:0,p=this._webgpuProcessingContext.availableTextures[i];if(p)d=p.textures.length;else{p={isTextureArray:d>0,isStorageTexture:c,textures:[],sampleType:"float"},d=d||1;for(let m=0;m0,g=lr[u],f=_?"depth":l==="u32"?"uint":l==="i32"?"sint":"float";if(p.sampleType=f,g===void 0)throw`Can't get the texture dimension corresponding to the texture function "${u}"!`;for(let m=0;mc.length-l.length>0?-1:c.length===l.length?0:1);for(const c of u){const l=e.indexOf("#define "+c);let h=e.indexOf(` +`,l);h===-1&&(h=e.length);const d=e.substring(l+8+c.length+1,h);e=e.replace(new RegExp(c,"g"),d)}return e=this._convertDefinesToConst(a)+e,"VERTEXOUTPUT_INVARIANT"in a&&(e=`#define VERTEXOUTPUT_INVARIANT +`+e),e}finalizeShaders(e,t){const r=[],n=t.indexOf("fragmentInputs.position")>=0&&!this.pureMode?` + if (internals.yFactor_ == 1.) { + fragmentInputs.position.y = internals.textureOutputHeight_ - fragmentInputs.position.y; + } + `:"";e=this._processSamplers(e,!0),t=this._processSamplers(t,!1),e=this._processCustomBuffers(e,!0),t=this._processCustomBuffers(t,!1);const i=this._buildLeftOverUBO();e=i+e,t=i+t,e=e.replace(/#define /g,"//#define "),e=this._processStridedUniformArrays(e);let a=`struct VertexInputs { + @builtin(vertex_index) vertexIndex : u32, + @builtin(instance_index) instanceIndex : u32, +`;this._attributesInputWGSL.length>0&&(a+=this._attributesInputWGSL.join(` +`)),a+=` +}; +var vertexInputs`+(this._hasNonFloatAttribute?"_":"")+` : VertexInputs; +`,this._hasNonFloatAttribute&&(a+=`struct VertexInputs_ { + vertexIndex : u32, instanceIndex : u32, +`,a+=this._attributesWGSL.join(` +`),a+=` +}; +var vertexInputs : VertexInputs_; +`);let o=`struct FragmentInputs { + @builtin(position)`+(e.indexOf("#define VERTEXOUTPUT_INVARIANT")>=0?" @invariant":"")+` position : vec4, +`;this._varyingsWGSL.length>0&&(o+=this._varyingsWGSL.join(` +`)),o+=` +}; +var vertexOutputs : FragmentInputs; +`,e=a+o+e;let u=` + vertexInputs${this._hasNonFloatAttribute?"_":""} = input; +`;this._hasNonFloatAttribute&&(u+=`vertexInputs.vertexIndex = vertexInputs_.vertexIndex; +vertexInputs.instanceIndex = vertexInputs_.instanceIndex; +`,u+=this._attributesConversionCodeWGSL.join(` +`),u+=` +`);const c=this.pureMode?" return vertexOutputs;":` vertexOutputs.position.y = vertexOutputs.position.y * internals.yFactor_; + return vertexOutputs;`;let l=e.indexOf("#define DISABLE_UNIFORMITY_ANALYSIS")!==-1;e=(l?`diagnostic(off, derivative_uniformity); +`:"")+`diagnostic(off, chromium.unreachable_code); +`+pe(e,"fn main",u,c),t=t.replace(/#define /g,"//#define "),t=this._processStridedUniformArrays(t),this.pureMode||(t=t.replace(/dpdy/g,"(-internals.yFactor_)*dpdy"));let h=`struct FragmentInputs { + @builtin(position) position : vec4, + @builtin(front_facing) frontFacing : bool, +`;this._varyingsWGSL.length>0&&(h+=this._varyingsWGSL.join(` +`)),h+=` +}; +var fragmentInputs : FragmentInputs; +`;let d=`struct FragmentOutputs { +`;const p="fragmentOutputs\\.fragData";let _=t.match(new RegExp(p+"0","g")),g=0;if(_){d+=` @location(${g}) fragData0 : vec4, +`,g++;for(let y=1;y<8;y++)_=t.match(new RegExp(p+y,"g")),_&&(d+=` @location(${g}) fragData${g} : vec4, +`,g++);t.indexOf("MRT_AND_COLOR")!==-1&&(d+=` @location(${g}) color : vec4, +`,g++)}const f=/oitDepthSampler/;_=t.match(f),_&&(d+=` @location(${g++}) depth : vec2, +`,d+=` @location(${g++}) frontColor : vec4, +`,d+=` @location(${g++}) backColor : vec4, +`),g===0&&(t.indexOf("DUAL_SOURCE_BLENDING")!==-1?(r.push("dual_source_blending"),d+=` @location(0) @blend_src(0) color : vec4, +`,d+=` @location(0) @blend_src(1) color2 : vec4, +`):d+=` @location(0) color : vec4, +`,g++);let m=!1,b=0;for(;!m&&(b=t.indexOf(_t,b),!(b<0));){const y=b;for(m=!0;b>1&&t.charAt(b)!==` +`;){if(t.charAt(b)==="/"&&t.charAt(b-1)==="/"){m=!1;break}b--}b=y+_t.length}m&&(d+=` @builtin(frag_depth) fragDepth: f32, +`),d+=`}; +var fragmentOutputs : FragmentOutputs; +`,t=h+d+t;const x=` fragmentInputs = input; + `+n,B=" return fragmentOutputs;";return l=t.indexOf("#define DISABLE_UNIFORMITY_ANALYSIS")!==-1,r.length>0&&(t="enable "+r.join(`; +enable `)+`; +`+t),t=(l?`diagnostic(off, derivative_uniformity); +`:"")+`diagnostic(off, chromium.unreachable_code); +`+pe(t,"fn main",x,B),this._collectBindingNames(),this._preCreateBindGroupEntries(),this._webgpuProcessingContext.vertexBufferKindToNumberOfComponents={},{vertexCode:e,fragmentCode:t}}_generateLeftOverUBOCode(e,t){let r="",n=`struct ${e} { +`;for(const i of this._webgpuProcessingContext.leftOverUniforms){const a=i.type.replace(/^(.*?)(<.*>)?$/,"$1"),o=P.UniformSizes[a];if(i.length>0)if(o<=2){const u=`${e}_${this._stridedUniformArrays.length}_strided_arr`;r+=`struct ${u} { + @size(16) + el: ${a}, + }`,this._stridedUniformArrays.push(i.name),n+=` @align(16) ${i.name} : array<${u}, ${i.length}>, +`}else n+=` ${i.name} : array<${i.type}, ${i.length}>, +`;else n+=` ${i.name} : ${i.type}, +`}return n+=`}; +`,n=`${r} +${n}`,n+=`@group(${t.binding.groupIndex}) @binding(${t.binding.bindingIndex}) var ${ur} : ${e}; +`,n}_processSamplers(e,t){const r=/var\s+(\w+Sampler)\s*:\s*(sampler|sampler_comparison)\s*;/gm;for(;;){const n=r.exec(e);if(n===null)break;const i=n[1],a=n[2],o=i.length-7,u=i.lastIndexOf("Sampler")===o?i.substring(0,o):null,c=a==="sampler_comparison"?"comparison":"filtering";if(u){const _=this._webgpuProcessingContext.availableTextures[u];_&&(_.autoBindSampler=!0)}let l=this._webgpuProcessingContext.availableSamplers[i];l||(l={binding:this._webgpuProcessingContext.getNextFreeUBOBinding(),type:c},this._webgpuProcessingContext.availableSamplers[i]=l),this._addSamplerBindingDescription(i,l,t);const h=e.substring(0,n.index),d=`@group(${l.binding.groupIndex}) @binding(${l.binding.bindingIndex}) `,p=e.substring(n.index);e=h+d+p,r.lastIndex+=d.length}return e}_processCustomBuffers(e,t){const r=/var<\s*(uniform|storage)\s*(,\s*(read|read_write)\s*)?>\s+(\S+)\s*:\s*(\S+)\s*;/gm;for(;;){const n=r.exec(e);if(n===null)break;const i=n[1],a=n[3];let o=n[4];const u=n[5];let c=this._webgpuProcessingContext.availableBuffers[o];if(!c){const g=i==="uniform"?O.KnownUBOs[u]:null;let f;g?(o=u,f=g.binding,f.groupIndex===-1&&(f=this._webgpuProcessingContext.availableBuffers[o]?.binding,f||(f=this._webgpuProcessingContext.getNextFreeUBOBinding()))):f=this._webgpuProcessingContext.getNextFreeUBOBinding(),c={binding:f},this._webgpuProcessingContext.availableBuffers[o]=c}this._addBufferBindingDescription(o,this._webgpuProcessingContext.availableBuffers[o],a==="read_write"?"storage":i==="storage"?"read-only-storage":"uniform",t);const l=c.binding.groupIndex,h=c.binding.bindingIndex,d=e.substring(0,n.index),p=`@group(${l}) @binding(${h}) `,_=e.substring(n.index);e=d+p+_,r.lastIndex+=p.length}return e}_processStridedUniformArrays(e){for(const t of this._stridedUniformArrays)e=e.replace(new RegExp(`${t}\\s*\\[(.*?)\\]`,"g"),`${t}[$1].el`);return e}}class se{get underlyingResource(){return this._webgpuTexture}getMSAATexture(e,t=0){return this._webgpuMSAATexture[t]||this._createMSAATexture(e,t),this._webgpuMSAATexture[t]}releaseMSAATextures(){for(const e of this._webgpuMSAATexture)e&&this._engine._textureHelper.releaseTexture(e);this._webgpuMSAATexture.length=0}constructor(e,t=null){this._engine=e,this._originalFormatIsRGB=!1,this.format="rgba8unorm",this.originalFormat="rgba8unorm",this.textureUsages=0,this.textureAdditionalUsages=0,this._webgpuTexture=t,this._webgpuMSAATexture=[],this.view=null,this.viewForWriting=null}set(e){this._webgpuTexture=e}setUsage(e,t,r,n,i,a,o,u){let c="2d",l=1;n?(c=r?"cube-array":"cube",l=6*(u||1)):i?(c="3d",l=1):r&&(c="2d-array",l=u);const h=I.GetDepthFormatOnly(this.format),d=I.HasDepthAndStencilAspects(this.format)?"depth-only":"all";this.createView({label:`TextureView${i?"3D":n?"Cube":"2D"}${r?"_Array"+l:""}_${a}x${o}_${t?"wmips":"womips"}_${this.format}_${c}`,format:h,dimension:c,mipLevelCount:t?It(Math.max(a,o))+1:1,baseArrayLayer:0,baseMipLevel:0,arrayLayerCount:l,aspect:d})}createView(e,t=!1){if(this.view=this._webgpuTexture.createView(e),t&&e){const r=e.mipLevelCount;e.mipLevelCount=1,this.viewForWriting=this._webgpuTexture.createView(e),e.mipLevelCount=r}}reset(){this._webgpuTexture=null,this._webgpuMSAATexture.length=0,this.view=null,this.viewForWriting=null}release(){this._webgpuTexture?.destroy(),this.releaseMSAATextures(),this._copyInvertYTempTexture?.destroy(),this.reset()}_createMSAATexture(e,t){if(!this._webgpuTexture)throw new Error("Cannot create GPU MSAA texture because underlying GPU texture is not created yet.");this._webgpuMSAATexture||(this._webgpuMSAATexture=[]),this._webgpuMSAATexture[t]=this._engine._textureHelper.createMSAATexture(this._webgpuTexture,this.originalFormat,e)}}const dr=` + const pos = array, 4>( vec2f(-1.0f, 1.0f), vec2f(1.0f, 1.0f), vec2f(-1.0f, -1.0f), vec2f(1.0f, -1.0f)); + const tex = array, 4>( vec2f(0.0f, 0.0f), vec2f(1.0f, 0.0f), vec2f(0.0f, 1.0f), vec2f(1.0f, 1.0f)); + + varying vTex: vec2f; + + @vertex + fn main(input : VertexInputs) -> FragmentInputs { + vertexOutputs.vTex = tex[input.vertexIndex]; + vertexOutputs.position = vec4f(pos[input.vertexIndex], 0.0, 1.0); + } + `,fr=` + var imgSampler: sampler; + var img: texture_2d; + + varying vTex: vec2f; + + @fragment + fn main(input: FragmentInputs) -> FragmentOutputs { + fragmentOutputs.color = textureSample(img, imgSampler, input.vTex); + } + `,vt=` + const pos = array, 4>( vec2f(-1.0f, 1.0f), vec2f(1.0f, 1.0f), vec2f(-1.0f, -1.0f), vec2f(1.0f, -1.0f)); + const tex = array, 4>( vec2f(0.0f, 0.0f), vec2f(1.0f, 0.0f), vec2f(0.0f, 1.0f), vec2f(1.0f, 1.0f)); + + var img: texture_2d; + + #ifdef INVERTY + varying vTextureSize: vec2f; + #endif + + @vertex + fn main(input : VertexInputs) -> FragmentInputs { + #ifdef INVERTY + vertexOutputs.vTextureSize = vec2f(textureDimensions(img, 0)); + #endif + vertexOutputs.position = vec4f(pos[input.vertexIndex], 0.0, 1.0); + } + `,pr=` + var img: texture_2d; + + #ifdef INVERTY + varying vTextureSize: vec2f; + #endif + + @fragment + fn main(input: FragmentInputs) -> FragmentOutputs { + #ifdef INVERTY + var color: vec4f = textureLoad(img, vec2i(i32(input.position.x), i32(input.vTextureSize.y - input.position.y)), 0); + #else + var color: vec4f = textureLoad(img, vec2i(input.position.xy), 0); + #endif + #ifdef PREMULTIPLYALPHA + color = vec4f(color.rgb * color.a, color.a); + #endif + fragmentOutputs.color = color; + } + `,gr=vt,_r=` + var img: texture_2d; + uniform ofstX: f32; + uniform ofstY: f32; + uniform width: f32; + uniform height: f32; + + #ifdef INVERTY + varying vTextureSize: vec2f; + #endif + + @fragment + fn main(input: FragmentInputs) -> FragmentOutputs { + if (input.position.x < uniforms.ofstX || input.position.x >= uniforms.ofstX + uniforms.width) { + discard; + } + if (input.position.y < uniforms.ofstY || input.position.y >= uniforms.ofstY + uniforms.height) { + discard; + } + #ifdef INVERTY + var color: vec4f = textureLoad(img, vec2i(i32(input.position.x), i32(uniforms.ofstY + uniforms.height - (input.position.y - uniforms.ofstY))), 0); + #else + var color: vec4f = textureLoad(img, vec2i(input.position.xy), 0); + #endif + #ifdef PREMULTIPLYALPHA + color = vec4f(color.rgb * color.a, color.a); + #endif + fragmentOutputs.color = color; + } + `,mr=` + const pos = array, 4>( vec2f(-1.0f, 1.0f), vec2f(1.0f, 1.0f), vec2f(-1.0f, -1.0f), vec2f(1.0f, -1.0f)); + + @vertex + fn main(input : VertexInputs) -> FragmentInputs { + vertexOutputs.position = vec4f(pos[input.vertexIndex], 0.0, 1.0); + } + `,br=` + uniform color: vec4f; + + @fragment + fn main(input: FragmentInputs) -> FragmentOutputs { + fragmentOutputs.color = uniforms.color; + } + `,xr=` + struct VertexOutput { + @builtin(position) Position : vec4, + @location(0) fragUV : vec2 + } + + @vertex + fn main( + @builtin(vertex_index) VertexIndex : u32 + ) -> VertexOutput { + var pos = array, 4>( + vec2(-1.0, 1.0), + vec2( 1.0, 1.0), + vec2(-1.0, -1.0), + vec2( 1.0, -1.0) + ); + var tex = array, 4>( + vec2(0.0, 0.0), + vec2(1.0, 0.0), + vec2(0.0, 1.0), + vec2(1.0, 1.0) + ); + + var output: VertexOutput; + + output.Position = vec4(pos[VertexIndex], 0.0, 1.0); + output.fragUV = tex[VertexIndex]; + + return output; + } + `,yr=` + @group(0) @binding(0) var videoSampler: sampler; + @group(0) @binding(1) var videoTexture: texture_external; + + @fragment + fn main( + @location(0) fragUV: vec2 + ) -> @location(0) vec4 { + return textureSampleBaseClampToEdge(videoTexture, videoSampler, fragUV); + } + `,Sr=` + @group(0) @binding(0) var videoSampler: sampler; + @group(0) @binding(1) var videoTexture: texture_external; + + @fragment + fn main( + @location(0) fragUV: vec2 + ) -> @location(0) vec4 { + return textureSampleBaseClampToEdge(videoTexture, videoSampler, vec2(fragUV.x, 1.0 - fragUV.y)); + } + `,wr=` + const pos = array, 4>( vec2f(-1.0f, 1.0f), vec2f(1.0f, 1.0f), vec2f(-1.0f, -1.0f), vec2f(1.0f, -1.0f)); + + @vertex + fn main(input : VertexInputs) -> FragmentInputs { + vertexOutputs.position = vec4f(pos[input.vertexIndex], 0.0, 1.0); + } + `,Ir=` + var msaaDepthTexture: texture_depth_multisampled_2d; + + @fragment + fn main(input: FragmentInputs) -> FragmentOutputs { + #ifdef USE_MIN + let numSamples = textureNumSamples(msaaDepthTexture); + var depth = 1.0; + + for (var i = 0u; i < numSamples; i = i + 1u) { + depth = min(depth, textureLoad(msaaDepthTexture, vec2u(input.position.xy), i)); + } + + fragmentOutputs.color = vec4f(depth); + #else + fragmentOutputs.color = vec4f(textureLoad(msaaDepthTexture, vec2u(input.position.xy), 0)); // do like WebGL, take the first sample + #endif + } + `;var U;(function(s){s[s.MipMap=0]="MipMap",s[s.InvertYPremultiplyAlpha=1]="InvertYPremultiplyAlpha",s[s.Clear=2]="Clear",s[s.InvertYPremultiplyAlphaWithOfst=3]="InvertYPremultiplyAlphaWithOfst",s[s.ResolveDepth=4]="ResolveDepth"})(U||(U={}));var j;(function(s){s[s.DontInvertY=0]="DontInvertY",s[s.InvertY=1]="InvertY"})(j||(j={}));const mt=[{vertex:dr,fragment:fr},{vertex:vt,fragment:pr},{vertex:mr,fragment:br},{vertex:gr,fragment:_r},{vertex:wr,fragment:Ir}],W={"":0,r8unorm:1,r8uint:2,r8sint:3,r16uint:4,r16sint:5,r16float:6,rg8unorm:7,rg8uint:8,rg8sint:9,r32uint:10,r32sint:11,r32float:12,rg16uint:13,rg16sint:14,rg16float:15,rgba8unorm:16,"rgba8unorm-srgb":17,rgba8uint:18,rgba8sint:19,bgra8unorm:20,"bgra8unorm-srgb":21,rgb10a2uint:22,rgb10a2unorm:23,rg32uint:24,rg32sint:25,rg32float:26,rgba16uint:27,rgba16sint:28,rgba16float:29,rgba32uint:30,rgba32sint:31,rgba32float:32,stencil8:33,depth16unorm:34,depth24plus:35,"depth24plus-stencil8":36,depth32float:37,"depth32float-stencil8":38,r16unorm:39,rg16unorm:40,rgba16unorm:41,r16snorm:42,rg16snorm:43,rgba16snorm:44};class Cr{constructor(e,t,r,n){if(this._pipelines={},this._compiledShaders=[],this._videoPipelines={},this._videoCompiledShaders=[],this._deferredReleaseTextures=[],this._engine=e,this._device=t,this._bufferManager=r,n.indexOf("rg11b10ufloat-renderable")!==-1){const i=Object.keys(W);W.rg11b10ufloat=W[i[i.length-1]]+1}this._mipmapSampler=t.createSampler({minFilter:"linear"}),this._videoSampler=t.createSampler({minFilter:"linear"}),this._ubCopyWithOfst=this._bufferManager.createBuffer(16,C.Uniform|C.CopyDst,"UBCopyWithOffset").underlyingResource,this._getPipeline("rgba8unorm"),this._getVideoPipeline("rgba8unorm")}_getPipeline(e,t=U.MipMap,r){const n=t===U.MipMap?1:t===U.InvertYPremultiplyAlpha?((r.invertY?1:0)<<1)+((r.premultiplyAlpha?1:0)<<2):t===U.Clear?8:t===U.InvertYPremultiplyAlphaWithOfst?((r.invertY?1:0)<<4)+((r.premultiplyAlpha?1:0)<<5):t===U.ResolveDepth?64:0;this._pipelines[e]||(this._pipelines[e]=[]);let i=this._pipelines[e][n];if(!i){let a="";(t===U.InvertYPremultiplyAlpha||t===U.InvertYPremultiplyAlphaWithOfst)&&(r.invertY&&(a+=`#define INVERTY +`),r.premultiplyAlpha&&(a+=`#define PREMULTIPLYALPHA +`));let o=this._compiledShaders[n];if(!o){let c=mt[t].vertex,l=mt[t].fragment;const h={defines:a.split(` +`),indexParameters:null,isFragment:!1,shouldUseHighPrecisionShader:!0,processor:this._engine._getShaderProcessor(1),supportsUniformBuffers:!0,shadersRepository:"",includesShadersStore:{},version:(this._engine.version*100).toString(),platformName:this._engine.shaderPlatformName,processingContext:this._engine._getShaderProcessingContext(1,!0),isNDCHalfZRange:this._engine.isNDCHalfZRange,useReverseDepthBuffer:this._engine.useReverseDepthBuffer};At(h),h.processor.pureMode=!0,Te(c,h,g=>{c=g},this._engine),h.isFragment=!0,Te(l,h,g=>{l=g},this._engine);const d=Mt(c,l,h);h.processor.pureMode=!1;const p=this._device.createShaderModule({label:`BabylonWebGPUDevice${this._engine.uniqueId}_InternalVertexShader_${n}`,code:d.vertexCode}),_=this._device.createShaderModule({label:`BabylonWebGPUDevice${this._engine.uniqueId}_InternalFragmentShader_${n}`,code:d.fragmentCode});o=this._compiledShaders[n]=[p,_]}const u=this._device.createRenderPipeline({label:`BabylonWebGPUDevice${this._engine.uniqueId}_InternalPipeline_${e}_${n}`,layout:"auto",vertex:{module:o[0],entryPoint:"main"},fragment:{module:o[1],entryPoint:"main",targets:[{format:e}]},primitive:{topology:"triangle-strip",stripIndexFormat:"uint16"}});i=this._pipelines[e][n]=[u,u.getBindGroupLayout(0)]}return i}_getVideoPipeline(e,t=j.DontInvertY){const r=t===j.InvertY?1:0;this._videoPipelines[e]||(this._videoPipelines[e]=[]);let n=this._videoPipelines[e][r];if(!n){let i=this._videoCompiledShaders[r];if(!i){const o=this._device.createShaderModule({code:xr,label:`BabylonWebGPUDevice${this._engine.uniqueId}_CopyVideoToTexture_VertexShader`}),u=this._device.createShaderModule({code:r===0?yr:Sr,label:`BabylonWebGPUDevice${this._engine.uniqueId}_CopyVideoToTexture_FragmentShader_${r===0?"DontInvertY":"InvertY"}`});i=this._videoCompiledShaders[r]=[o,u]}const a=this._device.createRenderPipeline({label:`BabylonWebGPUDevice${this._engine.uniqueId}_InternalVideoPipeline_${e}_${r===0?"DontInvertY":"InvertY"}`,layout:"auto",vertex:{module:i[0],entryPoint:"main"},fragment:{module:i[1],entryPoint:"main",targets:[{format:e}]},primitive:{topology:"triangle-strip",stripIndexFormat:"uint16"}});n=this._videoPipelines[e][r]=[a,a.getBindGroupLayout(0)]}return n}setCommandEncoder(e){this._commandEncoderForCreation=e}copyVideoToTexture(e,t,r,n=!1,i){const a=i===void 0,[o,u]=this._getVideoPipeline(r,n?j.InvertY:j.DontInvertY);a&&(i=this._device.createCommandEncoder({})),i.pushDebugGroup(`copy video to texture (invertY=${n})`);const c=t._hardwareTexture,l={label:`BabylonWebGPUDevice${this._engine.uniqueId}_copyVideoToTexture_${r}_${n?"InvertY":"DontInvertY"}${t.label?"_"+t.label:""}`,colorAttachments:[{view:c.underlyingResource.createView({format:r,dimension:"2d",mipLevelCount:1,baseArrayLayer:0,baseMipLevel:0,arrayLayerCount:1,aspect:"all"}),loadOp:"load",storeOp:"store"}]},h=i.beginRenderPass(l),d={layout:u,entries:[{binding:0,resource:this._videoSampler},{binding:1,resource:this._device.importExternalTexture({source:e.underlyingResource})}]},p=this._device.createBindGroup(d);h.setPipeline(o),h.setBindGroup(0,p),h.draw(4,1,0,0),h.end(),i.popDebugGroup(),a&&(this._device.queue.submit([i.finish()]),i=null)}invertYPreMultiplyAlpha(e,t,r,n,i=!1,a=!1,o=0,u=0,c=1,l=0,h=0,d=0,p=0,_,g){const f=d!==0,m=_===void 0,[b,x]=this._getPipeline(n,f?U.InvertYPremultiplyAlphaWithOfst:U.InvertYPremultiplyAlpha,{invertY:i,premultiplyAlpha:a});o=Math.max(o,0),m&&(_=this._device.createCommandEncoder({}));let B;if(I.IsHardwareTexture(e)?(B=e.underlyingResource,i&&!a&&c===1&&o===0||(e=void 0)):(B=e,e=void 0),!B)return;_.pushDebugGroup(`internal process texture "${B.label}" (invertY=${i} premultiplyAlpha=${a})`),f&&this._bufferManager.setRawData(this._ubCopyWithOfst,0,new Float32Array([l,h,d,p]),0,16);const y=e,M=y?._copyInvertYTempTexture??this.createTexture({width:t,height:r,layers:1},!1,!1,!1,!1,!1,n,1,_,21,void 0,"TempTextureForCopyWithInvertY"),R=y?._copyInvertYRenderPassDescr??{label:`BabylonWebGPUDevice${this._engine.uniqueId}_invertYPreMultiplyAlpha_${n}_${i?"InvertY":"DontInvertY"}_${a?"PremultiplyAlpha":"DontPremultiplyAlpha"}`,colorAttachments:[{view:M.createView({format:n,dimension:"2d",baseMipLevel:0,mipLevelCount:1,arrayLayerCount:1,baseArrayLayer:0}),loadOp:"load",storeOp:"store"}]},v=_.beginRenderPass(R);let L=f?y?._copyInvertYBindGroupWithOfst:y?._copyInvertYBindGroup;if(!L){const G={layout:x,entries:[{binding:0,resource:B.createView({format:n,dimension:"2d",baseMipLevel:u,mipLevelCount:1,arrayLayerCount:c,baseArrayLayer:o})}]};f&&G.entries.push({binding:1,resource:{buffer:this._ubCopyWithOfst}}),L=this._device.createBindGroup(G)}v.setPipeline(b),v.setBindGroup(0,L),v.draw(4,1,0,0),v.end(),_.copyTextureToTexture({texture:M},{texture:B,mipLevel:u,origin:{x:0,y:0,z:o}},{width:d||t,height:p||r,depthOrArrayLayers:1}),y?(y._copyInvertYTempTexture=M,y._copyInvertYRenderPassDescr=R,f?y._copyInvertYBindGroupWithOfst=L:y._copyInvertYBindGroup=L):this._deferredReleaseTextures.push([M,null]),_.popDebugGroup(),m&&(this._device.queue.submit([_.finish()]),_=null)}createTexture(e,t=!1,r=!1,n=!1,i=!1,a=!1,o="rgba8unorm",u=1,c,l=-1,h=0,d){u=I.GetSample(u);const p=e.layers||1,_={width:e.width,height:e.height,depthOrArrayLayers:p},g=W[o]?16:0,f=I.IsCompressedFormat(o),m=t?I.ComputeNumMipmapLevels(e.width,e.height):1,b=l>=0?l:7;h|=t&&!f?1|g:0,!f&&!a&&(h|=g|2);const x=this._device.createTexture({label:`BabylonWebGPUDevice${this._engine.uniqueId}_Texture${a?"3D":"2D"}_${d?d+"_":""}${_.width}x${_.height}x${_.depthOrArrayLayers}_${t?"wmips":"womips"}_${o}_samples${u}`,size:_,dimension:a?"3d":"2d",format:o,usage:b|h,sampleCount:u,mipLevelCount:m});return I.IsImageBitmap(e)&&(this.updateTexture(e,x,e.width,e.height,p,o,0,0,n,i,0,0),t&&r&&this.generateMipmaps(x,m,0,c)),x}createCubeTexture(e,t=!1,r=!1,n=!1,i=!1,a="rgba8unorm",o=1,u,c=-1,l=0,h){o=I.GetSample(o);const d=I.IsImageBitmapArray(e)?e[0].width:e.width,p=I.IsImageBitmapArray(e)?e[0].height:e.height,_=I.IsImageBitmapArray(e)?1:e.layers,g=W[a]?16:0,f=I.IsCompressedFormat(a),m=t?I.ComputeNumMipmapLevels(d,p):1,b=c>=0?c:7;l|=t&&!f?1|g:0,f||(l|=g|2);const x=this._device.createTexture({label:`BabylonWebGPUDevice${this._engine.uniqueId}_TextureCube_${h?h+"_":""}${d}x${p}x${_}_${t?"wmips":"womips"}_${a}_samples${o}`,size:{width:d,height:p,depthOrArrayLayers:6*_},dimension:"2d",format:a,usage:b|l,sampleCount:o,mipLevelCount:m});return I.IsImageBitmapArray(e)&&(this.updateCubeTextures(e,x,d,p,a,n,i,0,0),t&&r&&this.generateCubeMipmaps(x,m,u)),x}generateCubeMipmaps(e,t,r){const n=r===void 0,i=I.IsHardwareTexture(e)?e.underlyingResource:e;n&&(r=this._device.createCommandEncoder({})),r.pushDebugGroup(`create cube mipmaps for "${i.label}" (${t} levels)`);for(let a=0;a1)switch(a.format){case"depth16unorm":a.format="r16unorm";break;case"depth24plus":case"depth24plus-stencil8":case"depth32float":case"depth32float-stencil8":a.format="r32float";break}a.textureUsages=e._source===5||e.source===6?21:e._source===12?20:-1,a.textureAdditionalUsages=o?8:0;const u=e.generateMipMaps,c=n||1;let l;if(e._maxLodLevel!==null?l=e._maxLodLevel:l=u?I.ComputeNumMipmapLevels(t,r):1,e.isCube){const h=this.createCubeTexture({width:t,height:r,layers:c},e.generateMipMaps,e.generateMipMaps,e.invertY,!1,a.format,1,this._commandEncoderForCreation,a.textureUsages,a.textureAdditionalUsages,e.label);a.set(h);const d=I.GetDepthFormatOnly(a.format),p=I.HasDepthAndStencilAspects(a.format)?"depth-only":"all",_=e.is2DArray?"cube-array":"cube";a.createView({label:`BabylonWebGPUDevice${this._engine.uniqueId}_TextureViewCube${e.is2DArray?"_Array"+c:""}_${t}x${r}_${u?"wmips":"womips"}_${d}_${_}_${p}_${e.label??"noname"}`,format:d,dimension:_,mipLevelCount:l,baseArrayLayer:0,baseMipLevel:0,arrayLayerCount:6*c,aspect:p},o)}else{const h=this.createTexture({width:t,height:r,layers:c},e.generateMipMaps,e.generateMipMaps,e.invertY,!1,e.is3D,a.format,1,this._commandEncoderForCreation,a.textureUsages,a.textureAdditionalUsages,e.label);a.set(h);const d=e.is3D?1:c,p=I.GetDepthFormatOnly(a.format),_=I.HasDepthAndStencilAspects(a.format)?"depth-only":"all",g=e.is2DArray?"2d-array":e.is3D?"3d":"2d";a.createView({label:`BabylonWebGPUDevice${this._engine.uniqueId}_TextureView${e.is3D?"3D":"2D"}${e.is2DArray?"_Array"+d:""}_${t}x${r}${e.is3D?"x"+c:""}_${u?"wmips":"womips"}_${p}_${g}_${_}_${e.label??"noname"}`,format:p,dimension:g,mipLevelCount:l,baseArrayLayer:0,baseMipLevel:0,arrayLayerCount:d,aspect:_},o)}return a}createMSAATexture(e,t,r){return this.createTexture({width:e.width,height:e.height,layers:1},!1,!1,!1,!1,!1,t,r,this._commandEncoderForCreation,20,0,e.label?e.label+" (MSAA)":"MSAA")}resolveMSAADepthTexture(e,t,r){const n=t.format,i=r===void 0,[a,o]=this._getPipeline(n,U.ResolveDepth);i&&(r=this._device.createCommandEncoder({})),r.pushDebugGroup(`resolve MSAA Depth texture "${e.label}" to "${t.label}"`);const u={label:`BabylonWebGPUDevice${this._engine.uniqueId}_resolveMSAADepthTexture${e.label?"_"+e.label:""}`,colorAttachments:[{view:t,loadOp:"load",storeOp:"store"}]},c=r.beginRenderPass(u),l={layout:o,entries:[{binding:0,resource:e.createView({format:I.GetDepthFormatOnly(e.format),dimension:"2d",mipLevelCount:1,baseArrayLayer:0,baseMipLevel:0,arrayLayerCount:1,aspect:"depth-only"})}]},h=this._device.createBindGroup(l);c.setPipeline(a),c.setBindGroup(0,h),c.draw(4,1,0,0),c.end(),r.popDebugGroup(),i&&(this._device.queue.submit([r.finish()]),r=null)}updateCubeTextures(e,t,r,n,i,a=!1,o=!1,u=0,c=0){const l=[0,3,1,4,2,5];for(let h=0;h{e.mapAsync(1,u,t).then(()=>{const f=e.getMappedRange(u,t);let m=c;if(h)m===null?m=Be(o,t,!0,f):m=Be(o,m.buffer,void 0,f);else if(m===null)switch(d){case 0:m=new Uint8Array(t),m.set(new Uint8Array(f));break;case 1:m=this._getHalfFloatAsFloatRGBAArrayBuffer(t/2,f);break;case 2:m=new Float32Array(t/4),m.set(new Float32Array(f));break}else switch(d){case 0:m=new Uint8Array(m.buffer),m.set(new Uint8Array(f,0,Math.min(m.byteLength,t)));break;case 1:m=this._getHalfFloatAsFloatRGBAArrayBuffer(t/2,f,c);break;case 2:m=new Float32Array(m.buffer),m.set(new Float32Array(f,0,m.byteLength/4));break}if(i!==a){d===1&&!h&&(i*=2,a*=2);const b=new Uint8Array(m.buffer);let x=i,B=0;for(let y=1;y{this._engine.isDisposed||this._engine.uniqueId!==p?_(new Uint8Array):g(f)})})}releaseBuffer(e){return ie._IsGPUBuffer(e)?(this._deferredReleaseBuffers.push(e),!0):(e.references--,e.references===0?(this._deferredReleaseBuffers.push(e.underlyingResource),!0):!1)}destroyDeferredBuffers(){for(let e=0;e1?i="linear":(i="nearest",a=o=0);break;case 12:r="linear",n="nearest",i="nearest",a=o=0;break;default:r="nearest",n="nearest",i="nearest",a=o=0;break}return t>1&&(a!==0||o!==0)?{magFilter:"linear",minFilter:"linear",mipmapFilter:"linear",anisotropyEnabled:!0}:{magFilter:r,minFilter:n,mipmapFilter:i,lodMinClamp:a,lodMaxClamp:o}}static _GetWrappingMode(e){switch(e){case 1:return"repeat";case 0:return"clamp-to-edge";case 2:return"mirror-repeat"}return"repeat"}static _GetSamplerWrappingDescriptor(e){return{addressModeU:this._GetWrappingMode(e._cachedWrapU),addressModeV:this._GetWrappingMode(e._cachedWrapV),addressModeW:this._GetWrappingMode(e._cachedWrapR)}}static _GetSamplerDescriptor(e,t){let r=(e.useMipMaps||e.samplingMode===2)&&e._cachedAnisotropicFilteringLevel?e._cachedAnisotropicFilteringLevel:1;e.samplingMode!==11&&e.samplingMode!==3&&e.samplingMode!==2&&(r=1);const n=this._GetSamplerFilterDescriptor(e,r);return{label:t,...n,...this._GetSamplerWrappingDescriptor(e),compare:e._comparisonFunction?z.GetCompareFunction(e._comparisonFunction):void 0,maxAnisotropy:n.anisotropyEnabled?r:1}}static GetCompareFunction(e){switch(e){case 519:return"always";case 514:return"equal";case 516:return"greater";case 518:return"greater-equal";case 513:return"less";case 515:return"less-equal";case 512:return"never";case 517:return"not-equal";default:return"less"}}getSampler(e,t=!1,r=0,n){if(this.disabled)return this._device.createSampler(z._GetSamplerDescriptor(e,n));t?r=0:r===0&&(r=z.GetSamplerHashCode(e));let i=t?void 0:this._samplers[r];return i||(i=this._device.createSampler(z._GetSamplerDescriptor(e,n)),t||(this._samplers[r]=i)),i}}const Rr={[w.PositionKind]:!0,[w.NormalKind]:!0,[w.TangentKind]:!0,[w.UVKind]:!0,[w.UV2Kind]:!0,[w.UV3Kind]:!0,[w.UV4Kind]:!0,[w.UV5Kind]:!0,[w.UV6Kind]:!0,[w.ColorKind]:!0,[w.ColorInstanceKind]:!0,[w.MatricesIndicesKind]:!0,[w.MatricesWeightsKind]:!0,[w.MatricesIndicesExtraKind]:!0,[w.MatricesWeightsExtraKind]:!0};function Ar(s){switch(s){case w.BYTE:case w.SHORT:case w.INT:case w.FLOAT:return!0;case w.UNSIGNED_BYTE:case w.UNSIGNED_SHORT:case w.UNSIGNED_INT:return!1;default:throw new Error(`Invalid type '${s}'`)}}function Mr(s,e){const t=e.getEngine(),r=e._pipelineContext;if(!r?.vertexBufferKindToType)return;let n=null;for(const i in s){const a=s[i];if(!a||!Rr[i])continue;const o=a.normalized?w.FLOAT:a.type,u=r.vertexBufferKindToType[i];(o!==w.FLOAT&&u===void 0||u!==void 0&&u!==o)&&(n||(n=t._getShaderProcessingContext(e.shaderLanguage,!1)),r.vertexBufferKindToType[i]=o,o!==w.FLOAT&&(n.vertexBufferKindToNumberOfComponents[i]=w.DeduceStride(i),Ar(o)&&(n.vertexBufferKindToNumberOfComponents[i]*=-1)))}if(n){const i=t._caps.parallelShaderCompile;t._caps.parallelShaderCompile=void 0,e._processShaderCodeAsync(null,t._features._checkNonFloatVertexBuffersDontRecreatePipelineContext,n),t._caps.parallelShaderCompile=i}}var F;(function(s){s[s.StencilReadMask=0]="StencilReadMask",s[s.StencilWriteMask=1]="StencilWriteMask",s[s.DepthBias=2]="DepthBias",s[s.DepthBiasSlopeScale=3]="DepthBiasSlopeScale",s[s.DepthStencilState=4]="DepthStencilState",s[s.MRTAttachments=5]="MRTAttachments",s[s.RasterizationState=6]="RasterizationState",s[s.ColorStates1=7]="ColorStates1",s[s.ColorStates2=8]="ColorStates2",s[s.ColorStates3=9]="ColorStates3",s[s.ColorStates4=10]="ColorStates4",s[s.ShaderStage=11]="ShaderStage",s[s.TextureStage=12]="TextureStage",s[s.VertexState=13]="VertexState",s[s.NumStates=14]="NumStates"})(F||(F={}));const te={0:1,1:2,768:3,769:4,770:5,771:6,772:7,773:8,774:9,775:10,776:11,32769:12,32770:13,32771:14,32772:15,35065:16,35066:17,34185:18,35067:19},bt={32774:0,32775:1,32776:2,32778:3,32779:4},$={0:0,7680:1,7681:2,7682:3,7683:4,5386:5,34055:6,34056:7},Y=[0,0,0,0];class D{constructor(e,t){this.mrtTextureCount=0,this._device=e,this._useTextureStage=!0,this._states=new Array(30),this._statesLength=0,this._stateDirtyLowestIndex=0,this._emptyVertexBuffer=t,this._mrtFormats=[],this._parameter={token:void 0,pipeline:null},this.disabled=!1,this.vertexBuffers=[],this._kMaxVertexBufferStride=e.limits.maxVertexBufferArrayStride||2048,this.reset()}reset(){this._isDirty=!0,this.vertexBuffers.length=0,this.setAlphaToCoverage(!1),this.resetDepthCullingState(),this.setClampDepth(!1),this.setDepthBias(0),this._webgpuColorFormat=["bgra8unorm"],this.setColorFormat("bgra8unorm"),this.setMRT([]),this.setAlphaBlendEnabled([!1],1),this.setAlphaBlendFactors([null,null,null,null],[null,null]),this.setWriteMask(15),this.setDepthStencilFormat("depth24plus-stencil8"),this.setStencilEnabled(!1),this.resetStencilState(),this.setBuffers(null,null,null),this._setTextureState(0)}get colorFormats(){return this._mrtAttachments>0?this._mrtFormats:this._webgpuColorFormat}getRenderPipeline(e,t,r,n=0){if(r=I.GetSample(r),this.disabled){const a=D._GetTopology(e);return this._setVertexState(t),this._setTextureState(n),this._parameter.pipeline=this._createRenderPipeline(t,a,r),D.NumCacheMiss++,D._NumPipelineCreationCurrentFrame++,this._parameter.pipeline}if(this._setShaderStage(t.uniqueId),this._setRasterizationState(e,r),this._setColorStates(),this._setDepthStencilState(),this._setVertexState(t),this._setTextureState(n),this.lastStateDirtyLowestIndex=this._stateDirtyLowestIndex,!this._isDirty&&this._parameter.pipeline)return this._stateDirtyLowestIndex=this._statesLength,D.NumCacheHitWithoutHash++,this._parameter.pipeline;if(this._getRenderPipeline(this._parameter),this._isDirty=!1,this._stateDirtyLowestIndex=this._statesLength,this._parameter.pipeline)return D.NumCacheHitWithHash++,this._parameter.pipeline;const i=D._GetTopology(e);return this._parameter.pipeline=this._createRenderPipeline(t,i,r),this._setRenderPipeline(this._parameter),D.NumCacheMiss++,D._NumPipelineCreationCurrentFrame++,this._parameter.pipeline}endFrame(){D.NumPipelineCreationLastFrame=D._NumPipelineCreationCurrentFrame,D._NumPipelineCreationCurrentFrame=0}setAlphaToCoverage(e){this._alphaToCoverageEnabled=e}setFrontFace(e){this._frontFace=e}setCullEnabled(e){this._cullEnabled=e}setCullFace(e){this._cullFace=e}setClampDepth(e){this._clampDepth=e}resetDepthCullingState(){this.setDepthCullingState(!1,2,1,0,0,!0,!0,519)}setDepthCullingState(e,t,r,n,i,a,o,u){this._depthWriteEnabled=o,this._depthTestEnabled=a,this._depthCompare=(u??519)-512,this._cullFace=r,this._cullEnabled=e,this._frontFace=t,this.setDepthBiasSlopeScale(n),this.setDepthBias(i)}setDepthBias(e){this._depthBias!==e&&(this._depthBias=e,this._states[F.DepthBias]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,F.DepthBias))}setDepthBiasSlopeScale(e){this._depthBiasSlopeScale!==e&&(this._depthBiasSlopeScale=e,this._states[F.DepthBiasSlopeScale]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,F.DepthBiasSlopeScale))}setColorFormat(e){this._webgpuColorFormat[0]=e,this._colorFormat=W[e??""]}setMRTAttachments(e){this.mrtAttachments=e;let t=0;for(let r=0;r8)throw new Error("Can't handle more than 8 attachments for a MRT in cache render pipeline!");this.mrtTextureArray=e,this.mrtTextureCount=t,this._mrtEnabledMask=65535;let r=0,n=0;for(let i=0;i0)for(let p=0;p=this._video.HAVE_CURRENT_DATA}dispose(){}}class oe{get forceBindGroupCreation(){return this._numExternalTextures>0}get hasFloatOrDepthTextures(){return this._numFloatOrDepthTextures>0}constructor(){this.useVertexPulling=!1,this.uniqueId=oe._Counter++,this.updateId=0,this.textureState=0,this.reset()}reset(){this.samplers={},this.textures={},this.isDirty=!0,this._numFloatOrDepthTextures=0,this._numExternalTextures=0}setSampler(e,t){let r=this.samplers[e],n=-1;r?n=r.hashCode:this.samplers[e]=r={sampler:t,hashCode:0},r.sampler=t,r.hashCode=t?z.GetSamplerHashCode(t):0;const i=n!==r.hashCode;i&&this.updateId++,this.isDirty||(this.isDirty=i)}setTexture(e,t){let r=this.textures[e],n=-1;r?n=r.texture?.uniqueId??-1:this.textures[e]=r={texture:t,isFloatOrDepthTexture:!1,isExternalTexture:!1},r.isExternalTexture&&this._numExternalTextures--,r.isFloatOrDepthTexture&&this._numFloatOrDepthTextures--,t?(r.isFloatOrDepthTexture=t.type===1||t.format>=13&&t.format<=18,r.isExternalTexture=Tt.IsExternalTexture(t),r.isFloatOrDepthTexture&&this._numFloatOrDepthTextures++,r.isExternalTexture&&this._numExternalTextures++):(r.isFloatOrDepthTexture=!1,r.isExternalTexture=!1),r.texture=t;const i=n!==(t?.uniqueId??-1);i&&this.updateId++,this.isDirty||(this.isDirty=i)}}oe._Counter=0;class ue{isDirty(e){return this._isDirty||this._materialContextUpdateId!==e}resetIsDirty(e){this._isDirty=!1,this._materialContextUpdateId=e}get enableIndirectDraw(){return this._enableIndirectDraw}set enableIndirectDraw(e){this._enableIndirectDrawInCompatMode=!0,this._enableIndirectDraw!==e&&(this._enableIndirectDraw=e,!e&&!this._useInstancing&&this.indirectDrawBuffer?(this._bufferManager.releaseBuffer(this.indirectDrawBuffer),this.indirectDrawBuffer=void 0,this._indirectDrawData=void 0):e&&!this.indirectDrawBuffer&&(this.indirectDrawBuffer=this._bufferManager.createRawBuffer(20,C.CopyDst|C.Indirect|C.Storage,void 0,"IndirectDrawBuffer"),this._indirectDrawData=new Uint32Array(5),this._indirectDrawData[3]=0,this._indirectDrawData[4]=0))}get useInstancing(){return this._useInstancing}set useInstancing(e){if(this._useInstancing===e)return;this._useInstancing=e,this._currentInstanceCount=-1;const t=this._enableIndirectDrawInCompatMode;this.enableIndirectDraw=e,this._enableIndirectDrawInCompatMode=t}constructor(e,t){this._dummyIndexBuffer=t,this._enableIndirectDrawInCompatMode=!1,this._bufferManager=e,this.uniqueId=ue._Counter++,this._useInstancing=!1,this._currentInstanceCount=0,this._enableIndirectDraw=!1,this._vertexPullingEnabled=!1,this.reset()}reset(){this.buffers={},this._isDirty=!0,this._materialContextUpdateId=0,this.fastBundle=void 0,this.bindGroups=void 0,this._vertexPullingEnabled=!1}setBuffer(e,t){this._isDirty||(this._isDirty=t?.uniqueId!==this.buffers[e]?.uniqueId),this.buffers[e]=t}setIndirectData(e,t,r,n=!1){!n&&t===this._currentInstanceCount||!this.indirectDrawBuffer||!this._indirectDrawData||(this._currentInstanceCount=t,this._indirectDrawData[0]=e,this._indirectDrawData[1]=t,this._indirectDrawData[2]=r,this._bufferManager.setRawData(this.indirectDrawBuffer,0,this._indirectDrawData,0,20))}setVertexPulling(e,t,r,n,i){if(this._vertexPullingEnabled===e)return;this._vertexPullingEnabled=e,this._isDirty=!0;const a=t.shaderProcessingContext.bufferNames;if(i)for(const o in i){const u=i[o];if(!u||a.indexOf(o)===-1)continue;const c=u.effectiveBuffer;this.setBuffer(o,e?c:null)}for(const o in r){if(i&&o in i)continue;const u=r[o];if(!u||a.indexOf(o)===-1)continue;const c=u.effectiveBuffer;this.setBuffer(o,e?c:null)}a.indexOf("indices")!==-1&&this.setBuffer("indices",e?n??this._dummyIndexBuffer:null)}dispose(){this.indirectDrawBuffer&&(this._bufferManager.releaseBuffer(this.indirectDrawBuffer),this.indirectDrawBuffer=void 0,this._indirectDrawData=void 0),this.fastBundle=void 0,this.bindGroups=void 0,this.buffers=void 0,this._enableIndirectDraw=!1}}ue._Counter=0;const Lr=1<<20,Er=2**35;class J{constructor(){this.values={}}}class T{static get Statistics(){return{totalCreated:T.NumBindGroupsCreatedTotal,lastFrameCreated:T.NumBindGroupsCreatedLastFrame,lookupLastFrame:T.NumBindGroupsLookupLastFrame,noLookupLastFrame:T.NumBindGroupsNoLookupLastFrame}}static ResetCache(){T._Cache=new J,T.NumBindGroupsCreatedTotal=0,T.NumBindGroupsCreatedLastFrame=0,T.NumBindGroupsLookupLastFrame=0,T.NumBindGroupsNoLookupLastFrame=0,T._NumBindGroupsCreatedCurrentFrame=0,T._NumBindGroupsLookupCurrentFrame=0,T._NumBindGroupsNoLookupCurrentFrame=0}constructor(e,t,r){this.disabled=!1,this._device=e,this._cacheSampler=t,this._engine=r}endFrame(){T.NumBindGroupsCreatedLastFrame=T._NumBindGroupsCreatedCurrentFrame,T.NumBindGroupsLookupLastFrame=T._NumBindGroupsLookupCurrentFrame,T.NumBindGroupsNoLookupLastFrame=T._NumBindGroupsNoLookupCurrentFrame,T._NumBindGroupsCreatedCurrentFrame=0,T._NumBindGroupsLookupCurrentFrame=0,T._NumBindGroupsNoLookupCurrentFrame=0}getBindGroups(e,t,r){let n,i=T._Cache;const a=this.disabled||r.forceBindGroupCreation;if(!a){if(!t.isDirty(r.updateId)&&!r.isDirty)return T._NumBindGroupsNoLookupCurrentFrame++,t.bindGroups;for(const u of e.shaderProcessingContext.bufferNames){const c=(t.buffers[u]?.uniqueId??0)+Lr;let l=i.values[c];l||(l=new J,i.values[c]=l),i=l}for(const u of e.shaderProcessingContext.samplerNames){const c=r.samplers[u]?.hashCode??0;let l=i.values[c];l||(l=new J,i.values[c]=l),i=l}for(const u of e.shaderProcessingContext.textureNames){const c=(r.textures[u]?.texture?.uniqueId??0)+Er;let l=i.values[c];l||(l=new J,i.values[c]=l),i=l}n=i.bindGroups}if(t.resetIsDirty(r.updateId),r.isDirty=!1,n)return t.bindGroups=n,T._NumBindGroupsLookupCurrentFrame++,n;n=[],t.bindGroups=n,a||(i.bindGroups=n),T.NumBindGroupsCreatedTotal++,T._NumBindGroupsCreatedCurrentFrame++;const o=e.bindGroupLayouts[r.textureState];for(let u=0;ub==="texture"?"":x)}, materialContext.uniqueId=${r.uniqueId}`,50);continue}l[d].resource=this._cacheSampler.getSampler(m,!1,f.hashCode,m.label)}else S.Error(`Sampler "${g}" not found in the material context. Make sure you bound it. entry=${JSON.stringify(p)}, materialContext=${JSON.stringify(r,(m,b)=>m==="texture"||m==="sampler"?"":b)}`,50)}else if(p.texture||p.storageTexture){const f=r.textures[g];if(f){if(this._engine.dbgSanityChecks&&f.texture===null){S.Error(`Trying to bind a null texture! name="${g}", entry=${JSON.stringify(p)}, bindingInfo=${JSON.stringify(f,(b,x)=>b==="texture"?"":x)}, materialContext.uniqueId=${r.uniqueId}`,50);continue}const m=f.texture._hardwareTexture;if(this._engine.dbgSanityChecks&&(!m||p.texture&&!m.view||p.storageTexture&&!m.viewForWriting)){S.Error(`Trying to bind a null gpu texture or view! entry=${JSON.stringify(p)}, name=${g}, bindingInfo=${JSON.stringify(f,(b,x)=>b==="texture"?"":x)}, isReady=${f.texture?.isReady}, materialContext.uniqueId=${r.uniqueId}`,50);continue}l[d].resource=p.storageTexture?m.viewForWriting:m.view}else S.Error(`Texture "${g}" not found in the material context. Make sure you bound it (something like effect.setTexture("${g}", texture)). entry=${JSON.stringify(p)}, materialContext=${JSON.stringify(r,(m,b)=>m==="texture"||m==="sampler"?"":b)}`,50)}else if(p.externalTexture){const f=r.textures[g];if(f){if(this._engine.dbgSanityChecks&&f.texture===null){S.Error(`Trying to bind a null external texture! entry=${JSON.stringify(p)}, name=${g}, bindingInfo=${JSON.stringify(f,(b,x)=>b==="texture"?"":x)}, materialContext.uniqueId=${r.uniqueId}`,50);continue}const m=f.texture.underlyingResource;if(this._engine.dbgSanityChecks&&!m){S.Error(`Trying to bind a null gpu external texture! entry=${JSON.stringify(p)}, name=${g}, bindingInfo=${JSON.stringify(f,(b,x)=>b==="texture"?"":x)}, isReady=${f.texture?.isReady}, materialContext.uniqueId=${r.uniqueId}`,50);continue}l[d].resource=this._device.importExternalTexture({source:m})}else S.Error(`External texture "${g}" not found in the material context. Make sure you bound it. entry=${JSON.stringify(p)}, materialContext=${JSON.stringify(r,(m,b)=>m==="texture"||m==="sampler"?"":b)}`,50)}else if(p.buffer){const f=t.buffers[g];if(f){const m=f.underlyingResource;l[d].resource.buffer=m,l[d].resource.size=f.capacity}else S.Error(`Can't find buffer "${g}" in the draw context. Make sure you bound it. entry=${JSON.stringify(p)}, buffers=${JSON.stringify(t.buffers)}, drawContext.uniqueId=${t.uniqueId}`,50)}}const h=o[u];n[u]=this._device.createBindGroup({layout:h,entries:l})}return n}}T.NumBindGroupsCreatedTotal=0;T.NumBindGroupsCreatedLastFrame=0;T.NumBindGroupsLookupLastFrame=0;T.NumBindGroupsNoLookupLastFrame=0;T._Cache=new J;T._NumBindGroupsCreatedCurrentFrame=0;T._NumBindGroupsLookupCurrentFrame=0;T._NumBindGroupsNoLookupCurrentFrame=0;const xt="clearQuadVertexShader",Or=`uniform depthValue: f32;const pos=array( +vec2f(-1.0,1.0), +vec2f(1.0,1.0), +vec2f(-1.0,-1.0), +vec2f(1.0,-1.0) +); +#define CUSTOM_VERTEX_DEFINITIONS +@vertex +fn main(input : VertexInputs)->FragmentInputs { +#define CUSTOM_VERTEX_MAIN_BEGIN +vertexOutputs.position=vec4f(pos[input.vertexIndex],uniforms.depthValue,1.0); +#define CUSTOM_VERTEX_MAIN_END +} +`;ne.ShadersStoreWGSL[xt]||(ne.ShadersStoreWGSL[xt]=Or);const yt="clearQuadPixelShader",Gr=`uniform color: vec4f;@fragment +fn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=uniforms.color;} +`;ne.ShadersStoreWGSL[yt]||(ne.ShadersStoreWGSL[yt]=Gr);class Ur{setDepthStencilFormat(e){this._depthTextureFormat=e,this._cacheRenderPipeline.setDepthStencilFormat(e)}setColorFormat(e){this._cacheRenderPipeline.setColorFormat(e)}setMRTAttachments(e,t,r){this._cacheRenderPipeline.setMRT(t,r),this._cacheRenderPipeline.setMRTAttachments(e)}constructor(e,t,r){this._bindGroups={},this._bundleCache={},this._keyTemp=[],this._device=e,this._engine=t,this._cacheRenderPipeline=new k(this._device,r),this._cacheRenderPipeline.setDepthTestEnabled(!1),this._cacheRenderPipeline.setStencilReadMask(255),this._effect=t.createEffect("clearQuad",[],["color","depthValue"],void 0,void 0,void 0,void 0,void 0,void 0,1)}clear(e,t,r,n,i=1){let a,o=null,u;const c=!!this._engine._currentRenderTarget;if(e)a=e;else{let f=0;this._keyTemp.length=0;for(let b=0;b1?2**36:0)+m*2**37,u=this._keyTemp.join("_"),o=this._bundleCache[u],o)return o;a=this._device.createRenderBundleEncoder({label:"clearQuadRenderBundle",colorFormats:this._cacheRenderPipeline.colorFormats,depthStencilFormat:this._depthTextureFormat,sampleCount:I.GetSample(i)})}this._cacheRenderPipeline.setDepthWriteEnabled(!!r),this._cacheRenderPipeline.setStencilEnabled(!!n&&!!this._depthTextureFormat&&I.HasStencilAspect(this._depthTextureFormat)),this._cacheRenderPipeline.setStencilWriteMask(n?255:0),this._cacheRenderPipeline.setStencilCompare(n?519:512),this._cacheRenderPipeline.setStencilPassOp(n?7681:7680),this._cacheRenderPipeline.setWriteMask(t?15:0);const l=this._cacheRenderPipeline.getRenderPipeline(7,this._effect,i),h=this._effect._pipelineContext;t&&this._effect.setDirectColor4("color",t),this._effect.setFloat("depthValue",this._engine.useReverseDepthBuffer?this._engine._clearReverseDepthValue:this._engine._clearDepthValue),h.uniformBuffer.update();const d=c?this._engine._ubInvertY:this._engine._ubDontInvertY,p=h.uniformBuffer.getBuffer(),_=p.uniqueId+"-"+d.uniqueId;let g=this._bindGroups[_];if(!g){const f=h.bindGroupLayouts[0];g=this._bindGroups[_]=[],g.push(this._device.createBindGroup({label:`clearQuadBindGroup0-${_}`,layout:f[0],entries:[]})),O._SimplifiedKnownBindings||g.push(this._device.createBindGroup({label:`clearQuadBindGroup1-${_}`,layout:f[1],entries:[]})),g.push(this._device.createBindGroup({label:`clearQuadBindGroup${O._SimplifiedKnownBindings?1:2}-${_}`,layout:f[O._SimplifiedKnownBindings?1:2],entries:[{binding:0,resource:{buffer:d.underlyingResource,size:d.capacity}},{binding:1,resource:{buffer:p.underlyingResource,size:p.capacity}}]}))}a.setPipeline(l);for(let f=0;f{t!==null&&t>=0&&(this._gpuFrameTimeCounter.fetchNewFrame(),this._gpuFrameTimeCounter.addCount(t,!0)),this._measureDurationState=0}))}startPass(e,t){this._enabled?this._measureDuration.startPass(e,t):e.timestampWrites=void 0}endPass(e,t){if(!this._enabled||!t)return;const r=this._engine.frameId;this._measureDuration.stopPass(e).then(n=>{t._addDuration(r,n!==null&&n>0?n:0)})}dispose(){this._measureDuration?.dispose()}}class $r{constructor(e,t,r,n=2,i){this._count=n,this._querySet=new Bt(e,n,"timestamp",t,r,!0,i)}start(e){e.writeTimestamp?.(this._querySet.querySet,0)}async stop(e){return e.writeTimestamp?.(this._querySet.querySet,1),e.writeTimestamp?await this._querySet.readTwoValuesAndSubtract(0):0}startPass(e,t){if(t+3>this._count)throw new Error("WebGPUDurationMeasure: index out of range ("+t+")");e.timestampWrites={querySet:this._querySet.querySet,beginningOfPassWriteIndex:t+2,endOfPassWriteIndex:t+3}}async stopPass(e){return await this._querySet.readTwoValuesAndSubtract(e+2)}dispose(){this._querySet.dispose()}}class Vr{get querySet(){return this._querySet.querySet}get hasQueries(){return this._currentTotalIndices!==this._availableIndices.length}canBeginQuery(e){if(this._frameQuerySetIsDirty===this._engine.frameId||this._queryFrameId[e]===this._engine.frameId)return!1;const t=this._engine._getCurrentRenderPassWrapper().renderPassDescriptor.occlusionQuerySet!==void 0;return t&&(this._queryFrameId[e]=this._engine.frameId),t}constructor(e,t,r,n=50,i=100){this._availableIndices=[],this._frameQuerySetIsDirty=-1,this._queryFrameId=[],this._engine=e,this._device=t,this._bufferManager=r,this._frameLastBuffer=-1,this._currentTotalIndices=0,this._countIncrement=i,this._allocateNewIndices(n)}createQuery(){this._availableIndices.length===0&&this._allocateNewIndices();const e=this._availableIndices[this._availableIndices.length-1];return this._availableIndices.length--,e}deleteQuery(e){this._availableIndices[this._availableIndices.length]=e}isQueryResultAvailable(e){return this._retrieveQueryBuffer(),!!this._lastBuffer&&e{this._lastBuffer=e}))}_allocateNewIndices(e){e=e??this._countIncrement,this._delayQuerySetDispose();for(let t=0;te.dispose,1e3)}dispose(){this._querySet?.dispose(),this._availableIndices.length=0}}class ce{get code(){return this._sourceCode}constructor(e,t=20){this.debug=!1,this._sourceCode=e,this._numMaxIterations=t,this._functionDescr=[],this.inlineToken="#define inline"}processCode(){this.debug&&S.Log(`Start inlining process (code size=${this._sourceCode.length})...`),this._collectFunctions(),this._processInlining(this._numMaxIterations),this.debug&&S.Log("End of inlining process.")}_collectFunctions(){let e=0;for(;e=0&&p.push(m.substring(b+1))}i!=="void"&&p.push("return"),this._functionDescr.push({name:a,type:i,parameters:p,body:h,callIndex:0}),e=l+1;const _=t>0?this._sourceCode.substring(0,t):"",g=l+1=0&&this._replaceFunctionCallsByCode(););return this.debug&&S.Log(`numMaxIterations is ${e} after inlining process`),e>=0}_replaceFunctionCallsByCode(){let e=!1;for(const t of this._functionDescr){const{name:r,type:n,parameters:i,body:a}=t;let o=0;for(;o{const B=[];let y=0,M=0;for(;y0?this._sourceCode.substring(0,u):"";const b=l+1{const l=c[0];return he(e.charAt(l-1))||he(e.charAt(l+a))?t[n]:o})}return e}}ce._RegexpFindFunctionNameAndType=/((\s+?)(\w+)\s+(\w+)\s*?)$/;class E{async initTwgsl(e){if(!E._Twgsl){if(e=e||{},e={...E._TwgslDefaultOptions,...e},e.twgsl){E._Twgsl=e.twgsl;return}if(e.jsPath&&e.wasmPath&&await H.LoadBabylonScriptAsync(e.jsPath),self.twgsl){E._Twgsl=await self.twgsl(H.GetBabylonScriptURL(e.wasmPath));return}throw new Error("twgsl is not available.")}}convertSpirV2WGSL(e,t=!1){const r=E._Twgsl.convertSpirV2WGSL(e,E.DisableUniformityAnalysis||t);return E.ShowWGSLShaderCode&&(S.Log(r),S.Log("***********************************************")),E.DisableUniformityAnalysis||t?`diagnostic(off, derivative_uniformity); +`+r:r}}E._TwgslDefaultOptions={jsPath:`${H._DefaultCdnUrl}/twgsl/twgsl.js`,wasmPath:`${H._DefaultCdnUrl}/twgsl/twgsl.wasm`};E.ShowWGSLShaderCode=!1;E.DisableUniformityAnalysis=!1;E._Twgsl=null;class kr{constructor(e,t,r){this._record=!1,this._play=!1,this._playBundleListIndex=0,this._allBundleLists=[],this._enabled=!1,this.showDebugLogs=!1,this._engine=e,this._mode=t,this._bundleList=r}get enabled(){return this._enabled}get play(){return this._play}get record(){return this._record}set enabled(e){this._log("enabled",`activate=${e}, mode=${this._mode}`),this._allBundleLists.length=0,this._record=this._enabled=e,this._play=!1,e&&(this._modeSaved=this._mode,this._mode=0)}get mode(){return this._mode}set mode(e){this._record?this._modeSaved=e:this._mode=e}endRenderPass(e){if(!this._record&&!this._play)return!1;let t=null;return this._record?(t=this._bundleList.clone(),this._allBundleLists.push(t),this._bundleList.reset(),this._log("endRenderPass",`bundleList recorded at position #${this._allBundleLists.length-1}`)):this._playBundleListIndex>=this._allBundleLists.length?this._log("endRenderPass",`empty or out-of-sync bundleList (_allBundleLists.length=${this._allBundleLists.length}, playBundleListIndex=${this._playBundleListIndex})`):(this._log("endRenderPass",`run bundleList #${this._playBundleListIndex}`),t=this._allBundleLists[this._playBundleListIndex++]),t&&(t.run(e),this._mode===1&&this._engine._reportDrawCall(t.numDrawCalls)),!0}endFrame(){this._record&&(this._record=!1,this._play=!0,this._mode=this._modeSaved,this._log("endFrame","bundles recorded, switching to play mode")),this._playBundleListIndex=0}reset(){this._log("reset","called"),this._record&&(this._mode=this._modeSaved),this.enabled=!1,this.enabled=!0}_log(e,t){this.showDebugLogs&&S.Log(`[Frame: ${this._engine.frameId}] WebGPUSnapshotRendering:${e} - ${t}`)}}const X=(()=>{const s=new Uint8Array(4),e=new Uint32Array(s.buffer);return!!((e[0]=1)&s[0])})();Object.defineProperty(w.prototype,"effectiveByteStride",{get:function(){return this._alignedBuffer&&this._alignedBuffer.byteStride||this.byteStride},enumerable:!0,configurable:!0});Object.defineProperty(w.prototype,"effectiveByteOffset",{get:function(){return this._alignedBuffer?0:this.byteOffset},enumerable:!0,configurable:!0});Object.defineProperty(w.prototype,"effectiveBuffer",{get:function(){return this._alignedBuffer&&this._alignedBuffer.getBuffer()||this._buffer.getBuffer()},enumerable:!0,configurable:!0});w.prototype._rebuild=function(){this._buffer?._rebuild(),this._alignedBuffer?._rebuild()};w.prototype.dispose=function(){this._ownsBuffer&&this._buffer.dispose(),this._alignedBuffer?.dispose(),this._alignedBuffer=void 0,this._isDisposed=!0};w.prototype.getWrapperBuffer=function(){return this._alignedBuffer||this._buffer};w.prototype._alignBuffer=function(){const s=this._buffer.getData();if(!this.engine._features.forceVertexBufferStrideAndOffsetMultiple4Bytes||this.byteStride%4===0&&this.byteOffset%4===0||!s)return;const e=Ot(this.type),t=this.byteStride+3&-4,r=t/e,n=this._maxVerticesCount,a=n*t/e;let o;if(Array.isArray(s)){const h=new Float32Array(s);o=new DataView(h.buffer,h.byteOffset,h.byteLength)}else s instanceof ArrayBuffer?o=new DataView(s,0,s.byteLength):o=new DataView(s.buffer,s.byteOffset,s.byteLength);let u;this.type===w.BYTE?u=new Int8Array(a):this.type===w.UNSIGNED_BYTE?u=new Uint8Array(a):this.type===w.SHORT?u=new Int16Array(a):this.type===w.UNSIGNED_SHORT?u=new Uint16Array(a):this.type===w.INT?u=new Int32Array(a):this.type===w.UNSIGNED_INT?u=new Uint32Array(a):u=new Float32Array(a);const c=this.getSize();let l=this.byteOffset;for(let h=0;h{e?.removePendingData(d),c&&g&&c(g.status+" "+g.statusText,f)},_=async g=>{const f=a(g);if(!f)return;const m=f instanceof Promise?await f:f,b=d.width;if(o){const x=r===4,B=o(m),y=d._hardwareTexture,M=[0,1,2,3,4,5];for(let R=0;R>R,L=[];for(let G=0;G<6;G++){let V=B[R][M[G]];x&&(V=Z(V,v,v,n)),L.push(new Uint8Array(V.buffer,V.byteOffset,V.byteLength))}this._textureHelper.updateCubeTextures(L,y.underlyingResource,v,v,y.format,h,!1,0,0)}}else this.updateRawCubeTexture(d,m,r,n,h);d.isReady=!0,e?.removePendingData(d),u&&u()};return this._loadFile(s,g=>{_(g).catch(f=>{p(void 0,f)})},void 0,e?.offlineProvider,!0,p),d};A.prototype.createRawTexture3D=function(s,e,t,r,n,i,a,o,u=null,c=0,l=0){const d=new q(this,10);return d.baseWidth=e,d.baseHeight=t,d.baseDepth=r,d.width=e,d.height=t,d.depth=r,d.format=n,d.type=c,d.generateMipMaps=i,d.samplingMode=o,d.is3D=!0,d._creationFlags=l,this._doNotHandleContextLost||(d._bufferView=s),this._textureHelper.createGPUTextureForInternalTexture(d,e,t,void 0,l),this.updateRawTexture3D(d,s,n,a,u,c),this._internalTexturesCache.push(d),d};A.prototype.updateRawTexture3D=function(s,e,t,r,n=null,i=0){if(this._doNotHandleContextLost||(s._bufferView=e,s.format=t,s.invertY=r,s._compression=n),e){const a=s._hardwareTexture;t===4&&(e=Z(e,s.width,s.height,i));const u=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);this._textureHelper.updateTexture(u,s,s.width,s.height,s.depth,a.format,0,0,r,!1,0,0),s.generateMipMaps&&this._generateMipmaps(s,this._uploadEncoder)}s.isReady=!0};A.prototype.createRawTexture2DArray=function(s,e,t,r,n,i,a,o,u=null,c=0,l=0){const d=new q(this,11);return d.baseWidth=e,d.baseHeight=t,d.baseDepth=r,d.width=e,d.height=t,d.depth=r,d.format=n,d.type=c,d.generateMipMaps=i,d.samplingMode=o,d.is2DArray=!0,d._creationFlags=l,this._doNotHandleContextLost||(d._bufferView=s),this._textureHelper.createGPUTextureForInternalTexture(d,e,t,r,l),this.updateRawTexture2DArray(d,s,n,a,u,c),this._internalTexturesCache.push(d),d};A.prototype.updateRawTexture2DArray=function(s,e,t,r,n=null,i=0){if(this._doNotHandleContextLost||(s._bufferView=e,s.format=t,s.invertY=r,s._compression=n),e){const a=s._hardwareTexture;t===4&&(e=Z(e,s.width,s.height,i));const u=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);this._textureHelper.updateTexture(u,s,s.width,s.height,s.depth,a.format,0,0,r,!1,0,0),s.generateMipMaps&&this._generateMipmaps(s,this._uploadEncoder)}s.isReady=!0};function Z(s,e,t,r){let n,i=1;r===1?n=new Float32Array(e*t*4):r===2?(n=new Uint16Array(e*t*4),i=15360):r===7?n=new Uint32Array(e*t*4):n=new Uint8Array(e*t*4);for(let a=0;a{const m=f,b=m[0].width,x=b;this._setCubeMapTextureParams(g,!r),g.format=a??-1;const B=this._textureHelper.createGPUTextureForInternalTexture(g,b,x);this._textureHelper.updateCubeTextures(m,B.underlyingResource,b,x,B.format,!1,!1,0,0),r||this._generateMipmaps(g,this._uploadEncoder),g.isReady=!0,g.onLoadedObservable.notifyObservers(g),g.onLoadedObservable.clear(),n&&n()},!!p,_)};A.prototype._setCubeMapTextureParams=function(s,e,t){s.samplingMode=e?3:2,s._cachedWrapU=0,s._cachedWrapV=0,t&&(s._maxLodLevel=t)};A.prototype.generateMipMapsForCubemap=function(s){s.generateMipMaps&&(s._hardwareTexture?.underlyingResource||this._textureHelper.createGPUTextureForInternalTexture(s),this._generateMipmaps(s))};class qr extends Ut{constructor(e,t,r,n,i){super(e,t,r,n,i),n.enableGPUTimingMeasurements&&(this.gpuTimeInFrame=new Ct)}}A.prototype._createHardwareRenderTargetWrapper=function(s,e,t){const r=new qr(s,e,t,this);return this._renderTargetWrapperCache.push(r),r};A.prototype.createRenderTargetTexture=function(s,e){const t=this._createHardwareRenderTargetWrapper(!1,!1,s),r={};e!==void 0&&typeof e=="object"?(r.generateMipMaps=e.generateMipMaps,r.generateDepthBuffer=e.generateDepthBuffer===void 0?!0:e.generateDepthBuffer,r.generateStencilBuffer=r.generateDepthBuffer&&e.generateStencilBuffer,r.samplingMode=e.samplingMode===void 0?3:e.samplingMode,r.creationFlags=e.creationFlags??0,r.noColorAttachment=!!e.noColorAttachment,r.colorAttachment=e.colorAttachment,r.samples=e.samples,r.label=e.label,r.format=e.format,r.type=e.type):(r.generateMipMaps=e,r.generateDepthBuffer=!0,r.generateStencilBuffer=!1,r.samplingMode=3,r.creationFlags=0,r.noColorAttachment=!1);const n=r.colorAttachment||(r.noColorAttachment?null:this._createInternalTexture(s,r,!0,5));return t.label=r.label??"RenderTargetWrapper",t._samples=r.colorAttachment?.samples??r.samples??1,t._generateDepthBuffer=r.generateDepthBuffer,t._generateStencilBuffer=!!r.generateStencilBuffer,t.setTextures(n),(t._generateDepthBuffer||t._generateStencilBuffer)&&t.createDepthStencilTexture(0,!1,t._generateStencilBuffer,t.samples,r.generateStencilBuffer?13:14,r.label?r.label+"-DepthStencil":void 0),n&&!r.colorAttachment&&(e!==void 0&&typeof e=="object"&&e.createMipMaps&&!r.generateMipMaps&&(n.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(n,void 0,void 0,void 0,r.creationFlags),e!==void 0&&typeof e=="object"&&e.createMipMaps&&!r.generateMipMaps&&(n.generateMipMaps=!1)),t};A.prototype._createDepthStencilTexture=function(s,e,t){const r={bilinearFiltering:!1,comparisonFunction:0,samples:1,depthTextureFormat:e.generateStencil?13:14,...e},n=$t(r.depthTextureFormat);t._depthStencilTextureWithStencil=n;const i=new q(this,n?12:14);return i.label=e.label,i.format=r.depthTextureFormat,i.type=Nt(i.format),this._setupDepthStencilTexture(i,s,r.bilinearFiltering,r.comparisonFunction,r.samples),this._textureHelper.createGPUTextureForInternalTexture(i),this._internalTexturesCache.push(i),i};A.prototype._setupDepthStencilTexture=function(s,e,t,r,n=1){const i=e.width??e,a=e.height??e,o=e.layers||0,u=e.depth||0;s.baseWidth=i,s.baseHeight=a,s.width=i,s.height=a,s.is2DArray=o>0,s.is3D=u>0,s.depth=o||u,s.isReady=!0,s.samples=n,s.generateMipMaps=!1,s.samplingMode=t?2:1,s.type=1,s._comparisonFunction=r,s._cachedWrapU=0,s._cachedWrapV=0};A.prototype.updateRenderTargetTextureSampleCount=function(s,e){return!s||!s.texture||s.samples===e||(e=Math.min(e,this.getCaps().maxMSAASamples),s.texture._hardwareTexture?.releaseMSAATextures(),s._depthStencilTexture&&(s._depthStencilTexture._hardwareTexture?.releaseMSAATextures(),s._depthStencilTexture.samples=e),s._samples=e,s.texture.samples=e),e};A.prototype.setDepthStencilTexture=function(s,e,t,r){!t||!t.depthStencilTexture?this._setTexture(s,null,void 0,void 0,r):this._setTexture(s,t,!1,!0,r)};A.prototype.createRenderTargetCubeTexture=function(s,e){const t=this._createHardwareRenderTargetWrapper(!1,!0,s),r={generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:0,samplingMode:3,format:5,samples:1,...e};r.generateStencilBuffer=r.generateDepthBuffer&&r.generateStencilBuffer,t.label=r.label??"RenderTargetWrapper",t._generateDepthBuffer=r.generateDepthBuffer,t._generateStencilBuffer=r.generateStencilBuffer;const n=new q(this,5);return n.width=s,n.height=s,n.depth=0,n.isReady=!0,n.isCube=!0,n.samples=r.samples,n.generateMipMaps=r.generateMipMaps,n.samplingMode=r.samplingMode,n.type=r.type,n.format=r.format,this._internalTexturesCache.push(n),t.setTextures(n),(t._generateDepthBuffer||t._generateStencilBuffer)&&t.createDepthStencilTexture(0,r.samplingMode===void 0||r.samplingMode===2||r.samplingMode===2||r.samplingMode===3||r.samplingMode===3||r.samplingMode===5||r.samplingMode===6||r.samplingMode===7||r.samplingMode===11,t._generateStencilBuffer,t.samples),e&&e.createMipMaps&&!r.generateMipMaps&&(n.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(n),e&&e.createMipMaps&&!r.generateMipMaps&&(n.generateMipMaps=!1),t};class Qr{constructor(){this.occlusionInternalRetryCounter=0,this.isOcclusionQueryInProgress=!1,this.isOccluded=!1,this.occlusionRetryCount=-1,this.occlusionType=N.OCCLUSION_TYPE_NONE,this.occlusionQueryAlgorithmType=N.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE,this.forceRenderingWhenOccluded=!1}}Q.prototype.createQuery=function(){return null};Q.prototype.deleteQuery=function(s){return this};Q.prototype.isQueryResultAvailable=function(s){return!1};Q.prototype.getQueryResult=function(s){return 0};Q.prototype.beginOcclusionQuery=function(s,e){return!1};Q.prototype.endOcclusionQuery=function(s){return this};Object.defineProperty(N.prototype,"isOcclusionQueryInProgress",{get:function(){return this._occlusionDataStorage.isOcclusionQueryInProgress},set:function(s){this._occlusionDataStorage.isOcclusionQueryInProgress=s},enumerable:!1,configurable:!0});Object.defineProperty(N.prototype,"_occlusionDataStorage",{get:function(){return this.__occlusionDataStorage||(this.__occlusionDataStorage=new Qr),this.__occlusionDataStorage},enumerable:!1,configurable:!0});Object.defineProperty(N.prototype,"isOccluded",{get:function(){return this._occlusionDataStorage.isOccluded},set:function(s){this._occlusionDataStorage.isOccluded=s},enumerable:!0,configurable:!0});Object.defineProperty(N.prototype,"occlusionQueryAlgorithmType",{get:function(){return this._occlusionDataStorage.occlusionQueryAlgorithmType},set:function(s){this._occlusionDataStorage.occlusionQueryAlgorithmType=s},enumerable:!0,configurable:!0});Object.defineProperty(N.prototype,"occlusionType",{get:function(){return this._occlusionDataStorage.occlusionType},set:function(s){this._occlusionDataStorage.occlusionType=s},enumerable:!0,configurable:!0});Object.defineProperty(N.prototype,"occlusionRetryCount",{get:function(){return this._occlusionDataStorage.occlusionRetryCount},set:function(s){this._occlusionDataStorage.occlusionRetryCount=s},enumerable:!0,configurable:!0});Object.defineProperty(N.prototype,"forceRenderingWhenOccluded",{get:function(){return this._occlusionDataStorage.forceRenderingWhenOccluded},set:function(s){this._occlusionDataStorage.forceRenderingWhenOccluded=s},enumerable:!0,configurable:!0});N.prototype._checkOcclusionQuery=function(){const s=this._occlusionDataStorage;if(s.occlusionType===N.OCCLUSION_TYPE_NONE)return s.isOccluded=!1,!1;const e=this.getEngine();if(!e.getCaps().supportOcclusionQuery||!e.isQueryResultAvailable)return s.isOccluded=!1,!1;if(this.isOcclusionQueryInProgress&&this._occlusionQuery!==null&&this._occlusionQuery!==void 0)if(e.isQueryResultAvailable(this._occlusionQuery)){const n=e.getQueryResult(this._occlusionQuery);s.isOcclusionQueryInProgress=!1,s.occlusionInternalRetryCounter=0,s.isOccluded=!(n>0)}else if(s.occlusionInternalRetryCounter++,s.occlusionRetryCount!==-1&&s.occlusionInternalRetryCounter>s.occlusionRetryCount)s.isOcclusionQueryInProgress=!1,s.occlusionInternalRetryCounter=0,s.isOccluded=s.occlusionType===N.OCCLUSION_TYPE_OPTIMISTIC?!1:s.isOccluded;else return s.occlusionType===N.OCCLUSION_TYPE_OPTIMISTIC?!1:s.isOccluded;const t=this.getScene();if(t.getBoundingBoxRenderer){const r=t.getBoundingBoxRenderer();this._occlusionQuery===null&&(this._occlusionQuery=e.createQuery()),this._occlusionQuery&&e.beginOcclusionQuery(s.occlusionQueryAlgorithmType,this._occlusionQuery)&&(r.renderOcclusionBoundingBox(this),e.endOcclusionQuery(s.occlusionQueryAlgorithmType),this._occlusionDataStorage.isOcclusionQueryInProgress=!0)}return s.isOccluded};A.prototype.getGPUFrameTimeCounter=function(){return this._timestampQuery.gpuFrameTimeCounter};A.prototype.captureGPUFrameTime=function(s){this._timestampQuery.enable=s&&!!this._caps.timerQuery};A.prototype.createQuery=function(){return this._occlusionQuery.createQuery()};A.prototype.deleteQuery=function(s){return this._occlusionQuery.deleteQuery(s),this};A.prototype.isQueryResultAvailable=function(s){return this._occlusionQuery.isQueryResultAvailable(s)};A.prototype.getQueryResult=function(s){return this._occlusionQuery.getQueryResult(s)};A.prototype.beginOcclusionQuery=function(s,e){if(this.compatibilityMode){if(this._occlusionQuery.canBeginQuery(e))return this._currentRenderPass?.beginOcclusionQuery(e),!0}else return this._bundleList.addItem(new ye(e)),!0;return!1};A.prototype.endOcclusionQuery=function(){return this.compatibilityMode?this._currentRenderPass?.endOcclusionQuery():this._bundleList.addItem(new Se),this};const St={label:"TextureView_SwapChain_ResolveTarget",dimension:"2d",format:void 0,mipLevelCount:1,arrayLayerCount:1},wt={label:"TextureView_SwapChain",dimension:"2d",format:void 0,mipLevelCount:1,arrayLayerCount:1},Hr=new de;class K extends A{get snapshotRenderingMode(){return this._snapshotRendering.mode}set snapshotRenderingMode(e){this._snapshotRendering.mode=e}snapshotRenderingReset(){this._snapshotRendering.reset()}get snapshotRendering(){return this._snapshotRendering.enabled}set snapshotRendering(e){this._snapshotRendering.enabled=e}get disableCacheSamplers(){return this._cacheSampler?this._cacheSampler.disabled:!1}set disableCacheSamplers(e){this._cacheSampler&&(this._cacheSampler.disabled=e)}get disableCacheRenderPipelines(){return this._cacheRenderPipeline?this._cacheRenderPipeline.disabled:!1}set disableCacheRenderPipelines(e){this._cacheRenderPipeline&&(this._cacheRenderPipeline.disabled=e)}get disableCacheBindGroups(){return this._cacheBindGroups?this._cacheBindGroups.disabled:!1}set disableCacheBindGroups(e){this._cacheBindGroups&&(this._cacheBindGroups.disabled=e)}areAllEffectsReady(){return!0}getFontOffset(e){return Vt(e)}static get IsSupportedAsync(){return navigator.gpu?navigator.gpu.requestAdapter().then(e=>!!e,()=>!1).catch(()=>!1):Promise.resolve(!1)}static get IsSupported(){return S.Warn("You must call IsSupportedAsync for WebGPU!"),!1}get supportsUniformBuffers(){return!0}get supportedExtensions(){return this._adapterSupportedExtensions}get enabledExtensions(){return this._deviceEnabledExtensions}get supportedLimits(){return this._adapterSupportedLimits}get currentLimits(){return this._deviceLimits}get description(){return this.name+this.version}get version(){return 1}getInfo(){return{vendor:this._adapterInfo.vendor||"unknown vendor",renderer:this._adapterInfo.architecture||"unknown renderer",version:this._adapterInfo.description||"unknown version"}}get compatibilityMode(){return this._compatibilityMode}set compatibilityMode(e){this._compatibilityMode=e}get currentSampleCount(){return this._currentRenderTarget?this._currentRenderTarget.samples:this._mainPassSampleCount}static CreateAsync(e,t={}){const r=new K(e,t);return new Promise(n=>{r.initAsync(t.glslangOptions,t.twgslOptions).then(()=>n(r))})}constructor(e,t={}){if(super(t.antialias??!0,t),this.uniqueId=-1,this._uploadEncoderDescriptor={label:"upload"},this._renderEncoderDescriptor={label:"render"},this._clearDepthValue=1,this._clearReverseDepthValue=0,this._clearStencilValue=0,this._defaultSampleCount=4,this._glslang=null,this._tintWASM=null,this._glslangAndTintAreFullyLoaded=!1,this._adapterInfo={vendor:"",architecture:"",device:"",description:"",subgroupMinSize:0,subgroupMaxSize:0,isFallbackAdapter:!1},this._compiledComputeEffects={},this._counters={numEnableEffects:0,numEnableDrawWrapper:0,numBundleCreationNonCompatMode:0,numBundleReuseNonCompatMode:0},this.countersLastFrame={numEnableEffects:0,numEnableDrawWrapper:0,numBundleCreationNonCompatMode:0,numBundleReuseNonCompatMode:0},this.numMaxUncapturedErrors=20,this.scenes=[],this._virtualScenes=new Array,this._commandBuffers=[null,null],this._mainRenderPassWrapper={renderPassDescriptor:null,colorAttachmentViewDescriptor:null,depthAttachmentViewDescriptor:null,colorAttachmentGPUTextures:[],depthTextureFormat:void 0},this._rttRenderPassWrapper={renderPassDescriptor:null,colorAttachmentViewDescriptor:null,depthAttachmentViewDescriptor:null,colorAttachmentGPUTextures:[],depthTextureFormat:void 0},this._currentVertexBuffers={},this._currentOverrideVertexBuffers=null,this._currentIndexBuffer=null,this._colorWriteLocal=!0,this._forceEnableEffect=!1,this.isNDCHalfZRange=!0,this.hasOriginBottomLeft=!1,this._workingGlslangAndTintPromise=null,this._viewportsCurrent={x:0,y:0,w:0,h:0},this._scissorsCurrent={x:0,y:0,w:0,h:0},this._scissorCached={x:0,y:0,z:0,w:0},this._stencilRefsCurrent=-1,this._blendColorsCurrent=[null,null,null,null],this._performanceMonitor=new kt,this._name="WebGPU",this._drawCalls=new _e,t.deviceDescriptor=t.deviceDescriptor||{},t.enableGPUDebugMarkers=t.enableGPUDebugMarkers??!1,this._enableGPUDebugMarkers=t.enableGPUDebugMarkers,S.Log(`Babylon.js v${Q.Version} - ${this.description} engine`),!navigator.gpu){S.Error("WebGPU is not supported by your browser.");return}t.swapChainFormat=t.swapChainFormat||navigator.gpu.getPreferredCanvasFormat(),this._isWebGPU=!0,this._shaderPlatformName="WEBGPU",this._renderingCanvas=e,this._options=t,this._mainPassSampleCount=t.antialias?this._defaultSampleCount:1,navigator&&navigator.userAgent&&this._setupMobileChecks(),this._sharedInit(this._renderingCanvas),this._shaderProcessor=new or,this._shaderProcessorWGSL=new hr}prepareGlslangAndTintAsync(){return this._workingGlslangAndTintPromise||(this._workingGlslangAndTintPromise=new Promise(e=>{this._initGlslangAsync(this._glslangOptions??this._options?.glslangOptions).then(t=>{this._glslang=t,this._tintWASM=new E,this._tintWASM.initTwgsl(this._twgslOptions??this._options?.twgslOptions).then(()=>{this._glslangAndTintAreFullyLoaded=!0,e()})})})),this._workingGlslangAndTintPromise}initAsync(e,t){return this.uniqueId=K._InstanceId++,this._glslangOptions=e,this._twgslOptions=t,navigator.gpu.requestAdapter(this._options).then(async r=>{if(r){this._adapter=r,this._adapterSupportedExtensions=[],this._adapter.features?.forEach(a=>{this._adapterSupportedExtensions.push(a)}),this._adapterSupportedLimits=this._adapter.limits,this._adapterInfo=this._adapter.info;const n=this._options.deviceDescriptor??{},i=n?.requiredFeatures??(this._options.enableAllFeatures?this._adapterSupportedExtensions:void 0);if(i){const a=i,o=[];for(const u of a)this._adapterSupportedExtensions.indexOf(u)!==-1&&o.push(u);n.requiredFeatures=o}if(this._options.setMaximumLimits&&!n.requiredLimits){n.requiredLimits={};for(const a in this._adapterSupportedLimits)a==="minSubgroupSize"||a==="maxSubgroupSize"||(n.requiredLimits[a]=this._adapterSupportedLimits[a])}return n.label=`BabylonWebGPUDevice${this.uniqueId}`,await this._adapter.requestDevice(n)}else throw"Could not retrieve a WebGPU adapter (adapter is null)."}).then(r=>{this._device=r,this._deviceEnabledExtensions=[],this._device.features?.forEach(i=>{this._deviceEnabledExtensions.push(i)}),this._deviceLimits=r.limits;let n=-1;this._device.addEventListener("uncapturederror",i=>{++n{this._isDisposed||(this._contextWasLost=!0,S.Warn("WebGPU context lost. "+i),this.onContextLostObservable.notifyObservers(this),this._restoreEngineAfterContextLost(async()=>{const a=this.snapshotRenderingMode,o=this.snapshotRendering,u=this.disableCacheSamplers,c=this.disableCacheRenderPipelines,l=this.disableCacheBindGroups,h=this.enableGPUTimingMeasurements;await this.initAsync(this._glslangOptions??this._options?.glslangOptions,this._twgslOptions??this._options?.twgslOptions),this.snapshotRenderingMode=a,this.snapshotRendering=o,this.disableCacheSamplers=u,this.disableCacheRenderPipelines=c,this.disableCacheBindGroups=l,this.enableGPUTimingMeasurements=h,this._currentRenderPass=null}))})}).then(()=>{this._initializeLimits(),this._bufferManager=new ie(this,this._device),this._textureHelper=new Cr(this,this._device,this._bufferManager,this._deviceEnabledExtensions),this._cacheSampler=new z(this._device),this._cacheBindGroups=new T(this._device,this._cacheSampler,this),this._timestampQuery=new Nr(this,this._device,this._bufferManager),this._occlusionQuery=this._device.createQuerySet?new Vr(this,this._device,this._bufferManager):void 0,this._bundleList=new Ie(this._device),this._snapshotRendering=new kr(this,this._snapshotRenderingMode,this._bundleList),this._ubInvertY=this._bufferManager.createBuffer(new Float32Array([-1,0]),C.Uniform|C.CopyDst,"UBInvertY"),this._ubDontInvertY=this._bufferManager.createBuffer(new Float32Array([1,0]),C.Uniform|C.CopyDst,"UBDontInvertY"),this.dbgVerboseLogsForFirstFrames&&this._count===void 0&&(this._count=0,S.Log(["%c frame #"+this._count+" - begin","background: #ffff00"])),this._uploadEncoder=this._device.createCommandEncoder(this._uploadEncoderDescriptor),this._renderEncoder=this._device.createCommandEncoder(this._renderEncoderDescriptor),this._emptyVertexBuffer=new w(this,[0],"",{stride:1,offset:0,size:1,label:"EmptyVertexBuffer"}),this._dummyIndexBuffer=this._bufferManager.createBuffer(new Uint16Array([0,0,0,0]),C.Storage|C.CopyDst,"DummyIndices"),this._cacheRenderPipeline=new k(this._device,this._emptyVertexBuffer),this._depthCullingState=new Pr(this._cacheRenderPipeline),this._stencilStateComposer=new Fr(this._cacheRenderPipeline),this._stencilStateComposer.stencilGlobal=this._stencilState,this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=515,this._depthCullingState.depthMask=!0,this._textureHelper.setCommandEncoder(this._uploadEncoder),this._clearQuad=new Ur(this._device,this,this._emptyVertexBuffer),this._defaultDrawContext=this.createDrawContext(),this._currentDrawContext=this._defaultDrawContext,this._defaultMaterialContext=this.createMaterialContext(),this._currentMaterialContext=this._defaultMaterialContext,this._initializeContextAndSwapChain(),this._initializeMainAttachments(),this.resize()}).catch(r=>{throw S.Error("A fatal error occurred during WebGPU creation/initialization."),r})}_initGlslangAsync(e){if(e=e||{},e={...K._GlslangDefaultOptions,...e},e.glslang)return e.glslang;if(self.glslang)return self.glslang(e.wasmPath);if(e.jsPath&&e.wasmPath)return H.LoadBabylonScriptAsync(e.jsPath).then(()=>self.glslang(H.GetBabylonScriptURL(e.wasmPath)));throw new Error("glslang is not available")}_initializeLimits(){const e=this._deviceEnabledExtensions.indexOf("texture-formats-tier1")>=0;this._caps={maxTexturesImageUnits:this._deviceLimits.maxSampledTexturesPerShaderStage,maxVertexTextureImageUnits:this._deviceLimits.maxSampledTexturesPerShaderStage,maxCombinedTexturesImageUnits:this._deviceLimits.maxSampledTexturesPerShaderStage*2,maxTextureSize:this._deviceLimits.maxTextureDimension2D,maxCubemapTextureSize:this._deviceLimits.maxTextureDimension2D,maxRenderTextureSize:this._deviceLimits.maxTextureDimension2D,maxVertexAttribs:this._deviceLimits.maxVertexAttributes,maxDrawBuffers:8,maxVaryingVectors:this._deviceLimits.maxInterStageShaderVariables,maxFragmentUniformVectors:Math.floor(this._deviceLimits.maxUniformBufferBindingSize/4),maxVertexUniformVectors:Math.floor(this._deviceLimits.maxUniformBufferBindingSize/4),shaderFloatPrecision:23,standardDerivatives:!0,astc:this._deviceEnabledExtensions.indexOf("texture-compression-astc")>=0?!0:void 0,s3tc:this._deviceEnabledExtensions.indexOf("texture-compression-bc")>=0?!0:void 0,pvrtc:null,etc1:null,etc2:this._deviceEnabledExtensions.indexOf("texture-compression-etc2")>=0?!0:void 0,bptc:this._deviceEnabledExtensions.indexOf("texture-compression-bc")>=0?!0:void 0,maxAnisotropy:16,uintIndices:!0,fragmentDepthSupported:!0,highPrecisionShaderSupported:!0,colorBufferFloat:!0,blendFloat:this._deviceEnabledExtensions.indexOf("float32-blendable")>=0,supportFloatTexturesResolve:!1,rg11b10ufColorRenderable:this._deviceEnabledExtensions.indexOf("rg11b10ufloat-renderable")>=0,textureFloat:!0,textureFloatLinearFiltering:this._deviceEnabledExtensions.indexOf("float32-filterable")>=0,textureFloatRender:!0,textureHalfFloat:!0,textureHalfFloatLinearFiltering:!0,textureHalfFloatRender:!0,textureLOD:!0,texelFetch:!0,drawBuffersExtension:!0,depthTextureExtension:!0,vertexArrayObject:!1,instancedArrays:!0,timerQuery:typeof BigUint64Array<"u"&&this._deviceEnabledExtensions.indexOf("timestamp-query")!==-1?!0:void 0,supportOcclusionQuery:typeof BigUint64Array<"u",canUseTimestampForTimerQuery:!0,multiview:!1,oculusMultiview:!1,parallelShaderCompile:void 0,blendMinMax:!0,maxMSAASamples:4,canUseGLInstanceID:!0,canUseGLVertexID:!0,supportComputeShaders:!0,supportSRGBBuffers:!0,supportTransformFeedbacks:!1,textureMaxLevel:!0,texture2DArrayMaxLayerCount:this._deviceLimits.maxTextureArrayLayers,disableMorphTargetTexture:!1,textureNorm16:e,blendParametersPerTarget:!0,dualSourceBlending:!0},this._features={forceBitmapOverHTMLImageElement:!0,supportRenderAndCopyToLodForFloatTextures:!0,supportDepthStencilTexture:!0,supportShadowSamplers:!0,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:!0,trackUbosInFrame:!0,checkUbosContentBeforeUpload:!0,supportCSM:!0,basisNeedsPOT:!1,support3DTextures:!0,needTypeSuffixInShaderConstants:!0,supportMSAA:!0,supportSSAO2:!0,supportIBLShadows:!0,supportExtendedTextureFormats:!0,supportSwitchCaseInShader:!0,supportSyncTextureRead:!1,needsInvertingBitmap:!1,useUBOBindingCache:!1,needShaderCodeInlining:!0,needToAlwaysBindUniformBuffers:!0,supportRenderPasses:!0,supportSpriteInstancing:!0,forceVertexBufferStrideAndOffsetMultiple4Bytes:!0,_checkNonFloatVertexBuffersDontRecreatePipelineContext:!0,_collectUbosUpdatedInFrame:!1},this._alphaState=new Wt(this._caps.blendParametersPerTarget)}_initializeContextAndSwapChain(){if(!this._renderingCanvas)throw"The rendering canvas has not been set!";this._context=this._renderingCanvas.getContext("webgpu"),this._configureContext(),this._colorFormat=this._options.swapChainFormat,this._mainRenderPassWrapper.colorAttachmentGPUTextures=[new se(this)],this._mainRenderPassWrapper.colorAttachmentGPUTextures[0].format=this._colorFormat,this._setColorFormat(this._mainRenderPassWrapper)}_initializeMainAttachments(){if(!this._bufferManager)return;this.flushFramebuffer(),this._mainTextureExtends={width:this.getRenderWidth(!0),height:this.getRenderHeight(!0),depthOrArrayLayers:1};const e=new Float32Array([this.getRenderHeight(!0)]);this._bufferManager.setSubData(this._ubInvertY,4,e),this._bufferManager.setSubData(this._ubDontInvertY,4,e);let t;if(this._options.antialias){const i={label:`Texture_MainColor_${this._mainTextureExtends.width}x${this._mainTextureExtends.height}_antialiasing`,size:this._mainTextureExtends,mipLevelCount:1,sampleCount:this._mainPassSampleCount,dimension:"2d",format:this._options.swapChainFormat,usage:16};this._mainTexture&&this._textureHelper.releaseTexture(this._mainTexture),this._mainTexture=this._device.createTexture(i),t=[{view:this._mainTexture.createView({label:"TextureView_MainColor_antialiasing",dimension:"2d",format:this._options.swapChainFormat,mipLevelCount:1,arrayLayerCount:1}),clearValue:new de(0,0,0,1),loadOp:"clear",storeOp:"store"}]}else t=[{view:void 0,clearValue:new de(0,0,0,1),loadOp:"clear",storeOp:"store"}];this._mainRenderPassWrapper.depthTextureFormat=this.isStencilEnable?"depth24plus-stencil8":"depth32float",this._setDepthTextureFormat(this._mainRenderPassWrapper),this._setColorFormat(this._mainRenderPassWrapper);const r={label:`Texture_MainDepthStencil_${this._mainTextureExtends.width}x${this._mainTextureExtends.height}`,size:this._mainTextureExtends,mipLevelCount:1,sampleCount:this._mainPassSampleCount,dimension:"2d",format:this._mainRenderPassWrapper.depthTextureFormat,usage:16};this._depthTexture&&this._textureHelper.releaseTexture(this._depthTexture),this._depthTexture=this._device.createTexture(r);const n={view:this._depthTexture.createView({label:`TextureView_MainDepthStencil_${this._mainTextureExtends.width}x${this._mainTextureExtends.height}`,dimension:"2d",format:this._depthTexture.format,mipLevelCount:1,arrayLayerCount:1}),depthClearValue:this._clearDepthValue,depthLoadOp:"clear",depthStoreOp:"store",stencilClearValue:this._clearStencilValue,stencilLoadOp:this.isStencilEnable?"clear":void 0,stencilStoreOp:this.isStencilEnable?"store":void 0};this._mainRenderPassWrapper.renderPassDescriptor={label:"MainRenderPass",colorAttachments:t,depthStencilAttachment:n},this.beginFrame(),this._startMainRenderPass(!0,null,!0,!1),this._endCurrentRenderPass(),this.endFrame(),this._frameId--}_sharedInit(e){super._sharedInit(e),qt(this,e,this._creationOptions)}_configureContext(){this._context.configure({device:this._device,format:this._options.swapChainFormat,usage:17,alphaMode:this.premultipliedAlpha?"premultiplied":"opaque"})}resizeImageBitmap(e,t,r){return Qt(this,e,t,r)}async _createImageBitmapFromSource(e,t){return await Ht(this,e,t)}switchFullscreen(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)}enterFullscreen(e){this.isFullscreen||(this._pointerLockRequested=e,this._renderingCanvas&&Yt(this._renderingCanvas))}exitFullscreen(){this.isFullscreen&&zt()}enterPointerlock(){this._renderingCanvas&&jt(this._renderingCanvas)}exitPointerlock(){Kt()}_rebuildBuffers(){super._rebuildBuffers();for(const e of this._storageBuffers)e.getBuffer().engineId!==this.uniqueId&&e._rebuild()}_restoreEngineAfterContextLost(e){k.ResetCache(),T.ResetCache();const t=n=>{for(const i of n){for(const a of i.meshes){const o=a.subMeshes;if(o)for(const u of o)u._drawWrappers=[]}for(const a of i.materials)a._materialContext?.reset()}};t(this.scenes),t(this._virtualScenes);const r=[];for(const n of this._uniformBuffers)n.name.indexOf("leftOver")<0&&r.push(n);this._uniformBuffers=r,super._restoreEngineAfterContextLost(e)}setSize(e,t,r=!1){return super.setSize(e,t,r)?(this.dbgVerboseLogsForFirstFrames&&(this._count===void 0&&(this._count=0),(!this._count||this._count=0,i=t.indexOf("#define DISABLE_UNIFORMITY_ANALYSIS")>=0,a=r===0?this._compileRawShaderToSpirV(e,"vertex"):e,o=r===0?this._compileRawShaderToSpirV(t,"fragment"):t;return this._createPipelineStageDescriptor(a,o,r,n,i)}_compilePipelineStageDescriptor(e,t,r,n){this.onBeforeShaderCompilationObservable.notifyObservers(this);const i=e.indexOf("#define DISABLE_UNIFORMITY_ANALYSIS")>=0,a=t.indexOf("#define DISABLE_UNIFORMITY_ANALYSIS")>=0,o=`#version 450 +`,u=n===0?this._compileShaderToSpirV(e,"vertex",r,o):this._getWGSLShader(e,"vertex",r),c=n===0?this._compileShaderToSpirV(t,"fragment",r,o):this._getWGSLShader(t,"fragment",r),l=this._createPipelineStageDescriptor(u,c,n,i,a);return this.onAfterShaderCompilationObservable.notifyObservers(this),l}createRawShaderProgram(){throw"Not available on WebGPU"}createShaderProgram(){throw"Not available on WebGPU"}inlineShaderCode(e){const t=new ce(e);return t.debug=!1,t.processCode(),t.code}createPipelineContext(e){return new rr(e,this)}createMaterialContext(){return new oe}createDrawContext(){return new ue(this._bufferManager,this._dummyIndexBuffer)}async _preparePipelineContextAsync(e,t,r,n,i,a,o,u,c,l,h){const d=e,p=d.shaderProcessingContext.shaderLanguage;p===0&&!this._glslangAndTintAreFullyLoaded&&await this.prepareGlslangAndTintAsync(),this.dbgShowShaderCode&&(S.Log(["defines",u]),S.Log(t),S.Log(r),S.Log("***********************************************")),d.sources={fragment:r,vertex:t,rawVertex:i,rawFragment:a},n?d.stages=this._compileRawPipelineStageDescriptor(t,r,p):d.stages=this._compilePipelineStageDescriptor(t,r,u,p),h()}getAttributes(e,t){const r=new Array(t.length),n=e;for(let i=0;i0,a.is3D=c>0,a.isCube=i.isCube,a._cachedWrapU=0,a._cachedWrapV=0,a._useSRGBBuffer=i.useSRGBBuffer,a.label=i.label,this._internalTexturesCache.push(a),!r){const h=!i.generateMipMaps&&i.createMipMaps;h&&(a.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(a,o,u,a.depth||1,i.creationFlags),h&&(a.generateMipMaps=!1)}return a}createTexture(e,t,r,n,i=3,a=null,o=null,u=null,c=null,l=null,h=null,d,p,_,g){return this._createTextureBase(e,t,r,n,i,a,o,(f,m,b,x,B,y,M,R)=>{const v=x;if(f.baseWidth=v.width,f.baseHeight=v.height,f.width=v.width,f.height=v.height,f.format=f.format!==-1?f.format:l??5,f.type=f.type!==-1?f.type:0,f._creationFlags=_??0,R(f.width,f.height,v,m,f,()=>{}),f._hardwareTexture?.underlyingResource)!y&&!M&&this._generateMipmaps(f,this._uploadEncoder);else{const L=this._textureHelper.createGPUTextureForInternalTexture(f,v.width,v.height,void 0,_);I.IsImageBitmap(v)&&(this._textureHelper.updateTexture(v,f,v.width,v.height,f.depth,L.format,0,0,B,!1,0,0),!y&&!M&&this._generateMipmaps(f,this._uploadEncoder))}b&&b.removePendingData(f),f.isReady=!0,f.onLoadedObservable.notifyObservers(f),f.onLoadedObservable.clear()},()=>!1,u,c,l,h,d,p,g)}wrapWebGPUTexture(e){const t=new se(this,e),r=new q(this,0,!0);return r._hardwareTexture=t,r.isReady=!0,r}wrapWebGLTexture(){throw new Error("wrapWebGLTexture is not supported, use wrapWebGPUTexture instead.")}_getUseSRGBBuffer(e,t){return e&&this._caps.supportSRGBBuffers}_unpackFlipY(e){}updateTextureSamplingMode(e,t,r=!1){r&&(t.generateMipMaps=!0,this._generateMipmaps(t)),t.samplingMode=e}updateTextureWrappingMode(e,t,r=null,n=null){t!==null&&(e._cachedWrapU=t),r!==null&&(e._cachedWrapV=r),(e.is2DArray||e.is3D)&&n!==null&&(e._cachedWrapR=n)}updateTextureDimensions(e,t,r,n=1){if(!e._hardwareTexture||e.width===t&&e.height===r&&e.depth===n)return;const i=e._hardwareTexture.textureAdditionalUsages;e._hardwareTexture.release(),this._textureHelper.createGPUTextureForInternalTexture(e,t,r,n,i)}_setInternalTexture(e,t,r){if(r=r??e,this._currentEffect){const i=this._currentEffect._pipelineContext.shaderProcessingContext.availableTextures[r];if(this._currentMaterialContext.setTexture(e,t),i&&i.autoBindSampler){const a=r+"Sampler";this._currentMaterialContext.setSampler(a,t)}}}createPrefilteredCubeTexture(e,t,r,n,i=null,a=null,o,u=null,c=!0){const l=h=>{if(!h){i&&i(null);return}const d=h.texture;c?h.info.sphericalPolynomial&&(d._sphericalPolynomial=h.info.sphericalPolynomial):d._sphericalPolynomial=d._sphericalPolynomial??new tr,d._source=9,i&&i(d)};return this.createCubeTexture(e,t,null,!1,l,a,o,u,c,r,n)}setTexture(e,t,r,n){this._setTexture(e,r,!1,!1,n,n)}setTextureArray(e,t,r,n){for(let i=0;i1,c=a._depthStencilTexture,l=c?._hardwareTexture,h=l?.underlyingResource;let d,p;if(u){const y=l?.getMSAATexture(o);d=y?.createView(this._rttRenderPassWrapper.depthAttachmentViewDescriptor),p=y?.format}!d&&h&&(d=h.createView(this._rttRenderPassWrapper.depthAttachmentViewDescriptor)),!p&&l&&(p=l.format);const _=p?I.HasStencilAspect(p):!1,g=p?I.HasDepthAspect(p):!1,f=[];this.useReverseDepthBuffer&&this.setDepthFunctionToGreaterOrEqual();const m=Hr;r&&(m.r=r.r*255,m.g=r.g*255,m.b=r.b*255,m.a=r.a*255);const b=t&&r,x=t&&n,B=t&&i;if(a._attachments&&a.isMulti){(!this._mrtAttachments||this._mrtAttachments.length===0)&&(this._mrtAttachments=a._defaultAttachments);for(let y=0;y{const o=()=>{e.mapAsync(1,0,t).then(()=>{const u=e.getMappedRange(0,t);let c=r;if(c===void 0)c=new Uint8Array(t),c.set(new Uint8Array(u));else{const l=c.constructor;c=new l(c.buffer),c.set(new l(u))}e.unmap(),this._bufferManager.releaseBuffer(e),i(c)},u=>{this.isDisposed?i(new Uint8Array):a(u)})};n?(this.flushFramebuffer(),o()):this.onEndFrameObservable.addOnce(()=>{o()})})}readFromStorageBuffer(e,t,r,n,i){r=r||e.capacity;const a=this._bufferManager.createRawBuffer(r,C.MapRead|C.CopyDst,void 0,"TempReadFromStorageBuffer");return this._renderEncoder.copyBufferToBuffer(e.underlyingResource,t??0,a,0,r),this._readFromGPUBuffer(a,r,n,i)}readFromMultipleStorageBuffers(e,t,r,n,i){r=r||e[0].capacity;const a=this._bufferManager.createRawBuffer(r*e.length,C.MapRead|C.CopyDst,void 0,"TempReadFromMultipleStorageBuffers");for(let o=0;o{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let t,r;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,r=globalThis.innerHeight;else{const{clientWidth:n,clientHeight:i}=this._resizeTo;t=n,r=i}this.renderer.resize(t,r),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Ee.extension=p.Application;class Ve{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{configurable:!0,set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,ht.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?de.shared:new de,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}Ve.extension=p.Application;var Rt=`in vec2 aPosition; +out vec2 vTextureCoord; + +uniform vec4 uInputSize; +uniform vec4 uOutputFrame; +uniform vec4 uOutputTexture; + +vec4 filterVertexPosition( void ) +{ + vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; + + position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +vec2 filterTextureCoord( void ) +{ + return aPosition * (uOutputFrame.zw * uInputSize.zw); +} + +void main(void) +{ + gl_Position = filterVertexPosition(); + vTextureCoord = filterTextureCoord(); +} +`,Ut=`in vec2 vTextureCoord; +out vec4 finalColor; +uniform sampler2D uTexture; +void main() { + finalColor = texture(uTexture, vTextureCoord); +} +`,me=`struct GlobalFilterUniforms { + uInputSize: vec4, + uInputPixel: vec4, + uInputClamp: vec4, + uOutputFrame: vec4, + uGlobalFrame: vec4, + uOutputTexture: vec4, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler: sampler; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv: vec2 +}; + +fn filterVertexPosition(aPosition: vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord(aPosition: vec2) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +@vertex +fn mainVertex( + @location(0) aPosition: vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition) + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, +) -> @location(0) vec4 { + return textureSample(uTexture, uSampler, uv); +} +`;class Bt extends ft{constructor(){const e=Re.from({vertex:{source:me,entryPoint:"mainVertex"},fragment:{source:me,entryPoint:"mainFragment"},name:"passthrough-filter"}),t=Ue.from({vertex:Rt,fragment:Ut,name:"passthrough-filter"});super({gpuProgram:e,glProgram:t})}}class We{constructor(e){this._renderer=e}push(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}}We.extension={type:[p.WebGLPipes,p.WebGPUPipes,p.CanvasPipes],name:"filter"};const ge=new P;function Mt(o,e){e.clear();const t=e.matrix;for(let r=0;r"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new Be({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){const t=this.renderer,r=e.filterEffect.filters,n=this._pushFilterData();n.skip=!1,n.filters=r,n.container=e.container,n.outputRenderSurface=t.renderTarget.renderSurface;const i=t.renderTarget.renderTarget.colorTexture.source,s=i.resolution,a=i.antialias;if(r.every(f=>!f.enabled)){n.skip=!0;return}const l=n.bounds;if(this._calculateFilterArea(e,l),this._calculateFilterBounds(n,t.renderTarget.rootViewPort,a,s,1),n.skip)return;const u=this._getPreviousFilterData(),h=this._findFilterResolution(s);let c=0,d=0;u&&(c=u.bounds.minX,d=u.bounds.minY),this._calculateGlobalFrame(n,c,d,h,i.width,i.height),this._setupFilterTextures(n,l,t,u)}generateFilteredTexture({texture:e,filters:t}){const r=this._pushFilterData();this._activeFilterData=r,r.skip=!1,r.filters=t;const n=e.source,i=n.resolution,s=n.antialias;if(t.every(f=>!f.enabled))return r.skip=!0,e;const a=r.bounds;if(a.addRect(e.frame),this._calculateFilterBounds(r,a.rectangle,s,i,0),r.skip)return e;const l=i;this._calculateGlobalFrame(r,0,0,l,n.width,n.height),r.outputRenderSurface=w.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=R.EMPTY,r.inputTexture=e,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,!0);const d=r.outputRenderSurface;return d.source.alphaMode="premultiplied-alpha",d}pop(){const e=this.renderer,t=this._popFilterData();t.skip||(e.globalUniforms.pop(),e.renderTarget.finishRenderPass(),this._activeFilterData=t,this._applyFiltersToTexture(t,!1),t.blendRequired&&w.returnTexture(t.backTexture),w.returnTexture(t.inputTexture))}getBackTexture(e,t,r){const n=e.colorTexture.source._resolution,i=w.getOptimalTexture(t.width,t.height,n,!1);let s=t.minX,a=t.minY;r&&(s-=r.minX,a-=r.minY),s=Math.floor(s*n),a=Math.floor(a*n);const l=Math.ceil(t.width*n),u=Math.ceil(t.height*n);return this.renderer.renderTarget.copyToTexture(e,i,{x:s,y:a},{width:l,height:u},{x:0,y:0}),i}applyFilter(e,t,r,n){const i=this.renderer,s=this._activeFilterData,l=s.outputRenderSurface===r,u=i.renderTarget.rootRenderTarget.colorTexture.source._resolution,h=this._findFilterResolution(u);let c=0,d=0;if(l){const m=this._findPreviousFilterOffset();c=m.x,d=m.y}this._updateFilterUniforms(t,r,s,c,d,h,l,n);const f=e.enabled?e:this._getPassthroughFilter();this._setupBindGroupsAndRender(f,t,i)}calculateSpriteMatrix(e,t){const r=this._activeFilterData,n=e.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),i=t.worldTransform.copyTo(P.shared),s=t.renderGroup||t.parentRenderGroup;return s&&s.cacheToLocalTransform&&i.prepend(s.cacheToLocalTransform),i.invert(),n.prepend(i),n.scale(1/t.texture.orig.width,1/t.texture.orig.height),n.translate(t.anchor.x,t.anchor.y),n}destroy(){this._passthroughFilter?.destroy(!0),this._passthroughFilter=null}_getPassthroughFilter(){return this._passthroughFilter??(this._passthroughFilter=new Bt),this._passthroughFilter}_setupBindGroupsAndRender(e,t,r){if(r.renderPipes.uniformBatch){const n=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(n,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:Gt,shader:e,state:e._state,topology:"triangle-list"}),r.type===ne.WEBGL&&r.renderTarget.finishRenderPass()}_setupFilterTextures(e,t,r,n){if(e.backTexture=R.EMPTY,e.inputTexture=w.getOptimalTexture(t.width,t.height,e.resolution,e.antialias),e.blendRequired){r.renderTarget.finishRenderPass();const i=r.renderTarget.getRenderTarget(e.outputRenderSurface);e.backTexture=this.getBackTexture(i,t,n?.bounds)}r.renderTarget.bind(e.inputTexture,!0),r.globalUniforms.push({offset:t})}_calculateGlobalFrame(e,t,r,n,i,s){const a=e.globalFrame;a.x=t*n,a.y=r*n,a.width=i*n,a.height=s*n}_updateFilterUniforms(e,t,r,n,i,s,a,l){const u=this._filterGlobalUniforms.uniforms,h=u.uOutputFrame,c=u.uInputSize,d=u.uInputPixel,f=u.uInputClamp,m=u.uGlobalFrame,x=u.uOutputTexture;a?(h[0]=r.bounds.minX-n,h[1]=r.bounds.minY-i):(h[0]=0,h[1]=0),h[2]=e.frame.width,h[3]=e.frame.height,c[0]=e.source.width,c[1]=e.source.height,c[2]=1/c[0],c[3]=1/c[1],d[0]=e.source.pixelWidth,d[1]=e.source.pixelHeight,d[2]=1/d[0],d[3]=1/d[1],f[0]=.5*d[2],f[1]=.5*d[3],f[2]=e.frame.width*c[2]-.5*d[2],f[3]=e.frame.height*c[3]-.5*d[3];const g=this.renderer.renderTarget.rootRenderTarget.colorTexture;m[0]=n*s,m[1]=i*s,m[2]=g.source.width*s,m[3]=g.source.height*s,t instanceof R&&(t.source.resource=null);const _=this.renderer.renderTarget.getRenderTarget(t);this.renderer.renderTarget.bind(t,!!l),t instanceof R?(x[0]=t.frame.width,x[1]=t.frame.height):(x[0]=_.width,x[1]=_.height),x[2]=_.isRoot?-1:1,this._filterGlobalUniforms.update()}_findFilterResolution(e){let t=this._filterStackIndex-1;for(;t>0&&this._filterStack[t].skip;)--t;return t>0&&this._filterStack[t].inputTexture?this._filterStack[t].inputTexture.source._resolution:e}_findPreviousFilterOffset(){let e=0,t=0,r=this._filterStackIndex;for(;r>0;){r--;const n=this._filterStack[r];if(!n.skip){e=n.bounds.minX,t=n.bounds.minY;break}}return{x:e,y:t}}_calculateFilterArea(e,t){if(e.renderables?Mt(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){const n=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;n&&t.applyMatrix(n)}}_applyFiltersToTexture(e,t){const r=e.inputTexture,n=e.bounds,i=e.filters,s=e.firstEnabledIndex,a=e.lastEnabledIndex;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(e.backTexture.source,3),s===a)i[s].apply(this,r,e.outputRenderSurface,t);else{let l=e.inputTexture;const u=w.getOptimalTexture(n.width,n.height,l.source._resolution,!1);let h=u;for(let c=s;c0&&(t--,e=this._filterStack[t],!!e.skip););return e}_pushFilterData(){let e=this._filterStack[this._filterStackIndex];return e||(e=this._filterStack[this._filterStackIndex]=new Dt),this._filterStackIndex++,e}}Le.extension={type:[p.WebGLSystem,p.WebGPUSystem],name:"filter"};const Ye=class He extends re{constructor(...e){let t=e[0]??{};t instanceof Float32Array&&(I(Ge,"use new MeshGeometry({ positions, uvs, indices }) instead"),t={positions:t,uvs:e[1],indices:e[2]}),t={...He.defaultOptions,...t};const r=t.positions||new Float32Array([0,0,1,0,1,1,0,1]);let n=t.uvs;n||(t.positions?n=new Float32Array(r.length):n=new Float32Array([0,0,1,0,1,1,0,1]));const i=t.indices||new Uint32Array([0,1,2,0,2,3]),s=t.shrinkBuffersToFit,a=new A({data:r,label:"attribute-mesh-positions",shrinkToFit:s,usage:C.VERTEX|C.COPY_DST}),l=new A({data:n,label:"attribute-mesh-uvs",shrinkToFit:s,usage:C.VERTEX|C.COPY_DST}),u=new A({data:i,label:"index-mesh-buffer",shrinkToFit:s,usage:C.INDEX|C.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:8,offset:0},aUV:{buffer:l,format:"float32x2",stride:8,offset:0}},indexBuffer:u,topology:t.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(e){this.attributes.aPosition.buffer.data=e}get uvs(){return this.attributes.aUV.buffer.data}set uvs(e){this.attributes.aUV.buffer.data=e}get indices(){return this.indexBuffer.data}set indices(e){this.indexBuffer.data=e}};Ye.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let ae=Ye,U=null,S=null;function At(o,e){U||(U=L.get().createCanvas(256,128),S=U.getContext("2d",{willReadFrequently:!0}),S.globalCompositeOperation="copy",S.globalAlpha=1),(U.width${e.cssStyle};
          ${o}
          `,n.setAttribute("style","transform-origin: top left; display: inline-block"),t&&(i.textContent=t),document.body.appendChild(s);const a=n.getBoundingClientRect();s.remove();const l=e.padding*2;return{width:a.width-l,height:a.height-l}}class It{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(e=>{W.return(e)}),this.batches.length=0}}class Ke{constructor(e,t){this.state=V.for2d(),this.renderer=e,this._adaptor=t,this.renderer.runners.contextChange.add(this),this._managedGraphics=new B({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){const t=e.context,r=!!e._gpuData,n=this.renderer.graphicsContext.updateGpuContext(t);return!!(n.isBatchable||r!==n.isBatchable)}addRenderable(e,t){const r=this.renderer.graphicsContext.updateGpuContext(e.context);e.didViewUpdate&&this._rebuild(e),r.isBatchable?this._addToBatcher(e,t):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){const r=this._getGpuDataForRenderable(e).batches;for(let n=0;n{const a=W.get(mt);return s.copyTo(a),a.renderable=e,a.roundPixels=i,a})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}Ke.extension={type:[p.WebGLPipes,p.WebGPUPipes,p.CanvasPipes],name:"graphics"};const $e=class je extends ae{constructor(...e){super({});let t=e[0]??{};typeof t=="number"&&(I(Ge,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),t={width:t,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(t)}build(e){e={...je.defaultOptions,...e},this.verticesX=this.verticesX??e.verticesX,this.verticesY=this.verticesY??e.verticesY,this.width=this.width??e.width,this.height=this.height??e.height;const t=this.verticesX*this.verticesY,r=[],n=[],i=[],s=this.verticesX-1,a=this.verticesY-1,l=this.width/s,u=this.height/a;for(let c=0;c"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Be({0:this.localUniforms}),this.renderer=e,this._adaptor=t,this._adaptor.init()}validateRenderable(e){const t=this._getMeshData(e),r=t.batched,n=e.batched;if(t.batched=n,r!==n)return!0;if(n){const i=e._geometry;if(i.indices.length!==t.indexSize||i.positions.length!==t.vertexSize)return t.indexSize=i.indices.length,t.vertexSize=i.positions.length,!0;const s=this._getBatchableMesh(e);return s.texture.uid!==e._texture.uid&&(s._textureMatrixUpdateId=-1),!s._batcher.checkAndUpdateTexture(s,e._texture)}return!1}addRenderable(e,t){const r=this.renderer.renderPipes.batch,n=this._getMeshData(e);if(e.didViewUpdate&&(n.indexSize=e._geometry.indices?.length,n.vertexSize=e._geometry.positions?.length),n.batched){const i=this._getBatchableMesh(e);i.setTexture(e._texture),i.geometry=e._geometry,r.addToBatch(i,t)}else r.break(t),t.add(e)}updateRenderable(e){if(e.batched){const t=this._getBatchableMesh(e);t.setTexture(e._texture),t.geometry=e._geometry,t._batcher.updateElement(t)}}execute(e){if(!e.isRenderable)return;e.state.blendMode=ie(e.groupBlendMode,e.texture._source);const t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),Y(e.groupColorAlpha,t.uniforms.uColor,0),this._adaptor.execute(this,e)}_getMeshData(e){var t,r;return(t=e._gpuData)[r=this.renderer.uid]||(t[r]=new we),e._gpuData[this.renderer.uid].meshData||this._initMeshData(e)}_initMeshData(e){return e._gpuData[this.renderer.uid].meshData={batched:e.batched,indexSize:0,vertexSize:0},e._gpuData[this.renderer.uid].meshData}_getBatchableMesh(e){var t,r;return(t=e._gpuData)[r=this.renderer.uid]||(t[r]=new we),e._gpuData[this.renderer.uid].batchableMesh||this._initBatchableMesh(e)}_initBatchableMesh(e){const t=new oe;return t.renderable=e,t.setTexture(e._texture),t.transform=e.groupTransform,t.roundPixels=this.renderer._roundPixels|e._roundPixels,e._gpuData[this.renderer.uid].batchableMesh=t,t}destroy(){this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}}Ne.extension={type:[p.WebGLPipes,p.WebGPUPipes,p.CanvasPipes],name:"mesh"};class Vt{execute(e,t){const r=e.state,n=e.renderer,i=t.shader||e.defaultShader;i.resources.uTexture=t.texture._source,i.resources.uniforms=e.localUniforms;const s=n.gl,a=e.getBuffers(t);n.shader.bind(i),n.state.set(r),n.geometry.bind(a.geometry,i.glProgram);const u=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;s.drawElements(s.TRIANGLES,t.particleChildren.length*6,u,0)}}class Wt{execute(e,t){const r=e.renderer,n=t.shader||e.defaultShader;n.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(e.localUniforms,!0),n.groups[1]=r.texture.getTextureBindGroup(t.texture);const i=e.state,s=e.getBuffers(t);r.encoder.draw({geometry:s.geometry,shader:t.shader||e.defaultShader,state:i,size:t.particleChildren.length*6})}}function Ce(o,e=null){const t=o*6;if(t>65535?e||(e=new Uint32Array(t)):e||(e=new Uint16Array(t)),e.length!==t)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);for(let r=0,n=0;rthis._size&&(t=!0,this._size=Math.max(e.length,this._size*1.5|0),this.staticAttributeBuffer=new k(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new k(this._size*this._dynamicStride*4*4),this.indexBuffer=Ce(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));const r=this.dynamicAttributeBuffer;if(this._dynamicUpload(e,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,e.length*this._dynamicStride*4,!0),t){const n=this.staticAttributeBuffer;this._staticUpload(e,n.float32View,n.uint32View),this._staticBuffer.setDataWithSize(n.float32View,e.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}function Ht(o){const e=[];for(const t in o){const r=o[t];e.push(t,r.code,r.dynamic?"d":"s")}return e.join("_")}var Xt=`varying vec2 vUV; +varying vec4 vColor; + +uniform sampler2D uTexture; + +void main(void){ + vec4 color = texture2D(uTexture, vUV) * vColor; + gl_FragColor = color; +}`,Kt=`attribute vec2 aVertex; +attribute vec2 aUV; +attribute vec4 aColor; + +attribute vec2 aPosition; +attribute float aRotation; + +uniform mat3 uTranslationMatrix; +uniform float uRound; +uniform vec2 uResolution; +uniform vec4 uColor; + +varying vec2 vUV; +varying vec4 vColor; + +vec2 roundPixels(vec2 position, vec2 targetSize) +{ + return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; +} + +void main(void){ + float cosRotation = cos(aRotation); + float sinRotation = sin(aRotation); + float x = aVertex.x * cosRotation - aVertex.y * sinRotation; + float y = aVertex.x * sinRotation + aVertex.y * cosRotation; + + vec2 v = vec2(x, y); + v = v + aPosition; + + gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0); + + if(uRound == 1.0) + { + gl_Position.xy = roundPixels(gl_Position.xy, uResolution); + } + + vUV = aUV; + vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor; +} +`,Se=` +struct ParticleUniforms { + uTranslationMatrix:mat3x3, + uColor:vec4, + uRound:f32, + uResolution:vec2, +}; + +fn roundPixels(position: vec2, targetSize: vec2) -> vec2 +{ + return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; +} + +@group(0) @binding(0) var uniforms: ParticleUniforms; + +@group(1) @binding(0) var uTexture: texture_2d; +@group(1) @binding(1) var uSampler : sampler; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2, + @location(1) color : vec4, + }; +@vertex +fn mainVertex( + @location(0) aVertex: vec2, + @location(1) aPosition: vec2, + @location(2) aUV: vec2, + @location(3) aColor: vec4, + @location(4) aRotation: f32, +) -> VSOutput { + + let v = vec2( + aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation), + aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation) + ) + aPosition; + + var position = vec4((uniforms.uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0); + + if(uniforms.uRound == 1.0) { + position = vec4(roundPixels(position.xy, uniforms.uResolution), position.zw); + } + + let vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uniforms.uColor; + + return VSOutput( + position, + aUV, + vColor, + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @location(1) color: vec4, + @builtin(position) position: vec4, +) -> @location(0) vec4 { + + var sample = textureSample(uTexture, uSampler, uv) * color; + + return sample; +}`;class $t extends se{constructor(){const e=Ue.from({vertex:Kt,fragment:Xt}),t=Re.from({fragment:{source:Se,entryPoint:"mainFragment"},vertex:{source:Se,entryPoint:"mainVertex"}});super({glProgram:e,gpuProgram:t,resources:{uTexture:R.WHITE.source,uSampler:new Z({}),uniforms:{uTranslationMatrix:{value:new P,type:"mat3x3"},uColor:{value:new De(16777215),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}}})}}class qe{constructor(e,t){this.state=V.for2d(),this.localUniforms=new G({uTranslationMatrix:{value:new P,type:"mat3x3"},uColor:{value:new Float32Array(4),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}),this.renderer=e,this.adaptor=t,this.defaultShader=new $t,this.state=V.for2d(),this._managedContainers=new B({renderer:e,type:"renderable",name:"particleContainer"})}validateRenderable(e){return!1}addRenderable(e,t){this.renderer.renderPipes.batch.break(t),t.add(e)}getBuffers(e){return e._gpuData[this.renderer.uid]||this._initBuffer(e)}_initBuffer(e){return e._gpuData[this.renderer.uid]=new Yt({size:e.particleChildren.length,properties:e._properties}),this._managedContainers.add(e),e._gpuData[this.renderer.uid]}updateRenderable(e){}execute(e){const t=e.particleChildren;if(t.length===0)return;const r=this.renderer,n=this.getBuffers(e);e.texture||(e.texture=t[0].texture);const i=this.state;n.update(t,e._childrenDirty),e._childrenDirty=!1,i.blendMode=ie(e.blendMode,e.texture._source);const s=this.localUniforms.uniforms,a=s.uTranslationMatrix;e.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),s.uResolution=r.globalUniforms.globalUniformData.resolution,s.uRound=r._roundPixels|e._roundPixels,Y(e.groupColorAlpha,s.uColor,0),this.adaptor.execute(this,e)}destroy(){this._managedContainers.destroy(),this.renderer=null,this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}class Qe extends qe{constructor(e){super(e,new Vt)}}Qe.extension={type:[p.WebGLPipes],name:"particle"};class Je extends qe{constructor(e){super(e,new Wt)}}Je.extension={type:[p.WebGPUPipes],name:"particle"};const Ze=class et extends Et{constructor(e={}){e={...et.defaultOptions,...e},super({width:e.width,height:e.height,verticesX:4,verticesY:4}),this.update(e)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this._anchorX=e.anchor?.x,this._anchorY=e.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){const e=this.positions,{width:t,height:r,_leftWidth:n,_rightWidth:i,_topHeight:s,_bottomHeight:a,_anchorX:l,_anchorY:u}=this,h=n+i,c=t>h?1:t/h,d=s+a,f=r>d?1:r/d,m=Math.min(c,f),x=l*t,g=u*r;e[0]=e[8]=e[16]=e[24]=-x,e[2]=e[10]=e[18]=e[26]=n*m-x,e[4]=e[12]=e[20]=e[28]=t-i*m-x,e[6]=e[14]=e[22]=e[30]=t-x,e[1]=e[3]=e[5]=e[7]=-g,e[9]=e[11]=e[13]=e[15]=s*m-g,e[17]=e[19]=e[21]=e[23]=r-a*m-g,e[25]=e[27]=e[29]=e[31]=r-g,this.getBuffer("aPosition").update()}updateUvs(){const e=this.uvs;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1;const t=1/this._originalWidth,r=1/this._originalHeight;e[2]=e[10]=e[18]=e[26]=t*this._leftWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[4]=e[12]=e[20]=e[28]=1-t*this._rightWidth,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}};Ze.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};let jt=Ze;class Nt extends oe{constructor(){super(),this.geometry=new jt}destroy(){this.geometry.destroy()}}class tt{constructor(e){this._renderer=e,this._managedSprites=new B({renderer:e,type:"renderable",name:"nineSliceSprite"})}addRenderable(e,t){const r=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){const t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}_updateBatchableSprite(e,t){t.geometry.update(e),t.setTexture(e._texture)}_getGpuSprite(e){return e._gpuData[this._renderer.uid]||this._initGPUSprite(e)}_initGPUSprite(e){const t=e._gpuData[this._renderer.uid]=new Nt,r=t;return r.renderable=e,r.transform=e.groupTransform,r.texture=e._texture,r.roundPixels=this._renderer._roundPixels|e._roundPixels,this._managedSprites.add(e),e.didViewUpdate||this._updateBatchableSprite(e,r),t}destroy(){this._managedSprites.destroy(),this._renderer=null}}tt.extension={type:[p.WebGLPipes,p.WebGPUPipes,p.CanvasPipes],name:"nineSliceSprite"};const qt={name:"tiling-bit",vertex:{header:` + struct TilingUniforms { + uMapCoord:mat3x3, + uClampFrame:vec4, + uClampOffset:vec2, + uTextureTransform:mat3x3, + uSizeAnchor:vec4 + }; + + @group(2) @binding(0) var tilingUniforms: TilingUniforms; + @group(2) @binding(1) var uTexture: texture_2d; + @group(2) @binding(2) var uSampler: sampler; + `,main:` + uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy; + + position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy; + `},fragment:{header:` + struct TilingUniforms { + uMapCoord:mat3x3, + uClampFrame:vec4, + uClampOffset:vec2, + uTextureTransform:mat3x3, + uSizeAnchor:vec4 + }; + + @group(2) @binding(0) var tilingUniforms: TilingUniforms; + @group(2) @binding(1) var uTexture: texture_2d; + @group(2) @binding(2) var uSampler: sampler; + `,main:` + + var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV); + coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy; + var unclamped = coord; + coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw); + + var bias = 0.; + + if(unclamped.x == coord.x && unclamped.y == coord.y) + { + bias = -32.; + } + + outColor = textureSampleBias(uTexture, uSampler, coord, bias); + `}},Qt={name:"tiling-bit",vertex:{header:` + uniform mat3 uTextureTransform; + uniform vec4 uSizeAnchor; + + `,main:` + uv = (uTextureTransform * vec3(aUV, 1.0)).xy; + + position = (position - uSizeAnchor.zw) * uSizeAnchor.xy; + `},fragment:{header:` + uniform sampler2D uTexture; + uniform mat3 uMapCoord; + uniform vec4 uClampFrame; + uniform vec2 uClampOffset; + `,main:` + + vec2 coord = vUV + ceil(uClampOffset - vUV); + coord = (uMapCoord * vec3(coord, 1.0)).xy; + vec2 unclamped = coord; + coord = clamp(coord, uClampFrame.xy, uClampFrame.zw); + + outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0 + + `}};let X,K;class Jt extends se{constructor(){X??(X=Ae({name:"tiling-sprite-shader",bits:[St,qt,ze]})),K??(K=ke({name:"tiling-sprite-shader",bits:[Ft,Qt,Oe]}));const e=new G({uMapCoord:{value:new P,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new P,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:K,gpuProgram:X,resources:{localUniforms:new G({uTransformMatrix:{value:new P,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:R.EMPTY.source,uSampler:R.EMPTY.source.style}})}updateUniforms(e,t,r,n,i,s){const a=this.resources.tilingUniforms,l=s.width,u=s.height,h=s.textureMatrix,c=a.uniforms.uTextureTransform;c.set(r.a*l/e,r.b*l/t,r.c*u/e,r.d*u/t,r.tx/e,r.ty/t),c.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.uClampOffset,a.uniforms.uTextureTransform=c,a.uniforms.uSizeAnchor[0]=e,a.uniforms.uSizeAnchor[1]=t,a.uniforms.uSizeAnchor[2]=n,a.uniforms.uSizeAnchor[3]=i,s&&(this.resources.uTexture=s.source,this.resources.uSampler=s.source.style)}}class Zt extends ae{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}function er(o,e){const t=o.anchor.x,r=o.anchor.y;e[0]=-t*o.width,e[1]=-r*o.height,e[2]=(1-t)*o.width,e[3]=-r*o.height,e[4]=(1-t)*o.width,e[5]=(1-r)*o.height,e[6]=-t*o.width,e[7]=(1-r)*o.height}function tr(o,e,t,r){let n=0;const i=o.length/e,s=r.a,a=r.b,l=r.c,u=r.d,h=r.tx,c=r.ty;for(t*=e;n, + uTransformMatrix:mat3x3, + uDistance: f32, + uRound:f32, + } + + @group(2) @binding(0) var localUniforms : LocalUniforms; + `,main:` + vColor *= localUniforms.uColor; + modelMatrix *= localUniforms.uTransformMatrix; + `,end:` + if(localUniforms.uRound == 1) + { + vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); + } + `},fragment:{header:` + struct LocalUniforms { + uColor:vec4, + uTransformMatrix:mat3x3, + uDistance: f32 + } + + @group(2) @binding(0) var localUniforms : LocalUniforms; + `,main:` + outColor = vec4(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance)); + `}},sr={name:"local-uniform-msdf-bit",vertex:{header:` + uniform mat3 uTransformMatrix; + uniform vec4 uColor; + uniform float uRound; + `,main:` + vColor *= uColor; + modelMatrix *= uTransformMatrix; + `,end:` + if(uRound == 1.) + { + gl_Position.xy = roundPixels(gl_Position.xy, uResolution); + } + `},fragment:{header:` + uniform float uDistance; + `,main:` + outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance)); + `}},ar={name:"msdf-bit",fragment:{header:` + fn calculateMSDFAlpha(msdfColor:vec4, shapeColor:vec4, distance:f32) -> f32 { + + // MSDF + var median = msdfColor.r + msdfColor.g + msdfColor.b - + min(msdfColor.r, min(msdfColor.g, msdfColor.b)) - + max(msdfColor.r, max(msdfColor.g, msdfColor.b)); + + // SDF + median = min(median, msdfColor.a); + + var screenPxDistance = distance * (median - 0.5); + var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0); + if (median < 0.01) { + alpha = 0.0; + } else if (median > 0.99) { + alpha = 1.0; + } + + // Gamma correction for coverage-like alpha + var luma: f32 = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114)); + var gamma: f32 = mix(1.0, 1.0 / 2.2, luma); + var coverage: f32 = pow(shapeColor.a * alpha, gamma); + + return coverage; + + } + `}},or={name:"msdf-bit",fragment:{header:` + float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) { + + // MSDF + float median = msdfColor.r + msdfColor.g + msdfColor.b - + min(msdfColor.r, min(msdfColor.g, msdfColor.b)) - + max(msdfColor.r, max(msdfColor.g, msdfColor.b)); + + // SDF + median = min(median, msdfColor.a); + + float screenPxDistance = distance * (median - 0.5); + float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0); + + if (median < 0.01) { + alpha = 0.0; + } else if (median > 0.99) { + alpha = 1.0; + } + + // Gamma correction for coverage-like alpha + float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114)); + float gamma = mix(1.0, 1.0 / 2.2, luma); + float coverage = pow(shapeColor.a * alpha, gamma); + + return coverage; + } + `}};let $,j;class ur extends se{constructor(e){const t=new G({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new P,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}});$??($=Ae({name:"sdf-shader",bits:[gt,xt(e),ir,ar,ze]})),j??(j=ke({name:"sdf-shader",bits:[_t,bt(e),sr,or,Oe]})),super({glProgram:j,gpuProgram:$,resources:{localUniforms:t,batchSamplers:vt(e)}})}}class lr extends wt{destroy(){this.context.customShader&&this.context.customShader.destroy(),super.destroy()}}class nt{constructor(e){this._renderer=e,this._managedBitmapTexts=new B({renderer:e,type:"renderable",priority:-2,name:"bitmapText"})}validateRenderable(e){const t=this._getGpuBitmapText(e);return this._renderer.renderPipes.graphics.validateRenderable(t)}addRenderable(e,t){const r=this._getGpuBitmapText(e);Fe(e,r),e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,r)),this._renderer.renderPipes.graphics.addRenderable(r,t),r.context.customShader&&this._updateDistanceField(e)}updateRenderable(e){const t=this._getGpuBitmapText(e);Fe(e,t),this._renderer.renderPipes.graphics.updateRenderable(t),t.context.customShader&&this._updateDistanceField(e)}_updateContext(e,t){const{context:r}=t,n=yt.getFont(e.text,e._style);r.clear(),n.distanceField.type!=="none"&&(r.customShader||(r.customShader=new ur(this._renderer.limits.maxBatchableTextures)));const i=M.graphemeSegmenter(e.text),s=e._style;let a=n.baseLineOffset;const l=Tt(i,s,n,!0),u=s.padding,h=l.scale;let c=l.width,d=l.height+l.offsetY;s._stroke&&(c+=s._stroke.width/h,d+=s._stroke.width/h),r.translate(-e._anchor._x*c-u,-e._anchor._y*d-u).scale(h,h);const f=n.applyFillAsTint?s._fill.color:16777215;let m=n.fontMetrics.fontSize,x=n.lineHeight;s.lineHeight&&(m=s.fontSize/h,x=s.lineHeight/h);let g=(x-m)/2;g-n.baseLineOffset<0&&(g=0);for(let _=0;_{console.error(i)}),e._didTextUpdate=!1,te(r,e)}this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._getGpuText(e);t._batcher.updateElement(t)}async _updateGpuText(e){e._didTextUpdate=!1;const t=this._getGpuText(e);if(t.generatingTexture)return;const r=t.texturePromise;t.texturePromise=null,t.generatingTexture=!0,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;let n=this._renderer.htmlText.getTexturePromise(e);r&&(n=n.finally(()=>{this._renderer.htmlText.decreaseReferenceCount(t.currentKey),this._renderer.htmlText.returnTexturePromise(r)})),t.texturePromise=n,t.currentKey=e.styleKey,t.texture=await n;const i=e.renderGroup||e.parentRenderGroup;i&&(i.structureDidChange=!0),t.generatingTexture=!1,te(t,e)}_getGpuText(e){return e._gpuData[this._renderer.uid]||this.initGpuText(e)}initGpuText(e){const t=new cr;return t.renderable=e,t.transform=e.groupTransform,t.texture=R.EMPTY,t.bounds={minX:0,maxX:1,minY:0,maxY:0},t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,e._gpuData[this._renderer.uid]=t,this._managedTexts.add(e),t}onTextUnload(e){const t=e._gpuData[this._renderer.uid];if(!t)return;const{htmlText:r}=this._renderer;r.getReferenceCount(t.currentKey)===null?r.returnTexturePromise(t.texturePromise):r.decreaseReferenceCount(t.currentKey)}destroy(){this._managedTexts.destroy(),this._renderer=null}}it.extension={type:[p.WebGLPipes,p.WebGPUPipes,p.CanvasPipes],name:"htmlText"};function dr(){const{userAgent:o}=L.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(o)}const hr=new Me;function st(o,e,t,r){const n=hr;n.minX=0,n.minY=0,n.maxX=o.width/r|0,n.maxY=o.height/r|0;const i=w.getOptimalTexture(n.width,n.height,r,!1);return i.source.uploadMethodId="image",i.source.resource=o,i.source.alphaMode="premultiply-alpha-on-upload",i.frame.width=e/r,i.frame.height=t/r,i.source.emit("update",i.source),i.updateUvs(),i}function fr(o,e){const t=e.fontFamily,r=[],n={},i=/font-family:([^;"\s]+)/g,s=o.match(i);function a(l){n[l]||(r.push(l),n[l]=!0)}if(Array.isArray(t))for(let l=0;l{const u=l.split(":")[1].trim();a(u)});for(const l in e.tagStyles){const u=e.tagStyles[l].fontFamily;a(u)}return r}async function pr(o){const t=await(await L.get().fetch(o)).blob(),r=new FileReader;return await new Promise((i,s)=>{r.onloadend=()=>i(r.result),r.onerror=s,r.readAsDataURL(t)})}async function mr(o,e){const t=await pr(e);return`@font-face { + font-family: "${o.fontFamily}"; + font-weight: ${o.fontWeight}; + font-style: ${o.fontStyle}; + src: url('${t}'); + }`}const N=new Map;async function gr(o){const e=o.filter(t=>ee.has(`${t}-and-url`)).map(t=>{if(!N.has(t)){const{entries:r}=ee.get(`${t}-and-url`),n=[];r.forEach(i=>{const s=i.url,l=i.faces.map(u=>({weight:u.weight,style:u.style}));n.push(...l.map(u=>mr({fontWeight:u.weight,fontStyle:u.style,fontFamily:t},s)))}),N.set(t,Promise.all(n).then(i=>i.join(` +`)))}return N.get(t)});return(await Promise.all(e)).join(` +`)}function xr(o,e,t,r,n){const{domElement:i,styleElement:s,svgRoot:a}=n;i.innerHTML=`
          ${o}
          `,i.setAttribute("style",`transform: scale(${t});transform-origin: top left; display: inline-block`),s.textContent=r;const{width:l,height:u}=n.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",u.toString()),new XMLSerializer().serializeToString(a)}function _r(o,e){const t=E.getOptimalCanvasAndContext(o.width,o.height,e),{context:r}=t;return r.clearRect(0,0,o.width,o.height),r.drawImage(o,0,0),t}function br(o,e,t){return new Promise(async r=>{t&&await new Promise(n=>setTimeout(n,100)),o.onload=()=>{r()},o.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(e)}`,o.crossOrigin="anonymous"})}class at{constructor(e){this._activeTextures={},this._renderer=e,this._createCanvas=e.type===ne.WEBGPU}getTexture(e){return this.getTexturePromise(e)}getManagedTexture(e){const t=e.styleKey;if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].promise;const r=this._buildTexturePromise(e).then(n=>(this._activeTextures[t].texture=n,n));return this._activeTextures[t]={texture:null,promise:r,usageCount:1},r}getReferenceCount(e){return this._activeTextures[e]?.usageCount??null}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}decreaseReferenceCount(e){const t=this._activeTextures[e];t&&(t.usageCount--,t.usageCount===0&&(t.texture?this._cleanUp(t.texture):t.promise.then(r=>{t.texture=r,this._cleanUp(t.texture)}).catch(()=>{q("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[e]=null))}getTexturePromise(e){return this._buildTexturePromise(e)}async _buildTexturePromise(e){const{text:t,style:r,resolution:n,textureStyle:i}=e,s=W.get(Xe),a=fr(t,r),l=await gr(a),u=Ot(t,r,l,s),h=Math.ceil(Math.ceil(Math.max(1,u.width)+r.padding*2)*n),c=Math.ceil(Math.ceil(Math.max(1,u.height)+r.padding*2)*n),d=s.image,f=2;d.width=(h|0)+f,d.height=(c|0)+f;const m=xr(t,r,n,l,s);await br(d,m,dr()&&a.length>0);const x=d;let g;this._createCanvas&&(g=_r(d,n));const _=st(g?g.canvas:x,d.width-f,d.height-f,n);return i&&(_.source.style=i),this._createCanvas&&(this._renderer.texture.initSource(_.source),E.returnCanvasAndContext(g)),W.return(s),_}returnTexturePromise(e){e.then(t=>{this._cleanUp(t)}).catch(()=>{q("HTMLTextSystem: Failed to clean texture")})}_cleanUp(e){w.returnTexture(e,!0),e.source.resource=null,e.source.uploadMethodId="unknown"}destroy(){this._renderer=null;for(const e in this._activeTextures)this._activeTextures[e]&&this.returnTexturePromise(this._activeTextures[e].promise);this._activeTextures=null}}at.extension={type:[p.WebGLSystem,p.WebGPUSystem,p.CanvasSystem],name:"htmlText"};class vr extends Ie{}class ot{constructor(e){this._renderer=e,e.runners.resolutionChange.add(this),this._managedTexts=new B({renderer:e,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(const e in this._managedTexts.items){const t=this._managedTexts.items[e];t?._autoResolution&&t.onViewUpdate()}}validateRenderable(e){const t=this._getGpuText(e),r=e.styleKey;return t.currentKey!==r?!0:e._didTextUpdate}addRenderable(e,t){const r=this._getGpuText(e);if(e._didTextUpdate){const n=e._autoResolution?this._renderer.resolution:e.resolution;(r.currentKey!==e.styleKey||e.resolution!==n)&&this._updateGpuText(e),e._didTextUpdate=!1,te(r,e)}this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._getGpuText(e);t._batcher.updateElement(t)}_updateGpuText(e){const t=this._getGpuText(e);t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,t.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e.styleKey}_getGpuText(e){return e._gpuData[this._renderer.uid]||this.initGpuText(e)}initGpuText(e){const t=new vr;return t.currentKey="--",t.renderable=e,t.transform=e.groupTransform,t.bounds={minX:0,maxX:1,minY:0,maxY:0},t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._gpuData[this._renderer.uid]=t,this._managedTexts.add(e),t}onTextUnload(e){const t=e._gpuData[this._renderer.uid];if(!t)return;const{canvasText:r}=this._renderer;r.getReferenceCount(t.currentKey)>0?r.decreaseReferenceCount(t.currentKey):t.texture&&r.returnTexture(t.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}ot.extension={type:[p.WebGLPipes,p.WebGPUPipes,p.CanvasPipes],name:"text"};class ut{constructor(e){this._activeTextures={},this._renderer=e}getTexture(e,t,r,n){typeof e=="string"&&(I("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:r,resolution:t}),e.style instanceof pe||(e.style=new pe(e.style)),e.textureStyle instanceof Z||(e.textureStyle=new Z(e.textureStyle)),typeof e.text!="string"&&(e.text=e.text.toString());const{text:i,style:s,textureStyle:a}=e,l=e.resolution??this._renderer.resolution,{frame:u,canvasAndContext:h}=H.getCanvasAndContext({text:i,style:s,resolution:l}),c=st(h.canvas,u.width,u.height,l);if(a&&(c.source.style=a),s.trim&&(u.pad(s.padding),c.frame.copyFrom(u),c.frame.scale(1/l),c.updateUvs()),s.filters){const d=this._applyFilters(c,s.filters);return this.returnTexture(c),H.returnCanvasAndContext(h),d}return this._renderer.texture.initSource(c._source),H.returnCanvasAndContext(h),c}returnTexture(e){const t=e.source;t.resource=null,t.uploadMethodId="unknown",t.alphaMode="no-premultiply-alpha",w.returnTexture(e,!0)}renderTextToCanvas(){I("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(e){e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;const t=e.styleKey;if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;const r=this.getTexture({text:e.text,style:e.style,resolution:e._resolution,textureStyle:e.textureStyle});return this._activeTextures[t]={texture:r,usageCount:1},r}decreaseReferenceCount(e){const t=this._activeTextures[e];t.usageCount--,t.usageCount===0&&(this.returnTexture(t.texture),this._activeTextures[e]=null)}getReferenceCount(e){return this._activeTextures[e]?.usageCount??0}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}_applyFilters(e,t){const r=this._renderer.renderTarget.renderTarget,n=this._renderer.filter.generateFilteredTexture({texture:e,filters:t});return this._renderer.renderTarget.bind(r,!1),n}destroy(){this._renderer=null;for(const e in this._activeTextures)this._activeTextures[e]&&this.returnTexture(this._activeTextures[e].texture);this._activeTextures=null}}ut.extension={type:[p.WebGLSystem,p.WebGPUSystem,p.CanvasSystem],name:"canvasText"};y.add(Ee);y.add(Ve);y.add(Ke);y.add(Pt);y.add(Ne);y.add(Qe);y.add(Je);y.add(ut);y.add(ot);y.add(nt);y.add(at);y.add(it);y.add(rt);y.add(tt);y.add(Le);y.add(We); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/window-Uydxco8n.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/window-Uydxco8n.js new file mode 100644 index 0000000000000000000000000000000000000000..ead22551a7af3375637386af8abb35fd2cf23d96 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/window-Uydxco8n.js @@ -0,0 +1 @@ +import{ab as t,ac as e}from"./index-DWyDLubb.js";function w(i,o){t(window,["resize"],()=>e(()=>o(window[i])))}export{w as b}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/worker-BAOIWoxA.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/worker-BAOIWoxA.js new file mode 100644 index 0000000000000000000000000000000000000000..4be75e95ecb195ea449864292c9771494629d71b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/worker-BAOIWoxA.js @@ -0,0 +1 @@ +(function(){"use strict";const i="https://unpkg.com/@ffmpeg/core@0.12.9/dist/umd/ffmpeg-core.js";var E;(function(t){t.LOAD="LOAD",t.EXEC="EXEC",t.FFPROBE="FFPROBE",t.WRITE_FILE="WRITE_FILE",t.READ_FILE="READ_FILE",t.DELETE_FILE="DELETE_FILE",t.RENAME="RENAME",t.CREATE_DIR="CREATE_DIR",t.LIST_DIR="LIST_DIR",t.DELETE_DIR="DELETE_DIR",t.ERROR="ERROR",t.DOWNLOAD="DOWNLOAD",t.PROGRESS="PROGRESS",t.LOG="LOG",t.MOUNT="MOUNT",t.UNMOUNT="UNMOUNT"})(E||(E={}));const f=new Error("unknown message type"),a=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),u=new Error("failed to import ffmpeg-core.js");let r;const O=async({coreURL:t,wasmURL:n,workerURL:e})=>{const o=!r;try{t||(t=i),importScripts(t)}catch{if((!t||t===i)&&(t=i.replace("/umd/","/esm/")),self.createFFmpegCore=(await import(t)).default,!self.createFFmpegCore)throw u}const s=t,c=n||t.replace(/.js$/g,".wasm"),p=e||t.replace(/.js$/g,".worker.js");return r=await self.createFFmpegCore({mainScriptUrlOrBlob:`${s}#${btoa(JSON.stringify({wasmURL:c,workerURL:p}))}`}),r.setLogger(R=>self.postMessage({type:E.LOG,data:R})),r.setProgress(R=>self.postMessage({type:E.PROGRESS,data:R})),o},m=({args:t,timeout:n=-1})=>{r.setTimeout(n),r.exec(...t);const e=r.ret;return r.reset(),e},l=({args:t,timeout:n=-1})=>{r.setTimeout(n),r.ffprobe(...t);const e=r.ret;return r.reset(),e},D=({path:t,data:n})=>(r.FS.writeFile(t,n),!0),S=({path:t,encoding:n})=>r.FS.readFile(t,{encoding:n}),I=({path:t})=>(r.FS.unlink(t),!0),L=({oldPath:t,newPath:n})=>(r.FS.rename(t,n),!0),N=({path:t})=>(r.FS.mkdir(t),!0),A=({path:t})=>{const n=r.FS.readdir(t),e=[];for(const o of n){const s=r.FS.stat(`${t}/${o}`),c=r.FS.isDir(s.mode);e.push({name:o,isDir:c})}return e},k=({path:t})=>(r.FS.rmdir(t),!0),w=({fsType:t,options:n,mountPoint:e})=>{const o=t,s=r.FS.filesystems[o];return s?(r.FS.mount(s,n,e),!0):!1},b=({mountPoint:t})=>(r.FS.unmount(t),!0);self.onmessage=async({data:{id:t,type:n,data:e}})=>{const o=[];let s;try{if(n!==E.LOAD&&!r)throw a;switch(n){case E.LOAD:s=await O(e);break;case E.EXEC:s=m(e);break;case E.FFPROBE:s=l(e);break;case E.WRITE_FILE:s=D(e);break;case E.READ_FILE:s=S(e);break;case E.DELETE_FILE:s=I(e);break;case E.RENAME:s=L(e);break;case E.CREATE_DIR:s=N(e);break;case E.LIST_DIR:s=A(e);break;case E.DELETE_DIR:s=k(e);break;case E.MOUNT:s=w(e);break;case E.UNMOUNT:s=b(e);break;default:throw f}}catch(c){self.postMessage({id:t,type:E.ERROR,data:c.toString()});return}s instanceof Uint8Array&&o.push(s.buffer),self.postMessage({id:t,type:n,data:s},o)}})(); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/workerPool-CfMXSLnf.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/workerPool-CfMXSLnf.js new file mode 100644 index 0000000000000000000000000000000000000000..eafe2fa5798c18078a0e8c5b3707d41a11382e19 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/workerPool-CfMXSLnf.js @@ -0,0 +1 @@ +class h{constructor(e){this._pendingActions=new Array,this._workerInfos=e.map(s=>({workerPromise:Promise.resolve(s),idle:!0}))}dispose(){for(const e of this._workerInfos)e.workerPromise.then(s=>{s.terminate()});this._workerInfos.length=0,this._pendingActions.length=0}push(e){this._executeOnIdleWorker(e)||this._pendingActions.push(e)}_executeOnIdleWorker(e){for(const s of this._workerInfos)if(s.idle)return this._execute(s,e),!0;return!1}_execute(e,s){e.idle=!1,e.workerPromise.then(t=>{s(t,()=>{const i=this._pendingActions.shift();i?this._execute(e,i):e.idle=!0})})}}class r extends h{constructor(e,s,t=r.DefaultOptions){super([]),this._maxWorkers=e,this._createWorkerAsync=s,this._options=t}push(e){if(!this._executeOnIdleWorker(e))if(this._workerInfos.length{s(t,()=>{i(),e.idle&&(e.timeoutId=setTimeout(()=>{e.workerPromise.then(n=>{n.terminate()});const o=this._workerInfos.indexOf(e);o!==-1&&this._workerInfos.splice(o,1)},this._options.idleTimeElapsedBeforeRelease))})})}}r.DefaultOptions={idleTimeElapsedBeforeRelease:1e3};export{r as A}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/xychartDiagram-PRI3JC2R-DG74V_zU.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/xychartDiagram-PRI3JC2R-DG74V_zU.js new file mode 100644 index 0000000000000000000000000000000000000000..941662a65c211a6871310cfa2b249665b63854f9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/xychartDiagram-PRI3JC2R-DG74V_zU.js @@ -0,0 +1,7 @@ +import{s as ei,g as si,q as Lt,p as ni,a as ai,b as oi,_ as a,l as Et,I as ri,d as hi,y as li,G as xt,h as ci,E as It,F as ui,L as gi,ab as xi}from"./mermaid.core-7TB2QPZo.js";import{i as di}from"./init-Dmth1JHB.js";import{o as pi}from"./ordinal-BeghXfj9.js";import{r as fi}from"./range-OtVwhkKS.js";import{l as Tt}from"./linear-8mDBZVC7.js";import{l as Dt}from"./step-B-Gbak1k.js";import"./index-DWyDLubb.js";import"./i18n-Dnhn5Rxr.js";import"./dispatch-kxCwF96_.js";import"./select-BigU4G0v.js";import"./defaultLocale-CzDG__Ur.js";function ht(){var t=pi().unknown(void 0),i=t.domain,e=t.range,s=0,n=1,d,g,m=!1,S=0,D=0,v=.5;delete t.unknown;function w(){var y=i().length,E=n"u"&&(R.yylloc={});var at=R.yylloc;o.push(at);var ti=R.options&&R.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ii(V){u.length=u.length-2*V,A.length=A.length-V,o.length=o.length-V}a(ii,"popStack");function kt(){var V;return V=x.pop()||R.lex()||_t,typeof V!="number"&&(V instanceof Array&&(x=V,V=x.pop()),V=c.symbols_[V]||V),V}a(kt,"lex");for(var M,H,B,ot,q={},tt,O,Rt,it;;){if(H=u[u.length-1],this.defaultActions[H]?B=this.defaultActions[H]:((M===null||typeof M>"u")&&(M=kt()),B=j[H]&&j[H][M]),typeof B>"u"||!B.length||!B[0]){var rt="";it=[];for(tt in j[H])this.terminals_[tt]&&tt>Zt&&it.push("'"+this.terminals_[tt]+"'");R.showPosition?rt="Parse error on line "+(J+1)+`: +`+R.showPosition()+` +Expecting `+it.join(", ")+", got '"+(this.terminals_[M]||M)+"'":rt="Parse error on line "+(J+1)+": Unexpected "+(M==_t?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(rt,{text:R.match,token:this.terminals_[M]||M,line:R.yylineno,loc:at,expected:it})}if(B[0]instanceof Array&&B.length>1)throw new Error("Parse Error: multiple actions possible at state: "+H+", token: "+M);switch(B[0]){case 1:u.push(M),A.push(R.yytext),o.push(R.yylloc),u.push(B[1]),M=null,St=R.yyleng,p=R.yytext,J=R.yylineno,at=R.yylloc;break;case 2:if(O=this.productions_[B[1]][1],q.$=A[A.length-O],q._$={first_line:o[o.length-(O||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(O||1)].first_column,last_column:o[o.length-1].last_column},ti&&(q._$.range=[o[o.length-(O||1)].range[0],o[o.length-1].range[1]]),ot=this.performAction.apply(q,[p,St,J,Y.yy,B[1],A,o].concat(Jt)),typeof ot<"u")return ot;O&&(u=u.slice(0,-1*O*2),A=A.slice(0,-1*O),o=o.slice(0,-1*O)),u.push(this.productions_[B[1]][0]),A.push(q.$),o.push(q._$),Rt=j[u[u.length-2]][u[u.length-1]],u.push(Rt);break;case 3:return!0}}return!0},"parse")},Ct=(function(){var F={EOF:1,parseError:a(function(c,u){if(this.yy.parser)this.yy.parser.parseError(c,u);else throw new Error(c)},"parseError"),setInput:a(function(r,c){return this.yy=c||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var c=r.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:a(function(r){var c=r.length,u=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===x.length?this.yylloc.first_column:0)+x[x.length-u.length].length-u[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(r){this.unput(this.match.slice(r))},"less"),pastInput:a(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var r=this.pastInput(),c=new Array(r.length+1).join("-");return r+this.upcomingInput()+` +`+c+"^"},"showPosition"),test_match:a(function(r,c){var u,x,A;if(this.options.backtrack_lexer&&(A={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(A.yylloc.range=this.yylloc.range.slice(0))),x=r[0].match(/(?:\r\n?|\n).*/g),x&&(this.yylineno+=x.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:x?x[x.length-1].length-x[x.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],u=this.performAction.call(this,this.yy,this,c,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),u)return u;if(this._backtrack){for(var o in A)this[o]=A[o];return!1}return!1},"test_match"),next:a(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,c,u,x;this._more||(this.yytext="",this.match="");for(var A=this._currentRules(),o=0;oc[0].length)){if(c=u,x=o,this.options.backtrack_lexer){if(r=this.test_match(u,A[o]),r!==!1)return r;if(this._backtrack){c=!1;continue}else return!1}else if(!this.options.flex)break}return c?(r=this.test_match(c,A[x]),r!==!1?r:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:a(function(){var c=this.next();return c||this.lex()},"lex"),begin:a(function(c){this.conditionStack.push(c)},"begin"),popState:a(function(){var c=this.conditionStack.length-1;return c>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:a(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:a(function(c){return c=this.conditionStack.length-1-Math.abs(c||0),c>=0?this.conditionStack[c]:"INITIAL"},"topState"),pushState:a(function(c){this.begin(c)},"pushState"),stateStackSize:a(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:a(function(c,u,x,A){switch(x){case 0:break;case 1:break;case 2:return this.popState(),34;case 3:return this.popState(),34;case 4:return 34;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";case 18:return this.pushState("axis_data"),"Y_AXIS";case 19:return this.pushState("axis_band_data"),24;case 20:return 31;case 21:return this.pushState("data"),16;case 22:return this.pushState("data"),18;case 23:return this.pushState("data_inner"),24;case 24:return 27;case 25:return this.popState(),26;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 43;case 33:return"COLON";case 34:return 44;case 35:return 28;case 36:return 45;case 37:return 46;case 38:return 48;case 39:return 50;case 40:return 47;case 41:return 41;case 42:return 49;case 43:return 42;case 44:break;case 45:return 35;case 46:return 36}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\{)/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return F})();$.lexer=Ct;function N(){this.yy={}}return a(N,"Parser"),N.prototype=$,$.Parser=N,new N})();lt.parser=lt;var mi=lt;function ct(t){return t.type==="bar"}a(ct,"isBarPlot");function dt(t){return t.type==="band"}a(dt,"isBandAxisData");function G(t){return t.type==="linear"}a(G,"isLinearAxisData");var Mt=class{constructor(t){this.parentGroup=t}static{a(this,"TextDimensionCalculatorWithFont")}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce((n,d)=>Math.max(d.length,n),0)*i,height:i};const e={width:0,height:0},s=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(const n of t){const d=xi(s,1,n),g=d?d.width:n.length*i,m=d?d.height:i;e.width=Math.max(e.width,g),e.height=Math.max(e.height,m)}return s.remove(),e}},vt=.7,Pt=.2,Vt=class{constructor(t,i,e,s){this.axisConfig=t,this.title=i,this.textDimensionCalculator=e,this.axisThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left"}static{a(this,"BaseAxis")}setRange(t){this.range=t,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){const t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){vt*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(vt*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const e=this.getLabelDimension(),s=Pt*t.width;this.outerPadding=Math.min(e.width/2,s);const n=e.height+this.axisConfig.labelPadding*2;this.labelTextHeight=e.height,n<=i&&(i-=n,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const e=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),s=e.height+this.axisConfig.titlePadding*2;this.titleTextHeight=e.height,s<=i&&(i-=s,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const e=this.getLabelDimension(),s=Pt*t.height;this.outerPadding=Math.min(e.height/2,s);const n=e.width+this.axisConfig.labelPadding*2;n<=i&&(i-=n,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const e=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),s=e.height+this.axisConfig.titlePadding*2;this.titleTextHeight=e.height,s<=i&&(i-=s,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}getDrawableElementsForLeftAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){const i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(e=>({path:`M ${i},${this.getScaleValue(e)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(e)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(e=>({path:`M ${this.getScaleValue(e)},${i} L ${this.getScaleValue(e)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(e=>({path:`M ${this.getScaleValue(e)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(e)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}},yi=class extends Vt{static{a(this,"BandAxis")}constructor(t,i,e,s,n){super(t,s,n,i),this.categories=e,this.scale=ht().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=ht().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),Et.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},bi=class extends Vt{static{a(this,"LinearAxis")}constructor(t,i,e,s,n){super(t,s,n,i),this.domain=e,this.scale=Tt().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){const t=[...this.domain];this.axisPosition==="left"&&t.reverse(),this.scale=Tt().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}};function ut(t,i,e,s){const n=new Mt(s);return dt(t)?new yi(i,e,t.categories,t.title,n):new bi(i,e,[t.min,t.max],t.title,n)}a(ut,"getAxis");var Ai=class{constructor(t,i,e,s){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=e,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{a(this,"ChartTitle")}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){const i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),e=Math.max(i.width,t.width),s=i.height+2*this.chartConfig.titlePadding;return i.width<=e&&i.height<=s&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=e,this.boundingRect.height=s,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){const t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}};function Bt(t,i,e,s){const n=new Mt(s);return new Ai(n,t,i,e)}a(Bt,"getChartTitleComponent");var wi=class{constructor(t,i,e,s,n){this.plotData=t,this.xAxis=i,this.yAxis=e,this.orientation=s,this.plotIndex=n}static{a(this,"LinePlot")}getDrawableElement(){const t=this.plotData.data.map(e=>[this.xAxis.getScaleValue(e[0]),this.yAxis.getScaleValue(e[1])]);let i;return this.orientation==="horizontal"?i=Dt().y(e=>e[0]).x(e=>e[1])(t):i=Dt().x(e=>e[0]).y(e=>e[1])(t),i?[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}},Ci=class{constructor(t,i,e,s,n,d){this.barData=t,this.boundingRect=i,this.xAxis=e,this.yAxis=s,this.orientation=n,this.plotIndex=d}static{a(this,"BarPlot")}getDrawableElement(){const t=this.barData.data.map(n=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),e=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),s=e/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(n=>({x:this.boundingRect.x,y:n[0]-s,height:e,width:n[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(n=>({x:n[0]-s,y:n[1],width:e,height:this.boundingRect.y+this.boundingRect.height-n[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},Si=class{constructor(t,i,e){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=e,this.boundingRect={x:0,y:0,width:0,height:0}}static{a(this,"BasePlot")}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");const t=[];for(const[i,e]of this.chartData.plots.entries())switch(e.type){case"line":{const s=new wi(e,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...s.getDrawableElement())}break;case"bar":{const s=new Ci(e,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...s.getDrawableElement())}break}return t}};function Wt(t,i,e){return new Si(t,i,e)}a(Wt,"getPlotComponent");var _i=class{constructor(t,i,e,s){this.chartConfig=t,this.chartData=i,this.componentStore={title:Bt(t,i,e,s),plot:Wt(t,i,e),xAxis:ut(i.xAxis,t.xAxis,{titleColor:e.xAxisTitleColor,labelColor:e.xAxisLabelColor,tickColor:e.xAxisTickColor,axisLineColor:e.xAxisLineColor},s),yAxis:ut(i.yAxis,t.yAxis,{titleColor:e.yAxisTitleColor,labelColor:e.yAxisLabelColor,tickColor:e.yAxisTickColor,axisLineColor:e.yAxisLineColor},s)}}static{a(this,"Orchestrator")}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,s=0,n=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),d=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),g=this.componentStore.plot.calculateSpace({width:n,height:d});t-=g.width,i-=g.height,g=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=g.height,i-=g.height,this.componentStore.xAxis.setAxisPosition("bottom"),g=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=g.height,this.componentStore.yAxis.setAxisPosition("left"),g=this.componentStore.yAxis.calculateSpace({width:t,height:i}),e=g.width,t-=g.width,t>0&&(n+=t,t=0),i>0&&(d+=i,i=0),this.componentStore.plot.calculateSpace({width:n,height:d}),this.componentStore.plot.setBoundingBoxXY({x:e,y:s}),this.componentStore.xAxis.setRange([e,e+n]),this.componentStore.xAxis.setBoundingBoxXY({x:e,y:s+d}),this.componentStore.yAxis.setRange([s,s+d]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:s}),this.chartData.plots.some(m=>ct(m))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,s=0,n=0,d=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),g=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),m=this.componentStore.plot.calculateSpace({width:d,height:g});t-=m.width,i-=m.height,m=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),e=m.height,i-=m.height,this.componentStore.xAxis.setAxisPosition("left"),m=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=m.width,s=m.width,this.componentStore.yAxis.setAxisPosition("top"),m=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=m.height,n=e+m.height,t>0&&(d+=t,t=0),i>0&&(g+=i,i=0),this.componentStore.plot.calculateSpace({width:d,height:g}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.yAxis.setRange([s,s+d]),this.componentStore.yAxis.setBoundingBoxXY({x:s,y:e}),this.componentStore.xAxis.setRange([n,n+g]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some(S=>ct(S))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();const t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(const i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}},ki=class{static{a(this,"XYChartBuilder")}static build(t,i,e,s){return new _i(t,i,e,s).getDrawableElement()}},Q=0,zt,K=mt(),Z=ft(),b=yt(),gt=Z.plotColorPalette.split(",").map(t=>t.trim()),et=!1,pt=!1;function ft(){const t=gi(),i=xt();return It(t.xyChart,i.themeVariables.xyChart)}a(ft,"getChartDefaultThemeConfig");function mt(){const t=xt();return It(ui.xyChart,t.xyChart)}a(mt,"getChartDefaultConfig");function yt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}a(yt,"getChartDefaultData");function st(t){const i=xt();return ci(t.trim(),i)}a(st,"textSanitizer");function Ft(t){zt=t}a(Ft,"setTmpSVGG");function Ot(t){t==="horizontal"?K.chartOrientation="horizontal":K.chartOrientation="vertical"}a(Ot,"setOrientation");function Xt(t){b.xAxis.title=st(t.text)}a(Xt,"setXAxisTitle");function bt(t,i){b.xAxis={type:"linear",title:b.xAxis.title,min:t,max:i},et=!0}a(bt,"setXAxisRangeData");function Nt(t){b.xAxis={type:"band",title:b.xAxis.title,categories:t.map(i=>st(i.text))},et=!0}a(Nt,"setXAxisBand");function Yt(t){b.yAxis.title=st(t.text)}a(Yt,"setYAxisTitle");function Ht(t,i){b.yAxis={type:"linear",title:b.yAxis.title,min:t,max:i},pt=!0}a(Ht,"setYAxisRangeData");function Ut(t){const i=Math.min(...t),e=Math.max(...t),s=G(b.yAxis)?b.yAxis.min:1/0,n=G(b.yAxis)?b.yAxis.max:-1/0;b.yAxis={type:"linear",title:b.yAxis.title,min:Math.min(s,i),max:Math.max(n,e)}}a(Ut,"setYAxisRangeFromPlotData");function At(t){let i=[];if(t.length===0)return i;if(!et){const e=G(b.xAxis)?b.xAxis.min:1/0,s=G(b.xAxis)?b.xAxis.max:-1/0;bt(Math.min(e,1),Math.max(s,t.length))}if(pt||Ut(t),dt(b.xAxis)&&(i=b.xAxis.categories.map((e,s)=>[e,t[s]])),G(b.xAxis)){const e=b.xAxis.min,s=b.xAxis.max,n=(s-e)/(t.length-1),d=[];for(let g=e;g<=s;g+=n)d.push(`${g}`);i=d.map((g,m)=>[g,t[m]])}return i}a(At,"transformDataWithoutCategory");function wt(t){return gt[t===0?0:t%gt.length]}a(wt,"getPlotColorFromPalette");function $t(t,i){const e=At(i);b.plots.push({type:"line",strokeFill:wt(Q),strokeWidth:2,data:e}),Q++}a($t,"setLineData");function qt(t,i){const e=At(i);b.plots.push({type:"bar",fill:wt(Q),data:e}),Q++}a(qt,"setBarData");function Gt(){if(b.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return b.title=Lt(),ki.build(K,b,Z,zt)}a(Gt,"getDrawableElem");function jt(){return Z}a(jt,"getChartThemeConfig");function Qt(){return K}a(Qt,"getChartConfig");function Kt(){return b}a(Kt,"getXYChartData");var Ri=a(function(){li(),Q=0,K=mt(),b=yt(),Z=ft(),gt=Z.plotColorPalette.split(",").map(t=>t.trim()),et=!1,pt=!1},"clear"),Ti={getDrawableElem:Gt,clear:Ri,setAccTitle:oi,getAccTitle:ai,setDiagramTitle:ni,getDiagramTitle:Lt,getAccDescription:si,setAccDescription:ei,setOrientation:Ot,setXAxisTitle:Xt,setXAxisRangeData:bt,setXAxisBand:Nt,setYAxisTitle:Yt,setYAxisRangeData:Ht,setLineData:$t,setBarData:qt,setTmpSVGG:Ft,getChartThemeConfig:jt,getChartConfig:Qt,getXYChartData:Kt},Di=a((t,i,e,s)=>{const n=s.db,d=n.getChartThemeConfig(),g=n.getChartConfig(),m=n.getXYChartData().plots[0].data.map(f=>f[1]);function S(f){return f==="top"?"text-before-edge":"middle"}a(S,"getDominantBaseLine");function D(f){return f==="left"?"start":f==="right"?"end":"middle"}a(D,"getTextAnchor");function v(f){return`translate(${f.x}, ${f.y}) rotate(${f.rotation||0})`}a(v,"getTextTransformation"),Et.debug(`Rendering xychart chart +`+t);const w=ri(i),y=w.append("g").attr("class","main"),E=y.append("rect").attr("width",g.width).attr("height",g.height).attr("class","background");hi(w,g.height,g.width,!0),w.attr("viewBox",`0 0 ${g.width} ${g.height}`),E.attr("fill",d.backgroundColor),n.setTmpSVGG(w.append("g").attr("class","mermaid-tmp-group"));const T=n.getDrawableElem(),P={};function I(f){let _=y,l="";for(const[W]of f.entries()){let z=y;W>0&&P[l]&&(z=P[l]),l+=f[W],_=P[l],_||(_=P[l]=z.append("g").attr("class",f[W]))}return _}a(I,"getGroup");for(const f of T){if(f.data.length===0)continue;const _=I(f.groupTexts);switch(f.type){case"rect":if(_.selectAll("rect").data(f.data).enter().append("rect").attr("x",l=>l.x).attr("y",l=>l.y).attr("width",l=>l.width).attr("height",l=>l.height).attr("fill",l=>l.fill).attr("stroke",l=>l.strokeFill).attr("stroke-width",l=>l.strokeWidth),g.showDataLabel)if(g.chartOrientation==="horizontal"){let l=function(h,L){const{data:C,label:k}=h;return L*k.length*W<=C.width-10};a(l,"fitsHorizontally");const W=.7,z=f.data.map((h,L)=>({data:h,label:m[L].toString()})).filter(h=>h.data.width>0&&h.data.height>0),U=z.map(h=>{const{data:L}=h;let C=L.height*.7;for(;!l(h,C)&&C>0;)C-=1;return C}),X=Math.floor(Math.min(...U));_.selectAll("text").data(z).enter().append("text").attr("x",h=>h.data.x+h.data.width-10).attr("y",h=>h.data.y+h.data.height/2).attr("text-anchor","end").attr("dominant-baseline","middle").attr("fill","black").attr("font-size",`${X}px`).text(h=>h.label)}else{let l=function(h,L,C){const{data:k,label:$}=h,N=L*$.length*.7,F=k.x+k.width/2,r=F-N/2,c=F+N/2,u=r>=k.x&&c<=k.x+k.width,x=k.y+C+L<=k.y+k.height;return u&&x};a(l,"fitsInBar");const W=10,z=f.data.map((h,L)=>({data:h,label:m[L].toString()})).filter(h=>h.data.width>0&&h.data.height>0),U=z.map(h=>{const{data:L,label:C}=h;let k=L.width/(C.length*.7);for(;!l(h,k,W)&&k>0;)k-=1;return k}),X=Math.floor(Math.min(...U));_.selectAll("text").data(z).enter().append("text").attr("x",h=>h.data.x+h.data.width/2).attr("y",h=>h.data.y+W).attr("text-anchor","middle").attr("dominant-baseline","hanging").attr("fill","black").attr("font-size",`${X}px`).text(h=>h.label)}break;case"text":_.selectAll("text").data(f.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",l=>l.fill).attr("font-size",l=>l.fontSize).attr("dominant-baseline",l=>S(l.verticalPos)).attr("text-anchor",l=>D(l.horizontalPos)).attr("transform",l=>v(l)).text(l=>l.text);break;case"path":_.selectAll("path").data(f.data).enter().append("path").attr("d",l=>l.path).attr("fill",l=>l.fill?l.fill:"none").attr("stroke",l=>l.strokeFill).attr("stroke-width",l=>l.strokeWidth);break}}},"draw"),vi={draw:Di},Xi={parser:mi,db:Ti,renderer:vi};export{Xi as diagram}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/yaml-DsCXHVTH.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/yaml-DsCXHVTH.js new file mode 100644 index 0000000000000000000000000000000000000000..429ada56176333db796d82dcb9beefd9c089e59b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/yaml-DsCXHVTH.js @@ -0,0 +1 @@ +var l=["true","false","on","off","yes","no"],f=new RegExp("\\b(("+l.join(")|(")+"))$","i");const a={name:"yaml",token:function(n,i){var r=n.peek(),e=i.escaped;if(i.escaped=!1,r=="#"&&(n.pos==0||/\s/.test(n.string.charAt(n.pos-1))))return n.skipToEnd(),"comment";if(n.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(i.literal&&n.indentation()>i.keyCol)return n.skipToEnd(),"string";if(i.literal&&(i.literal=!1),n.sol()){if(i.keyCol=0,i.pair=!1,i.pairStart=!1,n.match("---")||n.match("..."))return"def";if(n.match(/^\s*-\s+/))return"meta"}if(n.match(/^(\{|\}|\[|\])/))return r=="{"?i.inlinePairs++:r=="}"?i.inlinePairs--:r=="["?i.inlineList++:i.inlineList--,"meta";if(i.inlineList>0&&!e&&r==",")return n.next(),"meta";if(i.inlinePairs>0&&!e&&r==",")return i.keyCol=0,i.pair=!1,i.pairStart=!1,n.next(),"meta";if(i.pairStart){if(n.match(/^\s*(\||\>)\s*/))return i.literal=!0,"meta";if(n.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable";if(i.inlinePairs==0&&n.match(/^\s*-?[0-9\.\,]+\s?$/)||i.inlinePairs>0&&n.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(n.match(f))return"keyword"}return!i.pair&&n.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(i.pair=!0,i.keyCol=n.indentation(),"atom"):i.pair&&n.match(/^:\s*/)?(i.pairStart=!0,"meta"):(i.pairStart=!1,i.escaped=r=="\\",n.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:"#"}}};export{a as yaml}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/zh-CN-D4oMFiss.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/zh-CN-D4oMFiss.js new file mode 100644 index 0000000000000000000000000000000000000000..78d1e1388237dad8ff5f84c3662df1165124b687 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/zh-CN-D4oMFiss.js @@ -0,0 +1 @@ +const o="简体中文",e={annotated_image:"标注图像"},r={allow_recording_access:"请允许访问麦克风以进行录音。",audio:"音频",record_from_microphone:"从麦克风录制",stop_recording:"停止录制",no_device_support:"无法访问媒体设备。请检查您是否在安全来源(https)或本地主机上运行(或者您已经通过 ssl_verify 传递了有效的 SSL 证书),并且您已经允许浏览器访问您的设备。",stop:"停止",resume:"继续",record:"录制",no_microphone:"找不到麦克风",pause:"暂停",play:"播放",waiting:"等待中",drop_to_upload:"将音频文件拖放到此处以上传"},t={connection_can_break:"在移动设备上,如果此标签页失去焦点或设备休眠,连接可能会中断,导致您在队列中失去位置。",long_requests_queue:"有一个长时间的待处理请求队列。复制此 Space 以跳过队列。",lost_connection:"由于离开页面,连接已丢失。正在重新加入队列...",waiting_for_inputs:"等待文件上传完成,请稍后重试。"},_={checkbox:"复选框",checkbox_group:"复选框组"},c={code:"代码"},a={color_picker:"颜色选择器"},n={built_with:"构建于",built_with_gradio:"使用 Gradio 构建",clear:"清除",download:"下载",edit:"编辑",empty:"空",error:"错误",hosted_on:"托管在",loading:"加载中",logo:"标志",or:"或",remove:"移除",share:"分享",submit:"提交",undo:"撤销",settings:"设置",no_devices:"未找到设备",language:"语言",display_theme:"显示主题",pwa:"渐进式 Web 应用"},s={incorrect_format:"格式不正确,仅支持 CSV 和 TSV 文件",new_column:"添加列",new_row:"新行",add_row_above:"在上方添加行",add_row_below:"在下方添加行",delete_row:"删除行",delete_column:"删除列",add_column_left:"在左侧添加列",add_column_right:"在右侧添加列",sort_column:"排序列",sort_ascending:"升序排序",sort_descending:"降序排序",drop_to_upload:"将 CSV 或 TSV 文件拖放到此处以将数据导入数据框",clear_sort:"清除排序"},d={dropdown:"下拉菜单"},i={build_error:"存在构建错误",config_error:"存在配置错误",contact_page_author:"请联系页面的作者并告知他们。",no_app_file:"不存在应用文件",runtime_error:"存在运行时错误",space_not_working:'"Space 无法工作,原因:" {0}',space_paused:"Space 已暂停",use_via_api:"通过 API 使用",use_via_api_or_mcp:"通过 API 或 MCP 使用"},l={uploading:"正在上传..."},p={highlighted_text:"高亮文本"},u={allow_webcam_access:"请允许访问网络摄像头以进行录制。",brush_color:"画笔颜色",brush_radius:"画笔大小",image:"图像",remove_image:"移除图像",select_brush_color:"选择画笔颜色",start_drawing:"开始绘画",use_brush:"使用画笔",drop_to_upload:"将图像文件拖放到此处以上传"},g={label:"标签"},m={enable_cookies:"如果您正在使用隐身模式访问 HuggingFace Space,您必须启用第三方 cookie。",incorrect_credentials:"凭据不正确",login:"登录",username:"用户名",password:"密码"},b={number:"数字"},h={plot:"图表"},w={radio:"单选框"},k={slider:"滑块"},f={click_to_upload:"点击上传",drop_audio:"将音频拖放到此处",drop_csv:"将 CSV 文件拖放到此处",drop_file:"将文件拖放到此处",drop_image:"将图像拖放到此处",drop_video:"将视频拖放到此处",drop_gallery:"在此处放置媒体文件",paste_clipboard:"从剪贴板粘贴"},v={drop_to_upload:"将视频文件拖放到此处以上传"},S={edit:"编辑",retry:"重试",undo:"撤销",submit:"发送",cancel:"取消",like:"赞",dislike:"踩",clear:"清空对话"},x={_name:o,"3D_model":{"3d_model":"3D模型",drop_to_upload:"将 3D 模型(.obj、.glb、.stl、.gltf、.splat 或 .ply)文件拖放到此处以上传"},annotated_image:e,audio:r,blocks:t,checkbox:_,code:c,color_picker:a,common:n,dataframe:s,dropdown:d,errors:i,file:l,highlighted_text:p,image:u,label:g,login:m,number:b,plot:h,radio:w,slider:k,upload_text:f,video:v,chatbot:S};export{o as _name,e as annotated_image,r as audio,t as blocks,S as chatbot,_ as checkbox,c as code,a as color_picker,n as common,s as dataframe,x as default,d as dropdown,i as errors,l as file,p as highlighted_text,u as image,g as label,m as login,b as number,h as plot,w as radio,k as slider,f as upload_text,v as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/zh-TW-R6BiSpm2.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/zh-TW-R6BiSpm2.js new file mode 100644 index 0000000000000000000000000000000000000000..88e680043d71edfb10a04476278cabc482346fe4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/assets/zh-TW-R6BiSpm2.js @@ -0,0 +1 @@ +const o="繁體中文",e={built_with_gradio:"使用 Gradio 建構",clear:"清除",or:"或",submit:"提交",built_with:"使用",download:"下載",edit:"編輯",empty:"空白",error:"錯誤",hosted_on:"托管於",loading:"載入中",logo:"標誌",remove:"移除",settings:"設定",share:"分享",undo:"復原",no_devices:"未找到裝置",language:"語言",display_theme:"顯示主題",pwa:"漸進式網頁應用程式"},r={click_to_upload:"點擊上傳",drop_audio:"拖放音訊至此處",drop_csv:"拖放 CSV 至此處",drop_file:"拖放檔案至此處",drop_image:"拖放圖片至此處",drop_video:"拖放影片至此處",drop_gallery:"在此處拖放媒體",paste_clipboard:"從剪貼簿貼上"},t={annotated_image:"標註圖像"},_={allow_recording_access:"請允許存取麥克風以進行錄音。",audio:"音訊",drop_to_upload:"將音訊檔案拖放到這裡上傳",record_from_microphone:"從麥克風錄音",stop_recording:"停止錄製",no_device_support:"無法存取媒體裝置。請確認您正在使用安全來源(https)或本機主機(或您已提供有效的 SSL 憑證以進行 ssl_verify),並且已允許瀏覽器存取您的裝置。",stop:"停止",resume:"繼續",record:"錄製",no_microphone:"未找到麥克風",pause:"暫停",play:"播放",waiting:"等待中"},c={connection_can_break:"在行動裝置上,如果此分頁失去焦點或裝置進入睡眠模式,連線可能會中斷,導致您在隊列中的位置遺失。",long_requests_queue:"目前有許多待處理的請求。複製此 Space 以跳過隊列。",lost_connection:"因離開頁面而失去連接。正在重新加入隊列...",waiting_for_inputs:"等待檔案上傳完成,請稍後重試。"},a={checkbox:"核取方塊",checkbox_group:"核取方塊群組"},n={code:"程式碼"},s={color_picker:"顏色選擇器"},d={incorrect_format:"格式不正確,僅支援 CSV 和 TSV 檔案",new_column:"新增欄位",new_row:"新增列",add_row_above:"在上方新增列",add_row_below:"在下方新增列",delete_row:"刪除列",delete_column:"刪除欄位",add_column_left:"在左側新增欄位",add_column_right:"在右側新增欄位",sort_column:"排序欄位",sort_ascending:"升冪排序",sort_descending:"降冪排序",drop_to_upload:"將 CSV 或 TSV 檔案拖放到這裡以匯入資料到資料框中",clear_sort:"清除排序"},i={dropdown:"下拉選單"},l={build_error:"有建置錯誤",config_error:"有設定錯誤",contact_page_author:"請聯繫頁面的作者以通知他們。",no_app_file:"沒有應用程式檔案",runtime_error:"有執行時錯誤",space_not_working:'"Space 無法運作,因為" {0}',space_paused:"Space 已暫停",use_via_api:"透過 API 使用",use_via_api_or_mcp:"透過 API 或 MCP 使用"},p={uploading:"上傳中..."},u={highlighted_text:"醒目提示的文字"},g={allow_webcam_access:"請允許存取網路攝影機以進行錄製。",brush_color:"筆刷顏色",brush_radius:"筆刷大小",image:"圖像",remove_image:"移除圖片",select_brush_color:"選擇筆刷顏色",start_drawing:"開始繪圖",use_brush:"使用筆刷",drop_to_upload:"將圖像檔案拖放到這裡上傳"},m={label:"標籤"},b={enable_cookies:"如果您在無痕模式下訪問 HuggingFace Space,您必須啟用第三方 Cookie。",incorrect_credentials:"憑證錯誤",username:"使用者名稱",password:"密碼",login:"登入"},h={number:"數字"},w={plot:"圖表"},k={radio:"單選按鈕"},f={slider:"滑桿"},v={drop_to_upload:"將影片檔案拖放到這裡上傳"},S={edit:"編輯",retry:"重試",undo:"復原",submit:"送出",cancel:"取消",like:"讚",dislike:"不讚",clear:"清空對話"},x={_name:o,common:e,upload_text:r,"3D_model":{"3d_model":"3D 模型",drop_to_upload:"將 3D 模型 (.obj、.glb、.stl、.gltf、.splat 或 .ply) 檔案拖放到這裡上傳"},annotated_image:t,audio:_,blocks:c,checkbox:a,code:n,color_picker:s,dataframe:d,dropdown:i,errors:l,file:p,highlighted_text:u,image:g,label:m,login:b,number:h,plot:w,radio:k,slider:f,video:v,chatbot:S};export{o as _name,t as annotated_image,_ as audio,c as blocks,S as chatbot,a as checkbox,n as code,s as color_picker,e as common,d as dataframe,x as default,i as dropdown,l as errors,p as file,u as highlighted_text,g as image,m as label,b as login,h as number,w as plot,k as radio,f as slider,r as upload_text,v as video}; diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/favicon.png b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..7e6f5eb5a2f1f1c882d265cf479de25caa925645 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/favicon.png differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/gradio.js b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/gradio.js new file mode 100644 index 0000000000000000000000000000000000000000..cc98de0d647aa8bf899c4ff7c6d43555817d7343 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/gradio.js @@ -0,0 +1 @@ +import("./assets/index-DWyDLubb.js"); diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/index.html b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/index.html new file mode 100644 index 0000000000000000000000000000000000000000..ffdab488b04724bd783bb0cb3d5092308f2b4b9f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/index.html @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/share.html b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/share.html new file mode 100644 index 0000000000000000000000000000000000000000..892d71b3568500f44fa3c147b730a1525758e2a7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/share.html @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/IBMPlexMono/IBMPlexMono-Bold.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/IBMPlexMono/IBMPlexMono-Bold.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..add42af3b3fa7fa2b90bfbafcd8063befbab354f Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/IBMPlexMono/IBMPlexMono-Bold.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/IBMPlexMono/IBMPlexMono-Regular.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/IBMPlexMono/IBMPlexMono-Regular.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..d0d7ded90791221663847f6258089ab9bb76c23a Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/IBMPlexMono/IBMPlexMono-Regular.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/IBMPlexSans/IBMPlexSans-Bold.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/IBMPlexSans/IBMPlexSans-Bold.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..0ded50b836c0b83f8fb3a122788c1c20ea901b5f Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/IBMPlexSans/IBMPlexSans-Bold.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/IBMPlexSans/IBMPlexSans-Regular.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/IBMPlexSans/IBMPlexSans-Regular.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..163f065415ed0f1ce0a453ad3bd9b13024b73a5d Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/IBMPlexSans/IBMPlexSans-Regular.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Inconsolata/Inconsolata-Bold.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Inconsolata/Inconsolata-Bold.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..c06f290dd3667a3356b2f21e450cd73cc3374509 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Inconsolata/Inconsolata-Bold.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Inconsolata/Inconsolata-Regular.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Inconsolata/Inconsolata-Regular.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..e3bddc0402df6b276c91787ac7b7ef4d968c3c29 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Inconsolata/Inconsolata-Regular.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Montserrat/Montserrat-Bold.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Montserrat/Montserrat-Bold.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..a75e620ac08ae6e729c1e8ee0d9a9597665d2689 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Montserrat/Montserrat-Bold.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Montserrat/Montserrat-Regular.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Montserrat/Montserrat-Regular.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..0fbe58830786aa9fd7dfb63cc707b41b02117618 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Montserrat/Montserrat-Regular.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Quicksand/Quicksand-Bold.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Quicksand/Quicksand-Bold.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..fc81b59e6d32d0caafc916e1f7ad5561fc9dd8d1 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Quicksand/Quicksand-Bold.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Quicksand/Quicksand-Regular.woff2 b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Quicksand/Quicksand-Regular.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..eb3616c4d6cdf85017eba2aa709e176c16427234 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/fonts/Quicksand/Quicksand-Regular.woff2 differ diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/api-logo.svg b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/api-logo.svg new file mode 100644 index 0000000000000000000000000000000000000000..bce49a58f0e8a89980e96b8f3bb99f7da48e6254 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/api-logo.svg @@ -0,0 +1,4 @@ + + + + diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/camera.svg b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/camera.svg new file mode 100644 index 0000000000000000000000000000000000000000..b46daebb74be9fffa8868fcee3d9f2e8759d08d3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/camera.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/clear.svg b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/clear.svg new file mode 100644 index 0000000000000000000000000000000000000000..bea03307482b585d819f3d581731e17e0ed37c29 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/clear.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/edit.svg b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/edit.svg new file mode 100644 index 0000000000000000000000000000000000000000..07fbe15983f2a5a9f9447c21a414a5c82ee8dadf --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/edit.svg @@ -0,0 +1,39 @@ + + + + + + diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/javascript.svg b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/javascript.svg new file mode 100644 index 0000000000000000000000000000000000000000..426b76c2fb75e27d9825661ddf341ac7aa0e5ced --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/javascript.svg @@ -0,0 +1,16 @@ + diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/logo.svg b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/logo.svg new file mode 100644 index 0000000000000000000000000000000000000000..4666c0347628146bc2d225dfad8363bce6c9cda3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/logo.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/logo_error.svg b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/logo_error.svg new file mode 100644 index 0000000000000000000000000000000000000000..5662b675528d13bd1cd70254cc125e27104f4409 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/logo_error.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + ERROR + + + diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/logo_nosize.svg b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/logo_nosize.svg new file mode 100644 index 0000000000000000000000000000000000000000..7452f8f41c286bacbd55a1b8dd338b56b7ba61f5 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/logo_nosize.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/python.svg b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/python.svg new file mode 100644 index 0000000000000000000000000000000000000000..ae0065b85722deca4baac8222b2ebf1df4a1c82b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/python.svg @@ -0,0 +1,20 @@ + diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/undo-solid.svg b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/undo-solid.svg new file mode 100644 index 0000000000000000000000000000000000000000..bbbc9670bbf3efdd50fb683f2fb5eac6eaff9f81 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/frontend/static/img/undo-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/BlockLabel-bKYWnOzQ.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/BlockLabel-bKYWnOzQ.js new file mode 100644 index 0000000000000000000000000000000000000000..5aa98f8f87df230fec933875a0b80ac3bd483e32 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/BlockLabel-bKYWnOzQ.js @@ -0,0 +1,8 @@ +import { f as fallback } from './async-D55cHugf.js'; +import { a as attr, f as attr_class, d as bind_props } from './index-u8mz_F03.js'; +import { e as escape_html } from './escaping-CBnpiEl5.js'; + +/* empty css */function k(t,a){let b=fallback(a.label,null),s=a.Icon,e=fallback(a.show_label,true),c=fallback(a.disable,false),f=fallback(a.float,true),o=fallback(a.rtl,false);t.push(``),bind_props(a,{label:b,Icon:s,show_label:e,disable:c,float:f,rtl:o});} + +export { k }; +//# sourceMappingURL=BlockLabel-bKYWnOzQ.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/BlockTitle-BnJIYf6a.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/BlockTitle-BnJIYf6a.js new file mode 100644 index 0000000000000000000000000000000000000000..dd3ecd00d1f1ccd469061c554d9c3a710a005540 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/BlockTitle-BnJIYf6a.js @@ -0,0 +1,8 @@ +import { f as fallback } from './async-D55cHugf.js'; +import { a as attr, f as attr_class, s as slot, d as bind_props } from './index-u8mz_F03.js'; +import { u } from './Info-DU6zbiUl.js'; + +/* empty css */function c(l,a){let i=fallback(a.show_label,true),s=fallback(a.info,void 0),o=fallback(a.rtl,false);l.push(``),slot(l,a,"default",{}),l.push(" "),s?(l.push(""),u(l,{info:s})):l.push(""),l.push(""),bind_props(a,{show_label:i,info:s,rtl:o});} + +export { c }; +//# sourceMappingURL=BlockTitle-BnJIYf6a.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Button-C_X4rUwO.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Button-C_X4rUwO.js new file mode 100644 index 0000000000000000000000000000000000000000..3f2a1c4fae638f27c41f2b47465e0793e7b78c2b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Button-C_X4rUwO.js @@ -0,0 +1,9 @@ +import './async-D55cHugf.js'; +import { a as attr, f as attr_class, g as attr_style, i as stringify } from './index-u8mz_F03.js'; +import './2-BLdXJizP.js'; +import { c } from './Image-CuPo5pWT.js'; + +/* empty css *//* empty css */function q(_,d){_.component(t=>{let{elem_id:f,elem_classes:c$1=[],visible:s,variant:m,size:g,value:u,link:h,link_target:b,icon:l,disabled:a,scale:o,min_width:n,onclick:w=()=>{},children:p}=d;h&&h.length>0?(t.push(""),t.push(``),l?(t.push(""),c(t,{src:l.url,restProps:{alt:`${u} icon`,class:"button-icon"}})):t.push(""),t.push(" "),p?(t.push(""),p(t),t.push("")):t.push(""),t.push("
          ")):(t.push(""),t.push(``),l?(t.push(""),c(t,{restProps:{alt:`${u} icon`},class_names:[`button-icon ${u?"right-padded":""}`],src:l.url})):t.push(""),t.push(" "),p?(t.push(""),p(t),t.push("")):t.push(""),t.push("")),t.push("");});} + +export { q }; +//# sourceMappingURL=Button-C_X4rUwO.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Clear-D7Yjckqz.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Clear-D7Yjckqz.js new file mode 100644 index 0000000000000000000000000000000000000000..56bd3f88c7aec009387cb74d3fa20e059dbffa85 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Clear-D7Yjckqz.js @@ -0,0 +1,6 @@ +import './async-D55cHugf.js'; + +function o(e){e.push('');} + +export { o }; +//# sourceMappingURL=Clear-D7Yjckqz.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Copy-B8YOhH7c.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Copy-B8YOhH7c.js new file mode 100644 index 0000000000000000000000000000000000000000..41b2ed73fa046eceecb428ead0951bad426d1cec --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Copy-B8YOhH7c.js @@ -0,0 +1,6 @@ +import './async-D55cHugf.js'; + +function h(r){r.push('');} + +export { h }; +//# sourceMappingURL=Copy-B8YOhH7c.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Empty-DGRbZO0a.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Empty-DGRbZO0a.js new file mode 100644 index 0000000000000000000000000000000000000000..bf7235200f0a096d8705404fa1c549e3086a7a29 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Empty-DGRbZO0a.js @@ -0,0 +1,7 @@ +import { f as fallback } from './async-D55cHugf.js'; +import { f as attr_class, s as slot, d as bind_props } from './index-u8mz_F03.js'; + +/* empty css */function p(t,a){let s,e=fallback(a.size,"small"),i=fallback(a.unpadded_box,false);function d(o){return false}s=d(),t.push(`
          `),slot(t,a,"default",{}),t.push("
          "),bind_props(a,{size:e,unpadded_box:i});} + +export { p }; +//# sourceMappingURL=Empty-DGRbZO0a.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Example24-BvT_xyd-.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Example24-BvT_xyd-.js new file mode 100644 index 0000000000000000000000000000000000000000..e9cce98ec856cba8ae866e343e0bd00f155096d1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Example24-BvT_xyd-.js @@ -0,0 +1,9 @@ +import { f as fallback } from './async-D55cHugf.js'; +import { f as attr_class, d as bind_props } from './index-u8mz_F03.js'; +import { e as escape_html } from './escaping-CBnpiEl5.js'; +import './context-CBkBucIx.js'; + +function c(d,e){let t=e.value,a=e.type,s=fallback(e.selected,false);d.push(`${escape_html(t!==null?t:"")}`),bind_props(e,{value:t,type:a,selected:s});} + +export { c as default }; +//# sourceMappingURL=Example24-BvT_xyd-.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Example25-hC7y3ome.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Example25-hC7y3ome.js new file mode 100644 index 0000000000000000000000000000000000000000..f2f4fc92086ebad51ea2b976d78a54db5915b9aa --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Example25-hC7y3ome.js @@ -0,0 +1,9 @@ +import { f as fallback } from './async-D55cHugf.js'; +import { f as attr_class, d as bind_props } from './index-u8mz_F03.js'; +import { e as escape_html } from './escaping-CBnpiEl5.js'; +import './context-CBkBucIx.js'; + +function r(s,e){let a=e.value,t=e.type,i=fallback(e.selected,false);s.push(`
          ${escape_html(JSON.stringify(a,null,2))}
          `),bind_props(e,{value:a,type:t,selected:i});} + +export { r as default }; +//# sourceMappingURL=Example25-hC7y3ome.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Example28-BxG4ajHL.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Example28-BxG4ajHL.js new file mode 100644 index 0000000000000000000000000000000000000000..d08bf66659f757df6ca3be0f838813ef09a41519 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Example28-BxG4ajHL.js @@ -0,0 +1,14 @@ +import './async-D55cHugf.js'; +import { f as attr_class } from './index-u8mz_F03.js'; +import { c as ch } from './Video2-BN5I0jvO.js'; +import './2-BLdXJizP.js'; +import './escaping-CBnpiEl5.js'; +import './context-CBkBucIx.js'; +import './index5-BoOEKc6P.js'; +import './dev-fallback-Bc5Ork7Y.js'; +import './index-Cg-Pg6j3.js'; + +function g(i,n){i.component(o=>{let{type:u,selected:p=false,value:a=null,loop:m}=n,t;async function d(){t&&(t.muted=true,t.playsInline=true,t.controls=false,t.setAttribute("muted",""),await t.play(),t.pause());}let l=true,s;function c(e){a?(e.push(""),e.push(""),e.push(``),ch(e,{muted:true,playsinline:true,onloadeddata:d,onmouseover:()=>t?.play(),onmouseout:()=>t?.pause(),src:a?.url,is_stream:false,loop:m,get node(){return t},set node(f){t=f,l=false;}}),e.push(""),e.push("")):e.push(""),e.push("");}do l=true,s=o.copy(),c(s);while(!l);o.subsume(s);});} + +export { g as default }; +//# sourceMappingURL=Example28-BxG4ajHL.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/FileUpload-CAvfA7nt.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/FileUpload-CAvfA7nt.js new file mode 100644 index 0000000000000000000000000000000000000000..8f8491a5eb6d5d971f5832b05626d1c5ca8c25a4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/FileUpload-CAvfA7nt.js @@ -0,0 +1,19 @@ +import './async-D55cHugf.js'; +import { d as bind_props, g as attr_style, e as ensure_array_like, f as attr_class, a as attr, s as slot } from './index-u8mz_F03.js'; +import { t as tick } from './index-server-CQz6EZl_.js'; +import { e as ee } from './Upload2-uTutz1dY.js'; +import { k } from './BlockLabel-bKYWnOzQ.js'; +import { w } from './IconButton-BRnu7KaR.js'; +import { o } from './Clear-D7Yjckqz.js'; +import { i } from './File-DQh5d1OO.js'; +import { h } from './Upload-BbxeBrrD.js'; +import './2-BLdXJizP.js'; +import { y } from './IconButtonWrapper-CjFRPb3y.js'; +import { u } from './DownloadLink-nj1p0krE.js'; +import { e as escape_html } from './escaping-CBnpiEl5.js'; +import { h as html } from './html-CfyvkLET.js'; + +const Q=f=>{let g=["B","KB","MB","GB","PB"],t=0;for(;f>1024;)f/=1024,t++;let l=g[t];return f.toFixed(1)+" "+l};function S(f,g){f.component(t=>{let{value:l,selectable:A=false,height:c=void 0,i18n:r,allow_reordering:d=false,onselect:U,onchange:x,ondelete:B,ondownload:b}=g,y=null,m=null;function v(s){const p=s.lastIndexOf(".");return p===-1?[s,""]:[s.slice(0,p),s.slice(p)]}let o=(Array.isArray(l)?l:[l]).map(s=>{const[p,n]=v(s.orig_name??"");return {...s,filename_stem:p,filename_ext:n}});const I=typeof window<"u";t.push(`
          `);const u$1=ensure_array_like(o);for(let s=0,p=u$1.length;s1)}>"),o.length>1?(t.push(""),t.push('')):t.push(""),t.push("");}t.push("
          `),d&&o.length>1?(t.push(""),t.push('⋮⋮')):t.push(""),t.push(` ${escape_html(n.filename_stem)} ${escape_html(n.filename_ext)}`),n.url?(t.push(""),u(t,{href:n.url,download:I&&window.__is_colab__?null:n.orig_name,children:k=>{k.push(`${html(n.size!=null?Q(n.size):"(size unknown)")} ⇣`);},$$slots:{default:true}})):(t.push(""),t.push(`${escape_html(r("file.uploading"))}`)),t.push("
          ");});}function pl(f,g){f.component(t=>{let{value:l=void 0,label:A,show_label:c=true,file_count:r="single",file_types:d=null,selectable:U=false,root:x,height:B=void 0,i18n:b,max_file_size:y$1=null,upload:m,stream_handler:v,uploading:o$1=false,allow_reordering:I=false,upload_promise:u=void 0,buttons:s=null,on_custom_button_click:p=null,onchange:n,onclear:k$1,ondrag:T,onupload:K,onerror:P,ondelete:M,onselect:O}=g;async function C(a){Array.isArray(l)?l=[...l,...Array.isArray(a)?a:[a]]:l?l=[l,...Array.isArray(a)?a:[a]]:l=a,await tick(),n?.(l),K?.(l);}function R(){l=null,n?.(null),k$1?.();}let w$1=false,h$1=true,F;function W(a){c&&s&&s.length>0?(a.push(""),y(a,{buttons:s,on_custom_button_click:p})):a.push(""),a.push(" "),k(a,{show_label:c,Icon:i,float:!l,label:A||"File"}),a.push(" "),l&&(!Array.isArray(l)||l.length>0)?(a.push(""),y(a,{buttons:s||[],on_custom_button_click:p,children:e=>{r==="single"&&(Array.isArray(l)?l.length>0:l!==null)?e.push(""):(e.push(""),w(e,{Icon:h,label:b("common.upload"),children:z=>{ee(z,{icon_upload:true,onload:C,filetype:d,file_count:r,max_file_size:y$1,root:x,onerror:P,stream_handler:v,upload:m,get upload_promise(){return u},set upload_promise(_){u=_,h$1=false;},get dragging(){return w$1},set dragging(_){w$1=_,h$1=false;},get uploading(){return o$1},set uploading(_){o$1=_,h$1=false;}});}})),e.push(" "),w(e,{Icon:o,label:b("common.clear"),onclick:z=>{z.stopPropagation(),R();}}),e.push("");}}),a.push(" "),S(a,{i18n:b,onselect:O,selectable:U,value:l,height:B,onchange:n,ondelete:M,allow_reordering:I}),a.push("")):(a.push(""),ee(a,{onload:C,filetype:d,file_count:r,max_file_size:y$1,root:x,onerror:P,stream_handler:v,upload:m,height:B,get upload_promise(){return u},set upload_promise(e){u=e,h$1=false;},get dragging(){return w$1},set dragging(e){w$1=e,h$1=false;},get uploading(){return o$1},set uploading(e){o$1=e,h$1=false;},children:e=>{e.push(""),slot(e,g,"default",{}),e.push("");},$$slots:{default:true}})),a.push("");}do h$1=true,F=t.copy(),W(F);while(!h$1);t.subsume(F),bind_props(g,{value:l,uploading:o$1,upload_promise:u});});} + +export { S, pl as p }; +//# sourceMappingURL=FileUpload-CAvfA7nt.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index13-ATH7_eve.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index13-ATH7_eve.js new file mode 100644 index 0000000000000000000000000000000000000000..e37537360de0c1317290ab1f8c2fc7430b8a45a6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index13-ATH7_eve.js @@ -0,0 +1,15 @@ +import './async-D55cHugf.js'; +import { a as attr, f as attr_class, j as clsx } from './index-u8mz_F03.js'; +import './2-BLdXJizP.js'; +import { $ } from './utils.svelte-B2py64Fz.js'; +import './escaping-CBnpiEl5.js'; +import './context-CBkBucIx.js'; +import './index5-BoOEKc6P.js'; +import './dev-fallback-Bc5Ork7Y.js'; +import './index-Cg-Pg6j3.js'; +import './clone-Yk88IHKV.js'; + +function b(s,t){s.component(a=>{const{$$slots:d,$$events:c,...n}=t,e=new $(n);({visible:e.shared.visible,main_page_name:e.props.main_page_name??"Home",value:e.props.value});a.push(`
          `);});} + +export { b as default }; +//# sourceMappingURL=Index13-ATH7_eve.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index23-DRLu7Qlf.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index23-DRLu7Qlf.js new file mode 100644 index 0000000000000000000000000000000000000000..246ed0f5f37d8d98f6280c4bbde553f319f3f759 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index23-DRLu7Qlf.js @@ -0,0 +1,49 @@ +import './async-D55cHugf.js'; +import { c as spread_props, f as attr_class, j as clsx } from './index-u8mz_F03.js'; +import { t as tick } from './index-server-CQz6EZl_.js'; +import { G } from './Block-DZmzQwnI.js'; +import './2-BLdXJizP.js'; +import { $ } from './utils.svelte-B2py64Fz.js'; +import { k } from './UploadText-BDXc1cBO.js'; +import { w } from './SelectSource-Bhpgvmj9.js'; +import { G as xt, h as ll } from './Gallery-CCN3JI-P.js'; +import { W } from './index3-Df92vI-L.js'; +import { p as pl } from './FileUpload-CAvfA7nt.js'; +import { Z } from './Webcam2-CNM_PDwT.js'; +export { default as BaseExample } from './Example17-B0rWh-Zw.js'; +import './escaping-CBnpiEl5.js'; +import './context-CBkBucIx.js'; +import './index5-BoOEKc6P.js'; +import './dev-fallback-Bc5Ork7Y.js'; +import './index-Cg-Pg6j3.js'; +import './clone-Yk88IHKV.js'; +import './Upload-BbxeBrrD.js'; +import './Microphone-BMM9-23W.js'; +import './Video-FfbWmOVG.js'; +import './Webcam-CvKMKUzA.js'; +import './BlockLabel-bKYWnOzQ.js'; +import './IconButton-BRnu7KaR.js'; +import './Empty-DGRbZO0a.js'; +import './ShareButton-7VTs9dOO.js'; +import './Clear-D7Yjckqz.js'; +import './Download-DcU5dONL.js'; +import './Image2-vcp9_ifi.js'; +import './Play-B_z3rKL1.js'; +import './IconButtonWrapper-CjFRPb3y.js'; +import './FullscreenButton-D8PvgSmk.js'; +import './Maximize-CuHbK64j.js'; +import './Upload2-uTutz1dY.js'; +import './ModifyUpload-CWSi2EyW.js'; +import './DownloadLink-nj1p0krE.js'; +import './Edit-DWZSi_T0.js'; +import './Undo-Ce01x-M5.js'; +import './Image-CuPo5pWT.js'; +import './Video2-BN5I0jvO.js'; +import './File-DQh5d1OO.js'; +import './html-CfyvkLET.js'; +import './StreamingBar-BGU65w2M.js'; + +function le(g,b){g.component(_=>{let r;class y extends ${async get_data(){return r&&(await r,await tick()),await super.get_data()}}const{$$slots:q,$$events:E,...x}=b,e=new y(x,{selected_index:null,file_types:["image","video"]});let n=false;function G$1(o){if(!e.props.value)return;const{index:a}=o;e.dispatch("delete",o),e.props.value=e.props.value.filter((s,t)=>t!==a),e.dispatch("change",e.props.value);}async function u(o){return (await Promise.all(o.map(async s=>{if(s.path?.toLowerCase().endsWith(".svg")&&s.url){const l=await(await fetch(s.url)).text();return {...s,url:`data:image/svg+xml,${encodeURIComponent(l)}`}}return s}))).map(s=>s.mime_type?.includes("video")?{video:s,caption:null}:{image:s,caption:null})}let i=e.props.sources?e.props.sources[0]:"upload",m=e.props.value===null?true:e.props.value.length===0,c=e.props.file_types?.includes("video")&&e.props.sources.includes("webcam")?e.props.sources.concat(["webcam-video"]):e.props.sources;async function f(){navigator.clipboard.read().then(async o=>{let a=null;for(let s=0;s(e.props.file_types||["image"]).some(A=>l.startsWith(A+"/")));if(t){const l=await o[s].getType(t);a=new File([l],`clipboard.${t.replace("image/","")}`);break}}if(a){const s=await ll(a,l=>e.shared.client.upload(l,e.shared.root),"clipboard_upload"),t=await u(s);e.props.value?.push(...t),e.dispatch("change",e.props.value),i=null;}else e.dispatch("warning","No image or video found in clipboard");});}async function k$1(o){o==="clipboard"&&await f();}async function S(o){await tick(),o==="clipboard"?await f():(i=o,m=true);}let p=true,d;function z(o){G(o,{visible:e.shared.visible,variant:"solid",padding:false,elem_id:e.shared.elem_id,elem_classes:e.shared.elem_classes,container:e.shared.container,scale:e.shared.scale,min_width:e.shared.min_width,allow_overflow:false,height:e.props.height||void 0,get fullscreen(){return n},set fullscreen(a){n=a,p=false;},children:a=>{W(a,spread_props([{autoscroll:e.shared.autoscroll,i18n:e.i18n},e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}])),a.push(" "),e.shared.interactive&&m?(a.push(""),a.push(``),pl(a,{value:null,root:e.shared.root,label:e.shared.label,max_file_size:e.shared.max_file_size,file_count:"multiple",file_types:e.props.file_types,i18n:e.i18n,upload:(...s)=>e.shared.client.upload(...s),stream_handler:(...s)=>e.shared.client.stream(...s),onupload:async s=>{const t=Array.isArray(s)?s:[s];e.props.value=await u(t),i=null,e.dispatch("upload",e.props.value),e.dispatch("change",e.props.value);},onerror:({detail:s})=>{e.shared.loading_status=e.shared.loading_status||{},e.shared.loading_status.status="error",e.dispatch("error",s);},get upload_promise(){return r},set upload_promise(s){r=s,p=false;},children:s=>{k(s,{i18n:e.i18n,type:"gallery"});},$$slots:{default:true}}),a.push(" "),i==="webcam"?(a.push(""),Z(a,{root:e.shared.root,value:null,mirror_webcam:true,streaming:false,mode:"image",include_audio:false,i18n:e.i18n,upload:(...s)=>e.shared.client.upload(...s)})):(a.push(""),i==="webcam-video"?(a.push(""),Z(a,{root:e.shared.root,value:null,mirror_webcam:true,streaming:false,mode:"video",include_audio:false,i18n:e.i18n,upload:(...s)=>e.shared.client.upload(...s)})):a.push(""),a.push("")),a.push(" "),c.length>1||c.includes("clipboard")?(a.push(""),w(a,{sources:c,handle_clear:()=>e.dispatch("clear"),handle_select:k$1,get active_source(){return i},set active_source(s){i=s,p=false;}})):a.push(""),a.push("")):(a.push(""),xt(a,{onchange:()=>e.dispatch("change"),onclear:()=>e.dispatch("change"),onselect:s=>e.dispatch("select",s),onshare:s=>e.dispatch("share",s.detail),onerror:s=>e.dispatch("error",s.detail),onpreview_open:()=>{e.dispatch("preview_open");},onpreview_close:()=>e.dispatch("preview_close"),onfullscreen:({detail:s})=>{n=s;},ondelete:G$1,onupload:async s=>{const t=Array.isArray(s)?s:[s],l=await u(t);e.props.value=e.props.value?[...e.props.value,...l]:l,e.dispatch("upload",l),e.dispatch("change",e.props.value);},sources:c,onsource_change:S,label:e.shared.label,show_label:e.shared.show_label,columns:e.props.columns,rows:e.props.rows,height:e.props.height,preview:e.props.preview,object_fit:e.props.object_fit,interactive:e.shared.interactive,allow_preview:e.props.allow_preview,show_share_button:e.props.buttons.some(s=>typeof s=="string"&&s==="share"),show_download_button:e.props.buttons.some(s=>typeof s=="string"&&s==="download"),fit_columns:e.props.fit_columns,i18n:e.i18n,_fetch:(...s)=>e.shared.client.fetch(...s),show_fullscreen_button:e.props.buttons.some(s=>typeof s=="string"&&s==="fullscreen"),buttons:e.props.buttons,oncustom_button_click:s=>{e.dispatch("custom_button_click",{id:s});},fullscreen:n,root:e.shared.root,file_types:e.props.file_types,max_file_size:e.shared.max_file_size,upload:(...s)=>e.shared.client.upload(...s),stream_handler:(...s)=>e.shared.client.stream(...s),get selected_index(){return e.props.selected_index},set selected_index(s){e.props.selected_index=s,p=false;},get value(){return e.props.value},set value(s){e.props.value=s,p=false;}})),a.push("");},$$slots:{default:true}});}do p=true,d=_.copy(),z(d);while(!p);_.subsume(d);});} + +export { xt as BaseGallery, le as default }; +//# sourceMappingURL=Index23-DRLu7Qlf.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index34-DwSVY7tj.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index34-DwSVY7tj.js new file mode 100644 index 0000000000000000000000000000000000000000..7d61f4f8f5f14ca8abd42c1c0b47617fa9da4915 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index34-DwSVY7tj.js @@ -0,0 +1,23 @@ +import './async-D55cHugf.js'; +import { f as attr_class, g as attr_style, e as ensure_array_like, a as attr, i as stringify, c as spread_props } from './index-u8mz_F03.js'; +import './2-BLdXJizP.js'; +import { $ } from './utils.svelte-B2py64Fz.js'; +import { e } from './LineChart-DIvFgn2j.js'; +import { G } from './Block-DZmzQwnI.js'; +import { k as k$1 } from './BlockLabel-bKYWnOzQ.js'; +import { p } from './Empty-DGRbZO0a.js'; +import { y } from './IconButtonWrapper-CjFRPb3y.js'; +import { W } from './index3-Df92vI-L.js'; +import { e as escape_html } from './escaping-CBnpiEl5.js'; +import './context-CBkBucIx.js'; +import './index5-BoOEKc6P.js'; +import './dev-fallback-Bc5Ork7Y.js'; +import './index-Cg-Pg6j3.js'; +import './clone-Yk88IHKV.js'; +import './IconButton-BRnu7KaR.js'; +import './Clear-D7Yjckqz.js'; + +function k(i,n){i.component(l=>{let{value:c,color:h=void 0,selectable:p=false,show_heading:s=true,onselect:u}=n;function t(e){return e.replace(/\s/g,"-")}if(l.push('
          '),s||!c.confidences?(l.push(""),l.push(`${escape_html(c.label)}`)):l.push(""),l.push(" "),typeof c=="object"&&c.confidences){l.push(""),l.push("");const e=ensure_array_like(c.confidences);for(let d=0,b=e.length;d
          ${escape_html(o.label)}
          ${escape_html(Math.round(o.confidence*100))}%
          `);}l.push("");}else l.push("");l.push("
          ");});}function A(i,n){i.component(l=>{const{$$slots:c,$$events:h,...p$1}=n,s=new $(p$1);let u=s.props.value.label;s.watch_for_change(),G(l,{test_id:"label",visible:s.shared.visible,elem_id:s.shared.elem_id,elem_classes:s.shared.elem_classes,container:s.shared.container,scale:s.shared.scale,min_width:s.shared.min_width,padding:false,children:t=>{W(t,spread_props([{autoscroll:s.shared.autoscroll,i18n:s.i18n},s.shared.loading_status,{on_clear_status:()=>s.dispatch("clear_status",s.shared.loading_status)}])),t.push(" "),s.shared.show_label&&s.props.buttons&&s.props.buttons.length>0?(t.push(""),y(t,{buttons:s.props.buttons,on_custom_button_click:e=>{s.dispatch("custom_button_click",{id:e});}})):t.push(""),t.push(" "),s.shared.show_label?(t.push(""),k$1(t,{Icon:e,label:s.shared.label||s.i18n("label.label"),disable:s.shared.container===false,float:s.props.show_heading===true})):t.push(""),t.push(" "),u!=null?(t.push(""),k(t,{onselect:e=>s.dispatch("select",e),selectable:s.props._selectable,value:s.props.value,color:s.props.color,show_heading:s.props.show_heading})):(t.push(""),p(t,{unpadded_box:true,children:e$1=>{e(e$1);},$$slots:{default:true}})),t.push("");},$$slots:{default:true}});});} + +export { k as BaseLabel, A as default }; +//# sourceMappingURL=Index34-DwSVY7tj.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index48-DXYf4HkK.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index48-DXYf4HkK.js new file mode 100644 index 0000000000000000000000000000000000000000..c7320624a41b82593450c5030330a2907c9f1fba --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Index48-DXYf4HkK.js @@ -0,0 +1,23 @@ +import './async-D55cHugf.js'; +import { d as bind_props, e as ensure_array_like, g as attr_style, f as attr_class, a as attr, c as spread_props } from './index-u8mz_F03.js'; +import './2-BLdXJizP.js'; +import { o } from './Clear-D7Yjckqz.js'; +import { G } from './Block-DZmzQwnI.js'; +import { k } from './BlockLabel-bKYWnOzQ.js'; +import { p } from './Empty-DGRbZO0a.js'; +import { $ } from './utils.svelte-B2py64Fz.js'; +import { y } from './IconButtonWrapper-CjFRPb3y.js'; +import { W } from './index3-Df92vI-L.js'; +import { e as escape_html } from './escaping-CBnpiEl5.js'; +import './context-CBkBucIx.js'; +import './index5-BoOEKc6P.js'; +import './dev-fallback-Bc5Ork7Y.js'; +import './index-Cg-Pg6j3.js'; +import './clone-Yk88IHKV.js'; +import './IconButton-BRnu7KaR.js'; + +function I(s){s.push('');}function R(s){if(!s)return true;const c=s.toLowerCase().trim();return c==="transparent"||c.length===9&&c.endsWith("00")}function P(s,c){if(s.length===0)return [];const p=[];let u=s[0].token,r=s[0].class_or_confidence;for(let o=1;o{let{value:u=[],label_to_edit:r=-1,category:o,active_legend:e,color_map:h,label_index:_,token:m,onchange:w,is_scores_mode:d=false}=c,a=o?.toString()??"";function n(){if(d){const f=typeof o=="number"?o:parseFloat(o??"0");return Q(f)}return o===null||e&&e!==o?"":h[o]?.primary??""}p.push(``),bind_props(c,{value:u,label_to_edit:r});});}function X(s,c){s.component(p=>{let {value:u=[],show_legend:r=false,show_inline_category:o$1=true,color_map:e={},show_whitespaces:h=false,interactive:_=false,onselect:m,onchange:w}=c,a="",n=-1,k={};function A(){w?.(u),n=-1;}function C(t){return t===null?"":k[t]?.secondary??""}function O(t){return t===null?"":k[t]?.primary??""}function T(t){const b=C(t);return R(b)?"":"black"}let y=true,M;function G(t){t.push('
          ');{if(t.push(""),r){t.push(""),t.push('
          ');const g=ensure_array_like(Object.entries(k));for(let v=0,x=g.length;v${escape_html(i)}`);}t.push("
          ");}else t.push("");t.push('
          ');const b=ensure_array_like(u);for(let g=0,v=b.length;g");const E=ensure_array_like(B);for(let L=0,W=E.length;L");const H=C(i);t.push(`${escape_html(S)} `),!r&&o$1&&i!==null&&n!==g?(t.push(""),t.push(`${escape_html(i)}`)):t.push(""),t.push(" "),_&&n===g&&i!==null?(t.push(""),U(t,{category:i,active_legend:a,color_map:k,label_index:g,token:x,onchange:A,get value(){return u},set value(z){u=z,y=false;},get label_to_edit(){return n},set label_to_edit(z){n=z,y=false;}})):t.push(""),t.push(" "),_&&i!==null?(t.push(""),t.push('")):t.push(""),t.push("");}else t.push("");t.push(" "),L"),t.push('')):t.push(""),t.push("");}t.push("");}t.push("
          ");}t.push("
          ");}do y=true,M=p.copy(),G(M);while(!y);p.subsume(M),bind_props(c,{value:u});});}function _t(s,c){s.component(p$1=>{const{$$slots:u,$$events:r,...o}=c,e=new $(o);e.props.value;let h=e.props.combine_adjacent?P(e.props.value||[]):e.props.value,_=true,m;function w(d){G(d,{variant:e.shared.interactive?"dashed":"solid",test_id:"highlighted-text",visible:e.shared.visible,elem_id:e.shared.elem_id,elem_classes:e.shared.elem_classes,padding:false,container:e.shared.container,scale:e.shared.scale,min_width:e.shared.min_width,rtl:e.props.rtl,children:a=>{W(a,spread_props([{autoscroll:e.shared.autoscroll,i18n:e.i18n},e.shared.loading_status,{onclearstatus:()=>e.dispatch("clear_status",e.shared.loading_status)}])),a.push(" "),e.shared.interactive&&e.shared.label&&e.shared.show_label&&e.props.buttons?.length?(a.push(""),y(a,{buttons:e.props.buttons,on_custom_button_click:n=>e.dispatch("custom_button_click",{id:n})})):a.push(""),a.push(" "),e.shared.label&&e.shared.show_label?(a.push(""),k(a,{Icon:I,label:e.shared.label||e.i18n("highlighted_text.highlighted_text"),float:false,disable:e.shared.container===false,show_label:e.shared.show_label,rtl:e.props.rtl})):a.push(""),a.push(" "),h?(a.push(""),X(a,{interactive:e.shared.interactive,show_legend:e.props.show_legend,show_inline_category:e.props.show_inline_category,show_whitespaces:e.props.show_whitespaces,color_map:e.props.color_map,onselect:n=>e.dispatch("select",n),onchange:()=>{e.props.value=h,e.dispatch("change");},get value(){return h},set value(n){h=n,_=false;}})):(a.push(""),p(a,{size:e.shared.interactive?"small":"large",unpadded_box:e.shared.interactive,children:n=>{I(n);},$$slots:{default:true}})),a.push("");},$$slots:{default:true}});}do _=true,m=p$1.copy(),w(m);while(!_);p$1.subsume(m);});} + +export { X as BaseHighlightedText, _t as default }; +//# sourceMappingURL=Index48-DXYf4HkK.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Maximize-CuHbK64j.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Maximize-CuHbK64j.js new file mode 100644 index 0000000000000000000000000000000000000000..cfb3012ba3a5938ffd9231d123fea6906e25b8e3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Maximize-CuHbK64j.js @@ -0,0 +1,6 @@ +import './async-D55cHugf.js'; + +function i(t){t.push('');} + +export { i }; +//# sourceMappingURL=Maximize-CuHbK64j.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ModifyUpload-CWSi2EyW.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ModifyUpload-CWSi2EyW.js new file mode 100644 index 0000000000000000000000000000000000000000..78d1e0c642aab2552c250316dc53326f9685e74b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ModifyUpload-CWSi2EyW.js @@ -0,0 +1,14 @@ +import './async-D55cHugf.js'; +import { u } from './DownloadLink-nj1p0krE.js'; +import { w } from './IconButton-BRnu7KaR.js'; +import { o } from './Clear-D7Yjckqz.js'; +import { l } from './Download-DcU5dONL.js'; +import { r } from './Edit-DWZSi_T0.js'; +import { r as r$1 } from './Undo-Ce01x-M5.js'; +import './2-BLdXJizP.js'; +import { y } from './IconButtonWrapper-CjFRPb3y.js'; + +function v(a,m){a.component(u$1=>{let{editable:c=false,undoable:n=false,download:s=null,i18n:l$1,onedit:h,onclear:f,onundo:I,children:t}=m;y(u$1,{children:o$1=>{c?(o$1.push(""),w(o$1,{Icon:r,label:l$1("common.edit"),onclick:()=>h?.()})):o$1.push(""),o$1.push(" "),n?(o$1.push(""),w(o$1,{Icon:r$1,label:l$1("common.undo"),onclick:()=>I?.()})):o$1.push(""),o$1.push(" "),s?(o$1.push(""),u(o$1,{href:s,download:true,children:i=>{w(i,{Icon:l,label:l$1("common.download")});},$$slots:{default:true}})):o$1.push(""),o$1.push(" "),t?(o$1.push(""),t(o$1),o$1.push("")):o$1.push(""),o$1.push(" "),w(o$1,{Icon:o,label:l$1("common.clear"),onclick:i=>{f?.(),i.stopPropagation();}}),o$1.push("");}});});} + +export { v }; +//# sourceMappingURL=ModifyUpload-CWSi2EyW.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ShareButton-7VTs9dOO.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ShareButton-7VTs9dOO.js new file mode 100644 index 0000000000000000000000000000000000000000..f403e11304d9a044c56315890727648f5d373e43 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ShareButton-7VTs9dOO.js @@ -0,0 +1,11 @@ +import './async-D55cHugf.js'; +import { d as bind_props } from './index-u8mz_F03.js'; +import { w } from './IconButton-BRnu7KaR.js'; +import { c as createEventDispatcher } from './index-server-CQz6EZl_.js'; +import './2-BLdXJizP.js'; +import { c } from './utils.svelte-B2py64Fz.js'; + +function u(e){e.push('');}function y(e,a){e.component(l=>{const r=createEventDispatcher();let n=a.formatter,i=a.value,s=a.i18n,o=false;w(l,{Icon:u,label:s("common.share"),pending:o,onclick:async()=>{try{o=!0;const t=await n(i);r("share",{description:t});}catch(t){console.error(t);t instanceof c?t.message:"Share failed.";}finally{o=false;}}}),bind_props(a,{formatter:n,value:i,i18n:s});});} + +export { u, y }; +//# sourceMappingURL=ShareButton-7VTs9dOO.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Upload-BbxeBrrD.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Upload-BbxeBrrD.js new file mode 100644 index 0000000000000000000000000000000000000000..4bcbabbc0422b764ace912b07a376d367d51f1d1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Upload-BbxeBrrD.js @@ -0,0 +1,6 @@ +import './async-D55cHugf.js'; + +function e(t){t.push('');}function h(t){t.push('');} + +export { e, h }; +//# sourceMappingURL=Upload-BbxeBrrD.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Video2-BN5I0jvO.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Video2-BN5I0jvO.js new file mode 100644 index 0000000000000000000000000000000000000000..68b4253410d712df6f2284efff0cb43dcd2bec3c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/Video2-BN5I0jvO.js @@ -0,0 +1,46 @@ +import './async-D55cHugf.js'; +import { f as attr_class, a as attr, d as bind_props } from './index-u8mz_F03.js'; + +var ri;(function(r){r.LOAD="LOAD",r.EXEC="EXEC",r.FFPROBE="FFPROBE",r.WRITE_FILE="WRITE_FILE",r.READ_FILE="READ_FILE",r.DELETE_FILE="DELETE_FILE",r.RENAME="RENAME",r.CREATE_DIR="CREATE_DIR",r.LIST_DIR="LIST_DIR",r.DELETE_DIR="DELETE_DIR",r.ERROR="ERROR",r.DOWNLOAD="DOWNLOAD",r.PROGRESS="PROGRESS",r.LOG="LOG",r.MOUNT="MOUNT",r.UNMOUNT="UNMOUNT";})(ri||(ri={}));var ai;(function(r){r.MEMFS="MEMFS",r.NODEFS="NODEFS",r.NODERAWFS="NODERAWFS",r.IDBFS="IDBFS",r.WORKERFS="WORKERFS",r.PROXYFS="PROXYFS";})(ai||(ai={}));const B=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},Ar=Number.isSafeInteger||function(r){return typeof r=="number"&&Math.abs(r)<=Ir},Ir=Number.MAX_SAFE_INTEGER||9007199254740991;let G=(function(r){return r.NETWORK_ERROR="networkError",r.MEDIA_ERROR="mediaError",r.KEY_SYSTEM_ERROR="keySystemError",r.MUX_ERROR="muxError",r.OTHER_ERROR="otherError",r})({}),_=(function(r){return r.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",r.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",r.KEY_SYSTEM_NO_SESSION="keySystemNoSession",r.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",r.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",r.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",r.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",r.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",r.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",r.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",r.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",r.MANIFEST_LOAD_ERROR="manifestLoadError",r.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",r.MANIFEST_PARSING_ERROR="manifestParsingError",r.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",r.LEVEL_EMPTY_ERROR="levelEmptyError",r.LEVEL_LOAD_ERROR="levelLoadError",r.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",r.LEVEL_PARSING_ERROR="levelParsingError",r.LEVEL_SWITCH_ERROR="levelSwitchError",r.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",r.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",r.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",r.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",r.FRAG_LOAD_ERROR="fragLoadError",r.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",r.FRAG_DECRYPT_ERROR="fragDecryptError",r.FRAG_PARSING_ERROR="fragParsingError",r.FRAG_GAP="fragGap",r.REMUX_ALLOC_ERROR="remuxAllocError",r.KEY_LOAD_ERROR="keyLoadError",r.KEY_LOAD_TIMEOUT="keyLoadTimeOut",r.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",r.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",r.BUFFER_APPEND_ERROR="bufferAppendError",r.BUFFER_APPENDING_ERROR="bufferAppendingError",r.BUFFER_STALLED_ERROR="bufferStalledError",r.BUFFER_FULL_ERROR="bufferFullError",r.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",r.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",r.ASSET_LIST_LOAD_ERROR="assetListLoadError",r.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",r.ASSET_LIST_PARSING_ERROR="assetListParsingError",r.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",r.INTERNAL_EXCEPTION="internalException",r.INTERNAL_ABORTED="aborted",r.ATTACH_MEDIA_ERROR="attachMediaError",r.UNKNOWN="unknown",r})({}),y=(function(r){return r.MEDIA_ATTACHING="hlsMediaAttaching",r.MEDIA_ATTACHED="hlsMediaAttached",r.MEDIA_DETACHING="hlsMediaDetaching",r.MEDIA_DETACHED="hlsMediaDetached",r.MEDIA_ENDED="hlsMediaEnded",r.STALL_RESOLVED="hlsStallResolved",r.BUFFER_RESET="hlsBufferReset",r.BUFFER_CODECS="hlsBufferCodecs",r.BUFFER_CREATED="hlsBufferCreated",r.BUFFER_APPENDING="hlsBufferAppending",r.BUFFER_APPENDED="hlsBufferAppended",r.BUFFER_EOS="hlsBufferEos",r.BUFFERED_TO_END="hlsBufferedToEnd",r.BUFFER_FLUSHING="hlsBufferFlushing",r.BUFFER_FLUSHED="hlsBufferFlushed",r.MANIFEST_LOADING="hlsManifestLoading",r.MANIFEST_LOADED="hlsManifestLoaded",r.MANIFEST_PARSED="hlsManifestParsed",r.LEVEL_SWITCHING="hlsLevelSwitching",r.LEVEL_SWITCHED="hlsLevelSwitched",r.LEVEL_LOADING="hlsLevelLoading",r.LEVEL_LOADED="hlsLevelLoaded",r.LEVEL_UPDATED="hlsLevelUpdated",r.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",r.LEVELS_UPDATED="hlsLevelsUpdated",r.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",r.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",r.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",r.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",r.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",r.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",r.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",r.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",r.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",r.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",r.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",r.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",r.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",r.CUES_PARSED="hlsCuesParsed",r.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",r.INIT_PTS_FOUND="hlsInitPtsFound",r.FRAG_LOADING="hlsFragLoading",r.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",r.FRAG_LOADED="hlsFragLoaded",r.FRAG_DECRYPTED="hlsFragDecrypted",r.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",r.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",r.FRAG_PARSING_METADATA="hlsFragParsingMetadata",r.FRAG_PARSED="hlsFragParsed",r.FRAG_BUFFERED="hlsFragBuffered",r.FRAG_CHANGED="hlsFragChanged",r.FPS_DROP="hlsFpsDrop",r.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",r.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",r.ERROR="hlsError",r.DESTROYING="hlsDestroying",r.KEY_LOADING="hlsKeyLoading",r.KEY_LOADED="hlsKeyLoaded",r.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",r.BACK_BUFFER_REACHED="hlsBackBufferReached",r.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",r.ASSET_LIST_LOADING="hlsAssetListLoading",r.ASSET_LIST_LOADED="hlsAssetListLoaded",r.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",r.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",r.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",r.INTERSTITIAL_STARTED="hlsInterstitialStarted",r.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",r.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",r.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",r.INTERSTITIAL_ENDED="hlsInterstitialEnded",r.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",r.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",r.EVENT_CUE_ENTER="hlsEventCueEnter",r})({});var $e={AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},K={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class it{constructor(e,t=0,s=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=s;}sample(e,t){const s=Math.pow(this.alpha_,e);this.estimate_=t*(1-s)+s*this.estimate_,this.totalWeight_+=e;}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class Rr{constructor(e,t,s,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new it(e),this.fast_=new it(t),this.defaultTTFB_=i,this.ttfb_=new it(e);}update(e,t){const{slow_:s,fast_:i,ttfb_:n}=this;s.halfLife!==e&&(this.slow_=new it(e,s.getEstimate(),s.getTotalWeight())),i.halfLife!==t&&(this.fast_=new it(t,i.getEstimate(),i.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new it(e,n.getEstimate(),n.getTotalWeight()));}sample(e,t){e=Math.max(e,this.minDelayMs_);const s=8*t,i=e/1e3,n=s/i;this.fast_.sample(i,n),this.slow_.sample(i,n);}sampleTTFB(e){const t=e/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(s,Math.max(e,5));}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function Lr(r,e,t){return (e=_r(e))in r?Object.defineProperty(r,e,{value:t,enumerable:true,configurable:true,writable:true}):r[e]=t,r}function ie(){return ie=Object.assign?Object.assign.bind():function(r){for(var e=1;e"u"?void 0:(r||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function kr(r){return typeof self<"u"&&r===self.ManagedMediaSource}function ln(r,e){const t=Object.keys(r),s=Object.keys(e),i=t.length,n=s.length;return !i||!n||i===n&&!t.some(a=>s.indexOf(a)===-1)}function Se(r,e=false){if(typeof TextDecoder<"u"){const c=new TextDecoder("utf-8").decode(r);if(e){const h=c.indexOf("\0");return h!==-1?c.substring(0,h):c}return c.replace(/\0/g,"")}const t=r.length;let s,i,n,a="",o=0;for(;o>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(s);break;case 12:case 13:i=r[o++],a+=String.fromCharCode((s&31)<<6|i&63);break;case 14:i=r[o++],n=r[o++],a+=String.fromCharCode((s&15)<<12|(i&63)<<6|(n&63)<<0);break}}return a}function xe(r){let e="";for(let t=0;t8&&r[t+4]===109&&r[t+5]===111&&r[t+6]===111&&r[t+7]===102)return true;t=s>1?t+s:e;}return false}function z(r,e){const t=[];if(!e.length)return t;const s=r.byteLength;for(let i=0;i1?i+n:s;if(a===e[0])if(e.length===1)t.push(r.subarray(i+8,o));else {const l=z(r.subarray(i+8,o),e.slice(1));l.length&&Mr.apply(t,l);}i=o;}return t}function Br(r){const e=[],t=r[0];let s=8;const i=$(r,s);s+=4;let n=0,a=0;t===0?(n=$(r,s),a=$(r,s+4),s+=8):(n=hi(r,s),a=hi(r,s+8),s+=16),s+=2;let o=r.length+a;const l=hn(r,s);s+=2;for(let c=0;c>>31===1)return re.warn("SIDX has hierarchical references (not supported)"),null;const f=$(r,h);h+=4,e.push({referenceSize:d,subsegmentDuration:f,info:{duration:f/i,start:o,end:o+d-1}}),o+=d,h+=4,s=h;}return {earliestPresentationTime:n,timescale:i,version:t,referencesCount:l,references:e}}function dn(r){const e=[],t=z(r,["moov","trak"]);for(let i=0;i{const n=$(i,4),a=e[n];a&&(a.default={duration:$(i,12),flags:$(i,20)});}),e}function Ur(r){const e=r.subarray(8),t=e.subarray(86),s=ae(e.subarray(4,8));let i=s,n;const a=s==="enca"||s==="encv";if(a){const c=z(e,[s])[0].subarray(s==="enca"?28:78);z(c,["sinf"]).forEach(u=>{const d=z(u,["schm"])[0];if(d){const g=ae(d.subarray(4,8));if(g==="cbcs"||g==="cenc"){const f=z(u,["frma"])[0];f&&(i=ae(f));}}});}const o=i;switch(i){case "avc1":case "avc2":case "avc3":case "avc4":{const l=z(t,["avcC"])[0];l&&l.length>3&&(i+="."+Lt(l[1])+Lt(l[2])+Lt(l[3]),n=Rt(o==="avc1"?"dva1":"dvav",t));break}case "mp4a":{const l=z(e,[s])[0],c=z(l.subarray(28),["esds"])[0];if(c&&c.length>7){let h=4;if(c[h++]!==3)break;h=ns(c,h),h+=2;const u=c[h++];if(u&128&&(h+=2),u&64&&(h+=c[h++]),c[h++]!==4)break;h=ns(c,h);const d=c[h++];if(d===64)i+="."+Lt(d);else break;if(h+=12,c[h++]!==5)break;h=ns(c,h);const g=c[h++];let f=(g&248)>>3;f===31&&(f+=1+((g&7)<<3)+((c[h]&224)>>5)),i+="."+f;}break}case "hvc1":case "hev1":{const l=z(t,["hvcC"])[0];if(l&&l.length>12){const c=l[1],h=["","A","B","C"][c>>6],u=c&31,d=$(l,2),g=(c&32)>>5?"H":"L",f=l[12],m=l.subarray(6,12);i+="."+h+u,i+="."+$r(d).toString(16).toUpperCase(),i+="."+g+f;let p="";for(let S=m.length;S--;){const E=m[S];(E||p)&&(p="."+E.toString(16).toUpperCase()+p);}i+=p;}n=Rt(o=="hev1"?"dvhe":"dvh1",t);break}case "dvh1":case "dvhe":case "dvav":case "dva1":case "dav1":{i=Rt(i,t)||i;break}case "vp09":{const l=z(t,["vpcC"])[0];if(l&&l.length>6){const c=l[4],h=l[5],u=l[6]>>4&15;i+="."+ke(c)+"."+ke(h)+"."+ke(u);}break}case "av01":{const l=z(t,["av1C"])[0];if(l&&l.length>2){const c=l[1]>>>5,h=l[1]&31,u=l[2]>>>7?"H":"M",d=(l[2]&64)>>6,g=(l[2]&32)>>5,f=c===2&&d?g?12:10:d?10:8,m=(l[2]&16)>>4,p=(l[2]&8)>>3,S=(l[2]&4)>>2,E=l[2]&3;i+="."+c+"."+ke(h)+u+"."+ke(f)+"."+m+"."+p+S+E+"."+ke(1)+"."+ke(1)+"."+ke(1)+"."+0,n=Rt("dav1",t);}break}}return {codec:i,encrypted:a,supplemental:n}}function Rt(r,e){const t=z(e,["dvvC"]),s=t.length?t[0]:z(e,["dvcC"])[0];if(s){const i=s[2]>>1&127,n=s[2]<<5&32|s[3]>>3&31;return r+"."+ke(i)+"."+ke(n)}}function $r(r){let e=0;for(let t=0;t<32;t++)e|=(r>>t&1)<<31-t;return e>>>0}function ns(r,e){const t=e+5;for(;r[e++]&128&&e{const n=s.subarray(8,24);n.some(a=>a!==0)||(re.log(`[eme] Patching keyId in 'enc${i?"a":"v"}>sinf>>tenc' box: ${xe(n)} -> ${xe(t)}`),s.set(t,8));});}function Kr(r,e){z(r,["moov","trak"]).forEach(s=>{const i=z(s,["mdia","minf","stbl","stsd"])[0];if(!i)return;const n=i.subarray(8);let a=z(n,["enca"]);const o=a.length>0;o||(a=z(n,["encv"])),a.forEach(l=>{const c=o?l.subarray(28):l.subarray(78);z(c,["sinf"]).forEach(u=>{const d=fn(u);d&&e(d,o);});});});}function fn(r){const e=z(r,["schm"])[0];if(e){const t=ae(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const s=z(r,["schi","tenc"])[0];if(s)return s}}}function Vr(r,e,t){const s={},i=z(r,["moof","traf"]);for(let n=0;ns[n].duration)){let n=1/0,a=0;const o=z(r,["sidx"]);for(let l=0;lu+d.info.duration||0,0);a=Math.max(a,h+c.earliestPresentationTime/c.timescale);}}a&&B(a)&&Object.keys(s).forEach(l=>{s[l].duration||(s[l].duration=a*s[l].timescale-s[l].start);});}return s}function Hr(r){const e={valid:null,remainder:null},t=z(r,["moof"]);if(t.length<2)return e.remainder=r,e;const s=t[t.length-1];return e.valid=r.slice(0,s.byteOffset-8),e.remainder=r.slice(s.byteOffset-8),e}function Ae(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function ui(r,e){const t=[],s=e.samples,i=e.timescale,n=e.id;let a=false;return z(s,["moof"]).map(l=>{const c=l.byteOffset-8;z(l,["traf"]).map(u=>{const d=z(u,["tfdt"]).map(g=>{const f=g[0];let m=$(g,4);return f===1&&(m*=Math.pow(2,32),m+=$(g,8)),m/i})[0];return d!==void 0&&(r=d),z(u,["tfhd"]).map(g=>{const f=$(g,4),m=$(g,0)&16777215,p=(m&1)!==0,S=(m&2)!==0,E=(m&8)!==0;let T=0;const A=(m&16)!==0;let I=0;const D=(m&32)!==0;let v=8;f===n&&(p&&(v+=8),S&&(v+=4),E&&(T=$(g,v),v+=4),A&&(I=$(g,v),v+=4),D&&(v+=4),e.type==="video"&&(a=Zt(e.codec)),z(u,["trun"]).map(L=>{const b=L[0],R=$(L,0)&16777215,P=(R&1)!==0;let O=0;const N=(R&4)!==0,U=(R&256)!==0;let q=0;const M=(R&512)!==0;let F=0;const V=(R&1024)!==0,H=(R&2048)!==0;let Y=0;const w=$(L,4);let k=8;P&&(O=$(L,k),k+=4),N&&(k+=4);let W=O+c;for(let Z=0;Z>1&63;return t===39||t===40}else return (e&31)===6}function Ms(r,e,t,s){const i=gn(r);let n=0;n+=e;let a=0,o=0,l=0;for(;n=i.length)break;l=i[n++],a+=l;}while(l===255);o=0;do{if(n>=i.length)break;l=i[n++],o+=l;}while(l===255);const c=i.length-n;let h=n;if(oc){re.error(`Malformed SEI payload. ${o} is too small, only ${c} bytes left to parse.`);break}if(a===4){if(i[h++]===181){const d=hn(i,h);if(h+=2,d===49){const g=$(i,h);if(h+=4,g===1195456820){const f=i[h++];if(f===3){const m=i[h++],p=31&m,S=64&m,E=S?2+p*3:0,T=new Uint8Array(E);if(S){T[0]=m;for(let A=1;A16){const u=[];for(let f=0;f<16;f++){const m=i[h++].toString(16);u.push(m.length==1?"0"+m:m),(f===3||f===5||f===7||f===9)&&u.push("-");}const d=o-16,g=new Uint8Array(d);for(let f=0;f/\(Windows.+Firefox\//i.test(navigator.userAgent),Is={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function pn(r,e){const t=Is[e];return !!t&&!!t[r.slice(0,4)]}function qr(r,e,t=true){return !r.split(",").some(s=>!Ns(s,e,t))}function Ns(r,e,t=true){var s;const i=Tt(t);return (s=i?.isTypeSupported(Bs(r,e)))!=null?s:false}function Bs(r,e){return `${e}/mp4;codecs=${r}`}function di(r){const e=mn();return r.split(",").reduce((t,s)=>{const n=e&&Zt(s)?9:Is.video[s];return n?(n*2+t)/(t?3:2):(Is.audio[s]+t)/(t?2:1)},0)}const rs={};function jr(r,e=true){if(rs[r])return rs[r];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[r];for(let i=0;ijr(t.toLowerCase(),e))}function Qr(r,e){const t=[];if(r){const s=r.split(",");for(let i=0;i4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(r)!==-1)&&(fi(r,"audio")||fi(r,"video")))return r;if(e){const t=e.split(",");if(t.length>1){if(r){for(let s=t.length;s--;)if(t[s].substring(0,4)===r.substring(0,4))return t[s]}return t[0]}}return e||r}function fi(r,e){return pn(r,e)&&Ns(r,e)}function Xr(r){if(r.startsWith("av01.")){const e=r.split("."),t=["0","111","01","01","01","0"];for(let s=e.length;s>4&&s<10;s++)e[s]=t[s-4];return e.join(".")}return r}function gi(r){const e=Tt(r)||{isTypeSupported:()=>false};return {mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Ls(r){return r.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Zr={supported:true,powerEfficient:true,smooth:true},Jr={supported:false,smooth:false,powerEfficient:false},yn={supported:true,configurations:[],decodingInfoResults:[Zr]};function ea(r,e){return {supported:false,configurations:e,decodingInfoResults:[Jr],error:r}}function ta(r,e,t,s,i,n){const a=r.videoCodec,o=r.audioCodec?r.audioGroups:null,l=n?.audioCodec,c=n?.channels,h=c?parseInt(c):l?1/0:2;let u=null;if(o!=null&&o.length)try{o.length===1&&o[0]?u=e.groups[o[0]].channels:u=o.reduce((d,g)=>{if(g){const f=e.groups[g];if(!f)throw new Error(`Audio track group ${g} not found`);Object.keys(f.channels).forEach(m=>{d[m]=(d[m]||0)+f.channels[m];});}return d},{2:0});}catch{return true}return a!==void 0&&(a.split(",").some(d=>Zt(d))||r.width>1920&&r.height>1088||r.height>1920&&r.width>1088||r.frameRate>Math.max(s,30)||r.videoRange!=="SDR"&&r.videoRange!==t||r.bitrate>Math.max(i,8e6))||!!u&&B(h)&&Object.keys(u).some(d=>parseInt(d)>h)}function sa(r,e,t,s={}){const i=r.videoCodec;if(!i&&!r.audioCodec||!t)return Promise.resolve(yn);const n=[],a=ia(r),o=a.length,l=na(r,e,o>0),c=l.length;for(let h=o||1*c||1;h--;){const u={type:"media-source"};if(o&&(u.video=a[h%o]),c){u.audio=l[h%c];const d=u.audio.bitrate;u.video&&d&&(u.video.bitrate-=d);}n.push(u);}if(i){const h=navigator.userAgent;if(i.split(",").some(u=>Zt(u))&&mn())return Promise.resolve(ea(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${h})`),n))}return Promise.all(n.map(h=>{const u=aa(h);return s[u]||(s[u]=t.decodingInfo(h))})).then(h=>({supported:!h.some(u=>!u.supported),configurations:n,decodingInfoResults:h})).catch(h=>({supported:false,configurations:n,decodingInfoResults:[],error:h}))}function ia(r){var e;const t=(e=r.videoCodec)==null?void 0:e.split(","),s=Sn(r),i=r.width||640,n=r.height||480,a=r.frameRate||30,o=r.videoRange.toLowerCase();return t?t.map(l=>{const c={contentType:Bs(Xr(l),"video"),width:i,height:n,bitrate:s,framerate:a};return o!=="sdr"&&(c.transferFunction=o),c}):[]}function na(r,e,t){var s;const i=(s=r.audioCodec)==null?void 0:s.split(","),n=Sn(r);return i&&r.audioGroups?r.audioGroups.reduce((a,o)=>{var l;const c=o?(l=e.groups[o])==null?void 0:l.tracks:null;return c?c.reduce((h,u)=>{if(u.groupId===o){const d=parseFloat(u.channels||"");i.forEach(g=>{const f={contentType:Bs(g,"audio"),bitrate:t?ra(g,n):n};d&&(f.channels=""+d),h.push(f);});}return h},a):a},[]):[]}function ra(r,e){if(e<=1)return 1;let t=128e3;return r==="ec-3"?t=768e3:r==="ac-3"&&(t=64e4),Math.min(e/2,t)}function Sn(r){return Math.ceil(Math.max(r.bitrate*.9,r.averageBitrate)/1e3)*1e3||1}function aa(r){let e="";const{audio:t,video:s}=r;if(s){const i=Ls(s.contentType);e+=`${i}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||"sd"}_${Math.ceil(s.bitrate/1e5)}`;}if(t){const i=Ls(t.contentType);e+=`${s?"_":""}${i}_c${t.channels}`;}return e}const mi=["NONE","TYPE-0","TYPE-1",null],oa=["SDR","PQ","HLG"];var Bt={No:"",Yes:"YES",v2:"v2"};function pi(r){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=r,i=s!!s).map(s=>s.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const s=(t=e.supplemental)==null?void 0:t.videoCodec;s&&s!==e.videoCodec&&(this.codecSet+=`,${s.substring(0,4)}`);}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES);}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Si(this._audioGroups,e)}hasSubtitleGroup(e){return Si(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(t)===-1&&s.push(t);}else if(e==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(t)===-1&&s.push(t);}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return (e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return (e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function Si(r,e){return !e||!r?false:r.indexOf(e)!==-1}function la(){if(typeof matchMedia=="function"){const r=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(r.media!==e.media)return r.matches===true}return false}function ca(r,e){let t=false,s=[];if(r&&(t=r!=="SDR",s=[r]),e){s=e.allowedVideoRanges||oa.slice(0);const i=s.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:i&&la(),t||(s=["SDR"]);}return {preferHDR:t,allowedVideoRanges:s}}const ha=r=>{const e=new WeakSet;return (t,s)=>{if(r&&(s=r(t,s)),typeof s=="object"&&s!==null){if(e.has(s))return;e.add(s);}return s}},se=(r,e)=>JSON.stringify(r,ha(e));function ua(r,e,t,s,i){const n=Object.keys(r),a=s?.channels,o=s?.audioCodec,l=i?.videoCodec,c=a&&parseInt(a)===2;let h=false,u=false,d=1/0,g=1/0,f=1/0,m=1/0,p=0,S=[];const{preferHDR:E,allowedVideoRanges:T}=ca(e,i);for(let L=n.length;L--;){const b=r[n[L]];h||(h=b.channels[2]>0),d=Math.min(d,b.minHeight),g=Math.min(g,b.minFramerate),f=Math.min(f,b.minBitrate),T.filter(P=>b.videoRanges[P]>0).length>0&&(u=true);}d=B(d)?d:0,g=B(g)?g:0;const A=Math.max(1080,d),I=Math.max(30,g);f=B(f)?f:t,t=Math.max(f,t),u||(e=void 0);const D=n.length>1;return {codecSet:n.reduce((L,b)=>{const R=r[b];if(b===L)return L;if(S=u?T.filter(P=>R.videoRanges[P]>0):[],D){if(R.minBitrate>t)return Pe(b,`min bitrate of ${R.minBitrate} > current estimate of ${t}`),L;if(!R.hasDefaultAudio)return Pe(b,"no renditions with default or auto-select sound found"),L;if(o&&b.indexOf(o.substring(0,4))%5!==0)return Pe(b,`audio codec preference "${o}" not found`),L;if(a&&!c){if(!R.channels[a])return Pe(b,`no renditions with ${a} channel sound found (channels options: ${Object.keys(R.channels)})`),L}else if((!o||c)&&h&&R.channels[2]===0)return Pe(b,"no renditions with stereo sound found"),L;if(R.minHeight>A)return Pe(b,`min resolution of ${R.minHeight} > maximum of ${A}`),L;if(R.minFramerate>I)return Pe(b,`min framerate of ${R.minFramerate} > maximum of ${I}`),L;if(!S.some(P=>R.videoRanges[P]>0))return Pe(b,`no variants with VIDEO-RANGE of ${se(S)} found`),L;if(l&&b.indexOf(l.substring(0,4))%5!==0)return Pe(b,`video codec preference "${l}" not found`),L;if(R.maxScore=di(L)||R.fragmentError>r[L].fragmentError)?L:(m=R.minIndex,p=R.maxScore,b)},void 0),videoRanges:S,preferHDR:E,minFramerate:g,minBitrate:f,minIndex:m}}function Pe(r,e){re.log(`[abr] start candidates with "${r}" ignored because ${e}`);}function da(r){return r.reduce((e,t)=>{let s=e.groups[t.groupId];s||(s=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:false,hasAutoSelect:false}),s.tracks.push(t);const i=t.channels||"2";return s.channels[i]=(s.channels[i]||0)+1,s.hasDefault=s.hasDefault||t.default,s.hasAutoSelect=s.hasAutoSelect||t.autoselect,s.hasDefault&&(e.hasDefaultAudio=true),s.hasAutoSelect&&(e.hasAutoSelectAudio=true),e},{hasDefaultAudio:false,hasAutoSelectAudio:false,groups:{}})}function fa(r,e,t,s){return r.slice(t,s+1).reduce((i,n,a)=>{if(!n.codecSet)return i;const o=n.audioGroups;let l=i[n.codecSet];l||(i[n.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,n.bitrate);const c=Math.min(n.height,n.width);return l.minHeight=Math.min(l.minHeight,c),l.minFramerate=Math.min(l.minFramerate,n.frameRate),l.minIndex=Math.min(l.minIndex,a),l.maxScore=Math.max(l.maxScore,n.score),l.fragmentError+=n.fragmentError,l.videoRanges[n.videoRange]=(l.videoRanges[n.videoRange]||0)+1,o&&o.forEach(h=>{if(!h)return;const u=e.groups[h];u&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?u.hasDefault:u.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(u.channels).forEach(d=>{l.channels[d]=(l.channels[d]||0)+u.channels[d];}));}),i},{})}function Ei(r){if(!r)return r;const{lang:e,assocLang:t,characteristics:s,channels:i,audioCodec:n}=r;return {lang:e,assocLang:t,characteristics:s,channels:i,audioCodec:n}}function Oe(r,e,t){if("attrs"in r){const s=e.indexOf(r);if(s!==-1)return s}for(let s=0;ss.indexOf(i)===-1)}function et(r,e){const{audioCodec:t,channels:s}=r;return (t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(s===void 0||s===(e.channels||"2"))}function pa(r,e,t,s,i){const n=e[s],o=e.reduce((d,g,f)=>{const m=g.uri;return (d[m]||(d[m]=[])).push(f),d},{})[n.uri];o.length>1&&(s=Math.max.apply(Math,o));const l=n.videoRange,c=n.frameRate,h=n.codecSet.substring(0,4),u=Ti(e,s,d=>{if(d.videoRange!==l||d.frameRate!==c||d.codecSet.substring(0,4)!==h)return false;const g=d.audioGroups,f=t.filter(m=>!g||g.indexOf(m.groupId)!==-1);return Oe(r,f,i)>-1});return u>-1?u:Ti(e,s,d=>{const g=d.audioGroups,f=t.filter(m=>!g||g.indexOf(m.groupId)!==-1);return Oe(r,f,i)>-1})}function Ti(r,e,t){for(let s=e;s>-1;s--)if(t(r[s]))return s;for(let s=e+1;s{var s;const{fragCurrent:i,partCurrent:n,hls:a}=this,{autoLevelEnabled:o,media:l}=a;if(!i||!l)return;const c=performance.now(),h=n?n.stats:i.stats,u=n?n.duration:i.duration,d=c-h.loading.start,g=a.minAutoLevel,f=i.level,m=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||f<=g){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const p=m>-1&&m!==f,S=!!t||p;if(!S&&(l.paused||!l.playbackRate||!l.readyState))return;const E=a.mainForwardBufferInfo;if(!S&&E===null)return;const T=this.bwEstimator.getEstimateTTFB(),A=Math.abs(l.playbackRate);if(d<=Math.max(T,1e3*(u/(A*2))))return;const I=E?E.len/A:0,D=h.loading.first?h.loading.first-h.loading.start:-1,v=h.loaded&&D>-1,L=this.getBwEstimate(),b=a.levels,R=b[f],P=Math.max(h.loaded,Math.round(u*(i.bitrate||R.averageBitrate)/8));let O=v?d-D:d;O<1&&v&&(O=Math.min(d,h.loaded*8/L));const N=v?h.loaded*1e3/O:0,U=T/1e3,q=N?(P-h.loaded)/N:P*8/L+U;if(q<=I)return;const M=N?N*8:L,F=((s=t?.details||this.hls.latestLevelDetails)==null?void 0:s.live)===true,V=this.hls.config.abrBandWidthUpFactor;let H=Number.POSITIVE_INFINITY,Y;for(Y=f-1;Y>g;Y--){const Z=b[Y].maxBitrate,j=!b[Y].details||F;if(H=this.getTimeToLoadFrag(U,M,u*Z,j),H=q||H>u*10)return;v?this.bwEstimator.sample(d-Math.min(T,D),h.loaded):this.bwEstimator.sampleTTFB(d);const w=b[Y].maxBitrate;this.getBwEstimate()*V>w&&this.resetEstimator(w);const k=this.findBestLevel(w,g,Y,0,I,1,1);k>-1&&(Y=k),this.warn(`Fragment ${i.sn}${n?" part "+n.index:""} of level ${f} is loading too slowly; + Fragment duration: ${i.duration.toFixed(3)} + Time to underbuffer: ${I.toFixed(3)} s + Estimated load time for current fragment: ${q.toFixed(3)} s + Estimated load time for down switch fragment: ${H.toFixed(3)} s + TTFB estimate: ${D|0} ms + Current BW estimate: ${B(L)?L|0:"Unknown"} bps + New BW estimate: ${this.getBwEstimate()|0} bps + Switching to level ${Y} @ ${w|0} bps`),a.nextLoadLevel=a.nextAutoLevel=Y,this.clearTimer();const W=()=>{if(this.clearTimer(),this.fragCurrent===i&&this.hls.loadLevel===Y&&Y>0){const Z=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${Y>0?"and switching down":""} + Fragment duration: ${i.duration.toFixed(3)} s + Time to underbuffer: ${Z.toFixed(3)} s`),i.abortRequests(),this.fragCurrent=this.partCurrent=null,Y>g){let j=this.findBestLevel(this.hls.levels[g].bitrate,g,Y,0,Z,1,1);j===-1&&(j=g),this.hls.nextLoadLevel=this.hls.nextAutoLevel=j,this.resetEstimator(this.hls.levels[j].bitrate);}}};p||q>H*2?W():this.timer=self.setInterval(W,H*1e3),a.trigger(y.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:n,stats:h});},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners();}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator();}initEstimator(){const e=this.hls.config;return new Rr(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(y.MANIFEST_LOADING,this.onManifestLoading,this),e.on(y.FRAG_LOADING,this.onFragLoading,this),e.on(y.FRAG_LOADED,this.onFragLoaded,this),e.on(y.FRAG_BUFFERED,this.onFragBuffered,this),e.on(y.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(y.LEVEL_LOADED,this.onLevelLoaded,this),e.on(y.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(y.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(y.ERROR,this.onError,this);}unregisterListeners(){const{hls:e}=this;e&&(e.off(y.MANIFEST_LOADING,this.onManifestLoading,this),e.off(y.FRAG_LOADING,this.onFragLoading,this),e.off(y.FRAG_LOADED,this.onFragLoaded,this),e.off(y.FRAG_BUFFERED,this.onFragBuffered,this),e.off(y.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(y.LEVEL_LOADED,this.onLevelLoaded,this),e.off(y.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(y.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(y.ERROR,this.onError,this));}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null;}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer();}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null;}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey="";}onFragLoading(e,t){const s=t.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var i;this.fragCurrent=s,this.partCurrent=(i=t.part)!=null?i:null;}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100);}}onLevelSwitching(e,t){this.clearTimer();}onError(e,t){if(!t.fatal)switch(t.details){case _.BUFFER_ADD_CODEC_ERROR:case _.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case _.FRAG_LOAD_TIMEOUT:{const s=t.frag,{fragCurrent:i,partCurrent:n}=this;if(s&&i&&s.sn===i.sn&&s.level===i.level){const a=performance.now(),o=n?n.stats:s.stats,l=a-o.loading.start,c=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&c>-1){const u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(u,c),o.loaded);}else this.bwEstimator.sampleTTFB(l);}break}}}getTimeToLoadFrag(e,t,s,i){const n=e+s/t,a=i?e+this.lastLevelLoadSec:0;return n+a}onLevelLoaded(e,t){const s=this.hls.config,{loading:i}=t.stats,n=i.end-i.first;B(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo);}onFragLoaded(e,{frag:t,part:s}){const i=s?s.stats:t.stats;if(t.type===K.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=s?s.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+i.loaded,l=(a.loaded?a.loaded.duration:0)+n;a.loaded={bytes:o,duration:l},a.realBitrate=Math.round(8*o/l);}if(t.bitrateTest){const n={stats:i,frag:t,part:s,id:t.type};this.onFragBuffered(y.FRAG_BUFFERED,n),t.bitrateTest=false;}else this.lastLoadedFragLevel=t.level;}}onFragBuffered(e,t){const{frag:s,part:i}=t,n=i!=null&&i.stats.loaded?i.stats:s.stats;if(n.aborted||this.ignoreFragment(s))return;const a=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0;}ignoreFragment(e){return e.type!==K.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1);}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,s=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,n=this.findBestLevel(s,t,e,0,i,1,1);if(n>-1)return n;const a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!s||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=s&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,n)&&a[e].loadError<=a[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return `${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:s}=this;if(s.levels.length<=1)return s.loadLevel;const{maxAutoLevel:i,config:n,minAutoLevel:a}=s,o=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),c=this.getStarvationDelay();let h=n.abrBandWidthFactor,u=n.abrBandWidthUpFactor;if(c){const p=this.findBestLevel(l,a,i,c,0,h,u);if(p>=0)return this.rebufferNotice=-1,p}let d=o?Math.min(o,n.maxStarvationDelay):n.maxStarvationDelay;if(!c){const p=this.bitrateTestDelay;p&&(d=(o?Math.min(o,n.maxLoadingDelay):n.maxLoadingDelay)-p,this.info(`bitrate test took ${Math.round(1e3*p)}ms, set first fragment max fetchDuration to ${Math.round(1e3*d)} ms`),h=u=1);}const g=this.findBestLevel(l,a,i,c,d,h,u);if(this.rebufferNotice!==g&&(this.rebufferNotice=g,this.info(`${c?"rebuffering expected":"buffer is empty"}, optimal quality level ${g}`)),g>-1)return g;const f=s.levels[a],m=s.loadLevelObj;return m&&f?.bitrate=t;M--){var q;const F=f[M],V=M>u;if(!F)continue;if(S.useMediaCapabilities&&!F.supportedResult&&!F.supportedPromise){const j=navigator.mediaCapabilities;typeof j?.decodingInfo=="function"&&ta(F,R,D,v,e,L)?(F.supportedPromise=sa(F,R,j,this.supportedCache),F.supportedPromise.then(Q=>{if(!this.hls)return;F.supportedResult=Q;const he=this.hls.levels,le=he.indexOf(F);Q.error?this.warn(`MediaCapabilities decodingInfo error: "${Q.error}" for level ${le} ${se(Q)}`):Q.supported?Q.decodingInfoResults.some(Ee=>Ee.smooth===false||Ee.powerEfficient===false)&&this.log(`MediaCapabilities decodingInfo for level ${le} not smooth or powerEfficient: ${se(Q)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${le} ${se(Q)}`),le>-1&&he.length>1&&(this.log(`Removing unsupported level ${le}`),this.hls.removeLevel(le),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)));}).catch(Q=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${Q}`);})):F.supportedResult=yn;}if((I&&F.codecSet!==I||D&&F.videoRange!==D||V&&v>F.frameRate||!V&&v>0&&vj.smooth===false))&&(!A||M!==P)){U.push(M);continue}const H=F.details,Y=(g?H?.partTarget:H?.averagetargetduration)||O;let w;V?w=o*e:w=a*e;const k=O&&i>=O*2&&n===0?F.averageBitrate:F.maxBitrate,W=this.getTimeToLoadFrag(N,w,k*Y,H===void 0);if(w>=k&&(M===h||F.loadError===0&&F.fragmentError===0)&&(W<=N||!B(W)||T&&!this.bitrateTestDelay||W${M} adjustedbw(${Math.round(w)})-bitrate=${Math.round(w-k)} ttfb:${N.toFixed(1)} avgDuration:${Y.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${W.toFixed(1)} firstSelection:${A} codecSet:${F.codecSet} videoRange:${F.videoRange} hls.loadLevel:${p}`)),A&&(this.firstSelection=M),M}}return -1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t);}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:s}=this.hls;return Math.min(Math.max(e,s),t)}}const Tn={search:function(r,e){let t=0,s=r.length-1,i=null,n=null;for(;t<=s;){i=(t+s)/2|0,n=r[i];const a=e(n);if(a>0)t=i+1;else if(a<0)s=i-1;else return n}return null}};function Sa(r,e,t){if(e===null||!Array.isArray(r)||!r.length||!B(e))return null;const s=r[0].programDateTime;if(e<(s||0))return null;const i=r[r.length-1].endProgramDateTime;if(e>=(i||0))return null;for(let n=0;n0&&o<15e-7&&(t+=15e-7),n&&r.level!==n.level&&n.end<=r.end&&(n=e[2+r.sn-e[0].sn]||null);}else t===0&&e[0].start===0&&(n=e[0]);if(n&&((!r||r.level===n.level)&&xi(t,s,n)===0||Ea(n,r,Math.min(i,s))))return n;const a=Tn.search(e,xi.bind(null,t,s));return a&&(a!==r||!n)?a:n}function Ea(r,e,t){if(e&&e.start===0&&e.level0){const s=e.tagList.reduce((i,n)=>(n[0]==="INF"&&(i+=parseFloat(n[1])),i),t);return r.start<=s}return false}function xi(r=0,e=0,t){if(t.start<=r&&t.start+t.duration>r)return 0;const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-s<=r?1:t.start-s>r&&t.start?-1:0}function Ta(r,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return (t.endProgramDateTime||0)-s>r}function xn(r,e,t){if(r&&r.startCC<=e&&r.endCC>=e){let s=r.fragments;const{fragmentHint:i}=r;i&&(s=s.concat(i));let n;return Tn.search(s,a=>a.cce?-1:(n=a,a.end<=t?1:a.start>t?-1:0)),n||null}return null}function Ht(r){switch(r.details){case _.FRAG_LOAD_TIMEOUT:case _.KEY_LOAD_TIMEOUT:case _.LEVEL_LOAD_TIMEOUT:case _.MANIFEST_LOAD_TIMEOUT:return true}return false}function vn(r){return r.details.startsWith("key")}function An(r){return vn(r)&&!!r.frag&&!r.frag.decryptdata}function vi(r,e){const t=Ht(e);return r.default[`${t?"timeout":"error"}Retry`]}function Us(r,e){const t=r.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*r.retryDelayMs,r.maxRetryDelayMs)}function Ai(r){return ee(ee({},r),{errorRetry:null,timeoutRetry:null})}function Yt(r,e,t,s){if(!r)return false;const i=s?.code,n=e499)}function bs(r){return r===0&&navigator.onLine===false}var ce={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},me={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};class va extends be{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners();}registerListeners(){const e=this.hls;e.on(y.ERROR,this.onError,this),e.on(y.MANIFEST_LOADING,this.onManifestLoading,this),e.on(y.LEVEL_UPDATED,this.onLevelUpdated,this);}unregisterListeners(){const e=this.hls;e&&(e.off(y.ERROR,this.onError,this),e.off(y.ERROR,this.onErrorOut,this),e.off(y.MANIFEST_LOADING,this.onManifestLoading,this),e.off(y.LEVEL_UPDATED,this.onLevelUpdated,this));}destroy(){this.unregisterListeners(),this.hls=null;}startLoad(e){}stopLoad(){this.playlistError=0;}getVariantLevelIndex(e){return e?.type===K.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,s=t.currentLevel;return (e=t.loadLevelObj)!=null&&e.details||s===-1?t.loadLevel:s}variantHasKey(e,t){if(e){var s;if((s=e.details)!=null&&s.hasKey(t))return true;const i=e.audioGroups;if(i)return this.hls.allAudioTracks.filter(a=>i.indexOf(a.groupId)>=0).some(a=>{var o;return (o=a.details)==null?void 0:o.hasKey(t)})}return false}onManifestLoading(){this.playlistError=0;}onLevelUpdated(){this.playlistError=0;}onError(e,t){var s;if(t.fatal)return;const i=this.hls,n=t.context;switch(t.details){case _.FRAG_LOAD_ERROR:case _.FRAG_LOAD_TIMEOUT:case _.KEY_LOAD_ERROR:case _.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case _.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction=ot();return}case _.FRAG_GAP:case _.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ce.SendAlternateToPenaltyBox;return}case _.LEVEL_EMPTY_ERROR:case _.LEVEL_PARSING_ERROR:{var a;const l=t.parent===K.MAIN?t.level:i.loadLevel;t.details===_.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=false,t.errorAction=this.getLevelSwitchAction(t,l));}return;case _.LEVEL_LOAD_ERROR:case _.LEVEL_LOAD_TIMEOUT:typeof n?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level));return;case _.AUDIO_TRACK_LOAD_ERROR:case _.AUDIO_TRACK_LOAD_TIMEOUT:case _.SUBTITLE_LOAD_ERROR:case _.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){const l=i.loadLevelObj;if(l&&(n.type===$e.AUDIO_TRACK&&l.hasAudioGroup(n.groupId)||n.type===$e.SUBTITLE_TRACK&&l.hasSubtitleGroup(n.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=ce.SendAlternateToPenaltyBox,t.errorAction.flags=me.MoveAllAlternatesMatchingHost;return}}return;case _.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:ce.SendAlternateToPenaltyBox,flags:me.MoveAllAlternatesMatchingHDCP};return;case _.KEY_SYSTEM_SESSION_UPDATE_FAILED:case _.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case _.KEY_SYSTEM_NO_SESSION:t.errorAction={action:ce.SendAlternateToPenaltyBox,flags:me.MoveAllAlternatesMatchingKey};return;case _.BUFFER_ADD_CODEC_ERROR:case _.REMUX_ALLOC_ERROR:case _.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:i.loadLevel);}return;case _.INTERNAL_EXCEPTION:case _.BUFFER_APPENDING_ERROR:case _.BUFFER_FULL_ERROR:case _.LEVEL_SWITCH_ERROR:case _.BUFFER_STALLED_ERROR:case _.BUFFER_SEEK_OVER_HOLE:case _.BUFFER_NUDGE_ON_STALL:t.errorAction=ot();return}t.type===G.KEY_SYSTEM_ERROR&&(t.levelRetry=false,t.errorAction=ot());}getPlaylistRetryOrSwitchAction(e,t){const s=this.hls,i=vi(s.config.playlistLoadPolicy,e),n=this.playlistError++;if(Yt(i,n,Ht(e),e.response))return {action:ce.RetryRequest,flags:me.None,retryConfig:i,retryCount:n};const o=this.getLevelSwitchAction(e,t);return i&&(o.retryConfig=i,o.retryCount=n),o}getFragRetryOrSwitchAction(e){const t=this.hls,s=this.getVariantLevelIndex(e.frag),i=t.levels[s],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,o=vi(vn(e)?a:n,e),l=t.levels.reduce((h,u)=>h+u.fragmentError,0);if(i&&(e.details!==_.FRAG_GAP&&i.fragmentError++,!An(e)&&Yt(o,l,Ht(e),e.response)))return {action:ce.RetryRequest,flags:me.None,retryConfig:o,retryCount:l};const c=this.getLevelSwitchAction(e,s);return o&&(c.retryConfig=o,c.retryCount=l),c}getLevelSwitchAction(e,t){const s=this.hls;t==null&&(t=s.loadLevel);const i=this.hls.levels[t];if(i){var n,a;const c=e.details;i.loadError++,c===_.BUFFER_APPEND_ERROR&&i.fragmentError++;let h=-1;const{levels:u,loadLevel:d,minAutoLevel:g,maxAutoLevel:f}=s;!s.autoLevelEnabled&&!s.config.preserveManualLevelOnError&&(s.loadLevel=-1);const m=(n=e.frag)==null?void 0:n.type,S=(m===K.AUDIO&&c===_.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(c===_.BUFFER_ADD_CODEC_ERROR||c===_.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:D})=>i.audioCodec!==D),T=e.sourceBufferName==="video"&&(c===_.BUFFER_ADD_CODEC_ERROR||c===_.BUFFER_APPEND_ERROR)&&u.some(({codecSet:D,audioCodec:v})=>i.codecSet!==D&&i.audioCodec===v),{type:A,groupId:I}=(a=e.context)!=null?a:{};for(let D=u.length;D--;){const v=(D+d)%u.length;if(v!==d&&v>=g&&v<=f&&u[v].loadError===0){var o,l;const L=u[v];if(c===_.FRAG_GAP&&m===K.MAIN&&e.frag){const b=u[v].details;if(b){const R=ht(e.frag,b.fragments,e.frag.start);if(R!=null&&R.gap)continue}}else {if(A===$e.AUDIO_TRACK&&L.hasAudioGroup(I)||A===$e.SUBTITLE_TRACK&&L.hasSubtitleGroup(I))continue;if(m===K.AUDIO&&(o=i.audioGroups)!=null&&o.some(b=>L.hasAudioGroup(b))||m===K.SUBTITLE&&(l=i.subtitleGroups)!=null&&l.some(b=>L.hasSubtitleGroup(b))||S&&i.audioCodec===L.audioCodec||T&&i.codecSet===L.codecSet||!S&&i.codecSet!==L.codecSet)continue}h=v;break}}if(h>-1&&s.loadLevel!==h)return e.levelRetry=true,this.playlistError=0,{action:ce.SendAlternateToPenaltyBox,flags:me.None,nextAutoLevel:h}}return {action:ce.SendAlternateToPenaltyBox,flags:me.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case ce.DoNothing:break;case ce.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==_.FRAG_GAP?t.fatal=true:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,s=e.errorAction;if(!s)return;const{flags:i}=s,n=s.nextAutoLevel;switch(i){case me.None:this.switchLevel(e,n);break;case me.MoveAllAlternatesMatchingHDCP:{const l=this.getVariantLevelIndex(e.frag),c=t.levels[l],h=c?.attrs["HDCP-LEVEL"];if(s.hdcpLevel=h,h==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(h){t.maxHdcpLevel=mi[mi.indexOf(h)-1],s.resolved=true,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case me.MoveAllAlternatesMatchingKey:{const l=e.decryptdata;if(l){const c=this.hls.levels,h=c.length;for(let d=h;d--;)if(this.variantHasKey(c[d],l)){var a,o;this.log(`Banned key found in level ${d} (${c[d].bitrate}bps) or audio group "${(a=c[d].audioGroups)==null?void 0:a.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${xe(l.keyId||[])}`),c[d].fragmentError++,c[d].loadError++,this.log(`Removing level ${d} with key error (${e.error})`),this.hls.removeLevel(d);}const u=e.frag;if(this.hls.levels.length>>8^S&255^99,e[f]=S,t[S]=f;const E=g[f],T=g[E],A=g[T];let I=g[S]*257^S*16843008;i[f]=I<<24|I>>>8,n[f]=I<<16|I>>>16,a[f]=I<<8|I>>>24,o[f]=I,I=A*16843009^T*65537^E*257^f*16843008,c[S]=I<<24|I>>>8,h[S]=I<<16|I>>>16,u[S]=I<<8|I>>>24,d[S]=I,f?(f=E^g[g[g[A^E]]],m^=g[g[m]]):f=m=1;}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let s=true,i=0;for(;i{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,s,i);const l=this.flush();l?n(l.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"));}):this.webCryptoDecrypt(new Uint8Array(e),t,s,i)}softwareDecrypt(e,t,s,i){const{currentIV:n,currentResult:a,remainderData:o}=this;if(i!==qe.cbc||t.byteLength!==16)return re.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=Ae(o,e),this.remainderData=null);const l=this.getValidChunk(e);if(!l.length)return null;n&&(s=n);let c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new Ra),c.expandKey(t);const h=a;return this.currentResult=c.decrypt(l.buffer,0,s),this.currentIV=l.slice(-16).buffer,h||null}webCryptoDecrypt(e,t,s,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,s,i));this.key=t,this.fastAesKey=new La(this.subtle,t,i);}return this.fastAesKey.expandKey().then(n=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Aa(this.subtle,new Uint8Array(s),i).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(re.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,s,i)))}onWebCryptoError(e,t,s,i){const n=this.enableSoftwareAES;if(n){this.useSoftware=true,this.logEnabled=true,this.softwareDecrypt(e,t,s,i);const a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(n?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const s=e.length-e.length%_a;return s!==e.length&&(t=e.slice(0,s),this.remainderData=e.slice(s)),t}logOnce(e){this.logEnabled&&(re.log(`[decrypter]: ${e}`),this.logEnabled=false);}}const Ii=Math.pow(2,17);class Da{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e;}destroy(){this.loader&&(this.loader.destroy(),this.loader=null);}abort(){this.loader&&this.loader.abort();}load(e,t){const s=e.url;if(!s)return Promise.reject(new He({type:G.NETWORK_ERROR,details:_.FRAG_LOAD_ERROR,fatal:false,frag:e,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,n=i.fLoader,a=i.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(f=>f[0]==="GAP")){l(Li(e));return}else e.gap=false;const c=this.loader=n?new n(i):new a(i),h=Ri(e);e.loader=c;const u=Ai(i.fragLoadPolicy.default),d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Ii};e.stats=c.stats;const g={onSuccess:(f,m,p,S)=>{this.resetLoader(e,c);let E=f.data;p.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(E.slice(0,16)),E=E.slice(16)),o({frag:e,part:null,payload:E,networkDetails:S});},onError:(f,m,p,S)=>{this.resetLoader(e,c),l(new He({type:G.NETWORK_ERROR,details:_.FRAG_LOAD_ERROR,fatal:false,frag:e,response:ee({url:s,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:p,stats:S}));},onAbort:(f,m,p)=>{this.resetLoader(e,c),l(new He({type:G.NETWORK_ERROR,details:_.INTERNAL_ABORTED,fatal:false,frag:e,error:new Error("Aborted"),networkDetails:p,stats:f}));},onTimeout:(f,m,p)=>{this.resetLoader(e,c),l(new He({type:G.NETWORK_ERROR,details:_.FRAG_LOAD_TIMEOUT,fatal:false,frag:e,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:p,stats:f}));}};t&&(g.onProgress=(f,m,p,S)=>t({frag:e,part:null,payload:p,networkDetails:S})),c.load(h,d,g);})}loadPart(e,t,s){this.abort();const i=this.config,n=i.fLoader,a=i.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(Li(e,t));return}const c=this.loader=n?new n(i):new a(i),h=Ri(e,t);e.loader=c;const u=Ai(i.fragLoadPolicy.default),d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Ii};t.stats=c.stats,c.load(h,d,{onSuccess:(g,f,m,p)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const S={frag:e,part:t,payload:g.data,networkDetails:p};s(S),o(S);},onError:(g,f,m,p)=>{this.resetLoader(e,c),l(new He({type:G.NETWORK_ERROR,details:_.FRAG_LOAD_ERROR,fatal:false,frag:e,part:t,response:ee({url:h.url,data:void 0},g),error:new Error(`HTTP Error ${g.code} ${g.text}`),networkDetails:m,stats:p}));},onAbort:(g,f,m)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),l(new He({type:G.NETWORK_ERROR,details:_.INTERNAL_ABORTED,fatal:false,frag:e,part:t,error:new Error("Aborted"),networkDetails:m,stats:g}));},onTimeout:(g,f,m)=>{this.resetLoader(e,c),l(new He({type:G.NETWORK_ERROR,details:_.FRAG_LOAD_TIMEOUT,fatal:false,frag:e,part:t,error:new Error(`Timeout after ${d.timeout}ms`),networkDetails:m,stats:g}));}});})}updateStatsFromPart(e,t){const s=e.stats,i=t.stats,n=i.total;if(s.loaded+=i.loaded,n){const l=Math.round(e.duration/t.duration),c=Math.min(Math.round(s.loaded/n),l),u=(l-c)*Math.round(s.loaded/c);s.total=s.loaded+u;}else s.total=Math.max(s.loaded,s.total);const a=s.loading,o=i.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end;}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy();}}function Ri(r,e=null){const t=e||r,s={frag:r,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(B(i)&&B(n)){var a;let o=i,l=n;if(r.sn==="initSegment"&&Pa((a=r.decryptdata)==null?void 0:a.method)){const c=n-i;c%16&&(l=n+(16-c%16)),i!==0&&(s.resetIV=true,o=i-16);}s.rangeStart=o,s.rangeEnd=l;}return s}function Li(r,e){const t=new Error(`GAP ${r.gap?"tag":"attribute"} found`),s={type:G.MEDIA_ERROR,details:_.FRAG_GAP,fatal:false,frag:r,error:t,networkDetails:null};return e&&(s.part=e),(e||r).stats.aborted=true,new He(s)}function Pa(r){return r==="AES-128"||r==="AES-256"}class He extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e;}}class Ca extends be{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this);}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed();}onHandlerDestroying(){this.clearNextTick(),this.clearInterval();}onHandlerDestroyed(){}hasInterval(){return !!this._tickInterval}hasNextTick(){return !!this._tickTimer}setInterval(e){return this._tickInterval?false:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),true)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,true):false}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,true):false}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0);}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0);}doTick(){}}class In{constructor(e,t,s,i=0,n=-1,a=false){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=bt(),this.buffering={audio:bt(),video:bt(),audiovideo:bt()},this.level=e,this.sn=t,this.id=s,this.size=i,this.part=n,this.partial=a;}}function bt(){return {start:0,executeStart:0,executeEnd:0,end:0}}const bi={length:0,start:()=>0,end:()=>0};class J{static isBuffered(e,t){if(e){const s=J.getBuffered(e);for(let i=s.length;i--;)if(t>=s.start(i)&&t<=s.end(i))return true}return false}static bufferedRanges(e){if(e){const t=J.getBuffered(e);return J.timeRangesToArray(t)}return []}static timeRangesToArray(e){const t=[];for(let s=0;s1&&e.sort((h,u)=>h.start-u.start||u.end-h.end);let i=-1,n=[];if(s)for(let h=0;h=e[h].start&&t<=e[h].end&&(i=h);const u=n.length;if(u){const d=n[u-1].end;e[h].start-dd&&(n[u-1].end=e[h].end):n.push(e[h]);}else n.push(e[h]);}else n=e;let a=0,o,l=t,c=t;for(let h=0;h=u&&t<=d&&(i=h),t+s>=u&&t{const i=s.substring(2,s.length-1),n=t?.[i];return n===void 0?(r.playlistParsingError||(r.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),s):n})}return e}const Oa=/^(\d+)x(\d+)$/,_i=/(.+?)=(".*?"|.*?)(?:,|$)/g;class At{constructor(e,t){typeof e=="string"&&(e=At.parseAttrList(e,t)),ie(this,e);}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const s=new Uint8Array(t.length/2);for(let i=0;iNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const s=this[e];return s?parseFloat(s):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const s=this[e];return (s?s.split(/[ ,]+/):[]).reduce((i,n)=>(i[n.toLowerCase()]=true,i),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Oa.exec(this[e]);if(t!==null)return {width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let s;const i={};for(_i.lastIndex=0;(s=_i.exec(e))!==null;){const a=s[1].trim();let o=s[2];const l=o.indexOf('"')===0&&o.lastIndexOf('"')===o.length-1;let c=false;if(l)o=o.slice(1,-1);else switch(a){case "IV":case "SCTE35-CMD":case "SCTE35-IN":case "SCTE35-OUT":c=true;}if(t&&(l||c))o=wa(t,o);else if(!c&&!l)switch(a){case "CLOSED-CAPTIONS":if(o==="NONE")break;case "ALLOWED-CPC":case "CLASS":case "ASSOC-LANGUAGE":case "AUDIO":case "BYTERANGE":case "CHANNELS":case "CHARACTERISTICS":case "CODECS":case "DATA-ID":case "END-DATE":case "GROUP-ID":case "ID":case "IMPORT":case "INSTREAM-ID":case "KEYFORMAT":case "KEYFORMATVERSIONS":case "LANGUAGE":case "NAME":case "PATHWAY-ID":case "QUERYPARAM":case "RECENTLY-REMOVED-DATERANGES":case "SERVER-URI":case "STABLE-RENDITION-ID":case "STABLE-VARIANT-ID":case "START-DATE":case "SUBTITLES":case "SUPPLEMENTAL-CODECS":case "URI":case "VALUE":case "VIDEO":case "X-ASSET-LIST":case "X-ASSET-URI":re.warn(`${e}: attribute ${a} is missing quotes`);}i[a]=o;}return i}}const Fa="com.apple.hls.interstitial";class Ma{constructor(e,t,s=0){var i;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=(i=t?.tagOrder)!=null?i:s,t){const n=t.attr;for(const a in n)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==n[a]){re.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=ie(new At({}),n,e);}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const n=t?.endDate||new Date(this.attr["END-DATE"]);B(n.getTime())&&(this._endDate=n);}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:false,post:false,once:false}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(re.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(B(e))return e}else if(this._endDate)return (this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return "PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===Fa}get isValid(){return !!this.id&&!this._badValueForSameId&&B(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}function Na(r,e){return r.length===e.length?!r.some((t,s)=>t!==e[s]):false}function Gs(r){return r==="AES-128"||r==="AES-256"||r==="AES-256-CTR"}function Ks(r){switch(r){case "AES-128":case "AES-256":return qe.cbc;case "AES-256-CTR":return qe.ctr;default:throw new Error(`invalid full segment method ${r}`)}}function Ba(r){return Uint8Array.from(atob(r),e=>e.charCodeAt(0))}function Di(r){return Uint8Array.from(unescape(encodeURIComponent(r)),e=>e.charCodeAt(0))}function Ua(r){const e=function(s,i,n){const a=s[i];s[i]=s[n],s[n]=a;};e(r,0,3),e(r,1,2),e(r,4,5),e(r,6,7);}const Wt=typeof self<"u"?self:void 0;var te={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},We={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function os(r){switch(r){case We.FAIRPLAY:return te.FAIRPLAY;case We.PLAYREADY:return te.PLAYREADY;case We.WIDEVINE:return te.WIDEVINE;case We.CLEARKEY:return te.CLEARKEY}}function ls(r){switch(r){case te.FAIRPLAY:return We.FAIRPLAY;case te.PLAYREADY:return We.PLAYREADY;case te.WIDEVINE:return We.WIDEVINE;case te.CLEARKEY:return We.CLEARKEY}}function _t(r){const{drmSystems:e,widevineLicenseUrl:t}=r,s=e?[te.FAIRPLAY,te.WIDEVINE,te.PLAYREADY,te.CLEARKEY].filter(i=>!!e[i]):[];return !s[te.WIDEVINE]&&t&&s.push(te.WIDEVINE),s}const Rn=(function(r){return Wt!=null&&(r=Wt.navigator)!=null&&r.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function $a(r,e,t,s){let i;switch(r){case te.FAIRPLAY:i=["cenc","sinf"];break;case te.WIDEVINE:case te.PLAYREADY:i=["cenc"];break;case te.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${r}`)}return Ga(i,e,t,s)}function Ga(r,e,t,s){return [{initDataTypes:r,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs=${n}`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs=${n}`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function Ka(r){var e;return !!r&&(r.sessionType==="persistent-license"||!!((e=r.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function Va(r,e){let t=r.length;if(!t)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];r.push(o),t++;}else return;const s=r[t-1],i=e.live?1/0:e.totalduration,n=Object.keys(e.dateRanges);for(let o=n.length;o--;){const l=e.dateRanges[n[o]],c=l.startDate.getTime();l.tagAnchor=s.ref;for(let h=t;h--;){var a;if(((a=r[h])==null?void 0:a.sn)=o||s===0){var a;const l=(((a=t[s+1])==null?void 0:a.start)||i)-n.start;if(e<=o+l*1e3){const c=t[s].sn-r.startSN;if(c<0)return -1;const h=r.fragments;if(h.length>t.length){const d=(t[s+1]||h[h.length-1]).sn-r.startSN;for(let g=d;g>c;g--){const f=h[g].programDateTime;if(e>=f&&er.sn?(s=t-r.start,i=r):(s=r.start-t,i=e),i.duration!==s&&i.setDuration(s);}else e.sn>r.sn?r.cc===e.cc&&r.minEndPTS?e.setStart(r.start+(r.minEndPTS-r.start)):e.setStart(r.start+r.duration):e.setStart(Math.max(r.start-e.duration,0));}function Ln(r,e,t,s,i,n,a){s-t<=0&&(a.warn("Fragment should have a positive duration",e),s=t+e.duration,n=i+e.duration);let l=t,c=s;const h=e.startPTS,u=e.endPTS;if(B(h)){const S=Math.abs(h-t);r&&S>r.totalduration?a.warn(`media timestamps and playlist times differ by ${S}s for level ${e.level} ${r.url}`):B(e.deltaPTS)?e.deltaPTS=Math.max(S,e.deltaPTS):e.deltaPTS=S,l=Math.max(t,h),t=Math.min(t,h),i=e.startDTS!==void 0?Math.min(i,e.startDTS):i,c=Math.min(s,u),s=Math.max(s,u),n=e.endDTS!==void 0?Math.max(n,e.endDTS):n;}const d=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(s-e.start),e.startPTS=t,e.maxStartPTS=l,e.startDTS=i,e.endPTS=s,e.minEndPTS=c,e.endDTS=n;const g=e.sn;if(!r||gr.endSN)return 0;let f;const m=g-r.startSN,p=r.fragments;for(p[m]=e,f=m;f>0;f--)cs(p[f],p[f-1]);for(f=m;f=0;h--){const u=i[h].initSegment;if(u){s=u;break}}r.fragmentHint&&delete r.fragmentHint.endPTS;let n;za(r,e,(h,u,d,g)=>{if((!e.startCC||e.skippedSegments)&&u.cc!==h.cc){const f=h.cc-u.cc;for(let m=d;m{var u;h&&(!h.initSegment||h.initSegment.relurl===((u=s)==null?void 0:u.relurl))&&(h.initSegment=s);}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(h=>!h),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let h=e.skippedSegments;h--;)a.shift();e.startSN=a[0].sn;}else {e.canSkipDateRanges&&(e.dateRanges=qa(r.dateRanges,e,t));const h=r.fragments.filter(u=>u.rawProgramDateTime);if(r.hasProgramDateTime&&!e.hasProgramDateTime)for(let u=1;u{u.elementaryStreams=h.elementaryStreams,u.stats=h.stats;}),n?Ln(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS,t):bn(r,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=r.driftStartTime,e.driftStart=r.driftStart;const c=e.advancedDateTime;if(e.advanced&&c){const h=e.edge;e.driftStart||(e.driftStartTime=c,e.driftStart=h),e.driftEndTime=c,e.driftEnd=h;}else e.driftEndTime=r.driftEndTime,e.driftEnd=r.driftEnd,e.advancedDateTime=r.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=r.requestScheduled);}function qa(r,e,t){const{dateRanges:s,recentlyRemovedDateranges:i}=e,n=ie({},r);i&&i.forEach(l=>{delete n[l];});const o=Object.keys(n).length;return o?(Object.keys(s).forEach(l=>{const c=n[l],h=new Ma(s[l].attr,c);h.isValid?(n[l]=h,c||(h.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${se(s[l].attr)}"`);}),n):s}function ja(r,e,t){if(r&&e){let s=0;for(let i=0,n=r.length;i<=n;i++){const a=r[i],o=e[i+s];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):s--;}}}function za(r,e,t){const s=e.skippedSegments,i=Math.max(r.startSN,e.startSN)-e.startSN,n=(r.fragmentHint?1:0)+(s?e.endSN:Math.min(r.endSN,e.endSN))-e.startSN,a=e.startSN-r.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments;for(let c=i;c<=n;c++){const h=l[a+c];let u=o[c];if(s&&!u&&h&&(u=e.fragments[c]=h),h&&u){t(h,u,c,o);const d=h.relurl,g=u.relurl;if(d&&Za(d,g)){e.playlistParsingError=Pi(`media sequence mismatch ${u.sn}:`,r,e,h,u);return}else if(h.cc!==u.cc){e.playlistParsingError=Pi(`discontinuity sequence mismatch (${h.cc}!=${u.cc})`,r,e,h,u);return}}}}function Pi(r,e,t,s,i){return new Error(`${r} ${i.url} +Playlist starting @${e.startSN} +${e.m3u8} + +Playlist starting @${t.startSN} +${t.m3u8}`)}function bn(r,e,t=true){const s=e.startSN+e.skippedSegments-r.startSN,i=r.fragments,n=s>=0;let a=0;if(n&&se){const n=s[s.length-1].duration*1e3;n{var s;(s=e.details)==null||s.fragments.forEach(i=>{i.level=t,i.initSegment&&(i.initSegment.level=t);});});}function Za(r,e){return r!==e&&e?ki(r)!==ki(e):false}function ki(r){return r.replace(/\?[^?]*$/,"")}function yt(r,e){for(let s=0,i=r.length;sr.startCC)}function wi(r,e){const t=r.start+e;r.startPTS=t,r.setStart(t),r.endPTS=t+r.duration;}function Pn(r,e){const t=e.fragments;for(let s=0,i=t.length;s{const{config:a,fragCurrent:o,media:l,mediaBuffer:c,state:h}=this,u=l?l.currentTime:0,d=J.bufferInfo(c||l,u,a.maxBufferHole),g=!d.len;if(this.log(`Media seeking to ${B(u)?u.toFixed(3):u}, state: ${h}, ${g?"out of":"in"} buffer`),this.state===C.ENDED)this.resetLoadingState();else if(o){const f=a.maxFragLookUpTolerance,m=o.start-f,p=o.start+o.duration+f;if(g||pd.end){const S=u>p;(uf&&(this.lastCurrentTime=u),!this.loadingParts){const m=Math.max(d.end,u),p=this.shouldLoadParts(this.getLevelDetails(),m);p&&(this.log(`LL-Part loading ON after seeking to ${u.toFixed(2)} with buffer @${m.toFixed(2)}`),this.loadingParts=p);}}this.hls.hasEnoughToStart||(this.log(`Setting ${g?"startPosition":"nextLoadPosition"} to ${u} for seek without enough to start`),this.nextLoadPosition=u,g&&(this.startPosition=u)),g&&this.state===C.IDLE&&this.tickImmediate();},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0;},this.playlistType=n,this.hls=e,this.fragmentLoader=new Da(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new $s(e.config);}registerListeners(){const{hls:e}=this;e.on(y.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(y.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(y.MANIFEST_LOADING,this.onManifestLoading,this),e.on(y.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(y.ERROR,this.onError,this);}unregisterListeners(){const{hls:e}=this;e.off(y.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(y.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(y.MANIFEST_LOADING,this.onManifestLoading,this),e.off(y.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(y.ERROR,this.onError,this);}doTick(){this.onTickEnd();}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===C.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=C.STOPPED;}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=false;}resumeBuffering(){this.buffering=true;}get inFlightFrag(){return {frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return false;const s=e.end||0,i=this.config.timelineOffset||0;if(s<=i)return false;const n=e.buffered;this.config.maxBufferHole&&n&&n.length>1&&(e=J.bufferedInfo(n,e.start,0));const a=e.nextStart;if(a&&a>i&&a{const a=n.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${n.part?" part: "+n.part.index:""} of ${this.fragInfo(a,false,n.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(n);};this._doFragLoad(e,t,s,i).then(n=>{if(!n)return;const a=this.state,o=n.frag;if(this.fragContextChanged(o)){(a===C.FRAG_LOADING||!this.fragCurrent&&a===C.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=C.IDLE);return}"payload"in n&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(y.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n);}).catch(n=>{this.state===C.STOPPED||this.state===C.ERROR||(this.warn(`Frag error: ${n?.message||n}`),this.resetFragmentLoading(e));});}clearTrackerIfNeeded(e){var t;const{fragmentTracker:s}=this;if(s.getState(e)===ve.APPENDING){const n=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,n),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&s.removeFragment(e);}else ((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?s.removeAllFragments():s.hasParts(e.type)&&(s.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),s.getState(e)===ve.PARTIAL&&s.removeFragment(e));}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type});}e.fragments[0]||(e.deltaUpdateFailed=true);}waitForLive(e){const t=e.details;return t?.live&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,s=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:s};this.hls.trigger(y.BUFFER_FLUSHING,i);}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{const i=s?.frag;if(!i||this.fragContextChanged(i)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:i}=this,{frag:n,payload:a}=s,o=n.decryptdata;if(a&&a.byteLength>0&&o!=null&&o.key&&o.iv&&Gs(o.method)){const l=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),o.key.buffer,o.iv.buffer,Ks(o.method)).catch(c=>{throw i.trigger(y.ERROR,{type:G.MEDIA_ERROR,details:_.FRAG_DECRYPT_ERROR,fatal:false,error:c,reason:c.message,frag:n}),c}).then(c=>{const h=self.performance.now();return i.trigger(y.FRAG_DECRYPTED,{frag:n,payload:c,stats:{tstart:l,tdecrypt:h}}),s.payload=c,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===C.STOPPED||this.state===C.ERROR||(this.warn(s),this.resetFragmentLoading(e));});}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const s=e.frag.stats;this.state!==C.STOPPED&&(this.state=C.IDLE),e.frag.data=new Uint8Array(e.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick();}unhandledEncryptionError(e,t){var s,i;const n=e.tracks;if(n&&!t.encrypted&&((s=n.audio)!=null&&s.encrypted||(i=n.video)!=null&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(o.message),!a||a.mediaKeys?false:(this.hls.trigger(y.ERROR,{type:G.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_NO_KEYS,fatal:false,error:o,frag:t}),this.resetTransmuxer(),true)}return false}fragContextChanged(e){const{fragCurrent:t}=this;return !e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,false,t)} > buffer:${s?to.toString(J.getBuffered(s)):"(detached)"})`),ye(e)){var i;if(e.type!==K.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o])){this.state=C.IDLE;return}}const n=(i=this.levels)==null?void 0:i[e.level];n!=null&&n.fragmentError&&(this.log(`Resetting level fragment error count of ${n.fragmentError} on frag buffered`),n.fragmentError=0);}this.state=C.IDLE;}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:s,part:i,partsLoaded:n}=e,a=!n||n.length===0||n.some(l=>!l),o=new In(s.level,s.sn,s.stats.chunkCount+1,0,i?i.index:-1,!a);t.flush(o);}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,i){var n;this.fragCurrent=e;const a=t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=C.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(d=>{if(!this.fragContextChanged(d.frag))return this.hls.trigger(y.KEY_LOADED,d),this.state===C.KEY_LOADING&&(this.state=C.IDLE),d}),this.hls.trigger(y.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));const l=this.fragPrevious;if(ye(e)&&(!l||e.sn!==l.sn)){const d=this.shouldLoadParts(t.details,e.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} loading sn ${l?.sn}->${e.sn}`),this.loadingParts=d);}if(s=Math.max(e.start,s||0),this.loadingParts&&ye(e)){const d=a.partList;if(d&&i){s>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);const g=this.getNextPart(d,e,s);if(g>-1){const f=d[g];e=this.fragCurrent=f.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${f.index} (${g}/${d.length-1}) of ${this.fragInfo(e,false,f)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=f.start+f.duration,this.state=C.FRAG_LOADING;let m;return o?m=o.then(p=>!p||this.fragContextChanged(p.frag)?null:this.doFragPartsLoad(e,f,t,i)).catch(p=>this.handleFragLoadError(p)):m=this.doFragPartsLoad(e,f,t,i).catch(p=>this.handleFragLoadError(p)),this.hls.trigger(y.FRAG_LOADING,{frag:e,part:f,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):m}else if(!e.url||this.loadedEndOfParts(d,s))return Promise.resolve(null)}}if(ye(e)&&this.loadingParts){var c;this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(c=a.partList)==null?void 0:c.filter(d=>d.loaded).map(d=>`[${d.start}-${d.end}]`)}`),this.loadingParts=false;}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,false)}) cc: ${e.cc} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(s.toFixed(3))}`),B(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=C.FRAG_LOADING;const h=this.config.progressive&&e.type!==K.SUBTITLE;let u;return h&&o?u=o.then(d=>!d||this.fragContextChanged(d.frag)?null:this.fragmentLoader.load(e,i)).catch(d=>this.handleFragLoadError(d)):u=Promise.all([this.fragmentLoader.load(e,h?i:void 0),o]).then(([d])=>(!h&&i&&i(d),d)).catch(d=>this.handleFragLoadError(d)),this.hls.trigger(y.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):u}doFragPartsLoad(e,t,s,i){return new Promise((n,a)=>{var o;const l=[],c=(o=s.details)==null?void 0:o.partList,h=u=>{this.fragmentLoader.loadPart(e,u,i).then(d=>{l[u.index]=d;const g=d.part;this.hls.trigger(y.FRAG_LOADED,d);const f=Ci(s.details,e.sn,u.index+1)||Dn(c,e.sn,u.index+1);if(f)h(f);else return n({frag:e,part:g,partsLoaded:l})}).catch(a);};h(t);})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===_.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===G.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(y.ERROR,t);}else this.hls.trigger(y.ERROR,{type:G.OTHER_ERROR,details:_.INTERNAL_EXCEPTION,err:e,error:e,fatal:true});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==C.PARSING){!this.fragCurrent&&this.state!==C.STOPPED&&this.state!==C.ERROR&&(this.state=C.IDLE);return}const{frag:s,part:i,level:n}=t,a=self.performance.now();s.stats.parsing.end=a,i&&(i.stats.parsing.end=a);const o=this.getLevelDetails(),c=o&&s.sn>o.endSN||this.shouldLoadParts(o,s.end);c!==this.loadingParts&&(this.log(`LL-Part loading ${c?"ON":"OFF"} after parsing segment ending @${s.end.toFixed(2)}`),this.loadingParts=c),this.updateLevelTiming(s,i,n,e.partial);}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var s;const n=e.partList[0];if(n.fragment.type===K.SUBTITLE)return false;const a=n.end+(((s=e.fragmentHint)==null?void 0:s.duration)||0);if(t>=a){var i;if((this.hls.hasEnoughToStart?((i=this.media)==null?void 0:i.currentTime)||this.lastCurrentTime:this.getLoadPosition())>n.start-n.fragment.duration)return true}}}return false}getCurrentContext(e){const{levels:t,fragCurrent:s}=this,{level:i,sn:n,part:a}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${n} of ${this.playlistLabel()} ${i}. The current chunk will not be buffered.`),null;const o=t[i],l=o.details,c=a>-1?Ci(l,n,a):null,h=c?c.fragment:_n(l,n,s);return h?(s&&s!==h&&(h.stats=s.stats),{frag:h,part:c,level:o}):null}bufferFragmentData(e,t,s,i,n){if(this.state!==C.PARSING)return;const{data1:a,data2:o}=e;let l=a;if(o&&(l=Ae(a,o)),!l.length)return;const c=this.initPTS[t.cc],h=c?-c.baseTime/c.timescale:void 0,u={type:e.type,frag:t,part:s,chunkMeta:i,offset:h,parent:t.type,data:l};if(this.hls.trigger(y.BUFFER_APPENDING,u),e.dropped&&e.independent&&!s){if(n)return;this.flushBufferGap(t);}}flushBufferGap(e){const t=this.media;if(!t)return;if(!J.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const s=t.currentTime,i=J.bufferInfo(t,s,0),n=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),o=Math.max(Math.min(e.start-a,i.end-a),s+a);e.start-o>a&&this.flushMainBuffer(o,e.start);}getFwdBufferInfo(e,t){var s;const i=this.getLoadPosition();if(!B(i))return null;const a=this.lastCurrentTime>i||(s=this.media)!=null&&s.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,i,t,a)}getFwdBufferInfoAtPos(e,t,s,i){const n=J.bufferInfo(e,t,i);if(n.len===0&&n.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,s);if(a&&(n.nextStart<=a.end||a.gap)){const o=Math.max(Math.min(n.nextStart,a.end)-t,i);return J.bufferInfo(e,t,o)}}return n}getMaxBufferLength(e){const{config:t}=this;let s;return e?s=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):s=t.maxBufferLength,Math.min(s,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const s=this.config,i=Math.max(Math.min(e-t,s.maxBufferLength),t),n=Math.max(e-t*3,s.maxMaxBufferLength/2,i);return n>=i?(s.maxMaxBufferLength=n,this.warn(`Reduce max buffer length to ${n}s`),true):false}getAppendedFrag(e,t=K.MAIN){const s=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return s&&"fragment"in s?s.fragment:s}getNextFragment(e,t){const s=t.fragments,i=s.length;if(!i)return null;const{config:n}=this,a=s[0].start,o=n.lowLatencyMode&&!!t.partList;let l=null;if(t.live){const u=n.initialLiveManifestSize;if(i=a?d:g)||l.start:e;this.log(`Setting startPosition to ${f} to match start frag at live edge. mainStart: ${d} liveSyncPosition: ${g} frag.start: ${(c=l)==null?void 0:c.start}`),this.startPosition=this.nextLoadPosition=f;}}else e<=a&&(l=s[0]);if(!l){const u=this.loadingParts?t.partEnd:t.fragmentEnd;l=this.getFragmentAtPosition(e,u,t);}let h=this.filterReplacedPrimary(l,t);if(!h&&l){const u=l.sn-t.startSN;h=this.filterReplacedPrimary(s[u+1]||null,t);}return this.mapToInitFragWhenRequired(h)}isLoopLoading(e,t){const s=this.fragmentTracker.getState(e);return (s===ve.OK||s===ve.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,s,i,n){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&s.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,i,0);if(o!==null&&s.len+o.len>=n){const l=a.sn;return this.loopSn!==l&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${l}`),this.loopSn=l),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(Oi(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return true}return false}filterReplacedPrimary(e,t){if(!e)return e;if(Oi(this.config)&&e.type!==K.SUBTITLE){const s=this.hls.interstitialsManager,i=s?.bufferingItem;if(i){const a=i.event;if(a){if(a.appendInPlace||Math.abs(e.start-i.start)>1||i.start===0)return null}else if(e.end<=i.start&&t?.live===false||e.start>i.end&&i.nextEvent&&(i.nextEvent.appendInPlace||e.start-i.end>1))return null}const n=s?.playerQueue;if(n)for(let a=n.length;a--;){const o=n[a].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,s){let i=-1,n=false,a=true;for(let o=0,l=e.length;o-1&&ss.start)return true}return false}getInitialLiveFragment(e){const t=e.fragments,s=this.fragPrevious;let i=null;if(s){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),i=Sa(t,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const n=s.sn+1;if(n>=e.startSN&&n<=e.endSN){const a=t[n-e.startSN];s.cc===a.cc&&(i=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`));}i||(i=xn(e,s.cc,s.end),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`));}}else {const n=this.hls.liveSyncPosition;n!==null&&(i=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e));}return i}getFragmentAtPosition(e,t,s){const{config:i}=this;let{fragPrevious:n}=this,{fragments:a,endSN:o}=s;const{fragmentHint:l}=s,{maxFragLookUpTolerance:c}=i,h=s.partList,u=!!(this.loadingParts&&h!=null&&h.length&&l);u&&!this.bitrateTest&&h[h.length-1].fragment.sn===l.sn&&(a=a.concat(l),o=l.sn);let d;if(et-c||(g=this.media)!=null&&g.paused||!this.startFragRequested?0:c;d=ht(n,a,e,m);}else d=a[a.length-1];if(d){const f=d.sn-s.startSN,m=this.fragmentTracker.getState(d);if((m===ve.OK||m===ve.PARTIAL&&d.gap)&&(n=d),n&&d.sn===n.sn&&(!u||h[0].fragment.sn>d.sn||!s.live)&&d.level===n.level){const S=a[f+1];d.sn${e.startSN} fragments: ${i}`),l}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let s=this.startPosition;s=0&&(s=this.nextLoadPosition),s}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&ye(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e));}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==C.FRAG_LOADING_WAITING_RETRY)&&(this.state=C.IDLE);}onFragmentOrKeyLoadError(e,t){var s;if(t.chunkMeta&&!t.frag){const S=this.getCurrentContext(t.chunkMeta);S&&(t.frag=S.frag);}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var n;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const a=t.details===_.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(i,true);const o=t.errorAction;if(!o){this.state=C.ERROR;return}const{action:l,flags:c,retryCount:h=0,retryConfig:u}=o,d=!!u,g=d&&l===ce.RetryRequest,f=d&&!o.resolved&&c===me.MoveAllAlternatesMatchingHost,m=(s=this.hls.latestLevelDetails)==null?void 0:s.live;if(!g&&f&&ye(i)&&!i.endList&&m&&!An(t))this.resetFragmentErrors(e),this.treatAsGap(i),o.resolved=true;else if((g||f)&&h=t||s&&!bs(0))&&(s&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=C.IDLE);}reduceLengthAndFlushBuffer(e){if(this.state===C.PARSING||this.state===C.PARSED){const t=e.frag,s=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,s),n=i&&i.len>.5;n&&this.reduceMaxBufferLength(i.len,t?.duration||10);const a=!n;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${s} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return false}resetFragmentErrors(e){e===K.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=false),this.state!==C.STOPPED&&(this.state=C.IDLE);}afterBufferFlushed(e,t,s){if(!e)return;const i=J.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,s),this.state===C.ENDED&&this.resetLoadingState();}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==C.STOPPED&&(this.state=C.IDLE);}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=false;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition;}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState();}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,false,true);}updateLevelTiming(e,t,s,i){const n=s.details;if(!n){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,c)=>{const h=e.elementaryStreams[c];if(h){const u=h.endPTS-h.startPTS;if(u<=0)return this.warn(`Could not parse fragment ${e.sn} ${c} duration reliably (${u})`),l||false;const d=i?0:Ln(n,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS,this);return this.hls.trigger(y.LEVEL_PTS_UPDATED,{details:n,level:s,drift:d,type:c,frag:e,start:h.startPTS,end:h.endPTS}),true}return l},false)){var o;const l=((o=this.transmuxer)==null?void 0:o.error)===null;if((s.fragmentError===0||l&&(s.fragmentError<2||e.endList))&&this.treatAsGap(e,s),l){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(y.ERROR,{type:G.MEDIA_ERROR,details:_.FRAG_PARSING_ERROR,fatal:false,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer();}}this.state=C.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,false,t)})`),this.hls.trigger(y.FRAG_PARSED,{frag:e,part:t});}playlistLabel(){return this.playlistType===K.MAIN?"level":"track"}fragInfo(e,t=true,s){var i,n;return `${this.playlistLabel()} ${e.level} (${s?"part":"frag"}:[${((i=t&&!s?e.startPTS:(s||e).start)!=null?i:NaN).toFixed(3)}-${((n=t&&!s?e.endPTS:(s||e).end)!=null?n:NaN).toFixed(3)}]${s&&e.type==="main"?"INDEPENDENT="+(s.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=true,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,true);}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset();}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState());}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`));}get state(){return this._state}}function Oi(r){return !!r.interstitialsController&&r.enableInterstitialPlayback!==false}class so{constructor(){this.chunks=[],this.dataLength=0;}push(e){this.chunks.push(e),this.dataLength+=e.length;}flush(){const{chunks:e,dataLength:t}=this;let s;if(e.length)e.length===1?s=e[0]:s=io(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0;}}function io(r,e){const t=new Uint8Array(e);let s=0;for(let i=0;i0)return r.subarray(t,t+s)}function ho(r,e,t,s){const i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],n=e[t+2],a=n>>2&15;if(a>12){const g=new Error(`invalid ADTS sampling index:${a}`);r.emit(y.ERROR,y.ERROR,{type:G.MEDIA_ERROR,details:_.FRAG_PARSING_ERROR,fatal:true,error:g,reason:g.message});return}const o=(n>>6&3)+1,l=e[t+3]>>6&3|(n&1)<<2,c="mp4a.40."+o,h=i[a];let u=a;(o===5||o===29)&&(u-=3);const d=[o<<3|(u&14)>>1,(u&1)<<7|l<<3];return re.log(`manifest codec:${s}, parsed codec:${c}, channels:${l}, rate:${h} (ADTS object type:${o} sampling index:${a})`),{config:d,samplerate:h,channelCount:l,codec:c,parsedCodec:c,manifestCodec:s}}function Fn(r,e){return r[e]===255&&(r[e+1]&246)===240}function Mn(r,e){return r[e+1]&1?7:9}function Hs(r,e){return (r[e+3]&3)<<11|r[e+4]<<3|(r[e+5]&224)>>>5}function uo(r,e){return e+5=r.length)return false;const s=Hs(r,e);if(s<=t)return false;const i=e+s;return i===r.length||zt(r,i)}return false}function Nn(r,e,t,s,i){if(!r.samplerate){const n=ho(e,t,s,i);if(!n)return;ie(r,n);}}function Bn(r){return 1024*9e4/r}function mo(r,e){const t=Mn(r,e);if(e+t<=r.length){const s=Hs(r,e)-t;if(s>0)return {headerLength:t,frameLength:s}}}function Un(r,e,t,s,i){const n=Bn(r.samplerate),a=s+i*n,o=mo(e,t);let l;if(o){const{frameLength:u,headerLength:d}=o,g=d+u,f=Math.max(0,t+g-e.length);f?(l=new Uint8Array(g-d),l.set(e.subarray(t+d,e.length),0)):l=e.subarray(t+d,t+g);const m={unit:l,pts:a};return f||r.samples.push(m),{sample:m,length:g,missing:f}}const c=e.length-t;return l=new Uint8Array(c),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:a},length:c,missing:-1}}function po(r,e){return Vs(r,e)&&Jt(r,e+6)+10<=r.length-e}function yo(r){return r instanceof ArrayBuffer?r:r.byteOffset==0&&r.byteLength==r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer}function us(r,e=0,t=1/0){return So(r,e,t,Uint8Array)}function So(r,e,t,s){const i=Eo(r);let n=1;"BYTES_PER_ELEMENT"in s&&(n=s.BYTES_PER_ELEMENT);const a=To(r)?r.byteOffset:0,o=(a+r.byteLength)/n,l=(a+e)/n,c=Math.floor(Math.max(0,Math.min(l,o))),h=Math.floor(Math.min(c+Math.max(t,0),o));return new s(i,c,h-c)}function Eo(r){return r instanceof ArrayBuffer?r:r.buffer}function To(r){return r&&r.buffer instanceof ArrayBuffer&&r.byteLength!==void 0&&r.byteOffset!==void 0}function xo(r){const e={key:r.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(r.size<2)return;if(r.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const s=r.data.subarray(1).indexOf(0);if(s===-1)return;const i=Se(us(r.data,1,s)),n=r.data[2+s],a=r.data.subarray(3+s).indexOf(0);if(a===-1)return;const o=Se(us(r.data,3+s,a));let l;return i==="-->"?l=Se(us(r.data,4+s+a)):l=yo(r.data.subarray(4+s+a)),e.mimeType=i,e.pictureType=n,e.description=o,e.data=l,e}function vo(r){if(r.size<2)return;const e=Se(r.data,true),t=new Uint8Array(r.data.subarray(e.length+1));return {key:r.type,info:e,data:t.buffer}}function Ao(r){if(r.size<2)return;if(r.type==="TXXX"){let t=1;const s=Se(r.data.subarray(t),true);t+=s.length+1;const i=Se(r.data.subarray(t));return {key:r.type,info:s,data:i}}const e=Se(r.data.subarray(1));return {key:r.type,info:"",data:e}}function Io(r){if(r.type==="WXXX"){if(r.size<2)return;let t=1;const s=Se(r.data.subarray(t),true);t+=s.length+1;const i=Se(r.data.subarray(t));return {key:r.type,info:s,data:i}}const e=Se(r.data);return {key:r.type,info:"",data:e}}function Ro(r){return r.type==="PRIV"?vo(r):r.type[0]==="W"?Io(r):r.type==="APIC"?xo(r):Ao(r)}function Lo(r){const e=String.fromCharCode(r[0],r[1],r[2],r[3]),t=Jt(r,4),s=10;return {type:e,size:t,data:r.subarray(s,s+t)}}const Dt=10,bo=10;function _o(r){let e=0;const t=[];for(;Vs(r,e);){const s=Jt(r,e+6);r[e+5]>>6&1&&(e+=Dt),e+=Dt;const i=e+s;for(;e+bo0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:dt.audioId3,duration:Number.POSITIVE_INFINITY});i{if(B(r))return r*90;const s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};let Pt=null;const ko=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],wo=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Oo=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Fo=[0,1,1,4];function $n(r,e,t,s,i){if(t+24>e.length)return;const n=Gn(e,t);if(n&&t+n.frameLength<=e.length){const a=n.samplesPerFrame*9e4/n.sampleRate,o=s+i*a,l={unit:e.subarray(t,t+n.frameLength),pts:o,dts:o};return r.config=[],r.channelCount=n.channelCount,r.samplerate=n.sampleRate,r.samples.push(l),{sample:l,length:n.frameLength,missing:0}}}function Gn(r,e){const t=r[e+1]>>3&3,s=r[e+1]>>1&3,i=r[e+2]>>4&15,n=r[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&n!==3){const a=r[e+2]>>1&1,o=r[e+3]>>6,l=t===3?3-s:s===3?3:4,c=ko[l*14+i-1]*1e3,u=wo[(t===3?0:t===2?1:2)*3+n],d=o===3?1:2,g=Oo[t][s],f=Fo[s],m=g*8*f,p=Math.floor(g*c/u+a)*f;if(Pt===null){const T=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Pt=T?parseInt(T[1]):0;}return Pt&&Pt<=87&&s===2&&c>=224e3&&o===0&&(r[e+3]=r[e+3]|128),{sampleRate:u,channelCount:d,frameLength:p,samplesPerFrame:m}}}function qs(r,e){return r[e]===255&&(r[e+1]&224)===224&&(r[e+1]&6)!==0}function Kn(r,e){return e+1{let t=0,s=5;e+=s;const i=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=r[e];const o=Math.min(s,8),l=8-o;n[0]=4278190080>>>24+l<>l,t=t?t<e.length||e[t]!==11||e[t+1]!==119)return -1;const n=e[t+4]>>6;if(n>=3)return -1;const o=[48e3,44100,32e3][n],l=e[t+4]&63,h=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][l*3+n]*2;if(t+h>e.length)return -1;const u=e[t+6]>>5;let d=0;u===2?d+=2:(u&1&&u!==1&&(d+=2),u&4&&(d+=2));const g=(e[t+6]<<8|e[t+7])>>12-d&1,m=[2,1,2,3,3,4,4,5][u]+g,p=e[t+5]>>3,S=e[t+5]&7,E=new Uint8Array([n<<6|p<<1|S>>2,(S&3)<<6|u<<3|g<<2|l>>4,l<<4&224]),T=1536/o*9e4,A=s+i*T,I=e.subarray(t,t+h);return r.config=E,r.channelCount=m,r.samplerate=o,r.samples.push({unit:I,pts:A}),h}class Uo extends Ws{resetInitSegment(e,t,s,i){super.resetInitSegment(e,t,s,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0};}static probe(e){if(!e)return false;const t=xt(e,0);let s=t?.length||0;if(t&&e[s]===11&&e[s+1]===119&&Ys(t)!==void 0&&Hn(e,s)<=16)return false;for(let i=e.length;s{const a=Wr(n);if($o.test(a.schemeIdUri)){const o=Mi(a,t);let l=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const c=a.payload;s.samples.push({data:c,len:c.byteLength,dts:o,pts:o,type:dt.emsg,duration:l});}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=Mi(a,t);s.samples.push({data:a.payload,len:a.payload.byteLength,dts:o,pts:o,type:dt.misbklv,duration:Number.POSITIVE_INFINITY});}});}return s}demuxSampleAes(e,t,s){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0;}}function Mi(r,e){return B(r.presentationTime)?r.presentationTime/r.timeScale:e+r.presentationTimeDelta/r.timeScale}class Ko{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new $s(t,{removePKCS7Padding:false});}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,qe.cbc)}decryptAacSample(e,t,s){const i=e[t].unit;if(i.length<=16)return;const n=i.subarray(16,i.length-i.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);i.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s);}).catch(s);}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length){s();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(t);let i=0;for(let n=32;n{n.data=this.getAvcDecryptedUnit(a,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,i);}).catch(i);}decryptAvcSamples(e,t,s,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,s=0){if(t>=e.length){i();return}const n=e[t].units;for(;!(s>=n.length);s++){const a=n[s];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,s,i,a),!this.decrypter.isSync()))return}}}}class Wn{constructor(){this.VideoSample=null;}createVideoSample(e,t,s){return {key:e,frame:false,pts:t,dts:s,units:[],length:0}}getLastNalUnit(e){var t;let s=this.VideoSample,i;if((!s||s.units.length===0)&&(s=e[e.length-1]),(t=s)!=null&&t.units){const n=s.units;i=n[n.length-1];}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const s=t.samples,i=s.length;if(i){const n=s[i-1];e.pts=n.pts,e.dts=n.dts;}else {t.dropped++;return}}t.samples.push(e);}}parseNALu(e,t,s){const i=t.byteLength;let n=e.naluState||0;const a=n,o=[];let l=0,c,h,u,d=-1,g=0;for(n===-1&&(d=0,g=this.getNALuType(t,0),n=0,l=1);l=0){const f={data:t.subarray(d,h),type:g};o.push(f);}else {const f=this.getLastNalUnit(e.samples);f&&(a&&l<=4-a&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-a)),h>0&&(f.data=Ae(f.data,t.subarray(0,h)),f.state=0));}l=0&&n>=0){const f={data:t.subarray(d,i),type:g,state:n};o.push(f);}if(o.length===0){const f=this.getLastNalUnit(e.samples);f&&(f.data=Ae(f.data,t));}return e.naluState=n,o}}class St{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0;}loadWord(){const e=this.data,t=this.bytesAvailable,s=e.byteLength-t,i=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");i.set(e.subarray(s,s+n)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n;}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e);}readBits(e){let t=Math.min(this.bitsAvailable,e);const s=this.word>>>32-t;if(e>32&&re.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?s<>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ());}skipEG(){this.skipBits(1+this.skipLZ());}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Vo extends Wn{parsePES(e,t,s,i){const n=this.parseNALu(e,s.data,i);let a=this.VideoSample,o,l=false;s.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(false,s.pts,s.dts)),n.forEach(c=>{var h,u;switch(c.type){case 1:{let m=false;o=true;const p=c.data;if(l&&p.length>4){const S=this.readSliceType(p);(S===2||S===4||S===7||S===9)&&(m=true);}if(m){var d;(d=a)!=null&&d.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null);}a||(a=this.VideoSample=this.createVideoSample(true,s.pts,s.dts)),a.frame=true,a.key=m;break}case 5:o=true,(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(true,s.pts,s.dts)),a.key=true,a.frame=true;break;case 6:{o=true,Ms(c.data,1,s.pts,t.samples);break}case 7:{var g,f;o=true,l=true;const m=c.data,p=this.readSPS(m);if(!e.sps||e.width!==p.width||e.height!==p.height||((g=e.pixelRatio)==null?void 0:g[0])!==p.pixelRatio[0]||((f=e.pixelRatio)==null?void 0:f[1])!==p.pixelRatio[1]){e.width=p.width,e.height=p.height,e.pixelRatio=p.pixelRatio,e.sps=[m];const S=m.subarray(1,4);let E="avc1.";for(let T=0;T<3;T++){let A=S[T].toString(16);A.length<2&&(A="0"+A),E+=A;}e.codec=E;}break}case 8:o=true,e.pps=[c.data];break;case 9:o=true,e.audFound=true,(u=a)!=null&&u.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(false,s.pts,s.dts));break;case 12:o=true;break;default:o=false;break}a&&o&&a.units.push(c);}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null);}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new St(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let s=8,i=8,n;for(let a=0;a{var h,u;switch(c.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(false,s.pts,s.dts)),a.frame=true,o=true;break;case 16:case 17:case 18:case 21:if(o=true,l){var d;(d=a)!=null&&d.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null);}a||(a=this.VideoSample=this.createVideoSample(true,s.pts,s.dts)),a.key=true,a.frame=true;break;case 19:case 20:o=true,(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(true,s.pts,s.dts)),a.key=true,a.frame=true;break;case 39:o=true,Ms(c.data,2,s.pts,t.samples);break;case 32:o=true,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=ie(e.params,this.readVPS(c.data)),this.initVPS=c.data),e.vps=[c.data];break;case 33:if(o=true,l=true,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],c.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const g=this.readSPS(c.data);e.width=g.width,e.height=g.height,e.pixelRatio=g.pixelRatio,e.codec=g.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const f in g.params)e.params[f]=g.params[f];}this.pushParameterSet(e.sps,c.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(true,s.pts,s.dts)),a.key=true;break;case 34:if(o=true,typeof e.params=="object"){if(!e.pps){e.pps=[];const g=this.readPPS(c.data);for(const f in g)e.params[f]=g[f];}this.pushParameterSet(e.pps,c.data,e.vps);}break;case 35:o=true,e.audFound=true,(u=a)!=null&&u.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(false,s.pts,s.dts));break;default:o=false;break}a&&o&&a.units.push(c);}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null);}pushParameterSet(e,t,s){(s&&s[0]===this.initVPS||!s&&!e.length)&&e.push(t);}getNALuType(e,t){return (e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let s=0;for(let i=0;i=2&&e[i]===3&&e[i-1]===0&&e[i-2]===0||(t[s]=e[i],s++);return new Uint8Array(t.buffer,0,s)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null);}readVPS(e){const t=new St(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const s=t.readBits(3),i=t.readBoolean();return {numTemporalLayers:s+1,temporalIdNested:i}}readSPS(e){const t=new St(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const s=t.readBits(3);t.readBoolean();const i=t.readBits(2),n=t.readBoolean(),a=t.readBits(5),o=t.readUByte(),l=t.readUByte(),c=t.readUByte(),h=t.readUByte(),u=t.readUByte(),d=t.readUByte(),g=t.readUByte(),f=t.readUByte(),m=t.readUByte(),p=t.readUByte(),S=t.readUByte(),E=[],T=[];for(let X=0;X0)for(let X=s;X<8;X++)t.readBits(2);for(let X=0;X1&&t.readEG();for(let st=0;st0&&Qe<16?(k=ei[Qe-1],W=It[Qe-1]):Qe===255&&(k=t.readBits(16),W=t.readBits(16));}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),he=t.readBoolean(),he&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(j=t.readBits(32),Q=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const It=t.readBoolean(),ti=t.readBoolean();let ft=false;(It||ti)&&(ft=t.readBoolean(),ft&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),ft&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let si=0;si<=s;si++){Z=t.readBoolean();const vr=Z||t.readBoolean();let ii=false;vr?t.readEG():ii=t.readBoolean();const ni=ii?1:t.readUEG()+1;if(It)for(let gt=0;gt>X&1)<<31-X)>>>0;let ss=ts.toString(16);return a===1&&ss==="2"&&(ss="6"),{codecString:`hvc1.${je}${a}.${ss}.${n?"H":"L"}${S}.B0`,params:{general_tier_flag:n,general_profile_idc:a,general_profile_space:i,general_profile_compatibility_flags:[o,l,c,h],general_constraint_indicator_flags:[u,d,g,f,m,p],general_level_idc:S,bit_depth:O+8,bit_depth_luma_minus8:O,bit_depth_chroma_minus8:N,min_spatial_segmentation_idc:w,chroma_format_idc:A,frame_rate:{fixed:Z,fps:Q/j}},width:Ee,height:_e,pixelRatio:[k,W]}}readPPS(e){const t=new St(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const i=t.readBoolean(),n=t.readBoolean();let a=1;return n&&i?a=0:n?a=3:i&&(a=2),{parallelismType:a}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const oe=188;class Ye{constructor(e,t,s,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=false,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.logger=i,this.videoParser=null;}static probe(e,t){const s=Ye.syncOffset(e);return s>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${s}`),s!==-1}static syncOffset(e){const t=e.length;let s=Math.min(oe*5,t-oe)+1,i=0;for(;i1&&(a===0&&o>2||l+oe>s))return a}else {if(o)return -1;break}i++;}return -1}static createTrack(e,t){return {container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:cn[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,s,i){this.pmtParsed=false,this._pmtId=-1,this._videoTrack=Ye.createTrack("video"),this._videoTrack.duration=i,this._audioTrack=Ye.createTrack("audio",i),this._id3Track=Ye.createTrack("id3"),this._txtTrack=Ye.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s;}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null;}demux(e,t,s=false,i=false){s||(this.sampleAes=null);let n;const a=this._videoTrack,o=this._audioTrack,l=this._id3Track,c=this._txtTrack;let h=a.pid,u=a.pesData,d=o.pid,g=l.pid,f=o.pesData,m=l.pesData,p=null,S=this.pmtParsed,E=this._pmtId,T=e.length;if(this.remainderData&&(e=Ae(this.remainderData,e),T=e.length,this.remainderData=null),T>4;let P;if(R>1){if(P=v+5+e[v+4],P===v+oe)continue}else P=v+4;switch(b){case h:L&&(u&&(n=nt(u,this.logger))&&(this.readyVideoParser(a.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(a,c,n,false)),u={data:[],size:0}),u&&(u.data.push(e.subarray(P,v+oe)),u.size+=v+oe-P);break;case d:if(L){if(f&&(n=nt(f,this.logger)))switch(o.segmentCodec){case "aac":this.parseAACPES(o,n);break;case "mp3":this.parseMPEGPES(o,n);break;case "ac3":this.parseAC3PES(o,n);break}f={data:[],size:0};}f&&(f.data.push(e.subarray(P,v+oe)),f.size+=v+oe-P);break;case g:L&&(m&&(n=nt(m,this.logger))&&this.parseID3PES(l,n),m={data:[],size:0}),m&&(m.data.push(e.subarray(P,v+oe)),m.size+=v+oe-P);break;case 0:L&&(P+=e[P]+1),E=this._pmtId=Yo(e,P);break;case E:{L&&(P+=e[P]+1);const O=Wo(e,P,this.typeSupported,s,this.observer,this.logger);h=O.videoPid,h>0&&(a.pid=h,a.segmentCodec=O.segmentVideoCodec),d=O.audioPid,d>0&&(o.pid=d,o.segmentCodec=O.segmentAudioCodec),g=O.id3Pid,g>0&&(l.pid=g),p!==null&&!S&&(this.logger.warn(`MPEG-TS PMT found at ${v} after unknown PID '${p}'. Backtracking to sync byte @${A} to parse all TS packets.`),p=null,v=A-188),S=this.pmtParsed=true;break}case 17:case 8191:break;default:p=b;break}}else I++;I>0&&Ps(this.observer,new Error(`Found ${I} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=u,o.pesData=f,l.pesData=m;const D={audioTrack:o,videoTrack:a,id3Track:l,textTrack:c};return i&&this.extractRemainingSamples(D),D}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,false,true):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:s,id3Track:i,textTrack:n}=e,a=s.pesData,o=t.pesData,l=i.pesData;let c;if(a&&(c=nt(a,this.logger))?(this.readyVideoParser(s.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(s,n,c,true),s.pesData=null)):s.pesData=a,o&&(c=nt(o,this.logger))){switch(t.segmentCodec){case "aac":this.parseAACPES(t,c);break;case "mp3":this.parseMPEGPES(t,c);break;case "ac3":this.parseAC3PES(t,c);break}t.pesData=null;}else o!=null&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;l&&(c=nt(l,this.logger))?(this.parseID3PES(i,c),i.pesData=null):i.pesData=l;}demuxSampleAes(e,t,s){const i=this.demux(e,s,true,!this.config.progressive),n=this.sampleAes=new Ko(this.observer,this.config,t);return this.decrypt(i,n)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new Vo:e==="hevc"&&(this.videoParser=new Ho));}decrypt(e,t){return new Promise(s=>{const{audioTrack:i,videoTrack:n}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{s(e);}):s(e);}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{s(e);});})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0;}parseAACPES(e,t){let s=0;const i=this.aacOverFlow;let n=t.data;if(i){this.aacOverFlow=null;const u=i.missing,d=i.sample.unit.byteLength;if(u===-1)n=Ae(i.sample.unit,n);else {const g=d-u;i.sample.unit.set(n.subarray(0,u),g),e.samples.push(i.sample),s=i.missing;}}let a,o;for(a=s,o=n.length;a0;)o+=l;}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=ie({},t,{type:this._videoTrack?dt.emsg:dt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s);}}function Ds(r,e){return ((r[e+1]&31)<<8)+r[e+2]}function Yo(r,e){return (r[e+10]&31)<<8|r[e+11]}function Wo(r,e,t,s,i,n){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(r[e+1]&15)<<8|r[e+2],l=e+3+o-4,c=(r[e+10]&15)<<8|r[e+11];for(e+=12+c;e0){let d=e+5,g=u;for(;g>2;){r[d]===106&&(t.ac3!==true?n.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=h,a.segmentAudioCodec="ac3"));const m=r[d+1]+2;d+=m,g-=m;}}break;case 194:case 135:return Ps(i,new Error("Unsupported EC-3 in M2TS found"),void 0,n),a;case 36:a.videoPid===-1&&(a.videoPid=h,a.segmentVideoCodec="hevc",n.log("HEVC in M2TS found"));break}e+=u+5;}return a}function Ps(r,e,t,s){s.warn(`parsing error: ${e.message}`),r.emit(y.ERROR,y.ERROR,{type:G.MEDIA_ERROR,details:_.FRAG_PARSING_ERROR,fatal:false,levelRetry:t,error:e,reason:e.message});}function ds(r,e){e.log(`${r} with AES-128-CBC encryption found in unencrypted stream`);}function nt(r,e){let t=0,s,i,n,a,o;const l=r.data;if(!r||r.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=Ae(l[0],l[1]),l.splice(1,1);if(s=l[0],(s[0]<<16)+(s[1]<<8)+s[2]===1){if(i=(s[4]<<8)+s[5],i&&i>r.size-6)return null;const h=s[7];h&192&&(a=(s[9]&14)*536870912+(s[10]&255)*4194304+(s[11]&254)*16384+(s[12]&255)*128+(s[13]&254)/2,h&64?(o=(s[14]&14)*536870912+(s[15]&255)*4194304+(s[16]&254)*16384+(s[17]&255)*128+(s[18]&254)/2,a-o>60*9e4&&(e.warn(`${Math.round((a-o)/9e4)}s delta between PTS and DTS, align them`),a=o)):o=a),n=s[8];let u=n+9;if(r.size<=u)return null;r.size-=u;const d=new Uint8Array(r.size);for(let g=0,f=l.length;gm){u-=m;continue}else s=s.subarray(u),m-=u,u=0;d.set(s,t),t+=m;}return i&&(i-=n+3),{data:d,pts:a,dts:o,len:i}}return null}class qo{static getSilentFrame(e,t){switch(e){case "mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const Ke=Math.pow(2,32)-1;class x{static init(){x.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in x.types)x.types.hasOwnProperty(e)&&(x.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),s=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);x.HDLR_TYPES={video:t,audio:s};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);x.STTS=x.STSC=x.STCO=n,x.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),x.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),x.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),x.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);x.FTYP=x.box(x.types.ftyp,a,l,a,o),x.DINF=x.box(x.types.dinf,x.box(x.types.dref,i));}static box(e,...t){let s=8,i=t.length;const n=i;for(;i--;)s+=t[i].byteLength;const a=new Uint8Array(s);for(a[0]=s>>24&255,a[1]=s>>16&255,a[2]=s>>8&255,a[3]=s&255,a.set(e,4),i=0,s=8;i>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return x.box(x.types.mdia,x.mdhd(e.timescale||0,e.duration||0),x.hdlr(e.type),x.minf(e))}static mfhd(e){return x.box(x.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?x.box(x.types.minf,x.box(x.types.smhd,x.SMHD),x.DINF,x.stbl(e)):x.box(x.types.minf,x.box(x.types.vmhd,x.VMHD),x.DINF,x.stbl(e))}static moof(e,t,s){return x.box(x.types.moof,x.mfhd(e),x.traf(s,t))}static moov(e){let t=e.length;const s=[];for(;t--;)s[t]=x.trak(e[t]);return x.box.apply(null,[x.types.moov,x.mvhd(e[0].timescale||0,e[0].duration||0)].concat(s).concat(x.mvex(e)))}static mvex(e){let t=e.length;const s=[];for(;t--;)s[t]=x.trex(e[t]);return x.box.apply(null,[x.types.mvex,...s])}static mvhd(e,t){t*=e;const s=Math.floor(t/(Ke+1)),i=Math.floor(t%(Ke+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,i>>24,i>>16&255,i>>8&255,i&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return x.box(x.types.mvhd,n)}static sdtp(e){const t=e.samples||[],s=new Uint8Array(4+t.length);let i,n;for(i=0;i>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(i=0;i>>8&255),s.push(a&255),s=s.concat(Array.prototype.slice.call(n));const o=x.box(x.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(s))),l=e.width,c=e.height,h=e.pixelRatio[0],u=e.pixelRatio[1];return x.box(x.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,x.box(x.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),x.box(x.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,u>>24,u>>16&255,u>>8&255,u&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return x.box(x.types.mp4a,x.audioStsd(e),x.box(x.types.esds,x.esds(e)))}static mp3(e){return x.box(x.types[".mp3"],x.audioStsd(e))}static ac3(e){return x.box(x.types["ac-3"],x.audioStsd(e),x.box(x.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return x.box(x.types.stsd,x.STSD,x.mp4a(e));if(t==="ac3"&&e.config)return x.box(x.types.stsd,x.STSD,x.ac3(e));if(t==="mp3"&&e.codec==="mp3")return x.box(x.types.stsd,x.STSD,x.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return x.box(x.types.stsd,x.STSD,x.avc1(e));if(t==="hevc"&&e.vps)return x.box(x.types.stsd,x.STSD,x.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,s=(e.duration||0)*(e.timescale||0),i=e.width||0,n=e.height||0,a=Math.floor(s/(Ke+1)),o=Math.floor(s%(Ke+1));return x.box(x.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,i&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const s=x.sdtp(e),i=e.id,n=Math.floor(t/(Ke+1)),a=Math.floor(t%(Ke+1));return x.box(x.types.traf,x.box(x.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),x.box(x.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,a>>24,a>>16&255,a>>8&255,a&255])),x.trun(e,s.length+16+20+8+16+8+8),s)}static trak(e){return e.duration=e.duration||4294967295,x.box(x.types.trak,x.tkhd(e),x.mdia(e))}static trex(e){const t=e.id;return x.box(x.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const s=e.samples||[],i=s.length,n=12+16*i,a=new Uint8Array(n);let o,l,c,h,u,d;for(t+=8+n,a.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o>>24&255,c>>>16&255,c>>>8&255,c&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,u.degradPrio&61440,u.degradPrio&15,d>>>24&255,d>>>16&255,d>>>8&255,d&255],12+16*o);return x.box(x.types.trun,a)}static initSegment(e){x.types||x.init();const t=x.moov(e);return Ae(x.FTYP,t)}static hvc1(e){const t=e.params,s=[e.vps,e.sps,e.pps],i=4,n=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),i-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),s.length]);let a=n.length;for(let f=0;f>8,s[f][m].length&255]),a),a+=2,o.set(s[f][m],a),a+=s[f][m].length;}const c=x.box(x.types.hvcC,o),h=e.width,u=e.height,d=e.pixelRatio[0],g=e.pixelRatio[1];return x.box(x.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,h>>8&255,h&255,u>>8&255,u&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c,x.box(x.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),x.box(x.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,g>>24,g>>16&255,g>>8&255,g&255])))}}x.types=void 0;x.HDLR_TYPES=void 0;x.STTS=void 0;x.STSC=void 0;x.STCO=void 0;x.STSZ=void 0;x.VMHD=void 0;x.SMHD=void 0;x.STSD=void 0;x.FTYP=void 0;x.DINF=void 0;const qn=9e4;function js(r,e,t=1,s=false){const i=r*e*t;return s?Math.round(i):i}function jo(r,e,t=1,s=false){return js(r,e,1/t,s)}function mt(r,e=false){return js(r,1e3,1/qn,e)}function zo(r,e=1){return js(r,qn,1/e)}function Ni(r){const{baseTime:e,timescale:t,trackId:s}=r;return `${e/t} (${e}/${t}) trackId: ${s}`}const Qo=10*1e3,Xo=1024,Zo=1152,Jo=1536;let rt=null,fs=null;function Bi(r,e,t,s){return {duration:e,size:t,cts:s,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:r?2:1,isNonSync:r?0:1}}}class Ut extends be{constructor(e,t,s,i){if(super("mp4-remuxer",i),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=false,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=false,this.isVideoContiguous=false,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.ISGenerated=false,rt===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);rt=a?parseInt(a[1]):0;}if(fs===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);fs=n?parseInt(n[1]):0;}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null;}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&Ni(t)} > ${e&&Ni(e)}`),this._initPTS=this._initDTS=e;}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=false,this.isAudioContiguous=false;}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=false,this.videoTrackConfig=void 0;}getVideoStartPts(e){let t=false;const s=e[0].pts,i=e.reduce((n,a)=>{let o=a.pts,l=o-n;return l<-4294967296&&(t=true,o=pe(o,s),l=o-n),l>0?n:o},s);return t&&this.debug("PTS rollover detected"),i}remux(e,t,s,i,n,a,o,l){let c,h,u,d,g,f,m=n,p=n;const S=e.pid>-1,E=t.pid>-1,T=t.samples.length,A=e.samples.length>0,I=o&&T>0||T>1;if((!S||A)&&(!E||I)||this.ISGenerated||o){if(this.ISGenerated){var v,L,b,R;const U=this.videoTrackConfig;(U&&(t.width!==U.width||t.height!==U.height||((v=t.pixelRatio)==null?void 0:v[0])!==((L=U.pixelRatio)==null?void 0:L[0])||((b=t.pixelRatio)==null?void 0:b[1])!==((R=U.pixelRatio)==null?void 0:R[1]))||!U&&I||this.nextAudioTs===null&&A)&&this.resetInitSegment();}this.ISGenerated||(u=this.generateIS(e,t,n,a));const P=this.isVideoContiguous;let O=-1,N;if(I&&(O=el(t.samples),!P&&this.config.forceKeyFrameOnDiscontinuity))if(f=true,O>0){this.warn(`Dropped ${O} out of ${T} video samples due to a missing keyframe`);const U=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(O),t.dropped+=O,p+=(t.samples[0].pts-U)/t.inputTimeScale,N=p;}else O===-1&&(this.warn(`No keyframe found out of ${T} video samples`),f=false);if(this.ISGenerated){if(A&&I){const U=this.getVideoStartPts(t.samples),M=(pe(e.samples[0].pts,U)-U)/t.inputTimeScale;m+=Math.max(0,M),p+=Math.max(0,-M);}if(A){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),u=this.generateIS(e,t,n,a)),h=this.remuxAudio(e,m,this.isAudioContiguous,a,E||I||l===K.AUDIO?p:void 0),I){const U=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),u=this.generateIS(e,t,n,a)),c=this.remuxVideo(t,p,P,U);}}else I&&(c=this.remuxVideo(t,p,P,0));c&&(c.firstKeyFrame=O,c.independent=O!==-1,c.firstKeyFramePTS=N);}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(g=jn(s,n,this._initPTS,this._initDTS)),i.samples.length&&(d=zn(i,n,this._initPTS))),{audio:h,video:c,initSegment:u,independent:f,text:d,id3:g}}computeInitPts(e,t,s,i){const n=Math.round(s*t);let a=pe(e,n);if(a0?w-1:w].dts&&(E=true);}E&&a.sort(function(w,k){const W=w.dts-k.dts,Z=w.pts-k.pts;return W||Z}),f=a[0].dts,m=a[a.length-1].dts;const A=m-f,I=A?Math.round(A/(l-1)):g||e.inputTimeScale/30;if(s){const w=f-T,k=w>I,W=w<-1;if((k||W)&&(k?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${mt(w,true)} ms (${w}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${mt(-w,true)} ms (${w}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!W||T>=a[0].pts||rt)){f=T;const Z=a[0].pts-w;if(k)a[0].dts=f,a[0].pts=Z;else {let j=true;for(let Q=0;QZ&&j);Q++){const he=a[Q].pts;if(a[Q].dts-=w,a[Q].pts-=w,Q0?k.dts-a[w-1].dts:I;if(j=w>0?k.pts-a[w-1].pts:I,he.stretchShortVideoTrack&&this.nextAudioTs!==null){const Ee=Math.floor(he.maxBufferHole*n),_e=(i?p+i*n:this.nextAudioTs+h)-k.pts;_e>Ee?(g=_e-le,g<0?g=le:O=true,this.log(`It is approximately ${_e/90} ms to the next segment; using duration ${g/90} ms for the last video frame.`)):g=le;}else g=le;}const Q=Math.round(k.pts-k.dts);N=Math.min(N,g),q=Math.max(q,g),U=Math.min(U,j),M=Math.max(M,j),o.push(Bi(k.key,g,Z,Q));}if(o.length){if(rt){if(rt<70){const w=o[0].flags;w.dependsOn=2,w.isNonSync=0;}}else if(fs&&M-U0&&(i&&Math.abs(T-(S+E))<9e3||Math.abs(pe(m[0].pts,T)-(S+E))<20*h),m.forEach(function(M){M.pts=pe(M.pts,T);}),!s||S<0){const M=m.length;if(m=m.filter(F=>F.pts>=0),M!==m.length&&this.warn(`Removed ${m.length-M} of ${M} samples (initPTS ${E} / ${a})`),!m.length)return;n===0?S=0:i&&!f?S=Math.max(0,T-E):S=m[0].pts-E;}if(e.segmentCodec==="aac"){const M=this.config.maxAudioFramesDrift;for(let F=0,V=S+E;F=M*h&&k0){v+=p;try{D=new Uint8Array(v);}catch(k){this.observer.emit(y.ERROR,y.ERROR,{type:G.MUX_ERROR,details:_.REMUX_ALLOC_ERROR,fatal:false,error:k,bytes:v,reason:`fail allocating audio mdat ${v}`});return}d||(new DataView(D.buffer).setUint32(0,v),D.set(x.types.mdat,4));}else return;D.set(H,p);const w=H.byteLength;p+=w,g.push(Bi(true,c,w,0)),I=Y;}const b=g.length;if(!b)return;const R=g[g.length-1];S=I-E,this.nextAudioTs=S+l*R.duration;const P=d?new Uint8Array(0):x.moof(e.sequenceNumber++,A/l,ie({},e,{samples:g}));e.samples=[];const O=(A-E)/a,N=this.nextAudioTs/a,q={data1:P,data2:D,startPTS:O,endPTS:N,startDTS:O,endDTS:N,type:"audio",hasAudio:true,hasVideo:false,nb:b};return this.isAudioContiguous=true,q}}function pe(r,e){let t;if(e===null)return r;for(e4294967296;)r+=t;return r}function el(r){for(let e=0;ea.pts-o.pts);const n=r.samples;return r.samples=[],{samples:n}}class tl extends be{constructor(e,t,s,i){super("passthrough-remuxer",i),this.emitInitSegment=false,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=false;}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e);}resetNextTimestamp(){this.isVideoContiguous=false,this.lastEndTime=null;}resetInitSegment(e,t,s,i){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(e,i),this.emitInitSegment=true;}generateInitSegment(e,t){let{audioCodec:s,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:n,video:a}=this.initData=dn(e);if(t)Gr(e,t);else {const l=n||a;l!=null&&l.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${l.codec}")!`);}n&&(s=Ui(n,fe.AUDIO,this)),a&&(i=Ui(a,fe.VIDEO,this));const o={};n&&a?o.audiovideo={container:"video/mp4",codec:s+","+i,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:n?o.audio={container:"audio/mp4",codec:s,encrypted:n.encrypted,initSegment:e,id:"audio"}:a?o.video={container:"video/mp4",codec:i,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o;}remux(e,t,s,i,n,a){var o,l;let{initPTS:c,lastEndTime:h}=this;const u={audio:void 0,video:void 0,text:i,id3:s,initSegment:void 0};B(h)||(h=this.lastEndTime=n||0);const d=t.samples;if(!d.length)return u;const g={initPTS:void 0,timescale:void 0,trackId:void 0};let f=this.initData;if((o=f)!=null&&o.length||(this.generateInitSegment(d),f=this.initData),!((l=f)!=null&&l.length))return this.warn("Failed to generate initSegment."),u;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=false);const m=Vr(d,f,this),p=f.audio?m[f.audio.id]:null,S=f.video?m[f.video.id]:null,E=Ct(S,1/0),T=Ct(p,1/0),A=Ct(S,0,true),I=Ct(p,0,true);let D=n,v=0;const L=p&&(!S||!c&&T0?this.lastEndTime=P:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const O=!!f.audio,N=!!f.video;let U="";O&&(U+="audio"),N&&(U+="video");const q=(f.audio?f.audio.encrypted:false)||(f.video?f.video.encrypted:false),M={data1:d,startPTS:R,startDTS:R,endPTS:P,endDTS:P,type:U,hasAudio:O,hasVideo:N,nb:1,dropped:0,encrypted:q};u.audio=O&&!N?M:void 0,u.video=N?M:void 0;const F=S?.sampleCount;if(F){const V=S.keyFrameIndex,H=V!==-1;M.nb=F,M.dropped=V===0||this.isVideoContiguous?0:H?V:F,M.independent=H,M.firstKeyFrame=V,H&&S.keyFrameStart&&(M.firstKeyFramePTS=(S.keyFrameStart-c.baseTime)/c.timescale),this.isVideoContiguous||(u.independent=H),this.isVideoContiguous||(this.isVideoContiguous=H),M.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${V}/${F} dropped: ${M.dropped} start: ${M.firstKeyFramePTS||"NA"}`);}return u.initSegment=g,u.id3=jn(s,n,c,c),i.samples.length&&(u.text=zn(i,n,c)),u}}function Ct(r,e,t=false){return r?.start!==void 0?(r.start+(t?r.duration:0))/r.timescale:e}function sl(r,e,t,s){if(r===null)return true;const i=Math.max(s,1),n=e-r.baseTime/r.timescale;return Math.abs(n-t)>i}function Ui(r,e,t){const s=r.codec;return s&&s.length>4?s:e===fe.AUDIO?s==="ec-3"||s==="ac-3"||s==="alac"?s:s==="fLaC"||s==="Opus"?Rs(s,false):(t.warn(`Unhandled audio codec "${s}" in mp4 MAP`),s||"mp4a"):(t.warn(`Unhandled video codec "${s}" in mp4 MAP`),s||"avc1")}let Ue;try{Ue=self.performance.now.bind(self.performance);}catch{Ue=Date.now;}const $t=[{demux:Go,remux:tl},{demux:Ye,remux:Ut},{demux:No,remux:Ut},{demux:Uo,remux:Ut}];$t.splice(2,0,{demux:Bo,remux:Ut});class $i{constructor(e,t,s,i,n,a){this.asyncResult=false,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=s,this.id=n,this.logger=a;}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset();}push(e,t,s,i){const n=s.transmuxing;n.executeStart=Ue();let a=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:l}=this;i&&(this.currentTransmuxState=i);const{contiguous:c,discontinuity:h,trackSwitch:u,accurateTimeOffset:d,timeOffset:g,initSegmentChange:f}=i||o,{audioCodec:m,videoCodec:p,defaultInitPts:S,duration:E,initSegmentData:T}=l,A=il(a,t);if(A&&Gs(A.method)){const L=this.getDecrypter(),b=Ks(A.method);if(L.isSync()){let R=L.softwareDecrypt(a,A.key.buffer,A.iv.buffer,b);if(s.part>-1){const O=L.flush();R=O&&O.buffer;}if(!R)return n.executeEnd=Ue(),gs(s);a=new Uint8Array(R);}else return this.asyncResult=true,this.decryptionPromise=L.webCryptoDecrypt(a,A.key.buffer,A.iv.buffer,b).then(R=>{const P=this.push(R,null,s);return this.decryptionPromise=null,P}),this.decryptionPromise}const I=this.needsProbing(h,u);if(I){const L=this.configureTransmuxer(a);if(L)return this.logger.warn(`[transmuxer] ${L.message}`),this.observer.emit(y.ERROR,y.ERROR,{type:G.MEDIA_ERROR,details:_.FRAG_PARSING_ERROR,fatal:false,error:L,reason:L.message}),n.executeEnd=Ue(),gs(s)}(h||u||f||I)&&this.resetInitSegment(T,m,p,E,t),(h||f||I)&&this.resetInitialTimestamp(S),c||this.resetContiguity();const D=this.transmux(a,A,g,d,s);this.asyncResult=Qt(D);const v=this.currentTransmuxState;return v.contiguous=true,v.discontinuity=false,v.trackSwitch=false,n.executeEnd=Ue(),D}flush(e){const t=e.transmuxing;t.executeStart=Ue();const{decrypter:s,currentTransmuxState:i,decryptionPromise:n}=this;if(n)return this.asyncResult=true,n.then(()=>this.flush(e));const a=[],{timeOffset:o}=i;if(s){const u=s.flush();u&&a.push(this.push(u.buffer,null,e));}const{demuxer:l,remuxer:c}=this;if(!l||!c){t.executeEnd=Ue();const u=[gs(e)];return this.asyncResult?Promise.resolve(u):u}const h=l.flush(o);return Qt(h)?(this.asyncResult=true,h.then(u=>(this.flushRemux(a,u,e),a))):(this.flushRemux(a,h,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,s){const{audioTrack:i,videoTrack:n,id3Track:a,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:c}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${s.sn}${s.part>-1?" part: "+s.part:""} of ${this.id===K.MAIN?"level":"track"} ${s.level}`);const h=this.remuxer.remux(i,n,a,o,c,l,true,this.id);e.push({remuxResult:h,chunkMeta:s}),s.transmuxing.executeEnd=Ue();}resetInitialTimestamp(e){const{demuxer:t,remuxer:s}=this;!t||!s||(t.resetTimeStamp(e),s.resetTimeStamp(e));}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp());}resetInitSegment(e,t,s,i,n){const{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,s,i),o.resetInitSegment(e,t,s,n));}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0);}transmux(e,t,s,i,n){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,s,i,n):a=this.transmuxUnencrypted(e,s,i,n),a}transmuxUnencrypted(e,t,s,i){const{audioTrack:n,videoTrack:a,id3Track:o,textTrack:l}=this.demuxer.demux(e,t,false,!this.config.progressive);return {remuxResult:this.remuxer.remux(n,a,o,l,t,s,false,this.id),chunkMeta:i}}transmuxSampleAes(e,t,s,i,n){return this.demuxer.demuxSampleAes(e,t,s).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,s,i,false,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:s,typeSupported:i}=this;let n;for(let u=0,d=$t.length;u0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const gs=r=>({remuxResult:{},chunkMeta:r});function Qt(r){return "then"in r&&r.then instanceof Function}class nl{constructor(e,t,s,i,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=s,this.duration=i,this.defaultInitPts=n||null;}}class rl{constructor(e,t,s,i,n,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=s,this.trackSwitch=i,this.timeOffset=n,this.initSegmentChange=a;}}let Gi=0;class al{constructor(e,t,s,i){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Gi++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=l=>{const c=l.data,h=this.hls;if(!(!h||!(c!=null&&c.event)||c.instanceNo!==this.instanceNo))switch(c.event){case "init":{var u;const d=(u=this.workerContext)==null?void 0:u.objectURL;d&&self.URL.revokeObjectURL(d);break}case "transmuxComplete":{this.handleTransmuxComplete(c.data);break}case "flush":{this.onFlush(c.data);break}case "workerLog":{h.logger[c.data.logType]&&h.logger[c.data.logType](c.data.message);break}default:{c.data=c.data||{},c.data.frag=this.frag,c.data.part=this.part,c.data.id=this.id,h.trigger(c.event,c.data);break}}},this.onWorkerError=l=>{if(!this.hls)return;const c=new Error(`${l.message} (${l.filename}:${l.lineno})`);this.hls.config.enableWorker=false,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(y.ERROR,{type:G.OTHER_ERROR,details:_.INTERNAL_EXCEPTION,fatal:false,event:"demuxerWorker",error:c});};const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=s,this.onFlush=i;const a=(l,c)=>{c=c||{},c.frag=this.frag||void 0,l===y.ERROR&&(c=c,c.parent=this.id,c.part=this.part,this.error=c.error),this.hls.trigger(l,c);};this.observer=new wn,this.observer.on(y.FRAG_DECRYPTED,a),this.observer.on(y.ERROR,a);const o=gi(n.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const l=this.hls.logger;if(n.workerPath||ao()){try{n.workerPath?(l.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=lo(n.workerPath)):(l.log(`injecting Web Worker for "${t}"`),this.workerContext=oo());const{worker:h}=this.workerContext;h.addEventListener("message",this.onWorkerMessage),h.addEventListener("error",this.onWorkerError),h.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:se(n)});}catch(h){l.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.terminateWorker(),this.error=null,this.transmuxer=new $i(this.observer,o,n,"",t,e.logger);}return}}this.transmuxer=new $i(this.observer,o,n,"",t,e.logger);}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Gi++;const t=this.hls.config,s=gi(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:s,id:this.id,config:se(t)});}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),co(this.hls.config.workerPath);}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else {const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null);}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null;}push(e,t,s,i,n,a,o,l,c,h){var u,d;c.transmuxing.start=self.performance.now();const{instanceNo:g,transmuxer:f}=this,m=a?a.start:n.start,p=n.decryptdata,S=this.frag,E=!(S&&n.cc===S.cc),T=!(S&&c.level===S.level),A=S?c.sn-S.sn:-1,I=this.part?c.part-this.part.index:-1,D=A===0&&c.id>1&&c.id===S?.stats.chunkCount,v=!T&&(A===1||A===0&&(I===1||D&&I<=0)),L=self.performance.now();(T||A||n.stats.parsing.start===0)&&(n.stats.parsing.start=L),a&&(I||!v)&&(a.stats.parsing.start=L);const b=!(S&&((u=n.initSegment)==null?void 0:u.url)===((d=S.initSegment)==null?void 0:d.url)),R=new rl(E,v,l,T,m,b);if(!v||E||b){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${n.type} sn: ${c.sn}${c.part>-1?" part: "+c.part:""} ${this.id===K.MAIN?"level":"track"}: ${c.level} id: ${c.id} + discontinuity: ${E} + trackSwitch: ${T} + contiguous: ${v} + accurateTimeOffset: ${l} + timeOffset: ${m} + initSegmentChange: ${b}`);const P=new nl(s,i,t,o,h);this.configureTransmuxer(P);}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:g,cmd:"demux",data:e,decryptdata:p,chunkMeta:c,state:R},e instanceof ArrayBuffer?[e]:[]);else if(f){const P=f.push(e,p,c,R);Qt(P)?P.then(O=>{this.handleTransmuxComplete(O);}).catch(O=>{this.transmuxerError(O,c,"transmuxer-interface push error");}):this.handleTransmuxComplete(P);}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:s}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(s){const i=s.flush(e);Qt(i)?i.then(n=>{this.handleFlushResult(n,e);}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error");}):this.handleFlushResult(i,e);}}transmuxerError(e,t,s){this.hls&&(this.error=e,this.hls.trigger(y.ERROR,{type:G.MEDIA_ERROR,details:_.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:false,error:e,err:e,reason:s}));}handleFlushResult(e,t){e.forEach(s=>{this.handleTransmuxComplete(s);}),this.onFlush(t);}configureTransmuxer(e){const{instanceNo:t,transmuxer:s}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):s&&s.configure(e);}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e);}}const Ki=100;class ol extends kn{constructor(e,t,s){super(e,t,s,"audio-stream-controller",K.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=false,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=false,this.bufferFlushed=false,this.cachedTrackLoadedData=null,this.registerListeners();}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem();}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null;}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(y.LEVEL_LOADED,this.onLevelLoaded,this),e.on(y.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(y.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(y.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(y.BUFFER_RESET,this.onBufferReset,this),e.on(y.BUFFER_CREATED,this.onBufferCreated,this),e.on(y.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(y.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(y.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(y.FRAG_LOADING,this.onFragLoading,this),e.on(y.FRAG_BUFFERED,this.onFragBuffered,this);}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(y.LEVEL_LOADED,this.onLevelLoaded,this),e.off(y.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(y.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(y.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(y.BUFFER_RESET,this.onBufferReset,this),e.off(y.BUFFER_CREATED,this.onBufferCreated,this),e.off(y.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(y.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(y.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(y.FRAG_LOADING,this.onFragLoading,this),e.off(y.FRAG_BUFFERED,this.onFragBuffered,this));}onInitPtsFound(e,{frag:t,id:s,initPTS:i,timescale:n,trackId:a}){if(s===K.MAIN){const o=t.cc,l=this.fragCurrent;if(this.initPTS[o]={baseTime:i,timescale:n,trackId:a},this.log(`InitPTS for cc: ${o} found from main: ${i/n} (${i}/${n}) trackId: ${a}`),this.mainAnchor=t,this.state===C.WAITING_INIT_PTS){const c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==o)&&this.syncWithAnchor(t,c?.frag);}else !this.hls.hasEnoughToStart&&l&&l.cc!==o?(l.abortRequests(),this.syncWithAnchor(t,l)):this.state===C.IDLE&&this.tick();}}getLoadPosition(){return !this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var s;const i=((s=this.mainFragLoading)==null?void 0:s.frag)||null;if(t&&i?.cc===t.cc)return;const n=(i||e).cc,a=this.getLevelDetails(),o=this.getLoadPosition(),l=xn(a,n,o);l&&(this.log(`Syncing with main frag at ${l.start} cc ${l.cc}`),this.startFragRequested=false,this.nextLoadPosition=l.start,this.resetLoadingState(),this.state===C.IDLE&&this.doTickIdle());}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=C.STOPPED;return}const s=this.lastCurrentTime;this.stopLoad(),this.setInterval(Ki),s>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s,this.state=C.IDLE):this.state=C.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick();}doTick(){switch(this.state){case C.IDLE:this.doTickIdle();break;case C.WAITING_TRACK:{const{levels:e,trackId:t}=this,s=e?.[t],i=s?.details;if(i&&!this.waitForLive(s)){if(this.waitForCdnTuneIn(i))break;this.state=C.WAITING_INIT_PTS;}break}case C.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case C.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:s,cache:i,complete:n}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=C.FRAG_LOADING;const o=i.flush().buffer,l={frag:t,part:s,payload:o,networkDetails:null};this._handleFragmentLoadProgress(l),n&&super._handleFragmentLoadComplete(l);}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag);}else this.state=C.IDLE;}}this.onTickEnd();}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState();}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime);}doTickIdle(){var e;const{hls:t,levels:s,media:i,trackId:n}=this,a=t.config;if(!this.buffering||!i&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(s!=null&&s[n]))return;const o=s[n],l=o.details;if(!l||this.waitForLive(o)||this.waitForCdnTuneIn(l)){this.state=C.WAITING_TRACK,this.startFragRequested=false;return}const c=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&c&&(this.bufferFlushed=false,this.afterBufferFlushed(c,fe.AUDIO,K.AUDIO));const h=this.getFwdBufferInfo(c,K.AUDIO);if(h===null)return;if(!this.switchingTrack&&this._streamEnded(h,l)){t.trigger(y.BUFFER_EOS,{type:"audio"}),this.state=C.ENDED;return}const u=h.len,d=t.maxBufferLength,g=l.fragments,f=g[0].start,m=this.getLoadPosition(),p=this.flushing?m:h.end;if(this.switchingTrack&&i){const T=m;l.PTSKnown&&Tf||h.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=f+.05);}if(u>=d&&!this.switchingTrack&&pE.end){const A=this.fragmentTracker.getFragAtPos(p,K.MAIN);A&&A.end>E.end&&(E=A,this.mainFragLoading={frag:A,targetBufferTime:null});}if(S.start>E.end)return}this.loadFragment(S,o,p);}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=false,super.onMediaDetaching(e,t);}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(s=>new Vt(s));}onAudioTrackSwitching(e,t){const s=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),s?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==C.STOPPED&&(this.setInterval(Ki),this.state=C.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval());}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=false,this.resetItem(),this.trackId=-1;}onLevelLoaded(e,t){this.mainDetails=t.details;const s=this.cachedTrackLoadedData;s&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(y.AUDIO_TRACK_LOADED,s));}onAudioTrackLoaded(e,t){var s;const{levels:i}=this,{details:n,id:a,groupId:o,track:l}=t;if(!i){this.warn(`Audio tracks reset while loading track ${a} "${l.name}" of "${o}"`);return}const c=this.mainDetails;if(!c||n.endCC>c.endCC||c.expired){this.cachedTrackLoadedData=t,this.state!==C.STOPPED&&(this.state=C.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${l.name}" of "${o}" loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const h=i[a];let u=0;if(n.live||(s=h.details)!=null&&s.live){if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;if(h.details){var d;u=this.alignPlaylists(n,h.details,(d=this.levelLastLoaded)==null?void 0:d.details);}n.alignedSliding||(Cn(n,c),n.alignedSliding||qt(n,c),u=n.fragmentStart);}h.details=n,this.levelLastLoaded=h,this.startFragRequested||this.setStartPosition(c,u),this.hls.trigger(y.AUDIO_TRACK_UPDATED,{details:n,id:a,groupId:t.groupId}),this.state===C.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=C.IDLE),this.tick();}_handleFragmentLoadProgress(e){var t;const s=e.frag,{part:i,payload:n}=e,{config:a,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const c=l[o];if(!c){this.warn("Audio track is undefined on fragment load progress");return}const h=c.details;if(!h){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const u=a.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let d=this.transmuxer;d||(d=this.transmuxer=new al(this.hls,K.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const g=this.initPTS[s.cc],f=(t=s.initSegment)==null?void 0:t.data;if(g!==void 0){const p=i?i.index:-1,S=p!==-1,E=new In(s.level,s.sn,s.stats.chunkCount,n.byteLength,p,S);d.push(n,f,u,"",s,i,h.totalduration,false,E,g);}else {this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${h.startSN} ,${h.endSN}],track ${o}`);const{cache:m}=this.waitingData=this.waitingData||{frag:s,part:i,cache:new so,complete:false};m.push(new Uint8Array(n)),this.state!==C.STOPPED&&(this.state=C.WAITING_INIT_PTS);}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=true;return}super._handleFragmentLoadComplete(e);}onBufferReset(){this.mediaBuffer=null;}onBufferCreated(e,t){this.bufferFlushed=this.flushing=false;const s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null);}onFragLoading(e,t){!this.audioOnly&&t.frag.type===K.MAIN&&ye(t.frag)&&(this.mainFragLoading=t,this.state===C.IDLE&&this.tick());}onFragBuffered(e,t){const{frag:s,part:i}=t;if(s.type!==K.AUDIO){!this.audioOnly&&s.type===K.MAIN&&!s.elementaryStreams.video&&!s.elementaryStreams.audiovideo&&(this.audioOnly=true,this.mainFragLoading=null);return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${i?" p: "+i.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(ye(s)){this.fragPrevious=s;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(y.AUDIO_TRACK_SWITCHED,ee({},n)));}this.fragBufferedComplete(s,i),this.media&&this.tick();}onError(e,t){var s;if(t.fatal){this.state=C.ERROR;return}switch(t.details){case _.FRAG_GAP:case _.FRAG_PARSING_ERROR:case _.FRAG_DECRYPT_ERROR:case _.FRAG_LOAD_ERROR:case _.FRAG_LOAD_TIMEOUT:case _.KEY_LOAD_ERROR:case _.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(K.AUDIO,t);break;case _.AUDIO_TRACK_LOAD_ERROR:case _.AUDIO_TRACK_LOAD_TIMEOUT:case _.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===C.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===$e.AUDIO_TRACK&&(this.state=C.IDLE);break;case _.BUFFER_ADD_CODEC_ERROR:case _.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case _.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case _.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==fe.VIDEO&&(this.flushing=true);}onBufferFlushed(e,{type:t}){if(t!==fe.VIDEO){this.flushing=false,this.bufferFlushed=true,this.state===C.ENDED&&(this.state=C.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,t,K.AUDIO),this.tick());}}_handleTransmuxComplete(e){var t;const s="audio",{hls:i}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:c,level:h}=o,{details:u}=h,{audio:d,text:g,id3:f,initSegment:m}=n;if(this.fragContextChanged(l)||!u){this.fragmentTracker.removeFragment(l);return}if(this.state=C.PARSING,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),m!=null&&m.tracks){const p=l.initSegment||l;if(this.unhandledEncryptionError(m,l))return;this._bufferInitSegment(h,m.tracks,p,a),i.trigger(y.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:s,tracks:m.tracks});}if(d){const{startPTS:p,endPTS:S,startDTS:E,endDTS:T}=d;c&&(c.elementaryStreams[fe.AUDIO]={startPTS:p,endPTS:S,startDTS:E,endDTS:T}),l.setElementaryStreamInfo(fe.AUDIO,p,S,E,T),this.bufferFragmentData(d,l,c,a);}if(f!=null&&(t=f.samples)!=null&&t.length){const p=ie({id:s,frag:l,details:u},f);i.trigger(y.FRAG_PARSING_METADATA,p);}if(g){const p=ie({id:s,frag:l,details:u},g);i.trigger(y.FRAG_PARSING_USERDATA,p);}}_bufferInitSegment(e,t,s,i){if(this.state!==C.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const n=t.audio;n.id=K.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${a}/${n.codec}]`),a&&a.split(",").length===1&&(n.levelCodec=a),this.hls.trigger(y.BUFFER_CODECS,t);const o=n.initSegment;if(o!=null&&o.byteLength){const l={type:"audio",frag:s,part:null,chunkMeta:i,parent:s.type,data:o};this.hls.trigger(y.BUFFER_APPENDING,l);}this.tickImmediate();}loadFragment(e,t,s){const i=this.fragmentTracker.getState(e);if(this.switchingTrack||i===ve.NOT_LOADED||i===ve.PARTIAL){var n;if(!ye(e))this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=C.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&qt(t.details,a);}else super.loadFragment(e,t,s);}else this.clearTrackerIfNeeded(e);}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:s,assocLang:i,characteristics:n,audioCodec:a,channels:o}=this.bufferedTrack;tt({name:t,lang:s,assocLang:i,characteristics:n,audioCodec:a,channels:o},e,et)||(En(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e);}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(y.AUDIO_TRACK_SWITCHED,ee({},e));}}class Qn extends be{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=false,this.timer=-1,this.hls=e;}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null;}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1);}startLoad(){this.canLoad=true,this.loadPlaylist();}stopLoad(){this.canLoad=false,this.clearTimer();}switchParams(e,t,s){const i=t?.renditionReports;if(i){let n=-1;for(let a=0;a=0&&h>t.partTarget&&(l+=1);}const c=s&&pi(s);return new yi(o,l>=0?l:void 0,c)}}}loadPlaylist(e){this.clearTimer();}loadingPlaylist(e,t){this.clearTimer();}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`);}return e}playlistLoaded(e,t,s){const{details:i,stats:n}=t,a=self.performance.now(),o=n.loading.first?Math.max(0,a-n.loading.first):0;i.advancedDateTime=Date.now()-o;const l=this.hls.config.timelineOffset;if(l!==i.appliedTimelineOffset){const h=Math.max(l||0,0);i.appliedTimelineOffset=h,i.fragments.forEach(u=>{u.setStart(u.playlistOffset+h);});}if(i.live||s!=null&&s.live){const h="levelInfo"in t?t.levelInfo:t.track;if(i.reloaded(s),s&&i.fragments.length>0){Wa(s,i,this);const E=i.playlistParsingError;if(E){this.warn(E);const T=this.hls;if(!T.config.ignorePlaylistParsingErrors){var c;const{networkDetails:A}=t;T.trigger(y.ERROR,{type:G.NETWORK_ERROR,details:_.LEVEL_PARSING_ERROR,fatal:false,url:i.url,error:E,reason:E.message,level:t.level||void 0,parent:(c=i.fragments[0])==null?void 0:c.type,networkDetails:A,stats:n});return}i.playlistParsingError=null;}}i.requestScheduled===-1&&(i.requestScheduled=n.loading.start);const u=this.hls.mainForwardBufferInfo,d=u?u.end-u.len:0,g=(i.edge-d)*1e3,f=Qa(i,g);if(i.requestScheduled+f0){if(b>i.targetduration*3)this.log(`Playlist last advanced ${L.toFixed(2)}s ago. Omitting segment and part directives.`),p=void 0,S=void 0;else if(s!=null&&s.tuneInGoal&&b-i.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${R} with playlist age: ${i.age}`),R=0;else {const P=Math.floor(R/i.targetduration);if(p+=P,S!==void 0){const O=Math.round(R%i.targetduration/i.partTarget);S+=O;}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${L.toFixed(2)}s goal: ${R} skip sn ${P} to part ${S}`);}i.tuneInGoal=R;}if(m=this.getDeliveryDirectives(i,t.deliveryDirectives,p,S),E||!v){i.requestScheduled=a,this.loadingPlaylist(h,m);return}}else (i.canBlockReload||i.canSkipUntil)&&(m=this.getDeliveryDirectives(i,t.deliveryDirectives,p,S));m&&p!==void 0&&i.canBlockReload&&(i.requestScheduled=n.loading.first+Math.max(f-o*2,f/2)),this.scheduleLoading(h,m,i);}else this.clearTimer();}scheduleLoading(e,t,s){const i=s||e.details;if(!i){this.loadingPlaylist(e,t);return}const n=self.performance.now(),a=i.requestScheduled;if(n>=a){this.loadingPlaylist(e,t);return}const o=a-n;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o);}getDeliveryDirectives(e,t,s,i){let n=pi(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,i=t.part,n=Bt.No),new yi(s,i,n)}checkRetry(e){const t=e.details,s=Ht(e),i=e.errorAction,{action:n,retryCount:a=0,retryConfig:o}=i||{},l=!!i&&!!o&&(n===ce.RetryRequest||!i.resolved&&n===ce.SendAlternateToPenaltyBox);if(l){var c;if(a>=o.maxNumRetry)return false;if(s&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else {const h=Us(o,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),h),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${h}ms`);}e.levelRetry=true,i.resolved=true;}return l}}function Xn(r,e){if(r.length!==e.length)return false;for(let t=0;tr[i]!==e[i])}function Cs(r,e){return e.label.toLowerCase()===r.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(r.lang||"").toLowerCase())}class ll extends Qn{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=true,this.registerListeners();}registerListeners(){const{hls:e}=this;e.on(y.MANIFEST_LOADING,this.onManifestLoading,this),e.on(y.MANIFEST_PARSED,this.onManifestParsed,this),e.on(y.LEVEL_LOADING,this.onLevelLoading,this),e.on(y.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(y.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(y.ERROR,this.onError,this);}unregisterListeners(){const{hls:e}=this;e.off(y.MANIFEST_LOADING,this.onManifestLoading,this),e.off(y.MANIFEST_PARSED,this.onManifestParsed,this),e.off(y.LEVEL_LOADING,this.onLevelLoading,this),e.off(y.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(y.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(y.ERROR,this.onError,this);}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy();}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=true;}onManifestParsed(e,t){this.tracks=t.audioTracks||[];}onAudioTrackLoaded(e,t){const{id:s,groupId:i,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==i){this.warn(`Audio track with id:${s} and group:${i} not found in active group ${a?.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Audio track ${s} "${a.name}" lang:${a.lang} group:${i} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o);}onLevelLoading(e,t){this.switchLevel(t.level);}onLevelSwitching(e,t){this.switchLevel(t.level);}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.audioGroups||null,i=this.groupIds;let n=this.currentTrack;if(!s||i?.length!==s?.length||s!=null&&s.some(o=>i?.indexOf(o)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(d=>!s||s.indexOf(d.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(d=>d.default)&&(this.selectDefaultTrack=false),o.forEach((d,g)=>{d.id=g;});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!n&&l){const d=Oe(l,o,et);if(d>-1)n=o[d];else {const g=Oe(l,this.tracks);n=this.tracks[g];}}let c=this.findTrackId(n);c===-1&&n&&(c=this.findTrackId(null));const h={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${s?.join(",")}`),this.hls.trigger(y.AUDIO_TRACKS_UPDATED,h);const u=this.trackId;if(c!==-1&&u===-1)this.setAudioTrack(c);else if(o.length&&u===-1){var a;const d=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${o.length}`);this.warn(d.message),this.hls.trigger(y.ERROR,{type:G.MEDIA_ERROR,details:_.AUDIO_TRACK_LOAD_ERROR,fatal:true,error:d});}}}onError(e,t){t.fatal||!t.context||t.context.type===$e.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t);}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=false,this.setAudioTrack(e);}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const s=this.allAudioTracks;if(this.selectDefaultTrack=false,s.length){const i=this.currentTrack;if(i&&tt(e,i,et))return i;const n=Oe(e,this.tracksInGroup,et);if(n>-1){const a=this.tracksInGroup[n];return this.setAudioTrack(n),a}else if(i){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const o=pa(e,t.levels,s,a,et);if(o===-1)return null;t.nextLoadLevel=o;}if(e.channels||e.audioCodec){const a=Oe(e,s);if(a>-1)return s[a]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=false;const s=this.currentTrack,i=t[e],n=i.details&&!i.details.live;if(e===this.trackId&&i===s&&n||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(y.AUDIO_TRACK_SWITCHING,ee({},i)),n))return;const a=this.switchParams(i.url,s?.details,i.details);this.loadPlaylist(a);}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s{const s={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(s,e);})}prependBlocker(e){return new Promise(t=>{if(this.queues){const s={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(s);}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const s=(t=e[0])==null?void 0:t.label;(s==="async-blocker"||s==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1));});}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio");}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const i=t[0];try{i.execute();}catch(n){var s;if(i.onError(n),this.queues===null||this.tracks===null)return;const a=(s=this.tracks[e])==null?void 0:s.buffer;a!=null&&a.updating||this.shiftAndExecuteNext(e);}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e));}current(e){var t;return ((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"":` +${this.list("video")} +${this.list("audio")} +${this.list("audiovideo")}}`}list(e){var t,s;return (t=this.queues)!=null&&t[e]||(s=this.tracks)!=null&&s[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const s=(t=this.tracks)==null?void 0:t[e],i=s?.buffer;return i?`SourceBuffer${i.updating?" updating":""}${s.ended?" ended":""}${s.ending?" ending":""}`:"none"}listOps(e){var t;return ((t=this.queues)==null?void 0:t[e].map(s=>s.label).join(", "))||""}}const Vi=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,Zn="HlsJsTrackRemovedError";class hl extends Error{constructor(e){super(e),this.name=Zn;}}class ul extends be{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=s=>{var i;this.hls&&((i=this.mediaSource)==null?void 0:i.readyState)==="open"&&this.hls.pauseBuffering();},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering();},this._onMediaSourceOpen=s=>{const{media:i,mediaSource:n}=this;s&&this.log("Media source opened"),!(!i||!n)&&(n.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(y.MEDIA_ATTACHED,{media:i,mediaSource:n}),this.mediaSource!==null&&this.checkPendingTracks());},this._onMediaSourceClose=()=>{this.log("Media source closed");},this._onMediaSourceEnded=()=>{this.log("Media source ended");},this._onMediaEmptied=()=>{const{mediaSrc:s,_objectUrl:i}=this;s!==i&&this.error(`Media element src was set while attaching MediaSource (${i} > ${s})`);},this.hls=e,this.fragmentTracker=t,this.appendSource=kr(Tt(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners();}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null;}registerListeners(){const{hls:e}=this;e.on(y.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(y.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(y.MANIFEST_LOADING,this.onManifestLoading,this),e.on(y.MANIFEST_PARSED,this.onManifestParsed,this),e.on(y.BUFFER_RESET,this.onBufferReset,this),e.on(y.BUFFER_APPENDING,this.onBufferAppending,this),e.on(y.BUFFER_CODECS,this.onBufferCodecs,this),e.on(y.BUFFER_EOS,this.onBufferEos,this),e.on(y.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(y.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(y.FRAG_PARSED,this.onFragParsed,this),e.on(y.FRAG_CHANGED,this.onFragChanged,this),e.on(y.ERROR,this.onError,this);}unregisterListeners(){const{hls:e}=this;e.off(y.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(y.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(y.MANIFEST_LOADING,this.onManifestLoading,this),e.off(y.MANIFEST_PARSED,this.onManifestParsed,this),e.off(y.BUFFER_RESET,this.onBufferReset,this),e.off(y.BUFFER_APPENDING,this.onBufferAppending,this),e.off(y.BUFFER_CODECS,this.onBufferCodecs,this),e.off(y.BUFFER_EOS,this.onBufferEos,this),e.off(y.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(y.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(y.FRAG_PARSED,this.onFragParsed,this),e.off(y.FRAG_CHANGED,this.onFragChanged,this),e.off(y.ERROR,this.onError,this);}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const s={};if(this.operationQueue){const n=this.isUpdating();n||this.operationQueue.removeBlockers();const a=this.isQueued();(n||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${n?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy();}const i=this.transferData;return !this.sourceBufferCount&&i&&i.mediaSource===t?ie(s,i.tracks):this.sourceBuffers.forEach(n=>{const[a]=n;a&&(s[a]=ie({},this.tracks[a]),this.removeBuffer(a)),n[0]=n[1]=null;}),{media:e,mediaSource:t,tracks:s}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0;}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null;}onManifestParsed(e,t){var s;let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(`${i} bufferCodec event(s) expected.`),(s=this.transferData)!=null&&s.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated();}onMediaAttaching(e,t){const s=this.media=t.media;this.transferData=this.overrides=void 0;const i=Tt(this.appendSource);if(i){const n=!!t.mediaSource;(n||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const a=this.mediaSource=t.mediaSource||new i;if(this.assignMediaSource(a),n)this._objectUrl=s.src,this.attachTransferred();else {const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{s.removeAttribute("src");const l=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||l&&a instanceof l,Hi(s),dl(s,o),s.load();}catch{s.src=o;}else s.src=o;}s.addEventListener("emptied",this._onMediaEmptied);}}assignMediaSource(e){var t,s;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(s=e.constructor)==null?void 0:s.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming));}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const s=this.tracks,i=t.tracks,n=i?Object.keys(i):null,a=n?n.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen();});};if(i&&n&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=true,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal}) +required tracks: ${se(s,(l,c)=>l==="initSegment"?void 0:c)}; +transfer tracks: ${se(i,(l,c)=>l==="initSegment"?void 0:c)}}`),!ln(i,s)){t.mediaSource=null,t.tracks=void 0;const l=e.currentTime,c=this.details,h=Math.max(l,c?.fragments[0].start||0);if(h-l>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${l} -> ${h}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(i)}"->"${Object.keys(s)}") start time: ${h} currentTime: ${l}`),this.onMediaDetaching(y.MEDIA_DETACHING,{}),this.onMediaAttaching(y.MEDIA_ATTACHING,t),e.currentTime=h;return}this.transferData=void 0,n.forEach(l=>{const c=l,h=i[c];if(h){const u=h.buffer;if(u){const d=this.fragmentTracker,g=h.id;if(d.hasFragments(g)||d.hasParts(g)){const p=J.getBuffered(u);d.detectEvictedFragments(c,p,g,null,true);}const f=ms(c),m=[c,u];this.sourceBuffers[f]=m,u.updating&&this.operationQueue&&this.operationQueue.prependBlocker(c),this.trackSourceBuffer(c,h);}}}),o(),this.bufferCreated();}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o();}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const s=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:i,mediaSource:n,_objectUrl:a}=this;if(n){if(this.log(`media source ${s?"transferring":"detaching"}`),s)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o);}),this.resetQueue();else {if(this.mediaSourceOpenOrEnded){const o=n.readyState==="open";try{const l=n.sourceBuffers;for(let c=l.length;c--;)o&&l[c].abort(),n.removeSourceBuffer(l[c]);o&&n.endOfStream();}catch(l){this.warn(`onMediaDetaching: ${l.message} while calling endOfStream`);}}this.sourceBufferCount&&this.onBufferReset();}n.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("sourceended",this._onMediaSourceEnded),n.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(n.removeEventListener("startstreaming",this._onStartStreaming),n.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null;}i&&(i.removeEventListener("emptied",this._onMediaEmptied),s||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(i.removeAttribute("src"),this.appendSource&&Hi(i),i.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(y.MEDIA_DETACHED,t);}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e);}),this.initTracks();}resetBuffer(e){var t;const s=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),s)try{var i;(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(s);}catch(n){this.warn(`onBufferReset ${e}`,n);}delete this.tracks[e];}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[ms(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0);}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new cl(this.tracks);}onBufferCodecs(e,t){var s;const i=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const a="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),o=!a&&this.sourceBufferCount&&this.media&&n.some(l=>!i[l]);if(a||o){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${n}" SourceBuffers`);return}n.forEach(l=>{var c,h;const u=t[l],{id:d,codec:g,levelCodec:f,container:m,metadata:p,supplemental:S}=u;let E=i[l];const T=(c=this.transferData)==null||(c=c.tracks)==null?void 0:c[l],A=T!=null&&T.buffer?T:E,I=A?.pendingCodec||A?.codec,D=A?.levelCodec;E||(E=i[l]={buffer:void 0,listeners:[],codec:g,supplemental:S,container:m,levelCodec:f,metadata:p,id:d});const v=as(I,D),L=v?.replace(Vi,"$1");let b=as(g,f);const R=(h=b)==null?void 0:h.replace(Vi,"$1");b&&v&&L!==R&&(l.slice(0,5)==="audio"&&(b=Rs(b,this.appendSource)),this.log(`switching codec ${I} to ${b}`),b!==(E.pendingCodec||E.codec)&&(E.pendingCodec=b),E.container=m,this.appendChangeType(l,m,b));}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((s=t.audio)==null?void 0:s.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks());}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const s=this.tracks[t];return e[t]={id:s.id,container:s.container,codec:s.codec,levelCodec:s.levelCodec},e},{})}appendChangeType(e,t,s){const i=`${t};codecs=${s}`,n={label:`change-type=${i}`,execute:()=>{const a=this.tracks[e];if(a){const o=a.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${i}`),o.changeType(i),a.codec=s,a.container=t);}this.shiftAndExecuteNext(e);},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a);}};this.append(n,e,this.isPending(this.tracks[e]));}blockAudio(e){var t;const s=e.start,i=s+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(s,K.MAIN))==null?void 0:t.gap)===true)return;const a={label:"block-audio",execute:()=>{var o;const l=this.tracks.video;(this.lastVideoAppendEnd>i||l!=null&&l.buffer&&J.isBuffered(l.buffer,i)||((o=this.fragmentTracker.getAppendedFrag(i,K.MAIN))==null?void 0:o.gap)===true)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"));},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o);}};this.blockedAudioAppend={op:a,frag:e},this.append(a,"audio",true);}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op));}onBufferAppending(e,t){const{tracks:s}=this,{data:i,type:n,parent:a,frag:o,part:l,chunkMeta:c,offset:h}=t,u=c.buffering[n],{sn:d,cc:g}=o,f=self.performance.now();u.start=f;const m=o.stats.buffering,p=l?l.stats.buffering:null;m.start===0&&(m.start=f),p&&p.start===0&&(p.start=f);const S=s.audio;let E=false;n==="audio"&&S?.container==="audio/mpeg"&&(E=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const T=s.video,A=T?.buffer;if(A&&d!=="initSegment"){const v=l||o,L=this.blockedAudioAppend;if(n==="audio"&&a!=="main"&&!this.blockedAudioAppend&&!(T.ending||T.ended)){const R=v.start+v.duration*.05,P=A.buffered,O=this.currentOp("video");!P.length&&!O?this.blockAudio(v):!O&&!J.isBuffered(A,R)&&this.lastVideoAppendEndR||b{var v;u.executeStart=self.performance.now();const L=(v=this.tracks[n])==null?void 0:v.buffer;L&&(E?this.updateTimestampOffset(L,I,.1,n,d,g):h!==void 0&&B(h)&&this.updateTimestampOffset(L,h,1e-6,n,d,g)),this.appendExecutor(i,n);},onStart:()=>{},onComplete:()=>{const v=self.performance.now();u.executeEnd=u.end=v,m.first===0&&(m.first=v),p&&p.first===0&&(p.first=v);const L={};this.sourceBuffers.forEach(([b,R])=>{b&&(L[b]=J.getBuffered(R));}),this.appendErrors[n]=0,n==="audio"||n==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(y.BUFFER_APPENDED,{type:n,frag:o,part:l,chunkMeta:c,parent:o.type,timeRanges:L});},onError:v=>{var L;const b={type:G.MEDIA_ERROR,parent:o.type,details:_.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:o,part:l,chunkMeta:c,error:v,err:v,fatal:false},R=(L=this.media)==null?void 0:L.error;if(v.code===DOMException.QUOTA_EXCEEDED_ERR||v.name=="QuotaExceededError"||"quota"in v)b.details=_.BUFFER_FULL_ERROR;else if(v.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!R)b.errorAction=ot(true);else if(v.name===Zn&&this.sourceBufferCount===0)b.errorAction=ot(true);else {const P=++this.appendErrors[n];this.warn(`Failed ${P}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${n}" sourceBuffer (${R||"no media error"})`),(P>=this.hls.config.appendErrorMaxRetry||R)&&(b.fatal=true);}this.hls.trigger(y.ERROR,b);}};this.log(`queuing "${n}" append sn: ${d}${l?" p: "+l.index:""} of ${o.type===K.MAIN?"level":"track"} ${o.level} cc: ${g}`),this.append(D,n,this.isPending(this.tracks[n]));}getFlushOp(e,t,s){return this.log(`queuing "${e}" remove ${t}-${s}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,s);},onStart:()=>{},onComplete:()=>{this.hls.trigger(y.BUFFER_FLUSHED,{type:e});},onError:i=>{this.warn(`Failed to remove ${t}-${s} from "${e}" SourceBuffer`,i);}}}onBufferFlushing(e,t){const{type:s,startOffset:i,endOffset:n}=t;s?this.append(this.getFlushOp(s,i,n),s):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,i,n),a);});}onFragParsed(e,t){const{frag:s,part:i}=t,n=[],a=i?i.elementaryStreams:s.elementaryStreams;a[fe.AUDIOVIDEO]?n.push("audiovideo"):(a[fe.AUDIO]&&n.push("audio"),a[fe.VIDEO]&&n.push("video"));const o=()=>{const l=self.performance.now();s.stats.buffering.end=l,i&&(i.stats.buffering.end=l);const c=i?i.stats:s.stats;this.hls.trigger(y.FRAG_BUFFERED,{frag:s,part:i,stats:c,id:s.type});};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(o,n).catch(l=>{this.warn(`Fragment buffered callback ${l}`),this.stepOperationQueue(this.sourceBufferTypes);});}onFragChanged(e,t){this.trimBuffers();}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return !t.ended||t.ending}return false})}onBufferEos(e,t){var s;this.sourceBuffers.forEach(([a])=>{if(a){const o=this.tracks[a];(!t.type||t.type===a)&&(o.ending=true,o.ended||(o.ended=true,this.log(`${a} buffer reached EOS`)));}});const i=((s=this.overrides)==null?void 0:s.endOfStream)!==false;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var o;return a&&!((o=this.tracks[a])!=null&&o.ended)})?i?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if(!a||a.readyState!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger(y.BUFFERED_TO_END,void 0);})):(this.tracksEnded(),this.hls.trigger(y.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio();}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=false);}});}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration());}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e);});}onError(e,t){if(t.details===_.BUFFER_APPEND_ERROR&&t.frag){var s;const i=(s=t.errorAction)==null?void 0:s.nextAutoLevel;B(i)&&i!==t.frag.level&&this.resetAppendErrors();}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0};}trimBuffers(){const{hls:e,details:t,media:s}=this;if(!s||t===null||!this.sourceBufferCount)return;const i=e.config,n=s.currentTime,a=t.levelTargetDuration,o=t.live&&i.liveBackBufferLength!==null?i.liveBackBufferLength:i.backBufferLength;if(B(o)&&o>=0){const c=Math.max(o,a),h=Math.floor(n/a)*a-c;this.flushBackBuffer(n,a,h);}const l=i.frontBufferFlushThreshold;if(B(l)&&l>0){const c=Math.max(i.maxBufferLength,l),h=Math.max(c,a),u=Math.floor(n/a)*a+h;this.flushFrontBuffer(n,a,u);}}flushBackBuffer(e,t,s){this.sourceBuffers.forEach(([i,n])=>{if(n){const o=J.getBuffered(n);if(o.length>0&&s>o.start(0)){var a;this.hls.trigger(y.BACK_BUFFER_REACHED,{bufferEnd:s});const l=this.tracks[i];if((a=this.details)!=null&&a.live)this.hls.trigger(y.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(l!=null&&l.ended){this.log(`Cannot flush ${i} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(y.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:i});}}});}flushFrontBuffer(e,t,s){this.sourceBuffers.forEach(([i,n])=>{if(n){const a=J.getBuffered(n),o=a.length;if(o<2)return;const l=a.start(o-1),c=a.end(o-1);if(s>l||e>=l&&e<=c)return;this.hls.trigger(y.BUFFER_FLUSHING,{startOffset:l,endOffset:1/0,type:i});}});}getDurationAndRange(){var e;const{details:t,mediaSource:s}=this;if(!t||!this.media||s?.readyState!=="open")return null;const i=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&s.setLiveSeekableRange){const c=Math.max(0,t.fragmentStart),h=Math.max(c,i);return {duration:1/0,start:c,end:h}}return {duration:1/0}}const n=(e=this.overrides)==null?void 0:e.duration;if(n)return B(n)?{duration:n}:null;const a=this.media.duration,o=B(s.duration)?s.duration:0;return i>o&&i>a||!B(a)?{duration:i}:null}updateMediaSource({duration:e,start:t,end:s}){const i=this.mediaSource;!this.media||!i||i.readyState!=="open"||(i.duration!==e&&(B(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),i.duration=e),t!==void 0&&s!==void 0&&(this.log(`MediaSource duration is set to ${i.duration}. Setting seekable range to ${t}-${s}.`),i.setLiveSeekableRange(t,s)));}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:s}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${se(s)}`),this.tracksReady){var i;const n=(i=this.transferData)==null?void 0:i.tracks;n&&Object.keys(n).length?this.attachTransferred():this.createSourceBuffers();}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,s])=>{if(t){const i=this.tracks[t];e[t]={buffer:s,container:i.container,codec:i.codec,supplemental:i.supplemental,levelCodec:i.levelCodec,id:i.id,metadata:i.metadata};}}),this.hls.trigger(y.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t);});}else {const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(y.ERROR,{type:G.MEDIA_ERROR,details:_.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:true,error:e,reason:e.message});}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:s}=this;if(!s)throw new Error("createSourceBuffers called when mediaSource was null");for(const n in e){const a=n,o=e[a];if(this.isPending(o)){const l=this.getTrackCodec(o,a),c=`${o.container};codecs=${l}`;o.codec=l,this.log(`creating sourceBuffer(${c})${this.currentOp(a)?" Queued":""} ${se(o)}`);try{const h=s.addSourceBuffer(c),u=ms(a),d=[a,h];t[u]=d,o.buffer=h;}catch(h){var i;this.error(`error while trying to add sourceBuffer: ${h.message}`),this.shiftAndExecuteNext(a),(i=this.operationQueue)==null||i.removeBlockers(),delete this.tracks[a],this.hls.trigger(y.ERROR,{type:G.MEDIA_ERROR,details:_.BUFFER_ADD_CODEC_ERROR,fatal:false,error:h,sourceBufferName:a,mimeType:c,parent:o.id});return}this.trackSourceBuffer(a,o);}}this.bufferCreated();}getTrackCodec(e,t){const s=e.supplemental;let i=e.codec;s&&(t==="video"||t==="audiovideo")&&qr(s,"video")&&(i=Qr(i,s));const n=as(i,e.levelCodec);return n?t.slice(0,5)==="audio"?Rs(n,this.appendSource):n:""}trackSourceBuffer(e,t){const s=t.buffer;if(!s)return;const i=this.getTrackCodec(t,e);this.tracks[e]={buffer:s,codec:i,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(n,a)=>{const o=a.removedRanges;o!=null&&o.length&&this.hls.trigger(y.BUFFER_FLUSHED,{type:n});});}get mediaSrc(){var e,t;const s=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return s?.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart();}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const s=this.currentOp(e);s&&(s.onComplete(),this.shiftAndExecuteNext(e));}onSBUpdateError(e,t){var s;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(s=this.mediaSource)==null?void 0:s.readyState}`);this.error(`${i}`,t),this.hls.trigger(y.ERROR,{type:G.MEDIA_ERROR,details:_.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:false});const n=this.currentOp(e);n&&n.onError(i);}updateTimestampOffset(e,t,s,i,n,a){const o=t-e.timestampOffset;Math.abs(o)>=s&&(this.log(`Updating ${i} SourceBuffer timestampOffset to ${t} (sn: ${n} cc: ${a})`),e.timestampOffset=t);}removeExecutor(e,t,s){const{media:i,mediaSource:n}=this,a=this.tracks[e],o=a?.buffer;if(!i||!n||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const l=B(i.duration)?i.duration:1/0,c=B(n.duration)?n.duration:1/0,h=Math.max(0,t),u=Math.min(s,l,c);u>h&&(!a.ending||a.ended)?(a.ended=false,this.log(`Removing [${h},${u}] from the ${e} SourceBuffer`),o.remove(h,u)):this.shiftAndExecuteNext(e);}appendExecutor(e,t){const s=this.tracks[t],i=s?.buffer;if(!i)throw new hl(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);s.ending=false,s.ended=false,i.appendBuffer(e);}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes);});else try{e();}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`);}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return !!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:s}=this,i=t.map(a=>this.appendBlocker(a));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(i).then(a=>{s===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes));})}stepOperationQueue(e){e.forEach(t=>{var s;const i=(s=this.tracks[t])==null?void 0:s.buffer;!i||i.updating||this.shiftAndExecuteNext(t);});}append(e,t,s){this.operationQueue&&this.operationQueue.append(e,t,s);}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e);}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e);}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,s){const i=this.tracks[e];if(!i)return;const n=i.buffer;if(!n)return;const a=s.bind(this,e);i.listeners.push({event:t,listener:a}),n.addEventListener(t,a);}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const s=t.buffer;s&&(t.listeners.forEach(i=>{s.removeEventListener(i.event,i.listener);}),t.listeners.length=0);}}function Hi(r){const e=r.querySelectorAll("source");[].slice.call(e).forEach(t=>{r.removeChild(t);});}function dl(r,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,r.appendChild(t);}function ms(r){return r==="audio"?1:0}class zs{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners();}setStreamController(e){this.streamController=e;}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null;}registerListeners(){const{hls:e}=this;e.on(y.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(y.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(y.MANIFEST_PARSED,this.onManifestParsed,this),e.on(y.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(y.BUFFER_CODECS,this.onBufferCodecs,this),e.on(y.MEDIA_DETACHING,this.onMediaDetaching,this);}unregisterListener(){const{hls:e}=this;e.off(y.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(y.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(y.MANIFEST_PARSED,this.onManifestParsed,this),e.off(y.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(y.BUFFER_CODECS,this.onBufferCodecs,this),e.off(y.MEDIA_DETACHING,this.onMediaDetaching,this);}onFpsDropLevelCapping(e,t){const s=this.hls.levels[t.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.width});}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize();}onManifestParsed(e,t){const s=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,s.config.capLevelToPlayerSize&&t.video&&this.startCapping();}onLevelsUpdated(e,t){this.timer&&B(this.autoLevelCapping)&&this.detectPlayerSize();}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping();}onMediaDetaching(){this.stopCapping(),this.media=null;}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,s=this.getMaxLevel(e.length-1);s!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${s}: ${e[s].height}p@${e[s].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=s,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping;}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return -1;const s=t.filter((i,n)=>this.isLevelAllowed(i)&&n<=e);return this.clientRect=null,zs.getMaxLevelByMediaSize(s,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize());}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0);}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const s=e.getBoundingClientRect();t.width=s.width,t.height=s.height,!t.width&&!t.height&&(t.width=s.right-s.left||e.width||0,t.height=s.bottom-s.top||e.height||0);}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio;}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return !this.restrictedLevels.some(s=>e.bitrate===s.bitrate&&e.width===s.width&&e.height===s.height)}static getMaxLevelByMediaSize(e,t,s){if(!(e!=null&&e.length))return -1;const i=(o,l)=>l?o.width!==l.width||o.height!==l.height:true;let n=e.length-1;const a=Math.max(t,s);for(let o=0;o=a||l.height>=a)&&i(l,e[o+1])){n=o;break}}return n}}const fl={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},de=fl,gl={HLS:"h"},ml=gl;class Me{constructor(e,t){Array.isArray(e)&&(e=e.map(s=>s instanceof Me?s:new Me(s))),this.value=e,this.params=t;}}const pl="Dict";function yl(r){return Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":typeof r=="object"?JSON.stringify(r):String(r)}function Sl(r,e,t,s){return new Error(`failed to ${r} "${yl(e)}" as ${t}`,{cause:s})}function Ne(r,e,t){return Sl("serialize",r,e,t)}class Jn{constructor(e){this.description=e;}}const Yi="Bare Item",El="Boolean";function Tl(r){if(typeof r!="boolean")throw Ne(r,El);return r?"?1":"?0"}function xl(r){return btoa(String.fromCharCode(...r))}const vl="Byte Sequence";function Al(r){if(ArrayBuffer.isView(r)===false)throw Ne(r,vl);return `:${xl(r)}:`}const Il="Integer";function Rl(r){return r<-999999999999999||99999999999999912)throw Ne(r,bl);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Dl="String",Pl=/[\x00-\x1f\x7f]+/;function Cl(r){if(Pl.test(r))throw Ne(r,Dl);return `"${r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function kl(r){return r.description||r.toString().slice(7,-1)}const wl="Token";function Wi(r){const e=kl(r);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===false)throw Ne(e,wl);return e}function ks(r){switch(typeof r){case "number":if(!B(r))throw Ne(r,Yi);return Number.isInteger(r)?er(r):_l(r);case "string":return Cl(r);case "symbol":return Wi(r);case "boolean":return Tl(r);case "object":if(r instanceof Date)return Ll(r);if(r instanceof Uint8Array)return Al(r);if(r instanceof Jn)return Wi(r);default:throw Ne(r,Yi)}}const Ol="Key";function ws(r){if(/^[a-z*][a-z0-9\-_.*]*$/.test(r)===false)throw Ne(r,Ol);return r}function Qs(r){return r==null?"":Object.entries(r).map(([e,t])=>t===true?`;${ws(e)}`:`;${ws(e)}=${ks(t)}`).join("")}function sr(r){return r instanceof Me?`${ks(r.value)}${Qs(r.params)}`:ks(r)}function Fl(r){return `(${r.value.map(sr).join(" ")})${Qs(r.params)}`}function Ml(r,e={whitespace:true}){if(typeof r!="object"||r==null)throw Ne(r,pl);const t=r instanceof Map?r.entries():Object.entries(r),s=e?.whitespace?" ":"";return Array.from(t).map(([i,n])=>{n instanceof Me||(n=new Me(n));let a=ws(i);return n.value===true?a+=Qs(n.params):(a+="=",Array.isArray(n.value)?a+=Fl(n):a+=sr(n)),a}).join(`,${s}`)}function ir(r,e){return Ml(r,e)}const Ce="CMCD-Object",ne="CMCD-Request",Xe="CMCD-Session",Ve="CMCD-Status",Nl={br:Ce,ab:Ce,d:Ce,ot:Ce,tb:Ce,tpb:Ce,lb:Ce,tab:Ce,lab:Ce,url:Ce,pb:ne,bl:ne,tbl:ne,dl:ne,ltc:ne,mtp:ne,nor:ne,nrr:ne,rc:ne,sn:ne,sta:ne,su:ne,ttfb:ne,ttfbb:ne,ttlb:ne,cmsdd:ne,cmsds:ne,smrt:ne,df:ne,cs:ne,ts:ne,cid:Xe,pr:Xe,sf:Xe,sid:Xe,st:Xe,v:Xe,msd:Xe,bs:Ve,bsd:Ve,cdn:Ve,rtp:Ve,bg:Ve,pt:Ve,ec:Ve,e:Ve},Bl={REQUEST:ne};function Ul(r){return Object.keys(r).reduce((e,t)=>{var s;return (s=r[t])===null||s===void 0||s.forEach(i=>e[i]=t),e},{})}function $l(r,e){const t={};if(!r)return t;const s=Object.keys(r),i=e?Ul(e):{};return s.reduce((n,a)=>{var o;const l=Nl[a]||i[a]||Bl.REQUEST,c=(o=n[l])!==null&&o!==void 0?o:n[l]={};return c[a]=r[a],n},t)}function Gl(r){return ["ot","sf","st","e","sta"].includes(r)}function Kl(r){return typeof r=="number"?B(r):r!=null&&r!==""&&r!==false}const nr="event";function Vl(r,e){const t=new URL(r),s=new URL(e);if(t.origin!==s.origin)return r;const i=t.pathname.split("/").slice(1),n=s.pathname.split("/").slice(1,-1);for(;i[0]===n[0];)i.shift(),n.shift();for(;n.length;)n.shift(),i.unshift("..");return i.join("/")+t.search+t.hash}const Gt=r=>Math.round(r),Os=(r,e)=>Array.isArray(r)?r.map(t=>Os(t,e)):r instanceof Me&&typeof r.value=="string"?new Me(Os(r.value,e),r.params):(e.baseUrl&&(r=Vl(r,e.baseUrl)),e.version===1?encodeURIComponent(r):r),kt=r=>Gt(r/100)*100,Hl=(r,e)=>{let t=r;return e.version>=2&&(r instanceof Me&&typeof r.value=="string"?t=new Me([r]):typeof r=="string"&&(t=[r])),Os(t,e)},Yl={br:Gt,d:Gt,bl:kt,dl:kt,mtp:kt,nor:Hl,rtp:kt,tb:Gt},rr="request",ar="response",Xs=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],Wl=["e"],ql=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function es(r){return ql.test(r)}function jl(r){return Xs.includes(r)||Wl.includes(r)||es(r)}const or=["d","dl","nor","ot","rtp","su"];function zl(r){return Xs.includes(r)||or.includes(r)||es(r)}const Ql=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function Xl(r){return Xs.includes(r)||or.includes(r)||Ql.includes(r)||es(r)}const Zl=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function Jl(r){return Zl.includes(r)||es(r)}const ec={[ar]:Xl,[nr]:jl,[rr]:zl};function lr(r,e={}){const t={};if(r==null||typeof r!="object")return t;const s=e.version||r.v||1,i=e.reportingMode||rr,n=s===1?Jl:ec[i];let a=Object.keys(r).filter(n);const o=e.filter;typeof o=="function"&&(a=a.filter(o));const l=i===ar||i===nr;l&&!a.includes("ts")&&a.push("ts"),s>1&&!a.includes("v")&&a.push("v");const c=ie({},Yl,e.formatters),h={version:s,reportingMode:i,baseUrl:e.baseUrl};return a.sort().forEach(u=>{let d=r[u];const g=c[u];if(typeof g=="function"&&(d=g(d,h)),u==="v"){if(s===1)return;d=s;}u=="pr"&&d===1||(l&&u==="ts"&&!B(d)&&(d=Date.now()),Kl(d)&&(Gl(u)&&typeof d=="string"&&(d=new Jn(d)),t[u]=d));}),t}function tc(r,e={}){const t={};if(!r)return t;const s=lr(r,e),i=$l(s,e?.customHeaderMap);return Object.entries(i).reduce((n,[a,o])=>{const l=ir(o,{whitespace:false});return l&&(n[a]=l),n},t)}function sc(r,e,t){return ie(r,tc(e,t))}const ic="CMCD";function nc(r,e={}){return r?ir(lr(r,e),{whitespace:false}):""}function rc(r,e={}){if(!r)return "";const t=nc(r,e);return encodeURIComponent(t)}function ac(r,e={}){if(!r)return "";const t=rc(r,e);return `${ic}=${t}`}const qi=/CMCD=[^&#]+/;function oc(r,e,t){const s=ac(e,t);if(!s)return r;if(qi.test(r))return r.replace(qi,s);const i=r.includes("?")?"&":"?";return `${r}${i}${s}`}class lc{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=false,this.includeKeys=void 0,this.initialized=false,this.starved=false,this.buffering=true,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=true),this.buffering=true;},this.onPlaying=()=>{this.initialized||(this.initialized=true),this.buffering=false;},this.applyPlaylistData=i=>{try{this.apply(i,{ot:de.MANIFEST,su:!this.initialized});}catch(n){this.hls.logger.warn("Could not generate manifest CMCD data.",n);}},this.applyFragmentData=i=>{try{const{frag:n,part:a}=i,o=this.hls.levels[n.level],l=this.getObjectType(n),c={d:(a||n).duration*1e3,ot:l};(l===de.VIDEO||l===de.AUDIO||l==de.MUXED)&&(c.br=o.bitrate/1e3,c.tb=this.getTopBandwidth(l)/1e3,c.bl=this.getBufferLength(l));const h=a?this.getNextPart(a):this.getNextFrag(n);h!=null&&h.url&&h.url!==n.url&&(c.nor=h.url),this.apply(i,c);}catch(n){this.hls.logger.warn("Could not generate segment CMCD data.",n);}},this.hls=e;const t=this.config=e.config,{cmcd:s}=t;s!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||e.sessionId,this.cid=s.contentId,this.useHeaders=s.useHeaders===true,this.includeKeys=s.includeKeys,this.registerListeners());}registerListeners(){const e=this.hls;e.on(y.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(y.MEDIA_DETACHED,this.onMediaDetached,this),e.on(y.BUFFER_CREATED,this.onBufferCreated,this);}unregisterListeners(){const e=this.hls;e.off(y.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(y.MEDIA_DETACHED,this.onMediaDetached,this),e.off(y.BUFFER_CREATED,this.onBufferCreated,this);}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null;}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying);}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null);}onBufferCreated(e,t){var s,i;this.audioBuffer=(s=t.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer;}createData(){var e;return {v:1,sf:ml.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){ie(t,this.createData());const s=t.ot===de.INIT||t.ot===de.VIDEO||t.ot===de.MUXED;this.starved&&s&&(t.bs=true,t.su=true,this.starved=false),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((a,o)=>(i.includes(o)&&(a[o]=t[o]),a),{}));const n={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),sc(e.headers,t,n)):e.url=oc(e.url,t,n);}getNextFrag(e){var t;const s=(t=this.hls.levels[e.level])==null?void 0:t.details;if(s){const i=e.sn-s.startSN;return s.fragments[i+1]}}getNextPart(e){var t;const{index:s,fragment:i}=e,n=(t=this.hls.levels[i.level])==null||(t=t.details)==null?void 0:t.partList;if(n){const{sn:a}=i;for(let o=n.length-1;o>=0;o--){const l=n[o];if(l.index===s&&l.fragment.sn===a)return n[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return de.TIMED_TEXT;if(e.sn==="initSegment")return de.INIT;if(t==="audio")return de.AUDIO;if(t==="main")return this.hls.audioTracks.length?de.VIDEO:de.MUXED}getTopBandwidth(e){let t=0,s;const i=this.hls;if(e===de.AUDIO)s=i.audioTracks;else {const n=i.maxAutoLevel,a=n>-1?n+1:i.levels.length;s=i.levels.slice(0,a);}return s.forEach(n=>{n.bitrate>t&&(t=n.bitrate);}),t>0?t:NaN}getBufferLength(e){const t=this.media,s=e===de.AUDIO?this.audioBuffer:this.videoBuffer;return !s||!t?NaN:J.bufferInfo(s,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new s(n);}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy();}abort(){this.loader.abort();}load(n,a,o){t(n),this.loader.load(n,a,o);}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,s=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new s(n);}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy();}abort(){this.loader.abort();}load(n,a,o){t(n),this.loader.load(n,a,o);}}}}const cc=3e5;class hc extends be{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=false,this.enabled=true,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners();}registerListeners(){const e=this.hls;e.on(y.MANIFEST_LOADING,this.onManifestLoading,this),e.on(y.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(y.MANIFEST_PARSED,this.onManifestParsed,this),e.on(y.ERROR,this.onError,this);}unregisterListeners(){const e=this.hls;e&&(e.off(y.MANIFEST_LOADING,this.onManifestLoading,this),e.off(y.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(y.MANIFEST_PARSED,this.onManifestParsed,this),e.off(y.ERROR,this.onError,this));}pathways(){return (this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e);}startLoad(){if(this.started=true,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri);}}stopLoad(){this.started=false,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout();}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1);}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null;}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(s=>s!==e));}onManifestLoading(){this.stopLoad(),this.enabled=true,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null;}onManifestLoaded(e,t){const{contentSteering:s}=t;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad());}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks;}onError(e,t){const{errorAction:s}=t;if(s?.action===ce.SendAlternateToPenaltyBox&&s.flags===me.MoveAllAlternatesMatchingHost){const i=this.levels;let n=this._pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:o,pathwayId:l,type:c}=t.context;o&&i?a=this.getPathwayForGroupId(o,c,a):l&&(a=l);}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&i&&(n=this.pathways()),n&&n.length>1&&(this.updatePathwayPriority(n),s.resolved=this.pathwayId!==a),t.details===_.BUFFER_APPEND_ERROR&&!t.fatal?s.resolved=true:s.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${i&&i.length} priorities: ${se(n)} penalized: ${se(this.penalizedPathways)}`);}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),t=this.getLevelsForPathway(s),this.pathwayId=s;}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const s=this.penalizedPathways,i=performance.now();Object.keys(s).forEach(n=>{i-s[n]>cc&&delete s[n];});for(let n=0;n0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,Xa(t),this.hls.trigger(y.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[o];l&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,s){const i=this.getLevelsForPathway(s).concat(this.levels||[]);for(let n=0;n{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=n;if(t.some(h=>h.pathwayId===a))return;const c=this.getLevelsForPathway(o).map(h=>{const u=new At(h.attrs);u["PATHWAY-ID"]=a;const d=u.AUDIO&&`${u.AUDIO}_clone_${a}`,g=u.SUBTITLES&&`${u.SUBTITLES}_clone_${a}`;d&&(s[u.AUDIO]=d,u.AUDIO=d),g&&(i[u.SUBTITLES]=g,u.SUBTITLES=g);const f=cr(h.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),m=new Vt({attrs:u,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:f,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let p=1;p{this.log(`Loaded steering manifest: "${i}"`);const f=h.data;if(f?.VERSION!==1){this.log(`Steering VERSION ${f.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=f.TTL;const{"RELOAD-URI":m,"PATHWAY-CLONES":p,"PATHWAY-PRIORITY":S}=f;if(m)try{this.uri=new self.URL(m,i).href;}catch{this.enabled=false,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${m}`);return}this.scheduleRefresh(this.uri||d.url),p&&this.clonePathways(p);const E={steeringManifest:f,url:i.toString()};this.hls.trigger(y.STEERING_MANIFEST_LOADED,E),S&&this.updatePathwayPriority(S);},onError:(h,u,d,g)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${u.url})`),this.stopLoad(),h.code===410){this.enabled=false,this.log(`Steering manifest ${u.url} no longer available`);return}let f=this.timeToLoad*1e3;if(h.code===429){const m=this.loader;if(typeof m?.getResponseHeader=="function"){const p=m.getResponseHeader("Retry-After");p&&(f=parseFloat(p)*1e3);}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,f);},onTimeout:(h,u,d)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url);}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(n,l,c);}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;const i=(s=this.hls)==null?void 0:s.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3);},t);}}function ji(r,e,t,s){r&&Object.keys(e).forEach(i=>{const n=r.filter(a=>a.groupId===i).map(a=>{const o=ie({},a);return o.details=void 0,o.attrs=new At(o.attrs),o.url=o.attrs.URI=cr(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[i],o.attrs["PATHWAY-ID"]=s,o});r.push(...n);});}function cr(r,e,t,s){const{HOST:i,PARAMS:n,[t]:a}=s;let o;e&&(o=a?.[e],o&&(r=o));const l=new self.URL(r);return i&&!o&&(l.host=i),n&&Object.keys(n).sort().forEach(c=>{c&&l.searchParams.set(c,n[c]);}),l.href}class lt extends be{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=lt.CDMCleanupPromise?[lt.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:s,initData:i}=t,n=`"${t.type}" event: init data type: "${s}"`;if(this.debug(n),i!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=_t(this.config));const o=a.map(ls).filter(l=>!!l);this.keyFormatPromise=this.getKeyFormatPromise(o);}this.keyFormatPromise.then(a=>{const o=os(a);if(s!=="sinf"||o!==te.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${s}" for selected key-system ${o}`);return}let l;try{const g=ae(new Uint8Array(i)),f=Ba(JSON.parse(g).sinf),m=fn(f);if(!m)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");l=new Uint8Array(m.subarray(8,24));}catch(g){this.warn(`${n} Failed to parse sinf: ${g}`);return}const c=xe(l),{keyIdToKeySessionPromise:h,mediaKeySessions:u}=this;let d=h[c];for(let g=0;gthis.generateRequestWithPreferredKeySession(f,s,i,"encrypted-event-key-match")),d.catch(S=>this.handleError(S));break}}d||this.handleError(new Error(`Key ID ${c} not encountered in playlist. Key-system sessions ${u.length}.`));}).catch(a=>this.handleError(a));}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`);},this.hls=e,this.config=e.config,this.registerListeners();}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null;}registerListeners(){this.hls.on(y.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(y.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(y.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(y.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(y.DESTROYING,this.onDestroying,this);}unregisterListeners(){this.hls.off(y.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(y.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(y.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(y.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(y.DESTROYING,this.onDestroying,this);}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:s}=this.config,i=t?.[e];if(i)return i.licenseUrl;if(e===te.WIDEVINE&&s)return s}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,s=t?.[e];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`);}attemptKeySystemAccess(e){const t=this.hls.levels,s=(a,o,l)=>!!a&&l.indexOf(a)===o,i=t.map(a=>a.audioCodec).filter(s),n=t.map(a=>a.videoCodec).filter(s);return i.length+n.length===0&&n.push("avc1.42e01e"),new Promise((a,o)=>{const l=c=>{const h=c.shift();this.getMediaKeysPromise(h,i,n).then(u=>a({keySystem:h,mediaKeys:u})).catch(u=>{c.length?l(c):u instanceof ge?o(u):o(new ge({type:G.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_NO_ACCESS,error:u,fatal:true},u.message));});};l(e);})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${s}`;return Rn===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return s(e,t)}getMediaKeysPromise(e,t,s){var i;const n=$a(e,t,s,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],o=(i=a)==null?void 0:i.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${se(n)}`),o=this.requestMediaKeySystemAccess(e,n);const l=a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(c=>{this.log(`Failed to obtain access to key-system "${e}": ${c}`);}),o.then(c=>{this.log(`Access for key-system "${c.keySystem}" obtained`);const h=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const u=l.mediaKeys=c.createMediaKeys().then(d=>(this.log(`Media-keys created for "${e}"`),l.hasMediaKeys=true,h.then(g=>g?this.setMediaKeysServerCertificate(d,e,g):d)));return u.catch(d=>{this.error(`Failed to create media-keys for "${e}"}: ${d}`);}),u})}return o.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:s}){this.log(`Creating key-system session "${t}" keyId: ${xe(e.keyId||[])} keyUri: ${e.uri}`);const i=s.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:s,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const s=this.createMediaKeySessionContext(e),i=wt(t),n="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(s,n,t.pssh.buffer,"expired");}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e);}updateKeySession(e,t){const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyId ${xe(e.decryptdata.keyId||[])} + } (data length: ${t.byteLength})`),s.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>ls(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:s})=>this.attemptSetMediaKeys(t,s))}selectKeySystem(e){return new Promise((t,s)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:i})=>{const n=ls(i);n?t(n):s(new Error(`Unable to find format for key-system "${i}"`));}).catch(s);})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=_t(this.config),s=e.map(os).filter(i=>!!i&&t.indexOf(i)!==-1);return this.selectKeySystem(s)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let s=0;s(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(l,c).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:l,mediaKeys:c,decryptdata:t}))))).then(l=>{const c="cenc",h=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(l,c,h,"playlist-key")});return o.catch(l=>this.handleError(l,e.frag)),this.keyIdToKeySessionPromise[s]=o,o}return a.catch(o=>{if(o instanceof ge){const l=ee({},o.data);this.getKeyStatus(t)==="internal-error"&&(l.decryptdata=t);const c=new ge(l,o.message);this.handleError(c,e.frag);}}),a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof ge){t&&(e.data.frag=t);const s=e.data.decryptdata;this.error(`${e.message}${s?` (${xe(s.keyId||[])})`:""}`),this.hls.trigger(y.ERROR,e.data);}else this.error(e.message),this.hls.trigger(y.ERROR,{type:G.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_NO_KEYS,error:e,fatal:true});}getKeySystemForKeyPromise(e){const t=wt(e),s=this.keyIdToKeySessionPromise[t];if(!s){const i=os(e.keyFormat),n=i?[i]:_t(this.config);return this.attemptKeySystemAccess(n)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=_t(this.config)),e.length===0)throw new ge({type:G.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:true},`Missing key-system license configuration options ${se({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(s).then(()=>this.media?this.media.setMediaKeys(t):new Promise((n,a)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return a(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(n).catch(a);};}));return this.mediaKeys=t,this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>s.indexOf(n)===-1);})}generateRequestWithPreferredKeySession(e,t,s,i){var n;const a=(n=this.config.drmSystems)==null||(n=n[e.keySystem])==null?void 0:n.generateRequest;if(a)try{const f=a.call(this.hls,t,s,e);if(!f)throw new Error("Invalid response from configured generateRequest filter");t=f.initDataType,s=f.initData?f.initData:null,e.decryptdata.pssh=s?new Uint8Array(s):null;}catch(f){if(this.warn(f.message),this.hls&&this.hls.config.debug)throw f}if(s===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const o=wt(e.decryptdata),l=e.decryptdata.uri;this.log(`Generating key-session request for "${i}" keyId: ${o} URI: ${l} (init data type: ${t} length: ${s.byteLength})`);const c=new wn,h=e._onmessage=f=>{const m=e.mediaKeysSession;if(!m){c.emit("error",new Error("invalid state"));return}const{messageType:p,message:S}=f;this.log(`"${p}" message event for session "${m.sessionId}" message size: ${S.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,S).catch(E=>{c.eventNames().length?c.emit("error",E):this.handleError(E);}):p==="license-release"?e.keySystem===te.FAIRPLAY&&this.updateKeySession(e,Di("acknowledged")).then(()=>this.removeSession(e)).catch(E=>this.handleError(E)):this.warn(`unhandled media key message type "${p}"`);},u=(f,m)=>{m.keyStatus=f;let p;f.startsWith("usable")?c.emit("resolved"):f==="internal-error"||f==="output-restricted"||f==="output-downscaled"?p=zi(f,m.decryptdata):f==="expired"?p=new Error(`key expired (keyId: ${o})`):f==="released"?p=new Error("key released"):f==="status-pending"||this.warn(`unhandled key status change "${f}" (keyId: ${o})`),p&&(c.eventNames().length?c.emit("error",p):this.handleError(p));},d=e._onkeystatuseschange=f=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}const p=this.getKeyStatuses(e);if(!Object.keys(p).some(A=>p[A]!=="status-pending"))return;if(p[o]==="expired"){this.log(`Expired key ${se(p)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let E=p[o];if(E)u(E,e);else {var T;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(T=e.keyStatusTimeouts)[o]||(T[o]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const I=this.getKeyStatus(e.decryptdata);if(I&&I!=="status-pending")return this.log(`No status for keyId ${o} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${I} from other session.`),u(I,e);this.log(`key status for ${o} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),E="internal-error",u(E,e);},1e3)),this.log(`No status for keyId ${o} (${se(p)}).`);}};Fe(e.mediaKeysSession,"message",h),Fe(e.mediaKeysSession,"keystatuseschange",d);const g=new Promise((f,m)=>{c.on("error",m),c.on("resolved",f);});return e.mediaKeysSession.generateRequest(t,s).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o} URI: ${l}`);}).catch(f=>{throw new ge({type:G.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_NO_SESSION,error:f,decryptdata:e.decryptdata,fatal:false},`Error generating key-session request: ${f}`)}).then(()=>g).catch(f=>(c.removeAllListeners(),this.removeSession(e).then(()=>{throw f}))).then(()=>(c.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((s,i)=>{if(typeof i=="string"&&typeof s=="object"){const o=i;i=s,s=o;}const n="buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i);if(e.keySystem===te.PLAYREADY&&n.length===16){const o=xe(n);t[o]=s,Ua(n);}const a=xe(n);s==="internal-error"&&(this.bannedKeyIds[a]=s),this.log(`key status change "${s}" for keyStatuses keyId: ${a} key-session "${e.mediaKeysSession.sessionId}"`),t[a]=s;}),t}fetchServerCertificate(e){const t=this.config,s=t.loader,i=new s(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const l={responseType:"arraybuffer",url:n},c=t.certLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(d,g,f,m)=>{a(d.data);},onError:(d,g,f,m)=>{o(new ge({type:G.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:true,networkDetails:f,response:ee({url:l.url,data:void 0},d)},`"${e}" certificate request failed (${n}). Status: ${d.code} (${d.text})`));},onTimeout:(d,g,f)=>{o(new ge({type:G.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:true,networkDetails:f,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${n})`));},onAbort:(d,g,f)=>{o(new Error("aborted"));}};i.load(l,h,u);})):Promise.resolve()}setMediaKeysServerCertificate(e,t,s){return new Promise((i,n)=>{e.setServerCertificate(s).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${s.byteLength}) on "${t}"`),i(e);}).catch(a=>{n(new ge({type:G.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:true},a.message));});})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(s=>this.updateKeySession(e,new Uint8Array(s)).catch(i=>{throw new ge({type:G.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:i,fatal:false},i.message)}))}unpackPlayReadyKeyMessage(e,t){const s=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!s.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(s,"application/xml"),n=i.querySelectorAll("HttpHeader");if(n.length>0){let h;for(let u=0,d=n.length;u in key message");return Di(atob(c))}setupLicenseXHR(e,t,s,i){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,s,i)}).catch(a=>{if(!s.decryptdata)throw a;return e.open("POST",t,true),n.call(this.hls,e,t,s,i)}).then(a=>(e.readyState||e.open("POST",t,true),{xhr:e,licenseChallenge:a||i})):(e.open("POST",t,true),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const s=this.config.keyLoadPolicy.default;return new Promise((i,n)=>{const a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let l=o.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const c=this.config.licenseResponseCallback;if(c)try{l=c.call(this.hls,o,a,e);}catch(h){this.error(h);}i(l);}else {const l=s.errorRetry,c=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||o.status>=400&&o.status<500)n(new ge({type:G.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:true,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else {const h=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} attempts left`),this.requestLicense(e,t).then(i,n);}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:l,licenseChallenge:c})=>{e.keySystem==te.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(l,c)),l.send(c);}).catch(n);})}onDestroying(){this.unregisterListeners(),this._clear();}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,Fe(s,"encrypted",this.onMediaEncrypted),Fe(s,"waitingforkey",this.onWaitingForKey);const i=this.mediaResolved;i?i():this.mediaKeys=s.mediaKeys;}onMediaDetached(){const e=this.media;e&&(Ge(e,"encrypted",this.onMediaEncrypted),Ge(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null);}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const s=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null;const n=i.length;lt.CDMCleanupPromise=Promise.all(i.map(a=>this.removeSession(a)).concat((s==null||(e=s.setMediaKeys(null))==null?void 0:e.catch(a=>{this.log(`Could not clear media keys: ${a}`),this.hls&&this.hls.trigger(y.ERROR,{type:G.OTHER_ERROR,details:_.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:false,error:new Error(`Could not clear media keys: ${a}`)});}))||Promise.resolve())).catch(a=>{this.log(`Could not close sessions and clear media keys: ${a}`),this.hls&&this.hls.trigger(y.ERROR,{type:G.OTHER_ERROR,details:_.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:false,error:new Error(`Could not close sessions and clear media keys: ${a}`)});}).then(()=>{n&&this.log("finished closing key sessions and clearing media keys");});}onManifestLoading(){this._clear();}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=t.reduce((i,n)=>(i.indexOf(n.keyFormat)===-1&&i.push(n.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s);}}removeSession(e){const{mediaKeysSession:t,licenseXhr:s,decryptdata:i}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${xe(i?.keyId||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);n>-1&&this.mediaKeySessions.splice(n,1);const{keyStatusTimeouts:a}=e;a&&Object.keys(a).forEach(c=>self.clearTimeout(a[c]));const{drmSystemOptions:o}=this.config;return (Ka(o)?new Promise((c,h)=>{self.setTimeout(()=>h(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(c).catch(h);}):Promise.resolve()).catch(c=>{this.log(`Could not remove session: ${c}`),this.hls&&this.hls.trigger(y.ERROR,{type:G.OTHER_ERROR,details:_.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:false,error:new Error(`Could not remove session: ${c}`)});}).then(()=>t.close()).catch(c=>{this.log(`Could not close session: ${c}`),this.hls&&this.hls.trigger(y.ERROR,{type:G.OTHER_ERROR,details:_.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:false,error:new Error(`Could not close session: ${c}`)});})}return Promise.resolve()}}lt.CDMCleanupPromise=void 0;function wt(r){if(!r)throw new Error("Could not read keyId of undefined decryptdata");if(r.keyId===null)throw new Error("keyId is null");return xe(r.keyId)}function uc(r,e){if(r.keyId&&e.mediaKeysSession.keyStatuses.has(r.keyId))return e.mediaKeysSession.keyStatuses.get(r.keyId);if(r.matches(e.decryptdata))return e.keyStatus}class ge extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error;}}function zi(r,e){const t=r==="output-restricted",s=t?_.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:_.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new ge({type:G.KEY_SYSTEM_ERROR,details:s,fatal:false,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${r}"`)}class dc{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=false,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners();}setStreamController(e){this.streamController=e;}registerListeners(){this.hls.on(y.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(y.MEDIA_DETACHING,this.onMediaDetaching,this);}unregisterListeners(){this.hls.off(y.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(y.MEDIA_DETACHING,this.onMediaDetaching,this);}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=false,this.media=null;}onMediaAttaching(e,t){const s=this.hls.config;if(s.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=true),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod);}}onMediaDetaching(){this.media=null;}checkFPS(e,t,s){const i=performance.now();if(t){if(this.lastTime){const n=i-this.lastTime,a=s-this.lastDroppedFrames,o=t-this.lastDecodedFrames,l=1e3*a/n,c=this.hls;if(c.trigger(y.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:s}),l>0&&a>c.config.fpsDroppedMonitoringThreshold*o){let h=c.currentLevel;c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=h)&&(h=h-1,c.trigger(y.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:c.currentLevel}),c.autoLevelCapping=h,this.streamController.nextLevelSwitch());}}this.lastTime=i,this.lastDroppedFrames=s,this.lastDecodedFrames=t;}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames);}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount);}}function fc(r,e){let t;try{t=new Event("addtrack");}catch{t=document.createEvent("Event"),t.initEvent("addtrack",false,false);}t.track=r,e.dispatchEvent(t);}function hr(r,e){const t=r.mode;if(t==="disabled"&&(r.mode="hidden"),r.cues&&!r.cues.getCueById(e.id))try{if(r.addCue(e),!r.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(s){re.debug(`[texttrack-utils]: ${s}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,r.addCue(i);}catch(i){re.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`);}}t==="disabled"&&(r.mode=t);}function pt(r,e){const t=r.mode;if(t==="disabled"&&(r.mode="hidden"),r.cues)for(let s=r.cues.length;s--;)r.removeCue(r.cues[s]);t==="disabled"&&(r.mode=t);}function Qi(r,e,t,s){const i=r.mode;if(i==="disabled"&&(r.mode="hidden"),r.cues&&r.cues.length>0){const n=mc(r.cues,e,t);for(let a=0;ar[t].endTime)return -1;let s=0,i=t,n;for(;s<=i;)if(n=Math.floor((i+s)/2),er[n].startTime&&s-1)for(let n=i,a=r.length;n=e&&o.endTime<=t)s.push(o);else if(o.startTime>t)return s}return s}function Kt(r){const e=[];for(let t=0;tthis.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const s=Kt(this.media.textTracks);for(let n=0;n-1&&this.toggleTrackModes();}registerListeners(){const{hls:e}=this;e.on(y.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(y.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(y.MANIFEST_LOADING,this.onManifestLoading,this),e.on(y.MANIFEST_PARSED,this.onManifestParsed,this),e.on(y.LEVEL_LOADING,this.onLevelLoading,this),e.on(y.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(y.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(y.ERROR,this.onError,this);}unregisterListeners(){const{hls:e}=this;e.off(y.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(y.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(y.MANIFEST_LOADING,this.onManifestLoading,this),e.off(y.MANIFEST_PARSED,this.onManifestParsed,this),e.off(y.LEVEL_LOADING,this.onLevelLoading,this),e.off(y.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(y.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(y.ERROR,this.onError,this);}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange));}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e);}onMediaDetaching(e,t){const s=this.media;if(!s)return;const i=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||s.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,i)return;Kt(s.textTracks).forEach(a=>{pt(a);});}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=true;}onManifestParsed(e,t){this.tracks=t.subtitleTracks;}onSubtitleTrackLoaded(e,t){const{id:s,groupId:i,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==i){this.warn(`Subtitle track with id:${s} and group:${i} not found in active group ${a?.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Subtitle track ${s} "${a.name}" lang:${a.lang} group:${i} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o);}onLevelLoading(e,t){this.switchLevel(t.level);}onLevelSwitching(e,t){this.switchLevel(t.level);}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.subtitleGroups||null,i=this.groupIds;let n=this.currentTrack;if(!s||i?.length!==s?.length||s!=null&&s.some(a=>i?.indexOf(a)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(h=>!s||s.indexOf(h.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(h=>h.default)&&(this.selectDefaultTrack=false),a.forEach((h,u)=>{h.id=u;});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const o=this.hls.config.subtitlePreference;if(!n&&o){this.selectDefaultTrack=false;const h=Oe(o,a);if(h>-1)n=a[h];else {const u=Oe(o,this.tracks);n=this.tracks[u];}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const c={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${s?.join(",")}" group-id`),this.hls.trigger(y.SUBTITLE_TRACKS_UPDATED,c),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l);}}findTrackId(e){const t=this.tracksInGroup,s=this.selectDefaultTrack;for(let i=0;i-1){const n=this.tracksInGroup[i];return this.setSubtitleTrack(i),n}else {if(s)return null;{const n=Oe(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e);}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=e.id,i=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading subtitle ${s} "${e.name}" lang:${e.lang} group:${i}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${n}`),this.hls.trigger(y.SUBTITLE_TRACK_LOADING,{url:n,id:s,groupId:i,deliveryDirectives:t||null,track:e});}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Kt(e.textTracks),s=this.currentTrack;let i;if(s&&(i=t.filter(n=>Cs(s,n))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${s.name}" and language "${s.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==i&&(n.mode="disabled");}),i){const n=this.subtitleDisplay?"showing":"hidden";i.mode!==n&&(i.mode=n);}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!B(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=false;const s=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(y.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!i.details&&!i.details.live;if(e===this.trackId&&i===s&&n)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:a,groupId:o="",name:l,type:c,url:h}=i;this.hls.trigger(y.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:c,url:h});const u=this.switchParams(i.url,s?.details,i.details);this.loadPlaylist(u);}}function Et(r){let e=5381,t=r.length;for(;t;)e=e*33^r.charCodeAt(--t);return (e>>>0).toString()}const ct=.025;let Xt=(function(r){return r[r.Point=0]="Point",r[r.Range=1]="Range",r})({});function yc(r,e,t){return `${r.identifier}-${t+1}-${Et(e)}`}class Sc{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=false,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:false,jump:false},this.snapOptions={out:false,in:false},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e);}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions);}reset(){var e;this.appendInPlaceStarted=false,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null);}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return true;const s=this.playoutLimit;return e<=0||isNaN(s)?false:s===0?true:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>s}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return ps(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return true;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,s=ps(t,e);return t-s<.1}return false}get resumptionOffset(){const e=this.resumeOffset,t=B(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return ps(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?true:this.appendInPlaceDisabled?false:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)0||this.assetListResponse!==null}toString(){return Ec(this)}}function ps(r,e){return r-e.start":r.cue.post?"":""}${r.timelineStart.toFixed(2)}-${r.resumeTime.toFixed(2)}]`}function at(r){const e=r.timelineStart,t=r.duration||0;return `["${r.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Tc{constructor(e,t,s,i){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=false,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(y.PLAYOUT_LIMIT_REACHED,{});};const n=this.hls=new e(t);this.interstitial=s,this.assetItem=i;const a=()=>{this.hasDetails=true;};n.once(y.LEVEL_LOADED,a),n.once(y.AUDIO_TRACK_LOADED,a),n.once(y.SUBTITLE_TRACK_LOADED,a),n.on(y.MEDIA_ATTACHING,(o,{media:l})=>{this.removeMediaListeners(),this.mediaAttached=l,this.interstitial.playoutLimit&&(l.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&n.on(y.BUFFER_APPENDED,()=>{const h=this.bufferedEnd;this.reachedPlayout(h)&&(this._bufferedEosTime=h,n.trigger(y.BUFFERED_TO_END,void 0));}));});}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,true);else {let t=this.assetItem.uri;try{t=ur(t,e.config.primarySessionId||"").href;}catch{}e.loadSource(t);}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return false;if((t=this.hls)!=null&&t.bufferedToEnd)return true;if(!e)return false;const s=Math.min(this._bufferedEosTime||1/0,this.duration),i=this.timelineOffset,n=J.bufferInfo(e,i,0);return this.getAssetTime(n.end)>=s-.02}reachedPlayout(e){const s=this.interstitial.playoutLimit;return this.startOffset+e>=s}get destroyed(){var e;return !((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return ((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=J.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const s=t-this.startOffset;if(s>0&&s1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e;}}}getAssetTime(e){const t=this.timelineOffset,s=this.duration;return Math.min(Math.max(0,e-t),s)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout));}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd);}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null;}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e);}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia();}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering();}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering();}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=s=>delete s.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=false;}}on(e,t,s){var i;(i=this.hls)==null||i.on(e,t);}once(e,t,s){var i;(i=this.hls)==null||i.once(e,t);}off(e,t,s){var i;(i=this.hls)==null||i.off(e,t);}toString(){var e;return `HlsAssetPlayer: ${at(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Xi=.033;class xc extends be{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e;}destroy(){this.reset(),this.onScheduleUpdate=null;}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null;}resetErrorsInRange(e,t){return this.events?this.events.reduce((s,i)=>e<=i.startOffset&&t>i.startOffset?(delete i.error,s+1):s,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let s=-1;e.nextEvent?s=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(s=this.findEventIndex(e.previousEvent.identifier)+1);const i=this.items;if(i)for(i[s]||(t===void 0&&(t=e.start),s=this.findItemIndexAtTime(t));s>=0&&(n=i[s])!=null&&n.event;){var n;s--;}return s}findItemIndexAtTime(e,t){const s=this.items;if(s)for(let i=0;in.start&&e1)for(let n=0;no&&(t!o.includes(c.identifier)):[];a.length&&a.sort((c,h)=>{const u=c.cue.pre,d=c.cue.post,g=h.cue.pre,f=h.cue.post;if(u&&!g)return -1;if(g&&!u||d&&!f)return 1;if(f&&!d)return -1;if(!u&&!g&&!d&&!f){const m=c.startTime,p=h.startTime;if(m!==p)return m-p}return c.dateRange.tagOrder-h.dateRange.tagOrder}),this.events=a,l.forEach(c=>{this.removeEvent(c);}),this.updateSchedule(e,l);}updateSchedule(e,t=[],s=false){const i=this.events||[];if(i.length||t.length||this.length<2){const n=this.items,a=this.parseSchedule(i,e);(s||t.length||n?.length!==a.length||a.some((l,c)=>Math.abs(l.playout.start-n[c].playout.start)>.005||Math.abs(l.playout.end-n[c].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(t,n));}}parseDateRanges(e,t,s){const i=[],n=Object.keys(e);for(let a=0;a!l.error&&!(l.cue.once&&l.hasPlayed)),e.length){this.resolveOffsets(e,t);let l=0,c=0;if(e.forEach((h,u)=>{const d=h.cue.pre,g=h.cue.post,f=e[u-1]||null,m=h.appendInPlace,p=g?n:h.startOffset,S=h.duration,E=h.timelineOccupancy===Xt.Range?S:0,T=h.resumptionOffset,A=f?.startTime===p,I=p+h.cumulativeDuration;let D=m?I+S:p+T;if(d||!g&&p<=0){const L=c;c+=E,h.timelineStart=I;const b=a;a+=S,s.push({event:h,start:I,end:D,playout:{start:b,end:a},integrated:{start:L,end:c}});}else if(p<=n){if(!A){const R=p-l;if(R>Xi){const P=l,O=c;c+=R;const N=a;a+=R;const U={previousEvent:e[u-1]||null,nextEvent:h,start:P,end:P+R,playout:{start:N,end:a},integrated:{start:O,end:c}};s.push(U);}else R>0&&f&&(f.cumulativeDuration+=R,s[s.length-1].end=p);}g&&(D=I),h.timelineStart=I;const L=c;c+=E;const b=a;a+=S,s.push({event:h,start:I,end:D,playout:{start:b,end:a},integrated:{start:L,end:c}});}else return;const v=h.resumeTime;g||v>n?l=n:l=v;}),l{const c=o.cue.pre,h=o.cue.post,u=c?0:h?i:o.startTime;this.updateAssetDurations(o),a===u?o.cumulativeDuration=n:(n=0,a=u),!h&&o.snapOptions.in&&(o.resumeAnchor=ht(null,s.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=false)),!o.appendInPlace&&l+1ct?(this.log(`"${e.identifier}" resumption ${s} not aligned with estimated timeline end ${i}`),false):!Object.keys(t).some(a=>{const o=t[a].details,l=o.edge;if(s>=l)return this.log(`"${e.identifier}" resumption ${s} past ${a} playlist end ${l}`),false;const c=ht(null,o.fragments,s);if(!c)return this.log(`"${e.identifier}" resumption ${s} does not align with any fragments in ${a} playlist (${o.fragStart}-${o.fragmentEnd})`),true;const h=a==="audio"?.175:0;return Math.abs(c.start-s){const p=d.data,S=p?.ASSETS;if(!Array.isArray(S)){const E=this.assignAssetListError(e,_.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),f.url,g,m);this.hls.trigger(y.ERROR,E);return}e.assetListResponse=p,this.hls.trigger(y.ASSET_LIST_LOADED,{event:e,assetListResponse:p,networkDetails:m});},onError:(d,g,f,m)=>{const p=this.assignAssetListError(e,_.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${d.code} ${d.text} (${g.url})`),g.url,m,f);this.hls.trigger(y.ERROR,p);},onTimeout:(d,g,f)=>{const m=this.assignAssetListError(e,_.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${g.url})`),g.url,d,f);this.hls.trigger(y.ERROR,m);}};return o.load(l,h,u),this.hls.trigger(y.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,s,i,n,a){return e.error=s,{type:G.NETWORK_ERROR,details:t,fatal:false,interstitial:e,url:i,error:s,networkDetails:a,stats:n}}}function Zi(r){var e;r==null||(e=r.play())==null||e.catch(()=>{});}function Ot(r,e){return `[${r}] Advancing timeline position to ${e}`}class Ac extends be{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=false,this.onPlay=()=>{this.shouldPlay=true;},this.onPause=()=>{this.shouldPlay=false;},this.onSeeking=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled||!this.schedule)return;const i=s-this.timelinePos;if(Math.abs(i)<1/7056e5)return;const a=i<=-0.01;this.timelinePos=s,this.bufferedPos=s;const o=this.playingItem;if(!o){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(s,s-i)&&this.updateSchedule(true),this.checkBuffer(),a&&s=o.end){var l;const g=this.findItemIndex(o);let f=this.schedule.findItemIndexAtTime(s);if(f===-1&&(f=g+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${s} (resolving from ${g} to ${f})`)),!this.isInterstitial(o)&&(l=this.media)!=null&&l.paused&&(this.shouldPlay=false),!a&&f>g){const m=this.schedule.findJumpRestrictedIndex(g+1,f);if(m>g){this.setSchedulePosition(m);return}}this.setSchedulePosition(f);return}const c=this.playingAsset;if(!c){if(this.playingLastItem&&this.isInterstitial(o)){const g=o.event.assetList[0];g&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(s,g));}return}const h=c.timelineStart,u=c.duration||0;if(a&&s=h+u){var d;(d=o.event)!=null&&d.appendInPlace&&(this.clearAssetPlayers(o.event,o),this.flushFrontBuffer(s)),this.setScheduleToAssetAtTime(s,c);}},this.onTimeupdate=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled)return;if(s>this.timelinePos)this.timelinePos=s,s>this.bufferedPos&&this.checkBuffer();else return;const i=this.playingItem;if(!i||this.playingLastItem)return;if(s>=i.end){this.timelinePos=i.end;const o=this.findItemIndex(i);this.setSchedulePosition(o+1);}const n=this.playingAsset;if(!n)return;const a=n.timelineStart+(n.duration||0);s>=a&&this.setScheduleToAssetAtTime(s,n);},this.onScheduleUpdate=(s,i)=>{const n=this.schedule;if(!n)return;const a=this.playingItem,o=n.events||[],l=n.items||[],c=n.durations,h=s.map(m=>m.identifier),u=!!(o.length||h.length);(u||i)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o} +Schedule: ${l.map(m=>Re(m))} pos: ${this.timelinePos}`),h.length&&this.log(`Removed events ${h}`);let d=null,g=null;a&&(d=this.updateItem(a,this.timelinePos),this.itemsMatch(a,d)?this.playingItem=d:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const f=this.bufferingItem;if(f&&(g=this.updateItem(f,this.bufferedPos),this.itemsMatch(f,g)?this.bufferingItem=g:f.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(f.event,null))),s.forEach(m=>{m.assetList.forEach(p=>{this.clearAssetPlayer(p.identifier,null);});}),this.playerQueue.forEach(m=>{if(m.interstitial.appendInPlace){const p=m.assetItem.timelineStart,S=m.timelineOffset-p;if(S)try{m.timelineOffset=p;}catch(E){Math.abs(S)>ct&&this.warn(`${E} ("${m.assetId}" ${m.timelineOffset}->${p})`);}}}),u||i){if(this.hls.trigger(y.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:l.slice(0),durations:c,removedIds:h}),this.isInterstitial(a)&&h.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(d,a),f&&g!==d&&this.trimInPlace(g,f),this.checkBuffer();}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new vc(e),this.schedule=new xc(this.onScheduleUpdate,e.logger),this.registerListeners();}registerListeners(){const e=this.hls;e&&(e.on(y.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(y.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(y.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(y.MANIFEST_LOADING,this.onManifestLoading,this),e.on(y.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(y.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(y.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(y.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(y.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(y.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(y.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(y.BUFFER_APPENDED,this.onBufferAppended,this),e.on(y.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(y.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(y.MEDIA_ENDED,this.onMediaEnded,this),e.on(y.ERROR,this.onError,this),e.on(y.DESTROYING,this.onDestroying,this));}unregisterListeners(){const e=this.hls;e&&(e.off(y.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(y.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(y.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(y.MANIFEST_LOADING,this.onManifestLoading,this),e.off(y.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(y.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(y.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(y.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(y.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(y.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(y.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(y.BUFFER_CODECS,this.onBufferCodecs,this),e.off(y.BUFFER_APPENDED,this.onBufferAppended,this),e.off(y.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(y.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(y.MEDIA_ENDED,this.onMediaEnded,this),e.off(y.ERROR,this.onError,this),e.off(y.DESTROYING,this.onDestroying,this));}startLoad(){this.resumeBuffering();}stopLoad(){this.pauseBuffering();}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering();}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering();}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null;}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e);}removeMediaListeners(e){Ge(e,"play",this.onPlay),Ge(e,"pause",this.onPause),Ge(e,"seeking",this.onSeeking),Ge(e,"timeupdate",this.onTimeupdate);}onMediaAttaching(e,t){const s=this.media=t.media;Fe(s,"seeking",this.onSeeking),Fe(s,"timeupdate",this.onTimeupdate),Fe(s,"play",this.onPlay),Fe(s,"pause",this.onPause);}onMediaAttached(e,t){const s=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,s===null)this.checkStart();else if(!i){this.clearScheduleState();const n=this.findItemIndex(s);this.setSchedulePosition(n);}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null;}onMediaDetaching(e,t){const s=!!t.transferMedia,i=this.media;if(this.media=null,!s&&(i&&this.removeMediaListeners(i),this.detachedData)){const n=this.getBufferingPlayer();n&&(this.log(`Removing schedule state for detachedData and ${n}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,n.detachMedia()),this.shouldPlay=false;}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,s=u=>u&&e.getAssetPlayer(u.identifier),i=(u,d,g,f,m)=>{if(u){let p=u[d].start;const S=u.event;if(S){if(d==="playout"||S.timelineOccupancy!==Xt.Point){const E=s(g);E?.interstitial===S&&(p+=E.assetItem.startOffset+E[m]);}}else {const E=f==="bufferedPos"?a():e[f];p+=E-u.start;}return p}return 0},n=(u,d)=>{var g;if(u!==0&&d!=="primary"&&(g=e.schedule)!=null&&g.length){var f;const m=e.schedule.findItemIndexAtTime(u),p=(f=e.schedule.items)==null?void 0:f[m];if(p){const S=p[d].start-p.start;return u+S}}return u},a=()=>{const u=e.bufferedPos;return u===Number.MAX_VALUE?o("primary"):Math.max(u,0)},o=u=>{var d,g;return (d=e.primaryDetails)!=null&&d.live?e.primaryDetails.edge:((g=e.schedule)==null?void 0:g.durations[u])||0},l=(u,d)=>{var g,f;const m=e.effectivePlayingItem;if(m!=null&&(g=m.event)!=null&&g.restrictions.skip||!e.schedule)return;e.log(`seek to ${u} "${d}"`);const p=e.effectivePlayingItem,S=e.schedule.findItemIndexAtTime(u,d),E=(f=e.schedule.items)==null?void 0:f[S],T=e.getBufferingPlayer(),A=T?.interstitial,I=A?.appendInPlace,D=p&&e.itemsMatch(p,E);if(p&&(I||D)){const v=s(e.playingAsset),L=v?.media||e.primaryMedia;if(L){const b=d==="primary"?L.currentTime:i(p,d,e.playingAsset,"timelinePos","currentTime"),R=u-b,P=(I?b:L.currentTime)+R;if(P>=0&&(!v||I||P<=v.duration)){L.currentTime=P;return}}}if(E){let v=u;if(d!=="primary"){const b=E[d].start,R=u-b;v=E.start+R;}const L=!e.isInterstitial(E);if((!e.isInterstitial(p)||p.event.appendInPlace)&&(L||E.event.appendInPlace)){const b=e.media||(I?T?.media:null);b&&(b.currentTime=v);}else if(p){const b=e.findItemIndex(p);if(S>b){const P=e.schedule.findJumpRestrictedIndex(b+1,S);if(P>b){e.setSchedulePosition(P);return}}let R=0;if(L)e.timelinePos=v,e.checkBuffer();else {const P=E.event.assetList,O=u-(E[d]||E).start;for(let N=P.length;N--;){const U=P[N];if(U.duration&&O>=U.startOffset&&O{const u=e.effectivePlayingItem;if(e.isInterstitial(u))return u;const d=t();return e.isInterstitial(d)?d:null},h={get bufferedEnd(){const u=t(),d=e.bufferingItem;if(d&&d===u){var g;return i(d,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-d.playout.start||((g=e.bufferingAsset)==null?void 0:g.startOffset)||0}return 0},get currentTime(){const u=c(),d=e.effectivePlayingItem;return d&&d===u?i(d,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-d.playout.start:0},set currentTime(u){const d=c(),g=e.effectivePlayingItem;g&&g===d&&l(u+g.playout.start,"playout");},get duration(){const u=c();return u?u.playout.end-u.playout.start:0},get assetPlayers(){var u;const d=(u=c())==null?void 0:u.event.assetList;return d?d.map(g=>e.getAssetPlayer(g.identifier)):[]},get playingIndex(){var u;const d=(u=c())==null?void 0:u.event;return d&&e.effectivePlayingAsset?d.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return c()}};return this.manager={get events(){var u;return ((u=e.schedule)==null||(u=u.events)==null?void 0:u.slice(0))||[]},get schedule(){var u;return ((u=e.schedule)==null||(u=u.items)==null?void 0:u.slice(0))||[]},get interstitialPlayer(){return c()?h:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const u=t();return e.findItemIndex(u)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const u=e.effectivePlayingItem;return e.findItemIndex(u)},primary:{get bufferedEnd(){return a()},get currentTime(){const u=e.timelinePos;return u>0?u:0},set currentTime(u){l(u,"primary");},get duration(){return o("primary")},get seekableStart(){var u;return ((u=e.primaryDetails)==null?void 0:u.fragmentStart)||0}},integrated:{get bufferedEnd(){return i(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(u){l(u,"integrated");},get duration(){return o("integrated")},get seekableStart(){var u;return n(((u=e.primaryDetails)==null?void 0:u.fragmentStart)||0,"integrated")}},skip:()=>{const u=e.effectivePlayingItem,d=u?.event;if(d&&!d.restrictions.skip){const g=e.findItemIndex(u);if(d.appendInPlace){const f=u.playout.start+u.event.duration;l(f+.001,"playout");}else e.advanceAfterAssetEnded(d,g,1/0);}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,s=(e=this.schedule)==null?void 0:e.items;return !this.playbackStarted||!t||!s?false:this.findItemIndex(t)===s.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const s=this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&!s.event.appendInPlace)return;let i=this.media;!i&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(i=this.primaryMedia);const n=(t=i)==null?void 0:t.currentTime;if(!(n===void 0||!B(n)))return n}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return !!(e!=null&&e.event)}retreiveMediaSource(e,t){const s=this.getAssetPlayer(e);s&&this.transferMediaFromPlayer(s,t);}transferMediaFromPlayer(e,t){const s=e.interstitial.appendInPlace,i=e.media;if(s&&i===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&i){this.detachedData={media:i};return}const n=e.transferMedia();this.log(`transfer MediaSource from ${e} ${se(n)}`),this.detachedData=n;}else t&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused));}transferMediaTo(e,t){var s,i;if(e.media===t)return;let n=null;const a=this.hls,o=e!==a,l=o&&e.interstitial.appendInPlace,c=(s=this.detachedData)==null?void 0:s.mediaSource;let h;if(a.media)l&&(n=a.transferMedia(),this.detachedData=n),h="Primary";else if(c){const f=this.getBufferingPlayer();f?(n=f.transferMedia(),h=`${f}`):h="detached MediaSource";}else h="detached media";if(!n){if(c)n=this.detachedData,this.log(`using detachedData: MediaSource ${se(n)}`);else if(!this.detachedData||a.media===t){const f=this.playerQueue;f.length>1&&f.forEach(m=>{if(o&&m.interstitial.appendInPlace!==l){const p=m.interstitial;this.clearInterstitial(m.interstitial,null),p.appendInPlace=false,p.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${p}`);}}),this.hls.detachMedia(),this.detachedData={media:t};}}const u=n&&"mediaSource"in n&&((i=n.mediaSource)==null?void 0:i.readyState)!=="closed",d=u&&n?n:t;this.log(`${u?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${h} (media.currentTime: ${t.currentTime})`);const g=this.schedule;if(d===n&&g){const f=o&&e.assetId===g.assetIdAtEnd;d.overrides={duration:g.duration,endOfStream:!o||f,cueRemoval:!o};}e.attachMedia(d);}onInterstitialCueEnter(){this.onTimeupdate();}checkStart(){const e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const s=this.timelinePos,i=this.effectivePlayingItem;if(s===-1){const n=this.hls.startPosition;if(this.log(Ot("checkStart",n)),this.timelinePos=n,t.length&&t[0].cue.pre){const a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a);}else if(n>=0||!this.primaryLive){const a=this.timelinePos=n>0?n:0,o=e.findItemIndexAtTime(a);this.setSchedulePosition(o);}}else if(i&&!this.playingItem){const n=e.findItemIndex(i);this.setSchedulePosition(n);}}advanceAssetBuffering(e,t){const s=e.event,i=s.findAssetIndex(t),n=ys(s,i);if(!s.isAssetPastPlayoutLimit(n))this.bufferedToEvent(e,n);else if(this.schedule){var a;const o=(a=this.schedule.items)==null?void 0:a[this.findItemIndex(e)+1];o&&this.bufferedToItem(o);}}advanceAfterAssetEnded(e,t,s){const i=ys(e,s);if(e.isAssetPastPlayoutLimit(i)){if(this.schedule){const n=this.schedule.items;if(n){const a=t+1,o=n.length;if(a>=o){this.setSchedulePosition(-1);return}const l=e.resumeTime;this.timelinePos=0?i[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${n&&Re(n)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(a)){const h=a.event,u=this.playingAsset,d=u?.identifier,g=d?this.getAssetPlayer(d):null;if(g&&d&&(!this.eventItemsMatch(a,n)||t!==void 0&&d!==h.assetList[t].identifier)){var l;const f=h.findAssetIndex(u);if(this.log(`INTERSTITIAL_ASSET_ENDED ${f+1}/${h.assetList.length} ${at(u)}`),this.endedAsset=u,this.playingAsset=null,this.hls.trigger(y.INTERSTITIAL_ASSET_ENDED,{asset:u,assetListIndex:f,event:h,schedule:i.slice(0),scheduleIndex:e,player:g}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(h,this.findItemIndex(this.playingItem),f);return}this.retreiveMediaSource(d,n),g.media&&!((l=this.detachedData)!=null&&l.mediaSource)&&g.detachMedia();}if(!this.eventItemsMatch(a,n)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${h} ${Re(a)}`),h.hasPlayed=true,this.hls.trigger(y.INTERSTITIAL_ENDED,{event:h,schedule:i.slice(0),scheduleIndex:e}),h.cue.once)){var c;this.updateSchedule();const f=(c=this.schedule)==null?void 0:c.items;if(n&&f){const m=this.findItemIndex(n);this.advanceSchedule(m,f,t,a,o);}return}}this.advanceSchedule(e,i,t,a,o);}advanceSchedule(e,t,s,i,n){const a=this.schedule;if(!a)return;const o=t[e]||null,l=this.primaryMedia,c=this.playerQueue;if(c.length&&c.forEach(h=>{const u=h.interstitial,d=a.findEventIndex(u.identifier);(de+1)&&this.clearInterstitial(u,o);}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const h=o.event;if(s===void 0){s=a.findAssetIndex(h,this.timelinePos);const f=ys(h,s-1);if(h.isAssetPastPlayoutLimit(f)||h.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(h,e,s);return}s=f;}const u=this.waitingItem;this.assetsBuffered(o,l)||this.setBufferingItem(o);let d=this.preloadAssets(h,s);if(this.eventItemsMatch(o,u||i)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${Re(o)} ${h.appendInPlace?"append in place":""}`),this.hls.trigger(y.INTERSTITIAL_STARTED,{event:h,schedule:t.slice(0),scheduleIndex:e})),!h.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${h}`);return}if(h.assetListLoader&&(h.assetListLoader.destroy(),h.assetListLoader=void 0),!l){this.log(`Waiting for attachMedia to start Interstitial ${h}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const g=h.assetList[s];if(!g){this.advanceAfterAssetEnded(h,e,s||0);return}if(d||(d=this.getAssetPlayer(g.identifier)),d===null||d.destroyed){const f=h.assetList.length;this.warn(`asset ${s+1}/${f} player destroyed ${h}`),d=this.createAssetPlayer(h,g,s),d.loadSource();}if(!this.eventItemsMatch(o,this.bufferingItem)&&h.appendInPlace&&this.isAssetBuffered(g))return;this.startAssetPlayer(d,s,t,e,l),this.shouldPlay&&Zi(d.media);}else o?(this.resumePrimary(o,e,i),this.shouldPlay&&Zi(this.hls.media)):n&&this.isInterstitial(i)&&(this.endedItem=null,this.playingItem=i,i.event.appendInPlace||this.attachPrimary(a.durations.primary,null));}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===false}get primaryDetails(){var e;return (e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return !!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,s){var i,n;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${Re(e)}`),!((i=this.detachedData)!=null&&i.mediaSource)){let o=this.timelinePos;(o=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(Ot("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e);}if(!s)return;const a=(n=this.schedule)==null?void 0:n.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Re(e)}`),this.hls.trigger(y.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:t}),this.checkBuffer());}getPrimaryResumption(e,t){const s=e.start;if(this.primaryLive){const i=this.primaryDetails;if(t===0)return this.hls.startPosition;if(i&&(si.edge))return this.hls.liveSyncPosition||-1}return s}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:J.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,s){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const i=this.primaryMedia;if(!i)return;const n=this.hls;n.media?this.checkBuffer():(this.transferMediaTo(n,i),s&&this.startLoadingPrimaryAt(e,s)),s||(this.log(Ot("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,s));}startLoadingPrimaryAt(e,t){var s;const i=this.hls;!i.loadingEnabled||!i.media||Math.abs((((s=i.mainForwardBufferInfo)==null?void 0:s.start)||i.media.currentTime)-e)>.5?i.startLoad(e,t):i.bufferingEnabled||i.resumeBuffering();}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=false,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(y.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(y.BUFFER_CODECS,this.onBufferCodecs,this);}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const s=this.hls.levels[t.level];if(!s.details)return;const i=ee(ee({},this.mediaSelection||this.altSelection),{},{main:s});this.mediaSelection=i,this.schedule.parseInterstitialDateRanges(i,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart();}onAudioTrackUpdated(e,t){const s=this.hls.audioTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=ee(ee({},this.altSelection),{},{audio:s});return}const n=ee(ee({},i),{},{audio:s});this.mediaSelection=n;}onSubtitleTrackUpdated(e,t){const s=this.hls.subtitleTracks[t.id],i=this.mediaSelection;if(!i){this.altSelection=ee(ee({},this.altSelection),{},{subtitles:s});return}const n=ee(ee({},i),{},{subtitles:s});this.mediaSelection=n;}onAudioTrackSwitching(e,t){const s=Ei(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setAudioOption(t)||i.setAudioOption(s)));}onSubtitleTrackSwitch(e,t){const s=Ei(t);this.playerQueue.forEach(({hls:i})=>i&&(i.setSubtitleOption(t)||t.id!==-1&&i.setSubtitleOption(s)));}onBufferCodecs(e,t){const s=t.tracks;s&&(this.requiredTracks=s);}onBufferAppended(e,t){this.checkBuffer();}onBufferFlushed(e,t){const s=this.playingItem;if(s&&!this.itemsMatch(s,this.bufferingItem)&&!this.isInterstitial(s)){const i=this.timelinePos;this.bufferedPos=i,this.checkBuffer();}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos.25){e.event.assetList.forEach((n,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(n.identifier,null);});const s=e.end+.25,i=J.bufferInfo(this.primaryMedia,s,0);(i.end>s||(i.nextStart||0)>s)&&(this.log(`trim buffered interstitial ${Re(e)} (was ${Re(t)})`),this.attachPrimary(s,null,true),this.flushFrontBuffer(s));}}itemsMatch(e,t){return !!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var s;return !!t&&(e===t||e.event.identifier===((s=t.event)==null?void 0:s.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=false){var t;const s=this.mediaSelection;s&&((t=this.schedule)==null||t.updateSchedule(s,[],e));}checkBuffer(e){var t;const s=(t=this.schedule)==null?void 0:t.items;if(!s)return;const i=J.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,s,e);}updateBufferedPos(e,t,s){const i=this.schedule,n=this.bufferingItem;if(this.bufferedPos>e||!i)return;if(t.length===1&&this.itemsMatch(t[0],n)){this.bufferedPos=e;return}const a=this.playingItem,o=this.findItemIndex(a);let l=i.findItemIndexAtTime(e);if(this.bufferedPos=n.end||(c=d.event)!=null&&c.appendInPlace&&e+.01>=d.start)&&(l=u),this.isInterstitial(n)){const g=n.event;if(u-o>1&&g.appendInPlace===false||g.assetList.length===0&&g.assetListLoader)return}if(this.bufferedPos=e,l>h&&l>o)this.bufferedToItem(d);else {const g=this.primaryDetails;this.primaryLive&&g&&e>g.edge-g.targetduration&&d.start{const n=this.getAssetPlayer(i.identifier);return !(n!=null&&n.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,s=this.schedule;if(!this.itemsMatch(e,t)&&s){const{items:i,events:n}=s;if(!i||!n)return t;const a=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const l=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Re(e)}`+(t?` (${l.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const c=s.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((h,u)=>{const d=this.getAssetPlayer(h.identifier);d&&(u===c&&d.loadSource(),d.resumeBuffering());});}else this.hls.resumeBuffering(),this.playerQueue.forEach(c=>c.pauseBuffering());this.hls.trigger(y.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:n.slice(0),schedule:i.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)});}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const s=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(s!==null){this.bufferingAsset=null;const i=this.detachedData;i?i.mediaSource?this.attachPrimary(e.start,e,true):this.preloadPrimary(e):this.preloadPrimary(e);}}}preloadPrimary(e){const t=this.findItemIndex(e),s=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(s);}bufferedToEvent(e,t){const s=e.event,i=s.assetList.length===0&&!s.assetListLoader,n=s.cue.once;if(i||!n){const a=this.preloadAssets(s,t);if(a!=null&&a.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(a,o);}}}preloadAssets(e,t){const s=e.assetUrl,i=e.assetList.length,n=i===0&&!e.assetListLoader,a=e.cue.once;if(n){const l=e.timelineStart;if(e.appendInPlace){var o;const d=this.playingItem;!this.isInterstitial(d)&&(d==null||(o=d.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(l+.25);}let c,h=0;if(!this.playingItem&&this.primaryLive&&(h=this.hls.startPosition,h===-1&&(h=this.hls.liveSyncPosition||0)),h&&!(e.cue.pre||e.cue.post)){const d=h-l;d>0&&(c=Math.round(d*1e3)/1e3);}if(this.log(`Load interstitial asset ${t+1}/${s?1:i} ${e}${c?` live-start: ${h} start-offset: ${c}`:""}`),s)return this.createAsset(e,0,0,l,e.duration,s);const u=this.assetListLoader.loadAssetList(e,c);u&&(e.assetListLoader=u);}else if(!a&&i){for(let c=t;c{this.hls.trigger(y.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:i});});}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let s=0;s1){const I=t.duration;I&&A{if(A.live){var I;const L=new Error(`Interstitials MUST be VOD assets ${e}`),b={fatal:true,type:G.OTHER_ERROR,details:_.INTERSTITIAL_ASSET_ITEM_ERROR,error:L},R=((I=this.schedule)==null?void 0:I.findEventIndex(e.identifier))||-1;this.handleAssetItemError(b,e,R,s,L.message);return}const D=A.edge-A.fragmentStart,v=t.duration;(m||v===null||D>v)&&(m=false,this.log(`Interstitial asset "${u}" duration change ${v} > ${D}`),t.duration=D,this.updateSchedule());};f.on(y.LEVEL_UPDATED,(A,{details:I})=>p(I)),f.on(y.LEVEL_PTS_UPDATED,(A,{details:I})=>p(I)),f.on(y.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const S=(A,I)=>{const D=this.getAssetPlayer(u);if(D&&I.tracks){D.off(y.BUFFER_CODECS,S),D.tracks=I.tracks;const v=this.primaryMedia;this.bufferingAsset===D.assetItem&&v&&!D.media&&this.bufferAssetPlayer(D,v);}};f.on(y.BUFFER_CODECS,S);const E=()=>{var A;const I=this.getAssetPlayer(u);if(this.log(`buffered to end of asset ${I}`),!I||!this.schedule)return;const D=this.schedule.findEventIndex(e.identifier),v=(A=this.schedule.items)==null?void 0:A[D];this.isInterstitial(v)&&this.advanceAssetBuffering(v,t);};f.on(y.BUFFERED_TO_END,E);const T=A=>()=>{if(!this.getAssetPlayer(u)||!this.schedule)return;this.shouldPlay=true;const D=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,D,A);};return f.once(y.MEDIA_ENDED,T(s)),f.once(y.PLAYOUT_LIMIT_REACHED,T(1/0)),f.on(y.ERROR,(A,I)=>{if(!this.schedule)return;const D=this.getAssetPlayer(u);if(I.details===_.BUFFER_STALLED_ERROR){if(D!=null&&D.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(true);return}this.handleAssetItemError(I,e,this.schedule.findEventIndex(e.identifier),s,`Asset player error ${I.error} ${e}`);}),f.on(y.DESTROYING,()=>{if(!this.getAssetPlayer(u)||!this.schedule)return;const I=new Error(`Asset player destroyed unexpectedly ${u}`),D={fatal:true,type:G.OTHER_ERROR,details:_.INTERSTITIAL_ASSET_ITEM_ERROR,error:I};this.handleAssetItemError(D,e,this.schedule.findEventIndex(e.identifier),s,I.message);}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${at(t)}`),this.hls.trigger(y.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:s,event:e,player:f}),f}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset();}clearAssetPlayers(e,t){e.assetList.forEach(s=>{this.clearAssetPlayer(s.identifier,t);});}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const s=this.playerQueue[t];this.transferMediaFromPlayer(s,null),s.resetDetails();}}clearAssetPlayer(e,t){const s=this.getAssetPlayerQueueIndex(e);if(s!==-1){const i=this.playerQueue[s];this.log(`clear ${i} toSegment: ${t&&Re(t)}`),this.transferMediaFromPlayer(i,t),this.playerQueue.splice(s,1),i.destroy();}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[];}startAssetPlayer(e,t,s,i,n){const{interstitial:a,assetItem:o,assetId:l}=e,c=a.assetList.length,h=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!h||h.identifier!==l)&&(h&&(this.clearAssetPlayer(h.identifier,s[i]),delete h.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${c} ${at(o)}`),this.hls.trigger(y.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:a,schedule:s.slice(0),scheduleIndex:i,player:e})),this.bufferAssetPlayer(e,n);}bufferAssetPlayer(e,t){var s,i;if(!this.schedule)return;const{interstitial:n,assetItem:a}=e,o=this.schedule.findEventIndex(n.identifier),l=(s=this.schedule.items)==null?void 0:s[o];if(!l)return;e.loadSource(),this.setBufferingItem(l),this.bufferingAsset=a;const c=this.getBufferingPlayer();if(c===e)return;const h=n.appendInPlace;if(h&&c?.interstitial.appendInPlace===false)return;const u=c?.tracks||((i=this.detachedData)==null?void 0:i.tracks)||this.requiredTracks;if(h&&a!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(u&&!ln(u,e.tracks)){const d=new Error(`Asset ${at(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(u)}')`),g={fatal:true,type:G.OTHER_ERROR,details:_.INTERSTITIAL_ASSET_ITEM_ERROR,error:d},f=n.findAssetIndex(a);this.handleAssetItemError(g,n,o,f,d.message);return}}this.transferMediaTo(e,t);}handleInPlaceStall(e){const t=this.schedule,s=this.primaryMedia;if(!t||!s)return;const i=s.currentTime,n=t.findAssetIndex(e,i),a=e.assetList[n];if(a){const o=this.getAssetPlayer(a.identifier);if(o){const l=o.currentTime||i-a.timelineStart,c=o.duration-l;if(this.warn(`Stalled at ${l} of ${l+c} in ${o} ${e} (media.currentTime: ${i})`),l&&(c/s.playbackRate<.5||o.bufferedInPlaceToEnd(s))&&o.hls){const h=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,h,n);}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime!m.error))t.error=f;else for(let m=i;m{const S=parseFloat(m.DURATION);this.createAsset(n,p,h,l+h,S,m.URI),h+=S;}),n.duration=h,this.log(`Loaded asset-list with duration: ${h} (was: ${c}) ${n}`);const u=this.waitingItem,d=u?.event.identifier===a;this.updateSchedule();const g=(i=this.bufferingItem)==null?void 0:i.event;if(d){var f;const m=this.schedule.findEventIndex(a),p=(f=this.schedule.items)==null?void 0:f[m];if(p){if(!this.playingItem&&this.timelinePos>p.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==m){n.error=new Error(`Interstitial ${o.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${n}`),this.log(n.error.message),this.updateSchedule(true),this.primaryFallback(n);return}this.setBufferingItem(p);}this.setSchedulePosition(m);}else if(g?.identifier===a){const m=n.assetList[0];if(m){const p=this.getAssetPlayer(m.identifier);if(g.appendInPlace){const S=this.primaryMedia;p&&S&&this.bufferAssetPlayer(p,S);}else p&&p.loadSource();}}}onError(e,t){if(this.schedule)switch(t.details){case _.ASSET_LIST_PARSING_ERROR:case _.ASSET_LIST_LOAD_ERROR:case _.ASSET_LIST_LOAD_TIMEOUT:{const s=t.interstitial;s&&(this.updateSchedule(true),this.primaryFallback(s));break}case _.BUFFER_STALLED_ERROR:{const s=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&s.event.appendInPlace){this.handleInPlaceStall(s.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(true);break}}}}const Ji=500;class Ic extends kn{constructor(e,t,s){super(e,t,s,"subtitle-stream-controller",K.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners();}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null;}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(y.LEVEL_LOADED,this.onLevelLoaded,this),e.on(y.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(y.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(y.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(y.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(y.BUFFER_FLUSHING,this.onBufferFlushing,this);}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(y.LEVEL_LOADED,this.onLevelLoaded,this),e.off(y.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(y.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(y.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(y.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(y.BUFFER_FLUSHING,this.onBufferFlushing,this);}startLoad(e,t){this.stopLoad(),this.state=C.IDLE,this.setInterval(Ji),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick();}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null;}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t);}onLevelLoaded(e,t){this.mainDetails=t.details;}onSubtitleFragProcessed(e,t){const{frag:s,success:i}=t;if(this.fragContextChanged(s)||(ye(s)&&(this.fragPrevious=s),this.state=C.IDLE),!i)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const o=s.start;for(let c=0;c=n[c].start&&o<=n[c].end){a=n[c];break}const l=s.start+s.duration;a?a.end=l:(a={start:o,end:l},n.push(a)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null),this.media&&this.tick();}onBufferFlushing(e,t){const{startOffset:s,endOffset:i}=t;if(s===0&&i!==Number.POSITIVE_INFINITY){const n=i-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(a=>{for(let o=0;onew Vt(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{const i=new Vt(s);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,K.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null;}onSubtitleTrackSwitch(e,t){var s;if(this.currentTrackId=t.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.state!==C.STOPPED&&this.setInterval(Ji);}onSubtitleTrackLoaded(e,t){var s;const{currentTrackId:i,levels:n}=this,{details:a,id:o}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=n[o];if(o>=n.length||!l)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(a.live||(s=l.details)!=null&&s.live){if(a.deltaUpdateFailed)return;const u=this.mainDetails;if(!u){this.startFragRequested=false;return}const d=u.fragments[0];if(!l.details)a.hasProgramDateTime&&u.hasProgramDateTime?(qt(a,u),c=a.fragmentStart):d&&(c=d.start,_s(a,c));else {var h;c=this.alignPlaylists(a,l.details,(h=this.levelLastLoaded)==null?void 0:h.details),c===0&&d&&(c=d.start,_s(a,c));}u&&!this.startFragRequested&&this.setStartPosition(u,c);}l.details=a,this.levelLastLoaded=l,o===i&&(this.hls.trigger(y.SUBTITLE_TRACK_UPDATED,{details:a,id:o,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===C.IDLE&&(ht(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)));}_handleFragmentLoadComplete(e){const{frag:t,payload:s}=e,i=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&s&&s.byteLength>0&&i!=null&&i.key&&i.iv&&Gs(i.method)){const a=performance.now();this.decrypter.decrypt(new Uint8Array(s),i.key.buffer,i.iv.buffer,Ks(i.method)).catch(o=>{throw n.trigger(y.ERROR,{type:G.MEDIA_ERROR,details:_.FRAG_DECRYPT_ERROR,fatal:false,error:o,reason:o.message,frag:t}),o}).then(o=>{const l=performance.now();n.trigger(y.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:a,tdecrypt:l}});}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=C.IDLE;});}}doTick(){if(!this.media){this.state=C.IDLE;return}if(this.state===C.IDLE){const{currentTrackId:e,levels:t}=this,s=t?.[e];if(!s||!t.length||!s.details||this.waitForLive(s))return;const{config:i}=this,n=this.getLoadPosition(),a=J.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,i.maxBufferHole),{end:o,len:l}=a,c=s.details,h=this.hls.maxBufferLength+c.levelTargetDuration;if(l>h)return;const u=c.fragments,d=u.length,g=c.edge;let f=null;const m=this.fragPrevious;if(og-E?0:E;f=ht(m,u,Math.max(u[0].start,o),T),!f&&m&&m.start{if(i=i>>>0,i>n-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${n})`);return e[i][s]};this.buffered={get length(){return e.length},end(s){return t("end",s,e.length)},start(s){return t("start",s,e.length)}};}}const Lc={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},dr=r=>String.fromCharCode(Lc[r]||r),Le=15,Be=100,bc={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_c={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Dc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Pc={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Cc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class kc{constructor(){this.time=null,this.verboseLevel=0;}log(e,t){if(this.verboseLevel>=e){const s=typeof t=="function"?t():t;re.log(`${this.time} [${e}] ${s}`);}}}const Ze=function(e){const t=[];for(let s=0;sBe&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Be);}moveCursor(e){const t=this.pos+e;if(e>1)for(let s=this.pos+1;s=144&&this.backSpace();const t=dr(e);if(this.pos>=Be){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1);}clearFromPos(e){let t;for(t=e;t"pacData = "+se(e));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+se(e)),this.backSpace(),this.setPen(e),this.insertChar(32);}setRollUpRows(e){this.nrRollUpRows=e;}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up");}getDisplayText(e){e=e||false;const t=[];let s="",i=-1;for(let n=0;n0&&(e?s="["+t.join(" | ")+"]":s=t.join(` +`)),s}getTextAndFormat(){return this.rows}}class en{constructor(e,t,s){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Ss(s),this.nonDisplayedMemory=new Ss(s),this.lastOutputScreen=new Ss(s),this.currRollUpRow=this.displayedMemory.rows[Le-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s;}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Le-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null;}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e;}setPAC(e){this.writeScreen.setPAC(e);}setBkgData(e){this.writeScreen.setBkgData(e);}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e);}insertChars(e){for(let s=0;st+": "+this.writeScreen.getDisplayText(true)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(true)),this.outputDataUpdate());}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON");}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate());}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate();}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e);}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:true});}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON");}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT");}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT");}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(true);}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(true);}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset();}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText());}this.outputDataUpdate(true);}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e);}ccMIDROW(e){const t={flash:false};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else {const s=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[s];}this.logger.log(2,"MIDROW: "+se(t)),this.writeScreen.setPen(t);}outputDataUpdate(e=false){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory));}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e));}}class tn{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Mc(),this.logger=void 0;const i=this.logger=new kc;this.channels=[null,new en(e,t,i),new en(e+1,s,i)];}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t);}addData(e,t){this.logger.time=e;for(let s=0;s"["+Ze([t[s],t[s+1]])+"] -> ("+Ze([i,n])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(Fc(i,n,l)){Ft(null,null,l),this.logger.log(3,()=>"Repeated command ("+Ze([i,n])+") is dropped");continue}Ft(i,n,this.cmdHistory),a=this.parseCmd(i,n),a||(a=this.parseMidrow(i,n)),a||(a=this.parsePAC(i,n)),a||(a=this.parseBackgroundAttributes(i,n));}else Ft(null,null,l);if(!a&&(o=this.parseChars(i,n),o)){const h=this.currentChannel;h&&h>0?this.channels[h].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?");}!a&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Ze([i,n])+" orig: "+Ze([t[s],t[s+1]]));}}parseCmd(e,t){const s=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(s||i))return false;const n=e===20||e===21||e===23?1:2,a=this.channels[n];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=n,true}parseMidrow(e,t){let s=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),false;const i=this.channels[s];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Ze([e,t])+")"),true):false}return false}parsePAC(e,t){let s;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,n=(e===16||e===24)&&t>=64&&t<=95;if(!(i||n))return false;const a=e<=23?1:2;t>=64&&t<=95?s=a===1?bc[e]:Dc[e]:s=a===1?_c[e]:Pc[e];const o=this.channels[a];return o?(o.setPAC(this.interpretPAC(s,t)),this.currentChannel=a,true):false}interpretPAC(e,t){let s;const i={color:null,italics:false,indent:null,underline:false,row:e};return t>95?s=t-96:s=t-64,i.underline=(s&1)===1,s<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(i.italics=true,i.color="white"):i.indent=Math.floor((s-16)/2)*4,i}parseChars(e,t){let s,i=null,n=null;if(e>=25?(s=2,n=e-8):(s=1,n=e),n>=17&&n<=19){let a;n===17?a=t+80:n===18?a=t+112:a=t+144,this.logger.log(2,()=>"Special char '"+dr(a)+"' in channel "+s),i=[a];}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+Ze(i).join(",")),i}parseBackgroundAttributes(e,t){const s=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(s||i))return false;let n;const a={};e===16||e===24?(n=Math.floor((t-32)/2),a.background=Cc[n],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=true));const o=e<=23?1:2;return this.channels[o].setBkgData(a),true}reset(){for(let e=0;e100)throw new Error("Position must be between 0 and 100.");D=R,this.hasBeenReset=true;}})),Object.defineProperty(h,"positionAlign",n({},u,{get:function(){return v},set:function(R){const P=i(R);if(!P)throw new SyntaxError("An invalid or illegal string was specified.");v=P,this.hasBeenReset=true;}})),Object.defineProperty(h,"size",n({},u,{get:function(){return L},set:function(R){if(R<0||R>100)throw new Error("Size must be between 0 and 100.");L=R,this.hasBeenReset=true;}})),Object.defineProperty(h,"align",n({},u,{get:function(){return b},set:function(R){const P=i(R);if(!P)throw new SyntaxError("An invalid or illegal string was specified.");b=P,this.hasBeenReset=true;}})),h.displayState=void 0;}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a})();class Nc{decode(e,t){if(!e)return "";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function gr(r){function e(s,i,n,a){return (s|0)*3600+(i|0)*60+(n|0)+parseFloat(a||0)}const t=r.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class Bc{constructor(){this.values=Object.create(null);}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t);}get(e,t,s){return s?this.has(e)?this.values[e]:t[s]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,s){for(let i=0;i=0&&s<=100)return this.set(e,s),true}return false}}function mr(r,e,t,s){const i=s?r.split(s):[r];for(const n in i){if(typeof i[n]!="string")continue;const a=i[n].split(t);if(a.length!==2)continue;const o=a[0],l=a[1];e(o,l);}}const Fs=new Zs(0,0,""),Mt=Fs.align==="middle"?"middle":"center";function Uc(r,e,t){const s=r;function i(){const o=gr(r);if(o===null)throw new Error("Malformed timestamp: "+s);return r=r.replace(/^[^\sa-zA-Z-]+/,""),o}function n(o,l){const c=new Bc;mr(o,function(d,g){let f;switch(d){case "region":for(let m=t.length-1;m>=0;m--)if(t[m].id===g){c.set(d,t[m].region);break}break;case "vertical":c.alt(d,g,["rl","lr"]);break;case "line":f=g.split(","),c.integer(d,f[0]),c.percent(d,f[0])&&c.set("snapToLines",false),c.alt(d,f[0],["auto"]),f.length===2&&c.alt("lineAlign",f[1],["start",Mt,"end"]);break;case "position":f=g.split(","),c.percent(d,f[0]),f.length===2&&c.alt("positionAlign",f[1],["start",Mt,"end","line-left","line-right","auto"]);break;case "size":c.percent(d,g);break;case "align":c.alt(d,g,["start",Mt,"end","left","right"]);break}},/:/,/\s/),l.region=c.get("region",null),l.vertical=c.get("vertical","");let h=c.get("line","auto");h==="auto"&&Fs.line===-1&&(h=-1),l.line=h,l.lineAlign=c.get("lineAlign","start"),l.snapToLines=c.get("snapToLines",true),l.size=c.get("size",100),l.align=c.get("align",Mt);let u=c.get("position","auto");u==="auto"&&Fs.position===50&&(u=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=u;}function a(){r=r.replace(/^\s+/,"");}if(a(),e.startTime=i(),a(),r.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);r=r.slice(3),a(),e.endTime=i(),a(),n(r,e);}function pr(r){return r.replace(//gi,` +`)}class $c{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Nc,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0;}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:true}));function s(){let n=t.buffer,a=0;for(n=pr(n);a")===-1){t.cue.id=n;continue}case "CUE":if(!t.cue){t.state="BADCUE";continue}try{Uc(n,t.cue,t.regionList);}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case "CUETEXT":{const o=n.indexOf("-->")!==-1;if(!n||o&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=` +`),t.cue.text+=n;}continue;case "BADCUE":n||(t.state="ID");}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE";}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=` + +`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t);}return e.onflush&&e.onflush(),this}}const Gc=/\r\n|\n\r|\n|\r/g,Es=function(e,t,s=0){return e.slice(s,s+t.length)===t},Kc=function(e){let t=parseInt(e.slice(-3));const s=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!B(t)||!B(s)||!B(i)||!B(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*s,t+=60*1e3*i,t+=3600*1e3*n,t};function Js(r,e,t){return Et(r.toString())+Et(e.toString())+Et(t)}const Vc=function(e,t,s){let i=e[t],n=e[i.prevCC];if(!n||!n.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=false;return}for(;(a=n)!=null&&a.new;){var a;e.ccOffset+=i.start-n.start,i.new=false,i=n,n=e[i.prevCC];}e.presentationOffset=s;};function Hc(r,e,t,s,i,n,a){const o=new $c,l=Se(new Uint8Array(r)).trim().replace(Gc,` +`).split(` +`),c=[],h=e?zo(e.baseTime,e.timescale):0;let u="00:00.000",d=0,g=0,f,m=true;o.oncue=function(p){const S=t[s];let E=t.ccOffset;const T=(d-h)/9e4;if(S!=null&&S.new&&(g!==void 0?E=t.ccOffset=S.start:Vc(t,s,T)),T){if(!e){f=new Error("Missing initPTS for VTT MPEGTS");return}E=T-t.presentationOffset;}const A=p.endTime-p.startTime,I=pe((p.startTime+E-g)*9e4,i*9e4)/9e4;p.startTime=Math.max(I,0),p.endTime=Math.max(I+A,0);const D=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(D)),p.id||(p.id=Js(p.startTime,p.endTime,D)),p.endTime>0&&c.push(p);},o.onparsingerror=function(p){f=p;},o.onflush=function(){if(f){a(f);return}n(c);},l.forEach(p=>{if(m)if(Es(p,"X-TIMESTAMP-MAP=")){m=false,p.slice(16).split(",").forEach(S=>{Es(S,"LOCAL:")?u=S.slice(6):Es(S,"MPEGTS:")&&(d=parseInt(S.slice(7)));});try{g=Kc(u)/1e3;}catch(S){f=S;}return}else p===""&&(m=false);o.parse(p+` +`);}),o.flush();}const Ts="stpp.ttml.im1t",yr=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Sr=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Yc={left:"start",center:"center",right:"end",start:"start",end:"end"};function sn(r,e,t,s){const i=z(new Uint8Array(r),["mdat"]);if(i.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const n=i.map(o=>Se(o)),a=jo(e.baseTime,1,e.timescale);try{n.forEach(o=>t(Wc(o,a)));}catch(o){s(o);}}function Wc(r,e){const i=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((u,d)=>(u[d]=i.getAttribute(`ttp:${d}`)||n[d],u),{}),o=i.getAttribute("xml:space")!=="preserve",l=nn(xs(i,"styling","style")),c=nn(xs(i,"layout","region")),h=xs(i,"body","[begin]");return [].map.call(h,u=>{const d=Er(u,o);if(!d||!u.hasAttribute("begin"))return null;const g=As(u.getAttribute("begin"),a),f=As(u.getAttribute("dur"),a);let m=As(u.getAttribute("end"),a);if(g===null)throw rn(u);if(m===null){if(f===null)throw rn(u);m=g+f;}const p=new Zs(g-e,m-e,d);p.id=Js(p.startTime,p.endTime,p.text);const S=c[u.getAttribute("region")],E=l[u.getAttribute("style")],T=qc(S,E,l),{textAlign:A}=T;if(A){const I=Yc[A];I&&(p.lineAlign=I),p.align=A;}return ie(p,T),p}).filter(u=>u!==null)}function xs(r,e,t){const s=r.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(t)):[]}function nn(r){return r.reduce((e,t)=>{const s=t.getAttribute("xml:id");return s&&(e[s]=t),e},{})}function Er(r,e){return [].slice.call(r.childNodes).reduce((t,s,i)=>{var n;return s.nodeName==="br"&&i?t+` +`:(n=s.childNodes)!=null&&n.length?Er(s,e):e?t+s.textContent.trim().replace(/\s+/g," "):t+s.textContent},"")}function qc(r,e,t){const s="http://www.w3.org/ns/ttml#styling";let i=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=r!=null&&r.hasAttribute("style")?r.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(i=t[a]),n.reduce((o,l)=>{const c=vs(e,s,l)||vs(r,s,l)||vs(i,s,l);return c&&(o[l]=c),o},{})}function vs(r,e,t){return r&&r.hasAttributeNS(e,t)?r.getAttributeNS(e,t):null}function rn(r){return new Error(`Could not parse ttml timestamp ${r}`)}function As(r,e){if(!r)return null;let t=gr(r);return t===null&&(yr.test(r)?t=jc(r,e):Sr.test(r)&&(t=zc(r,e))),t}function jc(r,e){const t=yr.exec(r),s=(t[4]|0)+(t[5]|0)/e.subFrameRate;return (t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+s/e.frameRate}function zc(r,e){const t=Sr.exec(r),s=Number(t[1]);switch(t[2]){case "h":return s*3600;case "m":return s*60;case "ms":return s*1e3;case "f":return s/e.frameRate;case "t":return s/e.tickRate}return s}class Nt{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t;}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null);}newCue(e,t,s){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName);}reset(){this.cueRanges=[],this.startTime=null;}}class Qc{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=true,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=on(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(y.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(y.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(y.MANIFEST_LOADING,this.onManifestLoading,this),e.on(y.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(y.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(y.FRAG_LOADING,this.onFragLoading,this),e.on(y.FRAG_LOADED,this.onFragLoaded,this),e.on(y.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(y.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(y.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(y.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(y.BUFFER_FLUSHING,this.onBufferFlushing,this);}destroy(){const{hls:e}=this;e.off(y.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(y.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(y.MANIFEST_LOADING,this.onManifestLoading,this),e.off(y.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(y.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(y.FRAG_LOADING,this.onFragLoading,this),e.off(y.FRAG_LOADED,this.onFragLoaded,this),e.off(y.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(y.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(y.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(y.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(y.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0;}initCea608Parsers(){const e=new Nt(this,"textTrack1"),t=new Nt(this,"textTrack2"),s=new Nt(this,"textTrack3"),i=new Nt(this,"textTrack4");this.cea608Parser1=new tn(1,e,t),this.cea608Parser2=new tn(3,s,i);}addCues(e,t,s,i,n){let a=false;for(let o=n.length;o--;){const l=n[o],c=Xc(l[0],l[1],t,s);if(c>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],s),a=true,c/(s-t)>.5))return}if(a||n.push([t,s]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,s,i);}else {const o=this.Cues.newCue(null,t,s,i);this.hls.trigger(y.CUES_PARSED,{type:"captions",cues:o,track:e});}}onInitPtsFound(e,{frag:t,id:s,initPTS:i,timescale:n,trackId:a}){const{unparsedVttFrags:o}=this;s===K.MAIN&&(this.initPTS[t.cc]={baseTime:i,timescale:n,trackId:a}),o.length&&(this.unparsedVttFrags=[],o.forEach(l=>{this.initPTS[l.frag.cc]?this.onFragLoaded(y.FRAG_LOADED,l):this.hls.trigger(y.SUBTITLE_FRAG_PROCESSED,{success:false,frag:l.frag,error:new Error("Subtitle discontinuity domain does not match main")});}));}getExistingTrack(e,t){const{media:s}=this;if(s)for(let i=0;i{pt(i[n]),delete i[n];}),this.nonNativeCaptionsTracks={};}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=on(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset());}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let s=0;sn.textCodec===Ts);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(Xn(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const a=this.media,o=a?Kt(a.textTracks):null;if(this.tracks.forEach((l,c)=>{let h;if(o){let u=null;for(let d=0;dc!==null).map(c=>c.label);l.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`);}}else if(this.tracks.length){const a=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(y.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a});}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(s=>{const i=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!i)return;const n=`textTrack${i[1]}`,a=this.captionsProperties[n];a&&(a.label=s.name,s.lang&&(a.languageCode=s.lang),a.media=s);});}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===K.MAIN){var s,i;const{cea608Parser1:n,cea608Parser2:a,lastSn:o}=this,{cc:l,sn:c}=t.frag,h=(s=(i=t.part)==null?void 0:i.index)!=null?s:-1;n&&a&&(c!==o+1||c===o&&h!==this.lastPartIndex+1||l!==this.lastCc)&&(n.reset(),a.reset()),this.lastCc=l,this.lastSn=c,this.lastPartIndex=h;}}onFragLoaded(e,t){const{frag:s,payload:i}=t;if(s.type===K.SUBTITLE)if(i.byteLength){const n=s.decryptdata,a="stats"in t;if(n==null||!n.encrypted||a){const o=this.tracks[s.level],l=this.vttCCs;l[s.cc]||(l[s.cc]={start:s.start,prevCC:this.prevCC,new:true},this.prevCC=s.cc),o&&o.textCodec===Ts?this._parseIMSC1(s,i):this._parseVTTs(t);}}else this.hls.trigger(y.SUBTITLE_FRAG_PROCESSED,{success:false,frag:s,error:new Error("Empty subtitle payload")});}_parseIMSC1(e,t){const s=this.hls;sn(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),s.trigger(y.SUBTITLE_FRAG_PROCESSED,{success:true,frag:e});},i=>{s.logger.log(`Failed to parse IMSC1: ${i}`),s.trigger(y.SUBTITLE_FRAG_PROCESSED,{success:false,frag:e,error:i});});}_parseVTTs(e){var t;const{frag:s,payload:i}=e,{initPTS:n,unparsedVttFrags:a}=this,o=n.length-1;if(!n[s.cc]&&o===-1){a.push(e);return}const l=this.hls,c=(t=s.initSegment)!=null&&t.data?Ae(s.initSegment.data,new Uint8Array(i)).buffer:i;Hc(c,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,h=>{this._appendCues(h,s.level),l.trigger(y.SUBTITLE_FRAG_PROCESSED,{success:true,frag:s});},h=>{const u=h.message==="Missing initPTS for VTT MPEGTS";u?a.push(e):this._fallbackToIMSC1(s,i),l.logger.log(`Failed to parse VTT cue: ${h}`),!(u&&o>s.cc)&&l.trigger(y.SUBTITLE_FRAG_PROCESSED,{success:false,frag:s,error:h});});}_fallbackToIMSC1(e,t){const s=this.tracks[e.level];s.textCodec||sn(t,this.initPTS[e.cc],()=>{s.textCodec=Ts,this._parseIMSC1(e,t);},()=>{s.textCodec="wvtt";});}_appendCues(e,t){const s=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(n=>hr(i,n));}else {const i=this.tracks[t];if(!i)return;const n=i.default?"default":"subtitles"+t;s.trigger(y.CUES_PARSED,{type:"subtitles",cues:e,track:n});}}onFragDecrypted(e,t){const{frag:s}=t;s.type===K.SUBTITLE&&this.onFragLoaded(y.FRAG_LOADED,t);}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={};}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:s,samples:i}=t;if(!(s.type===K.MAIN&&this.closedCaptionsForLevel(s)==="NONE"))for(let n=0;nQi(o[l],t,s));}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>Qi(o[l],t,i));}}}extractCea608Data(e){const t=[[],[]],s=e[0]&31;let i=2;for(let n=0;n=16?l--:l++;const g=pr(c.trim()),f=Js(e,t,g);r!=null&&(u=r.cues)!=null&&u.getCueById(f)||(a=new h(e,t,g),a.id=f,a.line=d+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),i.push(a));}return r&&i.length&&(i.sort((d,g)=>d.line==="auto"||g.line==="auto"?0:d.line>8&&g.line>8?g.line-d.line:d.line-g.line),i.forEach(d=>hr(r,d))),i}},eh=/^age:\s*[\d.]+\s*$/im;class th{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Fr,this.retryDelay=0;}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null;}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=true,e.abort()));}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader);}load(e,t,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=s,this.loadInternal();}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const s=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=false;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==s||this.stats.aborted))return n(s,t.url)}).catch(a=>{if(!(this.loader!==s||this.stats.aborted))return s.open("GET",t.url,true),n(s,t.url)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,t,e);}).catch(a=>{var o;(o=this.callbacks)==null||o.onError({code:s.status,text:a.message},t,s,i);}):this.openAndSendXhr(s,t,e);}openAndSendXhr(e,t,s){e.readyState||e.open("GET",t.url,true);const i=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=s.loadPolicy;if(i)for(const o in i)e.setRequestHeader(o,i[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),s.timeout=n&&B(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send();}readystatechange(){const{context:e,loader:t,stats:s}=this;if(!e||!t)return;const i=t.readyState,n=this.config;if(!s.aborted&&i>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const c=t.status,h=t.responseType==="text"?t.responseText:null;if(c>=200&&c<300){const f=h??t.response;if(f!=null){var a,o;s.loading.end=Math.max(self.performance.now(),s.loading.first);const m=t.responseType==="arraybuffer"?f.byteLength:f.length;s.loaded=s.total=m,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);const p=(a=this.callbacks)==null?void 0:a.onProgress;p&&p(s,e,f,t);const S={url:t.responseURL,data:f,code:c};(o=this.callbacks)==null||o.onSuccess(S,s,e,t);return}}const u=n.loadPolicy.errorRetry,d=s.retry,g={url:e.url,data:void 0,code:c};if(Yt(u,d,false,g))this.retry(u);else {var l;re.error(`${c} while loading ${e.url}`),(l=this.callbacks)==null||l.onError({code:c,text:t.statusText},e,t,s);}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Yt(e,t,true))this.retry(e);else {var s;re.warn(`timeout while loading ${(s=this.context)==null?void 0:s.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader));}}retry(e){const{context:t,stats:s}=this;this.retryDelay=Us(e,s.retry),s.retry++,re.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${s.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay);}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total);}getCacheAge(){let e=null;if(this.loader&&eh.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null;}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const sh={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null};ee(ee({autoStartLoad:true,startPosition:-1,defaultAudioCodec:void 0,debug:false,capLevelOnFPSDrop:false,capLevelToPlayerSize:false,ignoreDevicePixelRatio:false,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:true,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:false,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:true,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:false,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:true,workerPath:null,enableSoftwareAES:true,startLevel:void 0,startFragPrefetch:false,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:false,loader:th,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:ya,bufferController:ul,capLevelController:zs,errorController:va,fpsController:dc,stretchShortVideoTrack:false,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:true,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:false,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:false,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Rn,requireKeySystemAccessOnStart:false,testBandwidth:true,progressive:false,lowLatencyMode:true,cmcd:void 0,enableDateRangeMetadataCues:true,enableEmsgMetadataCues:true,enableEmsgKLVMetadata:false,enableID3MetadataCues:true,enableInterstitialPlayback:true,interstitialAppendInPlace:true,interstitialLiveLookAhead:10,useMediaCapabilities:true,preserveManualLevelOnError:false,certLoadPolicy:{default:sh},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},ih()),{},{subtitleStreamController:Ic,subtitleTrackController:pc,timelineController:Qc,audioStreamController:ol,audioTrackController:ll,emeController:lt,cmcdController:lc,contentSteeringController:hc,interstitialsController:Ac});function ih(){return {cueHandler:Jc,enableWebVTT:true,enableIMSC1:true,enableCEA708Captions:true,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:true}}function nh(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}(()=>{const r=nh();try{r&&new r(0,Number.POSITIVE_INFINITY,"");}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function ch(r,e){r.component(t=>{let{src:s=void 0,muted:i=void 0,playsinline:n=void 0,preload:a=void 0,autoplay:o=void 0,controls:l=void 0,currentTime:c=void 0,duration:h=void 0,paused:u=void 0,node:d=void 0,loop:g,is_stream:f,processingVideo:m=false,onloadeddata:p,onclick:S,onplay:E,onpause:T,onended:A,onmouseover:I,onmouseout:D,onfocus:v,onblur:L,onerror:b,onloadstart:R,onloadedmetadata:P,"data-testid":O,children:N}=e;t.push(` `),N?(t.push(""),N(t),t.push("")):t.push(""),t.push(""),bind_props(e,{currentTime:c,duration:h,paused:u,node:d});});} + +export { ch as c }; +//# sourceMappingURL=Video2-BN5I0jvO.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/WebGLRenderer-DHwOMpnC.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/WebGLRenderer-DHwOMpnC.js new file mode 100644 index 0000000000000000000000000000000000000000..6f6a17ccaf9444ed9b343746ac2bcaa882c322ec --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/WebGLRenderer-DHwOMpnC.js @@ -0,0 +1,191 @@ +import { A as ko, R as Ss, E as B, a9 as rc, e as ft$1, w as J$1, S as ll, y as ve$1, s as Mi, t as W$1, k as It$1, D as $, aa as Ql, G as Bc, B as vt$1, O as tl, b as ql, ab as kc, ad as Ec, M as H$1, l as fo, ac as Sc, ae as Ic, af as Rc, W as Z, j as $n, i as bo } from './Index4-BvPFZOEY.js'; +import { n } from './colorToUniform-CrQRsPlb.js'; +import { W as Wt, z as zt, E as Et$1, L as Lt, D as Dt$1, b, I as It$2, O as Ot, l as lt$1, H as Ht, C as C$1 } from './SharedSystems-CTk4bhlr.js'; +import './async-D55cHugf.js'; +import './index-u8mz_F03.js'; +import './escaping-CBnpiEl5.js'; +import './context-CBkBucIx.js'; +import './2-BLdXJizP.js'; +import './index5-BoOEKc6P.js'; +import './dev-fallback-Bc5Ork7Y.js'; +import './index-Cg-Pg6j3.js'; +import './index-server-CQz6EZl_.js'; +import './utils.svelte-B2py64Fz.js'; +import './clone-Yk88IHKV.js'; +import './ImagePreview-Ca2hvNZZ.js'; +import './BlockLabel-bKYWnOzQ.js'; +import './DownloadLink-nj1p0krE.js'; +import './IconButton-BRnu7KaR.js'; +import './Empty-DGRbZO0a.js'; +import './ShareButton-7VTs9dOO.js'; +import './Download-DcU5dONL.js'; +import './Image2-vcp9_ifi.js'; +import './IconButtonWrapper-CjFRPb3y.js'; +import './FullscreenButton-D8PvgSmk.js'; +import './Maximize-CuHbK64j.js'; +import './Image-CuPo5pWT.js'; +import './Block-DZmzQwnI.js'; +import './index3-Df92vI-L.js'; +import './Clear-D7Yjckqz.js'; +import './tinycolor-DfhFic3A.js'; +import './Check-C7_ZsXgh.js'; + +class J{constructor(){this._tempState=ll.for2d(),this._didUploadHash={};}init(e){e.renderer.runners.contextChange.add(this);}contextChange(){this._didUploadHash={};}start(e,r,s){const n=e.renderer,i=this._didUploadHash[s.uid];n.shader.bind(s,i),i||(this._didUploadHash[s.uid]=true),n.shader.updateUniformGroup(n.globalUniforms.uniformGroup),n.geometry.bind(r,s.glProgram);}execute(e,r){const s=e.renderer;this._tempState.blendMode=r.blendMode,s.state.set(this._tempState);const n=r.textures.textures;for(let i=0;i(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(x||{});class Ve{constructor(e,r){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=r;}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1;}}class ee{constructor(e){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._managedBuffers=new Bc({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"});}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={};}contextChange(){this._gl=this._renderer.gl,this.destroyAll(true),this._maxBindings=this._renderer.limits.maxUniformBindings;}getGlBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this.createGLBuffer(e)}bind(e){const{_gl:r}=this,s=this.getGlBuffer(e);r.bindBuffer(s.type,s.buffer);}bindBufferBase(e,r){const{_gl:s}=this;this._boundBufferBases[r]!==e&&(this._boundBufferBases[r]=e,e._lastBindBaseLocation=r,s.bindBufferBase(s.UNIFORM_BUFFER,r,e.buffer));}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1));}freeLocationForBufferBase(e){let r=this.getLastBindBaseLocation(e);if(r>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,r;let s=0,n=this._nextBindBaseIndex;for(;s<2;){n>=this._maxBindings&&(n=this._minBaseLocation,s++);const i=this._boundBufferBases[n];if(i&&i._lastBindCallId===this._bindCallId){n++;continue}break}return r=n,this._nextBindBaseIndex=n+1,s>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[r]=null,r)}getLastBindBaseLocation(e){const r=e._lastBindBaseLocation;return this._boundBufferBases[r]===e?r:-1}bindBufferRange(e,r,s,n){const{_gl:i}=this;s||(s=0),r||(r=0),this._boundBufferBases[r]=null,i.bindBufferRange(i.UNIFORM_BUFFER,r||0,e.buffer,s*256,n||256);}updateBuffer(e){const{_gl:r}=this,s=this.getGlBuffer(e);if(e._updateID===s.updateID)return s;s.updateID=e._updateID,r.bindBuffer(s.type,s.buffer);const n=e.data,i=e.descriptor.usage&vt$1.STATIC?r.STATIC_DRAW:r.DYNAMIC_DRAW;return n?s.byteLength>=n.byteLength?r.bufferSubData(s.type,0,n,0,e._updateSize/n.BYTES_PER_ELEMENT):(s.byteLength=n.byteLength,r.bufferData(s.type,n,i)):(s.byteLength=e.descriptor.size,r.bufferData(s.type,s.byteLength,i)),s}destroyAll(e=false){this._managedBuffers.removeAll(e);}onBufferUnload(e,r=false){const s=e._gpuData[this._renderer.uid];s&&(r||this._gl.deleteBuffer(s.buffer));}createGLBuffer(e){const{_gl:r}=this;let s=x.ARRAY_BUFFER;e.descriptor.usage&vt$1.INDEX?s=x.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&vt$1.UNIFORM&&(s=x.UNIFORM_BUFFER);const n=new Ve(r.createBuffer(),s);return e._gpuData[this._renderer.uid]=n,this._managedBuffers.add(e),n}resetState(){this._boundBufferBases=Object.create(null);}}ee.extension={type:[B.WebGLSystem],name:"buffer"};const P=class te{constructor(e){this.supports={uint32Indices:true,uniformBufferObject:true,vertexArrayObject:true,srgbTextures:true,nonPowOf2wrapping:true,msaa:true,nonPowOf2mipmaps:true},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this);}get isLost(){return !this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e;}init(e){e={...te.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(J$1("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=false),r?this.canvas=$.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else {const s=this._renderer.background.alpha<1,n=e.premultipliedAlpha??true,i=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:s,premultipliedAlpha:n,antialias:i,stencil:true,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"});}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&J$1("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:r}=this;(r.width{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext();},0));}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl);}destroy(){const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext();}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=true;}validateContext(e){const r=e.getContextAttributes();r&&!r.stencil&&J$1("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=this.supports,n=this.webGLVersion===2,i=this.extensions;s.uint32Indices=n||!!i.uint32ElementIndex,s.uniformBufferObject=n,s.vertexArrayObject=n||!!i.vertexArrayObject,s.srgbTextures=n||!!i.srgb,s.nonPowOf2wrapping=n,s.nonPowOf2mipmaps=n,s.msaa=n,s.uint32Indices||J$1("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly");}};P.extension={type:[B.WebGLSystem],name:"context"};P.defaultOptions={context:null,premultipliedAlpha:true,preserveDrawingBuffer:false,powerPreference:void 0,preferWebGLVersion:2,multiView:false};let Xe=P;var D=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(D||{}),re=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(re||{}),f=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(f||{});const H={uint8x2:f.UNSIGNED_BYTE,uint8x4:f.UNSIGNED_BYTE,sint8x2:f.BYTE,sint8x4:f.BYTE,unorm8x2:f.UNSIGNED_BYTE,unorm8x4:f.UNSIGNED_BYTE,snorm8x2:f.BYTE,snorm8x4:f.BYTE,uint16x2:f.UNSIGNED_SHORT,uint16x4:f.UNSIGNED_SHORT,sint16x2:f.SHORT,sint16x4:f.SHORT,unorm16x2:f.UNSIGNED_SHORT,unorm16x4:f.UNSIGNED_SHORT,snorm16x2:f.SHORT,snorm16x4:f.SHORT,float16x2:f.HALF_FLOAT,float16x4:f.HALF_FLOAT,float32:f.FLOAT,float32x2:f.FLOAT,float32x3:f.FLOAT,float32x4:f.FLOAT,uint32:f.UNSIGNED_INT,uint32x2:f.UNSIGNED_INT,uint32x3:f.UNSIGNED_INT,uint32x4:f.UNSIGNED_INT,sint32:f.INT,sint32x2:f.INT,sint32x3:f.INT,sint32x4:f.INT};function We(t){return H[t]??H.float32}const je={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class Ke{constructor(){this.vaoCache=Object.create(null);}destroy(){this.vaoCache=Object.create(null);}}class se{constructor(e){this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=true,this.hasInstance=true,this._managedGeometries=new Bc({renderer:e,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"});}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");this.destroyAll(true);const r=this._renderer.context.extensions.vertexArrayObject;r&&(e.createVertexArray=()=>r.createVertexArrayOES(),e.bindVertexArray=n=>r.bindVertexArrayOES(n),e.deleteVertexArray=n=>r.deleteVertexArrayOES(n));const s=this._renderer.context.extensions.vertexAttribDivisorANGLE;s&&(e.drawArraysInstanced=(n,i,a,o)=>{s.drawArraysInstancedANGLE(n,i,a,o);},e.drawElementsInstanced=(n,i,a,o,c)=>{s.drawElementsInstancedANGLE(n,i,a,o,c);},e.vertexAttribDivisor=(n,i)=>s.vertexAttribDivisorANGLE(n,i)),this._activeGeometry=null,this._activeVao=null;}bind(e,r){const s=this.gl;this._activeGeometry=e;const n=this.getVao(e,r);this._activeVao!==n&&(this._activeVao=n,s.bindVertexArray(n)),this.updateBuffers();}resetState(){this.unbind();}updateBuffers(){const e=this._activeGeometry,r=this._renderer.buffer;for(let s=0;s":8,"vec3":12,"vec4":16,"vec2":8,"vec3":12,"vec4":16,"mat2x2":32,"mat3x3":48,"mat4x4":64};function qe(t){const e=t.map(i=>({data:i,offset:0,size:0})),r=16;let s=0,n=0;for(let i=0;i1&&(s=Math.max(s,r)*a.data.size);const o=s===12?16:s;a.size=s;const c=n%r;c>0&&r-c=0?"dataInt32":"data";return ` + v = uv.${t.data.name}; + offset += ${e}; + + arrayOffset = offset; + + t = 0; + + for(var i=0; i < ${t.data.size*r}; i++) + { + for(var j = 0; j < ${s}; j++) + { + ${i}[arrayOffset++] = v[t++]; + } + ${n!==0?`arrayOffset += ${n};`:""} + } + `}function Qe(t){return Ot(t,"uboStd40",Ze,lt$1)}class _e extends Et$1{constructor(){super({createUboElements:qe,generateUboSync:Qe});}}_e.extension={type:[B.WebGLSystem],name:"ubo"};class Je{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new Z;}init(e,r){this._renderer=e,this._renderTargetSystem=r,e.runners.contextChange.add(this);}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new Z;const e=this._renderer.gl;this._drawBuffersCache=[];for(let r=1;r<=16;r++)this._drawBuffersCache[r]=Array.from({length:r},(s,n)=>e.COLOR_ATTACHMENT0+n);}copyToTexture(e,r,s,n,i){const a=this._renderTargetSystem,o=this._renderer,c=a.getGpuRenderTarget(e),u=o.gl;return this.finishRenderPass(e),u.bindFramebuffer(u.FRAMEBUFFER,c.resolveTargetFramebuffer),o.texture.bind(r,0),u.copyTexSubImage2D(u.TEXTURE_2D,0,i.x,i.y,s.x,s.y,n.width,n.height),r}startRenderPass(e,r=true,s,n){const i=this._renderTargetSystem,a=e.colorTexture,o=i.getGpuRenderTarget(e);let c=n.y;e.isRoot&&(c=a.pixelHeight-n.height-n.y),e.colorTextures.forEach(h=>{this._renderer.texture.unbind(h);});const u=this._renderer.gl;u.bindFramebuffer(u.FRAMEBUFFER,o.framebuffer),e.colorTextures.length>1&&this._setDrawBuffers(e,u);const _=this._viewPortCache;(_.x!==n.x||_.y!==c||_.width!==n.width||_.height!==n.height)&&(_.x=n.x,_.y=c,_.width=n.width,_.height=n.height,u.viewport(n.x,c,n.width,n.height)),!o.depthStencilRenderBuffer&&(e.stencil||e.depth)&&this._initStencil(o),this.clear(e,r,s);}finishRenderPass(e){const s=this._renderTargetSystem.getGpuRenderTarget(e);if(!s.msaa)return;const n=this._renderer.gl;n.bindFramebuffer(n.FRAMEBUFFER,s.resolveTargetFramebuffer),n.bindFramebuffer(n.READ_FRAMEBUFFER,s.framebuffer),n.blitFramebuffer(0,0,s.width,s.height,0,0,s.width,s.height,n.COLOR_BUFFER_BIT,n.NEAREST),n.bindFramebuffer(n.FRAMEBUFFER,s.framebuffer);}initGpuRenderTarget(e){const s=this._renderer.gl,n=new Ye;return e.colorTexture instanceof $n?(this._renderer.context.ensureCanvasSize(e.colorTexture.resource),n.framebuffer=null,n):(this._initColor(e,n),s.bindFramebuffer(s.FRAMEBUFFER,null),n)}destroyGpuRenderTarget(e){const r=this._renderer.gl;e.framebuffer&&(r.deleteFramebuffer(e.framebuffer),e.framebuffer=null),e.resolveTargetFramebuffer&&(r.deleteFramebuffer(e.resolveTargetFramebuffer),e.resolveTargetFramebuffer=null),e.depthStencilRenderBuffer&&(r.deleteRenderbuffer(e.depthStencilRenderBuffer),e.depthStencilRenderBuffer=null),e.msaaRenderBuffer.forEach(s=>{r.deleteRenderbuffer(s);}),e.msaaRenderBuffer=null;}clear(e,r,s){if(!r)return;const n=this._renderTargetSystem;typeof r=="boolean"&&(r=r?bo.ALL:bo.NONE);const i=this._renderer.gl;if(r&bo.COLOR){s??(s=n.defaultClearColor);const a=this._clearColorCache,o=s;(a[0]!==o[0]||a[1]!==o[1]||a[2]!==o[2]||a[3]!==o[3])&&(a[0]=o[0],a[1]=o[1],a[2]=o[2],a[3]=o[3],i.clearColor(o[0],o[1],o[2],o[3]));}i.clear(r);}resizeGpuRenderTarget(e){if(e.isRoot)return;const s=this._renderTargetSystem.getGpuRenderTarget(e);this._resizeColor(e,s),(e.stencil||e.depth)&&this._resizeStencil(s);}_initColor(e,r){const s=this._renderer,n=s.gl,i=n.createFramebuffer();if(r.resolveTargetFramebuffer=i,n.bindFramebuffer(n.FRAMEBUFFER,i),r.width=e.colorTexture.source.pixelWidth,r.height=e.colorTexture.source.pixelHeight,e.colorTextures.forEach((o,c)=>{const u=o.source;u.antialias&&(s.context.supports.msaa?r.msaa=true:J$1("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),s.texture.bindSource(u,0);const h=s.texture.getGlSource(u).texture;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+c,3553,h,0);}),r.msaa){const o=n.createFramebuffer();r.framebuffer=o,n.bindFramebuffer(n.FRAMEBUFFER,o),e.colorTextures.forEach((c,u)=>{const _=n.createRenderbuffer();r.msaaRenderBuffer[u]=_;});}else r.framebuffer=i;this._resizeColor(e,r);}_resizeColor(e,r){const s=e.colorTexture.source;if(r.width=s.pixelWidth,r.height=s.pixelHeight,e.colorTextures.forEach((n,i)=>{i!==0&&n.source.resize(s.width,s.height,s._resolution);}),r.msaa){const n=this._renderer,i=n.gl,a=r.framebuffer;i.bindFramebuffer(i.FRAMEBUFFER,a),e.colorTextures.forEach((o,c)=>{const u=o.source;n.texture.bindSource(u,0);const h=n.texture.getGlSource(u).internalFormat,l=r.msaaRenderBuffer[c];i.bindRenderbuffer(i.RENDERBUFFER,l),i.renderbufferStorageMultisample(i.RENDERBUFFER,4,h,u.pixelWidth,u.pixelHeight),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+c,i.RENDERBUFFER,l);});}}_initStencil(e){if(e.framebuffer===null)return;const r=this._renderer.gl,s=r.createRenderbuffer();e.depthStencilRenderBuffer=s,r.bindRenderbuffer(r.RENDERBUFFER,s),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,s),this._resizeStencil(e);}_resizeStencil(e){const r=this._renderer.gl;r.bindRenderbuffer(r.RENDERBUFFER,e.depthStencilRenderBuffer),e.msaa?r.renderbufferStorageMultisample(r.RENDERBUFFER,4,r.DEPTH24_STENCIL8,e.width,e.height):r.renderbufferStorage(r.RENDERBUFFER,this._renderer.context.webGLVersion===2?r.DEPTH24_STENCIL8:r.DEPTH_STENCIL,e.width,e.height);}prerender(e){const r=e.colorTexture.resource;this._renderer.context.multiView&&$n.test(r)&&this._renderer.context.ensureCanvasSize(r);}postrender(e){if(this._renderer.context.multiView&&$n.test(e.colorTexture.resource)){const r=this._renderer.context.canvas,s=e.colorTexture;s.context2D.drawImage(r,0,s.pixelHeight-r.height);}}_setDrawBuffers(e,r){const s=e.colorTextures.length,n=this._drawBuffersCache[s];if(this._renderer.context.webGLVersion===1){const i=this._renderer.context.extensions.drawBuffers;i?i.drawBuffersWEBGL(n):J$1("[RenderTexture] This WebGL1 context does not support rendering to multiple targets");}else r.drawBuffers(n);}}class fe extends Lt{constructor(e){super(e),this.adaptor=new Je,this.adaptor.init(e,this);}}fe.extension={type:[B.WebGLSystem],name:"renderTarget"};function et(t,e){const r=[],s=[` + var g = s.groups; + var sS = r.shader; + var p = s.glProgram; + var ugS = r.uniformGroup; + var resources; + `];let n=false,i=0;const a=e._getProgramData(t.glProgram);for(const c in t.groups){const u=t.groups[c];r.push(` + resources = g[${c}].resources; + `);for(const _ in u.resources){const h=u.resources[_];if(h instanceof fo)if(h.ubo){const l=t._uniformBindMap[c][Number(_)];r.push(` + sS.bindUniformBlock( + resources[${_}], + '${l}', + ${t.glProgram._uniformBlockData[l].index} + ); + `);}else r.push(` + ugS.updateUniformGroup(resources[${_}], p, sD); + `);else if(h instanceof Ht){const l=t._uniformBindMap[c][Number(_)];r.push(` + sS.bindUniformBlock( + resources[${_}], + '${l}', + ${t.glProgram._uniformBlockData[l].index} + ); + `);}else if(h instanceof It$1){const l=t._uniformBindMap[c][_],E=a.uniformData[l];E&&(n||(n=true,s.push(` + var tS = r.texture; + `)),e._gl.uniform1i(E.location,i),r.push(` + tS.bind(resources[${_}], ${i}); + `),i++);}}}const o=[...s,...r].join(` +`);return new Function("r","s","sD",o)}class tt{constructor(e,r){this.program=e,this.uniformData=r,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={};}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null;}}function k(t,e,r){const s=t.createShader(e);return t.shaderSource(s,r),t.compileShader(s),s}function y(t){const e=new Array(t);for(let r=0;ra>o?1:-1);for(let a=0;a`${_}: ${u}`),s=t.getShaderInfoLog(e),n=s.split(` +`),i={},a=n.map(u=>parseFloat(u.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(u=>u&&!i[u]?(i[u]=true,true):false),o=[""];a.forEach(u=>{r[u-1]=`%c${r[u-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px");});const c=r.join(` +`);o[0]=c,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd();}function ot(t,e,r,s){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||X(t,r),t.getShaderParameter(s,t.COMPILE_STATUS)||X(t,s),console.error("PixiJS Error: Could not initialize shader."),t.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)));}function ct(t,e){const r=k(t,t.VERTEX_SHADER,e.vertex),s=k(t,t.FRAGMENT_SHADER,e.fragment),n=t.createProgram();t.attachShader(n,r),t.attachShader(n,s);const i=e.transformFeedbackVaryings;i&&(typeof t.transformFeedbackVaryings!="function"?J$1("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(n,i.names,i.bufferMode==="separate"?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||ot(t,n,r,s),e._attributeData=nt(n,t,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertex)),e._uniformData=at(n,t),e._uniformBlockData=it(n,t),t.deleteShader(r),t.deleteShader(s);const a={};for(const c in e._uniformData){const u=e._uniformData[c];a[c]={location:t.getUniformLocation(n,c),value:he(u.type,u.size)};}return new tt(n,a)}const R={textureCount:0,blockIndex:0};class de{constructor(e){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=e;}contextChange(e){this._gl=e,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null;}bind(e,r){if(this._setProgram(e.glProgram),r)return;R.textureCount=0,R.blockIndex=0;let s=this._shaderSyncFunctions[e.glProgram._key];s||(s=this._shaderSyncFunctions[e.glProgram._key]=this._generateShaderSync(e,this)),this._renderer.buffer.nextBindBase(!!e.glProgram.transformFeedbackVaryings),s(this._renderer,e,R);}updateUniformGroup(e){this._renderer.uniformGroup.updateUniformGroup(e,this._activeProgram,R);}bindUniformBlock(e,r,s=0){const n=this._renderer.buffer,i=this._getProgramData(this._activeProgram),a=e._bufferResource;a||this._renderer.ubo.updateUniformGroup(e);const o=e.buffer,c=n.updateBuffer(o),u=n.freeLocationForBufferBase(c);if(a){const{offset:h,size:l}=e;h===0&&l===o.data.byteLength?n.bindBufferBase(c,u):n.bindBufferRange(c,u,h);}else n.getLastBindBaseLocation(c)!==u&&n.bindBufferBase(c,u);const _=this._activeProgram._uniformBlockData[r].index;i.uniformBlockBindings[s]!==u&&(i.uniformBlockBindings[s]=u,this._renderer.gl.uniformBlockBinding(i.program,_,u));}_setProgram(e){if(this._activeProgram===e)return;this._activeProgram=e;const r=this._getProgramData(e);this._gl.useProgram(r.program);}_getProgramData(e){return this._programDataHash[e._key]||this._createProgramData(e)}_createProgramData(e){const r=e._key;return this._programDataHash[r]=ct(this._gl,e),this._programDataHash[r]}destroy(){for(const e of Object.keys(this._programDataHash))this._programDataHash[e].destroy();this._programDataHash=null,this._shaderSyncFunctions=null,this._activeProgram=null,this._renderer=null,this._gl=null;}_generateShaderSync(e,r){return et(e,r)}resetState(){this._activeProgram=null;}}de.extension={type:[B.WebGLSystem],name:"shader"};const ut={f32:`if (cv !== v) { + cu.value = v; + gl.uniform1f(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2f(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3f(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4f(location, v[0], v[1], v[2], v[3]); + }`,i32:`if (cv !== v) { + cu.value = v; + gl.uniform1i(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2i(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3i(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,u32:`if (cv !== v) { + cu.value = v; + gl.uniform1ui(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2ui(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3ui(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4ui(location, v[0], v[1], v[2], v[3]); + }`,bool:`if (cv !== v) { + cu.value = v; + gl.uniform1i(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2i(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3i(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,"mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);"},_t={f32:"gl.uniform1fv(location, v);","vec2":"gl.uniform2fv(location, v);","vec3":"gl.uniform3fv(location, v);","vec4":"gl.uniform4fv(location, v);","mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);"};function ft(t,e){const r=[` + var v = null; + var cv = null; + var cu = null; + var t = 0; + var gl = renderer.gl; + var name = null; + `];for(const s in t.uniforms){if(!e[s]){t.uniforms[s]instanceof fo?t.uniforms[s].ubo?r.push(` + renderer.shader.bindUniformBlock(uv.${s}, "${s}"); + `):r.push(` + renderer.shader.updateUniformGroup(uv.${s}); + `):t.uniforms[s]instanceof Ht&&r.push(` + renderer.shader.bindBufferResource(uv.${s}, "${s}"); + `);continue}const n=t.uniformStructures[s];let i=false;for(let a=0;a>=1,s++;this.stateId=e.data;}for(let r=0;r>1,1),n=Math.max(n>>1,1);}}},be={id:"image",upload(t,e,r,s){const n=e.width,i=e.height,a=t.pixelWidth,o=t.pixelHeight,c=t.resourceWidth,u=t.resourceHeight;c1){const u=Math.min(t.maxAnisotropy,e.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[n](c,s.TEXTURE_MAX_ANISOTROPY_EXT,u);}t.compare&&e[n](c,e.TEXTURE_COMPARE_FUNC,At[t.compare]);}function Nt(t){return {r8unorm:t.RED,r8snorm:t.RED,r8uint:t.RED,r8sint:t.RED,r16uint:t.RED,r16sint:t.RED,r16float:t.RED,rg8unorm:t.RG,rg8snorm:t.RG,rg8uint:t.RG,rg8sint:t.RG,r32uint:t.RED,r32sint:t.RED,r32float:t.RED,rg16uint:t.RG,rg16sint:t.RG,rg16float:t.RG,rgba8unorm:t.RGBA,"rgba8unorm-srgb":t.RGBA,rgba8snorm:t.RGBA,rgba8uint:t.RGBA,rgba8sint:t.RGBA,bgra8unorm:t.RGBA,"bgra8unorm-srgb":t.RGBA,rgb9e5ufloat:t.RGB,rgb10a2unorm:t.RGBA,rg11b10ufloat:t.RGB,rg32uint:t.RG,rg32sint:t.RG,rg32float:t.RG,rgba16uint:t.RGBA,rgba16sint:t.RGBA,rgba16float:t.RGBA,rgba32uint:t.RGBA,rgba32sint:t.RGBA,rgba32float:t.RGBA,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT,depth24plus:t.DEPTH_COMPONENT,"depth24plus-stencil8":t.DEPTH_STENCIL,depth32float:t.DEPTH_COMPONENT,"depth32float-stencil8":t.DEPTH_STENCIL}}function yt(t,e){let r={},s=t.RGBA;return t instanceof $.get().getWebGLRenderingContext()?e.srgb&&(r={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":t.SRGB8_ALPHA8,"bgra8unorm-srgb":t.SRGB8_ALPHA8},s=t.RGBA8),{r8unorm:t.R8,r8snorm:t.R8_SNORM,r8uint:t.R8UI,r8sint:t.R8I,r16uint:t.R16UI,r16sint:t.R16I,r16float:t.R16F,rg8unorm:t.RG8,rg8snorm:t.RG8_SNORM,rg8uint:t.RG8UI,rg8sint:t.RG8I,r32uint:t.R32UI,r32sint:t.R32I,r32float:t.R32F,rg16uint:t.RG16UI,rg16sint:t.RG16I,rg16float:t.RG16F,rgba8unorm:t.RGBA,...r,rgba8snorm:t.RGBA8_SNORM,rgba8uint:t.RGBA8UI,rgba8sint:t.RGBA8I,bgra8unorm:s,rgb9e5ufloat:t.RGB9_E5,rgb10a2unorm:t.RGB10_A2,rg11b10ufloat:t.R11F_G11F_B10F,rg32uint:t.RG32UI,rg32sint:t.RG32I,rg32float:t.RG32F,rgba16uint:t.RGBA16UI,rgba16sint:t.RGBA16I,rgba16float:t.RGBA16F,rgba32uint:t.RGBA32UI,rgba32sint:t.RGBA32I,rgba32float:t.RGBA32F,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT16,depth24plus:t.DEPTH_COMPONENT24,"depth24plus-stencil8":t.DEPTH24_STENCIL8,depth32float:t.DEPTH_COMPONENT32F,"depth32float-stencil8":t.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}function Ct(t){return {r8unorm:t.UNSIGNED_BYTE,r8snorm:t.BYTE,r8uint:t.UNSIGNED_BYTE,r8sint:t.BYTE,r16uint:t.UNSIGNED_SHORT,r16sint:t.SHORT,r16float:t.HALF_FLOAT,rg8unorm:t.UNSIGNED_BYTE,rg8snorm:t.BYTE,rg8uint:t.UNSIGNED_BYTE,rg8sint:t.BYTE,r32uint:t.UNSIGNED_INT,r32sint:t.INT,r32float:t.FLOAT,rg16uint:t.UNSIGNED_SHORT,rg16sint:t.SHORT,rg16float:t.HALF_FLOAT,rgba8unorm:t.UNSIGNED_BYTE,"rgba8unorm-srgb":t.UNSIGNED_BYTE,rgba8snorm:t.BYTE,rgba8uint:t.UNSIGNED_BYTE,rgba8sint:t.BYTE,bgra8unorm:t.UNSIGNED_BYTE,"bgra8unorm-srgb":t.UNSIGNED_BYTE,rgb9e5ufloat:t.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:t.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:t.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:t.UNSIGNED_INT,rg32sint:t.INT,rg32float:t.FLOAT,rgba16uint:t.UNSIGNED_SHORT,rgba16sint:t.SHORT,rgba16float:t.HALF_FLOAT,rgba32uint:t.UNSIGNED_INT,rgba32sint:t.INT,rgba32float:t.FLOAT,stencil8:t.UNSIGNED_BYTE,depth16unorm:t.UNSIGNED_SHORT,depth24plus:t.UNSIGNED_INT,"depth24plus-stencil8":t.UNSIGNED_INT_24_8,depth32float:t.FLOAT,"depth32float-stencil8":t.FLOAT_32_UNSIGNED_INT_24_8_REV}}const Dt=4;class Se{constructor(e){this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:be,buffer:Rt,video:Tt,compressed:vt},this._premultiplyAlpha=false,this._useSeparateSamplers=false,this._renderer=e,this._managedTextures=new Bc({renderer:e,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"glTexture"});}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=yt(e,this._renderer.context.extensions),this._mapFormatToType=Ct(e),this._mapFormatToFormat=Nt(e)),this._managedTextures.removeAll(true),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=false;for(let r=0;r<16;r++)this.bind(W$1.EMPTY,r);}initSource(e){this.bind(e);}bind(e,r=0){const s=e.source;e?(this.bindSource(s,r),this._useSeparateSamplers&&this._bindSampler(s.style,r)):(this.bindSource(null,r),this._useSeparateSamplers&&this._bindSampler(null,r));}bindSource(e,r=0){const s=this._gl;if(e._gcLastUsed=this._renderer.gc.now,this._boundTextures[r]!==e){this._boundTextures[r]=e,this._activateLocation(r),e||(e=W$1.EMPTY.source);const n=this.getGlSource(e);s.bindTexture(n.target,n.texture);}}_bindSampler(e,r=0){const s=this._gl;if(!e){this._boundSamplers[r]=null,s.bindSampler(r,null);return}const n=this._getGlSampler(e);this._boundSamplers[r]!==n&&(this._boundSamplers[r]=n,s.bindSampler(r,n));}unbind(e){const r=e.source,s=this._boundTextures,n=this._gl;for(let i=0;i1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",s.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,r);}onSourceUnload(e,r=false){const s=e._gpuData[this._renderer.uid];s&&(r||(this.unbind(e),this._gl.deleteTexture(s.texture)),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this));}onSourceUpdate(e){const r=this._gl,s=this.getGlSource(e);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=e;const n=e.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==n&&(this._premultiplyAlpha=n,r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n)),this._uploads[e.uploadMethodId]?this._uploads[e.uploadMethodId].upload(e,s,r,this._renderer.context.webGLVersion):r.texImage2D(r.TEXTURE_2D,0,s.internalFormat,e.pixelWidth,e.pixelHeight,0,s.format,s.type,null),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,false);}onUpdateMipmaps(e,r=true){r&&this.bindSource(e,0);const s=this.getGlSource(e);this._gl.generateMipmap(s.target);}_initSampler(e){const r=this._gl,s=this._gl.createSampler();return this._glSamplers[e._resourceId]=s,j(e,r,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",s,false,true),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this._initSource(e)}generateCanvas(e){const{pixels:r,width:s,height:n}=this.getPixels(e),i=$.get().createCanvas();i.width=s,i.height=n;const a=i.getContext("2d");if(a){const o=a.createImageData(s,n);o.data.set(r),a.putImageData(o,0,0);}return i}getPixels(e){const r=e.source.resolution,s=e.frame,n=Math.max(Math.round(s.width*r),1),i=Math.max(Math.round(s.height*r),1),a=new Uint8Array(Dt*n*i),o=this._renderer,c=o.renderTarget.getRenderTarget(e),u=o.renderTarget.getGpuRenderTarget(c),_=o.gl;return _.bindFramebuffer(_.FRAMEBUFFER,u.resolveTargetFramebuffer),_.readPixels(Math.round(s.x*r),Math.round(s.y*r),n,i,_.RGBA,_.UNSIGNED_BYTE,a),{pixels:new Uint8ClampedArray(a.buffer),width:n,height:i}}destroy(){this._managedTextures.destroy(),this._glSamplers=null,this._boundTextures=null,this._boundSamplers=null,this._mapFormatToInternalFormat=null,this._mapFormatToType=null,this._mapFormatToFormat=null,this._uploads=null,this._renderer=null;}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(W$1.EMPTY.source),this._boundSamplers=Object.create(null);const e=this._gl;this._premultiplyAlpha=false,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha);}}Se.extension={type:[B.WebGLSystem],name:"texture"};class pe{contextChange(e){const r=new fo({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new H$1,type:"mat3x3"},uRound:{value:0,type:"f32"}}),s=e.limits.maxBatchableTextures,n$1=kc({name:"graphics",bits:[Sc,Ic(s),n,Ec]});this.shader=new Mi({glProgram:n$1,resources:{localUniforms:r,batchSamplers:Rc(s)}});}execute(e,r){const s=r.context,n=s.customShader||this.shader,i=e.renderer,a=i.graphicsContext,{batcher:o,instructions:c}=a.getContextRenderData(s);n.groups[0]=i.globalUniforms.bindGroup,i.state.set(e.state),i.shader.bind(n),i.geometry.bind(o.geometry,n.glProgram);const u=c.instructions;for(let _=0;_",value:new H$1}}}});}execute(e,r){const s=e.renderer;let n=r._shader;if(n){if(!n.glProgram){J$1("Mesh shader has no glProgram",r.shader);return}}else {n=this._shader;const i=r.texture,a=i.source;n.resources.uTexture=a,n.resources.uSampler=a.style,n.resources.textureUniforms.uniforms.uTextureMatrix=i.textureMatrix.mapCoord;}n.groups[100]=s.globalUniforms.bindGroup,n.groups[101]=e.localUniformsBindGroup,s.encoder.draw({geometry:r._geometry,shader:n,state:r.state});}destroy(){this._shader.destroy(true),this._shader=null;}}ge.extension={type:[B.WebGLPipesAdaptor],name:"mesh"};const It=[...Wt,_e,ze,Xe,oe,ee,Se,fe,se,me,de,ae,pt,ce,ie],Gt=[...zt],Ut=[J,ge,pe],Re=[],xe=[],ve=[];ft$1.handleByNamedList(B.WebGLSystem,Re);ft$1.handleByNamedList(B.WebGLPipes,xe);ft$1.handleByNamedList(B.WebGLPipesAdaptor,ve);ft$1.add(...It,...Gt,...Ut);class Mt extends ko{constructor(){const e={name:"webgl",type:Ss.WEBGL,systems:Re,renderPipes:xe,renderPipeAdaptors:ve};super(e);}} + +export { Mt as WebGLRenderer }; +//# sourceMappingURL=WebGLRenderer-DHwOMpnC.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/WebGPURenderer-B3ta5clj.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/WebGPURenderer-B3ta5clj.js new file mode 100644 index 0000000000000000000000000000000000000000..7a732d8da3b6928b8f184d0071f6148c93a404b6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/WebGPURenderer-B3ta5clj.js @@ -0,0 +1,76 @@ +import { A as ko, R as Ss, S as ll, E as B, e as ft, D as $$1, G as Bc, u as st, f as Dr, d as pi, l as fo, m as Gs, b as ql, h as qs, w as J$1, B as vt, c as Ke$1, g as Yl, n as vc, p as zc, s as Mi, M as H$1, t as W$1, o as Ac, q as Tc, i as bo, j as $n, k as It } from './Index4-BvPFZOEY.js'; +import { l, e } from './colorToUniform-CrQRsPlb.js'; +import { W as Wt, z as zt, E as Et, L as Lt, b as b$1, D as Dt, H as Ht, A as At, O as Ot, F as Ft } from './SharedSystems-CTk4bhlr.js'; +import './async-D55cHugf.js'; +import './index-u8mz_F03.js'; +import './escaping-CBnpiEl5.js'; +import './context-CBkBucIx.js'; +import './2-BLdXJizP.js'; +import './index5-BoOEKc6P.js'; +import './dev-fallback-Bc5Ork7Y.js'; +import './index-Cg-Pg6j3.js'; +import './index-server-CQz6EZl_.js'; +import './utils.svelte-B2py64Fz.js'; +import './clone-Yk88IHKV.js'; +import './ImagePreview-Ca2hvNZZ.js'; +import './BlockLabel-bKYWnOzQ.js'; +import './DownloadLink-nj1p0krE.js'; +import './IconButton-BRnu7KaR.js'; +import './Empty-DGRbZO0a.js'; +import './ShareButton-7VTs9dOO.js'; +import './Download-DcU5dONL.js'; +import './Image2-vcp9_ifi.js'; +import './IconButtonWrapper-CjFRPb3y.js'; +import './FullscreenButton-D8PvgSmk.js'; +import './Maximize-CuHbK64j.js'; +import './Image-CuPo5pWT.js'; +import './Block-DZmzQwnI.js'; +import './index3-Df92vI-L.js'; +import './Clear-D7Yjckqz.js'; +import './tinycolor-DfhFic3A.js'; +import './Check-C7_ZsXgh.js'; + +const y=ll.for2d();class W{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),y.blendMode="normal",s.pipeline.getPipeline(t,n,y);const o=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,o,n);}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=Yl(u.textures,u.count,s.limits.maxBatchableTextures);}y.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),o=s.pipeline.getPipeline(this._geometry,r,y,t.topology);t.bindGroup._touch(s.gc.now,s.tick),i.setPipeline(o),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start);}}W.extension={type:[B.WebGPUPipesAdaptor],name:"batch"};class H{constructor(e){this._hash=Object.create(null),this._renderer=e;}contextChange(e){this._gpu=e;}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],o=this._renderer;for(const l in i){const p=e.resources[l]??e.resources[i[l]];let h;if(p._resourceType==="uniformGroup"){const d=p;o.ubo.updateUniformGroup(d);const _=d.buffer;h={buffer:o.buffer.getGPUBuffer(_),offset:0,size:_.descriptor.size};}else if(p._resourceType==="buffer"){const d=p;h={buffer:o.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size};}else if(p._resourceType==="bufferResource"){const d=p;h={buffer:o.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size};}else if(p._resourceType==="textureSampler"){const d=p;h=o.texture.getGpuSampler(d);}else if(p._resourceType==="textureSource"){const d=p;h=o.texture.getGpuSource(d).createView();}n.push({binding:i[l],resource:h});}const u=o.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){this._hash=null,this._renderer=null;}}H.extension={type:[B.WebGPUSystem],name:"bindGroup"};class Me{constructor(e){this.gpuBuffer=e;}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null;}}class V{constructor(e){this._renderer=e,this._managedBuffers=new Bc({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"});}contextChange(e){this._gpu=e;}getGPUBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuBuffer||this.createGPUBuffer(e)}updateBuffer(e){const t=this.getGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){this._managedBuffers.removeAll();}onBufferUnload(e){e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this);}createGPUBuffer(e){const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e._resourceId=st("resource"),e.data&&(Dr(e.data.buffer,t.getMappedRange()),t.unmap()),e._gpuData[this._renderer.uid]=new Me(t),this._managedBuffers.add(e)&&(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this)),t}onBufferChange(e){this._managedBuffers.remove(e),e._updateID=0,this.createGPUBuffer(e);}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null;}}V.extension={type:[B.WebGPUSystem],name:"buffer"};class we{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535);}clear(){this.byteIndex=0;}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu);}),this._initPromise)}contextChange(e){this._renderer.gpu=e;}async _createDeviceAndAdaptor(e){const t=await $$1.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return {adapter:t,device:s}}destroy(){this.gpu=null,this._renderer=null;}}U.extension={type:[B.WebGPUSystem],name:"device"};U.defaultOptions={powerPreference:void 0,forceFallbackAdapter:false};class j{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e;}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e;}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder();}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor);}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null;}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1);}setPipelineFromGeometryProgramAndState(e,t,r,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i);}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e));}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)));}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t);}resetBindGroup(e){this._boundBindGroup[e]=null;}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.gc.now,this._renderer.tick);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s);}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(parseInt(s,10),e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer);}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,e.gpuProgram);}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r);}}draw(e){const{geometry:t,shader:r,state:s,topology:i,size:n,start:o,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u??t.instanceCount,o||0):this.renderPassEncoder.draw(n||t.getSize(),u??t.instanceCount,o||0);}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null);}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null;}restoreRenderPass(){const e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,false,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);const t=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const o in r)this._setVertexBuffer(o,r[o]);for(const o in i)this.setBindGroup(o,i[o],null);this._setIndexBuffer(s);}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null;}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null;}contextChange(e){this._gpu=e;}}j.extension={type:[B.WebGPUSystem],name:"encoder",priority:1};class K{constructor(e){this._renderer=e;}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures;}destroy(){}}K.extension={type:[B.WebGPUSystem],name:"limits"};class q{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this);}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:ql.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference);}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t);}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null;}}q.extension={type:[B.WebGPUSystem],name:"stencil"};const G={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:4,size:4},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:8,size:6},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:8,size:8},"mat2x2":{align:8,size:16},"mat2x2":{align:4,size:8},"mat3x2":{align:8,size:24},"mat3x2":{align:4,size:12},"mat4x2":{align:8,size:32},"mat4x2":{align:4,size:16},"mat2x3":{align:16,size:32},"mat2x3":{align:8,size:16},"mat3x3":{align:16,size:48},"mat3x3":{align:8,size:24},"mat4x3":{align:16,size:64},"mat4x3":{align:8,size:32},"mat2x4":{align:16,size:32},"mat2x4":{align:8,size:16},"mat3x4":{align:16,size:48},"mat3x4":{align:8,size:24},"mat4x4":{align:16,size:64},"mat4x4":{align:8,size:32}};function Re(a){const e=a.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i;}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function Ee(a,e){const{size:t,align:r}=G[a.data.type],s=(r-t)/4,i=a.data.type.indexOf("i32")>=0?"dataInt32":"data";return ` + v = uv.${a.data.name}; + ${e!==0?`offset += ${e};`:""} + + arrayOffset = offset; + + t = 0; + + for(var i=0; i < ${a.data.size*(t/4)}; i++) + { + for(var j = 0; j < ${t/4}; j++) + { + ${i}[arrayOffset++] = v[t++]; + } + ${s!==0?`arrayOffset += ${s};`:""} + } + `}function Le(a){return Ot(a,"uboWgsl",Ee,Ft)}class Y extends Et{constructor(){super({createUboElements:Re,generateUboSync:Le});}}Y.extension={type:[B.WebGPUSystem],name:"ubo"};const b=128;class ${constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._batchBuffer=new we({minUniformOffsetAlignment:b});const t=256/b;for(let r=0;r{const n={arrayStride:0,stepMode:"vertex",attributes:[]},o=n.attributes;for(const u in t.attributeData){const c=e.attributes[u];(c.divisor??1)!==1&&J$1(`Attribute ${u} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===i&&(n.arrayStride=c.stride,n.stepMode=c.instance?"instance":"vertex",o.push({shaderLocation:t.attributeData[u].location,offset:c.offset,format:c.format}));}o.length&&s.push(n);}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){const e=ke(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment,this._colorTargetCount);this._pipeStateCaches[e]||(this._pipeStateCaches[e]=Object.create(null)),this._pipeCache=this._pipeStateCaches[e];}destroy(){this._renderer=null,this._bufferLayoutsCache=null;}}X.extension={type:[B.WebGPUSystem],name:"pipeline"};class ze{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1;}}class Fe{init(e,t){this._renderer=e,this._renderTargetSystem=t;}copyToTexture(e,t,r,s,i){const n=this._renderer,o=this._getGpuColorTexture(e),u=n.texture.getGpuSource(t.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:o,origin:r},{texture:u,origin:i},s),t}startRenderPass(e,t=true,r,s){const n=this._renderTargetSystem.getGpuRenderTarget(e),o=this.getDescriptor(e,t,r);n.descriptor=o,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s);}finishRenderPass(){this._renderer.encoder.endRenderPass();}_getGpuColorTexture(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);return t.contexts[0]?t.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,t,r){typeof t=="boolean"&&(t=t?bo.ALL:bo.NONE);const s=this._renderTargetSystem,i=s.getGpuRenderTarget(e),n=e.colorTextures.map((c,l)=>{const p=i.contexts[l];let h,d;p?h=p.getCurrentTexture().createView():h=this._renderer.texture.getGpuSource(c).createView({mipLevelCount:1}),i.msaaTextures[l]&&(d=h,h=this._renderer.texture.getTextureView(i.msaaTextures[l]));const _=t&bo.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:h,resolveTarget:d,clearValue:r,storeOp:"store",loadOp:_}});let o;if((e.stencil||e.depth)&&!e.depthStencilTexture&&(e.ensureDepthStencilTexture(),e.depthStencilTexture.source.sampleCount=i.msaa?4:1),e.depthStencilTexture){const c=t&bo.STENCIL?"clear":"load",l=t&bo.DEPTH?"clear":"load";o={view:this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:c,depthClearValue:1,depthLoadOp:l,depthStoreOp:"store"};}return {colorAttachments:n,depthStencilAttachment:o}}clear(e,t=true,r,s){if(!t)return;const{gpu:i,encoder:n}=this._renderer,o=i.device;if(n.commandEncoder===null){const c=o.createCommandEncoder(),l=this.getDescriptor(e,t,r),p=c.beginRenderPass(l);p.setViewport(s.x,s.y,s.width,s.height,0,1),p.end();const h=c.finish();o.queue.submit([h]);}else this.startRenderPass(e,t,r,s);}initGpuRenderTarget(e){e.isRoot=true;const t=new ze;return t.colorTargetCount=e.colorTextures.length,e.colorTextures.forEach((r,s)=>{if(r instanceof $n){const i=r.resource.getContext("webgpu"),n=r.transparent?"premultiplied":"opaque";try{i.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n});}catch(o){console.error(o);}t.contexts[s]=i;}if(t.msaa=r.source.antialias,r.source.antialias){const i=new It({width:0,height:0,sampleCount:4});t.msaaTextures[s]=i;}}),t.msaa&&(t.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4)),t}destroyGpuRenderTarget(e){e.contexts.forEach(t=>{t.unconfigure();}),e.msaaTextures.forEach(t=>{t.destroy();}),e.msaaTextures.length=0,e.contexts.length=0;}ensureDepthStencilTexture(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&t.msaa&&(e.depthStencilTexture.source.sampleCount=4);}resizeGpuRenderTarget(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorTextures.forEach((r,s)=>{t.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution);});}}class Z extends Lt{constructor(e){super(e),this.adaptor=new Fe,this.adaptor.init(e,this);}}Z.extension={type:[B.WebGPUSystem],name:"renderTarget"};class J{constructor(){this._gpuProgramData=Object.create(null);}contextChange(e){this._gpu=e;}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){const t=this._gpu.device,r=e.gpuLayout.map(i=>t.createBindGroupLayout({entries:i})),s={bindGroupLayouts:r};return this._gpuProgramData[e._layoutKey]={bindGroups:r,pipeline:t.createPipelineLayout(s)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null;}}J.extension={type:[B.WebGPUSystem],name:"shader"};const g={};g.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};g.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};g.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};g.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};g.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};g.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};g["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};g["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};g["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};g.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};g.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};g.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}};class Q{constructor(){this.defaultState=new ll,this.defaultState.blend=true;}contextChange(e){this.gpu=e;}getColorTargets(e,t){const r=g[e.blendMode]||g.normal,s=[],i={format:"bgra8unorm",writeMask:0,blend:r};for(let n=0;n>1,1),s=Math.max(s>>1,1);}}},te={type:"image",upload(a,e,t){const r=a.resource;if(!r)return;if(globalThis.HTMLImageElement&&r instanceof HTMLImageElement){const o=$$1.get().createCanvas(r.width,r.height);o.getContext("2d").drawImage(r,0,0,r.width,r.height),a.resource=o,J$1("ImageSource: Image element passed, converting to canvas and replacing resource.");}const s=Math.min(e.width,a.resourceWidth||a.pixelWidth),i=Math.min(e.height,a.resourceHeight||a.pixelHeight),n=a.alphaMode==="premultiply-alpha-on-upload";t.device.queue.copyExternalImageToTexture({source:r},{texture:e,premultipliedAlpha:n},{width:s,height:i});}},He={type:"video",upload(a,e,t){te.upload(a,e,t);}};class Ve{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={};}_getMipmapPipeline(e){let t=this.pipelines[e];return t||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:` + var pos : array, 3> = array, 3>( + vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0)); + + struct VertexOutput { + @builtin(position) position : vec4, + @location(0) texCoord : vec2, + }; + + @vertex + fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput { + var output : VertexOutput; + output.texCoord = pos[vertexIndex] * vec2(0.5, -0.5) + vec2(0.5); + output.position = vec4(pos[vertexIndex], 0.0, 1.0); + return output; + } + + @group(0) @binding(0) var imgSampler : sampler; + @group(0) @binding(1) var img : texture_2d; + + @fragment + fn fragmentMain(@location(0) texCoord : vec2) -> @location(0) vec4 { + return textureSample(img, imgSampler, texCoord); + } + `})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){const t=this._getMipmapPipeline(e.format);if(e.dimension==="3d"||e.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=e;const s=e.depthOrArrayLayers||1,i=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!i){const u={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};r=this.device.createTexture(u);}const n=this.device.createCommandEncoder({}),o=t.getBindGroupLayout(0);for(let u=0;u1&&this.onUpdateMipmaps(e));}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new Ve(this._gpu.device));const t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t);}onSourceUnload(e){e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this);}onSourceResize(e){e._gcLastUsed=this._renderer.gc.now;const t=e._gpuData[this._renderer.uid],r=t?.gpuTexture;r?(r.width!==e.pixelWidth||r.height!==e.pixelHeight)&&(t.destroy(),this._bindGroupHash[e.uid]=null,e._gpuData[this._renderer.uid]=null,this.initSource(e)):this.initSource(e);}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuTexture||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]||this._createTextureBindGroup(e)}_createTextureBindGroup(e){const t=e.source;return this._bindGroupHash[e.uid]=new pi({0:t,1:t.style,2:new fo({uTextureMatrix:{type:"mat3x3",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){const t=e.source;t._gcLastUsed=this._renderer.gc.now;let r=t._gpuData[this._renderer.uid],s=null;return r||(this.initSource(t),r=t._gpuData[this._renderer.uid]),s=r.textureView||r.gpuTexture.createView(),s}generateCanvas(e){const t=this._renderer,r=t.gpu.device.createCommandEncoder(),s=$$1.get().createCanvas();s.width=e.source.pixelWidth,s.height=e.source.pixelHeight;const i=s.getContext("webgpu");return i.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:$$1.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:i.getCurrentTexture()},{width:s.width,height:s.height}),t.gpu.device.queue.submit([r.finish()]),s}getPixels(e){const t=this.generateCanvas(e),r=Gs.getOptimalCanvasAndContext(t.width,t.height),s=r.context;s.drawImage(t,0,0);const{width:i,height:n}=t,o=s.getImageData(0,0,i,n),u=new Uint8ClampedArray(o.data.buffer);return Gs.returnCanvasAndContext(r),{pixels:u,width:i,height:n}}destroy(){this._managedTextures.destroy();for(const e of Object.keys(this._bindGroupHash)){const t=Number(e);this._bindGroupHash[t]?.destroy();}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null;}}re.extension={type:[B.WebGPUSystem],name:"texture"};class se{constructor(){this._maxTextures=0;}contextChange(e$1){const t=new fo({uTransformMatrix:{value:new H$1,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}});this._maxTextures=e$1.limits.maxBatchableTextures;const r=vc({name:"graphics",bits:[Ac,Tc(this._maxTextures),e,zc]});this.shader=new Mi({gpuProgram:r,resources:{localUniforms:t}});}execute(e,t){const r=t.context,s=r.customShader||this.shader,i=e.renderer,n=i.graphicsContext,{batcher:o,instructions:u}=n.getContextRenderData(r),c=i.encoder;c.setGeometry(o.geometry,s.gpuProgram);const l=i.globalUniforms.bindGroup;c.setBindGroup(0,l,s.gpuProgram);const p=i.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,true);c.setBindGroup(2,p,s.gpuProgram);const h=u.instructions;let d=null;for(let _=0;_",value:new H$1}}}});}execute(e,t){const r=e.renderer;let s=t._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(t.texture);else if(!s.gpuProgram){J$1("Mesh shader has no gpuProgram",t.shader);return}const i=s.gpuProgram;if(i.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),i.autoAssignLocalUniforms){const n=e.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,true);}r.encoder.draw({geometry:t._geometry,shader:s,state:t.state});}destroy(){this._shader.destroy(true),this._shader=null;}}ie.extension={type:[B.WebGPUPipesAdaptor],name:"mesh"};const je=[...Wt,Y,j,U,K,V,re,Z,J,Q,X,N,q,H],Ke=[...zt,$],qe=[W,ie,se],ne=[],oe=[],ae=[];ft.handleByNamedList(B.WebGPUSystem,ne);ft.handleByNamedList(B.WebGPUPipes,oe);ft.handleByNamedList(B.WebGPUPipesAdaptor,ae);ft.add(...je,...Ke,...qe);class Ze extends ko{constructor(){const e={name:"webgpu",type:Ss.WEBGPU,systems:ne,renderPipes:oe,renderPipeAdaptors:ae};super(e);}} + +export { Ze as WebGPURenderer }; +//# sourceMappingURL=WebGPURenderer-B3ta5clj.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ckb-Cf76uBEO.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ckb-Cf76uBEO.js new file mode 100644 index 0000000000000000000000000000000000000000..df63dfb126f55532c66734c35c9d1d7b8cadf7f4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ckb-Cf76uBEO.js @@ -0,0 +1,4 @@ +const o="کوردی",e={annotated_image:"وێنەی نیشانە کراو"},t={allow_recording_access:"تکایە ڕێگە بدە بە دەستگەیشتن بە مایکرۆفۆن بۆ تۆمارکردن",audio:"دەنگ",record_from_microphone:"تۆمارکردن لە مایکرۆفۆنەوە",stop_recording:"تۆمارکردن بوەستێنە",no_device_support:"ناتوانرێت دەستبگات بە ئامێرەکانی میدیا. دڵنیابە لەوەی کە لەسەر سەرچاوەیەکی پارێزراو (https) یان localhost کاردەکەیت (یان بڕوانامەیەکی SSL دروستت داوە)، و ڕێگەت داوە بە وێبگەڕەکە دەستی بگات بە ئامێرەکەت.",stop:"وەستان",resume:"بەردەوامبوون",record:"تۆمارکردن",no_microphone:"هیچ مایکرۆفۆنێک نەدۆزرایەوە",pause:"وەستاندنی کاتی",play:"لێدان",waiting:"چاوەڕوانی",drop_to_upload:"فایلی دەنگی لێرە دابنێ بۆ بارکردن"},r={connection_can_break:"لە مۆبایلدا، پەیوەندییەکە دەکرێت بپچڕێت ئەگەر ئەم تابە چالاک نەبێت یان ئامێرەکە بچێتە دۆخی پشوو، ئەمەش شوێنی خۆت لە ڕیزدا لەدەست دەدات.",long_requests_queue:"ڕیزێکی درێژی داواکاری هەیە. ئەم سپەیسە دووباد بکە بۆی چاوەڕوان نەبیت.",lost_connection:"پەیوەندی پچڕا بەهۆی جێهێشتنی پەیج. گەڕانەوە بۆ ڕیز...",waiting_for_inputs:"بەخێربێی بۆ فایل(ەکان) دەستپێکردن، هەڵبژارە دووبارە هەوڵ بدە."},c={checkbox:"بۆکسی هەڵبژاردن",checkbox_group:"گروپی بۆکسی هەڵبژاردن"},_={code:"کۆد"},n={color_picker:"هەڵبژاردنی ڕەنگ"},a={built_with:"دروستکراوە لەگەڵ...",built_with_gradio:"Gradio دروستکراوە بە",clear:"خاوێنکردنەوە",download:"دابەزاندن",edit:"بژارکردن",empty:"بەتاڵ",error:"هەڵە",hosted_on:"میوانداری کراوە لە",loading:"بارکردن",logo:"لۆگۆ",or:"یان",remove:"لابردن",settings:"ڕێکخستنەکان",share:"هاوبەشکردن",submit:"پێشکەشکردن",undo:"پووچکردنەوە",no_devices:"هیچ ئامێرێک نەدۆزرایەوە",language:"زمان",display_theme:"ڕووکاری نیشاندان",pwa:"بەرنامەی وێبی پێشکەوتوو"},d={incorrect_format:"فۆرماتێکی هەڵە، تەنها فایلەکانی CSV و TSV پشتگیری دەکرێن",new_column:"زیادکردنی ستوون",new_row:"ڕیزی نوێ",add_row_above:"زیادکردنی ڕیز لە سەرەوە",add_row_below:"زیادکردنی ڕیز لە خوارەوە",add_column_left:"زیادکردنی ستوون لە چەپەوە",add_column_right:"زیادکردنی ستوون لە ڕاستەوە",delete_row:"ڕووی ڕاکردن",delete_column:"کۆلۆنی ڕاکردن",sort_column:"کۆلۆنی ڕێکەوە کردن",sort_ascending:"بەرچاوەی ڕوونی",sort_descending:"سەرچاوەکە بەپاشی بەرگرێڕەوە بەڕێوە بکە",drop_to_upload:"فایلەکانی CSV یان TSV لەگەڵ ئەمە بکەوە تا داتا بەرچوون بێت لەوەی دەیتە فرەیمەکەدا",clear_sort:"ڕاژکردنی ڕوونکردن"},s={dropdown:"لیستی داکەوتوو"},l={build_error:"هەڵەیەک هەیە لە دروستکردندا",config_error:"هەڵەیەک هەیە لە ڕێکخستندا",contact_page_author:"تکایە پەیوەندی بکە بە نووسەری لاپەڕەکە بۆ ئاگادارکردنەوە.",no_app_file:"فایلی بەرنامە نییە",runtime_error:"هەڵەیەک هەیە لە کاتی جێبەجێکردندا",space_not_working:'"سپەیسەکە کار ناکات چونکە" {0}',space_paused:"سپەیسەکە وەستێنراوە",use_via_api:"بەکارهێنان لە ڕێگەی API"},i={uploading:"بارکردن..."},p={highlighted_text:"دەقی دیاریکراو"},u={allow_webcam_access:"تکایە ڕێگە بدە بە بەکارهێنانی کامێرای وێب بۆ تۆمارکردن.",brush_color:"ڕەنگی فڵچە",brush_radius:"تیژڕەوی فڵچە",image:"وێنە",remove_image:"لابردنی وێنە",select_brush_color:"ڕەنگی فڵچە هەڵبژێرە",start_drawing:"دەست بکە بە وێنەکێشان",use_brush:"فڵچە بەکاربهێنە",drop_to_upload:"فایل وێنەیەک هەروەها لەمەکە دەڕوونە بۆ بارکردنەوە"},g={label:"لەیبڵ"},m={enable_cookies:"ئەگەر تۆ سەردانی HuggingFace Space دەکەیت لە دۆخی نادیاردا، پێویستە کووکی لایەنی سێیەم چالاک بکەیت.",incorrect_credentials:"زانیاری چوونەژوورەوە هەڵەیە",username:"ناوی بەکارهێنەر",password:"وشەی نهێنی",login:"چوونە ژوورەوە"},b={number:"ژمارە"},h={plot:"هێڵکاری"},w={radio:"ڕادیۆ"},k={slider:"سلایدەر"},f={click_to_upload:"کلیک بکە بۆ بارکردن",drop_audio:"دەنگ لێرە دابنێ",drop_csv:"لێرەدا CSV دابنێ",drop_file:"فایل لێرە دابنێ",drop_image:"وێنە لێرەدا دابنێ",drop_video:"ڤیدیۆ لێرە دابنێ",drop_gallery:"میدیا لێرە دابنێ",paste_clipboard:"لکاندن لە کلیپبۆردەوە"},v={drop_to_upload:"فایل ویدیۆییەکەت هەنە بکەرەوە بۆ بارکردنەوە"},S={edit:"دەستکاری",retry:"هەوڵدانەوە",undo:"گەڕانەوە",submit:"ناردن",cancel:"هەڵوەشاندنەوە",like:"پەسەند",dislike:"ناپەسەند",clear:"پاککردنەوەی گفتوگۆ"},x={_name:o,"3D_model":{"3d_model":"مۆدێلی سێ ڕەهەندی",drop_to_upload:"فایل مۆدێلی ٣دی (.obj، .glb، .stl، .gltf، .splat یان .ply) لەمە هێرە بکە لەبەر بارکردنی."},annotated_image:e,audio:t,blocks:r,checkbox:c,code:_,color_picker:n,common:a,dataframe:d,dropdown:s,errors:l,file:i,highlighted_text:p,image:u,label:g,login:m,number:b,plot:h,radio:w,slider:k,upload_text:f,video:v,chatbot:S}; + +export { o as _name, e as annotated_image, t as audio, r as blocks, S as chatbot, c as checkbox, _ as code, n as color_picker, a as common, d as dataframe, x as default, s as dropdown, l as errors, i as file, p as highlighted_text, u as image, g as label, m as login, b as number, h as plot, w as radio, k as slider, f as upload_text, v as video }; +//# sourceMappingURL=ckb-Cf76uBEO.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/index3-Df92vI-L.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/index3-Df92vI-L.js new file mode 100644 index 0000000000000000000000000000000000000000..8258a43c9ebf481774e54a6304702505b87fcb2f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/index3-Df92vI-L.js @@ -0,0 +1,202 @@ +import { n as noop } from './async-D55cHugf.js'; +import { f as attr_class, g as attr_style, i as stringify, e as ensure_array_like, s as slot, b as store_get, u as unsubscribe_stores } from './index-u8mz_F03.js'; +import { w as writable } from './index-Cg-Pg6j3.js'; +import { e as escape_html } from './escaping-CBnpiEl5.js'; +import { w } from './IconButton-BRnu7KaR.js'; +import { o } from './Clear-D7Yjckqz.js'; +import './2-BLdXJizP.js'; + +/** @import { Raf } from '#client' */ + +const now = () => Date.now(); + +/** @type {Raf} */ +const raf = { + // don't access requestAnimationFrame eagerly outside method + // this allows basic testing of user code without JSDOM + // bunder will eval and remove ternary when the user's app is built + tick: /** @param {any} _ */ (_) => (noop)(), + now: () => now(), + tasks: new Set() +}; + +/** @import { TaskCallback, Task, TaskEntry } from '#client' */ + +/** + * Creates a new task that runs on each raf frame + * until it returns a falsy value or is aborted + * @param {TaskCallback} callback + * @returns {Task} + */ +function loop(callback) { + /** @type {TaskEntry} */ + let task; + + if (raf.tasks.size === 0) ; + + return { + promise: new Promise((fulfill) => { + raf.tasks.add((task = { c: callback, f: fulfill })); + }), + abort() { + raf.tasks.delete(task); + } + }; +} + +/** + * @param {any} obj + * @returns {obj is Date} + */ +function is_date(obj) { + return Object.prototype.toString.call(obj) === '[object Date]'; +} + +/** @import { Task } from '#client' */ +/** @import { SpringOpts, SpringUpdateOpts, TickContext } from './private.js' */ +/** @import { Spring as SpringStore } from './public.js' */ + +/** + * @template T + * @param {TickContext} ctx + * @param {T} last_value + * @param {T} current_value + * @param {T} target_value + * @returns {T} + */ +function tick_spring(ctx, last_value, current_value, target_value) { + if (typeof current_value === 'number' || is_date(current_value)) { + // @ts-ignore + const delta = target_value - current_value; + // @ts-ignore + const velocity = (current_value - last_value) / (ctx.dt || 1 / 60); // guard div by 0 + const spring = ctx.opts.stiffness * delta; + const damper = ctx.opts.damping * velocity; + const acceleration = (spring - damper) * ctx.inv_mass; + const d = (velocity + acceleration) * ctx.dt; + if (Math.abs(d) < ctx.opts.precision && Math.abs(delta) < ctx.opts.precision) { + return target_value; // settled + } else { + ctx.settled = false; // signal loop to keep ticking + // @ts-ignore + return is_date(current_value) ? new Date(current_value.getTime() + d) : current_value + d; + } + } else if (Array.isArray(current_value)) { + // @ts-ignore + return current_value.map((_, i) => + // @ts-ignore + tick_spring(ctx, last_value[i], current_value[i], target_value[i]) + ); + } else if (typeof current_value === 'object') { + const next_value = {}; + for (const k in current_value) { + // @ts-ignore + next_value[k] = tick_spring(ctx, last_value[k], current_value[k], target_value[k]); + } + // @ts-ignore + return next_value; + } else { + throw new Error(`Cannot spring ${typeof current_value} values`); + } +} + +/** + * The spring function in Svelte creates a store whose value is animated, with a motion that simulates the behavior of a spring. This means when the value changes, instead of transitioning at a steady rate, it "bounces" like a spring would, depending on the physics parameters provided. This adds a level of realism to the transitions and can enhance the user experience. + * + * @deprecated Use [`Spring`](https://svelte.dev/docs/svelte/svelte-motion#Spring) instead + * @template [T=any] + * @param {T} [value] + * @param {SpringOpts} [opts] + * @returns {SpringStore} + */ +function spring(value, opts = {}) { + const store = writable(value); + const { stiffness = 0.15, damping = 0.8, precision = 0.01 } = opts; + /** @type {number} */ + let last_time; + /** @type {Task | null} */ + let task; + /** @type {object} */ + let current_token; + + let last_value = /** @type {T} */ (value); + let target_value = /** @type {T | undefined} */ (value); + + let inv_mass = 1; + let inv_mass_recovery_rate = 0; + let cancel_task = false; + /** + * @param {T} new_value + * @param {SpringUpdateOpts} opts + * @returns {Promise} + */ + function set(new_value, opts = {}) { + target_value = new_value; + const token = (current_token = {}); + if (value == null || opts.hard || (spring.stiffness >= 1 && spring.damping >= 1)) { + cancel_task = true; // cancel any running animation + last_time = raf.now(); + last_value = new_value; + store.set((value = target_value)); + return Promise.resolve(); + } else if (opts.soft) { + const rate = opts.soft === true ? 0.5 : +opts.soft; + inv_mass_recovery_rate = 1 / (rate * 60); + inv_mass = 0; // infinite mass, unaffected by spring forces + } + if (!task) { + last_time = raf.now(); + cancel_task = false; + task = loop((now) => { + if (cancel_task) { + cancel_task = false; + task = null; + return false; + } + inv_mass = Math.min(inv_mass + inv_mass_recovery_rate, 1); + + // clamp elapsed time to 1/30th of a second, so that longer pauses + // (blocked thread or inactive tab) don't cause the spring to go haywire + const elapsed = Math.min(now - last_time, 1000 / 30); + + /** @type {TickContext} */ + const ctx = { + inv_mass, + opts: spring, + settled: true, + dt: (elapsed * 60) / 1000 + }; + // @ts-ignore + const next_value = tick_spring(ctx, last_value, value, target_value); + last_time = now; + last_value = /** @type {T} */ (value); + store.set((value = /** @type {T} */ (next_value))); + if (ctx.settled) { + task = null; + } + return !ctx.settled; + }); + } + return new Promise((fulfil) => { + /** @type {Task} */ (task).promise.then(() => { + if (token === current_token) fulfil(); + }); + }); + } + /** @type {SpringStore} */ + // @ts-expect-error - class-only properties are missing + const spring = { + set, + update: (fn, opts) => set(fn(/** @type {T} */ (target_value), /** @type {T} */ (value)), opts), + subscribe: store.subscribe, + stiffness, + damping, + precision + }; + return spring; +} + +function B(p,h){p.component(s=>{var a;let{margin:b=true}=h;const v=spring([0,0]),m=spring([0,0]);s.push(``),a&&unsubscribe_stores(a);});}function x(p){let h=["","k","M","G","T","P","E","Z"],s=0;for(;p>1e3&&s{let{i18n:a,eta:b=null,queue_position:v,queue_size:m,status:e,scroll_to_output:S=false,timer:F=true,show_progress:g="full",message:E=null,progress:c=null,variant:n="default",loading_text:C="Loading...",absolute:L=true,translucent:k=false,border:M=false,autoscroll:G,validation_error:_=null,show_validation_error:y=true,type:Z=null,on_clear_status:N,used_cache:P=null,cache_duration:T=null,avg_time:X=null}=h,d=null;const I=!(y&&_)&&(Z==="input"||!e||e==="complete"||g==="hidden"||e=="streaming"),q=0 .toFixed(1);let z=c==null,o$1=(()=>{let u=null;c!=null?u=c.map(t=>{if(t.index!=null&&t.length!=null)return t.index/t.length;if(t.progress!=null)return t.progress}):u=null;let i,f="";return u?(i=u[u.length-1],i===0?f="0":f="150ms"):i=void 0,{progress_level:u,last_progress_level:i,progress_bar_transition:f}})();if(s.push(``),_&&y?(s.push(""),s.push(`
          ${escape_html(_)}
          ")):s.push(""),s.push(" "),e==="pending"){if(s.push(""),n==="default"&&z&&g==="full"?(s.push(""),s.push(`
          `)):s.push(""),s.push(` `),c){s.push(""),s.push("");const u=ensure_array_like(c);for(let i=0,f=u.length;i"),t.length!=null?(s.push(""),s.push(`${escape_html(x(t.index||0))}/${escape_html(x(t.length))}`)):(s.push(""),s.push(`${escape_html(x(t.index||0))}`)),s.push(` ${escape_html(t.unit)} | `)):s.push(""),s.push("");}s.push("");}else s.push(""),v!==null&&m!==void 0&&v>=0?(s.push(""),s.push(`queue: ${escape_html(v+1)}/${escape_html(m)} |`)):(s.push(""),v===0?(s.push(""),s.push("processing |")):s.push(""),s.push("")),s.push("");if(s.push(" "),F?(s.push(""),s.push(`${escape_html(q)}${escape_html(b?`/${d}`:"")}s`)):s.push(""),s.push(" "),o$1.last_progress_level!=null){if(s.push(""),s.push('
          '),c!=null){s.push(""),s.push("");const u=ensure_array_like(c);for(let i=0,f=u.length;i"),i!==0?(s.push(""),s.push(" /")):s.push(""),s.push(" "),t.desc!=null?(s.push(""),s.push(`${escape_html(t.desc)}`)):s.push(""),s.push(" "),t.desc!=null&&o$1.progress_level&&o$1.progress_level[i]!=null?(s.push(""),s.push("-")):s.push(""),s.push(" "),o$1.progress_level!=null?(s.push(""),s.push(`${escape_html((100*(o$1.progress_level[i]||0)).toFixed(1))}%`)):s.push(""),s.push("")):s.push(""),s.push("");}s.push("");}else s.push("");s.push(`
          `);}else s.push(""),g==="full"?(s.push(""),B(s,{margin:n==="default"})):s.push(""),s.push("");s.push(" "),F?s.push(""):(s.push(""),s.push(`

          ${escape_html(C)}

          `),slot(s,h,"additional-loading-text",{}),s.push("")),s.push("");}else s.push(""),e==="error"?(s.push(""),s.push('
          '),w(s,{Icon:o,label:a("common.clear"),disabled:false}),s.push(`
          ${escape_html(a("common.error"))} `),slot(s,h,"error",{}),s.push("")):s.push(""),s.push("");s.push(" "),s.push(""),s.push("");});} + +export { B, W, is_date as i, loop as l, raf as r, spring as s }; +//# sourceMappingURL=index3-Df92vI-L.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/module-BW3J_rLT.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/module-BW3J_rLT.js new file mode 100644 index 0000000000000000000000000000000000000000..02ffaeb6c4d7cb526c6567d8c168d085a6e27ad5 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/module-BW3J_rLT.js @@ -0,0 +1,6 @@ +import { q } from './module2-BgDPHXun.js'; + +const i=q({characterize:({call:e})=>()=>e("characterize"),encode:({call:e})=>(t,r)=>e("encode",{recordingId:t,timeslice:r}),record:({call:e})=>async(t,r,o)=>{await e("record",{recordingId:t,sampleRate:r,typedArrays:o},o.map(({buffer:n})=>n).filter(n=>n instanceof ArrayBuffer));}}),u=e=>{const t=new Worker(e);return i(t)},c=`(()=>{var e={775:function(e,t,r){!function(e,t,r,n){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(t),a=o(r),i=o(n),u=function(e,t){return void 0===t?e:t.reduce((function(e,t){if("capitalize"===t){var r=e.charAt(0).toUpperCase(),n=e.slice(1);return"".concat(r).concat(n)}return"dashify"===t?a.default(e):"prependIndefiniteArticle"===t?"".concat(i.default(e)," ").concat(e):e}),e)},c=function(e){var t=e.name+e.modifiers.map((function(e){return"\\\\.".concat(e,"\\\\(\\\\)")})).join("");return new RegExp("\\\\$\\\\{".concat(t,"}"),"g")},l=function(e,t){for(var r=/\\\${([^.}]+)((\\.[^(]+\\(\\))*)}/g,n=[],o=r.exec(e);null!==o;){var a={modifiers:[],name:o[1]};if(void 0!==o[3])for(var i=/\\.[^(]+\\(\\)/g,l=i.exec(o[2]);null!==l;)a.modifiers.push(l[0].slice(1,-2)),l=i.exec(o[2]);n.push(a),o=r.exec(e)}var d=n.reduce((function(e,r){return e.map((function(e){return"string"==typeof e?e.split(c(r)).reduce((function(e,n,o){return 0===o?[n]:r.name in t?[].concat(s.default(e),[u(t[r.name],r.modifiers),n]):[].concat(s.default(e),[function(e){return u(e[r.name],r.modifiers)},n])}),[]):[e]})).reduce((function(e,t){return[].concat(s.default(e),s.default(t))}),[])}),[e]);return function(e){return d.reduce((function(t,r){return[].concat(s.default(t),"string"==typeof r?[r]:[r(e)])}),[]).join("")}},d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=void 0===e.code?void 0:l(e.code,t),n=void 0===e.message?void 0:l(e.message,t);function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0,s=void 0===o&&(t instanceof Error||void 0!==t.code&&"Exception"===t.code.slice(-9))?{cause:t,missingParameters:{}}:{cause:o,missingParameters:t},a=s.cause,i=s.missingParameters,u=void 0===n?new Error:new Error(n(i));return null!==a&&(u.cause=a),void 0!==r&&(u.code=r(i)),void 0!==e.status&&(u.status=e.status),u}return o};e.compile=d,Object.defineProperty(e,"__esModule",{value:!0})}(t,r(106),r(881),r(507))},881:e=>{"use strict";e.exports=(e,t)=>{if("string"!=typeof e)throw new TypeError("expected a string");return e.trim().replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\\W/g,(e=>/[À-ž]/.test(e)?e:"-")).replace(/^-+|-+$/g,"").replace(/-{2,}/g,(e=>t&&t.condense?"-":e)).toLowerCase()}},107:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:an)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),l=t(c);e.addUniqueNumber=l,e.generateUniqueNumber=c,Object.defineProperty(e,"__esModule",{value:!0})}(t)},507:e=>{var t=function(e){var t,r,n=/\\w+/.exec(e);if(!n)return"an";var o=(r=n[0]).toLowerCase(),s=["honest","hour","hono"];for(t in s)if(0==o.indexOf(s[t]))return"an";if(1==o.length)return"aedhilmnorsx".indexOf(o)>=0?"an":"a";if(r.match(/(?!FJO|[HLMNS]Y.|RY[EO]|SQU|(F[LR]?|[HL]|MN?|N|RH?|S[CHKLMNPTVW]?|X(YL)?)[AEIOU])[FHLMNRSX][A-Z]/))return"an";var a=[/^e[uw]/,/^onc?e\\b/,/^uni([^nmd]|mo)/,/^u[bcfhjkqrst][aeiou]/];for(t=0;t=0?"an":"a":"aeiou".indexOf(o[0])>=0||o.match(/^y(b[lor]|cl[ea]|fere|gg|p[ios]|rou|tt)/)?"an":"a"};void 0!==e.exports?e.exports=t:window.indefiniteArticle=t},768:e=>{e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r{var n=r(768);e.exports=function(e){if(Array.isArray(e))return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports},642:e=>{e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},344:e=>{e.exports=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.")},e.exports.__esModule=!0,e.exports.default=e.exports},106:(e,t,r)=>{var n=r(907),o=r(642),s=r(906),a=r(344);e.exports=function(e){return n(e)||o(e)||s(e)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},906:(e,t,r)=>{var n=r(768);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";var e=r(775);const t=-32603,n=-32602,o=-32601,s=(0,e.compile)({message:'The requested method called "\${method}" is not supported.',status:o}),a=(0,e.compile)({message:'The handler of the method called "\${method}" returned no required result.',status:t}),i=(0,e.compile)({message:'The handler of the method called "\${method}" returned an unexpected result.',status:t}),u=(0,e.compile)({message:'The specified parameter called "portId" with the given value "\${portId}" does not identify a port connected to this worker.',status:n}),c=(e,t)=>async r=>{let{data:{id:n,method:o,params:u}}=r;const c=t[o];try{if(void 0===c)throw s({method:o});const t=void 0===u?c():c(u);if(void 0===t)throw a({method:o});const r=t instanceof Promise?await t:t;if(null===n){if(void 0!==r.result)throw i({method:o})}else{if(void 0===r.result)throw i({method:o});const{result:t,transferables:s=[]}=r;e.postMessage({id:n,result:t},s)}}catch(t){const{message:r,status:o=-32603}=t;e.postMessage({error:{code:o,message:r},id:n})}};var l=r(107);const d=new Map,f=(e,t,r)=>({...t,connect:r=>{let{port:n}=r;n.start();const o=e(n,t),s=(0,l.generateUniqueNumber)(d);return d.set(s,(()=>{o(),n.close(),d.delete(s)})),{result:s}},disconnect:e=>{let{portId:t}=e;const r=d.get(t);if(void 0===r)throw u({portId:t.toString()});return r(),{result:null}},isSupported:async()=>{if(await new Promise((e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=t=>{let{data:r}=t;return e(null!==r)},n.postMessage(t,[t])}))){const e=r();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),p=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;const n=f(p,t,r),o=c(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},m=e=>e.reduce(((e,t)=>e+t.length),0),h=(e,t)=>{const r=[];let n=0;e:for(;nt){const o=n-t;r.forEach(((t,r)=>{const n=t.pop(),s=n.length-o;t.push(n.subarray(0,s)),e[r].unshift(n.subarray(s))}))}return r},v=new Map,g=(e=>(t,r,n)=>{const o=e.get(t);if(void 0===o){const o={channelDataArrays:n.map((e=>[e])),isComplete:!0,sampleRate:r};return e.set(t,o),o}return o.channelDataArrays.forEach(((e,t)=>e.push(n[t]))),o})(v),x=((e,t)=>(r,n,o,s)=>{const a=o>>3,i="subsequent"===n?0:44,u=r.length,c=e(r[0]),l=new ArrayBuffer(c*u*a+i),d=new DataView(l);return"subsequent"!==n&&t(d,o,u,"complete"===n?c:Number.POSITIVE_INFINITY,s),r.forEach(((e,t)=>{let r=i+t*a;e.forEach((e=>{const t=e.length;for(let n=0;n{const s=t>>3,a=Math.min(n*r*s,4294967251);e.setUint32(0,1380533830),e.setUint32(4,a+36,!0),e.setUint32(8,1463899717),e.setUint32(12,1718449184),e.setUint32(16,16,!0),e.setUint16(20,1,!0),e.setUint16(22,r,!0),e.setUint32(24,o,!0),e.setUint32(28,o*r*s,!0),e.setUint16(32,r*s,!0),e.setUint16(34,t,!0),e.setUint32(36,1684108385),e.setUint32(40,a,!0)})),w=new Map;p(self,{characterize:()=>({result:/^audio\\/wav$/}),encode:e=>{let{recordingId:t,timeslice:r}=e;const n=w.get(t);void 0!==n&&(w.delete(t),n.reject(new Error("Another request was made to initiate an encoding.")));const o=v.get(t);if(null!==r){if(void 0===o||m(o.channelDataArrays[0])*(1e3/o.sampleRate){w.set(t,{reject:n,resolve:e,timeslice:r})}));const e=h(o.channelDataArrays,Math.ceil(r*(o.sampleRate/1e3))),n=x(e,o.isComplete?"initial":"subsequent",16,o.sampleRate);return o.isComplete=!1,{result:n,transferables:n}}if(void 0!==o){const e=x(o.channelDataArrays,o.isComplete?"complete":"subsequent",16,o.sampleRate);return v.delete(t),{result:e,transferables:e}}return{result:[],transferables:[]}},record:e=>{let{recordingId:t,sampleRate:r,typedArrays:n}=e;const o=g(t,r,n),s=w.get(t);if(void 0!==s&&m(o.channelDataArrays[0])*(1e3/r)>=s.timeslice){const e=h(o.channelDataArrays,Math.ceil(s.timeslice*(r/1e3))),n=x(e,o.isComplete?"initial":"subsequent",16,r);o.isComplete=!1,w.delete(t),s.resolve({result:n,transferables:n})}return{result:null}}})})()})();`,l=new Blob([c],{type:"application/javascript; charset=utf-8"}),s=URL.createObjectURL(l),d=u(s),p=d.connect;URL.revokeObjectURL(s); + +export { p as connect }; +//# sourceMappingURL=module-BW3J_rLT.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/module2-BgDPHXun.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/module2-BgDPHXun.js new file mode 100644 index 0000000000000000000000000000000000000000..c577f7a96987d34c4eab75aa3571bf31dee16ea2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/module2-BgDPHXun.js @@ -0,0 +1,4 @@ +const m=t=>r=>{const e=t(r);return r.add(e),e},O=t=>(r,e)=>(t.set(r,e),e),h=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,p=536870912,l=p*2,b=(t,r)=>e=>{const a=r.get(e);let n=a===void 0?e.size:ah)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;e.has(n);)n=Math.floor(Math.random()*h);return t(e,n)},w=new WeakMap,A=O(w),g=b(A,w),y=m(g),I=(t,r,e,a)=>n=>{const d=r(n);return u=>{const i=t(u);u.addEventListener("message",(({data:s})=>{const{id:o}=s;if(o!==null&&i.has(o)){const{reject:c,resolve:E}=i.get(o);i.delete(o),s.error===void 0?E(s.result):c(new Error(s.error.message));}})),a(u)&&u.start();const M=(s,o=null,c=[])=>new Promise((E,N)=>{const _=e(i);i.set(_,{reject:N,resolve:E}),o===null?u.postMessage({id:_,method:s},c):u.postMessage({id:_,method:s,params:o},c);}),T=(s,o,c=[])=>{u.postMessage({id:null,method:s,params:o},c);};let f={};for(const[s,o]of Object.entries(d))f={...f,[s]:o({call:M,notify:T})};return {...f}}},W=t=>r=>{if(t.has(r))return t.get(r);const e=new Map;return t.set(r,e),e},k=t=>r=>({...r,connect:({call:e})=>async()=>{const{port1:a,port2:n}=new MessageChannel,d=await e("connect",{port:a},[a]);return t.set(n,d),n},disconnect:({call:e})=>async a=>{const n=t.get(a);if(n===void 0)throw new Error("The given port is not connected.");await e("disconnect",{portId:n});},isSupported:({call:e})=>()=>e("isSupported")}),R=t=>typeof t.start=="function",q=I(W(new WeakMap),k(new WeakMap),g,R); + +export { g, q, y }; +//# sourceMappingURL=module2-BgDPHXun.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/sql-C4K_nLbQ.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/sql-C4K_nLbQ.js new file mode 100644 index 0000000000000000000000000000000000000000..6ab46d9366d82b59be881c0000ec8b5b62d5887d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/sql-C4K_nLbQ.js @@ -0,0 +1,4 @@ +function s(a){var c=a.client||{},h=a.atoms||{false:true,true:true,null:true},p=a.builtin||e(z),S=a.keywords||e(d),_=a.operatorChars||/^[*+\-%<>!=&|~^\/]/,o=a.support||{},y=a.hooks||{},C=a.dateSQL||{date:true,time:true,timestamp:true},Q=a.backslashStringEscapes!==false,j=a.brackets||/^[\{}\(\)\[\]]/,v=a.punctuation||/^[;.,:]/;function g(t,i){var r=t.next();if(y[r]){var n=y[r](t,i);if(n!==false)return n}if(o.hexNumber&&(r=="0"&&t.match(/^[xX][0-9a-fA-F]+/)||(r=="x"||r=="X")&&t.match(/^'[0-9a-fA-F]*'/)))return "number";if(o.binaryNumber&&((r=="b"||r=="B")&&t.match(/^'[01]+'/)||r=="0"&&t.match(/^b[01]*/)))return "number";if(r.charCodeAt(0)>47&&r.charCodeAt(0)<58)return t.match(/^[0-9]*(\.[0-9]+)?([eE][-+]?[0-9]+)?/),o.decimallessFloat&&t.match(/^\.(?!\.)/),"number";if(r=="?"&&(t.eatSpace()||t.eol()||t.eat(";")))return "macroName";if(r=="'"||r=='"'&&o.doubleQuote)return i.tokenize=x(r),i.tokenize(t,i);if((o.nCharCast&&(r=="n"||r=="N")||o.charsetCast&&r=="_"&&t.match(/[a-z][a-z0-9]*/i))&&(t.peek()=="'"||t.peek()=='"'))return "keyword";if(o.escapeConstant&&(r=="e"||r=="E")&&(t.peek()=="'"||t.peek()=='"'&&o.doubleQuote))return i.tokenize=function(m,k){return (k.tokenize=x(m.next(),true))(m,k)},"keyword";if(o.commentSlashSlash&&r=="/"&&t.eat("/"))return t.skipToEnd(),"comment";if(o.commentHash&&r=="#"||r=="-"&&t.eat("-")&&(!o.commentSpaceRequired||t.eat(" ")))return t.skipToEnd(),"comment";if(r=="/"&&t.eat("*"))return i.tokenize=b(1),i.tokenize(t,i);if(r=="."){if(o.zerolessFloat&&t.match(/^(?:\d+(?:e[+-]?\d+)?)/i))return "number";if(t.match(/^\.+/))return null;if(o.ODBCdotTable&&t.match(/^[\w\d_$#]+/))return "type"}else {if(_.test(r))return t.eatWhile(_),"operator";if(j.test(r))return "bracket";if(v.test(r))return t.eatWhile(v),"punctuation";if(r=="{"&&(t.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||t.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return "number";t.eatWhile(/^[_\w\d]/);var l=t.current().toLowerCase();return C.hasOwnProperty(l)&&(t.match(/^( )+'[^']*'/)||t.match(/^( )+"[^"]*"/))?"number":h.hasOwnProperty(l)?"atom":p.hasOwnProperty(l)?"type":S.hasOwnProperty(l)?"keyword":c.hasOwnProperty(l)?"builtin":null}}function x(t,i){return function(r,n){for(var l=false,m;(m=r.next())!=null;){if(m==t&&!l){n.tokenize=g;break}l=(Q||i)&&!l&&m=="\\";}return "string"}}function b(t){return function(i,r){var n=i.match(/^.*?(\/\*|\*\/)/);return n?n[1]=="/*"?r.tokenize=b(t+1):t>1?r.tokenize=b(t-1):r.tokenize=g:i.skipToEnd(),"comment"}}function w(t,i,r){i.context={prev:i.context,indent:t.indentation(),col:t.column(),type:r};}function L(t){t.indent=t.context.indent,t.context=t.context.prev;}return {name:"sql",startState:function(){return {tokenize:g,context:null}},token:function(t,i){if(t.sol()&&i.context&&i.context.align==null&&(i.context.align=false),i.tokenize==g&&t.eatSpace())return null;var r=i.tokenize(t,i);if(r=="comment")return r;i.context&&i.context.align==null&&(i.context.align=true);var n=t.current();return n=="("?w(t,i,")"):n=="["?w(t,i,"]"):i.context&&i.context.type==n&&L(i),r},indent:function(t,i,r){var n=t.context;if(!n)return null;var l=i.charAt(0)==n.type;return n.align?n.col+(l?0:1):n.indent+(l?0:r.unit)},languageData:{commentTokens:{line:o.commentSlashSlash?"//":o.commentHash?"#":"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}}}function f(a){for(var c;(c=a.next())!=null;)if(c=="`"&&!a.eat("`"))return "string.special";return a.backUp(a.current().length-1),a.eatWhile(/\w/)?"string.special":null}function N(a){for(var c;(c=a.next())!=null;)if(c=='"'&&!a.eat('"'))return "string.special";return a.backUp(a.current().length-1),a.eatWhile(/\w/)?"string.special":null}function u(a){return a.eat("@")&&(a.match("session."),a.match("local."),a.match("global.")),a.eat("'")?(a.match(/^.*'/),"string.special"):a.eat('"')?(a.match(/^.*"/),"string.special"):a.eat("`")?(a.match(/^.*`/),"string.special"):a.match(/^[0-9a-zA-Z$\.\_]+/)?"string.special":null}function q(a){return a.eat("N")?"atom":a.match(/^[a-zA-Z.#!?]/)?"string.special":null}var d="alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit ";function e(a){for(var c={},h=a.split(" "),p=0;p!=^\&|\/]/,brackets:/^[\{}\(\)]/,punctuation:/^[;.,:/]/,backslashStringEscapes:false,dateSQL:e("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":u}}),B=s({client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(d+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":u,"`":f,"\\":q}}),D=s({client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(d+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group group_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":u,"`":f,"\\":q}}),O=s({client:e("auth backup bail binary changes check clone databases dbinfo dump echo eqp exit explain fullschema headers help import imposter indexes iotrace limit lint load log mode nullvalue once open output print prompt quit read restore save scanstats schema separator session shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width"),keywords:e(d+"abort action add after all analyze attach autoincrement before begin cascade case cast check collate column commit conflict constraint cross current_date current_time current_timestamp database default deferrable deferred detach each else end escape except exclusive exists explain fail for foreign full glob if ignore immediate index indexed initially inner instead intersect isnull key left limit match natural no notnull null of offset outer plan pragma primary query raise recursive references regexp reindex release rename replace restrict right rollback row savepoint temp temporary then to transaction trigger unique using vacuum view virtual when with without"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text clob bigint int int2 int8 integer float double char varchar date datetime year unsigned signed numeric real"),atoms:e("null current_date current_time current_timestamp"),operatorChars:/^[*+\-%<>!=&|/~]/,dateSQL:e("date time timestamp datetime"),support:e("decimallessFloat zerolessFloat"),hooks:{"@":u,":":u,"?":u,$:u,'"':N,"`":f}}),$=s({client:{},keywords:e("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:e("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:e("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:e("commentSlashSlash decimallessFloat"),hooks:{}}),E=s({client:e("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:e("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:e("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*\/+\-%<>!=~]/,dateSQL:e("date time timestamp"),support:e("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),A=s({keywords:e("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with admin authorization char compact compactions conf cube current current_date current_timestamp day decimal defined dependency directories elem_type exchange file following for grouping hour ignore inner interval jar less logical macro minute month more none noscan over owner partialscan preceding pretty principals protection reload rewrite role roles rollup rows second server sets skewed transactions truncate unbounded unset uri user values window year"),builtin:e("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype key_type utctimestamp value_type varchar"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:e("date timestamp"),support:e("ODBCdotTable doubleQuote binaryNumber hexNumber")}),P=s({client:e("source"),keywords:e(d+"a abort abs absent absolute access according action ada add admin after aggregate alias all allocate also alter always analyse analyze and any are array array_agg array_max_cardinality as asc asensitive assert assertion assignment asymmetric at atomic attach attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli between bigint binary bit bit_length blob blocked bom boolean both breadth by c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain char char_length character character_length character_set_catalog character_set_name character_set_schema characteristics characters check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column column_name columns command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constant constraint constraint_catalog constraint_name constraint_schema constraints constructor contains content continue control conversion convert copy corr corresponding cost count covar_pop covar_samp create cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datatype date datetime_interval_code datetime_interval_precision day db deallocate debug dec decimal declare default defaults deferrable deferred defined definer degree delete delimiter delimiters dense_rank depends depth deref derived desc describe descriptor detach detail deterministic diagnostics dictionary disable discard disconnect dispatch distinct dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain double drop dump dynamic dynamic_function dynamic_function_code each element else elseif elsif empty enable encoding encrypted end end_frame end_partition endexec enforced enum equals errcode error escape event every except exception exclude excluding exclusive exec execute exists exit exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreach foreign fortran forward found frame_row free freeze from fs full function functions fusion g general generated get global go goto grant granted greatest group grouping groups handler having header hex hierarchy hint hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import in include including increment indent index indexes indicator info inherit inherits initially inline inner inout input insensitive insert instance instantiable instead int integer integrity intersect intersection interval into invoker is isnull isolation join k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like like_regex limit link listen ln load local localtime localtimestamp location locator lock locked log logged loop lower m map mapping match matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized not nothing notice notify notnull nowait nth_value ntile null nullable nullif nulls number numeric object occurrences_regex octet_length octets of off offset oids old on only open operator option options or order ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parallel parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password path percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding precision prepare prepared preserve primary print_strict_params prior privileges procedural procedure procedures program public publication query quote raise range rank read reads real reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result result_oid return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns reverse revoke right role rollback rollup routine routine_catalog routine_name routine_schema routines row row_count row_number rows rowtype rule savepoint scale schema schema_name schemas scope scope_catalog scope_name scope_schema scroll search second section security select selective self sensitive sequence sequences serializable server server_name session session_user set setof sets share show similar simple size skip slice smallint snapshot some source space specific specific_name specifictype sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable stacked standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time system_user t table table_name tables tablesample tablespace temp template temporary text then ties time timestamp timezone_hour timezone_minute to token top_level_count trailing transaction transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted union unique unknown unlink unlisten unlogged unnamed unnest until untyped update upper uri usage use_column use_variable user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of values var_pop var_samp varbinary varchar variable_conflict variadic varying verbose version versioning view views volatile warning when whenever where while whitespace width_bucket window with within without work wrapper write xml xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes zone"),builtin:e("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:e("false true null unknown"),operatorChars:/^[*\/+\-%<>!=&|^\/#@?~]/,backslashStringEscapes:false,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast escapeConstant")}),W=s({keywords:e("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),atoms:e("false true"),builtin:e("blob datetime first key __key__ string integer double boolean null"),operatorChars:/^[*+\-%<>!=]/}),H=s({client:e("source"),keywords:e("abort absolute access action active add admin after aggregate all also alter always analyse analyze and any array as asc assertion assignment asymmetric at authorization backward before begin between bigint binary bit boolean both by cache called cascade cascaded case cast chain char character characteristics check checkpoint class close cluster coalesce codegen collate column comment commit committed concurrency concurrently configuration connection constraint constraints contains content continue conversion copy cost cpu_rate_limit create createdb createexttable createrole createuser cross csv cube current current_catalog current_date current_role current_schema current_time current_timestamp current_user cursor cycle data database day deallocate dec decimal declare decode default defaults deferrable deferred definer delete delimiter delimiters deny desc dictionary disable discard distinct distributed do document domain double drop dxl each else enable encoding encrypted end enum errors escape every except exchange exclude excluding exclusive execute exists explain extension external extract false family fetch fields filespace fill filter first float following for force foreign format forward freeze from full function global grant granted greatest group group_id grouping handler hash having header hold host hour identity if ignore ilike immediate immutable implicit in including inclusive increment index indexes inherit inherits initially inline inner inout input insensitive insert instead int integer intersect interval into invoker is isnull isolation join key language large last leading least left level like limit list listen load local localtime localtimestamp location lock log login mapping master match maxvalue median merge minute minvalue missing mode modifies modify month move name names national natural nchar new newline next no nocreatedb nocreateexttable nocreaterole nocreateuser noinherit nologin none noovercommit nosuperuser not nothing notify notnull nowait null nullif nulls numeric object of off offset oids old on only operator option options or order ordered others out outer over overcommit overlaps overlay owned owner parser partial partition partitions passing password percent percentile_cont percentile_disc placing plans position preceding precision prepare prepared preserve primary prior privileges procedural procedure protocol queue quote randomly range read readable reads real reassign recheck recursive ref references reindex reject relative release rename repeatable replace replica reset resource restart restrict returning returns revoke right role rollback rollup rootpartition row rows rule savepoint scatter schema scroll search second security segment select sequence serializable session session_user set setof sets share show similar simple smallint some split sql stable standalone start statement statistics stdin stdout storage strict strip subpartition subpartitions substring superuser symmetric sysid system table tablespace temp template temporary text then threshold ties time timestamp to trailing transaction treat trigger trim true truncate trusted type unbounded uncommitted unencrypted union unique unknown unlisten until update user using vacuum valid validation validator value values varchar variadic varying verbose version view volatile web when where whitespace window with within without work writable write xml xmlattributes xmlconcat xmlelement xmlexists xmlforest xmlparse xmlpi xmlroot xmlserialize year yes zone"),builtin:e("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")}),R=s({keywords:e("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases data dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"),builtin:e("tinyint smallint int bigint boolean float double string binary timestamp decimal array map struct uniontype delimited serde sequencefile textfile rcfile inputformat outputformat"),atoms:e("false true null"),operatorChars:/^[*\/+\-%<>!=~&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable doubleQuote zerolessFloat")}),I=s({client:e("source"),keywords:e("alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit after all and as at asc avedev avg between by case cast coalesce count create current_timestamp day days delete define desc distinct else end escape events every exists false first from full group having hour hours in inner insert instanceof into irstream is istream join last lastweekday left limit like max match_recognize matches median measures metadatasql min minute minutes msec millisecond milliseconds not null offset on or order outer output partition pattern prev prior regexp retain-union retain-intersection right rstream sec second seconds select set some snapshot sql stddev sum then true unidirectional until update variable weekday when where window"),builtin:{},atoms:e("false true null"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:e("time"),support:e("decimallessFloat zerolessFloat binaryNumber hexNumber")}); + +export { $ as cassandra, I as esper, H as gpSQL, W as gql, A as hive, D as mariaDB, T as msSQL, B as mySQL, P as pgSQL, E as plSQL, R as sparkSQL, s as sql, O as sqlite, F as standardSQL }; +//# sourceMappingURL=sql-C4K_nLbQ.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ta-DmpZJUPn.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ta-DmpZJUPn.js new file mode 100644 index 0000000000000000000000000000000000000000..63b6c5bc5f6f698a80a624ae2ac1e3c7fcfa234c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/ta-DmpZJUPn.js @@ -0,0 +1,4 @@ +const o="தமிழ்",e={built_with_gradio:"கிரேடியோவுடன் உருவாக்கப்பட்டது",clear:"அழிக்கவும்",or:"அல்லது",submit:"சமர்ப்பிக்கவும்",built_with:"உருவாக்கப்பட்டது",download:"பதிவிறக்கம்",edit:"திருத்து",empty:"காலியாக உள்ளது",error:"பிழை",hosted_on:"இதில் ஹோஸ்ட் செய்யப்பட்டது",loading:"ஏற்றுகிறது",logo:"லோகோ",remove:"நீக்கு",settings:"அமைப்புகள்",share:"பகிர்",undo:"செயல்தவிர்",no_devices:"சாதனங்கள் எதுவும் கிடைக்கவில்லை",language:"மொழி",display_theme:"காட்சி தீம்",pwa:"முன்னேற்ற வலை பயன்பாடு"},t={click_to_upload:"பதிவேற்ற கிளிக் செய்யவும்",drop_audio:"ஆடியோவை இங்கே விடவும்",drop_csv:"CSV ஐ இங்கே விடவும்",drop_file:"கோப்பை இங்கே விடவும்",drop_image:"படத்தை இங்கே விடவும்",drop_video:"வீடியோவை இங்கே விடவும்",drop_gallery:"மீடியாவை இங்கே விடவும்",paste_clipboard:"கிளிப்போர்டிலிருந்து ஒட்டவும்"},r={annotated_image:"குறிப்பிடப்பட்ட படம்"},_={allow_recording_access:"தயவுசெய்து பதிவு செய்ய மைக்ரோஃபோன் அணுகலை அனுமதிக்கவும்.",audio:"ஒலி",drop_to_upload:"ஒலிக் கோப்பை பதிவேற்ற இங்கே விடவும்",record_from_microphone:"மைக்ரோஃபோனிலிருந்து பதிவு செய்யவும்",stop_recording:"பதிவை நிறுத்தவும்",no_device_support:"மீடியா சாதனங்களை அணுக முடியவில்லை. நீங்கள் பாதுகாப்பான மூலத்தில் (https) அல்லது localhost இல் இயங்குகிறீர்களா (அல்லது ssl_verify க்கு செல்லுபடியாகும் SSL சான்றிதழை அனுப்பியுள்ளீர்களா) என்பதையும், உங்கள் சாதனத்திற்கான உலாவி அணுகலை அனுமதித்துள்ளீர்களா என்பதையும் சரிபார்க்கவும்.",stop:"நிறுத்து",resume:"தொடரவும்",record:"பதிவு செய்",no_microphone:"மைக்ரோஃபோன் எதுவும் கிடைக்கவில்லை",pause:"இடைநிறுத்து",play:"இயக்கு",waiting:"காத்திருக்கிறது"},c={connection_can_break:"மொபைலில், இந்தத் தாவல் ஃபோகஸை இழந்தால் அல்லது சாதனம் உறங்கினால், இணைப்பு துண்டிக்கப்பட்டு, வரிசையில் உங்கள் இடத்தை இழக்கலாம்.",long_requests_queue:"காத்திருக்கும் கோரிக்கைகளின் நீண்ட வரிசை உள்ளது. வரிசையைத் தவிர்க்க இந்த Space ஐ நகலெடுக்கவும்.",lost_connection:"பக்கத்தை விட்டு வெளியேறியதால் இணைப்பு துண்டிக்கப்பட்டது. வரிசைக்கு மீண்டும் இணைகிறது...",waiting_for_inputs:"கோப்பு(கள்) பதிவேற்றம் முடிவடைய காத்திருக்கிறது, தயவுசெய்து மீண்டும் முயற்சிக்கவும்."},a={checkbox:"தேர்வுப்பெட்டி",checkbox_group:"தேர்வுப்பெட்டி குழு"},n={code:"குறியீடு"},s={color_picker:"வண்ணத் தேர்வி"},d={incorrect_format:"தவறான வடிவம், CSV மற்றும் TSV கோப்புகள் மட்டுமே ஆதரிக்கப்படுகின்றன",new_column:"நெடுவரிசை சேர்க்க",new_row:"புதிய வரிசை",add_row_above:"மேலே வரிசை சேர்க்க",add_row_below:"கீழே வரிசை சேர்க்க",delete_row:"வரிசையை நீக்கு",delete_column:"நெடுவரிசையை நீக்கு",add_column_left:"இடது பக்கத்தில் நெடுவரிசை சேர்க்க",add_column_right:"வலது பக்கத்தில் நெடுவரிசை சேர்க்க",sort_column:"நெடுவரிசையை வரிசைப்படுத்து",sort_ascending:"ஏறுவரிசையில் வரிசைப்படுத்து",sort_descending:"இறங்குவரிசையில் வரிசைப்படுத்து",drop_to_upload:"தரவுத்தளத்திற்கு தரவை இறக்குமதி செய்ய CSV அல்லது TSV கோப்புகளை இங்கே விடவும்",clear_sort:"வரிசைப்படுத்தலை அழி"},i={dropdown:"கீழ்தோன்றல் பட்டியல்"},l={build_error:"உருவாக்க பிழை உள்ளது",config_error:"கட்டமைப்பு பிழை உள்ளது",contact_page_author:"தயவுசெய்து பக்க ஆசிரியரைத் தொடர்பு கொண்டு தெரிவிக்கவும்.",no_app_file:"பயன்பாட்டுக் கோப்பு இல்லை",runtime_error:"இயக்க நேர பிழை உள்ளது",space_not_working:'"Space செயல்படவில்லை ஏனெனில்" {0}',space_paused:"Space இடைநிறுத்தப்பட்டுள்ளது",use_via_api:"API மூலம் பயன்படுத்தவும்",use_via_api_or_mcp:"API அல்லது MCP மூலம் பயன்படுத்தவும்"},p={uploading:"பதிவேற்றுகிறது..."},u={highlighted_text:"சிறப்பிக்கப்பட்ட உரை"},g={allow_webcam_access:"தயவுசெய்து பதிவு செய்ய வெப்கேம் அணுகலை அனுமதிக்கவும்.",brush_color:"தூரிகை நிறம்",brush_radius:"தூரிகை அளவு",image:"படம்",remove_image:"படத்தை நீக்கு",select_brush_color:"தூரிகை நிறத்தைத் தேர்ந்தெடுக்கவும்",start_drawing:"வரைய தொடங்கவும்",use_brush:"தூரிகையைப் பயன்படுத்தவும்",drop_to_upload:"பட கோப்பை பதிவேற்ற இங்கே விடவும்"},m={label:"லேபிள்"},b={enable_cookies:"நீங்கள் மறைநிலை பயன்முறையில் HuggingFace Space ஐப் பார்வையிட்டால், மூன்றாம் தரப்பு குக்கீகளை இயக்க வேண்டும்.",incorrect_credentials:"தவறான சான்றுகள்",username:"பயனர்பெயர்",password:"கடவுச்சொல்",login:"உள்நுழைய"},h={number:"எண்"},w={plot:"வரைபடம்"},f={radio:"ரேடியோ பொத்தான்"},k={slider:"சறுக்கி"},v={drop_to_upload:"வீடியோ கோப்பை பதிவேற்ற இங்கே விடவும்"},S={edit:"திருத்து",retry:"மீண்டும் முயற்சி",undo:"செயல்தவிர்",submit:"சமர்ப்பிக்கவும்",cancel:"ரத்து",like:"விரும்புகிறேன்",dislike:"விரும்பவில்லை",clear:"உரையாடலை அழி"},x={_name:o,common:e,upload_text:t,"3D_model":{"3d_model":"3D மாதிரி",drop_to_upload:"3D மாதிரி கோப்பை (.obj, .glb, .stl, .gltf, .splat, அல்லது .ply) பதிவேற்ற இங்கே விடவும்"},annotated_image:r,audio:_,blocks:c,checkbox:a,code:n,color_picker:s,dataframe:d,dropdown:i,errors:l,file:p,highlighted_text:u,image:g,label:m,login:b,number:h,plot:w,radio:f,slider:k,video:v,chatbot:S}; + +export { o as _name, r as annotated_image, _ as audio, c as blocks, S as chatbot, a as checkbox, n as code, s as color_picker, e as common, d as dataframe, x as default, i as dropdown, l as errors, p as file, u as highlighted_text, g as image, m as label, b as login, h as number, w as plot, f as radio, k as slider, t as upload_text, v as video }; +//# sourceMappingURL=ta-DmpZJUPn.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/th-DateLXqZ.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/th-DateLXqZ.js new file mode 100644 index 0000000000000000000000000000000000000000..ec67c46cb705dd9dbafc8b2a30442427364fe499 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/th-DateLXqZ.js @@ -0,0 +1,4 @@ +const o="ภาษาไทย",e={annotated_image:"รูปภาพที่มีคำอธิบาย"},t={allow_recording_access:"กรุณาอนุญาตการเข้าถึงไมโครโฟนเพื่อบันทึกเสียง",audio:"เสียง",drop_to_upload:"ลากและวางไฟล์เสียงที่นี่เพื่ออัปโหลด",record_from_microphone:"บันทึกจากไมโครโฟน",stop_recording:"หยุดบันทึก",no_device_support:"ไม่สามารถเข้าถึงอุปกรณ์สื่อได้ โปรดตรวจสอบว่าคุณใช้งานบนโดเมนที่ปลอดภัย (https) หรือ localhost (หรือคุณได้กำหนดค่า SSL ที่ถูกต้อง) และอนุญาตให้เบราว์เซอร์เข้าถึงอุปกรณ์ของคุณ",stop:"หยุด",resume:"ทำงานต่อ",record:"บันทึก",no_microphone:"ไม่พบไมโครโฟน",pause:"หยุดชั่วคราว",play:"เล่น",waiting:"กำลังรอ"},r={connection_can_break:"บนมือถือ การเชื่อมต่ออาจหลุดหากแท็บนี้ไม่ได้อยู่ในโฟกัสหรืออุปกรณ์เข้าสู่โหมดพัก ส่งผลให้เสียตำแหน่งในคิว",long_requests_queue:"มีคิวคำขอรออยู่เป็นจำนวนมาก คัดลอก Space นี้เพื่อข้ามคิว",lost_connection:"การเชื่อมต่อขาดหายเนื่องจากออกจากหน้า กำลังเข้าคิวใหม่...",waiting_for_inputs:"กำลังรอไฟล์อัปโหลดเสร็จ กรุณาลองใหม่"},_={checkbox:"กล่องเลือก",checkbox_group:"กลุ่มกล่องเลือก"},c={code:"โค้ด"},a={color_picker:"ตัวเลือกสี"},n={built_with:"สร้างด้วย",built_with_gradio:"สร้างด้วย Gradio",clear:"ล้าง",download:"ดาวน์โหลด",edit:"แก้ไข",empty:"ว่างเปล่า",error:"ข้อผิดพลาด",hosted_on:"โฮสต์บน",loading:"กำลังโหลด",logo:"โลโก้",or:"หรือ",remove:"ลบ",settings:"การตั้งค่า",share:"แชร์",submit:"ส่ง",undo:"เลิกทำ",no_devices:"ไม่พบอุปกรณ์",language:"ภาษา",display_theme:"ธีมการแสดงผล",pwa:"โปรเกรสซีฟเว็บแอป"},d={incorrect_format:"รูปแบบไม่ถูกต้อง รองรับเฉพาะไฟล์ CSV และ TSV",new_column:"เพิ่มคอลัมน์",new_row:"แถวใหม่",add_row_above:"เพิ่มแถวด้านบน",add_row_below:"เพิ่มแถวด้านล่าง",delete_row:"ลบแถว",delete_column:"ลบคอลัมน์",add_column_left:"เพิ่มคอลัมน์ทางซ้าย",add_column_right:"เพิ่มคอลัมน์ทางขวา",sort_column:"เรียงลำดับคอลัมน์",sort_ascending:"เรียงจากน้อยไปมาก",sort_descending:"เรียงจากมากไปน้อย",drop_to_upload:"ลากและวางไฟล์ CSV หรือ TSV ที่นี่เพื่อนำเข้าข้อมูลลงในตาราง",clear_sort:"ล้างการเรียงลำดับ"},s={dropdown:"เมนูดรอปดาวน์"},i={build_error:"เกิดข้อผิดพลาดในการสร้าง",config_error:"เกิดข้อผิดพลาดในการกำหนดค่า",contact_page_author:"โปรดติดต่อผู้ดูแลเพจเพื่อแจ้งให้ทราบ",no_app_file:"ไม่พบไฟล์แอป",runtime_error:"เกิดข้อผิดพลาดขณะทำงาน",space_not_working:'"Space ใช้งานไม่ได้เนื่องจาก" {0}',space_paused:"Space ถูกหยุดชั่วคราว",use_via_api:"ใช้งานผ่าน API",use_via_api_or_mcp:"ใช้งานผ่าน API หรือ MCP"},l={uploading:"กำลังอัปโหลด..."},p={highlighted_text:"ข้อความที่ถูกเน้น"},u={allow_webcam_access:"กรุณาอนุญาตการเข้าถึงเว็บแคมเพื่อบันทึกภาพ",brush_color:"สีแปรง",brush_radius:"ขนาดแปรง",image:"รูปภาพ",remove_image:"ลบรูปภาพ",select_brush_color:"เลือกสีแปรง",start_drawing:"เริ่มวาด",use_brush:"ใช้แปรง",drop_to_upload:"ลากและวางไฟล์รูปภาพที่นี่เพื่ออัปโหลด"},g={label:"ป้ายกำกับ"},m={enable_cookies:"หากคุณเข้าใช้งาน HuggingFace Space ในโหมดไม่ระบุตัวตน คุณต้องเปิดใช้งานคุกกี้ของบุคคลที่สาม",incorrect_credentials:"ชื่อผู้ใช้หรือรหัสผ่านไม่ถูกต้อง",username:"ชื่อผู้ใช้",password:"รหัสผ่าน",login:"เข้าสู่ระบบ"},b={number:"ตัวเลข"},h={plot:"กราฟ"},w={radio:"ปุ่มตัวเลือก"},k={slider:"แถบเลื่อน"},f={click_to_upload:"คลิกเพื่ออัปโหลด",drop_audio:"ลากและวางไฟล์เสียงที่นี่",drop_csv:"ลากและวางไฟล์ CSV ที่นี่",drop_file:"ลากและวางไฟล์ที่นี่",drop_image:"ลากและวางไฟล์รูปภาพที่นี่",drop_video:"ลากและวางไฟล์วิดีโอที่นี่",drop_gallery:"ลากและวางไฟล์สื่อที่นี่",paste_clipboard:"วางจากคลิปบอร์ด"},S={drop_to_upload:"ลากและวางไฟล์วิดีโอที่นี่เพื่ออัปโหลด"},v={edit:"แก้ไข",retry:"ลองใหม่",undo:"เลิกทำ",submit:"ส่ง",cancel:"ยกเลิก",like:"ถูกใจ",dislike:"ไม่ถูกใจ",clear:"ล้างการสนทนา"},x={_name:o,"3D_model":{"3d_model":"โมเดล 3 มิติ",drop_to_upload:"ลากและวางไฟล์โมเดล 3 มิติ (.obj, .glb, .stl, .gltf, .splat, หรือ .ply) ที่นี่เพื่ออัปโหลด"},annotated_image:e,audio:t,blocks:r,checkbox:_,code:c,color_picker:a,common:n,dataframe:d,dropdown:s,errors:i,file:l,highlighted_text:p,image:u,label:g,login:m,number:b,plot:h,radio:w,slider:k,upload_text:f,video:S,chatbot:v}; + +export { o as _name, e as annotated_image, t as audio, r as blocks, v as chatbot, _ as checkbox, c as code, a as color_picker, n as common, d as dataframe, x as default, s as dropdown, i as errors, l as file, p as highlighted_text, u as image, g as label, m as login, b as number, h as plot, w as radio, k as slider, f as upload_text, S as video }; +//# sourceMappingURL=th-DateLXqZ.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/utils.svelte-B2py64Fz.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/utils.svelte-B2py64Fz.js new file mode 100644 index 0000000000000000000000000000000000000000..b7753f8d62b677543dc13b72c5efb6fdf9418193 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/utils.svelte-B2py64Fz.js @@ -0,0 +1,7 @@ +import { s as snapshot } from './clone-Yk88IHKV.js'; +import { J } from './2-BLdXJizP.js'; + +const d="__i18n__",f=["label","info","placeholder","description","title","value"];class c extends Error{constructor(e){super(e),this.name="ShareError";}}async function b(s,e){if(window.__gradio_space__==null)throw new c("Must be on Spaces to share.");let r,t,o;{let p;if(typeof s=="object"&&s.url)p=s.url;else if(typeof s=="string")p=s;else throw new Error("Invalid data format for URL type");const h=await fetch(p);r=await h.blob(),t=h.headers.get("content-type")||"",o=h.headers.get("content-disposition")||"";}const n=new File([r],o,{type:t}),a=await fetch("https://huggingface.co/uploads",{method:"POST",body:n,headers:{"Content-Type":n.type,"X-Requested-With":"XMLHttpRequest"}});if(!a.ok){if(a.headers.get("content-type")?.includes("application/json")){const p=await a.json();throw new c(`Upload failed: ${p.error}`)}throw new c("Upload failed.")}return await a.text()}const w=s=>{const e=Math.floor(s/3600),r=Math.floor(s%3600/60),t=Math.round(s)%60,o=`${r<10?"0":""}${r}`,n=`${t<10?"0":""}${t}`;return e>0?`${e}:${o}:${n}`:`${r}:${n}`},u=["elem_id","elem_classes","visible","interactive","server_fns","server","id","target","theme_mode","version","root","autoscroll","max_file_size","formatter","client","load_component","scale","min_width","theme","padding","loading_status","label","show_label","validation_error","show_progress","api_prefix","container","attached_events","register_component","dispatcher"];function m(s){return typeof s=="string"&&s.includes(d)}function k(s,e){const r=s.indexOf(d);if(r===-1)return s;const t=r+d.length,o=s.indexOf("}",t)+1;if(o===0)return s;try{const n=JSON.parse(s.slice(t,o));if(n?.key){const a=e(n.key),i=a!==n.key?a:n.key;return s.slice(0,r)+i+s.slice(o)}}catch{}return s}class ${load_component;shared={};props={};i18n=e=>e;translatable_props={};dispatcher;last_update=null;shared_props=u;mounted=false;old_value;register_component;constructor(e,r){for(const t in e.shared_props)this.shared[t]=e.shared_props[t];for(const t in e.props)this.props[t]=e.props[t];if(r)for(const t in r)this.props[t]===void 0&&(this.props[t]=r[t]);this.i18n=this.props.i18n??(t=>t);for(const t of f)this.shared[t]=this._translate_and_store("shared",t,e.shared_props[t]),this.props[t]=this._translate_and_store("props",t,e.props[t]);this.load_component=this.shared.load_component,this.register_component=this.shared.register_component||(()=>{}),this.dispatcher=this.shared.dispatcher||(()=>{}),this.register_component(e.shared_props.id,this.set_data.bind(this),this.get_data.bind(this)),Object.keys(this.translatable_props).length>0&&J.subscribe(()=>{for(const[t,o]of Object.entries(this.translatable_props)){const[n,a]=t.split("."),i=this.i18n(o);n==="shared"?this.shared[a]=i:this.props[a]=i;}});}_is_i18n_managed(e,r){const t=this.translatable_props[e];return t?r===t?true:(delete this.translatable_props[e],false):false}_translate_and_store(e,r,t){if(typeof t!="string")return t;const o=this.i18n(t);return o!==t&&(this.translatable_props[`${e}.${r}`]=t),o}dispatch(e,r){this.dispatcher(this.shared.id,e,r);}async get_data(){return snapshot(this.props)}update(e){this.set_data(e);}set_data(e){for(const r in e){const t=e[r],o=m(t)?this._translate_and_store(this.shared_props.includes(r)?"shared":"props",r,t):t;if(this.shared_props.includes(r)){const n=r;this.shared[n]=o;continue}this.props[r]=o;}}watch_for_change(){}}const x=s=>typeof s=="number"?s+"px":s; + +export { $, b, c, d, k, u, w, x }; +//# sourceMappingURL=utils.svelte-B2py64Fz.js.map diff --git a/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/uz-D7FUtAO1.js b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/uz-D7FUtAO1.js new file mode 100644 index 0000000000000000000000000000000000000000..e535b5cdf0ae04d1c5d3d13d4e53da8e057953e4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/gradio/templates/node/build/server/chunks/uz-D7FUtAO1.js @@ -0,0 +1,4 @@ +const a="O'zbek",i={built_with_gradio:"Gradio bilan yaratilgan",clear:"Tozalash",submit:"Yuborish",built_with:"Bilan yaratilgan",download:"Yuklab olish",edit:"Tahrirlash",empty:"Bo'sh",error:"Xato",hosted_on:"Joylashtirilgan",loading:"Yuklanmoqda",logo:"Logo",or:"yoki",remove:"O'chirish",settings:"Sozlamalar",share:"Ulashish",undo:"Bekor qilish",no_devices:"Hech qanday qurilma topilmadi",language:"Til",display_theme:"Ko'rinish mavzusi",pwa:"Progressive web-ilova"},o={click_to_upload:"Yuklash uchun bosing",drop_audio:"Audioni shu yerga tashlang",drop_csv:"CSV faylni shu yerga tashlang",drop_file:"Faylni shu yerga tashlang",drop_image:"Rasmni shu yerga tashlang",drop_video:"Videoni shu yerga tashlang",drop_gallery:"Mediafaylni shu yerga tashlang",paste_clipboard:"Klipboarddan qo'yish"},n={annotated_image:"Izohli rasm"},s={allow_recording_access:"Iltimos, yozib olish uchun mikrofonga ruxsat bering.",audio:"Audio",drop_to_upload:"Audio faylni yuklash uchun shu yerga tashlang",record_from_microphone:"Mikrofondan yozib olish",stop_recording:"Yozib olishni to'xtatish",no_device_support:"Media qurilmalariga kira olmadik. Xavfsiz manbada (https) yoki localhost-da ishlayotganingizni tekshiring (yoki to'g'ri SSL sertifikatini ssl_verify-ga berganingizni) va brauzer qurilmangizga kirishiga ruxsat berganingizni tekshiring.",stop:"To'xtatish",resume:"Davom ettirish",record:"Yozib olish",no_microphone:"Mikrofon topilmadi",pause:"Pauza",play:"Ijro etish",waiting:"Kutilmoqda"},r={connection_can_break:"Mobil qurilmada, agar bu yorliq fokusdan chiqsa yoki qurilma uyqu rejimiga o'tsa, aloqa uzilib, navbatdagi o'rningizni yo'qotishingiz mumkin.",long_requests_queue:"So'rovlar navbati juda uzun. Navbatni chetlab o'tish uchun bu Space-ni nusxalang.",lost_connection:"Sahifadan chiqib ketganligi sababli aloqa uzildi. Navbatga qayta qo'shilmoqda...",waiting_for_inputs:"Fayl(lar) yuklanib bo'lishini kutish, iltimos, qayta urinib ko'ring."},l={checkbox:"Belgilash katagi",checkbox_group:"Belgilash kataklari guruhi"},t={code:"Kod"},e={color_picker:"Rang tanlagich"},h={incorrect_format:"Noto'g'ri format, faqat CSV va TSV fayllari qo'llab-quvvatlanadi",new_column:"Ustun qo'shish",new_row:"Yangi qator",add_row_above:"Yuqoriga qator qo'shish",add_row_below:"Pastga qator qo'shish",delete_row:"Qatorni o'chirish",delete_column:"Ustunni o'chirish",add_column_left:"Chapga ustun qo'shish",add_column_right:"O'ngga ustun qo'shish",sort_column:"Ustunni saralash",sort_ascending:"O'sish tartibida saralash",sort_descending:"Kamayish tartibida saralash",drop_to_upload:"Ma'lumotlarni ma'lumotlar jadvaliga import qilish uchun CSV yoki TSV fayllarini shu yerga tashlang",clear_sort:"Saralashni tozalash"},u={dropdown:"Ochiluvchi ro'yxat"},g={build_error:"Tuzilish xatosi mavjud",config_error:"Konfiguratsiya xatosi mavjud",contact_page_author:"Iltimos, sahifa muallifiga bog'laning va ularga xabar bering.",no_app_file:"Ilova fayli yo'q",runtime_error:"Bajarilish vaqti xatosi mavjud",space_not_working:'"Space ishlamayapti, chunki" {0}',space_paused:"Space to'xtatilgan",use_via_api:"API orqali foydalaning",use_via_api_or_mcp:"API yoki MCP orqali foydalaning"},d={uploading:"Yuklanmoqda..."},c={highlighted_text:"Ajratilgan matn"},_={allow_webcam_access:"Iltimos, yozib olish uchun veb-kameraga ruxsat bering.",brush_color:"Cho'tka rangi",brush_radius:"Cho'tka o'lchami",image:"Rasm",remove_image:"Rasmni o'chirish",select_brush_color:"Cho'tka rangini tanlang",start_drawing:"Chizishni boshlang",use_brush:"Cho'tkadan foydalaning",drop_to_upload:"Rasm faylini yuklash uchun shu yerga tashlang"},m={label:"Yorliq"},b={enable_cookies:"Agar HuggingFace Space-ni Inkognito rejimida ko'rayotgan bo'lsangiz, uchinchi tomon kukilarini yoqishingiz kerak.",incorrect_credentials:"Noto'g'ri kirish ma'lumotlari",username:"Foydalanuvchi nomi",password:"Parol",login:"Kirish"},y={number:"Raqam"},p={plot:"Grafik"},k={radio:"Radio tugma"},q={slider:"Slayder"},f={drop_to_upload:"Video faylni yuklash uchun shu yerga tashlang"},v={edit:"Tahrirlash",retry:"Qayta urinish",undo:"Bekor qilish",submit:"Yuborish",cancel:"Bekor qilish",like:"Yoqdi",dislike:"Yoqmadi",clear:"Suhbatni tozalash"},z={_name:a,common:i,upload_text:o,"3D_model":{"3d_model":"3D model",drop_to_upload:"3D model (.obj, .glb, .stl, .gltf, .splat yoki .ply) faylni yuklash uchun shu yerga tashlang"},annotated_image:n,audio:s,blocks:r,checkbox:l,code:t,color_picker:e,dataframe:h,dropdown:u,errors:g,file:d,highlighted_text:c,image:_,label:m,login:b,number:y,plot:p,radio:k,slider:q,video:f,chatbot:v}; + +export { a as _name, n as annotated_image, s as audio, r as blocks, v as chatbot, l as checkbox, t as code, e as color_picker, i as common, h as dataframe, z as default, u as dropdown, g as errors, d as file, c as highlighted_text, _ as image, m as label, b as login, y as number, p as plot, k as radio, q as slider, o as upload_text, f as video }; +//# sourceMappingURL=uz-D7FUtAO1.js.map diff --git a/.venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/INSTALLER b/.venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/INSTALLER @@ -0,0 +1 @@ +uv \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/REQUESTED b/.venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/WHEEL b/.venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..12228d414b6cfed7c39d3781c85c63256a1d7fb5 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/httpcore-1.0.9.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.27.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/INSTALLER b/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/INSTALLER @@ -0,0 +1 @@ +uv \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/METADATA b/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..b30fccc5b67d31f3b4eb7c26e5be2379f9f493d3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/METADATA @@ -0,0 +1,204 @@ +Metadata-Version: 2.4 +Name: idna +Version: 3.13 +Summary: Internationalized Domain Names in Applications (IDNA) +Author-email: Kim Davies +Requires-Python: >=3.8 +Description-Content-Type: text/x-rst +License-Expression: BSD-3-Clause +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: System Administrators +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Internet :: Name Service (DNS) +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Utilities +License-File: LICENSE.md +Requires-Dist: ruff >= 0.6.2 ; extra == "all" +Requires-Dist: mypy >= 1.11.2 ; extra == "all" +Requires-Dist: pytest >= 8.3.2 ; extra == "all" +Project-URL: Changelog, https://github.com/kjd/idna/blob/master/HISTORY.rst +Project-URL: Issue tracker, https://github.com/kjd/idna/issues +Project-URL: Source, https://github.com/kjd/idna +Provides-Extra: all + +Internationalized Domain Names in Applications (IDNA) +===================================================== + +Support for `Internationalized Domain Names in +Applications (IDNA) `_ +and `Unicode IDNA Compatibility Processing +`_. + +The latest versions of these standards supplied here provide +more comprehensive language coverage and reduce the potential of +allowing domains with known security vulnerabilities. This library +is a suitable replacement for the “encodings.idna” +module that comes with the Python standard library, but which +only supports an older superseded IDNA specification from 2003. + +Basic functions are simply executed: + +.. code-block:: pycon + + >>> import idna + >>> idna.encode('ドメイン.テスト') + b'xn--eckwd4c7c.xn--zckzah' + >>> print(idna.decode('xn--eckwd4c7c.xn--zckzah')) + ドメイン.テスト + + +Installation +------------ + +This package is available for installation from PyPI via the +typical mechanisms, such as: + +.. code-block:: bash + + $ python3 -m pip install idna + + +Usage +----- + +For typical usage, the ``encode`` and ``decode`` functions will take a +domain name argument and perform a conversion to ASCII-compatible encoding +(known as A-labels), or to Unicode strings (known as U-labels) +respectively. + +.. code-block:: pycon + + >>> import idna + >>> idna.encode('ドメイン.テスト') + b'xn--eckwd4c7c.xn--zckzah' + >>> print(idna.decode('xn--eckwd4c7c.xn--zckzah')) + ドメイン.テスト + +Conversions can be applied at a per-label basis using the ``ulabel`` or +``alabel`` functions if necessary: + +.. code-block:: pycon + + >>> idna.alabel('测试') + b'xn--0zwm56d' + + +Compatibility Mapping (UTS #46) ++++++++++++++++++++++++++++++++ + +This library provides support for `Unicode IDNA Compatibility +Processing `_ which normalizes input from +different potential ways a user may input a domain prior to performing the IDNA +conversion operations. This functionality, known as a +`mapping `_, is considered by the +specification to be a local user-interface issue distinct from IDNA +conversion functionality. + +For example, “Königsgäßchen” is not a permissible label as *LATIN +CAPITAL LETTER K* is not allowed (nor are capital letters in general). +UTS 46 will convert this into lower case prior to applying the IDNA +conversion. + +.. code-block:: pycon + + >>> import idna + >>> idna.encode('Königsgäßchen') + ... + idna.core.InvalidCodepoint: Codepoint U+004B at position 1 of 'Königsgäßchen' not allowed + >>> idna.encode('Königsgäßchen', uts46=True) + b'xn--knigsgchen-b4a3dun' + >>> print(idna.decode('xn--knigsgchen-b4a3dun')) + königsgäßchen + + +Exceptions +---------- + +All errors raised during the conversion following the specification +should raise an exception derived from the ``idna.IDNAError`` base +class. + +More specific exceptions that may be generated as ``idna.IDNABidiError`` +when the error reflects an illegal combination of left-to-right and +right-to-left characters in a label; ``idna.InvalidCodepoint`` when +a specific codepoint is an illegal character in an IDN label (i.e. +INVALID); and ``idna.InvalidCodepointContext`` when the codepoint is +illegal based on its position in the string (i.e. it is CONTEXTO or CONTEXTJ +but the contextual requirements are not satisfied.) + +Building and Diagnostics +------------------------ + +The IDNA and UTS 46 functionality relies upon pre-calculated lookup +tables for performance. These tables are derived from computing against +eligibility criteria in the respective standards using the command-line +script ``tools/idna-data``. + +This tool will fetch relevant codepoint data from the Unicode repository +and perform the required calculations to identify eligibility. There are +three main modes: + +* ``idna-data make-libdata``. Generates ``idnadata.py`` and + ``uts46data.py``, the pre-calculated lookup tables used for IDNA and + UTS 46 conversions. Implementers who wish to track this library against + a different Unicode version may use this tool to manually generate a + different version of the ``idnadata.py`` and ``uts46data.py`` files. + +* ``idna-data make-table``. Generate a table of the IDNA disposition + (e.g. PVALID, CONTEXTJ, CONTEXTO) in the format found in Appendix + B.1 of RFC 5892 and the pre-computed tables published by `IANA + `_. + +* ``idna-data U+0061``. Prints debugging output on the various + properties associated with an individual Unicode codepoint (in this + case, U+0061), that are used to assess the IDNA and UTS 46 status of a + codepoint. This is helpful in debugging or analysis. + +The tool accepts a number of arguments, described using ``idna-data -h``. +Most notably, the ``--version`` argument allows the specification +of the version of Unicode to be used in computing the table data. For +example, ``idna-data --version 9.0.0 make-libdata`` will generate +library data against Unicode 9.0.0. + + +Additional Notes +---------------- + +* **Packages**. The latest tagged release version is published in the + `Python Package Index `_. + +* **Version support**. This library supports Python 3.8 and higher. + As this library serves as a low-level toolkit for a variety of + applications, many of which strive for broad compatibility with older + Python versions, there is no rush to remove older interpreter support. + Support for older versions are likely to be removed from new releases + as automated tests can no longer easily be run, i.e. once the Python + version is officially end-of-life. + +* **Testing**. The library has a test suite based on each rule of the + IDNA specification, as well as tests that are provided as part of the + Unicode Technical Standard 46, `Unicode IDNA Compatibility Processing + `_. + +* **Emoji**. It is an occasional request to support emoji domains in + this library. Encoding of symbols like emoji is expressly prohibited by + the IDNA technical standard, and emoji domains are broadly phased + out across the domain industry due to associated security risks. + +* **Transitional processing**. Unicode 16.0.0 removed transitional + processing so the `transitional` argument for the encode() method + no longer has any effect and will be removed at a later date. + diff --git a/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/RECORD b/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..b5ead6daaebb776b2603ef07d78bf3b2a147b109 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/RECORD @@ -0,0 +1,15 @@ +idna-3.13.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +idna-3.13.dist-info/METADATA,sha256=aCJPP9iIHtp9NZSENIrzP52rgjQxw0-PWNfHGJ7ffQA,8033 +idna-3.13.dist-info/RECORD,, +idna-3.13.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +idna-3.13.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82 +idna-3.13.dist-info/licenses/LICENSE.md,sha256=GppPDj1HmickDd1ZqRN6ZqtKD539yMphiMwL_YUYfwQ,1541 +idna/__init__.py,sha256=MPqNDLZbXqGaNdXxAFhiqFPKEQXju2jNQhCey6-5eJM,868 +idna/codec.py,sha256=M2SGWN7cs_6B32QmKTyTN6xQGZeYQgQ2wiX3_DR6loE,3438 +idna/compat.py,sha256=RzLy6QQCdl9784aFhb2EX9EKGCJjg0P3PilGdeXXcx8,316 +idna/core.py,sha256=0_28DR8hKT_pJKcmbeIQiiO1rHOpS3kJTtp9pyrk-4k,13374 +idna/idnadata.py,sha256=EYkhqhOze0Whw1pIMum_-qEHM-8utUwc_IBoIUWW8Go,92613 +idna/intranges.py,sha256=amUtkdhYcQG8Zr-CoMM_kVRacxkivC1WgxN1b63KKdU,1898 +idna/package_data.py,sha256=Nc4yldCrxxvai27WL76JL60jhw0ajOoboFGsm5L8FxM,21 +idna/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +idna/uts46data.py,sha256=JAacELsMTouJI-U6jk_UcKuAM4K7ffGCYpbDLux8iVk,202713 diff --git a/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/REQUESTED b/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/WHEEL b/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..d8b9936dad9ab2513fa6979f411560d3b6b57e37 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: flit 3.12.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/licenses/LICENSE.md b/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/licenses/LICENSE.md new file mode 100644 index 0000000000000000000000000000000000000000..f706835ab3a5dd709a6e1f57aee0a94ae1415df6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/idna-3.13.dist-info/licenses/LICENSE.md @@ -0,0 +1,31 @@ +BSD 3-Clause License + +Copyright (c) 2013-2026, Kim Davies and contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/__init__.py b/.venv/lib/python3.10/site-packages/importlib_metadata/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..508b02e4fce3fa9463b7466138cca7414db0e9b9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/importlib_metadata/__init__.py @@ -0,0 +1,1191 @@ +""" +APIs exposing metadata from third-party Python packages. + +This codebase is shared between importlib.metadata in the stdlib +and importlib_metadata in PyPI. See +https://github.com/python/importlib_metadata/wiki/Development-Methodology +for more detail. +""" + +from __future__ import annotations + +import abc +import collections +import email +import functools +import itertools +import operator +import os +import pathlib +import posixpath +import re +import sys +import textwrap +import types +from collections.abc import Iterable, Mapping +from contextlib import suppress +from importlib import import_module +from importlib.abc import MetaPathFinder +from itertools import starmap +from typing import Any + +from . import _meta +from ._collections import FreezableDefaultDict, Pair +from ._compat import ( + NullFinder, + install, +) +from ._functools import method_cache, noop, pass_none, passthrough +from ._itertools import always_iterable, bucket, unique_everseen +from ._meta import PackageMetadata, SimplePath +from ._typing import md_none +from .compat import py39, py311 + +__all__ = [ + 'Distribution', + 'DistributionFinder', + 'PackageMetadata', + 'PackageNotFoundError', + 'SimplePath', + 'distribution', + 'distributions', + 'entry_points', + 'files', + 'metadata', + 'packages_distributions', + 'requires', + 'version', +] + + +class PackageNotFoundError(ModuleNotFoundError): + """The package was not found.""" + + def __str__(self) -> str: + return f"No package metadata was found for {self.name}" + + @property + def name(self) -> str: # type: ignore[override] # make readonly + (name,) = self.args + return name + + +class Sectioned: + """ + A simple entry point config parser for performance + + >>> for item in Sectioned.read(Sectioned._sample): + ... print(item) + Pair(name='sec1', value='# comments ignored') + Pair(name='sec1', value='a = 1') + Pair(name='sec1', value='b = 2') + Pair(name='sec2', value='a = 2') + + >>> res = Sectioned.section_pairs(Sectioned._sample) + >>> item = next(res) + >>> item.name + 'sec1' + >>> item.value + Pair(name='a', value='1') + >>> item = next(res) + >>> item.value + Pair(name='b', value='2') + >>> item = next(res) + >>> item.name + 'sec2' + >>> item.value + Pair(name='a', value='2') + >>> list(res) + [] + """ + + _sample = textwrap.dedent( + """ + [sec1] + # comments ignored + a = 1 + b = 2 + + [sec2] + a = 2 + """ + ).lstrip() + + @classmethod + def section_pairs(cls, text): + return ( + section._replace(value=Pair.parse(section.value)) + for section in cls.read(text, filter_=cls.valid) + if section.name is not None + ) + + @staticmethod + def read(text, filter_=None): + lines = filter(filter_, map(str.strip, text.splitlines())) + name = None + for value in lines: + section_match = value.startswith('[') and value.endswith(']') + if section_match: + name = value.strip('[]') + continue + yield Pair(name, value) + + @staticmethod + def valid(line: str): + return line and not line.startswith('#') + + +class _EntryPointMatch(types.SimpleNamespace): + module: str + attr: str + extras: str + + +class EntryPoint: + """An entry point as defined by Python packaging conventions. + + See `the packaging docs on entry points + `_ + for more information. + + >>> ep = EntryPoint( + ... name=None, group=None, value='package.module:attr [extra1, extra2]') + >>> ep.module + 'package.module' + >>> ep.attr + 'attr' + >>> ep.extras + ['extra1', 'extra2'] + + If the value package or module are not valid identifiers, a + ValueError is raised on access. + + >>> EntryPoint(name=None, group=None, value='invalid-name').module + Traceback (most recent call last): + ... + ValueError: ('Invalid object reference...invalid-name... + >>> EntryPoint(name=None, group=None, value='invalid-name').attr + Traceback (most recent call last): + ... + ValueError: ('Invalid object reference...invalid-name... + >>> EntryPoint(name=None, group=None, value='invalid-name').extras + Traceback (most recent call last): + ... + ValueError: ('Invalid object reference...invalid-name... + + The same thing happens on construction. + + >>> EntryPoint(name=None, group=None, value='invalid-name') + Traceback (most recent call last): + ... + ValueError: ('Invalid object reference...invalid-name... + + """ + + pattern = re.compile( + r'(?P[\w.]+)\s*' + r'(:\s*(?P[\w.]+)\s*)?' + r'((?P\[.*\])\s*)?$' + ) + """ + A regular expression describing the syntax for an entry point, + which might look like: + + - module + - package.module + - package.module:attribute + - package.module:object.attribute + - package.module:attr [extra1, extra2] + + Other combinations are possible as well. + + The expression is lenient about whitespace around the ':', + following the attr, and following any extras. + """ + + name: str + value: str + group: str + + dist: Distribution | None = None + + def __init__(self, name: str, value: str, group: str) -> None: + vars(self).update(name=name, value=value, group=group) + self.module + + def load(self) -> Any: + """Load the entry point from its definition. If only a module + is indicated by the value, return that module. Otherwise, + return the named object. + """ + module = import_module(self.module) + attrs = filter(None, (self.attr or '').split('.')) + return functools.reduce(getattr, attrs, module) + + @property + def module(self) -> str: + return self._match.module + + @property + def attr(self) -> str: + return self._match.attr + + @property + def extras(self) -> list[str]: + return re.findall(r'\w+', self._match.extras or '') + + @functools.cached_property + def _match(self) -> _EntryPointMatch: + match = self.pattern.match(self.value) + if not match: + raise ValueError( + 'Invalid object reference. ' + 'See https://packaging.python.org' + '/en/latest/specifications/entry-points/#data-model', + self.value, + ) + return _EntryPointMatch(**match.groupdict()) + + def _for(self, dist): + vars(self).update(dist=dist) + return self + + def matches(self, **params): + """ + EntryPoint matches the given parameters. + + >>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]') + >>> ep.matches(group='foo') + True + >>> ep.matches(name='bar', value='bing:bong [extra1, extra2]') + True + >>> ep.matches(group='foo', name='other') + False + >>> ep.matches() + True + >>> ep.matches(extras=['extra1', 'extra2']) + True + >>> ep.matches(module='bing') + True + >>> ep.matches(attr='bong') + True + """ + self._disallow_dist(params) + attrs = (getattr(self, param) for param in params) + return all(map(operator.eq, params.values(), attrs)) + + @staticmethod + def _disallow_dist(params): + """ + Querying by dist is not allowed (dist objects are not comparable). + >>> EntryPoint(name='fan', value='fav', group='fag').matches(dist='foo') + Traceback (most recent call last): + ... + ValueError: "dist" is not suitable for matching... + """ + if "dist" in params: + raise ValueError( + '"dist" is not suitable for matching. ' + "Instead, use Distribution.entry_points.select() on a " + "located distribution." + ) + + def _key(self): + return self.name, self.value, self.group + + def __lt__(self, other): + return self._key() < other._key() + + def __eq__(self, other): + return self._key() == other._key() + + def __setattr__(self, name, value): + raise AttributeError("EntryPoint objects are immutable.") + + def __repr__(self): + return ( + f'EntryPoint(name={self.name!r}, value={self.value!r}, ' + f'group={self.group!r})' + ) + + def __hash__(self) -> int: + return hash(self._key()) + + +class EntryPoints(tuple): + """ + An immutable collection of selectable EntryPoint objects. + """ + + __slots__ = () + + def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override] # Work with str instead of int + """ + Get the EntryPoint in self matching name. + """ + try: + return next(iter(self.select(name=name))) + except StopIteration: + raise KeyError(name) + + def __repr__(self): + """ + Repr with classname and tuple constructor to + signal that we deviate from regular tuple behavior. + """ + return '%s(%r)' % (self.__class__.__name__, tuple(self)) + + def select(self, **params) -> EntryPoints: + """ + Select entry points from self that match the + given parameters (typically group and/or name). + """ + return EntryPoints(ep for ep in self if py39.ep_matches(ep, **params)) + + @property + def names(self) -> set[str]: + """ + Return the set of all names of all entry points. + """ + return {ep.name for ep in self} + + @property + def groups(self) -> set[str]: + """ + Return the set of all groups of all entry points. + """ + return {ep.group for ep in self} + + @classmethod + def _from_text_for(cls, text, dist): + return cls(ep._for(dist) for ep in cls._from_text(text)) + + @staticmethod + def _from_text(text): + return ( + EntryPoint(name=item.value.name, value=item.value.value, group=item.name) + for item in Sectioned.section_pairs(text or '') + ) + + +class PackagePath(pathlib.PurePosixPath): + """A reference to a path in a package""" + + hash: FileHash | None + size: int + dist: Distribution + + def read_text(self, encoding: str = 'utf-8') -> str: + return self.locate().read_text(encoding=encoding) + + def read_binary(self) -> bytes: + return self.locate().read_bytes() + + def locate(self) -> SimplePath: + """Return a path-like object for this path""" + return self.dist.locate_file(self) + + +class FileHash: + def __init__(self, spec: str) -> None: + self.mode, _, self.value = spec.partition('=') + + def __repr__(self) -> str: + return f'' + + +class Distribution(metaclass=abc.ABCMeta): + """ + An abstract Python distribution package. + + Custom providers may derive from this class and define + the abstract methods to provide a concrete implementation + for their environment. Some providers may opt to override + the default implementation of some properties to bypass + the file-reading mechanism. + """ + + @abc.abstractmethod + def read_text(self, filename) -> str | None: + """Attempt to load metadata file given by the name. + + Python distribution metadata is organized by blobs of text + typically represented as "files" in the metadata directory + (e.g. package-1.0.dist-info). These files include things + like: + + - METADATA: The distribution metadata including fields + like Name and Version and Description. + - entry_points.txt: A series of entry points as defined in + `the entry points spec `_. + - RECORD: A record of files according to + `this recording spec `_. + + A package may provide any set of files, including those + not listed here or none at all. + + :param filename: The name of the file in the distribution info. + :return: The text if found, otherwise None. + """ + + @abc.abstractmethod + def locate_file(self, path: str | os.PathLike[str]) -> SimplePath: + """ + Given a path to a file in this distribution, return a SimplePath + to it. + + This method is used by callers of ``Distribution.files()`` to + locate files within the distribution. If it's possible for a + Distribution to represent files in the distribution as + ``SimplePath`` objects, it should implement this method + to resolve such objects. + + Some Distribution providers may elect not to resolve SimplePath + objects within the distribution by raising a + NotImplementedError, but consumers of such a Distribution would + be unable to invoke ``Distribution.files()``. + """ + + @classmethod + def from_name(cls, name: str) -> Distribution: + """Return the Distribution for the given package name. + + :param name: The name of the distribution package to search for. + :return: The Distribution instance (or subclass thereof) for the named + package, if found. + :raises PackageNotFoundError: When the named package's distribution + metadata cannot be found. + :raises ValueError: When an invalid value is supplied for name. + """ + if not name: + raise ValueError("A distribution name is required.") + try: + return next(iter(cls._prefer_valid(cls.discover(name=name)))) + except StopIteration: + raise PackageNotFoundError(name) + + @classmethod + def discover( + cls, *, context: DistributionFinder.Context | None = None, **kwargs + ) -> Iterable[Distribution]: + """Return an iterable of Distribution objects for all packages. + + Pass a ``context`` or pass keyword arguments for constructing + a context. + + :context: A ``DistributionFinder.Context`` object. + :return: Iterable of Distribution objects for packages matching + the context. + """ + if context and kwargs: + raise ValueError("cannot accept context and kwargs") + context = context or DistributionFinder.Context(**kwargs) + return itertools.chain.from_iterable( + resolver(context) for resolver in cls._discover_resolvers() + ) + + @staticmethod + def _prefer_valid(dists: Iterable[Distribution]) -> Iterable[Distribution]: + """ + Prefer (move to the front) distributions that have metadata. + + Ref python/importlib_resources#489. + """ + buckets = bucket(dists, lambda dist: bool(dist.metadata)) + return itertools.chain(buckets[True], buckets[False]) + + @staticmethod + def at(path: str | os.PathLike[str]) -> Distribution: + """Return a Distribution for the indicated metadata path. + + :param path: a string or path-like object + :return: a concrete Distribution instance for the path + """ + return PathDistribution(pathlib.Path(path)) + + @staticmethod + def _discover_resolvers(): + """Search the meta_path for resolvers (MetadataPathFinders).""" + declared = ( + getattr(finder, 'find_distributions', None) for finder in sys.meta_path + ) + return filter(None, declared) + + @property + def metadata(self) -> _meta.PackageMetadata | None: + """Return the parsed metadata for this Distribution. + + The returned object will have keys that name the various bits of + metadata per the + `Core metadata specifications `_. + + Custom providers may provide the METADATA file or override this + property. + """ + + text = ( + self.read_text('METADATA') + or self.read_text('PKG-INFO') + # This last clause is here to support old egg-info files. Its + # effect is to just end up using the PathDistribution's self._path + # (which points to the egg-info file) attribute unchanged. + or self.read_text('') + ) + return self._assemble_message(text) + + @staticmethod + @pass_none + def _assemble_message(text: str) -> _meta.PackageMetadata: + # deferred for performance (python/cpython#109829) + from . import _adapters + + return _adapters.Message(email.message_from_string(text)) + + @property + def name(self) -> str: + """Return the 'Name' metadata for the distribution package.""" + return md_none(self.metadata)['Name'] + + @property + def _normalized_name(self): + """Return a normalized version of the name.""" + return Prepared.normalize(self.name) + + @property + def version(self) -> str: + """Return the 'Version' metadata for the distribution package.""" + return md_none(self.metadata)['Version'] + + @property + def entry_points(self) -> EntryPoints: + """ + Return EntryPoints for this distribution. + + Custom providers may provide the ``entry_points.txt`` file + or override this property. + """ + return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self) + + @property + def files(self) -> list[PackagePath] | None: + """Files in this distribution. + + :return: List of PackagePath for this distribution or None + + Result is `None` if the metadata file that enumerates files + (i.e. RECORD for dist-info, or installed-files.txt or + SOURCES.txt for egg-info) is missing. + Result may be empty if the metadata exists but is empty. + + Custom providers are recommended to provide a "RECORD" file (in + ``read_text``) or override this property to allow for callers to be + able to resolve filenames provided by the package. + """ + + def make_file(name, hash=None, size_str=None): + result = PackagePath(name) + result.hash = FileHash(hash) if hash else None + result.size = int(size_str) if size_str else None + result.dist = self + return result + + @pass_none + def make_files(lines): + # Delay csv import, since Distribution.files is not as widely used + # as other parts of importlib.metadata + import csv + + return starmap(make_file, csv.reader(lines)) + + @pass_none + def skip_missing_files(package_paths): + return list(filter(lambda path: path.locate().exists(), package_paths)) + + return skip_missing_files( + make_files( + self._read_files_distinfo() + or self._read_files_egginfo_installed() + or self._read_files_egginfo_sources() + ) + ) + + def _read_files_distinfo(self): + """ + Read the lines of RECORD. + """ + text = self.read_text('RECORD') + return text and text.splitlines() + + def _read_files_egginfo_installed(self): + """ + Read installed-files.txt and return lines in a similar + CSV-parsable format as RECORD: each file must be placed + relative to the site-packages directory and must also be + quoted (since file names can contain literal commas). + + This file is written when the package is installed by pip, + but it might not be written for other installation methods. + Assume the file is accurate if it exists. + """ + text = self.read_text('installed-files.txt') + # Prepend the .egg-info/ subdir to the lines in this file. + # But this subdir is only available from PathDistribution's + # self._path. + subdir = getattr(self, '_path', None) + if not text or not subdir: + return + + paths = ( + py311 + .relative_fix((subdir / name).resolve()) + .relative_to(self.locate_file('').resolve(), walk_up=True) + .as_posix() + for name in text.splitlines() + ) + return map('"{}"'.format, paths) + + def _read_files_egginfo_sources(self): + """ + Read SOURCES.txt and return lines in a similar CSV-parsable + format as RECORD: each file name must be quoted (since it + might contain literal commas). + + Note that SOURCES.txt is not a reliable source for what + files are installed by a package. This file is generated + for a source archive, and the files that are present + there (e.g. setup.py) may not correctly reflect the files + that are present after the package has been installed. + """ + text = self.read_text('SOURCES.txt') + return text and map('"{}"'.format, text.splitlines()) + + @property + def requires(self) -> list[str] | None: + """Generated requirements specified for this Distribution""" + reqs = self._read_dist_info_reqs() or self._read_egg_info_reqs() + return reqs and list(reqs) + + def _read_dist_info_reqs(self): + return self.metadata.get_all('Requires-Dist') + + def _read_egg_info_reqs(self): + source = self.read_text('requires.txt') + return pass_none(self._deps_from_requires_text)(source) + + @classmethod + def _deps_from_requires_text(cls, source): + return cls._convert_egg_info_reqs_to_simple_reqs(Sectioned.read(source)) + + @staticmethod + def _convert_egg_info_reqs_to_simple_reqs(sections): + """ + Historically, setuptools would solicit and store 'extra' + requirements, including those with environment markers, + in separate sections. More modern tools expect each + dependency to be defined separately, with any relevant + extras and environment markers attached directly to that + requirement. This method converts the former to the + latter. See _test_deps_from_requires_text for an example. + """ + + def make_condition(name): + return name and f'extra == "{name}"' + + def quoted_marker(section): + section = section or '' + extra, sep, markers = section.partition(':') + if extra and markers: + markers = f'({markers})' + conditions = list(filter(None, [markers, make_condition(extra)])) + return '; ' + ' and '.join(conditions) if conditions else '' + + def url_req_space(req): + """ + PEP 508 requires a space between the url_spec and the quoted_marker. + Ref python/importlib_metadata#357. + """ + # '@' is uniquely indicative of a url_req. + return ' ' * ('@' in req) + + for section in sections: + space = url_req_space(section.value) + yield section.value + space + quoted_marker(section.name) + + @property + def origin(self): + return self._load_json('direct_url.json') + + def _load_json(self, filename): + # Deferred for performance (python/importlib_metadata#503) + import json + + return pass_none(json.loads)( + self.read_text(filename), + object_hook=lambda data: types.SimpleNamespace(**data), + ) + + +class DistributionFinder(MetaPathFinder): + """ + A MetaPathFinder capable of discovering installed distributions. + + Custom providers should implement this interface in order to + supply metadata. + """ + + class Context: + """ + Keyword arguments presented by the caller to + ``distributions()`` or ``Distribution.discover()`` + to narrow the scope of a search for distributions + in all DistributionFinders. + + Each DistributionFinder may expect any parameters + and should attempt to honor the canonical + parameters defined below when appropriate. + + This mechanism gives a custom provider a means to + solicit additional details from the caller beyond + "name" and "path" when searching distributions. + For example, imagine a provider that exposes suites + of packages in either a "public" or "private" ``realm``. + A caller may wish to query only for distributions in + a particular realm and could call + ``distributions(realm="private")`` to signal to the + custom provider to only include distributions from that + realm. + """ + + name = None + """ + Specific name for which a distribution finder should match. + A name of ``None`` matches all distributions. + """ + + def __init__(self, **kwargs): + vars(self).update(kwargs) + + @property + def path(self) -> list[str]: + """ + The sequence of directory path that a distribution finder + should search. + + Typically refers to Python installed package paths such as + "site-packages" directories and defaults to ``sys.path``. + """ + return vars(self).get('path', sys.path) + + @abc.abstractmethod + def find_distributions(self, context=Context()) -> Iterable[Distribution]: + """ + Find distributions. + + Return an iterable of all Distribution instances capable of + loading the metadata for packages matching the ``context``, + a DistributionFinder.Context instance. + """ + + +@passthrough +def _clear_after_fork(cached): + """Ensure ``func`` clears cached state after ``fork`` when supported. + + ``FastPath`` caches zip-backed ``pathlib.Path`` objects that retain a + reference to the parent's open ``ZipFile`` handle. Re-using a cached + instance in a forked child can therefore resurrect invalid file pointers + and trigger ``BadZipFile``/``OSError`` failures (python/importlib_metadata#520). + Registering ``cache_clear`` with ``os.register_at_fork`` keeps each process + on its own cache. + """ + getattr(os, 'register_at_fork', noop)(after_in_child=cached.cache_clear) + + +class FastPath: + """ + Micro-optimized class for searching a root for children. + + Root is a path on the file system that may contain metadata + directories either as natural directories or within a zip file. + + >>> FastPath('').children() + ['...'] + + FastPath objects are cached and recycled for any given root. + + >>> FastPath('foobar') is FastPath('foobar') + True + """ + + @_clear_after_fork # type: ignore[misc] + @functools.lru_cache() + def __new__(cls, root): + return super().__new__(cls) + + def __init__(self, root): + self.root = root + + def joinpath(self, child): + return pathlib.Path(self.root, child) + + def children(self): + with suppress(Exception): + return os.listdir(self.root or '.') + with suppress(Exception): + return self.zip_children() + return [] + + def zip_children(self): + # deferred for performance (python/importlib_metadata#502) + from zipp.compat.overlay import zipfile + + zip_path = zipfile.Path(self.root) + names = zip_path.root.namelist() + self.joinpath = zip_path.joinpath + + return dict.fromkeys(child.split(posixpath.sep, 1)[0] for child in names) + + def search(self, name): + return self.lookup(self.mtime).search(name) + + @property + def mtime(self): + with suppress(OSError): + return os.stat(self.root).st_mtime + self.lookup.cache_clear() + + @method_cache + def lookup(self, mtime): + return Lookup(self) + + +class Lookup: + """ + A micro-optimized class for searching a (fast) path for metadata. + """ + + def __init__(self, path: FastPath): + """ + Calculate all of the children representing metadata. + + From the children in the path, calculate early all of the + children that appear to represent metadata (infos) or legacy + metadata (eggs). + """ + + base = os.path.basename(path.root).lower() + base_is_egg = base.endswith(".egg") + self.infos = FreezableDefaultDict(list) + self.eggs = FreezableDefaultDict(list) + + for child in path.children(): + low = child.lower() + if low.endswith((".dist-info", ".egg-info")): + # rpartition is faster than splitext and suitable for this purpose. + name = low.rpartition(".")[0].partition("-")[0] + normalized = Prepared.normalize(name) + self.infos[normalized].append(path.joinpath(child)) + elif base_is_egg and low == "egg-info": + name = base.rpartition(".")[0].partition("-")[0] + legacy_normalized = Prepared.legacy_normalize(name) + self.eggs[legacy_normalized].append(path.joinpath(child)) + + self.infos.freeze() + self.eggs.freeze() + + def search(self, prepared: Prepared): + """ + Yield all infos and eggs matching the Prepared query. + """ + infos = ( + self.infos[prepared.normalized] + if prepared + else itertools.chain.from_iterable(self.infos.values()) + ) + eggs = ( + self.eggs[prepared.legacy_normalized] + if prepared + else itertools.chain.from_iterable(self.eggs.values()) + ) + return itertools.chain(infos, eggs) + + +class Prepared: + """ + A prepared search query for metadata on a possibly-named package. + + Pre-calculates the normalization to prevent repeated operations. + + >>> none = Prepared(None) + >>> none.normalized + >>> none.legacy_normalized + >>> bool(none) + False + >>> sample = Prepared('Sample__Pkg-name.foo') + >>> sample.normalized + 'sample_pkg_name_foo' + >>> sample.legacy_normalized + 'sample__pkg_name.foo' + >>> bool(sample) + True + """ + + normalized = None + legacy_normalized = None + + def __init__(self, name: str | None): + self.name = name + if name is None: + return + self.normalized = self.normalize(name) + self.legacy_normalized = self.legacy_normalize(name) + + @staticmethod + def normalize(name): + """ + PEP 503 normalization plus dashes as underscores. + """ + return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_') + + @staticmethod + def legacy_normalize(name): + """ + Normalize the package name as found in the convention in + older packaging tools versions and specs. + """ + return name.lower().replace('-', '_') + + def __bool__(self): + return bool(self.name) + + +@install +class MetadataPathFinder(NullFinder, DistributionFinder): + """A degenerate finder for distribution packages on the file system. + + This finder supplies only a find_distributions() method for versions + of Python that do not have a PathFinder find_distributions(). + """ + + @classmethod + def find_distributions( + cls, context=DistributionFinder.Context() + ) -> Iterable[PathDistribution]: + """ + Find distributions. + + Return an iterable of all Distribution instances capable of + loading the metadata for packages matching ``context.name`` + (or all names if ``None`` indicated) along the paths in the list + of directories ``context.path``. + """ + found = cls._search_paths(context.name, context.path) + return map(PathDistribution, found) + + @classmethod + def _search_paths(cls, name, paths): + """Find metadata directories in paths heuristically.""" + prepared = Prepared(name) + return itertools.chain.from_iterable( + path.search(prepared) for path in map(FastPath, paths) + ) + + @classmethod + def invalidate_caches(cls) -> None: + FastPath.__new__.cache_clear() + + +class PathDistribution(Distribution): + def __init__(self, path: SimplePath) -> None: + """Construct a distribution. + + :param path: SimplePath indicating the metadata directory. + """ + self._path = path + + def read_text(self, filename: str | os.PathLike[str]) -> str | None: + with suppress( + FileNotFoundError, + IsADirectoryError, + KeyError, + NotADirectoryError, + PermissionError, + ): + return self._path.joinpath(filename).read_text(encoding='utf-8') + + return None + + read_text.__doc__ = Distribution.read_text.__doc__ + + def locate_file(self, path: str | os.PathLike[str]) -> SimplePath: + return self._path.parent / path + + @property + def _normalized_name(self): + """ + Performance optimization: where possible, resolve the + normalized name from the file system path. + """ + stem = os.path.basename(str(self._path)) + return ( + pass_none(Prepared.normalize)(self._name_from_stem(stem)) + or super()._normalized_name + ) + + @staticmethod + def _name_from_stem(stem): + """ + >>> PathDistribution._name_from_stem('foo-3.0.egg-info') + 'foo' + >>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info') + 'CherryPy' + >>> PathDistribution._name_from_stem('face.egg-info') + 'face' + >>> PathDistribution._name_from_stem('foo.bar') + """ + filename, ext = os.path.splitext(stem) + if ext not in ('.dist-info', '.egg-info'): + return + name, sep, rest = filename.partition('-') + return name + + +def distribution(distribution_name: str) -> Distribution: + """Get the ``Distribution`` instance for the named package. + + :param distribution_name: The name of the distribution package as a string. + :return: A ``Distribution`` instance (or subclass thereof). + """ + return Distribution.from_name(distribution_name) + + +def distributions(**kwargs) -> Iterable[Distribution]: + """Get all ``Distribution`` instances in the current environment. + + :return: An iterable of ``Distribution`` instances. + """ + return Distribution.discover(**kwargs) + + +def metadata(distribution_name: str) -> _meta.PackageMetadata | None: + """Get the metadata for the named package. + + :param distribution_name: The name of the distribution package to query. + :return: A PackageMetadata containing the parsed metadata. + """ + return Distribution.from_name(distribution_name).metadata + + +def version(distribution_name: str) -> str: + """Get the version string for the named package. + + :param distribution_name: The name of the distribution package to query. + :return: The version string for the package as defined in the package's + "Version" metadata key. + """ + return distribution(distribution_name).version + + +_unique = functools.partial( + unique_everseen, + key=py39.normalized_name, +) +""" +Wrapper for ``distributions`` to return unique distributions by name. +""" + + +def entry_points(**params) -> EntryPoints: + """Return EntryPoint objects for all installed packages. + + Pass selection parameters (group or name) to filter the + result to entry points matching those properties (see + EntryPoints.select()). + + :return: EntryPoints for all installed packages. + """ + eps = itertools.chain.from_iterable( + dist.entry_points for dist in _unique(distributions()) + ) + return EntryPoints(eps).select(**params) + + +def files(distribution_name: str) -> list[PackagePath] | None: + """Return a list of files for the named package. + + :param distribution_name: The name of the distribution package to query. + :return: List of files composing the distribution. + """ + return distribution(distribution_name).files + + +def requires(distribution_name: str) -> list[str] | None: + """ + Return a list of requirements for the named package. + + :return: An iterable of requirements, suitable for + packaging.requirement.Requirement. + """ + return distribution(distribution_name).requires + + +def packages_distributions() -> Mapping[str, list[str]]: + """ + Return a mapping of top-level packages to their + distributions. + + >>> import collections.abc + >>> pkgs = packages_distributions() + >>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values()) + True + """ + pkg_to_dist = collections.defaultdict(list) + for dist in distributions(): + for pkg in _top_level_declared(dist) or _top_level_inferred(dist): + pkg_to_dist[pkg].append(md_none(dist.metadata)['Name']) + return dict(pkg_to_dist) + + +def _top_level_declared(dist): + return (dist.read_text('top_level.txt') or '').split() + + +def _topmost(name: PackagePath) -> str | None: + """ + Return the top-most parent as long as there is a parent. + """ + top, *rest = name.parts + return top if rest else None + + +def _get_toplevel_name(name: PackagePath) -> str: + """ + Infer a possibly importable module name from a name presumed on + sys.path. + + >>> _get_toplevel_name(PackagePath('foo.py')) + 'foo' + >>> _get_toplevel_name(PackagePath('foo')) + 'foo' + >>> _get_toplevel_name(PackagePath('foo.pyc')) + 'foo' + >>> _get_toplevel_name(PackagePath('foo/__init__.py')) + 'foo' + >>> _get_toplevel_name(PackagePath('foo.pth')) + 'foo.pth' + >>> _get_toplevel_name(PackagePath('foo.dist-info')) + 'foo.dist-info' + """ + # Defer import of inspect for performance (python/cpython#118761) + import inspect + + return _topmost(name) or inspect.getmodulename(name) or str(name) + + +def _top_level_inferred(dist): + opt_names = set(map(_get_toplevel_name, always_iterable(dist.files))) + + def importable_name(name): + return '.' not in name + + return filter(importable_name, opt_names) diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/__init__.cpython-310.pyc b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d564c3086c12d9e4f8945d07ca09fe339a1962cf Binary files /dev/null and b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/__init__.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_adapters.cpython-310.pyc b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_adapters.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..12fea1d6080ad27f6b26c42652300a48364188ba Binary files /dev/null and b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_adapters.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_collections.cpython-310.pyc b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_collections.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fdd50b2f813d031459d8fccdf06f013853132ece Binary files /dev/null and b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_collections.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_compat.cpython-310.pyc b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_compat.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1ec81e7b09f99308a9a18b78136ca397fc06d618 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_compat.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_functools.cpython-310.pyc b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_functools.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6fd58e6f39e271ed9bd4e52630ccbc64729c781d Binary files /dev/null and b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_functools.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_itertools.cpython-310.pyc b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_itertools.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4555f1b0ecf900387ec01c27a1e33a0eeac0fc85 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_itertools.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_meta.cpython-310.pyc b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_meta.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..16f35bbc84b75d0b5f4c0a079092d4f4b77820e7 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_meta.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_text.cpython-310.pyc b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_text.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fba8257e02976ae78acbd3993906f1caa2941375 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_text.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_typing.cpython-310.pyc b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_typing.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3cba055f44f6cf44a35ab0a1839a659001c1a55a Binary files /dev/null and b/.venv/lib/python3.10/site-packages/importlib_metadata/__pycache__/_typing.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/_adapters.py b/.venv/lib/python3.10/site-packages/importlib_metadata/_adapters.py new file mode 100644 index 0000000000000000000000000000000000000000..dede395d79a38bab322d56a66d916703af84f77b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/importlib_metadata/_adapters.py @@ -0,0 +1,136 @@ +import email.message +import email.policy +import re +import textwrap + +from ._text import FoldedCase + + +class RawPolicy(email.policy.EmailPolicy): + def fold(self, name, value): + folded = self.linesep.join( + textwrap + .indent(value, prefix=' ' * 8, predicate=lambda line: True) + .lstrip() + .splitlines() + ) + return f'{name}: {folded}{self.linesep}' + + +class Message(email.message.Message): + r""" + Specialized Message subclass to handle metadata naturally. + + Reads values that may have newlines in them and converts the + payload to the Description. + + >>> msg_text = textwrap.dedent(''' + ... Name: Foo + ... Version: 3.0 + ... License: blah + ... de-blah + ... + ... First line of description. + ... Second line of description. + ... + ... Fourth line! + ... ''').lstrip().replace('', '') + >>> msg = Message(email.message_from_string(msg_text)) + >>> msg['Description'] + 'First line of description.\nSecond line of description.\n\nFourth line!\n' + + Message should render even if values contain newlines. + + >>> print(msg) + Name: Foo + Version: 3.0 + License: blah + de-blah + Description: First line of description. + Second line of description. + + Fourth line! + + + """ + + multiple_use_keys = set( + map( + FoldedCase, + [ + 'Classifier', + 'Obsoletes-Dist', + 'Platform', + 'Project-URL', + 'Provides-Dist', + 'Provides-Extra', + 'Requires-Dist', + 'Requires-External', + 'Supported-Platform', + 'Dynamic', + ], + ) + ) + """ + Keys that may be indicated multiple times per PEP 566. + """ + + def __new__(cls, orig: email.message.Message): + res = super().__new__(cls) + vars(res).update(vars(orig)) + return res + + def __init__(self, *args, **kwargs): + self._headers = self._repair_headers() + + # suppress spurious error from mypy + def __iter__(self): + return super().__iter__() + + def __getitem__(self, item): + """ + Override parent behavior to typical dict behavior. + + ``email.message.Message`` will emit None values for missing + keys. Typical mappings, including this ``Message``, will raise + a key error for missing keys. + + Ref python/importlib_metadata#371. + """ + res = super().__getitem__(item) + if res is None: + raise KeyError(item) + return res + + def _repair_headers(self): + def redent(value): + "Correct for RFC822 indentation" + indent = ' ' * 8 + if not value or '\n' + indent not in value: + return value + return textwrap.dedent(indent + value) + + headers = [(key, redent(value)) for key, value in vars(self)['_headers']] + if self._payload: + headers.append(('Description', self.get_payload())) + self.set_payload('') + return headers + + def as_string(self): + return super().as_string(policy=RawPolicy()) + + @property + def json(self): + """ + Convert PackageMetadata to a JSON-compatible format + per PEP 0566. + """ + + def transform(key): + value = self.get_all(key) if key in self.multiple_use_keys else self[key] + if key == 'Keywords': + value = re.split(r'\s+', value) + tk = key.lower().replace('-', '_') + return tk, value + + return dict(map(transform, map(FoldedCase, self))) diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/_collections.py b/.venv/lib/python3.10/site-packages/importlib_metadata/_collections.py new file mode 100644 index 0000000000000000000000000000000000000000..fc5045d36be57251000393b32baba7baa9cd8c4f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/importlib_metadata/_collections.py @@ -0,0 +1,34 @@ +import collections +import typing + + +# from jaraco.collections 3.3 +class FreezableDefaultDict(collections.defaultdict): + """ + Often it is desirable to prevent the mutation of + a default dict after its initial construction, such + as to prevent mutation during iteration. + + >>> dd = FreezableDefaultDict(list) + >>> dd[0].append('1') + >>> dd.freeze() + >>> dd[1] + [] + >>> len(dd) + 1 + """ + + def __missing__(self, key): + return getattr(self, '_frozen', super().__missing__)(key) + + def freeze(self): + self._frozen = lambda key: self.default_factory() + + +class Pair(typing.NamedTuple): + name: str + value: str + + @classmethod + def parse(cls, text): + return cls(*map(str.strip, text.split("=", 1))) diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/_compat.py b/.venv/lib/python3.10/site-packages/importlib_metadata/_compat.py new file mode 100644 index 0000000000000000000000000000000000000000..01356d69b97c95a6d41818e5c2c50a299146bef4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/importlib_metadata/_compat.py @@ -0,0 +1,56 @@ +import platform +import sys + +__all__ = ['install', 'NullFinder'] + + +def install(cls): + """ + Class decorator for installation on sys.meta_path. + + Adds the backport DistributionFinder to sys.meta_path and + attempts to disable the finder functionality of the stdlib + DistributionFinder. + """ + sys.meta_path.append(cls()) + disable_stdlib_finder() + return cls + + +def disable_stdlib_finder(): + """ + Give the backport primacy for discovering path-based distributions + by monkey-patching the stdlib O_O. + + See #91 for more background for rationale on this sketchy + behavior. + """ + + def matches(finder): + return getattr( + finder, '__module__', None + ) == '_frozen_importlib_external' and hasattr(finder, 'find_distributions') + + for finder in filter(matches, sys.meta_path): # pragma: nocover + del finder.find_distributions + + +class NullFinder: + """ + A "Finder" (aka "MetaPathFinder") that never finds any modules, + but may find distributions. + """ + + @staticmethod + def find_spec(*args, **kwargs): + return None + + +def pypy_partial(val): + """ + Adjust for variable stacklevel on partial under PyPy. + + Workaround for #327. + """ + is_pypy = platform.python_implementation() == 'PyPy' + return val + is_pypy diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/_functools.py b/.venv/lib/python3.10/site-packages/importlib_metadata/_functools.py new file mode 100644 index 0000000000000000000000000000000000000000..b1fd04a84ab4c129b19f71a13f7489c37d1a9e9e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/importlib_metadata/_functools.py @@ -0,0 +1,135 @@ +import functools +import types +from typing import Callable, TypeVar + + +# from jaraco.functools 3.3 +def method_cache(method, cache_wrapper=None): + """ + Wrap lru_cache to support storing the cache data in the object instances. + + Abstracts the common paradigm where the method explicitly saves an + underscore-prefixed protected property on first call and returns that + subsequently. + + >>> class MyClass: + ... calls = 0 + ... + ... @method_cache + ... def method(self, value): + ... self.calls += 1 + ... return value + + >>> a = MyClass() + >>> a.method(3) + 3 + >>> for x in range(75): + ... res = a.method(x) + >>> a.calls + 75 + + Note that the apparent behavior will be exactly like that of lru_cache + except that the cache is stored on each instance, so values in one + instance will not flush values from another, and when an instance is + deleted, so are the cached values for that instance. + + >>> b = MyClass() + >>> for x in range(35): + ... res = b.method(x) + >>> b.calls + 35 + >>> a.method(0) + 0 + >>> a.calls + 75 + + Note that if method had been decorated with ``functools.lru_cache()``, + a.calls would have been 76 (due to the cached value of 0 having been + flushed by the 'b' instance). + + Clear the cache with ``.cache_clear()`` + + >>> a.method.cache_clear() + + Same for a method that hasn't yet been called. + + >>> c = MyClass() + >>> c.method.cache_clear() + + Another cache wrapper may be supplied: + + >>> cache = functools.lru_cache(maxsize=2) + >>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache) + >>> a = MyClass() + >>> a.method2() + 3 + + Caution - do not subsequently wrap the method with another decorator, such + as ``@property``, which changes the semantics of the function. + + See also + http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/ + for another implementation and additional justification. + """ + cache_wrapper = cache_wrapper or functools.lru_cache() + + def wrapper(self, *args, **kwargs): + # it's the first call, replace the method with a cached, bound method + bound_method = types.MethodType(method, self) + cached_method = cache_wrapper(bound_method) + setattr(self, method.__name__, cached_method) + return cached_method(*args, **kwargs) + + # Support cache clear even before cache has been created. + wrapper.cache_clear = lambda: None + + return wrapper + + +# From jaraco.functools 3.3 +def pass_none(func): + """ + Wrap func so it's not called if its first param is None + + >>> print_text = pass_none(print) + >>> print_text('text') + text + >>> print_text(None) + """ + + @functools.wraps(func) + def wrapper(param, *args, **kwargs): + if param is not None: + return func(param, *args, **kwargs) + + return wrapper + + +# From jaraco.functools 4.4 +def noop(*args, **kwargs): + """ + A no-operation function that does nothing. + + >>> noop(1, 2, three=3) + """ + + +_T = TypeVar('_T') + + +# From jaraco.functools 4.4 +def passthrough(func: Callable[..., object]) -> Callable[[_T], _T]: + """ + Wrap the function to always return the first parameter. + + >>> passthrough(print)('3') + 3 + '3' + """ + + @functools.wraps(func) + def wrapper(first: _T, *args, **kwargs) -> _T: + func(first, *args, **kwargs) + return first + + return wrapper # type: ignore[return-value] diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/_itertools.py b/.venv/lib/python3.10/site-packages/importlib_metadata/_itertools.py new file mode 100644 index 0000000000000000000000000000000000000000..79d37198ce7aff317873f6e4e84cd904a46a69de --- /dev/null +++ b/.venv/lib/python3.10/site-packages/importlib_metadata/_itertools.py @@ -0,0 +1,171 @@ +from collections import defaultdict, deque +from itertools import filterfalse + + +def unique_everseen(iterable, key=None): + "List unique elements, preserving order. Remember all elements ever seen." + # unique_everseen('AAAABBBCCDAABBB') --> A B C D + # unique_everseen('ABBCcAD', str.lower) --> A B C D + seen = set() + seen_add = seen.add + if key is None: + for element in filterfalse(seen.__contains__, iterable): + seen_add(element) + yield element + else: + for element in iterable: + k = key(element) + if k not in seen: + seen_add(k) + yield element + + +# copied from more_itertools 8.8 +def always_iterable(obj, base_type=(str, bytes)): + """If *obj* is iterable, return an iterator over its items:: + + >>> obj = (1, 2, 3) + >>> list(always_iterable(obj)) + [1, 2, 3] + + If *obj* is not iterable, return a one-item iterable containing *obj*:: + + >>> obj = 1 + >>> list(always_iterable(obj)) + [1] + + If *obj* is ``None``, return an empty iterable: + + >>> obj = None + >>> list(always_iterable(None)) + [] + + By default, binary and text strings are not considered iterable:: + + >>> obj = 'foo' + >>> list(always_iterable(obj)) + ['foo'] + + If *base_type* is set, objects for which ``isinstance(obj, base_type)`` + returns ``True`` won't be considered iterable. + + >>> obj = {'a': 1} + >>> list(always_iterable(obj)) # Iterate over the dict's keys + ['a'] + >>> list(always_iterable(obj, base_type=dict)) # Treat dicts as a unit + [{'a': 1}] + + Set *base_type* to ``None`` to avoid any special handling and treat objects + Python considers iterable as iterable: + + >>> obj = 'foo' + >>> list(always_iterable(obj, base_type=None)) + ['f', 'o', 'o'] + """ + if obj is None: + return iter(()) + + if (base_type is not None) and isinstance(obj, base_type): + return iter((obj,)) + + try: + return iter(obj) + except TypeError: + return iter((obj,)) + + +# Copied from more_itertools 10.3 +class bucket: + """Wrap *iterable* and return an object that buckets the iterable into + child iterables based on a *key* function. + + >>> iterable = ['a1', 'b1', 'c1', 'a2', 'b2', 'c2', 'b3'] + >>> s = bucket(iterable, key=lambda x: x[0]) # Bucket by 1st character + >>> sorted(list(s)) # Get the keys + ['a', 'b', 'c'] + >>> a_iterable = s['a'] + >>> next(a_iterable) + 'a1' + >>> next(a_iterable) + 'a2' + >>> list(s['b']) + ['b1', 'b2', 'b3'] + + The original iterable will be advanced and its items will be cached until + they are used by the child iterables. This may require significant storage. + + By default, attempting to select a bucket to which no items belong will + exhaust the iterable and cache all values. + If you specify a *validator* function, selected buckets will instead be + checked against it. + + >>> from itertools import count + >>> it = count(1, 2) # Infinite sequence of odd numbers + >>> key = lambda x: x % 10 # Bucket by last digit + >>> validator = lambda x: x in {1, 3, 5, 7, 9} # Odd digits only + >>> s = bucket(it, key=key, validator=validator) + >>> 2 in s + False + >>> list(s[2]) + [] + + """ + + def __init__(self, iterable, key, validator=None): + self._it = iter(iterable) + self._key = key + self._cache = defaultdict(deque) + self._validator = validator or (lambda x: True) + + def __contains__(self, value): + if not self._validator(value): + return False + + try: + item = next(self[value]) + except StopIteration: + return False + else: + self._cache[value].appendleft(item) + + return True + + def _get_values(self, value): + """ + Helper to yield items from the parent iterator that match *value*. + Items that don't match are stored in the local cache as they + are encountered. + """ + while True: + # If we've cached some items that match the target value, emit + # the first one and evict it from the cache. + if self._cache[value]: + yield self._cache[value].popleft() + # Otherwise we need to advance the parent iterator to search for + # a matching item, caching the rest. + else: + while True: + try: + item = next(self._it) + except StopIteration: + return + item_value = self._key(item) + if item_value == value: + yield item + break + elif self._validator(item_value): + self._cache[item_value].append(item) + + def __iter__(self): + for item in self._it: + item_value = self._key(item) + if self._validator(item_value): + self._cache[item_value].append(item) + + yield from self._cache.keys() + + def __getitem__(self, value): + if not self._validator(value): + return iter(()) + + return self._get_values(value) diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/_meta.py b/.venv/lib/python3.10/site-packages/importlib_metadata/_meta.py new file mode 100644 index 0000000000000000000000000000000000000000..0c20eff3da75223a5ca76a1743b7c5b8fa1dc1f6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/importlib_metadata/_meta.py @@ -0,0 +1,71 @@ +from __future__ import annotations + +import os +from collections.abc import Iterator +from typing import ( + Any, + Protocol, + TypeVar, + overload, +) + +_T = TypeVar("_T") + + +class PackageMetadata(Protocol): + def __len__(self) -> int: ... # pragma: no cover + + def __contains__(self, item: str) -> bool: ... # pragma: no cover + + def __getitem__(self, key: str) -> str: ... # pragma: no cover + + def __iter__(self) -> Iterator[str]: ... # pragma: no cover + + @overload + def get( + self, name: str, failobj: None = None + ) -> str | None: ... # pragma: no cover + + @overload + def get(self, name: str, failobj: _T) -> str | _T: ... # pragma: no cover + + # overload per python/importlib_metadata#435 + @overload + def get_all( + self, name: str, failobj: None = None + ) -> list[Any] | None: ... # pragma: no cover + + @overload + def get_all(self, name: str, failobj: _T) -> list[Any] | _T: + """ + Return all values associated with a possibly multi-valued key. + """ + + @property + def json(self) -> dict[str, str | list[str]]: + """ + A JSON-compatible form of the metadata. + """ + + +class SimplePath(Protocol): + """ + A minimal subset of pathlib.Path required by Distribution. + """ + + def joinpath( + self, other: str | os.PathLike[str] + ) -> SimplePath: ... # pragma: no cover + + def __truediv__( + self, other: str | os.PathLike[str] + ) -> SimplePath: ... # pragma: no cover + + @property + def parent(self) -> SimplePath: ... # pragma: no cover + + def read_text(self, encoding=None) -> str: ... # pragma: no cover + + def read_bytes(self) -> bytes: ... # pragma: no cover + + def exists(self) -> bool: ... # pragma: no cover diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/_text.py b/.venv/lib/python3.10/site-packages/importlib_metadata/_text.py new file mode 100644 index 0000000000000000000000000000000000000000..c88cfbb2349c6401336bc5ba6623f51afd1eb59d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/importlib_metadata/_text.py @@ -0,0 +1,99 @@ +import re + +from ._functools import method_cache + + +# from jaraco.text 3.5 +class FoldedCase(str): + """ + A case insensitive string class; behaves just like str + except compares equal when the only variation is case. + + >>> s = FoldedCase('hello world') + + >>> s == 'Hello World' + True + + >>> 'Hello World' == s + True + + >>> s != 'Hello World' + False + + >>> s.index('O') + 4 + + >>> s.split('O') + ['hell', ' w', 'rld'] + + >>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta'])) + ['alpha', 'Beta', 'GAMMA'] + + Sequence membership is straightforward. + + >>> "Hello World" in [s] + True + >>> s in ["Hello World"] + True + + You may test for set inclusion, but candidate and elements + must both be folded. + + >>> FoldedCase("Hello World") in {s} + True + >>> s in {FoldedCase("Hello World")} + True + + String inclusion works as long as the FoldedCase object + is on the right. + + >>> "hello" in FoldedCase("Hello World") + True + + But not if the FoldedCase object is on the left: + + >>> FoldedCase('hello') in 'Hello World' + False + + In that case, use in_: + + >>> FoldedCase('hello').in_('Hello World') + True + + >>> FoldedCase('hello') > FoldedCase('Hello') + False + """ + + def __lt__(self, other): + return self.lower() < other.lower() + + def __gt__(self, other): + return self.lower() > other.lower() + + def __eq__(self, other): + return self.lower() == other.lower() + + def __ne__(self, other): + return self.lower() != other.lower() + + def __hash__(self): + return hash(self.lower()) + + def __contains__(self, other): + return super().lower().__contains__(other.lower()) + + def in_(self, other): + "Does self appear in other?" + return self in FoldedCase(other) + + # cache lower since it's likely to be called frequently. + @method_cache + def lower(self): + return super().lower() + + def index(self, sub): + return self.lower().index(sub.lower()) + + def split(self, splitter=' ', maxsplit=0): + pattern = re.compile(re.escape(splitter), re.I) + return pattern.split(self, maxsplit) diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/_typing.py b/.venv/lib/python3.10/site-packages/importlib_metadata/_typing.py new file mode 100644 index 0000000000000000000000000000000000000000..32b1d2b98ac987e8361f60362b8bdabcdc6fb1c8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/importlib_metadata/_typing.py @@ -0,0 +1,15 @@ +import functools +import typing + +from ._meta import PackageMetadata + +md_none = functools.partial(typing.cast, PackageMetadata) +""" +Suppress type errors for optional metadata. + +Although Distribution.metadata can return None when metadata is corrupt +and thus None, allow callers to assume it's not None and crash if +that's the case. + +# python/importlib_metadata#493 +""" diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/compat/__init__.py b/.venv/lib/python3.10/site-packages/importlib_metadata/compat/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/compat/__pycache__/__init__.cpython-310.pyc b/.venv/lib/python3.10/site-packages/importlib_metadata/compat/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3e1c6b3f2d2de6e5309d85a7c5bc57559c6c73bf Binary files /dev/null and b/.venv/lib/python3.10/site-packages/importlib_metadata/compat/__pycache__/__init__.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/compat/__pycache__/py311.cpython-310.pyc b/.venv/lib/python3.10/site-packages/importlib_metadata/compat/__pycache__/py311.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5fbfdd810a94718884b8c7af2959de93df45a694 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/importlib_metadata/compat/__pycache__/py311.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/compat/__pycache__/py39.cpython-310.pyc b/.venv/lib/python3.10/site-packages/importlib_metadata/compat/__pycache__/py39.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6b9a0d022b819362f7807bb581bb7d8453e86ece Binary files /dev/null and b/.venv/lib/python3.10/site-packages/importlib_metadata/compat/__pycache__/py39.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/compat/py311.py b/.venv/lib/python3.10/site-packages/importlib_metadata/compat/py311.py new file mode 100644 index 0000000000000000000000000000000000000000..3a5327436f9b1d9eae371e321c491a270634b3cf --- /dev/null +++ b/.venv/lib/python3.10/site-packages/importlib_metadata/compat/py311.py @@ -0,0 +1,22 @@ +import os +import pathlib +import sys +import types + + +def wrap(path): # pragma: no cover + """ + Workaround for https://github.com/python/cpython/issues/84538 + to add backward compatibility for walk_up=True. + An example affected package is dask-labextension, which uses + jupyter-packaging to install JupyterLab javascript files outside + of site-packages. + """ + + def relative_to(root, *, walk_up=False): + return pathlib.Path(os.path.relpath(path, root)) + + return types.SimpleNamespace(relative_to=relative_to) + + +relative_fix = wrap if sys.version_info < (3, 12) else lambda x: x diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/compat/py39.py b/.venv/lib/python3.10/site-packages/importlib_metadata/compat/py39.py new file mode 100644 index 0000000000000000000000000000000000000000..3eb9c01ecbbdcdf7b79d8840ee91c2fe7a734a1c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/importlib_metadata/compat/py39.py @@ -0,0 +1,42 @@ +""" +Compatibility layer with Python 3.8/3.9 +""" + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any + +if TYPE_CHECKING: # pragma: no cover + # Prevent circular imports on runtime. + from .. import Distribution, EntryPoint +else: + Distribution = EntryPoint = Any + +from .._typing import md_none + + +def normalized_name(dist: Distribution) -> str | None: + """ + Honor name normalization for distributions that don't provide ``_normalized_name``. + """ + try: + return dist._normalized_name + except AttributeError: + from .. import Prepared # -> delay to prevent circular imports. + + return Prepared.normalize( + getattr(dist, "name", None) or md_none(dist.metadata)['Name'] + ) + + +def ep_matches(ep: EntryPoint, **params) -> bool: + """ + Workaround for ``EntryPoint`` objects without the ``matches`` method. + """ + try: + return ep.matches(**params) + except AttributeError: + from .. import EntryPoint # -> delay to prevent circular imports. + + # Reconstruct the EntryPoint object to make sure it is compatible. + return EntryPoint(ep.name, ep.value, ep.group).matches(**params) diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/diagnose.py b/.venv/lib/python3.10/site-packages/importlib_metadata/diagnose.py new file mode 100644 index 0000000000000000000000000000000000000000..e405471ac4d94371b1ee9b1622227ff76b337180 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/importlib_metadata/diagnose.py @@ -0,0 +1,21 @@ +import sys + +from . import Distribution + + +def inspect(path): + print("Inspecting", path) + dists = list(Distribution.discover(path=[path])) + if not dists: + return + print("Found", len(dists), "packages:", end=' ') + print(', '.join(dist.name for dist in dists)) + + +def run(): + for path in sys.path: + inspect(path) + + +if __name__ == '__main__': + run() diff --git a/.venv/lib/python3.10/site-packages/importlib_metadata/py.typed b/.venv/lib/python3.10/site-packages/importlib_metadata/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/INSTALLER b/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/INSTALLER @@ -0,0 +1 @@ +uv \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/METADATA b/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..ff5daefdd12c7c9b6c6e4dfd0982eb8dcb690fe4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/METADATA @@ -0,0 +1,54 @@ +Metadata-Version: 2.4 +Name: jsonschema-specifications +Version: 2025.9.1 +Summary: The JSON Schema meta-schemas and vocabularies, exposed as a Registry +Project-URL: Documentation, https://jsonschema-specifications.readthedocs.io/ +Project-URL: Homepage, https://github.com/python-jsonschema/jsonschema-specifications +Project-URL: Issues, https://github.com/python-jsonschema/jsonschema-specifications/issues/ +Project-URL: Funding, https://github.com/sponsors/Julian +Project-URL: Tidelift, https://tidelift.com/subscription/pkg/pypi-jsonschema-specifications?utm_source=pypi-jsonschema-specifications&utm_medium=referral&utm_campaign=pypi-link +Project-URL: Source, https://github.com/python-jsonschema/jsonschema-specifications +Author-email: Julian Berman +License-Expression: MIT +License-File: COPYING +Keywords: data validation,json,json schema,jsonschema,validation +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: File Formats :: JSON +Classifier: Topic :: File Formats :: JSON :: JSON Schema +Requires-Python: >=3.9 +Requires-Dist: referencing>=0.31.0 +Description-Content-Type: text/x-rst + +============================= +``jsonschema-specifications`` +============================= + +|PyPI| |Pythons| |CI| |ReadTheDocs| + +JSON support files from the `JSON Schema Specifications `_ (metaschemas, vocabularies, etc.), packaged for runtime access from Python as a `referencing-based Schema Registry `_. + +.. |PyPI| image:: https://img.shields.io/pypi/v/jsonschema-specifications.svg + :alt: PyPI version + :target: https://pypi.org/project/jsonschema-specifications/ + +.. |Pythons| image:: https://img.shields.io/pypi/pyversions/jsonschema-specifications.svg + :alt: Supported Python versions + :target: https://pypi.org/project/jsonschema-specifications/ + +.. |CI| image:: https://github.com/python-jsonschema/jsonschema-specifications/workflows/CI/badge.svg + :alt: Build status + :target: https://github.com/python-jsonschema/jsonschema-specifications/actions?query=workflow%3ACI + +.. |ReadTheDocs| image:: https://readthedocs.org/projects/jsonschema-specifications/badge/?version=stable&style=flat + :alt: ReadTheDocs status + :target: https://jsonschema-specifications.readthedocs.io/en/stable/ diff --git a/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/RECORD b/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..32965b86b414bf4f4c9fa5ab28f409ea768e1c72 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/RECORD @@ -0,0 +1,30 @@ +jsonschema_specifications-2025.9.1.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +jsonschema_specifications-2025.9.1.dist-info/METADATA,sha256=NavUF1fzK06iR1aSDe1HtwFz13y8BSpabTq1g7Lo2J0,2907 +jsonschema_specifications-2025.9.1.dist-info/RECORD,, +jsonschema_specifications-2025.9.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +jsonschema_specifications-2025.9.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87 +jsonschema_specifications-2025.9.1.dist-info/licenses/COPYING,sha256=QtzWNJX4e063x3V6-jebtVpT-Ur9el9lfZrfVyNuUVw,1057 +jsonschema_specifications/__init__.py,sha256=qoTB2DKY7qvNrGhMPH6gtmAJRLilmVQ-fFZwT6ryqw0,386 +jsonschema_specifications/_core.py,sha256=tFhc1CMleJ3AJOK_bjxOpFQTdrsUClFGfFxPBU_CebM,1140 +jsonschema_specifications/schemas/draft201909/metaschema.json,sha256=e3YbPhIfCgyh6ioLjizIVrz4AWBLgmjXG6yqICvAwTs,1785 +jsonschema_specifications/schemas/draft201909/vocabularies/applicator,sha256=aJUQDplyb7sQcFhRK77D7P1LJOj9L6zuPlBe5ysNTDE,1860 +jsonschema_specifications/schemas/draft201909/vocabularies/content,sha256=m31PVaTi_bAsQwBo_f-rxzKt3OI42j8d8mkCScM1MnQ,517 +jsonschema_specifications/schemas/draft201909/vocabularies/core,sha256=taLElX9kldClCB8ECevooU5BOayyA_x0hHH47eKvWyw,1531 +jsonschema_specifications/schemas/draft201909/vocabularies/format,sha256=UOu_55BhGoSbjMQAoJwdDg-2q1wNQ6DyIgH9NiUFa_Q,403 +jsonschema_specifications/schemas/draft201909/vocabularies/meta-data,sha256=1H4kRd1qgicaKY2DzGxsuNSuHhXg3Fa-zTehY-zwEoY,892 +jsonschema_specifications/schemas/draft201909/vocabularies/validation,sha256=HlJsHTNac0gF_ILPV5jBK5YK19olF8Zs2lobCTWcPBw,2834 +jsonschema_specifications/schemas/draft202012/metaschema.json,sha256=Qdp29a-3zgYtJI92JGOpL3ykfk4PkFsiS6av7vkd7Q8,2452 +jsonschema_specifications/schemas/draft202012/vocabularies/applicator,sha256=xKbkFHuR_vf-ptwFjLG_k0AvdBS3ZXiosWqvHa1qrO8,1659 +jsonschema_specifications/schemas/draft202012/vocabularies/content,sha256=CDQ3R3ZOSlgUJieTz01lIFenkThjxZUNQyl-jh_axbY,519 +jsonschema_specifications/schemas/draft202012/vocabularies/core,sha256=wtEqjk3RHTNt_IOj9mOqTGnwtJs76wlP_rJbUxb0gD0,1564 +jsonschema_specifications/schemas/draft202012/vocabularies/format-annotation,sha256=q8d1rf79idIjWBcNm_k_Tr0jSVY7u-3WDwK-98gSvMA,448 +jsonschema_specifications/schemas/draft202012/vocabularies/format-assertion,sha256=xSJCuaG7eGsmw-gset1CjDH5yW5XXc6Z5W6l_qptogw,445 +jsonschema_specifications/schemas/draft202012/vocabularies/meta-data,sha256=j3bW4U9Bubku-TO3CM3FFEyLUmhlGtEZGEhfsXVPHHY,892 +jsonschema_specifications/schemas/draft202012/vocabularies/unevaluated,sha256=Lb-8tzmUtnCwl2SSre4f_7RsIWgnhNL1pMpWH54tDLQ,506 +jsonschema_specifications/schemas/draft202012/vocabularies/validation,sha256=cBCjHlQfMtK-ch4t40jfdcmzaHaj7TBId_wKvaHTelg,2834 +jsonschema_specifications/schemas/draft3/metaschema.json,sha256=LPdfZENvtb43Si6qJ6uLfh_WUcm0ba6mxnsC_WTiRYs,2600 +jsonschema_specifications/schemas/draft4/metaschema.json,sha256=4UidC0dV8CeTMCWR0_y48Htok6gqlPJIlfjk7fEbguI,4357 +jsonschema_specifications/schemas/draft6/metaschema.json,sha256=wp386fVINcOgbAOzxdXsDtp3cGVo-cTffPvHVmpRAG0,4437 +jsonschema_specifications/schemas/draft7/metaschema.json,sha256=PVOSCIJhYGxVm2A_OFMpyfGrRbXWZ-uZBodFOwVdQF4,4819 +jsonschema_specifications/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +jsonschema_specifications/tests/test_jsonschema_specifications.py,sha256=WkbYRW6A6FoZ0rivShfqVLSCsAiHJ2x8TxqECJTXPTY,1106 diff --git a/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/REQUESTED b/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/WHEEL b/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..12228d414b6cfed7c39d3781c85c63256a1d7fb5 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.27.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/licenses/COPYING b/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/licenses/COPYING new file mode 100644 index 0000000000000000000000000000000000000000..a9f853e43069b8e3f8a156a4af2b1198a004230d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/jsonschema_specifications-2025.9.1.dist-info/licenses/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 2022 Julian Berman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/INSTALLER b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/INSTALLER @@ -0,0 +1 @@ +uv \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/METADATA b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..0282933652fda5b154bd36f91b14ca75fe9e0901 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/METADATA @@ -0,0 +1,74 @@ +Metadata-Version: 2.4 +Name: MarkupSafe +Version: 3.0.3 +Summary: Safely add untrusted strings to HTML/XML markup. +Maintainer-email: Pallets +License-Expression: BSD-3-Clause +Project-URL: Donate, https://palletsprojects.com/donate +Project-URL: Documentation, https://markupsafe.palletsprojects.com/ +Project-URL: Changes, https://markupsafe.palletsprojects.com/page/changes/ +Project-URL: Source, https://github.com/pallets/markupsafe/ +Project-URL: Chat, https://discord.gg/pallets +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content +Classifier: Topic :: Text Processing :: Markup :: HTML +Classifier: Typing :: Typed +Requires-Python: >=3.9 +Description-Content-Type: text/markdown +License-File: LICENSE.txt +Dynamic: license-file + +
          + +# MarkupSafe + +MarkupSafe implements a text object that escapes characters so it is +safe to use in HTML and XML. Characters that have special meanings are +replaced so that they display as the actual characters. This mitigates +injection attacks, meaning untrusted user input can safely be displayed +on a page. + + +## Examples + +```pycon +>>> from markupsafe import Markup, escape + +>>> # escape replaces special characters and wraps in Markup +>>> escape("") +Markup('<script>alert(document.cookie);</script>') + +>>> # wrap in Markup to mark text "safe" and prevent escaping +>>> Markup("Hello") +Markup('hello') + +>>> escape(Markup("Hello")) +Markup('hello') + +>>> # Markup is a str subclass +>>> # methods and operators escape their arguments +>>> template = Markup("Hello {name}") +>>> template.format(name='"World"') +Markup('Hello "World"') +``` + +## Donate + +The Pallets organization develops and supports MarkupSafe and other +popular packages. In order to grow the community of contributors and +users, and allow the maintainers to devote more time to the projects, +[please donate today][]. + +[please donate today]: https://palletsprojects.com/donate + +## Contributing + +See our [detailed contributing documentation][contrib] for many ways to +contribute, including reporting issues, requesting features, asking or answering +questions, and making PRs. + +[contrib]: https://palletsprojects.com/contributing/ diff --git a/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/RECORD b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..08e08f7e6d59d4bf48a3c93063489b1cb07ab6f1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/RECORD @@ -0,0 +1,13 @@ +markupsafe-3.0.3.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +markupsafe-3.0.3.dist-info/METADATA,sha256=ErTMYaf6KIz3Zn7j8hN4bZYZ21f7M_9vk0r7y1wS7IE,2690 +markupsafe-3.0.3.dist-info/RECORD,, +markupsafe-3.0.3.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +markupsafe-3.0.3.dist-info/WHEEL,sha256=DZl4yYurviXJJQsilHH1qAzCRDsdz--oNtDZ-hUrZUk,190 +markupsafe-3.0.3.dist-info/licenses/LICENSE.txt,sha256=SJqOEQhQntmKN7uYPhHg9-HTHwvY-Zp5yESOf_N9B-o,1475 +markupsafe-3.0.3.dist-info/top_level.txt,sha256=qy0Plje5IJuvsCBjejJyhDCjEAdcDLK_2agVcex8Z6U,11 +markupsafe/__init__.py,sha256=u1fLcNCx0P8E7LT6z3OXf6ipnSmgm6aefne5y-d7o40,13248 +markupsafe/_native.py,sha256=hSLs8Jmz5aqayuengJJ3kdT5PwNpBWpKrmQSdipndC8,210 +markupsafe/_speedups.c,sha256=t3tC6oVV7-bmKUqvCO5pVSky-G8ACIXpWMaJwkNtJjg,4327 +markupsafe/_speedups.cpython-310-x86_64-linux-gnu.so,sha256=IZmv9CMn34fHG-Pl2n7sQLmmtn2wqXhKYuCNqjunu9U,35816 +markupsafe/_speedups.pyi,sha256=ENd1bYe7gbBUf2ywyYWOGUpnXOHNJ-cgTNqetlW8h5k,41 +markupsafe/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/REQUESTED b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/WHEEL b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..6d6bf82d678c683effaf22b612f4dea70dd9933d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/WHEEL @@ -0,0 +1,7 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: false +Tag: cp310-cp310-manylinux_2_17_x86_64 +Tag: cp310-cp310-manylinux2014_x86_64 +Tag: cp310-cp310-manylinux_2_28_x86_64 + diff --git a/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/licenses/LICENSE.txt b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d227a0cc43c3268d15722b763bd94ad298645a1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/licenses/LICENSE.txt @@ -0,0 +1,28 @@ +Copyright 2010 Pallets + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/top_level.txt b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..75bf729258f9daef77370b6df1a57940f90fc23f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/markupsafe-3.0.3.dist-info/top_level.txt @@ -0,0 +1 @@ +markupsafe diff --git a/.venv/lib/python3.10/site-packages/markupsafe/__init__.py b/.venv/lib/python3.10/site-packages/markupsafe/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4c395d7ba6005500b71f8d9bea5fb4c3abe371d2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/markupsafe/__init__.py @@ -0,0 +1,396 @@ +from __future__ import annotations + +import collections.abc as cabc +import string +import typing as t + +try: + from ._speedups import _escape_inner +except ImportError: + from ._native import _escape_inner + +if t.TYPE_CHECKING: + import typing_extensions as te + + +class _HasHTML(t.Protocol): + def __html__(self, /) -> str: ... + + +class _TPEscape(t.Protocol): + def __call__(self, s: t.Any, /) -> Markup: ... + + +def escape(s: t.Any, /) -> Markup: + """Replace the characters ``&``, ``<``, ``>``, ``'``, and ``"`` in + the string with HTML-safe sequences. Use this if you need to display + text that might contain such characters in HTML. + + If the object has an ``__html__`` method, it is called and the + return value is assumed to already be safe for HTML. + + :param s: An object to be converted to a string and escaped. + :return: A :class:`Markup` string with the escaped text. + """ + # If the object is already a plain string, skip __html__ check and string + # conversion. This is the most common use case. + # Use type(s) instead of s.__class__ because a proxy object may be reporting + # the __class__ of the proxied value. + if type(s) is str: + return Markup(_escape_inner(s)) + + if hasattr(s, "__html__"): + return Markup(s.__html__()) + + return Markup(_escape_inner(str(s))) + + +def escape_silent(s: t.Any | None, /) -> Markup: + """Like :func:`escape` but treats ``None`` as the empty string. + Useful with optional values, as otherwise you get the string + ``'None'`` when the value is ``None``. + + >>> escape(None) + Markup('None') + >>> escape_silent(None) + Markup('') + """ + if s is None: + return Markup() + + return escape(s) + + +def soft_str(s: t.Any, /) -> str: + """Convert an object to a string if it isn't already. This preserves + a :class:`Markup` string rather than converting it back to a basic + string, so it will still be marked as safe and won't be escaped + again. + + >>> value = escape("") + >>> value + Markup('<User 1>') + >>> escape(str(value)) + Markup('&lt;User 1&gt;') + >>> escape(soft_str(value)) + Markup('<User 1>') + """ + if not isinstance(s, str): + return str(s) + + return s + + +class Markup(str): + """A string that is ready to be safely inserted into an HTML or XML + document, either because it was escaped or because it was marked + safe. + + Passing an object to the constructor converts it to text and wraps + it to mark it safe without escaping. To escape the text, use the + :meth:`escape` class method instead. + + >>> Markup("Hello, World!") + Markup('Hello, World!') + >>> Markup(42) + Markup('42') + >>> Markup.escape("Hello, World!") + Markup('Hello <em>World</em>!') + + This implements the ``__html__()`` interface that some frameworks + use. Passing an object that implements ``__html__()`` will wrap the + output of that method, marking it safe. + + >>> class Foo: + ... def __html__(self): + ... return 'foo' + ... + >>> Markup(Foo()) + Markup('foo') + + This is a subclass of :class:`str`. It has the same methods, but + escapes their arguments and returns a ``Markup`` instance. + + >>> Markup("%s") % ("foo & bar",) + Markup('foo & bar') + >>> Markup("Hello ") + "" + Markup('Hello <foo>') + """ + + __slots__ = () + + def __new__( + cls, object: t.Any = "", encoding: str | None = None, errors: str = "strict" + ) -> te.Self: + if hasattr(object, "__html__"): + object = object.__html__() + + if encoding is None: + return super().__new__(cls, object) + + return super().__new__(cls, object, encoding, errors) + + def __html__(self, /) -> te.Self: + return self + + def __add__(self, value: str | _HasHTML, /) -> te.Self: + if isinstance(value, str) or hasattr(value, "__html__"): + return self.__class__(super().__add__(self.escape(value))) + + return NotImplemented + + def __radd__(self, value: str | _HasHTML, /) -> te.Self: + if isinstance(value, str) or hasattr(value, "__html__"): + return self.escape(value).__add__(self) + + return NotImplemented + + def __mul__(self, value: t.SupportsIndex, /) -> te.Self: + return self.__class__(super().__mul__(value)) + + def __rmul__(self, value: t.SupportsIndex, /) -> te.Self: + return self.__class__(super().__mul__(value)) + + def __mod__(self, value: t.Any, /) -> te.Self: + if isinstance(value, tuple): + # a tuple of arguments, each wrapped + value = tuple(_MarkupEscapeHelper(x, self.escape) for x in value) + elif hasattr(type(value), "__getitem__") and not isinstance(value, str): + # a mapping of arguments, wrapped + value = _MarkupEscapeHelper(value, self.escape) + else: + # a single argument, wrapped with the helper and a tuple + value = (_MarkupEscapeHelper(value, self.escape),) + + return self.__class__(super().__mod__(value)) + + def __repr__(self, /) -> str: + return f"{self.__class__.__name__}({super().__repr__()})" + + def join(self, iterable: cabc.Iterable[str | _HasHTML], /) -> te.Self: + return self.__class__(super().join(map(self.escape, iterable))) + + def split( # type: ignore[override] + self, /, sep: str | None = None, maxsplit: t.SupportsIndex = -1 + ) -> list[te.Self]: + return [self.__class__(v) for v in super().split(sep, maxsplit)] + + def rsplit( # type: ignore[override] + self, /, sep: str | None = None, maxsplit: t.SupportsIndex = -1 + ) -> list[te.Self]: + return [self.__class__(v) for v in super().rsplit(sep, maxsplit)] + + def splitlines( # type: ignore[override] + self, /, keepends: bool = False + ) -> list[te.Self]: + return [self.__class__(v) for v in super().splitlines(keepends)] + + def unescape(self, /) -> str: + """Convert escaped markup back into a text string. This replaces + HTML entities with the characters they represent. + + >>> Markup("Main » About").unescape() + 'Main » About' + """ + from html import unescape + + return unescape(str(self)) + + def striptags(self, /) -> str: + """:meth:`unescape` the markup, remove tags, and normalize + whitespace to single spaces. + + >>> Markup("Main »\tAbout").striptags() + 'Main » About' + """ + value = str(self) + + # Look for comments then tags separately. Otherwise, a comment that + # contains a tag would end early, leaving some of the comment behind. + + # keep finding comment start marks + while (start := value.find("", start)) == -1: + break + + value = f"{value[:start]}{value[end + 3 :]}" + + # remove tags using the same method + while (start := value.find("<")) != -1: + if (end := value.find(">", start)) == -1: + break + + value = f"{value[:start]}{value[end + 1 :]}" + + # collapse spaces + value = " ".join(value.split()) + return self.__class__(value).unescape() + + @classmethod + def escape(cls, s: t.Any, /) -> te.Self: + """Escape a string. Calls :func:`escape` and ensures that for + subclasses the correct type is returned. + """ + rv = escape(s) + + if rv.__class__ is not cls: + return cls(rv) + + return rv # type: ignore[return-value] + + def __getitem__(self, key: t.SupportsIndex | slice, /) -> te.Self: + return self.__class__(super().__getitem__(key)) + + def capitalize(self, /) -> te.Self: + return self.__class__(super().capitalize()) + + def title(self, /) -> te.Self: + return self.__class__(super().title()) + + def lower(self, /) -> te.Self: + return self.__class__(super().lower()) + + def upper(self, /) -> te.Self: + return self.__class__(super().upper()) + + def replace(self, old: str, new: str, count: t.SupportsIndex = -1, /) -> te.Self: + return self.__class__(super().replace(old, self.escape(new), count)) + + def ljust(self, width: t.SupportsIndex, fillchar: str = " ", /) -> te.Self: + return self.__class__(super().ljust(width, self.escape(fillchar))) + + def rjust(self, width: t.SupportsIndex, fillchar: str = " ", /) -> te.Self: + return self.__class__(super().rjust(width, self.escape(fillchar))) + + def lstrip(self, chars: str | None = None, /) -> te.Self: + return self.__class__(super().lstrip(chars)) + + def rstrip(self, chars: str | None = None, /) -> te.Self: + return self.__class__(super().rstrip(chars)) + + def center(self, width: t.SupportsIndex, fillchar: str = " ", /) -> te.Self: + return self.__class__(super().center(width, self.escape(fillchar))) + + def strip(self, chars: str | None = None, /) -> te.Self: + return self.__class__(super().strip(chars)) + + def translate( + self, + table: cabc.Mapping[int, str | int | None], # type: ignore[override] + /, + ) -> str: + return self.__class__(super().translate(table)) + + def expandtabs(self, /, tabsize: t.SupportsIndex = 8) -> te.Self: + return self.__class__(super().expandtabs(tabsize)) + + def swapcase(self, /) -> te.Self: + return self.__class__(super().swapcase()) + + def zfill(self, width: t.SupportsIndex, /) -> te.Self: + return self.__class__(super().zfill(width)) + + def casefold(self, /) -> te.Self: + return self.__class__(super().casefold()) + + def removeprefix(self, prefix: str, /) -> te.Self: + return self.__class__(super().removeprefix(prefix)) + + def removesuffix(self, suffix: str) -> te.Self: + return self.__class__(super().removesuffix(suffix)) + + def partition(self, sep: str, /) -> tuple[te.Self, te.Self, te.Self]: + left, sep, right = super().partition(sep) + cls = self.__class__ + return cls(left), cls(sep), cls(right) + + def rpartition(self, sep: str, /) -> tuple[te.Self, te.Self, te.Self]: + left, sep, right = super().rpartition(sep) + cls = self.__class__ + return cls(left), cls(sep), cls(right) + + def format(self, *args: t.Any, **kwargs: t.Any) -> te.Self: + formatter = EscapeFormatter(self.escape) + return self.__class__(formatter.vformat(self, args, kwargs)) + + def format_map( + self, + mapping: cabc.Mapping[str, t.Any], # type: ignore[override] + /, + ) -> te.Self: + formatter = EscapeFormatter(self.escape) + return self.__class__(formatter.vformat(self, (), mapping)) + + def __html_format__(self, format_spec: str, /) -> te.Self: + if format_spec: + raise ValueError("Unsupported format specification for Markup.") + + return self + + +class EscapeFormatter(string.Formatter): + __slots__ = ("escape",) + + def __init__(self, escape: _TPEscape) -> None: + self.escape: _TPEscape = escape + super().__init__() + + def format_field(self, value: t.Any, format_spec: str) -> str: + if hasattr(value, "__html_format__"): + rv = value.__html_format__(format_spec) + elif hasattr(value, "__html__"): + if format_spec: + raise ValueError( + f"Format specifier {format_spec} given, but {type(value)} does not" + " define __html_format__. A class that defines __html__ must define" + " __html_format__ to work with format specifiers." + ) + rv = value.__html__() + else: + # We need to make sure the format spec is str here as + # otherwise the wrong callback methods are invoked. + rv = super().format_field(value, str(format_spec)) + return str(self.escape(rv)) + + +class _MarkupEscapeHelper: + """Helper for :meth:`Markup.__mod__`.""" + + __slots__ = ("obj", "escape") + + def __init__(self, obj: t.Any, escape: _TPEscape) -> None: + self.obj: t.Any = obj + self.escape: _TPEscape = escape + + def __getitem__(self, key: t.Any, /) -> te.Self: + return self.__class__(self.obj[key], self.escape) + + def __str__(self, /) -> str: + return str(self.escape(self.obj)) + + def __repr__(self, /) -> str: + return str(self.escape(repr(self.obj))) + + def __int__(self, /) -> int: + return int(self.obj) + + def __float__(self, /) -> float: + return float(self.obj) + + +def __getattr__(name: str) -> t.Any: + if name == "__version__": + import importlib.metadata + import warnings + + warnings.warn( + "The '__version__' attribute is deprecated and will be removed in" + " MarkupSafe 3.1. Use feature detection, or" + ' `importlib.metadata.version("markupsafe")`, instead.', + DeprecationWarning, + stacklevel=2, + ) + return importlib.metadata.version("markupsafe") + + raise AttributeError(name) diff --git a/.venv/lib/python3.10/site-packages/markupsafe/__pycache__/__init__.cpython-310.pyc b/.venv/lib/python3.10/site-packages/markupsafe/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c235517d096d82fa2fd638d315567898bc1f68e7 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/markupsafe/__pycache__/__init__.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/markupsafe/_native.py b/.venv/lib/python3.10/site-packages/markupsafe/_native.py new file mode 100644 index 0000000000000000000000000000000000000000..088b3bca9839ee489eefa546a0773a465b8cd0ca --- /dev/null +++ b/.venv/lib/python3.10/site-packages/markupsafe/_native.py @@ -0,0 +1,8 @@ +def _escape_inner(s: str, /) -> str: + return ( + s.replace("&", "&") + .replace(">", ">") + .replace("<", "<") + .replace("'", "'") + .replace('"', """) + ) diff --git a/.venv/lib/python3.10/site-packages/markupsafe/_speedups.c b/.venv/lib/python3.10/site-packages/markupsafe/_speedups.c new file mode 100644 index 0000000000000000000000000000000000000000..8a315f23c52851b23525d205e392ee69e0a27f39 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/markupsafe/_speedups.c @@ -0,0 +1,200 @@ +#include + +#define GET_DELTA(inp, inp_end, delta) \ + while (inp < inp_end) { \ + switch (*inp++) { \ + case '"': \ + case '\'': \ + case '&': \ + delta += 4; \ + break; \ + case '<': \ + case '>': \ + delta += 3; \ + break; \ + } \ + } + +#define DO_ESCAPE(inp, inp_end, outp) \ + { \ + Py_ssize_t ncopy = 0; \ + while (inp < inp_end) { \ + switch (*inp) { \ + case '"': \ + memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \ + outp += ncopy; ncopy = 0; \ + *outp++ = '&'; \ + *outp++ = '#'; \ + *outp++ = '3'; \ + *outp++ = '4'; \ + *outp++ = ';'; \ + break; \ + case '\'': \ + memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \ + outp += ncopy; ncopy = 0; \ + *outp++ = '&'; \ + *outp++ = '#'; \ + *outp++ = '3'; \ + *outp++ = '9'; \ + *outp++ = ';'; \ + break; \ + case '&': \ + memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \ + outp += ncopy; ncopy = 0; \ + *outp++ = '&'; \ + *outp++ = 'a'; \ + *outp++ = 'm'; \ + *outp++ = 'p'; \ + *outp++ = ';'; \ + break; \ + case '<': \ + memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \ + outp += ncopy; ncopy = 0; \ + *outp++ = '&'; \ + *outp++ = 'l'; \ + *outp++ = 't'; \ + *outp++ = ';'; \ + break; \ + case '>': \ + memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \ + outp += ncopy; ncopy = 0; \ + *outp++ = '&'; \ + *outp++ = 'g'; \ + *outp++ = 't'; \ + *outp++ = ';'; \ + break; \ + default: \ + ncopy++; \ + } \ + inp++; \ + } \ + memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \ + } + +static PyObject* +escape_unicode_kind1(PyUnicodeObject *in) +{ + Py_UCS1 *inp = PyUnicode_1BYTE_DATA(in); + Py_UCS1 *inp_end = inp + PyUnicode_GET_LENGTH(in); + Py_UCS1 *outp; + PyObject *out; + Py_ssize_t delta = 0; + + GET_DELTA(inp, inp_end, delta); + if (!delta) { + Py_INCREF(in); + return (PyObject*)in; + } + + out = PyUnicode_New(PyUnicode_GET_LENGTH(in) + delta, + PyUnicode_IS_ASCII(in) ? 127 : 255); + if (!out) + return NULL; + + inp = PyUnicode_1BYTE_DATA(in); + outp = PyUnicode_1BYTE_DATA(out); + DO_ESCAPE(inp, inp_end, outp); + return out; +} + +static PyObject* +escape_unicode_kind2(PyUnicodeObject *in) +{ + Py_UCS2 *inp = PyUnicode_2BYTE_DATA(in); + Py_UCS2 *inp_end = inp + PyUnicode_GET_LENGTH(in); + Py_UCS2 *outp; + PyObject *out; + Py_ssize_t delta = 0; + + GET_DELTA(inp, inp_end, delta); + if (!delta) { + Py_INCREF(in); + return (PyObject*)in; + } + + out = PyUnicode_New(PyUnicode_GET_LENGTH(in) + delta, 65535); + if (!out) + return NULL; + + inp = PyUnicode_2BYTE_DATA(in); + outp = PyUnicode_2BYTE_DATA(out); + DO_ESCAPE(inp, inp_end, outp); + return out; +} + + +static PyObject* +escape_unicode_kind4(PyUnicodeObject *in) +{ + Py_UCS4 *inp = PyUnicode_4BYTE_DATA(in); + Py_UCS4 *inp_end = inp + PyUnicode_GET_LENGTH(in); + Py_UCS4 *outp; + PyObject *out; + Py_ssize_t delta = 0; + + GET_DELTA(inp, inp_end, delta); + if (!delta) { + Py_INCREF(in); + return (PyObject*)in; + } + + out = PyUnicode_New(PyUnicode_GET_LENGTH(in) + delta, 1114111); + if (!out) + return NULL; + + inp = PyUnicode_4BYTE_DATA(in); + outp = PyUnicode_4BYTE_DATA(out); + DO_ESCAPE(inp, inp_end, outp); + return out; +} + +static PyObject* +escape_unicode(PyObject *self, PyObject *s) +{ + if (!PyUnicode_Check(s)) + return NULL; + + // This check is no longer needed in Python 3.12. + if (PyUnicode_READY(s)) + return NULL; + + switch (PyUnicode_KIND(s)) { + case PyUnicode_1BYTE_KIND: + return escape_unicode_kind1((PyUnicodeObject*) s); + case PyUnicode_2BYTE_KIND: + return escape_unicode_kind2((PyUnicodeObject*) s); + case PyUnicode_4BYTE_KIND: + return escape_unicode_kind4((PyUnicodeObject*) s); + } + assert(0); /* shouldn't happen */ + return NULL; +} + +static PyMethodDef module_methods[] = { + {"_escape_inner", (PyCFunction)escape_unicode, METH_O, NULL}, + {NULL, NULL, 0, NULL} /* Sentinel */ +}; + +static PyModuleDef_Slot module_slots[] = { +#ifdef Py_mod_multiple_interpreters // Python 3.12+ + {Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED}, +#endif +#ifdef Py_mod_gil // Python 3.13+ + {Py_mod_gil, Py_MOD_GIL_NOT_USED}, +#endif + {0, NULL} /* Sentinel */ +}; + +static struct PyModuleDef module_definition = { + .m_base = PyModuleDef_HEAD_INIT, + .m_name = "markupsafe._speedups", + .m_size = 0, + .m_methods = module_methods, + .m_slots = module_slots, +}; + +PyMODINIT_FUNC +PyInit__speedups(void) +{ + return PyModuleDef_Init(&module_definition); +} diff --git a/.venv/lib/python3.10/site-packages/markupsafe/_speedups.cpython-310-x86_64-linux-gnu.so b/.venv/lib/python3.10/site-packages/markupsafe/_speedups.cpython-310-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..5fafd6c2b2a534b2315eed769d5ab04543cb9918 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/markupsafe/_speedups.cpython-310-x86_64-linux-gnu.so differ diff --git a/.venv/lib/python3.10/site-packages/markupsafe/_speedups.pyi b/.venv/lib/python3.10/site-packages/markupsafe/_speedups.pyi new file mode 100644 index 0000000000000000000000000000000000000000..8c8885852a26eba90d3ca1783beca535d4d43bb0 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/markupsafe/_speedups.pyi @@ -0,0 +1 @@ +def _escape_inner(s: str, /) -> str: ... diff --git a/.venv/lib/python3.10/site-packages/markupsafe/py.typed b/.venv/lib/python3.10/site-packages/markupsafe/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/INSTALLER b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/INSTALLER @@ -0,0 +1 @@ +uv \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/METADATA b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..bff70c381a2a391268211a93215ac5845311d6e9 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/METADATA @@ -0,0 +1,47 @@ +Metadata-Version: 2.4 +Name: nvidia-cusparse +Version: 12.6.3.3 +Summary: CUSPARSE native runtime libraries +Home-page: https://developer.nvidia.com/cuda-zone +Author: Nvidia CUDA Installer Team +Author-email: compute_installer@nvidia.com +License: LicenseRef-NVIDIA-Proprietary +Keywords: cuda,nvidia,runtime,machine learning,deep learning +Classifier: Development Status :: 4 - Beta +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Education +Classifier: Intended Audience :: Science/Research +Classifier: License :: Other/Proprietary License +Classifier: Natural Language :: English +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Topic :: Scientific/Engineering +Classifier: Topic :: Scientific/Engineering :: Mathematics +Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence +Classifier: Topic :: Software Development +Classifier: Topic :: Software Development :: Libraries +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: POSIX :: Linux +Requires-Python: >=3 +License-File: License.txt +Requires-Dist: nvidia-nvjitlink +Dynamic: author +Dynamic: author-email +Dynamic: classifier +Dynamic: description +Dynamic: home-page +Dynamic: keywords +Dynamic: license +Dynamic: license-file +Dynamic: requires-dist +Dynamic: requires-python +Dynamic: summary + +CUSPARSE native runtime libraries diff --git a/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/RECORD b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..f75e9090646130d87efc515e804569846b0c372f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/RECORD @@ -0,0 +1,10 @@ +nvidia/cu13/include/cusparse.h,sha256=I_C-baSWSU38I2jL3KDzxLGSuOT8qvASdg1KUNUGBSI,296819 +nvidia/cu13/include/cusparse_v2.h,sha256=jkH2A9hYc-TEF0vuQ_SurbhPNEHkYGUIRuxKXhFAqnw,2587 +nvidia/cu13/lib/libcusparse.so.12,sha256=CTOfhI9guxERph7g_pHtDCUTK3_2MpgkTXrBTmG1hGY,162565256 +nvidia_cusparse-12.6.3.3.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +nvidia_cusparse-12.6.3.3.dist-info/METADATA,sha256=17hYLpzzgHKou5lggi6J9BpkvH9omV7seDMEyCjpc04,1763 +nvidia_cusparse-12.6.3.3.dist-info/RECORD,, +nvidia_cusparse-12.6.3.3.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +nvidia_cusparse-12.6.3.3.dist-info/WHEEL,sha256=gy6FWQgpujK_dnYc155G2NL32NQjpi5ebTEXjh8SGZQ,144 +nvidia_cusparse-12.6.3.3.dist-info/licenses/License.txt,sha256=rW9YU_ugyg0VnQ9Y1JrkmDDC-Mk_epJki5zpCttMbM0,59262 +nvidia_cusparse-12.6.3.3.dist-info/top_level.txt,sha256=fTkAtiFuL16nUrB9ytDDtpytz2t0B4NvYTnRzwAhO14,7 diff --git a/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/REQUESTED b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/WHEEL b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..29738220b339f398b2cbbc9ac8ccb38a39bdd7b2 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: true +Tag: py3-none-manylinux2014_x86_64 +Tag: py3-none-manylinux_2_17_x86_64 + diff --git a/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/licenses/License.txt b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/licenses/License.txt new file mode 100644 index 0000000000000000000000000000000000000000..b491c70e0aef319022ded661e111ddbd45b8a17f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/licenses/License.txt @@ -0,0 +1,1568 @@ +End User License Agreement +-------------------------- + + +Preface +------- + +The Software License Agreement in Chapter 1 and the Supplement +in Chapter 2 contain license terms and conditions that govern +the use of NVIDIA software. By accepting this agreement, you +agree to comply with all the terms and conditions applicable +to the product(s) included herein. + + +NVIDIA Driver + + +Description + +This package contains the operating system driver and +fundamental system software components for NVIDIA GPUs. + + +NVIDIA CUDA Toolkit + + +Description + +The NVIDIA CUDA Toolkit provides command-line and graphical +tools for building, debugging and optimizing the performance +of applications accelerated by NVIDIA GPUs, runtime and math +libraries, and documentation including programming guides, +user manuals, and API references. + + +Default Install Location of CUDA Toolkit + +Windows platform: + +%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v#.# + +Linux platform: + +/usr/local/cuda-#.# + +Mac platform: + +/Developer/NVIDIA/CUDA-#.# + + +NVIDIA CUDA Samples + + +Description + +This package includes over 100+ CUDA examples that demonstrate +various CUDA programming principles, and efficient CUDA +implementation of algorithms in specific application domains. + + +Default Install Location of CUDA Samples + +Windows platform: + +%ProgramData%\NVIDIA Corporation\CUDA Samples\v#.# + +Linux platform: + +/usr/local/cuda-#.#/samples + +and + +$HOME/NVIDIA_CUDA-#.#_Samples + +Mac platform: + +/Developer/NVIDIA/CUDA-#.#/samples + + +NVIDIA Nsight Visual Studio Edition (Windows only) + + +Description + +NVIDIA Nsight Development Platform, Visual Studio Edition is a +development environment integrated into Microsoft Visual +Studio that provides tools for debugging, profiling, analyzing +and optimizing your GPU computing and graphics applications. + + +Default Install Location of Nsight Visual Studio Edition + +Windows platform: + +%ProgramFiles(x86)%\NVIDIA Corporation\Nsight Visual Studio Edition #.# + + +1. License Agreement for NVIDIA Software Development Kits +--------------------------------------------------------- + + +Release Date: July 26, 2018 +--------------------------- + + +Important NoticeRead before downloading, installing, +copying or using the licensed software: +------------------------------------------------------- + +This license agreement, including exhibits attached +("Agreement”) is a legal agreement between you and NVIDIA +Corporation ("NVIDIA") and governs your use of a NVIDIA +software development kit (“SDK”). + +Each SDK has its own set of software and materials, but here +is a description of the types of items that may be included in +a SDK: source code, header files, APIs, data sets and assets +(examples include images, textures, models, scenes, videos, +native API input/output files), binary software, sample code, +libraries, utility programs, programming code and +documentation. + +This Agreement can be accepted only by an adult of legal age +of majority in the country in which the SDK is used. + +If you are entering into this Agreement on behalf of a company +or other legal entity, you represent that you have the legal +authority to bind the entity to this Agreement, in which case +“you” will mean the entity you represent. + +If you don’t have the required age or authority to accept +this Agreement, or if you don’t accept all the terms and +conditions of this Agreement, do not download, install or use +the SDK. + +You agree to use the SDK only for purposes that are permitted +by (a) this Agreement, and (b) any applicable law, regulation +or generally accepted practices or guidelines in the relevant +jurisdictions. + + +1.1. License + + +1.1.1. License Grant + +Subject to the terms of this Agreement, NVIDIA hereby grants +you a non-exclusive, non-transferable license, without the +right to sublicense (except as expressly provided in this +Agreement) to: + + 1. Install and use the SDK, + + 2. Modify and create derivative works of sample source code + delivered in the SDK, and + + 3. Distribute those portions of the SDK that are identified + in this Agreement as distributable, as incorporated in + object code format into a software application that meets + the distribution requirements indicated in this Agreement. + + +1.1.2. Distribution Requirements + +These are the distribution requirements for you to exercise +the distribution grant: + + 1. Your application must have material additional + functionality, beyond the included portions of the SDK. + + 2. The distributable portions of the SDK shall only be + accessed by your application. + + 3. The following notice shall be included in modifications + and derivative works of sample source code distributed: + “This software contains source code provided by NVIDIA + Corporation.” + + 4. Unless a developer tool is identified in this Agreement + as distributable, it is delivered for your internal use + only. + + 5. The terms under which you distribute your application + must be consistent with the terms of this Agreement, + including (without limitation) terms relating to the + license grant and license restrictions and protection of + NVIDIA’s intellectual property rights. Additionally, you + agree that you will protect the privacy, security and + legal rights of your application users. + + 6. You agree to notify NVIDIA in writing of any known or + suspected distribution or use of the SDK not in compliance + with the requirements of this Agreement, and to enforce + the terms of your agreements with respect to distributed + SDK. + + +1.1.3. Authorized Users + +You may allow employees and contractors of your entity or of +your subsidiary(ies) to access and use the SDK from your +secure network to perform work on your behalf. + +If you are an academic institution you may allow users +enrolled or employed by the academic institution to access and +use the SDK from your secure network. + +You are responsible for the compliance with the terms of this +Agreement by your authorized users. If you become aware that +your authorized users didn’t follow the terms of this +Agreement, you agree to take reasonable steps to resolve the +non-compliance and prevent new occurrences. + + +1.1.4. Pre-Release SDK + +The SDK versions identified as alpha, beta, preview or +otherwise as pre-release, may not be fully functional, may +contain errors or design flaws, and may have reduced or +different security, privacy, accessibility, availability, and +reliability standards relative to commercial versions of +NVIDIA software and materials. Use of a pre-release SDK may +result in unexpected results, loss of data, project delays or +other unpredictable damage or loss. + +You may use a pre-release SDK at your own risk, understanding +that pre-release SDKs are not intended for use in production +or business-critical systems. + +NVIDIA may choose not to make available a commercial version +of any pre-release SDK. NVIDIA may also choose to abandon +development and terminate the availability of a pre-release +SDK at any time without liability. + + +1.1.5. Updates + +NVIDIA may, at its option, make available patches, workarounds +or other updates to this SDK. Unless the updates are provided +with their separate governing terms, they are deemed part of +the SDK licensed to you as provided in this Agreement. You +agree that the form and content of the SDK that NVIDIA +provides may change without prior notice to you. While NVIDIA +generally maintains compatibility between versions, NVIDIA may +in some cases make changes that introduce incompatibilities in +future versions of the SDK. + + +1.1.6. Third Party Licenses + +The SDK may come bundled with, or otherwise include or be +distributed with, third party software licensed by a NVIDIA +supplier and/or open source software provided under an open +source license. Use of third party software is subject to the +third-party license terms, or in the absence of third party +terms, the terms of this Agreement. Copyright to third party +software is held by the copyright holders indicated in the +third-party software or license. + + +1.1.7. Reservation of Rights + +NVIDIA reserves all rights, title, and interest in and to the +SDK, not expressly granted to you under this Agreement. + + +1.2. Limitations + +The following license limitations apply to your use of the +SDK: + + 1. You may not reverse engineer, decompile or disassemble, + or remove copyright or other proprietary notices from any + portion of the SDK or copies of the SDK. + + 2. Except as expressly provided in this Agreement, you may + not copy, sell, rent, sublicense, transfer, distribute, + modify, or create derivative works of any portion of the + SDK. For clarity, you may not distribute or sublicense the + SDK as a stand-alone product. + + 3. Unless you have an agreement with NVIDIA for this + purpose, you may not indicate that an application created + with the SDK is sponsored or endorsed by NVIDIA. + + 4. You may not bypass, disable, or circumvent any + encryption, security, digital rights management or + authentication mechanism in the SDK. + + 5. You may not use the SDK in any manner that would cause it + to become subject to an open source software license. As + examples, licenses that require as a condition of use, + modification, and/or distribution that the SDK be: + + a. Disclosed or distributed in source code form; + + b. Licensed for the purpose of making derivative works; + or + + c. Redistributable at no charge. + + 6. Unless you have an agreement with NVIDIA for this + purpose, you may not use the SDK with any system or + application where the use or failure of the system or + application can reasonably be expected to threaten or + result in personal injury, death, or catastrophic loss. + Examples include use in avionics, navigation, military, + medical, life support or other life critical applications. + NVIDIA does not design, test or manufacture the SDK for + these critical uses and NVIDIA shall not be liable to you + or any third party, in whole or in part, for any claims or + damages arising from such uses. + + 7. You agree to defend, indemnify and hold harmless NVIDIA + and its affiliates, and their respective employees, + contractors, agents, officers and directors, from and + against any and all claims, damages, obligations, losses, + liabilities, costs or debt, fines, restitutions and + expenses (including but not limited to attorney’s fees + and costs incident to establishing the right of + indemnification) arising out of or related to your use of + the SDK outside of the scope of this Agreement, or not in + compliance with its terms. + + +1.3. Ownership + + 1. NVIDIA or its licensors hold all rights, title and + interest in and to the SDK and its modifications and + derivative works, including their respective intellectual + property rights, subject to your rights described in this + section. This SDK may include software and materials from + NVIDIA’s licensors, and these licensors are intended + third party beneficiaries that may enforce this Agreement + with respect to their intellectual property rights. + + 2. You hold all rights, title and interest in and to your + applications and your derivative works of the sample + source code delivered in the SDK, including their + respective intellectual property rights, subject to + NVIDIA’s rights described in this section. + + 3. You may, but don’t have to, provide to NVIDIA + suggestions, feature requests or other feedback regarding + the SDK, including possible enhancements or modifications + to the SDK. For any feedback that you voluntarily provide, + you hereby grant NVIDIA and its affiliates a perpetual, + non-exclusive, worldwide, irrevocable license to use, + reproduce, modify, license, sublicense (through multiple + tiers of sublicensees), and distribute (through multiple + tiers of distributors) it without the payment of any + royalties or fees to you. NVIDIA will use feedback at its + choice. NVIDIA is constantly looking for ways to improve + its products, so you may send feedback to NVIDIA through + the developer portal at https://developer.nvidia.com. + + +1.4. No Warranties + +THE SDK IS PROVIDED BY NVIDIA “AS IS” AND “WITH ALL +FAULTS.” TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND +ITS AFFILIATES EXPRESSLY DISCLAIM ALL WARRANTIES OF ANY KIND +OR NATURE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, +BUT NOT LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, OR THE +ABSENCE OF ANY DEFECTS THEREIN, WHETHER LATENT OR PATENT. NO +WARRANTY IS MADE ON THE BASIS OF TRADE USAGE, COURSE OF +DEALING OR COURSE OF TRADE. + + +1.5. Limitation of Liability + +TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND ITS +AFFILIATES SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, +PUNITIVE OR CONSEQUENTIAL DAMAGES, OR ANY LOST PROFITS, LOSS +OF USE, LOSS OF DATA OR LOSS OF GOODWILL, OR THE COSTS OF +PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF OR IN CONNECTION +WITH THIS AGREEMENT OR THE USE OR PERFORMANCE OF THE SDK, +WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED UPON BREACH +OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING NEGLIGENCE), +PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR THEORY OF +LIABILITY. IN NO EVENT WILL NVIDIA’S AND ITS AFFILIATES +TOTAL CUMULATIVE LIABILITY UNDER OR ARISING OUT OF THIS +AGREEMENT EXCEED US$10.00. THE NATURE OF THE LIABILITY OR THE +NUMBER OF CLAIMS OR SUITS SHALL NOT ENLARGE OR EXTEND THIS +LIMIT. + +These exclusions and limitations of liability shall apply +regardless if NVIDIA or its affiliates have been advised of +the possibility of such damages, and regardless of whether a +remedy fails its essential purpose. These exclusions and +limitations of liability form an essential basis of the +bargain between the parties, and, absent any of these +exclusions or limitations of liability, the provisions of this +Agreement, including, without limitation, the economic terms, +would be substantially different. + + +1.6. Termination + + 1. This Agreement will continue to apply until terminated by + either you or NVIDIA as described below. + + 2. If you want to terminate this Agreement, you may do so by + stopping to use the SDK. + + 3. NVIDIA may, at any time, terminate this Agreement if: + + a. (i) you fail to comply with any term of this + Agreement and the non-compliance is not fixed within + thirty (30) days following notice from NVIDIA (or + immediately if you violate NVIDIA’s intellectual + property rights); + + b. (ii) you commence or participate in any legal + proceeding against NVIDIA with respect to the SDK; or + + c. (iii) NVIDIA decides to no longer provide the SDK in + a country or, in NVIDIA’s sole discretion, the + continued use of it is no longer commercially viable. + + 4. Upon any termination of this Agreement, you agree to + promptly discontinue use of the SDK and destroy all copies + in your possession or control. Your prior distributions in + accordance with this Agreement are not affected by the + termination of this Agreement. Upon written request, you + will certify in writing that you have complied with your + commitments under this section. Upon any termination of + this Agreement all provisions survive except for the + license grant provisions. + + +1.7. General + +If you wish to assign this Agreement or your rights and +obligations, including by merger, consolidation, dissolution +or operation of law, contact NVIDIA to ask for permission. Any +attempted assignment not approved by NVIDIA in writing shall +be void and of no effect. NVIDIA may assign, delegate or +transfer this Agreement and its rights and obligations, and if +to a non-affiliate you will be notified. + +You agree to cooperate with NVIDIA and provide reasonably +requested information to verify your compliance with this +Agreement. + +This Agreement will be governed in all respects by the laws of +the United States and of the State of Delaware as those laws +are applied to contracts entered into and performed entirely +within Delaware by Delaware residents, without regard to the +conflicts of laws principles. The United Nations Convention on +Contracts for the International Sale of Goods is specifically +disclaimed. You agree to all terms of this Agreement in the +English language. + +The state or federal courts residing in Santa Clara County, +California shall have exclusive jurisdiction over any dispute +or claim arising out of this Agreement. Notwithstanding this, +you agree that NVIDIA shall still be allowed to apply for +injunctive remedies or an equivalent type of urgent legal +relief in any jurisdiction. + +If any court of competent jurisdiction determines that any +provision of this Agreement is illegal, invalid or +unenforceable, such provision will be construed as limited to +the extent necessary to be consistent with and fully +enforceable under the law and the remaining provisions will +remain in full force and effect. Unless otherwise specified, +remedies are cumulative. + +Each party acknowledges and agrees that the other is an +independent contractor in the performance of this Agreement. + +The SDK has been developed entirely at private expense and is +“commercial items” consisting of “commercial computer +software” and “commercial computer software +documentation” provided with RESTRICTED RIGHTS. Use, +duplication or disclosure by the U.S. Government or a U.S. +Government subcontractor is subject to the restrictions in +this Agreement pursuant to DFARS 227.7202-3(a) or as set forth +in subparagraphs (c)(1) and (2) of the Commercial Computer +Software - Restricted Rights clause at FAR 52.227-19, as +applicable. Contractor/manufacturer is NVIDIA, 2788 San Tomas +Expressway, Santa Clara, CA 95051. + +The SDK is subject to United States export laws and +regulations. You agree that you will not ship, transfer or +export the SDK into any country, or use the SDK in any manner, +prohibited by the United States Bureau of Industry and +Security or economic sanctions regulations administered by the +U.S. Department of Treasury’s Office of Foreign Assets +Control (OFAC), or any applicable export laws, restrictions or +regulations. These laws include restrictions on destinations, +end users and end use. By accepting this Agreement, you +confirm that you are not a resident or citizen of any country +currently embargoed by the U.S. and that you are not otherwise +prohibited from receiving the SDK. + +Any notice delivered by NVIDIA to you under this Agreement +will be delivered via mail, email or fax. You agree that any +notices that NVIDIA sends you electronically will satisfy any +legal communication requirements. Please direct your legal +notices or other correspondence to NVIDIA Corporation, 2788 +San Tomas Expressway, Santa Clara, California 95051, United +States of America, Attention: Legal Department. + +This Agreement and any exhibits incorporated into this +Agreement constitute the entire agreement of the parties with +respect to the subject matter of this Agreement and supersede +all prior negotiations or documentation exchanged between the +parties relating to this SDK license. Any additional and/or +conflicting terms on documents issued by you are null, void, +and invalid. Any amendment or waiver under this Agreement +shall be in writing and signed by representatives of both +parties. + + +2. CUDA Toolkit Supplement to Software License Agreement for +NVIDIA Software Development Kits +------------------------------------------------------------ + + +Release date: August 16, 2018 +----------------------------- + +The terms in this supplement govern your use of the NVIDIA +CUDA Toolkit SDK under the terms of your license agreement +(“Agreement”) as modified by this supplement. Capitalized +terms used but not defined below have the meaning assigned to +them in the Agreement. + +This supplement is an exhibit to the Agreement and is +incorporated as an integral part of the Agreement. In the +event of conflict between the terms in this supplement and the +terms in the Agreement, the terms in this supplement govern. + + +2.1. License Scope + +The SDK is licensed for you to develop applications only for +use in systems with NVIDIA GPUs. + + +2.2. Distribution + +The portions of the SDK that are distributable under the +Agreement are listed in Attachment A. + + +2.3. Operating Systems + +Those portions of the SDK designed exclusively for use on the +Linux or FreeBSD operating systems, or other operating systems +derived from the source code to these operating systems, may +be copied and redistributed for use in accordance with this +Agreement, provided that the object code files are not +modified in any way (except for unzipping of compressed +files). + + +2.4. Audio and Video Encoders and Decoders + +You acknowledge and agree that it is your sole responsibility +to obtain any additional third-party licenses required to +make, have made, use, have used, sell, import, and offer for +sale your products or services that include or incorporate any +third-party software and content relating to audio and/or +video encoders and decoders from, including but not limited +to, Microsoft, Thomson, Fraunhofer IIS, Sisvel S.p.A., +MPEG-LA, and Coding Technologies. NVIDIA does not grant to you +under this Agreement any necessary patent or other rights with +respect to any audio and/or video encoders and decoders. + + +2.5. Licensing + +If the distribution terms in this Agreement are not suitable +for your organization, or for any questions regarding this +Agreement, please contact NVIDIA at +nvidia-compute-license-questions@nvidia.com. + + +2.6. Attachment A + +The following portions of the SDK are distributable under the +Agreement: + +Component + +CUDA Runtime + +Windows + +cudart.dll, cudart_static.lib, cudadevrt.lib + +Mac OSX + +libcudart.dylib, libcudart_static.a, libcudadevrt.a + +Linux + +libcudart.so, libcudart_static.a, libcudadevrt.a + +Android + +libcudart.so, libcudart_static.a, libcudadevrt.a + +Component + +CUDA FFT Library + +Windows + +cufft.dll, cufftw.dll, cufft.lib, cufftw.lib + +Mac OSX + +libcufft.dylib, libcufft_static.a, libcufftw.dylib, +libcufftw_static.a + +Linux + +libcufft.so, libcufft_static.a, libcufftw.so, +libcufftw_static.a + +Android + +libcufft.so, libcufft_static.a, libcufftw.so, +libcufftw_static.a + +Component + +CUDA BLAS Library + +Windows + +cublas.dll, cublasLt.dll + +Mac OSX + +libcublas.dylib, libcublasLt.dylib, libcublas_static.a, +libcublasLt_static.a + +Linux + +libcublas.so, libcublasLt.so, libcublas_static.a, +libcublasLt_static.a + +Android + +libcublas.so, libcublasLt.so, libcublas_static.a, +libcublasLt_static.a + +Component + +NVIDIA "Drop-in" BLAS Library + +Windows + +nvblas.dll + +Mac OSX + +libnvblas.dylib + +Linux + +libnvblas.so + +Component + +CUDA Sparse Matrix Library + +Windows + +cusparse.dll, cusparse.lib + +Mac OSX + +libcusparse.dylib, libcusparse_static.a + +Linux + +libcusparse.so, libcusparse_static.a + +Android + +libcusparse.so, libcusparse_static.a + +Component + +CUDA Linear Solver Library + +Windows + +cusolver.dll, cusolver.lib + +Mac OSX + +libcusolver.dylib, libcusolver_static.a + +Linux + +libcusolver.so, libcusolver_static.a + +Android + +libcusolver.so, libcusolver_static.a + +Component + +CUDA Random Number Generation Library + +Windows + +curand.dll, curand.lib + +Mac OSX + +libcurand.dylib, libcurand_static.a + +Linux + +libcurand.so, libcurand_static.a + +Android + +libcurand.so, libcurand_static.a + +Component + +CUDA Accelerated Graph Library + +Component + +NVIDIA Performance Primitives Library + +Windows + +nppc.dll, nppc.lib, nppial.dll, nppial.lib, nppicc.dll, +nppicc.lib, nppicom.dll, nppicom.lib, nppidei.dll, +nppidei.lib, nppif.dll, nppif.lib, nppig.dll, nppig.lib, +nppim.dll, nppim.lib, nppist.dll, nppist.lib, nppisu.dll, +nppisu.lib, nppitc.dll, nppitc.lib, npps.dll, npps.lib + +Mac OSX + +libnppc.dylib, libnppc_static.a, libnppial.dylib, +libnppial_static.a, libnppicc.dylib, libnppicc_static.a, +libnppicom.dylib, libnppicom_static.a, libnppidei.dylib, +libnppidei_static.a, libnppif.dylib, libnppif_static.a, +libnppig.dylib, libnppig_static.a, libnppim.dylib, +libnppisu_static.a, libnppitc.dylib, libnppitc_static.a, +libnpps.dylib, libnpps_static.a + +Linux + +libnppc.so, libnppc_static.a, libnppial.so, +libnppial_static.a, libnppicc.so, libnppicc_static.a, +libnppicom.so, libnppicom_static.a, libnppidei.so, +libnppidei_static.a, libnppif.so, libnppif_static.a +libnppig.so, libnppig_static.a, libnppim.so, +libnppim_static.a, libnppist.so, libnppist_static.a, +libnppisu.so, libnppisu_static.a, libnppitc.so +libnppitc_static.a, libnpps.so, libnpps_static.a + +Android + +libnppc.so, libnppc_static.a, libnppial.so, +libnppial_static.a, libnppicc.so, libnppicc_static.a, +libnppicom.so, libnppicom_static.a, libnppidei.so, +libnppidei_static.a, libnppif.so, libnppif_static.a +libnppig.so, libnppig_static.a, libnppim.so, +libnppim_static.a, libnppist.so, libnppist_static.a, +libnppisu.so, libnppisu_static.a, libnppitc.so +libnppitc_static.a, libnpps.so, libnpps_static.a + +Component + +NVIDIA JPEG Library + +Linux + +libnvjpeg.so, libnvjpeg_static.a + +Component + +Internal common library required for statically linking to +cuBLAS, cuSPARSE, cuFFT, cuRAND, nvJPEG and NPP + +Mac OSX + +libculibos.a + +Linux + +libculibos.a + +Component + +NVIDIA Runtime Compilation Library and Header + +All + +nvrtc.h + +Windows + +nvrtc.dll, nvrtc-builtins.dll + +Mac OSX + +libnvrtc.dylib, libnvrtc-builtins.dylib + +Linux + +libnvrtc.so, libnvrtc-builtins.so + +Component + +NVIDIA Optimizing Compiler Library + +Windows + +nvvm.dll + +Mac OSX + +libnvvm.dylib + +Linux + +libnvvm.so + +Component + +NVIDIA Common Device Math Functions Library + +Windows + +libdevice.10.bc + +Mac OSX + +libdevice.10.bc + +Linux + +libdevice.10.bc + +Component + +CUDA Occupancy Calculation Header Library + +All + +cuda_occupancy.h + +Component + +CUDA Half Precision Headers + +All + +cuda_fp16.h, cuda_fp16.hpp + +Component + +CUDA Profiling Tools Interface (CUPTI) Library + +Windows + +cupti.dll + +Mac OSX + +libcupti.dylib + +Linux + +libcupti.so + +Component + +NVIDIA Tools Extension Library + +Windows + +nvToolsExt.dll, nvToolsExt.lib + +Mac OSX + +libnvToolsExt.dylib + +Linux + +libnvToolsExt.so + +Component + +NVIDIA CUDA Driver Libraries + +Linux + +libcuda.so, libnvidia-fatbinaryloader.so, +libnvidia-ptxjitcompiler.so + +The NVIDIA CUDA Driver Libraries are only distributable in +applications that meet this criteria: + + 1. The application was developed starting from a NVIDIA CUDA + container obtained from Docker Hub or the NVIDIA GPU + Cloud, and + + 2. The resulting application is packaged as a Docker + container and distributed to users on Docker Hub or the + NVIDIA GPU Cloud only. + + +2.7. Attachment B + + +Additional Licensing Obligations + +The following third party components included in the SOFTWARE +are licensed to Licensee pursuant to the following terms and +conditions: + + 1. Licensee's use of the GDB third party component is + subject to the terms and conditions of GNU GPL v3: + + This product includes copyrighted third-party software licensed + under the terms of the GNU General Public License v3 ("GPL v3"). + All third-party software packages are copyright by their respective + authors. GPL v3 terms and conditions are hereby incorporated into + the Agreement by this reference: http://www.gnu.org/licenses/gpl.txt + + Consistent with these licensing requirements, the software + listed below is provided under the terms of the specified + open source software licenses. To obtain source code for + software provided under licenses that require + redistribution of source code, including the GNU General + Public License (GPL) and GNU Lesser General Public License + (LGPL), contact oss-requests@nvidia.com. This offer is + valid for a period of three (3) years from the date of the + distribution of this product by NVIDIA CORPORATION. + + Component License + CUDA-GDB GPL v3 + + 2. Licensee represents and warrants that any and all third + party licensing and/or royalty payment obligations in + connection with Licensee's use of the H.264 video codecs + are solely the responsibility of Licensee. + + 3. Licensee's use of the Thrust library is subject to the + terms and conditions of the Apache License Version 2.0. + All third-party software packages are copyright by their + respective authors. Apache License Version 2.0 terms and + conditions are hereby incorporated into the Agreement by + this reference. + http://www.apache.org/licenses/LICENSE-2.0.html + + In addition, Licensee acknowledges the following notice: + Thrust includes source code from the Boost Iterator, + Tuple, System, and Random Number libraries. + + Boost Software License - Version 1.0 - August 17th, 2003 + . . . . + + Permission is hereby granted, free of charge, to any person or + organization obtaining a copy of the software and accompanying + documentation covered by this license (the "Software") to use, + reproduce, display, distribute, execute, and transmit the Software, + and to prepare derivative works of the Software, and to permit + third-parties to whom the Software is furnished to do so, all + subject to the following: + + The copyright notices in the Software and this entire statement, + including the above license grant, this restriction and the following + disclaimer, must be included in all copies of the Software, in whole + or in part, and all derivative works of the Software, unless such + copies or derivative works are solely in the form of machine-executable + object code generated by a source language processor. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND + NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR + OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + 4. Licensee's use of the LLVM third party component is + subject to the following terms and conditions: + + ====================================================== + LLVM Release License + ====================================================== + University of Illinois/NCSA + Open Source License + + Copyright (c) 2003-2010 University of Illinois at Urbana-Champaign. + All rights reserved. + + Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal with the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at Urbana- + Champaign, nor the names of its contributors may be used to endorse or + promote products derived from this Software without specific prior + written permission. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS WITH THE SOFTWARE. + + 5. Licensee's use (e.g. nvprof) of the PCRE third party + component is subject to the following terms and + conditions: + + ------------ + PCRE LICENCE + ------------ + PCRE is a library of functions to support regular expressions whose syntax + and semantics are as close as possible to those of the Perl 5 language. + Release 8 of PCRE is distributed under the terms of the "BSD" licence, as + specified below. The documentation for PCRE, supplied in the "doc" + directory, is distributed under the same terms as the software itself. The + basic library functions are written in C and are freestanding. Also + included in the distribution is a set of C++ wrapper functions, and a just- + in-time compiler that can be used to optimize pattern matching. These are + both optional features that can be omitted when the library is built. + + THE BASIC LIBRARY FUNCTIONS + --------------------------- + Written by: Philip Hazel + Email local part: ph10 + Email domain: cam.ac.uk + University of Cambridge Computing Service, + Cambridge, England. + Copyright (c) 1997-2012 University of Cambridge + All rights reserved. + + PCRE JUST-IN-TIME COMPILATION SUPPORT + ------------------------------------- + Written by: Zoltan Herczeg + Email local part: hzmester + Emain domain: freemail.hu + Copyright(c) 2010-2012 Zoltan Herczeg + All rights reserved. + + STACK-LESS JUST-IN-TIME COMPILER + -------------------------------- + Written by: Zoltan Herczeg + Email local part: hzmester + Emain domain: freemail.hu + Copyright(c) 2009-2012 Zoltan Herczeg + All rights reserved. + + THE C++ WRAPPER FUNCTIONS + ------------------------- + Contributed by: Google Inc. + Copyright (c) 2007-2012, Google Inc. + All rights reserved. + + THE "BSD" LICENCE + ----------------- + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the University of Cambridge nor the name of Google + Inc. nor the names of their contributors may be used to endorse or + promote products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + 6. Some of the cuBLAS library routines were written by or + derived from code written by Vasily Volkov and are subject + to the Modified Berkeley Software Distribution License as + follows: + + Copyright (c) 2007-2009, Regents of the University of California + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of the University of California, Berkeley nor + the names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + 7. Some of the cuBLAS library routines were written by or + derived from code written by Davide Barbieri and are + subject to the Modified Berkeley Software Distribution + License as follows: + + Copyright (c) 2008-2009 Davide Barbieri @ University of Rome Tor Vergata. + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + 8. Some of the cuBLAS library routines were derived from + code developed by the University of Tennessee and are + subject to the Modified Berkeley Software Distribution + License as follows: + + Copyright (c) 2010 The University of Tennessee. + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer listed in this license in the documentation and/or + other materials provided with the distribution. + * Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + 9. Some of the cuBLAS library routines were written by or + derived from code written by Jonathan Hogg and are subject + to the Modified Berkeley Software Distribution License as + follows: + + Copyright (c) 2012, The Science and Technology Facilities Council (STFC). + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of the STFC nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE STFC BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + 10. Some of the cuBLAS library routines were written by or + derived from code written by Ahmad M. Abdelfattah, David + Keyes, and Hatem Ltaief, and are subject to the Apache + License, Version 2.0, as follows: + + -- (C) Copyright 2013 King Abdullah University of Science and Technology + Authors: + Ahmad Abdelfattah (ahmad.ahmad@kaust.edu.sa) + David Keyes (david.keyes@kaust.edu.sa) + Hatem Ltaief (hatem.ltaief@kaust.edu.sa) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the King Abdullah University of Science and + Technology nor the names of its contributors may be used to endorse + or promote products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE + + 11. Some of the cuSPARSE library routines were written by or + derived from code written by Li-Wen Chang and are subject + to the NCSA Open Source License as follows: + + Copyright (c) 2012, University of Illinois. + + All rights reserved. + + Developed by: IMPACT Group, University of Illinois, http://impact.crhc.illinois.edu + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal with the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimers in the documentation and/or other materials provided + with the distribution. + * Neither the names of IMPACT Group, University of Illinois, nor + the names of its contributors may be used to endorse or promote + products derived from this Software without specific prior + written permission. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR + IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE + SOFTWARE. + + 12. Some of the cuRAND library routines were written by or + derived from code written by Mutsuo Saito and Makoto + Matsumoto and are subject to the following license: + + Copyright (c) 2009, 2010 Mutsuo Saito, Makoto Matsumoto and Hiroshima + University. All rights reserved. + + Copyright (c) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima + University and University of Tokyo. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of the Hiroshima University nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + 13. Some of the cuRAND library routines were derived from + code developed by D. E. Shaw Research and are subject to + the following license: + + Copyright 2010-2011, D. E. Shaw Research. + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions, and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions, and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of D. E. Shaw Research nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + 14. Some of the Math library routines were written by or + derived from code developed by Norbert Juffa and are + subject to the following license: + + Copyright (c) 2015-2017, Norbert Juffa + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + 15. Licensee's use of the lz4 third party component is + subject to the following terms and conditions: + + Copyright (C) 2011-2013, Yann Collet. + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + 16. The NPP library uses code from the Boost Math Toolkit, + and is subject to the following license: + + Boost Software License - Version 1.0 - August 17th, 2003 + . . . . + + Permission is hereby granted, free of charge, to any person or + organization obtaining a copy of the software and accompanying + documentation covered by this license (the "Software") to use, + reproduce, display, distribute, execute, and transmit the Software, + and to prepare derivative works of the Software, and to permit + third-parties to whom the Software is furnished to do so, all + subject to the following: + + The copyright notices in the Software and this entire statement, + including the above license grant, this restriction and the following + disclaimer, must be included in all copies of the Software, in whole + or in part, and all derivative works of the Software, unless such + copies or derivative works are solely in the form of machine-executable + object code generated by a source language processor. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND + NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR + OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + 17. Portions of the Nsight Eclipse Edition is subject to the + following license: + + The Eclipse Foundation makes available all content in this plug-in + ("Content"). Unless otherwise indicated below, the Content is provided + to you under the terms and conditions of the Eclipse Public License + Version 1.0 ("EPL"). A copy of the EPL is available at http:// + www.eclipse.org/legal/epl-v10.html. For purposes of the EPL, "Program" + will mean the Content. + + If you did not receive this Content directly from the Eclipse + Foundation, the Content is being redistributed by another party + ("Redistributor") and different terms and conditions may apply to your + use of any object code in the Content. Check the Redistributor's + license that was provided with the Content. If no such license exists, + contact the Redistributor. Unless otherwise indicated below, the terms + and conditions of the EPL still apply to any source code in the + Content and such source code may be obtained at http://www.eclipse.org. + + 18. Some of the cuBLAS library routines uses code from + OpenAI, which is subject to the following license: + + License URL + https://github.com/openai/openai-gemm/blob/master/LICENSE + + License Text + The MIT License + + Copyright (c) 2016 OpenAI (http://openai.com), 2016 Google Inc. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + 19. Licensee's use of the Visual Studio Setup Configuration + Samples is subject to the following license: + + The MIT License (MIT) + Copyright (C) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + 20. Licensee's use of linmath.h header for CPU functions for + GL vector/matrix operations from lunarG is subject to the + Apache License Version 2.0. + + 21. The DX12-CUDA sample uses the d3dx12.h header, which is + subject to the MIT license . + +----------------- diff --git a/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/top_level.txt b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..862f7abf232cdfbb928609856247292e81c9decb --- /dev/null +++ b/.venv/lib/python3.10/site-packages/nvidia_cusparse-12.6.3.3.dist-info/top_level.txt @@ -0,0 +1 @@ +nvidia diff --git a/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/INSTALLER b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/INSTALLER @@ -0,0 +1 @@ +uv \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/METADATA b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..689977d81a0f1cf80d5399505a1a0b73844a4e10 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/METADATA @@ -0,0 +1,1140 @@ +Metadata-Version: 2.4 +Name: orjson +Version: 3.11.8 +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: License :: OSI Approved :: MIT License +Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) +Classifier: Operating System :: MacOS +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: POSIX :: Linux +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: 3.15 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python +Classifier: Programming Language :: Rust +Classifier: Typing :: Typed +License-File: LICENSE-APACHE +License-File: LICENSE-MIT +License-File: LICENSE-MPL-2.0 +Summary: Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy +License-Expression: MPL-2.0 AND (Apache-2.0 OR MIT) +Requires-Python: >=3.10 +Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM +Project-URL: changelog, https://github.com/ijl/orjson/blob/master/CHANGELOG.md +Project-URL: documentation, https://github.com/ijl/orjson +Project-URL: source, https://github.com/ijl/orjson + +# orjson + +orjson is a fast, correct JSON library for Python. It +[benchmarks](https://github.com/ijl/orjson?tab=readme-ov-file#performance) as the fastest Python +library for JSON and is more correct than the standard json library or other +third-party libraries. It serializes +[dataclass](https://github.com/ijl/orjson?tab=readme-ov-file#dataclass), +[datetime](https://github.com/ijl/orjson?tab=readme-ov-file#datetime), +[numpy](https://github.com/ijl/orjson?tab=readme-ov-file#numpy), and +[UUID](https://github.com/ijl/orjson?tab=readme-ov-file#uuid) instances natively. + +[orjson.dumps()](https://github.com/ijl/orjson?tab=readme-ov-file#serialize) is +something like 10x as fast as `json`, serializes +common types and subtypes, has a `default` parameter for the caller to specify +how to serialize arbitrary types, and has a number of flags controlling output. + +[orjson.loads()](https://github.com/ijl/orjson?tab=readme-ov-file#deserialize) +is something like 2x as fast as `json`, and is strictly compliant with UTF-8 and +RFC 8259 ("The JavaScript Object Notation (JSON) Data Interchange Format"). + +Reading from and writing to files, line-delimited JSON files, and so on is +not provided by the library. + +orjson supports CPython 3.10, 3.11, 3.12, 3.13, 3.14, and 3.15. + +It distributes amd64/x86_64/x64, i686/x86, aarch64/arm64/armv8, arm7, +ppc64le/POWER8, and s390x wheels for Linux, amd64 and aarch64 wheels +for macOS, and amd64, i686, and aarch64 wheels for Windows. + +Wheels published to PyPI for amd64 run on x86-64-v1 (2003) +or later, but will at runtime use AVX-512 if available for a +significant performance benefit; aarch64 wheels run on ARMv8-A (2011) or +later. + +orjson does not and will not support PyPy, embedded Python builds for +Android/iOS, or PEP 554 subinterpreters. + +orjson may support PEP 703 free-threading when it is stable. + +Releases follow semantic versioning and serializing a new object type +without an opt-in flag is considered a breaking change. + +orjson contains source code licensed under the Mozilla Public License 2.0, +Apache 2.0, and MIT licenses. The repository from which PyPI artifacts are +published is [github.com/ijl/orjson](https://github.com/ijl/orjson) and an +alternative repository is [codeberg.org/ijl/orjson](https://codeberg.org/ijl/orjson). +There is no open issue tracker or pull requests due to signal-to-noise ratio. +There is a [CHANGELOG](https://github.com/ijl/orjson/blob/master/CHANGELOG.md) +available in the repository. + +1. [Usage](https://github.com/ijl/orjson?tab=readme-ov-file#usage) + 1. [Install](https://github.com/ijl/orjson?tab=readme-ov-file#install) + 2. [Quickstart](https://github.com/ijl/orjson?tab=readme-ov-file#quickstart) + 3. [Migrating](https://github.com/ijl/orjson?tab=readme-ov-file#migrating) + 4. [Serialize](https://github.com/ijl/orjson?tab=readme-ov-file#serialize) + 1. [default](https://github.com/ijl/orjson?tab=readme-ov-file#default) + 2. [option](https://github.com/ijl/orjson?tab=readme-ov-file#option) + 3. [Fragment](https://github.com/ijl/orjson?tab=readme-ov-file#fragment) + 5. [Deserialize](https://github.com/ijl/orjson?tab=readme-ov-file#deserialize) +2. [Types](https://github.com/ijl/orjson?tab=readme-ov-file#types) + 1. [dataclass](https://github.com/ijl/orjson?tab=readme-ov-file#dataclass) + 2. [datetime](https://github.com/ijl/orjson?tab=readme-ov-file#datetime) + 3. [enum](https://github.com/ijl/orjson?tab=readme-ov-file#enum) + 4. [float](https://github.com/ijl/orjson?tab=readme-ov-file#float) + 5. [int](https://github.com/ijl/orjson?tab=readme-ov-file#int) + 6. [numpy](https://github.com/ijl/orjson?tab=readme-ov-file#numpy) + 7. [str](https://github.com/ijl/orjson?tab=readme-ov-file#str) + 8. [uuid](https://github.com/ijl/orjson?tab=readme-ov-file#uuid) +3. [Testing](https://github.com/ijl/orjson?tab=readme-ov-file#testing) +4. [Performance](https://github.com/ijl/orjson?tab=readme-ov-file#performance) + 1. [Latency](https://github.com/ijl/orjson?tab=readme-ov-file#latency) + 2. [Reproducing](https://github.com/ijl/orjson?tab=readme-ov-file#reproducing) +5. [Questions](https://github.com/ijl/orjson?tab=readme-ov-file#questions) +6. [Packaging](https://github.com/ijl/orjson?tab=readme-ov-file#packaging) +7. [License](https://github.com/ijl/orjson?tab=readme-ov-file#license) + +## Usage + +### Install + +To install a wheel from PyPI, install the `orjson` package. + +In `requirements.in` or `requirements.txt` format, specify: + +```txt +orjson >= 3.10,<4 +``` + +In `pyproject.toml` format, specify: + +```toml +orjson = "^3.10" +``` + +To build a wheel, see [packaging](https://github.com/ijl/orjson?tab=readme-ov-file#packaging). + +### Quickstart + +This is an example of serializing, with options specified, and deserializing: + +```python +>>> import orjson, datetime, numpy +>>> data = { + "type": "job", + "created_at": datetime.datetime(1970, 1, 1), + "status": "🆗", + "payload": numpy.array([[1, 2], [3, 4]]), +} +>>> orjson.dumps(data, option=orjson.OPT_NAIVE_UTC | orjson.OPT_SERIALIZE_NUMPY) +b'{"type":"job","created_at":"1970-01-01T00:00:00+00:00","status":"\xf0\x9f\x86\x97","payload":[[1,2],[3,4]]}' +>>> orjson.loads(_) +{'type': 'job', 'created_at': '1970-01-01T00:00:00+00:00', 'status': '🆗', 'payload': [[1, 2], [3, 4]]} +``` + +### Migrating + +orjson version 3 serializes more types than version 2. Subclasses of `str`, +`int`, `dict`, and `list` are now serialized. This is faster and more similar +to the standard library. It can be disabled with +`orjson.OPT_PASSTHROUGH_SUBCLASS`.`dataclasses.dataclass` instances +are now serialized by default and cannot be customized in a +`default` function unless `option=orjson.OPT_PASSTHROUGH_DATACLASS` is +specified. `uuid.UUID` instances are serialized by default. +For any type that is now serialized, +implementations in a `default` function and options enabling them can be +removed but do not need to be. There was no change in deserialization. + +To migrate from the standard library, the largest difference is that +`orjson.dumps` returns `bytes` and `json.dumps` returns a `str`. + +Users with `dict` objects using non-`str` keys should specify `option=orjson.OPT_NON_STR_KEYS`. + +`sort_keys` is replaced by `option=orjson.OPT_SORT_KEYS`. + +`indent` is replaced by `option=orjson.OPT_INDENT_2` and other levels of indentation are not +supported. + +`ensure_ascii` is probably not relevant today and UTF-8 characters cannot be +escaped to ASCII. + +### Serialize + +```python +def dumps( + __obj: Any, + default: Optional[Callable[[Any], Any]] = ..., + option: Optional[int] = ..., +) -> bytes: ... +``` + +`dumps()` serializes Python objects to JSON. + +It natively serializes +`str`, `dict`, `list`, `tuple`, `int`, `float`, `bool`, `None`, +`dataclasses.dataclass`, `typing.TypedDict`, `datetime.datetime`, +`datetime.date`, `datetime.time`, `uuid.UUID`, `numpy.ndarray`, and +`orjson.Fragment` instances. It supports arbitrary types through `default`. It +serializes subclasses of `str`, `int`, `dict`, `list`, +`dataclasses.dataclass`, and `enum.Enum`. It does not serialize subclasses +of `tuple` to avoid serializing `namedtuple` objects as arrays. To avoid +serializing subclasses, specify the option `orjson.OPT_PASSTHROUGH_SUBCLASS`. + +The output is a `bytes` object containing UTF-8. + +The global interpreter lock (GIL) is held for the duration of the call. + +It raises `JSONEncodeError` on an unsupported type. This exception message +describes the invalid object with the error message +`Type is not JSON serializable: ...`. To fix this, specify +[default](https://github.com/ijl/orjson?tab=readme-ov-file#default). + +It raises `JSONEncodeError` on a `str` that contains invalid UTF-8. + +It raises `JSONEncodeError` on an integer that exceeds 64 bits by default or, +with `OPT_STRICT_INTEGER`, 53 bits. + +It raises `JSONEncodeError` if a `dict` has a key of a type other than `str`, +unless `OPT_NON_STR_KEYS` is specified. + +It raises `JSONEncodeError` if the output of `default` recurses to handling by +`default` more than 254 levels deep. + +It raises `JSONEncodeError` on circular references. + +It raises `JSONEncodeError` if a `tzinfo` on a datetime object is +unsupported. + +`JSONEncodeError` is a subclass of `TypeError`. This is for compatibility +with the standard library. + +If the failure was caused by an exception in `default` then +`JSONEncodeError` chains the original exception as `__cause__`. + +#### default + +To serialize a subclass or arbitrary types, specify `default` as a +callable that returns a supported type. `default` may be a function, +lambda, or callable class instance. To specify that a type was not +handled by `default`, raise an exception such as `TypeError`. + +```python +>>> import orjson, decimal +>>> +def default(obj): + if isinstance(obj, decimal.Decimal): + return str(obj) + raise TypeError + +>>> orjson.dumps(decimal.Decimal("0.0842389659712649442845")) +JSONEncodeError: Type is not JSON serializable: decimal.Decimal +>>> orjson.dumps(decimal.Decimal("0.0842389659712649442845"), default=default) +b'"0.0842389659712649442845"' +>>> orjson.dumps({1, 2}, default=default) +orjson.JSONEncodeError: Type is not JSON serializable: set +``` + +The `default` callable may return an object that itself +must be handled by `default` up to 254 times before an exception +is raised. + +It is important that `default` raise an exception if a type cannot be handled. +Python otherwise implicitly returns `None`, which appears to the caller +like a legitimate value and is serialized: + +```python +>>> import orjson, json +>>> +def default(obj): + if isinstance(obj, decimal.Decimal): + return str(obj) + +>>> orjson.dumps({"set":{1, 2}}, default=default) +b'{"set":null}' +>>> json.dumps({"set":{1, 2}}, default=default) +'{"set":null}' +``` + +#### option + +To modify how data is serialized, specify `option`. Each `option` is an integer +constant in `orjson`. To specify multiple options, mask them together, e.g., +`option=orjson.OPT_STRICT_INTEGER | orjson.OPT_NAIVE_UTC`. + +##### OPT_APPEND_NEWLINE + +Append `\n` to the output. This is a convenience and optimization for the +pattern of `dumps(...) + "\n"`. `bytes` objects are immutable and this +pattern copies the original contents. + +```python +>>> import orjson +>>> orjson.dumps([]) +b"[]" +>>> orjson.dumps([], option=orjson.OPT_APPEND_NEWLINE) +b"[]\n" +``` + +##### OPT_INDENT_2 + +Pretty-print output with an indent of two spaces. This is equivalent to +`indent=2` in the standard library. Pretty printing is slower and the output +larger. This option is compatible with all other options. + +```python +>>> import orjson +>>> orjson.dumps({"a": "b", "c": {"d": True}, "e": [1, 2]}) +b'{"a":"b","c":{"d":true},"e":[1,2]}' +>>> orjson.dumps( + {"a": "b", "c": {"d": True}, "e": [1, 2]}, + option=orjson.OPT_INDENT_2 +) +b'{\n "a": "b",\n "c": {\n "d": true\n },\n "e": [\n 1,\n 2\n ]\n}' +``` + +If displayed, the indentation and linebreaks appear like this: + +```json +{ + "a": "b", + "c": { + "d": true + }, + "e": [ + 1, + 2 + ] +} +``` + +This measures serializing the github.json fixture as compact (52KiB) or +pretty (64KiB): + +| Library | compact (ms) | pretty (ms) | vs. orjson | +|-----------|----------------|---------------|--------------| +| orjson | 0.01 | 0.02 | 1 | +| json | 0.13 | 0.54 | 34 | + +This measures serializing the citm_catalog.json fixture, more of a worst +case due to the amount of nesting and newlines, as compact (489KiB) or +pretty (1.1MiB): + +| Library | compact (ms) | pretty (ms) | vs. orjson | +|-----------|----------------|---------------|--------------| +| orjson | 0.25 | 0.45 | 1 | +| json | 3.01 | 24.42 | 54.4 | + +This can be reproduced using the `pyindent` script. + +##### OPT_NAIVE_UTC + +Serialize `datetime.datetime` objects without a `tzinfo` as UTC. This +has no effect on `datetime.datetime` objects that have `tzinfo` set. + +```python +>>> import orjson, datetime +>>> orjson.dumps( + datetime.datetime(1970, 1, 1, 0, 0, 0), + ) +b'"1970-01-01T00:00:00"' +>>> orjson.dumps( + datetime.datetime(1970, 1, 1, 0, 0, 0), + option=orjson.OPT_NAIVE_UTC, + ) +b'"1970-01-01T00:00:00+00:00"' +``` + +##### OPT_NON_STR_KEYS + +Serialize `dict` keys of type other than `str`. This allows `dict` keys +to be one of `str`, `int`, `float`, `bool`, `None`, `datetime.datetime`, +`datetime.date`, `datetime.time`, `enum.Enum`, and `uuid.UUID`. For comparison, +the standard library serializes `str`, `int`, `float`, `bool` or `None` by +default. orjson benchmarks as being faster at serializing non-`str` keys +than other libraries. This option is slower for `str` keys than the default. + +```python +>>> import orjson, datetime, uuid +>>> orjson.dumps( + {uuid.UUID("7202d115-7ff3-4c81-a7c1-2a1f067b1ece"): [1, 2, 3]}, + option=orjson.OPT_NON_STR_KEYS, + ) +b'{"7202d115-7ff3-4c81-a7c1-2a1f067b1ece":[1,2,3]}' +>>> orjson.dumps( + {datetime.datetime(1970, 1, 1, 0, 0, 0): [1, 2, 3]}, + option=orjson.OPT_NON_STR_KEYS | orjson.OPT_NAIVE_UTC, + ) +b'{"1970-01-01T00:00:00+00:00":[1,2,3]}' +``` + +These types are generally serialized how they would be as +values, e.g., `datetime.datetime` is still an RFC 3339 string and respects +options affecting it. The exception is that `int` serialization does not +respect `OPT_STRICT_INTEGER`. + +This option has the risk of creating duplicate keys. This is because non-`str` +objects may serialize to the same `str` as an existing key, e.g., +`{"1": true, 1: false}`. The last key to be inserted to the `dict` will be +serialized last and a JSON deserializer will presumably take the last +occurrence of a key (in the above, `false`). The first value will be lost. + +This option is compatible with `orjson.OPT_SORT_KEYS`. If sorting is used, +note the sort is unstable and will be unpredictable for duplicate keys. + +```python +>>> import orjson, datetime +>>> orjson.dumps( + {"other": 1, datetime.date(1970, 1, 5): 2, datetime.date(1970, 1, 3): 3}, + option=orjson.OPT_NON_STR_KEYS | orjson.OPT_SORT_KEYS +) +b'{"1970-01-03":3,"1970-01-05":2,"other":1}' +``` + +This measures serializing 589KiB of JSON comprising a `list` of 100 `dict` +in which each `dict` has both 365 randomly-sorted `int` keys representing epoch +timestamps as well as one `str` key and the value for each key is a +single integer. In "str keys", the keys were converted to `str` before +serialization, and orjson still specifes `option=orjson.OPT_NON_STR_KEYS` +(which is always somewhat slower). + +| Library | str keys (ms) | int keys (ms) | int keys sorted (ms) | +|-----------|-----------------|-----------------|------------------------| +| orjson | 0.5 | 0.93 | 2.08 | +| json | 2.72 | 3.59 | | + +json is blank because it +raises `TypeError` on attempting to sort before converting all keys to `str`. +This can be reproduced using the `pynonstr` script. + +##### OPT_OMIT_MICROSECONDS + +Do not serialize the `microsecond` field on `datetime.datetime` and +`datetime.time` instances. + +```python +>>> import orjson, datetime +>>> orjson.dumps( + datetime.datetime(1970, 1, 1, 0, 0, 0, 1), + ) +b'"1970-01-01T00:00:00.000001"' +>>> orjson.dumps( + datetime.datetime(1970, 1, 1, 0, 0, 0, 1), + option=orjson.OPT_OMIT_MICROSECONDS, + ) +b'"1970-01-01T00:00:00"' +``` + +##### OPT_PASSTHROUGH_DATACLASS + +Passthrough `dataclasses.dataclass` instances to `default`. This allows +customizing their output but is much slower. + + +```python +>>> import orjson, dataclasses +>>> +@dataclasses.dataclass +class User: + id: str + name: str + password: str + +def default(obj): + if isinstance(obj, User): + return {"id": obj.id, "name": obj.name} + raise TypeError + +>>> orjson.dumps(User("3b1", "asd", "zxc")) +b'{"id":"3b1","name":"asd","password":"zxc"}' +>>> orjson.dumps(User("3b1", "asd", "zxc"), option=orjson.OPT_PASSTHROUGH_DATACLASS) +TypeError: Type is not JSON serializable: User +>>> orjson.dumps( + User("3b1", "asd", "zxc"), + option=orjson.OPT_PASSTHROUGH_DATACLASS, + default=default, + ) +b'{"id":"3b1","name":"asd"}' +``` + +##### OPT_PASSTHROUGH_DATETIME + +Passthrough `datetime.datetime`, `datetime.date`, and `datetime.time` instances +to `default`. This allows serializing datetimes to a custom format, e.g., +HTTP dates: + +```python +>>> import orjson, datetime +>>> +def default(obj): + if isinstance(obj, datetime.datetime): + return obj.strftime("%a, %d %b %Y %H:%M:%S GMT") + raise TypeError + +>>> orjson.dumps({"created_at": datetime.datetime(1970, 1, 1)}) +b'{"created_at":"1970-01-01T00:00:00"}' +>>> orjson.dumps({"created_at": datetime.datetime(1970, 1, 1)}, option=orjson.OPT_PASSTHROUGH_DATETIME) +TypeError: Type is not JSON serializable: datetime.datetime +>>> orjson.dumps( + {"created_at": datetime.datetime(1970, 1, 1)}, + option=orjson.OPT_PASSTHROUGH_DATETIME, + default=default, + ) +b'{"created_at":"Thu, 01 Jan 1970 00:00:00 GMT"}' +``` + +This does not affect datetimes in `dict` keys if using OPT_NON_STR_KEYS. + +##### OPT_PASSTHROUGH_SUBCLASS + +Passthrough subclasses of builtin types to `default`. + +```python +>>> import orjson +>>> +class Secret(str): + pass + +def default(obj): + if isinstance(obj, Secret): + return "******" + raise TypeError + +>>> orjson.dumps(Secret("zxc")) +b'"zxc"' +>>> orjson.dumps(Secret("zxc"), option=orjson.OPT_PASSTHROUGH_SUBCLASS) +TypeError: Type is not JSON serializable: Secret +>>> orjson.dumps(Secret("zxc"), option=orjson.OPT_PASSTHROUGH_SUBCLASS, default=default) +b'"******"' +``` + +This does not affect serializing subclasses as `dict` keys if using +OPT_NON_STR_KEYS. + +##### OPT_SERIALIZE_DATACLASS + +This is deprecated and has no effect in version 3. In version 2 this was +required to serialize `dataclasses.dataclass` instances. For more, see +[dataclass](https://github.com/ijl/orjson?tab=readme-ov-file#dataclass). + +##### OPT_SERIALIZE_NUMPY + +Serialize `numpy.ndarray` instances. For more, see +[numpy](https://github.com/ijl/orjson?tab=readme-ov-file#numpy). + +##### OPT_SERIALIZE_UUID + +This is deprecated and has no effect in version 3. In version 2 this was +required to serialize `uuid.UUID` instances. For more, see +[UUID](https://github.com/ijl/orjson?tab=readme-ov-file#UUID). + +##### OPT_SORT_KEYS + +Serialize `dict` keys in sorted order. The default is to serialize in an +unspecified order. This is equivalent to `sort_keys=True` in the standard +library. + +This can be used to ensure the order is deterministic for hashing or tests. +It has a substantial performance penalty and is not recommended in general. + +```python +>>> import orjson +>>> orjson.dumps({"b": 1, "c": 2, "a": 3}) +b'{"b":1,"c":2,"a":3}' +>>> orjson.dumps({"b": 1, "c": 2, "a": 3}, option=orjson.OPT_SORT_KEYS) +b'{"a":3,"b":1,"c":2}' +``` + +This measures serializing the twitter.json fixture unsorted and sorted: + +| Library | unsorted (ms) | sorted (ms) | vs. orjson | +|-----------|-----------------|---------------|--------------| +| orjson | 0.11 | 0.3 | 1 | +| json | 1.36 | 1.93 | 6.4 | + +The benchmark can be reproduced using the `pysort` script. + +The sorting is not collation/locale-aware: + +```python +>>> import orjson +>>> orjson.dumps({"a": 1, "ä": 2, "A": 3}, option=orjson.OPT_SORT_KEYS) +b'{"A":3,"a":1,"\xc3\xa4":2}' +``` + +This is the same sorting behavior as the standard library. + +`dataclass` also serialize as maps but this has no effect on them. + +##### OPT_STRICT_INTEGER + +Enforce 53-bit limit on integers. The limit is otherwise 64 bits, the same as +the Python standard library. For more, see [int](https://github.com/ijl/orjson?tab=readme-ov-file#int). + +##### OPT_UTC_Z + +Serialize a UTC timezone on `datetime.datetime` instances as `Z` instead +of `+00:00`. + +```python +>>> import orjson, datetime, zoneinfo +>>> orjson.dumps( + datetime.datetime(1970, 1, 1, 0, 0, 0, tzinfo=zoneinfo.ZoneInfo("UTC")), + ) +b'"1970-01-01T00:00:00+00:00"' +>>> orjson.dumps( + datetime.datetime(1970, 1, 1, 0, 0, 0, tzinfo=zoneinfo.ZoneInfo("UTC")), + option=orjson.OPT_UTC_Z + ) +b'"1970-01-01T00:00:00Z"' +``` + +#### Fragment + +`orjson.Fragment` includes already-serialized JSON in a document. This is an +efficient way to include JSON blobs from a cache, JSONB field, or separately +serialized object without first deserializing to Python objects via `loads()`. + +```python +>>> import orjson +>>> orjson.dumps({"key": "zxc", "data": orjson.Fragment(b'{"a": "b", "c": 1}')}) +b'{"key":"zxc","data":{"a": "b", "c": 1}}' +``` + +It does no reformatting: `orjson.OPT_INDENT_2` will not affect a +compact blob nor will a pretty-printed JSON blob be rewritten as compact. + +The input must be `bytes` or `str` and given as a positional argument. + +This raises `orjson.JSONEncodeError` if a `str` is given and the input is +not valid UTF-8. It otherwise does no validation and it is possible to +write invalid JSON. This does not escape characters. The implementation is +tested to not crash if given invalid strings or invalid JSON. + +### Deserialize + +```python +def loads(__obj: Union[bytes, bytearray, memoryview, str]) -> Any: ... +``` + +`loads()` deserializes JSON to Python objects. It deserializes to `dict`, +`list`, `int`, `float`, `str`, `bool`, and `None` objects. + +`bytes`, `bytearray`, `memoryview`, and `str` input are accepted. If the input +exists as a `memoryview`, `bytearray`, or `bytes` object, it is recommended to +pass these directly rather than creating an unnecessary `str` object. That is, +`orjson.loads(b"{}")` instead of `orjson.loads(b"{}".decode("utf-8"))`. This +has lower memory usage and lower latency. + +The input must be valid UTF-8. + +orjson maintains a cache of map keys for the duration of the process. This +causes a net reduction in memory usage by avoiding duplicate strings. The +keys must be at most 64 bytes to be cached and 2048 entries are stored. + +The global interpreter lock (GIL) is held for the duration of the call. + +It raises `JSONDecodeError` if given an invalid type or invalid +JSON. This includes if the input contains `NaN`, `Infinity`, or `-Infinity`, +which the standard library allows, but is not valid JSON. + +It raises `JSONDecodeError` if a combination of array or object recurses +1024 levels deep. + +It raises `JSONDecodeError` if unable to allocate a buffer large enough +to parse the document. + +`JSONDecodeError` is a subclass of `json.JSONDecodeError` and `ValueError`. +This is for compatibility with the standard library. + +## Types + +### dataclass + +orjson serializes instances of `dataclasses.dataclass` natively. It serializes +instances 40-50x as fast as other libraries and avoids a severe slowdown seen +in other libraries compared to serializing `dict`. + +It is supported to pass all variants of dataclasses, including dataclasses +using `__slots__`, frozen dataclasses, those with optional or default +attributes, and subclasses. There is a performance benefit to not +using `__slots__`. + +| Library | dict (ms) | dataclass (ms) | vs. orjson | +|-----------|-------------|------------------|--------------| +| orjson | 0.43 | 0.95 | 1 | +| json | 5.81 | 38.32 | 40 | + +This measures serializing 555KiB of JSON, orjson natively and other libraries +using `default` to serialize the output of `dataclasses.asdict()`. This can be +reproduced using the `pydataclass` script. + +Dataclasses are serialized as maps, with every attribute serialized and in +the order given on class definition: + +```python +>>> import dataclasses, orjson, typing + +@dataclasses.dataclass +class Member: + id: int + active: bool = dataclasses.field(default=False) + +@dataclasses.dataclass +class Object: + id: int + name: str + members: typing.List[Member] + +>>> orjson.dumps(Object(1, "a", [Member(1, True), Member(2)])) +b'{"id":1,"name":"a","members":[{"id":1,"active":true},{"id":2,"active":false}]}' +``` + +### datetime + +orjson serializes `datetime.datetime` objects to +[RFC 3339](https://tools.ietf.org/html/rfc3339) format, +e.g., "1970-01-01T00:00:00+00:00". This is a subset of ISO 8601 and is +compatible with `isoformat()` in the standard library. + +```python +>>> import orjson, datetime, zoneinfo +>>> orjson.dumps( + datetime.datetime(2018, 12, 1, 2, 3, 4, 9, tzinfo=zoneinfo.ZoneInfo("Australia/Adelaide")) +) +b'"2018-12-01T02:03:04.000009+10:30"' +>>> orjson.dumps( + datetime.datetime(2100, 9, 1, 21, 55, 2).replace(tzinfo=zoneinfo.ZoneInfo("UTC")) +) +b'"2100-09-01T21:55:02+00:00"' +>>> orjson.dumps( + datetime.datetime(2100, 9, 1, 21, 55, 2) +) +b'"2100-09-01T21:55:02"' +``` + +`datetime.datetime` supports instances with a `tzinfo` that is `None`, +`datetime.timezone.utc`, a timezone instance from the standard library `zoneinfo` +module, or a timezone instance from the third-party `pendulum`, `pytz`, or +`dateutil`/`arrow` libraries. + +It is fastest to use the standard library's `zoneinfo.ZoneInfo` for timezones. + +`datetime.time` objects must not have a `tzinfo`. + +```python +>>> import orjson, datetime +>>> orjson.dumps(datetime.time(12, 0, 15, 290)) +b'"12:00:15.000290"' +``` + +`datetime.date` objects will always serialize. + +```python +>>> import orjson, datetime +>>> orjson.dumps(datetime.date(1900, 1, 2)) +b'"1900-01-02"' +``` + +Errors with `tzinfo` result in `JSONEncodeError` being raised. + +To disable serialization of `datetime` objects specify the option +`orjson.OPT_PASSTHROUGH_DATETIME`. + +To use "Z" suffix instead of "+00:00" to indicate UTC ("Zulu") time, use the option +`orjson.OPT_UTC_Z`. + +To assume datetimes without timezone are UTC, use the option `orjson.OPT_NAIVE_UTC`. + +### enum + +orjson serializes enums natively. Options apply to their values. + +```python +>>> import enum, datetime, orjson +>>> +class DatetimeEnum(enum.Enum): + EPOCH = datetime.datetime(1970, 1, 1, 0, 0, 0) +>>> orjson.dumps(DatetimeEnum.EPOCH) +b'"1970-01-01T00:00:00"' +>>> orjson.dumps(DatetimeEnum.EPOCH, option=orjson.OPT_NAIVE_UTC) +b'"1970-01-01T00:00:00+00:00"' +``` + +Enums with members that are not supported types can be serialized using +`default`: + +```python +>>> import enum, orjson +>>> +class Custom: + def __init__(self, val): + self.val = val + +def default(obj): + if isinstance(obj, Custom): + return obj.val + raise TypeError + +class CustomEnum(enum.Enum): + ONE = Custom(1) + +>>> orjson.dumps(CustomEnum.ONE, default=default) +b'1' +``` + +### float + +orjson serializes and deserializes double precision floats with no loss of +precision and consistent rounding. + +`orjson.dumps()` serializes Nan, Infinity, and -Infinity, which are not +compliant JSON, as `null`: + +```python +>>> import orjson, json +>>> orjson.dumps([float("NaN"), float("Infinity"), float("-Infinity")]) +b'[null,null,null]' +>>> json.dumps([float("NaN"), float("Infinity"), float("-Infinity")]) +'[NaN, Infinity, -Infinity]' +``` + +### int + +orjson serializes and deserializes 64-bit integers by default. The range +supported is a signed 64-bit integer's minimum (-9223372036854775807) to +an unsigned 64-bit integer's maximum (18446744073709551615). This +is widely compatible, but there are implementations +that only support 53-bits for integers, e.g., +web browsers. For those implementations, `dumps()` can be configured to +raise a `JSONEncodeError` on values exceeding the 53-bit range. + +```python +>>> import orjson +>>> orjson.dumps(9007199254740992) +b'9007199254740992' +>>> orjson.dumps(9007199254740992, option=orjson.OPT_STRICT_INTEGER) +JSONEncodeError: Integer exceeds 53-bit range +>>> orjson.dumps(-9007199254740992, option=orjson.OPT_STRICT_INTEGER) +JSONEncodeError: Integer exceeds 53-bit range +``` + +### numpy + +orjson natively serializes `numpy.ndarray` and individual +`numpy.float64`, `numpy.float32`, `numpy.float16` (`numpy.half`), +`numpy.int64`, `numpy.int32`, `numpy.int16`, `numpy.int8`, +`numpy.uint64`, `numpy.uint32`, `numpy.uint16`, `numpy.uint8`, +`numpy.uintp`, `numpy.intp`, `numpy.datetime64`, and `numpy.bool` +instances. + +orjson is compatible with both numpy v1 and v2. + +orjson is faster than all compared libraries at serializing +numpy instances. Serializing numpy data requires specifying +`option=orjson.OPT_SERIALIZE_NUMPY`. + +```python +>>> import orjson, numpy +>>> orjson.dumps( + numpy.array([[1, 2, 3], [4, 5, 6]]), + option=orjson.OPT_SERIALIZE_NUMPY, +) +b'[[1,2,3],[4,5,6]]' +``` + +The array must be a contiguous C array (`C_CONTIGUOUS`) and one of the +supported datatypes. + +Note a difference between serializing `numpy.float32` using `ndarray.tolist()` +or `orjson.dumps(..., option=orjson.OPT_SERIALIZE_NUMPY)`: `tolist()` converts +to a `double` before serializing and orjson's native path does not. This +can result in different rounding. + +`numpy.datetime64` instances are serialized as RFC 3339 strings and +datetime options affect them. + +```python +>>> import orjson, numpy +>>> orjson.dumps( + numpy.datetime64("2021-01-01T00:00:00.172"), + option=orjson.OPT_SERIALIZE_NUMPY, +) +b'"2021-01-01T00:00:00.172000"' +>>> orjson.dumps( + numpy.datetime64("2021-01-01T00:00:00.172"), + option=( + orjson.OPT_SERIALIZE_NUMPY | + orjson.OPT_NAIVE_UTC | + orjson.OPT_OMIT_MICROSECONDS + ), +) +b'"2021-01-01T00:00:00+00:00"' +``` + +If an array is not a contiguous C array, contains an unsupported datatype, +or contains a `numpy.datetime64` using an unsupported representation +(e.g., picoseconds), orjson falls through to `default`. In `default`, +`obj.tolist()` can be specified. + +If an array is not in the native endianness, e.g., an array of big-endian values +on a little-endian system, `orjson.JSONEncodeError` is raised. + +If an array is malformed, `orjson.JSONEncodeError` is raised. + +This measures serializing 92MiB of JSON from an `numpy.ndarray` with +dimensions of `(50000, 100)` and `numpy.float64` values: + +| Library | Latency (ms) | RSS diff (MiB) | vs. orjson | +|-----------|----------------|------------------|--------------| +| orjson | 105 | 105 | 1 | +| json | 1,481 | 295 | 14.2 | + +This measures serializing 100MiB of JSON from an `numpy.ndarray` with +dimensions of `(100000, 100)` and `numpy.int32` values: + +| Library | Latency (ms) | RSS diff (MiB) | vs. orjson | +|-----------|----------------|------------------|--------------| +| orjson | 68 | 119 | 1 | +| json | 684 | 501 | 10.1 | + +This measures serializing 105MiB of JSON from an `numpy.ndarray` with +dimensions of `(100000, 200)` and `numpy.bool` values: + +| Library | Latency (ms) | RSS diff (MiB) | vs. orjson | +|-----------|----------------|------------------|--------------| +| orjson | 50 | 125 | 1 | +| json | 573 | 398 | 11.5 | + +In these benchmarks, orjson serializes natively and `json` serializes +`ndarray.tolist()` via `default`. The RSS column measures peak memory +usage during serialization. This can be reproduced using the `pynumpy` script. + +orjson does not have an installation or compilation dependency on numpy. The +implementation is independent, reading `numpy.ndarray` using +`PyArrayInterface`. + +### str + +orjson is strict about UTF-8 conformance. This is stricter than the standard +library's json module, which will serialize and deserialize UTF-16 surrogates, +e.g., "\ud800", that are invalid UTF-8. + +If `orjson.dumps()` is given a `str` that does not contain valid UTF-8, +`orjson.JSONEncodeError` is raised. If `loads()` receives invalid UTF-8, +`orjson.JSONDecodeError` is raised. + +```python +>>> import orjson, json +>>> orjson.dumps('\ud800') +JSONEncodeError: str is not valid UTF-8: surrogates not allowed +>>> json.dumps('\ud800') +'"\\ud800"' +>>> orjson.loads('"\\ud800"') +JSONDecodeError: unexpected end of hex escape at line 1 column 8: line 1 column 1 (char 0) +>>> json.loads('"\\ud800"') +'\ud800' +``` + +To make a best effort at deserializing bad input, first decode `bytes` using +the `replace` or `lossy` argument for `errors`: + +```python +>>> import orjson +>>> orjson.loads(b'"\xed\xa0\x80"') +JSONDecodeError: str is not valid UTF-8: surrogates not allowed +>>> orjson.loads(b'"\xed\xa0\x80"'.decode("utf-8", "replace")) +'���' +``` + +### uuid + +orjson serializes `uuid.UUID` instances to +[RFC 4122](https://tools.ietf.org/html/rfc4122) format, e.g., +"f81d4fae-7dec-11d0-a765-00a0c91e6bf6". + +``` python +>>> import orjson, uuid +>>> orjson.dumps(uuid.uuid5(uuid.NAMESPACE_DNS, "python.org")) +b'"886313e1-3b8a-5372-9b90-0c9aee199e5d"' +``` + +## Testing + +The library has comprehensive tests. There are tests against fixtures in the +[JSONTestSuite](https://github.com/nst/JSONTestSuite) and +[nativejson-benchmark](https://github.com/miloyip/nativejson-benchmark) +repositories. It is tested to not crash against the +[Big List of Naughty Strings](https://github.com/minimaxir/big-list-of-naughty-strings). +It is tested to not leak memory. It is tested to not crash +against and not accept invalid UTF-8. There are integration tests +exercising the library's use in web servers (gunicorn using multiprocess/forked +workers) and when multithreaded. + +orjson is the most correct of the compared libraries. This graph shows how each +library handles a combined 342 JSON fixtures from the +[JSONTestSuite](https://github.com/nst/JSONTestSuite) and +[nativejson-benchmark](https://github.com/miloyip/nativejson-benchmark) tests: + +| Library | Invalid JSON documents not rejected | Valid JSON documents not deserialized | +|------------|---------------------------------------|-----------------------------------------| +| orjson | 0 | 0 | +| json | 17 | 0 | + +This shows that all libraries deserialize valid JSON but only orjson +correctly rejects the given invalid JSON fixtures. Errors are largely due to +accepting invalid strings and numbers. + +The graph above can be reproduced using the `pycorrectness` script. + +## Performance + +Serialization and deserialization performance of orjson is consistently better +than the standard library's `json`. The graphs below illustrate a few commonly +used documents. + +### Latency + +![Serialization](doc/serialization.png) + +![Deserialization](doc/deserialization.png) + +#### twitter.json serialization + +| Library | Median latency (milliseconds) | Operations per second | Relative (latency) | +|-----------|---------------------------------|-------------------------|----------------------| +| orjson | 0.1 | 8453 | 1 | +| json | 1.3 | 765 | 11.1 | + +#### twitter.json deserialization + +| Library | Median latency (milliseconds) | Operations per second | Relative (latency) | +|-----------|---------------------------------|-------------------------|----------------------| +| orjson | 0.5 | 1889 | 1 | +| json | 2.2 | 453 | 4.2 | + +#### github.json serialization + +| Library | Median latency (milliseconds) | Operations per second | Relative (latency) | +|-----------|---------------------------------|-------------------------|----------------------| +| orjson | 0.01 | 103693 | 1 | +| json | 0.13 | 7648 | 13.6 | + +#### github.json deserialization + +| Library | Median latency (milliseconds) | Operations per second | Relative (latency) | +|-----------|---------------------------------|-------------------------|----------------------| +| orjson | 0.04 | 23264 | 1 | +| json | 0.1 | 10430 | 2.2 | + +#### citm_catalog.json serialization + +| Library | Median latency (milliseconds) | Operations per second | Relative (latency) | +|-----------|---------------------------------|-------------------------|----------------------| +| orjson | 0.3 | 3975 | 1 | +| json | 3 | 338 | 11.8 | + +#### citm_catalog.json deserialization + +| Library | Median latency (milliseconds) | Operations per second | Relative (latency) | +|-----------|---------------------------------|-------------------------|----------------------| +| orjson | 1.3 | 781 | 1 | +| json | 4 | 250 | 3.1 | + +#### canada.json serialization + +| Library | Median latency (milliseconds) | Operations per second | Relative (latency) | +|-----------|---------------------------------|-------------------------|----------------------| +| orjson | 2.5 | 399 | 1 | +| json | 29.8 | 33 | 11.9 | + +#### canada.json deserialization + +| Library | Median latency (milliseconds) | Operations per second | Relative (latency) | +|-----------|---------------------------------|-------------------------|----------------------| +| orjson | 3 | 333 | 1 | +| json | 18 | 55 | 6 | + +### Reproducing + +The above was measured using Python 3.11.10 in a Fedora 42 container on an +x86-64-v4 machine using the +`orjson-3.10.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl` +artifact on PyPI. The latency results can be reproduced using the `pybench` script. + +## Questions + +### Will it deserialize to dataclasses, UUIDs, decimals, etc or support object_hook? + +No. This requires a schema specifying what types are expected and how to +handle errors etc. This is addressed by data validation libraries a +level above this. + +### Will it serialize to `str`? + +No. `bytes` is the correct type for a serialized blob. + +### Will it support NDJSON or JSONL? + +No. [orjsonl](https://github.com/umarbutler/orjsonl) may be appropriate. + +### Will it support JSON5 or RJSON? + +No, it supports RFC 8259. + +### How do I depend on orjson in a Rust project? + +orjson is only shipped as a Python module. The project should depend on +`orjson` in its own Python requirements and should obtain pointers to +functions and objects using the normal `PyImport_*` APIs. + +## Packaging + +To package orjson requires at least [Rust](https://www.rust-lang.org/) 1.89, +a C compiler, and the [maturin](https://github.com/PyO3/maturin) build tool. +The recommended build command is: + +```sh +maturin build --release --strip +``` + +The project's own CI tests against `nightly-2026-03-28` and stable 1.89. It +is prudent to pin the nightly version because that channel can introduce +breaking changes. There is a significant performance benefit to using +nightly. + +orjson is tested on native hardware for amd64, aarch64, and i686 on Linux. It is +cross-compiled and may be tested via emulation for arm7, ppc64le, and s390x. It +is tested for aarch64 on macOS and cross-compiles for amd64. For +Windows it is tested on amd64, i686, and aarch64. + +There are no runtime dependencies other than libc. + +The source distribution on PyPI contains all dependencies' source and can be +built without network access. The file can be downloaded from +`https://files.pythonhosted.org/packages/source/o/orjson/orjson-${version}.tar.gz`. + +orjson's tests are included in the source distribution on PyPI. The tests +require only `pytest`. There are optional packages such as `pytz` and `numpy` +listed in `test/requirements.txt` and used in ~10% of tests. Not having these +dependencies causes the tests needing them to skip. Tests can be run +with `pytest -q test`. + +## License + +orjson was written by ijl <>, copyright 2018 - 2026, with +some source files available under the Mozilla Public License 2.0 and some +available under your choice of the Apache 2 license or MIT license. + diff --git a/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/RECORD b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..bd6ffd3c6300916891be21a82542c56e915427c3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/RECORD @@ -0,0 +1,13 @@ +orjson-3.11.8.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +orjson-3.11.8.dist-info/METADATA,sha256=d-kgyd2hdL8p_n5YPq0WcJJ9KSiSgMPEiIn5AMX3sOs,41968 +orjson-3.11.8.dist-info/RECORD,, +orjson-3.11.8.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +orjson-3.11.8.dist-info/WHEEL,sha256=vyzG7zerSjHR75zGeakXlWawUhyGGRR6axMIY4PfGBg,147 +orjson-3.11.8.dist-info/licenses/LICENSE-APACHE,sha256=pg7qgXUUUxZo1-AHZXMUSf4U0FnTJJ4LyTs23kX3WfI,10847 +orjson-3.11.8.dist-info/licenses/LICENSE-MIT,sha256=I_GOA9xJ35FiL-KnYXZJdATkbO2KcV2dK2enRGVxzKM,1023 +orjson-3.11.8.dist-info/licenses/LICENSE-MPL-2.0,sha256=ZqMQfVrWoFiqt1PqrCBHzLLtDjlGXdD-WETaPjANUXI,16727 +orjson-3.11.8.dist-info/sboms/orjson.cyclonedx.json,sha256=GQTeUUmZ4pSnwIP54L3V5R5fUGmG0tkx5EkZ7BawnuI,28673 +orjson/__init__.py,sha256=ejoFsSgbZapQVMNTh_vlvJkwW_lLnsd3SmzUpvWxSPU,693 +orjson/__init__.pyi,sha256=ApTAgpg75i1fKjyi5QwAkB2eP0w73IJFNaqKSx70ASE,876 +orjson/orjson.cpython-310-x86_64-linux-gnu.so,sha256=Tm07-EvyQ0zO1sEGDLv9w6p5_pgaeXE_zUUIz1-Mp74,247104 +orjson/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/REQUESTED b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/WHEEL b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..59fc0f36d7f2f5916cd06cb0813b9e05991c36d4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: maturin (1.12.6) +Root-Is-Purelib: false +Tag: cp310-cp310-manylinux_2_17_x86_64 +Tag: cp310-cp310-manylinux2014_x86_64 diff --git a/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/licenses/LICENSE-APACHE b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/licenses/LICENSE-APACHE new file mode 100644 index 0000000000000000000000000000000000000000..16fe87b06e802f094b3fbb0894b137bca2b16ef1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/licenses/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/licenses/LICENSE-MIT b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/licenses/LICENSE-MIT new file mode 100644 index 0000000000000000000000000000000000000000..31aa79387f27e730e33d871925e152e35e428031 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/licenses/LICENSE-MIT @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/licenses/LICENSE-MPL-2.0 b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/licenses/LICENSE-MPL-2.0 new file mode 100644 index 0000000000000000000000000000000000000000..ee6256cdb62a765749a71aae3abea32884301cd1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/licenses/LICENSE-MPL-2.0 @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/sboms/orjson.cyclonedx.json b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/sboms/orjson.cyclonedx.json new file mode 100644 index 0000000000000000000000000000000000000000..0636ea406f0354175430bab1b2fbfda8b85c6ce1 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/orjson-3.11.8.dist-info/sboms/orjson.cyclonedx.json @@ -0,0 +1,943 @@ +{ + "bomFormat": "CycloneDX", + "specVersion": "1.5", + "version": 1, + "serialNumber": "urn:uuid:4ffb57df-71c8-42ab-88dc-c93f3c92911f", + "metadata": { + "timestamp": "2026-03-31T16:02:20.060771077Z", + "tools": [ + { + "vendor": "CycloneDX", + "name": "cargo-cyclonedx", + "version": "0.5.7" + } + ], + "authors": [ + { + "name": "ijl", + "email": "ijl@mailbox.org" + } + ], + "component": { + "type": "library", + "bom-ref": "path+file:///__w/orjson/orjson#3.11.8", + "author": "ijl ", + "name": "orjson", + "version": "3.11.8", + "description": "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy", + "scope": "required", + "licenses": [ + { + "expression": "MPL-2.0 AND (Apache-2.0 OR MIT)" + } + ], + "purl": "pkg:cargo/orjson@3.11.8?download_url=file://.", + "externalReferences": [ + { + "type": "vcs", + "url": "https://github.com/ijl/orjson" + } + ], + "components": [ + { + "type": "library", + "bom-ref": "path+file:///__w/orjson/orjson#3.11.8 bin-target-0", + "name": "orjson", + "version": "3.11.8", + "purl": "pkg:cargo/orjson@3.11.8?download_url=file://.#src/lib.rs" + } + ] + }, + "properties": [ + { + "name": "cdx:rustc:sbom:target:all_targets", + "value": "true" + } + ] + }, + "components": [ + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#associative-cache@3.0.0", + "author": "Nick Fitzgerald ", + "name": "associative-cache", + "version": "3.0.0", + "description": "A generic N-way associative cache with fixed-size capacity and random or least recently used (LRU) replacement.", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "6104bd6fd778b62f638add0dd848dca9887cf016a343d15a21d27fb8a3965b98" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/associative-cache@3.0.0", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/associative-cache" + }, + { + "type": "vcs", + "url": "https://github.com/fitzgen/associative-cache" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#bytecount@0.6.9", + "author": "Andre Bogus , Joshua Landau ", + "name": "bytecount", + "version": "0.6.9", + "description": "count occurrences of a given byte, or the number of UTF-8 code points, in a byte slice, fast", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" + } + ], + "licenses": [ + { + "expression": "Apache-2.0 OR MIT" + } + ], + "purl": "pkg:cargo/bytecount@0.6.9", + "externalReferences": [ + { + "type": "vcs", + "url": "https://github.com/llogiq/bytecount" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#bytes@1.11.1", + "author": "Carl Lerche , Sean McArthur ", + "name": "bytes", + "version": "1.11.1", + "description": "Types and traits for working with bytes", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + } + ], + "licenses": [ + { + "expression": "MIT" + } + ], + "purl": "pkg:cargo/bytes@1.11.1", + "externalReferences": [ + { + "type": "vcs", + "url": "https://github.com/tokio-rs/bytes" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#cc@1.2.58", + "author": "Alex Crichton ", + "name": "cc", + "version": "1.2.58", + "description": "A build-time dependency for Cargo build scripts to assist in invoking the native C compiler to compile native C code into a static archive to be linked into Rust code. ", + "scope": "excluded", + "hashes": [ + { + "alg": "SHA-256", + "content": "e1e928d4b69e3077709075a938a05ffbedfa53a84c8f766efbf8220bb1ff60e1" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/cc@1.2.58", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/cc" + }, + { + "type": "website", + "url": "https://github.com/rust-lang/cc-rs" + }, + { + "type": "vcs", + "url": "https://github.com/rust-lang/cc-rs" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#cfg-if@1.0.4", + "author": "Alex Crichton ", + "name": "cfg-if", + "version": "1.0.4", + "description": "A macro to ergonomically define an item depending on a large number of #[cfg] parameters. Structured like an if-else chain, the first matching branch is the item that gets emitted. ", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/cfg-if@1.0.4", + "externalReferences": [ + { + "type": "vcs", + "url": "https://github.com/rust-lang/cfg-if" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#encoding_rs@0.8.35", + "author": "Henri Sivonen ", + "name": "encoding_rs", + "version": "0.8.35", + "description": "A Gecko-oriented implementation of the Encoding Standard", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" + } + ], + "licenses": [ + { + "expression": "(Apache-2.0 OR MIT) AND BSD-3-Clause" + } + ], + "purl": "pkg:cargo/encoding_rs@0.8.35", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/encoding_rs/" + }, + { + "type": "website", + "url": "https://docs.rs/encoding_rs/" + }, + { + "type": "vcs", + "url": "https://github.com/hsivonen/encoding_rs" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#find-msvc-tools@0.1.9", + "name": "find-msvc-tools", + "version": "0.1.9", + "description": "Find windows-specific tools, read MSVC versions from the registry and from COM interfaces", + "scope": "excluded", + "hashes": [ + { + "alg": "SHA-256", + "content": "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/find-msvc-tools@0.1.9", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/find-msvc-tools" + }, + { + "type": "vcs", + "url": "https://github.com/rust-lang/cc-rs" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#itoa@1.0.18", + "author": "David Tolnay ", + "name": "itoa", + "version": "1.0.18", + "description": "Fast integer primitive to string conversion", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/itoa@1.0.18", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/itoa" + }, + { + "type": "vcs", + "url": "https://github.com/dtolnay/itoa" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#itoap@1.0.1", + "author": "Ryohei Machida ", + "name": "itoap", + "version": "1.0.1", + "description": "Even faster functions for printing integers with decimal format", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "9028f49264629065d057f340a86acb84867925865f73bbf8d47b4d149a7e88b8" + } + ], + "licenses": [ + { + "expression": "MIT" + } + ], + "purl": "pkg:cargo/itoap@1.0.1", + "externalReferences": [ + { + "type": "website", + "url": "https://github.com/Kogia-sima/itoap" + }, + { + "type": "vcs", + "url": "https://github.com/Kogia-sima/itoap" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#jiff@0.2.23", + "author": "Andrew Gallant ", + "name": "jiff", + "version": "0.2.23", + "description": "A date-time library that encourages you to jump into the pit of success. This library is heavily inspired by the Temporal project. ", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "1a3546dc96b6d42c5f24902af9e2538e82e39ad350b0c766eb3fbf2d8f3d8359" + } + ], + "licenses": [ + { + "expression": "Unlicense OR MIT" + } + ], + "purl": "pkg:cargo/jiff@0.2.23", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/jiff" + }, + { + "type": "vcs", + "url": "https://github.com/BurntSushi/jiff" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#libc@0.2.183", + "author": "The Rust Project Developers", + "name": "libc", + "version": "0.2.183", + "description": "Raw FFI bindings to platform libraries like libc.", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/libc@0.2.183", + "externalReferences": [ + { + "type": "vcs", + "url": "https://github.com/rust-lang/libc" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#memchr@2.8.0", + "author": "Andrew Gallant , bluss", + "name": "memchr", + "version": "2.8.0", + "description": "Provides extremely fast (uses SIMD on x86_64, aarch64 and wasm32) routines for 1, 2 or 3 byte search and single substring search. ", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + } + ], + "licenses": [ + { + "expression": "Unlicense OR MIT" + } + ], + "purl": "pkg:cargo/memchr@2.8.0", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/memchr/" + }, + { + "type": "website", + "url": "https://github.com/BurntSushi/memchr" + }, + { + "type": "vcs", + "url": "https://github.com/BurntSushi/memchr" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#once_cell@1.21.4", + "author": "Aleksey Kladov ", + "name": "once_cell", + "version": "1.21.4", + "description": "Single assignment cells and lazy values.", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/once_cell@1.21.4", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/once_cell" + }, + { + "type": "vcs", + "url": "https://github.com/matklad/once_cell" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#pyo3-build-config@0.28.2", + "author": "PyO3 Project and Contributors ", + "name": "pyo3-build-config", + "version": "0.28.2", + "description": "Build configuration for the PyO3 ecosystem", + "scope": "excluded", + "hashes": [ + { + "alg": "SHA-256", + "content": "8bf94ee265674bf76c09fa430b0e99c26e319c945d96ca0d5a8215f31bf81cf7" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/pyo3-build-config@0.28.2", + "externalReferences": [ + { + "type": "website", + "url": "https://github.com/pyo3/pyo3" + }, + { + "type": "vcs", + "url": "https://github.com/pyo3/pyo3" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#pyo3-ffi@0.28.2", + "author": "PyO3 Project and Contributors ", + "name": "pyo3-ffi", + "version": "0.28.2", + "description": "Python-API bindings for the PyO3 ecosystem", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "491aa5fc66d8059dd44a75f4580a2962c1862a1c2945359db36f6c2818b748dc" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/pyo3-ffi@0.28.2", + "externalReferences": [ + { + "type": "website", + "url": "https://github.com/pyo3/pyo3" + }, + { + "type": "other", + "url": "python" + }, + { + "type": "vcs", + "url": "https://github.com/pyo3/pyo3" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#serde@1.0.228", + "author": "Erick Tryzelaar , David Tolnay ", + "name": "serde", + "version": "1.0.228", + "description": "A generic serialization/deserialization framework", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/serde@1.0.228", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/serde" + }, + { + "type": "website", + "url": "https://serde.rs" + }, + { + "type": "vcs", + "url": "https://github.com/serde-rs/serde" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#serde_core@1.0.228", + "author": "Erick Tryzelaar , David Tolnay ", + "name": "serde_core", + "version": "1.0.228", + "description": "Serde traits only, with no support for derive -- use the `serde` crate instead", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/serde_core@1.0.228", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/serde_core" + }, + { + "type": "website", + "url": "https://serde.rs" + }, + { + "type": "vcs", + "url": "https://github.com/serde-rs/serde" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#serde_json@1.0.149", + "author": "Erick Tryzelaar , David Tolnay ", + "name": "serde_json", + "version": "1.0.149", + "description": "A JSON serialization file format", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/serde_json@1.0.149", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/serde_json" + }, + { + "type": "vcs", + "url": "https://github.com/serde-rs/json" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#shlex@1.3.0", + "author": "comex , Fenhl , Adrian Taylor , Alex Touchet , Daniel Parks , Garrett Berg ", + "name": "shlex", + "version": "1.3.0", + "description": "Split a string into shell words, like Python's shlex.", + "scope": "excluded", + "hashes": [ + { + "alg": "SHA-256", + "content": "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/shlex@1.3.0", + "externalReferences": [ + { + "type": "vcs", + "url": "https://github.com/comex/rust-shlex" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#simdutf8@0.1.5", + "author": "Hans Kratz ", + "name": "simdutf8", + "version": "0.1.5", + "description": "SIMD-accelerated UTF-8 validation.", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/simdutf8@0.1.5", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/simdutf8/" + }, + { + "type": "website", + "url": "https://github.com/rusticstuff/simdutf8" + }, + { + "type": "vcs", + "url": "https://github.com/rusticstuff/simdutf8" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#target-lexicon@0.13.5", + "author": "Dan Gohman ", + "name": "target-lexicon", + "version": "0.13.5", + "description": "LLVM target triple types", + "scope": "excluded", + "hashes": [ + { + "alg": "SHA-256", + "content": "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" + } + ], + "licenses": [ + { + "expression": "Apache-2.0 WITH LLVM-exception" + } + ], + "purl": "pkg:cargo/target-lexicon@0.13.5", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/target-lexicon/" + }, + { + "type": "vcs", + "url": "https://github.com/bytecodealliance/target-lexicon" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#version_check@0.9.5", + "author": "Sergio Benitez ", + "name": "version_check", + "version": "0.9.5", + "description": "Tiny crate to check the version of the installed/running rustc.", + "scope": "excluded", + "hashes": [ + { + "alg": "SHA-256", + "content": "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + } + ], + "licenses": [ + { + "expression": "MIT OR Apache-2.0" + } + ], + "purl": "pkg:cargo/version_check@0.9.5", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/version_check/" + }, + { + "type": "vcs", + "url": "https://github.com/SergioBenitez/version_check" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#xxhash-rust@0.8.15", + "author": "Douman ", + "name": "xxhash-rust", + "version": "0.8.15", + "description": "Implementation of xxhash", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "fdd20c5420375476fbd4394763288da7eb0cc0b8c11deed431a91562af7335d3" + } + ], + "licenses": [ + { + "expression": "BSL-1.0" + } + ], + "purl": "pkg:cargo/xxhash-rust@0.8.15", + "externalReferences": [ + { + "type": "vcs", + "url": "https://github.com/DoumanAsh/xxhash-rust" + } + ] + }, + { + "type": "library", + "bom-ref": "registry+https://github.com/rust-lang/crates.io-index#zmij@1.0.21", + "author": "David Tolnay ", + "name": "zmij", + "version": "1.0.21", + "description": "A double-to-string conversion algorithm based on Schubfach and yy", + "scope": "required", + "hashes": [ + { + "alg": "SHA-256", + "content": "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + } + ], + "licenses": [ + { + "expression": "MIT" + } + ], + "purl": "pkg:cargo/zmij@1.0.21", + "externalReferences": [ + { + "type": "documentation", + "url": "https://docs.rs/zmij" + }, + { + "type": "vcs", + "url": "https://github.com/dtolnay/zmij" + } + ] + } + ], + "dependencies": [ + { + "ref": "path+file:///__w/orjson/orjson#3.11.8", + "dependsOn": [ + "registry+https://github.com/rust-lang/crates.io-index#associative-cache@3.0.0", + "registry+https://github.com/rust-lang/crates.io-index#bytecount@0.6.9", + "registry+https://github.com/rust-lang/crates.io-index#bytes@1.11.1", + "registry+https://github.com/rust-lang/crates.io-index#cc@1.2.58", + "registry+https://github.com/rust-lang/crates.io-index#encoding_rs@0.8.35", + "registry+https://github.com/rust-lang/crates.io-index#itoap@1.0.1", + "registry+https://github.com/rust-lang/crates.io-index#jiff@0.2.23", + "registry+https://github.com/rust-lang/crates.io-index#once_cell@1.21.4", + "registry+https://github.com/rust-lang/crates.io-index#pyo3-build-config@0.28.2", + "registry+https://github.com/rust-lang/crates.io-index#pyo3-ffi@0.28.2", + "registry+https://github.com/rust-lang/crates.io-index#serde@1.0.228", + "registry+https://github.com/rust-lang/crates.io-index#serde_json@1.0.149", + "registry+https://github.com/rust-lang/crates.io-index#simdutf8@0.1.5", + "registry+https://github.com/rust-lang/crates.io-index#version_check@0.9.5", + "registry+https://github.com/rust-lang/crates.io-index#xxhash-rust@0.8.15", + "registry+https://github.com/rust-lang/crates.io-index#zmij@1.0.21" + ] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#associative-cache@3.0.0", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#bytecount@0.6.9", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#bytes@1.11.1", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#cc@1.2.58", + "dependsOn": [ + "registry+https://github.com/rust-lang/crates.io-index#find-msvc-tools@0.1.9", + "registry+https://github.com/rust-lang/crates.io-index#shlex@1.3.0" + ] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#cfg-if@1.0.4", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#encoding_rs@0.8.35", + "dependsOn": [ + "registry+https://github.com/rust-lang/crates.io-index#cfg-if@1.0.4" + ] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#find-msvc-tools@0.1.9", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#itoa@1.0.18", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#itoap@1.0.1", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#jiff@0.2.23", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#libc@0.2.183", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#memchr@2.8.0", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#once_cell@1.21.4", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#pyo3-build-config@0.28.2", + "dependsOn": [ + "registry+https://github.com/rust-lang/crates.io-index#target-lexicon@0.13.5" + ] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#pyo3-ffi@0.28.2", + "dependsOn": [ + "registry+https://github.com/rust-lang/crates.io-index#libc@0.2.183", + "registry+https://github.com/rust-lang/crates.io-index#pyo3-build-config@0.28.2" + ] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#serde@1.0.228", + "dependsOn": [ + "registry+https://github.com/rust-lang/crates.io-index#serde_core@1.0.228" + ] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#serde_core@1.0.228", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#serde_json@1.0.149", + "dependsOn": [ + "registry+https://github.com/rust-lang/crates.io-index#itoa@1.0.18", + "registry+https://github.com/rust-lang/crates.io-index#memchr@2.8.0", + "registry+https://github.com/rust-lang/crates.io-index#serde_core@1.0.228", + "registry+https://github.com/rust-lang/crates.io-index#zmij@1.0.21" + ] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#shlex@1.3.0", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#simdutf8@0.1.5", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#target-lexicon@0.13.5", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#version_check@0.9.5", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#xxhash-rust@0.8.15", + "dependsOn": [] + }, + { + "ref": "registry+https://github.com/rust-lang/crates.io-index#zmij@1.0.21", + "dependsOn": [] + } + ] +} \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/INSTALLER b/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/INSTALLER @@ -0,0 +1 @@ +uv \ No newline at end of file diff --git a/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/METADATA b/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..ca4156b06bc0b63c2639a063422b53826a8b0a25 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/METADATA @@ -0,0 +1,63 @@ +Metadata-Version: 2.4 +Name: pydantic-settings +Version: 2.14.0 +Summary: Settings management using Pydantic +Project-URL: Homepage, https://github.com/pydantic/pydantic-settings +Project-URL: Funding, https://github.com/sponsors/samuelcolvin +Project-URL: Source, https://github.com/pydantic/pydantic-settings +Project-URL: Changelog, https://github.com/pydantic/pydantic-settings/releases +Project-URL: Documentation, https://docs.pydantic.dev/dev-v2/concepts/pydantic_settings/ +Author-email: Samuel Colvin , Eric Jolibois , Hasan Ramezani +License-Expression: MIT +License-File: LICENSE +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Environment :: MacOS X +Classifier: Framework :: Pydantic +Classifier: Framework :: Pydantic :: 2 +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Information Technology +Classifier: Intended Audience :: System Administrators +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: Unix +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Topic :: Internet +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Requires-Python: >=3.10 +Requires-Dist: pydantic>=2.7.0 +Requires-Dist: python-dotenv>=0.21.0 +Requires-Dist: typing-inspection>=0.4.0 +Provides-Extra: aws-secrets-manager +Requires-Dist: boto3>=1.35.0; extra == 'aws-secrets-manager' +Requires-Dist: types-boto3[secretsmanager]; extra == 'aws-secrets-manager' +Provides-Extra: azure-key-vault +Requires-Dist: azure-identity>=1.16.0; extra == 'azure-key-vault' +Requires-Dist: azure-keyvault-secrets>=4.8.0; extra == 'azure-key-vault' +Provides-Extra: gcp-secret-manager +Requires-Dist: google-cloud-secret-manager>=2.23.1; extra == 'gcp-secret-manager' +Provides-Extra: toml +Requires-Dist: tomli>=2.0.1; extra == 'toml' +Provides-Extra: yaml +Requires-Dist: pyyaml>=6.0.1; extra == 'yaml' +Description-Content-Type: text/markdown + +# pydantic-settings + +[![CI](https://github.com/pydantic/pydantic-settings/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/pydantic/pydantic-settings/actions/workflows/ci.yml?query=branch%3Amain) +[![Coverage](https://codecov.io/gh/pydantic/pydantic-settings/branch/main/graph/badge.svg)](https://codecov.io/gh/pydantic/pydantic-settings) +[![pypi](https://img.shields.io/pypi/v/pydantic-settings.svg)](https://pypi.python.org/pypi/pydantic-settings) +[![license](https://img.shields.io/github/license/pydantic/pydantic-settings.svg)](https://github.com/pydantic/pydantic-settings/blob/main/LICENSE) +[![downloads](https://static.pepy.tech/badge/pydantic-settings/month)](https://pepy.tech/project/pydantic-settings) +[![versions](https://img.shields.io/pypi/pyversions/pydantic-settings.svg)](https://github.com/pydantic/pydantic-settings) + +Settings management using Pydantic. + +See [documentation](https://docs.pydantic.dev/latest/concepts/pydantic_settings/) for more details. diff --git a/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/RECORD b/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..24098bcbd5e83344d1ae1b044c2809f36dcf768a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/RECORD @@ -0,0 +1,29 @@ +pydantic_settings-2.14.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 +pydantic_settings-2.14.0.dist-info/METADATA,sha256=6aNGYxqx3yKp7Tpd7LZU9WFX3RABWvegYlngmx0l5KA,3395 +pydantic_settings-2.14.0.dist-info/RECORD,, +pydantic_settings-2.14.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pydantic_settings-2.14.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87 +pydantic_settings-2.14.0.dist-info/licenses/LICENSE,sha256=6zVadT4CA0bTPYO_l2kTW4n8YQVorFMaAcKVvO5_2Zg,1103 +pydantic_settings/__init__.py,sha256=_2aYjmOukI0KsXbkdAsnnNCTcwxDl8qSi5X_djGJ9vc,1707 +pydantic_settings/exceptions.py,sha256=SHLrIBHeFltPMc8abiQxw-MGqEadlYI-VdLELiZtWPU,97 +pydantic_settings/main.py,sha256=qc97-63zTOtIPmfFUMACwb1g8NOSj6OR4AedoXywKKQ,43610 +pydantic_settings/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +pydantic_settings/sources/__init__.py,sha256=8Mhev9QzMDfJ1dBlLJ1j3_PXEaD1ggcxrYp0gD3kJdo,2350 +pydantic_settings/sources/base.py,sha256=yqdhh1Pc1w1TilCsvQCNmVC6IQi9gqEUkoTF796I_tQ,23664 +pydantic_settings/sources/providers/__init__.py,sha256=KfYerDF3UC-0aLPc29KLuIYomPxYksryLFSPBVrZXSg,1281 +pydantic_settings/sources/providers/aws.py,sha256=lb7HxyPKCCZajUWlwglKJcqb9R4n8aeZRQf-rbIHp5o,2730 +pydantic_settings/sources/providers/azure.py,sha256=Qhf7IR7p0177NBwiLih6vTiMwWatgpP5EfQu2EI3KiA,5584 +pydantic_settings/sources/providers/cli.py,sha256=6yIsOPOXp7cA1Hq0zFs__mskFPiBK0jfq5_vYs-ijVQ,74463 +pydantic_settings/sources/providers/dotenv.py,sha256=YX9VvhNXQ4HLvIQAYncAXHYsSxAmAaszyN83ZcCe09E,7335 +pydantic_settings/sources/providers/env.py,sha256=SFg6AaeVgSawaPeQg3QwxOjXu5xtdoet7aau38S_Ez0,13510 +pydantic_settings/sources/providers/gcp.py,sha256=Y_5sa0ig-zN6MwVwRzAABNj87bN9nDJsLhXGCBU94aE,9962 +pydantic_settings/sources/providers/json.py,sha256=H0BpGTSkS0V9H59jr0ZTp_an2kLCSfef0TqwJuHY0iM,1492 +pydantic_settings/sources/providers/nested_secrets.py,sha256=9vpesWyl4fssfbcalPqjjoiCr1hvi1ikexFwH2UqgPo,6622 +pydantic_settings/sources/providers/pyproject.py,sha256=zSQsV3-jtZhiLm3YlrlYoE2__tZBazp0KjQyKLNyLr0,2052 +pydantic_settings/sources/providers/secrets.py,sha256=k5CFjS6ImQH4mP_bTaVJ3Iq8RF_ul0l9FEUPJUY8YLk,4470 +pydantic_settings/sources/providers/toml.py,sha256=xySqX4H--8E7yWq49SXzAK-BDPMaW-evfGCgQ3Bsq9g,1883 +pydantic_settings/sources/providers/yaml.py,sha256=pCZ-YDsjVyQIePEIqoPplIVtL9Vrr6gNAvC7JaFaR2w,4777 +pydantic_settings/sources/types.py,sha256=jN72c7TQILwj53LmcXozcL9gnFVVbJPRaE_7r3WciSY,1980 +pydantic_settings/sources/utils.py,sha256=hTWqE3p3A0kBQtkhGXN4bhe7ir2RQtL0em9tnAyvhJI,12290 +pydantic_settings/utils.py,sha256=8jXay93JWt26z12XORLcgGMPCndKVDJVPWtQNt4JZ3Q,1353 +pydantic_settings/version.py,sha256=xEXRwMzoiXMgu1HnSPy4zkJ-bHJ7aipcWe3R1EwSFuQ,19 diff --git a/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/REQUESTED b/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/WHEEL b/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..b1b94fd58e7e9ed0ef3449473bc48de68afcc3fe --- /dev/null +++ b/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.29.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/licenses/LICENSE b/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d90598f2a8740731fa4c637870bd1f8a1a23bfb4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/pydantic_settings-2.14.0.dist-info/licenses/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Samuel Colvin and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.venv/lib/python3.10/site-packages/urllib3/__init__.py b/.venv/lib/python3.10/site-packages/urllib3/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3fe782c8a45bbabcf240f3cac4303ac12b0ec274 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/__init__.py @@ -0,0 +1,211 @@ +""" +Python HTTP library with thread-safe connection pooling, file post support, user friendly, and more +""" + +from __future__ import annotations + +# Set default logging handler to avoid "No handler found" warnings. +import logging +import sys +import typing +import warnings +from logging import NullHandler + +from . import exceptions +from ._base_connection import _TYPE_BODY +from ._collections import HTTPHeaderDict +from ._version import __version__ +from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url +from .filepost import _TYPE_FIELDS, encode_multipart_formdata +from .poolmanager import PoolManager, ProxyManager, proxy_from_url +from .response import BaseHTTPResponse, HTTPResponse +from .util.request import make_headers +from .util.retry import Retry +from .util.timeout import Timeout + +# Ensure that Python is compiled with OpenSSL 1.1.1+ +# If the 'ssl' module isn't available at all that's +# fine, we only care if the module is available. +try: + import ssl +except ImportError: + pass +else: + if not ssl.OPENSSL_VERSION.startswith("OpenSSL "): # Defensive: + warnings.warn( + "urllib3 v2 only supports OpenSSL 1.1.1+, currently " + f"the 'ssl' module is compiled with {ssl.OPENSSL_VERSION!r}. " + "See: https://github.com/urllib3/urllib3/issues/3020", + exceptions.NotOpenSSLWarning, + ) + elif ssl.OPENSSL_VERSION_INFO < (1, 1, 1): # Defensive: + raise ImportError( + "urllib3 v2 only supports OpenSSL 1.1.1+, currently " + f"the 'ssl' module is compiled with {ssl.OPENSSL_VERSION!r}. " + "See: https://github.com/urllib3/urllib3/issues/2168" + ) + +__author__ = "Andrey Petrov (andrey.petrov@shazow.net)" +__license__ = "MIT" +__version__ = __version__ + +__all__ = ( + "HTTPConnectionPool", + "HTTPHeaderDict", + "HTTPSConnectionPool", + "PoolManager", + "ProxyManager", + "HTTPResponse", + "Retry", + "Timeout", + "add_stderr_logger", + "connection_from_url", + "disable_warnings", + "encode_multipart_formdata", + "make_headers", + "proxy_from_url", + "request", + "BaseHTTPResponse", +) + +logging.getLogger(__name__).addHandler(NullHandler()) + + +def add_stderr_logger( + level: int = logging.DEBUG, +) -> logging.StreamHandler[typing.TextIO]: + """ + Helper for quickly adding a StreamHandler to the logger. Useful for + debugging. + + Returns the handler after adding it. + """ + # This method needs to be in this __init__.py to get the __name__ correct + # even if urllib3 is vendored within another package. + logger = logging.getLogger(__name__) + handler = logging.StreamHandler() + handler.setFormatter(logging.Formatter("%(asctime)s %(levelname)s %(message)s")) + logger.addHandler(handler) + logger.setLevel(level) + logger.debug("Added a stderr logging handler to logger: %s", __name__) + return handler + + +# ... Clean up. +del NullHandler + + +# All warning filters *must* be appended unless you're really certain that they +# shouldn't be: otherwise, it's very hard for users to use most Python +# mechanisms to silence them. +# SecurityWarning's always go off by default. +warnings.simplefilter("always", exceptions.SecurityWarning, append=True) +# InsecurePlatformWarning's don't vary between requests, so we keep it default. +warnings.simplefilter("default", exceptions.InsecurePlatformWarning, append=True) + + +def disable_warnings(category: type[Warning] = exceptions.HTTPWarning) -> None: + """ + Helper for quickly disabling all urllib3 warnings. + """ + warnings.simplefilter("ignore", category) + + +_DEFAULT_POOL = PoolManager() + + +def request( + method: str, + url: str, + *, + body: _TYPE_BODY | None = None, + fields: _TYPE_FIELDS | None = None, + headers: typing.Mapping[str, str] | None = None, + preload_content: bool | None = True, + decode_content: bool | None = True, + redirect: bool | None = True, + retries: Retry | bool | int | None = None, + timeout: Timeout | float | int | None = 3, + json: typing.Any | None = None, +) -> BaseHTTPResponse: + """ + A convenience, top-level request method. It uses a module-global ``PoolManager`` instance. + Therefore, its side effects could be shared across dependencies relying on it. + To avoid side effects create a new ``PoolManager`` instance and use it instead. + The method does not accept low-level ``**urlopen_kw`` keyword arguments. + + :param method: + HTTP request method (such as GET, POST, PUT, etc.) + + :param url: + The URL to perform the request on. + + :param body: + Data to send in the request body, either :class:`str`, :class:`bytes`, + an iterable of :class:`str`/:class:`bytes`, or a file-like object. + + :param fields: + Data to encode and send in the request body. + + :param headers: + Dictionary of custom headers to send, such as User-Agent, + If-None-Match, etc. + + :param bool preload_content: + If True, the response's body will be preloaded into memory. + + :param bool decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param redirect: + If True, automatically handle redirects (status codes 301, 302, + 303, 307, 308). Each redirect counts as a retry. Disabling retries + will disable redirect, too. + + :param retries: + Configure the number of retries to allow before raising a + :class:`~urllib3.exceptions.MaxRetryError` exception. + + If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a + :class:`~urllib3.util.retry.Retry` object for fine-grained control + over different types of retries. + Pass an integer number to retry connection errors that many times, + but no other types of errors. Pass zero to never retry. + + If ``False``, then retries are disabled and any exception is raised + immediately. Also, instead of raising a MaxRetryError on redirects, + the redirect response will be returned. + + :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. + + :param timeout: + If specified, overrides the default timeout for this one + request. It may be a float (in seconds) or an instance of + :class:`urllib3.util.Timeout`. + + :param json: + Data to encode and send as JSON with UTF-encoded in the request body. + The ``"Content-Type"`` header will be set to ``"application/json"`` + unless specified otherwise. + """ + + return _DEFAULT_POOL.request( + method, + url, + body=body, + fields=fields, + headers=headers, + preload_content=preload_content, + decode_content=decode_content, + redirect=redirect, + retries=retries, + timeout=timeout, + json=json, + ) + + +if sys.platform == "emscripten": + from .contrib.emscripten import inject_into_urllib3 # noqa: 401 + + inject_into_urllib3() diff --git a/.venv/lib/python3.10/site-packages/urllib3/__pycache__/__init__.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7005f23af88eecd995abcce2a670d4812fd4faef Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/__init__.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/__pycache__/_base_connection.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/_base_connection.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c20bc4e4fbbab854c5afa706b0c61586d35fc0a2 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/_base_connection.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/__pycache__/_collections.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/_collections.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cc4889a8648c519abc1e21b20aede3dd2b1aec4a Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/_collections.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/__pycache__/_request_methods.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/_request_methods.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..282c26603317e54f7a27ecc4c4cabb51b6d8db04 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/_request_methods.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/__pycache__/_version.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/_version.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..907be464cb3e81ac733836fc8d7b096f59632e09 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/_version.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/__pycache__/connection.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/connection.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8b7d0da8bac9f151824236bdaf907d9c944f0f2f Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/connection.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/__pycache__/connectionpool.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/connectionpool.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..303821b2f57c253c8b6b21f81c9cf394a23947b9 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/connectionpool.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/__pycache__/exceptions.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/exceptions.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e4dc4d47d94d98d772f20b373094fdab239318a9 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/exceptions.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/__pycache__/fields.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/fields.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..725d12fef1366f7df112b358863f2a40cc3f1cd7 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/fields.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/__pycache__/filepost.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/filepost.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4a4ee089bed7a83a4c908205123b850870f3b3fc Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/filepost.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/__pycache__/poolmanager.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/poolmanager.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..34cd61c2d732f305c0c93c29e4673ad8a272dff5 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/poolmanager.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/__pycache__/response.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/response.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ce80c598109034a28d3b0c33de4a6813a5e70951 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/__pycache__/response.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/_base_connection.py b/.venv/lib/python3.10/site-packages/urllib3/_base_connection.py new file mode 100644 index 0000000000000000000000000000000000000000..dc0f318c0b380926eed0f4209d395c79963eaf9e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/_base_connection.py @@ -0,0 +1,165 @@ +from __future__ import annotations + +import typing + +from .util.connection import _TYPE_SOCKET_OPTIONS +from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT +from .util.url import Url + +_TYPE_BODY = typing.Union[bytes, typing.IO[typing.Any], typing.Iterable[bytes], str] + + +class ProxyConfig(typing.NamedTuple): + ssl_context: ssl.SSLContext | None + use_forwarding_for_https: bool + assert_hostname: None | str | typing.Literal[False] + assert_fingerprint: str | None + + +class _ResponseOptions(typing.NamedTuple): + # TODO: Remove this in favor of a better + # HTTP request/response lifecycle tracking. + request_method: str + request_url: str + preload_content: bool + decode_content: bool + enforce_content_length: bool + + +if typing.TYPE_CHECKING: + import ssl + from typing import Protocol + + from .response import BaseHTTPResponse + + class BaseHTTPConnection(Protocol): + default_port: typing.ClassVar[int] + default_socket_options: typing.ClassVar[_TYPE_SOCKET_OPTIONS] + + host: str + port: int + timeout: None | ( + float + ) # Instance doesn't store _DEFAULT_TIMEOUT, must be resolved. + blocksize: int + source_address: tuple[str, int] | None + socket_options: _TYPE_SOCKET_OPTIONS | None + + proxy: Url | None + proxy_config: ProxyConfig | None + + is_verified: bool + proxy_is_verified: bool | None + + def __init__( + self, + host: str, + port: int | None = None, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 8192, + socket_options: _TYPE_SOCKET_OPTIONS | None = ..., + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + ) -> None: ... + + def set_tunnel( + self, + host: str, + port: int | None = None, + headers: typing.Mapping[str, str] | None = None, + scheme: str = "http", + ) -> None: ... + + def connect(self) -> None: ... + + def request( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + # We know *at least* botocore is depending on the order of the + # first 3 parameters so to be safe we only mark the later ones + # as keyword-only to ensure we have space to extend. + *, + chunked: bool = False, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + ) -> None: ... + + def getresponse(self) -> BaseHTTPResponse: ... + + def close(self) -> None: ... + + @property + def is_closed(self) -> bool: + """Whether the connection either is brand new or has been previously closed. + If this property is True then both ``is_connected`` and ``has_connected_to_proxy`` + properties must be False. + """ + + @property + def is_connected(self) -> bool: + """Whether the connection is actively connected to any origin (proxy or target)""" + + @property + def has_connected_to_proxy(self) -> bool: + """Whether the connection has successfully connected to its proxy. + This returns False if no proxy is in use. Used to determine whether + errors are coming from the proxy layer or from tunnelling to the target origin. + """ + + class BaseHTTPSConnection(BaseHTTPConnection, Protocol): + default_port: typing.ClassVar[int] + default_socket_options: typing.ClassVar[_TYPE_SOCKET_OPTIONS] + + # Certificate verification methods + cert_reqs: int | str | None + assert_hostname: None | str | typing.Literal[False] + assert_fingerprint: str | None + ssl_context: ssl.SSLContext | None + + # Trusted CAs + ca_certs: str | None + ca_cert_dir: str | None + ca_cert_data: None | str | bytes + + # TLS version + ssl_minimum_version: int | None + ssl_maximum_version: int | None + ssl_version: int | str | None # Deprecated + + # Client certificates + cert_file: str | None + key_file: str | None + key_password: str | None + + def __init__( + self, + host: str, + port: int | None = None, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 16384, + socket_options: _TYPE_SOCKET_OPTIONS | None = ..., + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + cert_reqs: int | str | None = None, + assert_hostname: None | str | typing.Literal[False] = None, + assert_fingerprint: str | None = None, + server_hostname: str | None = None, + ssl_context: ssl.SSLContext | None = None, + ca_certs: str | None = None, + ca_cert_dir: str | None = None, + ca_cert_data: None | str | bytes = None, + ssl_minimum_version: int | None = None, + ssl_maximum_version: int | None = None, + ssl_version: int | str | None = None, # Deprecated + cert_file: str | None = None, + key_file: str | None = None, + key_password: str | None = None, + ) -> None: ... diff --git a/.venv/lib/python3.10/site-packages/urllib3/_collections.py b/.venv/lib/python3.10/site-packages/urllib3/_collections.py new file mode 100644 index 0000000000000000000000000000000000000000..0378aab1b1aba0b61cb2741156dea652591ca2bf --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/_collections.py @@ -0,0 +1,487 @@ +from __future__ import annotations + +import typing +from collections import OrderedDict +from enum import Enum, auto +from threading import RLock + +if typing.TYPE_CHECKING: + # We can only import Protocol if TYPE_CHECKING because it's a development + # dependency, and is not available at runtime. + from typing import Protocol + + from typing_extensions import Self + + class HasGettableStringKeys(Protocol): + def keys(self) -> typing.Iterator[str]: ... + + def __getitem__(self, key: str) -> str: ... + + +__all__ = ["RecentlyUsedContainer", "HTTPHeaderDict"] + + +# Key type +_KT = typing.TypeVar("_KT") +# Value type +_VT = typing.TypeVar("_VT") +# Default type +_DT = typing.TypeVar("_DT") + +ValidHTTPHeaderSource = typing.Union[ + "HTTPHeaderDict", + typing.Mapping[str, str], + typing.Iterable[tuple[str, str]], + "HasGettableStringKeys", +] + + +class _Sentinel(Enum): + not_passed = auto() + + +def ensure_can_construct_http_header_dict( + potential: object, +) -> ValidHTTPHeaderSource | None: + if isinstance(potential, HTTPHeaderDict): + return potential + elif isinstance(potential, typing.Mapping): + # Full runtime checking of the contents of a Mapping is expensive, so for the + # purposes of typechecking, we assume that any Mapping is the right shape. + return typing.cast(typing.Mapping[str, str], potential) + elif isinstance(potential, typing.Iterable): + # Similarly to Mapping, full runtime checking of the contents of an Iterable is + # expensive, so for the purposes of typechecking, we assume that any Iterable + # is the right shape. + return typing.cast(typing.Iterable[tuple[str, str]], potential) + elif hasattr(potential, "keys") and hasattr(potential, "__getitem__"): + return typing.cast("HasGettableStringKeys", potential) + else: + return None + + +class RecentlyUsedContainer(typing.Generic[_KT, _VT], typing.MutableMapping[_KT, _VT]): + """ + Provides a thread-safe dict-like container which maintains up to + ``maxsize`` keys while throwing away the least-recently-used keys beyond + ``maxsize``. + + :param maxsize: + Maximum number of recent elements to retain. + + :param dispose_func: + Every time an item is evicted from the container, + ``dispose_func(value)`` is called. Callback which will get called + """ + + _container: typing.OrderedDict[_KT, _VT] + _maxsize: int + dispose_func: typing.Callable[[_VT], None] | None + lock: RLock + + def __init__( + self, + maxsize: int = 10, + dispose_func: typing.Callable[[_VT], None] | None = None, + ) -> None: + super().__init__() + self._maxsize = maxsize + self.dispose_func = dispose_func + self._container = OrderedDict() + self.lock = RLock() + + def __getitem__(self, key: _KT) -> _VT: + # Re-insert the item, moving it to the end of the eviction line. + with self.lock: + item = self._container.pop(key) + self._container[key] = item + return item + + def __setitem__(self, key: _KT, value: _VT) -> None: + evicted_item = None + with self.lock: + # Possibly evict the existing value of 'key' + try: + # If the key exists, we'll overwrite it, which won't change the + # size of the pool. Because accessing a key should move it to + # the end of the eviction line, we pop it out first. + evicted_item = key, self._container.pop(key) + self._container[key] = value + except KeyError: + # When the key does not exist, we insert the value first so that + # evicting works in all cases, including when self._maxsize is 0 + self._container[key] = value + if len(self._container) > self._maxsize: + # If we didn't evict an existing value, and we've hit our maximum + # size, then we have to evict the least recently used item from + # the beginning of the container. + evicted_item = self._container.popitem(last=False) + + # After releasing the lock on the pool, dispose of any evicted value. + if evicted_item is not None and self.dispose_func: + _, evicted_value = evicted_item + self.dispose_func(evicted_value) + + def __delitem__(self, key: _KT) -> None: + with self.lock: + value = self._container.pop(key) + + if self.dispose_func: + self.dispose_func(value) + + def __len__(self) -> int: + with self.lock: + return len(self._container) + + def __iter__(self) -> typing.NoReturn: + raise NotImplementedError( + "Iteration over this class is unlikely to be threadsafe." + ) + + def clear(self) -> None: + with self.lock: + # Copy pointers to all values, then wipe the mapping + values = list(self._container.values()) + self._container.clear() + + if self.dispose_func: + for value in values: + self.dispose_func(value) + + def keys(self) -> set[_KT]: # type: ignore[override] + with self.lock: + return set(self._container.keys()) + + +class HTTPHeaderDictItemView(set[tuple[str, str]]): + """ + HTTPHeaderDict is unusual for a Mapping[str, str] in that it has two modes of + address. + + If we directly try to get an item with a particular name, we will get a string + back that is the concatenated version of all the values: + + >>> d['X-Header-Name'] + 'Value1, Value2, Value3' + + However, if we iterate over an HTTPHeaderDict's items, we will optionally combine + these values based on whether combine=True was called when building up the dictionary + + >>> d = HTTPHeaderDict({"A": "1", "B": "foo"}) + >>> d.add("A", "2", combine=True) + >>> d.add("B", "bar") + >>> list(d.items()) + [ + ('A', '1, 2'), + ('B', 'foo'), + ('B', 'bar'), + ] + + This class conforms to the interface required by the MutableMapping ABC while + also giving us the nonstandard iteration behavior we want; items with duplicate + keys, ordered by time of first insertion. + """ + + _headers: HTTPHeaderDict + + def __init__(self, headers: HTTPHeaderDict) -> None: + self._headers = headers + + def __len__(self) -> int: + return len(list(self._headers.iteritems())) + + def __iter__(self) -> typing.Iterator[tuple[str, str]]: + return self._headers.iteritems() + + def __contains__(self, item: object) -> bool: + if isinstance(item, tuple) and len(item) == 2: + passed_key, passed_val = item + if isinstance(passed_key, str) and isinstance(passed_val, str): + return self._headers._has_value_for_header(passed_key, passed_val) + return False + + +class HTTPHeaderDict(typing.MutableMapping[str, str]): + """ + :param headers: + An iterable of field-value pairs. Must not contain multiple field names + when compared case-insensitively. + + :param kwargs: + Additional field-value pairs to pass in to ``dict.update``. + + A ``dict`` like container for storing HTTP Headers. + + Field names are stored and compared case-insensitively in compliance with + RFC 7230. Iteration provides the first case-sensitive key seen for each + case-insensitive pair. + + Using ``__setitem__`` syntax overwrites fields that compare equal + case-insensitively in order to maintain ``dict``'s api. For fields that + compare equal, instead create a new ``HTTPHeaderDict`` and use ``.add`` + in a loop. + + If multiple fields that are equal case-insensitively are passed to the + constructor or ``.update``, the behavior is undefined and some will be + lost. + + >>> headers = HTTPHeaderDict() + >>> headers.add('Set-Cookie', 'foo=bar') + >>> headers.add('set-cookie', 'baz=quxx') + >>> headers['content-length'] = '7' + >>> headers['SET-cookie'] + 'foo=bar, baz=quxx' + >>> headers['Content-Length'] + '7' + """ + + _container: typing.MutableMapping[str, list[str]] + + def __init__(self, headers: ValidHTTPHeaderSource | None = None, **kwargs: str): + super().__init__() + self._container = {} # 'dict' is insert-ordered + if headers is not None: + if isinstance(headers, HTTPHeaderDict): + self._copy_from(headers) + else: + self.extend(headers) + if kwargs: + self.extend(kwargs) + + def __setitem__(self, key: str, val: str) -> None: + # avoid a bytes/str comparison by decoding before httplib + if isinstance(key, bytes): + key = key.decode("latin-1") + self._container[key.lower()] = [key, val] + + def __getitem__(self, key: str) -> str: + if isinstance(key, bytes): + key = key.decode("latin-1") + val = self._container[key.lower()] + return ", ".join(val[1:]) + + def __delitem__(self, key: str) -> None: + if isinstance(key, bytes): + key = key.decode("latin-1") + del self._container[key.lower()] + + def __contains__(self, key: object) -> bool: + if isinstance(key, bytes): + key = key.decode("latin-1") + if isinstance(key, str): + return key.lower() in self._container + return False + + def setdefault(self, key: str, default: str = "") -> str: + return super().setdefault(key, default) + + def __eq__(self, other: object) -> bool: + maybe_constructable = ensure_can_construct_http_header_dict(other) + if maybe_constructable is None: + return False + else: + other_as_http_header_dict = type(self)(maybe_constructable) + + return {k.lower(): v for k, v in self.itermerged()} == { + k.lower(): v for k, v in other_as_http_header_dict.itermerged() + } + + def __ne__(self, other: object) -> bool: + return not self.__eq__(other) + + def __len__(self) -> int: + return len(self._container) + + def __iter__(self) -> typing.Iterator[str]: + # Only provide the originally cased names + for vals in self._container.values(): + yield vals[0] + + def discard(self, key: str) -> None: + try: + del self[key] + except KeyError: + pass + + def add(self, key: str, val: str, *, combine: bool = False) -> None: + """Adds a (name, value) pair, doesn't overwrite the value if it already + exists. + + If this is called with combine=True, instead of adding a new header value + as a distinct item during iteration, this will instead append the value to + any existing header value with a comma. If no existing header value exists + for the key, then the value will simply be added, ignoring the combine parameter. + + >>> headers = HTTPHeaderDict(foo='bar') + >>> headers.add('Foo', 'baz') + >>> headers['foo'] + 'bar, baz' + >>> list(headers.items()) + [('foo', 'bar'), ('foo', 'baz')] + >>> headers.add('foo', 'quz', combine=True) + >>> list(headers.items()) + [('foo', 'bar, baz, quz')] + """ + # avoid a bytes/str comparison by decoding before httplib + if isinstance(key, bytes): + key = key.decode("latin-1") + key_lower = key.lower() + new_vals = [key, val] + # Keep the common case aka no item present as fast as possible + vals = self._container.setdefault(key_lower, new_vals) + if new_vals is not vals: + # if there are values here, then there is at least the initial + # key/value pair + assert len(vals) >= 2 + if combine: + vals[-1] = vals[-1] + ", " + val + else: + vals.append(val) + + def extend(self, *args: ValidHTTPHeaderSource, **kwargs: str) -> None: + """Generic import function for any type of header-like object. + Adapted version of MutableMapping.update in order to insert items + with self.add instead of self.__setitem__ + """ + if len(args) > 1: + raise TypeError( + f"extend() takes at most 1 positional arguments ({len(args)} given)" + ) + other = args[0] if len(args) >= 1 else () + + if isinstance(other, HTTPHeaderDict): + for key, val in other.iteritems(): + self.add(key, val) + elif isinstance(other, typing.Mapping): + for key, val in other.items(): + self.add(key, val) + elif isinstance(other, typing.Iterable): + other = typing.cast(typing.Iterable[tuple[str, str]], other) + for key, value in other: + self.add(key, value) + elif hasattr(other, "keys") and hasattr(other, "__getitem__"): + # THIS IS NOT A TYPESAFE BRANCH + # In this branch, the object has a `keys` attr but is not a Mapping or any of + # the other types indicated in the method signature. We do some stuff with + # it as though it partially implements the Mapping interface, but we're not + # doing that stuff safely AT ALL. + for key in other.keys(): + self.add(key, other[key]) + + for key, value in kwargs.items(): + self.add(key, value) + + @typing.overload + def getlist(self, key: str) -> list[str]: ... + + @typing.overload + def getlist(self, key: str, default: _DT) -> list[str] | _DT: ... + + def getlist( + self, key: str, default: _Sentinel | _DT = _Sentinel.not_passed + ) -> list[str] | _DT: + """Returns a list of all the values for the named field. Returns an + empty list if the key doesn't exist.""" + if isinstance(key, bytes): + key = key.decode("latin-1") + try: + vals = self._container[key.lower()] + except KeyError: + if default is _Sentinel.not_passed: + # _DT is unbound; empty list is instance of List[str] + return [] + # _DT is bound; default is instance of _DT + return default + else: + # _DT may or may not be bound; vals[1:] is instance of List[str], which + # meets our external interface requirement of `Union[List[str], _DT]`. + return vals[1:] + + def _prepare_for_method_change(self) -> Self: + """ + Remove content-specific header fields before changing the request + method to GET or HEAD according to RFC 9110, Section 15.4. + """ + content_specific_headers = [ + "Content-Encoding", + "Content-Language", + "Content-Location", + "Content-Type", + "Content-Length", + "Digest", + "Last-Modified", + ] + for header in content_specific_headers: + self.discard(header) + return self + + # Backwards compatibility for httplib + getheaders = getlist + getallmatchingheaders = getlist + iget = getlist + + # Backwards compatibility for http.cookiejar + get_all = getlist + + def __repr__(self) -> str: + return f"{type(self).__name__}({dict(self.itermerged())})" + + def _copy_from(self, other: HTTPHeaderDict) -> None: + for key in other: + val = other.getlist(key) + self._container[key.lower()] = [key, *val] + + def copy(self) -> Self: + clone = type(self)() + clone._copy_from(self) + return clone + + def iteritems(self) -> typing.Iterator[tuple[str, str]]: + """Iterate over all header lines, including duplicate ones.""" + for key in self: + vals = self._container[key.lower()] + for val in vals[1:]: + yield vals[0], val + + def itermerged(self) -> typing.Iterator[tuple[str, str]]: + """Iterate over all headers, merging duplicate ones together.""" + for key in self: + val = self._container[key.lower()] + yield val[0], ", ".join(val[1:]) + + def items(self) -> HTTPHeaderDictItemView: # type: ignore[override] + return HTTPHeaderDictItemView(self) + + def _has_value_for_header(self, header_name: str, potential_value: str) -> bool: + if header_name in self: + return potential_value in self._container[header_name.lower()][1:] + return False + + def __ior__(self, other: object) -> HTTPHeaderDict: + # Supports extending a header dict in-place using operator |= + # combining items with add instead of __setitem__ + maybe_constructable = ensure_can_construct_http_header_dict(other) + if maybe_constructable is None: + return NotImplemented + self.extend(maybe_constructable) + return self + + def __or__(self, other: object) -> Self: + # Supports merging header dicts using operator | + # combining items with add instead of __setitem__ + maybe_constructable = ensure_can_construct_http_header_dict(other) + if maybe_constructable is None: + return NotImplemented + result = self.copy() + result.extend(maybe_constructable) + return result + + def __ror__(self, other: object) -> Self: + # Supports merging header dicts using operator | when other is on left side + # combining items with add instead of __setitem__ + maybe_constructable = ensure_can_construct_http_header_dict(other) + if maybe_constructable is None: + return NotImplemented + result = type(self)(maybe_constructable) + result.extend(self) + return result diff --git a/.venv/lib/python3.10/site-packages/urllib3/_request_methods.py b/.venv/lib/python3.10/site-packages/urllib3/_request_methods.py new file mode 100644 index 0000000000000000000000000000000000000000..297c271bf401c1cb48c6225f8822e78f58c3ca56 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/_request_methods.py @@ -0,0 +1,278 @@ +from __future__ import annotations + +import json as _json +import typing +from urllib.parse import urlencode + +from ._base_connection import _TYPE_BODY +from ._collections import HTTPHeaderDict +from .filepost import _TYPE_FIELDS, encode_multipart_formdata +from .response import BaseHTTPResponse + +__all__ = ["RequestMethods"] + +_TYPE_ENCODE_URL_FIELDS = typing.Union[ + typing.Sequence[tuple[str, typing.Union[str, bytes]]], + typing.Mapping[str, typing.Union[str, bytes]], +] + + +class RequestMethods: + """ + Convenience mixin for classes who implement a :meth:`urlopen` method, such + as :class:`urllib3.HTTPConnectionPool` and + :class:`urllib3.PoolManager`. + + Provides behavior for making common types of HTTP request methods and + decides which type of request field encoding to use. + + Specifically, + + :meth:`.request_encode_url` is for sending requests whose fields are + encoded in the URL (such as GET, HEAD, DELETE). + + :meth:`.request_encode_body` is for sending requests whose fields are + encoded in the *body* of the request using multipart or www-form-urlencoded + (such as for POST, PUT, PATCH). + + :meth:`.request` is for making any kind of request, it will look up the + appropriate encoding format and use one of the above two methods to make + the request. + + Initializer parameters: + + :param headers: + Headers to include with all requests, unless other headers are given + explicitly. + """ + + _encode_url_methods = {"DELETE", "GET", "HEAD", "OPTIONS"} + + def __init__(self, headers: typing.Mapping[str, str] | None = None) -> None: + self.headers = headers or {} + + def urlopen( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + encode_multipart: bool = True, + multipart_boundary: str | None = None, + **kw: typing.Any, + ) -> BaseHTTPResponse: # Abstract + raise NotImplementedError( + "Classes extending RequestMethods must implement " + "their own ``urlopen`` method." + ) + + def request( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + fields: _TYPE_FIELDS | None = None, + headers: typing.Mapping[str, str] | None = None, + json: typing.Any | None = None, + **urlopen_kw: typing.Any, + ) -> BaseHTTPResponse: + """ + Make a request using :meth:`urlopen` with the appropriate encoding of + ``fields`` based on the ``method`` used. + + This is a convenience method that requires the least amount of manual + effort. It can be used in most situations, while still having the + option to drop down to more specific methods when necessary, such as + :meth:`request_encode_url`, :meth:`request_encode_body`, + or even the lowest level :meth:`urlopen`. + + :param method: + HTTP request method (such as GET, POST, PUT, etc.) + + :param url: + The URL to perform the request on. + + :param body: + Data to send in the request body, either :class:`str`, :class:`bytes`, + an iterable of :class:`str`/:class:`bytes`, or a file-like object. + + :param fields: + Data to encode and send in the URL or request body, depending on ``method``. + + :param headers: + Dictionary of custom headers to send, such as User-Agent, + If-None-Match, etc. If None, pool headers are used. If provided, + these headers completely replace any pool-specific headers. + + :param json: + Data to encode and send as JSON with UTF-encoded in the request body. + The ``"Content-Type"`` header will be set to ``"application/json"`` + unless specified otherwise. + """ + method = method.upper() + + if json is not None and body is not None: + raise TypeError( + "request got values for both 'body' and 'json' parameters which are mutually exclusive" + ) + + if json is not None: + if headers is None: + headers = self.headers + + if not ("content-type" in map(str.lower, headers.keys())): + headers = HTTPHeaderDict(headers) + headers["Content-Type"] = "application/json" + + body = _json.dumps(json, separators=(",", ":"), ensure_ascii=False).encode( + "utf-8" + ) + + if body is not None: + urlopen_kw["body"] = body + + if method in self._encode_url_methods: + return self.request_encode_url( + method, + url, + fields=fields, # type: ignore[arg-type] + headers=headers, + **urlopen_kw, + ) + else: + return self.request_encode_body( + method, url, fields=fields, headers=headers, **urlopen_kw + ) + + def request_encode_url( + self, + method: str, + url: str, + fields: _TYPE_ENCODE_URL_FIELDS | None = None, + headers: typing.Mapping[str, str] | None = None, + **urlopen_kw: str, + ) -> BaseHTTPResponse: + """ + Make a request using :meth:`urlopen` with the ``fields`` encoded in + the url. This is useful for request methods like GET, HEAD, DELETE, etc. + + :param method: + HTTP request method (such as GET, POST, PUT, etc.) + + :param url: + The URL to perform the request on. + + :param fields: + Data to encode and send in the URL. + + :param headers: + Dictionary of custom headers to send, such as User-Agent, + If-None-Match, etc. If None, pool headers are used. If provided, + these headers completely replace any pool-specific headers. + """ + if headers is None: + headers = self.headers + + extra_kw: dict[str, typing.Any] = {"headers": headers} + extra_kw.update(urlopen_kw) + + if fields: + url += "?" + urlencode(fields) + + return self.urlopen(method, url, **extra_kw) + + def request_encode_body( + self, + method: str, + url: str, + fields: _TYPE_FIELDS | None = None, + headers: typing.Mapping[str, str] | None = None, + encode_multipart: bool = True, + multipart_boundary: str | None = None, + **urlopen_kw: str, + ) -> BaseHTTPResponse: + """ + Make a request using :meth:`urlopen` with the ``fields`` encoded in + the body. This is useful for request methods like POST, PUT, PATCH, etc. + + When ``encode_multipart=True`` (default), then + :func:`urllib3.encode_multipart_formdata` is used to encode + the payload with the appropriate content type. Otherwise + :func:`urllib.parse.urlencode` is used with the + 'application/x-www-form-urlencoded' content type. + + Multipart encoding must be used when posting files, and it's reasonably + safe to use it in other times too. However, it may break request + signing, such as with OAuth. + + Supports an optional ``fields`` parameter of key/value strings AND + key/filetuple. A filetuple is a (filename, data, MIME type) tuple where + the MIME type is optional. For example:: + + fields = { + 'foo': 'bar', + 'fakefile': ('foofile.txt', 'contents of foofile'), + 'realfile': ('barfile.txt', open('realfile').read()), + 'typedfile': ('bazfile.bin', open('bazfile').read(), + 'image/jpeg'), + 'nonamefile': 'contents of nonamefile field', + } + + When uploading a file, providing a filename (the first parameter of the + tuple) is optional but recommended to best mimic behavior of browsers. + + Note that if ``headers`` are supplied, the 'Content-Type' header will + be overwritten because it depends on the dynamic random boundary string + which is used to compose the body of the request. The random boundary + string can be explicitly set with the ``multipart_boundary`` parameter. + + :param method: + HTTP request method (such as GET, POST, PUT, etc.) + + :param url: + The URL to perform the request on. + + :param fields: + Data to encode and send in the request body. + + :param headers: + Dictionary of custom headers to send, such as User-Agent, + If-None-Match, etc. If None, pool headers are used. If provided, + these headers completely replace any pool-specific headers. + + :param encode_multipart: + If True, encode the ``fields`` using the multipart/form-data MIME + format. + + :param multipart_boundary: + If not specified, then a random boundary will be generated using + :func:`urllib3.filepost.choose_boundary`. + """ + if headers is None: + headers = self.headers + + extra_kw: dict[str, typing.Any] = {"headers": HTTPHeaderDict(headers)} + body: bytes | str + + if fields: + if "body" in urlopen_kw: + raise TypeError( + "request got values for both 'fields' and 'body', can only specify one." + ) + + if encode_multipart: + body, content_type = encode_multipart_formdata( + fields, boundary=multipart_boundary + ) + else: + body, content_type = ( + urlencode(fields), # type: ignore[arg-type] + "application/x-www-form-urlencoded", + ) + + extra_kw["body"] = body + extra_kw["headers"].setdefault("Content-Type", content_type) + + extra_kw.update(urlopen_kw) + + return self.urlopen(method, url, **extra_kw) diff --git a/.venv/lib/python3.10/site-packages/urllib3/_version.py b/.venv/lib/python3.10/site-packages/urllib3/_version.py new file mode 100644 index 0000000000000000000000000000000000000000..268d3b984dc3861ed90b8c6aa5b2763b5bcfd729 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/_version.py @@ -0,0 +1,34 @@ +# file generated by setuptools-scm +# don't change, don't track in version control + +__all__ = [ + "__version__", + "__version_tuple__", + "version", + "version_tuple", + "__commit_id__", + "commit_id", +] + +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple + from typing import Union + + VERSION_TUPLE = Tuple[Union[int, str], ...] + COMMIT_ID = Union[str, None] +else: + VERSION_TUPLE = object + COMMIT_ID = object + +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE +commit_id: COMMIT_ID +__commit_id__: COMMIT_ID + +__version__ = version = '2.6.3' +__version_tuple__ = version_tuple = (2, 6, 3) + +__commit_id__ = commit_id = None diff --git a/.venv/lib/python3.10/site-packages/urllib3/connection.py b/.venv/lib/python3.10/site-packages/urllib3/connection.py new file mode 100644 index 0000000000000000000000000000000000000000..2ceeb0a5483bef1927a57d03c3dd2cab0d8c9f8f --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/connection.py @@ -0,0 +1,1099 @@ +from __future__ import annotations + +import datetime +import http.client +import logging +import os +import re +import socket +import sys +import threading +import typing +import warnings +from http.client import HTTPConnection as _HTTPConnection +from http.client import HTTPException as HTTPException # noqa: F401 +from http.client import ResponseNotReady +from socket import timeout as SocketTimeout + +if typing.TYPE_CHECKING: + from .response import HTTPResponse + from .util.ssl_ import _TYPE_PEER_CERT_RET_DICT + from .util.ssltransport import SSLTransport + +from ._collections import HTTPHeaderDict +from .http2 import probe as http2_probe +from .util.response import assert_header_parsing +from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT, Timeout +from .util.util import to_str +from .util.wait import wait_for_read + +try: # Compiled with SSL? + import ssl + + BaseSSLError = ssl.SSLError +except (ImportError, AttributeError): + ssl = None # type: ignore[assignment] + + class BaseSSLError(BaseException): # type: ignore[no-redef] + pass + + +from ._base_connection import _TYPE_BODY +from ._base_connection import ProxyConfig as ProxyConfig +from ._base_connection import _ResponseOptions as _ResponseOptions +from ._version import __version__ +from .exceptions import ( + ConnectTimeoutError, + HeaderParsingError, + NameResolutionError, + NewConnectionError, + ProxyError, + SystemTimeWarning, +) +from .util import SKIP_HEADER, SKIPPABLE_HEADERS, connection, ssl_ +from .util.request import body_to_chunks +from .util.ssl_ import assert_fingerprint as _assert_fingerprint +from .util.ssl_ import ( + create_urllib3_context, + is_ipaddress, + resolve_cert_reqs, + resolve_ssl_version, + ssl_wrap_socket, +) +from .util.ssl_match_hostname import CertificateError, match_hostname +from .util.url import Url + +# Not a no-op, we're adding this to the namespace so it can be imported. +ConnectionError = ConnectionError +BrokenPipeError = BrokenPipeError + + +log = logging.getLogger(__name__) + +port_by_scheme = {"http": 80, "https": 443} + +# When it comes time to update this value as a part of regular maintenance +# (ie test_recent_date is failing) update it to ~6 months before the current date. +RECENT_DATE = datetime.date(2025, 1, 1) + +_CONTAINS_CONTROL_CHAR_RE = re.compile(r"[^-!#$%&'*+.^_`|~0-9a-zA-Z]") + + +class HTTPConnection(_HTTPConnection): + """ + Based on :class:`http.client.HTTPConnection` but provides an extra constructor + backwards-compatibility layer between older and newer Pythons. + + Additional keyword parameters are used to configure attributes of the connection. + Accepted parameters include: + + - ``source_address``: Set the source address for the current connection. + - ``socket_options``: Set specific options on the underlying socket. If not specified, then + defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling + Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy. + + For example, if you wish to enable TCP Keep Alive in addition to the defaults, + you might pass: + + .. code-block:: python + + HTTPConnection.default_socket_options + [ + (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1), + ] + + Or you may want to disable the defaults by passing an empty list (e.g., ``[]``). + """ + + default_port: typing.ClassVar[int] = port_by_scheme["http"] # type: ignore[misc] + + #: Disable Nagle's algorithm by default. + #: ``[(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)]`` + default_socket_options: typing.ClassVar[connection._TYPE_SOCKET_OPTIONS] = [ + (socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + ] + + #: Whether this connection verifies the host's certificate. + is_verified: bool = False + + #: Whether this proxy connection verified the proxy host's certificate. + # If no proxy is currently connected to the value will be ``None``. + proxy_is_verified: bool | None = None + + blocksize: int + source_address: tuple[str, int] | None + socket_options: connection._TYPE_SOCKET_OPTIONS | None + + _has_connected_to_proxy: bool + _response_options: _ResponseOptions | None + _tunnel_host: str | None + _tunnel_port: int | None + _tunnel_scheme: str | None + + def __init__( + self, + host: str, + port: int | None = None, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 16384, + socket_options: None | ( + connection._TYPE_SOCKET_OPTIONS + ) = default_socket_options, + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + ) -> None: + super().__init__( + host=host, + port=port, + timeout=Timeout.resolve_default_timeout(timeout), + source_address=source_address, + blocksize=blocksize, + ) + self.socket_options = socket_options + self.proxy = proxy + self.proxy_config = proxy_config + + self._has_connected_to_proxy = False + self._response_options = None + self._tunnel_host: str | None = None + self._tunnel_port: int | None = None + self._tunnel_scheme: str | None = None + + def __str__(self) -> str: + return f"{type(self).__name__}(host={self.host!r}, port={self.port!r})" + + def __repr__(self) -> str: + return f"<{self} at {id(self):#x}>" + + @property + def host(self) -> str: + """ + Getter method to remove any trailing dots that indicate the hostname is an FQDN. + + In general, SSL certificates don't include the trailing dot indicating a + fully-qualified domain name, and thus, they don't validate properly when + checked against a domain name that includes the dot. In addition, some + servers may not expect to receive the trailing dot when provided. + + However, the hostname with trailing dot is critical to DNS resolution; doing a + lookup with the trailing dot will properly only resolve the appropriate FQDN, + whereas a lookup without a trailing dot will search the system's search domain + list. Thus, it's important to keep the original host around for use only in + those cases where it's appropriate (i.e., when doing DNS lookup to establish the + actual TCP connection across which we're going to send HTTP requests). + """ + return self._dns_host.rstrip(".") + + @host.setter + def host(self, value: str) -> None: + """ + Setter for the `host` property. + + We assume that only urllib3 uses the _dns_host attribute; httplib itself + only uses `host`, and it seems reasonable that other libraries follow suit. + """ + self._dns_host = value + + def _new_conn(self) -> socket.socket: + """Establish a socket connection and set nodelay settings on it. + + :return: New socket connection. + """ + try: + sock = connection.create_connection( + (self._dns_host, self.port), + self.timeout, + source_address=self.source_address, + socket_options=self.socket_options, + ) + except socket.gaierror as e: + raise NameResolutionError(self.host, self, e) from e + except SocketTimeout as e: + raise ConnectTimeoutError( + self, + f"Connection to {self.host} timed out. (connect timeout={self.timeout})", + ) from e + + except OSError as e: + raise NewConnectionError( + self, f"Failed to establish a new connection: {e}" + ) from e + + sys.audit("http.client.connect", self, self.host, self.port) + + return sock + + def set_tunnel( + self, + host: str, + port: int | None = None, + headers: typing.Mapping[str, str] | None = None, + scheme: str = "http", + ) -> None: + if scheme not in ("http", "https"): + raise ValueError( + f"Invalid proxy scheme for tunneling: {scheme!r}, must be either 'http' or 'https'" + ) + super().set_tunnel(host, port=port, headers=headers) + self._tunnel_scheme = scheme + + if sys.version_info < (3, 11, 9) or ((3, 12) <= sys.version_info < (3, 12, 3)): + # Taken from python/cpython#100986 which was backported in 3.11.9 and 3.12.3. + # When using connection_from_host, host will come without brackets. + def _wrap_ipv6(self, ip: bytes) -> bytes: + if b":" in ip and ip[0] != b"["[0]: + return b"[" + ip + b"]" + return ip + + if sys.version_info < (3, 11, 9): + # `_tunnel` copied from 3.11.13 backporting + # https://github.com/python/cpython/commit/0d4026432591d43185568dd31cef6a034c4b9261 + # and https://github.com/python/cpython/commit/6fbc61070fda2ffb8889e77e3b24bca4249ab4d1 + def _tunnel(self) -> None: + _MAXLINE = http.client._MAXLINE # type: ignore[attr-defined] + connect = b"CONNECT %s:%d HTTP/1.0\r\n" % ( # type: ignore[str-format] + self._wrap_ipv6(self._tunnel_host.encode("ascii")), # type: ignore[union-attr] + self._tunnel_port, + ) + headers = [connect] + for header, value in self._tunnel_headers.items(): # type: ignore[attr-defined] + headers.append(f"{header}: {value}\r\n".encode("latin-1")) + headers.append(b"\r\n") + # Making a single send() call instead of one per line encourages + # the host OS to use a more optimal packet size instead of + # potentially emitting a series of small packets. + self.send(b"".join(headers)) + del headers + + response = self.response_class(self.sock, method=self._method) # type: ignore[attr-defined] + try: + (version, code, message) = response._read_status() # type: ignore[attr-defined] + + if code != http.HTTPStatus.OK: + self.close() + raise OSError( + f"Tunnel connection failed: {code} {message.strip()}" + ) + while True: + line = response.fp.readline(_MAXLINE + 1) + if len(line) > _MAXLINE: + raise http.client.LineTooLong("header line") + if not line: + # for sites which EOF without sending a trailer + break + if line in (b"\r\n", b"\n", b""): + break + + if self.debuglevel > 0: + print("header:", line.decode()) + finally: + response.close() + + elif (3, 12) <= sys.version_info < (3, 12, 3): + # `_tunnel` copied from 3.12.11 backporting + # https://github.com/python/cpython/commit/23aef575c7629abcd4aaf028ebd226fb41a4b3c8 + def _tunnel(self) -> None: # noqa: F811 + connect = b"CONNECT %s:%d HTTP/1.1\r\n" % ( # type: ignore[str-format] + self._wrap_ipv6(self._tunnel_host.encode("idna")), # type: ignore[union-attr] + self._tunnel_port, + ) + headers = [connect] + for header, value in self._tunnel_headers.items(): # type: ignore[attr-defined] + headers.append(f"{header}: {value}\r\n".encode("latin-1")) + headers.append(b"\r\n") + # Making a single send() call instead of one per line encourages + # the host OS to use a more optimal packet size instead of + # potentially emitting a series of small packets. + self.send(b"".join(headers)) + del headers + + response = self.response_class(self.sock, method=self._method) # type: ignore[attr-defined] + try: + (version, code, message) = response._read_status() # type: ignore[attr-defined] + + self._raw_proxy_headers = http.client._read_headers(response.fp) # type: ignore[attr-defined] + + if self.debuglevel > 0: + for header in self._raw_proxy_headers: + print("header:", header.decode()) + + if code != http.HTTPStatus.OK: + self.close() + raise OSError( + f"Tunnel connection failed: {code} {message.strip()}" + ) + + finally: + response.close() + + def connect(self) -> None: + self.sock = self._new_conn() + if self._tunnel_host: + # If we're tunneling it means we're connected to our proxy. + self._has_connected_to_proxy = True + + # TODO: Fix tunnel so it doesn't depend on self.sock state. + self._tunnel() + + # If there's a proxy to be connected to we are fully connected. + # This is set twice (once above and here) due to forwarding proxies + # not using tunnelling. + self._has_connected_to_proxy = bool(self.proxy) + + if self._has_connected_to_proxy: + self.proxy_is_verified = False + + @property + def is_closed(self) -> bool: + return self.sock is None + + @property + def is_connected(self) -> bool: + if self.sock is None: + return False + return not wait_for_read(self.sock, timeout=0.0) + + @property + def has_connected_to_proxy(self) -> bool: + return self._has_connected_to_proxy + + @property + def proxy_is_forwarding(self) -> bool: + """ + Return True if a forwarding proxy is configured, else return False + """ + return bool(self.proxy) and self._tunnel_host is None + + @property + def proxy_is_tunneling(self) -> bool: + """ + Return True if a tunneling proxy is configured, else return False + """ + return self._tunnel_host is not None + + def close(self) -> None: + try: + super().close() + finally: + # Reset all stateful properties so connection + # can be re-used without leaking prior configs. + self.sock = None + self.is_verified = False + self.proxy_is_verified = None + self._has_connected_to_proxy = False + self._response_options = None + self._tunnel_host = None + self._tunnel_port = None + self._tunnel_scheme = None + + def putrequest( + self, + method: str, + url: str, + skip_host: bool = False, + skip_accept_encoding: bool = False, + ) -> None: + """""" + # Empty docstring because the indentation of CPython's implementation + # is broken but we don't want this method in our documentation. + match = _CONTAINS_CONTROL_CHAR_RE.search(method) + if match: + raise ValueError( + f"Method cannot contain non-token characters {method!r} (found at least {match.group()!r})" + ) + + return super().putrequest( + method, url, skip_host=skip_host, skip_accept_encoding=skip_accept_encoding + ) + + def putheader(self, header: str, *values: str) -> None: # type: ignore[override] + """""" + if not any(isinstance(v, str) and v == SKIP_HEADER for v in values): + super().putheader(header, *values) + elif to_str(header.lower()) not in SKIPPABLE_HEADERS: + skippable_headers = "', '".join( + [str.title(header) for header in sorted(SKIPPABLE_HEADERS)] + ) + raise ValueError( + f"urllib3.util.SKIP_HEADER only supports '{skippable_headers}'" + ) + + # `request` method's signature intentionally violates LSP. + # urllib3's API is different from `http.client.HTTPConnection` and the subclassing is only incidental. + def request( # type: ignore[override] + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + *, + chunked: bool = False, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + ) -> None: + # Update the inner socket's timeout value to send the request. + # This only triggers if the connection is re-used. + if self.sock is not None: + self.sock.settimeout(self.timeout) + + # Store these values to be fed into the HTTPResponse + # object later. TODO: Remove this in favor of a real + # HTTP lifecycle mechanism. + + # We have to store these before we call .request() + # because sometimes we can still salvage a response + # off the wire even if we aren't able to completely + # send the request body. + self._response_options = _ResponseOptions( + request_method=method, + request_url=url, + preload_content=preload_content, + decode_content=decode_content, + enforce_content_length=enforce_content_length, + ) + + if headers is None: + headers = {} + header_keys = frozenset(to_str(k.lower()) for k in headers) + skip_accept_encoding = "accept-encoding" in header_keys + skip_host = "host" in header_keys + self.putrequest( + method, url, skip_accept_encoding=skip_accept_encoding, skip_host=skip_host + ) + + # Transform the body into an iterable of sendall()-able chunks + # and detect if an explicit Content-Length is doable. + chunks_and_cl = body_to_chunks(body, method=method, blocksize=self.blocksize) + chunks = chunks_and_cl.chunks + content_length = chunks_and_cl.content_length + + # When chunked is explicit set to 'True' we respect that. + if chunked: + if "transfer-encoding" not in header_keys: + self.putheader("Transfer-Encoding", "chunked") + else: + # Detect whether a framing mechanism is already in use. If so + # we respect that value, otherwise we pick chunked vs content-length + # depending on the type of 'body'. + if "content-length" in header_keys: + chunked = False + elif "transfer-encoding" in header_keys: + chunked = True + + # Otherwise we go off the recommendation of 'body_to_chunks()'. + else: + chunked = False + if content_length is None: + if chunks is not None: + chunked = True + self.putheader("Transfer-Encoding", "chunked") + else: + self.putheader("Content-Length", str(content_length)) + + # Now that framing headers are out of the way we send all the other headers. + if "user-agent" not in header_keys: + self.putheader("User-Agent", _get_default_user_agent()) + for header, value in headers.items(): + self.putheader(header, value) + self.endheaders() + + # If we're given a body we start sending that in chunks. + if chunks is not None: + for chunk in chunks: + # Sending empty chunks isn't allowed for TE: chunked + # as it indicates the end of the body. + if not chunk: + continue + if isinstance(chunk, str): + chunk = chunk.encode("utf-8") + if chunked: + self.send(b"%x\r\n%b\r\n" % (len(chunk), chunk)) + else: + self.send(chunk) + + # Regardless of whether we have a body or not, if we're in + # chunked mode we want to send an explicit empty chunk. + if chunked: + self.send(b"0\r\n\r\n") + + def request_chunked( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + ) -> None: + """ + Alternative to the common request method, which sends the + body with chunked encoding and not as one block + """ + warnings.warn( + "HTTPConnection.request_chunked() is deprecated and will be removed " + "in urllib3 v2.1.0. Instead use HTTPConnection.request(..., chunked=True).", + category=DeprecationWarning, + stacklevel=2, + ) + self.request(method, url, body=body, headers=headers, chunked=True) + + def getresponse( # type: ignore[override] + self, + ) -> HTTPResponse: + """ + Get the response from the server. + + If the HTTPConnection is in the correct state, returns an instance of HTTPResponse or of whatever object is returned by the response_class variable. + + If a request has not been sent or if a previous response has not be handled, ResponseNotReady is raised. If the HTTP response indicates that the connection should be closed, then it will be closed before the response is returned. When the connection is closed, the underlying socket is closed. + """ + # Raise the same error as http.client.HTTPConnection + if self._response_options is None: + raise ResponseNotReady() + + # Reset this attribute for being used again. + resp_options = self._response_options + self._response_options = None + + # Since the connection's timeout value may have been updated + # we need to set the timeout on the socket. + self.sock.settimeout(self.timeout) + + # This is needed here to avoid circular import errors + from .response import HTTPResponse + + # Save a reference to the shutdown function before ownership is passed + # to httplib_response + # TODO should we implement it everywhere? + _shutdown = getattr(self.sock, "shutdown", None) + + # Get the response from http.client.HTTPConnection + httplib_response = super().getresponse() + + try: + assert_header_parsing(httplib_response.msg) + except (HeaderParsingError, TypeError) as hpe: + log.warning( + "Failed to parse headers (url=%s): %s", + _url_from_connection(self, resp_options.request_url), + hpe, + exc_info=True, + ) + + headers = HTTPHeaderDict(httplib_response.msg.items()) + + response = HTTPResponse( + body=httplib_response, + headers=headers, + status=httplib_response.status, + version=httplib_response.version, + version_string=getattr(self, "_http_vsn_str", "HTTP/?"), + reason=httplib_response.reason, + preload_content=resp_options.preload_content, + decode_content=resp_options.decode_content, + original_response=httplib_response, + enforce_content_length=resp_options.enforce_content_length, + request_method=resp_options.request_method, + request_url=resp_options.request_url, + sock_shutdown=_shutdown, + ) + return response + + +class HTTPSConnection(HTTPConnection): + """ + Many of the parameters to this constructor are passed to the underlying SSL + socket by means of :py:func:`urllib3.util.ssl_wrap_socket`. + """ + + default_port = port_by_scheme["https"] # type: ignore[misc] + + cert_reqs: int | str | None = None + ca_certs: str | None = None + ca_cert_dir: str | None = None + ca_cert_data: None | str | bytes = None + ssl_version: int | str | None = None + ssl_minimum_version: int | None = None + ssl_maximum_version: int | None = None + assert_fingerprint: str | None = None + _connect_callback: typing.Callable[..., None] | None = None + + def __init__( + self, + host: str, + port: int | None = None, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 16384, + socket_options: None | ( + connection._TYPE_SOCKET_OPTIONS + ) = HTTPConnection.default_socket_options, + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + cert_reqs: int | str | None = None, + assert_hostname: None | str | typing.Literal[False] = None, + assert_fingerprint: str | None = None, + server_hostname: str | None = None, + ssl_context: ssl.SSLContext | None = None, + ca_certs: str | None = None, + ca_cert_dir: str | None = None, + ca_cert_data: None | str | bytes = None, + ssl_minimum_version: int | None = None, + ssl_maximum_version: int | None = None, + ssl_version: int | str | None = None, # Deprecated + cert_file: str | None = None, + key_file: str | None = None, + key_password: str | None = None, + ) -> None: + super().__init__( + host, + port=port, + timeout=timeout, + source_address=source_address, + blocksize=blocksize, + socket_options=socket_options, + proxy=proxy, + proxy_config=proxy_config, + ) + + self.key_file = key_file + self.cert_file = cert_file + self.key_password = key_password + self.ssl_context = ssl_context + self.server_hostname = server_hostname + self.assert_hostname = assert_hostname + self.assert_fingerprint = assert_fingerprint + self.ssl_version = ssl_version + self.ssl_minimum_version = ssl_minimum_version + self.ssl_maximum_version = ssl_maximum_version + self.ca_certs = ca_certs and os.path.expanduser(ca_certs) + self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir) + self.ca_cert_data = ca_cert_data + + # cert_reqs depends on ssl_context so calculate last. + if cert_reqs is None: + if self.ssl_context is not None: + cert_reqs = self.ssl_context.verify_mode + else: + cert_reqs = resolve_cert_reqs(None) + self.cert_reqs = cert_reqs + self._connect_callback = None + + def set_cert( + self, + key_file: str | None = None, + cert_file: str | None = None, + cert_reqs: int | str | None = None, + key_password: str | None = None, + ca_certs: str | None = None, + assert_hostname: None | str | typing.Literal[False] = None, + assert_fingerprint: str | None = None, + ca_cert_dir: str | None = None, + ca_cert_data: None | str | bytes = None, + ) -> None: + """ + This method should only be called once, before the connection is used. + """ + warnings.warn( + "HTTPSConnection.set_cert() is deprecated and will be removed " + "in urllib3 v2.1.0. Instead provide the parameters to the " + "HTTPSConnection constructor.", + category=DeprecationWarning, + stacklevel=2, + ) + + # If cert_reqs is not provided we'll assume CERT_REQUIRED unless we also + # have an SSLContext object in which case we'll use its verify_mode. + if cert_reqs is None: + if self.ssl_context is not None: + cert_reqs = self.ssl_context.verify_mode + else: + cert_reqs = resolve_cert_reqs(None) + + self.key_file = key_file + self.cert_file = cert_file + self.cert_reqs = cert_reqs + self.key_password = key_password + self.assert_hostname = assert_hostname + self.assert_fingerprint = assert_fingerprint + self.ca_certs = ca_certs and os.path.expanduser(ca_certs) + self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir) + self.ca_cert_data = ca_cert_data + + def connect(self) -> None: + # Today we don't need to be doing this step before the /actual/ socket + # connection, however in the future we'll need to decide whether to + # create a new socket or re-use an existing "shared" socket as a part + # of the HTTP/2 handshake dance. + if self._tunnel_host is not None and self._tunnel_port is not None: + probe_http2_host = self._tunnel_host + probe_http2_port = self._tunnel_port + else: + probe_http2_host = self.host + probe_http2_port = self.port + + # Check if the target origin supports HTTP/2. + # If the value comes back as 'None' it means that the current thread + # is probing for HTTP/2 support. Otherwise, we're waiting for another + # probe to complete, or we get a value right away. + target_supports_http2: bool | None + if "h2" in ssl_.ALPN_PROTOCOLS: + target_supports_http2 = http2_probe.acquire_and_get( + host=probe_http2_host, port=probe_http2_port + ) + else: + # If HTTP/2 isn't going to be offered it doesn't matter if + # the target supports HTTP/2. Don't want to make a probe. + target_supports_http2 = False + + if self._connect_callback is not None: + self._connect_callback( + "before connect", + thread_id=threading.get_ident(), + target_supports_http2=target_supports_http2, + ) + + try: + sock: socket.socket | ssl.SSLSocket + self.sock = sock = self._new_conn() + server_hostname: str = self.host + tls_in_tls = False + + # Do we need to establish a tunnel? + if self.proxy_is_tunneling: + # We're tunneling to an HTTPS origin so need to do TLS-in-TLS. + if self._tunnel_scheme == "https": + # _connect_tls_proxy will verify and assign proxy_is_verified + self.sock = sock = self._connect_tls_proxy(self.host, sock) + tls_in_tls = True + elif self._tunnel_scheme == "http": + self.proxy_is_verified = False + + # If we're tunneling it means we're connected to our proxy. + self._has_connected_to_proxy = True + + self._tunnel() + # Override the host with the one we're requesting data from. + server_hostname = typing.cast(str, self._tunnel_host) + + if self.server_hostname is not None: + server_hostname = self.server_hostname + + is_time_off = datetime.date.today() < RECENT_DATE + if is_time_off: + warnings.warn( + ( + f"System time is way off (before {RECENT_DATE}). This will probably " + "lead to SSL verification errors" + ), + SystemTimeWarning, + ) + + # Remove trailing '.' from fqdn hostnames to allow certificate validation + server_hostname_rm_dot = server_hostname.rstrip(".") + + sock_and_verified = _ssl_wrap_socket_and_match_hostname( + sock=sock, + cert_reqs=self.cert_reqs, + ssl_version=self.ssl_version, + ssl_minimum_version=self.ssl_minimum_version, + ssl_maximum_version=self.ssl_maximum_version, + ca_certs=self.ca_certs, + ca_cert_dir=self.ca_cert_dir, + ca_cert_data=self.ca_cert_data, + cert_file=self.cert_file, + key_file=self.key_file, + key_password=self.key_password, + server_hostname=server_hostname_rm_dot, + ssl_context=self.ssl_context, + tls_in_tls=tls_in_tls, + assert_hostname=self.assert_hostname, + assert_fingerprint=self.assert_fingerprint, + ) + self.sock = sock_and_verified.socket + + # If an error occurs during connection/handshake we may need to release + # our lock so another connection can probe the origin. + except BaseException: + if self._connect_callback is not None: + self._connect_callback( + "after connect failure", + thread_id=threading.get_ident(), + target_supports_http2=target_supports_http2, + ) + + if target_supports_http2 is None: + http2_probe.set_and_release( + host=probe_http2_host, port=probe_http2_port, supports_http2=None + ) + raise + + # If this connection doesn't know if the origin supports HTTP/2 + # we report back to the HTTP/2 probe our result. + if target_supports_http2 is None: + supports_http2 = sock_and_verified.socket.selected_alpn_protocol() == "h2" + http2_probe.set_and_release( + host=probe_http2_host, + port=probe_http2_port, + supports_http2=supports_http2, + ) + + # Forwarding proxies can never have a verified target since + # the proxy is the one doing the verification. Should instead + # use a CONNECT tunnel in order to verify the target. + # See: https://github.com/urllib3/urllib3/issues/3267. + if self.proxy_is_forwarding: + self.is_verified = False + else: + self.is_verified = sock_and_verified.is_verified + + # If there's a proxy to be connected to we are fully connected. + # This is set twice (once above and here) due to forwarding proxies + # not using tunnelling. + self._has_connected_to_proxy = bool(self.proxy) + + # Set `self.proxy_is_verified` unless it's already set while + # establishing a tunnel. + if self._has_connected_to_proxy and self.proxy_is_verified is None: + self.proxy_is_verified = sock_and_verified.is_verified + + def _connect_tls_proxy(self, hostname: str, sock: socket.socket) -> ssl.SSLSocket: + """ + Establish a TLS connection to the proxy using the provided SSL context. + """ + # `_connect_tls_proxy` is called when self._tunnel_host is truthy. + proxy_config = typing.cast(ProxyConfig, self.proxy_config) + ssl_context = proxy_config.ssl_context + sock_and_verified = _ssl_wrap_socket_and_match_hostname( + sock, + cert_reqs=self.cert_reqs, + ssl_version=self.ssl_version, + ssl_minimum_version=self.ssl_minimum_version, + ssl_maximum_version=self.ssl_maximum_version, + ca_certs=self.ca_certs, + ca_cert_dir=self.ca_cert_dir, + ca_cert_data=self.ca_cert_data, + server_hostname=hostname, + ssl_context=ssl_context, + assert_hostname=proxy_config.assert_hostname, + assert_fingerprint=proxy_config.assert_fingerprint, + # Features that aren't implemented for proxies yet: + cert_file=None, + key_file=None, + key_password=None, + tls_in_tls=False, + ) + self.proxy_is_verified = sock_and_verified.is_verified + return sock_and_verified.socket # type: ignore[return-value] + + +class _WrappedAndVerifiedSocket(typing.NamedTuple): + """ + Wrapped socket and whether the connection is + verified after the TLS handshake + """ + + socket: ssl.SSLSocket | SSLTransport + is_verified: bool + + +def _ssl_wrap_socket_and_match_hostname( + sock: socket.socket, + *, + cert_reqs: None | str | int, + ssl_version: None | str | int, + ssl_minimum_version: int | None, + ssl_maximum_version: int | None, + cert_file: str | None, + key_file: str | None, + key_password: str | None, + ca_certs: str | None, + ca_cert_dir: str | None, + ca_cert_data: None | str | bytes, + assert_hostname: None | str | typing.Literal[False], + assert_fingerprint: str | None, + server_hostname: str | None, + ssl_context: ssl.SSLContext | None, + tls_in_tls: bool = False, +) -> _WrappedAndVerifiedSocket: + """Logic for constructing an SSLContext from all TLS parameters, passing + that down into ssl_wrap_socket, and then doing certificate verification + either via hostname or fingerprint. This function exists to guarantee + that both proxies and targets have the same behavior when connecting via TLS. + """ + default_ssl_context = False + if ssl_context is None: + default_ssl_context = True + context = create_urllib3_context( + ssl_version=resolve_ssl_version(ssl_version), + ssl_minimum_version=ssl_minimum_version, + ssl_maximum_version=ssl_maximum_version, + cert_reqs=resolve_cert_reqs(cert_reqs), + ) + else: + context = ssl_context + + context.verify_mode = resolve_cert_reqs(cert_reqs) + + # In some cases, we want to verify hostnames ourselves + if ( + # `ssl` can't verify fingerprints or alternate hostnames + assert_fingerprint + or assert_hostname + # assert_hostname can be set to False to disable hostname checking + or assert_hostname is False + # We still support OpenSSL 1.0.2, which prevents us from verifying + # hostnames easily: https://github.com/pyca/pyopenssl/pull/933 + or ssl_.IS_PYOPENSSL + or not ssl_.HAS_NEVER_CHECK_COMMON_NAME + ): + context.check_hostname = False + + # Try to load OS default certs if none are given. We need to do the hasattr() check + # for custom pyOpenSSL SSLContext objects because they don't support + # load_default_certs(). + if ( + not ca_certs + and not ca_cert_dir + and not ca_cert_data + and default_ssl_context + and hasattr(context, "load_default_certs") + ): + context.load_default_certs() + + # Ensure that IPv6 addresses are in the proper format and don't have a + # scope ID. Python's SSL module fails to recognize scoped IPv6 addresses + # and interprets them as DNS hostnames. + if server_hostname is not None: + normalized = server_hostname.strip("[]") + if "%" in normalized: + normalized = normalized[: normalized.rfind("%")] + if is_ipaddress(normalized): + server_hostname = normalized + + ssl_sock = ssl_wrap_socket( + sock=sock, + keyfile=key_file, + certfile=cert_file, + key_password=key_password, + ca_certs=ca_certs, + ca_cert_dir=ca_cert_dir, + ca_cert_data=ca_cert_data, + server_hostname=server_hostname, + ssl_context=context, + tls_in_tls=tls_in_tls, + ) + + try: + if assert_fingerprint: + _assert_fingerprint( + ssl_sock.getpeercert(binary_form=True), assert_fingerprint + ) + elif ( + context.verify_mode != ssl.CERT_NONE + and not context.check_hostname + and assert_hostname is not False + ): + cert: _TYPE_PEER_CERT_RET_DICT = ssl_sock.getpeercert() # type: ignore[assignment] + + # Need to signal to our match_hostname whether to use 'commonName' or not. + # If we're using our own constructed SSLContext we explicitly set 'False' + # because PyPy hard-codes 'True' from SSLContext.hostname_checks_common_name. + if default_ssl_context: + hostname_checks_common_name = False + else: + hostname_checks_common_name = ( + getattr(context, "hostname_checks_common_name", False) or False + ) + + _match_hostname( + cert, + assert_hostname or server_hostname, # type: ignore[arg-type] + hostname_checks_common_name, + ) + + return _WrappedAndVerifiedSocket( + socket=ssl_sock, + is_verified=context.verify_mode == ssl.CERT_REQUIRED + or bool(assert_fingerprint), + ) + except BaseException: + ssl_sock.close() + raise + + +def _match_hostname( + cert: _TYPE_PEER_CERT_RET_DICT | None, + asserted_hostname: str, + hostname_checks_common_name: bool = False, +) -> None: + # Our upstream implementation of ssl.match_hostname() + # only applies this normalization to IP addresses so it doesn't + # match DNS SANs so we do the same thing! + stripped_hostname = asserted_hostname.strip("[]") + if is_ipaddress(stripped_hostname): + asserted_hostname = stripped_hostname + + try: + match_hostname(cert, asserted_hostname, hostname_checks_common_name) + except CertificateError as e: + log.warning( + "Certificate did not match expected hostname: %s. Certificate: %s", + asserted_hostname, + cert, + ) + # Add cert to exception and reraise so client code can inspect + # the cert when catching the exception, if they want to + e._peer_cert = cert # type: ignore[attr-defined] + raise + + +def _wrap_proxy_error(err: Exception, proxy_scheme: str | None) -> ProxyError: + # Look for the phrase 'wrong version number', if found + # then we should warn the user that we're very sure that + # this proxy is HTTP-only and they have a configuration issue. + error_normalized = " ".join(re.split("[^a-z]", str(err).lower())) + is_likely_http_proxy = ( + "wrong version number" in error_normalized + or "unknown protocol" in error_normalized + or "record layer failure" in error_normalized + ) + http_proxy_warning = ( + ". Your proxy appears to only use HTTP and not HTTPS, " + "try changing your proxy URL to be HTTP. See: " + "https://urllib3.readthedocs.io/en/latest/advanced-usage.html" + "#https-proxy-error-http-proxy" + ) + new_err = ProxyError( + f"Unable to connect to proxy" + f"{http_proxy_warning if is_likely_http_proxy and proxy_scheme == 'https' else ''}", + err, + ) + new_err.__cause__ = err + return new_err + + +def _get_default_user_agent() -> str: + return f"python-urllib3/{__version__}" + + +class DummyConnection: + """Used to detect a failed ConnectionCls import.""" + + +if not ssl: + HTTPSConnection = DummyConnection # type: ignore[misc, assignment] # noqa: F811 + + +VerifiedHTTPSConnection = HTTPSConnection + + +def _url_from_connection( + conn: HTTPConnection | HTTPSConnection, path: str | None = None +) -> str: + """Returns the URL from a given connection. This is mainly used for testing and logging.""" + + scheme = "https" if isinstance(conn, HTTPSConnection) else "http" + + return Url(scheme=scheme, host=conn.host, port=conn.port, path=path).url diff --git a/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py b/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py new file mode 100644 index 0000000000000000000000000000000000000000..3a0685b4cdd0562e508b9dd032765b5c759ea61e --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py @@ -0,0 +1,1178 @@ +from __future__ import annotations + +import errno +import logging +import queue +import sys +import typing +import warnings +import weakref +from socket import timeout as SocketTimeout +from types import TracebackType + +from ._base_connection import _TYPE_BODY +from ._collections import HTTPHeaderDict +from ._request_methods import RequestMethods +from .connection import ( + BaseSSLError, + BrokenPipeError, + DummyConnection, + HTTPConnection, + HTTPException, + HTTPSConnection, + ProxyConfig, + _wrap_proxy_error, +) +from .connection import port_by_scheme as port_by_scheme +from .exceptions import ( + ClosedPoolError, + EmptyPoolError, + FullPoolError, + HostChangedError, + InsecureRequestWarning, + LocationValueError, + MaxRetryError, + NewConnectionError, + ProtocolError, + ProxyError, + ReadTimeoutError, + SSLError, + TimeoutError, +) +from .response import BaseHTTPResponse +from .util.connection import is_connection_dropped +from .util.proxy import connection_requires_http_tunnel +from .util.request import _TYPE_BODY_POSITION, set_file_position +from .util.retry import Retry +from .util.ssl_match_hostname import CertificateError +from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_DEFAULT, Timeout +from .util.url import Url, _encode_target +from .util.url import _normalize_host as normalize_host +from .util.url import parse_url +from .util.util import to_str + +if typing.TYPE_CHECKING: + import ssl + + from typing_extensions import Self + + from ._base_connection import BaseHTTPConnection, BaseHTTPSConnection + +log = logging.getLogger(__name__) + +_TYPE_TIMEOUT = typing.Union[Timeout, float, _TYPE_DEFAULT, None] + + +# Pool objects +class ConnectionPool: + """ + Base class for all connection pools, such as + :class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`. + + .. note:: + ConnectionPool.urlopen() does not normalize or percent-encode target URIs + which is useful if your target server doesn't support percent-encoded + target URIs. + """ + + scheme: str | None = None + QueueCls = queue.LifoQueue + + def __init__(self, host: str, port: int | None = None) -> None: + if not host: + raise LocationValueError("No host specified.") + + self.host = _normalize_host(host, scheme=self.scheme) + self.port = port + + # This property uses 'normalize_host()' (not '_normalize_host()') + # to avoid removing square braces around IPv6 addresses. + # This value is sent to `HTTPConnection.set_tunnel()` if called + # because square braces are required for HTTP CONNECT tunneling. + self._tunnel_host = normalize_host(host, scheme=self.scheme).lower() + + def __str__(self) -> str: + return f"{type(self).__name__}(host={self.host!r}, port={self.port!r})" + + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_val: BaseException | None, + exc_tb: TracebackType | None, + ) -> typing.Literal[False]: + self.close() + # Return False to re-raise any potential exceptions + return False + + def close(self) -> None: + """ + Close all pooled connections and disable the pool. + """ + + +# This is taken from http://hg.python.org/cpython/file/7aaba721ebc0/Lib/socket.py#l252 +_blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK} + + +class HTTPConnectionPool(ConnectionPool, RequestMethods): + """ + Thread-safe connection pool for one host. + + :param host: + Host used for this HTTP Connection (e.g. "localhost"), passed into + :class:`http.client.HTTPConnection`. + + :param port: + Port used for this HTTP Connection (None is equivalent to 80), passed + into :class:`http.client.HTTPConnection`. + + :param timeout: + Socket timeout in seconds for each individual connection. This can + be a float or integer, which sets the timeout for the HTTP request, + or an instance of :class:`urllib3.util.Timeout` which gives you more + fine-grained control over request timeouts. After the constructor has + been parsed, this is always a `urllib3.util.Timeout` object. + + :param maxsize: + Number of connections to save that can be reused. More than 1 is useful + in multithreaded situations. If ``block`` is set to False, more + connections will be created but they will not be saved once they've + been used. + + :param block: + If set to True, no more than ``maxsize`` connections will be used at + a time. When no free connections are available, the call will block + until a connection has been released. This is a useful side effect for + particular multithreaded situations where one does not want to use more + than maxsize connections per host to prevent flooding. + + :param headers: + Headers to include with all requests, unless other headers are given + explicitly. + + :param retries: + Retry configuration to use by default with requests in this pool. + + :param _proxy: + Parsed proxy URL, should not be used directly, instead, see + :class:`urllib3.ProxyManager` + + :param _proxy_headers: + A dictionary with proxy headers, should not be used directly, + instead, see :class:`urllib3.ProxyManager` + + :param \\**conn_kw: + Additional parameters are used to create fresh :class:`urllib3.connection.HTTPConnection`, + :class:`urllib3.connection.HTTPSConnection` instances. + """ + + scheme = "http" + ConnectionCls: type[BaseHTTPConnection] | type[BaseHTTPSConnection] = HTTPConnection + + def __init__( + self, + host: str, + port: int | None = None, + timeout: _TYPE_TIMEOUT | None = _DEFAULT_TIMEOUT, + maxsize: int = 1, + block: bool = False, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | bool | int | None = None, + _proxy: Url | None = None, + _proxy_headers: typing.Mapping[str, str] | None = None, + _proxy_config: ProxyConfig | None = None, + **conn_kw: typing.Any, + ): + ConnectionPool.__init__(self, host, port) + RequestMethods.__init__(self, headers) + + if not isinstance(timeout, Timeout): + timeout = Timeout.from_float(timeout) + + if retries is None: + retries = Retry.DEFAULT + + self.timeout = timeout + self.retries = retries + + self.pool: queue.LifoQueue[typing.Any] | None = self.QueueCls(maxsize) + self.block = block + + self.proxy = _proxy + self.proxy_headers = _proxy_headers or {} + self.proxy_config = _proxy_config + + # Fill the queue up so that doing get() on it will block properly + for _ in range(maxsize): + self.pool.put(None) + + # These are mostly for testing and debugging purposes. + self.num_connections = 0 + self.num_requests = 0 + self.conn_kw = conn_kw + + if self.proxy: + # Enable Nagle's algorithm for proxies, to avoid packet fragmentation. + # We cannot know if the user has added default socket options, so we cannot replace the + # list. + self.conn_kw.setdefault("socket_options", []) + + self.conn_kw["proxy"] = self.proxy + self.conn_kw["proxy_config"] = self.proxy_config + + # Do not pass 'self' as callback to 'finalize'. + # Then the 'finalize' would keep an endless living (leak) to self. + # By just passing a reference to the pool allows the garbage collector + # to free self if nobody else has a reference to it. + pool = self.pool + + # Close all the HTTPConnections in the pool before the + # HTTPConnectionPool object is garbage collected. + weakref.finalize(self, _close_pool_connections, pool) + + def _new_conn(self) -> BaseHTTPConnection: + """ + Return a fresh :class:`HTTPConnection`. + """ + self.num_connections += 1 + log.debug( + "Starting new HTTP connection (%d): %s:%s", + self.num_connections, + self.host, + self.port or "80", + ) + + conn = self.ConnectionCls( + host=self.host, + port=self.port, + timeout=self.timeout.connect_timeout, + **self.conn_kw, + ) + return conn + + def _get_conn(self, timeout: float | None = None) -> BaseHTTPConnection: + """ + Get a connection. Will return a pooled connection if one is available. + + If no connections are available and :prop:`.block` is ``False``, then a + fresh connection is returned. + + :param timeout: + Seconds to wait before giving up and raising + :class:`urllib3.exceptions.EmptyPoolError` if the pool is empty and + :prop:`.block` is ``True``. + """ + conn = None + + if self.pool is None: + raise ClosedPoolError(self, "Pool is closed.") + + try: + conn = self.pool.get(block=self.block, timeout=timeout) + + except AttributeError: # self.pool is None + raise ClosedPoolError(self, "Pool is closed.") from None # Defensive: + + except queue.Empty: + if self.block: + raise EmptyPoolError( + self, + "Pool is empty and a new connection can't be opened due to blocking mode.", + ) from None + pass # Oh well, we'll create a new connection then + + # If this is a persistent connection, check if it got disconnected + if conn and is_connection_dropped(conn): + log.debug("Resetting dropped connection: %s", self.host) + conn.close() + + return conn or self._new_conn() + + def _put_conn(self, conn: BaseHTTPConnection | None) -> None: + """ + Put a connection back into the pool. + + :param conn: + Connection object for the current host and port as returned by + :meth:`._new_conn` or :meth:`._get_conn`. + + If the pool is already full, the connection is closed and discarded + because we exceeded maxsize. If connections are discarded frequently, + then maxsize should be increased. + + If the pool is closed, then the connection will be closed and discarded. + """ + if self.pool is not None: + try: + self.pool.put(conn, block=False) + return # Everything is dandy, done. + except AttributeError: + # self.pool is None. + pass + except queue.Full: + # Connection never got put back into the pool, close it. + if conn: + conn.close() + + if self.block: + # This should never happen if you got the conn from self._get_conn + raise FullPoolError( + self, + "Pool reached maximum size and no more connections are allowed.", + ) from None + + log.warning( + "Connection pool is full, discarding connection: %s. Connection pool size: %s", + self.host, + self.pool.qsize(), + ) + + # Connection never got put back into the pool, close it. + if conn: + conn.close() + + def _validate_conn(self, conn: BaseHTTPConnection) -> None: + """ + Called right before a request is made, after the socket is created. + """ + + def _prepare_proxy(self, conn: BaseHTTPConnection) -> None: + # Nothing to do for HTTP connections. + pass + + def _get_timeout(self, timeout: _TYPE_TIMEOUT) -> Timeout: + """Helper that always returns a :class:`urllib3.util.Timeout`""" + if timeout is _DEFAULT_TIMEOUT: + return self.timeout.clone() + + if isinstance(timeout, Timeout): + return timeout.clone() + else: + # User passed us an int/float. This is for backwards compatibility, + # can be removed later + return Timeout.from_float(timeout) + + def _raise_timeout( + self, + err: BaseSSLError | OSError | SocketTimeout, + url: str, + timeout_value: _TYPE_TIMEOUT | None, + ) -> None: + """Is the error actually a timeout? Will raise a ReadTimeout or pass""" + + if isinstance(err, SocketTimeout): + raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={timeout_value})" + ) from err + + # See the above comment about EAGAIN in Python 3. + if hasattr(err, "errno") and err.errno in _blocking_errnos: + raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={timeout_value})" + ) from err + + def _make_request( + self, + conn: BaseHTTPConnection, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | None = None, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + chunked: bool = False, + response_conn: BaseHTTPConnection | None = None, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + ) -> BaseHTTPResponse: + """ + Perform a request on a given urllib connection object taken from our + pool. + + :param conn: + a connection from one of our connection pools + + :param method: + HTTP request method (such as GET, POST, PUT, etc.) + + :param url: + The URL to perform the request on. + + :param body: + Data to send in the request body, either :class:`str`, :class:`bytes`, + an iterable of :class:`str`/:class:`bytes`, or a file-like object. + + :param headers: + Dictionary of custom headers to send, such as User-Agent, + If-None-Match, etc. If None, pool headers are used. If provided, + these headers completely replace any pool-specific headers. + + :param retries: + Configure the number of retries to allow before raising a + :class:`~urllib3.exceptions.MaxRetryError` exception. + + Pass ``None`` to retry until you receive a response. Pass a + :class:`~urllib3.util.retry.Retry` object for fine-grained control + over different types of retries. + Pass an integer number to retry connection errors that many times, + but no other types of errors. Pass zero to never retry. + + If ``False``, then retries are disabled and any exception is raised + immediately. Also, instead of raising a MaxRetryError on redirects, + the redirect response will be returned. + + :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. + + :param timeout: + If specified, overrides the default timeout for this one + request. It may be a float (in seconds) or an instance of + :class:`urllib3.util.Timeout`. + + :param chunked: + If True, urllib3 will send the body using chunked transfer + encoding. Otherwise, urllib3 will send the body using the standard + content-length form. Defaults to False. + + :param response_conn: + Set this to ``None`` if you will handle releasing the connection or + set the connection to have the response release it. + + :param preload_content: + If True, the response's body will be preloaded during construction. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param enforce_content_length: + Enforce content length checking. Body returned by server must match + value of Content-Length header, if present. Otherwise, raise error. + """ + self.num_requests += 1 + + timeout_obj = self._get_timeout(timeout) + timeout_obj.start_connect() + conn.timeout = Timeout.resolve_default_timeout(timeout_obj.connect_timeout) + + try: + # Trigger any extra validation we need to do. + try: + self._validate_conn(conn) + except (SocketTimeout, BaseSSLError) as e: + self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) + raise + + # _validate_conn() starts the connection to an HTTPS proxy + # so we need to wrap errors with 'ProxyError' here too. + except ( + OSError, + NewConnectionError, + TimeoutError, + BaseSSLError, + CertificateError, + SSLError, + ) as e: + new_e: Exception = e + if isinstance(e, (BaseSSLError, CertificateError)): + new_e = SSLError(e) + # If the connection didn't successfully connect to it's proxy + # then there + if isinstance( + new_e, (OSError, NewConnectionError, TimeoutError, SSLError) + ) and (conn and conn.proxy and not conn.has_connected_to_proxy): + new_e = _wrap_proxy_error(new_e, conn.proxy.scheme) + raise new_e + + # conn.request() calls http.client.*.request, not the method in + # urllib3.request. It also calls makefile (recv) on the socket. + try: + conn.request( + method, + url, + body=body, + headers=headers, + chunked=chunked, + preload_content=preload_content, + decode_content=decode_content, + enforce_content_length=enforce_content_length, + ) + + # We are swallowing BrokenPipeError (errno.EPIPE) since the server is + # legitimately able to close the connection after sending a valid response. + # With this behaviour, the received response is still readable. + except BrokenPipeError: + pass + except OSError as e: + # MacOS/Linux + # EPROTOTYPE and ECONNRESET are needed on macOS + # https://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/ + # Condition changed later to emit ECONNRESET instead of only EPROTOTYPE. + if e.errno != errno.EPROTOTYPE and e.errno != errno.ECONNRESET: + raise + + # Reset the timeout for the recv() on the socket + read_timeout = timeout_obj.read_timeout + + if not conn.is_closed: + # In Python 3 socket.py will catch EAGAIN and return None when you + # try and read into the file pointer created by http.client, which + # instead raises a BadStatusLine exception. Instead of catching + # the exception and assuming all BadStatusLine exceptions are read + # timeouts, check for a zero timeout before making the request. + if read_timeout == 0: + raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={read_timeout})" + ) + conn.timeout = read_timeout + + # Receive the response from the server + try: + response = conn.getresponse() + except (BaseSSLError, OSError) as e: + self._raise_timeout(err=e, url=url, timeout_value=read_timeout) + raise + + # Set properties that are used by the pooling layer. + response.retries = retries + response._connection = response_conn # type: ignore[attr-defined] + response._pool = self # type: ignore[attr-defined] + + log.debug( + '%s://%s:%s "%s %s %s" %s %s', + self.scheme, + self.host, + self.port, + method, + url, + response.version_string, + response.status, + response.length_remaining, + ) + + return response + + def close(self) -> None: + """ + Close all pooled connections and disable the pool. + """ + if self.pool is None: + return + # Disable access to the pool + old_pool, self.pool = self.pool, None + + # Close all the HTTPConnections in the pool. + _close_pool_connections(old_pool) + + def is_same_host(self, url: str) -> bool: + """ + Check if the given ``url`` is a member of the same host as this + connection pool. + """ + if url.startswith("/"): + return True + + # TODO: Add optional support for socket.gethostbyname checking. + scheme, _, host, port, *_ = parse_url(url) + scheme = scheme or "http" + if host is not None: + host = _normalize_host(host, scheme=scheme) + + # Use explicit default port for comparison when none is given + if self.port and not port: + port = port_by_scheme.get(scheme) + elif not self.port and port == port_by_scheme.get(scheme): + port = None + + return (scheme, host, port) == (self.scheme, self.host, self.port) + + def urlopen( # type: ignore[override] + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | bool | int | None = None, + redirect: bool = True, + assert_same_host: bool = True, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + pool_timeout: int | None = None, + release_conn: bool | None = None, + chunked: bool = False, + body_pos: _TYPE_BODY_POSITION | None = None, + preload_content: bool = True, + decode_content: bool = True, + **response_kw: typing.Any, + ) -> BaseHTTPResponse: + """ + Get a connection from the pool and perform an HTTP request. This is the + lowest level call for making a request, so you'll need to specify all + the raw details. + + .. note:: + + More commonly, it's appropriate to use a convenience method + such as :meth:`request`. + + .. note:: + + `release_conn` will only behave as expected if + `preload_content=False` because we want to make + `preload_content=False` the default behaviour someday soon without + breaking backwards compatibility. + + :param method: + HTTP request method (such as GET, POST, PUT, etc.) + + :param url: + The URL to perform the request on. + + :param body: + Data to send in the request body, either :class:`str`, :class:`bytes`, + an iterable of :class:`str`/:class:`bytes`, or a file-like object. + + :param headers: + Dictionary of custom headers to send, such as User-Agent, + If-None-Match, etc. If None, pool headers are used. If provided, + these headers completely replace any pool-specific headers. + + :param retries: + Configure the number of retries to allow before raising a + :class:`~urllib3.exceptions.MaxRetryError` exception. + + If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a + :class:`~urllib3.util.retry.Retry` object for fine-grained control + over different types of retries. + Pass an integer number to retry connection errors that many times, + but no other types of errors. Pass zero to never retry. + + If ``False``, then retries are disabled and any exception is raised + immediately. Also, instead of raising a MaxRetryError on redirects, + the redirect response will be returned. + + :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. + + :param redirect: + If True, automatically handle redirects (status codes 301, 302, + 303, 307, 308). Each redirect counts as a retry. Disabling retries + will disable redirect, too. + + :param assert_same_host: + If ``True``, will make sure that the host of the pool requests is + consistent else will raise HostChangedError. When ``False``, you can + use the pool on an HTTP proxy and request foreign hosts. + + :param timeout: + If specified, overrides the default timeout for this one + request. It may be a float (in seconds) or an instance of + :class:`urllib3.util.Timeout`. + + :param pool_timeout: + If set and the pool is set to block=True, then this method will + block for ``pool_timeout`` seconds and raise EmptyPoolError if no + connection is available within the time period. + + :param bool preload_content: + If True, the response's body will be preloaded into memory. + + :param bool decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param release_conn: + If False, then the urlopen call will not release the connection + back into the pool once a response is received (but will release if + you read the entire contents of the response such as when + `preload_content=True`). This is useful if you're not preloading + the response's content immediately. You will need to call + ``r.release_conn()`` on the response ``r`` to return the connection + back into the pool. If None, it takes the value of ``preload_content`` + which defaults to ``True``. + + :param bool chunked: + If True, urllib3 will send the body using chunked transfer + encoding. Otherwise, urllib3 will send the body using the standard + content-length form. Defaults to False. + + :param int body_pos: + Position to seek to in file-like body in the event of a retry or + redirect. Typically this won't need to be set because urllib3 will + auto-populate the value when needed. + """ + parsed_url = parse_url(url) + destination_scheme = parsed_url.scheme + + if headers is None: + headers = self.headers + + if not isinstance(retries, Retry): + retries = Retry.from_int(retries, redirect=redirect, default=self.retries) + + if release_conn is None: + release_conn = preload_content + + # Check host + if assert_same_host and not self.is_same_host(url): + raise HostChangedError(self, url, retries) + + # Ensure that the URL we're connecting to is properly encoded + if url.startswith("/"): + url = to_str(_encode_target(url)) + else: + url = to_str(parsed_url.url) + + conn = None + + # Track whether `conn` needs to be released before + # returning/raising/recursing. Update this variable if necessary, and + # leave `release_conn` constant throughout the function. That way, if + # the function recurses, the original value of `release_conn` will be + # passed down into the recursive call, and its value will be respected. + # + # See issue #651 [1] for details. + # + # [1] + release_this_conn = release_conn + + http_tunnel_required = connection_requires_http_tunnel( + self.proxy, self.proxy_config, destination_scheme + ) + + # Merge the proxy headers. Only done when not using HTTP CONNECT. We + # have to copy the headers dict so we can safely change it without those + # changes being reflected in anyone else's copy. + if not http_tunnel_required: + headers = headers.copy() # type: ignore[attr-defined] + headers.update(self.proxy_headers) # type: ignore[union-attr] + + # Must keep the exception bound to a separate variable or else Python 3 + # complains about UnboundLocalError. + err = None + + # Keep track of whether we cleanly exited the except block. This + # ensures we do proper cleanup in finally. + clean_exit = False + + # Rewind body position, if needed. Record current position + # for future rewinds in the event of a redirect/retry. + body_pos = set_file_position(body, body_pos) + + try: + # Request a connection from the queue. + timeout_obj = self._get_timeout(timeout) + conn = self._get_conn(timeout=pool_timeout) + + conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] + + # Is this a closed/new connection that requires CONNECT tunnelling? + if self.proxy is not None and http_tunnel_required and conn.is_closed: + try: + self._prepare_proxy(conn) + except (BaseSSLError, OSError, SocketTimeout) as e: + self._raise_timeout( + err=e, url=self.proxy.url, timeout_value=conn.timeout + ) + raise + + # If we're going to release the connection in ``finally:``, then + # the response doesn't need to know about the connection. Otherwise + # it will also try to release it and we'll have a double-release + # mess. + response_conn = conn if not release_conn else None + + # Make the request on the HTTPConnection object + response = self._make_request( + conn, + method, + url, + timeout=timeout_obj, + body=body, + headers=headers, + chunked=chunked, + retries=retries, + response_conn=response_conn, + preload_content=preload_content, + decode_content=decode_content, + **response_kw, + ) + + # Everything went great! + clean_exit = True + + except EmptyPoolError: + # Didn't get a connection from the pool, no need to clean up + clean_exit = True + release_this_conn = False + raise + + except ( + TimeoutError, + HTTPException, + OSError, + ProtocolError, + BaseSSLError, + SSLError, + CertificateError, + ProxyError, + ) as e: + # Discard the connection for these exceptions. It will be + # replaced during the next _get_conn() call. + clean_exit = False + new_e: Exception = e + if isinstance(e, (BaseSSLError, CertificateError)): + new_e = SSLError(e) + if isinstance( + new_e, + ( + OSError, + NewConnectionError, + TimeoutError, + SSLError, + HTTPException, + ), + ) and (conn and conn.proxy and not conn.has_connected_to_proxy): + new_e = _wrap_proxy_error(new_e, conn.proxy.scheme) + elif isinstance(new_e, (OSError, HTTPException)): + new_e = ProtocolError("Connection aborted.", new_e) + + retries = retries.increment( + method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2] + ) + retries.sleep() + + # Keep track of the error for the retry warning. + err = e + + finally: + if not clean_exit: + # We hit some kind of exception, handled or otherwise. We need + # to throw the connection away unless explicitly told not to. + # Close the connection, set the variable to None, and make sure + # we put the None back in the pool to avoid leaking it. + if conn: + conn.close() + conn = None + release_this_conn = True + + if release_this_conn: + # Put the connection back to be reused. If the connection is + # expired then it will be None, which will get replaced with a + # fresh connection during _get_conn. + self._put_conn(conn) + + if not conn: + # Try again + log.warning( + "Retrying (%r) after connection broken by '%r': %s", retries, err, url + ) + return self.urlopen( + method, + url, + body, + headers, + retries, + redirect, + assert_same_host, + timeout=timeout, + pool_timeout=pool_timeout, + release_conn=release_conn, + chunked=chunked, + body_pos=body_pos, + preload_content=preload_content, + decode_content=decode_content, + **response_kw, + ) + + # Handle redirect? + redirect_location = redirect and response.get_redirect_location() + if redirect_location: + if response.status == 303: + # Change the method according to RFC 9110, Section 15.4.4. + method = "GET" + # And lose the body not to transfer anything sensitive. + body = None + headers = HTTPHeaderDict(headers)._prepare_for_method_change() + + try: + retries = retries.increment(method, url, response=response, _pool=self) + except MaxRetryError: + if retries.raise_on_redirect: + response.drain_conn() + raise + return response + + response.drain_conn() + retries.sleep_for_retry(response) + log.debug("Redirecting %s -> %s", url, redirect_location) + return self.urlopen( + method, + redirect_location, + body, + headers, + retries=retries, + redirect=redirect, + assert_same_host=assert_same_host, + timeout=timeout, + pool_timeout=pool_timeout, + release_conn=release_conn, + chunked=chunked, + body_pos=body_pos, + preload_content=preload_content, + decode_content=decode_content, + **response_kw, + ) + + # Check if we should retry the HTTP response. + has_retry_after = bool(response.headers.get("Retry-After")) + if retries.is_retry(method, response.status, has_retry_after): + try: + retries = retries.increment(method, url, response=response, _pool=self) + except MaxRetryError: + if retries.raise_on_status: + response.drain_conn() + raise + return response + + response.drain_conn() + retries.sleep(response) + log.debug("Retry: %s", url) + return self.urlopen( + method, + url, + body, + headers, + retries=retries, + redirect=redirect, + assert_same_host=assert_same_host, + timeout=timeout, + pool_timeout=pool_timeout, + release_conn=release_conn, + chunked=chunked, + body_pos=body_pos, + preload_content=preload_content, + decode_content=decode_content, + **response_kw, + ) + + return response + + +class HTTPSConnectionPool(HTTPConnectionPool): + """ + Same as :class:`.HTTPConnectionPool`, but HTTPS. + + :class:`.HTTPSConnection` uses one of ``assert_fingerprint``, + ``assert_hostname`` and ``host`` in this order to verify connections. + If ``assert_hostname`` is False, no verification is done. + + The ``key_file``, ``cert_file``, ``cert_reqs``, ``ca_certs``, + ``ca_cert_dir``, ``ssl_version``, ``key_password`` are only used if :mod:`ssl` + is available and are fed into :meth:`urllib3.util.ssl_wrap_socket` to upgrade + the connection socket into an SSL socket. + """ + + scheme = "https" + ConnectionCls: type[BaseHTTPSConnection] = HTTPSConnection + + def __init__( + self, + host: str, + port: int | None = None, + timeout: _TYPE_TIMEOUT | None = _DEFAULT_TIMEOUT, + maxsize: int = 1, + block: bool = False, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | bool | int | None = None, + _proxy: Url | None = None, + _proxy_headers: typing.Mapping[str, str] | None = None, + key_file: str | None = None, + cert_file: str | None = None, + cert_reqs: int | str | None = None, + key_password: str | None = None, + ca_certs: str | None = None, + ssl_version: int | str | None = None, + ssl_minimum_version: ssl.TLSVersion | None = None, + ssl_maximum_version: ssl.TLSVersion | None = None, + assert_hostname: str | typing.Literal[False] | None = None, + assert_fingerprint: str | None = None, + ca_cert_dir: str | None = None, + **conn_kw: typing.Any, + ) -> None: + super().__init__( + host, + port, + timeout, + maxsize, + block, + headers, + retries, + _proxy, + _proxy_headers, + **conn_kw, + ) + + self.key_file = key_file + self.cert_file = cert_file + self.cert_reqs = cert_reqs + self.key_password = key_password + self.ca_certs = ca_certs + self.ca_cert_dir = ca_cert_dir + self.ssl_version = ssl_version + self.ssl_minimum_version = ssl_minimum_version + self.ssl_maximum_version = ssl_maximum_version + self.assert_hostname = assert_hostname + self.assert_fingerprint = assert_fingerprint + + def _prepare_proxy(self, conn: HTTPSConnection) -> None: # type: ignore[override] + """Establishes a tunnel connection through HTTP CONNECT.""" + if self.proxy and self.proxy.scheme == "https": + tunnel_scheme = "https" + else: + tunnel_scheme = "http" + + conn.set_tunnel( + scheme=tunnel_scheme, + host=self._tunnel_host, + port=self.port, + headers=self.proxy_headers, + ) + conn.connect() + + def _new_conn(self) -> BaseHTTPSConnection: + """ + Return a fresh :class:`urllib3.connection.HTTPConnection`. + """ + self.num_connections += 1 + log.debug( + "Starting new HTTPS connection (%d): %s:%s", + self.num_connections, + self.host, + self.port or "443", + ) + + if not self.ConnectionCls or self.ConnectionCls is DummyConnection: # type: ignore[comparison-overlap] + raise ImportError( + "Can't connect to HTTPS URL because the SSL module is not available." + ) + + actual_host: str = self.host + actual_port = self.port + if self.proxy is not None and self.proxy.host is not None: + actual_host = self.proxy.host + actual_port = self.proxy.port + + return self.ConnectionCls( + host=actual_host, + port=actual_port, + timeout=self.timeout.connect_timeout, + cert_file=self.cert_file, + key_file=self.key_file, + key_password=self.key_password, + cert_reqs=self.cert_reqs, + ca_certs=self.ca_certs, + ca_cert_dir=self.ca_cert_dir, + assert_hostname=self.assert_hostname, + assert_fingerprint=self.assert_fingerprint, + ssl_version=self.ssl_version, + ssl_minimum_version=self.ssl_minimum_version, + ssl_maximum_version=self.ssl_maximum_version, + **self.conn_kw, + ) + + def _validate_conn(self, conn: BaseHTTPConnection) -> None: + """ + Called right before a request is made, after the socket is created. + """ + super()._validate_conn(conn) + + # Force connect early to allow us to validate the connection. + if conn.is_closed: + conn.connect() + + # TODO revise this, see https://github.com/urllib3/urllib3/issues/2791 + if not conn.is_verified and not conn.proxy_is_verified: + warnings.warn( + ( + f"Unverified HTTPS request is being made to host '{conn.host}'. " + "Adding certificate verification is strongly advised. See: " + "https://urllib3.readthedocs.io/en/latest/advanced-usage.html" + "#tls-warnings" + ), + InsecureRequestWarning, + ) + + +def connection_from_url(url: str, **kw: typing.Any) -> HTTPConnectionPool: + """ + Given a url, return an :class:`.ConnectionPool` instance of its host. + + This is a shortcut for not having to parse out the scheme, host, and port + of the url before creating an :class:`.ConnectionPool` instance. + + :param url: + Absolute URL string that must include the scheme. Port is optional. + + :param \\**kw: + Passes additional parameters to the constructor of the appropriate + :class:`.ConnectionPool`. Useful for specifying things like + timeout, maxsize, headers, etc. + + Example:: + + >>> conn = connection_from_url('http://google.com/') + >>> r = conn.request('GET', '/') + """ + scheme, _, host, port, *_ = parse_url(url) + scheme = scheme or "http" + port = port or port_by_scheme.get(scheme, 80) + if scheme == "https": + return HTTPSConnectionPool(host, port=port, **kw) # type: ignore[arg-type] + else: + return HTTPConnectionPool(host, port=port, **kw) # type: ignore[arg-type] + + +@typing.overload +def _normalize_host(host: None, scheme: str | None) -> None: ... + + +@typing.overload +def _normalize_host(host: str, scheme: str | None) -> str: ... + + +def _normalize_host(host: str | None, scheme: str | None) -> str | None: + """ + Normalize hosts for comparisons and use with sockets. + """ + + host = normalize_host(host, scheme) + + # httplib doesn't like it when we include brackets in IPv6 addresses + # Specifically, if we include brackets but also pass the port then + # httplib crazily doubles up the square brackets on the Host header. + # Instead, we need to make sure we never pass ``None`` as the port. + # However, for backward compatibility reasons we can't actually + # *assert* that. See http://bugs.python.org/issue28539 + if host and host.startswith("[") and host.endswith("]"): + host = host[1:-1] + return host + + +def _url_from_pool( + pool: HTTPConnectionPool | HTTPSConnectionPool, path: str | None = None +) -> str: + """Returns the URL from a given connection pool. This is mainly used for testing and logging.""" + return Url(scheme=pool.scheme, host=pool.host, port=pool.port, path=path).url + + +def _close_pool_connections(pool: queue.LifoQueue[typing.Any]) -> None: + """Drains a queue of connections and closes each one.""" + try: + while True: + conn = pool.get(block=False) + if conn: + conn.close() + except queue.Empty: + pass # Done. diff --git a/.venv/lib/python3.10/site-packages/urllib3/contrib/__init__.py b/.venv/lib/python3.10/site-packages/urllib3/contrib/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.venv/lib/python3.10/site-packages/urllib3/contrib/__pycache__/__init__.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/contrib/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d15dd66f5173cd94912f9590661a3004f87bac9a Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/contrib/__pycache__/__init__.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/contrib/__pycache__/socks.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/contrib/__pycache__/socks.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7312e717e48ae2444d4d7308cdf84cfa3214b1c8 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/contrib/__pycache__/socks.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/__init__.py b/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e5b62b25e932566f7ae7599c1cedec2b8f30d95b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/__init__.py @@ -0,0 +1,17 @@ +from __future__ import annotations + +import urllib3.connection + +from ...connectionpool import HTTPConnectionPool, HTTPSConnectionPool +from .connection import EmscriptenHTTPConnection, EmscriptenHTTPSConnection + + +def inject_into_urllib3() -> None: + # override connection classes to use emscripten specific classes + # n.b. mypy complains about the overriding of classes below + # if it isn't ignored + HTTPConnectionPool.ConnectionCls = EmscriptenHTTPConnection + HTTPSConnectionPool.ConnectionCls = EmscriptenHTTPSConnection + urllib3.connection.HTTPConnection = EmscriptenHTTPConnection # type: ignore[misc,assignment] + urllib3.connection.HTTPSConnection = EmscriptenHTTPSConnection # type: ignore[misc,assignment] + urllib3.connection.VerifiedHTTPSConnection = EmscriptenHTTPSConnection # type: ignore[assignment] diff --git a/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/connection.py b/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/connection.py new file mode 100644 index 0000000000000000000000000000000000000000..63f79dd3be803db09671c909f79316c3f65d6916 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/connection.py @@ -0,0 +1,260 @@ +from __future__ import annotations + +import os +import typing + +# use http.client.HTTPException for consistency with non-emscripten +from http.client import HTTPException as HTTPException # noqa: F401 +from http.client import ResponseNotReady + +from ..._base_connection import _TYPE_BODY +from ...connection import HTTPConnection, ProxyConfig, port_by_scheme +from ...exceptions import TimeoutError +from ...response import BaseHTTPResponse +from ...util.connection import _TYPE_SOCKET_OPTIONS +from ...util.timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT +from ...util.url import Url +from .fetch import _RequestError, _TimeoutError, send_request, send_streaming_request +from .request import EmscriptenRequest +from .response import EmscriptenHttpResponseWrapper, EmscriptenResponse + +if typing.TYPE_CHECKING: + from ..._base_connection import BaseHTTPConnection, BaseHTTPSConnection + + +class EmscriptenHTTPConnection: + default_port: typing.ClassVar[int] = port_by_scheme["http"] + default_socket_options: typing.ClassVar[_TYPE_SOCKET_OPTIONS] + + timeout: None | (float) + + host: str + port: int + blocksize: int + source_address: tuple[str, int] | None + socket_options: _TYPE_SOCKET_OPTIONS | None + + proxy: Url | None + proxy_config: ProxyConfig | None + + is_verified: bool = False + proxy_is_verified: bool | None = None + + response_class: type[BaseHTTPResponse] = EmscriptenHttpResponseWrapper + _response: EmscriptenResponse | None + + def __init__( + self, + host: str, + port: int = 0, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 8192, + socket_options: _TYPE_SOCKET_OPTIONS | None = None, + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + ) -> None: + self.host = host + self.port = port + self.timeout = timeout if isinstance(timeout, float) else 0.0 + self.scheme = "http" + self._closed = True + self._response = None + # ignore these things because we don't + # have control over that stuff + self.proxy = None + self.proxy_config = None + self.blocksize = blocksize + self.source_address = None + self.socket_options = None + self.is_verified = False + + def set_tunnel( + self, + host: str, + port: int | None = 0, + headers: typing.Mapping[str, str] | None = None, + scheme: str = "http", + ) -> None: + pass + + def connect(self) -> None: + pass + + def request( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + # We know *at least* botocore is depending on the order of the + # first 3 parameters so to be safe we only mark the later ones + # as keyword-only to ensure we have space to extend. + *, + chunked: bool = False, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + ) -> None: + self._closed = False + if url.startswith("/"): + if self.port is not None: + port = f":{self.port}" + else: + port = "" + # no scheme / host / port included, make a full url + url = f"{self.scheme}://{self.host}{port}{url}" + request = EmscriptenRequest( + url=url, + method=method, + timeout=self.timeout if self.timeout else 0, + decode_content=decode_content, + ) + request.set_body(body) + if headers: + for k, v in headers.items(): + request.set_header(k, v) + self._response = None + try: + if not preload_content: + self._response = send_streaming_request(request) + if self._response is None: + self._response = send_request(request) + except _TimeoutError as e: + raise TimeoutError(e.message) from e + except _RequestError as e: + raise HTTPException(e.message) from e + + def getresponse(self) -> BaseHTTPResponse: + if self._response is not None: + return EmscriptenHttpResponseWrapper( + internal_response=self._response, + url=self._response.request.url, + connection=self, + ) + else: + raise ResponseNotReady() + + def close(self) -> None: + self._closed = True + self._response = None + + @property + def is_closed(self) -> bool: + """Whether the connection either is brand new or has been previously closed. + If this property is True then both ``is_connected`` and ``has_connected_to_proxy`` + properties must be False. + """ + return self._closed + + @property + def is_connected(self) -> bool: + """Whether the connection is actively connected to any origin (proxy or target)""" + return True + + @property + def has_connected_to_proxy(self) -> bool: + """Whether the connection has successfully connected to its proxy. + This returns False if no proxy is in use. Used to determine whether + errors are coming from the proxy layer or from tunnelling to the target origin. + """ + return False + + +class EmscriptenHTTPSConnection(EmscriptenHTTPConnection): + default_port = port_by_scheme["https"] + # all this is basically ignored, as browser handles https + cert_reqs: int | str | None = None + ca_certs: str | None = None + ca_cert_dir: str | None = None + ca_cert_data: None | str | bytes = None + cert_file: str | None + key_file: str | None + key_password: str | None + ssl_context: typing.Any | None + ssl_version: int | str | None = None + ssl_minimum_version: int | None = None + ssl_maximum_version: int | None = None + assert_hostname: None | str | typing.Literal[False] + assert_fingerprint: str | None = None + + def __init__( + self, + host: str, + port: int = 0, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 16384, + socket_options: ( + None | _TYPE_SOCKET_OPTIONS + ) = HTTPConnection.default_socket_options, + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + cert_reqs: int | str | None = None, + assert_hostname: None | str | typing.Literal[False] = None, + assert_fingerprint: str | None = None, + server_hostname: str | None = None, + ssl_context: typing.Any | None = None, + ca_certs: str | None = None, + ca_cert_dir: str | None = None, + ca_cert_data: None | str | bytes = None, + ssl_minimum_version: int | None = None, + ssl_maximum_version: int | None = None, + ssl_version: int | str | None = None, # Deprecated + cert_file: str | None = None, + key_file: str | None = None, + key_password: str | None = None, + ) -> None: + super().__init__( + host, + port=port, + timeout=timeout, + source_address=source_address, + blocksize=blocksize, + socket_options=socket_options, + proxy=proxy, + proxy_config=proxy_config, + ) + self.scheme = "https" + + self.key_file = key_file + self.cert_file = cert_file + self.key_password = key_password + self.ssl_context = ssl_context + self.server_hostname = server_hostname + self.assert_hostname = assert_hostname + self.assert_fingerprint = assert_fingerprint + self.ssl_version = ssl_version + self.ssl_minimum_version = ssl_minimum_version + self.ssl_maximum_version = ssl_maximum_version + self.ca_certs = ca_certs and os.path.expanduser(ca_certs) + self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir) + self.ca_cert_data = ca_cert_data + + self.cert_reqs = None + + # The browser will automatically verify all requests. + # We have no control over that setting. + self.is_verified = True + + def set_cert( + self, + key_file: str | None = None, + cert_file: str | None = None, + cert_reqs: int | str | None = None, + key_password: str | None = None, + ca_certs: str | None = None, + assert_hostname: None | str | typing.Literal[False] = None, + assert_fingerprint: str | None = None, + ca_cert_dir: str | None = None, + ca_cert_data: None | str | bytes = None, + ) -> None: + pass + + +# verify that this class implements BaseHTTP(s) connection correctly +if typing.TYPE_CHECKING: + _supports_http_protocol: BaseHTTPConnection = EmscriptenHTTPConnection("", 0) + _supports_https_protocol: BaseHTTPSConnection = EmscriptenHTTPSConnection("", 0) diff --git a/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/emscripten_fetch_worker.js b/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/emscripten_fetch_worker.js new file mode 100644 index 0000000000000000000000000000000000000000..faf141e1fa4113a0c14480d1681ddecb9678ced4 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/emscripten_fetch_worker.js @@ -0,0 +1,110 @@ +let Status = { + SUCCESS_HEADER: -1, + SUCCESS_EOF: -2, + ERROR_TIMEOUT: -3, + ERROR_EXCEPTION: -4, +}; + +let connections = new Map(); +let nextConnectionID = 1; +const encoder = new TextEncoder(); + +self.addEventListener("message", async function (event) { + if (event.data.close) { + let connectionID = event.data.close; + connections.delete(connectionID); + return; + } else if (event.data.getMore) { + let connectionID = event.data.getMore; + let { curOffset, value, reader, intBuffer, byteBuffer } = + connections.get(connectionID); + // if we still have some in buffer, then just send it back straight away + if (!value || curOffset >= value.length) { + // read another buffer if required + try { + let readResponse = await reader.read(); + + if (readResponse.done) { + // read everything - clear connection and return + connections.delete(connectionID); + Atomics.store(intBuffer, 0, Status.SUCCESS_EOF); + Atomics.notify(intBuffer, 0); + // finished reading successfully + // return from event handler + return; + } + curOffset = 0; + connections.get(connectionID).value = readResponse.value; + value = readResponse.value; + } catch (error) { + console.log("Request exception:", error); + let errorBytes = encoder.encode(error.message); + let written = errorBytes.length; + byteBuffer.set(errorBytes); + intBuffer[1] = written; + Atomics.store(intBuffer, 0, Status.ERROR_EXCEPTION); + Atomics.notify(intBuffer, 0); + } + } + + // send as much buffer as we can + let curLen = value.length - curOffset; + if (curLen > byteBuffer.length) { + curLen = byteBuffer.length; + } + byteBuffer.set(value.subarray(curOffset, curOffset + curLen), 0); + + Atomics.store(intBuffer, 0, curLen); // store current length in bytes + Atomics.notify(intBuffer, 0); + curOffset += curLen; + connections.get(connectionID).curOffset = curOffset; + + return; + } else { + // start fetch + let connectionID = nextConnectionID; + nextConnectionID += 1; + const intBuffer = new Int32Array(event.data.buffer); + const byteBuffer = new Uint8Array(event.data.buffer, 8); + try { + const response = await fetch(event.data.url, event.data.fetchParams); + // return the headers first via textencoder + var headers = []; + for (const pair of response.headers.entries()) { + headers.push([pair[0], pair[1]]); + } + let headerObj = { + headers: headers, + status: response.status, + connectionID, + }; + const headerText = JSON.stringify(headerObj); + let headerBytes = encoder.encode(headerText); + let written = headerBytes.length; + byteBuffer.set(headerBytes); + intBuffer[1] = written; + // make a connection + connections.set(connectionID, { + reader: response.body.getReader(), + intBuffer: intBuffer, + byteBuffer: byteBuffer, + value: undefined, + curOffset: 0, + }); + // set header ready + Atomics.store(intBuffer, 0, Status.SUCCESS_HEADER); + Atomics.notify(intBuffer, 0); + // all fetching after this goes through a new postmessage call with getMore + // this allows for parallel requests + } catch (error) { + console.log("Request exception:", error); + let errorBytes = encoder.encode(error.message); + let written = errorBytes.length; + byteBuffer.set(errorBytes); + intBuffer[1] = written; + Atomics.store(intBuffer, 0, Status.ERROR_EXCEPTION); + Atomics.notify(intBuffer, 0); + } + } +}); +self.postMessage({ inited: true }); diff --git a/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/fetch.py b/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/fetch.py new file mode 100644 index 0000000000000000000000000000000000000000..612cfddc4c28d2f0edf47522278fa6d9b7906623 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/fetch.py @@ -0,0 +1,726 @@ +""" +Support for streaming http requests in emscripten. + +A few caveats - + +If your browser (or Node.js) has WebAssembly JavaScript Promise Integration enabled +https://github.com/WebAssembly/js-promise-integration/blob/main/proposals/js-promise-integration/Overview.md +*and* you launch pyodide using `pyodide.runPythonAsync`, this will fetch data using the +JavaScript asynchronous fetch api (wrapped via `pyodide.ffi.call_sync`). In this case +timeouts and streaming should just work. + +Otherwise, it uses a combination of XMLHttpRequest and a web-worker for streaming. + +This approach has several caveats: + +Firstly, you can't do streaming http in the main UI thread, because atomics.wait isn't allowed. +Streaming only works if you're running pyodide in a web worker. + +Secondly, this uses an extra web worker and SharedArrayBuffer to do the asynchronous fetch +operation, so it requires that you have crossOriginIsolation enabled, by serving over https +(or from localhost) with the two headers below set: + + Cross-Origin-Opener-Policy: same-origin + Cross-Origin-Embedder-Policy: require-corp + +You can tell if cross origin isolation is successfully enabled by looking at the global crossOriginIsolated variable in +JavaScript console. If it isn't, streaming requests will fallback to XMLHttpRequest, i.e. getting the whole +request into a buffer and then returning it. it shows a warning in the JavaScript console in this case. + +Finally, the webworker which does the streaming fetch is created on initial import, but will only be started once +control is returned to javascript. Call `await wait_for_streaming_ready()` to wait for streaming fetch. + +NB: in this code, there are a lot of JavaScript objects. They are named js_* +to make it clear what type of object they are. +""" + +from __future__ import annotations + +import io +import json +from email.parser import Parser +from importlib.resources import files +from typing import TYPE_CHECKING, Any + +import js # type: ignore[import-not-found] +from pyodide.ffi import ( # type: ignore[import-not-found] + JsArray, + JsException, + JsProxy, + to_js, +) + +if TYPE_CHECKING: + from typing_extensions import Buffer + +from .request import EmscriptenRequest +from .response import EmscriptenResponse + +""" +There are some headers that trigger unintended CORS preflight requests. +See also https://github.com/koenvo/pyodide-http/issues/22 +""" +HEADERS_TO_IGNORE = ("user-agent",) + +SUCCESS_HEADER = -1 +SUCCESS_EOF = -2 +ERROR_TIMEOUT = -3 +ERROR_EXCEPTION = -4 + + +class _RequestError(Exception): + def __init__( + self, + message: str | None = None, + *, + request: EmscriptenRequest | None = None, + response: EmscriptenResponse | None = None, + ): + self.request = request + self.response = response + self.message = message + super().__init__(self.message) + + +class _StreamingError(_RequestError): + pass + + +class _TimeoutError(_RequestError): + pass + + +def _obj_from_dict(dict_val: dict[str, Any]) -> JsProxy: + return to_js(dict_val, dict_converter=js.Object.fromEntries) + + +class _ReadStream(io.RawIOBase): + def __init__( + self, + int_buffer: JsArray, + byte_buffer: JsArray, + timeout: float, + worker: JsProxy, + connection_id: int, + request: EmscriptenRequest, + ): + self.int_buffer = int_buffer + self.byte_buffer = byte_buffer + self.read_pos = 0 + self.read_len = 0 + self.connection_id = connection_id + self.worker = worker + self.timeout = int(1000 * timeout) if timeout > 0 else None + self.is_live = True + self._is_closed = False + self.request: EmscriptenRequest | None = request + + def __del__(self) -> None: + self.close() + + # this is compatible with _base_connection + def is_closed(self) -> bool: + return self._is_closed + + # for compatibility with RawIOBase + @property + def closed(self) -> bool: + return self.is_closed() + + def close(self) -> None: + if self.is_closed(): + return + self.read_len = 0 + self.read_pos = 0 + self.int_buffer = None + self.byte_buffer = None + self._is_closed = True + self.request = None + if self.is_live: + self.worker.postMessage(_obj_from_dict({"close": self.connection_id})) + self.is_live = False + super().close() + + def readable(self) -> bool: + return True + + def writable(self) -> bool: + return False + + def seekable(self) -> bool: + return False + + def readinto(self, byte_obj: Buffer) -> int: + if not self.int_buffer: + raise _StreamingError( + "No buffer for stream in _ReadStream.readinto", + request=self.request, + response=None, + ) + if self.read_len == 0: + # wait for the worker to send something + js.Atomics.store(self.int_buffer, 0, ERROR_TIMEOUT) + self.worker.postMessage(_obj_from_dict({"getMore": self.connection_id})) + if ( + js.Atomics.wait(self.int_buffer, 0, ERROR_TIMEOUT, self.timeout) + == "timed-out" + ): + raise _TimeoutError + data_len = self.int_buffer[0] + if data_len > 0: + self.read_len = data_len + self.read_pos = 0 + elif data_len == ERROR_EXCEPTION: + string_len = self.int_buffer[1] + # decode the error string + js_decoder = js.TextDecoder.new() + json_str = js_decoder.decode(self.byte_buffer.slice(0, string_len)) + raise _StreamingError( + f"Exception thrown in fetch: {json_str}", + request=self.request, + response=None, + ) + else: + # EOF, free the buffers and return zero + # and free the request + self.is_live = False + self.close() + return 0 + # copy from int32array to python bytes + ret_length = min(self.read_len, len(memoryview(byte_obj))) + subarray = self.byte_buffer.subarray( + self.read_pos, self.read_pos + ret_length + ).to_py() + memoryview(byte_obj)[0:ret_length] = subarray + self.read_len -= ret_length + self.read_pos += ret_length + return ret_length + + +class _StreamingFetcher: + def __init__(self) -> None: + # make web-worker and data buffer on startup + self.streaming_ready = False + streaming_worker_code = ( + files(__package__) + .joinpath("emscripten_fetch_worker.js") + .read_text(encoding="utf-8") + ) + js_data_blob = js.Blob.new( + to_js([streaming_worker_code], create_pyproxies=False), + _obj_from_dict({"type": "application/javascript"}), + ) + + def promise_resolver(js_resolve_fn: JsProxy, js_reject_fn: JsProxy) -> None: + def onMsg(e: JsProxy) -> None: + self.streaming_ready = True + js_resolve_fn(e) + + def onErr(e: JsProxy) -> None: + js_reject_fn(e) # Defensive: never happens in ci + + self.js_worker.onmessage = onMsg + self.js_worker.onerror = onErr + + js_data_url = js.URL.createObjectURL(js_data_blob) + self.js_worker = js.globalThis.Worker.new(js_data_url) + self.js_worker_ready_promise = js.globalThis.Promise.new(promise_resolver) + + def send(self, request: EmscriptenRequest) -> EmscriptenResponse: + headers = { + k: v for k, v in request.headers.items() if k not in HEADERS_TO_IGNORE + } + + body = request.body + fetch_data = {"headers": headers, "body": to_js(body), "method": request.method} + # start the request off in the worker + timeout = int(1000 * request.timeout) if request.timeout > 0 else None + js_shared_buffer = js.SharedArrayBuffer.new(1048576) + js_int_buffer = js.Int32Array.new(js_shared_buffer) + js_byte_buffer = js.Uint8Array.new(js_shared_buffer, 8) + + js.Atomics.store(js_int_buffer, 0, ERROR_TIMEOUT) + js.Atomics.notify(js_int_buffer, 0) + js_absolute_url = js.URL.new(request.url, js.location).href + self.js_worker.postMessage( + _obj_from_dict( + { + "buffer": js_shared_buffer, + "url": js_absolute_url, + "fetchParams": fetch_data, + } + ) + ) + # wait for the worker to send something + js.Atomics.wait(js_int_buffer, 0, ERROR_TIMEOUT, timeout) + if js_int_buffer[0] == ERROR_TIMEOUT: + raise _TimeoutError( + "Timeout connecting to streaming request", + request=request, + response=None, + ) + elif js_int_buffer[0] == SUCCESS_HEADER: + # got response + # header length is in second int of intBuffer + string_len = js_int_buffer[1] + # decode the rest to a JSON string + js_decoder = js.TextDecoder.new() + # this does a copy (the slice) because decode can't work on shared array + # for some silly reason + json_str = js_decoder.decode(js_byte_buffer.slice(0, string_len)) + # get it as an object + response_obj = json.loads(json_str) + return EmscriptenResponse( + request=request, + status_code=response_obj["status"], + headers=response_obj["headers"], + body=_ReadStream( + js_int_buffer, + js_byte_buffer, + request.timeout, + self.js_worker, + response_obj["connectionID"], + request, + ), + ) + elif js_int_buffer[0] == ERROR_EXCEPTION: + string_len = js_int_buffer[1] + # decode the error string + js_decoder = js.TextDecoder.new() + json_str = js_decoder.decode(js_byte_buffer.slice(0, string_len)) + raise _StreamingError( + f"Exception thrown in fetch: {json_str}", request=request, response=None + ) + else: + raise _StreamingError( + f"Unknown status from worker in fetch: {js_int_buffer[0]}", + request=request, + response=None, + ) + + +class _JSPIReadStream(io.RawIOBase): + """ + A read stream that uses pyodide.ffi.run_sync to read from a JavaScript fetch + response. This requires support for WebAssembly JavaScript Promise Integration + in the containing browser, and for pyodide to be launched via runPythonAsync. + + :param js_read_stream: + The JavaScript stream reader + + :param timeout: + Timeout in seconds + + :param request: + The request we're handling + + :param response: + The response this stream relates to + + :param js_abort_controller: + A JavaScript AbortController object, used for timeouts + """ + + def __init__( + self, + js_read_stream: Any, + timeout: float, + request: EmscriptenRequest, + response: EmscriptenResponse, + js_abort_controller: Any, # JavaScript AbortController for timeouts + ): + self.js_read_stream = js_read_stream + self.timeout = timeout + self._is_closed = False + self._is_done = False + self.request: EmscriptenRequest | None = request + self.response: EmscriptenResponse | None = response + self.current_buffer = None + self.current_buffer_pos = 0 + self.js_abort_controller = js_abort_controller + + def __del__(self) -> None: + self.close() + + # this is compatible with _base_connection + def is_closed(self) -> bool: + return self._is_closed + + # for compatibility with RawIOBase + @property + def closed(self) -> bool: + return self.is_closed() + + def close(self) -> None: + if self.is_closed(): + return + self.read_len = 0 + self.read_pos = 0 + self.js_read_stream.cancel() + self.js_read_stream = None + self._is_closed = True + self._is_done = True + self.request = None + self.response = None + super().close() + + def readable(self) -> bool: + return True + + def writable(self) -> bool: + return False + + def seekable(self) -> bool: + return False + + def _get_next_buffer(self) -> bool: + result_js = _run_sync_with_timeout( + self.js_read_stream.read(), + self.timeout, + self.js_abort_controller, + request=self.request, + response=self.response, + ) + if result_js.done: + self._is_done = True + return False + else: + self.current_buffer = result_js.value.to_py() + self.current_buffer_pos = 0 + return True + + def readinto(self, byte_obj: Buffer) -> int: + if self.current_buffer is None: + if not self._get_next_buffer() or self.current_buffer is None: + self.close() + return 0 + ret_length = min( + len(byte_obj), len(self.current_buffer) - self.current_buffer_pos + ) + byte_obj[0:ret_length] = self.current_buffer[ + self.current_buffer_pos : self.current_buffer_pos + ret_length + ] + self.current_buffer_pos += ret_length + if self.current_buffer_pos == len(self.current_buffer): + self.current_buffer = None + return ret_length + + +# check if we are in a worker or not +def is_in_browser_main_thread() -> bool: + return hasattr(js, "window") and hasattr(js, "self") and js.self == js.window + + +def is_cross_origin_isolated() -> bool: + return hasattr(js, "crossOriginIsolated") and js.crossOriginIsolated + + +def is_in_node() -> bool: + return ( + hasattr(js, "process") + and hasattr(js.process, "release") + and hasattr(js.process.release, "name") + and js.process.release.name == "node" + ) + + +def is_worker_available() -> bool: + return hasattr(js, "Worker") and hasattr(js, "Blob") + + +_fetcher: _StreamingFetcher | None = None + +if is_worker_available() and ( + (is_cross_origin_isolated() and not is_in_browser_main_thread()) + and (not is_in_node()) +): + _fetcher = _StreamingFetcher() +else: + _fetcher = None + + +NODE_JSPI_ERROR = ( + "urllib3 only works in Node.js with pyodide.runPythonAsync" + " and requires the flag --experimental-wasm-stack-switching in " + " versions of node <24." +) + + +def send_streaming_request(request: EmscriptenRequest) -> EmscriptenResponse | None: + if has_jspi(): + return send_jspi_request(request, True) + elif is_in_node(): + raise _RequestError( + message=NODE_JSPI_ERROR, + request=request, + response=None, + ) + + if _fetcher and streaming_ready(): + return _fetcher.send(request) + else: + _show_streaming_warning() + return None + + +_SHOWN_TIMEOUT_WARNING = False + + +def _show_timeout_warning() -> None: + global _SHOWN_TIMEOUT_WARNING + if not _SHOWN_TIMEOUT_WARNING: + _SHOWN_TIMEOUT_WARNING = True + message = "Warning: Timeout is not available on main browser thread" + js.console.warn(message) + + +_SHOWN_STREAMING_WARNING = False + + +def _show_streaming_warning() -> None: + global _SHOWN_STREAMING_WARNING + if not _SHOWN_STREAMING_WARNING: + _SHOWN_STREAMING_WARNING = True + message = "Can't stream HTTP requests because: \n" + if not is_cross_origin_isolated(): + message += " Page is not cross-origin isolated\n" + if is_in_browser_main_thread(): + message += " Python is running in main browser thread\n" + if not is_worker_available(): + message += " Worker or Blob classes are not available in this environment." # Defensive: this is always False in browsers that we test in + if streaming_ready() is False: + message += """ Streaming fetch worker isn't ready. If you want to be sure that streaming fetch +is working, you need to call: 'await urllib3.contrib.emscripten.fetch.wait_for_streaming_ready()`""" + from js import console + + console.warn(message) + + +def send_request(request: EmscriptenRequest) -> EmscriptenResponse: + if has_jspi(): + return send_jspi_request(request, False) + elif is_in_node(): + raise _RequestError( + message=NODE_JSPI_ERROR, + request=request, + response=None, + ) + try: + js_xhr = js.XMLHttpRequest.new() + + if not is_in_browser_main_thread(): + js_xhr.responseType = "arraybuffer" + if request.timeout: + js_xhr.timeout = int(request.timeout * 1000) + else: + js_xhr.overrideMimeType("text/plain; charset=ISO-8859-15") + if request.timeout: + # timeout isn't available on the main thread - show a warning in console + # if it is set + _show_timeout_warning() + + js_xhr.open(request.method, request.url, False) + for name, value in request.headers.items(): + if name.lower() not in HEADERS_TO_IGNORE: + js_xhr.setRequestHeader(name, value) + + js_xhr.send(to_js(request.body)) + + headers = dict(Parser().parsestr(js_xhr.getAllResponseHeaders())) + + if not is_in_browser_main_thread(): + body = js_xhr.response.to_py().tobytes() + else: + body = js_xhr.response.encode("ISO-8859-15") + return EmscriptenResponse( + status_code=js_xhr.status, headers=headers, body=body, request=request + ) + except JsException as err: + if err.name == "TimeoutError": + raise _TimeoutError(err.message, request=request) + elif err.name == "NetworkError": + raise _RequestError(err.message, request=request) + else: + # general http error + raise _RequestError(err.message, request=request) + + +def send_jspi_request( + request: EmscriptenRequest, streaming: bool +) -> EmscriptenResponse: + """ + Send a request using WebAssembly JavaScript Promise Integration + to wrap the asynchronous JavaScript fetch api (experimental). + + :param request: + Request to send + + :param streaming: + Whether to stream the response + + :return: The response object + :rtype: EmscriptenResponse + """ + timeout = request.timeout + js_abort_controller = js.AbortController.new() + headers = {k: v for k, v in request.headers.items() if k not in HEADERS_TO_IGNORE} + req_body = request.body + fetch_data = { + "headers": headers, + "body": to_js(req_body), + "method": request.method, + "signal": js_abort_controller.signal, + } + # Node.js returns the whole response (unlike opaqueredirect in browsers), + # so urllib3 can set `redirect: manual` to control redirects itself. + # https://stackoverflow.com/a/78524615 + if _is_node_js(): + fetch_data["redirect"] = "manual" + # Call JavaScript fetch (async api, returns a promise) + fetcher_promise_js = js.fetch(request.url, _obj_from_dict(fetch_data)) + # Now suspend WebAssembly until we resolve that promise + # or time out. + response_js = _run_sync_with_timeout( + fetcher_promise_js, + timeout, + js_abort_controller, + request=request, + response=None, + ) + headers = {} + header_iter = response_js.headers.entries() + while True: + iter_value_js = header_iter.next() + if getattr(iter_value_js, "done", False): + break + else: + headers[str(iter_value_js.value[0])] = str(iter_value_js.value[1]) + status_code = response_js.status + body: bytes | io.RawIOBase = b"" + + response = EmscriptenResponse( + status_code=status_code, headers=headers, body=b"", request=request + ) + if streaming: + # get via inputstream + if response_js.body is not None: + # get a reader from the fetch response + body_stream_js = response_js.body.getReader() + body = _JSPIReadStream( + body_stream_js, timeout, request, response, js_abort_controller + ) + else: + # get directly via arraybuffer + # n.b. this is another async JavaScript call. + body = _run_sync_with_timeout( + response_js.arrayBuffer(), + timeout, + js_abort_controller, + request=request, + response=response, + ).to_py() + response.body = body + return response + + +def _run_sync_with_timeout( + promise: Any, + timeout: float, + js_abort_controller: Any, + request: EmscriptenRequest | None, + response: EmscriptenResponse | None, +) -> Any: + """ + Await a JavaScript promise synchronously with a timeout which is implemented + via the AbortController + + :param promise: + Javascript promise to await + + :param timeout: + Timeout in seconds + + :param js_abort_controller: + A JavaScript AbortController object, used on timeout + + :param request: + The request being handled + + :param response: + The response being handled (if it exists yet) + + :raises _TimeoutError: If the request times out + :raises _RequestError: If the request raises a JavaScript exception + + :return: The result of awaiting the promise. + """ + timer_id = None + if timeout > 0: + timer_id = js.setTimeout( + js_abort_controller.abort.bind(js_abort_controller), int(timeout * 1000) + ) + try: + from pyodide.ffi import run_sync + + # run_sync here uses WebAssembly JavaScript Promise Integration to + # suspend python until the JavaScript promise resolves. + return run_sync(promise) + except JsException as err: + if err.name == "AbortError": + raise _TimeoutError( + message="Request timed out", request=request, response=response + ) + else: + raise _RequestError(message=err.message, request=request, response=response) + finally: + if timer_id is not None: + js.clearTimeout(timer_id) + + +def has_jspi() -> bool: + """ + Return true if jspi can be used. + + This requires both browser support and also WebAssembly + to be in the correct state - i.e. that the javascript + call into python was async not sync. + + :return: True if jspi can be used. + :rtype: bool + """ + try: + from pyodide.ffi import can_run_sync, run_sync # noqa: F401 + + return bool(can_run_sync()) + except ImportError: + return False + + +def _is_node_js() -> bool: + """ + Check if we are in Node.js. + + :return: True if we are in Node.js. + :rtype: bool + """ + return ( + hasattr(js, "process") + and hasattr(js.process, "release") + # According to the Node.js documentation, the release name is always "node". + and js.process.release.name == "node" + ) + + +def streaming_ready() -> bool | None: + if _fetcher: + return _fetcher.streaming_ready + else: + return None # no fetcher, return None to signify that + + +async def wait_for_streaming_ready() -> bool: + if _fetcher: + await _fetcher.js_worker_ready_promise + return True + else: + return False diff --git a/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/request.py b/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/request.py new file mode 100644 index 0000000000000000000000000000000000000000..e692e692bd0d38f6a0677992a6993fc68050dff3 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/request.py @@ -0,0 +1,22 @@ +from __future__ import annotations + +from dataclasses import dataclass, field + +from ..._base_connection import _TYPE_BODY + + +@dataclass +class EmscriptenRequest: + method: str + url: str + params: dict[str, str] | None = None + body: _TYPE_BODY | None = None + headers: dict[str, str] = field(default_factory=dict) + timeout: float = 0 + decode_content: bool = True + + def set_header(self, name: str, value: str) -> None: + self.headers[name.capitalize()] = value + + def set_body(self, body: _TYPE_BODY | None) -> None: + self.body = body diff --git a/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/response.py b/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/response.py new file mode 100644 index 0000000000000000000000000000000000000000..cb1088a1826d089e1b603c51e85560b8583a3e3d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/contrib/emscripten/response.py @@ -0,0 +1,277 @@ +from __future__ import annotations + +import json as _json +import logging +import typing +from contextlib import contextmanager +from dataclasses import dataclass +from http.client import HTTPException as HTTPException +from io import BytesIO, IOBase + +from ...exceptions import InvalidHeader, TimeoutError +from ...response import BaseHTTPResponse +from ...util.retry import Retry +from .request import EmscriptenRequest + +if typing.TYPE_CHECKING: + from ..._base_connection import BaseHTTPConnection, BaseHTTPSConnection + +log = logging.getLogger(__name__) + + +@dataclass +class EmscriptenResponse: + status_code: int + headers: dict[str, str] + body: IOBase | bytes + request: EmscriptenRequest + + +class EmscriptenHttpResponseWrapper(BaseHTTPResponse): + def __init__( + self, + internal_response: EmscriptenResponse, + url: str | None = None, + connection: BaseHTTPConnection | BaseHTTPSConnection | None = None, + ): + self._pool = None # set by pool class + self._body = None + self._response = internal_response + self._url = url + self._connection = connection + self._closed = False + super().__init__( + headers=internal_response.headers, + status=internal_response.status_code, + request_url=url, + version=0, + version_string="HTTP/?", + reason="", + decode_content=True, + ) + self.length_remaining = self._init_length(self._response.request.method) + self.length_is_certain = False + + @property + def url(self) -> str | None: + return self._url + + @url.setter + def url(self, url: str | None) -> None: + self._url = url + + @property + def connection(self) -> BaseHTTPConnection | BaseHTTPSConnection | None: + return self._connection + + @property + def retries(self) -> Retry | None: + return self._retries + + @retries.setter + def retries(self, retries: Retry | None) -> None: + # Override the request_url if retries has a redirect location. + self._retries = retries + + def stream( + self, amt: int | None = 2**16, decode_content: bool | None = None + ) -> typing.Generator[bytes]: + """ + A generator wrapper for the read() method. A call will block until + ``amt`` bytes have been read from the connection or until the + connection is closed. + + :param amt: + How much of the content to read. The generator will return up to + much data per iteration, but may return less. This is particularly + likely when using compressed data. However, the empty string will + never be returned. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + """ + while True: + data = self.read(amt=amt, decode_content=decode_content) + + if data: + yield data + else: + break + + def _init_length(self, request_method: str | None) -> int | None: + length: int | None + content_length: str | None = self.headers.get("content-length") + + if content_length is not None: + try: + # RFC 7230 section 3.3.2 specifies multiple content lengths can + # be sent in a single Content-Length header + # (e.g. Content-Length: 42, 42). This line ensures the values + # are all valid ints and that as long as the `set` length is 1, + # all values are the same. Otherwise, the header is invalid. + lengths = {int(val) for val in content_length.split(",")} + if len(lengths) > 1: + raise InvalidHeader( + "Content-Length contained multiple " + "unmatching values (%s)" % content_length + ) + length = lengths.pop() + except ValueError: + length = None + else: + if length < 0: + length = None + + else: # if content_length is None + length = None + + # Check for responses that shouldn't include a body + if ( + self.status in (204, 304) + or 100 <= self.status < 200 + or request_method == "HEAD" + ): + length = 0 + + return length + + def read( + self, + amt: int | None = None, + decode_content: bool | None = None, # ignored because browser decodes always + cache_content: bool = False, + ) -> bytes: + if ( + self._closed + or self._response is None + or (isinstance(self._response.body, IOBase) and self._response.body.closed) + ): + return b"" + + with self._error_catcher(): + # body has been preloaded as a string by XmlHttpRequest + if not isinstance(self._response.body, IOBase): + self.length_remaining = len(self._response.body) + self.length_is_certain = True + # wrap body in IOStream + self._response.body = BytesIO(self._response.body) + if amt is not None and amt >= 0: + # don't cache partial content + cache_content = False + data = self._response.body.read(amt) + else: # read all we can (and cache it) + data = self._response.body.read() + if cache_content: + self._body = data + if self.length_remaining is not None: + self.length_remaining = max(self.length_remaining - len(data), 0) + if len(data) == 0 or ( + self.length_is_certain and self.length_remaining == 0 + ): + # definitely finished reading, close response stream + self._response.body.close() + return typing.cast(bytes, data) + + def read_chunked( + self, + amt: int | None = None, + decode_content: bool | None = None, + ) -> typing.Generator[bytes]: + # chunked is handled by browser + while True: + bytes = self.read(amt, decode_content) + if not bytes: + break + yield bytes + + def release_conn(self) -> None: + if not self._pool or not self._connection: + return None + + self._pool._put_conn(self._connection) + self._connection = None + + def drain_conn(self) -> None: + self.close() + + @property + def data(self) -> bytes: + if self._body: + return self._body + else: + return self.read(cache_content=True) + + def json(self) -> typing.Any: + """ + Deserializes the body of the HTTP response as a Python object. + + The body of the HTTP response must be encoded using UTF-8, as per + `RFC 8529 Section 8.1 `_. + + To use a custom JSON decoder pass the result of :attr:`HTTPResponse.data` to + your custom decoder instead. + + If the body of the HTTP response is not decodable to UTF-8, a + `UnicodeDecodeError` will be raised. If the body of the HTTP response is not a + valid JSON document, a `json.JSONDecodeError` will be raised. + + Read more :ref:`here `. + + :returns: The body of the HTTP response as a Python object. + """ + data = self.data.decode("utf-8") + return _json.loads(data) + + def close(self) -> None: + if not self._closed: + if isinstance(self._response.body, IOBase): + self._response.body.close() + if self._connection: + self._connection.close() + self._connection = None + self._closed = True + + @contextmanager + def _error_catcher(self) -> typing.Generator[None]: + """ + Catch Emscripten specific exceptions thrown by fetch.py, + instead re-raising urllib3 variants, so that low-level exceptions + are not leaked in the high-level api. + + On exit, release the connection back to the pool. + """ + from .fetch import _RequestError, _TimeoutError # avoid circular import + + clean_exit = False + + try: + yield + # If no exception is thrown, we should avoid cleaning up + # unnecessarily. + clean_exit = True + except _TimeoutError as e: + raise TimeoutError(str(e)) + except _RequestError as e: + raise HTTPException(str(e)) + finally: + # If we didn't terminate cleanly, we need to throw away our + # connection. + if not clean_exit: + # The response may not be closed but we're not going to use it + # anymore so close it now + if ( + isinstance(self._response.body, IOBase) + and not self._response.body.closed + ): + self._response.body.close() + # release the connection back to the pool + self.release_conn() + else: + # If we have read everything from the response stream, + # return the connection back to the pool. + if ( + isinstance(self._response.body, IOBase) + and self._response.body.closed + ): + self.release_conn() diff --git a/.venv/lib/python3.10/site-packages/urllib3/contrib/pyopenssl.py b/.venv/lib/python3.10/site-packages/urllib3/contrib/pyopenssl.py new file mode 100644 index 0000000000000000000000000000000000000000..8e05d3d785d53021a97a713cbdbb1f43708c9150 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/contrib/pyopenssl.py @@ -0,0 +1,564 @@ +""" +Module for using pyOpenSSL as a TLS backend. This module was relevant before +the standard library ``ssl`` module supported SNI, but now that we've dropped +support for Python 2.7 all relevant Python versions support SNI so +**this module is no longer recommended**. + +This needs the following packages installed: + +* `pyOpenSSL`_ (tested with 16.0.0) +* `cryptography`_ (minimum 1.3.4, from pyopenssl) +* `idna`_ (minimum 2.0) + +However, pyOpenSSL depends on cryptography, so while we use all three directly here we +end up having relatively few packages required. + +You can install them with the following command: + +.. code-block:: bash + + $ python -m pip install pyopenssl cryptography idna + +To activate certificate checking, call +:func:`~urllib3.contrib.pyopenssl.inject_into_urllib3` from your Python code +before you begin making HTTP requests. This can be done in a ``sitecustomize`` +module, or at any other time before your application begins using ``urllib3``, +like this: + +.. code-block:: python + + try: + import urllib3.contrib.pyopenssl + urllib3.contrib.pyopenssl.inject_into_urllib3() + except ImportError: + pass + +.. _pyopenssl: https://www.pyopenssl.org +.. _cryptography: https://cryptography.io +.. _idna: https://github.com/kjd/idna +""" + +from __future__ import annotations + +import OpenSSL.SSL # type: ignore[import-not-found] +from cryptography import x509 + +try: + from cryptography.x509 import UnsupportedExtension # type: ignore[attr-defined] +except ImportError: + # UnsupportedExtension is gone in cryptography >= 2.1.0 + class UnsupportedExtension(Exception): # type: ignore[no-redef] + pass + + +import logging +import ssl +import typing +from io import BytesIO +from socket import socket as socket_cls +from socket import timeout + +from .. import util + +if typing.TYPE_CHECKING: + from OpenSSL.crypto import X509 # type: ignore[import-not-found] + + +__all__ = ["inject_into_urllib3", "extract_from_urllib3"] + +# Map from urllib3 to PyOpenSSL compatible parameter-values. +_openssl_versions: dict[int, int] = { + util.ssl_.PROTOCOL_TLS: OpenSSL.SSL.SSLv23_METHOD, # type: ignore[attr-defined] + util.ssl_.PROTOCOL_TLS_CLIENT: OpenSSL.SSL.SSLv23_METHOD, # type: ignore[attr-defined] + ssl.PROTOCOL_TLSv1: OpenSSL.SSL.TLSv1_METHOD, +} + +if hasattr(ssl, "PROTOCOL_TLSv1_1") and hasattr(OpenSSL.SSL, "TLSv1_1_METHOD"): + _openssl_versions[ssl.PROTOCOL_TLSv1_1] = OpenSSL.SSL.TLSv1_1_METHOD + +if hasattr(ssl, "PROTOCOL_TLSv1_2") and hasattr(OpenSSL.SSL, "TLSv1_2_METHOD"): + _openssl_versions[ssl.PROTOCOL_TLSv1_2] = OpenSSL.SSL.TLSv1_2_METHOD + + +_stdlib_to_openssl_verify = { + ssl.CERT_NONE: OpenSSL.SSL.VERIFY_NONE, + ssl.CERT_OPTIONAL: OpenSSL.SSL.VERIFY_PEER, + ssl.CERT_REQUIRED: OpenSSL.SSL.VERIFY_PEER + + OpenSSL.SSL.VERIFY_FAIL_IF_NO_PEER_CERT, +} +_openssl_to_stdlib_verify = {v: k for k, v in _stdlib_to_openssl_verify.items()} + +# The SSLvX values are the most likely to be missing in the future +# but we check them all just to be sure. +_OP_NO_SSLv2_OR_SSLv3: int = getattr(OpenSSL.SSL, "OP_NO_SSLv2", 0) | getattr( + OpenSSL.SSL, "OP_NO_SSLv3", 0 +) +_OP_NO_TLSv1: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1", 0) +_OP_NO_TLSv1_1: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1_1", 0) +_OP_NO_TLSv1_2: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1_2", 0) +_OP_NO_TLSv1_3: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1_3", 0) + +_openssl_to_ssl_minimum_version: dict[int, int] = { + ssl.TLSVersion.MINIMUM_SUPPORTED: _OP_NO_SSLv2_OR_SSLv3, + ssl.TLSVersion.TLSv1: _OP_NO_SSLv2_OR_SSLv3, + ssl.TLSVersion.TLSv1_1: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1, + ssl.TLSVersion.TLSv1_2: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1 | _OP_NO_TLSv1_1, + ssl.TLSVersion.TLSv1_3: ( + _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1 | _OP_NO_TLSv1_1 | _OP_NO_TLSv1_2 + ), + ssl.TLSVersion.MAXIMUM_SUPPORTED: ( + _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1 | _OP_NO_TLSv1_1 | _OP_NO_TLSv1_2 + ), +} +_openssl_to_ssl_maximum_version: dict[int, int] = { + ssl.TLSVersion.MINIMUM_SUPPORTED: ( + _OP_NO_SSLv2_OR_SSLv3 + | _OP_NO_TLSv1 + | _OP_NO_TLSv1_1 + | _OP_NO_TLSv1_2 + | _OP_NO_TLSv1_3 + ), + ssl.TLSVersion.TLSv1: ( + _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1_1 | _OP_NO_TLSv1_2 | _OP_NO_TLSv1_3 + ), + ssl.TLSVersion.TLSv1_1: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1_2 | _OP_NO_TLSv1_3, + ssl.TLSVersion.TLSv1_2: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1_3, + ssl.TLSVersion.TLSv1_3: _OP_NO_SSLv2_OR_SSLv3, + ssl.TLSVersion.MAXIMUM_SUPPORTED: _OP_NO_SSLv2_OR_SSLv3, +} + +# OpenSSL will only write 16K at a time +SSL_WRITE_BLOCKSIZE = 16384 + +orig_util_SSLContext = util.ssl_.SSLContext + + +log = logging.getLogger(__name__) + + +def inject_into_urllib3() -> None: + "Monkey-patch urllib3 with PyOpenSSL-backed SSL-support." + + _validate_dependencies_met() + + util.SSLContext = PyOpenSSLContext # type: ignore[assignment] + util.ssl_.SSLContext = PyOpenSSLContext # type: ignore[assignment] + util.IS_PYOPENSSL = True + util.ssl_.IS_PYOPENSSL = True + + +def extract_from_urllib3() -> None: + "Undo monkey-patching by :func:`inject_into_urllib3`." + + util.SSLContext = orig_util_SSLContext + util.ssl_.SSLContext = orig_util_SSLContext + util.IS_PYOPENSSL = False + util.ssl_.IS_PYOPENSSL = False + + +def _validate_dependencies_met() -> None: + """ + Verifies that PyOpenSSL's package-level dependencies have been met. + Throws `ImportError` if they are not met. + """ + # Method added in `cryptography==1.1`; not available in older versions + from cryptography.x509.extensions import Extensions + + if getattr(Extensions, "get_extension_for_class", None) is None: + raise ImportError( + "'cryptography' module missing required functionality. " + "Try upgrading to v1.3.4 or newer." + ) + + # pyOpenSSL 0.14 and above use cryptography for OpenSSL bindings. The _x509 + # attribute is only present on those versions. + from OpenSSL.crypto import X509 + + x509 = X509() + if getattr(x509, "_x509", None) is None: + raise ImportError( + "'pyOpenSSL' module missing required functionality. " + "Try upgrading to v0.14 or newer." + ) + + +def _dnsname_to_stdlib(name: str) -> str | None: + """ + Converts a dNSName SubjectAlternativeName field to the form used by the + standard library on the given Python version. + + Cryptography produces a dNSName as a unicode string that was idna-decoded + from ASCII bytes. We need to idna-encode that string to get it back, and + then on Python 3 we also need to convert to unicode via UTF-8 (the stdlib + uses PyUnicode_FromStringAndSize on it, which decodes via UTF-8). + + If the name cannot be idna-encoded then we return None signalling that + the name given should be skipped. + """ + + def idna_encode(name: str) -> bytes | None: + """ + Borrowed wholesale from the Python Cryptography Project. It turns out + that we can't just safely call `idna.encode`: it can explode for + wildcard names. This avoids that problem. + """ + import idna + + try: + for prefix in ["*.", "."]: + if name.startswith(prefix): + name = name[len(prefix) :] + return prefix.encode("ascii") + idna.encode(name) + return idna.encode(name) + except idna.core.IDNAError: + return None + + # Don't send IPv6 addresses through the IDNA encoder. + if ":" in name: + return name + + encoded_name = idna_encode(name) + if encoded_name is None: + return None + return encoded_name.decode("utf-8") + + +def get_subj_alt_name(peer_cert: X509) -> list[tuple[str, str]]: + """ + Given an PyOpenSSL certificate, provides all the subject alternative names. + """ + cert = peer_cert.to_cryptography() + + # We want to find the SAN extension. Ask Cryptography to locate it (it's + # faster than looping in Python) + try: + ext = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName).value + except x509.ExtensionNotFound: + # No such extension, return the empty list. + return [] + except ( + x509.DuplicateExtension, + UnsupportedExtension, + x509.UnsupportedGeneralNameType, + UnicodeError, + ) as e: + # A problem has been found with the quality of the certificate. Assume + # no SAN field is present. + log.warning( + "A problem was encountered with the certificate that prevented " + "urllib3 from finding the SubjectAlternativeName field. This can " + "affect certificate validation. The error was %s", + e, + ) + return [] + + # We want to return dNSName and iPAddress fields. We need to cast the IPs + # back to strings because the match_hostname function wants them as + # strings. + # Sadly the DNS names need to be idna encoded and then, on Python 3, UTF-8 + # decoded. This is pretty frustrating, but that's what the standard library + # does with certificates, and so we need to attempt to do the same. + # We also want to skip over names which cannot be idna encoded. + names = [ + ("DNS", name) + for name in map(_dnsname_to_stdlib, ext.get_values_for_type(x509.DNSName)) + if name is not None + ] + names.extend( + ("IP Address", str(name)) for name in ext.get_values_for_type(x509.IPAddress) + ) + + return names + + +class WrappedSocket: + """API-compatibility wrapper for Python OpenSSL's Connection-class.""" + + def __init__( + self, + connection: OpenSSL.SSL.Connection, + socket: socket_cls, + suppress_ragged_eofs: bool = True, + ) -> None: + self.connection = connection + self.socket = socket + self.suppress_ragged_eofs = suppress_ragged_eofs + self._io_refs = 0 + self._closed = False + + def fileno(self) -> int: + return self.socket.fileno() + + # Copy-pasted from Python 3.5 source code + def _decref_socketios(self) -> None: + if self._io_refs > 0: + self._io_refs -= 1 + if self._closed: + self.close() + + def recv(self, *args: typing.Any, **kwargs: typing.Any) -> bytes: + try: + data = self.connection.recv(*args, **kwargs) + except OpenSSL.SSL.SysCallError as e: + if self.suppress_ragged_eofs and e.args == (-1, "Unexpected EOF"): + return b"" + else: + raise OSError(e.args[0], str(e)) from e + except OpenSSL.SSL.ZeroReturnError: + if self.connection.get_shutdown() == OpenSSL.SSL.RECEIVED_SHUTDOWN: + return b"" + else: + raise + except OpenSSL.SSL.WantReadError as e: + if not util.wait_for_read(self.socket, self.socket.gettimeout()): + raise timeout("The read operation timed out") from e + else: + return self.recv(*args, **kwargs) + + # TLS 1.3 post-handshake authentication + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"read error: {e!r}") from e + else: + return data # type: ignore[no-any-return] + + def recv_into(self, *args: typing.Any, **kwargs: typing.Any) -> int: + try: + return self.connection.recv_into(*args, **kwargs) # type: ignore[no-any-return] + except OpenSSL.SSL.SysCallError as e: + if self.suppress_ragged_eofs and e.args == (-1, "Unexpected EOF"): + return 0 + else: + raise OSError(e.args[0], str(e)) from e + except OpenSSL.SSL.ZeroReturnError: + if self.connection.get_shutdown() == OpenSSL.SSL.RECEIVED_SHUTDOWN: + return 0 + else: + raise + except OpenSSL.SSL.WantReadError as e: + if not util.wait_for_read(self.socket, self.socket.gettimeout()): + raise timeout("The read operation timed out") from e + else: + return self.recv_into(*args, **kwargs) + + # TLS 1.3 post-handshake authentication + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"read error: {e!r}") from e + + def settimeout(self, timeout: float) -> None: + return self.socket.settimeout(timeout) + + def _send_until_done(self, data: bytes) -> int: + while True: + try: + return self.connection.send(data) # type: ignore[no-any-return] + except OpenSSL.SSL.WantWriteError as e: + if not util.wait_for_write(self.socket, self.socket.gettimeout()): + raise timeout() from e + continue + except OpenSSL.SSL.SysCallError as e: + raise OSError(e.args[0], str(e)) from e + + def sendall(self, data: bytes) -> None: + total_sent = 0 + while total_sent < len(data): + sent = self._send_until_done( + data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE] + ) + total_sent += sent + + def shutdown(self, how: int) -> None: + try: + self.connection.shutdown() + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"shutdown error: {e!r}") from e + + def close(self) -> None: + self._closed = True + if self._io_refs <= 0: + self._real_close() + + def _real_close(self) -> None: + try: + return self.connection.close() # type: ignore[no-any-return] + except OpenSSL.SSL.Error: + return + + def getpeercert( + self, binary_form: bool = False + ) -> dict[str, list[typing.Any]] | None: + x509 = self.connection.get_peer_certificate() + + if not x509: + return x509 # type: ignore[no-any-return] + + if binary_form: + return OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_ASN1, x509) # type: ignore[no-any-return] + + return { + "subject": ((("commonName", x509.get_subject().CN),),), # type: ignore[dict-item] + "subjectAltName": get_subj_alt_name(x509), + } + + def version(self) -> str: + return self.connection.get_protocol_version_name() # type: ignore[no-any-return] + + def selected_alpn_protocol(self) -> str | None: + alpn_proto = self.connection.get_alpn_proto_negotiated() + return alpn_proto.decode() if alpn_proto else None + + +WrappedSocket.makefile = socket_cls.makefile # type: ignore[attr-defined] + + +class PyOpenSSLContext: + """ + I am a wrapper class for the PyOpenSSL ``Context`` object. I am responsible + for translating the interface of the standard library ``SSLContext`` object + to calls into PyOpenSSL. + """ + + def __init__(self, protocol: int) -> None: + self.protocol = _openssl_versions[protocol] + self._ctx = OpenSSL.SSL.Context(self.protocol) + self._options = 0 + self.check_hostname = False + self._minimum_version: int = ssl.TLSVersion.MINIMUM_SUPPORTED + self._maximum_version: int = ssl.TLSVersion.MAXIMUM_SUPPORTED + self._verify_flags: int = ssl.VERIFY_X509_TRUSTED_FIRST + + @property + def options(self) -> int: + return self._options + + @options.setter + def options(self, value: int) -> None: + self._options = value + self._set_ctx_options() + + @property + def verify_flags(self) -> int: + return self._verify_flags + + @verify_flags.setter + def verify_flags(self, value: int) -> None: + self._verify_flags = value + self._ctx.get_cert_store().set_flags(self._verify_flags) + + @property + def verify_mode(self) -> int: + return _openssl_to_stdlib_verify[self._ctx.get_verify_mode()] + + @verify_mode.setter + def verify_mode(self, value: ssl.VerifyMode) -> None: + self._ctx.set_verify(_stdlib_to_openssl_verify[value], _verify_callback) + + def set_default_verify_paths(self) -> None: + self._ctx.set_default_verify_paths() + + def set_ciphers(self, ciphers: bytes | str) -> None: + if isinstance(ciphers, str): + ciphers = ciphers.encode("utf-8") + self._ctx.set_cipher_list(ciphers) + + def load_verify_locations( + self, + cafile: str | None = None, + capath: str | None = None, + cadata: bytes | None = None, + ) -> None: + if cafile is not None: + cafile = cafile.encode("utf-8") # type: ignore[assignment] + if capath is not None: + capath = capath.encode("utf-8") # type: ignore[assignment] + try: + self._ctx.load_verify_locations(cafile, capath) + if cadata is not None: + self._ctx.load_verify_locations(BytesIO(cadata)) + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"unable to load trusted certificates: {e!r}") from e + + def load_cert_chain( + self, + certfile: str, + keyfile: str | None = None, + password: str | None = None, + ) -> None: + try: + self._ctx.use_certificate_chain_file(certfile) + if password is not None: + if not isinstance(password, bytes): + password = password.encode("utf-8") # type: ignore[assignment] + self._ctx.set_passwd_cb(lambda *_: password) + self._ctx.use_privatekey_file(keyfile or certfile) + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"Unable to load certificate chain: {e!r}") from e + + def set_alpn_protocols(self, protocols: list[bytes | str]) -> None: + protocols = [util.util.to_bytes(p, "ascii") for p in protocols] + return self._ctx.set_alpn_protos(protocols) # type: ignore[no-any-return] + + def wrap_socket( + self, + sock: socket_cls, + server_side: bool = False, + do_handshake_on_connect: bool = True, + suppress_ragged_eofs: bool = True, + server_hostname: bytes | str | None = None, + ) -> WrappedSocket: + cnx = OpenSSL.SSL.Connection(self._ctx, sock) + + # If server_hostname is an IP, don't use it for SNI, per RFC6066 Section 3 + if server_hostname and not util.ssl_.is_ipaddress(server_hostname): + if isinstance(server_hostname, str): + server_hostname = server_hostname.encode("utf-8") + cnx.set_tlsext_host_name(server_hostname) + + cnx.set_connect_state() + + while True: + try: + cnx.do_handshake() + except OpenSSL.SSL.WantReadError as e: + if not util.wait_for_read(sock, sock.gettimeout()): + raise timeout("select timed out") from e + continue + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"bad handshake: {e!r}") from e + break + + return WrappedSocket(cnx, sock) + + def _set_ctx_options(self) -> None: + self._ctx.set_options( + self._options + | _openssl_to_ssl_minimum_version[self._minimum_version] + | _openssl_to_ssl_maximum_version[self._maximum_version] + ) + + @property + def minimum_version(self) -> int: + return self._minimum_version + + @minimum_version.setter + def minimum_version(self, minimum_version: int) -> None: + self._minimum_version = minimum_version + self._set_ctx_options() + + @property + def maximum_version(self) -> int: + return self._maximum_version + + @maximum_version.setter + def maximum_version(self, maximum_version: int) -> None: + self._maximum_version = maximum_version + self._set_ctx_options() + + +def _verify_callback( + cnx: OpenSSL.SSL.Connection, + x509: X509, + err_no: int, + err_depth: int, + return_code: int, +) -> bool: + return err_no == 0 diff --git a/.venv/lib/python3.10/site-packages/urllib3/contrib/socks.py b/.venv/lib/python3.10/site-packages/urllib3/contrib/socks.py new file mode 100644 index 0000000000000000000000000000000000000000..e3239b569d93c6139f9c6a86118a5884daf1dabd --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/contrib/socks.py @@ -0,0 +1,228 @@ +""" +This module contains provisional support for SOCKS proxies from within +urllib3. This module supports SOCKS4, SOCKS4A (an extension of SOCKS4), and +SOCKS5. To enable its functionality, either install PySocks or install this +module with the ``socks`` extra. + +The SOCKS implementation supports the full range of urllib3 features. It also +supports the following SOCKS features: + +- SOCKS4A (``proxy_url='socks4a://...``) +- SOCKS4 (``proxy_url='socks4://...``) +- SOCKS5 with remote DNS (``proxy_url='socks5h://...``) +- SOCKS5 with local DNS (``proxy_url='socks5://...``) +- Usernames and passwords for the SOCKS proxy + +.. note:: + It is recommended to use ``socks5h://`` or ``socks4a://`` schemes in + your ``proxy_url`` to ensure that DNS resolution is done from the remote + server instead of client-side when connecting to a domain name. + +SOCKS4 supports IPv4 and domain names with the SOCKS4A extension. SOCKS5 +supports IPv4, IPv6, and domain names. + +When connecting to a SOCKS4 proxy the ``username`` portion of the ``proxy_url`` +will be sent as the ``userid`` section of the SOCKS request: + +.. code-block:: python + + proxy_url="socks4a://@proxy-host" + +When connecting to a SOCKS5 proxy the ``username`` and ``password`` portion +of the ``proxy_url`` will be sent as the username/password to authenticate +with the proxy: + +.. code-block:: python + + proxy_url="socks5h://:@proxy-host" + +""" + +from __future__ import annotations + +try: + import socks # type: ignore[import-untyped] +except ImportError: + import warnings + + from ..exceptions import DependencyWarning + + warnings.warn( + ( + "SOCKS support in urllib3 requires the installation of optional " + "dependencies: specifically, PySocks. For more information, see " + "https://urllib3.readthedocs.io/en/latest/advanced-usage.html#socks-proxies" + ), + DependencyWarning, + ) + raise + +import typing +from socket import timeout as SocketTimeout + +from ..connection import HTTPConnection, HTTPSConnection +from ..connectionpool import HTTPConnectionPool, HTTPSConnectionPool +from ..exceptions import ConnectTimeoutError, NewConnectionError +from ..poolmanager import PoolManager +from ..util.url import parse_url + +try: + import ssl +except ImportError: + ssl = None # type: ignore[assignment] + + +class _TYPE_SOCKS_OPTIONS(typing.TypedDict): + socks_version: int + proxy_host: str | None + proxy_port: str | None + username: str | None + password: str | None + rdns: bool + + +class SOCKSConnection(HTTPConnection): + """ + A plain-text HTTP connection that connects via a SOCKS proxy. + """ + + def __init__( + self, + _socks_options: _TYPE_SOCKS_OPTIONS, + *args: typing.Any, + **kwargs: typing.Any, + ) -> None: + self._socks_options = _socks_options + super().__init__(*args, **kwargs) + + def _new_conn(self) -> socks.socksocket: + """ + Establish a new connection via the SOCKS proxy. + """ + extra_kw: dict[str, typing.Any] = {} + if self.source_address: + extra_kw["source_address"] = self.source_address + + if self.socket_options: + extra_kw["socket_options"] = self.socket_options + + try: + conn = socks.create_connection( + (self.host, self.port), + proxy_type=self._socks_options["socks_version"], + proxy_addr=self._socks_options["proxy_host"], + proxy_port=self._socks_options["proxy_port"], + proxy_username=self._socks_options["username"], + proxy_password=self._socks_options["password"], + proxy_rdns=self._socks_options["rdns"], + timeout=self.timeout, + **extra_kw, + ) + + except SocketTimeout as e: + raise ConnectTimeoutError( + self, + f"Connection to {self.host} timed out. (connect timeout={self.timeout})", + ) from e + + except socks.ProxyError as e: + # This is fragile as hell, but it seems to be the only way to raise + # useful errors here. + if e.socket_err: + error = e.socket_err + if isinstance(error, SocketTimeout): + raise ConnectTimeoutError( + self, + f"Connection to {self.host} timed out. (connect timeout={self.timeout})", + ) from e + else: + # Adding `from e` messes with coverage somehow, so it's omitted. + # See #2386. + raise NewConnectionError( + self, f"Failed to establish a new connection: {error}" + ) + else: + raise NewConnectionError( + self, f"Failed to establish a new connection: {e}" + ) from e + + except OSError as e: # Defensive: PySocks should catch all these. + raise NewConnectionError( + self, f"Failed to establish a new connection: {e}" + ) from e + + return conn + + +# We don't need to duplicate the Verified/Unverified distinction from +# urllib3/connection.py here because the HTTPSConnection will already have been +# correctly set to either the Verified or Unverified form by that module. This +# means the SOCKSHTTPSConnection will automatically be the correct type. +class SOCKSHTTPSConnection(SOCKSConnection, HTTPSConnection): + pass + + +class SOCKSHTTPConnectionPool(HTTPConnectionPool): + ConnectionCls = SOCKSConnection + + +class SOCKSHTTPSConnectionPool(HTTPSConnectionPool): + ConnectionCls = SOCKSHTTPSConnection + + +class SOCKSProxyManager(PoolManager): + """ + A version of the urllib3 ProxyManager that routes connections via the + defined SOCKS proxy. + """ + + pool_classes_by_scheme = { + "http": SOCKSHTTPConnectionPool, + "https": SOCKSHTTPSConnectionPool, + } + + def __init__( + self, + proxy_url: str, + username: str | None = None, + password: str | None = None, + num_pools: int = 10, + headers: typing.Mapping[str, str] | None = None, + **connection_pool_kw: typing.Any, + ): + parsed = parse_url(proxy_url) + + if username is None and password is None and parsed.auth is not None: + split = parsed.auth.split(":") + if len(split) == 2: + username, password = split + if parsed.scheme == "socks5": + socks_version = socks.PROXY_TYPE_SOCKS5 + rdns = False + elif parsed.scheme == "socks5h": + socks_version = socks.PROXY_TYPE_SOCKS5 + rdns = True + elif parsed.scheme == "socks4": + socks_version = socks.PROXY_TYPE_SOCKS4 + rdns = False + elif parsed.scheme == "socks4a": + socks_version = socks.PROXY_TYPE_SOCKS4 + rdns = True + else: + raise ValueError(f"Unable to determine SOCKS version from {proxy_url}") + + self.proxy_url = proxy_url + + socks_options = { + "socks_version": socks_version, + "proxy_host": parsed.host, + "proxy_port": parsed.port, + "username": username, + "password": password, + "rdns": rdns, + } + connection_pool_kw["_socks_options"] = socks_options + + super().__init__(num_pools, headers, **connection_pool_kw) + + self.pool_classes_by_scheme = SOCKSProxyManager.pool_classes_by_scheme diff --git a/.venv/lib/python3.10/site-packages/urllib3/exceptions.py b/.venv/lib/python3.10/site-packages/urllib3/exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..58723faeb0ca7e5d8e3ba319f8d5acc79c91409c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/exceptions.py @@ -0,0 +1,335 @@ +from __future__ import annotations + +import socket +import typing +import warnings +from email.errors import MessageDefect +from http.client import IncompleteRead as httplib_IncompleteRead + +if typing.TYPE_CHECKING: + from .connection import HTTPConnection + from .connectionpool import ConnectionPool + from .response import HTTPResponse + from .util.retry import Retry + +# Base Exceptions + + +class HTTPError(Exception): + """Base exception used by this module.""" + + +class HTTPWarning(Warning): + """Base warning used by this module.""" + + +_TYPE_REDUCE_RESULT = tuple[typing.Callable[..., object], tuple[object, ...]] + + +class PoolError(HTTPError): + """Base exception for errors caused within a pool.""" + + def __init__(self, pool: ConnectionPool, message: str) -> None: + self.pool = pool + self._message = message + super().__init__(f"{pool}: {message}") + + def __reduce__(self) -> _TYPE_REDUCE_RESULT: + # For pickling purposes. + return self.__class__, (None, self._message) + + +class RequestError(PoolError): + """Base exception for PoolErrors that have associated URLs.""" + + def __init__(self, pool: ConnectionPool, url: str | None, message: str) -> None: + self.url = url + super().__init__(pool, message) + + def __reduce__(self) -> _TYPE_REDUCE_RESULT: + # For pickling purposes. + return self.__class__, (None, self.url, self._message) + + +class SSLError(HTTPError): + """Raised when SSL certificate fails in an HTTPS connection.""" + + +class ProxyError(HTTPError): + """Raised when the connection to a proxy fails.""" + + # The original error is also available as __cause__. + original_error: Exception + + def __init__(self, message: str, error: Exception) -> None: + super().__init__(message, error) + self.original_error = error + + +class DecodeError(HTTPError): + """Raised when automatic decoding based on Content-Type fails.""" + + +class ProtocolError(HTTPError): + """Raised when something unexpected happens mid-request/response.""" + + +#: Renamed to ProtocolError but aliased for backwards compatibility. +ConnectionError = ProtocolError + + +# Leaf Exceptions + + +class MaxRetryError(RequestError): + """Raised when the maximum number of retries is exceeded. + + :param pool: The connection pool + :type pool: :class:`~urllib3.connectionpool.HTTPConnectionPool` + :param str url: The requested Url + :param reason: The underlying error + :type reason: :class:`Exception` + + """ + + def __init__( + self, pool: ConnectionPool, url: str | None, reason: Exception | None = None + ) -> None: + self.reason = reason + + message = f"Max retries exceeded with url: {url} (Caused by {reason!r})" + + super().__init__(pool, url, message) + + def __reduce__(self) -> _TYPE_REDUCE_RESULT: + # For pickling purposes. + return self.__class__, (None, self.url, self.reason) + + +class HostChangedError(RequestError): + """Raised when an existing pool gets a request for a foreign host.""" + + def __init__( + self, pool: ConnectionPool, url: str, retries: Retry | int = 3 + ) -> None: + message = f"Tried to open a foreign host with url: {url}" + super().__init__(pool, url, message) + self.retries = retries + + +class TimeoutStateError(HTTPError): + """Raised when passing an invalid state to a timeout""" + + +class TimeoutError(HTTPError): + """Raised when a socket timeout error occurs. + + Catching this error will catch both :exc:`ReadTimeoutErrors + ` and :exc:`ConnectTimeoutErrors `. + """ + + +class ReadTimeoutError(TimeoutError, RequestError): + """Raised when a socket timeout occurs while receiving data from a server""" + + +# This timeout error does not have a URL attached and needs to inherit from the +# base HTTPError +class ConnectTimeoutError(TimeoutError): + """Raised when a socket timeout occurs while connecting to a server""" + + +class NewConnectionError(ConnectTimeoutError, HTTPError): + """Raised when we fail to establish a new connection. Usually ECONNREFUSED.""" + + def __init__(self, conn: HTTPConnection, message: str) -> None: + self.conn = conn + self._message = message + super().__init__(f"{conn}: {message}") + + def __reduce__(self) -> _TYPE_REDUCE_RESULT: + # For pickling purposes. + return self.__class__, (None, self._message) + + @property + def pool(self) -> HTTPConnection: + warnings.warn( + "The 'pool' property is deprecated and will be removed " + "in urllib3 v2.1.0. Use 'conn' instead.", + DeprecationWarning, + stacklevel=2, + ) + + return self.conn + + +class NameResolutionError(NewConnectionError): + """Raised when host name resolution fails.""" + + def __init__(self, host: str, conn: HTTPConnection, reason: socket.gaierror): + message = f"Failed to resolve '{host}' ({reason})" + self._host = host + self._reason = reason + super().__init__(conn, message) + + def __reduce__(self) -> _TYPE_REDUCE_RESULT: + # For pickling purposes. + return self.__class__, (self._host, None, self._reason) + + +class EmptyPoolError(PoolError): + """Raised when a pool runs out of connections and no more are allowed.""" + + +class FullPoolError(PoolError): + """Raised when we try to add a connection to a full pool in blocking mode.""" + + +class ClosedPoolError(PoolError): + """Raised when a request enters a pool after the pool has been closed.""" + + +class LocationValueError(ValueError, HTTPError): + """Raised when there is something wrong with a given URL input.""" + + +class LocationParseError(LocationValueError): + """Raised when get_host or similar fails to parse the URL input.""" + + def __init__(self, location: str) -> None: + message = f"Failed to parse: {location}" + super().__init__(message) + + self.location = location + + +class URLSchemeUnknown(LocationValueError): + """Raised when a URL input has an unsupported scheme.""" + + def __init__(self, scheme: str): + message = f"Not supported URL scheme {scheme}" + super().__init__(message) + + self.scheme = scheme + + +class ResponseError(HTTPError): + """Used as a container for an error reason supplied in a MaxRetryError.""" + + GENERIC_ERROR = "too many error responses" + SPECIFIC_ERROR = "too many {status_code} error responses" + + +class SecurityWarning(HTTPWarning): + """Warned when performing security reducing actions""" + + +class InsecureRequestWarning(SecurityWarning): + """Warned when making an unverified HTTPS request.""" + + +class NotOpenSSLWarning(SecurityWarning): + """Warned when using unsupported SSL library""" + + +class SystemTimeWarning(SecurityWarning): + """Warned when system time is suspected to be wrong""" + + +class InsecurePlatformWarning(SecurityWarning): + """Warned when certain TLS/SSL configuration is not available on a platform.""" + + +class DependencyWarning(HTTPWarning): + """ + Warned when an attempt is made to import a module with missing optional + dependencies. + """ + + +class ResponseNotChunked(ProtocolError, ValueError): + """Response needs to be chunked in order to read it as chunks.""" + + +class BodyNotHttplibCompatible(HTTPError): + """ + Body should be :class:`http.client.HTTPResponse` like + (have an fp attribute which returns raw chunks) for read_chunked(). + """ + + +class IncompleteRead(HTTPError, httplib_IncompleteRead): + """ + Response length doesn't match expected Content-Length + + Subclass of :class:`http.client.IncompleteRead` to allow int value + for ``partial`` to avoid creating large objects on streamed reads. + """ + + partial: int # type: ignore[assignment] + expected: int + + def __init__(self, partial: int, expected: int) -> None: + self.partial = partial + self.expected = expected + + def __repr__(self) -> str: + return "IncompleteRead(%i bytes read, %i more expected)" % ( + self.partial, + self.expected, + ) + + +class InvalidChunkLength(HTTPError, httplib_IncompleteRead): + """Invalid chunk length in a chunked response.""" + + def __init__(self, response: HTTPResponse, length: bytes) -> None: + self.partial: int = response.tell() # type: ignore[assignment] + self.expected: int | None = response.length_remaining + self.response = response + self.length = length + + def __repr__(self) -> str: + return "InvalidChunkLength(got length %r, %i bytes read)" % ( + self.length, + self.partial, + ) + + +class InvalidHeader(HTTPError): + """The header provided was somehow invalid.""" + + +class ProxySchemeUnknown(AssertionError, URLSchemeUnknown): + """ProxyManager does not support the supplied scheme""" + + # TODO(t-8ch): Stop inheriting from AssertionError in v2.0. + + def __init__(self, scheme: str | None) -> None: + # 'localhost' is here because our URL parser parses + # localhost:8080 -> scheme=localhost, remove if we fix this. + if scheme == "localhost": + scheme = None + if scheme is None: + message = "Proxy URL had no scheme, should start with http:// or https://" + else: + message = f"Proxy URL had unsupported scheme {scheme}, should use http:// or https://" + super().__init__(message) + + +class ProxySchemeUnsupported(ValueError): + """Fetching HTTPS resources through HTTPS proxies is unsupported""" + + +class HeaderParsingError(HTTPError): + """Raised by assert_header_parsing, but we convert it to a log.warning statement.""" + + def __init__( + self, defects: list[MessageDefect], unparsed_data: bytes | str | None + ) -> None: + message = f"{defects or 'Unknown'}, unparsed data: {unparsed_data!r}" + super().__init__(message) + + +class UnrewindableBodyError(HTTPError): + """urllib3 encountered an error when trying to rewind a body""" diff --git a/.venv/lib/python3.10/site-packages/urllib3/fields.py b/.venv/lib/python3.10/site-packages/urllib3/fields.py new file mode 100644 index 0000000000000000000000000000000000000000..97c4730cff0df570e1ab47f77e6aa879ec3c36e7 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/fields.py @@ -0,0 +1,341 @@ +from __future__ import annotations + +import email.utils +import mimetypes +import typing + +_TYPE_FIELD_VALUE = typing.Union[str, bytes] +_TYPE_FIELD_VALUE_TUPLE = typing.Union[ + _TYPE_FIELD_VALUE, + tuple[str, _TYPE_FIELD_VALUE], + tuple[str, _TYPE_FIELD_VALUE, str], +] + + +def guess_content_type( + filename: str | None, default: str = "application/octet-stream" +) -> str: + """ + Guess the "Content-Type" of a file. + + :param filename: + The filename to guess the "Content-Type" of using :mod:`mimetypes`. + :param default: + If no "Content-Type" can be guessed, default to `default`. + """ + if filename: + return mimetypes.guess_type(filename)[0] or default + return default + + +def format_header_param_rfc2231(name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + Helper function to format and quote a single header parameter using the + strategy defined in RFC 2231. + + Particularly useful for header parameters which might contain + non-ASCII values, like file names. This follows + `RFC 2388 Section 4.4 `_. + + :param name: + The name of the parameter, a string expected to be ASCII only. + :param value: + The value of the parameter, provided as ``bytes`` or `str``. + :returns: + An RFC-2231-formatted unicode string. + + .. deprecated:: 2.0.0 + Will be removed in urllib3 v2.1.0. This is not valid for + ``multipart/form-data`` header parameters. + """ + import warnings + + warnings.warn( + "'format_header_param_rfc2231' is deprecated and will be " + "removed in urllib3 v2.1.0. This is not valid for " + "multipart/form-data header parameters.", + DeprecationWarning, + stacklevel=2, + ) + + if isinstance(value, bytes): + value = value.decode("utf-8") + + if not any(ch in value for ch in '"\\\r\n'): + result = f'{name}="{value}"' + try: + result.encode("ascii") + except (UnicodeEncodeError, UnicodeDecodeError): + pass + else: + return result + + value = email.utils.encode_rfc2231(value, "utf-8") + value = f"{name}*={value}" + + return value + + +def format_multipart_header_param(name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + Format and quote a single multipart header parameter. + + This follows the `WHATWG HTML Standard`_ as of 2021/06/10, matching + the behavior of current browser and curl versions. Values are + assumed to be UTF-8. The ``\\n``, ``\\r``, and ``"`` characters are + percent encoded. + + .. _WHATWG HTML Standard: + https://html.spec.whatwg.org/multipage/ + form-control-infrastructure.html#multipart-form-data + + :param name: + The name of the parameter, an ASCII-only ``str``. + :param value: + The value of the parameter, a ``str`` or UTF-8 encoded + ``bytes``. + :returns: + A string ``name="value"`` with the escaped value. + + .. versionchanged:: 2.0.0 + Matches the WHATWG HTML Standard as of 2021/06/10. Control + characters are no longer percent encoded. + + .. versionchanged:: 2.0.0 + Renamed from ``format_header_param_html5`` and + ``format_header_param``. The old names will be removed in + urllib3 v2.1.0. + """ + if isinstance(value, bytes): + value = value.decode("utf-8") + + # percent encode \n \r " + value = value.translate({10: "%0A", 13: "%0D", 34: "%22"}) + return f'{name}="{value}"' + + +def format_header_param_html5(name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + .. deprecated:: 2.0.0 + Renamed to :func:`format_multipart_header_param`. Will be + removed in urllib3 v2.1.0. + """ + import warnings + + warnings.warn( + "'format_header_param_html5' has been renamed to " + "'format_multipart_header_param'. The old name will be " + "removed in urllib3 v2.1.0.", + DeprecationWarning, + stacklevel=2, + ) + return format_multipart_header_param(name, value) + + +def format_header_param(name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + .. deprecated:: 2.0.0 + Renamed to :func:`format_multipart_header_param`. Will be + removed in urllib3 v2.1.0. + """ + import warnings + + warnings.warn( + "'format_header_param' has been renamed to " + "'format_multipart_header_param'. The old name will be " + "removed in urllib3 v2.1.0.", + DeprecationWarning, + stacklevel=2, + ) + return format_multipart_header_param(name, value) + + +class RequestField: + """ + A data container for request body parameters. + + :param name: + The name of this request field. Must be unicode. + :param data: + The data/value body. + :param filename: + An optional filename of the request field. Must be unicode. + :param headers: + An optional dict-like object of headers to initially use for the field. + + .. versionchanged:: 2.0.0 + The ``header_formatter`` parameter is deprecated and will + be removed in urllib3 v2.1.0. + """ + + def __init__( + self, + name: str, + data: _TYPE_FIELD_VALUE, + filename: str | None = None, + headers: typing.Mapping[str, str] | None = None, + header_formatter: typing.Callable[[str, _TYPE_FIELD_VALUE], str] | None = None, + ): + self._name = name + self._filename = filename + self.data = data + self.headers: dict[str, str | None] = {} + if headers: + self.headers = dict(headers) + + if header_formatter is not None: + import warnings + + warnings.warn( + "The 'header_formatter' parameter is deprecated and " + "will be removed in urllib3 v2.1.0.", + DeprecationWarning, + stacklevel=2, + ) + self.header_formatter = header_formatter + else: + self.header_formatter = format_multipart_header_param + + @classmethod + def from_tuples( + cls, + fieldname: str, + value: _TYPE_FIELD_VALUE_TUPLE, + header_formatter: typing.Callable[[str, _TYPE_FIELD_VALUE], str] | None = None, + ) -> RequestField: + """ + A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters. + + Supports constructing :class:`~urllib3.fields.RequestField` from + parameter of key/value strings AND key/filetuple. A filetuple is a + (filename, data, MIME type) tuple where the MIME type is optional. + For example:: + + 'foo': 'bar', + 'fakefile': ('foofile.txt', 'contents of foofile'), + 'realfile': ('barfile.txt', open('realfile').read()), + 'typedfile': ('bazfile.bin', open('bazfile').read(), 'image/jpeg'), + 'nonamefile': 'contents of nonamefile field', + + Field names and filenames must be unicode. + """ + filename: str | None + content_type: str | None + data: _TYPE_FIELD_VALUE + + if isinstance(value, tuple): + if len(value) == 3: + filename, data, content_type = value + else: + filename, data = value + content_type = guess_content_type(filename) + else: + filename = None + content_type = None + data = value + + request_param = cls( + fieldname, data, filename=filename, header_formatter=header_formatter + ) + request_param.make_multipart(content_type=content_type) + + return request_param + + def _render_part(self, name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + Override this method to change how each multipart header + parameter is formatted. By default, this calls + :func:`format_multipart_header_param`. + + :param name: + The name of the parameter, an ASCII-only ``str``. + :param value: + The value of the parameter, a ``str`` or UTF-8 encoded + ``bytes``. + + :meta public: + """ + return self.header_formatter(name, value) + + def _render_parts( + self, + header_parts: ( + dict[str, _TYPE_FIELD_VALUE | None] + | typing.Sequence[tuple[str, _TYPE_FIELD_VALUE | None]] + ), + ) -> str: + """ + Helper function to format and quote a single header. + + Useful for single headers that are composed of multiple items. E.g., + 'Content-Disposition' fields. + + :param header_parts: + A sequence of (k, v) tuples or a :class:`dict` of (k, v) to format + as `k1="v1"; k2="v2"; ...`. + """ + iterable: typing.Iterable[tuple[str, _TYPE_FIELD_VALUE | None]] + + parts = [] + if isinstance(header_parts, dict): + iterable = header_parts.items() + else: + iterable = header_parts + + for name, value in iterable: + if value is not None: + parts.append(self._render_part(name, value)) + + return "; ".join(parts) + + def render_headers(self) -> str: + """ + Renders the headers for this request field. + """ + lines = [] + + sort_keys = ["Content-Disposition", "Content-Type", "Content-Location"] + for sort_key in sort_keys: + if self.headers.get(sort_key, False): + lines.append(f"{sort_key}: {self.headers[sort_key]}") + + for header_name, header_value in self.headers.items(): + if header_name not in sort_keys: + if header_value: + lines.append(f"{header_name}: {header_value}") + + lines.append("\r\n") + return "\r\n".join(lines) + + def make_multipart( + self, + content_disposition: str | None = None, + content_type: str | None = None, + content_location: str | None = None, + ) -> None: + """ + Makes this request field into a multipart request field. + + This method overrides "Content-Disposition", "Content-Type" and + "Content-Location" headers to the request parameter. + + :param content_disposition: + The 'Content-Disposition' of the request body. Defaults to 'form-data' + :param content_type: + The 'Content-Type' of the request body. + :param content_location: + The 'Content-Location' of the request body. + + """ + content_disposition = (content_disposition or "form-data") + "; ".join( + [ + "", + self._render_parts( + (("name", self._name), ("filename", self._filename)) + ), + ] + ) + + self.headers["Content-Disposition"] = content_disposition + self.headers["Content-Type"] = content_type + self.headers["Content-Location"] = content_location diff --git a/.venv/lib/python3.10/site-packages/urllib3/filepost.py b/.venv/lib/python3.10/site-packages/urllib3/filepost.py new file mode 100644 index 0000000000000000000000000000000000000000..14f70b05b4778f91137e4a9e7059d7514aa44d28 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/filepost.py @@ -0,0 +1,89 @@ +from __future__ import annotations + +import binascii +import codecs +import os +import typing +from io import BytesIO + +from .fields import _TYPE_FIELD_VALUE_TUPLE, RequestField + +writer = codecs.lookup("utf-8")[3] + +_TYPE_FIELDS_SEQUENCE = typing.Sequence[ + typing.Union[tuple[str, _TYPE_FIELD_VALUE_TUPLE], RequestField] +] +_TYPE_FIELDS = typing.Union[ + _TYPE_FIELDS_SEQUENCE, + typing.Mapping[str, _TYPE_FIELD_VALUE_TUPLE], +] + + +def choose_boundary() -> str: + """ + Our embarrassingly-simple replacement for mimetools.choose_boundary. + """ + return binascii.hexlify(os.urandom(16)).decode() + + +def iter_field_objects(fields: _TYPE_FIELDS) -> typing.Iterable[RequestField]: + """ + Iterate over fields. + + Supports list of (k, v) tuples and dicts, and lists of + :class:`~urllib3.fields.RequestField`. + + """ + iterable: typing.Iterable[RequestField | tuple[str, _TYPE_FIELD_VALUE_TUPLE]] + + if isinstance(fields, typing.Mapping): + iterable = fields.items() + else: + iterable = fields + + for field in iterable: + if isinstance(field, RequestField): + yield field + else: + yield RequestField.from_tuples(*field) + + +def encode_multipart_formdata( + fields: _TYPE_FIELDS, boundary: str | None = None +) -> tuple[bytes, str]: + """ + Encode a dictionary of ``fields`` using the multipart/form-data MIME format. + + :param fields: + Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). + Values are processed by :func:`urllib3.fields.RequestField.from_tuples`. + + :param boundary: + If not specified, then a random boundary will be generated using + :func:`urllib3.filepost.choose_boundary`. + """ + body = BytesIO() + if boundary is None: + boundary = choose_boundary() + + for field in iter_field_objects(fields): + body.write(f"--{boundary}\r\n".encode("latin-1")) + + writer(body).write(field.render_headers()) + data = field.data + + if isinstance(data, int): + data = str(data) # Backwards compatibility + + if isinstance(data, str): + writer(body).write(data) + else: + body.write(data) + + body.write(b"\r\n") + + body.write(f"--{boundary}--\r\n".encode("latin-1")) + + content_type = f"multipart/form-data; boundary={boundary}" + + return body.getvalue(), content_type diff --git a/.venv/lib/python3.10/site-packages/urllib3/http2/__init__.py b/.venv/lib/python3.10/site-packages/urllib3/http2/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..133e1d8f237f6fddd557ae1c0e0cf738f7cc2748 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/http2/__init__.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from importlib.metadata import version + +__all__ = [ + "inject_into_urllib3", + "extract_from_urllib3", +] + +import typing + +orig_HTTPSConnection: typing.Any = None + + +def inject_into_urllib3() -> None: + # First check if h2 version is valid + h2_version = version("h2") + if not h2_version.startswith("4."): + raise ImportError( + "urllib3 v2 supports h2 version 4.x.x, currently " + f"the 'h2' module is compiled with {h2_version!r}. " + "See: https://github.com/urllib3/urllib3/issues/3290" + ) + + # Import here to avoid circular dependencies. + from .. import connection as urllib3_connection + from .. import util as urllib3_util + from ..connectionpool import HTTPSConnectionPool + from ..util import ssl_ as urllib3_util_ssl + from .connection import HTTP2Connection + + global orig_HTTPSConnection + orig_HTTPSConnection = urllib3_connection.HTTPSConnection + + HTTPSConnectionPool.ConnectionCls = HTTP2Connection + urllib3_connection.HTTPSConnection = HTTP2Connection # type: ignore[misc] + + # TODO: Offer 'http/1.1' as well, but for testing purposes this is handy. + urllib3_util.ALPN_PROTOCOLS = ["h2"] + urllib3_util_ssl.ALPN_PROTOCOLS = ["h2"] + + +def extract_from_urllib3() -> None: + from .. import connection as urllib3_connection + from .. import util as urllib3_util + from ..connectionpool import HTTPSConnectionPool + from ..util import ssl_ as urllib3_util_ssl + + HTTPSConnectionPool.ConnectionCls = orig_HTTPSConnection + urllib3_connection.HTTPSConnection = orig_HTTPSConnection # type: ignore[misc] + + urllib3_util.ALPN_PROTOCOLS = ["http/1.1"] + urllib3_util_ssl.ALPN_PROTOCOLS = ["http/1.1"] diff --git a/.venv/lib/python3.10/site-packages/urllib3/http2/__pycache__/__init__.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/http2/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3c82515b18994ccbf05b651edb83264f5086a93c Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/http2/__pycache__/__init__.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/http2/__pycache__/probe.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/http2/__pycache__/probe.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..332db9eb670bf3c8961e09d0a0b648f0683cf801 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/http2/__pycache__/probe.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/http2/connection.py b/.venv/lib/python3.10/site-packages/urllib3/http2/connection.py new file mode 100644 index 0000000000000000000000000000000000000000..0a026da0a8357e324ded47b82b24042713b9bf06 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/http2/connection.py @@ -0,0 +1,356 @@ +from __future__ import annotations + +import logging +import re +import threading +import types +import typing + +import h2.config +import h2.connection +import h2.events + +from .._base_connection import _TYPE_BODY +from .._collections import HTTPHeaderDict +from ..connection import HTTPSConnection, _get_default_user_agent +from ..exceptions import ConnectionError +from ..response import BaseHTTPResponse + +orig_HTTPSConnection = HTTPSConnection + +T = typing.TypeVar("T") + +log = logging.getLogger(__name__) + +RE_IS_LEGAL_HEADER_NAME = re.compile(rb"^[!#$%&'*+\-.^_`|~0-9a-z]+$") +RE_IS_ILLEGAL_HEADER_VALUE = re.compile(rb"[\0\x00\x0a\x0d\r\n]|^[ \r\n\t]|[ \r\n\t]$") + + +def _is_legal_header_name(name: bytes) -> bool: + """ + "An implementation that validates fields according to the definitions in Sections + 5.1 and 5.5 of [HTTP] only needs an additional check that field names do not + include uppercase characters." (https://httpwg.org/specs/rfc9113.html#n-field-validity) + + `http.client._is_legal_header_name` does not validate the field name according to the + HTTP 1.1 spec, so we do that here, in addition to checking for uppercase characters. + + This does not allow for the `:` character in the header name, so should not + be used to validate pseudo-headers. + """ + return bool(RE_IS_LEGAL_HEADER_NAME.match(name)) + + +def _is_illegal_header_value(value: bytes) -> bool: + """ + "A field value MUST NOT contain the zero value (ASCII NUL, 0x00), line feed + (ASCII LF, 0x0a), or carriage return (ASCII CR, 0x0d) at any position. A field + value MUST NOT start or end with an ASCII whitespace character (ASCII SP or HTAB, + 0x20 or 0x09)." (https://httpwg.org/specs/rfc9113.html#n-field-validity) + """ + return bool(RE_IS_ILLEGAL_HEADER_VALUE.search(value)) + + +class _LockedObject(typing.Generic[T]): + """ + A wrapper class that hides a specific object behind a lock. + The goal here is to provide a simple way to protect access to an object + that cannot safely be simultaneously accessed from multiple threads. The + intended use of this class is simple: take hold of it with a context + manager, which returns the protected object. + """ + + __slots__ = ( + "lock", + "_obj", + ) + + def __init__(self, obj: T): + self.lock = threading.RLock() + self._obj = obj + + def __enter__(self) -> T: + self.lock.acquire() + return self._obj + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_val: BaseException | None, + exc_tb: types.TracebackType | None, + ) -> None: + self.lock.release() + + +class HTTP2Connection(HTTPSConnection): + def __init__( + self, host: str, port: int | None = None, **kwargs: typing.Any + ) -> None: + self._h2_conn = self._new_h2_conn() + self._h2_stream: int | None = None + self._headers: list[tuple[bytes, bytes]] = [] + + if "proxy" in kwargs or "proxy_config" in kwargs: # Defensive: + raise NotImplementedError("Proxies aren't supported with HTTP/2") + + super().__init__(host, port, **kwargs) + + if self._tunnel_host is not None: + raise NotImplementedError("Tunneling isn't supported with HTTP/2") + + def _new_h2_conn(self) -> _LockedObject[h2.connection.H2Connection]: + config = h2.config.H2Configuration(client_side=True) + return _LockedObject(h2.connection.H2Connection(config=config)) + + def connect(self) -> None: + super().connect() + with self._h2_conn as conn: + conn.initiate_connection() + if data_to_send := conn.data_to_send(): + self.sock.sendall(data_to_send) + + def putrequest( # type: ignore[override] + self, + method: str, + url: str, + **kwargs: typing.Any, + ) -> None: + """putrequest + This deviates from the HTTPConnection method signature since we never need to override + sending accept-encoding headers or the host header. + """ + if "skip_host" in kwargs: + raise NotImplementedError("`skip_host` isn't supported") + if "skip_accept_encoding" in kwargs: + raise NotImplementedError("`skip_accept_encoding` isn't supported") + + self._request_url = url or "/" + self._validate_path(url) # type: ignore[attr-defined] + + if ":" in self.host: + authority = f"[{self.host}]:{self.port or 443}" + else: + authority = f"{self.host}:{self.port or 443}" + + self._headers.append((b":scheme", b"https")) + self._headers.append((b":method", method.encode())) + self._headers.append((b":authority", authority.encode())) + self._headers.append((b":path", url.encode())) + + with self._h2_conn as conn: + self._h2_stream = conn.get_next_available_stream_id() + + def putheader(self, header: str | bytes, *values: str | bytes) -> None: # type: ignore[override] + # TODO SKIPPABLE_HEADERS from urllib3 are ignored. + header = header.encode() if isinstance(header, str) else header + header = header.lower() # A lot of upstream code uses capitalized headers. + if not _is_legal_header_name(header): + raise ValueError(f"Illegal header name {str(header)}") + + for value in values: + value = value.encode() if isinstance(value, str) else value + if _is_illegal_header_value(value): + raise ValueError(f"Illegal header value {str(value)}") + self._headers.append((header, value)) + + def endheaders(self, message_body: typing.Any = None) -> None: # type: ignore[override] + if self._h2_stream is None: + raise ConnectionError("Must call `putrequest` first.") + + with self._h2_conn as conn: + conn.send_headers( + stream_id=self._h2_stream, + headers=self._headers, + end_stream=(message_body is None), + ) + if data_to_send := conn.data_to_send(): + self.sock.sendall(data_to_send) + self._headers = [] # Reset headers for the next request. + + def send(self, data: typing.Any) -> None: + """Send data to the server. + `data` can be: `str`, `bytes`, an iterable, or file-like objects + that support a .read() method. + """ + if self._h2_stream is None: + raise ConnectionError("Must call `putrequest` first.") + + with self._h2_conn as conn: + if data_to_send := conn.data_to_send(): + self.sock.sendall(data_to_send) + + if hasattr(data, "read"): # file-like objects + while True: + chunk = data.read(self.blocksize) + if not chunk: + break + if isinstance(chunk, str): + chunk = chunk.encode() + conn.send_data(self._h2_stream, chunk, end_stream=False) + if data_to_send := conn.data_to_send(): + self.sock.sendall(data_to_send) + conn.end_stream(self._h2_stream) + return + + if isinstance(data, str): # str -> bytes + data = data.encode() + + try: + if isinstance(data, bytes): + conn.send_data(self._h2_stream, data, end_stream=True) + if data_to_send := conn.data_to_send(): + self.sock.sendall(data_to_send) + else: + for chunk in data: + conn.send_data(self._h2_stream, chunk, end_stream=False) + if data_to_send := conn.data_to_send(): + self.sock.sendall(data_to_send) + conn.end_stream(self._h2_stream) + except TypeError: + raise TypeError( + "`data` should be str, bytes, iterable, or file. got %r" + % type(data) + ) + + def set_tunnel( + self, + host: str, + port: int | None = None, + headers: typing.Mapping[str, str] | None = None, + scheme: str = "http", + ) -> None: + raise NotImplementedError( + "HTTP/2 does not support setting up a tunnel through a proxy" + ) + + def getresponse( # type: ignore[override] + self, + ) -> HTTP2Response: + status = None + data = bytearray() + with self._h2_conn as conn: + end_stream = False + while not end_stream: + # TODO: Arbitrary read value. + if received_data := self.sock.recv(65535): + events = conn.receive_data(received_data) + for event in events: + if isinstance(event, h2.events.ResponseReceived): + headers = HTTPHeaderDict() + for header, value in event.headers: + if header == b":status": + status = int(value.decode()) + else: + headers.add( + header.decode("ascii"), value.decode("ascii") + ) + + elif isinstance(event, h2.events.DataReceived): + data += event.data + conn.acknowledge_received_data( + event.flow_controlled_length, event.stream_id + ) + + elif isinstance(event, h2.events.StreamEnded): + end_stream = True + + if data_to_send := conn.data_to_send(): + self.sock.sendall(data_to_send) + + assert status is not None + return HTTP2Response( + status=status, + headers=headers, + request_url=self._request_url, + data=bytes(data), + ) + + def request( # type: ignore[override] + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + *, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + **kwargs: typing.Any, + ) -> None: + """Send an HTTP/2 request""" + if "chunked" in kwargs: + # TODO this is often present from upstream. + # raise NotImplementedError("`chunked` isn't supported with HTTP/2") + pass + + if self.sock is not None: + self.sock.settimeout(self.timeout) + + self.putrequest(method, url) + + headers = headers or {} + for k, v in headers.items(): + if k.lower() == "transfer-encoding" and v == "chunked": + continue + else: + self.putheader(k, v) + + if b"user-agent" not in dict(self._headers): + self.putheader(b"user-agent", _get_default_user_agent()) + + if body: + self.endheaders(message_body=body) + self.send(body) + else: + self.endheaders() + + def close(self) -> None: + with self._h2_conn as conn: + try: + conn.close_connection() + if data := conn.data_to_send(): + self.sock.sendall(data) + except Exception: + pass + + # Reset all our HTTP/2 connection state. + self._h2_conn = self._new_h2_conn() + self._h2_stream = None + self._headers = [] + + super().close() + + +class HTTP2Response(BaseHTTPResponse): + # TODO: This is a woefully incomplete response object, but works for non-streaming. + def __init__( + self, + status: int, + headers: HTTPHeaderDict, + request_url: str, + data: bytes, + decode_content: bool = False, # TODO: support decoding + ) -> None: + super().__init__( + status=status, + headers=headers, + # Following CPython, we map HTTP versions to major * 10 + minor integers + version=20, + version_string="HTTP/2", + # No reason phrase in HTTP/2 + reason=None, + decode_content=decode_content, + request_url=request_url, + ) + self._data = data + self.length_remaining = 0 + + @property + def data(self) -> bytes: + return self._data + + def get_redirect_location(self) -> None: + return None + + def close(self) -> None: + pass diff --git a/.venv/lib/python3.10/site-packages/urllib3/http2/probe.py b/.venv/lib/python3.10/site-packages/urllib3/http2/probe.py new file mode 100644 index 0000000000000000000000000000000000000000..9ea900764f0885eafaac9454523417d86e33df2d --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/http2/probe.py @@ -0,0 +1,87 @@ +from __future__ import annotations + +import threading + + +class _HTTP2ProbeCache: + __slots__ = ( + "_lock", + "_cache_locks", + "_cache_values", + ) + + def __init__(self) -> None: + self._lock = threading.Lock() + self._cache_locks: dict[tuple[str, int], threading.RLock] = {} + self._cache_values: dict[tuple[str, int], bool | None] = {} + + def acquire_and_get(self, host: str, port: int) -> bool | None: + # By the end of this block we know that + # _cache_[values,locks] is available. + value = None + with self._lock: + key = (host, port) + try: + value = self._cache_values[key] + # If it's a known value we return right away. + if value is not None: + return value + except KeyError: + self._cache_locks[key] = threading.RLock() + self._cache_values[key] = None + + # If the value is unknown, we acquire the lock to signal + # to the requesting thread that the probe is in progress + # or that the current thread needs to return their findings. + key_lock = self._cache_locks[key] + key_lock.acquire() + try: + # If the by the time we get the lock the value has been + # updated we want to return the updated value. + value = self._cache_values[key] + + # In case an exception like KeyboardInterrupt is raised here. + except BaseException as e: # Defensive: + assert not isinstance(e, KeyError) # KeyError shouldn't be possible. + key_lock.release() + raise + + return value + + def set_and_release( + self, host: str, port: int, supports_http2: bool | None + ) -> None: + key = (host, port) + key_lock = self._cache_locks[key] + with key_lock: # Uses an RLock, so can be locked again from same thread. + if supports_http2 is None and self._cache_values[key] is not None: + raise ValueError( + "Cannot reset HTTP/2 support for origin after value has been set." + ) # Defensive: not expected in normal usage + + self._cache_values[key] = supports_http2 + key_lock.release() + + def _values(self) -> dict[tuple[str, int], bool | None]: + """This function is for testing purposes only. Gets the current state of the probe cache""" + with self._lock: + return {k: v for k, v in self._cache_values.items()} + + def _reset(self) -> None: + """This function is for testing purposes only. Reset the cache values""" + with self._lock: + self._cache_locks = {} + self._cache_values = {} + + +_HTTP2_PROBE_CACHE = _HTTP2ProbeCache() + +set_and_release = _HTTP2_PROBE_CACHE.set_and_release +acquire_and_get = _HTTP2_PROBE_CACHE.acquire_and_get +_values = _HTTP2_PROBE_CACHE._values +_reset = _HTTP2_PROBE_CACHE._reset + +__all__ = [ + "set_and_release", + "acquire_and_get", +] diff --git a/.venv/lib/python3.10/site-packages/urllib3/poolmanager.py b/.venv/lib/python3.10/site-packages/urllib3/poolmanager.py new file mode 100644 index 0000000000000000000000000000000000000000..28ec82f0168543a8aee7cdb79a4b46f10bb2cc91 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/poolmanager.py @@ -0,0 +1,651 @@ +from __future__ import annotations + +import functools +import logging +import typing +import warnings +from types import TracebackType +from urllib.parse import urljoin + +from ._collections import HTTPHeaderDict, RecentlyUsedContainer +from ._request_methods import RequestMethods +from .connection import ProxyConfig +from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, port_by_scheme +from .exceptions import ( + LocationValueError, + MaxRetryError, + ProxySchemeUnknown, + URLSchemeUnknown, +) +from .response import BaseHTTPResponse +from .util.connection import _TYPE_SOCKET_OPTIONS +from .util.proxy import connection_requires_http_tunnel +from .util.retry import Retry +from .util.timeout import Timeout +from .util.url import Url, parse_url + +if typing.TYPE_CHECKING: + import ssl + + from typing_extensions import Self + +__all__ = ["PoolManager", "ProxyManager", "proxy_from_url"] + + +log = logging.getLogger(__name__) + +SSL_KEYWORDS = ( + "key_file", + "cert_file", + "cert_reqs", + "ca_certs", + "ca_cert_data", + "ssl_version", + "ssl_minimum_version", + "ssl_maximum_version", + "ca_cert_dir", + "ssl_context", + "key_password", + "server_hostname", +) +# Default value for `blocksize` - a new parameter introduced to +# http.client.HTTPConnection & http.client.HTTPSConnection in Python 3.7 +_DEFAULT_BLOCKSIZE = 16384 + + +class PoolKey(typing.NamedTuple): + """ + All known keyword arguments that could be provided to the pool manager, its + pools, or the underlying connections. + + All custom key schemes should include the fields in this key at a minimum. + """ + + key_scheme: str + key_host: str + key_port: int | None + key_timeout: Timeout | float | int | None + key_retries: Retry | bool | int | None + key_block: bool | None + key_source_address: tuple[str, int] | None + key_key_file: str | None + key_key_password: str | None + key_cert_file: str | None + key_cert_reqs: str | None + key_ca_certs: str | None + key_ca_cert_data: str | bytes | None + key_ssl_version: int | str | None + key_ssl_minimum_version: ssl.TLSVersion | None + key_ssl_maximum_version: ssl.TLSVersion | None + key_ca_cert_dir: str | None + key_ssl_context: ssl.SSLContext | None + key_maxsize: int | None + key_headers: frozenset[tuple[str, str]] | None + key__proxy: Url | None + key__proxy_headers: frozenset[tuple[str, str]] | None + key__proxy_config: ProxyConfig | None + key_socket_options: _TYPE_SOCKET_OPTIONS | None + key__socks_options: frozenset[tuple[str, str]] | None + key_assert_hostname: bool | str | None + key_assert_fingerprint: str | None + key_server_hostname: str | None + key_blocksize: int | None + + +def _default_key_normalizer( + key_class: type[PoolKey], request_context: dict[str, typing.Any] +) -> PoolKey: + """ + Create a pool key out of a request context dictionary. + + According to RFC 3986, both the scheme and host are case-insensitive. + Therefore, this function normalizes both before constructing the pool + key for an HTTPS request. If you wish to change this behaviour, provide + alternate callables to ``key_fn_by_scheme``. + + :param key_class: + The class to use when constructing the key. This should be a namedtuple + with the ``scheme`` and ``host`` keys at a minimum. + :type key_class: namedtuple + :param request_context: + A dictionary-like object that contain the context for a request. + :type request_context: dict + + :return: A namedtuple that can be used as a connection pool key. + :rtype: PoolKey + """ + # Since we mutate the dictionary, make a copy first + context = request_context.copy() + context["scheme"] = context["scheme"].lower() + context["host"] = context["host"].lower() + + # These are both dictionaries and need to be transformed into frozensets + for key in ("headers", "_proxy_headers", "_socks_options"): + if key in context and context[key] is not None: + context[key] = frozenset(context[key].items()) + + # The socket_options key may be a list and needs to be transformed into a + # tuple. + socket_opts = context.get("socket_options") + if socket_opts is not None: + context["socket_options"] = tuple(socket_opts) + + # Map the kwargs to the names in the namedtuple - this is necessary since + # namedtuples can't have fields starting with '_'. + for key in list(context.keys()): + context["key_" + key] = context.pop(key) + + # Default to ``None`` for keys missing from the context + for field in key_class._fields: + if field not in context: + context[field] = None + + # Default key_blocksize to _DEFAULT_BLOCKSIZE if missing from the context + if context.get("key_blocksize") is None: + context["key_blocksize"] = _DEFAULT_BLOCKSIZE + + return key_class(**context) + + +#: A dictionary that maps a scheme to a callable that creates a pool key. +#: This can be used to alter the way pool keys are constructed, if desired. +#: Each PoolManager makes a copy of this dictionary so they can be configured +#: globally here, or individually on the instance. +key_fn_by_scheme = { + "http": functools.partial(_default_key_normalizer, PoolKey), + "https": functools.partial(_default_key_normalizer, PoolKey), +} + +pool_classes_by_scheme = {"http": HTTPConnectionPool, "https": HTTPSConnectionPool} + + +class PoolManager(RequestMethods): + """ + Allows for arbitrary requests while transparently keeping track of + necessary connection pools for you. + + :param num_pools: + Number of connection pools to cache before discarding the least + recently used pool. + + :param headers: + Headers to include with all requests, unless other headers are given + explicitly. + + :param \\**connection_pool_kw: + Additional parameters are used to create fresh + :class:`urllib3.connectionpool.ConnectionPool` instances. + + Example: + + .. code-block:: python + + import urllib3 + + http = urllib3.PoolManager(num_pools=2) + + resp1 = http.request("GET", "https://google.com/") + resp2 = http.request("GET", "https://google.com/mail") + resp3 = http.request("GET", "https://yahoo.com/") + + print(len(http.pools)) + # 2 + + """ + + proxy: Url | None = None + proxy_config: ProxyConfig | None = None + + def __init__( + self, + num_pools: int = 10, + headers: typing.Mapping[str, str] | None = None, + **connection_pool_kw: typing.Any, + ) -> None: + super().__init__(headers) + # PoolManager handles redirects itself in PoolManager.urlopen(). + # It always passes redirect=False to the underlying connection pool to + # suppress per-pool redirect handling. If the user supplied a non-Retry + # value (int/bool/etc) for retries and we let the pool normalize it + # while redirect=False, the resulting Retry object would have redirect + # handling disabled, which can interfere with PoolManager's own + # redirect logic. Normalize here so redirects remain governed solely by + # PoolManager logic. + if "retries" in connection_pool_kw: + retries = connection_pool_kw["retries"] + if not isinstance(retries, Retry): + retries = Retry.from_int(retries) + connection_pool_kw = connection_pool_kw.copy() + connection_pool_kw["retries"] = retries + self.connection_pool_kw = connection_pool_kw + + self.pools: RecentlyUsedContainer[PoolKey, HTTPConnectionPool] + self.pools = RecentlyUsedContainer(num_pools) + + # Locally set the pool classes and keys so other PoolManagers can + # override them. + self.pool_classes_by_scheme = pool_classes_by_scheme + self.key_fn_by_scheme = key_fn_by_scheme.copy() + + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_val: BaseException | None, + exc_tb: TracebackType | None, + ) -> typing.Literal[False]: + self.clear() + # Return False to re-raise any potential exceptions + return False + + def _new_pool( + self, + scheme: str, + host: str, + port: int, + request_context: dict[str, typing.Any] | None = None, + ) -> HTTPConnectionPool: + """ + Create a new :class:`urllib3.connectionpool.ConnectionPool` based on host, port, scheme, and + any additional pool keyword arguments. + + If ``request_context`` is provided, it is provided as keyword arguments + to the pool class used. This method is used to actually create the + connection pools handed out by :meth:`connection_from_url` and + companion methods. It is intended to be overridden for customization. + """ + pool_cls: type[HTTPConnectionPool] = self.pool_classes_by_scheme[scheme] + if request_context is None: + request_context = self.connection_pool_kw.copy() + + # Default blocksize to _DEFAULT_BLOCKSIZE if missing or explicitly + # set to 'None' in the request_context. + if request_context.get("blocksize") is None: + request_context["blocksize"] = _DEFAULT_BLOCKSIZE + + # Although the context has everything necessary to create the pool, + # this function has historically only used the scheme, host, and port + # in the positional args. When an API change is acceptable these can + # be removed. + for key in ("scheme", "host", "port"): + request_context.pop(key, None) + + if scheme == "http": + for kw in SSL_KEYWORDS: + request_context.pop(kw, None) + + return pool_cls(host, port, **request_context) + + def clear(self) -> None: + """ + Empty our store of pools and direct them all to close. + + This will not affect in-flight connections, but they will not be + re-used after completion. + """ + self.pools.clear() + + def connection_from_host( + self, + host: str | None, + port: int | None = None, + scheme: str | None = "http", + pool_kwargs: dict[str, typing.Any] | None = None, + ) -> HTTPConnectionPool: + """ + Get a :class:`urllib3.connectionpool.ConnectionPool` based on the host, port, and scheme. + + If ``port`` isn't given, it will be derived from the ``scheme`` using + ``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is + provided, it is merged with the instance's ``connection_pool_kw`` + variable and used to create the new connection pool, if one is + needed. + """ + + if not host: + raise LocationValueError("No host specified.") + + request_context = self._merge_pool_kwargs(pool_kwargs) + request_context["scheme"] = scheme or "http" + if not port: + port = port_by_scheme.get(request_context["scheme"].lower(), 80) + request_context["port"] = port + request_context["host"] = host + + return self.connection_from_context(request_context) + + def connection_from_context( + self, request_context: dict[str, typing.Any] + ) -> HTTPConnectionPool: + """ + Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context. + + ``request_context`` must at least contain the ``scheme`` key and its + value must be a key in ``key_fn_by_scheme`` instance variable. + """ + if "strict" in request_context: + warnings.warn( + "The 'strict' parameter is no longer needed on Python 3+. " + "This will raise an error in urllib3 v2.1.0.", + DeprecationWarning, + ) + request_context.pop("strict") + + scheme = request_context["scheme"].lower() + pool_key_constructor = self.key_fn_by_scheme.get(scheme) + if not pool_key_constructor: + raise URLSchemeUnknown(scheme) + pool_key = pool_key_constructor(request_context) + + return self.connection_from_pool_key(pool_key, request_context=request_context) + + def connection_from_pool_key( + self, pool_key: PoolKey, request_context: dict[str, typing.Any] + ) -> HTTPConnectionPool: + """ + Get a :class:`urllib3.connectionpool.ConnectionPool` based on the provided pool key. + + ``pool_key`` should be a namedtuple that only contains immutable + objects. At a minimum it must have the ``scheme``, ``host``, and + ``port`` fields. + """ + with self.pools.lock: + # If the scheme, host, or port doesn't match existing open + # connections, open a new ConnectionPool. + pool = self.pools.get(pool_key) + if pool: + return pool + + # Make a fresh ConnectionPool of the desired type + scheme = request_context["scheme"] + host = request_context["host"] + port = request_context["port"] + pool = self._new_pool(scheme, host, port, request_context=request_context) + self.pools[pool_key] = pool + + return pool + + def connection_from_url( + self, url: str, pool_kwargs: dict[str, typing.Any] | None = None + ) -> HTTPConnectionPool: + """ + Similar to :func:`urllib3.connectionpool.connection_from_url`. + + If ``pool_kwargs`` is not provided and a new pool needs to be + constructed, ``self.connection_pool_kw`` is used to initialize + the :class:`urllib3.connectionpool.ConnectionPool`. If ``pool_kwargs`` + is provided, it is used instead. Note that if a new pool does not + need to be created for the request, the provided ``pool_kwargs`` are + not used. + """ + u = parse_url(url) + return self.connection_from_host( + u.host, port=u.port, scheme=u.scheme, pool_kwargs=pool_kwargs + ) + + def _merge_pool_kwargs( + self, override: dict[str, typing.Any] | None + ) -> dict[str, typing.Any]: + """ + Merge a dictionary of override values for self.connection_pool_kw. + + This does not modify self.connection_pool_kw and returns a new dict. + Any keys in the override dictionary with a value of ``None`` are + removed from the merged dictionary. + """ + base_pool_kwargs = self.connection_pool_kw.copy() + if override: + for key, value in override.items(): + if value is None: + try: + del base_pool_kwargs[key] + except KeyError: + pass + else: + base_pool_kwargs[key] = value + return base_pool_kwargs + + def _proxy_requires_url_absolute_form(self, parsed_url: Url) -> bool: + """ + Indicates if the proxy requires the complete destination URL in the + request. Normally this is only needed when not using an HTTP CONNECT + tunnel. + """ + if self.proxy is None: + return False + + return not connection_requires_http_tunnel( + self.proxy, self.proxy_config, parsed_url.scheme + ) + + def urlopen( # type: ignore[override] + self, method: str, url: str, redirect: bool = True, **kw: typing.Any + ) -> BaseHTTPResponse: + """ + Same as :meth:`urllib3.HTTPConnectionPool.urlopen` + with custom cross-host redirect logic and only sends the request-uri + portion of the ``url``. + + The given ``url`` parameter must be absolute, such that an appropriate + :class:`urllib3.connectionpool.ConnectionPool` can be chosen for it. + """ + u = parse_url(url) + + if u.scheme is None: + warnings.warn( + "URLs without a scheme (ie 'https://') are deprecated and will raise an error " + "in a future version of urllib3. To avoid this DeprecationWarning ensure all URLs " + "start with 'https://' or 'http://'. Read more in this issue: " + "https://github.com/urllib3/urllib3/issues/2920", + category=DeprecationWarning, + stacklevel=2, + ) + + conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme) + + kw["assert_same_host"] = False + kw["redirect"] = False + + if "headers" not in kw: + kw["headers"] = self.headers + + if self._proxy_requires_url_absolute_form(u): + response = conn.urlopen(method, url, **kw) + else: + response = conn.urlopen(method, u.request_uri, **kw) + + redirect_location = redirect and response.get_redirect_location() + if not redirect_location: + return response + + # Support relative URLs for redirecting. + redirect_location = urljoin(url, redirect_location) + + if response.status == 303: + # Change the method according to RFC 9110, Section 15.4.4. + method = "GET" + # And lose the body not to transfer anything sensitive. + kw["body"] = None + kw["headers"] = HTTPHeaderDict(kw["headers"])._prepare_for_method_change() + + retries = kw.get("retries", response.retries) + if not isinstance(retries, Retry): + retries = Retry.from_int(retries, redirect=redirect) + + # Strip headers marked as unsafe to forward to the redirected location. + # Check remove_headers_on_redirect to avoid a potential network call within + # conn.is_same_host() which may use socket.gethostbyname() in the future. + if retries.remove_headers_on_redirect and not conn.is_same_host( + redirect_location + ): + new_headers = kw["headers"].copy() + for header in kw["headers"]: + if header.lower() in retries.remove_headers_on_redirect: + new_headers.pop(header, None) + kw["headers"] = new_headers + + try: + retries = retries.increment(method, url, response=response, _pool=conn) + except MaxRetryError: + if retries.raise_on_redirect: + response.drain_conn() + raise + return response + + kw["retries"] = retries + kw["redirect"] = redirect + + log.info("Redirecting %s -> %s", url, redirect_location) + + response.drain_conn() + return self.urlopen(method, redirect_location, **kw) + + +class ProxyManager(PoolManager): + """ + Behaves just like :class:`PoolManager`, but sends all requests through + the defined proxy, using the CONNECT method for HTTPS URLs. + + :param proxy_url: + The URL of the proxy to be used. + + :param proxy_headers: + A dictionary containing headers that will be sent to the proxy. In case + of HTTP they are being sent with each request, while in the + HTTPS/CONNECT case they are sent only once. Could be used for proxy + authentication. + + :param proxy_ssl_context: + The proxy SSL context is used to establish the TLS connection to the + proxy when using HTTPS proxies. + + :param use_forwarding_for_https: + (Defaults to False) If set to True will forward requests to the HTTPS + proxy to be made on behalf of the client instead of creating a TLS + tunnel via the CONNECT method. **Enabling this flag means that request + and response headers and content will be visible from the HTTPS proxy** + whereas tunneling keeps request and response headers and content + private. IP address, target hostname, SNI, and port are always visible + to an HTTPS proxy even when this flag is disabled. + + :param proxy_assert_hostname: + The hostname of the certificate to verify against. + + :param proxy_assert_fingerprint: + The fingerprint of the certificate to verify against. + + Example: + + .. code-block:: python + + import urllib3 + + proxy = urllib3.ProxyManager("https://localhost:3128/") + + resp1 = proxy.request("GET", "https://google.com/") + resp2 = proxy.request("GET", "https://httpbin.org/") + + print(len(proxy.pools)) + # 1 + + resp3 = proxy.request("GET", "https://httpbin.org/") + resp4 = proxy.request("GET", "https://twitter.com/") + + print(len(proxy.pools)) + # 3 + + """ + + def __init__( + self, + proxy_url: str, + num_pools: int = 10, + headers: typing.Mapping[str, str] | None = None, + proxy_headers: typing.Mapping[str, str] | None = None, + proxy_ssl_context: ssl.SSLContext | None = None, + use_forwarding_for_https: bool = False, + proxy_assert_hostname: None | str | typing.Literal[False] = None, + proxy_assert_fingerprint: str | None = None, + **connection_pool_kw: typing.Any, + ) -> None: + if isinstance(proxy_url, HTTPConnectionPool): + str_proxy_url = f"{proxy_url.scheme}://{proxy_url.host}:{proxy_url.port}" + else: + str_proxy_url = proxy_url + proxy = parse_url(str_proxy_url) + + if proxy.scheme not in ("http", "https"): + raise ProxySchemeUnknown(proxy.scheme) + + if not proxy.port: + port = port_by_scheme.get(proxy.scheme, 80) + proxy = proxy._replace(port=port) + + self.proxy = proxy + self.proxy_headers = proxy_headers or {} + self.proxy_ssl_context = proxy_ssl_context + self.proxy_config = ProxyConfig( + proxy_ssl_context, + use_forwarding_for_https, + proxy_assert_hostname, + proxy_assert_fingerprint, + ) + + connection_pool_kw["_proxy"] = self.proxy + connection_pool_kw["_proxy_headers"] = self.proxy_headers + connection_pool_kw["_proxy_config"] = self.proxy_config + + super().__init__(num_pools, headers, **connection_pool_kw) + + def connection_from_host( + self, + host: str | None, + port: int | None = None, + scheme: str | None = "http", + pool_kwargs: dict[str, typing.Any] | None = None, + ) -> HTTPConnectionPool: + if scheme == "https": + return super().connection_from_host( + host, port, scheme, pool_kwargs=pool_kwargs + ) + + return super().connection_from_host( + self.proxy.host, self.proxy.port, self.proxy.scheme, pool_kwargs=pool_kwargs # type: ignore[union-attr] + ) + + def _set_proxy_headers( + self, url: str, headers: typing.Mapping[str, str] | None = None + ) -> typing.Mapping[str, str]: + """ + Sets headers needed by proxies: specifically, the Accept and Host + headers. Only sets headers not provided by the user. + """ + headers_ = {"Accept": "*/*"} + + netloc = parse_url(url).netloc + if netloc: + headers_["Host"] = netloc + + if headers: + headers_.update(headers) + return headers_ + + def urlopen( # type: ignore[override] + self, method: str, url: str, redirect: bool = True, **kw: typing.Any + ) -> BaseHTTPResponse: + "Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute." + u = parse_url(url) + if not connection_requires_http_tunnel(self.proxy, self.proxy_config, u.scheme): + # For connections using HTTP CONNECT, httplib sets the necessary + # headers on the CONNECT to the proxy. If we're not using CONNECT, + # we'll definitely need to set 'Host' at the very least. + headers = kw.get("headers", self.headers) + kw["headers"] = self._set_proxy_headers(url, headers) + + return super().urlopen(method, url, redirect=redirect, **kw) + + +def proxy_from_url(url: str, **kw: typing.Any) -> ProxyManager: + return ProxyManager(proxy_url=url, **kw) diff --git a/.venv/lib/python3.10/site-packages/urllib3/py.typed b/.venv/lib/python3.10/site-packages/urllib3/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..5f3ea3d919363f08ab03edbc85b6099bc4df5647 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/py.typed @@ -0,0 +1,2 @@ +# Instruct type checkers to look for inline type annotations in this package. +# See PEP 561. diff --git a/.venv/lib/python3.10/site-packages/urllib3/response.py b/.venv/lib/python3.10/site-packages/urllib3/response.py new file mode 100644 index 0000000000000000000000000000000000000000..ff6d1f4911c2e304a2d7822059d9574536f81aea --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/response.py @@ -0,0 +1,1480 @@ +from __future__ import annotations + +import collections +import io +import json as _json +import logging +import socket +import sys +import typing +import warnings +import zlib +from contextlib import contextmanager +from http.client import HTTPMessage as _HttplibHTTPMessage +from http.client import HTTPResponse as _HttplibHTTPResponse +from socket import timeout as SocketTimeout + +if typing.TYPE_CHECKING: + from ._base_connection import BaseHTTPConnection + +try: + try: + import brotlicffi as brotli # type: ignore[import-not-found] + except ImportError: + import brotli # type: ignore[import-not-found] +except ImportError: + brotli = None + +from . import util +from ._base_connection import _TYPE_BODY +from ._collections import HTTPHeaderDict +from .connection import BaseSSLError, HTTPConnection, HTTPException +from .exceptions import ( + BodyNotHttplibCompatible, + DecodeError, + DependencyWarning, + HTTPError, + IncompleteRead, + InvalidChunkLength, + InvalidHeader, + ProtocolError, + ReadTimeoutError, + ResponseNotChunked, + SSLError, +) +from .util.response import is_fp_closed, is_response_to_head +from .util.retry import Retry + +if typing.TYPE_CHECKING: + from .connectionpool import HTTPConnectionPool + +log = logging.getLogger(__name__) + + +class ContentDecoder: + def decompress(self, data: bytes, max_length: int = -1) -> bytes: + raise NotImplementedError() + + @property + def has_unconsumed_tail(self) -> bool: + raise NotImplementedError() + + def flush(self) -> bytes: + raise NotImplementedError() + + +class DeflateDecoder(ContentDecoder): + def __init__(self) -> None: + self._first_try = True + self._first_try_data = b"" + self._unfed_data = b"" + self._obj = zlib.decompressobj() + + def decompress(self, data: bytes, max_length: int = -1) -> bytes: + data = self._unfed_data + data + self._unfed_data = b"" + if not data and not self._obj.unconsumed_tail: + return data + original_max_length = max_length + if original_max_length < 0: + max_length = 0 + elif original_max_length == 0: + # We should not pass 0 to the zlib decompressor because 0 is + # the default value that will make zlib decompress without a + # length limit. + # Data should be stored for subsequent calls. + self._unfed_data = data + return b"" + + # Subsequent calls always reuse `self._obj`. zlib requires + # passing the unconsumed tail if decompression is to continue. + if not self._first_try: + return self._obj.decompress( + self._obj.unconsumed_tail + data, max_length=max_length + ) + + # First call tries with RFC 1950 ZLIB format. + self._first_try_data += data + try: + decompressed = self._obj.decompress(data, max_length=max_length) + if decompressed: + self._first_try = False + self._first_try_data = b"" + return decompressed + # On failure, it falls back to RFC 1951 DEFLATE format. + except zlib.error: + self._first_try = False + self._obj = zlib.decompressobj(-zlib.MAX_WBITS) + try: + return self.decompress( + self._first_try_data, max_length=original_max_length + ) + finally: + self._first_try_data = b"" + + @property + def has_unconsumed_tail(self) -> bool: + return bool(self._unfed_data) or ( + bool(self._obj.unconsumed_tail) and not self._first_try + ) + + def flush(self) -> bytes: + return self._obj.flush() + + +class GzipDecoderState: + FIRST_MEMBER = 0 + OTHER_MEMBERS = 1 + SWALLOW_DATA = 2 + + +class GzipDecoder(ContentDecoder): + def __init__(self) -> None: + self._obj = zlib.decompressobj(16 + zlib.MAX_WBITS) + self._state = GzipDecoderState.FIRST_MEMBER + self._unconsumed_tail = b"" + + def decompress(self, data: bytes, max_length: int = -1) -> bytes: + ret = bytearray() + if self._state == GzipDecoderState.SWALLOW_DATA: + return bytes(ret) + + if max_length == 0: + # We should not pass 0 to the zlib decompressor because 0 is + # the default value that will make zlib decompress without a + # length limit. + # Data should be stored for subsequent calls. + self._unconsumed_tail += data + return b"" + + # zlib requires passing the unconsumed tail to the subsequent + # call if decompression is to continue. + data = self._unconsumed_tail + data + if not data and self._obj.eof: + return bytes(ret) + + while True: + try: + ret += self._obj.decompress( + data, max_length=max(max_length - len(ret), 0) + ) + except zlib.error: + previous_state = self._state + # Ignore data after the first error + self._state = GzipDecoderState.SWALLOW_DATA + self._unconsumed_tail = b"" + if previous_state == GzipDecoderState.OTHER_MEMBERS: + # Allow trailing garbage acceptable in other gzip clients + return bytes(ret) + raise + + self._unconsumed_tail = data = ( + self._obj.unconsumed_tail or self._obj.unused_data + ) + if max_length > 0 and len(ret) >= max_length: + break + + if not data: + return bytes(ret) + # When the end of a gzip member is reached, a new decompressor + # must be created for unused (possibly future) data. + if self._obj.eof: + self._state = GzipDecoderState.OTHER_MEMBERS + self._obj = zlib.decompressobj(16 + zlib.MAX_WBITS) + + return bytes(ret) + + @property + def has_unconsumed_tail(self) -> bool: + return bool(self._unconsumed_tail) + + def flush(self) -> bytes: + return self._obj.flush() + + +if brotli is not None: + + class BrotliDecoder(ContentDecoder): + # Supports both 'brotlipy' and 'Brotli' packages + # since they share an import name. The top branches + # are for 'brotlipy' and bottom branches for 'Brotli' + def __init__(self) -> None: + self._obj = brotli.Decompressor() + if hasattr(self._obj, "decompress"): + setattr(self, "_decompress", self._obj.decompress) + else: + setattr(self, "_decompress", self._obj.process) + + # Requires Brotli >= 1.2.0 for `output_buffer_limit`. + def _decompress(self, data: bytes, output_buffer_limit: int = -1) -> bytes: + raise NotImplementedError() + + def decompress(self, data: bytes, max_length: int = -1) -> bytes: + try: + if max_length > 0: + return self._decompress(data, output_buffer_limit=max_length) + else: + return self._decompress(data) + except TypeError: + # Fallback for Brotli/brotlicffi/brotlipy versions without + # the `output_buffer_limit` parameter. + warnings.warn( + "Brotli >= 1.2.0 is required to prevent decompression bombs.", + DependencyWarning, + ) + return self._decompress(data) + + @property + def has_unconsumed_tail(self) -> bool: + try: + return not self._obj.can_accept_more_data() + except AttributeError: + return False + + def flush(self) -> bytes: + if hasattr(self._obj, "flush"): + return self._obj.flush() # type: ignore[no-any-return] + return b"" + + +try: + if sys.version_info >= (3, 14): + from compression import zstd + else: + from backports import zstd +except ImportError: + HAS_ZSTD = False +else: + HAS_ZSTD = True + + class ZstdDecoder(ContentDecoder): + def __init__(self) -> None: + self._obj = zstd.ZstdDecompressor() + + def decompress(self, data: bytes, max_length: int = -1) -> bytes: + if not data and not self.has_unconsumed_tail: + return b"" + if self._obj.eof: + data = self._obj.unused_data + data + self._obj = zstd.ZstdDecompressor() + part = self._obj.decompress(data, max_length=max_length) + length = len(part) + data_parts = [part] + # Every loop iteration is supposed to read data from a separate frame. + # The loop breaks when: + # - enough data is read; + # - no more unused data is available; + # - end of the last read frame has not been reached (i.e., + # more data has to be fed). + while ( + self._obj.eof + and self._obj.unused_data + and (max_length < 0 or length < max_length) + ): + unused_data = self._obj.unused_data + if not self._obj.needs_input: + self._obj = zstd.ZstdDecompressor() + part = self._obj.decompress( + unused_data, + max_length=(max_length - length) if max_length > 0 else -1, + ) + if part_length := len(part): + data_parts.append(part) + length += part_length + elif self._obj.needs_input: + break + return b"".join(data_parts) + + @property + def has_unconsumed_tail(self) -> bool: + return not (self._obj.needs_input or self._obj.eof) or bool( + self._obj.unused_data + ) + + def flush(self) -> bytes: + if not self._obj.eof: + raise DecodeError("Zstandard data is incomplete") + return b"" + + +class MultiDecoder(ContentDecoder): + """ + From RFC7231: + If one or more encodings have been applied to a representation, the + sender that applied the encodings MUST generate a Content-Encoding + header field that lists the content codings in the order in which + they were applied. + """ + + # Maximum allowed number of chained HTTP encodings in the + # Content-Encoding header. + max_decode_links = 5 + + def __init__(self, modes: str) -> None: + encodings = [m.strip() for m in modes.split(",")] + if len(encodings) > self.max_decode_links: + raise DecodeError( + "Too many content encodings in the chain: " + f"{len(encodings)} > {self.max_decode_links}" + ) + self._decoders = [_get_decoder(e) for e in encodings] + + def flush(self) -> bytes: + return self._decoders[0].flush() + + def decompress(self, data: bytes, max_length: int = -1) -> bytes: + if max_length <= 0: + for d in reversed(self._decoders): + data = d.decompress(data) + return data + + ret = bytearray() + # Every while loop iteration goes through all decoders once. + # It exits when enough data is read or no more data can be read. + # It is possible that the while loop iteration does not produce + # any data because we retrieve up to `max_length` from every + # decoder, and the amount of bytes may be insufficient for the + # next decoder to produce enough/any output. + while True: + any_data = False + for d in reversed(self._decoders): + data = d.decompress(data, max_length=max_length - len(ret)) + if data: + any_data = True + # We should not break when no data is returned because + # next decoders may produce data even with empty input. + ret += data + if not any_data or len(ret) >= max_length: + return bytes(ret) + data = b"" + + @property + def has_unconsumed_tail(self) -> bool: + return any(d.has_unconsumed_tail for d in self._decoders) + + +def _get_decoder(mode: str) -> ContentDecoder: + if "," in mode: + return MultiDecoder(mode) + + # According to RFC 9110 section 8.4.1.3, recipients should + # consider x-gzip equivalent to gzip + if mode in ("gzip", "x-gzip"): + return GzipDecoder() + + if brotli is not None and mode == "br": + return BrotliDecoder() + + if HAS_ZSTD and mode == "zstd": + return ZstdDecoder() + + return DeflateDecoder() + + +class BytesQueueBuffer: + """Memory-efficient bytes buffer + + To return decoded data in read() and still follow the BufferedIOBase API, we need a + buffer to always return the correct amount of bytes. + + This buffer should be filled using calls to put() + + Our maximum memory usage is determined by the sum of the size of: + + * self.buffer, which contains the full data + * the largest chunk that we will copy in get() + """ + + def __init__(self) -> None: + self.buffer: typing.Deque[bytes | memoryview[bytes]] = collections.deque() + self._size: int = 0 + + def __len__(self) -> int: + return self._size + + def put(self, data: bytes) -> None: + self.buffer.append(data) + self._size += len(data) + + def get(self, n: int) -> bytes: + if n == 0: + return b"" + elif not self.buffer: + raise RuntimeError("buffer is empty") + elif n < 0: + raise ValueError("n should be > 0") + + if len(self.buffer[0]) == n and isinstance(self.buffer[0], bytes): + self._size -= n + return self.buffer.popleft() + + fetched = 0 + ret = io.BytesIO() + while fetched < n: + remaining = n - fetched + chunk = self.buffer.popleft() + chunk_length = len(chunk) + if remaining < chunk_length: + chunk = memoryview(chunk) + left_chunk, right_chunk = chunk[:remaining], chunk[remaining:] + ret.write(left_chunk) + self.buffer.appendleft(right_chunk) + self._size -= remaining + break + else: + ret.write(chunk) + self._size -= chunk_length + fetched += chunk_length + + if not self.buffer: + break + + return ret.getvalue() + + def get_all(self) -> bytes: + buffer = self.buffer + if not buffer: + assert self._size == 0 + return b"" + if len(buffer) == 1: + result = buffer.pop() + if isinstance(result, memoryview): + result = result.tobytes() + else: + ret = io.BytesIO() + ret.writelines(buffer.popleft() for _ in range(len(buffer))) + result = ret.getvalue() + self._size = 0 + return result + + +class BaseHTTPResponse(io.IOBase): + CONTENT_DECODERS = ["gzip", "x-gzip", "deflate"] + if brotli is not None: + CONTENT_DECODERS += ["br"] + if HAS_ZSTD: + CONTENT_DECODERS += ["zstd"] + REDIRECT_STATUSES = [301, 302, 303, 307, 308] + + DECODER_ERROR_CLASSES: tuple[type[Exception], ...] = (IOError, zlib.error) + if brotli is not None: + DECODER_ERROR_CLASSES += (brotli.error,) + + if HAS_ZSTD: + DECODER_ERROR_CLASSES += (zstd.ZstdError,) + + def __init__( + self, + *, + headers: typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None = None, + status: int, + version: int, + version_string: str, + reason: str | None, + decode_content: bool, + request_url: str | None, + retries: Retry | None = None, + ) -> None: + if isinstance(headers, HTTPHeaderDict): + self.headers = headers + else: + self.headers = HTTPHeaderDict(headers) # type: ignore[arg-type] + self.status = status + self.version = version + self.version_string = version_string + self.reason = reason + self.decode_content = decode_content + self._has_decoded_content = False + self._request_url: str | None = request_url + self.retries = retries + + self.chunked = False + tr_enc = self.headers.get("transfer-encoding", "").lower() + # Don't incur the penalty of creating a list and then discarding it + encodings = (enc.strip() for enc in tr_enc.split(",")) + if "chunked" in encodings: + self.chunked = True + + self._decoder: ContentDecoder | None = None + self.length_remaining: int | None + + def get_redirect_location(self) -> str | None | typing.Literal[False]: + """ + Should we redirect and where to? + + :returns: Truthy redirect location string if we got a redirect status + code and valid location. ``None`` if redirect status and no + location. ``False`` if not a redirect status code. + """ + if self.status in self.REDIRECT_STATUSES: + return self.headers.get("location") + return False + + @property + def data(self) -> bytes: + raise NotImplementedError() + + def json(self) -> typing.Any: + """ + Deserializes the body of the HTTP response as a Python object. + + The body of the HTTP response must be encoded using UTF-8, as per + `RFC 8529 Section 8.1 `_. + + To use a custom JSON decoder pass the result of :attr:`HTTPResponse.data` to + your custom decoder instead. + + If the body of the HTTP response is not decodable to UTF-8, a + `UnicodeDecodeError` will be raised. If the body of the HTTP response is not a + valid JSON document, a `json.JSONDecodeError` will be raised. + + Read more :ref:`here `. + + :returns: The body of the HTTP response as a Python object. + """ + data = self.data.decode("utf-8") + return _json.loads(data) + + @property + def url(self) -> str | None: + raise NotImplementedError() + + @url.setter + def url(self, url: str | None) -> None: + raise NotImplementedError() + + @property + def connection(self) -> BaseHTTPConnection | None: + raise NotImplementedError() + + @property + def retries(self) -> Retry | None: + return self._retries + + @retries.setter + def retries(self, retries: Retry | None) -> None: + # Override the request_url if retries has a redirect location. + if retries is not None and retries.history: + self.url = retries.history[-1].redirect_location + self._retries = retries + + def stream( + self, amt: int | None = 2**16, decode_content: bool | None = None + ) -> typing.Iterator[bytes]: + raise NotImplementedError() + + def read( + self, + amt: int | None = None, + decode_content: bool | None = None, + cache_content: bool = False, + ) -> bytes: + raise NotImplementedError() + + def read1( + self, + amt: int | None = None, + decode_content: bool | None = None, + ) -> bytes: + raise NotImplementedError() + + def read_chunked( + self, + amt: int | None = None, + decode_content: bool | None = None, + ) -> typing.Iterator[bytes]: + raise NotImplementedError() + + def release_conn(self) -> None: + raise NotImplementedError() + + def drain_conn(self) -> None: + raise NotImplementedError() + + def shutdown(self) -> None: + raise NotImplementedError() + + def close(self) -> None: + raise NotImplementedError() + + def _init_decoder(self) -> None: + """ + Set-up the _decoder attribute if necessary. + """ + # Note: content-encoding value should be case-insensitive, per RFC 7230 + # Section 3.2 + content_encoding = self.headers.get("content-encoding", "").lower() + if self._decoder is None: + if content_encoding in self.CONTENT_DECODERS: + self._decoder = _get_decoder(content_encoding) + elif "," in content_encoding: + encodings = [ + e.strip() + for e in content_encoding.split(",") + if e.strip() in self.CONTENT_DECODERS + ] + if encodings: + self._decoder = _get_decoder(content_encoding) + + def _decode( + self, + data: bytes, + decode_content: bool | None, + flush_decoder: bool, + max_length: int | None = None, + ) -> bytes: + """ + Decode the data passed in and potentially flush the decoder. + """ + if not decode_content: + if self._has_decoded_content: + raise RuntimeError( + "Calling read(decode_content=False) is not supported after " + "read(decode_content=True) was called." + ) + return data + + if max_length is None or flush_decoder: + max_length = -1 + + try: + if self._decoder: + data = self._decoder.decompress(data, max_length=max_length) + self._has_decoded_content = True + except self.DECODER_ERROR_CLASSES as e: + content_encoding = self.headers.get("content-encoding", "").lower() + raise DecodeError( + "Received response with content-encoding: %s, but " + "failed to decode it." % content_encoding, + e, + ) from e + if flush_decoder: + data += self._flush_decoder() + + return data + + def _flush_decoder(self) -> bytes: + """ + Flushes the decoder. Should only be called if the decoder is actually + being used. + """ + if self._decoder: + return self._decoder.decompress(b"") + self._decoder.flush() + return b"" + + # Compatibility methods for `io` module + def readinto(self, b: bytearray) -> int: + temp = self.read(len(b)) + if len(temp) == 0: + return 0 + else: + b[: len(temp)] = temp + return len(temp) + + # Methods used by dependent libraries + def getheaders(self) -> HTTPHeaderDict: + return self.headers + + def getheader(self, name: str, default: str | None = None) -> str | None: + return self.headers.get(name, default) + + # Compatibility method for http.cookiejar + def info(self) -> HTTPHeaderDict: + return self.headers + + def geturl(self) -> str | None: + return self.url + + +class HTTPResponse(BaseHTTPResponse): + """ + HTTP Response container. + + Backwards-compatible with :class:`http.client.HTTPResponse` but the response ``body`` is + loaded and decoded on-demand when the ``data`` property is accessed. This + class is also compatible with the Python standard library's :mod:`io` + module, and can hence be treated as a readable object in the context of that + framework. + + Extra parameters for behaviour not present in :class:`http.client.HTTPResponse`: + + :param preload_content: + If True, the response's body will be preloaded during construction. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param original_response: + When this HTTPResponse wrapper is generated from an :class:`http.client.HTTPResponse` + object, it's convenient to include the original for debug purposes. It's + otherwise unused. + + :param retries: + The retries contains the last :class:`~urllib3.util.retry.Retry` that + was used during the request. + + :param enforce_content_length: + Enforce content length checking. Body returned by server must match + value of Content-Length header, if present. Otherwise, raise error. + """ + + def __init__( + self, + body: _TYPE_BODY = "", + headers: typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None = None, + status: int = 0, + version: int = 0, + version_string: str = "HTTP/?", + reason: str | None = None, + preload_content: bool = True, + decode_content: bool = True, + original_response: _HttplibHTTPResponse | None = None, + pool: HTTPConnectionPool | None = None, + connection: HTTPConnection | None = None, + msg: _HttplibHTTPMessage | None = None, + retries: Retry | None = None, + enforce_content_length: bool = True, + request_method: str | None = None, + request_url: str | None = None, + auto_close: bool = True, + sock_shutdown: typing.Callable[[int], None] | None = None, + ) -> None: + super().__init__( + headers=headers, + status=status, + version=version, + version_string=version_string, + reason=reason, + decode_content=decode_content, + request_url=request_url, + retries=retries, + ) + + self.enforce_content_length = enforce_content_length + self.auto_close = auto_close + + self._body = None + self._fp: _HttplibHTTPResponse | None = None + self._original_response = original_response + self._fp_bytes_read = 0 + self.msg = msg + + if body and isinstance(body, (str, bytes)): + self._body = body + + self._pool = pool + self._connection = connection + + if hasattr(body, "read"): + self._fp = body # type: ignore[assignment] + self._sock_shutdown = sock_shutdown + + # Are we using the chunked-style of transfer encoding? + self.chunk_left: int | None = None + + # Determine length of response + self.length_remaining = self._init_length(request_method) + + # Used to return the correct amount of bytes for partial read()s + self._decoded_buffer = BytesQueueBuffer() + + # If requested, preload the body. + if preload_content and not self._body: + self._body = self.read(decode_content=decode_content) + + def release_conn(self) -> None: + if not self._pool or not self._connection: + return None + + self._pool._put_conn(self._connection) + self._connection = None + + def drain_conn(self) -> None: + """ + Read and discard any remaining HTTP response data in the response connection. + + Unread data in the HTTPResponse connection blocks the connection from being released back to the pool. + """ + try: + self.read( + # Do not spend resources decoding the content unless + # decoding has already been initiated. + decode_content=self._has_decoded_content, + ) + except (HTTPError, OSError, BaseSSLError, HTTPException): + pass + + @property + def data(self) -> bytes: + # For backwards-compat with earlier urllib3 0.4 and earlier. + if self._body: + return self._body # type: ignore[return-value] + + if self._fp: + return self.read(cache_content=True) + + return None # type: ignore[return-value] + + @property + def connection(self) -> HTTPConnection | None: + return self._connection + + def isclosed(self) -> bool: + return is_fp_closed(self._fp) + + def tell(self) -> int: + """ + Obtain the number of bytes pulled over the wire so far. May differ from + the amount of content returned by :meth:``urllib3.response.HTTPResponse.read`` + if bytes are encoded on the wire (e.g, compressed). + """ + return self._fp_bytes_read + + def _init_length(self, request_method: str | None) -> int | None: + """ + Set initial length value for Response content if available. + """ + length: int | None + content_length: str | None = self.headers.get("content-length") + + if content_length is not None: + if self.chunked: + # This Response will fail with an IncompleteRead if it can't be + # received as chunked. This method falls back to attempt reading + # the response before raising an exception. + log.warning( + "Received response with both Content-Length and " + "Transfer-Encoding set. This is expressly forbidden " + "by RFC 7230 sec 3.3.2. Ignoring Content-Length and " + "attempting to process response as Transfer-Encoding: " + "chunked." + ) + return None + + try: + # RFC 7230 section 3.3.2 specifies multiple content lengths can + # be sent in a single Content-Length header + # (e.g. Content-Length: 42, 42). This line ensures the values + # are all valid ints and that as long as the `set` length is 1, + # all values are the same. Otherwise, the header is invalid. + lengths = {int(val) for val in content_length.split(",")} + if len(lengths) > 1: + raise InvalidHeader( + "Content-Length contained multiple " + "unmatching values (%s)" % content_length + ) + length = lengths.pop() + except ValueError: + length = None + else: + if length < 0: + length = None + + else: # if content_length is None + length = None + + # Convert status to int for comparison + # In some cases, httplib returns a status of "_UNKNOWN" + try: + status = int(self.status) + except ValueError: + status = 0 + + # Check for responses that shouldn't include a body + if status in (204, 304) or 100 <= status < 200 or request_method == "HEAD": + length = 0 + + return length + + @contextmanager + def _error_catcher(self) -> typing.Generator[None]: + """ + Catch low-level python exceptions, instead re-raising urllib3 + variants, so that low-level exceptions are not leaked in the + high-level api. + + On exit, release the connection back to the pool. + """ + clean_exit = False + + try: + try: + yield + + except SocketTimeout as e: + # FIXME: Ideally we'd like to include the url in the ReadTimeoutError but + # there is yet no clean way to get at it from this context. + raise ReadTimeoutError(self._pool, None, "Read timed out.") from e # type: ignore[arg-type] + + except BaseSSLError as e: + # FIXME: Is there a better way to differentiate between SSLErrors? + if "read operation timed out" not in str(e): + # SSL errors related to framing/MAC get wrapped and reraised here + raise SSLError(e) from e + + raise ReadTimeoutError(self._pool, None, "Read timed out.") from e # type: ignore[arg-type] + + except IncompleteRead as e: + if ( + e.expected is not None + and e.partial is not None + and e.expected == -e.partial + ): + arg = "Response may not contain content." + else: + arg = f"Connection broken: {e!r}" + raise ProtocolError(arg, e) from e + + except (HTTPException, OSError) as e: + raise ProtocolError(f"Connection broken: {e!r}", e) from e + + # If no exception is thrown, we should avoid cleaning up + # unnecessarily. + clean_exit = True + finally: + # If we didn't terminate cleanly, we need to throw away our + # connection. + if not clean_exit: + # The response may not be closed but we're not going to use it + # anymore so close it now to ensure that the connection is + # released back to the pool. + if self._original_response: + self._original_response.close() + + # Closing the response may not actually be sufficient to close + # everything, so if we have a hold of the connection close that + # too. + if self._connection: + self._connection.close() + + # If we hold the original response but it's closed now, we should + # return the connection back to the pool. + if self._original_response and self._original_response.isclosed(): + self.release_conn() + + def _fp_read( + self, + amt: int | None = None, + *, + read1: bool = False, + ) -> bytes: + """ + Read a response with the thought that reading the number of bytes + larger than can fit in a 32-bit int at a time via SSL in some + known cases leads to an overflow error that has to be prevented + if `amt` or `self.length_remaining` indicate that a problem may + happen. + + The known cases: + * CPython < 3.9.7 because of a bug + https://github.com/urllib3/urllib3/issues/2513#issuecomment-1152559900. + * urllib3 injected with pyOpenSSL-backed SSL-support. + * CPython < 3.10 only when `amt` does not fit 32-bit int. + """ + assert self._fp + c_int_max = 2**31 - 1 + if ( + (amt and amt > c_int_max) + or ( + amt is None + and self.length_remaining + and self.length_remaining > c_int_max + ) + ) and (util.IS_PYOPENSSL or sys.version_info < (3, 10)): + if read1: + return self._fp.read1(c_int_max) + buffer = io.BytesIO() + # Besides `max_chunk_amt` being a maximum chunk size, it + # affects memory overhead of reading a response by this + # method in CPython. + # `c_int_max` equal to 2 GiB - 1 byte is the actual maximum + # chunk size that does not lead to an overflow error, but + # 256 MiB is a compromise. + max_chunk_amt = 2**28 + while amt is None or amt != 0: + if amt is not None: + chunk_amt = min(amt, max_chunk_amt) + amt -= chunk_amt + else: + chunk_amt = max_chunk_amt + data = self._fp.read(chunk_amt) + if not data: + break + buffer.write(data) + del data # to reduce peak memory usage by `max_chunk_amt`. + return buffer.getvalue() + elif read1: + return self._fp.read1(amt) if amt is not None else self._fp.read1() + else: + # StringIO doesn't like amt=None + return self._fp.read(amt) if amt is not None else self._fp.read() + + def _raw_read( + self, + amt: int | None = None, + *, + read1: bool = False, + ) -> bytes: + """ + Reads `amt` of bytes from the socket. + """ + if self._fp is None: + return None # type: ignore[return-value] + + fp_closed = getattr(self._fp, "closed", False) + + with self._error_catcher(): + data = self._fp_read(amt, read1=read1) if not fp_closed else b"" + if amt is not None and amt != 0 and not data: + # Platform-specific: Buggy versions of Python. + # Close the connection when no data is returned + # + # This is redundant to what httplib/http.client _should_ + # already do. However, versions of python released before + # December 15, 2012 (http://bugs.python.org/issue16298) do + # not properly close the connection in all cases. There is + # no harm in redundantly calling close. + self._fp.close() + if ( + self.enforce_content_length + and self.length_remaining is not None + and self.length_remaining != 0 + ): + # This is an edge case that httplib failed to cover due + # to concerns of backward compatibility. We're + # addressing it here to make sure IncompleteRead is + # raised during streaming, so all calls with incorrect + # Content-Length are caught. + raise IncompleteRead(self._fp_bytes_read, self.length_remaining) + elif read1 and ( + (amt != 0 and not data) or self.length_remaining == len(data) + ): + # All data has been read, but `self._fp.read1` in + # CPython 3.12 and older doesn't always close + # `http.client.HTTPResponse`, so we close it here. + # See https://github.com/python/cpython/issues/113199 + self._fp.close() + + if data: + self._fp_bytes_read += len(data) + if self.length_remaining is not None: + self.length_remaining -= len(data) + return data + + def read( + self, + amt: int | None = None, + decode_content: bool | None = None, + cache_content: bool = False, + ) -> bytes: + """ + Similar to :meth:`http.client.HTTPResponse.read`, but with two additional + parameters: ``decode_content`` and ``cache_content``. + + :param amt: + How much of the content to read. If specified, caching is skipped + because it doesn't make sense to cache partial content as the full + response. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param cache_content: + If True, will save the returned data such that the same result is + returned despite of the state of the underlying file object. This + is useful if you want the ``.data`` property to continue working + after having ``.read()`` the file object. (Overridden if ``amt`` is + set.) + """ + self._init_decoder() + if decode_content is None: + decode_content = self.decode_content + + if amt and amt < 0: + # Negative numbers and `None` should be treated the same. + amt = None + elif amt is not None: + cache_content = False + + if self._decoder and self._decoder.has_unconsumed_tail: + decoded_data = self._decode( + b"", + decode_content, + flush_decoder=False, + max_length=amt - len(self._decoded_buffer), + ) + self._decoded_buffer.put(decoded_data) + if len(self._decoded_buffer) >= amt: + return self._decoded_buffer.get(amt) + + data = self._raw_read(amt) + + flush_decoder = amt is None or (amt != 0 and not data) + + if ( + not data + and len(self._decoded_buffer) == 0 + and not (self._decoder and self._decoder.has_unconsumed_tail) + ): + return data + + if amt is None: + data = self._decode(data, decode_content, flush_decoder) + if cache_content: + self._body = data + else: + # do not waste memory on buffer when not decoding + if not decode_content: + if self._has_decoded_content: + raise RuntimeError( + "Calling read(decode_content=False) is not supported after " + "read(decode_content=True) was called." + ) + return data + + decoded_data = self._decode( + data, + decode_content, + flush_decoder, + max_length=amt - len(self._decoded_buffer), + ) + self._decoded_buffer.put(decoded_data) + + while len(self._decoded_buffer) < amt and data: + # TODO make sure to initially read enough data to get past the headers + # For example, the GZ file header takes 10 bytes, we don't want to read + # it one byte at a time + data = self._raw_read(amt) + decoded_data = self._decode( + data, + decode_content, + flush_decoder, + max_length=amt - len(self._decoded_buffer), + ) + self._decoded_buffer.put(decoded_data) + data = self._decoded_buffer.get(amt) + + return data + + def read1( + self, + amt: int | None = None, + decode_content: bool | None = None, + ) -> bytes: + """ + Similar to ``http.client.HTTPResponse.read1`` and documented + in :meth:`io.BufferedReader.read1`, but with an additional parameter: + ``decode_content``. + + :param amt: + How much of the content to read. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + """ + if decode_content is None: + decode_content = self.decode_content + if amt and amt < 0: + # Negative numbers and `None` should be treated the same. + amt = None + # try and respond without going to the network + if self._has_decoded_content: + if not decode_content: + raise RuntimeError( + "Calling read1(decode_content=False) is not supported after " + "read1(decode_content=True) was called." + ) + if ( + self._decoder + and self._decoder.has_unconsumed_tail + and (amt is None or len(self._decoded_buffer) < amt) + ): + decoded_data = self._decode( + b"", + decode_content, + flush_decoder=False, + max_length=( + amt - len(self._decoded_buffer) if amt is not None else None + ), + ) + self._decoded_buffer.put(decoded_data) + if len(self._decoded_buffer) > 0: + if amt is None: + return self._decoded_buffer.get_all() + return self._decoded_buffer.get(amt) + if amt == 0: + return b"" + + # FIXME, this method's type doesn't say returning None is possible + data = self._raw_read(amt, read1=True) + if not decode_content or data is None: + return data + + self._init_decoder() + while True: + flush_decoder = not data + decoded_data = self._decode( + data, decode_content, flush_decoder, max_length=amt + ) + self._decoded_buffer.put(decoded_data) + if decoded_data or flush_decoder: + break + data = self._raw_read(8192, read1=True) + + if amt is None: + return self._decoded_buffer.get_all() + return self._decoded_buffer.get(amt) + + def stream( + self, amt: int | None = 2**16, decode_content: bool | None = None + ) -> typing.Generator[bytes]: + """ + A generator wrapper for the read() method. A call will block until + ``amt`` bytes have been read from the connection or until the + connection is closed. + + :param amt: + How much of the content to read. The generator will return up to + much data per iteration, but may return less. This is particularly + likely when using compressed data. However, the empty string will + never be returned. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + """ + if self.chunked and self.supports_chunked_reads(): + yield from self.read_chunked(amt, decode_content=decode_content) + else: + while ( + not is_fp_closed(self._fp) + or len(self._decoded_buffer) > 0 + or (self._decoder and self._decoder.has_unconsumed_tail) + ): + data = self.read(amt=amt, decode_content=decode_content) + + if data: + yield data + + # Overrides from io.IOBase + def readable(self) -> bool: + return True + + def shutdown(self) -> None: + if not self._sock_shutdown: + raise ValueError("Cannot shutdown socket as self._sock_shutdown is not set") + if self._connection is None: + raise RuntimeError( + "Cannot shutdown as connection has already been released to the pool" + ) + self._sock_shutdown(socket.SHUT_RD) + + def close(self) -> None: + self._sock_shutdown = None + + if not self.closed and self._fp: + self._fp.close() + + if self._connection: + self._connection.close() + + if not self.auto_close: + io.IOBase.close(self) + + @property + def closed(self) -> bool: + if not self.auto_close: + return io.IOBase.closed.__get__(self) # type: ignore[no-any-return] + elif self._fp is None: + return True + elif hasattr(self._fp, "isclosed"): + return self._fp.isclosed() + elif hasattr(self._fp, "closed"): + return self._fp.closed + else: + return True + + def fileno(self) -> int: + if self._fp is None: + raise OSError("HTTPResponse has no file to get a fileno from") + elif hasattr(self._fp, "fileno"): + return self._fp.fileno() + else: + raise OSError( + "The file-like object this HTTPResponse is wrapped " + "around has no file descriptor" + ) + + def flush(self) -> None: + if ( + self._fp is not None + and hasattr(self._fp, "flush") + and not getattr(self._fp, "closed", False) + ): + return self._fp.flush() + + def supports_chunked_reads(self) -> bool: + """ + Checks if the underlying file-like object looks like a + :class:`http.client.HTTPResponse` object. We do this by testing for + the fp attribute. If it is present we assume it returns raw chunks as + processed by read_chunked(). + """ + return hasattr(self._fp, "fp") + + def _update_chunk_length(self) -> None: + # First, we'll figure out length of a chunk and then + # we'll try to read it from socket. + if self.chunk_left is not None: + return None + line = self._fp.fp.readline() # type: ignore[union-attr] + line = line.split(b";", 1)[0] + try: + self.chunk_left = int(line, 16) + except ValueError: + self.close() + if line: + # Invalid chunked protocol response, abort. + raise InvalidChunkLength(self, line) from None + else: + # Truncated at start of next chunk + raise ProtocolError("Response ended prematurely") from None + + def _handle_chunk(self, amt: int | None) -> bytes: + returned_chunk = None + if amt is None: + chunk = self._fp._safe_read(self.chunk_left) # type: ignore[union-attr] + returned_chunk = chunk + self._fp._safe_read(2) # type: ignore[union-attr] # Toss the CRLF at the end of the chunk. + self.chunk_left = None + elif self.chunk_left is not None and amt < self.chunk_left: + value = self._fp._safe_read(amt) # type: ignore[union-attr] + self.chunk_left = self.chunk_left - amt + returned_chunk = value + elif amt == self.chunk_left: + value = self._fp._safe_read(amt) # type: ignore[union-attr] + self._fp._safe_read(2) # type: ignore[union-attr] # Toss the CRLF at the end of the chunk. + self.chunk_left = None + returned_chunk = value + else: # amt > self.chunk_left + returned_chunk = self._fp._safe_read(self.chunk_left) # type: ignore[union-attr] + self._fp._safe_read(2) # type: ignore[union-attr] # Toss the CRLF at the end of the chunk. + self.chunk_left = None + return returned_chunk # type: ignore[no-any-return] + + def read_chunked( + self, amt: int | None = None, decode_content: bool | None = None + ) -> typing.Generator[bytes]: + """ + Similar to :meth:`HTTPResponse.read`, but with an additional + parameter: ``decode_content``. + + :param amt: + How much of the content to read. If specified, caching is skipped + because it doesn't make sense to cache partial content as the full + response. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + """ + self._init_decoder() + # FIXME: Rewrite this method and make it a class with a better structured logic. + if not self.chunked: + raise ResponseNotChunked( + "Response is not chunked. " + "Header 'transfer-encoding: chunked' is missing." + ) + if not self.supports_chunked_reads(): + raise BodyNotHttplibCompatible( + "Body should be http.client.HTTPResponse like. " + "It should have have an fp attribute which returns raw chunks." + ) + + with self._error_catcher(): + # Don't bother reading the body of a HEAD request. + if self._original_response and is_response_to_head(self._original_response): + self._original_response.close() + return None + + # If a response is already read and closed + # then return immediately. + if self._fp.fp is None: # type: ignore[union-attr] + return None + + if amt and amt < 0: + # Negative numbers and `None` should be treated the same, + # but httplib handles only `None` correctly. + amt = None + + while True: + # First, check if any data is left in the decoder's buffer. + if self._decoder and self._decoder.has_unconsumed_tail: + chunk = b"" + else: + self._update_chunk_length() + if self.chunk_left == 0: + break + chunk = self._handle_chunk(amt) + decoded = self._decode( + chunk, + decode_content=decode_content, + flush_decoder=False, + max_length=amt, + ) + if decoded: + yield decoded + + if decode_content: + # On CPython and PyPy, we should never need to flush the + # decoder. However, on Jython we *might* need to, so + # lets defensively do it anyway. + decoded = self._flush_decoder() + if decoded: # Platform-specific: Jython. + yield decoded + + # Chunk content ends with \r\n: discard it. + while self._fp is not None: + line = self._fp.fp.readline() + if not line: + # Some sites may not end with '\r\n'. + break + if line == b"\r\n": + break + + # We read everything; close the "file". + if self._original_response: + self._original_response.close() + + @property + def url(self) -> str | None: + """ + Returns the URL that was the source of this response. + If the request that generated this response redirected, this method + will return the final redirect location. + """ + return self._request_url + + @url.setter + def url(self, url: str | None) -> None: + self._request_url = url + + def __iter__(self) -> typing.Iterator[bytes]: + buffer: list[bytes] = [] + for chunk in self.stream(decode_content=True): + if b"\n" in chunk: + chunks = chunk.split(b"\n") + yield b"".join(buffer) + chunks[0] + b"\n" + for x in chunks[1:-1]: + yield x + b"\n" + if chunks[-1]: + buffer = [chunks[-1]] + else: + buffer = [] + else: + buffer.append(chunk) + if buffer: + yield b"".join(buffer) diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__init__.py b/.venv/lib/python3.10/site-packages/urllib3/util/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..534126033c083203649022fa9b753a433f005556 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/__init__.py @@ -0,0 +1,42 @@ +# For backwards compatibility, provide imports that used to be here. +from __future__ import annotations + +from .connection import is_connection_dropped +from .request import SKIP_HEADER, SKIPPABLE_HEADERS, make_headers +from .response import is_fp_closed +from .retry import Retry +from .ssl_ import ( + ALPN_PROTOCOLS, + IS_PYOPENSSL, + SSLContext, + assert_fingerprint, + create_urllib3_context, + resolve_cert_reqs, + resolve_ssl_version, + ssl_wrap_socket, +) +from .timeout import Timeout +from .url import Url, parse_url +from .wait import wait_for_read, wait_for_write + +__all__ = ( + "IS_PYOPENSSL", + "SSLContext", + "ALPN_PROTOCOLS", + "Retry", + "Timeout", + "Url", + "assert_fingerprint", + "create_urllib3_context", + "is_connection_dropped", + "is_fp_closed", + "parse_url", + "make_headers", + "resolve_cert_reqs", + "resolve_ssl_version", + "ssl_wrap_socket", + "wait_for_read", + "wait_for_write", + "SKIP_HEADER", + "SKIPPABLE_HEADERS", +) diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/__init__.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..00109e7a8ee5931447c3b5d84cea55df954718c2 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/__init__.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/connection.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/connection.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..857d9343464d148664f6431eebcbf3a672baf2aa Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/connection.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/proxy.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/proxy.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e13790c6f1ec42dade3e390fef31e188e0eda1bd Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/proxy.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/request.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/request.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..baebaff7b3031be2a40dea7ca6a08b811f7aea10 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/request.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/response.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/response.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..329861e7fde7da4a6c7d06ee3be4678cb159e26c Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/response.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/retry.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/retry.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bdf2a46573a95628d962b614e53da676f202774e Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/retry.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/ssl_.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/ssl_.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f25e502da2e2fb692f17eafe2a28381513e44e8 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/ssl_.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/ssl_match_hostname.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/ssl_match_hostname.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9a5933fce7a5cf225cd04db4080bc088dfa41d12 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/ssl_match_hostname.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/ssltransport.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/ssltransport.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5e1e5f6fbae1330b6c9cae0980a7c1c5ca580626 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/ssltransport.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/timeout.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/timeout.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d84cdf6ddbdfe5e2a7a133b3c3637e094fd82f61 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/timeout.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/url.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/url.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2b5ed7e7cdab660cde187835182dd879c70c8eb0 Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/url.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/util.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/util.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8bdcb539b0c4e4acc43e559f949bd490bf39fcfd Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/util.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/wait.cpython-310.pyc b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/wait.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..55ca44abe97b450b37fb151fc56202871e19df5d Binary files /dev/null and b/.venv/lib/python3.10/site-packages/urllib3/util/__pycache__/wait.cpython-310.pyc differ diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/connection.py b/.venv/lib/python3.10/site-packages/urllib3/util/connection.py new file mode 100644 index 0000000000000000000000000000000000000000..f92519ee9124e91e5da7d60ccc3f274312ed3514 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/connection.py @@ -0,0 +1,137 @@ +from __future__ import annotations + +import socket +import typing + +from ..exceptions import LocationParseError +from .timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT + +_TYPE_SOCKET_OPTIONS = list[tuple[int, int, typing.Union[int, bytes]]] + +if typing.TYPE_CHECKING: + from .._base_connection import BaseHTTPConnection + + +def is_connection_dropped(conn: BaseHTTPConnection) -> bool: # Platform-specific + """ + Returns True if the connection is dropped and should be closed. + :param conn: :class:`urllib3.connection.HTTPConnection` object. + """ + return not conn.is_connected + + +# This function is copied from socket.py in the Python 2.7 standard +# library test suite. Added to its signature is only `socket_options`. +# One additional modification is that we avoid binding to IPv6 servers +# discovered in DNS if the system doesn't have IPv6 functionality. +def create_connection( + address: tuple[str, int], + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + socket_options: _TYPE_SOCKET_OPTIONS | None = None, +) -> socket.socket: + """Connect to *address* and return the socket object. + + Convenience function. Connect to *address* (a 2-tuple ``(host, + port)``) and return the socket object. Passing the optional + *timeout* parameter will set the timeout on the socket instance + before attempting to connect. If no *timeout* is supplied, the + global default timeout setting returned by :func:`socket.getdefaulttimeout` + is used. If *source_address* is set it must be a tuple of (host, port) + for the socket to bind as a source address before making the connection. + An host of '' or port 0 tells the OS to use the default. + """ + + host, port = address + if host.startswith("["): + host = host.strip("[]") + err = None + + # Using the value from allowed_gai_family() in the context of getaddrinfo lets + # us select whether to work with IPv4 DNS records, IPv6 records, or both. + # The original create_connection function always returns all records. + family = allowed_gai_family() + + try: + host.encode("idna") + except UnicodeError: + raise LocationParseError(f"'{host}', label empty or too long") from None + + for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): + af, socktype, proto, canonname, sa = res + sock = None + try: + sock = socket.socket(af, socktype, proto) + + # If provided, set socket level options before connecting. + _set_socket_options(sock, socket_options) + + if timeout is not _DEFAULT_TIMEOUT: + sock.settimeout(timeout) + if source_address: + sock.bind(source_address) + sock.connect(sa) + # Break explicitly a reference cycle + err = None + return sock + + except OSError as _: + err = _ + if sock is not None: + sock.close() + + if err is not None: + try: + raise err + finally: + # Break explicitly a reference cycle + err = None + else: + raise OSError("getaddrinfo returns an empty list") + + +def _set_socket_options( + sock: socket.socket, options: _TYPE_SOCKET_OPTIONS | None +) -> None: + if options is None: + return + + for opt in options: + sock.setsockopt(*opt) + + +def allowed_gai_family() -> socket.AddressFamily: + """This function is designed to work in the context of + getaddrinfo, where family=socket.AF_UNSPEC is the default and + will perform a DNS search for both IPv6 and IPv4 records.""" + + family = socket.AF_INET + if HAS_IPV6: + family = socket.AF_UNSPEC + return family + + +def _has_ipv6(host: str) -> bool: + """Returns True if the system can bind an IPv6 address.""" + sock = None + has_ipv6 = False + + if socket.has_ipv6: + # has_ipv6 returns true if cPython was compiled with IPv6 support. + # It does not tell us if the system has IPv6 support enabled. To + # determine that we must bind to an IPv6 address. + # https://github.com/urllib3/urllib3/pull/611 + # https://bugs.python.org/issue658327 + try: + sock = socket.socket(socket.AF_INET6) + sock.bind((host, 0)) + has_ipv6 = True + except Exception: + pass + + if sock: + sock.close() + return has_ipv6 + + +HAS_IPV6 = _has_ipv6("::1") diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/proxy.py b/.venv/lib/python3.10/site-packages/urllib3/util/proxy.py new file mode 100644 index 0000000000000000000000000000000000000000..908fc6621d0afbed16bde2c1957a5cf28d3a84d8 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/proxy.py @@ -0,0 +1,43 @@ +from __future__ import annotations + +import typing + +from .url import Url + +if typing.TYPE_CHECKING: + from ..connection import ProxyConfig + + +def connection_requires_http_tunnel( + proxy_url: Url | None = None, + proxy_config: ProxyConfig | None = None, + destination_scheme: str | None = None, +) -> bool: + """ + Returns True if the connection requires an HTTP CONNECT through the proxy. + + :param URL proxy_url: + URL of the proxy. + :param ProxyConfig proxy_config: + Proxy configuration from poolmanager.py + :param str destination_scheme: + The scheme of the destination. (i.e https, http, etc) + """ + # If we're not using a proxy, no way to use a tunnel. + if proxy_url is None: + return False + + # HTTP destinations never require tunneling, we always forward. + if destination_scheme == "http": + return False + + # Support for forwarding with HTTPS proxies and HTTPS destinations. + if ( + proxy_url.scheme == "https" + and proxy_config + and proxy_config.use_forwarding_for_https + ): + return False + + # Otherwise always use a tunnel. + return True diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/request.py b/.venv/lib/python3.10/site-packages/urllib3/util/request.py new file mode 100644 index 0000000000000000000000000000000000000000..6c2372ba7e777826a4eb124ddfb54f0240b65d67 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/request.py @@ -0,0 +1,263 @@ +from __future__ import annotations + +import io +import sys +import typing +from base64 import b64encode +from enum import Enum + +from ..exceptions import UnrewindableBodyError +from .util import to_bytes + +if typing.TYPE_CHECKING: + from typing import Final + +# Pass as a value within ``headers`` to skip +# emitting some HTTP headers that are added automatically. +# The only headers that are supported are ``Accept-Encoding``, +# ``Host``, and ``User-Agent``. +SKIP_HEADER = "@@@SKIP_HEADER@@@" +SKIPPABLE_HEADERS = frozenset(["accept-encoding", "host", "user-agent"]) + +ACCEPT_ENCODING = "gzip,deflate" +try: + try: + import brotlicffi as _unused_module_brotli # type: ignore[import-not-found] # noqa: F401 + except ImportError: + import brotli as _unused_module_brotli # type: ignore[import-not-found] # noqa: F401 +except ImportError: + pass +else: + ACCEPT_ENCODING += ",br" + +try: + if sys.version_info >= (3, 14): + from compression import zstd as _unused_module_zstd # noqa: F401 + else: + from backports import zstd as _unused_module_zstd # noqa: F401 +except ImportError: + pass +else: + ACCEPT_ENCODING += ",zstd" + + +class _TYPE_FAILEDTELL(Enum): + token = 0 + + +_FAILEDTELL: Final[_TYPE_FAILEDTELL] = _TYPE_FAILEDTELL.token + +_TYPE_BODY_POSITION = typing.Union[int, _TYPE_FAILEDTELL] + +# When sending a request with these methods we aren't expecting +# a body so don't need to set an explicit 'Content-Length: 0' +# The reason we do this in the negative instead of tracking methods +# which 'should' have a body is because unknown methods should be +# treated as if they were 'POST' which *does* expect a body. +_METHODS_NOT_EXPECTING_BODY = {"GET", "HEAD", "DELETE", "TRACE", "OPTIONS", "CONNECT"} + + +def make_headers( + keep_alive: bool | None = None, + accept_encoding: bool | list[str] | str | None = None, + user_agent: str | None = None, + basic_auth: str | None = None, + proxy_basic_auth: str | None = None, + disable_cache: bool | None = None, +) -> dict[str, str]: + """ + Shortcuts for generating request headers. + + :param keep_alive: + If ``True``, adds 'connection: keep-alive' header. + + :param accept_encoding: + Can be a boolean, list, or string. + ``True`` translates to 'gzip,deflate'. If the dependencies for + Brotli (either the ``brotli`` or ``brotlicffi`` package) and/or + Zstandard (the ``backports.zstd`` package for Python before 3.14) + algorithms are installed, then their encodings are + included in the string ('br' and 'zstd', respectively). + List will get joined by comma. + String will be used as provided. + + :param user_agent: + String representing the user-agent you want, such as + "python-urllib3/0.6" + + :param basic_auth: + Colon-separated username:password string for 'authorization: basic ...' + auth header. + + :param proxy_basic_auth: + Colon-separated username:password string for 'proxy-authorization: basic ...' + auth header. + + :param disable_cache: + If ``True``, adds 'cache-control: no-cache' header. + + Example: + + .. code-block:: python + + import urllib3 + + print(urllib3.util.make_headers(keep_alive=True, user_agent="Batman/1.0")) + # {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'} + print(urllib3.util.make_headers(accept_encoding=True)) + # {'accept-encoding': 'gzip,deflate'} + """ + headers: dict[str, str] = {} + if accept_encoding: + if isinstance(accept_encoding, str): + pass + elif isinstance(accept_encoding, list): + accept_encoding = ",".join(accept_encoding) + else: + accept_encoding = ACCEPT_ENCODING + headers["accept-encoding"] = accept_encoding + + if user_agent: + headers["user-agent"] = user_agent + + if keep_alive: + headers["connection"] = "keep-alive" + + if basic_auth: + headers["authorization"] = ( + f"Basic {b64encode(basic_auth.encode('latin-1')).decode()}" + ) + + if proxy_basic_auth: + headers["proxy-authorization"] = ( + f"Basic {b64encode(proxy_basic_auth.encode('latin-1')).decode()}" + ) + + if disable_cache: + headers["cache-control"] = "no-cache" + + return headers + + +def set_file_position( + body: typing.Any, pos: _TYPE_BODY_POSITION | None +) -> _TYPE_BODY_POSITION | None: + """ + If a position is provided, move file to that point. + Otherwise, we'll attempt to record a position for future use. + """ + if pos is not None: + rewind_body(body, pos) + elif getattr(body, "tell", None) is not None: + try: + pos = body.tell() + except OSError: + # This differentiates from None, allowing us to catch + # a failed `tell()` later when trying to rewind the body. + pos = _FAILEDTELL + + return pos + + +def rewind_body(body: typing.IO[typing.AnyStr], body_pos: _TYPE_BODY_POSITION) -> None: + """ + Attempt to rewind body to a certain position. + Primarily used for request redirects and retries. + + :param body: + File-like object that supports seek. + + :param int pos: + Position to seek to in file. + """ + body_seek = getattr(body, "seek", None) + if body_seek is not None and isinstance(body_pos, int): + try: + body_seek(body_pos) + except OSError as e: + raise UnrewindableBodyError( + "An error occurred when rewinding request body for redirect/retry." + ) from e + elif body_pos is _FAILEDTELL: + raise UnrewindableBodyError( + "Unable to record file position for rewinding " + "request body during a redirect/retry." + ) + else: + raise ValueError( + f"body_pos must be of type integer, instead it was {type(body_pos)}." + ) + + +class ChunksAndContentLength(typing.NamedTuple): + chunks: typing.Iterable[bytes] | None + content_length: int | None + + +def body_to_chunks( + body: typing.Any | None, method: str, blocksize: int +) -> ChunksAndContentLength: + """Takes the HTTP request method, body, and blocksize and + transforms them into an iterable of chunks to pass to + socket.sendall() and an optional 'Content-Length' header. + + A 'Content-Length' of 'None' indicates the length of the body + can't be determined so should use 'Transfer-Encoding: chunked' + for framing instead. + """ + + chunks: typing.Iterable[bytes] | None + content_length: int | None + + # No body, we need to make a recommendation on 'Content-Length' + # based on whether that request method is expected to have + # a body or not. + if body is None: + chunks = None + if method.upper() not in _METHODS_NOT_EXPECTING_BODY: + content_length = 0 + else: + content_length = None + + # Bytes or strings become bytes + elif isinstance(body, (str, bytes)): + chunks = (to_bytes(body),) + content_length = len(chunks[0]) + + # File-like object, TODO: use seek() and tell() for length? + elif hasattr(body, "read"): + + def chunk_readable() -> typing.Iterable[bytes]: + encode = isinstance(body, io.TextIOBase) + while True: + datablock = body.read(blocksize) + if not datablock: + break + if encode: + datablock = datablock.encode("utf-8") + yield datablock + + chunks = chunk_readable() + content_length = None + + # Otherwise we need to start checking via duck-typing. + else: + try: + # Check if the body implements the buffer API. + mv = memoryview(body) + except TypeError: + try: + # Check if the body is an iterable + chunks = iter(body) + content_length = None + except TypeError: + raise TypeError( + f"'body' must be a bytes-like object, file-like " + f"object, or iterable. Instead was {body!r}" + ) from None + else: + # Since it implements the buffer API can be passed directly to socket.sendall() + chunks = (body,) + content_length = mv.nbytes + + return ChunksAndContentLength(chunks=chunks, content_length=content_length) diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/response.py b/.venv/lib/python3.10/site-packages/urllib3/util/response.py new file mode 100644 index 0000000000000000000000000000000000000000..0f4578696fa2e17a900c6890ec26d65e860b0b72 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/response.py @@ -0,0 +1,101 @@ +from __future__ import annotations + +import http.client as httplib +from email.errors import MultipartInvariantViolationDefect, StartBoundaryNotFoundDefect + +from ..exceptions import HeaderParsingError + + +def is_fp_closed(obj: object) -> bool: + """ + Checks whether a given file-like object is closed. + + :param obj: + The file-like object to check. + """ + + try: + # Check `isclosed()` first, in case Python3 doesn't set `closed`. + # GH Issue #928 + return obj.isclosed() # type: ignore[no-any-return, attr-defined] + except AttributeError: + pass + + try: + # Check via the official file-like-object way. + return obj.closed # type: ignore[no-any-return, attr-defined] + except AttributeError: + pass + + try: + # Check if the object is a container for another file-like object that + # gets released on exhaustion (e.g. HTTPResponse). + return obj.fp is None # type: ignore[attr-defined] + except AttributeError: + pass + + raise ValueError("Unable to determine whether fp is closed.") + + +def assert_header_parsing(headers: httplib.HTTPMessage) -> None: + """ + Asserts whether all headers have been successfully parsed. + Extracts encountered errors from the result of parsing headers. + + Only works on Python 3. + + :param http.client.HTTPMessage headers: Headers to verify. + + :raises urllib3.exceptions.HeaderParsingError: + If parsing errors are found. + """ + + # This will fail silently if we pass in the wrong kind of parameter. + # To make debugging easier add an explicit check. + if not isinstance(headers, httplib.HTTPMessage): + raise TypeError(f"expected httplib.Message, got {type(headers)}.") + + unparsed_data = None + + # get_payload is actually email.message.Message.get_payload; + # we're only interested in the result if it's not a multipart message + if not headers.is_multipart(): + payload = headers.get_payload() + + if isinstance(payload, (bytes, str)): + unparsed_data = payload + + # httplib is assuming a response body is available + # when parsing headers even when httplib only sends + # header data to parse_headers() This results in + # defects on multipart responses in particular. + # See: https://github.com/urllib3/urllib3/issues/800 + + # So we ignore the following defects: + # - StartBoundaryNotFoundDefect: + # The claimed start boundary was never found. + # - MultipartInvariantViolationDefect: + # A message claimed to be a multipart but no subparts were found. + defects = [ + defect + for defect in headers.defects + if not isinstance( + defect, (StartBoundaryNotFoundDefect, MultipartInvariantViolationDefect) + ) + ] + + if defects or unparsed_data: + raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data) + + +def is_response_to_head(response: httplib.HTTPResponse) -> bool: + """ + Checks whether the request of a response has been a HEAD-request. + + :param http.client.HTTPResponse response: + Response to check if the originating request + used 'HEAD' as a method. + """ + # FIXME: Can we do this somehow without accessing private httplib _method? + method_str = response._method # type: str # type: ignore[attr-defined] + return method_str.upper() == "HEAD" diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/retry.py b/.venv/lib/python3.10/site-packages/urllib3/util/retry.py new file mode 100644 index 0000000000000000000000000000000000000000..b21b4b64ebbd4748eb6fa4301f947b0d4965da8b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/retry.py @@ -0,0 +1,549 @@ +from __future__ import annotations + +import email +import logging +import random +import re +import time +import typing +from itertools import takewhile +from types import TracebackType + +from ..exceptions import ( + ConnectTimeoutError, + InvalidHeader, + MaxRetryError, + ProtocolError, + ProxyError, + ReadTimeoutError, + ResponseError, +) +from .util import reraise + +if typing.TYPE_CHECKING: + from typing_extensions import Self + + from ..connectionpool import ConnectionPool + from ..response import BaseHTTPResponse + +log = logging.getLogger(__name__) + + +# Data structure for representing the metadata of requests that result in a retry. +class RequestHistory(typing.NamedTuple): + method: str | None + url: str | None + error: Exception | None + status: int | None + redirect_location: str | None + + +class Retry: + """Retry configuration. + + Each retry attempt will create a new Retry object with updated values, so + they can be safely reused. + + Retries can be defined as a default for a pool: + + .. code-block:: python + + retries = Retry(connect=5, read=2, redirect=5) + http = PoolManager(retries=retries) + response = http.request("GET", "https://example.com/") + + Or per-request (which overrides the default for the pool): + + .. code-block:: python + + response = http.request("GET", "https://example.com/", retries=Retry(10)) + + Retries can be disabled by passing ``False``: + + .. code-block:: python + + response = http.request("GET", "https://example.com/", retries=False) + + Errors will be wrapped in :class:`~urllib3.exceptions.MaxRetryError` unless + retries are disabled, in which case the causing exception will be raised. + + :param int total: + Total number of retries to allow. Takes precedence over other counts. + + Set to ``None`` to remove this constraint and fall back on other + counts. + + Set to ``0`` to fail on the first retry. + + Set to ``False`` to disable and imply ``raise_on_redirect=False``. + + :param int connect: + How many connection-related errors to retry on. + + These are errors raised before the request is sent to the remote server, + which we assume has not triggered the server to process the request. + + Set to ``0`` to fail on the first retry of this type. + + :param int read: + How many times to retry on read errors. + + These errors are raised after the request was sent to the server, so the + request may have side-effects. + + Set to ``0`` to fail on the first retry of this type. + + :param int redirect: + How many redirects to perform. Limit this to avoid infinite redirect + loops. + + A redirect is a HTTP response with a status code 301, 302, 303, 307 or + 308. + + Set to ``0`` to fail on the first retry of this type. + + Set to ``False`` to disable and imply ``raise_on_redirect=False``. + + :param int status: + How many times to retry on bad status codes. + + These are retries made on responses, where status code matches + ``status_forcelist``. + + Set to ``0`` to fail on the first retry of this type. + + :param int other: + How many times to retry on other errors. + + Other errors are errors that are not connect, read, redirect or status errors. + These errors might be raised after the request was sent to the server, so the + request might have side-effects. + + Set to ``0`` to fail on the first retry of this type. + + If ``total`` is not set, it's a good idea to set this to 0 to account + for unexpected edge cases and avoid infinite retry loops. + + :param Collection allowed_methods: + Set of uppercased HTTP method verbs that we should retry on. + + By default, we only retry on methods which are considered to be + idempotent (multiple requests with the same parameters end with the + same state). See :attr:`Retry.DEFAULT_ALLOWED_METHODS`. + + Set to a ``None`` value to retry on any verb. + + :param Collection status_forcelist: + A set of integer HTTP status codes that we should force a retry on. + A retry is initiated if the request method is in ``allowed_methods`` + and the response status code is in ``status_forcelist``. + + By default, this is disabled with ``None``. + + :param float backoff_factor: + A backoff factor to apply between attempts after the second try + (most errors are resolved immediately by a second try without a + delay). urllib3 will sleep for:: + + {backoff factor} * (2 ** ({number of previous retries})) + + seconds. If `backoff_jitter` is non-zero, this sleep is extended by:: + + random.uniform(0, {backoff jitter}) + + seconds. For example, if the backoff_factor is 0.1, then :func:`Retry.sleep` will + sleep for [0.0s, 0.2s, 0.4s, 0.8s, ...] between retries. No backoff will ever + be longer than `backoff_max`. + + By default, backoff is disabled (factor set to 0). + + :param bool raise_on_redirect: Whether, if the number of redirects is + exhausted, to raise a MaxRetryError, or to return a response with a + response code in the 3xx range. + + :param bool raise_on_status: Similar meaning to ``raise_on_redirect``: + whether we should raise an exception, or return a response, + if status falls in ``status_forcelist`` range and retries have + been exhausted. + + :param tuple history: The history of the request encountered during + each call to :meth:`~Retry.increment`. The list is in the order + the requests occurred. Each list item is of class :class:`RequestHistory`. + + :param bool respect_retry_after_header: + Whether to respect Retry-After header on status codes defined as + :attr:`Retry.RETRY_AFTER_STATUS_CODES` or not. + + :param Collection remove_headers_on_redirect: + Sequence of headers to remove from the request when a response + indicating a redirect is returned before firing off the redirected + request. + + :param int retry_after_max: Number of seconds to allow as the maximum for + Retry-After headers. Defaults to :attr:`Retry.DEFAULT_RETRY_AFTER_MAX`. + Any Retry-After headers larger than this value will be limited to this + value. + """ + + #: Default methods to be used for ``allowed_methods`` + DEFAULT_ALLOWED_METHODS = frozenset( + ["HEAD", "GET", "PUT", "DELETE", "OPTIONS", "TRACE"] + ) + + #: Default status codes to be used for ``status_forcelist`` + RETRY_AFTER_STATUS_CODES = frozenset([413, 429, 503]) + + #: Default headers to be used for ``remove_headers_on_redirect`` + DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset( + ["Cookie", "Authorization", "Proxy-Authorization"] + ) + + #: Default maximum backoff time. + DEFAULT_BACKOFF_MAX = 120 + + # This is undocumented in the RFC. Setting to 6 hours matches other popular libraries. + #: Default maximum allowed value for Retry-After headers in seconds + DEFAULT_RETRY_AFTER_MAX: typing.Final[int] = 21600 + + # Backward compatibility; assigned outside of the class. + DEFAULT: typing.ClassVar[Retry] + + def __init__( + self, + total: bool | int | None = 10, + connect: int | None = None, + read: int | None = None, + redirect: bool | int | None = None, + status: int | None = None, + other: int | None = None, + allowed_methods: typing.Collection[str] | None = DEFAULT_ALLOWED_METHODS, + status_forcelist: typing.Collection[int] | None = None, + backoff_factor: float = 0, + backoff_max: float = DEFAULT_BACKOFF_MAX, + raise_on_redirect: bool = True, + raise_on_status: bool = True, + history: tuple[RequestHistory, ...] | None = None, + respect_retry_after_header: bool = True, + remove_headers_on_redirect: typing.Collection[ + str + ] = DEFAULT_REMOVE_HEADERS_ON_REDIRECT, + backoff_jitter: float = 0.0, + retry_after_max: int = DEFAULT_RETRY_AFTER_MAX, + ) -> None: + self.total = total + self.connect = connect + self.read = read + self.status = status + self.other = other + + if redirect is False or total is False: + redirect = 0 + raise_on_redirect = False + + self.redirect = redirect + self.status_forcelist = status_forcelist or set() + self.allowed_methods = allowed_methods + self.backoff_factor = backoff_factor + self.backoff_max = backoff_max + self.retry_after_max = retry_after_max + self.raise_on_redirect = raise_on_redirect + self.raise_on_status = raise_on_status + self.history = history or () + self.respect_retry_after_header = respect_retry_after_header + self.remove_headers_on_redirect = frozenset( + h.lower() for h in remove_headers_on_redirect + ) + self.backoff_jitter = backoff_jitter + + def new(self, **kw: typing.Any) -> Self: + params = dict( + total=self.total, + connect=self.connect, + read=self.read, + redirect=self.redirect, + status=self.status, + other=self.other, + allowed_methods=self.allowed_methods, + status_forcelist=self.status_forcelist, + backoff_factor=self.backoff_factor, + backoff_max=self.backoff_max, + retry_after_max=self.retry_after_max, + raise_on_redirect=self.raise_on_redirect, + raise_on_status=self.raise_on_status, + history=self.history, + remove_headers_on_redirect=self.remove_headers_on_redirect, + respect_retry_after_header=self.respect_retry_after_header, + backoff_jitter=self.backoff_jitter, + ) + + params.update(kw) + return type(self)(**params) # type: ignore[arg-type] + + @classmethod + def from_int( + cls, + retries: Retry | bool | int | None, + redirect: bool | int | None = True, + default: Retry | bool | int | None = None, + ) -> Retry: + """Backwards-compatibility for the old retries format.""" + if retries is None: + retries = default if default is not None else cls.DEFAULT + + if isinstance(retries, Retry): + return retries + + redirect = bool(redirect) and None + new_retries = cls(retries, redirect=redirect) + log.debug("Converted retries value: %r -> %r", retries, new_retries) + return new_retries + + def get_backoff_time(self) -> float: + """Formula for computing the current backoff + + :rtype: float + """ + # We want to consider only the last consecutive errors sequence (Ignore redirects). + consecutive_errors_len = len( + list( + takewhile(lambda x: x.redirect_location is None, reversed(self.history)) + ) + ) + if consecutive_errors_len <= 1: + return 0 + + backoff_value = self.backoff_factor * (2 ** (consecutive_errors_len - 1)) + if self.backoff_jitter != 0.0: + backoff_value += random.random() * self.backoff_jitter + return float(max(0, min(self.backoff_max, backoff_value))) + + def parse_retry_after(self, retry_after: str) -> float: + seconds: float + # Whitespace: https://tools.ietf.org/html/rfc7230#section-3.2.4 + if re.match(r"^\s*[0-9]+\s*$", retry_after): + seconds = int(retry_after) + else: + retry_date_tuple = email.utils.parsedate_tz(retry_after) + if retry_date_tuple is None: + raise InvalidHeader(f"Invalid Retry-After header: {retry_after}") + + retry_date = email.utils.mktime_tz(retry_date_tuple) + seconds = retry_date - time.time() + + seconds = max(seconds, 0) + + # Check the seconds do not exceed the specified maximum + if seconds > self.retry_after_max: + seconds = self.retry_after_max + + return seconds + + def get_retry_after(self, response: BaseHTTPResponse) -> float | None: + """Get the value of Retry-After in seconds.""" + + retry_after = response.headers.get("Retry-After") + + if retry_after is None: + return None + + return self.parse_retry_after(retry_after) + + def sleep_for_retry(self, response: BaseHTTPResponse) -> bool: + retry_after = self.get_retry_after(response) + if retry_after: + time.sleep(retry_after) + return True + + return False + + def _sleep_backoff(self) -> None: + backoff = self.get_backoff_time() + if backoff <= 0: + return + time.sleep(backoff) + + def sleep(self, response: BaseHTTPResponse | None = None) -> None: + """Sleep between retry attempts. + + This method will respect a server's ``Retry-After`` response header + and sleep the duration of the time requested. If that is not present, it + will use an exponential backoff. By default, the backoff factor is 0 and + this method will return immediately. + """ + + if self.respect_retry_after_header and response: + slept = self.sleep_for_retry(response) + if slept: + return + + self._sleep_backoff() + + def _is_connection_error(self, err: Exception) -> bool: + """Errors when we're fairly sure that the server did not receive the + request, so it should be safe to retry. + """ + if isinstance(err, ProxyError): + err = err.original_error + return isinstance(err, ConnectTimeoutError) + + def _is_read_error(self, err: Exception) -> bool: + """Errors that occur after the request has been started, so we should + assume that the server began processing it. + """ + return isinstance(err, (ReadTimeoutError, ProtocolError)) + + def _is_method_retryable(self, method: str) -> bool: + """Checks if a given HTTP method should be retried upon, depending if + it is included in the allowed_methods + """ + if self.allowed_methods and method.upper() not in self.allowed_methods: + return False + return True + + def is_retry( + self, method: str, status_code: int, has_retry_after: bool = False + ) -> bool: + """Is this method/status code retryable? (Based on allowlists and control + variables such as the number of total retries to allow, whether to + respect the Retry-After header, whether this header is present, and + whether the returned status code is on the list of status codes to + be retried upon on the presence of the aforementioned header) + """ + if not self._is_method_retryable(method): + return False + + if self.status_forcelist and status_code in self.status_forcelist: + return True + + return bool( + self.total + and self.respect_retry_after_header + and has_retry_after + and (status_code in self.RETRY_AFTER_STATUS_CODES) + ) + + def is_exhausted(self) -> bool: + """Are we out of retries?""" + retry_counts = [ + x + for x in ( + self.total, + self.connect, + self.read, + self.redirect, + self.status, + self.other, + ) + if x + ] + if not retry_counts: + return False + + return min(retry_counts) < 0 + + def increment( + self, + method: str | None = None, + url: str | None = None, + response: BaseHTTPResponse | None = None, + error: Exception | None = None, + _pool: ConnectionPool | None = None, + _stacktrace: TracebackType | None = None, + ) -> Self: + """Return a new Retry object with incremented retry counters. + + :param response: A response object, or None, if the server did not + return a response. + :type response: :class:`~urllib3.response.BaseHTTPResponse` + :param Exception error: An error encountered during the request, or + None if the response was received successfully. + + :return: A new ``Retry`` object. + """ + if self.total is False and error: + # Disabled, indicate to re-raise the error. + raise reraise(type(error), error, _stacktrace) + + total = self.total + if total is not None: + total -= 1 + + connect = self.connect + read = self.read + redirect = self.redirect + status_count = self.status + other = self.other + cause = "unknown" + status = None + redirect_location = None + + if error and self._is_connection_error(error): + # Connect retry? + if connect is False: + raise reraise(type(error), error, _stacktrace) + elif connect is not None: + connect -= 1 + + elif error and self._is_read_error(error): + # Read retry? + if read is False or method is None or not self._is_method_retryable(method): + raise reraise(type(error), error, _stacktrace) + elif read is not None: + read -= 1 + + elif error: + # Other retry? + if other is not None: + other -= 1 + + elif response and response.get_redirect_location(): + # Redirect retry? + if redirect is not None: + redirect -= 1 + cause = "too many redirects" + response_redirect_location = response.get_redirect_location() + if response_redirect_location: + redirect_location = response_redirect_location + status = response.status + + else: + # Incrementing because of a server error like a 500 in + # status_forcelist and the given method is in the allowed_methods + cause = ResponseError.GENERIC_ERROR + if response and response.status: + if status_count is not None: + status_count -= 1 + cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) + status = response.status + + history = self.history + ( + RequestHistory(method, url, error, status, redirect_location), + ) + + new_retry = self.new( + total=total, + connect=connect, + read=read, + redirect=redirect, + status=status_count, + other=other, + history=history, + ) + + if new_retry.is_exhausted(): + reason = error or ResponseError(cause) + raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] + + log.debug("Incremented Retry for (url='%s'): %r", url, new_retry) + + return new_retry + + def __repr__(self) -> str: + return ( + f"{type(self).__name__}(total={self.total}, connect={self.connect}, " + f"read={self.read}, redirect={self.redirect}, status={self.status})" + ) + + +# For backwards compatibility (equivalent to pre-v1.9): +Retry.DEFAULT = Retry(3) diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/ssl_.py b/.venv/lib/python3.10/site-packages/urllib3/util/ssl_.py new file mode 100644 index 0000000000000000000000000000000000000000..56fe9093adaa86b30085aef2435e49f84841df12 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/ssl_.py @@ -0,0 +1,527 @@ +from __future__ import annotations + +import hashlib +import hmac +import os +import socket +import sys +import typing +import warnings +from binascii import unhexlify + +from ..exceptions import ProxySchemeUnsupported, SSLError +from .url import _BRACELESS_IPV6_ADDRZ_RE, _IPV4_RE + +SSLContext = None +SSLTransport = None +HAS_NEVER_CHECK_COMMON_NAME = False +IS_PYOPENSSL = False +ALPN_PROTOCOLS = ["http/1.1"] + +_TYPE_VERSION_INFO = tuple[int, int, int, str, int] + +# Maps the length of a digest to a possible hash function producing this digest +HASHFUNC_MAP = { + length: getattr(hashlib, algorithm, None) + for length, algorithm in ((32, "md5"), (40, "sha1"), (64, "sha256")) +} + + +def _is_bpo_43522_fixed( + implementation_name: str, + version_info: _TYPE_VERSION_INFO, + pypy_version_info: _TYPE_VERSION_INFO | None, +) -> bool: + """Return True for CPython 3.9.3+ or 3.10+ and PyPy 7.3.8+ where + setting SSLContext.hostname_checks_common_name to False works. + + Outside of CPython and PyPy we don't know which implementations work + or not so we conservatively use our hostname matching as we know that works + on all implementations. + + https://github.com/urllib3/urllib3/issues/2192#issuecomment-821832963 + https://foss.heptapod.net/pypy/pypy/-/issues/3539 + """ + if implementation_name == "pypy": + # https://foss.heptapod.net/pypy/pypy/-/issues/3129 + return pypy_version_info >= (7, 3, 8) # type: ignore[operator] + elif implementation_name == "cpython": + major_minor = version_info[:2] + micro = version_info[2] + return (major_minor == (3, 9) and micro >= 3) or major_minor >= (3, 10) + else: # Defensive: + return False + + +def _is_has_never_check_common_name_reliable( + openssl_version: str, + openssl_version_number: int, + implementation_name: str, + version_info: _TYPE_VERSION_INFO, + pypy_version_info: _TYPE_VERSION_INFO | None, +) -> bool: + # As of May 2023, all released versions of LibreSSL fail to reject certificates with + # only common names, see https://github.com/urllib3/urllib3/pull/3024 + is_openssl = openssl_version.startswith("OpenSSL ") + # Before fixing OpenSSL issue #14579, the SSL_new() API was not copying hostflags + # like X509_CHECK_FLAG_NEVER_CHECK_SUBJECT, which tripped up CPython. + # https://github.com/openssl/openssl/issues/14579 + # This was released in OpenSSL 1.1.1l+ (>=0x101010cf) + is_openssl_issue_14579_fixed = openssl_version_number >= 0x101010CF + + return is_openssl and ( + is_openssl_issue_14579_fixed + or _is_bpo_43522_fixed(implementation_name, version_info, pypy_version_info) + ) + + +if typing.TYPE_CHECKING: + from ssl import VerifyMode + from typing import TypedDict + + from .ssltransport import SSLTransport as SSLTransportType + + class _TYPE_PEER_CERT_RET_DICT(TypedDict, total=False): + subjectAltName: tuple[tuple[str, str], ...] + subject: tuple[tuple[tuple[str, str], ...], ...] + serialNumber: str + + +# Mapping from 'ssl.PROTOCOL_TLSX' to 'TLSVersion.X' +_SSL_VERSION_TO_TLS_VERSION: dict[int, int] = {} + +try: # Do we have ssl at all? + import ssl + from ssl import ( # type: ignore[assignment] + CERT_REQUIRED, + HAS_NEVER_CHECK_COMMON_NAME, + OP_NO_COMPRESSION, + OP_NO_TICKET, + OPENSSL_VERSION, + OPENSSL_VERSION_NUMBER, + PROTOCOL_TLS, + PROTOCOL_TLS_CLIENT, + VERIFY_X509_STRICT, + OP_NO_SSLv2, + OP_NO_SSLv3, + SSLContext, + TLSVersion, + ) + + PROTOCOL_SSLv23 = PROTOCOL_TLS + + # Needed for Python 3.9 which does not define this + VERIFY_X509_PARTIAL_CHAIN = getattr(ssl, "VERIFY_X509_PARTIAL_CHAIN", 0x80000) + + # Setting SSLContext.hostname_checks_common_name = False didn't work before CPython + # 3.9.3, and 3.10 (but OK on PyPy) or OpenSSL 1.1.1l+ + if HAS_NEVER_CHECK_COMMON_NAME and not _is_has_never_check_common_name_reliable( + OPENSSL_VERSION, + OPENSSL_VERSION_NUMBER, + sys.implementation.name, + sys.version_info, + sys.pypy_version_info if sys.implementation.name == "pypy" else None, # type: ignore[attr-defined] + ): # Defensive: for Python < 3.9.3 + HAS_NEVER_CHECK_COMMON_NAME = False + + # Need to be careful here in case old TLS versions get + # removed in future 'ssl' module implementations. + for attr in ("TLSv1", "TLSv1_1", "TLSv1_2"): + try: + _SSL_VERSION_TO_TLS_VERSION[getattr(ssl, f"PROTOCOL_{attr}")] = getattr( + TLSVersion, attr + ) + except AttributeError: # Defensive: + continue + + from .ssltransport import SSLTransport # type: ignore[assignment] +except ImportError: + OP_NO_COMPRESSION = 0x20000 # type: ignore[assignment, misc] + OP_NO_TICKET = 0x4000 # type: ignore[assignment, misc] + OP_NO_SSLv2 = 0x1000000 # type: ignore[assignment, misc] + OP_NO_SSLv3 = 0x2000000 # type: ignore[assignment, misc] + PROTOCOL_SSLv23 = PROTOCOL_TLS = 2 # type: ignore[assignment, misc] + PROTOCOL_TLS_CLIENT = 16 # type: ignore[assignment, misc] + VERIFY_X509_PARTIAL_CHAIN = 0x80000 + VERIFY_X509_STRICT = 0x20 # type: ignore[assignment, misc] + + +_TYPE_PEER_CERT_RET = typing.Union["_TYPE_PEER_CERT_RET_DICT", bytes, None] + + +def assert_fingerprint(cert: bytes | None, fingerprint: str) -> None: + """ + Checks if given fingerprint matches the supplied certificate. + + :param cert: + Certificate as bytes object. + :param fingerprint: + Fingerprint as string of hexdigits, can be interspersed by colons. + """ + + if cert is None: + raise SSLError("No certificate for the peer.") + + fingerprint = fingerprint.replace(":", "").lower() + digest_length = len(fingerprint) + if digest_length not in HASHFUNC_MAP: + raise SSLError(f"Fingerprint of invalid length: {fingerprint}") + hashfunc = HASHFUNC_MAP.get(digest_length) + if hashfunc is None: + raise SSLError( + f"Hash function implementation unavailable for fingerprint length: {digest_length}" + ) + + # We need encode() here for py32; works on py2 and p33. + fingerprint_bytes = unhexlify(fingerprint.encode()) + + cert_digest = hashfunc(cert).digest() + + if not hmac.compare_digest(cert_digest, fingerprint_bytes): + raise SSLError( + f'Fingerprints did not match. Expected "{fingerprint}", got "{cert_digest.hex()}"' + ) + + +def resolve_cert_reqs(candidate: None | int | str) -> VerifyMode: + """ + Resolves the argument to a numeric constant, which can be passed to + the wrap_socket function/method from the ssl module. + Defaults to :data:`ssl.CERT_REQUIRED`. + If given a string it is assumed to be the name of the constant in the + :mod:`ssl` module or its abbreviation. + (So you can specify `REQUIRED` instead of `CERT_REQUIRED`. + If it's neither `None` nor a string we assume it is already the numeric + constant which can directly be passed to wrap_socket. + """ + if candidate is None: + return CERT_REQUIRED + + if isinstance(candidate, str): + res = getattr(ssl, candidate, None) + if res is None: + res = getattr(ssl, "CERT_" + candidate) + return res # type: ignore[no-any-return] + + return candidate # type: ignore[return-value] + + +def resolve_ssl_version(candidate: None | int | str) -> int: + """ + like resolve_cert_reqs + """ + if candidate is None: + return PROTOCOL_TLS + + if isinstance(candidate, str): + res = getattr(ssl, candidate, None) + if res is None: + res = getattr(ssl, "PROTOCOL_" + candidate) + return typing.cast(int, res) + + return candidate + + +def create_urllib3_context( + ssl_version: int | None = None, + cert_reqs: int | None = None, + options: int | None = None, + ciphers: str | None = None, + ssl_minimum_version: int | None = None, + ssl_maximum_version: int | None = None, + verify_flags: int | None = None, +) -> ssl.SSLContext: + """Creates and configures an :class:`ssl.SSLContext` instance for use with urllib3. + + :param ssl_version: + The desired protocol version to use. This will default to + PROTOCOL_SSLv23 which will negotiate the highest protocol that both + the server and your installation of OpenSSL support. + + This parameter is deprecated instead use 'ssl_minimum_version'. + :param ssl_minimum_version: + The minimum version of TLS to be used. Use the 'ssl.TLSVersion' enum for specifying the value. + :param ssl_maximum_version: + The maximum version of TLS to be used. Use the 'ssl.TLSVersion' enum for specifying the value. + Not recommended to set to anything other than 'ssl.TLSVersion.MAXIMUM_SUPPORTED' which is the + default value. + :param cert_reqs: + Whether to require the certificate verification. This defaults to + ``ssl.CERT_REQUIRED``. + :param options: + Specific OpenSSL options. These default to ``ssl.OP_NO_SSLv2``, + ``ssl.OP_NO_SSLv3``, ``ssl.OP_NO_COMPRESSION``, and ``ssl.OP_NO_TICKET``. + :param ciphers: + Which cipher suites to allow the server to select. Defaults to either system configured + ciphers if OpenSSL 1.1.1+, otherwise uses a secure default set of ciphers. + :param verify_flags: + The flags for certificate verification operations. These default to + ``ssl.VERIFY_X509_PARTIAL_CHAIN`` and ``ssl.VERIFY_X509_STRICT`` for Python 3.13+. + :returns: + Constructed SSLContext object with specified options + :rtype: SSLContext + """ + if SSLContext is None: + raise TypeError("Can't create an SSLContext object without an ssl module") + + # This means 'ssl_version' was specified as an exact value. + if ssl_version not in (None, PROTOCOL_TLS, PROTOCOL_TLS_CLIENT): + # Disallow setting 'ssl_version' and 'ssl_minimum|maximum_version' + # to avoid conflicts. + if ssl_minimum_version is not None or ssl_maximum_version is not None: + raise ValueError( + "Can't specify both 'ssl_version' and either " + "'ssl_minimum_version' or 'ssl_maximum_version'" + ) + + # 'ssl_version' is deprecated and will be removed in the future. + else: + # Use 'ssl_minimum_version' and 'ssl_maximum_version' instead. + ssl_minimum_version = _SSL_VERSION_TO_TLS_VERSION.get( + ssl_version, TLSVersion.MINIMUM_SUPPORTED + ) + ssl_maximum_version = _SSL_VERSION_TO_TLS_VERSION.get( + ssl_version, TLSVersion.MAXIMUM_SUPPORTED + ) + + # This warning message is pushing users to use 'ssl_minimum_version' + # instead of both min/max. Best practice is to only set the minimum version and + # keep the maximum version to be it's default value: 'TLSVersion.MAXIMUM_SUPPORTED' + warnings.warn( + "'ssl_version' option is deprecated and will be " + "removed in urllib3 v2.6.0. Instead use 'ssl_minimum_version'", + category=DeprecationWarning, + stacklevel=2, + ) + + # PROTOCOL_TLS is deprecated in Python 3.10 so we always use PROTOCOL_TLS_CLIENT + context = SSLContext(PROTOCOL_TLS_CLIENT) + + if ssl_minimum_version is not None: + context.minimum_version = ssl_minimum_version + else: # Python <3.10 defaults to 'MINIMUM_SUPPORTED' so explicitly set TLSv1.2 here + context.minimum_version = TLSVersion.TLSv1_2 + + if ssl_maximum_version is not None: + context.maximum_version = ssl_maximum_version + + # Unless we're given ciphers defer to either system ciphers in + # the case of OpenSSL 1.1.1+ or use our own secure default ciphers. + if ciphers: + context.set_ciphers(ciphers) + + # Setting the default here, as we may have no ssl module on import + cert_reqs = ssl.CERT_REQUIRED if cert_reqs is None else cert_reqs + + if options is None: + options = 0 + # SSLv2 is easily broken and is considered harmful and dangerous + options |= OP_NO_SSLv2 + # SSLv3 has several problems and is now dangerous + options |= OP_NO_SSLv3 + # Disable compression to prevent CRIME attacks for OpenSSL 1.0+ + # (issue #309) + options |= OP_NO_COMPRESSION + # TLSv1.2 only. Unless set explicitly, do not request tickets. + # This may save some bandwidth on wire, and although the ticket is encrypted, + # there is a risk associated with it being on wire, + # if the server is not rotating its ticketing keys properly. + options |= OP_NO_TICKET + + context.options |= options + + if verify_flags is None: + verify_flags = 0 + # In Python 3.13+ ssl.create_default_context() sets VERIFY_X509_PARTIAL_CHAIN + # and VERIFY_X509_STRICT so we do the same + if sys.version_info >= (3, 13): + verify_flags |= VERIFY_X509_PARTIAL_CHAIN + verify_flags |= VERIFY_X509_STRICT + + context.verify_flags |= verify_flags + + # Enable post-handshake authentication for TLS 1.3, see GH #1634. PHA is + # necessary for conditional client cert authentication with TLS 1.3. + # The attribute is None for OpenSSL <= 1.1.0 or does not exist when using + # an SSLContext created by pyOpenSSL. + if getattr(context, "post_handshake_auth", None) is not None: + context.post_handshake_auth = True + + # The order of the below lines setting verify_mode and check_hostname + # matter due to safe-guards SSLContext has to prevent an SSLContext with + # check_hostname=True, verify_mode=NONE/OPTIONAL. + # We always set 'check_hostname=False' for pyOpenSSL so we rely on our own + # 'ssl.match_hostname()' implementation. + if cert_reqs == ssl.CERT_REQUIRED and not IS_PYOPENSSL: + context.verify_mode = cert_reqs + context.check_hostname = True + else: + context.check_hostname = False + context.verify_mode = cert_reqs + + try: + context.hostname_checks_common_name = False + except AttributeError: # Defensive: for CPython < 3.9.3; for PyPy < 7.3.8 + pass + + if "SSLKEYLOGFILE" in os.environ: + sslkeylogfile = os.path.expandvars(os.environ.get("SSLKEYLOGFILE")) + else: + sslkeylogfile = None + if sslkeylogfile: + context.keylog_filename = sslkeylogfile + + return context + + +@typing.overload +def ssl_wrap_socket( + sock: socket.socket, + keyfile: str | None = ..., + certfile: str | None = ..., + cert_reqs: int | None = ..., + ca_certs: str | None = ..., + server_hostname: str | None = ..., + ssl_version: int | None = ..., + ciphers: str | None = ..., + ssl_context: ssl.SSLContext | None = ..., + ca_cert_dir: str | None = ..., + key_password: str | None = ..., + ca_cert_data: None | str | bytes = ..., + tls_in_tls: typing.Literal[False] = ..., +) -> ssl.SSLSocket: ... + + +@typing.overload +def ssl_wrap_socket( + sock: socket.socket, + keyfile: str | None = ..., + certfile: str | None = ..., + cert_reqs: int | None = ..., + ca_certs: str | None = ..., + server_hostname: str | None = ..., + ssl_version: int | None = ..., + ciphers: str | None = ..., + ssl_context: ssl.SSLContext | None = ..., + ca_cert_dir: str | None = ..., + key_password: str | None = ..., + ca_cert_data: None | str | bytes = ..., + tls_in_tls: bool = ..., +) -> ssl.SSLSocket | SSLTransportType: ... + + +def ssl_wrap_socket( + sock: socket.socket, + keyfile: str | None = None, + certfile: str | None = None, + cert_reqs: int | None = None, + ca_certs: str | None = None, + server_hostname: str | None = None, + ssl_version: int | None = None, + ciphers: str | None = None, + ssl_context: ssl.SSLContext | None = None, + ca_cert_dir: str | None = None, + key_password: str | None = None, + ca_cert_data: None | str | bytes = None, + tls_in_tls: bool = False, +) -> ssl.SSLSocket | SSLTransportType: + """ + All arguments except for server_hostname, ssl_context, tls_in_tls, ca_cert_data and + ca_cert_dir have the same meaning as they do when using + :func:`ssl.create_default_context`, :meth:`ssl.SSLContext.load_cert_chain`, + :meth:`ssl.SSLContext.set_ciphers` and :meth:`ssl.SSLContext.wrap_socket`. + + :param server_hostname: + When SNI is supported, the expected hostname of the certificate + :param ssl_context: + A pre-made :class:`SSLContext` object. If none is provided, one will + be created using :func:`create_urllib3_context`. + :param ciphers: + A string of ciphers we wish the client to support. + :param ca_cert_dir: + A directory containing CA certificates in multiple separate files, as + supported by OpenSSL's -CApath flag or the capath argument to + SSLContext.load_verify_locations(). + :param key_password: + Optional password if the keyfile is encrypted. + :param ca_cert_data: + Optional string containing CA certificates in PEM format suitable for + passing as the cadata parameter to SSLContext.load_verify_locations() + :param tls_in_tls: + Use SSLTransport to wrap the existing socket. + """ + context = ssl_context + if context is None: + # Note: This branch of code and all the variables in it are only used in tests. + # We should consider deprecating and removing this code. + context = create_urllib3_context(ssl_version, cert_reqs, ciphers=ciphers) + + if ca_certs or ca_cert_dir or ca_cert_data: + try: + context.load_verify_locations(ca_certs, ca_cert_dir, ca_cert_data) + except OSError as e: + raise SSLError(e) from e + + elif ssl_context is None and hasattr(context, "load_default_certs"): + # try to load OS default certs; works well on Windows. + context.load_default_certs() + + # Attempt to detect if we get the goofy behavior of the + # keyfile being encrypted and OpenSSL asking for the + # passphrase via the terminal and instead error out. + if keyfile and key_password is None and _is_key_file_encrypted(keyfile): + raise SSLError("Client private key is encrypted, password is required") + + if certfile: + if key_password is None: + context.load_cert_chain(certfile, keyfile) + else: + context.load_cert_chain(certfile, keyfile, key_password) + + context.set_alpn_protocols(ALPN_PROTOCOLS) + + ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname) + return ssl_sock + + +def is_ipaddress(hostname: str | bytes) -> bool: + """Detects whether the hostname given is an IPv4 or IPv6 address. + Also detects IPv6 addresses with Zone IDs. + + :param str hostname: Hostname to examine. + :return: True if the hostname is an IP address, False otherwise. + """ + if isinstance(hostname, bytes): + # IDN A-label bytes are ASCII compatible. + hostname = hostname.decode("ascii") + return bool(_IPV4_RE.match(hostname) or _BRACELESS_IPV6_ADDRZ_RE.match(hostname)) + + +def _is_key_file_encrypted(key_file: str) -> bool: + """Detects if a key file is encrypted or not.""" + with open(key_file) as f: + for line in f: + # Look for Proc-Type: 4,ENCRYPTED + if "ENCRYPTED" in line: + return True + + return False + + +def _ssl_wrap_socket_impl( + sock: socket.socket, + ssl_context: ssl.SSLContext, + tls_in_tls: bool, + server_hostname: str | None = None, +) -> ssl.SSLSocket | SSLTransportType: + if tls_in_tls: + if not SSLTransport: + # Import error, ssl is not available. + raise ProxySchemeUnsupported( + "TLS in TLS requires support for the 'ssl' module" + ) + + SSLTransport._validate_ssl_context_for_tls_in_tls(ssl_context) + return SSLTransport(sock, ssl_context, server_hostname) + + return ssl_context.wrap_socket(sock, server_hostname=server_hostname) diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/ssl_match_hostname.py b/.venv/lib/python3.10/site-packages/urllib3/util/ssl_match_hostname.py new file mode 100644 index 0000000000000000000000000000000000000000..25d91000419ea4a860f511ebe669fe171b79254c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/ssl_match_hostname.py @@ -0,0 +1,159 @@ +"""The match_hostname() function from Python 3.5, essential when using SSL.""" + +# Note: This file is under the PSF license as the code comes from the python +# stdlib. http://docs.python.org/3/license.html +# It is modified to remove commonName support. + +from __future__ import annotations + +import ipaddress +import re +import typing +from ipaddress import IPv4Address, IPv6Address + +if typing.TYPE_CHECKING: + from .ssl_ import _TYPE_PEER_CERT_RET_DICT + +__version__ = "3.5.0.1" + + +class CertificateError(ValueError): + pass + + +def _dnsname_match( + dn: typing.Any, hostname: str, max_wildcards: int = 1 +) -> typing.Match[str] | None | bool: + """Matching according to RFC 6125, section 6.4.3 + + http://tools.ietf.org/html/rfc6125#section-6.4.3 + """ + pats = [] + if not dn: + return False + + # Ported from python3-syntax: + # leftmost, *remainder = dn.split(r'.') + parts = dn.split(r".") + leftmost = parts[0] + remainder = parts[1:] + + wildcards = leftmost.count("*") + if wildcards > max_wildcards: + # Issue #17980: avoid denials of service by refusing more + # than one wildcard per fragment. A survey of established + # policy among SSL implementations showed it to be a + # reasonable choice. + raise CertificateError( + "too many wildcards in certificate DNS name: " + repr(dn) + ) + + # speed up common case w/o wildcards + if not wildcards: + return bool(dn.lower() == hostname.lower()) + + # RFC 6125, section 6.4.3, subitem 1. + # The client SHOULD NOT attempt to match a presented identifier in which + # the wildcard character comprises a label other than the left-most label. + if leftmost == "*": + # When '*' is a fragment by itself, it matches a non-empty dotless + # fragment. + pats.append("[^.]+") + elif leftmost.startswith("xn--") or hostname.startswith("xn--"): + # RFC 6125, section 6.4.3, subitem 3. + # The client SHOULD NOT attempt to match a presented identifier + # where the wildcard character is embedded within an A-label or + # U-label of an internationalized domain name. + pats.append(re.escape(leftmost)) + else: + # Otherwise, '*' matches any dotless string, e.g. www* + pats.append(re.escape(leftmost).replace(r"\*", "[^.]*")) + + # add the remaining fragments, ignore any wildcards + for frag in remainder: + pats.append(re.escape(frag)) + + pat = re.compile(r"\A" + r"\.".join(pats) + r"\Z", re.IGNORECASE) + return pat.match(hostname) + + +def _ipaddress_match(ipname: str, host_ip: IPv4Address | IPv6Address) -> bool: + """Exact matching of IP addresses. + + RFC 9110 section 4.3.5: "A reference identity of IP-ID contains the decoded + bytes of the IP address. An IP version 4 address is 4 octets, and an IP + version 6 address is 16 octets. [...] A reference identity of type IP-ID + matches if the address is identical to an iPAddress value of the + subjectAltName extension of the certificate." + """ + # OpenSSL may add a trailing newline to a subjectAltName's IP address + # Divergence from upstream: ipaddress can't handle byte str + ip = ipaddress.ip_address(ipname.rstrip()) + return bool(ip.packed == host_ip.packed) + + +def match_hostname( + cert: _TYPE_PEER_CERT_RET_DICT | None, + hostname: str, + hostname_checks_common_name: bool = False, +) -> None: + """Verify that *cert* (in decoded format as returned by + SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 + rules are followed, but IP addresses are not accepted for *hostname*. + + CertificateError is raised on failure. On success, the function + returns nothing. + """ + if not cert: + raise ValueError( + "empty or no certificate, match_hostname needs a " + "SSL socket or SSL context with either " + "CERT_OPTIONAL or CERT_REQUIRED" + ) + try: + # Divergence from upstream: ipaddress can't handle byte str + # + # The ipaddress module shipped with Python < 3.9 does not support + # scoped IPv6 addresses so we unconditionally strip the Zone IDs for + # now. Once we drop support for Python 3.9 we can remove this branch. + if "%" in hostname: + host_ip = ipaddress.ip_address(hostname[: hostname.rfind("%")]) + else: + host_ip = ipaddress.ip_address(hostname) + + except ValueError: + # Not an IP address (common case) + host_ip = None + dnsnames = [] + san: tuple[tuple[str, str], ...] = cert.get("subjectAltName", ()) + key: str + value: str + for key, value in san: + if key == "DNS": + if host_ip is None and _dnsname_match(value, hostname): + return + dnsnames.append(value) + elif key == "IP Address": + if host_ip is not None and _ipaddress_match(value, host_ip): + return + dnsnames.append(value) + + # We only check 'commonName' if it's enabled and we're not verifying + # an IP address. IP addresses aren't valid within 'commonName'. + if hostname_checks_common_name and host_ip is None and not dnsnames: + for sub in cert.get("subject", ()): + for key, value in sub: + if key == "commonName": + if _dnsname_match(value, hostname): + return + dnsnames.append(value) # Defensive: for Python < 3.9.3 + + if len(dnsnames) > 1: + raise CertificateError( + "hostname %r " + "doesn't match either of %s" % (hostname, ", ".join(map(repr, dnsnames))) + ) + elif len(dnsnames) == 1: + raise CertificateError(f"hostname {hostname!r} doesn't match {dnsnames[0]!r}") + else: + raise CertificateError("no appropriate subjectAltName fields were found") diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/ssltransport.py b/.venv/lib/python3.10/site-packages/urllib3/util/ssltransport.py new file mode 100644 index 0000000000000000000000000000000000000000..6d59bc3bce2489c3a0aa5bcb83b737dcf33c033b --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/ssltransport.py @@ -0,0 +1,271 @@ +from __future__ import annotations + +import io +import socket +import ssl +import typing + +from ..exceptions import ProxySchemeUnsupported + +if typing.TYPE_CHECKING: + from typing_extensions import Self + + from .ssl_ import _TYPE_PEER_CERT_RET, _TYPE_PEER_CERT_RET_DICT + + +_WriteBuffer = typing.Union[bytearray, memoryview] +_ReturnValue = typing.TypeVar("_ReturnValue") + +SSL_BLOCKSIZE = 16384 + + +class SSLTransport: + """ + The SSLTransport wraps an existing socket and establishes an SSL connection. + + Contrary to Python's implementation of SSLSocket, it allows you to chain + multiple TLS connections together. It's particularly useful if you need to + implement TLS within TLS. + + The class supports most of the socket API operations. + """ + + @staticmethod + def _validate_ssl_context_for_tls_in_tls(ssl_context: ssl.SSLContext) -> None: + """ + Raises a ProxySchemeUnsupported if the provided ssl_context can't be used + for TLS in TLS. + + The only requirement is that the ssl_context provides the 'wrap_bio' + methods. + """ + + if not hasattr(ssl_context, "wrap_bio"): + raise ProxySchemeUnsupported( + "TLS in TLS requires SSLContext.wrap_bio() which isn't " + "available on non-native SSLContext" + ) + + def __init__( + self, + socket: socket.socket, + ssl_context: ssl.SSLContext, + server_hostname: str | None = None, + suppress_ragged_eofs: bool = True, + ) -> None: + """ + Create an SSLTransport around socket using the provided ssl_context. + """ + self.incoming = ssl.MemoryBIO() + self.outgoing = ssl.MemoryBIO() + + self.suppress_ragged_eofs = suppress_ragged_eofs + self.socket = socket + + self.sslobj = ssl_context.wrap_bio( + self.incoming, self.outgoing, server_hostname=server_hostname + ) + + # Perform initial handshake. + self._ssl_io_loop(self.sslobj.do_handshake) + + def __enter__(self) -> Self: + return self + + def __exit__(self, *_: typing.Any) -> None: + self.close() + + def fileno(self) -> int: + return self.socket.fileno() + + def read(self, len: int = 1024, buffer: typing.Any | None = None) -> int | bytes: + return self._wrap_ssl_read(len, buffer) + + def recv(self, buflen: int = 1024, flags: int = 0) -> int | bytes: + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to recv") + return self._wrap_ssl_read(buflen) + + def recv_into( + self, + buffer: _WriteBuffer, + nbytes: int | None = None, + flags: int = 0, + ) -> None | int | bytes: + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to recv_into") + if nbytes is None: + nbytes = len(buffer) + return self.read(nbytes, buffer) + + def sendall(self, data: bytes, flags: int = 0) -> None: + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to sendall") + count = 0 + with memoryview(data) as view, view.cast("B") as byte_view: + amount = len(byte_view) + while count < amount: + v = self.send(byte_view[count:]) + count += v + + def send(self, data: bytes, flags: int = 0) -> int: + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to send") + return self._ssl_io_loop(self.sslobj.write, data) + + def makefile( + self, + mode: str, + buffering: int | None = None, + *, + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, + ) -> typing.BinaryIO | typing.TextIO | socket.SocketIO: + """ + Python's httpclient uses makefile and buffered io when reading HTTP + messages and we need to support it. + + This is unfortunately a copy and paste of socket.py makefile with small + changes to point to the socket directly. + """ + if not set(mode) <= {"r", "w", "b"}: + raise ValueError(f"invalid mode {mode!r} (only r, w, b allowed)") + + writing = "w" in mode + reading = "r" in mode or not writing + assert reading or writing + binary = "b" in mode + rawmode = "" + if reading: + rawmode += "r" + if writing: + rawmode += "w" + raw = socket.SocketIO(self, rawmode) # type: ignore[arg-type] + self.socket._io_refs += 1 # type: ignore[attr-defined] + if buffering is None: + buffering = -1 + if buffering < 0: + buffering = io.DEFAULT_BUFFER_SIZE + if buffering == 0: + if not binary: + raise ValueError("unbuffered streams must be binary") + return raw + buffer: typing.BinaryIO + if reading and writing: + buffer = io.BufferedRWPair(raw, raw, buffering) # type: ignore[assignment] + elif reading: + buffer = io.BufferedReader(raw, buffering) + else: + assert writing + buffer = io.BufferedWriter(raw, buffering) + if binary: + return buffer + text = io.TextIOWrapper(buffer, encoding, errors, newline) + text.mode = mode # type: ignore[misc] + return text + + def unwrap(self) -> None: + self._ssl_io_loop(self.sslobj.unwrap) + + def close(self) -> None: + self.socket.close() + + @typing.overload + def getpeercert( + self, binary_form: typing.Literal[False] = ... + ) -> _TYPE_PEER_CERT_RET_DICT | None: ... + + @typing.overload + def getpeercert(self, binary_form: typing.Literal[True]) -> bytes | None: ... + + def getpeercert(self, binary_form: bool = False) -> _TYPE_PEER_CERT_RET: + return self.sslobj.getpeercert(binary_form) # type: ignore[return-value] + + def version(self) -> str | None: + return self.sslobj.version() + + def cipher(self) -> tuple[str, str, int] | None: + return self.sslobj.cipher() + + def selected_alpn_protocol(self) -> str | None: + return self.sslobj.selected_alpn_protocol() + + def shared_ciphers(self) -> list[tuple[str, str, int]] | None: + return self.sslobj.shared_ciphers() + + def compression(self) -> str | None: + return self.sslobj.compression() + + def settimeout(self, value: float | None) -> None: + self.socket.settimeout(value) + + def gettimeout(self) -> float | None: + return self.socket.gettimeout() + + def _decref_socketios(self) -> None: + self.socket._decref_socketios() # type: ignore[attr-defined] + + def _wrap_ssl_read(self, len: int, buffer: bytearray | None = None) -> int | bytes: + try: + return self._ssl_io_loop(self.sslobj.read, len, buffer) + except ssl.SSLError as e: + if e.errno == ssl.SSL_ERROR_EOF and self.suppress_ragged_eofs: + return 0 # eof, return 0. + else: + raise + + # func is sslobj.do_handshake or sslobj.unwrap + @typing.overload + def _ssl_io_loop(self, func: typing.Callable[[], None]) -> None: ... + + # func is sslobj.write, arg1 is data + @typing.overload + def _ssl_io_loop(self, func: typing.Callable[[bytes], int], arg1: bytes) -> int: ... + + # func is sslobj.read, arg1 is len, arg2 is buffer + @typing.overload + def _ssl_io_loop( + self, + func: typing.Callable[[int, bytearray | None], bytes], + arg1: int, + arg2: bytearray | None, + ) -> bytes: ... + + def _ssl_io_loop( + self, + func: typing.Callable[..., _ReturnValue], + arg1: None | bytes | int = None, + arg2: bytearray | None = None, + ) -> _ReturnValue: + """Performs an I/O loop between incoming/outgoing and the socket.""" + should_loop = True + ret = None + + while should_loop: + errno = None + try: + if arg1 is None and arg2 is None: + ret = func() + elif arg2 is None: + ret = func(arg1) + else: + ret = func(arg1, arg2) + except ssl.SSLError as e: + if e.errno not in (ssl.SSL_ERROR_WANT_READ, ssl.SSL_ERROR_WANT_WRITE): + # WANT_READ, and WANT_WRITE are expected, others are not. + raise e + errno = e.errno + + buf = self.outgoing.read() + self.socket.sendall(buf) + + if errno is None: + should_loop = False + elif errno == ssl.SSL_ERROR_WANT_READ: + buf = self.socket.recv(SSL_BLOCKSIZE) + if buf: + self.incoming.write(buf) + else: + self.incoming.write_eof() + return typing.cast(_ReturnValue, ret) diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/timeout.py b/.venv/lib/python3.10/site-packages/urllib3/util/timeout.py new file mode 100644 index 0000000000000000000000000000000000000000..4bb1be11d9cb06900dd82ecebd06aa6a7c5de916 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/timeout.py @@ -0,0 +1,275 @@ +from __future__ import annotations + +import time +import typing +from enum import Enum +from socket import getdefaulttimeout + +from ..exceptions import TimeoutStateError + +if typing.TYPE_CHECKING: + from typing import Final + + +class _TYPE_DEFAULT(Enum): + # This value should never be passed to socket.settimeout() so for safety we use a -1. + # socket.settimout() raises a ValueError for negative values. + token = -1 + + +_DEFAULT_TIMEOUT: Final[_TYPE_DEFAULT] = _TYPE_DEFAULT.token + +_TYPE_TIMEOUT = typing.Optional[typing.Union[float, _TYPE_DEFAULT]] + + +class Timeout: + """Timeout configuration. + + Timeouts can be defined as a default for a pool: + + .. code-block:: python + + import urllib3 + + timeout = urllib3.util.Timeout(connect=2.0, read=7.0) + + http = urllib3.PoolManager(timeout=timeout) + + resp = http.request("GET", "https://example.com/") + + print(resp.status) + + Or per-request (which overrides the default for the pool): + + .. code-block:: python + + response = http.request("GET", "https://example.com/", timeout=Timeout(10)) + + Timeouts can be disabled by setting all the parameters to ``None``: + + .. code-block:: python + + no_timeout = Timeout(connect=None, read=None) + response = http.request("GET", "https://example.com/", timeout=no_timeout) + + + :param total: + This combines the connect and read timeouts into one; the read timeout + will be set to the time leftover from the connect attempt. In the + event that both a connect timeout and a total are specified, or a read + timeout and a total are specified, the shorter timeout will be applied. + + Defaults to None. + + :type total: int, float, or None + + :param connect: + The maximum amount of time (in seconds) to wait for a connection + attempt to a server to succeed. Omitting the parameter will default the + connect timeout to the system default, probably `the global default + timeout in socket.py + `_. + None will set an infinite timeout for connection attempts. + + :type connect: int, float, or None + + :param read: + The maximum amount of time (in seconds) to wait between consecutive + read operations for a response from the server. Omitting the parameter + will default the read timeout to the system default, probably `the + global default timeout in socket.py + `_. + None will set an infinite timeout. + + :type read: int, float, or None + + .. note:: + + Many factors can affect the total amount of time for urllib3 to return + an HTTP response. + + For example, Python's DNS resolver does not obey the timeout specified + on the socket. Other factors that can affect total request time include + high CPU load, high swap, the program running at a low priority level, + or other behaviors. + + In addition, the read and total timeouts only measure the time between + read operations on the socket connecting the client and the server, + not the total amount of time for the request to return a complete + response. For most requests, the timeout is raised because the server + has not sent the first byte in the specified time. This is not always + the case; if a server streams one byte every fifteen seconds, a timeout + of 20 seconds will not trigger, even though the request will take + several minutes to complete. + """ + + #: A sentinel object representing the default timeout value + DEFAULT_TIMEOUT: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT + + def __init__( + self, + total: _TYPE_TIMEOUT = None, + connect: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + read: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + ) -> None: + self._connect = self._validate_timeout(connect, "connect") + self._read = self._validate_timeout(read, "read") + self.total = self._validate_timeout(total, "total") + self._start_connect: float | None = None + + def __repr__(self) -> str: + return f"{type(self).__name__}(connect={self._connect!r}, read={self._read!r}, total={self.total!r})" + + # __str__ provided for backwards compatibility + __str__ = __repr__ + + @staticmethod + def resolve_default_timeout(timeout: _TYPE_TIMEOUT) -> float | None: + return getdefaulttimeout() if timeout is _DEFAULT_TIMEOUT else timeout + + @classmethod + def _validate_timeout(cls, value: _TYPE_TIMEOUT, name: str) -> _TYPE_TIMEOUT: + """Check that a timeout attribute is valid. + + :param value: The timeout value to validate + :param name: The name of the timeout attribute to validate. This is + used to specify in error messages. + :return: The validated and casted version of the given value. + :raises ValueError: If it is a numeric value less than or equal to + zero, or the type is not an integer, float, or None. + """ + if value is None or value is _DEFAULT_TIMEOUT: + return value + + if isinstance(value, bool): + raise ValueError( + "Timeout cannot be a boolean value. It must " + "be an int, float or None." + ) + try: + float(value) + except (TypeError, ValueError): + raise ValueError( + "Timeout value %s was %s, but it must be an " + "int, float or None." % (name, value) + ) from None + + try: + if value <= 0: + raise ValueError( + "Attempted to set %s timeout to %s, but the " + "timeout cannot be set to a value less " + "than or equal to 0." % (name, value) + ) + except TypeError: + raise ValueError( + "Timeout value %s was %s, but it must be an " + "int, float or None." % (name, value) + ) from None + + return value + + @classmethod + def from_float(cls, timeout: _TYPE_TIMEOUT) -> Timeout: + """Create a new Timeout from a legacy timeout value. + + The timeout value used by httplib.py sets the same timeout on the + connect(), and recv() socket requests. This creates a :class:`Timeout` + object that sets the individual timeouts to the ``timeout`` value + passed to this function. + + :param timeout: The legacy timeout value. + :type timeout: integer, float, :attr:`urllib3.util.Timeout.DEFAULT_TIMEOUT`, or None + :return: Timeout object + :rtype: :class:`Timeout` + """ + return Timeout(read=timeout, connect=timeout) + + def clone(self) -> Timeout: + """Create a copy of the timeout object + + Timeout properties are stored per-pool but each request needs a fresh + Timeout object to ensure each one has its own start/stop configured. + + :return: a copy of the timeout object + :rtype: :class:`Timeout` + """ + # We can't use copy.deepcopy because that will also create a new object + # for _GLOBAL_DEFAULT_TIMEOUT, which socket.py uses as a sentinel to + # detect the user default. + return Timeout(connect=self._connect, read=self._read, total=self.total) + + def start_connect(self) -> float: + """Start the timeout clock, used during a connect() attempt + + :raises urllib3.exceptions.TimeoutStateError: if you attempt + to start a timer that has been started already. + """ + if self._start_connect is not None: + raise TimeoutStateError("Timeout timer has already been started.") + self._start_connect = time.monotonic() + return self._start_connect + + def get_connect_duration(self) -> float: + """Gets the time elapsed since the call to :meth:`start_connect`. + + :return: Elapsed time in seconds. + :rtype: float + :raises urllib3.exceptions.TimeoutStateError: if you attempt + to get duration for a timer that hasn't been started. + """ + if self._start_connect is None: + raise TimeoutStateError( + "Can't get connect duration for timer that has not started." + ) + return time.monotonic() - self._start_connect + + @property + def connect_timeout(self) -> _TYPE_TIMEOUT: + """Get the value to use when setting a connection timeout. + + This will be a positive float or integer, the value None + (never timeout), or the default system timeout. + + :return: Connect timeout. + :rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None + """ + if self.total is None: + return self._connect + + if self._connect is None or self._connect is _DEFAULT_TIMEOUT: + return self.total + + return min(self._connect, self.total) # type: ignore[type-var] + + @property + def read_timeout(self) -> float | None: + """Get the value for the read timeout. + + This assumes some time has elapsed in the connection timeout and + computes the read timeout appropriately. + + If self.total is set, the read timeout is dependent on the amount of + time taken by the connect timeout. If the connection time has not been + established, a :exc:`~urllib3.exceptions.TimeoutStateError` will be + raised. + + :return: Value to use for the read timeout. + :rtype: int, float or None + :raises urllib3.exceptions.TimeoutStateError: If :meth:`start_connect` + has not yet been called on this object. + """ + if ( + self.total is not None + and self.total is not _DEFAULT_TIMEOUT + and self._read is not None + and self._read is not _DEFAULT_TIMEOUT + ): + # In case the connect timeout has not yet been established. + if self._start_connect is None: + return self._read + return max(0, min(self.total - self.get_connect_duration(), self._read)) + elif self.total is not None and self.total is not _DEFAULT_TIMEOUT: + return max(0, self.total - self.get_connect_duration()) + else: + return self.resolve_default_timeout(self._read) diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/url.py b/.venv/lib/python3.10/site-packages/urllib3/util/url.py new file mode 100644 index 0000000000000000000000000000000000000000..db057f17be610174f30928748b5004dcbf6c501c --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/url.py @@ -0,0 +1,469 @@ +from __future__ import annotations + +import re +import typing + +from ..exceptions import LocationParseError +from .util import to_str + +# We only want to normalize urls with an HTTP(S) scheme. +# urllib3 infers URLs without a scheme (None) to be http. +_NORMALIZABLE_SCHEMES = ("http", "https", None) + +# Almost all of these patterns were derived from the +# 'rfc3986' module: https://github.com/python-hyper/rfc3986 +_PERCENT_RE = re.compile(r"%[a-fA-F0-9]{2}") +_SCHEME_RE = re.compile(r"^(?:[a-zA-Z][a-zA-Z0-9+-]*:|/)") +_URI_RE = re.compile( + r"^(?:([a-zA-Z][a-zA-Z0-9+.-]*):)?" + r"(?://([^\\/?#]*))?" + r"([^?#]*)" + r"(?:\?([^#]*))?" + r"(?:#(.*))?$", + re.UNICODE | re.DOTALL, +) + +_IPV4_PAT = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" +_HEX_PAT = "[0-9A-Fa-f]{1,4}" +_LS32_PAT = "(?:{hex}:{hex}|{ipv4})".format(hex=_HEX_PAT, ipv4=_IPV4_PAT) +_subs = {"hex": _HEX_PAT, "ls32": _LS32_PAT} +_variations = [ + # 6( h16 ":" ) ls32 + "(?:%(hex)s:){6}%(ls32)s", + # "::" 5( h16 ":" ) ls32 + "::(?:%(hex)s:){5}%(ls32)s", + # [ h16 ] "::" 4( h16 ":" ) ls32 + "(?:%(hex)s)?::(?:%(hex)s:){4}%(ls32)s", + # [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 + "(?:(?:%(hex)s:)?%(hex)s)?::(?:%(hex)s:){3}%(ls32)s", + # [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 + "(?:(?:%(hex)s:){0,2}%(hex)s)?::(?:%(hex)s:){2}%(ls32)s", + # [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 + "(?:(?:%(hex)s:){0,3}%(hex)s)?::%(hex)s:%(ls32)s", + # [ *4( h16 ":" ) h16 ] "::" ls32 + "(?:(?:%(hex)s:){0,4}%(hex)s)?::%(ls32)s", + # [ *5( h16 ":" ) h16 ] "::" h16 + "(?:(?:%(hex)s:){0,5}%(hex)s)?::%(hex)s", + # [ *6( h16 ":" ) h16 ] "::" + "(?:(?:%(hex)s:){0,6}%(hex)s)?::", +] + +_UNRESERVED_PAT = r"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._\-~" +_IPV6_PAT = "(?:" + "|".join([x % _subs for x in _variations]) + ")" +_ZONE_ID_PAT = "(?:%25|%)(?:[" + _UNRESERVED_PAT + "]|%[a-fA-F0-9]{2})+" +_IPV6_ADDRZ_PAT = r"\[" + _IPV6_PAT + r"(?:" + _ZONE_ID_PAT + r")?\]" +_REG_NAME_PAT = r"(?:[^\[\]%:/?#]|%[a-fA-F0-9]{2})*" +_TARGET_RE = re.compile(r"^(/[^?#]*)(?:\?([^#]*))?(?:#.*)?$") + +_IPV4_RE = re.compile("^" + _IPV4_PAT + "$") +_IPV6_RE = re.compile("^" + _IPV6_PAT + "$") +_IPV6_ADDRZ_RE = re.compile("^" + _IPV6_ADDRZ_PAT + "$") +_BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + _IPV6_ADDRZ_PAT[2:-2] + "$") +_ZONE_ID_RE = re.compile("(" + _ZONE_ID_PAT + r")\]$") + +_HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*?(|0|[1-9][0-9]{0,4}))?$") % ( + _REG_NAME_PAT, + _IPV4_PAT, + _IPV6_ADDRZ_PAT, +) +_HOST_PORT_RE = re.compile(_HOST_PORT_PAT, re.UNICODE | re.DOTALL) + +_UNRESERVED_CHARS = set( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-~" +) +_SUB_DELIM_CHARS = set("!$&'()*+,;=") +_USERINFO_CHARS = _UNRESERVED_CHARS | _SUB_DELIM_CHARS | {":"} +_PATH_CHARS = _USERINFO_CHARS | {"@", "/"} +_QUERY_CHARS = _FRAGMENT_CHARS = _PATH_CHARS | {"?"} + + +class Url( + typing.NamedTuple( + "Url", + [ + ("scheme", typing.Optional[str]), + ("auth", typing.Optional[str]), + ("host", typing.Optional[str]), + ("port", typing.Optional[int]), + ("path", typing.Optional[str]), + ("query", typing.Optional[str]), + ("fragment", typing.Optional[str]), + ], + ) +): + """ + Data structure for representing an HTTP URL. Used as a return value for + :func:`parse_url`. Both the scheme and host are normalized as they are + both case-insensitive according to RFC 3986. + """ + + def __new__( # type: ignore[no-untyped-def] + cls, + scheme: str | None = None, + auth: str | None = None, + host: str | None = None, + port: int | None = None, + path: str | None = None, + query: str | None = None, + fragment: str | None = None, + ): + if path and not path.startswith("/"): + path = "/" + path + if scheme is not None: + scheme = scheme.lower() + return super().__new__(cls, scheme, auth, host, port, path, query, fragment) + + @property + def hostname(self) -> str | None: + """For backwards-compatibility with urlparse. We're nice like that.""" + return self.host + + @property + def request_uri(self) -> str: + """Absolute path including the query string.""" + uri = self.path or "/" + + if self.query is not None: + uri += "?" + self.query + + return uri + + @property + def authority(self) -> str | None: + """ + Authority component as defined in RFC 3986 3.2. + This includes userinfo (auth), host and port. + + i.e. + userinfo@host:port + """ + userinfo = self.auth + netloc = self.netloc + if netloc is None or userinfo is None: + return netloc + else: + return f"{userinfo}@{netloc}" + + @property + def netloc(self) -> str | None: + """ + Network location including host and port. + + If you need the equivalent of urllib.parse's ``netloc``, + use the ``authority`` property instead. + """ + if self.host is None: + return None + if self.port: + return f"{self.host}:{self.port}" + return self.host + + @property + def url(self) -> str: + """ + Convert self into a url + + This function should more or less round-trip with :func:`.parse_url`. The + returned url may not be exactly the same as the url inputted to + :func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls + with a blank port will have : removed). + + Example: + + .. code-block:: python + + import urllib3 + + U = urllib3.util.parse_url("https://google.com/mail/") + + print(U.url) + # "https://google.com/mail/" + + print( urllib3.util.Url("https", "username:password", + "host.com", 80, "/path", "query", "fragment" + ).url + ) + # "https://username:password@host.com:80/path?query#fragment" + """ + scheme, auth, host, port, path, query, fragment = self + url = "" + + # We use "is not None" we want things to happen with empty strings (or 0 port) + if scheme is not None: + url += scheme + "://" + if auth is not None: + url += auth + "@" + if host is not None: + url += host + if port is not None: + url += ":" + str(port) + if path is not None: + url += path + if query is not None: + url += "?" + query + if fragment is not None: + url += "#" + fragment + + return url + + def __str__(self) -> str: + return self.url + + +@typing.overload +def _encode_invalid_chars( + component: str, allowed_chars: typing.Container[str] +) -> str: # Abstract + ... + + +@typing.overload +def _encode_invalid_chars( + component: None, allowed_chars: typing.Container[str] +) -> None: # Abstract + ... + + +def _encode_invalid_chars( + component: str | None, allowed_chars: typing.Container[str] +) -> str | None: + """Percent-encodes a URI component without reapplying + onto an already percent-encoded component. + """ + if component is None: + return component + + component = to_str(component) + + # Normalize existing percent-encoded bytes. + # Try to see if the component we're encoding is already percent-encoded + # so we can skip all '%' characters but still encode all others. + component, percent_encodings = _PERCENT_RE.subn( + lambda match: match.group(0).upper(), component + ) + + uri_bytes = component.encode("utf-8", "surrogatepass") + is_percent_encoded = percent_encodings == uri_bytes.count(b"%") + encoded_component = bytearray() + + for i in range(0, len(uri_bytes)): + # Will return a single character bytestring + byte = uri_bytes[i : i + 1] + byte_ord = ord(byte) + if (is_percent_encoded and byte == b"%") or ( + byte_ord < 128 and byte.decode() in allowed_chars + ): + encoded_component += byte + continue + encoded_component.extend(b"%" + (hex(byte_ord)[2:].encode().zfill(2).upper())) + + return encoded_component.decode() + + +def _remove_path_dot_segments(path: str) -> str: + # See http://tools.ietf.org/html/rfc3986#section-5.2.4 for pseudo-code + segments = path.split("/") # Turn the path into a list of segments + output = [] # Initialize the variable to use to store output + + for segment in segments: + # '.' is the current directory, so ignore it, it is superfluous + if segment == ".": + continue + # Anything other than '..', should be appended to the output + if segment != "..": + output.append(segment) + # In this case segment == '..', if we can, we should pop the last + # element + elif output: + output.pop() + + # If the path starts with '/' and the output is empty or the first string + # is non-empty + if path.startswith("/") and (not output or output[0]): + output.insert(0, "") + + # If the path starts with '/.' or '/..' ensure we add one more empty + # string to add a trailing '/' + if path.endswith(("/.", "/..")): + output.append("") + + return "/".join(output) + + +@typing.overload +def _normalize_host(host: None, scheme: str | None) -> None: ... + + +@typing.overload +def _normalize_host(host: str, scheme: str | None) -> str: ... + + +def _normalize_host(host: str | None, scheme: str | None) -> str | None: + if host: + if scheme in _NORMALIZABLE_SCHEMES: + is_ipv6 = _IPV6_ADDRZ_RE.match(host) + if is_ipv6: + # IPv6 hosts of the form 'a::b%zone' are encoded in a URL as + # such per RFC 6874: 'a::b%25zone'. Unquote the ZoneID + # separator as necessary to return a valid RFC 4007 scoped IP. + match = _ZONE_ID_RE.search(host) + if match: + start, end = match.span(1) + zone_id = host[start:end] + + if zone_id.startswith("%25") and zone_id != "%25": + zone_id = zone_id[3:] + else: + zone_id = zone_id[1:] + zone_id = _encode_invalid_chars(zone_id, _UNRESERVED_CHARS) + return f"{host[:start].lower()}%{zone_id}{host[end:]}" + else: + return host.lower() + elif not _IPV4_RE.match(host): + return to_str( + b".".join([_idna_encode(label) for label in host.split(".")]), + "ascii", + ) + return host + + +def _idna_encode(name: str) -> bytes: + if not name.isascii(): + try: + import idna + except ImportError: + raise LocationParseError( + "Unable to parse URL without the 'idna' module" + ) from None + + try: + return idna.encode(name.lower(), strict=True, std3_rules=True) + except idna.IDNAError: + raise LocationParseError( + f"Name '{name}' is not a valid IDNA label" + ) from None + + return name.lower().encode("ascii") + + +def _encode_target(target: str) -> str: + """Percent-encodes a request target so that there are no invalid characters + + Pre-condition for this function is that 'target' must start with '/'. + If that is the case then _TARGET_RE will always produce a match. + """ + match = _TARGET_RE.match(target) + if not match: # Defensive: + raise LocationParseError(f"{target!r} is not a valid request URI") + + path, query = match.groups() + encoded_target = _encode_invalid_chars(path, _PATH_CHARS) + if query is not None: + query = _encode_invalid_chars(query, _QUERY_CHARS) + encoded_target += "?" + query + return encoded_target + + +def parse_url(url: str) -> Url: + """ + Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is + performed to parse incomplete urls. Fields not provided will be None. + This parser is RFC 3986 and RFC 6874 compliant. + + The parser logic and helper functions are based heavily on + work done in the ``rfc3986`` module. + + :param str url: URL to parse into a :class:`.Url` namedtuple. + + Partly backwards-compatible with :mod:`urllib.parse`. + + Example: + + .. code-block:: python + + import urllib3 + + print( urllib3.util.parse_url('http://google.com/mail/')) + # Url(scheme='http', host='google.com', port=None, path='/mail/', ...) + + print( urllib3.util.parse_url('google.com:80')) + # Url(scheme=None, host='google.com', port=80, path=None, ...) + + print( urllib3.util.parse_url('/foo?bar')) + # Url(scheme=None, host=None, port=None, path='/foo', query='bar', ...) + """ + if not url: + # Empty + return Url() + + source_url = url + if not _SCHEME_RE.search(url): + url = "//" + url + + scheme: str | None + authority: str | None + auth: str | None + host: str | None + port: str | None + port_int: int | None + path: str | None + query: str | None + fragment: str | None + + try: + scheme, authority, path, query, fragment = _URI_RE.match(url).groups() # type: ignore[union-attr] + normalize_uri = scheme is None or scheme.lower() in _NORMALIZABLE_SCHEMES + + if scheme: + scheme = scheme.lower() + + if authority: + auth, _, host_port = authority.rpartition("@") + auth = auth or None + host, port = _HOST_PORT_RE.match(host_port).groups() # type: ignore[union-attr] + if auth and normalize_uri: + auth = _encode_invalid_chars(auth, _USERINFO_CHARS) + if port == "": + port = None + else: + auth, host, port = None, None, None + + if port is not None: + port_int = int(port) + if not (0 <= port_int <= 65535): + raise LocationParseError(url) + else: + port_int = None + + host = _normalize_host(host, scheme) + + if normalize_uri and path: + path = _remove_path_dot_segments(path) + path = _encode_invalid_chars(path, _PATH_CHARS) + if normalize_uri and query: + query = _encode_invalid_chars(query, _QUERY_CHARS) + if normalize_uri and fragment: + fragment = _encode_invalid_chars(fragment, _FRAGMENT_CHARS) + + except (ValueError, AttributeError) as e: + raise LocationParseError(source_url) from e + + # For the sake of backwards compatibility we put empty + # string values for path if there are any defined values + # beyond the path in the URL. + # TODO: Remove this when we break backwards compatibility. + if not path: + if query is not None or fragment is not None: + path = "" + else: + path = None + + return Url( + scheme=scheme, + auth=auth, + host=host, + port=port_int, + path=path, + query=query, + fragment=fragment, + ) diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/util.py b/.venv/lib/python3.10/site-packages/urllib3/util/util.py new file mode 100644 index 0000000000000000000000000000000000000000..35c77e4025842f548565334a3c04cba90f9283d6 --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/util.py @@ -0,0 +1,42 @@ +from __future__ import annotations + +import typing +from types import TracebackType + + +def to_bytes( + x: str | bytes, encoding: str | None = None, errors: str | None = None +) -> bytes: + if isinstance(x, bytes): + return x + elif not isinstance(x, str): + raise TypeError(f"not expecting type {type(x).__name__}") + if encoding or errors: + return x.encode(encoding or "utf-8", errors=errors or "strict") + return x.encode() + + +def to_str( + x: str | bytes, encoding: str | None = None, errors: str | None = None +) -> str: + if isinstance(x, str): + return x + elif not isinstance(x, bytes): + raise TypeError(f"not expecting type {type(x).__name__}") + if encoding or errors: + return x.decode(encoding or "utf-8", errors=errors or "strict") + return x.decode() + + +def reraise( + tp: type[BaseException] | None, + value: BaseException, + tb: TracebackType | None = None, +) -> typing.NoReturn: + try: + if value.__traceback__ is not tb: + raise value.with_traceback(tb) + raise value + finally: + value = None # type: ignore[assignment] + tb = None diff --git a/.venv/lib/python3.10/site-packages/urllib3/util/wait.py b/.venv/lib/python3.10/site-packages/urllib3/util/wait.py new file mode 100644 index 0000000000000000000000000000000000000000..aeca0c7ad5b232eeb1ad9c43d315bd1d74eaed9a --- /dev/null +++ b/.venv/lib/python3.10/site-packages/urllib3/util/wait.py @@ -0,0 +1,124 @@ +from __future__ import annotations + +import select +import socket +from functools import partial + +__all__ = ["wait_for_read", "wait_for_write"] + + +# How should we wait on sockets? +# +# There are two types of APIs you can use for waiting on sockets: the fancy +# modern stateful APIs like epoll/kqueue, and the older stateless APIs like +# select/poll. The stateful APIs are more efficient when you have a lots of +# sockets to keep track of, because you can set them up once and then use them +# lots of times. But we only ever want to wait on a single socket at a time +# and don't want to keep track of state, so the stateless APIs are actually +# more efficient. So we want to use select() or poll(). +# +# Now, how do we choose between select() and poll()? On traditional Unixes, +# select() has a strange calling convention that makes it slow, or fail +# altogether, for high-numbered file descriptors. The point of poll() is to fix +# that, so on Unixes, we prefer poll(). +# +# On Windows, there is no poll() (or at least Python doesn't provide a wrapper +# for it), but that's OK, because on Windows, select() doesn't have this +# strange calling convention; plain select() works fine. +# +# So: on Windows we use select(), and everywhere else we use poll(). We also +# fall back to select() in case poll() is somehow broken or missing. + + +def select_wait_for_socket( + sock: socket.socket, + read: bool = False, + write: bool = False, + timeout: float | None = None, +) -> bool: + if not read and not write: + raise RuntimeError("must specify at least one of read=True, write=True") + rcheck = [] + wcheck = [] + if read: + rcheck.append(sock) + if write: + wcheck.append(sock) + # When doing a non-blocking connect, most systems signal success by + # marking the socket writable. Windows, though, signals success by marked + # it as "exceptional". We paper over the difference by checking the write + # sockets for both conditions. (The stdlib selectors module does the same + # thing.) + fn = partial(select.select, rcheck, wcheck, wcheck) + rready, wready, xready = fn(timeout) + return bool(rready or wready or xready) + + +def poll_wait_for_socket( + sock: socket.socket, + read: bool = False, + write: bool = False, + timeout: float | None = None, +) -> bool: + if not read and not write: + raise RuntimeError("must specify at least one of read=True, write=True") + mask = 0 + if read: + mask |= select.POLLIN + if write: + mask |= select.POLLOUT + poll_obj = select.poll() + poll_obj.register(sock, mask) + + # For some reason, poll() takes timeout in milliseconds + def do_poll(t: float | None) -> list[tuple[int, int]]: + if t is not None: + t *= 1000 + return poll_obj.poll(t) + + return bool(do_poll(timeout)) + + +def _have_working_poll() -> bool: + # Apparently some systems have a select.poll that fails as soon as you try + # to use it, either due to strange configuration or broken monkeypatching + # from libraries like eventlet/greenlet. + try: + poll_obj = select.poll() + poll_obj.poll(0) + except (AttributeError, OSError): + return False + else: + return True + + +def wait_for_socket( + sock: socket.socket, + read: bool = False, + write: bool = False, + timeout: float | None = None, +) -> bool: + # We delay choosing which implementation to use until the first time we're + # called. We could do it at import time, but then we might make the wrong + # decision if someone goes wild with monkeypatching select.poll after + # we're imported. + global wait_for_socket + if _have_working_poll(): + wait_for_socket = poll_wait_for_socket + elif hasattr(select, "select"): + wait_for_socket = select_wait_for_socket + return wait_for_socket(sock, read, write, timeout) + + +def wait_for_read(sock: socket.socket, timeout: float | None = None) -> bool: + """Waits for reading to be available on a given socket. + Returns True if the socket is readable, or False if the timeout expired. + """ + return wait_for_socket(sock, read=True, timeout=timeout) + + +def wait_for_write(sock: socket.socket, timeout: float | None = None) -> bool: + """Waits for writing to be available on a given socket. + Returns True if the socket is readable, or False if the timeout expired. + """ + return wait_for_socket(sock, write=True, timeout=timeout)